From 0d03a34a13f6be28bbe0fa462ef85188f70f51b6 Mon Sep 17 00:00:00 2001 From: Andrea Amorese Date: Mon, 6 Sep 2021 14:52:24 +0200 Subject: [PATCH] Built motion from commit 1644b69e.|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 +- .../teamVoicePrefix/teamVoicePrefix.attributes.js | 2 +- .../api/teamVoicePrefix/teamVoicePrefix.model.js | 2 +- server/api/teamVoiceQueue/index.js | 2 +- .../teamVoiceQueue/teamVoiceQueue.attributes.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.model.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.rpc.js | 2 +- server/api/template/index.js | 2 +- server/api/template/template.attributes.js | 2 +- server/api/template/template.controller.js | 2 +- server/api/template/template.model.js | 2 +- server/api/template/template.rpc.js | 2 +- server/api/trigger/index.js | 2 +- server/api/trigger/trigger.attributes.js | 2 +- server/api/trigger/trigger.controller.js | 2 +- server/api/trigger/trigger.model.js | 2 +- server/api/trigger/trigger.rpc.js | 2 +- server/api/trunk/index.js | 2 +- server/api/trunk/trunk.attributes.js | 2 +- server/api/trunk/trunk.controller.js | 2 +- server/api/trunk/trunk.model.js | 2 +- server/api/trunk/trunk.rpc.js | 2 +- server/api/user/index.js | 2 +- server/api/user/user.attributes.js | 2 +- server/api/user/user.controller.js | 2 +- server/api/user/user.events.js | 2 +- server/api/user/user.model.js | 2 +- server/api/user/user.rpc.js | 2 +- server/api/user/user.socket.js | 2 +- server/api/userChatQueue/index.js | 2 +- .../api/userChatQueue/userChatQueue.attributes.js | 2 +- server/api/userChatQueue/userChatQueue.model.js | 2 +- server/api/userChatQueue/userChatQueue.rpc.js | 2 +- server/api/userFaxQueue/index.js | 2 +- server/api/userFaxQueue/userFaxQueue.attributes.js | 2 +- server/api/userFaxQueue/userFaxQueue.model.js | 2 +- server/api/userFaxQueue/userFaxQueue.rpc.js | 2 +- server/api/userMailQueue/index.js | 2 +- .../api/userMailQueue/userMailQueue.attributes.js | 2 +- server/api/userMailQueue/userMailQueue.model.js | 2 +- server/api/userMailQueue/userMailQueue.rpc.js | 2 +- server/api/userNotification/index.js | 2 +- .../userNotification.attributes.js | 2 +- .../userNotification.controller.js | 2 +- .../userNotification/userNotification.events.js | 2 +- .../api/userNotification/userNotification.model.js | 2 +- .../api/userNotification/userNotification.rpc.js | 2 +- .../userNotification/userNotification.socket.js | 2 +- server/api/userOpenchannelQueue/index.js | 2 +- .../userOpenchannelQueue.attributes.js | 2 +- .../userOpenchannelQueue.model.js | 2 +- .../userOpenchannelQueue.rpc.js | 2 +- server/api/userProfile/index.js | 2 +- server/api/userProfile/userProfile.attributes.js | 2 +- server/api/userProfile/userProfile.controller.js | 2 +- server/api/userProfile/userProfile.events.js | 2 +- server/api/userProfile/userProfile.model.js | 2 +- server/api/userProfile/userProfile.rpc.js | 2 +- server/api/userProfile/userProfile.socket.js | 2 +- server/api/userProfileResource/index.js | 2 +- .../userProfileResource.attributes.js | 2 +- .../userProfileResource.controller.js | 2 +- .../userProfileResource.model.js | 2 +- .../userProfileResource/userProfileResource.rpc.js | 2 +- server/api/userProfileSection/index.js | 2 +- .../userProfileSection.attributes.js | 2 +- .../userProfileSection.controller.js | 2 +- .../userProfileSection/userProfileSection.model.js | 2 +- .../userProfileSection/userProfileSection.rpc.js | 2 +- server/api/userSmsQueue/index.js | 2 +- server/api/userSmsQueue/userSmsQueue.attributes.js | 2 +- server/api/userSmsQueue/userSmsQueue.model.js | 2 +- server/api/userSmsQueue/userSmsQueue.rpc.js | 2 +- .../userVoicePrefix/userVoicePrefix.attributes.js | 2 +- .../api/userVoicePrefix/userVoicePrefix.model.js | 2 +- server/api/userVoiceQueue/index.js | 2 +- .../userVoiceQueue/userVoiceQueue.attributes.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.model.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.rpc.js | 2 +- server/api/userVoiceQueueRt/index.js | 2 +- .../userVoiceQueueRt.attributes.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.events.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.model.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.rpc.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.socket.js | 2 +- server/api/userWhatsappQueue/index.js | 2 +- .../userWhatsappQueue.attributes.js | 2 +- .../userWhatsappQueue/userWhatsappQueue.model.js | 2 +- .../api/userWhatsappQueue/userWhatsappQueue.rpc.js | 2 +- server/api/variable/index.js | 2 +- server/api/variable/variable.attributes.js | 2 +- server/api/variable/variable.controller.js | 2 +- server/api/variable/variable.model.js | 2 +- server/api/variable/variable.rpc.js | 2 +- server/api/version/index.js | 2 +- server/api/version/version.controller.js | 2 +- server/api/voiceAgentReport/index.js | 2 +- .../voiceAgentReport.attributes.js | 2 +- .../voiceAgentReport.controller.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.model.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.rpc.js | 2 +- server/api/voiceCallReport/index.js | 2 +- .../voiceCallReport/voiceCallReport.attributes.js | 2 +- .../voiceCallReport/voiceCallReport.controller.js | 2 +- .../api/voiceCallReport/voiceCallReport.model.js | 2 +- server/api/voiceCallReport/voiceCallReport.rpc.js | 2 +- server/api/voiceChanSpy/index.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.attributes.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.controller.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.model.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.rpc.js | 2 +- server/api/voiceContext/index.js | 2 +- server/api/voiceContext/voiceContext.attributes.js | 2 +- server/api/voiceContext/voiceContext.controller.js | 2 +- server/api/voiceContext/voiceContext.model.js | 2 +- server/api/voiceContext/voiceContext.rpc.js | 2 +- server/api/voiceDialReport/index.js | 2 +- .../voiceDialReport/voiceDialReport.attributes.js | 2 +- .../voiceDialReport/voiceDialReport.controller.js | 2 +- .../api/voiceDialReport/voiceDialReport.model.js | 2 +- server/api/voiceDialReport/voiceDialReport.rpc.js | 2 +- server/api/voiceExtension/index.js | 2 +- .../voiceExtension/voiceExtension.attributes.js | 2 +- .../voiceExtension/voiceExtension.controller.js | 2 +- server/api/voiceExtension/voiceExtension.events.js | 2 +- server/api/voiceExtension/voiceExtension.model.js | 2 +- server/api/voiceExtension/voiceExtension.rpc.js | 2 +- server/api/voiceExtension/voiceExtension.socket.js | 2 +- server/api/voiceMail/index.js | 2 +- server/api/voiceMail/voiceMail.attributes.js | 2 +- server/api/voiceMail/voiceMail.controller.js | 2 +- server/api/voiceMail/voiceMail.model.js | 2 +- server/api/voiceMail/voiceMail.rpc.js | 2 +- server/api/voiceMailMessage/index.js | 2 +- .../voiceMailMessage.attributes.js | 2 +- .../voiceMailMessage.controller.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.model.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.rpc.js | 2 +- server/api/voiceMusicOnHold/index.js | 2 +- .../voiceMusicOnHold.attributes.js | 2 +- .../voiceMusicOnHold.controller.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.model.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.rpc.js | 2 +- server/api/voicePrefix/index.js | 2 +- server/api/voicePrefix/voicePrefix.attributes.js | 2 +- server/api/voicePrefix/voicePrefix.controller.js | 2 +- server/api/voicePrefix/voicePrefix.events.js | 2 +- server/api/voicePrefix/voicePrefix.model.js | 2 +- server/api/voicePrefix/voicePrefix.rpc.js | 2 +- server/api/voicePrefix/voicePrefix.socket.js | 2 +- server/api/voiceQueue/index.js | 2 +- server/api/voiceQueue/voiceQueue.attributes.js | 2 +- server/api/voiceQueue/voiceQueue.controller.js | 2 +- server/api/voiceQueue/voiceQueue.events.js | 2 +- server/api/voiceQueue/voiceQueue.model.js | 2 +- server/api/voiceQueue/voiceQueue.rpc.js | 2 +- server/api/voiceQueue/voiceQueue.socket.js | 2 +- server/api/voiceQueueReport/index.js | 2 +- .../voiceQueueReport.attributes.js | 2 +- .../voiceQueueReport.controller.js | 2 +- .../voiceQueueReport/voiceQueueReport.events.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.model.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.rpc.js | 2 +- .../voiceQueueReport/voiceQueueReport.socket.js | 2 +- server/api/voiceQueuesLog/index.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.attributes.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.controller.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.model.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.rpc.js | 2 +- server/api/voiceRecording/index.js | 2 +- .../voiceRecording/voiceRecording.attributes.js | 2 +- .../voiceRecording/voiceRecording.controller.js | 2 +- server/api/voiceRecording/voiceRecording.model.js | 2 +- server/api/voiceRecording/voiceRecording.rpc.js | 2 +- server/api/voiceTransferReport/index.js | 2 +- .../voiceTransferReport.attributes.js | 2 +- .../voiceTransferReport.controller.js | 2 +- .../voiceTransferReport.model.js | 2 +- .../voiceTransferReport/voiceTransferReport.rpc.js | 2 +- server/api/webbar/index.js | 2 +- server/api/webbar/webbar.controller.js | 2 +- server/api/whatsappAccount/index.js | 2 +- .../whatsappAccount/whatsappAccount.attributes.js | 2 +- .../whatsappAccount/whatsappAccount.controller.js | 2 +- .../api/whatsappAccount/whatsappAccount.events.js | 2 +- .../api/whatsappAccount/whatsappAccount.model.js | 2 +- server/api/whatsappAccount/whatsappAccount.rpc.js | 2 +- .../api/whatsappAccount/whatsappAccount.socket.js | 2 +- server/api/whatsappApplication/index.js | 2 +- .../whatsappApplication.attributes.js | 2 +- .../whatsappApplication.controller.js | 2 +- .../whatsappApplication.model.js | 2 +- .../whatsappApplication/whatsappApplication.rpc.js | 2 +- server/api/whatsappInteraction/index.js | 2 +- .../whatsappInteraction.attributes.js | 2 +- .../whatsappInteraction.controller.js | 2 +- .../whatsappInteraction.events.js | 2 +- .../whatsappInteraction.model.js | 2 +- .../whatsappInteraction/whatsappInteraction.rpc.js | 2 +- .../whatsappInteraction.socket.js | 2 +- server/api/whatsappMessage/index.js | 2 +- .../whatsappMessage/whatsappMessage.attributes.js | 2 +- .../whatsappMessage/whatsappMessage.controller.js | 2 +- .../api/whatsappMessage/whatsappMessage.events.js | 2 +- .../api/whatsappMessage/whatsappMessage.model.js | 2 +- server/api/whatsappMessage/whatsappMessage.rpc.js | 2 +- .../api/whatsappMessage/whatsappMessage.socket.js | 2 +- server/api/whatsappQueue/index.js | 2 +- .../api/whatsappQueue/whatsappQueue.attributes.js | 2 +- .../api/whatsappQueue/whatsappQueue.controller.js | 2 +- server/api/whatsappQueue/whatsappQueue.events.js | 2 +- server/api/whatsappQueue/whatsappQueue.model.js | 2 +- server/api/whatsappQueue/whatsappQueue.rpc.js | 2 +- server/api/whatsappQueue/whatsappQueue.socket.js | 2 +- server/api/whatsappQueueReport/index.js | 2 +- .../whatsappQueueReport.attributes.js | 2 +- .../whatsappQueueReport.controller.js | 2 +- .../whatsappQueueReport.model.js | 2 +- .../whatsappQueueReport/whatsappQueueReport.rpc.js | 2 +- server/api/whatsappTransferReport/index.js | 2 +- .../whatsappTransferReport.attributes.js | 2 +- .../whatsappTransferReport.controller.js | 2 +- .../whatsappTransferReport.model.js | 2 +- .../whatsappTransferReport.rpc.js | 2 +- server/app.js | 2 +- server/components/auth/service.js | 2 +- server/components/encryptor/index.js | 2 +- server/components/export/csv.js | 2 +- server/components/export/pdf.js | 2 +- server/components/export/xlsx.js | 2 +- server/components/extensions/rewrite.js | 2 +- server/components/import/cm/csv.js | 2 +- server/components/import/cm/csv2.js | 2 +- server/components/integrations/configuration.js | 2 +- server/components/interaction/service.js | 2 +- server/components/license/service.js | 2 +- server/components/parsers/advancedSearch.js | 2 +- server/components/parsers/qs.js | 2 +- server/config/express.js | 2 +- server/config/license/hardware.js | 2 +- server/config/license/index.js | 2 +- server/config/license/util.js | 2 +- server/config/local.env.js | 2 +- server/config/logger.js | 2 +- server/config/pm2/config.js | 2 +- server/config/pm2/index.js | 2 +- server/config/schedule/chat.js | 2 +- server/config/schedule/index.js | 2 +- server/config/schedule/transcribe.js | 2 +- server/config/schedule/whatsapp.js | 2 +- server/config/seedContact.js | 2 +- server/config/seedUsers.js | 2 +- server/config/socketio.js | 2 +- server/config/triggers/index.js | 2 +- server/config/utils.js | 2 +- server/errors/index.js | 2 +- server/mysqldb/index.js | 2 +- server/routes.js | 2 +- server/rpc/index.js | 2 +- server/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 +- 1151 files changed, 1151 insertions(+), 1151 deletions(-) diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 69e77db..229cad8 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-06T12:29:21.798Z", + "time": "2021-09-06T12:41:38.576Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 2cb94a6..149402f 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-06T12:29:21.798Z", + "time": "2021-09-06T12:41:38.576Z", "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 7b0035a..0a2630b 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 _0x6657=['contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','urlForward[timeout],\x20browser[windowWidth]','TEXT','sequelize','VIRTUAL','getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'];(function(_0x4e0de1,_0x251835){var _0x507b73=function(_0x4353b7){while(--_0x4353b7){_0x4e0de1['push'](_0x4e0de1['shift']());}};_0x507b73(++_0x251835);}(_0x6657,0x17f));var _0x7665=function(_0x53691d,_0x5d11a2){_0x53691d=_0x53691d-0x0;var _0x4849b0=_0x6657[_0x53691d];return _0x4849b0;};'use strict';var Sequelize=require(_0x7665('0x0'));module['exports']={'name':{'type':Sequelize[_0x7665('0x1')],'get':function(_0x43c954){return this[_0x7665('0x2')](_0x7665('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x7665('0x4'),_0x7665('0x5'),_0x7665('0x6'),_0x7665('0x7'),_0x7665('0x8'),_0x7665('0x9'),_0x7665('0xa'),_0x7665('0xb')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x7665('0xc')},'data1':{'type':Sequelize[_0x7665('0xd')](0x1000),'comment':_0x7665('0xe')},'data2':{'type':Sequelize[_0x7665('0xd')](0x1000),'comment':_0x7665('0xf')},'data3':{'type':Sequelize[_0x7665('0xd')](0x1000),'comment':_0x7665('0x10')},'data4':{'type':Sequelize[_0x7665('0xd')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize[_0x7665('0xd')](0x1000),'comments':_0x7665('0x11')},'data6':{'type':Sequelize[_0x7665('0xd')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x7665('0x12')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x0618=['motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','getDataValue','contactManager','integration'];(function(_0x6e9a2c,_0x500106){var _0x4e331b=function(_0x4e8711){while(--_0x4e8711){_0x6e9a2c['push'](_0x6e9a2c['shift']());}};_0x4e331b(++_0x500106);}(_0x0618,0x1c6));var _0x8061=function(_0x32e68f,_0x57a2df){_0x32e68f=_0x32e68f-0x0;var _0x31ce49=_0x0618[_0x32e68f];return _0x31ce49;};'use strict';var Sequelize=require(_0x8061('0x0'));module[_0x8061('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x973865){return this[_0x8061('0x2')]('action');}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x8061('0x3'),_0x8061('0x4'),_0x8061('0x5'),_0x8061('0x6'),_0x8061('0x7'),_0x8061('0x8'),_0x8061('0x9'),_0x8061('0xa')]],'msg':_0x8061('0xb')}},'comment':_0x8061('0xb')},'data1':{'type':Sequelize[_0x8061('0xc')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x8061('0xc')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x8061('0xc')](0x1000),'comment':_0x8061('0xd')},'data4':{'type':Sequelize[_0x8061('0xc')](0x1000),'comments':_0x8061('0xe')},'data5':{'type':Sequelize[_0x8061('0xc')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth]'},'data6':{'type':Sequelize['STRING'],'comments':_0x8061('0xf')},'data7':{'type':Sequelize[_0x8061('0x10')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 5fc9323..d0a7ca1 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 _0x9f6f=['offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','body','Action','find','params','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json'];(function(_0x2550ce,_0x45209b){var _0x25748d=function(_0x806ad5){while(--_0x806ad5){_0x2550ce['push'](_0x2550ce['shift']());}};_0x25748d(++_0x45209b);}(_0x9f6f,0x1b1));var _0xf9f6=function(_0xdc545c,_0x1b010f){_0xdc545c=_0xdc545c-0x0;var _0x249c58=_0x9f6f[_0xdc545c];return _0x249c58;};'use strict';var emlformat=require(_0xf9f6('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf9f6('0x1'));var rp=require(_0xf9f6('0x2'));var moment=require('moment');var BPromise=require(_0xf9f6('0x3'));var Mustache=require(_0xf9f6('0x4'));var util=require(_0xf9f6('0x5'));var path=require(_0xf9f6('0x6'));var sox=require(_0xf9f6('0x7'));var csv=require(_0xf9f6('0x8'));var ejs=require(_0xf9f6('0x9'));var fs=require('fs');var fs_extra=require(_0xf9f6('0xa'));var _=require('lodash');var squel=require(_0xf9f6('0xb'));var crypto=require(_0xf9f6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf9f6('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf9f6('0xe'));var Papa=require(_0xf9f6('0xf'));var Redis=require(_0xf9f6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf9f6('0x11'));var as=require(_0xf9f6('0x12'));var hardwareService=require(_0xf9f6('0x13'));var logger=require(_0xf9f6('0x14'))('api');var utils=require(_0xf9f6('0x15'));var config=require(_0xf9f6('0x16'));var licenseUtil=require(_0xf9f6('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x175627,_0x17cc69){_0x17cc69=_0x17cc69||0xcc;return function(_0x3b1fc3){if(_0x3b1fc3){return _0x175627[_0xf9f6('0x18')](_0x17cc69);}return _0x175627[_0xf9f6('0x19')](_0x17cc69)['end']();};}function respondWithResult(_0x4ad7b6,_0x3b6cee){_0x3b6cee=_0x3b6cee||0xc8;return function(_0x38946f){if(_0x38946f){return _0x4ad7b6[_0xf9f6('0x19')](_0x3b6cee)[_0xf9f6('0x1a')](_0x38946f);}};}function respondWithFilteredResult(_0x3b5d5f,_0x4460dc){return function(_0x5a8235){if(_0x5a8235){var _0x16577a=typeof _0x4460dc[_0xf9f6('0x1b')]===_0xf9f6('0x1c')&&typeof _0x4460dc['limit']===_0xf9f6('0x1c');var _0x7b6e1a=_0x5a8235['count'];var _0x3fa0a3=_0x16577a?0x0:_0x4460dc[_0xf9f6('0x1b')];var _0x2e3c9f=_0x16577a?_0x5a8235[_0xf9f6('0x1d')]:_0x4460dc[_0xf9f6('0x1b')]+_0x4460dc[_0xf9f6('0x1e')];var _0x6a1b06;if(_0x2e3c9f>=_0x7b6e1a){_0x2e3c9f=_0x7b6e1a;_0x6a1b06=0xc8;}else{_0x6a1b06=0xce;}_0x3b5d5f[_0xf9f6('0x19')](_0x6a1b06);return _0x3b5d5f['set'](_0xf9f6('0x1f'),_0x3fa0a3+'-'+_0x2e3c9f+'/'+_0x7b6e1a)[_0xf9f6('0x1a')](_0x5a8235);}return null;};}function patchUpdates(_0x1cfa2d){return function(_0x379339){try{jsonpatch[_0xf9f6('0x20')](_0x379339,_0x1cfa2d,!![]);}catch(_0x4b2512){return BPromise[_0xf9f6('0x21')](_0x4b2512);}return _0x379339['save']();};}function saveUpdates(_0x13df70,_0x541e73){return function(_0x55baa9){if(_0x55baa9){return _0x55baa9[_0xf9f6('0x22')](_0x13df70)[_0xf9f6('0x23')](function(_0x5450e6){return _0x5450e6;});}return null;};}function removeEntity(_0x4d54d2,_0x417556){return function(_0x142670){if(_0x142670){return _0x142670[_0xf9f6('0x24')]()[_0xf9f6('0x23')](function(){_0x4d54d2['status'](0xcc)[_0xf9f6('0x25')]();});}};}function handleEntityNotFound(_0x309cff,_0x149264){return function(_0x1bc51e){if(!_0x1bc51e){_0x309cff['sendStatus'](0x194);}return _0x1bc51e;};}function handleError(_0x24d97e,_0x3d5457){_0x3d5457=_0x3d5457||0x1f4;return function(_0x4d6b8e){logger[_0xf9f6('0x26')](_0x4d6b8e[_0xf9f6('0x27')]);if(_0x4d6b8e[_0xf9f6('0x28')]){delete _0x4d6b8e[_0xf9f6('0x28')];}_0x24d97e['status'](_0x3d5457)[_0xf9f6('0x29')](_0x4d6b8e);};}exports[_0xf9f6('0x22')]=function(_0x511cb2,_0x1110fa){if(_0x511cb2[_0xf9f6('0x2a')]['id']){delete _0x511cb2[_0xf9f6('0x2a')]['id'];}return db[_0xf9f6('0x2b')][_0xf9f6('0x2c')]({'where':{'id':_0x511cb2[_0xf9f6('0x2d')]['id']}})[_0xf9f6('0x23')](handleEntityNotFound(_0x1110fa,null))[_0xf9f6('0x23')](saveUpdates(_0x511cb2[_0xf9f6('0x2a')],null))[_0xf9f6('0x23')](respondWithResult(_0x1110fa,null))['catch'](handleError(_0x1110fa,null));};exports[_0xf9f6('0x24')]=function(_0x3968c3,_0x257745){return db[_0xf9f6('0x2b')]['find']({'where':{'id':_0x3968c3[_0xf9f6('0x2d')]['id']}})[_0xf9f6('0x23')](handleEntityNotFound(_0x257745,null))['then'](removeEntity(_0x257745,null))['catch'](handleError(_0x257745,null));}; \ No newline at end of file +var _0xf051=['destroy','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','reject','save','update','then','stack','name','send','body','Action','find','params','catch'];(function(_0x2ce6d5,_0x333e0c){var _0x32d272=function(_0x399f0b){while(--_0x399f0b){_0x2ce6d5['push'](_0x2ce6d5['shift']());}};_0x32d272(++_0x333e0c);}(_0xf051,0x17b));var _0x1f05=function(_0x488262,_0x407387){_0x488262=_0x488262-0x0;var _0x3a4c00=_0xf051[_0x488262];return _0x3a4c00;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1f05('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1f05('0x1'));var rp=require(_0x1f05('0x2'));var moment=require('moment');var BPromise=require(_0x1f05('0x3'));var Mustache=require(_0x1f05('0x4'));var util=require(_0x1f05('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x1f05('0x6'));var ejs=require(_0x1f05('0x7'));var fs=require('fs');var fs_extra=require(_0x1f05('0x8'));var _=require('lodash');var squel=require(_0x1f05('0x9'));var crypto=require('crypto');var jsforce=require(_0x1f05('0xa'));var deskjs=require(_0x1f05('0xb'));var toCsv=require(_0x1f05('0x6'));var querystring=require('querystring');var Papa=require(_0x1f05('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1f05('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f05('0xe'))(_0x1f05('0xf'));var utils=require(_0x1f05('0x10'));var config=require(_0x1f05('0x11'));var licenseUtil=require(_0x1f05('0x12'));var db=require(_0x1f05('0x13'))['db'];function respondWithStatusCode(_0x3556ce,_0x1a78ab){_0x1a78ab=_0x1a78ab||0xcc;return function(_0x5374af){if(_0x5374af){return _0x3556ce[_0x1f05('0x14')](_0x1a78ab);}return _0x3556ce[_0x1f05('0x15')](_0x1a78ab)[_0x1f05('0x16')]();};}function respondWithResult(_0x4e7e9a,_0x3cbcb7){_0x3cbcb7=_0x3cbcb7||0xc8;return function(_0x17b642){if(_0x17b642){return _0x4e7e9a[_0x1f05('0x15')](_0x3cbcb7)['json'](_0x17b642);}};}function respondWithFilteredResult(_0x2c1cfa,_0x5bf92b){return function(_0x3fa9b2){if(_0x3fa9b2){var _0x85a501=typeof _0x5bf92b[_0x1f05('0x17')]===_0x1f05('0x18')&&typeof _0x5bf92b['limit']===_0x1f05('0x18');var _0x29472b=_0x3fa9b2[_0x1f05('0x19')];var _0x5f0398=_0x85a501?0x0:_0x5bf92b[_0x1f05('0x17')];var _0x2335f1=_0x85a501?_0x3fa9b2[_0x1f05('0x19')]:_0x5bf92b[_0x1f05('0x17')]+_0x5bf92b['limit'];var _0x45ec3c;if(_0x2335f1>=_0x29472b){_0x2335f1=_0x29472b;_0x45ec3c=0xc8;}else{_0x45ec3c=0xce;}_0x2c1cfa[_0x1f05('0x15')](_0x45ec3c);return _0x2c1cfa[_0x1f05('0x1a')](_0x1f05('0x1b'),_0x5f0398+'-'+_0x2335f1+'/'+_0x29472b)[_0x1f05('0x1c')](_0x3fa9b2);}return null;};}function patchUpdates(_0x3543eb){return function(_0xf43147){try{jsonpatch['apply'](_0xf43147,_0x3543eb,!![]);}catch(_0x59e377){return BPromise[_0x1f05('0x1d')](_0x59e377);}return _0xf43147[_0x1f05('0x1e')]();};}function saveUpdates(_0x3f08c5,_0x574dbd){return function(_0x400fc6){if(_0x400fc6){return _0x400fc6[_0x1f05('0x1f')](_0x3f08c5)[_0x1f05('0x20')](function(_0x23dcc6){return _0x23dcc6;});}return null;};}function removeEntity(_0x58b505,_0x59456c){return function(_0x214422){if(_0x214422){return _0x214422['destroy']()[_0x1f05('0x20')](function(){_0x58b505[_0x1f05('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x122465,_0x24308f){return function(_0x4c1dae){if(!_0x4c1dae){_0x122465[_0x1f05('0x14')](0x194);}return _0x4c1dae;};}function handleError(_0x316fbc,_0xa6c692){_0xa6c692=_0xa6c692||0x1f4;return function(_0x44c8c7){logger['error'](_0x44c8c7[_0x1f05('0x21')]);if(_0x44c8c7['name']){delete _0x44c8c7[_0x1f05('0x22')];}_0x316fbc['status'](_0xa6c692)[_0x1f05('0x23')](_0x44c8c7);};}exports[_0x1f05('0x1f')]=function(_0x1c80cc,_0x24eca6){if(_0x1c80cc[_0x1f05('0x24')]['id']){delete _0x1c80cc[_0x1f05('0x24')]['id'];}return db[_0x1f05('0x25')][_0x1f05('0x26')]({'where':{'id':_0x1c80cc[_0x1f05('0x27')]['id']}})[_0x1f05('0x20')](handleEntityNotFound(_0x24eca6,null))[_0x1f05('0x20')](saveUpdates(_0x1c80cc['body'],null))[_0x1f05('0x20')](respondWithResult(_0x24eca6,null))[_0x1f05('0x28')](handleError(_0x24eca6,null));};exports[_0x1f05('0x29')]=function(_0x48c9d6,_0x4847f7){return db[_0x1f05('0x25')]['find']({'where':{'id':_0x48c9d6[_0x1f05('0x27')]['id']}})[_0x1f05('0x20')](handleEntityNotFound(_0x4847f7,null))[_0x1f05('0x20')](removeEntity(_0x4847f7,null))['catch'](handleError(_0x4847f7,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 86f4906..c015250 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 _0x36b1=['exports','define','Action','lodash','util','../../config/logger','path','../../config/environment','./action.attributes'];(function(_0x1bcaa5,_0x4d8f4e){var _0x5093b6=function(_0x30a5ae){while(--_0x30a5ae){_0x1bcaa5['push'](_0x1bcaa5['shift']());}};_0x5093b6(++_0x4d8f4e);}(_0x36b1,0x1aa));var _0x136b=function(_0x10219c,_0x20196e){_0x10219c=_0x10219c-0x0;var _0x5139b9=_0x36b1[_0x10219c];return _0x5139b9;};'use strict';var _=require(_0x136b('0x0'));var util=require(_0x136b('0x1'));var logger=require(_0x136b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x136b('0x3'));var rimraf=require('rimraf');var config=require(_0x136b('0x4'));var attributes=require(_0x136b('0x5'));module[_0x136b('0x6')]=function(_0x2240a6,_0x5a8f24){return _0x2240a6[_0x136b('0x7')](_0x136b('0x8'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf30d=['moment','bluebird','path','rimraf','./action.attributes','exports','lodash','util'];(function(_0x3fd3a3,_0x36c863){var _0xa3e4d5=function(_0x1fd03b){while(--_0x1fd03b){_0x3fd3a3['push'](_0x3fd3a3['shift']());}};_0xa3e4d5(++_0x36c863);}(_0xf30d,0xd6));var _0xdf30=function(_0x5093c0,_0x4884c5){_0x5093c0=_0x5093c0-0x0;var _0x1acd10=_0xf30d[_0x5093c0];return _0x1acd10;};'use strict';var _=require(_0xdf30('0x0'));var util=require(_0xdf30('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xdf30('0x2'));var BPromise=require(_0xdf30('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf30('0x4'));var rimraf=require(_0xdf30('0x5'));var config=require('../../config/environment');var attributes=require(_0xdf30('0x6'));module[_0xdf30('0x7')]=function(_0x332210,_0x566088){return _0x332210['define']('Action',attributes,{'tableName':'tools_actions','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 f548fde..3887209 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 _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x1cb9,0x14e));var _0x91cb=function(_0x37b27b,_0x45571c){_0x37b27b=_0x37b27b-0x0;var _0x5deff7=_0x1cb9[_0x37b27b];return _0x5deff7;};'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')]('Action,\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 _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x994286,_0x5cdc6e){var _0x149aed=function(_0xb7bd84){while(--_0xb7bd84){_0x994286['push'](_0x994286['shift']());}};_0x149aed(++_0x5cdc6e);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x45ea78,_0x31678e){_0x45ea78=_0x45ea78-0x0;var _0xd722b7=_0x7fbe[_0x45ea78];return _0xd722b7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 2d5d7d4..586bbc4 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 _0xe978=['connect-timeout','express','Router','fs-extra','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','path'];(function(_0x5c1353,_0x328298){var _0x31e2e6=function(_0x5d37e4){while(--_0x5d37e4){_0x5c1353['push'](_0x5c1353['shift']());}};_0x31e2e6(++_0x328298);}(_0xe978,0x173));var _0x8e97=function(_0x2a44b9,_0x51ac94){_0x2a44b9=_0x2a44b9-0x0;var _0x1e2fa5=_0xe978[_0x2a44b9];return _0x1e2fa5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8e97('0x0'));var timeout=require(_0x8e97('0x1'));var express=require(_0x8e97('0x2'));var router=express[_0x8e97('0x3')]();var fs_extra=require(_0x8e97('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8e97('0x5'));var controller=require(_0x8e97('0x6'));router[_0x8e97('0x7')](_0x8e97('0x8'),auth[_0x8e97('0x9')](),controller[_0x8e97('0xa')]);router[_0x8e97('0xb')](_0x8e97('0x8'),auth[_0x8e97('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xcd08=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./action.controller','put','isAuthenticated','update','delete','/:id','exports','multer','util','path','connect-timeout'];(function(_0x59001b,_0x550269){var _0x4d9707=function(_0x538c09){while(--_0x538c09){_0x59001b['push'](_0x59001b['shift']());}};_0x4d9707(++_0x550269);}(_0xcd08,0x10a));var _0x8cd0=function(_0x486ea1,_0x2e4bef){_0x486ea1=_0x486ea1-0x0;var _0x1849e5=_0xcd08[_0x486ea1];return _0x1849e5;};'use strict';var multer=require(_0x8cd0('0x0'));var util=require(_0x8cd0('0x1'));var path=require(_0x8cd0('0x2'));var timeout=require(_0x8cd0('0x3'));var express=require(_0x8cd0('0x4'));var router=express['Router']();var fs_extra=require(_0x8cd0('0x5'));var auth=require(_0x8cd0('0x6'));var interaction=require(_0x8cd0('0x7'));var config=require('../../config/environment');var controller=require(_0x8cd0('0x8'));router[_0x8cd0('0x9')]('/:id',auth[_0x8cd0('0xa')](),controller[_0x8cd0('0xb')]);router[_0x8cd0('0xc')](_0x8cd0('0xd'),auth[_0x8cd0('0xa')](),controller['destroy']);module[_0x8cd0('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 0623c67..39ed9d0 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 _0xf494=['STRING','TEXT','sequelize','exports'];(function(_0x5815af,_0x361f0b){var _0x3f14cb=function(_0x422c47){while(--_0x422c47){_0x5815af['push'](_0x5815af['shift']());}};_0x3f14cb(++_0x361f0b);}(_0xf494,0x1c6));var _0x4f49=function(_0x3a6ff9,_0x4ae96f){_0x3a6ff9=_0x3a6ff9-0x0;var _0x48467e=_0xf494[_0x3a6ff9];return _0x48467e;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x4f49('0x2')]},'table':{'type':Sequelize[_0x4f49('0x2')]},'conditions':{'type':Sequelize[_0x4f49('0x3')]},'joins':{'type':Sequelize[_0x4f49('0x3')]}}; \ No newline at end of file +var _0xc4aa=['STRING','sequelize','exports'];(function(_0x2e1489,_0x18033f){var _0x1d41c1=function(_0x699b47){while(--_0x699b47){_0x2e1489['push'](_0x2e1489['shift']());}};_0x1d41c1(++_0x18033f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xc4aa[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xac4a('0x2')]},'parent':{'type':Sequelize[_0xac4a('0x2')]},'table':{'type':Sequelize[_0xac4a('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 5b9947f..f4b1189 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 _0xa33d=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','update','then','UserProfileResource','destroy','error','name','send','map','AnalyticCustomReport','fieldName','type','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','rawAttributes','keys','filters','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','userProfileId','autoAssociation','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','findAll','keyBy','select','from','table','MetricId','function','replace','format','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','SELECT','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NULL','IS\x20EMPTY','Sequelize','AnalyticMetric','metric','groupBy','alias','output','fullPath','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','QueryTypes','run','runReport','IS\x20NOT\x20NULL','%s.%s\x20=\x20%s.%s','debug','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa33d,0x8f));var _0xda33=function(_0x214f4d,_0x3153ad){_0x214f4d=_0x214f4d-0x0;var _0x5218e6=_0xa33d[_0x214f4d];return _0x5218e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda33('0x0'));var zipdir=require(_0xda33('0x1'));var jsonpatch=require(_0xda33('0x2'));var rp=require(_0xda33('0x3'));var moment=require(_0xda33('0x4'));var BPromise=require(_0xda33('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xda33('0x6'));var sox=require(_0xda33('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda33('0x8'));var _=require(_0xda33('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xda33('0xa'));var toCsv=require(_0xda33('0xb'));var querystring=require(_0xda33('0xc'));var Papa=require('papaparse');var Redis=require(_0xda33('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xda33('0xe'));var hardwareService=require(_0xda33('0xf'));var logger=require(_0xda33('0x10'))('api');var utils=require(_0xda33('0x11'));var config=require(_0xda33('0x12'));var licenseUtil=require(_0xda33('0x13'));var db=require(_0xda33('0x14'))['db'];var dbH=require('../../mysqldb')['dbH'];function respondWithStatusCode(_0x42fdb3,_0x2ab371){_0x2ab371=_0x2ab371||0xcc;return function(_0x1e4f57){if(_0x1e4f57){return _0x42fdb3[_0xda33('0x15')](_0x2ab371);}return _0x42fdb3['status'](_0x2ab371)['end']();};}function respondWithResult(_0x56d423,_0x5f4722){_0x5f4722=_0x5f4722||0xc8;return function(_0x2bf0c4){if(_0x2bf0c4){return _0x56d423[_0xda33('0x16')](_0x5f4722)[_0xda33('0x17')](_0x2bf0c4);}};}function respondWithFilteredResult(_0xc98127,_0x342def){return function(_0x300e3f){if(_0x300e3f){var _0x4aa762=typeof _0x342def[_0xda33('0x18')]==='undefined'&&typeof _0x342def[_0xda33('0x19')]===_0xda33('0x1a');var _0x22928d=_0x300e3f[_0xda33('0x1b')];var _0x2cbb63=_0x4aa762?0x0:_0x342def[_0xda33('0x18')];var _0x3a6b0b=_0x4aa762?_0x300e3f[_0xda33('0x1b')]:_0x342def[_0xda33('0x18')]+_0x342def[_0xda33('0x19')];var _0x340401;if(_0x3a6b0b>=_0x22928d){_0x3a6b0b=_0x22928d;_0x340401=0xc8;}else{_0x340401=0xce;}_0xc98127[_0xda33('0x16')](_0x340401);return _0xc98127['set'](_0xda33('0x1c'),_0x2cbb63+'-'+_0x3a6b0b+'/'+_0x22928d)[_0xda33('0x17')](_0x300e3f);}return null;};}function patchUpdates(_0x4fcaa4){return function(_0x586f2f){try{jsonpatch['apply'](_0x586f2f,_0x4fcaa4,!![]);}catch(_0x46e601){return BPromise[_0xda33('0x1d')](_0x46e601);}return _0x586f2f['save']();};}function saveUpdates(_0x4f6a0e,_0x2e319c){return function(_0xcdebf3){if(_0xcdebf3){return _0xcdebf3[_0xda33('0x1e')](_0x4f6a0e)[_0xda33('0x1f')](function(_0x12c538){return _0x12c538;});}return null;};}function removeEntity(_0x261642,_0x2955f1){return function(_0x48aed8){if(_0x48aed8){return _0x48aed8['destroy']()['then'](function(){var _0x5a7ba1=_0x48aed8['get']({'plain':!![]});var _0x1ccb6a='CustomReports';return db[_0xda33('0x20')][_0xda33('0x21')]({'where':{'type':_0x1ccb6a,'resourceId':_0x5a7ba1['id']}})[_0xda33('0x1f')](function(){return _0x48aed8;});})['then'](function(){_0x261642[_0xda33('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b9021,_0x4e1eca){return function(_0x3b5e16){if(!_0x3b5e16){_0x5b9021[_0xda33('0x15')](0x194);}return _0x3b5e16;};}function handleError(_0x2be28e,_0x45810c){_0x45810c=_0x45810c||0x1f4;return function(_0x142486){logger[_0xda33('0x22')](_0x142486['stack']);if(_0x142486[_0xda33('0x23')]){delete _0x142486['name'];}_0x2be28e[_0xda33('0x16')](_0x45810c)[_0xda33('0x24')](_0x142486);};}exports['index']=function(_0x168ac4,_0xe7714c){var _0x1acc7e={},_0x47620f={},_0xddbff9={'count':0x0,'rows':[]};var _0x4d4b4e=_[_0xda33('0x25')](db[_0xda33('0x26')]['rawAttributes'],function(_0x4ffc2b){return{'name':_0x4ffc2b[_0xda33('0x27')],'type':_0x4ffc2b[_0xda33('0x28')]['key']};});_0x47620f[_0xda33('0x29')]=_[_0xda33('0x25')](_0x4d4b4e,_0xda33('0x23'));_0x47620f['query']=_['keys'](_0x168ac4[_0xda33('0x2a')]);_0x47620f['filters']=_[_0xda33('0x2b')](_0x47620f[_0xda33('0x29')],_0x47620f[_0xda33('0x2a')]);_0x1acc7e['attributes']=_[_0xda33('0x2b')](_0x47620f['model'],qs[_0xda33('0x2c')](_0x168ac4['query'][_0xda33('0x2c')]));_0x1acc7e[_0xda33('0x2d')]=_0x1acc7e[_0xda33('0x2d')]['length']?_0x1acc7e[_0xda33('0x2d')]:_0x47620f['model'];if(!_0x168ac4[_0xda33('0x2a')][_0xda33('0x2e')](_0xda33('0x2f'))){_0x1acc7e['limit']=qs[_0xda33('0x19')](_0x168ac4['query'][_0xda33('0x19')]);_0x1acc7e[_0xda33('0x18')]=qs['offset'](_0x168ac4[_0xda33('0x2a')]['offset']);}_0x1acc7e[_0xda33('0x30')]=qs[_0xda33('0x31')](_0x168ac4['query'][_0xda33('0x31')]);_0x1acc7e[_0xda33('0x32')]=qs['filters'](_[_0xda33('0x33')](_0x168ac4[_0xda33('0x2a')],_0x47620f['filters']),_0x4d4b4e);if(_0x168ac4['query'][_0xda33('0x34')]){_0x1acc7e['where']=_[_0xda33('0x35')](_0x1acc7e[_0xda33('0x32')],{'$or':_[_0xda33('0x25')](_0x4d4b4e,function(_0x6409d9){if(_0x6409d9[_0xda33('0x28')]!==_0xda33('0x36')){var _0x58ddde={};_0x58ddde[_0x6409d9['name']]={'$like':'%'+_0x168ac4[_0xda33('0x2a')]['filter']+'%'};return _0x58ddde;}})});}_0x1acc7e=_[_0xda33('0x35')]({},_0x1acc7e,_0x168ac4[_0xda33('0x37')]);var _0xf324e0={'where':_0x1acc7e[_0xda33('0x32')]};return db[_0xda33('0x26')][_0xda33('0x1b')](_0xf324e0)[_0xda33('0x1f')](function(_0x4c3ae6){_0xddbff9[_0xda33('0x1b')]=_0x4c3ae6;if(_0x168ac4[_0xda33('0x2a')][_0xda33('0x38')]){_0x1acc7e[_0xda33('0x39')]=[{'all':!![]}];}return db[_0xda33('0x26')]['findAll'](_0x1acc7e);})[_0xda33('0x1f')](function(_0x5cabd9){_0xddbff9['rows']=_0x5cabd9;return _0xddbff9;})[_0xda33('0x1f')](respondWithFilteredResult(_0xe7714c,_0x1acc7e))[_0xda33('0x3a')](handleError(_0xe7714c,null));};exports['show']=function(_0x37beb4,_0x27311b){var _0x3726dd={'raw':![],'where':{'id':_0x37beb4[_0xda33('0x3b')]['id']}},_0x3ecb91={};_0x3ecb91[_0xda33('0x29')]=_['keys'](db[_0xda33('0x26')][_0xda33('0x3c')]);_0x3ecb91[_0xda33('0x2a')]=_[_0xda33('0x3d')](_0x37beb4['query']);_0x3ecb91[_0xda33('0x3e')]=_['intersection'](_0x3ecb91[_0xda33('0x29')],_0x3ecb91[_0xda33('0x2a')]);_0x3726dd[_0xda33('0x2d')]=_[_0xda33('0x2b')](_0x3ecb91[_0xda33('0x29')],qs[_0xda33('0x2c')](_0x37beb4[_0xda33('0x2a')][_0xda33('0x2c')]));_0x3726dd['attributes']=_0x3726dd[_0xda33('0x2d')][_0xda33('0x3f')]?_0x3726dd[_0xda33('0x2d')]:_0x3ecb91['model'];if(_0x37beb4[_0xda33('0x2a')][_0xda33('0x38')]){_0x3726dd[_0xda33('0x39')]=[{'all':!![]}];}_0x3726dd=_[_0xda33('0x35')]({},_0x3726dd,_0x37beb4['options']);return db[_0xda33('0x26')][_0xda33('0x40')](_0x3726dd)[_0xda33('0x1f')](handleEntityNotFound(_0x27311b,null))['then'](respondWithResult(_0x27311b,null))['catch'](handleError(_0x27311b,null));};exports[_0xda33('0x41')]=function(_0x1dcc64,_0x584ea9){return db[_0xda33('0x26')][_0xda33('0x41')](_0x1dcc64[_0xda33('0x42')],{})[_0xda33('0x1f')](function(_0x43ab8d){var _0x4e81f9=_0x1dcc64[_0xda33('0x43')][_0xda33('0x44')]({'plain':!![]});if(!_0x4e81f9)throw new Error(_0xda33('0x45'));if(_0x4e81f9['role']===_0xda33('0x43')){var _0x566bdc=_0x43ab8d[_0xda33('0x44')]({'plain':!![]});var _0x575c2=_0xda33('0x46');return db[_0xda33('0x47')]['find']({'where':{'name':_0x575c2,'userProfileId':_0x4e81f9[_0xda33('0x48')]},'raw':!![]})['then'](function(_0x1bbb1c){if(_0x1bbb1c&&_0x1bbb1c[_0xda33('0x49')]===0x0){return db[_0xda33('0x20')]['create']({'name':_0x566bdc[_0xda33('0x23')],'resourceId':_0x566bdc['id'],'type':_0xda33('0x4a'),'sectionId':_0x1bbb1c['id']},{})[_0xda33('0x1f')](function(){return _0x43ab8d;});}else{return _0x43ab8d;}})[_0xda33('0x3a')](function(_0x700803){logger['error'](_0xda33('0x4b'),_0x700803);throw _0x700803;});}return _0x43ab8d;})[_0xda33('0x1f')](respondWithResult(_0x584ea9,0xc9))['catch'](handleError(_0x584ea9,null));};exports['update']=function(_0x3be859,_0x451bb2){if(_0x3be859[_0xda33('0x42')]['id']){delete _0x3be859[_0xda33('0x42')]['id'];}return db['AnalyticCustomReport'][_0xda33('0x40')]({'where':{'id':_0x3be859[_0xda33('0x3b')]['id']}})[_0xda33('0x1f')](handleEntityNotFound(_0x451bb2,null))[_0xda33('0x1f')](saveUpdates(_0x3be859[_0xda33('0x42')],null))[_0xda33('0x1f')](respondWithResult(_0x451bb2,null))['catch'](handleError(_0x451bb2,null));};exports[_0xda33('0x21')]=function(_0x2df531,_0x3b73da){return db['AnalyticCustomReport']['find']({'where':{'id':_0x2df531[_0xda33('0x3b')]['id']}})[_0xda33('0x1f')](handleEntityNotFound(_0x3b73da,null))[_0xda33('0x1f')](removeEntity(_0x3b73da,null))[_0xda33('0x3a')](handleError(_0x3b73da,null));};exports[_0xda33('0x4c')]=function(_0xb2c643,_0x59fd3b){var _0x56f479=0xa;var _0x236101=[_0xda33('0x4d'),_0xda33('0x4e'),_0xda33('0x4f'),_0xda33('0x50')];var _0x5370fc={'SUM':_0xda33('0x51'),'COUNT':_0xda33('0x52'),'COUNT DISTINCT':_0xda33('0x53'),'MAX':_0xda33('0x54'),'MIN':_0xda33('0x55'),'AVG':_0xda33('0x56'),'GROUP_CONCAT':_0xda33('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xda33('0x58')};var _0x528cd4={'SEC_TO_TIME':_0xda33('0x59'),'DATE':_0xda33('0x5a'),'HOUR':_0xda33('0x5b'),'ROUND':_0xda33('0x5c'),'UNIX_TIMESTAMP':_0xda33('0x5d')};var _0x547aa5=function(_0x106d87){return!_[_0xda33('0x5e')](['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY',_0xda33('0x5f')],_0x106d87);};var _0x13baeb=function(_0x16f9bd){if(!_0x16f9bd||!_0x16f9bd[_0xda33('0x60')]['length']){return'';}for(var _0x1a5c34='(',_0x49349b=0x0;_0x49349b<_0x16f9bd['rules'][_0xda33('0x3f')];_0x49349b+=0x1){_0x49349b>0x0&&(_0x1a5c34+='\x20'+_0x16f9bd[_0xda33('0x61')]+'\x20');_0x1a5c34+=_0x16f9bd[_0xda33('0x60')][_0x49349b][_0xda33('0x62')]?_0x13baeb(_0x16f9bd['rules'][_0x49349b][_0xda33('0x62')]):_0x16f9bd[_0xda33('0x60')][_0x49349b][_0xda33('0x63')]+'\x20'+_0x16f9bd['rules'][_0x49349b][_0xda33('0x64')]+(_0x547aa5(_0x16f9bd[_0xda33('0x60')][_0x49349b][_0xda33('0x64')])?'\x20'+_0x16f9bd[_0xda33('0x60')][_0x49349b][_0xda33('0x65')]:'');}return _0x1a5c34+')';};var _0x3284b9={'where':{'id':_0xb2c643[_0xda33('0x3b')]['id']}},_0x25888b,_0x31ea41,_0x3d6cf6,_0x26fd1e,_0x3d83c7;_0x3284b9=_[_0xda33('0x35')]({},_0x3284b9,_0xb2c643[_0xda33('0x37')]);return db[_0xda33('0x26')][_0xda33('0x40')](_0x3284b9)[_0xda33('0x1f')](function(_0x4765c9){if(_0x4765c9){_0x25888b=_0x4765c9;return _0x4765c9[_0xda33('0x66')]();}return null;})[_0xda33('0x1f')](function(_0x3eb953){if(_0x3eb953){if(!_0x3eb953['length']){throw new db['Sequelize'][(_0xda33('0x67'))](_0xda33('0x68'),0x193);}_0x31ea41=_0x3eb953;return db['AnalyticMetric'][_0xda33('0x69')]({'raw':!![]});}return null;})[_0xda33('0x1f')](function(_0x2bf423){if(_0x2bf423){_0x3d6cf6=_[_0xda33('0x6a')](_0x2bf423,'id');var _0x482af1;var _0x12be75=squel[_0xda33('0x6b')]();_0x12be75[_0xda33('0x6c')](_0x25888b[_0xda33('0x6d')]);for(var _0x3108f3=0x0;_0x3108f3<_0x31ea41[_0xda33('0x3f')];_0x3108f3+=0x1){_0x482af1=_0x31ea41[_0x3108f3][_0xda33('0x6e')]?_0x3d6cf6[_0x31ea41[_0x3108f3][_0xda33('0x6e')]]['metric']:_0x31ea41[_0x3108f3][_0xda33('0x63')];_0x482af1=_0x31ea41[_0x3108f3][_0xda33('0x6f')]?_['replace'](_0x5370fc[_0x31ea41[_0x3108f3][_0xda33('0x6f')]],'%s',_0x482af1):_0x482af1;_0x482af1=_0x31ea41[_0x3108f3]['format']?_[_0xda33('0x70')](_0x528cd4[_0x31ea41[_0x3108f3][_0xda33('0x71')]],'%s',_0x482af1):_0x482af1;if(_0x31ea41[_0x3108f3]['groupBy']){_0x12be75[_0xda33('0x62')](_0x482af1);}_0x31ea41[_0x3108f3]['orderBy']&&_0x12be75[_0xda33('0x30')](_0x482af1,_0x31ea41[_0x3108f3][_0xda33('0x72')]===_0xda33('0x73')?![]:!![]);_0x12be75[_0xda33('0x63')](_0x482af1,_0x31ea41[_0x3108f3]['alias']||_0x482af1);}if(_0x25888b[_0xda33('0x74')]){_0x25888b[_0xda33('0x74')]=JSON[_0xda33('0x75')](_0x25888b[_0xda33('0x74')]);for(var _0x3241d0=0x0;_0x3241d0<_0x25888b['joins'][_0xda33('0x3f')];_0x3241d0+=0x1){if(_0x25888b['joins'][_0x3241d0][_0xda33('0x28')]&&_[_0xda33('0x5e')](_0x236101,_0x25888b[_0xda33('0x74')][_0x3241d0][_0xda33('0x28')])&&_0x25888b['joins'][_0x3241d0][_0xda33('0x76')]&&_0x25888b[_0xda33('0x74')][_0x3241d0][_0xda33('0x77')]&&_0x25888b['joins'][_0x3241d0][_0xda33('0x78')]){_0x12be75[_0x25888b[_0xda33('0x74')][_0x3241d0][_0xda33('0x28')]](_0x25888b[_0xda33('0x74')][_0x3241d0][_0xda33('0x77')],null,util[_0xda33('0x71')]('%s.%s\x20=\x20%s.%s',_0x25888b[_0xda33('0x6d')],_0x25888b[_0xda33('0x74')][_0x3241d0][_0xda33('0x76')],_0x25888b[_0xda33('0x74')][_0x3241d0][_0xda33('0x77')],_0x25888b['joins'][_0x3241d0][_0xda33('0x78')]));}}}if(_0x25888b[_0xda33('0x79')]){_0x25888b['conditions']=JSON[_0xda33('0x75')](_0x25888b['conditions']);_0x12be75['where'](_0x13baeb(_0x25888b['conditions'][_0xda33('0x62')]));}_0x3d83c7=_0x12be75[_0xda33('0x7a')]();_0x12be75[_0xda33('0x19')](_0x56f479);_0x12be75[_0xda33('0x18')](0x0);logger['debug'](_0xda33('0x7b'),_0x12be75[_0xda33('0x7c')]());return dbH[_0xda33('0x7d')][_0xda33('0x2a')](_0x12be75[_0xda33('0x7c')](),{'type':dbH[_0xda33('0x7d')]['QueryTypes'][_0xda33('0x7e')]});}})[_0xda33('0x1f')](respondWithResult(_0x59fd3b,null))[_0xda33('0x3a')](handleError(_0x59fd3b,null));};function runReport(_0xa9641a,_0x57c5f9,_0x45e814){var _0xae6491=_0x57c5f9[_0xda33('0x23')];var _0x11c9c6=0xa;var _0xa0c674=[_0xda33('0x4d'),_0xda33('0x4e'),_0xda33('0x4f'),_0xda33('0x50')];var _0x176a63={'SUM':_0xda33('0x51'),'COUNT':_0xda33('0x52'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xda33('0x55'),'AVG':_0xda33('0x56'),'GROUP_CONCAT':_0xda33('0x57'),'GROUP_CONCAT ASC':_0xda33('0x7f'),'GROUP_CONCAT DESC':_0xda33('0x58')};var _0x3b34ab={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xda33('0x5a'),'HOUR':_0xda33('0x5b'),'ROUND':_0xda33('0x5c'),'UNIX_TIMESTAMP':_0xda33('0x5d')};var _0x2877a9=function(_0x588447){return!_[_0xda33('0x5e')]([_0xda33('0x80'),'IS\x20NOT\x20NULL',_0xda33('0x81'),_0xda33('0x5f')],_0x588447);};var _0x310b8b=function(_0x498b1f){if(!_0x498b1f||!_0x498b1f['rules']['length']){return'';}for(var _0x9ca72b='(',_0x3b423a=0x0;_0x3b423a<_0x498b1f[_0xda33('0x60')][_0xda33('0x3f')];_0x3b423a+=0x1){_0x3b423a>0x0&&(_0x9ca72b+='\x20'+_0x498b1f[_0xda33('0x61')]+'\x20');_0x9ca72b+=_0x498b1f[_0xda33('0x60')][_0x3b423a][_0xda33('0x62')]?_0x310b8b(_0x498b1f[_0xda33('0x60')][_0x3b423a][_0xda33('0x62')]):_0x498b1f['rules'][_0x3b423a][_0xda33('0x63')]+'\x20'+_0x498b1f[_0xda33('0x60')][_0x3b423a]['condition']+(_0x2877a9(_0x498b1f[_0xda33('0x60')][_0x3b423a][_0xda33('0x64')])?'\x20'+_0x498b1f[_0xda33('0x60')][_0x3b423a][_0xda33('0x65')]:'');}return _0x9ca72b+')';};var _0x9bf68f={'where':{'id':_0xa9641a['id']}},_0x5f36fc,_0x30240f,_0x10f4e7,_0x43cc99,_0x5dd34a;_0x9bf68f=_[_0xda33('0x35')]({},_0x9bf68f,_0x45e814);return db[_0xda33('0x26')]['find'](_0x9bf68f)[_0xda33('0x1f')](function(_0x451497){if(_0x451497){_0x5f36fc=_0x451497;return _0x451497[_0xda33('0x66')]();}return null;})[_0xda33('0x1f')](function(_0x70a6cc){if(_0x70a6cc){if(!_0x70a6cc[_0xda33('0x3f')]){throw new db[(_0xda33('0x82'))][(_0xda33('0x67'))](_0xda33('0x68'),0x193);}_0x30240f=_0x70a6cc;return db[_0xda33('0x83')]['findAll']({'raw':!![]});}return null;})[_0xda33('0x1f')](function(_0x3f58b7){if(_0x3f58b7){_0x10f4e7=_[_0xda33('0x6a')](_0x3f58b7,'id');var _0x31f557;var _0x29520c=squel['select']();_0x29520c[_0xda33('0x6c')](_0x5f36fc[_0xda33('0x6d')]);for(var _0x1db94e=0x0;_0x1db94e<_0x30240f['length'];_0x1db94e+=0x1){_0x31f557=_0x30240f[_0x1db94e]['MetricId']?_0x10f4e7[_0x30240f[_0x1db94e][_0xda33('0x6e')]][_0xda33('0x84')]:_0x30240f[_0x1db94e][_0xda33('0x63')];_0x31f557=_0x30240f[_0x1db94e][_0xda33('0x6f')]?_['replace'](_0x176a63[_0x30240f[_0x1db94e][_0xda33('0x6f')]],'%s',_0x31f557):_0x31f557;_0x31f557=_0x30240f[_0x1db94e]['format']?_[_0xda33('0x70')](_0x3b34ab[_0x30240f[_0x1db94e][_0xda33('0x71')]],'%s',_0x31f557):_0x31f557;if(_0x30240f[_0x1db94e][_0xda33('0x85')]){_0x29520c[_0xda33('0x62')](_0x31f557);}_0x30240f[_0x1db94e][_0xda33('0x72')]&&_0x29520c['order'](_0x31f557,_0x30240f[_0x1db94e][_0xda33('0x72')]==='DESC'?![]:!![]);_0x29520c[_0xda33('0x63')](_0x31f557,_0x30240f[_0x1db94e][_0xda33('0x86')]||_0x31f557);}if(_0x5f36fc[_0xda33('0x74')]){_0x5f36fc[_0xda33('0x74')]=JSON[_0xda33('0x75')](_0x5f36fc[_0xda33('0x74')]);for(var _0x2e7ba5=0x0;_0x2e7ba5<_0x5f36fc[_0xda33('0x74')][_0xda33('0x3f')];_0x2e7ba5+=0x1){if(_0x5f36fc[_0xda33('0x74')][_0x2e7ba5][_0xda33('0x28')]&&_[_0xda33('0x5e')](_0xa0c674,_0x5f36fc[_0xda33('0x74')][_0x2e7ba5][_0xda33('0x28')])&&_0x5f36fc[_0xda33('0x74')][_0x2e7ba5][_0xda33('0x76')]&&_0x5f36fc['joins'][_0x2e7ba5][_0xda33('0x77')]&&_0x5f36fc['joins'][_0x2e7ba5][_0xda33('0x78')]){_0x29520c[_0x5f36fc[_0xda33('0x74')][_0x2e7ba5][_0xda33('0x28')]](_0x5f36fc[_0xda33('0x74')][_0x2e7ba5][_0xda33('0x77')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x5f36fc['table'],_0x5f36fc[_0xda33('0x74')][_0x2e7ba5][_0xda33('0x76')],_0x5f36fc[_0xda33('0x74')][_0x2e7ba5][_0xda33('0x77')],_0x5f36fc[_0xda33('0x74')][_0x2e7ba5][_0xda33('0x78')]));}}}if(_0x5f36fc[_0xda33('0x79')]){_0x5f36fc[_0xda33('0x79')]=JSON[_0xda33('0x75')](_0x5f36fc['conditions']);_0x29520c[_0xda33('0x32')](_0x310b8b(_0x5f36fc[_0xda33('0x79')][_0xda33('0x62')]));}_0x5dd34a=_0x29520c[_0xda33('0x7a')]();_0x29520c[_0xda33('0x19')](_0x11c9c6);_0x29520c['offset'](0x0);return;}})['then'](function(){if(_0x57c5f9[_0xda33('0x87')]==='web'){return null;}var _0x19cb9a=_[_0xda33('0x35')](_0x57c5f9,{'name':_0x57c5f9[_0xda33('0x88')]||_0x57c5f9[_0xda33('0x23')]||_0x5f36fc[_0xda33('0x23')],'basename':_0xae6491,'savename':util['format'](_0xda33('0x89'),_0x57c5f9[_0xda33('0x23')]||_0x5f36fc[_0xda33('0x23')],require('randomstring')[_0xda33('0x8a')](0x4),_0x57c5f9[_0xda33('0x87')]||_0xda33('0x8b')),'reportId':_0x5f36fc['id'],'reportType':_0xda33('0x8c')});return db[_0xda33('0x8d')][_0xda33('0x41')](_0x19cb9a,{'raw':!![]});})['then'](function(_0x44abf5){if(_0x5f36fc[_0xda33('0x6d')]==='cdr'){_0x5dd34a['where'](_0x5f36fc[_0xda33('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x57c5f9[_0xda33('0x8e')],_0x57c5f9[_0xda33('0x8f')]);}else{_0x5dd34a[_0xda33('0x32')](_0x5f36fc[_0xda33('0x6d')]+_0xda33('0x90'),_0x57c5f9['startDate'],_0x57c5f9['endDate']);}if(_0x44abf5){logger[_0xda33('0x91')](_0xda33('0x92'),_0x5dd34a[_0xda33('0x7c')]());require(_0xda33('0x93'))[_0xda33('0x94')](path[_0xda33('0x4d')](__dirname,_0xda33('0x95'),_0x44abf5['output']),[_0x44abf5['id'],_0x5dd34a[_0xda33('0x7c')](),path['join'](__dirname,_0xda33('0x96'),_0x44abf5[_0xda33('0x97')]),_0xae6491]);return _0x44abf5;}else{var _0x50ee7b=squel[_0xda33('0x6b')]();_0x50ee7b[_0xda33('0x6c')]('('+_0x5dd34a[_0xda33('0x7c')]()+')',_0xda33('0x98'));_0x50ee7b[_0xda33('0x63')](_0xda33('0x99'),_0xda33('0x1b'));_0x5dd34a['limit'](_0x57c5f9[_0xda33('0x19')]||_0x11c9c6);_0x5dd34a[_0xda33('0x18')](_0x57c5f9[_0xda33('0x18')]||0x0);return dbH['sequelize'][_0xda33('0x2a')](_0x50ee7b[_0xda33('0x7c')](),{'type':dbH['sequelize'][_0xda33('0x9a')]['SELECT']})['then'](function(_0x45147a){if(!_0x45147a[_0xda33('0x3f')]){_0x43cc99=0x0;}else{_0x43cc99=_0x45147a[0x0][_0xda33('0x1b')]||0x0;}return dbH[_0xda33('0x7d')][_0xda33('0x2a')](_0x5dd34a['toString'](),{'type':dbH[_0xda33('0x7d')][_0xda33('0x9a')][_0xda33('0x7e')]});})['then'](function(_0x1e4676){return{'rows':_0x1e4676||[],'count':_0x43cc99};});}});}exports[_0xda33('0x9b')]=function(_0xf60957,_0x2dbdb8){return runReport(_0xf60957[_0xda33('0x3b')],_0xf60957[_0xda33('0x2a')],_0xf60957[_0xda33('0x37')])[_0xda33('0x1f')](respondWithResult(_0x2dbdb8,null))[_0xda33('0x3a')](handleError(_0x2dbdb8,null));};exports[_0xda33('0x9c')]=runReport;exports[_0xda33('0x2a')]=function(_0x24bd2f,_0x322aa4){var _0x599732=0xa;var _0x16fa77=[_0xda33('0x4d'),_0xda33('0x4e'),'right_join',_0xda33('0x50')];var _0x343b5d={'SUM':_0xda33('0x51'),'COUNT':_0xda33('0x52'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xda33('0x55'),'AVG':_0xda33('0x56'),'GROUP_CONCAT':_0xda33('0x57'),'GROUP_CONCAT ASC':_0xda33('0x7f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x305df1={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xda33('0x5a'),'HOUR':_0xda33('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xda33('0x5d')};var _0x4f25e9=function(_0x16ae2a){return!_[_0xda33('0x5e')]([_0xda33('0x80'),_0xda33('0x9d'),_0xda33('0x81'),_0xda33('0x5f')],_0x16ae2a);};var _0x2dd0f2=function(_0x480113){if(!_0x480113||!_0x480113[_0xda33('0x60')][_0xda33('0x3f')]){return'';}for(var _0x5e1c01='(',_0x357491=0x0;_0x357491<_0x480113['rules']['length'];_0x357491+=0x1){_0x357491>0x0&&(_0x5e1c01+='\x20'+_0x480113[_0xda33('0x61')]+'\x20');_0x5e1c01+=_0x480113['rules'][_0x357491][_0xda33('0x62')]?_0x2dd0f2(_0x480113[_0xda33('0x60')][_0x357491]['group']):_0x480113[_0xda33('0x60')][_0x357491][_0xda33('0x63')]+'\x20'+_0x480113[_0xda33('0x60')][_0x357491][_0xda33('0x64')]+(_0x4f25e9(_0x480113[_0xda33('0x60')][_0x357491]['condition'])?'\x20'+_0x480113[_0xda33('0x60')][_0x357491][_0xda33('0x65')]:'');}return _0x5e1c01+')';};var _0x3d50ba={'where':{'id':_0x24bd2f[_0xda33('0x3b')]['id']}},_0x1fd895,_0x3de1b8,_0x1b5454,_0x1d357f,_0x2a5375;_0x3d50ba=_[_0xda33('0x35')]({},_0x3d50ba,_0x24bd2f[_0xda33('0x37')]);return db[_0xda33('0x26')][_0xda33('0x40')](_0x3d50ba)[_0xda33('0x1f')](function(_0x55a982){if(_0x55a982){_0x1fd895=_0x55a982;return _0x55a982[_0xda33('0x66')]();}return null;})[_0xda33('0x1f')](function(_0x1d517a){if(_0x1d517a){if(!_0x1d517a['length']){throw new db[(_0xda33('0x82'))][(_0xda33('0x67'))](_0xda33('0x68'),0x193);}_0x3de1b8=_0x1d517a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xda33('0x1f')](function(_0x21c35e){if(_0x21c35e){_0x1b5454=_[_0xda33('0x6a')](_0x21c35e,'id');var _0x3081e2;var _0x2cf42e=squel[_0xda33('0x6b')]();_0x2cf42e['from'](_0x1fd895[_0xda33('0x6d')]);for(var _0x1ae7a1=0x0;_0x1ae7a1<_0x3de1b8['length'];_0x1ae7a1+=0x1){_0x3081e2=_0x3de1b8[_0x1ae7a1][_0xda33('0x6e')]?_0x1b5454[_0x3de1b8[_0x1ae7a1]['MetricId']][_0xda33('0x84')]:_0x3de1b8[_0x1ae7a1]['field'];_0x3081e2=_0x3de1b8[_0x1ae7a1]['function']?_['replace'](_0x343b5d[_0x3de1b8[_0x1ae7a1]['function']],'%s',_0x3081e2):_0x3081e2;_0x3081e2=_0x3de1b8[_0x1ae7a1][_0xda33('0x71')]?_[_0xda33('0x70')](_0x305df1[_0x3de1b8[_0x1ae7a1]['format']],'%s',_0x3081e2):_0x3081e2;if(_0x3de1b8[_0x1ae7a1][_0xda33('0x85')]){_0x2cf42e[_0xda33('0x62')](_0x3081e2);}_0x3de1b8[_0x1ae7a1][_0xda33('0x72')]&&_0x2cf42e[_0xda33('0x30')](_0x3081e2,_0x3de1b8[_0x1ae7a1][_0xda33('0x72')]===_0xda33('0x73')?![]:!![]);_0x2cf42e['field'](_0x3081e2,_0x3de1b8[_0x1ae7a1][_0xda33('0x86')]||_0x3081e2);}if(_0x1fd895[_0xda33('0x74')]){_0x1fd895[_0xda33('0x74')]=JSON[_0xda33('0x75')](_0x1fd895[_0xda33('0x74')]);for(var _0x236961=0x0;_0x236961<_0x1fd895[_0xda33('0x74')][_0xda33('0x3f')];_0x236961+=0x1){if(_0x1fd895['joins'][_0x236961]['type']&&_[_0xda33('0x5e')](_0x16fa77,_0x1fd895[_0xda33('0x74')][_0x236961][_0xda33('0x28')])&&_0x1fd895[_0xda33('0x74')][_0x236961][_0xda33('0x76')]&&_0x1fd895['joins'][_0x236961][_0xda33('0x77')]&&_0x1fd895[_0xda33('0x74')][_0x236961][_0xda33('0x78')]){_0x2cf42e[_0x1fd895['joins'][_0x236961]['type']](_0x1fd895[_0xda33('0x74')][_0x236961][_0xda33('0x77')],null,util[_0xda33('0x71')](_0xda33('0x9e'),_0x1fd895[_0xda33('0x6d')],_0x1fd895[_0xda33('0x74')][_0x236961][_0xda33('0x76')],_0x1fd895['joins'][_0x236961][_0xda33('0x77')],_0x1fd895[_0xda33('0x74')][_0x236961]['foreignKey']));}}}if(_0x1fd895[_0xda33('0x79')]){_0x1fd895[_0xda33('0x79')]=JSON[_0xda33('0x75')](_0x1fd895[_0xda33('0x79')]);_0x2cf42e['where'](_0x2dd0f2(_0x1fd895[_0xda33('0x79')][_0xda33('0x62')]));}_0x2a5375=_0x2cf42e[_0xda33('0x7a')]();_0x2cf42e[_0xda33('0x19')](_0x599732);_0x2cf42e[_0xda33('0x18')](0x0);logger[_0xda33('0x9f')](_0xda33('0x7b'),_0x2cf42e['toString']());return dbH['sequelize'][_0xda33('0x2a')](_0x2cf42e[_0xda33('0x7c')](),{'type':dbH['sequelize'][_0xda33('0x9a')]['SELECT']});}})[_0xda33('0x1f')](function(){return{'sql':_0x2a5375[_0xda33('0x7c')]()};})[_0xda33('0x1f')](respondWithResult(_0x322aa4,null))[_0xda33('0x3a')](handleError(_0x322aa4,null));}; \ No newline at end of file +var _0xd5ee=['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','dbH','status','end','json','offset','limit','undefined','count','apply','update','destroy','then','get','CustomReports','error','stack','name','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','AnalyticCustomReport','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Reports','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','field','condition','value','getFields','ValidationErrorItem','AnalyticMetric','select','from','MetricId','metric','function','replace','format','orderBy','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','group','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','SUM(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','groupBy','output','web','randomstring','generate','csv','AnalyticExtractedReport','cdr','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','COUNT(*)','run','runReport','DESC','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x4c9f5d,_0x232322){var _0xc5ddc2=function(_0x4168b5){while(--_0x4168b5){_0x4c9f5d['push'](_0x4c9f5d['shift']());}};_0xc5ddc2(++_0x232322);}(_0xd5ee,0x93));var _0xed5e=function(_0x2a6571,_0xf1567c){_0x2a6571=_0x2a6571-0x0;var _0xdf7731=_0xd5ee[_0x2a6571];return _0xdf7731;};'use strict';var emlformat=require(_0xed5e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xed5e('0x1'));var jsonpatch=require(_0xed5e('0x2'));var rp=require(_0xed5e('0x3'));var moment=require('moment');var BPromise=require(_0xed5e('0x4'));var Mustache=require('mustache');var util=require(_0xed5e('0x5'));var path=require(_0xed5e('0x6'));var sox=require(_0xed5e('0x7'));var csv=require(_0xed5e('0x8'));var ejs=require(_0xed5e('0x9'));var fs=require('fs');var fs_extra=require(_0xed5e('0xa'));var _=require(_0xed5e('0xb'));var squel=require(_0xed5e('0xc'));var crypto=require(_0xed5e('0xd'));var jsforce=require(_0xed5e('0xe'));var deskjs=require(_0xed5e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xed5e('0x10'));var Papa=require(_0xed5e('0x11'));var Redis=require(_0xed5e('0x12'));var authService=require(_0xed5e('0x13'));var qs=require(_0xed5e('0x14'));var as=require(_0xed5e('0x15'));var hardwareService=require(_0xed5e('0x16'));var logger=require(_0xed5e('0x17'))(_0xed5e('0x18'));var utils=require(_0xed5e('0x19'));var config=require(_0xed5e('0x1a'));var licenseUtil=require(_0xed5e('0x1b'));var db=require('../../mysqldb')['db'];var dbH=require(_0xed5e('0x1c'))[_0xed5e('0x1d')];function respondWithStatusCode(_0x26d25c,_0x27373b){_0x27373b=_0x27373b||0xcc;return function(_0x490085){if(_0x490085){return _0x26d25c['sendStatus'](_0x27373b);}return _0x26d25c[_0xed5e('0x1e')](_0x27373b)[_0xed5e('0x1f')]();};}function respondWithResult(_0x1fc3a7,_0x4f7552){_0x4f7552=_0x4f7552||0xc8;return function(_0x18b4ab){if(_0x18b4ab){return _0x1fc3a7[_0xed5e('0x1e')](_0x4f7552)[_0xed5e('0x20')](_0x18b4ab);}};}function respondWithFilteredResult(_0x10893d,_0x54fe57){return function(_0xa986ef){if(_0xa986ef){var _0x2f794f=typeof _0x54fe57[_0xed5e('0x21')]==='undefined'&&typeof _0x54fe57[_0xed5e('0x22')]===_0xed5e('0x23');var _0x2a166a=_0xa986ef['count'];var _0x102485=_0x2f794f?0x0:_0x54fe57['offset'];var _0x4b4f30=_0x2f794f?_0xa986ef[_0xed5e('0x24')]:_0x54fe57['offset']+_0x54fe57[_0xed5e('0x22')];var _0x34e26c;if(_0x4b4f30>=_0x2a166a){_0x4b4f30=_0x2a166a;_0x34e26c=0xc8;}else{_0x34e26c=0xce;}_0x10893d['status'](_0x34e26c);return _0x10893d['set']('Content-Range',_0x102485+'-'+_0x4b4f30+'/'+_0x2a166a)[_0xed5e('0x20')](_0xa986ef);}return null;};}function patchUpdates(_0x4c7fa6){return function(_0x1bbf80){try{jsonpatch[_0xed5e('0x25')](_0x1bbf80,_0x4c7fa6,!![]);}catch(_0x10013f){return BPromise['reject'](_0x10013f);}return _0x1bbf80['save']();};}function saveUpdates(_0x1462da,_0x3acd50){return function(_0x51d0f7){if(_0x51d0f7){return _0x51d0f7[_0xed5e('0x26')](_0x1462da)['then'](function(_0x34bf33){return _0x34bf33;});}return null;};}function removeEntity(_0x13433d,_0x2e087a){return function(_0x176490){if(_0x176490){return _0x176490[_0xed5e('0x27')]()[_0xed5e('0x28')](function(){var _0x35b67e=_0x176490[_0xed5e('0x29')]({'plain':!![]});var _0xf7c420=_0xed5e('0x2a');return db['UserProfileResource'][_0xed5e('0x27')]({'where':{'type':_0xf7c420,'resourceId':_0x35b67e['id']}})[_0xed5e('0x28')](function(){return _0x176490;});})[_0xed5e('0x28')](function(){_0x13433d[_0xed5e('0x1e')](0xcc)[_0xed5e('0x1f')]();});}};}function handleEntityNotFound(_0x44b3f,_0x246f27){return function(_0x5de547){if(!_0x5de547){_0x44b3f['sendStatus'](0x194);}return _0x5de547;};}function handleError(_0x2667ad,_0x23e048){_0x23e048=_0x23e048||0x1f4;return function(_0x69a1d4){logger[_0xed5e('0x2b')](_0x69a1d4[_0xed5e('0x2c')]);if(_0x69a1d4[_0xed5e('0x2d')]){delete _0x69a1d4[_0xed5e('0x2d')];}_0x2667ad[_0xed5e('0x1e')](_0x23e048)['send'](_0x69a1d4);};}exports['index']=function(_0xda4d6a,_0x180cef){var _0x4247e4={},_0x3e2c7e={},_0x141d71={'count':0x0,'rows':[]};var _0x215bcb=_[_0xed5e('0x2e')](db['AnalyticCustomReport']['rawAttributes'],function(_0x2857dd){return{'name':_0x2857dd[_0xed5e('0x2f')],'type':_0x2857dd[_0xed5e('0x30')]['key']};});_0x3e2c7e[_0xed5e('0x31')]=_[_0xed5e('0x2e')](_0x215bcb,_0xed5e('0x2d'));_0x3e2c7e[_0xed5e('0x32')]=_[_0xed5e('0x33')](_0xda4d6a[_0xed5e('0x32')]);_0x3e2c7e[_0xed5e('0x34')]=_[_0xed5e('0x35')](_0x3e2c7e['model'],_0x3e2c7e['query']);_0x4247e4[_0xed5e('0x36')]=_['intersection'](_0x3e2c7e[_0xed5e('0x31')],qs[_0xed5e('0x37')](_0xda4d6a[_0xed5e('0x32')][_0xed5e('0x37')]));_0x4247e4['attributes']=_0x4247e4[_0xed5e('0x36')][_0xed5e('0x38')]?_0x4247e4[_0xed5e('0x36')]:_0x3e2c7e['model'];if(!_0xda4d6a[_0xed5e('0x32')][_0xed5e('0x39')](_0xed5e('0x3a'))){_0x4247e4['limit']=qs[_0xed5e('0x22')](_0xda4d6a[_0xed5e('0x32')][_0xed5e('0x22')]);_0x4247e4[_0xed5e('0x21')]=qs[_0xed5e('0x21')](_0xda4d6a[_0xed5e('0x32')][_0xed5e('0x21')]);}_0x4247e4[_0xed5e('0x3b')]=qs[_0xed5e('0x3c')](_0xda4d6a[_0xed5e('0x32')][_0xed5e('0x3c')]);_0x4247e4[_0xed5e('0x3d')]=qs[_0xed5e('0x34')](_['pick'](_0xda4d6a[_0xed5e('0x32')],_0x3e2c7e[_0xed5e('0x34')]),_0x215bcb);if(_0xda4d6a[_0xed5e('0x32')][_0xed5e('0x3e')]){_0x4247e4[_0xed5e('0x3d')]=_[_0xed5e('0x3f')](_0x4247e4[_0xed5e('0x3d')],{'$or':_[_0xed5e('0x2e')](_0x215bcb,function(_0x59e458){if(_0x59e458[_0xed5e('0x30')]!=='VIRTUAL'){var _0x2b5f31={};_0x2b5f31[_0x59e458[_0xed5e('0x2d')]]={'$like':'%'+_0xda4d6a[_0xed5e('0x32')][_0xed5e('0x3e')]+'%'};return _0x2b5f31;}})});}_0x4247e4=_['merge']({},_0x4247e4,_0xda4d6a[_0xed5e('0x40')]);var _0xd21cb8={'where':_0x4247e4[_0xed5e('0x3d')]};return db[_0xed5e('0x41')]['count'](_0xd21cb8)['then'](function(_0x39f402){_0x141d71['count']=_0x39f402;if(_0xda4d6a[_0xed5e('0x32')]['includeAll']){_0x4247e4[_0xed5e('0x42')]=[{'all':!![]}];}return db[_0xed5e('0x41')][_0xed5e('0x43')](_0x4247e4);})['then'](function(_0x28fb6f){_0x141d71[_0xed5e('0x44')]=_0x28fb6f;return _0x141d71;})[_0xed5e('0x28')](respondWithFilteredResult(_0x180cef,_0x4247e4))[_0xed5e('0x45')](handleError(_0x180cef,null));};exports[_0xed5e('0x46')]=function(_0x3d0e98,_0x19c289){var _0x5b96fa={'raw':![],'where':{'id':_0x3d0e98[_0xed5e('0x47')]['id']}},_0x392a75={};_0x392a75[_0xed5e('0x31')]=_['keys'](db[_0xed5e('0x41')]['rawAttributes']);_0x392a75[_0xed5e('0x32')]=_[_0xed5e('0x33')](_0x3d0e98[_0xed5e('0x32')]);_0x392a75[_0xed5e('0x34')]=_['intersection'](_0x392a75['model'],_0x392a75[_0xed5e('0x32')]);_0x5b96fa[_0xed5e('0x36')]=_[_0xed5e('0x35')](_0x392a75[_0xed5e('0x31')],qs['fields'](_0x3d0e98['query'][_0xed5e('0x37')]));_0x5b96fa[_0xed5e('0x36')]=_0x5b96fa['attributes'][_0xed5e('0x38')]?_0x5b96fa[_0xed5e('0x36')]:_0x392a75['model'];if(_0x3d0e98['query']['includeAll']){_0x5b96fa[_0xed5e('0x42')]=[{'all':!![]}];}_0x5b96fa=_[_0xed5e('0x3f')]({},_0x5b96fa,_0x3d0e98['options']);return db['AnalyticCustomReport'][_0xed5e('0x48')](_0x5b96fa)['then'](handleEntityNotFound(_0x19c289,null))[_0xed5e('0x28')](respondWithResult(_0x19c289,null))[_0xed5e('0x45')](handleError(_0x19c289,null));};exports[_0xed5e('0x49')]=function(_0x5ca488,_0x1fd7b8){return db[_0xed5e('0x41')][_0xed5e('0x49')](_0x5ca488[_0xed5e('0x4a')],{})[_0xed5e('0x28')](function(_0x5695a0){var _0x5b6640=_0x5ca488['user']['get']({'plain':!![]});if(!_0x5b6640)throw new Error(_0xed5e('0x4b'));if(_0x5b6640['role']===_0xed5e('0x4c')){var _0x43d708=_0x5695a0[_0xed5e('0x29')]({'plain':!![]});var _0x106194=_0xed5e('0x4d');return db[_0xed5e('0x4e')][_0xed5e('0x48')]({'where':{'name':_0x106194,'userProfileId':_0x5b6640['userProfileId']},'raw':!![]})[_0xed5e('0x28')](function(_0xed2350){if(_0xed2350&&_0xed2350[_0xed5e('0x4f')]===0x0){return db[_0xed5e('0x50')][_0xed5e('0x49')]({'name':_0x43d708[_0xed5e('0x2d')],'resourceId':_0x43d708['id'],'type':_0xed5e('0x2a'),'sectionId':_0xed2350['id']},{})['then'](function(){return _0x5695a0;});}else{return _0x5695a0;}})[_0xed5e('0x45')](function(_0x51dc52){logger[_0xed5e('0x2b')](_0xed5e('0x51'),_0x51dc52);throw _0x51dc52;});}return _0x5695a0;})[_0xed5e('0x28')](respondWithResult(_0x1fd7b8,0xc9))[_0xed5e('0x45')](handleError(_0x1fd7b8,null));};exports[_0xed5e('0x26')]=function(_0x3db7f3,_0x4e86df){if(_0x3db7f3[_0xed5e('0x4a')]['id']){delete _0x3db7f3[_0xed5e('0x4a')]['id'];}return db['AnalyticCustomReport'][_0xed5e('0x48')]({'where':{'id':_0x3db7f3[_0xed5e('0x47')]['id']}})[_0xed5e('0x28')](handleEntityNotFound(_0x4e86df,null))[_0xed5e('0x28')](saveUpdates(_0x3db7f3[_0xed5e('0x4a')],null))[_0xed5e('0x28')](respondWithResult(_0x4e86df,null))[_0xed5e('0x45')](handleError(_0x4e86df,null));};exports[_0xed5e('0x27')]=function(_0x45d536,_0x97d857){return db[_0xed5e('0x41')][_0xed5e('0x48')]({'where':{'id':_0x45d536[_0xed5e('0x47')]['id']}})['then'](handleEntityNotFound(_0x97d857,null))[_0xed5e('0x28')](removeEntity(_0x97d857,null))[_0xed5e('0x45')](handleError(_0x97d857,null));};exports['preview']=function(_0x705dcc,_0x2d6909){var _0x30723c=0xa;var _0x58a0f2=['join',_0xed5e('0x52'),_0xed5e('0x53'),_0xed5e('0x54')];var _0x49ce27={'SUM':'SUM(%s)','COUNT':_0xed5e('0x55'),'COUNT DISTINCT':_0xed5e('0x56'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xed5e('0x57'),'GROUP_CONCAT':_0xed5e('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xed5e('0x59')};var _0x274e93={'SEC_TO_TIME':_0xed5e('0x5a'),'DATE':_0xed5e('0x5b'),'HOUR':_0xed5e('0x5c'),'ROUND':_0xed5e('0x5d'),'UNIX_TIMESTAMP':_0xed5e('0x5e')};var _0x1af289=function(_0x4e5ad3){return!_[_0xed5e('0x5f')]([_0xed5e('0x60'),'IS\x20NOT\x20NULL',_0xed5e('0x61'),_0xed5e('0x62')],_0x4e5ad3);};var _0x1ce896=function(_0x33baff){if(!_0x33baff||!_0x33baff[_0xed5e('0x63')][_0xed5e('0x38')]){return'';}for(var _0x4a30ec='(',_0x381f45=0x0;_0x381f45<_0x33baff[_0xed5e('0x63')][_0xed5e('0x38')];_0x381f45+=0x1){_0x381f45>0x0&&(_0x4a30ec+='\x20'+_0x33baff[_0xed5e('0x64')]+'\x20');_0x4a30ec+=_0x33baff[_0xed5e('0x63')][_0x381f45]['group']?_0x1ce896(_0x33baff['rules'][_0x381f45]['group']):_0x33baff[_0xed5e('0x63')][_0x381f45][_0xed5e('0x65')]+'\x20'+_0x33baff[_0xed5e('0x63')][_0x381f45][_0xed5e('0x66')]+(_0x1af289(_0x33baff[_0xed5e('0x63')][_0x381f45][_0xed5e('0x66')])?'\x20'+_0x33baff[_0xed5e('0x63')][_0x381f45][_0xed5e('0x67')]:'');}return _0x4a30ec+')';};var _0x27e987={'where':{'id':_0x705dcc[_0xed5e('0x47')]['id']}},_0xcc2619,_0x41a0d4,_0x265977,_0x30fef7,_0x308fb8;_0x27e987=_[_0xed5e('0x3f')]({},_0x27e987,_0x705dcc[_0xed5e('0x40')]);return db[_0xed5e('0x41')][_0xed5e('0x48')](_0x27e987)[_0xed5e('0x28')](function(_0x472aef){if(_0x472aef){_0xcc2619=_0x472aef;return _0x472aef[_0xed5e('0x68')]();}return null;})['then'](function(_0x54f01c){if(_0x54f01c){if(!_0x54f01c[_0xed5e('0x38')]){throw new db['Sequelize'][(_0xed5e('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x41a0d4=_0x54f01c;return db[_0xed5e('0x6a')][_0xed5e('0x43')]({'raw':!![]});}return null;})['then'](function(_0x18602a){if(_0x18602a){_0x265977=_['keyBy'](_0x18602a,'id');var _0x34b026;var _0x5de972=squel[_0xed5e('0x6b')]();_0x5de972[_0xed5e('0x6c')](_0xcc2619['table']);for(var _0x57e7e3=0x0;_0x57e7e3<_0x41a0d4['length'];_0x57e7e3+=0x1){_0x34b026=_0x41a0d4[_0x57e7e3][_0xed5e('0x6d')]?_0x265977[_0x41a0d4[_0x57e7e3][_0xed5e('0x6d')]][_0xed5e('0x6e')]:_0x41a0d4[_0x57e7e3][_0xed5e('0x65')];_0x34b026=_0x41a0d4[_0x57e7e3][_0xed5e('0x6f')]?_[_0xed5e('0x70')](_0x49ce27[_0x41a0d4[_0x57e7e3][_0xed5e('0x6f')]],'%s',_0x34b026):_0x34b026;_0x34b026=_0x41a0d4[_0x57e7e3][_0xed5e('0x71')]?_[_0xed5e('0x70')](_0x274e93[_0x41a0d4[_0x57e7e3]['format']],'%s',_0x34b026):_0x34b026;if(_0x41a0d4[_0x57e7e3]['groupBy']){_0x5de972['group'](_0x34b026);}_0x41a0d4[_0x57e7e3][_0xed5e('0x72')]&&_0x5de972[_0xed5e('0x3b')](_0x34b026,_0x41a0d4[_0x57e7e3][_0xed5e('0x72')]==='DESC'?![]:!![]);_0x5de972[_0xed5e('0x65')](_0x34b026,_0x41a0d4[_0x57e7e3][_0xed5e('0x73')]||_0x34b026);}if(_0xcc2619[_0xed5e('0x74')]){_0xcc2619[_0xed5e('0x74')]=JSON[_0xed5e('0x75')](_0xcc2619['joins']);for(var _0x4c901c=0x0;_0x4c901c<_0xcc2619[_0xed5e('0x74')]['length'];_0x4c901c+=0x1){if(_0xcc2619[_0xed5e('0x74')][_0x4c901c][_0xed5e('0x30')]&&_['includes'](_0x58a0f2,_0xcc2619[_0xed5e('0x74')][_0x4c901c]['type'])&&_0xcc2619[_0xed5e('0x74')][_0x4c901c][_0xed5e('0x76')]&&_0xcc2619[_0xed5e('0x74')][_0x4c901c][_0xed5e('0x77')]&&_0xcc2619[_0xed5e('0x74')][_0x4c901c]['foreignKey']){_0x5de972[_0xcc2619[_0xed5e('0x74')][_0x4c901c][_0xed5e('0x30')]](_0xcc2619[_0xed5e('0x74')][_0x4c901c]['foreignTable'],null,util['format'](_0xed5e('0x78'),_0xcc2619[_0xed5e('0x79')],_0xcc2619[_0xed5e('0x74')][_0x4c901c][_0xed5e('0x76')],_0xcc2619[_0xed5e('0x74')][_0x4c901c][_0xed5e('0x77')],_0xcc2619[_0xed5e('0x74')][_0x4c901c][_0xed5e('0x7a')]));}}}if(_0xcc2619[_0xed5e('0x7b')]){_0xcc2619[_0xed5e('0x7b')]=JSON[_0xed5e('0x75')](_0xcc2619['conditions']);_0x5de972[_0xed5e('0x3d')](_0x1ce896(_0xcc2619[_0xed5e('0x7b')][_0xed5e('0x7c')]));}_0x308fb8=_0x5de972[_0xed5e('0x7d')]();_0x5de972[_0xed5e('0x22')](_0x30723c);_0x5de972['offset'](0x0);logger[_0xed5e('0x7e')](_0xed5e('0x7f'),_0x5de972[_0xed5e('0x80')]());return dbH['sequelize'][_0xed5e('0x32')](_0x5de972[_0xed5e('0x80')](),{'type':dbH[_0xed5e('0x81')][_0xed5e('0x82')][_0xed5e('0x83')]});}})[_0xed5e('0x28')](respondWithResult(_0x2d6909,null))[_0xed5e('0x45')](handleError(_0x2d6909,null));};function runReport(_0x4b1889,_0x1c8e3b,_0x199464){var _0x55dfce=_0x1c8e3b[_0xed5e('0x2d')];var _0x19cf2f=0xa;var _0x307c8a=[_0xed5e('0x84'),'left_join',_0xed5e('0x53'),_0xed5e('0x54')];var _0xaf7a91={'SUM':_0xed5e('0x85'),'COUNT':_0xed5e('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xed5e('0x86'),'MIN':_0xed5e('0x87'),'AVG':_0xed5e('0x57'),'GROUP_CONCAT':_0xed5e('0x58'),'GROUP_CONCAT ASC':_0xed5e('0x88'),'GROUP_CONCAT DESC':_0xed5e('0x59')};var _0xc5225a={'SEC_TO_TIME':_0xed5e('0x5a'),'DATE':'DATE(%s)','HOUR':_0xed5e('0x5c'),'ROUND':_0xed5e('0x5d'),'UNIX_TIMESTAMP':_0xed5e('0x5e')};var _0x94325=function(_0x115ca7){return!_[_0xed5e('0x5f')]([_0xed5e('0x60'),_0xed5e('0x89'),'IS\x20EMPTY',_0xed5e('0x62')],_0x115ca7);};var _0x20d310=function(_0x431e48){if(!_0x431e48||!_0x431e48[_0xed5e('0x63')][_0xed5e('0x38')]){return'';}for(var _0x4bb511='(',_0xd9f10b=0x0;_0xd9f10b<_0x431e48[_0xed5e('0x63')][_0xed5e('0x38')];_0xd9f10b+=0x1){_0xd9f10b>0x0&&(_0x4bb511+='\x20'+_0x431e48['operator']+'\x20');_0x4bb511+=_0x431e48[_0xed5e('0x63')][_0xd9f10b]['group']?_0x20d310(_0x431e48['rules'][_0xd9f10b][_0xed5e('0x7c')]):_0x431e48[_0xed5e('0x63')][_0xd9f10b][_0xed5e('0x65')]+'\x20'+_0x431e48['rules'][_0xd9f10b][_0xed5e('0x66')]+(_0x94325(_0x431e48[_0xed5e('0x63')][_0xd9f10b]['condition'])?'\x20'+_0x431e48[_0xed5e('0x63')][_0xd9f10b][_0xed5e('0x67')]:'');}return _0x4bb511+')';};var _0x388720={'where':{'id':_0x4b1889['id']}},_0xaef2e3,_0x5e9a78,_0x165a3d,_0x18d9a8,_0xd25b74;_0x388720=_[_0xed5e('0x3f')]({},_0x388720,_0x199464);return db[_0xed5e('0x41')]['find'](_0x388720)['then'](function(_0x6c940d){if(_0x6c940d){_0xaef2e3=_0x6c940d;return _0x6c940d[_0xed5e('0x68')]();}return null;})[_0xed5e('0x28')](function(_0x25b18c){if(_0x25b18c){if(!_0x25b18c[_0xed5e('0x38')]){throw new db[(_0xed5e('0x8a'))][(_0xed5e('0x69'))](_0xed5e('0x8b'),0x193);}_0x5e9a78=_0x25b18c;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xed5e('0x28')](function(_0x90097){if(_0x90097){_0x165a3d=_[_0xed5e('0x8c')](_0x90097,'id');var _0x503c3f;var _0x369c55=squel[_0xed5e('0x6b')]();_0x369c55[_0xed5e('0x6c')](_0xaef2e3[_0xed5e('0x79')]);for(var _0x2bc077=0x0;_0x2bc077<_0x5e9a78['length'];_0x2bc077+=0x1){_0x503c3f=_0x5e9a78[_0x2bc077]['MetricId']?_0x165a3d[_0x5e9a78[_0x2bc077][_0xed5e('0x6d')]][_0xed5e('0x6e')]:_0x5e9a78[_0x2bc077]['field'];_0x503c3f=_0x5e9a78[_0x2bc077][_0xed5e('0x6f')]?_[_0xed5e('0x70')](_0xaf7a91[_0x5e9a78[_0x2bc077][_0xed5e('0x6f')]],'%s',_0x503c3f):_0x503c3f;_0x503c3f=_0x5e9a78[_0x2bc077][_0xed5e('0x71')]?_[_0xed5e('0x70')](_0xc5225a[_0x5e9a78[_0x2bc077][_0xed5e('0x71')]],'%s',_0x503c3f):_0x503c3f;if(_0x5e9a78[_0x2bc077][_0xed5e('0x8d')]){_0x369c55[_0xed5e('0x7c')](_0x503c3f);}_0x5e9a78[_0x2bc077][_0xed5e('0x72')]&&_0x369c55[_0xed5e('0x3b')](_0x503c3f,_0x5e9a78[_0x2bc077][_0xed5e('0x72')]==='DESC'?![]:!![]);_0x369c55[_0xed5e('0x65')](_0x503c3f,_0x5e9a78[_0x2bc077][_0xed5e('0x73')]||_0x503c3f);}if(_0xaef2e3[_0xed5e('0x74')]){_0xaef2e3[_0xed5e('0x74')]=JSON[_0xed5e('0x75')](_0xaef2e3[_0xed5e('0x74')]);for(var _0x5d8f30=0x0;_0x5d8f30<_0xaef2e3[_0xed5e('0x74')][_0xed5e('0x38')];_0x5d8f30+=0x1){if(_0xaef2e3[_0xed5e('0x74')][_0x5d8f30][_0xed5e('0x30')]&&_['includes'](_0x307c8a,_0xaef2e3[_0xed5e('0x74')][_0x5d8f30][_0xed5e('0x30')])&&_0xaef2e3['joins'][_0x5d8f30][_0xed5e('0x76')]&&_0xaef2e3[_0xed5e('0x74')][_0x5d8f30]['foreignTable']&&_0xaef2e3[_0xed5e('0x74')][_0x5d8f30][_0xed5e('0x7a')]){_0x369c55[_0xaef2e3['joins'][_0x5d8f30][_0xed5e('0x30')]](_0xaef2e3[_0xed5e('0x74')][_0x5d8f30][_0xed5e('0x77')],null,util[_0xed5e('0x71')](_0xed5e('0x78'),_0xaef2e3[_0xed5e('0x79')],_0xaef2e3[_0xed5e('0x74')][_0x5d8f30][_0xed5e('0x76')],_0xaef2e3[_0xed5e('0x74')][_0x5d8f30]['foreignTable'],_0xaef2e3['joins'][_0x5d8f30][_0xed5e('0x7a')]));}}}if(_0xaef2e3[_0xed5e('0x7b')]){_0xaef2e3['conditions']=JSON[_0xed5e('0x75')](_0xaef2e3['conditions']);_0x369c55['where'](_0x20d310(_0xaef2e3[_0xed5e('0x7b')][_0xed5e('0x7c')]));}_0xd25b74=_0x369c55['clone']();_0x369c55[_0xed5e('0x22')](_0x19cf2f);_0x369c55[_0xed5e('0x21')](0x0);return;}})[_0xed5e('0x28')](function(){if(_0x1c8e3b[_0xed5e('0x8e')]===_0xed5e('0x8f')){return null;}var _0x4a241c=_[_0xed5e('0x3f')](_0x1c8e3b,{'name':_0x1c8e3b['fullPath']||_0x1c8e3b[_0xed5e('0x2d')]||_0xaef2e3[_0xed5e('0x2d')],'basename':_0x55dfce,'savename':util[_0xed5e('0x71')]('%s-%s.%s',_0x1c8e3b['name']||_0xaef2e3[_0xed5e('0x2d')],require(_0xed5e('0x90'))[_0xed5e('0x91')](0x4),_0x1c8e3b[_0xed5e('0x8e')]||_0xed5e('0x92')),'reportId':_0xaef2e3['id'],'reportType':'custom'});return db[_0xed5e('0x93')][_0xed5e('0x49')](_0x4a241c,{'raw':!![]});})['then'](function(_0x20657e){if(_0xaef2e3[_0xed5e('0x79')]===_0xed5e('0x94')){_0xd25b74[_0xed5e('0x3d')](_0xaef2e3['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x1c8e3b['startDate'],_0x1c8e3b['endDate']);}else{_0xd25b74['where'](_0xaef2e3[_0xed5e('0x79')]+_0xed5e('0x95'),_0x1c8e3b['startDate'],_0x1c8e3b[_0xed5e('0x96')]);}if(_0x20657e){logger[_0xed5e('0x97')](_0xed5e('0x98'),_0xd25b74[_0xed5e('0x80')]());require(_0xed5e('0x99'))[_0xed5e('0x9a')](path['join'](__dirname,_0xed5e('0x9b'),_0x20657e[_0xed5e('0x8e')]),[_0x20657e['id'],_0xd25b74[_0xed5e('0x80')](),path['join'](__dirname,_0xed5e('0x9c'),_0x20657e['savename']),_0x55dfce]);return _0x20657e;}else{var _0x1a2cdd=squel[_0xed5e('0x6b')]();_0x1a2cdd[_0xed5e('0x6c')]('('+_0xd25b74[_0xed5e('0x80')]()+')','countTable');_0x1a2cdd[_0xed5e('0x65')](_0xed5e('0x9d'),'count');_0xd25b74[_0xed5e('0x22')](_0x1c8e3b[_0xed5e('0x22')]||_0x19cf2f);_0xd25b74[_0xed5e('0x21')](_0x1c8e3b[_0xed5e('0x21')]||0x0);return dbH['sequelize'][_0xed5e('0x32')](_0x1a2cdd[_0xed5e('0x80')](),{'type':dbH[_0xed5e('0x81')][_0xed5e('0x82')]['SELECT']})[_0xed5e('0x28')](function(_0x13ad10){if(!_0x13ad10[_0xed5e('0x38')]){_0x18d9a8=0x0;}else{_0x18d9a8=_0x13ad10[0x0][_0xed5e('0x24')]||0x0;}return dbH['sequelize'][_0xed5e('0x32')](_0xd25b74[_0xed5e('0x80')](),{'type':dbH['sequelize'][_0xed5e('0x82')]['SELECT']});})['then'](function(_0x2d4247){return{'rows':_0x2d4247||[],'count':_0x18d9a8};});}});}exports[_0xed5e('0x9e')]=function(_0x3aa649,_0x24cf6f){return runReport(_0x3aa649[_0xed5e('0x47')],_0x3aa649[_0xed5e('0x32')],_0x3aa649[_0xed5e('0x40')])['then'](respondWithResult(_0x24cf6f,null))['catch'](handleError(_0x24cf6f,null));};exports[_0xed5e('0x9f')]=runReport;exports[_0xed5e('0x32')]=function(_0x456e8d,_0x299761){var _0x294126=0xa;var _0x159d9e=[_0xed5e('0x84'),_0xed5e('0x52'),'right_join',_0xed5e('0x54')];var _0x509444={'SUM':_0xed5e('0x85'),'COUNT':_0xed5e('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xed5e('0x86'),'MIN':'MIN(%s)','AVG':_0xed5e('0x57'),'GROUP_CONCAT':_0xed5e('0x58'),'GROUP_CONCAT ASC':_0xed5e('0x88'),'GROUP_CONCAT DESC':_0xed5e('0x59')};var _0x5d2bdb={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xed5e('0x5b'),'HOUR':_0xed5e('0x5c'),'ROUND':_0xed5e('0x5d'),'UNIX_TIMESTAMP':_0xed5e('0x5e')};var _0x286970=function(_0x5c5b0f){return!_[_0xed5e('0x5f')]([_0xed5e('0x60'),_0xed5e('0x89'),_0xed5e('0x61'),'IS\x20NOT\x20EMPTY'],_0x5c5b0f);};var _0x2b57f1=function(_0x55914f){if(!_0x55914f||!_0x55914f['rules'][_0xed5e('0x38')]){return'';}for(var _0x1516f5='(',_0x5a37ce=0x0;_0x5a37ce<_0x55914f[_0xed5e('0x63')]['length'];_0x5a37ce+=0x1){_0x5a37ce>0x0&&(_0x1516f5+='\x20'+_0x55914f[_0xed5e('0x64')]+'\x20');_0x1516f5+=_0x55914f[_0xed5e('0x63')][_0x5a37ce][_0xed5e('0x7c')]?_0x2b57f1(_0x55914f[_0xed5e('0x63')][_0x5a37ce][_0xed5e('0x7c')]):_0x55914f['rules'][_0x5a37ce][_0xed5e('0x65')]+'\x20'+_0x55914f['rules'][_0x5a37ce][_0xed5e('0x66')]+(_0x286970(_0x55914f[_0xed5e('0x63')][_0x5a37ce]['condition'])?'\x20'+_0x55914f[_0xed5e('0x63')][_0x5a37ce][_0xed5e('0x67')]:'');}return _0x1516f5+')';};var _0x30eba9={'where':{'id':_0x456e8d[_0xed5e('0x47')]['id']}},_0x37ce06,_0x18bb26,_0x2e46f6,_0x21d3d4,_0x2be86d;_0x30eba9=_['merge']({},_0x30eba9,_0x456e8d[_0xed5e('0x40')]);return db[_0xed5e('0x41')][_0xed5e('0x48')](_0x30eba9)['then'](function(_0x51454d){if(_0x51454d){_0x37ce06=_0x51454d;return _0x51454d[_0xed5e('0x68')]();}return null;})[_0xed5e('0x28')](function(_0xbf0c0){if(_0xbf0c0){if(!_0xbf0c0['length']){throw new db[(_0xed5e('0x8a'))][(_0xed5e('0x69'))](_0xed5e('0x8b'),0x193);}_0x18bb26=_0xbf0c0;return db[_0xed5e('0x6a')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x4692b5){if(_0x4692b5){_0x2e46f6=_[_0xed5e('0x8c')](_0x4692b5,'id');var _0x23dc2d;var _0x4f3bb6=squel[_0xed5e('0x6b')]();_0x4f3bb6[_0xed5e('0x6c')](_0x37ce06[_0xed5e('0x79')]);for(var _0xd05d86=0x0;_0xd05d86<_0x18bb26[_0xed5e('0x38')];_0xd05d86+=0x1){_0x23dc2d=_0x18bb26[_0xd05d86][_0xed5e('0x6d')]?_0x2e46f6[_0x18bb26[_0xd05d86][_0xed5e('0x6d')]]['metric']:_0x18bb26[_0xd05d86]['field'];_0x23dc2d=_0x18bb26[_0xd05d86][_0xed5e('0x6f')]?_[_0xed5e('0x70')](_0x509444[_0x18bb26[_0xd05d86][_0xed5e('0x6f')]],'%s',_0x23dc2d):_0x23dc2d;_0x23dc2d=_0x18bb26[_0xd05d86][_0xed5e('0x71')]?_[_0xed5e('0x70')](_0x5d2bdb[_0x18bb26[_0xd05d86][_0xed5e('0x71')]],'%s',_0x23dc2d):_0x23dc2d;if(_0x18bb26[_0xd05d86][_0xed5e('0x8d')]){_0x4f3bb6['group'](_0x23dc2d);}_0x18bb26[_0xd05d86]['orderBy']&&_0x4f3bb6['order'](_0x23dc2d,_0x18bb26[_0xd05d86][_0xed5e('0x72')]===_0xed5e('0xa0')?![]:!![]);_0x4f3bb6[_0xed5e('0x65')](_0x23dc2d,_0x18bb26[_0xd05d86][_0xed5e('0x73')]||_0x23dc2d);}if(_0x37ce06[_0xed5e('0x74')]){_0x37ce06[_0xed5e('0x74')]=JSON[_0xed5e('0x75')](_0x37ce06[_0xed5e('0x74')]);for(var _0x4e4c2b=0x0;_0x4e4c2b<_0x37ce06[_0xed5e('0x74')][_0xed5e('0x38')];_0x4e4c2b+=0x1){if(_0x37ce06[_0xed5e('0x74')][_0x4e4c2b][_0xed5e('0x30')]&&_[_0xed5e('0x5f')](_0x159d9e,_0x37ce06['joins'][_0x4e4c2b][_0xed5e('0x30')])&&_0x37ce06['joins'][_0x4e4c2b][_0xed5e('0x76')]&&_0x37ce06[_0xed5e('0x74')][_0x4e4c2b]['foreignTable']&&_0x37ce06[_0xed5e('0x74')][_0x4e4c2b][_0xed5e('0x7a')]){_0x4f3bb6[_0x37ce06[_0xed5e('0x74')][_0x4e4c2b][_0xed5e('0x30')]](_0x37ce06['joins'][_0x4e4c2b]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x37ce06['table'],_0x37ce06['joins'][_0x4e4c2b][_0xed5e('0x76')],_0x37ce06['joins'][_0x4e4c2b][_0xed5e('0x77')],_0x37ce06[_0xed5e('0x74')][_0x4e4c2b][_0xed5e('0x7a')]));}}}if(_0x37ce06[_0xed5e('0x7b')]){_0x37ce06[_0xed5e('0x7b')]=JSON[_0xed5e('0x75')](_0x37ce06[_0xed5e('0x7b')]);_0x4f3bb6[_0xed5e('0x3d')](_0x2b57f1(_0x37ce06[_0xed5e('0x7b')]['group']));}_0x2be86d=_0x4f3bb6[_0xed5e('0x7d')]();_0x4f3bb6[_0xed5e('0x22')](_0x294126);_0x4f3bb6[_0xed5e('0x21')](0x0);logger[_0xed5e('0x7e')](_0xed5e('0x7f'),_0x4f3bb6[_0xed5e('0x80')]());return dbH[_0xed5e('0x81')][_0xed5e('0x32')](_0x4f3bb6[_0xed5e('0x80')](),{'type':dbH['sequelize']['QueryTypes'][_0xed5e('0x83')]});}})[_0xed5e('0x28')](function(){return{'sql':_0x2be86d[_0xed5e('0x80')]()};})['then'](respondWithResult(_0x299761,null))[_0xed5e('0x45')](handleError(_0x299761,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 3b8d801..2de7e10 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 _0xd0a3=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./analyticCustomReport.attributes','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x1acb5a,_0x112268){var _0x92d8c5=function(_0x3038a2){while(--_0x3038a2){_0x1acb5a['push'](_0x1acb5a['shift']());}};_0x92d8c5(++_0x112268);}(_0xd0a3,0x1a3));var _0x3d0a=function(_0x221a3f,_0x2c632a){_0x221a3f=_0x221a3f-0x0;var _0x756b2b=_0xd0a3[_0x221a3f];return _0x756b2b;};'use strict';var _=require(_0x3d0a('0x0'));var util=require('util');var logger=require(_0x3d0a('0x1'))(_0x3d0a('0x2'));var moment=require(_0x3d0a('0x3'));var BPromise=require('bluebird');var rp=require(_0x3d0a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d0a('0x5'));var config=require(_0x3d0a('0x6'));var attributes=require(_0x3d0a('0x7'));module['exports']=function(_0x1d278f,_0x2b6f9a){return _0x1d278f['define'](_0x3d0a('0x8'),attributes,{'tableName':_0x3d0a('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3204=['define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3204,0x12e));var _0x4320=function(_0x5655fc,_0x11036b){_0x5655fc=_0x5655fc-0x0;var _0x17d348=_0x3204[_0x5655fc];return _0x17d348;};'use strict';var _=require(_0x4320('0x0'));var util=require(_0x4320('0x1'));var logger=require(_0x4320('0x2'))(_0x4320('0x3'));var moment=require(_0x4320('0x4'));var BPromise=require(_0x4320('0x5'));var rp=require(_0x4320('0x6'));var fs=require('fs');var path=require(_0x4320('0x7'));var rimraf=require(_0x4320('0x8'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0x4320('0x9')]=function(_0x7ce01d,_0xbda169){return _0x7ce01d[_0x4320('0xa')](_0x4320('0xb'),attributes,{'tableName':_0x4320('0xc'),'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 eb7da2e..6584a8d 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 _0xa9c3=['../../config/environment','jayson/promise','client','http','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x30e289,_0x1ed090){var _0x37d9a2=function(_0x306be5){while(--_0x306be5){_0x30e289['push'](_0x30e289['shift']());}};_0x37d9a2(++_0x1ed090);}(_0xa9c3,0x18e));var _0x3a9c=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xa9c3[_0x8a969d];return _0x1d8dc7;};'use strict';var _=require(_0x3a9c('0x0'));var util=require(_0x3a9c('0x1'));var moment=require(_0x3a9c('0x2'));var BPromise=require(_0x3a9c('0x3'));var rs=require(_0x3a9c('0x4'));var fs=require('fs');var Redis=require(_0x3a9c('0x5'));var db=require(_0x3a9c('0x6'))['db'];var utils=require(_0x3a9c('0x7'));var logger=require(_0x3a9c('0x8'))(_0x3a9c('0x9'));var config=require(_0x3a9c('0xa'));var jayson=require(_0x3a9c('0xb'));var client=jayson[_0x3a9c('0xc')][_0x3a9c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xfe17c6,_0x1cd332,_0x4e9edd){return new BPromise(function(_0xdd95f5,_0x11667f){return client['request'](_0xfe17c6,_0x4e9edd)['then'](function(_0x4ffd29){logger[_0x3a9c('0xe')](_0x3a9c('0xf'),_0x1cd332,'request\x20sent');logger[_0x3a9c('0x10')](_0x3a9c('0x11'),_0x1cd332,'request\x20sent',JSON[_0x3a9c('0x12')](_0x4ffd29));if(_0x4ffd29[_0x3a9c('0x13')]){if(_0x4ffd29['error']['code']===0x1f4){logger['error'](_0x3a9c('0xf'),_0x1cd332,_0x4ffd29[_0x3a9c('0x13')][_0x3a9c('0x14')]);return _0x11667f(_0x4ffd29[_0x3a9c('0x13')]['message']);}logger[_0x3a9c('0x13')](_0x3a9c('0xf'),_0x1cd332,_0x4ffd29[_0x3a9c('0x13')][_0x3a9c('0x14')]);return _0xdd95f5(_0x4ffd29[_0x3a9c('0x13')][_0x3a9c('0x14')]);}else{logger[_0x3a9c('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1cd332,_0x3a9c('0x15'));_0xdd95f5(_0x4ffd29[_0x3a9c('0x16')][_0x3a9c('0x14')]);}})[_0x3a9c('0x17')](function(_0x5f546d){logger[_0x3a9c('0x13')](_0x3a9c('0xf'),_0x1cd332,_0x5f546d);_0x11667f(_0x5f546d);});});} \ No newline at end of file +var _0xb416=['AnalyticCustomReport,\x20%s,\x20%s','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3c2407,_0x3c9a47){var _0x5d2eac=function(_0xb33bf8){while(--_0xb33bf8){_0x3c2407['push'](_0x3c2407['shift']());}};_0x5d2eac(++_0x3c9a47);}(_0xb416,0xe9));var _0x6b41=function(_0xa3fdc,_0x5aab57){_0xa3fdc=_0xa3fdc-0x0;var _0x50b95f=_0xb416[_0xa3fdc];return _0x50b95f;};'use strict';var _=require(_0x6b41('0x0'));var util=require(_0x6b41('0x1'));var moment=require('moment');var BPromise=require(_0x6b41('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6b41('0x3'));var db=require(_0x6b41('0x4'))['db'];var utils=require(_0x6b41('0x5'));var logger=require('../../config/logger')(_0x6b41('0x6'));var config=require(_0x6b41('0x7'));var jayson=require(_0x6b41('0x8'));var client=jayson[_0x6b41('0x9')][_0x6b41('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cbf10,_0x5d1452,_0x384c9b){return new BPromise(function(_0x23a7fd,_0xe5e5fa){return client[_0x6b41('0xb')](_0x2cbf10,_0x384c9b)[_0x6b41('0xc')](function(_0x244b2){logger[_0x6b41('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5d1452,_0x6b41('0xe'));logger[_0x6b41('0xf')](_0x6b41('0x10'),_0x5d1452,_0x6b41('0xe'),JSON[_0x6b41('0x11')](_0x244b2));if(_0x244b2[_0x6b41('0x12')]){if(_0x244b2[_0x6b41('0x12')][_0x6b41('0x13')]===0x1f4){logger[_0x6b41('0x12')](_0x6b41('0x14'),_0x5d1452,_0x244b2[_0x6b41('0x12')][_0x6b41('0x15')]);return _0xe5e5fa(_0x244b2[_0x6b41('0x12')][_0x6b41('0x15')]);}logger['error'](_0x6b41('0x14'),_0x5d1452,_0x244b2[_0x6b41('0x12')][_0x6b41('0x15')]);return _0x23a7fd(_0x244b2[_0x6b41('0x12')][_0x6b41('0x15')]);}else{logger[_0x6b41('0xd')](_0x6b41('0x14'),_0x5d1452,_0x6b41('0xe'));_0x23a7fd(_0x244b2['result'][_0x6b41('0x15')]);}})[_0x6b41('0x16')](function(_0x3538d2){logger[_0x6b41('0x12')](_0x6b41('0x14'),_0x5d1452,_0x3538d2);_0xe5e5fa(_0x3538d2);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 839c1d3..67c79a8 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 _0xf83f=['show','/:id/preview','preview','/:id/run','run','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','./analyticCustomReport.controller','isAuthenticated','get','/:id'];(function(_0x23a298,_0x21adb7){var _0x31a410=function(_0x3350b9){while(--_0x3350b9){_0x23a298['push'](_0x23a298['shift']());}};_0x31a410(++_0x21adb7);}(_0xf83f,0x185));var _0xff83=function(_0x2b553d,_0x5bc904){_0x2b553d=_0x2b553d-0x0;var _0xe9b379=_0xf83f[_0x2b553d];return _0xe9b379;};'use strict';var multer=require(_0xff83('0x0'));var util=require(_0xff83('0x1'));var path=require(_0xff83('0x2'));var timeout=require('connect-timeout');var express=require(_0xff83('0x3'));var router=express[_0xff83('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xff83('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xff83('0x6'));router['get']('/',auth[_0xff83('0x7')](),controller['index']);router[_0xff83('0x8')](_0xff83('0x9'),auth[_0xff83('0x7')](),controller[_0xff83('0xa')]);router[_0xff83('0x8')](_0xff83('0xb'),auth[_0xff83('0x7')](),controller[_0xff83('0xc')]);router[_0xff83('0x8')](_0xff83('0xd'),auth[_0xff83('0x7')](),controller[_0xff83('0xe')]);router[_0xff83('0x8')]('/:id/query',auth['isAuthenticated'](),controller['query']);router['post']('/',auth[_0xff83('0x7')](),controller['create']);router['put'](_0xff83('0x9'),auth[_0xff83('0x7')](),controller[_0xff83('0xf')]);router[_0xff83('0x10')](_0xff83('0x9'),auth[_0xff83('0x7')](),controller[_0xff83('0x11')]);module[_0xff83('0x12')]=router; \ No newline at end of file +var _0xb995=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','/:id','isAuthenticated','show','/:id/preview','/:id/run','run','query','post','create','put','delete','exports'];(function(_0xa643d4,_0x550359){var _0x290eae=function(_0x312219){while(--_0x312219){_0xa643d4['push'](_0xa643d4['shift']());}};_0x290eae(++_0x550359);}(_0xb995,0xb0));var _0x5b99=function(_0x557448,_0xd6a91){_0x557448=_0x557448-0x0;var _0x307ded=_0xb995[_0x557448];return _0x307ded;};'use strict';var multer=require(_0x5b99('0x0'));var util=require('util');var path=require(_0x5b99('0x1'));var timeout=require(_0x5b99('0x2'));var express=require(_0x5b99('0x3'));var router=express[_0x5b99('0x4')]();var fs_extra=require(_0x5b99('0x5'));var auth=require(_0x5b99('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5b99('0x7'));var controller=require(_0x5b99('0x8'));router[_0x5b99('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5b99('0x9')](_0x5b99('0xa'),auth[_0x5b99('0xb')](),controller[_0x5b99('0xc')]);router[_0x5b99('0x9')](_0x5b99('0xd'),auth['isAuthenticated'](),controller['preview']);router['get'](_0x5b99('0xe'),auth[_0x5b99('0xb')](),controller[_0x5b99('0xf')]);router[_0x5b99('0x9')]('/:id/query',auth['isAuthenticated'](),controller[_0x5b99('0x10')]);router[_0x5b99('0x11')]('/',auth[_0x5b99('0xb')](),controller[_0x5b99('0x12')]);router[_0x5b99('0x13')](_0x5b99('0xa'),auth[_0x5b99('0xb')](),controller['update']);router[_0x5b99('0x14')](_0x5b99('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x5b99('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 8f66acb..05a985b 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 _0xac9d=['TEXT','sequelize','exports','STRING'];(function(_0x474ba7,_0x1d74c6){var _0x422657=function(_0x570f82){while(--_0x570f82){_0x474ba7['push'](_0x474ba7['shift']());}};_0x422657(++_0x1d74c6);}(_0xac9d,0x14d));var _0xdac9=function(_0x3d7a9f,_0x24e0f1){_0x3d7a9f=_0x3d7a9f-0x0;var _0x13f5f1=_0xac9d[_0x3d7a9f];return _0x13f5f1;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'name':{'type':Sequelize[_0xdac9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdac9('0x2')]},'parent':{'type':Sequelize[_0xdac9('0x2')]},'table':{'type':Sequelize[_0xdac9('0x2')]},'conditions':{'type':Sequelize[_0xdac9('0x3')]},'joins':{'type':Sequelize[_0xdac9('0x3')]}}; \ No newline at end of file +var _0x425d=['sequelize','STRING','TEXT'];(function(_0x18db4d,_0x1379ad){var _0xa96e87=function(_0x5661c8){while(--_0x5661c8){_0x18db4d['push'](_0x18db4d['shift']());}};_0xa96e87(++_0x1379ad);}(_0x425d,0x1e0));var _0xd425=function(_0x129bed,_0x529bf2){_0x129bed=_0x129bed-0x0;var _0x286f63=_0x425d[_0x129bed];return _0x286f63;};'use strict';var Sequelize=require(_0xd425('0x0'));module['exports']={'name':{'type':Sequelize[_0xd425('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xd425('0x1')]},'parent':{'type':Sequelize[_0xd425('0x1')]},'table':{'type':Sequelize[_0xd425('0x1')]},'conditions':{'type':Sequelize[_0xd425('0x2')]},'joins':{'type':Sequelize[_0xd425('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 6e360c4..5aa1d13 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 _0x2675=['AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','table','MetricId','metric','field','function','replace','format','groupBy','order','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20EMPTY','Sequelize','keyBy','from','alias','output','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','MIN(%s)','debug','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','DefaultReports','name','map'];(function(_0x2ef9e2,_0x376185){var _0x2d4632=function(_0x4abaf4){while(--_0x4abaf4){_0x2ef9e2['push'](_0x2ef9e2['shift']());}};_0x2d4632(++_0x376185);}(_0x2675,0x75));var _0x5267=function(_0x1ca795,_0x3f3b29){_0x1ca795=_0x1ca795-0x0;var _0x499bb5=_0x2675[_0x1ca795];return _0x499bb5;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];var dbH=require(_0x5267('0x15'))[_0x5267('0x16')];function respondWithStatusCode(_0x1171b9,_0x20785c){_0x20785c=_0x20785c||0xcc;return function(_0x36dc17){if(_0x36dc17){return _0x1171b9[_0x5267('0x17')](_0x20785c);}return _0x1171b9[_0x5267('0x18')](_0x20785c)[_0x5267('0x19')]();};}function respondWithResult(_0x29349a,_0x3e2bab){_0x3e2bab=_0x3e2bab||0xc8;return function(_0x548040){if(_0x548040){return _0x29349a['status'](_0x3e2bab)[_0x5267('0x1a')](_0x548040);}};}function respondWithFilteredResult(_0x40d897,_0x38a147){return function(_0x3f5344){if(_0x3f5344){var _0x46b2c2=typeof _0x38a147[_0x5267('0x1b')]===_0x5267('0x1c')&&typeof _0x38a147[_0x5267('0x1d')]===_0x5267('0x1c');var _0xb1c97a=_0x3f5344[_0x5267('0x1e')];var _0x1ab03=_0x46b2c2?0x0:_0x38a147['offset'];var _0x18f32e=_0x46b2c2?_0x3f5344[_0x5267('0x1e')]:_0x38a147['offset']+_0x38a147[_0x5267('0x1d')];var _0x56733e;if(_0x18f32e>=_0xb1c97a){_0x18f32e=_0xb1c97a;_0x56733e=0xc8;}else{_0x56733e=0xce;}_0x40d897[_0x5267('0x18')](_0x56733e);return _0x40d897[_0x5267('0x1f')](_0x5267('0x20'),_0x1ab03+'-'+_0x18f32e+'/'+_0xb1c97a)[_0x5267('0x1a')](_0x3f5344);}return null;};}function patchUpdates(_0x5ca9c6){return function(_0x4dd637){try{jsonpatch[_0x5267('0x21')](_0x4dd637,_0x5ca9c6,!![]);}catch(_0x5aebdd){return BPromise[_0x5267('0x22')](_0x5aebdd);}return _0x4dd637[_0x5267('0x23')]();};}function saveUpdates(_0x3b53ac,_0x56dd95){return function(_0x499f19){if(_0x499f19){return _0x499f19['update'](_0x3b53ac)['then'](function(_0x5ea6a6){return _0x5ea6a6;});}return null;};}function removeEntity(_0x26c7f8,_0x399e64){return function(_0x2d761d){if(_0x2d761d){return _0x2d761d[_0x5267('0x24')]()[_0x5267('0x25')](function(){var _0x40d1be=_0x2d761d[_0x5267('0x26')]({'plain':!![]});var _0x220e03=_0x5267('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x220e03,'resourceId':_0x40d1be['id']}})[_0x5267('0x25')](function(){return _0x2d761d;});})[_0x5267('0x25')](function(){_0x26c7f8['status'](0xcc)[_0x5267('0x19')]();});}};}function handleEntityNotFound(_0x52504e,_0x4d7c2a){return function(_0x43e7e7){if(!_0x43e7e7){_0x52504e[_0x5267('0x17')](0x194);}return _0x43e7e7;};}function handleError(_0x1f33b7,_0x2d2ace){_0x2d2ace=_0x2d2ace||0x1f4;return function(_0x33c431){logger['error'](_0x33c431['stack']);if(_0x33c431[_0x5267('0x28')]){delete _0x33c431[_0x5267('0x28')];}_0x1f33b7[_0x5267('0x18')](_0x2d2ace)['send'](_0x33c431);};}exports['index']=function(_0xbe7922,_0x3ef2a8){var _0x1fa725={},_0x5bec7e={},_0x59b091={'count':0x0,'rows':[]};var _0x2249a1=_[_0x5267('0x29')](db[_0x5267('0x2a')][_0x5267('0x2b')],function(_0x5bbb83){return{'name':_0x5bbb83[_0x5267('0x2c')],'type':_0x5bbb83[_0x5267('0x2d')][_0x5267('0x2e')]};});_0x5bec7e[_0x5267('0x2f')]=_[_0x5267('0x29')](_0x2249a1,_0x5267('0x28'));_0x5bec7e[_0x5267('0x30')]=_[_0x5267('0x31')](_0xbe7922['query']);_0x5bec7e['filters']=_[_0x5267('0x32')](_0x5bec7e['model'],_0x5bec7e[_0x5267('0x30')]);_0x1fa725[_0x5267('0x33')]=_[_0x5267('0x32')](_0x5bec7e[_0x5267('0x2f')],qs['fields'](_0xbe7922[_0x5267('0x30')][_0x5267('0x34')]));_0x1fa725[_0x5267('0x33')]=_0x1fa725[_0x5267('0x33')][_0x5267('0x35')]?_0x1fa725[_0x5267('0x33')]:_0x5bec7e[_0x5267('0x2f')];if(!_0xbe7922[_0x5267('0x30')]['hasOwnProperty'](_0x5267('0x36'))){_0x1fa725['limit']=qs[_0x5267('0x1d')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1d')]);_0x1fa725[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1b')]);}_0x1fa725['order']=qs[_0x5267('0x37')](_0xbe7922[_0x5267('0x30')][_0x5267('0x37')]);_0x1fa725[_0x5267('0x38')]=qs[_0x5267('0x39')](_[_0x5267('0x3a')](_0xbe7922[_0x5267('0x30')],_0x5bec7e['filters']),_0x2249a1);if(_0xbe7922[_0x5267('0x30')]['filter']){_0x1fa725[_0x5267('0x38')]=_['merge'](_0x1fa725['where'],{'$or':_['map'](_0x2249a1,function(_0x46bfcc){if(_0x46bfcc['type']!==_0x5267('0x3b')){var _0x146476={};_0x146476[_0x46bfcc[_0x5267('0x28')]]={'$like':'%'+_0xbe7922[_0x5267('0x30')]['filter']+'%'};return _0x146476;}})});}_0x1fa725=_[_0x5267('0x3c')]({},_0x1fa725,_0xbe7922[_0x5267('0x3d')]);var _0x588edf={'where':_0x1fa725['where']};return db[_0x5267('0x2a')]['count'](_0x588edf)[_0x5267('0x25')](function(_0x1cf94a){_0x59b091[_0x5267('0x1e')]=_0x1cf94a;if(_0xbe7922[_0x5267('0x30')][_0x5267('0x3e')]){_0x1fa725[_0x5267('0x3f')]=[{'all':!![]}];}return db[_0x5267('0x2a')]['findAll'](_0x1fa725);})['then'](function(_0x28ea4a){_0x59b091['rows']=_0x28ea4a;return _0x59b091;})[_0x5267('0x25')](respondWithFilteredResult(_0x3ef2a8,_0x1fa725))[_0x5267('0x40')](handleError(_0x3ef2a8,null));};exports['show']=function(_0x1fa925,_0xc764cd){var _0x299a13={'raw':!![],'where':{'id':_0x1fa925[_0x5267('0x41')]['id']}},_0x161fed={};_0x161fed[_0x5267('0x2f')]=_[_0x5267('0x31')](db[_0x5267('0x2a')][_0x5267('0x2b')]);_0x161fed['query']=_[_0x5267('0x31')](_0x1fa925[_0x5267('0x30')]);_0x161fed[_0x5267('0x39')]=_[_0x5267('0x32')](_0x161fed[_0x5267('0x2f')],_0x161fed['query']);_0x299a13[_0x5267('0x33')]=_['intersection'](_0x161fed[_0x5267('0x2f')],qs['fields'](_0x1fa925['query'][_0x5267('0x34')]));_0x299a13['attributes']=_0x299a13[_0x5267('0x33')][_0x5267('0x35')]?_0x299a13[_0x5267('0x33')]:_0x161fed[_0x5267('0x2f')];if(_0x1fa925['query'][_0x5267('0x3e')]){_0x299a13['include']=[{'all':!![]}];}_0x299a13=_['merge']({},_0x299a13,_0x1fa925[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x299a13)['then'](handleEntityNotFound(_0xc764cd,null))[_0x5267('0x25')](respondWithResult(_0xc764cd,null))[_0x5267('0x40')](handleError(_0xc764cd,null));};exports[_0x5267('0x42')]=function(_0x1b5a7e,_0x1c2803){return db[_0x5267('0x2a')][_0x5267('0x42')](_0x1b5a7e[_0x5267('0x43')],{})[_0x5267('0x25')](function(_0x2cfe09){var _0x21b040=_0x1b5a7e[_0x5267('0x44')][_0x5267('0x26')]({'plain':!![]});if(!_0x21b040)throw new Error(_0x5267('0x45'));if(_0x21b040['role']===_0x5267('0x44')){var _0x466d46=_0x2cfe09[_0x5267('0x26')]({'plain':!![]});var _0x4f0148=_0x5267('0x46');return db[_0x5267('0x47')][_0x5267('0x48')]({'where':{'name':_0x4f0148,'userProfileId':_0x21b040[_0x5267('0x49')]},'raw':!![]})[_0x5267('0x25')](function(_0x1457cf){if(_0x1457cf&&_0x1457cf['autoAssociation']===0x0){return db[_0x5267('0x4a')]['create']({'name':_0x466d46[_0x5267('0x28')],'resourceId':_0x466d46['id'],'type':_0x5267('0x27'),'sectionId':_0x1457cf['id']},{})[_0x5267('0x25')](function(){return _0x2cfe09;});}else{return _0x2cfe09;}})[_0x5267('0x40')](function(_0x91b932){logger[_0x5267('0x4b')](_0x5267('0x4c'),_0x91b932);throw _0x91b932;});}return _0x2cfe09;})['then'](respondWithResult(_0x1c2803,0xc9))['catch'](handleError(_0x1c2803,null));};exports[_0x5267('0x4d')]=function(_0x15b5c9,_0x566b6f){if(_0x15b5c9[_0x5267('0x43')]['id']){delete _0x15b5c9['body']['id'];}return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0x15b5c9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x566b6f,null))[_0x5267('0x25')](saveUpdates(_0x15b5c9[_0x5267('0x43')],null))[_0x5267('0x25')](respondWithResult(_0x566b6f,null))[_0x5267('0x40')](handleError(_0x566b6f,null));};exports[_0x5267('0x24')]=function(_0xf0b5a9,_0x43d254){return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0xf0b5a9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x43d254,null))[_0x5267('0x25')](removeEntity(_0x43d254,null))[_0x5267('0x40')](handleError(_0x43d254,null));};exports[_0x5267('0x4e')]=function(_0x552211,_0x195575){var _0x5ad1ce=0xa;var _0x1522d6=[_0x5267('0x4f'),_0x5267('0x50'),'right_join',_0x5267('0x51')];var _0x161dab={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x51220c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x4e3771=function(_0x489780){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),'IS\x20EMPTY',_0x5267('0x60')],_0x489780);};var _0xc88193=function(_0x293e61){if(!_0x293e61||!_0x293e61[_0x5267('0x61')]['length']){return'';}for(var _0x5a87b5='(',_0x540ab8=0x0;_0x540ab8<_0x293e61[_0x5267('0x61')][_0x5267('0x35')];_0x540ab8+=0x1){_0x540ab8>0x0&&(_0x5a87b5+='\x20'+_0x293e61[_0x5267('0x62')]+'\x20');_0x5a87b5+=_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]?_0xc88193(_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]):_0x293e61[_0x5267('0x61')][_0x540ab8]['field']+'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x64')]+(_0x4e3771(_0x293e61['rules'][_0x540ab8][_0x5267('0x64')])?'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x65')]:'');}return _0x5a87b5+')';};var _0x1b6dd7={'where':{'id':_0x552211[_0x5267('0x41')]['id']}},_0x19adf5,_0xde1ecd,_0x4915f4,_0x2ca259,_0x726410;_0x1b6dd7=_[_0x5267('0x3c')]({},_0x1b6dd7,_0x552211[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x1b6dd7)[_0x5267('0x25')](function(_0x87465){if(_0x87465){_0x19adf5=_0x87465;return _0x87465[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x1a4016){if(_0x1a4016){if(!_0x1a4016[_0x5267('0x35')]){throw new db['Sequelize'][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0xde1ecd=_0x1a4016;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x516e6e){if(_0x516e6e){_0x4915f4=_['keyBy'](_0x516e6e,'id');var _0x910f97;var _0x5cca85=squel[_0x5267('0x6b')]();_0x5cca85['from'](_0x19adf5[_0x5267('0x6c')]);for(var _0x1150ba=0x0;_0x1150ba<_0xde1ecd[_0x5267('0x35')];_0x1150ba+=0x1){_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x6d')]?_0x4915f4[_0xde1ecd[_0x1150ba][_0x5267('0x6d')]][_0x5267('0x6e')]:_0xde1ecd[_0x1150ba][_0x5267('0x6f')];_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x70')]?_['replace'](_0x161dab[_0xde1ecd[_0x1150ba]['function']],'%s',_0x910f97):_0x910f97;_0x910f97=_0xde1ecd[_0x1150ba]['format']?_[_0x5267('0x71')](_0x51220c[_0xde1ecd[_0x1150ba][_0x5267('0x72')]],'%s',_0x910f97):_0x910f97;if(_0xde1ecd[_0x1150ba][_0x5267('0x73')]){_0x5cca85[_0x5267('0x63')](_0x910f97);}_0xde1ecd[_0x1150ba]['orderBy']&&_0x5cca85[_0x5267('0x74')](_0x910f97,_0xde1ecd[_0x1150ba][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x5cca85[_0x5267('0x6f')](_0x910f97,_0xde1ecd[_0x1150ba]['alias']||_0x910f97);}if(_0x19adf5[_0x5267('0x77')]){_0x19adf5[_0x5267('0x77')]=JSON['parse'](_0x19adf5[_0x5267('0x77')]);for(var _0x268805=0x0;_0x268805<_0x19adf5['joins']['length'];_0x268805+=0x1){if(_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x2d')]&&_['includes'](_0x1522d6,_0x19adf5['joins'][_0x268805][_0x5267('0x2d')])&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')]&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')]&&_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]){_0x5cca85[_0x19adf5[_0x5267('0x77')][_0x268805]['type']](_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x19adf5[_0x5267('0x6c')],_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')],_0x19adf5[_0x5267('0x77')][_0x268805]['foreignTable'],_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]));}}}if(_0x19adf5[_0x5267('0x7c')]){_0x19adf5[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x19adf5['conditions']);_0x5cca85[_0x5267('0x38')](_0xc88193(_0x19adf5['conditions'][_0x5267('0x63')]));}_0x726410=_0x5cca85[_0x5267('0x7e')]();_0x5cca85[_0x5267('0x1d')](_0x5ad1ce);_0x5cca85[_0x5267('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x5cca85[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x5cca85[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')]['SELECT']});}})[_0x5267('0x25')](respondWithResult(_0x195575,null))['catch'](handleError(_0x195575,null));};function runReport(_0x418a03,_0x5b8026,_0x2c2b95){var _0x20888d=_0x5b8026[_0x5267('0x28')];var _0x87aa90=0xa;var _0x164cc1=[_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x82'),_0x5267('0x51')];var _0x28e4b6={'SUM':_0x5267('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0xd18795={'SEC_TO_TIME':_0x5267('0x83'),'DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x2543a4=function(_0x2feea8){return!_[_0x5267('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5267('0x84'),_0x5267('0x60')],_0x2feea8);};var _0x199ff6=function(_0xbf36fb){if(!_0xbf36fb||!_0xbf36fb['rules'][_0x5267('0x35')]){return'';}for(var _0x3cc775='(',_0x2630f2=0x0;_0x2630f2<_0xbf36fb[_0x5267('0x61')][_0x5267('0x35')];_0x2630f2+=0x1){_0x2630f2>0x0&&(_0x3cc775+='\x20'+_0xbf36fb[_0x5267('0x62')]+'\x20');_0x3cc775+=_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]?_0x199ff6(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]):_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x6f')]+'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2]['condition']+(_0x2543a4(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x64')])?'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x65')]:'');}return _0x3cc775+')';};var _0x447b5f={'where':{'id':_0x418a03['id']}},_0x25ce90,_0x257c69,_0x160c9c,_0x42694a,_0x11a2f4;_0x447b5f=_[_0x5267('0x3c')]({},_0x447b5f,_0x2c2b95);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x447b5f)[_0x5267('0x25')](function(_0x35c3b7){if(_0x35c3b7){_0x25ce90=_0x35c3b7;return _0x35c3b7[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x35a4a3){if(_0x35a4a3){if(!_0x35a4a3[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0x257c69=_0x35a4a3;return db[_0x5267('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x318393){if(_0x318393){_0x160c9c=_[_0x5267('0x86')](_0x318393,'id');var _0x405eb4;var _0x38f5b7=squel['select']();_0x38f5b7[_0x5267('0x87')](_0x25ce90[_0x5267('0x6c')]);for(var _0x4c68cd=0x0;_0x4c68cd<_0x257c69['length'];_0x4c68cd+=0x1){_0x405eb4=_0x257c69[_0x4c68cd]['MetricId']?_0x160c9c[_0x257c69[_0x4c68cd][_0x5267('0x6d')]]['metric']:_0x257c69[_0x4c68cd][_0x5267('0x6f')];_0x405eb4=_0x257c69[_0x4c68cd]['function']?_['replace'](_0x28e4b6[_0x257c69[_0x4c68cd][_0x5267('0x70')]],'%s',_0x405eb4):_0x405eb4;_0x405eb4=_0x257c69[_0x4c68cd][_0x5267('0x72')]?_[_0x5267('0x71')](_0xd18795[_0x257c69[_0x4c68cd][_0x5267('0x72')]],'%s',_0x405eb4):_0x405eb4;if(_0x257c69[_0x4c68cd][_0x5267('0x73')]){_0x38f5b7['group'](_0x405eb4);}_0x257c69[_0x4c68cd]['orderBy']&&_0x38f5b7[_0x5267('0x74')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x38f5b7[_0x5267('0x6f')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x88')]||_0x405eb4);}if(_0x25ce90['joins']){_0x25ce90[_0x5267('0x77')]=JSON['parse'](_0x25ce90['joins']);for(var _0x3dfd8d=0x0;_0x3dfd8d<_0x25ce90['joins']['length'];_0x3dfd8d+=0x1){if(_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x2d')]&&_['includes'](_0x164cc1,_0x25ce90['joins'][_0x3dfd8d]['type'])&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['parentKey']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x7a')]){_0x38f5b7[_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x2d')]](_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x25ce90[_0x5267('0x6c')],_0x25ce90['joins'][_0x3dfd8d]['parentKey'],_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable'],_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x7a')]));}}}if(_0x25ce90['conditions']){_0x25ce90[_0x5267('0x7c')]=JSON['parse'](_0x25ce90[_0x5267('0x7c')]);_0x38f5b7['where'](_0x199ff6(_0x25ce90[_0x5267('0x7c')][_0x5267('0x63')]));}_0x11a2f4=_0x38f5b7[_0x5267('0x7e')]();_0x38f5b7[_0x5267('0x1d')](_0x87aa90);_0x38f5b7[_0x5267('0x1b')](0x0);return;}})[_0x5267('0x25')](function(){if(_0x5b8026[_0x5267('0x89')]==='web'){return null;}var _0x4df99f=_[_0x5267('0x3c')](_0x5b8026,{'name':_0x5b8026['fullPath']||_0x5b8026['name']||_0x25ce90['name'],'basename':_0x20888d,'savename':util['format']('%s-%s.%s',_0x5b8026['name']||_0x25ce90[_0x5267('0x28')],require(_0x5267('0x8a'))[_0x5267('0x8b')](0x4),_0x5b8026[_0x5267('0x89')]||_0x5267('0x8c')),'reportId':_0x25ce90['id'],'reportType':_0x5267('0x8d')});return db[_0x5267('0x8e')][_0x5267('0x42')](_0x4df99f,{'raw':!![]});})['then'](function(_0x5df23d){if(_0x25ce90['table']===_0x5267('0x8f')){_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+_0x5267('0x90'),_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}else{_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}if(_0x5df23d){logger[_0x5267('0x93')](_0x5267('0x94'),_0x11a2f4[_0x5267('0x7f')]());require(_0x5267('0x95'))[_0x5267('0x96')](path['join'](__dirname,'../../components/export/',_0x5df23d['output']),[_0x5df23d['id'],_0x11a2f4[_0x5267('0x7f')](),path[_0x5267('0x4f')](__dirname,_0x5267('0x97'),_0x5df23d[_0x5267('0x98')]),_0x20888d]);return _0x5df23d;}else{var _0x190ef4=squel[_0x5267('0x6b')]();_0x190ef4['from']('('+_0x11a2f4[_0x5267('0x7f')]()+')','countTable');_0x190ef4[_0x5267('0x6f')](_0x5267('0x99'),_0x5267('0x1e'));_0x11a2f4[_0x5267('0x1d')](_0x5b8026[_0x5267('0x1d')]||_0x87aa90);_0x11a2f4['offset'](_0x5b8026[_0x5267('0x1b')]||0x0);return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x190ef4['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5267('0x9a')]})[_0x5267('0x25')](function(_0x1be763){if(!_0x1be763[_0x5267('0x35')]){_0x42694a=0x0;}else{_0x42694a=_0x1be763[0x0]['count']||0x0;}return dbH['sequelize'][_0x5267('0x30')](_0x11a2f4[_0x5267('0x7f')](),{'type':dbH['sequelize'][_0x5267('0x81')][_0x5267('0x9a')]});})['then'](function(_0x5005b3){return{'rows':_0x5005b3||[],'count':_0x42694a};});}});}exports[_0x5267('0x9b')]=function(_0x11a6f4,_0x5a16ee){return runReport(_0x11a6f4[_0x5267('0x41')],_0x11a6f4[_0x5267('0x30')],_0x11a6f4[_0x5267('0x3d')])[_0x5267('0x25')](respondWithResult(_0x5a16ee,null))[_0x5267('0x40')](handleError(_0x5a16ee,null));};exports[_0x5267('0x9c')]=runReport;exports[_0x5267('0x30')]=function(_0x1e9651,_0x66da7a){var _0x54b582=0xa;var _0x4e4724=[_0x5267('0x4f'),'left_join',_0x5267('0x82'),_0x5267('0x51')];var _0x2722f9={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':_0x5267('0x9d'),'AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x5909b3={'SEC_TO_TIME':_0x5267('0x83'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x1d7987=function(_0x59efe1){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x84'),_0x5267('0x60')],_0x59efe1);};var _0x46c79e=function(_0xcfba51){if(!_0xcfba51||!_0xcfba51[_0x5267('0x61')][_0x5267('0x35')]){return'';}for(var _0x3c5516='(',_0x1e8367=0x0;_0x1e8367<_0xcfba51[_0x5267('0x61')]['length'];_0x1e8367+=0x1){_0x1e8367>0x0&&(_0x3c5516+='\x20'+_0xcfba51[_0x5267('0x62')]+'\x20');_0x3c5516+=_0xcfba51[_0x5267('0x61')][_0x1e8367]['group']?_0x46c79e(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x63')]):_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x6f')]+'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x64')]+(_0x1d7987(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x64')])?'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x65')]:'');}return _0x3c5516+')';};var _0x19935d={'where':{'id':_0x1e9651[_0x5267('0x41')]['id']}},_0x3102e0,_0x2d215e,_0xc0af94,_0x178080,_0x3485ab;_0x19935d=_[_0x5267('0x3c')]({},_0x19935d,_0x1e9651['options']);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x19935d)['then'](function(_0x17d2d4){if(_0x17d2d4){_0x3102e0=_0x17d2d4;return _0x17d2d4['getFields']();}return null;})[_0x5267('0x25')](function(_0x4c5a26){if(_0x4c5a26){if(!_0x4c5a26[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d215e=_0x4c5a26;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x1a0883){if(_0x1a0883){_0xc0af94=_[_0x5267('0x86')](_0x1a0883,'id');var _0x501da6;var _0x3dcf73=squel['select']();_0x3dcf73['from'](_0x3102e0['table']);for(var _0x1ded05=0x0;_0x1ded05<_0x2d215e[_0x5267('0x35')];_0x1ded05+=0x1){_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x6d')]?_0xc0af94[_0x2d215e[_0x1ded05][_0x5267('0x6d')]][_0x5267('0x6e')]:_0x2d215e[_0x1ded05][_0x5267('0x6f')];_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x70')]?_['replace'](_0x2722f9[_0x2d215e[_0x1ded05]['function']],'%s',_0x501da6):_0x501da6;_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x72')]?_[_0x5267('0x71')](_0x5909b3[_0x2d215e[_0x1ded05][_0x5267('0x72')]],'%s',_0x501da6):_0x501da6;if(_0x2d215e[_0x1ded05][_0x5267('0x73')]){_0x3dcf73[_0x5267('0x63')](_0x501da6);}_0x2d215e[_0x1ded05]['orderBy']&&_0x3dcf73[_0x5267('0x74')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x3dcf73[_0x5267('0x6f')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x88')]||_0x501da6);}if(_0x3102e0['joins']){_0x3102e0[_0x5267('0x77')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x77')]);for(var _0x4bfafd=0x0;_0x4bfafd<_0x3102e0[_0x5267('0x77')]['length'];_0x4bfafd+=0x1){if(_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]&&_['includes'](_0x4e4724,_0x3102e0[_0x5267('0x77')][_0x4bfafd]['type'])&&_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')]&&_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')]&&_0x3102e0[_0x5267('0x77')][_0x4bfafd]['foreignKey']){_0x3dcf73[_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]](_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x79')],null,util[_0x5267('0x72')]('%s.%s\x20=\x20%s.%s',_0x3102e0['table'],_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x7a')]));}}}if(_0x3102e0[_0x5267('0x7c')]){_0x3102e0[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x7c')]);_0x3dcf73[_0x5267('0x38')](_0x46c79e(_0x3102e0[_0x5267('0x7c')][_0x5267('0x63')]));}_0x3485ab=_0x3dcf73[_0x5267('0x7e')]();_0x3dcf73[_0x5267('0x1d')](_0x54b582);_0x3dcf73[_0x5267('0x1b')](0x0);logger[_0x5267('0x9e')]('Limited\x20Query:',_0x3dcf73[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x3dcf73[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')][_0x5267('0x9a')]});}})[_0x5267('0x25')](function(){return{'sql':_0x3485ab[_0x5267('0x7f')]()};})[_0x5267('0x25')](respondWithResult(_0x66da7a,null))[_0x5267('0x40')](handleError(_0x66da7a,null));}; \ No newline at end of file +var _0x1cb9=['runReport','left_join','SEC_TO_TIME(%s)','IS\x20NULL','clone','debug','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','apply','reject','then','destroy','get','UserProfileResource','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','body','user','role','autoAssociation','create','DefaultReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','order','DESC','joins','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','COUNT(%s)','GROUP_CONCAT(%s)','HOUR(%s)','value','groupBy','alias','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)'];(function(_0x5db576,_0xd3f8c1){var _0x19ef5b=function(_0x1f7a28){while(--_0x1f7a28){_0x5db576['push'](_0x5db576['shift']());}};_0x19ef5b(++_0xd3f8c1);}(_0x1cb9,0x14e));var _0x91cb=function(_0x2f5aa0,_0x2de038){_0x2f5aa0=_0x2f5aa0-0x0;var _0x498021=_0x1cb9[_0x2f5aa0];return _0x498021;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];var dbH=require(_0x91cb('0x18'))['dbH'];function respondWithStatusCode(_0x20e6e0,_0x3ea707){_0x3ea707=_0x3ea707||0xcc;return function(_0x44f2e9){if(_0x44f2e9){return _0x20e6e0[_0x91cb('0x19')](_0x3ea707);}return _0x20e6e0['status'](_0x3ea707)['end']();};}function respondWithResult(_0x4aae25,_0x3d22b7){_0x3d22b7=_0x3d22b7||0xc8;return function(_0x585470){if(_0x585470){return _0x4aae25['status'](_0x3d22b7)[_0x91cb('0x1a')](_0x585470);}};}function respondWithFilteredResult(_0xc3629e,_0x347980){return function(_0x5ea796){if(_0x5ea796){var _0x238f11=typeof _0x347980[_0x91cb('0x1b')]==='undefined'&&typeof _0x347980[_0x91cb('0x1c')]===_0x91cb('0x1d');var _0x1cd34b=_0x5ea796[_0x91cb('0x1e')];var _0x5cc1c3=_0x238f11?0x0:_0x347980[_0x91cb('0x1b')];var _0x7dcf60=_0x238f11?_0x5ea796['count']:_0x347980[_0x91cb('0x1b')]+_0x347980['limit'];var _0x55042a;if(_0x7dcf60>=_0x1cd34b){_0x7dcf60=_0x1cd34b;_0x55042a=0xc8;}else{_0x55042a=0xce;}_0xc3629e[_0x91cb('0x1f')](_0x55042a);return _0xc3629e[_0x91cb('0x20')]('Content-Range',_0x5cc1c3+'-'+_0x7dcf60+'/'+_0x1cd34b)['json'](_0x5ea796);}return null;};}function patchUpdates(_0x5b385a){return function(_0x438162){try{jsonpatch[_0x91cb('0x21')](_0x438162,_0x5b385a,!![]);}catch(_0x20aff5){return BPromise[_0x91cb('0x22')](_0x20aff5);}return _0x438162['save']();};}function saveUpdates(_0x45c4b3,_0x43881c){return function(_0x1fa837){if(_0x1fa837){return _0x1fa837['update'](_0x45c4b3)[_0x91cb('0x23')](function(_0x1a7a54){return _0x1a7a54;});}return null;};}function removeEntity(_0x2447e7,_0x422d14){return function(_0x3ca500){if(_0x3ca500){return _0x3ca500[_0x91cb('0x24')]()[_0x91cb('0x23')](function(){var _0x423c4f=_0x3ca500[_0x91cb('0x25')]({'plain':!![]});var _0x4c8438='DefaultReports';return db[_0x91cb('0x26')]['destroy']({'where':{'type':_0x4c8438,'resourceId':_0x423c4f['id']}})[_0x91cb('0x23')](function(){return _0x3ca500;});})[_0x91cb('0x23')](function(){_0x2447e7[_0x91cb('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9b26a6,_0x4f5a7b){return function(_0x4572f6){if(!_0x4572f6){_0x9b26a6[_0x91cb('0x19')](0x194);}return _0x4572f6;};}function handleError(_0x3b3ee6,_0x2fb473){_0x2fb473=_0x2fb473||0x1f4;return function(_0x468908){logger['error'](_0x468908[_0x91cb('0x27')]);if(_0x468908['name']){delete _0x468908[_0x91cb('0x28')];}_0x3b3ee6[_0x91cb('0x1f')](_0x2fb473)[_0x91cb('0x29')](_0x468908);};}exports['index']=function(_0x775c25,_0x146e1f){var _0x25bbf9={},_0x361e4c={},_0xf296bc={'count':0x0,'rows':[]};var _0x3dab18=_[_0x91cb('0x2a')](db[_0x91cb('0x2b')][_0x91cb('0x2c')],function(_0x5e6ed3){return{'name':_0x5e6ed3[_0x91cb('0x2d')],'type':_0x5e6ed3[_0x91cb('0x2e')][_0x91cb('0x2f')]};});_0x361e4c[_0x91cb('0x30')]=_[_0x91cb('0x2a')](_0x3dab18,'name');_0x361e4c[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x775c25[_0x91cb('0x31')]);_0x361e4c[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0x361e4c['model'],_0x361e4c[_0x91cb('0x31')]);_0x25bbf9['attributes']=_['intersection'](_0x361e4c['model'],qs[_0x91cb('0x35')](_0x775c25['query'][_0x91cb('0x35')]));_0x25bbf9['attributes']=_0x25bbf9['attributes'][_0x91cb('0x36')]?_0x25bbf9[_0x91cb('0x37')]:_0x361e4c[_0x91cb('0x30')];if(!_0x775c25[_0x91cb('0x31')][_0x91cb('0x38')]('nolimit')){_0x25bbf9[_0x91cb('0x1c')]=qs[_0x91cb('0x1c')](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1c')]);_0x25bbf9['offset']=qs['offset'](_0x775c25[_0x91cb('0x31')][_0x91cb('0x1b')]);}_0x25bbf9['order']=qs[_0x91cb('0x39')](_0x775c25[_0x91cb('0x31')]['sort']);_0x25bbf9[_0x91cb('0x3a')]=qs[_0x91cb('0x33')](_['pick'](_0x775c25[_0x91cb('0x31')],_0x361e4c['filters']),_0x3dab18);if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3b')]){_0x25bbf9[_0x91cb('0x3a')]=_[_0x91cb('0x3c')](_0x25bbf9[_0x91cb('0x3a')],{'$or':_[_0x91cb('0x2a')](_0x3dab18,function(_0x5d0e37){if(_0x5d0e37[_0x91cb('0x2e')]!==_0x91cb('0x3d')){var _0x4e5b4b={};_0x4e5b4b[_0x5d0e37[_0x91cb('0x28')]]={'$like':'%'+_0x775c25['query'][_0x91cb('0x3b')]+'%'};return _0x4e5b4b;}})});}_0x25bbf9=_[_0x91cb('0x3c')]({},_0x25bbf9,_0x775c25[_0x91cb('0x3e')]);var _0x174794={'where':_0x25bbf9['where']};return db[_0x91cb('0x2b')][_0x91cb('0x1e')](_0x174794)[_0x91cb('0x23')](function(_0x37e777){_0xf296bc[_0x91cb('0x1e')]=_0x37e777;if(_0x775c25[_0x91cb('0x31')][_0x91cb('0x3f')]){_0x25bbf9[_0x91cb('0x40')]=[{'all':!![]}];}return db[_0x91cb('0x2b')][_0x91cb('0x41')](_0x25bbf9);})['then'](function(_0x16993f){_0xf296bc['rows']=_0x16993f;return _0xf296bc;})[_0x91cb('0x23')](respondWithFilteredResult(_0x146e1f,_0x25bbf9))['catch'](handleError(_0x146e1f,null));};exports[_0x91cb('0x42')]=function(_0x52e82c,_0x138f48){var _0x477131={'raw':!![],'where':{'id':_0x52e82c[_0x91cb('0x43')]['id']}},_0xba99ce={};_0xba99ce['model']=_[_0x91cb('0x32')](db[_0x91cb('0x2b')]['rawAttributes']);_0xba99ce[_0x91cb('0x31')]=_[_0x91cb('0x32')](_0x52e82c[_0x91cb('0x31')]);_0xba99ce[_0x91cb('0x33')]=_[_0x91cb('0x34')](_0xba99ce[_0x91cb('0x30')],_0xba99ce[_0x91cb('0x31')]);_0x477131[_0x91cb('0x37')]=_[_0x91cb('0x34')](_0xba99ce['model'],qs[_0x91cb('0x35')](_0x52e82c[_0x91cb('0x31')][_0x91cb('0x35')]));_0x477131[_0x91cb('0x37')]=_0x477131[_0x91cb('0x37')][_0x91cb('0x36')]?_0x477131[_0x91cb('0x37')]:_0xba99ce[_0x91cb('0x30')];if(_0x52e82c['query'][_0x91cb('0x3f')]){_0x477131[_0x91cb('0x40')]=[{'all':!![]}];}_0x477131=_[_0x91cb('0x3c')]({},_0x477131,_0x52e82c[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x477131)[_0x91cb('0x23')](handleEntityNotFound(_0x138f48,null))['then'](respondWithResult(_0x138f48,null))[_0x91cb('0x45')](handleError(_0x138f48,null));};exports['create']=function(_0x2c419b,_0x4c0acd){return db['AnalyticDefaultReport']['create'](_0x2c419b[_0x91cb('0x46')],{})[_0x91cb('0x23')](function(_0x3d62c4){var _0x2f8384=_0x2c419b[_0x91cb('0x47')]['get']({'plain':!![]});if(!_0x2f8384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f8384[_0x91cb('0x48')]===_0x91cb('0x47')){var _0x140994=_0x3d62c4[_0x91cb('0x25')]({'plain':!![]});var _0x57adff='Reports';return db['UserProfileSection'][_0x91cb('0x44')]({'where':{'name':_0x57adff,'userProfileId':_0x2f8384['userProfileId']},'raw':!![]})[_0x91cb('0x23')](function(_0x4aa670){if(_0x4aa670&&_0x4aa670[_0x91cb('0x49')]===0x0){return db[_0x91cb('0x26')][_0x91cb('0x4a')]({'name':_0x140994[_0x91cb('0x28')],'resourceId':_0x140994['id'],'type':_0x91cb('0x4b'),'sectionId':_0x4aa670['id']},{})[_0x91cb('0x23')](function(){return _0x3d62c4;});}else{return _0x3d62c4;}})[_0x91cb('0x45')](function(_0x30fd4e){logger[_0x91cb('0x4c')](_0x91cb('0x4d'),_0x30fd4e);throw _0x30fd4e;});}return _0x3d62c4;})[_0x91cb('0x23')](respondWithResult(_0x4c0acd,0xc9))['catch'](handleError(_0x4c0acd,null));};exports[_0x91cb('0x4e')]=function(_0x1fa45a,_0x4d7a34){if(_0x1fa45a[_0x91cb('0x46')]['id']){delete _0x1fa45a[_0x91cb('0x46')]['id'];}return db['AnalyticDefaultReport'][_0x91cb('0x44')]({'where':{'id':_0x1fa45a[_0x91cb('0x43')]['id']}})[_0x91cb('0x23')](handleEntityNotFound(_0x4d7a34,null))[_0x91cb('0x23')](saveUpdates(_0x1fa45a[_0x91cb('0x46')],null))[_0x91cb('0x23')](respondWithResult(_0x4d7a34,null))[_0x91cb('0x45')](handleError(_0x4d7a34,null));};exports[_0x91cb('0x24')]=function(_0x3320bd,_0x93ef52){return db[_0x91cb('0x2b')]['find']({'where':{'id':_0x3320bd[_0x91cb('0x43')]['id']}})['then'](handleEntityNotFound(_0x93ef52,null))[_0x91cb('0x23')](removeEntity(_0x93ef52,null))['catch'](handleError(_0x93ef52,null));};exports[_0x91cb('0x4f')]=function(_0x1b2fec,_0x1986d7){var _0x47a6cd=0xa;var _0xe49d42=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),_0x91cb('0x52')];var _0x365afd={'SUM':_0x91cb('0x53'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x5c2c01={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x91cb('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':_0x91cb('0x5c')};var _0x5ae0d2=function(_0x4f19c8){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4f19c8);};var _0x551836=function(_0x22fea8){if(!_0x22fea8||!_0x22fea8['rules'][_0x91cb('0x36')]){return'';}for(var _0xe08233='(',_0xd7be15=0x0;_0xd7be15<_0x22fea8[_0x91cb('0x61')]['length'];_0xd7be15+=0x1){_0xd7be15>0x0&&(_0xe08233+='\x20'+_0x22fea8[_0x91cb('0x62')]+'\x20');_0xe08233+=_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]?_0x551836(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x63')]):_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x64')]+'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')]+(_0x5ae0d2(_0x22fea8[_0x91cb('0x61')][_0xd7be15][_0x91cb('0x65')])?'\x20'+_0x22fea8[_0x91cb('0x61')][_0xd7be15]['value']:'');}return _0xe08233+')';};var _0x2cf4d0={'where':{'id':_0x1b2fec[_0x91cb('0x43')]['id']}},_0x2e301a,_0x474682,_0x51ab8a,_0x21c890,_0xca33a2;_0x2cf4d0=_['merge']({},_0x2cf4d0,_0x1b2fec[_0x91cb('0x3e')]);return db['AnalyticDefaultReport'][_0x91cb('0x44')](_0x2cf4d0)[_0x91cb('0x23')](function(_0x80fcc6){if(_0x80fcc6){_0x2e301a=_0x80fcc6;return _0x80fcc6[_0x91cb('0x66')]();}return null;})['then'](function(_0x1c0b66){if(_0x1c0b66){if(!_0x1c0b66[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x474682=_0x1c0b66;return db[_0x91cb('0x6a')]['findAll']({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x28bfe5){if(_0x28bfe5){_0x51ab8a=_[_0x91cb('0x6b')](_0x28bfe5,'id');var _0x1f0ba2;var _0x891569=squel[_0x91cb('0x6c')]();_0x891569[_0x91cb('0x6d')](_0x2e301a[_0x91cb('0x6e')]);for(var _0x43629b=0x0;_0x43629b<_0x474682[_0x91cb('0x36')];_0x43629b+=0x1){_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x6f')]?_0x51ab8a[_0x474682[_0x43629b][_0x91cb('0x6f')]][_0x91cb('0x70')]:_0x474682[_0x43629b][_0x91cb('0x64')];_0x1f0ba2=_0x474682[_0x43629b][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x365afd[_0x474682[_0x43629b][_0x91cb('0x71')]],'%s',_0x1f0ba2):_0x1f0ba2;_0x1f0ba2=_0x474682[_0x43629b]['format']?_[_0x91cb('0x72')](_0x5c2c01[_0x474682[_0x43629b][_0x91cb('0x73')]],'%s',_0x1f0ba2):_0x1f0ba2;if(_0x474682[_0x43629b]['groupBy']){_0x891569[_0x91cb('0x63')](_0x1f0ba2);}_0x474682[_0x43629b][_0x91cb('0x74')]&&_0x891569[_0x91cb('0x75')](_0x1f0ba2,_0x474682[_0x43629b]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x891569[_0x91cb('0x64')](_0x1f0ba2,_0x474682[_0x43629b]['alias']||_0x1f0ba2);}if(_0x2e301a['joins']){_0x2e301a[_0x91cb('0x77')]=JSON['parse'](_0x2e301a[_0x91cb('0x77')]);for(var _0x376f56=0x0;_0x376f56<_0x2e301a['joins'][_0x91cb('0x36')];_0x376f56+=0x1){if(_0x2e301a['joins'][_0x376f56][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0xe49d42,_0x2e301a['joins'][_0x376f56]['type'])&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')]&&_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignTable']&&_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x79')]){_0x891569[_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x2e')]](_0x2e301a['joins'][_0x376f56][_0x91cb('0x7a')],null,util['format'](_0x91cb('0x7b'),_0x2e301a[_0x91cb('0x6e')],_0x2e301a[_0x91cb('0x77')][_0x376f56][_0x91cb('0x78')],_0x2e301a['joins'][_0x376f56]['foreignTable'],_0x2e301a[_0x91cb('0x77')][_0x376f56]['foreignKey']));}}}if(_0x2e301a[_0x91cb('0x7c')]){_0x2e301a[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2e301a[_0x91cb('0x7c')]);_0x891569[_0x91cb('0x3a')](_0x551836(_0x2e301a[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0xca33a2=_0x891569['clone']();_0x891569[_0x91cb('0x1c')](_0x47a6cd);_0x891569[_0x91cb('0x1b')](0x0);logger['debug'](_0x91cb('0x7e'),_0x891569['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x891569[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});}})[_0x91cb('0x23')](respondWithResult(_0x1986d7,null))[_0x91cb('0x45')](handleError(_0x1986d7,null));};function runReport(_0x23380a,_0x14cad8,_0x20a64f){var _0x11411d=_0x14cad8[_0x91cb('0x28')];var _0x14882d=0xa;var _0x22ba54=[_0x91cb('0x50'),'left_join',_0x91cb('0x51'),'cross_join'];var _0x1235c0={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':_0x91cb('0x84'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x91cb('0x59')};var _0xdee7f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x91cb('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x95f2de=function(_0x4d777a){return!_[_0x91cb('0x5d')](['IS\x20NULL',_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d777a);};var _0x443c01=function(_0x4e899c){if(!_0x4e899c||!_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x42d07b='(',_0x427afd=0x0;_0x427afd<_0x4e899c[_0x91cb('0x61')][_0x91cb('0x36')];_0x427afd+=0x1){_0x427afd>0x0&&(_0x42d07b+='\x20'+_0x4e899c[_0x91cb('0x62')]+'\x20');_0x42d07b+=_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]?_0x443c01(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x63')]):_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x64')]+'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')]+(_0x95f2de(_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x65')])?'\x20'+_0x4e899c[_0x91cb('0x61')][_0x427afd][_0x91cb('0x86')]:'');}return _0x42d07b+')';};var _0x39b5bd={'where':{'id':_0x23380a['id']}},_0x315518,_0x3d944d,_0x43b96c,_0xe4d946,_0x32d426;_0x39b5bd=_['merge']({},_0x39b5bd,_0x20a64f);return db[_0x91cb('0x2b')][_0x91cb('0x44')](_0x39b5bd)[_0x91cb('0x23')](function(_0x1a654b){if(_0x1a654b){_0x315518=_0x1a654b;return _0x1a654b[_0x91cb('0x66')]();}return null;})[_0x91cb('0x23')](function(_0x404457){if(_0x404457){if(!_0x404457[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))][(_0x91cb('0x68'))](_0x91cb('0x69'),0x193);}_0x3d944d=_0x404457;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})['then'](function(_0x5689ea){if(_0x5689ea){_0x43b96c=_[_0x91cb('0x6b')](_0x5689ea,'id');var _0x265ffb;var _0x4f66f=squel[_0x91cb('0x6c')]();_0x4f66f[_0x91cb('0x6d')](_0x315518[_0x91cb('0x6e')]);for(var _0x210b46=0x0;_0x210b46<_0x3d944d[_0x91cb('0x36')];_0x210b46+=0x1){_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x6f')]?_0x43b96c[_0x3d944d[_0x210b46][_0x91cb('0x6f')]]['metric']:_0x3d944d[_0x210b46][_0x91cb('0x64')];_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x71')]?_['replace'](_0x1235c0[_0x3d944d[_0x210b46][_0x91cb('0x71')]],'%s',_0x265ffb):_0x265ffb;_0x265ffb=_0x3d944d[_0x210b46][_0x91cb('0x73')]?_['replace'](_0xdee7f[_0x3d944d[_0x210b46][_0x91cb('0x73')]],'%s',_0x265ffb):_0x265ffb;if(_0x3d944d[_0x210b46][_0x91cb('0x87')]){_0x4f66f[_0x91cb('0x63')](_0x265ffb);}_0x3d944d[_0x210b46][_0x91cb('0x74')]&&_0x4f66f[_0x91cb('0x75')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x74')]===_0x91cb('0x76')?![]:!![]);_0x4f66f[_0x91cb('0x64')](_0x265ffb,_0x3d944d[_0x210b46][_0x91cb('0x88')]||_0x265ffb);}if(_0x315518[_0x91cb('0x77')]){_0x315518[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x315518['joins']);for(var _0x5c0725=0x0;_0x5c0725<_0x315518[_0x91cb('0x77')][_0x91cb('0x36')];_0x5c0725+=0x1){if(_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]&&_[_0x91cb('0x5d')](_0x22ba54,_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')])&&_0x315518['joins'][_0x5c0725][_0x91cb('0x78')]&&_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')]&&_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]){_0x4f66f[_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x2e')]](_0x315518['joins'][_0x5c0725][_0x91cb('0x7a')],null,util[_0x91cb('0x73')](_0x91cb('0x7b'),_0x315518[_0x91cb('0x6e')],_0x315518[_0x91cb('0x77')][_0x5c0725]['parentKey'],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x7a')],_0x315518[_0x91cb('0x77')][_0x5c0725][_0x91cb('0x79')]));}}}if(_0x315518['conditions']){_0x315518['conditions']=JSON['parse'](_0x315518[_0x91cb('0x7c')]);_0x4f66f[_0x91cb('0x3a')](_0x443c01(_0x315518[_0x91cb('0x7c')][_0x91cb('0x63')]));}_0x32d426=_0x4f66f['clone']();_0x4f66f[_0x91cb('0x1c')](_0x14882d);_0x4f66f[_0x91cb('0x1b')](0x0);return;}})[_0x91cb('0x23')](function(){if(_0x14cad8[_0x91cb('0x89')]==='web'){return null;}var _0x4bf7c7=_[_0x91cb('0x3c')](_0x14cad8,{'name':_0x14cad8[_0x91cb('0x8a')]||_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],'basename':_0x11411d,'savename':util[_0x91cb('0x73')](_0x91cb('0x8b'),_0x14cad8[_0x91cb('0x28')]||_0x315518[_0x91cb('0x28')],require(_0x91cb('0x8c'))[_0x91cb('0x8d')](0x4),_0x14cad8[_0x91cb('0x89')]||_0x91cb('0x8e')),'reportId':_0x315518['id'],'reportType':_0x91cb('0x8f')});return db['AnalyticExtractedReport']['create'](_0x4bf7c7,{'raw':!![]});})[_0x91cb('0x23')](function(_0x48a910){if(_0x315518[_0x91cb('0x6e')]===_0x91cb('0x90')){_0x32d426[_0x91cb('0x3a')](_0x315518[_0x91cb('0x6e')]+_0x91cb('0x91'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}else{_0x32d426[_0x91cb('0x3a')](_0x315518['table']+_0x91cb('0x94'),_0x14cad8[_0x91cb('0x92')],_0x14cad8[_0x91cb('0x93')]);}if(_0x48a910){logger[_0x91cb('0x95')](_0x91cb('0x96'),_0x32d426['toString']());require(_0x91cb('0x97'))[_0x91cb('0x98')](path[_0x91cb('0x50')](__dirname,_0x91cb('0x99'),_0x48a910[_0x91cb('0x89')]),[_0x48a910['id'],_0x32d426['toString'](),path[_0x91cb('0x50')](__dirname,_0x91cb('0x9a'),_0x48a910[_0x91cb('0x9b')]),_0x11411d]);return _0x48a910;}else{var _0x22b6d3=squel[_0x91cb('0x6c')]();_0x22b6d3[_0x91cb('0x6d')]('('+_0x32d426[_0x91cb('0x80')]()+')',_0x91cb('0x9c'));_0x22b6d3[_0x91cb('0x64')](_0x91cb('0x9d'),_0x91cb('0x1e'));_0x32d426[_0x91cb('0x1c')](_0x14cad8[_0x91cb('0x1c')]||_0x14882d);_0x32d426[_0x91cb('0x1b')](_0x14cad8[_0x91cb('0x1b')]||0x0);return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x22b6d3[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]})[_0x91cb('0x23')](function(_0x275c80){if(!_0x275c80[_0x91cb('0x36')]){_0xe4d946=0x0;}else{_0xe4d946=_0x275c80[0x0][_0x91cb('0x1e')]||0x0;}return dbH[_0x91cb('0x7f')]['query'](_0x32d426[_0x91cb('0x80')](),{'type':dbH[_0x91cb('0x7f')][_0x91cb('0x81')][_0x91cb('0x82')]});})[_0x91cb('0x23')](function(_0x5ca377){return{'rows':_0x5ca377||[],'count':_0xe4d946};});}});}exports['run']=function(_0x552490,_0x5174ac){return runReport(_0x552490['params'],_0x552490[_0x91cb('0x31')],_0x552490[_0x91cb('0x3e')])[_0x91cb('0x23')](respondWithResult(_0x5174ac,null))[_0x91cb('0x45')](handleError(_0x5174ac,null));};exports[_0x91cb('0x9e')]=runReport;exports[_0x91cb('0x31')]=function(_0x3462c5,_0x146346){var _0xe3d97f=0xa;var _0x3b93c3=['join',_0x91cb('0x9f'),_0x91cb('0x51'),'cross_join'];var _0x154e6a={'SUM':_0x91cb('0x53'),'COUNT':_0x91cb('0x83'),'COUNT DISTINCT':_0x91cb('0x54'),'MAX':_0x91cb('0x55'),'MIN':_0x91cb('0x56'),'AVG':_0x91cb('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x91cb('0x58'),'GROUP_CONCAT DESC':_0x91cb('0x59')};var _0x2a05af={'SEC_TO_TIME':_0x91cb('0xa0'),'DATE':_0x91cb('0x5a'),'HOUR':_0x91cb('0x85'),'ROUND':_0x91cb('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x34c1f2=function(_0x4d82b4){return!_[_0x91cb('0x5d')]([_0x91cb('0xa1'),_0x91cb('0x5e'),_0x91cb('0x5f'),_0x91cb('0x60')],_0x4d82b4);};var _0x432099=function(_0x344c95){if(!_0x344c95||!_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')]){return'';}for(var _0x570cf0='(',_0xb3a6c4=0x0;_0xb3a6c4<_0x344c95[_0x91cb('0x61')][_0x91cb('0x36')];_0xb3a6c4+=0x1){_0xb3a6c4>0x0&&(_0x570cf0+='\x20'+_0x344c95[_0x91cb('0x62')]+'\x20');_0x570cf0+=_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]?_0x432099(_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x63')]):_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x64')]+'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4][_0x91cb('0x65')]+(_0x34c1f2(_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['condition'])?'\x20'+_0x344c95[_0x91cb('0x61')][_0xb3a6c4]['value']:'');}return _0x570cf0+')';};var _0x39ba62={'where':{'id':_0x3462c5[_0x91cb('0x43')]['id']}},_0x2ab5a3,_0x10a9f6,_0x43ad75,_0x1382ba,_0x12da14;_0x39ba62=_[_0x91cb('0x3c')]({},_0x39ba62,_0x3462c5['options']);return db[_0x91cb('0x2b')]['find'](_0x39ba62)[_0x91cb('0x23')](function(_0x2f7387){if(_0x2f7387){_0x2ab5a3=_0x2f7387;return _0x2f7387[_0x91cb('0x66')]();}return null;})['then'](function(_0x1f2ef8){if(_0x1f2ef8){if(!_0x1f2ef8[_0x91cb('0x36')]){throw new db[(_0x91cb('0x67'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x10a9f6=_0x1f2ef8;return db['AnalyticMetric'][_0x91cb('0x41')]({'raw':!![]});}return null;})[_0x91cb('0x23')](function(_0x3ac830){if(_0x3ac830){_0x43ad75=_['keyBy'](_0x3ac830,'id');var _0x469e62;var _0x1e9441=squel[_0x91cb('0x6c')]();_0x1e9441[_0x91cb('0x6d')](_0x2ab5a3[_0x91cb('0x6e')]);for(var _0x416390=0x0;_0x416390<_0x10a9f6[_0x91cb('0x36')];_0x416390+=0x1){_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x6f')]?_0x43ad75[_0x10a9f6[_0x416390]['MetricId']][_0x91cb('0x70')]:_0x10a9f6[_0x416390][_0x91cb('0x64')];_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x71')]?_[_0x91cb('0x72')](_0x154e6a[_0x10a9f6[_0x416390]['function']],'%s',_0x469e62):_0x469e62;_0x469e62=_0x10a9f6[_0x416390][_0x91cb('0x73')]?_['replace'](_0x2a05af[_0x10a9f6[_0x416390][_0x91cb('0x73')]],'%s',_0x469e62):_0x469e62;if(_0x10a9f6[_0x416390][_0x91cb('0x87')]){_0x1e9441[_0x91cb('0x63')](_0x469e62);}_0x10a9f6[_0x416390][_0x91cb('0x74')]&&_0x1e9441[_0x91cb('0x75')](_0x469e62,_0x10a9f6[_0x416390]['orderBy']===_0x91cb('0x76')?![]:!![]);_0x1e9441['field'](_0x469e62,_0x10a9f6[_0x416390]['alias']||_0x469e62);}if(_0x2ab5a3[_0x91cb('0x77')]){_0x2ab5a3[_0x91cb('0x77')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x77')]);for(var _0x286ed7=0x0;_0x286ed7<_0x2ab5a3[_0x91cb('0x77')][_0x91cb('0x36')];_0x286ed7+=0x1){if(_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['type']&&_[_0x91cb('0x5d')](_0x3b93c3,_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x2e')])&&_0x2ab5a3['joins'][_0x286ed7]['parentKey']&&_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x7a')]&&_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x79')]){_0x1e9441[_0x2ab5a3['joins'][_0x286ed7][_0x91cb('0x2e')]](_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],null,util[_0x91cb('0x73')]('%s.%s\x20=\x20%s.%s',_0x2ab5a3[_0x91cb('0x6e')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x78')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7][_0x91cb('0x7a')],_0x2ab5a3[_0x91cb('0x77')][_0x286ed7]['foreignKey']));}}}if(_0x2ab5a3[_0x91cb('0x7c')]){_0x2ab5a3[_0x91cb('0x7c')]=JSON[_0x91cb('0x7d')](_0x2ab5a3[_0x91cb('0x7c')]);_0x1e9441[_0x91cb('0x3a')](_0x432099(_0x2ab5a3['conditions'][_0x91cb('0x63')]));}_0x12da14=_0x1e9441[_0x91cb('0xa2')]();_0x1e9441[_0x91cb('0x1c')](_0xe3d97f);_0x1e9441[_0x91cb('0x1b')](0x0);logger[_0x91cb('0xa3')](_0x91cb('0x7e'),_0x1e9441['toString']());return dbH[_0x91cb('0x7f')][_0x91cb('0x31')](_0x1e9441[_0x91cb('0x80')](),{'type':dbH['sequelize'][_0x91cb('0x81')]['SELECT']});}})[_0x91cb('0x23')](function(){return{'sql':_0x12da14[_0x91cb('0x80')]()};})[_0x91cb('0x23')](respondWithResult(_0x146346,null))[_0x91cb('0x45')](handleError(_0x146346,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 0345b11..96cddb8 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 _0x3533=['analytics_default_reports','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','AnalyticDefaultReport'];(function(_0x4b9aea,_0x85deeb){var _0x34fd47=function(_0x282b51){while(--_0x282b51){_0x4b9aea['push'](_0x4b9aea['shift']());}};_0x34fd47(++_0x85deeb);}(_0x3533,0xb5));var _0x3353=function(_0x82eef6,_0x52a17d){_0x82eef6=_0x82eef6-0x0;var _0x8809c3=_0x3533[_0x82eef6];return _0x8809c3;};'use strict';var _=require('lodash');var util=require(_0x3353('0x0'));var logger=require(_0x3353('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3353('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3353('0x3'));var rimraf=require(_0x3353('0x4'));var config=require(_0x3353('0x5'));var attributes=require(_0x3353('0x6'));module[_0x3353('0x7')]=function(_0x4f0988,_0xb85da7){return _0x4f0988['define'](_0x3353('0x8'),attributes,{'tableName':_0x3353('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb53f=['request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','api','moment','bluebird'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0xb53f,0x10c));var _0xfb53=function(_0x2af106,_0x5adc54){_0x2af106=_0x2af106-0x0;var _0x286124=_0xb53f[_0x2af106];return _0x286124;};'use strict';var _=require(_0xfb53('0x0'));var util=require(_0xfb53('0x1'));var logger=require('../../config/logger')(_0xfb53('0x2'));var moment=require(_0xfb53('0x3'));var BPromise=require(_0xfb53('0x4'));var rp=require(_0xfb53('0x5'));var fs=require('fs');var path=require(_0xfb53('0x6'));var rimraf=require(_0xfb53('0x7'));var config=require(_0xfb53('0x8'));var attributes=require(_0xfb53('0x9'));module['exports']=function(_0x342968,_0x17eb5b){return _0x342968[_0xfb53('0xa')](_0xfb53('0xb'),attributes,{'tableName':_0xfb53('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index ae86345..f428f64 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 _0x4f88=['../../config/environment','http','request','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x50f288,_0xfecd76){var _0x2a0755=function(_0x48f555){while(--_0x48f555){_0x50f288['push'](_0x50f288['shift']());}};_0x2a0755(++_0xfecd76);}(_0x4f88,0x1da));var _0x84f8=function(_0x467cb0,_0x303070){_0x467cb0=_0x467cb0-0x0;var _0x2153f7=_0x4f88[_0x467cb0];return _0x2153f7;};'use strict';var _=require(_0x84f8('0x0'));var util=require(_0x84f8('0x1'));var moment=require(_0x84f8('0x2'));var BPromise=require(_0x84f8('0x3'));var rs=require(_0x84f8('0x4'));var fs=require('fs');var Redis=require(_0x84f8('0x5'));var db=require(_0x84f8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x84f8('0x7'))(_0x84f8('0x8'));var config=require(_0x84f8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x84f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fea09,_0x54441e,_0x5e8807){return new BPromise(function(_0x5f2841,_0x4613c0){return client[_0x84f8('0xb')](_0x3fea09,_0x5e8807)['then'](function(_0x32fc2c){logger['info'](_0x84f8('0xc'),_0x54441e,_0x84f8('0xd'));logger[_0x84f8('0xe')](_0x84f8('0xf'),_0x54441e,_0x84f8('0xd'),JSON[_0x84f8('0x10')](_0x32fc2c));if(_0x32fc2c[_0x84f8('0x11')]){if(_0x32fc2c[_0x84f8('0x11')][_0x84f8('0x12')]===0x1f4){logger[_0x84f8('0x11')](_0x84f8('0xc'),_0x54441e,_0x32fc2c[_0x84f8('0x11')]['message']);return _0x4613c0(_0x32fc2c[_0x84f8('0x11')]['message']);}logger[_0x84f8('0x11')](_0x84f8('0xc'),_0x54441e,_0x32fc2c[_0x84f8('0x11')][_0x84f8('0x13')]);return _0x5f2841(_0x32fc2c['error'][_0x84f8('0x13')]);}else{logger[_0x84f8('0x14')](_0x84f8('0xc'),_0x54441e,_0x84f8('0xd'));_0x5f2841(_0x32fc2c[_0x84f8('0x15')]['message']);}})[_0x84f8('0x16')](function(_0x163332){logger['error'](_0x84f8('0xc'),_0x54441e,_0x163332);_0x4613c0(_0x163332);});});} \ No newline at end of file +var _0x9c21=['AnalyticDefaultReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x32abdd,_0xde81ef){var _0x1c9b16=function(_0x5a1632){while(--_0x5a1632){_0x32abdd['push'](_0x32abdd['shift']());}};_0x1c9b16(++_0xde81ef);}(_0x9c21,0x77));var _0x19c2=function(_0x8b1b15,_0x30a726){_0x8b1b15=_0x8b1b15-0x0;var _0x2448b3=_0x9c21[_0x8b1b15];return _0x2448b3;};'use strict';var _=require(_0x19c2('0x0'));var util=require(_0x19c2('0x1'));var moment=require(_0x19c2('0x2'));var BPromise=require(_0x19c2('0x3'));var rs=require(_0x19c2('0x4'));var fs=require('fs');var Redis=require(_0x19c2('0x5'));var db=require(_0x19c2('0x6'))['db'];var utils=require(_0x19c2('0x7'));var logger=require(_0x19c2('0x8'))(_0x19c2('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x19c2('0xa')][_0x19c2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5cf43a,_0x48ea5b,_0x81c062){return new BPromise(function(_0x33fcd9,_0x537c08){return client[_0x19c2('0xc')](_0x5cf43a,_0x81c062)[_0x19c2('0xd')](function(_0x642a16){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x48ea5b,'request\x20sent');logger[_0x19c2('0xe')](_0x19c2('0xf'),_0x48ea5b,'request\x20sent',JSON[_0x19c2('0x10')](_0x642a16));if(_0x642a16[_0x19c2('0x11')]){if(_0x642a16[_0x19c2('0x11')][_0x19c2('0x12')]===0x1f4){logger[_0x19c2('0x11')](_0x19c2('0x13'),_0x48ea5b,_0x642a16[_0x19c2('0x11')]['message']);return _0x537c08(_0x642a16[_0x19c2('0x11')]['message']);}logger[_0x19c2('0x11')](_0x19c2('0x13'),_0x48ea5b,_0x642a16['error'][_0x19c2('0x14')]);return _0x33fcd9(_0x642a16['error'][_0x19c2('0x14')]);}else{logger[_0x19c2('0x15')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x48ea5b,'request\x20sent');_0x33fcd9(_0x642a16[_0x19c2('0x16')][_0x19c2('0x14')]);}})['catch'](function(_0x10eb3a){logger['error'](_0x19c2('0x13'),_0x48ea5b,_0x10eb3a);_0x537c08(_0x10eb3a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 64b6e93..81eca3d 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 _0x74a7=['index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','delete','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated'];(function(_0x12e073,_0x2a6387){var _0x17e67b=function(_0x61b780){while(--_0x61b780){_0x12e073['push'](_0x12e073['shift']());}};_0x17e67b(++_0x2a6387);}(_0x74a7,0x91));var _0x774a=function(_0x3c8291,_0x104ac7){_0x3c8291=_0x3c8291-0x0;var _0x3eea23=_0x74a7[_0x3c8291];return _0x3eea23;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x774a('0x0'));var timeout=require(_0x774a('0x1'));var express=require('express');var router=express[_0x774a('0x2')]();var fs_extra=require(_0x774a('0x3'));var auth=require(_0x774a('0x4'));var interaction=require(_0x774a('0x5'));var config=require('../../config/environment');var controller=require(_0x774a('0x6'));router[_0x774a('0x7')]('/',auth[_0x774a('0x8')](),controller[_0x774a('0x9')]);router[_0x774a('0x7')](_0x774a('0xa'),auth['isAuthenticated'](),controller[_0x774a('0xb')]);router[_0x774a('0x7')](_0x774a('0xc'),auth[_0x774a('0x8')](),controller[_0x774a('0xd')]);router[_0x774a('0x7')](_0x774a('0xe'),auth[_0x774a('0x8')](),controller['run']);router[_0x774a('0x7')](_0x774a('0xf'),auth['isAuthenticated'](),controller[_0x774a('0x10')]);router[_0x774a('0x11')]('/',auth['isAuthenticated'](),controller[_0x774a('0x12')]);router[_0x774a('0x13')](_0x774a('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x774a('0x14')](_0x774a('0xa'),auth[_0x774a('0x8')](),controller['destroy']);module[_0x774a('0x15')]=router; \ No newline at end of file +var _0xd227=['/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','isAuthenticated','get','/:id/preview','preview','/:id/run','/:id/query','post','create'];(function(_0x46dce0,_0x2e12a8){var _0x254615=function(_0x172af0){while(--_0x172af0){_0x46dce0['push'](_0x46dce0['shift']());}};_0x254615(++_0x2e12a8);}(_0xd227,0xab));var _0x7d22=function(_0x22f75e,_0x4a9e06){_0x22f75e=_0x22f75e-0x0;var _0x1f6ab3=_0xd227[_0x22f75e];return _0x1f6ab3;};'use strict';var multer=require(_0x7d22('0x0'));var util=require(_0x7d22('0x1'));var path=require(_0x7d22('0x2'));var timeout=require(_0x7d22('0x3'));var express=require(_0x7d22('0x4'));var router=express[_0x7d22('0x5')]();var fs_extra=require(_0x7d22('0x6'));var auth=require(_0x7d22('0x7'));var interaction=require(_0x7d22('0x8'));var config=require('../../config/environment');var controller=require(_0x7d22('0x9'));router['get']('/',auth[_0x7d22('0xa')](),controller['index']);router[_0x7d22('0xb')]('/:id',auth[_0x7d22('0xa')](),controller['show']);router[_0x7d22('0xb')](_0x7d22('0xc'),auth['isAuthenticated'](),controller[_0x7d22('0xd')]);router[_0x7d22('0xb')](_0x7d22('0xe'),auth[_0x7d22('0xa')](),controller['run']);router['get'](_0x7d22('0xf'),auth[_0x7d22('0xa')](),controller['query']);router[_0x7d22('0x10')]('/',auth['isAuthenticated'](),controller[_0x7d22('0x11')]);router['put'](_0x7d22('0x12'),auth[_0x7d22('0xa')](),controller['update']);router[_0x7d22('0x13')]('/:id',auth[_0x7d22('0xa')](),controller[_0x7d22('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index f4f518e..833ad9c 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 _0x4401=['ENUM','csv','pdf','xlsx','DATE','Loading','scheduled','manual','INTEGER','sequelize','moment','exports','STRING'];(function(_0x4848cd,_0x3d9895){var _0x261a1d=function(_0xc825c0){while(--_0xc825c0){_0x4848cd['push'](_0x4848cd['shift']());}};_0x261a1d(++_0x3d9895);}(_0x4401,0xcc));var _0x1440=function(_0x29d1ac,_0x502f20){_0x29d1ac=_0x29d1ac-0x0;var _0x5db05c=_0x4401[_0x29d1ac];return _0x5db05c;};'use strict';var Sequelize=require(_0x1440('0x0'));var moment=require(_0x1440('0x1'));module[_0x1440('0x2')]={'name':{'type':Sequelize[_0x1440('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x1440('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x1440('0x4')](_0x1440('0x5'),_0x1440('0x6'),_0x1440('0x7')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x1440('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x1440('0x8')]},'endDate':{'type':Sequelize[_0x1440('0x8')]},'status':{'type':Sequelize[_0x1440('0x3')],'defaultValue':_0x1440('0x9')},'type':{'type':Sequelize[_0x1440('0x4')]('manual',_0x1440('0xa')),'allowNull':![],'defaultValue':_0x1440('0xb')},'reportId':{'type':Sequelize[_0x1440('0xc')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x1440('0x3')]}}; \ No newline at end of file +var _0xcd3c=['STRING','DATE','manual','INTEGER','sequelize','moment','exports','ENUM','csv','xlsx'];(function(_0x2d6c20,_0x4ce15c){var _0x2d18ef=function(_0x285aac){while(--_0x285aac){_0x2d6c20['push'](_0x2d6c20['shift']());}};_0x2d18ef(++_0x4ce15c);}(_0xcd3c,0x1a8));var _0xccd3=function(_0x49d08a,_0x53a512){_0x49d08a=_0x49d08a-0x0;var _0x19a236=_0xcd3c[_0x49d08a];return _0x19a236;};'use strict';var Sequelize=require(_0xccd3('0x0'));var moment=require(_0xccd3('0x1'));module[_0xccd3('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xccd3('0x3')](_0xccd3('0x4'),'pdf',_0xccd3('0x5')),'allowNull':![],'defaultValue':_0xccd3('0x4')},'savename':{'type':Sequelize[_0xccd3('0x6')],'allowNull':![]},'startDate':{'type':Sequelize[_0xccd3('0x7')]},'endDate':{'type':Sequelize[_0xccd3('0x7')]},'status':{'type':Sequelize[_0xccd3('0x6')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xccd3('0x3')]('manual','scheduled'),'allowNull':![],'defaultValue':_0xccd3('0x8')},'reportId':{'type':Sequelize[_0xccd3('0x9')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index f515c67..5bdbe8e 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 _0x9519=['pick','merge','options','findAll','rows','catch','show','params','keys','rawAttributes','length','includeAll','find','create','body','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','basename','savename','existsSync','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','server/files/reports','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','undefined','limit','count','offset','set','Content-Range','apply','reject','destroy','then','ExtractedReports','UserProfileResource','error','stack','name','status','send','index','map','AnalyticExtractedReport','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters'];(function(_0x5679ac,_0x413bd9){var _0xe5073b=function(_0x5b6903){while(--_0x5b6903){_0x5679ac['push'](_0x5679ac['shift']());}};_0xe5073b(++_0x413bd9);}(_0x9519,0x1a0));var _0x9951=function(_0x4452db,_0x4b907c){_0x4452db=_0x4452db-0x0;var _0x192d46=_0x9519[_0x4452db];return _0x192d46;};'use strict';var emlformat=require(_0x9951('0x0'));var rimraf=require(_0x9951('0x1'));var zipdir=require(_0x9951('0x2'));var jsonpatch=require(_0x9951('0x3'));var rp=require(_0x9951('0x4'));var moment=require(_0x9951('0x5'));var BPromise=require(_0x9951('0x6'));var Mustache=require(_0x9951('0x7'));var util=require(_0x9951('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(_0x9951('0x9'));var _=require(_0x9951('0xa'));var squel=require(_0x9951('0xb'));var crypto=require('crypto');var jsforce=require(_0x9951('0xc'));var deskjs=require(_0x9951('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9951('0xe'));var authService=require(_0x9951('0xf'));var qs=require(_0x9951('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9951('0x11'));var logger=require(_0x9951('0x12'))(_0x9951('0x13'));var utils=require(_0x9951('0x14'));var config=require(_0x9951('0x15'));var licenseUtil=require(_0x9951('0x16'));var db=require(_0x9951('0x17'))['db'];function respondWithStatusCode(_0x3b70e8,_0x56cca0){_0x56cca0=_0x56cca0||0xcc;return function(_0x518020){if(_0x518020){return _0x3b70e8[_0x9951('0x18')](_0x56cca0);}return _0x3b70e8['status'](_0x56cca0)[_0x9951('0x19')]();};}function respondWithResult(_0x2fd6e7,_0x45dbcc){_0x45dbcc=_0x45dbcc||0xc8;return function(_0x45f874){if(_0x45f874){return _0x2fd6e7['status'](_0x45dbcc)['json'](_0x45f874);}};}function respondWithFilteredResult(_0x266983,_0xcdfa8e){return function(_0x3cb7f4){if(_0x3cb7f4){var _0x5231fa=typeof _0xcdfa8e['offset']===_0x9951('0x1a')&&typeof _0xcdfa8e[_0x9951('0x1b')]==='undefined';var _0x230130=_0x3cb7f4[_0x9951('0x1c')];var _0x32c4df=_0x5231fa?0x0:_0xcdfa8e[_0x9951('0x1d')];var _0x517a25=_0x5231fa?_0x3cb7f4[_0x9951('0x1c')]:_0xcdfa8e[_0x9951('0x1d')]+_0xcdfa8e[_0x9951('0x1b')];var _0x5ecb52;if(_0x517a25>=_0x230130){_0x517a25=_0x230130;_0x5ecb52=0xc8;}else{_0x5ecb52=0xce;}_0x266983['status'](_0x5ecb52);return _0x266983[_0x9951('0x1e')](_0x9951('0x1f'),_0x32c4df+'-'+_0x517a25+'/'+_0x230130)['json'](_0x3cb7f4);}return null;};}function patchUpdates(_0x5dfb47){return function(_0x7b60de){try{jsonpatch[_0x9951('0x20')](_0x7b60de,_0x5dfb47,!![]);}catch(_0x2180e3){return BPromise[_0x9951('0x21')](_0x2180e3);}return _0x7b60de['save']();};}function saveUpdates(_0x4d32b0,_0x4003e5){return function(_0x4fabcd){if(_0x4fabcd){return _0x4fabcd['update'](_0x4d32b0)['then'](function(_0x1f44ae){return _0x1f44ae;});}return null;};}function removeEntity(_0x3bdd95,_0xc4392a){return function(_0x462788){if(_0x462788){return _0x462788[_0x9951('0x22')]()[_0x9951('0x23')](function(){var _0x53289b=_0x462788['get']({'plain':!![]});var _0x18ab60=_0x9951('0x24');return db[_0x9951('0x25')][_0x9951('0x22')]({'where':{'type':_0x18ab60,'resourceId':_0x53289b['id']}})[_0x9951('0x23')](function(){return _0x462788;});})[_0x9951('0x23')](function(){_0x3bdd95['status'](0xcc)[_0x9951('0x19')]();});}};}function handleEntityNotFound(_0x2243a3,_0x400377){return function(_0x30755b){if(!_0x30755b){_0x2243a3[_0x9951('0x18')](0x194);}return _0x30755b;};}function handleError(_0x1c88bd,_0x433f59){_0x433f59=_0x433f59||0x1f4;return function(_0x5b2aff){logger[_0x9951('0x26')](_0x5b2aff[_0x9951('0x27')]);if(_0x5b2aff[_0x9951('0x28')]){delete _0x5b2aff['name'];}_0x1c88bd[_0x9951('0x29')](_0x433f59)[_0x9951('0x2a')](_0x5b2aff);};}exports[_0x9951('0x2b')]=function(_0x5054ac,_0x102e89){var _0x4c5a39={},_0x335d4a={},_0x3a6f14={'count':0x0,'rows':[]};var _0x5d9b77=_[_0x9951('0x2c')](db[_0x9951('0x2d')]['rawAttributes'],function(_0x13fee1){return{'name':_0x13fee1[_0x9951('0x2e')],'type':_0x13fee1[_0x9951('0x2f')][_0x9951('0x30')]};});_0x335d4a[_0x9951('0x31')]=_['map'](_0x5d9b77,_0x9951('0x28'));_0x335d4a['query']=_['keys'](_0x5054ac[_0x9951('0x32')]);_0x335d4a['filters']=_[_0x9951('0x33')](_0x335d4a[_0x9951('0x31')],_0x335d4a['query']);_0x4c5a39[_0x9951('0x34')]=_[_0x9951('0x33')](_0x335d4a['model'],qs[_0x9951('0x35')](_0x5054ac[_0x9951('0x32')][_0x9951('0x35')]));_0x4c5a39['attributes']=_0x4c5a39[_0x9951('0x34')]['length']?_0x4c5a39[_0x9951('0x34')]:_0x335d4a[_0x9951('0x31')];if(!_0x5054ac[_0x9951('0x32')][_0x9951('0x36')](_0x9951('0x37'))){_0x4c5a39[_0x9951('0x1b')]=qs['limit'](_0x5054ac[_0x9951('0x32')]['limit']);_0x4c5a39[_0x9951('0x1d')]=qs[_0x9951('0x1d')](_0x5054ac[_0x9951('0x32')][_0x9951('0x1d')]);}_0x4c5a39['order']=qs['sort'](_0x5054ac['query'][_0x9951('0x38')]);_0x4c5a39[_0x9951('0x39')]=qs[_0x9951('0x3a')](_[_0x9951('0x3b')](_0x5054ac[_0x9951('0x32')],_0x335d4a[_0x9951('0x3a')]),_0x5d9b77);if(_0x5054ac[_0x9951('0x32')]['filter']){_0x4c5a39[_0x9951('0x39')]=_[_0x9951('0x3c')](_0x4c5a39[_0x9951('0x39')],{'$or':_[_0x9951('0x2c')](_0x5d9b77,function(_0x456727){if(_0x456727['type']!=='VIRTUAL'){var _0x424caa={};_0x424caa[_0x456727[_0x9951('0x28')]]={'$like':'%'+_0x5054ac['query']['filter']+'%'};return _0x424caa;}})});}_0x4c5a39=_[_0x9951('0x3c')]({},_0x4c5a39,_0x5054ac[_0x9951('0x3d')]);var _0xd48001={'where':_0x4c5a39[_0x9951('0x39')]};return db[_0x9951('0x2d')]['count'](_0xd48001)[_0x9951('0x23')](function(_0x235642){_0x3a6f14['count']=_0x235642;if(_0x5054ac[_0x9951('0x32')]['includeAll']){_0x4c5a39['include']=[{'all':!![]}];}return db[_0x9951('0x2d')][_0x9951('0x3e')](_0x4c5a39);})[_0x9951('0x23')](function(_0x51e2fa){_0x3a6f14[_0x9951('0x3f')]=_0x51e2fa;return _0x3a6f14;})['then'](respondWithFilteredResult(_0x102e89,_0x4c5a39))[_0x9951('0x40')](handleError(_0x102e89,null));};exports[_0x9951('0x41')]=function(_0x18b661,_0x3527c0){var _0x4b780e={'raw':!![],'where':{'id':_0x18b661[_0x9951('0x42')]['id']}},_0x4c1a84={};_0x4c1a84[_0x9951('0x31')]=_[_0x9951('0x43')](db[_0x9951('0x2d')][_0x9951('0x44')]);_0x4c1a84['query']=_[_0x9951('0x43')](_0x18b661[_0x9951('0x32')]);_0x4c1a84['filters']=_[_0x9951('0x33')](_0x4c1a84[_0x9951('0x31')],_0x4c1a84[_0x9951('0x32')]);_0x4b780e['attributes']=_['intersection'](_0x4c1a84[_0x9951('0x31')],qs[_0x9951('0x35')](_0x18b661['query']['fields']));_0x4b780e['attributes']=_0x4b780e[_0x9951('0x34')][_0x9951('0x45')]?_0x4b780e[_0x9951('0x34')]:_0x4c1a84[_0x9951('0x31')];if(_0x18b661[_0x9951('0x32')][_0x9951('0x46')]){_0x4b780e['include']=[{'all':!![]}];}_0x4b780e=_['merge']({},_0x4b780e,_0x18b661[_0x9951('0x3d')]);return db[_0x9951('0x2d')][_0x9951('0x47')](_0x4b780e)['then'](handleEntityNotFound(_0x3527c0,null))[_0x9951('0x23')](respondWithResult(_0x3527c0,null))['catch'](handleError(_0x3527c0,null));};exports['create']=function(_0x1eb99b,_0x138d98){return db[_0x9951('0x2d')][_0x9951('0x48')](_0x1eb99b[_0x9951('0x49')],{})[_0x9951('0x23')](function(_0x3e57a9){var _0x473bc5=_0x1eb99b['user'][_0x9951('0x4a')]({'plain':!![]});if(!_0x473bc5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x473bc5[_0x9951('0x4b')]==='user'){var _0x35f856=_0x3e57a9['get']({'plain':!![]});var _0x413042=_0x9951('0x24');return db[_0x9951('0x4c')][_0x9951('0x47')]({'where':{'name':_0x413042,'userProfileId':_0x473bc5[_0x9951('0x4d')]},'raw':!![]})[_0x9951('0x23')](function(_0x2e8d20){if(_0x2e8d20&&_0x2e8d20[_0x9951('0x4e')]===0x0){return db['UserProfileResource'][_0x9951('0x48')]({'name':_0x35f856['name'],'resourceId':_0x35f856['id'],'type':_0x2e8d20[_0x9951('0x28')],'sectionId':_0x2e8d20['id']},{})[_0x9951('0x23')](function(){return _0x3e57a9;});}else{return _0x3e57a9;}})[_0x9951('0x40')](function(_0x29ed5d){logger['error'](_0x9951('0x4f'),_0x29ed5d);throw _0x29ed5d;});}return _0x3e57a9;})[_0x9951('0x23')](respondWithResult(_0x138d98,0xc9))[_0x9951('0x40')](handleError(_0x138d98,null));};exports[_0x9951('0x50')]=function(_0xf9c26d,_0x471d7d){if(_0xf9c26d[_0x9951('0x49')]['id']){delete _0xf9c26d[_0x9951('0x49')]['id'];}return db[_0x9951('0x2d')][_0x9951('0x47')]({'where':{'id':_0xf9c26d[_0x9951('0x42')]['id']}})[_0x9951('0x23')](handleEntityNotFound(_0x471d7d,null))[_0x9951('0x23')](saveUpdates(_0xf9c26d['body'],null))[_0x9951('0x23')](respondWithResult(_0x471d7d,null))[_0x9951('0x40')](handleError(_0x471d7d,null));};exports[_0x9951('0x22')]=function(_0x205de1,_0x2a00d6){return db[_0x9951('0x2d')][_0x9951('0x47')]({'where':{'id':_0x205de1[_0x9951('0x42')]['id']}})[_0x9951('0x23')](handleEntityNotFound(_0x2a00d6,null))[_0x9951('0x23')](removeEntity(_0x2a00d6,null))['catch'](handleError(_0x2a00d6,null));};exports[_0x9951('0x51')]=function(_0x3556ab,_0x26c7af,_0x418a7e){return db[_0x9951('0x2d')]['find']({'where':{'id':_0x3556ab[_0x9951('0x42')]['id']},'attributes':[_0x9951('0x28'),_0x9951('0x52'),_0x9951('0x53'),'output'],'raw':!![]})[_0x9951('0x23')](handleEntityNotFound(_0x26c7af,null))[_0x9951('0x23')](function(_0x5877af){if(_0x5877af){if(!fs[_0x9951('0x54')](path[_0x9951('0x55')](config[_0x9951('0x56')],'server/files/reports',_0x5877af['savename']))){throw new db[(_0x9951('0x57'))][(_0x9951('0x58'))](_0x9951('0x59'));}if(_0x3556ab[_0x9951('0x32')][_0x9951('0x5a')]){return _0x26c7af[_0x9951('0x18')](0xc8);}return _0x26c7af['download'](path['join'](config[_0x9951('0x56')],_0x9951('0x5b'),_0x5877af[_0x9951('0x53')]),util[_0x9951('0x5c')](_0x9951('0x5d'),_0x5877af[_0x9951('0x52')]||_0x5877af[_0x9951('0x28')],_0x5877af['output'][_0x9951('0x5e')]()));}})[_0x9951('0x40')](handleError(_0x26c7af,null));}; \ No newline at end of file +var _0x1e2d=['limit','count','status','set','Content-Range','save','update','destroy','then','get','ExtractedReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','show','params','keys','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','Report\x20not\x20found\x20or\x20empty','%s.%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined'];(function(_0x43cce0,_0x5b432b){var _0x663f7e=function(_0x59c38c){while(--_0x59c38c){_0x43cce0['push'](_0x43cce0['shift']());}};_0x663f7e(++_0x5b432b);}(_0x1e2d,0xa5));var _0xd1e2=function(_0x4e5117,_0x1c90cd){_0x4e5117=_0x4e5117-0x0;var _0x1b0eea=_0x1e2d[_0x4e5117];return _0x1b0eea;};'use strict';var emlformat=require(_0xd1e2('0x0'));var rimraf=require(_0xd1e2('0x1'));var zipdir=require(_0xd1e2('0x2'));var jsonpatch=require(_0xd1e2('0x3'));var rp=require(_0xd1e2('0x4'));var moment=require('moment');var BPromise=require(_0xd1e2('0x5'));var Mustache=require(_0xd1e2('0x6'));var util=require(_0xd1e2('0x7'));var path=require(_0xd1e2('0x8'));var sox=require(_0xd1e2('0x9'));var csv=require(_0xd1e2('0xa'));var ejs=require(_0xd1e2('0xb'));var fs=require('fs');var fs_extra=require(_0xd1e2('0xc'));var _=require('lodash');var squel=require(_0xd1e2('0xd'));var crypto=require(_0xd1e2('0xe'));var jsforce=require(_0xd1e2('0xf'));var deskjs=require(_0xd1e2('0x10'));var toCsv=require(_0xd1e2('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd1e2('0x11'));var authService=require(_0xd1e2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd1e2('0x13'));var hardwareService=require(_0xd1e2('0x14'));var logger=require(_0xd1e2('0x15'))(_0xd1e2('0x16'));var utils=require(_0xd1e2('0x17'));var config=require(_0xd1e2('0x18'));var licenseUtil=require(_0xd1e2('0x19'));var db=require(_0xd1e2('0x1a'))['db'];function respondWithStatusCode(_0x358b55,_0x48e4fa){_0x48e4fa=_0x48e4fa||0xcc;return function(_0x27fa4a){if(_0x27fa4a){return _0x358b55['sendStatus'](_0x48e4fa);}return _0x358b55['status'](_0x48e4fa)[_0xd1e2('0x1b')]();};}function respondWithResult(_0x4678c6,_0x1aa58b){_0x1aa58b=_0x1aa58b||0xc8;return function(_0x1bcf1f){if(_0x1bcf1f){return _0x4678c6['status'](_0x1aa58b)[_0xd1e2('0x1c')](_0x1bcf1f);}};}function respondWithFilteredResult(_0x5499f0,_0x24098e){return function(_0x465783){if(_0x465783){var _0x185b0d=typeof _0x24098e[_0xd1e2('0x1d')]===_0xd1e2('0x1e')&&typeof _0x24098e[_0xd1e2('0x1f')]==='undefined';var _0x5beaf4=_0x465783[_0xd1e2('0x20')];var _0x3b12f2=_0x185b0d?0x0:_0x24098e[_0xd1e2('0x1d')];var _0x4ae0d2=_0x185b0d?_0x465783[_0xd1e2('0x20')]:_0x24098e[_0xd1e2('0x1d')]+_0x24098e[_0xd1e2('0x1f')];var _0xfb3b0c;if(_0x4ae0d2>=_0x5beaf4){_0x4ae0d2=_0x5beaf4;_0xfb3b0c=0xc8;}else{_0xfb3b0c=0xce;}_0x5499f0[_0xd1e2('0x21')](_0xfb3b0c);return _0x5499f0[_0xd1e2('0x22')](_0xd1e2('0x23'),_0x3b12f2+'-'+_0x4ae0d2+'/'+_0x5beaf4)['json'](_0x465783);}return null;};}function patchUpdates(_0x4d58ea){return function(_0x169d92){try{jsonpatch['apply'](_0x169d92,_0x4d58ea,!![]);}catch(_0x1b1ee0){return BPromise['reject'](_0x1b1ee0);}return _0x169d92[_0xd1e2('0x24')]();};}function saveUpdates(_0x5c74bf,_0x5a114a){return function(_0xdc067e){if(_0xdc067e){return _0xdc067e[_0xd1e2('0x25')](_0x5c74bf)['then'](function(_0x1ba2bb){return _0x1ba2bb;});}return null;};}function removeEntity(_0x42d115,_0x39cc28){return function(_0x1da081){if(_0x1da081){return _0x1da081[_0xd1e2('0x26')]()[_0xd1e2('0x27')](function(){var _0x17d0a8=_0x1da081[_0xd1e2('0x28')]({'plain':!![]});var _0x5b964d=_0xd1e2('0x29');return db[_0xd1e2('0x2a')]['destroy']({'where':{'type':_0x5b964d,'resourceId':_0x17d0a8['id']}})[_0xd1e2('0x27')](function(){return _0x1da081;});})['then'](function(){_0x42d115[_0xd1e2('0x21')](0xcc)[_0xd1e2('0x1b')]();});}};}function handleEntityNotFound(_0x16f825,_0x5a91da){return function(_0x45efbd){if(!_0x45efbd){_0x16f825[_0xd1e2('0x2b')](0x194);}return _0x45efbd;};}function handleError(_0x416c56,_0xba1c3c){_0xba1c3c=_0xba1c3c||0x1f4;return function(_0x41a369){logger[_0xd1e2('0x2c')](_0x41a369[_0xd1e2('0x2d')]);if(_0x41a369[_0xd1e2('0x2e')]){delete _0x41a369[_0xd1e2('0x2e')];}_0x416c56[_0xd1e2('0x21')](_0xba1c3c)[_0xd1e2('0x2f')](_0x41a369);};}exports[_0xd1e2('0x30')]=function(_0x366180,_0x419053){var _0x592695={},_0x5d4742={},_0x46cadd={'count':0x0,'rows':[]};var _0x3c679c=_[_0xd1e2('0x31')](db[_0xd1e2('0x32')][_0xd1e2('0x33')],function(_0x22bd6b){return{'name':_0x22bd6b['fieldName'],'type':_0x22bd6b[_0xd1e2('0x34')][_0xd1e2('0x35')]};});_0x5d4742[_0xd1e2('0x36')]=_[_0xd1e2('0x31')](_0x3c679c,_0xd1e2('0x2e'));_0x5d4742[_0xd1e2('0x37')]=_['keys'](_0x366180[_0xd1e2('0x37')]);_0x5d4742['filters']=_[_0xd1e2('0x38')](_0x5d4742[_0xd1e2('0x36')],_0x5d4742[_0xd1e2('0x37')]);_0x592695[_0xd1e2('0x39')]=_[_0xd1e2('0x38')](_0x5d4742['model'],qs[_0xd1e2('0x3a')](_0x366180['query'][_0xd1e2('0x3a')]));_0x592695[_0xd1e2('0x39')]=_0x592695[_0xd1e2('0x39')][_0xd1e2('0x3b')]?_0x592695[_0xd1e2('0x39')]:_0x5d4742[_0xd1e2('0x36')];if(!_0x366180['query'][_0xd1e2('0x3c')](_0xd1e2('0x3d'))){_0x592695[_0xd1e2('0x1f')]=qs['limit'](_0x366180[_0xd1e2('0x37')][_0xd1e2('0x1f')]);_0x592695[_0xd1e2('0x1d')]=qs[_0xd1e2('0x1d')](_0x366180[_0xd1e2('0x37')][_0xd1e2('0x1d')]);}_0x592695['order']=qs['sort'](_0x366180[_0xd1e2('0x37')][_0xd1e2('0x3e')]);_0x592695['where']=qs[_0xd1e2('0x3f')](_[_0xd1e2('0x40')](_0x366180[_0xd1e2('0x37')],_0x5d4742[_0xd1e2('0x3f')]),_0x3c679c);if(_0x366180[_0xd1e2('0x37')][_0xd1e2('0x41')]){_0x592695[_0xd1e2('0x42')]=_[_0xd1e2('0x43')](_0x592695['where'],{'$or':_[_0xd1e2('0x31')](_0x3c679c,function(_0xbfd28f){if(_0xbfd28f[_0xd1e2('0x34')]!==_0xd1e2('0x44')){var _0x576a34={};_0x576a34[_0xbfd28f[_0xd1e2('0x2e')]]={'$like':'%'+_0x366180['query'][_0xd1e2('0x41')]+'%'};return _0x576a34;}})});}_0x592695=_[_0xd1e2('0x43')]({},_0x592695,_0x366180['options']);var _0x5d6a8e={'where':_0x592695[_0xd1e2('0x42')]};return db[_0xd1e2('0x32')][_0xd1e2('0x20')](_0x5d6a8e)[_0xd1e2('0x27')](function(_0x1e9988){_0x46cadd[_0xd1e2('0x20')]=_0x1e9988;if(_0x366180[_0xd1e2('0x37')][_0xd1e2('0x45')]){_0x592695[_0xd1e2('0x46')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x592695);})[_0xd1e2('0x27')](function(_0xb18bd3){_0x46cadd[_0xd1e2('0x47')]=_0xb18bd3;return _0x46cadd;})[_0xd1e2('0x27')](respondWithFilteredResult(_0x419053,_0x592695))['catch'](handleError(_0x419053,null));};exports[_0xd1e2('0x48')]=function(_0x19e67a,_0x38e22d){var _0x4641b8={'raw':!![],'where':{'id':_0x19e67a[_0xd1e2('0x49')]['id']}},_0x5331de={};_0x5331de[_0xd1e2('0x36')]=_['keys'](db['AnalyticExtractedReport'][_0xd1e2('0x33')]);_0x5331de[_0xd1e2('0x37')]=_[_0xd1e2('0x4a')](_0x19e67a['query']);_0x5331de[_0xd1e2('0x3f')]=_[_0xd1e2('0x38')](_0x5331de[_0xd1e2('0x36')],_0x5331de[_0xd1e2('0x37')]);_0x4641b8[_0xd1e2('0x39')]=_[_0xd1e2('0x38')](_0x5331de[_0xd1e2('0x36')],qs[_0xd1e2('0x3a')](_0x19e67a[_0xd1e2('0x37')]['fields']));_0x4641b8[_0xd1e2('0x39')]=_0x4641b8[_0xd1e2('0x39')][_0xd1e2('0x3b')]?_0x4641b8['attributes']:_0x5331de[_0xd1e2('0x36')];if(_0x19e67a[_0xd1e2('0x37')][_0xd1e2('0x45')]){_0x4641b8[_0xd1e2('0x46')]=[{'all':!![]}];}_0x4641b8=_['merge']({},_0x4641b8,_0x19e67a[_0xd1e2('0x4b')]);return db[_0xd1e2('0x32')][_0xd1e2('0x4c')](_0x4641b8)[_0xd1e2('0x27')](handleEntityNotFound(_0x38e22d,null))['then'](respondWithResult(_0x38e22d,null))[_0xd1e2('0x4d')](handleError(_0x38e22d,null));};exports[_0xd1e2('0x4e')]=function(_0x4b7e3f,_0x1156b4){return db[_0xd1e2('0x32')][_0xd1e2('0x4e')](_0x4b7e3f['body'],{})[_0xd1e2('0x27')](function(_0x4f20b9){var _0x457ad0=_0x4b7e3f[_0xd1e2('0x4f')][_0xd1e2('0x28')]({'plain':!![]});if(!_0x457ad0)throw new Error(_0xd1e2('0x50'));if(_0x457ad0[_0xd1e2('0x51')]==='user'){var _0x5caf17=_0x4f20b9['get']({'plain':!![]});var _0x592e7e=_0xd1e2('0x29');return db[_0xd1e2('0x52')][_0xd1e2('0x4c')]({'where':{'name':_0x592e7e,'userProfileId':_0x457ad0[_0xd1e2('0x53')]},'raw':!![]})[_0xd1e2('0x27')](function(_0x39484a){if(_0x39484a&&_0x39484a[_0xd1e2('0x54')]===0x0){return db[_0xd1e2('0x2a')][_0xd1e2('0x4e')]({'name':_0x5caf17[_0xd1e2('0x2e')],'resourceId':_0x5caf17['id'],'type':_0x39484a[_0xd1e2('0x2e')],'sectionId':_0x39484a['id']},{})[_0xd1e2('0x27')](function(){return _0x4f20b9;});}else{return _0x4f20b9;}})[_0xd1e2('0x4d')](function(_0x398b5b){logger['error'](_0xd1e2('0x55'),_0x398b5b);throw _0x398b5b;});}return _0x4f20b9;})['then'](respondWithResult(_0x1156b4,0xc9))[_0xd1e2('0x4d')](handleError(_0x1156b4,null));};exports['update']=function(_0x5d9a4b,_0x1b886d){if(_0x5d9a4b['body']['id']){delete _0x5d9a4b[_0xd1e2('0x56')]['id'];}return db[_0xd1e2('0x32')][_0xd1e2('0x4c')]({'where':{'id':_0x5d9a4b['params']['id']}})['then'](handleEntityNotFound(_0x1b886d,null))[_0xd1e2('0x27')](saveUpdates(_0x5d9a4b['body'],null))[_0xd1e2('0x27')](respondWithResult(_0x1b886d,null))[_0xd1e2('0x4d')](handleError(_0x1b886d,null));};exports[_0xd1e2('0x26')]=function(_0x5cdaf5,_0x5687d9){return db[_0xd1e2('0x32')][_0xd1e2('0x4c')]({'where':{'id':_0x5cdaf5[_0xd1e2('0x49')]['id']}})[_0xd1e2('0x27')](handleEntityNotFound(_0x5687d9,null))['then'](removeEntity(_0x5687d9,null))[_0xd1e2('0x4d')](handleError(_0x5687d9,null));};exports[_0xd1e2('0x57')]=function(_0x1488a3,_0x66b9b2,_0x2b334e){return db[_0xd1e2('0x32')][_0xd1e2('0x4c')]({'where':{'id':_0x1488a3['params']['id']},'attributes':['name',_0xd1e2('0x58'),_0xd1e2('0x59'),_0xd1e2('0x5a')],'raw':!![]})['then'](handleEntityNotFound(_0x66b9b2,null))[_0xd1e2('0x27')](function(_0x5f594b){if(_0x5f594b){if(!fs[_0xd1e2('0x5b')](path[_0xd1e2('0x5c')](config[_0xd1e2('0x5d')],_0xd1e2('0x5e'),_0x5f594b['savename']))){throw new db[(_0xd1e2('0x5f'))]['ValidationError'](_0xd1e2('0x60'));}if(_0x1488a3['query']['exists']){return _0x66b9b2[_0xd1e2('0x2b')](0xc8);}return _0x66b9b2[_0xd1e2('0x57')](path[_0xd1e2('0x5c')](config[_0xd1e2('0x5d')],_0xd1e2('0x5e'),_0x5f594b[_0xd1e2('0x59')]),util['format'](_0xd1e2('0x61'),_0x5f594b[_0xd1e2('0x58')]||_0x5f594b[_0xd1e2('0x2e')],_0x5f594b['output']['toLowerCase']()));}})['catch'](handleError(_0x66b9b2,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index d81ed2c..6b234c9 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 _0xdb2f=['./analyticExtractedReport.attributes','define','analytics_extracted_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x51d6e4,_0x5b48ff){var _0xb104f1=function(_0x4d1bc3){while(--_0x4d1bc3){_0x51d6e4['push'](_0x51d6e4['shift']());}};_0xb104f1(++_0x5b48ff);}(_0xdb2f,0x12f));var _0xfdb2=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xdb2f[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xfdb2('0x0'));var util=require(_0xfdb2('0x1'));var logger=require(_0xfdb2('0x2'))(_0xfdb2('0x3'));var moment=require(_0xfdb2('0x4'));var BPromise=require(_0xfdb2('0x5'));var rp=require(_0xfdb2('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfdb2('0x7'));var config=require(_0xfdb2('0x8'));var attributes=require(_0xfdb2('0x9'));module['exports']=function(_0x351713,_0x590a39){return _0x351713[_0xfdb2('0xa')]('AnalyticExtractedReport',attributes,{'tableName':_0xfdb2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2ec=['analytics_extracted_reports','lodash','util','../../config/logger','moment','request-promise','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport'];(function(_0x493983,_0x45ea0e){var _0x52031b=function(_0xe84b82){while(--_0xe84b82){_0x493983['push'](_0x493983['shift']());}};_0x52031b(++_0x45ea0e);}(_0xe2ec,0x173));var _0xce2e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xe2ec[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xce2e('0x0'));var util=require(_0xce2e('0x1'));var logger=require(_0xce2e('0x2'))('api');var moment=require(_0xce2e('0x3'));var BPromise=require('bluebird');var rp=require(_0xce2e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xce2e('0x5'));module[_0xce2e('0x6')]=function(_0x3be0c4,_0x5142fe){return _0x3be0c4[_0xce2e('0x7')](_0xce2e('0x8'),attributes,{'tableName':_0xce2e('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 f04976f..e28afee 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 _0x96bb=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis'];(function(_0x58b6e9,_0x2857c0){var _0x261a4c=function(_0x1ac398){while(--_0x1ac398){_0x58b6e9['push'](_0x58b6e9['shift']());}};_0x261a4c(++_0x2857c0);}(_0x96bb,0x9c));var _0xb96b=function(_0x16c0bd,_0x9676d2){_0x16c0bd=_0x16c0bd-0x0;var _0x48fd60=_0x96bb[_0x16c0bd];return _0x48fd60;};'use strict';var _=require('lodash');var util=require(_0xb96b('0x0'));var moment=require(_0xb96b('0x1'));var BPromise=require(_0xb96b('0x2'));var rs=require(_0xb96b('0x3'));var fs=require('fs');var Redis=require(_0xb96b('0x4'));var db=require(_0xb96b('0x5'))['db'];var utils=require(_0xb96b('0x6'));var logger=require(_0xb96b('0x7'))(_0xb96b('0x8'));var config=require(_0xb96b('0x9'));var jayson=require(_0xb96b('0xa'));var client=jayson[_0xb96b('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5da463,_0x293eb3,_0x543c74){return new BPromise(function(_0x4b142c,_0x154222){return client[_0xb96b('0xc')](_0x5da463,_0x543c74)[_0xb96b('0xd')](function(_0x35c1c2){logger[_0xb96b('0xe')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x293eb3,_0xb96b('0xf'));logger[_0xb96b('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x293eb3,'request\x20sent',JSON[_0xb96b('0x11')](_0x35c1c2));if(_0x35c1c2[_0xb96b('0x12')]){if(_0x35c1c2['error'][_0xb96b('0x13')]===0x1f4){logger['error'](_0xb96b('0x14'),_0x293eb3,_0x35c1c2['error']['message']);return _0x154222(_0x35c1c2[_0xb96b('0x12')]['message']);}logger[_0xb96b('0x12')](_0xb96b('0x14'),_0x293eb3,_0x35c1c2['error'][_0xb96b('0x15')]);return _0x4b142c(_0x35c1c2[_0xb96b('0x12')][_0xb96b('0x15')]);}else{logger['info'](_0xb96b('0x14'),_0x293eb3,_0xb96b('0xf'));_0x4b142c(_0x35c1c2[_0xb96b('0x16')][_0xb96b('0x15')]);}})['catch'](function(_0x47b842){logger[_0xb96b('0x12')](_0xb96b('0x14'),_0x293eb3,_0x47b842);_0x154222(_0x47b842);});});} \ No newline at end of file +var _0xdcc1=['request','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http'];(function(_0x52e363,_0x48062a){var _0x3fc2b5=function(_0x1b0cf9){while(--_0x1b0cf9){_0x52e363['push'](_0x52e363['shift']());}};_0x3fc2b5(++_0x48062a);}(_0xdcc1,0x170));var _0x1dcc=function(_0x2127ad,_0x1e858d){_0x2127ad=_0x2127ad-0x0;var _0x30e2ab=_0xdcc1[_0x2127ad];return _0x30e2ab;};'use strict';var _=require(_0x1dcc('0x0'));var util=require(_0x1dcc('0x1'));var moment=require(_0x1dcc('0x2'));var BPromise=require(_0x1dcc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1dcc('0x4'));var db=require(_0x1dcc('0x5'))['db'];var utils=require(_0x1dcc('0x6'));var logger=require(_0x1dcc('0x7'))('rpc');var config=require(_0x1dcc('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1dcc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ce3a6,_0x481d7c,_0x40acb8){return new BPromise(function(_0x2b29ce,_0x13b150){return client[_0x1dcc('0xa')](_0x1ce3a6,_0x40acb8)['then'](function(_0x4d4edd){logger['info'](_0x1dcc('0xb'),_0x481d7c,_0x1dcc('0xc'));logger[_0x1dcc('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x481d7c,'request\x20sent',JSON[_0x1dcc('0xe')](_0x4d4edd));if(_0x4d4edd[_0x1dcc('0xf')]){if(_0x4d4edd[_0x1dcc('0xf')][_0x1dcc('0x10')]===0x1f4){logger[_0x1dcc('0xf')](_0x1dcc('0xb'),_0x481d7c,_0x4d4edd[_0x1dcc('0xf')][_0x1dcc('0x11')]);return _0x13b150(_0x4d4edd[_0x1dcc('0xf')][_0x1dcc('0x11')]);}logger[_0x1dcc('0xf')](_0x1dcc('0xb'),_0x481d7c,_0x4d4edd['error'][_0x1dcc('0x11')]);return _0x2b29ce(_0x4d4edd['error'][_0x1dcc('0x11')]);}else{logger[_0x1dcc('0x12')](_0x1dcc('0xb'),_0x481d7c,'request\x20sent');_0x2b29ce(_0x4d4edd[_0x1dcc('0x13')][_0x1dcc('0x11')]);}})[_0x1dcc('0x14')](function(_0x25eb59){logger[_0x1dcc('0xf')](_0x1dcc('0xb'),_0x481d7c,_0x25eb59);_0x13b150(_0x25eb59);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 8c24e1d..2e5e4ed 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 _0xdd79=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','/:id/download','isAuthenticated','put','update'];(function(_0x6c0ac,_0x26ec95){var _0x57f34c=function(_0x4d0ac6){while(--_0x4d0ac6){_0x6c0ac['push'](_0x6c0ac['shift']());}};_0x57f34c(++_0x26ec95);}(_0xdd79,0x16b));var _0x9dd7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xdd79[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x9dd7('0x0'));var path=require(_0x9dd7('0x1'));var timeout=require(_0x9dd7('0x2'));var express=require(_0x9dd7('0x3'));var router=express[_0x9dd7('0x4')]();var fs_extra=require(_0x9dd7('0x5'));var auth=require(_0x9dd7('0x6'));var interaction=require(_0x9dd7('0x7'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router[_0x9dd7('0x8')]('/',auth['isAuthenticated'](),controller[_0x9dd7('0x9')]);router[_0x9dd7('0x8')](_0x9dd7('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x9dd7('0x8')](_0x9dd7('0xb'),auth[_0x9dd7('0xc')](),controller['download']);router['post']('/',auth[_0x9dd7('0xc')](),controller['create']);router[_0x9dd7('0xd')](_0x9dd7('0xa'),auth['isAuthenticated'](),controller[_0x9dd7('0xe')]);router[_0x9dd7('0xf')](_0x9dd7('0xa'),auth['isAuthenticated'](),controller[_0x9dd7('0x10')]);module[_0x9dd7('0x11')]=router; \ No newline at end of file +var _0xd20d=['update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put'];(function(_0x38d897,_0x4683df){var _0x439ce8=function(_0x47f268){while(--_0x47f268){_0x38d897['push'](_0x38d897['shift']());}};_0x439ce8(++_0x4683df);}(_0xd20d,0x168));var _0xdd20=function(_0x877c80,_0x38f939){_0x877c80=_0x877c80-0x0;var _0x377bdb=_0xd20d[_0x877c80];return _0x377bdb;};'use strict';var multer=require(_0xdd20('0x0'));var util=require(_0xdd20('0x1'));var path=require(_0xdd20('0x2'));var timeout=require(_0xdd20('0x3'));var express=require(_0xdd20('0x4'));var router=express[_0xdd20('0x5')]();var fs_extra=require(_0xdd20('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdd20('0x7'));var controller=require('./analyticExtractedReport.controller');router[_0xdd20('0x8')]('/',auth['isAuthenticated'](),controller[_0xdd20('0x9')]);router[_0xdd20('0x8')](_0xdd20('0xa'),auth[_0xdd20('0xb')](),controller[_0xdd20('0xc')]);router[_0xdd20('0x8')](_0xdd20('0xd'),auth['isAuthenticated'](),controller[_0xdd20('0xe')]);router[_0xdd20('0xf')]('/',auth[_0xdd20('0xb')](),controller[_0xdd20('0x10')]);router[_0xdd20('0x11')](_0xdd20('0xa'),auth[_0xdd20('0xb')](),controller[_0xdd20('0x12')]);router[_0xdd20('0x13')]('/:id',auth[_0xdd20('0xb')](),controller['destroy']);module[_0xdd20('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 47c897d..51379a6 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 _0x8f1b=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x577a87,_0x30efe2){var _0x3e2384=function(_0x2f9915){while(--_0x2f9915){_0x577a87['push'](_0x577a87['shift']());}};_0x3e2384(++_0x30efe2);}(_0x8f1b,0x16a));var _0xb8f1=function(_0x87f99b,_0x4c3d05){_0x87f99b=_0x87f99b-0x0;var _0x233df9=_0x8f1b[_0x87f99b];return _0x233df9;};'use strict';var Sequelize=require(_0xb8f1('0x0'));module[_0xb8f1('0x1')]={'field':{'type':Sequelize[_0xb8f1('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0xb8f1('0x3')]},'format':{'type':Sequelize[_0xb8f1('0x3')]},'groupBy':{'type':Sequelize[_0xb8f1('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xb8f1('0x3')]},'custom':{'type':Sequelize[_0xb8f1('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x1fc1=['BOOLEAN','exports','TEXT','STRING'];(function(_0x3ab6cb,_0x5e47e7){var _0x1592d9=function(_0x28f34f){while(--_0x28f34f){_0x3ab6cb['push'](_0x3ab6cb['shift']());}};_0x1592d9(++_0x5e47e7);}(_0x1fc1,0x185));var _0x11fc=function(_0x23dad9,_0x5dc8f2){_0x23dad9=_0x23dad9-0x0;var _0x527967=_0x1fc1[_0x23dad9];return _0x527967;};'use strict';var Sequelize=require('sequelize');module[_0x11fc('0x0')]={'field':{'type':Sequelize[_0x11fc('0x1')]},'alias':{'type':Sequelize[_0x11fc('0x2')]},'function':{'type':Sequelize[_0x11fc('0x2')]},'format':{'type':Sequelize[_0x11fc('0x2')]},'groupBy':{'type':Sequelize[_0x11fc('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'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 e12c789..c5ac353 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 _0x535e=['AnalyticFieldReport','rawAttributes','fieldName','type','map','query','keys','intersection','attributes','model','length','nolimit','order','sort','pick','filters','where','merge','VIRTUAL','filter','options','then','findAll','catch','params','fields','includeAll','find','create','bulkCreate','body','update','bulkDestroy','ids','addFields','findOne','sequelize','transaction','rimraf','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','reject','destroy','sendStatus','stack','name','send','index'];(function(_0x27162c,_0x21cb5d){var _0x39f7fc=function(_0x2ba9e0){while(--_0x2ba9e0){_0x27162c['push'](_0x27162c['shift']());}};_0x39f7fc(++_0x21cb5d);}(_0x535e,0x189));var _0xe535=function(_0x2cdcf9,_0x8a09d1){_0x2cdcf9=_0x2cdcf9-0x0;var _0x39412d=_0x535e[_0x2cdcf9];return _0x39412d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe535('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe535('0x1'));var moment=require('moment');var BPromise=require(_0xe535('0x2'));var Mustache=require(_0xe535('0x3'));var util=require('util');var path=require('path');var sox=require(_0xe535('0x4'));var csv=require(_0xe535('0x5'));var ejs=require(_0xe535('0x6'));var fs=require('fs');var fs_extra=require(_0xe535('0x7'));var _=require('lodash');var squel=require(_0xe535('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe535('0x9'));var toCsv=require(_0xe535('0x5'));var querystring=require(_0xe535('0xa'));var Papa=require('papaparse');var Redis=require(_0xe535('0xb'));var authService=require(_0xe535('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xe535('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe535('0xe'))(_0xe535('0xf'));var utils=require(_0xe535('0x10'));var config=require(_0xe535('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xe535('0x12'))['db'];function respondWithStatusCode(_0x20cc8e,_0x2579c7){_0x2579c7=_0x2579c7||0xcc;return function(_0x573db0){if(_0x573db0){return _0x20cc8e['sendStatus'](_0x2579c7);}return _0x20cc8e[_0xe535('0x13')](_0x2579c7)[_0xe535('0x14')]();};}function respondWithResult(_0x50047b,_0x4bd6a5){_0x4bd6a5=_0x4bd6a5||0xc8;return function(_0x36c3b8){if(_0x36c3b8){return _0x50047b[_0xe535('0x13')](_0x4bd6a5)[_0xe535('0x15')](_0x36c3b8);}};}function respondWithFilteredResult(_0x2ea235,_0x5a0bca){return function(_0x29453d){if(_0x29453d){var _0x3dc832=typeof _0x5a0bca[_0xe535('0x16')]===_0xe535('0x17')&&typeof _0x5a0bca[_0xe535('0x18')]===_0xe535('0x17');var _0x2723f6=_0x29453d[_0xe535('0x19')];var _0x1886cb=_0x3dc832?0x0:_0x5a0bca['offset'];var _0x54bfd8=_0x3dc832?_0x29453d[_0xe535('0x19')]:_0x5a0bca[_0xe535('0x16')]+_0x5a0bca[_0xe535('0x18')];var _0x23d7d2;if(_0x54bfd8>=_0x2723f6){_0x54bfd8=_0x2723f6;_0x23d7d2=0xc8;}else{_0x23d7d2=0xce;}_0x2ea235[_0xe535('0x13')](_0x23d7d2);return _0x2ea235['set']('Content-Range',_0x1886cb+'-'+_0x54bfd8+'/'+_0x2723f6)[_0xe535('0x15')](_0x29453d);}return null;};}function patchUpdates(_0x3866d0){return function(_0x1bf92b){try{jsonpatch['apply'](_0x1bf92b,_0x3866d0,!![]);}catch(_0x297475){return BPromise[_0xe535('0x1a')](_0x297475);}return _0x1bf92b['save']();};}function saveUpdates(_0x6b6a79,_0x31bbcb){return function(_0x4946d5){if(_0x4946d5){return _0x4946d5['update'](_0x6b6a79)['then'](function(_0xcbffa2){return _0xcbffa2;});}return null;};}function removeEntity(_0x2936b5,_0x53b591){return function(_0x23a351){if(_0x23a351){return _0x23a351[_0xe535('0x1b')]()['then'](function(){_0x2936b5['status'](0xcc)[_0xe535('0x14')]();});}};}function handleEntityNotFound(_0x458876,_0x13fcb4){return function(_0x337565){if(!_0x337565){_0x458876[_0xe535('0x1c')](0x194);}return _0x337565;};}function handleError(_0x2ccc74,_0x206e65){_0x206e65=_0x206e65||0x1f4;return function(_0x232d30){logger['error'](_0x232d30[_0xe535('0x1d')]);if(_0x232d30[_0xe535('0x1e')]){delete _0x232d30[_0xe535('0x1e')];}_0x2ccc74[_0xe535('0x13')](_0x206e65)[_0xe535('0x1f')](_0x232d30);};}exports[_0xe535('0x20')]=function(_0x5b7ec5,_0xf96443){var _0x2415cd={},_0x3d7c86={},_0x7f46dd={'count':0x0,'rows':[]};var _0x34b778=_['map'](db[_0xe535('0x21')][_0xe535('0x22')],function(_0x3a6701){return{'name':_0x3a6701[_0xe535('0x23')],'type':_0x3a6701[_0xe535('0x24')]['key']};});_0x3d7c86['model']=_[_0xe535('0x25')](_0x34b778,'name');_0x3d7c86[_0xe535('0x26')]=_[_0xe535('0x27')](_0x5b7ec5[_0xe535('0x26')]);_0x3d7c86['filters']=_[_0xe535('0x28')](_0x3d7c86['model'],_0x3d7c86['query']);_0x2415cd[_0xe535('0x29')]=_['intersection'](_0x3d7c86[_0xe535('0x2a')],qs['fields'](_0x5b7ec5[_0xe535('0x26')]['fields']));_0x2415cd[_0xe535('0x29')]=_0x2415cd['attributes'][_0xe535('0x2b')]?_0x2415cd[_0xe535('0x29')]:_0x3d7c86[_0xe535('0x2a')];if(!_0x5b7ec5[_0xe535('0x26')]['hasOwnProperty'](_0xe535('0x2c'))){_0x2415cd['limit']=qs[_0xe535('0x18')](_0x5b7ec5[_0xe535('0x26')][_0xe535('0x18')]);_0x2415cd['offset']=qs[_0xe535('0x16')](_0x5b7ec5[_0xe535('0x26')][_0xe535('0x16')]);}_0x2415cd[_0xe535('0x2d')]=qs[_0xe535('0x2e')](_0x5b7ec5['query']['sort']);_0x2415cd['where']=qs['filters'](_[_0xe535('0x2f')](_0x5b7ec5[_0xe535('0x26')],_0x3d7c86[_0xe535('0x30')]),_0x34b778);if(_0x5b7ec5[_0xe535('0x26')]['filter']){_0x2415cd[_0xe535('0x31')]=_[_0xe535('0x32')](_0x2415cd['where'],{'$or':_[_0xe535('0x25')](_0x34b778,function(_0xa6bbe1){if(_0xa6bbe1['type']!==_0xe535('0x33')){var _0x1a0d08={};_0x1a0d08[_0xa6bbe1[_0xe535('0x1e')]]={'$like':'%'+_0x5b7ec5[_0xe535('0x26')][_0xe535('0x34')]+'%'};return _0x1a0d08;}})});}_0x2415cd=_[_0xe535('0x32')]({},_0x2415cd,_0x5b7ec5[_0xe535('0x35')]);var _0x46d861={'where':_0x2415cd['where']};return db[_0xe535('0x21')][_0xe535('0x19')](_0x46d861)[_0xe535('0x36')](function(_0x265b79){_0x7f46dd[_0xe535('0x19')]=_0x265b79;if(_0x5b7ec5[_0xe535('0x26')]['includeAll']){_0x2415cd['include']=[{'all':!![]}];}return db[_0xe535('0x21')][_0xe535('0x37')](_0x2415cd);})[_0xe535('0x36')](function(_0x4bb06e){_0x7f46dd['rows']=_0x4bb06e;return _0x7f46dd;})[_0xe535('0x36')](respondWithFilteredResult(_0xf96443,_0x2415cd))[_0xe535('0x38')](handleError(_0xf96443,null));};exports['show']=function(_0x30e83c,_0x3ee7a8){var _0x3b5aba={'raw':![],'where':{'id':_0x30e83c[_0xe535('0x39')]['id']}},_0x499071={};_0x499071[_0xe535('0x2a')]=_['keys'](db[_0xe535('0x21')][_0xe535('0x22')]);_0x499071[_0xe535('0x26')]=_[_0xe535('0x27')](_0x30e83c['query']);_0x499071['filters']=_[_0xe535('0x28')](_0x499071[_0xe535('0x2a')],_0x499071[_0xe535('0x26')]);_0x3b5aba[_0xe535('0x29')]=_[_0xe535('0x28')](_0x499071[_0xe535('0x2a')],qs[_0xe535('0x3a')](_0x30e83c[_0xe535('0x26')][_0xe535('0x3a')]));_0x3b5aba[_0xe535('0x29')]=_0x3b5aba[_0xe535('0x29')][_0xe535('0x2b')]?_0x3b5aba['attributes']:_0x499071[_0xe535('0x2a')];if(_0x30e83c[_0xe535('0x26')][_0xe535('0x3b')]){_0x3b5aba['include']=[{'all':!![]}];}_0x3b5aba=_[_0xe535('0x32')]({},_0x3b5aba,_0x30e83c[_0xe535('0x35')]);return db['AnalyticFieldReport'][_0xe535('0x3c')](_0x3b5aba)['then'](handleEntityNotFound(_0x3ee7a8,null))[_0xe535('0x36')](respondWithResult(_0x3ee7a8,null))[_0xe535('0x38')](handleError(_0x3ee7a8,null));};exports[_0xe535('0x3d')]=function(_0x4f1e95,_0x234267){return db[_0xe535('0x21')][_0xe535('0x3d')](_0x4f1e95['body'],{})[_0xe535('0x36')](respondWithResult(_0x234267,0xc9))[_0xe535('0x38')](handleError(_0x234267,null));};exports[_0xe535('0x3e')]=function(_0x398522,_0x416560){return db[_0xe535('0x21')][_0xe535('0x3e')](_0x398522[_0xe535('0x3f')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x416560,0xc9))[_0xe535('0x38')](handleError(_0x416560,null));};exports[_0xe535('0x40')]=function(_0xa02751,_0x237ee5){if(_0xa02751[_0xe535('0x3f')]['id']){delete _0xa02751[_0xe535('0x3f')]['id'];}return db[_0xe535('0x21')][_0xe535('0x3c')]({'where':{'id':_0xa02751['params']['id']}})['then'](handleEntityNotFound(_0x237ee5,null))[_0xe535('0x36')](saveUpdates(_0xa02751[_0xe535('0x3f')],null))[_0xe535('0x36')](respondWithResult(_0x237ee5,null))[_0xe535('0x38')](handleError(_0x237ee5,null));};exports[_0xe535('0x1b')]=function(_0x66e843,_0xdc8cc2){return db['AnalyticFieldReport'][_0xe535('0x3c')]({'where':{'id':_0x66e843[_0xe535('0x39')]['id']}})[_0xe535('0x36')](handleEntityNotFound(_0xdc8cc2,null))['then'](removeEntity(_0xdc8cc2,null))[_0xe535('0x38')](handleError(_0xdc8cc2,null));};exports[_0xe535('0x41')]=function(_0x16c597,_0x1c835b){return db[_0xe535('0x21')][_0xe535('0x1b')]({'where':{'id':_0x16c597[_0xe535('0x26')][_0xe535('0x42')]||[]},'raw':![],'individualHooks':!![]})[_0xe535('0x36')](respondWithResult(_0x1c835b,0xcc))[_0xe535('0x38')](handleError(_0x1c835b,null));};exports[_0xe535('0x43')]=function(_0x16fb66,_0x5d8566,_0xd6d10){return db['AnalyticCustomReport'][_0xe535('0x44')]({'where':{'id':_0x16fb66[_0xe535('0x39')]['id']}})[_0xe535('0x36')](handleEntityNotFound(_0x5d8566,null))['then'](function(_0x39e580){if(_0x39e580){return db[_0xe535('0x45')][_0xe535('0x46')](function(_0x278766){return db['AnalyticFieldReport'][_0xe535('0x1b')]({'where':{'CustomReportId':_0x16fb66[_0xe535('0x39')]['id']},'transaction':_0x278766})[_0xe535('0x36')](function(_0xdd7a7){var _0x41b37a=_['map'](_0x16fb66['body'],function(_0x48adb1){delete _0x48adb1['id'];_0x48adb1['CustomReportId']=_0x16fb66['params']['id'];return _0x48adb1;});return db[_0xe535('0x21')][_0xe535('0x3e')](_0x41b37a,{'transaction':_0x278766});});})[_0xe535('0x36')](function(){return db['AnalyticFieldReport'][_0xe535('0x37')]({'where':{'CustomReportId':_0x16fb66[_0xe535('0x39')]['id']}});});}})[_0xe535('0x36')](respondWithResult(_0x5d8566,null))[_0xe535('0x38')](handleError(_0x5d8566,null));}; \ No newline at end of file +var _0x50ca=['../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','end','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','find','create','body','bulkCreate','bulkDestroy','destroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','rimraf','fast-json-patch','request-promise','moment','util','path','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'];(function(_0x125207,_0x4b176b){var _0x3e8804=function(_0x4ac9ae){while(--_0x4ac9ae){_0x125207['push'](_0x125207['shift']());}};_0x3e8804(++_0x4b176b);}(_0x50ca,0xe3));var _0xa50c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x50ca[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa50c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa50c('0x1'));var rp=require(_0xa50c('0x2'));var moment=require(_0xa50c('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa50c('0x4'));var path=require(_0xa50c('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa50c('0x6'));var fs=require('fs');var fs_extra=require(_0xa50c('0x7'));var _=require(_0xa50c('0x8'));var squel=require(_0xa50c('0x9'));var crypto=require(_0xa50c('0xa'));var jsforce=require(_0xa50c('0xb'));var deskjs=require(_0xa50c('0xc'));var toCsv=require(_0xa50c('0xd'));var querystring=require(_0xa50c('0xe'));var Papa=require(_0xa50c('0xf'));var Redis=require(_0xa50c('0x10'));var authService=require(_0xa50c('0x11'));var qs=require(_0xa50c('0x12'));var as=require(_0xa50c('0x13'));var hardwareService=require(_0xa50c('0x14'));var logger=require(_0xa50c('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xa50c('0x16'));var licenseUtil=require(_0xa50c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b0818,_0x2902d2){_0x2902d2=_0x2902d2||0xcc;return function(_0x33d7a0){if(_0x33d7a0){return _0x1b0818[_0xa50c('0x18')](_0x2902d2);}return _0x1b0818[_0xa50c('0x19')](_0x2902d2)['end']();};}function respondWithResult(_0x1ffa05,_0x4438c0){_0x4438c0=_0x4438c0||0xc8;return function(_0x2009ce){if(_0x2009ce){return _0x1ffa05['status'](_0x4438c0)[_0xa50c('0x1a')](_0x2009ce);}};}function respondWithFilteredResult(_0x3cda12,_0x4c1453){return function(_0x174f51){if(_0x174f51){var _0x50a389=typeof _0x4c1453[_0xa50c('0x1b')]===_0xa50c('0x1c')&&typeof _0x4c1453[_0xa50c('0x1d')]===_0xa50c('0x1c');var _0x553bb8=_0x174f51['count'];var _0x5adf1e=_0x50a389?0x0:_0x4c1453[_0xa50c('0x1b')];var _0x2a8561=_0x50a389?_0x174f51[_0xa50c('0x1e')]:_0x4c1453[_0xa50c('0x1b')]+_0x4c1453['limit'];var _0xc3f35f;if(_0x2a8561>=_0x553bb8){_0x2a8561=_0x553bb8;_0xc3f35f=0xc8;}else{_0xc3f35f=0xce;}_0x3cda12[_0xa50c('0x19')](_0xc3f35f);return _0x3cda12[_0xa50c('0x1f')]('Content-Range',_0x5adf1e+'-'+_0x2a8561+'/'+_0x553bb8)[_0xa50c('0x1a')](_0x174f51);}return null;};}function patchUpdates(_0xf980cd){return function(_0xeeda7d){try{jsonpatch[_0xa50c('0x20')](_0xeeda7d,_0xf980cd,!![]);}catch(_0xbe35a4){return BPromise[_0xa50c('0x21')](_0xbe35a4);}return _0xeeda7d['save']();};}function saveUpdates(_0x1bfaa6,_0x57aa25){return function(_0x5132d8){if(_0x5132d8){return _0x5132d8[_0xa50c('0x22')](_0x1bfaa6)[_0xa50c('0x23')](function(_0x185695){return _0x185695;});}return null;};}function removeEntity(_0x566b57,_0x58da52){return function(_0x79229f){if(_0x79229f){return _0x79229f['destroy']()[_0xa50c('0x23')](function(){_0x566b57[_0xa50c('0x19')](0xcc)[_0xa50c('0x24')]();});}};}function handleEntityNotFound(_0x570b78,_0x3e85ae){return function(_0x5b8cf5){if(!_0x5b8cf5){_0x570b78[_0xa50c('0x18')](0x194);}return _0x5b8cf5;};}function handleError(_0x54611a,_0x1d307e){_0x1d307e=_0x1d307e||0x1f4;return function(_0x45b52c){logger[_0xa50c('0x25')](_0x45b52c[_0xa50c('0x26')]);if(_0x45b52c[_0xa50c('0x27')]){delete _0x45b52c[_0xa50c('0x27')];}_0x54611a[_0xa50c('0x19')](_0x1d307e)[_0xa50c('0x28')](_0x45b52c);};}exports[_0xa50c('0x29')]=function(_0x4efb98,_0x4c5543){var _0x1a2962={},_0xe159ef={},_0x4da853={'count':0x0,'rows':[]};var _0x2a7e0d=_[_0xa50c('0x2a')](db[_0xa50c('0x2b')][_0xa50c('0x2c')],function(_0x48cd0d){return{'name':_0x48cd0d[_0xa50c('0x2d')],'type':_0x48cd0d[_0xa50c('0x2e')][_0xa50c('0x2f')]};});_0xe159ef[_0xa50c('0x30')]=_[_0xa50c('0x2a')](_0x2a7e0d,_0xa50c('0x27'));_0xe159ef['query']=_[_0xa50c('0x31')](_0x4efb98[_0xa50c('0x32')]);_0xe159ef[_0xa50c('0x33')]=_[_0xa50c('0x34')](_0xe159ef[_0xa50c('0x30')],_0xe159ef[_0xa50c('0x32')]);_0x1a2962['attributes']=_['intersection'](_0xe159ef['model'],qs[_0xa50c('0x35')](_0x4efb98[_0xa50c('0x32')][_0xa50c('0x35')]));_0x1a2962[_0xa50c('0x36')]=_0x1a2962[_0xa50c('0x36')][_0xa50c('0x37')]?_0x1a2962[_0xa50c('0x36')]:_0xe159ef[_0xa50c('0x30')];if(!_0x4efb98[_0xa50c('0x32')]['hasOwnProperty'](_0xa50c('0x38'))){_0x1a2962['limit']=qs[_0xa50c('0x1d')](_0x4efb98['query'][_0xa50c('0x1d')]);_0x1a2962[_0xa50c('0x1b')]=qs[_0xa50c('0x1b')](_0x4efb98['query'][_0xa50c('0x1b')]);}_0x1a2962[_0xa50c('0x39')]=qs['sort'](_0x4efb98[_0xa50c('0x32')][_0xa50c('0x3a')]);_0x1a2962[_0xa50c('0x3b')]=qs[_0xa50c('0x33')](_[_0xa50c('0x3c')](_0x4efb98[_0xa50c('0x32')],_0xe159ef[_0xa50c('0x33')]),_0x2a7e0d);if(_0x4efb98[_0xa50c('0x32')]['filter']){_0x1a2962[_0xa50c('0x3b')]=_[_0xa50c('0x3d')](_0x1a2962['where'],{'$or':_['map'](_0x2a7e0d,function(_0x2a9fd7){if(_0x2a9fd7[_0xa50c('0x2e')]!==_0xa50c('0x3e')){var _0x248c85={};_0x248c85[_0x2a9fd7['name']]={'$like':'%'+_0x4efb98['query'][_0xa50c('0x3f')]+'%'};return _0x248c85;}})});}_0x1a2962=_['merge']({},_0x1a2962,_0x4efb98[_0xa50c('0x40')]);var _0x2bc3df={'where':_0x1a2962[_0xa50c('0x3b')]};return db['AnalyticFieldReport'][_0xa50c('0x1e')](_0x2bc3df)[_0xa50c('0x23')](function(_0x5371cd){_0x4da853[_0xa50c('0x1e')]=_0x5371cd;if(_0x4efb98[_0xa50c('0x32')][_0xa50c('0x41')]){_0x1a2962[_0xa50c('0x42')]=[{'all':!![]}];}return db[_0xa50c('0x2b')][_0xa50c('0x43')](_0x1a2962);})[_0xa50c('0x23')](function(_0x55977c){_0x4da853[_0xa50c('0x44')]=_0x55977c;return _0x4da853;})[_0xa50c('0x23')](respondWithFilteredResult(_0x4c5543,_0x1a2962))[_0xa50c('0x45')](handleError(_0x4c5543,null));};exports['show']=function(_0x2f7995,_0x2e2a3e){var _0x300ff4={'raw':![],'where':{'id':_0x2f7995[_0xa50c('0x46')]['id']}},_0x1852f0={};_0x1852f0[_0xa50c('0x30')]=_[_0xa50c('0x31')](db[_0xa50c('0x2b')][_0xa50c('0x2c')]);_0x1852f0[_0xa50c('0x32')]=_[_0xa50c('0x31')](_0x2f7995['query']);_0x1852f0[_0xa50c('0x33')]=_[_0xa50c('0x34')](_0x1852f0['model'],_0x1852f0['query']);_0x300ff4[_0xa50c('0x36')]=_[_0xa50c('0x34')](_0x1852f0['model'],qs[_0xa50c('0x35')](_0x2f7995[_0xa50c('0x32')][_0xa50c('0x35')]));_0x300ff4[_0xa50c('0x36')]=_0x300ff4[_0xa50c('0x36')][_0xa50c('0x37')]?_0x300ff4[_0xa50c('0x36')]:_0x1852f0['model'];if(_0x2f7995[_0xa50c('0x32')]['includeAll']){_0x300ff4[_0xa50c('0x42')]=[{'all':!![]}];}_0x300ff4=_[_0xa50c('0x3d')]({},_0x300ff4,_0x2f7995[_0xa50c('0x40')]);return db[_0xa50c('0x2b')][_0xa50c('0x47')](_0x300ff4)[_0xa50c('0x23')](handleEntityNotFound(_0x2e2a3e,null))[_0xa50c('0x23')](respondWithResult(_0x2e2a3e,null))[_0xa50c('0x45')](handleError(_0x2e2a3e,null));};exports[_0xa50c('0x48')]=function(_0x2af5f0,_0xf86b56){return db[_0xa50c('0x2b')][_0xa50c('0x48')](_0x2af5f0[_0xa50c('0x49')],{})['then'](respondWithResult(_0xf86b56,0xc9))[_0xa50c('0x45')](handleError(_0xf86b56,null));};exports[_0xa50c('0x4a')]=function(_0x1689ae,_0x3f7b79){return db['AnalyticFieldReport'][_0xa50c('0x4a')](_0x1689ae[_0xa50c('0x49')],{'raw':![],'individualHooks':!![]})[_0xa50c('0x23')](respondWithResult(_0x3f7b79,0xc9))[_0xa50c('0x45')](handleError(_0x3f7b79,null));};exports[_0xa50c('0x22')]=function(_0x25d770,_0x506a4a){if(_0x25d770['body']['id']){delete _0x25d770[_0xa50c('0x49')]['id'];}return db['AnalyticFieldReport']['find']({'where':{'id':_0x25d770[_0xa50c('0x46')]['id']}})[_0xa50c('0x23')](handleEntityNotFound(_0x506a4a,null))['then'](saveUpdates(_0x25d770[_0xa50c('0x49')],null))[_0xa50c('0x23')](respondWithResult(_0x506a4a,null))['catch'](handleError(_0x506a4a,null));};exports['destroy']=function(_0x1769e4,_0x4904bb){return db[_0xa50c('0x2b')][_0xa50c('0x47')]({'where':{'id':_0x1769e4[_0xa50c('0x46')]['id']}})[_0xa50c('0x23')](handleEntityNotFound(_0x4904bb,null))[_0xa50c('0x23')](removeEntity(_0x4904bb,null))['catch'](handleError(_0x4904bb,null));};exports[_0xa50c('0x4b')]=function(_0x45dffe,_0x38d2ed){return db['AnalyticFieldReport'][_0xa50c('0x4c')]({'where':{'id':_0x45dffe[_0xa50c('0x32')][_0xa50c('0x4d')]||[]},'raw':![],'individualHooks':!![]})[_0xa50c('0x23')](respondWithResult(_0x38d2ed,0xcc))[_0xa50c('0x45')](handleError(_0x38d2ed,null));};exports['addFields']=function(_0x1a1b28,_0x6a0670,_0x1ec333){return db[_0xa50c('0x4e')][_0xa50c('0x4f')]({'where':{'id':_0x1a1b28[_0xa50c('0x46')]['id']}})[_0xa50c('0x23')](handleEntityNotFound(_0x6a0670,null))['then'](function(_0x40141c){if(_0x40141c){return db[_0xa50c('0x50')][_0xa50c('0x51')](function(_0xa6243b){return db[_0xa50c('0x2b')][_0xa50c('0x4c')]({'where':{'CustomReportId':_0x1a1b28[_0xa50c('0x46')]['id']},'transaction':_0xa6243b})['then'](function(_0x3b6a5e){var _0x2bcf5b=_['map'](_0x1a1b28[_0xa50c('0x49')],function(_0x182bc0){delete _0x182bc0['id'];_0x182bc0[_0xa50c('0x52')]=_0x1a1b28['params']['id'];return _0x182bc0;});return db[_0xa50c('0x2b')][_0xa50c('0x4a')](_0x2bcf5b,{'transaction':_0xa6243b});});})['then'](function(){return db[_0xa50c('0x2b')][_0xa50c('0x43')]({'where':{'CustomReportId':_0x1a1b28[_0xa50c('0x46')]['id']}});});}})[_0xa50c('0x23')](respondWithResult(_0x6a0670,null))[_0xa50c('0x45')](handleError(_0x6a0670,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 206e1c7..cac02ea 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 _0xc247=['path','rimraf','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4408b8,_0x41014b){var _0x4671df=function(_0x420a4f){while(--_0x420a4f){_0x4408b8['push'](_0x4408b8['shift']());}};_0x4671df(++_0x41014b);}(_0xc247,0x1ac));var _0x7c24=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0xc247[_0x44216d];return _0xeca523;};'use strict';var _=require('lodash');var util=require(_0x7c24('0x0'));var logger=require(_0x7c24('0x1'))(_0x7c24('0x2'));var moment=require(_0x7c24('0x3'));var BPromise=require(_0x7c24('0x4'));var rp=require(_0x7c24('0x5'));var fs=require('fs');var path=require(_0x7c24('0x6'));var rimraf=require(_0x7c24('0x7'));var config=require(_0x7c24('0x8'));var attributes=require(_0x7c24('0x9'));module[_0x7c24('0xa')]=function(_0xbb4844,_0x7954c8){return _0xbb4844[_0x7c24('0xb')](_0x7c24('0xc'),attributes,{'tableName':_0x7c24('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ec2=['exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment'];(function(_0x545a02,_0x2efaab){var _0x70e3e=function(_0x3132a0){while(--_0x3132a0){_0x545a02['push'](_0x545a02['shift']());}};_0x70e3e(++_0x2efaab);}(_0x4ec2,0xd0));var _0x24ec=function(_0x1840ae,_0x3481a0){_0x1840ae=_0x1840ae-0x0;var _0x3478e4=_0x4ec2[_0x1840ae];return _0x3478e4;};'use strict';var _=require(_0x24ec('0x0'));var util=require(_0x24ec('0x1'));var logger=require(_0x24ec('0x2'))(_0x24ec('0x3'));var moment=require('moment');var BPromise=require(_0x24ec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x24ec('0x5'));var rimraf=require(_0x24ec('0x6'));var config=require(_0x24ec('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0x24ec('0x8')]=function(_0x5798da,_0x50fb40){return _0x5798da[_0x24ec('0x9')](_0x24ec('0xa'),attributes,{'tableName':_0x24ec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 629aaef..9eae410 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 _0xa0e0=['../../config/environment','jayson/promise','client','http','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x434a78,_0x4b1332){var _0x431d6e=function(_0xa80eac){while(--_0xa80eac){_0x434a78['push'](_0x434a78['shift']());}};_0x431d6e(++_0x4b1332);}(_0xa0e0,0x1af));var _0x0a0e=function(_0x47e4ba,_0x1e7596){_0x47e4ba=_0x47e4ba-0x0;var _0x51b33a=_0xa0e0[_0x47e4ba];return _0x51b33a;};'use strict';var _=require(_0x0a0e('0x0'));var util=require(_0x0a0e('0x1'));var moment=require(_0x0a0e('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a0e('0x3'));var fs=require('fs');var Redis=require(_0x0a0e('0x4'));var db=require(_0x0a0e('0x5'))['db'];var utils=require(_0x0a0e('0x6'));var logger=require(_0x0a0e('0x7'))(_0x0a0e('0x8'));var config=require(_0x0a0e('0x9'));var jayson=require(_0x0a0e('0xa'));var client=jayson[_0x0a0e('0xb')][_0x0a0e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8ef100,_0x3f6e6c,_0x217936){return new BPromise(function(_0x5f4d0e,_0x5f531c){return client['request'](_0x8ef100,_0x217936)[_0x0a0e('0xd')](function(_0x485b4c){logger[_0x0a0e('0xe')](_0x0a0e('0xf'),_0x3f6e6c,_0x0a0e('0x10'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x3f6e6c,'request\x20sent',JSON[_0x0a0e('0x11')](_0x485b4c));if(_0x485b4c[_0x0a0e('0x12')]){if(_0x485b4c[_0x0a0e('0x12')]['code']===0x1f4){logger[_0x0a0e('0x12')](_0x0a0e('0xf'),_0x3f6e6c,_0x485b4c[_0x0a0e('0x12')][_0x0a0e('0x13')]);return _0x5f531c(_0x485b4c[_0x0a0e('0x12')][_0x0a0e('0x13')]);}logger['error'](_0x0a0e('0xf'),_0x3f6e6c,_0x485b4c[_0x0a0e('0x12')][_0x0a0e('0x13')]);return _0x5f4d0e(_0x485b4c[_0x0a0e('0x12')][_0x0a0e('0x13')]);}else{logger[_0x0a0e('0xe')](_0x0a0e('0xf'),_0x3f6e6c,_0x0a0e('0x10'));_0x5f4d0e(_0x485b4c[_0x0a0e('0x14')][_0x0a0e('0x13')]);}})[_0x0a0e('0x15')](function(_0x331ff7){logger[_0x0a0e('0x12')](_0x0a0e('0xf'),_0x3f6e6c,_0x331ff7);_0x5f531c(_0x331ff7);});});} \ No newline at end of file +var _0x5fc4=['error','code','AnalyticFieldReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','request\x20sent','stringify'];(function(_0x3401b2,_0x15187a){var _0x37ced6=function(_0x596f93){while(--_0x596f93){_0x3401b2['push'](_0x3401b2['shift']());}};_0x37ced6(++_0x15187a);}(_0x5fc4,0x8b));var _0x45fc=function(_0xdada58,_0x324249){_0xdada58=_0xdada58-0x0;var _0xa6b75a=_0x5fc4[_0xdada58];return _0xa6b75a;};'use strict';var _=require(_0x45fc('0x0'));var util=require(_0x45fc('0x1'));var moment=require(_0x45fc('0x2'));var BPromise=require('bluebird');var rs=require(_0x45fc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x45fc('0x4'))['db'];var utils=require(_0x45fc('0x5'));var logger=require(_0x45fc('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x45fc('0x7'));var client=jayson['client'][_0x45fc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2cf74d,_0x14a6aa,_0x553268){return new BPromise(function(_0x26c0a8,_0x3de375){return client[_0x45fc('0x9')](_0x2cf74d,_0x553268)[_0x45fc('0xa')](function(_0x1bf644){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x14a6aa,_0x45fc('0xb'));logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x14a6aa,_0x45fc('0xb'),JSON[_0x45fc('0xc')](_0x1bf644));if(_0x1bf644['error']){if(_0x1bf644[_0x45fc('0xd')][_0x45fc('0xe')]===0x1f4){logger[_0x45fc('0xd')](_0x45fc('0xf'),_0x14a6aa,_0x1bf644[_0x45fc('0xd')]['message']);return _0x3de375(_0x1bf644['error']['message']);}logger['error'](_0x45fc('0xf'),_0x14a6aa,_0x1bf644['error'][_0x45fc('0x10')]);return _0x26c0a8(_0x1bf644['error'][_0x45fc('0x10')]);}else{logger[_0x45fc('0x11')](_0x45fc('0xf'),_0x14a6aa,_0x45fc('0xb'));_0x26c0a8(_0x1bf644['result'][_0x45fc('0x10')]);}})[_0x45fc('0x12')](function(_0xceebc7){logger[_0x45fc('0xd')](_0x45fc('0xf'),_0x14a6aa,_0xceebc7);_0x3de375(_0xceebc7);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 74c7d58..8589d88 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(_0x3f4bef,_0x359a87){var _0x1989b7=function(_0xe0ffca){while(--_0xe0ffca){_0x3f4bef['push'](_0x3f4bef['shift']());}};_0x1989b7(++_0x359a87);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +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(_0x53b625,_0x1cef46){var _0x201d33=function(_0x52c775){while(--_0x52c775){_0x53b625['push'](_0x53b625['shift']());}};_0x201d33(++_0x1cef46);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 ca251f5..f3892d6 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 _0xd110=['sequelize','exports','STRING','TEXT'];(function(_0x307547,_0x1a12bb){var _0x35bee3=function(_0x4d0499){while(--_0x4d0499){_0x307547['push'](_0x307547['shift']());}};_0x35bee3(++_0x1a12bb);}(_0xd110,0x1e8));var _0x0d11=function(_0x11163c,_0xa1514e){_0x11163c=_0x11163c-0x0;var _0x26b991=_0xd110[_0x11163c];return _0x26b991;};'use strict';var Sequelize=require(_0x0d11('0x0'));module[_0x0d11('0x1')]={'name':{'type':Sequelize[_0x0d11('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x0d11('0x2')]},'metric':{'type':Sequelize[_0x0d11('0x3')]},'description':{'type':Sequelize[_0x0d11('0x2')]}}; \ No newline at end of file +var _0x96cc=['TEXT','sequelize','STRING'];(function(_0x5ace25,_0x536239){var _0x4ba17a=function(_0x1ee54e){while(--_0x1ee54e){_0x5ace25['push'](_0x5ace25['shift']());}};_0x4ba17a(++_0x536239);}(_0x96cc,0x16c));var _0xc96c=function(_0x44d4e9,_0x52d710){_0x44d4e9=_0x44d4e9-0x0;var _0x4c9bd2=_0x96cc[_0x44d4e9];return _0x4c9bd2;};'use strict';var Sequelize=require(_0xc96c('0x0'));module['exports']={'name':{'type':Sequelize[_0xc96c('0x1')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xc96c('0x1')]},'metric':{'type':Sequelize[_0xc96c('0x2')]},'description':{'type':Sequelize[_0xc96c('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 877cea9..9cb5bad 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 _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x59517f,_0x5a7789){var _0x10f732=function(_0x125cb6){while(--_0x125cb6){_0x59517f['push'](_0x59517f['shift']());}};_0x10f732(++_0x5a7789);}(_0xe5b3,0x133));var _0x3e5b=function(_0x4af356,_0x298d74){_0x4af356=_0x4af356-0x0;var _0x40566=_0xe5b3[_0x4af356];return _0x40566;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));}; \ No newline at end of file +var _0xabce=['includeAll','rows','show','params','intersection','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','count','offset','Content-Range','apply','reject','save','update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','hasOwnProperty','nolimit','order','filter','merge','VIRTUAL','options'];(function(_0x347ff5,_0x3f21c9){var _0x59756d=function(_0x1a8e6e){while(--_0x1a8e6e){_0x347ff5['push'](_0x347ff5['shift']());}};_0x59756d(++_0x3f21c9);}(_0xabce,0x103));var _0xeabc=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xabce[_0x53cf8e];return _0x459197;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];function respondWithStatusCode(_0x3fd0b5,_0x36a92e){_0x36a92e=_0x36a92e||0xcc;return function(_0xcfbf06){if(_0xcfbf06){return _0x3fd0b5['sendStatus'](_0x36a92e);}return _0x3fd0b5[_0xeabc('0x1a')](_0x36a92e)[_0xeabc('0x1b')]();};}function respondWithResult(_0x3251c6,_0x55f0de){_0x55f0de=_0x55f0de||0xc8;return function(_0x5f4ee8){if(_0x5f4ee8){return _0x3251c6[_0xeabc('0x1a')](_0x55f0de)[_0xeabc('0x1c')](_0x5f4ee8);}};}function respondWithFilteredResult(_0x326bac,_0x53d5cb){return function(_0xf913d7){if(_0xf913d7){var _0x638976=typeof _0x53d5cb['offset']==='undefined'&&typeof _0x53d5cb[_0xeabc('0x1d')]==='undefined';var _0x3d0e21=_0xf913d7[_0xeabc('0x1e')];var _0x58a3c0=_0x638976?0x0:_0x53d5cb[_0xeabc('0x1f')];var _0x31dd53=_0x638976?_0xf913d7[_0xeabc('0x1e')]:_0x53d5cb[_0xeabc('0x1f')]+_0x53d5cb[_0xeabc('0x1d')];var _0x5d92e5;if(_0x31dd53>=_0x3d0e21){_0x31dd53=_0x3d0e21;_0x5d92e5=0xc8;}else{_0x5d92e5=0xce;}_0x326bac[_0xeabc('0x1a')](_0x5d92e5);return _0x326bac['set'](_0xeabc('0x20'),_0x58a3c0+'-'+_0x31dd53+'/'+_0x3d0e21)[_0xeabc('0x1c')](_0xf913d7);}return null;};}function patchUpdates(_0x502947){return function(_0x28063a){try{jsonpatch[_0xeabc('0x21')](_0x28063a,_0x502947,!![]);}catch(_0x254590){return BPromise[_0xeabc('0x22')](_0x254590);}return _0x28063a[_0xeabc('0x23')]();};}function saveUpdates(_0x4e99a4,_0xecdbf){return function(_0x10c675){if(_0x10c675){return _0x10c675[_0xeabc('0x24')](_0x4e99a4)['then'](function(_0x457f27){return _0x457f27;});}return null;};}function removeEntity(_0x3854d2,_0x214953){return function(_0x319119){if(_0x319119){return _0x319119['destroy']()[_0xeabc('0x25')](function(){var _0x480440=_0x319119[_0xeabc('0x26')]({'plain':!![]});var _0x4d4e29=_0xeabc('0x27');return db[_0xeabc('0x28')][_0xeabc('0x29')]({'where':{'type':_0x4d4e29,'resourceId':_0x480440['id']}})[_0xeabc('0x25')](function(){return _0x319119;});})[_0xeabc('0x25')](function(){_0x3854d2[_0xeabc('0x1a')](0xcc)[_0xeabc('0x1b')]();});}};}function handleEntityNotFound(_0x4c2693,_0x5b2934){return function(_0x459c8a){if(!_0x459c8a){_0x4c2693['sendStatus'](0x194);}return _0x459c8a;};}function handleError(_0x3c1b5b,_0x2b342c){_0x2b342c=_0x2b342c||0x1f4;return function(_0x48fb52){logger[_0xeabc('0x2a')](_0x48fb52[_0xeabc('0x2b')]);if(_0x48fb52[_0xeabc('0x2c')]){delete _0x48fb52[_0xeabc('0x2c')];}_0x3c1b5b[_0xeabc('0x1a')](_0x2b342c)[_0xeabc('0x2d')](_0x48fb52);};}exports[_0xeabc('0x2e')]=function(_0x38dc0a,_0x2915c1){var _0x5ebb86={},_0x5b34dd={},_0x5bb1f1={'count':0x0,'rows':[]};var _0x2f03e8=_[_0xeabc('0x2f')](db[_0xeabc('0x30')][_0xeabc('0x31')],function(_0x73c8d4){return{'name':_0x73c8d4[_0xeabc('0x32')],'type':_0x73c8d4[_0xeabc('0x33')]['key']};});_0x5b34dd[_0xeabc('0x34')]=_[_0xeabc('0x2f')](_0x2f03e8,_0xeabc('0x2c'));_0x5b34dd['query']=_[_0xeabc('0x35')](_0x38dc0a[_0xeabc('0x36')]);_0x5b34dd[_0xeabc('0x37')]=_['intersection'](_0x5b34dd[_0xeabc('0x34')],_0x5b34dd[_0xeabc('0x36')]);_0x5ebb86[_0xeabc('0x38')]=_['intersection'](_0x5b34dd[_0xeabc('0x34')],qs[_0xeabc('0x39')](_0x38dc0a['query']['fields']));_0x5ebb86[_0xeabc('0x38')]=_0x5ebb86[_0xeabc('0x38')]['length']?_0x5ebb86[_0xeabc('0x38')]:_0x5b34dd[_0xeabc('0x34')];if(!_0x38dc0a[_0xeabc('0x36')][_0xeabc('0x3a')](_0xeabc('0x3b'))){_0x5ebb86['limit']=qs[_0xeabc('0x1d')](_0x38dc0a['query'][_0xeabc('0x1d')]);_0x5ebb86[_0xeabc('0x1f')]=qs[_0xeabc('0x1f')](_0x38dc0a['query']['offset']);}_0x5ebb86[_0xeabc('0x3c')]=qs['sort'](_0x38dc0a[_0xeabc('0x36')]['sort']);_0x5ebb86['where']=qs['filters'](_['pick'](_0x38dc0a[_0xeabc('0x36')],_0x5b34dd['filters']),_0x2f03e8);if(_0x38dc0a[_0xeabc('0x36')][_0xeabc('0x3d')]){_0x5ebb86['where']=_[_0xeabc('0x3e')](_0x5ebb86['where'],{'$or':_[_0xeabc('0x2f')](_0x2f03e8,function(_0x58aafe){if(_0x58aafe[_0xeabc('0x33')]!==_0xeabc('0x3f')){var _0xeeef02={};_0xeeef02[_0x58aafe['name']]={'$like':'%'+_0x38dc0a['query']['filter']+'%'};return _0xeeef02;}})});}_0x5ebb86=_[_0xeabc('0x3e')]({},_0x5ebb86,_0x38dc0a[_0xeabc('0x40')]);var _0xafa59b={'where':_0x5ebb86['where']};return db['AnalyticMetric'][_0xeabc('0x1e')](_0xafa59b)[_0xeabc('0x25')](function(_0x5e9cb3){_0x5bb1f1[_0xeabc('0x1e')]=_0x5e9cb3;if(_0x38dc0a['query'][_0xeabc('0x41')]){_0x5ebb86['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x5ebb86);})[_0xeabc('0x25')](function(_0x37c926){_0x5bb1f1[_0xeabc('0x42')]=_0x37c926;return _0x5bb1f1;})[_0xeabc('0x25')](respondWithFilteredResult(_0x2915c1,_0x5ebb86))['catch'](handleError(_0x2915c1,null));};exports[_0xeabc('0x43')]=function(_0x555d26,_0x7d5add){var _0x1a4bbe={'raw':!![],'where':{'id':_0x555d26[_0xeabc('0x44')]['id']}},_0x3a7807={};_0x3a7807[_0xeabc('0x34')]=_['keys'](db['AnalyticMetric'][_0xeabc('0x31')]);_0x3a7807['query']=_[_0xeabc('0x35')](_0x555d26[_0xeabc('0x36')]);_0x3a7807['filters']=_[_0xeabc('0x45')](_0x3a7807[_0xeabc('0x34')],_0x3a7807[_0xeabc('0x36')]);_0x1a4bbe[_0xeabc('0x38')]=_[_0xeabc('0x45')](_0x3a7807[_0xeabc('0x34')],qs[_0xeabc('0x39')](_0x555d26['query'][_0xeabc('0x39')]));_0x1a4bbe[_0xeabc('0x38')]=_0x1a4bbe[_0xeabc('0x38')][_0xeabc('0x46')]?_0x1a4bbe[_0xeabc('0x38')]:_0x3a7807[_0xeabc('0x34')];if(_0x555d26[_0xeabc('0x36')][_0xeabc('0x41')]){_0x1a4bbe[_0xeabc('0x47')]=[{'all':!![]}];}_0x1a4bbe=_[_0xeabc('0x3e')]({},_0x1a4bbe,_0x555d26['options']);return db[_0xeabc('0x30')][_0xeabc('0x48')](_0x1a4bbe)[_0xeabc('0x25')](handleEntityNotFound(_0x7d5add,null))[_0xeabc('0x25')](respondWithResult(_0x7d5add,null))[_0xeabc('0x49')](handleError(_0x7d5add,null));};exports[_0xeabc('0x4a')]=function(_0x268d95,_0x48df43){return db[_0xeabc('0x30')][_0xeabc('0x4a')](_0x268d95[_0xeabc('0x4b')],{})[_0xeabc('0x25')](function(_0x47440e){var _0x58e2c1=_0x268d95[_0xeabc('0x4c')][_0xeabc('0x26')]({'plain':!![]});if(!_0x58e2c1)throw new Error(_0xeabc('0x4d'));if(_0x58e2c1[_0xeabc('0x4e')]==='user'){var _0x400b82=_0x47440e[_0xeabc('0x26')]({'plain':!![]});var _0x568847=_0xeabc('0x27');return db['UserProfileSection'][_0xeabc('0x48')]({'where':{'name':_0x568847,'userProfileId':_0x58e2c1['userProfileId']},'raw':!![]})[_0xeabc('0x25')](function(_0x2ec94c){if(_0x2ec94c&&_0x2ec94c[_0xeabc('0x4f')]===0x0){return db[_0xeabc('0x28')][_0xeabc('0x4a')]({'name':_0x400b82[_0xeabc('0x2c')],'resourceId':_0x400b82['id'],'type':_0x2ec94c[_0xeabc('0x2c')],'sectionId':_0x2ec94c['id']},{})[_0xeabc('0x25')](function(){return _0x47440e;});}else{return _0x47440e;}})[_0xeabc('0x49')](function(_0x6423f3){logger['error'](_0xeabc('0x50'),_0x6423f3);throw _0x6423f3;});}return _0x47440e;})[_0xeabc('0x25')](respondWithResult(_0x48df43,0xc9))[_0xeabc('0x49')](handleError(_0x48df43,null));};exports[_0xeabc('0x24')]=function(_0x555d6b,_0x1cef45){if(_0x555d6b[_0xeabc('0x4b')]['id']){delete _0x555d6b[_0xeabc('0x4b')]['id'];}return db[_0xeabc('0x30')]['find']({'where':{'id':_0x555d6b[_0xeabc('0x44')]['id']}})[_0xeabc('0x25')](handleEntityNotFound(_0x1cef45,null))[_0xeabc('0x25')](saveUpdates(_0x555d6b[_0xeabc('0x4b')],null))[_0xeabc('0x25')](respondWithResult(_0x1cef45,null))[_0xeabc('0x49')](handleError(_0x1cef45,null));};exports[_0xeabc('0x29')]=function(_0x3ff38c,_0x17acf8){return db['AnalyticMetric'][_0xeabc('0x48')]({'where':{'id':_0x3ff38c['params']['id']}})['then'](handleEntityNotFound(_0x17acf8,null))['then'](removeEntity(_0x17acf8,null))[_0xeabc('0x49')](handleError(_0x17acf8,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 8118890..b4e9e26 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 _0x280b=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','lodash','util'];(function(_0x27236c,_0x4e81b6){var _0x325d41=function(_0x355313){while(--_0x355313){_0x27236c['push'](_0x27236c['shift']());}};_0x325d41(++_0x4e81b6);}(_0x280b,0xce));var _0xb280=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x280b[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0xb280('0x0'));var util=require(_0xb280('0x1'));var logger=require('../../config/logger')(_0xb280('0x2'));var moment=require(_0xb280('0x3'));var BPromise=require(_0xb280('0x4'));var rp=require(_0xb280('0x5'));var fs=require('fs');var path=require(_0xb280('0x6'));var rimraf=require(_0xb280('0x7'));var config=require(_0xb280('0x8'));var attributes=require(_0xb280('0x9'));module[_0xb280('0xa')]=function(_0x5d1991,_0x4d1b2e){return _0x5d1991[_0xb280('0xb')](_0xb280('0xc'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06f4=['lodash','util','api','moment','path','../../config/environment','./analyticMetric.attributes','exports','define','analytics_metrics'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x06f4,0x136));var _0x406f=function(_0x555e42,_0x89260a){_0x555e42=_0x555e42-0x0;var _0x1ec74e=_0x06f4[_0x555e42];return _0x1ec74e;};'use strict';var _=require(_0x406f('0x0'));var util=require(_0x406f('0x1'));var logger=require('../../config/logger')(_0x406f('0x2'));var moment=require(_0x406f('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x406f('0x4'));var rimraf=require('rimraf');var config=require(_0x406f('0x5'));var attributes=require(_0x406f('0x6'));module[_0x406f('0x7')]=function(_0x32b2bd,_0x59821c){return _0x32b2bd[_0x406f('0x8')]('AnalyticMetric',attributes,{'tableName':_0x406f('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 81e6198..18248a2 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 _0xaed1=['then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x1ac120,_0x3e7e45){var _0x19b703=function(_0x5f32cb){while(--_0x5f32cb){_0x1ac120['push'](_0x1ac120['shift']());}};_0x19b703(++_0x3e7e45);}(_0xaed1,0x135));var _0x1aed=function(_0x384b64,_0x4f0784){_0x384b64=_0x384b64-0x0;var _0x3a8f2c=_0xaed1[_0x384b64];return _0x3a8f2c;};'use strict';var _=require('lodash');var util=require(_0x1aed('0x0'));var moment=require(_0x1aed('0x1'));var BPromise=require(_0x1aed('0x2'));var rs=require(_0x1aed('0x3'));var fs=require('fs');var Redis=require(_0x1aed('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1aed('0x5'));var logger=require(_0x1aed('0x6'))(_0x1aed('0x7'));var config=require(_0x1aed('0x8'));var jayson=require(_0x1aed('0x9'));var client=jayson[_0x1aed('0xa')][_0x1aed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cf800,_0x23db52,_0x43af06){return new BPromise(function(_0x181b62,_0x26bfdb){return client[_0x1aed('0xc')](_0x4cf800,_0x43af06)[_0x1aed('0xd')](function(_0x2d7e41){logger[_0x1aed('0xe')](_0x1aed('0xf'),_0x23db52,_0x1aed('0x10'));logger[_0x1aed('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x23db52,_0x1aed('0x10'),JSON[_0x1aed('0x12')](_0x2d7e41));if(_0x2d7e41['error']){if(_0x2d7e41[_0x1aed('0x13')][_0x1aed('0x14')]===0x1f4){logger[_0x1aed('0x13')](_0x1aed('0xf'),_0x23db52,_0x2d7e41[_0x1aed('0x13')]['message']);return _0x26bfdb(_0x2d7e41['error']['message']);}logger[_0x1aed('0x13')](_0x1aed('0xf'),_0x23db52,_0x2d7e41['error']['message']);return _0x181b62(_0x2d7e41[_0x1aed('0x13')][_0x1aed('0x15')]);}else{logger[_0x1aed('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x23db52,_0x1aed('0x10'));_0x181b62(_0x2d7e41[_0x1aed('0x16')][_0x1aed('0x15')]);}})['catch'](function(_0x51d0b9){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x23db52,_0x51d0b9);_0x26bfdb(_0x51d0b9);});});} \ No newline at end of file +var _0x4953=['lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticMetric,\x20%s,\x20%s','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4953,0x104));var _0x3495=function(_0x4eb48b,_0x4f3eb1){_0x4eb48b=_0x4eb48b-0x0;var _0x4f5180=_0x4953[_0x4eb48b];return _0x4f5180;};'use strict';var _=require(_0x3495('0x0'));var util=require(_0x3495('0x1'));var moment=require(_0x3495('0x2'));var BPromise=require('bluebird');var rs=require(_0x3495('0x3'));var fs=require('fs');var Redis=require(_0x3495('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3495('0x5'));var config=require(_0x3495('0x6'));var jayson=require(_0x3495('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x473205,_0x54c927,_0x4953ff){return new BPromise(function(_0x5e60af,_0x1baa0a){return client['request'](_0x473205,_0x4953ff)[_0x3495('0x8')](function(_0x327a22){logger[_0x3495('0x9')]('AnalyticMetric,\x20%s,\x20%s',_0x54c927,_0x3495('0xa'));logger[_0x3495('0xb')](_0x3495('0xc'),_0x54c927,_0x3495('0xa'),JSON[_0x3495('0xd')](_0x327a22));if(_0x327a22[_0x3495('0xe')]){if(_0x327a22[_0x3495('0xe')][_0x3495('0xf')]===0x1f4){logger[_0x3495('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x54c927,_0x327a22['error'][_0x3495('0x10')]);return _0x1baa0a(_0x327a22[_0x3495('0xe')][_0x3495('0x10')]);}logger[_0x3495('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x54c927,_0x327a22[_0x3495('0xe')]['message']);return _0x5e60af(_0x327a22[_0x3495('0xe')]['message']);}else{logger['info'](_0x3495('0x11'),_0x54c927,_0x3495('0xa'));_0x5e60af(_0x327a22[_0x3495('0x12')][_0x3495('0x10')]);}})[_0x3495('0x13')](function(_0x254cb2){logger[_0x3495('0xe')](_0x3495('0x11'),_0x54c927,_0x254cb2);_0x1baa0a(_0x254cb2);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 53f3592..e0a5db8 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 _0x0958=['create','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x4e468f,_0x1489a2){var _0x32edaf=function(_0x2e8cf3){while(--_0x2e8cf3){_0x4e468f['push'](_0x4e468f['shift']());}};_0x32edaf(++_0x1489a2);}(_0x0958,0x7c));var _0x8095=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0958[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x8095('0x0'));var util=require(_0x8095('0x1'));var path=require(_0x8095('0x2'));var timeout=require('connect-timeout');var express=require(_0x8095('0x3'));var router=express[_0x8095('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8095('0x5'));var config=require(_0x8095('0x6'));var controller=require('./analyticMetric.controller');router['get']('/',auth[_0x8095('0x7')](),controller[_0x8095('0x8')]);router[_0x8095('0x9')](_0x8095('0xa'),auth[_0x8095('0x7')](),controller['show']);router['post']('/',auth[_0x8095('0x7')](),controller[_0x8095('0xb')]);router['put']('/:id',auth[_0x8095('0x7')](),controller['update']);router[_0x8095('0xc')](_0x8095('0xa'),auth[_0x8095('0x7')](),controller[_0x8095('0xd')]);module[_0x8095('0xe')]=router; \ No newline at end of file +var _0xee14=['get','/:id','show','post','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated'];(function(_0x261b8a,_0x553ec4){var _0x3455e8=function(_0xdf10d4){while(--_0xdf10d4){_0x261b8a['push'](_0x261b8a['shift']());}};_0x3455e8(++_0x553ec4);}(_0xee14,0x13a));var _0x4ee1=function(_0x32b25e,_0x5cb3f9){_0x32b25e=_0x32b25e-0x0;var _0x2acbc7=_0xee14[_0x32b25e];return _0x2acbc7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4ee1('0x0'));var timeout=require(_0x4ee1('0x1'));var express=require(_0x4ee1('0x2'));var router=express[_0x4ee1('0x3')]();var fs_extra=require(_0x4ee1('0x4'));var auth=require(_0x4ee1('0x5'));var interaction=require(_0x4ee1('0x6'));var config=require(_0x4ee1('0x7'));var controller=require(_0x4ee1('0x8'));router['get']('/',auth[_0x4ee1('0x9')](),controller['index']);router[_0x4ee1('0xa')](_0x4ee1('0xb'),auth[_0x4ee1('0x9')](),controller[_0x4ee1('0xc')]);router[_0x4ee1('0xd')]('/',auth[_0x4ee1('0x9')](),controller['create']);router[_0x4ee1('0xe')](_0x4ee1('0xb'),auth['isAuthenticated'](),controller[_0x4ee1('0xf')]);router[_0x4ee1('0x10')](_0x4ee1('0xb'),auth[_0x4ee1('0x9')](),controller['destroy']);module[_0x4ee1('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 f04335d..abc92ca 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 _0x8002=['TEXT','sequelize','exports'];(function(_0x225f50,_0x48a77d){var _0x19d003=function(_0x58965d){while(--_0x58965d){_0x225f50['push'](_0x225f50['shift']());}};_0x19d003(++_0x48a77d);}(_0x8002,0xa0));var _0x2800=function(_0x4f6f0b,_0xc26047){_0x4f6f0b=_0x4f6f0b-0x0;var _0x518ed2=_0x8002[_0x4f6f0b];return _0x518ed2;};'use strict';var Sequelize=require(_0x2800('0x0'));module[_0x2800('0x1')]={'tree':{'type':Sequelize[_0x2800('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb30b=['exports','TEXT'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xb30b,0xf4));var _0xbb30=function(_0x2e0938,_0x2e20f0){_0x2e0938=_0x2e0938-0x0;var _0x1691d3=_0xb30b[_0x2e0938];return _0x1691d3;};'use strict';var Sequelize=require('sequelize');module[_0xbb30('0x0')]={'tree':{'type':Sequelize[_0xbb30('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index fa8622f..ed8e07f 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 _0x4a00=['update','then','destroy','error','name','send','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','include','findAll','rows','params','includeAll','merge','options','create','body','catch','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x53d5c6,_0x4cbc4d){var _0xd6e91a=function(_0x517a2f){while(--_0x517a2f){_0x53d5c6['push'](_0x53d5c6['shift']());}};_0xd6e91a(++_0x4cbc4d);}(_0x4a00,0x192));var _0x04a0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4a00[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x04a0('0x0'));var zipdir=require(_0x04a0('0x1'));var jsonpatch=require(_0x04a0('0x2'));var rp=require(_0x04a0('0x3'));var moment=require('moment');var BPromise=require(_0x04a0('0x4'));var Mustache=require(_0x04a0('0x5'));var util=require(_0x04a0('0x6'));var path=require(_0x04a0('0x7'));var sox=require(_0x04a0('0x8'));var csv=require(_0x04a0('0x9'));var ejs=require(_0x04a0('0xa'));var fs=require('fs');var fs_extra=require(_0x04a0('0xb'));var _=require(_0x04a0('0xc'));var squel=require(_0x04a0('0xd'));var crypto=require(_0x04a0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x04a0('0xf'));var toCsv=require(_0x04a0('0x9'));var querystring=require(_0x04a0('0x10'));var Papa=require(_0x04a0('0x11'));var Redis=require(_0x04a0('0x12'));var authService=require(_0x04a0('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x04a0('0x14'));var config=require(_0x04a0('0x15'));var licenseUtil=require(_0x04a0('0x16'));var db=require(_0x04a0('0x17'))['db'];function respondWithStatusCode(_0x54d360,_0x4280c8){_0x4280c8=_0x4280c8||0xcc;return function(_0xd3bc9b){if(_0xd3bc9b){return _0x54d360[_0x04a0('0x18')](_0x4280c8);}return _0x54d360[_0x04a0('0x19')](_0x4280c8)['end']();};}function respondWithResult(_0x20d3ab,_0x286aa4){_0x286aa4=_0x286aa4||0xc8;return function(_0x2454cb){if(_0x2454cb){return _0x20d3ab[_0x04a0('0x19')](_0x286aa4)[_0x04a0('0x1a')](_0x2454cb);}};}function respondWithFilteredResult(_0x3d4036,_0x1d9261){return function(_0x540702){if(_0x540702){var _0x83546=typeof _0x1d9261[_0x04a0('0x1b')]===_0x04a0('0x1c')&&typeof _0x1d9261[_0x04a0('0x1d')]===_0x04a0('0x1c');var _0x367915=_0x540702[_0x04a0('0x1e')];var _0x318b8a=_0x83546?0x0:_0x1d9261[_0x04a0('0x1b')];var _0x3883a5=_0x83546?_0x540702['count']:_0x1d9261[_0x04a0('0x1b')]+_0x1d9261['limit'];var _0x4515fd;if(_0x3883a5>=_0x367915){_0x3883a5=_0x367915;_0x4515fd=0xc8;}else{_0x4515fd=0xce;}_0x3d4036[_0x04a0('0x19')](_0x4515fd);return _0x3d4036[_0x04a0('0x1f')](_0x04a0('0x20'),_0x318b8a+'-'+_0x3883a5+'/'+_0x367915)[_0x04a0('0x1a')](_0x540702);}return null;};}function patchUpdates(_0x50847e){return function(_0x5d8dda){try{jsonpatch[_0x04a0('0x21')](_0x5d8dda,_0x50847e,!![]);}catch(_0x18693a){return BPromise[_0x04a0('0x22')](_0x18693a);}return _0x5d8dda[_0x04a0('0x23')]();};}function saveUpdates(_0x33163a,_0x54bae0){return function(_0x213295){if(_0x213295){return _0x213295[_0x04a0('0x24')](_0x33163a)[_0x04a0('0x25')](function(_0x4a5e83){return _0x4a5e83;});}return null;};}function removeEntity(_0x454b15,_0x406aae){return function(_0x4a9f67){if(_0x4a9f67){return _0x4a9f67[_0x04a0('0x26')]()[_0x04a0('0x25')](function(){_0x454b15['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x45eb59,_0x5be87d){return function(_0x2bd02a){if(!_0x2bd02a){_0x45eb59[_0x04a0('0x18')](0x194);}return _0x2bd02a;};}function handleError(_0x5a15ba,_0x164636){_0x164636=_0x164636||0x1f4;return function(_0x45c350){logger[_0x04a0('0x27')](_0x45c350['stack']);if(_0x45c350[_0x04a0('0x28')]){delete _0x45c350['name'];}_0x5a15ba[_0x04a0('0x19')](_0x164636)[_0x04a0('0x29')](_0x45c350);};}exports['index']=function(_0x269752,_0x209ba3){var _0x2bd19f={},_0xf8ba1d={},_0x4160fa={'count':0x0,'rows':[]};var _0x15d509=_[_0x04a0('0x2a')](db[_0x04a0('0x2b')][_0x04a0('0x2c')],function(_0x5b9d15){return{'name':_0x5b9d15[_0x04a0('0x2d')],'type':_0x5b9d15[_0x04a0('0x2e')][_0x04a0('0x2f')]};});_0xf8ba1d[_0x04a0('0x30')]=_[_0x04a0('0x2a')](_0x15d509,_0x04a0('0x28'));_0xf8ba1d['query']=_[_0x04a0('0x31')](_0x269752[_0x04a0('0x32')]);_0xf8ba1d[_0x04a0('0x33')]=_['intersection'](_0xf8ba1d['model'],_0xf8ba1d[_0x04a0('0x32')]);_0x2bd19f[_0x04a0('0x34')]=_[_0x04a0('0x35')](_0xf8ba1d[_0x04a0('0x30')],qs[_0x04a0('0x36')](_0x269752[_0x04a0('0x32')]['fields']));_0x2bd19f['attributes']=_0x2bd19f[_0x04a0('0x34')][_0x04a0('0x37')]?_0x2bd19f[_0x04a0('0x34')]:_0xf8ba1d[_0x04a0('0x30')];if(!_0x269752['query'][_0x04a0('0x38')](_0x04a0('0x39'))){_0x2bd19f[_0x04a0('0x1d')]=qs[_0x04a0('0x1d')](_0x269752[_0x04a0('0x32')][_0x04a0('0x1d')]);_0x2bd19f[_0x04a0('0x1b')]=qs[_0x04a0('0x1b')](_0x269752[_0x04a0('0x32')][_0x04a0('0x1b')]);}_0x2bd19f[_0x04a0('0x3a')]=qs[_0x04a0('0x3b')](_0x269752['query']['sort']);_0x2bd19f[_0x04a0('0x3c')]=qs[_0x04a0('0x33')](_[_0x04a0('0x3d')](_0x269752[_0x04a0('0x32')],_0xf8ba1d['filters']),_0x15d509);if(_0x269752['query'][_0x04a0('0x3e')]){_0x2bd19f['where']=_['merge'](_0x2bd19f['where'],{'$or':_['map'](_0x15d509,function(_0x1707fb){if(_0x1707fb[_0x04a0('0x2e')]!=='VIRTUAL'){var _0x5207a9={};_0x5207a9[_0x1707fb[_0x04a0('0x28')]]={'$like':'%'+_0x269752[_0x04a0('0x32')][_0x04a0('0x3e')]+'%'};return _0x5207a9;}})});}_0x2bd19f=_['merge']({},_0x2bd19f,_0x269752['options']);var _0x2262d4={'where':_0x2bd19f[_0x04a0('0x3c')]};return db[_0x04a0('0x2b')][_0x04a0('0x1e')](_0x2262d4)[_0x04a0('0x25')](function(_0x1dcd2){_0x4160fa[_0x04a0('0x1e')]=_0x1dcd2;if(_0x269752[_0x04a0('0x32')]['includeAll']){_0x2bd19f[_0x04a0('0x3f')]=[{'all':!![]}];}return db[_0x04a0('0x2b')][_0x04a0('0x40')](_0x2bd19f);})['then'](function(_0x43a21a){_0x4160fa[_0x04a0('0x41')]=_0x43a21a;return _0x4160fa;})['then'](respondWithFilteredResult(_0x209ba3,_0x2bd19f))['catch'](handleError(_0x209ba3,null));};exports['show']=function(_0x2015eb,_0x4f54fe){var _0x197802={'raw':!![],'where':{'id':_0x2015eb[_0x04a0('0x42')]['id']}},_0x11e212={};_0x11e212['model']=_[_0x04a0('0x31')](db['AnalyticTreeReport'][_0x04a0('0x2c')]);_0x11e212['query']=_[_0x04a0('0x31')](_0x2015eb['query']);_0x11e212[_0x04a0('0x33')]=_[_0x04a0('0x35')](_0x11e212[_0x04a0('0x30')],_0x11e212[_0x04a0('0x32')]);_0x197802[_0x04a0('0x34')]=_[_0x04a0('0x35')](_0x11e212['model'],qs[_0x04a0('0x36')](_0x2015eb[_0x04a0('0x32')][_0x04a0('0x36')]));_0x197802['attributes']=_0x197802['attributes'][_0x04a0('0x37')]?_0x197802[_0x04a0('0x34')]:_0x11e212[_0x04a0('0x30')];if(_0x2015eb[_0x04a0('0x32')][_0x04a0('0x43')]){_0x197802['include']=[{'all':!![]}];}_0x197802=_[_0x04a0('0x44')]({},_0x197802,_0x2015eb[_0x04a0('0x45')]);return db[_0x04a0('0x2b')]['find'](_0x197802)[_0x04a0('0x25')](handleEntityNotFound(_0x4f54fe,null))[_0x04a0('0x25')](respondWithResult(_0x4f54fe,null))['catch'](handleError(_0x4f54fe,null));};exports['create']=function(_0x42c273,_0x3b5125){return db['AnalyticTreeReport'][_0x04a0('0x46')](_0x42c273[_0x04a0('0x47')],{})['then'](respondWithResult(_0x3b5125,0xc9))[_0x04a0('0x48')](handleError(_0x3b5125,null));};exports[_0x04a0('0x24')]=function(_0x44c38c,_0x17f739){if(_0x44c38c[_0x04a0('0x47')]['id']){delete _0x44c38c[_0x04a0('0x47')]['id'];}return db[_0x04a0('0x2b')]['find']({'where':{'id':_0x44c38c[_0x04a0('0x42')]['id']}})[_0x04a0('0x25')](handleEntityNotFound(_0x17f739,null))[_0x04a0('0x25')](saveUpdates(_0x44c38c[_0x04a0('0x47')],null))[_0x04a0('0x25')](respondWithResult(_0x17f739,null))[_0x04a0('0x48')](handleError(_0x17f739,null));};exports[_0x04a0('0x26')]=function(_0x3cba97,_0x93bc1d){return db[_0x04a0('0x2b')]['find']({'where':{'id':_0x3cba97[_0x04a0('0x42')]['id']}})[_0x04a0('0x25')](handleEntityNotFound(_0x93bc1d,null))[_0x04a0('0x25')](removeEntity(_0x93bc1d,null))[_0x04a0('0x48')](handleError(_0x93bc1d,null));}; \ No newline at end of file +var _0x5a19=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','options','includeAll','findAll','rows','catch','params','include','find','create','body','update','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','model','query','keys'];(function(_0x3ad102,_0x59058a){var _0x279219=function(_0x450267){while(--_0x450267){_0x3ad102['push'](_0x3ad102['shift']());}};_0x279219(++_0x59058a);}(_0x5a19,0xf1));var _0x95a1=function(_0x4d5d0a,_0x4148dd){_0x4d5d0a=_0x4d5d0a-0x0;var _0x502c59=_0x5a19[_0x4d5d0a];return _0x502c59;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x95a1('0x0'));var rp=require(_0x95a1('0x1'));var moment=require(_0x95a1('0x2'));var BPromise=require(_0x95a1('0x3'));var Mustache=require(_0x95a1('0x4'));var util=require('util');var path=require(_0x95a1('0x5'));var sox=require(_0x95a1('0x6'));var csv=require(_0x95a1('0x7'));var ejs=require(_0x95a1('0x8'));var fs=require('fs');var fs_extra=require(_0x95a1('0x9'));var _=require(_0x95a1('0xa'));var squel=require(_0x95a1('0xb'));var crypto=require(_0x95a1('0xc'));var jsforce=require(_0x95a1('0xd'));var deskjs=require(_0x95a1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x95a1('0xf'));var Papa=require('papaparse');var Redis=require(_0x95a1('0x10'));var authService=require(_0x95a1('0x11'));var qs=require(_0x95a1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x95a1('0x13'));var logger=require('../../config/logger')(_0x95a1('0x14'));var utils=require(_0x95a1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x95a1('0x16'));var db=require(_0x95a1('0x17'))['db'];function respondWithStatusCode(_0x59c259,_0x5c2146){_0x5c2146=_0x5c2146||0xcc;return function(_0x31abe8){if(_0x31abe8){return _0x59c259[_0x95a1('0x18')](_0x5c2146);}return _0x59c259[_0x95a1('0x19')](_0x5c2146)[_0x95a1('0x1a')]();};}function respondWithResult(_0x4a92af,_0x39d196){_0x39d196=_0x39d196||0xc8;return function(_0x44bbb3){if(_0x44bbb3){return _0x4a92af[_0x95a1('0x19')](_0x39d196)['json'](_0x44bbb3);}};}function respondWithFilteredResult(_0x3fd668,_0x1591c3){return function(_0x188bb0){if(_0x188bb0){var _0x360f77=typeof _0x1591c3[_0x95a1('0x1b')]===_0x95a1('0x1c')&&typeof _0x1591c3[_0x95a1('0x1d')]==='undefined';var _0x1efa32=_0x188bb0[_0x95a1('0x1e')];var _0x461f0a=_0x360f77?0x0:_0x1591c3[_0x95a1('0x1b')];var _0x698f0e=_0x360f77?_0x188bb0['count']:_0x1591c3[_0x95a1('0x1b')]+_0x1591c3[_0x95a1('0x1d')];var _0x431c71;if(_0x698f0e>=_0x1efa32){_0x698f0e=_0x1efa32;_0x431c71=0xc8;}else{_0x431c71=0xce;}_0x3fd668['status'](_0x431c71);return _0x3fd668[_0x95a1('0x1f')](_0x95a1('0x20'),_0x461f0a+'-'+_0x698f0e+'/'+_0x1efa32)['json'](_0x188bb0);}return null;};}function patchUpdates(_0x558c16){return function(_0x43b964){try{jsonpatch[_0x95a1('0x21')](_0x43b964,_0x558c16,!![]);}catch(_0xaed437){return BPromise['reject'](_0xaed437);}return _0x43b964[_0x95a1('0x22')]();};}function saveUpdates(_0x34d696,_0x3ba06f){return function(_0x2c2723){if(_0x2c2723){return _0x2c2723['update'](_0x34d696)[_0x95a1('0x23')](function(_0x5a03df){return _0x5a03df;});}return null;};}function removeEntity(_0x5a75d5,_0x19cbf7){return function(_0x29a970){if(_0x29a970){return _0x29a970[_0x95a1('0x24')]()[_0x95a1('0x23')](function(){_0x5a75d5['status'](0xcc)[_0x95a1('0x1a')]();});}};}function handleEntityNotFound(_0x18a825,_0x45d8b1){return function(_0x300095){if(!_0x300095){_0x18a825[_0x95a1('0x18')](0x194);}return _0x300095;};}function handleError(_0x1cc292,_0x79e128){_0x79e128=_0x79e128||0x1f4;return function(_0x4a6d5e){logger[_0x95a1('0x25')](_0x4a6d5e[_0x95a1('0x26')]);if(_0x4a6d5e[_0x95a1('0x27')]){delete _0x4a6d5e[_0x95a1('0x27')];}_0x1cc292['status'](_0x79e128)[_0x95a1('0x28')](_0x4a6d5e);};}exports[_0x95a1('0x29')]=function(_0x2bf9dc,_0x21bef0){var _0x13ec8c={},_0x4d8e7b={},_0x4e1a76={'count':0x0,'rows':[]};var _0x4bbc11=_['map'](db[_0x95a1('0x2a')][_0x95a1('0x2b')],function(_0x16d447){return{'name':_0x16d447['fieldName'],'type':_0x16d447['type']['key']};});_0x4d8e7b[_0x95a1('0x2c')]=_['map'](_0x4bbc11,_0x95a1('0x27'));_0x4d8e7b[_0x95a1('0x2d')]=_[_0x95a1('0x2e')](_0x2bf9dc[_0x95a1('0x2d')]);_0x4d8e7b[_0x95a1('0x2f')]=_[_0x95a1('0x30')](_0x4d8e7b[_0x95a1('0x2c')],_0x4d8e7b[_0x95a1('0x2d')]);_0x13ec8c['attributes']=_[_0x95a1('0x30')](_0x4d8e7b[_0x95a1('0x2c')],qs[_0x95a1('0x31')](_0x2bf9dc[_0x95a1('0x2d')][_0x95a1('0x31')]));_0x13ec8c[_0x95a1('0x32')]=_0x13ec8c[_0x95a1('0x32')][_0x95a1('0x33')]?_0x13ec8c[_0x95a1('0x32')]:_0x4d8e7b[_0x95a1('0x2c')];if(!_0x2bf9dc[_0x95a1('0x2d')][_0x95a1('0x34')](_0x95a1('0x35'))){_0x13ec8c['limit']=qs['limit'](_0x2bf9dc[_0x95a1('0x2d')][_0x95a1('0x1d')]);_0x13ec8c[_0x95a1('0x1b')]=qs[_0x95a1('0x1b')](_0x2bf9dc[_0x95a1('0x2d')][_0x95a1('0x1b')]);}_0x13ec8c[_0x95a1('0x36')]=qs[_0x95a1('0x37')](_0x2bf9dc[_0x95a1('0x2d')]['sort']);_0x13ec8c['where']=qs['filters'](_[_0x95a1('0x38')](_0x2bf9dc[_0x95a1('0x2d')],_0x4d8e7b['filters']),_0x4bbc11);if(_0x2bf9dc[_0x95a1('0x2d')][_0x95a1('0x39')]){_0x13ec8c[_0x95a1('0x3a')]=_[_0x95a1('0x3b')](_0x13ec8c[_0x95a1('0x3a')],{'$or':_['map'](_0x4bbc11,function(_0x2772b5){if(_0x2772b5[_0x95a1('0x3c')]!=='VIRTUAL'){var _0x32eac0={};_0x32eac0[_0x2772b5[_0x95a1('0x27')]]={'$like':'%'+_0x2bf9dc[_0x95a1('0x2d')][_0x95a1('0x39')]+'%'};return _0x32eac0;}})});}_0x13ec8c=_[_0x95a1('0x3b')]({},_0x13ec8c,_0x2bf9dc[_0x95a1('0x3d')]);var _0xe24899={'where':_0x13ec8c[_0x95a1('0x3a')]};return db[_0x95a1('0x2a')][_0x95a1('0x1e')](_0xe24899)['then'](function(_0x2e58ce){_0x4e1a76[_0x95a1('0x1e')]=_0x2e58ce;if(_0x2bf9dc[_0x95a1('0x2d')][_0x95a1('0x3e')]){_0x13ec8c['include']=[{'all':!![]}];}return db[_0x95a1('0x2a')][_0x95a1('0x3f')](_0x13ec8c);})[_0x95a1('0x23')](function(_0x524901){_0x4e1a76[_0x95a1('0x40')]=_0x524901;return _0x4e1a76;})[_0x95a1('0x23')](respondWithFilteredResult(_0x21bef0,_0x13ec8c))[_0x95a1('0x41')](handleError(_0x21bef0,null));};exports['show']=function(_0x111861,_0x216a33){var _0x1ea231={'raw':!![],'where':{'id':_0x111861[_0x95a1('0x42')]['id']}},_0x2b3d52={};_0x2b3d52[_0x95a1('0x2c')]=_[_0x95a1('0x2e')](db['AnalyticTreeReport']['rawAttributes']);_0x2b3d52[_0x95a1('0x2d')]=_[_0x95a1('0x2e')](_0x111861[_0x95a1('0x2d')]);_0x2b3d52['filters']=_['intersection'](_0x2b3d52[_0x95a1('0x2c')],_0x2b3d52[_0x95a1('0x2d')]);_0x1ea231[_0x95a1('0x32')]=_[_0x95a1('0x30')](_0x2b3d52[_0x95a1('0x2c')],qs[_0x95a1('0x31')](_0x111861['query'][_0x95a1('0x31')]));_0x1ea231[_0x95a1('0x32')]=_0x1ea231[_0x95a1('0x32')]['length']?_0x1ea231['attributes']:_0x2b3d52[_0x95a1('0x2c')];if(_0x111861[_0x95a1('0x2d')][_0x95a1('0x3e')]){_0x1ea231[_0x95a1('0x43')]=[{'all':!![]}];}_0x1ea231=_[_0x95a1('0x3b')]({},_0x1ea231,_0x111861[_0x95a1('0x3d')]);return db[_0x95a1('0x2a')][_0x95a1('0x44')](_0x1ea231)[_0x95a1('0x23')](handleEntityNotFound(_0x216a33,null))[_0x95a1('0x23')](respondWithResult(_0x216a33,null))[_0x95a1('0x41')](handleError(_0x216a33,null));};exports['create']=function(_0x4a999e,_0x514f65){return db[_0x95a1('0x2a')][_0x95a1('0x45')](_0x4a999e[_0x95a1('0x46')],{})['then'](respondWithResult(_0x514f65,0xc9))['catch'](handleError(_0x514f65,null));};exports[_0x95a1('0x47')]=function(_0x4b717a,_0xd8b05){if(_0x4b717a['body']['id']){delete _0x4b717a[_0x95a1('0x46')]['id'];}return db[_0x95a1('0x2a')][_0x95a1('0x44')]({'where':{'id':_0x4b717a[_0x95a1('0x42')]['id']}})[_0x95a1('0x23')](handleEntityNotFound(_0xd8b05,null))['then'](saveUpdates(_0x4b717a[_0x95a1('0x46')],null))[_0x95a1('0x23')](respondWithResult(_0xd8b05,null))['catch'](handleError(_0xd8b05,null));};exports[_0x95a1('0x24')]=function(_0x3c4262,_0x2ed86e){return db[_0x95a1('0x2a')]['find']({'where':{'id':_0x3c4262[_0x95a1('0x42')]['id']}})['then'](handleEntityNotFound(_0x2ed86e,null))[_0x95a1('0x23')](removeEntity(_0x2ed86e,null))[_0x95a1('0x41')](handleError(_0x2ed86e,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 9bdf34f..6ef3071 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 _0xecc5=['lodash','api','moment','bluebird','path','../../config/environment','define','AnalyticTreeReport'];(function(_0x18528a,_0x4de7d1){var _0x2c3214=function(_0x1b9ff8){while(--_0x1b9ff8){_0x18528a['push'](_0x18528a['shift']());}};_0x2c3214(++_0x4de7d1);}(_0xecc5,0xf8));var _0x5ecc=function(_0x379271,_0x272069){_0x379271=_0x379271-0x0;var _0x597bf4=_0xecc5[_0x379271];return _0x597bf4;};'use strict';var _=require(_0x5ecc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5ecc('0x1'));var moment=require(_0x5ecc('0x2'));var BPromise=require(_0x5ecc('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ecc('0x4'));var rimraf=require('rimraf');var config=require(_0x5ecc('0x5'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x1901fe,_0x4e134e){return _0x1901fe[_0x5ecc('0x6')](_0x5ecc('0x7'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30fb=['analytics_report_trees','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticTreeReport'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x30fb,0x1ef));var _0xb30f=function(_0x4b16cf,_0x2dc12b){_0x4b16cf=_0x4b16cf-0x0;var _0x1e8620=_0x30fb[_0x4b16cf];return _0x1e8620;};'use strict';var _=require(_0xb30f('0x0'));var util=require(_0xb30f('0x1'));var logger=require(_0xb30f('0x2'))('api');var moment=require(_0xb30f('0x3'));var BPromise=require(_0xb30f('0x4'));var rp=require(_0xb30f('0x5'));var fs=require('fs');var path=require(_0xb30f('0x6'));var rimraf=require(_0xb30f('0x7'));var config=require(_0xb30f('0x8'));var attributes=require('./analyticTreeReport.attributes');module[_0xb30f('0x9')]=function(_0x2fbc92,_0x5495e1){return _0x2fbc92[_0xb30f('0xa')](_0xb30f('0xb'),attributes,{'tableName':_0xb30f('0xc'),'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 f2e6ec7..4e825f4 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(_0x33f9d0,_0x60b5b2){var _0x452c7e=function(_0x362179){while(--_0x362179){_0x33f9d0['push'](_0x33f9d0['shift']());}};_0x452c7e(++_0x60b5b2);}(_0x1261,0x144));var _0x1126=function(_0x16e9b5,_0x192142){_0x16e9b5=_0x16e9b5-0x0;var _0x206df0=_0x1261[_0x16e9b5];return _0x206df0;};'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 _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x69d888,_0x1f5645){_0x69d888=_0x69d888-0x0;var _0x360531=_0x7a54[_0x69d888];return _0x360531;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index e237869..64ad9c9 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 _0x7b5a=['show','post','create','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id'];(function(_0x5676df,_0x14d122){var _0x1fb878=function(_0x84c80a){while(--_0x84c80a){_0x5676df['push'](_0x5676df['shift']());}};_0x1fb878(++_0x14d122);}(_0x7b5a,0x1d0));var _0xa7b5=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0x7b5a[_0x386525];return _0x14d015;};'use strict';var multer=require(_0xa7b5('0x0'));var util=require('util');var path=require(_0xa7b5('0x1'));var timeout=require(_0xa7b5('0x2'));var express=require(_0xa7b5('0x3'));var router=express[_0xa7b5('0x4')]();var fs_extra=require(_0xa7b5('0x5'));var auth=require(_0xa7b5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa7b5('0x7'));var controller=require(_0xa7b5('0x8'));router[_0xa7b5('0x9')]('/',auth[_0xa7b5('0xa')](),controller['index']);router[_0xa7b5('0x9')](_0xa7b5('0xb'),auth[_0xa7b5('0xa')](),controller[_0xa7b5('0xc')]);router[_0xa7b5('0xd')]('/',auth['isAuthenticated'](),controller[_0xa7b5('0xe')]);router['put']('/:id',auth[_0xa7b5('0xa')](),controller['update']);router[_0xa7b5('0xf')]('/:id',auth[_0xa7b5('0xa')](),controller[_0xa7b5('0x10')]);module['exports']=router; \ No newline at end of file +var _0xbe4c=['Router','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','multer','path','connect-timeout','express'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xbe4c,0xd9));var _0xcbe4=function(_0x1623b9,_0x3079e4){_0x1623b9=_0x1623b9-0x0;var _0x35f978=_0xbe4c[_0x1623b9];return _0x35f978;};'use strict';var multer=require(_0xcbe4('0x0'));var util=require('util');var path=require(_0xcbe4('0x1'));var timeout=require(_0xcbe4('0x2'));var express=require(_0xcbe4('0x3'));var router=express[_0xcbe4('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcbe4('0x5'));var interaction=require(_0xcbe4('0x6'));var config=require('../../config/environment');var controller=require(_0xcbe4('0x7'));router[_0xcbe4('0x8')]('/',auth['isAuthenticated'](),controller[_0xcbe4('0x9')]);router[_0xcbe4('0x8')](_0xcbe4('0xa'),auth[_0xcbe4('0xb')](),controller[_0xcbe4('0xc')]);router[_0xcbe4('0xd')]('/',auth['isAuthenticated'](),controller[_0xcbe4('0xe')]);router[_0xcbe4('0xf')](_0xcbe4('0xa'),auth[_0xcbe4('0xb')](),controller[_0xcbe4('0x10')]);router['delete'](_0xcbe4('0xa'),auth[_0xcbe4('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index dc4c16a..2e731d6 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 _0x89c3=['sequelize','exports','STRING'];(function(_0x200d3d,_0xa6ad41){var _0x6d0dca=function(_0x37127b){while(--_0x37127b){_0x200d3d['push'](_0x200d3d['shift']());}};_0x6d0dca(++_0xa6ad41);}(_0x89c3,0xff));var _0x389c=function(_0x552b33,_0x1ce5ec){_0x552b33=_0x552b33-0x0;var _0x2b8810=_0x89c3[_0x552b33];return _0x2b8810;};'use strict';var Sequelize=require(_0x389c('0x0'));module[_0x389c('0x1')]={'name':{'type':Sequelize[_0x389c('0x2')]},'basename':{'type':Sequelize[_0x389c('0x2')]},'type':{'type':Sequelize[_0x389c('0x2')]}}; \ No newline at end of file +var _0x255f=['STRING','sequelize'];(function(_0x52121e,_0x4e7ac8){var _0x2d7778=function(_0x41775c){while(--_0x41775c){_0x52121e['push'](_0x52121e['shift']());}};_0x2d7778(++_0x4e7ac8);}(_0x255f,0x185));var _0xf255=function(_0x268db5,_0x3408a0){_0x268db5=_0x268db5-0x0;var _0x5c0a20=_0x255f[_0x268db5];return _0x5c0a20;};'use strict';var Sequelize=require(_0xf255('0x0'));module['exports']={'name':{'type':Sequelize[_0xf255('0x1')]},'basename':{'type':Sequelize[_0xf255('0x1')]},'type':{'type':Sequelize[_0xf255('0x1')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 62485fc..2e9840a 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 _0xcb53=['then','error','stack','name','send','index','Attachment','rawAttributes','fieldName','key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','keys','length','options','find','omit','createdAt','body','create','params','file','originalname','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update'];(function(_0x1a0667,_0x31adbd){var _0x39475a=function(_0x561478){while(--_0x561478){_0x1a0667['push'](_0x1a0667['shift']());}};_0x39475a(++_0x31adbd);}(_0xcb53,0xe6));var _0x3cb5=function(_0xc98184,_0x5adfa4){_0xc98184=_0xc98184-0x0;var _0x1d7c75=_0xcb53[_0xc98184];return _0x1d7c75;};'use strict';var emlformat=require(_0x3cb5('0x0'));var rimraf=require(_0x3cb5('0x1'));var zipdir=require(_0x3cb5('0x2'));var jsonpatch=require(_0x3cb5('0x3'));var rp=require(_0x3cb5('0x4'));var moment=require(_0x3cb5('0x5'));var BPromise=require(_0x3cb5('0x6'));var Mustache=require(_0x3cb5('0x7'));var util=require('util');var path=require(_0x3cb5('0x8'));var sox=require(_0x3cb5('0x9'));var csv=require(_0x3cb5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3cb5('0xb'));var _=require('lodash');var squel=require(_0x3cb5('0xc'));var crypto=require(_0x3cb5('0xd'));var jsforce=require(_0x3cb5('0xe'));var deskjs=require(_0x3cb5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3cb5('0x10'));var Redis=require(_0x3cb5('0x11'));var authService=require(_0x3cb5('0x12'));var qs=require(_0x3cb5('0x13'));var as=require(_0x3cb5('0x14'));var hardwareService=require(_0x3cb5('0x15'));var logger=require('../../config/logger')(_0x3cb5('0x16'));var utils=require(_0x3cb5('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3cb5('0x18'))['db'];function respondWithStatusCode(_0x3846c6,_0x3515bd){_0x3515bd=_0x3515bd||0xcc;return function(_0x34be3c){if(_0x34be3c){return _0x3846c6[_0x3cb5('0x19')](_0x3515bd);}return _0x3846c6[_0x3cb5('0x1a')](_0x3515bd)['end']();};}function respondWithResult(_0x5cc097,_0x3bbdc4){_0x3bbdc4=_0x3bbdc4||0xc8;return function(_0x3f0603){if(_0x3f0603){return _0x5cc097[_0x3cb5('0x1a')](_0x3bbdc4)[_0x3cb5('0x1b')](_0x3f0603);}};}function respondWithFilteredResult(_0x101c2a,_0x523582){return function(_0x2e62b4){if(_0x2e62b4){var _0x4d407b=typeof _0x523582[_0x3cb5('0x1c')]===_0x3cb5('0x1d')&&typeof _0x523582[_0x3cb5('0x1e')]==='undefined';var _0x3a6de5=_0x2e62b4[_0x3cb5('0x1f')];var _0x222638=_0x4d407b?0x0:_0x523582[_0x3cb5('0x1c')];var _0x5ab7d=_0x4d407b?_0x2e62b4[_0x3cb5('0x1f')]:_0x523582[_0x3cb5('0x1c')]+_0x523582[_0x3cb5('0x1e')];var _0x46cae1;if(_0x5ab7d>=_0x3a6de5){_0x5ab7d=_0x3a6de5;_0x46cae1=0xc8;}else{_0x46cae1=0xce;}_0x101c2a['status'](_0x46cae1);return _0x101c2a[_0x3cb5('0x20')](_0x3cb5('0x21'),_0x222638+'-'+_0x5ab7d+'/'+_0x3a6de5)[_0x3cb5('0x1b')](_0x2e62b4);}return null;};}function patchUpdates(_0x53d40d){return function(_0x160ce8){try{jsonpatch['apply'](_0x160ce8,_0x53d40d,!![]);}catch(_0x273985){return BPromise[_0x3cb5('0x22')](_0x273985);}return _0x160ce8[_0x3cb5('0x23')]();};}function saveUpdates(_0x5859a0,_0x5750b2){return function(_0x412306){if(_0x412306){return _0x412306[_0x3cb5('0x24')](_0x5859a0)['then'](function(_0x36c044){return _0x36c044;});}return null;};}function removeEntity(_0x306842,_0x3ddb6c){return function(_0x67fcf3){if(_0x67fcf3){return _0x67fcf3['destroy']()[_0x3cb5('0x25')](function(){_0x306842[_0x3cb5('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a7a74,_0x43775d){return function(_0x4c1dda){if(!_0x4c1dda){_0x1a7a74['sendStatus'](0x194);}return _0x4c1dda;};}function handleError(_0x1ea89f,_0x458a8a){_0x458a8a=_0x458a8a||0x1f4;return function(_0x5b41eb){logger[_0x3cb5('0x26')](_0x5b41eb[_0x3cb5('0x27')]);if(_0x5b41eb[_0x3cb5('0x28')]){delete _0x5b41eb[_0x3cb5('0x28')];}_0x1ea89f[_0x3cb5('0x1a')](_0x458a8a)[_0x3cb5('0x29')](_0x5b41eb);};}exports[_0x3cb5('0x2a')]=function(_0x5eb8ad,_0x44c863){var _0x18aad2={},_0x1187a0={},_0x135cd0={'count':0x0,'rows':[]};var _0x265634=_['map'](db[_0x3cb5('0x2b')][_0x3cb5('0x2c')],function(_0x5dcdb8){return{'name':_0x5dcdb8[_0x3cb5('0x2d')],'type':_0x5dcdb8['type'][_0x3cb5('0x2e')]};});_0x1187a0[_0x3cb5('0x2f')]=_[_0x3cb5('0x30')](_0x265634,_0x3cb5('0x28'));_0x1187a0[_0x3cb5('0x31')]=_['keys'](_0x5eb8ad[_0x3cb5('0x31')]);_0x1187a0[_0x3cb5('0x32')]=_['intersection'](_0x1187a0['model'],_0x1187a0[_0x3cb5('0x31')]);_0x18aad2[_0x3cb5('0x33')]=_[_0x3cb5('0x34')](_0x1187a0[_0x3cb5('0x2f')],qs[_0x3cb5('0x35')](_0x5eb8ad[_0x3cb5('0x31')][_0x3cb5('0x35')]));_0x18aad2['attributes']=_0x18aad2[_0x3cb5('0x33')]['length']?_0x18aad2[_0x3cb5('0x33')]:_0x1187a0[_0x3cb5('0x2f')];if(!_0x5eb8ad[_0x3cb5('0x31')][_0x3cb5('0x36')](_0x3cb5('0x37'))){_0x18aad2[_0x3cb5('0x1e')]=qs[_0x3cb5('0x1e')](_0x5eb8ad[_0x3cb5('0x31')][_0x3cb5('0x1e')]);_0x18aad2[_0x3cb5('0x1c')]=qs[_0x3cb5('0x1c')](_0x5eb8ad[_0x3cb5('0x31')][_0x3cb5('0x1c')]);}_0x18aad2['order']=qs[_0x3cb5('0x38')](_0x5eb8ad['query'][_0x3cb5('0x38')]);_0x18aad2[_0x3cb5('0x39')]=qs[_0x3cb5('0x32')](_[_0x3cb5('0x3a')](_0x5eb8ad[_0x3cb5('0x31')],_0x1187a0[_0x3cb5('0x32')]),_0x265634);if(_0x5eb8ad[_0x3cb5('0x31')]['filter']){_0x18aad2[_0x3cb5('0x39')]=_[_0x3cb5('0x3b')](_0x18aad2['where'],{'$or':_[_0x3cb5('0x30')](_0x265634,function(_0x2ac2f7){if(_0x2ac2f7[_0x3cb5('0x3c')]!==_0x3cb5('0x3d')){var _0x1f40ec={};_0x1f40ec[_0x2ac2f7[_0x3cb5('0x28')]]={'$like':'%'+_0x5eb8ad[_0x3cb5('0x31')][_0x3cb5('0x3e')]+'%'};return _0x1f40ec;}})});}_0x18aad2=_['merge']({},_0x18aad2,_0x5eb8ad['options']);var _0x47527d={'where':_0x18aad2[_0x3cb5('0x39')]};return db[_0x3cb5('0x2b')][_0x3cb5('0x1f')](_0x47527d)[_0x3cb5('0x25')](function(_0x53c7ee){_0x135cd0['count']=_0x53c7ee;if(_0x5eb8ad[_0x3cb5('0x31')][_0x3cb5('0x3f')]){_0x18aad2[_0x3cb5('0x40')]=[{'all':!![]}];}return db[_0x3cb5('0x2b')][_0x3cb5('0x41')](_0x18aad2);})['then'](function(_0x21116f){_0x135cd0[_0x3cb5('0x42')]=_0x21116f;return _0x135cd0;})[_0x3cb5('0x25')](respondWithFilteredResult(_0x44c863,_0x18aad2))[_0x3cb5('0x43')](handleError(_0x44c863,null));};exports[_0x3cb5('0x44')]=function(_0x122427,_0x52695b){var _0x2277db={'raw':!![],'where':{'id':_0x122427['params']['id']}},_0x57ddd0={};_0x57ddd0[_0x3cb5('0x2f')]=_[_0x3cb5('0x45')](db[_0x3cb5('0x2b')][_0x3cb5('0x2c')]);_0x57ddd0[_0x3cb5('0x31')]=_[_0x3cb5('0x45')](_0x122427[_0x3cb5('0x31')]);_0x57ddd0['filters']=_['intersection'](_0x57ddd0[_0x3cb5('0x2f')],_0x57ddd0[_0x3cb5('0x31')]);_0x2277db[_0x3cb5('0x33')]=_[_0x3cb5('0x34')](_0x57ddd0[_0x3cb5('0x2f')],qs['fields'](_0x122427['query'][_0x3cb5('0x35')]));_0x2277db[_0x3cb5('0x33')]=_0x2277db[_0x3cb5('0x33')][_0x3cb5('0x46')]?_0x2277db[_0x3cb5('0x33')]:_0x57ddd0[_0x3cb5('0x2f')];if(_0x122427['query']['includeAll']){_0x2277db['include']=[{'all':!![]}];}_0x2277db=_[_0x3cb5('0x3b')]({},_0x2277db,_0x122427[_0x3cb5('0x47')]);return db[_0x3cb5('0x2b')][_0x3cb5('0x48')](_0x2277db)['then'](handleEntityNotFound(_0x52695b,null))[_0x3cb5('0x25')](respondWithResult(_0x52695b,null))[_0x3cb5('0x43')](handleError(_0x52695b,null));};exports['clone']=function(_0x449248,_0x48823e){var _0x2807fb={'where':{'id':_0x449248['params']['id']}},_0x95c08e={};_0x95c08e[_0x3cb5('0x2f')]=_['keys'](db[_0x3cb5('0x2b')]['rawAttributes']);_0x2807fb['attributes']=_['intersection'](_0x95c08e[_0x3cb5('0x2f')],qs[_0x3cb5('0x35')](_0x449248[_0x3cb5('0x31')][_0x3cb5('0x35')]));_0x2807fb['attributes']=_0x2807fb[_0x3cb5('0x33')][_0x3cb5('0x46')]?_0x2807fb[_0x3cb5('0x33')]:_0x95c08e[_0x3cb5('0x2f')];if(_0x449248[_0x3cb5('0x31')][_0x3cb5('0x3f')]){_0x2807fb[_0x3cb5('0x40')]=[{'all':!![]}];}_0x2807fb=_[_0x3cb5('0x3b')]({},_0x2807fb,_0x449248['options']);return db[_0x3cb5('0x2b')][_0x3cb5('0x48')](_0x2807fb)['then'](handleEntityNotFound(_0x48823e,null))[_0x3cb5('0x25')](function(_0x1a1a12){if(_0x1a1a12){var _0x1460c0=_0x1a1a12['get']({'plain':!![]});_0x1460c0=qs[_0x3cb5('0x49')](_0x1460c0,['id',_0x3cb5('0x4a'),'updatedAt']);_0x449248[_0x3cb5('0x4b')]=_['omit'](_0x449248['body'],['id',_0x3cb5('0x4a'),'updatedAt']);return db[_0x3cb5('0x2b')][_0x3cb5('0x4c')](_[_0x3cb5('0x3b')](_0x1460c0,_0x449248[_0x3cb5('0x4b')]),{'include':_0x449248[_0x3cb5('0x31')][_0x3cb5('0x3f')]?[{'all':!![]}]:undefined});}})[_0x3cb5('0x25')](respondWithResult(_0x48823e,0xc9))[_0x3cb5('0x43')](handleError(_0x48823e,null));};exports[_0x3cb5('0x24')]=function(_0x1607af,_0x17922e){if(_0x1607af[_0x3cb5('0x4b')]['id']){delete _0x1607af['body']['id'];}return db['Attachment'][_0x3cb5('0x48')]({'where':{'id':_0x1607af[_0x3cb5('0x4d')]['id']}})[_0x3cb5('0x25')](handleEntityNotFound(_0x17922e,null))[_0x3cb5('0x25')](saveUpdates(_0x1607af[_0x3cb5('0x4b')],null))[_0x3cb5('0x25')](respondWithResult(_0x17922e,null))[_0x3cb5('0x43')](handleError(_0x17922e,null));};exports['destroy']=function(_0x13ca01,_0x1be727){return db['Attachment'][_0x3cb5('0x48')]({'where':{'id':_0x13ca01['params']['id']}})[_0x3cb5('0x25')](handleEntityNotFound(_0x1be727,null))[_0x3cb5('0x25')](removeEntity(_0x1be727,null))[_0x3cb5('0x43')](handleError(_0x1be727,null));};exports[_0x3cb5('0x4c')]=function(_0x69cbe3,_0x2f0cac,_0x626b2c){_0x69cbe3['body']['name']=_0x69cbe3[_0x3cb5('0x4e')][_0x3cb5('0x4f')];_0x69cbe3[_0x3cb5('0x4b')][_0x3cb5('0x50')]=_0x69cbe3[_0x3cb5('0x4e')][_0x3cb5('0x51')];_0x69cbe3[_0x3cb5('0x4b')][_0x3cb5('0x3c')]=_0x69cbe3[_0x3cb5('0x4e')][_0x3cb5('0x52')];return db['Attachment'][_0x3cb5('0x4c')](_0x69cbe3[_0x3cb5('0x4b')])[_0x3cb5('0x25')](respondWithResult(_0x2f0cac,0xc9))[_0x3cb5('0x43')](handleError(_0x2f0cac,null));};exports[_0x3cb5('0x53')]=function(_0x4f4ec2,_0x194191,_0x505332){return db['Attachment'][_0x3cb5('0x54')]({'where':{'id':_0x4f4ec2[_0x3cb5('0x4d')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x194191,null))['then'](function(_0x275f32){if(_0x275f32){var _0x2b31d5=_0x275f32[_0x3cb5('0x55')]!==null;var _0x31e82c=path[_0x3cb5('0x56')](config[_0x3cb5('0x57')],'server/files/attachments/');if(_0x2b31d5){_0x31e82c=path['join'](_0x31e82c,_0x3cb5('0x58'));}var _0x5bc453=path[_0x3cb5('0x56')](_0x31e82c,_0x275f32['basename']);return _0x194191[_0x3cb5('0x53')](_0x5bc453);}})[_0x3cb5('0x43')](handleError(_0x194191,null));}; \ No newline at end of file +var _0xa0f5=['options','Attachment','includeAll','include','findAll','rows','catch','params','keys','find','clone','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','download','findOne','ChatOfflineMessageId','join','root','offline-chat/','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','stack','name','index','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge'];(function(_0x350517,_0x1afeb6){var _0x335a10=function(_0x54b44c){while(--_0x54b44c){_0x350517['push'](_0x350517['shift']());}};_0x335a10(++_0x1afeb6);}(_0xa0f5,0x177));var _0x5a0f=function(_0x5d30c2,_0x20b931){_0x5d30c2=_0x5d30c2-0x0;var _0x322ce6=_0xa0f5[_0x5d30c2];return _0x322ce6;};'use strict';var emlformat=require(_0x5a0f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5a0f('0x1'));var jsonpatch=require(_0x5a0f('0x2'));var rp=require(_0x5a0f('0x3'));var moment=require('moment');var BPromise=require(_0x5a0f('0x4'));var Mustache=require(_0x5a0f('0x5'));var util=require('util');var path=require('path');var sox=require(_0x5a0f('0x6'));var csv=require(_0x5a0f('0x7'));var ejs=require(_0x5a0f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5a0f('0x9'));var crypto=require(_0x5a0f('0xa'));var jsforce=require(_0x5a0f('0xb'));var deskjs=require(_0x5a0f('0xc'));var toCsv=require(_0x5a0f('0x7'));var querystring=require(_0x5a0f('0xd'));var Papa=require(_0x5a0f('0xe'));var Redis=require(_0x5a0f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5a0f('0x10'));var as=require(_0x5a0f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5a0f('0x12'))(_0x5a0f('0x13'));var utils=require(_0x5a0f('0x14'));var config=require(_0x5a0f('0x15'));var licenseUtil=require(_0x5a0f('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x564854,_0x423c91){_0x423c91=_0x423c91||0xcc;return function(_0x49c80b){if(_0x49c80b){return _0x564854[_0x5a0f('0x17')](_0x423c91);}return _0x564854[_0x5a0f('0x18')](_0x423c91)[_0x5a0f('0x19')]();};}function respondWithResult(_0x3d345f,_0x21e287){_0x21e287=_0x21e287||0xc8;return function(_0x4291d6){if(_0x4291d6){return _0x3d345f['status'](_0x21e287)['json'](_0x4291d6);}};}function respondWithFilteredResult(_0x354bf4,_0x4fbf75){return function(_0x56f2f0){if(_0x56f2f0){var _0x1623bc=typeof _0x4fbf75['offset']===_0x5a0f('0x1a')&&typeof _0x4fbf75[_0x5a0f('0x1b')]===_0x5a0f('0x1a');var _0x30a18f=_0x56f2f0[_0x5a0f('0x1c')];var _0x3a138b=_0x1623bc?0x0:_0x4fbf75[_0x5a0f('0x1d')];var _0xfaa649=_0x1623bc?_0x56f2f0[_0x5a0f('0x1c')]:_0x4fbf75[_0x5a0f('0x1d')]+_0x4fbf75[_0x5a0f('0x1b')];var _0x3bd6b8;if(_0xfaa649>=_0x30a18f){_0xfaa649=_0x30a18f;_0x3bd6b8=0xc8;}else{_0x3bd6b8=0xce;}_0x354bf4['status'](_0x3bd6b8);return _0x354bf4[_0x5a0f('0x1e')](_0x5a0f('0x1f'),_0x3a138b+'-'+_0xfaa649+'/'+_0x30a18f)[_0x5a0f('0x20')](_0x56f2f0);}return null;};}function patchUpdates(_0x2c1589){return function(_0x4c1c1d){try{jsonpatch[_0x5a0f('0x21')](_0x4c1c1d,_0x2c1589,!![]);}catch(_0x45394a){return BPromise[_0x5a0f('0x22')](_0x45394a);}return _0x4c1c1d[_0x5a0f('0x23')]();};}function saveUpdates(_0x58ff0a,_0x4b6b4c){return function(_0x5d08e1){if(_0x5d08e1){return _0x5d08e1[_0x5a0f('0x24')](_0x58ff0a)[_0x5a0f('0x25')](function(_0x45e9a8){return _0x45e9a8;});}return null;};}function removeEntity(_0x166447,_0x487dc1){return function(_0x5d4272){if(_0x5d4272){return _0x5d4272['destroy']()[_0x5a0f('0x25')](function(){_0x166447[_0x5a0f('0x18')](0xcc)[_0x5a0f('0x19')]();});}};}function handleEntityNotFound(_0x432f22,_0x14a0a9){return function(_0xb20af7){if(!_0xb20af7){_0x432f22[_0x5a0f('0x17')](0x194);}return _0xb20af7;};}function handleError(_0x22c859,_0x2e7b79){_0x2e7b79=_0x2e7b79||0x1f4;return function(_0x22d4a2){logger['error'](_0x22d4a2[_0x5a0f('0x26')]);if(_0x22d4a2['name']){delete _0x22d4a2[_0x5a0f('0x27')];}_0x22c859['status'](_0x2e7b79)['send'](_0x22d4a2);};}exports[_0x5a0f('0x28')]=function(_0xfedbe0,_0x7fa78f){var _0x584b21={},_0x422e41={},_0xdd598a={'count':0x0,'rows':[]};var _0x162226=_['map'](db['Attachment'][_0x5a0f('0x29')],function(_0x537dc3){return{'name':_0x537dc3['fieldName'],'type':_0x537dc3[_0x5a0f('0x2a')][_0x5a0f('0x2b')]};});_0x422e41[_0x5a0f('0x2c')]=_[_0x5a0f('0x2d')](_0x162226,'name');_0x422e41['query']=_['keys'](_0xfedbe0[_0x5a0f('0x2e')]);_0x422e41[_0x5a0f('0x2f')]=_[_0x5a0f('0x30')](_0x422e41[_0x5a0f('0x2c')],_0x422e41[_0x5a0f('0x2e')]);_0x584b21[_0x5a0f('0x31')]=_[_0x5a0f('0x30')](_0x422e41['model'],qs[_0x5a0f('0x32')](_0xfedbe0[_0x5a0f('0x2e')][_0x5a0f('0x32')]));_0x584b21[_0x5a0f('0x31')]=_0x584b21[_0x5a0f('0x31')][_0x5a0f('0x33')]?_0x584b21[_0x5a0f('0x31')]:_0x422e41[_0x5a0f('0x2c')];if(!_0xfedbe0[_0x5a0f('0x2e')][_0x5a0f('0x34')]('nolimit')){_0x584b21[_0x5a0f('0x1b')]=qs[_0x5a0f('0x1b')](_0xfedbe0[_0x5a0f('0x2e')][_0x5a0f('0x1b')]);_0x584b21[_0x5a0f('0x1d')]=qs[_0x5a0f('0x1d')](_0xfedbe0[_0x5a0f('0x2e')][_0x5a0f('0x1d')]);}_0x584b21[_0x5a0f('0x35')]=qs[_0x5a0f('0x36')](_0xfedbe0[_0x5a0f('0x2e')]['sort']);_0x584b21[_0x5a0f('0x37')]=qs[_0x5a0f('0x2f')](_[_0x5a0f('0x38')](_0xfedbe0[_0x5a0f('0x2e')],_0x422e41[_0x5a0f('0x2f')]),_0x162226);if(_0xfedbe0[_0x5a0f('0x2e')][_0x5a0f('0x39')]){_0x584b21[_0x5a0f('0x37')]=_['merge'](_0x584b21[_0x5a0f('0x37')],{'$or':_[_0x5a0f('0x2d')](_0x162226,function(_0x5aaa5a){if(_0x5aaa5a[_0x5a0f('0x2a')]!==_0x5a0f('0x3a')){var _0x5de01b={};_0x5de01b[_0x5aaa5a[_0x5a0f('0x27')]]={'$like':'%'+_0xfedbe0[_0x5a0f('0x2e')][_0x5a0f('0x39')]+'%'};return _0x5de01b;}})});}_0x584b21=_[_0x5a0f('0x3b')]({},_0x584b21,_0xfedbe0[_0x5a0f('0x3c')]);var _0xb8868b={'where':_0x584b21[_0x5a0f('0x37')]};return db[_0x5a0f('0x3d')][_0x5a0f('0x1c')](_0xb8868b)[_0x5a0f('0x25')](function(_0x3a9255){_0xdd598a[_0x5a0f('0x1c')]=_0x3a9255;if(_0xfedbe0[_0x5a0f('0x2e')][_0x5a0f('0x3e')]){_0x584b21[_0x5a0f('0x3f')]=[{'all':!![]}];}return db[_0x5a0f('0x3d')][_0x5a0f('0x40')](_0x584b21);})['then'](function(_0x858b0c){_0xdd598a[_0x5a0f('0x41')]=_0x858b0c;return _0xdd598a;})['then'](respondWithFilteredResult(_0x7fa78f,_0x584b21))[_0x5a0f('0x42')](handleError(_0x7fa78f,null));};exports['show']=function(_0x573b7d,_0x1bed51){var _0x159e58={'raw':!![],'where':{'id':_0x573b7d[_0x5a0f('0x43')]['id']}},_0x90bba8={};_0x90bba8['model']=_[_0x5a0f('0x44')](db['Attachment']['rawAttributes']);_0x90bba8[_0x5a0f('0x2e')]=_[_0x5a0f('0x44')](_0x573b7d[_0x5a0f('0x2e')]);_0x90bba8[_0x5a0f('0x2f')]=_[_0x5a0f('0x30')](_0x90bba8[_0x5a0f('0x2c')],_0x90bba8[_0x5a0f('0x2e')]);_0x159e58['attributes']=_['intersection'](_0x90bba8[_0x5a0f('0x2c')],qs[_0x5a0f('0x32')](_0x573b7d[_0x5a0f('0x2e')][_0x5a0f('0x32')]));_0x159e58[_0x5a0f('0x31')]=_0x159e58[_0x5a0f('0x31')][_0x5a0f('0x33')]?_0x159e58[_0x5a0f('0x31')]:_0x90bba8['model'];if(_0x573b7d['query'][_0x5a0f('0x3e')]){_0x159e58['include']=[{'all':!![]}];}_0x159e58=_[_0x5a0f('0x3b')]({},_0x159e58,_0x573b7d[_0x5a0f('0x3c')]);return db[_0x5a0f('0x3d')][_0x5a0f('0x45')](_0x159e58)[_0x5a0f('0x25')](handleEntityNotFound(_0x1bed51,null))[_0x5a0f('0x25')](respondWithResult(_0x1bed51,null))[_0x5a0f('0x42')](handleError(_0x1bed51,null));};exports[_0x5a0f('0x46')]=function(_0x2ea411,_0x29156e){var _0x593e06={'where':{'id':_0x2ea411['params']['id']}},_0x46653f={};_0x46653f[_0x5a0f('0x2c')]=_['keys'](db['Attachment'][_0x5a0f('0x29')]);_0x593e06[_0x5a0f('0x31')]=_[_0x5a0f('0x30')](_0x46653f[_0x5a0f('0x2c')],qs[_0x5a0f('0x32')](_0x2ea411[_0x5a0f('0x2e')][_0x5a0f('0x32')]));_0x593e06[_0x5a0f('0x31')]=_0x593e06['attributes'][_0x5a0f('0x33')]?_0x593e06[_0x5a0f('0x31')]:_0x46653f[_0x5a0f('0x2c')];if(_0x2ea411['query'][_0x5a0f('0x3e')]){_0x593e06['include']=[{'all':!![]}];}_0x593e06=_[_0x5a0f('0x3b')]({},_0x593e06,_0x2ea411['options']);return db[_0x5a0f('0x3d')][_0x5a0f('0x45')](_0x593e06)[_0x5a0f('0x25')](handleEntityNotFound(_0x29156e,null))[_0x5a0f('0x25')](function(_0x107372){if(_0x107372){var _0x5b2337=_0x107372[_0x5a0f('0x47')]({'plain':!![]});_0x5b2337=qs[_0x5a0f('0x48')](_0x5b2337,['id',_0x5a0f('0x49'),_0x5a0f('0x4a')]);_0x2ea411['body']=_[_0x5a0f('0x48')](_0x2ea411[_0x5a0f('0x4b')],['id',_0x5a0f('0x49'),_0x5a0f('0x4a')]);return db[_0x5a0f('0x3d')][_0x5a0f('0x4c')](_['merge'](_0x5b2337,_0x2ea411['body']),{'include':_0x2ea411[_0x5a0f('0x2e')][_0x5a0f('0x3e')]?[{'all':!![]}]:undefined});}})[_0x5a0f('0x25')](respondWithResult(_0x29156e,0xc9))['catch'](handleError(_0x29156e,null));};exports[_0x5a0f('0x24')]=function(_0x45e0af,_0x37bfdf){if(_0x45e0af[_0x5a0f('0x4b')]['id']){delete _0x45e0af[_0x5a0f('0x4b')]['id'];}return db['Attachment'][_0x5a0f('0x45')]({'where':{'id':_0x45e0af[_0x5a0f('0x43')]['id']}})[_0x5a0f('0x25')](handleEntityNotFound(_0x37bfdf,null))[_0x5a0f('0x25')](saveUpdates(_0x45e0af[_0x5a0f('0x4b')],null))[_0x5a0f('0x25')](respondWithResult(_0x37bfdf,null))[_0x5a0f('0x42')](handleError(_0x37bfdf,null));};exports['destroy']=function(_0x4f39cb,_0x5c61fb){return db[_0x5a0f('0x3d')][_0x5a0f('0x45')]({'where':{'id':_0x4f39cb[_0x5a0f('0x43')]['id']}})['then'](handleEntityNotFound(_0x5c61fb,null))[_0x5a0f('0x25')](removeEntity(_0x5c61fb,null))['catch'](handleError(_0x5c61fb,null));};exports[_0x5a0f('0x4c')]=function(_0x3f0929,_0x5191ea,_0x453bd3){_0x3f0929[_0x5a0f('0x4b')][_0x5a0f('0x27')]=_0x3f0929[_0x5a0f('0x4d')][_0x5a0f('0x4e')];_0x3f0929[_0x5a0f('0x4b')][_0x5a0f('0x4f')]=_0x3f0929[_0x5a0f('0x4d')][_0x5a0f('0x50')];_0x3f0929[_0x5a0f('0x4b')][_0x5a0f('0x2a')]=_0x3f0929['file']['mimetype'];return db[_0x5a0f('0x3d')]['create'](_0x3f0929['body'])[_0x5a0f('0x25')](respondWithResult(_0x5191ea,0xc9))[_0x5a0f('0x42')](handleError(_0x5191ea,null));};exports[_0x5a0f('0x51')]=function(_0x4e3a7e,_0x45a4d7,_0x2a19b7){return db[_0x5a0f('0x3d')][_0x5a0f('0x52')]({'where':{'id':_0x4e3a7e[_0x5a0f('0x43')]['id']},'raw':!![]})[_0x5a0f('0x25')](handleEntityNotFound(_0x45a4d7,null))[_0x5a0f('0x25')](function(_0x3e3068){if(_0x3e3068){var _0x5cc212=_0x3e3068[_0x5a0f('0x53')]!==null;var _0x328c95=path[_0x5a0f('0x54')](config[_0x5a0f('0x55')],'server/files/attachments/');if(_0x5cc212){_0x328c95=path['join'](_0x328c95,_0x5a0f('0x56'));}var _0xd98cbc=path['join'](_0x328c95,_0x3e3068[_0x5a0f('0x4f')]);return _0x45a4d7['download'](_0xd98cbc);}})[_0x5a0f('0x42')](handleError(_0x45a4d7,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 7789b90..897c7f4 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 _0x0725=['exports','define','attachments','util','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x223a26,_0xfa7d3f){var _0x46f8d2=function(_0x3ddc3f){while(--_0x3ddc3f){_0x223a26['push'](_0x223a26['shift']());}};_0x46f8d2(++_0xfa7d3f);}(_0x0725,0x1aa));var _0x5072=function(_0x212d49,_0x1121d6){_0x212d49=_0x212d49-0x0;var _0x272fce=_0x0725[_0x212d49];return _0x272fce;};'use strict';var _=require('lodash');var util=require(_0x5072('0x0'));var logger=require('../../config/logger')(_0x5072('0x1'));var moment=require('moment');var BPromise=require(_0x5072('0x2'));var rp=require(_0x5072('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5072('0x4'));var config=require(_0x5072('0x5'));var attributes=require('./attachment.attributes');module[_0x5072('0x6')]=function(_0x2b39f1,_0x13904a){return _0x2b39f1[_0x5072('0x7')]('Attachment',attributes,{'tableName':_0x5072('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6acf=['Attachment','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./attachment.attributes','exports'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x6acf,0x121));var _0xf6ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6acf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf6ac('0x0'));var util=require(_0xf6ac('0x1'));var logger=require(_0xf6ac('0x2'))(_0xf6ac('0x3'));var moment=require(_0xf6ac('0x4'));var BPromise=require(_0xf6ac('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf6ac('0x6'));var rimraf=require(_0xf6ac('0x7'));var config=require(_0xf6ac('0x8'));var attributes=require(_0xf6ac('0x9'));module[_0xf6ac('0xa')]=function(_0x5d01c7,_0xc4bcde){return _0x5d01c7['define'](_0xf6ac('0xb'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 2e19925..64ae6d3 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 _0x222f=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','Attachment','body','options','raw','debug'];(function(_0x484508,_0x217c0e){var _0x141ef5=function(_0x26fdef){while(--_0x26fdef){_0x484508['push'](_0x484508['shift']());}};_0x141ef5(++_0x217c0e);}(_0x222f,0x1a4));var _0xf222=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0x222f[_0x33c9f8];return _0x2d7004;};'use strict';var _=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var moment=require(_0xf222('0x2'));var BPromise=require(_0xf222('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf222('0x4'))['db'];var utils=require(_0xf222('0x5'));var logger=require(_0xf222('0x6'))(_0xf222('0x7'));var config=require('../../config/environment');var jayson=require(_0xf222('0x8'));var client=jayson['client'][_0xf222('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26f129,_0x518ebb,_0xf5a105){return new BPromise(function(_0x302d7a,_0x4aceb4){return client[_0xf222('0xa')](_0x26f129,_0xf5a105)[_0xf222('0xb')](function(_0x878804){logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));logger['debug'](_0xf222('0xf'),_0x518ebb,_0xf222('0xe'),JSON[_0xf222('0x10')](_0x878804));if(_0x878804[_0xf222('0x11')]){if(_0x878804['error'][_0xf222('0x12')]===0x1f4){logger[_0xf222('0x11')](_0xf222('0xd'),_0x518ebb,_0x878804[_0xf222('0x11')][_0xf222('0x13')]);return _0x4aceb4(_0x878804[_0xf222('0x11')][_0xf222('0x13')]);}logger[_0xf222('0x11')]('Attachment,\x20%s,\x20%s',_0x518ebb,_0x878804['error'][_0xf222('0x13')]);return _0x302d7a(_0x878804[_0xf222('0x11')]['message']);}else{logger[_0xf222('0xc')](_0xf222('0xd'),_0x518ebb,_0xf222('0xe'));_0x302d7a(_0x878804[_0xf222('0x14')][_0xf222('0x13')]);}})[_0xf222('0x15')](function(_0x30b646){logger['error'](_0xf222('0xd'),_0x518ebb,_0x30b646);_0x4aceb4(_0x30b646);});});}exports[_0xf222('0x16')]=function(_0x8783ab){var _0xfb4ddf=this;return new Promise(function(_0x12a2e4,_0x1e57ee){return db[_0xf222('0x17')]['create'](_0x8783ab[_0xf222('0x18')],{'raw':_0x8783ab[_0xf222('0x19')]?_0x8783ab[_0xf222('0x19')][_0xf222('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x5cd899){logger[_0xf222('0xc')](_0xf222('0x16'),_0x8783ab);logger[_0xf222('0x1b')](_0xf222('0x16'),_0x8783ab,JSON[_0xf222('0x10')](_0x5cd899));_0x12a2e4(_0x5cd899);})[_0xf222('0x15')](function(_0x51b872){logger[_0xf222('0x11')](_0xf222('0x16'),_0x51b872[_0xf222('0x13')],_0x8783ab);_0x1e57ee(_0xfb4ddf[_0xf222('0x11')](0x1f4,_0x51b872[_0xf222('0x13')]));});});}; \ No newline at end of file +var _0x1ddc=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Attachment','create','body','options','raw','CreateAttachment','util','moment'];(function(_0x574115,_0x1334fb){var _0x45f3fe=function(_0x351e5b){while(--_0x351e5b){_0x574115['push'](_0x574115['shift']());}};_0x45f3fe(++_0x1334fb);}(_0x1ddc,0x6e));var _0xc1dd=function(_0x14f37f,_0x247bce){_0x14f37f=_0x14f37f-0x0;var _0xa85176=_0x1ddc[_0x14f37f];return _0xa85176;};'use strict';var _=require('lodash');var util=require(_0xc1dd('0x0'));var moment=require(_0xc1dd('0x1'));var BPromise=require(_0xc1dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1dd('0x3'));var db=require(_0xc1dd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1dd('0x5'))(_0xc1dd('0x6'));var config=require('../../config/environment');var jayson=require(_0xc1dd('0x7'));var client=jayson[_0xc1dd('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3938ff,_0x25c543,_0x593de5){return new BPromise(function(_0x54819b,_0x411452){return client[_0xc1dd('0x9')](_0x3938ff,_0x593de5)[_0xc1dd('0xa')](function(_0x217d07){logger['info'](_0xc1dd('0xb'),_0x25c543,_0xc1dd('0xc'));logger[_0xc1dd('0xd')](_0xc1dd('0xe'),_0x25c543,'request\x20sent',JSON[_0xc1dd('0xf')](_0x217d07));if(_0x217d07[_0xc1dd('0x10')]){if(_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x11')]===0x1f4){logger[_0xc1dd('0x10')](_0xc1dd('0xb'),_0x25c543,_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x12')]);return _0x411452(_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x12')]);}logger[_0xc1dd('0x10')]('Attachment,\x20%s,\x20%s',_0x25c543,_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x12')]);return _0x54819b(_0x217d07[_0xc1dd('0x10')][_0xc1dd('0x12')]);}else{logger[_0xc1dd('0x13')]('Attachment,\x20%s,\x20%s',_0x25c543,_0xc1dd('0xc'));_0x54819b(_0x217d07[_0xc1dd('0x14')][_0xc1dd('0x12')]);}})[_0xc1dd('0x15')](function(_0x5815d3){logger['error'](_0xc1dd('0xb'),_0x25c543,_0x5815d3);_0x411452(_0x5815d3);});});}exports['CreateAttachment']=function(_0x35139a){var _0x4c3114=this;return new Promise(function(_0x6198a7,_0x24446f){return db[_0xc1dd('0x16')][_0xc1dd('0x17')](_0x35139a[_0xc1dd('0x18')],{'raw':_0x35139a[_0xc1dd('0x19')]?_0x35139a['options'][_0xc1dd('0x1a')]===undefined?!![]:![]:!![]})[_0xc1dd('0xa')](function(_0x5e99a6){logger[_0xc1dd('0x13')](_0xc1dd('0x1b'),_0x35139a);logger[_0xc1dd('0xd')](_0xc1dd('0x1b'),_0x35139a,JSON[_0xc1dd('0xf')](_0x5e99a6));_0x6198a7(_0x5e99a6);})[_0xc1dd('0x15')](function(_0x228626){logger[_0xc1dd('0x10')]('CreateAttachment',_0x228626[_0xc1dd('0x12')],_0x35139a);_0x24446f(_0x4c3114[_0xc1dd('0x10')](0x1f4,_0x228626[_0xc1dd('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 27771ff..07d100b 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x3c7371,_0x4508f6){var _0x220298=function(_0x3d1d70){while(--_0x3d1d70){_0x3c7371['push'](_0x3c7371['shift']());}};_0x220298(++_0x4508f6);}(_0xadb5,0xad));var _0x5adb=function(_0xfa8d75,_0xfc2844){_0xfa8d75=_0xfa8d75-0x0;var _0xe03c2d=_0xadb5[_0xfa8d75];return _0xe03c2d;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file +var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x0b0e,0x187));var _0xe0b0=function(_0x51639a,_0x35f006){_0x51639a=_0x51639a-0x0;var _0x3abae4=_0x0b0e[_0x51639a];return _0x3abae4;};'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 96d93a4..32bd85b 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 _0xdc7a=['lodash','passport','passport-google-oauth20','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login','authenticate','google','/login','profile','email','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','find','map','emails','value','admin','user','agent','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','getLicense'];(function(_0x4d4576,_0x373606){var _0x437769=function(_0x4fee50){while(--_0x4fee50){_0x4d4576['push'](_0x4d4576['shift']());}};_0x437769(++_0x373606);}(_0xdc7a,0x8c));var _0xadc7=function(_0x174728,_0x205bb4){_0x174728=_0x174728-0x0;var _0x53e467=_0xdc7a[_0x174728];return _0x53e467;};'use strict';var _=require(_0xadc7('0x0'));var passport=require(_0xadc7('0x1'));var GoogleStrategy=require(_0xadc7('0x2'))['Strategy'];var moment=require('moment');var db=require(_0xadc7('0x3'))['db'];var config=require('../../config/environment');var signToken=require(_0xadc7('0x4'))[_0xadc7('0x5')];var utils=require(_0xadc7('0x6'));exports[_0xadc7('0x7')]=passport[_0xadc7('0x8')](_0xadc7('0x9'),{'failureRedirect':_0xadc7('0xa'),'scope':[_0xadc7('0xb'),_0xadc7('0xc')],'session':![]});exports['callback']=passport[_0xadc7('0x8')]('google',{'failureRedirect':_0xadc7('0xa'),'session':![]});passport[_0xadc7('0xd')](new GoogleStrategy({'clientID':config[_0xadc7('0x9')]?config['google'][_0xadc7('0xe')]:'id','clientSecret':config[_0xadc7('0x9')]?config[_0xadc7('0x9')][_0xadc7('0xf')]:_0xadc7('0x10'),'callbackURL':config[_0xadc7('0x9')]?config[_0xadc7('0x9')][_0xadc7('0x11')]:''},function(_0x342eb6,_0x3d8e59,_0x5b0a99,_0x5e7506){var _0x135394,_0x42c91c;return db[_0xadc7('0x12')][_0xadc7('0x13')]({'where':{'id':0x1},'attributes':[_0xadc7('0x14'),_0xadc7('0x15')],'raw':!![]})['then'](function(_0x416f64){_0x135394=_0x416f64;return db['User'][_0xadc7('0x16')]({'where':{'email':_[_0xadc7('0x17')](_0x5b0a99[_0xadc7('0x18')],_0xadc7('0x19')),'role':{'$or':[_0xadc7('0x1a'),_0xadc7('0x1b'),_0xadc7('0x1c')]}}});})[_0xadc7('0x1d')](function(_0x1fca4e){_0x42c91c=_0x1fca4e;if(_0x42c91c){if(_0x42c91c[_0xadc7('0x1e')]){return _0x5e7506(_0xadc7('0x1f'));}else if(_0x135394[_0xadc7('0x15')]>0x0){if(_0x42c91c['blocked']){if(moment(_0x42c91c['blockedAt'])[_0xadc7('0x20')](_0x135394[_0xadc7('0x15')],_0xadc7('0x21'))>moment()){return _0x5e7506(_0xadc7('0x1f'));}else{return utils['clearBlockUser'](_0x42c91c,0x0,![],null)['then'](function(){return utils[_0xadc7('0x22')](_0x42c91c);})[_0xadc7('0x1d')](function(){return _0x5e7506(null,_0x42c91c);});}}else{return utils['getLicense'](_0x42c91c)[_0xadc7('0x1d')](function(){return _0x5e7506(null,_0x42c91c);});}}else{return utils[_0xadc7('0x22')](_0x42c91c)['then'](function(){return _0x5e7506(null,_0x42c91c);});}}return _0x5e7506('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})['catch'](function(_0x42294a){_0x5e7506(_0x42294a);});})); \ No newline at end of file +var _0x0bf3=['../../config/utils','authenticate','google','/login','email','use','clientID','clientSecret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','find','emails','admin','agent','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','clearBlockUser','getLicense','catch','passport','Strategy','moment','../../mysqldb','../../components/auth/service','signToken'];(function(_0x2a3caa,_0x5239dc){var _0x44479a=function(_0x253c47){while(--_0x253c47){_0x2a3caa['push'](_0x2a3caa['shift']());}};_0x44479a(++_0x5239dc);}(_0x0bf3,0x1da));var _0x30bf=function(_0x2279ca,_0x59c102){_0x2279ca=_0x2279ca-0x0;var _0x41c616=_0x0bf3[_0x2279ca];return _0x41c616;};'use strict';var _=require('lodash');var passport=require(_0x30bf('0x0'));var GoogleStrategy=require('passport-google-oauth20')[_0x30bf('0x1')];var moment=require(_0x30bf('0x2'));var db=require(_0x30bf('0x3'))['db'];var config=require('../../config/environment');var signToken=require(_0x30bf('0x4'))[_0x30bf('0x5')];var utils=require(_0x30bf('0x6'));exports['login']=passport[_0x30bf('0x7')](_0x30bf('0x8'),{'failureRedirect':_0x30bf('0x9'),'scope':['profile',_0x30bf('0xa')],'session':![]});exports['callback']=passport['authenticate'](_0x30bf('0x8'),{'failureRedirect':_0x30bf('0x9'),'session':![]});passport[_0x30bf('0xb')](new GoogleStrategy({'clientID':config[_0x30bf('0x8')]?config[_0x30bf('0x8')][_0x30bf('0xc')]:'id','clientSecret':config['google']?config[_0x30bf('0x8')][_0x30bf('0xd')]:'secret','callbackURL':config[_0x30bf('0x8')]?config[_0x30bf('0x8')][_0x30bf('0xe')]:''},function(_0xf8f8c,_0x1bb702,_0x14586d,_0x5d93f3){var _0xb36731,_0x1ed0c8;return db[_0x30bf('0xf')][_0x30bf('0x10')]({'where':{'id':0x1},'attributes':[_0x30bf('0x11'),_0x30bf('0x12')],'raw':!![]})['then'](function(_0x1f1b70){_0xb36731=_0x1f1b70;return db['User'][_0x30bf('0x13')]({'where':{'email':_['map'](_0x14586d[_0x30bf('0x14')],'value'),'role':{'$or':[_0x30bf('0x15'),'user',_0x30bf('0x16')]}}});})[_0x30bf('0x17')](function(_0x10d7cd){_0x1ed0c8=_0x10d7cd;if(_0x1ed0c8){if(_0x1ed0c8[_0x30bf('0x18')]){return _0x5d93f3(_0x30bf('0x19'));}else if(_0xb36731['blockDuration']>0x0){if(_0x1ed0c8[_0x30bf('0x1a')]){if(moment(_0x1ed0c8[_0x30bf('0x1b')])[_0x30bf('0x1c')](_0xb36731[_0x30bf('0x12')],'minutes')>moment()){return _0x5d93f3('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils[_0x30bf('0x1d')](_0x1ed0c8,0x0,![],null)['then'](function(){return utils[_0x30bf('0x1e')](_0x1ed0c8);})[_0x30bf('0x17')](function(){return _0x5d93f3(null,_0x1ed0c8);});}}else{return utils[_0x30bf('0x1e')](_0x1ed0c8)['then'](function(){return _0x5d93f3(null,_0x1ed0c8);});}}else{return utils[_0x30bf('0x1e')](_0x1ed0c8)[_0x30bf('0x17')](function(){return _0x5d93f3(null,_0x1ed0c8);});}}return _0x5d93f3('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0x30bf('0x1f')](function(_0x329def){_0x5d93f3(_0x329def);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 07970ab..b8bdf6b 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 _0xacde=['isMiddleware','login','exports','express','passport','Router','./authGoogle.controller','../../components/auth/service','get','callback'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xacde,0x1cf));var _0xeacd=function(_0x5d160,_0xa4838e){_0x5d160=_0x5d160-0x0;var _0x1d180d=_0xacde[_0x5d160];return _0x1d180d;};'use strict';var express=require(_0xeacd('0x0'));var passport=require(_0xeacd('0x1'));var router=express[_0xeacd('0x2')]();var controller=require(_0xeacd('0x3'));var userController=require('../user/user.controller.js');var authService=require(_0xeacd('0x4'));router[_0xeacd('0x5')]('/',controller['login']);router['get']('/callback',controller[_0xeacd('0x6')],authService[_0xeacd('0x7')],userController[_0xeacd('0x8')],authService['setTokenCookie']);module[_0xeacd('0x9')]=router; \ No newline at end of file +var _0x046f=['login','/callback','callback','isMiddleware','express','passport','../user/user.controller.js','../../components/auth/service','get'];(function(_0x17fb84,_0x23d913){var _0x2d16eb=function(_0x357c39){while(--_0x357c39){_0x17fb84['push'](_0x17fb84['shift']());}};_0x2d16eb(++_0x23d913);}(_0x046f,0x1a2));var _0xf046=function(_0x1a60f8,_0x881a4e){_0x1a60f8=_0x1a60f8-0x0;var _0x1e5a4d=_0x046f[_0x1a60f8];return _0x1e5a4d;};'use strict';var express=require(_0xf046('0x0'));var passport=require(_0xf046('0x1'));var router=express['Router']();var controller=require('./authGoogle.controller');var userController=require(_0xf046('0x2'));var authService=require(_0xf046('0x3'));router[_0xf046('0x4')]('/',controller[_0xf046('0x5')]);router[_0xf046('0x4')](_0xf046('0x6'),controller[_0xf046('0x7')],authService[_0xf046('0x8')],userController[_0xf046('0x5')],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 31a90e8..c486a19 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 _0xc820=['moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','authenticate','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','email','service','Smtp','host','port','secure','auth','pass','merge','\x22%s\x22\x20<%s>','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','trim','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','headers','/reset/','send','reset','User','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','Password\x20reset!','use','passport','passport-local','Strategy','jayson/promise','lodash'];(function(_0x1e741c,_0x20e62d){var _0x2652b0=function(_0x220af5){while(--_0x220af5){_0x1e741c['push'](_0x1e741c['shift']());}};_0x2652b0(++_0x20e62d);}(_0xc820,0x13f));var _0x0c82=function(_0x3ad0d7,_0x22e61c){_0x3ad0d7=_0x3ad0d7-0x0;var _0x51cd6b=_0xc820[_0x3ad0d7];return _0x51cd6b;};'use strict';var util=require('util');var passport=require(_0x0c82('0x0'));var LocalStrategy=require(_0x0c82('0x1'))[_0x0c82('0x2')];var jayson=require(_0x0c82('0x3'));var _=require(_0x0c82('0x4'));var rs=require('randomstring');var moment=require(_0x0c82('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0x0c82('0x6'));var utils=require(_0x0c82('0x7'));var client=jayson[_0x0c82('0x8')][_0x0c82('0x9')]({'port':0x232b});function localAuthenticate(_0x28db5e,_0x23f783,_0x2d2567,_0x32e9ee){var _0x4689b7,_0x29fc55;return db[_0x0c82('0xa')][_0x0c82('0xb')]({'where':{'id':0x1},'attributes':[_0x0c82('0xc'),_0x0c82('0xd')],'raw':!![]})['then'](function(_0x8c568){_0x4689b7=_0x8c568;return _0x28db5e[_0x0c82('0xb')]({'attributes':['id',_0x0c82('0xe'),_0x0c82('0xf'),_0x0c82('0x10'),_0x0c82('0x11'),_0x0c82('0x12'),_0x0c82('0x13'),_0x0c82('0x14'),_0x0c82('0x15')],'where':{'name':_0x23f783,'role':{'$or':['admin',_0x0c82('0x16'),'agent']}}});})['then'](function(_0x2098ae){if(!_0x2098ae||_0x2098ae&&_0x2098ae[_0x0c82('0xe')]!==_0x23f783){throw new Error(_0x0c82('0x17'));}else{_0x29fc55=_0x2098ae;return _0x29fc55;}})[_0x0c82('0x18')](function(){_0x29fc55[_0x0c82('0x19')](_0x2d2567,function(_0x5bdcf6,_0x4610e5){var _0x17376c=_0x29fc55[_0x0c82('0x15')]+0x1;if(_0x5bdcf6){return _0x32e9ee(_0x5bdcf6);}else if(!_0x4610e5){if(_0x29fc55['disabled']){return _0x32e9ee(null,![],{'message':_0x0c82('0x17')});}else if(_0x4689b7['allowedLoginAttempts']>0x0){if(_0x29fc55[_0x0c82('0x13')]){if(_0x4689b7[_0x0c82('0xd')]>0x0){if(moment(_0x29fc55[_0x0c82('0x14')])['add'](_0x4689b7['blockDuration'],_0x0c82('0x1a'))>moment()){return _0x32e9ee(null,![],{'message':_0x0c82('0x17')});}else{return utils['clearBlockUser'](_0x29fc55,_0x17376c,![],null)[_0x0c82('0x18')](function(){return _0x32e9ee(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}else{return _0x32e9ee(null,![],{'message':_0x0c82('0x17')});}}else{if(_0x17376c>=_0x4689b7[_0x0c82('0xc')]){return utils['clearBlockUser'](_0x29fc55,0x0,!![],moment())[_0x0c82('0x18')](function(){return _0x32e9ee(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x0c82('0x1b')](_0x29fc55,_0x17376c,![],null)['then'](function(){return _0x32e9ee(null,![],{'message':_0x0c82('0x17')});});}}}else{return _0x32e9ee(null,![],{'message':_0x0c82('0x17')});}}else{if(_0x29fc55['disabled']){return _0x32e9ee(null,![],{'message':_0x0c82('0x17')});}else if(_0x4689b7[_0x0c82('0xc')]>0x0){if(_0x29fc55[_0x0c82('0x13')]){if(_0x4689b7['blockDuration']>0x0){if(moment(_0x29fc55[_0x0c82('0x14')])[_0x0c82('0x1c')](_0x4689b7[_0x0c82('0xd')],_0x0c82('0x1a'))>moment()){return _0x32e9ee(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x0c82('0x1b')](_0x29fc55,0x0,![],null)[_0x0c82('0x18')](function(){return utils[_0x0c82('0x1d')](_0x29fc55);})[_0x0c82('0x18')](function(){return _0x32e9ee(null,_0x29fc55);});}}else{return _0x32e9ee(null,![],{'message':_0x0c82('0x17')});}}else{return utils[_0x0c82('0x1b')](_0x29fc55,0x0,![],null)[_0x0c82('0x18')](function(){return utils['getLicense'](_0x29fc55);})[_0x0c82('0x18')](function(){return _0x32e9ee(null,_0x29fc55);})[_0x0c82('0x1e')](function(_0x4e7f33){return _0x32e9ee(null,![],_0x4e7f33);});}}else{if(_0x29fc55[_0x0c82('0x13')]){return _0x32e9ee(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['getLicense'](_0x29fc55)[_0x0c82('0x18')](function(){return _0x32e9ee(null,_0x29fc55);});}}}});})[_0x0c82('0x1e')](function(_0x224b66){return _0x32e9ee(null,![],_0x224b66);});}function sendServiceMail(_0x46490d){return db[_0x0c82('0x1f')][_0x0c82('0x20')]({'where':{'service':!![]},'attributes':['id','name',_0x0c82('0x21')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]})[_0x0c82('0x18')](function(_0x596232){if(!_0x596232){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x1ca7ee={'tls':{'rejectUnauthorized':![]}};if(_0x596232['Smtp']['service']){_0x1ca7ee[_0x0c82('0x22')]=_0x596232[_0x0c82('0x23')][_0x0c82('0x22')];}else{_0x1ca7ee[_0x0c82('0x24')]=_0x596232[_0x0c82('0x23')][_0x0c82('0x24')];_0x1ca7ee[_0x0c82('0x25')]=_0x596232[_0x0c82('0x23')][_0x0c82('0x25')];_0x1ca7ee[_0x0c82('0x26')]=_0x596232[_0x0c82('0x23')][_0x0c82('0x26')];}if(_0x596232['Smtp']['authentication']){_0x1ca7ee[_0x0c82('0x27')]={'user':_0x596232[_0x0c82('0x23')][_0x0c82('0x16')],'pass':_0x596232[_0x0c82('0x23')][_0x0c82('0x28')]};}var _0x175708={'account':_0x1ca7ee,'message':_[_0x0c82('0x29')]({'from':util['format'](_0x0c82('0x2a'),_0x596232[_0x0c82('0xe')],_0x596232['email']||_0x596232[_0x0c82('0x23')]['user'])},_0x46490d)};return client['request'](_0x0c82('0x2b'),_0x175708);})['then'](function(_0x4d86c2){if(_0x4d86c2[_0x0c82('0x2c')]){throw new Error(util[_0x0c82('0x2d')](_0x0c82('0x2e'),_0x4d86c2[_0x0c82('0x2c')][_0x0c82('0x2f')]||JSON[_0x0c82('0x30')](_0x4d86c2['error'])));}return!![];});}function handleError(_0x5a9cd1,_0x6ae129,_0x32597d){return _0x5a9cd1[_0x0c82('0x31')](_0x6ae129||0x1f4)['send']({'message':_0x32597d?_0x32597d[_0x0c82('0x2f')]||_0x32597d:''});}exports[_0x0c82('0x32')]=function(_0x572c14,_0x1c4bd7,_0x46d3d8){passport['authenticate'](_0x0c82('0x33'),function(_0x2da3dc,_0x41a569,_0x94f60e){var _0x5dcb49=_0x2da3dc||_0x94f60e;if(_0x5dcb49){return handleError(_0x1c4bd7,0x191,_0x5dcb49);}if(!_0x41a569){return handleError(_0x1c4bd7,0x194,{'message':_0x0c82('0x34')});}else{var _0x1b3048={'payload':{'id':_0x41a569['id'],'role':_0x41a569[_0x0c82('0x11')]},'options':{'expiresIn':0x15180}};return authService[_0x0c82('0x35')](_0x1b3048)[_0x0c82('0x18')](function(_0x2fa180){_0x1c4bd7[_0x0c82('0x36')]({'id':_0x41a569['id'],'token':_0x2fa180,'statusCall':'','isAlreadyLogged':_0x41a569['online']});});}})(_0x572c14,_0x1c4bd7,_0x46d3d8);};exports[_0x0c82('0x37')]=function(_0x18e98d,_0x534ec5,_0x1ad7f5){if(!_0x18e98d[_0x0c82('0x38')][_0x0c82('0x21')]){return handleError(_0x534ec5,0x1f4,{'message':_0x0c82('0x39')});}var _0x57ff5e=rs['generate']();_0x18e98d[_0x0c82('0x38')]['email']=_0x18e98d[_0x0c82('0x38')][_0x0c82('0x21')][_0x0c82('0x3a')]()['toLowerCase']();var _0x4b3257;return db[_0x0c82('0xa')][_0x0c82('0xb')]({'where':{'id':0x1},'attributes':[_0x0c82('0xc'),_0x0c82('0xd')],'raw':!![]})[_0x0c82('0x18')](function(_0x4b80f4){_0x4b3257=_0x4b80f4;return db['User'][_0x0c82('0x20')]({'where':{'email':_0x18e98d['body']['email']}});})['then'](function(_0xcdb966){if(!_0xcdb966){throw new Error(_0x0c82('0x3b'));}if(_0xcdb966['disabled']){throw new Error(_0x0c82('0x3c'));}if(_0xcdb966[_0x0c82('0x13')]){if(moment(_0xcdb966[_0x0c82('0x14')])['add'](_0x4b3257['blockDuration'],_0x0c82('0x1a'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0xcdb966[_0x0c82('0x13')]=![];_0xcdb966[_0x0c82('0x14')]=null;}}_0xcdb966[_0x0c82('0x3d')]=_0x57ff5e;_0xcdb966[_0x0c82('0x3e')]=Date[_0x0c82('0x3f')]()+0x36ee80;return _0xcdb966[_0x0c82('0x40')]();})[_0x0c82('0x18')](function(){return sendServiceMail({'to':_0x18e98d[_0x0c82('0x38')][_0x0c82('0x21')],'subject':_0x0c82('0x41'),'text':_0x0c82('0x42')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x18e98d[_0x0c82('0x43')][_0x0c82('0x24')]+_0x0c82('0x44')+_0x57ff5e+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x0c82('0x18')](function(){_0x534ec5[_0x0c82('0x31')](0xc8)[_0x0c82('0x45')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x16d118){return handleError(_0x534ec5,0x1f4,_0x16d118);});};exports[_0x0c82('0x46')]=function(_0x4e789d,_0x221efc,_0x5ccd68){return db[_0x0c82('0x47')][_0x0c82('0x20')]({'where':{'resetPasswordToken':_0x4e789d['params'][_0x0c82('0x48')],'resetPasswordExpires':{'$gt':Date[_0x0c82('0x3f')]()}}})[_0x0c82('0x18')](function(_0x401654){if(!_0x401654){throw new Error(_0x0c82('0x49'));}return db[_0x0c82('0xa')]['findOne']({'attributes':['id','securePassword',_0x0c82('0x4a'),_0x0c82('0x4b')]})[_0x0c82('0x18')](function(_0x1993b1){if(_0x1993b1[_0x0c82('0x4c')])authService[_0x0c82('0x4d')](_0x4e789d[_0x0c82('0x38')]['password']);if(!_0x1993b1['enforcePasswordHistory']||!_0x401654[_0x0c82('0x4e')])return _0x401654;authService['validatePasswordHistory'](_0x4e789d[_0x0c82('0x38')][_0x0c82('0xf')],_0x401654['previousPasswords'],_0x1993b1[_0x0c82('0x4b')]);return _0x401654;})[_0x0c82('0x18')](function(){_0x401654[_0x0c82('0xf')]=_0x4e789d[_0x0c82('0x38')]['password'];_0x401654[_0x0c82('0x3d')]=null;_0x401654[_0x0c82('0x3e')]=null;return _0x401654[_0x0c82('0x40')]();});})[_0x0c82('0x18')](function(){_0x221efc[_0x0c82('0x31')](0xc8)['send']({'message':_0x0c82('0x4f')});})[_0x0c82('0x1e')](function(_0x525673){return handleError(_0x221efc,0x1f4,_0x525673);});};passport[_0x0c82('0x50')](new LocalStrategy({'usernameField':_0x0c82('0xe'),'passwordField':_0x0c82('0xf')},function(_0x97889,_0x2b737a,_0x500e80){return localAuthenticate(db[_0x0c82('0x47')],_0x97889,_0x2b737a,_0x500e80);})); \ No newline at end of file +var _0xf6c6=['validatePasswordPattern','previousPasswords','validatePasswordHistory','use','passport','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','disabled','blocked','loginAttempts','admin','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockedAt','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','local','role','signToken','json','online','forgot','body','generate','trim','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','token','now','securePassword','enforcePasswordHistory','passwordHistoryLimit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xf6c6,0x154));var _0x6f6c=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xf6c6[_0x7e2eb0];return _0xd92de4;};'use strict';var util=require('util');var passport=require(_0x6f6c('0x0'));var LocalStrategy=require('passport-local')[_0x6f6c('0x1')];var jayson=require(_0x6f6c('0x2'));var _=require(_0x6f6c('0x3'));var rs=require('randomstring');var moment=require(_0x6f6c('0x4'));var db=require(_0x6f6c('0x5'))['db'];var authService=require(_0x6f6c('0x6'));var utils=require('../../config/utils');var client=jayson[_0x6f6c('0x7')][_0x6f6c('0x8')]({'port':0x232b});function localAuthenticate(_0x2b259e,_0x40a1c0,_0x3feb60,_0x1999c6){var _0x3cb15a,_0x2ef627;return db[_0x6f6c('0x9')][_0x6f6c('0xa')]({'where':{'id':0x1},'attributes':[_0x6f6c('0xb'),_0x6f6c('0xc')],'raw':!![]})[_0x6f6c('0xd')](function(_0x1acddc){_0x3cb15a=_0x1acddc;return _0x2b259e[_0x6f6c('0xa')]({'attributes':['id',_0x6f6c('0xe'),_0x6f6c('0xf'),_0x6f6c('0x10'),'role',_0x6f6c('0x11'),_0x6f6c('0x12'),'blockedAt',_0x6f6c('0x13')],'where':{'name':_0x40a1c0,'role':{'$or':[_0x6f6c('0x14'),'user','agent']}}});})[_0x6f6c('0xd')](function(_0x46b78e){if(!_0x46b78e||_0x46b78e&&_0x46b78e[_0x6f6c('0xe')]!==_0x40a1c0){throw new Error(_0x6f6c('0x15'));}else{_0x2ef627=_0x46b78e;return _0x2ef627;}})['then'](function(){_0x2ef627['authenticate'](_0x3feb60,function(_0x16f49e,_0x357dbd){var _0x1c9b6c=_0x2ef627[_0x6f6c('0x13')]+0x1;if(_0x16f49e){return _0x1999c6(_0x16f49e);}else if(!_0x357dbd){if(_0x2ef627[_0x6f6c('0x11')]){return _0x1999c6(null,![],{'message':_0x6f6c('0x15')});}else if(_0x3cb15a[_0x6f6c('0xb')]>0x0){if(_0x2ef627[_0x6f6c('0x12')]){if(_0x3cb15a[_0x6f6c('0xc')]>0x0){if(moment(_0x2ef627[_0x6f6c('0x16')])[_0x6f6c('0x17')](_0x3cb15a['blockDuration'],_0x6f6c('0x18'))>moment()){return _0x1999c6(null,![],{'message':_0x6f6c('0x15')});}else{return utils['clearBlockUser'](_0x2ef627,_0x1c9b6c,![],null)[_0x6f6c('0xd')](function(){return _0x1999c6(null,![],{'message':_0x6f6c('0x15')});});}}else{return _0x1999c6(null,![],{'message':_0x6f6c('0x15')});}}else{if(_0x1c9b6c>=_0x3cb15a[_0x6f6c('0xb')]){return utils[_0x6f6c('0x19')](_0x2ef627,0x0,!![],moment())[_0x6f6c('0xd')](function(){return _0x1999c6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x2ef627,_0x1c9b6c,![],null)[_0x6f6c('0xd')](function(){return _0x1999c6(null,![],{'message':_0x6f6c('0x15')});});}}}else{return _0x1999c6(null,![],{'message':_0x6f6c('0x15')});}}else{if(_0x2ef627[_0x6f6c('0x11')]){return _0x1999c6(null,![],{'message':_0x6f6c('0x15')});}else if(_0x3cb15a[_0x6f6c('0xb')]>0x0){if(_0x2ef627[_0x6f6c('0x12')]){if(_0x3cb15a['blockDuration']>0x0){if(moment(_0x2ef627[_0x6f6c('0x16')])[_0x6f6c('0x17')](_0x3cb15a[_0x6f6c('0xc')],_0x6f6c('0x18'))>moment()){return _0x1999c6(null,![],{'message':_0x6f6c('0x15')});}else{return utils['clearBlockUser'](_0x2ef627,0x0,![],null)['then'](function(){return utils[_0x6f6c('0x1a')](_0x2ef627);})[_0x6f6c('0xd')](function(){return _0x1999c6(null,_0x2ef627);});}}else{return _0x1999c6(null,![],{'message':_0x6f6c('0x15')});}}else{return utils[_0x6f6c('0x19')](_0x2ef627,0x0,![],null)[_0x6f6c('0xd')](function(){return utils['getLicense'](_0x2ef627);})['then'](function(){return _0x1999c6(null,_0x2ef627);})[_0x6f6c('0x1b')](function(_0x183e49){return _0x1999c6(null,![],_0x183e49);});}}else{if(_0x2ef627[_0x6f6c('0x12')]){return _0x1999c6(null,![],{'message':_0x6f6c('0x15')});}else{return utils[_0x6f6c('0x1a')](_0x2ef627)[_0x6f6c('0xd')](function(){return _0x1999c6(null,_0x2ef627);});}}}});})[_0x6f6c('0x1b')](function(_0x22ef30){return _0x1999c6(null,![],_0x22ef30);});}function sendServiceMail(_0x546dd8){return db[_0x6f6c('0x1c')][_0x6f6c('0x1d')]({'where':{'service':!![]},'attributes':['id',_0x6f6c('0xe'),_0x6f6c('0x1e')],'include':[{'model':db['MailServerOut'],'as':_0x6f6c('0x1f')}]})[_0x6f6c('0xd')](function(_0x398470){if(!_0x398470){throw new Error(_0x6f6c('0x20'));}var _0x1b34e8={'tls':{'rejectUnauthorized':![]}};if(_0x398470[_0x6f6c('0x1f')][_0x6f6c('0x21')]){_0x1b34e8['service']=_0x398470['Smtp'][_0x6f6c('0x21')];}else{_0x1b34e8['host']=_0x398470[_0x6f6c('0x1f')][_0x6f6c('0x22')];_0x1b34e8['port']=_0x398470[_0x6f6c('0x1f')][_0x6f6c('0x23')];_0x1b34e8[_0x6f6c('0x24')]=_0x398470['Smtp']['secure'];}if(_0x398470[_0x6f6c('0x1f')][_0x6f6c('0x25')]){_0x1b34e8[_0x6f6c('0x26')]={'user':_0x398470[_0x6f6c('0x1f')]['user'],'pass':_0x398470[_0x6f6c('0x1f')][_0x6f6c('0x27')]};}var _0x3e032b={'account':_0x1b34e8,'message':_[_0x6f6c('0x28')]({'from':util[_0x6f6c('0x29')](_0x6f6c('0x2a'),_0x398470[_0x6f6c('0xe')],_0x398470[_0x6f6c('0x1e')]||_0x398470[_0x6f6c('0x1f')]['user'])},_0x546dd8)};return client[_0x6f6c('0x2b')]('SendMail',_0x3e032b);})[_0x6f6c('0xd')](function(_0x461b18){if(_0x461b18[_0x6f6c('0x2c')]){throw new Error(util['format'](_0x6f6c('0x2d'),_0x461b18[_0x6f6c('0x2c')][_0x6f6c('0x2e')]||JSON[_0x6f6c('0x2f')](_0x461b18['error'])));}return!![];});}function handleError(_0x3ba588,_0x892313,_0x535a71){return _0x3ba588[_0x6f6c('0x30')](_0x892313||0x1f4)[_0x6f6c('0x31')]({'message':_0x535a71?_0x535a71[_0x6f6c('0x2e')]||_0x535a71:''});}exports['login']=function(_0x4bf0ba,_0x1f0ab7,_0xc90db3){passport['authenticate'](_0x6f6c('0x32'),function(_0x5bab5f,_0x1ba2fe,_0x3aa904){var _0xa35d26=_0x5bab5f||_0x3aa904;if(_0xa35d26){return handleError(_0x1f0ab7,0x191,_0xa35d26);}if(!_0x1ba2fe){return handleError(_0x1f0ab7,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x21020b={'payload':{'id':_0x1ba2fe['id'],'role':_0x1ba2fe[_0x6f6c('0x33')]},'options':{'expiresIn':0x15180}};return authService[_0x6f6c('0x34')](_0x21020b)[_0x6f6c('0xd')](function(_0x224c70){_0x1f0ab7[_0x6f6c('0x35')]({'id':_0x1ba2fe['id'],'token':_0x224c70,'statusCall':'','isAlreadyLogged':_0x1ba2fe[_0x6f6c('0x36')]});});}})(_0x4bf0ba,_0x1f0ab7,_0xc90db3);};exports[_0x6f6c('0x37')]=function(_0x1e310f,_0x3cea7c,_0x55047f){if(!_0x1e310f[_0x6f6c('0x38')]['email']){return handleError(_0x3cea7c,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x1b98f5=rs[_0x6f6c('0x39')]();_0x1e310f['body'][_0x6f6c('0x1e')]=_0x1e310f[_0x6f6c('0x38')][_0x6f6c('0x1e')][_0x6f6c('0x3a')]()['toLowerCase']();var _0x221343;return db['Setting'][_0x6f6c('0xa')]({'where':{'id':0x1},'attributes':[_0x6f6c('0xb'),'blockDuration'],'raw':!![]})[_0x6f6c('0xd')](function(_0x3bb475){_0x221343=_0x3bb475;return db[_0x6f6c('0x3b')]['find']({'where':{'email':_0x1e310f['body']['email']}});})[_0x6f6c('0xd')](function(_0x23daeb){if(!_0x23daeb){throw new Error(_0x6f6c('0x3c'));}if(_0x23daeb[_0x6f6c('0x11')]){throw new Error(_0x6f6c('0x3d'));}if(_0x23daeb[_0x6f6c('0x12')]){if(moment(_0x23daeb['blockedAt'])[_0x6f6c('0x17')](_0x221343['blockDuration'],'minutes')>moment()){throw new Error(_0x6f6c('0x3e'));}else{_0x23daeb[_0x6f6c('0x12')]=![];_0x23daeb['blockedAt']=null;}}_0x23daeb[_0x6f6c('0x3f')]=_0x1b98f5;_0x23daeb[_0x6f6c('0x40')]=Date['now']()+0x36ee80;return _0x23daeb[_0x6f6c('0x41')]();})[_0x6f6c('0xd')](function(){return sendServiceMail({'to':_0x1e310f[_0x6f6c('0x38')][_0x6f6c('0x1e')],'subject':_0x6f6c('0x42'),'text':_0x6f6c('0x43')+_0x6f6c('0x44')+_0x6f6c('0x45')+_0x1e310f[_0x6f6c('0x46')][_0x6f6c('0x22')]+_0x6f6c('0x47')+_0x1b98f5+'\x0a\x0a'+_0x6f6c('0x48')});})[_0x6f6c('0xd')](function(){_0x3cea7c[_0x6f6c('0x30')](0xc8)[_0x6f6c('0x31')]({'message':_0x6f6c('0x49')});})['catch'](function(_0x4c0ac6){return handleError(_0x3cea7c,0x1f4,_0x4c0ac6);});};exports[_0x6f6c('0x4a')]=function(_0x321576,_0x52b365,_0x41ca85){return db[_0x6f6c('0x3b')][_0x6f6c('0x1d')]({'where':{'resetPasswordToken':_0x321576['params'][_0x6f6c('0x4b')],'resetPasswordExpires':{'$gt':Date[_0x6f6c('0x4c')]()}}})[_0x6f6c('0xd')](function(_0x183b44){if(!_0x183b44){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db['Setting']['findOne']({'attributes':['id',_0x6f6c('0x4d'),_0x6f6c('0x4e'),_0x6f6c('0x4f')]})[_0x6f6c('0xd')](function(_0x3d0cc5){if(_0x3d0cc5[_0x6f6c('0x4d')])authService[_0x6f6c('0x50')](_0x321576[_0x6f6c('0x38')][_0x6f6c('0xf')]);if(!_0x3d0cc5[_0x6f6c('0x4e')]||!_0x183b44[_0x6f6c('0x51')])return _0x183b44;authService[_0x6f6c('0x52')](_0x321576[_0x6f6c('0x38')][_0x6f6c('0xf')],_0x183b44[_0x6f6c('0x51')],_0x3d0cc5['passwordHistoryLimit']);return _0x183b44;})[_0x6f6c('0xd')](function(){_0x183b44[_0x6f6c('0xf')]=_0x321576[_0x6f6c('0x38')][_0x6f6c('0xf')];_0x183b44[_0x6f6c('0x3f')]=null;_0x183b44[_0x6f6c('0x40')]=null;return _0x183b44['save']();});})[_0x6f6c('0xd')](function(){_0x52b365[_0x6f6c('0x30')](0xc8)[_0x6f6c('0x31')]({'message':'Password\x20reset!'});})['catch'](function(_0x3e1766){return handleError(_0x52b365,0x1f4,_0x3e1766);});};passport[_0x6f6c('0x53')](new LocalStrategy({'usernameField':_0x6f6c('0xe'),'passwordField':'password'},function(_0x2ca429,_0x2e1232,_0x5d4193){return localAuthenticate(db[_0x6f6c('0x3b')],_0x2ca429,_0x2e1232,_0x5d4193);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index bb4d9cd..6536163 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 _0x2925=['exports','express','Router','./authLocal.controller','post','forgot','reset'];(function(_0x217931,_0x2c6669){var _0x20f8d0=function(_0x144281){while(--_0x144281){_0x217931['push'](_0x217931['shift']());}};_0x20f8d0(++_0x2c6669);}(_0x2925,0x71));var _0x5292=function(_0x1d094b,_0x251681){_0x1d094b=_0x1d094b-0x0;var _0x1bf90b=_0x2925[_0x1d094b];return _0x1bf90b;};'use strict';var express=require(_0x5292('0x0'));var router=express[_0x5292('0x1')]();var controller=require(_0x5292('0x2'));router['post']('/',controller['login']);router[_0x5292('0x3')]('/forgot',controller[_0x5292('0x4')]);router['post']('/reset/:token',controller[_0x5292('0x5')]);module[_0x5292('0x6')]=router; \ No newline at end of file +var _0xf4e1=['exports','express','./authLocal.controller','post','login','/forgot','/reset/:token'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0xf4e1,0x86));var _0x1f4e=function(_0x2fea36,_0x1b5629){_0x2fea36=_0x2fea36-0x0;var _0x250d6e=_0xf4e1[_0x2fea36];return _0x250d6e;};'use strict';var express=require(_0x1f4e('0x0'));var router=express['Router']();var controller=require(_0x1f4e('0x1'));router[_0x1f4e('0x2')]('/',controller[_0x1f4e('0x3')]);router[_0x1f4e('0x2')](_0x1f4e('0x4'),controller['forgot']);router[_0x1f4e('0x2')](_0x1f4e('0x5'),controller['reset']);module[_0x1f4e('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index b76e984..759ee46 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 _0xe10e=['BOOLEAN','sequelize','STRING'];(function(_0x3a6b68,_0x8d8c95){var _0x45e882=function(_0x10060d){while(--_0x10060d){_0x3a6b68['push'](_0x3a6b68['shift']());}};_0x45e882(++_0x8d8c95);}(_0xe10e,0xe2));var _0xee10=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0xe10e[_0xd0a847];return _0x2536ec;};'use strict';var Sequelize=require(_0xee10('0x0'));module['exports']={'name':{'type':Sequelize[_0xee10('0x1')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xee10('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file +var _0x405c=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x49524b,_0x2f3ac0){var _0x5626b3=function(_0x4ed13d){while(--_0x4ed13d){_0x49524b['push'](_0x49524b['shift']());}};_0x5626b3(++_0x2f3ac0);}(_0x405c,0x11d));var _0xc405=function(_0x3146ea,_0x1c9e52){_0x3146ea=_0x3146ea-0x0;var _0x36acd6=_0x405c[_0x3146ea];return _0x36acd6;};'use strict';var Sequelize=require(_0xc405('0x0'));module[_0xc405('0x1')]={'name':{'type':Sequelize[_0xc405('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc405('0x2')]},'status':{'type':Sequelize[_0xc405('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xc405('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 cc75003..272a870 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 _0xc418=['query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','then','includeAll','include','rows','show','params','find','catch','create','body','addConditions','Condition','ids','omit','getConditions','addActions','Action','findOne','getActions','hasOwnProperty','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/license/hardware','api','../../config/environment','../../config/license/util','end','status','json','undefined','count','offset','limit','set','apply','reject','update','destroy','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','keys'];(function(_0x2f1677,_0x668f){var _0x359eff=function(_0x3fcc1e){while(--_0x3fcc1e){_0x2f1677['push'](_0x2f1677['shift']());}};_0x359eff(++_0x668f);}(_0xc418,0x17a));var _0x8c41=function(_0x13c782,_0x17bb19){_0x13c782=_0x13c782-0x0;var _0x539ad2=_0xc418[_0x13c782];return _0x539ad2;};'use strict';var emlformat=require(_0x8c41('0x0'));var rimraf=require(_0x8c41('0x1'));var zipdir=require(_0x8c41('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8c41('0x3'));var BPromise=require(_0x8c41('0x4'));var Mustache=require(_0x8c41('0x5'));var util=require(_0x8c41('0x6'));var path=require(_0x8c41('0x7'));var sox=require(_0x8c41('0x8'));var csv=require(_0x8c41('0x9'));var ejs=require(_0x8c41('0xa'));var fs=require('fs');var fs_extra=require(_0x8c41('0xb'));var _=require(_0x8c41('0xc'));var squel=require(_0x8c41('0xd'));var crypto=require(_0x8c41('0xe'));var jsforce=require(_0x8c41('0xf'));var deskjs=require(_0x8c41('0x10'));var toCsv=require(_0x8c41('0x9'));var querystring=require(_0x8c41('0x11'));var Papa=require(_0x8c41('0x12'));var Redis=require(_0x8c41('0x13'));var authService=require(_0x8c41('0x14'));var qs=require(_0x8c41('0x15'));var as=require(_0x8c41('0x16'));var hardwareService=require(_0x8c41('0x17'));var logger=require('../../config/logger')(_0x8c41('0x18'));var utils=require('../../config/utils');var config=require(_0x8c41('0x19'));var licenseUtil=require(_0x8c41('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x246c74,_0x412a05){_0x412a05=_0x412a05||0xcc;return function(_0x92c162){if(_0x92c162){return _0x246c74['sendStatus'](_0x412a05);}return _0x246c74['status'](_0x412a05)[_0x8c41('0x1b')]();};}function respondWithResult(_0x4c2a1f,_0x348559){_0x348559=_0x348559||0xc8;return function(_0x16bc3f){if(_0x16bc3f){return _0x4c2a1f[_0x8c41('0x1c')](_0x348559)[_0x8c41('0x1d')](_0x16bc3f);}};}function respondWithFilteredResult(_0x335eed,_0x1642f0){return function(_0xc29bbd){if(_0xc29bbd){var _0x47069a=typeof _0x1642f0['offset']===_0x8c41('0x1e')&&typeof _0x1642f0['limit']===_0x8c41('0x1e');var _0x4cafb3=_0xc29bbd[_0x8c41('0x1f')];var _0x51a344=_0x47069a?0x0:_0x1642f0[_0x8c41('0x20')];var _0x36d70f=_0x47069a?_0xc29bbd[_0x8c41('0x1f')]:_0x1642f0[_0x8c41('0x20')]+_0x1642f0[_0x8c41('0x21')];var _0x4ebee1;if(_0x36d70f>=_0x4cafb3){_0x36d70f=_0x4cafb3;_0x4ebee1=0xc8;}else{_0x4ebee1=0xce;}_0x335eed[_0x8c41('0x1c')](_0x4ebee1);return _0x335eed[_0x8c41('0x22')]('Content-Range',_0x51a344+'-'+_0x36d70f+'/'+_0x4cafb3)['json'](_0xc29bbd);}return null;};}function patchUpdates(_0x276f87){return function(_0x1c28d5){try{jsonpatch[_0x8c41('0x23')](_0x1c28d5,_0x276f87,!![]);}catch(_0x2eef71){return BPromise[_0x8c41('0x24')](_0x2eef71);}return _0x1c28d5['save']();};}function saveUpdates(_0x48d141,_0x14682c){return function(_0x3ef865){if(_0x3ef865){return _0x3ef865[_0x8c41('0x25')](_0x48d141)['then'](function(_0x2f0fc4){return _0x2f0fc4;});}return null;};}function removeEntity(_0x528ae6,_0x48b981){return function(_0x556a38){if(_0x556a38){return _0x556a38[_0x8c41('0x26')]()['then'](function(){_0x528ae6[_0x8c41('0x1c')](0xcc)[_0x8c41('0x1b')]();});}};}function handleEntityNotFound(_0x10bfd6,_0x51c543){return function(_0x3b9494){if(!_0x3b9494){_0x10bfd6['sendStatus'](0x194);}return _0x3b9494;};}function handleError(_0x462b5e,_0x2d4e7f){_0x2d4e7f=_0x2d4e7f||0x1f4;return function(_0x44b91e){logger[_0x8c41('0x27')](_0x44b91e[_0x8c41('0x28')]);if(_0x44b91e[_0x8c41('0x29')]){delete _0x44b91e['name'];}_0x462b5e[_0x8c41('0x1c')](_0x2d4e7f)[_0x8c41('0x2a')](_0x44b91e);};}exports[_0x8c41('0x2b')]=function(_0x52ef69,_0x51e2d1){var _0x3a7ef9={},_0x1f486b={},_0x542ec4={'count':0x0,'rows':[]};var _0x27664b=_[_0x8c41('0x2c')](db[_0x8c41('0x2d')][_0x8c41('0x2e')],function(_0x33a1df){return{'name':_0x33a1df[_0x8c41('0x2f')],'type':_0x33a1df[_0x8c41('0x30')][_0x8c41('0x31')]};});_0x1f486b[_0x8c41('0x32')]=_['map'](_0x27664b,_0x8c41('0x29'));_0x1f486b['query']=_[_0x8c41('0x33')](_0x52ef69[_0x8c41('0x34')]);_0x1f486b[_0x8c41('0x35')]=_[_0x8c41('0x36')](_0x1f486b[_0x8c41('0x32')],_0x1f486b['query']);_0x3a7ef9[_0x8c41('0x37')]=_[_0x8c41('0x36')](_0x1f486b[_0x8c41('0x32')],qs[_0x8c41('0x38')](_0x52ef69['query'][_0x8c41('0x38')]));_0x3a7ef9[_0x8c41('0x37')]=_0x3a7ef9['attributes'][_0x8c41('0x39')]?_0x3a7ef9[_0x8c41('0x37')]:_0x1f486b[_0x8c41('0x32')];if(!_0x52ef69[_0x8c41('0x34')]['hasOwnProperty'](_0x8c41('0x3a'))){_0x3a7ef9[_0x8c41('0x21')]=qs[_0x8c41('0x21')](_0x52ef69[_0x8c41('0x34')]['limit']);_0x3a7ef9['offset']=qs[_0x8c41('0x20')](_0x52ef69[_0x8c41('0x34')][_0x8c41('0x20')]);}_0x3a7ef9[_0x8c41('0x3b')]=qs[_0x8c41('0x3c')](_0x52ef69[_0x8c41('0x34')][_0x8c41('0x3c')]);_0x3a7ef9[_0x8c41('0x3d')]=qs[_0x8c41('0x35')](_[_0x8c41('0x3e')](_0x52ef69[_0x8c41('0x34')],_0x1f486b[_0x8c41('0x35')]),_0x27664b);if(_0x52ef69[_0x8c41('0x34')][_0x8c41('0x3f')]){_0x3a7ef9[_0x8c41('0x3d')]=_[_0x8c41('0x40')](_0x3a7ef9[_0x8c41('0x3d')],{'$or':_[_0x8c41('0x2c')](_0x27664b,function(_0x403e82){if(_0x403e82[_0x8c41('0x30')]!=='VIRTUAL'){var _0x4e59df={};_0x4e59df[_0x403e82[_0x8c41('0x29')]]={'$like':'%'+_0x52ef69['query'][_0x8c41('0x3f')]+'%'};return _0x4e59df;}})});}_0x3a7ef9=_[_0x8c41('0x40')]({},_0x3a7ef9,_0x52ef69[_0x8c41('0x41')]);var _0x1bc18d={'where':_0x3a7ef9[_0x8c41('0x3d')]};return db['Automation'][_0x8c41('0x1f')](_0x1bc18d)[_0x8c41('0x42')](function(_0x37c05c){_0x542ec4[_0x8c41('0x1f')]=_0x37c05c;if(_0x52ef69['query'][_0x8c41('0x43')]){_0x3a7ef9[_0x8c41('0x44')]=[{'all':!![]}];}return db[_0x8c41('0x2d')]['findAll'](_0x3a7ef9);})['then'](function(_0x3d2bbb){_0x542ec4[_0x8c41('0x45')]=_0x3d2bbb;return _0x542ec4;})[_0x8c41('0x42')](respondWithFilteredResult(_0x51e2d1,_0x3a7ef9))['catch'](handleError(_0x51e2d1,null));};exports[_0x8c41('0x46')]=function(_0x1b9197,_0x525c2d){var _0x58d211={'raw':![],'where':{'id':_0x1b9197[_0x8c41('0x47')]['id']}},_0x25a675={};_0x25a675[_0x8c41('0x32')]=_['keys'](db[_0x8c41('0x2d')][_0x8c41('0x2e')]);_0x25a675[_0x8c41('0x34')]=_[_0x8c41('0x33')](_0x1b9197[_0x8c41('0x34')]);_0x25a675[_0x8c41('0x35')]=_[_0x8c41('0x36')](_0x25a675[_0x8c41('0x32')],_0x25a675[_0x8c41('0x34')]);_0x58d211[_0x8c41('0x37')]=_['intersection'](_0x25a675[_0x8c41('0x32')],qs[_0x8c41('0x38')](_0x1b9197[_0x8c41('0x34')][_0x8c41('0x38')]));_0x58d211['attributes']=_0x58d211[_0x8c41('0x37')][_0x8c41('0x39')]?_0x58d211['attributes']:_0x25a675[_0x8c41('0x32')];if(_0x1b9197[_0x8c41('0x34')]['includeAll']){_0x58d211[_0x8c41('0x44')]=[{'all':!![]}];}_0x58d211=_[_0x8c41('0x40')]({},_0x58d211,_0x1b9197[_0x8c41('0x41')]);return db[_0x8c41('0x2d')][_0x8c41('0x48')](_0x58d211)[_0x8c41('0x42')](handleEntityNotFound(_0x525c2d,null))[_0x8c41('0x42')](respondWithResult(_0x525c2d,null))[_0x8c41('0x49')](handleError(_0x525c2d,null));};exports['create']=function(_0xa410c7,_0x302bea){return db['Automation'][_0x8c41('0x4a')](_0xa410c7[_0x8c41('0x4b')],{})[_0x8c41('0x42')](respondWithResult(_0x302bea,0xc9))[_0x8c41('0x49')](handleError(_0x302bea,null));};exports[_0x8c41('0x25')]=function(_0x526da9,_0x58febf){if(_0x526da9['body']['id']){delete _0x526da9['body']['id'];}return db[_0x8c41('0x2d')][_0x8c41('0x48')]({'where':{'id':_0x526da9[_0x8c41('0x47')]['id']}})['then'](handleEntityNotFound(_0x58febf,null))['then'](saveUpdates(_0x526da9[_0x8c41('0x4b')],null))[_0x8c41('0x42')](respondWithResult(_0x58febf,null))[_0x8c41('0x49')](handleError(_0x58febf,null));};exports[_0x8c41('0x26')]=function(_0xaa7815,_0x4de7c9){return db[_0x8c41('0x2d')]['find']({'where':{'id':_0xaa7815[_0x8c41('0x47')]['id']}})['then'](handleEntityNotFound(_0x4de7c9,null))[_0x8c41('0x42')](removeEntity(_0x4de7c9,null))['catch'](handleError(_0x4de7c9,null));};exports[_0x8c41('0x4c')]=function(_0x5f3565,_0x52722a,_0x3874c9){return db[_0x8c41('0x4d')][_0x8c41('0x48')]({'where':{'id':_0x5f3565[_0x8c41('0x47')]['id']}})[_0x8c41('0x42')](handleEntityNotFound(_0x52722a,null))[_0x8c41('0x42')](function(_0x573ae2){if(_0x573ae2){return _0x573ae2[_0x8c41('0x4c')](_0x5f3565['body'][_0x8c41('0x4e')],_[_0x8c41('0x4f')](_0x5f3565['body'],['ids','id'])||{});}})[_0x8c41('0x42')](respondWithResult(_0x52722a,null))[_0x8c41('0x49')](handleError(_0x52722a,null));};exports[_0x8c41('0x50')]=function(_0x3565e7,_0x5ecb6,_0x136444){var _0x38721e={};var _0x5e0f1d={};var _0x270b1b;var _0x3f2eb6;return db['Automation']['findOne']({'where':{'id':_0x3565e7[_0x8c41('0x47')]['id']}})['then'](handleEntityNotFound(_0x5ecb6,null))['then'](function(_0x3201ea){if(_0x3201ea){_0x270b1b=_0x3201ea;_0x5e0f1d[_0x8c41('0x32')]=_['keys'](db[_0x8c41('0x4d')][_0x8c41('0x2e')]);_0x5e0f1d[_0x8c41('0x34')]=_['keys'](_0x3565e7['query']);_0x5e0f1d[_0x8c41('0x35')]=_[_0x8c41('0x36')](_0x5e0f1d[_0x8c41('0x32')],_0x5e0f1d[_0x8c41('0x34')]);_0x38721e['attributes']=_['intersection'](_0x5e0f1d[_0x8c41('0x32')],qs['fields'](_0x3565e7[_0x8c41('0x34')][_0x8c41('0x38')]));_0x38721e[_0x8c41('0x37')]=_0x38721e[_0x8c41('0x37')][_0x8c41('0x39')]?_0x38721e[_0x8c41('0x37')]:_0x5e0f1d['model'];_0x38721e['order']=qs['sort'](_0x3565e7[_0x8c41('0x34')][_0x8c41('0x3c')]);_0x38721e[_0x8c41('0x3d')]=qs[_0x8c41('0x35')](_[_0x8c41('0x3e')](_0x3565e7['query'],_0x5e0f1d[_0x8c41('0x35')]));if(_0x3565e7[_0x8c41('0x34')][_0x8c41('0x3f')]){_0x38721e[_0x8c41('0x3d')]=_[_0x8c41('0x40')](_0x38721e[_0x8c41('0x3d')],{'$or':_[_0x8c41('0x2c')](_0x38721e[_0x8c41('0x37')],function(_0x15d619){var _0x2b86d3={};_0x2b86d3[_0x15d619]={'$like':'%'+_0x3565e7[_0x8c41('0x34')][_0x8c41('0x3f')]+'%'};return _0x2b86d3;})});}_0x38721e=_[_0x8c41('0x40')]({},_0x38721e,_0x3565e7[_0x8c41('0x41')]);return _0x270b1b[_0x8c41('0x50')](_0x38721e);}})[_0x8c41('0x42')](function(_0x32aa91){if(_0x32aa91){_0x3f2eb6=_0x32aa91[_0x8c41('0x39')];if(!_0x3565e7['query']['hasOwnProperty'](_0x8c41('0x3a'))){_0x38721e['limit']=qs[_0x8c41('0x21')](_0x3565e7['query'][_0x8c41('0x21')]);_0x38721e['offset']=qs[_0x8c41('0x20')](_0x3565e7[_0x8c41('0x34')][_0x8c41('0x20')]);}return _0x270b1b[_0x8c41('0x50')](_0x38721e);}})[_0x8c41('0x42')](function(_0x371582){if(_0x371582){return _0x371582?{'count':_0x3f2eb6,'rows':_0x371582}:null;}})['then'](respondWithResult(_0x5ecb6,null))['catch'](handleError(_0x5ecb6,null));};exports[_0x8c41('0x51')]=function(_0x158307,_0x5d1768,_0x291546){return db[_0x8c41('0x52')][_0x8c41('0x48')]({'where':{'id':_0x158307['params']['id']}})[_0x8c41('0x42')](handleEntityNotFound(_0x5d1768,null))[_0x8c41('0x42')](function(_0x82f8b7){if(_0x82f8b7){return _0x82f8b7[_0x8c41('0x51')](_0x158307[_0x8c41('0x4b')]['ids'],_[_0x8c41('0x4f')](_0x158307[_0x8c41('0x4b')],[_0x8c41('0x4e'),'id'])||{});}})[_0x8c41('0x42')](respondWithResult(_0x5d1768,null))[_0x8c41('0x49')](handleError(_0x5d1768,null));};exports['getActions']=function(_0x545c66,_0xa85e76,_0x5130d1){var _0x36518a={};var _0x2ff1c0={};var _0x23f15c;var _0x42a22f;return db[_0x8c41('0x2d')][_0x8c41('0x53')]({'where':{'id':_0x545c66['params']['id']}})[_0x8c41('0x42')](handleEntityNotFound(_0xa85e76,null))[_0x8c41('0x42')](function(_0x2e52c4){if(_0x2e52c4){_0x23f15c=_0x2e52c4;_0x2ff1c0[_0x8c41('0x32')]=_[_0x8c41('0x33')](db['Action'][_0x8c41('0x2e')]);_0x2ff1c0[_0x8c41('0x34')]=_[_0x8c41('0x33')](_0x545c66[_0x8c41('0x34')]);_0x2ff1c0[_0x8c41('0x35')]=_[_0x8c41('0x36')](_0x2ff1c0[_0x8c41('0x32')],_0x2ff1c0[_0x8c41('0x34')]);_0x36518a[_0x8c41('0x37')]=_[_0x8c41('0x36')](_0x2ff1c0[_0x8c41('0x32')],qs[_0x8c41('0x38')](_0x545c66[_0x8c41('0x34')]['fields']));_0x36518a['attributes']=_0x36518a[_0x8c41('0x37')][_0x8c41('0x39')]?_0x36518a[_0x8c41('0x37')]:_0x2ff1c0[_0x8c41('0x32')];_0x36518a[_0x8c41('0x3b')]=qs[_0x8c41('0x3c')](_0x545c66[_0x8c41('0x34')][_0x8c41('0x3c')]);_0x36518a['where']=qs[_0x8c41('0x35')](_[_0x8c41('0x3e')](_0x545c66[_0x8c41('0x34')],_0x2ff1c0['filters']));if(_0x545c66[_0x8c41('0x34')][_0x8c41('0x3f')]){_0x36518a['where']=_[_0x8c41('0x40')](_0x36518a[_0x8c41('0x3d')],{'$or':_['map'](_0x36518a['attributes'],function(_0x3e87d5){var _0x354df2={};_0x354df2[_0x3e87d5]={'$like':'%'+_0x545c66[_0x8c41('0x34')][_0x8c41('0x3f')]+'%'};return _0x354df2;})});}_0x36518a=_[_0x8c41('0x40')]({},_0x36518a,_0x545c66[_0x8c41('0x41')]);return _0x23f15c[_0x8c41('0x54')](_0x36518a);}})[_0x8c41('0x42')](function(_0x58f93e){if(_0x58f93e){_0x42a22f=_0x58f93e[_0x8c41('0x39')];if(!_0x545c66[_0x8c41('0x34')][_0x8c41('0x55')](_0x8c41('0x3a'))){_0x36518a['limit']=qs['limit'](_0x545c66[_0x8c41('0x34')][_0x8c41('0x21')]);_0x36518a[_0x8c41('0x20')]=qs[_0x8c41('0x20')](_0x545c66['query']['offset']);}return _0x23f15c[_0x8c41('0x54')](_0x36518a);}})['then'](function(_0x31ffa7){if(_0x31ffa7){return _0x31ffa7?{'count':_0x42a22f,'rows':_0x31ffa7}:null;}})[_0x8c41('0x42')](respondWithResult(_0xa85e76,null))[_0x8c41('0x49')](handleError(_0xa85e76,null));}; \ No newline at end of file +var _0x8397=['Action','getActions','eml-format','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','update','destroy','name','index','map','Automation','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','then','includeAll','include','findAll','rows','show','params','intersection','find','create','body','catch','addConditions','ids','omit','getConditions','findOne','Condition','addActions'];(function(_0x3d6bf6,_0x1ecad1){var _0x2c7929=function(_0x2ea51d){while(--_0x2ea51d){_0x3d6bf6['push'](_0x3d6bf6['shift']());}};_0x2c7929(++_0x1ecad1);}(_0x8397,0x12e));var _0x7839=function(_0x1e1818,_0x5bb131){_0x1e1818=_0x1e1818-0x0;var _0x5c7561=_0x8397[_0x1e1818];return _0x5c7561;};'use strict';var emlformat=require(_0x7839('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7839('0x1'));var moment=require('moment');var BPromise=require(_0x7839('0x2'));var Mustache=require(_0x7839('0x3'));var util=require('util');var path=require(_0x7839('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7839('0x5'));var fs=require('fs');var fs_extra=require(_0x7839('0x6'));var _=require(_0x7839('0x7'));var squel=require(_0x7839('0x8'));var crypto=require(_0x7839('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7839('0xa'));var toCsv=require(_0x7839('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7839('0xc'));var authService=require(_0x7839('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x7839('0xe'));var hardwareService=require(_0x7839('0xf'));var logger=require(_0x7839('0x10'))(_0x7839('0x11'));var utils=require(_0x7839('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7839('0x13'))['db'];function respondWithStatusCode(_0x4abdac,_0x3e3c84){_0x3e3c84=_0x3e3c84||0xcc;return function(_0x4be564){if(_0x4be564){return _0x4abdac[_0x7839('0x14')](_0x3e3c84);}return _0x4abdac[_0x7839('0x15')](_0x3e3c84)[_0x7839('0x16')]();};}function respondWithResult(_0x5ccf86,_0xfd43fa){_0xfd43fa=_0xfd43fa||0xc8;return function(_0x7c063a){if(_0x7c063a){return _0x5ccf86['status'](_0xfd43fa)[_0x7839('0x17')](_0x7c063a);}};}function respondWithFilteredResult(_0x300883,_0x1a3850){return function(_0x43e9b7){if(_0x43e9b7){var _0x5693b9=typeof _0x1a3850['offset']==='undefined'&&typeof _0x1a3850[_0x7839('0x18')]==='undefined';var _0xae4f9b=_0x43e9b7[_0x7839('0x19')];var _0xc624a8=_0x5693b9?0x0:_0x1a3850[_0x7839('0x1a')];var _0x562a54=_0x5693b9?_0x43e9b7[_0x7839('0x19')]:_0x1a3850[_0x7839('0x1a')]+_0x1a3850[_0x7839('0x18')];var _0x316a75;if(_0x562a54>=_0xae4f9b){_0x562a54=_0xae4f9b;_0x316a75=0xc8;}else{_0x316a75=0xce;}_0x300883[_0x7839('0x15')](_0x316a75);return _0x300883[_0x7839('0x1b')]('Content-Range',_0xc624a8+'-'+_0x562a54+'/'+_0xae4f9b)['json'](_0x43e9b7);}return null;};}function patchUpdates(_0x25ec1d){return function(_0x3da022){try{jsonpatch['apply'](_0x3da022,_0x25ec1d,!![]);}catch(_0x2206fa){return BPromise['reject'](_0x2206fa);}return _0x3da022['save']();};}function saveUpdates(_0x25726d,_0xc8ceb5){return function(_0x3fccc7){if(_0x3fccc7){return _0x3fccc7[_0x7839('0x1c')](_0x25726d)['then'](function(_0x1af3ee){return _0x1af3ee;});}return null;};}function removeEntity(_0x426b48,_0x49ba43){return function(_0x2545f0){if(_0x2545f0){return _0x2545f0[_0x7839('0x1d')]()['then'](function(){_0x426b48[_0x7839('0x15')](0xcc)[_0x7839('0x16')]();});}};}function handleEntityNotFound(_0xa4bb3,_0x5b1bd5){return function(_0x20b957){if(!_0x20b957){_0xa4bb3['sendStatus'](0x194);}return _0x20b957;};}function handleError(_0x16566c,_0x42a915){_0x42a915=_0x42a915||0x1f4;return function(_0x1840c7){logger['error'](_0x1840c7['stack']);if(_0x1840c7[_0x7839('0x1e')]){delete _0x1840c7[_0x7839('0x1e')];}_0x16566c[_0x7839('0x15')](_0x42a915)['send'](_0x1840c7);};}exports[_0x7839('0x1f')]=function(_0x5118bd,_0x514020){var _0x2adbe3={},_0x1d78a0={},_0x4c5946={'count':0x0,'rows':[]};var _0x5c3267=_[_0x7839('0x20')](db[_0x7839('0x21')][_0x7839('0x22')],function(_0x37642d){return{'name':_0x37642d[_0x7839('0x23')],'type':_0x37642d[_0x7839('0x24')][_0x7839('0x25')]};});_0x1d78a0[_0x7839('0x26')]=_[_0x7839('0x20')](_0x5c3267,'name');_0x1d78a0[_0x7839('0x27')]=_[_0x7839('0x28')](_0x5118bd[_0x7839('0x27')]);_0x1d78a0[_0x7839('0x29')]=_['intersection'](_0x1d78a0[_0x7839('0x26')],_0x1d78a0[_0x7839('0x27')]);_0x2adbe3[_0x7839('0x2a')]=_['intersection'](_0x1d78a0[_0x7839('0x26')],qs['fields'](_0x5118bd[_0x7839('0x27')][_0x7839('0x2b')]));_0x2adbe3[_0x7839('0x2a')]=_0x2adbe3[_0x7839('0x2a')][_0x7839('0x2c')]?_0x2adbe3[_0x7839('0x2a')]:_0x1d78a0[_0x7839('0x26')];if(!_0x5118bd[_0x7839('0x27')][_0x7839('0x2d')](_0x7839('0x2e'))){_0x2adbe3[_0x7839('0x18')]=qs[_0x7839('0x18')](_0x5118bd['query'][_0x7839('0x18')]);_0x2adbe3[_0x7839('0x1a')]=qs[_0x7839('0x1a')](_0x5118bd[_0x7839('0x27')][_0x7839('0x1a')]);}_0x2adbe3[_0x7839('0x2f')]=qs[_0x7839('0x30')](_0x5118bd[_0x7839('0x27')][_0x7839('0x30')]);_0x2adbe3[_0x7839('0x31')]=qs[_0x7839('0x29')](_[_0x7839('0x32')](_0x5118bd[_0x7839('0x27')],_0x1d78a0[_0x7839('0x29')]),_0x5c3267);if(_0x5118bd[_0x7839('0x27')]['filter']){_0x2adbe3[_0x7839('0x31')]=_[_0x7839('0x33')](_0x2adbe3[_0x7839('0x31')],{'$or':_['map'](_0x5c3267,function(_0x569824){if(_0x569824[_0x7839('0x24')]!=='VIRTUAL'){var _0x2fee25={};_0x2fee25[_0x569824[_0x7839('0x1e')]]={'$like':'%'+_0x5118bd[_0x7839('0x27')][_0x7839('0x34')]+'%'};return _0x2fee25;}})});}_0x2adbe3=_['merge']({},_0x2adbe3,_0x5118bd[_0x7839('0x35')]);var _0x5e413f={'where':_0x2adbe3[_0x7839('0x31')]};return db['Automation'][_0x7839('0x19')](_0x5e413f)[_0x7839('0x36')](function(_0x42e72a){_0x4c5946['count']=_0x42e72a;if(_0x5118bd[_0x7839('0x27')][_0x7839('0x37')]){_0x2adbe3[_0x7839('0x38')]=[{'all':!![]}];}return db[_0x7839('0x21')][_0x7839('0x39')](_0x2adbe3);})[_0x7839('0x36')](function(_0x53b71f){_0x4c5946[_0x7839('0x3a')]=_0x53b71f;return _0x4c5946;})[_0x7839('0x36')](respondWithFilteredResult(_0x514020,_0x2adbe3))['catch'](handleError(_0x514020,null));};exports[_0x7839('0x3b')]=function(_0x14171e,_0x46e086){var _0x274ecd={'raw':![],'where':{'id':_0x14171e[_0x7839('0x3c')]['id']}},_0x272792={};_0x272792[_0x7839('0x26')]=_['keys'](db[_0x7839('0x21')][_0x7839('0x22')]);_0x272792[_0x7839('0x27')]=_[_0x7839('0x28')](_0x14171e[_0x7839('0x27')]);_0x272792[_0x7839('0x29')]=_[_0x7839('0x3d')](_0x272792[_0x7839('0x26')],_0x272792['query']);_0x274ecd[_0x7839('0x2a')]=_[_0x7839('0x3d')](_0x272792[_0x7839('0x26')],qs[_0x7839('0x2b')](_0x14171e[_0x7839('0x27')][_0x7839('0x2b')]));_0x274ecd['attributes']=_0x274ecd[_0x7839('0x2a')][_0x7839('0x2c')]?_0x274ecd[_0x7839('0x2a')]:_0x272792[_0x7839('0x26')];if(_0x14171e[_0x7839('0x27')][_0x7839('0x37')]){_0x274ecd['include']=[{'all':!![]}];}_0x274ecd=_[_0x7839('0x33')]({},_0x274ecd,_0x14171e[_0x7839('0x35')]);return db['Automation'][_0x7839('0x3e')](_0x274ecd)[_0x7839('0x36')](handleEntityNotFound(_0x46e086,null))[_0x7839('0x36')](respondWithResult(_0x46e086,null))['catch'](handleError(_0x46e086,null));};exports[_0x7839('0x3f')]=function(_0x235bb9,_0x4d8ff2){return db[_0x7839('0x21')][_0x7839('0x3f')](_0x235bb9[_0x7839('0x40')],{})[_0x7839('0x36')](respondWithResult(_0x4d8ff2,0xc9))['catch'](handleError(_0x4d8ff2,null));};exports[_0x7839('0x1c')]=function(_0x307dbf,_0x5569af){if(_0x307dbf[_0x7839('0x40')]['id']){delete _0x307dbf[_0x7839('0x40')]['id'];}return db[_0x7839('0x21')][_0x7839('0x3e')]({'where':{'id':_0x307dbf['params']['id']}})[_0x7839('0x36')](handleEntityNotFound(_0x5569af,null))[_0x7839('0x36')](saveUpdates(_0x307dbf['body'],null))['then'](respondWithResult(_0x5569af,null))[_0x7839('0x41')](handleError(_0x5569af,null));};exports[_0x7839('0x1d')]=function(_0x51320c,_0x1b2c95){return db[_0x7839('0x21')][_0x7839('0x3e')]({'where':{'id':_0x51320c[_0x7839('0x3c')]['id']}})[_0x7839('0x36')](handleEntityNotFound(_0x1b2c95,null))['then'](removeEntity(_0x1b2c95,null))['catch'](handleError(_0x1b2c95,null));};exports[_0x7839('0x42')]=function(_0x5e6bca,_0x5732bb,_0x3f5512){return db['Condition'][_0x7839('0x3e')]({'where':{'id':_0x5e6bca['params']['id']}})[_0x7839('0x36')](handleEntityNotFound(_0x5732bb,null))[_0x7839('0x36')](function(_0x307f67){if(_0x307f67){return _0x307f67[_0x7839('0x42')](_0x5e6bca[_0x7839('0x40')][_0x7839('0x43')],_[_0x7839('0x44')](_0x5e6bca[_0x7839('0x40')],['ids','id'])||{});}})['then'](respondWithResult(_0x5732bb,null))['catch'](handleError(_0x5732bb,null));};exports[_0x7839('0x45')]=function(_0x1b508c,_0x3b70b1,_0x11c41f){var _0x2a9a8a={};var _0x1b1482={};var _0xb9c0c9;var _0x5e9cae;return db['Automation'][_0x7839('0x46')]({'where':{'id':_0x1b508c[_0x7839('0x3c')]['id']}})[_0x7839('0x36')](handleEntityNotFound(_0x3b70b1,null))['then'](function(_0x1812fe){if(_0x1812fe){_0xb9c0c9=_0x1812fe;_0x1b1482['model']=_['keys'](db[_0x7839('0x47')][_0x7839('0x22')]);_0x1b1482[_0x7839('0x27')]=_['keys'](_0x1b508c[_0x7839('0x27')]);_0x1b1482[_0x7839('0x29')]=_['intersection'](_0x1b1482[_0x7839('0x26')],_0x1b1482[_0x7839('0x27')]);_0x2a9a8a['attributes']=_[_0x7839('0x3d')](_0x1b1482[_0x7839('0x26')],qs[_0x7839('0x2b')](_0x1b508c['query'][_0x7839('0x2b')]));_0x2a9a8a[_0x7839('0x2a')]=_0x2a9a8a[_0x7839('0x2a')][_0x7839('0x2c')]?_0x2a9a8a[_0x7839('0x2a')]:_0x1b1482[_0x7839('0x26')];_0x2a9a8a[_0x7839('0x2f')]=qs[_0x7839('0x30')](_0x1b508c[_0x7839('0x27')]['sort']);_0x2a9a8a[_0x7839('0x31')]=qs[_0x7839('0x29')](_[_0x7839('0x32')](_0x1b508c[_0x7839('0x27')],_0x1b1482[_0x7839('0x29')]));if(_0x1b508c['query'][_0x7839('0x34')]){_0x2a9a8a[_0x7839('0x31')]=_[_0x7839('0x33')](_0x2a9a8a[_0x7839('0x31')],{'$or':_['map'](_0x2a9a8a[_0x7839('0x2a')],function(_0x476af5){var _0x38833d={};_0x38833d[_0x476af5]={'$like':'%'+_0x1b508c[_0x7839('0x27')]['filter']+'%'};return _0x38833d;})});}_0x2a9a8a=_[_0x7839('0x33')]({},_0x2a9a8a,_0x1b508c[_0x7839('0x35')]);return _0xb9c0c9[_0x7839('0x45')](_0x2a9a8a);}})[_0x7839('0x36')](function(_0x55110c){if(_0x55110c){_0x5e9cae=_0x55110c[_0x7839('0x2c')];if(!_0x1b508c[_0x7839('0x27')][_0x7839('0x2d')](_0x7839('0x2e'))){_0x2a9a8a[_0x7839('0x18')]=qs[_0x7839('0x18')](_0x1b508c[_0x7839('0x27')][_0x7839('0x18')]);_0x2a9a8a[_0x7839('0x1a')]=qs[_0x7839('0x1a')](_0x1b508c[_0x7839('0x27')]['offset']);}return _0xb9c0c9[_0x7839('0x45')](_0x2a9a8a);}})[_0x7839('0x36')](function(_0x2b5a1b){if(_0x2b5a1b){return _0x2b5a1b?{'count':_0x5e9cae,'rows':_0x2b5a1b}:null;}})[_0x7839('0x36')](respondWithResult(_0x3b70b1,null))[_0x7839('0x41')](handleError(_0x3b70b1,null));};exports[_0x7839('0x48')]=function(_0x3175ee,_0x2177b4,_0x154130){return db[_0x7839('0x49')][_0x7839('0x3e')]({'where':{'id':_0x3175ee[_0x7839('0x3c')]['id']}})[_0x7839('0x36')](handleEntityNotFound(_0x2177b4,null))[_0x7839('0x36')](function(_0x2caa55){if(_0x2caa55){return _0x2caa55['addActions'](_0x3175ee[_0x7839('0x40')]['ids'],_['omit'](_0x3175ee[_0x7839('0x40')],[_0x7839('0x43'),'id'])||{});}})[_0x7839('0x36')](respondWithResult(_0x2177b4,null))['catch'](handleError(_0x2177b4,null));};exports[_0x7839('0x4a')]=function(_0x220d9e,_0x16c80d,_0x3661c4){var _0x35acc8={};var _0x1953a6={};var _0x4be8b4;var _0x686efc;return db[_0x7839('0x21')]['findOne']({'where':{'id':_0x220d9e[_0x7839('0x3c')]['id']}})[_0x7839('0x36')](handleEntityNotFound(_0x16c80d,null))[_0x7839('0x36')](function(_0x134f84){if(_0x134f84){_0x4be8b4=_0x134f84;_0x1953a6[_0x7839('0x26')]=_[_0x7839('0x28')](db[_0x7839('0x49')]['rawAttributes']);_0x1953a6[_0x7839('0x27')]=_[_0x7839('0x28')](_0x220d9e['query']);_0x1953a6[_0x7839('0x29')]=_[_0x7839('0x3d')](_0x1953a6[_0x7839('0x26')],_0x1953a6[_0x7839('0x27')]);_0x35acc8[_0x7839('0x2a')]=_[_0x7839('0x3d')](_0x1953a6[_0x7839('0x26')],qs[_0x7839('0x2b')](_0x220d9e[_0x7839('0x27')][_0x7839('0x2b')]));_0x35acc8[_0x7839('0x2a')]=_0x35acc8[_0x7839('0x2a')][_0x7839('0x2c')]?_0x35acc8[_0x7839('0x2a')]:_0x1953a6[_0x7839('0x26')];_0x35acc8[_0x7839('0x2f')]=qs['sort'](_0x220d9e[_0x7839('0x27')][_0x7839('0x30')]);_0x35acc8['where']=qs[_0x7839('0x29')](_['pick'](_0x220d9e[_0x7839('0x27')],_0x1953a6['filters']));if(_0x220d9e[_0x7839('0x27')]['filter']){_0x35acc8[_0x7839('0x31')]=_[_0x7839('0x33')](_0x35acc8[_0x7839('0x31')],{'$or':_[_0x7839('0x20')](_0x35acc8['attributes'],function(_0x518a4f){var _0x43353c={};_0x43353c[_0x518a4f]={'$like':'%'+_0x220d9e[_0x7839('0x27')]['filter']+'%'};return _0x43353c;})});}_0x35acc8=_[_0x7839('0x33')]({},_0x35acc8,_0x220d9e['options']);return _0x4be8b4[_0x7839('0x4a')](_0x35acc8);}})[_0x7839('0x36')](function(_0xa52c92){if(_0xa52c92){_0x686efc=_0xa52c92['length'];if(!_0x220d9e[_0x7839('0x27')][_0x7839('0x2d')](_0x7839('0x2e'))){_0x35acc8[_0x7839('0x18')]=qs[_0x7839('0x18')](_0x220d9e[_0x7839('0x27')][_0x7839('0x18')]);_0x35acc8['offset']=qs[_0x7839('0x1a')](_0x220d9e[_0x7839('0x27')][_0x7839('0x1a')]);}return _0x4be8b4['getActions'](_0x35acc8);}})[_0x7839('0x36')](function(_0x271207){if(_0x271207){return _0x271207?{'count':_0x686efc,'rows':_0x271207}:null;}})['then'](respondWithResult(_0x16c80d,null))[_0x7839('0x41')](handleError(_0x16c80d,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 2a0260a..8f06362 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 _0x925d=['lodash','util','api','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x5d3397,_0x23a4bc){var _0x16a3c7=function(_0x54750e){while(--_0x54750e){_0x5d3397['push'](_0x5d3397['shift']());}};_0x16a3c7(++_0x23a4bc);}(_0x925d,0x140));var _0xd925=function(_0x547a0d,_0x442e7a){_0x547a0d=_0x547a0d-0x0;var _0x55f12c=_0x925d[_0x547a0d];return _0x55f12c;};'use strict';var _=require(_0xd925('0x0'));var util=require(_0xd925('0x1'));var logger=require('../../config/logger')(_0xd925('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd925('0x3'));var fs=require('fs');var path=require(_0xd925('0x4'));var rimraf=require(_0xd925('0x5'));var config=require(_0xd925('0x6'));var attributes=require('./automation.attributes');module[_0xd925('0x7')]=function(_0x4d0a93,_0x5de7ae){return _0x4d0a93['define']('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86e3=['../../config/environment','exports','define','Automation','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4948e0,_0x3701d3){var _0x594498=function(_0x4fba8c){while(--_0x4fba8c){_0x4948e0['push'](_0x4948e0['shift']());}};_0x594498(++_0x3701d3);}(_0x86e3,0xa0));var _0x386e=function(_0x35561d,_0x59a5cf){_0x35561d=_0x35561d-0x0;var _0x2ccc5b=_0x86e3[_0x35561d];return _0x2ccc5b;};'use strict';var _=require(_0x386e('0x0'));var util=require('util');var logger=require(_0x386e('0x1'))(_0x386e('0x2'));var moment=require(_0x386e('0x3'));var BPromise=require(_0x386e('0x4'));var rp=require(_0x386e('0x5'));var fs=require('fs');var path=require(_0x386e('0x6'));var rimraf=require(_0x386e('0x7'));var config=require(_0x386e('0x8'));var attributes=require('./automation.attributes');module[_0x386e('0x9')]=function(_0x411681,_0x522c69){return _0x411681[_0x386e('0xa')](_0x386e('0xb'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 3a9711e..c875009 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 _0x6efe=['error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x32146e,_0x2be230){var _0x375cc7=function(_0xdf3711){while(--_0xdf3711){_0x32146e['push'](_0x32146e['shift']());}};_0x375cc7(++_0x2be230);}(_0x6efe,0xc6));var _0xe6ef=function(_0x1c60a1,_0x11b0e1){_0x1c60a1=_0x1c60a1-0x0;var _0x45a858=_0x6efe[_0x1c60a1];return _0x45a858;};'use strict';var _=require(_0xe6ef('0x0'));var util=require(_0xe6ef('0x1'));var moment=require(_0xe6ef('0x2'));var BPromise=require(_0xe6ef('0x3'));var rs=require(_0xe6ef('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe6ef('0x5'));var logger=require(_0xe6ef('0x6'))(_0xe6ef('0x7'));var config=require(_0xe6ef('0x8'));var jayson=require(_0xe6ef('0x9'));var client=jayson['client'][_0xe6ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x422e13,_0x599b6c,_0x4a4bb9){return new BPromise(function(_0x51a9eb,_0x3256ff){return client[_0xe6ef('0xb')](_0x422e13,_0x4a4bb9)[_0xe6ef('0xc')](function(_0x4fca2f){logger[_0xe6ef('0xd')]('Automation,\x20%s,\x20%s',_0x599b6c,_0xe6ef('0xe'));logger[_0xe6ef('0xf')](_0xe6ef('0x10'),_0x599b6c,_0xe6ef('0xe'),JSON[_0xe6ef('0x11')](_0x4fca2f));if(_0x4fca2f[_0xe6ef('0x12')]){if(_0x4fca2f[_0xe6ef('0x12')][_0xe6ef('0x13')]===0x1f4){logger['error'](_0xe6ef('0x14'),_0x599b6c,_0x4fca2f[_0xe6ef('0x12')][_0xe6ef('0x15')]);return _0x3256ff(_0x4fca2f[_0xe6ef('0x12')]['message']);}logger[_0xe6ef('0x12')]('Automation,\x20%s,\x20%s',_0x599b6c,_0x4fca2f[_0xe6ef('0x12')][_0xe6ef('0x15')]);return _0x51a9eb(_0x4fca2f[_0xe6ef('0x12')][_0xe6ef('0x15')]);}else{logger[_0xe6ef('0xd')](_0xe6ef('0x14'),_0x599b6c,_0xe6ef('0xe'));_0x51a9eb(_0x4fca2f[_0xe6ef('0x16')][_0xe6ef('0x15')]);}})[_0xe6ef('0x17')](function(_0x5c32cc){logger[_0xe6ef('0x12')](_0xe6ef('0x14'),_0x599b6c,_0x5c32cc);_0x3256ff(_0x5c32cc);});});} \ No newline at end of file +var _0x753c=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2e2eab,_0x2e609a){var _0x2357bc=function(_0x2235ad){while(--_0x2235ad){_0x2e2eab['push'](_0x2e2eab['shift']());}};_0x2357bc(++_0x2e609a);}(_0x753c,0x96));var _0xc753=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x753c[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xc753('0x0'));var moment=require('moment');var BPromise=require(_0xc753('0x1'));var rs=require(_0xc753('0x2'));var fs=require('fs');var Redis=require(_0xc753('0x3'));var db=require(_0xc753('0x4'))['db'];var utils=require(_0xc753('0x5'));var logger=require(_0xc753('0x6'))(_0xc753('0x7'));var config=require(_0xc753('0x8'));var jayson=require(_0xc753('0x9'));var client=jayson[_0xc753('0xa')][_0xc753('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf96e73,_0xd7ee43,_0x44e544){return new BPromise(function(_0xb80bea,_0x3866e8){return client[_0xc753('0xc')](_0xf96e73,_0x44e544)[_0xc753('0xd')](function(_0x128610){logger[_0xc753('0xe')](_0xc753('0xf'),_0xd7ee43,_0xc753('0x10'));logger[_0xc753('0x11')](_0xc753('0x12'),_0xd7ee43,'request\x20sent',JSON[_0xc753('0x13')](_0x128610));if(_0x128610[_0xc753('0x14')]){if(_0x128610['error'][_0xc753('0x15')]===0x1f4){logger['error'](_0xc753('0xf'),_0xd7ee43,_0x128610[_0xc753('0x14')][_0xc753('0x16')]);return _0x3866e8(_0x128610['error'][_0xc753('0x16')]);}logger['error'](_0xc753('0xf'),_0xd7ee43,_0x128610['error'][_0xc753('0x16')]);return _0xb80bea(_0x128610[_0xc753('0x14')][_0xc753('0x16')]);}else{logger[_0xc753('0xe')](_0xc753('0xf'),_0xd7ee43,'request\x20sent');_0xb80bea(_0x128610[_0xc753('0x17')][_0xc753('0x16')]);}})[_0xc753('0x18')](function(_0x2e056c){logger[_0xc753('0x14')](_0xc753('0xf'),_0xd7ee43,_0x2e056c);_0x3866e8(_0x2e056c);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index f6be194..ab1df2b 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 _0xf4e5=['express','Router','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions','/:id/actions','getActions','create','post','addConditions','addActions','put','update','destroy','multer','util','path','connect-timeout'];(function(_0xfd495c,_0x4a3c1a){var _0x561dd8=function(_0x83e915){while(--_0x83e915){_0xfd495c['push'](_0xfd495c['shift']());}};_0x561dd8(++_0x4a3c1a);}(_0xf4e5,0xd4));var _0x5f4e=function(_0x5785fe,_0x359895){_0x5785fe=_0x5785fe-0x0;var _0x57a0e1=_0xf4e5[_0x5785fe];return _0x57a0e1;};'use strict';var multer=require(_0x5f4e('0x0'));var util=require(_0x5f4e('0x1'));var path=require(_0x5f4e('0x2'));var timeout=require(_0x5f4e('0x3'));var express=require(_0x5f4e('0x4'));var router=express[_0x5f4e('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5f4e('0x6'));var config=require(_0x5f4e('0x7'));var controller=require(_0x5f4e('0x8'));router['get']('/',auth[_0x5f4e('0x9')](),controller[_0x5f4e('0xa')]);router[_0x5f4e('0xb')](_0x5f4e('0xc'),auth[_0x5f4e('0x9')](),controller[_0x5f4e('0xd')]);router[_0x5f4e('0xb')](_0x5f4e('0xe'),auth[_0x5f4e('0x9')](),controller['getConditions']);router['get'](_0x5f4e('0xf'),auth[_0x5f4e('0x9')](),controller[_0x5f4e('0x10')]);router['post']('/',auth[_0x5f4e('0x9')](),controller[_0x5f4e('0x11')]);router[_0x5f4e('0x12')](_0x5f4e('0xe'),auth[_0x5f4e('0x9')](),controller[_0x5f4e('0x13')]);router[_0x5f4e('0x12')](_0x5f4e('0xf'),auth[_0x5f4e('0x9')](),controller[_0x5f4e('0x14')]);router[_0x5f4e('0x15')]('/:id',auth[_0x5f4e('0x9')](),controller[_0x5f4e('0x16')]);router['delete'](_0x5f4e('0xc'),auth[_0x5f4e('0x9')](),controller[_0x5f4e('0x17')]);module['exports']=router; \ No newline at end of file +var _0xd882=['destroy','exports','multer','path','connect-timeout','express','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','addActions','put','update','delete'];(function(_0x627730,_0x43a922){var _0x3d4df3=function(_0x2bc64c){while(--_0x2bc64c){_0x627730['push'](_0x627730['shift']());}};_0x3d4df3(++_0x43a922);}(_0xd882,0xd1));var _0x2d88=function(_0x21d982,_0x1c6cf5){_0x21d982=_0x21d982-0x0;var _0x1b045d=_0xd882[_0x21d982];return _0x1b045d;};'use strict';var multer=require(_0x2d88('0x0'));var util=require('util');var path=require(_0x2d88('0x1'));var timeout=require(_0x2d88('0x2'));var express=require(_0x2d88('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(_0x2d88('0x4'));var controller=require(_0x2d88('0x5'));router[_0x2d88('0x6')]('/',auth[_0x2d88('0x7')](),controller[_0x2d88('0x8')]);router[_0x2d88('0x6')](_0x2d88('0x9'),auth[_0x2d88('0x7')](),controller[_0x2d88('0xa')]);router[_0x2d88('0x6')](_0x2d88('0xb'),auth[_0x2d88('0x7')](),controller[_0x2d88('0xc')]);router[_0x2d88('0x6')](_0x2d88('0xd'),auth[_0x2d88('0x7')](),controller[_0x2d88('0xe')]);router[_0x2d88('0xf')]('/',auth[_0x2d88('0x7')](),controller['create']);router['post'](_0x2d88('0xb'),auth[_0x2d88('0x7')](),controller[_0x2d88('0x10')]);router[_0x2d88('0xf')](_0x2d88('0xd'),auth[_0x2d88('0x7')](),controller[_0x2d88('0x11')]);router[_0x2d88('0x12')](_0x2d88('0x9'),auth['isAuthenticated'](),controller[_0x2d88('0x13')]);router[_0x2d88('0x14')]('/:id',auth[_0x2d88('0x7')](),controller[_0x2d88('0x15')]);module[_0x2d88('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 7309277..b6e69bb 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 _0xdfc0=['UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','Max\x20200\x20calls.'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdfc0,0x1aa));var _0x0dfc=function(_0x169f05,_0x451867){_0x169f05=_0x169f05-0x0;var _0x44c984=_0xdfc0[_0x169f05];return _0x44c984;};'use strict';var Sequelize=require(_0x0dfc('0x0'));module['exports']={'name':{'type':Sequelize[_0x0dfc('0x1')],'unique':_0x0dfc('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x0dfc('0x3')](_0x0dfc('0x4')),'allowNull':![],'defaultValue':_0x0dfc('0x4')},'description':{'type':Sequelize[_0x0dfc('0x1')]},'active':{'type':Sequelize[_0x0dfc('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x0dfc('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x0dfc('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0x0dfc('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0dfc('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x0dfc('0x6')](0x3)[_0x0dfc('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x0dfc('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0dfc('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0dfc('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0dfc('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x0dfc('0x6')](0x5)[_0x0dfc('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x0dfc('0x6')](0x3)[_0x0dfc('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0dfc('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0dfc('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0dfc('0x1')],'defaultValue':_0x0dfc('0xa')},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0x0dfc('0xb'),_0x0dfc('0xc')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x0dfc('0x5')],'defaultValue':0x0,'comment':_0x0dfc('0xd')},'dialAMDInitialSilence':{'type':Sequelize[_0x0dfc('0x6')](0x9)[_0x0dfc('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x0dfc('0x6')](0x9)[_0x0dfc('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0dfc('0xe')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0dfc('0x6')](0x9)[_0x0dfc('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0dfc('0x6')](0x9)[_0x0dfc('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0dfc('0xf')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0dfc('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0dfc('0x10')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0dfc('0x6')](0x9)[_0x0dfc('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0dfc('0x11')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0dfc('0x6')](0x9)[_0x0dfc('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0dfc('0x12')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x0dfc('0x6')](0x5)[_0x0dfc('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0dfc('0x13')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x0dfc('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0dfc('0x14')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x0dfc('0x15'),_0x0dfc('0x16')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x0dfc('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0dfc('0x6')](0x3)[_0x0dfc('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0dfc('0x17')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x0dfc('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0dfc('0x18')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0dfc('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0dfc('0x19')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0dfc('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0dfc('0x1a')},'dialDropMaxRetry':{'type':Sequelize[_0x0dfc('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0dfc('0x1b')},'dialDropRetryFrequency':{'type':Sequelize[_0x0dfc('0x6')](0x5)[_0x0dfc('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0dfc('0x1c')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x0dfc('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x0dfc('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0dfc('0x1d')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0dfc('0x6')](0x5)[_0x0dfc('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0dfc('0x6')](0x3)[_0x0dfc('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0dfc('0x6')](0x5)[_0x0dfc('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0dfc('0x1e')}}; \ No newline at end of file +var _0xeb1c=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','STRING','name','ivr','BOOLEAN','Max\x20200\x20calls.','INTEGER','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','always','never','onlyIfOpen','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\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\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)'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0xeb1c,0x119));var _0xceb1=function(_0x360fc7,_0x5cd3e7){_0x360fc7=_0x360fc7-0x0;var _0x42f8ee=_0xeb1c[_0x360fc7];return _0x42f8ee;};'use strict';var Sequelize=require(_0xceb1('0x0'));module['exports']={'name':{'type':Sequelize[_0xceb1('0x1')],'unique':_0xceb1('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xceb1('0x3')),'allowNull':![],'defaultValue':_0xceb1('0x3')},'description':{'type':Sequelize[_0xceb1('0x1')]},'active':{'type':Sequelize[_0xceb1('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xceb1('0x5')},'dialOriginateCallerIdName':{'type':Sequelize[_0xceb1('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xceb1('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xceb1('0x6')](0x3)[_0xceb1('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xceb1('0x6')](0x3)[_0xceb1('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xceb1('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xceb1('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xceb1('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0xceb1('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xceb1('0xa')},'dialBusyRetryFrequency':{'type':Sequelize[_0xceb1('0x6')](0x5)[_0xceb1('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xceb1('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xceb1('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xceb1('0x6')](0x5)[_0xceb1('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xceb1('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0xceb1('0x6')](0x3)[_0xceb1('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xceb1('0xe')},'dialTimezone':{'type':Sequelize[_0xceb1('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xceb1('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0xceb1('0xf')](_0xceb1('0x10'),_0xceb1('0x11'),_0xceb1('0x12')),'defaultValue':_0xceb1('0x10')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xceb1('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xceb1('0x6')](0x9)[_0xceb1('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xceb1('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xceb1('0x6')](0x9)[_0xceb1('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xceb1('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xceb1('0x6')](0x9)[_0xceb1('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xceb1('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xceb1('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xceb1('0x17')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xceb1('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xceb1('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xceb1('0x6')](0x9)[_0xceb1('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xceb1('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xceb1('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xceb1('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xceb1('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xceb1('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xceb1('0x6')](0x9)[_0xceb1('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xceb1('0x1c'),_0xceb1('0x1d')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xceb1('0x6')](0x3)[_0xceb1('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xceb1('0x6')](0x3)[_0xceb1('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xceb1('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xceb1('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xceb1('0x1f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xceb1('0x6')](0x5)[_0xceb1('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xceb1('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0xceb1('0x6')](0x3)[_0xceb1('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xceb1('0x6')](0x5)[_0xceb1('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xceb1('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xceb1('0x6')](0x3)[_0xceb1('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xceb1('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xceb1('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xceb1('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0xceb1('0x6')](0x3)[_0xceb1('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xceb1('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0xceb1('0x6')](0x5)[_0xceb1('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xceb1('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xceb1('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xceb1('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xceb1('0x6')](0x5)[_0xceb1('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xceb1('0x27')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 6a9bea5..da115ec 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 _0xb8ac=['to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','then','destroy','get','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','VIRTUAL','options','Campaign','includeAll','include','findAll','show','params','model','merge','catch','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','omit','createdAt','updatedAt','IvrCampaigns','update','body','getHoppers','findOne','CmHopper','hasOwnProperty','order','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','deletedAt\x20IS\x20NULL','insert','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x1be3b3,_0x4335ee){var _0x4f8b2d=function(_0x1d955f){while(--_0x1d955f){_0x1be3b3['push'](_0x1be3b3['shift']());}};_0x4f8b2d(++_0x4335ee);}(_0xb8ac,0x10b));var _0xcb8a=function(_0xf2760,_0x2a3d49){_0xf2760=_0xf2760-0x0;var _0x17d9ac=_0xb8ac[_0xf2760];return _0x17d9ac;};'use strict';var emlformat=require(_0xcb8a('0x0'));var rimraf=require(_0xcb8a('0x1'));var zipdir=require(_0xcb8a('0x2'));var jsonpatch=require(_0xcb8a('0x3'));var rp=require(_0xcb8a('0x4'));var moment=require(_0xcb8a('0x5'));var BPromise=require(_0xcb8a('0x6'));var Mustache=require(_0xcb8a('0x7'));var util=require(_0xcb8a('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xcb8a('0x9'));var ejs=require(_0xcb8a('0xa'));var fs=require('fs');var fs_extra=require(_0xcb8a('0xb'));var _=require(_0xcb8a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcb8a('0xd'));var deskjs=require(_0xcb8a('0xe'));var toCsv=require(_0xcb8a('0x9'));var querystring=require(_0xcb8a('0xf'));var Papa=require(_0xcb8a('0x10'));var Redis=require(_0xcb8a('0x11'));var authService=require(_0xcb8a('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb8a('0x13'));var logger=require(_0xcb8a('0x14'))(_0xcb8a('0x15'));var utils=require('../../config/utils');var config=require(_0xcb8a('0x16'));var licenseUtil=require(_0xcb8a('0x17'));var db=require(_0xcb8a('0x18'))['db'];function respondWithStatusCode(_0x59932e,_0x5f0a5a){_0x5f0a5a=_0x5f0a5a||0xcc;return function(_0x519215){if(_0x519215){return _0x59932e['sendStatus'](_0x5f0a5a);}return _0x59932e['status'](_0x5f0a5a)[_0xcb8a('0x19')]();};}function respondWithResult(_0x49fc3b,_0x78f72f){_0x78f72f=_0x78f72f||0xc8;return function(_0x136c82){if(_0x136c82){return _0x49fc3b['status'](_0x78f72f)[_0xcb8a('0x1a')](_0x136c82);}};}function respondWithFilteredResult(_0x5a1481,_0x1eed8a){return function(_0x13a340){if(_0x13a340){var _0x529703=typeof _0x1eed8a[_0xcb8a('0x1b')]===_0xcb8a('0x1c')&&typeof _0x1eed8a['limit']==='undefined';var _0x475db6=_0x13a340[_0xcb8a('0x1d')];var _0x20d81c=_0x529703?0x0:_0x1eed8a[_0xcb8a('0x1b')];var _0x259cea=_0x529703?_0x13a340[_0xcb8a('0x1d')]:_0x1eed8a['offset']+_0x1eed8a[_0xcb8a('0x1e')];var _0x130af6;if(_0x259cea>=_0x475db6){_0x259cea=_0x475db6;_0x130af6=0xc8;}else{_0x130af6=0xce;}_0x5a1481[_0xcb8a('0x1f')](_0x130af6);return _0x5a1481[_0xcb8a('0x20')](_0xcb8a('0x21'),_0x20d81c+'-'+_0x259cea+'/'+_0x475db6)[_0xcb8a('0x1a')](_0x13a340);}return null;};}function patchUpdates(_0x2cdae7){return function(_0x378410){try{jsonpatch[_0xcb8a('0x22')](_0x378410,_0x2cdae7,!![]);}catch(_0x58772c){return BPromise[_0xcb8a('0x23')](_0x58772c);}return _0x378410[_0xcb8a('0x24')]();};}function saveUpdates(_0xe49140,_0x50e346){return function(_0x2ac6ea){if(_0x2ac6ea){return _0x2ac6ea['update'](_0xe49140)[_0xcb8a('0x25')](function(_0x23c05b){return _0x23c05b;});}return null;};}function removeEntity(_0x47d280,_0x1c042f){return function(_0x422f93){if(_0x422f93){return _0x422f93[_0xcb8a('0x26')]()[_0xcb8a('0x25')](function(){var _0x36fde6=_0x422f93[_0xcb8a('0x27')]({'plain':!![]});var _0x29825c='IvrCampaigns';return db['UserProfileResource']['destroy']({'where':{'type':_0x29825c,'resourceId':_0x36fde6['id']}})[_0xcb8a('0x25')](function(){return _0x422f93;});})[_0xcb8a('0x25')](function(){_0x47d280['status'](0xcc)[_0xcb8a('0x19')]();});}};}function handleEntityNotFound(_0x35d02f,_0x4b0ff5){return function(_0x62f277){if(!_0x62f277){_0x35d02f[_0xcb8a('0x28')](0x194);}return _0x62f277;};}function handleError(_0x4e6227,_0x3f71d6){_0x3f71d6=_0x3f71d6||0x1f4;return function(_0x534e75){logger[_0xcb8a('0x29')](_0x534e75['stack']);if(_0x534e75[_0xcb8a('0x2a')]){delete _0x534e75[_0xcb8a('0x2a')];}_0x4e6227[_0xcb8a('0x1f')](_0x3f71d6)[_0xcb8a('0x2b')](_0x534e75);};}exports[_0xcb8a('0x2c')]=function(_0x22be75,_0x1c9833){var _0x2fe306={},_0xaa3c55={},_0x4dd85f={'count':0x0,'rows':[]};var _0x348a8c=_[_0xcb8a('0x2d')](db['Campaign'][_0xcb8a('0x2e')],function(_0x3e874c){return{'name':_0x3e874c[_0xcb8a('0x2f')],'type':_0x3e874c[_0xcb8a('0x30')][_0xcb8a('0x31')]};});_0xaa3c55['model']=_[_0xcb8a('0x2d')](_0x348a8c,'name');_0xaa3c55[_0xcb8a('0x32')]=_[_0xcb8a('0x33')](_0x22be75[_0xcb8a('0x32')]);_0xaa3c55['filters']=_[_0xcb8a('0x34')](_0xaa3c55['model'],_0xaa3c55['query']);_0x2fe306[_0xcb8a('0x35')]=_[_0xcb8a('0x34')](_0xaa3c55['model'],qs[_0xcb8a('0x36')](_0x22be75[_0xcb8a('0x32')][_0xcb8a('0x36')]));_0x2fe306[_0xcb8a('0x35')]=_0x2fe306[_0xcb8a('0x35')][_0xcb8a('0x37')]?_0x2fe306[_0xcb8a('0x35')]:_0xaa3c55['model'];if(!_0x22be75[_0xcb8a('0x32')]['hasOwnProperty'](_0xcb8a('0x38'))){_0x2fe306[_0xcb8a('0x1e')]=qs[_0xcb8a('0x1e')](_0x22be75[_0xcb8a('0x32')][_0xcb8a('0x1e')]);_0x2fe306[_0xcb8a('0x1b')]=qs[_0xcb8a('0x1b')](_0x22be75[_0xcb8a('0x32')]['offset']);}_0x2fe306['order']=qs['sort'](_0x22be75['query'][_0xcb8a('0x39')]);_0x2fe306[_0xcb8a('0x3a')]=qs[_0xcb8a('0x3b')](_[_0xcb8a('0x3c')](_0x22be75[_0xcb8a('0x32')],_0xaa3c55['filters']),_0x348a8c);if(_0x22be75[_0xcb8a('0x32')][_0xcb8a('0x3d')]){_0x2fe306[_0xcb8a('0x3a')]=_['merge'](_0x2fe306['where'],{'$or':_['map'](_0x348a8c,function(_0x5ece2b){if(_0x5ece2b[_0xcb8a('0x30')]!==_0xcb8a('0x3e')){var _0x635cef={};_0x635cef[_0x5ece2b['name']]={'$like':'%'+_0x22be75[_0xcb8a('0x32')][_0xcb8a('0x3d')]+'%'};return _0x635cef;}})});}_0x2fe306=_['merge']({},_0x2fe306,_0x22be75[_0xcb8a('0x3f')]);var _0x532db2={'where':_0x2fe306['where']};return db[_0xcb8a('0x40')][_0xcb8a('0x1d')](_0x532db2)[_0xcb8a('0x25')](function(_0x3a6bff){_0x4dd85f[_0xcb8a('0x1d')]=_0x3a6bff;if(_0x22be75[_0xcb8a('0x32')][_0xcb8a('0x41')]){_0x2fe306[_0xcb8a('0x42')]=[{'all':!![]}];}return db['Campaign'][_0xcb8a('0x43')](_0x2fe306);})[_0xcb8a('0x25')](function(_0x29a86f){_0x4dd85f['rows']=_0x29a86f;return _0x4dd85f;})[_0xcb8a('0x25')](respondWithFilteredResult(_0x1c9833,_0x2fe306))['catch'](handleError(_0x1c9833,null));};exports[_0xcb8a('0x44')]=function(_0x5946c7,_0x34e3e3){var _0x4f53fd={'raw':![],'where':{'id':_0x5946c7[_0xcb8a('0x45')]['id']}},_0x3a1457={};_0x3a1457['model']=_[_0xcb8a('0x33')](db[_0xcb8a('0x40')][_0xcb8a('0x2e')]);_0x3a1457['query']=_['keys'](_0x5946c7[_0xcb8a('0x32')]);_0x3a1457[_0xcb8a('0x3b')]=_[_0xcb8a('0x34')](_0x3a1457[_0xcb8a('0x46')],_0x3a1457['query']);_0x4f53fd['attributes']=_[_0xcb8a('0x34')](_0x3a1457[_0xcb8a('0x46')],qs['fields'](_0x5946c7[_0xcb8a('0x32')][_0xcb8a('0x36')]));_0x4f53fd[_0xcb8a('0x35')]=_0x4f53fd[_0xcb8a('0x35')][_0xcb8a('0x37')]?_0x4f53fd[_0xcb8a('0x35')]:_0x3a1457[_0xcb8a('0x46')];if(_0x5946c7['query'][_0xcb8a('0x41')]){_0x4f53fd[_0xcb8a('0x42')]=[{'all':!![]}];}_0x4f53fd=_[_0xcb8a('0x47')]({},_0x4f53fd,_0x5946c7[_0xcb8a('0x3f')]);return db[_0xcb8a('0x40')]['find'](_0x4f53fd)[_0xcb8a('0x25')](handleEntityNotFound(_0x34e3e3,null))[_0xcb8a('0x25')](respondWithResult(_0x34e3e3,null))[_0xcb8a('0x48')](handleError(_0x34e3e3,null));};exports['create']=function(_0x19d5ec,_0x3e9330){return db[_0xcb8a('0x40')][_0xcb8a('0x49')](_0x19d5ec['body'],{})['then'](function(_0x58a8b1){var _0x3ed851=_0x19d5ec[_0xcb8a('0x4a')][_0xcb8a('0x27')]({'plain':!![]});if(!_0x3ed851)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ed851[_0xcb8a('0x4b')]==='user'){var _0x48fcd0=_0x58a8b1[_0xcb8a('0x27')]({'plain':!![]});var _0x5e0112='IvrCampaigns';return db[_0xcb8a('0x4c')][_0xcb8a('0x4d')]({'where':{'name':_0x5e0112,'userProfileId':_0x3ed851[_0xcb8a('0x4e')]},'raw':!![]})[_0xcb8a('0x25')](function(_0x3c6d12){if(_0x3c6d12&&_0x3c6d12[_0xcb8a('0x4f')]===0x0){return db[_0xcb8a('0x50')][_0xcb8a('0x49')]({'name':_0x48fcd0[_0xcb8a('0x2a')],'resourceId':_0x48fcd0['id'],'type':_0x3c6d12['name'],'sectionId':_0x3c6d12['id']},{})[_0xcb8a('0x25')](function(){return _0x58a8b1;});}else{return _0x58a8b1;}})[_0xcb8a('0x48')](function(_0x1ed7bd){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1ed7bd);throw _0x1ed7bd;});}return _0x58a8b1;})[_0xcb8a('0x25')](respondWithResult(_0x3e9330,0xc9))['catch'](handleError(_0x3e9330,null));};exports['clone']=function(_0x495fb6,_0x55ffd5){var _0x1962fe={'where':{'id':_0x495fb6[_0xcb8a('0x45')]['id']}},_0x4cbef3={};_0x4cbef3[_0xcb8a('0x46')]=_[_0xcb8a('0x33')](db[_0xcb8a('0x40')][_0xcb8a('0x2e')]);_0x1962fe[_0xcb8a('0x35')]=_['intersection'](_0x4cbef3[_0xcb8a('0x46')],qs[_0xcb8a('0x36')](_0x495fb6[_0xcb8a('0x32')]['fields']));_0x1962fe[_0xcb8a('0x35')]=_0x1962fe[_0xcb8a('0x35')][_0xcb8a('0x37')]?_0x1962fe[_0xcb8a('0x35')]:_0x4cbef3[_0xcb8a('0x46')];if(_0x495fb6[_0xcb8a('0x32')][_0xcb8a('0x41')]){_0x1962fe[_0xcb8a('0x42')]=[{'all':!![]}];}_0x1962fe=_[_0xcb8a('0x47')]({},_0x1962fe,_0x495fb6[_0xcb8a('0x3f')]);return db[_0xcb8a('0x40')]['find'](_0x1962fe)[_0xcb8a('0x25')](handleEntityNotFound(_0x55ffd5,null))['then'](function(_0x58e580){if(_0x58e580){var _0x4cbb8e=_0x58e580['get']({'plain':!![]});_0x4cbb8e=qs[_0xcb8a('0x51')](_0x4cbb8e,['id',_0xcb8a('0x52'),'updatedAt']);_0x495fb6['body']=_['omit'](_0x495fb6['body'],['id',_0xcb8a('0x52'),_0xcb8a('0x53')]);return db[_0xcb8a('0x40')]['create'](_[_0xcb8a('0x47')](_0x4cbb8e,_0x495fb6['body']),{'include':_0x495fb6[_0xcb8a('0x32')]['includeAll']?[{'all':!![]}]:undefined})[_0xcb8a('0x25')](function(_0x3dc3dc){var _0x5239f6=_0x495fb6[_0xcb8a('0x4a')]['get']({'plain':!![]});if(!_0x5239f6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5239f6[_0xcb8a('0x4b')]===_0xcb8a('0x4a')){var _0x53b3f3=_0x3dc3dc[_0xcb8a('0x27')]({'plain':!![]});var _0x162965=_0xcb8a('0x54');return db[_0xcb8a('0x4c')][_0xcb8a('0x4d')]({'where':{'name':_0x162965,'userProfileId':_0x5239f6['userProfileId']},'raw':!![]})[_0xcb8a('0x25')](function(_0x4941e6){if(_0x4941e6&&_0x4941e6[_0xcb8a('0x4f')]===0x0){return db[_0xcb8a('0x50')][_0xcb8a('0x49')]({'name':_0x53b3f3[_0xcb8a('0x2a')],'resourceId':_0x53b3f3['id'],'type':_0x4941e6[_0xcb8a('0x2a')],'sectionId':_0x4941e6['id']},{})[_0xcb8a('0x25')](function(){return _0x3dc3dc;});}else{return _0x3dc3dc;}})[_0xcb8a('0x48')](function(_0x3bcbdc){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3bcbdc);throw _0x3bcbdc;});}return _0x3dc3dc;});}})['then'](respondWithResult(_0x55ffd5,0xc9))[_0xcb8a('0x48')](handleError(_0x55ffd5,null));};exports[_0xcb8a('0x55')]=function(_0xd0c25e,_0x54aae7){if(_0xd0c25e[_0xcb8a('0x56')]['id']){delete _0xd0c25e['body']['id'];}return db[_0xcb8a('0x40')][_0xcb8a('0x4d')]({'where':{'id':_0xd0c25e[_0xcb8a('0x45')]['id']}})[_0xcb8a('0x25')](handleEntityNotFound(_0x54aae7,null))[_0xcb8a('0x25')](saveUpdates(_0xd0c25e[_0xcb8a('0x56')],null))[_0xcb8a('0x25')](respondWithResult(_0x54aae7,null))['catch'](handleError(_0x54aae7,null));};exports['destroy']=function(_0x38e72b,_0x50bcf8){return db[_0xcb8a('0x40')][_0xcb8a('0x4d')]({'where':{'id':_0x38e72b[_0xcb8a('0x45')]['id']}})[_0xcb8a('0x25')](handleEntityNotFound(_0x50bcf8,null))[_0xcb8a('0x25')](removeEntity(_0x50bcf8,null))[_0xcb8a('0x48')](handleError(_0x50bcf8,null));};exports[_0xcb8a('0x57')]=function(_0x4816d9,_0x35248d,_0x2806b9){var _0x25d24f={'raw':!![],'where':{}};var _0x43ec88={};var _0x1e536f={'count':0x0,'rows':[]};return db[_0xcb8a('0x40')][_0xcb8a('0x58')]({'where':{'id':_0x4816d9[_0xcb8a('0x45')]['id']}})[_0xcb8a('0x25')](handleEntityNotFound(_0x35248d,null))[_0xcb8a('0x25')](function(_0x1ed925){if(_0x1ed925){_0x43ec88['model']=_['keys'](db[_0xcb8a('0x59')][_0xcb8a('0x2e')]);_0x43ec88['query']=_[_0xcb8a('0x33')](_0x4816d9[_0xcb8a('0x32')]);_0x43ec88[_0xcb8a('0x3b')]=_[_0xcb8a('0x34')](_0x43ec88[_0xcb8a('0x46')],_0x43ec88[_0xcb8a('0x32')]);_0x25d24f[_0xcb8a('0x35')]=_[_0xcb8a('0x34')](_0x43ec88[_0xcb8a('0x46')],qs['fields'](_0x4816d9[_0xcb8a('0x32')][_0xcb8a('0x36')]));_0x25d24f[_0xcb8a('0x35')]=_0x25d24f['attributes'][_0xcb8a('0x37')]?_0x25d24f['attributes']:_0x43ec88[_0xcb8a('0x46')];if(!_0x4816d9[_0xcb8a('0x32')][_0xcb8a('0x5a')]('nolimit')){_0x25d24f[_0xcb8a('0x1e')]=qs['limit'](_0x4816d9['query'][_0xcb8a('0x1e')]);_0x25d24f['offset']=qs[_0xcb8a('0x1b')](_0x4816d9['query'][_0xcb8a('0x1b')]);}_0x25d24f[_0xcb8a('0x5b')]=qs['sort'](_0x4816d9['query'][_0xcb8a('0x39')]);_0x25d24f[_0xcb8a('0x3a')]=qs['filters'](_['pick'](_0x4816d9[_0xcb8a('0x32')],_0x43ec88[_0xcb8a('0x3b')]));_0x25d24f[_0xcb8a('0x3a')][_0xcb8a('0x5c')]=_0x1ed925['id'];if(_0x4816d9[_0xcb8a('0x32')][_0xcb8a('0x3d')]){_0x25d24f[_0xcb8a('0x3a')]=_['merge'](_0x25d24f[_0xcb8a('0x3a')],{'$or':_[_0xcb8a('0x2d')](_0x25d24f[_0xcb8a('0x35')],function(_0x707557){var _0x361b5e={};_0x361b5e[_0x707557]={'$like':'%'+_0x4816d9[_0xcb8a('0x32')]['filter']+'%'};return _0x361b5e;})});}_0x25d24f=_[_0xcb8a('0x47')]({},_0x25d24f,_0x4816d9[_0xcb8a('0x3f')]);return db[_0xcb8a('0x59')]['count']({'where':_0x25d24f['where']})[_0xcb8a('0x25')](function(_0x2bac27){_0x1e536f[_0xcb8a('0x1d')]=_0x2bac27;if(_0x4816d9[_0xcb8a('0x32')][_0xcb8a('0x41')]){_0x25d24f[_0xcb8a('0x42')]=[{'all':!![]}];}return db[_0xcb8a('0x59')]['findAll'](_0x25d24f);})['then'](function(_0x531f6f){_0x1e536f[_0xcb8a('0x5d')]=_0x531f6f;return _0x1e536f;});}})[_0xcb8a('0x25')](respondWithFilteredResult(_0x35248d,_0x25d24f))[_0xcb8a('0x48')](handleError(_0x35248d,null));};exports[_0xcb8a('0x5e')]=function(_0x150e00,_0xd23a30,_0x219726){var _0x28b7d7={'raw':!![],'where':{}};var _0x5b35db={};var _0x13dc2c={'count':0x0,'rows':[]};return db['Campaign'][_0xcb8a('0x58')]({'where':{'id':_0x150e00['params']['id']}})[_0xcb8a('0x25')](handleEntityNotFound(_0xd23a30,null))['then'](function(_0x5b9aea){if(_0x5b9aea){_0x5b35db[_0xcb8a('0x46')]=_[_0xcb8a('0x33')](db[_0xcb8a('0x5f')][_0xcb8a('0x2e')]);_0x5b35db[_0xcb8a('0x32')]=_[_0xcb8a('0x33')](_0x150e00['query']);_0x5b35db[_0xcb8a('0x3b')]=_[_0xcb8a('0x34')](_0x5b35db[_0xcb8a('0x46')],_0x5b35db[_0xcb8a('0x32')]);_0x28b7d7['attributes']=_[_0xcb8a('0x34')](_0x5b35db[_0xcb8a('0x46')],qs[_0xcb8a('0x36')](_0x150e00[_0xcb8a('0x32')][_0xcb8a('0x36')]));_0x28b7d7[_0xcb8a('0x35')]=_0x28b7d7[_0xcb8a('0x35')]['length']?_0x28b7d7[_0xcb8a('0x35')]:_0x5b35db[_0xcb8a('0x46')];if(!_0x150e00['query'][_0xcb8a('0x5a')](_0xcb8a('0x38'))){_0x28b7d7[_0xcb8a('0x1e')]=qs[_0xcb8a('0x1e')](_0x150e00[_0xcb8a('0x32')][_0xcb8a('0x1e')]);_0x28b7d7[_0xcb8a('0x1b')]=qs[_0xcb8a('0x1b')](_0x150e00[_0xcb8a('0x32')]['offset']);}_0x28b7d7[_0xcb8a('0x5b')]=qs[_0xcb8a('0x39')](_0x150e00['query'][_0xcb8a('0x39')]);_0x28b7d7[_0xcb8a('0x3a')]=qs[_0xcb8a('0x3b')](_[_0xcb8a('0x3c')](_0x150e00[_0xcb8a('0x32')],_0x5b35db[_0xcb8a('0x3b')]));_0x28b7d7[_0xcb8a('0x3a')][_0xcb8a('0x5c')]=_0x5b9aea['id'];if(_0x150e00['query'][_0xcb8a('0x3d')]){_0x28b7d7['where']=_[_0xcb8a('0x47')](_0x28b7d7[_0xcb8a('0x3a')],{'$or':_[_0xcb8a('0x2d')](_0x28b7d7['attributes'],function(_0x19b156){var _0x5052e2={};_0x5052e2[_0x19b156]={'$like':'%'+_0x150e00[_0xcb8a('0x32')][_0xcb8a('0x3d')]+'%'};return _0x5052e2;})});}_0x28b7d7=_[_0xcb8a('0x47')]({},_0x28b7d7,_0x150e00[_0xcb8a('0x3f')]);return db[_0xcb8a('0x5f')][_0xcb8a('0x1d')]({'where':_0x28b7d7[_0xcb8a('0x3a')]})[_0xcb8a('0x25')](function(_0x201731){_0x13dc2c[_0xcb8a('0x1d')]=_0x201731;if(_0x150e00[_0xcb8a('0x32')][_0xcb8a('0x41')]){_0x28b7d7[_0xcb8a('0x42')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x28b7d7);})[_0xcb8a('0x25')](function(_0x2b52ff){_0x13dc2c[_0xcb8a('0x5d')]=_0x2b52ff;return _0x13dc2c;});}})['then'](respondWithFilteredResult(_0xd23a30,_0x28b7d7))[_0xcb8a('0x48')](handleError(_0xd23a30,null));};exports[_0xcb8a('0x60')]=function(_0x185e73,_0x2232ae,_0x184325){var _0x2ad26e={'raw':!![],'where':{}};var _0x52ef1b={};var _0x13d4f1={'count':0x0,'rows':[]};return db[_0xcb8a('0x40')][_0xcb8a('0x58')]({'where':{'id':_0x185e73[_0xcb8a('0x45')]['id']}})['then'](handleEntityNotFound(_0x2232ae,null))[_0xcb8a('0x25')](function(_0x1b2d7d){if(_0x1b2d7d){_0x52ef1b[_0xcb8a('0x46')]=_[_0xcb8a('0x33')](db['CmHopperFinal'][_0xcb8a('0x2e')]);_0x52ef1b[_0xcb8a('0x32')]=_['keys'](_0x185e73[_0xcb8a('0x32')]);_0x52ef1b[_0xcb8a('0x3b')]=_['intersection'](_0x52ef1b[_0xcb8a('0x46')],_0x52ef1b['query']);_0x2ad26e[_0xcb8a('0x35')]=_[_0xcb8a('0x34')](_0x52ef1b['model'],qs[_0xcb8a('0x36')](_0x185e73[_0xcb8a('0x32')][_0xcb8a('0x36')]));_0x2ad26e[_0xcb8a('0x35')]=_0x2ad26e[_0xcb8a('0x35')][_0xcb8a('0x37')]?_0x2ad26e[_0xcb8a('0x35')]:_0x52ef1b['model'];if(!_0x185e73[_0xcb8a('0x32')][_0xcb8a('0x5a')](_0xcb8a('0x38'))){_0x2ad26e[_0xcb8a('0x1e')]=qs[_0xcb8a('0x1e')](_0x185e73[_0xcb8a('0x32')]['limit']);_0x2ad26e['offset']=qs[_0xcb8a('0x1b')](_0x185e73['query'][_0xcb8a('0x1b')]);}_0x2ad26e['order']=qs['sort'](_0x185e73[_0xcb8a('0x32')][_0xcb8a('0x39')]);_0x2ad26e[_0xcb8a('0x3a')]=qs['filters'](_[_0xcb8a('0x3c')](_0x185e73[_0xcb8a('0x32')],_0x52ef1b[_0xcb8a('0x3b')]));_0x2ad26e[_0xcb8a('0x3a')][_0xcb8a('0x5c')]=_0x1b2d7d['id'];if(_0x185e73[_0xcb8a('0x32')][_0xcb8a('0x3d')]){_0x2ad26e[_0xcb8a('0x3a')]=_[_0xcb8a('0x47')](_0x2ad26e['where'],{'$or':_[_0xcb8a('0x2d')](_0x2ad26e['attributes'],function(_0x208cbf){var _0x2b829c={};_0x2b829c[_0x208cbf]={'$like':'%'+_0x185e73['query']['filter']+'%'};return _0x2b829c;})});}_0x2ad26e=_['merge']({},_0x2ad26e,_0x185e73[_0xcb8a('0x3f')]);return db[_0xcb8a('0x61')][_0xcb8a('0x1d')]({'where':_0x2ad26e['where']})[_0xcb8a('0x25')](function(_0x187e5e){_0x13d4f1['count']=_0x187e5e;if(_0x185e73[_0xcb8a('0x32')][_0xcb8a('0x41')]){_0x2ad26e[_0xcb8a('0x42')]=[{'all':!![]}];}return db[_0xcb8a('0x61')][_0xcb8a('0x43')](_0x2ad26e);})[_0xcb8a('0x25')](function(_0x50dd87){_0x13d4f1[_0xcb8a('0x5d')]=_0x50dd87;return _0x13d4f1;});}})['then'](respondWithFilteredResult(_0x2232ae,_0x2ad26e))[_0xcb8a('0x48')](handleError(_0x2232ae,null));};exports[_0xcb8a('0x62')]=function(_0x421f40,_0x57b54e,_0x3c8ff7){var _0x45b141={'raw':!![],'where':{}};var _0x25fefb={};var _0x53fe4a={'count':0x0,'rows':[]};return db['Campaign'][_0xcb8a('0x58')]({'where':{'id':_0x421f40[_0xcb8a('0x45')]['id']}})[_0xcb8a('0x25')](handleEntityNotFound(_0x57b54e,null))[_0xcb8a('0x25')](function(_0x256d94){if(_0x256d94){_0x25fefb[_0xcb8a('0x46')]=_[_0xcb8a('0x33')](db[_0xcb8a('0x63')][_0xcb8a('0x2e')]);_0x25fefb['query']=_[_0xcb8a('0x33')](_0x421f40['query']);_0x25fefb['filters']=_[_0xcb8a('0x34')](_0x25fefb[_0xcb8a('0x46')],_0x25fefb[_0xcb8a('0x32')]);_0x45b141[_0xcb8a('0x35')]=_['intersection'](_0x25fefb[_0xcb8a('0x46')],qs[_0xcb8a('0x36')](_0x421f40['query'][_0xcb8a('0x36')]));_0x45b141[_0xcb8a('0x35')]=_0x45b141[_0xcb8a('0x35')]['length']?_0x45b141[_0xcb8a('0x35')]:_0x25fefb[_0xcb8a('0x46')];if(!_0x421f40[_0xcb8a('0x32')][_0xcb8a('0x5a')](_0xcb8a('0x38'))){_0x45b141[_0xcb8a('0x1e')]=qs[_0xcb8a('0x1e')](_0x421f40[_0xcb8a('0x32')][_0xcb8a('0x1e')]);_0x45b141[_0xcb8a('0x1b')]=qs[_0xcb8a('0x1b')](_0x421f40[_0xcb8a('0x32')][_0xcb8a('0x1b')]);}_0x45b141[_0xcb8a('0x5b')]=qs[_0xcb8a('0x39')](_0x421f40[_0xcb8a('0x32')]['sort']);_0x45b141[_0xcb8a('0x3a')]=qs[_0xcb8a('0x3b')](_['pick'](_0x421f40[_0xcb8a('0x32')],_0x25fefb['filters']));_0x45b141[_0xcb8a('0x3a')][_0xcb8a('0x5c')]=_0x256d94['id'];if(_0x421f40[_0xcb8a('0x32')]['filter']){_0x45b141['where']=_[_0xcb8a('0x47')](_0x45b141[_0xcb8a('0x3a')],{'$or':_[_0xcb8a('0x2d')](_0x45b141['attributes'],function(_0x510e06){var _0x34e2a3={};_0x34e2a3[_0x510e06]={'$like':'%'+_0x421f40['query'][_0xcb8a('0x3d')]+'%'};return _0x34e2a3;})});}_0x45b141=_[_0xcb8a('0x47')]({},_0x45b141,_0x421f40[_0xcb8a('0x3f')]);return db[_0xcb8a('0x63')][_0xcb8a('0x1d')]({'where':_0x45b141[_0xcb8a('0x3a')]})[_0xcb8a('0x25')](function(_0x4187f1){_0x53fe4a[_0xcb8a('0x1d')]=_0x4187f1;if(_0x421f40[_0xcb8a('0x32')][_0xcb8a('0x41')]){_0x45b141['include']=[{'all':!![]}];}return db[_0xcb8a('0x63')]['findAll'](_0x45b141);})[_0xcb8a('0x25')](function(_0x169376){_0x53fe4a[_0xcb8a('0x5d')]=_0x169376;return _0x53fe4a;});}})[_0xcb8a('0x25')](respondWithFilteredResult(_0x57b54e,_0x45b141))[_0xcb8a('0x48')](handleError(_0x57b54e,null));};exports[_0xcb8a('0x64')]=function(_0x456ed3,_0x4d59a5,_0x5c3bd4){var _0x57ef41={};var _0x311d18={};var _0x2a13f3;var _0x217173;return db[_0xcb8a('0x40')][_0xcb8a('0x58')]({'where':{'id':_0x456ed3['params']['id']}})[_0xcb8a('0x25')](handleEntityNotFound(_0x4d59a5,null))[_0xcb8a('0x25')](function(_0x2551be){if(_0x2551be){_0x2a13f3=_0x2551be;_0x311d18[_0xcb8a('0x46')]=_[_0xcb8a('0x33')](db[_0xcb8a('0x65')][_0xcb8a('0x2e')]);_0x311d18[_0xcb8a('0x32')]=_[_0xcb8a('0x33')](_0x456ed3[_0xcb8a('0x32')]);_0x311d18['filters']=_[_0xcb8a('0x34')](_0x311d18[_0xcb8a('0x46')],_0x311d18[_0xcb8a('0x32')]);_0x57ef41[_0xcb8a('0x35')]=_[_0xcb8a('0x34')](_0x311d18[_0xcb8a('0x46')],qs[_0xcb8a('0x36')](_0x456ed3[_0xcb8a('0x32')][_0xcb8a('0x36')]));_0x57ef41['attributes']=_0x57ef41['attributes']['length']?_0x57ef41[_0xcb8a('0x35')]:_0x311d18[_0xcb8a('0x46')];_0x57ef41['order']=qs['sort'](_0x456ed3[_0xcb8a('0x32')][_0xcb8a('0x39')]);_0x57ef41[_0xcb8a('0x3a')]=qs[_0xcb8a('0x3b')](_['pick'](_0x456ed3[_0xcb8a('0x32')],_0x311d18[_0xcb8a('0x3b')]));if(_0x456ed3['query'][_0xcb8a('0x3d')]){_0x57ef41[_0xcb8a('0x3a')]=_[_0xcb8a('0x47')](_0x57ef41[_0xcb8a('0x3a')],{'$or':_[_0xcb8a('0x2d')](_0x57ef41[_0xcb8a('0x35')],function(_0x224094){var _0x3a9af8={};_0x3a9af8[_0x224094]={'$like':'%'+_0x456ed3[_0xcb8a('0x32')][_0xcb8a('0x3d')]+'%'};return _0x3a9af8;})});}_0x57ef41=_['merge']({},_0x57ef41,_0x456ed3['options']);return _0x2a13f3[_0xcb8a('0x64')](_0x57ef41);}})['then'](function(_0x3c9734){if(_0x3c9734){_0x217173=_0x3c9734[_0xcb8a('0x37')];if(!_0x456ed3['query']['hasOwnProperty'](_0xcb8a('0x38'))){_0x57ef41[_0xcb8a('0x1e')]=qs[_0xcb8a('0x1e')](_0x456ed3[_0xcb8a('0x32')]['limit']);_0x57ef41[_0xcb8a('0x1b')]=qs[_0xcb8a('0x1b')](_0x456ed3[_0xcb8a('0x32')][_0xcb8a('0x1b')]);}return _0x2a13f3[_0xcb8a('0x64')](_0x57ef41);}})[_0xcb8a('0x25')](function(_0x53d2db){if(_0x53d2db){return _0x53d2db?{'count':_0x217173,'rows':_0x53d2db}:null;}})[_0xcb8a('0x25')](respondWithResult(_0x4d59a5,null))[_0xcb8a('0x48')](handleError(_0x4d59a5,null));};exports['addLists']=function(_0x1b6345,_0x344447,_0x367345){var _0x14d879,_0x4b3ff6;return db['Campaign'][_0xcb8a('0x4d')]({'where':{'id':_0x1b6345[_0xcb8a('0x45')]['id']}})['then'](handleEntityNotFound(_0x344447,null))[_0xcb8a('0x25')](function(_0x4fcfbe){if(_0x4fcfbe){_0x4b3ff6=_0x4fcfbe;return _0x4fcfbe[_0xcb8a('0x66')](_0x1b6345[_0xcb8a('0x56')][_0xcb8a('0x67')],_[_0xcb8a('0x51')](_0x1b6345[_0xcb8a('0x56')],[_0xcb8a('0x67'),'id'])||{});}return null;})[_0xcb8a('0x68')](function(_0x50c1de){var _0x1e043c;_0x14d879=_0x50c1de||[];var _0x179d47=[];if(_0x50c1de){for(var _0x4d5076=0x0;_0x4d5076<_0x50c1de['length'];_0x4d5076+=0x1){var _0x384519=_0x50c1de[_0x4d5076]['get']({'plain':!![]});_0x4b3ff6['dialCheckDuplicateType']=_0x1b6345['body']['dialCheckDuplicateType']?_0x1b6345[_0xcb8a('0x56')]['dialCheckDuplicateType']:_0x4b3ff6[_0xcb8a('0x69')];switch(_0x4b3ff6[_0xcb8a('0x69')]){case _0xcb8a('0x6a'):_0x1e043c=squel['insert']()[_0xcb8a('0x6b')](_0xcb8a('0x6c'))[_0xcb8a('0x6d')]([_0xcb8a('0x6e'),_0xcb8a('0x6f'),_0xcb8a('0x70'),_0xcb8a('0x71'),_0xcb8a('0x5c'),'createdAt',_0xcb8a('0x53')],squel[_0xcb8a('0x72')]()[_0xcb8a('0x73')](_0xcb8a('0x6e'),_0xcb8a('0x6e'))[_0xcb8a('0x73')](_0xcb8a('0x74'),_0xcb8a('0x6f'))['field']('id','ContactId')['field'](_0x384519[_0xcb8a('0x75')][_0xcb8a('0x76')](),_0xcb8a('0x71'))[_0xcb8a('0x73')](_0x1b6345[_0xcb8a('0x45')]['id'][_0xcb8a('0x76')](),'CampaignId')['field'](_0xcb8a('0x74'),_0xcb8a('0x52'))[_0xcb8a('0x73')]('NOW()',_0xcb8a('0x53'))[_0xcb8a('0x77')](_0xcb8a('0x78'))[_0xcb8a('0x3a')]('deletedAt\x20IS\x20NULL')[_0xcb8a('0x3a')](_0xcb8a('0x79'),_0x384519['CmListId'][_0xcb8a('0x76')]())[_0xcb8a('0x3a')](_0xcb8a('0x7a'))[_0xcb8a('0x3a')](_0xcb8a('0x7b'),squel['select']()[_0xcb8a('0x73')](_0xcb8a('0x7c'))['from'](_0xcb8a('0x7d'))[_0xcb8a('0x3a')](_0xcb8a('0x7e'),_0x1b6345[_0xcb8a('0x45')]['id']['toString']()))[_0xcb8a('0x3a')](_0xcb8a('0x7b'),squel[_0xcb8a('0x72')]()[_0xcb8a('0x73')](_0xcb8a('0x7f'))[_0xcb8a('0x77')]('cm_hopper')['where'](_0xcb8a('0x7e'),_0x1b6345[_0xcb8a('0x45')]['id'][_0xcb8a('0x76')]())))[_0xcb8a('0x76')]();break;case'onlyIfOpen':_0x1e043c=squel['insert']()[_0xcb8a('0x6b')](_0xcb8a('0x6c'))['fromQuery']([_0xcb8a('0x6e'),_0xcb8a('0x6f'),_0xcb8a('0x70'),_0xcb8a('0x71'),_0xcb8a('0x5c'),_0xcb8a('0x52'),_0xcb8a('0x53')],squel[_0xcb8a('0x72')]()[_0xcb8a('0x73')]('phone',_0xcb8a('0x6e'))['field'](_0xcb8a('0x74'),_0xcb8a('0x6f'))['field']('id',_0xcb8a('0x70'))[_0xcb8a('0x73')](_0x384519['CmListId'][_0xcb8a('0x76')](),_0xcb8a('0x71'))['field'](_0x1b6345[_0xcb8a('0x45')]['id'][_0xcb8a('0x76')](),_0xcb8a('0x5c'))[_0xcb8a('0x73')](_0xcb8a('0x74'),_0xcb8a('0x52'))['field']('NOW()',_0xcb8a('0x53'))['from'](_0xcb8a('0x78'))[_0xcb8a('0x3a')](_0xcb8a('0x80'))['where'](_0xcb8a('0x79'),_0x384519[_0xcb8a('0x75')][_0xcb8a('0x76')]())[_0xcb8a('0x3a')]('phone\x20IS\x20NOT\x20NULL')[_0xcb8a('0x3a')](_0xcb8a('0x7b'),squel[_0xcb8a('0x72')]()['field'](_0xcb8a('0x7f'))[_0xcb8a('0x77')](_0xcb8a('0x6c'))[_0xcb8a('0x3a')](_0xcb8a('0x7e'),_0x1b6345[_0xcb8a('0x45')]['id'][_0xcb8a('0x76')]())))[_0xcb8a('0x76')]();break;default:_0x1e043c=squel[_0xcb8a('0x81')]()['into'](_0xcb8a('0x6c'))['fromQuery']([_0xcb8a('0x6e'),_0xcb8a('0x6f'),'ContactId',_0xcb8a('0x71'),_0xcb8a('0x5c'),_0xcb8a('0x52'),_0xcb8a('0x53')],squel[_0xcb8a('0x72')]()['field'](_0xcb8a('0x6e'),'phone')[_0xcb8a('0x73')]('NOW()','scheduledAt')['field']('id',_0xcb8a('0x70'))[_0xcb8a('0x73')](_0x384519[_0xcb8a('0x75')][_0xcb8a('0x76')](),_0xcb8a('0x71'))[_0xcb8a('0x73')](_0x1b6345[_0xcb8a('0x45')]['id'][_0xcb8a('0x76')](),_0xcb8a('0x5c'))['field'](_0xcb8a('0x74'),'createdAt')[_0xcb8a('0x73')](_0xcb8a('0x74'),_0xcb8a('0x53'))['from']('cm_contacts')[_0xcb8a('0x3a')](_0xcb8a('0x80'))[_0xcb8a('0x3a')]('ListId\x20=\x20?',_0x384519[_0xcb8a('0x75')][_0xcb8a('0x76')]())[_0xcb8a('0x3a')](_0xcb8a('0x7a')))[_0xcb8a('0x76')]();}_0x179d47[_0xcb8a('0x82')](db[_0xcb8a('0x83')]['query'](_0x1e043c));}return BPromise[_0xcb8a('0x84')](_0x179d47);}})[_0xcb8a('0x25')](function(){return _0x14d879;})[_0xcb8a('0x25')](respondWithResult(_0x344447,null))['catch'](handleError(_0x344447,null));};exports[_0xcb8a('0x85')]=function(_0x5acfda,_0x5084d5,_0x593b3a){return db[_0xcb8a('0x40')][_0xcb8a('0x4d')]({'where':{'id':_0x5acfda['params']['id']}})[_0xcb8a('0x25')](handleEntityNotFound(_0x5084d5,null))[_0xcb8a('0x25')](function(_0x1b0d2d){if(_0x1b0d2d){return _0x1b0d2d['removeLists'](_0x5acfda['query'][_0xcb8a('0x67')]);}})['then'](function(_0x3d488f){if(_0x3d488f){return db[_0xcb8a('0x59')][_0xcb8a('0x26')]({'where':{'ListId':_0x5acfda['query'][_0xcb8a('0x67')],'CampaignId':_0x5acfda[_0xcb8a('0x45')]['id']}})['then'](function(){return _0x3d488f;});}})[_0xcb8a('0x25')](respondWithStatusCode(_0x5084d5,null))[_0xcb8a('0x48')](handleError(_0x5084d5,null));};exports[_0xcb8a('0x86')]=function(_0x29de60,_0x3d0639,_0x4d94c5){var _0xe3c16b={};var _0xeae62c={};var _0x4569f2;var _0x3e2234;return db[_0xcb8a('0x40')][_0xcb8a('0x58')]({'where':{'id':_0x29de60[_0xcb8a('0x45')]['id']}})[_0xcb8a('0x25')](handleEntityNotFound(_0x3d0639,null))[_0xcb8a('0x25')](function(_0x11e7f9){if(_0x11e7f9){_0x4569f2=_0x11e7f9;_0xeae62c[_0xcb8a('0x46')]=_[_0xcb8a('0x33')](db['CmList']['rawAttributes']);_0xeae62c[_0xcb8a('0x32')]=_[_0xcb8a('0x33')](_0x29de60[_0xcb8a('0x32')]);_0xeae62c[_0xcb8a('0x3b')]=_[_0xcb8a('0x34')](_0xeae62c[_0xcb8a('0x46')],_0xeae62c[_0xcb8a('0x32')]);_0xe3c16b[_0xcb8a('0x35')]=_['intersection'](_0xeae62c['model'],qs['fields'](_0x29de60['query'][_0xcb8a('0x36')]));_0xe3c16b['attributes']=_0xe3c16b[_0xcb8a('0x35')][_0xcb8a('0x37')]?_0xe3c16b['attributes']:_0xeae62c[_0xcb8a('0x46')];_0xe3c16b[_0xcb8a('0x5b')]=qs[_0xcb8a('0x39')](_0x29de60[_0xcb8a('0x32')][_0xcb8a('0x39')]);_0xe3c16b['where']=qs[_0xcb8a('0x3b')](_[_0xcb8a('0x3c')](_0x29de60[_0xcb8a('0x32')],_0xeae62c[_0xcb8a('0x3b')]));if(_0x29de60['query'][_0xcb8a('0x3d')]){_0xe3c16b[_0xcb8a('0x3a')]=_['merge'](_0xe3c16b[_0xcb8a('0x3a')],{'$or':_['map'](_0xe3c16b['attributes'],function(_0x5a13b3){var _0x175c8d={};_0x175c8d[_0x5a13b3]={'$like':'%'+_0x29de60[_0xcb8a('0x32')][_0xcb8a('0x3d')]+'%'};return _0x175c8d;})});}_0xe3c16b=_[_0xcb8a('0x47')]({},_0xe3c16b,_0x29de60[_0xcb8a('0x3f')]);return _0x4569f2[_0xcb8a('0x86')](_0xe3c16b);}})[_0xcb8a('0x25')](function(_0x16361f){if(_0x16361f){_0x3e2234=_0x16361f[_0xcb8a('0x37')];if(!_0x29de60[_0xcb8a('0x32')]['hasOwnProperty'](_0xcb8a('0x38'))){_0xe3c16b[_0xcb8a('0x1e')]=qs[_0xcb8a('0x1e')](_0x29de60[_0xcb8a('0x32')][_0xcb8a('0x1e')]);_0xe3c16b['offset']=qs[_0xcb8a('0x1b')](_0x29de60[_0xcb8a('0x32')]['offset']);}return _0x4569f2[_0xcb8a('0x86')](_0xe3c16b);}})[_0xcb8a('0x25')](function(_0x35d04b){if(_0x35d04b){return _0x35d04b?{'count':_0x3e2234,'rows':_0x35d04b}:null;}})[_0xcb8a('0x25')](respondWithResult(_0x3d0639,null))['catch'](handleError(_0x3d0639,null));};exports[_0xcb8a('0x87')]=function(_0x6999fd,_0x12db8b,_0x13aa7c){var _0x4ade74,_0x56966a;return db[_0xcb8a('0x40')]['find']({'where':{'id':_0x6999fd[_0xcb8a('0x45')]['id']}})[_0xcb8a('0x25')](handleEntityNotFound(_0x12db8b,null))[_0xcb8a('0x25')](function(_0x563ef0){if(_0x563ef0){_0x56966a=_0x563ef0;return _0x563ef0[_0xcb8a('0x87')](_0x6999fd[_0xcb8a('0x56')]['ids'],_[_0xcb8a('0x51')](_0x6999fd[_0xcb8a('0x56')],[_0xcb8a('0x67'),'id'])||{});}return null;})[_0xcb8a('0x68')](function(_0x3d3cbf){var _0x3fbff0;_0x4ade74=_0x3d3cbf||[];var _0x1b0a97=[];if(_0x3d3cbf){for(var _0x201e6a=0x0;_0x201e6a<_0x3d3cbf[_0xcb8a('0x37')];_0x201e6a+=0x1){var _0x17ba51=_0x3d3cbf[_0x201e6a]['get']({'plain':!![]});_0x3fbff0=squel[_0xcb8a('0x81')]()[_0xcb8a('0x6b')](_0xcb8a('0x88'))[_0xcb8a('0x6d')]([_0xcb8a('0x6e'),_0xcb8a('0x70'),_0xcb8a('0x71'),_0xcb8a('0x5c'),_0xcb8a('0x52'),_0xcb8a('0x53')],squel['select']()[_0xcb8a('0x73')]('phone','phone')[_0xcb8a('0x73')]('id','ContactId')['field'](_0x17ba51[_0xcb8a('0x75')]['toString'](),_0xcb8a('0x71'))['field'](_0x6999fd['params']['id'][_0xcb8a('0x76')](),'CampaignId')[_0xcb8a('0x73')](_0xcb8a('0x74'),_0xcb8a('0x52'))[_0xcb8a('0x73')](_0xcb8a('0x74'),'updatedAt')[_0xcb8a('0x77')](_0xcb8a('0x78'))[_0xcb8a('0x3a')](_0xcb8a('0x80'))[_0xcb8a('0x3a')](_0xcb8a('0x79'),_0x17ba51[_0xcb8a('0x75')][_0xcb8a('0x76')]())[_0xcb8a('0x3a')](_0xcb8a('0x7a')))['toString']();_0x1b0a97[_0xcb8a('0x82')](db[_0xcb8a('0x83')][_0xcb8a('0x32')](_0x3fbff0));}return BPromise[_0xcb8a('0x84')](_0x1b0a97);}})[_0xcb8a('0x25')](function(){return _0x4ade74;})[_0xcb8a('0x25')](respondWithResult(_0x12db8b,null))['catch'](handleError(_0x12db8b,null));};exports[_0xcb8a('0x89')]=function(_0x5a5539,_0x30d7d6,_0x4d8d26){return db[_0xcb8a('0x40')][_0xcb8a('0x4d')]({'where':{'id':_0x5a5539[_0xcb8a('0x45')]['id']}})['then'](handleEntityNotFound(_0x30d7d6,null))[_0xcb8a('0x25')](function(_0x53c4f3){if(_0x53c4f3){return _0x53c4f3['removeBlackLists'](_0x5a5539[_0xcb8a('0x32')][_0xcb8a('0x67')]);}})[_0xcb8a('0x25')](function(_0x1e5ef7){if(_0x1e5ef7){return db[_0xcb8a('0x63')][_0xcb8a('0x26')]({'where':{'ListId':_0x5a5539['query'][_0xcb8a('0x67')],'CampaignId':_0x5a5539['params']['id']}})[_0xcb8a('0x25')](function(){return _0x1e5ef7;});}})[_0xcb8a('0x25')](respondWithStatusCode(_0x30d7d6,null))[_0xcb8a('0x48')](handleError(_0x30d7d6,null));}; \ No newline at end of file +var _0xc4bd=['omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','getHoppers','findOne','CmHopper','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','ids','dialCheckDuplicateType','always','into','fromQuery','scheduledAt','ContactId','ListId','field','phone','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','NOW()','sequelize','removeLists','getBlackLists','addBlackLists','push','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','IvrCampaigns','UserProfileResource','destroy','error','name','send','index','map','type','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','Campaign','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','options','find','create','body','get','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone'];(function(_0x10511a,_0x156d15){var _0x2c3edc=function(_0x3ed68d){while(--_0x3ed68d){_0x10511a['push'](_0x10511a['shift']());}};_0x2c3edc(++_0x156d15);}(_0xc4bd,0x140));var _0xdc4b=function(_0x3f36fb,_0x2157a3){_0x3f36fb=_0x3f36fb-0x0;var _0xb394bc=_0xc4bd[_0x3f36fb];return _0xb394bc;};'use strict';var emlformat=require(_0xdc4b('0x0'));var rimraf=require(_0xdc4b('0x1'));var zipdir=require(_0xdc4b('0x2'));var jsonpatch=require(_0xdc4b('0x3'));var rp=require(_0xdc4b('0x4'));var moment=require('moment');var BPromise=require(_0xdc4b('0x5'));var Mustache=require(_0xdc4b('0x6'));var util=require('util');var path=require(_0xdc4b('0x7'));var sox=require(_0xdc4b('0x8'));var csv=require(_0xdc4b('0x9'));var ejs=require(_0xdc4b('0xa'));var fs=require('fs');var fs_extra=require(_0xdc4b('0xb'));var _=require(_0xdc4b('0xc'));var squel=require(_0xdc4b('0xd'));var crypto=require(_0xdc4b('0xe'));var jsforce=require(_0xdc4b('0xf'));var deskjs=require(_0xdc4b('0x10'));var toCsv=require(_0xdc4b('0x9'));var querystring=require(_0xdc4b('0x11'));var Papa=require(_0xdc4b('0x12'));var Redis=require(_0xdc4b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xdc4b('0x14'));var as=require(_0xdc4b('0x15'));var hardwareService=require(_0xdc4b('0x16'));var logger=require('../../config/logger')(_0xdc4b('0x17'));var utils=require('../../config/utils');var config=require(_0xdc4b('0x18'));var licenseUtil=require(_0xdc4b('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a52ce,_0x327eeb){_0x327eeb=_0x327eeb||0xcc;return function(_0x4410da){if(_0x4410da){return _0x2a52ce[_0xdc4b('0x1a')](_0x327eeb);}return _0x2a52ce[_0xdc4b('0x1b')](_0x327eeb)[_0xdc4b('0x1c')]();};}function respondWithResult(_0x2a3acd,_0x9183c0){_0x9183c0=_0x9183c0||0xc8;return function(_0x3b7fc3){if(_0x3b7fc3){return _0x2a3acd[_0xdc4b('0x1b')](_0x9183c0)['json'](_0x3b7fc3);}};}function respondWithFilteredResult(_0xd7ee3a,_0x3c1d97){return function(_0x3e4974){if(_0x3e4974){var _0x2d0232=typeof _0x3c1d97[_0xdc4b('0x1d')]==='undefined'&&typeof _0x3c1d97[_0xdc4b('0x1e')]===_0xdc4b('0x1f');var _0x2178d5=_0x3e4974[_0xdc4b('0x20')];var _0x3ea75c=_0x2d0232?0x0:_0x3c1d97[_0xdc4b('0x1d')];var _0xced4d8=_0x2d0232?_0x3e4974[_0xdc4b('0x20')]:_0x3c1d97[_0xdc4b('0x1d')]+_0x3c1d97['limit'];var _0x5abdf2;if(_0xced4d8>=_0x2178d5){_0xced4d8=_0x2178d5;_0x5abdf2=0xc8;}else{_0x5abdf2=0xce;}_0xd7ee3a[_0xdc4b('0x1b')](_0x5abdf2);return _0xd7ee3a[_0xdc4b('0x21')](_0xdc4b('0x22'),_0x3ea75c+'-'+_0xced4d8+'/'+_0x2178d5)['json'](_0x3e4974);}return null;};}function patchUpdates(_0x5011bf){return function(_0x5588cc){try{jsonpatch[_0xdc4b('0x23')](_0x5588cc,_0x5011bf,!![]);}catch(_0x52f34c){return BPromise[_0xdc4b('0x24')](_0x52f34c);}return _0x5588cc[_0xdc4b('0x25')]();};}function saveUpdates(_0x11cf35,_0x18fd73){return function(_0x156f46){if(_0x156f46){return _0x156f46[_0xdc4b('0x26')](_0x11cf35)[_0xdc4b('0x27')](function(_0x268d4a){return _0x268d4a;});}return null;};}function removeEntity(_0x17123b,_0x1e3d9a){return function(_0x2edb6a){if(_0x2edb6a){return _0x2edb6a['destroy']()['then'](function(){var _0x1ee78a=_0x2edb6a['get']({'plain':!![]});var _0x4bc01d=_0xdc4b('0x28');return db[_0xdc4b('0x29')][_0xdc4b('0x2a')]({'where':{'type':_0x4bc01d,'resourceId':_0x1ee78a['id']}})[_0xdc4b('0x27')](function(){return _0x2edb6a;});})[_0xdc4b('0x27')](function(){_0x17123b[_0xdc4b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1360b7,_0x4a0b67){return function(_0xb55f24){if(!_0xb55f24){_0x1360b7[_0xdc4b('0x1a')](0x194);}return _0xb55f24;};}function handleError(_0x16917e,_0x25ff3a){_0x25ff3a=_0x25ff3a||0x1f4;return function(_0x164428){logger[_0xdc4b('0x2b')](_0x164428['stack']);if(_0x164428[_0xdc4b('0x2c')]){delete _0x164428[_0xdc4b('0x2c')];}_0x16917e[_0xdc4b('0x1b')](_0x25ff3a)[_0xdc4b('0x2d')](_0x164428);};}exports[_0xdc4b('0x2e')]=function(_0xf3f433,_0x16aba6){var _0x185733={},_0x5efc11={},_0x49ba7a={'count':0x0,'rows':[]};var _0x1dd700=_[_0xdc4b('0x2f')](db['Campaign']['rawAttributes'],function(_0x3f4ebc){return{'name':_0x3f4ebc['fieldName'],'type':_0x3f4ebc[_0xdc4b('0x30')][_0xdc4b('0x31')]};});_0x5efc11[_0xdc4b('0x32')]=_[_0xdc4b('0x2f')](_0x1dd700,_0xdc4b('0x2c'));_0x5efc11[_0xdc4b('0x33')]=_['keys'](_0xf3f433['query']);_0x5efc11[_0xdc4b('0x34')]=_[_0xdc4b('0x35')](_0x5efc11['model'],_0x5efc11[_0xdc4b('0x33')]);_0x185733['attributes']=_[_0xdc4b('0x35')](_0x5efc11[_0xdc4b('0x32')],qs[_0xdc4b('0x36')](_0xf3f433['query'][_0xdc4b('0x36')]));_0x185733['attributes']=_0x185733['attributes'][_0xdc4b('0x37')]?_0x185733[_0xdc4b('0x38')]:_0x5efc11[_0xdc4b('0x32')];if(!_0xf3f433[_0xdc4b('0x33')][_0xdc4b('0x39')](_0xdc4b('0x3a'))){_0x185733[_0xdc4b('0x1e')]=qs[_0xdc4b('0x1e')](_0xf3f433[_0xdc4b('0x33')][_0xdc4b('0x1e')]);_0x185733['offset']=qs[_0xdc4b('0x1d')](_0xf3f433[_0xdc4b('0x33')][_0xdc4b('0x1d')]);}_0x185733[_0xdc4b('0x3b')]=qs[_0xdc4b('0x3c')](_0xf3f433['query'][_0xdc4b('0x3c')]);_0x185733['where']=qs[_0xdc4b('0x34')](_[_0xdc4b('0x3d')](_0xf3f433[_0xdc4b('0x33')],_0x5efc11['filters']),_0x1dd700);if(_0xf3f433['query'][_0xdc4b('0x3e')]){_0x185733[_0xdc4b('0x3f')]=_[_0xdc4b('0x40')](_0x185733[_0xdc4b('0x3f')],{'$or':_[_0xdc4b('0x2f')](_0x1dd700,function(_0x96ee57){if(_0x96ee57[_0xdc4b('0x30')]!==_0xdc4b('0x41')){var _0x3d67d2={};_0x3d67d2[_0x96ee57['name']]={'$like':'%'+_0xf3f433['query'][_0xdc4b('0x3e')]+'%'};return _0x3d67d2;}})});}_0x185733=_[_0xdc4b('0x40')]({},_0x185733,_0xf3f433['options']);var _0x4a5194={'where':_0x185733[_0xdc4b('0x3f')]};return db[_0xdc4b('0x42')][_0xdc4b('0x20')](_0x4a5194)[_0xdc4b('0x27')](function(_0x4c440e){_0x49ba7a[_0xdc4b('0x20')]=_0x4c440e;if(_0xf3f433[_0xdc4b('0x33')][_0xdc4b('0x43')]){_0x185733[_0xdc4b('0x44')]=[{'all':!![]}];}return db[_0xdc4b('0x42')][_0xdc4b('0x45')](_0x185733);})['then'](function(_0x32289c){_0x49ba7a[_0xdc4b('0x46')]=_0x32289c;return _0x49ba7a;})[_0xdc4b('0x27')](respondWithFilteredResult(_0x16aba6,_0x185733))[_0xdc4b('0x47')](handleError(_0x16aba6,null));};exports['show']=function(_0x315105,_0x3b1e3c){var _0x1863c8={'raw':![],'where':{'id':_0x315105[_0xdc4b('0x48')]['id']}},_0x2e9599={};_0x2e9599[_0xdc4b('0x32')]=_['keys'](db[_0xdc4b('0x42')][_0xdc4b('0x49')]);_0x2e9599[_0xdc4b('0x33')]=_[_0xdc4b('0x4a')](_0x315105[_0xdc4b('0x33')]);_0x2e9599[_0xdc4b('0x34')]=_['intersection'](_0x2e9599[_0xdc4b('0x32')],_0x2e9599[_0xdc4b('0x33')]);_0x1863c8[_0xdc4b('0x38')]=_['intersection'](_0x2e9599[_0xdc4b('0x32')],qs['fields'](_0x315105['query']['fields']));_0x1863c8[_0xdc4b('0x38')]=_0x1863c8[_0xdc4b('0x38')][_0xdc4b('0x37')]?_0x1863c8[_0xdc4b('0x38')]:_0x2e9599[_0xdc4b('0x32')];if(_0x315105['query'][_0xdc4b('0x43')]){_0x1863c8[_0xdc4b('0x44')]=[{'all':!![]}];}_0x1863c8=_[_0xdc4b('0x40')]({},_0x1863c8,_0x315105[_0xdc4b('0x4b')]);return db[_0xdc4b('0x42')][_0xdc4b('0x4c')](_0x1863c8)['then'](handleEntityNotFound(_0x3b1e3c,null))[_0xdc4b('0x27')](respondWithResult(_0x3b1e3c,null))[_0xdc4b('0x47')](handleError(_0x3b1e3c,null));};exports[_0xdc4b('0x4d')]=function(_0x276668,_0x200dba){return db[_0xdc4b('0x42')][_0xdc4b('0x4d')](_0x276668[_0xdc4b('0x4e')],{})[_0xdc4b('0x27')](function(_0x1d655f){var _0x3d2af4=_0x276668['user'][_0xdc4b('0x4f')]({'plain':!![]});if(!_0x3d2af4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d2af4['role']===_0xdc4b('0x50')){var _0x5dffec=_0x1d655f[_0xdc4b('0x4f')]({'plain':!![]});var _0x32f778=_0xdc4b('0x28');return db['UserProfileSection'][_0xdc4b('0x4c')]({'where':{'name':_0x32f778,'userProfileId':_0x3d2af4[_0xdc4b('0x51')]},'raw':!![]})[_0xdc4b('0x27')](function(_0x476a18){if(_0x476a18&&_0x476a18[_0xdc4b('0x52')]===0x0){return db[_0xdc4b('0x29')][_0xdc4b('0x4d')]({'name':_0x5dffec[_0xdc4b('0x2c')],'resourceId':_0x5dffec['id'],'type':_0x476a18[_0xdc4b('0x2c')],'sectionId':_0x476a18['id']},{})['then'](function(){return _0x1d655f;});}else{return _0x1d655f;}})['catch'](function(_0x59f019){logger[_0xdc4b('0x2b')](_0xdc4b('0x53'),_0x59f019);throw _0x59f019;});}return _0x1d655f;})['then'](respondWithResult(_0x200dba,0xc9))[_0xdc4b('0x47')](handleError(_0x200dba,null));};exports[_0xdc4b('0x54')]=function(_0x4e62e2,_0x32bb82){var _0x25906c={'where':{'id':_0x4e62e2['params']['id']}},_0x57cbd6={};_0x57cbd6[_0xdc4b('0x32')]=_[_0xdc4b('0x4a')](db[_0xdc4b('0x42')][_0xdc4b('0x49')]);_0x25906c[_0xdc4b('0x38')]=_['intersection'](_0x57cbd6[_0xdc4b('0x32')],qs[_0xdc4b('0x36')](_0x4e62e2[_0xdc4b('0x33')][_0xdc4b('0x36')]));_0x25906c['attributes']=_0x25906c[_0xdc4b('0x38')][_0xdc4b('0x37')]?_0x25906c[_0xdc4b('0x38')]:_0x57cbd6[_0xdc4b('0x32')];if(_0x4e62e2['query']['includeAll']){_0x25906c['include']=[{'all':!![]}];}_0x25906c=_[_0xdc4b('0x40')]({},_0x25906c,_0x4e62e2[_0xdc4b('0x4b')]);return db[_0xdc4b('0x42')][_0xdc4b('0x4c')](_0x25906c)['then'](handleEntityNotFound(_0x32bb82,null))[_0xdc4b('0x27')](function(_0x3b2dc1){if(_0x3b2dc1){var _0x18b01d=_0x3b2dc1[_0xdc4b('0x4f')]({'plain':!![]});_0x18b01d=qs[_0xdc4b('0x55')](_0x18b01d,['id',_0xdc4b('0x56'),_0xdc4b('0x57')]);_0x4e62e2[_0xdc4b('0x4e')]=_[_0xdc4b('0x55')](_0x4e62e2[_0xdc4b('0x4e')],['id',_0xdc4b('0x56'),_0xdc4b('0x57')]);return db[_0xdc4b('0x42')][_0xdc4b('0x4d')](_[_0xdc4b('0x40')](_0x18b01d,_0x4e62e2['body']),{'include':_0x4e62e2[_0xdc4b('0x33')][_0xdc4b('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x163b1f){var _0x291b88=_0x4e62e2[_0xdc4b('0x50')][_0xdc4b('0x4f')]({'plain':!![]});if(!_0x291b88)throw new Error(_0xdc4b('0x58'));if(_0x291b88[_0xdc4b('0x59')]===_0xdc4b('0x50')){var _0x5cabc1=_0x163b1f[_0xdc4b('0x4f')]({'plain':!![]});var _0x841dd4=_0xdc4b('0x28');return db[_0xdc4b('0x5a')][_0xdc4b('0x4c')]({'where':{'name':_0x841dd4,'userProfileId':_0x291b88[_0xdc4b('0x51')]},'raw':!![]})[_0xdc4b('0x27')](function(_0x33cc2e){if(_0x33cc2e&&_0x33cc2e[_0xdc4b('0x52')]===0x0){return db[_0xdc4b('0x29')][_0xdc4b('0x4d')]({'name':_0x5cabc1[_0xdc4b('0x2c')],'resourceId':_0x5cabc1['id'],'type':_0x33cc2e[_0xdc4b('0x2c')],'sectionId':_0x33cc2e['id']},{})[_0xdc4b('0x27')](function(){return _0x163b1f;});}else{return _0x163b1f;}})[_0xdc4b('0x47')](function(_0x585942){logger[_0xdc4b('0x2b')](_0xdc4b('0x53'),_0x585942);throw _0x585942;});}return _0x163b1f;});}})[_0xdc4b('0x27')](respondWithResult(_0x32bb82,0xc9))['catch'](handleError(_0x32bb82,null));};exports[_0xdc4b('0x26')]=function(_0x2e4e65,_0x4b071b){if(_0x2e4e65['body']['id']){delete _0x2e4e65[_0xdc4b('0x4e')]['id'];}return db[_0xdc4b('0x42')][_0xdc4b('0x4c')]({'where':{'id':_0x2e4e65['params']['id']}})[_0xdc4b('0x27')](handleEntityNotFound(_0x4b071b,null))[_0xdc4b('0x27')](saveUpdates(_0x2e4e65[_0xdc4b('0x4e')],null))[_0xdc4b('0x27')](respondWithResult(_0x4b071b,null))[_0xdc4b('0x47')](handleError(_0x4b071b,null));};exports['destroy']=function(_0x39c5c8,_0x5ce73e){return db[_0xdc4b('0x42')][_0xdc4b('0x4c')]({'where':{'id':_0x39c5c8[_0xdc4b('0x48')]['id']}})[_0xdc4b('0x27')](handleEntityNotFound(_0x5ce73e,null))[_0xdc4b('0x27')](removeEntity(_0x5ce73e,null))[_0xdc4b('0x47')](handleError(_0x5ce73e,null));};exports[_0xdc4b('0x5b')]=function(_0x4d5d86,_0xefd2ea,_0x1647e0){var _0x1e5d1={'raw':!![],'where':{}};var _0x421e42={};var _0x268f85={'count':0x0,'rows':[]};return db[_0xdc4b('0x42')][_0xdc4b('0x5c')]({'where':{'id':_0x4d5d86[_0xdc4b('0x48')]['id']}})[_0xdc4b('0x27')](handleEntityNotFound(_0xefd2ea,null))['then'](function(_0x3838a6){if(_0x3838a6){_0x421e42[_0xdc4b('0x32')]=_[_0xdc4b('0x4a')](db[_0xdc4b('0x5d')][_0xdc4b('0x49')]);_0x421e42['query']=_[_0xdc4b('0x4a')](_0x4d5d86[_0xdc4b('0x33')]);_0x421e42[_0xdc4b('0x34')]=_['intersection'](_0x421e42[_0xdc4b('0x32')],_0x421e42[_0xdc4b('0x33')]);_0x1e5d1[_0xdc4b('0x38')]=_['intersection'](_0x421e42[_0xdc4b('0x32')],qs[_0xdc4b('0x36')](_0x4d5d86[_0xdc4b('0x33')][_0xdc4b('0x36')]));_0x1e5d1['attributes']=_0x1e5d1[_0xdc4b('0x38')]['length']?_0x1e5d1[_0xdc4b('0x38')]:_0x421e42[_0xdc4b('0x32')];if(!_0x4d5d86[_0xdc4b('0x33')][_0xdc4b('0x39')]('nolimit')){_0x1e5d1['limit']=qs[_0xdc4b('0x1e')](_0x4d5d86['query'][_0xdc4b('0x1e')]);_0x1e5d1[_0xdc4b('0x1d')]=qs[_0xdc4b('0x1d')](_0x4d5d86[_0xdc4b('0x33')][_0xdc4b('0x1d')]);}_0x1e5d1[_0xdc4b('0x3b')]=qs['sort'](_0x4d5d86[_0xdc4b('0x33')]['sort']);_0x1e5d1[_0xdc4b('0x3f')]=qs[_0xdc4b('0x34')](_[_0xdc4b('0x3d')](_0x4d5d86[_0xdc4b('0x33')],_0x421e42[_0xdc4b('0x34')]));_0x1e5d1[_0xdc4b('0x3f')]['CampaignId']=_0x3838a6['id'];if(_0x4d5d86[_0xdc4b('0x33')][_0xdc4b('0x3e')]){_0x1e5d1[_0xdc4b('0x3f')]=_[_0xdc4b('0x40')](_0x1e5d1[_0xdc4b('0x3f')],{'$or':_[_0xdc4b('0x2f')](_0x1e5d1['attributes'],function(_0x384182){var _0x370f25={};_0x370f25[_0x384182]={'$like':'%'+_0x4d5d86[_0xdc4b('0x33')][_0xdc4b('0x3e')]+'%'};return _0x370f25;})});}_0x1e5d1=_[_0xdc4b('0x40')]({},_0x1e5d1,_0x4d5d86['options']);return db['CmHopper'][_0xdc4b('0x20')]({'where':_0x1e5d1['where']})[_0xdc4b('0x27')](function(_0x42b32e){_0x268f85[_0xdc4b('0x20')]=_0x42b32e;if(_0x4d5d86['query']['includeAll']){_0x1e5d1[_0xdc4b('0x44')]=[{'all':!![]}];}return db[_0xdc4b('0x5d')]['findAll'](_0x1e5d1);})[_0xdc4b('0x27')](function(_0x28fe6a){_0x268f85[_0xdc4b('0x46')]=_0x28fe6a;return _0x268f85;});}})[_0xdc4b('0x27')](respondWithFilteredResult(_0xefd2ea,_0x1e5d1))['catch'](handleError(_0xefd2ea,null));};exports['getHopperHistories']=function(_0x449c9e,_0x73c702,_0x396116){var _0x58bd0f={'raw':!![],'where':{}};var _0x1394b0={};var _0x48055c={'count':0x0,'rows':[]};return db[_0xdc4b('0x42')]['findOne']({'where':{'id':_0x449c9e[_0xdc4b('0x48')]['id']}})[_0xdc4b('0x27')](handleEntityNotFound(_0x73c702,null))[_0xdc4b('0x27')](function(_0x46d22a){if(_0x46d22a){_0x1394b0[_0xdc4b('0x32')]=_[_0xdc4b('0x4a')](db[_0xdc4b('0x5e')][_0xdc4b('0x49')]);_0x1394b0[_0xdc4b('0x33')]=_[_0xdc4b('0x4a')](_0x449c9e[_0xdc4b('0x33')]);_0x1394b0[_0xdc4b('0x34')]=_[_0xdc4b('0x35')](_0x1394b0[_0xdc4b('0x32')],_0x1394b0[_0xdc4b('0x33')]);_0x58bd0f[_0xdc4b('0x38')]=_['intersection'](_0x1394b0[_0xdc4b('0x32')],qs[_0xdc4b('0x36')](_0x449c9e[_0xdc4b('0x33')][_0xdc4b('0x36')]));_0x58bd0f[_0xdc4b('0x38')]=_0x58bd0f[_0xdc4b('0x38')][_0xdc4b('0x37')]?_0x58bd0f[_0xdc4b('0x38')]:_0x1394b0[_0xdc4b('0x32')];if(!_0x449c9e[_0xdc4b('0x33')]['hasOwnProperty'](_0xdc4b('0x3a'))){_0x58bd0f[_0xdc4b('0x1e')]=qs['limit'](_0x449c9e['query']['limit']);_0x58bd0f[_0xdc4b('0x1d')]=qs[_0xdc4b('0x1d')](_0x449c9e[_0xdc4b('0x33')][_0xdc4b('0x1d')]);}_0x58bd0f['order']=qs[_0xdc4b('0x3c')](_0x449c9e[_0xdc4b('0x33')][_0xdc4b('0x3c')]);_0x58bd0f[_0xdc4b('0x3f')]=qs[_0xdc4b('0x34')](_[_0xdc4b('0x3d')](_0x449c9e[_0xdc4b('0x33')],_0x1394b0[_0xdc4b('0x34')]));_0x58bd0f[_0xdc4b('0x3f')][_0xdc4b('0x5f')]=_0x46d22a['id'];if(_0x449c9e['query'][_0xdc4b('0x3e')]){_0x58bd0f['where']=_[_0xdc4b('0x40')](_0x58bd0f['where'],{'$or':_[_0xdc4b('0x2f')](_0x58bd0f[_0xdc4b('0x38')],function(_0x26a90e){var _0x229aa3={};_0x229aa3[_0x26a90e]={'$like':'%'+_0x449c9e[_0xdc4b('0x33')][_0xdc4b('0x3e')]+'%'};return _0x229aa3;})});}_0x58bd0f=_['merge']({},_0x58bd0f,_0x449c9e[_0xdc4b('0x4b')]);return db[_0xdc4b('0x5e')]['count']({'where':_0x58bd0f[_0xdc4b('0x3f')]})[_0xdc4b('0x27')](function(_0x3a0503){_0x48055c[_0xdc4b('0x20')]=_0x3a0503;if(_0x449c9e[_0xdc4b('0x33')][_0xdc4b('0x43')]){_0x58bd0f['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0xdc4b('0x45')](_0x58bd0f);})[_0xdc4b('0x27')](function(_0x2e1dfd){_0x48055c[_0xdc4b('0x46')]=_0x2e1dfd;return _0x48055c;});}})['then'](respondWithFilteredResult(_0x73c702,_0x58bd0f))[_0xdc4b('0x47')](handleError(_0x73c702,null));};exports[_0xdc4b('0x60')]=function(_0x2c894f,_0x1106ad,_0x332e8d){var _0x569549={'raw':!![],'where':{}};var _0x41f8ef={};var _0x28a100={'count':0x0,'rows':[]};return db[_0xdc4b('0x42')][_0xdc4b('0x5c')]({'where':{'id':_0x2c894f[_0xdc4b('0x48')]['id']}})[_0xdc4b('0x27')](handleEntityNotFound(_0x1106ad,null))[_0xdc4b('0x27')](function(_0x4a115e){if(_0x4a115e){_0x41f8ef[_0xdc4b('0x32')]=_[_0xdc4b('0x4a')](db[_0xdc4b('0x61')][_0xdc4b('0x49')]);_0x41f8ef[_0xdc4b('0x33')]=_['keys'](_0x2c894f['query']);_0x41f8ef[_0xdc4b('0x34')]=_[_0xdc4b('0x35')](_0x41f8ef['model'],_0x41f8ef['query']);_0x569549[_0xdc4b('0x38')]=_[_0xdc4b('0x35')](_0x41f8ef[_0xdc4b('0x32')],qs[_0xdc4b('0x36')](_0x2c894f[_0xdc4b('0x33')][_0xdc4b('0x36')]));_0x569549[_0xdc4b('0x38')]=_0x569549[_0xdc4b('0x38')][_0xdc4b('0x37')]?_0x569549[_0xdc4b('0x38')]:_0x41f8ef[_0xdc4b('0x32')];if(!_0x2c894f[_0xdc4b('0x33')][_0xdc4b('0x39')]('nolimit')){_0x569549[_0xdc4b('0x1e')]=qs['limit'](_0x2c894f['query']['limit']);_0x569549[_0xdc4b('0x1d')]=qs[_0xdc4b('0x1d')](_0x2c894f['query'][_0xdc4b('0x1d')]);}_0x569549[_0xdc4b('0x3b')]=qs['sort'](_0x2c894f[_0xdc4b('0x33')][_0xdc4b('0x3c')]);_0x569549['where']=qs['filters'](_['pick'](_0x2c894f[_0xdc4b('0x33')],_0x41f8ef[_0xdc4b('0x34')]));_0x569549[_0xdc4b('0x3f')]['CampaignId']=_0x4a115e['id'];if(_0x2c894f['query'][_0xdc4b('0x3e')]){_0x569549[_0xdc4b('0x3f')]=_['merge'](_0x569549[_0xdc4b('0x3f')],{'$or':_[_0xdc4b('0x2f')](_0x569549[_0xdc4b('0x38')],function(_0x55ed1){var _0x53fd5e={};_0x53fd5e[_0x55ed1]={'$like':'%'+_0x2c894f[_0xdc4b('0x33')]['filter']+'%'};return _0x53fd5e;})});}_0x569549=_[_0xdc4b('0x40')]({},_0x569549,_0x2c894f[_0xdc4b('0x4b')]);return db[_0xdc4b('0x61')][_0xdc4b('0x20')]({'where':_0x569549[_0xdc4b('0x3f')]})[_0xdc4b('0x27')](function(_0x2ef416){_0x28a100[_0xdc4b('0x20')]=_0x2ef416;if(_0x2c894f[_0xdc4b('0x33')][_0xdc4b('0x43')]){_0x569549[_0xdc4b('0x44')]=[{'all':!![]}];}return db[_0xdc4b('0x61')]['findAll'](_0x569549);})[_0xdc4b('0x27')](function(_0xdcbe76){_0x28a100[_0xdc4b('0x46')]=_0xdcbe76;return _0x28a100;});}})[_0xdc4b('0x27')](respondWithFilteredResult(_0x1106ad,_0x569549))[_0xdc4b('0x47')](handleError(_0x1106ad,null));};exports[_0xdc4b('0x62')]=function(_0x219056,_0x5881e2,_0x86611){var _0x2fe3bd={'raw':!![],'where':{}};var _0x4b47a1={};var _0x112b18={'count':0x0,'rows':[]};return db[_0xdc4b('0x42')]['findOne']({'where':{'id':_0x219056[_0xdc4b('0x48')]['id']}})['then'](handleEntityNotFound(_0x5881e2,null))['then'](function(_0x385286){if(_0x385286){_0x4b47a1['model']=_[_0xdc4b('0x4a')](db[_0xdc4b('0x63')][_0xdc4b('0x49')]);_0x4b47a1[_0xdc4b('0x33')]=_[_0xdc4b('0x4a')](_0x219056[_0xdc4b('0x33')]);_0x4b47a1['filters']=_['intersection'](_0x4b47a1['model'],_0x4b47a1[_0xdc4b('0x33')]);_0x2fe3bd[_0xdc4b('0x38')]=_[_0xdc4b('0x35')](_0x4b47a1[_0xdc4b('0x32')],qs[_0xdc4b('0x36')](_0x219056[_0xdc4b('0x33')]['fields']));_0x2fe3bd[_0xdc4b('0x38')]=_0x2fe3bd[_0xdc4b('0x38')][_0xdc4b('0x37')]?_0x2fe3bd[_0xdc4b('0x38')]:_0x4b47a1[_0xdc4b('0x32')];if(!_0x219056[_0xdc4b('0x33')][_0xdc4b('0x39')](_0xdc4b('0x3a'))){_0x2fe3bd[_0xdc4b('0x1e')]=qs[_0xdc4b('0x1e')](_0x219056[_0xdc4b('0x33')][_0xdc4b('0x1e')]);_0x2fe3bd['offset']=qs[_0xdc4b('0x1d')](_0x219056[_0xdc4b('0x33')][_0xdc4b('0x1d')]);}_0x2fe3bd['order']=qs[_0xdc4b('0x3c')](_0x219056[_0xdc4b('0x33')][_0xdc4b('0x3c')]);_0x2fe3bd[_0xdc4b('0x3f')]=qs['filters'](_['pick'](_0x219056[_0xdc4b('0x33')],_0x4b47a1['filters']));_0x2fe3bd[_0xdc4b('0x3f')][_0xdc4b('0x5f')]=_0x385286['id'];if(_0x219056[_0xdc4b('0x33')][_0xdc4b('0x3e')]){_0x2fe3bd[_0xdc4b('0x3f')]=_[_0xdc4b('0x40')](_0x2fe3bd['where'],{'$or':_[_0xdc4b('0x2f')](_0x2fe3bd['attributes'],function(_0x43359d){var _0x1f8447={};_0x1f8447[_0x43359d]={'$like':'%'+_0x219056[_0xdc4b('0x33')][_0xdc4b('0x3e')]+'%'};return _0x1f8447;})});}_0x2fe3bd=_['merge']({},_0x2fe3bd,_0x219056[_0xdc4b('0x4b')]);return db['CmHopperBlack'][_0xdc4b('0x20')]({'where':_0x2fe3bd['where']})[_0xdc4b('0x27')](function(_0x59baf2){_0x112b18[_0xdc4b('0x20')]=_0x59baf2;if(_0x219056[_0xdc4b('0x33')][_0xdc4b('0x43')]){_0x2fe3bd[_0xdc4b('0x44')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x2fe3bd);})['then'](function(_0x58148c){_0x112b18[_0xdc4b('0x46')]=_0x58148c;return _0x112b18;});}})[_0xdc4b('0x27')](respondWithFilteredResult(_0x5881e2,_0x2fe3bd))[_0xdc4b('0x47')](handleError(_0x5881e2,null));};exports[_0xdc4b('0x64')]=function(_0x49265e,_0x41eff1,_0x52d722){var _0xdcff14={};var _0x499a6f={};var _0x4bb644;var _0x1ca30f;return db[_0xdc4b('0x42')][_0xdc4b('0x5c')]({'where':{'id':_0x49265e[_0xdc4b('0x48')]['id']}})['then'](handleEntityNotFound(_0x41eff1,null))[_0xdc4b('0x27')](function(_0x51871f){if(_0x51871f){_0x4bb644=_0x51871f;_0x499a6f['model']=_[_0xdc4b('0x4a')](db[_0xdc4b('0x65')][_0xdc4b('0x49')]);_0x499a6f[_0xdc4b('0x33')]=_['keys'](_0x49265e['query']);_0x499a6f[_0xdc4b('0x34')]=_['intersection'](_0x499a6f[_0xdc4b('0x32')],_0x499a6f[_0xdc4b('0x33')]);_0xdcff14[_0xdc4b('0x38')]=_[_0xdc4b('0x35')](_0x499a6f[_0xdc4b('0x32')],qs[_0xdc4b('0x36')](_0x49265e[_0xdc4b('0x33')]['fields']));_0xdcff14[_0xdc4b('0x38')]=_0xdcff14[_0xdc4b('0x38')]['length']?_0xdcff14[_0xdc4b('0x38')]:_0x499a6f[_0xdc4b('0x32')];_0xdcff14[_0xdc4b('0x3b')]=qs['sort'](_0x49265e[_0xdc4b('0x33')][_0xdc4b('0x3c')]);_0xdcff14[_0xdc4b('0x3f')]=qs[_0xdc4b('0x34')](_[_0xdc4b('0x3d')](_0x49265e[_0xdc4b('0x33')],_0x499a6f[_0xdc4b('0x34')]));if(_0x49265e[_0xdc4b('0x33')][_0xdc4b('0x3e')]){_0xdcff14[_0xdc4b('0x3f')]=_[_0xdc4b('0x40')](_0xdcff14[_0xdc4b('0x3f')],{'$or':_['map'](_0xdcff14['attributes'],function(_0x48947f){var _0x3eee13={};_0x3eee13[_0x48947f]={'$like':'%'+_0x49265e[_0xdc4b('0x33')][_0xdc4b('0x3e')]+'%'};return _0x3eee13;})});}_0xdcff14=_['merge']({},_0xdcff14,_0x49265e[_0xdc4b('0x4b')]);return _0x4bb644[_0xdc4b('0x64')](_0xdcff14);}})['then'](function(_0x2bc16d){if(_0x2bc16d){_0x1ca30f=_0x2bc16d[_0xdc4b('0x37')];if(!_0x49265e[_0xdc4b('0x33')][_0xdc4b('0x39')](_0xdc4b('0x3a'))){_0xdcff14['limit']=qs[_0xdc4b('0x1e')](_0x49265e[_0xdc4b('0x33')]['limit']);_0xdcff14['offset']=qs[_0xdc4b('0x1d')](_0x49265e['query'][_0xdc4b('0x1d')]);}return _0x4bb644['getLists'](_0xdcff14);}})[_0xdc4b('0x27')](function(_0x2b518b){if(_0x2b518b){return _0x2b518b?{'count':_0x1ca30f,'rows':_0x2b518b}:null;}})[_0xdc4b('0x27')](respondWithResult(_0x41eff1,null))[_0xdc4b('0x47')](handleError(_0x41eff1,null));};exports['addLists']=function(_0x1e73da,_0x141287,_0x3cd883){var _0x11a36c,_0x2c8740;return db[_0xdc4b('0x42')][_0xdc4b('0x4c')]({'where':{'id':_0x1e73da[_0xdc4b('0x48')]['id']}})[_0xdc4b('0x27')](handleEntityNotFound(_0x141287,null))[_0xdc4b('0x27')](function(_0x2a74ec){if(_0x2a74ec){_0x2c8740=_0x2a74ec;return _0x2a74ec['addLists'](_0x1e73da[_0xdc4b('0x4e')][_0xdc4b('0x66')],_[_0xdc4b('0x55')](_0x1e73da['body'],[_0xdc4b('0x66'),'id'])||{});}return null;})['spread'](function(_0x1c2923){var _0x43a955;_0x11a36c=_0x1c2923||[];var _0x518790=[];if(_0x1c2923){for(var _0x4835ac=0x0;_0x4835ac<_0x1c2923[_0xdc4b('0x37')];_0x4835ac+=0x1){var _0x202206=_0x1c2923[_0x4835ac][_0xdc4b('0x4f')]({'plain':!![]});_0x2c8740[_0xdc4b('0x67')]=_0x1e73da[_0xdc4b('0x4e')][_0xdc4b('0x67')]?_0x1e73da[_0xdc4b('0x4e')][_0xdc4b('0x67')]:_0x2c8740['dialCheckDuplicateType'];switch(_0x2c8740[_0xdc4b('0x67')]){case _0xdc4b('0x68'):_0x43a955=squel['insert']()[_0xdc4b('0x69')]('cm_hopper')[_0xdc4b('0x6a')](['phone',_0xdc4b('0x6b'),_0xdc4b('0x6c'),_0xdc4b('0x6d'),_0xdc4b('0x5f'),_0xdc4b('0x56'),_0xdc4b('0x57')],squel['select']()[_0xdc4b('0x6e')]('phone',_0xdc4b('0x6f'))[_0xdc4b('0x6e')]('NOW()',_0xdc4b('0x6b'))[_0xdc4b('0x6e')]('id','ContactId')[_0xdc4b('0x6e')](_0x202206['CmListId']['toString'](),_0xdc4b('0x6d'))[_0xdc4b('0x6e')](_0x1e73da[_0xdc4b('0x48')]['id'][_0xdc4b('0x70')](),_0xdc4b('0x5f'))[_0xdc4b('0x6e')]('NOW()',_0xdc4b('0x56'))['field']('NOW()',_0xdc4b('0x57'))[_0xdc4b('0x71')](_0xdc4b('0x72'))[_0xdc4b('0x3f')](_0xdc4b('0x73'))['where'](_0xdc4b('0x74'),_0x202206[_0xdc4b('0x75')][_0xdc4b('0x70')]())[_0xdc4b('0x3f')](_0xdc4b('0x76'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xdc4b('0x77')]()[_0xdc4b('0x6e')](_0xdc4b('0x78'))[_0xdc4b('0x71')](_0xdc4b('0x79'))['where'](_0xdc4b('0x7a'),_0x1e73da[_0xdc4b('0x48')]['id'][_0xdc4b('0x70')]()))[_0xdc4b('0x3f')](_0xdc4b('0x7b'),squel[_0xdc4b('0x77')]()[_0xdc4b('0x6e')](_0xdc4b('0x7c'))['from'](_0xdc4b('0x7d'))[_0xdc4b('0x3f')]('CampaignId\x20=\x20?',_0x1e73da['params']['id']['toString']())))[_0xdc4b('0x70')]();break;case _0xdc4b('0x7e'):_0x43a955=squel[_0xdc4b('0x7f')]()[_0xdc4b('0x69')](_0xdc4b('0x7d'))[_0xdc4b('0x6a')](['phone',_0xdc4b('0x6b'),_0xdc4b('0x6c'),'ListId','CampaignId',_0xdc4b('0x56'),'updatedAt'],squel['select']()[_0xdc4b('0x6e')](_0xdc4b('0x6f'),_0xdc4b('0x6f'))[_0xdc4b('0x6e')]('NOW()',_0xdc4b('0x6b'))[_0xdc4b('0x6e')]('id',_0xdc4b('0x6c'))[_0xdc4b('0x6e')](_0x202206['CmListId']['toString'](),_0xdc4b('0x6d'))[_0xdc4b('0x6e')](_0x1e73da['params']['id'][_0xdc4b('0x70')](),'CampaignId')[_0xdc4b('0x6e')](_0xdc4b('0x80'),'createdAt')[_0xdc4b('0x6e')](_0xdc4b('0x80'),_0xdc4b('0x57'))['from'](_0xdc4b('0x72'))[_0xdc4b('0x3f')](_0xdc4b('0x73'))[_0xdc4b('0x3f')](_0xdc4b('0x74'),_0x202206[_0xdc4b('0x75')][_0xdc4b('0x70')]())[_0xdc4b('0x3f')](_0xdc4b('0x76'))[_0xdc4b('0x3f')](_0xdc4b('0x7b'),squel[_0xdc4b('0x77')]()[_0xdc4b('0x6e')](_0xdc4b('0x7c'))[_0xdc4b('0x71')](_0xdc4b('0x7d'))['where'](_0xdc4b('0x7a'),_0x1e73da[_0xdc4b('0x48')]['id'][_0xdc4b('0x70')]())))['toString']();break;default:_0x43a955=squel[_0xdc4b('0x7f')]()[_0xdc4b('0x69')](_0xdc4b('0x7d'))[_0xdc4b('0x6a')](['phone','scheduledAt',_0xdc4b('0x6c'),'ListId',_0xdc4b('0x5f'),'createdAt',_0xdc4b('0x57')],squel[_0xdc4b('0x77')]()[_0xdc4b('0x6e')](_0xdc4b('0x6f'),_0xdc4b('0x6f'))['field'](_0xdc4b('0x80'),_0xdc4b('0x6b'))['field']('id','ContactId')[_0xdc4b('0x6e')](_0x202206['CmListId']['toString'](),_0xdc4b('0x6d'))['field'](_0x1e73da['params']['id'][_0xdc4b('0x70')](),'CampaignId')['field'](_0xdc4b('0x80'),_0xdc4b('0x56'))[_0xdc4b('0x6e')](_0xdc4b('0x80'),'updatedAt')[_0xdc4b('0x71')](_0xdc4b('0x72'))[_0xdc4b('0x3f')]('deletedAt\x20IS\x20NULL')[_0xdc4b('0x3f')](_0xdc4b('0x74'),_0x202206[_0xdc4b('0x75')][_0xdc4b('0x70')]())[_0xdc4b('0x3f')](_0xdc4b('0x76')))[_0xdc4b('0x70')]();}_0x518790['push'](db[_0xdc4b('0x81')][_0xdc4b('0x33')](_0x43a955));}return BPromise['all'](_0x518790);}})[_0xdc4b('0x27')](function(){return _0x11a36c;})[_0xdc4b('0x27')](respondWithResult(_0x141287,null))[_0xdc4b('0x47')](handleError(_0x141287,null));};exports[_0xdc4b('0x82')]=function(_0x351a39,_0x5e003b,_0x2be6cb){return db[_0xdc4b('0x42')][_0xdc4b('0x4c')]({'where':{'id':_0x351a39[_0xdc4b('0x48')]['id']}})[_0xdc4b('0x27')](handleEntityNotFound(_0x5e003b,null))[_0xdc4b('0x27')](function(_0xc5b0a3){if(_0xc5b0a3){return _0xc5b0a3['removeLists'](_0x351a39[_0xdc4b('0x33')]['ids']);}})['then'](function(_0x2d88cd){if(_0x2d88cd){return db[_0xdc4b('0x5d')]['destroy']({'where':{'ListId':_0x351a39[_0xdc4b('0x33')][_0xdc4b('0x66')],'CampaignId':_0x351a39[_0xdc4b('0x48')]['id']}})['then'](function(){return _0x2d88cd;});}})[_0xdc4b('0x27')](respondWithStatusCode(_0x5e003b,null))['catch'](handleError(_0x5e003b,null));};exports[_0xdc4b('0x83')]=function(_0x421862,_0x57e67a,_0x390b34){var _0x3d9b2d={};var _0x3879d2={};var _0x5a7a88;var _0x100dab;return db[_0xdc4b('0x42')]['findOne']({'where':{'id':_0x421862[_0xdc4b('0x48')]['id']}})[_0xdc4b('0x27')](handleEntityNotFound(_0x57e67a,null))[_0xdc4b('0x27')](function(_0x4cb200){if(_0x4cb200){_0x5a7a88=_0x4cb200;_0x3879d2[_0xdc4b('0x32')]=_[_0xdc4b('0x4a')](db[_0xdc4b('0x65')]['rawAttributes']);_0x3879d2[_0xdc4b('0x33')]=_[_0xdc4b('0x4a')](_0x421862[_0xdc4b('0x33')]);_0x3879d2[_0xdc4b('0x34')]=_[_0xdc4b('0x35')](_0x3879d2[_0xdc4b('0x32')],_0x3879d2[_0xdc4b('0x33')]);_0x3d9b2d[_0xdc4b('0x38')]=_[_0xdc4b('0x35')](_0x3879d2[_0xdc4b('0x32')],qs[_0xdc4b('0x36')](_0x421862[_0xdc4b('0x33')][_0xdc4b('0x36')]));_0x3d9b2d['attributes']=_0x3d9b2d[_0xdc4b('0x38')][_0xdc4b('0x37')]?_0x3d9b2d[_0xdc4b('0x38')]:_0x3879d2[_0xdc4b('0x32')];_0x3d9b2d[_0xdc4b('0x3b')]=qs[_0xdc4b('0x3c')](_0x421862[_0xdc4b('0x33')][_0xdc4b('0x3c')]);_0x3d9b2d['where']=qs[_0xdc4b('0x34')](_[_0xdc4b('0x3d')](_0x421862['query'],_0x3879d2[_0xdc4b('0x34')]));if(_0x421862['query'][_0xdc4b('0x3e')]){_0x3d9b2d[_0xdc4b('0x3f')]=_['merge'](_0x3d9b2d[_0xdc4b('0x3f')],{'$or':_[_0xdc4b('0x2f')](_0x3d9b2d['attributes'],function(_0x258705){var _0x5c7a63={};_0x5c7a63[_0x258705]={'$like':'%'+_0x421862['query'][_0xdc4b('0x3e')]+'%'};return _0x5c7a63;})});}_0x3d9b2d=_[_0xdc4b('0x40')]({},_0x3d9b2d,_0x421862[_0xdc4b('0x4b')]);return _0x5a7a88[_0xdc4b('0x83')](_0x3d9b2d);}})[_0xdc4b('0x27')](function(_0x216b50){if(_0x216b50){_0x100dab=_0x216b50[_0xdc4b('0x37')];if(!_0x421862['query'][_0xdc4b('0x39')]('nolimit')){_0x3d9b2d[_0xdc4b('0x1e')]=qs[_0xdc4b('0x1e')](_0x421862[_0xdc4b('0x33')][_0xdc4b('0x1e')]);_0x3d9b2d[_0xdc4b('0x1d')]=qs['offset'](_0x421862['query'][_0xdc4b('0x1d')]);}return _0x5a7a88[_0xdc4b('0x83')](_0x3d9b2d);}})[_0xdc4b('0x27')](function(_0x27c607){if(_0x27c607){return _0x27c607?{'count':_0x100dab,'rows':_0x27c607}:null;}})[_0xdc4b('0x27')](respondWithResult(_0x57e67a,null))[_0xdc4b('0x47')](handleError(_0x57e67a,null));};exports[_0xdc4b('0x84')]=function(_0x7a7a1b,_0x11f54a,_0x21fd9c){var _0x2df040,_0x520c27;return db[_0xdc4b('0x42')]['find']({'where':{'id':_0x7a7a1b[_0xdc4b('0x48')]['id']}})['then'](handleEntityNotFound(_0x11f54a,null))[_0xdc4b('0x27')](function(_0x1c0843){if(_0x1c0843){_0x520c27=_0x1c0843;return _0x1c0843[_0xdc4b('0x84')](_0x7a7a1b[_0xdc4b('0x4e')]['ids'],_[_0xdc4b('0x55')](_0x7a7a1b[_0xdc4b('0x4e')],[_0xdc4b('0x66'),'id'])||{});}return null;})['spread'](function(_0x2d2172){var _0x4b387c;_0x2df040=_0x2d2172||[];var _0x18c44c=[];if(_0x2d2172){for(var _0x359749=0x0;_0x359749<_0x2d2172['length'];_0x359749+=0x1){var _0x3f0902=_0x2d2172[_0x359749][_0xdc4b('0x4f')]({'plain':!![]});_0x4b387c=squel[_0xdc4b('0x7f')]()[_0xdc4b('0x69')]('cm_hopper_black')[_0xdc4b('0x6a')]([_0xdc4b('0x6f'),'ContactId',_0xdc4b('0x6d'),_0xdc4b('0x5f'),_0xdc4b('0x56'),_0xdc4b('0x57')],squel[_0xdc4b('0x77')]()[_0xdc4b('0x6e')](_0xdc4b('0x6f'),_0xdc4b('0x6f'))['field']('id',_0xdc4b('0x6c'))['field'](_0x3f0902[_0xdc4b('0x75')]['toString'](),_0xdc4b('0x6d'))[_0xdc4b('0x6e')](_0x7a7a1b['params']['id'][_0xdc4b('0x70')](),_0xdc4b('0x5f'))['field'](_0xdc4b('0x80'),_0xdc4b('0x56'))[_0xdc4b('0x6e')](_0xdc4b('0x80'),_0xdc4b('0x57'))['from'](_0xdc4b('0x72'))[_0xdc4b('0x3f')](_0xdc4b('0x73'))['where']('ListId\x20=\x20?',_0x3f0902['CmListId'][_0xdc4b('0x70')]())[_0xdc4b('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0xdc4b('0x70')]();_0x18c44c[_0xdc4b('0x85')](db[_0xdc4b('0x81')]['query'](_0x4b387c));}return BPromise['all'](_0x18c44c);}})[_0xdc4b('0x27')](function(){return _0x2df040;})[_0xdc4b('0x27')](respondWithResult(_0x11f54a,null))[_0xdc4b('0x47')](handleError(_0x11f54a,null));};exports[_0xdc4b('0x86')]=function(_0x514edf,_0x24de96,_0x447c79){return db[_0xdc4b('0x42')][_0xdc4b('0x4c')]({'where':{'id':_0x514edf['params']['id']}})[_0xdc4b('0x27')](handleEntityNotFound(_0x24de96,null))[_0xdc4b('0x27')](function(_0x1a9811){if(_0x1a9811){return _0x1a9811['removeBlackLists'](_0x514edf[_0xdc4b('0x33')][_0xdc4b('0x66')]);}})[_0xdc4b('0x27')](function(_0x5837a1){if(_0x5837a1){return db[_0xdc4b('0x63')]['destroy']({'where':{'ListId':_0x514edf[_0xdc4b('0x33')][_0xdc4b('0x66')],'CampaignId':_0x514edf[_0xdc4b('0x48')]['id']}})['then'](function(){return _0x5837a1;});}})[_0xdc4b('0x27')](respondWithStatusCode(_0x24de96,null))[_0xdc4b('0x47')](handleError(_0x24de96,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index b851e45..72e3d98 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x2cee34,_0x7e21a9){var _0x5a369e=function(_0x5114d1){while(--_0x5114d1){_0x2cee34['push'](_0x2cee34['shift']());}};_0x5a369e(++_0x7e21a9);}(_0x7a54,0x106));var _0x47a5=function(_0x267210,_0x261b9f){_0x267210=_0x267210-0x0;var _0x485a55=_0x7a54[_0x267210];return _0x485a55;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x129954,_0x17b156){var _0x2b40f2=function(_0x5b3ce1){while(--_0x5b3ce1){_0x129954['push'](_0x129954['shift']());}};_0x2b40f2(++_0x17b156);}(_0x7a54,0x106));var _0x47a5=function(_0x4a1678,_0x35d7d5){_0x4a1678=_0x4a1678-0x0;var _0x4f7c32=_0x7a54[_0x4a1678];return _0x4f7c32;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 3f9297a..38ae9c3 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 _0x5bbd=['info','Campaign,\x20%s,\x20%s','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetCampaign','Campaign','options','raw','where','include','map','model','attributes','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise'];(function(_0x45ee03,_0x2f5319){var _0x13d535=function(_0x391904){while(--_0x391904){_0x45ee03['push'](_0x45ee03['shift']());}};_0x13d535(++_0x2f5319);}(_0x5bbd,0x12b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5bb('0x0'));var util=require(_0xd5bb('0x1'));var moment=require(_0xd5bb('0x2'));var BPromise=require(_0xd5bb('0x3'));var rs=require(_0xd5bb('0x4'));var fs=require('fs');var Redis=require(_0xd5bb('0x5'));var db=require(_0xd5bb('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd5bb('0x7'));var jayson=require(_0xd5bb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x292873,_0x5093d3,_0x3878ba){return new BPromise(function(_0x17c08f,_0x1e7ad6){return client['request'](_0x292873,_0x3878ba)['then'](function(_0x44ffea){logger[_0xd5bb('0x9')](_0xd5bb('0xa'),_0x5093d3,'request\x20sent');logger[_0xd5bb('0xb')](_0xd5bb('0xc'),_0x5093d3,_0xd5bb('0xd'),JSON['stringify'](_0x44ffea));if(_0x44ffea['error']){if(_0x44ffea[_0xd5bb('0xe')][_0xd5bb('0xf')]===0x1f4){logger['error'](_0xd5bb('0xa'),_0x5093d3,_0x44ffea['error'][_0xd5bb('0x10')]);return _0x1e7ad6(_0x44ffea['error'][_0xd5bb('0x10')]);}logger[_0xd5bb('0xe')]('Campaign,\x20%s,\x20%s',_0x5093d3,_0x44ffea[_0xd5bb('0xe')][_0xd5bb('0x10')]);return _0x17c08f(_0x44ffea[_0xd5bb('0xe')]['message']);}else{logger['info'](_0xd5bb('0xa'),_0x5093d3,_0xd5bb('0xd'));_0x17c08f(_0x44ffea['result'][_0xd5bb('0x10')]);}})[_0xd5bb('0x11')](function(_0x3b7021){logger[_0xd5bb('0xe')]('Campaign,\x20%s,\x20%s',_0x5093d3,_0x3b7021);_0x1e7ad6(_0x3b7021);});});}exports[_0xd5bb('0x12')]=function(_0x41bc89){var _0x567d06=this;return new Promise(function(_0x3d312f,_0x222b0c){return db[_0xd5bb('0x13')]['findAll']({'raw':_0x41bc89[_0xd5bb('0x14')]?_0x41bc89[_0xd5bb('0x14')][_0xd5bb('0x15')]===undefined?!![]:![]:!![],'where':_0x41bc89[_0xd5bb('0x14')]?_0x41bc89[_0xd5bb('0x14')][_0xd5bb('0x16')]||null:null,'attributes':_0x41bc89[_0xd5bb('0x14')]?_0x41bc89[_0xd5bb('0x14')]['attributes']||null:null,'limit':_0x41bc89['options']?_0x41bc89[_0xd5bb('0x14')]['limit']||null:null,'include':_0x41bc89['options']?_0x41bc89[_0xd5bb('0x14')][_0xd5bb('0x17')]?_[_0xd5bb('0x18')](_0x41bc89[_0xd5bb('0x14')][_0xd5bb('0x17')],function(_0x52383c){return{'model':db[_0x52383c[_0xd5bb('0x19')]],'as':_0x52383c['as'],'attributes':_0x52383c[_0xd5bb('0x1a')],'include':_0x52383c[_0xd5bb('0x17')]?_[_0xd5bb('0x18')](_0x52383c[_0xd5bb('0x17')],function(_0x48f15d){return{'model':db[_0x48f15d['model']],'as':_0x48f15d['as'],'attributes':_0x48f15d[_0xd5bb('0x1a')],'include':_0x48f15d[_0xd5bb('0x17')]?_[_0xd5bb('0x18')](_0x48f15d[_0xd5bb('0x17')],function(_0x351c33){return{'model':db[_0x351c33['model']],'as':_0x351c33['as'],'attributes':_0x351c33[_0xd5bb('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x30fa6d){logger[_0xd5bb('0x9')](_0xd5bb('0x12'),_0x41bc89);logger[_0xd5bb('0xb')](_0xd5bb('0x12'),_0x41bc89,JSON[_0xd5bb('0x1b')](_0x30fa6d));_0x3d312f(_0x30fa6d);})[_0xd5bb('0x11')](function(_0x228fc4){logger[_0xd5bb('0xe')](_0xd5bb('0x12'),_0x228fc4[_0xd5bb('0x10')],_0x41bc89);_0x222b0c(_0x567d06[_0xd5bb('0xe')](0x1f4,_0x228fc4[_0xd5bb('0x10')]));});});}; \ No newline at end of file +var _0xe79a=['Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','Campaign','findAll','options','raw','where','attributes','limit','include','model','map','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','debug','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x27c4e4,_0x279846){var _0x526f00=function(_0x4c184d){while(--_0x4c184d){_0x27c4e4['push'](_0x27c4e4['shift']());}};_0x526f00(++_0x279846);}(_0xe79a,0x70));var _0xae79=function(_0x31c480,_0x13f64a){_0x31c480=_0x31c480-0x0;var _0x3687ce=_0xe79a[_0x31c480];return _0x3687ce;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xae79('0x0'));var BPromise=require('bluebird');var rs=require(_0xae79('0x1'));var fs=require('fs');var Redis=require(_0xae79('0x2'));var db=require(_0xae79('0x3'))['db'];var utils=require(_0xae79('0x4'));var logger=require('../../config/logger')(_0xae79('0x5'));var config=require(_0xae79('0x6'));var jayson=require(_0xae79('0x7'));var client=jayson['client'][_0xae79('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a92bf,_0x51c226,_0x54e61d){return new BPromise(function(_0x459e6d,_0x417179){return client['request'](_0x3a92bf,_0x54e61d)[_0xae79('0x9')](function(_0x48092a){logger[_0xae79('0xa')]('Campaign,\x20%s,\x20%s',_0x51c226,'request\x20sent');logger[_0xae79('0xb')](_0xae79('0xc'),_0x51c226,_0xae79('0xd'),JSON['stringify'](_0x48092a));if(_0x48092a[_0xae79('0xe')]){if(_0x48092a[_0xae79('0xe')][_0xae79('0xf')]===0x1f4){logger[_0xae79('0xe')](_0xae79('0x10'),_0x51c226,_0x48092a[_0xae79('0xe')][_0xae79('0x11')]);return _0x417179(_0x48092a[_0xae79('0xe')][_0xae79('0x11')]);}logger[_0xae79('0xe')]('Campaign,\x20%s,\x20%s',_0x51c226,_0x48092a[_0xae79('0xe')][_0xae79('0x11')]);return _0x459e6d(_0x48092a[_0xae79('0xe')][_0xae79('0x11')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x51c226,_0xae79('0xd'));_0x459e6d(_0x48092a[_0xae79('0x12')]['message']);}})[_0xae79('0x13')](function(_0x5beb2d){logger[_0xae79('0xe')](_0xae79('0x10'),_0x51c226,_0x5beb2d);_0x417179(_0x5beb2d);});});}exports[_0xae79('0x14')]=function(_0x371944){var _0x3474a0=this;return new Promise(function(_0x5cb7d5,_0x432f0d){return db[_0xae79('0x15')][_0xae79('0x16')]({'raw':_0x371944[_0xae79('0x17')]?_0x371944[_0xae79('0x17')][_0xae79('0x18')]===undefined?!![]:![]:!![],'where':_0x371944['options']?_0x371944[_0xae79('0x17')][_0xae79('0x19')]||null:null,'attributes':_0x371944[_0xae79('0x17')]?_0x371944['options'][_0xae79('0x1a')]||null:null,'limit':_0x371944[_0xae79('0x17')]?_0x371944['options'][_0xae79('0x1b')]||null:null,'include':_0x371944[_0xae79('0x17')]?_0x371944[_0xae79('0x17')][_0xae79('0x1c')]?_['map'](_0x371944[_0xae79('0x17')][_0xae79('0x1c')],function(_0x49c55e){return{'model':db[_0x49c55e[_0xae79('0x1d')]],'as':_0x49c55e['as'],'attributes':_0x49c55e[_0xae79('0x1a')],'include':_0x49c55e[_0xae79('0x1c')]?_['map'](_0x49c55e[_0xae79('0x1c')],function(_0x6a289b){return{'model':db[_0x6a289b[_0xae79('0x1d')]],'as':_0x6a289b['as'],'attributes':_0x6a289b[_0xae79('0x1a')],'include':_0x6a289b['include']?_[_0xae79('0x1e')](_0x6a289b[_0xae79('0x1c')],function(_0x3ee7ea){return{'model':db[_0x3ee7ea['model']],'as':_0x3ee7ea['as'],'attributes':_0x3ee7ea['attributes']};}):[]};}):[]};}):[]:[]})[_0xae79('0x9')](function(_0x4efa59){logger[_0xae79('0xa')](_0xae79('0x14'),_0x371944);logger['debug']('GetCampaign',_0x371944,JSON[_0xae79('0x1f')](_0x4efa59));_0x5cb7d5(_0x4efa59);})[_0xae79('0x13')](function(_0x7281ce){logger[_0xae79('0xe')](_0xae79('0x14'),_0x7281ce[_0xae79('0x11')],_0x371944);_0x432f0d(_0x3474a0['error'](0x1f4,_0x7281ce['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 1f37205..a201a8e 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 _0x27c9=['/:id/hopper_black','getHopperBlacks','/:id/lists','getBlackLists','post','clone','addLists','put','update','delete','removeLists','/:id/blacklists','removeBlackLists','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','show','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals'];(function(_0x55a949,_0x43be62){var _0xbd0bff=function(_0x297308){while(--_0x297308){_0x55a949['push'](_0x55a949['shift']());}};_0xbd0bff(++_0x43be62);}(_0x27c9,0x12e));var _0x927c=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x27c9[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0x927c('0x0'));var util=require(_0x927c('0x1'));var path=require('path');var timeout=require(_0x927c('0x2'));var express=require(_0x927c('0x3'));var router=express[_0x927c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x927c('0x5'));var interaction=require(_0x927c('0x6'));var config=require(_0x927c('0x7'));var controller=require(_0x927c('0x8'));router[_0x927c('0x9')]('/',auth['isAuthenticated'](),controller[_0x927c('0xa')]);router[_0x927c('0x9')](_0x927c('0xb'),auth[_0x927c('0xc')](),controller[_0x927c('0xd')]);router[_0x927c('0x9')]('/:id/hoppers',auth[_0x927c('0xc')](),controller[_0x927c('0xe')]);router[_0x927c('0x9')](_0x927c('0xf'),auth[_0x927c('0xc')](),controller[_0x927c('0x10')]);router[_0x927c('0x9')]('/:id/hopper_finals',auth[_0x927c('0xc')](),controller[_0x927c('0x11')]);router[_0x927c('0x9')](_0x927c('0x12'),auth[_0x927c('0xc')](),controller[_0x927c('0x13')]);router[_0x927c('0x9')](_0x927c('0x14'),auth['isAuthenticated'](),controller['getLists']);router[_0x927c('0x9')]('/:id/blacklists',auth[_0x927c('0xc')](),controller[_0x927c('0x15')]);router[_0x927c('0x16')]('/',auth[_0x927c('0xc')](),controller['create']);router[_0x927c('0x16')]('/:id/clone',auth[_0x927c('0xc')](),controller[_0x927c('0x17')]);router[_0x927c('0x16')]('/:id/lists',auth[_0x927c('0xc')](),controller[_0x927c('0x18')]);router['post']('/:id/blacklists',auth[_0x927c('0xc')](),controller['addBlackLists']);router[_0x927c('0x19')](_0x927c('0xb'),auth[_0x927c('0xc')](),controller[_0x927c('0x1a')]);router[_0x927c('0x1b')]('/:id',auth[_0x927c('0xc')](),controller['destroy']);router['delete'](_0x927c('0x14'),auth[_0x927c('0xc')](),controller[_0x927c('0x1c')]);router[_0x927c('0x1b')](_0x927c('0x1d'),auth[_0x927c('0xc')](),controller[_0x927c('0x1e')]);module[_0x927c('0x1f')]=router; \ No newline at end of file +var _0x93da=['/:id/clone','clone','addLists','addBlackLists','put','delete','destroy','removeLists','removeBlackLists','exports','multer','path','connect-timeout','express','Router','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create'];(function(_0x51500e,_0x484ef0){var _0x3eec6e=function(_0x247c4d){while(--_0x247c4d){_0x51500e['push'](_0x51500e['shift']());}};_0x3eec6e(++_0x484ef0);}(_0x93da,0x92));var _0xa93d=function(_0x69dcb6,_0x282ffc){_0x69dcb6=_0x69dcb6-0x0;var _0x23a8cb=_0x93da[_0x69dcb6];return _0x23a8cb;};'use strict';var multer=require(_0xa93d('0x0'));var util=require('util');var path=require(_0xa93d('0x1'));var timeout=require(_0xa93d('0x2'));var express=require(_0xa93d('0x3'));var router=express[_0xa93d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa93d('0x5'));var controller=require(_0xa93d('0x6'));router[_0xa93d('0x7')]('/',auth[_0xa93d('0x8')](),controller[_0xa93d('0x9')]);router[_0xa93d('0x7')](_0xa93d('0xa'),auth[_0xa93d('0x8')](),controller[_0xa93d('0xb')]);router['get'](_0xa93d('0xc'),auth['isAuthenticated'](),controller[_0xa93d('0xd')]);router[_0xa93d('0x7')](_0xa93d('0xe'),auth['isAuthenticated'](),controller[_0xa93d('0xf')]);router[_0xa93d('0x7')](_0xa93d('0x10'),auth[_0xa93d('0x8')](),controller[_0xa93d('0x11')]);router['get']('/:id/hopper_black',auth[_0xa93d('0x8')](),controller['getHopperBlacks']);router[_0xa93d('0x7')](_0xa93d('0x12'),auth[_0xa93d('0x8')](),controller[_0xa93d('0x13')]);router[_0xa93d('0x7')](_0xa93d('0x14'),auth[_0xa93d('0x8')](),controller[_0xa93d('0x15')]);router[_0xa93d('0x16')]('/',auth[_0xa93d('0x8')](),controller[_0xa93d('0x17')]);router[_0xa93d('0x16')](_0xa93d('0x18'),auth[_0xa93d('0x8')](),controller[_0xa93d('0x19')]);router['post']('/:id/lists',auth[_0xa93d('0x8')](),controller[_0xa93d('0x1a')]);router[_0xa93d('0x16')](_0xa93d('0x14'),auth[_0xa93d('0x8')](),controller[_0xa93d('0x1b')]);router[_0xa93d('0x1c')](_0xa93d('0xa'),auth[_0xa93d('0x8')](),controller['update']);router[_0xa93d('0x1d')](_0xa93d('0xa'),auth['isAuthenticated'](),controller[_0xa93d('0x1e')]);router[_0xa93d('0x1d')](_0xa93d('0x12'),auth['isAuthenticated'](),controller[_0xa93d('0x1f')]);router[_0xa93d('0x1d')](_0xa93d('0x14'),auth[_0xa93d('0x8')](),controller[_0xa93d('0x20')]);module[_0xa93d('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 4f87492..8331af0 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 _0x0c42=['getDataValue','key','sequelize','STRING','VIRTUAL'];(function(_0x1f0559,_0x5257d5){var _0x1edf81=function(_0x1d076d){while(--_0x1d076d){_0x1f0559['push'](_0x1f0559['shift']());}};_0x1edf81(++_0x5257d5);}(_0x0c42,0x179));var _0x20c4=function(_0x5906f1,_0x32f216){_0x5906f1=_0x5906f1-0x0;var _0x3552a8=_0x0c42[_0x5906f1];return _0x3552a8;};'use strict';var Sequelize=require(_0x20c4('0x0'));module['exports']={'key':{'type':Sequelize[_0x20c4('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x20c4('0x1')]},'name':{'type':Sequelize[_0x20c4('0x2')],'get':function(){return this[_0x20c4('0x3')](_0x20c4('0x4'));}}}; \ No newline at end of file +var _0xd247=['exports','STRING','VIRTUAL','key'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xd247,0xac));var _0x7d24=function(_0x380158,_0x599bd1){_0x380158=_0x380158-0x0;var _0x39ac68=_0xd247[_0x380158];return _0x39ac68;};'use strict';var Sequelize=require('sequelize');module[_0x7d24('0x0')]={'key':{'type':Sequelize[_0x7d24('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x7d24('0x1')]},'name':{'type':Sequelize[_0x7d24('0x2')],'get':function(){return this['getDataValue'](_0x7d24('0x3'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 393c727..c1bc407 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 _0x0ca3=['jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','UserProfileResource','error','stack','name','index','CannedAnswer','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','find','body','destroy','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel'];(function(_0x181e5b,_0x5e7d43){var _0x494c61=function(_0x4d0c0e){while(--_0x4d0c0e){_0x181e5b['push'](_0x181e5b['shift']());}};_0x494c61(++_0x5e7d43);}(_0x0ca3,0x1b5));var _0x30ca=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0x0ca3[_0x5d5bcb];return _0x4ea5eb;};'use strict';var emlformat=require(_0x30ca('0x0'));var rimraf=require(_0x30ca('0x1'));var zipdir=require(_0x30ca('0x2'));var jsonpatch=require(_0x30ca('0x3'));var rp=require(_0x30ca('0x4'));var moment=require(_0x30ca('0x5'));var BPromise=require(_0x30ca('0x6'));var Mustache=require(_0x30ca('0x7'));var util=require(_0x30ca('0x8'));var path=require(_0x30ca('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x30ca('0xa'));var fs=require('fs');var fs_extra=require(_0x30ca('0xb'));var _=require('lodash');var squel=require(_0x30ca('0xc'));var crypto=require('crypto');var jsforce=require(_0x30ca('0xd'));var deskjs=require(_0x30ca('0xe'));var toCsv=require(_0x30ca('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x30ca('0x10'));var authService=require(_0x30ca('0x11'));var qs=require(_0x30ca('0x12'));var as=require(_0x30ca('0x13'));var hardwareService=require(_0x30ca('0x14'));var logger=require(_0x30ca('0x15'))('api');var utils=require(_0x30ca('0x16'));var config=require(_0x30ca('0x17'));var licenseUtil=require(_0x30ca('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45763b,_0x55afaf){_0x55afaf=_0x55afaf||0xcc;return function(_0x58dbd2){if(_0x58dbd2){return _0x45763b[_0x30ca('0x19')](_0x55afaf);}return _0x45763b['status'](_0x55afaf)[_0x30ca('0x1a')]();};}function respondWithResult(_0x429af7,_0x3b7737){_0x3b7737=_0x3b7737||0xc8;return function(_0x370815){if(_0x370815){return _0x429af7[_0x30ca('0x1b')](_0x3b7737)['json'](_0x370815);}};}function respondWithFilteredResult(_0x198664,_0x10f3b1){return function(_0x3a085b){if(_0x3a085b){var _0x155584=typeof _0x10f3b1[_0x30ca('0x1c')]===_0x30ca('0x1d')&&typeof _0x10f3b1[_0x30ca('0x1e')]===_0x30ca('0x1d');var _0x37f0e7=_0x3a085b['count'];var _0x6da53c=_0x155584?0x0:_0x10f3b1[_0x30ca('0x1c')];var _0x5258ce=_0x155584?_0x3a085b[_0x30ca('0x1f')]:_0x10f3b1[_0x30ca('0x1c')]+_0x10f3b1[_0x30ca('0x1e')];var _0x4fc776;if(_0x5258ce>=_0x37f0e7){_0x5258ce=_0x37f0e7;_0x4fc776=0xc8;}else{_0x4fc776=0xce;}_0x198664[_0x30ca('0x1b')](_0x4fc776);return _0x198664[_0x30ca('0x20')](_0x30ca('0x21'),_0x6da53c+'-'+_0x5258ce+'/'+_0x37f0e7)[_0x30ca('0x22')](_0x3a085b);}return null;};}function patchUpdates(_0x5583ee){return function(_0x536388){try{jsonpatch['apply'](_0x536388,_0x5583ee,!![]);}catch(_0x44358f){return BPromise[_0x30ca('0x23')](_0x44358f);}return _0x536388[_0x30ca('0x24')]();};}function saveUpdates(_0x51d3c0,_0x2bbfb2){return function(_0x3518f4){if(_0x3518f4){return _0x3518f4[_0x30ca('0x25')](_0x51d3c0)[_0x30ca('0x26')](function(_0x235ebb){return _0x235ebb;});}return null;};}function removeEntity(_0x6ef3d1,_0x30ca64){return function(_0x470523){if(_0x470523){return _0x470523['destroy']()['then'](function(){var _0x28a43e=_0x470523['get']({'plain':!![]});var _0x19199c='CannedAnswers';return db[_0x30ca('0x27')]['destroy']({'where':{'type':_0x19199c,'resourceId':_0x28a43e['id']}})[_0x30ca('0x26')](function(){return _0x470523;});})['then'](function(){_0x6ef3d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4550ca,_0x16e838){return function(_0xcfa08b){if(!_0xcfa08b){_0x4550ca['sendStatus'](0x194);}return _0xcfa08b;};}function handleError(_0x519a69,_0x44925d){_0x44925d=_0x44925d||0x1f4;return function(_0x4b6717){logger[_0x30ca('0x28')](_0x4b6717[_0x30ca('0x29')]);if(_0x4b6717[_0x30ca('0x2a')]){delete _0x4b6717[_0x30ca('0x2a')];}_0x519a69[_0x30ca('0x1b')](_0x44925d)['send'](_0x4b6717);};}exports[_0x30ca('0x2b')]=function(_0x95ac65,_0x48fdd8){var _0x5b54d7={},_0x378398={},_0x31b30d={'count':0x0,'rows':[]};var _0x5a5b34=_['map'](db[_0x30ca('0x2c')][_0x30ca('0x2d')],function(_0x24fb87){return{'name':_0x24fb87['fieldName'],'type':_0x24fb87[_0x30ca('0x2e')][_0x30ca('0x2f')]};});_0x378398[_0x30ca('0x30')]=_[_0x30ca('0x31')](_0x5a5b34,_0x30ca('0x2a'));_0x378398[_0x30ca('0x32')]=_['keys'](_0x95ac65['query']);_0x378398[_0x30ca('0x33')]=_[_0x30ca('0x34')](_0x378398['model'],_0x378398[_0x30ca('0x32')]);_0x5b54d7['attributes']=_[_0x30ca('0x34')](_0x378398[_0x30ca('0x30')],qs[_0x30ca('0x35')](_0x95ac65[_0x30ca('0x32')][_0x30ca('0x35')]));_0x5b54d7[_0x30ca('0x36')]=_0x5b54d7[_0x30ca('0x36')][_0x30ca('0x37')]?_0x5b54d7[_0x30ca('0x36')]:_0x378398['model'];if(!_0x95ac65[_0x30ca('0x32')][_0x30ca('0x38')](_0x30ca('0x39'))){_0x5b54d7[_0x30ca('0x1e')]=qs[_0x30ca('0x1e')](_0x95ac65[_0x30ca('0x32')][_0x30ca('0x1e')]);_0x5b54d7[_0x30ca('0x1c')]=qs[_0x30ca('0x1c')](_0x95ac65[_0x30ca('0x32')][_0x30ca('0x1c')]);}_0x5b54d7[_0x30ca('0x3a')]=qs[_0x30ca('0x3b')](_0x95ac65[_0x30ca('0x32')][_0x30ca('0x3b')]);_0x5b54d7[_0x30ca('0x3c')]=qs['filters'](_[_0x30ca('0x3d')](_0x95ac65[_0x30ca('0x32')],_0x378398[_0x30ca('0x33')]),_0x5a5b34);if(_0x95ac65['query'][_0x30ca('0x3e')]){_0x5b54d7[_0x30ca('0x3c')]=_[_0x30ca('0x3f')](_0x5b54d7[_0x30ca('0x3c')],{'$or':[{'key':{'$like':'%'+_0x95ac65[_0x30ca('0x32')][_0x30ca('0x3e')]+'%'}},{'value':{'$like':'%'+_0x95ac65[_0x30ca('0x32')]['filter']+'%'}}]});}_0x5b54d7=_[_0x30ca('0x3f')]({},_0x5b54d7,_0x95ac65[_0x30ca('0x40')]);var _0x1408cc={'where':_0x5b54d7[_0x30ca('0x3c')]};return db['CannedAnswer'][_0x30ca('0x1f')](_0x1408cc)[_0x30ca('0x26')](function(_0x1122d6){_0x31b30d[_0x30ca('0x1f')]=_0x1122d6;if(_0x95ac65[_0x30ca('0x32')][_0x30ca('0x41')]){_0x5b54d7[_0x30ca('0x42')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x5b54d7);})['then'](function(_0x50943b){_0x31b30d[_0x30ca('0x43')]=_0x50943b;return _0x31b30d;})[_0x30ca('0x26')](respondWithFilteredResult(_0x48fdd8,_0x5b54d7))[_0x30ca('0x44')](handleError(_0x48fdd8,null));};exports[_0x30ca('0x45')]=function(_0x370385,_0x2724f5){var _0x29c72b={'raw':!![],'where':{'id':_0x370385[_0x30ca('0x46')]['id']}},_0x373fb3={};_0x373fb3[_0x30ca('0x30')]=_[_0x30ca('0x47')](db['CannedAnswer'][_0x30ca('0x2d')]);_0x373fb3[_0x30ca('0x32')]=_[_0x30ca('0x47')](_0x370385[_0x30ca('0x32')]);_0x373fb3[_0x30ca('0x33')]=_[_0x30ca('0x34')](_0x373fb3['model'],_0x373fb3[_0x30ca('0x32')]);_0x29c72b['attributes']=_[_0x30ca('0x34')](_0x373fb3['model'],qs[_0x30ca('0x35')](_0x370385[_0x30ca('0x32')][_0x30ca('0x35')]));_0x29c72b['attributes']=_0x29c72b[_0x30ca('0x36')][_0x30ca('0x37')]?_0x29c72b[_0x30ca('0x36')]:_0x373fb3[_0x30ca('0x30')];if(_0x370385[_0x30ca('0x32')][_0x30ca('0x41')]){_0x29c72b[_0x30ca('0x42')]=[{'all':!![]}];}_0x29c72b=_['merge']({},_0x29c72b,_0x370385[_0x30ca('0x40')]);return db[_0x30ca('0x2c')][_0x30ca('0x48')](_0x29c72b)[_0x30ca('0x26')](handleEntityNotFound(_0x2724f5,null))[_0x30ca('0x26')](respondWithResult(_0x2724f5,null))['catch'](handleError(_0x2724f5,null));};exports[_0x30ca('0x25')]=function(_0x233347,_0x4cedda){if(_0x233347[_0x30ca('0x49')]['id']){delete _0x233347[_0x30ca('0x49')]['id'];}return db[_0x30ca('0x2c')][_0x30ca('0x48')]({'where':{'id':_0x233347[_0x30ca('0x46')]['id']}})[_0x30ca('0x26')](handleEntityNotFound(_0x4cedda,null))['then'](saveUpdates(_0x233347[_0x30ca('0x49')],null))[_0x30ca('0x26')](respondWithResult(_0x4cedda,null))['catch'](handleError(_0x4cedda,null));};exports[_0x30ca('0x4a')]=function(_0xc34702,_0x562e5d){return db[_0x30ca('0x2c')]['find']({'where':{'id':_0xc34702[_0x30ca('0x46')]['id']}})[_0x30ca('0x26')](handleEntityNotFound(_0x562e5d,null))['then'](removeEntity(_0x562e5d,null))[_0x30ca('0x44')](handleError(_0x562e5d,null));};exports[_0x30ca('0x4b')]=function(_0xaabf5b,_0x1fa96f){var _0x21332d={'key':_0xaabf5b[_0x30ca('0x49')][_0x30ca('0x2f')]};if(_0xaabf5b['body'][_0x30ca('0x4c')]){_0x21332d[_0x30ca('0x4c')]=_0xaabf5b['body'][_0x30ca('0x4c')];}else if(_0xaabf5b[_0x30ca('0x49')][_0x30ca('0x4d')]){_0x21332d[_0x30ca('0x4d')]=_0xaabf5b[_0x30ca('0x49')][_0x30ca('0x4d')];}else if(_0xaabf5b[_0x30ca('0x49')][_0x30ca('0x4e')]){_0x21332d[_0x30ca('0x4e')]=_0xaabf5b[_0x30ca('0x49')][_0x30ca('0x4e')];}else if(_0xaabf5b[_0x30ca('0x49')][_0x30ca('0x4f')]){_0x21332d['ChatWebsiteId']=_0xaabf5b[_0x30ca('0x49')][_0x30ca('0x4f')];}return db[_0x30ca('0x2c')][_0x30ca('0x48')]({'where':_0x21332d})['then'](function(_0x5f14be){if(_0x5f14be){throw new db['Sequelize'][(_0x30ca('0x50'))](_0x30ca('0x51'));}return db[_0x30ca('0x2c')][_0x30ca('0x4b')](_0xaabf5b[_0x30ca('0x49')]);})[_0x30ca('0x26')](function(_0x244435){var _0x2eb3e8=_0xaabf5b[_0x30ca('0x52')][_0x30ca('0x53')]({'plain':!![]});if(!_0x2eb3e8)throw new Error(_0x30ca('0x54'));if(_0x2eb3e8['role']===_0x30ca('0x52')){var _0x18e889=_0x244435['get']({'plain':!![]});return db[_0x30ca('0x55')]['find']({'where':{'name':_0x30ca('0x56'),'userProfileId':_0x2eb3e8[_0x30ca('0x57')]},'raw':!![]})[_0x30ca('0x26')](function(_0x47a210){if(_0x47a210&&_0x47a210[_0x30ca('0x58')]===0x0){return db[_0x30ca('0x27')]['create']({'name':_0x18e889[_0x30ca('0x2a')],'resourceId':_0x18e889['id'],'type':_0x47a210[_0x30ca('0x2a')],'sectionId':_0x47a210['id']},{})[_0x30ca('0x26')](function(){return _0x244435;});}else{return _0x244435;}})[_0x30ca('0x44')](function(_0x50ea2c){logger['error'](_0x30ca('0x59'),_0x50ea2c);throw _0x50ea2c;});}return _0x244435;})['then'](respondWithResult(_0x1fa96f,0xc9))[_0x30ca('0x44')](handleError(_0x1fa96f,null));}; \ No newline at end of file +var _0x3273=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','CannedAnswer','includeAll','include','findAll','catch','params','rawAttributes','find','body','create','MailAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','apply','reject','save','update','CannedAnswers','UserProfileResource','destroy','then','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x4f9f17,_0xcb1eeb){var _0x521fb5=function(_0x19980c){while(--_0x19980c){_0x4f9f17['push'](_0x4f9f17['shift']());}};_0x521fb5(++_0xcb1eeb);}(_0x3273,0x1da));var _0x3327=function(_0x46bf45,_0x201aaf){_0x46bf45=_0x46bf45-0x0;var _0x10cdc3=_0x3273[_0x46bf45];return _0x10cdc3;};'use strict';var emlformat=require(_0x3327('0x0'));var rimraf=require(_0x3327('0x1'));var zipdir=require(_0x3327('0x2'));var jsonpatch=require(_0x3327('0x3'));var rp=require(_0x3327('0x4'));var moment=require('moment');var BPromise=require(_0x3327('0x5'));var Mustache=require(_0x3327('0x6'));var util=require(_0x3327('0x7'));var path=require(_0x3327('0x8'));var sox=require(_0x3327('0x9'));var csv=require(_0x3327('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3327('0xb'));var squel=require(_0x3327('0xc'));var crypto=require(_0x3327('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3327('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3327('0xf'));var Papa=require(_0x3327('0x10'));var Redis=require(_0x3327('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3327('0x12'));var hardwareService=require(_0x3327('0x13'));var logger=require(_0x3327('0x14'))(_0x3327('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3327('0x16'));var db=require(_0x3327('0x17'))['db'];function respondWithStatusCode(_0x1f6b15,_0x38e719){_0x38e719=_0x38e719||0xcc;return function(_0x46a478){if(_0x46a478){return _0x1f6b15[_0x3327('0x18')](_0x38e719);}return _0x1f6b15['status'](_0x38e719)[_0x3327('0x19')]();};}function respondWithResult(_0x2eb48d,_0x48f1d6){_0x48f1d6=_0x48f1d6||0xc8;return function(_0x506ccd){if(_0x506ccd){return _0x2eb48d['status'](_0x48f1d6)['json'](_0x506ccd);}};}function respondWithFilteredResult(_0x5b5d9d,_0x36c067){return function(_0x10ef2b){if(_0x10ef2b){var _0x47aae9=typeof _0x36c067[_0x3327('0x1a')]===_0x3327('0x1b')&&typeof _0x36c067[_0x3327('0x1c')]===_0x3327('0x1b');var _0x23f807=_0x10ef2b[_0x3327('0x1d')];var _0x336037=_0x47aae9?0x0:_0x36c067['offset'];var _0x4e9d3b=_0x47aae9?_0x10ef2b['count']:_0x36c067[_0x3327('0x1a')]+_0x36c067['limit'];var _0x2ff214;if(_0x4e9d3b>=_0x23f807){_0x4e9d3b=_0x23f807;_0x2ff214=0xc8;}else{_0x2ff214=0xce;}_0x5b5d9d[_0x3327('0x1e')](_0x2ff214);return _0x5b5d9d['set'](_0x3327('0x1f'),_0x336037+'-'+_0x4e9d3b+'/'+_0x23f807)[_0x3327('0x20')](_0x10ef2b);}return null;};}function patchUpdates(_0x18f1ef){return function(_0x5e12d9){try{jsonpatch[_0x3327('0x21')](_0x5e12d9,_0x18f1ef,!![]);}catch(_0xaf46c5){return BPromise[_0x3327('0x22')](_0xaf46c5);}return _0x5e12d9[_0x3327('0x23')]();};}function saveUpdates(_0x1b7765,_0x5de47e){return function(_0x41b427){if(_0x41b427){return _0x41b427[_0x3327('0x24')](_0x1b7765)['then'](function(_0x361743){return _0x361743;});}return null;};}function removeEntity(_0x348c40,_0x4ae62a){return function(_0xa5d74a){if(_0xa5d74a){return _0xa5d74a['destroy']()['then'](function(){var _0x5986fc=_0xa5d74a['get']({'plain':!![]});var _0xbb0785=_0x3327('0x25');return db[_0x3327('0x26')][_0x3327('0x27')]({'where':{'type':_0xbb0785,'resourceId':_0x5986fc['id']}})[_0x3327('0x28')](function(){return _0xa5d74a;});})[_0x3327('0x28')](function(){_0x348c40[_0x3327('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e39a3,_0x567dea){return function(_0x2b474f){if(!_0x2b474f){_0x3e39a3[_0x3327('0x18')](0x194);}return _0x2b474f;};}function handleError(_0x46a0a3,_0x55fe30){_0x55fe30=_0x55fe30||0x1f4;return function(_0x541d52){logger['error'](_0x541d52[_0x3327('0x29')]);if(_0x541d52[_0x3327('0x2a')]){delete _0x541d52[_0x3327('0x2a')];}_0x46a0a3['status'](_0x55fe30)[_0x3327('0x2b')](_0x541d52);};}exports[_0x3327('0x2c')]=function(_0x4b052a,_0x1cea02){var _0x4260cc={},_0x22d7e1={},_0x16b762={'count':0x0,'rows':[]};var _0x297206=_[_0x3327('0x2d')](db['CannedAnswer']['rawAttributes'],function(_0x2f331e){return{'name':_0x2f331e[_0x3327('0x2e')],'type':_0x2f331e[_0x3327('0x2f')][_0x3327('0x30')]};});_0x22d7e1[_0x3327('0x31')]=_[_0x3327('0x2d')](_0x297206,_0x3327('0x2a'));_0x22d7e1[_0x3327('0x32')]=_[_0x3327('0x33')](_0x4b052a['query']);_0x22d7e1[_0x3327('0x34')]=_[_0x3327('0x35')](_0x22d7e1[_0x3327('0x31')],_0x22d7e1['query']);_0x4260cc[_0x3327('0x36')]=_[_0x3327('0x35')](_0x22d7e1['model'],qs[_0x3327('0x37')](_0x4b052a[_0x3327('0x32')][_0x3327('0x37')]));_0x4260cc[_0x3327('0x36')]=_0x4260cc[_0x3327('0x36')][_0x3327('0x38')]?_0x4260cc[_0x3327('0x36')]:_0x22d7e1['model'];if(!_0x4b052a['query'][_0x3327('0x39')](_0x3327('0x3a'))){_0x4260cc['limit']=qs[_0x3327('0x1c')](_0x4b052a[_0x3327('0x32')][_0x3327('0x1c')]);_0x4260cc[_0x3327('0x1a')]=qs['offset'](_0x4b052a[_0x3327('0x32')][_0x3327('0x1a')]);}_0x4260cc[_0x3327('0x3b')]=qs[_0x3327('0x3c')](_0x4b052a[_0x3327('0x32')][_0x3327('0x3c')]);_0x4260cc['where']=qs['filters'](_[_0x3327('0x3d')](_0x4b052a[_0x3327('0x32')],_0x22d7e1[_0x3327('0x34')]),_0x297206);if(_0x4b052a[_0x3327('0x32')][_0x3327('0x3e')]){_0x4260cc[_0x3327('0x3f')]=_['merge'](_0x4260cc['where'],{'$or':[{'key':{'$like':'%'+_0x4b052a[_0x3327('0x32')]['filter']+'%'}},{'value':{'$like':'%'+_0x4b052a['query'][_0x3327('0x3e')]+'%'}}]});}_0x4260cc=_[_0x3327('0x40')]({},_0x4260cc,_0x4b052a[_0x3327('0x41')]);var _0x2b6bf7={'where':_0x4260cc[_0x3327('0x3f')]};return db[_0x3327('0x42')][_0x3327('0x1d')](_0x2b6bf7)[_0x3327('0x28')](function(_0x2f4793){_0x16b762[_0x3327('0x1d')]=_0x2f4793;if(_0x4b052a[_0x3327('0x32')][_0x3327('0x43')]){_0x4260cc[_0x3327('0x44')]=[{'all':!![]}];}return db[_0x3327('0x42')][_0x3327('0x45')](_0x4260cc);})[_0x3327('0x28')](function(_0x17bf5c){_0x16b762['rows']=_0x17bf5c;return _0x16b762;})['then'](respondWithFilteredResult(_0x1cea02,_0x4260cc))[_0x3327('0x46')](handleError(_0x1cea02,null));};exports['show']=function(_0x1546b6,_0x28aeac){var _0x455558={'raw':!![],'where':{'id':_0x1546b6[_0x3327('0x47')]['id']}},_0x3926f7={};_0x3926f7[_0x3327('0x31')]=_[_0x3327('0x33')](db['CannedAnswer'][_0x3327('0x48')]);_0x3926f7[_0x3327('0x32')]=_[_0x3327('0x33')](_0x1546b6[_0x3327('0x32')]);_0x3926f7[_0x3327('0x34')]=_[_0x3327('0x35')](_0x3926f7[_0x3327('0x31')],_0x3926f7[_0x3327('0x32')]);_0x455558[_0x3327('0x36')]=_[_0x3327('0x35')](_0x3926f7[_0x3327('0x31')],qs[_0x3327('0x37')](_0x1546b6[_0x3327('0x32')][_0x3327('0x37')]));_0x455558['attributes']=_0x455558[_0x3327('0x36')][_0x3327('0x38')]?_0x455558[_0x3327('0x36')]:_0x3926f7[_0x3327('0x31')];if(_0x1546b6['query'][_0x3327('0x43')]){_0x455558['include']=[{'all':!![]}];}_0x455558=_['merge']({},_0x455558,_0x1546b6[_0x3327('0x41')]);return db[_0x3327('0x42')][_0x3327('0x49')](_0x455558)[_0x3327('0x28')](handleEntityNotFound(_0x28aeac,null))[_0x3327('0x28')](respondWithResult(_0x28aeac,null))[_0x3327('0x46')](handleError(_0x28aeac,null));};exports[_0x3327('0x24')]=function(_0x4f3ac7,_0x4c199b){if(_0x4f3ac7[_0x3327('0x4a')]['id']){delete _0x4f3ac7['body']['id'];}return db['CannedAnswer'][_0x3327('0x49')]({'where':{'id':_0x4f3ac7[_0x3327('0x47')]['id']}})[_0x3327('0x28')](handleEntityNotFound(_0x4c199b,null))['then'](saveUpdates(_0x4f3ac7['body'],null))['then'](respondWithResult(_0x4c199b,null))['catch'](handleError(_0x4c199b,null));};exports[_0x3327('0x27')]=function(_0x1698cd,_0x55122d){return db['CannedAnswer'][_0x3327('0x49')]({'where':{'id':_0x1698cd['params']['id']}})[_0x3327('0x28')](handleEntityNotFound(_0x55122d,null))[_0x3327('0x28')](removeEntity(_0x55122d,null))[_0x3327('0x46')](handleError(_0x55122d,null));};exports[_0x3327('0x4b')]=function(_0x260194,_0xdf94d6){var _0x2139f4={'key':_0x260194[_0x3327('0x4a')][_0x3327('0x30')]};if(_0x260194[_0x3327('0x4a')]['MailAccountId']){_0x2139f4['MailAccountId']=_0x260194[_0x3327('0x4a')][_0x3327('0x4c')];}else if(_0x260194[_0x3327('0x4a')]['SmsAccountId']){_0x2139f4['SmsAccountId']=_0x260194[_0x3327('0x4a')]['SmsAccountId'];}else if(_0x260194['body'][_0x3327('0x4d')]){_0x2139f4[_0x3327('0x4d')]=_0x260194[_0x3327('0x4a')][_0x3327('0x4d')];}else if(_0x260194[_0x3327('0x4a')][_0x3327('0x4e')]){_0x2139f4[_0x3327('0x4e')]=_0x260194[_0x3327('0x4a')][_0x3327('0x4e')];}return db[_0x3327('0x42')][_0x3327('0x49')]({'where':_0x2139f4})[_0x3327('0x28')](function(_0x1f61ac){if(_0x1f61ac){throw new db[(_0x3327('0x4f'))][(_0x3327('0x50'))](_0x3327('0x51'));}return db[_0x3327('0x42')]['create'](_0x260194[_0x3327('0x4a')]);})[_0x3327('0x28')](function(_0xa0b573){var _0x2b425a=_0x260194[_0x3327('0x52')][_0x3327('0x53')]({'plain':!![]});if(!_0x2b425a)throw new Error(_0x3327('0x54'));if(_0x2b425a[_0x3327('0x55')]===_0x3327('0x52')){var _0x5f3cb9=_0xa0b573[_0x3327('0x53')]({'plain':!![]});return db['UserProfileSection'][_0x3327('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x2b425a['userProfileId']},'raw':!![]})['then'](function(_0x245152){if(_0x245152&&_0x245152[_0x3327('0x56')]===0x0){return db[_0x3327('0x26')][_0x3327('0x4b')]({'name':_0x5f3cb9['name'],'resourceId':_0x5f3cb9['id'],'type':_0x245152[_0x3327('0x2a')],'sectionId':_0x245152['id']},{})['then'](function(){return _0xa0b573;});}else{return _0xa0b573;}})[_0x3327('0x46')](function(_0x1a4651){logger[_0x3327('0x57')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1a4651);throw _0x1a4651;});}return _0xa0b573;})['then'](respondWithResult(_0xdf94d6,0xc9))[_0x3327('0x46')](handleError(_0xdf94d6,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index c90cb26..01aa7ae 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 _0x92db=['../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0x92db,0x111));var _0xb92d=function(_0x59f89a,_0x22bc8b){_0x59f89a=_0x59f89a-0x0;var _0x2783d2=_0x92db[_0x59f89a];return _0x2783d2;};'use strict';var _=require('lodash');var util=require(_0xb92d('0x0'));var logger=require(_0xb92d('0x1'))(_0xb92d('0x2'));var moment=require(_0xb92d('0x3'));var BPromise=require(_0xb92d('0x4'));var rp=require(_0xb92d('0x5'));var fs=require('fs');var path=require(_0xb92d('0x6'));var rimraf=require('rimraf');var config=require(_0xb92d('0x7'));var attributes=require(_0xb92d('0x8'));module[_0xb92d('0x9')]=function(_0x36c463,_0x534688){return _0x36c463[_0xb92d('0xa')](_0xb92d('0xb'),attributes,{'tableName':_0xb92d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb92d('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8155=['tools_canned_answers','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer'];(function(_0x12db6d,_0x3bb21d){var _0x4d7852=function(_0x3395d5){while(--_0x3395d5){_0x12db6d['push'](_0x12db6d['shift']());}};_0x4d7852(++_0x3bb21d);}(_0x8155,0x1f2));var _0x5815=function(_0x2ecbc7,_0x3b38ba){_0x2ecbc7=_0x2ecbc7-0x0;var _0xebb63b=_0x8155[_0x2ecbc7];return _0xebb63b;};'use strict';var _=require(_0x5815('0x0'));var util=require(_0x5815('0x1'));var logger=require(_0x5815('0x2'))(_0x5815('0x3'));var moment=require(_0x5815('0x4'));var BPromise=require(_0x5815('0x5'));var rp=require(_0x5815('0x6'));var fs=require('fs');var path=require(_0x5815('0x7'));var rimraf=require(_0x5815('0x8'));var config=require(_0x5815('0x9'));var attributes=require(_0x5815('0xa'));module[_0x5815('0xb')]=function(_0x49c3ed,_0x452712){return _0x49c3ed[_0x5815('0xc')](_0x5815('0xd'),attributes,{'tableName':_0x5815('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x5815('0xf')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index daf79eb..07bda43 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(_0x557789,_0xce2491){var _0x164126=function(_0x2d8dfb){while(--_0x2d8dfb){_0x557789['push'](_0x557789['shift']());}};_0x164126(++_0xce2491);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ 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(_0xaa88a1,_0x5615e){var _0x17b270=function(_0x2ea302){while(--_0x2ea302){_0xaa88a1['push'](_0xaa88a1['shift']());}};_0x17b270(++_0x5615e);}(_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/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index c9deef4..0d4d7a7 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 _0x0e57=['create','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x0e57,0x1eb));var _0x70e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e57[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x70e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x70e5('0x1'));var express=require(_0x70e5('0x2'));var router=express[_0x70e5('0x3')]();var fs_extra=require(_0x70e5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x70e5('0x5'));var controller=require(_0x70e5('0x6'));router[_0x70e5('0x7')]('/',auth[_0x70e5('0x8')](),controller[_0x70e5('0x9')]);router[_0x70e5('0x7')](_0x70e5('0xa'),auth['isAuthenticated'](),controller[_0x70e5('0xb')]);router[_0x70e5('0xc')]('/',auth['isAuthenticated'](),controller[_0x70e5('0xd')]);router['put'](_0x70e5('0xa'),auth[_0x70e5('0x8')](),controller[_0x70e5('0xe')]);router[_0x70e5('0xf')](_0x70e5('0xa'),auth[_0x70e5('0x8')](),controller[_0x70e5('0x10')]);module[_0x70e5('0x11')]=router; \ No newline at end of file +var _0x78c7=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','post','create','put','/:id','delete'];(function(_0x3eb4f6,_0x342312){var _0x238e62=function(_0x588ced){while(--_0x588ced){_0x3eb4f6['push'](_0x3eb4f6['shift']());}};_0x238e62(++_0x342312);}(_0x78c7,0x1ba));var _0x778c=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x78c7[_0x2dadb9];return _0x2f0097;};'use strict';var multer=require(_0x778c('0x0'));var util=require(_0x778c('0x1'));var path=require(_0x778c('0x2'));var timeout=require(_0x778c('0x3'));var express=require(_0x778c('0x4'));var router=express[_0x778c('0x5')]();var fs_extra=require(_0x778c('0x6'));var auth=require(_0x778c('0x7'));var interaction=require(_0x778c('0x8'));var config=require('../../config/environment');var controller=require(_0x778c('0x9'));router[_0x778c('0xa')]('/',auth[_0x778c('0xb')](),controller[_0x778c('0xc')]);router[_0x778c('0xa')]('/:id',auth[_0x778c('0xb')](),controller['show']);router[_0x778c('0xd')]('/',auth[_0x778c('0xb')](),controller[_0x778c('0xe')]);router[_0x778c('0xf')](_0x778c('0x10'),auth[_0x778c('0xb')](),controller['update']);router[_0x778c('0x11')](_0x778c('0x10'),auth[_0x778c('0xb')](),controller[_0x778c('0x12')]);module[_0x778c('0x13')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 4dcf6cd..a2ebbd2 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 _0x92d7=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x92d7,0x17b));var _0x792d=function(_0xc586d3,_0x516ed4){_0xc586d3=_0xc586d3-0x0;var _0xb12da7=_0x92d7[_0xc586d3];return _0xb12da7;};'use strict';var Sequelize=require(_0x792d('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x792d('0x1')],'allowNull':![],'defaultValue':_0x792d('0x2')},'clid':{'type':Sequelize[_0x792d('0x3')]},'src':{'type':Sequelize[_0x792d('0x3')]},'dst':{'type':Sequelize[_0x792d('0x3')]},'dcontext':{'type':Sequelize[_0x792d('0x3')]},'channel':{'type':Sequelize[_0x792d('0x3')]},'dstchannel':{'type':Sequelize[_0x792d('0x3')]},'lastapp':{'type':Sequelize[_0x792d('0x3')]},'lastdata':{'type':Sequelize[_0x792d('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x792d('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x792d('0x3')]},'amaflags':{'type':Sequelize[_0x792d('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x792d('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x792d('0x3')]},'linkedid':{'type':Sequelize[_0x792d('0x3')]},'sequence':{'type':Sequelize[_0x792d('0x3')]},'peeraccount':{'type':Sequelize[_0x792d('0x3')]},'type':{'type':Sequelize[_0x792d('0x3')]},'tag':{'type':Sequelize[_0x792d('0x3')]}}; \ No newline at end of file +var _0x2821=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports','DATE'];(function(_0x80f51a,_0x32e95e){var _0x327148=function(_0x16f788){while(--_0x16f788){_0x80f51a['push'](_0x80f51a['shift']());}};_0x327148(++_0x32e95e);}(_0x2821,0x87));var _0x1282=function(_0x5502f4,_0x171360){_0x5502f4=_0x5502f4-0x0;var _0x486eb7=_0x2821[_0x5502f4];return _0x486eb7;};'use strict';var Sequelize=require(_0x1282('0x0'));module[_0x1282('0x1')]={'calldate':{'type':Sequelize[_0x1282('0x2')],'allowNull':![],'defaultValue':_0x1282('0x3')},'clid':{'type':Sequelize[_0x1282('0x4')]},'src':{'type':Sequelize[_0x1282('0x4')]},'dst':{'type':Sequelize[_0x1282('0x4')]},'dcontext':{'type':Sequelize[_0x1282('0x4')]},'channel':{'type':Sequelize[_0x1282('0x4')]},'dstchannel':{'type':Sequelize[_0x1282('0x4')]},'lastapp':{'type':Sequelize[_0x1282('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x1282('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x1282('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x1282('0x4')]},'amaflags':{'type':Sequelize[_0x1282('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x1282('0x4')]},'userfield':{'type':Sequelize[_0x1282('0x4')]},'uniqueid':{'type':Sequelize[_0x1282('0x4')]},'linkedid':{'type':Sequelize[_0x1282('0x4')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x1282('0x4')]},'type':{'type':Sequelize[_0x1282('0x4')]},'tag':{'type':Sequelize[_0x1282('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 7d21124..95dcba9 100644 --- a/server/api/cdr/cdr.controller.js +++ b/server/api/cdr/cdr.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1af3=['../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x1b68e5,_0x3d1a8d){var _0x2f80bb=function(_0x4fa58e){while(--_0x4fa58e){_0x1b68e5['push'](_0x1b68e5['shift']());}};_0x2f80bb(++_0x3d1a8d);}(_0x1af3,0x1ca));var _0x31af=function(_0x176317,_0x4897b3){_0x176317=_0x176317-0x0;var _0xef2759=_0x1af3[_0x176317];return _0xef2759;};'use strict';var emlformat=require(_0x31af('0x0'));var rimraf=require(_0x31af('0x1'));var zipdir=require(_0x31af('0x2'));var jsonpatch=require(_0x31af('0x3'));var rp=require(_0x31af('0x4'));var moment=require(_0x31af('0x5'));var BPromise=require(_0x31af('0x6'));var Mustache=require(_0x31af('0x7'));var util=require(_0x31af('0x8'));var path=require(_0x31af('0x9'));var sox=require('sox');var csv=require(_0x31af('0xa'));var ejs=require(_0x31af('0xb'));var fs=require('fs');var fs_extra=require(_0x31af('0xc'));var _=require(_0x31af('0xd'));var squel=require('squel');var crypto=require(_0x31af('0xe'));var jsforce=require(_0x31af('0xf'));var deskjs=require(_0x31af('0x10'));var toCsv=require('to-csv');var querystring=require(_0x31af('0x11'));var Papa=require(_0x31af('0x12'));var Redis=require(_0x31af('0x13'));var authService=require(_0x31af('0x14'));var qs=require(_0x31af('0x15'));var as=require(_0x31af('0x16'));var hardwareService=require(_0x31af('0x17'));var logger=require(_0x31af('0x18'))('api');var utils=require(_0x31af('0x19'));var config=require(_0x31af('0x1a'));var licenseUtil=require(_0x31af('0x1b'));var db=require(_0x31af('0x1c'))['db'];function respondWithStatusCode(_0x144406,_0x481f20){_0x481f20=_0x481f20||0xcc;return function(_0x358fb4){if(_0x358fb4){return _0x144406[_0x31af('0x1d')](_0x481f20);}return _0x144406['status'](_0x481f20)['end']();};}function respondWithResult(_0x2a4727,_0x46a494){_0x46a494=_0x46a494||0xc8;return function(_0x14c57e){if(_0x14c57e){return _0x2a4727[_0x31af('0x1e')](_0x46a494)[_0x31af('0x1f')](_0x14c57e);}};}function respondWithFilteredResult(_0x1d35fa,_0x369934){return function(_0x37c275){if(_0x37c275){var _0xd431e4=typeof _0x369934[_0x31af('0x20')]===_0x31af('0x21')&&typeof _0x369934['limit']===_0x31af('0x21');var _0xd33b3f=_0x37c275[_0x31af('0x22')];var _0x477ada=_0xd431e4?0x0:_0x369934[_0x31af('0x20')];var _0x30a112=_0xd431e4?_0x37c275[_0x31af('0x22')]:_0x369934[_0x31af('0x20')]+_0x369934[_0x31af('0x23')];var _0x550870;if(_0x30a112>=_0xd33b3f){_0x30a112=_0xd33b3f;_0x550870=0xc8;}else{_0x550870=0xce;}_0x1d35fa[_0x31af('0x1e')](_0x550870);return _0x1d35fa[_0x31af('0x24')](_0x31af('0x25'),_0x477ada+'-'+_0x30a112+'/'+_0xd33b3f)[_0x31af('0x1f')](_0x37c275);}return null;};}function patchUpdates(_0x414ad8){return function(_0x5d96ca){try{jsonpatch[_0x31af('0x26')](_0x5d96ca,_0x414ad8,!![]);}catch(_0x46b03e){return BPromise[_0x31af('0x27')](_0x46b03e);}return _0x5d96ca[_0x31af('0x28')]();};}function saveUpdates(_0x394d13,_0x14c3f9){return function(_0x1ddfba){if(_0x1ddfba){return _0x1ddfba[_0x31af('0x29')](_0x394d13)[_0x31af('0x2a')](function(_0x6634e3){return _0x6634e3;});}return null;};}function removeEntity(_0x40aa32,_0x1a67e3){return function(_0x3a98d3){if(_0x3a98d3){return _0x3a98d3[_0x31af('0x2b')]()[_0x31af('0x2a')](function(){_0x40aa32['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d3832,_0x20a50c){return function(_0x2b3bad){if(!_0x2b3bad){_0x5d3832['sendStatus'](0x194);}return _0x2b3bad;};}function handleError(_0x4c958,_0x8f9f60){_0x8f9f60=_0x8f9f60||0x1f4;return function(_0x49812a){logger[_0x31af('0x2c')](_0x49812a[_0x31af('0x2d')]);if(_0x49812a['name']){delete _0x49812a[_0x31af('0x2e')];}_0x4c958[_0x31af('0x1e')](_0x8f9f60)[_0x31af('0x2f')](_0x49812a);};}exports[_0x31af('0x30')]=function(_0x3326a7,_0x5a1f41){var _0xb1f5b1={},_0x3eb61f={},_0x1e6df8={'count':0x0,'rows':[]};var _0x1f4eae=_[_0x31af('0x31')](db[_0x31af('0x32')][_0x31af('0x33')],function(_0x231438){return{'name':_0x231438[_0x31af('0x34')],'type':_0x231438[_0x31af('0x35')][_0x31af('0x36')]};});_0x3eb61f[_0x31af('0x37')]=_['map'](_0x1f4eae,_0x31af('0x2e'));_0x3eb61f[_0x31af('0x38')]=_['keys'](_0x3326a7['query']);_0x3eb61f['filters']=_[_0x31af('0x39')](_0x3eb61f['model'],_0x3eb61f[_0x31af('0x38')]);_0xb1f5b1[_0x31af('0x3a')]=_[_0x31af('0x39')](_0x3eb61f[_0x31af('0x37')],qs[_0x31af('0x3b')](_0x3326a7[_0x31af('0x38')]['fields']));_0xb1f5b1[_0x31af('0x3a')]=_0xb1f5b1[_0x31af('0x3a')][_0x31af('0x3c')]?_0xb1f5b1[_0x31af('0x3a')]:_0x3eb61f[_0x31af('0x37')];if(!_0x3326a7[_0x31af('0x38')][_0x31af('0x3d')](_0x31af('0x3e'))){_0xb1f5b1['limit']=qs[_0x31af('0x23')](_0x3326a7['query'][_0x31af('0x23')]);_0xb1f5b1[_0x31af('0x20')]=qs[_0x31af('0x20')](_0x3326a7[_0x31af('0x38')][_0x31af('0x20')]);}_0xb1f5b1['order']=qs['sort'](_0x3326a7['query'][_0x31af('0x3f')]);_0xb1f5b1[_0x31af('0x40')]=qs[_0x31af('0x41')](_[_0x31af('0x42')](_0x3326a7[_0x31af('0x38')],_0x3eb61f[_0x31af('0x41')]),_0x1f4eae);if(_0x3326a7[_0x31af('0x38')][_0x31af('0x43')]){_0xb1f5b1['where']=_[_0x31af('0x44')](_0xb1f5b1[_0x31af('0x40')],{'$or':_[_0x31af('0x31')](_0x1f4eae,function(_0x2a5cde){if(_0x2a5cde[_0x31af('0x35')]!==_0x31af('0x45')){var _0x32d1b9={};_0x32d1b9[_0x2a5cde[_0x31af('0x2e')]]={'$like':'%'+_0x3326a7[_0x31af('0x38')]['filter']+'%'};return _0x32d1b9;}})});}_0xb1f5b1=_[_0x31af('0x44')]({},_0xb1f5b1,_0x3326a7['options']);var _0x447a01={'where':_0xb1f5b1['where']};return db['Cdr'][_0x31af('0x22')](_0x447a01)[_0x31af('0x2a')](function(_0x110f38){_0x1e6df8[_0x31af('0x22')]=_0x110f38;if(_0x3326a7[_0x31af('0x38')][_0x31af('0x46')]){_0xb1f5b1[_0x31af('0x47')]=[{'all':!![]}];}return db['Cdr'][_0x31af('0x48')](_0xb1f5b1);})[_0x31af('0x2a')](function(_0xb53565){_0x1e6df8['rows']=_0xb53565;return _0x1e6df8;})[_0x31af('0x2a')](respondWithFilteredResult(_0x5a1f41,_0xb1f5b1))[_0x31af('0x49')](handleError(_0x5a1f41,null));};exports[_0x31af('0x4a')]=function(_0x23942b,_0x34205a){var _0x57da2c={'raw':!![],'where':{'id':_0x23942b[_0x31af('0x4b')]['id']}},_0x12357c={};_0x12357c[_0x31af('0x37')]=_[_0x31af('0x4c')](db['Cdr'][_0x31af('0x33')]);_0x12357c[_0x31af('0x38')]=_['keys'](_0x23942b[_0x31af('0x38')]);_0x12357c[_0x31af('0x41')]=_[_0x31af('0x39')](_0x12357c[_0x31af('0x37')],_0x12357c[_0x31af('0x38')]);_0x57da2c[_0x31af('0x3a')]=_[_0x31af('0x39')](_0x12357c[_0x31af('0x37')],qs[_0x31af('0x3b')](_0x23942b[_0x31af('0x38')]['fields']));_0x57da2c['attributes']=_0x57da2c[_0x31af('0x3a')]['length']?_0x57da2c[_0x31af('0x3a')]:_0x12357c[_0x31af('0x37')];if(_0x23942b[_0x31af('0x38')]['includeAll']){_0x57da2c['include']=[{'all':!![]}];}_0x57da2c=_[_0x31af('0x44')]({},_0x57da2c,_0x23942b['options']);return db[_0x31af('0x32')][_0x31af('0x4d')](_0x57da2c)[_0x31af('0x2a')](handleEntityNotFound(_0x34205a,null))[_0x31af('0x2a')](respondWithResult(_0x34205a,null))['catch'](handleError(_0x34205a,null));};exports['create']=function(_0x407386,_0x3acff1){return db[_0x31af('0x32')][_0x31af('0x4e')](_0x407386['body'],{})[_0x31af('0x2a')](respondWithResult(_0x3acff1,0xc9))[_0x31af('0x49')](handleError(_0x3acff1,null));};exports[_0x31af('0x29')]=function(_0x4ad7a6,_0x5a1cbe){if(_0x4ad7a6[_0x31af('0x4f')]['id']){delete _0x4ad7a6[_0x31af('0x4f')]['id'];}return db[_0x31af('0x32')][_0x31af('0x4d')]({'where':{'id':_0x4ad7a6[_0x31af('0x4b')]['id']}})[_0x31af('0x2a')](handleEntityNotFound(_0x5a1cbe,null))[_0x31af('0x2a')](saveUpdates(_0x4ad7a6[_0x31af('0x4f')],null))[_0x31af('0x2a')](respondWithResult(_0x5a1cbe,null))[_0x31af('0x49')](handleError(_0x5a1cbe,null));};exports['destroy']=function(_0x441362,_0x29de7e){return db[_0x31af('0x32')][_0x31af('0x4d')]({'where':{'id':_0x441362[_0x31af('0x4b')]['id']}})[_0x31af('0x2a')](handleEntityNotFound(_0x29de7e,null))[_0x31af('0x2a')](removeEntity(_0x29de7e,null))[_0x31af('0x49')](handleError(_0x29de7e,null));};exports[_0x31af('0x50')]=function(_0x25369b,_0x3bfbae){return db[_0x31af('0x32')][_0x31af('0x50')]()[_0x31af('0x2a')](respondWithResult(_0x3bfbae,null))['catch'](handleError(_0x3bfbae,null));}; \ No newline at end of file +var _0x826a=['key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','describe','rimraf','fast-json-patch','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/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','send','index','Cdr','fieldName','type'];(function(_0x222054,_0x45620f){var _0x5de492=function(_0x8ee7b4){while(--_0x8ee7b4){_0x222054['push'](_0x222054['shift']());}};_0x5de492(++_0x45620f);}(_0x826a,0x1aa));var _0xa826=function(_0x424759,_0x44b989){_0x424759=_0x424759-0x0;var _0x515ced=_0x826a[_0x424759];return _0x515ced;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa826('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa826('0x1'));var rp=require('request-promise');var moment=require(_0xa826('0x2'));var BPromise=require(_0xa826('0x3'));var Mustache=require(_0xa826('0x4'));var util=require(_0xa826('0x5'));var path=require('path');var sox=require(_0xa826('0x6'));var csv=require(_0xa826('0x7'));var ejs=require(_0xa826('0x8'));var fs=require('fs');var fs_extra=require(_0xa826('0x9'));var _=require(_0xa826('0xa'));var squel=require(_0xa826('0xb'));var crypto=require(_0xa826('0xc'));var jsforce=require(_0xa826('0xd'));var deskjs=require(_0xa826('0xe'));var toCsv=require(_0xa826('0x7'));var querystring=require(_0xa826('0xf'));var Papa=require(_0xa826('0x10'));var Redis=require(_0xa826('0x11'));var authService=require(_0xa826('0x12'));var qs=require(_0xa826('0x13'));var as=require(_0xa826('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa826('0x15'))('api');var utils=require(_0xa826('0x16'));var config=require(_0xa826('0x17'));var licenseUtil=require(_0xa826('0x18'));var db=require(_0xa826('0x19'))['db'];function respondWithStatusCode(_0x212fac,_0x40838f){_0x40838f=_0x40838f||0xcc;return function(_0x2f1d39){if(_0x2f1d39){return _0x212fac['sendStatus'](_0x40838f);}return _0x212fac[_0xa826('0x1a')](_0x40838f)['end']();};}function respondWithResult(_0x3e99b0,_0x41c0c2){_0x41c0c2=_0x41c0c2||0xc8;return function(_0x5dc0c7){if(_0x5dc0c7){return _0x3e99b0['status'](_0x41c0c2)['json'](_0x5dc0c7);}};}function respondWithFilteredResult(_0x1b6d16,_0x4f25bd){return function(_0x4c546b){if(_0x4c546b){var _0x9a3788=typeof _0x4f25bd[_0xa826('0x1b')]===_0xa826('0x1c')&&typeof _0x4f25bd['limit']===_0xa826('0x1c');var _0x312e14=_0x4c546b[_0xa826('0x1d')];var _0x453c5d=_0x9a3788?0x0:_0x4f25bd[_0xa826('0x1b')];var _0x48930f=_0x9a3788?_0x4c546b[_0xa826('0x1d')]:_0x4f25bd[_0xa826('0x1b')]+_0x4f25bd[_0xa826('0x1e')];var _0x57e96e;if(_0x48930f>=_0x312e14){_0x48930f=_0x312e14;_0x57e96e=0xc8;}else{_0x57e96e=0xce;}_0x1b6d16['status'](_0x57e96e);return _0x1b6d16[_0xa826('0x1f')](_0xa826('0x20'),_0x453c5d+'-'+_0x48930f+'/'+_0x312e14)[_0xa826('0x21')](_0x4c546b);}return null;};}function patchUpdates(_0x8d1650){return function(_0x124564){try{jsonpatch['apply'](_0x124564,_0x8d1650,!![]);}catch(_0x3171ff){return BPromise[_0xa826('0x22')](_0x3171ff);}return _0x124564[_0xa826('0x23')]();};}function saveUpdates(_0x5d410f,_0x5ddeef){return function(_0x361ca5){if(_0x361ca5){return _0x361ca5[_0xa826('0x24')](_0x5d410f)[_0xa826('0x25')](function(_0x4eb4f3){return _0x4eb4f3;});}return null;};}function removeEntity(_0x1d7adf,_0x26ef25){return function(_0x1d4ade){if(_0x1d4ade){return _0x1d4ade[_0xa826('0x26')]()[_0xa826('0x25')](function(){_0x1d7adf['status'](0xcc)[_0xa826('0x27')]();});}};}function handleEntityNotFound(_0x4fa5db,_0x17ef2d){return function(_0x174f16){if(!_0x174f16){_0x4fa5db['sendStatus'](0x194);}return _0x174f16;};}function handleError(_0xfc0448,_0xfa4d94){_0xfa4d94=_0xfa4d94||0x1f4;return function(_0x38c919){logger[_0xa826('0x28')](_0x38c919[_0xa826('0x29')]);if(_0x38c919[_0xa826('0x2a')]){delete _0x38c919[_0xa826('0x2a')];}_0xfc0448[_0xa826('0x1a')](_0xfa4d94)[_0xa826('0x2b')](_0x38c919);};}exports[_0xa826('0x2c')]=function(_0x1e35de,_0x473d8d){var _0x1f2749={},_0x2cb586={},_0x2253c7={'count':0x0,'rows':[]};var _0x27f8f9=_['map'](db[_0xa826('0x2d')]['rawAttributes'],function(_0x2dd810){return{'name':_0x2dd810[_0xa826('0x2e')],'type':_0x2dd810[_0xa826('0x2f')][_0xa826('0x30')]};});_0x2cb586[_0xa826('0x31')]=_['map'](_0x27f8f9,'name');_0x2cb586[_0xa826('0x32')]=_[_0xa826('0x33')](_0x1e35de[_0xa826('0x32')]);_0x2cb586[_0xa826('0x34')]=_['intersection'](_0x2cb586[_0xa826('0x31')],_0x2cb586[_0xa826('0x32')]);_0x1f2749['attributes']=_[_0xa826('0x35')](_0x2cb586['model'],qs[_0xa826('0x36')](_0x1e35de[_0xa826('0x32')][_0xa826('0x36')]));_0x1f2749[_0xa826('0x37')]=_0x1f2749[_0xa826('0x37')]['length']?_0x1f2749[_0xa826('0x37')]:_0x2cb586[_0xa826('0x31')];if(!_0x1e35de[_0xa826('0x32')][_0xa826('0x38')](_0xa826('0x39'))){_0x1f2749[_0xa826('0x1e')]=qs[_0xa826('0x1e')](_0x1e35de[_0xa826('0x32')][_0xa826('0x1e')]);_0x1f2749[_0xa826('0x1b')]=qs[_0xa826('0x1b')](_0x1e35de['query'][_0xa826('0x1b')]);}_0x1f2749['order']=qs[_0xa826('0x3a')](_0x1e35de['query'][_0xa826('0x3a')]);_0x1f2749[_0xa826('0x3b')]=qs[_0xa826('0x34')](_[_0xa826('0x3c')](_0x1e35de[_0xa826('0x32')],_0x2cb586[_0xa826('0x34')]),_0x27f8f9);if(_0x1e35de[_0xa826('0x32')][_0xa826('0x3d')]){_0x1f2749[_0xa826('0x3b')]=_[_0xa826('0x3e')](_0x1f2749[_0xa826('0x3b')],{'$or':_[_0xa826('0x3f')](_0x27f8f9,function(_0x5911d3){if(_0x5911d3[_0xa826('0x2f')]!==_0xa826('0x40')){var _0x251208={};_0x251208[_0x5911d3['name']]={'$like':'%'+_0x1e35de[_0xa826('0x32')][_0xa826('0x3d')]+'%'};return _0x251208;}})});}_0x1f2749=_['merge']({},_0x1f2749,_0x1e35de[_0xa826('0x41')]);var _0x47d9f1={'where':_0x1f2749['where']};return db[_0xa826('0x2d')][_0xa826('0x1d')](_0x47d9f1)[_0xa826('0x25')](function(_0x308d4){_0x2253c7[_0xa826('0x1d')]=_0x308d4;if(_0x1e35de[_0xa826('0x32')]['includeAll']){_0x1f2749[_0xa826('0x42')]=[{'all':!![]}];}return db[_0xa826('0x2d')][_0xa826('0x43')](_0x1f2749);})[_0xa826('0x25')](function(_0x244fd3){_0x2253c7[_0xa826('0x44')]=_0x244fd3;return _0x2253c7;})['then'](respondWithFilteredResult(_0x473d8d,_0x1f2749))[_0xa826('0x45')](handleError(_0x473d8d,null));};exports[_0xa826('0x46')]=function(_0x405ee1,_0x162be1){var _0x258e57={'raw':!![],'where':{'id':_0x405ee1[_0xa826('0x47')]['id']}},_0x53b70e={};_0x53b70e[_0xa826('0x31')]=_[_0xa826('0x33')](db[_0xa826('0x2d')][_0xa826('0x48')]);_0x53b70e[_0xa826('0x32')]=_[_0xa826('0x33')](_0x405ee1[_0xa826('0x32')]);_0x53b70e[_0xa826('0x34')]=_[_0xa826('0x35')](_0x53b70e[_0xa826('0x31')],_0x53b70e[_0xa826('0x32')]);_0x258e57['attributes']=_[_0xa826('0x35')](_0x53b70e[_0xa826('0x31')],qs[_0xa826('0x36')](_0x405ee1['query'][_0xa826('0x36')]));_0x258e57[_0xa826('0x37')]=_0x258e57[_0xa826('0x37')][_0xa826('0x49')]?_0x258e57[_0xa826('0x37')]:_0x53b70e['model'];if(_0x405ee1[_0xa826('0x32')][_0xa826('0x4a')]){_0x258e57[_0xa826('0x42')]=[{'all':!![]}];}_0x258e57=_[_0xa826('0x3e')]({},_0x258e57,_0x405ee1[_0xa826('0x41')]);return db[_0xa826('0x2d')][_0xa826('0x4b')](_0x258e57)['then'](handleEntityNotFound(_0x162be1,null))[_0xa826('0x25')](respondWithResult(_0x162be1,null))['catch'](handleError(_0x162be1,null));};exports['create']=function(_0x4b4352,_0x26a858){return db[_0xa826('0x2d')][_0xa826('0x4c')](_0x4b4352[_0xa826('0x4d')],{})['then'](respondWithResult(_0x26a858,0xc9))[_0xa826('0x45')](handleError(_0x26a858,null));};exports['update']=function(_0x5e0947,_0xedcbc2){if(_0x5e0947[_0xa826('0x4d')]['id']){delete _0x5e0947['body']['id'];}return db[_0xa826('0x2d')][_0xa826('0x4b')]({'where':{'id':_0x5e0947['params']['id']}})['then'](handleEntityNotFound(_0xedcbc2,null))['then'](saveUpdates(_0x5e0947['body'],null))['then'](respondWithResult(_0xedcbc2,null))['catch'](handleError(_0xedcbc2,null));};exports['destroy']=function(_0xb3fae0,_0x5d5269){return db[_0xa826('0x2d')]['find']({'where':{'id':_0xb3fae0[_0xa826('0x47')]['id']}})[_0xa826('0x25')](handleEntityNotFound(_0x5d5269,null))[_0xa826('0x25')](removeEntity(_0x5d5269,null))[_0xa826('0x45')](handleError(_0x5d5269,null));};exports[_0xa826('0x4e')]=function(_0x52cf5e,_0x209704){return db['Cdr']['describe']()[_0xa826('0x25')](respondWithResult(_0x209704,null))[_0xa826('0x45')](handleError(_0x209704,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index ea592c8..fb69880 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(_0x15286e,_0x5c7c29){var _0x2fa3c8=function(_0x4e3a32){while(--_0x4e3a32){_0x15286e['push'](_0x15286e['shift']());}};_0x2fa3c8(++_0x5c7c29);}(_0x7a54,0x106));var _0x47a5=function(_0x34913b,_0x5070bf){_0x34913b=_0x34913b-0x0;var _0x4494f1=_0x7a54[_0x34913b];return _0x4494f1;};'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(_0x5853d4,_0x7f879){var _0x1b55f4=function(_0x29b890){while(--_0x29b890){_0x5853d4['push'](_0x5853d4['shift']());}};_0x1b55f4(++_0x7f879);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 7be0bf1..75d30cc 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 _0xfc25=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x58194e,_0x541b3b){var _0x3e5a76=function(_0x5d375d){while(--_0x5d375d){_0x58194e['push'](_0x58194e['shift']());}};_0x3e5a76(++_0x541b3b);}(_0xfc25,0xde));var _0x5fc2=function(_0x161e48,_0xf0b7b4){_0x161e48=_0x161e48-0x0;var _0x5817f0=_0xfc25[_0x161e48];return _0x5817f0;};'use strict';var _=require(_0x5fc2('0x0'));var util=require(_0x5fc2('0x1'));var moment=require(_0x5fc2('0x2'));var BPromise=require(_0x5fc2('0x3'));var rs=require(_0x5fc2('0x4'));var fs=require('fs');var Redis=require(_0x5fc2('0x5'));var db=require(_0x5fc2('0x6'))['db'];var utils=require(_0x5fc2('0x7'));var logger=require(_0x5fc2('0x8'))('rpc');var config=require(_0x5fc2('0x9'));var jayson=require(_0x5fc2('0xa'));var client=jayson[_0x5fc2('0xb')][_0x5fc2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59dc6a,_0x55d7cb,_0x2ad7ed){return new BPromise(function(_0x148390,_0x41ad50){return client[_0x5fc2('0xd')](_0x59dc6a,_0x2ad7ed)[_0x5fc2('0xe')](function(_0x52ef09){logger[_0x5fc2('0xf')](_0x5fc2('0x10'),_0x55d7cb,_0x5fc2('0x11'));logger[_0x5fc2('0x12')](_0x5fc2('0x13'),_0x55d7cb,_0x5fc2('0x11'),JSON[_0x5fc2('0x14')](_0x52ef09));if(_0x52ef09[_0x5fc2('0x15')]){if(_0x52ef09[_0x5fc2('0x15')]['code']===0x1f4){logger[_0x5fc2('0x15')](_0x5fc2('0x10'),_0x55d7cb,_0x52ef09[_0x5fc2('0x15')][_0x5fc2('0x16')]);return _0x41ad50(_0x52ef09['error'][_0x5fc2('0x16')]);}logger[_0x5fc2('0x15')](_0x5fc2('0x10'),_0x55d7cb,_0x52ef09['error']['message']);return _0x148390(_0x52ef09[_0x5fc2('0x15')][_0x5fc2('0x16')]);}else{logger[_0x5fc2('0xf')](_0x5fc2('0x10'),_0x55d7cb,'request\x20sent');_0x148390(_0x52ef09[_0x5fc2('0x17')][_0x5fc2('0x16')]);}})[_0x5fc2('0x18')](function(_0x375c8f){logger[_0x5fc2('0x15')](_0x5fc2('0x10'),_0x55d7cb,_0x375c8f);_0x41ad50(_0x375c8f);});});} \ No newline at end of file +var _0x7948=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x211fef,_0x4ab716){var _0x5447bf=function(_0x306ea3){while(--_0x306ea3){_0x211fef['push'](_0x211fef['shift']());}};_0x5447bf(++_0x4ab716);}(_0x7948,0xa3));var _0x8794=function(_0x112e2a,_0x364486){_0x112e2a=_0x112e2a-0x0;var _0x4f8af9=_0x7948[_0x112e2a];return _0x4f8af9;};'use strict';var _=require(_0x8794('0x0'));var util=require(_0x8794('0x1'));var moment=require(_0x8794('0x2'));var BPromise=require(_0x8794('0x3'));var rs=require(_0x8794('0x4'));var fs=require('fs');var Redis=require(_0x8794('0x5'));var db=require(_0x8794('0x6'))['db'];var utils=require(_0x8794('0x7'));var logger=require(_0x8794('0x8'))(_0x8794('0x9'));var config=require(_0x8794('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x8794('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1649d7,_0x5b3adf,_0x33132d){return new BPromise(function(_0x222a7d,_0x508ca8){return client[_0x8794('0xc')](_0x1649d7,_0x33132d)['then'](function(_0x1fe8d1){logger[_0x8794('0xd')](_0x8794('0xe'),_0x5b3adf,_0x8794('0xf'));logger[_0x8794('0x10')](_0x8794('0x11'),_0x5b3adf,_0x8794('0xf'),JSON[_0x8794('0x12')](_0x1fe8d1));if(_0x1fe8d1[_0x8794('0x13')]){if(_0x1fe8d1['error']['code']===0x1f4){logger[_0x8794('0x13')](_0x8794('0xe'),_0x5b3adf,_0x1fe8d1['error'][_0x8794('0x14')]);return _0x508ca8(_0x1fe8d1[_0x8794('0x13')][_0x8794('0x14')]);}logger[_0x8794('0x13')](_0x8794('0xe'),_0x5b3adf,_0x1fe8d1[_0x8794('0x13')][_0x8794('0x14')]);return _0x222a7d(_0x1fe8d1['error'][_0x8794('0x14')]);}else{logger[_0x8794('0xd')]('Cdr,\x20%s,\x20%s',_0x5b3adf,_0x8794('0xf'));_0x222a7d(_0x1fe8d1[_0x8794('0x15')][_0x8794('0x14')]);}})[_0x8794('0x16')](function(_0x1eedfa){logger['error'](_0x8794('0xe'),_0x5b3adf,_0x1eedfa);_0x508ca8(_0x1eedfa);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 2fac372..8b2226b 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x3dbccb,_0x126d36){var _0x3e90e7=function(_0x43298f){while(--_0x43298f){_0x3dbccb['push'](_0x3dbccb['shift']());}};_0x3e90e7(++_0x126d36);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _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(_0x1cb1a2,_0x3a0a27){var _0xa9aa05=function(_0x1cc324){while(--_0x1cc324){_0x1cb1a2['push'](_0x1cb1a2['shift']());}};_0xa9aa05(++_0x3a0a27);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 4744653..9f3fce6 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 _0xecd1=['TEXT','STRING','noop'];(function(_0x1d1fd9,_0x343c4f){var _0x48c07e=function(_0x2ccbef){while(--_0x2ccbef){_0x1d1fd9['push'](_0x1d1fd9['shift']());}};_0x48c07e(++_0x343c4f);}(_0xecd1,0x15d));var _0x1ecd=function(_0x10946a,_0x33d6b8){_0x10946a=_0x10946a-0x0;var _0x180fa3=_0xecd1[_0x10946a];return _0x180fa3;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x1ecd('0x0')],'allowNull':![],'defaultValue':_0x1ecd('0x1')},'appdata':{'type':Sequelize[_0x1ecd('0x2')]()},'description':{'type':Sequelize[_0x1ecd('0x0')]},'interval':{'type':Sequelize[_0x1ecd('0x0')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x5be3=['*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x287f72,_0x4e37db){var _0x4ad9c9=function(_0x13e909){while(--_0x13e909){_0x287f72['push'](_0x287f72['shift']());}};_0x4ad9c9(++_0x4e37db);}(_0x5be3,0x19b));var _0x35be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5be3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x35be('0x0'));module[_0x35be('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x35be('0x2')],'allowNull':![],'defaultValue':_0x35be('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x35be('0x2')]},'interval':{'type':Sequelize[_0x35be('0x2')],'defaultValue':_0x35be('0x4')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index aacd46c..5653e6c 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 _0xb676=['ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','catch','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','show','params','model','keys'];(function(_0x4a79c8,_0x49ec68){var _0x1b775d=function(_0x3bdb9b){while(--_0x3bdb9b){_0x4a79c8['push'](_0x4a79c8['shift']());}};_0x1b775d(++_0x49ec68);}(_0xb676,0xbc));var _0x6b67=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xb676[_0x125ff8];return _0x2d9ef;};'use strict';var emlformat=require(_0x6b67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6b67('0x1'));var jsonpatch=require(_0x6b67('0x2'));var rp=require(_0x6b67('0x3'));var moment=require(_0x6b67('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6b67('0x5'));var path=require(_0x6b67('0x6'));var sox=require('sox');var csv=require(_0x6b67('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6b67('0x8'));var _=require(_0x6b67('0x9'));var squel=require(_0x6b67('0xa'));var crypto=require('crypto');var jsforce=require(_0x6b67('0xb'));var deskjs=require(_0x6b67('0xc'));var toCsv=require(_0x6b67('0x7'));var querystring=require('querystring');var Papa=require(_0x6b67('0xd'));var Redis=require(_0x6b67('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6b67('0xf'));var as=require(_0x6b67('0x10'));var hardwareService=require(_0x6b67('0x11'));var logger=require(_0x6b67('0x12'))('api');var utils=require(_0x6b67('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b67('0x14'));var db=require(_0x6b67('0x15'))['db'];function respondWithStatusCode(_0x1ebceb,_0x2ab6c5){_0x2ab6c5=_0x2ab6c5||0xcc;return function(_0x3e1bc6){if(_0x3e1bc6){return _0x1ebceb[_0x6b67('0x16')](_0x2ab6c5);}return _0x1ebceb[_0x6b67('0x17')](_0x2ab6c5)[_0x6b67('0x18')]();};}function respondWithResult(_0x2de534,_0x5fb6b3){_0x5fb6b3=_0x5fb6b3||0xc8;return function(_0x8a29a2){if(_0x8a29a2){return _0x2de534['status'](_0x5fb6b3)[_0x6b67('0x19')](_0x8a29a2);}};}function respondWithFilteredResult(_0x2213f4,_0x51e798){return function(_0x187fd4){if(_0x187fd4){var _0x1b6c60=typeof _0x51e798[_0x6b67('0x1a')]===_0x6b67('0x1b')&&typeof _0x51e798['limit']===_0x6b67('0x1b');var _0x46c44e=_0x187fd4[_0x6b67('0x1c')];var _0x46d828=_0x1b6c60?0x0:_0x51e798[_0x6b67('0x1a')];var _0x37d964=_0x1b6c60?_0x187fd4['count']:_0x51e798[_0x6b67('0x1a')]+_0x51e798['limit'];var _0x37cf6d;if(_0x37d964>=_0x46c44e){_0x37d964=_0x46c44e;_0x37cf6d=0xc8;}else{_0x37cf6d=0xce;}_0x2213f4[_0x6b67('0x17')](_0x37cf6d);return _0x2213f4[_0x6b67('0x1d')](_0x6b67('0x1e'),_0x46d828+'-'+_0x37d964+'/'+_0x46c44e)['json'](_0x187fd4);}return null;};}function patchUpdates(_0xd36be3){return function(_0x360208){try{jsonpatch[_0x6b67('0x1f')](_0x360208,_0xd36be3,!![]);}catch(_0x50fdfc){return BPromise[_0x6b67('0x20')](_0x50fdfc);}return _0x360208[_0x6b67('0x21')]();};}function saveUpdates(_0x1fedd5,_0x4d48e1){return function(_0xd4fda5){if(_0xd4fda5){return _0xd4fda5[_0x6b67('0x22')](_0x1fedd5)[_0x6b67('0x23')](function(_0x3a0a3f){return _0x3a0a3f;});}return null;};}function removeEntity(_0x393b3d,_0x17d27b){return function(_0x3c89d2){if(_0x3c89d2){return _0x3c89d2[_0x6b67('0x24')]()[_0x6b67('0x23')](function(){_0x393b3d[_0x6b67('0x17')](0xcc)[_0x6b67('0x18')]();});}};}function handleEntityNotFound(_0x47c927,_0x265245){return function(_0x3cffdf){if(!_0x3cffdf){_0x47c927[_0x6b67('0x16')](0x194);}return _0x3cffdf;};}function handleError(_0x5dca55,_0x2b67f6){_0x2b67f6=_0x2b67f6||0x1f4;return function(_0x1c73b0){logger['error'](_0x1c73b0[_0x6b67('0x25')]);if(_0x1c73b0[_0x6b67('0x26')]){delete _0x1c73b0[_0x6b67('0x26')];}_0x5dca55[_0x6b67('0x17')](_0x2b67f6)[_0x6b67('0x27')](_0x1c73b0);};}exports[_0x6b67('0x28')]=function(_0x3b65af,_0x5d9f6d){var _0x320a70={'raw':!![],'where':{'id':_0x3b65af[_0x6b67('0x29')]['id']}},_0x433881={};_0x433881[_0x6b67('0x2a')]=_[_0x6b67('0x2b')](db[_0x6b67('0x2c')][_0x6b67('0x2d')]);_0x433881[_0x6b67('0x2e')]=_['keys'](_0x3b65af[_0x6b67('0x2e')]);_0x433881[_0x6b67('0x2f')]=_[_0x6b67('0x30')](_0x433881[_0x6b67('0x2a')],_0x433881[_0x6b67('0x2e')]);_0x320a70[_0x6b67('0x31')]=_['intersection'](_0x433881['model'],qs[_0x6b67('0x32')](_0x3b65af[_0x6b67('0x2e')][_0x6b67('0x32')]));_0x320a70[_0x6b67('0x31')]=_0x320a70['attributes'][_0x6b67('0x33')]?_0x320a70['attributes']:_0x433881[_0x6b67('0x2a')];if(_0x3b65af[_0x6b67('0x2e')][_0x6b67('0x34')]){_0x320a70['include']=[{'all':!![]}];}_0x320a70=_[_0x6b67('0x35')]({},_0x320a70,_0x3b65af[_0x6b67('0x36')]);return db[_0x6b67('0x2c')]['find'](_0x320a70)[_0x6b67('0x23')](handleEntityNotFound(_0x5d9f6d,null))[_0x6b67('0x23')](respondWithResult(_0x5d9f6d,null))[_0x6b67('0x37')](handleError(_0x5d9f6d,null));};exports[_0x6b67('0x22')]=function(_0x4c3a86,_0x2092f6){if(_0x4c3a86[_0x6b67('0x38')]['id']){delete _0x4c3a86[_0x6b67('0x38')]['id'];}return db[_0x6b67('0x2c')][_0x6b67('0x39')]({'where':{'id':_0x4c3a86[_0x6b67('0x29')]['id']}})[_0x6b67('0x23')](handleEntityNotFound(_0x2092f6,null))[_0x6b67('0x23')](saveUpdates(_0x4c3a86['body'],null))[_0x6b67('0x23')](respondWithResult(_0x2092f6,null))[_0x6b67('0x37')](handleError(_0x2092f6,null));};exports[_0x6b67('0x24')]=function(_0x4d259f,_0x3889ef){return db[_0x6b67('0x2c')][_0x6b67('0x39')]({'where':{'id':_0x4d259f[_0x6b67('0x29')]['id']}})['then'](handleEntityNotFound(_0x3889ef,null))['then'](removeEntity(_0x3889ef,null))[_0x6b67('0x37')](handleError(_0x3889ef,null));}; \ No newline at end of file +var _0xb945=['lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','set','Content-Range','json','apply','update','then','destroy','error','stack','send','show','model','keys','ChatApplication','rawAttributes','query','intersection','fields','attributes','include','merge','options','find','body','params','catch','eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv'];(function(_0x4faedc,_0x3f5ecb){var _0x3132a5=function(_0x19ab6f){while(--_0x19ab6f){_0x4faedc['push'](_0x4faedc['shift']());}};_0x3132a5(++_0x3f5ecb);}(_0xb945,0x97));var _0x5b94=function(_0x3cb152,_0x57eb54){_0x3cb152=_0x3cb152-0x0;var _0x4f54c3=_0xb945[_0x3cb152];return _0x4f54c3;};'use strict';var emlformat=require(_0x5b94('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5b94('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5b94('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5b94('0x3'));var util=require(_0x5b94('0x4'));var path=require(_0x5b94('0x5'));var sox=require(_0x5b94('0x6'));var csv=require(_0x5b94('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b94('0x8'));var squel=require(_0x5b94('0x9'));var crypto=require(_0x5b94('0xa'));var jsforce=require(_0x5b94('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5b94('0x7'));var querystring=require('querystring');var Papa=require(_0x5b94('0xc'));var Redis=require(_0x5b94('0xd'));var authService=require(_0x5b94('0xe'));var qs=require(_0x5b94('0xf'));var as=require(_0x5b94('0x10'));var hardwareService=require(_0x5b94('0x11'));var logger=require(_0x5b94('0x12'))('api');var utils=require(_0x5b94('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5b94('0x14'));var db=require(_0x5b94('0x15'))['db'];function respondWithStatusCode(_0x11e65c,_0x23e1d8){_0x23e1d8=_0x23e1d8||0xcc;return function(_0x32948e){if(_0x32948e){return _0x11e65c['sendStatus'](_0x23e1d8);}return _0x11e65c[_0x5b94('0x16')](_0x23e1d8)[_0x5b94('0x17')]();};}function respondWithResult(_0x3d819d,_0x1114ab){_0x1114ab=_0x1114ab||0xc8;return function(_0x51f123){if(_0x51f123){return _0x3d819d[_0x5b94('0x16')](_0x1114ab)['json'](_0x51f123);}};}function respondWithFilteredResult(_0xa8cf03,_0x34aa94){return function(_0x48914f){if(_0x48914f){var _0x40fbc7=typeof _0x34aa94[_0x5b94('0x18')]===_0x5b94('0x19')&&typeof _0x34aa94['limit']===_0x5b94('0x19');var _0x371fce=_0x48914f['count'];var _0x2bb003=_0x40fbc7?0x0:_0x34aa94[_0x5b94('0x18')];var _0x1b5874=_0x40fbc7?_0x48914f['count']:_0x34aa94[_0x5b94('0x18')]+_0x34aa94[_0x5b94('0x1a')];var _0x5b13e0;if(_0x1b5874>=_0x371fce){_0x1b5874=_0x371fce;_0x5b13e0=0xc8;}else{_0x5b13e0=0xce;}_0xa8cf03[_0x5b94('0x16')](_0x5b13e0);return _0xa8cf03[_0x5b94('0x1b')](_0x5b94('0x1c'),_0x2bb003+'-'+_0x1b5874+'/'+_0x371fce)[_0x5b94('0x1d')](_0x48914f);}return null;};}function patchUpdates(_0x1f2293){return function(_0x5d1a5a){try{jsonpatch[_0x5b94('0x1e')](_0x5d1a5a,_0x1f2293,!![]);}catch(_0x44d510){return BPromise['reject'](_0x44d510);}return _0x5d1a5a['save']();};}function saveUpdates(_0x17789b,_0xb9e5db){return function(_0x12980d){if(_0x12980d){return _0x12980d[_0x5b94('0x1f')](_0x17789b)[_0x5b94('0x20')](function(_0x30fb7a){return _0x30fb7a;});}return null;};}function removeEntity(_0x1e8236,_0x31d950){return function(_0x219486){if(_0x219486){return _0x219486[_0x5b94('0x21')]()[_0x5b94('0x20')](function(){_0x1e8236[_0x5b94('0x16')](0xcc)[_0x5b94('0x17')]();});}};}function handleEntityNotFound(_0x1c8db6,_0x439df0){return function(_0x2efe25){if(!_0x2efe25){_0x1c8db6['sendStatus'](0x194);}return _0x2efe25;};}function handleError(_0x21f36e,_0x41a4e9){_0x41a4e9=_0x41a4e9||0x1f4;return function(_0x344373){logger[_0x5b94('0x22')](_0x344373[_0x5b94('0x23')]);if(_0x344373['name']){delete _0x344373['name'];}_0x21f36e[_0x5b94('0x16')](_0x41a4e9)[_0x5b94('0x24')](_0x344373);};}exports[_0x5b94('0x25')]=function(_0x5bace6,_0x6001fd){var _0x377ac5={'raw':!![],'where':{'id':_0x5bace6['params']['id']}},_0x594aca={};_0x594aca[_0x5b94('0x26')]=_[_0x5b94('0x27')](db[_0x5b94('0x28')][_0x5b94('0x29')]);_0x594aca[_0x5b94('0x2a')]=_[_0x5b94('0x27')](_0x5bace6[_0x5b94('0x2a')]);_0x594aca['filters']=_[_0x5b94('0x2b')](_0x594aca['model'],_0x594aca['query']);_0x377ac5['attributes']=_[_0x5b94('0x2b')](_0x594aca[_0x5b94('0x26')],qs['fields'](_0x5bace6[_0x5b94('0x2a')][_0x5b94('0x2c')]));_0x377ac5[_0x5b94('0x2d')]=_0x377ac5[_0x5b94('0x2d')]['length']?_0x377ac5['attributes']:_0x594aca[_0x5b94('0x26')];if(_0x5bace6[_0x5b94('0x2a')]['includeAll']){_0x377ac5[_0x5b94('0x2e')]=[{'all':!![]}];}_0x377ac5=_[_0x5b94('0x2f')]({},_0x377ac5,_0x5bace6[_0x5b94('0x30')]);return db[_0x5b94('0x28')][_0x5b94('0x31')](_0x377ac5)['then'](handleEntityNotFound(_0x6001fd,null))['then'](respondWithResult(_0x6001fd,null))['catch'](handleError(_0x6001fd,null));};exports[_0x5b94('0x1f')]=function(_0x1a9b30,_0x4a1f86){if(_0x1a9b30[_0x5b94('0x32')]['id']){delete _0x1a9b30['body']['id'];}return db['ChatApplication'][_0x5b94('0x31')]({'where':{'id':_0x1a9b30[_0x5b94('0x33')]['id']}})[_0x5b94('0x20')](handleEntityNotFound(_0x4a1f86,null))['then'](saveUpdates(_0x1a9b30['body'],null))[_0x5b94('0x20')](respondWithResult(_0x4a1f86,null))[_0x5b94('0x34')](handleError(_0x4a1f86,null));};exports['destroy']=function(_0x4cbd22,_0x461eef){return db[_0x5b94('0x28')][_0x5b94('0x31')]({'where':{'id':_0x4cbd22[_0x5b94('0x33')]['id']}})['then'](handleEntityNotFound(_0x461eef,null))['then'](removeEntity(_0x461eef,null))[_0x5b94('0x34')](handleError(_0x461eef,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 0ccadd9..173d37e 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 _0x7ca3=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x3da77c,_0x5251ff){var _0x35ff37=function(_0x6fc260){while(--_0x6fc260){_0x3da77c['push'](_0x3da77c['shift']());}};_0x35ff37(++_0x5251ff);}(_0x7ca3,0x9b));var _0x37ca=function(_0x1265fa,_0x1a1fed){_0x1265fa=_0x1265fa-0x0;var _0x1fe35e=_0x7ca3[_0x1265fa];return _0x1fe35e;};'use strict';var _=require('lodash');var util=require(_0x37ca('0x0'));var logger=require(_0x37ca('0x1'))(_0x37ca('0x2'));var moment=require(_0x37ca('0x3'));var BPromise=require(_0x37ca('0x4'));var rp=require(_0x37ca('0x5'));var fs=require('fs');var path=require(_0x37ca('0x6'));var rimraf=require('rimraf');var config=require(_0x37ca('0x7'));var attributes=require('./chatApplication.attributes');module[_0x37ca('0x8')]=function(_0x3f0a23,_0xbb16e3){return _0x3f0a23['define'](_0x37ca('0x9'),attributes,{'tableName':_0x37ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x37ca('0xb'),'collate':_0x37ca('0xc')});}; \ No newline at end of file +var _0x737d=['exports','define','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x3fe30d,_0x469e48){var _0x37b3e1=function(_0x5f1a27){while(--_0x5f1a27){_0x3fe30d['push'](_0x3fe30d['shift']());}};_0x37b3e1(++_0x469e48);}(_0x737d,0x72));var _0xd737=function(_0x151efc,_0xacfaf2){_0x151efc=_0x151efc-0x0;var _0x1debeb=_0x737d[_0x151efc];return _0x1debeb;};'use strict';var _=require(_0xd737('0x0'));var util=require(_0xd737('0x1'));var logger=require(_0xd737('0x2'))(_0xd737('0x3'));var moment=require(_0xd737('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd737('0x5'));var rimraf=require(_0xd737('0x6'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0xd737('0x7')]=function(_0x565d4d,_0x4e5be1){return _0x565d4d[_0xd737('0x8')]('ChatApplication',attributes,{'tableName':_0xd737('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd737('0xa')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 198e432..95c1dae 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 _0x2c93=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2c93,0x106));var _0x32c9=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x2c93[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x32c9('0x0'));var util=require(_0x32c9('0x1'));var moment=require(_0x32c9('0x2'));var BPromise=require(_0x32c9('0x3'));var rs=require(_0x32c9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x32c9('0x5'));var logger=require(_0x32c9('0x6'))(_0x32c9('0x7'));var config=require('../../config/environment');var jayson=require(_0x32c9('0x8'));var client=jayson[_0x32c9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x112024,_0x8c5c8e,_0x1b8ef9){return new BPromise(function(_0x1f6062,_0x30e03d){return client[_0x32c9('0xa')](_0x112024,_0x1b8ef9)[_0x32c9('0xb')](function(_0x43bb2c){logger[_0x32c9('0xc')](_0x32c9('0xd'),_0x8c5c8e,_0x32c9('0xe'));logger[_0x32c9('0xf')](_0x32c9('0x10'),_0x8c5c8e,_0x32c9('0xe'),JSON['stringify'](_0x43bb2c));if(_0x43bb2c[_0x32c9('0x11')]){if(_0x43bb2c[_0x32c9('0x11')][_0x32c9('0x12')]===0x1f4){logger[_0x32c9('0x11')](_0x32c9('0xd'),_0x8c5c8e,_0x43bb2c[_0x32c9('0x11')][_0x32c9('0x13')]);return _0x30e03d(_0x43bb2c[_0x32c9('0x11')][_0x32c9('0x13')]);}logger[_0x32c9('0x11')](_0x32c9('0xd'),_0x8c5c8e,_0x43bb2c['error'][_0x32c9('0x13')]);return _0x1f6062(_0x43bb2c['error'][_0x32c9('0x13')]);}else{logger[_0x32c9('0xc')](_0x32c9('0xd'),_0x8c5c8e,_0x32c9('0xe'));_0x1f6062(_0x43bb2c[_0x32c9('0x14')][_0x32c9('0x13')]);}})[_0x32c9('0x15')](function(_0x3a76ee){logger[_0x32c9('0x11')](_0x32c9('0xd'),_0x8c5c8e,_0x3a76ee);_0x30e03d(_0x3a76ee);});});} \ No newline at end of file +var _0x73f3=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatApplication,\x20%s,\x20%s','message','result'];(function(_0x3b9ebc,_0x3920da){var _0x1ca0ea=function(_0xa9695a){while(--_0xa9695a){_0x3b9ebc['push'](_0x3b9ebc['shift']());}};_0x1ca0ea(++_0x3920da);}(_0x73f3,0x1cc));var _0x373f=function(_0x422eb5,_0x2e9f9a){_0x422eb5=_0x422eb5-0x0;var _0x2a511b=_0x73f3[_0x422eb5];return _0x2a511b;};'use strict';var _=require(_0x373f('0x0'));var util=require(_0x373f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x373f('0x2'));var fs=require('fs');var Redis=require(_0x373f('0x3'));var db=require(_0x373f('0x4'))['db'];var utils=require(_0x373f('0x5'));var logger=require('../../config/logger')(_0x373f('0x6'));var config=require('../../config/environment');var jayson=require(_0x373f('0x7'));var client=jayson[_0x373f('0x8')][_0x373f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c7b77,_0x51bbac,_0x3815fb){return new BPromise(function(_0x5f3a68,_0x2ee770){return client[_0x373f('0xa')](_0x1c7b77,_0x3815fb)['then'](function(_0x3e2d35){logger[_0x373f('0xb')]('ChatApplication,\x20%s,\x20%s',_0x51bbac,'request\x20sent');logger[_0x373f('0xc')](_0x373f('0xd'),_0x51bbac,_0x373f('0xe'),JSON['stringify'](_0x3e2d35));if(_0x3e2d35[_0x373f('0xf')]){if(_0x3e2d35[_0x373f('0xf')][_0x373f('0x10')]===0x1f4){logger['error'](_0x373f('0x11'),_0x51bbac,_0x3e2d35['error'][_0x373f('0x12')]);return _0x2ee770(_0x3e2d35[_0x373f('0xf')][_0x373f('0x12')]);}logger[_0x373f('0xf')]('ChatApplication,\x20%s,\x20%s',_0x51bbac,_0x3e2d35[_0x373f('0xf')]['message']);return _0x5f3a68(_0x3e2d35[_0x373f('0xf')][_0x373f('0x12')]);}else{logger[_0x373f('0xb')]('ChatApplication,\x20%s,\x20%s',_0x51bbac,_0x373f('0xe'));_0x5f3a68(_0x3e2d35[_0x373f('0x13')][_0x373f('0x12')]);}})['catch'](function(_0x1a0a61){logger[_0x373f('0xf')](_0x373f('0x11'),_0x51bbac,_0x1a0a61);_0x2ee770(_0x1a0a61);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index b4e40ba..aed6b43 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 _0x3798=['../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3798,0xe9));var _0x8379=function(_0x1da90d,_0x349c14){_0x1da90d=_0x1da90d-0x0;var _0x34aae9=_0x3798[_0x1da90d];return _0x34aae9;};'use strict';var multer=require(_0x8379('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8379('0x1'));var router=express[_0x8379('0x2')]();var fs_extra=require(_0x8379('0x3'));var auth=require(_0x8379('0x4'));var interaction=require(_0x8379('0x5'));var config=require(_0x8379('0x6'));var controller=require('./chatApplication.controller');router[_0x8379('0x7')](_0x8379('0x8'),auth[_0x8379('0x9')](),controller['show']);router['put']('/:id',auth[_0x8379('0x9')](),controller[_0x8379('0xa')]);router[_0x8379('0xb')](_0x8379('0x8'),auth[_0x8379('0x9')](),controller[_0x8379('0xc')]);module[_0x8379('0xd')]=router; \ No newline at end of file +var _0x5673=['isAuthenticated','show','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get'];(function(_0x56281b,_0x581ef5){var _0x37e4e8=function(_0x5df89f){while(--_0x5df89f){_0x56281b['push'](_0x56281b['shift']());}};_0x37e4e8(++_0x581ef5);}(_0x5673,0x1b7));var _0x3567=function(_0x3124f8,_0x1a8b23){_0x3124f8=_0x3124f8-0x0;var _0x5bab5f=_0x5673[_0x3124f8];return _0x5bab5f;};'use strict';var multer=require(_0x3567('0x0'));var util=require(_0x3567('0x1'));var path=require(_0x3567('0x2'));var timeout=require(_0x3567('0x3'));var express=require(_0x3567('0x4'));var router=express[_0x3567('0x5')]();var fs_extra=require(_0x3567('0x6'));var auth=require(_0x3567('0x7'));var interaction=require(_0x3567('0x8'));var config=require('../../config/environment');var controller=require(_0x3567('0x9'));router[_0x3567('0xa')]('/:id',auth[_0x3567('0xb')](),controller[_0x3567('0xc')]);router[_0x3567('0xd')](_0x3567('0xe'),auth[_0x3567('0xb')](),controller[_0x3567('0xf')]);router[_0x3567('0x10')](_0x3567('0xe'),auth[_0x3567('0xb')](),controller['destroy']);module[_0x3567('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 82b13d2..f9f379e 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 _0xaac4=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3663cb,_0x426160){var _0x2e5262=function(_0xf5ee41){while(--_0xf5ee41){_0x3663cb['push'](_0x3663cb['shift']());}};_0x2e5262(++_0x426160);}(_0xaac4,0x6c));var _0x4aac=function(_0x419c4a,_0x5d525d){_0x419c4a=_0x419c4a-0x0;var _0x4dae37=_0xaac4[_0x419c4a];return _0x4dae37;};'use strict';var Sequelize=require(_0x4aac('0x0'));module[_0x4aac('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4aac('0x2')]},'write':{'type':Sequelize[_0x4aac('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd706=['BOOLEAN','sequelize','exports','STRING'];(function(_0xf0fd64,_0x5a71db){var _0x1d5666=function(_0x44aeb5){while(--_0x44aeb5){_0xf0fd64['push'](_0xf0fd64['shift']());}};_0x1d5666(++_0x5a71db);}(_0xd706,0x115));var _0x6d70=function(_0x24148a,_0x2c3b2a){_0x24148a=_0x24148a-0x0;var _0x45d54a=_0xd706[_0x24148a];return _0x45d54a;};'use strict';var Sequelize=require(_0x6d70('0x0'));module[_0x6d70('0x1')]={'name':{'type':Sequelize[_0x6d70('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x6d70('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 a00b7a3..72a453c 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 _0xa277=['getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','./chatGroup.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','ChatGroup','findAll','rows','catch','find','create','body','update','params','describe','ChatInternalMessage','addMembers','omit','User','order','getMembers','removeMembers'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0xa277,0x1f0));var _0x7a27=function(_0x180131,_0x28e667){_0x180131=_0x180131-0x0;var _0x13755b=_0xa277[_0x180131];return _0x13755b;};'use strict';var emlformat=require(_0x7a27('0x0'));var rimraf=require(_0x7a27('0x1'));var zipdir=require(_0x7a27('0x2'));var jsonpatch=require(_0x7a27('0x3'));var rp=require(_0x7a27('0x4'));var moment=require('moment');var BPromise=require(_0x7a27('0x5'));var Mustache=require(_0x7a27('0x6'));var util=require(_0x7a27('0x7'));var path=require('path');var sox=require(_0x7a27('0x8'));var csv=require(_0x7a27('0x9'));var ejs=require(_0x7a27('0xa'));var fs=require('fs');var fs_extra=require(_0x7a27('0xb'));var _=require(_0x7a27('0xc'));var squel=require('squel');var crypto=require(_0x7a27('0xd'));var jsforce=require(_0x7a27('0xe'));var deskjs=require(_0x7a27('0xf'));var toCsv=require(_0x7a27('0x9'));var querystring=require(_0x7a27('0x10'));var Papa=require(_0x7a27('0x11'));var Redis=require(_0x7a27('0x12'));var authService=require(_0x7a27('0x13'));var qs=require(_0x7a27('0x14'));var as=require(_0x7a27('0x15'));var hardwareService=require(_0x7a27('0x16'));var logger=require('../../config/logger')(_0x7a27('0x17'));var utils=require(_0x7a27('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7a27('0x19'));var db=require(_0x7a27('0x1a'))['db'];config['redis']=_[_0x7a27('0x1b')](config[_0x7a27('0x1c')],{'host':_0x7a27('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7a27('0x1e'))['register'](socket);function respondWithStatusCode(_0x3a9dd1,_0x3f4482){_0x3f4482=_0x3f4482||0xcc;return function(_0x5f0262){if(_0x5f0262){return _0x3a9dd1[_0x7a27('0x1f')](_0x3f4482);}return _0x3a9dd1[_0x7a27('0x20')](_0x3f4482)[_0x7a27('0x21')]();};}function respondWithResult(_0x4c4579,_0x28b608){_0x28b608=_0x28b608||0xc8;return function(_0x1433ae){if(_0x1433ae){return _0x4c4579[_0x7a27('0x20')](_0x28b608)[_0x7a27('0x22')](_0x1433ae);}};}function respondWithFilteredResult(_0x3bd962,_0x2ff936){return function(_0x290e25){if(_0x290e25){var _0x480deb=typeof _0x2ff936[_0x7a27('0x23')]===_0x7a27('0x24')&&typeof _0x2ff936[_0x7a27('0x25')]===_0x7a27('0x24');var _0x4befc8=_0x290e25['count'];var _0x2e13a7=_0x480deb?0x0:_0x2ff936[_0x7a27('0x23')];var _0x340925=_0x480deb?_0x290e25[_0x7a27('0x26')]:_0x2ff936[_0x7a27('0x23')]+_0x2ff936[_0x7a27('0x25')];var _0x2c0fcf;if(_0x340925>=_0x4befc8){_0x340925=_0x4befc8;_0x2c0fcf=0xc8;}else{_0x2c0fcf=0xce;}_0x3bd962[_0x7a27('0x20')](_0x2c0fcf);return _0x3bd962[_0x7a27('0x27')](_0x7a27('0x28'),_0x2e13a7+'-'+_0x340925+'/'+_0x4befc8)['json'](_0x290e25);}return null;};}function patchUpdates(_0x26e71e){return function(_0xf71b3c){try{jsonpatch[_0x7a27('0x29')](_0xf71b3c,_0x26e71e,!![]);}catch(_0x8c3777){return BPromise[_0x7a27('0x2a')](_0x8c3777);}return _0xf71b3c[_0x7a27('0x2b')]();};}function saveUpdates(_0x59bab5,_0x509e20){return function(_0xb85130){if(_0xb85130){return _0xb85130['update'](_0x59bab5)[_0x7a27('0x2c')](function(_0x6dc1a4){return _0x6dc1a4;});}return null;};}function removeEntity(_0x1f3810,_0x20dbc4){return function(_0x4f9732){if(_0x4f9732){return _0x4f9732[_0x7a27('0x2d')]()['then'](function(){_0x1f3810[_0x7a27('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1126c7,_0xb7dbde){return function(_0x3af1a3){if(!_0x3af1a3){_0x1126c7['sendStatus'](0x194);}return _0x3af1a3;};}function handleError(_0x3f46af,_0x1fbf01){_0x1fbf01=_0x1fbf01||0x1f4;return function(_0x4f51f1){logger[_0x7a27('0x2e')](_0x4f51f1[_0x7a27('0x2f')]);if(_0x4f51f1[_0x7a27('0x30')]){delete _0x4f51f1['name'];}_0x3f46af['status'](_0x1fbf01)[_0x7a27('0x31')](_0x4f51f1);};}exports[_0x7a27('0x32')]=function(_0x4da785,_0x1191ee){var _0x1eec5c={},_0x7befcc={},_0x48686a={'count':0x0,'rows':[]};var _0x11e570=_['map'](db['ChatGroup'][_0x7a27('0x33')],function(_0x1436f5){return{'name':_0x1436f5[_0x7a27('0x34')],'type':_0x1436f5[_0x7a27('0x35')][_0x7a27('0x36')]};});_0x7befcc[_0x7a27('0x37')]=_[_0x7a27('0x38')](_0x11e570,'name');_0x7befcc[_0x7a27('0x39')]=_[_0x7a27('0x3a')](_0x4da785[_0x7a27('0x39')]);_0x7befcc['filters']=_[_0x7a27('0x3b')](_0x7befcc[_0x7a27('0x37')],_0x7befcc[_0x7a27('0x39')]);_0x1eec5c[_0x7a27('0x3c')]=_[_0x7a27('0x3b')](_0x7befcc[_0x7a27('0x37')],qs['fields'](_0x4da785['query'][_0x7a27('0x3d')]));_0x1eec5c['attributes']=_0x1eec5c[_0x7a27('0x3c')][_0x7a27('0x3e')]?_0x1eec5c[_0x7a27('0x3c')]:_0x7befcc[_0x7a27('0x37')];if(!_0x4da785['query'][_0x7a27('0x3f')](_0x7a27('0x40'))){_0x1eec5c[_0x7a27('0x25')]=qs[_0x7a27('0x25')](_0x4da785[_0x7a27('0x39')][_0x7a27('0x25')]);_0x1eec5c[_0x7a27('0x23')]=qs[_0x7a27('0x23')](_0x4da785['query']['offset']);}_0x1eec5c['order']=qs['sort'](_0x4da785[_0x7a27('0x39')][_0x7a27('0x41')]);_0x1eec5c['where']=qs[_0x7a27('0x42')](_[_0x7a27('0x43')](_0x4da785[_0x7a27('0x39')],_0x7befcc[_0x7a27('0x42')]),_0x11e570);if(_0x4da785['query']['filter']){_0x1eec5c[_0x7a27('0x44')]=_[_0x7a27('0x45')](_0x1eec5c[_0x7a27('0x44')],{'$or':_[_0x7a27('0x38')](_0x11e570,function(_0x1fb3b5){if(_0x1fb3b5[_0x7a27('0x35')]!==_0x7a27('0x46')){var _0xa03ebd={};_0xa03ebd[_0x1fb3b5[_0x7a27('0x30')]]={'$like':'%'+_0x4da785[_0x7a27('0x39')][_0x7a27('0x47')]+'%'};return _0xa03ebd;}})});}_0x1eec5c=_[_0x7a27('0x45')]({},_0x1eec5c,_0x4da785[_0x7a27('0x48')]);var _0x594078={'where':_0x1eec5c[_0x7a27('0x44')]};return db['ChatGroup'][_0x7a27('0x26')](_0x594078)[_0x7a27('0x2c')](function(_0x24a3ae){_0x48686a[_0x7a27('0x26')]=_0x24a3ae;if(_0x4da785['query'][_0x7a27('0x49')]){_0x1eec5c[_0x7a27('0x4a')]=[{'all':!![]}];}return db[_0x7a27('0x4b')][_0x7a27('0x4c')](_0x1eec5c);})[_0x7a27('0x2c')](function(_0x2c7a6c){_0x48686a[_0x7a27('0x4d')]=_0x2c7a6c;return _0x48686a;})[_0x7a27('0x2c')](respondWithFilteredResult(_0x1191ee,_0x1eec5c))[_0x7a27('0x4e')](handleError(_0x1191ee,null));};exports['show']=function(_0x5f4f23,_0x41b00e){var _0x76f894={'raw':!![],'where':{'id':_0x5f4f23['params']['id']}},_0x1cdd7e={};_0x1cdd7e[_0x7a27('0x37')]=_[_0x7a27('0x3a')](db['ChatGroup']['rawAttributes']);_0x1cdd7e[_0x7a27('0x39')]=_[_0x7a27('0x3a')](_0x5f4f23[_0x7a27('0x39')]);_0x1cdd7e['filters']=_[_0x7a27('0x3b')](_0x1cdd7e['model'],_0x1cdd7e[_0x7a27('0x39')]);_0x76f894[_0x7a27('0x3c')]=_[_0x7a27('0x3b')](_0x1cdd7e[_0x7a27('0x37')],qs[_0x7a27('0x3d')](_0x5f4f23['query'][_0x7a27('0x3d')]));_0x76f894[_0x7a27('0x3c')]=_0x76f894[_0x7a27('0x3c')][_0x7a27('0x3e')]?_0x76f894[_0x7a27('0x3c')]:_0x1cdd7e[_0x7a27('0x37')];if(_0x5f4f23['query']['includeAll']){_0x76f894['include']=[{'all':!![]}];}_0x76f894=_[_0x7a27('0x45')]({},_0x76f894,_0x5f4f23[_0x7a27('0x48')]);return db[_0x7a27('0x4b')][_0x7a27('0x4f')](_0x76f894)[_0x7a27('0x2c')](handleEntityNotFound(_0x41b00e,null))[_0x7a27('0x2c')](respondWithResult(_0x41b00e,null))[_0x7a27('0x4e')](handleError(_0x41b00e,null));};exports[_0x7a27('0x50')]=function(_0x3072bc,_0x5840b0){return db[_0x7a27('0x4b')][_0x7a27('0x50')](_0x3072bc[_0x7a27('0x51')],{})[_0x7a27('0x2c')](respondWithResult(_0x5840b0,0xc9))[_0x7a27('0x4e')](handleError(_0x5840b0,null));};exports[_0x7a27('0x52')]=function(_0x2e16b2,_0x1b08dc){if(_0x2e16b2['body']['id']){delete _0x2e16b2[_0x7a27('0x51')]['id'];}return db[_0x7a27('0x4b')][_0x7a27('0x4f')]({'where':{'id':_0x2e16b2[_0x7a27('0x53')]['id']}})['then'](handleEntityNotFound(_0x1b08dc,null))[_0x7a27('0x2c')](saveUpdates(_0x2e16b2[_0x7a27('0x51')],null))[_0x7a27('0x2c')](respondWithResult(_0x1b08dc,null))[_0x7a27('0x4e')](handleError(_0x1b08dc,null));};exports[_0x7a27('0x2d')]=function(_0x2ff167,_0x7879ad){return db[_0x7a27('0x4b')][_0x7a27('0x4f')]({'where':{'id':_0x2ff167['params']['id']}})[_0x7a27('0x2c')](handleEntityNotFound(_0x7879ad,null))[_0x7a27('0x2c')](removeEntity(_0x7879ad,null))[_0x7a27('0x4e')](handleError(_0x7879ad,null));};exports[_0x7a27('0x54')]=function(_0x3d8d92,_0xe2ce79){return db[_0x7a27('0x4b')]['describe']()[_0x7a27('0x2c')](respondWithResult(_0xe2ce79,null))[_0x7a27('0x4e')](handleError(_0xe2ce79,null));};exports['getUnread']=function(_0x30f38c,_0x26ae7c,_0x3ecba2){return db[_0x7a27('0x55')][_0x7a27('0x26')]({'where':{'ChatGroupId':_0x30f38c[_0x7a27('0x53')]['id'],'ToId':_0x30f38c['user']['id'],'read':![]}})[_0x7a27('0x2c')](function(_0x7f9ba){return{'id':_['toInteger'](_0x30f38c['params']['id']),'count':_0x7f9ba};})[_0x7a27('0x2c')](respondWithResult(_0x26ae7c,null))['catch'](handleError(_0x26ae7c,null));};exports[_0x7a27('0x56')]=function(_0x2a4142,_0x24d20e,_0x1b9e14){return db[_0x7a27('0x4b')][_0x7a27('0x4f')]({'where':{'id':_0x2a4142[_0x7a27('0x53')]['id']}})[_0x7a27('0x2c')](handleEntityNotFound(_0x24d20e,null))[_0x7a27('0x2c')](function(_0xe09070){if(_0xe09070){return _0xe09070[_0x7a27('0x56')](_0x2a4142['body']['ids'],_[_0x7a27('0x57')](_0x2a4142['body'],['ids','id'])||{});}})[_0x7a27('0x2c')](respondWithResult(_0x24d20e,null))[_0x7a27('0x4e')](handleError(_0x24d20e,null));};exports['getMembers']=function(_0x21c30b,_0x1f051e,_0x528b88){var _0x576537={};var _0x422135={};var _0x5628b7;var _0x5042d6;return db[_0x7a27('0x4b')]['findOne']({'where':{'id':_0x21c30b[_0x7a27('0x53')]['id']}})[_0x7a27('0x2c')](handleEntityNotFound(_0x1f051e,null))[_0x7a27('0x2c')](function(_0xd18baa){if(_0xd18baa){_0x5628b7=_0xd18baa;_0x422135[_0x7a27('0x37')]=_[_0x7a27('0x3a')](db[_0x7a27('0x58')][_0x7a27('0x33')]);_0x422135['query']=_[_0x7a27('0x3a')](_0x21c30b[_0x7a27('0x39')]);_0x422135['filters']=_[_0x7a27('0x3b')](_0x422135[_0x7a27('0x37')],_0x422135['query']);_0x576537['attributes']=_['intersection'](_0x422135['model'],qs[_0x7a27('0x3d')](_0x21c30b[_0x7a27('0x39')][_0x7a27('0x3d')]));_0x576537[_0x7a27('0x3c')]=_0x576537[_0x7a27('0x3c')][_0x7a27('0x3e')]?_0x576537[_0x7a27('0x3c')]:_0x422135[_0x7a27('0x37')];_0x576537[_0x7a27('0x59')]=qs[_0x7a27('0x41')](_0x21c30b['query'][_0x7a27('0x41')]);_0x576537['where']=qs[_0x7a27('0x42')](_['pick'](_0x21c30b[_0x7a27('0x39')],_0x422135[_0x7a27('0x42')]));if(_0x21c30b[_0x7a27('0x39')][_0x7a27('0x47')]){_0x576537[_0x7a27('0x44')]=_[_0x7a27('0x45')](_0x576537[_0x7a27('0x44')],{'$or':_[_0x7a27('0x38')](_0x576537['attributes'],function(_0x41629f){var _0x483711={};_0x483711[_0x41629f]={'$like':'%'+_0x21c30b[_0x7a27('0x39')][_0x7a27('0x47')]+'%'};return _0x483711;})});}_0x576537=_[_0x7a27('0x45')]({},_0x576537,_0x21c30b[_0x7a27('0x48')]);return _0x5628b7[_0x7a27('0x5a')](_0x576537);}})[_0x7a27('0x2c')](function(_0xb26db1){if(_0xb26db1){_0x5042d6=_0xb26db1[_0x7a27('0x3e')];if(!_0x21c30b[_0x7a27('0x39')][_0x7a27('0x3f')](_0x7a27('0x40'))){_0x576537[_0x7a27('0x25')]=qs[_0x7a27('0x25')](_0x21c30b[_0x7a27('0x39')][_0x7a27('0x25')]);_0x576537[_0x7a27('0x23')]=qs[_0x7a27('0x23')](_0x21c30b[_0x7a27('0x39')]['offset']);}return _0x5628b7['getMembers'](_0x576537);}})[_0x7a27('0x2c')](function(_0x51cfc9){if(_0x51cfc9){return _0x51cfc9?{'count':_0x5042d6,'rows':_0x51cfc9}:null;}})[_0x7a27('0x2c')](respondWithResult(_0x1f051e,null))[_0x7a27('0x4e')](handleError(_0x1f051e,null));};exports['removeMembers']=function(_0x5cb62b,_0x38c470,_0x31a133){return db[_0x7a27('0x4b')][_0x7a27('0x4f')]({'where':{'id':_0x5cb62b[_0x7a27('0x53')]['id']}})['then'](handleEntityNotFound(_0x38c470,null))[_0x7a27('0x2c')](function(_0x4b635f){if(_0x4b635f){return _0x4b635f[_0x7a27('0x5b')](_0x5cb62b[_0x7a27('0x39')]['ids']);}})['then'](respondWithStatusCode(_0x38c470,null))[_0x7a27('0x4e')](handleError(_0x38c470,null));};exports['addMessage']=function(_0x3b2b63,_0x3661e7,_0x5cd9e4){if(_0x3b2b63[_0x7a27('0x51')]['id']){delete _0x3b2b63[_0x7a27('0x51')]['id'];}return db[_0x7a27('0x4b')]['find']({'where':{'id':_0x3b2b63['params']['id']}})['then'](handleEntityNotFound(_0x3661e7,null))[_0x7a27('0x2c')](function(_0x2631ff){if(_0x2631ff){_0x3b2b63[_0x7a27('0x51')]['ChatGroupId']=_0x2631ff['id'];return db[_0x7a27('0x55')][_0x7a27('0x50')](_0x3b2b63[_0x7a27('0x51')]);}})['then'](respondWithResult(_0x3661e7,null))[_0x7a27('0x4e')](handleError(_0x3661e7,null));};exports[_0x7a27('0x5c')]=function(_0xd6544c,_0x2c17cf,_0x1bc540){var _0x5b385f={};var _0x4d05be={};var _0xb4a279;var _0x38e145;return db[_0x7a27('0x4b')][_0x7a27('0x5d')]({'where':{'id':_0xd6544c['params']['id']}})[_0x7a27('0x2c')](handleEntityNotFound(_0x2c17cf,null))[_0x7a27('0x2c')](function(_0x4701c4){if(_0x4701c4){_0xb4a279=_0x4701c4;_0x4d05be[_0x7a27('0x37')]=_[_0x7a27('0x3a')](db[_0x7a27('0x55')]['rawAttributes']);_0x4d05be['query']=_[_0x7a27('0x3a')](_0xd6544c[_0x7a27('0x39')]);_0x4d05be['filters']=_[_0x7a27('0x3b')](_0x4d05be['model'],_0x4d05be[_0x7a27('0x39')]);_0x5b385f['attributes']=_[_0x7a27('0x3b')](_0x4d05be[_0x7a27('0x37')],qs[_0x7a27('0x3d')](_0xd6544c[_0x7a27('0x39')][_0x7a27('0x3d')]));_0x5b385f['attributes']=_0x5b385f[_0x7a27('0x3c')][_0x7a27('0x3e')]?_0x5b385f[_0x7a27('0x3c')]:_0x4d05be[_0x7a27('0x37')];_0x5b385f['order']=qs[_0x7a27('0x41')](_0xd6544c[_0x7a27('0x39')][_0x7a27('0x41')]);_0x5b385f[_0x7a27('0x44')]=qs[_0x7a27('0x42')](_[_0x7a27('0x43')](_0xd6544c[_0x7a27('0x39')],_0x4d05be['filters']));if(_0xd6544c[_0x7a27('0x39')][_0x7a27('0x47')]){_0x5b385f[_0x7a27('0x44')]=_[_0x7a27('0x45')](_0x5b385f[_0x7a27('0x44')],{'$or':_[_0x7a27('0x38')](_0x5b385f[_0x7a27('0x3c')],function(_0x5b3b69){var _0x535d7f={};_0x535d7f[_0x5b3b69]={'$like':'%'+_0xd6544c['query'][_0x7a27('0x47')]+'%'};return _0x535d7f;})});}if(_0xd6544c[_0x7a27('0x39')][_0x7a27('0x5e')]){var _0xf76bd7=_0xd6544c[_0x7a27('0x39')][_0x7a27('0x5e')][_0x7a27('0x5f')](',');var _0x3e755d={};_0x3e755d[_0xf76bd7[0x0]]={'$gte':moment(_0xf76bd7[0x1])[_0x7a27('0x60')](_0x7a27('0x61'))};_0x5b385f[_0x7a27('0x44')]=_[_0x7a27('0x45')](_0x5b385f[_0x7a27('0x44')],_0x3e755d);}_0x5b385f=_[_0x7a27('0x45')]({},_0x5b385f,_0xd6544c[_0x7a27('0x48')]);return _0xb4a279[_0x7a27('0x5c')](_0x5b385f);}})[_0x7a27('0x2c')](function(_0xbeb2a3){if(_0xbeb2a3){_0x38e145=_0xbeb2a3[_0x7a27('0x3e')];if(!_0xd6544c[_0x7a27('0x39')][_0x7a27('0x3f')](_0x7a27('0x40'))){_0x5b385f[_0x7a27('0x25')]=qs[_0x7a27('0x25')](_0xd6544c[_0x7a27('0x39')][_0x7a27('0x25')]);_0x5b385f['offset']=qs[_0x7a27('0x23')](_0xd6544c[_0x7a27('0x39')]['offset']);}return _0xb4a279['getMessages'](_0x5b385f);}})[_0x7a27('0x2c')](function(_0x1ea6a4){if(_0x1ea6a4){return _0x1ea6a4?{'count':_0x38e145,'rows':_0x1ea6a4}:null;}})[_0x7a27('0x2c')](respondWithResult(_0x2c17cf,null))['catch'](handleError(_0x2c17cf,null));}; \ No newline at end of file +var _0x24a8=['limit','count','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','User','removeMembers','addMessage','ChatGroupId','findOne','split','getMessages','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','jsforce','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','json','offset','undefined'];(function(_0x4cc5a4,_0x56635b){var _0x1abfe3=function(_0x188bfa){while(--_0x188bfa){_0x4cc5a4['push'](_0x4cc5a4['shift']());}};_0x1abfe3(++_0x56635b);}(_0x24a8,0x163));var _0x824a=function(_0x5511d4,_0x51aab8){_0x5511d4=_0x5511d4-0x0;var _0x133104=_0x24a8[_0x5511d4];return _0x133104;};'use strict';var emlformat=require(_0x824a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x824a('0x1'));var jsonpatch=require(_0x824a('0x2'));var rp=require(_0x824a('0x3'));var moment=require(_0x824a('0x4'));var BPromise=require(_0x824a('0x5'));var Mustache=require('mustache');var util=require(_0x824a('0x6'));var path=require(_0x824a('0x7'));var sox=require(_0x824a('0x8'));var csv=require('to-csv');var ejs=require(_0x824a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x824a('0xa'));var squel=require(_0x824a('0xb'));var crypto=require('crypto');var jsforce=require(_0x824a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x824a('0xd'));var querystring=require('querystring');var Papa=require(_0x824a('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x824a('0xf'));var as=require(_0x824a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x824a('0x11'))(_0x824a('0x12'));var utils=require(_0x824a('0x13'));var config=require(_0x824a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x824a('0x15'))['db'];config[_0x824a('0x16')]=_[_0x824a('0x17')](config[_0x824a('0x16')],{'host':_0x824a('0x18'),'port':0x18eb});var socket=require(_0x824a('0x19'))(new Redis(config[_0x824a('0x16')]));require(_0x824a('0x1a'))[_0x824a('0x1b')](socket);function respondWithStatusCode(_0x148252,_0x4dde86){_0x4dde86=_0x4dde86||0xcc;return function(_0x4d396f){if(_0x4d396f){return _0x148252[_0x824a('0x1c')](_0x4dde86);}return _0x148252[_0x824a('0x1d')](_0x4dde86)['end']();};}function respondWithResult(_0x5358e4,_0x228be1){_0x228be1=_0x228be1||0xc8;return function(_0x52ac9f){if(_0x52ac9f){return _0x5358e4[_0x824a('0x1d')](_0x228be1)[_0x824a('0x1e')](_0x52ac9f);}};}function respondWithFilteredResult(_0xcfefa2,_0x1948aa){return function(_0x4cadbe){if(_0x4cadbe){var _0x588668=typeof _0x1948aa[_0x824a('0x1f')]===_0x824a('0x20')&&typeof _0x1948aa[_0x824a('0x21')]==='undefined';var _0x35b89f=_0x4cadbe[_0x824a('0x22')];var _0x3ee5e7=_0x588668?0x0:_0x1948aa['offset'];var _0x468053=_0x588668?_0x4cadbe[_0x824a('0x22')]:_0x1948aa['offset']+_0x1948aa['limit'];var _0xbb43f6;if(_0x468053>=_0x35b89f){_0x468053=_0x35b89f;_0xbb43f6=0xc8;}else{_0xbb43f6=0xce;}_0xcfefa2['status'](_0xbb43f6);return _0xcfefa2[_0x824a('0x23')](_0x824a('0x24'),_0x3ee5e7+'-'+_0x468053+'/'+_0x35b89f)[_0x824a('0x1e')](_0x4cadbe);}return null;};}function patchUpdates(_0x1864be){return function(_0x30da1f){try{jsonpatch[_0x824a('0x25')](_0x30da1f,_0x1864be,!![]);}catch(_0x73d4dc){return BPromise[_0x824a('0x26')](_0x73d4dc);}return _0x30da1f['save']();};}function saveUpdates(_0x556771,_0xf8dec7){return function(_0x30d8cc){if(_0x30d8cc){return _0x30d8cc[_0x824a('0x27')](_0x556771)[_0x824a('0x28')](function(_0x508cf1){return _0x508cf1;});}return null;};}function removeEntity(_0xcfb23b,_0x4fc538){return function(_0x1b1d5d){if(_0x1b1d5d){return _0x1b1d5d[_0x824a('0x29')]()[_0x824a('0x28')](function(){_0xcfb23b[_0x824a('0x1d')](0xcc)[_0x824a('0x2a')]();});}};}function handleEntityNotFound(_0x459065,_0x579c7c){return function(_0x4a6649){if(!_0x4a6649){_0x459065[_0x824a('0x1c')](0x194);}return _0x4a6649;};}function handleError(_0xcf611e,_0x209611){_0x209611=_0x209611||0x1f4;return function(_0x900b4e){logger[_0x824a('0x2b')](_0x900b4e[_0x824a('0x2c')]);if(_0x900b4e['name']){delete _0x900b4e[_0x824a('0x2d')];}_0xcf611e[_0x824a('0x1d')](_0x209611)[_0x824a('0x2e')](_0x900b4e);};}exports[_0x824a('0x2f')]=function(_0x22bc0a,_0x2d54b5){var _0x34395d={},_0x5759ad={},_0x23ed8d={'count':0x0,'rows':[]};var _0x7104d5=_[_0x824a('0x30')](db[_0x824a('0x31')][_0x824a('0x32')],function(_0x2d82b6){return{'name':_0x2d82b6[_0x824a('0x33')],'type':_0x2d82b6[_0x824a('0x34')][_0x824a('0x35')]};});_0x5759ad[_0x824a('0x36')]=_[_0x824a('0x30')](_0x7104d5,_0x824a('0x2d'));_0x5759ad[_0x824a('0x37')]=_[_0x824a('0x38')](_0x22bc0a['query']);_0x5759ad[_0x824a('0x39')]=_[_0x824a('0x3a')](_0x5759ad[_0x824a('0x36')],_0x5759ad[_0x824a('0x37')]);_0x34395d[_0x824a('0x3b')]=_['intersection'](_0x5759ad[_0x824a('0x36')],qs[_0x824a('0x3c')](_0x22bc0a[_0x824a('0x37')][_0x824a('0x3c')]));_0x34395d[_0x824a('0x3b')]=_0x34395d[_0x824a('0x3b')][_0x824a('0x3d')]?_0x34395d[_0x824a('0x3b')]:_0x5759ad['model'];if(!_0x22bc0a[_0x824a('0x37')][_0x824a('0x3e')](_0x824a('0x3f'))){_0x34395d[_0x824a('0x21')]=qs[_0x824a('0x21')](_0x22bc0a[_0x824a('0x37')][_0x824a('0x21')]);_0x34395d[_0x824a('0x1f')]=qs['offset'](_0x22bc0a[_0x824a('0x37')][_0x824a('0x1f')]);}_0x34395d[_0x824a('0x40')]=qs[_0x824a('0x41')](_0x22bc0a[_0x824a('0x37')]['sort']);_0x34395d[_0x824a('0x42')]=qs[_0x824a('0x39')](_[_0x824a('0x43')](_0x22bc0a[_0x824a('0x37')],_0x5759ad[_0x824a('0x39')]),_0x7104d5);if(_0x22bc0a[_0x824a('0x37')][_0x824a('0x44')]){_0x34395d[_0x824a('0x42')]=_[_0x824a('0x45')](_0x34395d[_0x824a('0x42')],{'$or':_[_0x824a('0x30')](_0x7104d5,function(_0x17b711){if(_0x17b711['type']!==_0x824a('0x46')){var _0x18505e={};_0x18505e[_0x17b711[_0x824a('0x2d')]]={'$like':'%'+_0x22bc0a[_0x824a('0x37')][_0x824a('0x44')]+'%'};return _0x18505e;}})});}_0x34395d=_[_0x824a('0x45')]({},_0x34395d,_0x22bc0a[_0x824a('0x47')]);var _0x4829a7={'where':_0x34395d[_0x824a('0x42')]};return db[_0x824a('0x31')][_0x824a('0x22')](_0x4829a7)[_0x824a('0x28')](function(_0x1f9b2f){_0x23ed8d[_0x824a('0x22')]=_0x1f9b2f;if(_0x22bc0a[_0x824a('0x37')][_0x824a('0x48')]){_0x34395d[_0x824a('0x49')]=[{'all':!![]}];}return db[_0x824a('0x31')][_0x824a('0x4a')](_0x34395d);})[_0x824a('0x28')](function(_0x4920f4){_0x23ed8d[_0x824a('0x4b')]=_0x4920f4;return _0x23ed8d;})[_0x824a('0x28')](respondWithFilteredResult(_0x2d54b5,_0x34395d))[_0x824a('0x4c')](handleError(_0x2d54b5,null));};exports[_0x824a('0x4d')]=function(_0x447778,_0x21e54b){var _0x268c87={'raw':!![],'where':{'id':_0x447778[_0x824a('0x4e')]['id']}},_0x526fe2={};_0x526fe2['model']=_[_0x824a('0x38')](db['ChatGroup'][_0x824a('0x32')]);_0x526fe2[_0x824a('0x37')]=_[_0x824a('0x38')](_0x447778[_0x824a('0x37')]);_0x526fe2[_0x824a('0x39')]=_['intersection'](_0x526fe2[_0x824a('0x36')],_0x526fe2[_0x824a('0x37')]);_0x268c87['attributes']=_[_0x824a('0x3a')](_0x526fe2[_0x824a('0x36')],qs['fields'](_0x447778[_0x824a('0x37')][_0x824a('0x3c')]));_0x268c87[_0x824a('0x3b')]=_0x268c87['attributes'][_0x824a('0x3d')]?_0x268c87[_0x824a('0x3b')]:_0x526fe2['model'];if(_0x447778[_0x824a('0x37')][_0x824a('0x48')]){_0x268c87['include']=[{'all':!![]}];}_0x268c87=_[_0x824a('0x45')]({},_0x268c87,_0x447778[_0x824a('0x47')]);return db[_0x824a('0x31')][_0x824a('0x4f')](_0x268c87)[_0x824a('0x28')](handleEntityNotFound(_0x21e54b,null))[_0x824a('0x28')](respondWithResult(_0x21e54b,null))[_0x824a('0x4c')](handleError(_0x21e54b,null));};exports[_0x824a('0x50')]=function(_0x2d76ac,_0x378ed5){return db['ChatGroup'][_0x824a('0x50')](_0x2d76ac[_0x824a('0x51')],{})['then'](respondWithResult(_0x378ed5,0xc9))[_0x824a('0x4c')](handleError(_0x378ed5,null));};exports[_0x824a('0x27')]=function(_0x453b11,_0x6e833d){if(_0x453b11[_0x824a('0x51')]['id']){delete _0x453b11['body']['id'];}return db[_0x824a('0x31')][_0x824a('0x4f')]({'where':{'id':_0x453b11[_0x824a('0x4e')]['id']}})[_0x824a('0x28')](handleEntityNotFound(_0x6e833d,null))[_0x824a('0x28')](saveUpdates(_0x453b11['body'],null))[_0x824a('0x28')](respondWithResult(_0x6e833d,null))['catch'](handleError(_0x6e833d,null));};exports['destroy']=function(_0x320fc1,_0x3c14fc){return db['ChatGroup']['find']({'where':{'id':_0x320fc1[_0x824a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3c14fc,null))[_0x824a('0x28')](removeEntity(_0x3c14fc,null))[_0x824a('0x4c')](handleError(_0x3c14fc,null));};exports[_0x824a('0x52')]=function(_0x2118ee,_0x5b61e7){return db[_0x824a('0x31')][_0x824a('0x52')]()[_0x824a('0x28')](respondWithResult(_0x5b61e7,null))[_0x824a('0x4c')](handleError(_0x5b61e7,null));};exports[_0x824a('0x53')]=function(_0x3c39d5,_0x5f444c,_0x3de7c7){return db[_0x824a('0x54')]['count']({'where':{'ChatGroupId':_0x3c39d5[_0x824a('0x4e')]['id'],'ToId':_0x3c39d5[_0x824a('0x55')]['id'],'read':![]}})[_0x824a('0x28')](function(_0x19e61e){return{'id':_['toInteger'](_0x3c39d5['params']['id']),'count':_0x19e61e};})['then'](respondWithResult(_0x5f444c,null))['catch'](handleError(_0x5f444c,null));};exports[_0x824a('0x56')]=function(_0x57cc8c,_0x5dda0a,_0x1de2d8){return db['ChatGroup'][_0x824a('0x4f')]({'where':{'id':_0x57cc8c[_0x824a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5dda0a,null))[_0x824a('0x28')](function(_0x25b7a4){if(_0x25b7a4){return _0x25b7a4['addMembers'](_0x57cc8c[_0x824a('0x51')][_0x824a('0x57')],_[_0x824a('0x58')](_0x57cc8c[_0x824a('0x51')],[_0x824a('0x57'),'id'])||{});}})[_0x824a('0x28')](respondWithResult(_0x5dda0a,null))[_0x824a('0x4c')](handleError(_0x5dda0a,null));};exports[_0x824a('0x59')]=function(_0x533774,_0x18e738,_0x3e8a3b){var _0x2317df={};var _0x133cc7={};var _0xa671e0;var _0x311a64;return db['ChatGroup']['findOne']({'where':{'id':_0x533774['params']['id']}})[_0x824a('0x28')](handleEntityNotFound(_0x18e738,null))[_0x824a('0x28')](function(_0x5d579f){if(_0x5d579f){_0xa671e0=_0x5d579f;_0x133cc7[_0x824a('0x36')]=_[_0x824a('0x38')](db[_0x824a('0x5a')]['rawAttributes']);_0x133cc7[_0x824a('0x37')]=_[_0x824a('0x38')](_0x533774[_0x824a('0x37')]);_0x133cc7['filters']=_[_0x824a('0x3a')](_0x133cc7['model'],_0x133cc7['query']);_0x2317df[_0x824a('0x3b')]=_[_0x824a('0x3a')](_0x133cc7['model'],qs[_0x824a('0x3c')](_0x533774[_0x824a('0x37')][_0x824a('0x3c')]));_0x2317df[_0x824a('0x3b')]=_0x2317df['attributes'][_0x824a('0x3d')]?_0x2317df[_0x824a('0x3b')]:_0x133cc7[_0x824a('0x36')];_0x2317df[_0x824a('0x40')]=qs[_0x824a('0x41')](_0x533774[_0x824a('0x37')][_0x824a('0x41')]);_0x2317df[_0x824a('0x42')]=qs[_0x824a('0x39')](_[_0x824a('0x43')](_0x533774[_0x824a('0x37')],_0x133cc7['filters']));if(_0x533774[_0x824a('0x37')][_0x824a('0x44')]){_0x2317df[_0x824a('0x42')]=_[_0x824a('0x45')](_0x2317df['where'],{'$or':_[_0x824a('0x30')](_0x2317df[_0x824a('0x3b')],function(_0x497a3c){var _0x575c00={};_0x575c00[_0x497a3c]={'$like':'%'+_0x533774[_0x824a('0x37')]['filter']+'%'};return _0x575c00;})});}_0x2317df=_[_0x824a('0x45')]({},_0x2317df,_0x533774[_0x824a('0x47')]);return _0xa671e0[_0x824a('0x59')](_0x2317df);}})[_0x824a('0x28')](function(_0x25d672){if(_0x25d672){_0x311a64=_0x25d672['length'];if(!_0x533774[_0x824a('0x37')][_0x824a('0x3e')](_0x824a('0x3f'))){_0x2317df['limit']=qs[_0x824a('0x21')](_0x533774[_0x824a('0x37')][_0x824a('0x21')]);_0x2317df[_0x824a('0x1f')]=qs[_0x824a('0x1f')](_0x533774[_0x824a('0x37')]['offset']);}return _0xa671e0[_0x824a('0x59')](_0x2317df);}})[_0x824a('0x28')](function(_0x54b702){if(_0x54b702){return _0x54b702?{'count':_0x311a64,'rows':_0x54b702}:null;}})[_0x824a('0x28')](respondWithResult(_0x18e738,null))[_0x824a('0x4c')](handleError(_0x18e738,null));};exports[_0x824a('0x5b')]=function(_0x23708e,_0x5d0be7,_0x35c4e1){return db[_0x824a('0x31')][_0x824a('0x4f')]({'where':{'id':_0x23708e['params']['id']}})[_0x824a('0x28')](handleEntityNotFound(_0x5d0be7,null))[_0x824a('0x28')](function(_0x3e93f7){if(_0x3e93f7){return _0x3e93f7[_0x824a('0x5b')](_0x23708e[_0x824a('0x37')]['ids']);}})[_0x824a('0x28')](respondWithStatusCode(_0x5d0be7,null))[_0x824a('0x4c')](handleError(_0x5d0be7,null));};exports[_0x824a('0x5c')]=function(_0x1dd3a7,_0x54ba2b,_0x565358){if(_0x1dd3a7[_0x824a('0x51')]['id']){delete _0x1dd3a7[_0x824a('0x51')]['id'];}return db['ChatGroup'][_0x824a('0x4f')]({'where':{'id':_0x1dd3a7[_0x824a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x54ba2b,null))[_0x824a('0x28')](function(_0x91174c){if(_0x91174c){_0x1dd3a7[_0x824a('0x51')][_0x824a('0x5d')]=_0x91174c['id'];return db[_0x824a('0x54')][_0x824a('0x50')](_0x1dd3a7[_0x824a('0x51')]);}})[_0x824a('0x28')](respondWithResult(_0x54ba2b,null))[_0x824a('0x4c')](handleError(_0x54ba2b,null));};exports['getMessages']=function(_0x3aab78,_0x244621,_0x66f1fe){var _0x48bf23={};var _0x526a5b={};var _0x86cd81;var _0x57257b;return db[_0x824a('0x31')][_0x824a('0x5e')]({'where':{'id':_0x3aab78[_0x824a('0x4e')]['id']}})[_0x824a('0x28')](handleEntityNotFound(_0x244621,null))[_0x824a('0x28')](function(_0x450f5f){if(_0x450f5f){_0x86cd81=_0x450f5f;_0x526a5b[_0x824a('0x36')]=_[_0x824a('0x38')](db[_0x824a('0x54')][_0x824a('0x32')]);_0x526a5b[_0x824a('0x37')]=_[_0x824a('0x38')](_0x3aab78[_0x824a('0x37')]);_0x526a5b['filters']=_[_0x824a('0x3a')](_0x526a5b['model'],_0x526a5b[_0x824a('0x37')]);_0x48bf23[_0x824a('0x3b')]=_['intersection'](_0x526a5b[_0x824a('0x36')],qs[_0x824a('0x3c')](_0x3aab78['query'][_0x824a('0x3c')]));_0x48bf23['attributes']=_0x48bf23['attributes'][_0x824a('0x3d')]?_0x48bf23[_0x824a('0x3b')]:_0x526a5b[_0x824a('0x36')];_0x48bf23[_0x824a('0x40')]=qs[_0x824a('0x41')](_0x3aab78[_0x824a('0x37')][_0x824a('0x41')]);_0x48bf23[_0x824a('0x42')]=qs[_0x824a('0x39')](_[_0x824a('0x43')](_0x3aab78['query'],_0x526a5b[_0x824a('0x39')]));if(_0x3aab78['query'][_0x824a('0x44')]){_0x48bf23[_0x824a('0x42')]=_[_0x824a('0x45')](_0x48bf23['where'],{'$or':_[_0x824a('0x30')](_0x48bf23[_0x824a('0x3b')],function(_0x435b18){var _0x56fc3e={};_0x56fc3e[_0x435b18]={'$like':'%'+_0x3aab78[_0x824a('0x37')]['filter']+'%'};return _0x56fc3e;})});}if(_0x3aab78[_0x824a('0x37')]['$gte']){var _0x2fba7e=_0x3aab78[_0x824a('0x37')]['$gte'][_0x824a('0x5f')](',');var _0x39eea3={};_0x39eea3[_0x2fba7e[0x0]]={'$gte':moment(_0x2fba7e[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x48bf23[_0x824a('0x42')]=_[_0x824a('0x45')](_0x48bf23[_0x824a('0x42')],_0x39eea3);}_0x48bf23=_[_0x824a('0x45')]({},_0x48bf23,_0x3aab78[_0x824a('0x47')]);return _0x86cd81['getMessages'](_0x48bf23);}})[_0x824a('0x28')](function(_0x3dfbd5){if(_0x3dfbd5){_0x57257b=_0x3dfbd5['length'];if(!_0x3aab78[_0x824a('0x37')]['hasOwnProperty']('nolimit')){_0x48bf23[_0x824a('0x21')]=qs[_0x824a('0x21')](_0x3aab78[_0x824a('0x37')][_0x824a('0x21')]);_0x48bf23[_0x824a('0x1f')]=qs[_0x824a('0x1f')](_0x3aab78[_0x824a('0x37')][_0x824a('0x1f')]);}return _0x86cd81[_0x824a('0x60')](_0x48bf23);}})[_0x824a('0x28')](function(_0x59ac12){if(_0x59ac12){return _0x59ac12?{'count':_0x57257b,'rows':_0x59ac12}:null;}})[_0x824a('0x28')](respondWithResult(_0x244621,null))[_0x824a('0x4c')](handleError(_0x244621,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 31ace2f..c1c140d 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 _0x62a7=['save','update','remove','emit','hook','exports','../../mysqldb','ChatGroup','setMaxListeners'];(function(_0x92fc4e,_0x3e6d2b){var _0x1476c6=function(_0x32c8d0){while(--_0x32c8d0){_0x92fc4e['push'](_0x92fc4e['shift']());}};_0x1476c6(++_0x3e6d2b);}(_0x62a7,0x84));var _0x762a=function(_0x1f0c9b,_0x234e61){_0x1f0c9b=_0x1f0c9b-0x0;var _0x1283e6=_0x62a7[_0x1f0c9b];return _0x1283e6;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x762a('0x0'))['db'][_0x762a('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x762a('0x2')](0x0);var events={'afterCreate':_0x762a('0x3'),'afterUpdate':_0x762a('0x4'),'afterDestroy':_0x762a('0x5')};function emitEvent(_0x804ab8){return function(_0x2a0808,_0x5c5006,_0x58690b){ChatGroupEvents[_0x762a('0x6')](_0x804ab8+':'+_0x2a0808['id'],_0x2a0808);ChatGroupEvents[_0x762a('0x6')](_0x804ab8,_0x2a0808);_0x58690b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x762a('0x7')](e,emitEvent(event));}}module[_0x762a('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0x5522=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save'];(function(_0x535517,_0x1095be){var _0xc1f779=function(_0x1049a5){while(--_0x1049a5){_0x535517['push'](_0x535517['shift']());}};_0xc1f779(++_0x1095be);}(_0x5522,0x1bd));var _0x2552=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5522[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x2552('0x0'));var ChatGroup=require(_0x2552('0x1'))['db'][_0x2552('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2552('0x3')](0x0);var events={'afterCreate':_0x2552('0x4'),'afterUpdate':'update','afterDestroy':_0x2552('0x5')};function emitEvent(_0x2fda3a){return function(_0x133ba6,_0x5f3396,_0x322713){ChatGroupEvents[_0x2552('0x6')](_0x2fda3a+':'+_0x133ba6['id'],_0x133ba6);ChatGroupEvents['emit'](_0x2fda3a,_0x133ba6);_0x322713(null);};}for(var e in events){if(events[_0x2552('0x7')](e)){var event=events[e];ChatGroup[_0x2552('0x8')](e,emitEvent(event));}}module[_0x2552('0x9')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index a32ca60..8984320 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 _0x7d93=['lodash','util','../../config/logger','path','rimraf','../../config/environment','./chatGroup.attributes','exports','define','ChatGroup'];(function(_0x3a498d,_0x43a314){var _0xe247b9=function(_0x543e7c){while(--_0x543e7c){_0x3a498d['push'](_0x3a498d['shift']());}};_0xe247b9(++_0x43a314);}(_0x7d93,0x1c2));var _0x37d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d93[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x37d9('0x0'));var util=require(_0x37d9('0x1'));var logger=require(_0x37d9('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x37d9('0x3'));var rimraf=require(_0x37d9('0x4'));var config=require(_0x37d9('0x5'));var attributes=require(_0x37d9('0x6'));module[_0x37d9('0x7')]=function(_0x32bd21,_0x278fdd){return _0x32bd21[_0x37d9('0x8')](_0x37d9('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f13=['./chatGroup.attributes','exports','ChatGroup','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0xb4a90c,_0x11adba){var _0x5ca900=function(_0x37ac22){while(--_0x37ac22){_0xb4a90c['push'](_0xb4a90c['shift']());}};_0x5ca900(++_0x11adba);}(_0x1f13,0xeb));var _0x31f1=function(_0x2c1ed5,_0x56a549){_0x2c1ed5=_0x2c1ed5-0x0;var _0x3606a1=_0x1f13[_0x2c1ed5];return _0x3606a1;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x31f1('0x0'));var BPromise=require(_0x31f1('0x1'));var rp=require(_0x31f1('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31f1('0x3'));var config=require(_0x31f1('0x4'));var attributes=require(_0x31f1('0x5'));module[_0x31f1('0x6')]=function(_0x1d6bca,_0x59c81f){return _0x1d6bca['define'](_0x31f1('0x7'),attributes,{'tableName':'chat_groups','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 124a8bb..fbd2cd4 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 _0x919e=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatGroup.socket','register','then','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','ChatGroup,\x20%s,\x20%s','message','info','catch','lodash','util','moment','randomstring'];(function(_0x1c33b5,_0x3445d8){var _0x5bf626=function(_0x449a63){while(--_0x449a63){_0x1c33b5['push'](_0x1c33b5['shift']());}};_0x5bf626(++_0x3445d8);}(_0x919e,0x1d7));var _0xe919=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x919e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe919('0x0'));var util=require(_0xe919('0x1'));var moment=require(_0xe919('0x2'));var BPromise=require('bluebird');var rs=require(_0xe919('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe919('0x4'));var logger=require(_0xe919('0x5'))(_0xe919('0x6'));var config=require(_0xe919('0x7'));var jayson=require(_0xe919('0x8'));var client=jayson[_0xe919('0x9')][_0xe919('0xa')]({'port':0x232a});config['redis']=_[_0xe919('0xb')](config[_0xe919('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xe919('0xd'))(new Redis(config['redis']));require(_0xe919('0xe'))[_0xe919('0xf')](socket);function respondWithRpcPromise(_0x814c47,_0x58a7a7,_0x83759d){return new BPromise(function(_0x34e59e,_0x1da9c9){return client['request'](_0x814c47,_0x83759d)[_0xe919('0x10')](function(_0x50c6ff){logger['info']('ChatGroup,\x20%s,\x20%s',_0x58a7a7,_0xe919('0x11'));logger[_0xe919('0x12')](_0xe919('0x13'),_0x58a7a7,'request\x20sent',JSON['stringify'](_0x50c6ff));if(_0x50c6ff[_0xe919('0x14')]){if(_0x50c6ff[_0xe919('0x14')]['code']===0x1f4){logger[_0xe919('0x14')](_0xe919('0x15'),_0x58a7a7,_0x50c6ff[_0xe919('0x14')][_0xe919('0x16')]);return _0x1da9c9(_0x50c6ff[_0xe919('0x14')][_0xe919('0x16')]);}logger[_0xe919('0x14')]('ChatGroup,\x20%s,\x20%s',_0x58a7a7,_0x50c6ff[_0xe919('0x14')]['message']);return _0x34e59e(_0x50c6ff['error'][_0xe919('0x16')]);}else{logger[_0xe919('0x17')]('ChatGroup,\x20%s,\x20%s',_0x58a7a7,'request\x20sent');_0x34e59e(_0x50c6ff['result'][_0xe919('0x16')]);}})[_0xe919('0x18')](function(_0x2e0988){logger[_0xe919('0x14')]('ChatGroup,\x20%s,\x20%s',_0x58a7a7,_0x2e0988);_0x1da9c9(_0x2e0988);});});} \ No newline at end of file +var _0xa5c0=['result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','info'];(function(_0x508cbc,_0x2a29c8){var _0x3b98ee=function(_0x5cc156){while(--_0x5cc156){_0x508cbc['push'](_0x508cbc['shift']());}};_0x3b98ee(++_0x2a29c8);}(_0xa5c0,0xbf));var _0x0a5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5c0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0a5c('0x0'));var util=require(_0x0a5c('0x1'));var moment=require(_0x0a5c('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a5c('0x3'));var fs=require('fs');var Redis=require(_0x0a5c('0x4'));var db=require(_0x0a5c('0x5'))['db'];var utils=require(_0x0a5c('0x6'));var logger=require(_0x0a5c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0a5c('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x0a5c('0x9')],{'host':_0x0a5c('0xa'),'port':0x18eb});var socket=require(_0x0a5c('0xb'))(new Redis(config[_0x0a5c('0x9')]));require(_0x0a5c('0xc'))[_0x0a5c('0xd')](socket);function respondWithRpcPromise(_0x161ce9,_0x4e4a0a,_0x23a933){return new BPromise(function(_0x2c8dac,_0x576070){return client[_0x0a5c('0xe')](_0x161ce9,_0x23a933)[_0x0a5c('0xf')](function(_0x35442d){logger['info']('ChatGroup,\x20%s,\x20%s',_0x4e4a0a,_0x0a5c('0x10'));logger[_0x0a5c('0x11')](_0x0a5c('0x12'),_0x4e4a0a,_0x0a5c('0x10'),JSON[_0x0a5c('0x13')](_0x35442d));if(_0x35442d[_0x0a5c('0x14')]){if(_0x35442d[_0x0a5c('0x14')][_0x0a5c('0x15')]===0x1f4){logger[_0x0a5c('0x14')](_0x0a5c('0x16'),_0x4e4a0a,_0x35442d[_0x0a5c('0x14')][_0x0a5c('0x17')]);return _0x576070(_0x35442d[_0x0a5c('0x14')]['message']);}logger['error'](_0x0a5c('0x16'),_0x4e4a0a,_0x35442d[_0x0a5c('0x14')]['message']);return _0x2c8dac(_0x35442d['error']['message']);}else{logger[_0x0a5c('0x18')](_0x0a5c('0x16'),_0x4e4a0a,_0x0a5c('0x10'));_0x2c8dac(_0x35442d[_0x0a5c('0x19')][_0x0a5c('0x17')]);}})[_0x0a5c('0x1a')](function(_0x1a29d9){logger[_0x0a5c('0x14')](_0x0a5c('0x16'),_0x4e4a0a,_0x1a29d9);_0x576070(_0x1a29d9);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 07a6f5d..40115c8 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 _0xee06=['removeListener','length','./chatGroup.events','save','remove','update','emit'];(function(_0x36c6eb,_0x4fb127){var _0x30675b=function(_0x3a788b){while(--_0x3a788b){_0x36c6eb['push'](_0x36c6eb['shift']());}};_0x30675b(++_0x4fb127);}(_0xee06,0x19f));var _0x6ee0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee06[_0x3dd15e];return _0x231fd0;};'use strict';var ChatGroupEvents=require(_0x6ee0('0x0'));var events=[_0x6ee0('0x1'),_0x6ee0('0x2'),_0x6ee0('0x3')];function createListener(_0x56ed68,_0x284013){return function(_0x16e380){_0x284013[_0x6ee0('0x4')](_0x56ed68,_0x16e380);};}function removeListener(_0x3f660c,_0x36ed40){return function(){ChatGroupEvents[_0x6ee0('0x5')](_0x3f660c,_0x36ed40);};}exports['register']=function(_0x5ec9b9){for(var _0x5b9136=0x0,_0x584d20=events[_0x6ee0('0x6')];_0x5b9136<_0x584d20;_0x5b9136++){var _0x3b4f69=events[_0x5b9136];var _0x157fd0=createListener('chatGroup:'+_0x3b4f69,_0x5ec9b9);ChatGroupEvents['on'](_0x3b4f69,_0x157fd0);}}; \ No newline at end of file +var _0x338e=['chatGroup:','save','update','emit','removeListener','length'];(function(_0xab6362,_0x5f53cf){var _0x1d2862=function(_0x3f95a5){while(--_0x3f95a5){_0xab6362['push'](_0xab6362['shift']());}};_0x1d2862(++_0x5f53cf);}(_0x338e,0x169));var _0xe338=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x338e[_0x3dd15e];return _0x231fd0;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xe338('0x0'),'remove',_0xe338('0x1')];function createListener(_0x45c675,_0x35e3ba){return function(_0x42ff34){_0x35e3ba[_0xe338('0x2')](_0x45c675,_0x42ff34);};}function removeListener(_0x540b5c,_0x45dfd4){return function(){ChatGroupEvents[_0xe338('0x3')](_0x540b5c,_0x45dfd4);};}exports['register']=function(_0x490d28){for(var _0x223d7e=0x0,_0x286f06=events[_0xe338('0x4')];_0x223d7e<_0x286f06;_0x223d7e++){var _0x232205=events[_0x223d7e];var _0x51bf10=createListener(_0xe338('0x5')+_0x232205,_0x490d28);ChatGroupEvents['on'](_0x232205,_0x51bf10);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 9ac41a1..a813de7 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 _0x3687=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getUnread','getMembers','getMessages','create','post','addMembers','addMessage','update','delete','destroy','exports','multer','util'];(function(_0x5c1f3b,_0xb93a7e){var _0x3496e0=function(_0xac66aa){while(--_0xac66aa){_0x5c1f3b['push'](_0x5c1f3b['shift']());}};_0x3496e0(++_0xb93a7e);}(_0x3687,0x1e4));var _0x7368=function(_0x475198,_0x30c1fa){_0x475198=_0x475198-0x0;var _0x5b6ee7=_0x3687[_0x475198];return _0x5b6ee7;};'use strict';var multer=require(_0x7368('0x0'));var util=require(_0x7368('0x1'));var path=require(_0x7368('0x2'));var timeout=require(_0x7368('0x3'));var express=require(_0x7368('0x4'));var router=express[_0x7368('0x5')]();var fs_extra=require(_0x7368('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x7368('0x7'));var config=require(_0x7368('0x8'));var controller=require('./chatGroup.controller');router[_0x7368('0x9')]('/',auth[_0x7368('0xa')](),controller[_0x7368('0xb')]);router[_0x7368('0x9')](_0x7368('0xc'),auth[_0x7368('0xa')](),controller[_0x7368('0xd')]);router[_0x7368('0x9')](_0x7368('0xe'),auth[_0x7368('0xa')](),controller[_0x7368('0xf')]);router[_0x7368('0x9')]('/:id/unread',auth[_0x7368('0xa')](),controller[_0x7368('0x10')]);router[_0x7368('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0x7368('0x11')]);router[_0x7368('0x9')]('/:id/messages',auth[_0x7368('0xa')](),controller[_0x7368('0x12')]);router['post']('/',auth[_0x7368('0xa')](),controller[_0x7368('0x13')]);router[_0x7368('0x14')]('/:id/members',auth['isAuthenticated'](),controller[_0x7368('0x15')]);router[_0x7368('0x14')]('/:id/messages',auth[_0x7368('0xa')](),controller[_0x7368('0x16')]);router['put'](_0x7368('0xe'),auth[_0x7368('0xa')](),controller[_0x7368('0x17')]);router[_0x7368('0x18')](_0x7368('0xe'),auth[_0x7368('0xa')](),controller[_0x7368('0x19')]);router[_0x7368('0x18')]('/:id/members',auth['isAuthenticated'](),controller['removeMembers']);module[_0x7368('0x1a')]=router; \ No newline at end of file +var _0x126f=['/:id/messages','getMessages','post','addMembers','addMessage','put','update','delete','removeMembers','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatGroup.controller','index','get','/describe','isAuthenticated','describe','/:id','show','getUnread','/:id/members','getMembers'];(function(_0x2842b4,_0x2b1b7b){var _0x2b9521=function(_0x3613b8){while(--_0x3613b8){_0x2842b4['push'](_0x2842b4['shift']());}};_0x2b9521(++_0x2b1b7b);}(_0x126f,0x192));var _0xf126=function(_0x1eec3a,_0x168828){_0x1eec3a=_0x1eec3a-0x0;var _0x133cf7=_0x126f[_0x1eec3a];return _0x133cf7;};'use strict';var multer=require(_0xf126('0x0'));var util=require('util');var path=require(_0xf126('0x1'));var timeout=require(_0xf126('0x2'));var express=require(_0xf126('0x3'));var router=express['Router']();var fs_extra=require(_0xf126('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf126('0x5'));var config=require(_0xf126('0x6'));var controller=require(_0xf126('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xf126('0x8')]);router[_0xf126('0x9')](_0xf126('0xa'),auth[_0xf126('0xb')](),controller[_0xf126('0xc')]);router[_0xf126('0x9')](_0xf126('0xd'),auth[_0xf126('0xb')](),controller[_0xf126('0xe')]);router[_0xf126('0x9')]('/:id/unread',auth['isAuthenticated'](),controller[_0xf126('0xf')]);router[_0xf126('0x9')](_0xf126('0x10'),auth[_0xf126('0xb')](),controller[_0xf126('0x11')]);router[_0xf126('0x9')](_0xf126('0x12'),auth[_0xf126('0xb')](),controller[_0xf126('0x13')]);router[_0xf126('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf126('0x14')](_0xf126('0x10'),auth['isAuthenticated'](),controller[_0xf126('0x15')]);router['post'](_0xf126('0x12'),auth[_0xf126('0xb')](),controller[_0xf126('0x16')]);router[_0xf126('0x17')](_0xf126('0xd'),auth[_0xf126('0xb')](),controller[_0xf126('0x18')]);router[_0xf126('0x19')](_0xf126('0xd'),auth[_0xf126('0xb')](),controller['destroy']);router[_0xf126('0x19')](_0xf126('0x10'),auth[_0xf126('0xb')](),controller[_0xf126('0x1a')]);module[_0xf126('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index e66b440..8f0d6f5 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 _0x6324=['long','ENUM','out','sequelize','exports','BOOLEAN','INTEGER','star','TEXT','DATE','STRING'];(function(_0x177fb5,_0x3962f9){var _0x1b8128=function(_0x5514ff){while(--_0x5514ff){_0x177fb5['push'](_0x177fb5['shift']());}};_0x1b8128(++_0x3962f9);}(_0x6324,0x142));var _0x4632=function(_0x255c48,_0x2a4449){_0x255c48=_0x255c48-0x0;var _0xaebda3=_0x6324[_0x255c48];return _0xaebda3;};'use strict';var Sequelize=require(_0x4632('0x0'));module[_0x4632('0x1')]={'closed':{'type':Sequelize[_0x4632('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x4632('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x4632('0x4'),'thumb'),'defaultValue':_0x4632('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x4632('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x4632('0x6')]},'disposition':{'type':Sequelize[_0x4632('0x7')]},'secondDisposition':{'type':Sequelize[_0x4632('0x7')]},'thirdDisposition':{'type':Sequelize[_0x4632('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x4632('0x7')]},'browserVersion':{'type':Sequelize[_0x4632('0x7')]},'osName':{'type':Sequelize[_0x4632('0x7')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x4632('0x7')]},'deviceVendor':{'type':Sequelize[_0x4632('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x4632('0x7')]},'formData':{'type':Sequelize[_0x4632('0x5')](_0x4632('0x8'))},'read1stAt':{'type':Sequelize[_0x4632('0x6')]},'lastMsgAt':{'type':Sequelize[_0x4632('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x4632('0x9')]('in',_0x4632('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x4632('0x7')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0x4632('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7fce=['sequelize','exports','BOOLEAN','ENUM','thumb','TEXT','STRING','long','DATE','out'];(function(_0x1e5011,_0x45db5b){var _0x25f503=function(_0x1b42cf){while(--_0x1b42cf){_0x1e5011['push'](_0x1e5011['shift']());}};_0x25f503(++_0x45db5b);}(_0x7fce,0xdc));var _0xe7fc=function(_0x4fdb7a,_0x602dc6){_0x4fdb7a=_0x4fdb7a-0x0;var _0x4d49f8=_0x7fce[_0x4fdb7a];return _0x4d49f8;};'use strict';var Sequelize=require(_0xe7fc('0x0'));module[_0xe7fc('0x1')]={'closed':{'type':Sequelize[_0xe7fc('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xe7fc('0x3')]('star',_0xe7fc('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xe7fc('0x5')]},'pathTranscript':{'type':Sequelize[_0xe7fc('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe7fc('0x6')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe7fc('0x6')]},'note':{'type':Sequelize[_0xe7fc('0x6')]},'browserName':{'type':Sequelize[_0xe7fc('0x6')]},'browserVersion':{'type':Sequelize[_0xe7fc('0x6')]},'osName':{'type':Sequelize[_0xe7fc('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xe7fc('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xe7fc('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xe7fc('0x6')]},'formData':{'type':Sequelize[_0xe7fc('0x5')](_0xe7fc('0x7'))},'read1stAt':{'type':Sequelize[_0xe7fc('0x8')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe7fc('0x3')]('in',_0xe7fc('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xe7fc('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 0cad000..eed2bf7 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 _0xea28=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','destroy','sendStatus','stack','name','merge','contact','agent','interaction','account','Users','map','TagIds','Tags','split','forEach','index','ChatInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','u.id','ui.ChatInteractionId','from','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','search','parseSearch','conditions','find','unreadMessages','having','`\x20=\x200','Contact','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','compact','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','params','includeAll','options','create','body','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','now','pathTranscript','%s%d','agentAlias','System','customer','format','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','fullname','[%s]\x20%s:\x20%s\x0a','direction','appendFileSync','MailServerOut','Smtp','service','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','include','findAll','rows','getMyMessages','secret','includeAgent','addTags','setTags','spread','emit','removeTags','files','attachments','transcript-%d-%s.zip','firstName','lastName','Messages','read','Account','Chat','Owner','YYYY-MM-DD\x20HH:mm:ss','browserName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.ejs','transcript-','log','unlinkSync','eml-format','rimraf','zip-dir'];(function(_0x57192c,_0x15496a){var _0x3d9932=function(_0x101291){while(--_0x101291){_0x57192c['push'](_0x57192c['shift']());}};_0x3d9932(++_0x15496a);}(_0xea28,0x13a));var _0x8ea2=function(_0x152f32,_0x2243d8){_0x152f32=_0x152f32-0x0;var _0x45d400=_0xea28[_0x152f32];return _0x45d400;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0x8ea2('0x16'));var logger=require(_0x8ea2('0x17'))(_0x8ea2('0x18'));var utils=require('../../config/utils');var config=require(_0x8ea2('0x19'));var licenseUtil=require(_0x8ea2('0x1a'));var db=require(_0x8ea2('0x1b'))['db'];config[_0x8ea2('0x1c')]=_[_0x8ea2('0x1d')](config['redis'],{'host':_0x8ea2('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8ea2('0x1f'))[_0x8ea2('0x20')](socket);var jayson=require(_0x8ea2('0x21'));var client=jayson[_0x8ea2('0x22')][_0x8ea2('0x23')]({'port':0x232b});var client9004=jayson[_0x8ea2('0x22')][_0x8ea2('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x11f5e8,_0x474873,_0x396aab,_0x2dfa7c){return new BPromise(function(_0x1c1715,_0x3bc774){var _0xaa8abf=_0x2dfa7c||client;return _0xaa8abf[_0x8ea2('0x24')](_0x11f5e8,_0x396aab)[_0x8ea2('0x25')](function(_0x467045){logger[_0x8ea2('0x26')](_0x8ea2('0x27'),_0x474873,_0x8ea2('0x28'));logger[_0x8ea2('0x29')](_0x8ea2('0x2a'),_0x474873,'request\x20sent',JSON['stringify'](_0x467045));if(_0x467045[_0x8ea2('0x2b')]){if(_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2c')]===0x1f4){logger['error'](_0x8ea2('0x27'),_0x474873,_0x467045[_0x8ea2('0x2b')]['message']);return _0x3bc774(_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2d')]);}logger[_0x8ea2('0x2b')](_0x8ea2('0x27'),_0x474873,_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2d')]);return _0x1c1715(_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2d')]);}else{logger[_0x8ea2('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x474873,_0x8ea2('0x28'));_0x1c1715(_0x467045['result'][_0x8ea2('0x2d')]);}})[_0x8ea2('0x2e')](function(_0x29b38f){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x474873,_0x29b38f);_0x3bc774(_0x29b38f);});});}function respondWithStatusCode(_0x2e4da3,_0x4dc7bf){_0x4dc7bf=_0x4dc7bf||0xcc;return function(_0x200a49){if(_0x200a49){return _0x2e4da3['sendStatus'](_0x4dc7bf);}return _0x2e4da3[_0x8ea2('0x2f')](_0x4dc7bf)[_0x8ea2('0x30')]();};}function respondWithResult(_0x21c526,_0x266db8){_0x266db8=_0x266db8||0xc8;return function(_0x4e1b90){if(_0x4e1b90){return _0x21c526['status'](_0x266db8)[_0x8ea2('0x31')](_0x4e1b90);}};}function respondWithFilteredResult(_0x4da5b3,_0x4a9875){return function(_0x287078){if(_0x287078){var _0x24f187=typeof _0x4a9875[_0x8ea2('0x32')]===_0x8ea2('0x33')&&typeof _0x4a9875[_0x8ea2('0x34')]===_0x8ea2('0x33');var _0x316707=_0x287078[_0x8ea2('0x35')];var _0x9c5fac=_0x24f187?0x0:_0x4a9875['offset'];var _0x5b7ff9=_0x24f187?_0x287078[_0x8ea2('0x35')]:_0x4a9875[_0x8ea2('0x32')]+_0x4a9875['limit'];var _0x4a110f;if(_0x5b7ff9>=_0x316707){_0x5b7ff9=_0x316707;_0x4a110f=0xc8;}else{_0x4a110f=0xce;}_0x4da5b3[_0x8ea2('0x2f')](_0x4a110f);return _0x4da5b3['set'](_0x8ea2('0x36'),_0x9c5fac+'-'+_0x5b7ff9+'/'+_0x316707)[_0x8ea2('0x31')](_0x287078);}return null;};}function patchUpdates(_0x53fd06){return function(_0x17b21c){try{jsonpatch[_0x8ea2('0x37')](_0x17b21c,_0x53fd06,!![]);}catch(_0x33abc8){return BPromise['reject'](_0x33abc8);}return _0x17b21c['save']();};}function saveUpdates(_0x49a252,_0x3880c3){return function(_0x233e12){if(_0x233e12){return _0x233e12[_0x8ea2('0x38')](_0x49a252)['then'](function(_0x456487){return _0x456487;});}return null;};}function removeEntity(_0x391b08,_0x3d5bf0){return function(_0x278e5d){if(_0x278e5d){return _0x278e5d[_0x8ea2('0x39')]()[_0x8ea2('0x25')](function(){_0x391b08[_0x8ea2('0x2f')](0xcc)[_0x8ea2('0x30')]();});}};}function handleEntityNotFound(_0x5e9b1f,_0x955ef3){return function(_0x29e3f5){if(!_0x29e3f5){_0x5e9b1f[_0x8ea2('0x3a')](0x194);}return _0x29e3f5;};}function handleError(_0x467d97,_0x4eebc1){_0x4eebc1=_0x4eebc1||0x1f4;return function(_0x2a1f14){logger['error'](_0x2a1f14[_0x8ea2('0x3b')]);if(_0x2a1f14[_0x8ea2('0x3c')]){delete _0x2a1f14[_0x8ea2('0x3c')];}_0x467d97[_0x8ea2('0x2f')](_0x4eebc1)['send'](_0x2a1f14);};}function getMustacheRender(_0x2bed24,_0x531979){return Mustache['render'](_0x2bed24,_[_0x8ea2('0x3d')](_0x531979['body'],{'contact':_0x531979[_0x8ea2('0x3e')],'message':_0x531979[_0x8ea2('0x2d')],'agent':_0x531979[_0x8ea2('0x3f')],'interaction':_0x531979[_0x8ea2('0x40')],'account':_0x531979[_0x8ea2('0x41')]}))||'';}function getInteractionUsers(_0x4ae536,_0x84685d){return new BPromise(function(_0x5c5d2d,_0x12a6c2){try{if(_0x84685d[_0x4ae536['id']]){_0x4ae536[_0x8ea2('0x42')]=_[_0x8ea2('0x43')](_0x84685d[_0x4ae536['id']],function(_0x3995ff){return{'id':_0x3995ff['id'],'fullname':_0x3995ff['fullname']};});}}catch(_0x44e8bc){_0x12a6c2(_0x44e8bc);}_0x5c5d2d(_0x4ae536);});}function getInteractionTags(_0x57a6b8,_0x3f0c78){return new BPromise(function(_0x5ba351,_0x2ee78b){try{if(_0x57a6b8[_0x8ea2('0x44')]){_0x57a6b8[_0x8ea2('0x45')]=[];_0x57a6b8[_0x8ea2('0x44')][_0x8ea2('0x46')](',')[_0x8ea2('0x47')](function(_0x2f4fa8){_0x57a6b8['Tags']['push'](_0x3f0c78[_0x2f4fa8]);});}delete _0x57a6b8[_0x8ea2('0x44')];}catch(_0x53455a){_0x2ee78b(_0x53455a);}_0x5ba351(_0x57a6b8);});}function updateChatInteraction(_0x4b03fa,_0x59e2fa,_0x3cbc09){return new BPromise(function(_0x5d9ba0,_0x40a532){return getInteractionUsers(_0x4b03fa,_0x3cbc09)[_0x8ea2('0x25')](function(_0x39c944){return getInteractionTags(_0x39c944,_0x59e2fa);})[_0x8ea2('0x25')](function(_0x989d9b){_0x5d9ba0(_0x989d9b);})[_0x8ea2('0x2e')](function(_0x3b2219){_0x40a532(_0x3b2219);});});}exports[_0x8ea2('0x48')]=function(_0x5352b9,_0x3afb80){var _0x1ef615={},_0x1db25c={},_0x5cb6ad={'count':0x0,'rows':[]};var _0x2d6bbb=_[_0x8ea2('0x43')](db[_0x8ea2('0x49')][_0x8ea2('0x4a')],function(_0x20992d){return{'name':_0x20992d['fieldName'],'type':_0x20992d[_0x8ea2('0x4b')][_0x8ea2('0x4c')]};});_0x1db25c[_0x8ea2('0x4d')]=_['map'](_0x2d6bbb,_0x8ea2('0x3c'));_0x1db25c[_0x8ea2('0x4e')]=_[_0x8ea2('0x4f')](_0x5352b9[_0x8ea2('0x4e')]);_0x1db25c[_0x8ea2('0x50')]=_[_0x8ea2('0x51')](_0x1db25c[_0x8ea2('0x4d')],_0x1db25c[_0x8ea2('0x4e')]);_0x1ef615[_0x8ea2('0x52')]=_[_0x8ea2('0x51')](_0x1db25c[_0x8ea2('0x4d')],qs[_0x8ea2('0x53')](_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x53')]));_0x1ef615['attributes']=_0x1ef615[_0x8ea2('0x52')][_0x8ea2('0x54')]?_0x1ef615[_0x8ea2('0x52')]:_0x1db25c[_0x8ea2('0x4d')];if(!_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x55')](_0x8ea2('0x56'))){_0x1ef615[_0x8ea2('0x34')]=qs['limit'](_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x34')]);_0x1ef615[_0x8ea2('0x32')]=qs['offset'](_0x5352b9['query'][_0x8ea2('0x32')]);}_0x1ef615[_0x8ea2('0x57')]=qs[_0x8ea2('0x58')](_0x5352b9['query'][_0x8ea2('0x58')]);_0x1ef615[_0x8ea2('0x59')]=qs[_0x8ea2('0x50')](_[_0x8ea2('0x5a')](_0x5352b9[_0x8ea2('0x4e')],_0x1db25c['filters']),_0x2d6bbb);var _0x4afd85=[];var _0x24a22a=squel[_0x8ea2('0x5b')]()[_0x8ea2('0x5c')]('id')['field'](_0x8ea2('0x3c'))[_0x8ea2('0x5c')](_0x8ea2('0x5d'))['from']('tools_tags');var _0x48aebf=squel['select']()['field'](_0x8ea2('0x5e'))[_0x8ea2('0x5c')]('u.fullname')['field'](_0x8ea2('0x5f'))[_0x8ea2('0x60')](_0x8ea2('0x61'),'ui')['left_join'](_0x8ea2('0x62'),'u',_0x8ea2('0x63'));var _0x59e3df=squel[_0x8ea2('0x5b')]()[_0x8ea2('0x60')](_0x8ea2('0x64'),'i')[_0x8ea2('0x65')](_0x8ea2('0x66'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0x8ea2('0x67'))[_0x8ea2('0x65')](_0x8ea2('0x68'),'a',_0x8ea2('0x69'))[_0x8ea2('0x65')](_0x8ea2('0x6a'),'me',_0x8ea2('0x6b'))['left_join']('chat_interaction_has_tags','it','it.ChatInteractionId\x20=\x20i.id')[_0x8ea2('0x65')](_0x8ea2('0x6c'),'t',_0x8ea2('0x6d'));var _0x2bbec0=squel['expr']();var _0x11824e=[];var _0x2b8662=squel['expr']();var _0x21485a;if(_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x6e')]){_0x21485a=as[_0x8ea2('0x6f')](_0x5352b9[_0x8ea2('0x4e')]['search']);var _0x479c05=_0x21485a['sqlOperator'];for(var _0x53a62c=0x0;_0x53a62c<_0x21485a[_0x8ea2('0x70')][_0x8ea2('0x54')];_0x53a62c++){var _0x2d8221=_0x21485a[_0x8ea2('0x70')][_0x53a62c];var _0x491d3d='i';var _0x461d32=_[_0x8ea2('0x71')](_0x2d6bbb,[_0x8ea2('0x3c'),_0x2d8221[_0x8ea2('0x5c')]]);if(!_0x461d32){switch(_0x2d8221['field']){case _0x8ea2('0x72'):if(_0x2d8221['value']==0x1){_0x59e3df[_0x8ea2('0x73')]('`'+_0x2d8221['field']+_0x8ea2('0x74'));}else{_0x59e3df[_0x8ea2('0x73')]('`'+_0x2d8221['field']+'`\x20>\x200');}break;case _0x8ea2('0x75'):if(_0x2d8221['operator']===_0x8ea2('0x76')){if(_0x2d8221[_0x8ea2('0x77')][_0x8ea2('0x46')]('\x20')[_0x8ea2('0x54')]>0x1){_0x2bbec0[_0x479c05]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8ea2('0x78')](_0x2d8221[_0x8ea2('0x77')]),null);}else{var _0x39776d='%'+_0x2d8221[_0x8ea2('0x77')]+'%';_0x2bbec0[_0x479c05](_0x8ea2('0x79'),_0x39776d,_0x39776d,_0x39776d);}}else{_0x461d32=_[_0x8ea2('0x71')](_0x2d6bbb,[_0x8ea2('0x3c'),_0x8ea2('0x7a')]);_0x2d8221[_0x8ea2('0x5c')]=_0x8ea2('0x7a');_0x3d55db=as[_0x8ea2('0x7b')](_0x491d3d,_0x461d32[_0x8ea2('0x4b')],_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db['text'],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x7c')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x30')]);}break;case _0x8ea2('0x7d'):var _0x219f78=_0x2d8221[_0x8ea2('0x77')][_0x8ea2('0x46')](',')[_0x8ea2('0x43')](function(_0xefb7b){return Number(_0xefb7b);});_0x219f78[_0x8ea2('0x47')](function(_0x35cfc5){_0x2b8662['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x35cfc5+',%');});_0x11824e=_[_0x8ea2('0x7e')](_0x11824e,_0x219f78);break;case _0x8ea2('0x7f'):if(_0x2d8221[_0x8ea2('0x80')]===_0x8ea2('0x76')){_0x2bbec0[_0x479c05](_0x8ea2('0x81'),'%'+_0x2d8221['value']+'%',null);}else{_0x461d32=_['find'](_0x2d6bbb,['name',_0x8ea2('0x82')]);_0x2d8221[_0x8ea2('0x5c')]=_0x8ea2('0x82');_0x3d55db=as[_0x8ea2('0x7b')](_0x491d3d,_0x461d32[_0x8ea2('0x4b')],_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db[_0x8ea2('0x83')],_0x3d55db['value'][_0x8ea2('0x7c')],_0x3d55db[_0x8ea2('0x77')]['end']);}break;case'body':_0x3d55db=as[_0x8ea2('0x7b')]('me',null,_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db[_0x8ea2('0x83')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x7c')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x30')]);break;}}else{var _0x3d55db=as['buildExpression'](_0x491d3d,_0x461d32[_0x8ea2('0x4b')],_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db[_0x8ea2('0x83')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x7c')],_0x3d55db['value'][_0x8ea2('0x30')]);}}}else{var _0x356099=_(_0x5352b9[_0x8ea2('0x4e')])['keys']()[_0x8ea2('0x43')](function(_0x5c2d05){return _['some'](_0x2d6bbb,[_0x8ea2('0x3c'),_0x5c2d05])?_0x5c2d05:undefined;})[_0x8ea2('0x84')]()['value']();if(!_['isEmpty'](_0x356099)){_0x356099['forEach'](function(_0x167f15){if(_0x167f15==='ChatWebsiteId'){_0x59e3df['where'](_0x8ea2('0x85'),[][_0x8ea2('0x86')](_0x5352b9[_0x8ea2('0x4e')][_0x167f15]));}else if(_0x167f15===_0x8ea2('0x87')){var _0x1681d8=JSON[_0x8ea2('0x88')](_0x5352b9[_0x8ea2('0x4e')][_0x167f15])[_0x8ea2('0x89')];var _0x14a5de=JSON[_0x8ea2('0x88')](_0x5352b9[_0x8ea2('0x4e')][_0x167f15])[_0x8ea2('0x8a')];_0x59e3df[_0x8ea2('0x59')](_0x8ea2('0x8b'),_0x1681d8,_0x14a5de);}else{if(_0x5352b9['query'][_0x167f15]===_0x8ea2('0x8c')){_0x59e3df[_0x8ea2('0x59')]('i.'+_0x167f15+_0x8ea2('0x8d'));}else{_0x59e3df['where']('i.'+_0x167f15+_0x8ea2('0x8e'),_0x5352b9['query'][_0x167f15]);}}});}if(_0x5352b9[_0x8ea2('0x4e')]['read']){if(_0x5352b9[_0x8ea2('0x4e')]['read']==0x1){_0x59e3df[_0x8ea2('0x73')](_0x8ea2('0x8f'));}else{_0x59e3df['having'](_0x8ea2('0x90'));}}if(_0x5352b9['query'][_0x8ea2('0x91')]){_0x11824e=_[_0x8ea2('0x92')](_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x91')])?_0x5352b9[_0x8ea2('0x4e')]['tag']:new Array(_0x5352b9['query'][_0x8ea2('0x91')]);_0x11824e['forEach'](function(_0x410f78){_0x2b8662['or'](_0x8ea2('0x93'),'%,'+_0x410f78+',%');});}if(_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x94')]){var _0x262cef=_0x5352b9[_0x8ea2('0x4e')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x8ea2('0x95')](_0x262cef)){_0x2bbec0['or']('i.id\x20LIKE\x20?',_0x262cef+'%');}else{_0x2bbec0['or'](_0x8ea2('0x96'),qs[_0x8ea2('0x78')](_0x262cef))['or'](_0x8ea2('0x97'),_0x262cef+'%');}}}_0x59e3df[_0x8ea2('0x59')](_0x2bbec0);_0x59e3df[_0x8ea2('0x98')](_0x8ea2('0x99'));var _0x4b4d64={'type':db[_0x8ea2('0x9a')][_0x8ea2('0x9b')][_0x8ea2('0x9c')],'raw':!![]};var _0x335a96=_0x59e3df[_0x8ea2('0x9d')]();_0x335a96['field']('i.id');_0x335a96[_0x8ea2('0x5c')](_0x8ea2('0x9e'),_0x8ea2('0x72'));if(_0x1ef615[_0x8ea2('0x57')]){_0x1ef615[_0x8ea2('0x57')][_0x8ea2('0x47')](function(_0x2e0bbe){var _0x9c4960=_0x2e0bbe[0x0]===_0x8ea2('0x9f')?_0x2e0bbe[0x0]:'i.'+_0x2e0bbe[0x0];_0x59e3df[_0x8ea2('0x57')](_0x9c4960,_0x2e0bbe[0x1]===_0x8ea2('0xa0')?![]:!![]);});}if(!_[_0x8ea2('0xa1')](_0x11824e)){_0x59e3df[_0x8ea2('0x73')](_0x2b8662);_0x335a96[_0x8ea2('0x59')](_0x8ea2('0xa2'),_0x11824e);}BPromise[_0x8ea2('0xa3')]()[_0x8ea2('0x25')](function(){if(!_0x21485a){if(_0x5352b9['query']['ChatWebsiteId'])return;_0x335a96[_0x8ea2('0x59')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x59e3df[_0x8ea2('0x59')](_0x8ea2('0xa4'));return;}if(_0x5352b9['user'][_0x8ea2('0xa5')]!=='agent')return;return _0x5352b9[_0x8ea2('0xa6')][_0x8ea2('0xa7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x17dee8){if(_[_0x8ea2('0xa1')](_0x17dee8)){_0x335a96[_0x8ea2('0x59')](_0x8ea2('0xa8'));_0x59e3df[_0x8ea2('0x59')](_0x8ea2('0xa8'));}else{_0x335a96[_0x8ea2('0x59')](_0x8ea2('0x85'),_[_0x8ea2('0x43')](_0x17dee8,'id'));_0x59e3df[_0x8ea2('0x59')]('i.ChatWebsiteId\x20IN\x20?',_[_0x8ea2('0x43')](_0x17dee8,'id'));}});})[_0x8ea2('0x25')](function(){if(_0x5352b9['user'][_0x8ea2('0xa5')]==='agent'&&!_0x21485a&&!_0x5352b9['query']['ChatWebsiteId'])return[];return db[_0x8ea2('0xa9')]['query'](_0x335a96[_0x8ea2('0xaa')](),_0x4b4d64);})[_0x8ea2('0x25')](function(_0x12ed20){_0x5cb6ad[_0x8ea2('0x35')]=_0x12ed20[_0x8ea2('0x54')];if(_0x5cb6ad[_0x8ea2('0x35')]===0x0)return[];return db['sequelize'][_0x8ea2('0x4e')](_0x24a22a['toString'](),_0x4b4d64)[_0x8ea2('0x25')](function(_0x18aa81){_0x4afd85=_[_0x8ea2('0xab')](_0x18aa81,'id');_0x4b4d64=_[_0x8ea2('0x3d')](_0x4b4d64,{'model':db[_0x8ea2('0x49')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5352b9['query'][_0x8ea2('0x53')]){_0x1ef615[_0x8ea2('0x52')][_0x8ea2('0x47')](function(_0x2a82b2){_0x59e3df[_0x8ea2('0x5c')]('i.'+_0x2a82b2);});}else{_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0x9e'),_0x8ea2('0x72'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xac'),_0x8ea2('0xad'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xae'),_0x8ea2('0xaf'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xb0'),_0x8ea2('0x9f'));_0x59e3df['field'](_0x8ea2('0xb1'));_0x59e3df['field']('c.firstName',_0x8ea2('0xb2'));_0x59e3df[_0x8ea2('0x5c')]('c.lastName',_0x8ea2('0xb3'));_0x59e3df[_0x8ea2('0x5c')]('c.email',_0x8ea2('0xb4'));_0x59e3df[_0x8ea2('0x5c')]('c.phone',_0x8ea2('0xb5'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xb6'),_0x8ea2('0xb7'));_0x59e3df[_0x8ea2('0x5c')]('c.fax',_0x8ea2('0xb8'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xb9'),_0x8ea2('0xba'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xbb'),_0x8ea2('0xbc'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xbd'),'TagIds');}if(_0x1ef615[_0x8ea2('0x34')])_0x59e3df['limit'](_0x1ef615[_0x8ea2('0x34')]);if(_0x1ef615[_0x8ea2('0x32')])_0x59e3df[_0x8ea2('0x32')](_0x1ef615[_0x8ea2('0x32')]);return db[_0x8ea2('0xa9')]['query'](_0x59e3df[_0x8ea2('0xaa')](),_0x4b4d64);})[_0x8ea2('0x25')](function(_0x4fdd16){if(_0x4fdd16['length']>0x0)_0x48aebf[_0x8ea2('0x59')](_0x8ea2('0xbe'),_['map'](_0x4fdd16,'id'));return db['sequelize'][_0x8ea2('0x4e')](_0x48aebf[_0x8ea2('0xaa')](),_0x4b4d64)['then'](function(_0x2b7e80){var _0x2f6673=_[_0x8ea2('0xbf')](_0x2b7e80,_0x8ea2('0xc0'));var _0xdf4de9=[];_0x4fdd16['forEach'](function(_0x2e3a5d){_0xdf4de9[_0x8ea2('0xc1')](updateChatInteraction(_0x2e3a5d,_0x4afd85,_0x2f6673));});return BPromise[_0x8ea2('0xc2')](_0xdf4de9);});});})[_0x8ea2('0x25')](function(_0x412af1){_0x5cb6ad['rows']=_0x412af1;return _0x5cb6ad;})[_0x8ea2('0x25')](respondWithFilteredResult(_0x3afb80,_0x1ef615))['catch'](handleError(_0x3afb80,null));};exports['show']=function(_0x9468be,_0x17e9fc){var _0x5c95ec={'raw':![],'where':{'id':_0x9468be[_0x8ea2('0xc3')]['id']}},_0x239516={};_0x239516[_0x8ea2('0x4d')]=_[_0x8ea2('0x4f')](db[_0x8ea2('0x49')][_0x8ea2('0x4a')]);_0x239516['query']=_[_0x8ea2('0x4f')](_0x9468be[_0x8ea2('0x4e')]);_0x239516[_0x8ea2('0x50')]=_['intersection'](_0x239516[_0x8ea2('0x4d')],_0x239516[_0x8ea2('0x4e')]);_0x5c95ec[_0x8ea2('0x52')]=_[_0x8ea2('0x51')](_0x239516[_0x8ea2('0x4d')],qs['fields'](_0x9468be[_0x8ea2('0x4e')][_0x8ea2('0x53')]));_0x5c95ec[_0x8ea2('0x52')]=_0x5c95ec[_0x8ea2('0x52')]['length']?_0x5c95ec['attributes']:_0x239516[_0x8ea2('0x4d')];if(_0x9468be['query'][_0x8ea2('0xc4')]){_0x5c95ec['include']=[{'all':!![]}];}_0x5c95ec=_[_0x8ea2('0x3d')]({},_0x5c95ec,_0x9468be[_0x8ea2('0xc5')]);return db[_0x8ea2('0x49')][_0x8ea2('0x71')](_0x5c95ec)[_0x8ea2('0x25')](handleEntityNotFound(_0x17e9fc,null))[_0x8ea2('0x25')](respondWithResult(_0x17e9fc,null))[_0x8ea2('0x2e')](handleError(_0x17e9fc,null));};exports['create']=function(_0x2c5677,_0x224fca){return db[_0x8ea2('0x49')][_0x8ea2('0xc6')](_0x2c5677[_0x8ea2('0xc7')],{})[_0x8ea2('0x25')](respondWithResult(_0x224fca,0xc9))['catch'](handleError(_0x224fca,null));};exports[_0x8ea2('0x38')]=function(_0x463372,_0x76085){if(_0x463372[_0x8ea2('0xc7')]['id']){delete _0x463372['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x463372[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x76085,null))[_0x8ea2('0x25')](saveUpdates(_0x463372['body'],null))[_0x8ea2('0x25')](respondWithResult(_0x76085,null))[_0x8ea2('0x2e')](handleError(_0x76085,null));};exports[_0x8ea2('0x39')]=function(_0x500b47,_0x331019){return db[_0x8ea2('0x49')]['find']({'where':{'id':_0x500b47[_0x8ea2('0xc3')]['id']}})['then'](handleEntityNotFound(_0x331019,null))['then'](removeEntity(_0x331019,null))[_0x8ea2('0x2e')](handleError(_0x331019,null));};exports[_0x8ea2('0xc8')]=function(_0x405020,_0x5c9359){return db[_0x8ea2('0x49')][_0x8ea2('0xc8')]()[_0x8ea2('0x25')](respondWithResult(_0x5c9359,null))[_0x8ea2('0x2e')](handleError(_0x5c9359,null));};exports[_0x8ea2('0xc9')]=function(_0x11c59e,_0x11b02a){var _0x5ab2c4=_0x11c59e[_0x8ea2('0xc3')]['id'];var _0x111f97;var _0xf76d70;var _0x384500;return db[_0x8ea2('0x49')][_0x8ea2('0xca')]({'where':{'id':_0x5ab2c4}})[_0x8ea2('0x25')](function(_0x568581){_0x111f97=_0x568581;return db[_0x8ea2('0xcb')][_0x8ea2('0xca')]({'where':{'id':_0x568581[_0x8ea2('0xcc')]},'attributes':['id',_0x8ea2('0xcd'),_0x8ea2('0xce'),'vidaooTopic',_0x8ea2('0xcf'),_0x8ea2('0xd0')],'raw':!![]});})[_0x8ea2('0x25')](function(_0x1c336e){if(_0x1c336e&&_0x1c336e[_0x8ea2('0xcd')]&&_0x1c336e[_0x8ea2('0xce')]){_0xf76d70=_0x1c336e;var _0x473ae2={'interaction':{'id':_0x5ab2c4},'agent':{'id':_0x11c59e[_0x8ea2('0xa6')]['id'],'name':_0x11c59e[_0x8ea2('0xa6')]['name'],'fullname':_0x11c59e['user']['fullname'],'email':_0x11c59e[_0x8ea2('0xa6')]['email']},'contact':_0x11c59e[_0x8ea2('0xc7')][_0x8ea2('0x3e')],'account':_0x11c59e[_0x8ea2('0xc7')][_0x8ea2('0x41')]};var _0x6c0ccc={'rejectUnauthorized':![],'method':_0x8ea2('0xd1'),'url':_0x8ea2('0xd2'),'headers':{'X-APIKEY':_0x1c336e[_0x8ea2('0xcd')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x11c59e[_0x8ea2('0xa6')][_0x8ea2('0xd3')]],'buttons':null,'topic':_0xf76d70['vidaooTopic'],'note':_[_0x8ea2('0xd4')](_0xf76d70[_0x8ea2('0xcf')])?null:getMustacheRender(_0xf76d70[_0x8ea2('0xcf')],_0x473ae2),'metadata':null},'redirect':_0x8ea2('0xd5'),'json':!![]};try{if(!_[_0x8ea2('0xd4')](_0xf76d70[_0x8ea2('0xd0')])){var _0xc6888c=getMustacheRender(_0xf76d70[_0x8ea2('0xd0')],_0x473ae2);var _0x152d46=JSON[_0x8ea2('0x88')](_0xc6888c);_0x6c0ccc[_0x8ea2('0xc7')][_0x8ea2('0xd6')]=_0x152d46;}}catch(_0x465e7f){throw new db[(_0x8ea2('0x9a'))][(_0x8ea2('0xd7'))](_0x8ea2('0xd8'));}return rp(_0x6c0ccc);}else{throw new db[(_0x8ea2('0x9a'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x4b2c0f){_0x384500=_0x4b2c0f;if(_0x384500['id']){var _0x2fcddc={'body':_0x384500[_0x8ea2('0xd9')],'ChatWebsiteId':_0xf76d70['id'],'ChatInteractionId':_0x111f97['id'],'direction':'out','UserId':_0x11c59e[_0x8ea2('0xa6')]['id']};return db[_0x8ea2('0xda')][_0x8ea2('0xc6')](_0x2fcddc,{});}else{throw new db[(_0x8ea2('0x9a'))]['ValidationError'](_0x8ea2('0xdb'));}})['then'](function(){return _0x111f97[_0x8ea2('0xdc')]({'vidaooSessionId':_0x384500['id']});})[_0x8ea2('0x25')](respondWithResult(_0x11b02a,null))[_0x8ea2('0x2e')](handleError(_0x11b02a,null));};exports[_0x8ea2('0xdd')]=function(_0x3b6b03,_0x3292bc){if(_0x3b6b03['body']['id']){delete _0x3b6b03['body']['id'];}return db[_0x8ea2('0x49')][_0x8ea2('0x71')]({'where':{'id':_0x3b6b03['params']['id']},'include':[{'model':db[_0x8ea2('0xde')],'as':'Contact'}]})[_0x8ea2('0x25')](handleEntityNotFound(_0x3292bc,null))[_0x8ea2('0x25')](saveUpdates(_0x3b6b03[_0x8ea2('0xc7')],null))[_0x8ea2('0x25')](respondWithResult(_0x3292bc,null))[_0x8ea2('0x2e')](handleError(_0x3292bc,null));};exports[_0x8ea2('0xdf')]=function(_0x1383b4,_0x4c1b9d,_0x3f3822){if(_0x1383b4[_0x8ea2('0xc7')]['id']){delete _0x1383b4[_0x8ea2('0xc7')]['id'];}return db[_0x8ea2('0x49')][_0x8ea2('0x71')]({'where':{'id':_0x1383b4[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](function(_0x1c974d){if(!_0x1c974d){logger[_0x8ea2('0x2b')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x8ea2('0xdf'),0x194,_0x8ea2('0xe0'));_0x4c1b9d[_0x8ea2('0x3a')](0x194);}else{if(_0x1c974d['UserId']){throw new db[(_0x8ea2('0x9a'))][(_0x8ea2('0xd7'))](_0x8ea2('0xe1'));}}return _0x1c974d;})[_0x8ea2('0x25')](function(_0xe18090){if(_0xe18090){return _0xe18090[_0x8ea2('0x38')]({'closed':_0x1383b4['body']['closed'],'disposition':_0x1383b4[_0x8ea2('0xc7')][_0x8ea2('0xe2')]})[_0x8ea2('0x25')](function(_0x695f4a){return _0x695f4a;});}})[_0x8ea2('0x25')](function(_0x57ff72){return respondWithRpcPromise(_0x8ea2('0xe3'),'abandon',_0x1383b4[_0x8ea2('0xc7')],client9004);})[_0x8ea2('0x25')](respondWithResult(_0x4c1b9d,null))['catch'](handleError(_0x4c1b9d,null));};exports[_0x8ea2('0xe4')]=function(_0x254b51,_0x2c11d2,_0x2aaa88){_0x254b51[_0x8ea2('0xc7')][_0x8ea2('0x3c')]=_0x254b51[_0x8ea2('0xe5')][_0x8ea2('0xe6')];_0x254b51[_0x8ea2('0xc7')][_0x8ea2('0xe7')]=_0x254b51['file'][_0x8ea2('0xe8')];_0x254b51[_0x8ea2('0xc7')][_0x8ea2('0x4b')]=_0x254b51['file'][_0x8ea2('0xe9')];return db['Attachment'][_0x8ea2('0xc6')](_0x254b51[_0x8ea2('0xc7')])[_0x8ea2('0x25')](respondWithResult(_0x2c11d2,0xc9))[_0x8ea2('0x2e')](handleError(_0x2c11d2,null));};exports[_0x8ea2('0xea')]=function(_0x1786ac,_0x7a45a8,_0x3a68e2){return db[_0x8ea2('0x49')]['findOne']({'where':{'id':_0x1786ac[_0x8ea2('0xc3')]['id']},'raw':!![]})[_0x8ea2('0x25')](handleEntityNotFound(_0x7a45a8,null))[_0x8ea2('0x25')](function(_0x8d4abd){if(_0x8d4abd){if(_0x8d4abd[_0x8ea2('0xeb')]){return _0x7a45a8[_0x8ea2('0x2f')](0x193)[_0x8ea2('0x31')]({'status':0x193,'message':_0x8ea2('0xec')});}return db[_0x8ea2('0xed')]['findOne']({'where':{'id':_0x1786ac[_0x8ea2('0x4e')][_0x8ea2('0xee')]},'raw':!![]})[_0x8ea2('0x25')](handleEntityNotFound(_0x7a45a8,null));}})[_0x8ea2('0x25')](function(_0xcbb6b3){if(_0xcbb6b3){var _0x4bdbe0=_0xcbb6b3[_0x8ea2('0xef')]!==null;var _0x44791f=path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],_0x8ea2('0xf2'));if(_0x4bdbe0){_0x44791f=path['join'](_0x44791f,_0x8ea2('0xf3'));}var _0x4e7aff=path[_0x8ea2('0xf0')](_0x44791f,_0xcbb6b3[_0x8ea2('0xe7')]);return _0x7a45a8[_0x8ea2('0xf4')](_0x4e7aff);}})['catch'](handleError(_0x7a45a8,null));};exports[_0x8ea2('0xf5')]=function(_0x48a2e2,_0x4e804c){var _0x487bab=null;var _0x1a0966=null;var _0x50087b=null;var _0x196b89=null;if(_0x48a2e2[_0x8ea2('0xc7')]['id']){delete _0x48a2e2[_0x8ea2('0xc7')]['id'];}if(_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xf6')]){_0x196b89=path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],_0x8ea2('0xf7'),util['format']('transcript-%s.txt',Date[_0x8ea2('0xf8')]()));_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xf9')]=_0x196b89;}return db['ChatInteraction']['find']({'where':{'id':_0x48a2e2['params']['id']},'include':[{'model':db[_0x8ea2('0xda')],'as':'Messages','include':[{'model':db['User'],'as':_0x8ea2('0x7f')}]}]})[_0x8ea2('0x25')](handleEntityNotFound(_0x4e804c,null))['then'](saveUpdates(_0x48a2e2['body'],null))[_0x8ea2('0x25')](function(_0x48eac8){if(_0x48eac8){_0x487bab=_0x48eac8;return db['ChatWebsite'][_0x8ea2('0x71')]({'where':{'id':_0x487bab[_0x8ea2('0xcc')]}});}})[_0x8ea2('0x25')](function(_0x54da21){if(_0x54da21){_0x50087b=_0x54da21;return db[_0x8ea2('0xde')][_0x8ea2('0x71')]({'where':{'id':_0x487bab[_0x8ea2('0x7a')]}});}})[_0x8ea2('0x25')](function(_0x3a43d5){if(_0x3a43d5){_0x1a0966=_0x3a43d5;if(_0x196b89){var _0x535b01=null;for(var _0x22e4cd=0x1;_0x22e4cd<_0x487bab['Messages'][_0x8ea2('0x54')];++_0x22e4cd){_0x535b01=_0x487bab['Messages'][_0x22e4cd];var _0x230a70=_0x535b01['UserId']?util['format'](_0x8ea2('0xfa'),_0x50087b[_0x8ea2('0xfb')],_0x535b01[_0x8ea2('0x82')]):_0x8ea2('0xfc');var _0x332670=_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xfd')]||util[_0x8ea2('0xfe')]('%s%d',_0x8ea2('0xff'),_0x535b01[_0x8ea2('0x7a')]);switch(_0x50087b[_0x8ea2('0x100')]){case _0x8ea2('0x101'):_0x230a70=_0x535b01[_0x8ea2('0x82')]?util['format'](_0x8ea2('0xfa'),_0x50087b['agentAlias'],_0x535b01[_0x8ea2('0x82')]):'System';break;case _0x8ea2('0x102'):_0x230a70=_0x535b01[_0x8ea2('0x82')]?_0x535b01[_0x8ea2('0x7f')][_0x8ea2('0x103')]||_0x535b01['User']['fullname']:'System';break;case _0x8ea2('0x104'):_0x230a70=_0x535b01[_0x8ea2('0x82')]?_0x535b01['User'][_0x8ea2('0x105')]:_0x8ea2('0xfc');break;default:_0x230a70=_0x535b01[_0x8ea2('0x82')]?util[_0x8ea2('0xfe')](_0x8ea2('0xfa'),_0x50087b[_0x8ea2('0xfb')],_0x535b01[_0x8ea2('0x82')]):_0x8ea2('0xfc');}var _0x422280=util[_0x8ea2('0xfe')](_0x8ea2('0x106'),moment(_0x535b01[_0x8ea2('0x87')])[_0x8ea2('0xfe')]('MM/DD/YYYY\x20HH:mm:ss'),_0x535b01[_0x8ea2('0x107')]==='in'?_0x332670:_0x230a70,_0x535b01['body']);if(!_0x535b01['secret']){fs[_0x8ea2('0x108')](_0x196b89,_0x422280);}}return db['MailAccount'][_0x8ea2('0xca')]({'where':{'service':!![]},'include':[{'model':db[_0x8ea2('0x109')],'as':_0x8ea2('0x10a'),'raw':!![]}]});}}})[_0x8ea2('0x25')](function(_0xff0fae){if(_0xff0fae&&_0xff0fae['Smtp']&&_0x48a2e2[_0x8ea2('0xc7')]){var _0x3f5688={'tls':{'rejectUnauthorized':![]}};if(_0xff0fae[_0x8ea2('0x10a')]['service']){_0x3f5688['service']=_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10b')];}else{_0x3f5688['host']=_0xff0fae[_0x8ea2('0x10a')]['host'];_0x3f5688[_0x8ea2('0x10c')]=_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10c')];_0x3f5688[_0x8ea2('0x10d')]=_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10d')];}if(_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10e')]){_0x3f5688[_0x8ea2('0x10f')]={'user':_0xff0fae['Smtp']['user'],'pass':_0xff0fae[_0x8ea2('0x10a')]['pass']};}return respondWithRpcPromise(_0x8ea2('0x110'),_0x8ea2('0x111'),{'account':_0x3f5688,'message':{'from':util[_0x8ea2('0xfe')](_0x8ea2('0x112'),_0xff0fae['name'],_0xff0fae[_0x8ea2('0xd3')]||_0xff0fae[_0x8ea2('0x10a')]['user']),'to':_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xf6')],'subject':_0x8ea2('0x113'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x48a2e2['body'][_0x8ea2('0xf6')]),'attachments':[{'path':_0x196b89}]}})['then'](function(){return _0x487bab;})[_0x8ea2('0x2e')](function(_0x488acb){console[_0x8ea2('0x2b')](_0x488acb);});}else{return _0x487bab;}})[_0x8ea2('0x25')](respondWithStatusCode(_0x4e804c,0xc8))[_0x8ea2('0x2e')](handleError(_0x4e804c,null));};exports[_0x8ea2('0x114')]=function(_0x54925a,_0x295339,_0x55c23c){return db['ChatMessage']['find']({'where':{'id':_0x54925a[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x295339,null))[_0x8ea2('0x25')](function(_0x48b51d){if(_0x48b51d){return _0x48b51d[_0x8ea2('0x114')](_0x54925a[_0x8ea2('0xc7')][_0x8ea2('0x115')],_[_0x8ea2('0x116')](_0x54925a[_0x8ea2('0xc7')],[_0x8ea2('0x115'),'id'])||{});}})[_0x8ea2('0x25')](respondWithResult(_0x295339,null))[_0x8ea2('0x2e')](handleError(_0x295339,null));};exports[_0x8ea2('0x117')]=function(_0x102d70,_0x2b014d,_0xc35654){var _0x355b91={'raw':![],'where':{}};var _0x1cf414={};var _0x48e543={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x8ea2('0xca')]({'where':{'id':_0x102d70['params']['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x2b014d,null))[_0x8ea2('0x25')](function(_0x3ebbc8){if(_0x3ebbc8){_0x1cf414['model']=_[_0x8ea2('0x4f')](db['ChatMessage']['rawAttributes']);_0x1cf414[_0x8ea2('0x4e')]=_[_0x8ea2('0x4f')](_0x102d70[_0x8ea2('0x4e')]);_0x1cf414[_0x8ea2('0x50')]=_[_0x8ea2('0x51')](_0x1cf414[_0x8ea2('0x4d')],_0x1cf414[_0x8ea2('0x4e')]);_0x355b91['attributes']=_[_0x8ea2('0x51')](_0x1cf414[_0x8ea2('0x4d')],qs[_0x8ea2('0x53')](_0x102d70['query'][_0x8ea2('0x53')]));_0x355b91[_0x8ea2('0x52')]=_0x355b91[_0x8ea2('0x52')]['length']?_0x355b91[_0x8ea2('0x52')]:_0x1cf414[_0x8ea2('0x4d')];if(!_0x102d70[_0x8ea2('0x4e')]['hasOwnProperty']('nolimit')){_0x355b91[_0x8ea2('0x34')]=qs['limit'](_0x102d70[_0x8ea2('0x4e')]['limit']);_0x355b91[_0x8ea2('0x32')]=qs[_0x8ea2('0x32')](_0x102d70[_0x8ea2('0x4e')][_0x8ea2('0x32')]);}_0x355b91[_0x8ea2('0x57')]=qs['sort'](_0x102d70[_0x8ea2('0x4e')][_0x8ea2('0x58')]);_0x355b91[_0x8ea2('0x59')]=qs[_0x8ea2('0x50')](_[_0x8ea2('0x5a')](_0x102d70[_0x8ea2('0x4e')],_0x1cf414['filters']));_0x355b91['where'][_0x8ea2('0xc0')]=_0x3ebbc8['id'];if(_0x102d70[_0x8ea2('0x4e')]['filter']){_0x355b91[_0x8ea2('0x59')]=_[_0x8ea2('0x3d')](_0x355b91[_0x8ea2('0x59')],{'$or':_[_0x8ea2('0x43')](_0x355b91['attributes'],function(_0x19ea2b){var _0x4450e8={};_0x4450e8[_0x19ea2b]={'$like':'%'+_0x102d70['query'][_0x8ea2('0x94')]+'%'};return _0x4450e8;})});}if(_0x102d70['query'][_0x8ea2('0x89')]){var _0x479b40=_0x102d70['query'][_0x8ea2('0x89')][_0x8ea2('0x46')](',');var _0xbb5964={};_0xbb5964[_0x479b40[0x0]]={'$gte':moment(_0x479b40[0x1])[_0x8ea2('0xfe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x355b91[_0x8ea2('0x59')]=_[_0x8ea2('0x3d')](_0x355b91[_0x8ea2('0x59')],_0xbb5964);}_0x355b91=_['merge']({},_0x355b91,_0x102d70[_0x8ea2('0xc5')]);return db[_0x8ea2('0xda')][_0x8ea2('0x35')]({'where':_0x355b91[_0x8ea2('0x59')]})[_0x8ea2('0x25')](function(_0x46d38e){_0x48e543[_0x8ea2('0x35')]=_0x46d38e;if(_0x102d70['query'][_0x8ea2('0xc4')]){_0x355b91[_0x8ea2('0x118')]=[{'all':!![]}];}return db[_0x8ea2('0xda')][_0x8ea2('0x119')](_0x355b91);})[_0x8ea2('0x25')](function(_0x23f247){_0x48e543[_0x8ea2('0x11a')]=_0x23f247;return _0x48e543;});}})[_0x8ea2('0x25')](respondWithFilteredResult(_0x2b014d,_0x355b91))[_0x8ea2('0x2e')](handleError(_0x2b014d,null));};exports[_0x8ea2('0x11b')]=function(_0x3a37fb,_0x455009,_0x556919){var _0x58a0e5={'where':{}},_0x3be2ce={},_0x56a973={'count':0x0,'rows':[]};return db[_0x8ea2('0x49')][_0x8ea2('0xca')]({'where':{'id':_0x3a37fb[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x455009,null))[_0x8ea2('0x25')](function(_0x515381){if(_0x515381){_0x3be2ce[_0x8ea2('0x4d')]=_[_0x8ea2('0x4f')](db['ChatMessage'][_0x8ea2('0x4a')]);_0x3be2ce[_0x8ea2('0x4e')]=_[_0x8ea2('0x4f')](_0x3a37fb[_0x8ea2('0x4e')]);_0x3be2ce['filters']=_[_0x8ea2('0x51')](_0x3be2ce[_0x8ea2('0x4d')],_0x3be2ce[_0x8ea2('0x4e')]);_0x58a0e5[_0x8ea2('0x52')]=_['intersection'](_0x3be2ce[_0x8ea2('0x4d')],qs[_0x8ea2('0x53')](_0x3a37fb[_0x8ea2('0x4e')]['fields']));_0x58a0e5[_0x8ea2('0x52')]=_0x58a0e5[_0x8ea2('0x52')][_0x8ea2('0x54')]?_0x58a0e5['attributes']:_0x3be2ce['model'];if(!_0x3a37fb[_0x8ea2('0x4e')]['hasOwnProperty'](_0x8ea2('0x56'))){_0x58a0e5[_0x8ea2('0x34')]=qs[_0x8ea2('0x34')](_0x3a37fb[_0x8ea2('0x4e')]['limit']);_0x58a0e5[_0x8ea2('0x32')]=qs['offset'](_0x3a37fb['query']['offset']);}_0x58a0e5['order']=qs[_0x8ea2('0x58')](_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x58')]);_0x58a0e5[_0x8ea2('0x59')]=qs[_0x8ea2('0x50')](_['pick'](_0x3a37fb['query'],_0x3be2ce[_0x8ea2('0x50')]));_0x58a0e5['where']['ChatInteractionId']=_0x515381['id'];if(_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x94')]){_0x58a0e5[_0x8ea2('0x59')]=_['merge'](_0x58a0e5[_0x8ea2('0x59')],{'$or':_['map'](_0x58a0e5[_0x8ea2('0x52')],function(_0x4041ec){var _0x56178b={};_0x56178b[_0x4041ec]={'$like':'%'+_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x94')]+'%'};return _0x56178b;})});}_0x58a0e5['where'][_0x8ea2('0x11c')]=![];if(_0x3a37fb[_0x8ea2('0x4e')]['id']){_0x58a0e5[_0x8ea2('0x59')]['id']={'$gt':_0x3a37fb[_0x8ea2('0x4e')]['id']};}_0x58a0e5=_[_0x8ea2('0x3d')]({},_0x58a0e5,_0x3a37fb[_0x8ea2('0xc5')]);return db[_0x8ea2('0xda')][_0x8ea2('0x35')]({'where':_0x58a0e5[_0x8ea2('0x59')]})['then'](function(_0xcedece){_0x56a973['count']=_0xcedece;_0x58a0e5[_0x8ea2('0x118')]=[];if(_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x11d')]){_0x58a0e5[_0x8ea2('0x118')][_0x8ea2('0xc1')]({'model':db[_0x8ea2('0x7f')],'as':_0x8ea2('0x7f'),'attributes':['id',_0x8ea2('0x105'),'alias']});}if(_0x3a37fb['query'][_0x8ea2('0xc4')]){_0x58a0e5[_0x8ea2('0x118')]=[{'all':!![]}];}return db[_0x8ea2('0xda')][_0x8ea2('0x119')](_0x58a0e5);})[_0x8ea2('0x25')](function(_0x52bf7c){_0x56a973[_0x8ea2('0x11a')]=_0x52bf7c;return _0x56a973;});}})[_0x8ea2('0x25')](respondWithFilteredResult(_0x455009,_0x58a0e5))['catch'](handleError(_0x455009,null));};exports[_0x8ea2('0x11e')]=function(_0x3be5d0,_0x3ac848,_0x52ce76){return db['ChatInteraction'][_0x8ea2('0x71')]({'where':{'id':_0x3be5d0['params']['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x3ac848,null))[_0x8ea2('0x25')](function(_0x1030c9){if(_0x1030c9){return _0x1030c9[_0x8ea2('0x11f')](_0x3be5d0[_0x8ea2('0xc7')][_0x8ea2('0x115')],_[_0x8ea2('0x116')](_0x3be5d0[_0x8ea2('0xc7')],[_0x8ea2('0x115'),'id'])||{})[_0x8ea2('0x120')](function(){return db[_0x8ea2('0x7d')][_0x8ea2('0x119')]({'attributes':['id',_0x8ea2('0x3c'),_0x8ea2('0x5d')],'where':{'id':_0x3be5d0[_0x8ea2('0xc7')][_0x8ea2('0x115')]}});})[_0x8ea2('0x25')](function(_0x452b94){socket[_0x8ea2('0x121')]('chatInteractionTags:save',{'id':Number(_0x3be5d0['params']['id']),'tags':_0x452b94||[]});return{'id':Number(_0x3be5d0['params']['id']),'tags':_0x452b94||[]};});}})[_0x8ea2('0x25')](respondWithResult(_0x3ac848,null))[_0x8ea2('0x2e')](handleError(_0x3ac848,null));};exports[_0x8ea2('0x122')]=function(_0x9410dd,_0x497671,_0x5e3e8d){return db[_0x8ea2('0x49')]['find']({'where':{'id':_0x9410dd[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x497671,null))[_0x8ea2('0x25')](function(_0x19b042){if(_0x19b042){return _0x19b042[_0x8ea2('0x122')](_0x9410dd[_0x8ea2('0x4e')][_0x8ea2('0x115')]);}})['then'](respondWithStatusCode(_0x497671,null))[_0x8ea2('0x2e')](handleError(_0x497671,null));};exports[_0x8ea2('0xf4')]=function(_0x2dc450,_0x34e1c5){var _0x5b929c=moment()['unix']()[_0x8ea2('0xaa')]();var _0x263123=path[_0x8ea2('0xf0')](config['root'],'server',_0x8ea2('0x123'),'tmp');var _0x40e8e6=path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],'server',_0x8ea2('0x123'),_0x8ea2('0x124'));var _0x2dfabc=path[_0x8ea2('0xf0')](_0x263123,_0x5b929c);var _0x515049=util['format'](_0x8ea2('0x125'),_0x2dc450[_0x8ea2('0xc3')]['id'],_0x5b929c);var _0x39000d=path['join'](_0x263123,_0x515049);var _0x3a1752=[];_0x3a1752['push']({'model':db[_0x8ea2('0x7f')],'as':'User','attributes':['id',_0x8ea2('0x105')],'raw':!![]});_0x3a1752['push']({'model':db[_0x8ea2('0xde')],'as':_0x8ea2('0x75'),'attributes':['id',_0x8ea2('0x126'),_0x8ea2('0x127')],'raw':!![]});if(_0x2dc450['query'][_0x8ea2('0x124')]){_0x3a1752[_0x8ea2('0xc1')]({'model':db[_0x8ea2('0xed')],'as':_0x8ea2('0xed'),'raw':!![]});}var _0x5ba508=[{'model':db[_0x8ea2('0xda')],'as':_0x8ea2('0x128'),'attributes':['id',_0x8ea2('0xc7'),_0x8ea2('0x87'),_0x8ea2('0x107'),'secret',_0x8ea2('0x129')],'include':_0x3a1752}];_0x5ba508[_0x8ea2('0xc1')]({'model':db[_0x8ea2('0xcb')],'as':_0x8ea2('0x12a'),'attributes':['id','name']});_0x5ba508[_0x8ea2('0xc1')]({'model':db[_0x8ea2('0x7f')],'as':'Owner','attributes':['id','fullname']});return db['ChatInteraction'][_0x8ea2('0x71')]({'where':{'id':_0x2dc450[_0x8ea2('0xc3')]['id']},'include':_0x5ba508})[_0x8ea2('0x25')](handleEntityNotFound(_0x34e1c5,null))[_0x8ea2('0x25')](function(_0x3c9013){if(_0x3c9013){var _0x103c43=_0x3c9013['get']({'plain':!![]});fs['mkdirSync'](_0x2dfabc);var _0xc099b6={'channel':_0x8ea2('0x12b'),'account':_0x103c43[_0x8ea2('0x12a')]['name'],'agent':_0x103c43['Owner']?_0x103c43[_0x8ea2('0x12c')][_0x8ea2('0x105')]:'N.A.','createdAt':moment(_0x103c43[_0x8ea2('0x87')])['format'](_0x8ea2('0x12d'))[_0x8ea2('0xaa')](),'closedAt':_0x103c43[_0x8ea2('0xeb')]?moment(_0x103c43['closedAt'])[_0x8ea2('0xfe')](_0x8ea2('0x12d'))['toString']():'','disposition':_0x103c43[_0x8ea2('0xe2')],'chatInfo':{'browser':_0x103c43[_0x8ea2('0x12e')],'os':_0x103c43['osName'],'referer':_0x103c43['referer'],'customerIp':_0x103c43[_0x8ea2('0x12f')],'customerPort':_0x103c43[_0x8ea2('0x130')]?_0x103c43[_0x8ea2('0x130')]:'N.A.'},'messages':_(_0x103c43[_0x8ea2('0x128')])[_0x8ea2('0x131')]()[_0x8ea2('0x94')]({'secret':![]})[_0x8ea2('0x43')](function(_0x36799a){if(_0x36799a['Attachment']){var _0x1cc1d9=path['join'](_0x40e8e6,_0x36799a[_0x8ea2('0xed')]['basename']);if(fs[_0x8ea2('0x132')](_0x1cc1d9)){fs[_0x8ea2('0x133')](_0x1cc1d9)[_0x8ea2('0x134')](fs[_0x8ea2('0x135')](path['join'](_0x2dfabc,_0x36799a[_0x8ea2('0xed')][_0x8ea2('0xe7')])));}}return{'date':moment(_0x36799a[_0x8ea2('0x87')])[_0x8ea2('0xfe')](_0x8ea2('0x12d'))[_0x8ea2('0xaa')](),'sender':_0x36799a[_0x8ea2('0x107')]===_0x8ea2('0x136')?_0x36799a[_0x8ea2('0x7f')]?_0x36799a[_0x8ea2('0x7f')][_0x8ea2('0x105')]:'System':_0x36799a[_0x8ea2('0x75')][_0x8ea2('0x126')]+(_0x36799a[_0x8ea2('0x75')]['lastName']?'\x20'+_0x36799a[_0x8ea2('0x75')][_0x8ea2('0x127')]:''),'body':_0x36799a[_0x8ea2('0xed')]?_0x36799a[_0x8ea2('0xed')][_0x8ea2('0xe7')]:_0x36799a[_0x8ea2('0xc7')],'direction':_0x36799a[_0x8ea2('0x107')]===_0x8ea2('0x136')?'A':'C','secret':_0x36799a[_0x8ea2('0x11c')],'read':_0x36799a[_0x8ea2('0x129')],'attachment':_0x36799a['Attachment']};})[_0x8ea2('0x77')]()};return ejs[_0x8ea2('0x137')](path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],'server',_0x8ea2('0x138'),_0x8ea2('0x139')),{'interaction':_0xc099b6})[_0x8ea2('0x25')](function(_0x10d2b3){var _0x12a217=path[_0x8ea2('0xf0')](_0x2dfabc,_0x8ea2('0x13a')+_0x103c43['id']+'-'+_0x5b929c+'.pdf');var _0x44b0dc={'path':_0x12a217,'channel':_0x8ea2('0x12b'),'interactionId':_0x103c43['id']};return pdf['createPdfFromHTML'](_0x10d2b3,_0x44b0dc);})[_0x8ea2('0x25')](function(){return new BPromise(function(_0x27f5e9,_0x19b678){zipdir(_0x2dfabc,{'saveTo':_0x39000d},function(_0x50ebcd,_0x5d6c63){if(_0x50ebcd)return _0x19b678(_0x50ebcd);return _0x27f5e9(_0x5d6c63);});})[_0x8ea2('0x25')](function(){return new BPromise(function(_0x55b3a1,_0x57e228){rimraf(_0x2dfabc,function(_0x3c669b){if(_0x3c669b)_0x57e228(_0x3c669b);return _0x55b3a1();});});})[_0x8ea2('0x25')](function(){return _0x34e1c5['download'](_0x39000d,_0x515049,function(_0x688d21){if(_0x688d21){console[_0x8ea2('0x13b')]('err',_0x688d21);}else{fs[_0x8ea2('0x13c')](_0x39000d);}});});});}else{return _0x34e1c5['sendStatus'](0xc8);}})[_0x8ea2('0x2e')](handleError(_0x34e1c5,null));}; \ No newline at end of file +var _0x66fa=['error','code','message','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','body','contact','agent','interaction','TagIds','Tags','split','forEach','push','map','ChatInteraction','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','field','from','tools_tags','select','u.id','u.fullname','ui.ChatInteractionId','left_join','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','buildExpression','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','isEmpty','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','params','includeAll','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','fullname','email','account','https://api-vidaoo.xcally.com/api/v1/meetings','follow','isNull','metadata','ValidationError','join_url','out','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','filename','mimetype','Attachment','attachmentDownload','Unauthorized','ChatOfflineMessageId','root','offline-chat/','join','basename','close','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','CmContact','ContactId','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','direction','MailServerOut','Smtp','service','host','port','secure','auth','pass','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ChatMessage','addMessage','omit','ids','getMessages','merge','YYYY-MM-DD\x20HH:mm:ss','options','getMyMessages','include','includeAgent','alias','addTags','setTags','findAll','color','emit','chatInteractionTags:save','removeTags','download','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','secret','read','Account','Owner','mkdirSync','Chat','N.A.','closedAt','browserName','osName','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','renderFile','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/export/pdf','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5db9fd,_0x222244){var _0x1595c8=function(_0x54594f){while(--_0x54594f){_0x5db9fd['push'](_0x5db9fd['shift']());}};_0x1595c8(++_0x222244);}(_0x66fa,0x117));var _0xa66f=function(_0x3036e5,_0x485e29){_0x3036e5=_0x3036e5-0x0;var _0x349ff7=_0x66fa[_0x3036e5];return _0x349ff7;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xa66f('0x11'));var hardwareService=require(_0xa66f('0x12'));var logger=require('../../config/logger')(_0xa66f('0x13'));var utils=require('../../config/utils');var config=require(_0xa66f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa66f('0x15'))['db'];config[_0xa66f('0x16')]=_[_0xa66f('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa66f('0x18'))(new Redis(config['redis']));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0xa66f('0x19'));var client=jayson[_0xa66f('0x1a')][_0xa66f('0x1b')]({'port':0x232b});var client9004=jayson[_0xa66f('0x1a')][_0xa66f('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x567d4f,_0x5510dc,_0x19b5ac,_0x32d338){return new BPromise(function(_0x295acf,_0x403f4d){var _0x5c67f5=_0x32d338||client;return _0x5c67f5[_0xa66f('0x1c')](_0x567d4f,_0x19b5ac)['then'](function(_0x4a28d4){logger[_0xa66f('0x1d')](_0xa66f('0x1e'),_0x5510dc,_0xa66f('0x1f'));logger[_0xa66f('0x20')](_0xa66f('0x21'),_0x5510dc,_0xa66f('0x1f'),JSON[_0xa66f('0x22')](_0x4a28d4));if(_0x4a28d4[_0xa66f('0x23')]){if(_0x4a28d4[_0xa66f('0x23')][_0xa66f('0x24')]===0x1f4){logger[_0xa66f('0x23')](_0xa66f('0x1e'),_0x5510dc,_0x4a28d4[_0xa66f('0x23')][_0xa66f('0x25')]);return _0x403f4d(_0x4a28d4[_0xa66f('0x23')]['message']);}logger[_0xa66f('0x23')](_0xa66f('0x1e'),_0x5510dc,_0x4a28d4[_0xa66f('0x23')][_0xa66f('0x25')]);return _0x295acf(_0x4a28d4['error'][_0xa66f('0x25')]);}else{logger[_0xa66f('0x1d')](_0xa66f('0x1e'),_0x5510dc,_0xa66f('0x1f'));_0x295acf(_0x4a28d4['result']['message']);}})[_0xa66f('0x26')](function(_0x598942){logger[_0xa66f('0x23')](_0xa66f('0x1e'),_0x5510dc,_0x598942);_0x403f4d(_0x598942);});});}function respondWithStatusCode(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0xcc;return function(_0x4683c7){if(_0x4683c7){return _0x384164[_0xa66f('0x27')](_0x57da7f);}return _0x384164[_0xa66f('0x28')](_0x57da7f)[_0xa66f('0x29')]();};}function respondWithResult(_0x17c103,_0x236046){_0x236046=_0x236046||0xc8;return function(_0x1eb86a){if(_0x1eb86a){return _0x17c103[_0xa66f('0x28')](_0x236046)[_0xa66f('0x2a')](_0x1eb86a);}};}function respondWithFilteredResult(_0x117d03,_0x45f71c){return function(_0x63650b){if(_0x63650b){var _0x42b966=typeof _0x45f71c[_0xa66f('0x2b')]==='undefined'&&typeof _0x45f71c['limit']===_0xa66f('0x2c');var _0x27ceae=_0x63650b['count'];var _0x44c79a=_0x42b966?0x0:_0x45f71c[_0xa66f('0x2b')];var _0x4cd7f2=_0x42b966?_0x63650b[_0xa66f('0x2d')]:_0x45f71c[_0xa66f('0x2b')]+_0x45f71c[_0xa66f('0x2e')];var _0x2c2ace;if(_0x4cd7f2>=_0x27ceae){_0x4cd7f2=_0x27ceae;_0x2c2ace=0xc8;}else{_0x2c2ace=0xce;}_0x117d03[_0xa66f('0x28')](_0x2c2ace);return _0x117d03['set'](_0xa66f('0x2f'),_0x44c79a+'-'+_0x4cd7f2+'/'+_0x27ceae)['json'](_0x63650b);}return null;};}function patchUpdates(_0x306b35){return function(_0x35a0a7){try{jsonpatch[_0xa66f('0x30')](_0x35a0a7,_0x306b35,!![]);}catch(_0x486e4e){return BPromise[_0xa66f('0x31')](_0x486e4e);}return _0x35a0a7[_0xa66f('0x32')]();};}function saveUpdates(_0x4f1668,_0x1a5d4a){return function(_0x35a847){if(_0x35a847){return _0x35a847[_0xa66f('0x33')](_0x4f1668)[_0xa66f('0x34')](function(_0x10a782){return _0x10a782;});}return null;};}function removeEntity(_0x2452d2,_0x25c74c){return function(_0x41303c){if(_0x41303c){return _0x41303c[_0xa66f('0x35')]()[_0xa66f('0x34')](function(){_0x2452d2['status'](0xcc)[_0xa66f('0x29')]();});}};}function handleEntityNotFound(_0x5bf736,_0x1c7eda){return function(_0x46f6cc){if(!_0x46f6cc){_0x5bf736[_0xa66f('0x27')](0x194);}return _0x46f6cc;};}function handleError(_0x3b9261,_0x3722d3){_0x3722d3=_0x3722d3||0x1f4;return function(_0x201432){logger[_0xa66f('0x23')](_0x201432[_0xa66f('0x36')]);if(_0x201432['name']){delete _0x201432[_0xa66f('0x37')];}_0x3b9261['status'](_0x3722d3)[_0xa66f('0x38')](_0x201432);};}function getMustacheRender(_0x45eeb8,_0x2ed1fb){return Mustache['render'](_0x45eeb8,_['merge'](_0x2ed1fb[_0xa66f('0x39')],{'contact':_0x2ed1fb[_0xa66f('0x3a')],'message':_0x2ed1fb[_0xa66f('0x25')],'agent':_0x2ed1fb[_0xa66f('0x3b')],'interaction':_0x2ed1fb[_0xa66f('0x3c')],'account':_0x2ed1fb['account']}))||'';}function getInteractionUsers(_0x5cb0a9,_0x49b869){return new BPromise(function(_0x30f7de,_0x4aeeb4){try{if(_0x49b869[_0x5cb0a9['id']]){_0x5cb0a9['Users']=_['map'](_0x49b869[_0x5cb0a9['id']],function(_0x5fdc3e){return{'id':_0x5fdc3e['id'],'fullname':_0x5fdc3e['fullname']};});}}catch(_0x8965d3){_0x4aeeb4(_0x8965d3);}_0x30f7de(_0x5cb0a9);});}function getInteractionTags(_0x17d942,_0x23a546){return new BPromise(function(_0x1647a0,_0xd65c5d){try{if(_0x17d942[_0xa66f('0x3d')]){_0x17d942[_0xa66f('0x3e')]=[];_0x17d942[_0xa66f('0x3d')][_0xa66f('0x3f')](',')[_0xa66f('0x40')](function(_0x3a7929){_0x17d942[_0xa66f('0x3e')][_0xa66f('0x41')](_0x23a546[_0x3a7929]);});}delete _0x17d942[_0xa66f('0x3d')];}catch(_0x4f01b9){_0xd65c5d(_0x4f01b9);}_0x1647a0(_0x17d942);});}function updateChatInteraction(_0x36037c,_0x25c2cb,_0x58c1f2){return new BPromise(function(_0x248587,_0x4b6e6b){return getInteractionUsers(_0x36037c,_0x58c1f2)[_0xa66f('0x34')](function(_0x27adf4){return getInteractionTags(_0x27adf4,_0x25c2cb);})['then'](function(_0x1ddd2f){_0x248587(_0x1ddd2f);})[_0xa66f('0x26')](function(_0x2126e8){_0x4b6e6b(_0x2126e8);});});}exports['index']=function(_0x394b1e,_0x5cdfe2){var _0x276cd5={},_0x33ed23={},_0xb52cc6={'count':0x0,'rows':[]};var _0x3a499e=_[_0xa66f('0x42')](db[_0xa66f('0x43')][_0xa66f('0x44')],function(_0x50cc47){return{'name':_0x50cc47[_0xa66f('0x45')],'type':_0x50cc47[_0xa66f('0x46')][_0xa66f('0x47')]};});_0x33ed23[_0xa66f('0x48')]=_[_0xa66f('0x42')](_0x3a499e,'name');_0x33ed23['query']=_[_0xa66f('0x49')](_0x394b1e[_0xa66f('0x4a')]);_0x33ed23[_0xa66f('0x4b')]=_[_0xa66f('0x4c')](_0x33ed23[_0xa66f('0x48')],_0x33ed23[_0xa66f('0x4a')]);_0x276cd5['attributes']=_[_0xa66f('0x4c')](_0x33ed23[_0xa66f('0x48')],qs[_0xa66f('0x4d')](_0x394b1e['query']['fields']));_0x276cd5[_0xa66f('0x4e')]=_0x276cd5[_0xa66f('0x4e')][_0xa66f('0x4f')]?_0x276cd5['attributes']:_0x33ed23['model'];if(!_0x394b1e['query'][_0xa66f('0x50')](_0xa66f('0x51'))){_0x276cd5[_0xa66f('0x2e')]=qs[_0xa66f('0x2e')](_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x2e')]);_0x276cd5[_0xa66f('0x2b')]=qs[_0xa66f('0x2b')](_0x394b1e['query'][_0xa66f('0x2b')]);}_0x276cd5[_0xa66f('0x52')]=qs[_0xa66f('0x53')](_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x53')]);_0x276cd5[_0xa66f('0x54')]=qs['filters'](_[_0xa66f('0x55')](_0x394b1e[_0xa66f('0x4a')],_0x33ed23[_0xa66f('0x4b')]),_0x3a499e);var _0x13848d=[];var _0x20d6be=squel['select']()[_0xa66f('0x56')]('id')['field'](_0xa66f('0x37'))['field']('color')[_0xa66f('0x57')](_0xa66f('0x58'));var _0x12271d=squel[_0xa66f('0x59')]()[_0xa66f('0x56')](_0xa66f('0x5a'))['field'](_0xa66f('0x5b'))[_0xa66f('0x56')](_0xa66f('0x5c'))[_0xa66f('0x57')]('user_has_chat_interactions','ui')[_0xa66f('0x5d')]('users','u',_0xa66f('0x5e'));var _0x10fc75=squel[_0xa66f('0x59')]()[_0xa66f('0x57')](_0xa66f('0x5f'),'i')[_0xa66f('0x5d')](_0xa66f('0x60'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xa66f('0x5d')](_0xa66f('0x61'),'o',_0xa66f('0x62'))[_0xa66f('0x5d')](_0xa66f('0x63'),'a',_0xa66f('0x64'))[_0xa66f('0x5d')](_0xa66f('0x65'),'me',_0xa66f('0x66'))['left_join']('chat_interaction_has_tags','it',_0xa66f('0x67'))[_0xa66f('0x5d')](_0xa66f('0x58'),'t',_0xa66f('0x68'));var _0x2f1f1e=squel[_0xa66f('0x69')]();var _0x8bea2b=[];var _0x4b10cf=squel[_0xa66f('0x69')]();var _0x11c89e;if(_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x6a')]){_0x11c89e=as['parseSearch'](_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x6a')]);var _0x19ff30=_0x11c89e[_0xa66f('0x6b')];for(var _0x19f4b5=0x0;_0x19f4b5<_0x11c89e[_0xa66f('0x6c')]['length'];_0x19f4b5++){var _0x4b31f7=_0x11c89e[_0xa66f('0x6c')][_0x19f4b5];var _0x31b81b='i';var _0x174aad=_['find'](_0x3a499e,[_0xa66f('0x37'),_0x4b31f7[_0xa66f('0x56')]]);if(!_0x174aad){switch(_0x4b31f7[_0xa66f('0x56')]){case _0xa66f('0x6d'):if(_0x4b31f7[_0xa66f('0x6e')]==0x1){_0x10fc75[_0xa66f('0x6f')]('`'+_0x4b31f7[_0xa66f('0x56')]+_0xa66f('0x70'));}else{_0x10fc75[_0xa66f('0x6f')]('`'+_0x4b31f7['field']+_0xa66f('0x71'));}break;case _0xa66f('0x72'):if(_0x4b31f7[_0xa66f('0x73')]===_0xa66f('0x74')){if(_0x4b31f7[_0xa66f('0x6e')][_0xa66f('0x3f')]('\x20')[_0xa66f('0x4f')]>0x1){_0x2f1f1e[_0x19ff30](_0xa66f('0x75'),qs['getFullTextValue'](_0x4b31f7['value']),null);}else{var _0x46327d='%'+_0x4b31f7[_0xa66f('0x6e')]+'%';_0x2f1f1e[_0x19ff30](_0xa66f('0x76'),_0x46327d,_0x46327d,_0x46327d);}}else{_0x174aad=_[_0xa66f('0x77')](_0x3a499e,[_0xa66f('0x37'),'ContactId']);_0x4b31f7[_0xa66f('0x56')]='ContactId';_0x53b01b=as[_0xa66f('0x78')](_0x31b81b,_0x174aad[_0xa66f('0x46')],_0x4b31f7);_0x2f1f1e[_0x19ff30](_0x53b01b[_0xa66f('0x79')],_0x53b01b[_0xa66f('0x6e')]['start'],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x29')]);}break;case _0xa66f('0x7a'):var _0x46ea11=_0x4b31f7[_0xa66f('0x6e')][_0xa66f('0x3f')](',')[_0xa66f('0x42')](function(_0x2bdb18){return Number(_0x2bdb18);});_0x46ea11[_0xa66f('0x40')](function(_0x36b92f){_0x4b10cf['or'](_0xa66f('0x7b'),'%,'+_0x36b92f+',%');});_0x8bea2b=_[_0xa66f('0x7c')](_0x8bea2b,_0x46ea11);break;case'User':if(_0x4b31f7[_0xa66f('0x73')]===_0xa66f('0x74')){_0x2f1f1e[_0x19ff30](_0xa66f('0x7d'),'%'+_0x4b31f7[_0xa66f('0x6e')]+'%',null);}else{_0x174aad=_[_0xa66f('0x77')](_0x3a499e,[_0xa66f('0x37'),_0xa66f('0x7e')]);_0x4b31f7[_0xa66f('0x56')]='UserId';_0x53b01b=as[_0xa66f('0x78')](_0x31b81b,_0x174aad[_0xa66f('0x46')],_0x4b31f7);_0x2f1f1e[_0x19ff30](_0x53b01b[_0xa66f('0x79')],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x7f')],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x29')]);}break;case _0xa66f('0x39'):_0x53b01b=as['buildExpression']('me',null,_0x4b31f7);_0x2f1f1e[_0x19ff30](_0x53b01b['text'],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x7f')],_0x53b01b[_0xa66f('0x6e')]['end']);break;}}else{var _0x53b01b=as[_0xa66f('0x78')](_0x31b81b,_0x174aad[_0xa66f('0x46')],_0x4b31f7);_0x2f1f1e[_0x19ff30](_0x53b01b[_0xa66f('0x79')],_0x53b01b[_0xa66f('0x6e')]['start'],_0x53b01b[_0xa66f('0x6e')][_0xa66f('0x29')]);}}}else{var _0x1d4642=_(_0x394b1e[_0xa66f('0x4a')])[_0xa66f('0x49')]()[_0xa66f('0x42')](function(_0x218128){return _[_0xa66f('0x80')](_0x3a499e,['name',_0x218128])?_0x218128:undefined;})[_0xa66f('0x81')]()[_0xa66f('0x6e')]();if(!_['isEmpty'](_0x1d4642)){_0x1d4642['forEach'](function(_0x183155){if(_0x183155===_0xa66f('0x82')){_0x10fc75['where'](_0xa66f('0x83'),[]['concat'](_0x394b1e[_0xa66f('0x4a')][_0x183155]));}else if(_0x183155==='createdAt'){var _0x4feda0=JSON['parse'](_0x394b1e[_0xa66f('0x4a')][_0x183155])[_0xa66f('0x84')];var _0x1f05bb=JSON[_0xa66f('0x85')](_0x394b1e[_0xa66f('0x4a')][_0x183155])[_0xa66f('0x86')];_0x10fc75[_0xa66f('0x54')](_0xa66f('0x87'),_0x4feda0,_0x1f05bb);}else{if(_0x394b1e[_0xa66f('0x4a')][_0x183155]===_0xa66f('0x88')){_0x10fc75[_0xa66f('0x54')]('i.'+_0x183155+_0xa66f('0x89'));}else{_0x10fc75[_0xa66f('0x54')]('i.'+_0x183155+_0xa66f('0x8a'),_0x394b1e[_0xa66f('0x4a')][_0x183155]);}}});}if(_0x394b1e[_0xa66f('0x4a')]['read']){if(_0x394b1e[_0xa66f('0x4a')]['read']==0x1){_0x10fc75[_0xa66f('0x6f')]('`unreadMessages`\x20=\x200');}else{_0x10fc75[_0xa66f('0x6f')](_0xa66f('0x8b'));}}if(_0x394b1e[_0xa66f('0x4a')]['tag']){_0x8bea2b=_['isArray'](_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8c')])?_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8c')]:new Array(_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8c')]);_0x8bea2b[_0xa66f('0x40')](function(_0x578bff){_0x4b10cf['or'](_0xa66f('0x7b'),'%,'+_0x578bff+',%');});}if(_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8d')]){var _0x4426d2=_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x8d')][_0xa66f('0x8e')]('\x5c','\x5c\x5c')[_0xa66f('0x8e')](/'/g,'\x27\x27');if(qs[_0xa66f('0x8f')](_0x4426d2)){_0x2f1f1e['or'](_0xa66f('0x90'),_0x4426d2+'%');}else{_0x2f1f1e['or'](_0xa66f('0x91'),qs[_0xa66f('0x92')](_0x4426d2))['or'](_0xa66f('0x93'),_0x4426d2+'%');}}}_0x10fc75['where'](_0x2f1f1e);_0x10fc75[_0xa66f('0x94')](_0xa66f('0x95'));var _0x34ebfd={'type':db[_0xa66f('0x96')][_0xa66f('0x97')][_0xa66f('0x98')],'raw':!![]};var _0x3058aa=_0x10fc75[_0xa66f('0x99')]();_0x3058aa[_0xa66f('0x56')]('i.id');_0x3058aa[_0xa66f('0x56')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa66f('0x6d'));if(_0x276cd5['order']){_0x276cd5[_0xa66f('0x52')]['forEach'](function(_0x298bd8){var _0x5a1750=_0x298bd8[0x0]===_0xa66f('0x9a')?_0x298bd8[0x0]:'i.'+_0x298bd8[0x0];_0x10fc75[_0xa66f('0x52')](_0x5a1750,_0x298bd8[0x1]===_0xa66f('0x9b')?![]:!![]);});}if(!_[_0xa66f('0x9c')](_0x8bea2b)){_0x10fc75[_0xa66f('0x6f')](_0x4b10cf);_0x3058aa[_0xa66f('0x54')]('t.id\x20IN\x20?',_0x8bea2b);}BPromise[_0xa66f('0x9d')]()[_0xa66f('0x34')](function(){if(!_0x11c89e){if(_0x394b1e[_0xa66f('0x4a')]['ChatWebsiteId'])return;_0x3058aa[_0xa66f('0x54')](_0xa66f('0x9e'));_0x10fc75['where'](_0xa66f('0x9e'));return;}if(_0x394b1e[_0xa66f('0x9f')]['role']!=='agent')return;return _0x394b1e[_0xa66f('0x9f')][_0xa66f('0xa0')]({'attributes':['id'],'raw':!![]})[_0xa66f('0x34')](function(_0x2929fe){if(_[_0xa66f('0x9c')](_0x2929fe)){_0x3058aa['where'](_0xa66f('0xa1'));_0x10fc75[_0xa66f('0x54')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x3058aa[_0xa66f('0x54')](_0xa66f('0x83'),_['map'](_0x2929fe,'id'));_0x10fc75[_0xa66f('0x54')](_0xa66f('0x83'),_[_0xa66f('0x42')](_0x2929fe,'id'));}});})[_0xa66f('0x34')](function(){if(_0x394b1e[_0xa66f('0x9f')]['role']===_0xa66f('0x3b')&&!_0x11c89e&&!_0x394b1e[_0xa66f('0x4a')][_0xa66f('0x82')])return[];return db[_0xa66f('0xa2')][_0xa66f('0x4a')](_0x3058aa[_0xa66f('0xa3')](),_0x34ebfd);})['then'](function(_0x2b2c54){_0xb52cc6[_0xa66f('0x2d')]=_0x2b2c54[_0xa66f('0x4f')];if(_0xb52cc6[_0xa66f('0x2d')]===0x0)return[];return db[_0xa66f('0xa2')][_0xa66f('0x4a')](_0x20d6be[_0xa66f('0xa3')](),_0x34ebfd)['then'](function(_0x5ec355){_0x13848d=_[_0xa66f('0xa4')](_0x5ec355,'id');_0x34ebfd=_['merge'](_0x34ebfd,{'model':db[_0xa66f('0x43')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x394b1e[_0xa66f('0x4a')]['fields']){_0x276cd5[_0xa66f('0x4e')][_0xa66f('0x40')](function(_0x3f84f9){_0x10fc75['field']('i.'+_0x3f84f9);});}else{_0x10fc75['field'](_0xa66f('0xa5'),'unreadMessages');_0x10fc75[_0xa66f('0x56')](_0xa66f('0xa6'),_0xa66f('0xa7'));_0x10fc75['field'](_0xa66f('0xa8'),'Account.mandatoryDisposition');_0x10fc75[_0xa66f('0x56')](_0xa66f('0xa9'),_0xa66f('0x9a'));_0x10fc75[_0xa66f('0x56')]('i.*');_0x10fc75[_0xa66f('0x56')](_0xa66f('0xaa'),_0xa66f('0xab'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xac'),_0xa66f('0xad'));_0x10fc75['field'](_0xa66f('0xae'),_0xa66f('0xaf'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb0'),_0xa66f('0xb1'));_0x10fc75['field']('c.mobile',_0xa66f('0xb2'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb3'),_0xa66f('0xb4'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb5'),_0xa66f('0xb6'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb7'),_0xa66f('0xb8'));_0x10fc75[_0xa66f('0x56')](_0xa66f('0xb9'),'TagIds');}if(_0x276cd5[_0xa66f('0x2e')])_0x10fc75[_0xa66f('0x2e')](_0x276cd5['limit']);if(_0x276cd5[_0xa66f('0x2b')])_0x10fc75[_0xa66f('0x2b')](_0x276cd5[_0xa66f('0x2b')]);return db['sequelize']['query'](_0x10fc75[_0xa66f('0xa3')](),_0x34ebfd);})['then'](function(_0x3520e1){if(_0x3520e1[_0xa66f('0x4f')]>0x0)_0x12271d['where'](_0xa66f('0xba'),_[_0xa66f('0x42')](_0x3520e1,'id'));return db['sequelize'][_0xa66f('0x4a')](_0x12271d[_0xa66f('0xa3')](),_0x34ebfd)[_0xa66f('0x34')](function(_0x176b30){var _0x4bc36d=_['groupBy'](_0x176b30,_0xa66f('0xbb'));var _0xdd2d09=[];_0x3520e1[_0xa66f('0x40')](function(_0x1bab2b){_0xdd2d09[_0xa66f('0x41')](updateChatInteraction(_0x1bab2b,_0x13848d,_0x4bc36d));});return BPromise[_0xa66f('0xbc')](_0xdd2d09);});});})[_0xa66f('0x34')](function(_0xac0e98){_0xb52cc6[_0xa66f('0xbd')]=_0xac0e98;return _0xb52cc6;})[_0xa66f('0x34')](respondWithFilteredResult(_0x5cdfe2,_0x276cd5))['catch'](handleError(_0x5cdfe2,null));};exports['show']=function(_0x1d472d,_0x3cbbb6){var _0x3cf40f={'raw':![],'where':{'id':_0x1d472d[_0xa66f('0xbe')]['id']}},_0x4298ca={};_0x4298ca['model']=_[_0xa66f('0x49')](db[_0xa66f('0x43')][_0xa66f('0x44')]);_0x4298ca['query']=_['keys'](_0x1d472d['query']);_0x4298ca[_0xa66f('0x4b')]=_['intersection'](_0x4298ca[_0xa66f('0x48')],_0x4298ca[_0xa66f('0x4a')]);_0x3cf40f[_0xa66f('0x4e')]=_[_0xa66f('0x4c')](_0x4298ca['model'],qs[_0xa66f('0x4d')](_0x1d472d[_0xa66f('0x4a')]['fields']));_0x3cf40f[_0xa66f('0x4e')]=_0x3cf40f[_0xa66f('0x4e')]['length']?_0x3cf40f['attributes']:_0x4298ca[_0xa66f('0x48')];if(_0x1d472d[_0xa66f('0x4a')][_0xa66f('0xbf')]){_0x3cf40f['include']=[{'all':!![]}];}_0x3cf40f=_['merge']({},_0x3cf40f,_0x1d472d['options']);return db['ChatInteraction'][_0xa66f('0x77')](_0x3cf40f)[_0xa66f('0x34')](handleEntityNotFound(_0x3cbbb6,null))[_0xa66f('0x34')](respondWithResult(_0x3cbbb6,null))[_0xa66f('0x26')](handleError(_0x3cbbb6,null));};exports[_0xa66f('0xc0')]=function(_0x46c9b2,_0x580eb7){return db[_0xa66f('0x43')][_0xa66f('0xc0')](_0x46c9b2[_0xa66f('0x39')],{})[_0xa66f('0x34')](respondWithResult(_0x580eb7,0xc9))['catch'](handleError(_0x580eb7,null));};exports['update']=function(_0xd78ede,_0xe11c2d){if(_0xd78ede[_0xa66f('0x39')]['id']){delete _0xd78ede[_0xa66f('0x39')]['id'];}return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0xd78ede[_0xa66f('0xbe')]['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0xe11c2d,null))[_0xa66f('0x34')](saveUpdates(_0xd78ede[_0xa66f('0x39')],null))[_0xa66f('0x34')](respondWithResult(_0xe11c2d,null))['catch'](handleError(_0xe11c2d,null));};exports[_0xa66f('0x35')]=function(_0x597ae3,_0x1b93e0){return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x597ae3[_0xa66f('0xbe')]['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0x1b93e0,null))['then'](removeEntity(_0x1b93e0,null))['catch'](handleError(_0x1b93e0,null));};exports['describe']=function(_0x484c8e,_0x728faa){return db[_0xa66f('0x43')][_0xa66f('0xc1')]()[_0xa66f('0x34')](respondWithResult(_0x728faa,null))['catch'](handleError(_0x728faa,null));};exports[_0xa66f('0xc2')]=function(_0x174510,_0x4f3985){var _0x348e6b=_0x174510[_0xa66f('0xbe')]['id'];var _0x4ed950;var _0xe43d63;var _0x3c2367;return db['ChatInteraction'][_0xa66f('0xc3')]({'where':{'id':_0x348e6b}})[_0xa66f('0x34')](function(_0x32bea5){_0x4ed950=_0x32bea5;return db[_0xa66f('0xc4')][_0xa66f('0xc3')]({'where':{'id':_0x32bea5[_0xa66f('0x82')]},'attributes':['id',_0xa66f('0xc5'),_0xa66f('0xc6'),_0xa66f('0xc7'),_0xa66f('0xc8'),_0xa66f('0xc9')],'raw':!![]});})['then'](function(_0x4c8386){if(_0x4c8386&&_0x4c8386[_0xa66f('0xc5')]&&_0x4c8386[_0xa66f('0xc6')]){_0xe43d63=_0x4c8386;var _0x12278e={'interaction':{'id':_0x348e6b},'agent':{'id':_0x174510['user']['id'],'name':_0x174510['user'][_0xa66f('0x37')],'fullname':_0x174510[_0xa66f('0x9f')][_0xa66f('0xca')],'email':_0x174510[_0xa66f('0x9f')][_0xa66f('0xcb')]},'contact':_0x174510['body'][_0xa66f('0x3a')],'account':_0x174510[_0xa66f('0x39')][_0xa66f('0xcc')]};var _0xfc01d7={'rejectUnauthorized':![],'method':'POST','url':_0xa66f('0xcd'),'headers':{'X-APIKEY':_0x4c8386[_0xa66f('0xc5')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x174510['user'][_0xa66f('0xcb')]],'buttons':null,'topic':_0xe43d63[_0xa66f('0xc7')],'note':_['isNull'](_0xe43d63[_0xa66f('0xc8')])?null:getMustacheRender(_0xe43d63[_0xa66f('0xc8')],_0x12278e),'metadata':null},'redirect':_0xa66f('0xce'),'json':!![]};try{if(!_[_0xa66f('0xcf')](_0xe43d63[_0xa66f('0xc9')])){var _0x3c73cc=getMustacheRender(_0xe43d63[_0xa66f('0xc9')],_0x12278e);var _0x4885bb=JSON['parse'](_0x3c73cc);_0xfc01d7[_0xa66f('0x39')][_0xa66f('0xd0')]=_0x4885bb;}}catch(_0x2e7c26){throw new db[(_0xa66f('0x96'))][(_0xa66f('0xd1'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0xfc01d7);}else{throw new db[(_0xa66f('0x96'))][(_0xa66f('0xd1'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xa66f('0x34')](function(_0x56198a){_0x3c2367=_0x56198a;if(_0x3c2367['id']){var _0x41ef9a={'body':_0x3c2367[_0xa66f('0xd2')],'ChatWebsiteId':_0xe43d63['id'],'ChatInteractionId':_0x4ed950['id'],'direction':_0xa66f('0xd3'),'UserId':_0x174510[_0xa66f('0x9f')]['id']};return db['ChatMessage']['create'](_0x41ef9a,{});}else{throw new db['Sequelize'][(_0xa66f('0xd1'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xa66f('0x34')](function(){return _0x4ed950['updateAttributes']({'vidaooSessionId':_0x3c2367['id']});})[_0xa66f('0x34')](respondWithResult(_0x4f3985,null))[_0xa66f('0x26')](handleError(_0x4f3985,null));};exports['customUpdate']=function(_0x35a2ce,_0x2d3bca){if(_0x35a2ce[_0xa66f('0x39')]['id']){delete _0x35a2ce[_0xa66f('0x39')]['id'];}return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x35a2ce[_0xa66f('0xbe')]['id']},'include':[{'model':db['CmContact'],'as':_0xa66f('0x72')}]})[_0xa66f('0x34')](handleEntityNotFound(_0x2d3bca,null))[_0xa66f('0x34')](saveUpdates(_0x35a2ce[_0xa66f('0x39')],null))[_0xa66f('0x34')](respondWithResult(_0x2d3bca,null))[_0xa66f('0x26')](handleError(_0x2d3bca,null));};exports[_0xa66f('0xd4')]=function(_0x3a2c2c,_0x179953,_0x5dcf9d){if(_0x3a2c2c[_0xa66f('0x39')]['id']){delete _0x3a2c2c['body']['id'];}return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x3a2c2c[_0xa66f('0xbe')]['id']}})[_0xa66f('0x34')](function(_0x1f4bc4){if(!_0x1f4bc4){logger['error'](_0xa66f('0xd5'),_0xa66f('0xd4'),0x194,_0xa66f('0xd6'));_0x179953[_0xa66f('0x27')](0x194);}else{if(_0x1f4bc4['UserId']){throw new db['Sequelize']['ValidationError'](_0xa66f('0xd7'));}}return _0x1f4bc4;})[_0xa66f('0x34')](function(_0x4be9ae){if(_0x4be9ae){return _0x4be9ae['update']({'closed':_0x3a2c2c[_0xa66f('0x39')][_0xa66f('0xd8')],'disposition':_0x3a2c2c['body'][_0xa66f('0xd9')]})[_0xa66f('0x34')](function(_0x17dc7d){return _0x17dc7d;});}})[_0xa66f('0x34')](function(_0x551c09){return respondWithRpcPromise('AbandonInteraction','abandon',_0x3a2c2c[_0xa66f('0x39')],client9004);})[_0xa66f('0x34')](respondWithResult(_0x179953,null))[_0xa66f('0x26')](handleError(_0x179953,null));};exports[_0xa66f('0xda')]=function(_0x377764,_0x434764,_0x315b27){_0x377764[_0xa66f('0x39')]['name']=_0x377764[_0xa66f('0xdb')][_0xa66f('0xdc')];_0x377764[_0xa66f('0x39')]['basename']=_0x377764[_0xa66f('0xdb')][_0xa66f('0xdd')];_0x377764[_0xa66f('0x39')]['type']=_0x377764['file'][_0xa66f('0xde')];return db[_0xa66f('0xdf')][_0xa66f('0xc0')](_0x377764[_0xa66f('0x39')])[_0xa66f('0x34')](respondWithResult(_0x434764,0xc9))[_0xa66f('0x26')](handleError(_0x434764,null));};exports[_0xa66f('0xe0')]=function(_0x5c5550,_0x383ce6,_0x4b2702){return db[_0xa66f('0x43')][_0xa66f('0xc3')]({'where':{'id':_0x5c5550[_0xa66f('0xbe')]['id']},'raw':!![]})[_0xa66f('0x34')](handleEntityNotFound(_0x383ce6,null))[_0xa66f('0x34')](function(_0x32f7ab){if(_0x32f7ab){if(_0x32f7ab[_0xa66f('0xd8')]){return _0x383ce6[_0xa66f('0x28')](0x193)[_0xa66f('0x2a')]({'status':0x193,'message':_0xa66f('0xe1')});}return db[_0xa66f('0xdf')][_0xa66f('0xc3')]({'where':{'id':_0x5c5550['query']['attachId']},'raw':!![]})[_0xa66f('0x34')](handleEntityNotFound(_0x383ce6,null));}})[_0xa66f('0x34')](function(_0x29ce7f){if(_0x29ce7f){var _0x1248c9=_0x29ce7f[_0xa66f('0xe2')]!==null;var _0x13948a=path['join'](config[_0xa66f('0xe3')],'server/files/attachments/');if(_0x1248c9){_0x13948a=path['join'](_0x13948a,_0xa66f('0xe4'));}var _0x1ce936=path[_0xa66f('0xe5')](_0x13948a,_0x29ce7f[_0xa66f('0xe6')]);return _0x383ce6['download'](_0x1ce936);}})[_0xa66f('0x26')](handleError(_0x383ce6,null));};exports[_0xa66f('0xe7')]=function(_0x1686df,_0x1889f4){var _0x2a03c8=null;var _0x48b16d=null;var _0x5a05e4=null;var _0x1b78fa=null;if(_0x1686df[_0xa66f('0x39')]['id']){delete _0x1686df[_0xa66f('0x39')]['id'];}if(_0x1686df[_0xa66f('0x39')]['mailTranscript']){_0x1b78fa=path[_0xa66f('0xe5')](config[_0xa66f('0xe3')],_0xa66f('0xe8'),util[_0xa66f('0xe9')](_0xa66f('0xea'),Date[_0xa66f('0xeb')]()));_0x1686df[_0xa66f('0x39')][_0xa66f('0xec')]=_0x1b78fa;}return db['ChatInteraction'][_0xa66f('0x77')]({'where':{'id':_0x1686df[_0xa66f('0xbe')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xa66f('0xed'),'include':[{'model':db[_0xa66f('0xee')],'as':_0xa66f('0xee')}]}]})[_0xa66f('0x34')](handleEntityNotFound(_0x1889f4,null))[_0xa66f('0x34')](saveUpdates(_0x1686df['body'],null))[_0xa66f('0x34')](function(_0x4153a0){if(_0x4153a0){_0x2a03c8=_0x4153a0;return db[_0xa66f('0xc4')][_0xa66f('0x77')]({'where':{'id':_0x2a03c8[_0xa66f('0x82')]}});}})['then'](function(_0x820ac1){if(_0x820ac1){_0x5a05e4=_0x820ac1;return db[_0xa66f('0xef')]['find']({'where':{'id':_0x2a03c8[_0xa66f('0xf0')]}});}})[_0xa66f('0x34')](function(_0x22d154){if(_0x22d154){_0x48b16d=_0x22d154;if(_0x1b78fa){var _0x31959f=null;for(var _0x2d3123=0x1;_0x2d3123<_0x2a03c8['Messages'][_0xa66f('0x4f')];++_0x2d3123){_0x31959f=_0x2a03c8[_0xa66f('0xed')][_0x2d3123];var _0x207ea2=_0x31959f[_0xa66f('0x7e')]?util['format'](_0xa66f('0xf1'),_0x5a05e4[_0xa66f('0xf2')],_0x31959f['UserId']):_0xa66f('0xf3');var _0x19fabd=_0x1686df[_0xa66f('0x39')][_0xa66f('0xf4')]||util['format'](_0xa66f('0xf1'),_0xa66f('0xf5'),_0x31959f['ContactId']);switch(_0x5a05e4[_0xa66f('0xf6')]){case _0xa66f('0xf7'):_0x207ea2=_0x31959f[_0xa66f('0x7e')]?util['format'](_0xa66f('0xf1'),_0x5a05e4[_0xa66f('0xf2')],_0x31959f[_0xa66f('0x7e')]):'System';break;case _0xa66f('0xf8'):_0x207ea2=_0x31959f[_0xa66f('0x7e')]?_0x31959f['User']['alias']||_0x31959f[_0xa66f('0xee')][_0xa66f('0xca')]:'System';break;case _0xa66f('0xf9'):_0x207ea2=_0x31959f[_0xa66f('0x7e')]?_0x31959f[_0xa66f('0xee')][_0xa66f('0xca')]:_0xa66f('0xf3');break;default:_0x207ea2=_0x31959f['UserId']?util[_0xa66f('0xe9')](_0xa66f('0xf1'),_0x5a05e4['agentAlias'],_0x31959f[_0xa66f('0x7e')]):'System';}var _0x506797=util[_0xa66f('0xe9')](_0xa66f('0xfa'),moment(_0x31959f['createdAt'])[_0xa66f('0xe9')]('MM/DD/YYYY\x20HH:mm:ss'),_0x31959f[_0xa66f('0xfb')]==='in'?_0x19fabd:_0x207ea2,_0x31959f[_0xa66f('0x39')]);if(!_0x31959f['secret']){fs['appendFileSync'](_0x1b78fa,_0x506797);}}return db['MailAccount'][_0xa66f('0xc3')]({'where':{'service':!![]},'include':[{'model':db[_0xa66f('0xfc')],'as':_0xa66f('0xfd'),'raw':!![]}]});}}})[_0xa66f('0x34')](function(_0x168d31){if(_0x168d31&&_0x168d31[_0xa66f('0xfd')]&&_0x1686df[_0xa66f('0x39')]){var _0x5a762d={'tls':{'rejectUnauthorized':![]}};if(_0x168d31['Smtp'][_0xa66f('0xfe')]){_0x5a762d[_0xa66f('0xfe')]=_0x168d31[_0xa66f('0xfd')][_0xa66f('0xfe')];}else{_0x5a762d[_0xa66f('0xff')]=_0x168d31[_0xa66f('0xfd')]['host'];_0x5a762d[_0xa66f('0x100')]=_0x168d31[_0xa66f('0xfd')]['port'];_0x5a762d[_0xa66f('0x101')]=_0x168d31['Smtp'][_0xa66f('0x101')];}if(_0x168d31['Smtp']['authentication']){_0x5a762d[_0xa66f('0x102')]={'user':_0x168d31[_0xa66f('0xfd')][_0xa66f('0x9f')],'pass':_0x168d31[_0xa66f('0xfd')][_0xa66f('0x103')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x5a762d,'message':{'from':util[_0xa66f('0xe9')](_0xa66f('0x104'),_0x168d31[_0xa66f('0x37')],_0x168d31['email']||_0x168d31['Smtp']['user']),'to':_0x1686df[_0xa66f('0x39')][_0xa66f('0x105')],'subject':_0xa66f('0x106'),'text':util[_0xa66f('0xe9')](_0xa66f('0x107'),_0x1686df[_0xa66f('0x39')]['mailTranscript']),'attachments':[{'path':_0x1b78fa}]}})[_0xa66f('0x34')](function(){return _0x2a03c8;})[_0xa66f('0x26')](function(_0x3215af){console['error'](_0x3215af);});}else{return _0x2a03c8;}})[_0xa66f('0x34')](respondWithStatusCode(_0x1889f4,0xc8))[_0xa66f('0x26')](handleError(_0x1889f4,null));};exports['addMessage']=function(_0x4e4b66,_0x2aaaab,_0x75d882){return db[_0xa66f('0x108')][_0xa66f('0x77')]({'where':{'id':_0x4e4b66['params']['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0x2aaaab,null))[_0xa66f('0x34')](function(_0x21e1d1){if(_0x21e1d1){return _0x21e1d1[_0xa66f('0x109')](_0x4e4b66[_0xa66f('0x39')]['ids'],_[_0xa66f('0x10a')](_0x4e4b66[_0xa66f('0x39')],[_0xa66f('0x10b'),'id'])||{});}})['then'](respondWithResult(_0x2aaaab,null))[_0xa66f('0x26')](handleError(_0x2aaaab,null));};exports[_0xa66f('0x10c')]=function(_0x53170d,_0x5d1e51,_0x3c3aff){var _0x3fb295={'raw':![],'where':{}};var _0x57c403={};var _0x31832f={'count':0x0,'rows':[]};return db[_0xa66f('0x43')][_0xa66f('0xc3')]({'where':{'id':_0x53170d[_0xa66f('0xbe')]['id']}})['then'](handleEntityNotFound(_0x5d1e51,null))[_0xa66f('0x34')](function(_0x43cc99){if(_0x43cc99){_0x57c403['model']=_[_0xa66f('0x49')](db[_0xa66f('0x108')]['rawAttributes']);_0x57c403['query']=_['keys'](_0x53170d[_0xa66f('0x4a')]);_0x57c403[_0xa66f('0x4b')]=_[_0xa66f('0x4c')](_0x57c403[_0xa66f('0x48')],_0x57c403[_0xa66f('0x4a')]);_0x3fb295['attributes']=_[_0xa66f('0x4c')](_0x57c403[_0xa66f('0x48')],qs['fields'](_0x53170d['query']['fields']));_0x3fb295[_0xa66f('0x4e')]=_0x3fb295[_0xa66f('0x4e')][_0xa66f('0x4f')]?_0x3fb295['attributes']:_0x57c403[_0xa66f('0x48')];if(!_0x53170d[_0xa66f('0x4a')][_0xa66f('0x50')]('nolimit')){_0x3fb295[_0xa66f('0x2e')]=qs[_0xa66f('0x2e')](_0x53170d[_0xa66f('0x4a')]['limit']);_0x3fb295[_0xa66f('0x2b')]=qs[_0xa66f('0x2b')](_0x53170d[_0xa66f('0x4a')][_0xa66f('0x2b')]);}_0x3fb295[_0xa66f('0x52')]=qs[_0xa66f('0x53')](_0x53170d[_0xa66f('0x4a')][_0xa66f('0x53')]);_0x3fb295['where']=qs[_0xa66f('0x4b')](_[_0xa66f('0x55')](_0x53170d[_0xa66f('0x4a')],_0x57c403[_0xa66f('0x4b')]));_0x3fb295[_0xa66f('0x54')][_0xa66f('0xbb')]=_0x43cc99['id'];if(_0x53170d[_0xa66f('0x4a')][_0xa66f('0x8d')]){_0x3fb295[_0xa66f('0x54')]=_[_0xa66f('0x10d')](_0x3fb295[_0xa66f('0x54')],{'$or':_[_0xa66f('0x42')](_0x3fb295[_0xa66f('0x4e')],function(_0x2b9a3c){var _0x1d688a={};_0x1d688a[_0x2b9a3c]={'$like':'%'+_0x53170d[_0xa66f('0x4a')][_0xa66f('0x8d')]+'%'};return _0x1d688a;})});}if(_0x53170d['query'][_0xa66f('0x84')]){var _0x570a01=_0x53170d['query']['$gte'][_0xa66f('0x3f')](',');var _0x35919e={};_0x35919e[_0x570a01[0x0]]={'$gte':moment(_0x570a01[0x1])[_0xa66f('0xe9')](_0xa66f('0x10e'))};_0x3fb295[_0xa66f('0x54')]=_['merge'](_0x3fb295[_0xa66f('0x54')],_0x35919e);}_0x3fb295=_['merge']({},_0x3fb295,_0x53170d[_0xa66f('0x10f')]);return db[_0xa66f('0x108')]['count']({'where':_0x3fb295['where']})[_0xa66f('0x34')](function(_0x3517eb){_0x31832f[_0xa66f('0x2d')]=_0x3517eb;if(_0x53170d[_0xa66f('0x4a')][_0xa66f('0xbf')]){_0x3fb295['include']=[{'all':!![]}];}return db[_0xa66f('0x108')]['findAll'](_0x3fb295);})[_0xa66f('0x34')](function(_0x24c209){_0x31832f[_0xa66f('0xbd')]=_0x24c209;return _0x31832f;});}})[_0xa66f('0x34')](respondWithFilteredResult(_0x5d1e51,_0x3fb295))[_0xa66f('0x26')](handleError(_0x5d1e51,null));};exports[_0xa66f('0x110')]=function(_0x1ef4c2,_0x21ec7f,_0x32b1c1){var _0x4ee9a3={'where':{}},_0x12889f={},_0xc813ad={'count':0x0,'rows':[]};return db[_0xa66f('0x43')]['findOne']({'where':{'id':_0x1ef4c2['params']['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0x21ec7f,null))[_0xa66f('0x34')](function(_0x3a1e4a){if(_0x3a1e4a){_0x12889f['model']=_[_0xa66f('0x49')](db[_0xa66f('0x108')]['rawAttributes']);_0x12889f[_0xa66f('0x4a')]=_[_0xa66f('0x49')](_0x1ef4c2[_0xa66f('0x4a')]);_0x12889f[_0xa66f('0x4b')]=_[_0xa66f('0x4c')](_0x12889f[_0xa66f('0x48')],_0x12889f[_0xa66f('0x4a')]);_0x4ee9a3[_0xa66f('0x4e')]=_[_0xa66f('0x4c')](_0x12889f[_0xa66f('0x48')],qs[_0xa66f('0x4d')](_0x1ef4c2[_0xa66f('0x4a')]['fields']));_0x4ee9a3[_0xa66f('0x4e')]=_0x4ee9a3[_0xa66f('0x4e')][_0xa66f('0x4f')]?_0x4ee9a3[_0xa66f('0x4e')]:_0x12889f['model'];if(!_0x1ef4c2[_0xa66f('0x4a')]['hasOwnProperty'](_0xa66f('0x51'))){_0x4ee9a3[_0xa66f('0x2e')]=qs['limit'](_0x1ef4c2['query'][_0xa66f('0x2e')]);_0x4ee9a3[_0xa66f('0x2b')]=qs[_0xa66f('0x2b')](_0x1ef4c2[_0xa66f('0x4a')][_0xa66f('0x2b')]);}_0x4ee9a3[_0xa66f('0x52')]=qs['sort'](_0x1ef4c2['query']['sort']);_0x4ee9a3[_0xa66f('0x54')]=qs[_0xa66f('0x4b')](_[_0xa66f('0x55')](_0x1ef4c2[_0xa66f('0x4a')],_0x12889f[_0xa66f('0x4b')]));_0x4ee9a3['where'][_0xa66f('0xbb')]=_0x3a1e4a['id'];if(_0x1ef4c2['query'][_0xa66f('0x8d')]){_0x4ee9a3[_0xa66f('0x54')]=_[_0xa66f('0x10d')](_0x4ee9a3['where'],{'$or':_['map'](_0x4ee9a3[_0xa66f('0x4e')],function(_0x2bf349){var _0x211ac6={};_0x211ac6[_0x2bf349]={'$like':'%'+_0x1ef4c2[_0xa66f('0x4a')][_0xa66f('0x8d')]+'%'};return _0x211ac6;})});}_0x4ee9a3[_0xa66f('0x54')]['secret']=![];if(_0x1ef4c2[_0xa66f('0x4a')]['id']){_0x4ee9a3['where']['id']={'$gt':_0x1ef4c2['query']['id']};}_0x4ee9a3=_[_0xa66f('0x10d')]({},_0x4ee9a3,_0x1ef4c2[_0xa66f('0x10f')]);return db[_0xa66f('0x108')]['count']({'where':_0x4ee9a3['where']})['then'](function(_0x533dc1){_0xc813ad[_0xa66f('0x2d')]=_0x533dc1;_0x4ee9a3[_0xa66f('0x111')]=[];if(_0x1ef4c2[_0xa66f('0x4a')][_0xa66f('0x112')]){_0x4ee9a3[_0xa66f('0x111')][_0xa66f('0x41')]({'model':db[_0xa66f('0xee')],'as':_0xa66f('0xee'),'attributes':['id',_0xa66f('0xca'),_0xa66f('0x113')]});}if(_0x1ef4c2[_0xa66f('0x4a')][_0xa66f('0xbf')]){_0x4ee9a3[_0xa66f('0x111')]=[{'all':!![]}];}return db[_0xa66f('0x108')]['findAll'](_0x4ee9a3);})['then'](function(_0x554ba6){_0xc813ad[_0xa66f('0xbd')]=_0x554ba6;return _0xc813ad;});}})[_0xa66f('0x34')](respondWithFilteredResult(_0x21ec7f,_0x4ee9a3))[_0xa66f('0x26')](handleError(_0x21ec7f,null));};exports[_0xa66f('0x114')]=function(_0x1a3bac,_0x44649c,_0x5e4fbc){return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x1a3bac[_0xa66f('0xbe')]['id']}})['then'](handleEntityNotFound(_0x44649c,null))[_0xa66f('0x34')](function(_0x1d2967){if(_0x1d2967){return _0x1d2967[_0xa66f('0x115')](_0x1a3bac[_0xa66f('0x39')][_0xa66f('0x10b')],_[_0xa66f('0x10a')](_0x1a3bac[_0xa66f('0x39')],[_0xa66f('0x10b'),'id'])||{})['spread'](function(){return db[_0xa66f('0x7a')][_0xa66f('0x116')]({'attributes':['id','name',_0xa66f('0x117')],'where':{'id':_0x1a3bac[_0xa66f('0x39')][_0xa66f('0x10b')]}});})['then'](function(_0x367549){socket[_0xa66f('0x118')](_0xa66f('0x119'),{'id':Number(_0x1a3bac['params']['id']),'tags':_0x367549||[]});return{'id':Number(_0x1a3bac[_0xa66f('0xbe')]['id']),'tags':_0x367549||[]};});}})[_0xa66f('0x34')](respondWithResult(_0x44649c,null))[_0xa66f('0x26')](handleError(_0x44649c,null));};exports[_0xa66f('0x11a')]=function(_0x4a1613,_0x324b7e,_0x1d3395){return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0x4a1613[_0xa66f('0xbe')]['id']}})[_0xa66f('0x34')](handleEntityNotFound(_0x324b7e,null))[_0xa66f('0x34')](function(_0x33f1ea){if(_0x33f1ea){return _0x33f1ea[_0xa66f('0x11a')](_0x4a1613[_0xa66f('0x4a')]['ids']);}})[_0xa66f('0x34')](respondWithStatusCode(_0x324b7e,null))['catch'](handleError(_0x324b7e,null));};exports[_0xa66f('0x11b')]=function(_0xd7dccf,_0x2b4238){var _0x321fa1=moment()['unix']()['toString']();var _0x254599=path[_0xa66f('0xe5')](config[_0xa66f('0xe3')],_0xa66f('0x11c'),_0xa66f('0x11d'),_0xa66f('0x11e'));var _0x3b9ff3=path['join'](config[_0xa66f('0xe3')],_0xa66f('0x11c'),'files',_0xa66f('0x11f'));var _0x5206a5=path['join'](_0x254599,_0x321fa1);var _0x6b60bd=util[_0xa66f('0xe9')](_0xa66f('0x120'),_0xd7dccf['params']['id'],_0x321fa1);var _0x3709b6=path['join'](_0x254599,_0x6b60bd);var _0x21bda3=[];_0x21bda3[_0xa66f('0x41')]({'model':db['User'],'as':_0xa66f('0xee'),'attributes':['id',_0xa66f('0xca')],'raw':!![]});_0x21bda3[_0xa66f('0x41')]({'model':db[_0xa66f('0xef')],'as':_0xa66f('0x72'),'attributes':['id',_0xa66f('0x121'),_0xa66f('0x122')],'raw':!![]});if(_0xd7dccf['query'][_0xa66f('0x11f')]){_0x21bda3[_0xa66f('0x41')]({'model':db['Attachment'],'as':_0xa66f('0xdf'),'raw':!![]});}var _0x22e7a6=[{'model':db[_0xa66f('0x108')],'as':_0xa66f('0xed'),'attributes':['id',_0xa66f('0x39'),_0xa66f('0x123'),_0xa66f('0xfb'),_0xa66f('0x124'),_0xa66f('0x125')],'include':_0x21bda3}];_0x22e7a6[_0xa66f('0x41')]({'model':db[_0xa66f('0xc4')],'as':_0xa66f('0x126'),'attributes':['id','name']});_0x22e7a6[_0xa66f('0x41')]({'model':db['User'],'as':_0xa66f('0x127'),'attributes':['id',_0xa66f('0xca')]});return db[_0xa66f('0x43')][_0xa66f('0x77')]({'where':{'id':_0xd7dccf[_0xa66f('0xbe')]['id']},'include':_0x22e7a6})[_0xa66f('0x34')](handleEntityNotFound(_0x2b4238,null))[_0xa66f('0x34')](function(_0x5efd6c){if(_0x5efd6c){var _0x24ee72=_0x5efd6c['get']({'plain':!![]});fs[_0xa66f('0x128')](_0x5206a5);var _0xdbb792={'channel':_0xa66f('0x129'),'account':_0x24ee72['Account'][_0xa66f('0x37')],'agent':_0x24ee72[_0xa66f('0x127')]?_0x24ee72['Owner']['fullname']:_0xa66f('0x12a'),'createdAt':moment(_0x24ee72[_0xa66f('0x123')])[_0xa66f('0xe9')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa66f('0xa3')](),'closedAt':_0x24ee72[_0xa66f('0xd8')]?moment(_0x24ee72[_0xa66f('0x12b')])['format'](_0xa66f('0x10e'))[_0xa66f('0xa3')]():'','disposition':_0x24ee72[_0xa66f('0xd9')],'chatInfo':{'browser':_0x24ee72[_0xa66f('0x12c')],'os':_0x24ee72[_0xa66f('0x12d')],'referer':_0x24ee72['referer'],'customerIp':_0x24ee72[_0xa66f('0x12e')],'customerPort':_0x24ee72[_0xa66f('0x12f')]?_0x24ee72[_0xa66f('0x12f')]:_0xa66f('0x12a')},'messages':_(_0x24ee72[_0xa66f('0xed')])[_0xa66f('0x130')]()['filter']({'secret':![]})[_0xa66f('0x42')](function(_0x31cc20){if(_0x31cc20['Attachment']){var _0x10a611=path[_0xa66f('0xe5')](_0x3b9ff3,_0x31cc20['Attachment'][_0xa66f('0xe6')]);if(fs[_0xa66f('0x131')](_0x10a611)){fs[_0xa66f('0x132')](_0x10a611)['pipe'](fs[_0xa66f('0x133')](path['join'](_0x5206a5,_0x31cc20['Attachment']['basename'])));}}return{'date':moment(_0x31cc20['createdAt'])['format'](_0xa66f('0x10e'))['toString'](),'sender':_0x31cc20[_0xa66f('0xfb')]===_0xa66f('0xd3')?_0x31cc20[_0xa66f('0xee')]?_0x31cc20[_0xa66f('0xee')][_0xa66f('0xca')]:_0xa66f('0xf3'):_0x31cc20[_0xa66f('0x72')][_0xa66f('0x121')]+(_0x31cc20[_0xa66f('0x72')][_0xa66f('0x122')]?'\x20'+_0x31cc20[_0xa66f('0x72')][_0xa66f('0x122')]:''),'body':_0x31cc20[_0xa66f('0xdf')]?_0x31cc20[_0xa66f('0xdf')][_0xa66f('0xe6')]:_0x31cc20[_0xa66f('0x39')],'direction':_0x31cc20[_0xa66f('0xfb')]==='out'?'A':'C','secret':_0x31cc20['secret'],'read':_0x31cc20[_0xa66f('0x125')],'attachment':_0x31cc20[_0xa66f('0xdf')]};})[_0xa66f('0x6e')]()};return ejs[_0xa66f('0x134')](path[_0xa66f('0xe5')](config[_0xa66f('0xe3')],_0xa66f('0x11c'),'views',_0xa66f('0x135')),{'interaction':_0xdbb792})['then'](function(_0x12024d){var _0x4baf59=path[_0xa66f('0xe5')](_0x5206a5,_0xa66f('0x136')+_0x24ee72['id']+'-'+_0x321fa1+'.pdf');var _0x33198c={'path':_0x4baf59,'channel':_0xa66f('0x129'),'interactionId':_0x24ee72['id']};return pdf[_0xa66f('0x137')](_0x12024d,_0x33198c);})[_0xa66f('0x34')](function(){return new BPromise(function(_0x3792b2,_0x5101f8){zipdir(_0x5206a5,{'saveTo':_0x3709b6},function(_0x4ac4b4,_0x171111){if(_0x4ac4b4)return _0x5101f8(_0x4ac4b4);return _0x3792b2(_0x171111);});})[_0xa66f('0x34')](function(){return new BPromise(function(_0x46691d,_0x136518){rimraf(_0x5206a5,function(_0x1404df){if(_0x1404df)_0x136518(_0x1404df);return _0x46691d();});});})[_0xa66f('0x34')](function(){return _0x2b4238[_0xa66f('0x11b')](_0x3709b6,_0x6b60bd,function(_0x58f445){if(_0x58f445){console[_0xa66f('0x138')](_0xa66f('0x139'),_0x58f445);}else{fs['unlinkSync'](_0x3709b6);}});});});}else{return _0x2b4238[_0xa66f('0x27')](0xc8);}})['catch'](handleError(_0x2b4238,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 051b8cb..9798f2c 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 _0x3a90=['Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','save','update','getUsers','setDataValue'];(function(_0x544a7b,_0x388672){var _0x1c8701=function(_0x448d61){while(--_0x448d61){_0x544a7b['push'](_0x544a7b['shift']());}};_0x1c8701(++_0x388672);}(_0x3a90,0x1ad));var _0x03a9=function(_0x5236e2,_0x18e12){_0x5236e2=_0x5236e2-0x0;var _0x22f044=_0x3a90[_0x5236e2];return _0x22f044;};'use strict';var EventEmitter=require(_0x03a9('0x0'));var ChatInteraction=require(_0x03a9('0x1'))['db'][_0x03a9('0x2')];var ChatMessage=require('../../mysqldb')['db'][_0x03a9('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x03a9('0x4'),'afterUpdate':_0x03a9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x9646ca){return function(_0x31629f,_0xc70f63,_0x1837bc){_0x31629f[_0x03a9('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x12dfb0){_0x31629f[_0x03a9('0x7')](_0x03a9('0x8'),_0x12dfb0[_0x03a9('0x9')](function(_0x40994b){return{'id':_0x40994b['id']};}));return ChatMessage[_0x03a9('0xa')]({'where':{'ChatInteractionId':_0x31629f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x03a9('0xb')](function(_0x830798){_0x31629f[_0x03a9('0x7')](_0x03a9('0xc'),_0x830798[_0x03a9('0xd')]);ChatInteractionEvents[_0x03a9('0xe')](_0x9646ca+':'+_0x31629f['id'],_0x31629f);ChatInteractionEvents['emit'](_0x9646ca,_0x31629f);_0x1837bc(null);})[_0x03a9('0xf')](_0x1837bc(null));};}for(var e in events){if(events[_0x03a9('0x10')](e)){var event=events[e];ChatInteraction[_0x03a9('0x11')](e,emitEvent(event));}}module[_0x03a9('0x12')]=ChatInteractionEvents; \ No newline at end of file +var _0x0041=['remove','getUsers','map','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','../../mysqldb','ChatInteraction','save','update'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x0041,0x1be));var _0x1004=function(_0x14b78b,_0x540ed0){_0x14b78b=_0x14b78b-0x0;var _0x590e43=_0x0041[_0x14b78b];return _0x590e43;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x1004('0x0'))['db'][_0x1004('0x1')];var ChatMessage=require(_0x1004('0x0'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1004('0x2'),'afterUpdate':_0x1004('0x3'),'afterDestroy':_0x1004('0x4')};function emitEvent(_0x3b70ab){return function(_0x82255,_0x8932bd,_0x1fde22){_0x82255[_0x1004('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3027f9){_0x82255['setDataValue']('Users',_0x3027f9[_0x1004('0x6')](function(_0x7b0229){return{'id':_0x7b0229['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x82255['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1004('0x7')](function(_0x2ca931){_0x82255[_0x1004('0x8')](_0x1004('0x9'),_0x2ca931[_0x1004('0xa')]);ChatInteractionEvents[_0x1004('0xb')](_0x3b70ab+':'+_0x82255['id'],_0x82255);ChatInteractionEvents['emit'](_0x3b70ab,_0x82255);_0x1fde22(null);})[_0x1004('0xc')](_0x1fde22(null));};}for(var e in events){if(events[_0x1004('0xd')](e)){var event=events[e];ChatInteraction[_0x1004('0xe')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 18f3767..fb07e4e 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 _0x8313=['rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','../../config/logger','moment','path'];(function(_0x1d8ef2,_0x1b22f7){var _0x4a1c25=function(_0x49405f){while(--_0x49405f){_0x1d8ef2['push'](_0x1d8ef2['shift']());}};_0x4a1c25(++_0x1b22f7);}(_0x8313,0x14d));var _0x3831=function(_0x357a74,_0xe8550f){_0x357a74=_0x357a74-0x0;var _0x17dfe5=_0x8313[_0x357a74];return _0x17dfe5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3831('0x0'))('api');var moment=require(_0x3831('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3831('0x2'));var rimraf=require(_0x3831('0x3'));var config=require(_0x3831('0x4'));var attributes=require(_0x3831('0x5'));module[_0x3831('0x6')]=function(_0x57e186,_0x4d26cf){return _0x57e186[_0x3831('0x7')](_0x3831('0x8'),attributes,{'tableName':_0x3831('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x60479e,_0x1b12ae,_0x160376){if(_0x60479e[_0x3831('0xa')](_0x3831('0xb'))){_0x60479e[_0x3831('0xc')]=moment()[_0x3831('0xd')](_0x3831('0xe'));}_0x160376(null,_0x60479e);}},'charset':_0x3831('0xf'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc2ee=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util'];(function(_0x95419c,_0x2dc306){var _0x3cb730=function(_0x7cdced){while(--_0x7cdced){_0x95419c['push'](_0x95419c['shift']());}};_0x3cb730(++_0x2dc306);}(_0xc2ee,0x10e));var _0xec2e=function(_0x3f27e7,_0x3b85ba){_0x3f27e7=_0x3f27e7-0x0;var _0x5f1a51=_0xc2ee[_0x3f27e7];return _0x5f1a51;};'use strict';var _=require(_0xec2e('0x0'));var util=require(_0xec2e('0x1'));var logger=require(_0xec2e('0x2'))(_0xec2e('0x3'));var moment=require(_0xec2e('0x4'));var BPromise=require(_0xec2e('0x5'));var rp=require(_0xec2e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xec2e('0x7'));var attributes=require(_0xec2e('0x8'));module[_0xec2e('0x9')]=function(_0x5584a3,_0x27f7fc){return _0x5584a3[_0xec2e('0xa')]('ChatInteraction',attributes,{'tableName':_0xec2e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x427d63,_0x2038f7,_0x43b5f3){if(_0x427d63['changed'](_0xec2e('0xc'))){_0x427d63[_0xec2e('0xd')]=moment()[_0xec2e('0xe')](_0xec2e('0xf'));}_0x43b5f3(null,_0x427d63);}},'charset':'utf8mb4','collate':_0xec2e('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 60e7e65..1b9cf3e 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 _0x6026=['rpc','jayson/promise','client','redis','defaults','localhost','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','limit','AddTagsToChatInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2958bf,_0x1d242c){var _0x454512=function(_0x4be22a){while(--_0x4be22a){_0x2958bf['push'](_0x2958bf['shift']());}};_0x454512(++_0x1d242c);}(_0x6026,0x76));var _0x6602=function(_0x2f2f8c,_0x12e3a5){_0x2f2f8c=_0x2f2f8c-0x0;var _0x26da09=_0x6026[_0x2f2f8c];return _0x26da09;};'use strict';var _=require(_0x6602('0x0'));var util=require(_0x6602('0x1'));var moment=require(_0x6602('0x2'));var BPromise=require(_0x6602('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6602('0x4'));var db=require(_0x6602('0x5'))['db'];var utils=require(_0x6602('0x6'));var logger=require(_0x6602('0x7'))(_0x6602('0x8'));var config=require('../../config/environment');var jayson=require(_0x6602('0x9'));var client=jayson[_0x6602('0xa')]['http']({'port':0x232a});config[_0x6602('0xb')]=_[_0x6602('0xc')](config['redis'],{'host':_0x6602('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6602('0xe'))[_0x6602('0xf')](socket);function respondWithRpcPromise(_0x5d3d6b,_0x4c6b42,_0x4d9b20){return new BPromise(function(_0x82c1fa,_0x563149){return client[_0x6602('0x10')](_0x5d3d6b,_0x4d9b20)[_0x6602('0x11')](function(_0x280316){logger[_0x6602('0x12')](_0x6602('0x13'),_0x4c6b42,'request\x20sent');logger[_0x6602('0x14')](_0x6602('0x15'),_0x4c6b42,'request\x20sent',JSON[_0x6602('0x16')](_0x280316));if(_0x280316[_0x6602('0x17')]){if(_0x280316[_0x6602('0x17')]['code']===0x1f4){logger[_0x6602('0x17')](_0x6602('0x13'),_0x4c6b42,_0x280316[_0x6602('0x17')][_0x6602('0x18')]);return _0x563149(_0x280316[_0x6602('0x17')][_0x6602('0x18')]);}logger[_0x6602('0x17')](_0x6602('0x13'),_0x4c6b42,_0x280316[_0x6602('0x17')][_0x6602('0x18')]);return _0x82c1fa(_0x280316['error']['message']);}else{logger[_0x6602('0x12')]('ChatInteraction,\x20%s,\x20%s',_0x4c6b42,_0x6602('0x19'));_0x82c1fa(_0x280316[_0x6602('0x1a')][_0x6602('0x18')]);}})[_0x6602('0x1b')](function(_0x5967a5){logger[_0x6602('0x17')](_0x6602('0x13'),_0x4c6b42,_0x5967a5);_0x563149(_0x5967a5);});});}exports[_0x6602('0x1c')]=function(_0x355df3){var _0x29c5dc=this;return new Promise(function(_0x55ec0c,_0x381ed8){return db[_0x6602('0x1d')][_0x6602('0x1e')](_0x355df3[_0x6602('0x1f')],{'raw':_0x355df3['options']?_0x355df3['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x355df3[_0x6602('0x20')]?_0x355df3[_0x6602('0x20')]['where']||null:null,'attributes':_0x355df3[_0x6602('0x20')]?_0x355df3[_0x6602('0x20')]['attributes']||null:null,'limit':_0x355df3[_0x6602('0x20')]?_0x355df3['options'][_0x6602('0x21')]||null:null})[_0x6602('0x11')](function(_0x235f52){logger[_0x6602('0x12')](_0x6602('0x1c'),_0x355df3);logger['debug'](_0x6602('0x1c'),_0x355df3,JSON[_0x6602('0x16')](_0x235f52));_0x55ec0c(_0x235f52);})['catch'](function(_0x987292){logger['error']('UpdateChatInteraction',_0x987292[_0x6602('0x18')],_0x355df3);_0x381ed8(_0x29c5dc[_0x6602('0x17')](0x1f4,_0x987292['message']));});});};exports[_0x6602('0x22')]=function(_0x596c71){return new Promise(function(_0x13b783,_0x25045f){return db['ChatInteraction'][_0x6602('0x23')]({'where':_0x596c71[_0x6602('0x20')]?_0x596c71[_0x6602('0x20')][_0x6602('0x24')]||null:null})['then'](function(_0xb9d616){if(_0xb9d616){return _0xb9d616[_0x6602('0x25')](_0x596c71[_0x6602('0x1f')][_0x6602('0x26')],_[_0x6602('0x27')](_0x596c71['body'],['ids','id'])||{});}})[_0x6602('0x28')](function(_0x31269e){logger[_0x6602('0x12')]('AddTags',_0x596c71);logger['debug'](_0x6602('0x29'),_0x596c71,JSON[_0x6602('0x16')](_0x31269e));_0x13b783(_0x31269e);})[_0x6602('0x1b')](function(_0x1ca417){logger[_0x6602('0x17')]('AddTags',_0x1ca417['message'],_0x596c71);_0x25045f(_this[_0x6602('0x17')](0x1f4,_0x1ca417[_0x6602('0x18')]));});});}; \ No newline at end of file +var _0x94b6=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatInteraction.socket','register','request','then','request\x20sent','debug','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','catch','update','options','raw','where','attributes','limit','info','UpdateChatInteraction','AddTagsToChatInteraction','ChatInteraction','addTags','body','ids','spread','AddTags'];(function(_0x412e45,_0x593523){var _0x317943=function(_0x5716d5){while(--_0x5716d5){_0x412e45['push'](_0x412e45['shift']());}};_0x317943(++_0x593523);}(_0x94b6,0x11f));var _0x694b=function(_0x4b174a,_0x33a017){_0x4b174a=_0x4b174a-0x0;var _0x3cd7bf=_0x94b6[_0x4b174a];return _0x3cd7bf;};'use strict';var _=require(_0x694b('0x0'));var util=require('util');var moment=require(_0x694b('0x1'));var BPromise=require(_0x694b('0x2'));var rs=require(_0x694b('0x3'));var fs=require('fs');var Redis=require(_0x694b('0x4'));var db=require(_0x694b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x694b('0x6'))(_0x694b('0x7'));var config=require(_0x694b('0x8'));var jayson=require(_0x694b('0x9'));var client=jayson[_0x694b('0xa')][_0x694b('0xb')]({'port':0x232a});config[_0x694b('0xc')]=_[_0x694b('0xd')](config[_0x694b('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x694b('0xc')]));require(_0x694b('0xe'))[_0x694b('0xf')](socket);function respondWithRpcPromise(_0x287782,_0x332bb1,_0x3e01cb){return new BPromise(function(_0xfd2eab,_0x4e742d){return client[_0x694b('0x10')](_0x287782,_0x3e01cb)[_0x694b('0x11')](function(_0x142d15){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x332bb1,_0x694b('0x12'));logger[_0x694b('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x332bb1,_0x694b('0x12'),JSON[_0x694b('0x14')](_0x142d15));if(_0x142d15[_0x694b('0x15')]){if(_0x142d15[_0x694b('0x15')][_0x694b('0x16')]===0x1f4){logger[_0x694b('0x15')](_0x694b('0x17'),_0x332bb1,_0x142d15['error'][_0x694b('0x18')]);return _0x4e742d(_0x142d15[_0x694b('0x15')][_0x694b('0x18')]);}logger['error'](_0x694b('0x17'),_0x332bb1,_0x142d15[_0x694b('0x15')][_0x694b('0x18')]);return _0xfd2eab(_0x142d15[_0x694b('0x15')]['message']);}else{logger['info'](_0x694b('0x17'),_0x332bb1,_0x694b('0x12'));_0xfd2eab(_0x142d15['result'][_0x694b('0x18')]);}})[_0x694b('0x19')](function(_0x155e12){logger['error'](_0x694b('0x17'),_0x332bb1,_0x155e12);_0x4e742d(_0x155e12);});});}exports['UpdateChatInteraction']=function(_0x1fb474){var _0x3ffb32=this;return new Promise(function(_0xf9a698,_0x3d9802){return db['ChatInteraction'][_0x694b('0x1a')](_0x1fb474['body'],{'raw':_0x1fb474[_0x694b('0x1b')]?_0x1fb474[_0x694b('0x1b')][_0x694b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fb474['options']?_0x1fb474[_0x694b('0x1b')][_0x694b('0x1d')]||null:null,'attributes':_0x1fb474[_0x694b('0x1b')]?_0x1fb474[_0x694b('0x1b')][_0x694b('0x1e')]||null:null,'limit':_0x1fb474[_0x694b('0x1b')]?_0x1fb474['options'][_0x694b('0x1f')]||null:null})[_0x694b('0x11')](function(_0xe05741){logger[_0x694b('0x20')](_0x694b('0x21'),_0x1fb474);logger[_0x694b('0x13')](_0x694b('0x21'),_0x1fb474,JSON[_0x694b('0x14')](_0xe05741));_0xf9a698(_0xe05741);})[_0x694b('0x19')](function(_0x30086b){logger['error'](_0x694b('0x21'),_0x30086b[_0x694b('0x18')],_0x1fb474);_0x3d9802(_0x3ffb32[_0x694b('0x15')](0x1f4,_0x30086b[_0x694b('0x18')]));});});};exports[_0x694b('0x22')]=function(_0x4eba0d){return new Promise(function(_0xbdaf10,_0x4e65f0){return db[_0x694b('0x23')]['find']({'where':_0x4eba0d[_0x694b('0x1b')]?_0x4eba0d[_0x694b('0x1b')][_0x694b('0x1d')]||null:null})[_0x694b('0x11')](function(_0x2d34ef){if(_0x2d34ef){return _0x2d34ef[_0x694b('0x24')](_0x4eba0d[_0x694b('0x25')][_0x694b('0x26')],_['omit'](_0x4eba0d['body'],['ids','id'])||{});}})[_0x694b('0x27')](function(_0x46c141){logger[_0x694b('0x20')](_0x694b('0x28'),_0x4eba0d);logger[_0x694b('0x13')](_0x694b('0x28'),_0x4eba0d,JSON[_0x694b('0x14')](_0x46c141));_0xbdaf10(_0x46c141);})[_0x694b('0x19')](function(_0x113c1a){logger['error']('AddTags',_0x113c1a[_0x694b('0x18')],_0x4eba0d);_0x4e65f0(_this['error'](0x1f4,_0x113c1a['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 0ca4c17..d757b95 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 _0x9d2d=['update','emit','removeListener','register','chatInteraction:','save','remove'];(function(_0x4d22b8,_0x4f1c0b){var _0x233467=function(_0x50ac2c){while(--_0x50ac2c){_0x4d22b8['push'](_0x4d22b8['shift']());}};_0x233467(++_0x4f1c0b);}(_0x9d2d,0x124));var _0xd9d2=function(_0x31d279,_0x24f8d7){_0x31d279=_0x31d279-0x0;var _0x107618=_0x9d2d[_0x31d279];return _0x107618;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xd9d2('0x0'),_0xd9d2('0x1'),_0xd9d2('0x2')];function createListener(_0x1fe802,_0x348c9d){return function(_0x406dc9){_0x348c9d[_0xd9d2('0x3')](_0x1fe802,_0x406dc9);};}function removeListener(_0x10f4bf,_0x420ef6){return function(){ChatInteractionEvents[_0xd9d2('0x4')](_0x10f4bf,_0x420ef6);};}exports[_0xd9d2('0x5')]=function(_0x8f3c05){for(var _0x2288db=0x0,_0x559ae0=events['length'];_0x2288db<_0x559ae0;_0x2288db++){var _0x5d49df=events[_0x2288db];var _0x195f06=createListener(_0xd9d2('0x6')+_0x5d49df,_0x8f3c05);ChatInteractionEvents['on'](_0x5d49df,_0x195f06);}}; \ No newline at end of file +var _0x27f3=['remove','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x27f3,0x1d8));var _0x327f=function(_0x3a2a3c,_0x37bd31){_0x3a2a3c=_0x3a2a3c-0x0;var _0x50ac9a=_0x27f3[_0x3a2a3c];return _0x50ac9a;};'use strict';var ChatInteractionEvents=require(_0x327f('0x0'));var events=[_0x327f('0x1'),_0x327f('0x2'),'update'];function createListener(_0x527cb7,_0x403508){return function(_0x7545ce){_0x403508['emit'](_0x527cb7,_0x7545ce);};}function removeListener(_0x220b04,_0x917e13){return function(){ChatInteractionEvents['removeListener'](_0x220b04,_0x917e13);};}exports[_0x327f('0x3')]=function(_0x39f8eb){for(var _0x4cfd58=0x0,_0x54d325=events[_0x327f('0x4')];_0x4cfd58<_0x54d325;_0x4cfd58++){var _0x52a6ca=events[_0x4cfd58];var _0x21e12b=createListener(_0x327f('0x5')+_0x52a6ca,_0x39f8eb);ChatInteractionEvents['on'](_0x52a6ca,_0x21e12b);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index f7ec1fe..b34a350 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 _0x9fcd=['chatinteraction:destroy','destroy','delete','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','isAuthenticated','getMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','customUpdate','/:id/abandon','abandon','/:id/close','close'];(function(_0x2cf4b3,_0x3d8c66){var _0x4b72a8=function(_0x56c54d){while(--_0x56c54d){_0x2cf4b3['push'](_0x2cf4b3['shift']());}};_0x4b72a8(++_0x3d8c66);}(_0x9fcd,0x6a));var _0xd9fc=function(_0x4a36dd,_0x9d6dc4){_0x4a36dd=_0x4a36dd-0x0;var _0x59287a=_0x9fcd[_0x4a36dd];return _0x59287a;};'use strict';var multer=require(_0xd9fc('0x0'));var util=require(_0xd9fc('0x1'));var path=require(_0xd9fc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd9fc('0x3')]();var fs_extra=require(_0xd9fc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd9fc('0x5'));var config=require(_0xd9fc('0x6'));var controller=require('./chatInteraction.controller');router[_0xd9fc('0x7')]('/',auth['isAuthenticated'](),controller[_0xd9fc('0x8')]);router['get'](_0xd9fc('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xd9fc('0x7')](_0xd9fc('0xa'),auth['isChatInteractionAuthorized'](),controller[_0xd9fc('0xb')]);router[_0xd9fc('0x7')](_0xd9fc('0xc'),auth[_0xd9fc('0xd')](),controller[_0xd9fc('0xe')]);router[_0xd9fc('0x7')]('/:id/messages',auth[_0xd9fc('0xf')](),controller[_0xd9fc('0x10')]);router[_0xd9fc('0x7')]('/:id/my_messages',auth[_0xd9fc('0xd')](),controller['getMyMessages']);router[_0xd9fc('0x7')](_0xd9fc('0x11'),auth[_0xd9fc('0xf')](),controller[_0xd9fc('0x12')]);router[_0xd9fc('0x13')]('/',auth[_0xd9fc('0xf')](),controller[_0xd9fc('0x14')]);router[_0xd9fc('0x13')](_0xd9fc('0x15'),auth[_0xd9fc('0xf')](),controller[_0xd9fc('0x16')]);var upload=multer({'storage':multer[_0xd9fc('0x17')]({'destination':function(_0x439708,_0x47f89c,_0x503ffb){_0x503ffb(null,path[_0xd9fc('0x18')](config['root'],_0xd9fc('0x19')));},'filename':function(_0x407061,_0x3f4cea,_0x258264){_0x258264(null,util['format'](_0xd9fc('0x1a'),Date[_0xd9fc('0x1b')](),_0x3f4cea[_0xd9fc('0x1c')][_0xd9fc('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xd9fc('0x13')](_0xd9fc('0x1e'),upload[_0xd9fc('0x1f')](_0xd9fc('0x20')),controller[_0xd9fc('0x21')]);router[_0xd9fc('0x13')](_0xd9fc('0x22'),auth[_0xd9fc('0xd')](),controller[_0xd9fc('0x23')]);router[_0xd9fc('0x13')](_0xd9fc('0x24'),auth['isAuthenticated'](),interaction['tracked'](_0xd9fc('0x25'),_0xd9fc('0x26')),controller[_0xd9fc('0x27')]);router[_0xd9fc('0x28')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xd9fc('0x25'),_0xd9fc('0x29')),controller['update']);router['put']('/:id/custom_update',controller[_0xd9fc('0x2a')]);router['put'](_0xd9fc('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0xd9fc('0x2c')]);router[_0xd9fc('0x28')](_0xd9fc('0x2d'),controller[_0xd9fc('0x2e')]);router['delete']('/:id',auth[_0xd9fc('0xf')](),interaction['tracked'](_0xd9fc('0x25'),_0xd9fc('0x2f')),controller[_0xd9fc('0x30')]);router[_0xd9fc('0x31')]('/:id/tags',auth[_0xd9fc('0xf')](),controller['removeTags']);module[_0xd9fc('0x32')]=router; \ No newline at end of file +var _0xbadc=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','format','%s-%s','originalname','/:id/attachment_upload','single','file','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','/:id/custom_update','/:id/abandon','abandon','/:id/close','close','delete','destroy','removeTags','exports'];(function(_0x374cce,_0x24c130){var _0x117084=function(_0x2192cf){while(--_0x2192cf){_0x374cce['push'](_0x374cce['shift']());}};_0x117084(++_0x24c130);}(_0xbadc,0x93));var _0xcbad=function(_0x125233,_0x522bf1){_0x125233=_0x125233-0x0;var _0x42d385=_0xbadc[_0x125233];return _0x42d385;};'use strict';var multer=require(_0xcbad('0x0'));var util=require(_0xcbad('0x1'));var path=require(_0xcbad('0x2'));var timeout=require(_0xcbad('0x3'));var express=require(_0xcbad('0x4'));var router=express[_0xcbad('0x5')]();var fs_extra=require(_0xcbad('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xcbad('0x7'));var config=require('../../config/environment');var controller=require('./chatInteraction.controller');router[_0xcbad('0x8')]('/',auth[_0xcbad('0x9')](),controller['index']);router[_0xcbad('0x8')](_0xcbad('0xa'),auth['isAuthenticated'](),controller[_0xcbad('0xb')]);router[_0xcbad('0x8')](_0xcbad('0xc'),auth[_0xcbad('0xd')](),controller[_0xcbad('0xe')]);router['get'](_0xcbad('0xf'),auth[_0xcbad('0xd')](),controller[_0xcbad('0x10')]);router['get'](_0xcbad('0x11'),auth[_0xcbad('0x9')](),controller[_0xcbad('0x12')]);router[_0xcbad('0x8')](_0xcbad('0x13'),auth['isChatInteractionAuthorized'](),controller[_0xcbad('0x14')]);router[_0xcbad('0x8')]('/:id/download',auth[_0xcbad('0x9')](),controller['download']);router[_0xcbad('0x15')]('/',auth[_0xcbad('0x9')](),controller[_0xcbad('0x16')]);router[_0xcbad('0x15')](_0xcbad('0x17'),auth['isAuthenticated'](),controller[_0xcbad('0x18')]);var upload=multer({'storage':multer[_0xcbad('0x19')]({'destination':function(_0x43439c,_0x44c8fb,_0xc52857){_0xc52857(null,path['join'](config[_0xcbad('0x1a')],'server/files/attachments/'));},'filename':function(_0x235112,_0x2401ff,_0x516f42){_0x516f42(null,util[_0xcbad('0x1b')](_0xcbad('0x1c'),Date['now'](),_0x2401ff[_0xcbad('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xcbad('0x15')](_0xcbad('0x1e'),upload[_0xcbad('0x1f')](_0xcbad('0x20')),controller['attachmentUpload']);router[_0xcbad('0x15')](_0xcbad('0x11'),auth[_0xcbad('0xd')](),controller['addMessage']);router[_0xcbad('0x15')](_0xcbad('0x21'),auth[_0xcbad('0x9')](),interaction[_0xcbad('0x22')](_0xcbad('0x23'),_0xcbad('0x24')),controller[_0xcbad('0x25')]);router[_0xcbad('0x26')](_0xcbad('0xc'),auth[_0xcbad('0x9')](),interaction[_0xcbad('0x22')](_0xcbad('0x23'),_0xcbad('0x27')),controller['update']);router['put'](_0xcbad('0x28'),controller['customUpdate']);router['put'](_0xcbad('0x29'),auth[_0xcbad('0xd')](),controller[_0xcbad('0x2a')]);router[_0xcbad('0x26')](_0xcbad('0x2b'),controller[_0xcbad('0x2c')]);router[_0xcbad('0x2d')](_0xcbad('0xc'),auth[_0xcbad('0x9')](),interaction[_0xcbad('0x22')](_0xcbad('0x23'),'chatinteraction:destroy'),controller[_0xcbad('0x2e')]);router[_0xcbad('0x2d')]('/:id/tags',auth['isAuthenticated'](),controller[_0xcbad('0x2f')]);module[_0xcbad('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 67adda1..c3c081e 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 _0xc9ef=['INTEGER','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc9ef,0xe5));var _0xfc9e=function(_0x4c5cd4,_0x268643){_0x4c5cd4=_0x4c5cd4-0x0;var _0x210bcf=_0xc9ef[_0x4c5cd4];return _0x210bcf;};'use strict';var Sequelize=require(_0xfc9e('0x0'));module[_0xfc9e('0x1')]={'body':{'type':Sequelize[_0xfc9e('0x2')](_0xfc9e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xfc9e('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xfc9e('0x5')]}}; \ No newline at end of file +var _0x45b2=['exports','TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x5998d0,_0x24ad81){var _0x47149d=function(_0x5e4d63){while(--_0x5e4d63){_0x5998d0['push'](_0x5998d0['shift']());}};_0x47149d(++_0x24ad81);}(_0x45b2,0x107));var _0x245b=function(_0x4a165e,_0x1b5784){_0x4a165e=_0x4a165e-0x0;var _0x5c8fbc=_0x45b2[_0x4a165e];return _0x5c8fbc;};'use strict';var Sequelize=require(_0x245b('0x0'));module[_0x245b('0x1')]={'body':{'type':Sequelize[_0x245b('0x2')](_0x245b('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x245b('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x245b('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index e972037..99c293b 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 _0x7410=['includeAll','include','findAll','catch','show','params','find','create','body','describe','get','lastMessageAt','createdAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','user','fullname','role','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','messages','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7410,0x9b));var _0x0741=function(_0x3ac779,_0x2fb6ad){_0x3ac779=_0x3ac779-0x0;var _0x5de65d=_0x7410[_0x3ac779];return _0x5de65d;};'use strict';var emlformat=require(_0x0741('0x0'));var rimraf=require(_0x0741('0x1'));var zipdir=require(_0x0741('0x2'));var jsonpatch=require(_0x0741('0x3'));var rp=require('request-promise');var moment=require(_0x0741('0x4'));var BPromise=require(_0x0741('0x5'));var Mustache=require(_0x0741('0x6'));var util=require(_0x0741('0x7'));var path=require(_0x0741('0x8'));var sox=require(_0x0741('0x9'));var csv=require(_0x0741('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0741('0xb'));var _=require(_0x0741('0xc'));var squel=require(_0x0741('0xd'));var crypto=require(_0x0741('0xe'));var jsforce=require(_0x0741('0xf'));var deskjs=require(_0x0741('0x10'));var toCsv=require(_0x0741('0xa'));var querystring=require(_0x0741('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0741('0x12'));var qs=require(_0x0741('0x13'));var as=require(_0x0741('0x14'));var hardwareService=require(_0x0741('0x15'));var logger=require(_0x0741('0x16'))('api');var utils=require(_0x0741('0x17'));var config=require(_0x0741('0x18'));var licenseUtil=require(_0x0741('0x19'));var db=require(_0x0741('0x1a'))['db'];config[_0x0741('0x1b')]=_[_0x0741('0x1c')](config[_0x0741('0x1b')],{'host':_0x0741('0x1d'),'port':0x18eb});var socket=require(_0x0741('0x1e'))(new Redis(config[_0x0741('0x1b')]));require(_0x0741('0x1f'))['register'](socket);function respondWithStatusCode(_0x466dee,_0x57d275){_0x57d275=_0x57d275||0xcc;return function(_0x28c37b){if(_0x28c37b){return _0x466dee['sendStatus'](_0x57d275);}return _0x466dee[_0x0741('0x20')](_0x57d275)[_0x0741('0x21')]();};}function respondWithResult(_0x24e07e,_0x40599f){_0x40599f=_0x40599f||0xc8;return function(_0x18c531){if(_0x18c531){return _0x24e07e[_0x0741('0x20')](_0x40599f)[_0x0741('0x22')](_0x18c531);}};}function respondWithFilteredResult(_0x3f0082,_0x35504a){return function(_0x2e9495){if(_0x2e9495){var _0x95cf86=typeof _0x35504a[_0x0741('0x23')]===_0x0741('0x24')&&typeof _0x35504a[_0x0741('0x25')]===_0x0741('0x24');var _0x47038a=_0x2e9495[_0x0741('0x26')];var _0x318a3b=_0x95cf86?0x0:_0x35504a[_0x0741('0x23')];var _0x419867=_0x95cf86?_0x2e9495['count']:_0x35504a[_0x0741('0x23')]+_0x35504a[_0x0741('0x25')];var _0x3d86dc;if(_0x419867>=_0x47038a){_0x419867=_0x47038a;_0x3d86dc=0xc8;}else{_0x3d86dc=0xce;}_0x3f0082[_0x0741('0x20')](_0x3d86dc);return _0x3f0082[_0x0741('0x27')](_0x0741('0x28'),_0x318a3b+'-'+_0x419867+'/'+_0x47038a)[_0x0741('0x22')](_0x2e9495);}return null;};}function patchUpdates(_0x39b71d){return function(_0x580ebe){try{jsonpatch[_0x0741('0x29')](_0x580ebe,_0x39b71d,!![]);}catch(_0x33d5b6){return BPromise[_0x0741('0x2a')](_0x33d5b6);}return _0x580ebe[_0x0741('0x2b')]();};}function saveUpdates(_0x32c14e,_0x3cc9b1){return function(_0x5c0a56){if(_0x5c0a56){return _0x5c0a56[_0x0741('0x2c')](_0x32c14e)['then'](function(_0x54985a){return _0x54985a;});}return null;};}function removeEntity(_0x68e47b,_0x2bf6a1){return function(_0x1bbb88){if(_0x1bbb88){return _0x1bbb88[_0x0741('0x2d')]()[_0x0741('0x2e')](function(){_0x68e47b[_0x0741('0x20')](0xcc)[_0x0741('0x21')]();});}};}function handleEntityNotFound(_0x16e684,_0x2bebf0){return function(_0x14c035){if(!_0x14c035){_0x16e684[_0x0741('0x2f')](0x194);}return _0x14c035;};}function handleError(_0x13c07e,_0x3c02ca){_0x3c02ca=_0x3c02ca||0x1f4;return function(_0x55178f){logger['error'](_0x55178f[_0x0741('0x30')]);if(_0x55178f[_0x0741('0x31')]){delete _0x55178f['name'];}_0x13c07e['status'](_0x3c02ca)[_0x0741('0x32')](_0x55178f);};}exports[_0x0741('0x33')]=function(_0x26c7d7,_0x2f6e2e){var _0x423268={},_0x420396={},_0x3768e7={'count':0x0,'rows':[]};var _0x2e6f12=_[_0x0741('0x34')](db[_0x0741('0x35')][_0x0741('0x36')],function(_0x57ef52){return{'name':_0x57ef52[_0x0741('0x37')],'type':_0x57ef52[_0x0741('0x38')][_0x0741('0x39')]};});_0x420396['model']=_[_0x0741('0x34')](_0x2e6f12,_0x0741('0x31'));_0x420396[_0x0741('0x3a')]=_[_0x0741('0x3b')](_0x26c7d7[_0x0741('0x3a')]);_0x420396[_0x0741('0x3c')]=_['intersection'](_0x420396['model'],_0x420396['query']);_0x423268[_0x0741('0x3d')]=_[_0x0741('0x3e')](_0x420396[_0x0741('0x3f')],qs[_0x0741('0x40')](_0x26c7d7[_0x0741('0x3a')][_0x0741('0x40')]));_0x423268[_0x0741('0x3d')]=_0x423268[_0x0741('0x3d')][_0x0741('0x41')]?_0x423268[_0x0741('0x3d')]:_0x420396[_0x0741('0x3f')];if(!_0x26c7d7['query'][_0x0741('0x42')](_0x0741('0x43'))){_0x423268[_0x0741('0x25')]=qs[_0x0741('0x25')](_0x26c7d7['query']['limit']);_0x423268[_0x0741('0x23')]=qs[_0x0741('0x23')](_0x26c7d7['query'][_0x0741('0x23')]);}_0x423268[_0x0741('0x44')]=qs[_0x0741('0x45')](_0x26c7d7['query'][_0x0741('0x45')]);_0x423268[_0x0741('0x46')]=qs['filters'](_['pick'](_0x26c7d7[_0x0741('0x3a')],_0x420396[_0x0741('0x3c')]),_0x2e6f12);if(_0x26c7d7['query'][_0x0741('0x47')]){_0x423268[_0x0741('0x46')]=_['merge'](_0x423268[_0x0741('0x46')],{'$or':_[_0x0741('0x34')](_0x2e6f12,function(_0x58970c){if(_0x58970c[_0x0741('0x38')]!==_0x0741('0x48')){var _0x54062c={};_0x54062c[_0x58970c['name']]={'$like':'%'+_0x26c7d7[_0x0741('0x3a')][_0x0741('0x47')]+'%'};return _0x54062c;}})});}_0x423268=_[_0x0741('0x49')]({},_0x423268,_0x26c7d7[_0x0741('0x4a')]);var _0x517c09={'where':_0x423268[_0x0741('0x46')]};return db[_0x0741('0x35')]['count'](_0x517c09)[_0x0741('0x2e')](function(_0x4f06b6){_0x3768e7[_0x0741('0x26')]=_0x4f06b6;if(_0x26c7d7[_0x0741('0x3a')][_0x0741('0x4b')]){_0x423268[_0x0741('0x4c')]=[{'all':!![]}];}return db[_0x0741('0x35')][_0x0741('0x4d')](_0x423268);})[_0x0741('0x2e')](function(_0x511366){_0x3768e7['rows']=_0x511366;return _0x3768e7;})[_0x0741('0x2e')](respondWithFilteredResult(_0x2f6e2e,_0x423268))[_0x0741('0x4e')](handleError(_0x2f6e2e,null));};exports[_0x0741('0x4f')]=function(_0xdb27da,_0x847f2){var _0x24c463={'raw':!![],'where':{'id':_0xdb27da[_0x0741('0x50')]['id']}},_0x40c6dd={};_0x40c6dd[_0x0741('0x3f')]=_['keys'](db[_0x0741('0x35')][_0x0741('0x36')]);_0x40c6dd[_0x0741('0x3a')]=_['keys'](_0xdb27da[_0x0741('0x3a')]);_0x40c6dd[_0x0741('0x3c')]=_[_0x0741('0x3e')](_0x40c6dd['model'],_0x40c6dd[_0x0741('0x3a')]);_0x24c463['attributes']=_[_0x0741('0x3e')](_0x40c6dd[_0x0741('0x3f')],qs[_0x0741('0x40')](_0xdb27da[_0x0741('0x3a')][_0x0741('0x40')]));_0x24c463[_0x0741('0x3d')]=_0x24c463[_0x0741('0x3d')][_0x0741('0x41')]?_0x24c463[_0x0741('0x3d')]:_0x40c6dd[_0x0741('0x3f')];if(_0xdb27da[_0x0741('0x3a')][_0x0741('0x4b')]){_0x24c463[_0x0741('0x4c')]=[{'all':!![]}];}_0x24c463=_[_0x0741('0x49')]({},_0x24c463,_0xdb27da['options']);return db[_0x0741('0x35')][_0x0741('0x51')](_0x24c463)[_0x0741('0x2e')](handleEntityNotFound(_0x847f2,null))[_0x0741('0x2e')](respondWithResult(_0x847f2,null))[_0x0741('0x4e')](handleError(_0x847f2,null));};exports[_0x0741('0x52')]=function(_0x244158,_0x1980fb){return db[_0x0741('0x35')][_0x0741('0x52')](_0x244158[_0x0741('0x53')],{})[_0x0741('0x2e')](respondWithResult(_0x1980fb,0xc9))[_0x0741('0x4e')](handleError(_0x1980fb,null));};exports[_0x0741('0x2c')]=function(_0x5a13ab,_0x1b0c8d){if(_0x5a13ab[_0x0741('0x53')]['id']){delete _0x5a13ab[_0x0741('0x53')]['id'];}return db[_0x0741('0x35')]['find']({'where':{'id':_0x5a13ab[_0x0741('0x50')]['id']}})[_0x0741('0x2e')](handleEntityNotFound(_0x1b0c8d,null))[_0x0741('0x2e')](saveUpdates(_0x5a13ab[_0x0741('0x53')],null))[_0x0741('0x2e')](respondWithResult(_0x1b0c8d,null))['catch'](handleError(_0x1b0c8d,null));};exports[_0x0741('0x2d')]=function(_0x3d2bde,_0xa1c15e){return db[_0x0741('0x35')][_0x0741('0x51')]({'where':{'id':_0x3d2bde[_0x0741('0x50')]['id']}})[_0x0741('0x2e')](handleEntityNotFound(_0xa1c15e,null))[_0x0741('0x2e')](removeEntity(_0xa1c15e,null))['catch'](handleError(_0xa1c15e,null));};exports['describe']=function(_0x3abb5d,_0x394009){return db[_0x0741('0x35')][_0x0741('0x54')]()[_0x0741('0x2e')](respondWithResult(_0x394009,null))['catch'](handleError(_0x394009,null));};function wrapUser(_0x4a7959){return function(_0x456189){var _0x55d770=_0x4a7959[_0x0741('0x55')]({'plain':!![]});_0x55d770['messages']=[];if(_0x456189){_0x55d770[_0x0741('0x56')]=_0x456189[_0x0741('0x57')];_0x55d770[_0x0741('0x58')]=_0x456189;}else{_0x55d770[_0x0741('0x56')]=moment(0x0)['format'](_0x0741('0x59'));_0x55d770['lastMessage']={};}return _0x55d770;};}exports['getUsers']=function(_0x32ccbf,_0x56cefa,_0x28e78a){var _0x17979b=[];return db[_0x0741('0x5a')][_0x0741('0x4d')]({'where':{'role':[_0x0741('0x5b'),_0x0741('0x5c'),_0x0741('0x5d')]},'attributes':['id',_0x0741('0x5e'),_0x0741('0x31'),_0x0741('0x5f'),'userpic','internal',_0x0741('0x60'),_0x0741('0x61'),_0x0741('0x62'),_0x0741('0x63')],'order':qs[_0x0741('0x45')](_0x0741('0x64')),'include':[{'model':db[_0x0741('0x65')],'as':'VoiceQueues','attributes':['id','name','type'],'through':{'attributes':[]}}]})[_0x0741('0x2e')](function(_0x3cfca6){if(_0x3cfca6){var _0x31dad7=_0x32ccbf[_0x0741('0x5d')]['get']({'plain':!![]});if(!_0x31dad7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31dad7[_0x0741('0x5f')]===_0x0741('0x5d')){return db[_0x0741('0x66')][_0x0741('0x51')]({'where':{'name':_0x0741('0x67'),'userProfileId':_0x31dad7[_0x0741('0x68')]},'raw':!![]})[_0x0741('0x2e')](function(_0x2ca818){if(_0x2ca818){if(_0x2ca818[_0x0741('0x69')]===0x0){return db[_0x0741('0x6a')][_0x0741('0x4d')]({'where':{'sectionId':_0x2ca818['id']},'raw':!![]})[_0x0741('0x2e')](function(_0x58bd6e){var _0x55054f=[];if(_['isEmpty'](_0x58bd6e)){_0x55054f=_[_0x0741('0x47')](_0x3cfca6,function(_0x1e9a5e){if(_0x1e9a5e['role']!=='agent'){return _0x1e9a5e;}});return _0x55054f;}else{for(var _0x2920e8=0x0;_0x2920e8<_0x3cfca6['length'];_0x2920e8++){var _0x5030d4=_0x3cfca6[_0x2920e8];if(_0x5030d4['role']===_0x0741('0x5b')){var _0x181ea9=_[_0x0741('0x51')](_0x58bd6e,function(_0x53eeaf){return _0x53eeaf[_0x0741('0x6b')]===_0x5030d4['id'];});if(_0x181ea9)_0x55054f['push'](_0x5030d4);}else{_0x55054f[_0x0741('0x6c')](_0x5030d4);}}return _0x55054f;}});}else{return _0x3cfca6;}}else{var _0x43988b=_[_0x0741('0x47')](_0x3cfca6,function(_0x5c1a2f){if(_0x5c1a2f['role']!==_0x0741('0x5b')){return _0x5c1a2f;}});return _0x43988b;}});}else{return _0x3cfca6;}}})['then'](function(_0x382d85){var _0x3c5df3=[];if(_0x382d85){_0x17979b=_0x382d85;for(var _0x217702=0x0;_0x217702<_0x382d85[_0x0741('0x41')];_0x217702+=0x1){_0x17979b[_0x217702][_0x0741('0x6d')]=[];_0x3c5df3['push'](db[_0x0741('0x35')][_0x0741('0x51')]({'where':{'FromId':[_0x32ccbf[_0x0741('0x5d')]['id'],_0x382d85[_0x217702]['id']],'ToId':[_0x32ccbf[_0x0741('0x5d')]['id'],_0x382d85[_0x217702]['id']],'ChatGroupId':null},'attributes':['id',_0x0741('0x57'),_0x0741('0x6e'),_0x0741('0x6f'),_0x0741('0x70'),'body'],'order':qs[_0x0741('0x45')](_0x0741('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x382d85[_0x217702])));}return BPromise[_0x0741('0x72')](_0x3c5df3);}return[];})[_0x0741('0x2e')](function(_0x1cded5){return{'rows':_0x1cded5,'count':_0x1cded5[_0x0741('0x41')]};})[_0x0741('0x2e')](respondWithResult(_0x56cefa,null))[_0x0741('0x4e')](handleError(_0x56cefa,null));}; \ No newline at end of file +var _0xf13c=['find','create','body','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','role','userpic','internal','online','showWebBar','-online','VoiceQueue','VoiceQueues','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','resourceId','push','ToId','read','-createdAt','all','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','filter','ChatInternalMessage','includeAll','include','findAll','rows','catch','show','params','options'];(function(_0x58578d,_0xd47212){var _0x37616b=function(_0x7bec18){while(--_0x7bec18){_0x58578d['push'](_0x58578d['shift']());}};_0x37616b(++_0xd47212);}(_0xf13c,0x1e1));var _0xcf13=function(_0x3ec1da,_0x1e36f5){_0x3ec1da=_0x3ec1da-0x0;var _0x472358=_0xf13c[_0x3ec1da];return _0x472358;};'use strict';var emlformat=require(_0xcf13('0x0'));var rimraf=require(_0xcf13('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcf13('0x2'));var rp=require(_0xcf13('0x3'));var moment=require(_0xcf13('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcf13('0x5'));var util=require('util');var path=require(_0xcf13('0x6'));var sox=require(_0xcf13('0x7'));var csv=require(_0xcf13('0x8'));var ejs=require(_0xcf13('0x9'));var fs=require('fs');var fs_extra=require(_0xcf13('0xa'));var _=require('lodash');var squel=require(_0xcf13('0xb'));var crypto=require(_0xcf13('0xc'));var jsforce=require(_0xcf13('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcf13('0xe'));var Papa=require(_0xcf13('0xf'));var Redis=require(_0xcf13('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcf13('0x11'));var as=require(_0xcf13('0x12'));var hardwareService=require(_0xcf13('0x13'));var logger=require(_0xcf13('0x14'))('api');var utils=require(_0xcf13('0x15'));var config=require(_0xcf13('0x16'));var licenseUtil=require(_0xcf13('0x17'));var db=require(_0xcf13('0x18'))['db'];config[_0xcf13('0x19')]=_[_0xcf13('0x1a')](config[_0xcf13('0x19')],{'host':_0xcf13('0x1b'),'port':0x18eb});var socket=require(_0xcf13('0x1c'))(new Redis(config[_0xcf13('0x19')]));require(_0xcf13('0x1d'))[_0xcf13('0x1e')](socket);function respondWithStatusCode(_0x163304,_0x245153){_0x245153=_0x245153||0xcc;return function(_0x1a6f64){if(_0x1a6f64){return _0x163304[_0xcf13('0x1f')](_0x245153);}return _0x163304[_0xcf13('0x20')](_0x245153)[_0xcf13('0x21')]();};}function respondWithResult(_0x52e989,_0x5599c8){_0x5599c8=_0x5599c8||0xc8;return function(_0x2a9f86){if(_0x2a9f86){return _0x52e989['status'](_0x5599c8)['json'](_0x2a9f86);}};}function respondWithFilteredResult(_0x467abe,_0x53b217){return function(_0xf89c7a){if(_0xf89c7a){var _0x5e5942=typeof _0x53b217[_0xcf13('0x22')]===_0xcf13('0x23')&&typeof _0x53b217[_0xcf13('0x24')]===_0xcf13('0x23');var _0xb9899f=_0xf89c7a[_0xcf13('0x25')];var _0x10aa52=_0x5e5942?0x0:_0x53b217[_0xcf13('0x22')];var _0x42c89a=_0x5e5942?_0xf89c7a['count']:_0x53b217[_0xcf13('0x22')]+_0x53b217[_0xcf13('0x24')];var _0x520c2d;if(_0x42c89a>=_0xb9899f){_0x42c89a=_0xb9899f;_0x520c2d=0xc8;}else{_0x520c2d=0xce;}_0x467abe[_0xcf13('0x20')](_0x520c2d);return _0x467abe['set'](_0xcf13('0x26'),_0x10aa52+'-'+_0x42c89a+'/'+_0xb9899f)[_0xcf13('0x27')](_0xf89c7a);}return null;};}function patchUpdates(_0x472315){return function(_0x4735ba){try{jsonpatch[_0xcf13('0x28')](_0x4735ba,_0x472315,!![]);}catch(_0x3ea576){return BPromise[_0xcf13('0x29')](_0x3ea576);}return _0x4735ba[_0xcf13('0x2a')]();};}function saveUpdates(_0x103507,_0x4e32d6){return function(_0x41cdb5){if(_0x41cdb5){return _0x41cdb5[_0xcf13('0x2b')](_0x103507)[_0xcf13('0x2c')](function(_0x1f0b0b){return _0x1f0b0b;});}return null;};}function removeEntity(_0x6b4114,_0x4b8445){return function(_0x586d47){if(_0x586d47){return _0x586d47[_0xcf13('0x2d')]()['then'](function(){_0x6b4114[_0xcf13('0x20')](0xcc)[_0xcf13('0x21')]();});}};}function handleEntityNotFound(_0x2c8c63,_0x4fbbf3){return function(_0x3bee22){if(!_0x3bee22){_0x2c8c63[_0xcf13('0x1f')](0x194);}return _0x3bee22;};}function handleError(_0x142bd8,_0x7ca82d){_0x7ca82d=_0x7ca82d||0x1f4;return function(_0x154d54){logger[_0xcf13('0x2e')](_0x154d54[_0xcf13('0x2f')]);if(_0x154d54[_0xcf13('0x30')]){delete _0x154d54[_0xcf13('0x30')];}_0x142bd8['status'](_0x7ca82d)['send'](_0x154d54);};}exports[_0xcf13('0x31')]=function(_0x5b4382,_0x3f4d22){var _0x2f3ec2={},_0x31db5a={},_0x35b08c={'count':0x0,'rows':[]};var _0x1b9deb=_[_0xcf13('0x32')](db['ChatInternalMessage']['rawAttributes'],function(_0x3c303b){return{'name':_0x3c303b[_0xcf13('0x33')],'type':_0x3c303b['type'][_0xcf13('0x34')]};});_0x31db5a['model']=_[_0xcf13('0x32')](_0x1b9deb,_0xcf13('0x30'));_0x31db5a[_0xcf13('0x35')]=_[_0xcf13('0x36')](_0x5b4382['query']);_0x31db5a['filters']=_[_0xcf13('0x37')](_0x31db5a[_0xcf13('0x38')],_0x31db5a[_0xcf13('0x35')]);_0x2f3ec2[_0xcf13('0x39')]=_['intersection'](_0x31db5a['model'],qs[_0xcf13('0x3a')](_0x5b4382['query'][_0xcf13('0x3a')]));_0x2f3ec2[_0xcf13('0x39')]=_0x2f3ec2['attributes'][_0xcf13('0x3b')]?_0x2f3ec2['attributes']:_0x31db5a['model'];if(!_0x5b4382[_0xcf13('0x35')][_0xcf13('0x3c')](_0xcf13('0x3d'))){_0x2f3ec2[_0xcf13('0x24')]=qs[_0xcf13('0x24')](_0x5b4382[_0xcf13('0x35')][_0xcf13('0x24')]);_0x2f3ec2[_0xcf13('0x22')]=qs['offset'](_0x5b4382[_0xcf13('0x35')][_0xcf13('0x22')]);}_0x2f3ec2['order']=qs[_0xcf13('0x3e')](_0x5b4382[_0xcf13('0x35')][_0xcf13('0x3e')]);_0x2f3ec2[_0xcf13('0x3f')]=qs[_0xcf13('0x40')](_[_0xcf13('0x41')](_0x5b4382[_0xcf13('0x35')],_0x31db5a[_0xcf13('0x40')]),_0x1b9deb);if(_0x5b4382['query']['filter']){_0x2f3ec2['where']=_[_0xcf13('0x42')](_0x2f3ec2[_0xcf13('0x3f')],{'$or':_[_0xcf13('0x32')](_0x1b9deb,function(_0x2374d0){if(_0x2374d0[_0xcf13('0x43')]!==_0xcf13('0x44')){var _0xe64a48={};_0xe64a48[_0x2374d0['name']]={'$like':'%'+_0x5b4382[_0xcf13('0x35')][_0xcf13('0x45')]+'%'};return _0xe64a48;}})});}_0x2f3ec2=_[_0xcf13('0x42')]({},_0x2f3ec2,_0x5b4382['options']);var _0x23df79={'where':_0x2f3ec2['where']};return db[_0xcf13('0x46')]['count'](_0x23df79)[_0xcf13('0x2c')](function(_0x5cf848){_0x35b08c[_0xcf13('0x25')]=_0x5cf848;if(_0x5b4382[_0xcf13('0x35')][_0xcf13('0x47')]){_0x2f3ec2[_0xcf13('0x48')]=[{'all':!![]}];}return db[_0xcf13('0x46')][_0xcf13('0x49')](_0x2f3ec2);})['then'](function(_0x5305f7){_0x35b08c[_0xcf13('0x4a')]=_0x5305f7;return _0x35b08c;})[_0xcf13('0x2c')](respondWithFilteredResult(_0x3f4d22,_0x2f3ec2))[_0xcf13('0x4b')](handleError(_0x3f4d22,null));};exports[_0xcf13('0x4c')]=function(_0x31a6f1,_0xfe795c){var _0x5d05f0={'raw':!![],'where':{'id':_0x31a6f1[_0xcf13('0x4d')]['id']}},_0x438d38={};_0x438d38[_0xcf13('0x38')]=_[_0xcf13('0x36')](db['ChatInternalMessage']['rawAttributes']);_0x438d38[_0xcf13('0x35')]=_[_0xcf13('0x36')](_0x31a6f1['query']);_0x438d38[_0xcf13('0x40')]=_[_0xcf13('0x37')](_0x438d38[_0xcf13('0x38')],_0x438d38[_0xcf13('0x35')]);_0x5d05f0[_0xcf13('0x39')]=_[_0xcf13('0x37')](_0x438d38[_0xcf13('0x38')],qs[_0xcf13('0x3a')](_0x31a6f1[_0xcf13('0x35')][_0xcf13('0x3a')]));_0x5d05f0['attributes']=_0x5d05f0[_0xcf13('0x39')]['length']?_0x5d05f0[_0xcf13('0x39')]:_0x438d38[_0xcf13('0x38')];if(_0x31a6f1[_0xcf13('0x35')][_0xcf13('0x47')]){_0x5d05f0[_0xcf13('0x48')]=[{'all':!![]}];}_0x5d05f0=_[_0xcf13('0x42')]({},_0x5d05f0,_0x31a6f1[_0xcf13('0x4e')]);return db[_0xcf13('0x46')][_0xcf13('0x4f')](_0x5d05f0)[_0xcf13('0x2c')](handleEntityNotFound(_0xfe795c,null))[_0xcf13('0x2c')](respondWithResult(_0xfe795c,null))[_0xcf13('0x4b')](handleError(_0xfe795c,null));};exports[_0xcf13('0x50')]=function(_0x95a954,_0x12daec){return db[_0xcf13('0x46')][_0xcf13('0x50')](_0x95a954['body'],{})[_0xcf13('0x2c')](respondWithResult(_0x12daec,0xc9))[_0xcf13('0x4b')](handleError(_0x12daec,null));};exports[_0xcf13('0x2b')]=function(_0x57f81a,_0x58f4b6){if(_0x57f81a[_0xcf13('0x51')]['id']){delete _0x57f81a[_0xcf13('0x51')]['id'];}return db[_0xcf13('0x46')][_0xcf13('0x4f')]({'where':{'id':_0x57f81a[_0xcf13('0x4d')]['id']}})[_0xcf13('0x2c')](handleEntityNotFound(_0x58f4b6,null))[_0xcf13('0x2c')](saveUpdates(_0x57f81a[_0xcf13('0x51')],null))['then'](respondWithResult(_0x58f4b6,null))['catch'](handleError(_0x58f4b6,null));};exports[_0xcf13('0x2d')]=function(_0x27e21c,_0x22ce07){return db[_0xcf13('0x46')][_0xcf13('0x4f')]({'where':{'id':_0x27e21c['params']['id']}})[_0xcf13('0x2c')](handleEntityNotFound(_0x22ce07,null))['then'](removeEntity(_0x22ce07,null))[_0xcf13('0x4b')](handleError(_0x22ce07,null));};exports[_0xcf13('0x52')]=function(_0x50a89e,_0x1976f0){return db[_0xcf13('0x46')][_0xcf13('0x52')]()[_0xcf13('0x2c')](respondWithResult(_0x1976f0,null))[_0xcf13('0x4b')](handleError(_0x1976f0,null));};function wrapUser(_0x139624){return function(_0x41f0be){var _0x4d7290=_0x139624['get']({'plain':!![]});_0x4d7290[_0xcf13('0x53')]=[];if(_0x41f0be){_0x4d7290[_0xcf13('0x54')]=_0x41f0be[_0xcf13('0x55')];_0x4d7290[_0xcf13('0x56')]=_0x41f0be;}else{_0x4d7290[_0xcf13('0x54')]=moment(0x0)[_0xcf13('0x57')](_0xcf13('0x58'));_0x4d7290[_0xcf13('0x56')]={};}return _0x4d7290;};}exports[_0xcf13('0x59')]=function(_0xaadd3,_0x35f840,_0x4e0b03){var _0x56eeaf=[];return db[_0xcf13('0x5a')][_0xcf13('0x49')]({'where':{'role':[_0xcf13('0x5b'),'admin','user']},'attributes':['id','fullname',_0xcf13('0x30'),_0xcf13('0x5c'),_0xcf13('0x5d'),_0xcf13('0x5e'),_0xcf13('0x5f'),'lastLoginAt','allowmessenger',_0xcf13('0x60')],'order':qs[_0xcf13('0x3e')](_0xcf13('0x61')),'include':[{'model':db[_0xcf13('0x62')],'as':_0xcf13('0x63'),'attributes':['id','name',_0xcf13('0x43')],'through':{'attributes':[]}}]})[_0xcf13('0x2c')](function(_0x3f600){if(_0x3f600){var _0x1bbcde=_0xaadd3[_0xcf13('0x64')][_0xcf13('0x65')]({'plain':!![]});if(!_0x1bbcde)throw new Error(_0xcf13('0x66'));if(_0x1bbcde[_0xcf13('0x5c')]===_0xcf13('0x64')){return db[_0xcf13('0x67')]['find']({'where':{'name':_0xcf13('0x68'),'userProfileId':_0x1bbcde['userProfileId']},'raw':!![]})['then'](function(_0x480a05){if(_0x480a05){if(_0x480a05[_0xcf13('0x69')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x480a05['id']},'raw':!![]})[_0xcf13('0x2c')](function(_0x197ec7){var _0x449cbf=[];if(_['isEmpty'](_0x197ec7)){_0x449cbf=_[_0xcf13('0x45')](_0x3f600,function(_0x1f4727){if(_0x1f4727['role']!==_0xcf13('0x5b')){return _0x1f4727;}});return _0x449cbf;}else{for(var _0x3ea362=0x0;_0x3ea362<_0x3f600[_0xcf13('0x3b')];_0x3ea362++){var _0x54fccb=_0x3f600[_0x3ea362];if(_0x54fccb[_0xcf13('0x5c')]===_0xcf13('0x5b')){var _0x266b6e=_[_0xcf13('0x4f')](_0x197ec7,function(_0x55d5a2){return _0x55d5a2[_0xcf13('0x6a')]===_0x54fccb['id'];});if(_0x266b6e)_0x449cbf[_0xcf13('0x6b')](_0x54fccb);}else{_0x449cbf[_0xcf13('0x6b')](_0x54fccb);}}return _0x449cbf;}});}else{return _0x3f600;}}else{var _0x10e425=_[_0xcf13('0x45')](_0x3f600,function(_0x45c27d){if(_0x45c27d[_0xcf13('0x5c')]!==_0xcf13('0x5b')){return _0x45c27d;}});return _0x10e425;}});}else{return _0x3f600;}}})['then'](function(_0x29abec){var _0x22d5fe=[];if(_0x29abec){_0x56eeaf=_0x29abec;for(var _0x402ff3=0x0;_0x402ff3<_0x29abec[_0xcf13('0x3b')];_0x402ff3+=0x1){_0x56eeaf[_0x402ff3]['messages']=[];_0x22d5fe['push'](db[_0xcf13('0x46')][_0xcf13('0x4f')]({'where':{'FromId':[_0xaadd3[_0xcf13('0x64')]['id'],_0x29abec[_0x402ff3]['id']],'ToId':[_0xaadd3['user']['id'],_0x29abec[_0x402ff3]['id']],'ChatGroupId':null},'attributes':['id',_0xcf13('0x55'),'FromId',_0xcf13('0x6c'),_0xcf13('0x6d'),_0xcf13('0x51')],'order':qs[_0xcf13('0x3e')](_0xcf13('0x6e')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x29abec[_0x402ff3])));}return BPromise[_0xcf13('0x6f')](_0x22d5fe);}return[];})[_0xcf13('0x2c')](function(_0x2b6264){return{'rows':_0x2b6264,'count':_0x2b6264[_0xcf13('0x3b')]};})[_0xcf13('0x2c')](respondWithResult(_0x35f840,null))['catch'](handleError(_0x35f840,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 545263a..8708c88 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 _0xcdd6=['setMaxListeners','save','remove','emit','hook','../../mysqldb','ChatInternalMessage'];(function(_0x4c3e69,_0x2be8c6){var _0x4aa69=function(_0x3b1238){while(--_0x3b1238){_0x4c3e69['push'](_0x4c3e69['shift']());}};_0x4aa69(++_0x2be8c6);}(_0xcdd6,0x1be));var _0x6cdd=function(_0x41f2fd,_0x427d9c){_0x41f2fd=_0x41f2fd-0x0;var _0x19ee5a=_0xcdd6[_0x41f2fd];return _0x19ee5a;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x6cdd('0x0'))['db'][_0x6cdd('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6cdd('0x2')](0x0);var events={'afterCreate':_0x6cdd('0x3'),'afterUpdate':'update','afterDestroy':_0x6cdd('0x4')};function emitEvent(_0x4d4591){return function(_0x105169,_0x2dd7da,_0x2cf235){ChatInternalMessageEvents[_0x6cdd('0x5')](_0x4d4591+':'+_0x105169['id'],_0x105169);ChatInternalMessageEvents[_0x6cdd('0x5')](_0x4d4591,_0x105169);_0x2cf235(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x6cdd('0x6')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x8044=['ChatInternalMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x446eff,_0x4e88e2){var _0x178fcf=function(_0x3c45ed){while(--_0x3c45ed){_0x446eff['push'](_0x446eff['shift']());}};_0x178fcf(++_0x4e88e2);}(_0x8044,0x170));var _0x4804=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0x8044[_0x2ca616];return _0x53155f;};'use strict';var EventEmitter=require(_0x4804('0x0'));var ChatInternalMessage=require(_0x4804('0x1'))['db'][_0x4804('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x4804('0x3')](0x0);var events={'afterCreate':_0x4804('0x4'),'afterUpdate':_0x4804('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4d6d6a){return function(_0x361aae,_0x1e482c,_0x3a3938){ChatInternalMessageEvents['emit'](_0x4d6d6a+':'+_0x361aae['id'],_0x361aae);ChatInternalMessageEvents[_0x4804('0x6')](_0x4d6d6a,_0x361aae);_0x3a3938(null);};}for(var e in events){if(events[_0x4804('0x7')](e)){var event=events[e];ChatInternalMessage[_0x4804('0x8')](e,emitEvent(event));}}module[_0x4804('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index f3c7d6c..0f1a36d 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 _0x947e=['ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','util','api','moment','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x947e,0x1a5));var _0xe947=function(_0x2e7153,_0x2b3dca){_0x2e7153=_0x2e7153-0x0;var _0xbd2fdd=_0x947e[_0x2e7153];return _0xbd2fdd;};'use strict';var _=require('lodash');var util=require(_0xe947('0x0'));var logger=require('../../config/logger')(_0xe947('0x1'));var moment=require(_0xe947('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe947('0x3'));var config=require(_0xe947('0x4'));var attributes=require(_0xe947('0x5'));module[_0xe947('0x6')]=function(_0x193497,_0x5919c7){return _0x193497[_0xe947('0x7')](_0xe947('0x8'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe947('0x9'),'collate':_0xe947('0xa')});}; \ No newline at end of file +var _0x309b=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','exports','define','ChatInternalMessage','chat_internal_messages'];(function(_0x1880f6,_0x3d14b5){var _0x13f186=function(_0x264e16){while(--_0x264e16){_0x1880f6['push'](_0x1880f6['shift']());}};_0x13f186(++_0x3d14b5);}(_0x309b,0x16e));var _0xb309=function(_0x2485b6,_0x1ac427){_0x2485b6=_0x2485b6-0x0;var _0x3f544f=_0x309b[_0x2485b6];return _0x3f544f;};'use strict';var _=require(_0xb309('0x0'));var util=require(_0xb309('0x1'));var logger=require(_0xb309('0x2'))(_0xb309('0x3'));var moment=require(_0xb309('0x4'));var BPromise=require('bluebird');var rp=require(_0xb309('0x5'));var fs=require('fs');var path=require(_0xb309('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0xb309('0x7')]=function(_0x5622fd,_0x5a51a6){return _0x5622fd[_0xb309('0x8')](_0xb309('0x9'),attributes,{'tableName':_0xb309('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb309('0xb'),'collate':_0xb309('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 0723662..98332ee 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 _0x87cb=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ChatInternalMessage,\x20%s,\x20%s','message'];(function(_0x1b8880,_0x382d59){var _0x144525=function(_0x207621){while(--_0x207621){_0x1b8880['push'](_0x1b8880['shift']());}};_0x144525(++_0x382d59);}(_0x87cb,0xaa));var _0xb87c=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x87cb[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0xb87c('0x0'));var util=require(_0xb87c('0x1'));var moment=require(_0xb87c('0x2'));var BPromise=require(_0xb87c('0x3'));var rs=require(_0xb87c('0x4'));var fs=require('fs');var Redis=require(_0xb87c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb87c('0x6'))(_0xb87c('0x7'));var config=require(_0xb87c('0x8'));var jayson=require(_0xb87c('0x9'));var client=jayson[_0xb87c('0xa')][_0xb87c('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb87c('0xc')],{'host':_0xb87c('0xd'),'port':0x18eb});var socket=require(_0xb87c('0xe'))(new Redis(config[_0xb87c('0xc')]));require(_0xb87c('0xf'))['register'](socket);function respondWithRpcPromise(_0x10517c,_0x484d49,_0x260a20){return new BPromise(function(_0x5229a4,_0x37b8e7){return client[_0xb87c('0x10')](_0x10517c,_0x260a20)[_0xb87c('0x11')](function(_0xa4095f){logger[_0xb87c('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x484d49,'request\x20sent');logger[_0xb87c('0x13')](_0xb87c('0x14'),_0x484d49,_0xb87c('0x15'),JSON['stringify'](_0xa4095f));if(_0xa4095f[_0xb87c('0x16')]){if(_0xa4095f[_0xb87c('0x16')][_0xb87c('0x17')]===0x1f4){logger[_0xb87c('0x16')](_0xb87c('0x18'),_0x484d49,_0xa4095f[_0xb87c('0x16')][_0xb87c('0x19')]);return _0x37b8e7(_0xa4095f[_0xb87c('0x16')][_0xb87c('0x19')]);}logger['error'](_0xb87c('0x18'),_0x484d49,_0xa4095f[_0xb87c('0x16')][_0xb87c('0x19')]);return _0x5229a4(_0xa4095f[_0xb87c('0x16')]['message']);}else{logger[_0xb87c('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x484d49,'request\x20sent');_0x5229a4(_0xa4095f[_0xb87c('0x1a')][_0xb87c('0x19')]);}})[_0xb87c('0x1b')](function(_0x581c9e){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x484d49,_0x581c9e);_0x37b8e7(_0x581c9e);});});} \ No newline at end of file +var _0x1052=['then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','localhost','socket.io-emitter','register','request'];(function(_0x443808,_0x2561a8){var _0x1ac12a=function(_0x59d260){while(--_0x59d260){_0x443808['push'](_0x443808['shift']());}};_0x1ac12a(++_0x2561a8);}(_0x1052,0xf4));var _0x2105=function(_0xbb7389,_0x12b29d){_0xbb7389=_0xbb7389-0x0;var _0x12537b=_0x1052[_0xbb7389];return _0x12537b;};'use strict';var _=require(_0x2105('0x0'));var util=require(_0x2105('0x1'));var moment=require(_0x2105('0x2'));var BPromise=require(_0x2105('0x3'));var rs=require(_0x2105('0x4'));var fs=require('fs');var Redis=require(_0x2105('0x5'));var db=require(_0x2105('0x6'))['db'];var utils=require(_0x2105('0x7'));var logger=require(_0x2105('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2105('0x9'));var client=jayson['client'][_0x2105('0xa')]({'port':0x232a});config[_0x2105('0xb')]=_['defaults'](config[_0x2105('0xb')],{'host':_0x2105('0xc'),'port':0x18eb});var socket=require(_0x2105('0xd'))(new Redis(config['redis']));require('./chatInternalMessage.socket')[_0x2105('0xe')](socket);function respondWithRpcPromise(_0x1ee90d,_0x39171e,_0x573d65){return new BPromise(function(_0x20e028,_0x42fe65){return client[_0x2105('0xf')](_0x1ee90d,_0x573d65)[_0x2105('0x10')](function(_0x4c7128){logger['info'](_0x2105('0x11'),_0x39171e,_0x2105('0x12'));logger[_0x2105('0x13')](_0x2105('0x14'),_0x39171e,_0x2105('0x12'),JSON[_0x2105('0x15')](_0x4c7128));if(_0x4c7128[_0x2105('0x16')]){if(_0x4c7128[_0x2105('0x16')][_0x2105('0x17')]===0x1f4){logger[_0x2105('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x39171e,_0x4c7128[_0x2105('0x16')][_0x2105('0x18')]);return _0x42fe65(_0x4c7128[_0x2105('0x16')][_0x2105('0x18')]);}logger['error'](_0x2105('0x11'),_0x39171e,_0x4c7128[_0x2105('0x16')][_0x2105('0x18')]);return _0x20e028(_0x4c7128[_0x2105('0x16')][_0x2105('0x18')]);}else{logger['info'](_0x2105('0x11'),_0x39171e,_0x2105('0x12'));_0x20e028(_0x4c7128['result'][_0x2105('0x18')]);}})[_0x2105('0x19')](function(_0x10243a){logger[_0x2105('0x16')](_0x2105('0x11'),_0x39171e,_0x10243a);_0x42fe65(_0x10243a);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 274c1a8..2ffbb1f 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 _0xd403=['update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x2224f0,_0x5a3253){var _0x4c2aac=function(_0xe32873){while(--_0xe32873){_0x2224f0['push'](_0x2224f0['shift']());}};_0x4c2aac(++_0x5a3253);}(_0xd403,0xbe));var _0x3d40=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xd403[_0x525c7b];return _0x27b33e;};'use strict';var ChatInternalMessageEvents=require(_0x3d40('0x0'));var events=[_0x3d40('0x1'),'remove',_0x3d40('0x2')];function createListener(_0xe152d6,_0x5dc3d1){return function(_0x362ea3){_0x5dc3d1[_0x3d40('0x3')](_0xe152d6,_0x362ea3);};}function removeListener(_0x2b3dc9,_0x1272ca){return function(){ChatInternalMessageEvents[_0x3d40('0x4')](_0x2b3dc9,_0x1272ca);};}exports[_0x3d40('0x5')]=function(_0x40fe68){for(var _0x29b4c8=0x0,_0x524034=events[_0x3d40('0x6')];_0x29b4c8<_0x524034;_0x29b4c8++){var _0x2f6f52=events[_0x29b4c8];var _0x3da2d3=createListener(_0x3d40('0x7')+_0x2f6f52,_0x40fe68);ChatInternalMessageEvents['on'](_0x2f6f52,_0x3da2d3);}}; \ No newline at end of file +var _0xc0a8=['update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save'];(function(_0x23ca3a,_0xe44c43){var _0x5c1aab=function(_0x29bcdd){while(--_0x29bcdd){_0x23ca3a['push'](_0x23ca3a['shift']());}};_0x5c1aab(++_0xe44c43);}(_0xc0a8,0x10e));var _0x8c0a=function(_0x219e61,_0x23c6ed){_0x219e61=_0x219e61-0x0;var _0x38f7de=_0xc0a8[_0x219e61];return _0x38f7de;};'use strict';var ChatInternalMessageEvents=require(_0x8c0a('0x0'));var events=[_0x8c0a('0x1'),'remove',_0x8c0a('0x2')];function createListener(_0x4b1de9,_0x339173){return function(_0x52d998){_0x339173[_0x8c0a('0x3')](_0x4b1de9,_0x52d998);};}function removeListener(_0x2faa03,_0x291fff){return function(){ChatInternalMessageEvents[_0x8c0a('0x4')](_0x2faa03,_0x291fff);};}exports[_0x8c0a('0x5')]=function(_0x1bfdf8){for(var _0x342718=0x0,_0xf67d44=events[_0x8c0a('0x6')];_0x342718<_0xf67d44;_0x342718++){var _0x4cddae=events[_0x342718];var _0x142b47=createListener(_0x8c0a('0x7')+_0x4cddae,_0x1bfdf8);ChatInternalMessageEvents['on'](_0x4cddae,_0x142b47);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 953fc95..ce900be 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 _0x3af7=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','getUsers','/:id','show','post','create','put','delete','destroy','util'];(function(_0x3c3cf3,_0x3e1092){var _0xcd152b=function(_0x49600f){while(--_0x49600f){_0x3c3cf3['push'](_0x3c3cf3['shift']());}};_0xcd152b(++_0x3e1092);}(_0x3af7,0x1cd));var _0x73af=function(_0x147ece,_0x12c09c){_0x147ece=_0x147ece-0x0;var _0x2d0bcb=_0x3af7[_0x147ece];return _0x2d0bcb;};'use strict';var multer=require('multer');var util=require(_0x73af('0x0'));var path=require(_0x73af('0x1'));var timeout=require(_0x73af('0x2'));var express=require(_0x73af('0x3'));var router=express[_0x73af('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x73af('0x5'));var interaction=require(_0x73af('0x6'));var config=require(_0x73af('0x7'));var controller=require(_0x73af('0x8'));router[_0x73af('0x9')]('/',auth[_0x73af('0xa')](),controller[_0x73af('0xb')]);router[_0x73af('0x9')]('/describe',auth[_0x73af('0xa')](),controller[_0x73af('0xc')]);router[_0x73af('0x9')]('/users',auth['isAuthenticated'](),controller[_0x73af('0xd')]);router[_0x73af('0x9')](_0x73af('0xe'),auth['isAuthenticated'](),controller[_0x73af('0xf')]);router[_0x73af('0x10')]('/',auth[_0x73af('0xa')](),controller[_0x73af('0x11')]);router[_0x73af('0x12')](_0x73af('0xe'),controller['update']);router[_0x73af('0x13')](_0x73af('0xe'),auth[_0x73af('0xa')](),controller[_0x73af('0x14')]);module['exports']=router; \ No newline at end of file +var _0xd31d=['get','isAuthenticated','index','/describe','/users','getUsers','/:id','show','post','create','put','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller'];(function(_0x15240b,_0x38dcd6){var _0x264cfe=function(_0x5ad394){while(--_0x5ad394){_0x15240b['push'](_0x15240b['shift']());}};_0x264cfe(++_0x38dcd6);}(_0xd31d,0x1da));var _0xdd31=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0xd31d[_0x35d4e9];return _0x5c2770;};'use strict';var multer=require(_0xdd31('0x0'));var util=require(_0xdd31('0x1'));var path=require(_0xdd31('0x2'));var timeout=require(_0xdd31('0x3'));var express=require(_0xdd31('0x4'));var router=express['Router']();var fs_extra=require(_0xdd31('0x5'));var auth=require(_0xdd31('0x6'));var interaction=require(_0xdd31('0x7'));var config=require(_0xdd31('0x8'));var controller=require(_0xdd31('0x9'));router[_0xdd31('0xa')]('/',auth[_0xdd31('0xb')](),controller[_0xdd31('0xc')]);router[_0xdd31('0xa')](_0xdd31('0xd'),auth[_0xdd31('0xb')](),controller['describe']);router[_0xdd31('0xa')](_0xdd31('0xe'),auth[_0xdd31('0xb')](),controller[_0xdd31('0xf')]);router[_0xdd31('0xa')](_0xdd31('0x10'),auth[_0xdd31('0xb')](),controller[_0xdd31('0x11')]);router[_0xdd31('0x12')]('/',auth['isAuthenticated'](),controller[_0xdd31('0x13')]);router[_0xdd31('0x14')](_0xdd31('0x10'),controller['update']);router['delete']('/:id',auth[_0xdd31('0xb')](),controller['destroy']);module[_0xdd31('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 738c7a8..90390be 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 _0xc06d=['BOOLEAN','ENUM','DATE','sequelize','exports','TEXT','medium'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xc06d,0x15a));var _0xdc06=function(_0x175b18,_0x4cc1f3){_0x175b18=_0x175b18-0x0;var _0x1e0702=_0xc06d[_0x175b18];return _0x1e0702;};'use strict';var Sequelize=require(_0xdc06('0x0'));module[_0xdc06('0x1')]={'body':{'type':Sequelize[_0xdc06('0x2')](_0xdc06('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xdc06('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdc06('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xdc06('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xdc06('0x2')]}}; \ No newline at end of file +var _0xb2af=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xb2af,0xd2));var _0xfb2a=function(_0x45bcfb,_0x2f0780){_0x45bcfb=_0x45bcfb-0x0;var _0x271599=_0xb2af[_0x45bcfb];return _0x271599;};'use strict';var Sequelize=require(_0xfb2a('0x0'));module[_0xfb2a('0x1')]={'body':{'type':Sequelize[_0xfb2a('0x2')](_0xfb2a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xfb2a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xfb2a('0x5')]('in',_0xfb2a('0x6')),'defaultValue':_0xfb2a('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0xfb2a('0x7')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xfb2a('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 64cf235..4814a08 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 _0x465f=['includeAll','include','findAll','show','params','create','body','find','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteractionId','update','isNil','interaction','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','SELECT','fullname','motionChannel','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','stack','name','send','map','ChatMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','merge','where'];(function(_0x2123d2,_0x2b4976){var _0x3c549e=function(_0x2a539a){while(--_0x2a539a){_0x2123d2['push'](_0x2123d2['shift']());}};_0x3c549e(++_0x2b4976);}(_0x465f,0x13f));var _0xf465=function(_0x10c3fc,_0x342c3e){_0x10c3fc=_0x10c3fc-0x0;var _0x3515bb=_0x465f[_0x10c3fc];return _0x3515bb;};'use strict';var emlformat=require(_0xf465('0x0'));var rimraf=require(_0xf465('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf465('0x2'));var rp=require(_0xf465('0x3'));var moment=require('moment');var BPromise=require(_0xf465('0x4'));var Mustache=require('mustache');var util=require(_0xf465('0x5'));var path=require(_0xf465('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf465('0x7'));var fs=require('fs');var fs_extra=require(_0xf465('0x8'));var _=require(_0xf465('0x9'));var squel=require(_0xf465('0xa'));var crypto=require(_0xf465('0xb'));var jsforce=require(_0xf465('0xc'));var deskjs=require(_0xf465('0xd'));var toCsv=require(_0xf465('0xe'));var querystring=require(_0xf465('0xf'));var Papa=require(_0xf465('0x10'));var Redis=require(_0xf465('0x11'));var authService=require(_0xf465('0x12'));var qs=require(_0xf465('0x13'));var as=require(_0xf465('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf465('0x15'))(_0xf465('0x16'));var utils=require(_0xf465('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xf465('0x18'));var db=require('../../mysqldb')['db'];config[_0xf465('0x19')]=_[_0xf465('0x1a')](config[_0xf465('0x19')],{'host':_0xf465('0x1b'),'port':0x18eb});var socket=require(_0xf465('0x1c'))(new Redis(config['redis']));require('./chatMessage.socket')['register'](socket);var jayson=require(_0xf465('0x1d'));var client=jayson[_0xf465('0x1e')][_0xf465('0x1f')]({'port':0x232c});var client9002=jayson[_0xf465('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e2707,_0xe47e8c,_0x5af046,_0x4e9c0d){return new BPromise(function(_0x230307,_0x227e9c){var _0x457caa=_0x4e9c0d||client;return _0x457caa['request'](_0x4e2707,_0x5af046)[_0xf465('0x20')](function(_0x45a23d){logger['info'](_0xf465('0x21'),_0xe47e8c,_0xf465('0x22'));logger[_0xf465('0x23')](_0xf465('0x24'),_0xe47e8c,'request\x20sent',JSON[_0xf465('0x25')](_0x45a23d));if(_0x45a23d[_0xf465('0x26')]){if(_0x45a23d[_0xf465('0x26')][_0xf465('0x27')]===0x1f4){logger[_0xf465('0x26')](_0xf465('0x21'),_0xe47e8c,_0x45a23d[_0xf465('0x26')]['message']);return _0x227e9c(_0x45a23d[_0xf465('0x26')][_0xf465('0x28')]);}logger[_0xf465('0x26')](_0xf465('0x21'),_0xe47e8c,_0x45a23d[_0xf465('0x26')]['message']);return _0x230307(_0x45a23d[_0xf465('0x26')][_0xf465('0x28')]);}else{logger[_0xf465('0x29')](_0xf465('0x21'),_0xe47e8c,_0xf465('0x22'));_0x230307(_0x45a23d[_0xf465('0x2a')]['message']);}})[_0xf465('0x2b')](function(_0x2405af){logger['error'](_0xf465('0x21'),_0xe47e8c,_0x2405af);_0x227e9c(_0x2405af);});});}function respondWithStatusCode(_0x5c6d17,_0x41a83f){_0x41a83f=_0x41a83f||0xcc;return function(_0x2167ca){if(_0x2167ca){return _0x5c6d17[_0xf465('0x2c')](_0x41a83f);}return _0x5c6d17[_0xf465('0x2d')](_0x41a83f)['end']();};}function respondWithResult(_0x4f72b9,_0x725457){_0x725457=_0x725457||0xc8;return function(_0xb75797){if(_0xb75797){return _0x4f72b9[_0xf465('0x2d')](_0x725457)[_0xf465('0x2e')](_0xb75797);}};}function respondWithFilteredResult(_0x5b0b17,_0x408c8d){return function(_0x14c4ad){if(_0x14c4ad){var _0x5b3eab=typeof _0x408c8d[_0xf465('0x2f')]==='undefined'&&typeof _0x408c8d['limit']===_0xf465('0x30');var _0x3abff3=_0x14c4ad[_0xf465('0x31')];var _0x35bb23=_0x5b3eab?0x0:_0x408c8d[_0xf465('0x2f')];var _0x4ef699=_0x5b3eab?_0x14c4ad[_0xf465('0x31')]:_0x408c8d[_0xf465('0x2f')]+_0x408c8d[_0xf465('0x32')];var _0x132005;if(_0x4ef699>=_0x3abff3){_0x4ef699=_0x3abff3;_0x132005=0xc8;}else{_0x132005=0xce;}_0x5b0b17['status'](_0x132005);return _0x5b0b17['set'](_0xf465('0x33'),_0x35bb23+'-'+_0x4ef699+'/'+_0x3abff3)[_0xf465('0x2e')](_0x14c4ad);}return null;};}function patchUpdates(_0x4d243b){return function(_0x3798f7){try{jsonpatch[_0xf465('0x34')](_0x3798f7,_0x4d243b,!![]);}catch(_0x4724c1){return BPromise[_0xf465('0x35')](_0x4724c1);}return _0x3798f7[_0xf465('0x36')]();};}function saveUpdates(_0x25cb23,_0x1aa85d){return function(_0x563df1){if(_0x563df1){return _0x563df1['update'](_0x25cb23)[_0xf465('0x20')](function(_0x598c9b){return _0x598c9b;});}return null;};}function removeEntity(_0x2f71c2,_0x2e4ad9){return function(_0x18bb78){if(_0x18bb78){return _0x18bb78['destroy']()[_0xf465('0x20')](function(){_0x2f71c2[_0xf465('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4246ba,_0x14bf97){return function(_0x314a02){if(!_0x314a02){_0x4246ba[_0xf465('0x2c')](0x194);}return _0x314a02;};}function handleError(_0x373f15,_0x475325){_0x475325=_0x475325||0x1f4;return function(_0x25edee){logger[_0xf465('0x26')](_0x25edee[_0xf465('0x37')]);if(_0x25edee[_0xf465('0x38')]){delete _0x25edee[_0xf465('0x38')];}_0x373f15['status'](_0x475325)[_0xf465('0x39')](_0x25edee);};}exports['index']=function(_0x38565c,_0x13d981){var _0x461a0e={},_0x2f8ce9={},_0x33ab69={'count':0x0,'rows':[]};var _0x93267b=_[_0xf465('0x3a')](db[_0xf465('0x3b')][_0xf465('0x3c')],function(_0xaf4005){return{'name':_0xaf4005['fieldName'],'type':_0xaf4005[_0xf465('0x3d')][_0xf465('0x3e')]};});_0x2f8ce9[_0xf465('0x3f')]=_['map'](_0x93267b,_0xf465('0x38'));_0x2f8ce9[_0xf465('0x40')]=_[_0xf465('0x41')](_0x38565c[_0xf465('0x40')]);_0x2f8ce9[_0xf465('0x42')]=_[_0xf465('0x43')](_0x2f8ce9[_0xf465('0x3f')],_0x2f8ce9[_0xf465('0x40')]);_0x461a0e[_0xf465('0x44')]=_['intersection'](_0x2f8ce9['model'],qs['fields'](_0x38565c[_0xf465('0x40')][_0xf465('0x45')]));_0x461a0e[_0xf465('0x44')]=_0x461a0e['attributes'][_0xf465('0x46')]?_0x461a0e[_0xf465('0x44')]:_0x2f8ce9[_0xf465('0x3f')];if(!_0x38565c[_0xf465('0x40')][_0xf465('0x47')](_0xf465('0x48'))){_0x461a0e[_0xf465('0x32')]=qs['limit'](_0x38565c[_0xf465('0x40')][_0xf465('0x32')]);_0x461a0e['offset']=qs['offset'](_0x38565c[_0xf465('0x40')][_0xf465('0x2f')]);}_0x461a0e[_0xf465('0x49')]=qs[_0xf465('0x4a')](_0x38565c[_0xf465('0x40')][_0xf465('0x4a')]);_0x461a0e['where']=qs[_0xf465('0x42')](_[_0xf465('0x4b')](_0x38565c['query'],_0x2f8ce9[_0xf465('0x42')]),_0x93267b);if(_0x38565c[_0xf465('0x40')][_0xf465('0x4c')]){_0x461a0e['where']=_['merge'](_0x461a0e['where'],{'$or':_['map'](_0x93267b,function(_0x290408){if(_0x290408[_0xf465('0x3d')]!==_0xf465('0x4d')){var _0x1465af={};_0x1465af[_0x290408['name']]={'$like':'%'+_0x38565c[_0xf465('0x40')][_0xf465('0x4c')]+'%'};return _0x1465af;}})});}_0x461a0e=_[_0xf465('0x4e')]({},_0x461a0e,_0x38565c['options']);var _0xf4666={'where':_0x461a0e[_0xf465('0x4f')]};return db[_0xf465('0x3b')][_0xf465('0x31')](_0xf4666)['then'](function(_0x1e46d){_0x33ab69['count']=_0x1e46d;if(_0x38565c[_0xf465('0x40')][_0xf465('0x50')]){_0x461a0e[_0xf465('0x51')]=[{'all':!![]}];}return db[_0xf465('0x3b')][_0xf465('0x52')](_0x461a0e);})['then'](function(_0x48d31d){_0x33ab69['rows']=_0x48d31d;return _0x33ab69;})[_0xf465('0x20')](respondWithFilteredResult(_0x13d981,_0x461a0e))[_0xf465('0x2b')](handleError(_0x13d981,null));};exports[_0xf465('0x53')]=function(_0x522e4d,_0x34c92e){var _0x315ec8={'raw':!![],'where':{'id':_0x522e4d[_0xf465('0x54')]['id']}},_0xe465c6={};_0xe465c6['model']=_[_0xf465('0x41')](db[_0xf465('0x3b')][_0xf465('0x3c')]);_0xe465c6[_0xf465('0x40')]=_['keys'](_0x522e4d[_0xf465('0x40')]);_0xe465c6[_0xf465('0x42')]=_[_0xf465('0x43')](_0xe465c6[_0xf465('0x3f')],_0xe465c6[_0xf465('0x40')]);_0x315ec8['attributes']=_['intersection'](_0xe465c6[_0xf465('0x3f')],qs['fields'](_0x522e4d['query']['fields']));_0x315ec8[_0xf465('0x44')]=_0x315ec8['attributes']['length']?_0x315ec8[_0xf465('0x44')]:_0xe465c6[_0xf465('0x3f')];if(_0x522e4d['query'][_0xf465('0x50')]){_0x315ec8[_0xf465('0x51')]=[{'all':!![]}];}_0x315ec8=_[_0xf465('0x4e')]({},_0x315ec8,_0x522e4d['options']);return db[_0xf465('0x3b')]['find'](_0x315ec8)[_0xf465('0x20')](handleEntityNotFound(_0x34c92e,null))[_0xf465('0x20')](respondWithResult(_0x34c92e,null))[_0xf465('0x2b')](handleError(_0x34c92e,null));};exports[_0xf465('0x55')]=function(_0x18c0be,_0x1efa96){return db[_0xf465('0x3b')][_0xf465('0x55')](_0x18c0be[_0xf465('0x56')],{})['then'](respondWithResult(_0x1efa96,0xc9))['catch'](handleError(_0x1efa96,null));};exports['update']=function(_0x185de9,_0x41fab2){if(_0x185de9[_0xf465('0x56')]['id']){delete _0x185de9['body']['id'];}return db[_0xf465('0x3b')][_0xf465('0x57')]({'where':{'id':_0x185de9[_0xf465('0x54')]['id']}})['then'](handleEntityNotFound(_0x41fab2,null))[_0xf465('0x20')](saveUpdates(_0x185de9[_0xf465('0x56')],null))['then'](respondWithResult(_0x41fab2,null))[_0xf465('0x2b')](handleError(_0x41fab2,null));};exports['destroy']=function(_0x365a3d,_0x2e070a){return db[_0xf465('0x3b')][_0xf465('0x57')]({'where':{'id':_0x365a3d[_0xf465('0x54')]['id']}})['then'](handleEntityNotFound(_0x2e070a,null))['then'](removeEntity(_0x2e070a,null))[_0xf465('0x2b')](handleError(_0x2e070a,null));};exports[_0xf465('0x58')]=function(_0xddcbd1,_0xccb2c5){return db['ChatMessage'][_0xf465('0x58')]()[_0xf465('0x20')](respondWithResult(_0xccb2c5,null))[_0xf465('0x2b')](handleError(_0xccb2c5,null));};var interaction_log=require('../../config/logger')(_0xf465('0x59'));exports[_0xf465('0x5a')]=function(_0x341de5,_0x4c82d6,_0x43f0ed){var _0x2ebb70={'agent':{},'channel':_0xf465('0x5b')};if(_0x341de5[_0xf465('0x56')]['id']){delete _0x341de5[_0xf465('0x56')]['id'];}_0x341de5['body'][_0xf465('0x5c')]=!![];_0x341de5[_0xf465('0x56')][_0xf465('0x5d')]=moment()[_0xf465('0x5e')](_0xf465('0x5f'));_0x341de5['body']['UserId']=_0x341de5[_0xf465('0x56')][_0xf465('0x60')]||_0x341de5[_0xf465('0x61')]['id'];_0x2ebb70[_0xf465('0x62')]['id']=_0x341de5['body'][_0xf465('0x60')];return db['ChatMessage']['find']({'where':{'id':_0x341de5['params']['id'],'UserId':null}})[_0xf465('0x20')](handleEntityNotFound(_0x4c82d6,null))['then'](saveUpdates(_0x341de5['body'],null))[_0xf465('0x20')](function(_0x1e77dc){if(_0x1e77dc){_0x2ebb70[_0xf465('0x28')]=_0x1e77dc[_0xf465('0x63')]({'plain':!![]});return db['ChatInteraction'][_0xf465('0x57')]({'where':{'id':_0x1e77dc[_0xf465('0x64')]}});}return null;})[_0xf465('0x20')](handleEntityNotFound(_0x4c82d6,null))['then'](function(_0x31f526){if(_0x31f526){return _0x31f526[_0xf465('0x65')]({'UserId':_0x341de5[_0xf465('0x56')][_0xf465('0x60')],'read1stAt':_[_0xf465('0x66')](_0x31f526['read1stAt'])?moment()[_0xf465('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf465('0x20')](function(_0x47b6c5){if(_0x47b6c5){_0x2ebb70[_0xf465('0x67')]=_0x47b6c5[_0xf465('0x63')]({'plain':!![]});interaction_log[_0xf465('0x29')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x341de5[_0xf465('0x61')]['id'],_0x341de5['user'][_0xf465('0x38')],_0x341de5['user'][_0xf465('0x68')],_0x2ebb70[_0xf465('0x67')]['id'],_0x341de5['body']?JSON[_0xf465('0x25')](_0x341de5[_0xf465('0x56')]):_0xf465('0x69'));return respondWithRpcPromise(_0xf465('0x6a'),'acceptMessage',_0x2ebb70);}return null;})[_0xf465('0x20')](function(_0x4c9501){var _0x1aa3db=_0xf465('0x6b')+_0x4c9501[_0xf465('0x28')][_0xf465('0x6c')];return db['sequelize'][_0xf465('0x40')](_0x1aa3db,{'type':db[_0xf465('0x6d')][_0xf465('0x6e')]['SELECT'],'raw':!![]})[_0xf465('0x20')](function(_0x42363f){return _0x42363f;});})[_0xf465('0x20')](function(_0x15bcff){if(_0x15bcff){_0x2ebb70[_0xf465('0x28')][_0xf465('0x6f')]=_0x15bcff[0x0];if(!_0x341de5['body'][_0xf465('0x60')])return;return db[_0xf465('0x70')]['find']({'where':{'id':_0x341de5['body'][_0xf465('0x60')],'role':_0xf465('0x62')},'attributes':['id',_0xf465('0x38'),'fullname',_0xf465('0x71'),_0xf465('0x72')],'raw':!![]});}return null;})['then'](function(_0x4b09ea){if(!_0x4b09ea)return null;_0x2ebb70[_0xf465('0x28')][_0xf465('0x62')]=_0x4b09ea;return _0x2ebb70;})[_0xf465('0x20')](function(_0x1a1eab){if(_0x1a1eab){if(_0x341de5['body'][_0xf465('0x73')]){_0x2ebb70[_0xf465('0x28')][_0xf465('0x74')]=util[_0xf465('0x5e')](_0xf465('0x75'),_0x341de5[_0xf465('0x61')][_0xf465('0x38')]);_0x2ebb70[_0xf465('0x28')][_0xf465('0x76')]=_0x2ebb70['channel'];_0x2ebb70[_0xf465('0x28')]['motionChannel']=_0x2ebb70[_0xf465('0x76')];_0x2ebb70[_0xf465('0x28')][_0xf465('0x77')]=_0xf465('0x5a');return respondWithRpcPromise(_0xf465('0x78'),_0xf465('0x78'),{'event':_0xf465('0x79'),'message':_[_0xf465('0x4e')](_0x2ebb70[_0xf465('0x28')],JSON[_0xf465('0x7a')](_0x2ebb70['interaction'][_0xf465('0x7b')]))},client9002)['then'](function(){return _0x2ebb70;});}return _0x2ebb70;}return null;})['then'](respondWithResult(_0x4c82d6,null))[_0xf465('0x2b')](handleError(_0x4c82d6,null));};var interaction_log=require('../../config/logger')(_0xf465('0x59'));exports[_0xf465('0x35')]=function(_0x1aadca,_0x4bc62a,_0x5a891d){var _0x3b11d7={'agent':{},'channel':'chat'};if(_0x1aadca[_0xf465('0x56')]['id']){delete _0x1aadca['body']['id'];}_0x1aadca['body'][_0xf465('0x60')]=_0x1aadca[_0xf465('0x56')][_0xf465('0x60')]||_0x1aadca[_0xf465('0x61')]['id'];_0x3b11d7[_0xf465('0x62')]['id']=_0x1aadca[_0xf465('0x56')][_0xf465('0x60')];return db['ChatMessage'][_0xf465('0x57')]({'where':{'id':_0x1aadca[_0xf465('0x54')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4bc62a,null))[_0xf465('0x20')](function(_0x170d45){if(_0x170d45){_0x3b11d7['message']=_0x170d45[_0xf465('0x63')]({'plain':!![]});return db[_0xf465('0x7c')][_0xf465('0x57')]({'where':{'id':_0x170d45[_0xf465('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x4bc62a,null))[_0xf465('0x20')](function(_0x31e714){if(_0x31e714){_0x3b11d7[_0xf465('0x67')]=_0x31e714['get']({'plain':!![]});interaction_log['info'](_0xf465('0x7d'),_0x1aadca[_0xf465('0x61')]['id'],_0x1aadca[_0xf465('0x61')][_0xf465('0x38')],_0x1aadca[_0xf465('0x61')]['role'],_0x3b11d7['interaction']['id'],_0x1aadca[_0xf465('0x56')]?JSON[_0xf465('0x25')](_0x1aadca[_0xf465('0x56')]):'null');return respondWithRpcPromise(_0xf465('0x7e'),_0xf465('0x7f'),_0x3b11d7);}return null;})[_0xf465('0x20')](function(_0x5344fd){var _0x147d88=_0xf465('0x6b')+_0x5344fd[_0xf465('0x28')][_0xf465('0x6c')];return db[_0xf465('0x80')][_0xf465('0x40')](_0x147d88,{'type':db[_0xf465('0x6d')][_0xf465('0x6e')][_0xf465('0x81')],'raw':!![]})[_0xf465('0x20')](function(_0x4c8c8b){return _0x4c8c8b;});})['then'](function(_0x170b01){if(_0x170b01){_0x3b11d7[_0xf465('0x28')][_0xf465('0x6f')]=_0x170b01[0x0];if(!_0x1aadca[_0xf465('0x56')][_0xf465('0x60')])return;return db['User'][_0xf465('0x57')]({'where':{'id':_0x1aadca[_0xf465('0x56')]['UserId'],'role':_0xf465('0x62')},'attributes':['id',_0xf465('0x38'),_0xf465('0x82'),_0xf465('0x71'),'internal'],'raw':!![]});}return null;})[_0xf465('0x20')](function(_0x5c5c40){if(!_0x5c5c40)return null;_0x3b11d7[_0xf465('0x28')][_0xf465('0x62')]=_0x5c5c40;return _0x3b11d7;})[_0xf465('0x20')](function(_0x19b7eb){if(_0x19b7eb){_0x19b7eb[_0xf465('0x28')][_0xf465('0x74')]=util[_0xf465('0x5e')]('SIP/%s',_0x1aadca[_0xf465('0x61')]['name']);_0x19b7eb[_0xf465('0x28')][_0xf465('0x76')]=_0x3b11d7['channel'];_0x19b7eb['message'][_0xf465('0x83')]=_0x3b11d7[_0xf465('0x76')];_0x19b7eb[_0xf465('0x28')][_0xf465('0x77')]=_0xf465('0x35');respondWithRpcPromise(_0xf465('0x78'),_0xf465('0x78'),{'event':_0xf465('0x84'),'message':_[_0xf465('0x4e')](_0x3b11d7[_0xf465('0x28')],JSON['parse'](_0x3b11d7[_0xf465('0x67')][_0xf465('0x7b')]))},client9002);return _0x3b11d7;}return null;})[_0xf465('0x20')](respondWithResult(_0x4bc62a,null))[_0xf465('0x2b')](handleError(_0x4bc62a,null));}; \ No newline at end of file +var _0xd91c=['pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','describe','../../config/logger','chat-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteractionId','isNil','interaction','[CHATMESSAGE: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','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','parse','formData','chat','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','QueryTypes','interface','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./chatMessage.socket','register','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','ChatMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where'];(function(_0xd36736,_0x48433a){var _0x5889d4=function(_0x58b286){while(--_0x58b286){_0xd36736['push'](_0xd36736['shift']());}};_0x5889d4(++_0x48433a);}(_0xd91c,0x159));var _0xcd91=function(_0x200396,_0x1fa29e){_0x200396=_0x200396-0x0;var _0x1ef7ce=_0xd91c[_0x200396];return _0x1ef7ce;};'use strict';var emlformat=require(_0xcd91('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcd91('0x1'));var jsonpatch=require(_0xcd91('0x2'));var rp=require(_0xcd91('0x3'));var moment=require(_0xcd91('0x4'));var BPromise=require(_0xcd91('0x5'));var Mustache=require(_0xcd91('0x6'));var util=require('util');var path=require(_0xcd91('0x7'));var sox=require(_0xcd91('0x8'));var csv=require(_0xcd91('0x9'));var ejs=require(_0xcd91('0xa'));var fs=require('fs');var fs_extra=require(_0xcd91('0xb'));var _=require(_0xcd91('0xc'));var squel=require(_0xcd91('0xd'));var crypto=require(_0xcd91('0xe'));var jsforce=require(_0xcd91('0xf'));var deskjs=require(_0xcd91('0x10'));var toCsv=require('to-csv');var querystring=require(_0xcd91('0x11'));var Papa=require(_0xcd91('0x12'));var Redis=require(_0xcd91('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xcd91('0x14'));var as=require(_0xcd91('0x15'));var hardwareService=require(_0xcd91('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xcd91('0x17'));var config=require(_0xcd91('0x18'));var licenseUtil=require(_0xcd91('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xcd91('0x1a')],{'host':_0xcd91('0x1b'),'port':0x18eb});var socket=require(_0xcd91('0x1c'))(new Redis(config['redis']));require(_0xcd91('0x1d'))[_0xcd91('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xcd91('0x1f')][_0xcd91('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x15cefd,_0x201f56,_0x51fefd,_0x27aacf){return new BPromise(function(_0x4b87c3,_0x115d97){var _0x10b6d8=_0x27aacf||client;return _0x10b6d8[_0xcd91('0x21')](_0x15cefd,_0x51fefd)[_0xcd91('0x22')](function(_0xca899a){logger[_0xcd91('0x23')](_0xcd91('0x24'),_0x201f56,'request\x20sent');logger[_0xcd91('0x25')](_0xcd91('0x26'),_0x201f56,_0xcd91('0x27'),JSON[_0xcd91('0x28')](_0xca899a));if(_0xca899a['error']){if(_0xca899a[_0xcd91('0x29')]['code']===0x1f4){logger['error'](_0xcd91('0x24'),_0x201f56,_0xca899a['error'][_0xcd91('0x2a')]);return _0x115d97(_0xca899a[_0xcd91('0x29')][_0xcd91('0x2a')]);}logger[_0xcd91('0x29')](_0xcd91('0x24'),_0x201f56,_0xca899a['error'][_0xcd91('0x2a')]);return _0x4b87c3(_0xca899a[_0xcd91('0x29')][_0xcd91('0x2a')]);}else{logger['info'](_0xcd91('0x24'),_0x201f56,'request\x20sent');_0x4b87c3(_0xca899a[_0xcd91('0x2b')][_0xcd91('0x2a')]);}})['catch'](function(_0x4b14d5){logger[_0xcd91('0x29')](_0xcd91('0x24'),_0x201f56,_0x4b14d5);_0x115d97(_0x4b14d5);});});}function respondWithStatusCode(_0xb31bd5,_0x21fa25){_0x21fa25=_0x21fa25||0xcc;return function(_0x145e25){if(_0x145e25){return _0xb31bd5[_0xcd91('0x2c')](_0x21fa25);}return _0xb31bd5[_0xcd91('0x2d')](_0x21fa25)[_0xcd91('0x2e')]();};}function respondWithResult(_0x5aa6b0,_0x14e16b){_0x14e16b=_0x14e16b||0xc8;return function(_0x4c3740){if(_0x4c3740){return _0x5aa6b0['status'](_0x14e16b)[_0xcd91('0x2f')](_0x4c3740);}};}function respondWithFilteredResult(_0x37965e,_0x57af76){return function(_0x55e08f){if(_0x55e08f){var _0x44898f=typeof _0x57af76[_0xcd91('0x30')]===_0xcd91('0x31')&&typeof _0x57af76[_0xcd91('0x32')]===_0xcd91('0x31');var _0x574160=_0x55e08f['count'];var _0x431d32=_0x44898f?0x0:_0x57af76[_0xcd91('0x30')];var _0x5df3d9=_0x44898f?_0x55e08f[_0xcd91('0x33')]:_0x57af76['offset']+_0x57af76[_0xcd91('0x32')];var _0xab0873;if(_0x5df3d9>=_0x574160){_0x5df3d9=_0x574160;_0xab0873=0xc8;}else{_0xab0873=0xce;}_0x37965e[_0xcd91('0x2d')](_0xab0873);return _0x37965e[_0xcd91('0x34')](_0xcd91('0x35'),_0x431d32+'-'+_0x5df3d9+'/'+_0x574160)[_0xcd91('0x2f')](_0x55e08f);}return null;};}function patchUpdates(_0x156934){return function(_0x51fd51){try{jsonpatch[_0xcd91('0x36')](_0x51fd51,_0x156934,!![]);}catch(_0x2f3152){return BPromise[_0xcd91('0x37')](_0x2f3152);}return _0x51fd51['save']();};}function saveUpdates(_0x107096,_0x563b02){return function(_0x3a0430){if(_0x3a0430){return _0x3a0430[_0xcd91('0x38')](_0x107096)[_0xcd91('0x22')](function(_0x405ccc){return _0x405ccc;});}return null;};}function removeEntity(_0x9c35d4,_0x54617e){return function(_0x55188c){if(_0x55188c){return _0x55188c[_0xcd91('0x39')]()[_0xcd91('0x22')](function(){_0x9c35d4[_0xcd91('0x2d')](0xcc)[_0xcd91('0x2e')]();});}};}function handleEntityNotFound(_0x2060f0,_0x51772c){return function(_0x4ee37b){if(!_0x4ee37b){_0x2060f0[_0xcd91('0x2c')](0x194);}return _0x4ee37b;};}function handleError(_0x5bf66c,_0x414371){_0x414371=_0x414371||0x1f4;return function(_0x3a2415){logger[_0xcd91('0x29')](_0x3a2415[_0xcd91('0x3a')]);if(_0x3a2415[_0xcd91('0x3b')]){delete _0x3a2415[_0xcd91('0x3b')];}_0x5bf66c[_0xcd91('0x2d')](_0x414371)[_0xcd91('0x3c')](_0x3a2415);};}exports[_0xcd91('0x3d')]=function(_0x8f3513,_0x4eb208){var _0x56e899={},_0x4e2d51={},_0x5d3647={'count':0x0,'rows':[]};var _0x4537fb=_['map'](db[_0xcd91('0x3e')][_0xcd91('0x3f')],function(_0x574d1c){return{'name':_0x574d1c[_0xcd91('0x40')],'type':_0x574d1c[_0xcd91('0x41')][_0xcd91('0x42')]};});_0x4e2d51[_0xcd91('0x43')]=_['map'](_0x4537fb,_0xcd91('0x3b'));_0x4e2d51[_0xcd91('0x44')]=_['keys'](_0x8f3513[_0xcd91('0x44')]);_0x4e2d51[_0xcd91('0x45')]=_[_0xcd91('0x46')](_0x4e2d51[_0xcd91('0x43')],_0x4e2d51[_0xcd91('0x44')]);_0x56e899[_0xcd91('0x47')]=_['intersection'](_0x4e2d51[_0xcd91('0x43')],qs[_0xcd91('0x48')](_0x8f3513['query']['fields']));_0x56e899[_0xcd91('0x47')]=_0x56e899[_0xcd91('0x47')][_0xcd91('0x49')]?_0x56e899[_0xcd91('0x47')]:_0x4e2d51[_0xcd91('0x43')];if(!_0x8f3513[_0xcd91('0x44')]['hasOwnProperty'](_0xcd91('0x4a'))){_0x56e899[_0xcd91('0x32')]=qs[_0xcd91('0x32')](_0x8f3513[_0xcd91('0x44')]['limit']);_0x56e899[_0xcd91('0x30')]=qs[_0xcd91('0x30')](_0x8f3513[_0xcd91('0x44')][_0xcd91('0x30')]);}_0x56e899[_0xcd91('0x4b')]=qs[_0xcd91('0x4c')](_0x8f3513[_0xcd91('0x44')]['sort']);_0x56e899[_0xcd91('0x4d')]=qs[_0xcd91('0x45')](_[_0xcd91('0x4e')](_0x8f3513[_0xcd91('0x44')],_0x4e2d51[_0xcd91('0x45')]),_0x4537fb);if(_0x8f3513['query'][_0xcd91('0x4f')]){_0x56e899['where']=_[_0xcd91('0x50')](_0x56e899['where'],{'$or':_[_0xcd91('0x51')](_0x4537fb,function(_0xe93b5a){if(_0xe93b5a[_0xcd91('0x41')]!==_0xcd91('0x52')){var _0x2e5887={};_0x2e5887[_0xe93b5a[_0xcd91('0x3b')]]={'$like':'%'+_0x8f3513[_0xcd91('0x44')][_0xcd91('0x4f')]+'%'};return _0x2e5887;}})});}_0x56e899=_['merge']({},_0x56e899,_0x8f3513['options']);var _0x48a343={'where':_0x56e899[_0xcd91('0x4d')]};return db['ChatMessage'][_0xcd91('0x33')](_0x48a343)['then'](function(_0x48d61e){_0x5d3647[_0xcd91('0x33')]=_0x48d61e;if(_0x8f3513[_0xcd91('0x44')][_0xcd91('0x53')]){_0x56e899[_0xcd91('0x54')]=[{'all':!![]}];}return db[_0xcd91('0x3e')][_0xcd91('0x55')](_0x56e899);})[_0xcd91('0x22')](function(_0x34b6ee){_0x5d3647[_0xcd91('0x56')]=_0x34b6ee;return _0x5d3647;})[_0xcd91('0x22')](respondWithFilteredResult(_0x4eb208,_0x56e899))[_0xcd91('0x57')](handleError(_0x4eb208,null));};exports[_0xcd91('0x58')]=function(_0x48801e,_0x384516){var _0x348a10={'raw':!![],'where':{'id':_0x48801e[_0xcd91('0x59')]['id']}},_0x139f2b={};_0x139f2b[_0xcd91('0x43')]=_[_0xcd91('0x5a')](db[_0xcd91('0x3e')][_0xcd91('0x3f')]);_0x139f2b[_0xcd91('0x44')]=_[_0xcd91('0x5a')](_0x48801e[_0xcd91('0x44')]);_0x139f2b[_0xcd91('0x45')]=_[_0xcd91('0x46')](_0x139f2b[_0xcd91('0x43')],_0x139f2b[_0xcd91('0x44')]);_0x348a10[_0xcd91('0x47')]=_[_0xcd91('0x46')](_0x139f2b[_0xcd91('0x43')],qs['fields'](_0x48801e[_0xcd91('0x44')]['fields']));_0x348a10[_0xcd91('0x47')]=_0x348a10[_0xcd91('0x47')][_0xcd91('0x49')]?_0x348a10['attributes']:_0x139f2b[_0xcd91('0x43')];if(_0x48801e[_0xcd91('0x44')]['includeAll']){_0x348a10[_0xcd91('0x54')]=[{'all':!![]}];}_0x348a10=_[_0xcd91('0x50')]({},_0x348a10,_0x48801e[_0xcd91('0x5b')]);return db['ChatMessage'][_0xcd91('0x5c')](_0x348a10)[_0xcd91('0x22')](handleEntityNotFound(_0x384516,null))[_0xcd91('0x22')](respondWithResult(_0x384516,null))[_0xcd91('0x57')](handleError(_0x384516,null));};exports[_0xcd91('0x5d')]=function(_0x23423e,_0xfc21a0){return db['ChatMessage'][_0xcd91('0x5d')](_0x23423e[_0xcd91('0x5e')],{})[_0xcd91('0x22')](respondWithResult(_0xfc21a0,0xc9))[_0xcd91('0x57')](handleError(_0xfc21a0,null));};exports[_0xcd91('0x38')]=function(_0x35abb5,_0x94b7cd){if(_0x35abb5[_0xcd91('0x5e')]['id']){delete _0x35abb5[_0xcd91('0x5e')]['id'];}return db['ChatMessage'][_0xcd91('0x5c')]({'where':{'id':_0x35abb5['params']['id']}})[_0xcd91('0x22')](handleEntityNotFound(_0x94b7cd,null))['then'](saveUpdates(_0x35abb5[_0xcd91('0x5e')],null))[_0xcd91('0x22')](respondWithResult(_0x94b7cd,null))[_0xcd91('0x57')](handleError(_0x94b7cd,null));};exports['destroy']=function(_0x1b2624,_0x3aaf2d){return db[_0xcd91('0x3e')][_0xcd91('0x5c')]({'where':{'id':_0x1b2624[_0xcd91('0x59')]['id']}})[_0xcd91('0x22')](handleEntityNotFound(_0x3aaf2d,null))[_0xcd91('0x22')](removeEntity(_0x3aaf2d,null))[_0xcd91('0x57')](handleError(_0x3aaf2d,null));};exports[_0xcd91('0x5f')]=function(_0x3890f0,_0x4355bd){return db[_0xcd91('0x3e')][_0xcd91('0x5f')]()[_0xcd91('0x22')](respondWithResult(_0x4355bd,null))[_0xcd91('0x57')](handleError(_0x4355bd,null));};var interaction_log=require(_0xcd91('0x60'))(_0xcd91('0x61'));exports['accept']=function(_0x384d24,_0x39030d,_0x70b5e6){var _0x4ff5e1={'agent':{},'channel':'chat'};if(_0x384d24[_0xcd91('0x5e')]['id']){delete _0x384d24[_0xcd91('0x5e')]['id'];}_0x384d24[_0xcd91('0x5e')][_0xcd91('0x62')]=!![];_0x384d24['body'][_0xcd91('0x63')]=moment()[_0xcd91('0x64')](_0xcd91('0x65'));_0x384d24[_0xcd91('0x5e')][_0xcd91('0x66')]=_0x384d24['body'][_0xcd91('0x66')]||_0x384d24[_0xcd91('0x67')]['id'];_0x4ff5e1[_0xcd91('0x68')]['id']=_0x384d24[_0xcd91('0x5e')][_0xcd91('0x66')];return db[_0xcd91('0x3e')]['find']({'where':{'id':_0x384d24['params']['id'],'UserId':null}})[_0xcd91('0x22')](handleEntityNotFound(_0x39030d,null))['then'](saveUpdates(_0x384d24[_0xcd91('0x5e')],null))[_0xcd91('0x22')](function(_0x574e42){if(_0x574e42){_0x4ff5e1[_0xcd91('0x2a')]=_0x574e42[_0xcd91('0x69')]({'plain':!![]});return db['ChatInteraction'][_0xcd91('0x5c')]({'where':{'id':_0x574e42[_0xcd91('0x6a')]}});}return null;})[_0xcd91('0x22')](handleEntityNotFound(_0x39030d,null))['then'](function(_0x4a651c){if(_0x4a651c){return _0x4a651c[_0xcd91('0x38')]({'UserId':_0x384d24[_0xcd91('0x5e')][_0xcd91('0x66')],'read1stAt':_[_0xcd91('0x6b')](_0x4a651c['read1stAt'])?moment()[_0xcd91('0x64')](_0xcd91('0x65')):undefined});}return null;})[_0xcd91('0x22')](function(_0x5940b0){if(_0x5940b0){_0x4ff5e1[_0xcd91('0x6c')]=_0x5940b0[_0xcd91('0x69')]({'plain':!![]});interaction_log[_0xcd91('0x23')](_0xcd91('0x6d'),_0x384d24[_0xcd91('0x67')]['id'],_0x384d24[_0xcd91('0x67')]['name'],_0x384d24['user'][_0xcd91('0x6e')],_0x4ff5e1[_0xcd91('0x6c')]['id'],_0x384d24[_0xcd91('0x5e')]?JSON[_0xcd91('0x28')](_0x384d24['body']):_0xcd91('0x6f'));return respondWithRpcPromise(_0xcd91('0x70'),_0xcd91('0x71'),_0x4ff5e1);}return null;})['then'](function(_0x5b61c1){var _0x4b1f2f=_0xcd91('0x72')+_0x5b61c1['message'][_0xcd91('0x73')];return db['sequelize'][_0xcd91('0x44')](_0x4b1f2f,{'type':db[_0xcd91('0x74')]['QueryTypes'][_0xcd91('0x75')],'raw':!![]})[_0xcd91('0x22')](function(_0x41034a){return _0x41034a;});})[_0xcd91('0x22')](function(_0x4ba26f){if(_0x4ba26f){_0x4ff5e1[_0xcd91('0x2a')][_0xcd91('0x76')]=_0x4ba26f[0x0];if(!_0x384d24[_0xcd91('0x5e')][_0xcd91('0x66')])return;return db[_0xcd91('0x77')]['find']({'where':{'id':_0x384d24['body'][_0xcd91('0x66')],'role':_0xcd91('0x68')},'attributes':['id',_0xcd91('0x3b'),_0xcd91('0x78'),_0xcd91('0x79'),_0xcd91('0x7a')],'raw':!![]});}return null;})[_0xcd91('0x22')](function(_0x4513a4){if(!_0x4513a4)return null;_0x4ff5e1[_0xcd91('0x2a')][_0xcd91('0x68')]=_0x4513a4;return _0x4ff5e1;})[_0xcd91('0x22')](function(_0x4d703c){if(_0x4d703c){if(_0x384d24[_0xcd91('0x5e')][_0xcd91('0x7b')]){_0x4ff5e1[_0xcd91('0x2a')]['interface']=util['format'](_0xcd91('0x7c'),_0x384d24[_0xcd91('0x67')][_0xcd91('0x3b')]);_0x4ff5e1[_0xcd91('0x2a')][_0xcd91('0x7d')]=_0x4ff5e1['channel'];_0x4ff5e1['message'][_0xcd91('0x7e')]=_0x4ff5e1[_0xcd91('0x7d')];_0x4ff5e1['message'][_0xcd91('0x7f')]=_0xcd91('0x80');return respondWithRpcPromise(_0xcd91('0x81'),_0xcd91('0x81'),{'event':_0xcd91('0x82'),'message':_[_0xcd91('0x50')](_0x4ff5e1[_0xcd91('0x2a')],JSON[_0xcd91('0x83')](_0x4ff5e1[_0xcd91('0x6c')][_0xcd91('0x84')]))},client9002)[_0xcd91('0x22')](function(){return _0x4ff5e1;});}return _0x4ff5e1;}return null;})['then'](respondWithResult(_0x39030d,null))['catch'](handleError(_0x39030d,null));};var interaction_log=require(_0xcd91('0x60'))(_0xcd91('0x61'));exports['reject']=function(_0x17788b,_0x290828,_0xcb0ede){var _0x33bdf7={'agent':{},'channel':_0xcd91('0x85')};if(_0x17788b['body']['id']){delete _0x17788b[_0xcd91('0x5e')]['id'];}_0x17788b[_0xcd91('0x5e')][_0xcd91('0x66')]=_0x17788b[_0xcd91('0x5e')][_0xcd91('0x66')]||_0x17788b[_0xcd91('0x67')]['id'];_0x33bdf7[_0xcd91('0x68')]['id']=_0x17788b[_0xcd91('0x5e')][_0xcd91('0x66')];return db[_0xcd91('0x3e')]['find']({'where':{'id':_0x17788b[_0xcd91('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x290828,null))['then'](function(_0x5b6d57){if(_0x5b6d57){_0x33bdf7[_0xcd91('0x2a')]=_0x5b6d57[_0xcd91('0x69')]({'plain':!![]});return db[_0xcd91('0x86')][_0xcd91('0x5c')]({'where':{'id':_0x5b6d57['ChatInteractionId']}});}return null;})[_0xcd91('0x22')](handleEntityNotFound(_0x290828,null))[_0xcd91('0x22')](function(_0x51aa16){if(_0x51aa16){_0x33bdf7[_0xcd91('0x6c')]=_0x51aa16[_0xcd91('0x69')]({'plain':!![]});interaction_log[_0xcd91('0x23')](_0xcd91('0x87'),_0x17788b[_0xcd91('0x67')]['id'],_0x17788b[_0xcd91('0x67')][_0xcd91('0x3b')],_0x17788b['user']['role'],_0x33bdf7[_0xcd91('0x6c')]['id'],_0x17788b[_0xcd91('0x5e')]?JSON[_0xcd91('0x28')](_0x17788b[_0xcd91('0x5e')]):_0xcd91('0x6f'));return respondWithRpcPromise('RejectMessage',_0xcd91('0x88'),_0x33bdf7);}return null;})[_0xcd91('0x22')](function(_0x3750c1){var _0x2a56c3=_0xcd91('0x72')+_0x3750c1['message']['ContactId'];return db[_0xcd91('0x89')]['query'](_0x2a56c3,{'type':db[_0xcd91('0x74')][_0xcd91('0x8a')][_0xcd91('0x75')],'raw':!![]})[_0xcd91('0x22')](function(_0x2ca9aa){return _0x2ca9aa;});})[_0xcd91('0x22')](function(_0x13c78a){if(_0x13c78a){_0x33bdf7[_0xcd91('0x2a')][_0xcd91('0x76')]=_0x13c78a[0x0];if(!_0x17788b[_0xcd91('0x5e')]['UserId'])return;return db[_0xcd91('0x77')]['find']({'where':{'id':_0x17788b['body'][_0xcd91('0x66')],'role':_0xcd91('0x68')},'attributes':['id',_0xcd91('0x3b'),_0xcd91('0x78'),_0xcd91('0x79'),_0xcd91('0x7a')],'raw':!![]});}return null;})[_0xcd91('0x22')](function(_0x5b64f2){if(!_0x5b64f2)return null;_0x33bdf7[_0xcd91('0x2a')][_0xcd91('0x68')]=_0x5b64f2;return _0x33bdf7;})[_0xcd91('0x22')](function(_0x37331c){if(_0x37331c){_0x37331c[_0xcd91('0x2a')][_0xcd91('0x8b')]=util[_0xcd91('0x64')]('SIP/%s',_0x17788b[_0xcd91('0x67')][_0xcd91('0x3b')]);_0x37331c[_0xcd91('0x2a')][_0xcd91('0x7d')]=_0x33bdf7[_0xcd91('0x7d')];_0x37331c[_0xcd91('0x2a')]['motionChannel']=_0x33bdf7[_0xcd91('0x7d')];_0x37331c[_0xcd91('0x2a')][_0xcd91('0x7f')]=_0xcd91('0x37');respondWithRpcPromise(_0xcd91('0x81'),_0xcd91('0x81'),{'event':_0xcd91('0x8c'),'message':_[_0xcd91('0x50')](_0x33bdf7[_0xcd91('0x2a')],JSON['parse'](_0x33bdf7[_0xcd91('0x6c')][_0xcd91('0x84')]))},client9002);return _0x33bdf7;}return null;})[_0xcd91('0x22')](respondWithResult(_0x290828,null))['catch'](handleError(_0x290828,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index cb79133..a9ec75f 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 _0xb04a=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0xc941ea,_0x408c2e){var _0x3b0f27=function(_0x5a4233){while(--_0x5a4233){_0xc941ea['push'](_0xc941ea['shift']());}};_0x3b0f27(++_0x408c2e);}(_0xb04a,0x67));var _0xab04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb04a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xab04('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xab04('0x1')](0x0);var events={'afterCreate':_0xab04('0x2'),'afterUpdate':_0xab04('0x3'),'afterDestroy':_0xab04('0x4')};function emitEvent(_0x48112b){return function(_0x54a524,_0x24d857,_0x5d9fc2){ChatMessageEvents['emit'](_0x48112b+':'+_0x54a524['id'],_0x54a524);ChatMessageEvents[_0xab04('0x5')](_0x48112b,_0x54a524);_0x5d9fc2(null);};}for(var e in events){if(events[_0xab04('0x6')](e)){var event=events[e];ChatMessage[_0xab04('0x7')](e,emitEvent(event));}}module[_0xab04('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x721b=['emit','hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x721b,0x150));var _0xb721=function(_0x5e1bc0,_0x1be942){_0x5e1bc0=_0x5e1bc0-0x0;var _0x24f992=_0x721b[_0x5e1bc0];return _0x24f992;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xb721('0x0'))['db'][_0xb721('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xb721('0x2')](0x0);var events={'afterCreate':_0xb721('0x3'),'afterUpdate':_0xb721('0x4'),'afterDestroy':_0xb721('0x5')};function emitEvent(_0x2c1217){return function(_0x5e27ac,_0x25513e,_0x4b25e4){ChatMessageEvents[_0xb721('0x6')](_0x2c1217+':'+_0x5e27ac['id'],_0x5e27ac);ChatMessageEvents[_0xb721('0x6')](_0x2c1217,_0x5e27ac);_0x4b25e4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xb721('0x7')](e,emitEvent(event));}}module[_0xb721('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index c5cb261..492cb5f 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 _0xe74d=['error','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','UserId','ChatInteraction','findOne','then','update','createdAt','catch'];(function(_0x2fb816,_0x1dadbb){var _0x557527=function(_0x461714){while(--_0x461714){_0x2fb816['push'](_0x2fb816['shift']());}};_0x557527(++_0x1dadbb);}(_0xe74d,0x16e));var _0xde74=function(_0x18d36f,_0x31b65f){_0x18d36f=_0x18d36f-0x0;var _0x10034d=_0xe74d[_0x18d36f];return _0x10034d;};'use strict';var _=require(_0xde74('0x0'));var util=require(_0xde74('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xde74('0x2'));var BPromise=require(_0xde74('0x3'));var rp=require(_0xde74('0x4'));var fs=require('fs');var path=require(_0xde74('0x5'));var rimraf=require('rimraf');var config=require(_0xde74('0x6'));var attributes=require(_0xde74('0x7'));module[_0xde74('0x8')]=function(_0x328c43,_0x4800a3){return _0x328c43[_0xde74('0x9')](_0xde74('0xa'),attributes,{'tableName':_0xde74('0xb'),'paranoid':![],'indexes':[{'name':_0xde74('0xc'),'fields':[_0xde74('0xd')],'type':_0xde74('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x27c148,_0x3e214e,_0x392082){var _0x146ecf=_0x328c43[_0xde74('0xf')];var _0x542f15=_0x27c148['get']({'plain':!![]});if(_0x542f15[_0xde74('0x10')][_0xde74('0x11')]()==='in'||_0x542f15[_0xde74('0x10')]['toLowerCase']()===_0xde74('0x12')&&!_0x542f15['secret']&&!_['isNil'](_0x542f15[_0xde74('0x13')])){_0x146ecf[_0xde74('0x14')][_0xde74('0x15')]({'where':{'id':_0x542f15['ChatInteractionId']}})[_0xde74('0x16')](function(_0x125c9b){if(_0x125c9b){_0x125c9b[_0xde74('0x17')]({'lastMsgAt':_0x542f15[_0xde74('0x18')],'lastMsgDirection':_0x542f15['direction']['toLowerCase']()});}})[_0xde74('0x19')](function(_0xa376){console[_0xde74('0x1a')](_0xa376);});}_0x392082();}},'charset':'utf8mb4','collate':_0xde74('0x1b')});}; \ No newline at end of file +var _0xb439=['ChatMessage','chat_messages','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','ChatInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./chatMessage.attributes','exports','define'];(function(_0x2fa67e,_0x1fe7e0){var _0x56a2c9=function(_0x48fb59){while(--_0x48fb59){_0x2fa67e['push'](_0x2fa67e['shift']());}};_0x56a2c9(++_0x1fe7e0);}(_0xb439,0x87));var _0x9b43=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xb439[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x9b43('0x0'));var util=require(_0x9b43('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9b43('0x2'));var BPromise=require(_0x9b43('0x3'));var rp=require(_0x9b43('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9b43('0x5'));var config=require(_0x9b43('0x6'));var attributes=require(_0x9b43('0x7'));module[_0x9b43('0x8')]=function(_0x3ab870,_0x3d2a05){return _0x3ab870[_0x9b43('0x9')](_0x9b43('0xa'),attributes,{'tableName':_0x9b43('0xb'),'paranoid':![],'indexes':[{'name':_0x9b43('0xc'),'fields':['body'],'type':_0x9b43('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x341492,_0x235503,_0x5d09d6){var _0x27b289=_0x3ab870[_0x9b43('0xe')];var _0x28c8be=_0x341492[_0x9b43('0xf')]({'plain':!![]});if(_0x28c8be[_0x9b43('0x10')][_0x9b43('0x11')]()==='in'||_0x28c8be[_0x9b43('0x10')][_0x9b43('0x11')]()==='out'&&!_0x28c8be[_0x9b43('0x12')]&&!_['isNil'](_0x28c8be[_0x9b43('0x13')])){_0x27b289[_0x9b43('0x14')][_0x9b43('0x15')]({'where':{'id':_0x28c8be['ChatInteractionId']}})[_0x9b43('0x16')](function(_0x470119){if(_0x470119){_0x470119[_0x9b43('0x17')]({'lastMsgAt':_0x28c8be[_0x9b43('0x18')],'lastMsgDirection':_0x28c8be[_0x9b43('0x10')][_0x9b43('0x11')]()});}})[_0x9b43('0x19')](function(_0x34678e){console[_0x9b43('0x1a')](_0x34678e);});}_0x5d09d6();}},'charset':_0x9b43('0x1b'),'collate':_0x9b43('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index ab84721..ab00db7 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 _0x70d7=['then','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','info','result','CreateChatMessage','ChatMessage','options','raw','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x2a4246,_0xe98f2e){var _0x13d361=function(_0x4eacaa){while(--_0x4eacaa){_0x2a4246['push'](_0x2a4246['shift']());}};_0x13d361(++_0xe98f2e);}(_0x70d7,0x1ee));var _0x770d=function(_0x3978e9,_0x202fbf){_0x3978e9=_0x3978e9-0x0;var _0x4c6581=_0x70d7[_0x3978e9];return _0x4c6581;};'use strict';var _=require(_0x770d('0x0'));var util=require(_0x770d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x770d('0x2'));var fs=require('fs');var Redis=require(_0x770d('0x3'));var db=require(_0x770d('0x4'))['db'];var utils=require(_0x770d('0x5'));var logger=require(_0x770d('0x6'))(_0x770d('0x7'));var config=require('../../config/environment');var jayson=require(_0x770d('0x8'));var client=jayson[_0x770d('0x9')][_0x770d('0xa')]({'port':0x232a});config[_0x770d('0xb')]=_[_0x770d('0xc')](config[_0x770d('0xb')],{'host':_0x770d('0xd'),'port':0x18eb});var socket=require(_0x770d('0xe'))(new Redis(config[_0x770d('0xb')]));require('./chatMessage.socket')[_0x770d('0xf')](socket);function respondWithRpcPromise(_0x104b21,_0x1579ca,_0xa9aebe){return new BPromise(function(_0x2c1a71,_0x269a7c){return client['request'](_0x104b21,_0xa9aebe)[_0x770d('0x10')](function(_0x5e1ee1){logger['info']('ChatMessage,\x20%s,\x20%s',_0x1579ca,_0x770d('0x11'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1579ca,_0x770d('0x11'),JSON[_0x770d('0x12')](_0x5e1ee1));if(_0x5e1ee1[_0x770d('0x13')]){if(_0x5e1ee1[_0x770d('0x13')][_0x770d('0x14')]===0x1f4){logger[_0x770d('0x13')](_0x770d('0x15'),_0x1579ca,_0x5e1ee1['error']['message']);return _0x269a7c(_0x5e1ee1[_0x770d('0x13')][_0x770d('0x16')]);}logger[_0x770d('0x13')]('ChatMessage,\x20%s,\x20%s',_0x1579ca,_0x5e1ee1[_0x770d('0x13')][_0x770d('0x16')]);return _0x2c1a71(_0x5e1ee1['error']['message']);}else{logger[_0x770d('0x17')](_0x770d('0x15'),_0x1579ca,_0x770d('0x11'));_0x2c1a71(_0x5e1ee1[_0x770d('0x18')]['message']);}})['catch'](function(_0x3857c7){logger[_0x770d('0x13')]('ChatMessage,\x20%s,\x20%s',_0x1579ca,_0x3857c7);_0x269a7c(_0x3857c7);});});}exports[_0x770d('0x19')]=function(_0x5888e4){var _0xe31303=this;return new Promise(function(_0x49f8af,_0x5d7818){return db[_0x770d('0x1a')]['create'](_0x5888e4['body'],{'raw':_0x5888e4[_0x770d('0x1b')]?_0x5888e4[_0x770d('0x1b')][_0x770d('0x1c')]===undefined?!![]:![]:!![]})[_0x770d('0x10')](function(_0x75e812){logger[_0x770d('0x17')]('CreateChatMessage',_0x5888e4);logger[_0x770d('0x1d')](_0x770d('0x19'),_0x5888e4,JSON[_0x770d('0x12')](_0x75e812));_0x49f8af(_0x75e812);})['catch'](function(_0x253a66){logger[_0x770d('0x13')](_0x770d('0x19'),_0x253a66['message'],_0x5888e4);_0x5d7818(_0xe31303[_0x770d('0x13')](0x1f4,_0x253a66[_0x770d('0x16')]));});});}; \ No newline at end of file +var _0x2fe5=['request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','message','info','CreateChatMessage','ChatMessage','create','options','raw','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatMessage.socket','register'];(function(_0x248ff5,_0x1dab91){var _0xc23327=function(_0x53912a){while(--_0x53912a){_0x248ff5['push'](_0x248ff5['shift']());}};_0xc23327(++_0x1dab91);}(_0x2fe5,0x1bd));var _0x52fe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2fe5[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x52fe('0x0'));var util=require(_0x52fe('0x1'));var moment=require(_0x52fe('0x2'));var BPromise=require(_0x52fe('0x3'));var rs=require(_0x52fe('0x4'));var fs=require('fs');var Redis=require(_0x52fe('0x5'));var db=require(_0x52fe('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x52fe('0x7'))('rpc');var config=require(_0x52fe('0x8'));var jayson=require(_0x52fe('0x9'));var client=jayson[_0x52fe('0xa')][_0x52fe('0xb')]({'port':0x232a});config[_0x52fe('0xc')]=_[_0x52fe('0xd')](config[_0x52fe('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x52fe('0xe'))(new Redis(config['redis']));require(_0x52fe('0xf'))[_0x52fe('0x10')](socket);function respondWithRpcPromise(_0x533965,_0x57db28,_0x6785c2){return new BPromise(function(_0x50e7ec,_0x36e722){return client[_0x52fe('0x11')](_0x533965,_0x6785c2)[_0x52fe('0x12')](function(_0x1dd16d){logger['info'](_0x52fe('0x13'),_0x57db28,_0x52fe('0x14'));logger[_0x52fe('0x15')](_0x52fe('0x16'),_0x57db28,_0x52fe('0x14'),JSON['stringify'](_0x1dd16d));if(_0x1dd16d['error']){if(_0x1dd16d['error']['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x57db28,_0x1dd16d[_0x52fe('0x17')][_0x52fe('0x18')]);return _0x36e722(_0x1dd16d[_0x52fe('0x17')][_0x52fe('0x18')]);}logger[_0x52fe('0x17')](_0x52fe('0x13'),_0x57db28,_0x1dd16d['error'][_0x52fe('0x18')]);return _0x50e7ec(_0x1dd16d[_0x52fe('0x17')][_0x52fe('0x18')]);}else{logger[_0x52fe('0x19')]('ChatMessage,\x20%s,\x20%s',_0x57db28,_0x52fe('0x14'));_0x50e7ec(_0x1dd16d['result']['message']);}})['catch'](function(_0x4f451d){logger[_0x52fe('0x17')](_0x52fe('0x13'),_0x57db28,_0x4f451d);_0x36e722(_0x4f451d);});});}exports[_0x52fe('0x1a')]=function(_0x1ea552){var _0x5d2586=this;return new Promise(function(_0x50866b,_0xbaee0f){return db[_0x52fe('0x1b')][_0x52fe('0x1c')](_0x1ea552['body'],{'raw':_0x1ea552[_0x52fe('0x1d')]?_0x1ea552[_0x52fe('0x1d')][_0x52fe('0x1e')]===undefined?!![]:![]:!![]})[_0x52fe('0x12')](function(_0x4f4816){logger['info'](_0x52fe('0x1a'),_0x1ea552);logger[_0x52fe('0x15')]('CreateChatMessage',_0x1ea552,JSON[_0x52fe('0x1f')](_0x4f4816));_0x50866b(_0x4f4816);})[_0x52fe('0x20')](function(_0xc50460){logger[_0x52fe('0x17')]('CreateChatMessage',_0xc50460[_0x52fe('0x18')],_0x1ea552);_0xbaee0f(_0x5d2586[_0x52fe('0x17')](0x1f4,_0xc50460[_0x52fe('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 6f2d584..f3dce21 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 _0xf776=['length','./chatMessage.events','remove','update','emit','removeListener'];(function(_0x1a450a,_0x4dcb72){var _0x4f8ef4=function(_0x44c6ba){while(--_0x44c6ba){_0x1a450a['push'](_0x1a450a['shift']());}};_0x4f8ef4(++_0x4dcb72);}(_0xf776,0x169));var _0x6f77=function(_0x399af4,_0x23cc92){_0x399af4=_0x399af4-0x0;var _0x265849=_0xf776[_0x399af4];return _0x265849;};'use strict';var ChatMessageEvents=require(_0x6f77('0x0'));var events=['save',_0x6f77('0x1'),_0x6f77('0x2')];function createListener(_0x4e3b77,_0x43f2fd){return function(_0x2458e0){_0x43f2fd[_0x6f77('0x3')](_0x4e3b77,_0x2458e0);};}function removeListener(_0x16874b,_0x53ec9b){return function(){ChatMessageEvents[_0x6f77('0x4')](_0x16874b,_0x53ec9b);};}exports['register']=function(_0xf62e3e){for(var _0x21909a=0x0,_0x36ffd2=events[_0x6f77('0x5')];_0x21909a<_0x36ffd2;_0x21909a++){var _0x545ba9=events[_0x21909a];var _0x1dd52f=createListener('chatMessage:'+_0x545ba9,_0xf62e3e);ChatMessageEvents['on'](_0x545ba9,_0x1dd52f);}}; \ No newline at end of file +var _0x615a=['remove','emit','removeListener','length','chatMessage:','./chatMessage.events'];(function(_0x5cff66,_0xf7816a){var _0x3244c4=function(_0x4a4e77){while(--_0x4a4e77){_0x5cff66['push'](_0x5cff66['shift']());}};_0x3244c4(++_0xf7816a);}(_0x615a,0x119));var _0xa615=function(_0x46d613,_0xf6aa29){_0x46d613=_0x46d613-0x0;var _0x3494e1=_0x615a[_0x46d613];return _0x3494e1;};'use strict';var ChatMessageEvents=require(_0xa615('0x0'));var events=['save',_0xa615('0x1'),'update'];function createListener(_0x7e1c17,_0x33c100){return function(_0x30bb4f){_0x33c100[_0xa615('0x2')](_0x7e1c17,_0x30bb4f);};}function removeListener(_0x52ae35,_0x1d9a38){return function(){ChatMessageEvents[_0xa615('0x3')](_0x52ae35,_0x1d9a38);};}exports['register']=function(_0x320680){for(var _0x5d04bd=0x0,_0x44afda=events[_0xa615('0x4')];_0x5d04bd<_0x44afda;_0x5d04bd++){var _0x2db48d=events[_0x5d04bd];var _0x1e714d=createListener(_0xa615('0x5')+_0x2db48d,_0x320680);ChatMessageEvents['on'](_0x2db48d,_0x1e714d);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index ece76ff..5548298 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 _0x4680=['delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','chat','create','put','update','/:id/accept','accept','/:id/reject','reject'];(function(_0x162c52,_0x2d489b){var _0xcb6dda=function(_0x170496){while(--_0x170496){_0x162c52['push'](_0x162c52['shift']());}};_0xcb6dda(++_0x2d489b);}(_0x4680,0x1ce));var _0x0468=function(_0x2de62c,_0x2a32cd){_0x2de62c=_0x2de62c-0x0;var _0x1c024c=_0x4680[_0x2de62c];return _0x1c024c;};'use strict';var multer=require(_0x0468('0x0'));var util=require('util');var path=require(_0x0468('0x1'));var timeout=require(_0x0468('0x2'));var express=require(_0x0468('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0468('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0468('0x5'));var controller=require(_0x0468('0x6'));router[_0x0468('0x7')]('/',auth[_0x0468('0x8')](),controller[_0x0468('0x9')]);router[_0x0468('0x7')](_0x0468('0xa'),auth[_0x0468('0x8')](),controller[_0x0468('0xb')]);router[_0x0468('0x7')](_0x0468('0xc'),auth[_0x0468('0x8')](),controller[_0x0468('0xd')]);router[_0x0468('0xe')]('/',auth[_0x0468('0x8')](),interaction[_0x0468('0xf')](_0x0468('0x10'),'chatmessage:create'),controller[_0x0468('0x11')]);router[_0x0468('0x12')](_0x0468('0xc'),controller[_0x0468('0x13')]);router[_0x0468('0x12')](_0x0468('0x14'),auth[_0x0468('0x8')](),controller[_0x0468('0x15')]);router[_0x0468('0x12')](_0x0468('0x16'),auth[_0x0468('0x8')](),controller[_0x0468('0x17')]);router[_0x0468('0x18')](_0x0468('0xc'),auth[_0x0468('0x8')](),controller[_0x0468('0x19')]);module[_0x0468('0x1a')]=router; \ No newline at end of file +var _0xa733=['delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','/describe','show','isAuthenticated','tracked','chat','put','/:id','update','/:id/reject','reject'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa733,0x11a));var _0x3a73=function(_0x54ff2c,_0x203f4c){_0x54ff2c=_0x54ff2c-0x0;var _0xf3ed4e=_0xa733[_0x54ff2c];return _0xf3ed4e;};'use strict';var multer=require('multer');var util=require(_0x3a73('0x0'));var path=require(_0x3a73('0x1'));var timeout=require('connect-timeout');var express=require(_0x3a73('0x2'));var router=express[_0x3a73('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3a73('0x4'));var interaction=require(_0x3a73('0x5'));var config=require('../../config/environment');var controller=require(_0x3a73('0x6'));router[_0x3a73('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3a73('0x7')](_0x3a73('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x3a73('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x3a73('0x9')]);router['post']('/',auth[_0x3a73('0xa')](),interaction[_0x3a73('0xb')](_0x3a73('0xc'),'chatmessage:create'),controller['create']);router[_0x3a73('0xd')](_0x3a73('0xe'),controller[_0x3a73('0xf')]);router['put']('/:id/accept',auth[_0x3a73('0xa')](),controller['accept']);router['put'](_0x3a73('0x10'),auth[_0x3a73('0xa')](),controller[_0x3a73('0x11')]);router[_0x3a73('0x12')]('/:id',auth[_0x3a73('0xa')](),controller['destroy']);module[_0x3a73('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 553d46b..48171f3 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 _0xd38f=['exports','TEXT','medium','sequelize'];(function(_0x34f756,_0x1ea7ab){var _0x26e745=function(_0x165a65){while(--_0x165a65){_0x34f756['push'](_0x34f756['shift']());}};_0x26e745(++_0x1ea7ab);}(_0xd38f,0xbf));var _0xfd38=function(_0x406a87,_0x28891c){_0x406a87=_0x406a87-0x0;var _0x223876=_0xd38f[_0x406a87];return _0x223876;};'use strict';var Sequelize=require(_0xfd38('0x0'));module[_0xfd38('0x1')]={'body':{'type':Sequelize[_0xfd38('0x2')](_0xfd38('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x04c8=['TEXT','medium','sequelize','exports'];(function(_0x416e7a,_0x565426){var _0x3f624d=function(_0x5d4a0a){while(--_0x5d4a0a){_0x416e7a['push'](_0x416e7a['shift']());}};_0x3f624d(++_0x565426);}(_0x04c8,0x11e));var _0x804c=function(_0x2f785b,_0x2094c2){_0x2f785b=_0x2f785b-0x0;var _0x4c669a=_0x04c8[_0x2f785b];return _0x4c669a;};'use strict';var Sequelize=require(_0x804c('0x0'));module[_0x804c('0x1')]={'body':{'type':Sequelize[_0x804c('0x2')](_0x804c('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 150e32b..4fe72f1 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(_0x13ca2c,_0x132564){var _0x37e9ac=function(_0x1c1d0f){while(--_0x1c1d0f){_0x13ca2c['push'](_0x13ca2c['shift']());}};_0x37e9ac(++_0x132564);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x7a54,0x106));var _0x47a5=function(_0x28150a,_0x45f175){_0x28150a=_0x28150a-0x0;var _0x38986d=_0x7a54[_0x28150a];return _0x38986d;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 06e8c54..6af8ff7 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 _0x45c2=['exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatOfflineMessage.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x45c2,0x164));var _0x245c=function(_0x3360f3,_0x344f01){_0x3360f3=_0x3360f3-0x0;var _0x45e856=_0x45c2[_0x3360f3];return _0x45e856;};'use strict';var _=require('lodash');var util=require(_0x245c('0x0'));var logger=require(_0x245c('0x1'))(_0x245c('0x2'));var moment=require('moment');var BPromise=require(_0x245c('0x3'));var rp=require(_0x245c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x245c('0x5'));var config=require(_0x245c('0x6'));var attributes=require(_0x245c('0x7'));module[_0x245c('0x8')]=function(_0x18d18c,_0x53d6bb){return _0x18d18c[_0x245c('0x9')](_0x245c('0xa'),attributes,{'tableName':_0x245c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x245c('0xc'),'collate':_0x245c('0xd')});}; \ No newline at end of file +var _0x070f=['request-promise','path','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x070f,0x166));var _0xf070=function(_0x4836d5,_0x16bb76){_0x4836d5=_0x4836d5-0x0;var _0x480887=_0x070f[_0x4836d5];return _0x480887;};'use strict';var _=require(_0xf070('0x0'));var util=require(_0xf070('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf070('0x2'));var fs=require('fs');var path=require(_0xf070('0x3'));var rimraf=require('rimraf');var config=require(_0xf070('0x4'));var attributes=require(_0xf070('0x5'));module[_0xf070('0x6')]=function(_0x58e5ee,_0x45db56){return _0x58e5ee[_0xf070('0x7')](_0xf070('0x8'),attributes,{'tableName':_0xf070('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf070('0xa'),'collate':_0xf070('0xb')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 286ff86..94e384b 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 _0x4ccf=['ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug'];(function(_0x585cff,_0xedb8e0){var _0x1aaf4c=function(_0x2041aa){while(--_0x2041aa){_0x585cff['push'](_0x585cff['shift']());}};_0x1aaf4c(++_0xedb8e0);}(_0x4ccf,0x170));var _0xf4cc=function(_0x157492,_0x38af62){_0x157492=_0x157492-0x0;var _0x224180=_0x4ccf[_0x157492];return _0x224180;};'use strict';var _=require('lodash');var util=require(_0xf4cc('0x0'));var moment=require(_0xf4cc('0x1'));var BPromise=require(_0xf4cc('0x2'));var rs=require(_0xf4cc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4cc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4cc('0x5'))(_0xf4cc('0x6'));var config=require(_0xf4cc('0x7'));var jayson=require(_0xf4cc('0x8'));var client=jayson[_0xf4cc('0x9')][_0xf4cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x234ff6,_0x35625c,_0x4b0a29){return new BPromise(function(_0x392fda,_0x4092d1){return client[_0xf4cc('0xb')](_0x234ff6,_0x4b0a29)[_0xf4cc('0xc')](function(_0x561314){logger[_0xf4cc('0xd')](_0xf4cc('0xe'),_0x35625c,'request\x20sent');logger[_0xf4cc('0xf')](_0xf4cc('0x10'),_0x35625c,_0xf4cc('0x11'),JSON[_0xf4cc('0x12')](_0x561314));if(_0x561314['error']){if(_0x561314[_0xf4cc('0x13')][_0xf4cc('0x14')]===0x1f4){logger[_0xf4cc('0x13')](_0xf4cc('0xe'),_0x35625c,_0x561314['error'][_0xf4cc('0x15')]);return _0x4092d1(_0x561314[_0xf4cc('0x13')][_0xf4cc('0x15')]);}logger[_0xf4cc('0x13')](_0xf4cc('0xe'),_0x35625c,_0x561314['error']['message']);return _0x392fda(_0x561314['error'][_0xf4cc('0x15')]);}else{logger['info'](_0xf4cc('0xe'),_0x35625c,'request\x20sent');_0x392fda(_0x561314[_0xf4cc('0x16')]['message']);}})[_0xf4cc('0x17')](function(_0x119c5c){logger[_0xf4cc('0x13')](_0xf4cc('0xe'),_0x35625c,_0x119c5c);_0x4092d1(_0x119c5c);});});} \ No newline at end of file +var _0x1c9a=['code','ChatOfflineMessage,\x20%s,\x20%s','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error'];(function(_0x4ae767,_0x1e29cf){var _0x301df7=function(_0x2b5b60){while(--_0x2b5b60){_0x4ae767['push'](_0x4ae767['shift']());}};_0x301df7(++_0x1e29cf);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x2d49ee,_0x2b530a){_0x2d49ee=_0x2d49ee-0x0;var _0x4fe00f=_0x1c9a[_0x2d49ee];return _0x4fe00f;};'use strict';var _=require(_0xa1c9('0x0'));var util=require(_0xa1c9('0x1'));var moment=require('moment');var BPromise=require(_0xa1c9('0x2'));var rs=require(_0xa1c9('0x3'));var fs=require('fs');var Redis=require(_0xa1c9('0x4'));var db=require(_0xa1c9('0x5'))['db'];var utils=require(_0xa1c9('0x6'));var logger=require('../../config/logger')(_0xa1c9('0x7'));var config=require('../../config/environment');var jayson=require(_0xa1c9('0x8'));var client=jayson[_0xa1c9('0x9')][_0xa1c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b0c89,_0x1a0364,_0x46b19a){return new BPromise(function(_0x3b1a2c,_0xc8bc5a){return client[_0xa1c9('0xb')](_0x2b0c89,_0x46b19a)[_0xa1c9('0xc')](function(_0x2fcbcd){logger[_0xa1c9('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x1a0364,'request\x20sent');logger[_0xa1c9('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x1a0364,_0xa1c9('0xf'),JSON[_0xa1c9('0x10')](_0x2fcbcd));if(_0x2fcbcd[_0xa1c9('0x11')]){if(_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x12')]===0x1f4){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x1a0364,_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);return _0xc8bc5a(_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);}logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x1a0364,_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);return _0x3b1a2c(_0x2fcbcd[_0xa1c9('0x11')][_0xa1c9('0x14')]);}else{logger[_0xa1c9('0xd')](_0xa1c9('0x13'),_0x1a0364,_0xa1c9('0xf'));_0x3b1a2c(_0x2fcbcd['result'][_0xa1c9('0x14')]);}})['catch'](function(_0x12d989){logger[_0xa1c9('0x11')](_0xa1c9('0x13'),_0x1a0364,_0x12d989);_0xc8bc5a(_0x12d989);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 90ad2e9..af26d52 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 _0x466f=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id'];(function(_0x46c8aa,_0x215266){var _0x5231eb=function(_0x500733){while(--_0x500733){_0x46c8aa['push'](_0x46c8aa['shift']());}};_0x5231eb(++_0x215266);}(_0x466f,0x114));var _0xf466=function(_0x514e2d,_0x5d7e17){_0x514e2d=_0x514e2d-0x0;var _0x3659f9=_0x466f[_0x514e2d];return _0x3659f9;};'use strict';var multer=require(_0xf466('0x0'));var util=require('util');var path=require(_0xf466('0x1'));var timeout=require(_0xf466('0x2'));var express=require(_0xf466('0x3'));var router=express[_0xf466('0x4')]();var fs_extra=require(_0xf466('0x5'));var auth=require(_0xf466('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf466('0x7'));router['get']('/',auth[_0xf466('0x8')](),controller[_0xf466('0x9')]);router[_0xf466('0xa')](_0xf466('0xb'),auth[_0xf466('0x8')](),controller[_0xf466('0xc')]);router[_0xf466('0xa')]('/:id',auth[_0xf466('0x8')](),controller[_0xf466('0xd')]);router[_0xf466('0xe')]('/',auth[_0xf466('0x8')](),controller[_0xf466('0xf')]);router[_0xf466('0x10')](_0xf466('0x11'),auth['isAuthenticated'](),controller['update']);router[_0xf466('0x12')](_0xf466('0x11'),auth[_0xf466('0x8')](),controller[_0xf466('0x13')]);module[_0xf466('0x14')]=router; \ No newline at end of file +var _0x70fb=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x1384a9,_0x1fcfec){var _0x1b2fbf=function(_0x35eb62){while(--_0x35eb62){_0x1384a9['push'](_0x1384a9['shift']());}};_0x1b2fbf(++_0x1fcfec);}(_0x70fb,0x1a7));var _0xb70f=function(_0x54516e,_0x5df54c){_0x54516e=_0x54516e-0x0;var _0x4d1e6f=_0x70fb[_0x54516e];return _0x4d1e6f;};'use strict';var multer=require(_0xb70f('0x0'));var util=require(_0xb70f('0x1'));var path=require(_0xb70f('0x2'));var timeout=require(_0xb70f('0x3'));var express=require(_0xb70f('0x4'));var router=express[_0xb70f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb70f('0x6'));var controller=require(_0xb70f('0x7'));router[_0xb70f('0x8')]('/',auth[_0xb70f('0x9')](),controller[_0xb70f('0xa')]);router['get']('/describe',auth[_0xb70f('0x9')](),controller['describe']);router[_0xb70f('0x8')](_0xb70f('0xb'),auth[_0xb70f('0x9')](),controller[_0xb70f('0xc')]);router[_0xb70f('0xd')]('/',auth[_0xb70f('0x9')](),controller[_0xb70f('0xe')]);router[_0xb70f('0xf')]('/:id',auth[_0xb70f('0x9')](),controller[_0xb70f('0x10')]);router[_0xb70f('0x11')](_0xb70f('0xb'),auth[_0xb70f('0x9')](),controller[_0xb70f('0x12')]);module[_0xb70f('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 9127ded..09c50bf 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 _0xb02d=['STRING','ENUM','mouseOver','timeout','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb02d,0xc8));var _0xdb02=function(_0x1f4427,_0x2c5101){_0x1f4427=_0x1f4427-0x0;var _0x56953d=_0xb02d[_0x1f4427];return _0x56953d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdb02('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xdb02('0x1')](_0xdb02('0x2'),_0xdb02('0x3')),'defaultValue':_0xdb02('0x2')},'selector':{'type':Sequelize[_0xdb02('0x0')]},'timeout':{'type':Sequelize[_0xdb02('0x4')]}}; \ No newline at end of file +var _0x6de0=['mouseOver','timeout','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x44474f,_0x431580){var _0x427d97=function(_0x53f7d4){while(--_0x53f7d4){_0x44474f['push'](_0x44474f['shift']());}};_0x427d97(++_0x431580);}(_0x6de0,0x114));var _0x06de=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x6de0[_0x1203f];return _0x365f0a;};'use strict';var Sequelize=require(_0x06de('0x0'));module[_0x06de('0x1')]={'name':{'type':Sequelize[_0x06de('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x06de('0x3')](_0x06de('0x4'),_0x06de('0x5')),'defaultValue':_0x06de('0x4')},'selector':{'type':Sequelize[_0x06de('0x2')]},'timeout':{'type':Sequelize[_0x06de('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 5b37605..ddb132f 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 _0x7217=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','show','params','keys','ChatProactiveAction','query','intersection','model','fields','attributes','length','includeAll','merge','find','catch','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x50748b,_0x599d6d){var _0x5688d7=function(_0xfb5d55){while(--_0xfb5d55){_0x50748b['push'](_0x50748b['shift']());}};_0x5688d7(++_0x599d6d);}(_0x7217,0x19e));var _0x7721=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x7217[_0x2a6809];return _0x11c371;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={'raw':!![],'where':{'id':_0x158d98[_0x7721('0x2f')]['id']}},_0xd7d703={};_0xd7d703['model']=_[_0x7721('0x30')](db[_0x7721('0x31')]['rawAttributes']);_0xd7d703['query']=_[_0x7721('0x30')](_0x158d98[_0x7721('0x32')]);_0xd7d703['filters']=_[_0x7721('0x33')](_0xd7d703[_0x7721('0x34')],_0xd7d703[_0x7721('0x32')]);_0x37b9f0['attributes']=_[_0x7721('0x33')](_0xd7d703[_0x7721('0x34')],qs[_0x7721('0x35')](_0x158d98[_0x7721('0x32')][_0x7721('0x35')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x36')][_0x7721('0x37')]?_0x37b9f0[_0x7721('0x36')]:_0xd7d703['model'];if(_0x158d98[_0x7721('0x32')][_0x7721('0x38')]){_0x37b9f0['include']=[{'all':!![]}];}_0x37b9f0=_[_0x7721('0x39')]({},_0x37b9f0,_0x158d98['options']);return db[_0x7721('0x31')][_0x7721('0x3a')](_0x37b9f0)[_0x7721('0x29')](handleEntityNotFound(_0x1ea4d,null))[_0x7721('0x29')](respondWithResult(_0x1ea4d,null))[_0x7721('0x3b')](handleError(_0x1ea4d,null));};exports[_0x7721('0x3c')]=function(_0x2f1fe0,_0x15545a){return db[_0x7721('0x31')][_0x7721('0x3c')](_0x2f1fe0[_0x7721('0x3d')],{})['then'](respondWithResult(_0x15545a,0xc9))[_0x7721('0x3b')](handleError(_0x15545a,null));};exports['update']=function(_0x212384,_0x35614c){if(_0x212384[_0x7721('0x3d')]['id']){delete _0x212384[_0x7721('0x3d')]['id'];}return db[_0x7721('0x31')][_0x7721('0x3a')]({'where':{'id':_0x212384['params']['id']}})['then'](handleEntityNotFound(_0x35614c,null))['then'](saveUpdates(_0x212384['body'],null))[_0x7721('0x29')](respondWithResult(_0x35614c,null))[_0x7721('0x3b')](handleError(_0x35614c,null));};exports[_0x7721('0x2a')]=function(_0x22ef35,_0x4a90ce){return db[_0x7721('0x31')]['find']({'where':{'id':_0x22ef35[_0x7721('0x2f')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x4a90ce,null))['then'](removeEntity(_0x4a90ce,null))[_0x7721('0x3b')](handleError(_0x4a90ce,null));}; \ No newline at end of file +var _0x3148=['crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','show','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','options','ChatProactiveAction','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x1e45c8,_0x196f96){var _0x2014db=function(_0x5bf6dc){while(--_0x5bf6dc){_0x1e45c8['push'](_0x1e45c8['shift']());}};_0x2014db(++_0x196f96);}(_0x3148,0x1d3));var _0x8314=function(_0x20cf8a,_0x44cd6b){_0x20cf8a=_0x20cf8a-0x0;var _0x54e165=_0x3148[_0x20cf8a];return _0x54e165;};'use strict';var emlformat=require(_0x8314('0x0'));var rimraf=require(_0x8314('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8314('0x2'));var rp=require(_0x8314('0x3'));var moment=require(_0x8314('0x4'));var BPromise=require(_0x8314('0x5'));var Mustache=require('mustache');var util=require(_0x8314('0x6'));var path=require(_0x8314('0x7'));var sox=require(_0x8314('0x8'));var csv=require(_0x8314('0x9'));var ejs=require(_0x8314('0xa'));var fs=require('fs');var fs_extra=require(_0x8314('0xb'));var _=require(_0x8314('0xc'));var squel=require('squel');var crypto=require(_0x8314('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8314('0xe'));var toCsv=require(_0x8314('0x9'));var querystring=require(_0x8314('0xf'));var Papa=require(_0x8314('0x10'));var Redis=require(_0x8314('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8314('0x12'));var hardwareService=require(_0x8314('0x13'));var logger=require(_0x8314('0x14'))(_0x8314('0x15'));var utils=require('../../config/utils');var config=require(_0x8314('0x16'));var licenseUtil=require(_0x8314('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f8231,_0x55e770){_0x55e770=_0x55e770||0xcc;return function(_0x5f17d8){if(_0x5f17d8){return _0x2f8231[_0x8314('0x18')](_0x55e770);}return _0x2f8231[_0x8314('0x19')](_0x55e770)[_0x8314('0x1a')]();};}function respondWithResult(_0x24c55c,_0x49587c){_0x49587c=_0x49587c||0xc8;return function(_0x9e90a6){if(_0x9e90a6){return _0x24c55c[_0x8314('0x19')](_0x49587c)[_0x8314('0x1b')](_0x9e90a6);}};}function respondWithFilteredResult(_0x136e09,_0x2c459e){return function(_0x6a588a){if(_0x6a588a){var _0x579a15=typeof _0x2c459e['offset']===_0x8314('0x1c')&&typeof _0x2c459e[_0x8314('0x1d')]===_0x8314('0x1c');var _0x570db3=_0x6a588a[_0x8314('0x1e')];var _0x10e256=_0x579a15?0x0:_0x2c459e['offset'];var _0x1ade63=_0x579a15?_0x6a588a[_0x8314('0x1e')]:_0x2c459e['offset']+_0x2c459e[_0x8314('0x1d')];var _0x55053a;if(_0x1ade63>=_0x570db3){_0x1ade63=_0x570db3;_0x55053a=0xc8;}else{_0x55053a=0xce;}_0x136e09[_0x8314('0x19')](_0x55053a);return _0x136e09[_0x8314('0x1f')](_0x8314('0x20'),_0x10e256+'-'+_0x1ade63+'/'+_0x570db3)['json'](_0x6a588a);}return null;};}function patchUpdates(_0x4ead11){return function(_0x240f4b){try{jsonpatch[_0x8314('0x21')](_0x240f4b,_0x4ead11,!![]);}catch(_0xc37d84){return BPromise[_0x8314('0x22')](_0xc37d84);}return _0x240f4b[_0x8314('0x23')]();};}function saveUpdates(_0x1b1579,_0x2e9052){return function(_0x9e2c24){if(_0x9e2c24){return _0x9e2c24[_0x8314('0x24')](_0x1b1579)[_0x8314('0x25')](function(_0x5c6fd1){return _0x5c6fd1;});}return null;};}function removeEntity(_0xf72fc9,_0x29535a){return function(_0x2b6183){if(_0x2b6183){return _0x2b6183[_0x8314('0x26')]()[_0x8314('0x25')](function(){_0xf72fc9['status'](0xcc)[_0x8314('0x1a')]();});}};}function handleEntityNotFound(_0x2405af,_0x3f3736){return function(_0x4b37de){if(!_0x4b37de){_0x2405af[_0x8314('0x18')](0x194);}return _0x4b37de;};}function handleError(_0x56a047,_0x4c55b1){_0x4c55b1=_0x4c55b1||0x1f4;return function(_0x30d0b2){logger['error'](_0x30d0b2[_0x8314('0x27')]);if(_0x30d0b2['name']){delete _0x30d0b2[_0x8314('0x28')];}_0x56a047[_0x8314('0x19')](_0x4c55b1)[_0x8314('0x29')](_0x30d0b2);};}exports[_0x8314('0x2a')]=function(_0x40efa3,_0x7acf62){var _0x56f1c1={'raw':!![],'where':{'id':_0x40efa3[_0x8314('0x2b')]['id']}},_0x59fbfc={};_0x59fbfc[_0x8314('0x2c')]=_[_0x8314('0x2d')](db['ChatProactiveAction'][_0x8314('0x2e')]);_0x59fbfc[_0x8314('0x2f')]=_[_0x8314('0x2d')](_0x40efa3[_0x8314('0x2f')]);_0x59fbfc[_0x8314('0x30')]=_[_0x8314('0x31')](_0x59fbfc[_0x8314('0x2c')],_0x59fbfc[_0x8314('0x2f')]);_0x56f1c1[_0x8314('0x32')]=_[_0x8314('0x31')](_0x59fbfc[_0x8314('0x2c')],qs[_0x8314('0x33')](_0x40efa3[_0x8314('0x2f')][_0x8314('0x33')]));_0x56f1c1[_0x8314('0x32')]=_0x56f1c1[_0x8314('0x32')][_0x8314('0x34')]?_0x56f1c1['attributes']:_0x59fbfc['model'];if(_0x40efa3[_0x8314('0x2f')][_0x8314('0x35')]){_0x56f1c1['include']=[{'all':!![]}];}_0x56f1c1=_['merge']({},_0x56f1c1,_0x40efa3[_0x8314('0x36')]);return db[_0x8314('0x37')][_0x8314('0x38')](_0x56f1c1)[_0x8314('0x25')](handleEntityNotFound(_0x7acf62,null))['then'](respondWithResult(_0x7acf62,null))[_0x8314('0x39')](handleError(_0x7acf62,null));};exports[_0x8314('0x3a')]=function(_0x3be94c,_0x3637f5){return db['ChatProactiveAction'][_0x8314('0x3a')](_0x3be94c[_0x8314('0x3b')],{})[_0x8314('0x25')](respondWithResult(_0x3637f5,0xc9))['catch'](handleError(_0x3637f5,null));};exports[_0x8314('0x24')]=function(_0x480d81,_0x1194ff){if(_0x480d81[_0x8314('0x3b')]['id']){delete _0x480d81['body']['id'];}return db['ChatProactiveAction'][_0x8314('0x38')]({'where':{'id':_0x480d81['params']['id']}})[_0x8314('0x25')](handleEntityNotFound(_0x1194ff,null))['then'](saveUpdates(_0x480d81[_0x8314('0x3b')],null))[_0x8314('0x25')](respondWithResult(_0x1194ff,null))['catch'](handleError(_0x1194ff,null));};exports[_0x8314('0x26')]=function(_0x83e57a,_0x207afd){return db[_0x8314('0x37')][_0x8314('0x38')]({'where':{'id':_0x83e57a[_0x8314('0x2b')]['id']}})[_0x8314('0x25')](handleEntityNotFound(_0x207afd,null))[_0x8314('0x25')](removeEntity(_0x207afd,null))[_0x8314('0x39')](handleError(_0x207afd,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 2dfa5de..84e617d 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 _0xf5a8=['../../config/environment','exports','define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0xf5a8,0x71));var _0x8f5a=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0xf5a8[_0x4d7a61];return _0x186f73;};'use strict';var _=require('lodash');var util=require(_0x8f5a('0x0'));var logger=require(_0x8f5a('0x1'))(_0x8f5a('0x2'));var moment=require(_0x8f5a('0x3'));var BPromise=require(_0x8f5a('0x4'));var rp=require(_0x8f5a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f5a('0x6'));var config=require(_0x8f5a('0x7'));var attributes=require('./chatProactiveAction.attributes');module[_0x8f5a('0x8')]=function(_0x364e1c,_0x58db24){return _0x364e1c[_0x8f5a('0x9')](_0x8f5a('0xa'),attributes,{'tableName':_0x8f5a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa610=['rimraf','../../config/environment','ChatProactiveAction','lodash','../../config/logger','moment','request-promise'];(function(_0x24ce1b,_0x885966){var _0x106cd6=function(_0x5a295a){while(--_0x5a295a){_0x24ce1b['push'](_0x24ce1b['shift']());}};_0x106cd6(++_0x885966);}(_0xa610,0x96));var _0x0a61=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa610[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0a61('0x0'));var util=require('util');var logger=require(_0x0a61('0x1'))('api');var moment=require(_0x0a61('0x2'));var BPromise=require('bluebird');var rp=require(_0x0a61('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a61('0x4'));var config=require(_0x0a61('0x5'));var attributes=require('./chatProactiveAction.attributes');module['exports']=function(_0x2f2064,_0x267640){return _0x2f2064['define'](_0x0a61('0x6'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 9f0a916..178cd97 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 _0xc36b=['util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x1306e9,_0x4fd1ce){var _0x15eafb=function(_0x16ebed){while(--_0x16ebed){_0x1306e9['push'](_0x1306e9['shift']());}};_0x15eafb(++_0x4fd1ce);}(_0xc36b,0x190));var _0xbc36=function(_0xfebe8f,_0x54af65){_0xfebe8f=_0xfebe8f-0x0;var _0x4c33a5=_0xc36b[_0xfebe8f];return _0x4c33a5;};'use strict';var _=require('lodash');var util=require(_0xbc36('0x0'));var moment=require(_0xbc36('0x1'));var BPromise=require(_0xbc36('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc36('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbc36('0x4'));var logger=require('../../config/logger')(_0xbc36('0x5'));var config=require(_0xbc36('0x6'));var jayson=require(_0xbc36('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x227380,_0x4d3629,_0x3f5bd6){return new BPromise(function(_0xd35713,_0x34f560){return client['request'](_0x227380,_0x3f5bd6)[_0xbc36('0x8')](function(_0xada406){logger['info'](_0xbc36('0x9'),_0x4d3629,_0xbc36('0xa'));logger[_0xbc36('0xb')](_0xbc36('0xc'),_0x4d3629,_0xbc36('0xa'),JSON[_0xbc36('0xd')](_0xada406));if(_0xada406['error']){if(_0xada406[_0xbc36('0xe')][_0xbc36('0xf')]===0x1f4){logger[_0xbc36('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x4d3629,_0xada406['error']['message']);return _0x34f560(_0xada406[_0xbc36('0xe')]['message']);}logger[_0xbc36('0xe')](_0xbc36('0x9'),_0x4d3629,_0xada406[_0xbc36('0xe')][_0xbc36('0x10')]);return _0xd35713(_0xada406[_0xbc36('0xe')][_0xbc36('0x10')]);}else{logger[_0xbc36('0x11')](_0xbc36('0x9'),_0x4d3629,_0xbc36('0xa'));_0xd35713(_0xada406[_0xbc36('0x12')][_0xbc36('0x10')]);}})[_0xbc36('0x13')](function(_0x4f3dad){logger[_0xbc36('0xe')](_0xbc36('0x9'),_0x4d3629,_0x4f3dad);_0x34f560(_0x4f3dad);});});} \ No newline at end of file +var _0x3661=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x3600a9,_0x4a3cbb){var _0x4532fd=function(_0x1e66aa){while(--_0x1e66aa){_0x3600a9['push'](_0x3600a9['shift']());}};_0x4532fd(++_0x4a3cbb);}(_0x3661,0x138));var _0x1366=function(_0x358d7f,_0x1cfebb){_0x358d7f=_0x358d7f-0x0;var _0x552c95=_0x3661[_0x358d7f];return _0x552c95;};'use strict';var _=require(_0x1366('0x0'));var util=require(_0x1366('0x1'));var moment=require(_0x1366('0x2'));var BPromise=require(_0x1366('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1366('0x4'));var db=require(_0x1366('0x5'))['db'];var utils=require(_0x1366('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1366('0x7'));var jayson=require(_0x1366('0x8'));var client=jayson[_0x1366('0x9')][_0x1366('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x215f16,_0x12c4d7,_0x40f6d3){return new BPromise(function(_0x381742,_0x4f93f7){return client[_0x1366('0xb')](_0x215f16,_0x40f6d3)[_0x1366('0xc')](function(_0x353a04){logger['info'](_0x1366('0xd'),_0x12c4d7,'request\x20sent');logger[_0x1366('0xe')](_0x1366('0xf'),_0x12c4d7,_0x1366('0x10'),JSON[_0x1366('0x11')](_0x353a04));if(_0x353a04['error']){if(_0x353a04[_0x1366('0x12')][_0x1366('0x13')]===0x1f4){logger[_0x1366('0x12')](_0x1366('0xd'),_0x12c4d7,_0x353a04[_0x1366('0x12')][_0x1366('0x14')]);return _0x4f93f7(_0x353a04[_0x1366('0x12')][_0x1366('0x14')]);}logger[_0x1366('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x12c4d7,_0x353a04[_0x1366('0x12')][_0x1366('0x14')]);return _0x381742(_0x353a04[_0x1366('0x12')]['message']);}else{logger[_0x1366('0x15')](_0x1366('0xd'),_0x12c4d7,'request\x20sent');_0x381742(_0x353a04[_0x1366('0x16')][_0x1366('0x14')]);}})[_0x1366('0x17')](function(_0x7b4a06){logger['error'](_0x1366('0xd'),_0x12c4d7,_0x7b4a06);_0x4f93f7(_0x7b4a06);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index a8f121f..5e63afd 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 _0xdbf5=['post','put','update','delete','destroy','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x25044f,_0x28a04a){var _0xaace9c=function(_0x209204){while(--_0x209204){_0x25044f['push'](_0x25044f['shift']());}};_0xaace9c(++_0x28a04a);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x340982,_0xa465f6){_0x340982=_0x340982-0x0;var _0x289d44=_0xdbf5[_0x340982];return _0x289d44;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var fs_extra=require(_0x5dbf('0x3'));var auth=require(_0x5dbf('0x4'));var interaction=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var controller=require(_0x5dbf('0x7'));router[_0x5dbf('0x8')](_0x5dbf('0x9'),auth[_0x5dbf('0xa')](),controller[_0x5dbf('0xb')]);router[_0x5dbf('0xc')]('/',auth[_0x5dbf('0xa')](),controller['create']);router[_0x5dbf('0xd')]('/:id',auth[_0x5dbf('0xa')](),controller[_0x5dbf('0xe')]);router[_0x5dbf('0xf')](_0x5dbf('0x9'),auth['isAuthenticated'](),controller[_0x5dbf('0x10')]);module['exports']=router; \ No newline at end of file +var _0xd8fb=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller','get','isAuthenticated','post','create','put','update','delete','/:id','destroy','exports'];(function(_0x46b4d5,_0x4ac1e3){var _0x522d96=function(_0x4c2efc){while(--_0x4c2efc){_0x46b4d5['push'](_0x46b4d5['shift']());}};_0x522d96(++_0x4ac1e3);}(_0xd8fb,0x99));var _0xbd8f=function(_0x57b0fb,_0x56f17a){_0x57b0fb=_0x57b0fb-0x0;var _0x40c81a=_0xd8fb[_0x57b0fb];return _0x40c81a;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd8f('0x4'));var interaction=require(_0xbd8f('0x5'));var config=require('../../config/environment');var controller=require(_0xbd8f('0x6'));router[_0xbd8f('0x7')]('/:id',auth[_0xbd8f('0x8')](),controller['show']);router[_0xbd8f('0x9')]('/',auth['isAuthenticated'](),controller[_0xbd8f('0xa')]);router[_0xbd8f('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xbd8f('0xc')]);router[_0xbd8f('0xd')](_0xbd8f('0xe'),auth['isAuthenticated'](),controller[_0xbd8f('0xf')]);module[_0xbd8f('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 97db6b2..0cbd630 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 _0xde65=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING'];(function(_0x4fc5df,_0x3acaab){var _0x4a18f5=function(_0x241409){while(--_0x241409){_0x4fc5df['push'](_0x4fc5df['shift']());}};_0x4a18f5(++_0x3acaab);}(_0xde65,0x1b8));var _0x5de6=function(_0x2c9f4a,_0x4871e7){_0x2c9f4a=_0x2c9f4a-0x0;var _0xad8d0f=_0xde65[_0x2c9f4a];return _0xad8d0f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5de6('0x0')],'unique':_0x5de6('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5de6('0x0')]},'timeout':{'type':Sequelize[_0x5de6('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5de6('0x3')](_0x5de6('0x4'),_0x5de6('0x5'),_0x5de6('0x6'))}}; \ No newline at end of file +var _0x64c6=['name','STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x55d522,_0x58a4cd){var _0x5592a3=function(_0x9ff33f){while(--_0x9ff33f){_0x55d522['push'](_0x55d522['shift']());}};_0x5592a3(++_0x58a4cd);}(_0x64c6,0xae));var _0x664c=function(_0x33c603,_0x6d0ce4){_0x33c603=_0x33c603-0x0;var _0xae96f4=_0x64c6[_0x33c603];return _0xae96f4;};'use strict';var Sequelize=require(_0x664c('0x0'));module[_0x664c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x664c('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x664c('0x3')]},'timeout':{'type':Sequelize[_0x664c('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x664c('0x5'),_0x664c('0x6'),_0x664c('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index ab42629..ece4fe7 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 _0x7d10=['removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','clone','push','sequelize','toString','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','ids','omit','spread','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','client','request','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','destroy','get','UserProfileResource','end','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','ChatQueue','findAll','show','params','includeAll','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserChatQueue','findAndCountAll','agent','chatPause','updatedAt','rows','%s/%s','createdAt','getTeams','Team','addTeams','User','online','voicePause','interface','flatMap','Agents','transaction','each','findOrCreate','emit','userChatQueue:save'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0x7d10,0xb3));var _0x07d1=function(_0x5c110e,_0x1c0f53){_0x5c110e=_0x5c110e-0x0;var _0x31b810=_0x7d10[_0x5c110e];return _0x31b810;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x07d1('0x0'));var zipdir=require(_0x07d1('0x1'));var jsonpatch=require(_0x07d1('0x2'));var rp=require(_0x07d1('0x3'));var moment=require(_0x07d1('0x4'));var BPromise=require(_0x07d1('0x5'));var Mustache=require(_0x07d1('0x6'));var util=require(_0x07d1('0x7'));var path=require(_0x07d1('0x8'));var sox=require('sox');var csv=require(_0x07d1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x07d1('0xa'));var _=require(_0x07d1('0xb'));var squel=require(_0x07d1('0xc'));var crypto=require(_0x07d1('0xd'));var jsforce=require(_0x07d1('0xe'));var deskjs=require(_0x07d1('0xf'));var toCsv=require(_0x07d1('0x9'));var querystring=require(_0x07d1('0x10'));var Papa=require(_0x07d1('0x11'));var Redis=require('ioredis');var authService=require(_0x07d1('0x12'));var qs=require(_0x07d1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x07d1('0x14'))(_0x07d1('0x15'));var utils=require(_0x07d1('0x16'));var config=require(_0x07d1('0x17'));var licenseUtil=require(_0x07d1('0x18'));var db=require(_0x07d1('0x19'))['db'];config[_0x07d1('0x1a')]=_['defaults'](config[_0x07d1('0x1a')],{'host':_0x07d1('0x1b'),'port':0x18eb});var socket=require(_0x07d1('0x1c'))(new Redis(config['redis']));require('./chatQueue.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x07d1('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31f30b,_0x4f63da,_0x289d4b,_0x867c65){return new BPromise(function(_0x49b7b9,_0x5bf102){var _0x50a44b=_0x867c65||client;return _0x50a44b[_0x07d1('0x1e')](_0x31f30b,_0x289d4b)[_0x07d1('0x1f')](function(_0x3816fb){logger['info'](_0x07d1('0x20'),_0x4f63da,_0x07d1('0x21'));logger[_0x07d1('0x22')](_0x07d1('0x23'),_0x4f63da,'request\x20sent',JSON[_0x07d1('0x24')](_0x3816fb));if(_0x3816fb['error']){if(_0x3816fb[_0x07d1('0x25')][_0x07d1('0x26')]===0x1f4){logger[_0x07d1('0x25')](_0x07d1('0x20'),_0x4f63da,_0x3816fb[_0x07d1('0x25')][_0x07d1('0x27')]);return _0x5bf102(_0x3816fb['error'][_0x07d1('0x27')]);}logger[_0x07d1('0x25')]('ChatQueue,\x20%s,\x20%s',_0x4f63da,_0x3816fb[_0x07d1('0x25')][_0x07d1('0x27')]);return _0x49b7b9(_0x3816fb[_0x07d1('0x25')][_0x07d1('0x27')]);}else{logger[_0x07d1('0x28')]('ChatQueue,\x20%s,\x20%s',_0x4f63da,_0x07d1('0x21'));_0x49b7b9(_0x3816fb[_0x07d1('0x29')]['message']);}})[_0x07d1('0x2a')](function(_0x31559d){logger['error']('ChatQueue,\x20%s,\x20%s',_0x4f63da,_0x31559d);_0x5bf102(_0x31559d);});});}function respondWithStatusCode(_0x1bd403,_0x493923){_0x493923=_0x493923||0xcc;return function(_0x2b4911){if(_0x2b4911){return _0x1bd403[_0x07d1('0x2b')](_0x493923);}return _0x1bd403[_0x07d1('0x2c')](_0x493923)['end']();};}function respondWithResult(_0xc92a99,_0x4e3d6d){_0x4e3d6d=_0x4e3d6d||0xc8;return function(_0x39034e){if(_0x39034e){return _0xc92a99['status'](_0x4e3d6d)[_0x07d1('0x2d')](_0x39034e);}};}function respondWithFilteredResult(_0x58bdf4,_0x3f8de2){return function(_0x16a7b6){if(_0x16a7b6){var _0x4a585a=typeof _0x3f8de2[_0x07d1('0x2e')]===_0x07d1('0x2f')&&typeof _0x3f8de2[_0x07d1('0x30')]===_0x07d1('0x2f');var _0x150311=_0x16a7b6['count'];var _0xd6ee18=_0x4a585a?0x0:_0x3f8de2['offset'];var _0x24ef12=_0x4a585a?_0x16a7b6[_0x07d1('0x31')]:_0x3f8de2['offset']+_0x3f8de2[_0x07d1('0x30')];var _0x1316b3;if(_0x24ef12>=_0x150311){_0x24ef12=_0x150311;_0x1316b3=0xc8;}else{_0x1316b3=0xce;}_0x58bdf4[_0x07d1('0x2c')](_0x1316b3);return _0x58bdf4[_0x07d1('0x32')]('Content-Range',_0xd6ee18+'-'+_0x24ef12+'/'+_0x150311)[_0x07d1('0x2d')](_0x16a7b6);}return null;};}function patchUpdates(_0x2b3e4c){return function(_0x967432){try{jsonpatch[_0x07d1('0x33')](_0x967432,_0x2b3e4c,!![]);}catch(_0x128c2a){return BPromise['reject'](_0x128c2a);}return _0x967432['save']();};}function saveUpdates(_0x2491d7,_0x33aed9){return function(_0x3d7481){if(_0x3d7481){return _0x3d7481['update'](_0x2491d7)[_0x07d1('0x1f')](function(_0x1fbb6a){return _0x1fbb6a;});}return null;};}function removeEntity(_0x89e7ad,_0x30b1a5){return function(_0x2e65ce){if(_0x2e65ce){return _0x2e65ce[_0x07d1('0x34')]()['then'](function(){var _0x4a9a9e=_0x2e65ce[_0x07d1('0x35')]({'plain':!![]});var _0x2c28ea='ChatQueues';return db[_0x07d1('0x36')]['destroy']({'where':{'type':_0x2c28ea,'resourceId':_0x4a9a9e['id']}})[_0x07d1('0x1f')](function(){return _0x2e65ce;});})[_0x07d1('0x1f')](function(){_0x89e7ad[_0x07d1('0x2c')](0xcc)[_0x07d1('0x37')]();});}};}function handleEntityNotFound(_0x10924b,_0x538355){return function(_0x16713d){if(!_0x16713d){_0x10924b[_0x07d1('0x2b')](0x194);}return _0x16713d;};}function handleError(_0x4e85b0,_0x2a026a){_0x2a026a=_0x2a026a||0x1f4;return function(_0x2952fe){logger['error'](_0x2952fe[_0x07d1('0x38')]);if(_0x2952fe[_0x07d1('0x39')]){delete _0x2952fe[_0x07d1('0x39')];}_0x4e85b0[_0x07d1('0x2c')](_0x2a026a)[_0x07d1('0x3a')](_0x2952fe);};}exports[_0x07d1('0x3b')]=function(_0x2e047f,_0x5ebc14){var _0xa8e6fa={},_0x39daff={},_0x38f3ae={'count':0x0,'rows':[]};var _0x2d9dd0=_[_0x07d1('0x3c')](db['ChatQueue'][_0x07d1('0x3d')],function(_0x3fb423){return{'name':_0x3fb423['fieldName'],'type':_0x3fb423[_0x07d1('0x3e')][_0x07d1('0x3f')]};});_0x39daff[_0x07d1('0x40')]=_[_0x07d1('0x3c')](_0x2d9dd0,_0x07d1('0x39'));_0x39daff[_0x07d1('0x41')]=_[_0x07d1('0x42')](_0x2e047f[_0x07d1('0x41')]);_0x39daff[_0x07d1('0x43')]=_[_0x07d1('0x44')](_0x39daff[_0x07d1('0x40')],_0x39daff[_0x07d1('0x41')]);_0xa8e6fa[_0x07d1('0x45')]=_[_0x07d1('0x44')](_0x39daff[_0x07d1('0x40')],qs[_0x07d1('0x46')](_0x2e047f[_0x07d1('0x41')][_0x07d1('0x46')]));_0xa8e6fa[_0x07d1('0x45')]=_0xa8e6fa['attributes'][_0x07d1('0x47')]?_0xa8e6fa['attributes']:_0x39daff[_0x07d1('0x40')];if(!_0x2e047f['query'][_0x07d1('0x48')](_0x07d1('0x49'))){_0xa8e6fa[_0x07d1('0x30')]=qs['limit'](_0x2e047f[_0x07d1('0x41')][_0x07d1('0x30')]);_0xa8e6fa['offset']=qs[_0x07d1('0x2e')](_0x2e047f[_0x07d1('0x41')]['offset']);}_0xa8e6fa[_0x07d1('0x4a')]=qs[_0x07d1('0x4b')](_0x2e047f[_0x07d1('0x41')][_0x07d1('0x4b')]);_0xa8e6fa['where']=qs['filters'](_[_0x07d1('0x4c')](_0x2e047f[_0x07d1('0x41')],_0x39daff['filters']),_0x2d9dd0);if(_0x2e047f[_0x07d1('0x41')][_0x07d1('0x4d')]){_0xa8e6fa['where']=_['merge'](_0xa8e6fa[_0x07d1('0x4e')],{'$or':_['map'](_0x2d9dd0,function(_0x31e7cf){if(_0x31e7cf['type']!==_0x07d1('0x4f')){var _0x597034={};_0x597034[_0x31e7cf[_0x07d1('0x39')]]={'$like':'%'+_0x2e047f[_0x07d1('0x41')]['filter']+'%'};return _0x597034;}})});}_0xa8e6fa=_[_0x07d1('0x50')]({},_0xa8e6fa,_0x2e047f['options']);var _0x1513b3={'where':_0xa8e6fa[_0x07d1('0x4e')]};return db[_0x07d1('0x51')][_0x07d1('0x31')](_0x1513b3)[_0x07d1('0x1f')](function(_0xf49e4a){_0x38f3ae[_0x07d1('0x31')]=_0xf49e4a;if(_0x2e047f[_0x07d1('0x41')]['includeAll']){_0xa8e6fa['include']=[{'all':!![]}];}return db[_0x07d1('0x51')][_0x07d1('0x52')](_0xa8e6fa);})[_0x07d1('0x1f')](function(_0x50ac7f){_0x38f3ae['rows']=_0x50ac7f;return _0x38f3ae;})[_0x07d1('0x1f')](respondWithFilteredResult(_0x5ebc14,_0xa8e6fa))[_0x07d1('0x2a')](handleError(_0x5ebc14,null));};exports[_0x07d1('0x53')]=function(_0x2f30bf,_0x17c5f1){var _0x2c781b={'raw':!![],'where':{'id':_0x2f30bf[_0x07d1('0x54')]['id']}},_0x262c1d={};_0x262c1d[_0x07d1('0x40')]=_[_0x07d1('0x42')](db[_0x07d1('0x51')][_0x07d1('0x3d')]);_0x262c1d[_0x07d1('0x41')]=_['keys'](_0x2f30bf['query']);_0x262c1d['filters']=_[_0x07d1('0x44')](_0x262c1d[_0x07d1('0x40')],_0x262c1d[_0x07d1('0x41')]);_0x2c781b[_0x07d1('0x45')]=_[_0x07d1('0x44')](_0x262c1d[_0x07d1('0x40')],qs[_0x07d1('0x46')](_0x2f30bf[_0x07d1('0x41')]['fields']));_0x2c781b['attributes']=_0x2c781b[_0x07d1('0x45')][_0x07d1('0x47')]?_0x2c781b[_0x07d1('0x45')]:_0x262c1d[_0x07d1('0x40')];if(_0x2f30bf[_0x07d1('0x41')][_0x07d1('0x55')]){_0x2c781b['include']=[{'all':!![]}];}_0x2c781b=_[_0x07d1('0x50')]({},_0x2c781b,_0x2f30bf[_0x07d1('0x56')]);return db[_0x07d1('0x51')][_0x07d1('0x57')](_0x2c781b)[_0x07d1('0x1f')](handleEntityNotFound(_0x17c5f1,null))['then'](respondWithResult(_0x17c5f1,null))[_0x07d1('0x2a')](handleError(_0x17c5f1,null));};exports['create']=function(_0x203cce,_0x22399e){return db[_0x07d1('0x51')][_0x07d1('0x58')](_0x203cce['body'],{})['then'](function(_0x218ffa){var _0x2fa4d0=_0x203cce['user'][_0x07d1('0x35')]({'plain':!![]});if(!_0x2fa4d0)throw new Error(_0x07d1('0x59'));if(_0x2fa4d0[_0x07d1('0x5a')]===_0x07d1('0x5b')){var _0x3edf2a=_0x218ffa[_0x07d1('0x35')]({'plain':!![]});var _0x1ab738=_0x07d1('0x5c');return db[_0x07d1('0x5d')][_0x07d1('0x57')]({'where':{'name':_0x1ab738,'userProfileId':_0x2fa4d0[_0x07d1('0x5e')]},'raw':!![]})[_0x07d1('0x1f')](function(_0x4af579){if(_0x4af579&&_0x4af579[_0x07d1('0x5f')]===0x0){return db['UserProfileResource'][_0x07d1('0x58')]({'name':_0x3edf2a[_0x07d1('0x39')],'resourceId':_0x3edf2a['id'],'type':_0x4af579['name'],'sectionId':_0x4af579['id']},{})[_0x07d1('0x1f')](function(){return _0x218ffa;});}else{return _0x218ffa;}})['catch'](function(_0xff8087){logger[_0x07d1('0x25')](_0x07d1('0x60'),_0xff8087);throw _0xff8087;});}return _0x218ffa;})[_0x07d1('0x1f')](respondWithResult(_0x22399e,0xc9))['catch'](handleError(_0x22399e,null));};exports['update']=function(_0x5ac7f6,_0x1973b1){if(_0x5ac7f6[_0x07d1('0x61')]['id']){delete _0x5ac7f6[_0x07d1('0x61')]['id'];}return db[_0x07d1('0x51')][_0x07d1('0x57')]({'where':{'id':_0x5ac7f6[_0x07d1('0x54')]['id']}})[_0x07d1('0x1f')](handleEntityNotFound(_0x1973b1,null))['then'](saveUpdates(_0x5ac7f6[_0x07d1('0x61')],null))[_0x07d1('0x1f')](respondWithResult(_0x1973b1,null))[_0x07d1('0x2a')](handleError(_0x1973b1,null));};exports[_0x07d1('0x34')]=function(_0x6c7657,_0x2d4457){return db[_0x07d1('0x51')][_0x07d1('0x57')]({'where':{'id':_0x6c7657[_0x07d1('0x54')]['id']}})[_0x07d1('0x1f')](handleEntityNotFound(_0x2d4457,null))[_0x07d1('0x1f')](removeEntity(_0x2d4457,null))[_0x07d1('0x2a')](handleError(_0x2d4457,null));};exports[_0x07d1('0x62')]=function(_0xf8d927,_0x40e8e4){return db['ChatQueue'][_0x07d1('0x62')]()[_0x07d1('0x1f')](respondWithResult(_0x40e8e4,null))[_0x07d1('0x2a')](handleError(_0x40e8e4,null));};exports[_0x07d1('0x63')]=function(_0x5ceb1d,_0x7a06b7,_0x3d4009){var _0x5bdfa3={'raw':!![],'where':{}},_0x460854={},_0x53d5f9;return db[_0x07d1('0x51')][_0x07d1('0x64')]({'where':{'id':_0x5ceb1d[_0x07d1('0x54')]['id']}})[_0x07d1('0x1f')](handleEntityNotFound(_0x7a06b7,null))['then'](function(_0x4357ae){if(_0x4357ae){_0x53d5f9=_0x4357ae[_0x07d1('0x35')]({'plain':!![]});_0x460854[_0x07d1('0x40')]=_[_0x07d1('0x42')](db[_0x07d1('0x65')][_0x07d1('0x3d')]);_0x460854[_0x07d1('0x41')]=_[_0x07d1('0x42')](_0x5ceb1d['query']);_0x460854[_0x07d1('0x43')]=_[_0x07d1('0x44')](_0x460854[_0x07d1('0x40')],_0x460854[_0x07d1('0x41')]);_0x5bdfa3[_0x07d1('0x45')]=_['intersection'](_0x460854['model'],qs[_0x07d1('0x46')](_0x5ceb1d[_0x07d1('0x41')][_0x07d1('0x46')]));_0x5bdfa3[_0x07d1('0x45')]=_0x5bdfa3[_0x07d1('0x45')][_0x07d1('0x47')]?_0x5bdfa3[_0x07d1('0x45')]:_0x460854[_0x07d1('0x40')];if(!_0x5ceb1d[_0x07d1('0x41')][_0x07d1('0x48')](_0x07d1('0x49'))){_0x5bdfa3[_0x07d1('0x30')]=qs[_0x07d1('0x30')](_0x5ceb1d['query'][_0x07d1('0x30')]);_0x5bdfa3[_0x07d1('0x2e')]=qs[_0x07d1('0x2e')](_0x5ceb1d[_0x07d1('0x41')][_0x07d1('0x2e')]);}_0x5bdfa3[_0x07d1('0x4a')]=qs[_0x07d1('0x4b')](_0x5ceb1d[_0x07d1('0x41')][_0x07d1('0x4b')]);_0x5bdfa3[_0x07d1('0x4e')]=qs[_0x07d1('0x43')](_[_0x07d1('0x4c')](_0x5ceb1d[_0x07d1('0x41')],_0x460854[_0x07d1('0x43')]));_0x5bdfa3['where']['ChatQueueId']=_0x4357ae['id'];if(_0x5ceb1d[_0x07d1('0x41')][_0x07d1('0x4d')]){_0x5bdfa3[_0x07d1('0x4e')]=_[_0x07d1('0x50')](_0x5bdfa3[_0x07d1('0x4e')],{'$or':_[_0x07d1('0x3c')](_0x5bdfa3[_0x07d1('0x45')],function(_0x220e98){var _0x14bb26={};_0x14bb26[_0x220e98]={'$like':'%'+_0x5ceb1d[_0x07d1('0x41')][_0x07d1('0x4d')]+'%'};return _0x14bb26;})});}_0x5bdfa3=_[_0x07d1('0x50')]({},_0x5bdfa3,_0x5ceb1d[_0x07d1('0x56')]);return db[_0x07d1('0x65')][_0x07d1('0x52')](_0x5bdfa3);}})['then'](function(_0x2c7928){if(_0x2c7928){return db['User'][_0x07d1('0x66')]({'where':{'id':_[_0x07d1('0x3c')](_0x2c7928,'UserId'),'role':_0x07d1('0x67')},'attributes':['id',_0x07d1('0x39'),_0x07d1('0x68'),_0x07d1('0x69'),'createdAt']});}})[_0x07d1('0x1f')](function(_0x48404c){if(_0x48404c){return{'count':_0x48404c[_0x07d1('0x31')],'rows':_[_0x07d1('0x3c')](_0x48404c[_0x07d1('0x6a')],function(_0x19b4d8){return{'membername':_0x19b4d8[_0x07d1('0x39')],'UserId':_0x19b4d8['id'],'queue_name':_0x53d5f9[_0x07d1('0x39')],'ChatQueueId':_0x53d5f9['id'],'interface':util['format'](_0x07d1('0x6b'),'SIP',_0x19b4d8[_0x07d1('0x39')]),'penalty':0x0,'paused':_0x19b4d8[_0x07d1('0x68')],'createdAt':_0x19b4d8[_0x07d1('0x6c')],'updatedAt':_0x19b4d8[_0x07d1('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x07d1('0x1f')](respondWithFilteredResult(_0x7a06b7,_0x5bdfa3))[_0x07d1('0x2a')](handleError(_0x7a06b7,null));};exports[_0x07d1('0x6d')]=function(_0x415228,_0x387b5f,_0x47fc87){var _0x76f9a4={};var _0x2e3f7d={};var _0x2497d0;var _0x4c57b1;return db[_0x07d1('0x51')][_0x07d1('0x64')]({'where':{'id':_0x415228[_0x07d1('0x54')]['id']}})[_0x07d1('0x1f')](handleEntityNotFound(_0x387b5f,null))[_0x07d1('0x1f')](function(_0x48870b){if(_0x48870b){_0x2497d0=_0x48870b;_0x2e3f7d[_0x07d1('0x40')]=_['keys'](db[_0x07d1('0x6e')][_0x07d1('0x3d')]);_0x2e3f7d[_0x07d1('0x41')]=_[_0x07d1('0x42')](_0x415228[_0x07d1('0x41')]);_0x2e3f7d[_0x07d1('0x43')]=_['intersection'](_0x2e3f7d[_0x07d1('0x40')],_0x2e3f7d[_0x07d1('0x41')]);_0x76f9a4[_0x07d1('0x45')]=_[_0x07d1('0x44')](_0x2e3f7d[_0x07d1('0x40')],qs[_0x07d1('0x46')](_0x415228[_0x07d1('0x41')][_0x07d1('0x46')]));_0x76f9a4[_0x07d1('0x45')]=_0x76f9a4[_0x07d1('0x45')][_0x07d1('0x47')]?_0x76f9a4[_0x07d1('0x45')]:_0x2e3f7d['model'];_0x76f9a4['order']=qs[_0x07d1('0x4b')](_0x415228[_0x07d1('0x41')][_0x07d1('0x4b')]);_0x76f9a4[_0x07d1('0x4e')]=qs[_0x07d1('0x43')](_[_0x07d1('0x4c')](_0x415228['query'],_0x2e3f7d[_0x07d1('0x43')]));if(_0x415228[_0x07d1('0x41')][_0x07d1('0x4d')]){_0x76f9a4[_0x07d1('0x4e')]=_[_0x07d1('0x50')](_0x76f9a4[_0x07d1('0x4e')],{'$or':_[_0x07d1('0x3c')](_0x76f9a4[_0x07d1('0x45')],function(_0xefd951){var _0x307cc8={};_0x307cc8[_0xefd951]={'$like':'%'+_0x415228[_0x07d1('0x41')][_0x07d1('0x4d')]+'%'};return _0x307cc8;})});}_0x76f9a4=_['merge']({},_0x76f9a4,_0x415228[_0x07d1('0x56')]);return _0x2497d0[_0x07d1('0x6d')](_0x76f9a4);}})[_0x07d1('0x1f')](function(_0x2f3bd3){if(_0x2f3bd3){_0x4c57b1=_0x2f3bd3[_0x07d1('0x47')];if(!_0x415228['query'][_0x07d1('0x48')](_0x07d1('0x49'))){_0x76f9a4[_0x07d1('0x30')]=qs[_0x07d1('0x30')](_0x415228[_0x07d1('0x41')][_0x07d1('0x30')]);_0x76f9a4[_0x07d1('0x2e')]=qs['offset'](_0x415228[_0x07d1('0x41')]['offset']);}return _0x2497d0[_0x07d1('0x6d')](_0x76f9a4);}})[_0x07d1('0x1f')](function(_0x5d5285){if(_0x5d5285){return _0x5d5285?{'count':_0x4c57b1,'rows':_0x5d5285}:null;}})[_0x07d1('0x1f')](respondWithResult(_0x387b5f,null))[_0x07d1('0x2a')](handleError(_0x387b5f,null));};exports[_0x07d1('0x6f')]=function(_0x544e35,_0x277fab,_0xd1ead2){var _0x4be875=_0x544e35[_0x07d1('0x61')]['ids'];return db['Team'][_0x07d1('0x52')]({'where':{'id':_0x4be875},'attributes':['id'],'include':[{'model':db[_0x07d1('0x70')],'as':'Agents','attributes':['id',_0x07d1('0x39'),_0x07d1('0x71'),_0x07d1('0x72'),_0x07d1('0x73')],'raw':!![]}]})[_0x07d1('0x1f')](function(_0x2926e2){if(_0x2926e2){var _0x30cfb7=_[_0x07d1('0x74')](_0x2926e2,function(_0x5a60cb){var _0x21ca08=_0x5a60cb[_0x07d1('0x35')]({'plain':!![]});return _0x21ca08[_0x07d1('0x75')];});return db[_0x07d1('0x51')]['find']({'where':{'id':_0x544e35['params']['id']}})[_0x07d1('0x1f')](function(_0x4baf2d){return db['sequelize'][_0x07d1('0x76')](function(_0x3b0a8a){return _0x4baf2d['addTeams'](_0x4be875,{'transaction':_0x3b0a8a})[_0x07d1('0x1f')](function(){return BPromise[_0x07d1('0x77')](_0x30cfb7,function(_0x27a09f){return db['UserChatQueue'][_0x07d1('0x78')]({'where':{'UserId':_0x27a09f['id'],'ChatQueueId':_0x544e35['params']['id']},'transaction':_0x3b0a8a});});})[_0x07d1('0x1f')](function(){_0x30cfb7['forEach'](function(_0x1d2258){socket[_0x07d1('0x79')](_0x07d1('0x7a'),{'UserId':_0x1d2258['id'],'ChatQueueId':_0x4baf2d['id']});});});});});}})[_0x07d1('0x1f')](respondWithStatusCode(_0x277fab,null))[_0x07d1('0x2a')](handleError(_0x277fab,null));};exports[_0x07d1('0x7b')]=function(_0x2c6ecf,_0x27eeee,_0x145503){return db[_0x07d1('0x6e')][_0x07d1('0x52')]({'where':{'id':_0x2c6ecf[_0x07d1('0x41')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x07d1('0x1f')](handleEntityNotFound(_0x27eeee,null))['then'](function(_0xee4035){var _0x3e84d6=_['map'](_0xee4035,'id');var _0x4314e3=[];var _0x187c21=[];var _0x31c4f4=squel['select']();_0x31c4f4[_0x07d1('0x7c')](_0x07d1('0x7d'))[_0x07d1('0x7e')](_0x07d1('0x7f'),'tq')[_0x07d1('0x80')](_0x07d1('0x81'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where']('ChatQueueId\x20=\x20?',_0x2c6ecf[_0x07d1('0x54')]['id']);for(var _0x3e2b36=0x0;_0x3e2b36<_0xee4035['length'];_0x3e2b36+=0x1){let _0x5613ce=_0xee4035[_0x3e2b36];for(var _0x2f2957=0x0;_0x2f2957<_0x5613ce[_0x07d1('0x75')][_0x07d1('0x47')];_0x2f2957+=0x1){let _0x272955=_0x5613ce['Agents'][_0x2f2957];var _0x451786=_0x31c4f4[_0x07d1('0x82')]();_0x451786['where']('ut.UserId\x20=\x20?',_0x272955['id']);_0x187c21[_0x07d1('0x83')](db[_0x07d1('0x84')][_0x07d1('0x41')](_0x451786[_0x07d1('0x85')](),{'type':db[_0x07d1('0x84')]['QueryTypes'][_0x07d1('0x86')]})[_0x07d1('0x1f')](function(_0x3ca01e){if(_0x3ca01e[_0x07d1('0x47')]===0x1){return _0x272955['id'];}else{var _0x5a6be2=_[_0x07d1('0x87')](_['map'](_0x3ca01e,_0x07d1('0x88')),function(_0x134d7e){return _[_0x07d1('0x89')](_0x3e84d6,_0x134d7e);});if(_0x5a6be2){return _0x272955['id'];}}}));}}return BPromise[_0x07d1('0x8a')](_0x187c21)[_0x07d1('0x1f')](function(_0x188751){_0x4314e3=_(_0x4314e3)[_0x07d1('0x8b')](_0x188751)[_0x07d1('0x8c')]()[_0x07d1('0x8d')]();return db[_0x07d1('0x51')]['find']({'where':{'id':_0x2c6ecf[_0x07d1('0x54')]['id']}})[_0x07d1('0x1f')](function(_0x485557){return db[_0x07d1('0x84')][_0x07d1('0x76')](function(_0x565dde){return _0x485557[_0x07d1('0x7b')](_0x2c6ecf['query']['ids'],{'transaction':_0x565dde})[_0x07d1('0x1f')](function(){if(!_[_0x07d1('0x8e')](_0x4314e3)){return _0x485557[_0x07d1('0x8f')](_0x4314e3,{'transaction':_0x565dde});}})[_0x07d1('0x1f')](function(){_0x4314e3[_0x07d1('0x90')](function(_0x46c80f){socket[_0x07d1('0x79')](_0x07d1('0x91'),{'UserId':_0x46c80f,'ChatQueueId':_0x485557['id']});});});});});});})[_0x07d1('0x1f')](respondWithStatusCode(_0x27eeee,null))[_0x07d1('0x2a')](handleError(_0x27eeee,null));};exports[_0x07d1('0x92')]=function(_0x161432,_0x3cfc2b,_0xcd863e){return db[_0x07d1('0x51')][_0x07d1('0x57')]({'where':{'id':_0x161432['params']['id']}})[_0x07d1('0x1f')](handleEntityNotFound(_0x3cfc2b,null))[_0x07d1('0x1f')](function(_0x5ddbf9){if(_0x5ddbf9){return _0x5ddbf9[_0x07d1('0x92')](_0x161432[_0x07d1('0x61')][_0x07d1('0x93')],_[_0x07d1('0x94')](_0x161432[_0x07d1('0x61')],[_0x07d1('0x93'),'id'])||{})[_0x07d1('0x95')](function(_0x3bea6b){for(var _0x41156b=0x0;_0x41156b<_0x161432[_0x07d1('0x61')]['ids']['length'];_0x41156b+=0x1){socket[_0x07d1('0x79')](_0x07d1('0x7a'),{'UserId':Number(_0x161432['body'][_0x07d1('0x93')][_0x41156b]),'ChatQueueId':Number(_0x161432['params']['id'])});}return _0x3bea6b;});}})['then'](respondWithResult(_0x3cfc2b,null))['catch'](handleError(_0x3cfc2b,null));};exports[_0x07d1('0x8f')]=function(_0x19a180,_0x11b774,_0x3ec169){return db[_0x07d1('0x51')]['find']({'where':{'id':_0x19a180[_0x07d1('0x54')]['id']}})[_0x07d1('0x1f')](handleEntityNotFound(_0x11b774,null))[_0x07d1('0x1f')](function(_0x121e11){if(_0x121e11){return _0x121e11[_0x07d1('0x8f')](_0x19a180[_0x07d1('0x41')][_0x07d1('0x93')])[_0x07d1('0x1f')](function(){if(_['isArray'](_0x19a180[_0x07d1('0x41')][_0x07d1('0x93')])){for(var _0x5e82aa=0x0;_0x5e82aa<_0x19a180[_0x07d1('0x41')]['ids']['length'];_0x5e82aa+=0x1){socket[_0x07d1('0x79')]('userChatQueue:remove',{'UserId':Number(_0x19a180['query'][_0x07d1('0x93')][_0x5e82aa]),'ChatQueueId':Number(_0x19a180[_0x07d1('0x54')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x19a180[_0x07d1('0x41')][_0x07d1('0x93')]),'ChatQueueId':Number(_0x19a180[_0x07d1('0x54')]['id'])});}});}})[_0x07d1('0x1f')](respondWithStatusCode(_0x11b774,null))[_0x07d1('0x2a')](handleError(_0x11b774,null));};exports[_0x07d1('0x96')]=function(_0x2f58ba,_0x495f4c,_0x33134b){var _0xa9d707={};var _0x58bff5={};var _0x2489fc;var _0x239e9b;return db[_0x07d1('0x51')]['findOne']({'where':{'id':_0x2f58ba[_0x07d1('0x54')]['id']}})[_0x07d1('0x1f')](handleEntityNotFound(_0x495f4c,null))[_0x07d1('0x1f')](function(_0x115a33){if(_0x115a33){_0x2489fc=_0x115a33;_0x58bff5['model']=_[_0x07d1('0x42')](db[_0x07d1('0x70')][_0x07d1('0x3d')]);_0x58bff5[_0x07d1('0x41')]=_[_0x07d1('0x42')](_0x2f58ba[_0x07d1('0x41')]);_0x58bff5['filters']=_[_0x07d1('0x44')](_0x58bff5[_0x07d1('0x40')],_0x58bff5[_0x07d1('0x41')]);_0xa9d707[_0x07d1('0x45')]=_[_0x07d1('0x44')](_0x58bff5[_0x07d1('0x40')],qs[_0x07d1('0x46')](_0x2f58ba['query']['fields']));_0xa9d707['attributes']=_0xa9d707['attributes']['length']?_0xa9d707[_0x07d1('0x45')]:_0x58bff5[_0x07d1('0x40')];_0xa9d707[_0x07d1('0x4a')]=qs['sort'](_0x2f58ba[_0x07d1('0x41')]['sort']);_0xa9d707[_0x07d1('0x4e')]=qs[_0x07d1('0x43')](_[_0x07d1('0x4c')](_0x2f58ba[_0x07d1('0x41')],_0x58bff5[_0x07d1('0x43')]));if(_0x2f58ba[_0x07d1('0x41')]['filter']){_0xa9d707[_0x07d1('0x4e')]=_[_0x07d1('0x50')](_0xa9d707[_0x07d1('0x4e')],{'$or':_[_0x07d1('0x3c')](_0xa9d707[_0x07d1('0x45')],function(_0x41e5e6){var _0x3743df={};_0x3743df[_0x41e5e6]={'$like':'%'+_0x2f58ba['query'][_0x07d1('0x4d')]+'%'};return _0x3743df;})});}_0xa9d707=_[_0x07d1('0x50')]({},_0xa9d707,_0x2f58ba[_0x07d1('0x56')]);return _0x2489fc[_0x07d1('0x96')](_0xa9d707);}})['then'](function(_0x2bfec0){if(_0x2bfec0){_0x239e9b=_0x2bfec0['length'];if(!_0x2f58ba[_0x07d1('0x41')][_0x07d1('0x48')](_0x07d1('0x49'))){_0xa9d707[_0x07d1('0x30')]=qs[_0x07d1('0x30')](_0x2f58ba[_0x07d1('0x41')][_0x07d1('0x30')]);_0xa9d707[_0x07d1('0x2e')]=qs[_0x07d1('0x2e')](_0x2f58ba[_0x07d1('0x41')][_0x07d1('0x2e')]);}return _0x2489fc[_0x07d1('0x96')](_0xa9d707);}})[_0x07d1('0x1f')](function(_0x2bebf1){if(_0x2bebf1){return _0x2bebf1?{'count':_0x239e9b,'rows':_0x2bebf1}:null;}})[_0x07d1('0x1f')](respondWithResult(_0x495f4c,null))[_0x07d1('0x2a')](handleError(_0x495f4c,null));}; \ No newline at end of file +var _0x915d=['../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','request','then','info','request\x20sent','debug','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','sendStatus','end','status','json','offset','undefined','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','name','send','index','map','ChatQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserChatQueue','ChatQueueId','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','count','format','%s/%s','SIP','Team','getTeams','nolimit','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','includes','union','value','isEmpty','removeAgents','userChatQueue:remove','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x915d,0x83));var _0xd915=function(_0x45c84b,_0x4d3e9a){_0x45c84b=_0x45c84b-0x0;var _0x5cd3e1=_0x915d[_0x45c84b];return _0x5cd3e1;};'use strict';var emlformat=require(_0xd915('0x0'));var rimraf=require(_0xd915('0x1'));var zipdir=require(_0xd915('0x2'));var jsonpatch=require(_0xd915('0x3'));var rp=require('request-promise');var moment=require(_0xd915('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd915('0x5'));var util=require(_0xd915('0x6'));var path=require('path');var sox=require(_0xd915('0x7'));var csv=require(_0xd915('0x8'));var ejs=require(_0xd915('0x9'));var fs=require('fs');var fs_extra=require(_0xd915('0xa'));var _=require(_0xd915('0xb'));var squel=require(_0xd915('0xc'));var crypto=require('crypto');var jsforce=require(_0xd915('0xd'));var deskjs=require(_0xd915('0xe'));var toCsv=require(_0xd915('0x8'));var querystring=require(_0xd915('0xf'));var Papa=require('papaparse');var Redis=require(_0xd915('0x10'));var authService=require(_0xd915('0x11'));var qs=require(_0xd915('0x12'));var as=require(_0xd915('0x13'));var hardwareService=require(_0xd915('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd915('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd915('0x16'))['db'];config[_0xd915('0x17')]=_[_0xd915('0x18')](config[_0xd915('0x17')],{'host':_0xd915('0x19'),'port':0x18eb});var socket=require(_0xd915('0x1a'))(new Redis(config[_0xd915('0x17')]));require('./chatQueue.socket')[_0xd915('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xd915('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x549537,_0xec6d17,_0xf4f37c,_0x442714){return new BPromise(function(_0xc76c85,_0x3e0048){var _0xce5aee=_0x442714||client;return _0xce5aee[_0xd915('0x1d')](_0x549537,_0xf4f37c)[_0xd915('0x1e')](function(_0x284b13){logger[_0xd915('0x1f')]('ChatQueue,\x20%s,\x20%s',_0xec6d17,_0xd915('0x20'));logger[_0xd915('0x21')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0xec6d17,_0xd915('0x20'),JSON[_0xd915('0x22')](_0x284b13));if(_0x284b13[_0xd915('0x23')]){if(_0x284b13[_0xd915('0x23')][_0xd915('0x24')]===0x1f4){logger[_0xd915('0x23')](_0xd915('0x25'),_0xec6d17,_0x284b13[_0xd915('0x23')][_0xd915('0x26')]);return _0x3e0048(_0x284b13[_0xd915('0x23')][_0xd915('0x26')]);}logger['error'](_0xd915('0x25'),_0xec6d17,_0x284b13[_0xd915('0x23')][_0xd915('0x26')]);return _0xc76c85(_0x284b13[_0xd915('0x23')]['message']);}else{logger['info'](_0xd915('0x25'),_0xec6d17,_0xd915('0x20'));_0xc76c85(_0x284b13[_0xd915('0x27')][_0xd915('0x26')]);}})['catch'](function(_0x2e9f18){logger[_0xd915('0x23')](_0xd915('0x25'),_0xec6d17,_0x2e9f18);_0x3e0048(_0x2e9f18);});});}function respondWithStatusCode(_0x4a4f72,_0x19969f){_0x19969f=_0x19969f||0xcc;return function(_0x158bef){if(_0x158bef){return _0x4a4f72[_0xd915('0x28')](_0x19969f);}return _0x4a4f72['status'](_0x19969f)[_0xd915('0x29')]();};}function respondWithResult(_0x3f6ddf,_0x443dae){_0x443dae=_0x443dae||0xc8;return function(_0x3db6af){if(_0x3db6af){return _0x3f6ddf[_0xd915('0x2a')](_0x443dae)[_0xd915('0x2b')](_0x3db6af);}};}function respondWithFilteredResult(_0x1e8d42,_0x36b88c){return function(_0x2383a7){if(_0x2383a7){var _0x1d3070=typeof _0x36b88c[_0xd915('0x2c')]===_0xd915('0x2d')&&typeof _0x36b88c['limit']===_0xd915('0x2d');var _0x41d52f=_0x2383a7['count'];var _0x549d4c=_0x1d3070?0x0:_0x36b88c['offset'];var _0x1bef48=_0x1d3070?_0x2383a7['count']:_0x36b88c[_0xd915('0x2c')]+_0x36b88c['limit'];var _0x36930c;if(_0x1bef48>=_0x41d52f){_0x1bef48=_0x41d52f;_0x36930c=0xc8;}else{_0x36930c=0xce;}_0x1e8d42[_0xd915('0x2a')](_0x36930c);return _0x1e8d42['set'](_0xd915('0x2e'),_0x549d4c+'-'+_0x1bef48+'/'+_0x41d52f)[_0xd915('0x2b')](_0x2383a7);}return null;};}function patchUpdates(_0x4edb1d){return function(_0x3bc1b9){try{jsonpatch[_0xd915('0x2f')](_0x3bc1b9,_0x4edb1d,!![]);}catch(_0xd58e3e){return BPromise[_0xd915('0x30')](_0xd58e3e);}return _0x3bc1b9[_0xd915('0x31')]();};}function saveUpdates(_0x2bc5ea,_0x1aa36a){return function(_0x2220e3){if(_0x2220e3){return _0x2220e3[_0xd915('0x32')](_0x2bc5ea)[_0xd915('0x1e')](function(_0x2088e8){return _0x2088e8;});}return null;};}function removeEntity(_0x25122b,_0x25a7a2){return function(_0x1ae6a0){if(_0x1ae6a0){return _0x1ae6a0[_0xd915('0x33')]()['then'](function(){var _0x33924b=_0x1ae6a0[_0xd915('0x34')]({'plain':!![]});var _0x5015c8='ChatQueues';return db[_0xd915('0x35')][_0xd915('0x33')]({'where':{'type':_0x5015c8,'resourceId':_0x33924b['id']}})[_0xd915('0x1e')](function(){return _0x1ae6a0;});})[_0xd915('0x1e')](function(){_0x25122b[_0xd915('0x2a')](0xcc)[_0xd915('0x29')]();});}};}function handleEntityNotFound(_0x2ff8ad,_0x556c16){return function(_0x52f37f){if(!_0x52f37f){_0x2ff8ad[_0xd915('0x28')](0x194);}return _0x52f37f;};}function handleError(_0x26d6fc,_0x262af5){_0x262af5=_0x262af5||0x1f4;return function(_0x3e9b94){logger[_0xd915('0x23')](_0x3e9b94['stack']);if(_0x3e9b94[_0xd915('0x36')]){delete _0x3e9b94[_0xd915('0x36')];}_0x26d6fc['status'](_0x262af5)[_0xd915('0x37')](_0x3e9b94);};}exports[_0xd915('0x38')]=function(_0x479158,_0xd106c4){var _0x2b2f6f={},_0x16c154={},_0x447add={'count':0x0,'rows':[]};var _0xf8b32e=_[_0xd915('0x39')](db[_0xd915('0x3a')][_0xd915('0x3b')],function(_0x9ea996){return{'name':_0x9ea996[_0xd915('0x3c')],'type':_0x9ea996['type'][_0xd915('0x3d')]};});_0x16c154[_0xd915('0x3e')]=_['map'](_0xf8b32e,'name');_0x16c154[_0xd915('0x3f')]=_[_0xd915('0x40')](_0x479158[_0xd915('0x3f')]);_0x16c154[_0xd915('0x41')]=_[_0xd915('0x42')](_0x16c154[_0xd915('0x3e')],_0x16c154[_0xd915('0x3f')]);_0x2b2f6f[_0xd915('0x43')]=_[_0xd915('0x42')](_0x16c154[_0xd915('0x3e')],qs['fields'](_0x479158[_0xd915('0x3f')][_0xd915('0x44')]));_0x2b2f6f[_0xd915('0x43')]=_0x2b2f6f[_0xd915('0x43')][_0xd915('0x45')]?_0x2b2f6f[_0xd915('0x43')]:_0x16c154[_0xd915('0x3e')];if(!_0x479158[_0xd915('0x3f')][_0xd915('0x46')]('nolimit')){_0x2b2f6f[_0xd915('0x47')]=qs[_0xd915('0x47')](_0x479158['query'][_0xd915('0x47')]);_0x2b2f6f['offset']=qs[_0xd915('0x2c')](_0x479158[_0xd915('0x3f')][_0xd915('0x2c')]);}_0x2b2f6f[_0xd915('0x48')]=qs[_0xd915('0x49')](_0x479158[_0xd915('0x3f')][_0xd915('0x49')]);_0x2b2f6f['where']=qs['filters'](_[_0xd915('0x4a')](_0x479158[_0xd915('0x3f')],_0x16c154['filters']),_0xf8b32e);if(_0x479158[_0xd915('0x3f')][_0xd915('0x4b')]){_0x2b2f6f[_0xd915('0x4c')]=_[_0xd915('0x4d')](_0x2b2f6f[_0xd915('0x4c')],{'$or':_['map'](_0xf8b32e,function(_0x505d39){if(_0x505d39[_0xd915('0x4e')]!=='VIRTUAL'){var _0x46e1c2={};_0x46e1c2[_0x505d39[_0xd915('0x36')]]={'$like':'%'+_0x479158[_0xd915('0x3f')][_0xd915('0x4b')]+'%'};return _0x46e1c2;}})});}_0x2b2f6f=_[_0xd915('0x4d')]({},_0x2b2f6f,_0x479158[_0xd915('0x4f')]);var _0x59a494={'where':_0x2b2f6f[_0xd915('0x4c')]};return db[_0xd915('0x3a')]['count'](_0x59a494)['then'](function(_0xc61c20){_0x447add['count']=_0xc61c20;if(_0x479158['query'][_0xd915('0x50')]){_0x2b2f6f[_0xd915('0x51')]=[{'all':!![]}];}return db[_0xd915('0x3a')][_0xd915('0x52')](_0x2b2f6f);})['then'](function(_0x40868a){_0x447add[_0xd915('0x53')]=_0x40868a;return _0x447add;})[_0xd915('0x1e')](respondWithFilteredResult(_0xd106c4,_0x2b2f6f))[_0xd915('0x54')](handleError(_0xd106c4,null));};exports[_0xd915('0x55')]=function(_0x1e2f58,_0x23f675){var _0x362889={'raw':!![],'where':{'id':_0x1e2f58[_0xd915('0x56')]['id']}},_0x1a9355={};_0x1a9355[_0xd915('0x3e')]=_[_0xd915('0x40')](db['ChatQueue'][_0xd915('0x3b')]);_0x1a9355['query']=_[_0xd915('0x40')](_0x1e2f58[_0xd915('0x3f')]);_0x1a9355[_0xd915('0x41')]=_[_0xd915('0x42')](_0x1a9355['model'],_0x1a9355[_0xd915('0x3f')]);_0x362889['attributes']=_['intersection'](_0x1a9355[_0xd915('0x3e')],qs['fields'](_0x1e2f58[_0xd915('0x3f')][_0xd915('0x44')]));_0x362889['attributes']=_0x362889[_0xd915('0x43')]['length']?_0x362889[_0xd915('0x43')]:_0x1a9355[_0xd915('0x3e')];if(_0x1e2f58[_0xd915('0x3f')][_0xd915('0x50')]){_0x362889[_0xd915('0x51')]=[{'all':!![]}];}_0x362889=_[_0xd915('0x4d')]({},_0x362889,_0x1e2f58[_0xd915('0x4f')]);return db[_0xd915('0x3a')][_0xd915('0x57')](_0x362889)['then'](handleEntityNotFound(_0x23f675,null))[_0xd915('0x1e')](respondWithResult(_0x23f675,null))[_0xd915('0x54')](handleError(_0x23f675,null));};exports[_0xd915('0x58')]=function(_0x3435c0,_0x33ebb6){return db[_0xd915('0x3a')][_0xd915('0x58')](_0x3435c0['body'],{})[_0xd915('0x1e')](function(_0x241b37){var _0x200826=_0x3435c0[_0xd915('0x59')]['get']({'plain':!![]});if(!_0x200826)throw new Error(_0xd915('0x5a'));if(_0x200826[_0xd915('0x5b')]===_0xd915('0x59')){var _0x50e305=_0x241b37[_0xd915('0x34')]({'plain':!![]});var _0x5a61ef=_0xd915('0x5c');return db['UserProfileSection']['find']({'where':{'name':_0x5a61ef,'userProfileId':_0x200826[_0xd915('0x5d')]},'raw':!![]})[_0xd915('0x1e')](function(_0x6b6bfb){if(_0x6b6bfb&&_0x6b6bfb[_0xd915('0x5e')]===0x0){return db[_0xd915('0x35')][_0xd915('0x58')]({'name':_0x50e305['name'],'resourceId':_0x50e305['id'],'type':_0x6b6bfb[_0xd915('0x36')],'sectionId':_0x6b6bfb['id']},{})[_0xd915('0x1e')](function(){return _0x241b37;});}else{return _0x241b37;}})['catch'](function(_0x4c8c9a){logger[_0xd915('0x23')](_0xd915('0x5f'),_0x4c8c9a);throw _0x4c8c9a;});}return _0x241b37;})[_0xd915('0x1e')](respondWithResult(_0x33ebb6,0xc9))[_0xd915('0x54')](handleError(_0x33ebb6,null));};exports[_0xd915('0x32')]=function(_0x5aa697,_0x111329){if(_0x5aa697[_0xd915('0x60')]['id']){delete _0x5aa697[_0xd915('0x60')]['id'];}return db[_0xd915('0x3a')][_0xd915('0x57')]({'where':{'id':_0x5aa697['params']['id']}})[_0xd915('0x1e')](handleEntityNotFound(_0x111329,null))[_0xd915('0x1e')](saveUpdates(_0x5aa697['body'],null))[_0xd915('0x1e')](respondWithResult(_0x111329,null))[_0xd915('0x54')](handleError(_0x111329,null));};exports[_0xd915('0x33')]=function(_0x2ba29f,_0x2655eb){return db[_0xd915('0x3a')][_0xd915('0x57')]({'where':{'id':_0x2ba29f[_0xd915('0x56')]['id']}})['then'](handleEntityNotFound(_0x2655eb,null))[_0xd915('0x1e')](removeEntity(_0x2655eb,null))['catch'](handleError(_0x2655eb,null));};exports['describe']=function(_0x4cdb2e,_0x11e588){return db[_0xd915('0x3a')][_0xd915('0x61')]()[_0xd915('0x1e')](respondWithResult(_0x11e588,null))['catch'](handleError(_0x11e588,null));};exports['getMembers']=function(_0x5e5675,_0x4c5d6d,_0x354ba5){var _0x3b27d2={'raw':!![],'where':{}},_0x8caf6={},_0x4cdd04;return db[_0xd915('0x3a')][_0xd915('0x62')]({'where':{'id':_0x5e5675['params']['id']}})[_0xd915('0x1e')](handleEntityNotFound(_0x4c5d6d,null))[_0xd915('0x1e')](function(_0x2d821f){if(_0x2d821f){_0x4cdd04=_0x2d821f[_0xd915('0x34')]({'plain':!![]});_0x8caf6[_0xd915('0x3e')]=_[_0xd915('0x40')](db[_0xd915('0x63')][_0xd915('0x3b')]);_0x8caf6[_0xd915('0x3f')]=_[_0xd915('0x40')](_0x5e5675['query']);_0x8caf6[_0xd915('0x41')]=_[_0xd915('0x42')](_0x8caf6['model'],_0x8caf6['query']);_0x3b27d2['attributes']=_['intersection'](_0x8caf6['model'],qs['fields'](_0x5e5675[_0xd915('0x3f')]['fields']));_0x3b27d2[_0xd915('0x43')]=_0x3b27d2[_0xd915('0x43')][_0xd915('0x45')]?_0x3b27d2[_0xd915('0x43')]:_0x8caf6['model'];if(!_0x5e5675[_0xd915('0x3f')]['hasOwnProperty']('nolimit')){_0x3b27d2[_0xd915('0x47')]=qs[_0xd915('0x47')](_0x5e5675[_0xd915('0x3f')][_0xd915('0x47')]);_0x3b27d2[_0xd915('0x2c')]=qs[_0xd915('0x2c')](_0x5e5675['query']['offset']);}_0x3b27d2[_0xd915('0x48')]=qs['sort'](_0x5e5675[_0xd915('0x3f')][_0xd915('0x49')]);_0x3b27d2['where']=qs[_0xd915('0x41')](_['pick'](_0x5e5675['query'],_0x8caf6[_0xd915('0x41')]));_0x3b27d2[_0xd915('0x4c')][_0xd915('0x64')]=_0x2d821f['id'];if(_0x5e5675['query'][_0xd915('0x4b')]){_0x3b27d2['where']=_['merge'](_0x3b27d2['where'],{'$or':_[_0xd915('0x39')](_0x3b27d2[_0xd915('0x43')],function(_0x8dc15d){var _0x26ec39={};_0x26ec39[_0x8dc15d]={'$like':'%'+_0x5e5675[_0xd915('0x3f')][_0xd915('0x4b')]+'%'};return _0x26ec39;})});}_0x3b27d2=_[_0xd915('0x4d')]({},_0x3b27d2,_0x5e5675[_0xd915('0x4f')]);return db[_0xd915('0x63')][_0xd915('0x52')](_0x3b27d2);}})[_0xd915('0x1e')](function(_0x35b0a1){if(_0x35b0a1){return db[_0xd915('0x65')][_0xd915('0x66')]({'where':{'id':_[_0xd915('0x39')](_0x35b0a1,'UserId'),'role':_0xd915('0x67')},'attributes':['id','name',_0xd915('0x68'),_0xd915('0x69'),_0xd915('0x6a')]});}})['then'](function(_0x3ada25){if(_0x3ada25){return{'count':_0x3ada25[_0xd915('0x6b')],'rows':_[_0xd915('0x39')](_0x3ada25[_0xd915('0x53')],function(_0x31f634){return{'membername':_0x31f634[_0xd915('0x36')],'UserId':_0x31f634['id'],'queue_name':_0x4cdd04[_0xd915('0x36')],'ChatQueueId':_0x4cdd04['id'],'interface':util[_0xd915('0x6c')](_0xd915('0x6d'),_0xd915('0x6e'),_0x31f634[_0xd915('0x36')]),'penalty':0x0,'paused':_0x31f634[_0xd915('0x68')],'createdAt':_0x31f634[_0xd915('0x6a')],'updatedAt':_0x31f634['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd915('0x1e')](respondWithFilteredResult(_0x4c5d6d,_0x3b27d2))[_0xd915('0x54')](handleError(_0x4c5d6d,null));};exports['getTeams']=function(_0x254494,_0x5ab50c,_0x53938f){var _0x47f2d7={};var _0x3a6939={};var _0x402a70;var _0x52144d;return db[_0xd915('0x3a')]['findOne']({'where':{'id':_0x254494[_0xd915('0x56')]['id']}})[_0xd915('0x1e')](handleEntityNotFound(_0x5ab50c,null))[_0xd915('0x1e')](function(_0x492152){if(_0x492152){_0x402a70=_0x492152;_0x3a6939[_0xd915('0x3e')]=_[_0xd915('0x40')](db[_0xd915('0x6f')][_0xd915('0x3b')]);_0x3a6939[_0xd915('0x3f')]=_[_0xd915('0x40')](_0x254494['query']);_0x3a6939[_0xd915('0x41')]=_[_0xd915('0x42')](_0x3a6939[_0xd915('0x3e')],_0x3a6939['query']);_0x47f2d7[_0xd915('0x43')]=_[_0xd915('0x42')](_0x3a6939[_0xd915('0x3e')],qs[_0xd915('0x44')](_0x254494[_0xd915('0x3f')][_0xd915('0x44')]));_0x47f2d7[_0xd915('0x43')]=_0x47f2d7['attributes'][_0xd915('0x45')]?_0x47f2d7[_0xd915('0x43')]:_0x3a6939[_0xd915('0x3e')];_0x47f2d7[_0xd915('0x48')]=qs[_0xd915('0x49')](_0x254494['query'][_0xd915('0x49')]);_0x47f2d7[_0xd915('0x4c')]=qs[_0xd915('0x41')](_['pick'](_0x254494[_0xd915('0x3f')],_0x3a6939[_0xd915('0x41')]));if(_0x254494[_0xd915('0x3f')][_0xd915('0x4b')]){_0x47f2d7['where']=_[_0xd915('0x4d')](_0x47f2d7[_0xd915('0x4c')],{'$or':_[_0xd915('0x39')](_0x47f2d7[_0xd915('0x43')],function(_0x4cc34a){var _0x34250d={};_0x34250d[_0x4cc34a]={'$like':'%'+_0x254494[_0xd915('0x3f')][_0xd915('0x4b')]+'%'};return _0x34250d;})});}_0x47f2d7=_[_0xd915('0x4d')]({},_0x47f2d7,_0x254494[_0xd915('0x4f')]);return _0x402a70[_0xd915('0x70')](_0x47f2d7);}})[_0xd915('0x1e')](function(_0x4fa451){if(_0x4fa451){_0x52144d=_0x4fa451[_0xd915('0x45')];if(!_0x254494['query'][_0xd915('0x46')](_0xd915('0x71'))){_0x47f2d7[_0xd915('0x47')]=qs['limit'](_0x254494['query']['limit']);_0x47f2d7[_0xd915('0x2c')]=qs[_0xd915('0x2c')](_0x254494[_0xd915('0x3f')][_0xd915('0x2c')]);}return _0x402a70['getTeams'](_0x47f2d7);}})[_0xd915('0x1e')](function(_0x284f0b){if(_0x284f0b){return _0x284f0b?{'count':_0x52144d,'rows':_0x284f0b}:null;}})[_0xd915('0x1e')](respondWithResult(_0x5ab50c,null))[_0xd915('0x54')](handleError(_0x5ab50c,null));};exports[_0xd915('0x72')]=function(_0x19bfc7,_0x2e143c,_0x1cda38){var _0x4f4da1=_0x19bfc7['body'][_0xd915('0x73')];return db['Team']['findAll']({'where':{'id':_0x4f4da1},'attributes':['id'],'include':[{'model':db[_0xd915('0x65')],'as':_0xd915('0x74'),'attributes':['id',_0xd915('0x36'),_0xd915('0x75'),_0xd915('0x76'),_0xd915('0x77')],'raw':!![]}]})[_0xd915('0x1e')](function(_0x156b50){if(_0x156b50){var _0x549ab2=_[_0xd915('0x78')](_0x156b50,function(_0x3f479d){var _0x389ddb=_0x3f479d[_0xd915('0x34')]({'plain':!![]});return _0x389ddb[_0xd915('0x74')];});return db[_0xd915('0x3a')][_0xd915('0x57')]({'where':{'id':_0x19bfc7[_0xd915('0x56')]['id']}})[_0xd915('0x1e')](function(_0x59a99a){return db['sequelize'][_0xd915('0x79')](function(_0x49ba52){return _0x59a99a[_0xd915('0x72')](_0x4f4da1,{'transaction':_0x49ba52})['then'](function(){return BPromise[_0xd915('0x7a')](_0x549ab2,function(_0x31dd0b){return db[_0xd915('0x63')][_0xd915('0x7b')]({'where':{'UserId':_0x31dd0b['id'],'ChatQueueId':_0x19bfc7[_0xd915('0x56')]['id']},'transaction':_0x49ba52});});})[_0xd915('0x1e')](function(){_0x549ab2[_0xd915('0x7c')](function(_0x3fc5d8){socket[_0xd915('0x7d')](_0xd915('0x7e'),{'UserId':_0x3fc5d8['id'],'ChatQueueId':_0x59a99a['id']});});});});});}})['then'](respondWithStatusCode(_0x2e143c,null))['catch'](handleError(_0x2e143c,null));};exports[_0xd915('0x7f')]=function(_0x11a2af,_0x4b2b96,_0x4ff2c1){return db[_0xd915('0x6f')][_0xd915('0x52')]({'where':{'id':_0x11a2af[_0xd915('0x3f')][_0xd915('0x73')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd915('0x74'),'attributes':['id'],'raw':!![]}]})[_0xd915('0x1e')](handleEntityNotFound(_0x4b2b96,null))[_0xd915('0x1e')](function(_0x36f84b){var _0x44eaa7=_[_0xd915('0x39')](_0x36f84b,'id');var _0x442f90=[];var _0x3fbc74=[];var _0x9e9161=squel[_0xd915('0x80')]();_0x9e9161[_0xd915('0x81')](_0xd915('0x82'))[_0xd915('0x83')](_0xd915('0x84'),'tq')['join'](_0xd915('0x85'),'ut',_0xd915('0x86'))[_0xd915('0x4c')](_0xd915('0x87'),_0x11a2af['params']['id']);for(var _0x59cff9=0x0;_0x59cff9<_0x36f84b[_0xd915('0x45')];_0x59cff9+=0x1){let _0x3012c4=_0x36f84b[_0x59cff9];for(var _0x1235ae=0x0;_0x1235ae<_0x3012c4[_0xd915('0x74')][_0xd915('0x45')];_0x1235ae+=0x1){let _0xe02c6e=_0x3012c4[_0xd915('0x74')][_0x1235ae];var _0x2e6517=_0x9e9161[_0xd915('0x88')]();_0x2e6517[_0xd915('0x4c')](_0xd915('0x89'),_0xe02c6e['id']);_0x3fbc74['push'](db[_0xd915('0x8a')]['query'](_0x2e6517[_0xd915('0x8b')](),{'type':db[_0xd915('0x8a')][_0xd915('0x8c')][_0xd915('0x8d')]})['then'](function(_0x4ce16d){if(_0x4ce16d[_0xd915('0x45')]===0x1){return _0xe02c6e['id'];}else{var _0x43a4b1=_[_0xd915('0x8e')](_['map'](_0x4ce16d,'TeamId'),function(_0x18c48b){return _[_0xd915('0x8f')](_0x44eaa7,_0x18c48b);});if(_0x43a4b1){return _0xe02c6e['id'];}}}));}}return BPromise['all'](_0x3fbc74)[_0xd915('0x1e')](function(_0xc4e086){_0x442f90=_(_0x442f90)[_0xd915('0x90')](_0xc4e086)['compact']()[_0xd915('0x91')]();return db[_0xd915('0x3a')]['find']({'where':{'id':_0x11a2af[_0xd915('0x56')]['id']}})['then'](function(_0x15c742){return db[_0xd915('0x8a')][_0xd915('0x79')](function(_0x27f0c6){return _0x15c742[_0xd915('0x7f')](_0x11a2af['query'][_0xd915('0x73')],{'transaction':_0x27f0c6})[_0xd915('0x1e')](function(){if(!_[_0xd915('0x92')](_0x442f90)){return _0x15c742[_0xd915('0x93')](_0x442f90,{'transaction':_0x27f0c6});}})[_0xd915('0x1e')](function(){_0x442f90[_0xd915('0x7c')](function(_0xc431ce){socket['emit'](_0xd915('0x94'),{'UserId':_0xc431ce,'ChatQueueId':_0x15c742['id']});});});});});});})[_0xd915('0x1e')](respondWithStatusCode(_0x4b2b96,null))[_0xd915('0x54')](handleError(_0x4b2b96,null));};exports['addAgents']=function(_0x18ad46,_0x1f29b4,_0x370977){return db['ChatQueue'][_0xd915('0x57')]({'where':{'id':_0x18ad46[_0xd915('0x56')]['id']}})['then'](handleEntityNotFound(_0x1f29b4,null))[_0xd915('0x1e')](function(_0x2edf3c){if(_0x2edf3c){return _0x2edf3c['addAgents'](_0x18ad46['body'][_0xd915('0x73')],_['omit'](_0x18ad46[_0xd915('0x60')],[_0xd915('0x73'),'id'])||{})[_0xd915('0x95')](function(_0x211749){for(var _0x4a6012=0x0;_0x4a6012<_0x18ad46[_0xd915('0x60')]['ids'][_0xd915('0x45')];_0x4a6012+=0x1){socket[_0xd915('0x7d')](_0xd915('0x7e'),{'UserId':Number(_0x18ad46[_0xd915('0x60')]['ids'][_0x4a6012]),'ChatQueueId':Number(_0x18ad46['params']['id'])});}return _0x211749;});}})[_0xd915('0x1e')](respondWithResult(_0x1f29b4,null))[_0xd915('0x54')](handleError(_0x1f29b4,null));};exports['removeAgents']=function(_0x49cfbc,_0x3ae93e,_0x88de91){return db[_0xd915('0x3a')][_0xd915('0x57')]({'where':{'id':_0x49cfbc[_0xd915('0x56')]['id']}})[_0xd915('0x1e')](handleEntityNotFound(_0x3ae93e,null))[_0xd915('0x1e')](function(_0x3f3095){if(_0x3f3095){return _0x3f3095[_0xd915('0x93')](_0x49cfbc[_0xd915('0x3f')][_0xd915('0x73')])[_0xd915('0x1e')](function(){if(_[_0xd915('0x96')](_0x49cfbc[_0xd915('0x3f')][_0xd915('0x73')])){for(var _0x4cab68=0x0;_0x4cab68<_0x49cfbc[_0xd915('0x3f')][_0xd915('0x73')][_0xd915('0x45')];_0x4cab68+=0x1){socket[_0xd915('0x7d')](_0xd915('0x94'),{'UserId':Number(_0x49cfbc[_0xd915('0x3f')][_0xd915('0x73')][_0x4cab68]),'ChatQueueId':Number(_0x49cfbc[_0xd915('0x56')]['id'])});}}else{socket[_0xd915('0x7d')](_0xd915('0x94'),{'UserId':Number(_0x49cfbc['query'][_0xd915('0x73')]),'ChatQueueId':Number(_0x49cfbc[_0xd915('0x56')]['id'])});}});}})[_0xd915('0x1e')](respondWithStatusCode(_0x3ae93e,null))[_0xd915('0x54')](handleError(_0x3ae93e,null));};exports[_0xd915('0x97')]=function(_0x28e301,_0x416005,_0xd55271){var _0x3a3670={};var _0x5357b0={};var _0x564f95;var _0x3f1fe4;return db[_0xd915('0x3a')][_0xd915('0x62')]({'where':{'id':_0x28e301[_0xd915('0x56')]['id']}})[_0xd915('0x1e')](handleEntityNotFound(_0x416005,null))[_0xd915('0x1e')](function(_0x4a5835){if(_0x4a5835){_0x564f95=_0x4a5835;_0x5357b0['model']=_[_0xd915('0x40')](db[_0xd915('0x65')]['rawAttributes']);_0x5357b0[_0xd915('0x3f')]=_[_0xd915('0x40')](_0x28e301['query']);_0x5357b0[_0xd915('0x41')]=_['intersection'](_0x5357b0['model'],_0x5357b0[_0xd915('0x3f')]);_0x3a3670['attributes']=_[_0xd915('0x42')](_0x5357b0[_0xd915('0x3e')],qs[_0xd915('0x44')](_0x28e301[_0xd915('0x3f')]['fields']));_0x3a3670[_0xd915('0x43')]=_0x3a3670[_0xd915('0x43')][_0xd915('0x45')]?_0x3a3670[_0xd915('0x43')]:_0x5357b0['model'];_0x3a3670[_0xd915('0x48')]=qs['sort'](_0x28e301['query'][_0xd915('0x49')]);_0x3a3670['where']=qs['filters'](_[_0xd915('0x4a')](_0x28e301['query'],_0x5357b0['filters']));if(_0x28e301[_0xd915('0x3f')]['filter']){_0x3a3670[_0xd915('0x4c')]=_[_0xd915('0x4d')](_0x3a3670[_0xd915('0x4c')],{'$or':_[_0xd915('0x39')](_0x3a3670[_0xd915('0x43')],function(_0x8265b1){var _0x10d0dc={};_0x10d0dc[_0x8265b1]={'$like':'%'+_0x28e301[_0xd915('0x3f')][_0xd915('0x4b')]+'%'};return _0x10d0dc;})});}_0x3a3670=_[_0xd915('0x4d')]({},_0x3a3670,_0x28e301[_0xd915('0x4f')]);return _0x564f95[_0xd915('0x97')](_0x3a3670);}})[_0xd915('0x1e')](function(_0x4a1f3b){if(_0x4a1f3b){_0x3f1fe4=_0x4a1f3b[_0xd915('0x45')];if(!_0x28e301[_0xd915('0x3f')][_0xd915('0x46')](_0xd915('0x71'))){_0x3a3670[_0xd915('0x47')]=qs[_0xd915('0x47')](_0x28e301[_0xd915('0x3f')][_0xd915('0x47')]);_0x3a3670[_0xd915('0x2c')]=qs[_0xd915('0x2c')](_0x28e301[_0xd915('0x3f')][_0xd915('0x2c')]);}return _0x564f95[_0xd915('0x97')](_0x3a3670);}})[_0xd915('0x1e')](function(_0x421e02){if(_0x421e02){return _0x421e02?{'count':_0x3f1fe4,'rows':_0x421e02}:null;}})['then'](respondWithResult(_0x416005,null))['catch'](handleError(_0x416005,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 51f0323..5f930c8 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 _0xa8fb=['exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x4cae67,_0x573621){var _0x290961=function(_0x23e722){while(--_0x23e722){_0x4cae67['push'](_0x4cae67['shift']());}};_0x290961(++_0x573621);}(_0xa8fb,0x172));var _0xba8f=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xa8fb[_0x47fd36];return _0x21a0fc;};'use strict';var EventEmitter=require(_0xba8f('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xba8f('0x1')](0x0);var events={'afterCreate':_0xba8f('0x2'),'afterUpdate':_0xba8f('0x3'),'afterDestroy':_0xba8f('0x4')};function emitEvent(_0x26eab1){return function(_0x21be59,_0x19567f,_0x2218f0){ChatQueueEvents[_0xba8f('0x5')](_0x26eab1+':'+_0x21be59['id'],_0x21be59);ChatQueueEvents[_0xba8f('0x5')](_0x26eab1,_0x21be59);_0x2218f0(null);};}for(var e in events){if(events[_0xba8f('0x6')](e)){var event=events[e];ChatQueue[_0xba8f('0x7')](e,emitEvent(event));}}module[_0xba8f('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0xf3cd=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x5b1370,_0x5beac4){var _0xf5075d=function(_0x26aeab){while(--_0x26aeab){_0x5b1370['push'](_0x5b1370['shift']());}};_0xf5075d(++_0x5beac4);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x203c8c,_0x2728e5){_0x203c8c=_0x203c8c-0x0;var _0x1e5322=_0xf3cd[_0x203c8c];return _0x1e5322;};'use strict';var EventEmitter=require(_0xdf3c('0x0'));var ChatQueue=require(_0xdf3c('0x1'))['db'][_0xdf3c('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xdf3c('0x3')](0x0);var events={'afterCreate':_0xdf3c('0x4'),'afterUpdate':_0xdf3c('0x5'),'afterDestroy':'remove'};function emitEvent(_0x401518){return function(_0x71b446,_0x9f71cb,_0x573076){ChatQueueEvents[_0xdf3c('0x6')](_0x401518+':'+_0x71b446['id'],_0x71b446);ChatQueueEvents[_0xdf3c('0x6')](_0x401518,_0x71b446);_0x573076(null);};}for(var e in events){if(events[_0xdf3c('0x7')](e)){var event=events[e];ChatQueue[_0xdf3c('0x8')](e,emitEvent(event));}}module[_0xdf3c('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 27eddce..8911a61 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 _0x7abe=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash','util'];(function(_0x351134,_0x392b05){var _0x5a5278=function(_0x5a4a7f){while(--_0x5a4a7f){_0x351134['push'](_0x351134['shift']());}};_0x5a5278(++_0x392b05);}(_0x7abe,0x1ab));var _0xe7ab=function(_0x544e1a,_0xf7582c){_0x544e1a=_0x544e1a-0x0;var _0x142980=_0x7abe[_0x544e1a];return _0x142980;};'use strict';var _=require(_0xe7ab('0x0'));var util=require(_0xe7ab('0x1'));var logger=require(_0xe7ab('0x2'))(_0xe7ab('0x3'));var moment=require('moment');var BPromise=require(_0xe7ab('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe7ab('0x5'));var rimraf=require(_0xe7ab('0x6'));var config=require(_0xe7ab('0x7'));var attributes=require(_0xe7ab('0x8'));module[_0xe7ab('0x9')]=function(_0x44c7de,_0x1a7494){return _0x44c7de[_0xe7ab('0xa')](_0xe7ab('0xb'),attributes,{'tableName':_0xe7ab('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb412=['request-promise','rimraf','../../config/environment','./chatQueue.attributes','define','ChatQueue','chat_queues','lodash','util','moment','bluebird'];(function(_0x1ad53d,_0x3067eb){var _0x57df8d=function(_0x2e1ac3){while(--_0x2e1ac3){_0x1ad53d['push'](_0x1ad53d['shift']());}};_0x57df8d(++_0x3067eb);}(_0xb412,0x193));var _0x2b41=function(_0x5a9999,_0x557ff8){_0x5a9999=_0x5a9999-0x0;var _0x4597dc=_0xb412[_0x5a9999];return _0x4597dc;};'use strict';var _=require(_0x2b41('0x0'));var util=require(_0x2b41('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2b41('0x2'));var BPromise=require(_0x2b41('0x3'));var rp=require(_0x2b41('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2b41('0x5'));var config=require(_0x2b41('0x6'));var attributes=require(_0x2b41('0x7'));module['exports']=function(_0x9b06a1,_0x39cfaa){return _0x9b06a1[_0x2b41('0x8')](_0x2b41('0x9'),attributes,{'tableName':_0x2b41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 33f943c..a637b90 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 _0x8769=['map','model','attributes','catch','ShowChatQueue','stringify','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','GetChatQueue','ChatQueue','findAll','options','raw','where','include'];(function(_0x568f46,_0x507dcf){var _0xf158b1=function(_0x2d892f){while(--_0x2d892f){_0x568f46['push'](_0x568f46['shift']());}};_0xf158b1(++_0x507dcf);}(_0x8769,0x110));var _0x9876=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0x8769[_0x58e469];return _0x4c01c5;};'use strict';var _=require(_0x9876('0x0'));var util=require(_0x9876('0x1'));var moment=require('moment');var BPromise=require(_0x9876('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9876('0x3'));var db=require(_0x9876('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9876('0x5'));var config=require(_0x9876('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9876('0x7')][_0x9876('0x8')]({'port':0x232a});config['redis']=_[_0x9876('0x9')](config[_0x9876('0xa')],{'host':_0x9876('0xb'),'port':0x18eb});var socket=require(_0x9876('0xc'))(new Redis(config[_0x9876('0xa')]));require(_0x9876('0xd'))[_0x9876('0xe')](socket);function respondWithRpcPromise(_0x2db388,_0x3c6568,_0x299087){return new BPromise(function(_0x1cac6c,_0x8946f8){return client[_0x9876('0xf')](_0x2db388,_0x299087)[_0x9876('0x10')](function(_0x2ef152){logger['info'](_0x9876('0x11'),_0x3c6568,'request\x20sent');logger[_0x9876('0x12')](_0x9876('0x13'),_0x3c6568,'request\x20sent',JSON['stringify'](_0x2ef152));if(_0x2ef152[_0x9876('0x14')]){if(_0x2ef152['error'][_0x9876('0x15')]===0x1f4){logger[_0x9876('0x14')](_0x9876('0x11'),_0x3c6568,_0x2ef152[_0x9876('0x14')]['message']);return _0x8946f8(_0x2ef152[_0x9876('0x14')][_0x9876('0x16')]);}logger[_0x9876('0x14')](_0x9876('0x11'),_0x3c6568,_0x2ef152[_0x9876('0x14')][_0x9876('0x16')]);return _0x1cac6c(_0x2ef152[_0x9876('0x14')][_0x9876('0x16')]);}else{logger[_0x9876('0x17')](_0x9876('0x11'),_0x3c6568,'request\x20sent');_0x1cac6c(_0x2ef152[_0x9876('0x18')][_0x9876('0x16')]);}})['catch'](function(_0x43cd0f){logger[_0x9876('0x14')](_0x9876('0x11'),_0x3c6568,_0x43cd0f);_0x8946f8(_0x43cd0f);});});}exports[_0x9876('0x19')]=function(_0x264445){var _0x73a9f7=this;return new Promise(function(_0x523878,_0x1adb6d){return db[_0x9876('0x1a')][_0x9876('0x1b')]({'raw':_0x264445[_0x9876('0x1c')]?_0x264445[_0x9876('0x1c')][_0x9876('0x1d')]===undefined?!![]:![]:!![],'where':_0x264445[_0x9876('0x1c')]?_0x264445[_0x9876('0x1c')][_0x9876('0x1e')]||null:null,'attributes':_0x264445[_0x9876('0x1c')]?_0x264445[_0x9876('0x1c')]['attributes']||null:null,'limit':_0x264445[_0x9876('0x1c')]?_0x264445[_0x9876('0x1c')]['limit']||null:null,'include':_0x264445[_0x9876('0x1c')]?_0x264445[_0x9876('0x1c')][_0x9876('0x1f')]?_[_0x9876('0x20')](_0x264445[_0x9876('0x1c')][_0x9876('0x1f')],function(_0x40d360){return{'model':db[_0x40d360[_0x9876('0x21')]],'as':_0x40d360['as'],'attributes':_0x40d360[_0x9876('0x22')],'include':_0x40d360[_0x9876('0x1f')]?_[_0x9876('0x20')](_0x40d360['include'],function(_0x39bb68){return{'model':db[_0x39bb68[_0x9876('0x21')]],'as':_0x39bb68['as'],'attributes':_0x39bb68['attributes'],'include':_0x39bb68[_0x9876('0x1f')]?_['map'](_0x39bb68['include'],function(_0x134b97){return{'model':db[_0x134b97[_0x9876('0x21')]],'as':_0x134b97['as'],'attributes':_0x134b97[_0x9876('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f8121){logger['info'](_0x9876('0x19'),_0x264445);logger['debug'](_0x9876('0x19'),_0x264445,JSON['stringify'](_0x2f8121));_0x523878(_0x2f8121);})[_0x9876('0x23')](function(_0x37537a){logger[_0x9876('0x14')]('GetChatQueue',_0x37537a[_0x9876('0x16')],_0x264445);_0x1adb6d(_0x73a9f7[_0x9876('0x14')](0x1f4,_0x37537a[_0x9876('0x16')]));});});};exports['ShowChatQueue']=function(_0xf00408){var _0x4d5c4f=this;return new Promise(function(_0x2b34bd,_0x57787c){return db['ChatQueue']['find']({'raw':_0xf00408[_0x9876('0x1c')]?_0xf00408[_0x9876('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xf00408[_0x9876('0x1c')]?_0xf00408[_0x9876('0x1c')][_0x9876('0x1e')]||null:null,'attributes':_0xf00408[_0x9876('0x1c')]?_0xf00408[_0x9876('0x1c')][_0x9876('0x22')]||null:null,'include':_0xf00408[_0x9876('0x1c')]?_0xf00408['options'][_0x9876('0x1f')]?_['map'](_0xf00408[_0x9876('0x1c')][_0x9876('0x1f')],function(_0x9ad012){return{'model':db[_0x9ad012[_0x9876('0x21')]],'as':_0x9ad012['as'],'attributes':_0x9ad012[_0x9876('0x22')],'include':_0x9ad012['include']?_[_0x9876('0x20')](_0x9ad012[_0x9876('0x1f')],function(_0x36c19d){return{'model':db[_0x36c19d['model']],'as':_0x36c19d['as'],'attributes':_0x36c19d[_0x9876('0x22')],'include':_0x36c19d['include']?_[_0x9876('0x20')](_0x36c19d['include'],function(_0x591718){return{'model':db[_0x591718[_0x9876('0x21')]],'as':_0x591718['as'],'attributes':_0x591718['attributes']};}):[]};}):[]};}):[]:[]})[_0x9876('0x10')](function(_0x341bf9){logger['info'](_0x9876('0x24'),_0xf00408);logger[_0x9876('0x12')](_0x9876('0x24'),_0xf00408,JSON[_0x9876('0x25')](_0x341bf9));_0x2b34bd(_0x341bf9);})[_0x9876('0x23')](function(_0x386e1e){logger[_0x9876('0x14')](_0x9876('0x24'),_0x386e1e[_0x9876('0x16')],_0xf00408);_0x57787c(_0x4d5c4f[_0x9876('0x14')](0x1f4,_0x386e1e[_0x9876('0x16')]));});});}; \ No newline at end of file +var _0x94d2=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','where','attributes','include','map','model','then','ShowChatQueue','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0xe3f9c3,_0x12473b){var _0x5aa9ac=function(_0x208fc0){while(--_0x208fc0){_0xe3f9c3['push'](_0xe3f9c3['shift']());}};_0x5aa9ac(++_0x12473b);}(_0x94d2,0x1cd));var _0x294d=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0x94d2[_0xd4636c];return _0x5ee17d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x294d('0x0'));var BPromise=require(_0x294d('0x1'));var rs=require(_0x294d('0x2'));var fs=require('fs');var Redis=require(_0x294d('0x3'));var db=require(_0x294d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x294d('0x5'));var config=require(_0x294d('0x6'));var jayson=require(_0x294d('0x7'));var client=jayson[_0x294d('0x8')][_0x294d('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x294d('0xa')],{'host':_0x294d('0xb'),'port':0x18eb});var socket=require(_0x294d('0xc'))(new Redis(config[_0x294d('0xa')]));require(_0x294d('0xd'))['register'](socket);function respondWithRpcPromise(_0x7931bb,_0x297494,_0x53d5f5){return new BPromise(function(_0x20af48,_0x18fde9){return client['request'](_0x7931bb,_0x53d5f5)['then'](function(_0x165330){logger[_0x294d('0xe')](_0x294d('0xf'),_0x297494,'request\x20sent');logger[_0x294d('0x10')](_0x294d('0x11'),_0x297494,_0x294d('0x12'),JSON[_0x294d('0x13')](_0x165330));if(_0x165330['error']){if(_0x165330[_0x294d('0x14')]['code']===0x1f4){logger['error'](_0x294d('0xf'),_0x297494,_0x165330[_0x294d('0x14')][_0x294d('0x15')]);return _0x18fde9(_0x165330[_0x294d('0x14')]['message']);}logger[_0x294d('0x14')]('ChatQueue,\x20%s,\x20%s',_0x297494,_0x165330['error']['message']);return _0x20af48(_0x165330['error'][_0x294d('0x15')]);}else{logger[_0x294d('0xe')](_0x294d('0xf'),_0x297494,_0x294d('0x12'));_0x20af48(_0x165330[_0x294d('0x16')][_0x294d('0x15')]);}})[_0x294d('0x17')](function(_0x9a7c6a){logger['error'](_0x294d('0xf'),_0x297494,_0x9a7c6a);_0x18fde9(_0x9a7c6a);});});}exports[_0x294d('0x18')]=function(_0x578e13){var _0xa9338a=this;return new Promise(function(_0x19cee1,_0x429da3){return db[_0x294d('0x19')][_0x294d('0x1a')]({'raw':_0x578e13[_0x294d('0x1b')]?_0x578e13[_0x294d('0x1b')][_0x294d('0x1c')]===undefined?!![]:![]:!![],'where':_0x578e13[_0x294d('0x1b')]?_0x578e13[_0x294d('0x1b')][_0x294d('0x1d')]||null:null,'attributes':_0x578e13[_0x294d('0x1b')]?_0x578e13[_0x294d('0x1b')][_0x294d('0x1e')]||null:null,'limit':_0x578e13[_0x294d('0x1b')]?_0x578e13['options']['limit']||null:null,'include':_0x578e13[_0x294d('0x1b')]?_0x578e13[_0x294d('0x1b')][_0x294d('0x1f')]?_[_0x294d('0x20')](_0x578e13[_0x294d('0x1b')][_0x294d('0x1f')],function(_0x4da072){return{'model':db[_0x4da072[_0x294d('0x21')]],'as':_0x4da072['as'],'attributes':_0x4da072['attributes'],'include':_0x4da072[_0x294d('0x1f')]?_[_0x294d('0x20')](_0x4da072[_0x294d('0x1f')],function(_0x1f2dd7){return{'model':db[_0x1f2dd7[_0x294d('0x21')]],'as':_0x1f2dd7['as'],'attributes':_0x1f2dd7[_0x294d('0x1e')],'include':_0x1f2dd7[_0x294d('0x1f')]?_['map'](_0x1f2dd7[_0x294d('0x1f')],function(_0x2b2072){return{'model':db[_0x2b2072[_0x294d('0x21')]],'as':_0x2b2072['as'],'attributes':_0x2b2072[_0x294d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x294d('0x22')](function(_0x338cc1){logger[_0x294d('0xe')](_0x294d('0x18'),_0x578e13);logger['debug'](_0x294d('0x18'),_0x578e13,JSON[_0x294d('0x13')](_0x338cc1));_0x19cee1(_0x338cc1);})[_0x294d('0x17')](function(_0x3cf02d){logger['error']('GetChatQueue',_0x3cf02d[_0x294d('0x15')],_0x578e13);_0x429da3(_0xa9338a[_0x294d('0x14')](0x1f4,_0x3cf02d[_0x294d('0x15')]));});});};exports[_0x294d('0x23')]=function(_0x395ed8){var _0x15353d=this;return new Promise(function(_0x1e445f,_0x16c3e1){return db[_0x294d('0x19')]['find']({'raw':_0x395ed8[_0x294d('0x1b')]?_0x395ed8[_0x294d('0x1b')][_0x294d('0x1c')]===undefined?!![]:![]:!![],'where':_0x395ed8['options']?_0x395ed8[_0x294d('0x1b')][_0x294d('0x1d')]||null:null,'attributes':_0x395ed8['options']?_0x395ed8[_0x294d('0x1b')][_0x294d('0x1e')]||null:null,'include':_0x395ed8['options']?_0x395ed8['options'][_0x294d('0x1f')]?_[_0x294d('0x20')](_0x395ed8[_0x294d('0x1b')]['include'],function(_0x37aa78){return{'model':db[_0x37aa78[_0x294d('0x21')]],'as':_0x37aa78['as'],'attributes':_0x37aa78[_0x294d('0x1e')],'include':_0x37aa78[_0x294d('0x1f')]?_[_0x294d('0x20')](_0x37aa78[_0x294d('0x1f')],function(_0x2b70e3){return{'model':db[_0x2b70e3[_0x294d('0x21')]],'as':_0x2b70e3['as'],'attributes':_0x2b70e3[_0x294d('0x1e')],'include':_0x2b70e3[_0x294d('0x1f')]?_[_0x294d('0x20')](_0x2b70e3[_0x294d('0x1f')],function(_0x496941){return{'model':db[_0x496941[_0x294d('0x21')]],'as':_0x496941['as'],'attributes':_0x496941[_0x294d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x294d('0x22')](function(_0x538381){logger[_0x294d('0xe')](_0x294d('0x23'),_0x395ed8);logger[_0x294d('0x10')](_0x294d('0x23'),_0x395ed8,JSON['stringify'](_0x538381));_0x1e445f(_0x538381);})[_0x294d('0x17')](function(_0x22066a){logger[_0x294d('0x14')]('ShowChatQueue',_0x22066a[_0x294d('0x15')],_0x395ed8);_0x16c3e1(_0x15353d[_0x294d('0x14')](0x1f4,_0x22066a[_0x294d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 8d9a302..0e2a4fd 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 _0x72b1=['register','length','./chatQueue.events','remove','update','emit','removeListener'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x72b1,0x16e));var _0x172b=function(_0x30cb8d,_0x57cd7c){_0x30cb8d=_0x30cb8d-0x0;var _0x47747f=_0x72b1[_0x30cb8d];return _0x47747f;};'use strict';var ChatQueueEvents=require(_0x172b('0x0'));var events=['save',_0x172b('0x1'),_0x172b('0x2')];function createListener(_0x42b795,_0x18fd16){return function(_0x23bc7a){_0x18fd16[_0x172b('0x3')](_0x42b795,_0x23bc7a);};}function removeListener(_0x2c1d6e,_0x558038){return function(){ChatQueueEvents[_0x172b('0x4')](_0x2c1d6e,_0x558038);};}exports[_0x172b('0x5')]=function(_0x475fd6){for(var _0x222624=0x0,_0x571994=events[_0x172b('0x6')];_0x222624<_0x571994;_0x222624++){var _0x517363=events[_0x222624];var _0x1f98e9=createListener('chatQueue:'+_0x517363,_0x475fd6);ChatQueueEvents['on'](_0x517363,_0x1f98e9);}}; \ No newline at end of file +var _0x702d=['remove','update','emit','register','length','./chatQueue.events','save'];(function(_0x4a9c4e,_0x18766d){var _0x5c5bc2=function(_0x8b10bb){while(--_0x8b10bb){_0x4a9c4e['push'](_0x4a9c4e['shift']());}};_0x5c5bc2(++_0x18766d);}(_0x702d,0x147));var _0xd702=function(_0x29fb85,_0xa67e8d){_0x29fb85=_0x29fb85-0x0;var _0xf38a5c=_0x702d[_0x29fb85];return _0xf38a5c;};'use strict';var ChatQueueEvents=require(_0xd702('0x0'));var events=[_0xd702('0x1'),_0xd702('0x2'),_0xd702('0x3')];function createListener(_0x37ed5c,_0x5c2b9e){return function(_0x20c11a){_0x5c2b9e[_0xd702('0x4')](_0x37ed5c,_0x20c11a);};}function removeListener(_0x27b260,_0x1c5a32){return function(){ChatQueueEvents['removeListener'](_0x27b260,_0x1c5a32);};}exports[_0xd702('0x5')]=function(_0x544e94){for(var _0x1aecfc=0x0,_0x3a2c03=events[_0xd702('0x6')];_0x1aecfc<_0x3a2c03;_0x1aecfc++){var _0x5af246=events[_0x1aecfc];var _0x12bb75=createListener('chatQueue:'+_0x5af246,_0x544e94);ChatQueueEvents['on'](_0x5af246,_0x12bb75);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index c770cf0..94ca162 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x7a3fd,_0xe06535){var _0xa18f70=function(_0x13d791){while(--_0x13d791){_0x7a3fd['push'](_0x7a3fd['shift']());}};_0xa18f70(++_0xe06535);}(_0x008c,0x188));var _0xc008=function(_0x2bc400,_0x27208f){_0x2bc400=_0x2bc400-0x0;var _0x36ab53=_0x008c[_0x2bc400];return _0x36ab53;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x411d5,_0x393fe1){var _0x2295b3=function(_0x4f5e4f){while(--_0x4f5e4f){_0x411d5['push'](_0x411d5['shift']());}};_0x2295b3(++_0x393fe1);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 3a95ea4..369400a 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 _0xc715=['moment','sequelize','exports','STRING','DATE'];(function(_0x36c1f2,_0x58de4a){var _0x58d393=function(_0x13b5f3){while(--_0x13b5f3){_0x36c1f2['push'](_0x36c1f2['shift']());}};_0x58d393(++_0x58de4a);}(_0xc715,0x1d6));var _0x5c71=function(_0x3bf4d5,_0x366a37){_0x3bf4d5=_0x3bf4d5-0x0;var _0x48fdea=_0xc715[_0x3bf4d5];return _0x48fdea;};'use strict';var moment=require(_0x5c71('0x0'));var Sequelize=require(_0x5c71('0x1'));module[_0x5c71('0x2')]={'uniqueid':{'type':Sequelize[_0x5c71('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5c71('0x3')]},'joinAt':{'type':Sequelize[_0x5c71('0x4')]},'leaveAt':{'type':Sequelize[_0x5c71('0x4')]},'acceptAt':{'type':Sequelize[_0x5c71('0x4')]},'exitAt':{'type':Sequelize[_0x5c71('0x4')]},'reason':{'type':Sequelize[_0x5c71('0x3')]}}; \ No newline at end of file +var _0x4813=['sequelize','exports','STRING','DATE','moment'];(function(_0xd9eaf7,_0x4740cd){var _0x473f7a=function(_0x35ffa5){while(--_0x35ffa5){_0xd9eaf7['push'](_0xd9eaf7['shift']());}};_0x473f7a(++_0x4740cd);}(_0x4813,0x14e));var _0x3481=function(_0x496cd5,_0x403984){_0x496cd5=_0x496cd5-0x0;var _0x163059=_0x4813[_0x496cd5];return _0x163059;};'use strict';var moment=require(_0x3481('0x0'));var Sequelize=require(_0x3481('0x1'));module[_0x3481('0x2')]={'uniqueid':{'type':Sequelize[_0x3481('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x3481('0x3')]},'joinAt':{'type':Sequelize[_0x3481('0x4')]},'leaveAt':{'type':Sequelize[_0x3481('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x3481('0x4')]},'reason':{'type':Sequelize[_0x3481('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index c18cfdd..b950d00 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 _0xe5e0=['../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','ChatQueueReport','rawAttributes','type','key','model','filters','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','intersection','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x5a2285,_0x3212d1){var _0x48f6ed=function(_0x322127){while(--_0x322127){_0x5a2285['push'](_0x5a2285['shift']());}};_0x48f6ed(++_0x3212d1);}(_0xe5e0,0x1be));var _0x0e5e=function(_0x3452b4,_0x1d0da2){_0x3452b4=_0x3452b4-0x0;var _0x459641=_0xe5e0[_0x3452b4];return _0x459641;};'use strict';var emlformat=require(_0x0e5e('0x0'));var rimraf=require(_0x0e5e('0x1'));var zipdir=require(_0x0e5e('0x2'));var jsonpatch=require(_0x0e5e('0x3'));var rp=require(_0x0e5e('0x4'));var moment=require(_0x0e5e('0x5'));var BPromise=require(_0x0e5e('0x6'));var Mustache=require(_0x0e5e('0x7'));var util=require(_0x0e5e('0x8'));var path=require('path');var sox=require(_0x0e5e('0x9'));var csv=require(_0x0e5e('0xa'));var ejs=require(_0x0e5e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e5e('0xc'));var squel=require(_0x0e5e('0xd'));var crypto=require(_0x0e5e('0xe'));var jsforce=require(_0x0e5e('0xf'));var deskjs=require(_0x0e5e('0x10'));var toCsv=require(_0x0e5e('0xa'));var querystring=require(_0x0e5e('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0e5e('0x12'));var as=require(_0x0e5e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0e5e('0x14'));var utils=require(_0x0e5e('0x15'));var config=require(_0x0e5e('0x16'));var licenseUtil=require(_0x0e5e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x275cd5,_0x322cdf){_0x322cdf=_0x322cdf||0xcc;return function(_0x5c0900){if(_0x5c0900){return _0x275cd5[_0x0e5e('0x18')](_0x322cdf);}return _0x275cd5[_0x0e5e('0x19')](_0x322cdf)[_0x0e5e('0x1a')]();};}function respondWithResult(_0x50c0a3,_0x731afc){_0x731afc=_0x731afc||0xc8;return function(_0x2353b3){if(_0x2353b3){return _0x50c0a3[_0x0e5e('0x19')](_0x731afc)[_0x0e5e('0x1b')](_0x2353b3);}};}function respondWithFilteredResult(_0x19d3a1,_0x1ef0be){return function(_0x5dedc5){if(_0x5dedc5){var _0x20a35f=typeof _0x1ef0be[_0x0e5e('0x1c')]===_0x0e5e('0x1d')&&typeof _0x1ef0be[_0x0e5e('0x1e')]===_0x0e5e('0x1d');var _0x550dda=_0x5dedc5[_0x0e5e('0x1f')];var _0x2efa7f=_0x20a35f?0x0:_0x1ef0be['offset'];var _0x29597b=_0x20a35f?_0x5dedc5[_0x0e5e('0x1f')]:_0x1ef0be['offset']+_0x1ef0be[_0x0e5e('0x1e')];var _0x3b80f8;if(_0x29597b>=_0x550dda){_0x29597b=_0x550dda;_0x3b80f8=0xc8;}else{_0x3b80f8=0xce;}_0x19d3a1['status'](_0x3b80f8);return _0x19d3a1[_0x0e5e('0x20')](_0x0e5e('0x21'),_0x2efa7f+'-'+_0x29597b+'/'+_0x550dda)[_0x0e5e('0x1b')](_0x5dedc5);}return null;};}function patchUpdates(_0x56dcc9){return function(_0x4f468f){try{jsonpatch[_0x0e5e('0x22')](_0x4f468f,_0x56dcc9,!![]);}catch(_0x1b0588){return BPromise[_0x0e5e('0x23')](_0x1b0588);}return _0x4f468f[_0x0e5e('0x24')]();};}function saveUpdates(_0x2c3c01,_0x44b8b9){return function(_0x2588fa){if(_0x2588fa){return _0x2588fa[_0x0e5e('0x25')](_0x2c3c01)[_0x0e5e('0x26')](function(_0x33b27e){return _0x33b27e;});}return null;};}function removeEntity(_0x523c30,_0x742ee8){return function(_0x2321f9){if(_0x2321f9){return _0x2321f9[_0x0e5e('0x27')]()[_0x0e5e('0x26')](function(){_0x523c30[_0x0e5e('0x19')](0xcc)[_0x0e5e('0x1a')]();});}};}function handleEntityNotFound(_0x46cbd7,_0x4b53ca){return function(_0x1b19f0){if(!_0x1b19f0){_0x46cbd7['sendStatus'](0x194);}return _0x1b19f0;};}function handleError(_0x2750b0,_0x2f789a){_0x2f789a=_0x2f789a||0x1f4;return function(_0x5e3a60){logger[_0x0e5e('0x28')](_0x5e3a60[_0x0e5e('0x29')]);if(_0x5e3a60[_0x0e5e('0x2a')]){delete _0x5e3a60['name'];}_0x2750b0[_0x0e5e('0x19')](_0x2f789a)['send'](_0x5e3a60);};}exports[_0x0e5e('0x2b')]=function(_0x2d5cc0,_0x149209){var _0x4eb0d6={},_0x38930f={},_0x7a118={'count':0x0,'rows':[]};var _0x37a2d0=_[_0x0e5e('0x2c')](db[_0x0e5e('0x2d')][_0x0e5e('0x2e')],function(_0x3ea522){return{'name':_0x3ea522['fieldName'],'type':_0x3ea522[_0x0e5e('0x2f')][_0x0e5e('0x30')]};});_0x38930f[_0x0e5e('0x31')]=_[_0x0e5e('0x2c')](_0x37a2d0,'name');_0x38930f['query']=_['keys'](_0x2d5cc0['query']);_0x38930f[_0x0e5e('0x32')]=_['intersection'](_0x38930f[_0x0e5e('0x31')],_0x38930f[_0x0e5e('0x33')]);_0x4eb0d6[_0x0e5e('0x34')]=_['intersection'](_0x38930f[_0x0e5e('0x31')],qs['fields'](_0x2d5cc0['query'][_0x0e5e('0x35')]));_0x4eb0d6[_0x0e5e('0x34')]=_0x4eb0d6[_0x0e5e('0x34')][_0x0e5e('0x36')]?_0x4eb0d6[_0x0e5e('0x34')]:_0x38930f['model'];if(!_0x2d5cc0[_0x0e5e('0x33')][_0x0e5e('0x37')](_0x0e5e('0x38'))){_0x4eb0d6[_0x0e5e('0x1e')]=qs[_0x0e5e('0x1e')](_0x2d5cc0[_0x0e5e('0x33')][_0x0e5e('0x1e')]);_0x4eb0d6[_0x0e5e('0x1c')]=qs[_0x0e5e('0x1c')](_0x2d5cc0['query'][_0x0e5e('0x1c')]);}_0x4eb0d6[_0x0e5e('0x39')]=qs[_0x0e5e('0x3a')](_0x2d5cc0[_0x0e5e('0x33')]['sort']);_0x4eb0d6[_0x0e5e('0x3b')]=qs['filters'](_[_0x0e5e('0x3c')](_0x2d5cc0[_0x0e5e('0x33')],_0x38930f[_0x0e5e('0x32')]),_0x37a2d0);if(_0x2d5cc0['query'][_0x0e5e('0x3d')]){_0x4eb0d6[_0x0e5e('0x3b')]=_[_0x0e5e('0x3e')](_0x4eb0d6['where'],{'$or':_['map'](_0x37a2d0,function(_0x392a37){if(_0x392a37[_0x0e5e('0x2f')]!==_0x0e5e('0x3f')){var _0x5e6600={};_0x5e6600[_0x392a37[_0x0e5e('0x2a')]]={'$like':'%'+_0x2d5cc0[_0x0e5e('0x33')][_0x0e5e('0x3d')]+'%'};return _0x5e6600;}})});}_0x4eb0d6=_[_0x0e5e('0x3e')]({},_0x4eb0d6,_0x2d5cc0[_0x0e5e('0x40')]);var _0x5d25f6={'where':_0x4eb0d6[_0x0e5e('0x3b')]};return db[_0x0e5e('0x2d')][_0x0e5e('0x1f')](_0x5d25f6)[_0x0e5e('0x26')](function(_0xb0953f){_0x7a118[_0x0e5e('0x1f')]=_0xb0953f;if(_0x2d5cc0['query'][_0x0e5e('0x41')]){_0x4eb0d6[_0x0e5e('0x42')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x0e5e('0x43')](_0x4eb0d6);})[_0x0e5e('0x26')](function(_0x5271fb){_0x7a118[_0x0e5e('0x44')]=_0x5271fb;return _0x7a118;})[_0x0e5e('0x26')](respondWithFilteredResult(_0x149209,_0x4eb0d6))['catch'](handleError(_0x149209,null));};exports[_0x0e5e('0x45')]=function(_0x5570b6,_0x1aeaad){var _0x29fd38={'raw':!![],'where':{'id':_0x5570b6[_0x0e5e('0x46')]['id']}},_0x31223b={};_0x31223b[_0x0e5e('0x31')]=_[_0x0e5e('0x47')](db[_0x0e5e('0x2d')][_0x0e5e('0x2e')]);_0x31223b[_0x0e5e('0x33')]=_[_0x0e5e('0x47')](_0x5570b6[_0x0e5e('0x33')]);_0x31223b['filters']=_[_0x0e5e('0x48')](_0x31223b['model'],_0x31223b['query']);_0x29fd38[_0x0e5e('0x34')]=_[_0x0e5e('0x48')](_0x31223b[_0x0e5e('0x31')],qs[_0x0e5e('0x35')](_0x5570b6[_0x0e5e('0x33')][_0x0e5e('0x35')]));_0x29fd38[_0x0e5e('0x34')]=_0x29fd38['attributes'][_0x0e5e('0x36')]?_0x29fd38[_0x0e5e('0x34')]:_0x31223b[_0x0e5e('0x31')];if(_0x5570b6[_0x0e5e('0x33')]['includeAll']){_0x29fd38[_0x0e5e('0x42')]=[{'all':!![]}];}_0x29fd38=_[_0x0e5e('0x3e')]({},_0x29fd38,_0x5570b6[_0x0e5e('0x40')]);return db[_0x0e5e('0x2d')]['find'](_0x29fd38)['then'](handleEntityNotFound(_0x1aeaad,null))['then'](respondWithResult(_0x1aeaad,null))[_0x0e5e('0x49')](handleError(_0x1aeaad,null));};exports['create']=function(_0x15a57c,_0x1d9995){return db['ChatQueueReport'][_0x0e5e('0x4a')](_0x15a57c[_0x0e5e('0x4b')],{})[_0x0e5e('0x26')](respondWithResult(_0x1d9995,0xc9))[_0x0e5e('0x49')](handleError(_0x1d9995,null));};exports[_0x0e5e('0x25')]=function(_0x2eb6d9,_0x13098a){if(_0x2eb6d9[_0x0e5e('0x4b')]['id']){delete _0x2eb6d9[_0x0e5e('0x4b')]['id'];}return db['ChatQueueReport']['find']({'where':{'id':_0x2eb6d9[_0x0e5e('0x46')]['id']}})[_0x0e5e('0x26')](handleEntityNotFound(_0x13098a,null))[_0x0e5e('0x26')](saveUpdates(_0x2eb6d9[_0x0e5e('0x4b')],null))['then'](respondWithResult(_0x13098a,null))[_0x0e5e('0x49')](handleError(_0x13098a,null));};exports[_0x0e5e('0x27')]=function(_0x4cd35a,_0x2b9bc2){return db[_0x0e5e('0x2d')][_0x0e5e('0x4c')]({'where':{'id':_0x4cd35a[_0x0e5e('0x46')]['id']}})['then'](handleEntityNotFound(_0x2b9bc2,null))[_0x0e5e('0x26')](removeEntity(_0x2b9bc2,null))['catch'](handleError(_0x2b9bc2,null));};exports[_0x0e5e('0x4d')]=function(_0x4af255,_0x5b6dcd){return db[_0x0e5e('0x2d')][_0x0e5e('0x4d')]()[_0x0e5e('0x26')](respondWithResult(_0x5b6dcd,null))['catch'](handleError(_0x5b6dcd,null));}; \ No newline at end of file +var _0x2d2c=['name','index','map','ChatQueueReport','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','findAll','rows','catch','keys','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','stack'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2d2c,0x1d7));var _0xc2d2=function(_0x4756a1,_0x3f8d1){_0x4756a1=_0x4756a1-0x0;var _0x177c4f=_0x2d2c[_0x4756a1];return _0x177c4f;};'use strict';var emlformat=require(_0xc2d2('0x0'));var rimraf=require(_0xc2d2('0x1'));var zipdir=require(_0xc2d2('0x2'));var jsonpatch=require(_0xc2d2('0x3'));var rp=require(_0xc2d2('0x4'));var moment=require(_0xc2d2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc2d2('0x6'));var util=require('util');var path=require(_0xc2d2('0x7'));var sox=require(_0xc2d2('0x8'));var csv=require(_0xc2d2('0x9'));var ejs=require(_0xc2d2('0xa'));var fs=require('fs');var fs_extra=require(_0xc2d2('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc2d2('0xc'));var jsforce=require(_0xc2d2('0xd'));var deskjs=require(_0xc2d2('0xe'));var toCsv=require(_0xc2d2('0x9'));var querystring=require(_0xc2d2('0xf'));var Papa=require(_0xc2d2('0x10'));var Redis=require(_0xc2d2('0x11'));var authService=require(_0xc2d2('0x12'));var qs=require(_0xc2d2('0x13'));var as=require(_0xc2d2('0x14'));var hardwareService=require(_0xc2d2('0x15'));var logger=require(_0xc2d2('0x16'))('api');var utils=require(_0xc2d2('0x17'));var config=require(_0xc2d2('0x18'));var licenseUtil=require(_0xc2d2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x273269,_0x738877){_0x738877=_0x738877||0xcc;return function(_0x4c2b12){if(_0x4c2b12){return _0x273269[_0xc2d2('0x1a')](_0x738877);}return _0x273269[_0xc2d2('0x1b')](_0x738877)['end']();};}function respondWithResult(_0xa6f836,_0x4de52a){_0x4de52a=_0x4de52a||0xc8;return function(_0x5a1d24){if(_0x5a1d24){return _0xa6f836[_0xc2d2('0x1b')](_0x4de52a)[_0xc2d2('0x1c')](_0x5a1d24);}};}function respondWithFilteredResult(_0xf6bc66,_0x4006f3){return function(_0x2c42a6){if(_0x2c42a6){var _0x37552b=typeof _0x4006f3[_0xc2d2('0x1d')]===_0xc2d2('0x1e')&&typeof _0x4006f3[_0xc2d2('0x1f')]===_0xc2d2('0x1e');var _0x403d51=_0x2c42a6['count'];var _0x2d4ec4=_0x37552b?0x0:_0x4006f3[_0xc2d2('0x1d')];var _0x34f750=_0x37552b?_0x2c42a6[_0xc2d2('0x20')]:_0x4006f3['offset']+_0x4006f3[_0xc2d2('0x1f')];var _0x18cef7;if(_0x34f750>=_0x403d51){_0x34f750=_0x403d51;_0x18cef7=0xc8;}else{_0x18cef7=0xce;}_0xf6bc66['status'](_0x18cef7);return _0xf6bc66[_0xc2d2('0x21')](_0xc2d2('0x22'),_0x2d4ec4+'-'+_0x34f750+'/'+_0x403d51)[_0xc2d2('0x1c')](_0x2c42a6);}return null;};}function patchUpdates(_0xb14bc3){return function(_0x603323){try{jsonpatch['apply'](_0x603323,_0xb14bc3,!![]);}catch(_0x100d5b){return BPromise[_0xc2d2('0x23')](_0x100d5b);}return _0x603323['save']();};}function saveUpdates(_0x2cac91,_0x4e3cb5){return function(_0x5ecf78){if(_0x5ecf78){return _0x5ecf78['update'](_0x2cac91)[_0xc2d2('0x24')](function(_0x1bdcb5){return _0x1bdcb5;});}return null;};}function removeEntity(_0x7ffb28,_0x4b3449){return function(_0x2dbc46){if(_0x2dbc46){return _0x2dbc46[_0xc2d2('0x25')]()[_0xc2d2('0x24')](function(){_0x7ffb28[_0xc2d2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25b201,_0x25e6af){return function(_0xf2ba15){if(!_0xf2ba15){_0x25b201[_0xc2d2('0x1a')](0x194);}return _0xf2ba15;};}function handleError(_0x1a11d2,_0x1c14e5){_0x1c14e5=_0x1c14e5||0x1f4;return function(_0x49e955){logger[_0xc2d2('0x26')](_0x49e955[_0xc2d2('0x27')]);if(_0x49e955[_0xc2d2('0x28')]){delete _0x49e955[_0xc2d2('0x28')];}_0x1a11d2['status'](_0x1c14e5)['send'](_0x49e955);};}exports[_0xc2d2('0x29')]=function(_0x7b75f4,_0x1f3b66){var _0x21ca37={},_0x402337={},_0x460379={'count':0x0,'rows':[]};var _0x4d4af2=_[_0xc2d2('0x2a')](db[_0xc2d2('0x2b')]['rawAttributes'],function(_0x29cae5){return{'name':_0x29cae5[_0xc2d2('0x2c')],'type':_0x29cae5[_0xc2d2('0x2d')][_0xc2d2('0x2e')]};});_0x402337[_0xc2d2('0x2f')]=_['map'](_0x4d4af2,'name');_0x402337[_0xc2d2('0x30')]=_['keys'](_0x7b75f4[_0xc2d2('0x30')]);_0x402337[_0xc2d2('0x31')]=_[_0xc2d2('0x32')](_0x402337[_0xc2d2('0x2f')],_0x402337[_0xc2d2('0x30')]);_0x21ca37['attributes']=_[_0xc2d2('0x32')](_0x402337[_0xc2d2('0x2f')],qs[_0xc2d2('0x33')](_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x33')]));_0x21ca37[_0xc2d2('0x34')]=_0x21ca37['attributes'][_0xc2d2('0x35')]?_0x21ca37[_0xc2d2('0x34')]:_0x402337['model'];if(!_0x7b75f4[_0xc2d2('0x30')]['hasOwnProperty'](_0xc2d2('0x36'))){_0x21ca37[_0xc2d2('0x1f')]=qs[_0xc2d2('0x1f')](_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x1f')]);_0x21ca37[_0xc2d2('0x1d')]=qs[_0xc2d2('0x1d')](_0x7b75f4[_0xc2d2('0x30')]['offset']);}_0x21ca37[_0xc2d2('0x37')]=qs[_0xc2d2('0x38')](_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x38')]);_0x21ca37['where']=qs[_0xc2d2('0x31')](_[_0xc2d2('0x39')](_0x7b75f4[_0xc2d2('0x30')],_0x402337[_0xc2d2('0x31')]),_0x4d4af2);if(_0x7b75f4['query'][_0xc2d2('0x3a')]){_0x21ca37['where']=_[_0xc2d2('0x3b')](_0x21ca37[_0xc2d2('0x3c')],{'$or':_['map'](_0x4d4af2,function(_0xdbdce0){if(_0xdbdce0[_0xc2d2('0x2d')]!==_0xc2d2('0x3d')){var _0x29d04b={};_0x29d04b[_0xdbdce0[_0xc2d2('0x28')]]={'$like':'%'+_0x7b75f4[_0xc2d2('0x30')][_0xc2d2('0x3a')]+'%'};return _0x29d04b;}})});}_0x21ca37=_[_0xc2d2('0x3b')]({},_0x21ca37,_0x7b75f4[_0xc2d2('0x3e')]);var _0x49d900={'where':_0x21ca37['where']};return db[_0xc2d2('0x2b')][_0xc2d2('0x20')](_0x49d900)['then'](function(_0xfd3ad4){_0x460379[_0xc2d2('0x20')]=_0xfd3ad4;if(_0x7b75f4[_0xc2d2('0x30')]['includeAll']){_0x21ca37['include']=[{'all':!![]}];}return db['ChatQueueReport'][_0xc2d2('0x3f')](_0x21ca37);})[_0xc2d2('0x24')](function(_0x4031d0){_0x460379[_0xc2d2('0x40')]=_0x4031d0;return _0x460379;})['then'](respondWithFilteredResult(_0x1f3b66,_0x21ca37))[_0xc2d2('0x41')](handleError(_0x1f3b66,null));};exports['show']=function(_0x582edb,_0x24544e){var _0x2a987a={'raw':!![],'where':{'id':_0x582edb['params']['id']}},_0x386a39={};_0x386a39[_0xc2d2('0x2f')]=_[_0xc2d2('0x42')](db[_0xc2d2('0x2b')]['rawAttributes']);_0x386a39[_0xc2d2('0x30')]=_['keys'](_0x582edb[_0xc2d2('0x30')]);_0x386a39[_0xc2d2('0x31')]=_[_0xc2d2('0x32')](_0x386a39[_0xc2d2('0x2f')],_0x386a39[_0xc2d2('0x30')]);_0x2a987a[_0xc2d2('0x34')]=_['intersection'](_0x386a39[_0xc2d2('0x2f')],qs['fields'](_0x582edb[_0xc2d2('0x30')][_0xc2d2('0x33')]));_0x2a987a[_0xc2d2('0x34')]=_0x2a987a[_0xc2d2('0x34')][_0xc2d2('0x35')]?_0x2a987a['attributes']:_0x386a39[_0xc2d2('0x2f')];if(_0x582edb[_0xc2d2('0x30')]['includeAll']){_0x2a987a['include']=[{'all':!![]}];}_0x2a987a=_['merge']({},_0x2a987a,_0x582edb['options']);return db[_0xc2d2('0x2b')][_0xc2d2('0x43')](_0x2a987a)[_0xc2d2('0x24')](handleEntityNotFound(_0x24544e,null))[_0xc2d2('0x24')](respondWithResult(_0x24544e,null))[_0xc2d2('0x41')](handleError(_0x24544e,null));};exports[_0xc2d2('0x44')]=function(_0x1146cb,_0x3b795a){return db[_0xc2d2('0x2b')][_0xc2d2('0x44')](_0x1146cb[_0xc2d2('0x45')],{})[_0xc2d2('0x24')](respondWithResult(_0x3b795a,0xc9))['catch'](handleError(_0x3b795a,null));};exports[_0xc2d2('0x46')]=function(_0x4181dc,_0x572764){if(_0x4181dc[_0xc2d2('0x45')]['id']){delete _0x4181dc['body']['id'];}return db[_0xc2d2('0x2b')][_0xc2d2('0x43')]({'where':{'id':_0x4181dc[_0xc2d2('0x47')]['id']}})[_0xc2d2('0x24')](handleEntityNotFound(_0x572764,null))['then'](saveUpdates(_0x4181dc[_0xc2d2('0x45')],null))[_0xc2d2('0x24')](respondWithResult(_0x572764,null))[_0xc2d2('0x41')](handleError(_0x572764,null));};exports[_0xc2d2('0x25')]=function(_0x3b61ef,_0x4765f9){return db[_0xc2d2('0x2b')][_0xc2d2('0x43')]({'where':{'id':_0x3b61ef[_0xc2d2('0x47')]['id']}})['then'](handleEntityNotFound(_0x4765f9,null))['then'](removeEntity(_0x4765f9,null))[_0xc2d2('0x41')](handleError(_0x4765f9,null));};exports[_0xc2d2('0x48')]=function(_0x472299,_0x1827c3){return db[_0xc2d2('0x2b')]['describe']()[_0xc2d2('0x24')](respondWithResult(_0x1827c3,null))[_0xc2d2('0x41')](handleError(_0x1827c3,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 1c94378..e16e93e 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0xcd4b0a,_0x1fca76){var _0x2d54a9=function(_0x139208){while(--_0x139208){_0xcd4b0a['push'](_0xcd4b0a['shift']());}};_0x2d54a9(++_0x1fca76);}(_0xb7e7,0x121));var _0x7b7e=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xb7e7[_0x186376];return _0x2dbdd9;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x37a0ab,_0x34b900){var _0x13ca1d=function(_0x3c6a41){while(--_0x3c6a41){_0x37a0ab['push'](_0x37a0ab['shift']());}};_0x13ca1d(++_0x34b900);}(_0xb10b,0x12a));var _0xbb10=function(_0x348b29,_0x3be5e9){_0x348b29=_0x348b29-0x0;var _0xc260c5=_0xb10b[_0x348b29];return _0xc260c5;};'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 9068442..b5a5d72 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 _0xf7e2=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ChatQueueReport','body','CreateChatQueueReport','debug','UpdateChatQueueReport','options','raw','attributes','lodash','util','bluebird'];(function(_0x2cf5c9,_0x56e270){var _0x162695=function(_0x5952ca){while(--_0x5952ca){_0x2cf5c9['push'](_0x2cf5c9['shift']());}};_0x162695(++_0x56e270);}(_0xf7e2,0x1bd));var _0x2f7e=function(_0x146ac6,_0x1f34bf){_0x146ac6=_0x146ac6-0x0;var _0x2892bd=_0xf7e2[_0x146ac6];return _0x2892bd;};'use strict';var _=require(_0x2f7e('0x0'));var util=require(_0x2f7e('0x1'));var moment=require('moment');var BPromise=require(_0x2f7e('0x2'));var rs=require(_0x2f7e('0x3'));var fs=require('fs');var Redis=require(_0x2f7e('0x4'));var db=require(_0x2f7e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f7e('0x6'))(_0x2f7e('0x7'));var config=require(_0x2f7e('0x8'));var jayson=require(_0x2f7e('0x9'));var client=jayson[_0x2f7e('0xa')][_0x2f7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bd1d1,_0x33aa1d,_0x515cf1){return new BPromise(function(_0x3d9396,_0x2e52a2){return client[_0x2f7e('0xc')](_0x5bd1d1,_0x515cf1)[_0x2f7e('0xd')](function(_0x18eeb4){logger['info'](_0x2f7e('0xe'),_0x33aa1d,_0x2f7e('0xf'));logger['debug'](_0x2f7e('0x10'),_0x33aa1d,_0x2f7e('0xf'),JSON[_0x2f7e('0x11')](_0x18eeb4));if(_0x18eeb4[_0x2f7e('0x12')]){if(_0x18eeb4[_0x2f7e('0x12')][_0x2f7e('0x13')]===0x1f4){logger[_0x2f7e('0x12')](_0x2f7e('0xe'),_0x33aa1d,_0x18eeb4['error']['message']);return _0x2e52a2(_0x18eeb4[_0x2f7e('0x12')]['message']);}logger[_0x2f7e('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x33aa1d,_0x18eeb4[_0x2f7e('0x12')][_0x2f7e('0x14')]);return _0x3d9396(_0x18eeb4['error'][_0x2f7e('0x14')]);}else{logger[_0x2f7e('0x15')](_0x2f7e('0xe'),_0x33aa1d,_0x2f7e('0xf'));_0x3d9396(_0x18eeb4[_0x2f7e('0x16')][_0x2f7e('0x14')]);}})[_0x2f7e('0x17')](function(_0x3a066a){logger[_0x2f7e('0x12')](_0x2f7e('0xe'),_0x33aa1d,_0x3a066a);_0x2e52a2(_0x3a066a);});});}exports['CreateChatQueueReport']=function(_0x4a0ff8){var _0x2c30ea=this;return new Promise(function(_0x19b909,_0x3ee08a){return db[_0x2f7e('0x18')]['create'](_0x4a0ff8[_0x2f7e('0x19')],{'raw':_0x4a0ff8['options']?_0x4a0ff8['options']['raw']===undefined?!![]:![]:!![]})[_0x2f7e('0xd')](function(_0x1b60ad){logger[_0x2f7e('0x15')](_0x2f7e('0x1a'),_0x4a0ff8);logger[_0x2f7e('0x1b')](_0x2f7e('0x1a'),_0x4a0ff8,JSON['stringify'](_0x1b60ad));_0x19b909(_0x1b60ad);})['catch'](function(_0x5dbce6){logger['error'](_0x2f7e('0x1a'),_0x5dbce6[_0x2f7e('0x14')],_0x4a0ff8);_0x3ee08a(_0x2c30ea[_0x2f7e('0x12')](0x1f4,_0x5dbce6[_0x2f7e('0x14')]));});});};exports[_0x2f7e('0x1c')]=function(_0x380176){var _0xe29a6=this;return new Promise(function(_0x283efa,_0x59bbc1){return db[_0x2f7e('0x18')]['update'](_0x380176[_0x2f7e('0x19')],{'raw':_0x380176[_0x2f7e('0x1d')]?_0x380176[_0x2f7e('0x1d')][_0x2f7e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x380176[_0x2f7e('0x1d')]?_0x380176[_0x2f7e('0x1d')]['where']||null:null,'attributes':_0x380176['options']?_0x380176[_0x2f7e('0x1d')][_0x2f7e('0x1f')]||null:null,'limit':_0x380176[_0x2f7e('0x1d')]?_0x380176[_0x2f7e('0x1d')]['limit']||null:null})[_0x2f7e('0xd')](function(_0x489bbf){logger[_0x2f7e('0x15')](_0x2f7e('0x1c'),_0x380176);logger['debug']('UpdateChatQueueReport',_0x380176,JSON[_0x2f7e('0x11')](_0x489bbf));_0x283efa(_0x489bbf);})[_0x2f7e('0x17')](function(_0x50b9a0){logger[_0x2f7e('0x12')](_0x2f7e('0x1c'),_0x50b9a0[_0x2f7e('0x14')],_0x380176);_0x59bbc1(_0xe29a6[_0x2f7e('0x12')](0x1f4,_0x50b9a0[_0x2f7e('0x14')]));});});}; \ No newline at end of file +var _0x8727=['CreateChatQueueReport','ChatQueueReport','create','body','options','raw','stringify','catch','UpdateChatQueueReport','update','where','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x155c64,_0x26ff95){var _0x1f154a=function(_0xbc46e4){while(--_0xbc46e4){_0x155c64['push'](_0x155c64['shift']());}};_0x1f154a(++_0x26ff95);}(_0x8727,0x8c));var _0x7872=function(_0xa58a3e,_0x115109){_0xa58a3e=_0xa58a3e-0x0;var _0x4f6cd2=_0x8727[_0xa58a3e];return _0x4f6cd2;};'use strict';var _=require('lodash');var util=require(_0x7872('0x0'));var moment=require(_0x7872('0x1'));var BPromise=require(_0x7872('0x2'));var rs=require(_0x7872('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7872('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7872('0x5'))(_0x7872('0x6'));var config=require(_0x7872('0x7'));var jayson=require(_0x7872('0x8'));var client=jayson['client'][_0x7872('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x130bbf,_0xba7c24,_0x47b40e){return new BPromise(function(_0x12f9bb,_0x2e42e4){return client['request'](_0x130bbf,_0x47b40e)[_0x7872('0xa')](function(_0x1c6983){logger[_0x7872('0xb')](_0x7872('0xc'),_0xba7c24,_0x7872('0xd'));logger[_0x7872('0xe')](_0x7872('0xf'),_0xba7c24,_0x7872('0xd'),JSON['stringify'](_0x1c6983));if(_0x1c6983[_0x7872('0x10')]){if(_0x1c6983[_0x7872('0x10')][_0x7872('0x11')]===0x1f4){logger['error'](_0x7872('0xc'),_0xba7c24,_0x1c6983[_0x7872('0x10')][_0x7872('0x12')]);return _0x2e42e4(_0x1c6983[_0x7872('0x10')][_0x7872('0x12')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0xba7c24,_0x1c6983[_0x7872('0x10')][_0x7872('0x12')]);return _0x12f9bb(_0x1c6983['error'][_0x7872('0x12')]);}else{logger[_0x7872('0xb')]('ChatQueueReport,\x20%s,\x20%s',_0xba7c24,_0x7872('0xd'));_0x12f9bb(_0x1c6983[_0x7872('0x13')][_0x7872('0x12')]);}})['catch'](function(_0xa26208){logger['error'](_0x7872('0xc'),_0xba7c24,_0xa26208);_0x2e42e4(_0xa26208);});});}exports[_0x7872('0x14')]=function(_0x438afb){var _0x5c96c9=this;return new Promise(function(_0x4a7c68,_0x5cfd4f){return db[_0x7872('0x15')][_0x7872('0x16')](_0x438afb[_0x7872('0x17')],{'raw':_0x438afb[_0x7872('0x18')]?_0x438afb[_0x7872('0x18')][_0x7872('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xce0414){logger[_0x7872('0xb')](_0x7872('0x14'),_0x438afb);logger['debug'](_0x7872('0x14'),_0x438afb,JSON[_0x7872('0x1a')](_0xce0414));_0x4a7c68(_0xce0414);})[_0x7872('0x1b')](function(_0x38c97d){logger[_0x7872('0x10')]('CreateChatQueueReport',_0x38c97d['message'],_0x438afb);_0x5cfd4f(_0x5c96c9['error'](0x1f4,_0x38c97d[_0x7872('0x12')]));});});};exports[_0x7872('0x1c')]=function(_0x59638d){var _0x223fa3=this;return new Promise(function(_0x534ef5,_0x369966){return db[_0x7872('0x15')][_0x7872('0x1d')](_0x59638d[_0x7872('0x17')],{'raw':_0x59638d[_0x7872('0x18')]?_0x59638d[_0x7872('0x18')][_0x7872('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59638d[_0x7872('0x18')]?_0x59638d[_0x7872('0x18')][_0x7872('0x1e')]||null:null,'attributes':_0x59638d[_0x7872('0x18')]?_0x59638d[_0x7872('0x18')]['attributes']||null:null,'limit':_0x59638d[_0x7872('0x18')]?_0x59638d['options'][_0x7872('0x1f')]||null:null})[_0x7872('0xa')](function(_0x47a0d4){logger[_0x7872('0xb')](_0x7872('0x1c'),_0x59638d);logger[_0x7872('0xe')](_0x7872('0x1c'),_0x59638d,JSON[_0x7872('0x1a')](_0x47a0d4));_0x534ef5(_0x47a0d4);})['catch'](function(_0xcf13f8){logger[_0x7872('0x10')]('UpdateChatQueueReport',_0xcf13f8[_0x7872('0x12')],_0x59638d);_0x369966(_0x223fa3['error'](0x1f4,_0xcf13f8['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 2ab7e65..2d37667 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 _0x2875=['/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated'];(function(_0x5cc49e,_0x571829){var _0x5071f4=function(_0xdc5b79){while(--_0xdc5b79){_0x5cc49e['push'](_0x5cc49e['shift']());}};_0x5071f4(++_0x571829);}(_0x2875,0x11e));var _0x5287=function(_0x5f0995,_0x207d8c){_0x5f0995=_0x5f0995-0x0;var _0x2e0334=_0x2875[_0x5f0995];return _0x2e0334;};'use strict';var multer=require(_0x5287('0x0'));var util=require(_0x5287('0x1'));var path=require(_0x5287('0x2'));var timeout=require(_0x5287('0x3'));var express=require(_0x5287('0x4'));var router=express[_0x5287('0x5')]();var fs_extra=require(_0x5287('0x6'));var auth=require(_0x5287('0x7'));var interaction=require(_0x5287('0x8'));var config=require(_0x5287('0x9'));var controller=require('./chatQueueReport.controller');router[_0x5287('0xa')]('/',auth['isAuthenticated'](),controller[_0x5287('0xb')]);router[_0x5287('0xa')](_0x5287('0xc'),auth[_0x5287('0xd')](),controller['describe']);router[_0x5287('0xa')](_0x5287('0xe'),auth[_0x5287('0xd')](),controller['show']);router[_0x5287('0xf')]('/',auth['isAuthenticated'](),controller[_0x5287('0x10')]);router['put'](_0x5287('0xe'),auth[_0x5287('0xd')](),controller['update']);router[_0x5287('0x11')](_0x5287('0xe'),auth[_0x5287('0xd')](),controller[_0x5287('0x12')]);module[_0x5287('0x13')]=router; \ No newline at end of file +var _0x94c3=['describe','/:id','post','create','put','update','delete','exports','util','path','express','fs-extra','../../components/interaction/service','./chatQueueReport.controller','get','isAuthenticated','index'];(function(_0x3be333,_0x1b4d22){var _0x24670c=function(_0x412883){while(--_0x412883){_0x3be333['push'](_0x3be333['shift']());}};_0x24670c(++_0x1b4d22);}(_0x94c3,0x1d3));var _0x394c=function(_0x2ecbd9,_0x247e5f){_0x2ecbd9=_0x2ecbd9-0x0;var _0x49a198=_0x94c3[_0x2ecbd9];return _0x49a198;};'use strict';var multer=require('multer');var util=require(_0x394c('0x0'));var path=require(_0x394c('0x1'));var timeout=require('connect-timeout');var express=require(_0x394c('0x2'));var router=express['Router']();var fs_extra=require(_0x394c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x394c('0x4'));var config=require('../../config/environment');var controller=require(_0x394c('0x5'));router[_0x394c('0x6')]('/',auth[_0x394c('0x7')](),controller[_0x394c('0x8')]);router[_0x394c('0x6')]('/describe',auth[_0x394c('0x7')](),controller[_0x394c('0x9')]);router[_0x394c('0x6')](_0x394c('0xa'),auth[_0x394c('0x7')](),controller['show']);router[_0x394c('0xb')]('/',auth['isAuthenticated'](),controller[_0x394c('0xc')]);router[_0x394c('0xd')]('/:id',auth[_0x394c('0x7')](),controller[_0x394c('0xe')]);router[_0x394c('0xf')](_0x394c('0xa'),auth[_0x394c('0x7')](),controller['destroy']);module[_0x394c('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 4041d7e..102d37b 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x53273a,_0x5ed978){var _0x3c41db=function(_0x491a57){while(--_0x491a57){_0x53273a['push'](_0x53273a['shift']());}};_0x3c41db(++_0x5ed978);}(_0x008c,0x188));var _0xc008=function(_0x7b484,_0x195ad4){_0x7b484=_0x7b484-0x0;var _0x2ae1cf=_0x008c[_0x7b484];return _0x2ae1cf;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x3c0569,_0x11da9f){var _0x142524=function(_0x59a41e){while(--_0x59a41e){_0x3c0569['push'](_0x3c0569['shift']());}};_0x142524(++_0x11da9f);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 1b0aa9f..3bbdc12 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 _0xfe0a=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','ChatTransferReport','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','include','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs'];(function(_0x34d0a4,_0x217ff4){var _0x350ae3=function(_0x2834af){while(--_0x2834af){_0x34d0a4['push'](_0x34d0a4['shift']());}};_0x350ae3(++_0x217ff4);}(_0xfe0a,0x10c));var _0xafe0=function(_0x14f21c,_0x315b28){_0x14f21c=_0x14f21c-0x0;var _0x2b509b=_0xfe0a[_0x14f21c];return _0x2b509b;};'use strict';var emlformat=require(_0xafe0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xafe0('0x1'));var jsonpatch=require(_0xafe0('0x2'));var rp=require(_0xafe0('0x3'));var moment=require('moment');var BPromise=require(_0xafe0('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xafe0('0x5'));var sox=require(_0xafe0('0x6'));var csv=require(_0xafe0('0x7'));var ejs=require(_0xafe0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xafe0('0x9'));var crypto=require(_0xafe0('0xa'));var jsforce=require(_0xafe0('0xb'));var deskjs=require(_0xafe0('0xc'));var toCsv=require('to-csv');var querystring=require(_0xafe0('0xd'));var Papa=require('papaparse');var Redis=require(_0xafe0('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xafe0('0xf'));var as=require(_0xafe0('0x10'));var hardwareService=require(_0xafe0('0x11'));var logger=require(_0xafe0('0x12'))(_0xafe0('0x13'));var utils=require(_0xafe0('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xafe0('0x15'));var db=require(_0xafe0('0x16'))['db'];function respondWithStatusCode(_0x116610,_0x3669d1){_0x3669d1=_0x3669d1||0xcc;return function(_0x4865a4){if(_0x4865a4){return _0x116610[_0xafe0('0x17')](_0x3669d1);}return _0x116610[_0xafe0('0x18')](_0x3669d1)['end']();};}function respondWithResult(_0xd54083,_0x7ae7b9){_0x7ae7b9=_0x7ae7b9||0xc8;return function(_0xcc1418){if(_0xcc1418){return _0xd54083[_0xafe0('0x18')](_0x7ae7b9)[_0xafe0('0x19')](_0xcc1418);}};}function respondWithFilteredResult(_0x80450a,_0x3d950e){return function(_0x18e506){if(_0x18e506){var _0x13e4a5=typeof _0x3d950e[_0xafe0('0x1a')]==='undefined'&&typeof _0x3d950e['limit']===_0xafe0('0x1b');var _0x158138=_0x18e506[_0xafe0('0x1c')];var _0xbc2b87=_0x13e4a5?0x0:_0x3d950e['offset'];var _0x281d1a=_0x13e4a5?_0x18e506['count']:_0x3d950e['offset']+_0x3d950e[_0xafe0('0x1d')];var _0x2b87a7;if(_0x281d1a>=_0x158138){_0x281d1a=_0x158138;_0x2b87a7=0xc8;}else{_0x2b87a7=0xce;}_0x80450a[_0xafe0('0x18')](_0x2b87a7);return _0x80450a['set'](_0xafe0('0x1e'),_0xbc2b87+'-'+_0x281d1a+'/'+_0x158138)[_0xafe0('0x19')](_0x18e506);}return null;};}function patchUpdates(_0x41fc65){return function(_0x2c5d98){try{jsonpatch[_0xafe0('0x1f')](_0x2c5d98,_0x41fc65,!![]);}catch(_0xe33b77){return BPromise[_0xafe0('0x20')](_0xe33b77);}return _0x2c5d98[_0xafe0('0x21')]();};}function saveUpdates(_0x40258a,_0x9e20ae){return function(_0x4375cc){if(_0x4375cc){return _0x4375cc[_0xafe0('0x22')](_0x40258a)[_0xafe0('0x23')](function(_0xe25448){return _0xe25448;});}return null;};}function removeEntity(_0x25d757,_0x519ffb){return function(_0x30ea39){if(_0x30ea39){return _0x30ea39[_0xafe0('0x24')]()['then'](function(){_0x25d757[_0xafe0('0x18')](0xcc)[_0xafe0('0x25')]();});}};}function handleEntityNotFound(_0x44f306,_0x558ea8){return function(_0x402bbf){if(!_0x402bbf){_0x44f306['sendStatus'](0x194);}return _0x402bbf;};}function handleError(_0xdb18,_0x8b897b){_0x8b897b=_0x8b897b||0x1f4;return function(_0x2bc23a){logger[_0xafe0('0x26')](_0x2bc23a[_0xafe0('0x27')]);if(_0x2bc23a[_0xafe0('0x28')]){delete _0x2bc23a[_0xafe0('0x28')];}_0xdb18[_0xafe0('0x18')](_0x8b897b)[_0xafe0('0x29')](_0x2bc23a);};}exports['index']=function(_0x28c58a,_0x36d600){var _0x214912={},_0x3ab9ed={},_0x29fa50={'count':0x0,'rows':[]};var _0xa41a24=_[_0xafe0('0x2a')](db[_0xafe0('0x2b')]['rawAttributes'],function(_0x383bd5){return{'name':_0x383bd5['fieldName'],'type':_0x383bd5[_0xafe0('0x2c')]['key']};});_0x3ab9ed[_0xafe0('0x2d')]=_['map'](_0xa41a24,_0xafe0('0x28'));_0x3ab9ed[_0xafe0('0x2e')]=_[_0xafe0('0x2f')](_0x28c58a['query']);_0x3ab9ed['filters']=_[_0xafe0('0x30')](_0x3ab9ed[_0xafe0('0x2d')],_0x3ab9ed[_0xafe0('0x2e')]);_0x214912[_0xafe0('0x31')]=_[_0xafe0('0x30')](_0x3ab9ed['model'],qs['fields'](_0x28c58a[_0xafe0('0x2e')][_0xafe0('0x32')]));_0x214912[_0xafe0('0x31')]=_0x214912['attributes']['length']?_0x214912[_0xafe0('0x31')]:_0x3ab9ed['model'];if(!_0x28c58a[_0xafe0('0x2e')][_0xafe0('0x33')]('nolimit')){_0x214912[_0xafe0('0x1d')]=qs[_0xafe0('0x1d')](_0x28c58a[_0xafe0('0x2e')][_0xafe0('0x1d')]);_0x214912[_0xafe0('0x1a')]=qs[_0xafe0('0x1a')](_0x28c58a[_0xafe0('0x2e')][_0xafe0('0x1a')]);}_0x214912['order']=qs[_0xafe0('0x34')](_0x28c58a[_0xafe0('0x2e')][_0xafe0('0x34')]);_0x214912[_0xafe0('0x35')]=qs[_0xafe0('0x36')](_[_0xafe0('0x37')](_0x28c58a['query'],_0x3ab9ed[_0xafe0('0x36')]),_0xa41a24);if(_0x28c58a['query'][_0xafe0('0x38')]){_0x214912['where']=_[_0xafe0('0x39')](_0x214912[_0xafe0('0x35')],{'$or':_[_0xafe0('0x2a')](_0xa41a24,function(_0x4acdc9){if(_0x4acdc9['type']!==_0xafe0('0x3a')){var _0xbd73fb={};_0xbd73fb[_0x4acdc9[_0xafe0('0x28')]]={'$like':'%'+_0x28c58a[_0xafe0('0x2e')]['filter']+'%'};return _0xbd73fb;}})});}_0x214912=_[_0xafe0('0x39')]({},_0x214912,_0x28c58a[_0xafe0('0x3b')]);var _0x2488f3={'where':_0x214912['where']};return db[_0xafe0('0x2b')]['count'](_0x2488f3)[_0xafe0('0x23')](function(_0x132907){_0x29fa50['count']=_0x132907;if(_0x28c58a['query'][_0xafe0('0x3c')]){_0x214912['include']=[{'all':!![]}];}return db[_0xafe0('0x2b')][_0xafe0('0x3d')](_0x214912);})[_0xafe0('0x23')](function(_0x12f590){_0x29fa50[_0xafe0('0x3e')]=_0x12f590;return _0x29fa50;})[_0xafe0('0x23')](respondWithFilteredResult(_0x36d600,_0x214912))[_0xafe0('0x3f')](handleError(_0x36d600,null));};exports[_0xafe0('0x40')]=function(_0x206d79,_0x19d5b2){var _0x2a267a={'raw':!![],'where':{'id':_0x206d79['params']['id']}},_0x4e21e7={};_0x4e21e7[_0xafe0('0x2d')]=_['keys'](db[_0xafe0('0x2b')][_0xafe0('0x41')]);_0x4e21e7[_0xafe0('0x2e')]=_[_0xafe0('0x2f')](_0x206d79['query']);_0x4e21e7[_0xafe0('0x36')]=_[_0xafe0('0x30')](_0x4e21e7[_0xafe0('0x2d')],_0x4e21e7[_0xafe0('0x2e')]);_0x2a267a[_0xafe0('0x31')]=_['intersection'](_0x4e21e7[_0xafe0('0x2d')],qs[_0xafe0('0x32')](_0x206d79['query']['fields']));_0x2a267a[_0xafe0('0x31')]=_0x2a267a['attributes']['length']?_0x2a267a[_0xafe0('0x31')]:_0x4e21e7[_0xafe0('0x2d')];if(_0x206d79[_0xafe0('0x2e')][_0xafe0('0x3c')]){_0x2a267a[_0xafe0('0x42')]=[{'all':!![]}];}_0x2a267a=_['merge']({},_0x2a267a,_0x206d79[_0xafe0('0x3b')]);return db['ChatTransferReport'][_0xafe0('0x43')](_0x2a267a)[_0xafe0('0x23')](handleEntityNotFound(_0x19d5b2,null))['then'](respondWithResult(_0x19d5b2,null))[_0xafe0('0x3f')](handleError(_0x19d5b2,null));};exports[_0xafe0('0x44')]=function(_0xd82b5,_0x597ee7){return db['ChatTransferReport'][_0xafe0('0x44')](_0xd82b5['body'],{})[_0xafe0('0x23')](respondWithResult(_0x597ee7,0xc9))['catch'](handleError(_0x597ee7,null));};exports[_0xafe0('0x22')]=function(_0x1eae0c,_0xd5923){if(_0x1eae0c['body']['id']){delete _0x1eae0c[_0xafe0('0x45')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x1eae0c[_0xafe0('0x46')]['id']}})['then'](handleEntityNotFound(_0xd5923,null))[_0xafe0('0x23')](saveUpdates(_0x1eae0c[_0xafe0('0x45')],null))[_0xafe0('0x23')](respondWithResult(_0xd5923,null))[_0xafe0('0x3f')](handleError(_0xd5923,null));};exports[_0xafe0('0x24')]=function(_0x3ffc06,_0x21c629){return db['ChatTransferReport'][_0xafe0('0x43')]({'where':{'id':_0x3ffc06[_0xafe0('0x46')]['id']}})['then'](handleEntityNotFound(_0x21c629,null))[_0xafe0('0x23')](removeEntity(_0x21c629,null))[_0xafe0('0x3f')](handleError(_0x21c629,null));};exports['describe']=function(_0x163f71,_0x139352){return db[_0xafe0('0x2b')]['describe']()[_0xafe0('0x23')](respondWithResult(_0x139352,null))[_0xafe0('0x3f')](handleError(_0x139352,null));}; \ No newline at end of file +var _0x52f6=['model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','body','destroy','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','end','error','stack','name','send','index','ChatTransferReport','fieldName','type','key'];(function(_0x38fbc2,_0x54f822){var _0x2ae767=function(_0x172113){while(--_0x172113){_0x38fbc2['push'](_0x38fbc2['shift']());}};_0x2ae767(++_0x54f822);}(_0x52f6,0xf8));var _0x652f=function(_0x441e5d,_0x204cd9){_0x441e5d=_0x441e5d-0x0;var _0x251a60=_0x52f6[_0x441e5d];return _0x251a60;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x652f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x652f('0x1'));var rp=require(_0x652f('0x2'));var moment=require(_0x652f('0x3'));var BPromise=require(_0x652f('0x4'));var Mustache=require('mustache');var util=require(_0x652f('0x5'));var path=require(_0x652f('0x6'));var sox=require(_0x652f('0x7'));var csv=require('to-csv');var ejs=require(_0x652f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x652f('0x9'));var squel=require(_0x652f('0xa'));var crypto=require(_0x652f('0xb'));var jsforce=require(_0x652f('0xc'));var deskjs=require(_0x652f('0xd'));var toCsv=require(_0x652f('0xe'));var querystring=require(_0x652f('0xf'));var Papa=require(_0x652f('0x10'));var Redis=require(_0x652f('0x11'));var authService=require(_0x652f('0x12'));var qs=require(_0x652f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x652f('0x14'));var logger=require(_0x652f('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x652f('0x16'));var licenseUtil=require(_0x652f('0x17'));var db=require(_0x652f('0x18'))['db'];function respondWithStatusCode(_0x1aad4b,_0x219f5b){_0x219f5b=_0x219f5b||0xcc;return function(_0xe1da3d){if(_0xe1da3d){return _0x1aad4b[_0x652f('0x19')](_0x219f5b);}return _0x1aad4b[_0x652f('0x1a')](_0x219f5b)['end']();};}function respondWithResult(_0x5be48d,_0xe408eb){_0xe408eb=_0xe408eb||0xc8;return function(_0x5396ce){if(_0x5396ce){return _0x5be48d['status'](_0xe408eb)[_0x652f('0x1b')](_0x5396ce);}};}function respondWithFilteredResult(_0x116723,_0x7aaaed){return function(_0x373591){if(_0x373591){var _0x46aa25=typeof _0x7aaaed[_0x652f('0x1c')]===_0x652f('0x1d')&&typeof _0x7aaaed['limit']===_0x652f('0x1d');var _0x5e2fd4=_0x373591[_0x652f('0x1e')];var _0x13b7be=_0x46aa25?0x0:_0x7aaaed[_0x652f('0x1c')];var _0xefff7c=_0x46aa25?_0x373591[_0x652f('0x1e')]:_0x7aaaed[_0x652f('0x1c')]+_0x7aaaed[_0x652f('0x1f')];var _0x5adea7;if(_0xefff7c>=_0x5e2fd4){_0xefff7c=_0x5e2fd4;_0x5adea7=0xc8;}else{_0x5adea7=0xce;}_0x116723[_0x652f('0x1a')](_0x5adea7);return _0x116723[_0x652f('0x20')](_0x652f('0x21'),_0x13b7be+'-'+_0xefff7c+'/'+_0x5e2fd4)['json'](_0x373591);}return null;};}function patchUpdates(_0x653fe3){return function(_0x267b54){try{jsonpatch['apply'](_0x267b54,_0x653fe3,!![]);}catch(_0x55a85a){return BPromise[_0x652f('0x22')](_0x55a85a);}return _0x267b54[_0x652f('0x23')]();};}function saveUpdates(_0x5b3fe2,_0x534be3){return function(_0x374507){if(_0x374507){return _0x374507[_0x652f('0x24')](_0x5b3fe2)[_0x652f('0x25')](function(_0x3b9cb7){return _0x3b9cb7;});}return null;};}function removeEntity(_0x5b5f62,_0x5947e2){return function(_0x2d401d){if(_0x2d401d){return _0x2d401d['destroy']()[_0x652f('0x25')](function(){_0x5b5f62[_0x652f('0x1a')](0xcc)[_0x652f('0x26')]();});}};}function handleEntityNotFound(_0x304e80,_0x44f363){return function(_0xaa6ae6){if(!_0xaa6ae6){_0x304e80['sendStatus'](0x194);}return _0xaa6ae6;};}function handleError(_0xaba730,_0x54e89d){_0x54e89d=_0x54e89d||0x1f4;return function(_0x4e2d5f){logger[_0x652f('0x27')](_0x4e2d5f[_0x652f('0x28')]);if(_0x4e2d5f['name']){delete _0x4e2d5f[_0x652f('0x29')];}_0xaba730['status'](_0x54e89d)[_0x652f('0x2a')](_0x4e2d5f);};}exports[_0x652f('0x2b')]=function(_0x72ae35,_0x2b989f){var _0x2635d7={},_0x326a21={},_0x280de4={'count':0x0,'rows':[]};var _0x5af914=_['map'](db[_0x652f('0x2c')]['rawAttributes'],function(_0x208a36){return{'name':_0x208a36[_0x652f('0x2d')],'type':_0x208a36[_0x652f('0x2e')][_0x652f('0x2f')]};});_0x326a21[_0x652f('0x30')]=_[_0x652f('0x31')](_0x5af914,_0x652f('0x29'));_0x326a21[_0x652f('0x32')]=_[_0x652f('0x33')](_0x72ae35[_0x652f('0x32')]);_0x326a21[_0x652f('0x34')]=_[_0x652f('0x35')](_0x326a21['model'],_0x326a21[_0x652f('0x32')]);_0x2635d7[_0x652f('0x36')]=_['intersection'](_0x326a21[_0x652f('0x30')],qs[_0x652f('0x37')](_0x72ae35['query'][_0x652f('0x37')]));_0x2635d7[_0x652f('0x36')]=_0x2635d7[_0x652f('0x36')][_0x652f('0x38')]?_0x2635d7[_0x652f('0x36')]:_0x326a21[_0x652f('0x30')];if(!_0x72ae35['query']['hasOwnProperty'](_0x652f('0x39'))){_0x2635d7['limit']=qs[_0x652f('0x1f')](_0x72ae35[_0x652f('0x32')][_0x652f('0x1f')]);_0x2635d7[_0x652f('0x1c')]=qs[_0x652f('0x1c')](_0x72ae35['query'][_0x652f('0x1c')]);}_0x2635d7[_0x652f('0x3a')]=qs['sort'](_0x72ae35[_0x652f('0x32')]['sort']);_0x2635d7[_0x652f('0x3b')]=qs[_0x652f('0x34')](_[_0x652f('0x3c')](_0x72ae35[_0x652f('0x32')],_0x326a21[_0x652f('0x34')]),_0x5af914);if(_0x72ae35[_0x652f('0x32')][_0x652f('0x3d')]){_0x2635d7[_0x652f('0x3b')]=_['merge'](_0x2635d7[_0x652f('0x3b')],{'$or':_['map'](_0x5af914,function(_0x42104e){if(_0x42104e[_0x652f('0x2e')]!==_0x652f('0x3e')){var _0x2cf9c4={};_0x2cf9c4[_0x42104e[_0x652f('0x29')]]={'$like':'%'+_0x72ae35[_0x652f('0x32')][_0x652f('0x3d')]+'%'};return _0x2cf9c4;}})});}_0x2635d7=_['merge']({},_0x2635d7,_0x72ae35[_0x652f('0x3f')]);var _0x2e38ce={'where':_0x2635d7[_0x652f('0x3b')]};return db[_0x652f('0x2c')][_0x652f('0x1e')](_0x2e38ce)[_0x652f('0x25')](function(_0x580e05){_0x280de4[_0x652f('0x1e')]=_0x580e05;if(_0x72ae35['query'][_0x652f('0x40')]){_0x2635d7[_0x652f('0x41')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0x2635d7);})[_0x652f('0x25')](function(_0x1b4965){_0x280de4[_0x652f('0x42')]=_0x1b4965;return _0x280de4;})[_0x652f('0x25')](respondWithFilteredResult(_0x2b989f,_0x2635d7))[_0x652f('0x43')](handleError(_0x2b989f,null));};exports[_0x652f('0x44')]=function(_0x51785e,_0x14bb29){var _0x1a8480={'raw':!![],'where':{'id':_0x51785e[_0x652f('0x45')]['id']}},_0x5a7d46={};_0x5a7d46[_0x652f('0x30')]=_[_0x652f('0x33')](db['ChatTransferReport']['rawAttributes']);_0x5a7d46[_0x652f('0x32')]=_[_0x652f('0x33')](_0x51785e['query']);_0x5a7d46[_0x652f('0x34')]=_[_0x652f('0x35')](_0x5a7d46[_0x652f('0x30')],_0x5a7d46['query']);_0x1a8480[_0x652f('0x36')]=_[_0x652f('0x35')](_0x5a7d46[_0x652f('0x30')],qs['fields'](_0x51785e['query'][_0x652f('0x37')]));_0x1a8480['attributes']=_0x1a8480[_0x652f('0x36')][_0x652f('0x38')]?_0x1a8480[_0x652f('0x36')]:_0x5a7d46[_0x652f('0x30')];if(_0x51785e[_0x652f('0x32')][_0x652f('0x40')]){_0x1a8480[_0x652f('0x41')]=[{'all':!![]}];}_0x1a8480=_['merge']({},_0x1a8480,_0x51785e['options']);return db[_0x652f('0x2c')][_0x652f('0x46')](_0x1a8480)['then'](handleEntityNotFound(_0x14bb29,null))[_0x652f('0x25')](respondWithResult(_0x14bb29,null))[_0x652f('0x43')](handleError(_0x14bb29,null));};exports['create']=function(_0x33f806,_0x333dea){return db['ChatTransferReport']['create'](_0x33f806['body'],{})[_0x652f('0x25')](respondWithResult(_0x333dea,0xc9))[_0x652f('0x43')](handleError(_0x333dea,null));};exports[_0x652f('0x24')]=function(_0x46e91e,_0x5d22aa){if(_0x46e91e[_0x652f('0x47')]['id']){delete _0x46e91e[_0x652f('0x47')]['id'];}return db['ChatTransferReport'][_0x652f('0x46')]({'where':{'id':_0x46e91e[_0x652f('0x45')]['id']}})['then'](handleEntityNotFound(_0x5d22aa,null))[_0x652f('0x25')](saveUpdates(_0x46e91e[_0x652f('0x47')],null))[_0x652f('0x25')](respondWithResult(_0x5d22aa,null))[_0x652f('0x43')](handleError(_0x5d22aa,null));};exports[_0x652f('0x48')]=function(_0x2d8d3c,_0x1fefe3){return db[_0x652f('0x2c')][_0x652f('0x46')]({'where':{'id':_0x2d8d3c[_0x652f('0x45')]['id']}})[_0x652f('0x25')](handleEntityNotFound(_0x1fefe3,null))[_0x652f('0x25')](removeEntity(_0x1fefe3,null))[_0x652f('0x43')](handleError(_0x1fefe3,null));};exports[_0x652f('0x49')]=function(_0x356eeb,_0x52ea10){return db['ChatTransferReport'][_0x652f('0x49')]()[_0x652f('0x25')](respondWithResult(_0x52ea10,null))['catch'](handleError(_0x52ea10,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index daade68..493e5fd 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 _0xc339=['./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x695b76,_0x551526){var _0x1dc21f=function(_0x5fdb1c){while(--_0x5fdb1c){_0x695b76['push'](_0x695b76['shift']());}};_0x1dc21f(++_0x551526);}(_0xc339,0xae));var _0x9c33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc339[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9c33('0x0'));var util=require(_0x9c33('0x1'));var logger=require(_0x9c33('0x2'))(_0x9c33('0x3'));var moment=require('moment');var BPromise=require(_0x9c33('0x4'));var rp=require(_0x9c33('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9c33('0x6'));var config=require(_0x9c33('0x7'));var attributes=require(_0x9c33('0x8'));module[_0x9c33('0x9')]=function(_0xaf8460,_0xd6da0b){return _0xaf8460[_0x9c33('0xa')](_0x9c33('0xb'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x9c33('0xc'),'fields':[_0x9c33('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa0bf=['./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x250332,_0x40ff3e){var _0xe47c67=function(_0xd79430){while(--_0xd79430){_0x250332['push'](_0x250332['shift']());}};_0xe47c67(++_0x40ff3e);}(_0xa0bf,0x7e));var _0xfa0b=function(_0x57a1b4,_0x4e0e05){_0x57a1b4=_0x57a1b4-0x0;var _0xb9803a=_0xa0bf[_0x57a1b4];return _0xb9803a;};'use strict';var _=require(_0xfa0b('0x0'));var util=require(_0xfa0b('0x1'));var logger=require('../../config/logger')(_0xfa0b('0x2'));var moment=require(_0xfa0b('0x3'));var BPromise=require(_0xfa0b('0x4'));var rp=require(_0xfa0b('0x5'));var fs=require('fs');var path=require(_0xfa0b('0x6'));var rimraf=require(_0xfa0b('0x7'));var config=require(_0xfa0b('0x8'));var attributes=require(_0xfa0b('0x9'));module[_0xfa0b('0xa')]=function(_0x565397,_0x173733){return _0x565397[_0xfa0b('0xb')](_0xfa0b('0xc'),attributes,{'tableName':_0xfa0b('0xd'),'paranoid':![],'indexes':[{'name':_0xfa0b('0xe'),'fields':[_0xfa0b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index c5650c7..6437ce9 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 _0xd1fe=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x67d4c1,_0x346942){var _0x3ed198=function(_0x166049){while(--_0x166049){_0x67d4c1['push'](_0x67d4c1['shift']());}};_0x3ed198(++_0x346942);}(_0xd1fe,0xdd));var _0xed1f=function(_0x582d5f,_0x2355f1){_0x582d5f=_0x582d5f-0x0;var _0x5ed1b4=_0xd1fe[_0x582d5f];return _0x5ed1b4;};'use strict';var _=require(_0xed1f('0x0'));var util=require(_0xed1f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xed1f('0x2'));var fs=require('fs');var Redis=require(_0xed1f('0x3'));var db=require(_0xed1f('0x4'))['db'];var utils=require(_0xed1f('0x5'));var logger=require('../../config/logger')(_0xed1f('0x6'));var config=require(_0xed1f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xed1f('0x8')][_0xed1f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x792a52,_0x5ef87f,_0x295be6){return new BPromise(function(_0x43c8ff,_0x55ea0b){return client['request'](_0x792a52,_0x295be6)[_0xed1f('0xa')](function(_0x2e100a){logger[_0xed1f('0xb')](_0xed1f('0xc'),_0x5ef87f,_0xed1f('0xd'));logger['debug'](_0xed1f('0xe'),_0x5ef87f,_0xed1f('0xd'),JSON['stringify'](_0x2e100a));if(_0x2e100a['error']){if(_0x2e100a[_0xed1f('0xf')]['code']===0x1f4){logger[_0xed1f('0xf')](_0xed1f('0xc'),_0x5ef87f,_0x2e100a[_0xed1f('0xf')]['message']);return _0x55ea0b(_0x2e100a['error'][_0xed1f('0x10')]);}logger[_0xed1f('0xf')](_0xed1f('0xc'),_0x5ef87f,_0x2e100a[_0xed1f('0xf')][_0xed1f('0x10')]);return _0x43c8ff(_0x2e100a[_0xed1f('0xf')][_0xed1f('0x10')]);}else{logger['info'](_0xed1f('0xc'),_0x5ef87f,_0xed1f('0xd'));_0x43c8ff(_0x2e100a['result'][_0xed1f('0x10')]);}})['catch'](function(_0x4d7b3e){logger[_0xed1f('0xf')](_0xed1f('0xc'),_0x5ef87f,_0x4d7b3e);_0x55ea0b(_0x4d7b3e);});});} \ No newline at end of file +var _0xbdcf=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0x484487,_0x50a709){var _0x20cff2=function(_0x33d1a4){while(--_0x33d1a4){_0x484487['push'](_0x484487['shift']());}};_0x20cff2(++_0x50a709);}(_0xbdcf,0x130));var _0xfbdc=function(_0x37cc0a,_0x2b3a59){_0x37cc0a=_0x37cc0a-0x0;var _0x37a7fe=_0xbdcf[_0x37cc0a];return _0x37a7fe;};'use strict';var _=require(_0xfbdc('0x0'));var util=require('util');var moment=require(_0xfbdc('0x1'));var BPromise=require(_0xfbdc('0x2'));var rs=require(_0xfbdc('0x3'));var fs=require('fs');var Redis=require(_0xfbdc('0x4'));var db=require(_0xfbdc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfbdc('0x6'));var config=require(_0xfbdc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfbdc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c7cb9,_0x129b60,_0x3510aa){return new BPromise(function(_0xee2c43,_0xf2b5d){return client[_0xfbdc('0x9')](_0x2c7cb9,_0x3510aa)['then'](function(_0x970aa1){logger[_0xfbdc('0xa')](_0xfbdc('0xb'),_0x129b60,_0xfbdc('0xc'));logger[_0xfbdc('0xd')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x129b60,_0xfbdc('0xc'),JSON[_0xfbdc('0xe')](_0x970aa1));if(_0x970aa1[_0xfbdc('0xf')]){if(_0x970aa1[_0xfbdc('0xf')][_0xfbdc('0x10')]===0x1f4){logger[_0xfbdc('0xf')](_0xfbdc('0xb'),_0x129b60,_0x970aa1[_0xfbdc('0xf')][_0xfbdc('0x11')]);return _0xf2b5d(_0x970aa1[_0xfbdc('0xf')][_0xfbdc('0x11')]);}logger['error'](_0xfbdc('0xb'),_0x129b60,_0x970aa1[_0xfbdc('0xf')]['message']);return _0xee2c43(_0x970aa1[_0xfbdc('0xf')][_0xfbdc('0x11')]);}else{logger['info'](_0xfbdc('0xb'),_0x129b60,_0xfbdc('0xc'));_0xee2c43(_0x970aa1['result'][_0xfbdc('0x11')]);}})[_0xfbdc('0x12')](function(_0x3ab590){logger[_0xfbdc('0xf')](_0xfbdc('0xb'),_0x129b60,_0x3ab590);_0xf2b5d(_0x3ab590);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 1a559d5..d0b16c2 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 _0xf206=['create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf206,0x89));var _0x6f20=function(_0x51a130,_0x1be49f){_0x51a130=_0x51a130-0x0;var _0x3b3215=_0xf206[_0x51a130];return _0x3b3215;};'use strict';var multer=require(_0x6f20('0x0'));var util=require('util');var path=require(_0x6f20('0x1'));var timeout=require(_0x6f20('0x2'));var express=require(_0x6f20('0x3'));var router=express[_0x6f20('0x4')]();var fs_extra=require(_0x6f20('0x5'));var auth=require(_0x6f20('0x6'));var interaction=require(_0x6f20('0x7'));var config=require('../../config/environment');var controller=require(_0x6f20('0x8'));router['get']('/',auth[_0x6f20('0x9')](),controller[_0x6f20('0xa')]);router[_0x6f20('0xb')](_0x6f20('0xc'),auth['isAuthenticated'](),controller[_0x6f20('0xd')]);router[_0x6f20('0xb')](_0x6f20('0xe'),auth['isAuthenticated'](),controller[_0x6f20('0xf')]);router[_0x6f20('0x10')]('/',auth[_0x6f20('0x9')](),controller[_0x6f20('0x11')]);router[_0x6f20('0x12')](_0x6f20('0xe'),auth[_0x6f20('0x9')](),controller[_0x6f20('0x13')]);router[_0x6f20('0x14')]('/:id',auth[_0x6f20('0x9')](),controller['destroy']);module[_0x6f20('0x15')]=router; \ No newline at end of file +var _0x9b3e=['describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x448422,_0x362248){var _0xcc0afd=function(_0x576b07){while(--_0x576b07){_0x448422['push'](_0x448422['shift']());}};_0xcc0afd(++_0x362248);}(_0x9b3e,0xef));var _0xe9b3=function(_0x1d5013,_0x26c621){_0x1d5013=_0x1d5013-0x0;var _0x2b25e7=_0x9b3e[_0x1d5013];return _0x2b25e7;};'use strict';var multer=require(_0xe9b3('0x0'));var util=require(_0xe9b3('0x1'));var path=require(_0xe9b3('0x2'));var timeout=require(_0xe9b3('0x3'));var express=require(_0xe9b3('0x4'));var router=express[_0xe9b3('0x5')]();var fs_extra=require(_0xe9b3('0x6'));var auth=require(_0xe9b3('0x7'));var interaction=require(_0xe9b3('0x8'));var config=require(_0xe9b3('0x9'));var controller=require('./chatTransferReport.controller');router[_0xe9b3('0xa')]('/',auth[_0xe9b3('0xb')](),controller[_0xe9b3('0xc')]);router[_0xe9b3('0xa')](_0xe9b3('0xd'),auth[_0xe9b3('0xb')](),controller[_0xe9b3('0xe')]);router[_0xe9b3('0xa')](_0xe9b3('0xf'),auth['isAuthenticated'](),controller[_0xe9b3('0x10')]);router[_0xe9b3('0x11')]('/',auth[_0xe9b3('0xb')](),controller[_0xe9b3('0x12')]);router[_0xe9b3('0x13')](_0xe9b3('0xf'),auth[_0xe9b3('0xb')](),controller[_0xe9b3('0x14')]);router[_0xe9b3('0x15')](_0xe9b3('0xf'),auth['isAuthenticated'](),controller[_0xe9b3('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 678c402..1d32879 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 _0x860f=['input','name','text','parse','getDataValue','onlineForm','setDataValue','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','Skip','Feedback','thumb','star','stringify'];(function(_0x4e0a43,_0xd9ba5b){var _0x3f9fd4=function(_0x36d35c){while(--_0x36d35c){_0x4e0a43['push'](_0x4e0a43['shift']());}};_0x3f9fd4(++_0xd9ba5b);}(_0x860f,0x1c7));var _0xf860=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x860f[_0x484e36];return _0xafc85d;};'use strict';var Sequelize=require(_0xf860('0x0'));var rs=require('randomstring');module[_0xf860('0x1')]={'name':{'type':Sequelize[_0xf860('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf860('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xf860('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xf860('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xf860('0x5')},'customerAlias':{'type':Sequelize[_0xf860('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf860('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf860('0x2')],'allowNull':![],'defaultValue':_0xf860('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf860('0x2')],'allowNull':![],'defaultValue':_0xf860('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xf860('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xf860('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xf860('0xa')](_0xf860('0xb'),'squared'),'defaultValue':_0xf860('0xb')},'header_online':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0xc')},'start_chat_button':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0xd')},'offline_chat_button':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0xe')},'header_offline':{'type':Sequelize[_0xf860('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xf860('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf860('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xf860('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xf860('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf860('0x10')]},'closingQuestion':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf860('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0x12')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0x13')},'closingMessage':{'type':Sequelize[_0xf860('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0xe')},'skipMessageButton':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0x14')},'conditionAgreement':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0x15')},'ratingType':{'type':Sequelize[_0xf860('0xa')]('star',_0xf860('0x16')),'defaultValue':_0xf860('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xf860('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xf860('0x18')]({'items':[{'type':_0xf860('0x19'),'variable':null,'config':{'placeholder':_0xf860('0x1a'),'type':_0xf860('0x1b'),'required':!![]},'props':{'title':_0xf860('0x1a'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xf860('0x4'),'type':_0xf860('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0xf860('0x1c')](this[_0xf860('0x1d')](_0xf860('0x1e'))):{};},'set':function(_0x1c679f){return this[_0xf860('0x1f')](_0xf860('0x1e'),JSON[_0xf860('0x18')](_0x1c679f));}},'offlineForm':{'type':Sequelize[_0xf860('0x10')],'defaultValue':function(){return JSON[_0xf860('0x18')]({'items':[{'type':_0xf860('0x19'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xf860('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':'Comments','helpText':_0xf860('0x20')}}],'fromKey':0x0});},'get':function(){return this[_0xf860('0x1d')](_0xf860('0x21'))?JSON[_0xf860('0x1c')](this[_0xf860('0x1d')](_0xf860('0x21'))):{};},'set':function(_0x2ea267){return this['setDataValue']('offlineForm',JSON['stringify'](_0x2ea267));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf860('0x22')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf860('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xf860('0x23')},'waitingMessage':{'type':Sequelize[_0xf860('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0xf860('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xf860('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0xf860('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xf860('0x25')},'skipUnmanaged':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0x14')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xf860('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xf860('0x10')]},'showAgentAvatar':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xf860('0x2')]},'notificationTemplate':{'type':Sequelize[_0xf860('0x10')],'defaultValue':function(){return _0xf860('0x26');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0x27')},'waitForTheAssignedAgent':{'type':Sequelize[_0xf860('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xf860('0x28')},'verticalAlignment':{'type':Sequelize[_0xf860('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0x29')},'defaultTitle':{'type':Sequelize[_0xf860('0x2')]},'customerAvatar':{'type':Sequelize[_0xf860('0x10')]},'showCustomerAvatar':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf860('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf860('0x2')],'allowNull':![],'defaultValue':_0xf860('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf860('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf860('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf860('0x2')],'defaultValue':_0xf860('0x2b')},'systemAvatar':{'type':Sequelize[_0xf860('0x10')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf860('0x8')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![],'comment':_0xf860('0x2c'),'set':function(_0x4a5269){if(!_0x4a5269)this[_0xf860('0x1f')](_0xf860('0x2d'),null);this[_0xf860('0x1f')](_0xf860('0x2e'),_0x4a5269);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xf860('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xf860('0x2')],'defaultValue':function(){return _0xf860('0x2f');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xf860('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf860('0x10')]}}; \ No newline at end of file +var _0x7d6b=['address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','Send','Contact\x20us','Powered\x20by\x20xCALLY','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','thumb','stringify','name','text','onlineForm','parse','setDataValue','TEXT','input','Comments','getDataValue','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','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','STRING'];(function(_0x374735,_0x467847){var _0x26ff88=function(_0x5c877e){while(--_0x5c877e){_0x374735['push'](_0x374735['shift']());}};_0x26ff88(++_0x467847);}(_0x7d6b,0x8e));var _0xb7d6=function(_0xd88aaf,_0x23479a){_0xd88aaf=_0xd88aaf-0x0;var _0x39308e=_0x7d6b[_0xd88aaf];return _0x39308e;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xb7d6('0x0')]={'name':{'type':Sequelize[_0xb7d6('0x1')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb7d6('0x2')},'description':{'type':Sequelize[_0xb7d6('0x1')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xb7d6('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xb7d6('0x3')},'key':{'type':Sequelize[_0xb7d6('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':_0xb7d6('0x4')},'customerAlias':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb7d6('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb7d6('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xb7d6('0x1')],'allowNull':![],'defaultValue':_0xb7d6('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xb7d6('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xb7d6('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xb7d6('0x9')](_0xb7d6('0xa'),_0xb7d6('0xb')),'defaultValue':_0xb7d6('0xa')},'header_online':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':_0xb7d6('0xc')},'header_offline':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':_0xb7d6('0xd')},'download_transcript':{'type':Sequelize[_0xb7d6('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xb7d6('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':_0xb7d6('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xb7d6('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':_0xb7d6('0xf')},'formSubmitFailureMessage':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':_0xb7d6('0x10')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':_0xb7d6('0x11')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xb7d6('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xb7d6('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':_0xb7d6('0x12')},'ratingType':{'type':Sequelize[_0xb7d6('0x9')](_0xb7d6('0x13'),_0xb7d6('0x14')),'defaultValue':_0xb7d6('0x13')},'ratingStarsNumber':{'type':Sequelize[_0xb7d6('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xb7d6('0x15')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xb7d6('0x16'),'type':_0xb7d6('0x17'),'required':!![]},'props':{'title':_0xb7d6('0x16'),'helpText':''}},{'type':'input','props':{'title':_0xb7d6('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xb7d6('0x3'),'type':_0xb7d6('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xb7d6('0x18'))?JSON[_0xb7d6('0x19')](this['getDataValue'](_0xb7d6('0x18'))):{};},'set':function(_0x1348cf){return this[_0xb7d6('0x1a')](_0xb7d6('0x18'),JSON[_0xb7d6('0x15')](_0x1348cf));}},'offlineForm':{'type':Sequelize[_0xb7d6('0x1b')],'defaultValue':function(){return JSON[_0xb7d6('0x15')]({'items':[{'type':_0xb7d6('0x1c'),'props':{'title':_0xb7d6('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xb7d6('0x3'),'type':_0xb7d6('0x3')},'variable':null},{'type':'textarea','config':{'placeholder':_0xb7d6('0x1d')},'props':{'title':_0xb7d6('0x1d'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xb7d6('0x1e')](_0xb7d6('0x1f'))?JSON[_0xb7d6('0x19')](this[_0xb7d6('0x1e')](_0xb7d6('0x1f'))):{};},'set':function(_0x4f2d7c){return this[_0xb7d6('0x1a')](_0xb7d6('0x1f'),JSON[_0xb7d6('0x15')](_0x4f2d7c));}},'token':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xb7d6('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xb7d6('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xb7d6('0x1')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xb7d6('0x1')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xb7d6('0x20')},'waitingMessage':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':_0xb7d6('0x21')},'offlineMessageSubject':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':_0xb7d6('0x22')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xb7d6('0x23')},'enableUnmanagedNote':{'type':Sequelize[_0xb7d6('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':_0xb7d6('0x24')},'sendUnmanaged':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xb7d6('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xb7d6('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xb7d6('0x1b')]},'showAgentAvatar':{'type':Sequelize[_0xb7d6('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xb7d6('0x1b')],'defaultValue':function(){return _0xb7d6('0x25');}},'notificationSound':{'type':Sequelize[_0xb7d6('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb7d6('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xb7d6('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':_0xb7d6('0x26')},'waitForTheAssignedAgent':{'type':Sequelize[_0xb7d6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':_0xb7d6('0x27')},'verticalAlignment':{'type':Sequelize[_0xb7d6('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':_0xb7d6('0x28')},'defaultTitle':{'type':Sequelize[_0xb7d6('0x1')]},'customerAvatar':{'type':Sequelize[_0xb7d6('0x1b')]},'showCustomerAvatar':{'type':Sequelize[_0xb7d6('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xb7d6('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb7d6('0x29'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xb7d6('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb7d6('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb7d6('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xb7d6('0x1b')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb7d6('0x7')],'comment':_0xb7d6('0x2a')},'mandatoryDisposition':{'type':Sequelize[_0xb7d6('0x8')],'defaultValue':![],'comment':_0xb7d6('0x2b'),'set':function(_0x273cb4){if(!_0x273cb4)this['setDataValue'](_0xb7d6('0x2c'),null);this[_0xb7d6('0x1a')](_0xb7d6('0x2d'),_0x273cb4);}},'vidaooEscalation':{'type':Sequelize[_0xb7d6('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xb7d6('0x1')]},'vidaooTopic':{'type':Sequelize[_0xb7d6('0x1')],'allowNull':![],'defaultValue':_0xb7d6('0x2e')},'vidaooNote':{'type':Sequelize[_0xb7d6('0x1')],'defaultValue':function(){return _0xb7d6('0x2f');}},'vidaooMetadata':{'type':Sequelize[_0xb7d6('0x1b')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xb7d6('0x1b')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 5f3c58b..b8f01cb 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 _0xfa1b=['hasOwnProperty','order','sort','where','pick','filter','type','VIRTUAL','merge','ChatWebsite','includeAll','include','findAll','rows','show','keys','fields','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','params','ChatWebsiteId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addLogo','file','filename','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','isNil','existsSync','join','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','orderBy','asc','defaults','ListId','contact','customerIp','headers','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','files','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','render','offlineMessageBody','ChatOfflineMessage','mimetype','server','offline-chat','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','originalname','subjectOffline','toPairsIn','Chat','MailAccountId','NotifyMailAccount','notifyMail','attachments','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','virtual','custom','License','increment','all','some','server/files/chat/iframe.ejs','remote','x-real-ip','connection','remoteAddress','verticalAlignment','color_button','backgroundColor','addApplications','findAndCountAll','priority','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getProactiveActions','getFields','online','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','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','../../mysqldb','redis','jayson/promise','client','http','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','offset','limit','undefined','count','status','Content-Range','apply','reject','save','destroy','get','ChatWebsites','UserProfileResource','end','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes'];(function(_0xc0b67e,_0x4a5ae3){var _0x46b91f=function(_0xd8a097){while(--_0xd8a097){_0xc0b67e['push'](_0xc0b67e['shift']());}};_0x46b91f(++_0x4a5ae3);}(_0xfa1b,0xe9));var _0xbfa1=function(_0x1f63ed,_0x219297){_0x1f63ed=_0x1f63ed-0x0;var _0x174cfa=_0xfa1b[_0x1f63ed];return _0x174cfa;};'use strict';var emlformat=require(_0xbfa1('0x0'));var rimraf=require(_0xbfa1('0x1'));var zipdir=require(_0xbfa1('0x2'));var jsonpatch=require(_0xbfa1('0x3'));var rp=require(_0xbfa1('0x4'));var moment=require(_0xbfa1('0x5'));var BPromise=require(_0xbfa1('0x6'));var Mustache=require(_0xbfa1('0x7'));var util=require(_0xbfa1('0x8'));var path=require(_0xbfa1('0x9'));var sox=require(_0xbfa1('0xa'));var csv=require('to-csv');var ejs=require(_0xbfa1('0xb'));var fs=require('fs');var fs_extra=require(_0xbfa1('0xc'));var _=require(_0xbfa1('0xd'));var squel=require(_0xbfa1('0xe'));var crypto=require(_0xbfa1('0xf'));var jsforce=require(_0xbfa1('0x10'));var deskjs=require(_0xbfa1('0x11'));var toCsv=require(_0xbfa1('0x12'));var querystring=require(_0xbfa1('0x13'));var Papa=require(_0xbfa1('0x14'));var Redis=require(_0xbfa1('0x15'));var authService=require(_0xbfa1('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0xbfa1('0x17'));var hardwareService=require(_0xbfa1('0x18'));var logger=require(_0xbfa1('0x19'))(_0xbfa1('0x1a'));var utils=require(_0xbfa1('0x1b'));var config=require(_0xbfa1('0x1c'));var licenseUtil=require(_0xbfa1('0x1d'));var db=require(_0xbfa1('0x1e'))['db'];config['redis']=_['defaults'](config[_0xbfa1('0x1f')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbfa1('0x1f')]));require('./chatWebsite.socket')['register'](socket);var jayson=require(_0xbfa1('0x20'));var client=jayson[_0xbfa1('0x21')][_0xbfa1('0x22')]({'port':0x232c});var client9002=jayson[_0xbfa1('0x21')][_0xbfa1('0x22')]({'port':0x232a});var client9003=jayson[_0xbfa1('0x21')][_0xbfa1('0x22')]({'port':0x232b});var client9001=jayson[_0xbfa1('0x21')][_0xbfa1('0x22')]({'port':0x2329});function respondWithRpcPromise(_0x25b7b9,_0x59cd14,_0x31ea04,_0x1eff03){return new BPromise(function(_0x306e42,_0x2c3ca5){var _0x1976d7=_0x1eff03||client;return _0x1976d7['request'](_0x25b7b9,_0x31ea04)[_0xbfa1('0x23')](function(_0x58a6f9){logger[_0xbfa1('0x24')](_0xbfa1('0x25'),_0x59cd14,_0xbfa1('0x26'));logger['debug'](_0xbfa1('0x27'),_0x59cd14,'request\x20sent',JSON[_0xbfa1('0x28')](_0x58a6f9));if(_0x58a6f9[_0xbfa1('0x29')]){if(_0x58a6f9[_0xbfa1('0x29')][_0xbfa1('0x2a')]===0x1f4){logger['error'](_0xbfa1('0x25'),_0x59cd14,_0x58a6f9['error'][_0xbfa1('0x2b')]);return _0x2c3ca5(_0x58a6f9[_0xbfa1('0x29')][_0xbfa1('0x2b')]);}logger[_0xbfa1('0x29')](_0xbfa1('0x25'),_0x59cd14,_0x58a6f9[_0xbfa1('0x29')][_0xbfa1('0x2b')]);return _0x306e42(_0x58a6f9['error'][_0xbfa1('0x2b')]);}else{logger[_0xbfa1('0x24')]('ChatWebsite,\x20%s,\x20%s',_0x59cd14,_0xbfa1('0x26'));_0x306e42(_0x58a6f9[_0xbfa1('0x2c')][_0xbfa1('0x2b')]);}})[_0xbfa1('0x2d')](function(_0x1496a6){logger['error'](_0xbfa1('0x25'),_0x59cd14,_0x1496a6);_0x2c3ca5(_0x1496a6);});});}function respondWithStatusCode(_0x1faa17,_0x346375){_0x346375=_0x346375||0xcc;return function(_0x13d9bb){if(_0x13d9bb){return _0x1faa17['sendStatus'](_0x346375);}return _0x1faa17['status'](_0x346375)['end']();};}function respondWithResult(_0x2c8385,_0x30642d){_0x30642d=_0x30642d||0xc8;return function(_0x5603df){if(_0x5603df){return _0x2c8385['status'](_0x30642d)[_0xbfa1('0x2e')](_0x5603df);}};}function respondWithFilteredResult(_0x4a7dce,_0x88d01e){return function(_0x28eb91){if(_0x28eb91){var _0x95ffc8=typeof _0x88d01e[_0xbfa1('0x2f')]==='undefined'&&typeof _0x88d01e[_0xbfa1('0x30')]===_0xbfa1('0x31');var _0x1a4740=_0x28eb91[_0xbfa1('0x32')];var _0x38d752=_0x95ffc8?0x0:_0x88d01e[_0xbfa1('0x2f')];var _0x6b2574=_0x95ffc8?_0x28eb91[_0xbfa1('0x32')]:_0x88d01e[_0xbfa1('0x2f')]+_0x88d01e[_0xbfa1('0x30')];var _0x5ac586;if(_0x6b2574>=_0x1a4740){_0x6b2574=_0x1a4740;_0x5ac586=0xc8;}else{_0x5ac586=0xce;}_0x4a7dce[_0xbfa1('0x33')](_0x5ac586);return _0x4a7dce['set'](_0xbfa1('0x34'),_0x38d752+'-'+_0x6b2574+'/'+_0x1a4740)[_0xbfa1('0x2e')](_0x28eb91);}return null;};}function patchUpdates(_0x2a94e4){return function(_0x34254f){try{jsonpatch[_0xbfa1('0x35')](_0x34254f,_0x2a94e4,!![]);}catch(_0x36751e){return BPromise[_0xbfa1('0x36')](_0x36751e);}return _0x34254f[_0xbfa1('0x37')]();};}function saveUpdates(_0x1ae2a3,_0x4338e9){return function(_0x671bac){if(_0x671bac){return _0x671bac['update'](_0x1ae2a3)['then'](function(_0x239475){return _0x239475;});}return null;};}function removeEntity(_0xad7c88,_0x5af01d){return function(_0x5276fb){if(_0x5276fb){return _0x5276fb[_0xbfa1('0x38')]()[_0xbfa1('0x23')](function(){var _0x1c4a22=_0x5276fb[_0xbfa1('0x39')]({'plain':!![]});var _0x46118a=_0xbfa1('0x3a');return db[_0xbfa1('0x3b')]['destroy']({'where':{'type':_0x46118a,'resourceId':_0x1c4a22['id']}})['then'](function(){return _0x5276fb;});})[_0xbfa1('0x23')](function(){_0xad7c88[_0xbfa1('0x33')](0xcc)[_0xbfa1('0x3c')]();});}};}function handleEntityNotFound(_0x33936a,_0x56ad1b){return function(_0x8a6a65){if(!_0x8a6a65){_0x33936a[_0xbfa1('0x3d')](0x194);}return _0x8a6a65;};}function handleError(_0x21dce1,_0x479d87){_0x479d87=_0x479d87||0x1f4;return function(_0x333233){logger['error'](_0x333233[_0xbfa1('0x3e')]);if(_0x333233['name']){delete _0x333233[_0xbfa1('0x3f')];}_0x21dce1['status'](_0x479d87)[_0xbfa1('0x40')](_0x333233);};}exports['index']=function(_0x3ac573,_0x49d687){var _0x3347ba={'include':[{'model':db[_0xbfa1('0x41')],'as':_0xbfa1('0x42')}]},_0x212ec1={},_0x3b694c={'count':0x0,'rows':[]};var _0x33bbb7=_['map'](db['ChatWebsite'][_0xbfa1('0x43')],function(_0x50a079){return{'name':_0x50a079[_0xbfa1('0x44')],'type':_0x50a079['type'][_0xbfa1('0x45')]};});_0x212ec1[_0xbfa1('0x46')]=_[_0xbfa1('0x47')](_0x33bbb7,_0xbfa1('0x3f'));_0x212ec1[_0xbfa1('0x48')]=_['keys'](_0x3ac573[_0xbfa1('0x48')]);_0x212ec1[_0xbfa1('0x49')]=_[_0xbfa1('0x4a')](_0x212ec1[_0xbfa1('0x46')],_0x212ec1[_0xbfa1('0x48')]);_0x3347ba[_0xbfa1('0x4b')]=_['intersection'](_0x212ec1[_0xbfa1('0x46')],qs['fields'](_0x3ac573[_0xbfa1('0x48')]['fields']));_0x3347ba[_0xbfa1('0x4b')]=_0x3347ba[_0xbfa1('0x4b')]['length']?_0x3347ba['attributes']:_0x212ec1[_0xbfa1('0x46')];if(!_0x3ac573[_0xbfa1('0x48')][_0xbfa1('0x4c')]('nolimit')){_0x3347ba[_0xbfa1('0x30')]=qs[_0xbfa1('0x30')](_0x3ac573['query']['limit']);_0x3347ba[_0xbfa1('0x2f')]=qs[_0xbfa1('0x2f')](_0x3ac573[_0xbfa1('0x48')][_0xbfa1('0x2f')]);}_0x3347ba[_0xbfa1('0x4d')]=qs[_0xbfa1('0x4e')](_0x3ac573[_0xbfa1('0x48')][_0xbfa1('0x4e')]);_0x3347ba[_0xbfa1('0x4f')]=qs[_0xbfa1('0x49')](_[_0xbfa1('0x50')](_0x3ac573[_0xbfa1('0x48')],_0x212ec1[_0xbfa1('0x49')]),_0x33bbb7);if(_0x3ac573['query'][_0xbfa1('0x51')]){_0x3347ba[_0xbfa1('0x4f')]=_['merge'](_0x3347ba[_0xbfa1('0x4f')],{'$or':_[_0xbfa1('0x47')](_0x33bbb7,function(_0xf2c726){if(_0xf2c726[_0xbfa1('0x52')]!==_0xbfa1('0x53')){var _0x1eaec3={};_0x1eaec3[_0xf2c726[_0xbfa1('0x3f')]]={'$like':'%'+_0x3ac573[_0xbfa1('0x48')][_0xbfa1('0x51')]+'%'};return _0x1eaec3;}})});}_0x3347ba=_[_0xbfa1('0x54')]({},_0x3347ba,_0x3ac573['options']);var _0xcc5ed6={'where':_0x3347ba[_0xbfa1('0x4f')]};return db[_0xbfa1('0x55')]['count'](_0xcc5ed6)[_0xbfa1('0x23')](function(_0x58e78e){_0x3b694c[_0xbfa1('0x32')]=_0x58e78e;if(_0x3ac573[_0xbfa1('0x48')][_0xbfa1('0x56')]){_0x3347ba[_0xbfa1('0x57')]=[{'all':!![]}];}return db[_0xbfa1('0x55')][_0xbfa1('0x58')](_0x3347ba);})[_0xbfa1('0x23')](function(_0xa8b585){_0x3b694c[_0xbfa1('0x59')]=_0xa8b585;return _0x3b694c;})['then'](respondWithFilteredResult(_0x49d687,_0x3347ba))[_0xbfa1('0x2d')](handleError(_0x49d687,null));};exports[_0xbfa1('0x5a')]=function(_0x5f30d9,_0x2c279b){var _0x9a5015={'raw':![],'where':{'id':_0x5f30d9['params']['id']},'include':[{'model':db[_0xbfa1('0x41')],'as':'mandatoryDispositionPause'}]},_0x6f6006={};_0x6f6006['model']=_[_0xbfa1('0x5b')](db[_0xbfa1('0x55')][_0xbfa1('0x43')]);_0x6f6006['query']=_[_0xbfa1('0x5b')](_0x5f30d9[_0xbfa1('0x48')]);_0x6f6006['filters']=_[_0xbfa1('0x4a')](_0x6f6006[_0xbfa1('0x46')],_0x6f6006[_0xbfa1('0x48')]);_0x9a5015[_0xbfa1('0x4b')]=_[_0xbfa1('0x4a')](_0x6f6006['model'],qs['fields'](_0x5f30d9[_0xbfa1('0x48')][_0xbfa1('0x5c')]));_0x9a5015[_0xbfa1('0x4b')]=_0x9a5015[_0xbfa1('0x4b')][_0xbfa1('0x5d')]?_0x9a5015[_0xbfa1('0x4b')]:_0x6f6006[_0xbfa1('0x46')];if(_0x5f30d9[_0xbfa1('0x48')][_0xbfa1('0x56')]){_0x9a5015[_0xbfa1('0x57')]=[{'all':!![]}];}_0x9a5015=_[_0xbfa1('0x54')]({},_0x9a5015,_0x5f30d9[_0xbfa1('0x5e')]);return db[_0xbfa1('0x55')][_0xbfa1('0x5f')](_0x9a5015)['then'](handleEntityNotFound(_0x2c279b,null))[_0xbfa1('0x23')](respondWithResult(_0x2c279b,null))[_0xbfa1('0x2d')](handleError(_0x2c279b,null));};exports[_0xbfa1('0x60')]=function(_0x26febd,_0x12a732){return db[_0xbfa1('0x55')]['create'](_0x26febd[_0xbfa1('0x61')],{})[_0xbfa1('0x23')](function(_0x2e863b){var _0x50b4c7=_0x26febd['user'][_0xbfa1('0x39')]({'plain':!![]});if(!_0x50b4c7)throw new Error(_0xbfa1('0x62'));if(_0x50b4c7['role']===_0xbfa1('0x63')){var _0x1edf51=_0x2e863b['get']({'plain':!![]});var _0x2b8b0d=_0xbfa1('0x3a');return db[_0xbfa1('0x64')][_0xbfa1('0x5f')]({'where':{'name':_0x2b8b0d,'userProfileId':_0x50b4c7[_0xbfa1('0x65')]},'raw':!![]})['then'](function(_0x15ebcf){if(_0x15ebcf&&_0x15ebcf[_0xbfa1('0x66')]===0x0){return db['UserProfileResource'][_0xbfa1('0x60')]({'name':_0x1edf51[_0xbfa1('0x3f')],'resourceId':_0x1edf51['id'],'type':_0x15ebcf[_0xbfa1('0x3f')],'sectionId':_0x15ebcf['id']},{})[_0xbfa1('0x23')](function(){return _0x2e863b;});}else{return _0x2e863b;}})[_0xbfa1('0x2d')](function(_0x560bcc){logger[_0xbfa1('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x560bcc);throw _0x560bcc;});}return _0x2e863b;})[_0xbfa1('0x23')](respondWithResult(_0x12a732,0xc9))['catch'](handleError(_0x12a732,null));};exports['update']=function(_0x32a681,_0xc892db){if(_0x32a681[_0xbfa1('0x61')]['id']){delete _0x32a681[_0xbfa1('0x61')]['id'];}return db[_0xbfa1('0x55')]['find']({'where':{'id':_0x32a681['params']['id']},'include':[{'model':db[_0xbfa1('0x41')],'as':'mandatoryDispositionPause'}]})[_0xbfa1('0x23')](handleEntityNotFound(_0xc892db,null))[_0xbfa1('0x23')](saveUpdates(_0x32a681['body'],null))[_0xbfa1('0x23')](respondWithResult(_0xc892db,null))[_0xbfa1('0x2d')](handleError(_0xc892db,null));};exports[_0xbfa1('0x38')]=function(_0x2e7f15,_0x1efe59){return db[_0xbfa1('0x55')]['find']({'where':{'id':_0x2e7f15['params']['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x1efe59,null))[_0xbfa1('0x23')](removeEntity(_0x1efe59,null))['catch'](handleError(_0x1efe59,null));};exports[_0xbfa1('0x67')]=function(_0x32a8f2,_0x38ee4c){return db[_0xbfa1('0x55')][_0xbfa1('0x67')]()[_0xbfa1('0x23')](respondWithResult(_0x38ee4c,null))[_0xbfa1('0x2d')](handleError(_0x38ee4c,null));};exports[_0xbfa1('0x68')]=function(_0x448a4c,_0x171d48,_0x582e5d){if(_0x448a4c[_0xbfa1('0x61')]['id']){delete _0x448a4c[_0xbfa1('0x61')]['id'];}return db[_0xbfa1('0x55')][_0xbfa1('0x5f')]({'where':{'id':_0x448a4c[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x171d48,null))[_0xbfa1('0x23')](function(_0x4d7cac){if(_0x4d7cac){_0x448a4c[_0xbfa1('0x61')][_0xbfa1('0x6a')]=_0x4d7cac['id'];return db[_0xbfa1('0x6b')]['create'](_0x448a4c['body']);}})[_0xbfa1('0x23')](respondWithResult(_0x171d48,null))[_0xbfa1('0x2d')](handleError(_0x171d48,null));};exports[_0xbfa1('0x6c')]=function(_0x59736f,_0x132b0e,_0x3c6830){var _0x5f5449={'raw':![],'where':{}};var _0x37330c={};var _0x3f001f={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xbfa1('0x6d')]({'where':{'id':_0x59736f['params']['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x132b0e,null))['then'](function(_0x55916d){if(_0x55916d){_0x37330c['model']=_[_0xbfa1('0x5b')](db[_0xbfa1('0x6b')]['rawAttributes']);_0x37330c[_0xbfa1('0x48')]=_[_0xbfa1('0x5b')](_0x59736f[_0xbfa1('0x48')]);_0x37330c['filters']=_[_0xbfa1('0x4a')](_0x37330c[_0xbfa1('0x46')],_0x37330c[_0xbfa1('0x48')]);_0x5f5449[_0xbfa1('0x4b')]=_[_0xbfa1('0x4a')](_0x37330c[_0xbfa1('0x46')],qs[_0xbfa1('0x5c')](_0x59736f['query']['fields']));_0x5f5449[_0xbfa1('0x4b')]=_0x5f5449[_0xbfa1('0x4b')]['length']?_0x5f5449['attributes']:_0x37330c[_0xbfa1('0x46')];if(!_0x59736f['query'][_0xbfa1('0x4c')](_0xbfa1('0x6e'))){_0x5f5449[_0xbfa1('0x30')]=qs[_0xbfa1('0x30')](_0x59736f[_0xbfa1('0x48')][_0xbfa1('0x30')]);_0x5f5449['offset']=qs[_0xbfa1('0x2f')](_0x59736f['query'][_0xbfa1('0x2f')]);}_0x5f5449[_0xbfa1('0x4d')]=qs['sort'](_0x59736f[_0xbfa1('0x48')][_0xbfa1('0x4e')]);_0x5f5449[_0xbfa1('0x4f')]=qs['filters'](_[_0xbfa1('0x50')](_0x59736f['query'],_0x37330c['filters']));_0x5f5449[_0xbfa1('0x4f')]['ChatWebsiteId']=_0x55916d['id'];if(_0x59736f['query'][_0xbfa1('0x51')]){_0x5f5449[_0xbfa1('0x4f')]=_[_0xbfa1('0x54')](_0x5f5449[_0xbfa1('0x4f')],{'$or':_[_0xbfa1('0x47')](_0x5f5449['attributes'],function(_0x1fac99){var _0x277f05={};_0x277f05[_0x1fac99]={'$like':'%'+_0x59736f['query']['filter']+'%'};return _0x277f05;})});}_0x5f5449=_['merge']({},_0x5f5449,_0x59736f[_0xbfa1('0x5e')]);return db['Disposition'][_0xbfa1('0x32')]({'where':_0x5f5449[_0xbfa1('0x4f')]})[_0xbfa1('0x23')](function(_0x372d9d){_0x3f001f[_0xbfa1('0x32')]=_0x372d9d;if(_0x59736f[_0xbfa1('0x48')]['includeAll']){_0x5f5449[_0xbfa1('0x57')]=[{'all':!![]}];}return db['Disposition'][_0xbfa1('0x58')](_0x5f5449);})[_0xbfa1('0x23')](function(_0x2fa547){_0x3f001f[_0xbfa1('0x59')]=_0x2fa547;return _0x3f001f;});}})['then'](respondWithFilteredResult(_0x132b0e,_0x5f5449))[_0xbfa1('0x2d')](handleError(_0x132b0e,null));};exports[_0xbfa1('0x6f')]=function(_0x10c288,_0x574461,_0x1b43fa){return db[_0xbfa1('0x55')]['find']({'where':{'id':_0x10c288[_0xbfa1('0x69')]['id']}})['then'](handleEntityNotFound(_0x574461,null))['then'](function(_0x4355c9){if(_0x4355c9){return _0x4355c9[_0xbfa1('0x6f')](_0x10c288['query'][_0xbfa1('0x70')]);}})[_0xbfa1('0x23')](respondWithStatusCode(_0x574461,null))['catch'](handleError(_0x574461,null));};exports[_0xbfa1('0x71')]=function(_0x26e7f7,_0x596c03,_0x2bf00e){if(_0x26e7f7[_0xbfa1('0x61')]['id']){delete _0x26e7f7[_0xbfa1('0x61')]['id'];}return db[_0xbfa1('0x55')][_0xbfa1('0x5f')]({'where':{'id':_0x26e7f7['params']['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x596c03,null))[_0xbfa1('0x23')](function(_0x3221ff){if(_0x3221ff){_0x26e7f7[_0xbfa1('0x61')]['ChatWebsiteId']=_0x3221ff['id'];return db[_0xbfa1('0x72')]['create'](_0x26e7f7[_0xbfa1('0x61')]);}})[_0xbfa1('0x23')](respondWithResult(_0x596c03,null))[_0xbfa1('0x2d')](handleError(_0x596c03,null));};exports[_0xbfa1('0x73')]=function(_0x9cbe85,_0x5616f2,_0x53e395){var _0x595d47={'raw':![],'where':{}};var _0x2da59f={};var _0x61cadc={'count':0x0,'rows':[]};return db[_0xbfa1('0x55')][_0xbfa1('0x6d')]({'where':{'id':_0x9cbe85[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x5616f2,null))[_0xbfa1('0x23')](function(_0x59ef6b){if(_0x59ef6b){_0x2da59f[_0xbfa1('0x46')]=_[_0xbfa1('0x5b')](db['CannedAnswer'][_0xbfa1('0x43')]);_0x2da59f[_0xbfa1('0x48')]=_[_0xbfa1('0x5b')](_0x9cbe85[_0xbfa1('0x48')]);_0x2da59f['filters']=_[_0xbfa1('0x4a')](_0x2da59f[_0xbfa1('0x46')],_0x2da59f[_0xbfa1('0x48')]);_0x595d47[_0xbfa1('0x4b')]=_['intersection'](_0x2da59f[_0xbfa1('0x46')],qs[_0xbfa1('0x5c')](_0x9cbe85['query'][_0xbfa1('0x5c')]));_0x595d47['attributes']=_0x595d47[_0xbfa1('0x4b')][_0xbfa1('0x5d')]?_0x595d47[_0xbfa1('0x4b')]:_0x2da59f[_0xbfa1('0x46')];if(!_0x9cbe85['query'][_0xbfa1('0x4c')]('nolimit')){_0x595d47[_0xbfa1('0x30')]=qs[_0xbfa1('0x30')](_0x9cbe85[_0xbfa1('0x48')][_0xbfa1('0x30')]);_0x595d47[_0xbfa1('0x2f')]=qs[_0xbfa1('0x2f')](_0x9cbe85['query'][_0xbfa1('0x2f')]);}_0x595d47[_0xbfa1('0x4d')]=qs[_0xbfa1('0x4e')](_0x9cbe85[_0xbfa1('0x48')][_0xbfa1('0x4e')]);_0x595d47[_0xbfa1('0x4f')]=qs[_0xbfa1('0x49')](_[_0xbfa1('0x50')](_0x9cbe85[_0xbfa1('0x48')],_0x2da59f['filters']));_0x595d47[_0xbfa1('0x4f')]['ChatWebsiteId']=_0x59ef6b['id'];if(_0x9cbe85[_0xbfa1('0x48')][_0xbfa1('0x51')]){_0x595d47['where']=_[_0xbfa1('0x54')](_0x595d47['where'],{'$or':_[_0xbfa1('0x47')](_0x595d47['attributes'],function(_0x753baa){var _0x1642c1={};_0x1642c1[_0x753baa]={'$like':'%'+_0x9cbe85['query'][_0xbfa1('0x51')]+'%'};return _0x1642c1;})});}_0x595d47=_['merge']({},_0x595d47,_0x9cbe85[_0xbfa1('0x5e')]);return db['CannedAnswer']['count']({'where':_0x595d47['where']})[_0xbfa1('0x23')](function(_0x28dc08){_0x61cadc['count']=_0x28dc08;if(_0x9cbe85['query']['includeAll']){_0x595d47[_0xbfa1('0x57')]=[{'all':!![]}];}return db[_0xbfa1('0x72')]['findAll'](_0x595d47);})[_0xbfa1('0x23')](function(_0x342b25){_0x61cadc[_0xbfa1('0x59')]=_0x342b25;return _0x61cadc;});}})[_0xbfa1('0x23')](respondWithFilteredResult(_0x5616f2,_0x595d47))[_0xbfa1('0x2d')](handleError(_0x5616f2,null));};exports[_0xbfa1('0x74')]=function(_0x14a7cb,_0x23489d,_0xe2bf72){return db[_0xbfa1('0x55')][_0xbfa1('0x5f')]({'where':{'id':_0x14a7cb[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x23489d,null))[_0xbfa1('0x23')](function(_0x2e5931){if(_0x2e5931){return _0x2e5931['removeAnswers'](_0x14a7cb[_0xbfa1('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x23489d,null))['catch'](handleError(_0x23489d,null));};exports[_0xbfa1('0x75')]=function(_0x3059ba,_0x304aa2,_0x9fea5d){_0x3059ba[_0xbfa1('0x61')]['sitepic']=_0x3059ba[_0xbfa1('0x76')][_0xbfa1('0x77')];return db[_0xbfa1('0x55')][_0xbfa1('0x5f')]({'where':{'id':_0x3059ba['params']['id']}})['then'](handleEntityNotFound(_0x304aa2,null))['then'](saveUpdates(_0x3059ba[_0xbfa1('0x61')],null))[_0xbfa1('0x23')](respondWithResult(_0x304aa2,null))[_0xbfa1('0x2d')](handleError(_0x304aa2,null));};exports['addAvatar']=function(_0x11336a,_0x415fdb,_0x1b3f12){_0x11336a[_0xbfa1('0x61')][_0xbfa1('0x78')]=_0x11336a['file'][_0xbfa1('0x77')];return db[_0xbfa1('0x55')][_0xbfa1('0x5f')]({'where':{'id':_0x11336a[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x415fdb,null))[_0xbfa1('0x23')](saveUpdates(_0x11336a[_0xbfa1('0x61')],null))['then'](respondWithResult(_0x415fdb,null))['catch'](handleError(_0x415fdb,null));};exports[_0xbfa1('0x79')]=function(_0x163f7c,_0x3f83ec,_0x2cc377){_0x163f7c[_0xbfa1('0x61')][_0xbfa1('0x7a')]=_0x163f7c[_0xbfa1('0x76')][_0xbfa1('0x77')];return db['ChatWebsite'][_0xbfa1('0x5f')]({'where':{'id':_0x163f7c[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x3f83ec,null))[_0xbfa1('0x23')](saveUpdates(_0x163f7c[_0xbfa1('0x61')],null))['then'](respondWithResult(_0x3f83ec,null))['catch'](handleError(_0x3f83ec,null));};exports['addSystemAvatar']=function(_0x29b90e,_0x24d6f2,_0x4884a6){_0x29b90e[_0xbfa1('0x61')][_0xbfa1('0x7b')]=_0x29b90e['file']['filename'];return db[_0xbfa1('0x55')]['find']({'where':{'id':_0x29b90e[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x24d6f2,null))[_0xbfa1('0x23')](saveUpdates(_0x29b90e[_0xbfa1('0x61')],null))[_0xbfa1('0x23')](respondWithResult(_0x24d6f2,null))[_0xbfa1('0x2d')](handleError(_0x24d6f2,null));};exports[_0xbfa1('0x7c')]=function(_0x558870,_0x51dc96,_0x5c1fee){var _0x3c8427=path['join'](config[_0xbfa1('0x7d')],_0xbfa1('0x7e'));var _0x3ff138={'where':{'id':_0x558870[_0xbfa1('0x69')]['id']},'attributes':['id',_0xbfa1('0x7f')],'raw':!![]};var _0x4ffcba=![];return require('../../config/license/util')[_0xbfa1('0x80')]()['then'](function(_0x359134){if(_0x359134){_0x4ffcba=_0x359134['custom'];}})[_0xbfa1('0x23')](function(){return db['ChatWebsite'][_0xbfa1('0x5f')](_0x3ff138);})[_0xbfa1('0x23')](handleEntityNotFound(_0x51dc96,null))['then'](function(_0x47b43c){if(_0x47b43c){if(!_[_0xbfa1('0x81')](_0x47b43c['sitepic'])){if(fs[_0xbfa1('0x82')](path[_0xbfa1('0x83')](config[_0xbfa1('0x7d')],_0xbfa1('0x84'),_0x47b43c[_0xbfa1('0x7f')]))&&_0x4ffcba){_0x3c8427=path['join'](config['root'],'server/files/images/logos/',_0x47b43c[_0xbfa1('0x7f')]);}}return _0x51dc96[_0xbfa1('0x85')](_0x3c8427);}})[_0xbfa1('0x2d')](handleError(_0x51dc96,null));};exports['getAvatar']=function(_0x51c66f,_0x4720a8,_0x2637de){var _0x22380f=path[_0xbfa1('0x83')](config['root'],_0xbfa1('0x86'));var _0x37950f={'where':{'id':_0x51c66f[_0xbfa1('0x69')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xbfa1('0x55')][_0xbfa1('0x5f')](_0x37950f)[_0xbfa1('0x23')](handleEntityNotFound(_0x4720a8,null))['then'](function(_0x2f0bcc){if(_0x2f0bcc){if(!_['isNil'](_0x2f0bcc[_0xbfa1('0x78')])){if(fs[_0xbfa1('0x82')](path[_0xbfa1('0x83')](config[_0xbfa1('0x7d')],_0xbfa1('0x87'),_0x2f0bcc[_0xbfa1('0x78')]))){_0x22380f=path[_0xbfa1('0x83')](config[_0xbfa1('0x7d')],'server/files/images/avatars/',_0x2f0bcc['agentAvatar']);}}return _0x4720a8[_0xbfa1('0x85')](_0x22380f);}})['catch'](handleError(_0x4720a8,null));};exports[_0xbfa1('0x88')]=function(_0x12dbe4,_0x379d8b,_0x13dc71){var _0x419c20=path[_0xbfa1('0x83')](config[_0xbfa1('0x7d')],'server/files/images/avatars/customer_avatar.png');var _0x5ca8ee={'where':{'id':_0x12dbe4[_0xbfa1('0x69')]['id']},'attributes':['id','customerAvatar',_0xbfa1('0x89')],'raw':!![]};return db[_0xbfa1('0x55')][_0xbfa1('0x5f')](_0x5ca8ee)[_0xbfa1('0x23')](handleEntityNotFound(_0x379d8b,null))[_0xbfa1('0x23')](function(_0x17d268){if(_0x17d268){if(!_[_0xbfa1('0x81')](_0x17d268[_0xbfa1('0x7a')])){if(fs[_0xbfa1('0x82')](path[_0xbfa1('0x83')](config[_0xbfa1('0x7d')],'server/files/images/avatars/',_0x17d268[_0xbfa1('0x7a')]))&&_0x17d268[_0xbfa1('0x89')]){_0x419c20=path[_0xbfa1('0x83')](config['root'],_0xbfa1('0x87'),_0x17d268[_0xbfa1('0x7a')]);}}return _0x379d8b[_0xbfa1('0x85')](_0x419c20);}})[_0xbfa1('0x2d')](handleError(_0x379d8b,null));};exports[_0xbfa1('0x8a')]=function(_0x35494e,_0x465ae9,_0x41d81b){var _0x380690=path[_0xbfa1('0x83')](config['root'],_0xbfa1('0x8b'));var _0x77e4ae={'where':{'id':_0x35494e['params']['id']},'attributes':['id',_0xbfa1('0x7b')],'raw':!![]};return db[_0xbfa1('0x55')][_0xbfa1('0x5f')](_0x77e4ae)[_0xbfa1('0x23')](handleEntityNotFound(_0x465ae9,null))[_0xbfa1('0x23')](function(_0x15e425){if(_0x15e425){if(!_[_0xbfa1('0x81')](_0x15e425[_0xbfa1('0x7b')])){if(fs[_0xbfa1('0x82')](path['join'](config['root'],_0xbfa1('0x87'),_0x15e425[_0xbfa1('0x7b')]))){_0x380690=path[_0xbfa1('0x83')](config[_0xbfa1('0x7d')],_0xbfa1('0x87'),_0x15e425[_0xbfa1('0x7b')]);}}return _0x465ae9[_0xbfa1('0x85')](_0x380690);}})[_0xbfa1('0x2d')](handleError(_0x465ae9,null));};exports[_0xbfa1('0x8c')]=function(_0x2c921b,_0x514213,_0x4e6f85){var _0x325747=require(_0xbfa1('0x8d'));var _0x4b6c67=new _0x325747();var _0xa22eff=_0x4b6c67['setUA'](_0x2c921b['headers']['user-agent'])['getResult']();var _0x35f72f={'body':_0x2c921b[_0xbfa1('0x61')],'channel':'chat'};var _0x14bd26=[];var _0x3d0e30=[];var _0x5419c5={};var _0x6df36e=![];return db[_0xbfa1('0x8e')][_0xbfa1('0x67')]()[_0xbfa1('0x23')](function(_0x4733e6){if(!_0x4733e6){throw new db[(_0xbfa1('0x8f'))][(_0xbfa1('0x90'))](_0xbfa1('0x91'));}_0x14bd26=_[_0xbfa1('0x92')](_[_0xbfa1('0x5b')](_0x4733e6),[_0xbfa1('0x93'),_0xbfa1('0x94')]);_0x3d0e30=_[_0xbfa1('0x92')](_['keys'](_0x4733e6),['createdAt','updatedAt',_0xbfa1('0x95'),'ListId']);if(_0x2c921b[_0xbfa1('0x61')]['id']){delete _0x2c921b[_0xbfa1('0x61')]['id'];}if(_[_0xbfa1('0x81')](_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x96')])){throw new db['Sequelize'][(_0xbfa1('0x90'))](_0xbfa1('0x97'));}if(_[_0xbfa1('0x81')](_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x61')])||_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x61')]===''){throw new db['Sequelize'][(_0xbfa1('0x90'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x98')])){throw new db[(_0xbfa1('0x8f'))][(_0xbfa1('0x90'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3d0e30);}if(!_[_0xbfa1('0x99')](_0x3d0e30,_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x98')])){throw new db[(_0xbfa1('0x8f'))][(_0xbfa1('0x90'))](_0xbfa1('0x9a')+_0x3d0e30);}_0x5419c5[_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x98')]]=_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x96')];})[_0xbfa1('0x23')](function(){return db[_0xbfa1('0x55')]['find']({'where':{'id':_0x2c921b[_0xbfa1('0x69')]['id']},'include':[{'model':db[_0xbfa1('0x9b')],'as':_0xbfa1('0x9c'),'include':[{'model':db[_0xbfa1('0x8e')],'as':_0xbfa1('0x9d'),'where':_0x5419c5,'limit':0x1,'order':[[_0xbfa1('0x94'),_0xbfa1('0x9e')]]}]},{'model':db[_0xbfa1('0x9f')],'as':_0xbfa1('0xa0')}]});})[_0xbfa1('0x23')](handleEntityNotFound(_0x514213,null))[_0xbfa1('0x23')](function(_0x30a077){if(_0x30a077&&_0x30a077['List']){_0x35f72f[_0xbfa1('0xa1')]=_0x30a077;_0x35f72f[_0xbfa1('0xa2')]=_0x30a077['Applications'];_0x35f72f['list']=_0x30a077[_0xbfa1('0x9c')];_0x35f72f['applications']=_[_0xbfa1('0xa3')](_0x35f72f['applications'],['priority'],[_0xbfa1('0xa4')]);if(_0x35f72f['account'][_0xbfa1('0xa0')]){delete _0x35f72f[_0xbfa1('0xa1')][_0xbfa1('0xa0')];}if(_0x35f72f[_0xbfa1('0xa1')]['List']&&_0x35f72f[_0xbfa1('0xa1')]['List'][_0xbfa1('0x9d')][_0xbfa1('0x5d')]){return _0x35f72f[_0xbfa1('0xa1')][_0xbfa1('0x9c')][_0xbfa1('0x9d')][0x0];}var _0x892f53=_[_0xbfa1('0xa5')](_0x2c921b['body'],{'firstName':_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x96')],'ListId':_0x30a077[_0xbfa1('0xa6')]});_0x892f53[_0x2c921b[_0xbfa1('0x61')]['mapKey']]=_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x96')];return db[_0xbfa1('0x8e')][_0xbfa1('0x60')](_0x892f53,{'fields':_0x14bd26,'raw':!![]});}})[_0xbfa1('0x23')](handleEntityNotFound(_0x514213,null))[_0xbfa1('0x23')](function(_0x1d3008){_0x35f72f[_0xbfa1('0xa7')]=_0x1d3008;var _0x1e2db9=_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0xa8')];if(_0x2c921b[_0xbfa1('0xa9')][_0xbfa1('0xaa')]){_0x1e2db9=_0x2c921b[_0xbfa1('0xa9')][_0xbfa1('0xaa')];}else if(_0x2c921b[_0xbfa1('0xa9')][_0xbfa1('0xab')]){_0x1e2db9=_[_0xbfa1('0xac')](_0x2c921b['headers'][_0xbfa1('0xab')][_0xbfa1('0xad')](','));}if(_0x1d3008){var _0x952643={'ContactId':_0x1d3008['id'],'ChatWebsiteId':_0x2c921b[_0xbfa1('0x69')]['id'],'from':(_0x1d3008[_0xbfa1('0xae')]||'')+'\x20'+(_0x1d3008[_0xbfa1('0xaf')]||''),'customerIp':_0x1e2db9,'customerPort':_0x2c921b[_0xbfa1('0xa9')][_0xbfa1('0xb0')]?_0x2c921b[_0xbfa1('0xa9')][_0xbfa1('0xb0')]:null,'referer':_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0xb1')],'browserName':_0xa22eff[_0xbfa1('0xb2')][_0xbfa1('0x3f')]&&_0xa22eff[_0xbfa1('0xb2')][_0xbfa1('0xb3')]?util[_0xbfa1('0xb4')](_0xbfa1('0xb5'),_0xa22eff[_0xbfa1('0xb2')][_0xbfa1('0x3f')],_0xa22eff[_0xbfa1('0xb2')]['version']):_0xbfa1('0xb6'),'browserVersion':_0xa22eff[_0xbfa1('0xb2')][_0xbfa1('0xb3')]||_0xbfa1('0xb6'),'osName':util[_0xbfa1('0xb4')](_0xbfa1('0xb5'),_0xa22eff['os']['name'],_0xa22eff['os']['version']),'osVersion':_0xa22eff['os']['version'],'deviceModel':_0xa22eff[_0xbfa1('0xb7')][_0xbfa1('0x46')]&&_0xa22eff[_0xbfa1('0xb7')][_0xbfa1('0xb8')]?util['format'](_0xbfa1('0xb9'),_0xa22eff[_0xbfa1('0xb7')][_0xbfa1('0x46')],_0xa22eff[_0xbfa1('0xb7')][_0xbfa1('0xb8')],_0xa22eff[_0xbfa1('0xb7')][_0xbfa1('0x52')]):null,'deviceVendor':_0xa22eff['device'][_0xbfa1('0xb8')],'deviceType':_0xa22eff[_0xbfa1('0xb7')][_0xbfa1('0x52')],'formData':JSON['stringify'](_0x2c921b[_0xbfa1('0x61')])};var _0x3b70ad={'ChatWebsiteId':_0x2c921b[_0xbfa1('0x69')]['id'],'closed':![]};if(_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0xba')]){_0x3b70ad[_0xbfa1('0xba')]=_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0xba')];return db[_0xbfa1('0xbb')][_0xbfa1('0x5f')]({'where':_0x3b70ad})[_0xbfa1('0x23')](function(_0x4ab116){if(_0x4ab116){return[_0x4ab116,![]];}_0x952643[_0xbfa1('0xba')]=_0x2c921b['body'][_0xbfa1('0xba')];_0x952643[_0xbfa1('0xbc')]=_0x2c921b[_0xbfa1('0x61')]['externalUrl'];return db[_0xbfa1('0xbb')]['create'](_0x952643)[_0xbfa1('0x23')](function(_0x57c778){return[_0x57c778,!![]];});});}_0x3b70ad['ContactId']=_0x1d3008['id'];if(_0x2c921b['body'][_0xbfa1('0xbd')]&&_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0xbd')]['id']){_0x3b70ad['id']=_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0xbd')]['id'];return db[_0xbfa1('0xbb')][_0xbfa1('0x5f')]({'where':_0x3b70ad})[_0xbfa1('0x23')](function(_0x833de1){if(_0x833de1){return[_0x833de1,![]];}return db['ChatInteraction']['create'](_0x952643)[_0xbfa1('0x23')](function(_0x5a89e1){return[_0x5a89e1,!![]];});});}return db['ChatInteraction'][_0xbfa1('0x60')](_0x952643)[_0xbfa1('0x23')](function(_0x52f4f1){return[_0x52f4f1,!![]];});}})[_0xbfa1('0xbe')](function(_0x978898,_0x22b8dc){if(_0x978898){_0x6df36e=_0x22b8dc;if(!_0x22b8dc){var _0x3d68d0={'from':(_0x35f72f[_0xbfa1('0xa7')][_0xbfa1('0xae')]||'')+'\x20'+(_0x35f72f[_0xbfa1('0xa7')]['lastName']||'')};if(_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0xba')]&&_0x2c921b[_0xbfa1('0x61')]['messageId']&&_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0xba')]!=_0x2c921b[_0xbfa1('0x61')]['messageId']){_0x3d68d0[_0xbfa1('0xba')]=_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0xbf')];}return _0x978898['update'](_0x3d68d0);}else{return _0x978898;}}})['then'](function(_0xea342f){_0x35f72f[_0xbfa1('0xbd')]=_0xea342f['get']({'plain':!![]});_0x35f72f[_0xbfa1('0xbd')][_0xbfa1('0xc0')]=_0x6df36e;if(_0x35f72f[_0xbfa1('0xbd')][_0xbfa1('0xc0')]){if(_0x35f72f[_0xbfa1('0xa1')][_0xbfa1('0xc1')]){_0x35f72f[_0xbfa1('0xa2')][_0xbfa1('0xc2')]({'id':0x0,'priority':_0x35f72f[_0xbfa1('0xa2')]['length']+0x1,'app':_0xbfa1('0xc3'),'appdata':_0xbfa1('0xc4'),'interval':_0xbfa1('0xc5')});}}return db['ChatMessage'][_0xbfa1('0x60')]({'body':_0x2c921b[_0xbfa1('0x61')][_0xbfa1('0x61')],'ChatWebsiteId':_0x2c921b[_0xbfa1('0x69')]['id'],'ChatInteractionId':_0xea342f['id'],'direction':'in','ContactId':_0x35f72f[_0xbfa1('0xa7')]['id'],'AttachmentId':_0x2c921b[_0xbfa1('0x61')]['AttachmentId']});})['then'](function(_0x46bd19){_0x35f72f[_0xbfa1('0x2b')]=_0x46bd19;if(_0x35f72f[_0xbfa1('0xbd')][_0xbfa1('0xc6')]){return db[_0xbfa1('0xc7')][_0xbfa1('0x5f')]({'attributes':['id',_0xbfa1('0x3f')],'where':{'id':_0x35f72f[_0xbfa1('0xbd')][_0xbfa1('0xc6')]}})[_0xbfa1('0x23')](function(_0x3542b2){if(_0x3542b2){_0x35f72f[_0xbfa1('0xa2')][_0xbfa1('0xc8')]({'id':0x0,'priority':0x0,'app':_0xbfa1('0xc9'),'appdata':_0x3542b2['name']+','+(_0x35f72f['account'][_0xbfa1('0xca')]||0xa),'interval':_0xbfa1('0xc5')});_0x35f72f['forcedOwnership']=!![];}return respondWithRpcPromise(_0xbfa1('0xcb'),_0xbfa1('0xcc'),_0x35f72f);});}return respondWithRpcPromise('Start','startRouting',_0x35f72f);})['then'](function(_0x56053e){respondWithRpcPromise('EventManager',_0xbfa1('0xcd'),{'event':_0xbfa1('0x8c'),'message':_0x56053e},client9002);return _0x56053e;})['then'](respondWithResult(_0x514213,null))['catch'](handleError(_0x514213,null));};exports['offline']=function(_0x13c82a,_0x42bc1c,_0x30011b){var _0x18a9e3,_0x405105,_0x33d7f4;var _0x1196bc=[];var _0x1089f2=[];var _0x2380f4={};var _0x5e3495=_0x13c82a[_0xbfa1('0xce')]||[];var _0x5aa6a8=[];var _0xe8c3b2;return db['CmContact'][_0xbfa1('0x67')]()[_0xbfa1('0x23')](function(_0x813fab){if(!_0x813fab){throw new db[(_0xbfa1('0x8f'))][(_0xbfa1('0x90'))](_0xbfa1('0x91'));}_0x1089f2=_[_0xbfa1('0x92')](_[_0xbfa1('0x5b')](_0x813fab),[_0xbfa1('0x93'),_0xbfa1('0x94')]);_0x1196bc=_[_0xbfa1('0x92')](_[_0xbfa1('0x5b')](_0x813fab),[_0xbfa1('0x93'),'updatedAt',_0xbfa1('0x95'),_0xbfa1('0xa6')]);if(_0x13c82a['body']['id']){delete _0x13c82a[_0xbfa1('0x61')]['id'];}if(_['isNil'](_0x13c82a[_0xbfa1('0x61')]['from'])){throw _0x42bc1c[_0xbfa1('0x33')](0x1f4)[_0xbfa1('0x40')](new db['Sequelize'][(_0xbfa1('0x90'))](_0xbfa1('0x97')));}if(_['isNil'](_0x13c82a[_0xbfa1('0x61')][_0xbfa1('0x61')])||_0x13c82a[_0xbfa1('0x61')][_0xbfa1('0x61')]===''){throw _0x42bc1c[_0xbfa1('0x33')](0x1f4)['send'](new db[(_0xbfa1('0x8f'))]['ValidationError'](_0xbfa1('0xcf')));}if(_[_0xbfa1('0x81')](_0x13c82a[_0xbfa1('0x61')]['mapKeyOffline'])){throw _0x42bc1c[_0xbfa1('0x33')](0x1f4)[_0xbfa1('0x40')](new db[(_0xbfa1('0x8f'))][(_0xbfa1('0x90'))](_0xbfa1('0xd0')+_0x1196bc));}if(!_[_0xbfa1('0x99')](_0x1196bc,_0x13c82a[_0xbfa1('0x61')][_0xbfa1('0xd1')])){throw _0x42bc1c['status'](0x1f4)[_0xbfa1('0x40')](new db[(_0xbfa1('0x8f'))][(_0xbfa1('0x90'))](_0xbfa1('0xd2')+_0x1196bc));}_0x2380f4[_0x13c82a[_0xbfa1('0x61')]['mapKeyOffline']]=_0x13c82a[_0xbfa1('0x61')]['from'];})[_0xbfa1('0x23')](function(){return db[_0xbfa1('0x55')][_0xbfa1('0x5f')]({'where':{'id':_0x13c82a['params']['id']},'include':[{'model':db[_0xbfa1('0x9b')],'as':'List'},{'model':db['MailAccount'],'as':_0xbfa1('0xd3')}]});})['then'](handleEntityNotFound(_0x42bc1c,null))[_0xbfa1('0x23')](function(_0x4d0064){if(_0x4d0064&&_0x4d0064[_0xbfa1('0x9c')]){_0x405105=_0x4d0064;var _0x454680=_['defaults'](_0x13c82a['body'],{'firstName':_0x13c82a[_0xbfa1('0x61')][_0xbfa1('0x96')],'phone':_0x13c82a[_0xbfa1('0x61')]['from'],'ListId':_0x4d0064['ListId']});_0x454680[_0x13c82a[_0xbfa1('0x61')][_0xbfa1('0xd1')]]=_0x13c82a[_0xbfa1('0x61')][_0xbfa1('0x96')];return db[_0xbfa1('0x8e')][_0xbfa1('0xd4')]({'where':_0x2380f4,'defaults':_0x454680});}})[_0xbfa1('0xbe')](function(_0x122571){if(_0x122571){_0x33d7f4=_0x122571;var _0x21df66=fs[_0xbfa1('0xd5')](path[_0xbfa1('0x83')](config[_0xbfa1('0x7d')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x4424e4=ejs[_0xbfa1('0xd6')](_0x21df66,{'body':_['toPairs'](_0x13c82a['body'][_0xbfa1('0x61')]),'bodyTitle':_0x405105[_0xbfa1('0xd7')]});return db[_0xbfa1('0xd8')][_0xbfa1('0x60')]({'body':_0x4424e4,'ContactId':_0x122571['id'],'ChatWebsiteId':_0x405105['id']});}})[_0xbfa1('0x23')](function(_0x583804){_0xe8c3b2=_0x583804;if(_0x5e3495[_0xbfa1('0x5d')]){var _0x5a2b57=_0x5e3495[_0xbfa1('0x47')](function(_0x52ddcb){return{'name':_0x52ddcb['originalname'],'basename':_0x52ddcb[_0xbfa1('0x77')],'type':_0x52ddcb[_0xbfa1('0xd9')],'ChatOfflineMessageId':_0x583804['id']};});_0x5aa6a8=_0x5a2b57[_0xbfa1('0x47')](_0x17347f=>{var _0x339c2e={'filename':_0x17347f[_0xbfa1('0x3f')],'path':path['join'](config[_0xbfa1('0x7d')],_0xbfa1('0xda'),_0xbfa1('0xce'),'attachments',_0xbfa1('0xdb'),_0x17347f['basename'])};return _0x339c2e;});if(!_0x405105[_0xbfa1('0xdc')]){return db[_0xbfa1('0xdd')][_0xbfa1('0xde')](function(_0x4e476d){return db[_0xbfa1('0xdf')][_0xbfa1('0xe0')](_0x5a2b57,{'transaction':_0x4e476d});});}}})[_0xbfa1('0x23')](function(){if(_0xe8c3b2){_0x18a9e3=_0xe8c3b2;return db[_0xbfa1('0xd3')][_0xbfa1('0x6d')]({'where':{'active':!![]},'include':[{'model':db[_0xbfa1('0xe1')],'as':_0xbfa1('0xe2'),'raw':!![]}]});}})[_0xbfa1('0x23')](function(_0x272cb7){if(_0x272cb7&&_0x272cb7[_0xbfa1('0xe2')]&&_0x405105['forwardOffline']&&_0x405105[_0xbfa1('0xe3')]){var _0x62d20c={'tls':{'rejectUnauthorized':![]}};if(_0x272cb7[_0xbfa1('0xe2')][_0xbfa1('0xe4')]){_0x62d20c['service']=_0x272cb7[_0xbfa1('0xe2')][_0xbfa1('0xe4')];}else{_0x62d20c[_0xbfa1('0xe5')]=_0x272cb7['Smtp'][_0xbfa1('0xe5')];_0x62d20c[_0xbfa1('0xe6')]=_0x272cb7[_0xbfa1('0xe2')]['port'];_0x62d20c[_0xbfa1('0xe7')]=_0x272cb7[_0xbfa1('0xe2')][_0xbfa1('0xe7')];}if(_0x272cb7[_0xbfa1('0xe2')][_0xbfa1('0xe8')]){_0x62d20c[_0xbfa1('0xe9')]={'user':_0x272cb7['Smtp'][_0xbfa1('0x63')],'pass':_0x272cb7[_0xbfa1('0xe2')][_0xbfa1('0xea')]};}return respondWithRpcPromise(_0xbfa1('0xeb'),_0xbfa1('0xec'),{'account':_0x62d20c,'message':{'from':util[_0xbfa1('0xb4')](_0xbfa1('0xed'),_0x272cb7[_0xbfa1('0x3f')],_0x272cb7[_0xbfa1('0xee')]||_0x272cb7[_0xbfa1('0xe2')][_0xbfa1('0x63')]),'to':_0x405105[_0xbfa1('0xe3')],'subject':_0x405105[_0xbfa1('0xef')],'html':_0x18a9e3['body'],'attachments':_0x5aa6a8}},client9003)[_0xbfa1('0x23')](function(){return _0x18a9e3;})[_0xbfa1('0x2d')](function(_0x350a3c){console[_0xbfa1('0x29')](_0x350a3c);});}})[_0xbfa1('0x23')](function(){if(_0x405105&&_0x405105[_0xbfa1('0xdc')]&&_0x405105['MailAccountId']){var _0x653c41=[];if(_0x5e3495['length']){_0x653c41=_0x5e3495['map'](function(_0x457185){return{'name':_0x457185[_0xbfa1('0xf0')],'basename':_0x457185[_0xbfa1('0x77')],'type':_0x457185['mimetype'],'ChatOfflineMessageId':_0xe8c3b2['id']};});}var _0x989c6b;if(!_[_0xbfa1('0x81')](_0x405105[_0xbfa1('0xf1')])){var _0x58d637=_[_0xbfa1('0x47')](_0x13c82a['body'],function(_0x5197d0){return _0x5197d0;});var _0x58c4d9=_[_0xbfa1('0xf2')](_0x58d637)[0x0];var _0x2b9acc=_['mapValues'](_0x58c4d9,function(_0x3af21e){return _0x3af21e;});_0x989c6b=_0x2b9acc[0x1][_0x405105[_0xbfa1('0xf1')]];}var _0xbfe18={'from':_0x33d7f4[_0xbfa1('0xee')],'firstName':_0x33d7f4[_0xbfa1('0xae')],'lastName':_0x33d7f4[_0xbfa1('0xaf')],'mapKey':'email','message':{'from':_0x33d7f4['email'],'to':_0x405105['MailAccount'][_0xbfa1('0xee')],'cc':'','subject':_[_0xbfa1('0x81')](_0x989c6b)?_0x405105['offlineMessageSubject']:_0x989c6b,'messageId':'','sentAt':new Date(),'attach':_0x653c41[_0xbfa1('0x5d')],'attachments':_0x653c41,'originChannel':_0xbfa1('0xf3'),'ChatWebsiteId':_0x405105['id'],'ChatOfflineMessageId':_0x18a9e3['id'],'originTo':_0x405105[_0xbfa1('0xd3')][_0xbfa1('0xee')]},'body':_0x18a9e3[_0xbfa1('0x61')]};var _0x4cfc7e={'account':{'id':_0x405105[_0xbfa1('0xf4')]},'body':_0xbfe18,'log':_0xbfa1('0xf5')};return respondWithRpcPromise(_0xbfa1('0xf5'),_0xbfa1('0xf6'),_0x4cfc7e,client9001)[_0xbfa1('0x23')](function(){return _0x18a9e3;})[_0xbfa1('0x2d')](function(_0xb4c102){console[_0xbfa1('0x29')](_0xb4c102);});}return;})['then'](function(){if(_0x18a9e3){return _0x18a9e3;}})[_0xbfa1('0x23')](respondWithResult(_0x42bc1c,null))[_0xbfa1('0x2d')](function(_0x3b3fd8){console[_0xbfa1('0x29')](_0xbfa1('0x2d'),_0x3b3fd8);for(var _0x438f97 of _0x5e3495){var _0xafc825=path['join'](config['root'],_0xbfa1('0xda'),_0xbfa1('0xce'),_0xbfa1('0xf7'),_0xbfa1('0xdb'),_0x438f97[_0xbfa1('0x77')]);fs_extra['remove'](_0xafc825)[_0xbfa1('0x2d')](function(_0x298f97){console[_0xbfa1('0x29')](_0xbfa1('0xf8'),_0xafc825,_0x298f97);});}});};exports[_0xbfa1('0xf9')]=function(_0x279991,_0x104a80,_0x243bdd){return db[_0xbfa1('0xbb')][_0xbfa1('0x5f')]({'where':{'id':_0x279991[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x104a80,null))['then'](function(_0x4ed2ad){if(_0x4ed2ad){return _0x4ed2ad[_0xbfa1('0xf9')](_0x279991[_0xbfa1('0x61')][_0xbfa1('0x70')],_[_0xbfa1('0xfa')](_0x279991[_0xbfa1('0x61')],[_0xbfa1('0x70'),'id'])||{});}})[_0xbfa1('0x23')](respondWithResult(_0x104a80,null))['catch'](handleError(_0x104a80,null));};exports[_0xbfa1('0xfb')]=function(_0x7d59e1,_0x5e7184,_0x39a6ab){var _0x4ee45c={'raw':![],'where':{}};var _0x5a7e9e={};var _0x36b4bd={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x7d59e1[_0xbfa1('0x69')]['id']}})['then'](handleEntityNotFound(_0x5e7184,null))[_0xbfa1('0x23')](function(_0x4cab93){if(_0x4cab93){_0x5a7e9e[_0xbfa1('0x46')]=_[_0xbfa1('0x5b')](db[_0xbfa1('0xbb')][_0xbfa1('0x43')]);_0x5a7e9e[_0xbfa1('0x48')]=_[_0xbfa1('0x5b')](_0x7d59e1['query']);_0x5a7e9e[_0xbfa1('0x49')]=_['intersection'](_0x5a7e9e['model'],_0x5a7e9e['query']);_0x4ee45c[_0xbfa1('0x4b')]=_['intersection'](_0x5a7e9e[_0xbfa1('0x46')],qs[_0xbfa1('0x5c')](_0x7d59e1['query'][_0xbfa1('0x5c')]));_0x4ee45c[_0xbfa1('0x4b')]=_0x4ee45c[_0xbfa1('0x4b')][_0xbfa1('0x5d')]?_0x4ee45c['attributes']:_0x5a7e9e[_0xbfa1('0x46')];if(!_0x7d59e1[_0xbfa1('0x48')][_0xbfa1('0x4c')](_0xbfa1('0x6e'))){_0x4ee45c[_0xbfa1('0x30')]=qs[_0xbfa1('0x30')](_0x7d59e1[_0xbfa1('0x48')]['limit']);_0x4ee45c[_0xbfa1('0x2f')]=qs['offset'](_0x7d59e1[_0xbfa1('0x48')][_0xbfa1('0x2f')]);}_0x4ee45c[_0xbfa1('0x4d')]=qs[_0xbfa1('0x4e')](_0x7d59e1[_0xbfa1('0x48')][_0xbfa1('0x4e')]);_0x4ee45c['where']=qs['filters'](_[_0xbfa1('0x50')](_0x7d59e1[_0xbfa1('0x48')],_0x5a7e9e[_0xbfa1('0x49')]));_0x4ee45c['where']['ChatWebsiteId']=_0x4cab93['id'];if(_0x7d59e1['query'][_0xbfa1('0x51')]){_0x4ee45c['where']=_[_0xbfa1('0x54')](_0x4ee45c[_0xbfa1('0x4f')],{'$or':_['map'](_0x4ee45c[_0xbfa1('0x4b')],function(_0x35ea44){var _0x240160={};_0x240160[_0x35ea44]={'$like':'%'+_0x7d59e1[_0xbfa1('0x48')]['filter']+'%'};return _0x240160;})});}_0x4ee45c=_[_0xbfa1('0x54')]({},_0x4ee45c,_0x7d59e1[_0xbfa1('0x5e')]);return db[_0xbfa1('0xbb')][_0xbfa1('0x32')]({'where':_0x4ee45c['where']})[_0xbfa1('0x23')](function(_0x54db05){_0x36b4bd[_0xbfa1('0x32')]=_0x54db05;if(_0x7d59e1['query'][_0xbfa1('0x56')]){_0x4ee45c[_0xbfa1('0x57')]=[{'model':db[_0xbfa1('0x8e')],'as':_0xbfa1('0xfc'),'required':![]},{'model':db[_0xbfa1('0xc7')],'as':'Owner','attributes':['name',_0xbfa1('0xfd'),_0xbfa1('0xfe')],'required':![]},{'model':db[_0xbfa1('0xff')],'as':_0xbfa1('0x100'),'attributes':['id',_0xbfa1('0x3f'),_0xbfa1('0x101')],'where':_0x7d59e1[_0xbfa1('0x48')][_0xbfa1('0x102')]?{'id':_0x7d59e1[_0xbfa1('0x48')][_0xbfa1('0x102')]}:undefined,'required':_0x7d59e1[_0xbfa1('0x48')][_0xbfa1('0x102')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x4ee45c);})[_0xbfa1('0x23')](function(_0x303302){_0x36b4bd['rows']=_0x303302;return _0x36b4bd;});}})[_0xbfa1('0x23')](respondWithFilteredResult(_0x5e7184,_0x4ee45c))[_0xbfa1('0x2d')](handleError(_0x5e7184,null));};function iftimePromise(_0x5e76e0,_0x1e12e1){return respondWithRpcPromise(_0xbfa1('0x103'),'getSnippet',{'command':_0x1e12e1[_0xbfa1('0x104')]?util[_0xbfa1('0xb4')](_0xbfa1('0x105'),_0x5e76e0[_0xbfa1('0x106')],_0x1e12e1[_0xbfa1('0x104')]):util[_0xbfa1('0xb4')](_0xbfa1('0x107'),_0x5e76e0[_0xbfa1('0x106')])},client9002)[_0xbfa1('0x23')](function(_0x2c7717){var _0x467363=_0x2c7717&&_0x2c7717[_0xbfa1('0x108')](_0xbfa1('0x109'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1e12e1['id'],_0x5e76e0['id'],_0x5e76e0[_0xbfa1('0x106')],_0x467363?_0xbfa1('0x10a'):_0xbfa1('0x10b'),_0x1e12e1[_0xbfa1('0x104')]?_0x1e12e1[_0xbfa1('0x104')]:_0xbfa1('0x10c'));return _0x467363;})[_0xbfa1('0x2d')](function(_0x60fa96){logger[_0xbfa1('0x29')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x1e12e1['id'],_0x5e76e0['id'],_0x5e76e0[_0xbfa1('0x106')],util[_0xbfa1('0x10d')](_0x60fa96,{'showHidden':![],'depth':null}),_0x1e12e1[_0xbfa1('0x104')]?_0x1e12e1[_0xbfa1('0x104')]:'No\x20timezone');return![];});}exports[_0xbfa1('0x10e')]=function(_0x2b2724,_0x4858e6,_0xc390c7){var _0x5cee54=0x0;var _0x4057e2=0x0;var _0x163951=![];var _0x56d6d4;var _0x37015e;return db[_0xbfa1('0x55')][_0xbfa1('0x5f')]({'where':{'id':_0x2b2724['params']['id']},'include':[{'model':db[_0xbfa1('0x10f')],'as':'Interval','include':[{'model':db[_0xbfa1('0x10f')],'as':_0xbfa1('0x110'),'attributes':['id',_0xbfa1('0x106')],'raw':!![]}]}]})[_0xbfa1('0x23')](handleEntityNotFound(_0x4858e6,null))[_0xbfa1('0x23')](function(_0x2e38ac){if(_0x2e38ac){_0x56d6d4=_0x2e38ac;return _0x2e38ac['getProactiveActions']({'raw':!![]});}})[_0xbfa1('0x23')](function(_0x1b76fd){if(_0x56d6d4){if(_0x1b76fd){_0x37015e=_0x1b76fd;}}return require(_0xbfa1('0x1d'))[_0xbfa1('0x80')]();})[_0xbfa1('0x23')](function(_0x24eead){if(_0x24eead){_0x4057e2=_0x24eead[_0xbfa1('0x111')];_0x163951=_0x24eead[_0xbfa1('0x112')];}})[_0xbfa1('0x23')](function(){return db[_0xbfa1('0xbb')]['count']({'where':{'closed':![]}});})[_0xbfa1('0x23')](function(_0x11e79e){_0x5cee54=_0x11e79e;if(_0x4057e2&&_0x11e79e>_0x4057e2){return db[_0xbfa1('0x113')][_0xbfa1('0x6d')]({'where':{'id':0x1}})['then'](function(_0x46d69b){if(_0x46d69b){_0x46d69b[_0xbfa1('0x114')]('chatLicenseExceeded');}});}})[_0xbfa1('0x23')](function(){if(_0x56d6d4[_0xbfa1('0x10f')]&&_0x56d6d4[_0xbfa1('0x10f')][_0xbfa1('0x110')]){var _0x466dac=[];for(var _0x17674f=0x0;_0x17674f<_0x56d6d4[_0xbfa1('0x10f')][_0xbfa1('0x110')][_0xbfa1('0x5d')];_0x17674f++){var _0x1d0173=_0x56d6d4[_0xbfa1('0x10f')]['Intervals'][_0x17674f]['get']({'plain':!![]});_0x466dac['push'](iftimePromise(_0x1d0173,_0x56d6d4));}return BPromise[_0xbfa1('0x115')](_0x466dac)[_0xbfa1('0x23')](function(_0xc36cf2){return _[_0xbfa1('0x116')](_0xc36cf2);});}else{return!![];}})['then'](function(_0x39b41e){var _0x4974be=fs[_0xbfa1('0xd5')](path[_0xbfa1('0x83')](config['root'],_0xbfa1('0x117')),'utf8');var _0x1eca27={'remote':_0x56d6d4[_0xbfa1('0x118')],'query':querystring['stringify'](_['merge'](_0x56d6d4[_0xbfa1('0x39')]({'plain':!![]}),{'customerIp':_0x2b2724['headers'][_0xbfa1('0xab')]||_0x2b2724[_0xbfa1('0xa9')][_0xbfa1('0x119')]||_0x2b2724[_0xbfa1('0x11a')][_0xbfa1('0x11b')]||_0x2b2724['ip'],'referer':_0x2b2724[_0xbfa1('0xa9')][_0xbfa1('0xb1')],'openedInteractions':_0x5cee54,'maxInteractions':_0x4057e2,'virtual':_0x163951['virtual'],'online':_0x39b41e,'custom':_0x163951}))['replace'](/'/g,'\x5c\x27')};_0x4858e6[_0xbfa1('0x40')](ejs[_0xbfa1('0xd6')](Mustache[_0xbfa1('0xd6')](_0x4974be,_0x1eca27),{'proactiveActions':_0x37015e,'alignment':_0x56d6d4['alignment'],'verticalAlignment':_0x56d6d4[_0xbfa1('0x11c')],'div_color':_0x56d6d4['color'],'text_color':_0x56d6d4['textColor'],'button_color':_0x56d6d4[_0xbfa1('0x11d')],'background_color':_0x56d6d4[_0xbfa1('0x11e')]}));})[_0xbfa1('0x2d')](handleError(_0x4858e6,null));};exports[_0xbfa1('0x11f')]=function(_0xa6b4e1,_0x72ea9a,_0x469a38){return db[_0xbfa1('0x55')][_0xbfa1('0x6d')]({'where':{'id':_0xa6b4e1[_0xbfa1('0x69')]['id']}})['then'](handleEntityNotFound(_0x72ea9a,null))['then'](function(_0x11efa9){if(_0x11efa9){return db[_0xbfa1('0xdd')][_0xbfa1('0xde')](function(_0x6cc3ff){return db['ChatApplication'][_0xbfa1('0x38')]({'where':{'ChatWebsiteId':_0xa6b4e1['params']['id']},'transaction':_0x6cc3ff})[_0xbfa1('0x23')](function(_0x156a2b){var _0x2e5adf=_['map'](_0xa6b4e1[_0xbfa1('0x61')],function(_0x286429){_0x286429[_0xbfa1('0x6a')]=_0xa6b4e1[_0xbfa1('0x69')]['id'];return _0x286429;});return db['ChatApplication'][_0xbfa1('0xe0')](_0x2e5adf,{'transaction':_0x6cc3ff});});})[_0xbfa1('0x23')](function(){return db[_0xbfa1('0x9f')][_0xbfa1('0x120')]({'where':{'ChatWebsiteId':_0xa6b4e1[_0xbfa1('0x69')]['id']},'order':_0xbfa1('0x121')});});}})[_0xbfa1('0x23')](respondWithResult(_0x72ea9a,null))[_0xbfa1('0x2d')](handleError(_0x72ea9a,null));};exports[_0xbfa1('0x122')]=function(_0x57b837,_0x58dfe6,_0xa64f4f){var _0x46726d={};var _0xd3ab16={};var _0x779dc7;var _0x56a89a;return db[_0xbfa1('0x55')][_0xbfa1('0x6d')]({'where':{'id':_0x57b837['params']['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x58dfe6,null))['then'](function(_0x158c16){if(_0x158c16){_0x779dc7=_0x158c16;_0xd3ab16[_0xbfa1('0x46')]=_[_0xbfa1('0x5b')](db['ChatApplication'][_0xbfa1('0x43')]);_0xd3ab16[_0xbfa1('0x48')]=_[_0xbfa1('0x5b')](_0x57b837[_0xbfa1('0x48')]);_0xd3ab16[_0xbfa1('0x49')]=_[_0xbfa1('0x4a')](_0xd3ab16[_0xbfa1('0x46')],_0xd3ab16['query']);_0x46726d[_0xbfa1('0x4b')]=_[_0xbfa1('0x4a')](_0xd3ab16[_0xbfa1('0x46')],qs['fields'](_0x57b837[_0xbfa1('0x48')]['fields']));_0x46726d[_0xbfa1('0x4b')]=_0x46726d[_0xbfa1('0x4b')][_0xbfa1('0x5d')]?_0x46726d[_0xbfa1('0x4b')]:_0xd3ab16['model'];_0x46726d[_0xbfa1('0x4d')]=qs[_0xbfa1('0x4e')](_0x57b837[_0xbfa1('0x48')][_0xbfa1('0x4e')]);_0x46726d[_0xbfa1('0x4f')]=qs[_0xbfa1('0x49')](_[_0xbfa1('0x50')](_0x57b837[_0xbfa1('0x48')],_0xd3ab16['filters']));if(_0x57b837[_0xbfa1('0x48')][_0xbfa1('0x51')]){_0x46726d['where']=_[_0xbfa1('0x54')](_0x46726d[_0xbfa1('0x4f')],{'$or':_[_0xbfa1('0x47')](_0x46726d[_0xbfa1('0x4b')],function(_0x16b06f){var _0x52e6a2={};_0x52e6a2[_0x16b06f]={'$like':'%'+_0x57b837[_0xbfa1('0x48')]['filter']+'%'};return _0x52e6a2;})});}_0x46726d=_[_0xbfa1('0x54')]({},_0x46726d,_0x57b837[_0xbfa1('0x5e')]);return _0x779dc7[_0xbfa1('0x122')](_0x46726d);}})[_0xbfa1('0x23')](function(_0x464422){if(_0x464422){_0x56a89a=_0x464422[_0xbfa1('0x5d')];if(!_0x57b837[_0xbfa1('0x48')][_0xbfa1('0x4c')](_0xbfa1('0x6e'))){_0x46726d[_0xbfa1('0x30')]=qs[_0xbfa1('0x30')](_0x57b837['query'][_0xbfa1('0x30')]);_0x46726d[_0xbfa1('0x2f')]=qs[_0xbfa1('0x2f')](_0x57b837[_0xbfa1('0x48')][_0xbfa1('0x2f')]);}return _0x779dc7[_0xbfa1('0x122')](_0x46726d);}})[_0xbfa1('0x23')](function(_0x551c99){if(_0x551c99){return _0x551c99?{'count':_0x56a89a,'rows':_0x551c99}:null;}})[_0xbfa1('0x23')](respondWithResult(_0x58dfe6,null))['catch'](handleError(_0x58dfe6,null));};exports[_0xbfa1('0x123')]=function(_0x1058b4,_0x3636c2,_0x2db5f5){return db[_0xbfa1('0x124')]['find']({'where':{'id':_0x1058b4[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x3636c2,null))['then'](function(_0x2afbf3){if(_0x2afbf3){return _0x2afbf3['addProactiveActions'](_0x1058b4['body'][_0xbfa1('0x70')],_[_0xbfa1('0xfa')](_0x1058b4[_0xbfa1('0x61')],[_0xbfa1('0x70'),'id'])||{});}})[_0xbfa1('0x23')](respondWithResult(_0x3636c2,null))[_0xbfa1('0x2d')](handleError(_0x3636c2,null));};exports['getProactiveActions']=function(_0x4a7edb,_0x2ed3d6,_0xee0f21){var _0x1506df={};var _0x37d655={};var _0x581a08;var _0x14b45f;return db[_0xbfa1('0x55')][_0xbfa1('0x6d')]({'where':{'id':_0x4a7edb[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x2ed3d6,null))[_0xbfa1('0x23')](function(_0x534675){if(_0x534675){_0x581a08=_0x534675;_0x37d655['model']=_[_0xbfa1('0x5b')](db[_0xbfa1('0x125')][_0xbfa1('0x43')]);_0x37d655[_0xbfa1('0x48')]=_[_0xbfa1('0x5b')](_0x4a7edb[_0xbfa1('0x48')]);_0x37d655[_0xbfa1('0x49')]=_[_0xbfa1('0x4a')](_0x37d655[_0xbfa1('0x46')],_0x37d655['query']);_0x1506df[_0xbfa1('0x4b')]=_[_0xbfa1('0x4a')](_0x37d655['model'],qs[_0xbfa1('0x5c')](_0x4a7edb[_0xbfa1('0x48')]['fields']));_0x1506df['attributes']=_0x1506df[_0xbfa1('0x4b')][_0xbfa1('0x5d')]?_0x1506df['attributes']:_0x37d655[_0xbfa1('0x46')];_0x1506df[_0xbfa1('0x4d')]=qs[_0xbfa1('0x4e')](_0x4a7edb['query'][_0xbfa1('0x4e')]);_0x1506df['where']=qs[_0xbfa1('0x49')](_[_0xbfa1('0x50')](_0x4a7edb[_0xbfa1('0x48')],_0x37d655[_0xbfa1('0x49')]));if(_0x4a7edb[_0xbfa1('0x48')][_0xbfa1('0x51')]){_0x1506df[_0xbfa1('0x4f')]=_[_0xbfa1('0x54')](_0x1506df[_0xbfa1('0x4f')],{'$or':_[_0xbfa1('0x47')](_0x1506df['attributes'],function(_0x5c2033){var _0x4457a5={};_0x4457a5[_0x5c2033]={'$like':'%'+_0x4a7edb['query'][_0xbfa1('0x51')]+'%'};return _0x4457a5;})});}_0x1506df=_[_0xbfa1('0x54')]({},_0x1506df,_0x4a7edb[_0xbfa1('0x5e')]);return _0x581a08[_0xbfa1('0x126')](_0x1506df);}})[_0xbfa1('0x23')](function(_0x296834){if(_0x296834){_0x14b45f=_0x296834[_0xbfa1('0x5d')];if(!_0x4a7edb[_0xbfa1('0x48')]['hasOwnProperty'](_0xbfa1('0x6e'))){_0x1506df[_0xbfa1('0x30')]=qs[_0xbfa1('0x30')](_0x4a7edb[_0xbfa1('0x48')][_0xbfa1('0x30')]);_0x1506df['offset']=qs[_0xbfa1('0x2f')](_0x4a7edb[_0xbfa1('0x48')][_0xbfa1('0x2f')]);}return _0x581a08[_0xbfa1('0x126')](_0x1506df);}})[_0xbfa1('0x23')](function(_0x38a872){if(_0x38a872){return _0x38a872?{'count':_0x14b45f,'rows':_0x38a872}:null;}})[_0xbfa1('0x23')](respondWithResult(_0x2ed3d6,null))[_0xbfa1('0x2d')](handleError(_0x2ed3d6,null));};exports[_0xbfa1('0x127')]=function(_0x2a26c6,_0x5e6c70,_0x5f2b64){var _0x4dd2e8=_0x2a26c6[_0xbfa1('0x48')][_0xbfa1('0x128')]==='false'?'offlineForm':_0xbfa1('0x129');return db[_0xbfa1('0x55')]['find']({'attributes':['id',_0x4dd2e8],'where':{'id':_0x2a26c6[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x5e6c70,null))[_0xbfa1('0x23')](function(_0x57ade5){if(_0x57ade5){var _0x341758=_0x57ade5[_0x4dd2e8];var _0x593eb9=_0x341758&&_0x341758[_0xbfa1('0x12a')]?_0x341758[_0xbfa1('0x12a')]:[];_0x5e6c70[_0xbfa1('0x40')]({'fromKey':_[_0xbfa1('0x81')](_0x341758[_0xbfa1('0x12b')])?undefined:_0x341758[_0xbfa1('0x12b')],'count':_0x593eb9[_0xbfa1('0x5d')],'rows':_0x593eb9});}})['catch'](handleError(_0x5e6c70,null));};exports[_0xbfa1('0x12c')]=function(_0x3ea5ab,_0x4221be,_0xc3583a){var _0x270cde={'raw':![],'where':{}};var _0x43d811={};var _0xee4fc6={'count':0x0,'rows':[]};return db[_0xbfa1('0x55')][_0xbfa1('0x6d')]({'where':{'id':_0x3ea5ab[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x4221be,null))[_0xbfa1('0x23')](function(_0x51f55d){if(_0x51f55d){_0x43d811[_0xbfa1('0x46')]=_[_0xbfa1('0x5b')](db[_0xbfa1('0xd8')][_0xbfa1('0x43')]);_0x43d811['query']=_[_0xbfa1('0x5b')](_0x3ea5ab[_0xbfa1('0x48')]);_0x43d811[_0xbfa1('0x49')]=_[_0xbfa1('0x4a')](_0x43d811[_0xbfa1('0x46')],_0x43d811[_0xbfa1('0x48')]);_0x270cde[_0xbfa1('0x4b')]=_[_0xbfa1('0x4a')](_0x43d811[_0xbfa1('0x46')],qs['fields'](_0x3ea5ab[_0xbfa1('0x48')][_0xbfa1('0x5c')]));_0x270cde[_0xbfa1('0x4b')]=_0x270cde['attributes']['length']?_0x270cde[_0xbfa1('0x4b')]:_0x43d811[_0xbfa1('0x46')];if(!_0x3ea5ab[_0xbfa1('0x48')]['hasOwnProperty'](_0xbfa1('0x6e'))){_0x270cde[_0xbfa1('0x30')]=qs[_0xbfa1('0x30')](_0x3ea5ab[_0xbfa1('0x48')][_0xbfa1('0x30')]);_0x270cde[_0xbfa1('0x2f')]=qs[_0xbfa1('0x2f')](_0x3ea5ab[_0xbfa1('0x48')][_0xbfa1('0x2f')]);}_0x270cde[_0xbfa1('0x4d')]=qs[_0xbfa1('0x4e')](_0x3ea5ab[_0xbfa1('0x48')][_0xbfa1('0x4e')]);_0x270cde[_0xbfa1('0x4f')]=qs[_0xbfa1('0x49')](_[_0xbfa1('0x50')](_0x3ea5ab[_0xbfa1('0x48')],_0x43d811['filters']));_0x270cde['where'][_0xbfa1('0x6a')]=_0x51f55d['id'];if(_0x3ea5ab[_0xbfa1('0x48')][_0xbfa1('0x51')]){_0x270cde['where']=_['merge'](_0x270cde[_0xbfa1('0x4f')],{'$or':_['map'](_0x270cde['attributes'],function(_0xb38fc){var _0x5f2186={};_0x5f2186[_0xb38fc]={'$like':'%'+_0x3ea5ab['query'][_0xbfa1('0x51')]+'%'};return _0x5f2186;})});}_0x270cde=_['merge']({},_0x270cde,_0x3ea5ab[_0xbfa1('0x5e')]);return db[_0xbfa1('0xd8')]['count']({'where':_0x270cde['where']})['then'](function(_0x228916){_0xee4fc6[_0xbfa1('0x32')]=_0x228916;if(_0x3ea5ab[_0xbfa1('0x48')][_0xbfa1('0x56')]){_0x270cde[_0xbfa1('0x57')]=[{'all':!![]}];}else{_0x270cde[_0xbfa1('0x57')]=[{'model':db[_0xbfa1('0x8e')],'as':'Contact','required':![]},{'model':db['Attachment'],'as':_0xbfa1('0x12d'),'required':![]}];}return db['ChatOfflineMessage'][_0xbfa1('0x58')](_0x270cde);})[_0xbfa1('0x23')](function(_0x337137){_0xee4fc6[_0xbfa1('0x59')]=_0x337137;return _0xee4fc6;});}})['then'](respondWithFilteredResult(_0x4221be,_0x270cde))[_0xbfa1('0x2d')](handleError(_0x4221be,null));};exports[_0xbfa1('0x12e')]=function(_0x213851,_0x54fd01,_0x536146){return db[_0xbfa1('0x55')][_0xbfa1('0x5f')]({'where':{'id':_0x213851['params']['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x54fd01,null))[_0xbfa1('0x23')](function(_0x1f50a1){if(_0x1f50a1){return _0x1f50a1['addAgents'](_0x213851[_0xbfa1('0x61')][_0xbfa1('0x70')],_['omit'](_0x213851[_0xbfa1('0x61')],['ids','id'])||{})['spread'](function(_0x3fa795){for(var _0x974be3=0x0;_0x974be3<_0x213851[_0xbfa1('0x61')][_0xbfa1('0x70')]['length'];_0x974be3+=0x1){socket[_0xbfa1('0x12f')](_0xbfa1('0x130'),{'UserId':Number(_0x213851['body']['ids'][_0x974be3]),'ChatWebsiteId':Number(_0x213851['params']['id'])});}return _0x3fa795;});}})[_0xbfa1('0x23')](respondWithResult(_0x54fd01,null))['catch'](handleError(_0x54fd01,null));};exports[_0xbfa1('0x131')]=function(_0x241e52,_0x22d8bf,_0x5b0f70){return db[_0xbfa1('0x55')][_0xbfa1('0x5f')]({'where':{'id':_0x241e52[_0xbfa1('0x69')]['id']}})['then'](handleEntityNotFound(_0x22d8bf,null))[_0xbfa1('0x23')](function(_0x21f1ad){if(_0x21f1ad){return _0x21f1ad[_0xbfa1('0x131')](_0x241e52[_0xbfa1('0x48')][_0xbfa1('0x70')])['then'](function(){if(_[_0xbfa1('0x132')](_0x241e52[_0xbfa1('0x48')][_0xbfa1('0x70')])){for(var _0x51cc81=0x0;_0x51cc81<_0x241e52[_0xbfa1('0x48')]['ids'][_0xbfa1('0x5d')];_0x51cc81+=0x1){socket[_0xbfa1('0x12f')](_0xbfa1('0x133'),{'UserId':Number(_0x241e52[_0xbfa1('0x48')][_0xbfa1('0x70')][_0x51cc81]),'ChatWebsiteId':Number(_0x241e52[_0xbfa1('0x69')]['id'])});}}else{socket['emit'](_0xbfa1('0x133'),{'UserId':Number(_0x241e52['query']['ids']),'ChatWebsiteId':Number(_0x241e52[_0xbfa1('0x69')]['id'])});}});}})['then'](respondWithStatusCode(_0x22d8bf,null))['catch'](handleError(_0x22d8bf,null));};exports[_0xbfa1('0x134')]=function(_0x3eaaf1,_0x3be0cb,_0x47a100){var _0x224778={};var _0x1568dd={};var _0x51b0bb;var _0x57da96;return db[_0xbfa1('0x55')][_0xbfa1('0x6d')]({'where':{'id':_0x3eaaf1[_0xbfa1('0x69')]['id']}})[_0xbfa1('0x23')](handleEntityNotFound(_0x3be0cb,null))[_0xbfa1('0x23')](function(_0x2967b0){if(_0x2967b0){_0x51b0bb=_0x2967b0;_0x1568dd[_0xbfa1('0x46')]=_[_0xbfa1('0x5b')](db[_0xbfa1('0xc7')]['rawAttributes']);_0x1568dd[_0xbfa1('0x48')]=_[_0xbfa1('0x5b')](_0x3eaaf1[_0xbfa1('0x48')]);_0x1568dd[_0xbfa1('0x49')]=_[_0xbfa1('0x4a')](_0x1568dd[_0xbfa1('0x46')],_0x1568dd[_0xbfa1('0x48')]);_0x224778[_0xbfa1('0x4b')]=_[_0xbfa1('0x4a')](_0x1568dd[_0xbfa1('0x46')],qs['fields'](_0x3eaaf1[_0xbfa1('0x48')]['fields']));_0x224778['attributes']=_0x224778[_0xbfa1('0x4b')][_0xbfa1('0x5d')]?_0x224778[_0xbfa1('0x4b')]:_0x1568dd[_0xbfa1('0x46')];_0x224778[_0xbfa1('0x4d')]=qs[_0xbfa1('0x4e')](_0x3eaaf1['query'][_0xbfa1('0x4e')]);_0x224778[_0xbfa1('0x4f')]=qs[_0xbfa1('0x49')](_[_0xbfa1('0x50')](_0x3eaaf1[_0xbfa1('0x48')],_0x1568dd['filters']));if(_0x3eaaf1[_0xbfa1('0x48')][_0xbfa1('0x51')]){_0x224778[_0xbfa1('0x4f')]=_[_0xbfa1('0x54')](_0x224778[_0xbfa1('0x4f')],{'$or':_[_0xbfa1('0x47')](_0x224778[_0xbfa1('0x4b')],function(_0x51b7bf){var _0xe5ddf9={};_0xe5ddf9[_0x51b7bf]={'$like':'%'+_0x3eaaf1['query'][_0xbfa1('0x51')]+'%'};return _0xe5ddf9;})});}_0x224778=_['merge']({},_0x224778,_0x3eaaf1['options']);return _0x51b0bb[_0xbfa1('0x134')](_0x224778);}})['then'](function(_0x19e422){if(_0x19e422){_0x57da96=_0x19e422[_0xbfa1('0x5d')];if(!_0x3eaaf1[_0xbfa1('0x48')][_0xbfa1('0x4c')](_0xbfa1('0x6e'))){_0x224778[_0xbfa1('0x30')]=qs[_0xbfa1('0x30')](_0x3eaaf1['query']['limit']);_0x224778[_0xbfa1('0x2f')]=qs['offset'](_0x3eaaf1[_0xbfa1('0x48')][_0xbfa1('0x2f')]);}return _0x51b0bb['getAgents'](_0x224778);}})[_0xbfa1('0x23')](function(_0x3b5da5){if(_0x3b5da5){return _0x3b5da5?{'count':_0x57da96,'rows':_0x3b5da5}:null;}})['then'](respondWithResult(_0x3be0cb,null))[_0xbfa1('0x2d')](handleError(_0x3be0cb,null));}; \ No newline at end of file +var _0x3888=['getProactiveActions','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','offset','count','Content-Range','apply','reject','save','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','map','ChatWebsite','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','params','mandatoryDispositionPause','keys','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','Disposition','getDispositions','findOne','includeAll','removeDispositions','addAnswer','getAnswers','CannedAnswer','ChatWebsiteId','removeAnswers','ids','file','filename','addAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','sitepic','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','agentAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','setUA','headers','getResult','chat','CmContact','describe','Sequelize','ValidationError','difference','createdAt','CompanyId','ListId','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','updatedAt','DESC','ChatApplication','Applications','List','account','applications','list','priority','asc','Contacts','contact','customerIp','cf-connecting-ip','first','split','firstName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','ContactId','interaction','spread','messageId','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','notify','offline','files','no\x20available\x20attributes','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','forwardOffline','forwardOfflineAddress','service','Smtp','host','port','secure','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','lastName','Chat','NotifyMailAccount','notifyMail','remove','addInteraction','omit','Contact','User','internal','Tags','color','tag','Command','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','Interval','Intervals','virtual','License','increment','chatLicenseExceeded','all','some','server/files/chat/iframe.ejs','remote','x-forwarded-for','connection','remoteAddress','render','alignment','verticalAlignment','backgroundColor','addApplications','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction'];(function(_0x42020e,_0x4b92fb){var _0x561551=function(_0xf8216){while(--_0xf8216){_0x42020e['push'](_0x42020e['shift']());}};_0x561551(++_0x4b92fb);}(_0x3888,0x14e));var _0x8388=function(_0x34ad55,_0x2fb590){_0x34ad55=_0x34ad55-0x0;var _0x4239f9=_0x3888[_0x34ad55];return _0x4239f9;};'use strict';var emlformat=require(_0x8388('0x0'));var rimraf=require(_0x8388('0x1'));var zipdir=require(_0x8388('0x2'));var jsonpatch=require(_0x8388('0x3'));var rp=require(_0x8388('0x4'));var moment=require(_0x8388('0x5'));var BPromise=require(_0x8388('0x6'));var Mustache=require(_0x8388('0x7'));var util=require(_0x8388('0x8'));var path=require(_0x8388('0x9'));var sox=require(_0x8388('0xa'));var csv=require(_0x8388('0xb'));var ejs=require(_0x8388('0xc'));var fs=require('fs');var fs_extra=require(_0x8388('0xd'));var _=require(_0x8388('0xe'));var squel=require(_0x8388('0xf'));var crypto=require(_0x8388('0x10'));var jsforce=require(_0x8388('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x8388('0xb'));var querystring=require(_0x8388('0x12'));var Papa=require('papaparse');var Redis=require(_0x8388('0x13'));var authService=require(_0x8388('0x14'));var qs=require(_0x8388('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8388('0x16'));var logger=require(_0x8388('0x17'))('api');var utils=require(_0x8388('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8388('0x19'))['db'];config[_0x8388('0x1a')]=_[_0x8388('0x1b')](config[_0x8388('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x8388('0x1c'))(new Redis(config[_0x8388('0x1a')]));require(_0x8388('0x1d'))[_0x8388('0x1e')](socket);var jayson=require(_0x8388('0x1f'));var client=jayson['client'][_0x8388('0x20')]({'port':0x232c});var client9002=jayson[_0x8388('0x21')]['http']({'port':0x232a});var client9003=jayson[_0x8388('0x21')]['http']({'port':0x232b});var client9001=jayson[_0x8388('0x21')][_0x8388('0x20')]({'port':0x2329});function respondWithRpcPromise(_0x424e6e,_0x234df2,_0x40d97c,_0x572c8e){return new BPromise(function(_0x58b7e1,_0x4e710a){var _0x3b9841=_0x572c8e||client;return _0x3b9841[_0x8388('0x22')](_0x424e6e,_0x40d97c)[_0x8388('0x23')](function(_0x26c500){logger[_0x8388('0x24')](_0x8388('0x25'),_0x234df2,_0x8388('0x26'));logger[_0x8388('0x27')](_0x8388('0x28'),_0x234df2,_0x8388('0x26'),JSON[_0x8388('0x29')](_0x26c500));if(_0x26c500['error']){if(_0x26c500[_0x8388('0x2a')][_0x8388('0x2b')]===0x1f4){logger['error'](_0x8388('0x25'),_0x234df2,_0x26c500[_0x8388('0x2a')][_0x8388('0x2c')]);return _0x4e710a(_0x26c500[_0x8388('0x2a')]['message']);}logger[_0x8388('0x2a')]('ChatWebsite,\x20%s,\x20%s',_0x234df2,_0x26c500[_0x8388('0x2a')][_0x8388('0x2c')]);return _0x58b7e1(_0x26c500['error'][_0x8388('0x2c')]);}else{logger[_0x8388('0x24')]('ChatWebsite,\x20%s,\x20%s',_0x234df2,_0x8388('0x26'));_0x58b7e1(_0x26c500[_0x8388('0x2d')][_0x8388('0x2c')]);}})[_0x8388('0x2e')](function(_0x491d00){logger[_0x8388('0x2a')](_0x8388('0x25'),_0x234df2,_0x491d00);_0x4e710a(_0x491d00);});});}function respondWithStatusCode(_0x2d8ed4,_0xc829a6){_0xc829a6=_0xc829a6||0xcc;return function(_0xa0ee2f){if(_0xa0ee2f){return _0x2d8ed4[_0x8388('0x2f')](_0xc829a6);}return _0x2d8ed4[_0x8388('0x30')](_0xc829a6)[_0x8388('0x31')]();};}function respondWithResult(_0x32e4ae,_0x4b4c1b){_0x4b4c1b=_0x4b4c1b||0xc8;return function(_0x67450f){if(_0x67450f){return _0x32e4ae[_0x8388('0x30')](_0x4b4c1b)[_0x8388('0x32')](_0x67450f);}};}function respondWithFilteredResult(_0x29915a,_0x386006){return function(_0x315b09){if(_0x315b09){var _0x52504b=typeof _0x386006['offset']==='undefined'&&typeof _0x386006[_0x8388('0x33')]===_0x8388('0x34');var _0x59e6cc=_0x315b09['count'];var _0x5a1816=_0x52504b?0x0:_0x386006[_0x8388('0x35')];var _0x4fae55=_0x52504b?_0x315b09[_0x8388('0x36')]:_0x386006[_0x8388('0x35')]+_0x386006[_0x8388('0x33')];var _0x327636;if(_0x4fae55>=_0x59e6cc){_0x4fae55=_0x59e6cc;_0x327636=0xc8;}else{_0x327636=0xce;}_0x29915a[_0x8388('0x30')](_0x327636);return _0x29915a['set'](_0x8388('0x37'),_0x5a1816+'-'+_0x4fae55+'/'+_0x59e6cc)['json'](_0x315b09);}return null;};}function patchUpdates(_0x16670c){return function(_0x11f644){try{jsonpatch[_0x8388('0x38')](_0x11f644,_0x16670c,!![]);}catch(_0x2f818d){return BPromise[_0x8388('0x39')](_0x2f818d);}return _0x11f644[_0x8388('0x3a')]();};}function saveUpdates(_0x4b06f3,_0x4d8d5f){return function(_0x305512){if(_0x305512){return _0x305512[_0x8388('0x3b')](_0x4b06f3)[_0x8388('0x23')](function(_0x4056cd){return _0x4056cd;});}return null;};}function removeEntity(_0x242332,_0xa5401b){return function(_0x124728){if(_0x124728){return _0x124728[_0x8388('0x3c')]()[_0x8388('0x23')](function(){var _0x53dbc3=_0x124728[_0x8388('0x3d')]({'plain':!![]});var _0x2a415f=_0x8388('0x3e');return db[_0x8388('0x3f')][_0x8388('0x3c')]({'where':{'type':_0x2a415f,'resourceId':_0x53dbc3['id']}})[_0x8388('0x23')](function(){return _0x124728;});})[_0x8388('0x23')](function(){_0x242332[_0x8388('0x30')](0xcc)[_0x8388('0x31')]();});}};}function handleEntityNotFound(_0x59dfed,_0x13f7f1){return function(_0x471897){if(!_0x471897){_0x59dfed['sendStatus'](0x194);}return _0x471897;};}function handleError(_0x31b299,_0x17a177){_0x17a177=_0x17a177||0x1f4;return function(_0x102925){logger[_0x8388('0x2a')](_0x102925[_0x8388('0x40')]);if(_0x102925[_0x8388('0x41')]){delete _0x102925['name'];}_0x31b299[_0x8388('0x30')](_0x17a177)[_0x8388('0x42')](_0x102925);};}exports[_0x8388('0x43')]=function(_0x534a88,_0x38d284){var _0x43bad6={'include':[{'model':db[_0x8388('0x44')],'as':'mandatoryDispositionPause'}]},_0x37c6bc={},_0x3fcefd={'count':0x0,'rows':[]};var _0x29ef80=_[_0x8388('0x45')](db[_0x8388('0x46')][_0x8388('0x47')],function(_0x18a13a){return{'name':_0x18a13a[_0x8388('0x48')],'type':_0x18a13a[_0x8388('0x49')][_0x8388('0x4a')]};});_0x37c6bc[_0x8388('0x4b')]=_['map'](_0x29ef80,_0x8388('0x41'));_0x37c6bc['query']=_['keys'](_0x534a88[_0x8388('0x4c')]);_0x37c6bc['filters']=_[_0x8388('0x4d')](_0x37c6bc[_0x8388('0x4b')],_0x37c6bc[_0x8388('0x4c')]);_0x43bad6['attributes']=_['intersection'](_0x37c6bc[_0x8388('0x4b')],qs[_0x8388('0x4e')](_0x534a88[_0x8388('0x4c')][_0x8388('0x4e')]));_0x43bad6[_0x8388('0x4f')]=_0x43bad6[_0x8388('0x4f')][_0x8388('0x50')]?_0x43bad6[_0x8388('0x4f')]:_0x37c6bc[_0x8388('0x4b')];if(!_0x534a88[_0x8388('0x4c')][_0x8388('0x51')](_0x8388('0x52'))){_0x43bad6[_0x8388('0x33')]=qs[_0x8388('0x33')](_0x534a88['query'][_0x8388('0x33')]);_0x43bad6[_0x8388('0x35')]=qs['offset'](_0x534a88[_0x8388('0x4c')][_0x8388('0x35')]);}_0x43bad6[_0x8388('0x53')]=qs[_0x8388('0x54')](_0x534a88['query'][_0x8388('0x54')]);_0x43bad6[_0x8388('0x55')]=qs['filters'](_[_0x8388('0x56')](_0x534a88['query'],_0x37c6bc[_0x8388('0x57')]),_0x29ef80);if(_0x534a88[_0x8388('0x4c')][_0x8388('0x58')]){_0x43bad6['where']=_[_0x8388('0x59')](_0x43bad6[_0x8388('0x55')],{'$or':_[_0x8388('0x45')](_0x29ef80,function(_0x1d4f4e){if(_0x1d4f4e['type']!==_0x8388('0x5a')){var _0x400677={};_0x400677[_0x1d4f4e['name']]={'$like':'%'+_0x534a88[_0x8388('0x4c')][_0x8388('0x58')]+'%'};return _0x400677;}})});}_0x43bad6=_[_0x8388('0x59')]({},_0x43bad6,_0x534a88[_0x8388('0x5b')]);var _0x4721c2={'where':_0x43bad6[_0x8388('0x55')]};return db[_0x8388('0x46')][_0x8388('0x36')](_0x4721c2)[_0x8388('0x23')](function(_0x344044){_0x3fcefd[_0x8388('0x36')]=_0x344044;if(_0x534a88['query']['includeAll']){_0x43bad6[_0x8388('0x5c')]=[{'all':!![]}];}return db[_0x8388('0x46')][_0x8388('0x5d')](_0x43bad6);})[_0x8388('0x23')](function(_0x3fbd03){_0x3fcefd[_0x8388('0x5e')]=_0x3fbd03;return _0x3fcefd;})['then'](respondWithFilteredResult(_0x38d284,_0x43bad6))[_0x8388('0x2e')](handleError(_0x38d284,null));};exports['show']=function(_0x342744,_0x406fc7){var _0x22e1eb={'raw':![],'where':{'id':_0x342744[_0x8388('0x5f')]['id']},'include':[{'model':db[_0x8388('0x44')],'as':_0x8388('0x60')}]},_0x20dc7d={};_0x20dc7d['model']=_['keys'](db[_0x8388('0x46')][_0x8388('0x47')]);_0x20dc7d[_0x8388('0x4c')]=_[_0x8388('0x61')](_0x342744[_0x8388('0x4c')]);_0x20dc7d[_0x8388('0x57')]=_[_0x8388('0x4d')](_0x20dc7d[_0x8388('0x4b')],_0x20dc7d[_0x8388('0x4c')]);_0x22e1eb['attributes']=_[_0x8388('0x4d')](_0x20dc7d[_0x8388('0x4b')],qs['fields'](_0x342744['query'][_0x8388('0x4e')]));_0x22e1eb['attributes']=_0x22e1eb[_0x8388('0x4f')][_0x8388('0x50')]?_0x22e1eb[_0x8388('0x4f')]:_0x20dc7d['model'];if(_0x342744['query']['includeAll']){_0x22e1eb[_0x8388('0x5c')]=[{'all':!![]}];}_0x22e1eb=_[_0x8388('0x59')]({},_0x22e1eb,_0x342744['options']);return db[_0x8388('0x46')][_0x8388('0x62')](_0x22e1eb)[_0x8388('0x23')](handleEntityNotFound(_0x406fc7,null))[_0x8388('0x23')](respondWithResult(_0x406fc7,null))[_0x8388('0x2e')](handleError(_0x406fc7,null));};exports[_0x8388('0x63')]=function(_0xa61e8c,_0x5ca3b5){return db['ChatWebsite'][_0x8388('0x63')](_0xa61e8c[_0x8388('0x64')],{})[_0x8388('0x23')](function(_0x25c7f4){var _0x411b9a=_0xa61e8c[_0x8388('0x65')]['get']({'plain':!![]});if(!_0x411b9a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x411b9a[_0x8388('0x66')]==='user'){var _0x4fd237=_0x25c7f4[_0x8388('0x3d')]({'plain':!![]});var _0x12225e=_0x8388('0x3e');return db[_0x8388('0x67')][_0x8388('0x62')]({'where':{'name':_0x12225e,'userProfileId':_0x411b9a[_0x8388('0x68')]},'raw':!![]})[_0x8388('0x23')](function(_0x5e5c2e){if(_0x5e5c2e&&_0x5e5c2e['autoAssociation']===0x0){return db[_0x8388('0x3f')][_0x8388('0x63')]({'name':_0x4fd237['name'],'resourceId':_0x4fd237['id'],'type':_0x5e5c2e['name'],'sectionId':_0x5e5c2e['id']},{})['then'](function(){return _0x25c7f4;});}else{return _0x25c7f4;}})[_0x8388('0x2e')](function(_0x539049){logger['error'](_0x8388('0x69'),_0x539049);throw _0x539049;});}return _0x25c7f4;})[_0x8388('0x23')](respondWithResult(_0x5ca3b5,0xc9))[_0x8388('0x2e')](handleError(_0x5ca3b5,null));};exports[_0x8388('0x3b')]=function(_0x5092d2,_0x49ae82){if(_0x5092d2[_0x8388('0x64')]['id']){delete _0x5092d2[_0x8388('0x64')]['id'];}return db[_0x8388('0x46')][_0x8388('0x62')]({'where':{'id':_0x5092d2['params']['id']},'include':[{'model':db[_0x8388('0x44')],'as':_0x8388('0x60')}]})[_0x8388('0x23')](handleEntityNotFound(_0x49ae82,null))[_0x8388('0x23')](saveUpdates(_0x5092d2[_0x8388('0x64')],null))['then'](respondWithResult(_0x49ae82,null))['catch'](handleError(_0x49ae82,null));};exports['destroy']=function(_0x3dff75,_0x5ad91e){return db['ChatWebsite'][_0x8388('0x62')]({'where':{'id':_0x3dff75['params']['id']}})[_0x8388('0x23')](handleEntityNotFound(_0x5ad91e,null))[_0x8388('0x23')](removeEntity(_0x5ad91e,null))[_0x8388('0x2e')](handleError(_0x5ad91e,null));};exports['describe']=function(_0xfc329b,_0x58b989){return db[_0x8388('0x46')]['describe']()[_0x8388('0x23')](respondWithResult(_0x58b989,null))[_0x8388('0x2e')](handleError(_0x58b989,null));};exports[_0x8388('0x6a')]=function(_0x11ebfd,_0x55e084,_0x10e0a4){if(_0x11ebfd[_0x8388('0x64')]['id']){delete _0x11ebfd[_0x8388('0x64')]['id'];}return db[_0x8388('0x46')]['find']({'where':{'id':_0x11ebfd[_0x8388('0x5f')]['id']}})[_0x8388('0x23')](handleEntityNotFound(_0x55e084,null))['then'](function(_0xd7c306){if(_0xd7c306){_0x11ebfd[_0x8388('0x64')]['ChatWebsiteId']=_0xd7c306['id'];return db[_0x8388('0x6b')][_0x8388('0x63')](_0x11ebfd[_0x8388('0x64')]);}})[_0x8388('0x23')](respondWithResult(_0x55e084,null))['catch'](handleError(_0x55e084,null));};exports[_0x8388('0x6c')]=function(_0x11c32c,_0x59a4a4,_0x4c49fd){var _0x278461={'raw':![],'where':{}};var _0x5f52fc={};var _0x217be8={'count':0x0,'rows':[]};return db[_0x8388('0x46')][_0x8388('0x6d')]({'where':{'id':_0x11c32c[_0x8388('0x5f')]['id']}})[_0x8388('0x23')](handleEntityNotFound(_0x59a4a4,null))[_0x8388('0x23')](function(_0x5a2e4e){if(_0x5a2e4e){_0x5f52fc[_0x8388('0x4b')]=_['keys'](db[_0x8388('0x6b')][_0x8388('0x47')]);_0x5f52fc[_0x8388('0x4c')]=_['keys'](_0x11c32c['query']);_0x5f52fc['filters']=_['intersection'](_0x5f52fc[_0x8388('0x4b')],_0x5f52fc['query']);_0x278461[_0x8388('0x4f')]=_[_0x8388('0x4d')](_0x5f52fc['model'],qs['fields'](_0x11c32c[_0x8388('0x4c')][_0x8388('0x4e')]));_0x278461[_0x8388('0x4f')]=_0x278461['attributes'][_0x8388('0x50')]?_0x278461[_0x8388('0x4f')]:_0x5f52fc[_0x8388('0x4b')];if(!_0x11c32c[_0x8388('0x4c')][_0x8388('0x51')](_0x8388('0x52'))){_0x278461['limit']=qs['limit'](_0x11c32c[_0x8388('0x4c')][_0x8388('0x33')]);_0x278461[_0x8388('0x35')]=qs[_0x8388('0x35')](_0x11c32c['query']['offset']);}_0x278461[_0x8388('0x53')]=qs[_0x8388('0x54')](_0x11c32c[_0x8388('0x4c')][_0x8388('0x54')]);_0x278461[_0x8388('0x55')]=qs[_0x8388('0x57')](_['pick'](_0x11c32c[_0x8388('0x4c')],_0x5f52fc[_0x8388('0x57')]));_0x278461[_0x8388('0x55')]['ChatWebsiteId']=_0x5a2e4e['id'];if(_0x11c32c[_0x8388('0x4c')][_0x8388('0x58')]){_0x278461[_0x8388('0x55')]=_[_0x8388('0x59')](_0x278461[_0x8388('0x55')],{'$or':_[_0x8388('0x45')](_0x278461[_0x8388('0x4f')],function(_0x40c55b){var _0x16660d={};_0x16660d[_0x40c55b]={'$like':'%'+_0x11c32c[_0x8388('0x4c')][_0x8388('0x58')]+'%'};return _0x16660d;})});}_0x278461=_[_0x8388('0x59')]({},_0x278461,_0x11c32c[_0x8388('0x5b')]);return db[_0x8388('0x6b')][_0x8388('0x36')]({'where':_0x278461['where']})[_0x8388('0x23')](function(_0x3d3941){_0x217be8[_0x8388('0x36')]=_0x3d3941;if(_0x11c32c[_0x8388('0x4c')][_0x8388('0x6e')]){_0x278461[_0x8388('0x5c')]=[{'all':!![]}];}return db['Disposition'][_0x8388('0x5d')](_0x278461);})['then'](function(_0x4bcbeb){_0x217be8[_0x8388('0x5e')]=_0x4bcbeb;return _0x217be8;});}})[_0x8388('0x23')](respondWithFilteredResult(_0x59a4a4,_0x278461))['catch'](handleError(_0x59a4a4,null));};exports[_0x8388('0x6f')]=function(_0x9f32a2,_0xe33968,_0x4322ef){return db[_0x8388('0x46')]['find']({'where':{'id':_0x9f32a2['params']['id']}})[_0x8388('0x23')](handleEntityNotFound(_0xe33968,null))['then'](function(_0x48f7e9){if(_0x48f7e9){return _0x48f7e9[_0x8388('0x6f')](_0x9f32a2[_0x8388('0x4c')]['ids']);}})[_0x8388('0x23')](respondWithStatusCode(_0xe33968,null))[_0x8388('0x2e')](handleError(_0xe33968,null));};exports[_0x8388('0x70')]=function(_0x3dbb75,_0x494445,_0x23e71d){if(_0x3dbb75['body']['id']){delete _0x3dbb75[_0x8388('0x64')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x3dbb75[_0x8388('0x5f')]['id']}})[_0x8388('0x23')](handleEntityNotFound(_0x494445,null))[_0x8388('0x23')](function(_0xcf8574){if(_0xcf8574){_0x3dbb75[_0x8388('0x64')]['ChatWebsiteId']=_0xcf8574['id'];return db['CannedAnswer']['create'](_0x3dbb75['body']);}})['then'](respondWithResult(_0x494445,null))[_0x8388('0x2e')](handleError(_0x494445,null));};exports[_0x8388('0x71')]=function(_0xb7531e,_0x19ceb3,_0x270ef0){var _0x3833d1={'raw':![],'where':{}};var _0x248ea1={};var _0xb23183={'count':0x0,'rows':[]};return db[_0x8388('0x46')][_0x8388('0x6d')]({'where':{'id':_0xb7531e[_0x8388('0x5f')]['id']}})[_0x8388('0x23')](handleEntityNotFound(_0x19ceb3,null))[_0x8388('0x23')](function(_0x4ffd9d){if(_0x4ffd9d){_0x248ea1[_0x8388('0x4b')]=_[_0x8388('0x61')](db[_0x8388('0x72')][_0x8388('0x47')]);_0x248ea1[_0x8388('0x4c')]=_[_0x8388('0x61')](_0xb7531e['query']);_0x248ea1['filters']=_['intersection'](_0x248ea1['model'],_0x248ea1[_0x8388('0x4c')]);_0x3833d1[_0x8388('0x4f')]=_[_0x8388('0x4d')](_0x248ea1[_0x8388('0x4b')],qs[_0x8388('0x4e')](_0xb7531e[_0x8388('0x4c')][_0x8388('0x4e')]));_0x3833d1[_0x8388('0x4f')]=_0x3833d1['attributes'][_0x8388('0x50')]?_0x3833d1['attributes']:_0x248ea1[_0x8388('0x4b')];if(!_0xb7531e[_0x8388('0x4c')][_0x8388('0x51')](_0x8388('0x52'))){_0x3833d1[_0x8388('0x33')]=qs[_0x8388('0x33')](_0xb7531e['query'][_0x8388('0x33')]);_0x3833d1[_0x8388('0x35')]=qs[_0x8388('0x35')](_0xb7531e[_0x8388('0x4c')][_0x8388('0x35')]);}_0x3833d1[_0x8388('0x53')]=qs['sort'](_0xb7531e[_0x8388('0x4c')]['sort']);_0x3833d1['where']=qs['filters'](_[_0x8388('0x56')](_0xb7531e[_0x8388('0x4c')],_0x248ea1[_0x8388('0x57')]));_0x3833d1[_0x8388('0x55')][_0x8388('0x73')]=_0x4ffd9d['id'];if(_0xb7531e['query'][_0x8388('0x58')]){_0x3833d1[_0x8388('0x55')]=_['merge'](_0x3833d1[_0x8388('0x55')],{'$or':_[_0x8388('0x45')](_0x3833d1['attributes'],function(_0x436366){var _0x41bcca={};_0x41bcca[_0x436366]={'$like':'%'+_0xb7531e[_0x8388('0x4c')]['filter']+'%'};return _0x41bcca;})});}_0x3833d1=_[_0x8388('0x59')]({},_0x3833d1,_0xb7531e[_0x8388('0x5b')]);return db[_0x8388('0x72')]['count']({'where':_0x3833d1[_0x8388('0x55')]})[_0x8388('0x23')](function(_0x3fb141){_0xb23183[_0x8388('0x36')]=_0x3fb141;if(_0xb7531e[_0x8388('0x4c')][_0x8388('0x6e')]){_0x3833d1[_0x8388('0x5c')]=[{'all':!![]}];}return db[_0x8388('0x72')][_0x8388('0x5d')](_0x3833d1);})[_0x8388('0x23')](function(_0x3678eb){_0xb23183[_0x8388('0x5e')]=_0x3678eb;return _0xb23183;});}})[_0x8388('0x23')](respondWithFilteredResult(_0x19ceb3,_0x3833d1))['catch'](handleError(_0x19ceb3,null));};exports[_0x8388('0x74')]=function(_0x587a10,_0x8fd885,_0x4c73af){return db[_0x8388('0x46')][_0x8388('0x62')]({'where':{'id':_0x587a10[_0x8388('0x5f')]['id']}})[_0x8388('0x23')](handleEntityNotFound(_0x8fd885,null))[_0x8388('0x23')](function(_0x55050e){if(_0x55050e){return _0x55050e[_0x8388('0x74')](_0x587a10[_0x8388('0x4c')][_0x8388('0x75')]);}})['then'](respondWithStatusCode(_0x8fd885,null))[_0x8388('0x2e')](handleError(_0x8fd885,null));};exports['addLogo']=function(_0x6a7947,_0x5ad6a1,_0x16e342){_0x6a7947[_0x8388('0x64')]['sitepic']=_0x6a7947[_0x8388('0x76')][_0x8388('0x77')];return db[_0x8388('0x46')][_0x8388('0x62')]({'where':{'id':_0x6a7947['params']['id']}})['then'](handleEntityNotFound(_0x5ad6a1,null))[_0x8388('0x23')](saveUpdates(_0x6a7947[_0x8388('0x64')],null))[_0x8388('0x23')](respondWithResult(_0x5ad6a1,null))['catch'](handleError(_0x5ad6a1,null));};exports[_0x8388('0x78')]=function(_0x22cab3,_0x4d0d99,_0x5bd2ee){_0x22cab3['body']['agentAvatar']=_0x22cab3['file']['filename'];return db[_0x8388('0x46')][_0x8388('0x62')]({'where':{'id':_0x22cab3[_0x8388('0x5f')]['id']}})[_0x8388('0x23')](handleEntityNotFound(_0x4d0d99,null))[_0x8388('0x23')](saveUpdates(_0x22cab3[_0x8388('0x64')],null))['then'](respondWithResult(_0x4d0d99,null))[_0x8388('0x2e')](handleError(_0x4d0d99,null));};exports[_0x8388('0x79')]=function(_0x49b78b,_0x19d685,_0x163726){_0x49b78b[_0x8388('0x64')]['customerAvatar']=_0x49b78b[_0x8388('0x76')][_0x8388('0x77')];return db[_0x8388('0x46')][_0x8388('0x62')]({'where':{'id':_0x49b78b[_0x8388('0x5f')]['id']}})['then'](handleEntityNotFound(_0x19d685,null))[_0x8388('0x23')](saveUpdates(_0x49b78b[_0x8388('0x64')],null))[_0x8388('0x23')](respondWithResult(_0x19d685,null))['catch'](handleError(_0x19d685,null));};exports[_0x8388('0x7a')]=function(_0x15b718,_0x35344a,_0x2b1590){_0x15b718['body'][_0x8388('0x7b')]=_0x15b718[_0x8388('0x76')]['filename'];return db[_0x8388('0x46')][_0x8388('0x62')]({'where':{'id':_0x15b718['params']['id']}})[_0x8388('0x23')](handleEntityNotFound(_0x35344a,null))[_0x8388('0x23')](saveUpdates(_0x15b718[_0x8388('0x64')],null))[_0x8388('0x23')](respondWithResult(_0x35344a,null))[_0x8388('0x2e')](handleError(_0x35344a,null));};exports['getLogo']=function(_0x388843,_0x53e7e8,_0x261b04){var _0x467de3=path[_0x8388('0x7c')](config['root'],_0x8388('0x7d'));var _0x34b851={'where':{'id':_0x388843[_0x8388('0x5f')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x1bcb0c=![];return require(_0x8388('0x7e'))[_0x8388('0x7f')]()[_0x8388('0x23')](function(_0x50b3e6){if(_0x50b3e6){_0x1bcb0c=_0x50b3e6[_0x8388('0x80')];}})[_0x8388('0x23')](function(){return db['ChatWebsite']['find'](_0x34b851);})[_0x8388('0x23')](handleEntityNotFound(_0x53e7e8,null))['then'](function(_0x36469d){if(_0x36469d){if(!_[_0x8388('0x81')](_0x36469d[_0x8388('0x82')])){if(fs['existsSync'](path[_0x8388('0x7c')](config[_0x8388('0x83')],_0x8388('0x84'),_0x36469d['sitepic']))&&_0x1bcb0c){_0x467de3=path[_0x8388('0x7c')](config[_0x8388('0x83')],_0x8388('0x84'),_0x36469d[_0x8388('0x82')]);}}return _0x53e7e8[_0x8388('0x85')](_0x467de3);}})[_0x8388('0x2e')](handleError(_0x53e7e8,null));};exports[_0x8388('0x86')]=function(_0x4255e3,_0x3413fb,_0x57502d){var _0x5cdfa0=path['join'](config['root'],_0x8388('0x87'));var _0x1e41b1={'where':{'id':_0x4255e3[_0x8388('0x5f')]['id']},'attributes':['id',_0x8388('0x88')],'raw':!![]};return db['ChatWebsite'][_0x8388('0x62')](_0x1e41b1)[_0x8388('0x23')](handleEntityNotFound(_0x3413fb,null))[_0x8388('0x23')](function(_0x31ade1){if(_0x31ade1){if(!_['isNil'](_0x31ade1[_0x8388('0x88')])){if(fs[_0x8388('0x89')](path[_0x8388('0x7c')](config[_0x8388('0x83')],'server/files/images/avatars/',_0x31ade1[_0x8388('0x88')]))){_0x5cdfa0=path[_0x8388('0x7c')](config[_0x8388('0x83')],_0x8388('0x8a'),_0x31ade1[_0x8388('0x88')]);}}return _0x3413fb[_0x8388('0x85')](_0x5cdfa0);}})[_0x8388('0x2e')](handleError(_0x3413fb,null));};exports[_0x8388('0x8b')]=function(_0x440f0a,_0x24d316,_0xf95230){var _0x1e2925=path[_0x8388('0x7c')](config['root'],_0x8388('0x8c'));var _0x256c55={'where':{'id':_0x440f0a['params']['id']},'attributes':['id',_0x8388('0x8d'),'showCustomerAvatar'],'raw':!![]};return db[_0x8388('0x46')][_0x8388('0x62')](_0x256c55)[_0x8388('0x23')](handleEntityNotFound(_0x24d316,null))[_0x8388('0x23')](function(_0x2ef1e0){if(_0x2ef1e0){if(!_[_0x8388('0x81')](_0x2ef1e0[_0x8388('0x8d')])){if(fs[_0x8388('0x89')](path['join'](config[_0x8388('0x83')],_0x8388('0x8a'),_0x2ef1e0[_0x8388('0x8d')]))&&_0x2ef1e0[_0x8388('0x8e')]){_0x1e2925=path[_0x8388('0x7c')](config['root'],_0x8388('0x8a'),_0x2ef1e0[_0x8388('0x8d')]);}}return _0x24d316[_0x8388('0x85')](_0x1e2925);}})[_0x8388('0x2e')](handleError(_0x24d316,null));};exports[_0x8388('0x8f')]=function(_0x1b6290,_0x47ca7a,_0x32ce24){var _0x3e186a=path[_0x8388('0x7c')](config[_0x8388('0x83')],_0x8388('0x90'));var _0x50ffc8={'where':{'id':_0x1b6290[_0x8388('0x5f')]['id']},'attributes':['id',_0x8388('0x7b')],'raw':!![]};return db[_0x8388('0x46')][_0x8388('0x62')](_0x50ffc8)[_0x8388('0x23')](handleEntityNotFound(_0x47ca7a,null))[_0x8388('0x23')](function(_0x581440){if(_0x581440){if(!_[_0x8388('0x81')](_0x581440['systemAvatar'])){if(fs[_0x8388('0x89')](path[_0x8388('0x7c')](config['root'],_0x8388('0x8a'),_0x581440['systemAvatar']))){_0x3e186a=path[_0x8388('0x7c')](config[_0x8388('0x83')],_0x8388('0x8a'),_0x581440['systemAvatar']);}}return _0x47ca7a['download'](_0x3e186a);}})[_0x8388('0x2e')](handleError(_0x47ca7a,null));};exports['notify']=function(_0x46fd80,_0x1f09f0,_0x1c0056){var _0x1c09e4=require('user-agent-parser');var _0x5564d5=new _0x1c09e4();var _0x2b5d93=_0x5564d5[_0x8388('0x91')](_0x46fd80[_0x8388('0x92')]['user-agent'])[_0x8388('0x93')]();var _0x2bf2c8={'body':_0x46fd80[_0x8388('0x64')],'channel':_0x8388('0x94')};var _0x2aa5c5=[];var _0x3916ed=[];var _0x3a4cfa={};var _0x45db28=![];return db[_0x8388('0x95')][_0x8388('0x96')]()[_0x8388('0x23')](function(_0x5237e3){if(!_0x5237e3){throw new db[(_0x8388('0x97'))][(_0x8388('0x98'))]('no\x20available\x20attributes');}_0x2aa5c5=_[_0x8388('0x99')](_[_0x8388('0x61')](_0x5237e3),[_0x8388('0x9a'),'updatedAt']);_0x3916ed=_['difference'](_['keys'](_0x5237e3),[_0x8388('0x9a'),'updatedAt',_0x8388('0x9b'),_0x8388('0x9c')]);if(_0x46fd80['body']['id']){delete _0x46fd80['body']['id'];}if(_[_0x8388('0x81')](_0x46fd80[_0x8388('0x64')]['from'])){throw new db[(_0x8388('0x97'))][(_0x8388('0x98'))](_0x8388('0x9d'));}if(_[_0x8388('0x81')](_0x46fd80[_0x8388('0x64')][_0x8388('0x64')])||_0x46fd80['body']['body']===''){throw new db[(_0x8388('0x97'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x46fd80[_0x8388('0x64')][_0x8388('0x9e')])){throw new db[(_0x8388('0x97'))][(_0x8388('0x98'))](_0x8388('0x9f')+_0x3916ed);}if(!_['includes'](_0x3916ed,_0x46fd80[_0x8388('0x64')][_0x8388('0x9e')])){throw new db[(_0x8388('0x97'))][(_0x8388('0x98'))](_0x8388('0xa0')+_0x3916ed);}_0x3a4cfa[_0x46fd80[_0x8388('0x64')][_0x8388('0x9e')]]=_0x46fd80[_0x8388('0x64')][_0x8388('0xa1')];})[_0x8388('0x23')](function(){return db[_0x8388('0x46')]['find']({'where':{'id':_0x46fd80[_0x8388('0x5f')]['id']},'include':[{'model':db[_0x8388('0xa2')],'as':'List','include':[{'model':db[_0x8388('0x95')],'as':'Contacts','where':_0x3a4cfa,'limit':0x1,'order':[[_0x8388('0xa3'),_0x8388('0xa4')]]}]},{'model':db[_0x8388('0xa5')],'as':_0x8388('0xa6')}]});})[_0x8388('0x23')](handleEntityNotFound(_0x1f09f0,null))['then'](function(_0x3cf240){if(_0x3cf240&&_0x3cf240[_0x8388('0xa7')]){_0x2bf2c8[_0x8388('0xa8')]=_0x3cf240;_0x2bf2c8[_0x8388('0xa9')]=_0x3cf240['Applications'];_0x2bf2c8[_0x8388('0xaa')]=_0x3cf240[_0x8388('0xa7')];_0x2bf2c8['applications']=_['orderBy'](_0x2bf2c8[_0x8388('0xa9')],[_0x8388('0xab')],[_0x8388('0xac')]);if(_0x2bf2c8[_0x8388('0xa8')][_0x8388('0xa6')]){delete _0x2bf2c8[_0x8388('0xa8')][_0x8388('0xa6')];}if(_0x2bf2c8['account'][_0x8388('0xa7')]&&_0x2bf2c8['account']['List'][_0x8388('0xad')][_0x8388('0x50')]){return _0x2bf2c8[_0x8388('0xa8')][_0x8388('0xa7')][_0x8388('0xad')][0x0];}var _0xc34c3a=_[_0x8388('0x1b')](_0x46fd80[_0x8388('0x64')],{'firstName':_0x46fd80['body'][_0x8388('0xa1')],'ListId':_0x3cf240[_0x8388('0x9c')]});_0xc34c3a[_0x46fd80[_0x8388('0x64')][_0x8388('0x9e')]]=_0x46fd80['body'][_0x8388('0xa1')];return db[_0x8388('0x95')][_0x8388('0x63')](_0xc34c3a,{'fields':_0x2aa5c5,'raw':!![]});}})[_0x8388('0x23')](handleEntityNotFound(_0x1f09f0,null))[_0x8388('0x23')](function(_0x4f2416){_0x2bf2c8[_0x8388('0xae')]=_0x4f2416;var _0x46b8aa=_0x46fd80[_0x8388('0x64')][_0x8388('0xaf')];if(_0x46fd80[_0x8388('0x92')][_0x8388('0xb0')]){_0x46b8aa=_0x46fd80[_0x8388('0x92')][_0x8388('0xb0')];}else if(_0x46fd80[_0x8388('0x92')]['x-forwarded-for']){_0x46b8aa=_[_0x8388('0xb1')](_0x46fd80[_0x8388('0x92')]['x-forwarded-for'][_0x8388('0xb2')](','));}if(_0x4f2416){var _0x136a89={'ContactId':_0x4f2416['id'],'ChatWebsiteId':_0x46fd80[_0x8388('0x5f')]['id'],'from':(_0x4f2416[_0x8388('0xb3')]||'')+'\x20'+(_0x4f2416['lastName']||''),'customerIp':_0x46b8aa,'customerPort':_0x46fd80[_0x8388('0x92')][_0x8388('0xb4')]?_0x46fd80[_0x8388('0x92')][_0x8388('0xb4')]:null,'referer':_0x46fd80[_0x8388('0x64')][_0x8388('0xb5')],'browserName':_0x2b5d93[_0x8388('0xb6')][_0x8388('0x41')]&&_0x2b5d93[_0x8388('0xb6')][_0x8388('0xb7')]?util[_0x8388('0xb8')](_0x8388('0xb9'),_0x2b5d93[_0x8388('0xb6')]['name'],_0x2b5d93[_0x8388('0xb6')][_0x8388('0xb7')]):_0x8388('0xba'),'browserVersion':_0x2b5d93[_0x8388('0xb6')][_0x8388('0xb7')]||'unknown','osName':util[_0x8388('0xb8')](_0x8388('0xb9'),_0x2b5d93['os']['name'],_0x2b5d93['os'][_0x8388('0xb7')]),'osVersion':_0x2b5d93['os'][_0x8388('0xb7')],'deviceModel':_0x2b5d93[_0x8388('0xbb')][_0x8388('0x4b')]&&_0x2b5d93[_0x8388('0xbb')][_0x8388('0xbc')]?util['format'](_0x8388('0xbd'),_0x2b5d93[_0x8388('0xbb')][_0x8388('0x4b')],_0x2b5d93[_0x8388('0xbb')][_0x8388('0xbc')],_0x2b5d93[_0x8388('0xbb')][_0x8388('0x49')]):null,'deviceVendor':_0x2b5d93[_0x8388('0xbb')][_0x8388('0xbc')],'deviceType':_0x2b5d93[_0x8388('0xbb')][_0x8388('0x49')],'formData':JSON[_0x8388('0x29')](_0x46fd80[_0x8388('0x64')])};var _0x15889c={'ChatWebsiteId':_0x46fd80[_0x8388('0x5f')]['id'],'closed':![]};if(_0x46fd80['body'][_0x8388('0xbe')]){_0x15889c[_0x8388('0xbe')]=_0x46fd80[_0x8388('0x64')][_0x8388('0xbe')];return db['ChatInteraction'][_0x8388('0x62')]({'where':_0x15889c})[_0x8388('0x23')](function(_0x2f8468){if(_0x2f8468){return[_0x2f8468,![]];}_0x136a89[_0x8388('0xbe')]=_0x46fd80[_0x8388('0x64')][_0x8388('0xbe')];_0x136a89[_0x8388('0xbf')]=_0x46fd80[_0x8388('0x64')][_0x8388('0xbf')];return db[_0x8388('0xc0')]['create'](_0x136a89)[_0x8388('0x23')](function(_0x4ee75f){return[_0x4ee75f,!![]];});});}_0x15889c[_0x8388('0xc1')]=_0x4f2416['id'];if(_0x46fd80[_0x8388('0x64')]['interaction']&&_0x46fd80['body']['interaction']['id']){_0x15889c['id']=_0x46fd80['body'][_0x8388('0xc2')]['id'];return db['ChatInteraction'][_0x8388('0x62')]({'where':_0x15889c})[_0x8388('0x23')](function(_0x19b2df){if(_0x19b2df){return[_0x19b2df,![]];}return db[_0x8388('0xc0')][_0x8388('0x63')](_0x136a89)['then'](function(_0x2d5828){return[_0x2d5828,!![]];});});}return db[_0x8388('0xc0')][_0x8388('0x63')](_0x136a89)[_0x8388('0x23')](function(_0x3fb0a3){return[_0x3fb0a3,!![]];});}})[_0x8388('0xc3')](function(_0x353c8d,_0x1215c5){if(_0x353c8d){_0x45db28=_0x1215c5;if(!_0x1215c5){var _0xa271b3={'from':(_0x2bf2c8['contact']['firstName']||'')+'\x20'+(_0x2bf2c8['contact']['lastName']||'')};if(_0x46fd80[_0x8388('0x64')][_0x8388('0xbe')]&&_0x46fd80['body']['messageId']&&_0x46fd80[_0x8388('0x64')][_0x8388('0xbe')]!=_0x46fd80[_0x8388('0x64')][_0x8388('0xc4')]){_0xa271b3[_0x8388('0xbe')]=_0x46fd80['body'][_0x8388('0xc4')];}return _0x353c8d['update'](_0xa271b3);}else{return _0x353c8d;}}})['then'](function(_0x3d4fc5){_0x2bf2c8[_0x8388('0xc2')]=_0x3d4fc5[_0x8388('0x3d')]({'plain':!![]});_0x2bf2c8[_0x8388('0xc2')]['created']=_0x45db28;if(_0x2bf2c8[_0x8388('0xc2')]['created']){if(_0x2bf2c8[_0x8388('0xa8')]['autoclose']){_0x2bf2c8[_0x8388('0xa9')][_0x8388('0xc5')]({'id':0x0,'priority':_0x2bf2c8[_0x8388('0xa9')]['length']+0x1,'app':_0x8388('0xc6'),'appdata':_0x8388('0xc7'),'interval':_0x8388('0xc8')});}}return db['ChatMessage'][_0x8388('0x63')]({'body':_0x46fd80[_0x8388('0x64')][_0x8388('0x64')],'ChatWebsiteId':_0x46fd80['params']['id'],'ChatInteractionId':_0x3d4fc5['id'],'direction':'in','ContactId':_0x2bf2c8['contact']['id'],'AttachmentId':_0x46fd80['body'][_0x8388('0xc9')]});})[_0x8388('0x23')](function(_0x1fb63e){_0x2bf2c8[_0x8388('0x2c')]=_0x1fb63e;if(_0x2bf2c8['interaction'][_0x8388('0xca')]){return db['User'][_0x8388('0x62')]({'attributes':['id','name'],'where':{'id':_0x2bf2c8[_0x8388('0xc2')]['UserId']}})[_0x8388('0x23')](function(_0x27e9f6){if(_0x27e9f6){_0x2bf2c8['applications'][_0x8388('0xcb')]({'id':0x0,'priority':0x0,'app':_0x8388('0xcc'),'appdata':_0x27e9f6[_0x8388('0x41')]+','+(_0x2bf2c8[_0x8388('0xa8')][_0x8388('0xcd')]||0xa),'interval':_0x8388('0xc8')});_0x2bf2c8[_0x8388('0xce')]=!![];}return respondWithRpcPromise(_0x8388('0xcf'),_0x8388('0xd0'),_0x2bf2c8);});}return respondWithRpcPromise(_0x8388('0xcf'),_0x8388('0xd0'),_0x2bf2c8);})['then'](function(_0x51ec7a){respondWithRpcPromise(_0x8388('0xd1'),_0x8388('0xd1'),{'event':_0x8388('0xd2'),'message':_0x51ec7a},client9002);return _0x51ec7a;})[_0x8388('0x23')](respondWithResult(_0x1f09f0,null))[_0x8388('0x2e')](handleError(_0x1f09f0,null));};exports[_0x8388('0xd3')]=function(_0x5c0df5,_0x41c463,_0x374992){var _0x2b8e47,_0x4ac65a,_0x52d7f4;var _0x4fe98d=[];var _0x3b4676=[];var _0x368fcb={};var _0x13a39e=_0x5c0df5[_0x8388('0xd4')]||[];var _0x491982=[];var _0x5eaeb0;return db[_0x8388('0x95')][_0x8388('0x96')]()[_0x8388('0x23')](function(_0x110356){if(!_0x110356){throw new db[(_0x8388('0x97'))][(_0x8388('0x98'))](_0x8388('0xd5'));}_0x3b4676=_[_0x8388('0x99')](_[_0x8388('0x61')](_0x110356),[_0x8388('0x9a'),'updatedAt']);_0x4fe98d=_[_0x8388('0x99')](_[_0x8388('0x61')](_0x110356),[_0x8388('0x9a'),'updatedAt',_0x8388('0x9b'),'ListId']);if(_0x5c0df5['body']['id']){delete _0x5c0df5['body']['id'];}if(_[_0x8388('0x81')](_0x5c0df5[_0x8388('0x64')]['from'])){throw _0x41c463['status'](0x1f4)[_0x8388('0x42')](new db[(_0x8388('0x97'))]['ValidationError'](_0x8388('0x9d')));}if(_[_0x8388('0x81')](_0x5c0df5[_0x8388('0x64')][_0x8388('0x64')])||_0x5c0df5[_0x8388('0x64')][_0x8388('0x64')]===''){throw _0x41c463[_0x8388('0x30')](0x1f4)[_0x8388('0x42')](new db[(_0x8388('0x97'))][(_0x8388('0x98'))](_0x8388('0xd6')));}if(_['isNil'](_0x5c0df5[_0x8388('0x64')]['mapKeyOffline'])){throw _0x41c463[_0x8388('0x30')](0x1f4)[_0x8388('0x42')](new db[(_0x8388('0x97'))][(_0x8388('0x98'))](_0x8388('0xd7')+_0x4fe98d));}if(!_['includes'](_0x4fe98d,_0x5c0df5['body'][_0x8388('0xd8')])){throw _0x41c463[_0x8388('0x30')](0x1f4)[_0x8388('0x42')](new db[(_0x8388('0x97'))][(_0x8388('0x98'))](_0x8388('0xd9')+_0x4fe98d));}_0x368fcb[_0x5c0df5[_0x8388('0x64')][_0x8388('0xd8')]]=_0x5c0df5[_0x8388('0x64')][_0x8388('0xa1')];})[_0x8388('0x23')](function(){return db['ChatWebsite'][_0x8388('0x62')]({'where':{'id':_0x5c0df5[_0x8388('0x5f')]['id']},'include':[{'model':db[_0x8388('0xa2')],'as':_0x8388('0xa7')},{'model':db[_0x8388('0xda')],'as':_0x8388('0xda')}]});})[_0x8388('0x23')](handleEntityNotFound(_0x41c463,null))['then'](function(_0x3cd0c0){if(_0x3cd0c0&&_0x3cd0c0[_0x8388('0xa7')]){_0x4ac65a=_0x3cd0c0;var _0x2ff8ca=_[_0x8388('0x1b')](_0x5c0df5[_0x8388('0x64')],{'firstName':_0x5c0df5[_0x8388('0x64')][_0x8388('0xa1')],'phone':_0x5c0df5[_0x8388('0x64')]['from'],'ListId':_0x3cd0c0['ListId']});_0x2ff8ca[_0x5c0df5[_0x8388('0x64')][_0x8388('0xd8')]]=_0x5c0df5[_0x8388('0x64')][_0x8388('0xa1')];return db[_0x8388('0x95')][_0x8388('0xdb')]({'where':_0x368fcb,'defaults':_0x2ff8ca});}})[_0x8388('0xc3')](function(_0x46ca6b){if(_0x46ca6b){_0x52d7f4=_0x46ca6b;var _0x5e017e=fs[_0x8388('0xdc')](path[_0x8388('0x7c')](config[_0x8388('0x83')],_0x8388('0xdd')),_0x8388('0xde'));var _0x529890=ejs['render'](_0x5e017e,{'body':_[_0x8388('0xdf')](_0x5c0df5[_0x8388('0x64')][_0x8388('0x64')]),'bodyTitle':_0x4ac65a[_0x8388('0xe0')]});return db[_0x8388('0xe1')][_0x8388('0x63')]({'body':_0x529890,'ContactId':_0x46ca6b['id'],'ChatWebsiteId':_0x4ac65a['id']});}})[_0x8388('0x23')](function(_0x290246){_0x5eaeb0=_0x290246;if(_0x13a39e[_0x8388('0x50')]){var _0x245d7f=_0x13a39e[_0x8388('0x45')](function(_0x24e06b){return{'name':_0x24e06b[_0x8388('0xe2')],'basename':_0x24e06b[_0x8388('0x77')],'type':_0x24e06b[_0x8388('0xe3')],'ChatOfflineMessageId':_0x290246['id']};});_0x491982=_0x245d7f['map'](_0x5763e5=>{var _0x2a2a24={'filename':_0x5763e5[_0x8388('0x41')],'path':path[_0x8388('0x7c')](config['root'],_0x8388('0xe4'),'files',_0x8388('0xe5'),'offline-chat',_0x5763e5[_0x8388('0xe6')])};return _0x2a2a24;});if(!_0x4ac65a[_0x8388('0xe7')]){return db[_0x8388('0xe8')][_0x8388('0xe9')](function(_0x3cf95e){return db[_0x8388('0xea')][_0x8388('0xeb')](_0x245d7f,{'transaction':_0x3cf95e});});}}})[_0x8388('0x23')](function(){if(_0x5eaeb0){_0x2b8e47=_0x5eaeb0;return db[_0x8388('0xda')][_0x8388('0x6d')]({'where':{'active':!![]},'include':[{'model':db[_0x8388('0xec')],'as':'Smtp','raw':!![]}]});}})[_0x8388('0x23')](function(_0x42e67f){if(_0x42e67f&&_0x42e67f['Smtp']&&_0x4ac65a[_0x8388('0xed')]&&_0x4ac65a[_0x8388('0xee')]){var _0x312db9={'tls':{'rejectUnauthorized':![]}};if(_0x42e67f['Smtp'][_0x8388('0xef')]){_0x312db9['service']=_0x42e67f[_0x8388('0xf0')]['service'];}else{_0x312db9['host']=_0x42e67f[_0x8388('0xf0')][_0x8388('0xf1')];_0x312db9['port']=_0x42e67f[_0x8388('0xf0')][_0x8388('0xf2')];_0x312db9[_0x8388('0xf3')]=_0x42e67f[_0x8388('0xf0')][_0x8388('0xf3')];}if(_0x42e67f['Smtp']['authentication']){_0x312db9[_0x8388('0xf4')]={'user':_0x42e67f[_0x8388('0xf0')][_0x8388('0x65')],'pass':_0x42e67f[_0x8388('0xf0')][_0x8388('0xf5')]};}return respondWithRpcPromise(_0x8388('0xf6'),_0x8388('0xf7'),{'account':_0x312db9,'message':{'from':util['format'](_0x8388('0xf8'),_0x42e67f[_0x8388('0x41')],_0x42e67f[_0x8388('0xf9')]||_0x42e67f[_0x8388('0xf0')][_0x8388('0x65')]),'to':_0x4ac65a[_0x8388('0xee')],'subject':_0x4ac65a[_0x8388('0xfa')],'html':_0x2b8e47[_0x8388('0x64')],'attachments':_0x491982}},client9003)['then'](function(){return _0x2b8e47;})[_0x8388('0x2e')](function(_0x23b83d){console[_0x8388('0x2a')](_0x23b83d);});}})[_0x8388('0x23')](function(){if(_0x4ac65a&&_0x4ac65a['openNewInteraction']&&_0x4ac65a[_0x8388('0xfb')]){var _0x39d9cd=[];if(_0x13a39e['length']){_0x39d9cd=_0x13a39e[_0x8388('0x45')](function(_0x262514){return{'name':_0x262514[_0x8388('0xe2')],'basename':_0x262514['filename'],'type':_0x262514['mimetype'],'ChatOfflineMessageId':_0x5eaeb0['id']};});}var _0x1f7f8a;if(!_[_0x8388('0x81')](_0x4ac65a[_0x8388('0xfc')])){var _0x5292c5=_['map'](_0x5c0df5[_0x8388('0x64')],function(_0x203851){return _0x203851;});var _0x26ad93=_[_0x8388('0xfd')](_0x5292c5)[0x0];var _0x530ec3=_[_0x8388('0xfe')](_0x26ad93,function(_0x35f341){return _0x35f341;});_0x1f7f8a=_0x530ec3[0x1][_0x4ac65a[_0x8388('0xfc')]];}var _0x42537f={'from':_0x52d7f4['email'],'firstName':_0x52d7f4[_0x8388('0xb3')],'lastName':_0x52d7f4[_0x8388('0xff')],'mapKey':_0x8388('0xf9'),'message':{'from':_0x52d7f4['email'],'to':_0x4ac65a[_0x8388('0xda')][_0x8388('0xf9')],'cc':'','subject':_[_0x8388('0x81')](_0x1f7f8a)?_0x4ac65a[_0x8388('0xfa')]:_0x1f7f8a,'messageId':'','sentAt':new Date(),'attach':_0x39d9cd[_0x8388('0x50')],'attachments':_0x39d9cd,'originChannel':_0x8388('0x100'),'ChatWebsiteId':_0x4ac65a['id'],'ChatOfflineMessageId':_0x2b8e47['id'],'originTo':_0x4ac65a[_0x8388('0xda')][_0x8388('0xf9')]},'body':_0x2b8e47[_0x8388('0x64')]};var _0x2a6298={'account':{'id':_0x4ac65a[_0x8388('0xfb')]},'body':_0x42537f,'log':_0x8388('0x101')};return respondWithRpcPromise(_0x8388('0x101'),_0x8388('0x102'),_0x2a6298,client9001)[_0x8388('0x23')](function(){return _0x2b8e47;})[_0x8388('0x2e')](function(_0x182fb3){console[_0x8388('0x2a')](_0x182fb3);});}return;})[_0x8388('0x23')](function(){if(_0x2b8e47){return _0x2b8e47;}})[_0x8388('0x23')](respondWithResult(_0x41c463,null))[_0x8388('0x2e')](function(_0x4de218){console[_0x8388('0x2a')](_0x8388('0x2e'),_0x4de218);for(var _0x15c640 of _0x13a39e){var _0x2bd127=path[_0x8388('0x7c')](config[_0x8388('0x83')],_0x8388('0xe4'),'files',_0x8388('0xe5'),'offline-chat',_0x15c640[_0x8388('0x77')]);fs_extra[_0x8388('0x103')](_0x2bd127)['catch'](function(_0x252024){console['error']('Could\x20not\x20remove\x20attachment\x20file',_0x2bd127,_0x252024);});}});};exports[_0x8388('0x104')]=function(_0x111a13,_0x5ab21a,_0x3e1da4){return db['ChatInteraction'][_0x8388('0x62')]({'where':{'id':_0x111a13[_0x8388('0x5f')]['id']}})[_0x8388('0x23')](handleEntityNotFound(_0x5ab21a,null))[_0x8388('0x23')](function(_0x16411c){if(_0x16411c){return _0x16411c[_0x8388('0x104')](_0x111a13[_0x8388('0x64')][_0x8388('0x75')],_[_0x8388('0x105')](_0x111a13[_0x8388('0x64')],['ids','id'])||{});}})[_0x8388('0x23')](respondWithResult(_0x5ab21a,null))[_0x8388('0x2e')](handleError(_0x5ab21a,null));};exports['getInteractions']=function(_0x4de571,_0x3153d4,_0xcc34c7){var _0x368aa7={'raw':![],'where':{}};var _0x1a6e97={};var _0x299769={'count':0x0,'rows':[]};return db[_0x8388('0x46')][_0x8388('0x6d')]({'where':{'id':_0x4de571[_0x8388('0x5f')]['id']}})[_0x8388('0x23')](handleEntityNotFound(_0x3153d4,null))[_0x8388('0x23')](function(_0x1c3b01){if(_0x1c3b01){_0x1a6e97[_0x8388('0x4b')]=_[_0x8388('0x61')](db[_0x8388('0xc0')][_0x8388('0x47')]);_0x1a6e97['query']=_[_0x8388('0x61')](_0x4de571['query']);_0x1a6e97[_0x8388('0x57')]=_['intersection'](_0x1a6e97[_0x8388('0x4b')],_0x1a6e97[_0x8388('0x4c')]);_0x368aa7[_0x8388('0x4f')]=_[_0x8388('0x4d')](_0x1a6e97[_0x8388('0x4b')],qs[_0x8388('0x4e')](_0x4de571[_0x8388('0x4c')][_0x8388('0x4e')]));_0x368aa7[_0x8388('0x4f')]=_0x368aa7[_0x8388('0x4f')][_0x8388('0x50')]?_0x368aa7[_0x8388('0x4f')]:_0x1a6e97[_0x8388('0x4b')];if(!_0x4de571[_0x8388('0x4c')]['hasOwnProperty'](_0x8388('0x52'))){_0x368aa7[_0x8388('0x33')]=qs[_0x8388('0x33')](_0x4de571[_0x8388('0x4c')][_0x8388('0x33')]);_0x368aa7[_0x8388('0x35')]=qs[_0x8388('0x35')](_0x4de571[_0x8388('0x4c')][_0x8388('0x35')]);}_0x368aa7[_0x8388('0x53')]=qs['sort'](_0x4de571[_0x8388('0x4c')][_0x8388('0x54')]);_0x368aa7[_0x8388('0x55')]=qs[_0x8388('0x57')](_[_0x8388('0x56')](_0x4de571[_0x8388('0x4c')],_0x1a6e97[_0x8388('0x57')]));_0x368aa7['where']['ChatWebsiteId']=_0x1c3b01['id'];if(_0x4de571['query']['filter']){_0x368aa7[_0x8388('0x55')]=_[_0x8388('0x59')](_0x368aa7[_0x8388('0x55')],{'$or':_[_0x8388('0x45')](_0x368aa7[_0x8388('0x4f')],function(_0x439648){var _0x4ac133={};_0x4ac133[_0x439648]={'$like':'%'+_0x4de571['query'][_0x8388('0x58')]+'%'};return _0x4ac133;})});}_0x368aa7=_[_0x8388('0x59')]({},_0x368aa7,_0x4de571[_0x8388('0x5b')]);return db[_0x8388('0xc0')][_0x8388('0x36')]({'where':_0x368aa7[_0x8388('0x55')]})[_0x8388('0x23')](function(_0x22e61e){_0x299769['count']=_0x22e61e;if(_0x4de571['query']['includeAll']){_0x368aa7[_0x8388('0x5c')]=[{'model':db[_0x8388('0x95')],'as':_0x8388('0x106'),'required':![]},{'model':db[_0x8388('0x107')],'as':'Owner','attributes':[_0x8388('0x41'),'fullname',_0x8388('0x108')],'required':![]},{'model':db['Tag'],'as':_0x8388('0x109'),'attributes':['id',_0x8388('0x41'),_0x8388('0x10a')],'where':_0x4de571[_0x8388('0x4c')][_0x8388('0x10b')]?{'id':_0x4de571[_0x8388('0x4c')]['tag']}:undefined,'required':_0x4de571[_0x8388('0x4c')][_0x8388('0x10b')]?!![]:![]}];}return db[_0x8388('0xc0')][_0x8388('0x5d')](_0x368aa7);})['then'](function(_0x59e482){_0x299769['rows']=_0x59e482;return _0x299769;});}})[_0x8388('0x23')](respondWithFilteredResult(_0x3153d4,_0x368aa7))[_0x8388('0x2e')](handleError(_0x3153d4,null));};function iftimePromise(_0x300da9,_0x275f07){return respondWithRpcPromise(_0x8388('0x10c'),_0x8388('0x10d'),{'command':_0x275f07['timezone']?util['format'](_0x8388('0x10e'),_0x300da9[_0x8388('0x10f')],_0x275f07[_0x8388('0x110')]):util[_0x8388('0xb8')](_0x8388('0x111'),_0x300da9[_0x8388('0x10f')])},client9002)[_0x8388('0x23')](function(_0x5905ce){var _0x318456=_0x5905ce&&_0x5905ce[_0x8388('0x112')](_0x8388('0x113'))>=0x0?!![]:![];logger[_0x8388('0x24')](_0x8388('0x114'),_0x275f07['id'],_0x300da9['id'],_0x300da9[_0x8388('0x10f')],_0x318456?_0x8388('0x115'):_0x8388('0x116'),_0x275f07['timezone']?_0x275f07[_0x8388('0x110')]:_0x8388('0x117'));return _0x318456;})['catch'](function(_0x5f2f1){logger[_0x8388('0x2a')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x275f07['id'],_0x300da9['id'],_0x300da9[_0x8388('0x10f')],util[_0x8388('0x118')](_0x5f2f1,{'showHidden':![],'depth':null}),_0x275f07[_0x8388('0x110')]?_0x275f07[_0x8388('0x110')]:'No\x20timezone');return![];});}exports[_0x8388('0x10d')]=function(_0x1a49fe,_0x576527,_0x393a01){var _0xc933dd=0x0;var _0x842f85=0x0;var _0x2573b9=![];var _0x4daadd;var _0x2fb2e4;return db[_0x8388('0x46')][_0x8388('0x62')]({'where':{'id':_0x1a49fe[_0x8388('0x5f')]['id']},'include':[{'model':db[_0x8388('0x119')],'as':_0x8388('0x119'),'include':[{'model':db[_0x8388('0x119')],'as':_0x8388('0x11a'),'attributes':['id',_0x8388('0x10f')],'raw':!![]}]}]})[_0x8388('0x23')](handleEntityNotFound(_0x576527,null))[_0x8388('0x23')](function(_0x9ae9af){if(_0x9ae9af){_0x4daadd=_0x9ae9af;return _0x9ae9af['getProactiveActions']({'raw':!![]});}})['then'](function(_0x44280e){if(_0x4daadd){if(_0x44280e){_0x2fb2e4=_0x44280e;}}return require(_0x8388('0x7e'))['getLicense']();})['then'](function(_0x5baf2e){if(_0x5baf2e){_0x842f85=_0x5baf2e[_0x8388('0x11b')];_0x2573b9=_0x5baf2e[_0x8388('0x80')];}})[_0x8388('0x23')](function(){return db[_0x8388('0xc0')]['count']({'where':{'closed':![]}});})[_0x8388('0x23')](function(_0x562ecd){_0xc933dd=_0x562ecd;if(_0x842f85&&_0x562ecd>_0x842f85){return db[_0x8388('0x11c')][_0x8388('0x6d')]({'where':{'id':0x1}})[_0x8388('0x23')](function(_0x427929){if(_0x427929){_0x427929[_0x8388('0x11d')](_0x8388('0x11e'));}});}})[_0x8388('0x23')](function(){if(_0x4daadd[_0x8388('0x119')]&&_0x4daadd[_0x8388('0x119')]['Intervals']){var _0x1067c0=[];for(var _0x547437=0x0;_0x547437<_0x4daadd[_0x8388('0x119')][_0x8388('0x11a')][_0x8388('0x50')];_0x547437++){var _0x58ba3c=_0x4daadd[_0x8388('0x119')][_0x8388('0x11a')][_0x547437][_0x8388('0x3d')]({'plain':!![]});_0x1067c0['push'](iftimePromise(_0x58ba3c,_0x4daadd));}return BPromise[_0x8388('0x11f')](_0x1067c0)[_0x8388('0x23')](function(_0x2fa003){return _[_0x8388('0x120')](_0x2fa003);});}else{return!![];}})[_0x8388('0x23')](function(_0x43cd5b){var _0x101989=fs[_0x8388('0xdc')](path[_0x8388('0x7c')](config[_0x8388('0x83')],_0x8388('0x121')),_0x8388('0xde'));var _0x5db9ae={'remote':_0x4daadd[_0x8388('0x122')],'query':querystring['stringify'](_[_0x8388('0x59')](_0x4daadd[_0x8388('0x3d')]({'plain':!![]}),{'customerIp':_0x1a49fe[_0x8388('0x92')][_0x8388('0x123')]||_0x1a49fe[_0x8388('0x92')]['x-real-ip']||_0x1a49fe[_0x8388('0x124')][_0x8388('0x125')]||_0x1a49fe['ip'],'referer':_0x1a49fe[_0x8388('0x92')][_0x8388('0xb5')],'openedInteractions':_0xc933dd,'maxInteractions':_0x842f85,'virtual':_0x2573b9[_0x8388('0x11b')],'online':_0x43cd5b,'custom':_0x2573b9}))['replace'](/'/g,'\x5c\x27')};_0x576527[_0x8388('0x42')](ejs[_0x8388('0x126')](Mustache[_0x8388('0x126')](_0x101989,_0x5db9ae),{'proactiveActions':_0x2fb2e4,'alignment':_0x4daadd[_0x8388('0x127')],'verticalAlignment':_0x4daadd[_0x8388('0x128')],'div_color':_0x4daadd['color'],'text_color':_0x4daadd['textColor'],'button_color':_0x4daadd['color_button'],'background_color':_0x4daadd[_0x8388('0x129')]}));})['catch'](handleError(_0x576527,null));};exports[_0x8388('0x12a')]=function(_0x3cf226,_0x27e081,_0x4abd49){return db[_0x8388('0x46')][_0x8388('0x6d')]({'where':{'id':_0x3cf226[_0x8388('0x5f')]['id']}})[_0x8388('0x23')](handleEntityNotFound(_0x27e081,null))['then'](function(_0x35466d){if(_0x35466d){return db[_0x8388('0xe8')][_0x8388('0xe9')](function(_0x410ac0){return db[_0x8388('0xa5')][_0x8388('0x3c')]({'where':{'ChatWebsiteId':_0x3cf226[_0x8388('0x5f')]['id']},'transaction':_0x410ac0})[_0x8388('0x23')](function(_0x1d783f){var _0x42f282=_['map'](_0x3cf226[_0x8388('0x64')],function(_0x2381e8){_0x2381e8['ChatWebsiteId']=_0x3cf226[_0x8388('0x5f')]['id'];return _0x2381e8;});return db[_0x8388('0xa5')][_0x8388('0xeb')](_0x42f282,{'transaction':_0x410ac0});});})[_0x8388('0x23')](function(){return db[_0x8388('0xa5')][_0x8388('0x12b')]({'where':{'ChatWebsiteId':_0x3cf226[_0x8388('0x5f')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x27e081,null))[_0x8388('0x2e')](handleError(_0x27e081,null));};exports[_0x8388('0x12c')]=function(_0x5de8be,_0x101362,_0x10c498){var _0x415c5d={};var _0x4b35c8={};var _0x3ef806;var _0x553167;return db[_0x8388('0x46')]['findOne']({'where':{'id':_0x5de8be['params']['id']}})[_0x8388('0x23')](handleEntityNotFound(_0x101362,null))[_0x8388('0x23')](function(_0x1d8e21){if(_0x1d8e21){_0x3ef806=_0x1d8e21;_0x4b35c8[_0x8388('0x4b')]=_['keys'](db[_0x8388('0xa5')][_0x8388('0x47')]);_0x4b35c8[_0x8388('0x4c')]=_[_0x8388('0x61')](_0x5de8be[_0x8388('0x4c')]);_0x4b35c8[_0x8388('0x57')]=_[_0x8388('0x4d')](_0x4b35c8[_0x8388('0x4b')],_0x4b35c8['query']);_0x415c5d[_0x8388('0x4f')]=_[_0x8388('0x4d')](_0x4b35c8['model'],qs[_0x8388('0x4e')](_0x5de8be[_0x8388('0x4c')][_0x8388('0x4e')]));_0x415c5d['attributes']=_0x415c5d[_0x8388('0x4f')][_0x8388('0x50')]?_0x415c5d['attributes']:_0x4b35c8['model'];_0x415c5d[_0x8388('0x53')]=qs[_0x8388('0x54')](_0x5de8be[_0x8388('0x4c')][_0x8388('0x54')]);_0x415c5d[_0x8388('0x55')]=qs[_0x8388('0x57')](_[_0x8388('0x56')](_0x5de8be['query'],_0x4b35c8['filters']));if(_0x5de8be[_0x8388('0x4c')][_0x8388('0x58')]){_0x415c5d[_0x8388('0x55')]=_['merge'](_0x415c5d[_0x8388('0x55')],{'$or':_['map'](_0x415c5d[_0x8388('0x4f')],function(_0x53fdf2){var _0x5bc10d={};_0x5bc10d[_0x53fdf2]={'$like':'%'+_0x5de8be[_0x8388('0x4c')]['filter']+'%'};return _0x5bc10d;})});}_0x415c5d=_[_0x8388('0x59')]({},_0x415c5d,_0x5de8be[_0x8388('0x5b')]);return _0x3ef806[_0x8388('0x12c')](_0x415c5d);}})['then'](function(_0x22785c){if(_0x22785c){_0x553167=_0x22785c[_0x8388('0x50')];if(!_0x5de8be[_0x8388('0x4c')][_0x8388('0x51')](_0x8388('0x52'))){_0x415c5d[_0x8388('0x33')]=qs['limit'](_0x5de8be[_0x8388('0x4c')][_0x8388('0x33')]);_0x415c5d[_0x8388('0x35')]=qs[_0x8388('0x35')](_0x5de8be[_0x8388('0x4c')][_0x8388('0x35')]);}return _0x3ef806[_0x8388('0x12c')](_0x415c5d);}})['then'](function(_0x2fd198){if(_0x2fd198){return _0x2fd198?{'count':_0x553167,'rows':_0x2fd198}:null;}})[_0x8388('0x23')](respondWithResult(_0x101362,null))[_0x8388('0x2e')](handleError(_0x101362,null));};exports[_0x8388('0x12d')]=function(_0x401c56,_0x58fb14,_0x34f8f3){return db[_0x8388('0x12e')][_0x8388('0x62')]({'where':{'id':_0x401c56['params']['id']}})['then'](handleEntityNotFound(_0x58fb14,null))[_0x8388('0x23')](function(_0x595327){if(_0x595327){return _0x595327[_0x8388('0x12d')](_0x401c56[_0x8388('0x64')][_0x8388('0x75')],_[_0x8388('0x105')](_0x401c56[_0x8388('0x64')],[_0x8388('0x75'),'id'])||{});}})['then'](respondWithResult(_0x58fb14,null))[_0x8388('0x2e')](handleError(_0x58fb14,null));};exports['getProactiveActions']=function(_0x358066,_0x530c57,_0x282d7a){var _0x5cf9d2={};var _0x5e695e={};var _0x10a758;var _0xe28b0f;return db['ChatWebsite'][_0x8388('0x6d')]({'where':{'id':_0x358066['params']['id']}})[_0x8388('0x23')](handleEntityNotFound(_0x530c57,null))[_0x8388('0x23')](function(_0x431847){if(_0x431847){_0x10a758=_0x431847;_0x5e695e['model']=_[_0x8388('0x61')](db[_0x8388('0x12f')][_0x8388('0x47')]);_0x5e695e[_0x8388('0x4c')]=_[_0x8388('0x61')](_0x358066['query']);_0x5e695e[_0x8388('0x57')]=_[_0x8388('0x4d')](_0x5e695e['model'],_0x5e695e[_0x8388('0x4c')]);_0x5cf9d2[_0x8388('0x4f')]=_['intersection'](_0x5e695e[_0x8388('0x4b')],qs[_0x8388('0x4e')](_0x358066[_0x8388('0x4c')]['fields']));_0x5cf9d2[_0x8388('0x4f')]=_0x5cf9d2['attributes']['length']?_0x5cf9d2['attributes']:_0x5e695e['model'];_0x5cf9d2[_0x8388('0x53')]=qs['sort'](_0x358066[_0x8388('0x4c')]['sort']);_0x5cf9d2[_0x8388('0x55')]=qs['filters'](_[_0x8388('0x56')](_0x358066['query'],_0x5e695e[_0x8388('0x57')]));if(_0x358066['query']['filter']){_0x5cf9d2[_0x8388('0x55')]=_[_0x8388('0x59')](_0x5cf9d2[_0x8388('0x55')],{'$or':_[_0x8388('0x45')](_0x5cf9d2[_0x8388('0x4f')],function(_0x54dade){var _0x1137cc={};_0x1137cc[_0x54dade]={'$like':'%'+_0x358066[_0x8388('0x4c')][_0x8388('0x58')]+'%'};return _0x1137cc;})});}_0x5cf9d2=_[_0x8388('0x59')]({},_0x5cf9d2,_0x358066[_0x8388('0x5b')]);return _0x10a758['getProactiveActions'](_0x5cf9d2);}})[_0x8388('0x23')](function(_0x21e069){if(_0x21e069){_0xe28b0f=_0x21e069[_0x8388('0x50')];if(!_0x358066[_0x8388('0x4c')]['hasOwnProperty']('nolimit')){_0x5cf9d2[_0x8388('0x33')]=qs[_0x8388('0x33')](_0x358066[_0x8388('0x4c')][_0x8388('0x33')]);_0x5cf9d2['offset']=qs[_0x8388('0x35')](_0x358066[_0x8388('0x4c')][_0x8388('0x35')]);}return _0x10a758[_0x8388('0x130')](_0x5cf9d2);}})[_0x8388('0x23')](function(_0x37cd32){if(_0x37cd32){return _0x37cd32?{'count':_0xe28b0f,'rows':_0x37cd32}:null;}})[_0x8388('0x23')](respondWithResult(_0x530c57,null))[_0x8388('0x2e')](handleError(_0x530c57,null));};exports[_0x8388('0x131')]=function(_0x4c5751,_0x582b98,_0x84e462){var _0x4779cd=_0x4c5751[_0x8388('0x4c')][_0x8388('0x132')]===_0x8388('0x133')?_0x8388('0x134'):_0x8388('0x135');return db[_0x8388('0x46')][_0x8388('0x62')]({'attributes':['id',_0x4779cd],'where':{'id':_0x4c5751['params']['id']}})['then'](handleEntityNotFound(_0x582b98,null))['then'](function(_0x9d8948){if(_0x9d8948){var _0x116e94=_0x9d8948[_0x4779cd];var _0x19ba0d=_0x116e94&&_0x116e94[_0x8388('0x136')]?_0x116e94['items']:[];_0x582b98['send']({'fromKey':_[_0x8388('0x81')](_0x116e94[_0x8388('0x137')])?undefined:_0x116e94[_0x8388('0x137')],'count':_0x19ba0d[_0x8388('0x50')],'rows':_0x19ba0d});}})[_0x8388('0x2e')](handleError(_0x582b98,null));};exports[_0x8388('0x138')]=function(_0x1c2e1e,_0x59a733,_0x3f3b78){var _0x1237be={'raw':![],'where':{}};var _0xa67328={};var _0x1f2b57={'count':0x0,'rows':[]};return db[_0x8388('0x46')][_0x8388('0x6d')]({'where':{'id':_0x1c2e1e['params']['id']}})[_0x8388('0x23')](handleEntityNotFound(_0x59a733,null))['then'](function(_0x37a20f){if(_0x37a20f){_0xa67328['model']=_[_0x8388('0x61')](db[_0x8388('0xe1')][_0x8388('0x47')]);_0xa67328[_0x8388('0x4c')]=_['keys'](_0x1c2e1e[_0x8388('0x4c')]);_0xa67328[_0x8388('0x57')]=_[_0x8388('0x4d')](_0xa67328[_0x8388('0x4b')],_0xa67328[_0x8388('0x4c')]);_0x1237be['attributes']=_[_0x8388('0x4d')](_0xa67328[_0x8388('0x4b')],qs['fields'](_0x1c2e1e[_0x8388('0x4c')][_0x8388('0x4e')]));_0x1237be[_0x8388('0x4f')]=_0x1237be[_0x8388('0x4f')][_0x8388('0x50')]?_0x1237be[_0x8388('0x4f')]:_0xa67328[_0x8388('0x4b')];if(!_0x1c2e1e['query'][_0x8388('0x51')](_0x8388('0x52'))){_0x1237be[_0x8388('0x33')]=qs[_0x8388('0x33')](_0x1c2e1e['query'][_0x8388('0x33')]);_0x1237be[_0x8388('0x35')]=qs[_0x8388('0x35')](_0x1c2e1e[_0x8388('0x4c')][_0x8388('0x35')]);}_0x1237be[_0x8388('0x53')]=qs[_0x8388('0x54')](_0x1c2e1e[_0x8388('0x4c')][_0x8388('0x54')]);_0x1237be[_0x8388('0x55')]=qs['filters'](_['pick'](_0x1c2e1e['query'],_0xa67328[_0x8388('0x57')]));_0x1237be[_0x8388('0x55')][_0x8388('0x73')]=_0x37a20f['id'];if(_0x1c2e1e[_0x8388('0x4c')][_0x8388('0x58')]){_0x1237be['where']=_[_0x8388('0x59')](_0x1237be['where'],{'$or':_[_0x8388('0x45')](_0x1237be[_0x8388('0x4f')],function(_0x1f056f){var _0x5a626d={};_0x5a626d[_0x1f056f]={'$like':'%'+_0x1c2e1e[_0x8388('0x4c')][_0x8388('0x58')]+'%'};return _0x5a626d;})});}_0x1237be=_[_0x8388('0x59')]({},_0x1237be,_0x1c2e1e['options']);return db[_0x8388('0xe1')][_0x8388('0x36')]({'where':_0x1237be[_0x8388('0x55')]})['then'](function(_0x30d0b9){_0x1f2b57[_0x8388('0x36')]=_0x30d0b9;if(_0x1c2e1e[_0x8388('0x4c')][_0x8388('0x6e')]){_0x1237be[_0x8388('0x5c')]=[{'all':!![]}];}else{_0x1237be[_0x8388('0x5c')]=[{'model':db[_0x8388('0x95')],'as':'Contact','required':![]},{'model':db[_0x8388('0xea')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage'][_0x8388('0x5d')](_0x1237be);})['then'](function(_0xd2091e){_0x1f2b57[_0x8388('0x5e')]=_0xd2091e;return _0x1f2b57;});}})[_0x8388('0x23')](respondWithFilteredResult(_0x59a733,_0x1237be))[_0x8388('0x2e')](handleError(_0x59a733,null));};exports[_0x8388('0x139')]=function(_0x1fa666,_0x1d7aa6,_0x4cacf0){return db[_0x8388('0x46')][_0x8388('0x62')]({'where':{'id':_0x1fa666['params']['id']}})['then'](handleEntityNotFound(_0x1d7aa6,null))[_0x8388('0x23')](function(_0x2dbcaf){if(_0x2dbcaf){return _0x2dbcaf[_0x8388('0x139')](_0x1fa666[_0x8388('0x64')]['ids'],_['omit'](_0x1fa666['body'],[_0x8388('0x75'),'id'])||{})[_0x8388('0xc3')](function(_0x562629){for(var _0x7a5a65=0x0;_0x7a5a65<_0x1fa666['body'][_0x8388('0x75')][_0x8388('0x50')];_0x7a5a65+=0x1){socket[_0x8388('0x13a')]('userChatWebsite:save',{'UserId':Number(_0x1fa666['body'][_0x8388('0x75')][_0x7a5a65]),'ChatWebsiteId':Number(_0x1fa666['params']['id'])});}return _0x562629;});}})['then'](respondWithResult(_0x1d7aa6,null))[_0x8388('0x2e')](handleError(_0x1d7aa6,null));};exports[_0x8388('0x13b')]=function(_0x3320e4,_0xa1fcc5,_0x12c14e){return db[_0x8388('0x46')][_0x8388('0x62')]({'where':{'id':_0x3320e4[_0x8388('0x5f')]['id']}})[_0x8388('0x23')](handleEntityNotFound(_0xa1fcc5,null))[_0x8388('0x23')](function(_0x492abc){if(_0x492abc){return _0x492abc['removeAgents'](_0x3320e4[_0x8388('0x4c')]['ids'])[_0x8388('0x23')](function(){if(_[_0x8388('0x13c')](_0x3320e4[_0x8388('0x4c')]['ids'])){for(var _0x536eec=0x0;_0x536eec<_0x3320e4[_0x8388('0x4c')]['ids'][_0x8388('0x50')];_0x536eec+=0x1){socket[_0x8388('0x13a')](_0x8388('0x13d'),{'UserId':Number(_0x3320e4['query'][_0x8388('0x75')][_0x536eec]),'ChatWebsiteId':Number(_0x3320e4['params']['id'])});}}else{socket[_0x8388('0x13a')](_0x8388('0x13d'),{'UserId':Number(_0x3320e4['query'][_0x8388('0x75')]),'ChatWebsiteId':Number(_0x3320e4['params']['id'])});}});}})['then'](respondWithStatusCode(_0xa1fcc5,null))[_0x8388('0x2e')](handleError(_0xa1fcc5,null));};exports[_0x8388('0x13e')]=function(_0x2318c7,_0x2a81a7,_0x83effe){var _0x292409={};var _0xd1a9f5={};var _0x242459;var _0x519fc9;return db[_0x8388('0x46')][_0x8388('0x6d')]({'where':{'id':_0x2318c7['params']['id']}})['then'](handleEntityNotFound(_0x2a81a7,null))[_0x8388('0x23')](function(_0x10dfba){if(_0x10dfba){_0x242459=_0x10dfba;_0xd1a9f5[_0x8388('0x4b')]=_[_0x8388('0x61')](db['User'][_0x8388('0x47')]);_0xd1a9f5[_0x8388('0x4c')]=_['keys'](_0x2318c7[_0x8388('0x4c')]);_0xd1a9f5[_0x8388('0x57')]=_['intersection'](_0xd1a9f5['model'],_0xd1a9f5[_0x8388('0x4c')]);_0x292409['attributes']=_[_0x8388('0x4d')](_0xd1a9f5['model'],qs['fields'](_0x2318c7['query']['fields']));_0x292409[_0x8388('0x4f')]=_0x292409[_0x8388('0x4f')][_0x8388('0x50')]?_0x292409[_0x8388('0x4f')]:_0xd1a9f5[_0x8388('0x4b')];_0x292409[_0x8388('0x53')]=qs[_0x8388('0x54')](_0x2318c7[_0x8388('0x4c')][_0x8388('0x54')]);_0x292409[_0x8388('0x55')]=qs[_0x8388('0x57')](_[_0x8388('0x56')](_0x2318c7['query'],_0xd1a9f5[_0x8388('0x57')]));if(_0x2318c7[_0x8388('0x4c')][_0x8388('0x58')]){_0x292409['where']=_[_0x8388('0x59')](_0x292409[_0x8388('0x55')],{'$or':_[_0x8388('0x45')](_0x292409[_0x8388('0x4f')],function(_0x31d9ed){var _0x33fc5e={};_0x33fc5e[_0x31d9ed]={'$like':'%'+_0x2318c7['query'][_0x8388('0x58')]+'%'};return _0x33fc5e;})});}_0x292409=_['merge']({},_0x292409,_0x2318c7[_0x8388('0x5b')]);return _0x242459[_0x8388('0x13e')](_0x292409);}})['then'](function(_0x49874e){if(_0x49874e){_0x519fc9=_0x49874e[_0x8388('0x50')];if(!_0x2318c7['query'][_0x8388('0x51')](_0x8388('0x52'))){_0x292409['limit']=qs[_0x8388('0x33')](_0x2318c7['query']['limit']);_0x292409[_0x8388('0x35')]=qs[_0x8388('0x35')](_0x2318c7[_0x8388('0x4c')][_0x8388('0x35')]);}return _0x242459[_0x8388('0x13e')](_0x292409);}})['then'](function(_0x2d6c98){if(_0x2d6c98){return _0x2d6c98?{'count':_0x519fc9,'rows':_0x2d6c98}:null;}})[_0x8388('0x23')](respondWithResult(_0x2a81a7,null))[_0x8388('0x2e')](handleError(_0x2a81a7,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index ff70d15..b10617a 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 _0x3c7b=['setMaxListeners','save','emit','hook','exports','events','../../mysqldb','ChatWebsite'];(function(_0x131f95,_0x52919a){var _0x405fd2=function(_0x2dd12d){while(--_0x2dd12d){_0x131f95['push'](_0x131f95['shift']());}};_0x405fd2(++_0x52919a);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x14d079,_0x4b6d7b){_0x14d079=_0x14d079-0x0;var _0x74dcd=_0x3c7b[_0x14d079];return _0x74dcd;};'use strict';var EventEmitter=require(_0xb3c7('0x0'));var ChatWebsite=require(_0xb3c7('0x1'))['db'][_0xb3c7('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xb3c7('0x3')](0x0);var events={'afterCreate':_0xb3c7('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x500bea){return function(_0x5b34ef,_0x234fe5,_0x44c399){ChatWebsiteEvents['emit'](_0x500bea+':'+_0x5b34ef['id'],_0x5b34ef);ChatWebsiteEvents[_0xb3c7('0x5')](_0x500bea,_0x5b34ef);_0x44c399(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xb3c7('0x6')](e,emitEvent(event));}}module[_0xb3c7('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0x8ef6=['hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit'];(function(_0x73e5b0,_0x241ec0){var _0x23ed6f=function(_0x12825c){while(--_0x12825c){_0x73e5b0['push'](_0x73e5b0['shift']());}};_0x23ed6f(++_0x241ec0);}(_0x8ef6,0xf2));var _0x68ef=function(_0x569441,_0x4cd9c3){_0x569441=_0x569441-0x0;var _0x13f6b2=_0x8ef6[_0x569441];return _0x13f6b2;};'use strict';var EventEmitter=require(_0x68ef('0x0'));var ChatWebsite=require(_0x68ef('0x1'))['db'][_0x68ef('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x68ef('0x3')](0x0);var events={'afterCreate':_0x68ef('0x4'),'afterUpdate':_0x68ef('0x5'),'afterDestroy':_0x68ef('0x6')};function emitEvent(_0x4a72b8){return function(_0x27d0af,_0x129ce,_0xbab618){ChatWebsiteEvents[_0x68ef('0x7')](_0x4a72b8+':'+_0x27d0af['id'],_0x27d0af);ChatWebsiteEvents['emit'](_0x4a72b8,_0x27d0af);_0xbab618(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x68ef('0x8')](e,emitEvent(event));}}module[_0x68ef('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 1ab5f6d..f2c81ca 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 _0x651a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites'];(function(_0x31930f,_0x4f5869){var _0x3fab66=function(_0x3644b2){while(--_0x3644b2){_0x31930f['push'](_0x31930f['shift']());}};_0x3fab66(++_0x4f5869);}(_0x651a,0xf0));var _0xa651=function(_0x18f82b,_0x3ea7a0){_0x18f82b=_0x18f82b-0x0;var _0x5d8128=_0x651a[_0x18f82b];return _0x5d8128;};'use strict';var _=require(_0xa651('0x0'));var util=require(_0xa651('0x1'));var logger=require(_0xa651('0x2'))(_0xa651('0x3'));var moment=require(_0xa651('0x4'));var BPromise=require(_0xa651('0x5'));var rp=require(_0xa651('0x6'));var fs=require('fs');var path=require(_0xa651('0x7'));var rimraf=require(_0xa651('0x8'));var config=require(_0xa651('0x9'));var attributes=require(_0xa651('0xa'));module[_0xa651('0xb')]=function(_0x4242d6,_0x8ae13){return _0x4242d6[_0xa651('0xc')](_0xa651('0xd'),attributes,{'tableName':_0xa651('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fc4=['request-promise','path','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x21a848,_0x5ce41a){var _0x5aaf99=function(_0x342593){while(--_0x342593){_0x21a848['push'](_0x21a848['shift']());}};_0x5aaf99(++_0x5ce41a);}(_0x8fc4,0x1c1));var _0x48fc=function(_0x3ad847,_0x275ac7){_0x3ad847=_0x3ad847-0x0;var _0x2120b4=_0x8fc4[_0x3ad847];return _0x2120b4;};'use strict';var _=require(_0x48fc('0x0'));var util=require(_0x48fc('0x1'));var logger=require(_0x48fc('0x2'))(_0x48fc('0x3'));var moment=require(_0x48fc('0x4'));var BPromise=require(_0x48fc('0x5'));var rp=require(_0x48fc('0x6'));var fs=require('fs');var path=require(_0x48fc('0x7'));var rimraf=require(_0x48fc('0x8'));var config=require(_0x48fc('0x9'));var attributes=require(_0x48fc('0xa'));module[_0x48fc('0xb')]=function(_0x5af58d,_0x1a5fcb){return _0x5af58d[_0x48fc('0xc')]('ChatWebsite',attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index b831990..8a06627 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 _0xdaab=['../../config/utils','../../config/logger','rpc','http','redis','localhost','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','bluebird','randomstring','ioredis'];(function(_0x30bda8,_0x2a47f4){var _0x187982=function(_0x3c5959){while(--_0x3c5959){_0x30bda8['push'](_0x30bda8['shift']());}};_0x187982(++_0x2a47f4);}(_0xdaab,0xe3));var _0xbdaa=function(_0x230747,_0x26a388){_0x230747=_0x230747-0x0;var _0xfe319b=_0xdaab[_0x230747];return _0xfe319b;};'use strict';var _=require(_0xbdaa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbdaa('0x1'));var rs=require(_0xbdaa('0x2'));var fs=require('fs');var Redis=require(_0xbdaa('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbdaa('0x4'));var logger=require(_0xbdaa('0x5'))(_0xbdaa('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xbdaa('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0xbdaa('0x8')],{'host':_0xbdaa('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbdaa('0x8')]));require('./chatWebsite.socket')[_0xbdaa('0xa')](socket);function respondWithRpcPromise(_0x3cc253,_0x5940bb,_0xbe71bc){return new BPromise(function(_0x3683be,_0x544a40){return client['request'](_0x3cc253,_0xbe71bc)[_0xbdaa('0xb')](function(_0x57a65e){logger[_0xbdaa('0xc')](_0xbdaa('0xd'),_0x5940bb,_0xbdaa('0xe'));logger[_0xbdaa('0xf')](_0xbdaa('0x10'),_0x5940bb,_0xbdaa('0xe'),JSON[_0xbdaa('0x11')](_0x57a65e));if(_0x57a65e['error']){if(_0x57a65e[_0xbdaa('0x12')][_0xbdaa('0x13')]===0x1f4){logger['error'](_0xbdaa('0xd'),_0x5940bb,_0x57a65e['error'][_0xbdaa('0x14')]);return _0x544a40(_0x57a65e['error'][_0xbdaa('0x14')]);}logger[_0xbdaa('0x12')](_0xbdaa('0xd'),_0x5940bb,_0x57a65e['error']['message']);return _0x3683be(_0x57a65e[_0xbdaa('0x12')]['message']);}else{logger['info'](_0xbdaa('0xd'),_0x5940bb,_0xbdaa('0xe'));_0x3683be(_0x57a65e['result']['message']);}})['catch'](function(_0x2fd096){logger[_0xbdaa('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x5940bb,_0x2fd096);_0x544a40(_0x2fd096);});});} \ No newline at end of file +var _0x34f0=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','./chatWebsite.socket','register','request','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','lodash'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x34f0,0x15e));var _0x034f=function(_0x50b9b5,_0xabece1){_0x50b9b5=_0x50b9b5-0x0;var _0x883384=_0x34f0[_0x50b9b5];return _0x883384;};'use strict';var _=require(_0x034f('0x0'));var util=require(_0x034f('0x1'));var moment=require(_0x034f('0x2'));var BPromise=require(_0x034f('0x3'));var rs=require(_0x034f('0x4'));var fs=require('fs');var Redis=require(_0x034f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x034f('0x6'));var logger=require(_0x034f('0x7'))('rpc');var config=require(_0x034f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x034f('0x9')][_0x034f('0xa')]({'port':0x232a});config['redis']=_[_0x034f('0xb')](config[_0x034f('0xc')],{'host':_0x034f('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x034f('0xc')]));require(_0x034f('0xe'))[_0x034f('0xf')](socket);function respondWithRpcPromise(_0x43e246,_0x102278,_0x773a9){return new BPromise(function(_0x481477,_0x4b947b){return client[_0x034f('0x10')](_0x43e246,_0x773a9)['then'](function(_0x55a4d6){logger[_0x034f('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x102278,_0x034f('0x12'));logger[_0x034f('0x13')](_0x034f('0x14'),_0x102278,_0x034f('0x12'),JSON[_0x034f('0x15')](_0x55a4d6));if(_0x55a4d6[_0x034f('0x16')]){if(_0x55a4d6['error'][_0x034f('0x17')]===0x1f4){logger[_0x034f('0x16')](_0x034f('0x18'),_0x102278,_0x55a4d6[_0x034f('0x16')][_0x034f('0x19')]);return _0x4b947b(_0x55a4d6[_0x034f('0x16')][_0x034f('0x19')]);}logger[_0x034f('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x102278,_0x55a4d6[_0x034f('0x16')][_0x034f('0x19')]);return _0x481477(_0x55a4d6[_0x034f('0x16')][_0x034f('0x19')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x102278,_0x034f('0x12'));_0x481477(_0x55a4d6['result'][_0x034f('0x19')]);}})[_0x034f('0x1a')](function(_0x59e187){logger[_0x034f('0x16')](_0x034f('0x18'),_0x102278,_0x59e187);_0x4b947b(_0x59e187);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index f890c3d..c207567 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 _0xaed8=['remove','update','emit','removeListener','length','chatWebsite:','save'];(function(_0x16f39a,_0x233f55){var _0xd6a5da=function(_0x179a80){while(--_0x179a80){_0x16f39a['push'](_0x16f39a['shift']());}};_0xd6a5da(++_0x233f55);}(_0xaed8,0x102));var _0x8aed=function(_0x4d82ea,_0x4d459f){_0x4d82ea=_0x4d82ea-0x0;var _0x257f4a=_0xaed8[_0x4d82ea];return _0x257f4a;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x8aed('0x0'),_0x8aed('0x1'),_0x8aed('0x2')];function createListener(_0x3f2364,_0x5924a5){return function(_0x2a6bdd){_0x5924a5[_0x8aed('0x3')](_0x3f2364,_0x2a6bdd);};}function removeListener(_0x9bddfe,_0x146906){return function(){ChatWebsiteEvents[_0x8aed('0x4')](_0x9bddfe,_0x146906);};}exports['register']=function(_0x5c6b9d){for(var _0x2a5084=0x0,_0x5dce12=events[_0x8aed('0x5')];_0x2a5084<_0x5dce12;_0x2a5084++){var _0x1c2ff2=events[_0x2a5084];var _0x28cba8=createListener(_0x8aed('0x6')+_0x1c2ff2,_0x5c6b9d);ChatWebsiteEvents['on'](_0x1c2ff2,_0x28cba8);}}; \ No newline at end of file +var _0x50f6=['emit','removeListener','register','length','./chatWebsite.events','save','remove','update'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x50f6,0x94));var _0x650f=function(_0x56085e,_0x5c69e9){_0x56085e=_0x56085e-0x0;var _0x4de130=_0x50f6[_0x56085e];return _0x4de130;};'use strict';var ChatWebsiteEvents=require(_0x650f('0x0'));var events=[_0x650f('0x1'),_0x650f('0x2'),_0x650f('0x3')];function createListener(_0xc1b39d,_0xd2b427){return function(_0x3225a1){_0xd2b427[_0x650f('0x4')](_0xc1b39d,_0x3225a1);};}function removeListener(_0x1f7ab2,_0x321533){return function(){ChatWebsiteEvents[_0x650f('0x5')](_0x1f7ab2,_0x321533);};}exports[_0x650f('0x6')]=function(_0x54dce2){for(var _0xb224dc=0x0,_0x5307b2=events[_0x650f('0x7')];_0xb224dc<_0x5307b2;_0xb224dc++){var _0x43b244=events[_0xb224dc];var _0x31226a=createListener('chatWebsite:'+_0x43b244,_0x54dce2);ChatWebsiteEvents['on'](_0x43b244,_0x31226a);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 933c060..2e72194 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 _0x7212=['/:id/applications','getApplications','/:id/proactive_actions','/:id/fields','getFields','getOfflineMessages','/:id/users','getAgents','create','post','/:id/dispositions','diskStorage','root','server/files/images/logos/','%s-%s','now','originalname','single','file','addLogo','join','server/files/images/avatars/','format','/:id/avatar','addAvatar','/:id/notify','attachments','offline-chat','replace','any','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','put','/:id','update','delete','removeDispositions','removeAgents','exports','multer','express','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getInteractions','/:id/snippet','getSnippet'];(function(_0x57904d,_0x58e82f){var _0x105cfc=function(_0x44ba55){while(--_0x44ba55){_0x57904d['push'](_0x57904d['shift']());}};_0x105cfc(++_0x58e82f);}(_0x7212,0x1e3));var _0x2721=function(_0x4f0ee5,_0x4aaec5){_0x4f0ee5=_0x4f0ee5-0x0;var _0x1661dc=_0x7212[_0x4f0ee5];return _0x1661dc;};'use strict';var multer=require(_0x2721('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2721('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2721('0x2'));var config=require('../../config/environment');var controller=require('./chatWebsite.controller');router[_0x2721('0x3')]('/',auth[_0x2721('0x4')](),controller[_0x2721('0x5')]);router['get'](_0x2721('0x6'),auth[_0x2721('0x4')](),controller[_0x2721('0x7')]);router[_0x2721('0x3')]('/:id',auth['isAuthenticated'](),controller[_0x2721('0x8')]);router['get']('/:id/dispositions',auth['isAuthenticated'](),controller[_0x2721('0x9')]);router['get'](_0x2721('0xa'),auth[_0x2721('0x4')](),controller[_0x2721('0xb')]);router[_0x2721('0x3')](_0x2721('0xc'),controller[_0x2721('0xd')]);router['get']('/:id/avatar',controller[_0x2721('0xe')]);router[_0x2721('0x3')](_0x2721('0xf'),controller[_0x2721('0x10')]);router[_0x2721('0x3')](_0x2721('0x11'),controller['getSystemAvatar']);router[_0x2721('0x3')]('/:id/interactions',auth[_0x2721('0x4')](),controller[_0x2721('0x12')]);router[_0x2721('0x3')](_0x2721('0x13'),controller[_0x2721('0x14')]);router[_0x2721('0x3')](_0x2721('0x15'),auth[_0x2721('0x4')](),controller[_0x2721('0x16')]);router[_0x2721('0x3')](_0x2721('0x17'),auth[_0x2721('0x4')](),controller['getProactiveActions']);router[_0x2721('0x3')](_0x2721('0x18'),controller[_0x2721('0x19')]);router[_0x2721('0x3')]('/:id/offline_messages',auth[_0x2721('0x4')](),controller[_0x2721('0x1a')]);router[_0x2721('0x3')](_0x2721('0x1b'),auth['isAuthenticated'](),controller[_0x2721('0x1c')]);router['post']('/',auth[_0x2721('0x4')](),controller[_0x2721('0x1d')]);router[_0x2721('0x1e')](_0x2721('0x1f'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x2721('0x1e')](_0x2721('0xa'),auth[_0x2721('0x4')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x2721('0x20')]({'destination':function(_0x13c101,_0xa2c46d,_0x5e4324){_0x5e4324(null,path['join'](config[_0x2721('0x21')],_0x2721('0x22')));},'filename':function(_0x49dfd9,_0xef2b48,_0x3e7028){_0x3e7028(null,util['format'](_0x2721('0x23'),Date[_0x2721('0x24')](),_0xef2b48[_0x2721('0x25')]));}})});router[_0x2721('0x1e')](_0x2721('0xc'),upload[_0x2721('0x26')](_0x2721('0x27')),controller[_0x2721('0x28')]);var upload=multer({'storage':multer[_0x2721('0x20')]({'destination':function(_0x2ae791,_0x3f56a9,_0x49437c){_0x49437c(null,path[_0x2721('0x29')](config['root'],_0x2721('0x2a')));},'filename':function(_0x33b1ba,_0x1c5e49,_0x1da0cd){_0x1da0cd(null,util[_0x2721('0x2b')]('%s-%s',Date[_0x2721('0x24')](),_0x1c5e49[_0x2721('0x25')]));}})});router[_0x2721('0x1e')](_0x2721('0x2c'),upload[_0x2721('0x26')](_0x2721('0x27')),controller[_0x2721('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2cfe3c,_0x5ad530,_0x27cb59){_0x27cb59(null,path[_0x2721('0x29')](config[_0x2721('0x21')],_0x2721('0x2a')));},'filename':function(_0x581332,_0x442b93,_0xeae5d4){_0xeae5d4(null,util[_0x2721('0x2b')](_0x2721('0x23'),Date[_0x2721('0x24')](),_0x442b93[_0x2721('0x25')]));}})});router[_0x2721('0x1e')](_0x2721('0xf'),upload['single']('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x2721('0x20')]({'destination':function(_0x3d1f61,_0x9204a7,_0x17214b){_0x17214b(null,path[_0x2721('0x29')](config['root'],_0x2721('0x2a')));},'filename':function(_0x1826ad,_0x25aee9,_0x204831){_0x204831(null,util[_0x2721('0x2b')]('%s-%s',Date[_0x2721('0x24')](),_0x25aee9[_0x2721('0x25')]));}})});router['post'](_0x2721('0x11'),upload[_0x2721('0x26')]('file'),controller['addSystemAvatar']);router['post'](_0x2721('0x2e'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x2721('0x20')]({'destination':function(_0xeb502c,_0x3fd911,_0x46786b){const _0x2e2629=path[_0x2721('0x29')](config[_0x2721('0x21')],'server/files',_0x2721('0x2f'),_0x2721('0x30'));fs_extra['ensureDir'](_0x2e2629,function(){_0x46786b(null,_0x2e2629);});},'filename':function(_0xd59880,_0x2e9eab,_0x2a4f2f){const _0x5333a0=_0x2e9eab['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x20e567=path['extname'](_0x5333a0);const _0x459d9e=Date[_0x2721('0x24')]()+'-'+_0x5333a0[_0x2721('0x31')](_0x20e567,'')+_0x20e567;_0x2a4f2f(null,_0x459d9e);}})});router[_0x2721('0x1e')]('/:id/offline',offlineUploadMulter[_0x2721('0x32')](),controller['offline']);router[_0x2721('0x1e')](_0x2721('0x33'),auth['isAuthenticated'](),controller[_0x2721('0x34')]);router[_0x2721('0x1e')](_0x2721('0x15'),auth[_0x2721('0x4')](),controller[_0x2721('0x35')]);router[_0x2721('0x1e')](_0x2721('0x17'),auth[_0x2721('0x4')](),controller[_0x2721('0x36')]);router[_0x2721('0x1e')]('/:id/users',auth[_0x2721('0x4')](),controller[_0x2721('0x37')]);router[_0x2721('0x38')](_0x2721('0x39'),auth[_0x2721('0x4')](),controller[_0x2721('0x3a')]);router[_0x2721('0x3b')]('/:id',auth[_0x2721('0x4')](),controller['destroy']);router[_0x2721('0x3b')]('/:id/dispositions',auth[_0x2721('0x4')](),controller[_0x2721('0x3c')]);router[_0x2721('0x3b')](_0x2721('0xa'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0x2721('0x3b')]('/:id/users',auth[_0x2721('0x4')](),controller[_0x2721('0x3d')]);module[_0x2721('0x3e')]=router; \ No newline at end of file +var _0xe03d=['addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','server/files/images/logos/','format','%s-%s','originalname','file','addLogo','join','root','server/files/images/avatars/','now','/:id/avatar','single','addAvatar','diskStorage','addCustomerAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xe03d,0xa1));var _0xde03=function(_0x2bcd1f,_0x4f1972){_0x2bcd1f=_0x2bcd1f-0x0;var _0x2381ca=_0xe03d[_0x2bcd1f];return _0x2381ca;};'use strict';var multer=require('multer');var util=require(_0xde03('0x0'));var path=require(_0xde03('0x1'));var timeout=require(_0xde03('0x2'));var express=require(_0xde03('0x3'));var router=express[_0xde03('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xde03('0x5'));var interaction=require(_0xde03('0x6'));var config=require(_0xde03('0x7'));var controller=require(_0xde03('0x8'));router['get']('/',auth[_0xde03('0x9')](),controller['index']);router[_0xde03('0xa')](_0xde03('0xb'),auth[_0xde03('0x9')](),controller[_0xde03('0xc')]);router[_0xde03('0xa')](_0xde03('0xd'),auth[_0xde03('0x9')](),controller[_0xde03('0xe')]);router[_0xde03('0xa')](_0xde03('0xf'),auth[_0xde03('0x9')](),controller[_0xde03('0x10')]);router[_0xde03('0xa')](_0xde03('0x11'),auth[_0xde03('0x9')](),controller[_0xde03('0x12')]);router[_0xde03('0xa')](_0xde03('0x13'),controller[_0xde03('0x14')]);router['get']('/:id/avatar',controller['getAvatar']);router[_0xde03('0xa')]('/:id/customer_avatar',controller[_0xde03('0x15')]);router['get'](_0xde03('0x16'),controller[_0xde03('0x17')]);router[_0xde03('0xa')](_0xde03('0x18'),auth[_0xde03('0x9')](),controller[_0xde03('0x19')]);router[_0xde03('0xa')](_0xde03('0x1a'),controller[_0xde03('0x1b')]);router['get'](_0xde03('0x1c'),auth[_0xde03('0x9')](),controller[_0xde03('0x1d')]);router[_0xde03('0xa')](_0xde03('0x1e'),auth[_0xde03('0x9')](),controller[_0xde03('0x1f')]);router[_0xde03('0xa')](_0xde03('0x20'),controller[_0xde03('0x21')]);router[_0xde03('0xa')](_0xde03('0x22'),auth[_0xde03('0x9')](),controller[_0xde03('0x23')]);router[_0xde03('0xa')](_0xde03('0x24'),auth['isAuthenticated'](),controller['getAgents']);router[_0xde03('0x25')]('/',auth['isAuthenticated'](),controller[_0xde03('0x26')]);router[_0xde03('0x25')](_0xde03('0xf'),auth[_0xde03('0x9')](),controller[_0xde03('0x27')]);router['post'](_0xde03('0x11'),auth[_0xde03('0x9')](),controller[_0xde03('0x28')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2267e4,_0x26b0d5,_0x64c39d){_0x64c39d(null,path['join'](config['root'],_0xde03('0x29')));},'filename':function(_0x21316d,_0x23f82,_0x3037c6){_0x3037c6(null,util[_0xde03('0x2a')](_0xde03('0x2b'),Date['now'](),_0x23f82[_0xde03('0x2c')]));}})});router[_0xde03('0x25')](_0xde03('0x13'),upload['single'](_0xde03('0x2d')),controller[_0xde03('0x2e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x303f95,_0x3dbe54,_0x144251){_0x144251(null,path[_0xde03('0x2f')](config[_0xde03('0x30')],_0xde03('0x31')));},'filename':function(_0x5e8c4e,_0x5cc89a,_0x3f2e98){_0x3f2e98(null,util['format'](_0xde03('0x2b'),Date[_0xde03('0x32')](),_0x5cc89a[_0xde03('0x2c')]));}})});router[_0xde03('0x25')](_0xde03('0x33'),upload[_0xde03('0x34')]('file'),controller[_0xde03('0x35')]);var upload=multer({'storage':multer[_0xde03('0x36')]({'destination':function(_0x4d235c,_0x137666,_0xe851b1){_0xe851b1(null,path[_0xde03('0x2f')](config['root'],_0xde03('0x31')));},'filename':function(_0x462d4d,_0x38d57f,_0x589875){_0x589875(null,util[_0xde03('0x2a')](_0xde03('0x2b'),Date['now'](),_0x38d57f['originalname']));}})});router[_0xde03('0x25')]('/:id/customer_avatar',upload['single'](_0xde03('0x2d')),controller[_0xde03('0x37')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53d61f,_0x130f39,_0xd43cad){_0xd43cad(null,path[_0xde03('0x2f')](config[_0xde03('0x30')],_0xde03('0x31')));},'filename':function(_0x12161d,_0x4483f4,_0x22b549){_0x22b549(null,util['format'](_0xde03('0x2b'),Date['now'](),_0x4483f4[_0xde03('0x2c')]));}})});router['post']('/:id/system_avatar',upload[_0xde03('0x34')]('file'),controller['addSystemAvatar']);router[_0xde03('0x25')](_0xde03('0x38'),controller[_0xde03('0x39')]);const offlineUploadMulter=multer({'storage':multer[_0xde03('0x36')]({'destination':function(_0x3e2216,_0x3181e9,_0x4f0afd){const _0x19ba1d=path[_0xde03('0x2f')](config[_0xde03('0x30')],_0xde03('0x3a'),_0xde03('0x3b'),_0xde03('0x3c'));fs_extra[_0xde03('0x3d')](_0x19ba1d,function(){_0x4f0afd(null,_0x19ba1d);});},'filename':function(_0x1725b4,_0x3017f9,_0x9bfad9){const _0x5d4aa4=_0x3017f9[_0xde03('0x2c')][_0xde03('0x3e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5b3103=path[_0xde03('0x3f')](_0x5d4aa4);const _0x164b6b=Date[_0xde03('0x32')]()+'-'+_0x5d4aa4[_0xde03('0x3e')](_0x5b3103,'')+_0x5b3103;_0x9bfad9(null,_0x164b6b);}})});router[_0xde03('0x25')](_0xde03('0x40'),offlineUploadMulter[_0xde03('0x41')](),controller[_0xde03('0x42')]);router[_0xde03('0x25')](_0xde03('0x18'),auth['isAuthenticated'](),controller['addInteraction']);router[_0xde03('0x25')](_0xde03('0x1c'),auth[_0xde03('0x9')](),controller[_0xde03('0x43')]);router['post'](_0xde03('0x1e'),auth['isAuthenticated'](),controller[_0xde03('0x44')]);router['post'](_0xde03('0x24'),auth[_0xde03('0x9')](),controller[_0xde03('0x45')]);router[_0xde03('0x46')]('/:id',auth[_0xde03('0x9')](),controller[_0xde03('0x47')]);router[_0xde03('0x48')](_0xde03('0xd'),auth[_0xde03('0x9')](),controller[_0xde03('0x49')]);router[_0xde03('0x48')](_0xde03('0xf'),auth[_0xde03('0x9')](),controller[_0xde03('0x4a')]);router[_0xde03('0x48')]('/:id/canned_answers',auth['isAuthenticated'](),controller['removeAnswers']);router['delete'](_0xde03('0x24'),auth[_0xde03('0x9')](),controller['removeAgents']);module[_0xde03('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 a5d0995..f451c4f 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 _0x6050=['STRING','ENUM','AmazonAWS','Google','sequelize','exports'];(function(_0x6ca3e0,_0x45acf7){var _0x2f7502=function(_0x2d41d8){while(--_0x2d41d8){_0x6ca3e0['push'](_0x6ca3e0['shift']());}};_0x2f7502(++_0x45acf7);}(_0x6050,0x196));var _0x0605=function(_0x14aea2,_0x441017){_0x14aea2=_0x14aea2-0x0;var _0xaab0b4=_0x6050[_0x14aea2];return _0xaab0b4;};'use strict';var Sequelize=require(_0x0605('0x0'));module[_0x0605('0x1')]={'name':{'type':Sequelize[_0x0605('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x0605('0x3')](_0x0605('0x4'),_0x0605('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x0605('0x2')]}}; \ No newline at end of file +var _0x6dc0=['Google','sequelize','STRING','ENUM','AmazonAWS'];(function(_0x481730,_0x4283ef){var _0x1c26ae=function(_0x2c1448){while(--_0x2c1448){_0x481730['push'](_0x481730['shift']());}};_0x1c26ae(++_0x4283ef);}(_0x6dc0,0x18c));var _0x06dc=function(_0x50aa4b,_0x77f234){_0x50aa4b=_0x50aa4b-0x0;var _0x20fbd9=_0x6dc0[_0x50aa4b];return _0x20fbd9;};'use strict';var Sequelize=require(_0x06dc('0x0'));module['exports']={'name':{'type':Sequelize[_0x06dc('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x06dc('0x2')](_0x06dc('0x3'),_0x06dc('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x06dc('0x1')]},'data2':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index c4960d8..5272d31 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 _0x7a54=['offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','CloudProvider','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x58cb22,_0x9c9794){var _0x202197=function(_0x577667){while(--_0x577667){_0x58cb22['push'](_0x58cb22['shift']());}};_0x202197(++_0x9c9794);}(_0x7a54,0x106));var _0x47a5=function(_0x2b05e1,_0x41c8ba){_0x2b05e1=_0x2b05e1-0x0;var _0x4fbb1c=_0x7a54[_0x2b05e1];return _0x4fbb1c;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['CloudProvider'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['CloudProvider']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['CloudProvider']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));}; \ No newline at end of file +var _0x0b0e=['hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','include','find','create','body','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','CloudProvider','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length'];(function(_0x89e913,_0x2273e2){var _0x1e2d4c=function(_0x2731fd){while(--_0x2731fd){_0x89e913['push'](_0x89e913['shift']());}};_0x1e2d4c(++_0x2273e2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x22ffbf,_0x16f31e){_0x22ffbf=_0x22ffbf-0x0;var _0x360c17=_0x0b0e[_0x22ffbf];return _0x360c17;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['CloudProvider'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'all':!![]}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x41')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x402a0e){_0x36d137[_0xe0b0('0x42')]=_0x402a0e;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))[_0xe0b0('0x43')](handleError(_0x5b7a64,null));};exports[_0xe0b0('0x44')]=function(_0x52ffe4,_0x2aad80){var _0x309bbf={'raw':!![],'where':{'id':_0x52ffe4['params']['id']}},_0x528818={};_0x528818[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db['CloudProvider'][_0xe0b0('0x2b')]);_0x528818[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x52ffe4[_0xe0b0('0x2e')]);_0x528818[_0xe0b0('0x39')]=_['intersection'](_0x528818['model'],_0x528818['query']);_0x309bbf[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x528818['model'],qs[_0xe0b0('0x33')](_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x309bbf[_0xe0b0('0x32')]=_0x309bbf[_0xe0b0('0x32')]['length']?_0x309bbf['attributes']:_0x528818[_0xe0b0('0x31')];if(_0x52ffe4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x309bbf[_0xe0b0('0x45')]=[{'all':!![]}];}_0x309bbf=_[_0xe0b0('0x3b')]({},_0x309bbf,_0x52ffe4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x46')](_0x309bbf)['then'](handleEntityNotFound(_0x2aad80,null))['then'](respondWithResult(_0x2aad80,null))['catch'](handleError(_0x2aad80,null));};exports[_0xe0b0('0x47')]=function(_0x2184d3,_0x2419ce){return db[_0xe0b0('0x2a')]['create'](_0x2184d3[_0xe0b0('0x48')],{})[_0xe0b0('0x23')](respondWithResult(_0x2419ce,0xc9))['catch'](handleError(_0x2419ce,null));};exports['update']=function(_0x2365be,_0x1bc6e0){if(_0x2365be['body']['id']){delete _0x2365be[_0xe0b0('0x48')]['id'];}return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x2365be['params']['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x1bc6e0,null))['then'](saveUpdates(_0x2365be[_0xe0b0('0x48')],null))[_0xe0b0('0x23')](respondWithResult(_0x1bc6e0,null))[_0xe0b0('0x43')](handleError(_0x1bc6e0,null));};exports[_0xe0b0('0x24')]=function(_0x19ee71,_0xf9e694){return db['CloudProvider']['find']({'where':{'id':_0x19ee71[_0xe0b0('0x49')]['id']}})['then'](handleEntityNotFound(_0xf9e694,null))['then'](removeEntity(_0xf9e694,null))[_0xe0b0('0x43')](handleError(_0xf9e694,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index e921ed7..656e0b4 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 _0xffd9=['api','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash','util','../../config/logger'];(function(_0x2ef1b7,_0x2350bb){var _0x212cd0=function(_0x1bb516){while(--_0x1bb516){_0x2ef1b7['push'](_0x2ef1b7['shift']());}};_0x212cd0(++_0x2350bb);}(_0xffd9,0x19d));var _0x9ffd=function(_0x2d3401,_0x4317d6){_0x2d3401=_0x2d3401-0x0;var _0x50d033=_0xffd9[_0x2d3401];return _0x50d033;};'use strict';var _=require(_0x9ffd('0x0'));var util=require(_0x9ffd('0x1'));var logger=require(_0x9ffd('0x2'))(_0x9ffd('0x3'));var moment=require('moment');var BPromise=require(_0x9ffd('0x4'));var rp=require(_0x9ffd('0x5'));var fs=require('fs');var path=require(_0x9ffd('0x6'));var rimraf=require(_0x9ffd('0x7'));var config=require(_0x9ffd('0x8'));var attributes=require(_0x9ffd('0x9'));module['exports']=function(_0x5d8c52,_0x1c297f){return _0x5d8c52[_0x9ffd('0xa')](_0x9ffd('0xb'),attributes,{'tableName':_0x9ffd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbce8=['path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','util','moment','bluebird'];(function(_0x1b74dc,_0x19e0ad){var _0x25962e=function(_0xfa0749){while(--_0xfa0749){_0x1b74dc['push'](_0x1b74dc['shift']());}};_0x25962e(++_0x19e0ad);}(_0xbce8,0x1ec));var _0x8bce=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0xbce8[_0x4392af];return _0x9fa8eb;};'use strict';var _=require('lodash');var util=require(_0x8bce('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8bce('0x1'));var BPromise=require(_0x8bce('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bce('0x3'));var rimraf=require(_0x8bce('0x4'));var config=require(_0x8bce('0x5'));var attributes=require(_0x8bce('0x6'));module[_0x8bce('0x7')]=function(_0x2764be,_0x9fedeb){return _0x2764be[_0x8bce('0x8')](_0x8bce('0x9'),attributes,{'tableName':_0x8bce('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 269084e..bea9d87 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 _0xcf66=['jayson/promise','client','http','request','then','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x4c253b,_0x3205e9){var _0x2f447c=function(_0xddbb70){while(--_0xddbb70){_0x4c253b['push'](_0x4c253b['shift']());}};_0x2f447c(++_0x3205e9);}(_0xcf66,0x71));var _0x6cf6=function(_0x15f580,_0x35dc48){_0x15f580=_0x15f580-0x0;var _0x40a487=_0xcf66[_0x15f580];return _0x40a487;};'use strict';var _=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var moment=require(_0x6cf6('0x2'));var BPromise=require('bluebird');var rs=require(_0x6cf6('0x3'));var fs=require('fs');var Redis=require(_0x6cf6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6cf6('0x5'))(_0x6cf6('0x6'));var config=require('../../config/environment');var jayson=require(_0x6cf6('0x7'));var client=jayson[_0x6cf6('0x8')][_0x6cf6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eb082,_0x94c6a9,_0x308d0d){return new BPromise(function(_0x36b892,_0x748c93){return client[_0x6cf6('0xa')](_0x5eb082,_0x308d0d)[_0x6cf6('0xb')](function(_0x5b3827){logger['info']('CloudProvider,\x20%s,\x20%s',_0x94c6a9,_0x6cf6('0xc'));logger['debug'](_0x6cf6('0xd'),_0x94c6a9,_0x6cf6('0xc'),JSON[_0x6cf6('0xe')](_0x5b3827));if(_0x5b3827[_0x6cf6('0xf')]){if(_0x5b3827['error']['code']===0x1f4){logger['error'](_0x6cf6('0x10'),_0x94c6a9,_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);return _0x748c93(_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);}logger[_0x6cf6('0xf')]('CloudProvider,\x20%s,\x20%s',_0x94c6a9,_0x5b3827[_0x6cf6('0xf')]['message']);return _0x36b892(_0x5b3827[_0x6cf6('0xf')][_0x6cf6('0x11')]);}else{logger['info'](_0x6cf6('0x10'),_0x94c6a9,_0x6cf6('0xc'));_0x36b892(_0x5b3827[_0x6cf6('0x12')][_0x6cf6('0x11')]);}})[_0x6cf6('0x13')](function(_0x2bdb12){logger[_0x6cf6('0xf')](_0x6cf6('0x10'),_0x94c6a9,_0x2bdb12);_0x748c93(_0x2bdb12);});});} \ No newline at end of file +var _0x4744=['error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s'];(function(_0x2cda84,_0x5e433d){var _0x84590e=function(_0x4664b1){while(--_0x4664b1){_0x2cda84['push'](_0x2cda84['shift']());}};_0x84590e(++_0x5e433d);}(_0x4744,0x107));var _0x4474=function(_0x165d3c,_0x582bec){_0x165d3c=_0x165d3c-0x0;var _0x337eff=_0x4744[_0x165d3c];return _0x337eff;};'use strict';var _=require(_0x4474('0x0'));var util=require(_0x4474('0x1'));var moment=require('moment');var BPromise=require(_0x4474('0x2'));var rs=require(_0x4474('0x3'));var fs=require('fs');var Redis=require(_0x4474('0x4'));var db=require(_0x4474('0x5'))['db'];var utils=require(_0x4474('0x6'));var logger=require(_0x4474('0x7'))(_0x4474('0x8'));var config=require(_0x4474('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4474('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc08a4c,_0x3024cd,_0x1dcdf0){return new BPromise(function(_0x387297,_0x247b66){return client[_0x4474('0xb')](_0xc08a4c,_0x1dcdf0)['then'](function(_0x17c4f7){logger[_0x4474('0xc')](_0x4474('0xd'),_0x3024cd,_0x4474('0xe'));logger[_0x4474('0xf')](_0x4474('0x10'),_0x3024cd,_0x4474('0xe'),JSON['stringify'](_0x17c4f7));if(_0x17c4f7['error']){if(_0x17c4f7['error']['code']===0x1f4){logger[_0x4474('0x11')](_0x4474('0xd'),_0x3024cd,_0x17c4f7['error'][_0x4474('0x12')]);return _0x247b66(_0x17c4f7['error'][_0x4474('0x12')]);}logger[_0x4474('0x11')](_0x4474('0xd'),_0x3024cd,_0x17c4f7[_0x4474('0x11')][_0x4474('0x12')]);return _0x387297(_0x17c4f7[_0x4474('0x11')][_0x4474('0x12')]);}else{logger[_0x4474('0xc')](_0x4474('0xd'),_0x3024cd,'request\x20sent');_0x387297(_0x17c4f7[_0x4474('0x13')]['message']);}})['catch'](function(_0x46b79d){logger[_0x4474('0x11')]('CloudProvider,\x20%s,\x20%s',_0x3024cd,_0x46b79d);_0x247b66(_0x46b79d);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 6a1ee33..a654d79 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 _0xcd94=['create','put','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show'];(function(_0x4f11f0,_0xd8b6b9){var _0x495cd9=function(_0x40dfc8){while(--_0x40dfc8){_0x4f11f0['push'](_0x4f11f0['shift']());}};_0x495cd9(++_0xd8b6b9);}(_0xcd94,0x19b));var _0x4cd9=function(_0x3e451f,_0x10500d){_0x3e451f=_0x3e451f-0x0;var _0x57978f=_0xcd94[_0x3e451f];return _0x57978f;};'use strict';var multer=require('multer');var util=require(_0x4cd9('0x0'));var path=require(_0x4cd9('0x1'));var timeout=require(_0x4cd9('0x2'));var express=require(_0x4cd9('0x3'));var router=express[_0x4cd9('0x4')]();var fs_extra=require(_0x4cd9('0x5'));var auth=require(_0x4cd9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4cd9('0x7'));var controller=require(_0x4cd9('0x8'));router[_0x4cd9('0x9')]('/',auth[_0x4cd9('0xa')](),controller[_0x4cd9('0xb')]);router[_0x4cd9('0x9')](_0x4cd9('0xc'),auth[_0x4cd9('0xa')](),controller[_0x4cd9('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4cd9('0xe')]);router[_0x4cd9('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x4cd9('0xa')](),controller[_0x4cd9('0x10')]);module['exports']=router; \ No newline at end of file +var _0x853e=['./cloudProvider.controller','get','index','/:id','isAuthenticated','show','post','create','put','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0x853e,0x1ea));var _0xe853=function(_0x96f5e2,_0xfae276){_0x96f5e2=_0x96f5e2-0x0;var _0x22bbe5=_0x853e[_0x96f5e2];return _0x22bbe5;};'use strict';var multer=require('multer');var util=require(_0xe853('0x0'));var path=require('path');var timeout=require(_0xe853('0x1'));var express=require('express');var router=express[_0xe853('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe853('0x3'));var interaction=require(_0xe853('0x4'));var config=require(_0xe853('0x5'));var controller=require(_0xe853('0x6'));router[_0xe853('0x7')]('/',auth['isAuthenticated'](),controller[_0xe853('0x8')]);router[_0xe853('0x7')](_0xe853('0x9'),auth[_0xe853('0xa')](),controller[_0xe853('0xb')]);router[_0xe853('0xc')]('/',auth[_0xe853('0xa')](),controller[_0xe853('0xd')]);router[_0xe853('0xe')](_0xe853('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe853('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xe853('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 161ee49..262f153 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 _0xb844=['STRING','exports'];(function(_0x342929,_0x2276b8){var _0x3e7f17=function(_0x48153e){while(--_0x48153e){_0x342929['push'](_0x342929['shift']());}};_0x3e7f17(++_0x2276b8);}(_0xb844,0x149));var _0x4b84=function(_0x4429d8,_0x1d1923){_0x4429d8=_0x4429d8-0x0;var _0x7246b0=_0xb844[_0x4429d8];return _0x7246b0;};'use strict';var Sequelize=require('sequelize');module[_0x4b84('0x0')]={'name':{'type':Sequelize[_0x4b84('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x4b84('0x1')]},'companyId':{'type':Sequelize[_0x4b84('0x1')]},'website':{'type':Sequelize[_0x4b84('0x1')]},'phone':{'type':Sequelize[_0x4b84('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4b84('0x1')]},'street':{'type':Sequelize[_0x4b84('0x1')]},'postalCode':{'type':Sequelize[_0x4b84('0x1')]},'city':{'type':Sequelize[_0x4b84('0x1')]},'country':{'type':Sequelize[_0x4b84('0x1')]},'email':{'type':Sequelize[_0x4b84('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x4b84('0x1')]},'sStreet':{'type':Sequelize[_0x4b84('0x1')]},'sPostalCode':{'type':Sequelize[_0x4b84('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x4b84('0x1')]},'description':{'type':Sequelize[_0x4b84('0x1')]}}; \ No newline at end of file +var _0x9320=['name','sequelize','exports','STRING'];(function(_0x472590,_0x38c69c){var _0x3a43d6=function(_0x2e7e1e){while(--_0x2e7e1e){_0x472590['push'](_0x472590['shift']());}};_0x3a43d6(++_0x38c69c);}(_0x9320,0xfd));var _0x0932=function(_0x26261f,_0x1202db){_0x26261f=_0x26261f-0x0;var _0x4316d0=_0x9320[_0x26261f];return _0x4316d0;};'use strict';var Sequelize=require(_0x0932('0x0'));module[_0x0932('0x1')]={'name':{'type':Sequelize[_0x0932('0x2')],'unique':_0x0932('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x0932('0x2')]},'companyId':{'type':Sequelize[_0x0932('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0932('0x2')]},'fax':{'type':Sequelize[_0x0932('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x0932('0x2')]},'postalCode':{'type':Sequelize[_0x0932('0x2')]},'city':{'type':Sequelize[_0x0932('0x2')]},'country':{'type':Sequelize[_0x0932('0x2')]},'email':{'type':Sequelize[_0x0932('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x0932('0x2')]},'sStreet':{'type':Sequelize[_0x0932('0x2')]},'sPostalCode':{'type':Sequelize[_0x0932('0x2')]},'sCity':{'type':Sequelize[_0x0932('0x2')]},'sCountry':{'type':Sequelize[_0x0932('0x2')]},'description':{'type':Sequelize[_0x0932('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 5555f6b..52a375a 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 _0x32d6=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','json','apply','reject','save','update','destroy','then','get','UserProfileResource','stack','name','send','index','CmCompany','describe','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','map','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Companies','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','getContacts','findOne','CmContact','rawAttributes','order','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring'];(function(_0x2b171a,_0x582765){var _0x33acbc=function(_0x97b429){while(--_0x97b429){_0x2b171a['push'](_0x2b171a['shift']());}};_0x33acbc(++_0x582765);}(_0x32d6,0xf8));var _0x632d=function(_0x3a92c3,_0x1b49cf){_0x3a92c3=_0x3a92c3-0x0;var _0x155ce1=_0x32d6[_0x3a92c3];return _0x155ce1;};'use strict';var emlformat=require(_0x632d('0x0'));var rimraf=require(_0x632d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x632d('0x2'));var rp=require(_0x632d('0x3'));var moment=require(_0x632d('0x4'));var BPromise=require(_0x632d('0x5'));var Mustache=require(_0x632d('0x6'));var util=require(_0x632d('0x7'));var path=require(_0x632d('0x8'));var sox=require(_0x632d('0x9'));var csv=require(_0x632d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x632d('0xb'));var _=require(_0x632d('0xc'));var squel=require(_0x632d('0xd'));var crypto=require(_0x632d('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x632d('0xf'));var Papa=require(_0x632d('0x10'));var Redis=require('ioredis');var authService=require(_0x632d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x632d('0x12'));var hardwareService=require(_0x632d('0x13'));var logger=require(_0x632d('0x14'))(_0x632d('0x15'));var utils=require(_0x632d('0x16'));var config=require(_0x632d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x632d('0x18'))['db'];function respondWithStatusCode(_0x517c10,_0x5c2826){_0x5c2826=_0x5c2826||0xcc;return function(_0x2b5da7){if(_0x2b5da7){return _0x517c10[_0x632d('0x19')](_0x5c2826);}return _0x517c10[_0x632d('0x1a')](_0x5c2826)[_0x632d('0x1b')]();};}function respondWithResult(_0x5706e9,_0x5a1b01){_0x5a1b01=_0x5a1b01||0xc8;return function(_0x57e280){if(_0x57e280){return _0x5706e9[_0x632d('0x1a')](_0x5a1b01)['json'](_0x57e280);}};}function respondWithFilteredResult(_0x977a5c,_0x2aa81b){return function(_0x44401b){if(_0x44401b){var _0x228bdd=typeof _0x2aa81b['offset']==='undefined'&&typeof _0x2aa81b['limit']===_0x632d('0x1c');var _0x5903f4=_0x44401b[_0x632d('0x1d')];var _0x10dbf0=_0x228bdd?0x0:_0x2aa81b[_0x632d('0x1e')];var _0x295232=_0x228bdd?_0x44401b[_0x632d('0x1d')]:_0x2aa81b[_0x632d('0x1e')]+_0x2aa81b[_0x632d('0x1f')];var _0x41d0bf;if(_0x295232>=_0x5903f4){_0x295232=_0x5903f4;_0x41d0bf=0xc8;}else{_0x41d0bf=0xce;}_0x977a5c['status'](_0x41d0bf);return _0x977a5c['set']('Content-Range',_0x10dbf0+'-'+_0x295232+'/'+_0x5903f4)[_0x632d('0x20')](_0x44401b);}return null;};}function patchUpdates(_0x3034cb){return function(_0x2b544f){try{jsonpatch[_0x632d('0x21')](_0x2b544f,_0x3034cb,!![]);}catch(_0x2bd70b){return BPromise[_0x632d('0x22')](_0x2bd70b);}return _0x2b544f[_0x632d('0x23')]();};}function saveUpdates(_0x2e13e7,_0x16527e){return function(_0x558111){if(_0x558111){return _0x558111[_0x632d('0x24')](_0x2e13e7)['then'](function(_0x34bd08){return _0x34bd08;});}return null;};}function removeEntity(_0x5293e8,_0x5ee19e){return function(_0x2d33a5){if(_0x2d33a5){return _0x2d33a5[_0x632d('0x25')]()[_0x632d('0x26')](function(){var _0x49bf05=_0x2d33a5[_0x632d('0x27')]({'plain':!![]});var _0x32a058='Companies';return db[_0x632d('0x28')][_0x632d('0x25')]({'where':{'type':_0x32a058,'resourceId':_0x49bf05['id']}})[_0x632d('0x26')](function(){return _0x2d33a5;});})[_0x632d('0x26')](function(){_0x5293e8[_0x632d('0x1a')](0xcc)[_0x632d('0x1b')]();});}};}function handleEntityNotFound(_0x122f16,_0x5c13fc){return function(_0x11198b){if(!_0x11198b){_0x122f16[_0x632d('0x19')](0x194);}return _0x11198b;};}function handleError(_0x349afe,_0x7f4dd){_0x7f4dd=_0x7f4dd||0x1f4;return function(_0x16b751){logger['error'](_0x16b751[_0x632d('0x29')]);if(_0x16b751[_0x632d('0x2a')]){delete _0x16b751[_0x632d('0x2a')];}_0x349afe[_0x632d('0x1a')](_0x7f4dd)[_0x632d('0x2b')](_0x16b751);};}exports[_0x632d('0x2c')]=function(_0x338830,_0x87514){var _0x2879ee={},_0x4b8abc={},_0x4e63c2={'count':0x0,'rows':[]};return db[_0x632d('0x2d')][_0x632d('0x2e')]()[_0x632d('0x26')](function(_0x5af753){_0x4b8abc[_0x632d('0x2f')]=_[_0x632d('0x30')](_0x5af753);_0x4b8abc[_0x632d('0x31')]=_[_0x632d('0x30')](_0x338830['query']);_0x4b8abc[_0x632d('0x32')]=_['intersection'](_0x4b8abc[_0x632d('0x2f')],_0x4b8abc[_0x632d('0x31')]);_0x2879ee[_0x632d('0x33')]=_[_0x632d('0x34')](_0x4b8abc[_0x632d('0x2f')],qs[_0x632d('0x35')](_0x338830[_0x632d('0x31')][_0x632d('0x35')]));_0x2879ee[_0x632d('0x33')]=_0x2879ee[_0x632d('0x33')][_0x632d('0x36')]?_0x2879ee['attributes']:_0x4b8abc[_0x632d('0x2f')];if(!_0x338830[_0x632d('0x31')]['hasOwnProperty'](_0x632d('0x37'))){_0x2879ee[_0x632d('0x1f')]=qs['limit'](_0x338830[_0x632d('0x31')][_0x632d('0x1f')]);_0x2879ee['offset']=qs[_0x632d('0x1e')](_0x338830[_0x632d('0x31')][_0x632d('0x1e')]);}_0x2879ee['order']=qs[_0x632d('0x38')](_0x338830[_0x632d('0x31')][_0x632d('0x38')]);_0x2879ee[_0x632d('0x39')]=qs[_0x632d('0x32')](_[_0x632d('0x3a')](_0x338830[_0x632d('0x31')],_0x4b8abc['filters']),_0x5af753);if(_0x338830['query'][_0x632d('0x3b')]){_0x2879ee['where']=_[_0x632d('0x3c')](_0x2879ee[_0x632d('0x39')],{'$or':_[_0x632d('0x3d')](_0x2879ee['attributes'],function(_0x1772b6){var _0x1543be={};_0x1543be[_0x1772b6]={'$like':'%'+_0x338830[_0x632d('0x31')][_0x632d('0x3b')]+'%'};return _0x1543be;})});}_0x2879ee=_['merge']({},_0x2879ee,_0x338830['options']);var _0x516178={'where':_0x2879ee[_0x632d('0x39')]};return db[_0x632d('0x2d')]['count'](_0x516178)['then'](function(_0x46e20b){_0x4e63c2[_0x632d('0x1d')]=_0x46e20b;if(_0x338830[_0x632d('0x31')][_0x632d('0x3e')]){_0x2879ee[_0x632d('0x3f')]=[{'all':!![]}];}return db[_0x632d('0x2d')][_0x632d('0x40')](_0x2879ee);})[_0x632d('0x26')](function(_0x4bb94b){_0x4e63c2[_0x632d('0x41')]=_0x4bb94b;return _0x4e63c2;})[_0x632d('0x26')](respondWithFilteredResult(_0x87514,_0x2879ee))[_0x632d('0x42')](handleError(_0x87514,null));})[_0x632d('0x42')](handleError(_0x87514,null));};exports[_0x632d('0x43')]=function(_0x167231,_0x133acb){var _0x4a296a={'raw':![],'where':{'id':_0x167231[_0x632d('0x44')]['id']}},_0x5d6b0c={};_0x5d6b0c[_0x632d('0x2f')]=_[_0x632d('0x30')](db['CmCompany']['rawAttributes']);_0x5d6b0c[_0x632d('0x31')]=_['keys'](_0x167231['query']);_0x5d6b0c[_0x632d('0x32')]=_[_0x632d('0x34')](_0x5d6b0c[_0x632d('0x2f')],_0x5d6b0c[_0x632d('0x31')]);_0x4a296a['attributes']=_[_0x632d('0x34')](_0x5d6b0c['model'],qs[_0x632d('0x35')](_0x167231[_0x632d('0x31')]['fields']));_0x4a296a[_0x632d('0x33')]=_0x4a296a[_0x632d('0x33')][_0x632d('0x36')]?_0x4a296a[_0x632d('0x33')]:_0x5d6b0c[_0x632d('0x2f')];if(_0x167231[_0x632d('0x31')][_0x632d('0x3e')]){_0x4a296a[_0x632d('0x3f')]=[{'all':!![]}];}_0x4a296a=_[_0x632d('0x3c')]({},_0x4a296a,_0x167231[_0x632d('0x45')]);return db[_0x632d('0x2d')][_0x632d('0x46')](_0x4a296a)[_0x632d('0x26')](handleEntityNotFound(_0x133acb,null))['then'](respondWithResult(_0x133acb,null))[_0x632d('0x42')](handleError(_0x133acb,null));};exports[_0x632d('0x47')]=function(_0x58892e,_0x5786d5){return db[_0x632d('0x2d')][_0x632d('0x47')](_0x58892e[_0x632d('0x48')],{})['then'](function(_0x41ffa8){var _0x5ef223=_0x58892e['user']['get']({'plain':!![]});if(!_0x5ef223)throw new Error(_0x632d('0x49'));if(_0x5ef223['role']===_0x632d('0x4a')){var _0x501588=_0x41ffa8[_0x632d('0x27')]({'plain':!![]});var _0x271692=_0x632d('0x4b');return db['UserProfileSection'][_0x632d('0x46')]({'where':{'name':_0x271692,'userProfileId':_0x5ef223[_0x632d('0x4c')]},'raw':!![]})[_0x632d('0x26')](function(_0x416b7e){if(_0x416b7e&&_0x416b7e[_0x632d('0x4d')]===0x0){return db['UserProfileResource'][_0x632d('0x47')]({'name':_0x501588[_0x632d('0x2a')],'resourceId':_0x501588['id'],'type':_0x416b7e[_0x632d('0x2a')],'sectionId':_0x416b7e['id']},{})[_0x632d('0x26')](function(){return _0x41ffa8;});}else{return _0x41ffa8;}})[_0x632d('0x42')](function(_0x4adc1d){logger[_0x632d('0x4e')](_0x632d('0x4f'),_0x4adc1d);throw _0x4adc1d;});}return _0x41ffa8;})[_0x632d('0x26')](respondWithResult(_0x5786d5,0xc9))[_0x632d('0x42')](handleError(_0x5786d5,null));};exports[_0x632d('0x24')]=function(_0x286d35,_0x37ca40){if(_0x286d35[_0x632d('0x48')]['id']){delete _0x286d35[_0x632d('0x48')]['id'];}return db[_0x632d('0x2d')]['find']({'where':{'id':_0x286d35['params']['id']}})['then'](handleEntityNotFound(_0x37ca40,null))[_0x632d('0x26')](saveUpdates(_0x286d35[_0x632d('0x48')],null))[_0x632d('0x26')](respondWithResult(_0x37ca40,null))[_0x632d('0x42')](handleError(_0x37ca40,null));};exports[_0x632d('0x25')]=function(_0x35b671,_0x3c1acb){return db[_0x632d('0x2d')][_0x632d('0x46')]({'where':{'id':_0x35b671[_0x632d('0x44')]['id']}})[_0x632d('0x26')](handleEntityNotFound(_0x3c1acb,null))['then'](removeEntity(_0x3c1acb,null))[_0x632d('0x42')](handleError(_0x3c1acb,null));};exports[_0x632d('0x2e')]=function(_0x437619,_0x1d963b){return db[_0x632d('0x2d')][_0x632d('0x2e')]()[_0x632d('0x26')](respondWithResult(_0x1d963b,null))[_0x632d('0x42')](handleError(_0x1d963b,null));};exports[_0x632d('0x50')]=function(_0x1579e8,_0x5d5205,_0x3c71bf){return db['CmContact'][_0x632d('0x46')]({'where':{'id':_0x1579e8[_0x632d('0x44')]['id']}})[_0x632d('0x26')](handleEntityNotFound(_0x5d5205,null))[_0x632d('0x26')](function(_0x322d50){if(_0x322d50){return _0x322d50[_0x632d('0x50')](_0x1579e8['body']['ids'],_['omit'](_0x1579e8[_0x632d('0x48')],[_0x632d('0x51'),'id'])||{});}})[_0x632d('0x26')](respondWithResult(_0x5d5205,null))[_0x632d('0x42')](handleError(_0x5d5205,null));};exports[_0x632d('0x52')]=function(_0x4891cf,_0x19a540,_0x20ab58){var _0x5d9f69={};var _0x5e6bdb={};var _0x3168d4;var _0x5a6fc4;return db[_0x632d('0x2d')][_0x632d('0x53')]({'where':{'id':_0x4891cf[_0x632d('0x44')]['id']}})['then'](handleEntityNotFound(_0x19a540,null))[_0x632d('0x26')](function(_0x4e3d05){if(_0x4e3d05){_0x3168d4=_0x4e3d05;_0x5e6bdb[_0x632d('0x2f')]=_['keys'](db[_0x632d('0x54')][_0x632d('0x55')]);_0x5e6bdb['query']=_[_0x632d('0x30')](_0x4891cf[_0x632d('0x31')]);_0x5e6bdb[_0x632d('0x32')]=_[_0x632d('0x34')](_0x5e6bdb[_0x632d('0x2f')],_0x5e6bdb[_0x632d('0x31')]);_0x5d9f69[_0x632d('0x33')]=_[_0x632d('0x34')](_0x5e6bdb[_0x632d('0x2f')],qs[_0x632d('0x35')](_0x4891cf['query'][_0x632d('0x35')]));_0x5d9f69[_0x632d('0x33')]=_0x5d9f69[_0x632d('0x33')][_0x632d('0x36')]?_0x5d9f69[_0x632d('0x33')]:_0x5e6bdb[_0x632d('0x2f')];_0x5d9f69[_0x632d('0x56')]=qs[_0x632d('0x38')](_0x4891cf['query']['sort']);_0x5d9f69['where']=qs[_0x632d('0x32')](_[_0x632d('0x3a')](_0x4891cf['query'],_0x5e6bdb[_0x632d('0x32')]));if(_0x4891cf[_0x632d('0x31')][_0x632d('0x3b')]){_0x5d9f69[_0x632d('0x39')]=_[_0x632d('0x3c')](_0x5d9f69['where'],{'$or':_[_0x632d('0x3d')](_0x5d9f69[_0x632d('0x33')],function(_0x580163){var _0x4529b7={};_0x4529b7[_0x580163]={'$like':'%'+_0x4891cf[_0x632d('0x31')]['filter']+'%'};return _0x4529b7;})});}_0x5d9f69=_[_0x632d('0x3c')]({},_0x5d9f69,_0x4891cf[_0x632d('0x45')]);return _0x3168d4[_0x632d('0x52')](_0x5d9f69);}})[_0x632d('0x26')](function(_0x3922a2){if(_0x3922a2){_0x5a6fc4=_0x3922a2['length'];if(!_0x4891cf[_0x632d('0x31')][_0x632d('0x57')](_0x632d('0x37'))){_0x5d9f69[_0x632d('0x1f')]=qs[_0x632d('0x1f')](_0x4891cf[_0x632d('0x31')][_0x632d('0x1f')]);_0x5d9f69['offset']=qs[_0x632d('0x1e')](_0x4891cf['query'][_0x632d('0x1e')]);}return _0x3168d4[_0x632d('0x52')](_0x5d9f69);}})[_0x632d('0x26')](function(_0x428afe){if(_0x428afe){return _0x428afe?{'count':_0x5a6fc4,'rows':_0x428afe}:null;}})[_0x632d('0x26')](respondWithResult(_0x19a540,null))['catch'](handleError(_0x19a540,null));}; \ No newline at end of file +var _0x4a62=['status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','end','sendStatus','error','stack','name','send','index','CmCompany','describe','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','catch','show','params','rawAttributes','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContact','addContacts','ids','omit','map','getContacts','eml-format','rimraf','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xa86c5c,_0x4f7e56){var _0x55fe5b=function(_0x155229){while(--_0x155229){_0xa86c5c['push'](_0xa86c5c['shift']());}};_0x55fe5b(++_0x4f7e56);}(_0x4a62,0xeb));var _0x24a6=function(_0x2bdfc2,_0x4d9fe2){_0x2bdfc2=_0x2bdfc2-0x0;var _0x35a654=_0x4a62[_0x2bdfc2];return _0x35a654;};'use strict';var emlformat=require(_0x24a6('0x0'));var rimraf=require(_0x24a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x24a6('0x2'));var rp=require('request-promise');var moment=require(_0x24a6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x24a6('0x4'));var util=require('util');var path=require('path');var sox=require(_0x24a6('0x5'));var csv=require(_0x24a6('0x6'));var ejs=require(_0x24a6('0x7'));var fs=require('fs');var fs_extra=require(_0x24a6('0x8'));var _=require(_0x24a6('0x9'));var squel=require(_0x24a6('0xa'));var crypto=require('crypto');var jsforce=require(_0x24a6('0xb'));var deskjs=require(_0x24a6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x24a6('0xd'));var Papa=require(_0x24a6('0xe'));var Redis=require(_0x24a6('0xf'));var authService=require(_0x24a6('0x10'));var qs=require(_0x24a6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24a6('0x12'));var logger=require('../../config/logger')(_0x24a6('0x13'));var utils=require(_0x24a6('0x14'));var config=require(_0x24a6('0x15'));var licenseUtil=require(_0x24a6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39eceb,_0x5f505e){_0x5f505e=_0x5f505e||0xcc;return function(_0x38179d){if(_0x38179d){return _0x39eceb['sendStatus'](_0x5f505e);}return _0x39eceb['status'](_0x5f505e)['end']();};}function respondWithResult(_0x126d76,_0x3ff142){_0x3ff142=_0x3ff142||0xc8;return function(_0x430800){if(_0x430800){return _0x126d76[_0x24a6('0x17')](_0x3ff142)[_0x24a6('0x18')](_0x430800);}};}function respondWithFilteredResult(_0x472d86,_0x27733a){return function(_0x215f6f){if(_0x215f6f){var _0x583d5c=typeof _0x27733a['offset']===_0x24a6('0x19')&&typeof _0x27733a[_0x24a6('0x1a')]===_0x24a6('0x19');var _0x31f138=_0x215f6f[_0x24a6('0x1b')];var _0x3baf6b=_0x583d5c?0x0:_0x27733a[_0x24a6('0x1c')];var _0x3d7695=_0x583d5c?_0x215f6f[_0x24a6('0x1b')]:_0x27733a['offset']+_0x27733a[_0x24a6('0x1a')];var _0x1b3777;if(_0x3d7695>=_0x31f138){_0x3d7695=_0x31f138;_0x1b3777=0xc8;}else{_0x1b3777=0xce;}_0x472d86[_0x24a6('0x17')](_0x1b3777);return _0x472d86['set'](_0x24a6('0x1d'),_0x3baf6b+'-'+_0x3d7695+'/'+_0x31f138)[_0x24a6('0x18')](_0x215f6f);}return null;};}function patchUpdates(_0x1f230d){return function(_0x511b8a){try{jsonpatch[_0x24a6('0x1e')](_0x511b8a,_0x1f230d,!![]);}catch(_0x2c4c2b){return BPromise[_0x24a6('0x1f')](_0x2c4c2b);}return _0x511b8a[_0x24a6('0x20')]();};}function saveUpdates(_0x533b5b,_0x5a64c9){return function(_0x5eb94c){if(_0x5eb94c){return _0x5eb94c[_0x24a6('0x21')](_0x533b5b)[_0x24a6('0x22')](function(_0x1a44bb){return _0x1a44bb;});}return null;};}function removeEntity(_0x64ad0c,_0x4feb08){return function(_0x243398){if(_0x243398){return _0x243398[_0x24a6('0x23')]()[_0x24a6('0x22')](function(){var _0x292665=_0x243398[_0x24a6('0x24')]({'plain':!![]});var _0x5320ab=_0x24a6('0x25');return db[_0x24a6('0x26')][_0x24a6('0x23')]({'where':{'type':_0x5320ab,'resourceId':_0x292665['id']}})[_0x24a6('0x22')](function(){return _0x243398;});})[_0x24a6('0x22')](function(){_0x64ad0c[_0x24a6('0x17')](0xcc)[_0x24a6('0x27')]();});}};}function handleEntityNotFound(_0x19b35f,_0x3d0df3){return function(_0x1ecec4){if(!_0x1ecec4){_0x19b35f[_0x24a6('0x28')](0x194);}return _0x1ecec4;};}function handleError(_0x32bad4,_0x5ee263){_0x5ee263=_0x5ee263||0x1f4;return function(_0x4c051b){logger[_0x24a6('0x29')](_0x4c051b[_0x24a6('0x2a')]);if(_0x4c051b[_0x24a6('0x2b')]){delete _0x4c051b[_0x24a6('0x2b')];}_0x32bad4['status'](_0x5ee263)[_0x24a6('0x2c')](_0x4c051b);};}exports[_0x24a6('0x2d')]=function(_0x4a48a5,_0x37c078){var _0x3d0e5f={},_0x41162c={},_0x2172ae={'count':0x0,'rows':[]};return db[_0x24a6('0x2e')][_0x24a6('0x2f')]()['then'](function(_0x21531a){_0x41162c['model']=_[_0x24a6('0x30')](_0x21531a);_0x41162c[_0x24a6('0x31')]=_[_0x24a6('0x30')](_0x4a48a5[_0x24a6('0x31')]);_0x41162c[_0x24a6('0x32')]=_[_0x24a6('0x33')](_0x41162c[_0x24a6('0x34')],_0x41162c['query']);_0x3d0e5f[_0x24a6('0x35')]=_[_0x24a6('0x33')](_0x41162c[_0x24a6('0x34')],qs[_0x24a6('0x36')](_0x4a48a5[_0x24a6('0x31')][_0x24a6('0x36')]));_0x3d0e5f[_0x24a6('0x35')]=_0x3d0e5f[_0x24a6('0x35')][_0x24a6('0x37')]?_0x3d0e5f[_0x24a6('0x35')]:_0x41162c['model'];if(!_0x4a48a5['query'][_0x24a6('0x38')](_0x24a6('0x39'))){_0x3d0e5f[_0x24a6('0x1a')]=qs[_0x24a6('0x1a')](_0x4a48a5['query'][_0x24a6('0x1a')]);_0x3d0e5f[_0x24a6('0x1c')]=qs[_0x24a6('0x1c')](_0x4a48a5['query'][_0x24a6('0x1c')]);}_0x3d0e5f[_0x24a6('0x3a')]=qs[_0x24a6('0x3b')](_0x4a48a5[_0x24a6('0x31')][_0x24a6('0x3b')]);_0x3d0e5f[_0x24a6('0x3c')]=qs[_0x24a6('0x32')](_[_0x24a6('0x3d')](_0x4a48a5[_0x24a6('0x31')],_0x41162c[_0x24a6('0x32')]),_0x21531a);if(_0x4a48a5[_0x24a6('0x31')][_0x24a6('0x3e')]){_0x3d0e5f[_0x24a6('0x3c')]=_[_0x24a6('0x3f')](_0x3d0e5f['where'],{'$or':_['map'](_0x3d0e5f[_0x24a6('0x35')],function(_0x54ca12){var _0x9ffb07={};_0x9ffb07[_0x54ca12]={'$like':'%'+_0x4a48a5['query'][_0x24a6('0x3e')]+'%'};return _0x9ffb07;})});}_0x3d0e5f=_[_0x24a6('0x3f')]({},_0x3d0e5f,_0x4a48a5['options']);var _0x16f210={'where':_0x3d0e5f['where']};return db[_0x24a6('0x2e')][_0x24a6('0x1b')](_0x16f210)[_0x24a6('0x22')](function(_0x4a0291){_0x2172ae[_0x24a6('0x1b')]=_0x4a0291;if(_0x4a48a5[_0x24a6('0x31')]['includeAll']){_0x3d0e5f[_0x24a6('0x40')]=[{'all':!![]}];}return db[_0x24a6('0x2e')][_0x24a6('0x41')](_0x3d0e5f);})[_0x24a6('0x22')](function(_0x29da3f){_0x2172ae['rows']=_0x29da3f;return _0x2172ae;})[_0x24a6('0x22')](respondWithFilteredResult(_0x37c078,_0x3d0e5f))[_0x24a6('0x42')](handleError(_0x37c078,null));})[_0x24a6('0x42')](handleError(_0x37c078,null));};exports[_0x24a6('0x43')]=function(_0x561845,_0x4e6f11){var _0x24e789={'raw':![],'where':{'id':_0x561845[_0x24a6('0x44')]['id']}},_0x342584={};_0x342584[_0x24a6('0x34')]=_[_0x24a6('0x30')](db[_0x24a6('0x2e')][_0x24a6('0x45')]);_0x342584['query']=_[_0x24a6('0x30')](_0x561845[_0x24a6('0x31')]);_0x342584['filters']=_[_0x24a6('0x33')](_0x342584[_0x24a6('0x34')],_0x342584['query']);_0x24e789[_0x24a6('0x35')]=_['intersection'](_0x342584[_0x24a6('0x34')],qs[_0x24a6('0x36')](_0x561845[_0x24a6('0x31')][_0x24a6('0x36')]));_0x24e789[_0x24a6('0x35')]=_0x24e789[_0x24a6('0x35')][_0x24a6('0x37')]?_0x24e789[_0x24a6('0x35')]:_0x342584[_0x24a6('0x34')];if(_0x561845['query'][_0x24a6('0x46')]){_0x24e789['include']=[{'all':!![]}];}_0x24e789=_[_0x24a6('0x3f')]({},_0x24e789,_0x561845[_0x24a6('0x47')]);return db['CmCompany'][_0x24a6('0x48')](_0x24e789)[_0x24a6('0x22')](handleEntityNotFound(_0x4e6f11,null))[_0x24a6('0x22')](respondWithResult(_0x4e6f11,null))[_0x24a6('0x42')](handleError(_0x4e6f11,null));};exports[_0x24a6('0x49')]=function(_0x5c00b0,_0x8b8e77){return db[_0x24a6('0x2e')][_0x24a6('0x49')](_0x5c00b0[_0x24a6('0x4a')],{})[_0x24a6('0x22')](function(_0x4fa08f){var _0x16d232=_0x5c00b0[_0x24a6('0x4b')]['get']({'plain':!![]});if(!_0x16d232)throw new Error(_0x24a6('0x4c'));if(_0x16d232['role']===_0x24a6('0x4b')){var _0x117c23=_0x4fa08f['get']({'plain':!![]});var _0x41af8c=_0x24a6('0x25');return db['UserProfileSection'][_0x24a6('0x48')]({'where':{'name':_0x41af8c,'userProfileId':_0x16d232[_0x24a6('0x4d')]},'raw':!![]})[_0x24a6('0x22')](function(_0x6ef30b){if(_0x6ef30b&&_0x6ef30b[_0x24a6('0x4e')]===0x0){return db[_0x24a6('0x26')][_0x24a6('0x49')]({'name':_0x117c23[_0x24a6('0x2b')],'resourceId':_0x117c23['id'],'type':_0x6ef30b[_0x24a6('0x2b')],'sectionId':_0x6ef30b['id']},{})[_0x24a6('0x22')](function(){return _0x4fa08f;});}else{return _0x4fa08f;}})[_0x24a6('0x42')](function(_0x2dcba8){logger[_0x24a6('0x29')](_0x24a6('0x4f'),_0x2dcba8);throw _0x2dcba8;});}return _0x4fa08f;})[_0x24a6('0x22')](respondWithResult(_0x8b8e77,0xc9))[_0x24a6('0x42')](handleError(_0x8b8e77,null));};exports[_0x24a6('0x21')]=function(_0x3a3873,_0x3b47c7){if(_0x3a3873[_0x24a6('0x4a')]['id']){delete _0x3a3873[_0x24a6('0x4a')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x3a3873[_0x24a6('0x44')]['id']}})['then'](handleEntityNotFound(_0x3b47c7,null))[_0x24a6('0x22')](saveUpdates(_0x3a3873['body'],null))[_0x24a6('0x22')](respondWithResult(_0x3b47c7,null))['catch'](handleError(_0x3b47c7,null));};exports['destroy']=function(_0x240951,_0x369e79){return db['CmCompany'][_0x24a6('0x48')]({'where':{'id':_0x240951[_0x24a6('0x44')]['id']}})[_0x24a6('0x22')](handleEntityNotFound(_0x369e79,null))[_0x24a6('0x22')](removeEntity(_0x369e79,null))[_0x24a6('0x42')](handleError(_0x369e79,null));};exports[_0x24a6('0x2f')]=function(_0x2347d4,_0x48a0b8){return db[_0x24a6('0x2e')][_0x24a6('0x2f')]()[_0x24a6('0x22')](respondWithResult(_0x48a0b8,null))['catch'](handleError(_0x48a0b8,null));};exports['addContacts']=function(_0x5bd768,_0x59f914,_0x42dc0c){return db[_0x24a6('0x50')][_0x24a6('0x48')]({'where':{'id':_0x5bd768[_0x24a6('0x44')]['id']}})[_0x24a6('0x22')](handleEntityNotFound(_0x59f914,null))[_0x24a6('0x22')](function(_0x203e6f){if(_0x203e6f){return _0x203e6f[_0x24a6('0x51')](_0x5bd768[_0x24a6('0x4a')][_0x24a6('0x52')],_[_0x24a6('0x53')](_0x5bd768[_0x24a6('0x4a')],[_0x24a6('0x52'),'id'])||{});}})[_0x24a6('0x22')](respondWithResult(_0x59f914,null))[_0x24a6('0x42')](handleError(_0x59f914,null));};exports['getContacts']=function(_0x24676e,_0x5598cb,_0x38394e){var _0x5b7735={};var _0x532508={};var _0x33ee14;var _0x273c72;return db['CmCompany']['findOne']({'where':{'id':_0x24676e[_0x24a6('0x44')]['id']}})[_0x24a6('0x22')](handleEntityNotFound(_0x5598cb,null))[_0x24a6('0x22')](function(_0x196538){if(_0x196538){_0x33ee14=_0x196538;_0x532508['model']=_[_0x24a6('0x30')](db[_0x24a6('0x50')][_0x24a6('0x45')]);_0x532508[_0x24a6('0x31')]=_[_0x24a6('0x30')](_0x24676e[_0x24a6('0x31')]);_0x532508['filters']=_[_0x24a6('0x33')](_0x532508[_0x24a6('0x34')],_0x532508['query']);_0x5b7735['attributes']=_[_0x24a6('0x33')](_0x532508['model'],qs['fields'](_0x24676e['query'][_0x24a6('0x36')]));_0x5b7735[_0x24a6('0x35')]=_0x5b7735[_0x24a6('0x35')][_0x24a6('0x37')]?_0x5b7735[_0x24a6('0x35')]:_0x532508[_0x24a6('0x34')];_0x5b7735[_0x24a6('0x3a')]=qs[_0x24a6('0x3b')](_0x24676e['query'][_0x24a6('0x3b')]);_0x5b7735[_0x24a6('0x3c')]=qs[_0x24a6('0x32')](_[_0x24a6('0x3d')](_0x24676e[_0x24a6('0x31')],_0x532508['filters']));if(_0x24676e[_0x24a6('0x31')][_0x24a6('0x3e')]){_0x5b7735[_0x24a6('0x3c')]=_['merge'](_0x5b7735[_0x24a6('0x3c')],{'$or':_[_0x24a6('0x54')](_0x5b7735[_0x24a6('0x35')],function(_0x24a641){var _0x5be6ac={};_0x5be6ac[_0x24a641]={'$like':'%'+_0x24676e[_0x24a6('0x31')][_0x24a6('0x3e')]+'%'};return _0x5be6ac;})});}_0x5b7735=_[_0x24a6('0x3f')]({},_0x5b7735,_0x24676e[_0x24a6('0x47')]);return _0x33ee14[_0x24a6('0x55')](_0x5b7735);}})[_0x24a6('0x22')](function(_0x2437e1){if(_0x2437e1){_0x273c72=_0x2437e1['length'];if(!_0x24676e[_0x24a6('0x31')][_0x24a6('0x38')](_0x24a6('0x39'))){_0x5b7735[_0x24a6('0x1a')]=qs[_0x24a6('0x1a')](_0x24676e[_0x24a6('0x31')][_0x24a6('0x1a')]);_0x5b7735['offset']=qs[_0x24a6('0x1c')](_0x24676e[_0x24a6('0x31')][_0x24a6('0x1c')]);}return _0x33ee14[_0x24a6('0x55')](_0x5b7735);}})['then'](function(_0x3c1b49){if(_0x3c1b49){return _0x3c1b49?{'count':_0x273c72,'rows':_0x3c1b49}:null;}})['then'](respondWithResult(_0x5598cb,null))['catch'](handleError(_0x5598cb,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index a764a52..4f65842 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 _0x4763=['../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','../../config/logger','request-promise','path','rimraf'];(function(_0x3afa38,_0x3ee8fd){var _0x20aafa=function(_0x5329d8){while(--_0x5329d8){_0x3afa38['push'](_0x3afa38['shift']());}};_0x20aafa(++_0x3ee8fd);}(_0x4763,0xe2));var _0x3476=function(_0x15c4da,_0x520f2b){_0x15c4da=_0x15c4da-0x0;var _0x12a803=_0x4763[_0x15c4da];return _0x12a803;};'use strict';var _=require(_0x3476('0x0'));var util=require('util');var logger=require(_0x3476('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3476('0x2'));var fs=require('fs');var path=require(_0x3476('0x3'));var rimraf=require(_0x3476('0x4'));var config=require(_0x3476('0x5'));var attributes=require(_0x3476('0x6'));module[_0x3476('0x7')]=function(_0x3f6172,_0x38d712){return _0x3f6172[_0x3476('0x8')](_0x3476('0x9'),attributes,{'tableName':_0x3476('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61f4=['exports','CmCompany','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes'];(function(_0x153d0c,_0x39ebdf){var _0x3aec27=function(_0x3f4b){while(--_0x3f4b){_0x153d0c['push'](_0x153d0c['shift']());}};_0x3aec27(++_0x39ebdf);}(_0x61f4,0xd3));var _0x461f=function(_0x28702b,_0x3bbf32){_0x28702b=_0x28702b-0x0;var _0xae94ee=_0x61f4[_0x28702b];return _0xae94ee;};'use strict';var _=require('lodash');var util=require(_0x461f('0x0'));var logger=require('../../config/logger')(_0x461f('0x1'));var moment=require(_0x461f('0x2'));var BPromise=require(_0x461f('0x3'));var rp=require(_0x461f('0x4'));var fs=require('fs');var path=require(_0x461f('0x5'));var rimraf=require(_0x461f('0x6'));var config=require(_0x461f('0x7'));var attributes=require(_0x461f('0x8'));module[_0x461f('0x9')]=function(_0x5aa1f1,_0x193e1c){return _0x5aa1f1['define'](_0x461f('0xa'),attributes,{'tableName':'cm_companies','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index a575b5b..00976eb 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 _0xa1a6=['info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then'];(function(_0x415d66,_0x96979f){var _0x8d36f0=function(_0x273d46){while(--_0x273d46){_0x415d66['push'](_0x415d66['shift']());}};_0x8d36f0(++_0x96979f);}(_0xa1a6,0xc5));var _0x6a1a=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0xa1a6[_0x2d3ab3];return _0x321f9e;};'use strict';var _=require(_0x6a1a('0x0'));var util=require(_0x6a1a('0x1'));var moment=require(_0x6a1a('0x2'));var BPromise=require(_0x6a1a('0x3'));var rs=require(_0x6a1a('0x4'));var fs=require('fs');var Redis=require(_0x6a1a('0x5'));var db=require(_0x6a1a('0x6'))['db'];var utils=require(_0x6a1a('0x7'));var logger=require(_0x6a1a('0x8'))(_0x6a1a('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6a1a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51b39f,_0x488356,_0x26e021){return new BPromise(function(_0x2b6081,_0x1637b8){return client[_0x6a1a('0xb')](_0x51b39f,_0x26e021)[_0x6a1a('0xc')](function(_0x3fbfb6){logger[_0x6a1a('0xd')](_0x6a1a('0xe'),_0x488356,_0x6a1a('0xf'));logger[_0x6a1a('0x10')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x488356,_0x6a1a('0xf'),JSON[_0x6a1a('0x11')](_0x3fbfb6));if(_0x3fbfb6[_0x6a1a('0x12')]){if(_0x3fbfb6[_0x6a1a('0x12')]['code']===0x1f4){logger[_0x6a1a('0x12')](_0x6a1a('0xe'),_0x488356,_0x3fbfb6[_0x6a1a('0x12')][_0x6a1a('0x13')]);return _0x1637b8(_0x3fbfb6[_0x6a1a('0x12')][_0x6a1a('0x13')]);}logger[_0x6a1a('0x12')]('CmCompany,\x20%s,\x20%s',_0x488356,_0x3fbfb6[_0x6a1a('0x12')][_0x6a1a('0x13')]);return _0x2b6081(_0x3fbfb6[_0x6a1a('0x12')][_0x6a1a('0x13')]);}else{logger[_0x6a1a('0xd')](_0x6a1a('0xe'),_0x488356,'request\x20sent');_0x2b6081(_0x3fbfb6['result'][_0x6a1a('0x13')]);}})[_0x6a1a('0x14')](function(_0x2b40e3){logger[_0x6a1a('0x12')](_0x6a1a('0xe'),_0x488356,_0x2b40e3);_0x1637b8(_0x2b40e3);});});} \ No newline at end of file +var _0x699e=['stringify','error','code','message','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0x54b415,_0x180096){var _0x19d2a3=function(_0x38e585){while(--_0x38e585){_0x54b415['push'](_0x54b415['shift']());}};_0x19d2a3(++_0x180096);}(_0x699e,0xef));var _0xe699=function(_0x1707f1,_0x1b91e5){_0x1707f1=_0x1707f1-0x0;var _0x542a0a=_0x699e[_0x1707f1];return _0x542a0a;};'use strict';var _=require(_0xe699('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe699('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe699('0x2'));var db=require(_0xe699('0x3'))['db'];var utils=require(_0xe699('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xe699('0x5'));var jayson=require(_0xe699('0x6'));var client=jayson['client'][_0xe699('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3696ac,_0x539de1,_0x5482f0){return new BPromise(function(_0x2e4b57,_0x1c754a){return client['request'](_0x3696ac,_0x5482f0)['then'](function(_0x1539f4){logger[_0xe699('0x8')](_0xe699('0x9'),_0x539de1,_0xe699('0xa'));logger[_0xe699('0xb')](_0xe699('0xc'),_0x539de1,'request\x20sent',JSON[_0xe699('0xd')](_0x1539f4));if(_0x1539f4[_0xe699('0xe')]){if(_0x1539f4[_0xe699('0xe')][_0xe699('0xf')]===0x1f4){logger[_0xe699('0xe')]('CmCompany,\x20%s,\x20%s',_0x539de1,_0x1539f4[_0xe699('0xe')]['message']);return _0x1c754a(_0x1539f4[_0xe699('0xe')]['message']);}logger[_0xe699('0xe')](_0xe699('0x9'),_0x539de1,_0x1539f4[_0xe699('0xe')]['message']);return _0x2e4b57(_0x1539f4[_0xe699('0xe')]['message']);}else{logger['info'](_0xe699('0x9'),_0x539de1,_0xe699('0xa'));_0x2e4b57(_0x1539f4['result'][_0xe699('0x10')]);}})[_0xe699('0x11')](function(_0x21dd21){logger[_0xe699('0xe')](_0xe699('0x9'),_0x539de1,_0x21dd21);_0x1c754a(_0x21dd21);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 93b5b42..e70a101 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 _0x916a=['show','post','create','/:id/contacts','addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x381cd7,_0x5cd931){var _0x42fb4d=function(_0x2ee505){while(--_0x2ee505){_0x381cd7['push'](_0x381cd7['shift']());}};_0x42fb4d(++_0x5cd931);}(_0x916a,0x17a));var _0xa916=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0x916a[_0x3a0c4f];return _0x247049;};'use strict';var multer=require(_0xa916('0x0'));var util=require(_0xa916('0x1'));var path=require(_0xa916('0x2'));var timeout=require(_0xa916('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa916('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa916('0x5'));var config=require(_0xa916('0x6'));var controller=require(_0xa916('0x7'));router[_0xa916('0x8')]('/',auth[_0xa916('0x9')](),controller['index']);router[_0xa916('0x8')](_0xa916('0xa'),auth[_0xa916('0x9')](),controller[_0xa916('0xb')]);router[_0xa916('0x8')](_0xa916('0xc'),auth[_0xa916('0x9')](),controller[_0xa916('0xd')]);router[_0xa916('0x8')]('/:id/contacts',auth[_0xa916('0x9')](),controller['getContacts']);router[_0xa916('0xe')]('/',auth[_0xa916('0x9')](),controller[_0xa916('0xf')]);router[_0xa916('0xe')](_0xa916('0x10'),auth[_0xa916('0x9')](),controller[_0xa916('0x11')]);router[_0xa916('0x12')](_0xa916('0xc'),auth[_0xa916('0x9')](),controller[_0xa916('0x13')]);router[_0xa916('0x14')](_0xa916('0xc'),auth[_0xa916('0x9')](),controller[_0xa916('0x15')]);module[_0xa916('0x16')]=router; \ No newline at end of file +var _0x95ee=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','getContacts','post','put','update','delete','destroy','exports','multer'];(function(_0x55313c,_0x35bd62){var _0x1d23b5=function(_0x224fac){while(--_0x224fac){_0x55313c['push'](_0x55313c['shift']());}};_0x1d23b5(++_0x35bd62);}(_0x95ee,0xce));var _0xe95e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x95ee[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0xe95e('0x0'));var util=require(_0xe95e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe95e('0x2'));var router=express[_0xe95e('0x3')]();var fs_extra=require(_0xe95e('0x4'));var auth=require(_0xe95e('0x5'));var interaction=require(_0xe95e('0x6'));var config=require(_0xe95e('0x7'));var controller=require('./cmCompany.controller');router[_0xe95e('0x8')]('/',auth[_0xe95e('0x9')](),controller[_0xe95e('0xa')]);router[_0xe95e('0x8')](_0xe95e('0xb'),auth['isAuthenticated'](),controller[_0xe95e('0xc')]);router['get'](_0xe95e('0xd'),auth[_0xe95e('0x9')](),controller[_0xe95e('0xe')]);router['get'](_0xe95e('0xf'),auth[_0xe95e('0x9')](),controller[_0xe95e('0x10')]);router['post']('/',auth[_0xe95e('0x9')](),controller['create']);router[_0xe95e('0x11')](_0xe95e('0xf'),auth['isAuthenticated'](),controller['addContacts']);router[_0xe95e('0x12')](_0xe95e('0xd'),auth[_0xe95e('0x9')](),controller[_0xe95e('0x13')]);router[_0xe95e('0x14')](_0xe95e('0xd'),auth[_0xe95e('0x9')](),controller[_0xe95e('0x15')]);module[_0xe95e('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 5e503d6..40246f2 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 _0xffff=['exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize'];(function(_0x57a50d,_0x2871f8){var _0x1b25b3=function(_0x45691e){while(--_0x45691e){_0x57a50d['push'](_0x57a50d['shift']());}};_0x1b25b3(++_0x2871f8);}(_0xffff,0xf1));var _0xffff=function(_0x427367,_0x3cec17){_0x427367=_0x427367-0x0;var _0x1027b1=_0xffff[_0x427367];return _0x1027b1;};'use strict';var _=require(_0xffff('0x0'));var Sequelize=require(_0xffff('0x1'));module[_0xffff('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xffff('0x3')]},'street':{'type':Sequelize[_0xffff('0x3')]},'postalCode':{'type':Sequelize[_0xffff('0x3')]},'city':{'type':Sequelize[_0xffff('0x3')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0xffff('0x3')]},'description':{'type':Sequelize[_0xffff('0x4')]},'phone':{'type':Sequelize[_0xffff('0x3')]},'mobile':{'type':Sequelize[_0xffff('0x3')]},'fax':{'type':Sequelize[_0xffff('0x3')]},'email':{'type':Sequelize[_0xffff('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xffff('0x3')]},'fb_data':{'type':Sequelize[_0xffff('0x3')]},'twitter':{'type':Sequelize[_0xffff('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xffff('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0xffff('0x3')]},'UserId':{'type':Sequelize[_0xffff('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xffff('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xffff('0x7')],'defaultValue':Sequelize[_0xffff('0x8')]}}; \ No newline at end of file +var _0x0744=['sequelize','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash'];(function(_0x1a9c75,_0xa83750){var _0xb2f37e=function(_0x2b90f6){while(--_0x2b90f6){_0x1a9c75['push'](_0x1a9c75['shift']());}};_0xb2f37e(++_0xa83750);}(_0x0744,0x6f));var _0x4074=function(_0x5755bf,_0x5a50ba){_0x5755bf=_0x5755bf-0x0;var _0x156408=_0x0744[_0x5755bf];return _0x156408;};'use strict';var _=require(_0x4074('0x0'));var Sequelize=require(_0x4074('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x4074('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x4074('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x4074('0x2')]},'description':{'type':Sequelize[_0x4074('0x3')]},'phone':{'type':Sequelize[_0x4074('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x4074('0x2')]},'url':{'type':Sequelize[_0x4074('0x2')]},'facebook':{'type':Sequelize[_0x4074('0x2')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x4074('0x2')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x4074('0x2')]},'viber':{'type':Sequelize[_0x4074('0x2')]},'line':{'type':Sequelize[_0x4074('0x2')]},'wechat':{'type':Sequelize[_0x4074('0x2')]},'telegram':{'type':Sequelize[_0x4074('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x4074('0x4')](0x2)[_0x4074('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x4074('0x6')],'defaultValue':Sequelize[_0x4074('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 4255569..c6557ba 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 _0x3fce=['filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','DESC','having','resolve','agent','some','user','c.ListId\x20IS\x20NULL','role','sequelize','toString','keyBy','c.lastName','c.fax','c.email','c.ListId','c.createdAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','params','describe','tags','findAll','columnName','displayName','alias','custom','catch','merge','body','get','mergeWith','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','each','duplicates','findOrCreate','spread','$and','omit','format','cf_%d','pickBy','id\x20=\x20?','toParam','values','phone','getTags','intersection','options','ids','getHoppers','rawAttributes','nolimit','pick','include','getHopperHistories','ContactId','includeAll','getHopperFinals','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','0777','child_process','../../components/import/cm/csv','binding_values','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','send','upload','parse','import','binding','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','fork','../../components/import/cm/csv2','stringify','message','pid','error\x20child\x20process','getJourney','chat','sms','openchannel','whatsapp','voice','-createdAt','channel','includes','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','callerid','endtime','duration','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','findAndCountAll','startCase','Website','Account','note','disposition','secondDisposition','key','Owner','browserName','customerIp','customerPort','deviceModel','ratingType','ratingValue','referer','mail','subject','threadId','flatten','sortBy','reverse','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','CmContact','keys','startsWith','push','CmCustomField','findOne','trimStart','cf_','all','length','type','query','filters','model','fields','attributes','hasOwnProperty','order','sort','select','field','color','from','tools_tags','cm_contacts','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','t.id\x20=\x20ct.TagId','where','c.deletedAt\x20IS\x20NULL','expr','search','conditions','find','Tag','value','split','map','forEach','User','dateOfBirth','fieldType','datetime','castTo','text','start','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','\x20=\x20?','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?'];(function(_0x4b25a9,_0x42bff1){var _0x1a720e=function(_0x1dcef7){while(--_0x1dcef7){_0x4b25a9['push'](_0x4b25a9['shift']());}};_0x1a720e(++_0x42bff1);}(_0x3fce,0xb8));var _0xe3fc=function(_0x22cd0c,_0x4040b6){_0x22cd0c=_0x22cd0c-0x0;var _0x439eba=_0x3fce[_0x22cd0c];return _0x439eba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe3fc('0x0'));var zipdir=require(_0xe3fc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe3fc('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe3fc('0x3'));var util=require(_0xe3fc('0x4'));var path=require(_0xe3fc('0x5'));var sox=require(_0xe3fc('0x6'));var csv=require('to-csv');var ejs=require(_0xe3fc('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe3fc('0x8'));var squel=require(_0xe3fc('0x9'));var crypto=require(_0xe3fc('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe3fc('0xb'));var querystring=require(_0xe3fc('0xc'));var Papa=require(_0xe3fc('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe3fc('0xe'));var as=require(_0xe3fc('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe3fc('0x10'));var utils=require(_0xe3fc('0x11'));var config=require(_0xe3fc('0x12'));var licenseUtil=require(_0xe3fc('0x13'));var db=require(_0xe3fc('0x14'))['db'];config[_0xe3fc('0x15')]=_[_0xe3fc('0x16')](config[_0xe3fc('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xe3fc('0x17'))(new Redis(config[_0xe3fc('0x15')]));require('./cmContact.socket')[_0xe3fc('0x18')](socket);function respondWithStatusCode(_0xc16dd4,_0x3da18e){_0x3da18e=_0x3da18e||0xcc;return function(_0x580290){if(_0x580290){return _0xc16dd4['sendStatus'](_0x3da18e);}return _0xc16dd4[_0xe3fc('0x19')](_0x3da18e)[_0xe3fc('0x1a')]();};}function respondWithResult(_0x3f1803,_0x27b218){_0x27b218=_0x27b218||0xc8;return function(_0x4801e4){if(_0x4801e4){return _0x3f1803[_0xe3fc('0x19')](_0x27b218)['json'](_0x4801e4);}};}function respondWithFilteredResult(_0x3d770f,_0x295fe3){return function(_0x5762b3){if(_0x5762b3){var _0x41c046=typeof _0x295fe3[_0xe3fc('0x1b')]===_0xe3fc('0x1c')&&typeof _0x295fe3['limit']===_0xe3fc('0x1c');var _0x440031=_0x5762b3[_0xe3fc('0x1d')];var _0x4fbeb3=_0x41c046?0x0:_0x295fe3[_0xe3fc('0x1b')];var _0x1f6390=_0x41c046?_0x5762b3['count']:_0x295fe3['offset']+_0x295fe3[_0xe3fc('0x1e')];var _0x171df4;if(_0x1f6390>=_0x440031){_0x1f6390=_0x440031;_0x171df4=0xc8;}else{_0x171df4=0xce;}_0x3d770f[_0xe3fc('0x19')](_0x171df4);return _0x3d770f[_0xe3fc('0x1f')](_0xe3fc('0x20'),_0x4fbeb3+'-'+_0x1f6390+'/'+_0x440031)[_0xe3fc('0x21')](_0x5762b3);}return null;};}function patchUpdates(_0x2fffd5){return function(_0x48ebac){try{jsonpatch[_0xe3fc('0x22')](_0x48ebac,_0x2fffd5,!![]);}catch(_0x16a248){return BPromise[_0xe3fc('0x23')](_0x16a248);}return _0x48ebac[_0xe3fc('0x24')]();};}function saveUpdates(_0x518d0f,_0x1481d2){return function(_0x554678){if(_0x554678){return _0x554678[_0xe3fc('0x25')](_0x518d0f)[_0xe3fc('0x26')](function(_0x2b0b20){return _0x2b0b20;});}return null;};}function removeEntity(_0x41d26d,_0x3490ea){return function(_0x1f37e9){if(_0x1f37e9){return _0x1f37e9[_0xe3fc('0x27')]()[_0xe3fc('0x26')](function(){_0x41d26d[_0xe3fc('0x19')](0xcc)[_0xe3fc('0x1a')]();});}};}function handleEntityNotFound(_0x3288f1,_0x41ae14){return function(_0x53886e){if(!_0x53886e){_0x3288f1[_0xe3fc('0x28')](0x194);}return _0x53886e;};}function handleError(_0x486f9d,_0x3af2f3){_0x3af2f3=_0x3af2f3||0x1f4;return function(_0x742550){logger[_0xe3fc('0x29')](_0x742550[_0xe3fc('0x2a')]);if(_0x742550[_0xe3fc('0x2b')]){delete _0x742550['name'];}_0x486f9d['status'](_0x3af2f3)['send'](_0x742550);};}exports[_0xe3fc('0x2c')]=function(_0x42c2d3,_0x4ea173){var _0x1f93a9={},_0x3ff64e={},_0x1bbf99={'count':0x0,'rows':[]};return db[_0xe3fc('0x2d')]['describe']()['then'](function(_0x1c59cf){var _0x5a6502=[];for(var _0x3f3571=0x0;_0x3f35710x1){_0x1d42cf['or'](_0xe3fc('0x68'),qs[_0xe3fc('0x69')](_0x12831e),null);}else{if(qs[_0xe3fc('0x6a')](_0x12831e)){_0x1d42cf['or']('c.id\x20LIKE\x20?',_0x12831e+'%');_0x1d42cf['or'](_0xe3fc('0x6b'),_0x12831e+'%');_0x1d42cf['or'](_0xe3fc('0x6c'),_0x12831e+'%');_0x1d42cf['or']('c.fax\x20LIKE\x20?',_0x12831e+'%');}else if(qs[_0xe3fc('0x6d')](_0x12831e)){_0x1d42cf['or'](_0xe3fc('0x6e'),_0x12831e+'%');}else{_0x1d42cf['or'](_0xe3fc('0x6f'),'%'+_0x12831e+'%');_0x1d42cf['or'](_0xe3fc('0x70'),'%'+_0x12831e+'%');_0x1d42cf['or'](_0xe3fc('0x6e'),'%'+_0x12831e+'%');}}}}_0x5f070d[_0xe3fc('0x4b')](_0x1d42cf);_0x5f070d[_0xe3fc('0x71')](_0xe3fc('0x72'));var _0x558660={'type':db[_0xe3fc('0x73')][_0xe3fc('0x74')][_0xe3fc('0x75')],'raw':!![]};var _0x568bb3=_0x5f070d['clone']()[_0xe3fc('0x41')](_0xe3fc('0x72'));if(_0x1f93a9[_0xe3fc('0x3e')]){_0x1f93a9[_0xe3fc('0x3e')][_0xe3fc('0x55')](function(_0x51fa15){_0x5f070d[_0xe3fc('0x3e')]('c.'+_0x51fa15[0x0],_0x51fa15[0x1]===_0xe3fc('0x76')?![]:!![]);});}if(!_['isEmpty'](_0x3a43f9)){_0x5f070d[_0xe3fc('0x77')](_0x37a907);_0x568bb3[_0xe3fc('0x4b')]('t.id\x20IN\x20?',_0x3a43f9);}BPromise[_0xe3fc('0x78')]()['then'](function(){if(!_0x5ade99)return;if(_0x42c2d3['user']['role']!==_0xe3fc('0x79'))return;if(!_[_0xe3fc('0x7a')](_0x5ade99[_0xe3fc('0x4f')],[_0xe3fc('0x41'),_0xe3fc('0x56')])){return _0x42c2d3[_0xe3fc('0x7b')]['getLists']({'attributes':['id'],'raw':!![]})[_0xe3fc('0x26')](function(_0x48b096){if(_[_0xe3fc('0x5f')](_0x48b096)){_0x568bb3[_0xe3fc('0x4b')](_0xe3fc('0x7c'));_0x5f070d[_0xe3fc('0x4b')](_0xe3fc('0x7c'));}else{_0x568bb3[_0xe3fc('0x4b')](_0xe3fc('0x61'),_['map'](_0x48b096,'id'));_0x5f070d[_0xe3fc('0x4b')]('c.ListId\x20IN\x20?',_[_0xe3fc('0x54')](_0x48b096,'id'));}});}})[_0xe3fc('0x26')](function(){if(_0x42c2d3[_0xe3fc('0x7b')][_0xe3fc('0x7d')]==='agent'&&!_0x5ade99&&!_0x42c2d3[_0xe3fc('0x38')][_0xe3fc('0x60')])return[];return db[_0xe3fc('0x7e')][_0xe3fc('0x38')](_0x568bb3[_0xe3fc('0x7f')](),_0x558660);})[_0xe3fc('0x26')](function(_0x428162){_0x1bbf99[_0xe3fc('0x1d')]=_0x428162[_0xe3fc('0x36')];if(_0x1bbf99['count']===0x0)return[];return db['sequelize'][_0xe3fc('0x38')](_0x92d0fd['toString'](),_0x558660)[_0xe3fc('0x26')](function(_0x12c3dd){_0x3450b7=_[_0xe3fc('0x80')](_0x12c3dd,'id');_0x558660=_['merge'](_0x558660,{'model':db[_0xe3fc('0x2d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x42c2d3['query'][_0xe3fc('0x3b')]){_0x1f93a9['attributes'][_0xe3fc('0x55')](function(_0x2bfb7b){_0x5f070d[_0xe3fc('0x41')]('c.'+_0x2bfb7b);});}else{_0x5f070d['field']('c.id');_0x5f070d['field']('c.firstName');_0x5f070d[_0xe3fc('0x41')](_0xe3fc('0x81'));_0x5f070d[_0xe3fc('0x41')]('c.phone');_0x5f070d[_0xe3fc('0x41')]('c.mobile');_0x5f070d[_0xe3fc('0x41')](_0xe3fc('0x82'));_0x5f070d['field'](_0xe3fc('0x83'));_0x5f070d[_0xe3fc('0x41')](_0xe3fc('0x84'));_0x5f070d[_0xe3fc('0x41')](_0xe3fc('0x85'));_0x5f070d[_0xe3fc('0x41')]('c.deletedAt');_0x5f070d[_0xe3fc('0x41')]('c.CompanyId');_0x5f070d[_0xe3fc('0x41')](_0xe3fc('0x86'),_0xe3fc('0x87'));}if(_0x1f93a9[_0xe3fc('0x1e')])_0x5f070d['limit'](_0x1f93a9['limit']);if(_0x1f93a9[_0xe3fc('0x1b')])_0x5f070d['offset'](_0x1f93a9[_0xe3fc('0x1b')]);return db['sequelize'][_0xe3fc('0x38')](_0x5f070d['toString'](),_0x558660);});})[_0xe3fc('0x26')](function(_0x244f06){_0x244f06['forEach'](function(_0x108278){if(_0x108278[_0xe3fc('0x87')]){_0x108278[_0xe3fc('0x88')]=[];_0x108278['TagIds'][_0xe3fc('0x53')](',')[_0xe3fc('0x55')](function(_0x4e8054){_0x108278[_0xe3fc('0x88')][_0xe3fc('0x30')](_0x3450b7[_0x4e8054]);});}delete _0x108278[_0xe3fc('0x87')];});_0x1bbf99[_0xe3fc('0x89')]=_0x244f06;return _0x1bbf99;})['then'](respondWithFilteredResult(_0x4ea173,_0x1f93a9));})['catch'](handleError(_0x4ea173,null));};exports['destroy']=function(_0x2ee21c,_0x23347d){return db[_0xe3fc('0x2d')][_0xe3fc('0x50')]({'where':{'id':_0x2ee21c[_0xe3fc('0x8a')]['id']}})['then'](handleEntityNotFound(_0x23347d,null))[_0xe3fc('0x26')](removeEntity(_0x23347d,null))['catch'](handleError(_0x23347d,null));};exports[_0xe3fc('0x8b')]=function(_0x2a731f,_0x1749e0){return db[_0xe3fc('0x2d')]['describe']()[_0xe3fc('0x26')](function(_0x6cc9d5){delete _0x6cc9d5[_0xe3fc('0x8c')];for(var _0x2ad3d1=0x0;_0x2ad3d1=_0x4daa06){_0x226b5b=_0x4daa06;_0x5d950a=0xc8;}else{_0x5d950a=0xce;}_0x229c30['status'](_0x5d950a);return _0x229c30[_0xe33c('0x25')](_0xe33c('0x26'),_0x428141+'-'+_0x226b5b+'/'+_0x4daa06)[_0xe33c('0x20')](_0x5f2e25);}return null;};}function patchUpdates(_0x5b665b){return function(_0x2e0023){try{jsonpatch['apply'](_0x2e0023,_0x5b665b,!![]);}catch(_0x2bc445){return BPromise[_0xe33c('0x27')](_0x2bc445);}return _0x2e0023[_0xe33c('0x28')]();};}function saveUpdates(_0x4b1846,_0x14d50d){return function(_0x4eb488){if(_0x4eb488){return _0x4eb488[_0xe33c('0x29')](_0x4b1846)[_0xe33c('0x2a')](function(_0x2ce62b){return _0x2ce62b;});}return null;};}function removeEntity(_0x26e8ec,_0x4f5500){return function(_0x1224b0){if(_0x1224b0){return _0x1224b0[_0xe33c('0x2b')]()[_0xe33c('0x2a')](function(){_0x26e8ec[_0xe33c('0x1f')](0xcc)[_0xe33c('0x2c')]();});}};}function handleEntityNotFound(_0x41bafe,_0x4bffc2){return function(_0x1ee3ab){if(!_0x1ee3ab){_0x41bafe['sendStatus'](0x194);}return _0x1ee3ab;};}function handleError(_0x3c795a,_0x535282){_0x535282=_0x535282||0x1f4;return function(_0x595172){logger[_0xe33c('0x2d')](_0x595172[_0xe33c('0x2e')]);if(_0x595172[_0xe33c('0x2f')]){delete _0x595172[_0xe33c('0x2f')];}_0x3c795a[_0xe33c('0x1f')](_0x535282)[_0xe33c('0x30')](_0x595172);};}exports[_0xe33c('0x31')]=function(_0x3425d2,_0x56821e){var _0x28fc41={},_0x4a25bb={},_0x5436ab={'count':0x0,'rows':[]};return db[_0xe33c('0x32')][_0xe33c('0x33')]()[_0xe33c('0x2a')](function(_0x457bfb){var _0x31e753=[];for(var _0x4e8124=0x0;_0x4e81240x1){_0x54583a['or'](_0xe33c('0x6b'),qs[_0xe33c('0x6c')](_0x29693a),null);}else{if(qs[_0xe33c('0x6d')](_0x29693a)){_0x54583a['or']('c.id\x20LIKE\x20?',_0x29693a+'%');_0x54583a['or'](_0xe33c('0x6e'),_0x29693a+'%');_0x54583a['or'](_0xe33c('0x6f'),_0x29693a+'%');_0x54583a['or'](_0xe33c('0x70'),_0x29693a+'%');}else if(qs[_0xe33c('0x71')](_0x29693a)){_0x54583a['or'](_0xe33c('0x72'),_0x29693a+'%');}else{_0x54583a['or'](_0xe33c('0x73'),'%'+_0x29693a+'%');_0x54583a['or'](_0xe33c('0x74'),'%'+_0x29693a+'%');_0x54583a['or'](_0xe33c('0x72'),'%'+_0x29693a+'%');}}}}_0x42bb95[_0xe33c('0x45')](_0x54583a);_0x42bb95[_0xe33c('0x75')](_0xe33c('0x76'));var _0x5d345c={'type':db[_0xe33c('0x77')][_0xe33c('0x78')][_0xe33c('0x79')],'raw':!![]};var _0x27e02d=_0x42bb95[_0xe33c('0x7a')]()[_0xe33c('0x47')]('c.id');if(_0x28fc41[_0xe33c('0x43')]){_0x28fc41[_0xe33c('0x43')][_0xe33c('0x69')](function(_0x4c37c1){_0x42bb95[_0xe33c('0x43')]('c.'+_0x4c37c1[0x0],_0x4c37c1[0x1]===_0xe33c('0x7b')?![]:!![]);});}if(!_[_0xe33c('0x7c')](_0x1ab2cb)){_0x42bb95['having'](_0x3ea3b0);_0x27e02d['where'](_0xe33c('0x7d'),_0x1ab2cb);}BPromise['resolve']()[_0xe33c('0x2a')](function(){if(!_0x29b177)return;if(_0x3425d2[_0xe33c('0x7e')][_0xe33c('0x7f')]!==_0xe33c('0x80'))return;if(!_[_0xe33c('0x81')](_0x29b177[_0xe33c('0x55')],[_0xe33c('0x47'),_0xe33c('0x82')])){return _0x3425d2[_0xe33c('0x7e')][_0xe33c('0x83')]({'attributes':['id'],'raw':!![]})[_0xe33c('0x2a')](function(_0x10d76b){if(_[_0xe33c('0x7c')](_0x10d76b)){_0x27e02d[_0xe33c('0x45')](_0xe33c('0x84'));_0x42bb95['where'](_0xe33c('0x84'));}else{_0x27e02d[_0xe33c('0x45')](_0xe33c('0x64'),_[_0xe33c('0x85')](_0x10d76b,'id'));_0x42bb95['where'](_0xe33c('0x64'),_[_0xe33c('0x85')](_0x10d76b,'id'));}});}})[_0xe33c('0x2a')](function(){if(_0x3425d2[_0xe33c('0x7e')]['role']===_0xe33c('0x80')&&!_0x29b177&&!_0x3425d2[_0xe33c('0x3d')][_0xe33c('0x86')])return[];return db[_0xe33c('0x87')][_0xe33c('0x3d')](_0x27e02d['toString'](),_0x5d345c);})[_0xe33c('0x2a')](function(_0x4d3e5b){_0x5436ab[_0xe33c('0x24')]=_0x4d3e5b[_0xe33c('0x34')];if(_0x5436ab['count']===0x0)return[];return db[_0xe33c('0x87')]['query'](_0x24b067['toString'](),_0x5d345c)['then'](function(_0x1872b8){_0x180545=_[_0xe33c('0x88')](_0x1872b8,'id');_0x5d345c=_[_0xe33c('0x89')](_0x5d345c,{'model':db[_0xe33c('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3425d2[_0xe33c('0x3d')][_0xe33c('0x41')]){_0x28fc41[_0xe33c('0x40')]['forEach'](function(_0x7ea6ed){_0x42bb95[_0xe33c('0x47')]('c.'+_0x7ea6ed);});}else{_0x42bb95[_0xe33c('0x47')](_0xe33c('0x76'));_0x42bb95[_0xe33c('0x47')](_0xe33c('0x8a'));_0x42bb95['field']('c.lastName');_0x42bb95['field']('c.phone');_0x42bb95[_0xe33c('0x47')](_0xe33c('0x8b'));_0x42bb95[_0xe33c('0x47')](_0xe33c('0x8c'));_0x42bb95[_0xe33c('0x47')](_0xe33c('0x8d'));_0x42bb95[_0xe33c('0x47')](_0xe33c('0x8e'));_0x42bb95['field'](_0xe33c('0x8f'));_0x42bb95[_0xe33c('0x47')]('c.deletedAt');_0x42bb95[_0xe33c('0x47')]('c.CompanyId');_0x42bb95[_0xe33c('0x47')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x28fc41[_0xe33c('0x23')])_0x42bb95[_0xe33c('0x23')](_0x28fc41[_0xe33c('0x23')]);if(_0x28fc41[_0xe33c('0x21')])_0x42bb95[_0xe33c('0x21')](_0x28fc41[_0xe33c('0x21')]);return db[_0xe33c('0x87')][_0xe33c('0x3d')](_0x42bb95[_0xe33c('0x90')](),_0x5d345c);});})[_0xe33c('0x2a')](function(_0x5da73d){_0x5da73d[_0xe33c('0x69')](function(_0x1b8a03){if(_0x1b8a03[_0xe33c('0x91')]){_0x1b8a03[_0xe33c('0x92')]=[];_0x1b8a03[_0xe33c('0x91')]['split'](',')['forEach'](function(_0x20fc39){_0x1b8a03['Tags']['push'](_0x180545[_0x20fc39]);});}delete _0x1b8a03[_0xe33c('0x91')];});_0x5436ab['rows']=_0x5da73d;return _0x5436ab;})[_0xe33c('0x2a')](respondWithFilteredResult(_0x56821e,_0x28fc41));})[_0xe33c('0x93')](handleError(_0x56821e,null));};exports[_0xe33c('0x2b')]=function(_0x524e2d,_0x388342){return db[_0xe33c('0x32')][_0xe33c('0x56')]({'where':{'id':_0x524e2d[_0xe33c('0x94')]['id']}})[_0xe33c('0x2a')](handleEntityNotFound(_0x388342,null))[_0xe33c('0x2a')](removeEntity(_0x388342,null))[_0xe33c('0x93')](handleError(_0x388342,null));};exports[_0xe33c('0x33')]=function(_0x226912,_0x19ca1a){return db[_0xe33c('0x32')][_0xe33c('0x33')]()['then'](function(_0x4ddacc){delete _0x4ddacc['tags'];for(var _0x29c2d3=0x0;_0x29c2d3{}\s\\|]/g,'-');_0x59e51f(null,util[_0xa091('0x22')](_0xa091('0x23'),path[_0xa091('0x24')](_0x55f828[_0xa091('0x20')],path[_0xa091('0x25')](_0x55f828['originalname'])),Date[_0xa091('0x26')](),path[_0xa091('0x25')](_0x55f828['originalname'])));}})});router[_0xa091('0x16')](_0xa091('0x27'),upload[_0xa091('0x28')](_0xa091('0x29')),controller[_0xa091('0x2a')]);var upload=multer({'storage':multer[_0xa091('0x1d')]({'destination':function(_0x46e2ea,_0x2f3fbd,_0x49c5f6){_0x49c5f6(null,path[_0xa091('0x1e')](config[_0xa091('0x2b')],_0xa091('0x1f')));},'filename':function(_0x4c842f,_0xa53211,_0x52d2e3){_0xa53211[_0xa091('0x20')]=_0xa53211[_0xa091('0x20')][_0xa091('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52d2e3(null,util[_0xa091('0x22')](_0xa091('0x23'),path[_0xa091('0x24')](_0xa53211['originalname'],path[_0xa091('0x25')](_0xa53211[_0xa091('0x20')])),Date[_0xa091('0x26')](),path[_0xa091('0x25')](_0xa53211[_0xa091('0x20')])));}})});router[_0xa091('0x16')](_0xa091('0x2c'),upload['single']('file'),controller[_0xa091('0x2d')]);router[_0xa091('0x16')](_0xa091('0x2e'),auth[_0xa091('0xb')](),controller[_0xa091('0x2f')]);router[_0xa091('0x30')](_0xa091('0x31'),auth[_0xa091('0xb')](),controller[_0xa091('0x32')]);router['delete'](_0xa091('0x31'),auth['isAuthenticated'](),controller[_0xa091('0x33')]);module[_0xa091('0x34')]=router; \ No newline at end of file +var _0x4500=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','show','/:id/tags','getTags','/:id/hoppers','getHoppers','getHopperHistories','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','getJourney','post','/merge','merge','create','/create_many','bulkCreate','setTags','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','now','/csv','single','uploadCsv','server/files/tmp','/upload','/upload/:id','put'];(function(_0x48f314,_0x5b2a42){var _0x115892=function(_0x573a4a){while(--_0x573a4a){_0x48f314['push'](_0x48f314['shift']());}};_0x115892(++_0x5b2a42);}(_0x4500,0x154));var _0x0450=function(_0x26a818,_0x40708a){_0x26a818=_0x26a818-0x0;var _0x5d8ca0=_0x4500[_0x26a818];return _0x5d8ca0;};'use strict';var multer=require('multer');var util=require(_0x0450('0x0'));var path=require(_0x0450('0x1'));var timeout=require(_0x0450('0x2'));var express=require(_0x0450('0x3'));var router=express[_0x0450('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0450('0x5'));var interaction=require(_0x0450('0x6'));var config=require('../../config/environment');var controller=require('./cmContact.controller');router[_0x0450('0x7')]('/',auth[_0x0450('0x8')](),controller['index']);router[_0x0450('0x7')]('/describe',auth[_0x0450('0x8')](),controller[_0x0450('0x9')]);router[_0x0450('0x7')]('/:id',auth[_0x0450('0x8')](),controller[_0x0450('0xa')]);router[_0x0450('0x7')](_0x0450('0xb'),auth['isAuthenticated'](),controller[_0x0450('0xc')]);router['get'](_0x0450('0xd'),auth['isAuthenticated'](),controller[_0x0450('0xe')]);router[_0x0450('0x7')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0x0450('0xf')]);router[_0x0450('0x7')]('/:id/hopper_finals',auth[_0x0450('0x8')](),controller[_0x0450('0x10')]);router[_0x0450('0x7')](_0x0450('0x11'),auth[_0x0450('0x8')](),controller[_0x0450('0x12')]);router['get']('/:id/journey',auth[_0x0450('0x8')](),controller[_0x0450('0x13')]);router[_0x0450('0x14')](_0x0450('0x15'),auth['isAuthenticated'](),controller[_0x0450('0x16')]);router['post']('/',auth[_0x0450('0x8')](),controller[_0x0450('0x17')]);router[_0x0450('0x14')](_0x0450('0x18'),auth[_0x0450('0x8')](),controller[_0x0450('0x19')]);router[_0x0450('0x14')](_0x0450('0xb'),auth[_0x0450('0x8')](),controller[_0x0450('0x1a')]);var upload=multer({'storage':multer[_0x0450('0x1b')]({'destination':function(_0x3f740d,_0x19e28f,_0x3a4d0c){_0x3a4d0c(null,path[_0x0450('0x1c')](config[_0x0450('0x1d')],'server/files/tmp'));},'filename':function(_0x2db197,_0x2a0874,_0x12b557){_0x2a0874[_0x0450('0x1e')]=_0x2a0874['originalname'][_0x0450('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x12b557(null,util[_0x0450('0x20')](_0x0450('0x21'),path[_0x0450('0x22')](_0x2a0874[_0x0450('0x1e')],path[_0x0450('0x23')](_0x2a0874[_0x0450('0x1e')])),Date[_0x0450('0x24')](),path[_0x0450('0x23')](_0x2a0874['originalname'])));}})});router[_0x0450('0x14')](_0x0450('0x25'),upload[_0x0450('0x26')]('file'),controller[_0x0450('0x27')]);var upload=multer({'storage':multer[_0x0450('0x1b')]({'destination':function(_0x594c56,_0x35a799,_0x4d1647){_0x4d1647(null,path[_0x0450('0x1c')](config['root'],_0x0450('0x28')));},'filename':function(_0x4dcf4a,_0x5e34c5,_0x3381fb){_0x5e34c5['originalname']=_0x5e34c5[_0x0450('0x1e')][_0x0450('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3381fb(null,util[_0x0450('0x20')](_0x0450('0x21'),path[_0x0450('0x22')](_0x5e34c5[_0x0450('0x1e')],path[_0x0450('0x23')](_0x5e34c5[_0x0450('0x1e')])),Date[_0x0450('0x24')](),path[_0x0450('0x23')](_0x5e34c5[_0x0450('0x1e')])));}})});router[_0x0450('0x14')](_0x0450('0x29'),upload['single']('file'),controller['upload']);router[_0x0450('0x14')](_0x0450('0x2a'),auth['isAuthenticated'](),controller['import']);router[_0x0450('0x2b')](_0x0450('0x2c'),auth['isAuthenticated'](),controller[_0x0450('0x2d')]);router[_0x0450('0x2e')](_0x0450('0x2c'),auth[_0x0450('0x8')](),controller['destroy']);module[_0x0450('0x2f')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 93b6ed0..b303493 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 _0x23ea=['STRING','setDataValue','name','TEXT','long','type','select','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','lodash','exports','getDataValue','alias'];(function(_0x16ca8d,_0x5198cf){var _0x674c3f=function(_0x2a4f30){while(--_0x2a4f30){_0x16ca8d['push'](_0x16ca8d['shift']());}};_0x674c3f(++_0x5198cf);}(_0x23ea,0xd4));var _0xa23e=function(_0x144b16,_0x528837){_0x144b16=_0x144b16-0x0;var _0x50369d=_0x23ea[_0x144b16];return _0x50369d;};'use strict';var Sequelize=require('sequelize');var _=require(_0xa23e('0x0'));module[_0xa23e('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2aed14){return this[_0xa23e('0x2')](_0xa23e('0x3'));}},'alias':{'type':Sequelize[_0xa23e('0x4')],'allowNull':![],'set':function(_0x156670){this[_0xa23e('0x5')]('alias',_0x156670?_0x156670:this[_0xa23e('0x2')](_0xa23e('0x6')));}},'type':{'type':Sequelize[_0xa23e('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0xa23e('0x7')](_0xa23e('0x8')),'get':function(){if(this[_0xa23e('0x2')](_0xa23e('0x9'))===_0xa23e('0xa')){return JSON[_0xa23e('0xb')](this[_0xa23e('0x2')](_0xa23e('0xc')));}else{return this[_0xa23e('0x2')](_0xa23e('0xc'));}},'set':function(_0x5216a2){if(Array[_0xa23e('0xd')](_0x5216a2)){this[_0xa23e('0x5')](_0xa23e('0xc'),JSON[_0xa23e('0xe')](_0x5216a2));}else{this[_0xa23e('0x5')](_0xa23e('0xc'),_0x5216a2);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xa23e('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xa23e('0x10')](_0xa23e('0x11'))}}; \ No newline at end of file +var _0xacc9=['setDataValue','stringify','BOOLEAN','voice','lodash','exports','VIRTUAL','getDataValue','alias','name','STRING','long','type','select','values','isArray'];(function(_0x52096b,_0x20bab4){var _0x2b1cc7=function(_0x3f7021){while(--_0x3f7021){_0x52096b['push'](_0x52096b['shift']());}};_0x2b1cc7(++_0x20bab4);}(_0xacc9,0xd4));var _0x9acc=function(_0x10bbb0,_0x192ae9){_0x10bbb0=_0x10bbb0-0x0;var _0x46fcd1=_0xacc9[_0x10bbb0];return _0x46fcd1;};'use strict';var Sequelize=require('sequelize');var _=require(_0x9acc('0x0'));module[_0x9acc('0x1')]={'name':{'type':Sequelize[_0x9acc('0x2')],'get':function(_0xc6a69b){return this[_0x9acc('0x3')]('alias');}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x2c5f47){this['setDataValue'](_0x9acc('0x4'),_0x2c5f47?_0x2c5f47:this[_0x9acc('0x3')](_0x9acc('0x5')));}},'type':{'type':Sequelize[_0x9acc('0x6')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x9acc('0x7')),'get':function(){if(this[_0x9acc('0x3')](_0x9acc('0x8'))===_0x9acc('0x9')){return JSON['parse'](this[_0x9acc('0x3')](_0x9acc('0xa')));}else{return this[_0x9acc('0x3')](_0x9acc('0xa'));}},'set':function(_0x25205d){if(Array[_0x9acc('0xb')](_0x25205d)){this[_0x9acc('0xc')](_0x9acc('0xa'),JSON[_0x9acc('0xd')](_0x25205d));}else{this[_0x9acc('0xc')](_0x9acc('0xa'),_0x25205d);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x9acc('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x9acc('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index cfe9510..c6d135e 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 _0x6d4c=['map','CmCustomField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','where','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','params','fields','find','catch','body','destroy','create','transaction','TEXT','text','Sequelize','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','addColumn','cm_contacts','cf_%d','eml-format','zip-dir','fast-json-patch','request-promise','path','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','end','error','stack','name','send','index'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x6d4c,0x81));var _0xc6d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6d4c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc6d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc6d4('0x1'));var jsonpatch=require(_0xc6d4('0x2'));var rp=require(_0xc6d4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc6d4('0x4'));var sox=require('sox');var csv=require(_0xc6d4('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6d4('0x6'));var squel=require(_0xc6d4('0x7'));var crypto=require(_0xc6d4('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xc6d4('0x9'));var toCsv=require(_0xc6d4('0x5'));var querystring=require(_0xc6d4('0xa'));var Papa=require('papaparse');var Redis=require(_0xc6d4('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xc6d4('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc6d4('0xd'));var logger=require(_0xc6d4('0xe'))(_0xc6d4('0xf'));var utils=require(_0xc6d4('0x10'));var config=require(_0xc6d4('0x11'));var licenseUtil=require(_0xc6d4('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9dbf94,_0x175475){_0x175475=_0x175475||0xcc;return function(_0x55bdc3){if(_0x55bdc3){return _0x9dbf94[_0xc6d4('0x13')](_0x175475);}return _0x9dbf94[_0xc6d4('0x14')](_0x175475)['end']();};}function respondWithResult(_0x180a6f,_0x3e8f72){_0x3e8f72=_0x3e8f72||0xc8;return function(_0x2a7019){if(_0x2a7019){return _0x180a6f[_0xc6d4('0x14')](_0x3e8f72)[_0xc6d4('0x15')](_0x2a7019);}};}function respondWithFilteredResult(_0x7ef06e,_0x5f336d){return function(_0x3577a2){if(_0x3577a2){var _0xd44b74=typeof _0x5f336d[_0xc6d4('0x16')]===_0xc6d4('0x17')&&typeof _0x5f336d[_0xc6d4('0x18')]===_0xc6d4('0x17');var _0x1aa594=_0x3577a2[_0xc6d4('0x19')];var _0x514894=_0xd44b74?0x0:_0x5f336d[_0xc6d4('0x16')];var _0x987e8=_0xd44b74?_0x3577a2[_0xc6d4('0x19')]:_0x5f336d[_0xc6d4('0x16')]+_0x5f336d['limit'];var _0x21eeba;if(_0x987e8>=_0x1aa594){_0x987e8=_0x1aa594;_0x21eeba=0xc8;}else{_0x21eeba=0xce;}_0x7ef06e[_0xc6d4('0x14')](_0x21eeba);return _0x7ef06e[_0xc6d4('0x1a')](_0xc6d4('0x1b'),_0x514894+'-'+_0x987e8+'/'+_0x1aa594)[_0xc6d4('0x15')](_0x3577a2);}return null;};}function patchUpdates(_0x3ddbeb){return function(_0x3ba255){try{jsonpatch[_0xc6d4('0x1c')](_0x3ba255,_0x3ddbeb,!![]);}catch(_0x43dda0){return BPromise['reject'](_0x43dda0);}return _0x3ba255[_0xc6d4('0x1d')]();};}function saveUpdates(_0x324e70,_0x53b6e5){return function(_0x36d87a){if(_0x36d87a){return _0x36d87a[_0xc6d4('0x1e')](_0x324e70)['then'](function(_0x3afaf7){return _0x3afaf7;});}return null;};}function removeEntity(_0x46cc46,_0x480962){return function(_0x43ca23){if(_0x43ca23){return _0x43ca23['destroy']()['then'](function(){_0x46cc46[_0xc6d4('0x14')](0xcc)[_0xc6d4('0x1f')]();});}};}function handleEntityNotFound(_0x3e0cce,_0x49a45c){return function(_0x1da83e){if(!_0x1da83e){_0x3e0cce[_0xc6d4('0x13')](0x194);}return _0x1da83e;};}function handleError(_0x5b8c26,_0x2fd3ef){_0x2fd3ef=_0x2fd3ef||0x1f4;return function(_0x41e3a7){logger[_0xc6d4('0x20')](_0x41e3a7[_0xc6d4('0x21')]);if(_0x41e3a7[_0xc6d4('0x22')]){delete _0x41e3a7[_0xc6d4('0x22')];}_0x5b8c26[_0xc6d4('0x14')](_0x2fd3ef)[_0xc6d4('0x23')](_0x41e3a7);};}exports[_0xc6d4('0x24')]=function(_0x972f50,_0x24e8fe){var _0x3237a5={},_0x58bba1={},_0x3aef62={'count':0x0,'rows':[]};var _0x1d4ecb=_[_0xc6d4('0x25')](db[_0xc6d4('0x26')][_0xc6d4('0x27')],function(_0x499556){return{'name':_0x499556[_0xc6d4('0x28')],'type':_0x499556[_0xc6d4('0x29')][_0xc6d4('0x2a')]};});_0x58bba1[_0xc6d4('0x2b')]=_['differenceBy'](_['map'](_0x1d4ecb,_0xc6d4('0x22')),[_0xc6d4('0x22')]);_0x58bba1[_0xc6d4('0x2c')]=_[_0xc6d4('0x2d')](_0x972f50[_0xc6d4('0x2c')]);_0x58bba1[_0xc6d4('0x2e')]=_[_0xc6d4('0x2f')](_0x58bba1['model'],_0x58bba1[_0xc6d4('0x2c')]);_0x3237a5['attributes']=_['intersection'](_0x58bba1['model'],qs['fields'](_0x972f50[_0xc6d4('0x2c')]['fields']));_0x3237a5[_0xc6d4('0x30')]=_0x3237a5[_0xc6d4('0x30')][_0xc6d4('0x31')]?_0x3237a5[_0xc6d4('0x30')]:_0x58bba1['model'];if(!_0x972f50[_0xc6d4('0x2c')][_0xc6d4('0x32')](_0xc6d4('0x33'))){_0x3237a5[_0xc6d4('0x18')]=qs[_0xc6d4('0x18')](_0x972f50[_0xc6d4('0x2c')][_0xc6d4('0x18')]);_0x3237a5['offset']=qs['offset'](_0x972f50['query'][_0xc6d4('0x16')]);}_0x3237a5[_0xc6d4('0x34')]=qs['sort'](_0x972f50['query']['sort']);_0x3237a5[_0xc6d4('0x35')]=qs['filters'](_['pick'](_0x972f50[_0xc6d4('0x2c')],_0x58bba1[_0xc6d4('0x2e')]),_0x1d4ecb);if(_0x972f50[_0xc6d4('0x2c')][_0xc6d4('0x36')]){_0x3237a5[_0xc6d4('0x35')]=_[_0xc6d4('0x37')](_0x3237a5[_0xc6d4('0x35')],{'$or':_['map'](_0x1d4ecb,function(_0x15cb8f){if(_0x15cb8f['type']!==_0xc6d4('0x38')){var _0x540724={};_0x540724[_0x15cb8f[_0xc6d4('0x22')]]={'$like':'%'+_0x972f50[_0xc6d4('0x2c')][_0xc6d4('0x36')]+'%'};return _0x540724;}})});}_0x3237a5=_['merge']({},_0x3237a5,_0x972f50[_0xc6d4('0x39')]);var _0xcf93fc={'where':_0x3237a5['where']};return db[_0xc6d4('0x26')][_0xc6d4('0x19')](_0xcf93fc)[_0xc6d4('0x3a')](function(_0x4c1aaf){_0x3aef62['count']=_0x4c1aaf;if(_0x972f50[_0xc6d4('0x2c')][_0xc6d4('0x3b')]){_0x3237a5[_0xc6d4('0x3c')]=[{'all':!![]}];}return db[_0xc6d4('0x26')][_0xc6d4('0x3d')](_0x3237a5);})[_0xc6d4('0x3a')](function(_0x196a31){_0x3aef62[_0xc6d4('0x3e')]=_0x196a31;return _0x3aef62;})[_0xc6d4('0x3a')](respondWithFilteredResult(_0x24e8fe,_0x3237a5))['catch'](handleError(_0x24e8fe,null));};exports['show']=function(_0x1589dc,_0x195752){var _0x3c1ed9={'raw':!![],'where':{'id':_0x1589dc[_0xc6d4('0x3f')]['id']}},_0x2eadcd={};_0x2eadcd[_0xc6d4('0x2b')]=_['keys'](db[_0xc6d4('0x26')]['rawAttributes']);_0x2eadcd[_0xc6d4('0x2c')]=_[_0xc6d4('0x2d')](_0x1589dc[_0xc6d4('0x2c')]);_0x2eadcd[_0xc6d4('0x2e')]=_[_0xc6d4('0x2f')](_0x2eadcd[_0xc6d4('0x2b')],_0x2eadcd[_0xc6d4('0x2c')]);_0x3c1ed9[_0xc6d4('0x30')]=_['intersection'](_0x2eadcd[_0xc6d4('0x2b')],qs['fields'](_0x1589dc['query'][_0xc6d4('0x40')]));_0x3c1ed9[_0xc6d4('0x30')]=_0x3c1ed9[_0xc6d4('0x30')][_0xc6d4('0x31')]?_0x3c1ed9[_0xc6d4('0x30')]:_0x2eadcd[_0xc6d4('0x2b')];if(_0x1589dc[_0xc6d4('0x2c')][_0xc6d4('0x3b')]){_0x3c1ed9[_0xc6d4('0x3c')]=[{'all':!![]}];}_0x3c1ed9=_[_0xc6d4('0x37')]({},_0x3c1ed9,_0x1589dc[_0xc6d4('0x39')]);return db[_0xc6d4('0x26')][_0xc6d4('0x41')](_0x3c1ed9)[_0xc6d4('0x3a')](handleEntityNotFound(_0x195752,null))[_0xc6d4('0x3a')](respondWithResult(_0x195752,null))[_0xc6d4('0x42')](handleError(_0x195752,null));};exports[_0xc6d4('0x1e')]=function(_0x557556,_0x3ae7d8){if(_0x557556[_0xc6d4('0x43')]['id']){delete _0x557556[_0xc6d4('0x43')]['id'];}return db['CmCustomField'][_0xc6d4('0x41')]({'where':{'id':_0x557556[_0xc6d4('0x3f')]['id']}})[_0xc6d4('0x3a')](handleEntityNotFound(_0x3ae7d8,null))[_0xc6d4('0x3a')](saveUpdates(_0x557556[_0xc6d4('0x43')],null))[_0xc6d4('0x3a')](respondWithResult(_0x3ae7d8,null))['catch'](handleError(_0x3ae7d8,null));};exports[_0xc6d4('0x44')]=function(_0x59d44b,_0xe7e63a){return db[_0xc6d4('0x26')][_0xc6d4('0x41')]({'where':{'id':_0x59d44b[_0xc6d4('0x3f')]['id']}})[_0xc6d4('0x3a')](handleEntityNotFound(_0xe7e63a,null))[_0xc6d4('0x3a')](removeEntity(_0xe7e63a,null))[_0xc6d4('0x42')](handleError(_0xe7e63a,null));};exports[_0xc6d4('0x45')]=function(_0x58235c,_0x187664){var _0x559391;return db['sequelize'][_0xc6d4('0x46')](function(_0x46c8aa){return db[_0xc6d4('0x26')][_0xc6d4('0x45')](_0x58235c[_0xc6d4('0x43')],{'transaction':_0x46c8aa})['then'](function(_0xfc12cd){_0x559391=_0xfc12cd;var _0x2a4c3b={'type':db['Sequelize'][_0xc6d4('0x47')],'transaction':_0x46c8aa};switch(_0x58235c[_0xc6d4('0x43')][_0xc6d4('0x29')]){case _0xc6d4('0x48'):_0x2a4c3b[_0xc6d4('0x29')]=db[_0xc6d4('0x49')][_0xc6d4('0x47')];break;case _0xc6d4('0x4a'):_0x2a4c3b['type']=db[_0xc6d4('0x49')][_0xc6d4('0x4b')];break;case _0xc6d4('0x4c'):_0x2a4c3b['type']=db[_0xc6d4('0x49')][_0xc6d4('0x4d')];_0x2a4c3b[_0xc6d4('0x4e')]=![];break;default:}return db[_0xc6d4('0x4f')]['queryInterface'][_0xc6d4('0x50')](_0xc6d4('0x51'),util['format'](_0xc6d4('0x52'),_0x559391['id']),_0x2a4c3b);})[_0xc6d4('0x3a')](function(){return _0x559391;});})[_0xc6d4('0x3a')](respondWithResult(_0x187664,0xc9))[_0xc6d4('0x42')](handleError(_0x187664,null));}; \ No newline at end of file +var _0x8cc7=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','status','send','CmCustomField','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','count','includeAll','findAll','catch','show','params','keys','length','include','options','find','body','create','sequelize','transaction','TEXT','text','number','Sequelize','BOOLEAN','defaultValue','addColumn','cm_contacts','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8cc7,0x1f1));var _0x78cc=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x8cc7[_0x2b10c6];return _0x3789d2;};'use strict';var emlformat=require(_0x78cc('0x0'));var rimraf=require(_0x78cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x78cc('0x2'));var moment=require(_0x78cc('0x3'));var BPromise=require(_0x78cc('0x4'));var Mustache=require(_0x78cc('0x5'));var util=require(_0x78cc('0x6'));var path=require(_0x78cc('0x7'));var sox=require(_0x78cc('0x8'));var csv=require(_0x78cc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78cc('0xa'));var _=require(_0x78cc('0xb'));var squel=require(_0x78cc('0xc'));var crypto=require(_0x78cc('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x78cc('0xe'));var toCsv=require(_0x78cc('0x9'));var querystring=require(_0x78cc('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x78cc('0x10'));var qs=require(_0x78cc('0x11'));var as=require(_0x78cc('0x12'));var hardwareService=require(_0x78cc('0x13'));var logger=require(_0x78cc('0x14'))(_0x78cc('0x15'));var utils=require(_0x78cc('0x16'));var config=require(_0x78cc('0x17'));var licenseUtil=require(_0x78cc('0x18'));var db=require(_0x78cc('0x19'))['db'];function respondWithStatusCode(_0x3dae4,_0x462dd5){_0x462dd5=_0x462dd5||0xcc;return function(_0x531547){if(_0x531547){return _0x3dae4[_0x78cc('0x1a')](_0x462dd5);}return _0x3dae4['status'](_0x462dd5)[_0x78cc('0x1b')]();};}function respondWithResult(_0xb0485,_0x1ca23c){_0x1ca23c=_0x1ca23c||0xc8;return function(_0x37e8d5){if(_0x37e8d5){return _0xb0485['status'](_0x1ca23c)['json'](_0x37e8d5);}};}function respondWithFilteredResult(_0x4b027c,_0x449274){return function(_0x430c92){if(_0x430c92){var _0x39a3bf=typeof _0x449274[_0x78cc('0x1c')]===_0x78cc('0x1d')&&typeof _0x449274['limit']===_0x78cc('0x1d');var _0x5f1360=_0x430c92['count'];var _0x59f29e=_0x39a3bf?0x0:_0x449274[_0x78cc('0x1c')];var _0x4c299d=_0x39a3bf?_0x430c92['count']:_0x449274[_0x78cc('0x1c')]+_0x449274[_0x78cc('0x1e')];var _0x19356f;if(_0x4c299d>=_0x5f1360){_0x4c299d=_0x5f1360;_0x19356f=0xc8;}else{_0x19356f=0xce;}_0x4b027c['status'](_0x19356f);return _0x4b027c[_0x78cc('0x1f')](_0x78cc('0x20'),_0x59f29e+'-'+_0x4c299d+'/'+_0x5f1360)[_0x78cc('0x21')](_0x430c92);}return null;};}function patchUpdates(_0x3db205){return function(_0xed3e71){try{jsonpatch[_0x78cc('0x22')](_0xed3e71,_0x3db205,!![]);}catch(_0x31e1dc){return BPromise['reject'](_0x31e1dc);}return _0xed3e71[_0x78cc('0x23')]();};}function saveUpdates(_0x55eed9,_0x1f8687){return function(_0x560d49){if(_0x560d49){return _0x560d49[_0x78cc('0x24')](_0x55eed9)['then'](function(_0x37ebe5){return _0x37ebe5;});}return null;};}function removeEntity(_0x32b57f,_0x3c22be){return function(_0x2c6216){if(_0x2c6216){return _0x2c6216[_0x78cc('0x25')]()[_0x78cc('0x26')](function(){_0x32b57f['status'](0xcc)[_0x78cc('0x1b')]();});}};}function handleEntityNotFound(_0x2f1dd5,_0x56867b){return function(_0x4d78f5){if(!_0x4d78f5){_0x2f1dd5['sendStatus'](0x194);}return _0x4d78f5;};}function handleError(_0x11bcb2,_0x439e50){_0x439e50=_0x439e50||0x1f4;return function(_0x4bfe9e){logger[_0x78cc('0x27')](_0x4bfe9e[_0x78cc('0x28')]);if(_0x4bfe9e['name']){delete _0x4bfe9e[_0x78cc('0x29')];}_0x11bcb2[_0x78cc('0x2a')](_0x439e50)[_0x78cc('0x2b')](_0x4bfe9e);};}exports['index']=function(_0xf40f13,_0x536cfd){var _0x4059a3={},_0x152fe5={},_0x2fc5c2={'count':0x0,'rows':[]};var _0x56596f=_['map'](db[_0x78cc('0x2c')][_0x78cc('0x2d')],function(_0x2e9dca){return{'name':_0x2e9dca['fieldName'],'type':_0x2e9dca['type'][_0x78cc('0x2e')]};});_0x152fe5[_0x78cc('0x2f')]=_['differenceBy'](_[_0x78cc('0x30')](_0x56596f,'name'),['name']);_0x152fe5['query']=_['keys'](_0xf40f13[_0x78cc('0x31')]);_0x152fe5[_0x78cc('0x32')]=_[_0x78cc('0x33')](_0x152fe5[_0x78cc('0x2f')],_0x152fe5[_0x78cc('0x31')]);_0x4059a3[_0x78cc('0x34')]=_[_0x78cc('0x33')](_0x152fe5[_0x78cc('0x2f')],qs['fields'](_0xf40f13[_0x78cc('0x31')][_0x78cc('0x35')]));_0x4059a3['attributes']=_0x4059a3[_0x78cc('0x34')]['length']?_0x4059a3[_0x78cc('0x34')]:_0x152fe5[_0x78cc('0x2f')];if(!_0xf40f13[_0x78cc('0x31')][_0x78cc('0x36')](_0x78cc('0x37'))){_0x4059a3[_0x78cc('0x1e')]=qs[_0x78cc('0x1e')](_0xf40f13['query'][_0x78cc('0x1e')]);_0x4059a3[_0x78cc('0x1c')]=qs[_0x78cc('0x1c')](_0xf40f13[_0x78cc('0x31')]['offset']);}_0x4059a3[_0x78cc('0x38')]=qs[_0x78cc('0x39')](_0xf40f13[_0x78cc('0x31')][_0x78cc('0x39')]);_0x4059a3[_0x78cc('0x3a')]=qs['filters'](_[_0x78cc('0x3b')](_0xf40f13[_0x78cc('0x31')],_0x152fe5[_0x78cc('0x32')]),_0x56596f);if(_0xf40f13[_0x78cc('0x31')][_0x78cc('0x3c')]){_0x4059a3[_0x78cc('0x3a')]=_[_0x78cc('0x3d')](_0x4059a3[_0x78cc('0x3a')],{'$or':_[_0x78cc('0x30')](_0x56596f,function(_0x4d2bb2){if(_0x4d2bb2[_0x78cc('0x3e')]!=='VIRTUAL'){var _0x3e4275={};_0x3e4275[_0x4d2bb2[_0x78cc('0x29')]]={'$like':'%'+_0xf40f13[_0x78cc('0x31')]['filter']+'%'};return _0x3e4275;}})});}_0x4059a3=_[_0x78cc('0x3d')]({},_0x4059a3,_0xf40f13['options']);var _0x3d1e79={'where':_0x4059a3[_0x78cc('0x3a')]};return db[_0x78cc('0x2c')][_0x78cc('0x3f')](_0x3d1e79)[_0x78cc('0x26')](function(_0x313261){_0x2fc5c2[_0x78cc('0x3f')]=_0x313261;if(_0xf40f13[_0x78cc('0x31')][_0x78cc('0x40')]){_0x4059a3['include']=[{'all':!![]}];}return db[_0x78cc('0x2c')][_0x78cc('0x41')](_0x4059a3);})[_0x78cc('0x26')](function(_0x34b498){_0x2fc5c2['rows']=_0x34b498;return _0x2fc5c2;})['then'](respondWithFilteredResult(_0x536cfd,_0x4059a3))[_0x78cc('0x42')](handleError(_0x536cfd,null));};exports[_0x78cc('0x43')]=function(_0x1fc4ef,_0x5694f9){var _0x4775ed={'raw':!![],'where':{'id':_0x1fc4ef[_0x78cc('0x44')]['id']}},_0x5a3ffb={};_0x5a3ffb[_0x78cc('0x2f')]=_[_0x78cc('0x45')](db[_0x78cc('0x2c')][_0x78cc('0x2d')]);_0x5a3ffb[_0x78cc('0x31')]=_['keys'](_0x1fc4ef[_0x78cc('0x31')]);_0x5a3ffb[_0x78cc('0x32')]=_[_0x78cc('0x33')](_0x5a3ffb[_0x78cc('0x2f')],_0x5a3ffb[_0x78cc('0x31')]);_0x4775ed[_0x78cc('0x34')]=_[_0x78cc('0x33')](_0x5a3ffb['model'],qs[_0x78cc('0x35')](_0x1fc4ef[_0x78cc('0x31')][_0x78cc('0x35')]));_0x4775ed['attributes']=_0x4775ed[_0x78cc('0x34')][_0x78cc('0x46')]?_0x4775ed[_0x78cc('0x34')]:_0x5a3ffb[_0x78cc('0x2f')];if(_0x1fc4ef['query'][_0x78cc('0x40')]){_0x4775ed[_0x78cc('0x47')]=[{'all':!![]}];}_0x4775ed=_[_0x78cc('0x3d')]({},_0x4775ed,_0x1fc4ef[_0x78cc('0x48')]);return db[_0x78cc('0x2c')][_0x78cc('0x49')](_0x4775ed)[_0x78cc('0x26')](handleEntityNotFound(_0x5694f9,null))['then'](respondWithResult(_0x5694f9,null))[_0x78cc('0x42')](handleError(_0x5694f9,null));};exports[_0x78cc('0x24')]=function(_0x74f1d1,_0x53bbd0){if(_0x74f1d1['body']['id']){delete _0x74f1d1[_0x78cc('0x4a')]['id'];}return db[_0x78cc('0x2c')]['find']({'where':{'id':_0x74f1d1[_0x78cc('0x44')]['id']}})['then'](handleEntityNotFound(_0x53bbd0,null))[_0x78cc('0x26')](saveUpdates(_0x74f1d1[_0x78cc('0x4a')],null))[_0x78cc('0x26')](respondWithResult(_0x53bbd0,null))['catch'](handleError(_0x53bbd0,null));};exports[_0x78cc('0x25')]=function(_0x162f09,_0x4c3e55){return db[_0x78cc('0x2c')][_0x78cc('0x49')]({'where':{'id':_0x162f09[_0x78cc('0x44')]['id']}})[_0x78cc('0x26')](handleEntityNotFound(_0x4c3e55,null))[_0x78cc('0x26')](removeEntity(_0x4c3e55,null))['catch'](handleError(_0x4c3e55,null));};exports[_0x78cc('0x4b')]=function(_0x26cbad,_0x312596){var _0x1df2bd;return db[_0x78cc('0x4c')][_0x78cc('0x4d')](function(_0x17a670){return db['CmCustomField'][_0x78cc('0x4b')](_0x26cbad['body'],{'transaction':_0x17a670})[_0x78cc('0x26')](function(_0xaf9a90){_0x1df2bd=_0xaf9a90;var _0x418825={'type':db['Sequelize'][_0x78cc('0x4e')],'transaction':_0x17a670};switch(_0x26cbad[_0x78cc('0x4a')][_0x78cc('0x3e')]){case _0x78cc('0x4f'):_0x418825[_0x78cc('0x3e')]=db['Sequelize']['TEXT'];break;case _0x78cc('0x50'):_0x418825[_0x78cc('0x3e')]=db[_0x78cc('0x51')]['INTEGER'];break;case'switch':_0x418825['type']=db['Sequelize'][_0x78cc('0x52')];_0x418825[_0x78cc('0x53')]=![];break;default:}return db[_0x78cc('0x4c')]['queryInterface'][_0x78cc('0x54')](_0x78cc('0x55'),util['format']('cf_%d',_0x1df2bd['id']),_0x418825);})[_0x78cc('0x26')](function(){return _0x1df2bd;});})[_0x78cc('0x26')](respondWithResult(_0x312596,0xc9))[_0x78cc('0x42')](handleError(_0x312596,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 78fb2bf..dcabb00 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 _0x809c=['api','moment','bluebird','request-promise','path','rimraf','./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x809c,0x15a));var _0xc809=function(_0x256fb7,_0x4150de){_0x256fb7=_0x256fb7-0x0;var _0x401c7b=_0x809c[_0x256fb7];return _0x401c7b;};'use strict';var _=require('lodash');var util=require(_0xc809('0x0'));var logger=require(_0xc809('0x1'))(_0xc809('0x2'));var moment=require(_0xc809('0x3'));var BPromise=require(_0xc809('0x4'));var rp=require(_0xc809('0x5'));var fs=require('fs');var path=require(_0xc809('0x6'));var rimraf=require(_0xc809('0x7'));var config=require('../../config/environment');var attributes=require(_0xc809('0x8'));module[_0xc809('0x9')]=function(_0xf6533b,_0x17395b){return _0xf6533b['define'](_0xc809('0xa'),attributes,{'tableName':_0xc809('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbc7=['exports','define','CmCustomField','cm_custom_fields','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes'];(function(_0x5e8672,_0x234cdf){var _0x3d1049=function(_0x3f7a9b){while(--_0x3f7a9b){_0x5e8672['push'](_0x5e8672['shift']());}};_0x3d1049(++_0x234cdf);}(_0xdbc7,0x1c0));var _0x7dbc=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xdbc7[_0x263a74];return _0x2aa86c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7dbc('0x0'))(_0x7dbc('0x1'));var moment=require(_0x7dbc('0x2'));var BPromise=require(_0x7dbc('0x3'));var rp=require(_0x7dbc('0x4'));var fs=require('fs');var path=require(_0x7dbc('0x5'));var rimraf=require('rimraf');var config=require(_0x7dbc('0x6'));var attributes=require(_0x7dbc('0x7'));module[_0x7dbc('0x8')]=function(_0x34448a,_0x4dd284){return _0x34448a[_0x7dbc('0x9')](_0x7dbc('0xa'),attributes,{'tableName':_0x7dbc('0xb'),'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 f9dc05e..824d3d0 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 _0x3c79=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x311608,_0x74a560){var _0x44542d=function(_0x242c05){while(--_0x242c05){_0x311608['push'](_0x311608['shift']());}};_0x44542d(++_0x74a560);}(_0x3c79,0xff));var _0x93c7=function(_0x3aea93,_0x2cd9fe){_0x3aea93=_0x3aea93-0x0;var _0x12bfa1=_0x3c79[_0x3aea93];return _0x12bfa1;};'use strict';var _=require(_0x93c7('0x0'));var util=require('util');var moment=require(_0x93c7('0x1'));var BPromise=require(_0x93c7('0x2'));var rs=require(_0x93c7('0x3'));var fs=require('fs');var Redis=require(_0x93c7('0x4'));var db=require(_0x93c7('0x5'))['db'];var utils=require(_0x93c7('0x6'));var logger=require(_0x93c7('0x7'))(_0x93c7('0x8'));var config=require(_0x93c7('0x9'));var jayson=require(_0x93c7('0xa'));var client=jayson[_0x93c7('0xb')][_0x93c7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xde206b,_0x2619ec,_0x4b1768){return new BPromise(function(_0x576ad9,_0x2961e5){return client['request'](_0xde206b,_0x4b1768)['then'](function(_0x21d058){logger['info'](_0x93c7('0xd'),_0x2619ec,_0x93c7('0xe'));logger[_0x93c7('0xf')](_0x93c7('0x10'),_0x2619ec,'request\x20sent',JSON[_0x93c7('0x11')](_0x21d058));if(_0x21d058[_0x93c7('0x12')]){if(_0x21d058[_0x93c7('0x12')][_0x93c7('0x13')]===0x1f4){logger[_0x93c7('0x12')](_0x93c7('0xd'),_0x2619ec,_0x21d058[_0x93c7('0x12')]['message']);return _0x2961e5(_0x21d058['error']['message']);}logger[_0x93c7('0x12')](_0x93c7('0xd'),_0x2619ec,_0x21d058[_0x93c7('0x12')]['message']);return _0x576ad9(_0x21d058[_0x93c7('0x12')][_0x93c7('0x14')]);}else{logger['info'](_0x93c7('0xd'),_0x2619ec,_0x93c7('0xe'));_0x576ad9(_0x21d058[_0x93c7('0x15')][_0x93c7('0x14')]);}})[_0x93c7('0x16')](function(_0x4a013f){logger[_0x93c7('0x12')](_0x93c7('0xd'),_0x2619ec,_0x4a013f);_0x2961e5(_0x4a013f);});});} \ No newline at end of file +var _0x6fb8=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','http','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5c066c,_0x5a976b){var _0x145657=function(_0x4bd50b){while(--_0x4bd50b){_0x5c066c['push'](_0x5c066c['shift']());}};_0x145657(++_0x5a976b);}(_0x6fb8,0x82));var _0x86fb=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x6fb8[_0x59d89e];return _0x554e93;};'use strict';var _=require(_0x86fb('0x0'));var util=require(_0x86fb('0x1'));var moment=require('moment');var BPromise=require(_0x86fb('0x2'));var rs=require(_0x86fb('0x3'));var fs=require('fs');var Redis=require(_0x86fb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x86fb('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x86fb('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x57d7f4,_0x232f6f,_0x1d4de8){return new BPromise(function(_0x237c46,_0x224a5a){return client['request'](_0x57d7f4,_0x1d4de8)['then'](function(_0x12716e){logger[_0x86fb('0x7')](_0x86fb('0x8'),_0x232f6f,_0x86fb('0x9'));logger[_0x86fb('0xa')](_0x86fb('0xb'),_0x232f6f,_0x86fb('0x9'),JSON[_0x86fb('0xc')](_0x12716e));if(_0x12716e['error']){if(_0x12716e[_0x86fb('0xd')][_0x86fb('0xe')]===0x1f4){logger[_0x86fb('0xd')](_0x86fb('0x8'),_0x232f6f,_0x12716e['error'][_0x86fb('0xf')]);return _0x224a5a(_0x12716e['error'][_0x86fb('0xf')]);}logger['error'](_0x86fb('0x8'),_0x232f6f,_0x12716e[_0x86fb('0xd')]['message']);return _0x237c46(_0x12716e[_0x86fb('0xd')][_0x86fb('0xf')]);}else{logger[_0x86fb('0x7')]('CmCustomField,\x20%s,\x20%s',_0x232f6f,'request\x20sent');_0x237c46(_0x12716e[_0x86fb('0x10')][_0x86fb('0xf')]);}})[_0x86fb('0x11')](function(_0x235e03){logger['error'](_0x86fb('0x8'),_0x232f6f,_0x235e03);_0x224a5a(_0x235e03);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 01b4fc6..7cc6f78 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 _0xdf3b=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','create','update'];(function(_0x390f35,_0x3a7e7b){var _0x43a987=function(_0x114678){while(--_0x114678){_0x390f35['push'](_0x390f35['shift']());}};_0x43a987(++_0x3a7e7b);}(_0xdf3b,0x172));var _0xbdf3=function(_0x4d821c,_0x22bd0e){_0x4d821c=_0x4d821c-0x0;var _0x15dd5b=_0xdf3b[_0x4d821c];return _0x15dd5b;};'use strict';var multer=require('multer');var util=require(_0xbdf3('0x0'));var path=require('path');var timeout=require(_0xbdf3('0x1'));var express=require(_0xbdf3('0x2'));var router=express[_0xbdf3('0x3')]();var fs_extra=require(_0xbdf3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbdf3('0x5'));var config=require(_0xbdf3('0x6'));var controller=require(_0xbdf3('0x7'));router[_0xbdf3('0x8')]('/',auth[_0xbdf3('0x9')](),controller[_0xbdf3('0xa')]);router[_0xbdf3('0x8')](_0xbdf3('0xb'),auth[_0xbdf3('0x9')](),controller['show']);router['post']('/',auth[_0xbdf3('0x9')](),controller[_0xbdf3('0xc')]);router['put'](_0xbdf3('0xb'),auth[_0xbdf3('0x9')](),controller[_0xbdf3('0xd')]);router['delete'](_0xbdf3('0xb'),auth[_0xbdf3('0x9')](),controller[_0xbdf3('0xe')]);module[_0xbdf3('0xf')]=router; \ No newline at end of file +var _0x90b5=['/:id','show','post','create','put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x5b93f2,_0x32b14c){var _0x4b0d81=function(_0x21ff56){while(--_0x21ff56){_0x5b93f2['push'](_0x5b93f2['shift']());}};_0x4b0d81(++_0x32b14c);}(_0x90b5,0x139));var _0x590b=function(_0x5be7f3,_0x4e583a){_0x5be7f3=_0x5be7f3-0x0;var _0x330c10=_0x90b5[_0x5be7f3];return _0x330c10;};'use strict';var multer=require(_0x590b('0x0'));var util=require('util');var path=require(_0x590b('0x1'));var timeout=require(_0x590b('0x2'));var express=require(_0x590b('0x3'));var router=express[_0x590b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x590b('0x5'));var config=require(_0x590b('0x6'));var controller=require('./cmCustomField.controller');router[_0x590b('0x7')]('/',auth[_0x590b('0x8')](),controller[_0x590b('0x9')]);router['get'](_0x590b('0xa'),auth[_0x590b('0x8')](),controller[_0x590b('0xb')]);router[_0x590b('0xc')]('/',auth[_0x590b('0x8')](),controller[_0x590b('0xd')]);router[_0x590b('0xe')](_0x590b('0xa'),auth[_0x590b('0x8')](),controller['update']);router[_0x590b('0xf')](_0x590b('0xa'),auth['isAuthenticated'](),controller[_0x590b('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index f0f3503..0d669f9 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 _0x7e65=['contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE','INTEGER','UNSIGNED'];(function(_0x15ca1a,_0x30fc82){var _0x507626=function(_0x14c9bc){while(--_0x14c9bc){_0x15ca1a['push'](_0x15ca1a['shift']());}};_0x507626(++_0x30fc82);}(_0x7e65,0xc9));var _0x57e6=function(_0x510f22,_0x391e2d){_0x510f22=_0x510f22-0x0;var _0x131834=_0x7e65[_0x510f22];return _0x131834;};'use strict';var moment=require(_0x57e6('0x0'));var Sequelize=require(_0x57e6('0x1'));module['exports']={'phone':{'type':Sequelize[_0x57e6('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x57e6('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x57e6('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x57e6('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x57e6('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x57e6('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x57e6('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x57e6('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x57e6('0x4')]},'priority':{'type':Sequelize[_0x57e6('0x5')](0x2)[_0x57e6('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x57e6('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x57e6('0x5')],'unique':_0x57e6('0x7')},'ListId':{'type':Sequelize[_0x57e6('0x5')],'unique':_0x57e6('0x7')},'UserId':{'type':Sequelize[_0x57e6('0x5')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x57e6('0x7')},'CampaignId':{'type':Sequelize[_0x57e6('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x57e6('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x57e6('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x57e6('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x57e6('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0x65af=['exports','STRING','BOOLEAN','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','sequelize'];(function(_0x3d3891,_0x163ab5){var _0x1a5477=function(_0x30dda2){while(--_0x30dda2){_0x3d3891['push'](_0x3d3891['shift']());}};_0x1a5477(++_0x163ab5);}(_0x65af,0xfb));var _0xf65a=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x65af[_0x369151];return _0x4292d5;};'use strict';var moment=require(_0xf65a('0x0'));var Sequelize=require(_0xf65a('0x1'));module[_0xf65a('0x2')]={'phone':{'type':Sequelize[_0xf65a('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xf65a('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xf65a('0x5')],'defaultValue':moment()[_0xf65a('0x6')](_0xf65a('0x7'))},'countbusyretry':{'type':Sequelize[_0xf65a('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf65a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf65a('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xf65a('0x9')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf65a('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xf65a('0x8')],'unique':_0xf65a('0xa')},'ListId':{'type':Sequelize[_0xf65a('0x8')],'unique':_0xf65a('0xa')},'UserId':{'type':Sequelize[_0xf65a('0x8')]},'VoiceQueueId':{'type':Sequelize[_0xf65a('0x8')],'unique':_0xf65a('0xa')},'CampaignId':{'type':Sequelize[_0xf65a('0x8')]},'countnosuchnumberretry':{'type':Sequelize[_0xf65a('0x8')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf65a('0x8')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xf65a('0x8')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 1edc21d..d787db4 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 _0xda66=['hopperIds','scheduledAt','findOne','UPDATE','CmContact','Contact','CmCompany','CmList','List','VoiceQueue','Queue','dialActive','getOpenContacts','getVoiceQueues','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','model','keys','query','intersection','filters','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$between','$in','$notIn','$iLike','$like','$contained','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','include','findAll','then','params','includeAll','find','catch','create','body','describe','VoiceQueueId','Campaign','CampaignId','dataValues','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','format','calleridnum','phone','campaigntype','ivr','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','preview','dialOrderByScheduledAt','sequelize','transaction','YYYY-MM-DD\x20HH:mm:ss','prev','isEmpty','priority','ASC','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xda66,0x1c8));var _0x6da6=function(_0x48a80d,_0x1b2aaf){_0x48a80d=_0x48a80d-0x0;var _0x267bcb=_0xda66[_0x48a80d];return _0x267bcb;};'use strict';var emlformat=require(_0x6da6('0x0'));var rimraf=require(_0x6da6('0x1'));var zipdir=require(_0x6da6('0x2'));var jsonpatch=require(_0x6da6('0x3'));var rp=require(_0x6da6('0x4'));var moment=require(_0x6da6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6da6('0x6'));var util=require(_0x6da6('0x7'));var path=require('path');var sox=require(_0x6da6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6da6('0x9'));var _=require(_0x6da6('0xa'));var squel=require(_0x6da6('0xb'));var crypto=require(_0x6da6('0xc'));var jsforce=require(_0x6da6('0xd'));var deskjs=require(_0x6da6('0xe'));var toCsv=require(_0x6da6('0xf'));var querystring=require(_0x6da6('0x10'));var Papa=require(_0x6da6('0x11'));var Redis=require(_0x6da6('0x12'));var authService=require(_0x6da6('0x13'));var qs=require(_0x6da6('0x14'));var as=require(_0x6da6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6da6('0x16'));var utils=require(_0x6da6('0x17'));var config=require(_0x6da6('0x18'));var licenseUtil=require(_0x6da6('0x19'));var db=require(_0x6da6('0x1a'))['db'];function respondWithStatusCode(_0x32dd4e,_0x555eca){_0x555eca=_0x555eca||0xcc;return function(_0x3fa4b2){if(_0x3fa4b2){return _0x32dd4e[_0x6da6('0x1b')](_0x555eca);}return _0x32dd4e[_0x6da6('0x1c')](_0x555eca)['end']();};}function respondWithResult(_0x180726,_0x4dfa87){_0x4dfa87=_0x4dfa87||0xc8;return function(_0x581435){if(_0x581435){return _0x180726[_0x6da6('0x1c')](_0x4dfa87)[_0x6da6('0x1d')](_0x581435);}};}function respondWithFilteredResult(_0x3b7b01,_0x1fbd1a){return function(_0x395556){if(_0x395556){var _0x457030=typeof _0x1fbd1a[_0x6da6('0x1e')]===_0x6da6('0x1f')&&typeof _0x1fbd1a[_0x6da6('0x20')]===_0x6da6('0x1f');var _0x435df2=_0x395556['count'];var _0x249e91=_0x457030?0x0:_0x1fbd1a[_0x6da6('0x1e')];var _0x4dbc07=_0x457030?_0x395556[_0x6da6('0x21')]:_0x1fbd1a[_0x6da6('0x1e')]+_0x1fbd1a['limit'];var _0x10473d;if(_0x4dbc07>=_0x435df2){_0x4dbc07=_0x435df2;_0x10473d=0xc8;}else{_0x10473d=0xce;}_0x3b7b01[_0x6da6('0x1c')](_0x10473d);return _0x3b7b01[_0x6da6('0x22')](_0x6da6('0x23'),_0x249e91+'-'+_0x4dbc07+'/'+_0x435df2)[_0x6da6('0x1d')](_0x395556);}return null;};}function patchUpdates(_0x403cb0){return function(_0x18bc06){try{jsonpatch[_0x6da6('0x24')](_0x18bc06,_0x403cb0,!![]);}catch(_0x4a75e3){return BPromise[_0x6da6('0x25')](_0x4a75e3);}return _0x18bc06[_0x6da6('0x26')]();};}function saveUpdates(_0x3bc107,_0x47b574){return function(_0x360c5a){if(_0x360c5a){return _0x360c5a[_0x6da6('0x27')](_0x3bc107)['then'](function(_0x40452c){return _0x40452c;});}return null;};}function removeEntity(_0x392491,_0x259e56){return function(_0xfb3a2a){if(_0xfb3a2a){return _0xfb3a2a[_0x6da6('0x28')]()['then'](function(){_0x392491[_0x6da6('0x1c')](0xcc)[_0x6da6('0x29')]();});}};}function handleEntityNotFound(_0x54dfc6,_0x17251e){return function(_0x2610e9){if(!_0x2610e9){_0x54dfc6[_0x6da6('0x1b')](0x194);}return _0x2610e9;};}function handleError(_0x3d9709,_0x5819c2){_0x5819c2=_0x5819c2||0x1f4;return function(_0x346a1a){logger[_0x6da6('0x2a')](_0x346a1a[_0x6da6('0x2b')]);if(_0x346a1a[_0x6da6('0x2c')]){delete _0x346a1a[_0x6da6('0x2c')];}_0x3d9709['status'](_0x5819c2)[_0x6da6('0x2d')](_0x346a1a);};}exports[_0x6da6('0x2e')]=function(_0x20e221,_0x5909a1){var _0x1c7bc1={},_0x63cd6e={},_0x297262={'count':0x0,'rows':[]};var _0x1fdb04=_[_0x6da6('0x2f')](db[_0x6da6('0x30')][_0x6da6('0x31')],function(_0x58e0fb){return{'name':_0x58e0fb[_0x6da6('0x32')],'type':_0x58e0fb['type']['key']};});_0x63cd6e[_0x6da6('0x33')]=_['map'](_0x1fdb04,_0x6da6('0x2c'));_0x63cd6e['query']=_[_0x6da6('0x34')](_0x20e221[_0x6da6('0x35')]);_0x63cd6e['filters']=_[_0x6da6('0x36')](_0x63cd6e[_0x6da6('0x33')],_0x63cd6e['query']);_0x63cd6e[_0x6da6('0x37')]=_[_0x6da6('0x38')](_0x63cd6e['filters'],[_0x6da6('0x39'),_0x6da6('0x3a'),'$gt',_0x6da6('0x3b'),_0x6da6('0x3c'),_0x6da6('0x3d'),_0x6da6('0x3e'),_0x6da6('0x3f'),'$not',_0x6da6('0x40'),'$notBetween',_0x6da6('0x41'),_0x6da6('0x42'),'$like','$notLike',_0x6da6('0x43'),'$notILike',_0x6da6('0x44'),'$overlap','$contains',_0x6da6('0x45'),'$any']);_0x1c7bc1[_0x6da6('0x46')]=_[_0x6da6('0x36')](_0x63cd6e[_0x6da6('0x33')],qs[_0x6da6('0x47')](_0x20e221[_0x6da6('0x35')]['fields']));_0x1c7bc1['attributes']=_0x1c7bc1[_0x6da6('0x46')][_0x6da6('0x48')]?_0x1c7bc1['attributes']:_0x63cd6e[_0x6da6('0x33')];if(!_0x20e221['query'][_0x6da6('0x49')](_0x6da6('0x4a'))){_0x1c7bc1[_0x6da6('0x20')]=qs[_0x6da6('0x20')](_0x20e221['query'][_0x6da6('0x20')]);_0x1c7bc1[_0x6da6('0x1e')]=qs[_0x6da6('0x1e')](_0x20e221[_0x6da6('0x35')][_0x6da6('0x1e')]);}_0x1c7bc1[_0x6da6('0x4b')]=qs[_0x6da6('0x4c')](_0x20e221['query']['sort']);_0x1c7bc1[_0x6da6('0x4d')]=qs[_0x6da6('0x37')](_['pick'](_0x20e221[_0x6da6('0x35')],_0x63cd6e[_0x6da6('0x37')]),_0x1fdb04);if(_0x20e221['query'][_0x6da6('0x4e')]){_0x1c7bc1[_0x6da6('0x4d')]=_['merge'](_0x1c7bc1['where'],{'$or':_[_0x6da6('0x2f')](_0x1fdb04,function(_0x5179d8){if(_0x5179d8[_0x6da6('0x4f')]!==_0x6da6('0x50')){var _0x58acc4={};_0x58acc4[_0x5179d8[_0x6da6('0x2c')]]={'$like':'%'+_0x20e221[_0x6da6('0x35')][_0x6da6('0x4e')]+'%'};return _0x58acc4;}})});}_0x1c7bc1=_[_0x6da6('0x51')]({},_0x1c7bc1,_0x20e221[_0x6da6('0x52')]);var _0x48e84b={'where':_0x1c7bc1['where']};return db['CmHopper'][_0x6da6('0x21')](_0x48e84b)['then'](function(_0x1719c9){_0x297262[_0x6da6('0x21')]=_0x1719c9;if(_0x20e221['query']['includeAll']){_0x1c7bc1[_0x6da6('0x53')]=[{'all':!![]}];}return db[_0x6da6('0x30')][_0x6da6('0x54')](_0x1c7bc1);})[_0x6da6('0x55')](function(_0x447ef3){_0x297262['rows']=_0x447ef3;return _0x297262;})['then'](respondWithFilteredResult(_0x5909a1,_0x1c7bc1))['catch'](handleError(_0x5909a1,null));};exports['show']=function(_0x1859e2,_0x2186c0){var _0x244287={'raw':!![],'where':{'id':_0x1859e2[_0x6da6('0x56')]['id']}},_0x16d1ba={};_0x16d1ba['model']=_[_0x6da6('0x34')](db[_0x6da6('0x30')][_0x6da6('0x31')]);_0x16d1ba['query']=_['keys'](_0x1859e2[_0x6da6('0x35')]);_0x16d1ba[_0x6da6('0x37')]=_[_0x6da6('0x36')](_0x16d1ba[_0x6da6('0x33')],_0x16d1ba[_0x6da6('0x35')]);_0x244287[_0x6da6('0x46')]=_['intersection'](_0x16d1ba[_0x6da6('0x33')],qs[_0x6da6('0x47')](_0x1859e2[_0x6da6('0x35')][_0x6da6('0x47')]));_0x244287[_0x6da6('0x46')]=_0x244287['attributes'][_0x6da6('0x48')]?_0x244287['attributes']:_0x16d1ba[_0x6da6('0x33')];if(_0x1859e2[_0x6da6('0x35')][_0x6da6('0x57')]){_0x244287[_0x6da6('0x53')]=[{'all':!![]}];}_0x244287=_[_0x6da6('0x51')]({},_0x244287,_0x1859e2[_0x6da6('0x52')]);return db['CmHopper'][_0x6da6('0x58')](_0x244287)[_0x6da6('0x55')](handleEntityNotFound(_0x2186c0,null))['then'](respondWithResult(_0x2186c0,null))[_0x6da6('0x59')](handleError(_0x2186c0,null));};exports[_0x6da6('0x5a')]=function(_0x3fa094,_0x1fb6d6){return db[_0x6da6('0x30')][_0x6da6('0x5a')](_0x3fa094[_0x6da6('0x5b')],{})[_0x6da6('0x55')](respondWithResult(_0x1fb6d6,0xc9))[_0x6da6('0x59')](handleError(_0x1fb6d6,null));};exports[_0x6da6('0x27')]=function(_0xb6556e,_0xf66baa){if(_0xb6556e[_0x6da6('0x5b')]['id']){delete _0xb6556e['body']['id'];}return db['CmHopper']['find']({'where':{'id':_0xb6556e[_0x6da6('0x56')]['id']}})[_0x6da6('0x55')](handleEntityNotFound(_0xf66baa,null))['then'](saveUpdates(_0xb6556e[_0x6da6('0x5b')],null))[_0x6da6('0x55')](respondWithResult(_0xf66baa,null))[_0x6da6('0x59')](handleError(_0xf66baa,null));};exports[_0x6da6('0x5c')]=function(_0x4566d8,_0x387d3f){return db[_0x6da6('0x30')][_0x6da6('0x5c')]()['then'](respondWithResult(_0x387d3f,null))['catch'](handleError(_0x387d3f,null));};exports['destroy']=function(_0x31a67e,_0x4b9cb5){var _0x192f0e;return db[_0x6da6('0x30')][_0x6da6('0x58')]({'where':{'id':_0x31a67e['params']['id']}})[_0x6da6('0x55')](handleEntityNotFound(_0x4b9cb5,null))[_0x6da6('0x55')](function(_0x37388a){if(_0x37388a){return _0x37388a[_0x6da6('0x28')]()[_0x6da6('0x55')](function(_0x5bd5f6){return _0x5bd5f6;});}})[_0x6da6('0x55')](function(_0x2ad0e3){_0x192f0e=_0x2ad0e3;if(_0x2ad0e3){if(_0x2ad0e3[_0x6da6('0x5d')]||_0x2ad0e3['CampaignId']){return db[_0x2ad0e3['VoiceQueueId']?'VoiceQueue':_0x6da6('0x5e')][_0x6da6('0x58')]({'where':{'id':_0x2ad0e3[_0x6da6('0x5d')]?_0x2ad0e3[_0x6da6('0x5d')]:_0x2ad0e3[_0x6da6('0x5f')]},'attributes':['id',_0x6da6('0x2c')],'raw':!![]});}}})['then'](function(_0x572668){var _0x419fbb={};if(_0x572668){_[_0x6da6('0x51')](_0x419fbb,_['omit'](_0x192f0e[_0x6da6('0x60')],['createdAt',_0x6da6('0x61'),'id']));_0x419fbb[_0x6da6('0x62')]=0x15;_0x419fbb[_0x6da6('0x63')]=_0x6da6('0x64');_0x419fbb[_0x6da6('0x65')]=_0x572668[_0x6da6('0x2c')];_0x419fbb[_0x6da6('0x66')]=_0x31a67e[_0x6da6('0x67')][_0x6da6('0x2c')];_0x419fbb[_0x6da6('0x68')]=_0x31a67e[_0x6da6('0x67')]['id'];_0x419fbb[_0x6da6('0x64')]=!![];_0x419fbb['deletedat']=moment()[_0x6da6('0x69')]('YYYY-MM-DD\x20HH:mm:ss');_0x419fbb[_0x6da6('0x6a')]=_0x192f0e[_0x6da6('0x6b')];_0x419fbb[_0x6da6('0x6c')]=_0x192f0e[_0x6da6('0x5d')]?'queue':_0x6da6('0x6d');return db['CmContact']['find']({'where':{'id':_0x419fbb[_0x6da6('0x6e')]},'attributes':[_0x6da6('0x6f'),_0x6da6('0x70')]})[_0x6da6('0x55')](function(_0x2ae1af){if(!_[_0x6da6('0x71')](_0x4b9cb5)&&!_[_0x6da6('0x71')](_0x2ae1af['firstName'])){_0x419fbb['calleridname']=_0x2ae1af['firstName'];if(!_[_0x6da6('0x71')](_0x2ae1af[_0x6da6('0x70')])){_0x419fbb[_0x6da6('0x72')]+='\x20'+_0x2ae1af[_0x6da6('0x70')];}}})['finally'](function(){return db[_0x6da6('0x73')][_0x6da6('0x5a')](_0x419fbb);});}})[_0x6da6('0x55')](function(){return _0x4b9cb5[_0x6da6('0x1c')](0xcc)[_0x6da6('0x29')]();})['catch'](handleError(_0x4b9cb5,null));};exports[_0x6da6('0x74')]=function(_0x55f0b6,_0x4b8c79,_0x3547c9){var _0x7ec9eb=[];return db['CmContact'][_0x6da6('0x5c')]()[_0x6da6('0x55')](function(_0x2adfae){_0x7ec9eb=_[_0x6da6('0x34')](_0x2adfae);return _0x55f0b6['user']['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x6da6('0x75')},'attributes':['id',_0x6da6('0x76')],'raw':!![]});})[_0x6da6('0x55')](function(_0x291349){if(_0x291349&&_0x291349[_0x6da6('0x48')]){return db[_0x6da6('0x77')][_0x6da6('0x78')](function(_0x109158){var _0x141cc1={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6da6('0x69')](_0x6da6('0x79'))},'VoiceQueueId':{'$in':_['map'](_0x291349,'id')},'$or':[{'UserId':null},{'UserId':_0x55f0b6[_0x6da6('0x67')]['id']}]};var _0x5ebcb3=[];if(_0x55f0b6[_0x6da6('0x5b')]['direction']&&_0x55f0b6[_0x6da6('0x5b')]['direction']===_0x6da6('0x7a')){if(!_[_0x6da6('0x7b')](_0x55f0b6[_0x6da6('0x5b')]['hopperIds'])){_0x141cc1['id']={'$in':_0x55f0b6[_0x6da6('0x5b')]['hopperIds']};}_0x5ebcb3=[[_0x6da6('0x7c'),_0x6da6('0x7d')],['scheduledAt',_0x291349[0x0][_0x6da6('0x76')]===_0x6da6('0x7d')?'DESC':_0x6da6('0x7d')],db[_0x6da6('0x77')]['literal'](_0x6da6('0x7e')),['id',_0x6da6('0x7f')]];}else{if(!_[_0x6da6('0x7b')](_0x55f0b6[_0x6da6('0x5b')][_0x6da6('0x80')])){_0x141cc1['id']={'$notIn':_0x55f0b6[_0x6da6('0x5b')][_0x6da6('0x80')]};}_0x5ebcb3=[[_0x6da6('0x7c'),_0x6da6('0x7f')],[_0x6da6('0x81'),_0x291349[0x0][_0x6da6('0x76')]],db[_0x6da6('0x77')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x6da6('0x7d')]];}return db[_0x6da6('0x30')][_0x6da6('0x82')]({'attributes':['id','scheduledat'],'where':_0x141cc1,'order':_0x5ebcb3,'transaction':_0x109158,'lock':_0x109158['LOCK'][_0x6da6('0x83')],'include':[{'model':db[_0x6da6('0x84')],'as':_0x6da6('0x85'),'attributes':_0x7ec9eb,'include':[{'model':db[_0x6da6('0x86')],'as':'Company','attributes':['id',_0x6da6('0x2c')]}]},{'model':db[_0x6da6('0x87')],'as':_0x6da6('0x88'),'attributes':['id','name']},{'model':db[_0x6da6('0x89')],'as':_0x6da6('0x8a'),'attributes':['id',_0x6da6('0x2c'),_0x6da6('0x8b')]}]})['then'](function(_0x59d1de){if(_0x59d1de){return _0x59d1de['update']({'UserId':_0x55f0b6[_0x6da6('0x67')]['id']},{'transaction':_0x109158});}});});}})[_0x6da6('0x55')](handleEntityNotFound(_0x4b8c79,null))[_0x6da6('0x55')](respondWithResult(_0x4b8c79,null))[_0x6da6('0x59')](handleError(_0x4b8c79,null));};exports[_0x6da6('0x8c')]=function(_0x5259ca,_0x1eee3f,_0x270feb){return _0x5259ca[_0x6da6('0x67')][_0x6da6('0x8d')]({'where':{'type':_0x6da6('0x8e'),'dialActive':!![],'dialMethod':_0x6da6('0x75')},'attributes':['id'],'raw':!![]})[_0x6da6('0x55')](function(_0x25b694){if(_0x25b694&&_0x25b694[_0x6da6('0x48')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6da6('0x69')](_0x6da6('0x79'))},'VoiceQueueId':{'$in':_['map'](_0x25b694,'id')},'$or':[{'UserId':null},{'UserId':_0x5259ca[_0x6da6('0x67')]['id']}]}});}return 0x0;})['then'](function(_0x2f7e4c){if(!_[_0x6da6('0x71')](_0x2f7e4c)&&_[_0x6da6('0x8f')](_0x2f7e4c)){return _0x1eee3f[_0x6da6('0x1c')](0xc8)[_0x6da6('0x1d')]({'contacts':_0x2f7e4c});}else{logger[_0x6da6('0x2a')](_0x6da6('0x90'),_0x6da6('0x8c'),0x194,_0x6da6('0x91'));_0x1eee3f[_0x6da6('0x1b')](0x194);}})['catch'](handleError(_0x1eee3f,null));}; \ No newline at end of file +var _0x56ea=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','stack','name','index','map','CmHopper','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','concat','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$notILike','$like','$overlap','$any','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','fields','include','find','create','body','params','describe','destroy','VoiceQueueId','Campaign','omit','createdAt','statedesc','deleted','campaign','membername','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','end','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','transaction','direction','prev','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','Contact','Company','VoiceQueue','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x2e81a2,_0x4477fc){var _0x27b108=function(_0xcee602){while(--_0xcee602){_0x2e81a2['push'](_0x2e81a2['shift']());}};_0x27b108(++_0x4477fc);}(_0x56ea,0x78));var _0xa56e=function(_0x22c684,_0x753309){_0x22c684=_0x22c684-0x0;var _0x39fcbb=_0x56ea[_0x22c684];return _0x39fcbb;};'use strict';var emlformat=require(_0xa56e('0x0'));var rimraf=require(_0xa56e('0x1'));var zipdir=require(_0xa56e('0x2'));var jsonpatch=require(_0xa56e('0x3'));var rp=require('request-promise');var moment=require(_0xa56e('0x4'));var BPromise=require(_0xa56e('0x5'));var Mustache=require(_0xa56e('0x6'));var util=require(_0xa56e('0x7'));var path=require(_0xa56e('0x8'));var sox=require(_0xa56e('0x9'));var csv=require(_0xa56e('0xa'));var ejs=require(_0xa56e('0xb'));var fs=require('fs');var fs_extra=require(_0xa56e('0xc'));var _=require('lodash');var squel=require(_0xa56e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa56e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa56e('0xf'));var Redis=require(_0xa56e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa56e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa56e('0x12'))(_0xa56e('0x13'));var utils=require('../../config/utils');var config=require(_0xa56e('0x14'));var licenseUtil=require(_0xa56e('0x15'));var db=require(_0xa56e('0x16'))['db'];function respondWithStatusCode(_0x4d6e35,_0x2b11da){_0x2b11da=_0x2b11da||0xcc;return function(_0xb0f517){if(_0xb0f517){return _0x4d6e35[_0xa56e('0x17')](_0x2b11da);}return _0x4d6e35[_0xa56e('0x18')](_0x2b11da)['end']();};}function respondWithResult(_0x1d01a9,_0x30df5e){_0x30df5e=_0x30df5e||0xc8;return function(_0x5f30a0){if(_0x5f30a0){return _0x1d01a9[_0xa56e('0x18')](_0x30df5e)[_0xa56e('0x19')](_0x5f30a0);}};}function respondWithFilteredResult(_0x9f3947,_0x15e557){return function(_0x394e4f){if(_0x394e4f){var _0x27b339=typeof _0x15e557[_0xa56e('0x1a')]===_0xa56e('0x1b')&&typeof _0x15e557[_0xa56e('0x1c')]===_0xa56e('0x1b');var _0x27f217=_0x394e4f[_0xa56e('0x1d')];var _0x56e6db=_0x27b339?0x0:_0x15e557[_0xa56e('0x1a')];var _0x1c0acd=_0x27b339?_0x394e4f[_0xa56e('0x1d')]:_0x15e557[_0xa56e('0x1a')]+_0x15e557[_0xa56e('0x1c')];var _0x54930a;if(_0x1c0acd>=_0x27f217){_0x1c0acd=_0x27f217;_0x54930a=0xc8;}else{_0x54930a=0xce;}_0x9f3947[_0xa56e('0x18')](_0x54930a);return _0x9f3947[_0xa56e('0x1e')](_0xa56e('0x1f'),_0x56e6db+'-'+_0x1c0acd+'/'+_0x27f217)['json'](_0x394e4f);}return null;};}function patchUpdates(_0x5df57a){return function(_0x184e78){try{jsonpatch[_0xa56e('0x20')](_0x184e78,_0x5df57a,!![]);}catch(_0x3cd7cb){return BPromise[_0xa56e('0x21')](_0x3cd7cb);}return _0x184e78['save']();};}function saveUpdates(_0x2eb183,_0x382645){return function(_0x186227){if(_0x186227){return _0x186227[_0xa56e('0x22')](_0x2eb183)[_0xa56e('0x23')](function(_0xc6aa4c){return _0xc6aa4c;});}return null;};}function removeEntity(_0x2254bb,_0x2b1a23){return function(_0x56b133){if(_0x56b133){return _0x56b133['destroy']()[_0xa56e('0x23')](function(){_0x2254bb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d7e9e,_0x4ec2ac){return function(_0x68741c){if(!_0x68741c){_0x2d7e9e['sendStatus'](0x194);}return _0x68741c;};}function handleError(_0x39cf80,_0xb520c9){_0xb520c9=_0xb520c9||0x1f4;return function(_0x39c5a9){logger['error'](_0x39c5a9[_0xa56e('0x24')]);if(_0x39c5a9[_0xa56e('0x25')]){delete _0x39c5a9[_0xa56e('0x25')];}_0x39cf80[_0xa56e('0x18')](_0xb520c9)['send'](_0x39c5a9);};}exports[_0xa56e('0x26')]=function(_0x5cecd3,_0x569c85){var _0x46c25d={},_0x299e45={},_0x1f9740={'count':0x0,'rows':[]};var _0x1d6a0b=_[_0xa56e('0x27')](db[_0xa56e('0x28')][_0xa56e('0x29')],function(_0x562f50){return{'name':_0x562f50[_0xa56e('0x2a')],'type':_0x562f50[_0xa56e('0x2b')][_0xa56e('0x2c')]};});_0x299e45[_0xa56e('0x2d')]=_[_0xa56e('0x27')](_0x1d6a0b,_0xa56e('0x25'));_0x299e45['query']=_[_0xa56e('0x2e')](_0x5cecd3[_0xa56e('0x2f')]);_0x299e45[_0xa56e('0x30')]=_[_0xa56e('0x31')](_0x299e45[_0xa56e('0x2d')],_0x299e45[_0xa56e('0x2f')]);_0x299e45[_0xa56e('0x30')]=_[_0xa56e('0x32')](_0x299e45[_0xa56e('0x30')],['$and',_0xa56e('0x33'),_0xa56e('0x34'),_0xa56e('0x35'),_0xa56e('0x36'),_0xa56e('0x37'),_0xa56e('0x38'),_0xa56e('0x39'),_0xa56e('0x3a'),_0xa56e('0x3b'),_0xa56e('0x3c'),_0xa56e('0x3d'),_0xa56e('0x3e'),'$like',_0xa56e('0x3f'),'$iLike',_0xa56e('0x40'),_0xa56e('0x41'),_0xa56e('0x42'),'$contains','$contained',_0xa56e('0x43')]);_0x46c25d[_0xa56e('0x44')]=_[_0xa56e('0x31')](_0x299e45[_0xa56e('0x2d')],qs['fields'](_0x5cecd3[_0xa56e('0x2f')]['fields']));_0x46c25d[_0xa56e('0x44')]=_0x46c25d[_0xa56e('0x44')][_0xa56e('0x45')]?_0x46c25d[_0xa56e('0x44')]:_0x299e45['model'];if(!_0x5cecd3['query'][_0xa56e('0x46')](_0xa56e('0x47'))){_0x46c25d[_0xa56e('0x1c')]=qs['limit'](_0x5cecd3['query'][_0xa56e('0x1c')]);_0x46c25d[_0xa56e('0x1a')]=qs[_0xa56e('0x1a')](_0x5cecd3['query'][_0xa56e('0x1a')]);}_0x46c25d['order']=qs['sort'](_0x5cecd3[_0xa56e('0x2f')][_0xa56e('0x48')]);_0x46c25d[_0xa56e('0x49')]=qs[_0xa56e('0x30')](_['pick'](_0x5cecd3[_0xa56e('0x2f')],_0x299e45[_0xa56e('0x30')]),_0x1d6a0b);if(_0x5cecd3[_0xa56e('0x2f')][_0xa56e('0x4a')]){_0x46c25d[_0xa56e('0x49')]=_[_0xa56e('0x4b')](_0x46c25d[_0xa56e('0x49')],{'$or':_[_0xa56e('0x27')](_0x1d6a0b,function(_0x54a0f6){if(_0x54a0f6[_0xa56e('0x2b')]!==_0xa56e('0x4c')){var _0x33673b={};_0x33673b[_0x54a0f6[_0xa56e('0x25')]]={'$like':'%'+_0x5cecd3['query']['filter']+'%'};return _0x33673b;}})});}_0x46c25d=_['merge']({},_0x46c25d,_0x5cecd3[_0xa56e('0x4d')]);var _0x1587cd={'where':_0x46c25d[_0xa56e('0x49')]};return db['CmHopper']['count'](_0x1587cd)[_0xa56e('0x23')](function(_0x151b38){_0x1f9740['count']=_0x151b38;if(_0x5cecd3[_0xa56e('0x2f')][_0xa56e('0x4e')]){_0x46c25d['include']=[{'all':!![]}];}return db['CmHopper'][_0xa56e('0x4f')](_0x46c25d);})[_0xa56e('0x23')](function(_0x3d7238){_0x1f9740[_0xa56e('0x50')]=_0x3d7238;return _0x1f9740;})[_0xa56e('0x23')](respondWithFilteredResult(_0x569c85,_0x46c25d))[_0xa56e('0x51')](handleError(_0x569c85,null));};exports[_0xa56e('0x52')]=function(_0x568a2b,_0x32e140){var _0x30166b={'raw':!![],'where':{'id':_0x568a2b['params']['id']}},_0x262dcf={};_0x262dcf[_0xa56e('0x2d')]=_[_0xa56e('0x2e')](db[_0xa56e('0x28')][_0xa56e('0x29')]);_0x262dcf[_0xa56e('0x2f')]=_[_0xa56e('0x2e')](_0x568a2b[_0xa56e('0x2f')]);_0x262dcf['filters']=_[_0xa56e('0x31')](_0x262dcf['model'],_0x262dcf[_0xa56e('0x2f')]);_0x30166b[_0xa56e('0x44')]=_[_0xa56e('0x31')](_0x262dcf[_0xa56e('0x2d')],qs[_0xa56e('0x53')](_0x568a2b[_0xa56e('0x2f')][_0xa56e('0x53')]));_0x30166b['attributes']=_0x30166b[_0xa56e('0x44')]['length']?_0x30166b['attributes']:_0x262dcf[_0xa56e('0x2d')];if(_0x568a2b['query'][_0xa56e('0x4e')]){_0x30166b[_0xa56e('0x54')]=[{'all':!![]}];}_0x30166b=_[_0xa56e('0x4b')]({},_0x30166b,_0x568a2b[_0xa56e('0x4d')]);return db[_0xa56e('0x28')][_0xa56e('0x55')](_0x30166b)[_0xa56e('0x23')](handleEntityNotFound(_0x32e140,null))[_0xa56e('0x23')](respondWithResult(_0x32e140,null))['catch'](handleError(_0x32e140,null));};exports[_0xa56e('0x56')]=function(_0x584b3,_0x1ffce1){return db[_0xa56e('0x28')][_0xa56e('0x56')](_0x584b3[_0xa56e('0x57')],{})['then'](respondWithResult(_0x1ffce1,0xc9))['catch'](handleError(_0x1ffce1,null));};exports['update']=function(_0x26bdc9,_0x2bd6b4){if(_0x26bdc9['body']['id']){delete _0x26bdc9[_0xa56e('0x57')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x26bdc9[_0xa56e('0x58')]['id']}})[_0xa56e('0x23')](handleEntityNotFound(_0x2bd6b4,null))[_0xa56e('0x23')](saveUpdates(_0x26bdc9[_0xa56e('0x57')],null))[_0xa56e('0x23')](respondWithResult(_0x2bd6b4,null))[_0xa56e('0x51')](handleError(_0x2bd6b4,null));};exports[_0xa56e('0x59')]=function(_0x262367,_0x14cd88){return db[_0xa56e('0x28')][_0xa56e('0x59')]()[_0xa56e('0x23')](respondWithResult(_0x14cd88,null))[_0xa56e('0x51')](handleError(_0x14cd88,null));};exports['destroy']=function(_0x1718fc,_0x21d2da){var _0x50a14e;return db[_0xa56e('0x28')]['find']({'where':{'id':_0x1718fc[_0xa56e('0x58')]['id']}})[_0xa56e('0x23')](handleEntityNotFound(_0x21d2da,null))[_0xa56e('0x23')](function(_0x5be697){if(_0x5be697){return _0x5be697[_0xa56e('0x5a')]()[_0xa56e('0x23')](function(_0x287915){return _0x287915;});}})[_0xa56e('0x23')](function(_0x51c8b8){_0x50a14e=_0x51c8b8;if(_0x51c8b8){if(_0x51c8b8['VoiceQueueId']||_0x51c8b8['CampaignId']){return db[_0x51c8b8[_0xa56e('0x5b')]?'VoiceQueue':_0xa56e('0x5c')][_0xa56e('0x55')]({'where':{'id':_0x51c8b8['VoiceQueueId']?_0x51c8b8['VoiceQueueId']:_0x51c8b8['CampaignId']},'attributes':['id',_0xa56e('0x25')],'raw':!![]});}}})[_0xa56e('0x23')](function(_0x932615){var _0x4e822d={};if(_0x932615){_[_0xa56e('0x4b')](_0x4e822d,_[_0xa56e('0x5d')](_0x50a14e['dataValues'],[_0xa56e('0x5e'),'updatedAt','id']));_0x4e822d['state']=0x15;_0x4e822d[_0xa56e('0x5f')]=_0xa56e('0x60');_0x4e822d[_0xa56e('0x61')]=_0x932615[_0xa56e('0x25')];_0x4e822d[_0xa56e('0x62')]=_0x1718fc['user']['name'];_0x4e822d[_0xa56e('0x63')]=_0x1718fc[_0xa56e('0x64')]['id'];_0x4e822d[_0xa56e('0x60')]=!![];_0x4e822d[_0xa56e('0x65')]=moment()[_0xa56e('0x66')](_0xa56e('0x67'));_0x4e822d[_0xa56e('0x68')]=_0x50a14e[_0xa56e('0x69')];_0x4e822d[_0xa56e('0x6a')]=_0x50a14e[_0xa56e('0x5b')]?_0xa56e('0x6b'):_0xa56e('0x6c');return db[_0xa56e('0x6d')]['find']({'where':{'id':_0x4e822d[_0xa56e('0x6e')]},'attributes':[_0xa56e('0x6f'),'lastName']})[_0xa56e('0x23')](function(_0x2a518d){if(!_[_0xa56e('0x70')](_0x21d2da)&&!_[_0xa56e('0x70')](_0x2a518d[_0xa56e('0x6f')])){_0x4e822d[_0xa56e('0x71')]=_0x2a518d[_0xa56e('0x6f')];if(!_[_0xa56e('0x70')](_0x2a518d[_0xa56e('0x72')])){_0x4e822d[_0xa56e('0x71')]+='\x20'+_0x2a518d['lastName'];}}})[_0xa56e('0x73')](function(){return db[_0xa56e('0x74')][_0xa56e('0x56')](_0x4e822d);});}})[_0xa56e('0x23')](function(){return _0x21d2da['status'](0xcc)[_0xa56e('0x75')]();})[_0xa56e('0x51')](handleError(_0x21d2da,null));};exports['getPreview']=function(_0xf94461,_0x1f58cf,_0x3e75d2){var _0x53e79d=[];return db[_0xa56e('0x6d')][_0xa56e('0x59')]()[_0xa56e('0x23')](function(_0x16964b){_0x53e79d=_['keys'](_0x16964b);return _0xf94461[_0xa56e('0x64')][_0xa56e('0x76')]({'where':{'type':_0xa56e('0x77'),'dialActive':!![],'dialMethod':_0xa56e('0x78')},'attributes':['id',_0xa56e('0x79')],'raw':!![]});})[_0xa56e('0x23')](function(_0x1d0a74){if(_0x1d0a74&&_0x1d0a74['length']){return db[_0xa56e('0x7a')][_0xa56e('0x7b')](function(_0x14de12){var _0x55013b={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xa56e('0x67'))},'VoiceQueueId':{'$in':_[_0xa56e('0x27')](_0x1d0a74,'id')},'$or':[{'UserId':null},{'UserId':_0xf94461[_0xa56e('0x64')]['id']}]};var _0x252a14=[];if(_0xf94461[_0xa56e('0x57')]['direction']&&_0xf94461[_0xa56e('0x57')][_0xa56e('0x7c')]===_0xa56e('0x7d')){if(!_['isEmpty'](_0xf94461[_0xa56e('0x57')][_0xa56e('0x7e')])){_0x55013b['id']={'$in':_0xf94461[_0xa56e('0x57')]['hopperIds']};}_0x252a14=[[_0xa56e('0x7f'),_0xa56e('0x80')],[_0xa56e('0x81'),_0x1d0a74[0x0]['dialOrderByScheduledAt']===_0xa56e('0x80')?_0xa56e('0x82'):_0xa56e('0x80')],db[_0xa56e('0x7a')][_0xa56e('0x83')](_0xa56e('0x84')),['id',_0xa56e('0x82')]];}else{if(!_[_0xa56e('0x85')](_0xf94461[_0xa56e('0x57')][_0xa56e('0x7e')])){_0x55013b['id']={'$notIn':_0xf94461['body'][_0xa56e('0x7e')]};}_0x252a14=[[_0xa56e('0x7f'),_0xa56e('0x82')],[_0xa56e('0x81'),_0x1d0a74[0x0]['dialOrderByScheduledAt']],db[_0xa56e('0x7a')]['literal'](_0xa56e('0x86')),['id','ASC']];}return db[_0xa56e('0x28')]['findOne']({'attributes':['id',_0xa56e('0x87')],'where':_0x55013b,'order':_0x252a14,'transaction':_0x14de12,'lock':_0x14de12[_0xa56e('0x88')]['UPDATE'],'include':[{'model':db[_0xa56e('0x6d')],'as':_0xa56e('0x89'),'attributes':_0x53e79d,'include':[{'model':db['CmCompany'],'as':_0xa56e('0x8a'),'attributes':['id',_0xa56e('0x25')]}]},{'model':db['CmList'],'as':'List','attributes':['id','name']},{'model':db[_0xa56e('0x8b')],'as':_0xa56e('0x8c'),'attributes':['id',_0xa56e('0x25'),_0xa56e('0x8d')]}]})[_0xa56e('0x23')](function(_0x4b398d){if(_0x4b398d){return _0x4b398d[_0xa56e('0x22')]({'UserId':_0xf94461[_0xa56e('0x64')]['id']},{'transaction':_0x14de12});}});});}})[_0xa56e('0x23')](handleEntityNotFound(_0x1f58cf,null))[_0xa56e('0x23')](respondWithResult(_0x1f58cf,null))[_0xa56e('0x51')](handleError(_0x1f58cf,null));};exports[_0xa56e('0x8e')]=function(_0x4b1419,_0x48f31b,_0x4b6ec0){return _0x4b1419[_0xa56e('0x64')]['getVoiceQueues']({'where':{'type':_0xa56e('0x77'),'dialActive':!![],'dialMethod':_0xa56e('0x78')},'attributes':['id'],'raw':!![]})[_0xa56e('0x23')](function(_0x3eca5a){if(_0x3eca5a&&_0x3eca5a[_0xa56e('0x45')]){return db[_0xa56e('0x28')][_0xa56e('0x1d')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xa56e('0x66')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xa56e('0x27')](_0x3eca5a,'id')},'$or':[{'UserId':null},{'UserId':_0x4b1419['user']['id']}]}});}return 0x0;})[_0xa56e('0x23')](function(_0x159a05){if(!_[_0xa56e('0x70')](_0x159a05)&&_[_0xa56e('0x8f')](_0x159a05)){return _0x48f31b[_0xa56e('0x18')](0xc8)[_0xa56e('0x19')]({'contacts':_0x159a05});}else{logger['error'](_0xa56e('0x90'),_0xa56e('0x8e'),0x194,'entity\x20not\x20found');_0x48f31b[_0xa56e('0x17')](0x194);}})[_0xa56e('0x51')](handleError(_0x48f31b,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index c9f0d0a..18d82a8 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(_0x5d87e9,_0x3ef6b9){var _0x1b6035=function(_0x221455){while(--_0x221455){_0x5d87e9['push'](_0x5d87e9['shift']());}};_0x1b6035(++_0x3ef6b9);}(_0x7096,0x10c));var _0x6709=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x7096[_0xae7c2f];return _0x5d7001;};'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 _0xc6ac=['./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x35a884,_0x534fa8){_0x35a884=_0x35a884-0x0;var _0xd1b0d8=_0xc6ac[_0x35a884];return _0xd1b0d8;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'paranoid':![],'indexes':[{'name':_0xcc6a('0xe'),'fields':['scheduledat']},{'name':_0xcc6a('0xf'),'fields':[_0xcc6a('0xf')]},{'name':_0xcc6a('0x10'),'fields':[_0xcc6a('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index ac9827d..4132a0f 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 _0xe61b=['Agent','name','voicePause','length','UserId','push','all','GetContactDialer','MoveContactManagedDialer','sequelize','CmHopperFinal','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','CmContact','LOCK','UPDATE','GetCmHopperPreview','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CmHopper','findAll','options','raw','where','limit','include','map','model','attributes','GetCmHopper','ShowCmHopper','find','then','CreateCmHopper','create','body','update','UpdateCmHopper','destroy','DestroyCmHopper','describe','transaction','order','Contact','keys'];(function(_0x49e0f7,_0x387cc6){var _0x4a325a=function(_0x1a9537){while(--_0x1a9537){_0x49e0f7['push'](_0x49e0f7['shift']());}};_0x4a325a(++_0x387cc6);}(_0xe61b,0xa0));var _0xbe61=function(_0x4697fa,_0x21c841){_0x4697fa=_0x4697fa-0x0;var _0x390950=_0xe61b[_0x4697fa];return _0x390950;};'use strict';var _=require(_0xbe61('0x0'));var util=require(_0xbe61('0x1'));var moment=require('moment');var BPromise=require(_0xbe61('0x2'));var rs=require(_0xbe61('0x3'));var fs=require('fs');var Redis=require(_0xbe61('0x4'));var db=require(_0xbe61('0x5'))['db'];var utils=require(_0xbe61('0x6'));var logger=require(_0xbe61('0x7'))(_0xbe61('0x8'));var config=require(_0xbe61('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbe61('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4678dc,_0x18494e,_0x412108){return new BPromise(function(_0x57c954,_0x51f4b0){return client['request'](_0x4678dc,_0x412108)['then'](function(_0xc8d15b){logger[_0xbe61('0xb')](_0xbe61('0xc'),_0x18494e,_0xbe61('0xd'));logger[_0xbe61('0xe')](_0xbe61('0xf'),_0x18494e,_0xbe61('0xd'),JSON[_0xbe61('0x10')](_0xc8d15b));if(_0xc8d15b[_0xbe61('0x11')]){if(_0xc8d15b['error']['code']===0x1f4){logger[_0xbe61('0x11')](_0xbe61('0xc'),_0x18494e,_0xc8d15b['error'][_0xbe61('0x12')]);return _0x51f4b0(_0xc8d15b[_0xbe61('0x11')]['message']);}logger[_0xbe61('0x11')]('CmHopper,\x20%s,\x20%s',_0x18494e,_0xc8d15b[_0xbe61('0x11')][_0xbe61('0x12')]);return _0x57c954(_0xc8d15b[_0xbe61('0x11')][_0xbe61('0x12')]);}else{logger[_0xbe61('0xb')](_0xbe61('0xc'),_0x18494e,_0xbe61('0xd'));_0x57c954(_0xc8d15b[_0xbe61('0x13')]['message']);}})[_0xbe61('0x14')](function(_0x5bbc92){logger['error'](_0xbe61('0xc'),_0x18494e,_0x5bbc92);_0x51f4b0(_0x5bbc92);});});}exports['GetCmHopper']=function(_0x468f78){var _0x22aee7=this;return new Promise(function(_0x3ad6b4,_0x344fc4){return db[_0xbe61('0x15')][_0xbe61('0x16')]({'raw':_0x468f78[_0xbe61('0x17')]?_0x468f78[_0xbe61('0x17')][_0xbe61('0x18')]===undefined?!![]:![]:!![],'where':_0x468f78['options']?_0x468f78[_0xbe61('0x17')][_0xbe61('0x19')]||null:null,'attributes':_0x468f78['options']?_0x468f78[_0xbe61('0x17')]['attributes']||null:null,'limit':_0x468f78[_0xbe61('0x17')]?_0x468f78[_0xbe61('0x17')][_0xbe61('0x1a')]||null:null,'include':_0x468f78[_0xbe61('0x17')]?_0x468f78[_0xbe61('0x17')][_0xbe61('0x1b')]?_[_0xbe61('0x1c')](_0x468f78[_0xbe61('0x17')][_0xbe61('0x1b')],function(_0x1a5324){return{'model':db[_0x1a5324[_0xbe61('0x1d')]],'as':_0x1a5324['as'],'attributes':_0x1a5324[_0xbe61('0x1e')],'include':_0x1a5324[_0xbe61('0x1b')]?_['map'](_0x1a5324[_0xbe61('0x1b')],function(_0x1dc2ee){return{'model':db[_0x1dc2ee[_0xbe61('0x1d')]],'as':_0x1dc2ee['as'],'attributes':_0x1dc2ee['attributes'],'include':_0x1dc2ee[_0xbe61('0x1b')]?_[_0xbe61('0x1c')](_0x1dc2ee[_0xbe61('0x1b')],function(_0x40084c){return{'model':db[_0x40084c[_0xbe61('0x1d')]],'as':_0x40084c['as'],'attributes':_0x40084c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cc6f){logger[_0xbe61('0xb')]('GetCmHopper',_0x468f78);logger['debug'](_0xbe61('0x1f'),_0x468f78,JSON['stringify'](_0x23cc6f));_0x3ad6b4(_0x23cc6f);})['catch'](function(_0x22da71){logger[_0xbe61('0x11')](_0xbe61('0x1f'),_0x22da71[_0xbe61('0x12')],_0x468f78);_0x344fc4(_0x22aee7[_0xbe61('0x11')](0x1f4,_0x22da71[_0xbe61('0x12')]));});});};exports[_0xbe61('0x20')]=function(_0x192d60){var _0x52833c=this;return new Promise(function(_0xe30d76,_0x46c99e){return db[_0xbe61('0x15')][_0xbe61('0x21')]({'raw':_0x192d60[_0xbe61('0x17')]?_0x192d60[_0xbe61('0x17')][_0xbe61('0x18')]===undefined?!![]:![]:!![],'where':_0x192d60[_0xbe61('0x17')]?_0x192d60[_0xbe61('0x17')][_0xbe61('0x19')]||null:null,'attributes':_0x192d60[_0xbe61('0x17')]?_0x192d60[_0xbe61('0x17')]['attributes']||null:null,'include':_0x192d60[_0xbe61('0x17')]?_0x192d60[_0xbe61('0x17')][_0xbe61('0x1b')]?_[_0xbe61('0x1c')](_0x192d60['options'][_0xbe61('0x1b')],function(_0x227747){return{'model':db[_0x227747[_0xbe61('0x1d')]],'as':_0x227747['as'],'attributes':_0x227747[_0xbe61('0x1e')],'include':_0x227747[_0xbe61('0x1b')]?_[_0xbe61('0x1c')](_0x227747[_0xbe61('0x1b')],function(_0x467635){return{'model':db[_0x467635[_0xbe61('0x1d')]],'as':_0x467635['as'],'attributes':_0x467635[_0xbe61('0x1e')],'include':_0x467635['include']?_[_0xbe61('0x1c')](_0x467635[_0xbe61('0x1b')],function(_0x51acdb){return{'model':db[_0x51acdb['model']],'as':_0x51acdb['as'],'attributes':_0x51acdb['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe61('0x22')](function(_0x28020d){logger[_0xbe61('0xb')](_0xbe61('0x20'),_0x192d60);logger['debug']('ShowCmHopper',_0x192d60,JSON[_0xbe61('0x10')](_0x28020d));_0xe30d76(_0x28020d);})['catch'](function(_0x397e95){logger[_0xbe61('0x11')]('ShowCmHopper',_0x397e95['message'],_0x192d60);_0x46c99e(_0x52833c[_0xbe61('0x11')](0x1f4,_0x397e95[_0xbe61('0x12')]));});});};exports[_0xbe61('0x23')]=function(_0x55b2a9){var _0x4cbf8d=this;return new Promise(function(_0x53f719,_0x38b533){return db[_0xbe61('0x15')][_0xbe61('0x24')](_0x55b2a9[_0xbe61('0x25')],{'raw':_0x55b2a9[_0xbe61('0x17')]?_0x55b2a9[_0xbe61('0x17')][_0xbe61('0x18')]===undefined?!![]:![]:!![]})[_0xbe61('0x22')](function(_0x5a964f){logger[_0xbe61('0xb')](_0xbe61('0x23'),_0x55b2a9);logger[_0xbe61('0xe')](_0xbe61('0x23'),_0x55b2a9,JSON['stringify'](_0x5a964f));_0x53f719(_0x5a964f);})[_0xbe61('0x14')](function(_0x55ed41){logger[_0xbe61('0x11')](_0xbe61('0x23'),_0x55ed41['message'],_0x55b2a9);_0x38b533(_0x4cbf8d['error'](0x1f4,_0x55ed41['message']));});});};exports['UpdateCmHopper']=function(_0x36a11c){var _0x29681f=this;return new Promise(function(_0x53ad92,_0xc6b768){return db[_0xbe61('0x15')][_0xbe61('0x26')](_0x36a11c[_0xbe61('0x25')],{'raw':_0x36a11c[_0xbe61('0x17')]?_0x36a11c[_0xbe61('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36a11c[_0xbe61('0x17')]?_0x36a11c['options'][_0xbe61('0x19')]||null:null,'attributes':_0x36a11c[_0xbe61('0x17')]?_0x36a11c[_0xbe61('0x17')][_0xbe61('0x1e')]||null:null,'limit':_0x36a11c['options']?_0x36a11c['options'][_0xbe61('0x1a')]||null:null})['then'](function(_0x372f70){logger[_0xbe61('0xb')]('UpdateCmHopper',_0x36a11c);logger[_0xbe61('0xe')]('UpdateCmHopper',_0x36a11c,JSON[_0xbe61('0x10')](_0x372f70));_0x53ad92(_0x372f70);})['catch'](function(_0x47962e){logger[_0xbe61('0x11')](_0xbe61('0x27'),_0x47962e[_0xbe61('0x12')],_0x36a11c);_0xc6b768(_0x29681f[_0xbe61('0x11')](0x1f4,_0x47962e[_0xbe61('0x12')]));});});};exports['DestroyCmHopper']=function(_0x15fc9e){var _0x1f21f3=this;return new Promise(function(_0x2d3243,_0x4cb1f4){return db[_0xbe61('0x15')][_0xbe61('0x28')]({'where':_0x15fc9e[_0xbe61('0x17')]?_0x15fc9e[_0xbe61('0x17')]['where']||null:null})[_0xbe61('0x22')](function(_0x3c7980){logger['info']('DestroyCmHopper',_0x15fc9e);logger[_0xbe61('0xe')](_0xbe61('0x29'),_0x15fc9e,JSON[_0xbe61('0x10')](_0x3c7980));_0x2d3243(_0x3c7980);})[_0xbe61('0x14')](function(_0x5990f8){logger[_0xbe61('0x11')]('DestroyCmHopper',_0x5990f8[_0xbe61('0x12')],_0x15fc9e);_0x4cb1f4(_0x1f21f3['error'](0x1f4,_0x5990f8[_0xbe61('0x12')]));});});};exports['GetContactDialer']=function(_0x2899e8){var _0x11ad8a=this;return new Promise(function(_0x1c294e,_0x4685b9){return db['CmContact'][_0xbe61('0x2a')]()[_0xbe61('0x22')](function(_0x4390d2){return db['sequelize'][_0xbe61('0x2b')](function(_0x127a26){return db[_0xbe61('0x15')]['findAll']({'where':_0x2899e8[_0xbe61('0x17')]?_0x2899e8[_0xbe61('0x17')][_0xbe61('0x19')]||null:null,'attributes':_0x2899e8[_0xbe61('0x17')]?_0x2899e8['options'][_0xbe61('0x1e')]||null:null,'limit':_0x2899e8[_0xbe61('0x17')]?_0x2899e8[_0xbe61('0x17')]['limit']||null:null,'order':_0x2899e8['options']?_0x2899e8[_0xbe61('0x17')][_0xbe61('0x2c')]||null:null,'transaction':_0x127a26,'lock':_0x127a26['LOCK']['UPDATE'],'include':[{'model':db['CmContact'],'as':_0xbe61('0x2d'),'attributes':_[_0xbe61('0x2e')](_0x4390d2)},{'model':db['User'],'as':_0xbe61('0x2f'),'attributes':['id',_0xbe61('0x30'),_0xbe61('0x31')]}]})[_0xbe61('0x22')](function(_0x63a4a4){var _0x29d43a=[];var _0x21dc4b=[];for(var _0x3d2d7f=0x0;_0x3d2d7f<_0x63a4a4[_0xbe61('0x32')];_0x3d2d7f+=0x1){var _0x5532ec=_0x63a4a4[_0x3d2d7f][_0xbe61('0x33')];if(_0x5532ec===null){_0x29d43a[_0xbe61('0x34')](_0x63a4a4[_0x3d2d7f]['update'](_0x2899e8[_0xbe61('0x25')],{'transaction':_0x127a26}));}else if(!_0x21dc4b['includes'](_0x5532ec)){_0x21dc4b[_0xbe61('0x34')](_0x5532ec);_0x29d43a['push'](_0x63a4a4[_0x3d2d7f][_0xbe61('0x26')](_0x2899e8[_0xbe61('0x25')],{'transaction':_0x127a26}));}}return BPromise[_0xbe61('0x35')](_0x29d43a);});})[_0xbe61('0x22')](function(_0x3f91e8){logger[_0xbe61('0xb')]('GetContactDialer',_0x2899e8);logger[_0xbe61('0xe')](_0xbe61('0x36'),_0x2899e8,JSON['stringify'](_0x3f91e8));_0x1c294e(_0x3f91e8);})[_0xbe61('0x14')](function(_0x375e58){logger[_0xbe61('0x11')](_0xbe61('0x36'),_0x375e58[_0xbe61('0x12')],_0x2899e8);_0x4685b9(_0x11ad8a[_0xbe61('0x11')](0x1f4,_0x375e58[_0xbe61('0x12')]));});});});};exports[_0xbe61('0x37')]=function(_0x1a466d){var _0x362ed4=this;return new Promise(function(_0x2fe991,_0x2e9932){return db[_0xbe61('0x38')][_0xbe61('0x2b')](function(_0x83e4c9){return db[_0xbe61('0x39')]['create'](_0x1a466d[_0xbe61('0x25')],{'raw':_0x1a466d[_0xbe61('0x17')]?_0x1a466d[_0xbe61('0x17')][_0xbe61('0x18')]===undefined?!![]:![]:!![],'transaction':_0x83e4c9})[_0xbe61('0x22')](function(){return db[_0xbe61('0x15')][_0xbe61('0x28')]({'where':_0x1a466d['options']?_0x1a466d[_0xbe61('0x17')][_0xbe61('0x19')]||null:null,'transaction':_0x83e4c9});});})[_0xbe61('0x22')](function(_0x14822c){logger['info'](_0xbe61('0x37'),_0x1a466d);logger[_0xbe61('0xe')](_0xbe61('0x37'),_0x1a466d,JSON[_0xbe61('0x10')](_0x14822c));_0x2fe991(_0x14822c);})['catch'](function(_0xb1554d){logger['error']('MoveContactManagedDialer',_0xb1554d['message'],_0x1a466d);_0x2e9932(_0x362ed4['error'](0x1f4,_0xb1554d[_0xbe61('0x12')]));});});};exports[_0xbe61('0x3a')]=function(_0x6f9f0b){var _0x33a7ed=this;return new Promise(function(_0x39a939,_0x1cb4b5){return db[_0xbe61('0x15')][_0xbe61('0x16')]({'raw':_0x6f9f0b[_0xbe61('0x17')]?_0x6f9f0b[_0xbe61('0x17')][_0xbe61('0x18')]===undefined?!![]:![]:!![],'where':_0x6f9f0b[_0xbe61('0x17')]?_0x6f9f0b['options'][_0xbe61('0x19')]||null:null,'attributes':[[db[_0xbe61('0x38')]['fn']('COUNT',db[_0xbe61('0x38')]['fn']('IF',db[_0xbe61('0x38')][_0xbe61('0x3b')](_0xbe61('0x3c')+util[_0xbe61('0x3d')]('\x22%s\x22',moment()[_0xbe61('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xbe61('0x3e')))),_0xbe61('0x3f')]]})[_0xbe61('0x22')](function(_0x2a844f){logger[_0xbe61('0xb')](_0xbe61('0x3a'),_0x6f9f0b);logger['debug'](_0xbe61('0x3a'),_0x6f9f0b,JSON[_0xbe61('0x10')](_0x2a844f));_0x39a939(_0x2a844f);})[_0xbe61('0x14')](function(_0x5b2f6b){logger[_0xbe61('0x11')](_0xbe61('0x3a'),_0x5b2f6b[_0xbe61('0x12')],_0x6f9f0b);_0x1cb4b5(_0x33a7ed[_0xbe61('0x11')](0x1f4,_0x5b2f6b[_0xbe61('0x12')]));});});};exports[_0xbe61('0x40')]=function(_0x37bfab){var _0x5058a3=this;return new Promise(function(_0x55160d,_0x720006){return db[_0xbe61('0x41')][_0xbe61('0x2a')]()['then'](function(_0x219da4){return db[_0xbe61('0x38')][_0xbe61('0x2b')](function(_0x5d5c0f){return db[_0xbe61('0x15')][_0xbe61('0x16')]({'where':_0x37bfab[_0xbe61('0x17')]?_0x37bfab[_0xbe61('0x17')][_0xbe61('0x19')]||null:null,'attributes':_0x37bfab['options']?_0x37bfab[_0xbe61('0x17')][_0xbe61('0x1e')]||null:null,'limit':0x1,'order':_0x37bfab[_0xbe61('0x17')]?_0x37bfab[_0xbe61('0x17')][_0xbe61('0x2c')]||null:null,'group':db[_0xbe61('0x15')][_0xbe61('0x33')],'transaction':_0x5d5c0f,'lock':_0x5d5c0f[_0xbe61('0x42')][_0xbe61('0x43')],'include':_0x37bfab[_0xbe61('0x17')]?_0x37bfab[_0xbe61('0x17')][_0xbe61('0x1b')]?_['map'](_0x37bfab[_0xbe61('0x17')][_0xbe61('0x1b')],function(_0x69332b){return{'model':db[_0x69332b['model']],'as':_0x69332b['as'],'attributes':_0x69332b[_0xbe61('0x1e')],'include':_0x69332b[_0xbe61('0x1b')]?_[_0xbe61('0x1c')](_0x69332b['include'],function(_0x130fa8){return{'model':db[_0x130fa8[_0xbe61('0x1d')]],'as':_0x130fa8['as'],'attributes':_0x130fa8[_0xbe61('0x1e')],'include':_0x130fa8[_0xbe61('0x1b')]?_['map'](_0x130fa8[_0xbe61('0x1b')],function(_0x10969b){return{'model':db[_0x10969b[_0xbe61('0x1d')]],'as':_0x10969b['as'],'attributes':_0x10969b['attributes']};}):[]};}):[]};}):[]:[]})[_0xbe61('0x22')](function(_0x12715e){var _0x223e59=[];for(var _0x4eb640=0x0;_0x4eb640<_0x12715e[_0xbe61('0x32')];_0x4eb640+=0x1){_0x223e59['push'](_0x12715e[_0x4eb640][_0xbe61('0x26')](_0x37bfab[_0xbe61('0x25')],{'transaction':_0x5d5c0f}));}return BPromise[_0xbe61('0x35')](_0x223e59);});})['then'](function(_0x4702e1){logger['info']('GetContactRecallMe',_0x37bfab);logger[_0xbe61('0xe')]('GetContactRecallMe',_0x37bfab,JSON['stringify'](_0x4702e1));_0x55160d(_0x4702e1);})[_0xbe61('0x14')](function(_0x514957){logger[_0xbe61('0x11')]('GetContactRecallMe',_0x514957['message'],_0x37bfab);_0x720006(_0x5058a3[_0xbe61('0x11')](0x1f4,_0x514957[_0xbe61('0x12')]));});});});};exports[_0xbe61('0x44')]=function(_0x22cb1f){var _0x352937=this;return new Promise(function(_0x2915eb,_0x96098f){db[_0xbe61('0x41')][_0xbe61('0x2a')]()[_0xbe61('0x22')](function(_0x2c1af3){return db[_0xbe61('0x15')]['findAll']({'raw':_0x22cb1f['options']?_0x22cb1f[_0xbe61('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x22cb1f[_0xbe61('0x17')]?_0x22cb1f[_0xbe61('0x17')]['where']||null:null,'attributes':_0x22cb1f[_0xbe61('0x17')]?_0x22cb1f[_0xbe61('0x17')]['attributes']||null:null,'limit':_0x22cb1f['options']?_0x22cb1f[_0xbe61('0x17')]['limit']||null:null,'include':_0x22cb1f[_0xbe61('0x17')]?_0x22cb1f[_0xbe61('0x17')][_0xbe61('0x1b')]?_['map'](_0x22cb1f['options'][_0xbe61('0x1b')],function(_0x23463f){return{'model':db[_0x23463f[_0xbe61('0x1d')]],'as':_0x23463f['as'],'attributes':_0x23463f['as']===_0xbe61('0x2d')?_[_0xbe61('0x2e')](_0x2c1af3):_0x23463f[_0xbe61('0x1e')],'include':_0x23463f['include']?_['map'](_0x23463f[_0xbe61('0x1b')],function(_0x4d3dea){return{'model':db[_0x4d3dea[_0xbe61('0x1d')]],'as':_0x4d3dea['as'],'attributes':_0x4d3dea[_0xbe61('0x1e')],'include':_0x4d3dea[_0xbe61('0x1b')]?_['map'](_0x4d3dea['include'],function(_0x5d767a){return{'model':db[_0x5d767a[_0xbe61('0x1d')]],'as':_0x5d767a['as'],'attributes':_0x5d767a[_0xbe61('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbe61('0x22')](function(_0x44c7da){logger[_0xbe61('0xb')](_0xbe61('0x1f'),_0x22cb1f);logger[_0xbe61('0xe')](_0xbe61('0x1f'),_0x22cb1f,JSON[_0xbe61('0x10')](_0x44c7da));_0x2915eb(_0x44c7da);})[_0xbe61('0x14')](function(_0x2a49f3){logger['error']('GetCmHopper',_0x2a49f3[_0xbe61('0x12')],_0x22cb1f);_0x96098f(_0x352937[_0xbe61('0x11')](0x1f4,_0x2a49f3[_0xbe61('0x12')]));});});});}; \ No newline at end of file +var _0x5b01=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','CmHopper,\x20%s,\x20%s','message','result','GetCmHopper','findAll','options','raw','attributes','limit','include','model','map','ShowCmHopper','CmHopper','find','where','catch','CreateCmHopper','create','body','update','UpdateCmHopper','destroy','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','Agent','name','length','UserId','push','all','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','bluebird','randomstring'];(function(_0x206c3b,_0x12e7cc){var _0x48d3e5=function(_0x304148){while(--_0x304148){_0x206c3b['push'](_0x206c3b['shift']());}};_0x48d3e5(++_0x12e7cc);}(_0x5b01,0x86));var _0x15b0=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x5b01[_0x45e98e];return _0x374dba;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x15b0('0x0'));var rs=require(_0x15b0('0x1'));var fs=require('fs');var Redis=require(_0x15b0('0x2'));var db=require(_0x15b0('0x3'))['db'];var utils=require(_0x15b0('0x4'));var logger=require(_0x15b0('0x5'))(_0x15b0('0x6'));var config=require(_0x15b0('0x7'));var jayson=require(_0x15b0('0x8'));var client=jayson[_0x15b0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x216562,_0x2133f0,_0x414bb9){return new BPromise(function(_0xad714c,_0x52a2ba){return client[_0x15b0('0xa')](_0x216562,_0x414bb9)[_0x15b0('0xb')](function(_0x3b7b4e){logger[_0x15b0('0xc')]('CmHopper,\x20%s,\x20%s',_0x2133f0,_0x15b0('0xd'));logger[_0x15b0('0xe')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x2133f0,'request\x20sent',JSON[_0x15b0('0xf')](_0x3b7b4e));if(_0x3b7b4e[_0x15b0('0x10')]){if(_0x3b7b4e[_0x15b0('0x10')]['code']===0x1f4){logger[_0x15b0('0x10')](_0x15b0('0x11'),_0x2133f0,_0x3b7b4e['error']['message']);return _0x52a2ba(_0x3b7b4e[_0x15b0('0x10')]['message']);}logger['error'](_0x15b0('0x11'),_0x2133f0,_0x3b7b4e[_0x15b0('0x10')][_0x15b0('0x12')]);return _0xad714c(_0x3b7b4e['error'][_0x15b0('0x12')]);}else{logger[_0x15b0('0xc')](_0x15b0('0x11'),_0x2133f0,_0x15b0('0xd'));_0xad714c(_0x3b7b4e[_0x15b0('0x13')][_0x15b0('0x12')]);}})['catch'](function(_0x262633){logger['error'](_0x15b0('0x11'),_0x2133f0,_0x262633);_0x52a2ba(_0x262633);});});}exports[_0x15b0('0x14')]=function(_0x46bb17){var _0x5b830c=this;return new Promise(function(_0xb8c92b,_0x252266){return db['CmHopper'][_0x15b0('0x15')]({'raw':_0x46bb17[_0x15b0('0x16')]?_0x46bb17[_0x15b0('0x16')][_0x15b0('0x17')]===undefined?!![]:![]:!![],'where':_0x46bb17[_0x15b0('0x16')]?_0x46bb17[_0x15b0('0x16')]['where']||null:null,'attributes':_0x46bb17['options']?_0x46bb17[_0x15b0('0x16')][_0x15b0('0x18')]||null:null,'limit':_0x46bb17[_0x15b0('0x16')]?_0x46bb17[_0x15b0('0x16')][_0x15b0('0x19')]||null:null,'include':_0x46bb17[_0x15b0('0x16')]?_0x46bb17[_0x15b0('0x16')][_0x15b0('0x1a')]?_['map'](_0x46bb17[_0x15b0('0x16')]['include'],function(_0x4612c6){return{'model':db[_0x4612c6[_0x15b0('0x1b')]],'as':_0x4612c6['as'],'attributes':_0x4612c6[_0x15b0('0x18')],'include':_0x4612c6[_0x15b0('0x1a')]?_['map'](_0x4612c6[_0x15b0('0x1a')],function(_0x1c5177){return{'model':db[_0x1c5177[_0x15b0('0x1b')]],'as':_0x1c5177['as'],'attributes':_0x1c5177['attributes'],'include':_0x1c5177[_0x15b0('0x1a')]?_[_0x15b0('0x1c')](_0x1c5177[_0x15b0('0x1a')],function(_0x2f5a29){return{'model':db[_0x2f5a29[_0x15b0('0x1b')]],'as':_0x2f5a29['as'],'attributes':_0x2f5a29['attributes']};}):[]};}):[]};}):[]:[]})[_0x15b0('0xb')](function(_0x4482b9){logger[_0x15b0('0xc')](_0x15b0('0x14'),_0x46bb17);logger[_0x15b0('0xe')](_0x15b0('0x14'),_0x46bb17,JSON['stringify'](_0x4482b9));_0xb8c92b(_0x4482b9);})['catch'](function(_0x30c499){logger[_0x15b0('0x10')]('GetCmHopper',_0x30c499[_0x15b0('0x12')],_0x46bb17);_0x252266(_0x5b830c[_0x15b0('0x10')](0x1f4,_0x30c499[_0x15b0('0x12')]));});});};exports[_0x15b0('0x1d')]=function(_0x122950){var _0x5f278d=this;return new Promise(function(_0x433105,_0x2ee577){return db[_0x15b0('0x1e')][_0x15b0('0x1f')]({'raw':_0x122950[_0x15b0('0x16')]?_0x122950[_0x15b0('0x16')][_0x15b0('0x17')]===undefined?!![]:![]:!![],'where':_0x122950['options']?_0x122950[_0x15b0('0x16')][_0x15b0('0x20')]||null:null,'attributes':_0x122950['options']?_0x122950[_0x15b0('0x16')][_0x15b0('0x18')]||null:null,'include':_0x122950[_0x15b0('0x16')]?_0x122950[_0x15b0('0x16')][_0x15b0('0x1a')]?_['map'](_0x122950['options']['include'],function(_0x422f59){return{'model':db[_0x422f59['model']],'as':_0x422f59['as'],'attributes':_0x422f59[_0x15b0('0x18')],'include':_0x422f59[_0x15b0('0x1a')]?_['map'](_0x422f59[_0x15b0('0x1a')],function(_0x38f50d){return{'model':db[_0x38f50d[_0x15b0('0x1b')]],'as':_0x38f50d['as'],'attributes':_0x38f50d['attributes'],'include':_0x38f50d['include']?_[_0x15b0('0x1c')](_0x38f50d[_0x15b0('0x1a')],function(_0x56029f){return{'model':db[_0x56029f[_0x15b0('0x1b')]],'as':_0x56029f['as'],'attributes':_0x56029f[_0x15b0('0x18')]};}):[]};}):[]};}):[]:[]})[_0x15b0('0xb')](function(_0x3568e8){logger[_0x15b0('0xc')](_0x15b0('0x1d'),_0x122950);logger[_0x15b0('0xe')](_0x15b0('0x1d'),_0x122950,JSON['stringify'](_0x3568e8));_0x433105(_0x3568e8);})[_0x15b0('0x21')](function(_0x5f3af3){logger[_0x15b0('0x10')]('ShowCmHopper',_0x5f3af3[_0x15b0('0x12')],_0x122950);_0x2ee577(_0x5f278d[_0x15b0('0x10')](0x1f4,_0x5f3af3[_0x15b0('0x12')]));});});};exports[_0x15b0('0x22')]=function(_0x5f026a){var _0x2ed18b=this;return new Promise(function(_0x5d3aa8,_0x2cfc34){return db[_0x15b0('0x1e')][_0x15b0('0x23')](_0x5f026a[_0x15b0('0x24')],{'raw':_0x5f026a['options']?_0x5f026a[_0x15b0('0x16')][_0x15b0('0x17')]===undefined?!![]:![]:!![]})[_0x15b0('0xb')](function(_0x5137cd){logger[_0x15b0('0xc')]('CreateCmHopper',_0x5f026a);logger[_0x15b0('0xe')](_0x15b0('0x22'),_0x5f026a,JSON[_0x15b0('0xf')](_0x5137cd));_0x5d3aa8(_0x5137cd);})[_0x15b0('0x21')](function(_0x372622){logger['error'](_0x15b0('0x22'),_0x372622[_0x15b0('0x12')],_0x5f026a);_0x2cfc34(_0x2ed18b[_0x15b0('0x10')](0x1f4,_0x372622[_0x15b0('0x12')]));});});};exports['UpdateCmHopper']=function(_0x4a9d25){var _0x535f14=this;return new Promise(function(_0x44255f,_0x8053ac){return db[_0x15b0('0x1e')][_0x15b0('0x25')](_0x4a9d25[_0x15b0('0x24')],{'raw':_0x4a9d25[_0x15b0('0x16')]?_0x4a9d25['options'][_0x15b0('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a9d25[_0x15b0('0x16')]?_0x4a9d25['options'][_0x15b0('0x20')]||null:null,'attributes':_0x4a9d25['options']?_0x4a9d25[_0x15b0('0x16')][_0x15b0('0x18')]||null:null,'limit':_0x4a9d25[_0x15b0('0x16')]?_0x4a9d25[_0x15b0('0x16')][_0x15b0('0x19')]||null:null})['then'](function(_0x108ee1){logger[_0x15b0('0xc')](_0x15b0('0x26'),_0x4a9d25);logger[_0x15b0('0xe')](_0x15b0('0x26'),_0x4a9d25,JSON['stringify'](_0x108ee1));_0x44255f(_0x108ee1);})[_0x15b0('0x21')](function(_0x101c8c){logger['error'](_0x15b0('0x26'),_0x101c8c['message'],_0x4a9d25);_0x8053ac(_0x535f14['error'](0x1f4,_0x101c8c[_0x15b0('0x12')]));});});};exports['DestroyCmHopper']=function(_0xdc686d){var _0x50aa5a=this;return new Promise(function(_0x2b4b81,_0x46a6c3){return db[_0x15b0('0x1e')][_0x15b0('0x27')]({'where':_0xdc686d['options']?_0xdc686d['options'][_0x15b0('0x20')]||null:null})[_0x15b0('0xb')](function(_0x2bcef4){logger[_0x15b0('0xc')](_0x15b0('0x28'),_0xdc686d);logger['debug']('DestroyCmHopper',_0xdc686d,JSON[_0x15b0('0xf')](_0x2bcef4));_0x2b4b81(_0x2bcef4);})[_0x15b0('0x21')](function(_0x232cac){logger[_0x15b0('0x10')](_0x15b0('0x28'),_0x232cac['message'],_0xdc686d);_0x46a6c3(_0x50aa5a[_0x15b0('0x10')](0x1f4,_0x232cac[_0x15b0('0x12')]));});});};exports[_0x15b0('0x29')]=function(_0x37df99){var _0x25c8f5=this;return new Promise(function(_0x2ea3c3,_0x1ac6b8){return db[_0x15b0('0x2a')][_0x15b0('0x2b')]()[_0x15b0('0xb')](function(_0x2f740a){return db[_0x15b0('0x2c')][_0x15b0('0x2d')](function(_0x387195){return db[_0x15b0('0x1e')]['findAll']({'where':_0x37df99[_0x15b0('0x16')]?_0x37df99[_0x15b0('0x16')]['where']||null:null,'attributes':_0x37df99[_0x15b0('0x16')]?_0x37df99['options'][_0x15b0('0x18')]||null:null,'limit':_0x37df99[_0x15b0('0x16')]?_0x37df99[_0x15b0('0x16')][_0x15b0('0x19')]||null:null,'order':_0x37df99[_0x15b0('0x16')]?_0x37df99['options'][_0x15b0('0x2e')]||null:null,'transaction':_0x387195,'lock':_0x387195[_0x15b0('0x2f')][_0x15b0('0x30')],'include':[{'model':db[_0x15b0('0x2a')],'as':_0x15b0('0x31'),'attributes':_[_0x15b0('0x32')](_0x2f740a)},{'model':db['User'],'as':_0x15b0('0x33'),'attributes':['id',_0x15b0('0x34'),'voicePause']}]})[_0x15b0('0xb')](function(_0x51fd6c){var _0x8d9fb9=[];var _0x40d2d3=[];for(var _0x3080b4=0x0;_0x3080b4<_0x51fd6c[_0x15b0('0x35')];_0x3080b4+=0x1){var _0x50517d=_0x51fd6c[_0x3080b4][_0x15b0('0x36')];if(_0x50517d===null){_0x8d9fb9[_0x15b0('0x37')](_0x51fd6c[_0x3080b4][_0x15b0('0x25')](_0x37df99[_0x15b0('0x24')],{'transaction':_0x387195}));}else if(!_0x40d2d3['includes'](_0x50517d)){_0x40d2d3[_0x15b0('0x37')](_0x50517d);_0x8d9fb9[_0x15b0('0x37')](_0x51fd6c[_0x3080b4][_0x15b0('0x25')](_0x37df99[_0x15b0('0x24')],{'transaction':_0x387195}));}}return BPromise[_0x15b0('0x38')](_0x8d9fb9);});})[_0x15b0('0xb')](function(_0x56d5ee){logger[_0x15b0('0xc')]('GetContactDialer',_0x37df99);logger[_0x15b0('0xe')](_0x15b0('0x29'),_0x37df99,JSON['stringify'](_0x56d5ee));_0x2ea3c3(_0x56d5ee);})[_0x15b0('0x21')](function(_0x11006b){logger['error'](_0x15b0('0x29'),_0x11006b[_0x15b0('0x12')],_0x37df99);_0x1ac6b8(_0x25c8f5[_0x15b0('0x10')](0x1f4,_0x11006b[_0x15b0('0x12')]));});});});};exports[_0x15b0('0x39')]=function(_0x10b725){var _0x596cd2=this;return new Promise(function(_0x7dd80e,_0x26a98){return db[_0x15b0('0x2c')]['transaction'](function(_0x4a3a11){return db['CmHopperFinal'][_0x15b0('0x23')](_0x10b725[_0x15b0('0x24')],{'raw':_0x10b725[_0x15b0('0x16')]?_0x10b725[_0x15b0('0x16')][_0x15b0('0x17')]===undefined?!![]:![]:!![],'transaction':_0x4a3a11})[_0x15b0('0xb')](function(){return db[_0x15b0('0x1e')][_0x15b0('0x27')]({'where':_0x10b725[_0x15b0('0x16')]?_0x10b725['options'][_0x15b0('0x20')]||null:null,'transaction':_0x4a3a11});});})['then'](function(_0x46489a){logger[_0x15b0('0xc')](_0x15b0('0x39'),_0x10b725);logger[_0x15b0('0xe')](_0x15b0('0x39'),_0x10b725,JSON['stringify'](_0x46489a));_0x7dd80e(_0x46489a);})[_0x15b0('0x21')](function(_0x6f4c5e){logger[_0x15b0('0x10')]('MoveContactManagedDialer',_0x6f4c5e[_0x15b0('0x12')],_0x10b725);_0x26a98(_0x596cd2[_0x15b0('0x10')](0x1f4,_0x6f4c5e[_0x15b0('0x12')]));});});};exports[_0x15b0('0x3a')]=function(_0x67cd57){var _0x33d3f4=this;return new Promise(function(_0x189bd8,_0x173220){return db[_0x15b0('0x1e')][_0x15b0('0x15')]({'raw':_0x67cd57['options']?_0x67cd57[_0x15b0('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x67cd57[_0x15b0('0x16')]?_0x67cd57[_0x15b0('0x16')][_0x15b0('0x20')]||null:null,'attributes':[[db[_0x15b0('0x2c')]['fn'](_0x15b0('0x3b'),db[_0x15b0('0x2c')]['fn']('IF',db['sequelize'][_0x15b0('0x3c')](_0x15b0('0x3d')+util['format'](_0x15b0('0x3e'),moment()['format'](_0x15b0('0x3f')))+_0x15b0('0x40')))),_0x15b0('0x41')]]})[_0x15b0('0xb')](function(_0x2e6e63){logger[_0x15b0('0xc')](_0x15b0('0x3a'),_0x67cd57);logger[_0x15b0('0xe')]('CountReScheduled',_0x67cd57,JSON[_0x15b0('0xf')](_0x2e6e63));_0x189bd8(_0x2e6e63);})[_0x15b0('0x21')](function(_0x2f2d2c){logger[_0x15b0('0x10')](_0x15b0('0x3a'),_0x2f2d2c[_0x15b0('0x12')],_0x67cd57);_0x173220(_0x33d3f4[_0x15b0('0x10')](0x1f4,_0x2f2d2c[_0x15b0('0x12')]));});});};exports[_0x15b0('0x42')]=function(_0x4c94d0){var _0x28f40a=this;return new Promise(function(_0x30a098,_0x325704){return db[_0x15b0('0x2a')][_0x15b0('0x2b')]()[_0x15b0('0xb')](function(_0x238f75){return db[_0x15b0('0x2c')]['transaction'](function(_0x1f5107){return db['CmHopper'][_0x15b0('0x15')]({'where':_0x4c94d0['options']?_0x4c94d0[_0x15b0('0x16')][_0x15b0('0x20')]||null:null,'attributes':_0x4c94d0[_0x15b0('0x16')]?_0x4c94d0[_0x15b0('0x16')][_0x15b0('0x18')]||null:null,'limit':0x1,'order':_0x4c94d0[_0x15b0('0x16')]?_0x4c94d0[_0x15b0('0x16')][_0x15b0('0x2e')]||null:null,'group':db[_0x15b0('0x1e')]['UserId'],'transaction':_0x1f5107,'lock':_0x1f5107[_0x15b0('0x2f')][_0x15b0('0x30')],'include':_0x4c94d0[_0x15b0('0x16')]?_0x4c94d0['options']['include']?_['map'](_0x4c94d0[_0x15b0('0x16')][_0x15b0('0x1a')],function(_0x39a3f8){return{'model':db[_0x39a3f8[_0x15b0('0x1b')]],'as':_0x39a3f8['as'],'attributes':_0x39a3f8['attributes'],'include':_0x39a3f8[_0x15b0('0x1a')]?_[_0x15b0('0x1c')](_0x39a3f8[_0x15b0('0x1a')],function(_0x4e4c25){return{'model':db[_0x4e4c25['model']],'as':_0x4e4c25['as'],'attributes':_0x4e4c25[_0x15b0('0x18')],'include':_0x4e4c25[_0x15b0('0x1a')]?_[_0x15b0('0x1c')](_0x4e4c25['include'],function(_0x3f956b){return{'model':db[_0x3f956b[_0x15b0('0x1b')]],'as':_0x3f956b['as'],'attributes':_0x3f956b[_0x15b0('0x18')]};}):[]};}):[]};}):[]:[]})[_0x15b0('0xb')](function(_0xd2986b){var _0x5489e0=[];for(var _0xed626=0x0;_0xed626<_0xd2986b[_0x15b0('0x35')];_0xed626+=0x1){_0x5489e0[_0x15b0('0x37')](_0xd2986b[_0xed626][_0x15b0('0x25')](_0x4c94d0['body'],{'transaction':_0x1f5107}));}return BPromise[_0x15b0('0x38')](_0x5489e0);});})[_0x15b0('0xb')](function(_0x278524){logger['info'](_0x15b0('0x42'),_0x4c94d0);logger['debug'](_0x15b0('0x42'),_0x4c94d0,JSON['stringify'](_0x278524));_0x30a098(_0x278524);})[_0x15b0('0x21')](function(_0x3720ea){logger[_0x15b0('0x10')](_0x15b0('0x42'),_0x3720ea['message'],_0x4c94d0);_0x325704(_0x28f40a['error'](0x1f4,_0x3720ea[_0x15b0('0x12')]));});});});};exports[_0x15b0('0x43')]=function(_0x568e84){var _0x242e6c=this;return new Promise(function(_0x17e001,_0x2f2be1){db['CmContact'][_0x15b0('0x2b')]()['then'](function(_0x249556){return db[_0x15b0('0x1e')]['findAll']({'raw':_0x568e84[_0x15b0('0x16')]?_0x568e84[_0x15b0('0x16')][_0x15b0('0x17')]===undefined?!![]:![]:!![],'where':_0x568e84['options']?_0x568e84[_0x15b0('0x16')][_0x15b0('0x20')]||null:null,'attributes':_0x568e84[_0x15b0('0x16')]?_0x568e84[_0x15b0('0x16')][_0x15b0('0x18')]||null:null,'limit':_0x568e84[_0x15b0('0x16')]?_0x568e84[_0x15b0('0x16')][_0x15b0('0x19')]||null:null,'include':_0x568e84['options']?_0x568e84['options'][_0x15b0('0x1a')]?_[_0x15b0('0x1c')](_0x568e84[_0x15b0('0x16')][_0x15b0('0x1a')],function(_0x26690c){return{'model':db[_0x26690c[_0x15b0('0x1b')]],'as':_0x26690c['as'],'attributes':_0x26690c['as']==='Contact'?_['keys'](_0x249556):_0x26690c[_0x15b0('0x18')],'include':_0x26690c[_0x15b0('0x1a')]?_[_0x15b0('0x1c')](_0x26690c[_0x15b0('0x1a')],function(_0x5525bd){return{'model':db[_0x5525bd['model']],'as':_0x5525bd['as'],'attributes':_0x5525bd[_0x15b0('0x18')],'include':_0x5525bd[_0x15b0('0x1a')]?_['map'](_0x5525bd[_0x15b0('0x1a')],function(_0x31d5e8){return{'model':db[_0x31d5e8[_0x15b0('0x1b')]],'as':_0x31d5e8['as'],'attributes':_0x31d5e8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b3045){logger['info'](_0x15b0('0x14'),_0x568e84);logger[_0x15b0('0xe')](_0x15b0('0x14'),_0x568e84,JSON['stringify'](_0x1b3045));_0x17e001(_0x1b3045);})[_0x15b0('0x21')](function(_0x3da1fb){logger[_0x15b0('0x10')](_0x15b0('0x14'),_0x3da1fb[_0x15b0('0x12')],_0x568e84);_0x2f2be1(_0x242e6c[_0x15b0('0x10')](0x1f4,_0x3da1fb[_0x15b0('0x12')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index a1f2d4d..7d3bc91 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 _0x1aa3=['getOpenContacts','show','post','/preview','getPreview','put','/:id','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','/describe','describe','/opencontacts'];(function(_0x47f587,_0x33ec3a){var _0x2a26d3=function(_0x3154f0){while(--_0x3154f0){_0x47f587['push'](_0x47f587['shift']());}};_0x2a26d3(++_0x33ec3a);}(_0x1aa3,0x7d));var _0x31aa=function(_0x3cdcbe,_0x450f7b){_0x3cdcbe=_0x3cdcbe-0x0;var _0x5846a1=_0x1aa3[_0x3cdcbe];return _0x5846a1;};'use strict';var multer=require(_0x31aa('0x0'));var util=require(_0x31aa('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x31aa('0x2'));var router=express['Router']();var fs_extra=require(_0x31aa('0x3'));var auth=require(_0x31aa('0x4'));var interaction=require(_0x31aa('0x5'));var config=require(_0x31aa('0x6'));var controller=require(_0x31aa('0x7'));router[_0x31aa('0x8')]('/',auth[_0x31aa('0x9')](),controller['index']);router[_0x31aa('0x8')](_0x31aa('0xa'),auth['isAuthenticated'](),controller[_0x31aa('0xb')]);router[_0x31aa('0x8')](_0x31aa('0xc'),auth['isAuthenticated'](),controller[_0x31aa('0xd')]);router[_0x31aa('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x31aa('0xe')]);router[_0x31aa('0xf')]('/',auth[_0x31aa('0x9')](),controller['create']);router[_0x31aa('0xf')](_0x31aa('0x10'),auth['isAuthenticated'](),controller[_0x31aa('0x11')]);router[_0x31aa('0x12')](_0x31aa('0x13'),auth[_0x31aa('0x9')](),controller['update']);router[_0x31aa('0x14')]('/:id',auth[_0x31aa('0x9')](),controller[_0x31aa('0x15')]);module[_0x31aa('0x16')]=router; \ No newline at end of file +var _0xf88e=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','/:id','create','post','/preview','getPreview','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x14a176,_0x14f1f8){var _0x5d470f=function(_0x105e97){while(--_0x105e97){_0x14a176['push'](_0x14a176['shift']());}};_0x5d470f(++_0x14f1f8);}(_0xf88e,0x14b));var _0xef88=function(_0x2c8448,_0x28ae68){_0x2c8448=_0x2c8448-0x0;var _0x385b3a=_0xf88e[_0x2c8448];return _0x385b3a;};'use strict';var multer=require(_0xef88('0x0'));var util=require(_0xef88('0x1'));var path=require(_0xef88('0x2'));var timeout=require(_0xef88('0x3'));var express=require(_0xef88('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xef88('0x5'));var interaction=require(_0xef88('0x6'));var config=require(_0xef88('0x7'));var controller=require('./cmHopper.controller');router[_0xef88('0x8')]('/',auth[_0xef88('0x9')](),controller[_0xef88('0xa')]);router['get'](_0xef88('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xef88('0x8')](_0xef88('0xc'),auth[_0xef88('0x9')](),controller[_0xef88('0xd')]);router[_0xef88('0x8')](_0xef88('0xe'),auth[_0xef88('0x9')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xef88('0xf')]);router[_0xef88('0x10')](_0xef88('0x11'),auth[_0xef88('0x9')](),controller[_0xef88('0x12')]);router[_0xef88('0x13')](_0xef88('0xe'),auth[_0xef88('0x9')](),controller[_0xef88('0x14')]);router[_0xef88('0x15')]('/:id',auth[_0xef88('0x9')](),controller[_0xef88('0x16')]);module[_0xef88('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 2eb71a7..ade9440 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 _0x7d55=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x3f246b,_0xd399bd){var _0x10d846=function(_0x455002){while(--_0x455002){_0x3f246b['push'](_0x3f246b['shift']());}};_0x10d846(++_0xd399bd);}(_0x7d55,0x1bc));var _0x57d5=function(_0x311685,_0x2ea661){_0x311685=_0x311685-0x0;var _0x5ea29e=_0x7d55[_0x311685];return _0x5ea29e;};'use strict';var moment=require(_0x57d5('0x0'));var Sequelize=require(_0x57d5('0x1'));module[_0x57d5('0x2')]={'phone':{'type':Sequelize[_0x57d5('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x57d5('0x4')],'unique':_0x57d5('0x5')},'VoiceQueueId':{'type':Sequelize[_0x57d5('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x90b5=['STRING','INTEGER','contactListQueue','moment','exports'];(function(_0x1e0c0e,_0x5ccb80){var _0x53fecc=function(_0x21145a){while(--_0x21145a){_0x1e0c0e['push'](_0x1e0c0e['shift']());}};_0x53fecc(++_0x5ccb80);}(_0x90b5,0x139));var _0x590b=function(_0x156282,_0x15aa54){_0x156282=_0x156282-0x0;var _0x401672=_0x90b5[_0x156282];return _0x401672;};'use strict';var moment=require(_0x590b('0x0'));var Sequelize=require('sequelize');module[_0x590b('0x1')]={'phone':{'type':Sequelize[_0x590b('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x590b('0x3')],'unique':_0x590b('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x590b('0x3')],'unique':_0x590b('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index a9166c7..2e7ad70 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 _0x07c9=['apply','save','destroy','then','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filters','merge','filter','options','includeAll','include','findAll','rows','catch','params','find','update','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set'];(function(_0x15f8dd,_0xd65352){var _0x1b48f7=function(_0x26d68e){while(--_0x26d68e){_0x15f8dd['push'](_0x15f8dd['shift']());}};_0x1b48f7(++_0xd65352);}(_0x07c9,0x6f));var _0x907c=function(_0x1206e0,_0x21f7b9){_0x1206e0=_0x1206e0-0x0;var _0x1d002f=_0x07c9[_0x1206e0];return _0x1d002f;};'use strict';var emlformat=require(_0x907c('0x0'));var rimraf=require(_0x907c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x907c('0x2'));var rp=require(_0x907c('0x3'));var moment=require(_0x907c('0x4'));var BPromise=require(_0x907c('0x5'));var Mustache=require(_0x907c('0x6'));var util=require(_0x907c('0x7'));var path=require(_0x907c('0x8'));var sox=require(_0x907c('0x9'));var csv=require(_0x907c('0xa'));var ejs=require(_0x907c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x907c('0xc'));var squel=require(_0x907c('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x907c('0xe'));var toCsv=require(_0x907c('0xa'));var querystring=require(_0x907c('0xf'));var Papa=require(_0x907c('0x10'));var Redis=require(_0x907c('0x11'));var authService=require(_0x907c('0x12'));var qs=require(_0x907c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x907c('0x14'))('api');var utils=require(_0x907c('0x15'));var config=require(_0x907c('0x16'));var licenseUtil=require(_0x907c('0x17'));var db=require(_0x907c('0x18'))['db'];function respondWithStatusCode(_0x4a6449,_0x35ba40){_0x35ba40=_0x35ba40||0xcc;return function(_0x4e252d){if(_0x4e252d){return _0x4a6449[_0x907c('0x19')](_0x35ba40);}return _0x4a6449[_0x907c('0x1a')](_0x35ba40)[_0x907c('0x1b')]();};}function respondWithResult(_0xcaabb9,_0x1a2c47){_0x1a2c47=_0x1a2c47||0xc8;return function(_0x4f2f69){if(_0x4f2f69){return _0xcaabb9['status'](_0x1a2c47)[_0x907c('0x1c')](_0x4f2f69);}};}function respondWithFilteredResult(_0x5dbd92,_0x5da4ec){return function(_0x24beb4){if(_0x24beb4){var _0x2c6aa9=typeof _0x5da4ec['offset']==='undefined'&&typeof _0x5da4ec[_0x907c('0x1d')]==='undefined';var _0x20a9c6=_0x24beb4[_0x907c('0x1e')];var _0x37cd38=_0x2c6aa9?0x0:_0x5da4ec[_0x907c('0x1f')];var _0x3f43ff=_0x2c6aa9?_0x24beb4[_0x907c('0x1e')]:_0x5da4ec[_0x907c('0x1f')]+_0x5da4ec[_0x907c('0x1d')];var _0x2f65a2;if(_0x3f43ff>=_0x20a9c6){_0x3f43ff=_0x20a9c6;_0x2f65a2=0xc8;}else{_0x2f65a2=0xce;}_0x5dbd92[_0x907c('0x1a')](_0x2f65a2);return _0x5dbd92[_0x907c('0x20')]('Content-Range',_0x37cd38+'-'+_0x3f43ff+'/'+_0x20a9c6)[_0x907c('0x1c')](_0x24beb4);}return null;};}function patchUpdates(_0x4fb8e9){return function(_0x4dee41){try{jsonpatch[_0x907c('0x21')](_0x4dee41,_0x4fb8e9,!![]);}catch(_0x4004c1){return BPromise['reject'](_0x4004c1);}return _0x4dee41[_0x907c('0x22')]();};}function saveUpdates(_0x6bc4fa,_0x4b2d2e){return function(_0x48f82a){if(_0x48f82a){return _0x48f82a['update'](_0x6bc4fa)['then'](function(_0x4fc97d){return _0x4fc97d;});}return null;};}function removeEntity(_0x18e8a8,_0xdeecde){return function(_0x3f56ad){if(_0x3f56ad){return _0x3f56ad[_0x907c('0x23')]()[_0x907c('0x24')](function(){_0x18e8a8[_0x907c('0x1a')](0xcc)[_0x907c('0x1b')]();});}};}function handleEntityNotFound(_0x1da8da,_0x38a55b){return function(_0x329895){if(!_0x329895){_0x1da8da[_0x907c('0x19')](0x194);}return _0x329895;};}function handleError(_0x1d3c55,_0x5c14f4){_0x5c14f4=_0x5c14f4||0x1f4;return function(_0x576304){logger[_0x907c('0x25')](_0x576304[_0x907c('0x26')]);if(_0x576304[_0x907c('0x27')]){delete _0x576304[_0x907c('0x27')];}_0x1d3c55['status'](_0x5c14f4)[_0x907c('0x28')](_0x576304);};}exports[_0x907c('0x29')]=function(_0x2d23cd,_0x5ee598){var _0x5da345={},_0x3171c4={},_0x530a1d={'count':0x0,'rows':[]};var _0x5b58ee=_[_0x907c('0x2a')](db[_0x907c('0x2b')][_0x907c('0x2c')],function(_0x102388){return{'name':_0x102388[_0x907c('0x2d')],'type':_0x102388[_0x907c('0x2e')]['key']};});_0x3171c4[_0x907c('0x2f')]=_[_0x907c('0x2a')](_0x5b58ee,_0x907c('0x27'));_0x3171c4[_0x907c('0x30')]=_[_0x907c('0x31')](_0x2d23cd[_0x907c('0x30')]);_0x3171c4['filters']=_['intersection'](_0x3171c4[_0x907c('0x2f')],_0x3171c4['query']);_0x5da345[_0x907c('0x32')]=_[_0x907c('0x33')](_0x3171c4[_0x907c('0x2f')],qs[_0x907c('0x34')](_0x2d23cd[_0x907c('0x30')][_0x907c('0x34')]));_0x5da345[_0x907c('0x32')]=_0x5da345[_0x907c('0x32')][_0x907c('0x35')]?_0x5da345['attributes']:_0x3171c4['model'];if(!_0x2d23cd[_0x907c('0x30')][_0x907c('0x36')]('nolimit')){_0x5da345[_0x907c('0x1d')]=qs['limit'](_0x2d23cd['query'][_0x907c('0x1d')]);_0x5da345[_0x907c('0x1f')]=qs['offset'](_0x2d23cd['query'][_0x907c('0x1f')]);}_0x5da345['order']=qs[_0x907c('0x37')](_0x2d23cd['query'][_0x907c('0x37')]);_0x5da345[_0x907c('0x38')]=qs['filters'](_[_0x907c('0x39')](_0x2d23cd[_0x907c('0x30')],_0x3171c4[_0x907c('0x3a')]),_0x5b58ee);if(_0x2d23cd[_0x907c('0x30')]['filter']){_0x5da345['where']=_[_0x907c('0x3b')](_0x5da345[_0x907c('0x38')],{'$or':_[_0x907c('0x2a')](_0x5b58ee,function(_0x5526f1){if(_0x5526f1['type']!=='VIRTUAL'){var _0x51951e={};_0x51951e[_0x5526f1['name']]={'$like':'%'+_0x2d23cd['query'][_0x907c('0x3c')]+'%'};return _0x51951e;}})});}_0x5da345=_['merge']({},_0x5da345,_0x2d23cd[_0x907c('0x3d')]);var _0x4f3c84={'where':_0x5da345[_0x907c('0x38')]};return db[_0x907c('0x2b')][_0x907c('0x1e')](_0x4f3c84)['then'](function(_0x2159c4){_0x530a1d[_0x907c('0x1e')]=_0x2159c4;if(_0x2d23cd[_0x907c('0x30')][_0x907c('0x3e')]){_0x5da345[_0x907c('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x907c('0x40')](_0x5da345);})[_0x907c('0x24')](function(_0x5e60ee){_0x530a1d[_0x907c('0x41')]=_0x5e60ee;return _0x530a1d;})[_0x907c('0x24')](respondWithFilteredResult(_0x5ee598,_0x5da345))[_0x907c('0x42')](handleError(_0x5ee598,null));};exports['show']=function(_0x57c278,_0x12c632){var _0x3d3bb4={'raw':!![],'where':{'id':_0x57c278[_0x907c('0x43')]['id']}},_0x261610={};_0x261610[_0x907c('0x2f')]=_[_0x907c('0x31')](db[_0x907c('0x2b')][_0x907c('0x2c')]);_0x261610[_0x907c('0x30')]=_[_0x907c('0x31')](_0x57c278[_0x907c('0x30')]);_0x261610['filters']=_['intersection'](_0x261610['model'],_0x261610['query']);_0x3d3bb4[_0x907c('0x32')]=_['intersection'](_0x261610[_0x907c('0x2f')],qs[_0x907c('0x34')](_0x57c278[_0x907c('0x30')]['fields']));_0x3d3bb4[_0x907c('0x32')]=_0x3d3bb4[_0x907c('0x32')][_0x907c('0x35')]?_0x3d3bb4['attributes']:_0x261610[_0x907c('0x2f')];if(_0x57c278[_0x907c('0x30')][_0x907c('0x3e')]){_0x3d3bb4[_0x907c('0x3f')]=[{'all':!![]}];}_0x3d3bb4=_[_0x907c('0x3b')]({},_0x3d3bb4,_0x57c278[_0x907c('0x3d')]);return db[_0x907c('0x2b')][_0x907c('0x44')](_0x3d3bb4)[_0x907c('0x24')](handleEntityNotFound(_0x12c632,null))['then'](respondWithResult(_0x12c632,null))['catch'](handleError(_0x12c632,null));};exports[_0x907c('0x45')]=function(_0x1cfdb7,_0x55439c){if(_0x1cfdb7[_0x907c('0x46')]['id']){delete _0x1cfdb7[_0x907c('0x46')]['id'];}return db[_0x907c('0x2b')][_0x907c('0x44')]({'where':{'id':_0x1cfdb7[_0x907c('0x43')]['id']}})[_0x907c('0x24')](handleEntityNotFound(_0x55439c,null))[_0x907c('0x24')](saveUpdates(_0x1cfdb7['body'],null))[_0x907c('0x24')](respondWithResult(_0x55439c,null))['catch'](handleError(_0x55439c,null));};exports[_0x907c('0x23')]=function(_0x571f84,_0x4dfc37){return db['CmHopperBlack'][_0x907c('0x44')]({'where':{'id':_0x571f84[_0x907c('0x43')]['id']}})[_0x907c('0x24')](handleEntityNotFound(_0x4dfc37,null))[_0x907c('0x24')](removeEntity(_0x4dfc37,null))[_0x907c('0x42')](handleError(_0x4dfc37,null));};exports['describe']=function(_0x26241c,_0x1d30f6){return db[_0x907c('0x2b')][_0x907c('0x47')]()['then'](respondWithResult(_0x1d30f6,null))[_0x907c('0x42')](handleError(_0x1d30f6,null));}; \ No newline at end of file +var _0xf2a0=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','map','CmHopperBlack','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','find','body','params','describe','rimraf','zip-dir'];(function(_0x289929,_0x3c4fd4){var _0x515489=function(_0x1e7b19){while(--_0x1e7b19){_0x289929['push'](_0x289929['shift']());}};_0x515489(++_0x3c4fd4);}(_0xf2a0,0x88));var _0x0f2a=function(_0x313dab,_0x53179c){_0x313dab=_0x313dab-0x0;var _0x18ee37=_0xf2a0[_0x313dab];return _0x18ee37;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f2a('0x0'));var zipdir=require(_0x0f2a('0x1'));var jsonpatch=require(_0x0f2a('0x2'));var rp=require(_0x0f2a('0x3'));var moment=require(_0x0f2a('0x4'));var BPromise=require(_0x0f2a('0x5'));var Mustache=require(_0x0f2a('0x6'));var util=require(_0x0f2a('0x7'));var path=require(_0x0f2a('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0f2a('0x9'));var fs=require('fs');var fs_extra=require(_0x0f2a('0xa'));var _=require('lodash');var squel=require(_0x0f2a('0xb'));var crypto=require(_0x0f2a('0xc'));var jsforce=require(_0x0f2a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0f2a('0xe'));var Papa=require(_0x0f2a('0xf'));var Redis=require(_0x0f2a('0x10'));var authService=require(_0x0f2a('0x11'));var qs=require(_0x0f2a('0x12'));var as=require(_0x0f2a('0x13'));var hardwareService=require(_0x0f2a('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0f2a('0x15'));var licenseUtil=require(_0x0f2a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43cf09,_0x289bdf){_0x289bdf=_0x289bdf||0xcc;return function(_0x377f9e){if(_0x377f9e){return _0x43cf09[_0x0f2a('0x17')](_0x289bdf);}return _0x43cf09['status'](_0x289bdf)[_0x0f2a('0x18')]();};}function respondWithResult(_0x2905d1,_0x3eb5e8){_0x3eb5e8=_0x3eb5e8||0xc8;return function(_0x5c7ae1){if(_0x5c7ae1){return _0x2905d1[_0x0f2a('0x19')](_0x3eb5e8)[_0x0f2a('0x1a')](_0x5c7ae1);}};}function respondWithFilteredResult(_0xe6870d,_0x28114c){return function(_0x2a3fc5){if(_0x2a3fc5){var _0x4ba06f=typeof _0x28114c[_0x0f2a('0x1b')]===_0x0f2a('0x1c')&&typeof _0x28114c[_0x0f2a('0x1d')]===_0x0f2a('0x1c');var _0x2b65d0=_0x2a3fc5[_0x0f2a('0x1e')];var _0x326c9a=_0x4ba06f?0x0:_0x28114c['offset'];var _0x3920ae=_0x4ba06f?_0x2a3fc5[_0x0f2a('0x1e')]:_0x28114c[_0x0f2a('0x1b')]+_0x28114c[_0x0f2a('0x1d')];var _0x314cc5;if(_0x3920ae>=_0x2b65d0){_0x3920ae=_0x2b65d0;_0x314cc5=0xc8;}else{_0x314cc5=0xce;}_0xe6870d[_0x0f2a('0x19')](_0x314cc5);return _0xe6870d[_0x0f2a('0x1f')]('Content-Range',_0x326c9a+'-'+_0x3920ae+'/'+_0x2b65d0)['json'](_0x2a3fc5);}return null;};}function patchUpdates(_0x19ef09){return function(_0x7cdc4a){try{jsonpatch['apply'](_0x7cdc4a,_0x19ef09,!![]);}catch(_0x2003cd){return BPromise[_0x0f2a('0x20')](_0x2003cd);}return _0x7cdc4a[_0x0f2a('0x21')]();};}function saveUpdates(_0x40e066,_0x527a58){return function(_0xd94aeb){if(_0xd94aeb){return _0xd94aeb[_0x0f2a('0x22')](_0x40e066)[_0x0f2a('0x23')](function(_0x41f6a9){return _0x41f6a9;});}return null;};}function removeEntity(_0x216ed3,_0xf2f553){return function(_0x2f8308){if(_0x2f8308){return _0x2f8308[_0x0f2a('0x24')]()['then'](function(){_0x216ed3[_0x0f2a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x392c4b,_0x7c93ef){return function(_0x3ea2ba){if(!_0x3ea2ba){_0x392c4b[_0x0f2a('0x17')](0x194);}return _0x3ea2ba;};}function handleError(_0x532865,_0x390af6){_0x390af6=_0x390af6||0x1f4;return function(_0x417874){logger[_0x0f2a('0x25')](_0x417874[_0x0f2a('0x26')]);if(_0x417874[_0x0f2a('0x27')]){delete _0x417874[_0x0f2a('0x27')];}_0x532865[_0x0f2a('0x19')](_0x390af6)['send'](_0x417874);};}exports['index']=function(_0x367bca,_0x25a915){var _0x45c936={},_0x398912={},_0x483e65={'count':0x0,'rows':[]};var _0x210fd4=_[_0x0f2a('0x28')](db[_0x0f2a('0x29')][_0x0f2a('0x2a')],function(_0x24b480){return{'name':_0x24b480[_0x0f2a('0x2b')],'type':_0x24b480['type'][_0x0f2a('0x2c')]};});_0x398912[_0x0f2a('0x2d')]=_['map'](_0x210fd4,'name');_0x398912['query']=_[_0x0f2a('0x2e')](_0x367bca[_0x0f2a('0x2f')]);_0x398912[_0x0f2a('0x30')]=_[_0x0f2a('0x31')](_0x398912[_0x0f2a('0x2d')],_0x398912[_0x0f2a('0x2f')]);_0x45c936[_0x0f2a('0x32')]=_[_0x0f2a('0x31')](_0x398912[_0x0f2a('0x2d')],qs[_0x0f2a('0x33')](_0x367bca[_0x0f2a('0x2f')][_0x0f2a('0x33')]));_0x45c936[_0x0f2a('0x32')]=_0x45c936[_0x0f2a('0x32')]['length']?_0x45c936['attributes']:_0x398912[_0x0f2a('0x2d')];if(!_0x367bca[_0x0f2a('0x2f')][_0x0f2a('0x34')](_0x0f2a('0x35'))){_0x45c936[_0x0f2a('0x1d')]=qs[_0x0f2a('0x1d')](_0x367bca[_0x0f2a('0x2f')]['limit']);_0x45c936['offset']=qs['offset'](_0x367bca[_0x0f2a('0x2f')][_0x0f2a('0x1b')]);}_0x45c936[_0x0f2a('0x36')]=qs[_0x0f2a('0x37')](_0x367bca['query'][_0x0f2a('0x37')]);_0x45c936[_0x0f2a('0x38')]=qs[_0x0f2a('0x30')](_[_0x0f2a('0x39')](_0x367bca[_0x0f2a('0x2f')],_0x398912['filters']),_0x210fd4);if(_0x367bca[_0x0f2a('0x2f')]['filter']){_0x45c936['where']=_['merge'](_0x45c936[_0x0f2a('0x38')],{'$or':_[_0x0f2a('0x28')](_0x210fd4,function(_0x22b528){if(_0x22b528['type']!=='VIRTUAL'){var _0x3025e1={};_0x3025e1[_0x22b528['name']]={'$like':'%'+_0x367bca['query'][_0x0f2a('0x3a')]+'%'};return _0x3025e1;}})});}_0x45c936=_[_0x0f2a('0x3b')]({},_0x45c936,_0x367bca[_0x0f2a('0x3c')]);var _0x28ca18={'where':_0x45c936[_0x0f2a('0x38')]};return db[_0x0f2a('0x29')][_0x0f2a('0x1e')](_0x28ca18)[_0x0f2a('0x23')](function(_0x35abdb){_0x483e65[_0x0f2a('0x1e')]=_0x35abdb;if(_0x367bca['query']['includeAll']){_0x45c936[_0x0f2a('0x3d')]=[{'all':!![]}];}return db[_0x0f2a('0x29')][_0x0f2a('0x3e')](_0x45c936);})[_0x0f2a('0x23')](function(_0x525207){_0x483e65[_0x0f2a('0x3f')]=_0x525207;return _0x483e65;})['then'](respondWithFilteredResult(_0x25a915,_0x45c936))[_0x0f2a('0x40')](handleError(_0x25a915,null));};exports['show']=function(_0x401aa7,_0x12de9f){var _0x327be9={'raw':!![],'where':{'id':_0x401aa7['params']['id']}},_0x38fd1e={};_0x38fd1e[_0x0f2a('0x2d')]=_[_0x0f2a('0x2e')](db[_0x0f2a('0x29')][_0x0f2a('0x2a')]);_0x38fd1e[_0x0f2a('0x2f')]=_[_0x0f2a('0x2e')](_0x401aa7[_0x0f2a('0x2f')]);_0x38fd1e[_0x0f2a('0x30')]=_['intersection'](_0x38fd1e[_0x0f2a('0x2d')],_0x38fd1e[_0x0f2a('0x2f')]);_0x327be9[_0x0f2a('0x32')]=_[_0x0f2a('0x31')](_0x38fd1e[_0x0f2a('0x2d')],qs[_0x0f2a('0x33')](_0x401aa7[_0x0f2a('0x2f')][_0x0f2a('0x33')]));_0x327be9[_0x0f2a('0x32')]=_0x327be9[_0x0f2a('0x32')]['length']?_0x327be9['attributes']:_0x38fd1e[_0x0f2a('0x2d')];if(_0x401aa7[_0x0f2a('0x2f')]['includeAll']){_0x327be9[_0x0f2a('0x3d')]=[{'all':!![]}];}_0x327be9=_[_0x0f2a('0x3b')]({},_0x327be9,_0x401aa7[_0x0f2a('0x3c')]);return db['CmHopperBlack'][_0x0f2a('0x41')](_0x327be9)[_0x0f2a('0x23')](handleEntityNotFound(_0x12de9f,null))['then'](respondWithResult(_0x12de9f,null))[_0x0f2a('0x40')](handleError(_0x12de9f,null));};exports[_0x0f2a('0x22')]=function(_0x44057c,_0x3f03e4){if(_0x44057c[_0x0f2a('0x42')]['id']){delete _0x44057c[_0x0f2a('0x42')]['id'];}return db[_0x0f2a('0x29')]['find']({'where':{'id':_0x44057c[_0x0f2a('0x43')]['id']}})[_0x0f2a('0x23')](handleEntityNotFound(_0x3f03e4,null))[_0x0f2a('0x23')](saveUpdates(_0x44057c['body'],null))['then'](respondWithResult(_0x3f03e4,null))[_0x0f2a('0x40')](handleError(_0x3f03e4,null));};exports['destroy']=function(_0x38a4f1,_0x15a7be){return db[_0x0f2a('0x29')][_0x0f2a('0x41')]({'where':{'id':_0x38a4f1['params']['id']}})['then'](handleEntityNotFound(_0x15a7be,null))[_0x0f2a('0x23')](removeEntity(_0x15a7be,null))[_0x0f2a('0x40')](handleError(_0x15a7be,null));};exports[_0x0f2a('0x44')]=function(_0x336005,_0x1d10b2){return db['CmHopperBlack']['describe']()[_0x0f2a('0x23')](respondWithResult(_0x1d10b2,null))[_0x0f2a('0x40')](handleError(_0x1d10b2,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 8c20a15..0cf8e6c 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 _0xf494=['../../config/logger','api','moment','bluebird','path','exports','define','CmHopperBlack'];(function(_0x132a9a,_0x4da489){var _0x9dd201=function(_0x20435d){while(--_0x20435d){_0x132a9a['push'](_0x132a9a['shift']());}};_0x9dd201(++_0x4da489);}(_0xf494,0x1d8));var _0x4f49=function(_0x2bd8cb,_0x1fd91c){_0x2bd8cb=_0x2bd8cb-0x0;var _0x2db999=_0xf494[_0x2bd8cb];return _0x2db999;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4f49('0x0'))(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require(_0x4f49('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f49('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperBlack.attributes');module[_0x4f49('0x5')]=function(_0x400cbe,_0x1754cd){return _0x400cbe[_0x4f49('0x6')](_0x4f49('0x7'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc094=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black'];(function(_0x38b2d6,_0x45b152){var _0x4921a9=function(_0x290fb2){while(--_0x290fb2){_0x38b2d6['push'](_0x38b2d6['shift']());}};_0x4921a9(++_0x45b152);}(_0xc094,0x8f));var _0x4c09=function(_0x806c89,_0x31e9ef){_0x806c89=_0x806c89-0x0;var _0x2ae0c7=_0xc094[_0x806c89];return _0x2ae0c7;};'use strict';var _=require(_0x4c09('0x0'));var util=require(_0x4c09('0x1'));var logger=require(_0x4c09('0x2'))(_0x4c09('0x3'));var moment=require('moment');var BPromise=require(_0x4c09('0x4'));var rp=require(_0x4c09('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c09('0x6'));var config=require(_0x4c09('0x7'));var attributes=require(_0x4c09('0x8'));module[_0x4c09('0x9')]=function(_0x443b8a,_0x1c4908){return _0x443b8a[_0x4c09('0xa')](_0x4c09('0xb'),attributes,{'tableName':_0x4c09('0xc'),'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 eddbb61..a967182 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 _0x4c05=['findAll','options','raw','where','attributes','limit','include','map','model','UpdateCmHopperBlack','body','DestroyCmHopperBlack','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetCmHopperBlack','CmHopperBlack'];(function(_0x27eab2,_0x5d3db){var _0xa81a1b=function(_0x476599){while(--_0x476599){_0x27eab2['push'](_0x27eab2['shift']());}};_0xa81a1b(++_0x5d3db);}(_0x4c05,0xc0));var _0x54c0=function(_0x5dc384,_0x1ba10f){_0x5dc384=_0x5dc384-0x0;var _0x46b4e9=_0x4c05[_0x5dc384];return _0x46b4e9;};'use strict';var _=require(_0x54c0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x54c0('0x1'));var rs=require(_0x54c0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54c0('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x54c0('0x4'))(_0x54c0('0x5'));var config=require(_0x54c0('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x54c0('0x7')][_0x54c0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x526287,_0x3840ac,_0x32f820){return new BPromise(function(_0x35d32b,_0x1dcf01){return client[_0x54c0('0x9')](_0x526287,_0x32f820)[_0x54c0('0xa')](function(_0x444955){logger[_0x54c0('0xb')](_0x54c0('0xc'),_0x3840ac,'request\x20sent');logger[_0x54c0('0xd')](_0x54c0('0xe'),_0x3840ac,'request\x20sent',JSON[_0x54c0('0xf')](_0x444955));if(_0x444955[_0x54c0('0x10')]){if(_0x444955['error'][_0x54c0('0x11')]===0x1f4){logger[_0x54c0('0x10')](_0x54c0('0xc'),_0x3840ac,_0x444955[_0x54c0('0x10')][_0x54c0('0x12')]);return _0x1dcf01(_0x444955[_0x54c0('0x10')][_0x54c0('0x12')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x3840ac,_0x444955[_0x54c0('0x10')][_0x54c0('0x12')]);return _0x35d32b(_0x444955[_0x54c0('0x10')][_0x54c0('0x12')]);}else{logger[_0x54c0('0xb')](_0x54c0('0xc'),_0x3840ac,_0x54c0('0x13'));_0x35d32b(_0x444955[_0x54c0('0x14')][_0x54c0('0x12')]);}})[_0x54c0('0x15')](function(_0x3139e3){logger[_0x54c0('0x10')](_0x54c0('0xc'),_0x3840ac,_0x3139e3);_0x1dcf01(_0x3139e3);});});}exports[_0x54c0('0x16')]=function(_0x4637d8){var _0x3c012b=this;return new Promise(function(_0x123516,_0xa872b9){return db[_0x54c0('0x17')][_0x54c0('0x18')]({'raw':_0x4637d8[_0x54c0('0x19')]?_0x4637d8[_0x54c0('0x19')][_0x54c0('0x1a')]===undefined?!![]:![]:!![],'where':_0x4637d8[_0x54c0('0x19')]?_0x4637d8[_0x54c0('0x19')][_0x54c0('0x1b')]||null:null,'attributes':_0x4637d8[_0x54c0('0x19')]?_0x4637d8[_0x54c0('0x19')][_0x54c0('0x1c')]||null:null,'limit':_0x4637d8[_0x54c0('0x19')]?_0x4637d8[_0x54c0('0x19')][_0x54c0('0x1d')]||null:null,'include':_0x4637d8[_0x54c0('0x19')]?_0x4637d8['options'][_0x54c0('0x1e')]?_[_0x54c0('0x1f')](_0x4637d8['options'][_0x54c0('0x1e')],function(_0x215fd0){return{'model':db[_0x215fd0[_0x54c0('0x20')]],'as':_0x215fd0['as'],'attributes':_0x215fd0[_0x54c0('0x1c')],'include':_0x215fd0[_0x54c0('0x1e')]?_[_0x54c0('0x1f')](_0x215fd0['include'],function(_0xd70df4){return{'model':db[_0xd70df4['model']],'as':_0xd70df4['as'],'attributes':_0xd70df4['attributes'],'include':_0xd70df4[_0x54c0('0x1e')]?_['map'](_0xd70df4[_0x54c0('0x1e')],function(_0x4a3712){return{'model':db[_0x4a3712['model']],'as':_0x4a3712['as'],'attributes':_0x4a3712[_0x54c0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x54c0('0xa')](function(_0x777811){logger[_0x54c0('0xb')](_0x54c0('0x16'),_0x4637d8);logger[_0x54c0('0xd')](_0x54c0('0x16'),_0x4637d8,JSON[_0x54c0('0xf')](_0x777811));_0x123516(_0x777811);})[_0x54c0('0x15')](function(_0x33b585){logger[_0x54c0('0x10')](_0x54c0('0x16'),_0x33b585['message'],_0x4637d8);_0xa872b9(_0x3c012b['error'](0x1f4,_0x33b585[_0x54c0('0x12')]));});});};exports[_0x54c0('0x21')]=function(_0x5b0354){var _0x3e7876=this;return new Promise(function(_0x18b3e4,_0x1ffa6a){return db[_0x54c0('0x17')]['update'](_0x5b0354[_0x54c0('0x22')],{'raw':_0x5b0354[_0x54c0('0x19')]?_0x5b0354[_0x54c0('0x19')][_0x54c0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b0354[_0x54c0('0x19')]?_0x5b0354[_0x54c0('0x19')][_0x54c0('0x1b')]||null:null,'attributes':_0x5b0354[_0x54c0('0x19')]?_0x5b0354[_0x54c0('0x19')]['attributes']||null:null,'limit':_0x5b0354[_0x54c0('0x19')]?_0x5b0354['options'][_0x54c0('0x1d')]||null:null})['then'](function(_0x5e6ad0){logger[_0x54c0('0xb')](_0x54c0('0x21'),_0x5b0354);logger[_0x54c0('0xd')](_0x54c0('0x21'),_0x5b0354,JSON[_0x54c0('0xf')](_0x5e6ad0));_0x18b3e4(_0x5e6ad0);})['catch'](function(_0x1e9ee1){logger[_0x54c0('0x10')](_0x54c0('0x21'),_0x1e9ee1[_0x54c0('0x12')],_0x5b0354);_0x1ffa6a(_0x3e7876['error'](0x1f4,_0x1e9ee1[_0x54c0('0x12')]));});});};exports['DestroyCmHopperBlack']=function(_0x6cc4ac){var _0x4cdf5c=this;return new Promise(function(_0x35fad2,_0x4f9cc1){return db[_0x54c0('0x17')]['destroy']({'where':_0x6cc4ac['options']?_0x6cc4ac[_0x54c0('0x19')][_0x54c0('0x1b')]||null:null})[_0x54c0('0xa')](function(_0x416480){logger[_0x54c0('0xb')](_0x54c0('0x23'),_0x6cc4ac);logger[_0x54c0('0xd')]('DestroyCmHopperBlack',_0x6cc4ac,JSON[_0x54c0('0xf')](_0x416480));_0x35fad2(_0x416480);})[_0x54c0('0x15')](function(_0x27ca0b){logger[_0x54c0('0x10')](_0x54c0('0x23'),_0x27ca0b[_0x54c0('0x12')],_0x6cc4ac);_0x4f9cc1(_0x4cdf5c[_0x54c0('0x10')](0x1f4,_0x27ca0b[_0x54c0('0x12')]));});});}; \ No newline at end of file +var _0xff9b=['message','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','map','include','model','UpdateCmHopperBlack','limit','then','DestroyCmHopperBlack','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x5407ad,_0x40293d){var _0x5328de=function(_0x1c0fb3){while(--_0x1c0fb3){_0x5407ad['push'](_0x5407ad['shift']());}};_0x5328de(++_0x40293d);}(_0xff9b,0x1b0));var _0xbff9=function(_0x1a3984,_0x492a1d){_0x1a3984=_0x1a3984-0x0;var _0x386311=_0xff9b[_0x1a3984];return _0x386311;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xbff9('0x0'));var rs=require(_0xbff9('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbff9('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xbff9('0x3'))(_0xbff9('0x4'));var config=require(_0xbff9('0x5'));var jayson=require(_0xbff9('0x6'));var client=jayson['client'][_0xbff9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x244ac4,_0x9a5973,_0x20ba08){return new BPromise(function(_0x34b381,_0x37bea4){return client[_0xbff9('0x8')](_0x244ac4,_0x20ba08)['then'](function(_0x5c0bb4){logger[_0xbff9('0x9')](_0xbff9('0xa'),_0x9a5973,_0xbff9('0xb'));logger[_0xbff9('0xc')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x9a5973,_0xbff9('0xb'),JSON[_0xbff9('0xd')](_0x5c0bb4));if(_0x5c0bb4[_0xbff9('0xe')]){if(_0x5c0bb4[_0xbff9('0xe')][_0xbff9('0xf')]===0x1f4){logger[_0xbff9('0xe')](_0xbff9('0xa'),_0x9a5973,_0x5c0bb4['error'][_0xbff9('0x10')]);return _0x37bea4(_0x5c0bb4[_0xbff9('0xe')]['message']);}logger[_0xbff9('0xe')](_0xbff9('0xa'),_0x9a5973,_0x5c0bb4['error'][_0xbff9('0x10')]);return _0x34b381(_0x5c0bb4[_0xbff9('0xe')]['message']);}else{logger[_0xbff9('0x9')](_0xbff9('0xa'),_0x9a5973,'request\x20sent');_0x34b381(_0x5c0bb4['result'][_0xbff9('0x10')]);}})[_0xbff9('0x11')](function(_0x7a62f3){logger['error'](_0xbff9('0xa'),_0x9a5973,_0x7a62f3);_0x37bea4(_0x7a62f3);});});}exports[_0xbff9('0x12')]=function(_0x521f96){var _0x372715=this;return new Promise(function(_0x210fa1,_0x343d77){return db[_0xbff9('0x13')][_0xbff9('0x14')]({'raw':_0x521f96['options']?_0x521f96[_0xbff9('0x15')][_0xbff9('0x16')]===undefined?!![]:![]:!![],'where':_0x521f96[_0xbff9('0x15')]?_0x521f96['options'][_0xbff9('0x17')]||null:null,'attributes':_0x521f96[_0xbff9('0x15')]?_0x521f96[_0xbff9('0x15')][_0xbff9('0x18')]||null:null,'limit':_0x521f96['options']?_0x521f96[_0xbff9('0x15')]['limit']||null:null,'include':_0x521f96[_0xbff9('0x15')]?_0x521f96[_0xbff9('0x15')]['include']?_[_0xbff9('0x19')](_0x521f96[_0xbff9('0x15')][_0xbff9('0x1a')],function(_0x35b4b6){return{'model':db[_0x35b4b6['model']],'as':_0x35b4b6['as'],'attributes':_0x35b4b6[_0xbff9('0x18')],'include':_0x35b4b6[_0xbff9('0x1a')]?_['map'](_0x35b4b6[_0xbff9('0x1a')],function(_0xa030a0){return{'model':db[_0xa030a0[_0xbff9('0x1b')]],'as':_0xa030a0['as'],'attributes':_0xa030a0[_0xbff9('0x18')],'include':_0xa030a0[_0xbff9('0x1a')]?_['map'](_0xa030a0[_0xbff9('0x1a')],function(_0x5a48fa){return{'model':db[_0x5a48fa[_0xbff9('0x1b')]],'as':_0x5a48fa['as'],'attributes':_0x5a48fa[_0xbff9('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11074d){logger[_0xbff9('0x9')](_0xbff9('0x12'),_0x521f96);logger[_0xbff9('0xc')](_0xbff9('0x12'),_0x521f96,JSON[_0xbff9('0xd')](_0x11074d));_0x210fa1(_0x11074d);})[_0xbff9('0x11')](function(_0x5ef936){logger[_0xbff9('0xe')](_0xbff9('0x12'),_0x5ef936[_0xbff9('0x10')],_0x521f96);_0x343d77(_0x372715['error'](0x1f4,_0x5ef936['message']));});});};exports[_0xbff9('0x1c')]=function(_0x1ad76f){var _0x5bf3f9=this;return new Promise(function(_0x3f3488,_0x17a6d8){return db['CmHopperBlack']['update'](_0x1ad76f['body'],{'raw':_0x1ad76f['options']?_0x1ad76f[_0xbff9('0x15')][_0xbff9('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ad76f[_0xbff9('0x15')]?_0x1ad76f['options'][_0xbff9('0x17')]||null:null,'attributes':_0x1ad76f[_0xbff9('0x15')]?_0x1ad76f[_0xbff9('0x15')][_0xbff9('0x18')]||null:null,'limit':_0x1ad76f[_0xbff9('0x15')]?_0x1ad76f[_0xbff9('0x15')][_0xbff9('0x1d')]||null:null})[_0xbff9('0x1e')](function(_0xc6beff){logger[_0xbff9('0x9')](_0xbff9('0x1c'),_0x1ad76f);logger[_0xbff9('0xc')](_0xbff9('0x1c'),_0x1ad76f,JSON[_0xbff9('0xd')](_0xc6beff));_0x3f3488(_0xc6beff);})[_0xbff9('0x11')](function(_0x4df038){logger[_0xbff9('0xe')]('UpdateCmHopperBlack',_0x4df038[_0xbff9('0x10')],_0x1ad76f);_0x17a6d8(_0x5bf3f9['error'](0x1f4,_0x4df038[_0xbff9('0x10')]));});});};exports['DestroyCmHopperBlack']=function(_0x2a6aca){var _0x4977a8=this;return new Promise(function(_0x324b47,_0x240ffd){return db[_0xbff9('0x13')]['destroy']({'where':_0x2a6aca[_0xbff9('0x15')]?_0x2a6aca[_0xbff9('0x15')]['where']||null:null})[_0xbff9('0x1e')](function(_0x5be6e0){logger['info'](_0xbff9('0x1f'),_0x2a6aca);logger['debug']('DestroyCmHopperBlack',_0x2a6aca,JSON[_0xbff9('0xd')](_0x5be6e0));_0x324b47(_0x5be6e0);})[_0xbff9('0x11')](function(_0x4ed250){logger['error'](_0xbff9('0x1f'),_0x4ed250[_0xbff9('0x10')],_0x2a6aca);_0x240ffd(_0x4977a8['error'](0x1f4,_0x4ed250[_0xbff9('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index abe62c4..2ce5f4c 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 _0xf2e3=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','update','delete','destroy'];(function(_0x41ed13,_0x1044be){var _0x1bb4d5=function(_0x15d224){while(--_0x15d224){_0x41ed13['push'](_0x41ed13['shift']());}};_0x1bb4d5(++_0x1044be);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xf2e3[_0x46d0c9];return _0x174506;};'use strict';var multer=require(_0x3f2e('0x0'));var util=require('util');var path=require(_0x3f2e('0x1'));var timeout=require(_0x3f2e('0x2'));var express=require(_0x3f2e('0x3'));var router=express[_0x3f2e('0x4')]();var fs_extra=require(_0x3f2e('0x5'));var auth=require(_0x3f2e('0x6'));var interaction=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var controller=require(_0x3f2e('0x9'));router['get']('/',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xb')]);router[_0x3f2e('0xc')](_0x3f2e('0xd'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xe')]);router[_0x3f2e('0xc')](_0x3f2e('0xf'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x10')]);router[_0x3f2e('0x11')](_0x3f2e('0xf'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x12')]);router[_0x3f2e('0x13')](_0x3f2e('0xf'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x14')]);module[_0x3f2e('0x15')]=router; \ No newline at end of file +var _0x4975=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','/:id','show','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x4975,0x86));var _0x5497=function(_0x24be65,_0xcb00ed){_0x24be65=_0x24be65-0x0;var _0x953cf9=_0x4975[_0x24be65];return _0x953cf9;};'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('0x11')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xf'),auth[_0x5497('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index cc7ddfa..b886b5c 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 _0x2c58=['endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','moment','exports','INTEGER','DATE','STRING'];(function(_0x1deae8,_0x936ca2){var _0xf176ae=function(_0x3c0017){while(--_0x3c0017){_0x1deae8['push'](_0x1deae8['shift']());}};_0xf176ae(++_0x936ca2);}(_0x2c58,0x1ab));var _0x82c5=function(_0x5311b5,_0x3df0db){_0x5311b5=_0x5311b5-0x0;var _0x116e77=_0x2c58[_0x5311b5];return _0x116e77;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x82c5('0x0'));module[_0x82c5('0x1')]={'state':{'type':Sequelize[_0x82c5('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x82c5('0x3')]},'countbusyretry':{'type':Sequelize[_0x82c5('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x82c5('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x82c5('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x82c5('0x4')]},'originatecalleridname':{'type':Sequelize[_0x82c5('0x4')]},'calleridnum':{'type':Sequelize[_0x82c5('0x4')]},'calleridname':{'type':Sequelize[_0x82c5('0x4')]},'starttime':{'type':Sequelize[_0x82c5('0x3')]},'responsetime':{'type':Sequelize[_0x82c5('0x3')]},'answertime':{'type':Sequelize[_0x82c5('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x82c5('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x82c5('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x82c5('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x82c5('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x82c5('0x4')]},'campaign':{'type':Sequelize[_0x82c5('0x4')]},'campaigntype':{'type':Sequelize[_0x82c5('0x4')]},'membername':{'type':Sequelize[_0x82c5('0x4')]},'reason':{'type':Sequelize[_0x82c5('0x4')]},'disposition':{'type':Sequelize[_0x82c5('0x4')]},'secondDisposition':{'type':Sequelize[_0x82c5('0x4')]},'thirdDisposition':{'type':Sequelize[_0x82c5('0x4')]},'dispositionat':{'type':Sequelize[_0x82c5('0x3')],'set':function(_0x1a1e5c){var _0x16f873=this['getDataValue'](_0x82c5('0x5'));if(_0x16f873&&_0x1a1e5c){this[_0x82c5('0x6')](_0x82c5('0x7'),moment(_0x1a1e5c)[_0x82c5('0x8')](moment(_0x16f873),_0x82c5('0x9')));}return this['setDataValue'](_0x82c5('0xa'),_0x1a1e5c);}},'amd':{'type':Sequelize[_0x82c5('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x82c5('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x82c5('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x82c5('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x82c5('0x3')]},'deleted':{'type':Sequelize[_0x82c5('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x82c5('0x3')]},'recallme':{'type':Sequelize[_0x82c5('0xb')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x82c5('0x3')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x82c5('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x82c5('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x82c5('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x4fda=['BOOLEAN','sequelize','moment','exports','STRING','DATE','INTEGER','getDataValue','endtime','setDataValue','followuptime','seconds','dispositionat'];(function(_0x249d99,_0x16b584){var _0x5bfb05=function(_0x4f4d67){while(--_0x4f4d67){_0x249d99['push'](_0x249d99['shift']());}};_0x5bfb05(++_0x16b584);}(_0x4fda,0x1ae));var _0xa4fd=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x4fda[_0x2642cb];return _0xe6e41;};'use strict';var Sequelize=require(_0xa4fd('0x0'));var moment=require(_0xa4fd('0x1'));module[_0xa4fd('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xa4fd('0x3')]},'scheduledat':{'type':Sequelize[_0xa4fd('0x4')]},'countbusyretry':{'type':Sequelize[_0xa4fd('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xa4fd('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xa4fd('0x3')]},'originatecalleridname':{'type':Sequelize[_0xa4fd('0x3')]},'calleridnum':{'type':Sequelize[_0xa4fd('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xa4fd('0x4')]},'answertime':{'type':Sequelize[_0xa4fd('0x4')]},'droptime':{'type':Sequelize[_0xa4fd('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xa4fd('0x5')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xa4fd('0x5')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xa4fd('0x5')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xa4fd('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xa4fd('0x3')]},'reason':{'type':Sequelize[_0xa4fd('0x3')]},'disposition':{'type':Sequelize[_0xa4fd('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xa4fd('0x3')]},'dispositionat':{'type':Sequelize[_0xa4fd('0x4')],'set':function(_0x1b171c){var _0x4f095a=this[_0xa4fd('0x6')](_0xa4fd('0x7'));if(_0x4f095a&&_0x1b171c){this[_0xa4fd('0x8')](_0xa4fd('0x9'),moment(_0x1b171c)['diff'](moment(_0x4f095a),_0xa4fd('0xa')));}return this[_0xa4fd('0x8')](_0xa4fd('0xb'),_0x1b171c);}},'amd':{'type':Sequelize[_0xa4fd('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0xa4fd('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xa4fd('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xa4fd('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa4fd('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa4fd('0x4')]},'deleted':{'type':Sequelize[_0xa4fd('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xa4fd('0x4')]},'recallme':{'type':Sequelize[_0xa4fd('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xa4fd('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xa4fd('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa4fd('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa4fd('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa4fd('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 a64200e..4da6b96 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 _0x01d9=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noAnswerContacts','dropContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','fromQuery','CampaignId','updatedAt','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment'];(function(_0x5de076,_0x404fa7){var _0x1b01ed=function(_0x5b738f){while(--_0x5b738f){_0x5de076['push'](_0x5de076['shift']());}};_0x1b01ed(++_0x404fa7);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':!![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['CmHopperFinal'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')]()[_0x901d('0x28')](respondWithResult(_0x27459b,null))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x2cd965,_0x23f2a9){if(_0x2cd965['body']['uniqueid']){delete _0x2cd965[_0x901d('0x4c')][_0x901d('0x4d')];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'uniqueid':_0x2cd965[_0x901d('0x48')]['id']}})['then'](handleEntityNotFound(_0x23f2a9,null))['then'](saveUpdates(_0x2cd965[_0x901d('0x4c')],null))[_0x901d('0x28')](respondWithResult(_0x23f2a9,null))['catch'](handleError(_0x23f2a9,null));};exports[_0x901d('0x4e')]=function(_0x165207,_0x4d2b2d,_0x4512e5){return db['CmHopperFinal'][_0x901d('0x4f')]({'raw':![],'where':{'VoiceQueueId':_0x165207[_0x901d('0x48')]['id']},'attributes':[[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db['sequelize']['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x53')))),_0x901d('0x54')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x55')))),'noAnswerContacts'],[db[_0x901d('0x50')]['fn']('COUNT',db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x56')))),_0x901d('0x57')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db['sequelize'][_0x901d('0x52')](_0x901d('0x58')))),_0x901d('0x59')],[db['sequelize']['fn'](_0x901d('0x51'),db['sequelize']['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5a')))),'dropContacts'],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5b')))),'abandonedContacts'],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5c')))),'reCallContacts'],[db[_0x901d('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x901d('0x5d')))),_0x901d('0x5e')]]})[_0x901d('0x28')](handleEntityNotFound(_0x4d2b2d,null))['then'](respondWithResult(_0x4d2b2d,null))[_0x901d('0x46')](handleError(_0x4d2b2d,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xabab57,_0x219c23,_0xecc8f9){return db[_0x901d('0x2f')][_0x901d('0x4f')]({'raw':![],'where':{'CampaignId':_0xabab57[_0x901d('0x48')]['id']},'attributes':[[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x53')))),_0x901d('0x54')],[db[_0x901d('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x55')))),_0x901d('0x5f')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x901d('0x57')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x58')))),_0x901d('0x59')],[db[_0x901d('0x50')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5a')))),_0x901d('0x60')],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')][_0x901d('0x52')](_0x901d('0x5b')))),'abandonedContacts'],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db['sequelize']['fn']('IF',db['sequelize'][_0x901d('0x52')](_0x901d('0x5c')))),'reCallContacts'],[db[_0x901d('0x50')]['fn'](_0x901d('0x51'),db[_0x901d('0x50')]['fn']('IF',db[_0x901d('0x50')]['literal'](_0x901d('0x5d')))),_0x901d('0x5e')]]})[_0x901d('0x28')](handleEntityNotFound(_0x219c23,null))[_0x901d('0x28')](respondWithResult(_0x219c23,null))[_0x901d('0x46')](handleError(_0x219c23,null));};exports[_0x901d('0x61')]=function(_0x5cff96,_0x130dfb,_0x302049){return db[_0x901d('0x62')]['find']({'where':{'id':_0x5cff96[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x130dfb,null))[_0x901d('0x28')](function(_0x4b5e3b){var _0x576d50;if(_0x4b5e3b){_0x576d50=squel['insert']()[_0x901d('0x63')](_0x901d('0x64'))['fromQuery'](['phone',_0x901d('0x65'),_0x901d('0x66'),_0x901d('0x67'),_0x901d('0x68'),_0x901d('0x69'),'updatedAt'],squel[_0x901d('0x6a')]()[_0x901d('0x6b')](_0x901d('0x6c'),_0x901d('0x6d'))['field'](_0x901d('0x6e'),'scheduledAt')[_0x901d('0x6b')]('ANY_VALUE(ContactId)',_0x901d('0x66'))[_0x901d('0x6b')](_0x901d('0x6f'),_0x901d('0x67'))[_0x901d('0x6b')](_0x901d('0x70'),_0x901d('0x68'))['field'](_0x901d('0x6e'),_0x901d('0x69'))['field'](_0x901d('0x6e'),'updatedAt')['from']('cm_hopper_final')['where'](_0x901d('0x71'),_0x5cff96[_0x901d('0x48')]['id']['toString']())[_0x901d('0x3e')](_0x901d('0x72'),_0x5cff96[_0x901d('0x4c')][_0x901d('0x73')][_0x901d('0x74')]())['where'](_0x901d('0x75'))[_0x901d('0x3e')](_0x901d('0x76'),squel['select']()[_0x901d('0x6b')](_0x901d('0x6d'))[_0x901d('0x77')](_0x901d('0x64'))[_0x901d('0x3e')](_0x901d('0x71'),_0x5cff96[_0x901d('0x48')]['id'][_0x901d('0x74')]()))[_0x901d('0x3e')](_0x901d('0x76'),squel[_0x901d('0x6a')]()[_0x901d('0x6b')](_0x901d('0x78'))['from'](_0x901d('0x79'))[_0x901d('0x3e')](_0x901d('0x71'),_0x5cff96[_0x901d('0x48')]['id'][_0x901d('0x74')]())[_0x901d('0x3e')](_0x901d('0x7a')))[_0x901d('0x7b')]('ContactId'))[_0x901d('0x74')]();return db[_0x901d('0x50')][_0x901d('0x35')](_0x576d50);}return[];})['then'](respondWithResult(_0x130dfb,null))[_0x901d('0x46')](handleError(_0x130dfb,null));};exports[_0x901d('0x7c')]=function(_0xa14cbd,_0x34f33f,_0x785f77){return db[_0x901d('0x7d')][_0x901d('0x4a')]({'where':{'id':_0xa14cbd[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x34f33f,null))[_0x901d('0x28')](function(_0x28b640){var _0x45601a;if(_0x28b640){_0x45601a=squel[_0x901d('0x7e')]()[_0x901d('0x63')](_0x901d('0x64'))[_0x901d('0x7f')](['phone',_0x901d('0x65'),_0x901d('0x66'),_0x901d('0x67'),_0x901d('0x80'),_0x901d('0x69'),_0x901d('0x81')],squel['select']()[_0x901d('0x6b')](_0x901d('0x6c'),_0x901d('0x6d'))[_0x901d('0x6b')](_0x901d('0x6e'),_0x901d('0x65'))[_0x901d('0x6b')]('ANY_VALUE(ContactId)',_0x901d('0x66'))['field'](_0x901d('0x6f'),_0x901d('0x67'))[_0x901d('0x6b')](_0x901d('0x82'),'CampaignId')['field']('NOW()','createdAt')[_0x901d('0x6b')](_0x901d('0x6e'),'updatedAt')['from']('cm_hopper_final')[_0x901d('0x3e')]('CampaignId\x20=\x20?',_0xa14cbd[_0x901d('0x48')]['id'][_0x901d('0x74')]())[_0x901d('0x3e')]('state\x20=\x20?',_0xa14cbd['body'][_0x901d('0x73')][_0x901d('0x74')]())[_0x901d('0x3e')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x901d('0x6a')]()[_0x901d('0x6b')]('phone')[_0x901d('0x77')]('cm_hopper')['where'](_0x901d('0x83'),_0xa14cbd['params']['id'][_0x901d('0x74')]()))[_0x901d('0x3e')](_0x901d('0x76'),squel[_0x901d('0x6a')]()[_0x901d('0x6b')](_0x901d('0x78'))['from'](_0x901d('0x79'))[_0x901d('0x3e')](_0x901d('0x83'),_0xa14cbd[_0x901d('0x48')]['id'][_0x901d('0x74')]())[_0x901d('0x3e')]('state\x20=\x204'))['group'](_0x901d('0x66')))[_0x901d('0x74')]();return db[_0x901d('0x50')][_0x901d('0x35')](_0x45601a);}return[];})[_0x901d('0x28')](respondWithResult(_0x34f33f,null))[_0x901d('0x46')](handleError(_0x34f33f,null));};exports[_0x901d('0x84')]=function(_0x306491,_0x3cb399,_0x101067){return db['CmHopper'][_0x901d('0x85')]({'where':{'VoiceQueueId':_0x306491[_0x901d('0x4c')][_0x901d('0x68')],'CampaignId':_0x306491[_0x901d('0x4c')][_0x901d('0x80')],'ContactId':_0x306491[_0x901d('0x4c')][_0x901d('0x66')]}})[_0x901d('0x28')](handleEntityNotFound(_0x3cb399,null))[_0x901d('0x28')](function(_0x17b7ef){if(_0x17b7ef){return _0x17b7ef;}return null;})[_0x901d('0x28')](respondWithResult(_0x3cb399,null))[_0x901d('0x46')](handleError(_0x3cb399,null));}; \ No newline at end of file +var _0xb016=['error','name','send','index','map','CmHopperFinal','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','update','body','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','moveContactsIvrCampaignHopperFinal','Campaign','into','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state','calleridnum','state\x20=\x204','group','checkContactHopper','CmHopper','eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','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','apply','reject','save','then','destroy','end'];(function(_0x100480,_0x5e50dc){var _0x14bf1b=function(_0x39d4a3){while(--_0x39d4a3){_0x100480['push'](_0x100480['shift']());}};_0x14bf1b(++_0x5e50dc);}(_0xb016,0x159));var _0x6b01=function(_0x53d440,_0x4624ed){_0x53d440=_0x53d440-0x0;var _0x246282=_0xb016[_0x53d440];return _0x246282;};'use strict';var emlformat=require(_0x6b01('0x0'));var rimraf=require(_0x6b01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6b01('0x2'));var moment=require('moment');var BPromise=require(_0x6b01('0x3'));var Mustache=require(_0x6b01('0x4'));var util=require(_0x6b01('0x5'));var path=require(_0x6b01('0x6'));var sox=require('sox');var csv=require(_0x6b01('0x7'));var ejs=require(_0x6b01('0x8'));var fs=require('fs');var fs_extra=require(_0x6b01('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6b01('0xa'));var jsforce=require(_0x6b01('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6b01('0xc'));var Papa=require(_0x6b01('0xd'));var Redis=require(_0x6b01('0xe'));var authService=require(_0x6b01('0xf'));var qs=require(_0x6b01('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6b01('0x11'))(_0x6b01('0x12'));var utils=require(_0x6b01('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6b01('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x51f976,_0x26f2a0){_0x26f2a0=_0x26f2a0||0xcc;return function(_0x4fa826){if(_0x4fa826){return _0x51f976[_0x6b01('0x15')](_0x26f2a0);}return _0x51f976[_0x6b01('0x16')](_0x26f2a0)['end']();};}function respondWithResult(_0x2c305e,_0x4ea5fa){_0x4ea5fa=_0x4ea5fa||0xc8;return function(_0x50d778){if(_0x50d778){return _0x2c305e['status'](_0x4ea5fa)[_0x6b01('0x17')](_0x50d778);}};}function respondWithFilteredResult(_0x4cbd38,_0x5b2f60){return function(_0x3a259f){if(_0x3a259f){var _0x327e86=typeof _0x5b2f60[_0x6b01('0x18')]===_0x6b01('0x19')&&typeof _0x5b2f60[_0x6b01('0x1a')]===_0x6b01('0x19');var _0x122769=_0x3a259f[_0x6b01('0x1b')];var _0x9c6571=_0x327e86?0x0:_0x5b2f60[_0x6b01('0x18')];var _0x18f336=_0x327e86?_0x3a259f['count']:_0x5b2f60[_0x6b01('0x18')]+_0x5b2f60[_0x6b01('0x1a')];var _0x3b0bab;if(_0x18f336>=_0x122769){_0x18f336=_0x122769;_0x3b0bab=0xc8;}else{_0x3b0bab=0xce;}_0x4cbd38[_0x6b01('0x16')](_0x3b0bab);return _0x4cbd38[_0x6b01('0x1c')](_0x6b01('0x1d'),_0x9c6571+'-'+_0x18f336+'/'+_0x122769)[_0x6b01('0x17')](_0x3a259f);}return null;};}function patchUpdates(_0x3c0573){return function(_0x54a942){try{jsonpatch[_0x6b01('0x1e')](_0x54a942,_0x3c0573,!![]);}catch(_0xc1f453){return BPromise[_0x6b01('0x1f')](_0xc1f453);}return _0x54a942[_0x6b01('0x20')]();};}function saveUpdates(_0x1fced4,_0x181b09){return function(_0x2cea6e){if(_0x2cea6e){return _0x2cea6e['update'](_0x1fced4)[_0x6b01('0x21')](function(_0xcf9200){return _0xcf9200;});}return null;};}function removeEntity(_0x42c990,_0x51243c){return function(_0x399808){if(_0x399808){return _0x399808[_0x6b01('0x22')]()[_0x6b01('0x21')](function(){_0x42c990[_0x6b01('0x16')](0xcc)[_0x6b01('0x23')]();});}};}function handleEntityNotFound(_0x2456e9,_0x1b46fb){return function(_0x136452){if(!_0x136452){_0x2456e9[_0x6b01('0x15')](0x194);}return _0x136452;};}function handleError(_0x152dda,_0x3c0607){_0x3c0607=_0x3c0607||0x1f4;return function(_0xa846d8){logger[_0x6b01('0x24')](_0xa846d8['stack']);if(_0xa846d8[_0x6b01('0x25')]){delete _0xa846d8[_0x6b01('0x25')];}_0x152dda[_0x6b01('0x16')](_0x3c0607)[_0x6b01('0x26')](_0xa846d8);};}exports[_0x6b01('0x27')]=function(_0x528cbd,_0x54f030){var _0x3fae61={},_0x3df3d4={},_0xc574c={'count':0x0,'rows':[]};var _0x8883d1=_[_0x6b01('0x28')](db[_0x6b01('0x29')]['rawAttributes'],function(_0x39f193){return{'name':_0x39f193['fieldName'],'type':_0x39f193[_0x6b01('0x2a')]['key']};});_0x3df3d4[_0x6b01('0x2b')]=_[_0x6b01('0x28')](_0x8883d1,_0x6b01('0x25'));_0x3df3d4[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x528cbd['query']);_0x3df3d4[_0x6b01('0x2e')]=_[_0x6b01('0x2f')](_0x3df3d4[_0x6b01('0x2b')],_0x3df3d4['query']);_0x3fae61['attributes']=_[_0x6b01('0x2f')](_0x3df3d4['model'],qs[_0x6b01('0x30')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x30')]));_0x3fae61['attributes']=_0x3fae61[_0x6b01('0x31')][_0x6b01('0x32')]?_0x3fae61[_0x6b01('0x31')]:_0x3df3d4['model'];if(!_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x33')](_0x6b01('0x34'))){_0x3fae61[_0x6b01('0x1a')]=qs[_0x6b01('0x1a')](_0x528cbd['query'][_0x6b01('0x1a')]);_0x3fae61[_0x6b01('0x18')]=qs[_0x6b01('0x18')](_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x18')]);}_0x3fae61[_0x6b01('0x35')]=qs[_0x6b01('0x36')](_0x528cbd[_0x6b01('0x2c')]['sort']);_0x3fae61[_0x6b01('0x37')]=qs['filters'](_[_0x6b01('0x38')](_0x528cbd[_0x6b01('0x2c')],_0x3df3d4[_0x6b01('0x2e')]),_0x8883d1);if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]){_0x3fae61[_0x6b01('0x37')]=_[_0x6b01('0x3a')](_0x3fae61['where'],{'$or':_[_0x6b01('0x28')](_0x8883d1,function(_0x15f274){if(_0x15f274[_0x6b01('0x2a')]!==_0x6b01('0x3b')){var _0x1ca3aa={};_0x1ca3aa[_0x15f274[_0x6b01('0x25')]]={'$like':'%'+_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x39')]+'%'};return _0x1ca3aa;}})});}_0x3fae61=_['merge']({},_0x3fae61,_0x528cbd[_0x6b01('0x3c')]);var _0x55907f={'where':_0x3fae61[_0x6b01('0x37')]};return db[_0x6b01('0x29')]['count'](_0x55907f)[_0x6b01('0x21')](function(_0x2e661b){_0xc574c[_0x6b01('0x1b')]=_0x2e661b;if(_0x528cbd[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0x3fae61[_0x6b01('0x3e')]=[{'all':!![]}];}return db[_0x6b01('0x29')][_0x6b01('0x3f')](_0x3fae61);})[_0x6b01('0x21')](function(_0x17f335){_0xc574c['rows']=_0x17f335;return _0xc574c;})[_0x6b01('0x21')](respondWithFilteredResult(_0x54f030,_0x3fae61))[_0x6b01('0x40')](handleError(_0x54f030,null));};exports['show']=function(_0x52cec0,_0x32b9ec){var _0xd11195={'raw':!![],'where':{'id':_0x52cec0[_0x6b01('0x41')]['id']}},_0x558ec1={};_0x558ec1[_0x6b01('0x2b')]=_['keys'](db[_0x6b01('0x29')]['rawAttributes']);_0x558ec1[_0x6b01('0x2c')]=_[_0x6b01('0x2d')](_0x52cec0[_0x6b01('0x2c')]);_0x558ec1['filters']=_[_0x6b01('0x2f')](_0x558ec1[_0x6b01('0x2b')],_0x558ec1['query']);_0xd11195['attributes']=_['intersection'](_0x558ec1[_0x6b01('0x2b')],qs[_0x6b01('0x30')](_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x30')]));_0xd11195[_0x6b01('0x31')]=_0xd11195[_0x6b01('0x31')]['length']?_0xd11195[_0x6b01('0x31')]:_0x558ec1[_0x6b01('0x2b')];if(_0x52cec0[_0x6b01('0x2c')][_0x6b01('0x3d')]){_0xd11195[_0x6b01('0x3e')]=[{'all':!![]}];}_0xd11195=_[_0x6b01('0x3a')]({},_0xd11195,_0x52cec0['options']);return db[_0x6b01('0x29')]['find'](_0xd11195)['then'](handleEntityNotFound(_0x32b9ec,null))[_0x6b01('0x21')](respondWithResult(_0x32b9ec,null))[_0x6b01('0x40')](handleError(_0x32b9ec,null));};exports['describe']=function(_0x408bb0,_0x27442e){return db[_0x6b01('0x29')]['describe']()['then'](respondWithResult(_0x27442e,null))['catch'](handleError(_0x27442e,null));};exports[_0x6b01('0x42')]=function(_0x12160f,_0x518d94){if(_0x12160f[_0x6b01('0x43')]['uniqueid']){delete _0x12160f['body']['uniqueid'];}return db[_0x6b01('0x29')][_0x6b01('0x44')]({'where':{'uniqueid':_0x12160f['params']['id']}})['then'](handleEntityNotFound(_0x518d94,null))[_0x6b01('0x21')](saveUpdates(_0x12160f['body'],null))[_0x6b01('0x21')](respondWithResult(_0x518d94,null))[_0x6b01('0x40')](handleError(_0x518d94,null));};exports[_0x6b01('0x45')]=function(_0x172a56,_0x13f6d7,_0x4d327f){return db[_0x6b01('0x29')][_0x6b01('0x3f')]({'raw':![],'where':{'VoiceQueueId':_0x172a56[_0x6b01('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x49')))),_0x6b01('0x4a')],[db[_0x6b01('0x47')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6b01('0x47')]['literal']('`state`\x20=\x203,\x201,\x20null'))),_0x6b01('0x4b')],[db[_0x6b01('0x47')]['fn']('COUNT',db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')]['literal'](_0x6b01('0x4c')))),_0x6b01('0x4d')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')]('`state`\x20=\x208,\x201,\x20null'))),_0x6b01('0x4e')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db['sequelize']['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x4f')))),_0x6b01('0x50')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6b01('0x51')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db['sequelize']['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x52')))),'reCallContacts'],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x53')))),_0x6b01('0x54')]]})[_0x6b01('0x21')](handleEntityNotFound(_0x13f6d7,null))[_0x6b01('0x21')](respondWithResult(_0x13f6d7,null))[_0x6b01('0x40')](handleError(_0x13f6d7,null));};exports[_0x6b01('0x55')]=function(_0x425d28,_0x132dda,_0x4c1345){return db[_0x6b01('0x29')][_0x6b01('0x3f')]({'raw':![],'where':{'CampaignId':_0x425d28[_0x6b01('0x41')]['id']},'attributes':[[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x49')))),'noSuchContacts'],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x56')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x4c')))),_0x6b01('0x4d')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x57')))),_0x6b01('0x4e')],[db[_0x6b01('0x47')]['fn']('COUNT',db[_0x6b01('0x47')]['fn']('IF',db['sequelize'][_0x6b01('0x48')](_0x6b01('0x4f')))),_0x6b01('0x50')],[db['sequelize']['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x58')))),_0x6b01('0x51')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x52')))),_0x6b01('0x59')],[db[_0x6b01('0x47')]['fn'](_0x6b01('0x46'),db[_0x6b01('0x47')]['fn']('IF',db[_0x6b01('0x47')][_0x6b01('0x48')](_0x6b01('0x53')))),'answeringMachine']]})[_0x6b01('0x21')](handleEntityNotFound(_0x132dda,null))[_0x6b01('0x21')](respondWithResult(_0x132dda,null))[_0x6b01('0x40')](handleError(_0x132dda,null));};exports[_0x6b01('0x5a')]=function(_0x1c419c,_0x250889,_0x40931a){return db[_0x6b01('0x5b')][_0x6b01('0x44')]({'where':{'id':_0x1c419c[_0x6b01('0x41')]['id']}})[_0x6b01('0x21')](handleEntityNotFound(_0x250889,null))[_0x6b01('0x21')](function(_0x468a0b){var _0x30171f;if(_0x468a0b){_0x30171f=squel[_0x6b01('0x5c')]()['into'](_0x6b01('0x5d'))[_0x6b01('0x5e')]([_0x6b01('0x5f'),_0x6b01('0x60'),_0x6b01('0x61'),_0x6b01('0x62'),_0x6b01('0x63'),_0x6b01('0x64'),_0x6b01('0x65')],squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x68'),_0x6b01('0x5f'))[_0x6b01('0x67')](_0x6b01('0x69'),_0x6b01('0x60'))[_0x6b01('0x67')](_0x6b01('0x6a'),_0x6b01('0x61'))[_0x6b01('0x67')]('ANY_VALUE(ListId)','ListId')['field']('ANY_VALUE(VoiceQueueId)',_0x6b01('0x63'))['field']('NOW()','createdAt')[_0x6b01('0x67')]('NOW()',_0x6b01('0x65'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c['params']['id']['toString']())[_0x6b01('0x37')](_0x6b01('0x6e'),_0x1c419c[_0x6b01('0x43')]['state'][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x70'))[_0x6b01('0x37')](_0x6b01('0x71'),squel['select']()[_0x6b01('0x67')]('phone')[_0x6b01('0x6b')](_0x6b01('0x5d'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c[_0x6b01('0x41')]['id']['toString']()))[_0x6b01('0x37')](_0x6b01('0x71'),squel[_0x6b01('0x66')]()[_0x6b01('0x67')]('calleridnum')[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x6d'),_0x1c419c[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]())['where']('state\x20=\x204'))['group'](_0x6b01('0x61')))[_0x6b01('0x6f')]();return db['sequelize'][_0x6b01('0x2c')](_0x30171f);}return[];})[_0x6b01('0x21')](respondWithResult(_0x250889,null))[_0x6b01('0x40')](handleError(_0x250889,null));};exports[_0x6b01('0x72')]=function(_0x536748,_0x18066a,_0x4ccc00){return db[_0x6b01('0x73')]['find']({'where':{'id':_0x536748[_0x6b01('0x41')]['id']}})['then'](handleEntityNotFound(_0x18066a,null))[_0x6b01('0x21')](function(_0x3bc182){var _0x410303;if(_0x3bc182){_0x410303=squel[_0x6b01('0x5c')]()[_0x6b01('0x74')](_0x6b01('0x5d'))[_0x6b01('0x5e')](['phone',_0x6b01('0x60'),'ContactId',_0x6b01('0x62'),_0x6b01('0x75'),_0x6b01('0x64'),_0x6b01('0x65')],squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x68'),_0x6b01('0x5f'))[_0x6b01('0x67')](_0x6b01('0x69'),_0x6b01('0x60'))['field'](_0x6b01('0x6a'),_0x6b01('0x61'))[_0x6b01('0x67')](_0x6b01('0x76'),'ListId')[_0x6b01('0x67')](_0x6b01('0x77'),_0x6b01('0x75'))[_0x6b01('0x67')](_0x6b01('0x69'),'createdAt')[_0x6b01('0x67')]('NOW()',_0x6b01('0x65'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x78'),_0x536748[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x6e'),_0x536748[_0x6b01('0x43')][_0x6b01('0x79')][_0x6b01('0x6f')]())[_0x6b01('0x37')](_0x6b01('0x70'))['where'](_0x6b01('0x71'),squel['select']()['field'](_0x6b01('0x5f'))[_0x6b01('0x6b')](_0x6b01('0x5d'))[_0x6b01('0x37')]('CampaignId\x20=\x20?',_0x536748[_0x6b01('0x41')]['id'][_0x6b01('0x6f')]()))[_0x6b01('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6b01('0x66')]()[_0x6b01('0x67')](_0x6b01('0x7a'))[_0x6b01('0x6b')](_0x6b01('0x6c'))[_0x6b01('0x37')](_0x6b01('0x78'),_0x536748[_0x6b01('0x41')]['id']['toString']())[_0x6b01('0x37')](_0x6b01('0x7b')))[_0x6b01('0x7c')](_0x6b01('0x61')))['toString']();return db['sequelize'][_0x6b01('0x2c')](_0x410303);}return[];})[_0x6b01('0x21')](respondWithResult(_0x18066a,null))[_0x6b01('0x40')](handleError(_0x18066a,null));};exports[_0x6b01('0x7d')]=function(_0x6a33d7,_0x214f54,_0x1343af){return db[_0x6b01('0x7e')]['findOne']({'where':{'VoiceQueueId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x63')],'CampaignId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x75')],'ContactId':_0x6a33d7[_0x6b01('0x43')][_0x6b01('0x61')]}})[_0x6b01('0x21')](handleEntityNotFound(_0x214f54,null))['then'](function(_0x5140ba){if(_0x5140ba){return _0x5140ba;}return null;})['then'](respondWithResult(_0x214f54,null))[_0x6b01('0x40')](handleError(_0x214f54,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 24307dd..a3b5a60 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 _0x9dbd=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','api','moment','request-promise','path','define'];(function(_0x19eefa,_0x53f333){var _0x1123f0=function(_0xe3a4d8){while(--_0xe3a4d8){_0x19eefa['push'](_0x19eefa['shift']());}};_0x1123f0(++_0x53f333);}(_0x9dbd,0xb4));var _0xd9db=function(_0xeb9086,_0x312332){_0xeb9086=_0xeb9086-0x0;var _0x3d5f58=_0x9dbd[_0xeb9086];return _0x3d5f58;};'use strict';var _=require(_0xd9db('0x0'));var util=require(_0xd9db('0x1'));var logger=require('../../config/logger')(_0xd9db('0x2'));var moment=require(_0xd9db('0x3'));var BPromise=require('bluebird');var rp=require(_0xd9db('0x4'));var fs=require('fs');var path=require(_0xd9db('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0x495ff9,_0x2a85e7){return _0x495ff9[_0xd9db('0x6')](_0xd9db('0x7'),attributes,{'tableName':_0xd9db('0x8'),'paranoid':![],'indexes':[{'name':_0xd9db('0x9'),'fields':['calleridnum']},{'name':_0xd9db('0xa'),'fields':[_0xd9db('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xffb2=['request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','moment'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xffb2,0x1d7));var _0x2ffb=function(_0x179c4a,_0x10eb06){_0x179c4a=_0x179c4a-0x0;var _0x5d1879=_0xffb2[_0x179c4a];return _0x5d1879;};'use strict';var _=require(_0x2ffb('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2ffb('0x1'));var BPromise=require('bluebird');var rp=require(_0x2ffb('0x2'));var fs=require('fs');var path=require(_0x2ffb('0x3'));var rimraf=require(_0x2ffb('0x4'));var config=require(_0x2ffb('0x5'));var attributes=require(_0x2ffb('0x6'));module['exports']=function(_0x5e0995,_0x24f17c){return _0x5e0995['define'](_0x2ffb('0x7'),attributes,{'tableName':_0x2ffb('0x8'),'paranoid':![],'indexes':[{'name':_0x2ffb('0x9'),'fields':['calleridnum']},{'name':_0x2ffb('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index ba69a02..7808128 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x2888b0,_0x36bbef){var _0x389329=function(_0x93f49b){while(--_0x93f49b){_0x2888b0['push'](_0x2888b0['shift']());}};_0x389329(++_0x36bbef);}(_0xb10b,0x12a));var _0xbb10=function(_0x5dc2fa,_0x56279d){_0x5dc2fa=_0x5dc2fa-0x0;var _0x16eaf9=_0xb10b[_0x5dc2fa];return _0x16eaf9;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x89ff76,_0x52c363){var _0x16271f=function(_0x94d1cd){while(--_0x94d1cd){_0x89ff76['push'](_0x89ff76['shift']());}};_0x16271f(++_0x52c363);}(_0xb10b,0x12a));var _0xbb10=function(_0x16b1a5,_0x318267){_0x16b1a5=_0x16b1a5-0x0;var _0x475e25=_0xb10b[_0x16b1a5];return _0x475e25;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index b4b0300..0f038d0 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 _0x3121=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','util','path','express'];(function(_0x4ccd0a,_0x523d4d){var _0x36eb6c=function(_0xba32ef){while(--_0xba32ef){_0x4ccd0a['push'](_0x4ccd0a['shift']());}};_0x36eb6c(++_0x523d4d);}(_0x3121,0x14d));var _0x1312=function(_0x3d7de9,_0x3057f6){_0x3d7de9=_0x3d7de9-0x0;var _0x3fdbe8=_0x3121[_0x3d7de9];return _0x3fdbe8;};'use strict';var multer=require('multer');var util=require(_0x1312('0x0'));var path=require(_0x1312('0x1'));var timeout=require('connect-timeout');var express=require(_0x1312('0x2'));var router=express[_0x1312('0x3')]();var fs_extra=require(_0x1312('0x4'));var auth=require(_0x1312('0x5'));var interaction=require(_0x1312('0x6'));var config=require(_0x1312('0x7'));var controller=require(_0x1312('0x8'));router[_0x1312('0x9')]('/',auth[_0x1312('0xa')](),controller[_0x1312('0xb')]);router[_0x1312('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x1312('0xc')]);router[_0x1312('0x9')](_0x1312('0xd'),auth[_0x1312('0xa')](),controller[_0x1312('0xe')]);router['get'](_0x1312('0xf'),auth[_0x1312('0xa')](),controller[_0x1312('0x10')]);router['get'](_0x1312('0x11'),auth[_0x1312('0xa')](),controller[_0x1312('0x12')]);router[_0x1312('0x13')](_0x1312('0x14'),auth[_0x1312('0xa')](),controller[_0x1312('0x15')]);router[_0x1312('0x13')](_0x1312('0x16'),auth[_0x1312('0xa')](),controller[_0x1312('0x17')]);router[_0x1312('0x13')](_0x1312('0x18'),auth['isAuthenticated'](),controller[_0x1312('0x19')]);router['put']('/:id',auth[_0x1312('0xa')](),controller[_0x1312('0x1a')]);module[_0x1312('0x1b')]=router; \ No newline at end of file +var _0x3843=['update','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put'];(function(_0x117793,_0x5cf87f){var _0x297fdc=function(_0x49531f){while(--_0x49531f){_0x117793['push'](_0x117793['shift']());}};_0x297fdc(++_0x5cf87f);}(_0x3843,0x144));var _0x3384=function(_0x49428e,_0x6a7228){_0x49428e=_0x49428e-0x0;var _0xe3f52b=_0x3843[_0x49428e];return _0xe3f52b;};'use strict';var multer=require(_0x3384('0x0'));var util=require(_0x3384('0x1'));var path=require(_0x3384('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3384('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3384('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3384('0x5'));var controller=require('./cmHopperFinal.controller');router[_0x3384('0x6')]('/',auth['isAuthenticated'](),controller[_0x3384('0x7')]);router[_0x3384('0x6')](_0x3384('0x8'),auth[_0x3384('0x9')](),controller[_0x3384('0xa')]);router[_0x3384('0x6')](_0x3384('0xb'),auth[_0x3384('0x9')](),controller[_0x3384('0xc')]);router[_0x3384('0x6')](_0x3384('0xd'),auth[_0x3384('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0x3384('0xe'),auth[_0x3384('0x9')](),controller['countContactsIvrCampaignHopperFinal']);router[_0x3384('0xf')](_0x3384('0x10'),auth[_0x3384('0x9')](),controller[_0x3384('0x11')]);router[_0x3384('0xf')]('/voice/campaign/moveContacts/:id',auth[_0x3384('0x9')](),controller[_0x3384('0x12')]);router['post'](_0x3384('0x13'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0x3384('0x14')](_0x3384('0xb'),auth[_0x3384('0x9')](),controller[_0x3384('0x15')]);module[_0x3384('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 3719135..a1773bb 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 _0xd365=['STRING','DATE','BOOLEAN','sequelize','INTEGER'];(function(_0x220bec,_0x3e116e){var _0x398827=function(_0x2290c3){while(--_0x2290c3){_0x220bec['push'](_0x220bec['shift']());}};_0x398827(++_0x3e116e);}(_0xd365,0x102));var _0x5d36=function(_0x49dab2,_0x3adc67){_0x49dab2=_0x49dab2-0x0;var _0x148d3a=_0xd365[_0x49dab2];return _0x148d3a;};'use strict';var Sequelize=require(_0x5d36('0x0'));module['exports']={'state':{'type':Sequelize[_0x5d36('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x5d36('0x2')]},'scheduledat':{'type':Sequelize[_0x5d36('0x3')]},'countbusyretry':{'type':Sequelize[_0x5d36('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x5d36('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x5d36('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x5d36('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x5d36('0x2')]},'originatecalleridname':{'type':Sequelize[_0x5d36('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x5d36('0x3')]},'responsetime':{'type':Sequelize[_0x5d36('0x3')]},'answertime':{'type':Sequelize[_0x5d36('0x3')]},'droptime':{'type':Sequelize[_0x5d36('0x3')]},'endtime':{'type':Sequelize[_0x5d36('0x3')]},'ringtime':{'type':Sequelize[_0x5d36('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x5d36('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x5d36('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x5d36('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x5d36('0x2')]},'membername':{'type':Sequelize[_0x5d36('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x5d36('0x4')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x5d36('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x5d36('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x5d36('0x3')]},'recallme':{'type':Sequelize[_0x5d36('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x5d36('0x3')]},'edited':{'type':Sequelize[_0x5d36('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x5d36('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x5d36('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x9a05=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x4ce0bd,_0x864062){var _0x519b97=function(_0x46b42e){while(--_0x46b42e){_0x4ce0bd['push'](_0x4ce0bd['shift']());}};_0x519b97(++_0x864062);}(_0x9a05,0x11c));var _0x59a0=function(_0x3036a2,_0x405b57){_0x3036a2=_0x3036a2-0x0;var _0x46e432=_0x9a05[_0x3036a2];return _0x46e432;};'use strict';var Sequelize=require(_0x59a0('0x0'));module[_0x59a0('0x1')]={'state':{'type':Sequelize[_0x59a0('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x59a0('0x3')]},'scheduledat':{'type':Sequelize[_0x59a0('0x4')]},'countbusyretry':{'type':Sequelize[_0x59a0('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x59a0('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x59a0('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x59a0('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x59a0('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x59a0('0x3')]},'originatecalleridname':{'type':Sequelize[_0x59a0('0x3')]},'calleridnum':{'type':Sequelize[_0x59a0('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x59a0('0x4')]},'responsetime':{'type':Sequelize[_0x59a0('0x4')]},'answertime':{'type':Sequelize[_0x59a0('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x59a0('0x4')]},'ringtime':{'type':Sequelize[_0x59a0('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x59a0('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x59a0('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x59a0('0x3')]},'campaign':{'type':Sequelize[_0x59a0('0x3')]},'campaigntype':{'type':Sequelize[_0x59a0('0x3')]},'membername':{'type':Sequelize[_0x59a0('0x3')]},'reason':{'type':Sequelize[_0x59a0('0x3')]},'amd':{'type':Sequelize[_0x59a0('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x59a0('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x59a0('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x59a0('0x4')]},'recallme':{'type':Sequelize[_0x59a0('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x59a0('0x4')]},'edited':{'type':Sequelize[_0x59a0('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x59a0('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x59a0('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x59a0('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 2f1706f..80de59b 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 _0x076f=['set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x11568b,_0x4e971c){var _0x147d35=function(_0x5ef775){while(--_0x5ef775){_0x11568b['push'](_0x11568b['shift']());}};_0x147d35(++_0x4e971c);}(_0x076f,0x121));var _0xf076=function(_0x51bf9b,_0x2f6e31){_0x51bf9b=_0x51bf9b-0x0;var _0x45e7e3=_0x076f[_0x51bf9b];return _0x45e7e3;};'use strict';var emlformat=require(_0xf076('0x0'));var rimraf=require(_0xf076('0x1'));var zipdir=require(_0xf076('0x2'));var jsonpatch=require(_0xf076('0x3'));var rp=require(_0xf076('0x4'));var moment=require(_0xf076('0x5'));var BPromise=require(_0xf076('0x6'));var Mustache=require('mustache');var util=require(_0xf076('0x7'));var path=require(_0xf076('0x8'));var sox=require('sox');var csv=require(_0xf076('0x9'));var ejs=require(_0xf076('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf076('0xb'));var squel=require(_0xf076('0xc'));var crypto=require(_0xf076('0xd'));var jsforce=require(_0xf076('0xe'));var deskjs=require(_0xf076('0xf'));var toCsv=require(_0xf076('0x9'));var querystring=require(_0xf076('0x10'));var Papa=require(_0xf076('0x11'));var Redis=require(_0xf076('0x12'));var authService=require(_0xf076('0x13'));var qs=require(_0xf076('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf076('0x15'));var logger=require('../../config/logger')(_0xf076('0x16'));var utils=require(_0xf076('0x17'));var config=require(_0xf076('0x18'));var licenseUtil=require(_0xf076('0x19'));var db=require(_0xf076('0x1a'))['db'];function respondWithStatusCode(_0x122ad5,_0x209cf4){_0x209cf4=_0x209cf4||0xcc;return function(_0x21a9b3){if(_0x21a9b3){return _0x122ad5[_0xf076('0x1b')](_0x209cf4);}return _0x122ad5[_0xf076('0x1c')](_0x209cf4)[_0xf076('0x1d')]();};}function respondWithResult(_0xa20e0a,_0x142d6f){_0x142d6f=_0x142d6f||0xc8;return function(_0x2af9df){if(_0x2af9df){return _0xa20e0a[_0xf076('0x1c')](_0x142d6f)[_0xf076('0x1e')](_0x2af9df);}};}function respondWithFilteredResult(_0x58f682,_0x437a15){return function(_0x4c8cfc){if(_0x4c8cfc){var _0x1bd07f=typeof _0x437a15['offset']===_0xf076('0x1f')&&typeof _0x437a15[_0xf076('0x20')]===_0xf076('0x1f');var _0x437243=_0x4c8cfc[_0xf076('0x21')];var _0x3c1028=_0x1bd07f?0x0:_0x437a15['offset'];var _0x1df372=_0x1bd07f?_0x4c8cfc[_0xf076('0x21')]:_0x437a15[_0xf076('0x22')]+_0x437a15[_0xf076('0x20')];var _0x43736a;if(_0x1df372>=_0x437243){_0x1df372=_0x437243;_0x43736a=0xc8;}else{_0x43736a=0xce;}_0x58f682[_0xf076('0x1c')](_0x43736a);return _0x58f682[_0xf076('0x23')](_0xf076('0x24'),_0x3c1028+'-'+_0x1df372+'/'+_0x437243)[_0xf076('0x1e')](_0x4c8cfc);}return null;};}function patchUpdates(_0x7fd4f3){return function(_0x587afb){try{jsonpatch[_0xf076('0x25')](_0x587afb,_0x7fd4f3,!![]);}catch(_0xa8cf0e){return BPromise[_0xf076('0x26')](_0xa8cf0e);}return _0x587afb[_0xf076('0x27')]();};}function saveUpdates(_0x252165,_0x57a845){return function(_0x43da0c){if(_0x43da0c){return _0x43da0c[_0xf076('0x28')](_0x252165)[_0xf076('0x29')](function(_0x1f9661){return _0x1f9661;});}return null;};}function removeEntity(_0x1b9698,_0x275e3f){return function(_0x2874be){if(_0x2874be){return _0x2874be[_0xf076('0x2a')]()[_0xf076('0x29')](function(){_0x1b9698['status'](0xcc)[_0xf076('0x1d')]();});}};}function handleEntityNotFound(_0x3ff431,_0x5edbf3){return function(_0x1324d4){if(!_0x1324d4){_0x3ff431[_0xf076('0x1b')](0x194);}return _0x1324d4;};}function handleError(_0x4ef11a,_0x606835){_0x606835=_0x606835||0x1f4;return function(_0x15edee){logger['error'](_0x15edee[_0xf076('0x2b')]);if(_0x15edee[_0xf076('0x2c')]){delete _0x15edee[_0xf076('0x2c')];}_0x4ef11a[_0xf076('0x1c')](_0x606835)[_0xf076('0x2d')](_0x15edee);};}exports[_0xf076('0x2e')]=function(_0x21ec47,_0x4d7054){var _0x2e1725={},_0x457946={},_0x472b59={'count':0x0,'rows':[]};var _0x448aba=_[_0xf076('0x2f')](db[_0xf076('0x30')][_0xf076('0x31')],function(_0xa1e4da){return{'name':_0xa1e4da[_0xf076('0x32')],'type':_0xa1e4da[_0xf076('0x33')]['key']};});_0x457946[_0xf076('0x34')]=_[_0xf076('0x2f')](_0x448aba,_0xf076('0x2c'));_0x457946['query']=_[_0xf076('0x35')](_0x21ec47[_0xf076('0x36')]);_0x457946[_0xf076('0x37')]=_[_0xf076('0x38')](_0x457946[_0xf076('0x34')],_0x457946['query']);_0x2e1725['attributes']=_['intersection'](_0x457946[_0xf076('0x34')],qs[_0xf076('0x39')](_0x21ec47[_0xf076('0x36')][_0xf076('0x39')]));_0x2e1725[_0xf076('0x3a')]=_0x2e1725[_0xf076('0x3a')][_0xf076('0x3b')]?_0x2e1725[_0xf076('0x3a')]:_0x457946['model'];if(!_0x21ec47['query'][_0xf076('0x3c')](_0xf076('0x3d'))){_0x2e1725[_0xf076('0x20')]=qs[_0xf076('0x20')](_0x21ec47[_0xf076('0x36')]['limit']);_0x2e1725[_0xf076('0x22')]=qs['offset'](_0x21ec47['query'][_0xf076('0x22')]);}_0x2e1725[_0xf076('0x3e')]=qs['sort'](_0x21ec47['query']['sort']);_0x2e1725[_0xf076('0x3f')]=qs['filters'](_[_0xf076('0x40')](_0x21ec47[_0xf076('0x36')],_0x457946[_0xf076('0x37')]),_0x448aba);if(_0x21ec47[_0xf076('0x36')][_0xf076('0x41')]){_0x2e1725['where']=_[_0xf076('0x42')](_0x2e1725[_0xf076('0x3f')],{'$or':_[_0xf076('0x2f')](_0x448aba,function(_0x2aadee){if(_0x2aadee[_0xf076('0x33')]!==_0xf076('0x43')){var _0x6ae8b0={};_0x6ae8b0[_0x2aadee['name']]={'$like':'%'+_0x21ec47[_0xf076('0x36')][_0xf076('0x41')]+'%'};return _0x6ae8b0;}})});}_0x2e1725=_[_0xf076('0x42')]({},_0x2e1725,_0x21ec47[_0xf076('0x44')]);var _0x100c9e={'where':_0x2e1725[_0xf076('0x3f')]};return db[_0xf076('0x30')]['count'](_0x100c9e)[_0xf076('0x29')](function(_0x53ec88){_0x472b59[_0xf076('0x21')]=_0x53ec88;if(_0x21ec47[_0xf076('0x36')][_0xf076('0x45')]){_0x2e1725[_0xf076('0x46')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xf076('0x47')](_0x2e1725);})[_0xf076('0x29')](function(_0x408723){_0x472b59[_0xf076('0x48')]=_0x408723;return _0x472b59;})[_0xf076('0x29')](respondWithFilteredResult(_0x4d7054,_0x2e1725))[_0xf076('0x49')](handleError(_0x4d7054,null));};exports[_0xf076('0x4a')]=function(_0x398cf6,_0x37e997){var _0x5d3a84={'raw':!![],'where':{'id':_0x398cf6[_0xf076('0x4b')]['id']}},_0x36e31f={};_0x36e31f['model']=_[_0xf076('0x35')](db[_0xf076('0x30')][_0xf076('0x31')]);_0x36e31f[_0xf076('0x36')]=_['keys'](_0x398cf6[_0xf076('0x36')]);_0x36e31f[_0xf076('0x37')]=_['intersection'](_0x36e31f[_0xf076('0x34')],_0x36e31f[_0xf076('0x36')]);_0x5d3a84[_0xf076('0x3a')]=_[_0xf076('0x38')](_0x36e31f['model'],qs[_0xf076('0x39')](_0x398cf6[_0xf076('0x36')]['fields']));_0x5d3a84[_0xf076('0x3a')]=_0x5d3a84['attributes'][_0xf076('0x3b')]?_0x5d3a84[_0xf076('0x3a')]:_0x36e31f[_0xf076('0x34')];if(_0x398cf6[_0xf076('0x36')][_0xf076('0x45')]){_0x5d3a84[_0xf076('0x46')]=[{'all':!![]}];}_0x5d3a84=_['merge']({},_0x5d3a84,_0x398cf6[_0xf076('0x44')]);return db['CmHopperHistory']['find'](_0x5d3a84)['then'](handleEntityNotFound(_0x37e997,null))['then'](respondWithResult(_0x37e997,null))[_0xf076('0x49')](handleError(_0x37e997,null));};exports[_0xf076('0x4c')]=function(_0x4b5055,_0x4d2858){return db[_0xf076('0x30')]['create'](_0x4b5055[_0xf076('0x4d')],{})[_0xf076('0x29')](respondWithResult(_0x4d2858,0xc9))[_0xf076('0x49')](handleError(_0x4d2858,null));};exports['describe']=function(_0x4640ae,_0x214913){return db[_0xf076('0x30')][_0xf076('0x4e')]()[_0xf076('0x29')](respondWithResult(_0x214913,null))[_0xf076('0x49')](handleError(_0x214913,null));};exports[_0xf076('0x28')]=function(_0x58a44f,_0xf5f957){if(_0x58a44f[_0xf076('0x4d')]['uniqueid']){delete _0x58a44f[_0xf076('0x4d')][_0xf076('0x4f')];}return db[_0xf076('0x30')][_0xf076('0x50')]({'where':{'uniqueid':_0x58a44f['params']['id']}})[_0xf076('0x29')](handleEntityNotFound(_0xf5f957,null))[_0xf076('0x29')](saveUpdates(_0x58a44f[_0xf076('0x4d')],null))[_0xf076('0x29')](respondWithResult(_0xf5f957,null))[_0xf076('0x49')](handleError(_0xf5f957,null));}; \ No newline at end of file +var _0x9fd1=['bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','json','offset','count','limit','Content-Range','reject','save','update','then','end','stack','name','send','map','type','model','keys','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','CmHopperHistory','rawAttributes','include','find','create','body','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0xd2dd48,_0x1a985){var _0x3853db=function(_0x2cfb39){while(--_0x2cfb39){_0xd2dd48['push'](_0xd2dd48['shift']());}};_0x3853db(++_0x1a985);}(_0x9fd1,0x86));var _0x19fd=function(_0x5d9d65,_0x75633e){_0x5d9d65=_0x5d9d65-0x0;var _0xb55939=_0x9fd1[_0x5d9d65];return _0xb55939;};'use strict';var emlformat=require(_0x19fd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x19fd('0x1'));var jsonpatch=require(_0x19fd('0x2'));var rp=require(_0x19fd('0x3'));var moment=require('moment');var BPromise=require(_0x19fd('0x4'));var Mustache=require('mustache');var util=require(_0x19fd('0x5'));var path=require(_0x19fd('0x6'));var sox=require(_0x19fd('0x7'));var csv=require(_0x19fd('0x8'));var ejs=require(_0x19fd('0x9'));var fs=require('fs');var fs_extra=require(_0x19fd('0xa'));var _=require(_0x19fd('0xb'));var squel=require(_0x19fd('0xc'));var crypto=require(_0x19fd('0xd'));var jsforce=require(_0x19fd('0xe'));var deskjs=require(_0x19fd('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x19fd('0x10'));var authService=require(_0x19fd('0x11'));var qs=require(_0x19fd('0x12'));var as=require(_0x19fd('0x13'));var hardwareService=require(_0x19fd('0x14'));var logger=require(_0x19fd('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x19fd('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cca97,_0x1243cd){_0x1243cd=_0x1243cd||0xcc;return function(_0x5d24af){if(_0x5d24af){return _0x5cca97[_0x19fd('0x17')](_0x1243cd);}return _0x5cca97[_0x19fd('0x18')](_0x1243cd)['end']();};}function respondWithResult(_0x4b863f,_0x5625a2){_0x5625a2=_0x5625a2||0xc8;return function(_0x4b3c7c){if(_0x4b3c7c){return _0x4b863f[_0x19fd('0x18')](_0x5625a2)[_0x19fd('0x19')](_0x4b3c7c);}};}function respondWithFilteredResult(_0xa948de,_0x51fbf8){return function(_0x18b728){if(_0x18b728){var _0x59071c=typeof _0x51fbf8[_0x19fd('0x1a')]==='undefined'&&typeof _0x51fbf8['limit']==='undefined';var _0x5bd97a=_0x18b728[_0x19fd('0x1b')];var _0x6f475=_0x59071c?0x0:_0x51fbf8[_0x19fd('0x1a')];var _0x420dae=_0x59071c?_0x18b728[_0x19fd('0x1b')]:_0x51fbf8[_0x19fd('0x1a')]+_0x51fbf8[_0x19fd('0x1c')];var _0x5155a9;if(_0x420dae>=_0x5bd97a){_0x420dae=_0x5bd97a;_0x5155a9=0xc8;}else{_0x5155a9=0xce;}_0xa948de[_0x19fd('0x18')](_0x5155a9);return _0xa948de['set'](_0x19fd('0x1d'),_0x6f475+'-'+_0x420dae+'/'+_0x5bd97a)[_0x19fd('0x19')](_0x18b728);}return null;};}function patchUpdates(_0x15ab98){return function(_0x1647ef){try{jsonpatch['apply'](_0x1647ef,_0x15ab98,!![]);}catch(_0x119d25){return BPromise[_0x19fd('0x1e')](_0x119d25);}return _0x1647ef[_0x19fd('0x1f')]();};}function saveUpdates(_0x5319d8,_0x2e9f77){return function(_0x34ee93){if(_0x34ee93){return _0x34ee93[_0x19fd('0x20')](_0x5319d8)['then'](function(_0x9a627b){return _0x9a627b;});}return null;};}function removeEntity(_0x7e307b,_0x590b87){return function(_0x44687f){if(_0x44687f){return _0x44687f['destroy']()[_0x19fd('0x21')](function(){_0x7e307b[_0x19fd('0x18')](0xcc)[_0x19fd('0x22')]();});}};}function handleEntityNotFound(_0x3740d6,_0xa6d96){return function(_0x2a0097){if(!_0x2a0097){_0x3740d6['sendStatus'](0x194);}return _0x2a0097;};}function handleError(_0x26beb1,_0x4b0451){_0x4b0451=_0x4b0451||0x1f4;return function(_0x2d97fe){logger['error'](_0x2d97fe[_0x19fd('0x23')]);if(_0x2d97fe[_0x19fd('0x24')]){delete _0x2d97fe[_0x19fd('0x24')];}_0x26beb1[_0x19fd('0x18')](_0x4b0451)[_0x19fd('0x25')](_0x2d97fe);};}exports['index']=function(_0x2aa8d5,_0x7ebaa0){var _0x4af2a6={},_0x21fc07={},_0x84e479={'count':0x0,'rows':[]};var _0x1fff22=_[_0x19fd('0x26')](db['CmHopperHistory']['rawAttributes'],function(_0x3086cd){return{'name':_0x3086cd['fieldName'],'type':_0x3086cd[_0x19fd('0x27')]['key']};});_0x21fc07[_0x19fd('0x28')]=_[_0x19fd('0x26')](_0x1fff22,'name');_0x21fc07['query']=_[_0x19fd('0x29')](_0x2aa8d5[_0x19fd('0x2a')]);_0x21fc07['filters']=_[_0x19fd('0x2b')](_0x21fc07['model'],_0x21fc07[_0x19fd('0x2a')]);_0x4af2a6['attributes']=_[_0x19fd('0x2b')](_0x21fc07[_0x19fd('0x28')],qs[_0x19fd('0x2c')](_0x2aa8d5[_0x19fd('0x2a')][_0x19fd('0x2c')]));_0x4af2a6[_0x19fd('0x2d')]=_0x4af2a6[_0x19fd('0x2d')]['length']?_0x4af2a6[_0x19fd('0x2d')]:_0x21fc07[_0x19fd('0x28')];if(!_0x2aa8d5[_0x19fd('0x2a')][_0x19fd('0x2e')](_0x19fd('0x2f'))){_0x4af2a6[_0x19fd('0x1c')]=qs[_0x19fd('0x1c')](_0x2aa8d5['query'][_0x19fd('0x1c')]);_0x4af2a6[_0x19fd('0x1a')]=qs[_0x19fd('0x1a')](_0x2aa8d5[_0x19fd('0x2a')][_0x19fd('0x1a')]);}_0x4af2a6[_0x19fd('0x30')]=qs['sort'](_0x2aa8d5[_0x19fd('0x2a')][_0x19fd('0x31')]);_0x4af2a6[_0x19fd('0x32')]=qs[_0x19fd('0x33')](_[_0x19fd('0x34')](_0x2aa8d5[_0x19fd('0x2a')],_0x21fc07[_0x19fd('0x33')]),_0x1fff22);if(_0x2aa8d5[_0x19fd('0x2a')]['filter']){_0x4af2a6['where']=_[_0x19fd('0x35')](_0x4af2a6[_0x19fd('0x32')],{'$or':_['map'](_0x1fff22,function(_0xdb16a4){if(_0xdb16a4[_0x19fd('0x27')]!==_0x19fd('0x36')){var _0x464ba4={};_0x464ba4[_0xdb16a4[_0x19fd('0x24')]]={'$like':'%'+_0x2aa8d5[_0x19fd('0x2a')]['filter']+'%'};return _0x464ba4;}})});}_0x4af2a6=_['merge']({},_0x4af2a6,_0x2aa8d5[_0x19fd('0x37')]);var _0x1fb16e={'where':_0x4af2a6[_0x19fd('0x32')]};return db['CmHopperHistory'][_0x19fd('0x1b')](_0x1fb16e)['then'](function(_0x524fc3){_0x84e479[_0x19fd('0x1b')]=_0x524fc3;if(_0x2aa8d5[_0x19fd('0x2a')][_0x19fd('0x38')]){_0x4af2a6['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x19fd('0x39')](_0x4af2a6);})[_0x19fd('0x21')](function(_0x1d08cd){_0x84e479[_0x19fd('0x3a')]=_0x1d08cd;return _0x84e479;})[_0x19fd('0x21')](respondWithFilteredResult(_0x7ebaa0,_0x4af2a6))[_0x19fd('0x3b')](handleError(_0x7ebaa0,null));};exports['show']=function(_0x256967,_0x52f486){var _0xf91974={'raw':!![],'where':{'id':_0x256967[_0x19fd('0x3c')]['id']}},_0x3bd655={};_0x3bd655[_0x19fd('0x28')]=_[_0x19fd('0x29')](db[_0x19fd('0x3d')][_0x19fd('0x3e')]);_0x3bd655[_0x19fd('0x2a')]=_[_0x19fd('0x29')](_0x256967[_0x19fd('0x2a')]);_0x3bd655[_0x19fd('0x33')]=_[_0x19fd('0x2b')](_0x3bd655[_0x19fd('0x28')],_0x3bd655[_0x19fd('0x2a')]);_0xf91974[_0x19fd('0x2d')]=_['intersection'](_0x3bd655[_0x19fd('0x28')],qs['fields'](_0x256967[_0x19fd('0x2a')][_0x19fd('0x2c')]));_0xf91974[_0x19fd('0x2d')]=_0xf91974[_0x19fd('0x2d')]['length']?_0xf91974['attributes']:_0x3bd655['model'];if(_0x256967[_0x19fd('0x2a')]['includeAll']){_0xf91974[_0x19fd('0x3f')]=[{'all':!![]}];}_0xf91974=_[_0x19fd('0x35')]({},_0xf91974,_0x256967[_0x19fd('0x37')]);return db[_0x19fd('0x3d')][_0x19fd('0x40')](_0xf91974)[_0x19fd('0x21')](handleEntityNotFound(_0x52f486,null))[_0x19fd('0x21')](respondWithResult(_0x52f486,null))[_0x19fd('0x3b')](handleError(_0x52f486,null));};exports['create']=function(_0xe245a6,_0x4d037f){return db[_0x19fd('0x3d')][_0x19fd('0x41')](_0xe245a6[_0x19fd('0x42')],{})[_0x19fd('0x21')](respondWithResult(_0x4d037f,0xc9))[_0x19fd('0x3b')](handleError(_0x4d037f,null));};exports['describe']=function(_0x48f01a,_0x44cce6){return db['CmHopperHistory'][_0x19fd('0x43')]()[_0x19fd('0x21')](respondWithResult(_0x44cce6,null))[_0x19fd('0x3b')](handleError(_0x44cce6,null));};exports[_0x19fd('0x20')]=function(_0x1a81ca,_0xd5b8a8){if(_0x1a81ca[_0x19fd('0x42')]['uniqueid']){delete _0x1a81ca[_0x19fd('0x42')][_0x19fd('0x44')];}return db[_0x19fd('0x3d')][_0x19fd('0x40')]({'where':{'uniqueid':_0x1a81ca['params']['id']}})['then'](handleEntityNotFound(_0xd5b8a8,null))['then'](saveUpdates(_0x1a81ca[_0x19fd('0x42')],null))[_0x19fd('0x21')](respondWithResult(_0xd5b8a8,null))[_0x19fd('0x3b')](handleError(_0xd5b8a8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index a924165..98b7eb2 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 _0x80e0=['cm_hopper_history','endtime','uniqueid','../../config/logger','api','moment','request-promise','path','rimraf','./cmHopperHistory.attributes','exports'];(function(_0x2a7416,_0x2a2b28){var _0x5ed598=function(_0x16ff89){while(--_0x16ff89){_0x2a7416['push'](_0x2a7416['shift']());}};_0x5ed598(++_0x2a2b28);}(_0x80e0,0x9d));var _0x080e=function(_0x22f274,_0x443582){_0x22f274=_0x22f274-0x0;var _0x1a9506=_0x80e0[_0x22f274];return _0x1a9506;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x080e('0x0'))(_0x080e('0x1'));var moment=require(_0x080e('0x2'));var BPromise=require('bluebird');var rp=require(_0x080e('0x3'));var fs=require('fs');var path=require(_0x080e('0x4'));var rimraf=require(_0x080e('0x5'));var config=require('../../config/environment');var attributes=require(_0x080e('0x6'));module[_0x080e('0x7')]=function(_0x307481,_0x52548f){return _0x307481['define']('CmHopperHistory',attributes,{'tableName':_0x080e('0x8'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0x080e('0x9')]},{'name':'uniqueid','fields':[_0x080e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdcdb=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util'];(function(_0x3f888f,_0x4cc275){var _0x14cd0c=function(_0x12975b){while(--_0x12975b){_0x3f888f['push'](_0x3f888f['shift']());}};_0x14cd0c(++_0x4cc275);}(_0xdcdb,0x64));var _0xbdcd=function(_0x2f0f90,_0x411945){_0x2f0f90=_0x2f0f90-0x0;var _0x3da03a=_0xdcdb[_0x2f0f90];return _0x3da03a;};'use strict';var _=require(_0xbdcd('0x0'));var util=require(_0xbdcd('0x1'));var logger=require(_0xbdcd('0x2'))(_0xbdcd('0x3'));var moment=require(_0xbdcd('0x4'));var BPromise=require(_0xbdcd('0x5'));var rp=require(_0xbdcd('0x6'));var fs=require('fs');var path=require(_0xbdcd('0x7'));var rimraf=require(_0xbdcd('0x8'));var config=require(_0xbdcd('0x9'));var attributes=require(_0xbdcd('0xa'));module[_0xbdcd('0xb')]=function(_0x3a8b0d,_0x471f46){return _0x3a8b0d[_0xbdcd('0xc')](_0xbdcd('0xd'),attributes,{'tableName':_0xbdcd('0xe'),'paranoid':![],'indexes':[{'name':_0xbdcd('0xf'),'fields':[_0xbdcd('0xf')]},{'name':_0xbdcd('0x10'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 837857c..9c14cc3 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 _0xc678=['`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrTotalCallsDays','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','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','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay'];(function(_0x4ace6e,_0x162d9d){var _0x265c2d=function(_0x160bf6){while(--_0x160bf6){_0x4ace6e['push'](_0x4ace6e['shift']());}};_0x265c2d(++_0x162d9d);}(_0xc678,0x1b4));var _0x8c67=function(_0xc091ba,_0x300504){_0xc091ba=_0xc091ba-0x0;var _0xeb0355=_0xc678[_0xc091ba];return _0xeb0355;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8c67('0x0'));var BPromise=require(_0x8c67('0x1'));var rs=require(_0x8c67('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c67('0x3'))['db'];var utils=require(_0x8c67('0x4'));var logger=require(_0x8c67('0x5'))(_0x8c67('0x6'));var config=require('../../config/environment');var jayson=require(_0x8c67('0x7'));var client=jayson['client'][_0x8c67('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b4ceb,_0x4c2ffe,_0x207de1){return new BPromise(function(_0x22d7e4,_0x41ac88){return client[_0x8c67('0x9')](_0x1b4ceb,_0x207de1)[_0x8c67('0xa')](function(_0x5bac97){logger[_0x8c67('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x4c2ffe,_0x8c67('0xc'));logger[_0x8c67('0xd')](_0x8c67('0xe'),_0x4c2ffe,'request\x20sent',JSON[_0x8c67('0xf')](_0x5bac97));if(_0x5bac97[_0x8c67('0x10')]){if(_0x5bac97[_0x8c67('0x10')][_0x8c67('0x11')]===0x1f4){logger['error'](_0x8c67('0x12'),_0x4c2ffe,_0x5bac97['error']['message']);return _0x41ac88(_0x5bac97['error']['message']);}logger[_0x8c67('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x4c2ffe,_0x5bac97[_0x8c67('0x10')]['message']);return _0x22d7e4(_0x5bac97[_0x8c67('0x10')][_0x8c67('0x13')]);}else{logger[_0x8c67('0xb')](_0x8c67('0x12'),_0x4c2ffe,'request\x20sent');_0x22d7e4(_0x5bac97[_0x8c67('0x14')][_0x8c67('0x13')]);}})[_0x8c67('0x15')](function(_0x1bae2f){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x4c2ffe,_0x1bae2f);_0x41ac88(_0x1bae2f);});});}exports[_0x8c67('0x16')]=function(_0x3e9ab8){var _0x215d52=this;return new Promise(function(_0x544717,_0xe7f0b6){return db[_0x8c67('0x17')]['create'](_0x3e9ab8[_0x8c67('0x18')],{'raw':_0x3e9ab8['options']?_0x3e9ab8[_0x8c67('0x19')][_0x8c67('0x1a')]===undefined?!![]:![]:!![]})[_0x8c67('0xa')](function(_0x2bd6b3){logger[_0x8c67('0xb')]('CreateCmHopperHistory',_0x3e9ab8);logger[_0x8c67('0xd')](_0x8c67('0x16'),_0x3e9ab8,JSON['stringify'](_0x2bd6b3));_0x544717(_0x2bd6b3);})[_0x8c67('0x15')](function(_0x5486e8){logger[_0x8c67('0x10')](_0x8c67('0x16'),_0x5486e8[_0x8c67('0x13')],_0x3e9ab8);_0xe7f0b6(_0x215d52[_0x8c67('0x10')](0x1f4,_0x5486e8[_0x8c67('0x13')]));});});};exports['AvgHandleTime']=function(_0x2658a1){var _0x26fb02=this;return new Promise(function(_0x94d19b,_0xbb787e){return db[_0x8c67('0x17')][_0x8c67('0x1b')]({'raw':_0x2658a1['options']?_0x2658a1['options'][_0x8c67('0x1a')]===undefined?!![]:![]:!![],'where':_0x2658a1['options']?_0x2658a1['options'][_0x8c67('0x1c')]||null:null,'attributes':[[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db['sequelize'][_0x8c67('0x1f')]('id')),_0x8c67('0x20')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db['sequelize']['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x22')))),_0x8c67('0x23')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db['sequelize'][_0x8c67('0x21')](_0x8c67('0x24')))),_0x8c67('0x25')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x8c67('0x21')](_0x8c67('0x26')))),_0x8c67('0x27')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x28'),db['sequelize']['fn']('IF',db['sequelize'][_0x8c67('0x21')](_0x8c67('0x29')))),_0x8c67('0x2a')],[db['sequelize']['fn'](_0x8c67('0x28'),db[_0x8c67('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x8c67('0x2b')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x2a855a){logger[_0x8c67('0xb')](_0x8c67('0x2c'),_0x2658a1);logger[_0x8c67('0xd')](_0x8c67('0x2c'),_0x2658a1,JSON[_0x8c67('0xf')](_0x2a855a));_0x94d19b(_0x2a855a);})[_0x8c67('0x15')](function(_0x435ece){logger['error']('AvgHandleTime',_0x435ece[_0x8c67('0x13')],_0x2658a1);_0xbb787e(_0x26fb02['error'](0x1f4,_0x435ece[_0x8c67('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x34684a){var _0x3a956a=this;return new Promise(function(_0x2a37b4,_0x2145b4){return db['CmHopperHistory'][_0x8c67('0x1b')]({'raw':_0x34684a[_0x8c67('0x19')]?_0x34684a['options'][_0x8c67('0x1a')]===undefined?!![]:![]:!![],'where':_0x34684a[_0x8c67('0x19')]?_0x34684a[_0x8c67('0x19')]['where']||null:null,'attributes':[['campaign',_0x8c67('0x2d')],[db[_0x8c67('0x1d')]['fn']('COUNT',db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x2e')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x8c67('0x2f')))),_0x8c67('0x30')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x22')))),_0x8c67('0x31')],[db[_0x8c67('0x1d')]['fn']('COUNT',db[_0x8c67('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x8c67('0x32')],[db['sequelize']['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x33')))),'outboundCongestionCallsDay'],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')]['literal'](_0x8c67('0x34')))),_0x8c67('0x35')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db['sequelize'][_0x8c67('0x21')](_0x8c67('0x36')))),_0x8c67('0x37')],[db[_0x8c67('0x1d')]['fn']('COUNT',db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x38')))),_0x8c67('0x39')],[db[_0x8c67('0x1d')]['fn']('COUNT',db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')]['literal']('`state`\x20=\x2013,\x201,\x20null'))),_0x8c67('0x3a')],[db['sequelize']['fn'](_0x8c67('0x1e'),db['sequelize']['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x3b')))),_0x8c67('0x3c')],[db['sequelize']['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x3d')))),_0x8c67('0x3e')],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x3f')))),_0x8c67('0x40')],[db['sequelize']['fn'](_0x8c67('0x1e'),db[_0x8c67('0x1d')]['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x41')))),'outboundRejectCallsDay'],[db[_0x8c67('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8c67('0x1d')][_0x8c67('0x21')](_0x8c67('0x42')))),'outboundReCallsDay']],'group':[_0x8c67('0x43')]})['then'](function(_0x50fb02){logger[_0x8c67('0xb')](_0x8c67('0x44'),_0x34684a);logger[_0x8c67('0xd')](_0x8c67('0x44'),_0x34684a,JSON[_0x8c67('0xf')](_0x50fb02));_0x2a37b4(_0x50fb02);})['catch'](function(_0xc9ff67){logger[_0x8c67('0x10')]('GetVoiceQueueHopperHistory',_0xc9ff67[_0x8c67('0x13')],_0x34684a);_0x2145b4(_0x3a956a[_0x8c67('0x10')](0x1f4,_0xc9ff67[_0x8c67('0x13')]));});});};exports[_0x8c67('0x45')]=function(_0x4724c7){var _0x51555f=this;return new Promise(function(_0x31bd72,_0x3344ce){return db[_0x8c67('0x17')][_0x8c67('0x1b')]({'raw':_0x4724c7['options']?_0x4724c7['options']['raw']===undefined?!![]:![]:!![],'where':_0x4724c7[_0x8c67('0x19')]?_0x4724c7[_0x8c67('0x19')][_0x8c67('0x1c')]||null:null,'attributes':[[_0x8c67('0x43'),'name'],[db[_0x8c67('0x1d')]['fn'](_0x8c67('0x1e'),db['sequelize']['col']('id')),_0x8c67('0x46')],[db[_0x8c67('0x1d')]['fn']('COUNT',db[_0x8c67('0x1d')]['fn']('IF',db['sequelize'][_0x8c67('0x21')]('`state`\x20=\x204,\x201,\x20null'))),'ivrAnswerCallsDay']],'group':[_0x8c67('0x43')]})[_0x8c67('0xa')](function(_0x4465e2){logger['info']('GetCampaignHopperHistory',_0x4724c7);logger[_0x8c67('0xd')]('GetCampaignHopperHistory',_0x4724c7,JSON[_0x8c67('0xf')](_0x4465e2));_0x31bd72(_0x4465e2);})[_0x8c67('0x15')](function(_0x278377){logger['error'](_0x8c67('0x45'),_0x278377['message'],_0x4724c7);_0x3344ce(_0x51555f['error'](0x1f4,_0x278377['message']));});});}; \ No newline at end of file +var _0x6505=['../../config/logger','rpc','../../config/environment','client','http','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','catch','AvgHandleTime','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5654ef,_0x1ddf03){var _0x40fee1=function(_0x128450){while(--_0x128450){_0x5654ef['push'](_0x5654ef['shift']());}};_0x40fee1(++_0x1ddf03);}(_0x6505,0x8c));var _0x5650=function(_0x319383,_0x895da){_0x319383=_0x319383-0x0;var _0x187a52=_0x6505[_0x319383];return _0x187a52;};'use strict';var _=require(_0x5650('0x0'));var util=require(_0x5650('0x1'));var moment=require(_0x5650('0x2'));var BPromise=require(_0x5650('0x3'));var rs=require(_0x5650('0x4'));var fs=require('fs');var Redis=require(_0x5650('0x5'));var db=require(_0x5650('0x6'))['db'];var utils=require(_0x5650('0x7'));var logger=require(_0x5650('0x8'))(_0x5650('0x9'));var config=require(_0x5650('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5650('0xb')][_0x5650('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39fab5,_0x21a5b1,_0x224352){return new BPromise(function(_0x29fc80,_0x14a29b){return client['request'](_0x39fab5,_0x224352)[_0x5650('0xd')](function(_0x4cde26){logger[_0x5650('0xe')](_0x5650('0xf'),_0x21a5b1,_0x5650('0x10'));logger[_0x5650('0x11')](_0x5650('0x12'),_0x21a5b1,_0x5650('0x10'),JSON[_0x5650('0x13')](_0x4cde26));if(_0x4cde26[_0x5650('0x14')]){if(_0x4cde26[_0x5650('0x14')][_0x5650('0x15')]===0x1f4){logger[_0x5650('0x14')](_0x5650('0xf'),_0x21a5b1,_0x4cde26[_0x5650('0x14')][_0x5650('0x16')]);return _0x14a29b(_0x4cde26[_0x5650('0x14')][_0x5650('0x16')]);}logger[_0x5650('0x14')](_0x5650('0xf'),_0x21a5b1,_0x4cde26[_0x5650('0x14')][_0x5650('0x16')]);return _0x29fc80(_0x4cde26['error'][_0x5650('0x16')]);}else{logger[_0x5650('0xe')](_0x5650('0xf'),_0x21a5b1,_0x5650('0x10'));_0x29fc80(_0x4cde26[_0x5650('0x17')][_0x5650('0x16')]);}})['catch'](function(_0x3f0aa8){logger[_0x5650('0x14')](_0x5650('0xf'),_0x21a5b1,_0x3f0aa8);_0x14a29b(_0x3f0aa8);});});}exports[_0x5650('0x18')]=function(_0x493633){var _0x2896e2=this;return new Promise(function(_0x44c67b,_0x14bfa4){return db[_0x5650('0x19')][_0x5650('0x1a')](_0x493633[_0x5650('0x1b')],{'raw':_0x493633[_0x5650('0x1c')]?_0x493633[_0x5650('0x1c')][_0x5650('0x1d')]===undefined?!![]:![]:!![]})[_0x5650('0xd')](function(_0x34b79a){logger[_0x5650('0xe')]('CreateCmHopperHistory',_0x493633);logger[_0x5650('0x11')](_0x5650('0x18'),_0x493633,JSON[_0x5650('0x13')](_0x34b79a));_0x44c67b(_0x34b79a);})[_0x5650('0x1e')](function(_0x44d93f){logger[_0x5650('0x14')](_0x5650('0x18'),_0x44d93f[_0x5650('0x16')],_0x493633);_0x14bfa4(_0x2896e2[_0x5650('0x14')](0x1f4,_0x44d93f[_0x5650('0x16')]));});});};exports[_0x5650('0x1f')]=function(_0x24526f){var _0x92ec49=this;return new Promise(function(_0x5daac0,_0x54853c){return db['CmHopperHistory'][_0x5650('0x20')]({'raw':_0x24526f[_0x5650('0x1c')]?_0x24526f[_0x5650('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x24526f['options']?_0x24526f[_0x5650('0x1c')]['where']||null:null,'attributes':[[db[_0x5650('0x21')]['fn'](_0x5650('0x22'),db[_0x5650('0x21')][_0x5650('0x23')]('id')),_0x5650('0x24')],[db[_0x5650('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5650('0x21')][_0x5650('0x25')](_0x5650('0x26')))),_0x5650('0x27')],[db[_0x5650('0x21')]['fn'](_0x5650('0x22'),db['sequelize']['fn']('IF',db[_0x5650('0x21')]['literal']('`state`\x20=\x2010,\x201,\x20null'))),_0x5650('0x28')],[db[_0x5650('0x21')]['fn'](_0x5650('0x22'),db['sequelize']['fn']('IF',db[_0x5650('0x21')][_0x5650('0x25')]('`state`\x20=\x2011,\x201,\x20null'))),_0x5650('0x29')],[db[_0x5650('0x21')]['fn'](_0x5650('0x2a'),db[_0x5650('0x21')]['fn']('IF',db[_0x5650('0x21')][_0x5650('0x25')](_0x5650('0x2b')))),_0x5650('0x2c')],[db[_0x5650('0x21')]['fn'](_0x5650('0x2a'),db[_0x5650('0x21')]['fn']('IF',db[_0x5650('0x21')]['literal'](_0x5650('0x2d')))),_0x5650('0x2e')]]})['then'](function(_0x29a4fc){logger[_0x5650('0xe')]('AvgHandleTime',_0x24526f);logger['debug'](_0x5650('0x1f'),_0x24526f,JSON[_0x5650('0x13')](_0x29a4fc));_0x5daac0(_0x29a4fc);})[_0x5650('0x1e')](function(_0x128f87){logger[_0x5650('0x14')]('AvgHandleTime',_0x128f87['message'],_0x24526f);_0x54853c(_0x92ec49[_0x5650('0x14')](0x1f4,_0x128f87[_0x5650('0x16')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x415660){var _0x38a3d8=this;return new Promise(function(_0x4a1244,_0x926279){return db['CmHopperHistory']['findAll']({'raw':_0x415660[_0x5650('0x1c')]?_0x415660[_0x5650('0x1c')][_0x5650('0x1d')]===undefined?!![]:![]:!![],'where':_0x415660[_0x5650('0x1c')]?_0x415660['options'][_0x5650('0x2f')]||null:null,'attributes':[[_0x5650('0x30'),_0x5650('0x31')],[db[_0x5650('0x21')]['fn'](_0x5650('0x22'),db[_0x5650('0x21')]['fn']('IF',db[_0x5650('0x21')]['literal'](_0x5650('0x32')))),_0x5650('0x33')],[db[_0x5650('0x21')]['fn'](_0x5650('0x22'),db[_0x5650('0x21')]['fn']('IF',db[_0x5650('0x21')][_0x5650('0x25')]('`state`\x20=\x203,\x201,\x20null'))),_0x5650('0x34')],[db[_0x5650('0x21')]['fn']('COUNT',db[_0x5650('0x21')]['fn']('IF',db[_0x5650('0x21')][_0x5650('0x25')](_0x5650('0x26')))),_0x5650('0x35')],[db['sequelize']['fn'](_0x5650('0x22'),db[_0x5650('0x21')]['fn']('IF',db[_0x5650('0x21')][_0x5650('0x25')]('`state`\x20=\x205,\x201,\x20null'))),_0x5650('0x36')],[db[_0x5650('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x5650('0x37')))),_0x5650('0x38')],[db[_0x5650('0x21')]['fn'](_0x5650('0x22'),db[_0x5650('0x21')]['fn']('IF',db[_0x5650('0x21')][_0x5650('0x25')](_0x5650('0x39')))),_0x5650('0x3a')],[db[_0x5650('0x21')]['fn'](_0x5650('0x22'),db[_0x5650('0x21')]['fn']('IF',db[_0x5650('0x21')][_0x5650('0x25')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5650('0x3b')],[db[_0x5650('0x21')]['fn'](_0x5650('0x22'),db[_0x5650('0x21')]['fn']('IF',db[_0x5650('0x21')][_0x5650('0x25')](_0x5650('0x3c')))),_0x5650('0x3d')],[db[_0x5650('0x21')]['fn'](_0x5650('0x22'),db[_0x5650('0x21')]['fn']('IF',db['sequelize']['literal'](_0x5650('0x3e')))),'outboundBlacklistCallsDay'],[db[_0x5650('0x21')]['fn'](_0x5650('0x22'),db[_0x5650('0x21')]['fn']('IF',db[_0x5650('0x21')]['literal'](_0x5650('0x3f')))),_0x5650('0x40')],[db[_0x5650('0x21')]['fn'](_0x5650('0x22'),db['sequelize']['fn']('IF',db[_0x5650('0x21')][_0x5650('0x25')](_0x5650('0x41')))),_0x5650('0x42')],[db[_0x5650('0x21')]['fn'](_0x5650('0x22'),db[_0x5650('0x21')]['fn']('IF',db['sequelize']['literal'](_0x5650('0x43')))),_0x5650('0x44')],[db[_0x5650('0x21')]['fn'](_0x5650('0x22'),db[_0x5650('0x21')]['fn']('IF',db['sequelize'][_0x5650('0x25')](_0x5650('0x45')))),_0x5650('0x42')],[db[_0x5650('0x21')]['fn']('COUNT',db[_0x5650('0x21')]['fn']('IF',db[_0x5650('0x21')][_0x5650('0x25')](_0x5650('0x46')))),'outboundReCallsDay']],'group':[_0x5650('0x30')]})[_0x5650('0xd')](function(_0x4ac3f5){logger[_0x5650('0xe')](_0x5650('0x47'),_0x415660);logger[_0x5650('0x11')](_0x5650('0x47'),_0x415660,JSON[_0x5650('0x13')](_0x4ac3f5));_0x4a1244(_0x4ac3f5);})[_0x5650('0x1e')](function(_0x4ef82e){logger['error'](_0x5650('0x47'),_0x4ef82e[_0x5650('0x16')],_0x415660);_0x926279(_0x38a3d8[_0x5650('0x14')](0x1f4,_0x4ef82e[_0x5650('0x16')]));});});};exports['GetCampaignHopperHistory']=function(_0x4ed486){var _0x486e8c=this;return new Promise(function(_0x48dd44,_0x37ec72){return db[_0x5650('0x19')][_0x5650('0x20')]({'raw':_0x4ed486[_0x5650('0x1c')]?_0x4ed486[_0x5650('0x1c')][_0x5650('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ed486['options']?_0x4ed486[_0x5650('0x1c')]['where']||null:null,'attributes':[[_0x5650('0x30'),_0x5650('0x31')],[db[_0x5650('0x21')]['fn'](_0x5650('0x22'),db[_0x5650('0x21')]['col']('id')),'ivrTotalCallsDays'],[db[_0x5650('0x21')]['fn'](_0x5650('0x22'),db['sequelize']['fn']('IF',db[_0x5650('0x21')][_0x5650('0x25')](_0x5650('0x26')))),_0x5650('0x48')]],'group':['campaign']})['then'](function(_0x27a51e){logger[_0x5650('0xe')](_0x5650('0x49'),_0x4ed486);logger['debug'](_0x5650('0x49'),_0x4ed486,JSON[_0x5650('0x13')](_0x27a51e));_0x48dd44(_0x27a51e);})[_0x5650('0x1e')](function(_0x2338eb){logger['error'](_0x5650('0x49'),_0x2338eb[_0x5650('0x16')],_0x4ed486);_0x37ec72(_0x486e8c['error'](0x1f4,_0x2338eb[_0x5650('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 54eb4d1..b7bcf5d 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 _0xb5a4=['../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','put','util','path','Router','fs-extra','../../components/interaction/service'];(function(_0x499b6c,_0x137024){var _0x4a9d83=function(_0x5e364a){while(--_0x5e364a){_0x499b6c['push'](_0x499b6c['shift']());}};_0x4a9d83(++_0x137024);}(_0xb5a4,0xcd));var _0x4b5a=function(_0x9d2949,_0x259ca0){_0x9d2949=_0x9d2949-0x0;var _0x5596ad=_0xb5a4[_0x9d2949];return _0x5596ad;};'use strict';var multer=require('multer');var util=require(_0x4b5a('0x0'));var path=require(_0x4b5a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4b5a('0x2')]();var fs_extra=require(_0x4b5a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4b5a('0x4'));var config=require(_0x4b5a('0x5'));var controller=require('./cmHopperHistory.controller');router[_0x4b5a('0x6')]('/',auth['isAuthenticated'](),controller[_0x4b5a('0x7')]);router['get'](_0x4b5a('0x8'),auth[_0x4b5a('0x9')](),controller[_0x4b5a('0xa')]);router['get'](_0x4b5a('0xb'),auth[_0x4b5a('0x9')](),controller[_0x4b5a('0xc')]);router[_0x4b5a('0xd')]('/',auth[_0x4b5a('0x9')](),controller['create']);router[_0x4b5a('0xe')]('/:id',auth[_0x4b5a('0x9')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x75f0=['isAuthenticated','show','post','create','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmHopperHistory.controller','get','/describe','describe'];(function(_0x50bece,_0x49771a){var _0x77c2c=function(_0x1f880b){while(--_0x1f880b){_0x50bece['push'](_0x50bece['shift']());}};_0x77c2c(++_0x49771a);}(_0x75f0,0x1e2));var _0x075f=function(_0x3cb48e,_0x580d7a){_0x3cb48e=_0x3cb48e-0x0;var _0x27c35a=_0x75f0[_0x3cb48e];return _0x27c35a;};'use strict';var multer=require(_0x075f('0x0'));var util=require(_0x075f('0x1'));var path=require('path');var timeout=require(_0x075f('0x2'));var express=require(_0x075f('0x3'));var router=express['Router']();var fs_extra=require(_0x075f('0x4'));var auth=require(_0x075f('0x5'));var interaction=require(_0x075f('0x6'));var config=require('../../config/environment');var controller=require(_0x075f('0x7'));router[_0x075f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x075f('0x8')](_0x075f('0x9'),auth['isAuthenticated'](),controller[_0x075f('0xa')]);router[_0x075f('0x8')]('/:id',auth[_0x075f('0xb')](),controller[_0x075f('0xc')]);router[_0x075f('0xd')]('/',auth[_0x075f('0xb')](),controller[_0x075f('0xe')]);router['put']('/:id',auth[_0x075f('0xb')](),controller[_0x075f('0xf')]);module[_0x075f('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 9e30827..37a0c05 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 _0x7da7=['exports','STRING','sequelize'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x7da7,0x10d));var _0x77da=function(_0x37c8ef,_0x334449){_0x37c8ef=_0x37c8ef-0x0;var _0x5eaee9=_0x7da7[_0x37c8ef];return _0x5eaee9;};'use strict';var Sequelize=require(_0x77da('0x0'));module[_0x77da('0x1')]={'name':{'type':Sequelize[_0x77da('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x77da('0x2')]}}; \ No newline at end of file +var _0xfd7b=['STRING','name','exports'];(function(_0x14aea7,_0x955df6){var _0xcab72c=function(_0x239fbb){while(--_0x239fbb){_0x14aea7['push'](_0x14aea7['shift']());}};_0xcab72c(++_0x955df6);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xfd7b[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require('sequelize');module[_0xbfd7('0x0')]={'name':{'type':Sequelize[_0xbfd7('0x1')],'unique':_0xbfd7('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbfd7('0x1')]},'dialPrefix':{'type':Sequelize[_0xbfd7('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 376ce8d..ce6caa4 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 _0x9ec4=['Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','omit','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Lists','error','stack','name','index','map','CmList','rawAttributes','type','key','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','Disposition','getDispositions','findOne','length','removeDispositions','ids','addContacts','CmContact','isArray','tags','join','push','each','success','dataValues','errors','message','json','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields'];(function(_0x1017fa,_0x371fe5){var _0x3072e8=function(_0x42b827){while(--_0x42b827){_0x1017fa['push'](_0x1017fa['shift']());}};_0x3072e8(++_0x371fe5);}(_0x9ec4,0x147));var _0x49ec=function(_0x5109a3,_0x494ed5){_0x5109a3=_0x5109a3-0x0;var _0x25df9e=_0x9ec4[_0x5109a3];return _0x25df9e;};'use strict';var emlformat=require(_0x49ec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x49ec('0x1'));var jsonpatch=require(_0x49ec('0x2'));var rp=require(_0x49ec('0x3'));var moment=require(_0x49ec('0x4'));var BPromise=require(_0x49ec('0x5'));var Mustache=require(_0x49ec('0x6'));var util=require(_0x49ec('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x49ec('0x8'));var ejs=require(_0x49ec('0x9'));var fs=require('fs');var fs_extra=require(_0x49ec('0xa'));var _=require(_0x49ec('0xb'));var squel=require('squel');var crypto=require(_0x49ec('0xc'));var jsforce=require(_0x49ec('0xd'));var deskjs=require(_0x49ec('0xe'));var toCsv=require(_0x49ec('0x8'));var querystring=require(_0x49ec('0xf'));var Papa=require(_0x49ec('0x10'));var Redis=require(_0x49ec('0x11'));var authService=require(_0x49ec('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x49ec('0x13'));var hardwareService=require(_0x49ec('0x14'));var logger=require(_0x49ec('0x15'))(_0x49ec('0x16'));var utils=require(_0x49ec('0x17'));var config=require(_0x49ec('0x18'));var licenseUtil=require(_0x49ec('0x19'));var db=require(_0x49ec('0x1a'))['db'];config[_0x49ec('0x1b')]=_[_0x49ec('0x1c')](config[_0x49ec('0x1b')],{'host':_0x49ec('0x1d'),'port':0x18eb});var socket=require(_0x49ec('0x1e'))(new Redis(config[_0x49ec('0x1b')]));require(_0x49ec('0x1f'))[_0x49ec('0x20')](socket);function respondWithStatusCode(_0x480ce9,_0x536a91){_0x536a91=_0x536a91||0xcc;return function(_0x291b23){if(_0x291b23){return _0x480ce9[_0x49ec('0x21')](_0x536a91);}return _0x480ce9[_0x49ec('0x22')](_0x536a91)[_0x49ec('0x23')]();};}function respondWithResult(_0x575f3a,_0x376603){_0x376603=_0x376603||0xc8;return function(_0x2e226){if(_0x2e226){return _0x575f3a[_0x49ec('0x22')](_0x376603)['json'](_0x2e226);}};}function respondWithFilteredResult(_0x3c6637,_0x576d72){return function(_0x1f855a){if(_0x1f855a){var _0x427ec7=typeof _0x576d72['offset']===_0x49ec('0x24')&&typeof _0x576d72[_0x49ec('0x25')]===_0x49ec('0x24');var _0x2480bf=_0x1f855a[_0x49ec('0x26')];var _0x51da15=_0x427ec7?0x0:_0x576d72[_0x49ec('0x27')];var _0x4a81a8=_0x427ec7?_0x1f855a['count']:_0x576d72['offset']+_0x576d72['limit'];var _0x53999a;if(_0x4a81a8>=_0x2480bf){_0x4a81a8=_0x2480bf;_0x53999a=0xc8;}else{_0x53999a=0xce;}_0x3c6637[_0x49ec('0x22')](_0x53999a);return _0x3c6637[_0x49ec('0x28')](_0x49ec('0x29'),_0x51da15+'-'+_0x4a81a8+'/'+_0x2480bf)['json'](_0x1f855a);}return null;};}function patchUpdates(_0x1a4e5a){return function(_0x486355){try{jsonpatch[_0x49ec('0x2a')](_0x486355,_0x1a4e5a,!![]);}catch(_0x135f2e){return BPromise[_0x49ec('0x2b')](_0x135f2e);}return _0x486355[_0x49ec('0x2c')]();};}function saveUpdates(_0xa8fd17,_0x370a7a){return function(_0x40cd33){if(_0x40cd33){return _0x40cd33['update'](_0xa8fd17)[_0x49ec('0x2d')](function(_0x4ba5e4){return _0x4ba5e4;});}return null;};}function removeEntity(_0x407e50,_0xadccc8){return function(_0x38f405){if(_0x38f405){return _0x38f405[_0x49ec('0x2e')]()[_0x49ec('0x2d')](function(){var _0x2c3ce3=_0x38f405[_0x49ec('0x2f')]({'plain':!![]});var _0x30ea70=_0x49ec('0x30');return db['UserProfileResource'][_0x49ec('0x2e')]({'where':{'type':_0x30ea70,'resourceId':_0x2c3ce3['id']}})[_0x49ec('0x2d')](function(){return _0x38f405;});})['then'](function(){_0x407e50['status'](0xcc)[_0x49ec('0x23')]();});}};}function handleEntityNotFound(_0xa122fc,_0x38e17c){return function(_0x169042){if(!_0x169042){_0xa122fc[_0x49ec('0x21')](0x194);}return _0x169042;};}function handleError(_0x17c952,_0x552ebf){_0x552ebf=_0x552ebf||0x1f4;return function(_0x10f0ab){logger[_0x49ec('0x31')](_0x10f0ab[_0x49ec('0x32')]);if(_0x10f0ab['name']){delete _0x10f0ab[_0x49ec('0x33')];}_0x17c952['status'](_0x552ebf)['send'](_0x10f0ab);};}exports[_0x49ec('0x34')]=function(_0x2e6a2b,_0x1cb9ae){var _0x2af790={},_0x36b0f0={},_0x57e6ce={'count':0x0,'rows':[]};var _0x2d271c=_[_0x49ec('0x35')](db[_0x49ec('0x36')][_0x49ec('0x37')],function(_0x515cdd){return{'name':_0x515cdd['fieldName'],'type':_0x515cdd[_0x49ec('0x38')][_0x49ec('0x39')]};});_0x36b0f0[_0x49ec('0x3a')]=_[_0x49ec('0x35')](_0x2d271c,_0x49ec('0x33'));_0x36b0f0['query']=_['keys'](_0x2e6a2b['query']);_0x36b0f0[_0x49ec('0x3b')]=_[_0x49ec('0x3c')](_0x36b0f0[_0x49ec('0x3a')],_0x36b0f0[_0x49ec('0x3d')]);_0x2af790[_0x49ec('0x3e')]=_[_0x49ec('0x3c')](_0x36b0f0['model'],qs[_0x49ec('0x3f')](_0x2e6a2b[_0x49ec('0x3d')][_0x49ec('0x3f')]));_0x2af790[_0x49ec('0x3e')]=_0x2af790['attributes']['length']?_0x2af790[_0x49ec('0x3e')]:_0x36b0f0[_0x49ec('0x3a')];if(!_0x2e6a2b[_0x49ec('0x3d')][_0x49ec('0x40')](_0x49ec('0x41'))){_0x2af790[_0x49ec('0x25')]=qs[_0x49ec('0x25')](_0x2e6a2b[_0x49ec('0x3d')][_0x49ec('0x25')]);_0x2af790['offset']=qs['offset'](_0x2e6a2b[_0x49ec('0x3d')][_0x49ec('0x27')]);}_0x2af790[_0x49ec('0x42')]=qs[_0x49ec('0x43')](_0x2e6a2b[_0x49ec('0x3d')][_0x49ec('0x43')]);_0x2af790[_0x49ec('0x44')]=qs[_0x49ec('0x3b')](_[_0x49ec('0x45')](_0x2e6a2b[_0x49ec('0x3d')],_0x36b0f0[_0x49ec('0x3b')]),_0x2d271c);if(_0x2e6a2b[_0x49ec('0x3d')][_0x49ec('0x46')]){_0x2af790['where']=_[_0x49ec('0x47')](_0x2af790['where'],{'$or':_['map'](_0x2d271c,function(_0x231f6e){if(_0x231f6e[_0x49ec('0x38')]!==_0x49ec('0x48')){var _0x56ed83={};_0x56ed83[_0x231f6e['name']]={'$like':'%'+_0x2e6a2b[_0x49ec('0x3d')][_0x49ec('0x46')]+'%'};return _0x56ed83;}})});}_0x2af790=_[_0x49ec('0x47')]({},_0x2af790,_0x2e6a2b[_0x49ec('0x49')]);var _0x1ac398={'where':_0x2af790[_0x49ec('0x44')]};return db[_0x49ec('0x36')]['count'](_0x1ac398)[_0x49ec('0x2d')](function(_0xd717e5){_0x57e6ce[_0x49ec('0x26')]=_0xd717e5;if(_0x2e6a2b[_0x49ec('0x3d')][_0x49ec('0x4a')]){_0x2af790[_0x49ec('0x4b')]=[{'all':!![]}];}return db[_0x49ec('0x36')][_0x49ec('0x4c')](_0x2af790);})['then'](function(_0xb400c1){_0x57e6ce[_0x49ec('0x4d')]=_0xb400c1;return _0x57e6ce;})[_0x49ec('0x2d')](respondWithFilteredResult(_0x1cb9ae,_0x2af790))[_0x49ec('0x4e')](handleError(_0x1cb9ae,null));};exports[_0x49ec('0x4f')]=function(_0x1a54dc,_0x1b0427){var _0x17e78c={'raw':![],'where':{'id':_0x1a54dc[_0x49ec('0x50')]['id']}},_0x2386ba={};_0x2386ba[_0x49ec('0x3a')]=_[_0x49ec('0x51')](db[_0x49ec('0x36')][_0x49ec('0x37')]);_0x2386ba['query']=_[_0x49ec('0x51')](_0x1a54dc[_0x49ec('0x3d')]);_0x2386ba[_0x49ec('0x3b')]=_['intersection'](_0x2386ba[_0x49ec('0x3a')],_0x2386ba[_0x49ec('0x3d')]);_0x17e78c[_0x49ec('0x3e')]=_[_0x49ec('0x3c')](_0x2386ba[_0x49ec('0x3a')],qs['fields'](_0x1a54dc[_0x49ec('0x3d')][_0x49ec('0x3f')]));_0x17e78c['attributes']=_0x17e78c[_0x49ec('0x3e')]['length']?_0x17e78c[_0x49ec('0x3e')]:_0x2386ba['model'];if(_0x1a54dc[_0x49ec('0x3d')][_0x49ec('0x4a')]){_0x17e78c[_0x49ec('0x4b')]=[{'all':!![]}];}_0x17e78c=_[_0x49ec('0x47')]({},_0x17e78c,_0x1a54dc[_0x49ec('0x49')]);return db[_0x49ec('0x36')][_0x49ec('0x52')](_0x17e78c)['then'](handleEntityNotFound(_0x1b0427,null))[_0x49ec('0x2d')](respondWithResult(_0x1b0427,null))['catch'](handleError(_0x1b0427,null));};exports['create']=function(_0x3b3311,_0x39a276){return db['CmList'][_0x49ec('0x53')](_0x3b3311[_0x49ec('0x54')],{})[_0x49ec('0x2d')](function(_0x251f1e){var _0x3d3561=_0x3b3311[_0x49ec('0x55')][_0x49ec('0x2f')]({'plain':!![]});if(!_0x3d3561)throw new Error(_0x49ec('0x56'));if(_0x3d3561[_0x49ec('0x57')]===_0x49ec('0x55')){var _0xb4e5cd=_0x251f1e[_0x49ec('0x2f')]({'plain':!![]});var _0x1e8b78=_0x49ec('0x30');return db['UserProfileSection'][_0x49ec('0x52')]({'where':{'name':_0x1e8b78,'userProfileId':_0x3d3561['userProfileId']},'raw':!![]})[_0x49ec('0x2d')](function(_0x35d40e){if(_0x35d40e&&_0x35d40e[_0x49ec('0x58')]===0x0){return db[_0x49ec('0x59')][_0x49ec('0x53')]({'name':_0xb4e5cd[_0x49ec('0x33')],'resourceId':_0xb4e5cd['id'],'type':_0x35d40e[_0x49ec('0x33')],'sectionId':_0x35d40e['id']},{})[_0x49ec('0x2d')](function(){return _0x251f1e;});}else{return _0x251f1e;}})[_0x49ec('0x4e')](function(_0x224f90){logger[_0x49ec('0x31')](_0x49ec('0x5a'),_0x224f90);throw _0x224f90;});}return _0x251f1e;})['then'](respondWithResult(_0x39a276,0xc9))[_0x49ec('0x4e')](handleError(_0x39a276,null));};exports[_0x49ec('0x5b')]=function(_0x29c89f,_0x4121ec){if(_0x29c89f['body']['id']){delete _0x29c89f[_0x49ec('0x54')]['id'];}return db[_0x49ec('0x36')]['find']({'where':{'id':_0x29c89f[_0x49ec('0x50')]['id']}})['then'](handleEntityNotFound(_0x4121ec,null))[_0x49ec('0x2d')](saveUpdates(_0x29c89f[_0x49ec('0x54')],null))[_0x49ec('0x2d')](respondWithResult(_0x4121ec,null))[_0x49ec('0x4e')](handleError(_0x4121ec,null));};exports['destroy']=function(_0x3f1bfd,_0x563d94){return db['CmList'][_0x49ec('0x52')]({'where':{'id':_0x3f1bfd[_0x49ec('0x50')]['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x563d94,null))['then'](removeEntity(_0x563d94,null))[_0x49ec('0x4e')](handleError(_0x563d94,null));};exports[_0x49ec('0x5c')]=function(_0x572744,_0x1ee79d){return db['CmList'][_0x49ec('0x5c')]()[_0x49ec('0x2d')](respondWithResult(_0x1ee79d,null))[_0x49ec('0x4e')](handleError(_0x1ee79d,null));};exports[_0x49ec('0x5d')]=function(_0x39c7d6,_0x4c804f,_0x43b356){if(_0x39c7d6[_0x49ec('0x54')]['id']){delete _0x39c7d6[_0x49ec('0x54')]['id'];}return db[_0x49ec('0x36')][_0x49ec('0x52')]({'where':{'id':_0x39c7d6[_0x49ec('0x50')]['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x4c804f,null))[_0x49ec('0x2d')](function(_0x468327){if(_0x468327){_0x39c7d6[_0x49ec('0x54')]['ListId']=_0x468327['id'];return db[_0x49ec('0x5e')]['create'](_0x39c7d6[_0x49ec('0x54')]);}})['then'](respondWithResult(_0x4c804f,null))['catch'](handleError(_0x4c804f,null));};exports[_0x49ec('0x5f')]=function(_0x58498a,_0x3c4ca2,_0xd84f1b){var _0x3cecc4={'raw':![],'where':{}};var _0x5bcc34={};var _0x2df57a={'count':0x0,'rows':[]};return db['CmList'][_0x49ec('0x60')]({'where':{'id':_0x58498a['params']['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x3c4ca2,null))[_0x49ec('0x2d')](function(_0x27c138){if(_0x27c138){_0x5bcc34['model']=_[_0x49ec('0x51')](db[_0x49ec('0x5e')]['rawAttributes']);_0x5bcc34[_0x49ec('0x3d')]=_[_0x49ec('0x51')](_0x58498a[_0x49ec('0x3d')]);_0x5bcc34[_0x49ec('0x3b')]=_[_0x49ec('0x3c')](_0x5bcc34[_0x49ec('0x3a')],_0x5bcc34[_0x49ec('0x3d')]);_0x3cecc4[_0x49ec('0x3e')]=_[_0x49ec('0x3c')](_0x5bcc34[_0x49ec('0x3a')],qs[_0x49ec('0x3f')](_0x58498a[_0x49ec('0x3d')][_0x49ec('0x3f')]));_0x3cecc4[_0x49ec('0x3e')]=_0x3cecc4[_0x49ec('0x3e')][_0x49ec('0x61')]?_0x3cecc4[_0x49ec('0x3e')]:_0x5bcc34[_0x49ec('0x3a')];if(!_0x58498a['query']['hasOwnProperty'](_0x49ec('0x41'))){_0x3cecc4['limit']=qs['limit'](_0x58498a[_0x49ec('0x3d')]['limit']);_0x3cecc4[_0x49ec('0x27')]=qs['offset'](_0x58498a['query'][_0x49ec('0x27')]);}_0x3cecc4[_0x49ec('0x42')]=qs[_0x49ec('0x43')](_0x58498a[_0x49ec('0x3d')][_0x49ec('0x43')]);_0x3cecc4[_0x49ec('0x44')]=qs[_0x49ec('0x3b')](_[_0x49ec('0x45')](_0x58498a[_0x49ec('0x3d')],_0x5bcc34[_0x49ec('0x3b')]));_0x3cecc4[_0x49ec('0x44')]['ListId']=_0x27c138['id'];if(_0x58498a[_0x49ec('0x3d')][_0x49ec('0x46')]){_0x3cecc4['where']=_[_0x49ec('0x47')](_0x3cecc4[_0x49ec('0x44')],{'$or':_[_0x49ec('0x35')](_0x3cecc4['attributes'],function(_0x437944){var _0x2ae646={};_0x2ae646[_0x437944]={'$like':'%'+_0x58498a[_0x49ec('0x3d')][_0x49ec('0x46')]+'%'};return _0x2ae646;})});}_0x3cecc4=_[_0x49ec('0x47')]({},_0x3cecc4,_0x58498a['options']);return db['Disposition'][_0x49ec('0x26')]({'where':_0x3cecc4[_0x49ec('0x44')]})[_0x49ec('0x2d')](function(_0x4a5b84){_0x2df57a['count']=_0x4a5b84;if(_0x58498a[_0x49ec('0x3d')][_0x49ec('0x4a')]){_0x3cecc4['include']=[{'all':!![]}];}return db[_0x49ec('0x5e')][_0x49ec('0x4c')](_0x3cecc4);})[_0x49ec('0x2d')](function(_0x17a798){_0x2df57a['rows']=_0x17a798;return _0x2df57a;});}})[_0x49ec('0x2d')](respondWithFilteredResult(_0x3c4ca2,_0x3cecc4))[_0x49ec('0x4e')](handleError(_0x3c4ca2,null));};exports[_0x49ec('0x62')]=function(_0x2fd394,_0x29ab33,_0x40471f){return db[_0x49ec('0x36')]['find']({'where':{'id':_0x2fd394['params']['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x29ab33,null))[_0x49ec('0x2d')](function(_0x26a3e7){if(_0x26a3e7){return _0x26a3e7[_0x49ec('0x62')](_0x2fd394[_0x49ec('0x3d')][_0x49ec('0x63')]);}})[_0x49ec('0x2d')](respondWithStatusCode(_0x29ab33,null))[_0x49ec('0x4e')](handleError(_0x29ab33,null));};exports[_0x49ec('0x64')]=function(_0x3324d4,_0x316832,_0x25306b){return db[_0x49ec('0x36')][_0x49ec('0x52')]({'where':{'id':_0x3324d4[_0x49ec('0x50')]['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x316832,null))[_0x49ec('0x2d')](function(_0x18efc5){if(_0x18efc5){var _0x112d33=[];var _0x18aad9={'success':[],'errors':[]};return db[_0x49ec('0x65')][_0x49ec('0x5c')]()['then'](function(_0x1c3d7c){if(_0x3324d4[_0x49ec('0x54')]['tags']&&_[_0x49ec('0x66')](_0x3324d4['body'][_0x49ec('0x67')])){if(_0x3324d4[_0x49ec('0x54')]['tags'][_0x49ec('0x61')]){_0x3324d4[_0x49ec('0x54')][_0x49ec('0x67')]=_0x3324d4['body'][_0x49ec('0x67')][_0x49ec('0x68')](';')+';';}else{_0x3324d4[_0x49ec('0x54')][_0x49ec('0x67')]=null;}}else{_0x3324d4['body']['tags']=null;}if(_0x3324d4[_0x49ec('0x54')]&&_[_0x49ec('0x66')](_0x3324d4[_0x49ec('0x54')])){for(var _0x4a9853=0x0;_0x4a9853<_0x3324d4[_0x49ec('0x54')][_0x49ec('0x61')];_0x4a9853+=0x1){_0x3324d4['body'][_0x4a9853]['ListId']=_0x3324d4[_0x49ec('0x50')]['id'];_0x112d33[_0x49ec('0x69')](_0x3324d4[_0x49ec('0x54')][_0x4a9853]);}return BPromise[_0x49ec('0x6a')](_0x112d33,function(_0x60e430){return db[_0x49ec('0x65')][_0x49ec('0x53')](_['omit'](_0x60e430,['ids','id'])||{},{'fields':_[_0x49ec('0x51')](_0x1c3d7c),'raw':!![]})[_0x49ec('0x2d')](function(_0x15d819){_0x18aad9[_0x49ec('0x6b')][_0x49ec('0x69')](_0x15d819[_0x49ec('0x6c')]);})[_0x49ec('0x4e')](function(_0x364ad2){_0x18aad9[_0x49ec('0x6d')][_0x49ec('0x69')]({'data':_0x60e430,'error':_0x364ad2[_0x49ec('0x6e')]});});})[_0x49ec('0x2d')](function(_0x373e5b){return _0x18aad9;})[_0x49ec('0x4e')](function(_0x31ab10){return _0x31ab10;});}else{_0x316832[_0x49ec('0x22')](0x190)[_0x49ec('0x6f')]({'message':_0x49ec('0x70')});}});}})[_0x49ec('0x2d')](respondWithResult(_0x316832,null))['catch'](handleError(_0x316832,null));};exports[_0x49ec('0x71')]=function(_0x1f9f24,_0x4497b4,_0x6e77cf){var _0x36d480;return db[_0x49ec('0x36')]['find']({'where':{'id':_0x1f9f24['params']['id']},'include':[{'model':db[_0x49ec('0x72')],'as':_0x49ec('0x73')}]})[_0x49ec('0x2d')](handleEntityNotFound(_0x4497b4,null))[_0x49ec('0x2d')](function(_0x100d11){if(_0x100d11){_0x36d480=_0x100d11;return db[_0x49ec('0x65')][_0x49ec('0x37')];}})[_0x49ec('0x2d')](function(_0x5cd93f){if(_0x5cd93f){var _0x30fc2f={};var _0xcdc48e={};_0xcdc48e[_0x49ec('0x3a')]=_[_0x49ec('0x74')](_[_0x49ec('0x51')](_0x5cd93f),_[_0x49ec('0x35')](_0x36d480[_0x49ec('0x73')],function(_0x545942){return util[_0x49ec('0x75')](_0x49ec('0x76'),_0x545942['id']);}));_0xcdc48e[_0x49ec('0x3d')]=_[_0x49ec('0x51')](_0x1f9f24[_0x49ec('0x3d')]);_0xcdc48e['filters']=_[_0x49ec('0x3c')](_0xcdc48e[_0x49ec('0x3a')],_0xcdc48e[_0x49ec('0x3d')]);_0x30fc2f[_0x49ec('0x3e')]=_[_0x49ec('0x3c')](_0xcdc48e[_0x49ec('0x3a')],qs[_0x49ec('0x3f')](_0x1f9f24[_0x49ec('0x3d')][_0x49ec('0x3f')]));_0x30fc2f[_0x49ec('0x3e')]=_0x30fc2f[_0x49ec('0x3e')][_0x49ec('0x61')]?_0x30fc2f[_0x49ec('0x3e')]:_0xcdc48e['model'];if(!_0x1f9f24[_0x49ec('0x3d')][_0x49ec('0x40')]('nolimit')){_0x30fc2f[_0x49ec('0x25')]=qs[_0x49ec('0x25')](_0x1f9f24[_0x49ec('0x3d')][_0x49ec('0x25')]);_0x30fc2f[_0x49ec('0x27')]=qs[_0x49ec('0x27')](_0x1f9f24['query'][_0x49ec('0x27')]);}_0x30fc2f['order']=qs[_0x49ec('0x43')](_0x1f9f24[_0x49ec('0x3d')]['sort']);_0x30fc2f['where']=qs[_0x49ec('0x3b')](_[_0x49ec('0x45')](_0x1f9f24[_0x49ec('0x3d')],_0xcdc48e[_0x49ec('0x3b')]));_0x30fc2f[_0x49ec('0x77')]=!![];if(_0x1f9f24[_0x49ec('0x3d')][_0x49ec('0x46')]){_0x30fc2f['where']=_['merge'](_0x30fc2f[_0x49ec('0x44')],{'$or':_['map'](_0x30fc2f['attributes'],function(_0x229b1c){var _0x19ad8a={};_0x19ad8a[_0x229b1c]={'$like':'%'+_0x1f9f24['query'][_0x49ec('0x46')]+'%'};return _0x19ad8a;})});}_0x30fc2f=_['merge']({},_0x30fc2f,_0x1f9f24[_0x49ec('0x49')]);return _0x36d480[_0x49ec('0x71')](_0x30fc2f);}})[_0x49ec('0x2d')](respondWithResult(_0x4497b4,null))['catch'](handleError(_0x4497b4,null));};exports['getContactsCsv']=function(_0x4ea0e3,_0x54ec9a,_0x3803e7){var _0x12a41d;return db['CmList']['find']({'where':{'id':_0x4ea0e3[_0x49ec('0x50')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x49ec('0x73')}]})[_0x49ec('0x2d')](handleEntityNotFound(_0x54ec9a,null))[_0x49ec('0x2d')](function(_0x2e71f8){if(_0x2e71f8){_0x12a41d=_0x2e71f8;return db[_0x49ec('0x65')][_0x49ec('0x37')];}})[_0x49ec('0x2d')](function(_0xdd1d4f){if(_0xdd1d4f){var _0x4aa530={};var _0x560770={};_0x560770['model']=_[_0x49ec('0x74')](_[_0x49ec('0x51')](_0xdd1d4f),_['map'](_0x12a41d[_0x49ec('0x73')],function(_0x137095){return util[_0x49ec('0x75')](_0x49ec('0x76'),_0x137095['id']);}));_0x560770[_0x49ec('0x3d')]=_['keys'](_0x4ea0e3[_0x49ec('0x3d')]);_0x560770[_0x49ec('0x3b')]=_[_0x49ec('0x3c')](_0x560770[_0x49ec('0x3a')],_0x560770[_0x49ec('0x3d')]);_0x4aa530[_0x49ec('0x3e')]=_['intersection'](_0x560770[_0x49ec('0x3a')],qs[_0x49ec('0x3f')](_0x4ea0e3[_0x49ec('0x3d')]['fields']));_0x4aa530[_0x49ec('0x3e')]=_0x4aa530[_0x49ec('0x3e')][_0x49ec('0x61')]?_0x4aa530[_0x49ec('0x3e')]:_0x560770[_0x49ec('0x3a')];if(!_0x4ea0e3[_0x49ec('0x3d')][_0x49ec('0x40')](_0x49ec('0x41'))){_0x4aa530['limit']=qs[_0x49ec('0x25')](_0x4ea0e3[_0x49ec('0x3d')][_0x49ec('0x25')]);_0x4aa530[_0x49ec('0x27')]=qs[_0x49ec('0x27')](_0x4ea0e3[_0x49ec('0x3d')][_0x49ec('0x27')]);}_0x4aa530['order']=qs[_0x49ec('0x43')](_0x4ea0e3['query'][_0x49ec('0x43')]);_0x4aa530[_0x49ec('0x44')]=qs['filters'](_[_0x49ec('0x45')](_0x4ea0e3['query'],_0x560770[_0x49ec('0x3b')]));_0x4aa530['raw']=!![];if(_0x4ea0e3[_0x49ec('0x3d')]['filter']){_0x4aa530[_0x49ec('0x44')]=_[_0x49ec('0x47')](_0x4aa530[_0x49ec('0x44')],{'$or':_['map'](_0x4aa530[_0x49ec('0x3e')],function(_0x16f101){var _0x5c2f26={};_0x5c2f26[_0x16f101]={'$like':'%'+_0x4ea0e3[_0x49ec('0x3d')]['filter']+'%'};return _0x5c2f26;})});}_0x4aa530=_[_0x49ec('0x47')]({},_0x4aa530,_0x4ea0e3[_0x49ec('0x49')]);return _0x12a41d['getContacts'](_0x4aa530);}})[_0x49ec('0x2d')](function(_0x181fc7){if(!_[_0x49ec('0x78')](_0x181fc7)){var _0x561c8e=toCsv(_0x181fc7);var _0x398f40=Date[_0x49ec('0x79')]();fs[_0x49ec('0x7a')](util['format'](_0x49ec('0x7b'),_0x12a41d['id'],_0x398f40),_0x561c8e);_0x54ec9a[_0x49ec('0x7c')](_0x49ec('0x7d'),_0x49ec('0x7e')+util[_0x49ec('0x75')](_0x49ec('0x7f'),_0x12a41d['id'],_0x398f40));_0x54ec9a[_0x49ec('0x7c')]('Content-type','text/csv');return _0x54ec9a['download'](util[_0x49ec('0x75')](_0x49ec('0x7b'),_0x12a41d['id'],_0x398f40));}else{return _0x54ec9a[_0x49ec('0x21')](0xcc);}})[_0x49ec('0x4e')](handleError(_0x54ec9a,null));};exports[_0x49ec('0x80')]=function(_0xbd644f,_0x2329e1,_0x5c011c){var _0x845584;delete _0xbd644f[_0x49ec('0x54')]['id'];return db[_0x49ec('0x36')][_0x49ec('0x60')]({'where':{'id':_0xbd644f[_0x49ec('0x50')]['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x2329e1,null))['then'](function(_0x3103b9){if(_0x3103b9){return db[_0x49ec('0x81')][_0x49ec('0x82')](function(_0x306604){return db[_0x49ec('0x72')][_0x49ec('0x53')](_0xbd644f[_0x49ec('0x54')],{'transaction':_0x306604})[_0x49ec('0x2d')](function(_0x375905){_0x845584=_0x375905;return _0x3103b9[_0x49ec('0x83')](_0x375905,{'transaction':_0x306604});})[_0x49ec('0x2d')](function(){var _0x350758={'type':db[_0x49ec('0x84')][_0x49ec('0x85')],'transaction':_0x306604};switch(_0xbd644f[_0x49ec('0x54')][_0x49ec('0x38')]){case _0x49ec('0x86'):_0x350758[_0x49ec('0x38')]=db['Sequelize'][_0x49ec('0x85')];break;case'number':_0x350758[_0x49ec('0x38')]=db['Sequelize'][_0x49ec('0x87')];break;case _0x49ec('0x88'):_0x350758['type']=db[_0x49ec('0x84')][_0x49ec('0x89')];_0x350758[_0x49ec('0x8a')]=![];break;default:}return db[_0x49ec('0x81')][_0x49ec('0x8b')][_0x49ec('0x8c')](_0x49ec('0x8d'),util[_0x49ec('0x75')](_0x49ec('0x8e'),_0x845584['id']),_0x350758);})[_0x49ec('0x2d')](function(){return _0x845584;});});}})['then'](respondWithResult(_0x2329e1,null))['catch'](handleError(_0x2329e1,null));};exports[_0x49ec('0x8f')]=function(_0x4b876e,_0x3da5e,_0x1e49dd){var _0x276195={};var _0x38b823={};var _0x2751f4;var _0x6994f1;return db[_0x49ec('0x36')]['findOne']({'where':{'id':_0x4b876e[_0x49ec('0x50')]['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x3da5e,null))['then'](function(_0x34517c){if(_0x34517c){_0x2751f4=_0x34517c;_0x38b823[_0x49ec('0x3a')]=_[_0x49ec('0x51')](db[_0x49ec('0x72')][_0x49ec('0x37')]);_0x38b823[_0x49ec('0x3d')]=_['keys'](_0x4b876e[_0x49ec('0x3d')]);_0x38b823[_0x49ec('0x3b')]=_[_0x49ec('0x3c')](_0x38b823[_0x49ec('0x3a')],_0x38b823[_0x49ec('0x3d')]);_0x276195[_0x49ec('0x3e')]=_[_0x49ec('0x3c')](_0x38b823[_0x49ec('0x3a')],qs[_0x49ec('0x3f')](_0x4b876e['query'][_0x49ec('0x3f')]));_0x276195[_0x49ec('0x3e')]=_0x276195[_0x49ec('0x3e')][_0x49ec('0x61')]?_0x276195[_0x49ec('0x3e')]:_0x38b823['model'];_0x276195[_0x49ec('0x42')]=qs[_0x49ec('0x43')](_0x4b876e[_0x49ec('0x3d')][_0x49ec('0x43')]);_0x276195[_0x49ec('0x44')]=qs['filters'](_[_0x49ec('0x45')](_0x4b876e[_0x49ec('0x3d')],_0x38b823['filters']));_0x276195[_0x49ec('0x44')]=_['merge'](_0x276195[_0x49ec('0x44')],{'$or':[{'ListId':_0x34517c['id']},{'ListId':null}]});if(_0x4b876e[_0x49ec('0x3d')][_0x49ec('0x46')]){_0x276195[_0x49ec('0x44')]=_[_0x49ec('0x47')](_0x276195[_0x49ec('0x44')],{'$or':_['map'](_0x276195[_0x49ec('0x3e')],function(_0x52cddb){var _0x4f8e95={};_0x4f8e95[_0x52cddb]={'$like':'%'+_0x4b876e['query'][_0x49ec('0x46')]+'%'};return _0x4f8e95;})});}_0x276195=_['merge']({},_0x276195,_0x4b876e['options']);return db[_0x49ec('0x72')][_0x49ec('0x90')](_0x276195);}})['then'](respondWithResult(_0x3da5e,null))[_0x49ec('0x4e')](handleError(_0x3da5e,null));};exports[_0x49ec('0x91')]=function(_0x4a16e2,_0x1757b1,_0x40a7c6){return db[_0x49ec('0x36')]['find']({'where':{'id':_0x4a16e2[_0x49ec('0x50')]['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x1757b1,null))['then'](function(_0x5426d3){if(_0x5426d3){return _0x5426d3[_0x49ec('0x91')](_0x4a16e2[_0x49ec('0x54')]['ids'],_[_0x49ec('0x92')](_0x4a16e2[_0x49ec('0x54')],[_0x49ec('0x63'),'id'])||{})['spread'](function(_0x5514e5){for(var _0x39036f=0x0;_0x39036f<_0x4a16e2[_0x49ec('0x54')]['ids'][_0x49ec('0x61')];_0x39036f+=0x1){socket[_0x49ec('0x93')](_0x49ec('0x94'),{'UserId':Number(_0x4a16e2[_0x49ec('0x54')][_0x49ec('0x63')][_0x39036f]),'CmListId':Number(_0x4a16e2[_0x49ec('0x50')]['id'])});}return _0x5514e5;});}})[_0x49ec('0x2d')](respondWithResult(_0x1757b1,null))['catch'](handleError(_0x1757b1,null));};exports[_0x49ec('0x95')]=function(_0x239a13,_0x506d78,_0x26cb0c){return db['CmList'][_0x49ec('0x52')]({'where':{'id':_0x239a13[_0x49ec('0x50')]['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x506d78,null))[_0x49ec('0x2d')](function(_0x413ef1){if(_0x413ef1){return _0x413ef1[_0x49ec('0x95')](_0x239a13['query'][_0x49ec('0x63')])[_0x49ec('0x2d')](function(){if(_['isArray'](_0x239a13[_0x49ec('0x3d')]['ids'])){for(var _0x14c5bd=0x0;_0x14c5bd<_0x239a13[_0x49ec('0x3d')][_0x49ec('0x63')][_0x49ec('0x61')];_0x14c5bd+=0x1){socket[_0x49ec('0x93')](_0x49ec('0x96'),{'UserId':Number(_0x239a13[_0x49ec('0x3d')][_0x49ec('0x63')][_0x14c5bd]),'CmListId':Number(_0x239a13[_0x49ec('0x50')]['id'])});}}else{socket[_0x49ec('0x93')](_0x49ec('0x96'),{'UserId':Number(_0x239a13[_0x49ec('0x3d')][_0x49ec('0x63')]),'CmListId':Number(_0x239a13[_0x49ec('0x50')]['id'])});}});}})[_0x49ec('0x2d')](respondWithStatusCode(_0x506d78,null))[_0x49ec('0x4e')](handleError(_0x506d78,null));};exports[_0x49ec('0x97')]=function(_0x12c51c,_0x450f0d,_0x1fd6d6){var _0x378f32={};var _0x300f9f={};var _0x22d6e6;var _0x223902;return db[_0x49ec('0x36')][_0x49ec('0x60')]({'where':{'id':_0x12c51c[_0x49ec('0x50')]['id']}})[_0x49ec('0x2d')](handleEntityNotFound(_0x450f0d,null))['then'](function(_0x2536bb){if(_0x2536bb){_0x22d6e6=_0x2536bb;_0x300f9f[_0x49ec('0x3a')]=_[_0x49ec('0x51')](db[_0x49ec('0x98')][_0x49ec('0x37')]);_0x300f9f[_0x49ec('0x3d')]=_[_0x49ec('0x51')](_0x12c51c[_0x49ec('0x3d')]);_0x300f9f['filters']=_[_0x49ec('0x3c')](_0x300f9f[_0x49ec('0x3a')],_0x300f9f[_0x49ec('0x3d')]);_0x378f32['attributes']=_[_0x49ec('0x3c')](_0x300f9f[_0x49ec('0x3a')],qs[_0x49ec('0x3f')](_0x12c51c[_0x49ec('0x3d')][_0x49ec('0x3f')]));_0x378f32[_0x49ec('0x3e')]=_0x378f32[_0x49ec('0x3e')]['length']?_0x378f32['attributes']:_0x300f9f[_0x49ec('0x3a')];_0x378f32[_0x49ec('0x42')]=qs[_0x49ec('0x43')](_0x12c51c[_0x49ec('0x3d')]['sort']);_0x378f32[_0x49ec('0x44')]=qs['filters'](_[_0x49ec('0x45')](_0x12c51c[_0x49ec('0x3d')],_0x300f9f['filters']));if(_0x12c51c[_0x49ec('0x3d')][_0x49ec('0x46')]){_0x378f32[_0x49ec('0x44')]=_[_0x49ec('0x47')](_0x378f32[_0x49ec('0x44')],{'$or':_[_0x49ec('0x35')](_0x378f32[_0x49ec('0x3e')],function(_0x37cac8){var _0x2ba8d1={};_0x2ba8d1[_0x37cac8]={'$like':'%'+_0x12c51c['query'][_0x49ec('0x46')]+'%'};return _0x2ba8d1;})});}_0x378f32=_[_0x49ec('0x47')]({},_0x378f32,_0x12c51c[_0x49ec('0x49')]);return _0x22d6e6[_0x49ec('0x97')](_0x378f32);}})[_0x49ec('0x2d')](function(_0x465cb4){if(_0x465cb4){_0x223902=_0x465cb4[_0x49ec('0x61')];if(!_0x12c51c[_0x49ec('0x3d')][_0x49ec('0x40')](_0x49ec('0x41'))){_0x378f32[_0x49ec('0x25')]=qs[_0x49ec('0x25')](_0x12c51c['query'][_0x49ec('0x25')]);_0x378f32[_0x49ec('0x27')]=qs['offset'](_0x12c51c[_0x49ec('0x3d')][_0x49ec('0x27')]);}return _0x22d6e6[_0x49ec('0x97')](_0x378f32);}})[_0x49ec('0x2d')](function(_0x52626a){if(_0x52626a){return _0x52626a?{'count':_0x223902,'rows':_0x52626a}:null;}})[_0x49ec('0x2d')](respondWithResult(_0x450f0d,null))[_0x49ec('0x4e')](handleError(_0x450f0d,null));}; \ No newline at end of file +var _0x5038=['offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','CmList','includeAll','include','findAll','show','params','length','find','catch','create','user','role','Lists','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','ListId','getDispositions','Disposition','rows','removeDispositions','ids','CmContact','tags','isArray','join','push','omit','dataValues','message','Malformed\x20request\x20syntax','concat','CustomFields','cf_%d','raw','getContacts','getContactsCsv','CmCustomField','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','format','Content-type','text/csv','download','transaction','addCustomFields','TEXT','text','Sequelize','INTEGER','BOOLEAN','sequelize','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findOne','addAgents','spread','userCmList:save','removeAgents','emit','userCmList:remove','getAgents','eml-format','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','json'];(function(_0x1b8b95,_0x3ea343){var _0x3657ae=function(_0x3703e1){while(--_0x3703e1){_0x1b8b95['push'](_0x1b8b95['shift']());}};_0x3657ae(++_0x3ea343);}(_0x5038,0x192));var _0x8503=function(_0x35ee49,_0x5754cd){_0x35ee49=_0x35ee49-0x0;var _0x2c517b=_0x5038[_0x35ee49];return _0x2c517b;};'use strict';var emlformat=require(_0x8503('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8503('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8503('0x2'));var moment=require(_0x8503('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8503('0x4'));var path=require(_0x8503('0x5'));var sox=require(_0x8503('0x6'));var csv=require('to-csv');var ejs=require(_0x8503('0x7'));var fs=require('fs');var fs_extra=require(_0x8503('0x8'));var _=require(_0x8503('0x9'));var squel=require(_0x8503('0xa'));var crypto=require(_0x8503('0xb'));var jsforce=require(_0x8503('0xc'));var deskjs=require(_0x8503('0xd'));var toCsv=require(_0x8503('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8503('0xf'));var authService=require(_0x8503('0x10'));var qs=require(_0x8503('0x11'));var as=require(_0x8503('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8503('0x13'))(_0x8503('0x14'));var utils=require(_0x8503('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x8503('0x16'));var db=require(_0x8503('0x17'))['db'];config['redis']=_[_0x8503('0x18')](config[_0x8503('0x19')],{'host':_0x8503('0x1a'),'port':0x18eb});var socket=require(_0x8503('0x1b'))(new Redis(config[_0x8503('0x19')]));require(_0x8503('0x1c'))[_0x8503('0x1d')](socket);function respondWithStatusCode(_0x559c51,_0x1a14e8){_0x1a14e8=_0x1a14e8||0xcc;return function(_0x3793b1){if(_0x3793b1){return _0x559c51[_0x8503('0x1e')](_0x1a14e8);}return _0x559c51[_0x8503('0x1f')](_0x1a14e8)['end']();};}function respondWithResult(_0x25a554,_0xa0f171){_0xa0f171=_0xa0f171||0xc8;return function(_0x4b4510){if(_0x4b4510){return _0x25a554[_0x8503('0x1f')](_0xa0f171)[_0x8503('0x20')](_0x4b4510);}};}function respondWithFilteredResult(_0x2c059b,_0x39eeb0){return function(_0x7ef8d5){if(_0x7ef8d5){var _0x3c0ba1=typeof _0x39eeb0[_0x8503('0x21')]==='undefined'&&typeof _0x39eeb0[_0x8503('0x22')]===_0x8503('0x23');var _0x1f37df=_0x7ef8d5['count'];var _0x58ab23=_0x3c0ba1?0x0:_0x39eeb0[_0x8503('0x21')];var _0x162d7b=_0x3c0ba1?_0x7ef8d5[_0x8503('0x24')]:_0x39eeb0[_0x8503('0x21')]+_0x39eeb0[_0x8503('0x22')];var _0x2c834b;if(_0x162d7b>=_0x1f37df){_0x162d7b=_0x1f37df;_0x2c834b=0xc8;}else{_0x2c834b=0xce;}_0x2c059b[_0x8503('0x1f')](_0x2c834b);return _0x2c059b[_0x8503('0x25')](_0x8503('0x26'),_0x58ab23+'-'+_0x162d7b+'/'+_0x1f37df)[_0x8503('0x20')](_0x7ef8d5);}return null;};}function patchUpdates(_0x32c3cd){return function(_0x447065){try{jsonpatch[_0x8503('0x27')](_0x447065,_0x32c3cd,!![]);}catch(_0x3a33d6){return BPromise[_0x8503('0x28')](_0x3a33d6);}return _0x447065[_0x8503('0x29')]();};}function saveUpdates(_0x169475,_0x15de5d){return function(_0x39d084){if(_0x39d084){return _0x39d084[_0x8503('0x2a')](_0x169475)['then'](function(_0x2177f4){return _0x2177f4;});}return null;};}function removeEntity(_0x3b14d1,_0x582e2c){return function(_0x4faf1e){if(_0x4faf1e){return _0x4faf1e[_0x8503('0x2b')]()[_0x8503('0x2c')](function(){var _0x13ddc1=_0x4faf1e[_0x8503('0x2d')]({'plain':!![]});var _0xbfab7='Lists';return db[_0x8503('0x2e')]['destroy']({'where':{'type':_0xbfab7,'resourceId':_0x13ddc1['id']}})['then'](function(){return _0x4faf1e;});})[_0x8503('0x2c')](function(){_0x3b14d1[_0x8503('0x1f')](0xcc)[_0x8503('0x2f')]();});}};}function handleEntityNotFound(_0x53475b,_0x570002){return function(_0xa41e7e){if(!_0xa41e7e){_0x53475b[_0x8503('0x1e')](0x194);}return _0xa41e7e;};}function handleError(_0x2e49d3,_0x4e1a94){_0x4e1a94=_0x4e1a94||0x1f4;return function(_0x2f57d3){logger[_0x8503('0x30')](_0x2f57d3[_0x8503('0x31')]);if(_0x2f57d3['name']){delete _0x2f57d3[_0x8503('0x32')];}_0x2e49d3['status'](_0x4e1a94)[_0x8503('0x33')](_0x2f57d3);};}exports[_0x8503('0x34')]=function(_0x18e7f3,_0x3aa005){var _0x2dada7={},_0x292703={},_0xf02ece={'count':0x0,'rows':[]};var _0xdd420f=_[_0x8503('0x35')](db['CmList'][_0x8503('0x36')],function(_0x7ec00b){return{'name':_0x7ec00b['fieldName'],'type':_0x7ec00b[_0x8503('0x37')]['key']};});_0x292703[_0x8503('0x38')]=_[_0x8503('0x35')](_0xdd420f,_0x8503('0x32'));_0x292703[_0x8503('0x39')]=_[_0x8503('0x3a')](_0x18e7f3[_0x8503('0x39')]);_0x292703['filters']=_[_0x8503('0x3b')](_0x292703[_0x8503('0x38')],_0x292703['query']);_0x2dada7[_0x8503('0x3c')]=_['intersection'](_0x292703['model'],qs[_0x8503('0x3d')](_0x18e7f3[_0x8503('0x39')][_0x8503('0x3d')]));_0x2dada7['attributes']=_0x2dada7[_0x8503('0x3c')]['length']?_0x2dada7['attributes']:_0x292703[_0x8503('0x38')];if(!_0x18e7f3[_0x8503('0x39')][_0x8503('0x3e')](_0x8503('0x3f'))){_0x2dada7[_0x8503('0x22')]=qs['limit'](_0x18e7f3[_0x8503('0x39')][_0x8503('0x22')]);_0x2dada7[_0x8503('0x21')]=qs[_0x8503('0x21')](_0x18e7f3[_0x8503('0x39')]['offset']);}_0x2dada7[_0x8503('0x40')]=qs[_0x8503('0x41')](_0x18e7f3[_0x8503('0x39')][_0x8503('0x41')]);_0x2dada7[_0x8503('0x42')]=qs[_0x8503('0x43')](_[_0x8503('0x44')](_0x18e7f3[_0x8503('0x39')],_0x292703['filters']),_0xdd420f);if(_0x18e7f3[_0x8503('0x39')][_0x8503('0x45')]){_0x2dada7[_0x8503('0x42')]=_[_0x8503('0x46')](_0x2dada7['where'],{'$or':_[_0x8503('0x35')](_0xdd420f,function(_0x43a128){if(_0x43a128[_0x8503('0x37')]!==_0x8503('0x47')){var _0x18fb68={};_0x18fb68[_0x43a128[_0x8503('0x32')]]={'$like':'%'+_0x18e7f3['query']['filter']+'%'};return _0x18fb68;}})});}_0x2dada7=_['merge']({},_0x2dada7,_0x18e7f3[_0x8503('0x48')]);var _0x3ca9cf={'where':_0x2dada7['where']};return db[_0x8503('0x49')]['count'](_0x3ca9cf)[_0x8503('0x2c')](function(_0x13fb43){_0xf02ece[_0x8503('0x24')]=_0x13fb43;if(_0x18e7f3[_0x8503('0x39')][_0x8503('0x4a')]){_0x2dada7[_0x8503('0x4b')]=[{'all':!![]}];}return db[_0x8503('0x49')][_0x8503('0x4c')](_0x2dada7);})[_0x8503('0x2c')](function(_0x49958c){_0xf02ece['rows']=_0x49958c;return _0xf02ece;})[_0x8503('0x2c')](respondWithFilteredResult(_0x3aa005,_0x2dada7))['catch'](handleError(_0x3aa005,null));};exports[_0x8503('0x4d')]=function(_0x2d1810,_0x2b4e71){var _0x52c0f0={'raw':![],'where':{'id':_0x2d1810[_0x8503('0x4e')]['id']}},_0x2d0772={};_0x2d0772[_0x8503('0x38')]=_['keys'](db[_0x8503('0x49')]['rawAttributes']);_0x2d0772['query']=_[_0x8503('0x3a')](_0x2d1810['query']);_0x2d0772['filters']=_[_0x8503('0x3b')](_0x2d0772[_0x8503('0x38')],_0x2d0772[_0x8503('0x39')]);_0x52c0f0[_0x8503('0x3c')]=_['intersection'](_0x2d0772[_0x8503('0x38')],qs[_0x8503('0x3d')](_0x2d1810[_0x8503('0x39')][_0x8503('0x3d')]));_0x52c0f0[_0x8503('0x3c')]=_0x52c0f0[_0x8503('0x3c')][_0x8503('0x4f')]?_0x52c0f0['attributes']:_0x2d0772['model'];if(_0x2d1810[_0x8503('0x39')][_0x8503('0x4a')]){_0x52c0f0[_0x8503('0x4b')]=[{'all':!![]}];}_0x52c0f0=_[_0x8503('0x46')]({},_0x52c0f0,_0x2d1810[_0x8503('0x48')]);return db['CmList'][_0x8503('0x50')](_0x52c0f0)[_0x8503('0x2c')](handleEntityNotFound(_0x2b4e71,null))[_0x8503('0x2c')](respondWithResult(_0x2b4e71,null))[_0x8503('0x51')](handleError(_0x2b4e71,null));};exports[_0x8503('0x52')]=function(_0x139eac,_0x445718){return db[_0x8503('0x49')][_0x8503('0x52')](_0x139eac['body'],{})[_0x8503('0x2c')](function(_0x368b85){var _0x188729=_0x139eac[_0x8503('0x53')]['get']({'plain':!![]});if(!_0x188729)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x188729[_0x8503('0x54')]===_0x8503('0x53')){var _0x113888=_0x368b85[_0x8503('0x2d')]({'plain':!![]});var _0x4674e1=_0x8503('0x55');return db[_0x8503('0x56')][_0x8503('0x50')]({'where':{'name':_0x4674e1,'userProfileId':_0x188729[_0x8503('0x57')]},'raw':!![]})[_0x8503('0x2c')](function(_0xaf9c49){if(_0xaf9c49&&_0xaf9c49['autoAssociation']===0x0){return db[_0x8503('0x2e')][_0x8503('0x52')]({'name':_0x113888['name'],'resourceId':_0x113888['id'],'type':_0xaf9c49[_0x8503('0x32')],'sectionId':_0xaf9c49['id']},{})[_0x8503('0x2c')](function(){return _0x368b85;});}else{return _0x368b85;}})[_0x8503('0x51')](function(_0xaa3ce5){logger['error'](_0x8503('0x58'),_0xaa3ce5);throw _0xaa3ce5;});}return _0x368b85;})[_0x8503('0x2c')](respondWithResult(_0x445718,0xc9))[_0x8503('0x51')](handleError(_0x445718,null));};exports[_0x8503('0x2a')]=function(_0x555861,_0x14f267){if(_0x555861[_0x8503('0x59')]['id']){delete _0x555861[_0x8503('0x59')]['id'];}return db[_0x8503('0x49')][_0x8503('0x50')]({'where':{'id':_0x555861['params']['id']}})[_0x8503('0x2c')](handleEntityNotFound(_0x14f267,null))[_0x8503('0x2c')](saveUpdates(_0x555861[_0x8503('0x59')],null))[_0x8503('0x2c')](respondWithResult(_0x14f267,null))[_0x8503('0x51')](handleError(_0x14f267,null));};exports[_0x8503('0x2b')]=function(_0x25bbbc,_0x4f3a33){return db[_0x8503('0x49')]['find']({'where':{'id':_0x25bbbc[_0x8503('0x4e')]['id']}})[_0x8503('0x2c')](handleEntityNotFound(_0x4f3a33,null))[_0x8503('0x2c')](removeEntity(_0x4f3a33,null))[_0x8503('0x51')](handleError(_0x4f3a33,null));};exports[_0x8503('0x5a')]=function(_0x351e53,_0x48b374){return db[_0x8503('0x49')][_0x8503('0x5a')]()['then'](respondWithResult(_0x48b374,null))['catch'](handleError(_0x48b374,null));};exports['addDisposition']=function(_0x11e702,_0x50f724,_0x39732c){if(_0x11e702[_0x8503('0x59')]['id']){delete _0x11e702['body']['id'];}return db['CmList'][_0x8503('0x50')]({'where':{'id':_0x11e702[_0x8503('0x4e')]['id']}})[_0x8503('0x2c')](handleEntityNotFound(_0x50f724,null))[_0x8503('0x2c')](function(_0x13132e){if(_0x13132e){_0x11e702[_0x8503('0x59')][_0x8503('0x5b')]=_0x13132e['id'];return db['Disposition']['create'](_0x11e702['body']);}})['then'](respondWithResult(_0x50f724,null))[_0x8503('0x51')](handleError(_0x50f724,null));};exports[_0x8503('0x5c')]=function(_0x5eb7ac,_0x587796,_0xc8db86){var _0x306c39={'raw':![],'where':{}};var _0x48bbcd={};var _0x1c3b09={'count':0x0,'rows':[]};return db[_0x8503('0x49')]['findOne']({'where':{'id':_0x5eb7ac['params']['id']}})[_0x8503('0x2c')](handleEntityNotFound(_0x587796,null))[_0x8503('0x2c')](function(_0x335191){if(_0x335191){_0x48bbcd[_0x8503('0x38')]=_[_0x8503('0x3a')](db['Disposition']['rawAttributes']);_0x48bbcd[_0x8503('0x39')]=_[_0x8503('0x3a')](_0x5eb7ac[_0x8503('0x39')]);_0x48bbcd[_0x8503('0x43')]=_[_0x8503('0x3b')](_0x48bbcd[_0x8503('0x38')],_0x48bbcd['query']);_0x306c39[_0x8503('0x3c')]=_[_0x8503('0x3b')](_0x48bbcd[_0x8503('0x38')],qs[_0x8503('0x3d')](_0x5eb7ac[_0x8503('0x39')][_0x8503('0x3d')]));_0x306c39[_0x8503('0x3c')]=_0x306c39[_0x8503('0x3c')][_0x8503('0x4f')]?_0x306c39[_0x8503('0x3c')]:_0x48bbcd[_0x8503('0x38')];if(!_0x5eb7ac[_0x8503('0x39')][_0x8503('0x3e')]('nolimit')){_0x306c39[_0x8503('0x22')]=qs['limit'](_0x5eb7ac[_0x8503('0x39')][_0x8503('0x22')]);_0x306c39[_0x8503('0x21')]=qs['offset'](_0x5eb7ac['query'][_0x8503('0x21')]);}_0x306c39[_0x8503('0x40')]=qs['sort'](_0x5eb7ac[_0x8503('0x39')]['sort']);_0x306c39[_0x8503('0x42')]=qs[_0x8503('0x43')](_[_0x8503('0x44')](_0x5eb7ac[_0x8503('0x39')],_0x48bbcd['filters']));_0x306c39[_0x8503('0x42')]['ListId']=_0x335191['id'];if(_0x5eb7ac['query']['filter']){_0x306c39[_0x8503('0x42')]=_[_0x8503('0x46')](_0x306c39[_0x8503('0x42')],{'$or':_['map'](_0x306c39[_0x8503('0x3c')],function(_0x5ce4b0){var _0x2bb70b={};_0x2bb70b[_0x5ce4b0]={'$like':'%'+_0x5eb7ac[_0x8503('0x39')]['filter']+'%'};return _0x2bb70b;})});}_0x306c39=_[_0x8503('0x46')]({},_0x306c39,_0x5eb7ac[_0x8503('0x48')]);return db[_0x8503('0x5d')][_0x8503('0x24')]({'where':_0x306c39[_0x8503('0x42')]})['then'](function(_0xd2da80){_0x1c3b09[_0x8503('0x24')]=_0xd2da80;if(_0x5eb7ac[_0x8503('0x39')][_0x8503('0x4a')]){_0x306c39[_0x8503('0x4b')]=[{'all':!![]}];}return db[_0x8503('0x5d')]['findAll'](_0x306c39);})[_0x8503('0x2c')](function(_0x4ac481){_0x1c3b09[_0x8503('0x5e')]=_0x4ac481;return _0x1c3b09;});}})[_0x8503('0x2c')](respondWithFilteredResult(_0x587796,_0x306c39))[_0x8503('0x51')](handleError(_0x587796,null));};exports[_0x8503('0x5f')]=function(_0x188148,_0x1c1c3b,_0x5868bd){return db[_0x8503('0x49')][_0x8503('0x50')]({'where':{'id':_0x188148[_0x8503('0x4e')]['id']}})[_0x8503('0x2c')](handleEntityNotFound(_0x1c1c3b,null))[_0x8503('0x2c')](function(_0x24adb3){if(_0x24adb3){return _0x24adb3['removeDispositions'](_0x188148['query'][_0x8503('0x60')]);}})[_0x8503('0x2c')](respondWithStatusCode(_0x1c1c3b,null))['catch'](handleError(_0x1c1c3b,null));};exports['addContacts']=function(_0x39cfd1,_0x388b3c,_0x4c6ce6){return db[_0x8503('0x49')][_0x8503('0x50')]({'where':{'id':_0x39cfd1[_0x8503('0x4e')]['id']}})['then'](handleEntityNotFound(_0x388b3c,null))[_0x8503('0x2c')](function(_0x2300de){if(_0x2300de){var _0x549239=[];var _0x5c6770={'success':[],'errors':[]};return db[_0x8503('0x61')][_0x8503('0x5a')]()[_0x8503('0x2c')](function(_0x4cd7e7){if(_0x39cfd1[_0x8503('0x59')][_0x8503('0x62')]&&_[_0x8503('0x63')](_0x39cfd1[_0x8503('0x59')][_0x8503('0x62')])){if(_0x39cfd1[_0x8503('0x59')][_0x8503('0x62')][_0x8503('0x4f')]){_0x39cfd1['body']['tags']=_0x39cfd1['body'][_0x8503('0x62')][_0x8503('0x64')](';')+';';}else{_0x39cfd1[_0x8503('0x59')][_0x8503('0x62')]=null;}}else{_0x39cfd1[_0x8503('0x59')]['tags']=null;}if(_0x39cfd1[_0x8503('0x59')]&&_[_0x8503('0x63')](_0x39cfd1[_0x8503('0x59')])){for(var _0x50f8a4=0x0;_0x50f8a4<_0x39cfd1[_0x8503('0x59')][_0x8503('0x4f')];_0x50f8a4+=0x1){_0x39cfd1[_0x8503('0x59')][_0x50f8a4]['ListId']=_0x39cfd1['params']['id'];_0x549239[_0x8503('0x65')](_0x39cfd1[_0x8503('0x59')][_0x50f8a4]);}return BPromise['each'](_0x549239,function(_0x57b40f){return db[_0x8503('0x61')][_0x8503('0x52')](_[_0x8503('0x66')](_0x57b40f,[_0x8503('0x60'),'id'])||{},{'fields':_['keys'](_0x4cd7e7),'raw':!![]})[_0x8503('0x2c')](function(_0x538d67){_0x5c6770['success'][_0x8503('0x65')](_0x538d67[_0x8503('0x67')]);})[_0x8503('0x51')](function(_0x453399){_0x5c6770['errors'][_0x8503('0x65')]({'data':_0x57b40f,'error':_0x453399[_0x8503('0x68')]});});})['then'](function(_0x14bd51){return _0x5c6770;})[_0x8503('0x51')](function(_0x3bc820){return _0x3bc820;});}else{_0x388b3c[_0x8503('0x1f')](0x190)['json']({'message':_0x8503('0x69')});}});}})['then'](respondWithResult(_0x388b3c,null))[_0x8503('0x51')](handleError(_0x388b3c,null));};exports['getContacts']=function(_0x8872da,_0x44a8af,_0x5db986){var _0x493f2d;return db[_0x8503('0x49')][_0x8503('0x50')]({'where':{'id':_0x8872da[_0x8503('0x4e')]['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})['then'](handleEntityNotFound(_0x44a8af,null))['then'](function(_0x657b61){if(_0x657b61){_0x493f2d=_0x657b61;return db[_0x8503('0x61')]['rawAttributes'];}})[_0x8503('0x2c')](function(_0x4404ff){if(_0x4404ff){var _0x4624dc={};var _0x4444c1={};_0x4444c1['model']=_[_0x8503('0x6a')](_[_0x8503('0x3a')](_0x4404ff),_[_0x8503('0x35')](_0x493f2d[_0x8503('0x6b')],function(_0x3a7109){return util['format'](_0x8503('0x6c'),_0x3a7109['id']);}));_0x4444c1[_0x8503('0x39')]=_[_0x8503('0x3a')](_0x8872da[_0x8503('0x39')]);_0x4444c1['filters']=_[_0x8503('0x3b')](_0x4444c1[_0x8503('0x38')],_0x4444c1['query']);_0x4624dc[_0x8503('0x3c')]=_[_0x8503('0x3b')](_0x4444c1['model'],qs['fields'](_0x8872da[_0x8503('0x39')][_0x8503('0x3d')]));_0x4624dc['attributes']=_0x4624dc[_0x8503('0x3c')][_0x8503('0x4f')]?_0x4624dc[_0x8503('0x3c')]:_0x4444c1[_0x8503('0x38')];if(!_0x8872da[_0x8503('0x39')][_0x8503('0x3e')](_0x8503('0x3f'))){_0x4624dc['limit']=qs['limit'](_0x8872da[_0x8503('0x39')][_0x8503('0x22')]);_0x4624dc[_0x8503('0x21')]=qs['offset'](_0x8872da['query']['offset']);}_0x4624dc[_0x8503('0x40')]=qs['sort'](_0x8872da['query'][_0x8503('0x41')]);_0x4624dc[_0x8503('0x42')]=qs['filters'](_['pick'](_0x8872da[_0x8503('0x39')],_0x4444c1[_0x8503('0x43')]));_0x4624dc[_0x8503('0x6d')]=!![];if(_0x8872da[_0x8503('0x39')]['filter']){_0x4624dc['where']=_[_0x8503('0x46')](_0x4624dc[_0x8503('0x42')],{'$or':_['map'](_0x4624dc['attributes'],function(_0x1a4c17){var _0x480dff={};_0x480dff[_0x1a4c17]={'$like':'%'+_0x8872da['query'][_0x8503('0x45')]+'%'};return _0x480dff;})});}_0x4624dc=_['merge']({},_0x4624dc,_0x8872da['options']);return _0x493f2d[_0x8503('0x6e')](_0x4624dc);}})[_0x8503('0x2c')](respondWithResult(_0x44a8af,null))[_0x8503('0x51')](handleError(_0x44a8af,null));};exports[_0x8503('0x6f')]=function(_0xf8116e,_0x2e7565,_0x3c1c76){var _0x3bc881;return db[_0x8503('0x49')]['find']({'where':{'id':_0xf8116e[_0x8503('0x4e')]['id']},'include':[{'model':db[_0x8503('0x70')],'as':_0x8503('0x6b')}]})['then'](handleEntityNotFound(_0x2e7565,null))[_0x8503('0x2c')](function(_0x550013){if(_0x550013){_0x3bc881=_0x550013;return db[_0x8503('0x61')][_0x8503('0x36')];}})['then'](function(_0x5380a1){if(_0x5380a1){var _0x4e3954={};var _0x1cb3a7={};_0x1cb3a7['model']=_[_0x8503('0x6a')](_['keys'](_0x5380a1),_[_0x8503('0x35')](_0x3bc881['CustomFields'],function(_0x3ab389){return util['format'](_0x8503('0x6c'),_0x3ab389['id']);}));_0x1cb3a7['query']=_[_0x8503('0x3a')](_0xf8116e[_0x8503('0x39')]);_0x1cb3a7[_0x8503('0x43')]=_[_0x8503('0x3b')](_0x1cb3a7[_0x8503('0x38')],_0x1cb3a7[_0x8503('0x39')]);_0x4e3954[_0x8503('0x3c')]=_[_0x8503('0x3b')](_0x1cb3a7[_0x8503('0x38')],qs[_0x8503('0x3d')](_0xf8116e['query'][_0x8503('0x3d')]));_0x4e3954[_0x8503('0x3c')]=_0x4e3954[_0x8503('0x3c')]['length']?_0x4e3954[_0x8503('0x3c')]:_0x1cb3a7['model'];if(!_0xf8116e['query']['hasOwnProperty'](_0x8503('0x3f'))){_0x4e3954[_0x8503('0x22')]=qs[_0x8503('0x22')](_0xf8116e[_0x8503('0x39')][_0x8503('0x22')]);_0x4e3954[_0x8503('0x21')]=qs[_0x8503('0x21')](_0xf8116e[_0x8503('0x39')][_0x8503('0x21')]);}_0x4e3954['order']=qs[_0x8503('0x41')](_0xf8116e['query'][_0x8503('0x41')]);_0x4e3954[_0x8503('0x42')]=qs[_0x8503('0x43')](_[_0x8503('0x44')](_0xf8116e[_0x8503('0x39')],_0x1cb3a7['filters']));_0x4e3954['raw']=!![];if(_0xf8116e[_0x8503('0x39')][_0x8503('0x45')]){_0x4e3954[_0x8503('0x42')]=_['merge'](_0x4e3954[_0x8503('0x42')],{'$or':_[_0x8503('0x35')](_0x4e3954[_0x8503('0x3c')],function(_0x496212){var _0x403461={};_0x403461[_0x496212]={'$like':'%'+_0xf8116e[_0x8503('0x39')][_0x8503('0x45')]+'%'};return _0x403461;})});}_0x4e3954=_[_0x8503('0x46')]({},_0x4e3954,_0xf8116e[_0x8503('0x48')]);return _0x3bc881[_0x8503('0x6e')](_0x4e3954);}})[_0x8503('0x2c')](function(_0x12c972){if(!_[_0x8503('0x71')](_0x12c972)){var _0x4dd5b2=toCsv(_0x12c972);var _0x4cd177=Date[_0x8503('0x72')]();fs[_0x8503('0x73')](util['format'](_0x8503('0x74'),_0x3bc881['id'],_0x4cd177),_0x4dd5b2);_0x2e7565[_0x8503('0x75')](_0x8503('0x76'),_0x8503('0x77')+util[_0x8503('0x78')]('list_%d_%s.csv',_0x3bc881['id'],_0x4cd177));_0x2e7565[_0x8503('0x75')](_0x8503('0x79'),_0x8503('0x7a'));return _0x2e7565[_0x8503('0x7b')](util[_0x8503('0x78')](_0x8503('0x74'),_0x3bc881['id'],_0x4cd177));}else{return _0x2e7565[_0x8503('0x1e')](0xcc);}})[_0x8503('0x51')](handleError(_0x2e7565,null));};exports['addCustomField']=function(_0x2114c2,_0x144e53,_0x126f2a){var _0x114bae;delete _0x2114c2[_0x8503('0x59')]['id'];return db[_0x8503('0x49')]['findOne']({'where':{'id':_0x2114c2['params']['id']}})[_0x8503('0x2c')](handleEntityNotFound(_0x144e53,null))[_0x8503('0x2c')](function(_0x2da3af){if(_0x2da3af){return db['sequelize'][_0x8503('0x7c')](function(_0x349ace){return db[_0x8503('0x70')][_0x8503('0x52')](_0x2114c2[_0x8503('0x59')],{'transaction':_0x349ace})[_0x8503('0x2c')](function(_0x1842e5){_0x114bae=_0x1842e5;return _0x2da3af[_0x8503('0x7d')](_0x1842e5,{'transaction':_0x349ace});})['then'](function(){var _0x4e4507={'type':db['Sequelize'][_0x8503('0x7e')],'transaction':_0x349ace};switch(_0x2114c2[_0x8503('0x59')]['type']){case _0x8503('0x7f'):_0x4e4507[_0x8503('0x37')]=db[_0x8503('0x80')][_0x8503('0x7e')];break;case'number':_0x4e4507['type']=db[_0x8503('0x80')][_0x8503('0x81')];break;case'switch':_0x4e4507[_0x8503('0x37')]=db[_0x8503('0x80')][_0x8503('0x82')];_0x4e4507['defaultValue']=![];break;default:}return db[_0x8503('0x83')][_0x8503('0x84')][_0x8503('0x85')](_0x8503('0x86'),util[_0x8503('0x78')](_0x8503('0x87'),_0x114bae['id']),_0x4e4507);})[_0x8503('0x2c')](function(){return _0x114bae;});});}})[_0x8503('0x2c')](respondWithResult(_0x144e53,null))[_0x8503('0x51')](handleError(_0x144e53,null));};exports[_0x8503('0x88')]=function(_0x52bbb4,_0x28bffe,_0x5d6ff6){var _0x29262c={};var _0x1086c3={};var _0x52c017;var _0x41db60;return db[_0x8503('0x49')][_0x8503('0x89')]({'where':{'id':_0x52bbb4[_0x8503('0x4e')]['id']}})[_0x8503('0x2c')](handleEntityNotFound(_0x28bffe,null))[_0x8503('0x2c')](function(_0x3f40eb){if(_0x3f40eb){_0x52c017=_0x3f40eb;_0x1086c3[_0x8503('0x38')]=_[_0x8503('0x3a')](db[_0x8503('0x70')]['rawAttributes']);_0x1086c3['query']=_['keys'](_0x52bbb4[_0x8503('0x39')]);_0x1086c3['filters']=_[_0x8503('0x3b')](_0x1086c3[_0x8503('0x38')],_0x1086c3[_0x8503('0x39')]);_0x29262c[_0x8503('0x3c')]=_['intersection'](_0x1086c3[_0x8503('0x38')],qs[_0x8503('0x3d')](_0x52bbb4[_0x8503('0x39')]['fields']));_0x29262c[_0x8503('0x3c')]=_0x29262c[_0x8503('0x3c')][_0x8503('0x4f')]?_0x29262c[_0x8503('0x3c')]:_0x1086c3['model'];_0x29262c[_0x8503('0x40')]=qs['sort'](_0x52bbb4[_0x8503('0x39')]['sort']);_0x29262c[_0x8503('0x42')]=qs[_0x8503('0x43')](_[_0x8503('0x44')](_0x52bbb4[_0x8503('0x39')],_0x1086c3[_0x8503('0x43')]));_0x29262c[_0x8503('0x42')]=_[_0x8503('0x46')](_0x29262c[_0x8503('0x42')],{'$or':[{'ListId':_0x3f40eb['id']},{'ListId':null}]});if(_0x52bbb4['query'][_0x8503('0x45')]){_0x29262c[_0x8503('0x42')]=_[_0x8503('0x46')](_0x29262c[_0x8503('0x42')],{'$or':_[_0x8503('0x35')](_0x29262c[_0x8503('0x3c')],function(_0x5ccadd){var _0x445d8f={};_0x445d8f[_0x5ccadd]={'$like':'%'+_0x52bbb4['query'][_0x8503('0x45')]+'%'};return _0x445d8f;})});}_0x29262c=_[_0x8503('0x46')]({},_0x29262c,_0x52bbb4['options']);return db[_0x8503('0x70')]['findAndCountAll'](_0x29262c);}})['then'](respondWithResult(_0x28bffe,null))[_0x8503('0x51')](handleError(_0x28bffe,null));};exports['addAgents']=function(_0x1924fd,_0x5a8af8,_0xee62ea){return db['CmList'][_0x8503('0x50')]({'where':{'id':_0x1924fd[_0x8503('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5a8af8,null))['then'](function(_0x17ace5){if(_0x17ace5){return _0x17ace5[_0x8503('0x8a')](_0x1924fd['body'][_0x8503('0x60')],_[_0x8503('0x66')](_0x1924fd[_0x8503('0x59')],[_0x8503('0x60'),'id'])||{})[_0x8503('0x8b')](function(_0x3ba4c4){for(var _0x575a63=0x0;_0x575a63<_0x1924fd[_0x8503('0x59')]['ids'][_0x8503('0x4f')];_0x575a63+=0x1){socket['emit'](_0x8503('0x8c'),{'UserId':Number(_0x1924fd[_0x8503('0x59')]['ids'][_0x575a63]),'CmListId':Number(_0x1924fd['params']['id'])});}return _0x3ba4c4;});}})[_0x8503('0x2c')](respondWithResult(_0x5a8af8,null))[_0x8503('0x51')](handleError(_0x5a8af8,null));};exports[_0x8503('0x8d')]=function(_0x153631,_0x2cbc40,_0x36bbee){return db['CmList'][_0x8503('0x50')]({'where':{'id':_0x153631[_0x8503('0x4e')]['id']}})[_0x8503('0x2c')](handleEntityNotFound(_0x2cbc40,null))['then'](function(_0x3fa1a5){if(_0x3fa1a5){return _0x3fa1a5[_0x8503('0x8d')](_0x153631[_0x8503('0x39')][_0x8503('0x60')])[_0x8503('0x2c')](function(){if(_[_0x8503('0x63')](_0x153631[_0x8503('0x39')][_0x8503('0x60')])){for(var _0x40386d=0x0;_0x40386d<_0x153631[_0x8503('0x39')][_0x8503('0x60')]['length'];_0x40386d+=0x1){socket[_0x8503('0x8e')](_0x8503('0x8f'),{'UserId':Number(_0x153631[_0x8503('0x39')][_0x8503('0x60')][_0x40386d]),'CmListId':Number(_0x153631[_0x8503('0x4e')]['id'])});}}else{socket['emit'](_0x8503('0x8f'),{'UserId':Number(_0x153631[_0x8503('0x39')]['ids']),'CmListId':Number(_0x153631[_0x8503('0x4e')]['id'])});}});}})[_0x8503('0x2c')](respondWithStatusCode(_0x2cbc40,null))['catch'](handleError(_0x2cbc40,null));};exports['getAgents']=function(_0x25100b,_0x4c4fa2,_0xf8cda4){var _0x26ff1c={};var _0x5403ea={};var _0x28f3be;var _0x533795;return db[_0x8503('0x49')][_0x8503('0x89')]({'where':{'id':_0x25100b[_0x8503('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4c4fa2,null))[_0x8503('0x2c')](function(_0x360e37){if(_0x360e37){_0x28f3be=_0x360e37;_0x5403ea[_0x8503('0x38')]=_[_0x8503('0x3a')](db['User'][_0x8503('0x36')]);_0x5403ea[_0x8503('0x39')]=_[_0x8503('0x3a')](_0x25100b[_0x8503('0x39')]);_0x5403ea[_0x8503('0x43')]=_[_0x8503('0x3b')](_0x5403ea['model'],_0x5403ea[_0x8503('0x39')]);_0x26ff1c['attributes']=_[_0x8503('0x3b')](_0x5403ea['model'],qs['fields'](_0x25100b['query'][_0x8503('0x3d')]));_0x26ff1c[_0x8503('0x3c')]=_0x26ff1c[_0x8503('0x3c')][_0x8503('0x4f')]?_0x26ff1c['attributes']:_0x5403ea['model'];_0x26ff1c[_0x8503('0x40')]=qs[_0x8503('0x41')](_0x25100b[_0x8503('0x39')][_0x8503('0x41')]);_0x26ff1c[_0x8503('0x42')]=qs[_0x8503('0x43')](_[_0x8503('0x44')](_0x25100b[_0x8503('0x39')],_0x5403ea[_0x8503('0x43')]));if(_0x25100b['query'][_0x8503('0x45')]){_0x26ff1c[_0x8503('0x42')]=_['merge'](_0x26ff1c[_0x8503('0x42')],{'$or':_[_0x8503('0x35')](_0x26ff1c['attributes'],function(_0x15a009){var _0x3f0817={};_0x3f0817[_0x15a009]={'$like':'%'+_0x25100b[_0x8503('0x39')]['filter']+'%'};return _0x3f0817;})});}_0x26ff1c=_[_0x8503('0x46')]({},_0x26ff1c,_0x25100b['options']);return _0x28f3be[_0x8503('0x90')](_0x26ff1c);}})[_0x8503('0x2c')](function(_0xe76d57){if(_0xe76d57){_0x533795=_0xe76d57['length'];if(!_0x25100b['query'][_0x8503('0x3e')](_0x8503('0x3f'))){_0x26ff1c[_0x8503('0x22')]=qs[_0x8503('0x22')](_0x25100b[_0x8503('0x39')][_0x8503('0x22')]);_0x26ff1c[_0x8503('0x21')]=qs[_0x8503('0x21')](_0x25100b[_0x8503('0x39')][_0x8503('0x21')]);}return _0x28f3be['getAgents'](_0x26ff1c);}})[_0x8503('0x2c')](function(_0x499b3f){if(_0x499b3f){return _0x499b3f?{'count':_0x533795,'rows':_0x499b3f}:null;}})[_0x8503('0x2c')](respondWithResult(_0x4c4fa2,null))['catch'](handleError(_0x4c4fa2,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 32bf096..1f81c03 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe14b,0x93));var _0xbe14=function(_0x4cdc05,_0xe591b4){_0x4cdc05=_0x4cdc05-0x0;var _0x7bced5=_0xe14b[_0x4cdc05];return _0x7bced5;};'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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x2cc342,_0x3b891c){var _0x5b16ac=function(_0x163946){while(--_0x163946){_0x2cc342['push'](_0x2cc342['shift']());}};_0x5b16ac(++_0x3b891c);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index b710876..c0bc467 100644 --- a/server/api/cmList/cmList.model.js +++ b/server/api/cmList/cmList.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','../../config/logger','moment','bluebird'];(function(_0x1a7698,_0x28d70e){var _0x3e8433=function(_0x151ebd){while(--_0x151ebd){_0x1a7698['push'](_0x1a7698['shift']());}};_0x3e8433(++_0x28d70e);}(_0xe706,0xa3));var _0x6e70=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0xe706[_0x10f68e];return _0x4c8372;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1be1=['define','cm_lists','../../config/logger','api','bluebird','request-promise','path','rimraf','./cmList.attributes','exports'];(function(_0x5a585b,_0x3e0674){var _0x4cd398=function(_0x32fbb5){while(--_0x32fbb5){_0x5a585b['push'](_0x5a585b['shift']());}};_0x4cd398(++_0x3e0674);}(_0x1be1,0x192));var _0x11be=function(_0x48e9dc,_0x5a55cf){_0x48e9dc=_0x48e9dc-0x0;var _0xd29694=_0x1be1[_0x48e9dc];return _0xd29694;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x11be('0x0'))(_0x11be('0x1'));var moment=require('moment');var BPromise=require(_0x11be('0x2'));var rp=require(_0x11be('0x3'));var fs=require('fs');var path=require(_0x11be('0x4'));var rimraf=require(_0x11be('0x5'));var config=require('../../config/environment');var attributes=require(_0x11be('0x6'));module[_0x11be('0x7')]=function(_0x11f793,_0x479719){return _0x11f793[_0x11be('0x8')]('CmList',attributes,{'tableName':_0x11be('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 18f16d5..e6e0804 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 _0xee5e=['code','message','CmList,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','then','info','request\x20sent','debug','stringify','error'];(function(_0xe8725,_0x1d4a7d){var _0x21c1fc=function(_0x5d2a8d){while(--_0x5d2a8d){_0xe8725['push'](_0xe8725['shift']());}};_0x21c1fc(++_0x1d4a7d);}(_0xee5e,0x1a9));var _0xeee5=function(_0x3a0895,_0xf5e0a6){_0x3a0895=_0x3a0895-0x0;var _0x4ec9aa=_0xee5e[_0x3a0895];return _0x4ec9aa;};'use strict';var _=require(_0xeee5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xeee5('0x1'));var rs=require(_0xeee5('0x2'));var fs=require('fs');var Redis=require(_0xeee5('0x3'));var db=require(_0xeee5('0x4'))['db'];var utils=require(_0xeee5('0x5'));var logger=require(_0xeee5('0x6'))(_0xeee5('0x7'));var config=require(_0xeee5('0x8'));var jayson=require(_0xeee5('0x9'));var client=jayson[_0xeee5('0xa')][_0xeee5('0xb')]({'port':0x232a});config[_0xeee5('0xc')]=_[_0xeee5('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xeee5('0xe'))(new Redis(config['redis']));require(_0xeee5('0xf'))[_0xeee5('0x10')](socket);function respondWithRpcPromise(_0x439088,_0x3fad46,_0x429c22){return new BPromise(function(_0x3134eb,_0xb5c3d0){return client['request'](_0x439088,_0x429c22)[_0xeee5('0x11')](function(_0x1cd8ed){logger[_0xeee5('0x12')]('CmList,\x20%s,\x20%s',_0x3fad46,_0xeee5('0x13'));logger[_0xeee5('0x14')]('CmList,\x20%s,\x20%s,\x20%s',_0x3fad46,_0xeee5('0x13'),JSON[_0xeee5('0x15')](_0x1cd8ed));if(_0x1cd8ed[_0xeee5('0x16')]){if(_0x1cd8ed[_0xeee5('0x16')][_0xeee5('0x17')]===0x1f4){logger[_0xeee5('0x16')]('CmList,\x20%s,\x20%s',_0x3fad46,_0x1cd8ed[_0xeee5('0x16')]['message']);return _0xb5c3d0(_0x1cd8ed['error'][_0xeee5('0x18')]);}logger[_0xeee5('0x16')](_0xeee5('0x19'),_0x3fad46,_0x1cd8ed[_0xeee5('0x16')][_0xeee5('0x18')]);return _0x3134eb(_0x1cd8ed[_0xeee5('0x16')][_0xeee5('0x18')]);}else{logger['info'](_0xeee5('0x19'),_0x3fad46,_0xeee5('0x13'));_0x3134eb(_0x1cd8ed[_0xeee5('0x1a')]['message']);}})[_0xeee5('0x1b')](function(_0x182899){logger[_0xeee5('0x16')](_0xeee5('0x19'),_0x3fad46,_0x182899);_0xb5c3d0(_0x182899);});});} \ No newline at end of file +var _0x3baa=['CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then'];(function(_0x5a711b,_0x1c1296){var _0x428658=function(_0x1a9f95){while(--_0x1a9f95){_0x5a711b['push'](_0x5a711b['shift']());}};_0x428658(++_0x1c1296);}(_0x3baa,0x1de));var _0xa3ba=function(_0x13e7c5,_0x48f184){_0x13e7c5=_0x13e7c5-0x0;var _0x8b5742=_0x3baa[_0x13e7c5];return _0x8b5742;};'use strict';var _=require('lodash');var util=require(_0xa3ba('0x0'));var moment=require(_0xa3ba('0x1'));var BPromise=require(_0xa3ba('0x2'));var rs=require(_0xa3ba('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3ba('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa3ba('0x5'))(_0xa3ba('0x6'));var config=require(_0xa3ba('0x7'));var jayson=require(_0xa3ba('0x8'));var client=jayson[_0xa3ba('0x9')][_0xa3ba('0xa')]({'port':0x232a});config[_0xa3ba('0xb')]=_['defaults'](config['redis'],{'host':_0xa3ba('0xc'),'port':0x18eb});var socket=require(_0xa3ba('0xd'))(new Redis(config[_0xa3ba('0xb')]));require('./cmList.socket')[_0xa3ba('0xe')](socket);function respondWithRpcPromise(_0x23bb46,_0x34bc99,_0x3204cd){return new BPromise(function(_0x1459a7,_0x46731f){return client['request'](_0x23bb46,_0x3204cd)[_0xa3ba('0xf')](function(_0x8d34eb){logger['info'](_0xa3ba('0x10'),_0x34bc99,_0xa3ba('0x11'));logger[_0xa3ba('0x12')](_0xa3ba('0x13'),_0x34bc99,_0xa3ba('0x11'),JSON[_0xa3ba('0x14')](_0x8d34eb));if(_0x8d34eb[_0xa3ba('0x15')]){if(_0x8d34eb['error'][_0xa3ba('0x16')]===0x1f4){logger['error'](_0xa3ba('0x10'),_0x34bc99,_0x8d34eb[_0xa3ba('0x15')][_0xa3ba('0x17')]);return _0x46731f(_0x8d34eb[_0xa3ba('0x15')][_0xa3ba('0x17')]);}logger['error'](_0xa3ba('0x10'),_0x34bc99,_0x8d34eb[_0xa3ba('0x15')][_0xa3ba('0x17')]);return _0x1459a7(_0x8d34eb['error'][_0xa3ba('0x17')]);}else{logger[_0xa3ba('0x18')](_0xa3ba('0x10'),_0x34bc99,_0xa3ba('0x11'));_0x1459a7(_0x8d34eb[_0xa3ba('0x19')][_0xa3ba('0x17')]);}})['catch'](function(_0xdae00){logger[_0xa3ba('0x15')](_0xa3ba('0x10'),_0x34bc99,_0xdae00);_0x46731f(_0xdae00);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 0d2eecf..a6f6488 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 _0xcea1=['cmList:','./cmList.events','save','update','removeListener','register'];(function(_0x2a332d,_0x3d5865){var _0x5d24c4=function(_0x255e6c){while(--_0x255e6c){_0x2a332d['push'](_0x2a332d['shift']());}};_0x5d24c4(++_0x3d5865);}(_0xcea1,0x91));var _0x1cea=function(_0x4e07d9,_0x15d276){_0x4e07d9=_0x4e07d9-0x0;var _0x508643=_0xcea1[_0x4e07d9];return _0x508643;};'use strict';var CmListEvents=require(_0x1cea('0x0'));var events=[_0x1cea('0x1'),'remove',_0x1cea('0x2')];function createListener(_0x5f3c91,_0x25dc90){return function(_0x46ed81){_0x25dc90['emit'](_0x5f3c91,_0x46ed81);};}function removeListener(_0x3a9290,_0x441520){return function(){CmListEvents[_0x1cea('0x3')](_0x3a9290,_0x441520);};}exports[_0x1cea('0x4')]=function(_0x5c6218){for(var _0x221a88=0x0,_0x3323a3=events['length'];_0x221a88<_0x3323a3;_0x221a88++){var _0xa9757a=events[_0x221a88];var _0x14f58c=createListener(_0x1cea('0x5')+_0xa9757a,_0x5c6218);CmListEvents['on'](_0xa9757a,_0x14f58c);}}; \ No newline at end of file +var _0xd6aa=['save','remove','update','emit','removeListener','register','length','cmList:','./cmList.events'];(function(_0x2c6ba9,_0x595fa4){var _0x51a381=function(_0x4dcac8){while(--_0x4dcac8){_0x2c6ba9['push'](_0x2c6ba9['shift']());}};_0x51a381(++_0x595fa4);}(_0xd6aa,0x11f));var _0xad6a=function(_0x511b97,_0x4366cb){_0x511b97=_0x511b97-0x0;var _0x13ada3=_0xd6aa[_0x511b97];return _0x13ada3;};'use strict';var CmListEvents=require(_0xad6a('0x0'));var events=[_0xad6a('0x1'),_0xad6a('0x2'),_0xad6a('0x3')];function createListener(_0x2c22c4,_0x3dbd45){return function(_0x5786fd){_0x3dbd45[_0xad6a('0x4')](_0x2c22c4,_0x5786fd);};}function removeListener(_0x3e08b4,_0x11a544){return function(){CmListEvents[_0xad6a('0x5')](_0x3e08b4,_0x11a544);};}exports[_0xad6a('0x6')]=function(_0xfc49b){for(var _0x30a4bd=0x0,_0x30e24b=events[_0xad6a('0x7')];_0x30a4bd<_0x30e24b;_0x30a4bd++){var _0x342482=events[_0x30a4bd];var _0x41fb34=createListener(_0xad6a('0x8')+_0x342482,_0xfc49b);CmListEvents['on'](_0x342482,_0x41fb34);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 2720003..8d76d1c 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 _0x7e53=['/:id/contacts','addContacts','addCustomField','addAgents','put','update','delete','removeDispositions','exports','multer','fs-extra','../../components/auth/service','isAuthenticated','get','/:id','show','/:id/dispositions','getDispositions','/:id/contacts/csv','getContactsCsv','/:id/fields','/:id/users','getAgents','post','create','addDisposition'];(function(_0x2946db,_0x113ba6){var _0x39a299=function(_0x2e7e85){while(--_0x2e7e85){_0x2946db['push'](_0x2946db['shift']());}};_0x39a299(++_0x113ba6);}(_0x7e53,0xf3));var _0x37e5=function(_0x1efa4d,_0x5d52a1){_0x1efa4d=_0x1efa4d-0x0;var _0x4aa043=_0x7e53[_0x1efa4d];return _0x4aa043;};'use strict';var multer=require(_0x37e5('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x37e5('0x1'));var auth=require(_0x37e5('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmList.controller');router['get']('/',auth[_0x37e5('0x3')](),controller['index']);router['get']('/describe',auth[_0x37e5('0x3')](),controller['describe']);router[_0x37e5('0x4')](_0x37e5('0x5'),auth[_0x37e5('0x3')](),controller[_0x37e5('0x6')]);router[_0x37e5('0x4')](_0x37e5('0x7'),auth[_0x37e5('0x3')](),controller[_0x37e5('0x8')]);router[_0x37e5('0x4')]('/:id/contacts',auth[_0x37e5('0x3')](),controller['getContacts']);router['get'](_0x37e5('0x9'),auth[_0x37e5('0x3')](),controller[_0x37e5('0xa')]);router['get'](_0x37e5('0xb'),auth['isAuthenticated'](),controller['getCustomFields']);router['get'](_0x37e5('0xc'),auth['isAuthenticated'](),controller[_0x37e5('0xd')]);router[_0x37e5('0xe')]('/',auth['isAuthenticated'](),controller[_0x37e5('0xf')]);router[_0x37e5('0xe')](_0x37e5('0x7'),auth[_0x37e5('0x3')](),controller[_0x37e5('0x10')]);router[_0x37e5('0xe')](_0x37e5('0x11'),auth[_0x37e5('0x3')](),controller[_0x37e5('0x12')]);router['post']('/:id/fields',auth['isAuthenticated'](),controller[_0x37e5('0x13')]);router[_0x37e5('0xe')](_0x37e5('0xc'),auth[_0x37e5('0x3')](),controller[_0x37e5('0x14')]);router[_0x37e5('0x15')]('/:id',auth[_0x37e5('0x3')](),controller[_0x37e5('0x16')]);router[_0x37e5('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x37e5('0x17')](_0x37e5('0x7'),auth[_0x37e5('0x3')](),controller[_0x37e5('0x18')]);router[_0x37e5('0x17')]('/:id/users',auth[_0x37e5('0x3')](),controller['removeAgents']);module[_0x37e5('0x19')]=router; \ No newline at end of file +var _0xb2be=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','describe','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','addContacts','addCustomField','addAgents','put','delete','destroy','removeDispositions','exports','multer','util'];(function(_0x5404a,_0x55af79){var _0x26acab=function(_0x334c97){while(--_0x334c97){_0x5404a['push'](_0x5404a['shift']());}};_0x26acab(++_0x55af79);}(_0xb2be,0x1da));var _0xeb2b=function(_0x11fb16,_0x29a381){_0x11fb16=_0x11fb16-0x0;var _0x343de1=_0xb2be[_0x11fb16];return _0x343de1;};'use strict';var multer=require(_0xeb2b('0x0'));var util=require(_0xeb2b('0x1'));var path=require(_0xeb2b('0x2'));var timeout=require('connect-timeout');var express=require(_0xeb2b('0x3'));var router=express[_0xeb2b('0x4')]();var fs_extra=require(_0xeb2b('0x5'));var auth=require(_0xeb2b('0x6'));var interaction=require(_0xeb2b('0x7'));var config=require(_0xeb2b('0x8'));var controller=require(_0xeb2b('0x9'));router[_0xeb2b('0xa')]('/',auth[_0xeb2b('0xb')](),controller['index']);router[_0xeb2b('0xa')](_0xeb2b('0xc'),auth[_0xeb2b('0xb')](),controller[_0xeb2b('0xd')]);router['get'](_0xeb2b('0xe'),auth[_0xeb2b('0xb')](),controller[_0xeb2b('0xf')]);router[_0xeb2b('0xa')]('/:id/dispositions',auth[_0xeb2b('0xb')](),controller[_0xeb2b('0x10')]);router[_0xeb2b('0xa')](_0xeb2b('0x11'),auth[_0xeb2b('0xb')](),controller[_0xeb2b('0x12')]);router['get']('/:id/contacts/csv',auth['isAuthenticated'](),controller['getContactsCsv']);router['get'](_0xeb2b('0x13'),auth[_0xeb2b('0xb')](),controller[_0xeb2b('0x14')]);router['get'](_0xeb2b('0x15'),auth[_0xeb2b('0xb')](),controller[_0xeb2b('0x16')]);router[_0xeb2b('0x17')]('/',auth[_0xeb2b('0xb')](),controller[_0xeb2b('0x18')]);router['post'](_0xeb2b('0x19'),auth[_0xeb2b('0xb')](),controller['addDisposition']);router[_0xeb2b('0x17')](_0xeb2b('0x11'),auth['isAuthenticated'](),controller[_0xeb2b('0x1a')]);router['post']('/:id/fields',auth['isAuthenticated'](),controller[_0xeb2b('0x1b')]);router[_0xeb2b('0x17')](_0xeb2b('0x15'),auth[_0xeb2b('0xb')](),controller[_0xeb2b('0x1c')]);router[_0xeb2b('0x1d')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xeb2b('0x1e')](_0xeb2b('0xe'),auth[_0xeb2b('0xb')](),controller[_0xeb2b('0x1f')]);router[_0xeb2b('0x1e')](_0xeb2b('0x19'),auth[_0xeb2b('0xb')](),controller[_0xeb2b('0x20')]);router[_0xeb2b('0x1e')](_0xeb2b('0x15'),auth[_0xeb2b('0xb')](),controller['removeAgents']);module[_0xeb2b('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 90a594d..0979c8f 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 _0x24be=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x50f378,_0x4ea47e){var _0x2db0ee=function(_0x557099){while(--_0x557099){_0x50f378['push'](_0x50f378['shift']());}};_0x2db0ee(++_0x4ea47e);}(_0x24be,0x1b5));var _0xe24b=function(_0x5a6323,_0x5ecd9f){_0x5a6323=_0x5a6323-0x0;var _0x252ed5=_0x24be[_0x5a6323];return _0x252ed5;};'use strict';var Sequelize=require(_0xe24b('0x0'));module[_0xe24b('0x1')]={'name':{'type':Sequelize[_0xe24b('0x2')],'get':function(_0x4583a7){return this[_0xe24b('0x3')](_0xe24b('0x4'));}},'field':{'type':Sequelize[_0xe24b('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xe24b('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xe24b('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x5d87=['STRING','exports','VIRTUAL'];(function(_0x339709,_0x363e80){var _0x548eed=function(_0x28c280){while(--_0x28c280){_0x339709['push'](_0x339709['shift']());}};_0x548eed(++_0x363e80);}(_0x5d87,0xfa));var _0x75d8=function(_0x5c197c,_0x5d1878){_0x5c197c=_0x5c197c-0x0;var _0x4a469c=_0x5d87[_0x5c197c];return _0x4a469c;};'use strict';var Sequelize=require('sequelize');module[_0x75d8('0x0')]={'name':{'type':Sequelize[_0x75d8('0x1')],'get':function(_0x3e3e4f){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0x75d8('0x2')],'allowNull':![]},'operator':{'type':Sequelize[_0x75d8('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x75d8('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 47bcd8e..f429785 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x1544a6,_0x37a542){var _0xe4bd5b=function(_0xc52f4f){while(--_0xc52f4f){_0x1544a6['push'](_0x1544a6['shift']());}};_0xe4bd5b(++_0x37a542);}(_0x7a54,0x106));var _0x47a5=function(_0x39baed,_0x2a1ea4){_0x39baed=_0x39baed-0x0;var _0x67bf75=_0x7a54[_0x39baed];return _0x67bf75;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _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(_0xe1ae82,_0x1857b1){var _0x39c527=function(_0x51a066){while(--_0x51a066){_0xe1ae82['push'](_0xe1ae82['shift']());}};_0x39c527(++_0x1857b1);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 735bdae..83c9bfd 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 _0xc806=['path','../../config/environment','./condition.attributes','exports','define','lodash','../../config/logger','api','moment','request-promise'];(function(_0x37ee9a,_0x49f980){var _0x2177e1=function(_0x1fb96b){while(--_0x1fb96b){_0x37ee9a['push'](_0x37ee9a['shift']());}};_0x2177e1(++_0x49f980);}(_0xc806,0x109));var _0x6c80=function(_0x139ecb,_0x26c9fc){_0x139ecb=_0x139ecb-0x0;var _0x2b67fb=_0xc806[_0x139ecb];return _0x2b67fb;};'use strict';var _=require(_0x6c80('0x0'));var util=require('util');var logger=require(_0x6c80('0x1'))(_0x6c80('0x2'));var moment=require(_0x6c80('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c80('0x4'));var fs=require('fs');var path=require(_0x6c80('0x5'));var rimraf=require('rimraf');var config=require(_0x6c80('0x6'));var attributes=require(_0x6c80('0x7'));module[_0x6c80('0x8')]=function(_0x270a8b,_0x5bb903){return _0x270a8b[_0x6c80('0x9')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x535e=['bluebird','request-promise','path','../../config/environment','./condition.attributes','exports','define','tools_conditions','lodash','util','../../config/logger','api','moment'];(function(_0x1c3824,_0x5794a1){var _0x3245bb=function(_0x15f8da){while(--_0x15f8da){_0x1c3824['push'](_0x1c3824['shift']());}};_0x3245bb(++_0x5794a1);}(_0x535e,0x15a));var _0xe535=function(_0x3171f1,_0x28c520){_0x3171f1=_0x3171f1-0x0;var _0x244bc2=_0x535e[_0x3171f1];return _0x244bc2;};'use strict';var _=require(_0xe535('0x0'));var util=require(_0xe535('0x1'));var logger=require(_0xe535('0x2'))(_0xe535('0x3'));var moment=require(_0xe535('0x4'));var BPromise=require(_0xe535('0x5'));var rp=require(_0xe535('0x6'));var fs=require('fs');var path=require(_0xe535('0x7'));var rimraf=require('rimraf');var config=require(_0xe535('0x8'));var attributes=require(_0xe535('0x9'));module[_0xe535('0xa')]=function(_0x22e37a,_0x1e3730){return _0x22e37a[_0xe535('0xb')]('Condition',attributes,{'tableName':_0xe535('0xc'),'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 91101b7..8810391 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 _0x09d2=['../../config/environment','http','request','then','info','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','error','code','message','Condition,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x59ca69,_0x8f11e4){var _0x4d2f9a=function(_0x44c560){while(--_0x44c560){_0x59ca69['push'](_0x59ca69['shift']());}};_0x4d2f9a(++_0x8f11e4);}(_0x09d2,0xf4));var _0x209d=function(_0x323065,_0x5d412a){_0x323065=_0x323065-0x0;var _0xec74b2=_0x09d2[_0x323065];return _0xec74b2;};'use strict';var _=require(_0x209d('0x0'));var util=require('util');var moment=require(_0x209d('0x1'));var BPromise=require(_0x209d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x209d('0x3'));var db=require(_0x209d('0x4'))['db'];var utils=require(_0x209d('0x5'));var logger=require(_0x209d('0x6'))(_0x209d('0x7'));var config=require(_0x209d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x209d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa5de1c,_0x40f8d3,_0xf265ad){return new BPromise(function(_0x3bc915,_0x29d37c){return client[_0x209d('0xa')](_0xa5de1c,_0xf265ad)[_0x209d('0xb')](function(_0x4df03b){logger[_0x209d('0xc')]('Condition,\x20%s,\x20%s',_0x40f8d3,_0x209d('0xd'));logger['debug'](_0x209d('0xe'),_0x40f8d3,_0x209d('0xd'),JSON['stringify'](_0x4df03b));if(_0x4df03b['error']){if(_0x4df03b[_0x209d('0xf')][_0x209d('0x10')]===0x1f4){logger[_0x209d('0xf')]('Condition,\x20%s,\x20%s',_0x40f8d3,_0x4df03b[_0x209d('0xf')][_0x209d('0x11')]);return _0x29d37c(_0x4df03b['error']['message']);}logger[_0x209d('0xf')]('Condition,\x20%s,\x20%s',_0x40f8d3,_0x4df03b[_0x209d('0xf')][_0x209d('0x11')]);return _0x3bc915(_0x4df03b[_0x209d('0xf')]['message']);}else{logger[_0x209d('0xc')](_0x209d('0x12'),_0x40f8d3,_0x209d('0xd'));_0x3bc915(_0x4df03b[_0x209d('0x13')]['message']);}})[_0x209d('0x14')](function(_0x1764c0){logger[_0x209d('0xf')](_0x209d('0x12'),_0x40f8d3,_0x1764c0);_0x29d37c(_0x1764c0);});});} \ No newline at end of file +var _0x169a=['../../config/environment','jayson/promise','then','info','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5432f0,_0xc569fc){var _0x1cfb50=function(_0x18935f){while(--_0x18935f){_0x5432f0['push'](_0x5432f0['shift']());}};_0x1cfb50(++_0xc569fc);}(_0x169a,0x92));var _0xa169=function(_0x3d5dc1,_0x2a5abe){_0x3d5dc1=_0x3d5dc1-0x0;var _0x5d70ae=_0x169a[_0x3d5dc1];return _0x5d70ae;};'use strict';var _=require(_0xa169('0x0'));var util=require(_0xa169('0x1'));var moment=require(_0xa169('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa169('0x3'));var db=require(_0xa169('0x4'))['db'];var utils=require(_0xa169('0x5'));var logger=require(_0xa169('0x6'))(_0xa169('0x7'));var config=require(_0xa169('0x8'));var jayson=require(_0xa169('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x26fe79,_0x41b53d,_0x442d7f){return new BPromise(function(_0x4d89b4,_0x4b12c1){return client['request'](_0x26fe79,_0x442d7f)[_0xa169('0xa')](function(_0x1aa599){logger[_0xa169('0xb')]('Condition,\x20%s,\x20%s',_0x41b53d,'request\x20sent');logger[_0xa169('0xc')](_0xa169('0xd'),_0x41b53d,'request\x20sent',JSON[_0xa169('0xe')](_0x1aa599));if(_0x1aa599[_0xa169('0xf')]){if(_0x1aa599[_0xa169('0xf')][_0xa169('0x10')]===0x1f4){logger[_0xa169('0xf')](_0xa169('0x11'),_0x41b53d,_0x1aa599[_0xa169('0xf')][_0xa169('0x12')]);return _0x4b12c1(_0x1aa599['error'][_0xa169('0x12')]);}logger[_0xa169('0xf')](_0xa169('0x11'),_0x41b53d,_0x1aa599[_0xa169('0xf')]['message']);return _0x4d89b4(_0x1aa599[_0xa169('0xf')][_0xa169('0x12')]);}else{logger[_0xa169('0xb')](_0xa169('0x11'),_0x41b53d,_0xa169('0x13'));_0x4d89b4(_0x1aa599[_0xa169('0x14')]['message']);}})[_0xa169('0x15')](function(_0x319ed5){logger[_0xa169('0xf')]('Condition,\x20%s,\x20%s',_0x41b53d,_0x319ed5);_0x4b12c1(_0x319ed5);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index fcfdfab..87220d2 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 _0xc4d4=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete','isAuthenticated'];(function(_0x17c9d6,_0xb95b04){var _0x68b7a2=function(_0x59468b){while(--_0x59468b){_0x17c9d6['push'](_0x17c9d6['shift']());}};_0x68b7a2(++_0xb95b04);}(_0xc4d4,0x193));var _0x4c4d=function(_0x554b32,_0x577efd){_0x554b32=_0x554b32-0x0;var _0x2d896d=_0xc4d4[_0x554b32];return _0x2d896d;};'use strict';var multer=require('multer');var util=require(_0x4c4d('0x0'));var path=require(_0x4c4d('0x1'));var timeout=require('connect-timeout');var express=require(_0x4c4d('0x2'));var router=express[_0x4c4d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4c4d('0x4'));var interaction=require(_0x4c4d('0x5'));var config=require(_0x4c4d('0x6'));var controller=require(_0x4c4d('0x7'));router[_0x4c4d('0x8')](_0x4c4d('0x9'),auth['isAuthenticated'](),controller[_0x4c4d('0xa')]);router[_0x4c4d('0xb')]('/:id',auth[_0x4c4d('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb44c=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','put','update','delete','/:id','isAuthenticated'];(function(_0x2d73ec,_0x1daaeb){var _0x2a4437=function(_0x1b852a){while(--_0x1b852a){_0x2d73ec['push'](_0x2d73ec['shift']());}};_0x2a4437(++_0x1daaeb);}(_0xb44c,0x1b5));var _0xcb44=function(_0x1c6efd,_0xb2f3cd){_0x1c6efd=_0x1c6efd-0x0;var _0x53a918=_0xb44c[_0x1c6efd];return _0x53a918;};'use strict';var multer=require('multer');var util=require(_0xcb44('0x0'));var path=require(_0xcb44('0x1'));var timeout=require(_0xcb44('0x2'));var express=require(_0xcb44('0x3'));var router=express[_0xcb44('0x4')]();var fs_extra=require(_0xcb44('0x5'));var auth=require(_0xcb44('0x6'));var interaction=require(_0xcb44('0x7'));var config=require('../../config/environment');var controller=require('./condition.controller');router[_0xcb44('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xcb44('0x9')]);router[_0xcb44('0xa')](_0xcb44('0xb'),auth[_0xcb44('0xc')](),controller[_0xcb44('0xd')]);module[_0xcb44('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 7452045..1b105e3 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 _0x757a=['exports','STRING'];(function(_0x2fac80,_0x285808){var _0xb6ad33=function(_0x129359){while(--_0x129359){_0x2fac80['push'](_0x2fac80['shift']());}};_0xb6ad33(++_0x285808);}(_0x757a,0xde));var _0xa757=function(_0x20c260,_0x4b21a2){_0x20c260=_0x20c260-0x0;var _0x2f22de=_0x757a[_0x20c260];return _0x2f22de;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xe706,0xa3));var _0x6e70=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xe706[_0x3ff085];return _0x2b68c3;};'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/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 90a8da5..b64a2d0 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 _0xec3f=['body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','stringify','DashboardId','DashboardItem','getItems','findOne','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','json','offset','limit','undefined','count','status','apply','reject','update','destroy','then','get','CustomDashboards','UserProfileResource','end','sendStatus','error','name','send','index','map','Dashboard','fieldName','type','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','rows','show','params','keys','rawAttributes','includeAll','include','merge','options','find','catch','create'];(function(_0x58547b,_0x4b89c2){var _0x1d3fd2=function(_0x4ac500){while(--_0x4ac500){_0x58547b['push'](_0x58547b['shift']());}};_0x1d3fd2(++_0x4b89c2);}(_0xec3f,0xa0));var _0xfec3=function(_0x1425b9,_0xfa7115){_0x1425b9=_0x1425b9-0x0;var _0x37d4ef=_0xec3f[_0x1425b9];return _0x37d4ef;};'use strict';var emlformat=require(_0xfec3('0x0'));var rimraf=require(_0xfec3('0x1'));var zipdir=require(_0xfec3('0x2'));var jsonpatch=require(_0xfec3('0x3'));var rp=require('request-promise');var moment=require(_0xfec3('0x4'));var BPromise=require(_0xfec3('0x5'));var Mustache=require(_0xfec3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xfec3('0x7'));var csv=require('to-csv');var ejs=require(_0xfec3('0x8'));var fs=require('fs');var fs_extra=require(_0xfec3('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfec3('0xa'));var jsforce=require(_0xfec3('0xb'));var deskjs=require(_0xfec3('0xc'));var toCsv=require(_0xfec3('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfec3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfec3('0xf'));var as=require(_0xfec3('0x10'));var hardwareService=require(_0xfec3('0x11'));var logger=require(_0xfec3('0x12'))('api');var utils=require(_0xfec3('0x13'));var config=require(_0xfec3('0x14'));var licenseUtil=require(_0xfec3('0x15'));var db=require(_0xfec3('0x16'))['db'];config[_0xfec3('0x17')]=_[_0xfec3('0x18')](config['redis'],{'host':_0xfec3('0x19'),'port':0x18eb});var socket=require(_0xfec3('0x1a'))(new Redis(config[_0xfec3('0x17')]));require(_0xfec3('0x1b'))['register'](socket);function respondWithStatusCode(_0x1916ec,_0x27626e){_0x27626e=_0x27626e||0xcc;return function(_0x271f5d){if(_0x271f5d){return _0x1916ec['sendStatus'](_0x27626e);}return _0x1916ec['status'](_0x27626e)['end']();};}function respondWithResult(_0x53ea49,_0xc74b78){_0xc74b78=_0xc74b78||0xc8;return function(_0x4d861e){if(_0x4d861e){return _0x53ea49['status'](_0xc74b78)[_0xfec3('0x1c')](_0x4d861e);}};}function respondWithFilteredResult(_0x1186fe,_0x43d2ee){return function(_0x47087c){if(_0x47087c){var _0x586b26=typeof _0x43d2ee[_0xfec3('0x1d')]==='undefined'&&typeof _0x43d2ee[_0xfec3('0x1e')]===_0xfec3('0x1f');var _0x19701b=_0x47087c[_0xfec3('0x20')];var _0x4b17da=_0x586b26?0x0:_0x43d2ee['offset'];var _0x594901=_0x586b26?_0x47087c[_0xfec3('0x20')]:_0x43d2ee[_0xfec3('0x1d')]+_0x43d2ee[_0xfec3('0x1e')];var _0x4d31eb;if(_0x594901>=_0x19701b){_0x594901=_0x19701b;_0x4d31eb=0xc8;}else{_0x4d31eb=0xce;}_0x1186fe[_0xfec3('0x21')](_0x4d31eb);return _0x1186fe['set']('Content-Range',_0x4b17da+'-'+_0x594901+'/'+_0x19701b)['json'](_0x47087c);}return null;};}function patchUpdates(_0x47b82a){return function(_0x185b73){try{jsonpatch[_0xfec3('0x22')](_0x185b73,_0x47b82a,!![]);}catch(_0x536aaf){return BPromise[_0xfec3('0x23')](_0x536aaf);}return _0x185b73['save']();};}function saveUpdates(_0x146957,_0x453bf5){return function(_0x3416cd){if(_0x3416cd){return _0x3416cd[_0xfec3('0x24')](_0x146957)['then'](function(_0x5a59db){return _0x5a59db;});}return null;};}function removeEntity(_0x560081,_0x24b3ed){return function(_0x6e8f6d){if(_0x6e8f6d){return _0x6e8f6d[_0xfec3('0x25')]()[_0xfec3('0x26')](function(){var _0x428a93=_0x6e8f6d[_0xfec3('0x27')]({'plain':!![]});var _0x3c9104=_0xfec3('0x28');return db[_0xfec3('0x29')][_0xfec3('0x25')]({'where':{'type':_0x3c9104,'resourceId':_0x428a93['id']}})['then'](function(){return _0x6e8f6d;});})['then'](function(){_0x560081['status'](0xcc)[_0xfec3('0x2a')]();});}};}function handleEntityNotFound(_0x2d80ab,_0x19d45b){return function(_0x2526ae){if(!_0x2526ae){_0x2d80ab[_0xfec3('0x2b')](0x194);}return _0x2526ae;};}function handleError(_0x1402fc,_0x1ca58d){_0x1ca58d=_0x1ca58d||0x1f4;return function(_0x28855d){logger[_0xfec3('0x2c')](_0x28855d['stack']);if(_0x28855d[_0xfec3('0x2d')]){delete _0x28855d[_0xfec3('0x2d')];}_0x1402fc[_0xfec3('0x21')](_0x1ca58d)[_0xfec3('0x2e')](_0x28855d);};}exports[_0xfec3('0x2f')]=function(_0x487a82,_0x55e866){var _0x69155={},_0x1bf29d={},_0x58b7b0={'count':0x0,'rows':[]};var _0x4a4542=_[_0xfec3('0x30')](db[_0xfec3('0x31')]['rawAttributes'],function(_0x48d026){return{'name':_0x48d026[_0xfec3('0x32')],'type':_0x48d026[_0xfec3('0x33')]['key']};});_0x1bf29d[_0xfec3('0x34')]=_[_0xfec3('0x30')](_0x4a4542,_0xfec3('0x2d'));_0x1bf29d[_0xfec3('0x35')]=_['keys'](_0x487a82['query']);_0x1bf29d['filters']=_[_0xfec3('0x36')](_0x1bf29d[_0xfec3('0x34')],_0x1bf29d['query']);_0x69155['attributes']=_['intersection'](_0x1bf29d['model'],qs[_0xfec3('0x37')](_0x487a82[_0xfec3('0x35')][_0xfec3('0x37')]));_0x69155[_0xfec3('0x38')]=_0x69155[_0xfec3('0x38')][_0xfec3('0x39')]?_0x69155[_0xfec3('0x38')]:_0x1bf29d[_0xfec3('0x34')];if(!_0x487a82[_0xfec3('0x35')]['hasOwnProperty'](_0xfec3('0x3a'))){_0x69155[_0xfec3('0x1e')]=qs[_0xfec3('0x1e')](_0x487a82[_0xfec3('0x35')][_0xfec3('0x1e')]);_0x69155['offset']=qs['offset'](_0x487a82[_0xfec3('0x35')]['offset']);}_0x69155[_0xfec3('0x3b')]=qs[_0xfec3('0x3c')](_0x487a82[_0xfec3('0x35')][_0xfec3('0x3c')]);_0x69155[_0xfec3('0x3d')]=qs[_0xfec3('0x3e')](_[_0xfec3('0x3f')](_0x487a82[_0xfec3('0x35')],_0x1bf29d[_0xfec3('0x3e')]),_0x4a4542);if(_0x487a82[_0xfec3('0x35')]['filter']){_0x69155[_0xfec3('0x3d')]=_['merge'](_0x69155['where'],{'$or':_[_0xfec3('0x30')](_0x4a4542,function(_0x1a0523){if(_0x1a0523[_0xfec3('0x33')]!==_0xfec3('0x40')){var _0x4bee9b={};_0x4bee9b[_0x1a0523['name']]={'$like':'%'+_0x487a82[_0xfec3('0x35')][_0xfec3('0x41')]+'%'};return _0x4bee9b;}})});}_0x69155=_['merge']({},_0x69155,_0x487a82['options']);var _0x4ca9ef={'where':_0x69155[_0xfec3('0x3d')]};return db[_0xfec3('0x31')][_0xfec3('0x20')](_0x4ca9ef)['then'](function(_0x2a671d){_0x58b7b0[_0xfec3('0x20')]=_0x2a671d;if(_0x487a82[_0xfec3('0x35')]['includeAll']){_0x69155['include']=[{'all':!![]}];}return db[_0xfec3('0x31')]['findAll'](_0x69155);})['then'](function(_0x2f0336){_0x58b7b0[_0xfec3('0x42')]=_0x2f0336;return _0x58b7b0;})[_0xfec3('0x26')](respondWithFilteredResult(_0x55e866,_0x69155))['catch'](handleError(_0x55e866,null));};exports[_0xfec3('0x43')]=function(_0x6a4123,_0x3468c8){var _0x14a60a={'raw':![],'where':{'id':_0x6a4123[_0xfec3('0x44')]['id']}},_0xda345b={};_0xda345b[_0xfec3('0x34')]=_[_0xfec3('0x45')](db['Dashboard'][_0xfec3('0x46')]);_0xda345b[_0xfec3('0x35')]=_['keys'](_0x6a4123[_0xfec3('0x35')]);_0xda345b[_0xfec3('0x3e')]=_[_0xfec3('0x36')](_0xda345b['model'],_0xda345b[_0xfec3('0x35')]);_0x14a60a[_0xfec3('0x38')]=_[_0xfec3('0x36')](_0xda345b[_0xfec3('0x34')],qs[_0xfec3('0x37')](_0x6a4123['query']['fields']));_0x14a60a['attributes']=_0x14a60a[_0xfec3('0x38')][_0xfec3('0x39')]?_0x14a60a[_0xfec3('0x38')]:_0xda345b[_0xfec3('0x34')];if(_0x6a4123['query'][_0xfec3('0x47')]){_0x14a60a[_0xfec3('0x48')]=[{'all':!![]}];}_0x14a60a=_[_0xfec3('0x49')]({},_0x14a60a,_0x6a4123[_0xfec3('0x4a')]);return db[_0xfec3('0x31')][_0xfec3('0x4b')](_0x14a60a)[_0xfec3('0x26')](handleEntityNotFound(_0x3468c8,null))[_0xfec3('0x26')](respondWithResult(_0x3468c8,null))[_0xfec3('0x4c')](handleError(_0x3468c8,null));};exports['create']=function(_0x45ce0f,_0xce3cea){return db[_0xfec3('0x31')][_0xfec3('0x4d')](_0x45ce0f[_0xfec3('0x4e')],{})[_0xfec3('0x26')](function(_0x4a72cf){var _0x2abd1d=_0x45ce0f[_0xfec3('0x4f')]['get']({'plain':!![]});if(!_0x2abd1d)throw new Error(_0xfec3('0x50'));if(_0x2abd1d[_0xfec3('0x51')]===_0xfec3('0x4f')){var _0x3924a4=_0x4a72cf[_0xfec3('0x27')]({'plain':!![]});var _0x48730c='CustomDashboards';return db[_0xfec3('0x52')][_0xfec3('0x4b')]({'where':{'name':_0x48730c,'userProfileId':_0x2abd1d[_0xfec3('0x53')]},'raw':!![]})[_0xfec3('0x26')](function(_0x5c78f7){if(_0x5c78f7&&_0x5c78f7[_0xfec3('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x3924a4[_0xfec3('0x2d')],'resourceId':_0x3924a4['id'],'type':_0x5c78f7['name'],'sectionId':_0x5c78f7['id']},{})[_0xfec3('0x26')](function(){return _0x4a72cf;});}else{return _0x4a72cf;}})[_0xfec3('0x4c')](function(_0x5df0ba){logger[_0xfec3('0x2c')](_0xfec3('0x55'),_0x5df0ba);throw _0x5df0ba;});}return _0x4a72cf;})[_0xfec3('0x26')](respondWithResult(_0xce3cea,0xc9))[_0xfec3('0x4c')](handleError(_0xce3cea,null));};exports[_0xfec3('0x56')]=function(_0x595051,_0x516651){var _0x46c6b1={'where':{'id':_0x595051[_0xfec3('0x44')]['id']}},_0x47b3e3={};_0x47b3e3['model']=_[_0xfec3('0x45')](db[_0xfec3('0x31')]['rawAttributes']);_0x46c6b1['attributes']=_[_0xfec3('0x36')](_0x47b3e3['model'],qs[_0xfec3('0x37')](_0x595051[_0xfec3('0x35')][_0xfec3('0x37')]));_0x46c6b1['attributes']=_0x46c6b1[_0xfec3('0x38')]['length']?_0x46c6b1[_0xfec3('0x38')]:_0x47b3e3[_0xfec3('0x34')];if(_0x595051[_0xfec3('0x35')][_0xfec3('0x47')]){_0x46c6b1[_0xfec3('0x48')]=[{'all':!![]}];}_0x46c6b1=_[_0xfec3('0x49')]({},_0x46c6b1,_0x595051['options']);return db[_0xfec3('0x31')][_0xfec3('0x4b')](_0x46c6b1)['then'](handleEntityNotFound(_0x516651,null))[_0xfec3('0x26')](function(_0x307a3e){if(_0x307a3e){var _0x66c7df=_0x307a3e[_0xfec3('0x27')]({'plain':!![]});_0x66c7df=qs['omit'](_0x66c7df,['id',_0xfec3('0x57'),_0xfec3('0x58')]);_0x595051[_0xfec3('0x4e')]=_[_0xfec3('0x59')](_0x595051['body'],['id',_0xfec3('0x57'),_0xfec3('0x58')]);return db[_0xfec3('0x31')][_0xfec3('0x4d')](_[_0xfec3('0x49')](_0x66c7df,_0x595051[_0xfec3('0x4e')]),{'include':_0x595051[_0xfec3('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x31e7fd){var _0x42a573=_0x595051[_0xfec3('0x4f')][_0xfec3('0x27')]({'plain':!![]});if(!_0x42a573)throw new Error(_0xfec3('0x50'));if(_0x42a573[_0xfec3('0x51')]===_0xfec3('0x4f')){var _0x4b15d6=_0x31e7fd['get']({'plain':!![]});var _0xdc7dae=_0xfec3('0x28');return db[_0xfec3('0x52')]['find']({'where':{'name':_0xdc7dae,'userProfileId':_0x42a573[_0xfec3('0x53')]},'raw':!![]})[_0xfec3('0x26')](function(_0x5c2f6c){if(_0x5c2f6c&&_0x5c2f6c['autoAssociation']===0x0){return db[_0xfec3('0x29')][_0xfec3('0x4d')]({'name':_0x4b15d6[_0xfec3('0x2d')],'resourceId':_0x4b15d6['id'],'type':_0x5c2f6c['name'],'sectionId':_0x5c2f6c['id']},{})[_0xfec3('0x26')](function(){return _0x31e7fd;});}else{return _0x31e7fd;}})[_0xfec3('0x4c')](function(_0x1f446f){logger[_0xfec3('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f446f);throw _0x1f446f;});}return _0x31e7fd;});}})['then'](respondWithResult(_0x516651,0xc9))[_0xfec3('0x4c')](handleError(_0x516651,null));};exports[_0xfec3('0x24')]=function(_0x3fd123,_0x5f3262){if(_0x3fd123[_0xfec3('0x4e')]['id']){delete _0x3fd123[_0xfec3('0x4e')]['id'];}return db[_0xfec3('0x31')][_0xfec3('0x4b')]({'where':{'id':_0x3fd123[_0xfec3('0x44')]['id']}})[_0xfec3('0x26')](handleEntityNotFound(_0x5f3262,null))['then'](saveUpdates(_0x3fd123['body'],null))[_0xfec3('0x26')](respondWithResult(_0x5f3262,null))['catch'](handleError(_0x5f3262,null));};exports[_0xfec3('0x25')]=function(_0x5bf2ed,_0x31cfc8){return db[_0xfec3('0x31')][_0xfec3('0x4b')]({'where':{'id':_0x5bf2ed[_0xfec3('0x44')]['id']}})['then'](handleEntityNotFound(_0x31cfc8,null))[_0xfec3('0x26')](removeEntity(_0x31cfc8,null))[_0xfec3('0x4c')](handleError(_0x31cfc8,null));};function widgetAttributes(_0x29b7d7){try{switch(_0x29b7d7[_0xfec3('0x33')]){case _0xfec3('0x5a'):return[{'name':_0xfec3('0x5b'),'value':_0x29b7d7[_0xfec3('0x5b')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7[_0xfec3('0x5c')][0x0]?_0x29b7d7[_0xfec3('0x5c')][0x0][_0xfec3('0x5d')]:undefined)||_0xfec3('0x5e')}];case'custom':return[{'name':_0xfec3('0x5f'),'value':_0x29b7d7[_0xfec3('0x5f')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7['attrs'][0x0]?_0x29b7d7['attrs'][0x0]['value']:undefined)||''}];case _0xfec3('0x60'):return[{'name':_0xfec3('0x61'),'value':_0x29b7d7[_0xfec3('0x61')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7[_0xfec3('0x5c')][0x0]?_0x29b7d7[_0xfec3('0x5c')][0x0][_0xfec3('0x5d')]:undefined)||_0xfec3('0x62')},{'name':_0xfec3('0x63'),'value':_0x29b7d7['attrTimezone']||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7[_0xfec3('0x5c')][0x1]?_0x29b7d7[_0xfec3('0x5c')][0x1]['value']:undefined)||_0xfec3('0x64')},{'name':_0xfec3('0x65'),'value':_0x29b7d7[_0xfec3('0x65')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7['attrs'][0x2]?_0x29b7d7['attrs'][0x2][_0xfec3('0x5d')]:undefined)||0xc}];case _0xfec3('0x66'):return[{'name':_0xfec3('0x67'),'value':_0x29b7d7[_0xfec3('0x67')]||(_0x29b7d7['attrs']&&_0x29b7d7['attrs'][0x0]?_0x29b7d7[_0xfec3('0x5c')][0x0][_0xfec3('0x5d')]:undefined)||_0xfec3('0x68')},{'name':_0xfec3('0x69'),'value':_0x29b7d7[_0xfec3('0x69')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7[_0xfec3('0x5c')][0x1]?_0x29b7d7['attrs'][0x1][_0xfec3('0x5d')]:undefined)||[]},{'name':_0xfec3('0x65'),'value':_0x29b7d7[_0xfec3('0x65')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7[_0xfec3('0x5c')][0x2]?_0x29b7d7[_0xfec3('0x5c')][0x2][_0xfec3('0x5d')]:undefined)||0x14}];case _0xfec3('0x6a'):case _0xfec3('0x6b'):return[{'name':'attrSerie1','value':_0x29b7d7[_0xfec3('0x6c')]||(_0x29b7d7['attrs']&&_0x29b7d7[_0xfec3('0x5c')][0x0]?_0x29b7d7[_0xfec3('0x5c')][0x0][_0xfec3('0x5d')]:undefined)||_0xfec3('0x68')},{'name':'attrSerie2','value':_0x29b7d7[_0xfec3('0x6d')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7['attrs'][0x1]?_0x29b7d7[_0xfec3('0x5c')][0x1][_0xfec3('0x5d')]:undefined)||null},{'name':_0xfec3('0x6e'),'value':_0x29b7d7[_0xfec3('0x6e')]||(_0x29b7d7['attrs']&&_0x29b7d7[_0xfec3('0x5c')][0x2]?_0x29b7d7[_0xfec3('0x5c')][0x2]['value']:undefined)||null},{'name':_0xfec3('0x69'),'value':_0x29b7d7['attrVoiceQueues']||(_0x29b7d7['attrs']&&_0x29b7d7[_0xfec3('0x5c')][0x3]?_0x29b7d7[_0xfec3('0x5c')][0x3][_0xfec3('0x5d')]:undefined)||[]}];case'web-report':return[{'name':_0xfec3('0x6f'),'type':_0x29b7d7[_0xfec3('0x70')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7[_0xfec3('0x5c')][0x0]?_0x29b7d7[_0xfec3('0x5c')][0x0]['type']:undefined)||null,'value':_0x29b7d7[_0xfec3('0x6f')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7['attrs'][0x0]?_0x29b7d7[_0xfec3('0x5c')][0x0][_0xfec3('0x5d')]:undefined)||null},{'name':_0xfec3('0x71'),'value':_0x29b7d7[_0xfec3('0x71')]||(_0x29b7d7[_0xfec3('0x5c')]&&_0x29b7d7[_0xfec3('0x5c')][0x1]?_0x29b7d7['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0xda7743){logger[_0xfec3('0x2c')]('widgetAttributes:\x20%s',JSON[_0xfec3('0x72')](_0xda7743));return[];}}exports['addItem']=function(_0x344834,_0x247b06,_0x474326){if(_0x344834['body']['id']){delete _0x344834['body']['id'];}return db[_0xfec3('0x31')]['find']({'where':{'id':_0x344834['params']['id']}})[_0xfec3('0x26')](handleEntityNotFound(_0x247b06,null))['then'](function(_0x127dd8){if(_0x127dd8){_0x344834['body'][_0xfec3('0x73')]=_0x127dd8['id'];_0x344834[_0xfec3('0x4e')][_0xfec3('0x5c')]=widgetAttributes(_0x344834[_0xfec3('0x4e')]);return db[_0xfec3('0x74')][_0xfec3('0x4d')](_0x344834[_0xfec3('0x4e')]);}})[_0xfec3('0x26')](respondWithResult(_0x247b06,null))[_0xfec3('0x4c')](handleError(_0x247b06,null));};exports[_0xfec3('0x75')]=function(_0x22ce40,_0x5e025e,_0x2ae602){var _0x1809e4={};var _0x36f9d9={};var _0x48efd1;var _0x5ec2e6;return db[_0xfec3('0x31')][_0xfec3('0x76')]({'where':{'id':_0x22ce40[_0xfec3('0x44')]['id']}})[_0xfec3('0x26')](handleEntityNotFound(_0x5e025e,null))[_0xfec3('0x26')](function(_0x4af92d){if(_0x4af92d){_0x48efd1=_0x4af92d;_0x36f9d9['model']=_[_0xfec3('0x45')](db[_0xfec3('0x74')][_0xfec3('0x46')]);_0x36f9d9['query']=_[_0xfec3('0x45')](_0x22ce40[_0xfec3('0x35')]);_0x36f9d9[_0xfec3('0x3e')]=_['intersection'](_0x36f9d9[_0xfec3('0x34')],_0x36f9d9[_0xfec3('0x35')]);_0x1809e4[_0xfec3('0x38')]=_[_0xfec3('0x36')](_0x36f9d9[_0xfec3('0x34')],qs[_0xfec3('0x37')](_0x22ce40[_0xfec3('0x35')][_0xfec3('0x37')]));_0x1809e4['attributes']=_0x1809e4[_0xfec3('0x38')][_0xfec3('0x39')]?_0x1809e4['attributes']:_0x36f9d9[_0xfec3('0x34')];_0x1809e4[_0xfec3('0x3b')]=qs[_0xfec3('0x3c')](_0x22ce40[_0xfec3('0x35')][_0xfec3('0x3c')]);_0x1809e4[_0xfec3('0x3d')]=qs[_0xfec3('0x3e')](_[_0xfec3('0x3f')](_0x22ce40[_0xfec3('0x35')],_0x36f9d9[_0xfec3('0x3e')]));if(_0x22ce40[_0xfec3('0x35')]['filter']){_0x1809e4[_0xfec3('0x3d')]=_['merge'](_0x1809e4[_0xfec3('0x3d')],{'$or':_[_0xfec3('0x30')](_0x1809e4[_0xfec3('0x38')],function(_0x497efa){var _0x349b5e={};_0x349b5e[_0x497efa]={'$like':'%'+_0x22ce40[_0xfec3('0x35')]['filter']+'%'};return _0x349b5e;})});}_0x1809e4=_[_0xfec3('0x49')]({},_0x1809e4,_0x22ce40[_0xfec3('0x4a')]);return _0x48efd1['getItems'](_0x1809e4);}})[_0xfec3('0x26')](function(_0x3c7edb){if(_0x3c7edb){_0x5ec2e6=_0x3c7edb['length'];if(!_0x22ce40['query']['hasOwnProperty'](_0xfec3('0x3a'))){_0x1809e4[_0xfec3('0x1e')]=qs[_0xfec3('0x1e')](_0x22ce40['query'][_0xfec3('0x1e')]);_0x1809e4[_0xfec3('0x1d')]=qs[_0xfec3('0x1d')](_0x22ce40[_0xfec3('0x35')]['offset']);}return _0x48efd1[_0xfec3('0x75')](_0x1809e4);}})[_0xfec3('0x26')](function(_0x57227e){if(_0x57227e){return _0x57227e?{'count':_0x5ec2e6,'rows':_0x57227e}:null;}})['then'](respondWithResult(_0x5e025e,null))[_0xfec3('0x4c')](handleError(_0x5e025e,null));}; \ No newline at end of file +var _0xb585=['find','userProfileId','autoAssociation','create','clone','createdAt','updatedAt','omit','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','findOne','DashboardItem','getItems','nolimit','eml-format','rimraf','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./dashboard.socket','register','sendStatus','status','end','json','limit','offset','count','set','Content-Range','save','update','then','destroy','get','UserProfileResource','error','stack','name','map','Dashboard','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CustomDashboards','UserProfileSection'];(function(_0x5d63e0,_0x4f859f){var _0x4f35a4=function(_0x3a3fa4){while(--_0x3a3fa4){_0x5d63e0['push'](_0x5d63e0['shift']());}};_0x4f35a4(++_0x4f859f);}(_0xb585,0x188));var _0x5b58=function(_0x253eeb,_0x26cb4f){_0x253eeb=_0x253eeb-0x0;var _0xb49935=_0xb585[_0x253eeb];return _0xb49935;};'use strict';var emlformat=require(_0x5b58('0x0'));var rimraf=require(_0x5b58('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b58('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5b58('0x3'));var util=require(_0x5b58('0x4'));var path=require('path');var sox=require(_0x5b58('0x5'));var csv=require(_0x5b58('0x6'));var ejs=require(_0x5b58('0x7'));var fs=require('fs');var fs_extra=require(_0x5b58('0x8'));var _=require(_0x5b58('0x9'));var squel=require(_0x5b58('0xa'));var crypto=require(_0x5b58('0xb'));var jsforce=require(_0x5b58('0xc'));var deskjs=require(_0x5b58('0xd'));var toCsv=require(_0x5b58('0x6'));var querystring=require('querystring');var Papa=require(_0x5b58('0xe'));var Redis=require('ioredis');var authService=require(_0x5b58('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5b58('0x10'));var hardwareService=require(_0x5b58('0x11'));var logger=require(_0x5b58('0x12'))(_0x5b58('0x13'));var utils=require(_0x5b58('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5b58('0x15'));var db=require(_0x5b58('0x16'))['db'];config['redis']=_[_0x5b58('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5b58('0x18'))(new Redis(config[_0x5b58('0x19')]));require(_0x5b58('0x1a'))[_0x5b58('0x1b')](socket);function respondWithStatusCode(_0x21ff7a,_0xfb8a40){_0xfb8a40=_0xfb8a40||0xcc;return function(_0x19b6dc){if(_0x19b6dc){return _0x21ff7a[_0x5b58('0x1c')](_0xfb8a40);}return _0x21ff7a[_0x5b58('0x1d')](_0xfb8a40)[_0x5b58('0x1e')]();};}function respondWithResult(_0x2f5d95,_0x963fd4){_0x963fd4=_0x963fd4||0xc8;return function(_0x57411a){if(_0x57411a){return _0x2f5d95[_0x5b58('0x1d')](_0x963fd4)[_0x5b58('0x1f')](_0x57411a);}};}function respondWithFilteredResult(_0x4915c1,_0x194248){return function(_0x4631d5){if(_0x4631d5){var _0x369bc3=typeof _0x194248['offset']==='undefined'&&typeof _0x194248[_0x5b58('0x20')]==='undefined';var _0xc36abd=_0x4631d5['count'];var _0x37f928=_0x369bc3?0x0:_0x194248[_0x5b58('0x21')];var _0x3a928a=_0x369bc3?_0x4631d5[_0x5b58('0x22')]:_0x194248[_0x5b58('0x21')]+_0x194248[_0x5b58('0x20')];var _0x3b619c;if(_0x3a928a>=_0xc36abd){_0x3a928a=_0xc36abd;_0x3b619c=0xc8;}else{_0x3b619c=0xce;}_0x4915c1[_0x5b58('0x1d')](_0x3b619c);return _0x4915c1[_0x5b58('0x23')](_0x5b58('0x24'),_0x37f928+'-'+_0x3a928a+'/'+_0xc36abd)[_0x5b58('0x1f')](_0x4631d5);}return null;};}function patchUpdates(_0x1c3acc){return function(_0x556ffe){try{jsonpatch['apply'](_0x556ffe,_0x1c3acc,!![]);}catch(_0x150199){return BPromise['reject'](_0x150199);}return _0x556ffe[_0x5b58('0x25')]();};}function saveUpdates(_0x4ef7c3,_0x2100ac){return function(_0x161ac8){if(_0x161ac8){return _0x161ac8[_0x5b58('0x26')](_0x4ef7c3)[_0x5b58('0x27')](function(_0x7a54a5){return _0x7a54a5;});}return null;};}function removeEntity(_0x4965b2,_0x35a1cb){return function(_0x1b7b44){if(_0x1b7b44){return _0x1b7b44[_0x5b58('0x28')]()[_0x5b58('0x27')](function(){var _0x77a931=_0x1b7b44[_0x5b58('0x29')]({'plain':!![]});var _0xc522c7='CustomDashboards';return db[_0x5b58('0x2a')]['destroy']({'where':{'type':_0xc522c7,'resourceId':_0x77a931['id']}})[_0x5b58('0x27')](function(){return _0x1b7b44;});})[_0x5b58('0x27')](function(){_0x4965b2[_0x5b58('0x1d')](0xcc)[_0x5b58('0x1e')]();});}};}function handleEntityNotFound(_0x6170d5,_0x5e2bcb){return function(_0x314e22){if(!_0x314e22){_0x6170d5[_0x5b58('0x1c')](0x194);}return _0x314e22;};}function handleError(_0x5cba7e,_0x14822c){_0x14822c=_0x14822c||0x1f4;return function(_0x7d5406){logger[_0x5b58('0x2b')](_0x7d5406[_0x5b58('0x2c')]);if(_0x7d5406[_0x5b58('0x2d')]){delete _0x7d5406[_0x5b58('0x2d')];}_0x5cba7e[_0x5b58('0x1d')](_0x14822c)['send'](_0x7d5406);};}exports['index']=function(_0xbd4303,_0x1d52fc){var _0x25480b={},_0x1fb77c={},_0x2793db={'count':0x0,'rows':[]};var _0x2eb765=_[_0x5b58('0x2e')](db[_0x5b58('0x2f')][_0x5b58('0x30')],function(_0x339de9){return{'name':_0x339de9[_0x5b58('0x31')],'type':_0x339de9['type'][_0x5b58('0x32')]};});_0x1fb77c[_0x5b58('0x33')]=_[_0x5b58('0x2e')](_0x2eb765,_0x5b58('0x2d'));_0x1fb77c[_0x5b58('0x34')]=_['keys'](_0xbd4303[_0x5b58('0x34')]);_0x1fb77c[_0x5b58('0x35')]=_[_0x5b58('0x36')](_0x1fb77c[_0x5b58('0x33')],_0x1fb77c[_0x5b58('0x34')]);_0x25480b[_0x5b58('0x37')]=_[_0x5b58('0x36')](_0x1fb77c[_0x5b58('0x33')],qs[_0x5b58('0x38')](_0xbd4303[_0x5b58('0x34')]['fields']));_0x25480b[_0x5b58('0x37')]=_0x25480b[_0x5b58('0x37')][_0x5b58('0x39')]?_0x25480b['attributes']:_0x1fb77c['model'];if(!_0xbd4303[_0x5b58('0x34')][_0x5b58('0x3a')]('nolimit')){_0x25480b[_0x5b58('0x20')]=qs['limit'](_0xbd4303['query'][_0x5b58('0x20')]);_0x25480b[_0x5b58('0x21')]=qs['offset'](_0xbd4303['query'][_0x5b58('0x21')]);}_0x25480b[_0x5b58('0x3b')]=qs[_0x5b58('0x3c')](_0xbd4303[_0x5b58('0x34')]['sort']);_0x25480b[_0x5b58('0x3d')]=qs[_0x5b58('0x35')](_[_0x5b58('0x3e')](_0xbd4303['query'],_0x1fb77c[_0x5b58('0x35')]),_0x2eb765);if(_0xbd4303[_0x5b58('0x34')][_0x5b58('0x3f')]){_0x25480b['where']=_[_0x5b58('0x40')](_0x25480b['where'],{'$or':_[_0x5b58('0x2e')](_0x2eb765,function(_0x253fea){if(_0x253fea['type']!=='VIRTUAL'){var _0x15c6ff={};_0x15c6ff[_0x253fea[_0x5b58('0x2d')]]={'$like':'%'+_0xbd4303[_0x5b58('0x34')][_0x5b58('0x3f')]+'%'};return _0x15c6ff;}})});}_0x25480b=_['merge']({},_0x25480b,_0xbd4303['options']);var _0x430d2a={'where':_0x25480b[_0x5b58('0x3d')]};return db[_0x5b58('0x2f')][_0x5b58('0x22')](_0x430d2a)[_0x5b58('0x27')](function(_0x22e592){_0x2793db[_0x5b58('0x22')]=_0x22e592;if(_0xbd4303[_0x5b58('0x34')][_0x5b58('0x41')]){_0x25480b[_0x5b58('0x42')]=[{'all':!![]}];}return db[_0x5b58('0x2f')][_0x5b58('0x43')](_0x25480b);})[_0x5b58('0x27')](function(_0x1ab06d){_0x2793db[_0x5b58('0x44')]=_0x1ab06d;return _0x2793db;})[_0x5b58('0x27')](respondWithFilteredResult(_0x1d52fc,_0x25480b))[_0x5b58('0x45')](handleError(_0x1d52fc,null));};exports[_0x5b58('0x46')]=function(_0x53644f,_0x2fc7e1){var _0x292b06={'raw':![],'where':{'id':_0x53644f[_0x5b58('0x47')]['id']}},_0xaa5284={};_0xaa5284['model']=_['keys'](db[_0x5b58('0x2f')][_0x5b58('0x30')]);_0xaa5284[_0x5b58('0x34')]=_[_0x5b58('0x48')](_0x53644f[_0x5b58('0x34')]);_0xaa5284['filters']=_[_0x5b58('0x36')](_0xaa5284[_0x5b58('0x33')],_0xaa5284[_0x5b58('0x34')]);_0x292b06[_0x5b58('0x37')]=_[_0x5b58('0x36')](_0xaa5284[_0x5b58('0x33')],qs[_0x5b58('0x38')](_0x53644f[_0x5b58('0x34')][_0x5b58('0x38')]));_0x292b06['attributes']=_0x292b06['attributes'][_0x5b58('0x39')]?_0x292b06[_0x5b58('0x37')]:_0xaa5284[_0x5b58('0x33')];if(_0x53644f[_0x5b58('0x34')][_0x5b58('0x41')]){_0x292b06['include']=[{'all':!![]}];}_0x292b06=_[_0x5b58('0x40')]({},_0x292b06,_0x53644f[_0x5b58('0x49')]);return db[_0x5b58('0x2f')]['find'](_0x292b06)['then'](handleEntityNotFound(_0x2fc7e1,null))['then'](respondWithResult(_0x2fc7e1,null))[_0x5b58('0x45')](handleError(_0x2fc7e1,null));};exports['create']=function(_0x53d418,_0x2c35a7){return db[_0x5b58('0x2f')]['create'](_0x53d418[_0x5b58('0x4a')],{})[_0x5b58('0x27')](function(_0x431114){var _0x81ee65=_0x53d418['user'][_0x5b58('0x29')]({'plain':!![]});if(!_0x81ee65)throw new Error(_0x5b58('0x4b'));if(_0x81ee65[_0x5b58('0x4c')]===_0x5b58('0x4d')){var _0x2b2b85=_0x431114['get']({'plain':!![]});var _0x42c7b6=_0x5b58('0x4e');return db[_0x5b58('0x4f')][_0x5b58('0x50')]({'where':{'name':_0x42c7b6,'userProfileId':_0x81ee65[_0x5b58('0x51')]},'raw':!![]})[_0x5b58('0x27')](function(_0x254482){if(_0x254482&&_0x254482[_0x5b58('0x52')]===0x0){return db[_0x5b58('0x2a')][_0x5b58('0x53')]({'name':_0x2b2b85[_0x5b58('0x2d')],'resourceId':_0x2b2b85['id'],'type':_0x254482[_0x5b58('0x2d')],'sectionId':_0x254482['id']},{})[_0x5b58('0x27')](function(){return _0x431114;});}else{return _0x431114;}})[_0x5b58('0x45')](function(_0x30150a){logger[_0x5b58('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x30150a);throw _0x30150a;});}return _0x431114;})['then'](respondWithResult(_0x2c35a7,0xc9))[_0x5b58('0x45')](handleError(_0x2c35a7,null));};exports[_0x5b58('0x54')]=function(_0x485925,_0x36fab3){var _0xbd3371={'where':{'id':_0x485925[_0x5b58('0x47')]['id']}},_0xb5f9a6={};_0xb5f9a6[_0x5b58('0x33')]=_[_0x5b58('0x48')](db[_0x5b58('0x2f')][_0x5b58('0x30')]);_0xbd3371['attributes']=_[_0x5b58('0x36')](_0xb5f9a6['model'],qs[_0x5b58('0x38')](_0x485925['query'][_0x5b58('0x38')]));_0xbd3371[_0x5b58('0x37')]=_0xbd3371[_0x5b58('0x37')]['length']?_0xbd3371[_0x5b58('0x37')]:_0xb5f9a6[_0x5b58('0x33')];if(_0x485925[_0x5b58('0x34')][_0x5b58('0x41')]){_0xbd3371[_0x5b58('0x42')]=[{'all':!![]}];}_0xbd3371=_['merge']({},_0xbd3371,_0x485925[_0x5b58('0x49')]);return db['Dashboard'][_0x5b58('0x50')](_0xbd3371)['then'](handleEntityNotFound(_0x36fab3,null))['then'](function(_0x273f89){if(_0x273f89){var _0x5086e8=_0x273f89[_0x5b58('0x29')]({'plain':!![]});_0x5086e8=qs['omit'](_0x5086e8,['id',_0x5b58('0x55'),_0x5b58('0x56')]);_0x485925['body']=_[_0x5b58('0x57')](_0x485925[_0x5b58('0x4a')],['id','createdAt','updatedAt']);return db[_0x5b58('0x2f')][_0x5b58('0x53')](_[_0x5b58('0x40')](_0x5086e8,_0x485925['body']),{'include':_0x485925[_0x5b58('0x34')]['includeAll']?[{'all':!![]}]:undefined})[_0x5b58('0x27')](function(_0x610d7b){var _0x581033=_0x485925['user']['get']({'plain':!![]});if(!_0x581033)throw new Error(_0x5b58('0x4b'));if(_0x581033[_0x5b58('0x4c')]===_0x5b58('0x4d')){var _0x5c2a54=_0x610d7b[_0x5b58('0x29')]({'plain':!![]});var _0x21bf48=_0x5b58('0x4e');return db[_0x5b58('0x4f')][_0x5b58('0x50')]({'where':{'name':_0x21bf48,'userProfileId':_0x581033[_0x5b58('0x51')]},'raw':!![]})['then'](function(_0x46653e){if(_0x46653e&&_0x46653e['autoAssociation']===0x0){return db[_0x5b58('0x2a')][_0x5b58('0x53')]({'name':_0x5c2a54[_0x5b58('0x2d')],'resourceId':_0x5c2a54['id'],'type':_0x46653e[_0x5b58('0x2d')],'sectionId':_0x46653e['id']},{})[_0x5b58('0x27')](function(){return _0x610d7b;});}else{return _0x610d7b;}})[_0x5b58('0x45')](function(_0x46c129){logger[_0x5b58('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x46c129);throw _0x46c129;});}return _0x610d7b;});}})[_0x5b58('0x27')](respondWithResult(_0x36fab3,0xc9))[_0x5b58('0x45')](handleError(_0x36fab3,null));};exports[_0x5b58('0x26')]=function(_0x1f169b,_0x379b7a){if(_0x1f169b[_0x5b58('0x4a')]['id']){delete _0x1f169b[_0x5b58('0x4a')]['id'];}return db[_0x5b58('0x2f')][_0x5b58('0x50')]({'where':{'id':_0x1f169b[_0x5b58('0x47')]['id']}})[_0x5b58('0x27')](handleEntityNotFound(_0x379b7a,null))['then'](saveUpdates(_0x1f169b[_0x5b58('0x4a')],null))[_0x5b58('0x27')](respondWithResult(_0x379b7a,null))['catch'](handleError(_0x379b7a,null));};exports[_0x5b58('0x28')]=function(_0x1e29f9,_0xce8f72){return db[_0x5b58('0x2f')][_0x5b58('0x50')]({'where':{'id':_0x1e29f9['params']['id']}})['then'](handleEntityNotFound(_0xce8f72,null))['then'](removeEntity(_0xce8f72,null))[_0x5b58('0x45')](handleError(_0xce8f72,null));};function widgetAttributes(_0x824167){try{switch(_0x824167[_0x5b58('0x58')]){case _0x5b58('0x59'):return[{'name':'attrUrl','value':_0x824167[_0x5b58('0x5a')]||(_0x824167['attrs']&&_0x824167[_0x5b58('0x5b')][0x0]?_0x824167[_0x5b58('0x5b')][0x0][_0x5b58('0x5c')]:undefined)||'https://'}];case _0x5b58('0x5d'):return[{'name':_0x5b58('0x5e'),'value':_0x824167[_0x5b58('0x5e')]||(_0x824167[_0x5b58('0x5b')]&&_0x824167['attrs'][0x0]?_0x824167[_0x5b58('0x5b')][0x0][_0x5b58('0x5c')]:undefined)||''}];case _0x5b58('0x5f'):return[{'name':_0x5b58('0x60'),'value':_0x824167[_0x5b58('0x60')]||(_0x824167[_0x5b58('0x5b')]&&_0x824167[_0x5b58('0x5b')][0x0]?_0x824167[_0x5b58('0x5b')][0x0][_0x5b58('0x5c')]:undefined)||'HH:mm:ss'},{'name':_0x5b58('0x61'),'value':_0x824167[_0x5b58('0x61')]||(_0x824167[_0x5b58('0x5b')]&&_0x824167['attrs'][0x1]?_0x824167[_0x5b58('0x5b')][0x1][_0x5b58('0x5c')]:undefined)||_0x5b58('0x62')},{'name':'attrFontSize','value':_0x824167['attrFontSize']||(_0x824167[_0x5b58('0x5b')]&&_0x824167[_0x5b58('0x5b')][0x2]?_0x824167['attrs'][0x2][_0x5b58('0x5c')]:undefined)||0xc}];case'counter':return[{'name':_0x5b58('0x63'),'value':_0x824167[_0x5b58('0x63')]||(_0x824167[_0x5b58('0x5b')]&&_0x824167[_0x5b58('0x5b')][0x0]?_0x824167[_0x5b58('0x5b')][0x0][_0x5b58('0x5c')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x824167[_0x5b58('0x64')]||(_0x824167[_0x5b58('0x5b')]&&_0x824167['attrs'][0x1]?_0x824167[_0x5b58('0x5b')][0x1][_0x5b58('0x5c')]:undefined)||[]},{'name':'attrFontSize','value':_0x824167['attrFontSize']||(_0x824167[_0x5b58('0x5b')]&&_0x824167[_0x5b58('0x5b')][0x2]?_0x824167['attrs'][0x2]['value']:undefined)||0x14}];case _0x5b58('0x65'):case _0x5b58('0x66'):return[{'name':'attrSerie1','value':_0x824167[_0x5b58('0x67')]||(_0x824167['attrs']&&_0x824167[_0x5b58('0x5b')][0x0]?_0x824167['attrs'][0x0][_0x5b58('0x5c')]:undefined)||'total'},{'name':_0x5b58('0x68'),'value':_0x824167[_0x5b58('0x68')]||(_0x824167[_0x5b58('0x5b')]&&_0x824167[_0x5b58('0x5b')][0x1]?_0x824167['attrs'][0x1][_0x5b58('0x5c')]:undefined)||null},{'name':_0x5b58('0x69'),'value':_0x824167[_0x5b58('0x69')]||(_0x824167[_0x5b58('0x5b')]&&_0x824167['attrs'][0x2]?_0x824167[_0x5b58('0x5b')][0x2][_0x5b58('0x5c')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x824167[_0x5b58('0x64')]||(_0x824167[_0x5b58('0x5b')]&&_0x824167[_0x5b58('0x5b')][0x3]?_0x824167[_0x5b58('0x5b')][0x3]['value']:undefined)||[]}];case _0x5b58('0x6a'):return[{'name':_0x5b58('0x6b'),'type':_0x824167[_0x5b58('0x6c')]||(_0x824167[_0x5b58('0x5b')]&&_0x824167[_0x5b58('0x5b')][0x0]?_0x824167['attrs'][0x0]['type']:undefined)||null,'value':_0x824167[_0x5b58('0x6b')]||(_0x824167[_0x5b58('0x5b')]&&_0x824167[_0x5b58('0x5b')][0x0]?_0x824167[_0x5b58('0x5b')][0x0][_0x5b58('0x5c')]:undefined)||null},{'name':_0x5b58('0x6d'),'value':_0x824167[_0x5b58('0x6d')]||(_0x824167[_0x5b58('0x5b')]&&_0x824167[_0x5b58('0x5b')][0x1]?_0x824167['attrs'][0x1][_0x5b58('0x5c')]:undefined)||0x0}];default:return[];}}catch(_0x41e60a){logger[_0x5b58('0x2b')](_0x5b58('0x6e'),JSON[_0x5b58('0x6f')](_0x41e60a));return[];}}exports[_0x5b58('0x70')]=function(_0x1a02de,_0x3954db,_0x1767c5){if(_0x1a02de[_0x5b58('0x4a')]['id']){delete _0x1a02de[_0x5b58('0x4a')]['id'];}return db[_0x5b58('0x2f')]['find']({'where':{'id':_0x1a02de[_0x5b58('0x47')]['id']}})[_0x5b58('0x27')](handleEntityNotFound(_0x3954db,null))[_0x5b58('0x27')](function(_0x58d494){if(_0x58d494){_0x1a02de[_0x5b58('0x4a')][_0x5b58('0x71')]=_0x58d494['id'];_0x1a02de[_0x5b58('0x4a')][_0x5b58('0x5b')]=widgetAttributes(_0x1a02de[_0x5b58('0x4a')]);return db['DashboardItem'][_0x5b58('0x53')](_0x1a02de[_0x5b58('0x4a')]);}})['then'](respondWithResult(_0x3954db,null))[_0x5b58('0x45')](handleError(_0x3954db,null));};exports['getItems']=function(_0x257cfd,_0x2ce9aa,_0x4f9c91){var _0x5e0ccf={};var _0x5a1f53={};var _0x1e1268;var _0x1771b9;return db[_0x5b58('0x2f')][_0x5b58('0x72')]({'where':{'id':_0x257cfd[_0x5b58('0x47')]['id']}})[_0x5b58('0x27')](handleEntityNotFound(_0x2ce9aa,null))[_0x5b58('0x27')](function(_0x2c7172){if(_0x2c7172){_0x1e1268=_0x2c7172;_0x5a1f53[_0x5b58('0x33')]=_[_0x5b58('0x48')](db[_0x5b58('0x73')][_0x5b58('0x30')]);_0x5a1f53[_0x5b58('0x34')]=_['keys'](_0x257cfd[_0x5b58('0x34')]);_0x5a1f53[_0x5b58('0x35')]=_[_0x5b58('0x36')](_0x5a1f53[_0x5b58('0x33')],_0x5a1f53['query']);_0x5e0ccf['attributes']=_[_0x5b58('0x36')](_0x5a1f53[_0x5b58('0x33')],qs[_0x5b58('0x38')](_0x257cfd[_0x5b58('0x34')][_0x5b58('0x38')]));_0x5e0ccf[_0x5b58('0x37')]=_0x5e0ccf[_0x5b58('0x37')][_0x5b58('0x39')]?_0x5e0ccf[_0x5b58('0x37')]:_0x5a1f53['model'];_0x5e0ccf[_0x5b58('0x3b')]=qs[_0x5b58('0x3c')](_0x257cfd['query']['sort']);_0x5e0ccf[_0x5b58('0x3d')]=qs[_0x5b58('0x35')](_[_0x5b58('0x3e')](_0x257cfd[_0x5b58('0x34')],_0x5a1f53[_0x5b58('0x35')]));if(_0x257cfd['query'][_0x5b58('0x3f')]){_0x5e0ccf[_0x5b58('0x3d')]=_[_0x5b58('0x40')](_0x5e0ccf['where'],{'$or':_[_0x5b58('0x2e')](_0x5e0ccf[_0x5b58('0x37')],function(_0x9ce5e1){var _0x4a0924={};_0x4a0924[_0x9ce5e1]={'$like':'%'+_0x257cfd[_0x5b58('0x34')][_0x5b58('0x3f')]+'%'};return _0x4a0924;})});}_0x5e0ccf=_[_0x5b58('0x40')]({},_0x5e0ccf,_0x257cfd[_0x5b58('0x49')]);return _0x1e1268[_0x5b58('0x74')](_0x5e0ccf);}})[_0x5b58('0x27')](function(_0x298c18){if(_0x298c18){_0x1771b9=_0x298c18[_0x5b58('0x39')];if(!_0x257cfd[_0x5b58('0x34')]['hasOwnProperty'](_0x5b58('0x75'))){_0x5e0ccf['limit']=qs[_0x5b58('0x20')](_0x257cfd[_0x5b58('0x34')][_0x5b58('0x20')]);_0x5e0ccf[_0x5b58('0x21')]=qs[_0x5b58('0x21')](_0x257cfd[_0x5b58('0x34')][_0x5b58('0x21')]);}return _0x1e1268[_0x5b58('0x74')](_0x5e0ccf);}})[_0x5b58('0x27')](function(_0x5d3cb4){if(_0x5d3cb4){return _0x5d3cb4?{'count':_0x1771b9,'rows':_0x5d3cb4}:null;}})['then'](respondWithResult(_0x2ce9aa,null))[_0x5b58('0x45')](handleError(_0x2ce9aa,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 4242c92..cda7875 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 _0x3ea2=['Dashboard','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x538fd8,_0x24ed11){var _0x279fb4=function(_0x550563){while(--_0x550563){_0x538fd8['push'](_0x538fd8['shift']());}};_0x279fb4(++_0x24ed11);}(_0x3ea2,0x1d4));var _0x23ea=function(_0x2fb356,_0x567092){_0x2fb356=_0x2fb356-0x0;var _0x27fb4b=_0x3ea2[_0x2fb356];return _0x27fb4b;};'use strict';var EventEmitter=require(_0x23ea('0x0'));var Dashboard=require(_0x23ea('0x1'))['db'][_0x23ea('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x23ea('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x23ea('0x4'),'afterDestroy':_0x23ea('0x5')};function emitEvent(_0x239a88){return function(_0x32d062,_0x5e1a61,_0x1b7557){DashboardEvents[_0x23ea('0x6')](_0x239a88+':'+_0x32d062['id'],_0x32d062);DashboardEvents[_0x23ea('0x6')](_0x239a88,_0x32d062);_0x1b7557(null);};}for(var e in events){if(events[_0x23ea('0x7')](e)){var event=events[e];Dashboard[_0x23ea('0x8')](e,emitEvent(event));}}module[_0x23ea('0x9')]=DashboardEvents; \ No newline at end of file +var _0xfbfc=['update','remove','emit','hasOwnProperty','hook','exports','events','Dashboard','setMaxListeners','save'];(function(_0x19828e,_0x2b3845){var _0x53a968=function(_0x23339c){while(--_0x23339c){_0x19828e['push'](_0x19828e['shift']());}};_0x53a968(++_0x2b3845);}(_0xfbfc,0x1be));var _0xcfbf=function(_0x392c0b,_0x4f9090){_0x392c0b=_0x392c0b-0x0;var _0x108762=_0xfbfc[_0x392c0b];return _0x108762;};'use strict';var EventEmitter=require(_0xcfbf('0x0'));var Dashboard=require('../../mysqldb')['db'][_0xcfbf('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xcfbf('0x2')](0x0);var events={'afterCreate':_0xcfbf('0x3'),'afterUpdate':_0xcfbf('0x4'),'afterDestroy':_0xcfbf('0x5')};function emitEvent(_0x5d3d55){return function(_0x50522d,_0x30d524,_0x138e36){DashboardEvents[_0xcfbf('0x6')](_0x5d3d55+':'+_0x50522d['id'],_0x50522d);DashboardEvents['emit'](_0x5d3d55,_0x50522d);_0x138e36(null);};}for(var e in events){if(events[_0xcfbf('0x7')](e)){var event=events[e];Dashboard[_0xcfbf('0x8')](e,emitEvent(event));}}module[_0xcfbf('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 2b7543f..30a7928 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 _0x5000=['moment','bluebird','request-promise','path','rimraf','exports','define','Dashboard','dashboards','lodash','util','api'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5000,0x1c5));var _0x0500=function(_0x52d5c6,_0x18dfc8){_0x52d5c6=_0x52d5c6-0x0;var _0x4a6334=_0x5000[_0x52d5c6];return _0x4a6334;};'use strict';var _=require(_0x0500('0x0'));var util=require(_0x0500('0x1'));var logger=require('../../config/logger')(_0x0500('0x2'));var moment=require(_0x0500('0x3'));var BPromise=require(_0x0500('0x4'));var rp=require(_0x0500('0x5'));var fs=require('fs');var path=require(_0x0500('0x6'));var rimraf=require(_0x0500('0x7'));var config=require('../../config/environment');var attributes=require('./dashboard.attributes');module[_0x0500('0x8')]=function(_0x5991af,_0x772836){return _0x5991af[_0x0500('0x9')](_0x0500('0xa'),attributes,{'tableName':_0x0500('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x61c5=['dashboards','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x5235a6,_0x680b76){var _0x1cf37e=function(_0x31c173){while(--_0x31c173){_0x5235a6['push'](_0x5235a6['shift']());}};_0x1cf37e(++_0x680b76);}(_0x61c5,0x1dd));var _0x561c=function(_0x4da9d8,_0x42fb50){_0x4da9d8=_0x4da9d8-0x0;var _0x468872=_0x61c5[_0x4da9d8];return _0x468872;};'use strict';var _=require(_0x561c('0x0'));var util=require(_0x561c('0x1'));var logger=require(_0x561c('0x2'))(_0x561c('0x3'));var moment=require(_0x561c('0x4'));var BPromise=require(_0x561c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x561c('0x6'));var rimraf=require(_0x561c('0x7'));var config=require(_0x561c('0x8'));var attributes=require(_0x561c('0x9'));module[_0x561c('0xa')]=function(_0x1a59e6,_0x34d800){return _0x1a59e6[_0x561c('0xb')](_0x561c('0xc'),attributes,{'tableName':_0x561c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 7a7f7e8..7b17a00 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 _0xcc1a=['../../config/logger','rpc','client','redis','defaults','localhost','./dashboard.socket','request','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','ioredis','../../config/utils'];(function(_0x39ffd1,_0x299703){var _0x31267e=function(_0x11b420){while(--_0x11b420){_0x39ffd1['push'](_0x39ffd1['shift']());}};_0x31267e(++_0x299703);}(_0xcc1a,0x133));var _0xacc1=function(_0x419550,_0x15cdf1){_0x419550=_0x419550-0x0;var _0x55f9ef=_0xcc1a[_0x419550];return _0x55f9ef;};'use strict';var _=require(_0xacc1('0x0'));var util=require('util');var moment=require(_0xacc1('0x1'));var BPromise=require(_0xacc1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xacc1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xacc1('0x4'));var logger=require(_0xacc1('0x5'))(_0xacc1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xacc1('0x7')]['http']({'port':0x232a});config[_0xacc1('0x8')]=_[_0xacc1('0x9')](config['redis'],{'host':_0xacc1('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xacc1('0x8')]));require(_0xacc1('0xb'))['register'](socket);function respondWithRpcPromise(_0x18a3ce,_0x457ca8,_0x30c27b){return new BPromise(function(_0x4d74e1,_0x231a4f){return client[_0xacc1('0xc')](_0x18a3ce,_0x30c27b)['then'](function(_0x2623a6){logger['info']('Dashboard,\x20%s,\x20%s',_0x457ca8,_0xacc1('0xd'));logger[_0xacc1('0xe')](_0xacc1('0xf'),_0x457ca8,_0xacc1('0xd'),JSON[_0xacc1('0x10')](_0x2623a6));if(_0x2623a6[_0xacc1('0x11')]){if(_0x2623a6[_0xacc1('0x11')][_0xacc1('0x12')]===0x1f4){logger['error'](_0xacc1('0x13'),_0x457ca8,_0x2623a6[_0xacc1('0x11')][_0xacc1('0x14')]);return _0x231a4f(_0x2623a6['error'][_0xacc1('0x14')]);}logger[_0xacc1('0x11')](_0xacc1('0x13'),_0x457ca8,_0x2623a6[_0xacc1('0x11')]['message']);return _0x4d74e1(_0x2623a6[_0xacc1('0x11')]['message']);}else{logger[_0xacc1('0x15')]('Dashboard,\x20%s,\x20%s',_0x457ca8,_0xacc1('0xd'));_0x4d74e1(_0x2623a6[_0xacc1('0x16')][_0xacc1('0x14')]);}})[_0xacc1('0x17')](function(_0x1319d4){logger['error'](_0xacc1('0x13'),_0x457ca8,_0x1319d4);_0x231a4f(_0x1319d4);});});} \ No newline at end of file +var _0x7cfc=['jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dashboard,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5d67ca,_0x43c5b8){var _0x1cd1e9=function(_0x15f41b){while(--_0x15f41b){_0x5d67ca['push'](_0x5d67ca['shift']());}};_0x1cd1e9(++_0x43c5b8);}(_0x7cfc,0x81));var _0xc7cf=function(_0x5ef202,_0x3fec14){_0x5ef202=_0x5ef202-0x0;var _0x632e7e=_0x7cfc[_0x5ef202];return _0x632e7e;};'use strict';var _=require(_0xc7cf('0x0'));var util=require(_0xc7cf('0x1'));var moment=require(_0xc7cf('0x2'));var BPromise=require(_0xc7cf('0x3'));var rs=require(_0xc7cf('0x4'));var fs=require('fs');var Redis=require(_0xc7cf('0x5'));var db=require(_0xc7cf('0x6'))['db'];var utils=require(_0xc7cf('0x7'));var logger=require(_0xc7cf('0x8'))(_0xc7cf('0x9'));var config=require(_0xc7cf('0xa'));var jayson=require(_0xc7cf('0xb'));var client=jayson['client'][_0xc7cf('0xc')]({'port':0x232a});config[_0xc7cf('0xd')]=_[_0xc7cf('0xe')](config[_0xc7cf('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc7cf('0xf'))(new Redis(config[_0xc7cf('0xd')]));require('./dashboard.socket')[_0xc7cf('0x10')](socket);function respondWithRpcPromise(_0x320fcb,_0x1f6262,_0x16bb97){return new BPromise(function(_0xe04485,_0x5e2d7b){return client[_0xc7cf('0x11')](_0x320fcb,_0x16bb97)[_0xc7cf('0x12')](function(_0xe9af8){logger[_0xc7cf('0x13')]('Dashboard,\x20%s,\x20%s',_0x1f6262,'request\x20sent');logger['debug'](_0xc7cf('0x14'),_0x1f6262,_0xc7cf('0x15'),JSON[_0xc7cf('0x16')](_0xe9af8));if(_0xe9af8['error']){if(_0xe9af8[_0xc7cf('0x17')][_0xc7cf('0x18')]===0x1f4){logger['error'](_0xc7cf('0x19'),_0x1f6262,_0xe9af8[_0xc7cf('0x17')][_0xc7cf('0x1a')]);return _0x5e2d7b(_0xe9af8['error'][_0xc7cf('0x1a')]);}logger['error'](_0xc7cf('0x19'),_0x1f6262,_0xe9af8[_0xc7cf('0x17')][_0xc7cf('0x1a')]);return _0xe04485(_0xe9af8[_0xc7cf('0x17')]['message']);}else{logger[_0xc7cf('0x13')](_0xc7cf('0x19'),_0x1f6262,_0xc7cf('0x15'));_0xe04485(_0xe9af8['result'][_0xc7cf('0x1a')]);}})[_0xc7cf('0x1b')](function(_0x47070d){logger['error'](_0xc7cf('0x19'),_0x1f6262,_0x47070d);_0x5e2d7b(_0x47070d);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index da6566b..0bf1218 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 _0x8b80=['register','length','dashboard:','./dashboard.events','save','remove','update','emit','removeListener'];(function(_0x589c04,_0x210b55){var _0x2cce22=function(_0x284ece){while(--_0x284ece){_0x589c04['push'](_0x589c04['shift']());}};_0x2cce22(++_0x210b55);}(_0x8b80,0xed));var _0x08b8=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x8b80[_0x28d18d];return _0x470640;};'use strict';var DashboardEvents=require(_0x08b8('0x0'));var events=[_0x08b8('0x1'),_0x08b8('0x2'),_0x08b8('0x3')];function createListener(_0x3f929b,_0x43fcff){return function(_0x22d054){_0x43fcff[_0x08b8('0x4')](_0x3f929b,_0x22d054);};}function removeListener(_0x3932ba,_0x20eaf9){return function(){DashboardEvents[_0x08b8('0x5')](_0x3932ba,_0x20eaf9);};}exports[_0x08b8('0x6')]=function(_0x358547){for(var _0x3a6bcd=0x0,_0x38bbbf=events[_0x08b8('0x7')];_0x3a6bcd<_0x38bbbf;_0x3a6bcd++){var _0x199b0c=events[_0x3a6bcd];var _0x2ea5cf=createListener(_0x08b8('0x8')+_0x199b0c,_0x358547);DashboardEvents['on'](_0x199b0c,_0x2ea5cf);}}; \ No newline at end of file +var _0xe8b9=['update','emit','removeListener','length','dashboard:','./dashboard.events','save','remove'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xe8b9,0x14d));var _0x9e8b=function(_0x3d09c7,_0x3ff87d){_0x3d09c7=_0x3d09c7-0x0;var _0x43db15=_0xe8b9[_0x3d09c7];return _0x43db15;};'use strict';var DashboardEvents=require(_0x9e8b('0x0'));var events=[_0x9e8b('0x1'),_0x9e8b('0x2'),_0x9e8b('0x3')];function createListener(_0xb24aca,_0x39a427){return function(_0x10e0ec){_0x39a427[_0x9e8b('0x4')](_0xb24aca,_0x10e0ec);};}function removeListener(_0x1eee40,_0x9d3121){return function(){DashboardEvents[_0x9e8b('0x5')](_0x1eee40,_0x9d3121);};}exports['register']=function(_0x15ee58){for(var _0x2ff69b=0x0,_0x53f2fa=events[_0x9e8b('0x6')];_0x2ff69b<_0x53f2fa;_0x2ff69b++){var _0x2ab13e=events[_0x2ff69b];var _0x1a44f0=createListener(_0x9e8b('0x7')+_0x2ab13e,_0x15ee58);DashboardEvents['on'](_0x2ab13e,_0x1a44f0);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index ce1c929..2b43b25 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 _0xb1d6=['exports','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','clone','addItem','put','update','delete','destroy'];(function(_0x1c470d,_0x81d66b){var _0x12141b=function(_0x45bfd3){while(--_0x45bfd3){_0x1c470d['push'](_0x1c470d['shift']());}};_0x12141b(++_0x81d66b);}(_0xb1d6,0xdd));var _0x6b1d=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xb1d6[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6b1d('0x0'));var timeout=require('connect-timeout');var express=require(_0x6b1d('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6b1d('0x2'));var interaction=require(_0x6b1d('0x3'));var config=require(_0x6b1d('0x4'));var controller=require('./dashboard.controller');router[_0x6b1d('0x5')]('/',auth[_0x6b1d('0x6')](),controller[_0x6b1d('0x7')]);router[_0x6b1d('0x5')](_0x6b1d('0x8'),auth[_0x6b1d('0x6')](),controller[_0x6b1d('0x9')]);router['get'](_0x6b1d('0xa'),auth[_0x6b1d('0x6')](),controller[_0x6b1d('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6b1d('0xc')]('/:id/clone',auth[_0x6b1d('0x6')](),controller[_0x6b1d('0xd')]);router[_0x6b1d('0xc')](_0x6b1d('0xa'),auth[_0x6b1d('0x6')](),controller[_0x6b1d('0xe')]);router[_0x6b1d('0xf')](_0x6b1d('0x8'),auth[_0x6b1d('0x6')](),controller[_0x6b1d('0x10')]);router[_0x6b1d('0x11')](_0x6b1d('0x8'),auth[_0x6b1d('0x6')](),controller[_0x6b1d('0x12')]);module[_0x6b1d('0x13')]=router; \ No newline at end of file +var _0xf12d=['show','/:id/items','getItems','post','clone','addItem','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index','get','/:id'];(function(_0x34bc94,_0x74f0fd){var _0xee41e7=function(_0x424111){while(--_0x424111){_0x34bc94['push'](_0x34bc94['shift']());}};_0xee41e7(++_0x74f0fd);}(_0xf12d,0xb3));var _0xdf12=function(_0x21d899,_0x3ea853){_0x21d899=_0x21d899-0x0;var _0x4b2cc7=_0xf12d[_0x21d899];return _0x4b2cc7;};'use strict';var multer=require(_0xdf12('0x0'));var util=require(_0xdf12('0x1'));var path=require(_0xdf12('0x2'));var timeout=require('connect-timeout');var express=require(_0xdf12('0x3'));var router=express[_0xdf12('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdf12('0x5'));var interaction=require(_0xdf12('0x6'));var config=require(_0xdf12('0x7'));var controller=require(_0xdf12('0x8'));router['get']('/',auth[_0xdf12('0x9')](),controller[_0xdf12('0xa')]);router[_0xdf12('0xb')](_0xdf12('0xc'),auth[_0xdf12('0x9')](),controller[_0xdf12('0xd')]);router[_0xdf12('0xb')](_0xdf12('0xe'),auth[_0xdf12('0x9')](),controller[_0xdf12('0xf')]);router[_0xdf12('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xdf12('0x10')]('/:id/clone',auth[_0xdf12('0x9')](),controller[_0xdf12('0x11')]);router['post'](_0xdf12('0xe'),auth['isAuthenticated'](),controller[_0xdf12('0x12')]);router[_0xdf12('0x13')](_0xdf12('0xc'),auth[_0xdf12('0x9')](),controller[_0xdf12('0x14')]);router[_0xdf12('0x15')](_0xdf12('0xc'),auth['isAuthenticated'](),controller[_0xdf12('0x16')]);module[_0xdf12('0x17')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 87a64c5..cd6aa40 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 _0xeda8=['TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','#ffffff','sequelize','squel','exports','STRING'];(function(_0xf23b24,_0x55c8f4){var _0x12ed3b=function(_0x99f130){while(--_0x99f130){_0xf23b24['push'](_0xf23b24['shift']());}};_0x12ed3b(++_0x55c8f4);}(_0xeda8,0x104));var _0x8eda=function(_0x3c3e69,_0x361556){_0x3c3e69=_0x3c3e69-0x0;var _0x273e78=_0xeda8[_0x3c3e69];return _0x273e78;};'use strict';var Sequelize=require(_0x8eda('0x0'));var squel=require(_0x8eda('0x1'));var _=require('lodash');module[_0x8eda('0x2')]={'title':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8eda('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x8eda('0x4')](_0x8eda('0x5')),'get':function(){try{return JSON[_0x8eda('0x6')](this[_0x8eda('0x7')](_0x8eda('0x8')));}catch(_0x22dee9){return[];}},'set':function(_0x1f3556){try{this[_0x8eda('0x9')](_0x8eda('0x8'),JSON['stringify'](_0x1f3556));}catch(_0x28b721){this[_0x8eda('0x9')](_0x8eda('0x8'),JSON[_0x8eda('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![],'defaultValue':_0x8eda('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8eda('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xe2fe=['setDataValue','INTEGER','sequelize','exports','STRING','TEXT','long','parse','getDataValue','attrs','stringify'];(function(_0x171300,_0x34fd80){var _0x3afea8=function(_0x3cc02b){while(--_0x3cc02b){_0x171300['push'](_0x171300['shift']());}};_0x3afea8(++_0x34fd80);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xee2f('0x0'));var squel=require('squel');var _=require('lodash');module[_0xee2f('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xee2f('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xee2f('0x3')](_0xee2f('0x4')),'get':function(){try{return JSON[_0xee2f('0x5')](this[_0xee2f('0x6')]('attrs'));}catch(_0x311a2f){return[];}},'set':function(_0x2b7e7c){try{this['setDataValue'](_0xee2f('0x7'),JSON[_0xee2f('0x8')](_0x2b7e7c));}catch(_0x5a7975){this[_0xee2f('0x9')]('attrs',JSON[_0xee2f('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0xee2f('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xee2f('0xa')]},'col':{'type':Sequelize[_0xee2f('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xee2f('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'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 5b58a50..89b7830 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 _0xd99d=['attrs','https://','attrPath','clock','attrHourFormat','attrTimezone','value','attrFontSize','counter','attrMetric','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','defaults','redis','localhost','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','then','destroy','error','stack','name','send','params','model','DashboardItem','keys','query','intersection','fields','attributes','includeAll','include','merge','options','find','catch','attrUrl'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xd99d,0x70));var _0xdd99=function(_0x2b03b9,_0x2e6583){_0x2b03b9=_0x2b03b9-0x0;var _0x31351b=_0xd99d[_0x2b03b9];return _0x31351b;};'use strict';var emlformat=require(_0xdd99('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdd99('0x1'));var jsonpatch=require(_0xdd99('0x2'));var rp=require(_0xdd99('0x3'));var moment=require(_0xdd99('0x4'));var BPromise=require(_0xdd99('0x5'));var Mustache=require(_0xdd99('0x6'));var util=require('util');var path=require(_0xdd99('0x7'));var sox=require(_0xdd99('0x8'));var csv=require(_0xdd99('0x9'));var ejs=require(_0xdd99('0xa'));var fs=require('fs');var fs_extra=require(_0xdd99('0xb'));var _=require(_0xdd99('0xc'));var squel=require(_0xdd99('0xd'));var crypto=require(_0xdd99('0xe'));var jsforce=require(_0xdd99('0xf'));var deskjs=require(_0xdd99('0x10'));var toCsv=require(_0xdd99('0x9'));var querystring=require('querystring');var Papa=require(_0xdd99('0x11'));var Redis=require(_0xdd99('0x12'));var authService=require(_0xdd99('0x13'));var qs=require(_0xdd99('0x14'));var as=require(_0xdd99('0x15'));var hardwareService=require(_0xdd99('0x16'));var logger=require(_0xdd99('0x17'))('api');var utils=require(_0xdd99('0x18'));var config=require(_0xdd99('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xdd99('0x1a')](config[_0xdd99('0x1b')],{'host':_0xdd99('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./dashboardItem.socket')[_0xdd99('0x1d')](socket);function respondWithStatusCode(_0x572f8b,_0x52776e){_0x52776e=_0x52776e||0xcc;return function(_0xc7c333){if(_0xc7c333){return _0x572f8b[_0xdd99('0x1e')](_0x52776e);}return _0x572f8b[_0xdd99('0x1f')](_0x52776e)['end']();};}function respondWithResult(_0x396fdf,_0x2637c){_0x2637c=_0x2637c||0xc8;return function(_0x547ccb){if(_0x547ccb){return _0x396fdf['status'](_0x2637c)[_0xdd99('0x20')](_0x547ccb);}};}function respondWithFilteredResult(_0x50bdd7,_0x400b13){return function(_0x41fa2f){if(_0x41fa2f){var _0x1d178f=typeof _0x400b13['offset']===_0xdd99('0x21')&&typeof _0x400b13[_0xdd99('0x22')]===_0xdd99('0x21');var _0x3c884c=_0x41fa2f[_0xdd99('0x23')];var _0x4dec31=_0x1d178f?0x0:_0x400b13[_0xdd99('0x24')];var _0x3e05a8=_0x1d178f?_0x41fa2f['count']:_0x400b13['offset']+_0x400b13[_0xdd99('0x22')];var _0x51d98f;if(_0x3e05a8>=_0x3c884c){_0x3e05a8=_0x3c884c;_0x51d98f=0xc8;}else{_0x51d98f=0xce;}_0x50bdd7['status'](_0x51d98f);return _0x50bdd7[_0xdd99('0x25')](_0xdd99('0x26'),_0x4dec31+'-'+_0x3e05a8+'/'+_0x3c884c)[_0xdd99('0x20')](_0x41fa2f);}return null;};}function patchUpdates(_0x47d122){return function(_0x300b98){try{jsonpatch['apply'](_0x300b98,_0x47d122,!![]);}catch(_0x210bb4){return BPromise['reject'](_0x210bb4);}return _0x300b98['save']();};}function saveUpdates(_0xa784cf,_0xcc25b6){return function(_0x246f3f){if(_0x246f3f){return _0x246f3f['update'](_0xa784cf)[_0xdd99('0x27')](function(_0x49654a){return _0x49654a;});}return null;};}function removeEntity(_0x48e187,_0x238cd9){return function(_0x1e5f59){if(_0x1e5f59){return _0x1e5f59[_0xdd99('0x28')]()[_0xdd99('0x27')](function(){_0x48e187['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x441ebf,_0x4ac226){return function(_0x277012){if(!_0x277012){_0x441ebf[_0xdd99('0x1e')](0x194);}return _0x277012;};}function handleError(_0x282421,_0x23d72b){_0x23d72b=_0x23d72b||0x1f4;return function(_0x9895f0){logger[_0xdd99('0x29')](_0x9895f0[_0xdd99('0x2a')]);if(_0x9895f0[_0xdd99('0x2b')]){delete _0x9895f0['name'];}_0x282421[_0xdd99('0x1f')](_0x23d72b)[_0xdd99('0x2c')](_0x9895f0);};}exports['show']=function(_0x59b314,_0x3f0290){var _0x2c4f7d={'raw':![],'where':{'id':_0x59b314[_0xdd99('0x2d')]['id']}},_0x2ca78f={};_0x2ca78f[_0xdd99('0x2e')]=_['keys'](db[_0xdd99('0x2f')]['rawAttributes']);_0x2ca78f['query']=_[_0xdd99('0x30')](_0x59b314[_0xdd99('0x31')]);_0x2ca78f['filters']=_[_0xdd99('0x32')](_0x2ca78f['model'],_0x2ca78f[_0xdd99('0x31')]);_0x2c4f7d['attributes']=_[_0xdd99('0x32')](_0x2ca78f['model'],qs[_0xdd99('0x33')](_0x59b314[_0xdd99('0x31')][_0xdd99('0x33')]));_0x2c4f7d['attributes']=_0x2c4f7d[_0xdd99('0x34')]['length']?_0x2c4f7d[_0xdd99('0x34')]:_0x2ca78f[_0xdd99('0x2e')];if(_0x59b314[_0xdd99('0x31')][_0xdd99('0x35')]){_0x2c4f7d[_0xdd99('0x36')]=[{'all':!![]}];}_0x2c4f7d=_[_0xdd99('0x37')]({},_0x2c4f7d,_0x59b314[_0xdd99('0x38')]);return db[_0xdd99('0x2f')][_0xdd99('0x39')](_0x2c4f7d)['then'](handleEntityNotFound(_0x3f0290,null))[_0xdd99('0x27')](respondWithResult(_0x3f0290,null))[_0xdd99('0x3a')](handleError(_0x3f0290,null));};exports[_0xdd99('0x28')]=function(_0x56e041,_0x1a9b48){return db[_0xdd99('0x2f')][_0xdd99('0x39')]({'where':{'id':_0x56e041['params']['id']}})[_0xdd99('0x27')](handleEntityNotFound(_0x1a9b48,null))[_0xdd99('0x27')](removeEntity(_0x1a9b48,null))[_0xdd99('0x3a')](handleError(_0x1a9b48,null));};function widgetAttributes(_0x1a2fb3){try{switch(_0x1a2fb3['type']){case'iframe':return[{'name':'attrUrl','value':_0x1a2fb3[_0xdd99('0x3b')]||(_0x1a2fb3['attrs']&&_0x1a2fb3['attrs'][0x0]?_0x1a2fb3[_0xdd99('0x3c')][0x0]['value']:undefined)||_0xdd99('0x3d')}];case'custom':return[{'name':_0xdd99('0x3e'),'value':_0x1a2fb3[_0xdd99('0x3e')]||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3[_0xdd99('0x3c')][0x0]?_0x1a2fb3[_0xdd99('0x3c')][0x0]['value']:undefined)||''}];case _0xdd99('0x3f'):return[{'name':_0xdd99('0x40'),'value':_0x1a2fb3['attrHourFormat']||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3['attrs'][0x0]?_0x1a2fb3[_0xdd99('0x3c')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xdd99('0x41'),'value':_0x1a2fb3[_0xdd99('0x41')]||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3[_0xdd99('0x3c')][0x1]?_0x1a2fb3['attrs'][0x1][_0xdd99('0x42')]:undefined)||'0.00'},{'name':_0xdd99('0x43'),'value':_0x1a2fb3[_0xdd99('0x43')]||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3[_0xdd99('0x3c')][0x2]?_0x1a2fb3[_0xdd99('0x3c')][0x2]['value']:undefined)||0xc}];case _0xdd99('0x44'):return[{'name':_0xdd99('0x45'),'value':_0x1a2fb3[_0xdd99('0x45')]||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3[_0xdd99('0x3c')][0x0]?_0x1a2fb3[_0xdd99('0x3c')][0x0][_0xdd99('0x42')]:undefined)||'total'},{'name':_0xdd99('0x46'),'value':_0x1a2fb3[_0xdd99('0x46')]||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3[_0xdd99('0x3c')][0x1]?_0x1a2fb3[_0xdd99('0x3c')][0x1][_0xdd99('0x42')]:undefined)||[]},{'name':'attrFontSize','value':_0x1a2fb3['attrFontSize']||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3[_0xdd99('0x3c')][0x2]?_0x1a2fb3[_0xdd99('0x3c')][0x2][_0xdd99('0x42')]:undefined)||0x14}];case _0xdd99('0x47'):case _0xdd99('0x48'):return[{'name':'attrSerie1','value':_0x1a2fb3[_0xdd99('0x49')]||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3[_0xdd99('0x3c')][0x0]?_0x1a2fb3['attrs'][0x0][_0xdd99('0x42')]:undefined)||'total'},{'name':_0xdd99('0x4a'),'value':_0x1a2fb3[_0xdd99('0x4a')]||(_0x1a2fb3['attrs']&&_0x1a2fb3['attrs'][0x1]?_0x1a2fb3[_0xdd99('0x3c')][0x1][_0xdd99('0x42')]:undefined)||null},{'name':_0xdd99('0x4b'),'value':_0x1a2fb3[_0xdd99('0x4b')]||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3[_0xdd99('0x3c')][0x2]?_0x1a2fb3[_0xdd99('0x3c')][0x2]['value']:undefined)||null},{'name':_0xdd99('0x46'),'value':_0x1a2fb3[_0xdd99('0x46')]||(_0x1a2fb3['attrs']&&_0x1a2fb3[_0xdd99('0x3c')][0x3]?_0x1a2fb3['attrs'][0x3]['value']:undefined)||[]}];case _0xdd99('0x4c'):return[{'name':_0xdd99('0x4d'),'type':_0x1a2fb3[_0xdd99('0x4e')]||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3['attrs'][0x0]?_0x1a2fb3[_0xdd99('0x3c')][0x0][_0xdd99('0x4f')]:undefined)||null,'value':_0x1a2fb3[_0xdd99('0x4d')]||(_0x1a2fb3['attrs']&&_0x1a2fb3[_0xdd99('0x3c')][0x0]?_0x1a2fb3['attrs'][0x0]['value']:undefined)||null},{'name':_0xdd99('0x50'),'value':_0x1a2fb3[_0xdd99('0x50')]||(_0x1a2fb3[_0xdd99('0x3c')]&&_0x1a2fb3[_0xdd99('0x3c')][0x1]?_0x1a2fb3['attrs'][0x1][_0xdd99('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x311163){logger[_0xdd99('0x29')](_0xdd99('0x51'),JSON[_0xdd99('0x52')](_0x311163));return[];}}exports[_0xdd99('0x53')]=function(_0x493d91,_0x21eef5){if(_0x493d91['body']){_0x493d91['body'][_0xdd99('0x3c')]=widgetAttributes(_0x493d91[_0xdd99('0x54')]);}return db[_0xdd99('0x2f')]['create'](_0x493d91[_0xdd99('0x54')],{})[_0xdd99('0x27')](respondWithResult(_0x21eef5,0xc9))[_0xdd99('0x3a')](handleError(_0x21eef5,null));};exports[_0xdd99('0x55')]=function(_0x13df5d,_0x536bb7){if(_0x13df5d[_0xdd99('0x54')]['id']){delete _0x13df5d['body']['id'];}_0x13df5d[_0xdd99('0x54')][_0xdd99('0x3c')]=widgetAttributes(_0x13df5d[_0xdd99('0x54')]);return db[_0xdd99('0x2f')]['find']({'where':{'id':_0x13df5d['params']['id']}})[_0xdd99('0x27')](handleEntityNotFound(_0x536bb7,null))[_0xdd99('0x27')](saveUpdates(_0x13df5d['body'],null))[_0xdd99('0x27')](respondWithResult(_0x536bb7,null))['catch'](handleError(_0x536bb7,null));}; \ No newline at end of file +var _0x01b2=['sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','error','stack','name','show','params','model','keys','DashboardItem','rawAttributes','query','intersection','fields','length','attributes','includeAll','include','options','find','catch','type','iframe','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','body','create','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./dashboardItem.socket','register'];(function(_0x5c595f,_0xb2699){var _0x11c0f6=function(_0x4f5cf2){while(--_0x4f5cf2){_0x5c595f['push'](_0x5c595f['shift']());}};_0x11c0f6(++_0xb2699);}(_0x01b2,0xf1));var _0x201b=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0x01b2[_0x29c3b2];return _0x4b3aa7;};'use strict';var emlformat=require(_0x201b('0x0'));var rimraf=require(_0x201b('0x1'));var zipdir=require(_0x201b('0x2'));var jsonpatch=require(_0x201b('0x3'));var rp=require('request-promise');var moment=require(_0x201b('0x4'));var BPromise=require(_0x201b('0x5'));var Mustache=require(_0x201b('0x6'));var util=require(_0x201b('0x7'));var path=require(_0x201b('0x8'));var sox=require(_0x201b('0x9'));var csv=require(_0x201b('0xa'));var ejs=require(_0x201b('0xb'));var fs=require('fs');var fs_extra=require(_0x201b('0xc'));var _=require(_0x201b('0xd'));var squel=require(_0x201b('0xe'));var crypto=require(_0x201b('0xf'));var jsforce=require(_0x201b('0x10'));var deskjs=require(_0x201b('0x11'));var toCsv=require(_0x201b('0xa'));var querystring=require(_0x201b('0x12'));var Papa=require(_0x201b('0x13'));var Redis=require(_0x201b('0x14'));var authService=require(_0x201b('0x15'));var qs=require(_0x201b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x201b('0x17'))('api');var utils=require(_0x201b('0x18'));var config=require(_0x201b('0x19'));var licenseUtil=require(_0x201b('0x1a'));var db=require(_0x201b('0x1b'))['db'];config[_0x201b('0x1c')]=_['defaults'](config[_0x201b('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x201b('0x1d'))(new Redis(config[_0x201b('0x1c')]));require(_0x201b('0x1e'))[_0x201b('0x1f')](socket);function respondWithStatusCode(_0x415a72,_0x52d080){_0x52d080=_0x52d080||0xcc;return function(_0x34c380){if(_0x34c380){return _0x415a72[_0x201b('0x20')](_0x52d080);}return _0x415a72['status'](_0x52d080)[_0x201b('0x21')]();};}function respondWithResult(_0xf11f72,_0x4ef0c9){_0x4ef0c9=_0x4ef0c9||0xc8;return function(_0x32d1c8){if(_0x32d1c8){return _0xf11f72[_0x201b('0x22')](_0x4ef0c9)[_0x201b('0x23')](_0x32d1c8);}};}function respondWithFilteredResult(_0xc92033,_0x3782bd){return function(_0x364363){if(_0x364363){var _0x3572ef=typeof _0x3782bd[_0x201b('0x24')]===_0x201b('0x25')&&typeof _0x3782bd[_0x201b('0x26')]===_0x201b('0x25');var _0x4eef0e=_0x364363[_0x201b('0x27')];var _0x48d04d=_0x3572ef?0x0:_0x3782bd[_0x201b('0x24')];var _0x7e70b3=_0x3572ef?_0x364363[_0x201b('0x27')]:_0x3782bd['offset']+_0x3782bd['limit'];var _0x3917d4;if(_0x7e70b3>=_0x4eef0e){_0x7e70b3=_0x4eef0e;_0x3917d4=0xc8;}else{_0x3917d4=0xce;}_0xc92033['status'](_0x3917d4);return _0xc92033[_0x201b('0x28')](_0x201b('0x29'),_0x48d04d+'-'+_0x7e70b3+'/'+_0x4eef0e)[_0x201b('0x23')](_0x364363);}return null;};}function patchUpdates(_0x9ebb3){return function(_0x14afac){try{jsonpatch[_0x201b('0x2a')](_0x14afac,_0x9ebb3,!![]);}catch(_0x57585c){return BPromise['reject'](_0x57585c);}return _0x14afac['save']();};}function saveUpdates(_0x5f0475,_0x1df9cc){return function(_0x252de7){if(_0x252de7){return _0x252de7['update'](_0x5f0475)[_0x201b('0x2b')](function(_0x3c7ea2){return _0x3c7ea2;});}return null;};}function removeEntity(_0x2c6a53,_0x508500){return function(_0x22350c){if(_0x22350c){return _0x22350c[_0x201b('0x2c')]()[_0x201b('0x2b')](function(){_0x2c6a53[_0x201b('0x22')](0xcc)[_0x201b('0x21')]();});}};}function handleEntityNotFound(_0x3d8596,_0x5e4680){return function(_0x1deb25){if(!_0x1deb25){_0x3d8596[_0x201b('0x20')](0x194);}return _0x1deb25;};}function handleError(_0x2294bc,_0x42f1f3){_0x42f1f3=_0x42f1f3||0x1f4;return function(_0x140e9e){logger[_0x201b('0x2d')](_0x140e9e[_0x201b('0x2e')]);if(_0x140e9e[_0x201b('0x2f')]){delete _0x140e9e[_0x201b('0x2f')];}_0x2294bc[_0x201b('0x22')](_0x42f1f3)['send'](_0x140e9e);};}exports[_0x201b('0x30')]=function(_0x354813,_0x2b68a5){var _0x488682={'raw':![],'where':{'id':_0x354813[_0x201b('0x31')]['id']}},_0x52b8b8={};_0x52b8b8[_0x201b('0x32')]=_[_0x201b('0x33')](db[_0x201b('0x34')][_0x201b('0x35')]);_0x52b8b8[_0x201b('0x36')]=_[_0x201b('0x33')](_0x354813['query']);_0x52b8b8['filters']=_[_0x201b('0x37')](_0x52b8b8['model'],_0x52b8b8[_0x201b('0x36')]);_0x488682['attributes']=_[_0x201b('0x37')](_0x52b8b8[_0x201b('0x32')],qs[_0x201b('0x38')](_0x354813[_0x201b('0x36')][_0x201b('0x38')]));_0x488682['attributes']=_0x488682['attributes'][_0x201b('0x39')]?_0x488682[_0x201b('0x3a')]:_0x52b8b8['model'];if(_0x354813[_0x201b('0x36')][_0x201b('0x3b')]){_0x488682[_0x201b('0x3c')]=[{'all':!![]}];}_0x488682=_['merge']({},_0x488682,_0x354813[_0x201b('0x3d')]);return db[_0x201b('0x34')][_0x201b('0x3e')](_0x488682)[_0x201b('0x2b')](handleEntityNotFound(_0x2b68a5,null))[_0x201b('0x2b')](respondWithResult(_0x2b68a5,null))[_0x201b('0x3f')](handleError(_0x2b68a5,null));};exports['destroy']=function(_0x218f7d,_0x50cba0){return db[_0x201b('0x34')]['find']({'where':{'id':_0x218f7d['params']['id']}})['then'](handleEntityNotFound(_0x50cba0,null))[_0x201b('0x2b')](removeEntity(_0x50cba0,null))[_0x201b('0x3f')](handleError(_0x50cba0,null));};function widgetAttributes(_0xa8a8d5){try{switch(_0xa8a8d5[_0x201b('0x40')]){case _0x201b('0x41'):return[{'name':_0x201b('0x42'),'value':_0xa8a8d5[_0x201b('0x42')]||(_0xa8a8d5[_0x201b('0x43')]&&_0xa8a8d5['attrs'][0x0]?_0xa8a8d5[_0x201b('0x43')][0x0]['value']:undefined)||_0x201b('0x44')}];case'custom':return[{'name':_0x201b('0x45'),'value':_0xa8a8d5['attrPath']||(_0xa8a8d5['attrs']&&_0xa8a8d5['attrs'][0x0]?_0xa8a8d5[_0x201b('0x43')][0x0][_0x201b('0x46')]:undefined)||''}];case _0x201b('0x47'):return[{'name':'attrHourFormat','value':_0xa8a8d5[_0x201b('0x48')]||(_0xa8a8d5[_0x201b('0x43')]&&_0xa8a8d5[_0x201b('0x43')][0x0]?_0xa8a8d5[_0x201b('0x43')][0x0][_0x201b('0x46')]:undefined)||_0x201b('0x49')},{'name':'attrTimezone','value':_0xa8a8d5[_0x201b('0x4a')]||(_0xa8a8d5[_0x201b('0x43')]&&_0xa8a8d5['attrs'][0x1]?_0xa8a8d5[_0x201b('0x43')][0x1][_0x201b('0x46')]:undefined)||_0x201b('0x4b')},{'name':_0x201b('0x4c'),'value':_0xa8a8d5[_0x201b('0x4c')]||(_0xa8a8d5[_0x201b('0x43')]&&_0xa8a8d5['attrs'][0x2]?_0xa8a8d5[_0x201b('0x43')][0x2][_0x201b('0x46')]:undefined)||0xc}];case _0x201b('0x4d'):return[{'name':'attrMetric','value':_0xa8a8d5[_0x201b('0x4e')]||(_0xa8a8d5[_0x201b('0x43')]&&_0xa8a8d5[_0x201b('0x43')][0x0]?_0xa8a8d5['attrs'][0x0][_0x201b('0x46')]:undefined)||'total'},{'name':_0x201b('0x4f'),'value':_0xa8a8d5[_0x201b('0x4f')]||(_0xa8a8d5[_0x201b('0x43')]&&_0xa8a8d5[_0x201b('0x43')][0x1]?_0xa8a8d5[_0x201b('0x43')][0x1][_0x201b('0x46')]:undefined)||[]},{'name':_0x201b('0x4c'),'value':_0xa8a8d5[_0x201b('0x4c')]||(_0xa8a8d5['attrs']&&_0xa8a8d5['attrs'][0x2]?_0xa8a8d5[_0x201b('0x43')][0x2]['value']:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0x201b('0x50'),'value':_0xa8a8d5[_0x201b('0x50')]||(_0xa8a8d5[_0x201b('0x43')]&&_0xa8a8d5[_0x201b('0x43')][0x0]?_0xa8a8d5[_0x201b('0x43')][0x0]['value']:undefined)||_0x201b('0x51')},{'name':'attrSerie2','value':_0xa8a8d5[_0x201b('0x52')]||(_0xa8a8d5[_0x201b('0x43')]&&_0xa8a8d5['attrs'][0x1]?_0xa8a8d5[_0x201b('0x43')][0x1][_0x201b('0x46')]:undefined)||null},{'name':_0x201b('0x53'),'value':_0xa8a8d5[_0x201b('0x53')]||(_0xa8a8d5[_0x201b('0x43')]&&_0xa8a8d5[_0x201b('0x43')][0x2]?_0xa8a8d5['attrs'][0x2][_0x201b('0x46')]:undefined)||null},{'name':_0x201b('0x4f'),'value':_0xa8a8d5[_0x201b('0x4f')]||(_0xa8a8d5['attrs']&&_0xa8a8d5[_0x201b('0x43')][0x3]?_0xa8a8d5[_0x201b('0x43')][0x3][_0x201b('0x46')]:undefined)||[]}];case _0x201b('0x54'):return[{'name':_0x201b('0x55'),'type':_0xa8a8d5[_0x201b('0x56')]||(_0xa8a8d5[_0x201b('0x43')]&&_0xa8a8d5[_0x201b('0x43')][0x0]?_0xa8a8d5[_0x201b('0x43')][0x0]['type']:undefined)||null,'value':_0xa8a8d5[_0x201b('0x55')]||(_0xa8a8d5[_0x201b('0x43')]&&_0xa8a8d5[_0x201b('0x43')][0x0]?_0xa8a8d5[_0x201b('0x43')][0x0][_0x201b('0x46')]:undefined)||null},{'name':'attrRefresh','value':_0xa8a8d5[_0x201b('0x57')]||(_0xa8a8d5[_0x201b('0x43')]&&_0xa8a8d5[_0x201b('0x43')][0x1]?_0xa8a8d5['attrs'][0x1][_0x201b('0x46')]:undefined)||0x0}];default:return[];}}catch(_0x2b6f2a){logger[_0x201b('0x2d')](_0x201b('0x58'),JSON['stringify'](_0x2b6f2a));return[];}}exports['create']=function(_0x2fc59b,_0x1e05a8){if(_0x2fc59b[_0x201b('0x59')]){_0x2fc59b[_0x201b('0x59')][_0x201b('0x43')]=widgetAttributes(_0x2fc59b[_0x201b('0x59')]);}return db[_0x201b('0x34')][_0x201b('0x5a')](_0x2fc59b[_0x201b('0x59')],{})[_0x201b('0x2b')](respondWithResult(_0x1e05a8,0xc9))['catch'](handleError(_0x1e05a8,null));};exports['update']=function(_0x5cd286,_0x45cde4){if(_0x5cd286[_0x201b('0x59')]['id']){delete _0x5cd286[_0x201b('0x59')]['id'];}_0x5cd286[_0x201b('0x59')]['attrs']=widgetAttributes(_0x5cd286['body']);return db[_0x201b('0x34')][_0x201b('0x3e')]({'where':{'id':_0x5cd286['params']['id']}})[_0x201b('0x2b')](handleEntityNotFound(_0x45cde4,null))[_0x201b('0x2b')](saveUpdates(_0x5cd286[_0x201b('0x59')],null))[_0x201b('0x2b')](respondWithResult(_0x45cde4,null))[_0x201b('0x3f')](handleError(_0x45cde4,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index d04abf6..629db59 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 _0xa606=['events','../../mysqldb','DashboardItem','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0xa606,0x198));var _0x6a60=function(_0x59be19,_0x1e253e){_0x59be19=_0x59be19-0x0;var _0x3daa51=_0xa606[_0x59be19];return _0x3daa51;};'use strict';var EventEmitter=require(_0x6a60('0x0'));var DashboardItem=require(_0x6a60('0x1'))['db'][_0x6a60('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x6a60('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x6a60('0x4')};function emitEvent(_0x9b42bc){return function(_0x47c96b,_0x40c7f1,_0x14246b){DashboardItemEvents[_0x6a60('0x5')](_0x9b42bc+':'+_0x47c96b['id'],_0x47c96b);DashboardItemEvents['emit'](_0x9b42bc,_0x47c96b);_0x14246b(null);};}for(var e in events){if(events[_0x6a60('0x6')](e)){var event=events[e];DashboardItem[_0x6a60('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x371f=['hasOwnProperty','events','../../mysqldb','setMaxListeners','save','emit'];(function(_0x491661,_0x435d38){var _0x3765eb=function(_0x3d30f7){while(--_0x3d30f7){_0x491661['push'](_0x491661['shift']());}};_0x3765eb(++_0x435d38);}(_0x371f,0x169));var _0xf371=function(_0x1a6fe2,_0x2c59e3){_0x1a6fe2=_0x1a6fe2-0x0;var _0x8e802c=_0x371f[_0x1a6fe2];return _0x8e802c;};'use strict';var EventEmitter=require(_0xf371('0x0'));var DashboardItem=require(_0xf371('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xf371('0x2')](0x0);var events={'afterCreate':_0xf371('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2523f7){return function(_0x210cb4,_0x575bd9,_0x4c94c8){DashboardItemEvents[_0xf371('0x4')](_0x2523f7+':'+_0x210cb4['id'],_0x210cb4);DashboardItemEvents['emit'](_0x2523f7,_0x210cb4);_0x4c94c8(null);};}for(var e in events){if(events[_0xf371('0x5')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 222d21f..987b63b 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 _0x8e0e=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','DashboardItem','dashboard_items'];(function(_0x3901fa,_0x43d1e3){var _0x1c6c80=function(_0x1f1a44){while(--_0x1f1a44){_0x3901fa['push'](_0x3901fa['shift']());}};_0x1c6c80(++_0x43d1e3);}(_0x8e0e,0x176));var _0xe8e0=function(_0x4c7dc7,_0x1f0e2f){_0x4c7dc7=_0x4c7dc7-0x0;var _0xddef07=_0x8e0e[_0x4c7dc7];return _0xddef07;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe8e0('0x0'))('api');var moment=require(_0xe8e0('0x1'));var BPromise=require(_0xe8e0('0x2'));var rp=require(_0xe8e0('0x3'));var fs=require('fs');var path=require(_0xe8e0('0x4'));var rimraf=require(_0xe8e0('0x5'));var config=require(_0xe8e0('0x6'));var attributes=require('./dashboardItem.attributes');module[_0xe8e0('0x7')]=function(_0x71adc6,_0x5cb6ea){return _0x71adc6[_0xe8e0('0x8')](_0xe8e0('0x9'),attributes,{'tableName':_0xe8e0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x43b8=['../../config/environment','./dashboardItem.attributes','exports','define','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43b8,0x13c));var _0x843b=function(_0x382ff2,_0x45ac63){_0x382ff2=_0x382ff2-0x0;var _0x40f8d8=_0x43b8[_0x382ff2];return _0x40f8d8;};'use strict';var _=require(_0x843b('0x0'));var util=require(_0x843b('0x1'));var logger=require('../../config/logger')(_0x843b('0x2'));var moment=require(_0x843b('0x3'));var BPromise=require(_0x843b('0x4'));var rp=require(_0x843b('0x5'));var fs=require('fs');var path=require(_0x843b('0x6'));var rimraf=require(_0x843b('0x7'));var config=require(_0x843b('0x8'));var attributes=require(_0x843b('0x9'));module[_0x843b('0xa')]=function(_0x2be776,_0x3c65e4){return _0x2be776[_0x843b('0xb')]('DashboardItem',attributes,{'tableName':'dashboard_items','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 5a1d6c7..606ed5a 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 _0x2de4=['rpc','../../config/environment','redis','localhost','./dashboardItem.socket','register','request','info','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2b36bc,_0x382e97){var _0x4aafcd=function(_0x27c96b){while(--_0x27c96b){_0x2b36bc['push'](_0x2b36bc['shift']());}};_0x4aafcd(++_0x382e97);}(_0x2de4,0xd2));var _0x42de=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2de4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x42de('0x0'));var util=require('util');var moment=require(_0x42de('0x1'));var BPromise=require('bluebird');var rs=require(_0x42de('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x42de('0x3'))['db'];var utils=require(_0x42de('0x4'));var logger=require(_0x42de('0x5'))(_0x42de('0x6'));var config=require(_0x42de('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x42de('0x8')],{'host':_0x42de('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42de('0x8')]));require(_0x42de('0xa'))[_0x42de('0xb')](socket);function respondWithRpcPromise(_0x1f9e0c,_0x543778,_0x49eb31){return new BPromise(function(_0x1ac950,_0x432e08){return client[_0x42de('0xc')](_0x1f9e0c,_0x49eb31)['then'](function(_0x5d1f6b){logger[_0x42de('0xd')]('DashboardItem,\x20%s,\x20%s',_0x543778,'request\x20sent');logger[_0x42de('0xe')](_0x42de('0xf'),_0x543778,_0x42de('0x10'),JSON[_0x42de('0x11')](_0x5d1f6b));if(_0x5d1f6b['error']){if(_0x5d1f6b['error'][_0x42de('0x12')]===0x1f4){logger[_0x42de('0x13')](_0x42de('0x14'),_0x543778,_0x5d1f6b[_0x42de('0x13')][_0x42de('0x15')]);return _0x432e08(_0x5d1f6b[_0x42de('0x13')]['message']);}logger[_0x42de('0x13')](_0x42de('0x14'),_0x543778,_0x5d1f6b['error'][_0x42de('0x15')]);return _0x1ac950(_0x5d1f6b[_0x42de('0x13')][_0x42de('0x15')]);}else{logger['info']('DashboardItem,\x20%s,\x20%s',_0x543778,'request\x20sent');_0x1ac950(_0x5d1f6b[_0x42de('0x16')][_0x42de('0x15')]);}})[_0x42de('0x17')](function(_0x525156){logger['error'](_0x42de('0x14'),_0x543778,_0x525156);_0x432e08(_0x525156);});});} \ No newline at end of file +var _0x9f1c=['code','error','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s'];(function(_0xb66f92,_0x301f99){var _0x344d2d=function(_0x34378c){while(--_0x34378c){_0xb66f92['push'](_0xb66f92['shift']());}};_0x344d2d(++_0x301f99);}(_0x9f1c,0x1af));var _0xc9f1=function(_0x6495f2,_0x155e4b){_0x6495f2=_0x6495f2-0x0;var _0x5045d0=_0x9f1c[_0x6495f2];return _0x5045d0;};'use strict';var _=require(_0xc9f1('0x0'));var util=require(_0xc9f1('0x1'));var moment=require('moment');var BPromise=require(_0xc9f1('0x2'));var rs=require(_0xc9f1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9f1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc9f1('0x5'))(_0xc9f1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc9f1('0x7')][_0xc9f1('0x8')]({'port':0x232a});config[_0xc9f1('0x9')]=_['defaults'](config[_0xc9f1('0x9')],{'host':_0xc9f1('0xa'),'port':0x18eb});var socket=require(_0xc9f1('0xb'))(new Redis(config[_0xc9f1('0x9')]));require(_0xc9f1('0xc'))[_0xc9f1('0xd')](socket);function respondWithRpcPromise(_0x3da78a,_0x2a0685,_0x30b03f){return new BPromise(function(_0x2fd0e7,_0x5bc230){return client[_0xc9f1('0xe')](_0x3da78a,_0x30b03f)[_0xc9f1('0xf')](function(_0x25f03a){logger[_0xc9f1('0x10')]('DashboardItem,\x20%s,\x20%s',_0x2a0685,_0xc9f1('0x11'));logger['debug'](_0xc9f1('0x12'),_0x2a0685,_0xc9f1('0x11'),JSON['stringify'](_0x25f03a));if(_0x25f03a['error']){if(_0x25f03a['error'][_0xc9f1('0x13')]===0x1f4){logger[_0xc9f1('0x14')](_0xc9f1('0x15'),_0x2a0685,_0x25f03a[_0xc9f1('0x14')][_0xc9f1('0x16')]);return _0x5bc230(_0x25f03a['error'][_0xc9f1('0x16')]);}logger[_0xc9f1('0x14')](_0xc9f1('0x15'),_0x2a0685,_0x25f03a['error'][_0xc9f1('0x16')]);return _0x2fd0e7(_0x25f03a[_0xc9f1('0x14')]['message']);}else{logger['info'](_0xc9f1('0x15'),_0x2a0685,_0xc9f1('0x11'));_0x2fd0e7(_0x25f03a[_0xc9f1('0x17')][_0xc9f1('0x16')]);}})[_0xc9f1('0x18')](function(_0x2c87d0){logger[_0xc9f1('0x14')](_0xc9f1('0x15'),_0x2a0685,_0x2c87d0);_0x5bc230(_0x2c87d0);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 061ddfb..8a3d850 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 _0x79b0=['register','./dashboardItem.events','emit','removeListener'];(function(_0x4e8369,_0x16e483){var _0x512f31=function(_0x397085){while(--_0x397085){_0x4e8369['push'](_0x4e8369['shift']());}};_0x512f31(++_0x16e483);}(_0x79b0,0x1c9));var _0x079b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x79b0[_0x1facfa];return _0x9ec701;};'use strict';var DashboardItemEvents=require(_0x079b('0x0'));var events=['save','remove','update'];function createListener(_0x1216c8,_0xed4386){return function(_0x594e3f){_0xed4386[_0x079b('0x1')](_0x1216c8,_0x594e3f);};}function removeListener(_0x49ae5f,_0x17ae62){return function(){DashboardItemEvents[_0x079b('0x2')](_0x49ae5f,_0x17ae62);};}exports[_0x079b('0x3')]=function(_0x1ea701){for(var _0x25efaf=0x0,_0x171e11=events['length'];_0x25efaf<_0x171e11;_0x25efaf++){var _0x285c53=events[_0x25efaf];var _0xa0217a=createListener('dashboardItem:'+_0x285c53,_0x1ea701);DashboardItemEvents['on'](_0x285c53,_0xa0217a);}}; \ No newline at end of file +var _0xfe2c=['save','remove','update','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events'];(function(_0x3514bc,_0x2688a8){var _0x12d9a8=function(_0x57b828){while(--_0x57b828){_0x3514bc['push'](_0x3514bc['shift']());}};_0x12d9a8(++_0x2688a8);}(_0xfe2c,0x1e5));var _0xcfe2=function(_0x342c67,_0x205885){_0x342c67=_0x342c67-0x0;var _0x3a5130=_0xfe2c[_0x342c67];return _0x3a5130;};'use strict';var DashboardItemEvents=require(_0xcfe2('0x0'));var events=[_0xcfe2('0x1'),_0xcfe2('0x2'),_0xcfe2('0x3')];function createListener(_0x4b50b8,_0x24427b){return function(_0x94579f){_0x24427b[_0xcfe2('0x4')](_0x4b50b8,_0x94579f);};}function removeListener(_0x5ada8e,_0x23df39){return function(){DashboardItemEvents[_0xcfe2('0x5')](_0x5ada8e,_0x23df39);};}exports[_0xcfe2('0x6')]=function(_0x3d5780){for(var _0x379a40=0x0,_0x815436=events[_0xcfe2('0x7')];_0x379a40<_0x815436;_0x379a40++){var _0x5111e9=events[_0x379a40];var _0x37dd74=createListener(_0xcfe2('0x8')+_0x5111e9,_0x3d5780);DashboardItemEvents['on'](_0x5111e9,_0x37dd74);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 5b6c75c..7bd5f25 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 _0xc28a=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','show','create','isAuthenticated'];(function(_0x1c8fdc,_0x4210b1){var _0x39e241=function(_0x1c1faf){while(--_0x1c1faf){_0x1c8fdc['push'](_0x1c8fdc['shift']());}};_0x39e241(++_0x4210b1);}(_0xc28a,0x17a));var _0xac28=function(_0x29b15c,_0x3ac4f9){_0x29b15c=_0x29b15c-0x0;var _0x2022f7=_0xc28a[_0x29b15c];return _0x2022f7;};'use strict';var multer=require(_0xac28('0x0'));var util=require(_0xac28('0x1'));var path=require(_0xac28('0x2'));var timeout=require(_0xac28('0x3'));var express=require('express');var router=express[_0xac28('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xac28('0x5'));var config=require(_0xac28('0x6'));var controller=require(_0xac28('0x7'));router[_0xac28('0x8')](_0xac28('0x9'),auth['isAuthenticated'](),controller[_0xac28('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xac28('0xb')]);router['put'](_0xac28('0x9'),auth[_0xac28('0xc')](),controller[_0xac28('0xd')]);router[_0xac28('0xe')](_0xac28('0x9'),auth['isAuthenticated'](),controller[_0xac28('0xf')]);module[_0xac28('0x10')]=router; \ No newline at end of file +var _0xf90e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x826bbc,_0x396589){var _0x2edd14=function(_0x4bcc5c){while(--_0x4bcc5c){_0x826bbc['push'](_0x826bbc['shift']());}};_0x2edd14(++_0x396589);}(_0xf90e,0x80));var _0xef90=function(_0x5bb86f,_0x29797b){_0x5bb86f=_0x5bb86f-0x0;var _0x59810c=_0xf90e[_0x5bb86f];return _0x59810c;};'use strict';var multer=require(_0xef90('0x0'));var util=require(_0xef90('0x1'));var path=require(_0xef90('0x2'));var timeout=require(_0xef90('0x3'));var express=require('express');var router=express[_0xef90('0x4')]();var fs_extra=require(_0xef90('0x5'));var auth=require(_0xef90('0x6'));var interaction=require(_0xef90('0x7'));var config=require(_0xef90('0x8'));var controller=require(_0xef90('0x9'));router[_0xef90('0xa')](_0xef90('0xb'),auth[_0xef90('0xc')](),controller[_0xef90('0xd')]);router[_0xef90('0xe')]('/',auth['isAuthenticated'](),controller[_0xef90('0xf')]);router[_0xef90('0x10')](_0xef90('0xb'),auth[_0xef90('0xc')](),controller['update']);router[_0xef90('0x11')](_0xef90('0xb'),auth[_0xef90('0xc')](),controller['destroy']);module[_0xef90('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 275866b..b1a6da8 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 _0x9b25=['second','third','sequelize','STRING','ENUM','first'];(function(_0x390dad,_0x3a3e5a){var _0x490148=function(_0x4a2c87){while(--_0x4a2c87){_0x390dad['push'](_0x390dad['shift']());}};_0x490148(++_0x3a3e5a);}(_0x9b25,0x74));var _0x59b2=function(_0x58ea81,_0x8b5067){_0x58ea81=_0x58ea81-0x0;var _0x2c467c=_0x9b25[_0x58ea81];return _0x2c467c;};'use strict';var Sequelize=require(_0x59b2('0x0'));module['exports']={'name':{'type':Sequelize[_0x59b2('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0x59b2('0x2')](_0x59b2('0x3'),_0x59b2('0x4'),_0x59b2('0x5')),'allowNull':![],'defaultValue':_0x59b2('0x3')},'description':{'type':Sequelize[_0x59b2('0x1')]}}; \ No newline at end of file +var _0x275e=['exports','STRING','ENUM','first','third','sequelize'];(function(_0x38c951,_0x4b6256){var _0x49a896=function(_0x5477cc){while(--_0x5477cc){_0x38c951['push'](_0x38c951['shift']());}};_0x49a896(++_0x4b6256);}(_0x275e,0x1f1));var _0xe275=function(_0x2018b3,_0x326e23){_0x2018b3=_0x2018b3-0x0;var _0x55c0a5=_0x275e[_0x2018b3];return _0x55c0a5;};'use strict';var Sequelize=require(_0xe275('0x0'));module[_0xe275('0x1')]={'name':{'type':Sequelize[_0xe275('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xe275('0x3')](_0xe275('0x4'),'second',_0xe275('0x5')),'allowNull':![],'defaultValue':_0xe275('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 45278d5..ad7ffc8 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 _0xcafb=['Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','get','Dispositions','destroy','end','sendStatus','error','stack','name','send','index','map'];(function(_0x2fe5b9,_0x127e48){var _0x6f874=function(_0x23f8e7){while(--_0x23f8e7){_0x2fe5b9['push'](_0x2fe5b9['shift']());}};_0x6f874(++_0x127e48);}(_0xcafb,0x188));var _0xbcaf=function(_0x1501ee,_0x1627f4){_0x1501ee=_0x1501ee-0x0;var _0x4fe224=_0xcafb[_0x1501ee];return _0x4fe224;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbcaf('0x0'));var zipdir=require(_0xbcaf('0x1'));var jsonpatch=require(_0xbcaf('0x2'));var rp=require(_0xbcaf('0x3'));var moment=require(_0xbcaf('0x4'));var BPromise=require(_0xbcaf('0x5'));var Mustache=require(_0xbcaf('0x6'));var util=require('util');var path=require(_0xbcaf('0x7'));var sox=require(_0xbcaf('0x8'));var csv=require(_0xbcaf('0x9'));var ejs=require(_0xbcaf('0xa'));var fs=require('fs');var fs_extra=require(_0xbcaf('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbcaf('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbcaf('0xd'));var toCsv=require(_0xbcaf('0x9'));var querystring=require(_0xbcaf('0xe'));var Papa=require(_0xbcaf('0xf'));var Redis=require(_0xbcaf('0x10'));var authService=require(_0xbcaf('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbcaf('0x12'));var hardwareService=require(_0xbcaf('0x13'));var logger=require(_0xbcaf('0x14'))('api');var utils=require(_0xbcaf('0x15'));var config=require(_0xbcaf('0x16'));var licenseUtil=require(_0xbcaf('0x17'));var db=require(_0xbcaf('0x18'))['db'];function respondWithStatusCode(_0x15db82,_0x5be89f){_0x5be89f=_0x5be89f||0xcc;return function(_0x21ad45){if(_0x21ad45){return _0x15db82['sendStatus'](_0x5be89f);}return _0x15db82[_0xbcaf('0x19')](_0x5be89f)['end']();};}function respondWithResult(_0x5291e0,_0xd42af6){_0xd42af6=_0xd42af6||0xc8;return function(_0x3f10f4){if(_0x3f10f4){return _0x5291e0[_0xbcaf('0x19')](_0xd42af6)['json'](_0x3f10f4);}};}function respondWithFilteredResult(_0x593d9d,_0x41dfde){return function(_0x4507d9){if(_0x4507d9){var _0x4e4a65=typeof _0x41dfde[_0xbcaf('0x1a')]==='undefined'&&typeof _0x41dfde['limit']===_0xbcaf('0x1b');var _0x2c5efc=_0x4507d9[_0xbcaf('0x1c')];var _0x1f7862=_0x4e4a65?0x0:_0x41dfde[_0xbcaf('0x1a')];var _0x5d6e09=_0x4e4a65?_0x4507d9[_0xbcaf('0x1c')]:_0x41dfde['offset']+_0x41dfde[_0xbcaf('0x1d')];var _0x5b026a;if(_0x5d6e09>=_0x2c5efc){_0x5d6e09=_0x2c5efc;_0x5b026a=0xc8;}else{_0x5b026a=0xce;}_0x593d9d['status'](_0x5b026a);return _0x593d9d[_0xbcaf('0x1e')](_0xbcaf('0x1f'),_0x1f7862+'-'+_0x5d6e09+'/'+_0x2c5efc)[_0xbcaf('0x20')](_0x4507d9);}return null;};}function patchUpdates(_0x3772b3){return function(_0x5d93c0){try{jsonpatch[_0xbcaf('0x21')](_0x5d93c0,_0x3772b3,!![]);}catch(_0x3ce683){return BPromise[_0xbcaf('0x22')](_0x3ce683);}return _0x5d93c0['save']();};}function saveUpdates(_0x1f97ac,_0x19ce71){return function(_0x45714a){if(_0x45714a){return _0x45714a[_0xbcaf('0x23')](_0x1f97ac)[_0xbcaf('0x24')](function(_0x23574f){return _0x23574f;});}return null;};}function removeEntity(_0x32ad8a,_0x1306d1){return function(_0x44b462){if(_0x44b462){return _0x44b462['destroy']()['then'](function(){var _0x41f397=_0x44b462[_0xbcaf('0x25')]({'plain':!![]});var _0xe0c35f=_0xbcaf('0x26');return db['UserProfileResource'][_0xbcaf('0x27')]({'where':{'type':_0xe0c35f,'resourceId':_0x41f397['id']}})[_0xbcaf('0x24')](function(){return _0x44b462;});})[_0xbcaf('0x24')](function(){_0x32ad8a[_0xbcaf('0x19')](0xcc)[_0xbcaf('0x28')]();});}};}function handleEntityNotFound(_0x5b5980,_0x5652ba){return function(_0x44f856){if(!_0x44f856){_0x5b5980[_0xbcaf('0x29')](0x194);}return _0x44f856;};}function handleError(_0x1a8db4,_0x37b6fe){_0x37b6fe=_0x37b6fe||0x1f4;return function(_0xefc6f5){logger[_0xbcaf('0x2a')](_0xefc6f5[_0xbcaf('0x2b')]);if(_0xefc6f5[_0xbcaf('0x2c')]){delete _0xefc6f5[_0xbcaf('0x2c')];}_0x1a8db4[_0xbcaf('0x19')](_0x37b6fe)[_0xbcaf('0x2d')](_0xefc6f5);};}exports[_0xbcaf('0x2e')]=function(_0x5dc2c3,_0x73631f){var _0x292236={},_0xddfd02={},_0x3041d8={'count':0x0,'rows':[]};var _0x1b0dd6=_[_0xbcaf('0x2f')](db[_0xbcaf('0x30')][_0xbcaf('0x31')],function(_0x6b45c4){return{'name':_0x6b45c4[_0xbcaf('0x32')],'type':_0x6b45c4[_0xbcaf('0x33')][_0xbcaf('0x34')]};});_0xddfd02[_0xbcaf('0x35')]=_[_0xbcaf('0x2f')](_0x1b0dd6,_0xbcaf('0x2c'));_0xddfd02[_0xbcaf('0x36')]=_[_0xbcaf('0x37')](_0x5dc2c3[_0xbcaf('0x36')]);_0xddfd02[_0xbcaf('0x38')]=_[_0xbcaf('0x39')](_0xddfd02['model'],_0xddfd02[_0xbcaf('0x36')]);_0x292236['attributes']=_['intersection'](_0xddfd02[_0xbcaf('0x35')],qs[_0xbcaf('0x3a')](_0x5dc2c3[_0xbcaf('0x36')][_0xbcaf('0x3a')]));_0x292236[_0xbcaf('0x3b')]=_0x292236[_0xbcaf('0x3b')][_0xbcaf('0x3c')]?_0x292236[_0xbcaf('0x3b')]:_0xddfd02[_0xbcaf('0x35')];if(!_0x5dc2c3[_0xbcaf('0x36')][_0xbcaf('0x3d')](_0xbcaf('0x3e'))){_0x292236['limit']=qs[_0xbcaf('0x1d')](_0x5dc2c3[_0xbcaf('0x36')][_0xbcaf('0x1d')]);_0x292236['offset']=qs['offset'](_0x5dc2c3[_0xbcaf('0x36')][_0xbcaf('0x1a')]);}_0x292236[_0xbcaf('0x3f')]=qs[_0xbcaf('0x40')](_0x5dc2c3[_0xbcaf('0x36')]['sort']);_0x292236[_0xbcaf('0x41')]=qs['filters'](_[_0xbcaf('0x42')](_0x5dc2c3['query'],_0xddfd02[_0xbcaf('0x38')]),_0x1b0dd6);if(_0x5dc2c3[_0xbcaf('0x36')][_0xbcaf('0x43')]){_0x292236[_0xbcaf('0x41')]=_[_0xbcaf('0x44')](_0x292236[_0xbcaf('0x41')],{'$or':_[_0xbcaf('0x2f')](_0x1b0dd6,function(_0x52087b){if(_0x52087b[_0xbcaf('0x33')]!==_0xbcaf('0x45')){var _0x255fde={};_0x255fde[_0x52087b['name']]={'$like':'%'+_0x5dc2c3[_0xbcaf('0x36')][_0xbcaf('0x43')]+'%'};return _0x255fde;}})});}_0x292236=_[_0xbcaf('0x44')]({},_0x292236,_0x5dc2c3[_0xbcaf('0x46')]);var _0x3aea16={'where':_0x292236[_0xbcaf('0x41')]};return db[_0xbcaf('0x30')]['count'](_0x3aea16)['then'](function(_0x94deb9){_0x3041d8[_0xbcaf('0x1c')]=_0x94deb9;if(_0x5dc2c3['query'][_0xbcaf('0x47')]){_0x292236[_0xbcaf('0x48')]=[{'all':!![]}];}return db[_0xbcaf('0x30')][_0xbcaf('0x49')](_0x292236);})['then'](function(_0x28f144){_0x3041d8[_0xbcaf('0x4a')]=_0x28f144;return _0x3041d8;})[_0xbcaf('0x24')](respondWithFilteredResult(_0x73631f,_0x292236))[_0xbcaf('0x4b')](handleError(_0x73631f,null));};exports[_0xbcaf('0x4c')]=function(_0x29ac9c,_0x4a8798){var _0x41efa8={'raw':!![],'where':{'id':_0x29ac9c[_0xbcaf('0x4d')]['id']}},_0x5bc15f={};_0x5bc15f[_0xbcaf('0x35')]=_[_0xbcaf('0x37')](db[_0xbcaf('0x30')]['rawAttributes']);_0x5bc15f[_0xbcaf('0x36')]=_[_0xbcaf('0x37')](_0x29ac9c[_0xbcaf('0x36')]);_0x5bc15f['filters']=_[_0xbcaf('0x39')](_0x5bc15f[_0xbcaf('0x35')],_0x5bc15f[_0xbcaf('0x36')]);_0x41efa8[_0xbcaf('0x3b')]=_[_0xbcaf('0x39')](_0x5bc15f[_0xbcaf('0x35')],qs[_0xbcaf('0x3a')](_0x29ac9c['query'][_0xbcaf('0x3a')]));_0x41efa8[_0xbcaf('0x3b')]=_0x41efa8[_0xbcaf('0x3b')]['length']?_0x41efa8[_0xbcaf('0x3b')]:_0x5bc15f[_0xbcaf('0x35')];if(_0x29ac9c[_0xbcaf('0x36')][_0xbcaf('0x47')]){_0x41efa8[_0xbcaf('0x48')]=[{'all':!![]}];}_0x41efa8=_['merge']({},_0x41efa8,_0x29ac9c[_0xbcaf('0x46')]);return db[_0xbcaf('0x30')][_0xbcaf('0x4e')](_0x41efa8)['then'](handleEntityNotFound(_0x4a8798,null))[_0xbcaf('0x24')](respondWithResult(_0x4a8798,null))[_0xbcaf('0x4b')](handleError(_0x4a8798,null));};exports['create']=function(_0x35b613,_0x92dca7){return db[_0xbcaf('0x30')][_0xbcaf('0x4f')](_0x35b613['body'],{})['then'](function(_0x16d961){var _0x5e2765=_0x35b613['user']['get']({'plain':!![]});if(!_0x5e2765)throw new Error(_0xbcaf('0x50'));if(_0x5e2765[_0xbcaf('0x51')]===_0xbcaf('0x52')){var _0x4868a8=_0x16d961['get']({'plain':!![]});var _0x3a0370=_0xbcaf('0x26');return db[_0xbcaf('0x53')][_0xbcaf('0x4e')]({'where':{'name':_0x3a0370,'userProfileId':_0x5e2765['userProfileId']},'raw':!![]})['then'](function(_0x3eb41b){if(_0x3eb41b&&_0x3eb41b[_0xbcaf('0x54')]===0x0){return db[_0xbcaf('0x55')][_0xbcaf('0x4f')]({'name':_0x4868a8[_0xbcaf('0x2c')],'resourceId':_0x4868a8['id'],'type':_0x3eb41b[_0xbcaf('0x2c')],'sectionId':_0x3eb41b['id']},{})['then'](function(){return _0x16d961;});}else{return _0x16d961;}})[_0xbcaf('0x4b')](function(_0x48b065){logger['error'](_0xbcaf('0x56'),_0x48b065);throw _0x48b065;});}return _0x16d961;})[_0xbcaf('0x24')](respondWithResult(_0x92dca7,0xc9))['catch'](handleError(_0x92dca7,null));};exports['update']=function(_0xdc4c0a,_0x2cf357){if(_0xdc4c0a[_0xbcaf('0x57')]['id']){delete _0xdc4c0a[_0xbcaf('0x57')]['id'];}return db['Disposition'][_0xbcaf('0x4e')]({'where':{'id':_0xdc4c0a[_0xbcaf('0x4d')]['id']}})[_0xbcaf('0x24')](handleEntityNotFound(_0x2cf357,null))[_0xbcaf('0x24')](saveUpdates(_0xdc4c0a[_0xbcaf('0x57')],null))[_0xbcaf('0x24')](respondWithResult(_0x2cf357,null))['catch'](handleError(_0x2cf357,null));};exports['destroy']=function(_0x22a0e3,_0x2e653b){return db[_0xbcaf('0x30')][_0xbcaf('0x4e')]({'where':{'id':_0x22a0e3['params']['id']}})[_0xbcaf('0x24')](handleEntityNotFound(_0x2e653b,null))[_0xbcaf('0x24')](removeEntity(_0x2e653b,null))[_0xbcaf('0x4b')](handleError(_0x2e653b,null));}; \ No newline at end of file +var _0x5d99=['update','then','destroy','get','UserProfileResource','stack','name','send','map','Disposition','fieldName','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','filter','merge','where','includeAll','include','findAll','catch','show','params','fields','length','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','save'];(function(_0x530455,_0x41da2d){var _0x128a27=function(_0x3152af){while(--_0x3152af){_0x530455['push'](_0x530455['shift']());}};_0x128a27(++_0x41da2d);}(_0x5d99,0x1b7));var _0x95d9=function(_0xca1f0e,_0x2713d5){_0xca1f0e=_0xca1f0e-0x0;var _0x35e4ef=_0x5d99[_0xca1f0e];return _0x35e4ef;};'use strict';var emlformat=require(_0x95d9('0x0'));var rimraf=require(_0x95d9('0x1'));var zipdir=require(_0x95d9('0x2'));var jsonpatch=require(_0x95d9('0x3'));var rp=require(_0x95d9('0x4'));var moment=require(_0x95d9('0x5'));var BPromise=require(_0x95d9('0x6'));var Mustache=require(_0x95d9('0x7'));var util=require(_0x95d9('0x8'));var path=require(_0x95d9('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x95d9('0xa'));var fs=require('fs');var fs_extra=require(_0x95d9('0xb'));var _=require(_0x95d9('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x95d9('0xd'));var deskjs=require(_0x95d9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x95d9('0xf'));var Papa=require(_0x95d9('0x10'));var Redis=require(_0x95d9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x95d9('0x12'));var as=require(_0x95d9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x95d9('0x14'));var utils=require(_0x95d9('0x15'));var config=require(_0x95d9('0x16'));var licenseUtil=require(_0x95d9('0x17'));var db=require(_0x95d9('0x18'))['db'];function respondWithStatusCode(_0x8c1b85,_0xbbdcd4){_0xbbdcd4=_0xbbdcd4||0xcc;return function(_0x1363a0){if(_0x1363a0){return _0x8c1b85['sendStatus'](_0xbbdcd4);}return _0x8c1b85[_0x95d9('0x19')](_0xbbdcd4)[_0x95d9('0x1a')]();};}function respondWithResult(_0x49a3f2,_0x44cf76){_0x44cf76=_0x44cf76||0xc8;return function(_0x3a4283){if(_0x3a4283){return _0x49a3f2[_0x95d9('0x19')](_0x44cf76)[_0x95d9('0x1b')](_0x3a4283);}};}function respondWithFilteredResult(_0x372c24,_0x51e2a1){return function(_0x134a4f){if(_0x134a4f){var _0xed5a6e=typeof _0x51e2a1[_0x95d9('0x1c')]==='undefined'&&typeof _0x51e2a1[_0x95d9('0x1d')]===_0x95d9('0x1e');var _0xf0067a=_0x134a4f[_0x95d9('0x1f')];var _0xb3b52a=_0xed5a6e?0x0:_0x51e2a1[_0x95d9('0x1c')];var _0x1f58b5=_0xed5a6e?_0x134a4f[_0x95d9('0x1f')]:_0x51e2a1['offset']+_0x51e2a1[_0x95d9('0x1d')];var _0x57e1e3;if(_0x1f58b5>=_0xf0067a){_0x1f58b5=_0xf0067a;_0x57e1e3=0xc8;}else{_0x57e1e3=0xce;}_0x372c24[_0x95d9('0x19')](_0x57e1e3);return _0x372c24[_0x95d9('0x20')]('Content-Range',_0xb3b52a+'-'+_0x1f58b5+'/'+_0xf0067a)[_0x95d9('0x1b')](_0x134a4f);}return null;};}function patchUpdates(_0x171791){return function(_0x361db8){try{jsonpatch[_0x95d9('0x21')](_0x361db8,_0x171791,!![]);}catch(_0x248f5d){return BPromise['reject'](_0x248f5d);}return _0x361db8[_0x95d9('0x22')]();};}function saveUpdates(_0x5d562c,_0x2f3b7c){return function(_0x20b81d){if(_0x20b81d){return _0x20b81d[_0x95d9('0x23')](_0x5d562c)[_0x95d9('0x24')](function(_0x45e228){return _0x45e228;});}return null;};}function removeEntity(_0x5f3fcc,_0x102777){return function(_0x282840){if(_0x282840){return _0x282840[_0x95d9('0x25')]()[_0x95d9('0x24')](function(){var _0x5d74e3=_0x282840[_0x95d9('0x26')]({'plain':!![]});var _0x420041='Dispositions';return db[_0x95d9('0x27')][_0x95d9('0x25')]({'where':{'type':_0x420041,'resourceId':_0x5d74e3['id']}})[_0x95d9('0x24')](function(){return _0x282840;});})['then'](function(){_0x5f3fcc[_0x95d9('0x19')](0xcc)[_0x95d9('0x1a')]();});}};}function handleEntityNotFound(_0x5867f1,_0x2c6eb0){return function(_0x5c96ad){if(!_0x5c96ad){_0x5867f1['sendStatus'](0x194);}return _0x5c96ad;};}function handleError(_0x315faf,_0x2bbdb9){_0x2bbdb9=_0x2bbdb9||0x1f4;return function(_0x279acd){logger['error'](_0x279acd[_0x95d9('0x28')]);if(_0x279acd['name']){delete _0x279acd[_0x95d9('0x29')];}_0x315faf[_0x95d9('0x19')](_0x2bbdb9)[_0x95d9('0x2a')](_0x279acd);};}exports['index']=function(_0x7acc8d,_0x464bfb){var _0xe710fb={},_0xa72afa={},_0x38c7d6={'count':0x0,'rows':[]};var _0x5de7ec=_[_0x95d9('0x2b')](db[_0x95d9('0x2c')]['rawAttributes'],function(_0x21f9ee){return{'name':_0x21f9ee[_0x95d9('0x2d')],'type':_0x21f9ee['type'][_0x95d9('0x2e')]};});_0xa72afa[_0x95d9('0x2f')]=_[_0x95d9('0x2b')](_0x5de7ec,_0x95d9('0x29'));_0xa72afa[_0x95d9('0x30')]=_[_0x95d9('0x31')](_0x7acc8d[_0x95d9('0x30')]);_0xa72afa[_0x95d9('0x32')]=_[_0x95d9('0x33')](_0xa72afa[_0x95d9('0x2f')],_0xa72afa[_0x95d9('0x30')]);_0xe710fb[_0x95d9('0x34')]=_['intersection'](_0xa72afa['model'],qs['fields'](_0x7acc8d[_0x95d9('0x30')]['fields']));_0xe710fb[_0x95d9('0x34')]=_0xe710fb[_0x95d9('0x34')]['length']?_0xe710fb['attributes']:_0xa72afa[_0x95d9('0x2f')];if(!_0x7acc8d[_0x95d9('0x30')]['hasOwnProperty'](_0x95d9('0x35'))){_0xe710fb[_0x95d9('0x1d')]=qs[_0x95d9('0x1d')](_0x7acc8d[_0x95d9('0x30')]['limit']);_0xe710fb[_0x95d9('0x1c')]=qs[_0x95d9('0x1c')](_0x7acc8d[_0x95d9('0x30')][_0x95d9('0x1c')]);}_0xe710fb[_0x95d9('0x36')]=qs[_0x95d9('0x37')](_0x7acc8d['query']['sort']);_0xe710fb['where']=qs[_0x95d9('0x32')](_['pick'](_0x7acc8d[_0x95d9('0x30')],_0xa72afa[_0x95d9('0x32')]),_0x5de7ec);if(_0x7acc8d[_0x95d9('0x30')][_0x95d9('0x38')]){_0xe710fb['where']=_[_0x95d9('0x39')](_0xe710fb[_0x95d9('0x3a')],{'$or':_['map'](_0x5de7ec,function(_0x56d9f4){if(_0x56d9f4['type']!=='VIRTUAL'){var _0x24a0ae={};_0x24a0ae[_0x56d9f4[_0x95d9('0x29')]]={'$like':'%'+_0x7acc8d[_0x95d9('0x30')]['filter']+'%'};return _0x24a0ae;}})});}_0xe710fb=_['merge']({},_0xe710fb,_0x7acc8d['options']);var _0x13614c={'where':_0xe710fb[_0x95d9('0x3a')]};return db['Disposition'][_0x95d9('0x1f')](_0x13614c)['then'](function(_0x234af3){_0x38c7d6[_0x95d9('0x1f')]=_0x234af3;if(_0x7acc8d['query'][_0x95d9('0x3b')]){_0xe710fb[_0x95d9('0x3c')]=[{'all':!![]}];}return db[_0x95d9('0x2c')][_0x95d9('0x3d')](_0xe710fb);})[_0x95d9('0x24')](function(_0x55a03b){_0x38c7d6['rows']=_0x55a03b;return _0x38c7d6;})['then'](respondWithFilteredResult(_0x464bfb,_0xe710fb))[_0x95d9('0x3e')](handleError(_0x464bfb,null));};exports[_0x95d9('0x3f')]=function(_0x4526fe,_0x50591c){var _0x481e7e={'raw':!![],'where':{'id':_0x4526fe[_0x95d9('0x40')]['id']}},_0x2fa94d={};_0x2fa94d['model']=_[_0x95d9('0x31')](db[_0x95d9('0x2c')]['rawAttributes']);_0x2fa94d['query']=_[_0x95d9('0x31')](_0x4526fe[_0x95d9('0x30')]);_0x2fa94d['filters']=_[_0x95d9('0x33')](_0x2fa94d['model'],_0x2fa94d[_0x95d9('0x30')]);_0x481e7e[_0x95d9('0x34')]=_[_0x95d9('0x33')](_0x2fa94d[_0x95d9('0x2f')],qs[_0x95d9('0x41')](_0x4526fe[_0x95d9('0x30')][_0x95d9('0x41')]));_0x481e7e[_0x95d9('0x34')]=_0x481e7e[_0x95d9('0x34')][_0x95d9('0x42')]?_0x481e7e[_0x95d9('0x34')]:_0x2fa94d['model'];if(_0x4526fe[_0x95d9('0x30')][_0x95d9('0x3b')]){_0x481e7e[_0x95d9('0x3c')]=[{'all':!![]}];}_0x481e7e=_[_0x95d9('0x39')]({},_0x481e7e,_0x4526fe[_0x95d9('0x43')]);return db['Disposition']['find'](_0x481e7e)[_0x95d9('0x24')](handleEntityNotFound(_0x50591c,null))['then'](respondWithResult(_0x50591c,null))['catch'](handleError(_0x50591c,null));};exports[_0x95d9('0x44')]=function(_0x556809,_0x29a75a){return db[_0x95d9('0x2c')][_0x95d9('0x44')](_0x556809['body'],{})['then'](function(_0x4a7769){var _0x317f10=_0x556809[_0x95d9('0x45')][_0x95d9('0x26')]({'plain':!![]});if(!_0x317f10)throw new Error(_0x95d9('0x46'));if(_0x317f10[_0x95d9('0x47')]===_0x95d9('0x45')){var _0x5dd817=_0x4a7769[_0x95d9('0x26')]({'plain':!![]});var _0x5425b4=_0x95d9('0x48');return db['UserProfileSection']['find']({'where':{'name':_0x5425b4,'userProfileId':_0x317f10[_0x95d9('0x49')]},'raw':!![]})[_0x95d9('0x24')](function(_0x4c0e46){if(_0x4c0e46&&_0x4c0e46[_0x95d9('0x4a')]===0x0){return db['UserProfileResource'][_0x95d9('0x44')]({'name':_0x5dd817['name'],'resourceId':_0x5dd817['id'],'type':_0x4c0e46[_0x95d9('0x29')],'sectionId':_0x4c0e46['id']},{})[_0x95d9('0x24')](function(){return _0x4a7769;});}else{return _0x4a7769;}})['catch'](function(_0x4cd2e8){logger[_0x95d9('0x4b')](_0x95d9('0x4c'),_0x4cd2e8);throw _0x4cd2e8;});}return _0x4a7769;})[_0x95d9('0x24')](respondWithResult(_0x29a75a,0xc9))['catch'](handleError(_0x29a75a,null));};exports['update']=function(_0x495ee3,_0x461ffa){if(_0x495ee3[_0x95d9('0x4d')]['id']){delete _0x495ee3[_0x95d9('0x4d')]['id'];}return db[_0x95d9('0x2c')]['find']({'where':{'id':_0x495ee3['params']['id']}})['then'](handleEntityNotFound(_0x461ffa,null))[_0x95d9('0x24')](saveUpdates(_0x495ee3[_0x95d9('0x4d')],null))[_0x95d9('0x24')](respondWithResult(_0x461ffa,null))['catch'](handleError(_0x461ffa,null));};exports[_0x95d9('0x25')]=function(_0x310e78,_0xb1238e){return db[_0x95d9('0x2c')][_0x95d9('0x4e')]({'where':{'id':_0x310e78[_0x95d9('0x40')]['id']}})[_0x95d9('0x24')](handleEntityNotFound(_0xb1238e,null))[_0x95d9('0x24')](removeEntity(_0xb1238e,null))[_0x95d9('0x3e')](handleError(_0xb1238e,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 68e306c..7ad5c7f 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 _0xc502=['bluebird','request-promise','path','rimraf','exports','define','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','name_openchannel','name_whatsapp','lodash','../../config/logger','api','moment'];(function(_0xb4535f,_0x5d8a20){var _0x398acf=function(_0x125bb8){while(--_0x125bb8){_0xb4535f['push'](_0xb4535f['shift']());}};_0x398acf(++_0x5d8a20);}(_0xc502,0xee));var _0x2c50=function(_0x41e45d,_0x1ee3b0){_0x41e45d=_0x41e45d-0x0;var _0x4d3aac=_0xc502[_0x41e45d];return _0x4d3aac;};'use strict';var _=require(_0x2c50('0x0'));var util=require('util');var logger=require(_0x2c50('0x1'))(_0x2c50('0x2'));var moment=require(_0x2c50('0x3'));var BPromise=require(_0x2c50('0x4'));var rp=require(_0x2c50('0x5'));var fs=require('fs');var path=require(_0x2c50('0x6'));var rimraf=require(_0x2c50('0x7'));var config=require('../../config/environment');var attributes=require('./disposition.attributes');module[_0x2c50('0x8')]=function(_0x2c9e62,_0x570c6e){return _0x2c9e62[_0x2c50('0x9')]('Disposition',attributes,{'tableName':_0x2c50('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2c50('0xb'),'fields':[_0x2c50('0xc'),_0x2c50('0xd')]},{'unique':!![],'name':_0x2c50('0xe'),'fields':[_0x2c50('0xc'),_0x2c50('0xf')]},{'unique':!![],'name':_0x2c50('0x10'),'fields':['name',_0x2c50('0x11')]},{'unique':!![],'name':_0x2c50('0x12'),'fields':[_0x2c50('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x2c50('0x13'),'fields':[_0x2c50('0xc'),'FaxAccountId']},{'unique':!![],'name':_0x2c50('0x14'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0x2c50('0x15'),'fields':[_0x2c50('0xc'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x40da=['Disposition','name','ListId','name_chat','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','define'];(function(_0x1af98d,_0x3c608e){var _0x3553ea=function(_0x5668a4){while(--_0x5668a4){_0x1af98d['push'](_0x1af98d['shift']());}};_0x3553ea(++_0x3c608e);}(_0x40da,0x1ed));var _0xa40d=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x40da[_0x3511d3];return _0x5d6321;};'use strict';var _=require('lodash');var util=require(_0xa40d('0x0'));var logger=require(_0xa40d('0x1'))(_0xa40d('0x2'));var moment=require(_0xa40d('0x3'));var BPromise=require(_0xa40d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa40d('0x5'));var rimraf=require(_0xa40d('0x6'));var config=require(_0xa40d('0x7'));var attributes=require(_0xa40d('0x8'));module[_0xa40d('0x9')]=function(_0x416da7,_0x2b6cef){return _0x416da7[_0xa40d('0xa')](_0xa40d('0xb'),attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xa40d('0xc'),_0xa40d('0xd')]},{'unique':!![],'name':_0xa40d('0xe'),'fields':[_0xa40d('0xc'),'ChatWebsiteId']},{'unique':!![],'name':'name_mail','fields':[_0xa40d('0xc'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0xa40d('0xc'),_0xa40d('0xf')]},{'unique':!![],'name':_0xa40d('0x10'),'fields':[_0xa40d('0xc'),'FaxAccountId']},{'unique':!![],'name':_0xa40d('0x11'),'fields':[_0xa40d('0xc'),_0xa40d('0x12')]},{'unique':!![],'name':_0xa40d('0x13'),'fields':[_0xa40d('0xc'),_0xa40d('0x14')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index e46e804..71bd2a4 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(_0x5e58ea,_0x671fee){var _0x42ba2b=function(_0x151ef1){while(--_0x151ef1){_0x5e58ea['push'](_0x5e58ea['shift']());}};_0x42ba2b(++_0x671fee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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(_0x3d169d,_0x4119b6){var _0x4de97b=function(_0x3ac193){while(--_0x3ac193){_0x3d169d['push'](_0x3d169d['shift']());}};_0x4de97b(++_0x4119b6);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 f69ef79..ed2dc3a 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 _0xd1e8=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./disposition.controller','get','index','/:id','show','post','isAuthenticated','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd1e8,0xed));var _0x8d1e=function(_0x281386,_0x1a98ac){_0x281386=_0x281386-0x0;var _0x43077e=_0xd1e8[_0x281386];return _0x43077e;};'use strict';var multer=require(_0x8d1e('0x0'));var util=require(_0x8d1e('0x1'));var path=require('path');var timeout=require(_0x8d1e('0x2'));var express=require(_0x8d1e('0x3'));var router=express[_0x8d1e('0x4')]();var fs_extra=require(_0x8d1e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8d1e('0x6'));var config=require('../../config/environment');var controller=require(_0x8d1e('0x7'));router[_0x8d1e('0x8')]('/',auth['isAuthenticated'](),controller[_0x8d1e('0x9')]);router['get'](_0x8d1e('0xa'),auth['isAuthenticated'](),controller[_0x8d1e('0xb')]);router[_0x8d1e('0xc')]('/',auth[_0x8d1e('0xd')](),controller['create']);router[_0x8d1e('0xe')](_0x8d1e('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x8d1e('0xf')](_0x8d1e('0xa'),auth[_0x8d1e('0xd')](),controller[_0x8d1e('0x10')]);module[_0x8d1e('0x11')]=router; \ No newline at end of file +var _0xe13a=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x42d2af,_0x3961b5){var _0x1d6d63=function(_0x10833e){while(--_0x10833e){_0x42d2af['push'](_0x42d2af['shift']());}};_0x1d6d63(++_0x3961b5);}(_0xe13a,0xb0));var _0xae13=function(_0xd89a87,_0x191876){_0xd89a87=_0xd89a87-0x0;var _0x432756=_0xe13a[_0xd89a87];return _0x432756;};'use strict';var multer=require(_0xae13('0x0'));var util=require(_0xae13('0x1'));var path=require(_0xae13('0x2'));var timeout=require(_0xae13('0x3'));var express=require(_0xae13('0x4'));var router=express[_0xae13('0x5')]();var fs_extra=require(_0xae13('0x6'));var auth=require(_0xae13('0x7'));var interaction=require(_0xae13('0x8'));var config=require(_0xae13('0x9'));var controller=require('./disposition.controller');router[_0xae13('0xa')]('/',auth['isAuthenticated'](),controller[_0xae13('0xb')]);router[_0xae13('0xa')](_0xae13('0xc'),auth[_0xae13('0xd')](),controller[_0xae13('0xe')]);router[_0xae13('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xae13('0x10')](_0xae13('0xc'),auth[_0xae13('0xd')](),controller[_0xae13('0x11')]);router[_0xae13('0x12')](_0xae13('0xc'),auth[_0xae13('0xd')](),controller['destroy']);module[_0xae13('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 0e7a616..35ebad7 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 _0x407f=['14400','v17,v27,v29','INTEGER','DADHI','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000'];(function(_0x55bc6e,_0x179ede){var _0x30344d=function(_0x18d459){while(--_0x18d459){_0x55bc6e['push'](_0x55bc6e['shift']());}};_0x30344d(++_0x179ede);}(_0x407f,0x8a));var _0xf407=function(_0x553f1e,_0x3a2402){_0x553f1e=_0x553f1e-0x0;var _0x1edf1b=_0x407f[_0x553f1e];return _0x1edf1b;};'use strict';var Sequelize=require(_0xf407('0x0'));module[_0xf407('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf407('0x2')]},'ecm':{'type':Sequelize[_0xf407('0x3')](_0xf407('0x4'),'no'),'defaultValue':_0xf407('0x4')},'headerinfo':{'type':Sequelize[_0xf407('0x2')],'defaultValue':_0xf407('0x5')},'localstationid':{'type':Sequelize[_0xf407('0x2')],'unique':_0xf407('0x6')},'minrate':{'type':Sequelize[_0xf407('0x3')](_0xf407('0x7'),_0xf407('0x8'),_0xf407('0x9'),_0xf407('0xa'),_0xf407('0xb'),_0xf407('0xc')),'defaultValue':_0xf407('0x8')},'maxrate':{'type':Sequelize[_0xf407('0x3')](_0xf407('0x7'),_0xf407('0x8'),_0xf407('0x9'),_0xf407('0xa'),_0xf407('0xb'),_0xf407('0xc')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xf407('0x2')],'defaultValue':_0xf407('0xd')},'gateway':{'type':Sequelize['STRING'],'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[_0xf407('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf407('0x3')]('SIP','IAX',_0xf407('0xf'),'KHOMP'),'defaultValue':_0xf407('0x10')},'key':{'type':Sequelize[_0xf407('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf407('0x11')],'defaultValue':function(){return _0xf407('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf407('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf407('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf407('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf407('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf407('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xf407('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xf407('0x13')],'defaultValue':![],'comment':_0xf407('0x15'),'set':function(_0x5415f5){if(!_0x5415f5)this[_0xf407('0x16')](_0xf407('0x17'),null);this[_0xf407('0x16')](_0xf407('0x18'),_0x5415f5);}}}; \ No newline at end of file +var _0x11d4=['SIP','IAX','DADHI','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','4800','7200','12000','14400','2400','9600','v17,v27,v29'];(function(_0x10b2d5,_0x5a7743){var _0x14b8d1=function(_0x3b888c){while(--_0x3b888c){_0x10b2d5['push'](_0x10b2d5['shift']());}};_0x14b8d1(++_0x5a7743);}(_0x11d4,0x15b));var _0x411d=function(_0x1c0434,_0x4af0ad){_0x1c0434=_0x1c0434-0x0;var _0x84b38=_0x11d4[_0x1c0434];return _0x84b38;};'use strict';var Sequelize=require(_0x411d('0x0'));module[_0x411d('0x1')]={'name':{'type':Sequelize[_0x411d('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x411d('0x2')]},'ecm':{'type':Sequelize[_0x411d('0x3')](_0x411d('0x4'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x411d('0x2')],'defaultValue':_0x411d('0x5')},'localstationid':{'type':Sequelize[_0x411d('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x411d('0x3')]('2400',_0x411d('0x6'),_0x411d('0x7'),'9600',_0x411d('0x8'),_0x411d('0x9')),'defaultValue':_0x411d('0x6')},'maxrate':{'type':Sequelize[_0x411d('0x3')](_0x411d('0xa'),_0x411d('0x6'),_0x411d('0x7'),_0x411d('0xb'),_0x411d('0x8'),'14400'),'defaultValue':_0x411d('0x9')},'modem':{'type':Sequelize[_0x411d('0x2')],'defaultValue':_0x411d('0xc')},'gateway':{'type':Sequelize[_0x411d('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x411d('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x411d('0x3')](_0x411d('0xd'),_0x411d('0xe'),_0x411d('0xf'),'KHOMP'),'defaultValue':_0x411d('0xd')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x411d('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x411d('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x411d('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x411d('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x411d('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x411d('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x411d('0x11')],'allowNull':!![],'defaultValue':null,'comment':_0x411d('0x12')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1e8324){if(!_0x1e8324)this[_0x411d('0x13')]('mandatoryDispositionPauseId',null);this[_0x411d('0x13')]('mandatoryDisposition',_0x1e8324);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 251ca45..a4e21be 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 _0x9a3a=['root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','Contacts','ListId','List\x20not\x20found','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','client','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','FaxAccounts','stack','name','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','params','find','create','body','user','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','rows','removeDispositions','ids','addAnswer','FaxAccountId','CannedAnswer','getAnswers','findOne','nolimit','addInteraction','FaxInteraction','omit','getInteractions','hasOwnProperty','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','from-voip-provider','exten','localstationid','app','system','description','push','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','maxrate','minrate','modem','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','updateAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','findById','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','send','CmList','List','DESC','attachments','join'];(function(_0x3e2a9e,_0x476f39){var _0x51eb5f=function(_0x421bb8){while(--_0x421bb8){_0x3e2a9e['push'](_0x3e2a9e['shift']());}};_0x51eb5f(++_0x476f39);}(_0x9a3a,0x19a));var _0xa9a3=function(_0x173c67,_0x31db4c){_0x173c67=_0x173c67-0x0;var _0x174507=_0x9a3a[_0x173c67];return _0x174507;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa9a3('0x0'));var rp=require(_0xa9a3('0x1'));var moment=require(_0xa9a3('0x2'));var BPromise=require(_0xa9a3('0x3'));var Mustache=require(_0xa9a3('0x4'));var util=require(_0xa9a3('0x5'));var path=require(_0xa9a3('0x6'));var sox=require(_0xa9a3('0x7'));var csv=require('to-csv');var ejs=require(_0xa9a3('0x8'));var fs=require('fs');var fs_extra=require(_0xa9a3('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa9a3('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa9a3('0xb'));var querystring=require(_0xa9a3('0xc'));var Papa=require('papaparse');var Redis=require(_0xa9a3('0xd'));var authService=require(_0xa9a3('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9a3('0xf'));var logger=require(_0xa9a3('0x10'))(_0xa9a3('0x11'));var utils=require(_0xa9a3('0x12'));var config=require(_0xa9a3('0x13'));var licenseUtil=require(_0xa9a3('0x14'));var db=require(_0xa9a3('0x15'))['db'];config['redis']=_[_0xa9a3('0x16')](config['redis'],{'host':_0xa9a3('0x17'),'port':0x18eb});var socket=require(_0xa9a3('0x18'))(new Redis(config['redis']));require(_0xa9a3('0x19'))[_0xa9a3('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xa9a3('0x1b')][_0xa9a3('0x1c')]({'port':0x232c});var client9002=jayson[_0xa9a3('0x1b')][_0xa9a3('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x44f46d,_0x3c5ab3,_0x512532,_0x360e7a){return new BPromise(function(_0x6b7933,_0x109aa7){var _0x489860=_0x360e7a||client;return _0x489860[_0xa9a3('0x1d')](_0x44f46d,_0x512532)[_0xa9a3('0x1e')](function(_0x3143bd){logger[_0xa9a3('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x3c5ab3,_0xa9a3('0x20'));logger[_0xa9a3('0x21')](_0xa9a3('0x22'),_0x3c5ab3,_0xa9a3('0x20'),JSON[_0xa9a3('0x23')](_0x3143bd));if(_0x3143bd['error']){if(_0x3143bd[_0xa9a3('0x24')]['code']===0x1f4){logger[_0xa9a3('0x24')](_0xa9a3('0x25'),_0x3c5ab3,_0x3143bd['error'][_0xa9a3('0x26')]);return _0x109aa7(_0x3143bd[_0xa9a3('0x24')][_0xa9a3('0x26')]);}logger[_0xa9a3('0x24')](_0xa9a3('0x25'),_0x3c5ab3,_0x3143bd[_0xa9a3('0x24')][_0xa9a3('0x26')]);return _0x6b7933(_0x3143bd[_0xa9a3('0x24')][_0xa9a3('0x26')]);}else{logger[_0xa9a3('0x1f')]('FaxAccount,\x20%s,\x20%s',_0x3c5ab3,_0xa9a3('0x20'));_0x6b7933(_0x3143bd[_0xa9a3('0x27')][_0xa9a3('0x26')]);}})[_0xa9a3('0x28')](function(_0x35d3c1){logger[_0xa9a3('0x24')](_0xa9a3('0x25'),_0x3c5ab3,_0x35d3c1);_0x109aa7(_0x35d3c1);});});}function respondWithStatusCode(_0x218392,_0x1b11c4){_0x1b11c4=_0x1b11c4||0xcc;return function(_0xc74b8f){if(_0xc74b8f){return _0x218392[_0xa9a3('0x29')](_0x1b11c4);}return _0x218392['status'](_0x1b11c4)[_0xa9a3('0x2a')]();};}function respondWithResult(_0x43d0a1,_0x48dcd2){_0x48dcd2=_0x48dcd2||0xc8;return function(_0x88637b){if(_0x88637b){return _0x43d0a1[_0xa9a3('0x2b')](_0x48dcd2)[_0xa9a3('0x2c')](_0x88637b);}};}function respondWithFilteredResult(_0x19a230,_0x339f7a){return function(_0xfb190e){if(_0xfb190e){var _0x4c6f68=typeof _0x339f7a[_0xa9a3('0x2d')]===_0xa9a3('0x2e')&&typeof _0x339f7a[_0xa9a3('0x2f')]===_0xa9a3('0x2e');var _0x11f8d2=_0xfb190e[_0xa9a3('0x30')];var _0x21d258=_0x4c6f68?0x0:_0x339f7a['offset'];var _0x303f22=_0x4c6f68?_0xfb190e[_0xa9a3('0x30')]:_0x339f7a[_0xa9a3('0x2d')]+_0x339f7a[_0xa9a3('0x2f')];var _0x24a7a4;if(_0x303f22>=_0x11f8d2){_0x303f22=_0x11f8d2;_0x24a7a4=0xc8;}else{_0x24a7a4=0xce;}_0x19a230[_0xa9a3('0x2b')](_0x24a7a4);return _0x19a230['set'](_0xa9a3('0x31'),_0x21d258+'-'+_0x303f22+'/'+_0x11f8d2)['json'](_0xfb190e);}return null;};}function patchUpdates(_0x4480ab){return function(_0x2711fc){try{jsonpatch[_0xa9a3('0x32')](_0x2711fc,_0x4480ab,!![]);}catch(_0x513cc4){return BPromise['reject'](_0x513cc4);}return _0x2711fc[_0xa9a3('0x33')]();};}function saveUpdates(_0x414604,_0x17d56b){return function(_0x4c1041){if(_0x4c1041){return _0x4c1041[_0xa9a3('0x34')](_0x414604)[_0xa9a3('0x1e')](function(_0x38d82c){return _0x38d82c;});}return null;};}function removeEntity(_0x9d7574,_0x426b28){return function(_0x178183){if(_0x178183){return _0x178183[_0xa9a3('0x35')]()[_0xa9a3('0x1e')](function(){var _0x5010d2=_0x178183['get']({'plain':!![]});var _0x31199a=_0xa9a3('0x36');return db['UserProfileResource'][_0xa9a3('0x35')]({'where':{'type':_0x31199a,'resourceId':_0x5010d2['id']}})[_0xa9a3('0x1e')](function(){return _0x178183;});})[_0xa9a3('0x1e')](function(){_0x9d7574['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x107408,_0x386b53){return function(_0x1a13d2){if(!_0x1a13d2){_0x107408[_0xa9a3('0x29')](0x194);}return _0x1a13d2;};}function handleError(_0x43b557,_0x4d2f78){_0x4d2f78=_0x4d2f78||0x1f4;return function(_0x3060ef){logger[_0xa9a3('0x24')](_0x3060ef[_0xa9a3('0x37')]);if(_0x3060ef[_0xa9a3('0x38')]){delete _0x3060ef['name'];}_0x43b557[_0xa9a3('0x2b')](_0x4d2f78)['send'](_0x3060ef);};}exports['index']=function(_0x124b8d,_0x22221c){var _0x202235={'include':[{'model':db[_0xa9a3('0x39')],'as':_0xa9a3('0x3a')}]},_0x4bcbe5={},_0xe874f1={'count':0x0,'rows':[]};var _0x3274d1=_[_0xa9a3('0x3b')](db[_0xa9a3('0x3c')][_0xa9a3('0x3d')],function(_0x396f95){return{'name':_0x396f95[_0xa9a3('0x3e')],'type':_0x396f95[_0xa9a3('0x3f')][_0xa9a3('0x40')]};});_0x4bcbe5[_0xa9a3('0x41')]=_[_0xa9a3('0x3b')](_0x3274d1,_0xa9a3('0x38'));_0x4bcbe5[_0xa9a3('0x42')]=_[_0xa9a3('0x43')](_0x124b8d[_0xa9a3('0x42')]);_0x4bcbe5[_0xa9a3('0x44')]=_[_0xa9a3('0x45')](_0x4bcbe5[_0xa9a3('0x41')],_0x4bcbe5[_0xa9a3('0x42')]);_0x202235[_0xa9a3('0x46')]=_['intersection'](_0x4bcbe5['model'],qs[_0xa9a3('0x47')](_0x124b8d[_0xa9a3('0x42')][_0xa9a3('0x47')]));_0x202235[_0xa9a3('0x46')]=_0x202235['attributes'][_0xa9a3('0x48')]?_0x202235[_0xa9a3('0x46')]:_0x4bcbe5[_0xa9a3('0x41')];if(!_0x124b8d[_0xa9a3('0x42')]['hasOwnProperty']('nolimit')){_0x202235[_0xa9a3('0x2f')]=qs[_0xa9a3('0x2f')](_0x124b8d[_0xa9a3('0x42')]['limit']);_0x202235[_0xa9a3('0x2d')]=qs[_0xa9a3('0x2d')](_0x124b8d[_0xa9a3('0x42')][_0xa9a3('0x2d')]);}_0x202235[_0xa9a3('0x49')]=qs['sort'](_0x124b8d[_0xa9a3('0x42')][_0xa9a3('0x4a')]);_0x202235[_0xa9a3('0x4b')]=qs[_0xa9a3('0x44')](_[_0xa9a3('0x4c')](_0x124b8d['query'],_0x4bcbe5[_0xa9a3('0x44')]),_0x3274d1);if(_0x124b8d[_0xa9a3('0x42')]['filter']){_0x202235[_0xa9a3('0x4b')]=_['merge'](_0x202235['where'],{'$or':_['map'](_0x3274d1,function(_0x4edae0){if(_0x4edae0['type']!==_0xa9a3('0x4d')){var _0x48a013={};_0x48a013[_0x4edae0['name']]={'$like':'%'+_0x124b8d[_0xa9a3('0x42')][_0xa9a3('0x4e')]+'%'};return _0x48a013;}})});}_0x202235=_[_0xa9a3('0x4f')]({},_0x202235,_0x124b8d[_0xa9a3('0x50')]);var _0x4176a0={'where':_0x202235[_0xa9a3('0x4b')]};return db[_0xa9a3('0x3c')][_0xa9a3('0x30')](_0x4176a0)['then'](function(_0x538a92){_0xe874f1[_0xa9a3('0x30')]=_0x538a92;if(_0x124b8d[_0xa9a3('0x42')][_0xa9a3('0x51')]){_0x202235[_0xa9a3('0x52')]=[{'all':!![]}];}return db[_0xa9a3('0x3c')][_0xa9a3('0x53')](_0x202235);})[_0xa9a3('0x1e')](function(_0x569997){_0xe874f1['rows']=_0x569997;return _0xe874f1;})[_0xa9a3('0x1e')](respondWithFilteredResult(_0x22221c,_0x202235))[_0xa9a3('0x28')](handleError(_0x22221c,null));};exports[_0xa9a3('0x54')]=function(_0x37ad97,_0x328743){var _0x48a9f6={'raw':![],'where':{'id':_0x37ad97[_0xa9a3('0x55')]['id']},'include':[{'model':db[_0xa9a3('0x39')],'as':_0xa9a3('0x3a')}]},_0x327032={};_0x327032[_0xa9a3('0x41')]=_[_0xa9a3('0x43')](db[_0xa9a3('0x3c')]['rawAttributes']);_0x327032[_0xa9a3('0x42')]=_['keys'](_0x37ad97[_0xa9a3('0x42')]);_0x327032[_0xa9a3('0x44')]=_['intersection'](_0x327032[_0xa9a3('0x41')],_0x327032[_0xa9a3('0x42')]);_0x48a9f6[_0xa9a3('0x46')]=_['intersection'](_0x327032[_0xa9a3('0x41')],qs[_0xa9a3('0x47')](_0x37ad97[_0xa9a3('0x42')]['fields']));_0x48a9f6[_0xa9a3('0x46')]=_0x48a9f6['attributes']['length']?_0x48a9f6['attributes']:_0x327032['model'];if(_0x37ad97[_0xa9a3('0x42')]['includeAll']){_0x48a9f6[_0xa9a3('0x52')]=[{'all':!![]}];}_0x48a9f6=_[_0xa9a3('0x4f')]({},_0x48a9f6,_0x37ad97[_0xa9a3('0x50')]);return db[_0xa9a3('0x3c')][_0xa9a3('0x56')](_0x48a9f6)['then'](handleEntityNotFound(_0x328743,null))[_0xa9a3('0x1e')](respondWithResult(_0x328743,null))[_0xa9a3('0x28')](handleError(_0x328743,null));};exports[_0xa9a3('0x57')]=function(_0x386ec0,_0x5b1a53){return db[_0xa9a3('0x3c')][_0xa9a3('0x57')](_0x386ec0[_0xa9a3('0x58')],{})['then'](function(_0x224809){var _0x174e82=_0x386ec0[_0xa9a3('0x59')][_0xa9a3('0x5a')]({'plain':!![]});if(!_0x174e82)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x174e82[_0xa9a3('0x5b')]==='user'){var _0x45b0b0=_0x224809[_0xa9a3('0x5a')]({'plain':!![]});var _0x36349c=_0xa9a3('0x36');return db[_0xa9a3('0x5c')][_0xa9a3('0x56')]({'where':{'name':_0x36349c,'userProfileId':_0x174e82['userProfileId']},'raw':!![]})['then'](function(_0x6d0291){if(_0x6d0291&&_0x6d0291[_0xa9a3('0x5d')]===0x0){return db['UserProfileResource'][_0xa9a3('0x57')]({'name':_0x45b0b0[_0xa9a3('0x38')],'resourceId':_0x45b0b0['id'],'type':_0x6d0291['name'],'sectionId':_0x6d0291['id']},{})['then'](function(){return _0x224809;});}else{return _0x224809;}})[_0xa9a3('0x28')](function(_0x3f08cc){logger[_0xa9a3('0x24')](_0xa9a3('0x5e'),_0x3f08cc);throw _0x3f08cc;});}return _0x224809;})[_0xa9a3('0x1e')](respondWithResult(_0x5b1a53,0xc9))[_0xa9a3('0x28')](handleError(_0x5b1a53,null));};exports[_0xa9a3('0x34')]=function(_0x583ecf,_0x204e75){if(_0x583ecf[_0xa9a3('0x58')]['id']){delete _0x583ecf[_0xa9a3('0x58')]['id'];}return db[_0xa9a3('0x3c')][_0xa9a3('0x56')]({'where':{'id':_0x583ecf[_0xa9a3('0x55')]['id']},'include':[{'model':db[_0xa9a3('0x39')],'as':_0xa9a3('0x3a')}]})[_0xa9a3('0x1e')](handleEntityNotFound(_0x204e75,null))['then'](saveUpdates(_0x583ecf[_0xa9a3('0x58')],null))['then'](respondWithResult(_0x204e75,null))[_0xa9a3('0x28')](handleError(_0x204e75,null));};exports[_0xa9a3('0x35')]=function(_0x451cdc,_0x425822){return db[_0xa9a3('0x3c')][_0xa9a3('0x56')]({'where':{'id':_0x451cdc[_0xa9a3('0x55')]['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x425822,null))[_0xa9a3('0x1e')](removeEntity(_0x425822,null))[_0xa9a3('0x28')](handleError(_0x425822,null));};exports[_0xa9a3('0x5f')]=function(_0x540951,_0x10589b){return db[_0xa9a3('0x3c')][_0xa9a3('0x5f')]()[_0xa9a3('0x1e')](respondWithResult(_0x10589b,null))['catch'](handleError(_0x10589b,null));};exports[_0xa9a3('0x60')]=function(_0x3e5999,_0x3ff015,_0x319ee9){if(_0x3e5999['body']['id']){delete _0x3e5999[_0xa9a3('0x58')]['id'];}return db[_0xa9a3('0x3c')][_0xa9a3('0x56')]({'where':{'id':_0x3e5999[_0xa9a3('0x55')]['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x3ff015,null))[_0xa9a3('0x1e')](function(_0x3f9d86){if(_0x3f9d86){_0x3e5999[_0xa9a3('0x58')]['FaxAccountId']=_0x3f9d86['id'];return db[_0xa9a3('0x61')][_0xa9a3('0x57')](_0x3e5999[_0xa9a3('0x58')]);}})[_0xa9a3('0x1e')](respondWithResult(_0x3ff015,null))[_0xa9a3('0x28')](handleError(_0x3ff015,null));};exports[_0xa9a3('0x62')]=function(_0x55b5ae,_0x5da599,_0x428541){var _0x38c1c2={'raw':![],'where':{}};var _0x1d055b={};var _0x4ada2f={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x55b5ae[_0xa9a3('0x55')]['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x5da599,null))['then'](function(_0x1af67c){if(_0x1af67c){_0x1d055b[_0xa9a3('0x41')]=_[_0xa9a3('0x43')](db[_0xa9a3('0x61')]['rawAttributes']);_0x1d055b[_0xa9a3('0x42')]=_['keys'](_0x55b5ae[_0xa9a3('0x42')]);_0x1d055b['filters']=_[_0xa9a3('0x45')](_0x1d055b[_0xa9a3('0x41')],_0x1d055b[_0xa9a3('0x42')]);_0x38c1c2[_0xa9a3('0x46')]=_[_0xa9a3('0x45')](_0x1d055b['model'],qs[_0xa9a3('0x47')](_0x55b5ae[_0xa9a3('0x42')][_0xa9a3('0x47')]));_0x38c1c2[_0xa9a3('0x46')]=_0x38c1c2[_0xa9a3('0x46')][_0xa9a3('0x48')]?_0x38c1c2[_0xa9a3('0x46')]:_0x1d055b[_0xa9a3('0x41')];if(!_0x55b5ae[_0xa9a3('0x42')]['hasOwnProperty']('nolimit')){_0x38c1c2[_0xa9a3('0x2f')]=qs['limit'](_0x55b5ae['query']['limit']);_0x38c1c2[_0xa9a3('0x2d')]=qs[_0xa9a3('0x2d')](_0x55b5ae['query'][_0xa9a3('0x2d')]);}_0x38c1c2[_0xa9a3('0x49')]=qs[_0xa9a3('0x4a')](_0x55b5ae['query'][_0xa9a3('0x4a')]);_0x38c1c2[_0xa9a3('0x4b')]=qs[_0xa9a3('0x44')](_['pick'](_0x55b5ae[_0xa9a3('0x42')],_0x1d055b[_0xa9a3('0x44')]));_0x38c1c2[_0xa9a3('0x4b')]['FaxAccountId']=_0x1af67c['id'];if(_0x55b5ae['query'][_0xa9a3('0x4e')]){_0x38c1c2[_0xa9a3('0x4b')]=_[_0xa9a3('0x4f')](_0x38c1c2[_0xa9a3('0x4b')],{'$or':_[_0xa9a3('0x3b')](_0x38c1c2[_0xa9a3('0x46')],function(_0xd174f0){var _0x3f188e={};_0x3f188e[_0xd174f0]={'$like':'%'+_0x55b5ae[_0xa9a3('0x42')][_0xa9a3('0x4e')]+'%'};return _0x3f188e;})});}_0x38c1c2=_['merge']({},_0x38c1c2,_0x55b5ae[_0xa9a3('0x50')]);return db[_0xa9a3('0x61')][_0xa9a3('0x30')]({'where':_0x38c1c2['where']})[_0xa9a3('0x1e')](function(_0x1346b2){_0x4ada2f[_0xa9a3('0x30')]=_0x1346b2;if(_0x55b5ae[_0xa9a3('0x42')][_0xa9a3('0x51')]){_0x38c1c2[_0xa9a3('0x52')]=[{'all':!![]}];}return db[_0xa9a3('0x61')][_0xa9a3('0x53')](_0x38c1c2);})[_0xa9a3('0x1e')](function(_0x2f2afa){_0x4ada2f[_0xa9a3('0x63')]=_0x2f2afa;return _0x4ada2f;});}})[_0xa9a3('0x1e')](respondWithFilteredResult(_0x5da599,_0x38c1c2))[_0xa9a3('0x28')](handleError(_0x5da599,null));};exports[_0xa9a3('0x64')]=function(_0x5f4e66,_0x4ca93b,_0x511e0a){return db['FaxAccount'][_0xa9a3('0x56')]({'where':{'id':_0x5f4e66[_0xa9a3('0x55')]['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x4ca93b,null))[_0xa9a3('0x1e')](function(_0x1e42e3){if(_0x1e42e3){return _0x1e42e3['removeDispositions'](_0x5f4e66[_0xa9a3('0x42')][_0xa9a3('0x65')]);}})['then'](respondWithStatusCode(_0x4ca93b,null))[_0xa9a3('0x28')](handleError(_0x4ca93b,null));};exports[_0xa9a3('0x66')]=function(_0x463206,_0xa5cea3,_0x585beb){if(_0x463206[_0xa9a3('0x58')]['id']){delete _0x463206[_0xa9a3('0x58')]['id'];}return db[_0xa9a3('0x3c')][_0xa9a3('0x56')]({'where':{'id':_0x463206['params']['id']}})['then'](handleEntityNotFound(_0xa5cea3,null))['then'](function(_0x2788fa){if(_0x2788fa){_0x463206[_0xa9a3('0x58')][_0xa9a3('0x67')]=_0x2788fa['id'];return db[_0xa9a3('0x68')][_0xa9a3('0x57')](_0x463206[_0xa9a3('0x58')]);}})[_0xa9a3('0x1e')](respondWithResult(_0xa5cea3,null))['catch'](handleError(_0xa5cea3,null));};exports[_0xa9a3('0x69')]=function(_0x637b2c,_0x1049e4,_0x56407b){var _0x35166b={'raw':![],'where':{}};var _0x46944b={};var _0x594d19={'count':0x0,'rows':[]};return db['FaxAccount'][_0xa9a3('0x6a')]({'where':{'id':_0x637b2c[_0xa9a3('0x55')]['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x1049e4,null))[_0xa9a3('0x1e')](function(_0x539fc4){if(_0x539fc4){_0x46944b['model']=_['keys'](db[_0xa9a3('0x68')]['rawAttributes']);_0x46944b['query']=_[_0xa9a3('0x43')](_0x637b2c[_0xa9a3('0x42')]);_0x46944b[_0xa9a3('0x44')]=_[_0xa9a3('0x45')](_0x46944b[_0xa9a3('0x41')],_0x46944b[_0xa9a3('0x42')]);_0x35166b['attributes']=_[_0xa9a3('0x45')](_0x46944b['model'],qs['fields'](_0x637b2c[_0xa9a3('0x42')][_0xa9a3('0x47')]));_0x35166b[_0xa9a3('0x46')]=_0x35166b[_0xa9a3('0x46')][_0xa9a3('0x48')]?_0x35166b[_0xa9a3('0x46')]:_0x46944b['model'];if(!_0x637b2c['query']['hasOwnProperty'](_0xa9a3('0x6b'))){_0x35166b[_0xa9a3('0x2f')]=qs[_0xa9a3('0x2f')](_0x637b2c[_0xa9a3('0x42')][_0xa9a3('0x2f')]);_0x35166b[_0xa9a3('0x2d')]=qs[_0xa9a3('0x2d')](_0x637b2c[_0xa9a3('0x42')][_0xa9a3('0x2d')]);}_0x35166b[_0xa9a3('0x49')]=qs['sort'](_0x637b2c[_0xa9a3('0x42')]['sort']);_0x35166b[_0xa9a3('0x4b')]=qs[_0xa9a3('0x44')](_['pick'](_0x637b2c[_0xa9a3('0x42')],_0x46944b[_0xa9a3('0x44')]));_0x35166b[_0xa9a3('0x4b')][_0xa9a3('0x67')]=_0x539fc4['id'];if(_0x637b2c['query'][_0xa9a3('0x4e')]){_0x35166b[_0xa9a3('0x4b')]=_[_0xa9a3('0x4f')](_0x35166b[_0xa9a3('0x4b')],{'$or':_[_0xa9a3('0x3b')](_0x35166b['attributes'],function(_0x4e1932){var _0xf16bc3={};_0xf16bc3[_0x4e1932]={'$like':'%'+_0x637b2c[_0xa9a3('0x42')][_0xa9a3('0x4e')]+'%'};return _0xf16bc3;})});}_0x35166b=_['merge']({},_0x35166b,_0x637b2c['options']);return db[_0xa9a3('0x68')][_0xa9a3('0x30')]({'where':_0x35166b[_0xa9a3('0x4b')]})[_0xa9a3('0x1e')](function(_0x335f78){_0x594d19[_0xa9a3('0x30')]=_0x335f78;if(_0x637b2c[_0xa9a3('0x42')][_0xa9a3('0x51')]){_0x35166b['include']=[{'all':!![]}];}return db[_0xa9a3('0x68')]['findAll'](_0x35166b);})[_0xa9a3('0x1e')](function(_0x1d79d8){_0x594d19['rows']=_0x1d79d8;return _0x594d19;});}})['then'](respondWithFilteredResult(_0x1049e4,_0x35166b))[_0xa9a3('0x28')](handleError(_0x1049e4,null));};exports['removeAnswers']=function(_0x16648e,_0x2299e0,_0x1929b2){return db['FaxAccount'][_0xa9a3('0x56')]({'where':{'id':_0x16648e[_0xa9a3('0x55')]['id']}})['then'](handleEntityNotFound(_0x2299e0,null))['then'](function(_0xa4db78){if(_0xa4db78){return _0xa4db78['removeAnswers'](_0x16648e[_0xa9a3('0x42')][_0xa9a3('0x65')]);}})['then'](respondWithStatusCode(_0x2299e0,null))[_0xa9a3('0x28')](handleError(_0x2299e0,null));};exports[_0xa9a3('0x6c')]=function(_0x52f9e4,_0x5226de,_0x3eeb57){return db[_0xa9a3('0x6d')][_0xa9a3('0x56')]({'where':{'id':_0x52f9e4['params']['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x5226de,null))['then'](function(_0x599d79){if(_0x599d79){return _0x599d79[_0xa9a3('0x6c')](_0x52f9e4['body'][_0xa9a3('0x65')],_[_0xa9a3('0x6e')](_0x52f9e4[_0xa9a3('0x58')],[_0xa9a3('0x65'),'id'])||{});}})[_0xa9a3('0x1e')](respondWithResult(_0x5226de,null))[_0xa9a3('0x28')](handleError(_0x5226de,null));};exports[_0xa9a3('0x6f')]=function(_0x10a47b,_0x1c25e0,_0x348d51){var _0x25c7ef={'raw':![],'where':{}};var _0x4e7daa={};var _0x5aeea0={'count':0x0,'rows':[]};return db['FaxAccount'][_0xa9a3('0x6a')]({'where':{'id':_0x10a47b[_0xa9a3('0x55')]['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x1c25e0,null))['then'](function(_0x138a63){if(_0x138a63){_0x4e7daa[_0xa9a3('0x41')]=_[_0xa9a3('0x43')](db[_0xa9a3('0x6d')][_0xa9a3('0x3d')]);_0x4e7daa[_0xa9a3('0x42')]=_[_0xa9a3('0x43')](_0x10a47b[_0xa9a3('0x42')]);_0x4e7daa['filters']=_[_0xa9a3('0x45')](_0x4e7daa[_0xa9a3('0x41')],_0x4e7daa[_0xa9a3('0x42')]);_0x25c7ef[_0xa9a3('0x46')]=_['intersection'](_0x4e7daa[_0xa9a3('0x41')],qs['fields'](_0x10a47b[_0xa9a3('0x42')][_0xa9a3('0x47')]));_0x25c7ef[_0xa9a3('0x46')]=_0x25c7ef[_0xa9a3('0x46')]['length']?_0x25c7ef[_0xa9a3('0x46')]:_0x4e7daa[_0xa9a3('0x41')];if(!_0x10a47b[_0xa9a3('0x42')][_0xa9a3('0x70')]('nolimit')){_0x25c7ef[_0xa9a3('0x2f')]=qs[_0xa9a3('0x2f')](_0x10a47b[_0xa9a3('0x42')][_0xa9a3('0x2f')]);_0x25c7ef[_0xa9a3('0x2d')]=qs['offset'](_0x10a47b[_0xa9a3('0x42')][_0xa9a3('0x2d')]);}_0x25c7ef[_0xa9a3('0x49')]=qs[_0xa9a3('0x4a')](_0x10a47b[_0xa9a3('0x42')][_0xa9a3('0x4a')]);_0x25c7ef[_0xa9a3('0x4b')]=qs[_0xa9a3('0x44')](_[_0xa9a3('0x4c')](_0x10a47b[_0xa9a3('0x42')],_0x4e7daa[_0xa9a3('0x44')]));_0x25c7ef[_0xa9a3('0x4b')][_0xa9a3('0x67')]=_0x138a63['id'];if(_0x10a47b[_0xa9a3('0x42')][_0xa9a3('0x4e')]){_0x25c7ef[_0xa9a3('0x4b')]=_[_0xa9a3('0x4f')](_0x25c7ef['where'],{'$or':_[_0xa9a3('0x3b')](_0x25c7ef['attributes'],function(_0x2745be){var _0xd34a4b={};_0xd34a4b[_0x2745be]={'$like':'%'+_0x10a47b[_0xa9a3('0x42')][_0xa9a3('0x4e')]+'%'};return _0xd34a4b;})});}_0x25c7ef=_[_0xa9a3('0x4f')]({},_0x25c7ef,_0x10a47b[_0xa9a3('0x50')]);return db[_0xa9a3('0x6d')][_0xa9a3('0x30')]({'where':_0x25c7ef['where']})[_0xa9a3('0x1e')](function(_0x319d92){_0x5aeea0[_0xa9a3('0x30')]=_0x319d92;if(_0x10a47b['query'][_0xa9a3('0x51')]){_0x25c7ef['include']=[{'model':db[_0xa9a3('0x71')],'as':_0xa9a3('0x72'),'required':![]},{'model':db[_0xa9a3('0x73')],'as':_0xa9a3('0x74'),'attributes':['name',_0xa9a3('0x75'),_0xa9a3('0x76')],'required':![]},{'model':db[_0xa9a3('0x77')],'as':'Tags','attributes':['id',_0xa9a3('0x38'),_0xa9a3('0x78')],'where':_0x10a47b['query'][_0xa9a3('0x79')]?{'id':_0x10a47b['query'][_0xa9a3('0x79')]}:undefined,'required':_0x10a47b[_0xa9a3('0x42')]['tag']?!![]:![]}];}return db[_0xa9a3('0x6d')][_0xa9a3('0x53')](_0x25c7ef);})[_0xa9a3('0x1e')](function(_0x53a038){_0x5aeea0[_0xa9a3('0x63')]=_0x53a038;return _0x5aeea0;});}})[_0xa9a3('0x1e')](respondWithFilteredResult(_0x1c25e0,_0x25c7ef))[_0xa9a3('0x28')](handleError(_0x1c25e0,null));};exports[_0xa9a3('0x7a')]=function(_0x1a990f,_0x177c21,_0x3f09d4){return db[_0xa9a3('0x3c')]['findOne']({'where':{'id':_0x1a990f[_0xa9a3('0x55')]['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x177c21,null))[_0xa9a3('0x1e')](function(_0x4779c0){if(_0x4779c0){return db[_0xa9a3('0x7b')][_0xa9a3('0x7c')](function(_0x29d90e){return db['FaxApplication'][_0xa9a3('0x35')]({'where':{'FaxAccountId':_0x1a990f[_0xa9a3('0x55')]['id']},'transaction':_0x29d90e})[_0xa9a3('0x1e')](function(_0x120784){var _0x259343=_[_0xa9a3('0x3b')](_0x1a990f[_0xa9a3('0x58')],function(_0x439332){_0x439332[_0xa9a3('0x67')]=_0x1a990f[_0xa9a3('0x55')]['id'];return _0x439332;});return db[_0xa9a3('0x7d')][_0xa9a3('0x7e')](_0x259343,{'transaction':_0x29d90e});});})[_0xa9a3('0x1e')](function(){return db[_0xa9a3('0x7d')][_0xa9a3('0x7f')]({'where':{'FaxAccountId':_0x1a990f[_0xa9a3('0x55')]['id']},'order':_0xa9a3('0x80')});});}})[_0xa9a3('0x1e')](respondWithResult(_0x177c21,null))[_0xa9a3('0x28')](handleError(_0x177c21,null));};exports[_0xa9a3('0x81')]=function(_0x2dd4e0,_0x9b46f3,_0x448b74){var _0xb9cfae={};var _0x119d6a={};var _0x33cadb;var _0x344750;return db[_0xa9a3('0x3c')][_0xa9a3('0x6a')]({'where':{'id':_0x2dd4e0[_0xa9a3('0x55')]['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x9b46f3,null))[_0xa9a3('0x1e')](function(_0x14fced){if(_0x14fced){_0x33cadb=_0x14fced;_0x119d6a[_0xa9a3('0x41')]=_[_0xa9a3('0x43')](db['FaxApplication']['rawAttributes']);_0x119d6a[_0xa9a3('0x42')]=_[_0xa9a3('0x43')](_0x2dd4e0['query']);_0x119d6a['filters']=_['intersection'](_0x119d6a['model'],_0x119d6a[_0xa9a3('0x42')]);_0xb9cfae[_0xa9a3('0x46')]=_[_0xa9a3('0x45')](_0x119d6a[_0xa9a3('0x41')],qs[_0xa9a3('0x47')](_0x2dd4e0[_0xa9a3('0x42')][_0xa9a3('0x47')]));_0xb9cfae['attributes']=_0xb9cfae[_0xa9a3('0x46')][_0xa9a3('0x48')]?_0xb9cfae[_0xa9a3('0x46')]:_0x119d6a[_0xa9a3('0x41')];_0xb9cfae[_0xa9a3('0x49')]=qs[_0xa9a3('0x4a')](_0x2dd4e0[_0xa9a3('0x42')][_0xa9a3('0x4a')]);_0xb9cfae[_0xa9a3('0x4b')]=qs[_0xa9a3('0x44')](_[_0xa9a3('0x4c')](_0x2dd4e0[_0xa9a3('0x42')],_0x119d6a[_0xa9a3('0x44')]));if(_0x2dd4e0[_0xa9a3('0x42')][_0xa9a3('0x4e')]){_0xb9cfae[_0xa9a3('0x4b')]=_[_0xa9a3('0x4f')](_0xb9cfae[_0xa9a3('0x4b')],{'$or':_[_0xa9a3('0x3b')](_0xb9cfae[_0xa9a3('0x46')],function(_0x3f35bc){var _0x84eadb={};_0x84eadb[_0x3f35bc]={'$like':'%'+_0x2dd4e0[_0xa9a3('0x42')]['filter']+'%'};return _0x84eadb;})});}_0xb9cfae=_[_0xa9a3('0x4f')]({},_0xb9cfae,_0x2dd4e0['options']);return _0x33cadb[_0xa9a3('0x81')](_0xb9cfae);}})[_0xa9a3('0x1e')](function(_0x54d82b){if(_0x54d82b){_0x344750=_0x54d82b[_0xa9a3('0x48')];if(!_0x2dd4e0['query'][_0xa9a3('0x70')]('nolimit')){_0xb9cfae[_0xa9a3('0x2f')]=qs[_0xa9a3('0x2f')](_0x2dd4e0[_0xa9a3('0x42')][_0xa9a3('0x2f')]);_0xb9cfae[_0xa9a3('0x2d')]=qs['offset'](_0x2dd4e0[_0xa9a3('0x42')]['offset']);}return _0x33cadb['getApplications'](_0xb9cfae);}})['then'](function(_0x52b0f6){if(_0x52b0f6){return _0x52b0f6?{'count':_0x344750,'rows':_0x52b0f6}:null;}})[_0xa9a3('0x1e')](respondWithResult(_0x9b46f3,null))[_0xa9a3('0x28')](handleError(_0x9b46f3,null));};function Extension(_0x8294d7,_0x2ef625,_0x3483e6,_0x1f2b70){this['context']=_0xa9a3('0x82');this[_0xa9a3('0x83')]=_0x8294d7[_0xa9a3('0x84')];this[_0xa9a3('0x85')]=_0x1f2b70;this[_0xa9a3('0x3f')]=_0xa9a3('0x86');this[_0xa9a3('0x87')]='Fax\x20Extension';this[_0xa9a3('0x67')]=_0x8294d7['id'];this[_0xa9a3('0x80')]=_0x2ef625;this['appdata']=_0x3483e6;}function createExtensionsReciveFax(_0x38489c){var _0x4aeebd=0x1;var _0x4c1d44=[];_0x4c1d44[_0xa9a3('0x88')](new Extension(_0x38489c,_0x4aeebd,'','Answer'));_0x4aeebd+=0x1;_0x4c1d44[_0xa9a3('0x88')](new Extension(_0x38489c,_0x4aeebd,_0xa9a3('0x89'),_0xa9a3('0x8a')));_0x4aeebd+=0x1;for(var _0x498d2d in _0x38489c){if(_0x38489c[_0xa9a3('0x70')](_0x498d2d)&&(_0x498d2d==='ecm'||_0x498d2d===_0xa9a3('0x84')||_0x498d2d===_0xa9a3('0x8b')||_0x498d2d===_0xa9a3('0x8c')||_0x498d2d===_0xa9a3('0x8d')||_0x498d2d===_0xa9a3('0x8e')||_0x498d2d===_0xa9a3('0x8f')||_0x498d2d===_0xa9a3('0x90')||_0x498d2d==='t38timeout')){_0x4c1d44[_0xa9a3('0x88')](new Extension(_0x38489c,_0x4aeebd,'FAXOPT('+_0x498d2d+')='+_0x38489c[_0x498d2d],_0xa9a3('0x8a')));_0x4aeebd+=0x1;}}_0x4c1d44[_0xa9a3('0x88')](new Extension(_0x38489c,_0x4aeebd,'6',_0xa9a3('0x91')));_0x4aeebd+=0x1;_0x4c1d44[_0xa9a3('0x88')](new Extension(_0x38489c,_0x4aeebd,_0xa9a3('0x92'),_0xa9a3('0x93')));_0x4aeebd=0x0;return _0x4c1d44;}exports[_0xa9a3('0x94')]=function(_0x2a0851,_0x5e2555,_0x32ce49){var _0x80a591;return db[_0xa9a3('0x7b')][_0xa9a3('0x7c')](function(_0x21d872){return db[_0xa9a3('0x3c')]['create'](_0x2a0851[_0xa9a3('0x58')],{'transaction':_0x21d872})[_0xa9a3('0x1e')](function(_0x98ad2b){_0x80a591=_0x98ad2b[_0xa9a3('0x5a')]({'plain':!![]});return db['VoiceExtension'][_0xa9a3('0x7e')](createExtensionsReciveFax(_0x80a591),{'transaction':_0x21d872});});})[_0xa9a3('0x1e')](function(){return _0x80a591;})[_0xa9a3('0x1e')](respondWithResult(_0x5e2555,null))['catch'](handleError(_0x5e2555,null));};exports[_0xa9a3('0x95')]=function(_0x7ab45a,_0x2415ef,_0x51cfe7){var _0x3b526d;return db['sequelize']['transaction'](function(_0x47b145){return db[_0xa9a3('0x3c')][_0xa9a3('0x34')](_0x7ab45a[_0xa9a3('0x58')],{'where':{'id':_0x7ab45a['body']['id']},'transaction':_0x47b145})[_0xa9a3('0x1e')](function(_0x2c70af){return db[_0xa9a3('0x96')][_0xa9a3('0x35')]({'where':{'FaxAccountId':_0x7ab45a[_0xa9a3('0x58')]['id']},'transaction':_0x47b145})[_0xa9a3('0x1e')](function(_0x35ca4b){return db[_0xa9a3('0x96')][_0xa9a3('0x7e')](createExtensionsReciveFax(_[_0xa9a3('0x6e')](_0x7ab45a[_0xa9a3('0x58')],[_0xa9a3('0x97'),_0xa9a3('0x40'),_0xa9a3('0x98'),_0xa9a3('0x99'),_0xa9a3('0x9a'),'ListId'])),{'transaction':_0x47b145});});});})[_0xa9a3('0x1e')](function(){return db[_0xa9a3('0x3c')][_0xa9a3('0x9b')](_0x7ab45a[_0xa9a3('0x58')]['id']);})[_0xa9a3('0x1e')](respondWithResult(_0x2415ef,null))['catch'](handleError(_0x2415ef,null));};exports['getMessages']=function(_0xa11e7b,_0x91621d,_0x452951){var _0x143cfe={'raw':!![],'where':{}};var _0x34402b={};var _0x4f2dd3={'count':0x0,'rows':[]};return db['FaxAccount'][_0xa9a3('0x6a')]({'where':{'id':_0xa11e7b[_0xa9a3('0x55')]['id']}})['then'](handleEntityNotFound(_0x91621d,null))[_0xa9a3('0x1e')](function(_0x57898a){if(_0x57898a){_0x34402b[_0xa9a3('0x41')]=_[_0xa9a3('0x43')](db[_0xa9a3('0x9c')][_0xa9a3('0x3d')]);_0x34402b[_0xa9a3('0x42')]=_[_0xa9a3('0x43')](_0xa11e7b['query']);_0x34402b[_0xa9a3('0x44')]=_[_0xa9a3('0x45')](_0x34402b[_0xa9a3('0x41')],_0x34402b['query']);_0x143cfe[_0xa9a3('0x46')]=_['intersection'](_0x34402b[_0xa9a3('0x41')],qs[_0xa9a3('0x47')](_0xa11e7b['query']['fields']));_0x143cfe[_0xa9a3('0x46')]=_0x143cfe['attributes'][_0xa9a3('0x48')]?_0x143cfe['attributes']:_0x34402b[_0xa9a3('0x41')];if(!_0xa11e7b[_0xa9a3('0x42')]['hasOwnProperty'](_0xa9a3('0x6b'))){_0x143cfe[_0xa9a3('0x2f')]=qs[_0xa9a3('0x2f')](_0xa11e7b[_0xa9a3('0x42')][_0xa9a3('0x2f')]);_0x143cfe['offset']=qs[_0xa9a3('0x2d')](_0xa11e7b[_0xa9a3('0x42')][_0xa9a3('0x2d')]);}_0x143cfe[_0xa9a3('0x49')]=qs[_0xa9a3('0x4a')](_0xa11e7b[_0xa9a3('0x42')][_0xa9a3('0x4a')]);_0x143cfe[_0xa9a3('0x4b')]=qs[_0xa9a3('0x44')](_['pick'](_0xa11e7b[_0xa9a3('0x42')],_0x34402b['filters']));_0x143cfe[_0xa9a3('0x4b')][_0xa9a3('0x67')]=_0x57898a['id'];if(_0xa11e7b[_0xa9a3('0x42')][_0xa9a3('0x4e')]){_0x143cfe[_0xa9a3('0x4b')]=_[_0xa9a3('0x4f')](_0x143cfe[_0xa9a3('0x4b')],{'$or':_[_0xa9a3('0x3b')](_0x143cfe['attributes'],function(_0x26f288){var _0x34e877={};_0x34e877[_0x26f288]={'$like':'%'+_0xa11e7b[_0xa9a3('0x42')][_0xa9a3('0x4e')]+'%'};return _0x34e877;})});}if(_0xa11e7b[_0xa9a3('0x42')][_0xa9a3('0x9d')]){var _0x5b0e68=_0xa11e7b['query'][_0xa9a3('0x9d')][_0xa9a3('0x9e')](',');var _0xfcc9b3={};_0xfcc9b3[_0x5b0e68[0x0]]={'$gte':moment(_0x5b0e68[0x1])['format'](_0xa9a3('0x9f'))};_0x143cfe[_0xa9a3('0x4b')]=_['merge'](_0x143cfe[_0xa9a3('0x4b')],_0xfcc9b3);}_0x143cfe=_[_0xa9a3('0x4f')]({},_0x143cfe,_0xa11e7b['options']);return db[_0xa9a3('0x9c')][_0xa9a3('0x30')]({'where':_0x143cfe[_0xa9a3('0x4b')]})[_0xa9a3('0x1e')](function(_0x2dbda7){_0x4f2dd3[_0xa9a3('0x30')]=_0x2dbda7;if(_0xa11e7b[_0xa9a3('0x42')][_0xa9a3('0x51')]){_0x143cfe[_0xa9a3('0x52')]=[{'all':!![]}];}return db[_0xa9a3('0x9c')][_0xa9a3('0x53')](_0x143cfe);})['then'](function(_0x3db2f2){_0x4f2dd3[_0xa9a3('0x63')]=_0x3db2f2;return _0x4f2dd3;});}})[_0xa9a3('0x1e')](respondWithFilteredResult(_0x91621d,_0x143cfe))[_0xa9a3('0x28')](handleError(_0x91621d,null));};exports[_0xa9a3('0xa0')]=function(_0x1e66f7,_0x4dec1d,_0x33d43e){var _0x4f5e2d,_0x19acd2={},_0xd3a415;if(_0x1e66f7[_0xa9a3('0x58')]['to']){_0xd3a415=_0x1e66f7['body']['to'][0x0];}return db[_0xa9a3('0x3c')]['find']({'where':{'id':_0x1e66f7['params']['id']},'include':[{'model':db[_0xa9a3('0xa1')],'as':_0xa9a3('0xa2'),'include':[{'model':db[_0xa9a3('0x71')],'as':'Contacts','where':{'fax':_0xd3a415},'limit':0x1,'order':[[_0xa9a3('0x99'),_0xa9a3('0xa3')]]}]}]})[_0xa9a3('0x1e')](handleEntityNotFound(_0x4dec1d,null))[_0xa9a3('0x1e')](function(_0x458d03){_0x4f5e2d=_0x458d03;if(_0x1e66f7[_0xa9a3('0x58')]['attachments']&&_0x1e66f7[_0xa9a3('0x58')]['attachments']['length']){for(var _0x23666f=0x0;_0x23666f<_0x1e66f7[_0xa9a3('0x58')][_0xa9a3('0xa4')]['length'];_0x23666f+=0x1){_0x1e66f7['body']['attachments'][_0x23666f]={'filename':_0x1e66f7[_0xa9a3('0x58')][_0xa9a3('0xa4')][_0x23666f][_0xa9a3('0x38')],'id':_0x1e66f7[_0xa9a3('0x58')][_0xa9a3('0xa4')][_0x23666f]['id'],'path':path[_0xa9a3('0xa5')](config[_0xa9a3('0xa6')],_0xa9a3('0xa7'),_0x1e66f7[_0xa9a3('0x58')][_0xa9a3('0xa4')][_0x23666f][_0xa9a3('0xa8')])};}}return respondWithRpcPromise(_0xa9a3('0xa9'),_0xa9a3('0xa9'),{'FaxAccountId':_[_0xa9a3('0xaa')](_0x1e66f7[_0xa9a3('0x55')]['id'])?undefined:_0x1e66f7[_0xa9a3('0x55')]['id'],'path':_[_0xa9a3('0xaa')](_0x1e66f7[_0xa9a3('0x58')][_0xa9a3('0xa4')][0x0][_0xa9a3('0x6')])?undefined:_0x1e66f7['body'][_0xa9a3('0xa4')][0x0]['path'],'fax':_[_0xa9a3('0xaa')](_0x1e66f7[_0xa9a3('0x58')]['to'][0x0])?undefined:_0x1e66f7['body']['to'][0x0]},client9002);})[_0xa9a3('0x1e')](function(){if(_0x4f5e2d){if(_[_0xa9a3('0xaa')](_0x1e66f7[_0xa9a3('0x58')][_0xa9a3('0xab')])){_0x1e66f7[_0xa9a3('0x58')][_0xa9a3('0xab')]=util['format'](_0xa9a3('0xac'),_0x4f5e2d[_0xa9a3('0x38')],_0x4f5e2d['fax']);}if(_0x4f5e2d['List']){if(_0x4f5e2d[_0xa9a3('0xa2')][_0xa9a3('0xad')][_0xa9a3('0x48')]){return _0x4f5e2d[_0xa9a3('0xa2')]['Contacts'][0x0];}else{return db['CmContact'][_0xa9a3('0x57')](_[_0xa9a3('0x16')](_0x1e66f7['body'],{'firstName':_0x1e66f7[_0xa9a3('0x58')]['to'][0x0],'phone':_0x1e66f7[_0xa9a3('0x58')]['to'][0x0],'fax':_0x1e66f7[_0xa9a3('0x58')]['to'][0x0],'ListId':_0x4f5e2d[_0xa9a3('0xae')]}));}}else{throw new Error(_0xa9a3('0xaf'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xa9a3('0x1e')](function(_0x14a7f9){if(_0x14a7f9){return db['FaxInteraction'][_0xa9a3('0x56')]({'where':{'ContactId':_0x14a7f9['id'],'closed':![],'FaxAccountId':_0x4f5e2d['id']}})[_0xa9a3('0x1e')](function(_0x20f4ff){if(_0x20f4ff){return[_0x20f4ff,![]];}return db['FaxInteraction']['create']({'UserId':_0x1e66f7['user']['id'],'ContactId':_0x14a7f9['id'],'FaxAccountId':_0x4f5e2d['id'],'fax':_0x1e66f7[_0xa9a3('0x58')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xa9a3('0x4f')](_0x1e66f7[_0xa9a3('0x58')],{'read':![],'body':_0x1e66f7[_0xa9a3('0x58')]['attachments'][0x0][_0xa9a3('0xb0')],'FaxAccountId':_0x4f5e2d['id'],'UserId':_0x1e66f7['user']['id'],'ContactId':_0x14a7f9['id'],'AttachmentId':_0x1e66f7['body'][_0xa9a3('0xa4')][0x0]['id']})]},{'include':[{'model':db[_0xa9a3('0x9c')],'as':_0xa9a3('0xb1')}]})[_0xa9a3('0x1e')](function(_0x3de677){return[_0x3de677,!![]];});});}else{throw new Error(_0xa9a3('0xb2'));}})[_0xa9a3('0xb3')](function(_0x5b04a6,_0x503322){if(_0x503322){return _0x5b04a6;}return db['FaxMessage']['create']({'direction':_0xa9a3('0xb4'),'read':![],'body':_0x1e66f7['body'][_0xa9a3('0xa4')][0x0][_0xa9a3('0xb0')],'FaxAccountId':_0x4f5e2d['id'],'FaxInteractionId':_0x5b04a6['id'],'UserId':_0x1e66f7['user']['id'],'ContactId':_0x5b04a6[_0xa9a3('0xb5')],'AttachmentId':_0x1e66f7['body'][_0xa9a3('0xa4')][0x0]['id']})[_0xa9a3('0x1e')](function(_0x1cad77){_0x5b04a6['dataValues'][_0xa9a3('0xb1')]=[];_0x5b04a6[_0xa9a3('0xb6')][_0xa9a3('0xb1')][_0xa9a3('0x88')](_0x1cad77[_0xa9a3('0xb6')]);return _0x5b04a6;});})[_0xa9a3('0x1e')](function(_0x54ec10){respondWithRpcPromise(_0xa9a3('0xb7'),_0xa9a3('0xb7'),{'FaxAccountId':_[_0xa9a3('0xaa')](_0x1e66f7[_0xa9a3('0x55')]['id'])?undefined:_0x1e66f7['params']['id'],'path':_[_0xa9a3('0xaa')](_0x1e66f7[_0xa9a3('0x58')]['attachments'][0x0][_0xa9a3('0x6')])?undefined:_0x1e66f7[_0xa9a3('0x58')][_0xa9a3('0xa4')][0x0][_0xa9a3('0x6')],'fax':_[_0xa9a3('0xaa')](_0x1e66f7[_0xa9a3('0x58')]['to'][0x0])?undefined:_0x1e66f7[_0xa9a3('0x58')]['to'][0x0],'AttachmentId':_0x1e66f7[_0xa9a3('0x58')]['attachments'][0x0]['id']},client9002)[_0xa9a3('0x1e')](function(_0x264e33){logger[_0xa9a3('0x1f')](_0xa9a3('0xb8'),_0x264e33);})[_0xa9a3('0x28')](function(_0x200585){logger[_0xa9a3('0x1f')](_0xa9a3('0xb8'),_0x200585);});return _0x54ec10;})[_0xa9a3('0x1e')](respondWithResult(_0x4dec1d,null))[_0xa9a3('0x28')](handleError(_0x4dec1d,null));};exports[_0xa9a3('0xb9')]=function(_0x376fa3,_0x31baf2,_0x2a64cb){return db['FaxAccount'][_0xa9a3('0x56')]({'where':{'id':_0x376fa3[_0xa9a3('0x55')]['id']}})['then'](handleEntityNotFound(_0x31baf2,null))['then'](function(_0x3ee0c3){if(_0x3ee0c3){return _0x3ee0c3['addAgents'](_0x376fa3['body'][_0xa9a3('0x65')],_['omit'](_0x376fa3['body'],[_0xa9a3('0x65'),'id'])||{})[_0xa9a3('0xb3')](function(_0x447fe9){for(var _0x59e930=0x0;_0x59e930<_0x376fa3['body'][_0xa9a3('0x65')][_0xa9a3('0x48')];_0x59e930+=0x1){socket['emit'](_0xa9a3('0xba'),{'UserId':Number(_0x376fa3['body'][_0xa9a3('0x65')][_0x59e930]),'FaxAccountId':Number(_0x376fa3[_0xa9a3('0x55')]['id'])});}return _0x447fe9;});}})[_0xa9a3('0x1e')](respondWithResult(_0x31baf2,null))[_0xa9a3('0x28')](handleError(_0x31baf2,null));};exports['removeAgents']=function(_0x29f983,_0x5e73a1,_0x5d4933){return db[_0xa9a3('0x3c')][_0xa9a3('0x56')]({'where':{'id':_0x29f983[_0xa9a3('0x55')]['id']}})['then'](handleEntityNotFound(_0x5e73a1,null))[_0xa9a3('0x1e')](function(_0x15f9fc){if(_0x15f9fc){return _0x15f9fc[_0xa9a3('0xbb')](_0x29f983[_0xa9a3('0x42')]['ids'])[_0xa9a3('0x1e')](function(){if(_[_0xa9a3('0xbc')](_0x29f983[_0xa9a3('0x42')][_0xa9a3('0x65')])){for(var _0x40a70c=0x0;_0x40a70c<_0x29f983[_0xa9a3('0x42')][_0xa9a3('0x65')][_0xa9a3('0x48')];_0x40a70c+=0x1){socket[_0xa9a3('0xbd')](_0xa9a3('0xbe'),{'UserId':Number(_0x29f983['query'][_0xa9a3('0x65')][_0x40a70c]),'FaxAccountId':Number(_0x29f983['params']['id'])});}}else{socket[_0xa9a3('0xbd')]('userFaxAccount:remove',{'UserId':Number(_0x29f983[_0xa9a3('0x42')][_0xa9a3('0x65')]),'FaxAccountId':Number(_0x29f983[_0xa9a3('0x55')]['id'])});}});}})['then'](respondWithStatusCode(_0x5e73a1,null))[_0xa9a3('0x28')](handleError(_0x5e73a1,null));};exports[_0xa9a3('0xbf')]=function(_0x6547aa,_0x4f979b,_0xbb75a3){var _0x5a3bf1={};var _0x5f059c={};var _0x526219;var _0x4467e0;return db[_0xa9a3('0x3c')][_0xa9a3('0x6a')]({'where':{'id':_0x6547aa[_0xa9a3('0x55')]['id']}})[_0xa9a3('0x1e')](handleEntityNotFound(_0x4f979b,null))['then'](function(_0x33f4ab){if(_0x33f4ab){_0x526219=_0x33f4ab;_0x5f059c['model']=_[_0xa9a3('0x43')](db[_0xa9a3('0x73')]['rawAttributes']);_0x5f059c[_0xa9a3('0x42')]=_[_0xa9a3('0x43')](_0x6547aa[_0xa9a3('0x42')]);_0x5f059c[_0xa9a3('0x44')]=_['intersection'](_0x5f059c[_0xa9a3('0x41')],_0x5f059c[_0xa9a3('0x42')]);_0x5a3bf1[_0xa9a3('0x46')]=_[_0xa9a3('0x45')](_0x5f059c[_0xa9a3('0x41')],qs[_0xa9a3('0x47')](_0x6547aa[_0xa9a3('0x42')][_0xa9a3('0x47')]));_0x5a3bf1[_0xa9a3('0x46')]=_0x5a3bf1['attributes']['length']?_0x5a3bf1[_0xa9a3('0x46')]:_0x5f059c['model'];_0x5a3bf1[_0xa9a3('0x49')]=qs[_0xa9a3('0x4a')](_0x6547aa[_0xa9a3('0x42')][_0xa9a3('0x4a')]);_0x5a3bf1[_0xa9a3('0x4b')]=qs[_0xa9a3('0x44')](_[_0xa9a3('0x4c')](_0x6547aa[_0xa9a3('0x42')],_0x5f059c[_0xa9a3('0x44')]));if(_0x6547aa[_0xa9a3('0x42')][_0xa9a3('0x4e')]){_0x5a3bf1[_0xa9a3('0x4b')]=_['merge'](_0x5a3bf1[_0xa9a3('0x4b')],{'$or':_[_0xa9a3('0x3b')](_0x5a3bf1[_0xa9a3('0x46')],function(_0x55e40e){var _0x2eb703={};_0x2eb703[_0x55e40e]={'$like':'%'+_0x6547aa[_0xa9a3('0x42')][_0xa9a3('0x4e')]+'%'};return _0x2eb703;})});}_0x5a3bf1=_[_0xa9a3('0x4f')]({},_0x5a3bf1,_0x6547aa['options']);return _0x526219[_0xa9a3('0xbf')](_0x5a3bf1);}})[_0xa9a3('0x1e')](function(_0x5e3c2b){if(_0x5e3c2b){_0x4467e0=_0x5e3c2b[_0xa9a3('0x48')];if(!_0x6547aa[_0xa9a3('0x42')][_0xa9a3('0x70')](_0xa9a3('0x6b'))){_0x5a3bf1['limit']=qs['limit'](_0x6547aa['query'][_0xa9a3('0x2f')]);_0x5a3bf1[_0xa9a3('0x2d')]=qs['offset'](_0x6547aa[_0xa9a3('0x42')]['offset']);}return _0x526219[_0xa9a3('0xbf')](_0x5a3bf1);}})[_0xa9a3('0x1e')](function(_0x3b548a){if(_0x3b548a){return _0x3b548a?{'count':_0x4467e0,'rows':_0x3b548a}:null;}})[_0xa9a3('0x1e')](respondWithResult(_0x4f979b,null))['catch'](handleError(_0x4f979b,null));}; \ No newline at end of file +var _0xe076=['sequelize','VoiceExtension','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','List','DESC','attachments','join','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','./faxAccount.socket','jayson/promise','client','http','request','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','get','FaxAccounts','UserProfileResource','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','FaxAccount','findAll','rows','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','update','describe','addDisposition','Disposition','getDispositions','findOne','sort','FaxAccountId','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','FaxInteraction','omit','getInteractions','CmContact','Contact','Owner','internal','Tag','Tags','color','tag','transaction','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','localstationid','app','system','description','Answer','push','ecm','faxdetect','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d'];(function(_0x448340,_0xdef62c){var _0x43cd6f=function(_0xefcdd7){while(--_0xefcdd7){_0x448340['push'](_0x448340['shift']());}};_0x43cd6f(++_0xdef62c);}(_0xe076,0x1a0));var _0x6e07=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xe076[_0x491a7f];return _0x3d8f44;};'use strict';var emlformat=require(_0x6e07('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6e07('0x1'));var moment=require('moment');var BPromise=require(_0x6e07('0x2'));var Mustache=require(_0x6e07('0x3'));var util=require(_0x6e07('0x4'));var path=require(_0x6e07('0x5'));var sox=require(_0x6e07('0x6'));var csv=require(_0x6e07('0x7'));var ejs=require(_0x6e07('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e07('0x9'));var squel=require(_0x6e07('0xa'));var crypto=require(_0x6e07('0xb'));var jsforce=require(_0x6e07('0xc'));var deskjs=require(_0x6e07('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6e07('0xe'));var Papa=require(_0x6e07('0xf'));var Redis=require('ioredis');var authService=require(_0x6e07('0x10'));var qs=require(_0x6e07('0x11'));var as=require(_0x6e07('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e07('0x13'))(_0x6e07('0x14'));var utils=require(_0x6e07('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6e07('0x16'));var db=require(_0x6e07('0x17'))['db'];config[_0x6e07('0x18')]=_['defaults'](config[_0x6e07('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6e07('0x18')]));require(_0x6e07('0x19'))['register'](socket);var jayson=require(_0x6e07('0x1a'));var client=jayson[_0x6e07('0x1b')][_0x6e07('0x1c')]({'port':0x232c});var client9002=jayson[_0x6e07('0x1b')][_0x6e07('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x1667ee,_0x3cedc0,_0x30f3eb,_0x5b154c){return new BPromise(function(_0x30b4e6,_0x3513e5){var _0x5b24cd=_0x5b154c||client;return _0x5b24cd[_0x6e07('0x1d')](_0x1667ee,_0x30f3eb)['then'](function(_0x3d1c65){logger['info'](_0x6e07('0x1e'),_0x3cedc0,'request\x20sent');logger[_0x6e07('0x1f')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x3cedc0,_0x6e07('0x20'),JSON[_0x6e07('0x21')](_0x3d1c65));if(_0x3d1c65[_0x6e07('0x22')]){if(_0x3d1c65['error']['code']===0x1f4){logger[_0x6e07('0x22')](_0x6e07('0x1e'),_0x3cedc0,_0x3d1c65[_0x6e07('0x22')][_0x6e07('0x23')]);return _0x3513e5(_0x3d1c65['error'][_0x6e07('0x23')]);}logger[_0x6e07('0x22')]('FaxAccount,\x20%s,\x20%s',_0x3cedc0,_0x3d1c65[_0x6e07('0x22')]['message']);return _0x30b4e6(_0x3d1c65[_0x6e07('0x22')][_0x6e07('0x23')]);}else{logger[_0x6e07('0x24')](_0x6e07('0x1e'),_0x3cedc0,'request\x20sent');_0x30b4e6(_0x3d1c65[_0x6e07('0x25')][_0x6e07('0x23')]);}})[_0x6e07('0x26')](function(_0x5b550d){logger[_0x6e07('0x22')](_0x6e07('0x1e'),_0x3cedc0,_0x5b550d);_0x3513e5(_0x5b550d);});});}function respondWithStatusCode(_0x5b3f24,_0x1902f9){_0x1902f9=_0x1902f9||0xcc;return function(_0x448d0a){if(_0x448d0a){return _0x5b3f24[_0x6e07('0x27')](_0x1902f9);}return _0x5b3f24[_0x6e07('0x28')](_0x1902f9)['end']();};}function respondWithResult(_0x5b9270,_0x3005a4){_0x3005a4=_0x3005a4||0xc8;return function(_0x4cba56){if(_0x4cba56){return _0x5b9270[_0x6e07('0x28')](_0x3005a4)[_0x6e07('0x29')](_0x4cba56);}};}function respondWithFilteredResult(_0x3a6c56,_0x505746){return function(_0x23802d){if(_0x23802d){var _0x1860b5=typeof _0x505746[_0x6e07('0x2a')]===_0x6e07('0x2b')&&typeof _0x505746[_0x6e07('0x2c')]==='undefined';var _0xde8193=_0x23802d[_0x6e07('0x2d')];var _0x254dd6=_0x1860b5?0x0:_0x505746[_0x6e07('0x2a')];var _0x2d5d1c=_0x1860b5?_0x23802d[_0x6e07('0x2d')]:_0x505746[_0x6e07('0x2a')]+_0x505746['limit'];var _0x1572eb;if(_0x2d5d1c>=_0xde8193){_0x2d5d1c=_0xde8193;_0x1572eb=0xc8;}else{_0x1572eb=0xce;}_0x3a6c56[_0x6e07('0x28')](_0x1572eb);return _0x3a6c56[_0x6e07('0x2e')](_0x6e07('0x2f'),_0x254dd6+'-'+_0x2d5d1c+'/'+_0xde8193)[_0x6e07('0x29')](_0x23802d);}return null;};}function patchUpdates(_0x49c1b3){return function(_0x22de61){try{jsonpatch['apply'](_0x22de61,_0x49c1b3,!![]);}catch(_0x328af6){return BPromise[_0x6e07('0x30')](_0x328af6);}return _0x22de61[_0x6e07('0x31')]();};}function saveUpdates(_0x39347c,_0x6cd882){return function(_0x3e0ab7){if(_0x3e0ab7){return _0x3e0ab7['update'](_0x39347c)['then'](function(_0x305b47){return _0x305b47;});}return null;};}function removeEntity(_0x46db32,_0x480f2d){return function(_0x58771e){if(_0x58771e){return _0x58771e[_0x6e07('0x32')]()[_0x6e07('0x33')](function(){var _0x2186e6=_0x58771e[_0x6e07('0x34')]({'plain':!![]});var _0x370e67=_0x6e07('0x35');return db[_0x6e07('0x36')][_0x6e07('0x32')]({'where':{'type':_0x370e67,'resourceId':_0x2186e6['id']}})[_0x6e07('0x33')](function(){return _0x58771e;});})['then'](function(){_0x46db32['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c125b,_0x26831e){return function(_0x524c55){if(!_0x524c55){_0x2c125b['sendStatus'](0x194);}return _0x524c55;};}function handleError(_0x163d4c,_0x3404c8){_0x3404c8=_0x3404c8||0x1f4;return function(_0x316e97){logger[_0x6e07('0x22')](_0x316e97[_0x6e07('0x37')]);if(_0x316e97['name']){delete _0x316e97[_0x6e07('0x38')];}_0x163d4c[_0x6e07('0x28')](_0x3404c8)['send'](_0x316e97);};}exports[_0x6e07('0x39')]=function(_0x1fc989,_0x45ccf2){var _0x32e1b8={'include':[{'model':db[_0x6e07('0x3a')],'as':_0x6e07('0x3b')}]},_0x36d529={},_0x487353={'count':0x0,'rows':[]};var _0x52692f=_[_0x6e07('0x3c')](db['FaxAccount'][_0x6e07('0x3d')],function(_0x349a39){return{'name':_0x349a39[_0x6e07('0x3e')],'type':_0x349a39[_0x6e07('0x3f')]['key']};});_0x36d529[_0x6e07('0x40')]=_[_0x6e07('0x3c')](_0x52692f,_0x6e07('0x38'));_0x36d529[_0x6e07('0x41')]=_['keys'](_0x1fc989[_0x6e07('0x41')]);_0x36d529[_0x6e07('0x42')]=_[_0x6e07('0x43')](_0x36d529[_0x6e07('0x40')],_0x36d529[_0x6e07('0x41')]);_0x32e1b8[_0x6e07('0x44')]=_[_0x6e07('0x43')](_0x36d529[_0x6e07('0x40')],qs[_0x6e07('0x45')](_0x1fc989[_0x6e07('0x41')]['fields']));_0x32e1b8[_0x6e07('0x44')]=_0x32e1b8[_0x6e07('0x44')][_0x6e07('0x46')]?_0x32e1b8[_0x6e07('0x44')]:_0x36d529[_0x6e07('0x40')];if(!_0x1fc989['query'][_0x6e07('0x47')](_0x6e07('0x48'))){_0x32e1b8['limit']=qs[_0x6e07('0x2c')](_0x1fc989[_0x6e07('0x41')][_0x6e07('0x2c')]);_0x32e1b8[_0x6e07('0x2a')]=qs[_0x6e07('0x2a')](_0x1fc989[_0x6e07('0x41')][_0x6e07('0x2a')]);}_0x32e1b8[_0x6e07('0x49')]=qs['sort'](_0x1fc989[_0x6e07('0x41')]['sort']);_0x32e1b8[_0x6e07('0x4a')]=qs[_0x6e07('0x42')](_[_0x6e07('0x4b')](_0x1fc989[_0x6e07('0x41')],_0x36d529[_0x6e07('0x42')]),_0x52692f);if(_0x1fc989[_0x6e07('0x41')][_0x6e07('0x4c')]){_0x32e1b8[_0x6e07('0x4a')]=_[_0x6e07('0x4d')](_0x32e1b8['where'],{'$or':_[_0x6e07('0x3c')](_0x52692f,function(_0x41aecc){if(_0x41aecc['type']!==_0x6e07('0x4e')){var _0x477221={};_0x477221[_0x41aecc[_0x6e07('0x38')]]={'$like':'%'+_0x1fc989['query'][_0x6e07('0x4c')]+'%'};return _0x477221;}})});}_0x32e1b8=_[_0x6e07('0x4d')]({},_0x32e1b8,_0x1fc989['options']);var _0xb02a29={'where':_0x32e1b8[_0x6e07('0x4a')]};return db['FaxAccount'][_0x6e07('0x2d')](_0xb02a29)[_0x6e07('0x33')](function(_0x27acfe){_0x487353[_0x6e07('0x2d')]=_0x27acfe;if(_0x1fc989[_0x6e07('0x41')][_0x6e07('0x4f')]){_0x32e1b8[_0x6e07('0x50')]=[{'all':!![]}];}return db[_0x6e07('0x51')][_0x6e07('0x52')](_0x32e1b8);})[_0x6e07('0x33')](function(_0x45feaf){_0x487353[_0x6e07('0x53')]=_0x45feaf;return _0x487353;})[_0x6e07('0x33')](respondWithFilteredResult(_0x45ccf2,_0x32e1b8))['catch'](handleError(_0x45ccf2,null));};exports[_0x6e07('0x54')]=function(_0x173636,_0x1a71f8){var _0x3412a0={'raw':![],'where':{'id':_0x173636[_0x6e07('0x55')]['id']},'include':[{'model':db[_0x6e07('0x3a')],'as':_0x6e07('0x3b')}]},_0x34f47d={};_0x34f47d['model']=_[_0x6e07('0x56')](db[_0x6e07('0x51')]['rawAttributes']);_0x34f47d[_0x6e07('0x41')]=_['keys'](_0x173636['query']);_0x34f47d[_0x6e07('0x42')]=_['intersection'](_0x34f47d[_0x6e07('0x40')],_0x34f47d[_0x6e07('0x41')]);_0x3412a0[_0x6e07('0x44')]=_[_0x6e07('0x43')](_0x34f47d[_0x6e07('0x40')],qs[_0x6e07('0x45')](_0x173636[_0x6e07('0x41')][_0x6e07('0x45')]));_0x3412a0[_0x6e07('0x44')]=_0x3412a0[_0x6e07('0x44')]['length']?_0x3412a0[_0x6e07('0x44')]:_0x34f47d[_0x6e07('0x40')];if(_0x173636[_0x6e07('0x41')][_0x6e07('0x4f')]){_0x3412a0[_0x6e07('0x50')]=[{'all':!![]}];}_0x3412a0=_[_0x6e07('0x4d')]({},_0x3412a0,_0x173636[_0x6e07('0x57')]);return db[_0x6e07('0x51')][_0x6e07('0x58')](_0x3412a0)[_0x6e07('0x33')](handleEntityNotFound(_0x1a71f8,null))[_0x6e07('0x33')](respondWithResult(_0x1a71f8,null))[_0x6e07('0x26')](handleError(_0x1a71f8,null));};exports[_0x6e07('0x59')]=function(_0x16c533,_0x196690){return db[_0x6e07('0x51')][_0x6e07('0x59')](_0x16c533[_0x6e07('0x5a')],{})[_0x6e07('0x33')](function(_0x5eac5b){var _0x34df82=_0x16c533[_0x6e07('0x5b')][_0x6e07('0x34')]({'plain':!![]});if(!_0x34df82)throw new Error(_0x6e07('0x5c'));if(_0x34df82[_0x6e07('0x5d')]==='user'){var _0x5cf1c2=_0x5eac5b[_0x6e07('0x34')]({'plain':!![]});var _0x4cf1af=_0x6e07('0x35');return db[_0x6e07('0x5e')][_0x6e07('0x58')]({'where':{'name':_0x4cf1af,'userProfileId':_0x34df82['userProfileId']},'raw':!![]})['then'](function(_0x99d8b0){if(_0x99d8b0&&_0x99d8b0[_0x6e07('0x5f')]===0x0){return db[_0x6e07('0x36')][_0x6e07('0x59')]({'name':_0x5cf1c2[_0x6e07('0x38')],'resourceId':_0x5cf1c2['id'],'type':_0x99d8b0[_0x6e07('0x38')],'sectionId':_0x99d8b0['id']},{})[_0x6e07('0x33')](function(){return _0x5eac5b;});}else{return _0x5eac5b;}})[_0x6e07('0x26')](function(_0x507987){logger[_0x6e07('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x507987);throw _0x507987;});}return _0x5eac5b;})[_0x6e07('0x33')](respondWithResult(_0x196690,0xc9))[_0x6e07('0x26')](handleError(_0x196690,null));};exports[_0x6e07('0x60')]=function(_0x182964,_0x154fb0){if(_0x182964[_0x6e07('0x5a')]['id']){delete _0x182964[_0x6e07('0x5a')]['id'];}return db[_0x6e07('0x51')]['find']({'where':{'id':_0x182964['params']['id']},'include':[{'model':db[_0x6e07('0x3a')],'as':'mandatoryDispositionPause'}]})[_0x6e07('0x33')](handleEntityNotFound(_0x154fb0,null))['then'](saveUpdates(_0x182964[_0x6e07('0x5a')],null))['then'](respondWithResult(_0x154fb0,null))[_0x6e07('0x26')](handleError(_0x154fb0,null));};exports[_0x6e07('0x32')]=function(_0x29bd55,_0x46f9fb){return db[_0x6e07('0x51')][_0x6e07('0x58')]({'where':{'id':_0x29bd55[_0x6e07('0x55')]['id']}})[_0x6e07('0x33')](handleEntityNotFound(_0x46f9fb,null))[_0x6e07('0x33')](removeEntity(_0x46f9fb,null))[_0x6e07('0x26')](handleError(_0x46f9fb,null));};exports[_0x6e07('0x61')]=function(_0x2a4dda,_0x106189){return db[_0x6e07('0x51')]['describe']()[_0x6e07('0x33')](respondWithResult(_0x106189,null))['catch'](handleError(_0x106189,null));};exports[_0x6e07('0x62')]=function(_0x107975,_0x3ab2cb,_0x520370){if(_0x107975[_0x6e07('0x5a')]['id']){delete _0x107975[_0x6e07('0x5a')]['id'];}return db['FaxAccount'][_0x6e07('0x58')]({'where':{'id':_0x107975[_0x6e07('0x55')]['id']}})[_0x6e07('0x33')](handleEntityNotFound(_0x3ab2cb,null))[_0x6e07('0x33')](function(_0x59cd5c){if(_0x59cd5c){_0x107975[_0x6e07('0x5a')]['FaxAccountId']=_0x59cd5c['id'];return db[_0x6e07('0x63')][_0x6e07('0x59')](_0x107975['body']);}})[_0x6e07('0x33')](respondWithResult(_0x3ab2cb,null))[_0x6e07('0x26')](handleError(_0x3ab2cb,null));};exports[_0x6e07('0x64')]=function(_0x5987bd,_0x5ca108,_0x30b9c4){var _0x22dbda={'raw':![],'where':{}};var _0x42d21b={};var _0x2f24fa={'count':0x0,'rows':[]};return db[_0x6e07('0x51')][_0x6e07('0x65')]({'where':{'id':_0x5987bd[_0x6e07('0x55')]['id']}})[_0x6e07('0x33')](handleEntityNotFound(_0x5ca108,null))['then'](function(_0x5471dd){if(_0x5471dd){_0x42d21b[_0x6e07('0x40')]=_[_0x6e07('0x56')](db[_0x6e07('0x63')][_0x6e07('0x3d')]);_0x42d21b[_0x6e07('0x41')]=_['keys'](_0x5987bd[_0x6e07('0x41')]);_0x42d21b['filters']=_[_0x6e07('0x43')](_0x42d21b[_0x6e07('0x40')],_0x42d21b[_0x6e07('0x41')]);_0x22dbda[_0x6e07('0x44')]=_[_0x6e07('0x43')](_0x42d21b[_0x6e07('0x40')],qs[_0x6e07('0x45')](_0x5987bd[_0x6e07('0x41')][_0x6e07('0x45')]));_0x22dbda['attributes']=_0x22dbda['attributes'][_0x6e07('0x46')]?_0x22dbda['attributes']:_0x42d21b[_0x6e07('0x40')];if(!_0x5987bd[_0x6e07('0x41')][_0x6e07('0x47')]('nolimit')){_0x22dbda['limit']=qs[_0x6e07('0x2c')](_0x5987bd[_0x6e07('0x41')]['limit']);_0x22dbda[_0x6e07('0x2a')]=qs['offset'](_0x5987bd['query'][_0x6e07('0x2a')]);}_0x22dbda[_0x6e07('0x49')]=qs[_0x6e07('0x66')](_0x5987bd['query'][_0x6e07('0x66')]);_0x22dbda[_0x6e07('0x4a')]=qs[_0x6e07('0x42')](_['pick'](_0x5987bd['query'],_0x42d21b[_0x6e07('0x42')]));_0x22dbda['where'][_0x6e07('0x67')]=_0x5471dd['id'];if(_0x5987bd[_0x6e07('0x41')][_0x6e07('0x4c')]){_0x22dbda['where']=_[_0x6e07('0x4d')](_0x22dbda[_0x6e07('0x4a')],{'$or':_[_0x6e07('0x3c')](_0x22dbda[_0x6e07('0x44')],function(_0x29e934){var _0x720e4d={};_0x720e4d[_0x29e934]={'$like':'%'+_0x5987bd[_0x6e07('0x41')][_0x6e07('0x4c')]+'%'};return _0x720e4d;})});}_0x22dbda=_[_0x6e07('0x4d')]({},_0x22dbda,_0x5987bd[_0x6e07('0x57')]);return db[_0x6e07('0x63')][_0x6e07('0x2d')]({'where':_0x22dbda['where']})[_0x6e07('0x33')](function(_0x531f50){_0x2f24fa[_0x6e07('0x2d')]=_0x531f50;if(_0x5987bd[_0x6e07('0x41')][_0x6e07('0x4f')]){_0x22dbda[_0x6e07('0x50')]=[{'all':!![]}];}return db[_0x6e07('0x63')][_0x6e07('0x52')](_0x22dbda);})[_0x6e07('0x33')](function(_0x52f30c){_0x2f24fa[_0x6e07('0x53')]=_0x52f30c;return _0x2f24fa;});}})[_0x6e07('0x33')](respondWithFilteredResult(_0x5ca108,_0x22dbda))[_0x6e07('0x26')](handleError(_0x5ca108,null));};exports['removeDispositions']=function(_0x2928d9,_0x1e7247,_0x4d06ea){return db['FaxAccount'][_0x6e07('0x58')]({'where':{'id':_0x2928d9[_0x6e07('0x55')]['id']}})[_0x6e07('0x33')](handleEntityNotFound(_0x1e7247,null))['then'](function(_0x454fce){if(_0x454fce){return _0x454fce[_0x6e07('0x68')](_0x2928d9[_0x6e07('0x41')]['ids']);}})[_0x6e07('0x33')](respondWithStatusCode(_0x1e7247,null))[_0x6e07('0x26')](handleError(_0x1e7247,null));};exports[_0x6e07('0x69')]=function(_0x10c3cb,_0x38d0f9,_0x33ca78){if(_0x10c3cb[_0x6e07('0x5a')]['id']){delete _0x10c3cb[_0x6e07('0x5a')]['id'];}return db[_0x6e07('0x51')][_0x6e07('0x58')]({'where':{'id':_0x10c3cb['params']['id']}})[_0x6e07('0x33')](handleEntityNotFound(_0x38d0f9,null))[_0x6e07('0x33')](function(_0x5c4507){if(_0x5c4507){_0x10c3cb[_0x6e07('0x5a')][_0x6e07('0x67')]=_0x5c4507['id'];return db[_0x6e07('0x6a')]['create'](_0x10c3cb[_0x6e07('0x5a')]);}})[_0x6e07('0x33')](respondWithResult(_0x38d0f9,null))[_0x6e07('0x26')](handleError(_0x38d0f9,null));};exports[_0x6e07('0x6b')]=function(_0x29b35a,_0x18ac7a,_0x56bd69){var _0x1dbcd2={'raw':![],'where':{}};var _0x15d261={};var _0x4eada1={'count':0x0,'rows':[]};return db[_0x6e07('0x51')][_0x6e07('0x65')]({'where':{'id':_0x29b35a[_0x6e07('0x55')]['id']}})['then'](handleEntityNotFound(_0x18ac7a,null))[_0x6e07('0x33')](function(_0x1b2768){if(_0x1b2768){_0x15d261[_0x6e07('0x40')]=_[_0x6e07('0x56')](db[_0x6e07('0x6a')][_0x6e07('0x3d')]);_0x15d261[_0x6e07('0x41')]=_[_0x6e07('0x56')](_0x29b35a[_0x6e07('0x41')]);_0x15d261[_0x6e07('0x42')]=_[_0x6e07('0x43')](_0x15d261[_0x6e07('0x40')],_0x15d261[_0x6e07('0x41')]);_0x1dbcd2[_0x6e07('0x44')]=_[_0x6e07('0x43')](_0x15d261['model'],qs[_0x6e07('0x45')](_0x29b35a[_0x6e07('0x41')]['fields']));_0x1dbcd2[_0x6e07('0x44')]=_0x1dbcd2[_0x6e07('0x44')][_0x6e07('0x46')]?_0x1dbcd2[_0x6e07('0x44')]:_0x15d261[_0x6e07('0x40')];if(!_0x29b35a['query'][_0x6e07('0x47')](_0x6e07('0x48'))){_0x1dbcd2[_0x6e07('0x2c')]=qs[_0x6e07('0x2c')](_0x29b35a[_0x6e07('0x41')]['limit']);_0x1dbcd2[_0x6e07('0x2a')]=qs[_0x6e07('0x2a')](_0x29b35a[_0x6e07('0x41')]['offset']);}_0x1dbcd2[_0x6e07('0x49')]=qs['sort'](_0x29b35a[_0x6e07('0x41')][_0x6e07('0x66')]);_0x1dbcd2[_0x6e07('0x4a')]=qs['filters'](_[_0x6e07('0x4b')](_0x29b35a[_0x6e07('0x41')],_0x15d261[_0x6e07('0x42')]));_0x1dbcd2[_0x6e07('0x4a')][_0x6e07('0x67')]=_0x1b2768['id'];if(_0x29b35a[_0x6e07('0x41')][_0x6e07('0x4c')]){_0x1dbcd2['where']=_['merge'](_0x1dbcd2[_0x6e07('0x4a')],{'$or':_[_0x6e07('0x3c')](_0x1dbcd2['attributes'],function(_0x457f79){var _0x2d07eb={};_0x2d07eb[_0x457f79]={'$like':'%'+_0x29b35a['query'][_0x6e07('0x4c')]+'%'};return _0x2d07eb;})});}_0x1dbcd2=_[_0x6e07('0x4d')]({},_0x1dbcd2,_0x29b35a['options']);return db['CannedAnswer']['count']({'where':_0x1dbcd2[_0x6e07('0x4a')]})[_0x6e07('0x33')](function(_0xc942b4){_0x4eada1[_0x6e07('0x2d')]=_0xc942b4;if(_0x29b35a[_0x6e07('0x41')][_0x6e07('0x4f')]){_0x1dbcd2[_0x6e07('0x50')]=[{'all':!![]}];}return db[_0x6e07('0x6a')]['findAll'](_0x1dbcd2);})[_0x6e07('0x33')](function(_0x49f8f2){_0x4eada1[_0x6e07('0x53')]=_0x49f8f2;return _0x4eada1;});}})[_0x6e07('0x33')](respondWithFilteredResult(_0x18ac7a,_0x1dbcd2))[_0x6e07('0x26')](handleError(_0x18ac7a,null));};exports['removeAnswers']=function(_0x31f351,_0x4b1b45,_0x41f7a7){return db['FaxAccount']['find']({'where':{'id':_0x31f351[_0x6e07('0x55')]['id']}})[_0x6e07('0x33')](handleEntityNotFound(_0x4b1b45,null))['then'](function(_0x2b7962){if(_0x2b7962){return _0x2b7962[_0x6e07('0x6c')](_0x31f351[_0x6e07('0x41')][_0x6e07('0x6d')]);}})[_0x6e07('0x33')](respondWithStatusCode(_0x4b1b45,null))[_0x6e07('0x26')](handleError(_0x4b1b45,null));};exports['addInteraction']=function(_0x5e4e1b,_0x43cffc,_0x2e7645){return db[_0x6e07('0x6e')]['find']({'where':{'id':_0x5e4e1b['params']['id']}})['then'](handleEntityNotFound(_0x43cffc,null))[_0x6e07('0x33')](function(_0x406417){if(_0x406417){return _0x406417['addInteraction'](_0x5e4e1b['body'][_0x6e07('0x6d')],_[_0x6e07('0x6f')](_0x5e4e1b[_0x6e07('0x5a')],[_0x6e07('0x6d'),'id'])||{});}})[_0x6e07('0x33')](respondWithResult(_0x43cffc,null))[_0x6e07('0x26')](handleError(_0x43cffc,null));};exports[_0x6e07('0x70')]=function(_0x3269c9,_0x579461,_0x2fa0f7){var _0x15ea44={'raw':![],'where':{}};var _0x2dd5c5={};var _0x241dbe={'count':0x0,'rows':[]};return db[_0x6e07('0x51')]['findOne']({'where':{'id':_0x3269c9['params']['id']}})['then'](handleEntityNotFound(_0x579461,null))[_0x6e07('0x33')](function(_0x53faae){if(_0x53faae){_0x2dd5c5['model']=_[_0x6e07('0x56')](db[_0x6e07('0x6e')][_0x6e07('0x3d')]);_0x2dd5c5[_0x6e07('0x41')]=_[_0x6e07('0x56')](_0x3269c9[_0x6e07('0x41')]);_0x2dd5c5['filters']=_[_0x6e07('0x43')](_0x2dd5c5[_0x6e07('0x40')],_0x2dd5c5[_0x6e07('0x41')]);_0x15ea44[_0x6e07('0x44')]=_['intersection'](_0x2dd5c5[_0x6e07('0x40')],qs[_0x6e07('0x45')](_0x3269c9[_0x6e07('0x41')][_0x6e07('0x45')]));_0x15ea44[_0x6e07('0x44')]=_0x15ea44['attributes'][_0x6e07('0x46')]?_0x15ea44[_0x6e07('0x44')]:_0x2dd5c5[_0x6e07('0x40')];if(!_0x3269c9[_0x6e07('0x41')][_0x6e07('0x47')](_0x6e07('0x48'))){_0x15ea44[_0x6e07('0x2c')]=qs[_0x6e07('0x2c')](_0x3269c9['query'][_0x6e07('0x2c')]);_0x15ea44[_0x6e07('0x2a')]=qs[_0x6e07('0x2a')](_0x3269c9['query']['offset']);}_0x15ea44[_0x6e07('0x49')]=qs['sort'](_0x3269c9[_0x6e07('0x41')][_0x6e07('0x66')]);_0x15ea44[_0x6e07('0x4a')]=qs[_0x6e07('0x42')](_[_0x6e07('0x4b')](_0x3269c9[_0x6e07('0x41')],_0x2dd5c5[_0x6e07('0x42')]));_0x15ea44[_0x6e07('0x4a')][_0x6e07('0x67')]=_0x53faae['id'];if(_0x3269c9[_0x6e07('0x41')]['filter']){_0x15ea44[_0x6e07('0x4a')]=_[_0x6e07('0x4d')](_0x15ea44[_0x6e07('0x4a')],{'$or':_[_0x6e07('0x3c')](_0x15ea44[_0x6e07('0x44')],function(_0x519618){var _0x178665={};_0x178665[_0x519618]={'$like':'%'+_0x3269c9[_0x6e07('0x41')]['filter']+'%'};return _0x178665;})});}_0x15ea44=_[_0x6e07('0x4d')]({},_0x15ea44,_0x3269c9['options']);return db[_0x6e07('0x6e')][_0x6e07('0x2d')]({'where':_0x15ea44[_0x6e07('0x4a')]})[_0x6e07('0x33')](function(_0x2a45eb){_0x241dbe['count']=_0x2a45eb;if(_0x3269c9[_0x6e07('0x41')][_0x6e07('0x4f')]){_0x15ea44[_0x6e07('0x50')]=[{'model':db[_0x6e07('0x71')],'as':_0x6e07('0x72'),'required':![]},{'model':db['User'],'as':_0x6e07('0x73'),'attributes':[_0x6e07('0x38'),'fullname',_0x6e07('0x74')],'required':![]},{'model':db[_0x6e07('0x75')],'as':_0x6e07('0x76'),'attributes':['id',_0x6e07('0x38'),_0x6e07('0x77')],'where':_0x3269c9[_0x6e07('0x41')][_0x6e07('0x78')]?{'id':_0x3269c9['query']['tag']}:undefined,'required':_0x3269c9[_0x6e07('0x41')][_0x6e07('0x78')]?!![]:![]}];}return db[_0x6e07('0x6e')]['findAll'](_0x15ea44);})['then'](function(_0xc44e64){_0x241dbe['rows']=_0xc44e64;return _0x241dbe;});}})[_0x6e07('0x33')](respondWithFilteredResult(_0x579461,_0x15ea44))['catch'](handleError(_0x579461,null));};exports['addApplications']=function(_0x1b80b5,_0x875c1d,_0x262f1a){return db[_0x6e07('0x51')][_0x6e07('0x65')]({'where':{'id':_0x1b80b5[_0x6e07('0x55')]['id']}})[_0x6e07('0x33')](handleEntityNotFound(_0x875c1d,null))['then'](function(_0x14abe1){if(_0x14abe1){return db['sequelize'][_0x6e07('0x79')](function(_0x25fca0){return db[_0x6e07('0x7a')][_0x6e07('0x32')]({'where':{'FaxAccountId':_0x1b80b5[_0x6e07('0x55')]['id']},'transaction':_0x25fca0})['then'](function(_0x53117e){var _0x5300cd=_[_0x6e07('0x3c')](_0x1b80b5[_0x6e07('0x5a')],function(_0x3a0bb5){_0x3a0bb5[_0x6e07('0x67')]=_0x1b80b5[_0x6e07('0x55')]['id'];return _0x3a0bb5;});return db[_0x6e07('0x7a')][_0x6e07('0x7b')](_0x5300cd,{'transaction':_0x25fca0});});})[_0x6e07('0x33')](function(){return db['FaxApplication'][_0x6e07('0x7c')]({'where':{'FaxAccountId':_0x1b80b5[_0x6e07('0x55')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x875c1d,null))[_0x6e07('0x26')](handleError(_0x875c1d,null));};exports['getApplications']=function(_0x5d6679,_0x269517,_0x32d136){var _0x58e2b7={};var _0x59b1a8={};var _0x212c50;var _0x285925;return db[_0x6e07('0x51')][_0x6e07('0x65')]({'where':{'id':_0x5d6679[_0x6e07('0x55')]['id']}})[_0x6e07('0x33')](handleEntityNotFound(_0x269517,null))['then'](function(_0x5ba364){if(_0x5ba364){_0x212c50=_0x5ba364;_0x59b1a8[_0x6e07('0x40')]=_[_0x6e07('0x56')](db[_0x6e07('0x7a')][_0x6e07('0x3d')]);_0x59b1a8[_0x6e07('0x41')]=_[_0x6e07('0x56')](_0x5d6679[_0x6e07('0x41')]);_0x59b1a8[_0x6e07('0x42')]=_[_0x6e07('0x43')](_0x59b1a8[_0x6e07('0x40')],_0x59b1a8[_0x6e07('0x41')]);_0x58e2b7[_0x6e07('0x44')]=_[_0x6e07('0x43')](_0x59b1a8['model'],qs[_0x6e07('0x45')](_0x5d6679[_0x6e07('0x41')][_0x6e07('0x45')]));_0x58e2b7['attributes']=_0x58e2b7['attributes']['length']?_0x58e2b7[_0x6e07('0x44')]:_0x59b1a8['model'];_0x58e2b7['order']=qs['sort'](_0x5d6679['query'][_0x6e07('0x66')]);_0x58e2b7[_0x6e07('0x4a')]=qs['filters'](_[_0x6e07('0x4b')](_0x5d6679['query'],_0x59b1a8[_0x6e07('0x42')]));if(_0x5d6679[_0x6e07('0x41')][_0x6e07('0x4c')]){_0x58e2b7[_0x6e07('0x4a')]=_[_0x6e07('0x4d')](_0x58e2b7['where'],{'$or':_[_0x6e07('0x3c')](_0x58e2b7[_0x6e07('0x44')],function(_0xe2a08){var _0x3a29b4={};_0x3a29b4[_0xe2a08]={'$like':'%'+_0x5d6679[_0x6e07('0x41')][_0x6e07('0x4c')]+'%'};return _0x3a29b4;})});}_0x58e2b7=_[_0x6e07('0x4d')]({},_0x58e2b7,_0x5d6679[_0x6e07('0x57')]);return _0x212c50[_0x6e07('0x7d')](_0x58e2b7);}})['then'](function(_0x3bb736){if(_0x3bb736){_0x285925=_0x3bb736['length'];if(!_0x5d6679['query'][_0x6e07('0x47')]('nolimit')){_0x58e2b7[_0x6e07('0x2c')]=qs['limit'](_0x5d6679[_0x6e07('0x41')]['limit']);_0x58e2b7[_0x6e07('0x2a')]=qs[_0x6e07('0x2a')](_0x5d6679[_0x6e07('0x41')][_0x6e07('0x2a')]);}return _0x212c50[_0x6e07('0x7d')](_0x58e2b7);}})[_0x6e07('0x33')](function(_0x1179ac){if(_0x1179ac){return _0x1179ac?{'count':_0x285925,'rows':_0x1179ac}:null;}})[_0x6e07('0x33')](respondWithResult(_0x269517,null))['catch'](handleError(_0x269517,null));};function Extension(_0x41ac2a,_0x5e54c7,_0x40b3e6,_0x4b23c4){this[_0x6e07('0x7e')]=_0x6e07('0x7f');this['exten']=_0x41ac2a[_0x6e07('0x80')];this[_0x6e07('0x81')]=_0x4b23c4;this[_0x6e07('0x3f')]=_0x6e07('0x82');this[_0x6e07('0x83')]='Fax\x20Extension';this[_0x6e07('0x67')]=_0x41ac2a['id'];this['priority']=_0x5e54c7;this['appdata']=_0x40b3e6;}function createExtensionsReciveFax(_0x2f1e79){var _0x384c02=0x1;var _0x2f9969=[];_0x2f9969['push'](new Extension(_0x2f1e79,_0x384c02,'',_0x6e07('0x84')));_0x384c02+=0x1;_0x2f9969[_0x6e07('0x85')](new Extension(_0x2f1e79,_0x384c02,'CDR(type)=inbound-fax','Set'));_0x384c02+=0x1;for(var _0x212f81 in _0x2f1e79){if(_0x2f1e79[_0x6e07('0x47')](_0x212f81)&&(_0x212f81===_0x6e07('0x86')||_0x212f81===_0x6e07('0x80')||_0x212f81==='gateway'||_0x212f81===_0x6e07('0x87')||_0x212f81==='headerinfo'||_0x212f81==='maxrate'||_0x212f81===_0x6e07('0x88')||_0x212f81===_0x6e07('0x89')||_0x212f81===_0x6e07('0x8a'))){_0x2f9969[_0x6e07('0x85')](new Extension(_0x2f1e79,_0x384c02,_0x6e07('0x8b')+_0x212f81+')='+_0x2f1e79[_0x212f81],'Set'));_0x384c02+=0x1;}}_0x2f9969[_0x6e07('0x85')](new Extension(_0x2f1e79,_0x384c02,'6',_0x6e07('0x8c')));_0x384c02+=0x1;_0x2f9969[_0x6e07('0x85')](new Extension(_0x2f1e79,_0x384c02,_0x6e07('0x8d'),'ReceiveFax'));_0x384c02=0x0;return _0x2f9969;}exports['addAccountApplications']=function(_0x4164a6,_0x4cb32f,_0x10e6f7){var _0x58bf74;return db[_0x6e07('0x8e')][_0x6e07('0x79')](function(_0x3d64f3){return db[_0x6e07('0x51')]['create'](_0x4164a6[_0x6e07('0x5a')],{'transaction':_0x3d64f3})[_0x6e07('0x33')](function(_0x1f3ff6){_0x58bf74=_0x1f3ff6[_0x6e07('0x34')]({'plain':!![]});return db[_0x6e07('0x8f')][_0x6e07('0x7b')](createExtensionsReciveFax(_0x58bf74),{'transaction':_0x3d64f3});});})[_0x6e07('0x33')](function(){return _0x58bf74;})[_0x6e07('0x33')](respondWithResult(_0x4cb32f,null))[_0x6e07('0x26')](handleError(_0x4cb32f,null));};exports['updateAccountApplications']=function(_0x192c2f,_0x142b21,_0xdd4abc){var _0x1cd172;return db['sequelize']['transaction'](function(_0x4b282f){return db[_0x6e07('0x51')][_0x6e07('0x60')](_0x192c2f['body'],{'where':{'id':_0x192c2f[_0x6e07('0x5a')]['id']},'transaction':_0x4b282f})[_0x6e07('0x33')](function(_0x4aeeb5){return db[_0x6e07('0x8f')][_0x6e07('0x32')]({'where':{'FaxAccountId':_0x192c2f['body']['id']},'transaction':_0x4b282f})[_0x6e07('0x33')](function(_0x1ab505){return db[_0x6e07('0x8f')]['bulkCreate'](createExtensionsReciveFax(_[_0x6e07('0x6f')](_0x192c2f[_0x6e07('0x5a')],['tech',_0x6e07('0x90'),_0x6e07('0x91'),_0x6e07('0x92'),_0x6e07('0x93'),_0x6e07('0x94')])),{'transaction':_0x4b282f});});});})[_0x6e07('0x33')](function(){return db[_0x6e07('0x51')][_0x6e07('0x95')](_0x192c2f['body']['id']);})['then'](respondWithResult(_0x142b21,null))['catch'](handleError(_0x142b21,null));};exports[_0x6e07('0x96')]=function(_0x496d85,_0x27c5b1,_0x309e5b){var _0xb7cff0={'raw':!![],'where':{}};var _0x372727={};var _0x2ebdc3={'count':0x0,'rows':[]};return db[_0x6e07('0x51')][_0x6e07('0x65')]({'where':{'id':_0x496d85[_0x6e07('0x55')]['id']}})['then'](handleEntityNotFound(_0x27c5b1,null))['then'](function(_0x36e59a){if(_0x36e59a){_0x372727[_0x6e07('0x40')]=_[_0x6e07('0x56')](db[_0x6e07('0x97')][_0x6e07('0x3d')]);_0x372727[_0x6e07('0x41')]=_[_0x6e07('0x56')](_0x496d85[_0x6e07('0x41')]);_0x372727[_0x6e07('0x42')]=_['intersection'](_0x372727['model'],_0x372727[_0x6e07('0x41')]);_0xb7cff0['attributes']=_[_0x6e07('0x43')](_0x372727[_0x6e07('0x40')],qs[_0x6e07('0x45')](_0x496d85[_0x6e07('0x41')][_0x6e07('0x45')]));_0xb7cff0[_0x6e07('0x44')]=_0xb7cff0[_0x6e07('0x44')][_0x6e07('0x46')]?_0xb7cff0[_0x6e07('0x44')]:_0x372727[_0x6e07('0x40')];if(!_0x496d85['query']['hasOwnProperty'](_0x6e07('0x48'))){_0xb7cff0[_0x6e07('0x2c')]=qs['limit'](_0x496d85['query'][_0x6e07('0x2c')]);_0xb7cff0[_0x6e07('0x2a')]=qs['offset'](_0x496d85['query'][_0x6e07('0x2a')]);}_0xb7cff0[_0x6e07('0x49')]=qs['sort'](_0x496d85[_0x6e07('0x41')][_0x6e07('0x66')]);_0xb7cff0['where']=qs[_0x6e07('0x42')](_['pick'](_0x496d85['query'],_0x372727[_0x6e07('0x42')]));_0xb7cff0[_0x6e07('0x4a')][_0x6e07('0x67')]=_0x36e59a['id'];if(_0x496d85[_0x6e07('0x41')][_0x6e07('0x4c')]){_0xb7cff0[_0x6e07('0x4a')]=_['merge'](_0xb7cff0[_0x6e07('0x4a')],{'$or':_[_0x6e07('0x3c')](_0xb7cff0['attributes'],function(_0x31fc44){var _0x37e1c0={};_0x37e1c0[_0x31fc44]={'$like':'%'+_0x496d85['query'][_0x6e07('0x4c')]+'%'};return _0x37e1c0;})});}if(_0x496d85[_0x6e07('0x41')][_0x6e07('0x98')]){var _0x45a79a=_0x496d85['query'][_0x6e07('0x98')][_0x6e07('0x99')](',');var _0x2a48ea={};_0x2a48ea[_0x45a79a[0x0]]={'$gte':moment(_0x45a79a[0x1])[_0x6e07('0x9a')]('YYYY-MM-DD\x20HH:mm:ss')};_0xb7cff0[_0x6e07('0x4a')]=_['merge'](_0xb7cff0[_0x6e07('0x4a')],_0x2a48ea);}_0xb7cff0=_[_0x6e07('0x4d')]({},_0xb7cff0,_0x496d85[_0x6e07('0x57')]);return db[_0x6e07('0x97')]['count']({'where':_0xb7cff0['where']})[_0x6e07('0x33')](function(_0x25b8f8){_0x2ebdc3[_0x6e07('0x2d')]=_0x25b8f8;if(_0x496d85[_0x6e07('0x41')][_0x6e07('0x4f')]){_0xb7cff0[_0x6e07('0x50')]=[{'all':!![]}];}return db[_0x6e07('0x97')]['findAll'](_0xb7cff0);})[_0x6e07('0x33')](function(_0x25377){_0x2ebdc3['rows']=_0x25377;return _0x2ebdc3;});}})['then'](respondWithFilteredResult(_0x27c5b1,_0xb7cff0))[_0x6e07('0x26')](handleError(_0x27c5b1,null));};exports['send']=function(_0x41c660,_0x3d1bf4,_0x152497){var _0x230c24,_0x825966={},_0x1abf84;if(_0x41c660[_0x6e07('0x5a')]['to']){_0x1abf84=_0x41c660[_0x6e07('0x5a')]['to'][0x0];}return db[_0x6e07('0x51')][_0x6e07('0x58')]({'where':{'id':_0x41c660[_0x6e07('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0x6e07('0x9b'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x1abf84},'limit':0x1,'order':[[_0x6e07('0x92'),_0x6e07('0x9c')]]}]}]})[_0x6e07('0x33')](handleEntityNotFound(_0x3d1bf4,null))[_0x6e07('0x33')](function(_0x57635f){_0x230c24=_0x57635f;if(_0x41c660[_0x6e07('0x5a')][_0x6e07('0x9d')]&&_0x41c660['body'][_0x6e07('0x9d')][_0x6e07('0x46')]){for(var _0x2b8989=0x0;_0x2b8989<_0x41c660[_0x6e07('0x5a')][_0x6e07('0x9d')][_0x6e07('0x46')];_0x2b8989+=0x1){_0x41c660[_0x6e07('0x5a')][_0x6e07('0x9d')][_0x2b8989]={'filename':_0x41c660['body'][_0x6e07('0x9d')][_0x2b8989][_0x6e07('0x38')],'id':_0x41c660[_0x6e07('0x5a')]['attachments'][_0x2b8989]['id'],'path':path[_0x6e07('0x9e')](config['root'],_0x6e07('0x9f'),_0x41c660[_0x6e07('0x5a')][_0x6e07('0x9d')][_0x2b8989]['basename'])};}}return respondWithRpcPromise(_0x6e07('0xa0'),'CheckAfterSend',{'FaxAccountId':_[_0x6e07('0xa1')](_0x41c660['params']['id'])?undefined:_0x41c660[_0x6e07('0x55')]['id'],'path':_['isNil'](_0x41c660[_0x6e07('0x5a')][_0x6e07('0x9d')][0x0][_0x6e07('0x5')])?undefined:_0x41c660['body'][_0x6e07('0x9d')][0x0][_0x6e07('0x5')],'fax':_['isNil'](_0x41c660[_0x6e07('0x5a')]['to'][0x0])?undefined:_0x41c660[_0x6e07('0x5a')]['to'][0x0]},client9002);})[_0x6e07('0x33')](function(){if(_0x230c24){if(_[_0x6e07('0xa1')](_0x41c660['body']['from'])){_0x41c660['body'][_0x6e07('0xa2')]=util['format'](_0x6e07('0xa3'),_0x230c24['name'],_0x230c24[_0x6e07('0xa4')]);}if(_0x230c24[_0x6e07('0x9b')]){if(_0x230c24['List'][_0x6e07('0xa5')][_0x6e07('0x46')]){return _0x230c24[_0x6e07('0x9b')][_0x6e07('0xa5')][0x0];}else{return db[_0x6e07('0x71')][_0x6e07('0x59')](_[_0x6e07('0xa6')](_0x41c660[_0x6e07('0x5a')],{'firstName':_0x41c660['body']['to'][0x0],'phone':_0x41c660['body']['to'][0x0],'fax':_0x41c660[_0x6e07('0x5a')]['to'][0x0],'ListId':_0x230c24[_0x6e07('0x94')]}));}}else{throw new Error(_0x6e07('0xa7'));}}else{throw new Error(_0x6e07('0xa8'));}})[_0x6e07('0x33')](function(_0x139c88){if(_0x139c88){return db[_0x6e07('0x6e')][_0x6e07('0x58')]({'where':{'ContactId':_0x139c88['id'],'closed':![],'FaxAccountId':_0x230c24['id']}})[_0x6e07('0x33')](function(_0x1beff4){if(_0x1beff4){return[_0x1beff4,![]];}return db[_0x6e07('0x6e')][_0x6e07('0x59')]({'UserId':_0x41c660['user']['id'],'ContactId':_0x139c88['id'],'FaxAccountId':_0x230c24['id'],'fax':_0x41c660['body']['to'][0x0],'firstMsgDirection':_0x6e07('0xa9'),'Messages':[_[_0x6e07('0x4d')](_0x41c660['body'],{'read':![],'body':_0x41c660[_0x6e07('0x5a')][_0x6e07('0x9d')][0x0][_0x6e07('0xaa')],'FaxAccountId':_0x230c24['id'],'UserId':_0x41c660['user']['id'],'ContactId':_0x139c88['id'],'AttachmentId':_0x41c660[_0x6e07('0x5a')][_0x6e07('0x9d')][0x0]['id']})]},{'include':[{'model':db[_0x6e07('0x97')],'as':_0x6e07('0xab')}]})[_0x6e07('0x33')](function(_0x3494f2){return[_0x3494f2,!![]];});});}else{throw new Error(_0x6e07('0xac'));}})['spread'](function(_0x238c3a,_0xd6d2fc){if(_0xd6d2fc){return _0x238c3a;}return db[_0x6e07('0x97')][_0x6e07('0x59')]({'direction':_0x6e07('0xa9'),'read':![],'body':_0x41c660[_0x6e07('0x5a')][_0x6e07('0x9d')][0x0]['filename'],'FaxAccountId':_0x230c24['id'],'FaxInteractionId':_0x238c3a['id'],'UserId':_0x41c660[_0x6e07('0x5b')]['id'],'ContactId':_0x238c3a[_0x6e07('0xad')],'AttachmentId':_0x41c660[_0x6e07('0x5a')][_0x6e07('0x9d')][0x0]['id']})['then'](function(_0x2ec265){_0x238c3a[_0x6e07('0xae')]['Messages']=[];_0x238c3a['dataValues'][_0x6e07('0xab')]['push'](_0x2ec265['dataValues']);return _0x238c3a;});})['then'](function(_0x3710fd){respondWithRpcPromise(_0x6e07('0xaf'),'SendFax',{'FaxAccountId':_['isNil'](_0x41c660[_0x6e07('0x55')]['id'])?undefined:_0x41c660[_0x6e07('0x55')]['id'],'path':_[_0x6e07('0xa1')](_0x41c660[_0x6e07('0x5a')][_0x6e07('0x9d')][0x0][_0x6e07('0x5')])?undefined:_0x41c660[_0x6e07('0x5a')][_0x6e07('0x9d')][0x0][_0x6e07('0x5')],'fax':_[_0x6e07('0xa1')](_0x41c660[_0x6e07('0x5a')]['to'][0x0])?undefined:_0x41c660['body']['to'][0x0],'AttachmentId':_0x41c660['body'][_0x6e07('0x9d')][0x0]['id']},client9002)['then'](function(_0x33cf38){logger[_0x6e07('0x24')]('SendFaxRpc,\x20%s',_0x33cf38);})['catch'](function(_0x3a5383){logger[_0x6e07('0x24')](_0x6e07('0xb0'),_0x3a5383);});return _0x3710fd;})[_0x6e07('0x33')](respondWithResult(_0x3d1bf4,null))[_0x6e07('0x26')](handleError(_0x3d1bf4,null));};exports[_0x6e07('0xb1')]=function(_0x506119,_0x290cf8,_0x18b158){return db[_0x6e07('0x51')]['find']({'where':{'id':_0x506119[_0x6e07('0x55')]['id']}})[_0x6e07('0x33')](handleEntityNotFound(_0x290cf8,null))[_0x6e07('0x33')](function(_0x2f18ba){if(_0x2f18ba){return _0x2f18ba['addAgents'](_0x506119[_0x6e07('0x5a')][_0x6e07('0x6d')],_[_0x6e07('0x6f')](_0x506119['body'],[_0x6e07('0x6d'),'id'])||{})[_0x6e07('0xb2')](function(_0x3c7445){for(var _0x29253e=0x0;_0x29253e<_0x506119['body'][_0x6e07('0x6d')][_0x6e07('0x46')];_0x29253e+=0x1){socket[_0x6e07('0xb3')](_0x6e07('0xb4'),{'UserId':Number(_0x506119[_0x6e07('0x5a')][_0x6e07('0x6d')][_0x29253e]),'FaxAccountId':Number(_0x506119['params']['id'])});}return _0x3c7445;});}})[_0x6e07('0x33')](respondWithResult(_0x290cf8,null))['catch'](handleError(_0x290cf8,null));};exports[_0x6e07('0xb5')]=function(_0x3b5a20,_0x25e9cd,_0x44468b){return db[_0x6e07('0x51')][_0x6e07('0x58')]({'where':{'id':_0x3b5a20['params']['id']}})['then'](handleEntityNotFound(_0x25e9cd,null))[_0x6e07('0x33')](function(_0x42646d){if(_0x42646d){return _0x42646d['removeAgents'](_0x3b5a20['query'][_0x6e07('0x6d')])[_0x6e07('0x33')](function(){if(_[_0x6e07('0xb6')](_0x3b5a20[_0x6e07('0x41')][_0x6e07('0x6d')])){for(var _0x4570c9=0x0;_0x4570c9<_0x3b5a20['query'][_0x6e07('0x6d')][_0x6e07('0x46')];_0x4570c9+=0x1){socket[_0x6e07('0xb3')]('userFaxAccount:remove',{'UserId':Number(_0x3b5a20['query'][_0x6e07('0x6d')][_0x4570c9]),'FaxAccountId':Number(_0x3b5a20[_0x6e07('0x55')]['id'])});}}else{socket['emit'](_0x6e07('0xb7'),{'UserId':Number(_0x3b5a20[_0x6e07('0x41')][_0x6e07('0x6d')]),'FaxAccountId':Number(_0x3b5a20[_0x6e07('0x55')]['id'])});}});}})[_0x6e07('0x33')](respondWithStatusCode(_0x25e9cd,null))['catch'](handleError(_0x25e9cd,null));};exports[_0x6e07('0xb8')]=function(_0x5e2dde,_0x5208f2,_0x330c02){var _0x27e2d7={};var _0x1cbb71={};var _0x183002;var _0x2a5a1e;return db[_0x6e07('0x51')][_0x6e07('0x65')]({'where':{'id':_0x5e2dde[_0x6e07('0x55')]['id']}})[_0x6e07('0x33')](handleEntityNotFound(_0x5208f2,null))[_0x6e07('0x33')](function(_0x3f7f2a){if(_0x3f7f2a){_0x183002=_0x3f7f2a;_0x1cbb71[_0x6e07('0x40')]=_[_0x6e07('0x56')](db[_0x6e07('0xb9')][_0x6e07('0x3d')]);_0x1cbb71['query']=_['keys'](_0x5e2dde['query']);_0x1cbb71[_0x6e07('0x42')]=_[_0x6e07('0x43')](_0x1cbb71[_0x6e07('0x40')],_0x1cbb71[_0x6e07('0x41')]);_0x27e2d7['attributes']=_[_0x6e07('0x43')](_0x1cbb71[_0x6e07('0x40')],qs[_0x6e07('0x45')](_0x5e2dde[_0x6e07('0x41')][_0x6e07('0x45')]));_0x27e2d7[_0x6e07('0x44')]=_0x27e2d7[_0x6e07('0x44')][_0x6e07('0x46')]?_0x27e2d7[_0x6e07('0x44')]:_0x1cbb71[_0x6e07('0x40')];_0x27e2d7[_0x6e07('0x49')]=qs['sort'](_0x5e2dde[_0x6e07('0x41')][_0x6e07('0x66')]);_0x27e2d7[_0x6e07('0x4a')]=qs[_0x6e07('0x42')](_[_0x6e07('0x4b')](_0x5e2dde[_0x6e07('0x41')],_0x1cbb71[_0x6e07('0x42')]));if(_0x5e2dde[_0x6e07('0x41')][_0x6e07('0x4c')]){_0x27e2d7['where']=_[_0x6e07('0x4d')](_0x27e2d7['where'],{'$or':_[_0x6e07('0x3c')](_0x27e2d7[_0x6e07('0x44')],function(_0x157bbc){var _0x346ca8={};_0x346ca8[_0x157bbc]={'$like':'%'+_0x5e2dde['query'][_0x6e07('0x4c')]+'%'};return _0x346ca8;})});}_0x27e2d7=_[_0x6e07('0x4d')]({},_0x27e2d7,_0x5e2dde[_0x6e07('0x57')]);return _0x183002[_0x6e07('0xb8')](_0x27e2d7);}})['then'](function(_0x5b52d3){if(_0x5b52d3){_0x2a5a1e=_0x5b52d3[_0x6e07('0x46')];if(!_0x5e2dde['query']['hasOwnProperty'](_0x6e07('0x48'))){_0x27e2d7[_0x6e07('0x2c')]=qs[_0x6e07('0x2c')](_0x5e2dde['query'][_0x6e07('0x2c')]);_0x27e2d7[_0x6e07('0x2a')]=qs['offset'](_0x5e2dde[_0x6e07('0x41')][_0x6e07('0x2a')]);}return _0x183002[_0x6e07('0xb8')](_0x27e2d7);}})[_0x6e07('0x33')](function(_0x5d845a){if(_0x5d845a){return _0x5d845a?{'count':_0x2a5a1e,'rows':_0x5d845a}:null;}})['then'](respondWithResult(_0x5208f2,null))[_0x6e07('0x26')](handleError(_0x5208f2,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index f739ffd..35ddfd4 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 _0x7543=['remove','emit','hook','exports','../../mysqldb','FaxAccount','setMaxListeners','save','update'];(function(_0x45413a,_0x281b1c){var _0x27fe7f=function(_0x11e59e){while(--_0x11e59e){_0x45413a['push'](_0x45413a['shift']());}};_0x27fe7f(++_0x281b1c);}(_0x7543,0xca));var _0x3754=function(_0x4ac941,_0x2432a9){_0x4ac941=_0x4ac941-0x0;var _0x4d1ad1=_0x7543[_0x4ac941];return _0x4d1ad1;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x3754('0x0'))['db'][_0x3754('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x3754('0x2')](0x0);var events={'afterCreate':_0x3754('0x3'),'afterUpdate':_0x3754('0x4'),'afterDestroy':_0x3754('0x5')};function emitEvent(_0x1f13c8){return function(_0x276109,_0x3e5e4e,_0x42c22e){FaxAccountEvents[_0x3754('0x6')](_0x1f13c8+':'+_0x276109['id'],_0x276109);FaxAccountEvents[_0x3754('0x6')](_0x1f13c8,_0x276109);_0x42c22e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x3754('0x7')](e,emitEvent(event));}}module[_0x3754('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x3adb=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x15023f,_0x342b87){var _0x1d3400=function(_0x4408ac){while(--_0x4408ac){_0x15023f['push'](_0x15023f['shift']());}};_0x1d3400(++_0x342b87);}(_0x3adb,0xd3));var _0xb3ad=function(_0x27dc8b,_0x217cec){_0x27dc8b=_0x27dc8b-0x0;var _0x5cea8a=_0x3adb[_0x27dc8b];return _0x5cea8a;};'use strict';var EventEmitter=require(_0xb3ad('0x0'));var FaxAccount=require(_0xb3ad('0x1'))['db'][_0xb3ad('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xb3ad('0x3')](0x0);var events={'afterCreate':_0xb3ad('0x4'),'afterUpdate':'update','afterDestroy':_0xb3ad('0x5')};function emitEvent(_0x411222){return function(_0x3a11d3,_0x4025d3,_0x5f2038){FaxAccountEvents[_0xb3ad('0x6')](_0x411222+':'+_0x3a11d3['id'],_0x3a11d3);FaxAccountEvents[_0xb3ad('0x6')](_0x411222,_0x3a11d3);_0x5f2038(null);};}for(var e in events){if(events[_0xb3ad('0x7')](e)){var event=events[e];FaxAccount[_0xb3ad('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 274fa3f..a670864 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 _0x6ee8=['FaxAccount','fax_accounts','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x37a1e6,_0x536b85){var _0x115a59=function(_0x4173a7){while(--_0x4173a7){_0x37a1e6['push'](_0x37a1e6['shift']());}};_0x115a59(++_0x536b85);}(_0x6ee8,0x10a));var _0x86ee=function(_0x2ff22c,_0xae3c7d){_0x2ff22c=_0x2ff22c-0x0;var _0x2a8243=_0x6ee8[_0x2ff22c];return _0x2a8243;};'use strict';var _=require(_0x86ee('0x0'));var util=require(_0x86ee('0x1'));var logger=require('../../config/logger')(_0x86ee('0x2'));var moment=require(_0x86ee('0x3'));var BPromise=require(_0x86ee('0x4'));var rp=require(_0x86ee('0x5'));var fs=require('fs');var path=require(_0x86ee('0x6'));var rimraf=require('rimraf');var config=require(_0x86ee('0x7'));var attributes=require('./faxAccount.attributes');module[_0x86ee('0x8')]=function(_0x39d68c,_0x4daa4f){return _0x39d68c['define'](_0x86ee('0x9'),attributes,{'tableName':_0x86ee('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4261=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','FaxAccount','fax_accounts'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x4261,0x84));var _0x1426=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4261[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1426('0x0'))(_0x1426('0x1'));var moment=require('moment');var BPromise=require(_0x1426('0x2'));var rp=require(_0x1426('0x3'));var fs=require('fs');var path=require(_0x1426('0x4'));var rimraf=require(_0x1426('0x5'));var config=require(_0x1426('0x6'));var attributes=require(_0x1426('0x7'));module[_0x1426('0x8')]=function(_0x39c804,_0x317289){return _0x39c804['define'](_0x1426('0x9'),attributes,{'tableName':_0x1426('0xa'),'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 86c5c6b..b0b1dc2 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 _0xe829=['priority','asc','length','defaults','create','fax','FaxInteraction','find','Contact\x20not\x20found','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','ContactId','AttachmentId','UserId','User','unshift','name','Start','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','then','body','CmContact','describe','Sequelize','difference','updatedAt','keys','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','list'];(function(_0x481739,_0x714003){var _0x20f1d4=function(_0x266a1e){while(--_0x266a1e){_0x481739['push'](_0x481739['shift']());}};_0x20f1d4(++_0x714003);}(_0xe829,0x113));var _0x9e82=function(_0x443547,_0x21d7a8){_0x443547=_0x443547-0x0;var _0x1423a8=_0xe829[_0x443547];return _0x1423a8;};'use strict';var _=require(_0x9e82('0x0'));var util=require(_0x9e82('0x1'));var moment=require(_0x9e82('0x2'));var BPromise=require(_0x9e82('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9e82('0x4'));var db=require(_0x9e82('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9e82('0x6'))(_0x9e82('0x7'));var config=require(_0x9e82('0x8'));var jayson=require(_0x9e82('0x9'));var client=jayson[_0x9e82('0xa')]['http']({'port':0x232c});config[_0x9e82('0xb')]=_['defaults'](config[_0x9e82('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9e82('0xb')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x2b6a1a,_0x5e4119,_0x381bd4){return new BPromise(function(_0x4762ea,_0xe6f581){return client['request'](_0x2b6a1a,_0x381bd4)['then'](function(_0x55f3c2){logger[_0x9e82('0xc')](_0x9e82('0xd'),_0x5e4119,_0x9e82('0xe'));logger['debug'](_0x9e82('0xf'),_0x5e4119,_0x9e82('0xe'),JSON[_0x9e82('0x10')](_0x55f3c2));if(_0x55f3c2[_0x9e82('0x11')]){if(_0x55f3c2['error'][_0x9e82('0x12')]===0x1f4){logger[_0x9e82('0x11')](_0x9e82('0xd'),_0x5e4119,_0x55f3c2[_0x9e82('0x11')][_0x9e82('0x13')]);return _0xe6f581(_0x55f3c2[_0x9e82('0x11')][_0x9e82('0x13')]);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x5e4119,_0x55f3c2['error'][_0x9e82('0x13')]);return _0x4762ea(_0x55f3c2[_0x9e82('0x11')][_0x9e82('0x13')]);}else{logger[_0x9e82('0xc')](_0x9e82('0xd'),_0x5e4119,_0x9e82('0xe'));_0x4762ea(_0x55f3c2[_0x9e82('0x14')][_0x9e82('0x13')]);}})[_0x9e82('0x15')](function(_0x48744c){logger[_0x9e82('0x11')](_0x9e82('0xd'),_0x5e4119,_0x48744c);_0xe6f581(_0x48744c);});});}exports[_0x9e82('0x16')]=function(_0x1219f4){var _0xfbcb36=this;return new Promise(function(_0x27c853,_0x52af10){return db[_0x9e82('0x17')][_0x9e82('0x18')]({'raw':_0x1219f4[_0x9e82('0x19')]?_0x1219f4[_0x9e82('0x19')][_0x9e82('0x1a')]===undefined?!![]:![]:!![],'where':_0x1219f4[_0x9e82('0x19')]?_0x1219f4[_0x9e82('0x19')]['where']||null:null,'attributes':_0x1219f4[_0x9e82('0x19')]?_0x1219f4[_0x9e82('0x19')][_0x9e82('0x1b')]||null:null,'limit':_0x1219f4[_0x9e82('0x19')]?_0x1219f4[_0x9e82('0x19')][_0x9e82('0x1c')]||null:null,'include':_0x1219f4[_0x9e82('0x19')]?_0x1219f4[_0x9e82('0x19')][_0x9e82('0x1d')]?_[_0x9e82('0x1e')](_0x1219f4[_0x9e82('0x19')]['include'],function(_0x373812){return{'model':db[_0x373812[_0x9e82('0x1f')]],'as':_0x373812['as'],'attributes':_0x373812[_0x9e82('0x1b')],'include':_0x373812[_0x9e82('0x1d')]?_['map'](_0x373812[_0x9e82('0x1d')],function(_0x103ff4){return{'model':db[_0x103ff4[_0x9e82('0x1f')]],'as':_0x103ff4['as'],'attributes':_0x103ff4['attributes'],'include':_0x103ff4[_0x9e82('0x1d')]?_[_0x9e82('0x1e')](_0x103ff4[_0x9e82('0x1d')],function(_0xcaa0dd){return{'model':db[_0xcaa0dd[_0x9e82('0x1f')]],'as':_0xcaa0dd['as'],'attributes':_0xcaa0dd['attributes']};}):[]};}):[]};}):[]:[]})[_0x9e82('0x20')](function(_0x3a836c){logger[_0x9e82('0xc')]('GetFaxAccount',_0x1219f4);logger['debug'](_0x9e82('0x16'),_0x1219f4,JSON['stringify'](_0x3a836c));_0x27c853(_0x3a836c);})[_0x9e82('0x15')](function(_0x2e1f7f){logger[_0x9e82('0x11')](_0x9e82('0x16'),_0x2e1f7f[_0x9e82('0x13')],_0x1219f4);_0x52af10(_0xfbcb36[_0x9e82('0x11')](0x1f4,_0x2e1f7f[_0x9e82('0x13')]));});});};exports['NotifyFaxAccount']=function(_0x5b90b5,_0x2c9756,_0x1024f6){var _0x800bbc=this;return new Promise(function(_0x542e50,_0x567720){var _0x161e1f={'body':_0x5b90b5[_0x9e82('0x21')],'channel':'fax'};var _0x1dbe93=[];var _0x9ad36a=[];var _0x3fdd16={};return db[_0x9e82('0x22')][_0x9e82('0x23')]()[_0x9e82('0x20')](function(_0x3908c8){if(!_0x3908c8){throw new db[(_0x9e82('0x24'))]['ValidationError']('no\x20available\x20attributes');}_0x1dbe93=_[_0x9e82('0x25')](_['keys'](_0x3908c8),['createdAt',_0x9e82('0x26')]);_0x9ad36a=_[_0x9e82('0x25')](_[_0x9e82('0x27')](_0x3908c8),[_0x9e82('0x28'),_0x9e82('0x26'),_0x9e82('0x29'),_0x9e82('0x2a')]);if(_0x5b90b5['body']['id']){delete _0x5b90b5[_0x9e82('0x21')]['id'];}if(_[_0x9e82('0x2b')](_0x5b90b5[_0x9e82('0x21')][_0x9e82('0x2c')])){throw new db[(_0x9e82('0x24'))]['ValidationError'](_0x9e82('0x2d'));}if(_[_0x9e82('0x2b')](_0x5b90b5[_0x9e82('0x21')][_0x9e82('0x21')])||_0x5b90b5[_0x9e82('0x21')][_0x9e82('0x21')]===''){throw new db[(_0x9e82('0x24'))]['ValidationError'](_0x9e82('0x2e'));}if(_['isNil'](_0x5b90b5[_0x9e82('0x21')][_0x9e82('0x2f')])){throw new db[(_0x9e82('0x24'))][(_0x9e82('0x30'))](_0x9e82('0x31')+_0x9ad36a);}if(!_[_0x9e82('0x32')](_0x9ad36a,_0x5b90b5['body'][_0x9e82('0x2f')])){throw new db[(_0x9e82('0x24'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x9ad36a);}_0x3fdd16[_0x5b90b5[_0x9e82('0x21')]['mapKey']]=_0x5b90b5[_0x9e82('0x21')][_0x9e82('0x2c')];})[_0x9e82('0x20')](function(){return db[_0x9e82('0x17')]['find']({'where':{'id':_0x5b90b5[_0x9e82('0x33')]['id']},'include':[{'model':db[_0x9e82('0x34')],'as':_0x9e82('0x35'),'include':[{'model':db[_0x9e82('0x22')],'as':_0x9e82('0x36'),'where':_0x3fdd16,'limit':0x1,'order':[[_0x9e82('0x26'),_0x9e82('0x37')]]}]},{'model':db[_0x9e82('0x38')],'as':_0x9e82('0x39')}]});})[_0x9e82('0x20')](function(_0x417781){if(_0x417781&&_0x417781[_0x9e82('0x35')]){var _0x581ead=_0x417781[_0x9e82('0x3a')]({'plain':!![]});_0x161e1f[_0x9e82('0x33')]=_0x581ead;_0x161e1f[_0x9e82('0x3b')]=_0x581ead['Applications'];_0x161e1f[_0x9e82('0x3c')]=_0x581ead['List'];_0x161e1f['applications']=_['orderBy'](_0x161e1f[_0x9e82('0x3b')],[_0x9e82('0x3d')],[_0x9e82('0x3e')]);if(_0x161e1f[_0x9e82('0x33')][_0x9e82('0x39')]){delete _0x161e1f[_0x9e82('0x33')][_0x9e82('0x39')];}if(_0x161e1f['account'][_0x9e82('0x35')]&&_0x161e1f[_0x9e82('0x33')]['List']['Contacts'][_0x9e82('0x3f')]){return _0x161e1f[_0x9e82('0x33')][_0x9e82('0x35')][_0x9e82('0x36')][0x0];}var _0x520f4f=_[_0x9e82('0x40')](_0x5b90b5[_0x9e82('0x21')],{'firstName':_0x5b90b5[_0x9e82('0x21')][_0x9e82('0x2c')],'ListId':_0x581ead[_0x9e82('0x2a')]});_0x520f4f[_0x5b90b5[_0x9e82('0x21')][_0x9e82('0x2f')]]=_0x5b90b5['body'][_0x9e82('0x2c')];return db[_0x9e82('0x22')][_0x9e82('0x41')](_0x520f4f,{'fields':_0x1dbe93,'raw':!![]});}})[_0x9e82('0x20')](function(_0x5951d8){_0x161e1f['contact']=_0x5951d8;if(_0x5951d8){var _0x168cf6={'ContactId':_0x5951d8['id'],'FaxAccountId':_0x5b90b5['account']['id'],'fax':_0x5951d8[_0x9e82('0x42')]};return db[_0x9e82('0x43')][_0x9e82('0x44')]({'where':{'ContactId':_0x5951d8['id'],'closed':![],'FaxAccountId':_0x5b90b5[_0x9e82('0x33')]['id']}})[_0x9e82('0x20')](function(_0x169ecc){if(_0x169ecc){return[_0x169ecc,![]];}return db[_0x9e82('0x43')][_0x9e82('0x41')](_0x168cf6)[_0x9e82('0x20')](function(_0x4286f5){return[_0x4286f5,!![]];});});}else{throw new Error(_0x9e82('0x45'));}})['spread'](function(_0x41ec01,_0x24a544){var _0x155aac=_0x41ec01[_0x9e82('0x3a')]({'plain':!![]});if(_0x24a544){if(_0x161e1f[_0x9e82('0x33')][_0x9e82('0x46')]){_0x161e1f['applications'][_0x9e82('0x47')]({'id':0x0,'priority':_0x161e1f[_0x9e82('0x3b')][_0x9e82('0x3f')]+0x1,'app':'close','appdata':_0x9e82('0x48'),'interval':_0x9e82('0x49')});}_0x155aac['created']=!![];}else{_0x155aac[_0x9e82('0x4a')]=![];}_0x161e1f[_0x9e82('0x4b')]=_0x155aac;return db[_0x9e82('0x4c')][_0x9e82('0x41')]({'body':_0x5b90b5[_0x9e82('0x21')][_0x9e82('0x21')],'FaxAccountId':_0x5b90b5[_0x9e82('0x33')]['id'],'FaxInteractionId':_0x41ec01['id'],'direction':'in','ContactId':_0x41ec01[_0x9e82('0x4d')],'AttachmentId':_0x5b90b5[_0x9e82('0x21')][_0x9e82('0x4e')]});})['then'](function(_0x184d3a){_0x161e1f[_0x9e82('0x13')]=_0x184d3a;if(_0x161e1f[_0x9e82('0x4b')][_0x9e82('0x4f')]){return db[_0x9e82('0x50')][_0x9e82('0x44')]({'attributes':['id','name'],'where':{'id':_0x161e1f[_0x9e82('0x4b')][_0x9e82('0x4f')]}})[_0x9e82('0x20')](function(_0x971f35){if(_0x971f35){_0x161e1f[_0x9e82('0x3b')][_0x9e82('0x51')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x971f35[_0x9e82('0x52')]+','+(_0x161e1f['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x9e82('0x53'),'startRouting',_0x161e1f);});}return respondWithRpcPromise(_0x9e82('0x53'),'startRouting',_0x161e1f);})[_0x9e82('0x20')](function(_0x2cb3b1){_0x542e50(_0x2cb3b1);})[_0x9e82('0x15')](function(_0xce7fe9){_0x567720(_0x800bbc['error'](0x1f4,_0xce7fe9[_0x9e82('0x13')]));});});}; \ No newline at end of file +var _0xa677=['find','account','CmList','List','DESC','FaxApplication','get','applications','Applications','list','orderBy','Contacts','length','contact','FaxInteraction','create','spread','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','UserId','User','name','interaction','unshift','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','GetFaxAccount','FaxAccount','findAll','options','raw','attributes','limit','include','map','model','catch','NotifyFaxAccount','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'];(function(_0x5d6ff1,_0x4c766a){var _0x1134e3=function(_0x196f81){while(--_0x196f81){_0x5d6ff1['push'](_0x5d6ff1['shift']());}};_0x1134e3(++_0x4c766a);}(_0xa677,0x7b));var _0x7a67=function(_0x1d1d09,_0x504d77){_0x1d1d09=_0x1d1d09-0x0;var _0x8827e=_0xa677[_0x1d1d09];return _0x8827e;};'use strict';var _=require(_0x7a67('0x0'));var util=require('util');var moment=require(_0x7a67('0x1'));var BPromise=require(_0x7a67('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a67('0x3'));var db=require(_0x7a67('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7a67('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7a67('0x6'));var client=jayson['client'][_0x7a67('0x7')]({'port':0x232c});config[_0x7a67('0x8')]=_[_0x7a67('0x9')](config[_0x7a67('0x8')],{'host':_0x7a67('0xa'),'port':0x18eb});var socket=require(_0x7a67('0xb'))(new Redis(config[_0x7a67('0x8')]));require(_0x7a67('0xc'))[_0x7a67('0xd')](socket);function respondWithRpcPromise(_0x3a6782,_0x40659c,_0x495794){return new BPromise(function(_0x2852c6,_0x392639){return client['request'](_0x3a6782,_0x495794)[_0x7a67('0xe')](function(_0x4ee88d){logger[_0x7a67('0xf')](_0x7a67('0x10'),_0x40659c,'request\x20sent');logger[_0x7a67('0x11')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x40659c,'request\x20sent',JSON[_0x7a67('0x12')](_0x4ee88d));if(_0x4ee88d[_0x7a67('0x13')]){if(_0x4ee88d['error'][_0x7a67('0x14')]===0x1f4){logger['error'](_0x7a67('0x10'),_0x40659c,_0x4ee88d['error'][_0x7a67('0x15')]);return _0x392639(_0x4ee88d[_0x7a67('0x13')][_0x7a67('0x15')]);}logger[_0x7a67('0x13')]('FaxAccount,\x20%s,\x20%s',_0x40659c,_0x4ee88d['error'][_0x7a67('0x15')]);return _0x2852c6(_0x4ee88d[_0x7a67('0x13')]['message']);}else{logger[_0x7a67('0xf')](_0x7a67('0x10'),_0x40659c,_0x7a67('0x16'));_0x2852c6(_0x4ee88d[_0x7a67('0x17')][_0x7a67('0x15')]);}})['catch'](function(_0x76411c){logger[_0x7a67('0x13')](_0x7a67('0x10'),_0x40659c,_0x76411c);_0x392639(_0x76411c);});});}exports[_0x7a67('0x18')]=function(_0x4e4f16){var _0x3573fa=this;return new Promise(function(_0x30b7fa,_0x388587){return db[_0x7a67('0x19')][_0x7a67('0x1a')]({'raw':_0x4e4f16[_0x7a67('0x1b')]?_0x4e4f16[_0x7a67('0x1b')][_0x7a67('0x1c')]===undefined?!![]:![]:!![],'where':_0x4e4f16['options']?_0x4e4f16[_0x7a67('0x1b')]['where']||null:null,'attributes':_0x4e4f16[_0x7a67('0x1b')]?_0x4e4f16[_0x7a67('0x1b')][_0x7a67('0x1d')]||null:null,'limit':_0x4e4f16[_0x7a67('0x1b')]?_0x4e4f16['options'][_0x7a67('0x1e')]||null:null,'include':_0x4e4f16[_0x7a67('0x1b')]?_0x4e4f16['options'][_0x7a67('0x1f')]?_[_0x7a67('0x20')](_0x4e4f16['options'][_0x7a67('0x1f')],function(_0x3275bf){return{'model':db[_0x3275bf[_0x7a67('0x21')]],'as':_0x3275bf['as'],'attributes':_0x3275bf[_0x7a67('0x1d')],'include':_0x3275bf['include']?_['map'](_0x3275bf[_0x7a67('0x1f')],function(_0x5e2546){return{'model':db[_0x5e2546['model']],'as':_0x5e2546['as'],'attributes':_0x5e2546[_0x7a67('0x1d')],'include':_0x5e2546[_0x7a67('0x1f')]?_[_0x7a67('0x20')](_0x5e2546[_0x7a67('0x1f')],function(_0x5f5822){return{'model':db[_0x5f5822[_0x7a67('0x21')]],'as':_0x5f5822['as'],'attributes':_0x5f5822[_0x7a67('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7a67('0xe')](function(_0x2725d9){logger['info'](_0x7a67('0x18'),_0x4e4f16);logger['debug'](_0x7a67('0x18'),_0x4e4f16,JSON[_0x7a67('0x12')](_0x2725d9));_0x30b7fa(_0x2725d9);})[_0x7a67('0x22')](function(_0x51df9d){logger[_0x7a67('0x13')]('GetFaxAccount',_0x51df9d[_0x7a67('0x15')],_0x4e4f16);_0x388587(_0x3573fa[_0x7a67('0x13')](0x1f4,_0x51df9d['message']));});});};exports[_0x7a67('0x23')]=function(_0x584efe,_0x46253d,_0x314f87){var _0x40453e=this;return new Promise(function(_0x24cc88,_0x29574d){var _0x2b0b91={'body':_0x584efe['body'],'channel':_0x7a67('0x24')};var _0x512f9e=[];var _0x474898=[];var _0x56ab18={};return db[_0x7a67('0x25')][_0x7a67('0x26')]()[_0x7a67('0xe')](function(_0x506701){if(!_0x506701){throw new db[(_0x7a67('0x27'))][(_0x7a67('0x28'))](_0x7a67('0x29'));}_0x512f9e=_[_0x7a67('0x2a')](_[_0x7a67('0x2b')](_0x506701),[_0x7a67('0x2c'),_0x7a67('0x2d')]);_0x474898=_['difference'](_[_0x7a67('0x2b')](_0x506701),[_0x7a67('0x2c'),'updatedAt',_0x7a67('0x2e'),_0x7a67('0x2f')]);if(_0x584efe[_0x7a67('0x30')]['id']){delete _0x584efe[_0x7a67('0x30')]['id'];}if(_[_0x7a67('0x31')](_0x584efe['body'][_0x7a67('0x32')])){throw new db[(_0x7a67('0x27'))][(_0x7a67('0x28'))](_0x7a67('0x33'));}if(_[_0x7a67('0x31')](_0x584efe['body'][_0x7a67('0x30')])||_0x584efe[_0x7a67('0x30')][_0x7a67('0x30')]===''){throw new db[(_0x7a67('0x27'))][(_0x7a67('0x28'))](_0x7a67('0x34'));}if(_[_0x7a67('0x31')](_0x584efe[_0x7a67('0x30')][_0x7a67('0x35')])){throw new db[(_0x7a67('0x27'))][(_0x7a67('0x28'))](_0x7a67('0x36')+_0x474898);}if(!_[_0x7a67('0x37')](_0x474898,_0x584efe['body'][_0x7a67('0x35')])){throw new db[(_0x7a67('0x27'))][(_0x7a67('0x28'))](_0x7a67('0x38')+_0x474898);}_0x56ab18[_0x584efe['body'][_0x7a67('0x35')]]=_0x584efe[_0x7a67('0x30')][_0x7a67('0x32')];})[_0x7a67('0xe')](function(){return db[_0x7a67('0x19')][_0x7a67('0x39')]({'where':{'id':_0x584efe[_0x7a67('0x3a')]['id']},'include':[{'model':db[_0x7a67('0x3b')],'as':_0x7a67('0x3c'),'include':[{'model':db[_0x7a67('0x25')],'as':'Contacts','where':_0x56ab18,'limit':0x1,'order':[[_0x7a67('0x2d'),_0x7a67('0x3d')]]}]},{'model':db[_0x7a67('0x3e')],'as':'Applications'}]});})[_0x7a67('0xe')](function(_0x208dd8){if(_0x208dd8&&_0x208dd8[_0x7a67('0x3c')]){var _0xe94243=_0x208dd8[_0x7a67('0x3f')]({'plain':!![]});_0x2b0b91[_0x7a67('0x3a')]=_0xe94243;_0x2b0b91[_0x7a67('0x40')]=_0xe94243[_0x7a67('0x41')];_0x2b0b91[_0x7a67('0x42')]=_0xe94243[_0x7a67('0x3c')];_0x2b0b91[_0x7a67('0x40')]=_[_0x7a67('0x43')](_0x2b0b91[_0x7a67('0x40')],['priority'],['asc']);if(_0x2b0b91[_0x7a67('0x3a')][_0x7a67('0x41')]){delete _0x2b0b91['account'][_0x7a67('0x41')];}if(_0x2b0b91[_0x7a67('0x3a')]['List']&&_0x2b0b91[_0x7a67('0x3a')][_0x7a67('0x3c')][_0x7a67('0x44')][_0x7a67('0x45')]){return _0x2b0b91[_0x7a67('0x3a')][_0x7a67('0x3c')][_0x7a67('0x44')][0x0];}var _0x48fd48=_[_0x7a67('0x9')](_0x584efe[_0x7a67('0x30')],{'firstName':_0x584efe[_0x7a67('0x30')][_0x7a67('0x32')],'ListId':_0xe94243[_0x7a67('0x2f')]});_0x48fd48[_0x584efe[_0x7a67('0x30')][_0x7a67('0x35')]]=_0x584efe['body'][_0x7a67('0x32')];return db[_0x7a67('0x25')]['create'](_0x48fd48,{'fields':_0x512f9e,'raw':!![]});}})[_0x7a67('0xe')](function(_0x6d087d){_0x2b0b91[_0x7a67('0x46')]=_0x6d087d;if(_0x6d087d){var _0x45996e={'ContactId':_0x6d087d['id'],'FaxAccountId':_0x584efe[_0x7a67('0x3a')]['id'],'fax':_0x6d087d['fax']};return db['FaxInteraction'][_0x7a67('0x39')]({'where':{'ContactId':_0x6d087d['id'],'closed':![],'FaxAccountId':_0x584efe[_0x7a67('0x3a')]['id']}})[_0x7a67('0xe')](function(_0x595da2){if(_0x595da2){return[_0x595da2,![]];}return db[_0x7a67('0x47')][_0x7a67('0x48')](_0x45996e)[_0x7a67('0xe')](function(_0x589f2d){return[_0x589f2d,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x7a67('0x49')](function(_0x7f954a,_0x217ce7){var _0x5376bb=_0x7f954a[_0x7a67('0x3f')]({'plain':!![]});if(_0x217ce7){if(_0x2b0b91['account'][_0x7a67('0x4a')]){_0x2b0b91[_0x7a67('0x40')][_0x7a67('0x4b')]({'id':0x0,'priority':_0x2b0b91[_0x7a67('0x40')][_0x7a67('0x45')]+0x1,'app':_0x7a67('0x4c'),'appdata':_0x7a67('0x4d'),'interval':_0x7a67('0x4e')});}_0x5376bb[_0x7a67('0x4f')]=!![];}else{_0x5376bb['created']=![];}_0x2b0b91['interaction']=_0x5376bb;return db[_0x7a67('0x50')]['create']({'body':_0x584efe[_0x7a67('0x30')][_0x7a67('0x30')],'FaxAccountId':_0x584efe['account']['id'],'FaxInteractionId':_0x7f954a['id'],'direction':'in','ContactId':_0x7f954a[_0x7a67('0x51')],'AttachmentId':_0x584efe[_0x7a67('0x30')]['AttachmentId']});})[_0x7a67('0xe')](function(_0x21d96e){_0x2b0b91[_0x7a67('0x15')]=_0x21d96e;if(_0x2b0b91['interaction'][_0x7a67('0x52')]){return db[_0x7a67('0x53')][_0x7a67('0x39')]({'attributes':['id',_0x7a67('0x54')],'where':{'id':_0x2b0b91[_0x7a67('0x55')][_0x7a67('0x52')]}})[_0x7a67('0xe')](function(_0x4ddb25){if(_0x4ddb25){_0x2b0b91[_0x7a67('0x40')][_0x7a67('0x56')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4ddb25[_0x7a67('0x54')]+','+(_0x2b0b91['account'][_0x7a67('0x57')]||0xa),'interval':_0x7a67('0x4e')});}return respondWithRpcPromise(_0x7a67('0x58'),'startRouting',_0x2b0b91);});}return respondWithRpcPromise('Start',_0x7a67('0x59'),_0x2b0b91);})['then'](function(_0x4795b8){_0x24cc88(_0x4795b8);})[_0x7a67('0x22')](function(_0x499693){_0x29574d(_0x40453e[_0x7a67('0x13')](0x1f4,_0x499693['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 088d8f6..a2b5fda 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 _0x8909=['save','remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x505f7e,_0x454912){var _0x3851f9=function(_0xde87ba){while(--_0xde87ba){_0x505f7e['push'](_0x505f7e['shift']());}};_0x3851f9(++_0x454912);}(_0x8909,0x14c));var _0x9890=function(_0x4629ed,_0x59ef85){_0x4629ed=_0x4629ed-0x0;var _0x52ca04=_0x8909[_0x4629ed];return _0x52ca04;};'use strict';var FaxAccountEvents=require(_0x9890('0x0'));var events=[_0x9890('0x1'),_0x9890('0x2'),_0x9890('0x3')];function createListener(_0x2951fa,_0x10725b){return function(_0x5f4dca){_0x10725b[_0x9890('0x4')](_0x2951fa,_0x5f4dca);};}function removeListener(_0x524e23,_0x2ad9ad){return function(){FaxAccountEvents[_0x9890('0x5')](_0x524e23,_0x2ad9ad);};}exports[_0x9890('0x6')]=function(_0x65bdc1){for(var _0x466168=0x0,_0x15427b=events[_0x9890('0x7')];_0x466168<_0x15427b;_0x466168++){var _0x1c0935=events[_0x466168];var _0x431ab9=createListener(_0x9890('0x8')+_0x1c0935,_0x65bdc1);FaxAccountEvents['on'](_0x1c0935,_0x431ab9);}}; \ No newline at end of file +var _0x3048=['length','faxAccount:','save','update','emit','removeListener'];(function(_0x51a0b3,_0x2a1e73){var _0x3452de=function(_0x4ffe34){while(--_0x4ffe34){_0x51a0b3['push'](_0x51a0b3['shift']());}};_0x3452de(++_0x2a1e73);}(_0x3048,0x68));var _0x8304=function(_0x43d7c9,_0x1e369d){_0x43d7c9=_0x43d7c9-0x0;var _0xcf4d4c=_0x3048[_0x43d7c9];return _0xcf4d4c;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=[_0x8304('0x0'),'remove',_0x8304('0x1')];function createListener(_0x2eb748,_0x5972e6){return function(_0x4372fd){_0x5972e6[_0x8304('0x2')](_0x2eb748,_0x4372fd);};}function removeListener(_0x5aadd7,_0x1205a7){return function(){FaxAccountEvents[_0x8304('0x3')](_0x5aadd7,_0x1205a7);};}exports['register']=function(_0x354dfc){for(var _0x45aa85=0x0,_0x4c5322=events[_0x8304('0x4')];_0x45aa85<_0x4c5322;_0x45aa85++){var _0x42f24e=events[_0x45aa85];var _0x4057f3=createListener(_0x8304('0x5')+_0x42f24e,_0x354dfc);FaxAccountEvents['on'](_0x42f24e,_0x4057f3);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index ed936c6..54e4cf3 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(_0x54a229,_0x1a65da){var _0x3a6c60=function(_0x4ada56){while(--_0x4ada56){_0x54a229['push'](_0x54a229['shift']());}};_0x3a6c60(++_0x1a65da);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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(_0x39eb6e,_0x54d8c1){var _0x568e9e=function(_0x513a99){while(--_0x513a99){_0x39eb6e['push'](_0x39eb6e['shift']());}};_0x568e9e(++_0x54d8c1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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 ad46e16..7747980 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 _0x3835=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x1e8c6a,_0x239500){var _0x207244=function(_0x438245){while(--_0x438245){_0x1e8c6a['push'](_0x1e8c6a['shift']());}};_0x207244(++_0x239500);}(_0x3835,0xf5));var _0x5383=function(_0x11765d,_0x46113b){_0x11765d=_0x11765d-0x0;var _0x389e72=_0x3835[_0x11765d];return _0x389e72;};'use strict';var Sequelize=require(_0x5383('0x0'));module[_0x5383('0x1')]={'priority':{'type':Sequelize[_0x5383('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5383('0x3')],'allowNull':![],'defaultValue':_0x5383('0x4')},'appdata':{'type':Sequelize[_0x5383('0x5')]()},'description':{'type':Sequelize[_0x5383('0x3')]},'interval':{'type':Sequelize[_0x5383('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xa58c=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x153ce3,_0x3d14e2){var _0x1a41e7=function(_0xe18678){while(--_0xe18678){_0x153ce3['push'](_0x153ce3['shift']());}};_0x1a41e7(++_0x3d14e2);}(_0xa58c,0x184));var _0xca58=function(_0x2b0866,_0x34a049){_0x2b0866=_0x2b0866-0x0;var _0x5b6c77=_0xa58c[_0x2b0866];return _0x5b6c77;};'use strict';var Sequelize=require(_0xca58('0x0'));module['exports']={'priority':{'type':Sequelize[_0xca58('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xca58('0x2')],'allowNull':![],'defaultValue':_0xca58('0x3')},'appdata':{'type':Sequelize[_0xca58('0x4')]()},'description':{'type':Sequelize[_0xca58('0x2')]},'interval':{'type':Sequelize[_0xca58('0x2')],'defaultValue':_0xca58('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index f10002e..584cbd4 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 _0x12b6=['model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','Content-Range','apply','update','then','error','name','send','map','FaxApplication','rawAttributes','type','key'];(function(_0x69d61e,_0x424294){var _0x2e3bea=function(_0xe6085){while(--_0xe6085){_0x69d61e['push'](_0x69d61e['shift']());}};_0x2e3bea(++_0x424294);}(_0x12b6,0x165));var _0x612b=function(_0x54f8b2,_0x37fd77){_0x54f8b2=_0x54f8b2-0x0;var _0x563b6d=_0x12b6[_0x54f8b2];return _0x563b6d;};'use strict';var emlformat=require(_0x612b('0x0'));var rimraf=require(_0x612b('0x1'));var zipdir=require(_0x612b('0x2'));var jsonpatch=require(_0x612b('0x3'));var rp=require(_0x612b('0x4'));var moment=require('moment');var BPromise=require(_0x612b('0x5'));var Mustache=require('mustache');var util=require(_0x612b('0x6'));var path=require(_0x612b('0x7'));var sox=require('sox');var csv=require(_0x612b('0x8'));var ejs=require(_0x612b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x612b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x612b('0xb'));var Papa=require(_0x612b('0xc'));var Redis=require(_0x612b('0xd'));var authService=require(_0x612b('0xe'));var qs=require(_0x612b('0xf'));var as=require(_0x612b('0x10'));var hardwareService=require(_0x612b('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x612b('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x612b('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a1e93,_0x2cd015){_0x2cd015=_0x2cd015||0xcc;return function(_0x7a5f0f){if(_0x7a5f0f){return _0x3a1e93[_0x612b('0x14')](_0x2cd015);}return _0x3a1e93[_0x612b('0x15')](_0x2cd015)[_0x612b('0x16')]();};}function respondWithResult(_0x127f76,_0x2eeb8e){_0x2eeb8e=_0x2eeb8e||0xc8;return function(_0x2de920){if(_0x2de920){return _0x127f76[_0x612b('0x15')](_0x2eeb8e)[_0x612b('0x17')](_0x2de920);}};}function respondWithFilteredResult(_0x248b54,_0x1f2a36){return function(_0x45c776){if(_0x45c776){var _0x1e27ef=typeof _0x1f2a36['offset']===_0x612b('0x18')&&typeof _0x1f2a36[_0x612b('0x19')]===_0x612b('0x18');var _0x3c6d54=_0x45c776['count'];var _0x5df72c=_0x1e27ef?0x0:_0x1f2a36['offset'];var _0x203559=_0x1e27ef?_0x45c776['count']:_0x1f2a36[_0x612b('0x1a')]+_0x1f2a36[_0x612b('0x19')];var _0x220e5a;if(_0x203559>=_0x3c6d54){_0x203559=_0x3c6d54;_0x220e5a=0xc8;}else{_0x220e5a=0xce;}_0x248b54[_0x612b('0x15')](_0x220e5a);return _0x248b54['set'](_0x612b('0x1b'),_0x5df72c+'-'+_0x203559+'/'+_0x3c6d54)['json'](_0x45c776);}return null;};}function patchUpdates(_0x588c7e){return function(_0x4a2c0f){try{jsonpatch[_0x612b('0x1c')](_0x4a2c0f,_0x588c7e,!![]);}catch(_0x4744c1){return BPromise['reject'](_0x4744c1);}return _0x4a2c0f['save']();};}function saveUpdates(_0x41b26b,_0x42de3e){return function(_0x591223){if(_0x591223){return _0x591223[_0x612b('0x1d')](_0x41b26b)[_0x612b('0x1e')](function(_0x5ad3d1){return _0x5ad3d1;});}return null;};}function removeEntity(_0x503806,_0x48d083){return function(_0x22854e){if(_0x22854e){return _0x22854e['destroy']()[_0x612b('0x1e')](function(){_0x503806[_0x612b('0x15')](0xcc)[_0x612b('0x16')]();});}};}function handleEntityNotFound(_0x33b296,_0xfad797){return function(_0x38fce9){if(!_0x38fce9){_0x33b296[_0x612b('0x14')](0x194);}return _0x38fce9;};}function handleError(_0x18cbce,_0x213f60){_0x213f60=_0x213f60||0x1f4;return function(_0x513f40){logger[_0x612b('0x1f')](_0x513f40['stack']);if(_0x513f40['name']){delete _0x513f40[_0x612b('0x20')];}_0x18cbce['status'](_0x213f60)[_0x612b('0x21')](_0x513f40);};}exports['index']=function(_0x18e175,_0x483407){var _0x4136f1={},_0x1f0ad1={},_0x40f44a={'count':0x0,'rows':[]};var _0x2d8519=_[_0x612b('0x22')](db[_0x612b('0x23')][_0x612b('0x24')],function(_0x26c8f6){return{'name':_0x26c8f6['fieldName'],'type':_0x26c8f6[_0x612b('0x25')][_0x612b('0x26')]};});_0x1f0ad1[_0x612b('0x27')]=_['map'](_0x2d8519,_0x612b('0x20'));_0x1f0ad1['query']=_[_0x612b('0x28')](_0x18e175[_0x612b('0x29')]);_0x1f0ad1['filters']=_[_0x612b('0x2a')](_0x1f0ad1['model'],_0x1f0ad1[_0x612b('0x29')]);_0x4136f1[_0x612b('0x2b')]=_[_0x612b('0x2a')](_0x1f0ad1[_0x612b('0x27')],qs[_0x612b('0x2c')](_0x18e175['query']['fields']));_0x4136f1[_0x612b('0x2b')]=_0x4136f1[_0x612b('0x2b')]['length']?_0x4136f1[_0x612b('0x2b')]:_0x1f0ad1[_0x612b('0x27')];if(!_0x18e175[_0x612b('0x29')][_0x612b('0x2d')](_0x612b('0x2e'))){_0x4136f1[_0x612b('0x19')]=qs[_0x612b('0x19')](_0x18e175[_0x612b('0x29')][_0x612b('0x19')]);_0x4136f1[_0x612b('0x1a')]=qs[_0x612b('0x1a')](_0x18e175[_0x612b('0x29')][_0x612b('0x1a')]);}_0x4136f1['order']=qs[_0x612b('0x2f')](_0x18e175[_0x612b('0x29')][_0x612b('0x2f')]);_0x4136f1[_0x612b('0x30')]=qs[_0x612b('0x31')](_[_0x612b('0x32')](_0x18e175[_0x612b('0x29')],_0x1f0ad1[_0x612b('0x31')]),_0x2d8519);if(_0x18e175[_0x612b('0x29')][_0x612b('0x33')]){_0x4136f1[_0x612b('0x30')]=_[_0x612b('0x34')](_0x4136f1[_0x612b('0x30')],{'$or':_[_0x612b('0x22')](_0x2d8519,function(_0x1bb1cd){if(_0x1bb1cd[_0x612b('0x25')]!==_0x612b('0x35')){var _0x371150={};_0x371150[_0x1bb1cd[_0x612b('0x20')]]={'$like':'%'+_0x18e175[_0x612b('0x29')][_0x612b('0x33')]+'%'};return _0x371150;}})});}_0x4136f1=_[_0x612b('0x34')]({},_0x4136f1,_0x18e175[_0x612b('0x36')]);var _0x1e3857={'where':_0x4136f1[_0x612b('0x30')]};return db[_0x612b('0x23')][_0x612b('0x37')](_0x1e3857)[_0x612b('0x1e')](function(_0x28133e){_0x40f44a[_0x612b('0x37')]=_0x28133e;if(_0x18e175[_0x612b('0x29')][_0x612b('0x38')]){_0x4136f1[_0x612b('0x39')]=[{'all':!![]}];}return db[_0x612b('0x23')]['findAll'](_0x4136f1);})[_0x612b('0x1e')](function(_0x4bc9fa){_0x40f44a[_0x612b('0x3a')]=_0x4bc9fa;return _0x40f44a;})[_0x612b('0x1e')](respondWithFilteredResult(_0x483407,_0x4136f1))[_0x612b('0x3b')](handleError(_0x483407,null));};exports[_0x612b('0x3c')]=function(_0x40cb87,_0x5c9872){var _0x1835f4={'raw':!![],'where':{'id':_0x40cb87[_0x612b('0x3d')]['id']}},_0x37c378={};_0x37c378[_0x612b('0x27')]=_[_0x612b('0x28')](db['FaxApplication'][_0x612b('0x24')]);_0x37c378['query']=_['keys'](_0x40cb87[_0x612b('0x29')]);_0x37c378['filters']=_[_0x612b('0x2a')](_0x37c378['model'],_0x37c378[_0x612b('0x29')]);_0x1835f4['attributes']=_[_0x612b('0x2a')](_0x37c378[_0x612b('0x27')],qs[_0x612b('0x2c')](_0x40cb87[_0x612b('0x29')]['fields']));_0x1835f4[_0x612b('0x2b')]=_0x1835f4[_0x612b('0x2b')][_0x612b('0x3e')]?_0x1835f4[_0x612b('0x2b')]:_0x37c378[_0x612b('0x27')];if(_0x40cb87[_0x612b('0x29')]['includeAll']){_0x1835f4['include']=[{'all':!![]}];}_0x1835f4=_[_0x612b('0x34')]({},_0x1835f4,_0x40cb87[_0x612b('0x36')]);return db[_0x612b('0x23')][_0x612b('0x3f')](_0x1835f4)[_0x612b('0x1e')](handleEntityNotFound(_0x5c9872,null))[_0x612b('0x1e')](respondWithResult(_0x5c9872,null))[_0x612b('0x3b')](handleError(_0x5c9872,null));};exports['create']=function(_0x28bdd5,_0xf42efe){return db[_0x612b('0x23')][_0x612b('0x40')](_0x28bdd5[_0x612b('0x41')],{})[_0x612b('0x1e')](respondWithResult(_0xf42efe,0xc9))['catch'](handleError(_0xf42efe,null));};exports['update']=function(_0x524a3b,_0x27bb43){if(_0x524a3b[_0x612b('0x41')]['id']){delete _0x524a3b[_0x612b('0x41')]['id'];}return db[_0x612b('0x23')][_0x612b('0x3f')]({'where':{'id':_0x524a3b[_0x612b('0x3d')]['id']}})[_0x612b('0x1e')](handleEntityNotFound(_0x27bb43,null))[_0x612b('0x1e')](saveUpdates(_0x524a3b[_0x612b('0x41')],null))[_0x612b('0x1e')](respondWithResult(_0x27bb43,null))['catch'](handleError(_0x27bb43,null));};exports['destroy']=function(_0xcd00a8,_0x44ed5d){return db[_0x612b('0x23')][_0x612b('0x3f')]({'where':{'id':_0xcd00a8[_0x612b('0x3d')]['id']}})[_0x612b('0x1e')](handleEntityNotFound(_0x44ed5d,null))[_0x612b('0x1e')](removeEntity(_0x44ed5d,null))[_0x612b('0x3b')](handleError(_0x44ed5d,null));}; \ No newline at end of file +var _0x3217=['catch','find','create','body','update','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','reject','save','then','destroy','end','sendStatus','error','stack','name','map','FaxApplication','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x2a0812,_0x256c48){var _0x237a38=function(_0x4f0859){while(--_0x4f0859){_0x2a0812['push'](_0x2a0812['shift']());}};_0x237a38(++_0x256c48);}(_0x3217,0x9a));var _0x7321=function(_0x26436f,_0x2b0085){_0x26436f=_0x26436f-0x0;var _0xc936c9=_0x3217[_0x26436f];return _0xc936c9;};'use strict';var emlformat=require(_0x7321('0x0'));var rimraf=require(_0x7321('0x1'));var zipdir=require(_0x7321('0x2'));var jsonpatch=require(_0x7321('0x3'));var rp=require(_0x7321('0x4'));var moment=require(_0x7321('0x5'));var BPromise=require(_0x7321('0x6'));var Mustache=require('mustache');var util=require(_0x7321('0x7'));var path=require(_0x7321('0x8'));var sox=require(_0x7321('0x9'));var csv=require(_0x7321('0xa'));var ejs=require(_0x7321('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7321('0xc'));var squel=require(_0x7321('0xd'));var crypto=require(_0x7321('0xe'));var jsforce=require(_0x7321('0xf'));var deskjs=require(_0x7321('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7321('0x11'));var Papa=require(_0x7321('0x12'));var Redis=require(_0x7321('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7321('0x14'));var as=require(_0x7321('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7321('0x16'))('api');var utils=require(_0x7321('0x17'));var config=require(_0x7321('0x18'));var licenseUtil=require(_0x7321('0x19'));var db=require(_0x7321('0x1a'))['db'];function respondWithStatusCode(_0x447b70,_0x3b0e8d){_0x3b0e8d=_0x3b0e8d||0xcc;return function(_0x1910bb){if(_0x1910bb){return _0x447b70['sendStatus'](_0x3b0e8d);}return _0x447b70[_0x7321('0x1b')](_0x3b0e8d)['end']();};}function respondWithResult(_0x55dc17,_0x28bc2c){_0x28bc2c=_0x28bc2c||0xc8;return function(_0x358e07){if(_0x358e07){return _0x55dc17[_0x7321('0x1b')](_0x28bc2c)[_0x7321('0x1c')](_0x358e07);}};}function respondWithFilteredResult(_0x176057,_0xce4ae2){return function(_0x15632b){if(_0x15632b){var _0x543c9a=typeof _0xce4ae2[_0x7321('0x1d')]===_0x7321('0x1e')&&typeof _0xce4ae2[_0x7321('0x1f')]===_0x7321('0x1e');var _0x7bb810=_0x15632b[_0x7321('0x20')];var _0x5a2e17=_0x543c9a?0x0:_0xce4ae2[_0x7321('0x1d')];var _0x10bdab=_0x543c9a?_0x15632b[_0x7321('0x20')]:_0xce4ae2[_0x7321('0x1d')]+_0xce4ae2[_0x7321('0x1f')];var _0x232472;if(_0x10bdab>=_0x7bb810){_0x10bdab=_0x7bb810;_0x232472=0xc8;}else{_0x232472=0xce;}_0x176057[_0x7321('0x1b')](_0x232472);return _0x176057['set'](_0x7321('0x21'),_0x5a2e17+'-'+_0x10bdab+'/'+_0x7bb810)[_0x7321('0x1c')](_0x15632b);}return null;};}function patchUpdates(_0x3b525c){return function(_0x5769eb){try{jsonpatch['apply'](_0x5769eb,_0x3b525c,!![]);}catch(_0x3fed0a){return BPromise[_0x7321('0x22')](_0x3fed0a);}return _0x5769eb[_0x7321('0x23')]();};}function saveUpdates(_0x1ed891,_0x336f53){return function(_0x337771){if(_0x337771){return _0x337771['update'](_0x1ed891)[_0x7321('0x24')](function(_0x22a1e3){return _0x22a1e3;});}return null;};}function removeEntity(_0x276fe4,_0x4e638f){return function(_0x140f71){if(_0x140f71){return _0x140f71[_0x7321('0x25')]()[_0x7321('0x24')](function(){_0x276fe4[_0x7321('0x1b')](0xcc)[_0x7321('0x26')]();});}};}function handleEntityNotFound(_0x1f8d36,_0x4beef3){return function(_0x54566f){if(!_0x54566f){_0x1f8d36[_0x7321('0x27')](0x194);}return _0x54566f;};}function handleError(_0x7bdabc,_0x3e3e12){_0x3e3e12=_0x3e3e12||0x1f4;return function(_0x1a0133){logger[_0x7321('0x28')](_0x1a0133[_0x7321('0x29')]);if(_0x1a0133[_0x7321('0x2a')]){delete _0x1a0133[_0x7321('0x2a')];}_0x7bdabc['status'](_0x3e3e12)['send'](_0x1a0133);};}exports['index']=function(_0x36f3c5,_0x1d753e){var _0x330635={},_0x5b654a={},_0x52b21f={'count':0x0,'rows':[]};var _0x13f997=_[_0x7321('0x2b')](db[_0x7321('0x2c')][_0x7321('0x2d')],function(_0x3a88c4){return{'name':_0x3a88c4['fieldName'],'type':_0x3a88c4[_0x7321('0x2e')][_0x7321('0x2f')]};});_0x5b654a[_0x7321('0x30')]=_[_0x7321('0x2b')](_0x13f997,_0x7321('0x2a'));_0x5b654a[_0x7321('0x31')]=_[_0x7321('0x32')](_0x36f3c5[_0x7321('0x31')]);_0x5b654a[_0x7321('0x33')]=_[_0x7321('0x34')](_0x5b654a[_0x7321('0x30')],_0x5b654a[_0x7321('0x31')]);_0x330635[_0x7321('0x35')]=_[_0x7321('0x34')](_0x5b654a[_0x7321('0x30')],qs[_0x7321('0x36')](_0x36f3c5[_0x7321('0x31')][_0x7321('0x36')]));_0x330635[_0x7321('0x35')]=_0x330635[_0x7321('0x35')][_0x7321('0x37')]?_0x330635[_0x7321('0x35')]:_0x5b654a[_0x7321('0x30')];if(!_0x36f3c5['query']['hasOwnProperty'](_0x7321('0x38'))){_0x330635[_0x7321('0x1f')]=qs[_0x7321('0x1f')](_0x36f3c5[_0x7321('0x31')][_0x7321('0x1f')]);_0x330635[_0x7321('0x1d')]=qs['offset'](_0x36f3c5[_0x7321('0x31')]['offset']);}_0x330635[_0x7321('0x39')]=qs[_0x7321('0x3a')](_0x36f3c5[_0x7321('0x31')]['sort']);_0x330635[_0x7321('0x3b')]=qs['filters'](_[_0x7321('0x3c')](_0x36f3c5[_0x7321('0x31')],_0x5b654a[_0x7321('0x33')]),_0x13f997);if(_0x36f3c5[_0x7321('0x31')][_0x7321('0x3d')]){_0x330635[_0x7321('0x3b')]=_[_0x7321('0x3e')](_0x330635[_0x7321('0x3b')],{'$or':_['map'](_0x13f997,function(_0x2c205c){if(_0x2c205c['type']!==_0x7321('0x3f')){var _0x148dc0={};_0x148dc0[_0x2c205c['name']]={'$like':'%'+_0x36f3c5[_0x7321('0x31')][_0x7321('0x3d')]+'%'};return _0x148dc0;}})});}_0x330635=_[_0x7321('0x3e')]({},_0x330635,_0x36f3c5[_0x7321('0x40')]);var _0x203ddf={'where':_0x330635[_0x7321('0x3b')]};return db[_0x7321('0x2c')][_0x7321('0x20')](_0x203ddf)[_0x7321('0x24')](function(_0x138450){_0x52b21f[_0x7321('0x20')]=_0x138450;if(_0x36f3c5[_0x7321('0x31')][_0x7321('0x41')]){_0x330635[_0x7321('0x42')]=[{'all':!![]}];}return db['FaxApplication'][_0x7321('0x43')](_0x330635);})['then'](function(_0x5d7138){_0x52b21f['rows']=_0x5d7138;return _0x52b21f;})[_0x7321('0x24')](respondWithFilteredResult(_0x1d753e,_0x330635))[_0x7321('0x44')](handleError(_0x1d753e,null));};exports['show']=function(_0x136153,_0x4d3634){var _0x157c78={'raw':!![],'where':{'id':_0x136153['params']['id']}},_0xccb5d2={};_0xccb5d2[_0x7321('0x30')]=_[_0x7321('0x32')](db[_0x7321('0x2c')][_0x7321('0x2d')]);_0xccb5d2[_0x7321('0x31')]=_[_0x7321('0x32')](_0x136153[_0x7321('0x31')]);_0xccb5d2[_0x7321('0x33')]=_[_0x7321('0x34')](_0xccb5d2[_0x7321('0x30')],_0xccb5d2[_0x7321('0x31')]);_0x157c78['attributes']=_[_0x7321('0x34')](_0xccb5d2[_0x7321('0x30')],qs[_0x7321('0x36')](_0x136153['query']['fields']));_0x157c78[_0x7321('0x35')]=_0x157c78[_0x7321('0x35')][_0x7321('0x37')]?_0x157c78['attributes']:_0xccb5d2[_0x7321('0x30')];if(_0x136153[_0x7321('0x31')][_0x7321('0x41')]){_0x157c78['include']=[{'all':!![]}];}_0x157c78=_[_0x7321('0x3e')]({},_0x157c78,_0x136153[_0x7321('0x40')]);return db['FaxApplication'][_0x7321('0x45')](_0x157c78)[_0x7321('0x24')](handleEntityNotFound(_0x4d3634,null))[_0x7321('0x24')](respondWithResult(_0x4d3634,null))[_0x7321('0x44')](handleError(_0x4d3634,null));};exports[_0x7321('0x46')]=function(_0x2710bc,_0x46366a){return db[_0x7321('0x2c')]['create'](_0x2710bc[_0x7321('0x47')],{})[_0x7321('0x24')](respondWithResult(_0x46366a,0xc9))[_0x7321('0x44')](handleError(_0x46366a,null));};exports[_0x7321('0x48')]=function(_0xfd9161,_0x2008ff){if(_0xfd9161[_0x7321('0x47')]['id']){delete _0xfd9161[_0x7321('0x47')]['id'];}return db[_0x7321('0x2c')][_0x7321('0x45')]({'where':{'id':_0xfd9161[_0x7321('0x49')]['id']}})['then'](handleEntityNotFound(_0x2008ff,null))[_0x7321('0x24')](saveUpdates(_0xfd9161['body'],null))[_0x7321('0x24')](respondWithResult(_0x2008ff,null))[_0x7321('0x44')](handleError(_0x2008ff,null));};exports[_0x7321('0x25')]=function(_0x3e8b45,_0x4d1f27){return db[_0x7321('0x2c')][_0x7321('0x45')]({'where':{'id':_0x3e8b45['params']['id']}})[_0x7321('0x24')](handleEntityNotFound(_0x4d1f27,null))[_0x7321('0x24')](removeEntity(_0x4d1f27,null))['catch'](handleError(_0x4d1f27,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index edd773d..af8d9db 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 _0x287d=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','FaxApplication','fax_applications'];(function(_0x22ebe6,_0x182cc6){var _0x3b6886=function(_0x82eaac){while(--_0x82eaac){_0x22ebe6['push'](_0x22ebe6['shift']());}};_0x3b6886(++_0x182cc6);}(_0x287d,0xab));var _0xd287=function(_0x16dbcd,_0x274516){_0x16dbcd=_0x16dbcd-0x0;var _0x34706e=_0x287d[_0x16dbcd];return _0x34706e;};'use strict';var _=require('lodash');var util=require(_0xd287('0x0'));var logger=require(_0xd287('0x1'))(_0xd287('0x2'));var moment=require(_0xd287('0x3'));var BPromise=require(_0xd287('0x4'));var rp=require(_0xd287('0x5'));var fs=require('fs');var path=require(_0xd287('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxApplication.attributes');module[_0xd287('0x7')]=function(_0x2cad4e,_0x223856){return _0x2cad4e[_0xd287('0x8')](_0xd287('0x9'),attributes,{'tableName':_0xd287('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd287('0xb'),'collate':_0xd287('0xc')});}; \ No newline at end of file +var _0x9121=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','lodash'];(function(_0x4e40a1,_0x2c9015){var _0xa46157=function(_0x95a230){while(--_0x95a230){_0x4e40a1['push'](_0x4e40a1['shift']());}};_0xa46157(++_0x2c9015);}(_0x9121,0xd1));var _0x1912=function(_0x1ecdc3,_0x3095e1){_0x1ecdc3=_0x1ecdc3-0x0;var _0x3af46c=_0x9121[_0x1ecdc3];return _0x3af46c;};'use strict';var _=require(_0x1912('0x0'));var util=require(_0x1912('0x1'));var logger=require(_0x1912('0x2'))(_0x1912('0x3'));var moment=require(_0x1912('0x4'));var BPromise=require(_0x1912('0x5'));var rp=require(_0x1912('0x6'));var fs=require('fs');var path=require(_0x1912('0x7'));var rimraf=require(_0x1912('0x8'));var config=require('../../config/environment');var attributes=require(_0x1912('0x9'));module[_0x1912('0xa')]=function(_0x35614e,_0x1eaf35){return _0x35614e[_0x1912('0xb')](_0x1912('0xc'),attributes,{'tableName':_0x1912('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1912('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 2979af4..5715491 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 _0x589e=['request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','attributes','limit','info','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x49adfe,_0x2fd329){var _0x1d53da=function(_0x4edbdb){while(--_0x4edbdb){_0x49adfe['push'](_0x49adfe['shift']());}};_0x1d53da(++_0x2fd329);}(_0x589e,0x94));var _0xe589=function(_0x254e90,_0x117412){_0x254e90=_0x254e90-0x0;var _0x113ba0=_0x589e[_0x254e90];return _0x113ba0;};'use strict';var _=require(_0xe589('0x0'));var util=require('util');var moment=require(_0xe589('0x1'));var BPromise=require(_0xe589('0x2'));var rs=require(_0xe589('0x3'));var fs=require('fs');var Redis=require(_0xe589('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe589('0x5'));var logger=require(_0xe589('0x6'))(_0xe589('0x7'));var config=require(_0xe589('0x8'));var jayson=require(_0xe589('0x9'));var client=jayson[_0xe589('0xa')][_0xe589('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56d277,_0x1079a9,_0x125192){return new BPromise(function(_0x158f43,_0x20842b){return client[_0xe589('0xc')](_0x56d277,_0x125192)[_0xe589('0xd')](function(_0xc2de0c){logger['info'](_0xe589('0xe'),_0x1079a9,_0xe589('0xf'));logger[_0xe589('0x10')](_0xe589('0x11'),_0x1079a9,_0xe589('0xf'),JSON[_0xe589('0x12')](_0xc2de0c));if(_0xc2de0c[_0xe589('0x13')]){if(_0xc2de0c[_0xe589('0x13')][_0xe589('0x14')]===0x1f4){logger['error'](_0xe589('0xe'),_0x1079a9,_0xc2de0c[_0xe589('0x13')][_0xe589('0x15')]);return _0x20842b(_0xc2de0c[_0xe589('0x13')][_0xe589('0x15')]);}logger[_0xe589('0x13')](_0xe589('0xe'),_0x1079a9,_0xc2de0c[_0xe589('0x13')][_0xe589('0x15')]);return _0x158f43(_0xc2de0c['error'][_0xe589('0x15')]);}else{logger['info']('FaxApplication,\x20%s,\x20%s',_0x1079a9,_0xe589('0xf'));_0x158f43(_0xc2de0c['result'][_0xe589('0x15')]);}})[_0xe589('0x16')](function(_0x52241c){logger[_0xe589('0x13')](_0xe589('0xe'),_0x1079a9,_0x52241c);_0x20842b(_0x52241c);});});}exports[_0xe589('0x17')]=function(_0x31621d){var _0xfcd9c7=this;return new Promise(function(_0x5e30a3,_0x245faa){return db[_0xe589('0x18')][_0xe589('0x19')](_0x31621d[_0xe589('0x1a')],{'raw':_0x31621d[_0xe589('0x1b')]?_0x31621d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31621d['options']?_0x31621d[_0xe589('0x1b')][_0xe589('0x1c')]||null:null,'attributes':_0x31621d[_0xe589('0x1b')]?_0x31621d['options'][_0xe589('0x1d')]||null:null,'limit':_0x31621d[_0xe589('0x1b')]?_0x31621d[_0xe589('0x1b')][_0xe589('0x1e')]||null:null})['then'](function(_0x3516ff){logger[_0xe589('0x1f')](_0xe589('0x17'),_0x31621d);logger[_0xe589('0x10')](_0xe589('0x17'),_0x31621d,JSON[_0xe589('0x12')](_0x3516ff));_0x5e30a3(_0x3516ff);})[_0xe589('0x16')](function(_0x5dddc1){logger[_0xe589('0x13')](_0xe589('0x17'),_0x5dddc1[_0xe589('0x15')],_0x31621d);_0x245faa(_0xfcd9c7[_0xe589('0x13')](0x1f4,_0x5dddc1[_0xe589('0x15')]));});});}; \ No newline at end of file +var _0x3291=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UpdateFaxApplication','update','options','raw','where','attributes','lodash','util','moment','randomstring','ioredis'];(function(_0x27a0a9,_0x1e7dd1){var _0x11cb3b=function(_0x5a9aa3){while(--_0x5a9aa3){_0x27a0a9['push'](_0x27a0a9['shift']());}};_0x11cb3b(++_0x1e7dd1);}(_0x3291,0x1cb));var _0x1329=function(_0xe0ee30,_0x3d6136){_0xe0ee30=_0xe0ee30-0x0;var _0x5f328b=_0x3291[_0xe0ee30];return _0x5f328b;};'use strict';var _=require(_0x1329('0x0'));var util=require(_0x1329('0x1'));var moment=require(_0x1329('0x2'));var BPromise=require('bluebird');var rs=require(_0x1329('0x3'));var fs=require('fs');var Redis=require(_0x1329('0x4'));var db=require(_0x1329('0x5'))['db'];var utils=require(_0x1329('0x6'));var logger=require(_0x1329('0x7'))(_0x1329('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1329('0x9')][_0x1329('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3904d0,_0x2ca3fc,_0x3823ae){return new BPromise(function(_0x429dd0,_0x338c94){return client[_0x1329('0xb')](_0x3904d0,_0x3823ae)[_0x1329('0xc')](function(_0x39fec9){logger['info'](_0x1329('0xd'),_0x2ca3fc,_0x1329('0xe'));logger[_0x1329('0xf')](_0x1329('0x10'),_0x2ca3fc,_0x1329('0xe'),JSON[_0x1329('0x11')](_0x39fec9));if(_0x39fec9['error']){if(_0x39fec9[_0x1329('0x12')]['code']===0x1f4){logger['error'](_0x1329('0xd'),_0x2ca3fc,_0x39fec9['error'][_0x1329('0x13')]);return _0x338c94(_0x39fec9[_0x1329('0x12')][_0x1329('0x13')]);}logger['error'](_0x1329('0xd'),_0x2ca3fc,_0x39fec9[_0x1329('0x12')][_0x1329('0x13')]);return _0x429dd0(_0x39fec9[_0x1329('0x12')][_0x1329('0x13')]);}else{logger[_0x1329('0x14')](_0x1329('0xd'),_0x2ca3fc,_0x1329('0xe'));_0x429dd0(_0x39fec9[_0x1329('0x15')]['message']);}})[_0x1329('0x16')](function(_0x4843ad){logger[_0x1329('0x12')](_0x1329('0xd'),_0x2ca3fc,_0x4843ad);_0x338c94(_0x4843ad);});});}exports[_0x1329('0x17')]=function(_0x8ee5b4){var _0x4ad417=this;return new Promise(function(_0x16afa2,_0xdefa5f){return db['FaxApplication'][_0x1329('0x18')](_0x8ee5b4['body'],{'raw':_0x8ee5b4[_0x1329('0x19')]?_0x8ee5b4['options'][_0x1329('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8ee5b4[_0x1329('0x19')]?_0x8ee5b4[_0x1329('0x19')][_0x1329('0x1b')]||null:null,'attributes':_0x8ee5b4[_0x1329('0x19')]?_0x8ee5b4[_0x1329('0x19')][_0x1329('0x1c')]||null:null,'limit':_0x8ee5b4[_0x1329('0x19')]?_0x8ee5b4[_0x1329('0x19')]['limit']||null:null})[_0x1329('0xc')](function(_0x3a5e4a){logger[_0x1329('0x14')]('UpdateFaxApplication',_0x8ee5b4);logger[_0x1329('0xf')](_0x1329('0x17'),_0x8ee5b4,JSON['stringify'](_0x3a5e4a));_0x16afa2(_0x3a5e4a);})[_0x1329('0x16')](function(_0x17063d){logger['error']('UpdateFaxApplication',_0x17063d[_0x1329('0x13')],_0x8ee5b4);_0xdefa5f(_0x4ad417[_0x1329('0x12')](0x1f4,_0x17063d[_0x1329('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 1f8eff2..1414ed7 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 _0x1775=['../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x272da3,_0x2ce295){var _0xbfd0de=function(_0x167a44){while(--_0x167a44){_0x272da3['push'](_0x272da3['shift']());}};_0xbfd0de(++_0x2ce295);}(_0x1775,0x1db));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x5177('0x0'));var path=require(_0x5177('0x1'));var timeout=require(_0x5177('0x2'));var express=require(_0x5177('0x3'));var router=express[_0x5177('0x4')]();var fs_extra=require(_0x5177('0x5'));var auth=require(_0x5177('0x6'));var interaction=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var controller=require(_0x5177('0x9'));router[_0x5177('0xa')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0xc')]);router[_0x5177('0xa')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0xe')]);router[_0x5177('0xf')]('/',auth[_0x5177('0xb')](),controller[_0x5177('0x10')]);router[_0x5177('0x11')](_0x5177('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5177('0x12')](_0x5177('0xd'),auth[_0x5177('0xb')](),controller[_0x5177('0x13')]);module[_0x5177('0x14')]=router; \ No newline at end of file +var _0x3266=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','isAuthenticated','index','get','post','create','put','/:id','update','delete','destroy'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x3266,0x6a));var _0x6326=function(_0x1ebce2,_0x10e903){_0x1ebce2=_0x1ebce2-0x0;var _0x4a330c=_0x3266[_0x1ebce2];return _0x4a330c;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var fs_extra=require(_0x6326('0x6'));var auth=require(_0x6326('0x7'));var interaction=require(_0x6326('0x8'));var config=require('../../config/environment');var controller=require(_0x6326('0x9'));router['get']('/',auth[_0x6326('0xa')](),controller[_0x6326('0xb')]);router[_0x6326('0xc')]('/:id',auth[_0x6326('0xa')](),controller['show']);router[_0x6326('0xd')]('/',auth[_0x6326('0xa')](),controller[_0x6326('0xe')]);router[_0x6326('0xf')](_0x6326('0x10'),auth['isAuthenticated'](),controller[_0x6326('0x11')]);router[_0x6326('0x12')](_0x6326('0x10'),auth[_0x6326('0xa')](),controller[_0x6326('0x13')]);module[_0x6326('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index f39388d..1ba9fb2 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 _0x2b78=['sequelize','exports','DATE','STRING','ENUM','out'];(function(_0x4a9b4e,_0x229afb){var _0x53c60a=function(_0x273e97){while(--_0x273e97){_0x4a9b4e['push'](_0x4a9b4e['shift']());}};_0x53c60a(++_0x229afb);}(_0x2b78,0x1c8));var _0x82b7=function(_0x1d484c,_0x27c954){_0x1d484c=_0x1d484c-0x0;var _0xb2ec18=_0x2b78[_0x1d484c];return _0xb2ec18;};'use strict';var Sequelize=require(_0x82b7('0x0'));module[_0x82b7('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x82b7('0x2')]},'disposition':{'type':Sequelize[_0x82b7('0x3')]},'secondDisposition':{'type':Sequelize[_0x82b7('0x3')]},'thirdDisposition':{'type':Sequelize[_0x82b7('0x3')]},'note':{'type':Sequelize[_0x82b7('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0x82b7('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x82b7('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x82b7('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x82b7('0x4')]('in',_0x82b7('0x5')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x6689=['ENUM','out','exports','BOOLEAN','DATE','STRING'];(function(_0x3a13cf,_0x478c62){var _0x4817c=function(_0x3a2e75){while(--_0x3a2e75){_0x3a13cf['push'](_0x3a13cf['shift']());}};_0x4817c(++_0x478c62);}(_0x6689,0x176));var _0x9668=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6689[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x9668('0x0')]={'closed':{'type':Sequelize[_0x9668('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9668('0x2')]},'disposition':{'type':Sequelize[_0x9668('0x3')]},'secondDisposition':{'type':Sequelize[_0x9668('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9668('0x3')]},'read1stAt':{'type':Sequelize[_0x9668('0x2')]},'fax':{'type':Sequelize[_0x9668('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x9668('0x4')]('in',_0x9668('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x9668('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 324a995..619a971 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 _0x21c7=['fields','attributes','length','nolimit','order','sort','where','pick','select','field','color','tools_tags','ui.FaxInteractionId','user_has_fax_interactions','left_join','u.id\x20=\x20ui.UserId','from','fax_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','isEmpty','forEach','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','group','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','getFaxAccounts','toString','sequelize','keyBy','merge','FaxInteraction','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','all','rows','rawAttributes','includeAll','include','options','create','body','catch','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','findAll','addTags','setTags','spread','emit','faxInteractionTags:save','removeTags','download','unix','root','files','tmp','join','server','attachments','format','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','existsSync','createReadStream','log','err','sendStatus','rimraf','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','json','undefined','limit','offset','count','set','apply','update','then','destroy','end','error','stack','name','send','Users','map','fullname','Tags','split','push','TagIds','index','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x215e00,_0x50f345){var _0x180847=function(_0x3287ce){while(--_0x3287ce){_0x215e00['push'](_0x215e00['shift']());}};_0x180847(++_0x50f345);}(_0x21c7,0x99));var _0x721c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x21c7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x721c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x721c('0x1'));var BPromise=require(_0x721c('0x2'));var Mustache=require(_0x721c('0x3'));var util=require(_0x721c('0x4'));var path=require('path');var sox=require(_0x721c('0x5'));var csv=require('to-csv');var ejs=require(_0x721c('0x6'));var fs=require('fs');var fs_extra=require(_0x721c('0x7'));var _=require(_0x721c('0x8'));var squel=require('squel');var crypto=require(_0x721c('0x9'));var jsforce=require(_0x721c('0xa'));var deskjs=require(_0x721c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x721c('0xc'));var Papa=require(_0x721c('0xd'));var Redis=require(_0x721c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x721c('0xf'));var hardwareService=require(_0x721c('0x10'));var logger=require('../../config/logger')(_0x721c('0x11'));var utils=require(_0x721c('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x721c('0x13'));var db=require(_0x721c('0x14'))['db'];config[_0x721c('0x15')]=_[_0x721c('0x16')](config[_0x721c('0x15')],{'host':_0x721c('0x17'),'port':0x18eb});var socket=require(_0x721c('0x18'))(new Redis(config[_0x721c('0x15')]));require(_0x721c('0x19'))[_0x721c('0x1a')](socket);function respondWithStatusCode(_0x4b3d4c,_0x58d93b){_0x58d93b=_0x58d93b||0xcc;return function(_0x59647b){if(_0x59647b){return _0x4b3d4c['sendStatus'](_0x58d93b);}return _0x4b3d4c[_0x721c('0x1b')](_0x58d93b)['end']();};}function respondWithResult(_0x38d022,_0x4451f6){_0x4451f6=_0x4451f6||0xc8;return function(_0xe68b3b){if(_0xe68b3b){return _0x38d022[_0x721c('0x1b')](_0x4451f6)[_0x721c('0x1c')](_0xe68b3b);}};}function respondWithFilteredResult(_0x17341a,_0x571e8f){return function(_0x2ceb27){if(_0x2ceb27){var _0x48d392=typeof _0x571e8f['offset']===_0x721c('0x1d')&&typeof _0x571e8f[_0x721c('0x1e')]==='undefined';var _0x3f77e3=_0x2ceb27['count'];var _0x2cb774=_0x48d392?0x0:_0x571e8f[_0x721c('0x1f')];var _0x51ec9e=_0x48d392?_0x2ceb27[_0x721c('0x20')]:_0x571e8f['offset']+_0x571e8f['limit'];var _0x69e8cc;if(_0x51ec9e>=_0x3f77e3){_0x51ec9e=_0x3f77e3;_0x69e8cc=0xc8;}else{_0x69e8cc=0xce;}_0x17341a[_0x721c('0x1b')](_0x69e8cc);return _0x17341a[_0x721c('0x21')]('Content-Range',_0x2cb774+'-'+_0x51ec9e+'/'+_0x3f77e3)[_0x721c('0x1c')](_0x2ceb27);}return null;};}function patchUpdates(_0x69016f){return function(_0x3fc921){try{jsonpatch[_0x721c('0x22')](_0x3fc921,_0x69016f,!![]);}catch(_0xe8032b){return BPromise['reject'](_0xe8032b);}return _0x3fc921['save']();};}function saveUpdates(_0x1f9835,_0x3b49c0){return function(_0x5daacb){if(_0x5daacb){return _0x5daacb[_0x721c('0x23')](_0x1f9835)[_0x721c('0x24')](function(_0x10d5b6){return _0x10d5b6;});}return null;};}function removeEntity(_0x3bf663,_0x1a1dc4){return function(_0x5adc46){if(_0x5adc46){return _0x5adc46[_0x721c('0x25')]()[_0x721c('0x24')](function(){_0x3bf663[_0x721c('0x1b')](0xcc)[_0x721c('0x26')]();});}};}function handleEntityNotFound(_0x5e1a74,_0x3f95ed){return function(_0x1b9a60){if(!_0x1b9a60){_0x5e1a74['sendStatus'](0x194);}return _0x1b9a60;};}function handleError(_0x2d7413,_0xc17ad1){_0xc17ad1=_0xc17ad1||0x1f4;return function(_0x534987){logger[_0x721c('0x27')](_0x534987[_0x721c('0x28')]);if(_0x534987[_0x721c('0x29')]){delete _0x534987[_0x721c('0x29')];}_0x2d7413[_0x721c('0x1b')](_0xc17ad1)[_0x721c('0x2a')](_0x534987);};}function getInteractionUsers(_0x5a5ca6,_0x1ec307){return new BPromise(function(_0x36b140,_0x3a5393){try{if(_0x1ec307[_0x5a5ca6['id']]){_0x5a5ca6[_0x721c('0x2b')]=_[_0x721c('0x2c')](_0x1ec307[_0x5a5ca6['id']],function(_0x552164){return{'id':_0x552164['id'],'fullname':_0x552164[_0x721c('0x2d')]};});}}catch(_0x1d1887){_0x3a5393(_0x1d1887);}_0x36b140(_0x5a5ca6);});}function getInteractionTags(_0x125299,_0x1c8297){return new BPromise(function(_0xdec993,_0x1d53ed){try{if(_0x125299['TagIds']){_0x125299[_0x721c('0x2e')]=[];_0x125299['TagIds'][_0x721c('0x2f')](',')['forEach'](function(_0x3ebde4){_0x125299[_0x721c('0x2e')][_0x721c('0x30')](_0x1c8297[_0x3ebde4]);});}delete _0x125299[_0x721c('0x31')];}catch(_0x28a13f){_0x1d53ed(_0x28a13f);}_0xdec993(_0x125299);});}function updateFaxInteraction(_0x365d54,_0x3adc56,_0x546c1e){return new BPromise(function(_0x22bb61,_0x13dba9){return getInteractionUsers(_0x365d54,_0x546c1e)[_0x721c('0x24')](function(_0x23f12b){return getInteractionTags(_0x23f12b,_0x3adc56);})[_0x721c('0x24')](function(_0x1cdbcc){_0x22bb61(_0x1cdbcc);})['catch'](function(_0x3bd072){_0x13dba9(_0x3bd072);});});}exports[_0x721c('0x32')]=function(_0x1e22f5,_0x284193){var _0x433a4f={},_0x4012eb={},_0xeded77={'count':0x0,'rows':[]};var _0x2e9f57=_[_0x721c('0x2c')](db['FaxInteraction']['rawAttributes'],function(_0x113af6){return{'name':_0x113af6[_0x721c('0x33')],'type':_0x113af6[_0x721c('0x34')][_0x721c('0x35')]};});_0x4012eb[_0x721c('0x36')]=_[_0x721c('0x2c')](_0x2e9f57,'name');_0x4012eb[_0x721c('0x37')]=_[_0x721c('0x38')](_0x1e22f5[_0x721c('0x37')]);_0x4012eb[_0x721c('0x39')]=_[_0x721c('0x3a')](_0x4012eb[_0x721c('0x36')],_0x4012eb[_0x721c('0x37')]);_0x433a4f['attributes']=_[_0x721c('0x3a')](_0x4012eb[_0x721c('0x36')],qs['fields'](_0x1e22f5[_0x721c('0x37')][_0x721c('0x3b')]));_0x433a4f['attributes']=_0x433a4f[_0x721c('0x3c')][_0x721c('0x3d')]?_0x433a4f[_0x721c('0x3c')]:_0x4012eb[_0x721c('0x36')];if(!_0x1e22f5[_0x721c('0x37')]['hasOwnProperty'](_0x721c('0x3e'))){_0x433a4f[_0x721c('0x1e')]=qs[_0x721c('0x1e')](_0x1e22f5[_0x721c('0x37')][_0x721c('0x1e')]);_0x433a4f[_0x721c('0x1f')]=qs[_0x721c('0x1f')](_0x1e22f5[_0x721c('0x37')][_0x721c('0x1f')]);}_0x433a4f[_0x721c('0x3f')]=qs[_0x721c('0x40')](_0x1e22f5[_0x721c('0x37')][_0x721c('0x40')]);_0x433a4f[_0x721c('0x41')]=qs[_0x721c('0x39')](_[_0x721c('0x42')](_0x1e22f5[_0x721c('0x37')],_0x4012eb[_0x721c('0x39')]),_0x2e9f57);var _0xee04b5=[];var _0x353d20=squel[_0x721c('0x43')]()[_0x721c('0x44')]('id')[_0x721c('0x44')](_0x721c('0x29'))[_0x721c('0x44')](_0x721c('0x45'))['from'](_0x721c('0x46'));var _0x5a38f8=squel[_0x721c('0x43')]()[_0x721c('0x44')]('u.id')['field']('u.fullname')[_0x721c('0x44')](_0x721c('0x47'))['from'](_0x721c('0x48'),'ui')[_0x721c('0x49')]('users','u',_0x721c('0x4a'));var _0x3329a9=squel[_0x721c('0x43')]()[_0x721c('0x4b')](_0x721c('0x4c'),'i')[_0x721c('0x49')](_0x721c('0x4d'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x721c('0x49')](_0x721c('0x4e'),'o',_0x721c('0x4f'))[_0x721c('0x49')]('fax_accounts','a',_0x721c('0x50'))[_0x721c('0x49')](_0x721c('0x51'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x721c('0x49')](_0x721c('0x52'),'it',_0x721c('0x53'))[_0x721c('0x49')](_0x721c('0x46'),'t',_0x721c('0x54'));var _0x293d27=squel[_0x721c('0x55')]();var _0x25369e=[];var _0x4154a0=squel[_0x721c('0x55')]();var _0x44f453;if(_0x1e22f5[_0x721c('0x37')][_0x721c('0x56')]){_0x44f453=as['parseSearch'](_0x1e22f5['query'][_0x721c('0x56')]);var _0x4ef6fb=_0x44f453[_0x721c('0x57')];for(var _0x52816a=0x0;_0x52816a<_0x44f453[_0x721c('0x58')][_0x721c('0x3d')];_0x52816a++){var _0x2ce4d7=_0x44f453[_0x721c('0x58')][_0x52816a];var _0x4ce71d='i';var _0x58f2e7=_[_0x721c('0x59')](_0x2e9f57,[_0x721c('0x29'),_0x2ce4d7[_0x721c('0x44')]]);if(!_0x58f2e7){switch(_0x2ce4d7[_0x721c('0x44')]){case _0x721c('0x5a'):if(_0x2ce4d7[_0x721c('0x5b')]==0x1){_0x3329a9[_0x721c('0x5c')]('`'+_0x2ce4d7[_0x721c('0x44')]+_0x721c('0x5d'));}else{_0x3329a9[_0x721c('0x5c')]('`'+_0x2ce4d7['field']+_0x721c('0x5e'));}break;case'Contact':if(_0x2ce4d7[_0x721c('0x5f')]===_0x721c('0x60')){if(_0x2ce4d7[_0x721c('0x5b')][_0x721c('0x2f')]('\x20')[_0x721c('0x3d')]>0x1){_0x293d27[_0x4ef6fb](_0x721c('0x61'),qs[_0x721c('0x62')](_0x2ce4d7[_0x721c('0x5b')]),null);}else{var _0x1b9860='%'+_0x2ce4d7[_0x721c('0x5b')]+'%';_0x293d27[_0x4ef6fb](_0x721c('0x63'),_0x1b9860,_0x1b9860,_0x1b9860);}}else{_0x58f2e7=_[_0x721c('0x59')](_0x2e9f57,[_0x721c('0x29'),'ContactId']);_0x2ce4d7[_0x721c('0x44')]=_0x721c('0x64');_0x13ae10=as[_0x721c('0x65')](_0x4ce71d,_0x58f2e7[_0x721c('0x34')],_0x2ce4d7);_0x293d27[_0x4ef6fb](_0x13ae10[_0x721c('0x66')],_0x13ae10[_0x721c('0x5b')][_0x721c('0x67')],_0x13ae10[_0x721c('0x5b')][_0x721c('0x26')]);}break;case _0x721c('0x68'):var _0x4152ed=_0x2ce4d7[_0x721c('0x5b')][_0x721c('0x2f')](',')[_0x721c('0x2c')](function(_0x52f297){return Number(_0x52f297);});_0x4152ed['forEach'](function(_0x2983fb){_0x4154a0['or'](_0x721c('0x69'),'%,'+_0x2983fb+',%');});_0x25369e=_[_0x721c('0x6a')](_0x25369e,_0x4152ed);break;case'User':if(_0x2ce4d7[_0x721c('0x5f')]===_0x721c('0x60')){_0x293d27[_0x4ef6fb](_0x721c('0x6b'),'%'+_0x2ce4d7['value']+'%',null);}else{_0x58f2e7=_[_0x721c('0x59')](_0x2e9f57,[_0x721c('0x29'),_0x721c('0x6c')]);_0x2ce4d7[_0x721c('0x44')]='UserId';_0x13ae10=as[_0x721c('0x65')](_0x4ce71d,_0x58f2e7[_0x721c('0x34')],_0x2ce4d7);_0x293d27[_0x4ef6fb](_0x13ae10[_0x721c('0x66')],_0x13ae10['value'][_0x721c('0x67')],_0x13ae10[_0x721c('0x5b')][_0x721c('0x26')]);}break;case'body':_0x13ae10=as[_0x721c('0x65')]('me',null,_0x2ce4d7);_0x293d27[_0x4ef6fb](_0x13ae10[_0x721c('0x66')],_0x13ae10[_0x721c('0x5b')][_0x721c('0x67')],_0x13ae10[_0x721c('0x5b')]['end']);break;}}else{var _0x13ae10=as[_0x721c('0x65')](_0x4ce71d,_0x58f2e7[_0x721c('0x34')],_0x2ce4d7);_0x293d27[_0x4ef6fb](_0x13ae10[_0x721c('0x66')],_0x13ae10[_0x721c('0x5b')][_0x721c('0x67')],_0x13ae10[_0x721c('0x5b')][_0x721c('0x26')]);}}}else{var _0x3102ed=_(_0x1e22f5[_0x721c('0x37')])[_0x721c('0x38')]()[_0x721c('0x2c')](function(_0x3b3d73){return _[_0x721c('0x6d')](_0x2e9f57,[_0x721c('0x29'),_0x3b3d73])?_0x3b3d73:undefined;})['compact']()[_0x721c('0x5b')]();if(!_[_0x721c('0x6e')](_0x3102ed)){_0x3102ed[_0x721c('0x6f')](function(_0x1099c6){if(_0x1099c6===_0x721c('0x70')){_0x3329a9[_0x721c('0x41')](_0x721c('0x71'),[][_0x721c('0x72')](_0x1e22f5[_0x721c('0x37')][_0x1099c6]));}else if(_0x1099c6===_0x721c('0x73')){var _0x53c3b8=JSON[_0x721c('0x74')](_0x1e22f5[_0x721c('0x37')][_0x1099c6])[_0x721c('0x75')];var _0x2cbf28=JSON[_0x721c('0x74')](_0x1e22f5[_0x721c('0x37')][_0x1099c6])[_0x721c('0x76')];_0x3329a9[_0x721c('0x41')](_0x721c('0x77'),_0x53c3b8,_0x2cbf28);}else{if(_0x1e22f5[_0x721c('0x37')][_0x1099c6]==='null'){_0x3329a9[_0x721c('0x41')]('i.'+_0x1099c6+'\x20IS\x20NULL');}else{_0x3329a9[_0x721c('0x41')]('i.'+_0x1099c6+_0x721c('0x78'),_0x1e22f5[_0x721c('0x37')][_0x1099c6]);}}});}if(_0x1e22f5[_0x721c('0x37')][_0x721c('0x79')]){if(_0x1e22f5[_0x721c('0x37')][_0x721c('0x79')]==0x1){_0x3329a9[_0x721c('0x5c')](_0x721c('0x7a'));}else{_0x3329a9[_0x721c('0x5c')](_0x721c('0x7b'));}}if(_0x1e22f5[_0x721c('0x37')]['tag']){_0x25369e=_['isArray'](_0x1e22f5[_0x721c('0x37')][_0x721c('0x7c')])?_0x1e22f5[_0x721c('0x37')][_0x721c('0x7c')]:new Array(_0x1e22f5[_0x721c('0x37')][_0x721c('0x7c')]);_0x25369e['forEach'](function(_0x53ce3a){_0x4154a0['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x53ce3a+',%');});}if(_0x1e22f5[_0x721c('0x37')][_0x721c('0x7d')]){var _0x3c2ee0=_0x1e22f5[_0x721c('0x37')][_0x721c('0x7d')]['replace']('\x5c','\x5c\x5c')[_0x721c('0x7e')](/'/g,'\x27\x27');if(qs[_0x721c('0x7f')](_0x3c2ee0)){_0x293d27['or'](_0x721c('0x80'),_0x3c2ee0+'%')['or']('i.fax\x20LIKE\x20?',_0x3c2ee0+'%');}_0x293d27['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3c2ee0+'%');}}_0x3329a9[_0x721c('0x41')](_0x293d27);_0x3329a9[_0x721c('0x81')]('i.id');var _0x48a158={'type':db[_0x721c('0x82')][_0x721c('0x83')]['SELECT'],'raw':!![]};var _0x4d020f=_0x3329a9[_0x721c('0x84')]();_0x4d020f[_0x721c('0x44')]('i.id');_0x4d020f['field'](_0x721c('0x85'),_0x721c('0x5a'));if(_0x433a4f['order']){_0x433a4f['order'][_0x721c('0x6f')](function(_0x117e9e){var _0x1953dd=_0x117e9e[0x0]===_0x721c('0x86')?_0x117e9e[0x0]:'i.'+_0x117e9e[0x0];_0x3329a9[_0x721c('0x3f')](_0x1953dd,_0x117e9e[0x1]===_0x721c('0x87')?![]:!![]);});}if(!_[_0x721c('0x6e')](_0x25369e)){_0x3329a9['having'](_0x4154a0);_0x4d020f['where'](_0x721c('0x88'),_0x25369e);}BPromise[_0x721c('0x89')]()[_0x721c('0x24')](function(){if(!_0x44f453){if(_0x1e22f5[_0x721c('0x37')][_0x721c('0x70')])return;_0x4d020f[_0x721c('0x41')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x3329a9[_0x721c('0x41')](_0x721c('0x8a'));return;}if(_0x1e22f5[_0x721c('0x8b')][_0x721c('0x8c')]!==_0x721c('0x8d'))return;return _0x1e22f5[_0x721c('0x8b')][_0x721c('0x8e')]({'attributes':['id'],'raw':!![]})[_0x721c('0x24')](function(_0x22d1d6){if(_[_0x721c('0x6e')](_0x22d1d6)){_0x4d020f[_0x721c('0x41')]('i.FaxAccountId\x20IS\x20NULL');_0x3329a9[_0x721c('0x41')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x4d020f[_0x721c('0x41')](_0x721c('0x71'),_[_0x721c('0x2c')](_0x22d1d6,'id'));_0x3329a9[_0x721c('0x41')](_0x721c('0x71'),_[_0x721c('0x2c')](_0x22d1d6,'id'));}});})[_0x721c('0x24')](function(){if(_0x1e22f5[_0x721c('0x8b')]['role']===_0x721c('0x8d')&&!_0x44f453&&!_0x1e22f5[_0x721c('0x37')][_0x721c('0x70')])return[];return db['sequelize'][_0x721c('0x37')](_0x4d020f[_0x721c('0x8f')](),_0x48a158);})[_0x721c('0x24')](function(_0x3078ca){_0xeded77[_0x721c('0x20')]=_0x3078ca[_0x721c('0x3d')];if(_0xeded77['count']===0x0)return[];return db[_0x721c('0x90')][_0x721c('0x37')](_0x353d20[_0x721c('0x8f')](),_0x48a158)['then'](function(_0xbd9d){_0xee04b5=_[_0x721c('0x91')](_0xbd9d,'id');_0x48a158=_[_0x721c('0x92')](_0x48a158,{'model':db[_0x721c('0x93')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1e22f5[_0x721c('0x37')][_0x721c('0x3b')]){_0x433a4f[_0x721c('0x3c')][_0x721c('0x6f')](function(_0x4b5dcc){_0x3329a9[_0x721c('0x44')]('i.'+_0x4b5dcc);});}else{_0x3329a9[_0x721c('0x44')](_0x721c('0x85'),_0x721c('0x5a'));_0x3329a9[_0x721c('0x44')](_0x721c('0x94'),_0x721c('0x95'));_0x3329a9[_0x721c('0x44')](_0x721c('0x96'),'Account.mandatoryDisposition');_0x3329a9['field'](_0x721c('0x97'),_0x721c('0x86'));_0x3329a9[_0x721c('0x44')](_0x721c('0x98'));_0x3329a9[_0x721c('0x44')](_0x721c('0x99'),_0x721c('0x9a'));_0x3329a9[_0x721c('0x44')](_0x721c('0x9b'),_0x721c('0x9c'));_0x3329a9['field'](_0x721c('0x9d'),_0x721c('0x9e'));_0x3329a9[_0x721c('0x44')](_0x721c('0x9f'),_0x721c('0xa0'));_0x3329a9[_0x721c('0x44')]('c.mobile',_0x721c('0xa1'));_0x3329a9['field']('c.fax',_0x721c('0xa2'));_0x3329a9[_0x721c('0x44')](_0x721c('0xa3'),_0x721c('0xa4'));_0x3329a9['field'](_0x721c('0xa5'),'Owner.internal');_0x3329a9[_0x721c('0x44')](_0x721c('0xa6'),_0x721c('0x31'));}if(_0x433a4f['limit'])_0x3329a9[_0x721c('0x1e')](_0x433a4f[_0x721c('0x1e')]);if(_0x433a4f[_0x721c('0x1f')])_0x3329a9[_0x721c('0x1f')](_0x433a4f[_0x721c('0x1f')]);return db[_0x721c('0x90')]['query'](_0x3329a9[_0x721c('0x8f')](),_0x48a158);})['then'](function(_0x1e4339){if(_0x1e4339[_0x721c('0x3d')]>0x0)_0x5a38f8['where']('ui.FaxInteractionId\x20IN\x20?',_[_0x721c('0x2c')](_0x1e4339,'id'));return db[_0x721c('0x90')]['query'](_0x5a38f8[_0x721c('0x8f')](),_0x48a158)['then'](function(_0x16a235){var _0x1a6878=_[_0x721c('0xa7')](_0x16a235,_0x721c('0xa8'));var _0x3d5d33=[];_0x1e4339[_0x721c('0x6f')](function(_0x5cdc70){_0x3d5d33[_0x721c('0x30')](updateFaxInteraction(_0x5cdc70,_0xee04b5,_0x1a6878));});return BPromise[_0x721c('0xa9')](_0x3d5d33);});});})[_0x721c('0x24')](function(_0x22b82e){_0xeded77[_0x721c('0xaa')]=_0x22b82e;return _0xeded77;})[_0x721c('0x24')](respondWithFilteredResult(_0x284193,_0x433a4f))['catch'](handleError(_0x284193,null));};exports['show']=function(_0x52f229,_0x519c76){var _0x230cbd={'raw':![],'where':{'id':_0x52f229['params']['id']}},_0x4b2421={};_0x4b2421[_0x721c('0x36')]=_['keys'](db['FaxInteraction'][_0x721c('0xab')]);_0x4b2421[_0x721c('0x37')]=_[_0x721c('0x38')](_0x52f229[_0x721c('0x37')]);_0x4b2421[_0x721c('0x39')]=_['intersection'](_0x4b2421[_0x721c('0x36')],_0x4b2421[_0x721c('0x37')]);_0x230cbd[_0x721c('0x3c')]=_[_0x721c('0x3a')](_0x4b2421[_0x721c('0x36')],qs[_0x721c('0x3b')](_0x52f229[_0x721c('0x37')][_0x721c('0x3b')]));_0x230cbd['attributes']=_0x230cbd['attributes'][_0x721c('0x3d')]?_0x230cbd[_0x721c('0x3c')]:_0x4b2421[_0x721c('0x36')];if(_0x52f229[_0x721c('0x37')][_0x721c('0xac')]){_0x230cbd[_0x721c('0xad')]=[{'all':!![]}];}_0x230cbd=_[_0x721c('0x92')]({},_0x230cbd,_0x52f229[_0x721c('0xae')]);return db[_0x721c('0x93')]['find'](_0x230cbd)[_0x721c('0x24')](handleEntityNotFound(_0x519c76,null))[_0x721c('0x24')](respondWithResult(_0x519c76,null))['catch'](handleError(_0x519c76,null));};exports[_0x721c('0xaf')]=function(_0xdfd095,_0x28215f){return db['FaxInteraction']['create'](_0xdfd095[_0x721c('0xb0')],{})[_0x721c('0x24')](respondWithResult(_0x28215f,0xc9))[_0x721c('0xb1')](handleError(_0x28215f,null));};exports['update']=function(_0x4b1165,_0x473e89){if(_0x4b1165['body']['id']){delete _0x4b1165[_0x721c('0xb0')]['id'];}return db[_0x721c('0x93')][_0x721c('0x59')]({'where':{'id':_0x4b1165[_0x721c('0xb2')]['id']}})['then'](handleEntityNotFound(_0x473e89,null))['then'](saveUpdates(_0x4b1165[_0x721c('0xb0')],null))[_0x721c('0x24')](respondWithResult(_0x473e89,null))[_0x721c('0xb1')](handleError(_0x473e89,null));};exports['destroy']=function(_0x2f47e1,_0x3e3ff6){return db[_0x721c('0x93')][_0x721c('0x59')]({'where':{'id':_0x2f47e1['params']['id']}})[_0x721c('0x24')](handleEntityNotFound(_0x3e3ff6,null))[_0x721c('0x24')](removeEntity(_0x3e3ff6,null))[_0x721c('0xb1')](handleError(_0x3e3ff6,null));};exports[_0x721c('0xb3')]=function(_0x55a066,_0x9e21b3){return db['FaxInteraction'][_0x721c('0xb3')]()[_0x721c('0x24')](respondWithResult(_0x9e21b3,null))[_0x721c('0xb1')](handleError(_0x9e21b3,null));};exports[_0x721c('0xb4')]=function(_0x48fb9a,_0x20fbd0,_0xcccc11){return db[_0x721c('0xb5')][_0x721c('0x59')]({'where':{'id':_0x48fb9a['params']['id']}})[_0x721c('0x24')](handleEntityNotFound(_0x20fbd0,null))[_0x721c('0x24')](function(_0x140d15){if(_0x140d15){return _0x140d15[_0x721c('0xb4')](_0x48fb9a[_0x721c('0xb0')][_0x721c('0xb6')],_[_0x721c('0xb7')](_0x48fb9a['body'],[_0x721c('0xb6'),'id'])||{});}})[_0x721c('0x24')](respondWithResult(_0x20fbd0,null))[_0x721c('0xb1')](handleError(_0x20fbd0,null));};exports[_0x721c('0xb8')]=function(_0x1cb198,_0x44fcde,_0x20f2e6){var _0x508924={'raw':![],'where':{}};var _0xb2fe1f={};var _0x2f3564={'count':0x0,'rows':[]};return db[_0x721c('0x93')][_0x721c('0xb9')]({'where':{'id':_0x1cb198[_0x721c('0xb2')]['id']}})[_0x721c('0x24')](handleEntityNotFound(_0x44fcde,null))[_0x721c('0x24')](function(_0x35ac52){if(_0x35ac52){_0xb2fe1f[_0x721c('0x36')]=_[_0x721c('0x38')](db[_0x721c('0xb5')][_0x721c('0xab')]);_0xb2fe1f[_0x721c('0x37')]=_['keys'](_0x1cb198[_0x721c('0x37')]);_0xb2fe1f[_0x721c('0x39')]=_[_0x721c('0x3a')](_0xb2fe1f[_0x721c('0x36')],_0xb2fe1f[_0x721c('0x37')]);_0x508924[_0x721c('0x3c')]=_[_0x721c('0x3a')](_0xb2fe1f['model'],qs[_0x721c('0x3b')](_0x1cb198['query'][_0x721c('0x3b')]));_0x508924[_0x721c('0x3c')]=_0x508924['attributes'][_0x721c('0x3d')]?_0x508924['attributes']:_0xb2fe1f[_0x721c('0x36')];if(!_0x1cb198[_0x721c('0x37')]['hasOwnProperty'](_0x721c('0x3e'))){_0x508924[_0x721c('0x1e')]=qs[_0x721c('0x1e')](_0x1cb198[_0x721c('0x37')][_0x721c('0x1e')]);_0x508924[_0x721c('0x1f')]=qs['offset'](_0x1cb198[_0x721c('0x37')][_0x721c('0x1f')]);}_0x508924[_0x721c('0x3f')]=qs['sort'](_0x1cb198[_0x721c('0x37')][_0x721c('0x40')]);_0x508924[_0x721c('0x41')]=qs[_0x721c('0x39')](_[_0x721c('0x42')](_0x1cb198[_0x721c('0x37')],_0xb2fe1f['filters']));_0x508924[_0x721c('0x41')]['FaxInteractionId']=_0x35ac52['id'];if(_0x1cb198[_0x721c('0x37')]['filter']){_0x508924[_0x721c('0x41')]=_[_0x721c('0x92')](_0x508924[_0x721c('0x41')],{'$or':_['map'](_0x508924['attributes'],function(_0x28ba42){var _0x1cb95a={};_0x1cb95a[_0x28ba42]={'$like':'%'+_0x1cb198[_0x721c('0x37')]['filter']+'%'};return _0x1cb95a;})});}if(_0x1cb198[_0x721c('0x37')][_0x721c('0x75')]){var _0x3e92dc=_0x1cb198[_0x721c('0x37')]['$gte']['split'](',');var _0x411a75={};_0x411a75[_0x3e92dc[0x0]]={'$gte':moment(_0x3e92dc[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x508924[_0x721c('0x41')]=_[_0x721c('0x92')](_0x508924['where'],_0x411a75);}_0x508924=_[_0x721c('0x92')]({},_0x508924,_0x1cb198[_0x721c('0xae')]);return db[_0x721c('0xb5')][_0x721c('0x20')]({'where':_0x508924[_0x721c('0x41')]})[_0x721c('0x24')](function(_0x32d2e0){_0x2f3564[_0x721c('0x20')]=_0x32d2e0;if(_0x1cb198[_0x721c('0x37')]['includeAll']){_0x508924['include']=[{'all':!![]}];}return db[_0x721c('0xb5')][_0x721c('0xba')](_0x508924);})[_0x721c('0x24')](function(_0x517050){_0x2f3564[_0x721c('0xaa')]=_0x517050;return _0x2f3564;});}})[_0x721c('0x24')](respondWithFilteredResult(_0x44fcde,_0x508924))[_0x721c('0xb1')](handleError(_0x44fcde,null));};exports[_0x721c('0xbb')]=function(_0x176224,_0x382407,_0x351f3c){return db[_0x721c('0x93')][_0x721c('0x59')]({'where':{'id':_0x176224['params']['id']}})['then'](handleEntityNotFound(_0x382407,null))[_0x721c('0x24')](function(_0x5ee4d0){if(_0x5ee4d0){return _0x5ee4d0[_0x721c('0xbc')](_0x176224[_0x721c('0xb0')][_0x721c('0xb6')],_[_0x721c('0xb7')](_0x176224[_0x721c('0xb0')],['ids','id'])||{})[_0x721c('0xbd')](function(){return db[_0x721c('0x68')][_0x721c('0xba')]({'attributes':['id',_0x721c('0x29'),_0x721c('0x45')],'where':{'id':_0x176224[_0x721c('0xb0')][_0x721c('0xb6')]}});})[_0x721c('0x24')](function(_0x4aba23){socket[_0x721c('0xbe')](_0x721c('0xbf'),{'id':Number(_0x176224[_0x721c('0xb2')]['id']),'tags':_0x4aba23||[]});return{'id':Number(_0x176224[_0x721c('0xb2')]['id']),'tags':_0x4aba23||[]};});}})[_0x721c('0x24')](respondWithResult(_0x382407,null))[_0x721c('0xb1')](handleError(_0x382407,null));};exports[_0x721c('0xc0')]=function(_0x343d31,_0x38b924,_0xf74ca9){return db['FaxInteraction'][_0x721c('0x59')]({'where':{'id':_0x343d31[_0x721c('0xb2')]['id']}})[_0x721c('0x24')](handleEntityNotFound(_0x38b924,null))[_0x721c('0x24')](function(_0x1ce4c6){if(_0x1ce4c6){return _0x1ce4c6[_0x721c('0xc0')](_0x343d31[_0x721c('0x37')]['ids']);}})[_0x721c('0x24')](respondWithStatusCode(_0x38b924,null))[_0x721c('0xb1')](handleError(_0x38b924,null));};exports[_0x721c('0xc1')]=function(_0x58766c,_0x5521e2){var _0x4aa201=moment()[_0x721c('0xc2')]()[_0x721c('0x8f')]();var _0x5565f0=path['join'](config[_0x721c('0xc3')],'server',_0x721c('0xc4'),_0x721c('0xc5'));var _0x25aa17=path[_0x721c('0xc6')](config[_0x721c('0xc3')],_0x721c('0xc7'),_0x721c('0xc4'),_0x721c('0xc8'));var _0x1fe57c=path[_0x721c('0xc6')](_0x5565f0,_0x4aa201);var _0x3151e8=util[_0x721c('0xc9')](_0x721c('0xca'),_0x58766c[_0x721c('0xb2')]['id'],_0x4aa201);var _0x1c0d49=path['join'](_0x5565f0,_0x3151e8);var _0x9e7f8=[];_0x9e7f8[_0x721c('0x30')]({'model':db['Attachment'],'as':_0x721c('0xcb'),'raw':!![]});var _0x113b15=[{'model':db[_0x721c('0xb5')],'as':_0x721c('0xcc'),'attributes':['id',_0x721c('0xb0'),'createdAt'],'include':_0x9e7f8}];return db[_0x721c('0x93')][_0x721c('0x59')]({'where':{'id':_0x58766c[_0x721c('0xb2')]['id']},'include':_0x113b15})[_0x721c('0x24')](handleEntityNotFound(_0x5521e2,null))[_0x721c('0x24')](function(_0x98410){if(_0x98410&&_0x98410[_0x721c('0xcc')]){var _0x260f7d=_0x98410[_0x721c('0xcd')]({'plain':!![]});fs[_0x721c('0xce')](_0x1fe57c);for(var _0x3926b3=0x0;_0x3926b3<_0x260f7d[_0x721c('0xcc')][_0x721c('0x3d')];_0x3926b3++){var _0x4766f4=_0x260f7d[_0x721c('0xcc')][_0x3926b3]['Attachment'];if(_0x4766f4){var _0x5db736=path[_0x721c('0xc6')](_0x25aa17,_0x4766f4['basename']);if(fs[_0x721c('0xcf')](_0x5db736)){fs[_0x721c('0xd0')](_0x5db736)['pipe'](fs['createWriteStream'](path['join'](_0x1fe57c,_0x4766f4['basename'])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0xe1fff4,_0xbad2e4){zipdir(_0x1fe57c,{'saveTo':_0x1c0d49},function(_0x1e64aa,_0x1fb028){if(_0x1e64aa)return _0xbad2e4(_0x1e64aa);return _0xe1fff4(_0x1fb028);});})[_0x721c('0x24')](function(){return new BPromise(function(_0x192dc7,_0x1ef873){rimraf(_0x1fe57c,function(_0x132866){if(_0x132866)_0x1ef873(_0x132866);return _0x192dc7();});});})[_0x721c('0x24')](function(){return _0x5521e2[_0x721c('0xc1')](_0x1c0d49,_0x3151e8,function(_0x44448a){if(_0x44448a){console[_0x721c('0xd1')](_0x721c('0xd2'),_0x44448a);}else{fs['unlinkSync'](_0x1c0d49);}});});});}else{return _0x5521e2[_0x721c('0xd3')](0xc8);}})[_0x721c('0xb1')](handleError(_0x5521e2,null));}; \ No newline at end of file +var _0xdd21=['Contact.email','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','all','rows','catch','show','include','merge','options','create','body','params','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','format','includeAll','findAll','addTags','setTags','spread','emit','removeTags','download','unix','root','server','files','join','attachments','Attachment','Messages','mkdirSync','basename','existsSync','createReadStream','err','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','Users','fullname','TagIds','Tags','forEach','push','index','FaxInteraction','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','select','field','color','from','tools_tags','u.id','ui.FaxInteractionId','left_join','u.id\x20=\x20ui.UserId','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','fax_accounts','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','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','text','start','Tag','split','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','some','compact','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','toString','sequelize','keyBy','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdd21,0x1e0));var _0x1dd2=function(_0x3ae285,_0x27a64f){_0x3ae285=_0x3ae285-0x0;var _0x38de01=_0xdd21[_0x3ae285];return _0x38de01;};'use strict';var emlformat=require(_0x1dd2('0x0'));var rimraf=require(_0x1dd2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1dd2('0x2'));var rp=require(_0x1dd2('0x3'));var moment=require(_0x1dd2('0x4'));var BPromise=require(_0x1dd2('0x5'));var Mustache=require(_0x1dd2('0x6'));var util=require(_0x1dd2('0x7'));var path=require(_0x1dd2('0x8'));var sox=require(_0x1dd2('0x9'));var csv=require(_0x1dd2('0xa'));var ejs=require(_0x1dd2('0xb'));var fs=require('fs');var fs_extra=require(_0x1dd2('0xc'));var _=require(_0x1dd2('0xd'));var squel=require(_0x1dd2('0xe'));var crypto=require(_0x1dd2('0xf'));var jsforce=require(_0x1dd2('0x10'));var deskjs=require(_0x1dd2('0x11'));var toCsv=require(_0x1dd2('0xa'));var querystring=require(_0x1dd2('0x12'));var Papa=require(_0x1dd2('0x13'));var Redis=require(_0x1dd2('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x1dd2('0x15'));var as=require(_0x1dd2('0x16'));var hardwareService=require(_0x1dd2('0x17'));var logger=require(_0x1dd2('0x18'))(_0x1dd2('0x19'));var utils=require(_0x1dd2('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x1dd2('0x1b')]=_[_0x1dd2('0x1c')](config[_0x1dd2('0x1b')],{'host':_0x1dd2('0x1d'),'port':0x18eb});var socket=require(_0x1dd2('0x1e'))(new Redis(config[_0x1dd2('0x1b')]));require(_0x1dd2('0x1f'))[_0x1dd2('0x20')](socket);function respondWithStatusCode(_0x3cad70,_0x1b9947){_0x1b9947=_0x1b9947||0xcc;return function(_0x5e0d05){if(_0x5e0d05){return _0x3cad70[_0x1dd2('0x21')](_0x1b9947);}return _0x3cad70[_0x1dd2('0x22')](_0x1b9947)[_0x1dd2('0x23')]();};}function respondWithResult(_0x437911,_0x8d5291){_0x8d5291=_0x8d5291||0xc8;return function(_0x100eeb){if(_0x100eeb){return _0x437911[_0x1dd2('0x22')](_0x8d5291)[_0x1dd2('0x24')](_0x100eeb);}};}function respondWithFilteredResult(_0x36732d,_0x16da48){return function(_0x13bd26){if(_0x13bd26){var _0x409e3e=typeof _0x16da48['offset']===_0x1dd2('0x25')&&typeof _0x16da48[_0x1dd2('0x26')]==='undefined';var _0x3fd055=_0x13bd26[_0x1dd2('0x27')];var _0x10b412=_0x409e3e?0x0:_0x16da48[_0x1dd2('0x28')];var _0x7a5193=_0x409e3e?_0x13bd26[_0x1dd2('0x27')]:_0x16da48[_0x1dd2('0x28')]+_0x16da48[_0x1dd2('0x26')];var _0x20ea9a;if(_0x7a5193>=_0x3fd055){_0x7a5193=_0x3fd055;_0x20ea9a=0xc8;}else{_0x20ea9a=0xce;}_0x36732d['status'](_0x20ea9a);return _0x36732d[_0x1dd2('0x29')](_0x1dd2('0x2a'),_0x10b412+'-'+_0x7a5193+'/'+_0x3fd055)[_0x1dd2('0x24')](_0x13bd26);}return null;};}function patchUpdates(_0x19a94c){return function(_0xe240e0){try{jsonpatch[_0x1dd2('0x2b')](_0xe240e0,_0x19a94c,!![]);}catch(_0x4a8e46){return BPromise[_0x1dd2('0x2c')](_0x4a8e46);}return _0xe240e0[_0x1dd2('0x2d')]();};}function saveUpdates(_0x280792,_0x5506c6){return function(_0x126ac9){if(_0x126ac9){return _0x126ac9[_0x1dd2('0x2e')](_0x280792)[_0x1dd2('0x2f')](function(_0x4b4070){return _0x4b4070;});}return null;};}function removeEntity(_0x217540,_0x18d318){return function(_0x7b70f0){if(_0x7b70f0){return _0x7b70f0[_0x1dd2('0x30')]()[_0x1dd2('0x2f')](function(){_0x217540['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x461678,_0x53b7e2){return function(_0xed87c8){if(!_0xed87c8){_0x461678[_0x1dd2('0x21')](0x194);}return _0xed87c8;};}function handleError(_0x1d83de,_0x1b7f0e){_0x1b7f0e=_0x1b7f0e||0x1f4;return function(_0x587005){logger[_0x1dd2('0x31')](_0x587005[_0x1dd2('0x32')]);if(_0x587005[_0x1dd2('0x33')]){delete _0x587005[_0x1dd2('0x33')];}_0x1d83de[_0x1dd2('0x22')](_0x1b7f0e)[_0x1dd2('0x34')](_0x587005);};}function getInteractionUsers(_0x4c0776,_0x5bb1e7){return new BPromise(function(_0x1d1726,_0x2804b3){try{if(_0x5bb1e7[_0x4c0776['id']]){_0x4c0776[_0x1dd2('0x35')]=_['map'](_0x5bb1e7[_0x4c0776['id']],function(_0x26e6fa){return{'id':_0x26e6fa['id'],'fullname':_0x26e6fa[_0x1dd2('0x36')]};});}}catch(_0x29ff97){_0x2804b3(_0x29ff97);}_0x1d1726(_0x4c0776);});}function getInteractionTags(_0x368bff,_0x2d560d){return new BPromise(function(_0x4127c5,_0x34d41e){try{if(_0x368bff[_0x1dd2('0x37')]){_0x368bff[_0x1dd2('0x38')]=[];_0x368bff[_0x1dd2('0x37')]['split'](',')[_0x1dd2('0x39')](function(_0xd5325b){_0x368bff[_0x1dd2('0x38')][_0x1dd2('0x3a')](_0x2d560d[_0xd5325b]);});}delete _0x368bff['TagIds'];}catch(_0x2d4d65){_0x34d41e(_0x2d4d65);}_0x4127c5(_0x368bff);});}function updateFaxInteraction(_0x3fc21b,_0x57490c,_0x38722d){return new BPromise(function(_0x31e795,_0x766d15){return getInteractionUsers(_0x3fc21b,_0x38722d)['then'](function(_0x24eb8c){return getInteractionTags(_0x24eb8c,_0x57490c);})[_0x1dd2('0x2f')](function(_0x627fb4){_0x31e795(_0x627fb4);})['catch'](function(_0x45605b){_0x766d15(_0x45605b);});});}exports[_0x1dd2('0x3b')]=function(_0xd4c94a,_0x39000d){var _0x901377={},_0x3fbe96={},_0x1a0836={'count':0x0,'rows':[]};var _0x48f477=_['map'](db[_0x1dd2('0x3c')][_0x1dd2('0x3d')],function(_0x5092a9){return{'name':_0x5092a9[_0x1dd2('0x3e')],'type':_0x5092a9[_0x1dd2('0x3f')][_0x1dd2('0x40')]};});_0x3fbe96['model']=_[_0x1dd2('0x41')](_0x48f477,_0x1dd2('0x33'));_0x3fbe96[_0x1dd2('0x42')]=_[_0x1dd2('0x43')](_0xd4c94a['query']);_0x3fbe96['filters']=_[_0x1dd2('0x44')](_0x3fbe96[_0x1dd2('0x45')],_0x3fbe96[_0x1dd2('0x42')]);_0x901377[_0x1dd2('0x46')]=_[_0x1dd2('0x44')](_0x3fbe96[_0x1dd2('0x45')],qs[_0x1dd2('0x47')](_0xd4c94a['query'][_0x1dd2('0x47')]));_0x901377[_0x1dd2('0x46')]=_0x901377[_0x1dd2('0x46')][_0x1dd2('0x48')]?_0x901377[_0x1dd2('0x46')]:_0x3fbe96[_0x1dd2('0x45')];if(!_0xd4c94a[_0x1dd2('0x42')][_0x1dd2('0x49')](_0x1dd2('0x4a'))){_0x901377[_0x1dd2('0x26')]=qs['limit'](_0xd4c94a[_0x1dd2('0x42')][_0x1dd2('0x26')]);_0x901377[_0x1dd2('0x28')]=qs[_0x1dd2('0x28')](_0xd4c94a[_0x1dd2('0x42')]['offset']);}_0x901377[_0x1dd2('0x4b')]=qs[_0x1dd2('0x4c')](_0xd4c94a['query'][_0x1dd2('0x4c')]);_0x901377[_0x1dd2('0x4d')]=qs[_0x1dd2('0x4e')](_[_0x1dd2('0x4f')](_0xd4c94a[_0x1dd2('0x42')],_0x3fbe96['filters']),_0x48f477);var _0x4dfd27=[];var _0x1f755d=squel[_0x1dd2('0x50')]()[_0x1dd2('0x51')]('id')[_0x1dd2('0x51')](_0x1dd2('0x33'))[_0x1dd2('0x51')](_0x1dd2('0x52'))[_0x1dd2('0x53')](_0x1dd2('0x54'));var _0x9e4615=squel[_0x1dd2('0x50')]()[_0x1dd2('0x51')](_0x1dd2('0x55'))['field']('u.fullname')[_0x1dd2('0x51')](_0x1dd2('0x56'))[_0x1dd2('0x53')]('user_has_fax_interactions','ui')[_0x1dd2('0x57')]('users','u',_0x1dd2('0x58'));var _0x415365=squel[_0x1dd2('0x50')]()['from'](_0x1dd2('0x59'),'i')[_0x1dd2('0x57')](_0x1dd2('0x5a'),'c',_0x1dd2('0x5b'))[_0x1dd2('0x57')](_0x1dd2('0x5c'),'o',_0x1dd2('0x5d'))[_0x1dd2('0x57')](_0x1dd2('0x5e'),'a','a.id\x20=\x20i.FaxAccountId')[_0x1dd2('0x57')]('fax_messages','me','me.FaxInteractionId\x20=\x20i.id')[_0x1dd2('0x57')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')[_0x1dd2('0x57')](_0x1dd2('0x54'),'t',_0x1dd2('0x5f'));var _0x26843c=squel[_0x1dd2('0x60')]();var _0x2ca43b=[];var _0x29db24=squel[_0x1dd2('0x60')]();var _0xd5cb47;if(_0xd4c94a['query'][_0x1dd2('0x61')]){_0xd5cb47=as[_0x1dd2('0x62')](_0xd4c94a[_0x1dd2('0x42')][_0x1dd2('0x61')]);var _0x5a0096=_0xd5cb47[_0x1dd2('0x63')];for(var _0x4f4a70=0x0;_0x4f4a70<_0xd5cb47[_0x1dd2('0x64')][_0x1dd2('0x48')];_0x4f4a70++){var _0x147542=_0xd5cb47[_0x1dd2('0x64')][_0x4f4a70];var _0x327d4f='i';var _0x236697=_[_0x1dd2('0x65')](_0x48f477,['name',_0x147542['field']]);if(!_0x236697){switch(_0x147542[_0x1dd2('0x51')]){case _0x1dd2('0x66'):if(_0x147542['value']==0x1){_0x415365[_0x1dd2('0x67')]('`'+_0x147542[_0x1dd2('0x51')]+_0x1dd2('0x68'));}else{_0x415365['having']('`'+_0x147542[_0x1dd2('0x51')]+_0x1dd2('0x69'));}break;case _0x1dd2('0x6a'):if(_0x147542['operator']===_0x1dd2('0x6b')){if(_0x147542[_0x1dd2('0x6c')]['split']('\x20')[_0x1dd2('0x48')]>0x1){_0x26843c[_0x5a0096]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1dd2('0x6d')](_0x147542['value']),null);}else{var _0x4c2527='%'+_0x147542['value']+'%';_0x26843c[_0x5a0096](_0x1dd2('0x6e'),_0x4c2527,_0x4c2527,_0x4c2527);}}else{_0x236697=_[_0x1dd2('0x65')](_0x48f477,[_0x1dd2('0x33'),_0x1dd2('0x6f')]);_0x147542[_0x1dd2('0x51')]=_0x1dd2('0x6f');_0x5f3141=as[_0x1dd2('0x70')](_0x327d4f,_0x236697[_0x1dd2('0x3f')],_0x147542);_0x26843c[_0x5a0096](_0x5f3141[_0x1dd2('0x71')],_0x5f3141[_0x1dd2('0x6c')][_0x1dd2('0x72')],_0x5f3141[_0x1dd2('0x6c')][_0x1dd2('0x23')]);}break;case _0x1dd2('0x73'):var _0x2f2106=_0x147542[_0x1dd2('0x6c')][_0x1dd2('0x74')](',')[_0x1dd2('0x41')](function(_0x7356ee){return Number(_0x7356ee);});_0x2f2106[_0x1dd2('0x39')](function(_0x2fb851){_0x29db24['or'](_0x1dd2('0x75'),'%,'+_0x2fb851+',%');});_0x2ca43b=_[_0x1dd2('0x76')](_0x2ca43b,_0x2f2106);break;case _0x1dd2('0x77'):if(_0x147542[_0x1dd2('0x78')]===_0x1dd2('0x6b')){_0x26843c[_0x5a0096](_0x1dd2('0x79'),'%'+_0x147542[_0x1dd2('0x6c')]+'%',null);}else{_0x236697=_[_0x1dd2('0x65')](_0x48f477,[_0x1dd2('0x33'),_0x1dd2('0x7a')]);_0x147542['field']='UserId';_0x5f3141=as[_0x1dd2('0x70')](_0x327d4f,_0x236697['type'],_0x147542);_0x26843c[_0x5a0096](_0x5f3141[_0x1dd2('0x71')],_0x5f3141['value'][_0x1dd2('0x72')],_0x5f3141[_0x1dd2('0x6c')][_0x1dd2('0x23')]);}break;case'body':_0x5f3141=as[_0x1dd2('0x70')]('me',null,_0x147542);_0x26843c[_0x5a0096](_0x5f3141[_0x1dd2('0x71')],_0x5f3141[_0x1dd2('0x6c')][_0x1dd2('0x72')],_0x5f3141['value'][_0x1dd2('0x23')]);break;}}else{var _0x5f3141=as['buildExpression'](_0x327d4f,_0x236697[_0x1dd2('0x3f')],_0x147542);_0x26843c[_0x5a0096](_0x5f3141[_0x1dd2('0x71')],_0x5f3141[_0x1dd2('0x6c')][_0x1dd2('0x72')],_0x5f3141['value'][_0x1dd2('0x23')]);}}}else{var _0x23ef5d=_(_0xd4c94a[_0x1dd2('0x42')])[_0x1dd2('0x43')]()[_0x1dd2('0x41')](function(_0x44692c){return _[_0x1dd2('0x7b')](_0x48f477,['name',_0x44692c])?_0x44692c:undefined;})[_0x1dd2('0x7c')]()[_0x1dd2('0x6c')]();if(!_[_0x1dd2('0x7d')](_0x23ef5d)){_0x23ef5d[_0x1dd2('0x39')](function(_0x4d3757){if(_0x4d3757===_0x1dd2('0x7e')){_0x415365[_0x1dd2('0x4d')](_0x1dd2('0x7f'),[][_0x1dd2('0x80')](_0xd4c94a[_0x1dd2('0x42')][_0x4d3757]));}else if(_0x4d3757===_0x1dd2('0x81')){var _0x31c82a=JSON[_0x1dd2('0x82')](_0xd4c94a['query'][_0x4d3757])[_0x1dd2('0x83')];var _0x5af09a=JSON[_0x1dd2('0x82')](_0xd4c94a[_0x1dd2('0x42')][_0x4d3757])[_0x1dd2('0x84')];_0x415365[_0x1dd2('0x4d')](_0x1dd2('0x85'),_0x31c82a,_0x5af09a);}else{if(_0xd4c94a['query'][_0x4d3757]===_0x1dd2('0x86')){_0x415365[_0x1dd2('0x4d')]('i.'+_0x4d3757+'\x20IS\x20NULL');}else{_0x415365[_0x1dd2('0x4d')]('i.'+_0x4d3757+'\x20=\x20?',_0xd4c94a[_0x1dd2('0x42')][_0x4d3757]);}}});}if(_0xd4c94a['query'][_0x1dd2('0x87')]){if(_0xd4c94a[_0x1dd2('0x42')][_0x1dd2('0x87')]==0x1){_0x415365[_0x1dd2('0x67')]('`unreadMessages`\x20=\x200');}else{_0x415365[_0x1dd2('0x67')](_0x1dd2('0x88'));}}if(_0xd4c94a['query'][_0x1dd2('0x89')]){_0x2ca43b=_['isArray'](_0xd4c94a[_0x1dd2('0x42')][_0x1dd2('0x89')])?_0xd4c94a['query'][_0x1dd2('0x89')]:new Array(_0xd4c94a[_0x1dd2('0x42')][_0x1dd2('0x89')]);_0x2ca43b[_0x1dd2('0x39')](function(_0x50db30){_0x29db24['or'](_0x1dd2('0x75'),'%,'+_0x50db30+',%');});}if(_0xd4c94a[_0x1dd2('0x42')][_0x1dd2('0x8a')]){var _0x40d883=_0xd4c94a[_0x1dd2('0x42')]['filter'][_0x1dd2('0x8b')]('\x5c','\x5c\x5c')[_0x1dd2('0x8b')](/'/g,'\x27\x27');if(qs[_0x1dd2('0x8c')](_0x40d883)){_0x26843c['or'](_0x1dd2('0x8d'),_0x40d883+'%')['or'](_0x1dd2('0x8e'),_0x40d883+'%');}_0x26843c['or'](_0x1dd2('0x8f'),_0x40d883+'%');}}_0x415365[_0x1dd2('0x4d')](_0x26843c);_0x415365[_0x1dd2('0x90')](_0x1dd2('0x91'));var _0x119703={'type':db[_0x1dd2('0x92')]['QueryTypes']['SELECT'],'raw':!![]};var _0x374e56=_0x415365['clone']();_0x374e56[_0x1dd2('0x51')](_0x1dd2('0x91'));_0x374e56[_0x1dd2('0x51')](_0x1dd2('0x93'),'unreadMessages');if(_0x901377[_0x1dd2('0x4b')]){_0x901377['order'][_0x1dd2('0x39')](function(_0x422cdc){var _0x41f55f=_0x422cdc[0x0]===_0x1dd2('0x94')?_0x422cdc[0x0]:'i.'+_0x422cdc[0x0];_0x415365['order'](_0x41f55f,_0x422cdc[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x2ca43b)){_0x415365[_0x1dd2('0x67')](_0x29db24);_0x374e56['where'](_0x1dd2('0x95'),_0x2ca43b);}BPromise[_0x1dd2('0x96')]()[_0x1dd2('0x2f')](function(){if(!_0xd5cb47){if(_0xd4c94a['query'][_0x1dd2('0x7e')])return;_0x374e56[_0x1dd2('0x4d')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x415365[_0x1dd2('0x4d')](_0x1dd2('0x97'));return;}if(_0xd4c94a[_0x1dd2('0x98')][_0x1dd2('0x99')]!==_0x1dd2('0x9a'))return;return _0xd4c94a[_0x1dd2('0x98')][_0x1dd2('0x9b')]({'attributes':['id'],'raw':!![]})[_0x1dd2('0x2f')](function(_0x3e6bdf){if(_[_0x1dd2('0x7d')](_0x3e6bdf)){_0x374e56[_0x1dd2('0x4d')](_0x1dd2('0x9c'));_0x415365[_0x1dd2('0x4d')](_0x1dd2('0x9c'));}else{_0x374e56[_0x1dd2('0x4d')]('i.FaxAccountId\x20IN\x20?',_['map'](_0x3e6bdf,'id'));_0x415365[_0x1dd2('0x4d')](_0x1dd2('0x7f'),_[_0x1dd2('0x41')](_0x3e6bdf,'id'));}});})[_0x1dd2('0x2f')](function(){if(_0xd4c94a[_0x1dd2('0x98')]['role']===_0x1dd2('0x9a')&&!_0xd5cb47&&!_0xd4c94a['query'][_0x1dd2('0x7e')])return[];return db['sequelize'][_0x1dd2('0x42')](_0x374e56[_0x1dd2('0x9d')](),_0x119703);})['then'](function(_0x2f120c){_0x1a0836[_0x1dd2('0x27')]=_0x2f120c['length'];if(_0x1a0836[_0x1dd2('0x27')]===0x0)return[];return db[_0x1dd2('0x9e')][_0x1dd2('0x42')](_0x1f755d[_0x1dd2('0x9d')](),_0x119703)[_0x1dd2('0x2f')](function(_0xd862bd){_0x4dfd27=_[_0x1dd2('0x9f')](_0xd862bd,'id');_0x119703=_['merge'](_0x119703,{'model':db[_0x1dd2('0x3c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xd4c94a[_0x1dd2('0x42')][_0x1dd2('0x47')]){_0x901377[_0x1dd2('0x46')][_0x1dd2('0x39')](function(_0xe4a04c){_0x415365[_0x1dd2('0x51')]('i.'+_0xe4a04c);});}else{_0x415365['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x415365[_0x1dd2('0x51')]('a.key',_0x1dd2('0xa0'));_0x415365[_0x1dd2('0x51')]('a.mandatoryDisposition',_0x1dd2('0xa1'));_0x415365[_0x1dd2('0x51')]('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');_0x415365[_0x1dd2('0x51')](_0x1dd2('0xa2'));_0x415365[_0x1dd2('0x51')]('c.firstName',_0x1dd2('0xa3'));_0x415365[_0x1dd2('0x51')](_0x1dd2('0xa4'),'Contact.lastName');_0x415365[_0x1dd2('0x51')]('c.email',_0x1dd2('0xa5'));_0x415365[_0x1dd2('0x51')]('c.phone','Contact.phone');_0x415365[_0x1dd2('0x51')]('c.mobile',_0x1dd2('0xa6'));_0x415365[_0x1dd2('0x51')](_0x1dd2('0xa7'),'Contact.fax');_0x415365[_0x1dd2('0x51')](_0x1dd2('0xa8'),_0x1dd2('0xa9'));_0x415365[_0x1dd2('0x51')](_0x1dd2('0xaa'),_0x1dd2('0xab'));_0x415365[_0x1dd2('0x51')](_0x1dd2('0xac'),'TagIds');}if(_0x901377['limit'])_0x415365[_0x1dd2('0x26')](_0x901377['limit']);if(_0x901377[_0x1dd2('0x28')])_0x415365['offset'](_0x901377[_0x1dd2('0x28')]);return db[_0x1dd2('0x9e')][_0x1dd2('0x42')](_0x415365[_0x1dd2('0x9d')](),_0x119703);})[_0x1dd2('0x2f')](function(_0x5bed51){if(_0x5bed51[_0x1dd2('0x48')]>0x0)_0x9e4615[_0x1dd2('0x4d')]('ui.FaxInteractionId\x20IN\x20?',_[_0x1dd2('0x41')](_0x5bed51,'id'));return db[_0x1dd2('0x9e')][_0x1dd2('0x42')](_0x9e4615[_0x1dd2('0x9d')](),_0x119703)['then'](function(_0x18f736){var _0x38b67d=_[_0x1dd2('0xad')](_0x18f736,_0x1dd2('0xae'));var _0x27658b=[];_0x5bed51['forEach'](function(_0x499a02){_0x27658b[_0x1dd2('0x3a')](updateFaxInteraction(_0x499a02,_0x4dfd27,_0x38b67d));});return BPromise[_0x1dd2('0xaf')](_0x27658b);});});})[_0x1dd2('0x2f')](function(_0x409056){_0x1a0836[_0x1dd2('0xb0')]=_0x409056;return _0x1a0836;})[_0x1dd2('0x2f')](respondWithFilteredResult(_0x39000d,_0x901377))[_0x1dd2('0xb1')](handleError(_0x39000d,null));};exports[_0x1dd2('0xb2')]=function(_0x36a5e9,_0x1a20ae){var _0x51a5da={'raw':![],'where':{'id':_0x36a5e9['params']['id']}},_0x327358={};_0x327358[_0x1dd2('0x45')]=_[_0x1dd2('0x43')](db[_0x1dd2('0x3c')][_0x1dd2('0x3d')]);_0x327358[_0x1dd2('0x42')]=_['keys'](_0x36a5e9[_0x1dd2('0x42')]);_0x327358[_0x1dd2('0x4e')]=_[_0x1dd2('0x44')](_0x327358[_0x1dd2('0x45')],_0x327358[_0x1dd2('0x42')]);_0x51a5da['attributes']=_[_0x1dd2('0x44')](_0x327358[_0x1dd2('0x45')],qs['fields'](_0x36a5e9['query'][_0x1dd2('0x47')]));_0x51a5da['attributes']=_0x51a5da['attributes'][_0x1dd2('0x48')]?_0x51a5da[_0x1dd2('0x46')]:_0x327358['model'];if(_0x36a5e9[_0x1dd2('0x42')]['includeAll']){_0x51a5da[_0x1dd2('0xb3')]=[{'all':!![]}];}_0x51a5da=_[_0x1dd2('0xb4')]({},_0x51a5da,_0x36a5e9[_0x1dd2('0xb5')]);return db[_0x1dd2('0x3c')]['find'](_0x51a5da)['then'](handleEntityNotFound(_0x1a20ae,null))[_0x1dd2('0x2f')](respondWithResult(_0x1a20ae,null))[_0x1dd2('0xb1')](handleError(_0x1a20ae,null));};exports[_0x1dd2('0xb6')]=function(_0x23005a,_0x39aaf2){return db['FaxInteraction'][_0x1dd2('0xb6')](_0x23005a[_0x1dd2('0xb7')],{})['then'](respondWithResult(_0x39aaf2,0xc9))[_0x1dd2('0xb1')](handleError(_0x39aaf2,null));};exports[_0x1dd2('0x2e')]=function(_0x34a40a,_0x3bc007){if(_0x34a40a[_0x1dd2('0xb7')]['id']){delete _0x34a40a['body']['id'];}return db['FaxInteraction'][_0x1dd2('0x65')]({'where':{'id':_0x34a40a[_0x1dd2('0xb8')]['id']}})[_0x1dd2('0x2f')](handleEntityNotFound(_0x3bc007,null))[_0x1dd2('0x2f')](saveUpdates(_0x34a40a[_0x1dd2('0xb7')],null))[_0x1dd2('0x2f')](respondWithResult(_0x3bc007,null))[_0x1dd2('0xb1')](handleError(_0x3bc007,null));};exports['destroy']=function(_0x2f8da2,_0x29c284){return db[_0x1dd2('0x3c')][_0x1dd2('0x65')]({'where':{'id':_0x2f8da2['params']['id']}})[_0x1dd2('0x2f')](handleEntityNotFound(_0x29c284,null))[_0x1dd2('0x2f')](removeEntity(_0x29c284,null))['catch'](handleError(_0x29c284,null));};exports[_0x1dd2('0xb9')]=function(_0x4a0371,_0xbcb8c3){return db[_0x1dd2('0x3c')][_0x1dd2('0xb9')]()[_0x1dd2('0x2f')](respondWithResult(_0xbcb8c3,null))[_0x1dd2('0xb1')](handleError(_0xbcb8c3,null));};exports[_0x1dd2('0xba')]=function(_0x43fa8c,_0x323edc,_0x5f532c){return db[_0x1dd2('0xbb')][_0x1dd2('0x65')]({'where':{'id':_0x43fa8c[_0x1dd2('0xb8')]['id']}})[_0x1dd2('0x2f')](handleEntityNotFound(_0x323edc,null))[_0x1dd2('0x2f')](function(_0x36c7fd){if(_0x36c7fd){return _0x36c7fd[_0x1dd2('0xba')](_0x43fa8c[_0x1dd2('0xb7')][_0x1dd2('0xbc')],_[_0x1dd2('0xbd')](_0x43fa8c['body'],[_0x1dd2('0xbc'),'id'])||{});}})[_0x1dd2('0x2f')](respondWithResult(_0x323edc,null))[_0x1dd2('0xb1')](handleError(_0x323edc,null));};exports[_0x1dd2('0xbe')]=function(_0xfa667f,_0x8151ff,_0x17c479){var _0x3ec64d={'raw':![],'where':{}};var _0x570d30={};var _0x41eeb6={'count':0x0,'rows':[]};return db[_0x1dd2('0x3c')][_0x1dd2('0xbf')]({'where':{'id':_0xfa667f[_0x1dd2('0xb8')]['id']}})['then'](handleEntityNotFound(_0x8151ff,null))[_0x1dd2('0x2f')](function(_0x4fbeb4){if(_0x4fbeb4){_0x570d30[_0x1dd2('0x45')]=_[_0x1dd2('0x43')](db[_0x1dd2('0xbb')][_0x1dd2('0x3d')]);_0x570d30['query']=_[_0x1dd2('0x43')](_0xfa667f[_0x1dd2('0x42')]);_0x570d30[_0x1dd2('0x4e')]=_[_0x1dd2('0x44')](_0x570d30[_0x1dd2('0x45')],_0x570d30[_0x1dd2('0x42')]);_0x3ec64d['attributes']=_[_0x1dd2('0x44')](_0x570d30[_0x1dd2('0x45')],qs[_0x1dd2('0x47')](_0xfa667f[_0x1dd2('0x42')][_0x1dd2('0x47')]));_0x3ec64d[_0x1dd2('0x46')]=_0x3ec64d[_0x1dd2('0x46')][_0x1dd2('0x48')]?_0x3ec64d[_0x1dd2('0x46')]:_0x570d30[_0x1dd2('0x45')];if(!_0xfa667f[_0x1dd2('0x42')]['hasOwnProperty'](_0x1dd2('0x4a'))){_0x3ec64d[_0x1dd2('0x26')]=qs[_0x1dd2('0x26')](_0xfa667f[_0x1dd2('0x42')]['limit']);_0x3ec64d['offset']=qs[_0x1dd2('0x28')](_0xfa667f[_0x1dd2('0x42')]['offset']);}_0x3ec64d[_0x1dd2('0x4b')]=qs['sort'](_0xfa667f[_0x1dd2('0x42')]['sort']);_0x3ec64d[_0x1dd2('0x4d')]=qs[_0x1dd2('0x4e')](_[_0x1dd2('0x4f')](_0xfa667f[_0x1dd2('0x42')],_0x570d30[_0x1dd2('0x4e')]));_0x3ec64d[_0x1dd2('0x4d')][_0x1dd2('0xae')]=_0x4fbeb4['id'];if(_0xfa667f['query'][_0x1dd2('0x8a')]){_0x3ec64d[_0x1dd2('0x4d')]=_[_0x1dd2('0xb4')](_0x3ec64d['where'],{'$or':_['map'](_0x3ec64d[_0x1dd2('0x46')],function(_0x312cae){var _0x518b42={};_0x518b42[_0x312cae]={'$like':'%'+_0xfa667f[_0x1dd2('0x42')][_0x1dd2('0x8a')]+'%'};return _0x518b42;})});}if(_0xfa667f[_0x1dd2('0x42')][_0x1dd2('0x83')]){var _0x4258ab=_0xfa667f[_0x1dd2('0x42')]['$gte'][_0x1dd2('0x74')](',');var _0x2eed9d={};_0x2eed9d[_0x4258ab[0x0]]={'$gte':moment(_0x4258ab[0x1])[_0x1dd2('0xc0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x3ec64d[_0x1dd2('0x4d')]=_[_0x1dd2('0xb4')](_0x3ec64d['where'],_0x2eed9d);}_0x3ec64d=_[_0x1dd2('0xb4')]({},_0x3ec64d,_0xfa667f['options']);return db[_0x1dd2('0xbb')][_0x1dd2('0x27')]({'where':_0x3ec64d[_0x1dd2('0x4d')]})[_0x1dd2('0x2f')](function(_0x17ec2f){_0x41eeb6[_0x1dd2('0x27')]=_0x17ec2f;if(_0xfa667f[_0x1dd2('0x42')][_0x1dd2('0xc1')]){_0x3ec64d[_0x1dd2('0xb3')]=[{'all':!![]}];}return db[_0x1dd2('0xbb')][_0x1dd2('0xc2')](_0x3ec64d);})['then'](function(_0x27d03d){_0x41eeb6[_0x1dd2('0xb0')]=_0x27d03d;return _0x41eeb6;});}})[_0x1dd2('0x2f')](respondWithFilteredResult(_0x8151ff,_0x3ec64d))['catch'](handleError(_0x8151ff,null));};exports[_0x1dd2('0xc3')]=function(_0x22d6d5,_0x1747fd,_0x169552){return db[_0x1dd2('0x3c')][_0x1dd2('0x65')]({'where':{'id':_0x22d6d5['params']['id']}})[_0x1dd2('0x2f')](handleEntityNotFound(_0x1747fd,null))[_0x1dd2('0x2f')](function(_0x135d0d){if(_0x135d0d){return _0x135d0d[_0x1dd2('0xc4')](_0x22d6d5[_0x1dd2('0xb7')][_0x1dd2('0xbc')],_[_0x1dd2('0xbd')](_0x22d6d5['body'],[_0x1dd2('0xbc'),'id'])||{})[_0x1dd2('0xc5')](function(){return db[_0x1dd2('0x73')][_0x1dd2('0xc2')]({'attributes':['id',_0x1dd2('0x33'),_0x1dd2('0x52')],'where':{'id':_0x22d6d5[_0x1dd2('0xb7')][_0x1dd2('0xbc')]}});})[_0x1dd2('0x2f')](function(_0x202f98){socket[_0x1dd2('0xc6')]('faxInteractionTags:save',{'id':Number(_0x22d6d5[_0x1dd2('0xb8')]['id']),'tags':_0x202f98||[]});return{'id':Number(_0x22d6d5[_0x1dd2('0xb8')]['id']),'tags':_0x202f98||[]};});}})[_0x1dd2('0x2f')](respondWithResult(_0x1747fd,null))[_0x1dd2('0xb1')](handleError(_0x1747fd,null));};exports[_0x1dd2('0xc7')]=function(_0x1e1cdc,_0x3abe00,_0x115c3e){return db['FaxInteraction']['find']({'where':{'id':_0x1e1cdc[_0x1dd2('0xb8')]['id']}})[_0x1dd2('0x2f')](handleEntityNotFound(_0x3abe00,null))[_0x1dd2('0x2f')](function(_0x4cf3df){if(_0x4cf3df){return _0x4cf3df[_0x1dd2('0xc7')](_0x1e1cdc['query']['ids']);}})[_0x1dd2('0x2f')](respondWithStatusCode(_0x3abe00,null))[_0x1dd2('0xb1')](handleError(_0x3abe00,null));};exports[_0x1dd2('0xc8')]=function(_0xb840d9,_0x258ba3){var _0x56dfa1=moment()[_0x1dd2('0xc9')]()['toString']();var _0x5923bc=path['join'](config[_0x1dd2('0xca')],_0x1dd2('0xcb'),_0x1dd2('0xcc'),'tmp');var _0x3a3bc8=path[_0x1dd2('0xcd')](config[_0x1dd2('0xca')],_0x1dd2('0xcb'),_0x1dd2('0xcc'),_0x1dd2('0xce'));var _0x3824b8=path[_0x1dd2('0xcd')](_0x5923bc,_0x56dfa1);var _0x21f232=util[_0x1dd2('0xc0')]('transcript-%d-%s.zip',_0xb840d9[_0x1dd2('0xb8')]['id'],_0x56dfa1);var _0x100d25=path[_0x1dd2('0xcd')](_0x5923bc,_0x21f232);var _0x57011a=[];_0x57011a[_0x1dd2('0x3a')]({'model':db[_0x1dd2('0xcf')],'as':'Attachment','raw':!![]});var _0x54203b=[{'model':db[_0x1dd2('0xbb')],'as':_0x1dd2('0xd0'),'attributes':['id',_0x1dd2('0xb7'),_0x1dd2('0x81')],'include':_0x57011a}];return db[_0x1dd2('0x3c')][_0x1dd2('0x65')]({'where':{'id':_0xb840d9[_0x1dd2('0xb8')]['id']},'include':_0x54203b})[_0x1dd2('0x2f')](handleEntityNotFound(_0x258ba3,null))[_0x1dd2('0x2f')](function(_0x5b42e9){if(_0x5b42e9&&_0x5b42e9[_0x1dd2('0xd0')]){var _0x129858=_0x5b42e9['get']({'plain':!![]});fs[_0x1dd2('0xd1')](_0x3824b8);for(var _0x139d3b=0x0;_0x139d3b<_0x129858[_0x1dd2('0xd0')][_0x1dd2('0x48')];_0x139d3b++){var _0x5c74c5=_0x129858['Messages'][_0x139d3b][_0x1dd2('0xcf')];if(_0x5c74c5){var _0x4af23e=path['join'](_0x3a3bc8,_0x5c74c5[_0x1dd2('0xd2')]);if(fs[_0x1dd2('0xd3')](_0x4af23e)){fs[_0x1dd2('0xd4')](_0x4af23e)['pipe'](fs['createWriteStream'](path['join'](_0x3824b8,_0x5c74c5['basename'])));}}}return BPromise[_0x1dd2('0x96')]()['then'](function(){return new BPromise(function(_0x503cf9,_0x1666da){zipdir(_0x3824b8,{'saveTo':_0x100d25},function(_0x52409f,_0x19ec3f){if(_0x52409f)return _0x1666da(_0x52409f);return _0x503cf9(_0x19ec3f);});})[_0x1dd2('0x2f')](function(){return new BPromise(function(_0x340ece,_0x45f720){rimraf(_0x3824b8,function(_0x33b633){if(_0x33b633)_0x45f720(_0x33b633);return _0x340ece();});});})[_0x1dd2('0x2f')](function(){return _0x258ba3[_0x1dd2('0xc8')](_0x100d25,_0x21f232,function(_0x50e890){if(_0x50e890){console['log'](_0x1dd2('0xd5'),_0x50e890);}else{fs[_0x1dd2('0xd6')](_0x100d25);}});});});}else{return _0x258ba3[_0x1dd2('0x21')](0xc8);}})[_0x1dd2('0xb1')](handleError(_0x258ba3,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 8ada7df..d64562b 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 _0xc5d6=['exports','../../mysqldb','FaxInteraction','FaxMessage','save','remove','then','Users','unreadMessages','emit','catch','hasOwnProperty'];(function(_0x34a89b,_0x1f19c0){var _0x57078b=function(_0x423d6b){while(--_0x423d6b){_0x34a89b['push'](_0x34a89b['shift']());}};_0x57078b(++_0x1f19c0);}(_0xc5d6,0x85));var _0x6c5d=function(_0x5f0099,_0x2b8c05){_0x5f0099=_0x5f0099-0x0;var _0x101c76=_0xc5d6[_0x5f0099];return _0x101c76;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x6c5d('0x0'))['db'][_0x6c5d('0x1')];var FaxMessage=require(_0x6c5d('0x0'))['db'][_0x6c5d('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6c5d('0x3'),'afterUpdate':'update','afterDestroy':_0x6c5d('0x4')};function emitEvent(_0x52178d){return function(_0x54b9ee,_0x5700b9,_0x230a1c){_0x54b9ee['getUsers']({'attributes':['id'],'raw':!![]})[_0x6c5d('0x5')](function(_0x312772){_0x54b9ee['setDataValue'](_0x6c5d('0x6'),_0x312772['map'](function(_0x52cc4e){return{'id':_0x52cc4e['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x54b9ee['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6c5d('0x5')](function(_0x309fe9){_0x54b9ee['setDataValue'](_0x6c5d('0x7'),_0x309fe9['length']);FaxInteractionEvents[_0x6c5d('0x8')](_0x52178d+':'+_0x54b9ee['id'],_0x54b9ee);FaxInteractionEvents[_0x6c5d('0x8')](_0x52178d,_0x54b9ee);_0x230a1c(null);})[_0x6c5d('0x9')](_0x230a1c(null));};}for(var e in events){if(events[_0x6c5d('0xa')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x6c5d('0xb')]=FaxInteractionEvents; \ No newline at end of file +var _0x0feb=['emit','catch','hook','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','Users','findAll','setDataValue','unreadMessages','length'];(function(_0x59218d,_0x2100e8){var _0x5ea84c=function(_0x8d3da7){while(--_0x8d3da7){_0x59218d['push'](_0x59218d['shift']());}};_0x5ea84c(++_0x2100e8);}(_0x0feb,0x1c3));var _0xb0fe=function(_0x181c63,_0x2099ec){_0x181c63=_0x181c63-0x0;var _0x288f87=_0x0feb[_0x181c63];return _0x288f87;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0xb0fe('0x0'))['db'][_0xb0fe('0x1')];var FaxMessage=require(_0xb0fe('0x0'))['db'][_0xb0fe('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xb0fe('0x3')](0x0);var events={'afterCreate':_0xb0fe('0x4'),'afterUpdate':_0xb0fe('0x5'),'afterDestroy':'remove'};function emitEvent(_0x39eef7){return function(_0x2fde3e,_0x795211,_0x15cc63){_0x2fde3e['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x3d17e7){_0x2fde3e['setDataValue'](_0xb0fe('0x6'),_0x3d17e7['map'](function(_0x2c867d){return{'id':_0x2c867d['id']};}));return FaxMessage[_0xb0fe('0x7')]({'where':{'FaxInteractionId':_0x2fde3e['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x167c3f){_0x2fde3e[_0xb0fe('0x8')](_0xb0fe('0x9'),_0x167c3f[_0xb0fe('0xa')]);FaxInteractionEvents[_0xb0fe('0xb')](_0x39eef7+':'+_0x2fde3e['id'],_0x2fde3e);FaxInteractionEvents['emit'](_0x39eef7,_0x2fde3e);_0x15cc63(null);})[_0xb0fe('0xc')](_0x15cc63(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xb0fe('0xd')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index c1c23cb..a9d48a7 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 _0x5cb4=['FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0x2bfafd,_0x242781){var _0x2e7059=function(_0x5afd19){while(--_0x5afd19){_0x2bfafd['push'](_0x2bfafd['shift']());}};_0x2e7059(++_0x242781);}(_0x5cb4,0xc6));var _0x45cb=function(_0x18f57a,_0x2a23ec){_0x18f57a=_0x18f57a-0x0;var _0x529482=_0x5cb4[_0x18f57a];return _0x529482;};'use strict';var _=require(_0x45cb('0x0'));var util=require('util');var logger=require(_0x45cb('0x1'))('api');var moment=require('moment');var BPromise=require(_0x45cb('0x2'));var rp=require(_0x45cb('0x3'));var fs=require('fs');var path=require(_0x45cb('0x4'));var rimraf=require(_0x45cb('0x5'));var config=require(_0x45cb('0x6'));var attributes=require(_0x45cb('0x7'));module[_0x45cb('0x8')]=function(_0x468f63,_0x2bdbd7){return _0x468f63[_0x45cb('0x9')](_0x45cb('0xa'),attributes,{'tableName':_0x45cb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5da4b4,_0x3d8551,_0x46203f){if(_0x5da4b4[_0x45cb('0xc')](_0x45cb('0xd'))){_0x5da4b4[_0x45cb('0xe')]=moment()['format'](_0x45cb('0xf'));}_0x46203f(null,_0x5da4b4);}}});}; \ No newline at end of file +var _0x2faf=['bluebird','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','FaxInteraction','fax_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment'];(function(_0x442f2d,_0xd630db){var _0x355ef2=function(_0x44daf8){while(--_0x44daf8){_0x442f2d['push'](_0x442f2d['shift']());}};_0x355ef2(++_0xd630db);}(_0x2faf,0xb0));var _0xf2fa=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x2faf[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf2fa('0x0'));var util=require(_0xf2fa('0x1'));var logger=require(_0xf2fa('0x2'))('api');var moment=require(_0xf2fa('0x3'));var BPromise=require(_0xf2fa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf2fa('0x5'));var rimraf=require(_0xf2fa('0x6'));var config=require(_0xf2fa('0x7'));var attributes=require(_0xf2fa('0x8'));module[_0xf2fa('0x9')]=function(_0x33c832,_0x44d406){return _0x33c832['define'](_0xf2fa('0xa'),attributes,{'tableName':_0xf2fa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x28ca24,_0x19ce5a,_0x5dc47b){if(_0x28ca24[_0xf2fa('0xc')]('closed')){_0x28ca24[_0xf2fa('0xd')]=moment()['format'](_0xf2fa('0xe'));}_0x5dc47b(null,_0x28ca24);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index ab25df8..b9d9ddf 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 _0x8b4c=['update','body','options','attributes','debug','find','where','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','info','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateFaxInteraction','FaxInteraction'];(function(_0x2806a7,_0x413cd3){var _0x232415=function(_0xd57617){while(--_0xd57617){_0x2806a7['push'](_0x2806a7['shift']());}};_0x232415(++_0x413cd3);}(_0x8b4c,0x187));var _0xc8b4=function(_0x339806,_0xd51dc3){_0x339806=_0x339806-0x0;var _0x5edb3f=_0x8b4c[_0x339806];return _0x5edb3f;};'use strict';var _=require(_0xc8b4('0x0'));var util=require(_0xc8b4('0x1'));var moment=require(_0xc8b4('0x2'));var BPromise=require('bluebird');var rs=require(_0xc8b4('0x3'));var fs=require('fs');var Redis=require(_0xc8b4('0x4'));var db=require(_0xc8b4('0x5'))['db'];var utils=require(_0xc8b4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xc8b4('0x7'));var jayson=require(_0xc8b4('0x8'));var client=jayson[_0xc8b4('0x9')][_0xc8b4('0xa')]({'port':0x232a});config[_0xc8b4('0xb')]=_[_0xc8b4('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc8b4('0xd'))(new Redis(config[_0xc8b4('0xb')]));require('./faxInteraction.socket')[_0xc8b4('0xe')](socket);function respondWithRpcPromise(_0x4379d0,_0x12d3f0,_0x24e82e){return new BPromise(function(_0x297d1f,_0x54e44a){return client['request'](_0x4379d0,_0x24e82e)[_0xc8b4('0xf')](function(_0x1e2311){logger[_0xc8b4('0x10')](_0xc8b4('0x11'),_0x12d3f0,'request\x20sent');logger['debug'](_0xc8b4('0x12'),_0x12d3f0,_0xc8b4('0x13'),JSON[_0xc8b4('0x14')](_0x1e2311));if(_0x1e2311[_0xc8b4('0x15')]){if(_0x1e2311[_0xc8b4('0x15')]['code']===0x1f4){logger[_0xc8b4('0x15')](_0xc8b4('0x11'),_0x12d3f0,_0x1e2311[_0xc8b4('0x15')][_0xc8b4('0x16')]);return _0x54e44a(_0x1e2311['error'][_0xc8b4('0x16')]);}logger[_0xc8b4('0x15')](_0xc8b4('0x11'),_0x12d3f0,_0x1e2311[_0xc8b4('0x15')][_0xc8b4('0x16')]);return _0x297d1f(_0x1e2311[_0xc8b4('0x15')][_0xc8b4('0x16')]);}else{logger[_0xc8b4('0x10')](_0xc8b4('0x11'),_0x12d3f0,_0xc8b4('0x13'));_0x297d1f(_0x1e2311[_0xc8b4('0x17')][_0xc8b4('0x16')]);}})[_0xc8b4('0x18')](function(_0x32f70c){logger['error'](_0xc8b4('0x11'),_0x12d3f0,_0x32f70c);_0x54e44a(_0x32f70c);});});}exports[_0xc8b4('0x19')]=function(_0x44687b){var _0x541d84=this;return new Promise(function(_0xb269e6,_0x6511db){return db[_0xc8b4('0x1a')][_0xc8b4('0x1b')](_0x44687b[_0xc8b4('0x1c')],{'raw':_0x44687b[_0xc8b4('0x1d')]?_0x44687b[_0xc8b4('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44687b[_0xc8b4('0x1d')]?_0x44687b['options']['where']||null:null,'attributes':_0x44687b[_0xc8b4('0x1d')]?_0x44687b[_0xc8b4('0x1d')][_0xc8b4('0x1e')]||null:null,'limit':_0x44687b[_0xc8b4('0x1d')]?_0x44687b[_0xc8b4('0x1d')]['limit']||null:null})[_0xc8b4('0xf')](function(_0x2b01b7){logger[_0xc8b4('0x10')](_0xc8b4('0x19'),_0x44687b);logger[_0xc8b4('0x1f')](_0xc8b4('0x19'),_0x44687b,JSON[_0xc8b4('0x14')](_0x2b01b7));_0xb269e6(_0x2b01b7);})[_0xc8b4('0x18')](function(_0x18e13f){logger['error'](_0xc8b4('0x19'),_0x18e13f[_0xc8b4('0x16')],_0x44687b);_0x6511db(_0x541d84['error'](0x1f4,_0x18e13f['message']));});});};exports['AddTagsToFaxInteraction']=function(_0x11bb8d){return new Promise(function(_0x1a5743,_0x2ab9cb){return db['FaxInteraction'][_0xc8b4('0x20')]({'where':_0x11bb8d['options']?_0x11bb8d[_0xc8b4('0x1d')][_0xc8b4('0x21')]||null:null})[_0xc8b4('0xf')](function(_0x4d3e27){if(_0x4d3e27){return _0x4d3e27[_0xc8b4('0x22')](_0x11bb8d[_0xc8b4('0x1c')][_0xc8b4('0x23')],_['omit'](_0x11bb8d['body'],[_0xc8b4('0x23'),'id'])||{});}})[_0xc8b4('0x24')](function(_0x11eb53){logger[_0xc8b4('0x10')]('AddTags',_0x11bb8d);logger[_0xc8b4('0x1f')]('AddTags',_0x11bb8d,JSON[_0xc8b4('0x14')](_0x11eb53));_0x1a5743(_0x11eb53);})[_0xc8b4('0x18')](function(_0x2155b9){logger[_0xc8b4('0x15')](_0xc8b4('0x25'),_0x2155b9['message'],_0x11bb8d);_0x2ab9cb(_this[_0xc8b4('0x15')](0x1f4,_0x2155b9[_0xc8b4('0x16')]));});});}; \ No newline at end of file +var _0xfccc=['options','raw','where','attributes','then','catch','AddTagsToFaxInteraction','find','addTags','omit','ids','spread','AddTags','stringify','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','defaults','localhost','socket.io-emitter','redis','./faxInteraction.socket','register','request','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','FaxInteraction,\x20%s,\x20%s','UpdateFaxInteraction','FaxInteraction','body'];(function(_0x587e24,_0x15b6aa){var _0x46a3b4=function(_0x337ee9){while(--_0x337ee9){_0x587e24['push'](_0x587e24['shift']());}};_0x46a3b4(++_0x15b6aa);}(_0xfccc,0xae));var _0xcfcc=function(_0x526e3b,_0x5195d9){_0x526e3b=_0x526e3b-0x0;var _0x1038ed=_0xfccc[_0x526e3b];return _0x1038ed;};'use strict';var _=require('lodash');var util=require(_0xcfcc('0x0'));var moment=require(_0xcfcc('0x1'));var BPromise=require(_0xcfcc('0x2'));var rs=require(_0xcfcc('0x3'));var fs=require('fs');var Redis=require(_0xcfcc('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcfcc('0x5'));var logger=require('../../config/logger')(_0xcfcc('0x6'));var config=require(_0xcfcc('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xcfcc('0x8')](config['redis'],{'host':_0xcfcc('0x9'),'port':0x18eb});var socket=require(_0xcfcc('0xa'))(new Redis(config[_0xcfcc('0xb')]));require(_0xcfcc('0xc'))[_0xcfcc('0xd')](socket);function respondWithRpcPromise(_0x5494d4,_0x5c3ce6,_0x501e40){return new BPromise(function(_0x5458de,_0x247531){return client[_0xcfcc('0xe')](_0x5494d4,_0x501e40)['then'](function(_0x5eed33){logger[_0xcfcc('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x5c3ce6,_0xcfcc('0x10'));logger[_0xcfcc('0x11')](_0xcfcc('0x12'),_0x5c3ce6,'request\x20sent',JSON['stringify'](_0x5eed33));if(_0x5eed33['error']){if(_0x5eed33[_0xcfcc('0x13')][_0xcfcc('0x14')]===0x1f4){logger[_0xcfcc('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x5c3ce6,_0x5eed33[_0xcfcc('0x13')][_0xcfcc('0x15')]);return _0x247531(_0x5eed33[_0xcfcc('0x13')][_0xcfcc('0x15')]);}logger[_0xcfcc('0x13')](_0xcfcc('0x16'),_0x5c3ce6,_0x5eed33[_0xcfcc('0x13')][_0xcfcc('0x15')]);return _0x5458de(_0x5eed33['error'][_0xcfcc('0x15')]);}else{logger[_0xcfcc('0xf')](_0xcfcc('0x16'),_0x5c3ce6,_0xcfcc('0x10'));_0x5458de(_0x5eed33['result'][_0xcfcc('0x15')]);}})['catch'](function(_0x2b28a6){logger[_0xcfcc('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x5c3ce6,_0x2b28a6);_0x247531(_0x2b28a6);});});}exports[_0xcfcc('0x17')]=function(_0x2736bf){var _0x3cf240=this;return new Promise(function(_0x43c5b8,_0x35b4d7){return db[_0xcfcc('0x18')]['update'](_0x2736bf[_0xcfcc('0x19')],{'raw':_0x2736bf['options']?_0x2736bf[_0xcfcc('0x1a')][_0xcfcc('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2736bf[_0xcfcc('0x1a')]?_0x2736bf[_0xcfcc('0x1a')][_0xcfcc('0x1c')]||null:null,'attributes':_0x2736bf['options']?_0x2736bf[_0xcfcc('0x1a')][_0xcfcc('0x1d')]||null:null,'limit':_0x2736bf[_0xcfcc('0x1a')]?_0x2736bf[_0xcfcc('0x1a')]['limit']||null:null})[_0xcfcc('0x1e')](function(_0x59fb7c){logger[_0xcfcc('0xf')](_0xcfcc('0x17'),_0x2736bf);logger['debug'](_0xcfcc('0x17'),_0x2736bf,JSON['stringify'](_0x59fb7c));_0x43c5b8(_0x59fb7c);})[_0xcfcc('0x1f')](function(_0x319600){logger[_0xcfcc('0x13')](_0xcfcc('0x17'),_0x319600[_0xcfcc('0x15')],_0x2736bf);_0x35b4d7(_0x3cf240[_0xcfcc('0x13')](0x1f4,_0x319600['message']));});});};exports[_0xcfcc('0x20')]=function(_0x24c989){return new Promise(function(_0x2c7579,_0x32a32e){return db['FaxInteraction'][_0xcfcc('0x21')]({'where':_0x24c989[_0xcfcc('0x1a')]?_0x24c989[_0xcfcc('0x1a')][_0xcfcc('0x1c')]||null:null})['then'](function(_0x528357){if(_0x528357){return _0x528357[_0xcfcc('0x22')](_0x24c989[_0xcfcc('0x19')]['ids'],_[_0xcfcc('0x23')](_0x24c989[_0xcfcc('0x19')],[_0xcfcc('0x24'),'id'])||{});}})[_0xcfcc('0x25')](function(_0x482db7){logger[_0xcfcc('0xf')](_0xcfcc('0x26'),_0x24c989);logger[_0xcfcc('0x11')](_0xcfcc('0x26'),_0x24c989,JSON[_0xcfcc('0x27')](_0x482db7));_0x2c7579(_0x482db7);})[_0xcfcc('0x1f')](function(_0x12ad5d){logger[_0xcfcc('0x13')]('AddTags',_0x12ad5d['message'],_0x24c989);_0x32a32e(_this[_0xcfcc('0x13')](0x1f4,_0x12ad5d[_0xcfcc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index eb7e530..7b57ad2 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 _0x112a=['emit','removeListener','register','remove','update'];(function(_0x3ba79c,_0x1547d2){var _0xd2d1a4=function(_0x429fd1){while(--_0x429fd1){_0x3ba79c['push'](_0x3ba79c['shift']());}};_0xd2d1a4(++_0x1547d2);}(_0x112a,0x67));var _0xa112=function(_0x37d8bd,_0xee1d87){_0x37d8bd=_0x37d8bd-0x0;var _0x426b73=_0x112a[_0x37d8bd];return _0x426b73;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0xa112('0x0'),_0xa112('0x1')];function createListener(_0x34a650,_0x11261d){return function(_0x492f0b){_0x11261d[_0xa112('0x2')](_0x34a650,_0x492f0b);};}function removeListener(_0x2fb692,_0x5d8397){return function(){FaxInteractionEvents[_0xa112('0x3')](_0x2fb692,_0x5d8397);};}exports[_0xa112('0x4')]=function(_0x3ecd88){for(var _0x728ec4=0x0,_0x371efe=events['length'];_0x728ec4<_0x371efe;_0x728ec4++){var _0x219d9b=events[_0x728ec4];var _0x5a8617=createListener('faxInteraction:'+_0x219d9b,_0x3ecd88);FaxInteractionEvents['on'](_0x219d9b,_0x5a8617);}}; \ No newline at end of file +var _0x9e01=['update','emit','removeListener','register','length'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9e01,0xaa));var _0x19e0=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x9e01[_0x17d9e3];return _0x14192d;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save','remove',_0x19e0('0x0')];function createListener(_0x4dc807,_0x559b07){return function(_0x5ee730){_0x559b07[_0x19e0('0x1')](_0x4dc807,_0x5ee730);};}function removeListener(_0x307320,_0x45ec18){return function(){FaxInteractionEvents[_0x19e0('0x2')](_0x307320,_0x45ec18);};}exports[_0x19e0('0x3')]=function(_0x1382fa){for(var _0x1d1469=0x0,_0x1a22b3=events[_0x19e0('0x4')];_0x1d1469<_0x1a22b3;_0x1d1469++){var _0x1e01e0=events[_0x1d1469];var _0x58e1c2=createListener('faxInteraction:'+_0x1e01e0,_0x1382fa);FaxInteractionEvents['on'](_0x1e01e0,_0x58e1c2);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index b2c3bb8..2e48f99 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 _0x0d6a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id/download','download','post','/:id/messages','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','faxinteraction:update','update','delete','/:id','faxinteraction:destroy','exports','multer','util'];(function(_0x1cf2da,_0x41e8cd){var _0x59108c=function(_0x43735a){while(--_0x43735a){_0x1cf2da['push'](_0x1cf2da['shift']());}};_0x59108c(++_0x41e8cd);}(_0x0d6a,0xc9));var _0xa0d6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x0d6a[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0xa0d6('0x0'));var util=require(_0xa0d6('0x1'));var path=require('path');var timeout=require(_0xa0d6('0x2'));var express=require(_0xa0d6('0x3'));var router=express[_0xa0d6('0x4')]();var fs_extra=require(_0xa0d6('0x5'));var auth=require(_0xa0d6('0x6'));var interaction=require(_0xa0d6('0x7'));var config=require(_0xa0d6('0x8'));var controller=require(_0xa0d6('0x9'));router[_0xa0d6('0xa')]('/',auth[_0xa0d6('0xb')](),controller['index']);router[_0xa0d6('0xa')](_0xa0d6('0xc'),auth[_0xa0d6('0xb')](),controller[_0xa0d6('0xd')]);router[_0xa0d6('0xa')]('/:id',auth[_0xa0d6('0xb')](),controller['show']);router[_0xa0d6('0xa')]('/:id/messages',auth[_0xa0d6('0xb')](),controller['getMessages']);router[_0xa0d6('0xa')](_0xa0d6('0xe'),auth[_0xa0d6('0xb')](),controller[_0xa0d6('0xf')]);router[_0xa0d6('0x10')]('/',auth[_0xa0d6('0xb')](),controller['create']);router[_0xa0d6('0x10')](_0xa0d6('0x11'),auth[_0xa0d6('0xb')](),controller['addMessage']);router[_0xa0d6('0x10')](_0xa0d6('0x12'),auth[_0xa0d6('0xb')](),interaction[_0xa0d6('0x13')](_0xa0d6('0x14'),_0xa0d6('0x15')),controller[_0xa0d6('0x16')]);router['put']('/:id',auth[_0xa0d6('0xb')](),interaction[_0xa0d6('0x13')](_0xa0d6('0x14'),_0xa0d6('0x17')),controller[_0xa0d6('0x18')]);router[_0xa0d6('0x19')](_0xa0d6('0x1a'),auth['isAuthenticated'](),interaction[_0xa0d6('0x13')](_0xa0d6('0x14'),_0xa0d6('0x1b')),controller['destroy']);router[_0xa0d6('0x19')]('/:id/tags',auth[_0xa0d6('0xb')](),controller['removeTags']);module[_0xa0d6('0x1c')]=router; \ No newline at end of file +var _0x9918=['index','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','fax','faxinteraction:addtags','addTags','put','/:id','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x3d92fc,_0x287b91){var _0x2dc213=function(_0x2270f8){while(--_0x2270f8){_0x3d92fc['push'](_0x3d92fc['shift']());}};_0x2dc213(++_0x287b91);}(_0x9918,0xad));var _0x8991=function(_0x1e8dd5,_0x571f6d){_0x1e8dd5=_0x1e8dd5-0x0;var _0x9aa844=_0x9918[_0x1e8dd5];return _0x9aa844;};'use strict';var multer=require('multer');var util=require(_0x8991('0x0'));var path=require(_0x8991('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8991('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x8991('0x3'));var interaction=require(_0x8991('0x4'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router[_0x8991('0x5')]('/',auth[_0x8991('0x6')](),controller[_0x8991('0x7')]);router[_0x8991('0x5')]('/describe',auth[_0x8991('0x6')](),controller[_0x8991('0x8')]);router[_0x8991('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x8991('0x9')]);router[_0x8991('0x5')](_0x8991('0xa'),auth[_0x8991('0x6')](),controller[_0x8991('0xb')]);router[_0x8991('0x5')](_0x8991('0xc'),auth[_0x8991('0x6')](),controller[_0x8991('0xd')]);router[_0x8991('0xe')]('/',auth['isAuthenticated'](),controller[_0x8991('0xf')]);router[_0x8991('0xe')](_0x8991('0xa'),auth[_0x8991('0x6')](),controller[_0x8991('0x10')]);router[_0x8991('0xe')]('/:id/tags',auth[_0x8991('0x6')](),interaction[_0x8991('0x11')](_0x8991('0x12'),_0x8991('0x13')),controller[_0x8991('0x14')]);router[_0x8991('0x15')](_0x8991('0x16'),auth['isAuthenticated'](),interaction['tracked'](_0x8991('0x12'),'faxinteraction:update'),controller[_0x8991('0x17')]);router[_0x8991('0x18')]('/:id',auth[_0x8991('0x6')](),interaction[_0x8991('0x11')](_0x8991('0x12'),_0x8991('0x19')),controller[_0x8991('0x1a')]);router['delete'](_0x8991('0x1b'),auth[_0x8991('0x6')](),controller[_0x8991('0x1c')]);module[_0x8991('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 4fb2e50..dfa69bd 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 _0xb49a=['exports','TEXT','medium','BOOLEAN','out','sequelize'];(function(_0x4e43fd,_0xceae2d){var _0xc71aad=function(_0x594093){while(--_0x594093){_0x4e43fd['push'](_0x4e43fd['shift']());}};_0xc71aad(++_0xceae2d);}(_0xb49a,0xfb));var _0xab49=function(_0x5e570c,_0x233990){_0x5e570c=_0x5e570c-0x0;var _0xc62527=_0xb49a[_0x5e570c];return _0xc62527;};'use strict';var Sequelize=require(_0xab49('0x0'));module[_0xab49('0x1')]={'body':{'type':Sequelize[_0xab49('0x2')](_0xab49('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xab49('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xab49('0x5')),'defaultValue':_0xab49('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x2750=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x50d929,_0x5f40ad){var _0x1a0772=function(_0x565a59){while(--_0x565a59){_0x50d929['push'](_0x50d929['shift']());}};_0x1a0772(++_0x5f40ad);}(_0x2750,0x13b));var _0x0275=function(_0x37003d,_0x5f1fdb){_0x37003d=_0x37003d-0x0;var _0x4a4ff1=_0x2750[_0x37003d];return _0x4a4ff1;};'use strict';var Sequelize=require(_0x0275('0x0'));module['exports']={'body':{'type':Sequelize[_0x0275('0x1')](_0x0275('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0275('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0275('0x4')]('in',_0x0275('0x5')),'defaultValue':_0x0275('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x0275('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x0275('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 32046dd..061f485 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 _0xd3a9=['apply','reject','save','update','destroy','status','stack','name','index','FaxMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','VIRTUAL','filter','merge','options','where','includeAll','show','params','include','find','body','describe','fax-interactions','fax','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','User','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','null','RejectMessage','contact','email','rejectmessage','create','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','server','files','Attachment','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','end','offset','count','set','Content-Range','json'];(function(_0x58c045,_0x2719d1){var _0x460cdb=function(_0x52efe4){while(--_0x52efe4){_0x58c045['push'](_0x58c045['shift']());}};_0x460cdb(++_0x2719d1);}(_0xd3a9,0xe5));var _0x9d3a=function(_0x451c75,_0x57c9db){_0x451c75=_0x451c75-0x0;var _0x158a56=_0xd3a9[_0x451c75];return _0x158a56;};'use strict';var emlformat=require(_0x9d3a('0x0'));var rimraf=require(_0x9d3a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9d3a('0x2'));var rp=require(_0x9d3a('0x3'));var moment=require(_0x9d3a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9d3a('0x5'));var util=require('util');var path=require(_0x9d3a('0x6'));var sox=require(_0x9d3a('0x7'));var csv=require('to-csv');var ejs=require(_0x9d3a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d3a('0x9'));var squel=require(_0x9d3a('0xa'));var crypto=require(_0x9d3a('0xb'));var jsforce=require(_0x9d3a('0xc'));var deskjs=require(_0x9d3a('0xd'));var toCsv=require(_0x9d3a('0xe'));var querystring=require(_0x9d3a('0xf'));var Papa=require(_0x9d3a('0x10'));var Redis=require(_0x9d3a('0x11'));var authService=require(_0x9d3a('0x12'));var qs=require(_0x9d3a('0x13'));var as=require(_0x9d3a('0x14'));var hardwareService=require(_0x9d3a('0x15'));var logger=require(_0x9d3a('0x16'))(_0x9d3a('0x17'));var utils=require(_0x9d3a('0x18'));var config=require(_0x9d3a('0x19'));var licenseUtil=require(_0x9d3a('0x1a'));var db=require('../../mysqldb')['db'];config[_0x9d3a('0x1b')]=_[_0x9d3a('0x1c')](config[_0x9d3a('0x1b')],{'host':_0x9d3a('0x1d'),'port':0x18eb});var socket=require(_0x9d3a('0x1e'))(new Redis(config[_0x9d3a('0x1b')]));require(_0x9d3a('0x1f'))[_0x9d3a('0x20')](socket);var jayson=require(_0x9d3a('0x21'));var client=jayson[_0x9d3a('0x22')][_0x9d3a('0x23')]({'port':0x232c});var client9002=jayson['client'][_0x9d3a('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x1d6134,_0x4fa029,_0x223415,_0x1a8d30){return new BPromise(function(_0x406856,_0x2f46ef){var _0x35c237=_0x1a8d30||client;return _0x35c237['request'](_0x1d6134,_0x223415)[_0x9d3a('0x24')](function(_0x5583a2){logger[_0x9d3a('0x25')](_0x9d3a('0x26'),_0x4fa029,_0x9d3a('0x27'));logger[_0x9d3a('0x28')](_0x9d3a('0x29'),_0x4fa029,_0x9d3a('0x27'),JSON['stringify'](_0x5583a2));if(_0x5583a2[_0x9d3a('0x2a')]){if(_0x5583a2[_0x9d3a('0x2a')]['code']===0x1f4){logger[_0x9d3a('0x2a')](_0x9d3a('0x26'),_0x4fa029,_0x5583a2[_0x9d3a('0x2a')][_0x9d3a('0x2b')]);return _0x2f46ef(_0x5583a2[_0x9d3a('0x2a')]['message']);}logger[_0x9d3a('0x2a')]('FaxMessage,\x20%s,\x20%s',_0x4fa029,_0x5583a2['error']['message']);return _0x406856(_0x5583a2[_0x9d3a('0x2a')][_0x9d3a('0x2b')]);}else{logger[_0x9d3a('0x25')](_0x9d3a('0x26'),_0x4fa029,_0x9d3a('0x27'));_0x406856(_0x5583a2[_0x9d3a('0x2c')][_0x9d3a('0x2b')]);}})[_0x9d3a('0x2d')](function(_0x396038){logger[_0x9d3a('0x2a')](_0x9d3a('0x26'),_0x4fa029,_0x396038);_0x2f46ef(_0x396038);});});}function respondWithStatusCode(_0x131283,_0x29f983){_0x29f983=_0x29f983||0xcc;return function(_0x44ceba){if(_0x44ceba){return _0x131283[_0x9d3a('0x2e')](_0x29f983);}return _0x131283['status'](_0x29f983)[_0x9d3a('0x2f')]();};}function respondWithResult(_0x5e8514,_0x34a25b){_0x34a25b=_0x34a25b||0xc8;return function(_0x5c1e24){if(_0x5c1e24){return _0x5e8514['status'](_0x34a25b)['json'](_0x5c1e24);}};}function respondWithFilteredResult(_0x11840a,_0x18e298){return function(_0x1fbe8e){if(_0x1fbe8e){var _0x3c77f9=typeof _0x18e298[_0x9d3a('0x30')]==='undefined'&&typeof _0x18e298['limit']==='undefined';var _0x1ff804=_0x1fbe8e['count'];var _0x3f54b0=_0x3c77f9?0x0:_0x18e298[_0x9d3a('0x30')];var _0x321227=_0x3c77f9?_0x1fbe8e[_0x9d3a('0x31')]:_0x18e298['offset']+_0x18e298['limit'];var _0x57bed5;if(_0x321227>=_0x1ff804){_0x321227=_0x1ff804;_0x57bed5=0xc8;}else{_0x57bed5=0xce;}_0x11840a['status'](_0x57bed5);return _0x11840a[_0x9d3a('0x32')](_0x9d3a('0x33'),_0x3f54b0+'-'+_0x321227+'/'+_0x1ff804)[_0x9d3a('0x34')](_0x1fbe8e);}return null;};}function patchUpdates(_0x56bc07){return function(_0x378717){try{jsonpatch[_0x9d3a('0x35')](_0x378717,_0x56bc07,!![]);}catch(_0x42abcd){return BPromise[_0x9d3a('0x36')](_0x42abcd);}return _0x378717[_0x9d3a('0x37')]();};}function saveUpdates(_0x5e56d0,_0x3e085f){return function(_0x2d6d56){if(_0x2d6d56){return _0x2d6d56[_0x9d3a('0x38')](_0x5e56d0)['then'](function(_0x4877f5){return _0x4877f5;});}return null;};}function removeEntity(_0x360fed,_0x2e6a84){return function(_0x353827){if(_0x353827){return _0x353827[_0x9d3a('0x39')]()[_0x9d3a('0x24')](function(){_0x360fed[_0x9d3a('0x3a')](0xcc)[_0x9d3a('0x2f')]();});}};}function handleEntityNotFound(_0x1f8535,_0x1e3298){return function(_0x2b94fe){if(!_0x2b94fe){_0x1f8535[_0x9d3a('0x2e')](0x194);}return _0x2b94fe;};}function handleError(_0x3fc274,_0x19e5ae){_0x19e5ae=_0x19e5ae||0x1f4;return function(_0x43b255){logger[_0x9d3a('0x2a')](_0x43b255[_0x9d3a('0x3b')]);if(_0x43b255[_0x9d3a('0x3c')]){delete _0x43b255[_0x9d3a('0x3c')];}_0x3fc274[_0x9d3a('0x3a')](_0x19e5ae)['send'](_0x43b255);};}exports[_0x9d3a('0x3d')]=function(_0x2176b7,_0xa60fa6){var _0x5cb777={},_0x2c5812={},_0xf5f865={'count':0x0,'rows':[]};var _0x55ca4d=_['map'](db[_0x9d3a('0x3e')][_0x9d3a('0x3f')],function(_0x15e72e){return{'name':_0x15e72e[_0x9d3a('0x40')],'type':_0x15e72e[_0x9d3a('0x41')]['key']};});_0x2c5812[_0x9d3a('0x42')]=_[_0x9d3a('0x43')](_0x55ca4d,'name');_0x2c5812[_0x9d3a('0x44')]=_[_0x9d3a('0x45')](_0x2176b7[_0x9d3a('0x44')]);_0x2c5812[_0x9d3a('0x46')]=_[_0x9d3a('0x47')](_0x2c5812[_0x9d3a('0x42')],_0x2c5812[_0x9d3a('0x44')]);_0x5cb777[_0x9d3a('0x48')]=_[_0x9d3a('0x47')](_0x2c5812['model'],qs['fields'](_0x2176b7[_0x9d3a('0x44')][_0x9d3a('0x49')]));_0x5cb777[_0x9d3a('0x48')]=_0x5cb777[_0x9d3a('0x48')][_0x9d3a('0x4a')]?_0x5cb777[_0x9d3a('0x48')]:_0x2c5812[_0x9d3a('0x42')];if(!_0x2176b7[_0x9d3a('0x44')][_0x9d3a('0x4b')](_0x9d3a('0x4c'))){_0x5cb777[_0x9d3a('0x4d')]=qs[_0x9d3a('0x4d')](_0x2176b7[_0x9d3a('0x44')][_0x9d3a('0x4d')]);_0x5cb777[_0x9d3a('0x30')]=qs[_0x9d3a('0x30')](_0x2176b7['query']['offset']);}_0x5cb777[_0x9d3a('0x4e')]=qs[_0x9d3a('0x4f')](_0x2176b7[_0x9d3a('0x44')][_0x9d3a('0x4f')]);_0x5cb777['where']=qs[_0x9d3a('0x46')](_[_0x9d3a('0x50')](_0x2176b7[_0x9d3a('0x44')],_0x2c5812['filters']),_0x55ca4d);if(_0x2176b7['query']['filter']){_0x5cb777['where']=_['merge'](_0x5cb777['where'],{'$or':_[_0x9d3a('0x43')](_0x55ca4d,function(_0x33e8d8){if(_0x33e8d8[_0x9d3a('0x41')]!==_0x9d3a('0x51')){var _0x3bec8f={};_0x3bec8f[_0x33e8d8[_0x9d3a('0x3c')]]={'$like':'%'+_0x2176b7[_0x9d3a('0x44')][_0x9d3a('0x52')]+'%'};return _0x3bec8f;}})});}_0x5cb777=_[_0x9d3a('0x53')]({},_0x5cb777,_0x2176b7[_0x9d3a('0x54')]);var _0x4e3270={'where':_0x5cb777[_0x9d3a('0x55')]};return db[_0x9d3a('0x3e')][_0x9d3a('0x31')](_0x4e3270)[_0x9d3a('0x24')](function(_0x2b16f5){_0xf5f865[_0x9d3a('0x31')]=_0x2b16f5;if(_0x2176b7[_0x9d3a('0x44')][_0x9d3a('0x56')]){_0x5cb777['include']=[{'all':!![]}];}return db[_0x9d3a('0x3e')]['findAll'](_0x5cb777);})['then'](function(_0x23583a){_0xf5f865['rows']=_0x23583a;return _0xf5f865;})[_0x9d3a('0x24')](respondWithFilteredResult(_0xa60fa6,_0x5cb777))[_0x9d3a('0x2d')](handleError(_0xa60fa6,null));};exports[_0x9d3a('0x57')]=function(_0x1f2e46,_0x2b903c){var _0x1e906e={'raw':!![],'where':{'id':_0x1f2e46[_0x9d3a('0x58')]['id']}},_0x583c37={};_0x583c37[_0x9d3a('0x42')]=_['keys'](db['FaxMessage'][_0x9d3a('0x3f')]);_0x583c37[_0x9d3a('0x44')]=_[_0x9d3a('0x45')](_0x1f2e46[_0x9d3a('0x44')]);_0x583c37[_0x9d3a('0x46')]=_['intersection'](_0x583c37[_0x9d3a('0x42')],_0x583c37['query']);_0x1e906e[_0x9d3a('0x48')]=_[_0x9d3a('0x47')](_0x583c37[_0x9d3a('0x42')],qs[_0x9d3a('0x49')](_0x1f2e46[_0x9d3a('0x44')][_0x9d3a('0x49')]));_0x1e906e[_0x9d3a('0x48')]=_0x1e906e[_0x9d3a('0x48')][_0x9d3a('0x4a')]?_0x1e906e[_0x9d3a('0x48')]:_0x583c37['model'];if(_0x1f2e46[_0x9d3a('0x44')][_0x9d3a('0x56')]){_0x1e906e[_0x9d3a('0x59')]=[{'all':!![]}];}_0x1e906e=_['merge']({},_0x1e906e,_0x1f2e46['options']);return db[_0x9d3a('0x3e')][_0x9d3a('0x5a')](_0x1e906e)[_0x9d3a('0x24')](handleEntityNotFound(_0x2b903c,null))[_0x9d3a('0x24')](respondWithResult(_0x2b903c,null))['catch'](handleError(_0x2b903c,null));};exports[_0x9d3a('0x38')]=function(_0x597876,_0x44dfe9){if(_0x597876[_0x9d3a('0x5b')]['id']){delete _0x597876['body']['id'];}return db[_0x9d3a('0x3e')][_0x9d3a('0x5a')]({'where':{'id':_0x597876['params']['id']}})[_0x9d3a('0x24')](handleEntityNotFound(_0x44dfe9,null))['then'](saveUpdates(_0x597876[_0x9d3a('0x5b')],null))[_0x9d3a('0x24')](respondWithResult(_0x44dfe9,null))[_0x9d3a('0x2d')](handleError(_0x44dfe9,null));};exports[_0x9d3a('0x39')]=function(_0x2336b2,_0xbc3288){return db[_0x9d3a('0x3e')]['find']({'where':{'id':_0x2336b2[_0x9d3a('0x58')]['id']}})[_0x9d3a('0x24')](handleEntityNotFound(_0xbc3288,null))[_0x9d3a('0x24')](removeEntity(_0xbc3288,null))[_0x9d3a('0x2d')](handleError(_0xbc3288,null));};exports[_0x9d3a('0x5c')]=function(_0x3122a,_0x469b7d){return db[_0x9d3a('0x3e')][_0x9d3a('0x5c')]()[_0x9d3a('0x24')](respondWithResult(_0x469b7d,null))[_0x9d3a('0x2d')](handleError(_0x469b7d,null));};var interaction_log=require(_0x9d3a('0x16'))(_0x9d3a('0x5d'));exports['accept']=function(_0x59878c,_0xb98b0d,_0x1b3a8f){var _0x18b78c={'agent':{},'channel':_0x9d3a('0x5e')};if(_0x59878c['body']['id']){delete _0x59878c['body']['id'];}_0x59878c[_0x9d3a('0x5b')]['read']=!![];_0x59878c[_0x9d3a('0x5b')]['readAt']=moment()[_0x9d3a('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x59878c[_0x9d3a('0x5b')]['UserId']=_0x59878c[_0x9d3a('0x5b')][_0x9d3a('0x60')]||_0x59878c[_0x9d3a('0x61')]['id'];_0x18b78c[_0x9d3a('0x62')]['id']=_0x59878c[_0x9d3a('0x5b')][_0x9d3a('0x60')];return db[_0x9d3a('0x3e')][_0x9d3a('0x5a')]({'where':{'id':_0x59878c[_0x9d3a('0x58')]['id'],'UserId':null}})[_0x9d3a('0x24')](handleEntityNotFound(_0xb98b0d,null))['then'](saveUpdates(_0x59878c[_0x9d3a('0x5b')],null))['then'](function(_0x4017e9){if(_0x4017e9){_0x18b78c[_0x9d3a('0x2b')]=_0x4017e9[_0x9d3a('0x63')]({'plain':!![]});return db[_0x9d3a('0x64')][_0x9d3a('0x5a')]({'where':{'id':_0x4017e9[_0x9d3a('0x65')]}});}return null;})['then'](handleEntityNotFound(_0xb98b0d,null))['then'](function(_0x340b86){if(_0x340b86){return _0x340b86['update']({'UserId':_0x59878c[_0x9d3a('0x5b')][_0x9d3a('0x60')],'read1stAt':_[_0x9d3a('0x66')](_0x340b86['read1stAt'])?moment()['format'](_0x9d3a('0x67')):undefined});}return null;})[_0x9d3a('0x24')](function(_0x36dd06){if(_0x36dd06){_0x18b78c[_0x9d3a('0x68')]=_0x36dd06[_0x9d3a('0x63')]({'plain':!![]});interaction_log[_0x9d3a('0x25')](_0x9d3a('0x69'),_0x59878c[_0x9d3a('0x61')]['id'],_0x59878c['user'][_0x9d3a('0x3c')],_0x59878c[_0x9d3a('0x61')][_0x9d3a('0x6a')],_0x18b78c[_0x9d3a('0x68')]['id'],_0x59878c[_0x9d3a('0x5b')]?JSON[_0x9d3a('0x6b')](_0x59878c[_0x9d3a('0x5b')]):'null');return respondWithRpcPromise('AcceptMessage',_0x9d3a('0x6c'),_0x18b78c);}return null;})['then'](function(_0x15419a){var _0x501daa=_0x9d3a('0x6d')+_0x15419a[_0x9d3a('0x2b')]['ContactId'];return db[_0x9d3a('0x6e')][_0x9d3a('0x44')](_0x501daa,{'type':db[_0x9d3a('0x6f')]['QueryTypes'][_0x9d3a('0x70')],'raw':!![]})[_0x9d3a('0x24')](function(_0x419e62){return _0x419e62;});})[_0x9d3a('0x24')](function(_0x56f7e8){if(_0x56f7e8){_0x18b78c[_0x9d3a('0x2b')]['contact']=_0x56f7e8[0x0];if(!_0x59878c['body'][_0x9d3a('0x60')])return;return db[_0x9d3a('0x71')][_0x9d3a('0x5a')]({'where':{'id':_0x59878c[_0x9d3a('0x5b')]['UserId'],'role':_0x9d3a('0x62')},'attributes':['id',_0x9d3a('0x3c'),_0x9d3a('0x72'),'email',_0x9d3a('0x73')],'raw':!![]});}return null;})[_0x9d3a('0x24')](function(_0x1366db){if(!_0x1366db)return null;_0x18b78c[_0x9d3a('0x2b')][_0x9d3a('0x62')]=_0x1366db;return _0x18b78c;})['then'](function(_0xee7d61){if(_0xee7d61){if(_0x59878c[_0x9d3a('0x5b')][_0x9d3a('0x74')]){_0x18b78c[_0x9d3a('0x2b')][_0x9d3a('0x75')]=util['format'](_0x9d3a('0x76'),_0x59878c['user'][_0x9d3a('0x3c')]);_0x18b78c[_0x9d3a('0x2b')][_0x9d3a('0x77')]=_0x18b78c[_0x9d3a('0x77')];_0x18b78c[_0x9d3a('0x2b')][_0x9d3a('0x78')]=_0x18b78c[_0x9d3a('0x77')];_0x18b78c['message'][_0x9d3a('0x79')]=_0x9d3a('0x7a');return respondWithRpcPromise('EventManager',_0x9d3a('0x7b'),{'event':_0x9d3a('0x7c'),'message':_0x18b78c[_0x9d3a('0x2b')]},client9002)['then'](function(){return _0x18b78c;});}return _0x18b78c;}return null;})[_0x9d3a('0x24')](respondWithResult(_0xb98b0d,null))[_0x9d3a('0x2d')](handleError(_0xb98b0d,null));};var interaction_log=require(_0x9d3a('0x16'))(_0x9d3a('0x5d'));exports[_0x9d3a('0x36')]=function(_0x397c05,_0x4f8493,_0xa61916){var _0x3bae38={'agent':{},'channel':_0x9d3a('0x5e')};if(_0x397c05[_0x9d3a('0x5b')]['id']){delete _0x397c05[_0x9d3a('0x5b')]['id'];}_0x397c05[_0x9d3a('0x5b')]['UserId']=_0x397c05[_0x9d3a('0x5b')][_0x9d3a('0x60')]||_0x397c05[_0x9d3a('0x61')]['id'];_0x3bae38['agent']['id']=_0x397c05['body'][_0x9d3a('0x60')];return db[_0x9d3a('0x3e')][_0x9d3a('0x5a')]({'where':{'id':_0x397c05[_0x9d3a('0x58')]['id'],'UserId':null}})[_0x9d3a('0x24')](handleEntityNotFound(_0x4f8493,null))[_0x9d3a('0x24')](function(_0x17b711){if(_0x17b711){_0x3bae38[_0x9d3a('0x2b')]=_0x17b711['get']({'plain':!![]});return db[_0x9d3a('0x64')]['find']({'where':{'id':_0x17b711['FaxInteractionId']}});}return null;})[_0x9d3a('0x24')](handleEntityNotFound(_0x4f8493,null))[_0x9d3a('0x24')](function(_0x2745a8){if(_0x2745a8){_0x3bae38['interaction']=_0x2745a8[_0x9d3a('0x63')]({'plain':!![]});interaction_log[_0x9d3a('0x25')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x397c05[_0x9d3a('0x61')]['id'],_0x397c05[_0x9d3a('0x61')]['name'],_0x397c05[_0x9d3a('0x61')][_0x9d3a('0x6a')],_0x3bae38[_0x9d3a('0x68')]['id'],_0x397c05[_0x9d3a('0x5b')]?JSON['stringify'](_0x397c05[_0x9d3a('0x5b')]):_0x9d3a('0x7d'));return respondWithRpcPromise(_0x9d3a('0x7e'),'rejectMessage',_0x3bae38);}return null;})['then'](function(_0xe70fb5){var _0xdb712e=_0x9d3a('0x6d')+_0xe70fb5[_0x9d3a('0x2b')]['ContactId'];return db[_0x9d3a('0x6e')][_0x9d3a('0x44')](_0xdb712e,{'type':db[_0x9d3a('0x6f')]['QueryTypes']['SELECT'],'raw':!![]})[_0x9d3a('0x24')](function(_0x102833){return _0x102833;});})[_0x9d3a('0x24')](function(_0x433fac){if(_0x433fac){_0x3bae38[_0x9d3a('0x2b')][_0x9d3a('0x7f')]=_0x433fac[0x0];if(!_0x397c05[_0x9d3a('0x5b')][_0x9d3a('0x60')])return;return db['User'][_0x9d3a('0x5a')]({'where':{'id':_0x397c05[_0x9d3a('0x5b')][_0x9d3a('0x60')],'role':_0x9d3a('0x62')},'attributes':['id',_0x9d3a('0x3c'),'fullname',_0x9d3a('0x80'),_0x9d3a('0x73')],'raw':!![]});}return null;})[_0x9d3a('0x24')](function(_0x40025c){if(!_0x40025c)return null;_0x3bae38['message'][_0x9d3a('0x62')]=_0x40025c;return _0x3bae38;})[_0x9d3a('0x24')](function(_0x475cbe){if(_0x475cbe){_0x475cbe['message']['interface']=util[_0x9d3a('0x5f')](_0x9d3a('0x76'),_0x397c05[_0x9d3a('0x61')][_0x9d3a('0x3c')]);_0x475cbe[_0x9d3a('0x2b')][_0x9d3a('0x77')]=_0x3bae38[_0x9d3a('0x77')];_0x475cbe[_0x9d3a('0x2b')][_0x9d3a('0x78')]=_0x3bae38[_0x9d3a('0x77')];_0x475cbe[_0x9d3a('0x2b')][_0x9d3a('0x79')]=_0x9d3a('0x36');respondWithRpcPromise(_0x9d3a('0x7b'),_0x9d3a('0x7b'),{'event':_0x9d3a('0x81'),'message':_0x475cbe[_0x9d3a('0x2b')]},client9002);return _0x3bae38;}return null;})[_0x9d3a('0x24')](respondWithResult(_0x4f8493,null))[_0x9d3a('0x2d')](handleError(_0x4f8493,null));};exports[_0x9d3a('0x82')]=function(_0x41bdfd,_0xb474da){var _0x724142;return db[_0x9d3a('0x3e')][_0x9d3a('0x82')](_0x41bdfd[_0x9d3a('0x5b')],{})[_0x9d3a('0x24')](function(_0x16ef86){_0x724142=_0x16ef86;return db['CmContact'][_0x9d3a('0x83')]({'where':{'id':_0x724142['ContactId']}});})[_0x9d3a('0x24')](function(_0x154a89){if(_[_0x9d3a('0x66')](_0x154a89)){return;}else{_0x724142['fax']=_0x154a89['fax'];return db['Attachment'][_0x9d3a('0x83')]({'where':{'id':_0x724142[_0x9d3a('0x84')]}});}})['then'](function(_0x439689){return respondWithRpcPromise(_0x9d3a('0x85'),_0x9d3a('0x85'),{'FaxAccountId':_[_0x9d3a('0x66')](_0x41bdfd[_0x9d3a('0x5b')])?undefined:_0x41bdfd[_0x9d3a('0x5b')][_0x9d3a('0x86')],'path':_[_0x9d3a('0x66')](_0x439689)?undefined:util['format'](_0x9d3a('0x87'),_0x439689[_0x9d3a('0x88')]),'fax':_[_0x9d3a('0x66')](_0x724142[_0x9d3a('0x5e')])?undefined:_0x724142[_0x9d3a('0x5e')],'AttachmentId':_0x724142[_0x9d3a('0x84')]},client9002);})['then'](respondWithResult(_0xb474da,0xc9))[_0x9d3a('0x2d')](handleError(_0xb474da,null));};exports[_0x9d3a('0x89')]=function(_0x460042,_0x24b107){var _0x37e71c=path['join'](config['root'],_0x9d3a('0x8a'),_0x9d3a('0x8b'),'attachments');return db[_0x9d3a('0x3e')][_0x9d3a('0x5a')]({'where':{'id':_0x460042[_0x9d3a('0x58')]['id']},'include':[{'model':db[_0x9d3a('0x8c')],'as':'Attachment'}]})[_0x9d3a('0x24')](handleEntityNotFound(_0x24b107,null))['then'](function(_0x52a7d2){if(_0x52a7d2){return _0x24b107[_0x9d3a('0x89')](path['join'](_0x37e71c,_0x52a7d2[_0x9d3a('0x8c')][_0x9d3a('0x88')]));}})[_0x9d3a('0x2d')](handleError(_0x24b107,null));}; \ No newline at end of file +var _0xfec0=['find','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','rejectmessage','CmContact','findOne','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','root','server','files','attachments','join','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxMessage.socket','register','client','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','index','map','FaxMessage','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','show','params','includeAll','body'];(function(_0x3806e6,_0x2f55d1){var _0x43aea8=function(_0x3c9928){while(--_0x3c9928){_0x3806e6['push'](_0x3806e6['shift']());}};_0x43aea8(++_0x2f55d1);}(_0xfec0,0x1df));var _0x0fec=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xfec0[_0x4709c0];return _0x13348b;};'use strict';var emlformat=require(_0x0fec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0fec('0x1'));var jsonpatch=require(_0x0fec('0x2'));var rp=require(_0x0fec('0x3'));var moment=require(_0x0fec('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0fec('0x5'));var util=require(_0x0fec('0x6'));var path=require(_0x0fec('0x7'));var sox=require(_0x0fec('0x8'));var csv=require(_0x0fec('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0fec('0xa'));var squel=require(_0x0fec('0xb'));var crypto=require('crypto');var jsforce=require(_0x0fec('0xc'));var deskjs=require(_0x0fec('0xd'));var toCsv=require(_0x0fec('0x9'));var querystring=require(_0x0fec('0xe'));var Papa=require(_0x0fec('0xf'));var Redis=require('ioredis');var authService=require(_0x0fec('0x10'));var qs=require(_0x0fec('0x11'));var as=require(_0x0fec('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fec('0x13'))(_0x0fec('0x14'));var utils=require(_0x0fec('0x15'));var config=require(_0x0fec('0x16'));var licenseUtil=require(_0x0fec('0x17'));var db=require(_0x0fec('0x18'))['db'];config[_0x0fec('0x19')]=_[_0x0fec('0x1a')](config[_0x0fec('0x19')],{'host':_0x0fec('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0fec('0x19')]));require(_0x0fec('0x1c'))[_0x0fec('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x0fec('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x0fec('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fafa1,_0x6a1566,_0x2b0497,_0x9845bb){return new BPromise(function(_0x5cfeee,_0x382b64){var _0x1458de=_0x9845bb||client;return _0x1458de[_0x0fec('0x1f')](_0x4fafa1,_0x2b0497)[_0x0fec('0x20')](function(_0x4a8e49){logger[_0x0fec('0x21')](_0x0fec('0x22'),_0x6a1566,_0x0fec('0x23'));logger['debug'](_0x0fec('0x24'),_0x6a1566,_0x0fec('0x23'),JSON['stringify'](_0x4a8e49));if(_0x4a8e49[_0x0fec('0x25')]){if(_0x4a8e49['error'][_0x0fec('0x26')]===0x1f4){logger[_0x0fec('0x25')](_0x0fec('0x22'),_0x6a1566,_0x4a8e49['error'][_0x0fec('0x27')]);return _0x382b64(_0x4a8e49[_0x0fec('0x25')][_0x0fec('0x27')]);}logger[_0x0fec('0x25')](_0x0fec('0x22'),_0x6a1566,_0x4a8e49[_0x0fec('0x25')][_0x0fec('0x27')]);return _0x5cfeee(_0x4a8e49[_0x0fec('0x25')][_0x0fec('0x27')]);}else{logger[_0x0fec('0x21')](_0x0fec('0x22'),_0x6a1566,'request\x20sent');_0x5cfeee(_0x4a8e49[_0x0fec('0x28')][_0x0fec('0x27')]);}})[_0x0fec('0x29')](function(_0x343503){logger[_0x0fec('0x25')](_0x0fec('0x22'),_0x6a1566,_0x343503);_0x382b64(_0x343503);});});}function respondWithStatusCode(_0xec6bb7,_0x443af4){_0x443af4=_0x443af4||0xcc;return function(_0x4252a8){if(_0x4252a8){return _0xec6bb7[_0x0fec('0x2a')](_0x443af4);}return _0xec6bb7[_0x0fec('0x2b')](_0x443af4)[_0x0fec('0x2c')]();};}function respondWithResult(_0x35e02c,_0xd9d07b){_0xd9d07b=_0xd9d07b||0xc8;return function(_0x5d36ee){if(_0x5d36ee){return _0x35e02c[_0x0fec('0x2b')](_0xd9d07b)[_0x0fec('0x2d')](_0x5d36ee);}};}function respondWithFilteredResult(_0x87ed23,_0x15f386){return function(_0x2e2b80){if(_0x2e2b80){var _0x13c4ba=typeof _0x15f386['offset']===_0x0fec('0x2e')&&typeof _0x15f386[_0x0fec('0x2f')]===_0x0fec('0x2e');var _0x3c5248=_0x2e2b80[_0x0fec('0x30')];var _0x4a9090=_0x13c4ba?0x0:_0x15f386[_0x0fec('0x31')];var _0x29b979=_0x13c4ba?_0x2e2b80[_0x0fec('0x30')]:_0x15f386[_0x0fec('0x31')]+_0x15f386[_0x0fec('0x2f')];var _0x419441;if(_0x29b979>=_0x3c5248){_0x29b979=_0x3c5248;_0x419441=0xc8;}else{_0x419441=0xce;}_0x87ed23['status'](_0x419441);return _0x87ed23[_0x0fec('0x32')](_0x0fec('0x33'),_0x4a9090+'-'+_0x29b979+'/'+_0x3c5248)['json'](_0x2e2b80);}return null;};}function patchUpdates(_0x29314b){return function(_0x5a9e04){try{jsonpatch[_0x0fec('0x34')](_0x5a9e04,_0x29314b,!![]);}catch(_0x3fa802){return BPromise[_0x0fec('0x35')](_0x3fa802);}return _0x5a9e04[_0x0fec('0x36')]();};}function saveUpdates(_0x29f53a,_0x56d437){return function(_0x53ff7b){if(_0x53ff7b){return _0x53ff7b[_0x0fec('0x37')](_0x29f53a)[_0x0fec('0x20')](function(_0xc6bb87){return _0xc6bb87;});}return null;};}function removeEntity(_0x3712c0,_0x2c2769){return function(_0x1cb370){if(_0x1cb370){return _0x1cb370[_0x0fec('0x38')]()[_0x0fec('0x20')](function(){_0x3712c0[_0x0fec('0x2b')](0xcc)[_0x0fec('0x2c')]();});}};}function handleEntityNotFound(_0x3a1161,_0x438d98){return function(_0x9a40a0){if(!_0x9a40a0){_0x3a1161[_0x0fec('0x2a')](0x194);}return _0x9a40a0;};}function handleError(_0x22c254,_0x4f8968){_0x4f8968=_0x4f8968||0x1f4;return function(_0x4bfd1e){logger[_0x0fec('0x25')](_0x4bfd1e['stack']);if(_0x4bfd1e['name']){delete _0x4bfd1e[_0x0fec('0x39')];}_0x22c254[_0x0fec('0x2b')](_0x4f8968)[_0x0fec('0x3a')](_0x4bfd1e);};}exports[_0x0fec('0x3b')]=function(_0x309192,_0x43eac6){var _0x330a3e={},_0x2cf6db={},_0x2c62b0={'count':0x0,'rows':[]};var _0x48423e=_[_0x0fec('0x3c')](db[_0x0fec('0x3d')][_0x0fec('0x3e')],function(_0x4bc406){return{'name':_0x4bc406['fieldName'],'type':_0x4bc406['type'][_0x0fec('0x3f')]};});_0x2cf6db[_0x0fec('0x40')]=_[_0x0fec('0x3c')](_0x48423e,_0x0fec('0x39'));_0x2cf6db[_0x0fec('0x41')]=_[_0x0fec('0x42')](_0x309192[_0x0fec('0x41')]);_0x2cf6db['filters']=_['intersection'](_0x2cf6db[_0x0fec('0x40')],_0x2cf6db[_0x0fec('0x41')]);_0x330a3e[_0x0fec('0x43')]=_[_0x0fec('0x44')](_0x2cf6db[_0x0fec('0x40')],qs[_0x0fec('0x45')](_0x309192[_0x0fec('0x41')]['fields']));_0x330a3e['attributes']=_0x330a3e[_0x0fec('0x43')][_0x0fec('0x46')]?_0x330a3e[_0x0fec('0x43')]:_0x2cf6db[_0x0fec('0x40')];if(!_0x309192[_0x0fec('0x41')]['hasOwnProperty'](_0x0fec('0x47'))){_0x330a3e[_0x0fec('0x2f')]=qs['limit'](_0x309192[_0x0fec('0x41')][_0x0fec('0x2f')]);_0x330a3e[_0x0fec('0x31')]=qs[_0x0fec('0x31')](_0x309192[_0x0fec('0x41')][_0x0fec('0x31')]);}_0x330a3e['order']=qs['sort'](_0x309192[_0x0fec('0x41')][_0x0fec('0x48')]);_0x330a3e[_0x0fec('0x49')]=qs['filters'](_[_0x0fec('0x4a')](_0x309192[_0x0fec('0x41')],_0x2cf6db[_0x0fec('0x4b')]),_0x48423e);if(_0x309192[_0x0fec('0x41')][_0x0fec('0x4c')]){_0x330a3e['where']=_[_0x0fec('0x4d')](_0x330a3e['where'],{'$or':_['map'](_0x48423e,function(_0x18405d){if(_0x18405d[_0x0fec('0x4e')]!==_0x0fec('0x4f')){var _0x3b4c05={};_0x3b4c05[_0x18405d['name']]={'$like':'%'+_0x309192[_0x0fec('0x41')][_0x0fec('0x4c')]+'%'};return _0x3b4c05;}})});}_0x330a3e=_[_0x0fec('0x4d')]({},_0x330a3e,_0x309192[_0x0fec('0x50')]);var _0x10a2d2={'where':_0x330a3e[_0x0fec('0x49')]};return db['FaxMessage']['count'](_0x10a2d2)[_0x0fec('0x20')](function(_0x2687a8){_0x2c62b0[_0x0fec('0x30')]=_0x2687a8;if(_0x309192[_0x0fec('0x41')]['includeAll']){_0x330a3e['include']=[{'all':!![]}];}return db[_0x0fec('0x3d')]['findAll'](_0x330a3e);})[_0x0fec('0x20')](function(_0x3fcdc4){_0x2c62b0['rows']=_0x3fcdc4;return _0x2c62b0;})[_0x0fec('0x20')](respondWithFilteredResult(_0x43eac6,_0x330a3e))[_0x0fec('0x29')](handleError(_0x43eac6,null));};exports[_0x0fec('0x51')]=function(_0x2a9474,_0x420bc4){var _0x44a787={'raw':!![],'where':{'id':_0x2a9474[_0x0fec('0x52')]['id']}},_0x1013df={};_0x1013df['model']=_[_0x0fec('0x42')](db[_0x0fec('0x3d')][_0x0fec('0x3e')]);_0x1013df[_0x0fec('0x41')]=_['keys'](_0x2a9474[_0x0fec('0x41')]);_0x1013df[_0x0fec('0x4b')]=_['intersection'](_0x1013df[_0x0fec('0x40')],_0x1013df[_0x0fec('0x41')]);_0x44a787[_0x0fec('0x43')]=_['intersection'](_0x1013df[_0x0fec('0x40')],qs[_0x0fec('0x45')](_0x2a9474['query'][_0x0fec('0x45')]));_0x44a787['attributes']=_0x44a787['attributes'][_0x0fec('0x46')]?_0x44a787[_0x0fec('0x43')]:_0x1013df[_0x0fec('0x40')];if(_0x2a9474[_0x0fec('0x41')][_0x0fec('0x53')]){_0x44a787['include']=[{'all':!![]}];}_0x44a787=_[_0x0fec('0x4d')]({},_0x44a787,_0x2a9474[_0x0fec('0x50')]);return db[_0x0fec('0x3d')]['find'](_0x44a787)[_0x0fec('0x20')](handleEntityNotFound(_0x420bc4,null))[_0x0fec('0x20')](respondWithResult(_0x420bc4,null))[_0x0fec('0x29')](handleError(_0x420bc4,null));};exports['update']=function(_0x173997,_0x1df69c){if(_0x173997['body']['id']){delete _0x173997[_0x0fec('0x54')]['id'];}return db['FaxMessage'][_0x0fec('0x55')]({'where':{'id':_0x173997[_0x0fec('0x52')]['id']}})[_0x0fec('0x20')](handleEntityNotFound(_0x1df69c,null))[_0x0fec('0x20')](saveUpdates(_0x173997[_0x0fec('0x54')],null))[_0x0fec('0x20')](respondWithResult(_0x1df69c,null))[_0x0fec('0x29')](handleError(_0x1df69c,null));};exports[_0x0fec('0x38')]=function(_0x2f8b43,_0x61b425){return db['FaxMessage'][_0x0fec('0x55')]({'where':{'id':_0x2f8b43[_0x0fec('0x52')]['id']}})[_0x0fec('0x20')](handleEntityNotFound(_0x61b425,null))['then'](removeEntity(_0x61b425,null))[_0x0fec('0x29')](handleError(_0x61b425,null));};exports[_0x0fec('0x56')]=function(_0xbe4300,_0xff84cf){return db['FaxMessage']['describe']()[_0x0fec('0x20')](respondWithResult(_0xff84cf,null))[_0x0fec('0x29')](handleError(_0xff84cf,null));};var interaction_log=require(_0x0fec('0x13'))(_0x0fec('0x57'));exports[_0x0fec('0x58')]=function(_0x2c9b8b,_0x3c7dec,_0x43cecb){var _0x18b78c={'agent':{},'channel':_0x0fec('0x59')};if(_0x2c9b8b[_0x0fec('0x54')]['id']){delete _0x2c9b8b[_0x0fec('0x54')]['id'];}_0x2c9b8b[_0x0fec('0x54')][_0x0fec('0x5a')]=!![];_0x2c9b8b[_0x0fec('0x54')][_0x0fec('0x5b')]=moment()[_0x0fec('0x5c')](_0x0fec('0x5d'));_0x2c9b8b[_0x0fec('0x54')][_0x0fec('0x5e')]=_0x2c9b8b[_0x0fec('0x54')][_0x0fec('0x5e')]||_0x2c9b8b[_0x0fec('0x5f')]['id'];_0x18b78c['agent']['id']=_0x2c9b8b[_0x0fec('0x54')][_0x0fec('0x5e')];return db[_0x0fec('0x3d')]['find']({'where':{'id':_0x2c9b8b[_0x0fec('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3c7dec,null))[_0x0fec('0x20')](saveUpdates(_0x2c9b8b[_0x0fec('0x54')],null))[_0x0fec('0x20')](function(_0x3d61c6){if(_0x3d61c6){_0x18b78c[_0x0fec('0x27')]=_0x3d61c6[_0x0fec('0x60')]({'plain':!![]});return db[_0x0fec('0x61')][_0x0fec('0x55')]({'where':{'id':_0x3d61c6[_0x0fec('0x62')]}});}return null;})[_0x0fec('0x20')](handleEntityNotFound(_0x3c7dec,null))[_0x0fec('0x20')](function(_0x5469df){if(_0x5469df){return _0x5469df[_0x0fec('0x37')]({'UserId':_0x2c9b8b[_0x0fec('0x54')][_0x0fec('0x5e')],'read1stAt':_[_0x0fec('0x63')](_0x5469df['read1stAt'])?moment()['format'](_0x0fec('0x5d')):undefined});}return null;})[_0x0fec('0x20')](function(_0x277021){if(_0x277021){_0x18b78c[_0x0fec('0x64')]=_0x277021[_0x0fec('0x60')]({'plain':!![]});interaction_log['info'](_0x0fec('0x65'),_0x2c9b8b[_0x0fec('0x5f')]['id'],_0x2c9b8b[_0x0fec('0x5f')][_0x0fec('0x39')],_0x2c9b8b[_0x0fec('0x5f')][_0x0fec('0x66')],_0x18b78c['interaction']['id'],_0x2c9b8b[_0x0fec('0x54')]?JSON['stringify'](_0x2c9b8b[_0x0fec('0x54')]):'null');return respondWithRpcPromise(_0x0fec('0x67'),_0x0fec('0x68'),_0x18b78c);}return null;})['then'](function(_0x5a7923){var _0x1bed73='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5a7923[_0x0fec('0x27')][_0x0fec('0x69')];return db['sequelize'][_0x0fec('0x41')](_0x1bed73,{'type':db[_0x0fec('0x6a')][_0x0fec('0x6b')][_0x0fec('0x6c')],'raw':!![]})[_0x0fec('0x20')](function(_0x238181){return _0x238181;});})['then'](function(_0x92b62b){if(_0x92b62b){_0x18b78c[_0x0fec('0x27')][_0x0fec('0x6d')]=_0x92b62b[0x0];if(!_0x2c9b8b['body']['UserId'])return;return db[_0x0fec('0x6e')][_0x0fec('0x55')]({'where':{'id':_0x2c9b8b[_0x0fec('0x54')][_0x0fec('0x5e')],'role':_0x0fec('0x6f')},'attributes':['id',_0x0fec('0x39'),_0x0fec('0x70'),_0x0fec('0x71'),_0x0fec('0x72')],'raw':!![]});}return null;})[_0x0fec('0x20')](function(_0x459530){if(!_0x459530)return null;_0x18b78c[_0x0fec('0x27')][_0x0fec('0x6f')]=_0x459530;return _0x18b78c;})[_0x0fec('0x20')](function(_0xd8c542){if(_0xd8c542){if(_0x2c9b8b[_0x0fec('0x54')][_0x0fec('0x73')]){_0x18b78c[_0x0fec('0x27')][_0x0fec('0x74')]=util[_0x0fec('0x5c')](_0x0fec('0x75'),_0x2c9b8b[_0x0fec('0x5f')][_0x0fec('0x39')]);_0x18b78c['message']['channel']=_0x18b78c[_0x0fec('0x76')];_0x18b78c[_0x0fec('0x27')][_0x0fec('0x77')]=_0x18b78c['channel'];_0x18b78c[_0x0fec('0x27')][_0x0fec('0x78')]=_0x0fec('0x58');return respondWithRpcPromise(_0x0fec('0x79'),_0x0fec('0x79'),{'event':_0x0fec('0x7a'),'message':_0x18b78c[_0x0fec('0x27')]},client9002)[_0x0fec('0x20')](function(){return _0x18b78c;});}return _0x18b78c;}return null;})[_0x0fec('0x20')](respondWithResult(_0x3c7dec,null))[_0x0fec('0x29')](handleError(_0x3c7dec,null));};var interaction_log=require(_0x0fec('0x13'))('fax-interactions');exports[_0x0fec('0x35')]=function(_0x2f22d1,_0x516244,_0x550e7f){var _0x54942b={'agent':{},'channel':_0x0fec('0x59')};if(_0x2f22d1[_0x0fec('0x54')]['id']){delete _0x2f22d1[_0x0fec('0x54')]['id'];}_0x2f22d1['body'][_0x0fec('0x5e')]=_0x2f22d1['body'][_0x0fec('0x5e')]||_0x2f22d1['user']['id'];_0x54942b[_0x0fec('0x6f')]['id']=_0x2f22d1['body']['UserId'];return db[_0x0fec('0x3d')]['find']({'where':{'id':_0x2f22d1[_0x0fec('0x52')]['id'],'UserId':null}})[_0x0fec('0x20')](handleEntityNotFound(_0x516244,null))[_0x0fec('0x20')](function(_0xcdf504){if(_0xcdf504){_0x54942b[_0x0fec('0x27')]=_0xcdf504['get']({'plain':!![]});return db[_0x0fec('0x61')][_0x0fec('0x55')]({'where':{'id':_0xcdf504[_0x0fec('0x62')]}});}return null;})[_0x0fec('0x20')](handleEntityNotFound(_0x516244,null))[_0x0fec('0x20')](function(_0xf37e5a){if(_0xf37e5a){_0x54942b[_0x0fec('0x64')]=_0xf37e5a[_0x0fec('0x60')]({'plain':!![]});interaction_log['info'](_0x0fec('0x7b'),_0x2f22d1[_0x0fec('0x5f')]['id'],_0x2f22d1[_0x0fec('0x5f')][_0x0fec('0x39')],_0x2f22d1[_0x0fec('0x5f')][_0x0fec('0x66')],_0x54942b[_0x0fec('0x64')]['id'],_0x2f22d1[_0x0fec('0x54')]?JSON[_0x0fec('0x7c')](_0x2f22d1[_0x0fec('0x54')]):'null');return respondWithRpcPromise(_0x0fec('0x7d'),'rejectMessage',_0x54942b);}return null;})['then'](function(_0x483268){var _0x17079f=_0x0fec('0x7e')+_0x483268['message'][_0x0fec('0x69')];return db['sequelize'][_0x0fec('0x41')](_0x17079f,{'type':db[_0x0fec('0x6a')]['QueryTypes'][_0x0fec('0x6c')],'raw':!![]})[_0x0fec('0x20')](function(_0x11c000){return _0x11c000;});})[_0x0fec('0x20')](function(_0x42094f){if(_0x42094f){_0x54942b['message'][_0x0fec('0x6d')]=_0x42094f[0x0];if(!_0x2f22d1[_0x0fec('0x54')][_0x0fec('0x5e')])return;return db[_0x0fec('0x6e')][_0x0fec('0x55')]({'where':{'id':_0x2f22d1[_0x0fec('0x54')][_0x0fec('0x5e')],'role':'agent'},'attributes':['id',_0x0fec('0x39'),_0x0fec('0x70'),_0x0fec('0x71'),'internal'],'raw':!![]});}return null;})[_0x0fec('0x20')](function(_0x431591){if(!_0x431591)return null;_0x54942b[_0x0fec('0x27')]['agent']=_0x431591;return _0x54942b;})[_0x0fec('0x20')](function(_0x356349){if(_0x356349){_0x356349[_0x0fec('0x27')][_0x0fec('0x74')]=util[_0x0fec('0x5c')](_0x0fec('0x75'),_0x2f22d1[_0x0fec('0x5f')][_0x0fec('0x39')]);_0x356349[_0x0fec('0x27')]['channel']=_0x54942b[_0x0fec('0x76')];_0x356349[_0x0fec('0x27')][_0x0fec('0x77')]=_0x54942b[_0x0fec('0x76')];_0x356349[_0x0fec('0x27')][_0x0fec('0x78')]='reject';respondWithRpcPromise(_0x0fec('0x79'),_0x0fec('0x79'),{'event':_0x0fec('0x7f'),'message':_0x356349[_0x0fec('0x27')]},client9002);return _0x54942b;}return null;})[_0x0fec('0x20')](respondWithResult(_0x516244,null))[_0x0fec('0x29')](handleError(_0x516244,null));};exports['create']=function(_0x4fcfee,_0x5ab99a){var _0x4fd9fd;return db['FaxMessage']['create'](_0x4fcfee[_0x0fec('0x54')],{})['then'](function(_0x43b3c3){_0x4fd9fd=_0x43b3c3;return db[_0x0fec('0x80')][_0x0fec('0x81')]({'where':{'id':_0x4fd9fd[_0x0fec('0x69')]}});})[_0x0fec('0x20')](function(_0x556377){if(_[_0x0fec('0x63')](_0x556377)){return;}else{_0x4fd9fd[_0x0fec('0x59')]=_0x556377[_0x0fec('0x59')];return db[_0x0fec('0x82')][_0x0fec('0x81')]({'where':{'id':_0x4fd9fd[_0x0fec('0x83')]}});}})[_0x0fec('0x20')](function(_0x5267a1){return respondWithRpcPromise(_0x0fec('0x84'),'SendFax',{'FaxAccountId':_['isNil'](_0x4fcfee[_0x0fec('0x54')])?undefined:_0x4fcfee['body']['FaxAccountId'],'path':_['isNil'](_0x5267a1)?undefined:util[_0x0fec('0x5c')](_0x0fec('0x85'),_0x5267a1[_0x0fec('0x86')]),'fax':_[_0x0fec('0x63')](_0x4fd9fd[_0x0fec('0x59')])?undefined:_0x4fd9fd[_0x0fec('0x59')],'AttachmentId':_0x4fd9fd['AttachmentId']},client9002);})[_0x0fec('0x20')](respondWithResult(_0x5ab99a,0xc9))['catch'](handleError(_0x5ab99a,null));};exports[_0x0fec('0x87')]=function(_0x31589c,_0x197919){var _0x142caa=path['join'](config[_0x0fec('0x88')],_0x0fec('0x89'),_0x0fec('0x8a'),_0x0fec('0x8b'));return db[_0x0fec('0x3d')]['find']({'where':{'id':_0x31589c['params']['id']},'include':[{'model':db[_0x0fec('0x82')],'as':'Attachment'}]})[_0x0fec('0x20')](handleEntityNotFound(_0x197919,null))['then'](function(_0x52e2c2){if(_0x52e2c2){return _0x197919[_0x0fec('0x87')](path[_0x0fec('0x8c')](_0x142caa,_0x52e2c2[_0x0fec('0x82')]['basename']));}})['catch'](handleError(_0x197919,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 424c68b..66aaa1b 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 _0x0424=['exports','FaxMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x3166e4,_0x1bd8cd){var _0x438265=function(_0x2dde13){while(--_0x2dde13){_0x3166e4['push'](_0x3166e4['shift']());}};_0x438265(++_0x1bd8cd);}(_0x0424,0x159));var _0x4042=function(_0x43709e,_0x2c3b45){_0x43709e=_0x43709e-0x0;var _0x452820=_0x0424[_0x43709e];return _0x452820;};'use strict';var EventEmitter=require('events');var FaxMessage=require('../../mysqldb')['db'][_0x4042('0x0')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x4042('0x1')](0x0);var events={'afterCreate':_0x4042('0x2'),'afterUpdate':_0x4042('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3cd879){return function(_0x519987,_0x491eae,_0x20d8df){FaxMessageEvents[_0x4042('0x4')](_0x3cd879+':'+_0x519987['id'],_0x519987);FaxMessageEvents[_0x4042('0x4')](_0x3cd879,_0x519987);_0x20d8df(null);};}for(var e in events){if(events[_0x4042('0x5')](e)){var event=events[e];FaxMessage[_0x4042('0x6')](e,emitEvent(event));}}module[_0x4042('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x806b=['update','remove','emit','hook','exports','events','../../mysqldb','FaxMessage','setMaxListeners','save'];(function(_0x58956e,_0x298fb6){var _0x2966ec=function(_0x5d4a49){while(--_0x5d4a49){_0x58956e['push'](_0x58956e['shift']());}};_0x2966ec(++_0x298fb6);}(_0x806b,0x163));var _0xb806=function(_0x46f617,_0x247085){_0x46f617=_0x46f617-0x0;var _0xd46acb=_0x806b[_0x46f617];return _0xd46acb;};'use strict';var EventEmitter=require(_0xb806('0x0'));var FaxMessage=require(_0xb806('0x1'))['db'][_0xb806('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xb806('0x3')](0x0);var events={'afterCreate':_0xb806('0x4'),'afterUpdate':_0xb806('0x5'),'afterDestroy':_0xb806('0x6')};function emitEvent(_0x2cbd26){return function(_0x595117,_0x32c93c,_0x2ddaa3){FaxMessageEvents[_0xb806('0x7')](_0x2cbd26+':'+_0x595117['id'],_0x595117);FaxMessageEvents[_0xb806('0x7')](_0x2cbd26,_0x595117);_0x2ddaa3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0xb806('0x8')](e,emitEvent(event));}}module[_0xb806('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index ffeb767..996432d 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 _0x4105=['./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','isNil','UserId','findOne','FaxInteractionId','update','createdAt','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x2650e9,_0xb91cc){var _0x3511c8=function(_0x5069cf){while(--_0x5069cf){_0x2650e9['push'](_0x2650e9['shift']());}};_0x3511c8(++_0xb91cc);}(_0x4105,0xc9));var _0x5410=function(_0x4c57f7,_0x2ea228){_0x4c57f7=_0x4c57f7-0x0;var _0x3e2da4=_0x4105[_0x4c57f7];return _0x3e2da4;};'use strict';var _=require(_0x5410('0x0'));var util=require(_0x5410('0x1'));var logger=require(_0x5410('0x2'))('api');var moment=require(_0x5410('0x3'));var BPromise=require('bluebird');var rp=require(_0x5410('0x4'));var fs=require('fs');var path=require(_0x5410('0x5'));var rimraf=require('rimraf');var config=require(_0x5410('0x6'));var attributes=require(_0x5410('0x7'));module[_0x5410('0x8')]=function(_0x1c0348,_0x339b69){return _0x1c0348[_0x5410('0x9')](_0x5410('0xa'),attributes,{'tableName':_0x5410('0xb'),'paranoid':![],'indexes':[{'name':_0x5410('0xc'),'fields':[_0x5410('0xd')],'type':_0x5410('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x409246,_0xbf504b,_0x40b403){var _0xd1ef8=_0x1c0348[_0x5410('0xf')];var _0x5c3d39=_0x409246['get']({'plain':!![]});if(_0x5c3d39[_0x5410('0x10')][_0x5410('0x11')]()==='in'||_0x5c3d39[_0x5410('0x10')][_0x5410('0x11')]()==='out'&&!_0x5c3d39['secret']&&!_[_0x5410('0x12')](_0x5c3d39[_0x5410('0x13')])){_0xd1ef8['FaxInteraction'][_0x5410('0x14')]({'where':{'id':_0x5c3d39[_0x5410('0x15')]}})['then'](function(_0x3c7366){if(_0x3c7366){_0x3c7366[_0x5410('0x16')]({'lastMsgAt':_0x5c3d39[_0x5410('0x17')],'lastMsgDirection':_0x5c3d39[_0x5410('0x10')][_0x5410('0x11')]()});}})['catch'](function(_0xa72d7){console[_0x5410('0x18')](_0xa72d7);});}_0x40b403();}},'charset':'utf8mb4','collate':_0x5410('0x19')});}; \ No newline at end of file +var _0x77d9=['request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','FaxInteractionId','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x77d9,0xd5));var _0x977d=function(_0x5ec9db,_0x4f051e){_0x5ec9db=_0x5ec9db-0x0;var _0xfc7061=_0x77d9[_0x5ec9db];return _0xfc7061;};'use strict';var _=require(_0x977d('0x0'));var util=require(_0x977d('0x1'));var logger=require(_0x977d('0x2'))('api');var moment=require(_0x977d('0x3'));var BPromise=require('bluebird');var rp=require(_0x977d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x977d('0x5'));var config=require(_0x977d('0x6'));var attributes=require(_0x977d('0x7'));module[_0x977d('0x8')]=function(_0x125b3a,_0x143d6b){return _0x125b3a[_0x977d('0x9')](_0x977d('0xa'),attributes,{'tableName':_0x977d('0xb'),'paranoid':![],'indexes':[{'name':_0x977d('0xc'),'fields':[_0x977d('0xd')],'type':_0x977d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x354c2c,_0x42318f,_0x323634){var _0x3b8a6d=_0x125b3a[_0x977d('0xf')];var _0x57dc02=_0x354c2c[_0x977d('0x10')]({'plain':!![]});if(_0x57dc02[_0x977d('0x11')][_0x977d('0x12')]()==='in'||_0x57dc02[_0x977d('0x11')][_0x977d('0x12')]()===_0x977d('0x13')&&!_0x57dc02[_0x977d('0x14')]&&!_[_0x977d('0x15')](_0x57dc02[_0x977d('0x16')])){_0x3b8a6d['FaxInteraction'][_0x977d('0x17')]({'where':{'id':_0x57dc02[_0x977d('0x18')]}})['then'](function(_0x4f53ce){if(_0x4f53ce){_0x4f53ce[_0x977d('0x19')]({'lastMsgAt':_0x57dc02[_0x977d('0x1a')],'lastMsgDirection':_0x57dc02[_0x977d('0x11')][_0x977d('0x12')]()});}})[_0x977d('0x1b')](function(_0x39a8a5){console[_0x977d('0x1c')](_0x39a8a5);});}_0x323634();}},'charset':_0x977d('0x1d'),'collate':_0x977d('0x1e')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index c5591fa..1f90fbf 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 _0x7bae=['request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxMessage,\x20%s,\x20%s','create','body','options','raw','CreateFaxMessage','debug','FaxMessage','update','where','limit','UpdateFaxMessage','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','request','then','info'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7bae,0x13b));var _0xe7ba=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x7bae[_0x15bc81];return _0x59440e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7ba('0x0'));var BPromise=require(_0xe7ba('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7ba('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe7ba('0x3'));var logger=require(_0xe7ba('0x4'))(_0xe7ba('0x5'));var config=require(_0xe7ba('0x6'));var jayson=require(_0xe7ba('0x7'));var client=jayson[_0xe7ba('0x8')][_0xe7ba('0x9')]({'port':0x232a});config[_0xe7ba('0xa')]=_[_0xe7ba('0xb')](config[_0xe7ba('0xa')],{'host':_0xe7ba('0xc'),'port':0x18eb});var socket=require(_0xe7ba('0xd'))(new Redis(config[_0xe7ba('0xa')]));require(_0xe7ba('0xe'))['register'](socket);function respondWithRpcPromise(_0x3df8bf,_0xe57e33,_0x375ebb){return new BPromise(function(_0x276bc3,_0x15083a){return client[_0xe7ba('0xf')](_0x3df8bf,_0x375ebb)[_0xe7ba('0x10')](function(_0x448bcc){logger[_0xe7ba('0x11')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0xe7ba('0x12'));logger['debug'](_0xe7ba('0x13'),_0xe57e33,_0xe7ba('0x12'),JSON[_0xe7ba('0x14')](_0x448bcc));if(_0x448bcc[_0xe7ba('0x15')]){if(_0x448bcc[_0xe7ba('0x15')][_0xe7ba('0x16')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0x448bcc[_0xe7ba('0x15')][_0xe7ba('0x17')]);return _0x15083a(_0x448bcc[_0xe7ba('0x15')]['message']);}logger[_0xe7ba('0x15')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,_0x448bcc['error']['message']);return _0x276bc3(_0x448bcc[_0xe7ba('0x15')]['message']);}else{logger[_0xe7ba('0x11')]('FaxMessage,\x20%s,\x20%s',_0xe57e33,'request\x20sent');_0x276bc3(_0x448bcc['result'][_0xe7ba('0x17')]);}})[_0xe7ba('0x18')](function(_0x39ca38){logger[_0xe7ba('0x15')](_0xe7ba('0x19'),_0xe57e33,_0x39ca38);_0x15083a(_0x39ca38);});});}exports['CreateFaxMessage']=function(_0x149c62){var _0x20c653=this;return new Promise(function(_0x3b40fb,_0x136ec6){return db['FaxMessage'][_0xe7ba('0x1a')](_0x149c62[_0xe7ba('0x1b')],{'raw':_0x149c62['options']?_0x149c62[_0xe7ba('0x1c')][_0xe7ba('0x1d')]===undefined?!![]:![]:!![]})[_0xe7ba('0x10')](function(_0x7ab9e4){logger[_0xe7ba('0x11')](_0xe7ba('0x1e'),_0x149c62);logger[_0xe7ba('0x1f')](_0xe7ba('0x1e'),_0x149c62,JSON[_0xe7ba('0x14')](_0x7ab9e4));_0x3b40fb(_0x7ab9e4);})[_0xe7ba('0x18')](function(_0x58cf43){logger['error']('CreateFaxMessage',_0x58cf43['message'],_0x149c62);_0x136ec6(_0x20c653[_0xe7ba('0x15')](0x1f4,_0x58cf43['message']));});});};exports['UpdateFaxMessage']=function(_0x5ece11){var _0x255def=this;return new Promise(function(_0x32cc00,_0xe32862){return db[_0xe7ba('0x20')][_0xe7ba('0x21')](_0x5ece11[_0xe7ba('0x1b')],{'raw':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11[_0xe7ba('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11['options'][_0xe7ba('0x22')]||null:null,'attributes':_0x5ece11[_0xe7ba('0x1c')]?_0x5ece11[_0xe7ba('0x1c')]['attributes']||null:null,'limit':_0x5ece11['options']?_0x5ece11[_0xe7ba('0x1c')][_0xe7ba('0x23')]||null:null})[_0xe7ba('0x10')](function(_0x20b6cd){logger[_0xe7ba('0x11')]('UpdateFaxMessage',_0x5ece11);logger[_0xe7ba('0x1f')](_0xe7ba('0x24'),_0x5ece11,JSON['stringify'](_0x20b6cd));_0x32cc00(_0x20b6cd);})[_0xe7ba('0x18')](function(_0x530227){logger['error'](_0xe7ba('0x24'),_0x530227[_0xe7ba('0x17')],_0x5ece11);_0xe32862(_0x255def[_0xe7ba('0x15')](0x1f4,_0x530227['message']));});});}; \ No newline at end of file +var _0x17ba=['CreateFaxMessage','FaxMessage','create','options','raw','info','UpdateFaxMessage','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x4e4a7b,_0x411ed3){var _0x292f4c=function(_0xf3024f){while(--_0xf3024f){_0x4e4a7b['push'](_0x4e4a7b['shift']());}};_0x292f4c(++_0x411ed3);}(_0x17ba,0xab));var _0xa17b=function(_0x37cad6,_0x174451){_0x37cad6=_0x37cad6-0x0;var _0x347c9d=_0x17ba[_0x37cad6];return _0x347c9d;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var moment=require('moment');var BPromise=require(_0xa17b('0x2'));var rs=require(_0xa17b('0x3'));var fs=require('fs');var Redis=require(_0xa17b('0x4'));var db=require(_0xa17b('0x5'))['db'];var utils=require(_0xa17b('0x6'));var logger=require(_0xa17b('0x7'))(_0xa17b('0x8'));var config=require(_0xa17b('0x9'));var jayson=require(_0xa17b('0xa'));var client=jayson[_0xa17b('0xb')][_0xa17b('0xc')]({'port':0x232a});config[_0xa17b('0xd')]=_[_0xa17b('0xe')](config[_0xa17b('0xd')],{'host':_0xa17b('0xf'),'port':0x18eb});var socket=require(_0xa17b('0x10'))(new Redis(config[_0xa17b('0xd')]));require(_0xa17b('0x11'))[_0xa17b('0x12')](socket);function respondWithRpcPromise(_0x578799,_0x2556c4,_0x38b8f1){return new BPromise(function(_0x322dc0,_0x1e799a){return client[_0xa17b('0x13')](_0x578799,_0x38b8f1)[_0xa17b('0x14')](function(_0xc5ef2e){logger['info'](_0xa17b('0x15'),_0x2556c4,_0xa17b('0x16'));logger[_0xa17b('0x17')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2556c4,_0xa17b('0x16'),JSON[_0xa17b('0x18')](_0xc5ef2e));if(_0xc5ef2e[_0xa17b('0x19')]){if(_0xc5ef2e[_0xa17b('0x19')]['code']===0x1f4){logger[_0xa17b('0x19')]('FaxMessage,\x20%s,\x20%s',_0x2556c4,_0xc5ef2e[_0xa17b('0x19')][_0xa17b('0x1a')]);return _0x1e799a(_0xc5ef2e['error'][_0xa17b('0x1a')]);}logger[_0xa17b('0x19')](_0xa17b('0x15'),_0x2556c4,_0xc5ef2e[_0xa17b('0x19')]['message']);return _0x322dc0(_0xc5ef2e[_0xa17b('0x19')]['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x2556c4,_0xa17b('0x16'));_0x322dc0(_0xc5ef2e[_0xa17b('0x1b')]['message']);}})[_0xa17b('0x1c')](function(_0x166d44){logger[_0xa17b('0x19')](_0xa17b('0x15'),_0x2556c4,_0x166d44);_0x1e799a(_0x166d44);});});}exports[_0xa17b('0x1d')]=function(_0x1ecaa2){var _0x24afc2=this;return new Promise(function(_0x584a0a,_0x610c2b){return db[_0xa17b('0x1e')][_0xa17b('0x1f')](_0x1ecaa2['body'],{'raw':_0x1ecaa2[_0xa17b('0x20')]?_0x1ecaa2[_0xa17b('0x20')][_0xa17b('0x21')]===undefined?!![]:![]:!![]})[_0xa17b('0x14')](function(_0x3c7ec2){logger[_0xa17b('0x22')]('CreateFaxMessage',_0x1ecaa2);logger[_0xa17b('0x17')]('CreateFaxMessage',_0x1ecaa2,JSON[_0xa17b('0x18')](_0x3c7ec2));_0x584a0a(_0x3c7ec2);})[_0xa17b('0x1c')](function(_0x4ba608){logger['error'](_0xa17b('0x1d'),_0x4ba608[_0xa17b('0x1a')],_0x1ecaa2);_0x610c2b(_0x24afc2[_0xa17b('0x19')](0x1f4,_0x4ba608[_0xa17b('0x1a')]));});});};exports[_0xa17b('0x23')]=function(_0x3a64f5){var _0x4cd38e=this;return new Promise(function(_0x47aff8,_0x5c98fe){return db['FaxMessage'][_0xa17b('0x24')](_0x3a64f5['body'],{'raw':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5['options'][_0xa17b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5[_0xa17b('0x20')][_0xa17b('0x25')]||null:null,'attributes':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5[_0xa17b('0x20')][_0xa17b('0x26')]||null:null,'limit':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5[_0xa17b('0x20')][_0xa17b('0x27')]||null:null})[_0xa17b('0x14')](function(_0x573585){logger['info']('UpdateFaxMessage',_0x3a64f5);logger[_0xa17b('0x17')](_0xa17b('0x23'),_0x3a64f5,JSON[_0xa17b('0x18')](_0x573585));_0x47aff8(_0x573585);})[_0xa17b('0x1c')](function(_0x16dd1f){logger[_0xa17b('0x19')](_0xa17b('0x23'),_0x16dd1f[_0xa17b('0x1a')],_0x3a64f5);_0x5c98fe(_0x4cd38e['error'](0x1f4,_0x16dd1f[_0xa17b('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 26f9f33..e66316a 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 _0x79c1=['save','remove','update','emit','removeListener','register','faxMessage:','./faxMessage.events'];(function(_0x4a7cbc,_0x555ea3){var _0x401e22=function(_0x30b6ab){while(--_0x30b6ab){_0x4a7cbc['push'](_0x4a7cbc['shift']());}};_0x401e22(++_0x555ea3);}(_0x79c1,0x13f));var _0x179c=function(_0x3e9266,_0xf51328){_0x3e9266=_0x3e9266-0x0;var _0x18b80c=_0x79c1[_0x3e9266];return _0x18b80c;};'use strict';var FaxMessageEvents=require(_0x179c('0x0'));var events=[_0x179c('0x1'),_0x179c('0x2'),_0x179c('0x3')];function createListener(_0x552ab4,_0x880f1a){return function(_0x57dbc2){_0x880f1a[_0x179c('0x4')](_0x552ab4,_0x57dbc2);};}function removeListener(_0x5e7f6f,_0x1013b6){return function(){FaxMessageEvents[_0x179c('0x5')](_0x5e7f6f,_0x1013b6);};}exports[_0x179c('0x6')]=function(_0x1a25da){for(var _0x4c27e0=0x0,_0x152b0a=events['length'];_0x4c27e0<_0x152b0a;_0x4c27e0++){var _0xde7eec=events[_0x4c27e0];var _0x33d280=createListener(_0x179c('0x7')+_0xde7eec,_0x1a25da);FaxMessageEvents['on'](_0xde7eec,_0x33d280);}}; \ No newline at end of file +var _0x3045=['./faxMessage.events','save','remove','emit','removeListener','register','length','faxMessage:'];(function(_0xe98e39,_0x5d2206){var _0x1c1a97=function(_0x378c3a){while(--_0x378c3a){_0xe98e39['push'](_0xe98e39['shift']());}};_0x1c1a97(++_0x5d2206);}(_0x3045,0x148));var _0x5304=function(_0xedb476,_0x3612e5){_0xedb476=_0xedb476-0x0;var _0x4d1897=_0x3045[_0xedb476];return _0x4d1897;};'use strict';var FaxMessageEvents=require(_0x5304('0x0'));var events=[_0x5304('0x1'),_0x5304('0x2'),'update'];function createListener(_0x4ecaa0,_0x5400f1){return function(_0x525a72){_0x5400f1[_0x5304('0x3')](_0x4ecaa0,_0x525a72);};}function removeListener(_0x3d8f59,_0x177154){return function(){FaxMessageEvents[_0x5304('0x4')](_0x3d8f59,_0x177154);};}exports[_0x5304('0x5')]=function(_0xa82561){for(var _0x144279=0x0,_0x3e1df9=events[_0x5304('0x6')];_0x144279<_0x3e1df9;_0x144279++){var _0x452210=events[_0x144279];var _0x11bb9e=createListener(_0x5304('0x7')+_0x452210,_0xa82561);FaxMessageEvents['on'](_0x452210,_0x11bb9e);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 2665bb5..a917efb 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 _0x668b=['create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./faxMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x668b,0x140));var _0xb668=function(_0x480bc8,_0x1fac40){_0x480bc8=_0x480bc8-0x0;var _0x28c245=_0x668b[_0x480bc8];return _0x28c245;};'use strict';var multer=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var path=require('path');var timeout=require(_0xb668('0x2'));var express=require(_0xb668('0x3'));var router=express['Router']();var fs_extra=require(_0xb668('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var controller=require(_0xb668('0x7'));router['get']('/',auth[_0xb668('0x8')](),controller[_0xb668('0x9')]);router[_0xb668('0xa')](_0xb668('0xb'),auth[_0xb668('0x8')](),controller[_0xb668('0xc')]);router['get'](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0xe')]);router[_0xb668('0xa')](_0xb668('0xf'),auth[_0xb668('0x8')](),controller[_0xb668('0x10')]);router[_0xb668('0x11')]('/',auth['isAuthenticated'](),interaction[_0xb668('0x12')](_0xb668('0x13'),_0xb668('0x14')),controller[_0xb668('0x15')]);router[_0xb668('0x16')](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0x17')]);router[_0xb668('0x16')](_0xb668('0x18'),auth[_0xb668('0x8')](),controller[_0xb668('0x19')]);router[_0xb668('0x16')](_0xb668('0x1a'),auth[_0xb668('0x8')](),controller[_0xb668('0x1b')]);router[_0xb668('0x1c')](_0xb668('0xd'),auth[_0xb668('0x8')](),controller[_0xb668('0x1d')]);module[_0xb668('0x1e')]=router; \ No newline at end of file +var _0x3667=['/describe','describe','/:id','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index'];(function(_0x59c6bd,_0x4387f0){var _0x43ded4=function(_0xe89da6){while(--_0xe89da6){_0x59c6bd['push'](_0x59c6bd['shift']());}};_0x43ded4(++_0x4387f0);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var path=require(_0x7366('0x2'));var timeout=require(_0x7366('0x3'));var express=require(_0x7366('0x4'));var router=express['Router']();var fs_extra=require(_0x7366('0x5'));var auth=require(_0x7366('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7366('0x7'));var controller=require(_0x7366('0x8'));router[_0x7366('0x9')]('/',auth[_0x7366('0xa')](),controller[_0x7366('0xb')]);router['get'](_0x7366('0xc'),auth[_0x7366('0xa')](),controller[_0x7366('0xd')]);router[_0x7366('0x9')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller[_0x7366('0xf')]);router[_0x7366('0x9')](_0x7366('0x10'),auth[_0x7366('0xa')](),controller[_0x7366('0x11')]);router[_0x7366('0x12')]('/',auth[_0x7366('0xa')](),interaction[_0x7366('0x13')](_0x7366('0x14'),_0x7366('0x15')),controller[_0x7366('0x16')]);router[_0x7366('0x17')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller[_0x7366('0x18')]);router[_0x7366('0x17')](_0x7366('0x19'),auth[_0x7366('0xa')](),controller[_0x7366('0x1a')]);router[_0x7366('0x17')](_0x7366('0x1b'),auth[_0x7366('0xa')](),controller['reject']);router[_0x7366('0x1c')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller[_0x7366('0x1d')]);module[_0x7366('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 9a8defa..fd538d6 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 _0x6cb2=['rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x17e6b2,_0xb25987){var _0x4c500b=function(_0x2a2e90){while(--_0x2a2e90){_0x17e6b2['push'](_0x17e6b2['shift']());}};_0x4c500b(++_0xb25987);}(_0x6cb2,0xfa));var _0x26cb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x6cb2[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0x26cb('0x0'));module[_0x26cb('0x1')]={'name':{'type':Sequelize[_0x26cb('0x2')],'unique':_0x26cb('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x26cb('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x26cb('0x5')](_0x26cb('0x6'),'beepall',_0x26cb('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x26cb('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x084d=['beepall','roundrobin','INTEGER','sequelize','exports','STRING','name','ENUM','rrmemory'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x084d,0x147));var _0xd084=function(_0x1a5e18,_0x203b00){_0x1a5e18=_0x1a5e18-0x0;var _0x25460f=_0x084d[_0x1a5e18];return _0x25460f;};'use strict';var Sequelize=require(_0xd084('0x0'));module[_0xd084('0x1')]={'name':{'type':Sequelize[_0xd084('0x2')],'unique':_0xd084('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd084('0x4')](_0xd084('0x5'),_0xd084('0x6'),_0xd084('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xd084('0x8')],'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 6e375fc..457b4e2 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 _0x4cdb=['index','map','FaxQueue','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','findAll','rows','catch','show','params','includeAll','include','options','find','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','error','body','describe','getMembers','findOne','UserFaxQueue','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','addTeams','ids','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','Team','select','field','tq.TeamId','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','FaxQueues','UserProfileResource','name','send'];(function(_0x1d2054,_0x3ba7cc){var _0x4e0173=function(_0x131e86){while(--_0x131e86){_0x1d2054['push'](_0x1d2054['shift']());}};_0x4e0173(++_0x3ba7cc);}(_0x4cdb,0xee));var _0xb4cd=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x4cdb[_0x1f36bb];return _0xaf97fa;};'use strict';var emlformat=require(_0xb4cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb4cd('0x1'));var jsonpatch=require(_0xb4cd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb4cd('0x3'));var Mustache=require(_0xb4cd('0x4'));var util=require(_0xb4cd('0x5'));var path=require(_0xb4cd('0x6'));var sox=require(_0xb4cd('0x7'));var csv=require(_0xb4cd('0x8'));var ejs=require(_0xb4cd('0x9'));var fs=require('fs');var fs_extra=require(_0xb4cd('0xa'));var _=require(_0xb4cd('0xb'));var squel=require(_0xb4cd('0xc'));var crypto=require('crypto');var jsforce=require(_0xb4cd('0xd'));var deskjs=require(_0xb4cd('0xe'));var toCsv=require(_0xb4cd('0x8'));var querystring=require('querystring');var Papa=require(_0xb4cd('0xf'));var Redis=require(_0xb4cd('0x10'));var authService=require(_0xb4cd('0x11'));var qs=require(_0xb4cd('0x12'));var as=require(_0xb4cd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb4cd('0x14'))(_0xb4cd('0x15'));var utils=require(_0xb4cd('0x16'));var config=require(_0xb4cd('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb4cd('0x18'))['db'];config[_0xb4cd('0x19')]=_[_0xb4cd('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')[_0xb4cd('0x1b')](socket);function respondWithStatusCode(_0x2bc96e,_0x2f6804){_0x2f6804=_0x2f6804||0xcc;return function(_0x38c180){if(_0x38c180){return _0x2bc96e[_0xb4cd('0x1c')](_0x2f6804);}return _0x2bc96e[_0xb4cd('0x1d')](_0x2f6804)[_0xb4cd('0x1e')]();};}function respondWithResult(_0x2631f9,_0x36c2f1){_0x36c2f1=_0x36c2f1||0xc8;return function(_0x26e10e){if(_0x26e10e){return _0x2631f9[_0xb4cd('0x1d')](_0x36c2f1)[_0xb4cd('0x1f')](_0x26e10e);}};}function respondWithFilteredResult(_0x4fe807,_0x345c05){return function(_0x2fd90f){if(_0x2fd90f){var _0x404473=typeof _0x345c05[_0xb4cd('0x20')]==='undefined'&&typeof _0x345c05[_0xb4cd('0x21')]===_0xb4cd('0x22');var _0x41b422=_0x2fd90f['count'];var _0x3a983b=_0x404473?0x0:_0x345c05[_0xb4cd('0x20')];var _0x2cb402=_0x404473?_0x2fd90f[_0xb4cd('0x23')]:_0x345c05[_0xb4cd('0x20')]+_0x345c05[_0xb4cd('0x21')];var _0x5d0e0e;if(_0x2cb402>=_0x41b422){_0x2cb402=_0x41b422;_0x5d0e0e=0xc8;}else{_0x5d0e0e=0xce;}_0x4fe807['status'](_0x5d0e0e);return _0x4fe807[_0xb4cd('0x24')](_0xb4cd('0x25'),_0x3a983b+'-'+_0x2cb402+'/'+_0x41b422)['json'](_0x2fd90f);}return null;};}function patchUpdates(_0x1c1799){return function(_0x8a0053){try{jsonpatch[_0xb4cd('0x26')](_0x8a0053,_0x1c1799,!![]);}catch(_0x3c214c){return BPromise[_0xb4cd('0x27')](_0x3c214c);}return _0x8a0053[_0xb4cd('0x28')]();};}function saveUpdates(_0x481d36,_0x7336ff){return function(_0x362104){if(_0x362104){return _0x362104[_0xb4cd('0x29')](_0x481d36)['then'](function(_0x208b36){return _0x208b36;});}return null;};}function removeEntity(_0x5cb309,_0x5e87b6){return function(_0x3bfbc6){if(_0x3bfbc6){return _0x3bfbc6[_0xb4cd('0x2a')]()[_0xb4cd('0x2b')](function(){var _0x3dd086=_0x3bfbc6['get']({'plain':!![]});var _0x55b988=_0xb4cd('0x2c');return db[_0xb4cd('0x2d')][_0xb4cd('0x2a')]({'where':{'type':_0x55b988,'resourceId':_0x3dd086['id']}})[_0xb4cd('0x2b')](function(){return _0x3bfbc6;});})['then'](function(){_0x5cb309[_0xb4cd('0x1d')](0xcc)[_0xb4cd('0x1e')]();});}};}function handleEntityNotFound(_0x44e78a,_0x3f072a){return function(_0xf53c1){if(!_0xf53c1){_0x44e78a[_0xb4cd('0x1c')](0x194);}return _0xf53c1;};}function handleError(_0x50a272,_0x9049f){_0x9049f=_0x9049f||0x1f4;return function(_0x17de90){logger['error'](_0x17de90['stack']);if(_0x17de90[_0xb4cd('0x2e')]){delete _0x17de90[_0xb4cd('0x2e')];}_0x50a272['status'](_0x9049f)[_0xb4cd('0x2f')](_0x17de90);};}exports[_0xb4cd('0x30')]=function(_0x1d72db,_0xad0970){var _0x2980ce={},_0x55091a={},_0x4fbd4a={'count':0x0,'rows':[]};var _0x14ce3d=_[_0xb4cd('0x31')](db[_0xb4cd('0x32')][_0xb4cd('0x33')],function(_0x34bc89){return{'name':_0x34bc89[_0xb4cd('0x34')],'type':_0x34bc89[_0xb4cd('0x35')][_0xb4cd('0x36')]};});_0x55091a['model']=_[_0xb4cd('0x31')](_0x14ce3d,'name');_0x55091a[_0xb4cd('0x37')]=_[_0xb4cd('0x38')](_0x1d72db[_0xb4cd('0x37')]);_0x55091a[_0xb4cd('0x39')]=_['intersection'](_0x55091a[_0xb4cd('0x3a')],_0x55091a[_0xb4cd('0x37')]);_0x2980ce[_0xb4cd('0x3b')]=_[_0xb4cd('0x3c')](_0x55091a['model'],qs[_0xb4cd('0x3d')](_0x1d72db[_0xb4cd('0x37')][_0xb4cd('0x3d')]));_0x2980ce['attributes']=_0x2980ce[_0xb4cd('0x3b')][_0xb4cd('0x3e')]?_0x2980ce[_0xb4cd('0x3b')]:_0x55091a['model'];if(!_0x1d72db[_0xb4cd('0x37')][_0xb4cd('0x3f')](_0xb4cd('0x40'))){_0x2980ce['limit']=qs[_0xb4cd('0x21')](_0x1d72db[_0xb4cd('0x37')][_0xb4cd('0x21')]);_0x2980ce[_0xb4cd('0x20')]=qs['offset'](_0x1d72db[_0xb4cd('0x37')][_0xb4cd('0x20')]);}_0x2980ce[_0xb4cd('0x41')]=qs['sort'](_0x1d72db[_0xb4cd('0x37')][_0xb4cd('0x42')]);_0x2980ce[_0xb4cd('0x43')]=qs[_0xb4cd('0x39')](_[_0xb4cd('0x44')](_0x1d72db[_0xb4cd('0x37')],_0x55091a[_0xb4cd('0x39')]),_0x14ce3d);if(_0x1d72db['query']['filter']){_0x2980ce[_0xb4cd('0x43')]=_[_0xb4cd('0x45')](_0x2980ce['where'],{'$or':_[_0xb4cd('0x31')](_0x14ce3d,function(_0x3fd268){if(_0x3fd268[_0xb4cd('0x35')]!=='VIRTUAL'){var _0x48e126={};_0x48e126[_0x3fd268[_0xb4cd('0x2e')]]={'$like':'%'+_0x1d72db['query'][_0xb4cd('0x46')]+'%'};return _0x48e126;}})});}_0x2980ce=_[_0xb4cd('0x45')]({},_0x2980ce,_0x1d72db['options']);var _0x3ac14b={'where':_0x2980ce[_0xb4cd('0x43')]};return db['FaxQueue'][_0xb4cd('0x23')](_0x3ac14b)[_0xb4cd('0x2b')](function(_0x43877a){_0x4fbd4a[_0xb4cd('0x23')]=_0x43877a;if(_0x1d72db[_0xb4cd('0x37')]['includeAll']){_0x2980ce['include']=[{'all':!![]}];}return db[_0xb4cd('0x32')][_0xb4cd('0x47')](_0x2980ce);})[_0xb4cd('0x2b')](function(_0x532de6){_0x4fbd4a[_0xb4cd('0x48')]=_0x532de6;return _0x4fbd4a;})['then'](respondWithFilteredResult(_0xad0970,_0x2980ce))[_0xb4cd('0x49')](handleError(_0xad0970,null));};exports[_0xb4cd('0x4a')]=function(_0x4ad421,_0x1e54ce){var _0x5b05fa={'raw':!![],'where':{'id':_0x4ad421[_0xb4cd('0x4b')]['id']}},_0x30bb5c={};_0x30bb5c[_0xb4cd('0x3a')]=_[_0xb4cd('0x38')](db[_0xb4cd('0x32')][_0xb4cd('0x33')]);_0x30bb5c[_0xb4cd('0x37')]=_['keys'](_0x4ad421[_0xb4cd('0x37')]);_0x30bb5c[_0xb4cd('0x39')]=_[_0xb4cd('0x3c')](_0x30bb5c[_0xb4cd('0x3a')],_0x30bb5c[_0xb4cd('0x37')]);_0x5b05fa[_0xb4cd('0x3b')]=_[_0xb4cd('0x3c')](_0x30bb5c['model'],qs['fields'](_0x4ad421[_0xb4cd('0x37')][_0xb4cd('0x3d')]));_0x5b05fa[_0xb4cd('0x3b')]=_0x5b05fa[_0xb4cd('0x3b')]['length']?_0x5b05fa['attributes']:_0x30bb5c[_0xb4cd('0x3a')];if(_0x4ad421[_0xb4cd('0x37')][_0xb4cd('0x4c')]){_0x5b05fa[_0xb4cd('0x4d')]=[{'all':!![]}];}_0x5b05fa=_[_0xb4cd('0x45')]({},_0x5b05fa,_0x4ad421[_0xb4cd('0x4e')]);return db[_0xb4cd('0x32')][_0xb4cd('0x4f')](_0x5b05fa)[_0xb4cd('0x2b')](handleEntityNotFound(_0x1e54ce,null))[_0xb4cd('0x2b')](respondWithResult(_0x1e54ce,null))[_0xb4cd('0x49')](handleError(_0x1e54ce,null));};exports['create']=function(_0x5a1e2f,_0x3d821c){return db['FaxQueue']['create'](_0x5a1e2f['body'],{})[_0xb4cd('0x2b')](function(_0x4ef2be){var _0x366a3b=_0x5a1e2f[_0xb4cd('0x50')][_0xb4cd('0x51')]({'plain':!![]});if(!_0x366a3b)throw new Error(_0xb4cd('0x52'));if(_0x366a3b[_0xb4cd('0x53')]===_0xb4cd('0x50')){var _0x5b80d6=_0x4ef2be[_0xb4cd('0x51')]({'plain':!![]});var _0x4b1790=_0xb4cd('0x2c');return db['UserProfileSection'][_0xb4cd('0x4f')]({'where':{'name':_0x4b1790,'userProfileId':_0x366a3b[_0xb4cd('0x54')]},'raw':!![]})[_0xb4cd('0x2b')](function(_0x4b5ae8){if(_0x4b5ae8&&_0x4b5ae8['autoAssociation']===0x0){return db[_0xb4cd('0x2d')]['create']({'name':_0x5b80d6[_0xb4cd('0x2e')],'resourceId':_0x5b80d6['id'],'type':_0x4b5ae8['name'],'sectionId':_0x4b5ae8['id']},{})[_0xb4cd('0x2b')](function(){return _0x4ef2be;});}else{return _0x4ef2be;}})['catch'](function(_0x14433d){logger[_0xb4cd('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x14433d);throw _0x14433d;});}return _0x4ef2be;})[_0xb4cd('0x2b')](respondWithResult(_0x3d821c,0xc9))[_0xb4cd('0x49')](handleError(_0x3d821c,null));};exports[_0xb4cd('0x29')]=function(_0x2696c5,_0x39f508){if(_0x2696c5[_0xb4cd('0x56')]['id']){delete _0x2696c5['body']['id'];}return db['FaxQueue']['find']({'where':{'id':_0x2696c5[_0xb4cd('0x4b')]['id']}})[_0xb4cd('0x2b')](handleEntityNotFound(_0x39f508,null))[_0xb4cd('0x2b')](saveUpdates(_0x2696c5[_0xb4cd('0x56')],null))['then'](respondWithResult(_0x39f508,null))[_0xb4cd('0x49')](handleError(_0x39f508,null));};exports[_0xb4cd('0x2a')]=function(_0x42bea8,_0x31b897){return db[_0xb4cd('0x32')][_0xb4cd('0x4f')]({'where':{'id':_0x42bea8[_0xb4cd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x31b897,null))[_0xb4cd('0x2b')](removeEntity(_0x31b897,null))[_0xb4cd('0x49')](handleError(_0x31b897,null));};exports[_0xb4cd('0x57')]=function(_0x2a2391,_0x1f5c88){return db[_0xb4cd('0x32')][_0xb4cd('0x57')]()[_0xb4cd('0x2b')](respondWithResult(_0x1f5c88,null))[_0xb4cd('0x49')](handleError(_0x1f5c88,null));};exports[_0xb4cd('0x58')]=function(_0x31fe76,_0x521d31,_0x3f65b7){var _0x44b72e={'raw':!![],'where':{}},_0x2a0904={},_0x5dc3b6;return db[_0xb4cd('0x32')][_0xb4cd('0x59')]({'where':{'id':_0x31fe76[_0xb4cd('0x4b')]['id']}})[_0xb4cd('0x2b')](handleEntityNotFound(_0x521d31,null))['then'](function(_0x2684bf){if(_0x2684bf){_0x5dc3b6=_0x2684bf['get']({'plain':!![]});_0x2a0904[_0xb4cd('0x3a')]=_[_0xb4cd('0x38')](db[_0xb4cd('0x5a')][_0xb4cd('0x33')]);_0x2a0904[_0xb4cd('0x37')]=_['keys'](_0x31fe76[_0xb4cd('0x37')]);_0x2a0904['filters']=_[_0xb4cd('0x3c')](_0x2a0904['model'],_0x2a0904[_0xb4cd('0x37')]);_0x44b72e['attributes']=_[_0xb4cd('0x3c')](_0x2a0904[_0xb4cd('0x3a')],qs[_0xb4cd('0x3d')](_0x31fe76[_0xb4cd('0x37')][_0xb4cd('0x3d')]));_0x44b72e[_0xb4cd('0x3b')]=_0x44b72e[_0xb4cd('0x3b')][_0xb4cd('0x3e')]?_0x44b72e[_0xb4cd('0x3b')]:_0x2a0904[_0xb4cd('0x3a')];if(!_0x31fe76[_0xb4cd('0x37')]['hasOwnProperty'](_0xb4cd('0x40'))){_0x44b72e['limit']=qs['limit'](_0x31fe76[_0xb4cd('0x37')][_0xb4cd('0x21')]);_0x44b72e[_0xb4cd('0x20')]=qs[_0xb4cd('0x20')](_0x31fe76[_0xb4cd('0x37')][_0xb4cd('0x20')]);}_0x44b72e[_0xb4cd('0x41')]=qs[_0xb4cd('0x42')](_0x31fe76['query']['sort']);_0x44b72e[_0xb4cd('0x43')]=qs[_0xb4cd('0x39')](_[_0xb4cd('0x44')](_0x31fe76[_0xb4cd('0x37')],_0x2a0904['filters']));_0x44b72e[_0xb4cd('0x43')]['FaxQueueId']=_0x2684bf['id'];if(_0x31fe76[_0xb4cd('0x37')][_0xb4cd('0x46')]){_0x44b72e[_0xb4cd('0x43')]=_[_0xb4cd('0x45')](_0x44b72e['where'],{'$or':_['map'](_0x44b72e[_0xb4cd('0x3b')],function(_0x36231d){var _0x384ffd={};_0x384ffd[_0x36231d]={'$like':'%'+_0x31fe76[_0xb4cd('0x37')][_0xb4cd('0x46')]+'%'};return _0x384ffd;})});}_0x44b72e=_[_0xb4cd('0x45')]({},_0x44b72e,_0x31fe76[_0xb4cd('0x4e')]);return db['UserFaxQueue'][_0xb4cd('0x47')](_0x44b72e);}})[_0xb4cd('0x2b')](function(_0x59274b){if(_0x59274b){return db[_0xb4cd('0x5b')][_0xb4cd('0x5c')]({'where':{'id':_['map'](_0x59274b,_0xb4cd('0x5d')),'role':'agent'},'attributes':['id',_0xb4cd('0x2e'),'faxPause',_0xb4cd('0x5e'),_0xb4cd('0x5f')]});}})[_0xb4cd('0x2b')](function(_0x125416){if(_0x125416){return{'count':_0x125416['count'],'rows':_['map'](_0x125416['rows'],function(_0x261450){return{'membername':_0x261450[_0xb4cd('0x2e')],'UserId':_0x261450['id'],'queue_name':_0x5dc3b6[_0xb4cd('0x2e')],'FaxQueueId':_0x5dc3b6['id'],'interface':util[_0xb4cd('0x60')](_0xb4cd('0x61'),_0xb4cd('0x62'),_0x261450['name']),'penalty':0x0,'paused':_0x261450[_0xb4cd('0x63')],'createdAt':_0x261450[_0xb4cd('0x5f')],'updatedAt':_0x261450[_0xb4cd('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb4cd('0x2b')](respondWithFilteredResult(_0x521d31,_0x44b72e))[_0xb4cd('0x49')](handleError(_0x521d31,null));};exports['getTeams']=function(_0x14cd3d,_0x401c0f,_0x4fdd3f){var _0x4a57aa={};var _0x2bb74b={};var _0x2cb565;var _0x4e9068;return db[_0xb4cd('0x32')][_0xb4cd('0x59')]({'where':{'id':_0x14cd3d[_0xb4cd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x401c0f,null))[_0xb4cd('0x2b')](function(_0x187c4f){if(_0x187c4f){_0x2cb565=_0x187c4f;_0x2bb74b[_0xb4cd('0x3a')]=_[_0xb4cd('0x38')](db['Team'][_0xb4cd('0x33')]);_0x2bb74b['query']=_[_0xb4cd('0x38')](_0x14cd3d[_0xb4cd('0x37')]);_0x2bb74b[_0xb4cd('0x39')]=_[_0xb4cd('0x3c')](_0x2bb74b['model'],_0x2bb74b[_0xb4cd('0x37')]);_0x4a57aa[_0xb4cd('0x3b')]=_['intersection'](_0x2bb74b['model'],qs[_0xb4cd('0x3d')](_0x14cd3d['query'][_0xb4cd('0x3d')]));_0x4a57aa[_0xb4cd('0x3b')]=_0x4a57aa[_0xb4cd('0x3b')]['length']?_0x4a57aa[_0xb4cd('0x3b')]:_0x2bb74b['model'];_0x4a57aa[_0xb4cd('0x41')]=qs['sort'](_0x14cd3d[_0xb4cd('0x37')][_0xb4cd('0x42')]);_0x4a57aa[_0xb4cd('0x43')]=qs['filters'](_[_0xb4cd('0x44')](_0x14cd3d[_0xb4cd('0x37')],_0x2bb74b[_0xb4cd('0x39')]));if(_0x14cd3d[_0xb4cd('0x37')][_0xb4cd('0x46')]){_0x4a57aa[_0xb4cd('0x43')]=_[_0xb4cd('0x45')](_0x4a57aa['where'],{'$or':_[_0xb4cd('0x31')](_0x4a57aa['attributes'],function(_0x1cd8ad){var _0x5d85e9={};_0x5d85e9[_0x1cd8ad]={'$like':'%'+_0x14cd3d[_0xb4cd('0x37')][_0xb4cd('0x46')]+'%'};return _0x5d85e9;})});}_0x4a57aa=_[_0xb4cd('0x45')]({},_0x4a57aa,_0x14cd3d[_0xb4cd('0x4e')]);return _0x2cb565[_0xb4cd('0x64')](_0x4a57aa);}})[_0xb4cd('0x2b')](function(_0x1ccbdc){if(_0x1ccbdc){_0x4e9068=_0x1ccbdc[_0xb4cd('0x3e')];if(!_0x14cd3d[_0xb4cd('0x37')][_0xb4cd('0x3f')](_0xb4cd('0x40'))){_0x4a57aa[_0xb4cd('0x21')]=qs[_0xb4cd('0x21')](_0x14cd3d[_0xb4cd('0x37')][_0xb4cd('0x21')]);_0x4a57aa[_0xb4cd('0x20')]=qs[_0xb4cd('0x20')](_0x14cd3d[_0xb4cd('0x37')][_0xb4cd('0x20')]);}return _0x2cb565['getTeams'](_0x4a57aa);}})[_0xb4cd('0x2b')](function(_0x98b5ae){if(_0x98b5ae){return _0x98b5ae?{'count':_0x4e9068,'rows':_0x98b5ae}:null;}})[_0xb4cd('0x2b')](respondWithResult(_0x401c0f,null))[_0xb4cd('0x49')](handleError(_0x401c0f,null));};exports[_0xb4cd('0x65')]=function(_0x5eb138,_0x59e3ea,_0x1f0d2b){var _0x1fb252=_0x5eb138[_0xb4cd('0x56')][_0xb4cd('0x66')];return db['Team'][_0xb4cd('0x47')]({'where':{'id':_0x1fb252},'attributes':['id'],'include':[{'model':db['User'],'as':_0xb4cd('0x67'),'attributes':['id',_0xb4cd('0x2e'),_0xb4cd('0x68'),_0xb4cd('0x69'),_0xb4cd('0x6a')],'raw':!![]}]})[_0xb4cd('0x2b')](function(_0x22f4b3){if(_0x22f4b3){var _0x5ebe13=_['flatMap'](_0x22f4b3,function(_0x3f472e){var _0x792866=_0x3f472e[_0xb4cd('0x51')]({'plain':!![]});return _0x792866[_0xb4cd('0x67')];});return db[_0xb4cd('0x32')]['find']({'where':{'id':_0x5eb138[_0xb4cd('0x4b')]['id']}})[_0xb4cd('0x2b')](function(_0x4e4ea7){return db[_0xb4cd('0x6b')]['transaction'](function(_0x59df93){return _0x4e4ea7[_0xb4cd('0x65')](_0x1fb252,{'transaction':_0x59df93})[_0xb4cd('0x2b')](function(){return BPromise[_0xb4cd('0x6c')](_0x5ebe13,function(_0x421255){return db[_0xb4cd('0x5a')][_0xb4cd('0x6d')]({'where':{'UserId':_0x421255['id'],'FaxQueueId':_0x5eb138['params']['id']},'transaction':_0x59df93});});})['then'](function(){_0x5ebe13[_0xb4cd('0x6e')](function(_0x526124){socket[_0xb4cd('0x6f')](_0xb4cd('0x70'),{'UserId':_0x526124['id'],'FaxQueueId':_0x4e4ea7['id']});});});});});}})[_0xb4cd('0x2b')](respondWithStatusCode(_0x59e3ea,null))[_0xb4cd('0x49')](handleError(_0x59e3ea,null));};exports[_0xb4cd('0x71')]=function(_0x50b751,_0x58e459,_0x1ce593){return db[_0xb4cd('0x72')][_0xb4cd('0x47')]({'where':{'id':_0x50b751[_0xb4cd('0x37')][_0xb4cd('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb4cd('0x2b')](handleEntityNotFound(_0x58e459,null))['then'](function(_0x2bae75){var _0x168d23=_['map'](_0x2bae75,'id');var _0x233f98=[];var _0x10cb8e=[];var _0x1c84d0=squel[_0xb4cd('0x73')]();_0x1c84d0[_0xb4cd('0x74')](_0xb4cd('0x75'))['from'](_0xb4cd('0x76'),'tq')[_0xb4cd('0x77')](_0xb4cd('0x78'),'ut',_0xb4cd('0x79'))['where'](_0xb4cd('0x7a'),_0x50b751[_0xb4cd('0x4b')]['id']);for(var _0x43a05b=0x0;_0x43a05b<_0x2bae75[_0xb4cd('0x3e')];_0x43a05b+=0x1){let _0x435ba9=_0x2bae75[_0x43a05b];for(var _0x1eb181=0x0;_0x1eb181<_0x435ba9[_0xb4cd('0x67')][_0xb4cd('0x3e')];_0x1eb181+=0x1){let _0x4c47d9=_0x435ba9[_0xb4cd('0x67')][_0x1eb181];var _0x21e5a2=_0x1c84d0[_0xb4cd('0x7b')]();_0x21e5a2['where'](_0xb4cd('0x7c'),_0x4c47d9['id']);_0x10cb8e['push'](db['sequelize'][_0xb4cd('0x37')](_0x21e5a2['toString'](),{'type':db[_0xb4cd('0x6b')][_0xb4cd('0x7d')][_0xb4cd('0x7e')]})[_0xb4cd('0x2b')](function(_0x34dc94){if(_0x34dc94[_0xb4cd('0x3e')]===0x1){return _0x4c47d9['id'];}else{var _0xcc9166=_[_0xb4cd('0x7f')](_[_0xb4cd('0x31')](_0x34dc94,_0xb4cd('0x80')),function(_0x9a6970){return _[_0xb4cd('0x81')](_0x168d23,_0x9a6970);});if(_0xcc9166){return _0x4c47d9['id'];}}}));}}return BPromise[_0xb4cd('0x82')](_0x10cb8e)['then'](function(_0x2325bf){_0x233f98=_(_0x233f98)[_0xb4cd('0x83')](_0x2325bf)[_0xb4cd('0x84')]()[_0xb4cd('0x85')]();return db[_0xb4cd('0x32')][_0xb4cd('0x4f')]({'where':{'id':_0x50b751['params']['id']}})[_0xb4cd('0x2b')](function(_0x102e7b){return db[_0xb4cd('0x6b')][_0xb4cd('0x86')](function(_0x5c9504){return _0x102e7b['removeTeams'](_0x50b751['query'][_0xb4cd('0x66')],{'transaction':_0x5c9504})[_0xb4cd('0x2b')](function(){if(!_[_0xb4cd('0x87')](_0x233f98)){return _0x102e7b[_0xb4cd('0x88')](_0x233f98,{'transaction':_0x5c9504});}})['then'](function(){_0x233f98[_0xb4cd('0x6e')](function(_0x1f1979){socket[_0xb4cd('0x6f')](_0xb4cd('0x89'),{'UserId':_0x1f1979,'FaxQueueId':_0x102e7b['id']});});});});});});})['then'](respondWithStatusCode(_0x58e459,null))[_0xb4cd('0x49')](handleError(_0x58e459,null));};exports[_0xb4cd('0x8a')]=function(_0x139052,_0x340d88,_0xcf5c95){return db[_0xb4cd('0x32')][_0xb4cd('0x4f')]({'where':{'id':_0x139052['params']['id']}})[_0xb4cd('0x2b')](handleEntityNotFound(_0x340d88,null))[_0xb4cd('0x2b')](function(_0x2595ce){if(_0x2595ce){return _0x2595ce[_0xb4cd('0x8a')](_0x139052['body'][_0xb4cd('0x66')],_[_0xb4cd('0x8b')](_0x139052[_0xb4cd('0x56')],[_0xb4cd('0x66'),'id'])||{})[_0xb4cd('0x8c')](function(_0x5e4eee){for(var _0x25900f=0x0;_0x25900f<_0x139052[_0xb4cd('0x56')]['ids'][_0xb4cd('0x3e')];_0x25900f+=0x1){socket[_0xb4cd('0x6f')](_0xb4cd('0x70'),{'UserId':Number(_0x139052[_0xb4cd('0x56')][_0xb4cd('0x66')][_0x25900f]),'FaxQueueId':Number(_0x139052[_0xb4cd('0x4b')]['id'])});}return _0x5e4eee;});}})[_0xb4cd('0x2b')](respondWithResult(_0x340d88,null))[_0xb4cd('0x49')](handleError(_0x340d88,null));};exports[_0xb4cd('0x88')]=function(_0x257cc1,_0x34a6f6,_0x14a05d){return db['FaxQueue']['find']({'where':{'id':_0x257cc1[_0xb4cd('0x4b')]['id']}})[_0xb4cd('0x2b')](handleEntityNotFound(_0x34a6f6,null))[_0xb4cd('0x2b')](function(_0x4c58ae){if(_0x4c58ae){return _0x4c58ae[_0xb4cd('0x88')](_0x257cc1[_0xb4cd('0x37')][_0xb4cd('0x66')])[_0xb4cd('0x2b')](function(){if(_[_0xb4cd('0x8d')](_0x257cc1[_0xb4cd('0x37')][_0xb4cd('0x66')])){for(var _0x2125e8=0x0;_0x2125e8<_0x257cc1[_0xb4cd('0x37')][_0xb4cd('0x66')][_0xb4cd('0x3e')];_0x2125e8+=0x1){socket['emit'](_0xb4cd('0x89'),{'UserId':Number(_0x257cc1[_0xb4cd('0x37')]['ids'][_0x2125e8]),'FaxQueueId':Number(_0x257cc1['params']['id'])});}}else{socket[_0xb4cd('0x6f')](_0xb4cd('0x89'),{'UserId':Number(_0x257cc1[_0xb4cd('0x37')][_0xb4cd('0x66')]),'FaxQueueId':Number(_0x257cc1[_0xb4cd('0x4b')]['id'])});}});}})[_0xb4cd('0x2b')](respondWithStatusCode(_0x34a6f6,null))['catch'](handleError(_0x34a6f6,null));};exports[_0xb4cd('0x8e')]=function(_0x20f133,_0x21dd0c,_0x59d174){var _0x568c8a={};var _0x4e7b5a={};var _0x914f4f;var _0x3fa2b3;return db[_0xb4cd('0x32')][_0xb4cd('0x59')]({'where':{'id':_0x20f133[_0xb4cd('0x4b')]['id']}})['then'](handleEntityNotFound(_0x21dd0c,null))[_0xb4cd('0x2b')](function(_0x84cb45){if(_0x84cb45){_0x914f4f=_0x84cb45;_0x4e7b5a[_0xb4cd('0x3a')]=_['keys'](db[_0xb4cd('0x5b')][_0xb4cd('0x33')]);_0x4e7b5a[_0xb4cd('0x37')]=_['keys'](_0x20f133[_0xb4cd('0x37')]);_0x4e7b5a[_0xb4cd('0x39')]=_[_0xb4cd('0x3c')](_0x4e7b5a[_0xb4cd('0x3a')],_0x4e7b5a['query']);_0x568c8a[_0xb4cd('0x3b')]=_[_0xb4cd('0x3c')](_0x4e7b5a[_0xb4cd('0x3a')],qs[_0xb4cd('0x3d')](_0x20f133[_0xb4cd('0x37')][_0xb4cd('0x3d')]));_0x568c8a[_0xb4cd('0x3b')]=_0x568c8a[_0xb4cd('0x3b')][_0xb4cd('0x3e')]?_0x568c8a[_0xb4cd('0x3b')]:_0x4e7b5a[_0xb4cd('0x3a')];_0x568c8a['order']=qs[_0xb4cd('0x42')](_0x20f133['query']['sort']);_0x568c8a[_0xb4cd('0x43')]=qs['filters'](_[_0xb4cd('0x44')](_0x20f133[_0xb4cd('0x37')],_0x4e7b5a[_0xb4cd('0x39')]));if(_0x20f133[_0xb4cd('0x37')][_0xb4cd('0x46')]){_0x568c8a[_0xb4cd('0x43')]=_[_0xb4cd('0x45')](_0x568c8a[_0xb4cd('0x43')],{'$or':_[_0xb4cd('0x31')](_0x568c8a[_0xb4cd('0x3b')],function(_0x9c7455){var _0x38eeaa={};_0x38eeaa[_0x9c7455]={'$like':'%'+_0x20f133[_0xb4cd('0x37')][_0xb4cd('0x46')]+'%'};return _0x38eeaa;})});}_0x568c8a=_[_0xb4cd('0x45')]({},_0x568c8a,_0x20f133['options']);return _0x914f4f[_0xb4cd('0x8e')](_0x568c8a);}})[_0xb4cd('0x2b')](function(_0x58f69e){if(_0x58f69e){_0x3fa2b3=_0x58f69e[_0xb4cd('0x3e')];if(!_0x20f133[_0xb4cd('0x37')]['hasOwnProperty'](_0xb4cd('0x40'))){_0x568c8a[_0xb4cd('0x21')]=qs[_0xb4cd('0x21')](_0x20f133[_0xb4cd('0x37')][_0xb4cd('0x21')]);_0x568c8a[_0xb4cd('0x20')]=qs[_0xb4cd('0x20')](_0x20f133[_0xb4cd('0x37')][_0xb4cd('0x20')]);}return _0x914f4f[_0xb4cd('0x8e')](_0x568c8a);}})['then'](function(_0x1457ac){if(_0x1457ac){return _0x1457ac?{'count':_0x3fa2b3,'rows':_0x1457ac}:null;}})['then'](respondWithResult(_0x21dd0c,null))[_0xb4cd('0x49')](handleError(_0x21dd0c,null));}; \ No newline at end of file +var _0xe232=['sox','to-csv','ejs','lodash','squel','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','redis','defaults','localhost','./faxQueue.socket','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','end','stack','name','send','index','map','FaxQueue','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','describe','getMembers','findOne','UserFaxQueue','nolimit','pick','FaxQueueId','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','transaction','each','forEach','emit','removeTeams','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','sequelize','toString','SELECT','every','includes','all','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x41f570,_0x477d83){var _0x188024=function(_0x1ccb21){while(--_0x1ccb21){_0x41f570['push'](_0x41f570['shift']());}};_0x188024(++_0x477d83);}(_0xe232,0x117));var _0x2e23=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe232[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2e23('0x0'));var rimraf=require(_0x2e23('0x1'));var zipdir=require(_0x2e23('0x2'));var jsonpatch=require(_0x2e23('0x3'));var rp=require(_0x2e23('0x4'));var moment=require(_0x2e23('0x5'));var BPromise=require(_0x2e23('0x6'));var Mustache=require('mustache');var util=require(_0x2e23('0x7'));var path=require(_0x2e23('0x8'));var sox=require(_0x2e23('0x9'));var csv=require(_0x2e23('0xa'));var ejs=require(_0x2e23('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2e23('0xc'));var squel=require(_0x2e23('0xd'));var crypto=require('crypto');var jsforce=require(_0x2e23('0xe'));var deskjs=require(_0x2e23('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2e23('0x10'));var Redis=require(_0x2e23('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2e23('0x12'));var as=require(_0x2e23('0x13'));var hardwareService=require(_0x2e23('0x14'));var logger=require(_0x2e23('0x15'))(_0x2e23('0x16'));var utils=require(_0x2e23('0x17'));var config=require(_0x2e23('0x18'));var licenseUtil=require(_0x2e23('0x19'));var db=require(_0x2e23('0x1a'))['db'];config[_0x2e23('0x1b')]=_[_0x2e23('0x1c')](config[_0x2e23('0x1b')],{'host':_0x2e23('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2e23('0x1b')]));require(_0x2e23('0x1e'))['register'](socket);function respondWithStatusCode(_0x30c5e1,_0x1198d0){_0x1198d0=_0x1198d0||0xcc;return function(_0x44da10){if(_0x44da10){return _0x30c5e1[_0x2e23('0x1f')](_0x1198d0);}return _0x30c5e1[_0x2e23('0x20')](_0x1198d0)['end']();};}function respondWithResult(_0x4a4f34,_0x2b6c6b){_0x2b6c6b=_0x2b6c6b||0xc8;return function(_0x54a304){if(_0x54a304){return _0x4a4f34[_0x2e23('0x20')](_0x2b6c6b)[_0x2e23('0x21')](_0x54a304);}};}function respondWithFilteredResult(_0x41aac0,_0x8ef122){return function(_0x3d49da){if(_0x3d49da){var _0x4a604a=typeof _0x8ef122['offset']===_0x2e23('0x22')&&typeof _0x8ef122[_0x2e23('0x23')]===_0x2e23('0x22');var _0x5cd254=_0x3d49da[_0x2e23('0x24')];var _0x55f2c4=_0x4a604a?0x0:_0x8ef122['offset'];var _0x3932de=_0x4a604a?_0x3d49da[_0x2e23('0x24')]:_0x8ef122[_0x2e23('0x25')]+_0x8ef122[_0x2e23('0x23')];var _0x49579c;if(_0x3932de>=_0x5cd254){_0x3932de=_0x5cd254;_0x49579c=0xc8;}else{_0x49579c=0xce;}_0x41aac0['status'](_0x49579c);return _0x41aac0['set'](_0x2e23('0x26'),_0x55f2c4+'-'+_0x3932de+'/'+_0x5cd254)[_0x2e23('0x21')](_0x3d49da);}return null;};}function patchUpdates(_0x1f1982){return function(_0x5b47b3){try{jsonpatch[_0x2e23('0x27')](_0x5b47b3,_0x1f1982,!![]);}catch(_0x2f5d68){return BPromise[_0x2e23('0x28')](_0x2f5d68);}return _0x5b47b3[_0x2e23('0x29')]();};}function saveUpdates(_0x598aa4,_0x50ba41){return function(_0x227b6f){if(_0x227b6f){return _0x227b6f[_0x2e23('0x2a')](_0x598aa4)[_0x2e23('0x2b')](function(_0x48b99a){return _0x48b99a;});}return null;};}function removeEntity(_0x352348,_0x5e2c81){return function(_0x545df9){if(_0x545df9){return _0x545df9[_0x2e23('0x2c')]()[_0x2e23('0x2b')](function(){var _0x4a6fb2=_0x545df9[_0x2e23('0x2d')]({'plain':!![]});var _0x9091c4=_0x2e23('0x2e');return db[_0x2e23('0x2f')]['destroy']({'where':{'type':_0x9091c4,'resourceId':_0x4a6fb2['id']}})[_0x2e23('0x2b')](function(){return _0x545df9;});})[_0x2e23('0x2b')](function(){_0x352348[_0x2e23('0x20')](0xcc)[_0x2e23('0x30')]();});}};}function handleEntityNotFound(_0x40ead1,_0x23cb0f){return function(_0x29860e){if(!_0x29860e){_0x40ead1[_0x2e23('0x1f')](0x194);}return _0x29860e;};}function handleError(_0x3ebcca,_0x235720){_0x235720=_0x235720||0x1f4;return function(_0x4a7ad3){logger['error'](_0x4a7ad3[_0x2e23('0x31')]);if(_0x4a7ad3['name']){delete _0x4a7ad3[_0x2e23('0x32')];}_0x3ebcca[_0x2e23('0x20')](_0x235720)[_0x2e23('0x33')](_0x4a7ad3);};}exports[_0x2e23('0x34')]=function(_0x3afa69,_0x32a1c5){var _0x3c227d={},_0x10bbee={},_0x32466d={'count':0x0,'rows':[]};var _0x2cda8d=_[_0x2e23('0x35')](db[_0x2e23('0x36')]['rawAttributes'],function(_0x3328f4){return{'name':_0x3328f4[_0x2e23('0x37')],'type':_0x3328f4[_0x2e23('0x38')][_0x2e23('0x39')]};});_0x10bbee[_0x2e23('0x3a')]=_[_0x2e23('0x35')](_0x2cda8d,_0x2e23('0x32'));_0x10bbee[_0x2e23('0x3b')]=_[_0x2e23('0x3c')](_0x3afa69[_0x2e23('0x3b')]);_0x10bbee[_0x2e23('0x3d')]=_[_0x2e23('0x3e')](_0x10bbee[_0x2e23('0x3a')],_0x10bbee['query']);_0x3c227d['attributes']=_[_0x2e23('0x3e')](_0x10bbee[_0x2e23('0x3a')],qs[_0x2e23('0x3f')](_0x3afa69['query']['fields']));_0x3c227d[_0x2e23('0x40')]=_0x3c227d[_0x2e23('0x40')][_0x2e23('0x41')]?_0x3c227d[_0x2e23('0x40')]:_0x10bbee[_0x2e23('0x3a')];if(!_0x3afa69[_0x2e23('0x3b')][_0x2e23('0x42')]('nolimit')){_0x3c227d[_0x2e23('0x23')]=qs[_0x2e23('0x23')](_0x3afa69['query'][_0x2e23('0x23')]);_0x3c227d[_0x2e23('0x25')]=qs[_0x2e23('0x25')](_0x3afa69[_0x2e23('0x3b')]['offset']);}_0x3c227d[_0x2e23('0x43')]=qs[_0x2e23('0x44')](_0x3afa69[_0x2e23('0x3b')][_0x2e23('0x44')]);_0x3c227d[_0x2e23('0x45')]=qs[_0x2e23('0x3d')](_['pick'](_0x3afa69['query'],_0x10bbee[_0x2e23('0x3d')]),_0x2cda8d);if(_0x3afa69[_0x2e23('0x3b')][_0x2e23('0x46')]){_0x3c227d['where']=_[_0x2e23('0x47')](_0x3c227d[_0x2e23('0x45')],{'$or':_[_0x2e23('0x35')](_0x2cda8d,function(_0x4d06f5){if(_0x4d06f5[_0x2e23('0x38')]!==_0x2e23('0x48')){var _0x60011e={};_0x60011e[_0x4d06f5['name']]={'$like':'%'+_0x3afa69[_0x2e23('0x3b')]['filter']+'%'};return _0x60011e;}})});}_0x3c227d=_[_0x2e23('0x47')]({},_0x3c227d,_0x3afa69['options']);var _0x2d152e={'where':_0x3c227d[_0x2e23('0x45')]};return db['FaxQueue'][_0x2e23('0x24')](_0x2d152e)['then'](function(_0x1b1fb3){_0x32466d[_0x2e23('0x24')]=_0x1b1fb3;if(_0x3afa69[_0x2e23('0x3b')][_0x2e23('0x49')]){_0x3c227d['include']=[{'all':!![]}];}return db['FaxQueue'][_0x2e23('0x4a')](_0x3c227d);})[_0x2e23('0x2b')](function(_0x3b58fc){_0x32466d[_0x2e23('0x4b')]=_0x3b58fc;return _0x32466d;})[_0x2e23('0x2b')](respondWithFilteredResult(_0x32a1c5,_0x3c227d))[_0x2e23('0x4c')](handleError(_0x32a1c5,null));};exports[_0x2e23('0x4d')]=function(_0x5339a6,_0x3e3f79){var _0x1c79ca={'raw':!![],'where':{'id':_0x5339a6[_0x2e23('0x4e')]['id']}},_0x2bd18e={};_0x2bd18e[_0x2e23('0x3a')]=_[_0x2e23('0x3c')](db[_0x2e23('0x36')][_0x2e23('0x4f')]);_0x2bd18e[_0x2e23('0x3b')]=_[_0x2e23('0x3c')](_0x5339a6[_0x2e23('0x3b')]);_0x2bd18e['filters']=_[_0x2e23('0x3e')](_0x2bd18e[_0x2e23('0x3a')],_0x2bd18e['query']);_0x1c79ca[_0x2e23('0x40')]=_[_0x2e23('0x3e')](_0x2bd18e[_0x2e23('0x3a')],qs[_0x2e23('0x3f')](_0x5339a6['query'][_0x2e23('0x3f')]));_0x1c79ca['attributes']=_0x1c79ca[_0x2e23('0x40')][_0x2e23('0x41')]?_0x1c79ca[_0x2e23('0x40')]:_0x2bd18e[_0x2e23('0x3a')];if(_0x5339a6[_0x2e23('0x3b')][_0x2e23('0x49')]){_0x1c79ca[_0x2e23('0x50')]=[{'all':!![]}];}_0x1c79ca=_[_0x2e23('0x47')]({},_0x1c79ca,_0x5339a6[_0x2e23('0x51')]);return db[_0x2e23('0x36')]['find'](_0x1c79ca)[_0x2e23('0x2b')](handleEntityNotFound(_0x3e3f79,null))[_0x2e23('0x2b')](respondWithResult(_0x3e3f79,null))[_0x2e23('0x4c')](handleError(_0x3e3f79,null));};exports[_0x2e23('0x52')]=function(_0xc92d62,_0x4485c9){return db[_0x2e23('0x36')][_0x2e23('0x52')](_0xc92d62['body'],{})[_0x2e23('0x2b')](function(_0x73f926){var _0x428e79=_0xc92d62[_0x2e23('0x53')]['get']({'plain':!![]});if(!_0x428e79)throw new Error(_0x2e23('0x54'));if(_0x428e79[_0x2e23('0x55')]===_0x2e23('0x53')){var _0xb411b9=_0x73f926['get']({'plain':!![]});var _0x83d754=_0x2e23('0x2e');return db[_0x2e23('0x56')]['find']({'where':{'name':_0x83d754,'userProfileId':_0x428e79[_0x2e23('0x57')]},'raw':!![]})[_0x2e23('0x2b')](function(_0x135075){if(_0x135075&&_0x135075['autoAssociation']===0x0){return db[_0x2e23('0x2f')][_0x2e23('0x52')]({'name':_0xb411b9[_0x2e23('0x32')],'resourceId':_0xb411b9['id'],'type':_0x135075['name'],'sectionId':_0x135075['id']},{})[_0x2e23('0x2b')](function(){return _0x73f926;});}else{return _0x73f926;}})[_0x2e23('0x4c')](function(_0x7b68ed){logger[_0x2e23('0x58')](_0x2e23('0x59'),_0x7b68ed);throw _0x7b68ed;});}return _0x73f926;})[_0x2e23('0x2b')](respondWithResult(_0x4485c9,0xc9))[_0x2e23('0x4c')](handleError(_0x4485c9,null));};exports['update']=function(_0x2ca24c,_0x3ce42c){if(_0x2ca24c[_0x2e23('0x5a')]['id']){delete _0x2ca24c['body']['id'];}return db[_0x2e23('0x36')][_0x2e23('0x5b')]({'where':{'id':_0x2ca24c['params']['id']}})['then'](handleEntityNotFound(_0x3ce42c,null))[_0x2e23('0x2b')](saveUpdates(_0x2ca24c[_0x2e23('0x5a')],null))['then'](respondWithResult(_0x3ce42c,null))[_0x2e23('0x4c')](handleError(_0x3ce42c,null));};exports[_0x2e23('0x2c')]=function(_0x3fe0cb,_0x62bd3){return db[_0x2e23('0x36')][_0x2e23('0x5b')]({'where':{'id':_0x3fe0cb[_0x2e23('0x4e')]['id']}})[_0x2e23('0x2b')](handleEntityNotFound(_0x62bd3,null))['then'](removeEntity(_0x62bd3,null))[_0x2e23('0x4c')](handleError(_0x62bd3,null));};exports['describe']=function(_0xdabd2f,_0x383aae){return db[_0x2e23('0x36')][_0x2e23('0x5c')]()[_0x2e23('0x2b')](respondWithResult(_0x383aae,null))[_0x2e23('0x4c')](handleError(_0x383aae,null));};exports[_0x2e23('0x5d')]=function(_0x422c7a,_0x3e14cb,_0x40f930){var _0x38d8a3={'raw':!![],'where':{}},_0x21ebbc={},_0x17a83f;return db[_0x2e23('0x36')][_0x2e23('0x5e')]({'where':{'id':_0x422c7a[_0x2e23('0x4e')]['id']}})[_0x2e23('0x2b')](handleEntityNotFound(_0x3e14cb,null))['then'](function(_0x17ec25){if(_0x17ec25){_0x17a83f=_0x17ec25['get']({'plain':!![]});_0x21ebbc['model']=_[_0x2e23('0x3c')](db[_0x2e23('0x5f')][_0x2e23('0x4f')]);_0x21ebbc[_0x2e23('0x3b')]=_[_0x2e23('0x3c')](_0x422c7a[_0x2e23('0x3b')]);_0x21ebbc['filters']=_['intersection'](_0x21ebbc[_0x2e23('0x3a')],_0x21ebbc[_0x2e23('0x3b')]);_0x38d8a3[_0x2e23('0x40')]=_['intersection'](_0x21ebbc[_0x2e23('0x3a')],qs[_0x2e23('0x3f')](_0x422c7a[_0x2e23('0x3b')]['fields']));_0x38d8a3[_0x2e23('0x40')]=_0x38d8a3[_0x2e23('0x40')][_0x2e23('0x41')]?_0x38d8a3[_0x2e23('0x40')]:_0x21ebbc['model'];if(!_0x422c7a[_0x2e23('0x3b')][_0x2e23('0x42')](_0x2e23('0x60'))){_0x38d8a3[_0x2e23('0x23')]=qs[_0x2e23('0x23')](_0x422c7a['query']['limit']);_0x38d8a3[_0x2e23('0x25')]=qs[_0x2e23('0x25')](_0x422c7a[_0x2e23('0x3b')][_0x2e23('0x25')]);}_0x38d8a3['order']=qs[_0x2e23('0x44')](_0x422c7a[_0x2e23('0x3b')]['sort']);_0x38d8a3['where']=qs[_0x2e23('0x3d')](_[_0x2e23('0x61')](_0x422c7a[_0x2e23('0x3b')],_0x21ebbc[_0x2e23('0x3d')]));_0x38d8a3[_0x2e23('0x45')][_0x2e23('0x62')]=_0x17ec25['id'];if(_0x422c7a[_0x2e23('0x3b')]['filter']){_0x38d8a3['where']=_['merge'](_0x38d8a3['where'],{'$or':_[_0x2e23('0x35')](_0x38d8a3[_0x2e23('0x40')],function(_0x4d20ff){var _0x53be5e={};_0x53be5e[_0x4d20ff]={'$like':'%'+_0x422c7a[_0x2e23('0x3b')]['filter']+'%'};return _0x53be5e;})});}_0x38d8a3=_[_0x2e23('0x47')]({},_0x38d8a3,_0x422c7a[_0x2e23('0x51')]);return db[_0x2e23('0x5f')]['findAll'](_0x38d8a3);}})[_0x2e23('0x2b')](function(_0x91eb29){if(_0x91eb29){return db[_0x2e23('0x63')][_0x2e23('0x64')]({'where':{'id':_['map'](_0x91eb29,_0x2e23('0x65')),'role':_0x2e23('0x66')},'attributes':['id',_0x2e23('0x32'),'faxPause',_0x2e23('0x67'),_0x2e23('0x68')]});}})[_0x2e23('0x2b')](function(_0x4d8292){if(_0x4d8292){return{'count':_0x4d8292[_0x2e23('0x24')],'rows':_[_0x2e23('0x35')](_0x4d8292[_0x2e23('0x4b')],function(_0xf719c2){return{'membername':_0xf719c2[_0x2e23('0x32')],'UserId':_0xf719c2['id'],'queue_name':_0x17a83f[_0x2e23('0x32')],'FaxQueueId':_0x17a83f['id'],'interface':util[_0x2e23('0x69')](_0x2e23('0x6a'),_0x2e23('0x6b'),_0xf719c2[_0x2e23('0x32')]),'penalty':0x0,'paused':_0xf719c2[_0x2e23('0x6c')],'createdAt':_0xf719c2[_0x2e23('0x68')],'updatedAt':_0xf719c2[_0x2e23('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2e23('0x2b')](respondWithFilteredResult(_0x3e14cb,_0x38d8a3))[_0x2e23('0x4c')](handleError(_0x3e14cb,null));};exports[_0x2e23('0x6d')]=function(_0x5cfc50,_0x2547ca,_0x35f3f5){var _0x1fc68b={};var _0x9d164b={};var _0x88b835;var _0x4564e8;return db[_0x2e23('0x36')][_0x2e23('0x5e')]({'where':{'id':_0x5cfc50[_0x2e23('0x4e')]['id']}})[_0x2e23('0x2b')](handleEntityNotFound(_0x2547ca,null))[_0x2e23('0x2b')](function(_0x29577f){if(_0x29577f){_0x88b835=_0x29577f;_0x9d164b[_0x2e23('0x3a')]=_[_0x2e23('0x3c')](db[_0x2e23('0x6e')][_0x2e23('0x4f')]);_0x9d164b['query']=_[_0x2e23('0x3c')](_0x5cfc50[_0x2e23('0x3b')]);_0x9d164b['filters']=_[_0x2e23('0x3e')](_0x9d164b[_0x2e23('0x3a')],_0x9d164b[_0x2e23('0x3b')]);_0x1fc68b[_0x2e23('0x40')]=_[_0x2e23('0x3e')](_0x9d164b[_0x2e23('0x3a')],qs['fields'](_0x5cfc50[_0x2e23('0x3b')][_0x2e23('0x3f')]));_0x1fc68b[_0x2e23('0x40')]=_0x1fc68b['attributes'][_0x2e23('0x41')]?_0x1fc68b['attributes']:_0x9d164b['model'];_0x1fc68b[_0x2e23('0x43')]=qs[_0x2e23('0x44')](_0x5cfc50[_0x2e23('0x3b')][_0x2e23('0x44')]);_0x1fc68b[_0x2e23('0x45')]=qs['filters'](_[_0x2e23('0x61')](_0x5cfc50[_0x2e23('0x3b')],_0x9d164b['filters']));if(_0x5cfc50[_0x2e23('0x3b')][_0x2e23('0x46')]){_0x1fc68b[_0x2e23('0x45')]=_['merge'](_0x1fc68b[_0x2e23('0x45')],{'$or':_[_0x2e23('0x35')](_0x1fc68b[_0x2e23('0x40')],function(_0x5bd90b){var _0x2128e1={};_0x2128e1[_0x5bd90b]={'$like':'%'+_0x5cfc50['query'][_0x2e23('0x46')]+'%'};return _0x2128e1;})});}_0x1fc68b=_['merge']({},_0x1fc68b,_0x5cfc50['options']);return _0x88b835[_0x2e23('0x6d')](_0x1fc68b);}})[_0x2e23('0x2b')](function(_0x3a83eb){if(_0x3a83eb){_0x4564e8=_0x3a83eb[_0x2e23('0x41')];if(!_0x5cfc50[_0x2e23('0x3b')][_0x2e23('0x42')](_0x2e23('0x60'))){_0x1fc68b[_0x2e23('0x23')]=qs[_0x2e23('0x23')](_0x5cfc50[_0x2e23('0x3b')][_0x2e23('0x23')]);_0x1fc68b[_0x2e23('0x25')]=qs[_0x2e23('0x25')](_0x5cfc50[_0x2e23('0x3b')][_0x2e23('0x25')]);}return _0x88b835[_0x2e23('0x6d')](_0x1fc68b);}})[_0x2e23('0x2b')](function(_0x278fa3){if(_0x278fa3){return _0x278fa3?{'count':_0x4564e8,'rows':_0x278fa3}:null;}})['then'](respondWithResult(_0x2547ca,null))[_0x2e23('0x4c')](handleError(_0x2547ca,null));};exports[_0x2e23('0x6f')]=function(_0x1e8297,_0x53aa17,_0x43899a){var _0x44d78a=_0x1e8297[_0x2e23('0x5a')][_0x2e23('0x70')];return db[_0x2e23('0x6e')][_0x2e23('0x4a')]({'where':{'id':_0x44d78a},'attributes':['id'],'include':[{'model':db[_0x2e23('0x63')],'as':_0x2e23('0x71'),'attributes':['id',_0x2e23('0x32'),_0x2e23('0x72'),_0x2e23('0x73'),_0x2e23('0x74')],'raw':!![]}]})[_0x2e23('0x2b')](function(_0x2a45f7){if(_0x2a45f7){var _0x16fe3d=_[_0x2e23('0x75')](_0x2a45f7,function(_0x21911e){var _0x5a47d8=_0x21911e[_0x2e23('0x2d')]({'plain':!![]});return _0x5a47d8[_0x2e23('0x71')];});return db[_0x2e23('0x36')]['find']({'where':{'id':_0x1e8297['params']['id']}})[_0x2e23('0x2b')](function(_0x5c6c53){return db['sequelize'][_0x2e23('0x76')](function(_0x1107a6){return _0x5c6c53[_0x2e23('0x6f')](_0x44d78a,{'transaction':_0x1107a6})['then'](function(){return BPromise[_0x2e23('0x77')](_0x16fe3d,function(_0x5a721b){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x5a721b['id'],'FaxQueueId':_0x1e8297[_0x2e23('0x4e')]['id']},'transaction':_0x1107a6});});})[_0x2e23('0x2b')](function(){_0x16fe3d[_0x2e23('0x78')](function(_0x269aca){socket[_0x2e23('0x79')]('userFaxQueue:save',{'UserId':_0x269aca['id'],'FaxQueueId':_0x5c6c53['id']});});});});});}})[_0x2e23('0x2b')](respondWithStatusCode(_0x53aa17,null))[_0x2e23('0x4c')](handleError(_0x53aa17,null));};exports[_0x2e23('0x7a')]=function(_0x987630,_0x16fa6f,_0x1ba6a0){return db[_0x2e23('0x6e')][_0x2e23('0x4a')]({'where':{'id':_0x987630[_0x2e23('0x3b')][_0x2e23('0x70')]},'attributes':['id'],'include':[{'model':db[_0x2e23('0x63')],'as':_0x2e23('0x71'),'attributes':['id'],'raw':!![]}]})[_0x2e23('0x2b')](handleEntityNotFound(_0x16fa6f,null))[_0x2e23('0x2b')](function(_0x1a6317){var _0x5e2ca4=_[_0x2e23('0x35')](_0x1a6317,'id');var _0x251e84=[];var _0x54cd32=[];var _0x57a361=squel['select']();_0x57a361['field'](_0x2e23('0x7b'))[_0x2e23('0x7c')](_0x2e23('0x7d'),'tq')[_0x2e23('0x7e')](_0x2e23('0x7f'),'ut',_0x2e23('0x80'))['where'](_0x2e23('0x81'),_0x987630[_0x2e23('0x4e')]['id']);for(var _0xe3e25c=0x0;_0xe3e25c<_0x1a6317[_0x2e23('0x41')];_0xe3e25c+=0x1){let _0xb27b0=_0x1a6317[_0xe3e25c];for(var _0x792806=0x0;_0x792806<_0xb27b0[_0x2e23('0x71')][_0x2e23('0x41')];_0x792806+=0x1){let _0x822576=_0xb27b0['Agents'][_0x792806];var _0x4fd33b=_0x57a361['clone']();_0x4fd33b[_0x2e23('0x45')]('ut.UserId\x20=\x20?',_0x822576['id']);_0x54cd32[_0x2e23('0x82')](db[_0x2e23('0x83')]['query'](_0x4fd33b[_0x2e23('0x84')](),{'type':db[_0x2e23('0x83')]['QueryTypes'][_0x2e23('0x85')]})[_0x2e23('0x2b')](function(_0x19f1d3){if(_0x19f1d3[_0x2e23('0x41')]===0x1){return _0x822576['id'];}else{var _0x594e65=_[_0x2e23('0x86')](_['map'](_0x19f1d3,'TeamId'),function(_0x576422){return _[_0x2e23('0x87')](_0x5e2ca4,_0x576422);});if(_0x594e65){return _0x822576['id'];}}}));}}return BPromise[_0x2e23('0x88')](_0x54cd32)[_0x2e23('0x2b')](function(_0x30e5c2){_0x251e84=_(_0x251e84)['union'](_0x30e5c2)['compact']()[_0x2e23('0x89')]();return db[_0x2e23('0x36')][_0x2e23('0x5b')]({'where':{'id':_0x987630['params']['id']}})[_0x2e23('0x2b')](function(_0x358de4){return db[_0x2e23('0x83')]['transaction'](function(_0x1cc925){return _0x358de4['removeTeams'](_0x987630[_0x2e23('0x3b')][_0x2e23('0x70')],{'transaction':_0x1cc925})[_0x2e23('0x2b')](function(){if(!_[_0x2e23('0x8a')](_0x251e84)){return _0x358de4[_0x2e23('0x8b')](_0x251e84,{'transaction':_0x1cc925});}})[_0x2e23('0x2b')](function(){_0x251e84[_0x2e23('0x78')](function(_0x416b23){socket[_0x2e23('0x79')](_0x2e23('0x8c'),{'UserId':_0x416b23,'FaxQueueId':_0x358de4['id']});});});});});});})[_0x2e23('0x2b')](respondWithStatusCode(_0x16fa6f,null))[_0x2e23('0x4c')](handleError(_0x16fa6f,null));};exports[_0x2e23('0x8d')]=function(_0x46c8c4,_0x720637,_0x371487){return db[_0x2e23('0x36')][_0x2e23('0x5b')]({'where':{'id':_0x46c8c4[_0x2e23('0x4e')]['id']}})[_0x2e23('0x2b')](handleEntityNotFound(_0x720637,null))['then'](function(_0xc3738f){if(_0xc3738f){return _0xc3738f['addAgents'](_0x46c8c4[_0x2e23('0x5a')]['ids'],_['omit'](_0x46c8c4[_0x2e23('0x5a')],['ids','id'])||{})['spread'](function(_0x32327b){for(var _0x162198=0x0;_0x162198<_0x46c8c4['body'][_0x2e23('0x70')][_0x2e23('0x41')];_0x162198+=0x1){socket[_0x2e23('0x79')]('userFaxQueue:save',{'UserId':Number(_0x46c8c4[_0x2e23('0x5a')][_0x2e23('0x70')][_0x162198]),'FaxQueueId':Number(_0x46c8c4[_0x2e23('0x4e')]['id'])});}return _0x32327b;});}})[_0x2e23('0x2b')](respondWithResult(_0x720637,null))[_0x2e23('0x4c')](handleError(_0x720637,null));};exports['removeAgents']=function(_0xee123,_0x263774,_0x141755){return db[_0x2e23('0x36')]['find']({'where':{'id':_0xee123['params']['id']}})[_0x2e23('0x2b')](handleEntityNotFound(_0x263774,null))[_0x2e23('0x2b')](function(_0x5040eb){if(_0x5040eb){return _0x5040eb[_0x2e23('0x8b')](_0xee123[_0x2e23('0x3b')]['ids'])[_0x2e23('0x2b')](function(){if(_[_0x2e23('0x8e')](_0xee123[_0x2e23('0x3b')]['ids'])){for(var _0x559abb=0x0;_0x559abb<_0xee123[_0x2e23('0x3b')]['ids'][_0x2e23('0x41')];_0x559abb+=0x1){socket[_0x2e23('0x79')](_0x2e23('0x8c'),{'UserId':Number(_0xee123['query']['ids'][_0x559abb]),'FaxQueueId':Number(_0xee123[_0x2e23('0x4e')]['id'])});}}else{socket['emit'](_0x2e23('0x8c'),{'UserId':Number(_0xee123[_0x2e23('0x3b')]['ids']),'FaxQueueId':Number(_0xee123['params']['id'])});}});}})['then'](respondWithStatusCode(_0x263774,null))[_0x2e23('0x4c')](handleError(_0x263774,null));};exports[_0x2e23('0x8f')]=function(_0x5b3180,_0x4a8cc7,_0x5dc205){var _0x3fd2c7={};var _0x23ff23={};var _0x2f540c;var _0x59a8ec;return db[_0x2e23('0x36')][_0x2e23('0x5e')]({'where':{'id':_0x5b3180[_0x2e23('0x4e')]['id']}})[_0x2e23('0x2b')](handleEntityNotFound(_0x4a8cc7,null))['then'](function(_0xb8d09d){if(_0xb8d09d){_0x2f540c=_0xb8d09d;_0x23ff23[_0x2e23('0x3a')]=_['keys'](db['User'][_0x2e23('0x4f')]);_0x23ff23[_0x2e23('0x3b')]=_[_0x2e23('0x3c')](_0x5b3180[_0x2e23('0x3b')]);_0x23ff23[_0x2e23('0x3d')]=_['intersection'](_0x23ff23[_0x2e23('0x3a')],_0x23ff23[_0x2e23('0x3b')]);_0x3fd2c7[_0x2e23('0x40')]=_[_0x2e23('0x3e')](_0x23ff23[_0x2e23('0x3a')],qs[_0x2e23('0x3f')](_0x5b3180[_0x2e23('0x3b')][_0x2e23('0x3f')]));_0x3fd2c7[_0x2e23('0x40')]=_0x3fd2c7[_0x2e23('0x40')][_0x2e23('0x41')]?_0x3fd2c7[_0x2e23('0x40')]:_0x23ff23[_0x2e23('0x3a')];_0x3fd2c7[_0x2e23('0x43')]=qs[_0x2e23('0x44')](_0x5b3180[_0x2e23('0x3b')][_0x2e23('0x44')]);_0x3fd2c7['where']=qs[_0x2e23('0x3d')](_['pick'](_0x5b3180[_0x2e23('0x3b')],_0x23ff23[_0x2e23('0x3d')]));if(_0x5b3180['query'][_0x2e23('0x46')]){_0x3fd2c7['where']=_[_0x2e23('0x47')](_0x3fd2c7[_0x2e23('0x45')],{'$or':_['map'](_0x3fd2c7[_0x2e23('0x40')],function(_0x524a56){var _0x1ff679={};_0x1ff679[_0x524a56]={'$like':'%'+_0x5b3180[_0x2e23('0x3b')][_0x2e23('0x46')]+'%'};return _0x1ff679;})});}_0x3fd2c7=_[_0x2e23('0x47')]({},_0x3fd2c7,_0x5b3180[_0x2e23('0x51')]);return _0x2f540c['getAgents'](_0x3fd2c7);}})['then'](function(_0x39094c){if(_0x39094c){_0x59a8ec=_0x39094c[_0x2e23('0x41')];if(!_0x5b3180[_0x2e23('0x3b')][_0x2e23('0x42')](_0x2e23('0x60'))){_0x3fd2c7['limit']=qs[_0x2e23('0x23')](_0x5b3180['query'][_0x2e23('0x23')]);_0x3fd2c7[_0x2e23('0x25')]=qs[_0x2e23('0x25')](_0x5b3180[_0x2e23('0x3b')][_0x2e23('0x25')]);}return _0x2f540c[_0x2e23('0x8f')](_0x3fd2c7);}})['then'](function(_0x409960){if(_0x409960){return _0x409960?{'count':_0x59a8ec,'rows':_0x409960}:null;}})[_0x2e23('0x2b')](respondWithResult(_0x4a8cc7,null))['catch'](handleError(_0x4a8cc7,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index d3af5c3..f339117 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 _0x55e8=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x16e07a,_0x3d4a03){var _0x508dc6=function(_0x2782c4){while(--_0x2782c4){_0x16e07a['push'](_0x16e07a['shift']());}};_0x508dc6(++_0x3d4a03);}(_0x55e8,0x1e1));var _0x855e=function(_0x4940fc,_0x45357a){_0x4940fc=_0x4940fc-0x0;var _0xd590f8=_0x55e8[_0x4940fc];return _0xd590f8;};'use strict';var EventEmitter=require(_0x855e('0x0'));var FaxQueue=require('../../mysqldb')['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x855e('0x1')](0x0);var events={'afterCreate':_0x855e('0x2'),'afterUpdate':_0x855e('0x3'),'afterDestroy':_0x855e('0x4')};function emitEvent(_0x5d6875){return function(_0x186f40,_0x2bd24e,_0x5b0fe9){FaxQueueEvents[_0x855e('0x5')](_0x5d6875+':'+_0x186f40['id'],_0x186f40);FaxQueueEvents['emit'](_0x5d6875,_0x186f40);_0x5b0fe9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x855e('0x6')](e,emitEvent(event));}}module[_0x855e('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xe059=['events','../../mysqldb','FaxQueue','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x4c445a,_0x4ee80f){var _0x2f611c=function(_0x4f3699){while(--_0x4f3699){_0x4c445a['push'](_0x4c445a['shift']());}};_0x2f611c(++_0x4ee80f);}(_0xe059,0xea));var _0x9e05=function(_0x3b3656,_0x1b032a){_0x3b3656=_0x3b3656-0x0;var _0x5a6ffd=_0xe059[_0x3b3656];return _0x5a6ffd;};'use strict';var EventEmitter=require(_0x9e05('0x0'));var FaxQueue=require(_0x9e05('0x1'))['db'][_0x9e05('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9e05('0x3'),'afterDestroy':_0x9e05('0x4')};function emitEvent(_0x3df034){return function(_0x52bb52,_0x581d47,_0x2a6a4f){FaxQueueEvents['emit'](_0x3df034+':'+_0x52bb52['id'],_0x52bb52);FaxQueueEvents[_0x9e05('0x5')](_0x3df034,_0x52bb52);_0x2a6a4f(null);};}for(var e in events){if(events[_0x9e05('0x6')](e)){var event=events[e];FaxQueue[_0x9e05('0x7')](e,emitEvent(event));}}module[_0x9e05('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 7bad8ca..2d692f0 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 _0xbd57=['request-promise','path','../../config/environment','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x1fcd58,_0x4f8a92){var _0x307d25=function(_0x3b0bc0){while(--_0x3b0bc0){_0x1fcd58['push'](_0x1fcd58['shift']());}};_0x307d25(++_0x4f8a92);}(_0xbd57,0xeb));var _0x7bd5=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbd57[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7bd5('0x0'));var util=require(_0x7bd5('0x1'));var logger=require(_0x7bd5('0x2'))(_0x7bd5('0x3'));var moment=require('moment');var BPromise=require(_0x7bd5('0x4'));var rp=require(_0x7bd5('0x5'));var fs=require('fs');var path=require(_0x7bd5('0x6'));var rimraf=require('rimraf');var config=require(_0x7bd5('0x7'));var attributes=require('./faxQueue.attributes');module[_0x7bd5('0x8')]=function(_0x263684,_0x32d31c){return _0x263684[_0x7bd5('0x9')](_0x7bd5('0xa'),attributes,{'tableName':_0x7bd5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf70c=['define','fax_queues','lodash','util','../../config/logger','api','path','./faxQueue.attributes'];(function(_0x4aa156,_0xb9dd89){var _0x3da040=function(_0x3979a0){while(--_0x3979a0){_0x4aa156['push'](_0x4aa156['shift']());}};_0x3da040(++_0xb9dd89);}(_0xf70c,0x1a2));var _0xcf70=function(_0x4fab8f,_0x54c857){_0x4fab8f=_0x4fab8f-0x0;var _0x275495=_0xf70c[_0x4fab8f];return _0x275495;};'use strict';var _=require(_0xcf70('0x0'));var util=require(_0xcf70('0x1'));var logger=require(_0xcf70('0x2'))(_0xcf70('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcf70('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcf70('0x5'));module['exports']=function(_0x56fc33,_0x225728){return _0x56fc33[_0xcf70('0x6')]('FaxQueue',attributes,{'tableName':_0xcf70('0x7'),'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 6f034ee..78a4225 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 _0x6856=['where','attributes','limit','include','model','map','ShowFaxQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','info','result','catch','GetFaxQueue','FaxQueue','options'];(function(_0x512973,_0x564e8b){var _0x32f2e1=function(_0x5d5d3b){while(--_0x5d5d3b){_0x512973['push'](_0x512973['shift']());}};_0x32f2e1(++_0x564e8b);}(_0x6856,0x1ac));var _0x6685=function(_0x36c251,_0x25159c){_0x36c251=_0x36c251-0x0;var _0xa2cbba=_0x6856[_0x36c251];return _0xa2cbba;};'use strict';var _=require(_0x6685('0x0'));var util=require('util');var moment=require(_0x6685('0x1'));var BPromise=require(_0x6685('0x2'));var rs=require(_0x6685('0x3'));var fs=require('fs');var Redis=require(_0x6685('0x4'));var db=require(_0x6685('0x5'))['db'];var utils=require(_0x6685('0x6'));var logger=require(_0x6685('0x7'))(_0x6685('0x8'));var config=require(_0x6685('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6685('0xa')][_0x6685('0xb')]({'port':0x232a});config[_0x6685('0xc')]=_[_0x6685('0xd')](config[_0x6685('0xc')],{'host':_0x6685('0xe'),'port':0x18eb});var socket=require(_0x6685('0xf'))(new Redis(config['redis']));require(_0x6685('0x10'))[_0x6685('0x11')](socket);function respondWithRpcPromise(_0x1b5323,_0x37d366,_0xb9c507){return new BPromise(function(_0x22fd87,_0x6bda05){return client[_0x6685('0x12')](_0x1b5323,_0xb9c507)[_0x6685('0x13')](function(_0x2ea7ba){logger['info']('FaxQueue,\x20%s,\x20%s',_0x37d366,_0x6685('0x14'));logger[_0x6685('0x15')](_0x6685('0x16'),_0x37d366,'request\x20sent',JSON[_0x6685('0x17')](_0x2ea7ba));if(_0x2ea7ba[_0x6685('0x18')]){if(_0x2ea7ba[_0x6685('0x18')][_0x6685('0x19')]===0x1f4){logger[_0x6685('0x18')](_0x6685('0x1a'),_0x37d366,_0x2ea7ba['error'][_0x6685('0x1b')]);return _0x6bda05(_0x2ea7ba[_0x6685('0x18')]['message']);}logger[_0x6685('0x18')](_0x6685('0x1a'),_0x37d366,_0x2ea7ba[_0x6685('0x18')][_0x6685('0x1b')]);return _0x22fd87(_0x2ea7ba[_0x6685('0x18')][_0x6685('0x1b')]);}else{logger[_0x6685('0x1c')](_0x6685('0x1a'),_0x37d366,_0x6685('0x14'));_0x22fd87(_0x2ea7ba[_0x6685('0x1d')][_0x6685('0x1b')]);}})[_0x6685('0x1e')](function(_0x50fc1){logger[_0x6685('0x18')]('FaxQueue,\x20%s,\x20%s',_0x37d366,_0x50fc1);_0x6bda05(_0x50fc1);});});}exports[_0x6685('0x1f')]=function(_0x31fbea){var _0x1723c5=this;return new Promise(function(_0x4c5ce3,_0xbcd45){return db[_0x6685('0x20')]['findAll']({'raw':_0x31fbea['options']?_0x31fbea[_0x6685('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x31fbea[_0x6685('0x21')]?_0x31fbea[_0x6685('0x21')][_0x6685('0x22')]||null:null,'attributes':_0x31fbea[_0x6685('0x21')]?_0x31fbea[_0x6685('0x21')][_0x6685('0x23')]||null:null,'limit':_0x31fbea[_0x6685('0x21')]?_0x31fbea['options'][_0x6685('0x24')]||null:null,'include':_0x31fbea['options']?_0x31fbea[_0x6685('0x21')][_0x6685('0x25')]?_['map'](_0x31fbea[_0x6685('0x21')][_0x6685('0x25')],function(_0x3c5bd1){return{'model':db[_0x3c5bd1[_0x6685('0x26')]],'as':_0x3c5bd1['as'],'attributes':_0x3c5bd1[_0x6685('0x23')],'include':_0x3c5bd1[_0x6685('0x25')]?_[_0x6685('0x27')](_0x3c5bd1[_0x6685('0x25')],function(_0x45ff96){return{'model':db[_0x45ff96[_0x6685('0x26')]],'as':_0x45ff96['as'],'attributes':_0x45ff96[_0x6685('0x23')],'include':_0x45ff96[_0x6685('0x25')]?_[_0x6685('0x27')](_0x45ff96['include'],function(_0x19825e){return{'model':db[_0x19825e[_0x6685('0x26')]],'as':_0x19825e['as'],'attributes':_0x19825e['attributes']};}):[]};}):[]};}):[]:[]})[_0x6685('0x13')](function(_0x2de148){logger[_0x6685('0x1c')](_0x6685('0x1f'),_0x31fbea);logger[_0x6685('0x15')](_0x6685('0x1f'),_0x31fbea,JSON[_0x6685('0x17')](_0x2de148));_0x4c5ce3(_0x2de148);})[_0x6685('0x1e')](function(_0x498fa6){logger[_0x6685('0x18')](_0x6685('0x1f'),_0x498fa6[_0x6685('0x1b')],_0x31fbea);_0xbcd45(_0x1723c5['error'](0x1f4,_0x498fa6[_0x6685('0x1b')]));});});};exports[_0x6685('0x28')]=function(_0x260820){var _0x56f216=this;return new Promise(function(_0x2870db,_0x21ece7){return db[_0x6685('0x20')][_0x6685('0x29')]({'raw':_0x260820[_0x6685('0x21')]?_0x260820[_0x6685('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x260820['options']?_0x260820[_0x6685('0x21')]['where']||null:null,'attributes':_0x260820['options']?_0x260820[_0x6685('0x21')][_0x6685('0x23')]||null:null,'include':_0x260820['options']?_0x260820[_0x6685('0x21')][_0x6685('0x25')]?_[_0x6685('0x27')](_0x260820[_0x6685('0x21')][_0x6685('0x25')],function(_0x2c603d){return{'model':db[_0x2c603d[_0x6685('0x26')]],'as':_0x2c603d['as'],'attributes':_0x2c603d[_0x6685('0x23')],'include':_0x2c603d[_0x6685('0x25')]?_[_0x6685('0x27')](_0x2c603d['include'],function(_0x44bf51){return{'model':db[_0x44bf51['model']],'as':_0x44bf51['as'],'attributes':_0x44bf51[_0x6685('0x23')],'include':_0x44bf51[_0x6685('0x25')]?_['map'](_0x44bf51[_0x6685('0x25')],function(_0x1fcded){return{'model':db[_0x1fcded[_0x6685('0x26')]],'as':_0x1fcded['as'],'attributes':_0x1fcded[_0x6685('0x23')]};}):[]};}):[]};}):[]:[]})[_0x6685('0x13')](function(_0x5df446){logger[_0x6685('0x1c')](_0x6685('0x28'),_0x260820);logger['debug'](_0x6685('0x28'),_0x260820,JSON[_0x6685('0x17')](_0x5df446));_0x2870db(_0x5df446);})[_0x6685('0x1e')](function(_0x1148dd){logger[_0x6685('0x18')](_0x6685('0x28'),_0x1148dd['message'],_0x260820);_0x21ece7(_0x56f216[_0x6685('0x18')](0x1f4,_0x1148dd['message']));});});}; \ No newline at end of file +var _0x8218=['FaxQueue','findAll','options','raw','where','attributes','limit','map','model','include','GetFaxQueue','stringify','ShowFaxQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','message','info','result','catch'];(function(_0x1eb786,_0x1b5f72){var _0x460cad=function(_0x3ec7a6){while(--_0x3ec7a6){_0x1eb786['push'](_0x1eb786['shift']());}};_0x460cad(++_0x1b5f72);}(_0x8218,0xb2));var _0x8821=function(_0x438d4a,_0x70220a){_0x438d4a=_0x438d4a-0x0;var _0x35fe05=_0x8218[_0x438d4a];return _0x35fe05;};'use strict';var _=require(_0x8821('0x0'));var util=require(_0x8821('0x1'));var moment=require('moment');var BPromise=require(_0x8821('0x2'));var rs=require(_0x8821('0x3'));var fs=require('fs');var Redis=require(_0x8821('0x4'));var db=require(_0x8821('0x5'))['db'];var utils=require(_0x8821('0x6'));var logger=require(_0x8821('0x7'))(_0x8821('0x8'));var config=require(_0x8821('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8821('0xa')][_0x8821('0xb')]({'port':0x232a});config['redis']=_[_0x8821('0xc')](config[_0x8821('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x8821('0xe'))(new Redis(config['redis']));require(_0x8821('0xf'))[_0x8821('0x10')](socket);function respondWithRpcPromise(_0x4c9840,_0xeaae30,_0x41f609){return new BPromise(function(_0x3feff1,_0x1ebaca){return client[_0x8821('0x11')](_0x4c9840,_0x41f609)[_0x8821('0x12')](function(_0x11002a){logger['info'](_0x8821('0x13'),_0xeaae30,_0x8821('0x14'));logger[_0x8821('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0xeaae30,_0x8821('0x14'),JSON['stringify'](_0x11002a));if(_0x11002a[_0x8821('0x16')]){if(_0x11002a[_0x8821('0x16')]['code']===0x1f4){logger[_0x8821('0x16')](_0x8821('0x13'),_0xeaae30,_0x11002a[_0x8821('0x16')][_0x8821('0x17')]);return _0x1ebaca(_0x11002a['error'][_0x8821('0x17')]);}logger['error'](_0x8821('0x13'),_0xeaae30,_0x11002a[_0x8821('0x16')][_0x8821('0x17')]);return _0x3feff1(_0x11002a[_0x8821('0x16')]['message']);}else{logger[_0x8821('0x18')](_0x8821('0x13'),_0xeaae30,_0x8821('0x14'));_0x3feff1(_0x11002a[_0x8821('0x19')]['message']);}})[_0x8821('0x1a')](function(_0x12ea9e){logger['error'](_0x8821('0x13'),_0xeaae30,_0x12ea9e);_0x1ebaca(_0x12ea9e);});});}exports['GetFaxQueue']=function(_0x199e00){var _0x31b80c=this;return new Promise(function(_0x4bd6ef,_0x5d3aec){return db[_0x8821('0x1b')][_0x8821('0x1c')]({'raw':_0x199e00['options']?_0x199e00[_0x8821('0x1d')][_0x8821('0x1e')]===undefined?!![]:![]:!![],'where':_0x199e00['options']?_0x199e00[_0x8821('0x1d')][_0x8821('0x1f')]||null:null,'attributes':_0x199e00[_0x8821('0x1d')]?_0x199e00[_0x8821('0x1d')][_0x8821('0x20')]||null:null,'limit':_0x199e00['options']?_0x199e00[_0x8821('0x1d')][_0x8821('0x21')]||null:null,'include':_0x199e00[_0x8821('0x1d')]?_0x199e00[_0x8821('0x1d')]['include']?_[_0x8821('0x22')](_0x199e00['options']['include'],function(_0x32a6df){return{'model':db[_0x32a6df[_0x8821('0x23')]],'as':_0x32a6df['as'],'attributes':_0x32a6df[_0x8821('0x20')],'include':_0x32a6df[_0x8821('0x24')]?_[_0x8821('0x22')](_0x32a6df[_0x8821('0x24')],function(_0x3dcb32){return{'model':db[_0x3dcb32[_0x8821('0x23')]],'as':_0x3dcb32['as'],'attributes':_0x3dcb32['attributes'],'include':_0x3dcb32[_0x8821('0x24')]?_[_0x8821('0x22')](_0x3dcb32['include'],function(_0xbdb526){return{'model':db[_0xbdb526['model']],'as':_0xbdb526['as'],'attributes':_0xbdb526[_0x8821('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8821('0x12')](function(_0x4acce5){logger[_0x8821('0x18')](_0x8821('0x25'),_0x199e00);logger[_0x8821('0x15')](_0x8821('0x25'),_0x199e00,JSON[_0x8821('0x26')](_0x4acce5));_0x4bd6ef(_0x4acce5);})['catch'](function(_0x4a1620){logger['error'](_0x8821('0x25'),_0x4a1620['message'],_0x199e00);_0x5d3aec(_0x31b80c[_0x8821('0x16')](0x1f4,_0x4a1620[_0x8821('0x17')]));});});};exports[_0x8821('0x27')]=function(_0x30d3f4){var _0x5e2af6=this;return new Promise(function(_0x7bff07,_0x1b6450){return db[_0x8821('0x1b')][_0x8821('0x28')]({'raw':_0x30d3f4['options']?_0x30d3f4[_0x8821('0x1d')][_0x8821('0x1e')]===undefined?!![]:![]:!![],'where':_0x30d3f4[_0x8821('0x1d')]?_0x30d3f4[_0x8821('0x1d')][_0x8821('0x1f')]||null:null,'attributes':_0x30d3f4['options']?_0x30d3f4[_0x8821('0x1d')][_0x8821('0x20')]||null:null,'include':_0x30d3f4[_0x8821('0x1d')]?_0x30d3f4['options'][_0x8821('0x24')]?_[_0x8821('0x22')](_0x30d3f4[_0x8821('0x1d')]['include'],function(_0x294c6c){return{'model':db[_0x294c6c['model']],'as':_0x294c6c['as'],'attributes':_0x294c6c[_0x8821('0x20')],'include':_0x294c6c[_0x8821('0x24')]?_[_0x8821('0x22')](_0x294c6c[_0x8821('0x24')],function(_0x496dba){return{'model':db[_0x496dba[_0x8821('0x23')]],'as':_0x496dba['as'],'attributes':_0x496dba['attributes'],'include':_0x496dba[_0x8821('0x24')]?_[_0x8821('0x22')](_0x496dba[_0x8821('0x24')],function(_0x21b0bd){return{'model':db[_0x21b0bd[_0x8821('0x23')]],'as':_0x21b0bd['as'],'attributes':_0x21b0bd['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5ee37b){logger['info'](_0x8821('0x27'),_0x30d3f4);logger[_0x8821('0x15')](_0x8821('0x27'),_0x30d3f4,JSON[_0x8821('0x26')](_0x5ee37b));_0x7bff07(_0x5ee37b);})[_0x8821('0x1a')](function(_0x5015aa){logger[_0x8821('0x16')](_0x8821('0x27'),_0x5015aa['message'],_0x30d3f4);_0x1b6450(_0x5e2af6[_0x8821('0x16')](0x1f4,_0x5015aa[_0x8821('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 10f031c..1a39ea5 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 _0x20ef=['register','faxQueue:','save','remove','emit','removeListener'];(function(_0x29cf54,_0x1be9c5){var _0x35dd6f=function(_0x5cdab2){while(--_0x5cdab2){_0x29cf54['push'](_0x29cf54['shift']());}};_0x35dd6f(++_0x1be9c5);}(_0x20ef,0x9e));var _0xf20e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x20ef[_0x3dd15e];return _0x231fd0;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xf20e('0x0'),_0xf20e('0x1'),'update'];function createListener(_0x399efc,_0x2c11e9){return function(_0x2e66f2){_0x2c11e9[_0xf20e('0x2')](_0x399efc,_0x2e66f2);};}function removeListener(_0x4ee77b,_0x5792a0){return function(){FaxQueueEvents[_0xf20e('0x3')](_0x4ee77b,_0x5792a0);};}exports[_0xf20e('0x4')]=function(_0x141d2b){for(var _0x26b003=0x0,_0x62143b=events['length'];_0x26b003<_0x62143b;_0x26b003++){var _0x146c28=events[_0x26b003];var _0x3330cd=createListener(_0xf20e('0x5')+_0x146c28,_0x141d2b);FaxQueueEvents['on'](_0x146c28,_0x3330cd);}}; \ No newline at end of file +var _0x6f1e=['removeListener','register','./faxQueue.events','save','emit'];(function(_0x1e13fa,_0x1c9b31){var _0x3b875d=function(_0x5eb25c){while(--_0x5eb25c){_0x1e13fa['push'](_0x1e13fa['shift']());}};_0x3b875d(++_0x1c9b31);}(_0x6f1e,0x84));var _0xe6f1=function(_0x15c12d,_0x5e24b7){_0x15c12d=_0x15c12d-0x0;var _0x17beb9=_0x6f1e[_0x15c12d];return _0x17beb9;};'use strict';var FaxQueueEvents=require(_0xe6f1('0x0'));var events=[_0xe6f1('0x1'),'remove','update'];function createListener(_0x1c5941,_0x2840be){return function(_0x1214ee){_0x2840be[_0xe6f1('0x2')](_0x1c5941,_0x1214ee);};}function removeListener(_0x4c56f8,_0x3069d0){return function(){FaxQueueEvents[_0xe6f1('0x3')](_0x4c56f8,_0x3069d0);};}exports[_0xe6f1('0x4')]=function(_0x4d4475){for(var _0x463b3c=0x0,_0x396e2c=events['length'];_0x463b3c<_0x396e2c;_0x463b3c++){var _0x9061d2=events[_0x463b3c];var _0x1292c0=createListener('faxQueue:'+_0x9061d2,_0x4d4475);FaxQueueEvents['on'](_0x9061d2,_0x1292c0);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index b9e0856..d87f581 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 _0x2542=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addAgents','put','update','destroy','delete','removeAgents'];(function(_0x3b4b82,_0x210aab){var _0x2ebf58=function(_0x46504e){while(--_0x46504e){_0x3b4b82['push'](_0x3b4b82['shift']());}};_0x2ebf58(++_0x210aab);}(_0x2542,0x169));var _0x2254=function(_0x405e53,_0x27b8f3){_0x405e53=_0x405e53-0x0;var _0x1395eb=_0x2542[_0x405e53];return _0x1395eb;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x9')](_0x2254('0x10'),auth['isAuthenticated'](),controller[_0x2254('0x11')]);router[_0x2254('0x9')](_0x2254('0x12'),auth[_0x2254('0xc')](),controller['getTeams']);router['get'](_0x2254('0x13'),auth[_0x2254('0xc')](),controller[_0x2254('0x14')]);router[_0x2254('0x15')]('/',auth[_0x2254('0xc')](),controller[_0x2254('0x16')]);router['post'](_0x2254('0x12'),auth[_0x2254('0xc')](),controller['addTeams']);router[_0x2254('0x15')](_0x2254('0x13'),auth[_0x2254('0xc')](),controller[_0x2254('0x17')]);router[_0x2254('0x18')](_0x2254('0xe'),auth['isAuthenticated'](),controller[_0x2254('0x19')]);router['delete'](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0x1a')]);router[_0x2254('0x1b')](_0x2254('0x12'),auth[_0x2254('0xc')](),controller['removeTeams']);router['delete']('/:id/users',auth[_0x2254('0xc')](),controller[_0x2254('0x1c')]);module[_0x2254('0x1d')]=router; \ No newline at end of file +var _0xc359=['isAuthenticated','describe','/:id','show','/:id/members','/:id/users','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get'];(function(_0x49cf85,_0xfdf2d7){var _0x24f687=function(_0x2126ae){while(--_0x2126ae){_0x49cf85['push'](_0x49cf85['shift']());}};_0x24f687(++_0xfdf2d7);}(_0xc359,0x1d9));var _0x9c35=function(_0x4880fd,_0x2cc70d){_0x4880fd=_0x4880fd-0x0;var _0x4a4b50=_0xc359[_0x4880fd];return _0x4a4b50;};'use strict';var multer=require('multer');var util=require(_0x9c35('0x0'));var path=require('path');var timeout=require(_0x9c35('0x1'));var express=require(_0x9c35('0x2'));var router=express[_0x9c35('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9c35('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9c35('0x5'));var controller=require('./faxQueue.controller');router[_0x9c35('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x9c35('0x7')](),controller[_0x9c35('0x8')]);router[_0x9c35('0x6')](_0x9c35('0x9'),auth[_0x9c35('0x7')](),controller[_0x9c35('0xa')]);router['get'](_0x9c35('0xb'),auth[_0x9c35('0x7')](),controller['getMembers']);router['get']('/:id/teams',auth[_0x9c35('0x7')](),controller['getTeams']);router[_0x9c35('0x6')](_0x9c35('0xc'),auth[_0x9c35('0x7')](),controller['getAgents']);router[_0x9c35('0xd')]('/',auth[_0x9c35('0x7')](),controller[_0x9c35('0xe')]);router[_0x9c35('0xd')](_0x9c35('0xf'),auth['isAuthenticated'](),controller[_0x9c35('0x10')]);router[_0x9c35('0xd')](_0x9c35('0xc'),auth[_0x9c35('0x7')](),controller[_0x9c35('0x11')]);router[_0x9c35('0x12')](_0x9c35('0x9'),auth[_0x9c35('0x7')](),controller[_0x9c35('0x13')]);router[_0x9c35('0x14')](_0x9c35('0x9'),auth[_0x9c35('0x7')](),controller[_0x9c35('0x15')]);router[_0x9c35('0x14')](_0x9c35('0xf'),auth['isAuthenticated'](),controller[_0x9c35('0x16')]);router[_0x9c35('0x14')](_0x9c35('0xc'),auth[_0x9c35('0x7')](),controller['removeAgents']);module[_0x9c35('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index d5dfcd8..e355e0b 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 _0x8524=['exports','DATE','STRING'];(function(_0x233826,_0x2a0353){var _0x31cbb8=function(_0x3f08fb){while(--_0x3f08fb){_0x233826['push'](_0x233826['shift']());}};_0x31cbb8(++_0x2a0353);}(_0x8524,0x84));var _0x4852=function(_0x58fe9b,_0x5b725c){_0x58fe9b=_0x58fe9b-0x0;var _0x1af38b=_0x8524[_0x58fe9b];return _0x1af38b;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x4852('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4852('0x1')]},'leaveAt':{'type':Sequelize[_0x4852('0x1')]},'acceptAt':{'type':Sequelize[_0x4852('0x1')]},'exitAt':{'type':Sequelize[_0x4852('0x1')]},'reason':{'type':Sequelize[_0x4852('0x2')]}}; \ No newline at end of file +var _0x0bcb=['DATE','exports','STRING'];(function(_0x4bdc99,_0xad3b35){var _0x296fee=function(_0x5a636a){while(--_0x5a636a){_0x4bdc99['push'](_0x4bdc99['shift']());}};_0x296fee(++_0xad3b35);}(_0x0bcb,0x118));var _0xb0bc=function(_0x44250a,_0x3befd8){_0x44250a=_0x44250a-0x0;var _0x24d83e=_0x0bcb[_0x44250a];return _0x24d83e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xb0bc('0x0')]={'uniqueid':{'type':Sequelize[_0xb0bc('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xb0bc('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xb0bc('0x2')]},'acceptAt':{'type':Sequelize[_0xb0bc('0x2')]},'exitAt':{'type':Sequelize[_0xb0bc('0x2')]},'reason':{'type':Sequelize[_0xb0bc('0x1')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 0d17329..b484f7c 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 _0xc831=['count','limit','set','then','error','name','send','index','FaxQueueReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','create','body','update','params','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x196196,_0x248c82){var _0x495848=function(_0x26dbbf){while(--_0x26dbbf){_0x196196['push'](_0x196196['shift']());}};_0x495848(++_0x248c82);}(_0xc831,0x103));var _0x1c83=function(_0x140157,_0x29b06f){_0x140157=_0x140157-0x0;var _0x3f8e46=_0xc831[_0x140157];return _0x3f8e46;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c83('0x0'));var zipdir=require(_0x1c83('0x1'));var jsonpatch=require(_0x1c83('0x2'));var rp=require(_0x1c83('0x3'));var moment=require(_0x1c83('0x4'));var BPromise=require(_0x1c83('0x5'));var Mustache=require(_0x1c83('0x6'));var util=require(_0x1c83('0x7'));var path=require(_0x1c83('0x8'));var sox=require(_0x1c83('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c83('0xa'));var _=require('lodash');var squel=require(_0x1c83('0xb'));var crypto=require(_0x1c83('0xc'));var jsforce=require(_0x1c83('0xd'));var deskjs=require(_0x1c83('0xe'));var toCsv=require(_0x1c83('0xf'));var querystring=require('querystring');var Papa=require(_0x1c83('0x10'));var Redis=require(_0x1c83('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1c83('0x12'));var hardwareService=require(_0x1c83('0x13'));var logger=require(_0x1c83('0x14'))('api');var utils=require(_0x1c83('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1c83('0x16'))['db'];function respondWithStatusCode(_0x276377,_0x3128ec){_0x3128ec=_0x3128ec||0xcc;return function(_0x20a59f){if(_0x20a59f){return _0x276377[_0x1c83('0x17')](_0x3128ec);}return _0x276377[_0x1c83('0x18')](_0x3128ec)[_0x1c83('0x19')]();};}function respondWithResult(_0x5d5742,_0x43f74e){_0x43f74e=_0x43f74e||0xc8;return function(_0x1be133){if(_0x1be133){return _0x5d5742[_0x1c83('0x18')](_0x43f74e)[_0x1c83('0x1a')](_0x1be133);}};}function respondWithFilteredResult(_0x37ba9b,_0x4e1620){return function(_0x11acf1){if(_0x11acf1){var _0x18a06d=typeof _0x4e1620[_0x1c83('0x1b')]===_0x1c83('0x1c')&&typeof _0x4e1620['limit']===_0x1c83('0x1c');var _0x4a5025=_0x11acf1['count'];var _0x3b3369=_0x18a06d?0x0:_0x4e1620[_0x1c83('0x1b')];var _0x2ec743=_0x18a06d?_0x11acf1[_0x1c83('0x1d')]:_0x4e1620['offset']+_0x4e1620[_0x1c83('0x1e')];var _0x5642aa;if(_0x2ec743>=_0x4a5025){_0x2ec743=_0x4a5025;_0x5642aa=0xc8;}else{_0x5642aa=0xce;}_0x37ba9b[_0x1c83('0x18')](_0x5642aa);return _0x37ba9b[_0x1c83('0x1f')]('Content-Range',_0x3b3369+'-'+_0x2ec743+'/'+_0x4a5025)[_0x1c83('0x1a')](_0x11acf1);}return null;};}function patchUpdates(_0x1b5a71){return function(_0x5aa566){try{jsonpatch['apply'](_0x5aa566,_0x1b5a71,!![]);}catch(_0x4cd6bb){return BPromise['reject'](_0x4cd6bb);}return _0x5aa566['save']();};}function saveUpdates(_0x19abb8,_0x3e216d){return function(_0x5daab4){if(_0x5daab4){return _0x5daab4['update'](_0x19abb8)[_0x1c83('0x20')](function(_0x3c8123){return _0x3c8123;});}return null;};}function removeEntity(_0x2d041f,_0x58a7d5){return function(_0xb21f06){if(_0xb21f06){return _0xb21f06['destroy']()[_0x1c83('0x20')](function(){_0x2d041f[_0x1c83('0x18')](0xcc)[_0x1c83('0x19')]();});}};}function handleEntityNotFound(_0x1096ed,_0x2e452b){return function(_0x2982d3){if(!_0x2982d3){_0x1096ed[_0x1c83('0x17')](0x194);}return _0x2982d3;};}function handleError(_0x2beb2b,_0x2ed4a3){_0x2ed4a3=_0x2ed4a3||0x1f4;return function(_0x578c37){logger[_0x1c83('0x21')](_0x578c37['stack']);if(_0x578c37[_0x1c83('0x22')]){delete _0x578c37['name'];}_0x2beb2b[_0x1c83('0x18')](_0x2ed4a3)[_0x1c83('0x23')](_0x578c37);};}exports[_0x1c83('0x24')]=function(_0x341d8d,_0x3c027b){var _0x282df2={},_0x2671a9={},_0x2fb872={'count':0x0,'rows':[]};var _0x3cf5a2=_['map'](db[_0x1c83('0x25')]['rawAttributes'],function(_0x4af140){return{'name':_0x4af140[_0x1c83('0x26')],'type':_0x4af140[_0x1c83('0x27')][_0x1c83('0x28')]};});_0x2671a9[_0x1c83('0x29')]=_[_0x1c83('0x2a')](_0x3cf5a2,_0x1c83('0x22'));_0x2671a9[_0x1c83('0x2b')]=_[_0x1c83('0x2c')](_0x341d8d['query']);_0x2671a9[_0x1c83('0x2d')]=_[_0x1c83('0x2e')](_0x2671a9[_0x1c83('0x29')],_0x2671a9[_0x1c83('0x2b')]);_0x282df2[_0x1c83('0x2f')]=_['intersection'](_0x2671a9[_0x1c83('0x29')],qs[_0x1c83('0x30')](_0x341d8d[_0x1c83('0x2b')]['fields']));_0x282df2[_0x1c83('0x2f')]=_0x282df2[_0x1c83('0x2f')][_0x1c83('0x31')]?_0x282df2[_0x1c83('0x2f')]:_0x2671a9[_0x1c83('0x29')];if(!_0x341d8d[_0x1c83('0x2b')][_0x1c83('0x32')](_0x1c83('0x33'))){_0x282df2[_0x1c83('0x1e')]=qs['limit'](_0x341d8d[_0x1c83('0x2b')][_0x1c83('0x1e')]);_0x282df2[_0x1c83('0x1b')]=qs[_0x1c83('0x1b')](_0x341d8d[_0x1c83('0x2b')]['offset']);}_0x282df2['order']=qs['sort'](_0x341d8d[_0x1c83('0x2b')]['sort']);_0x282df2[_0x1c83('0x34')]=qs[_0x1c83('0x2d')](_[_0x1c83('0x35')](_0x341d8d[_0x1c83('0x2b')],_0x2671a9[_0x1c83('0x2d')]),_0x3cf5a2);if(_0x341d8d['query']['filter']){_0x282df2['where']=_[_0x1c83('0x36')](_0x282df2[_0x1c83('0x34')],{'$or':_[_0x1c83('0x2a')](_0x3cf5a2,function(_0x10fba4){if(_0x10fba4[_0x1c83('0x27')]!==_0x1c83('0x37')){var _0x24d8c5={};_0x24d8c5[_0x10fba4['name']]={'$like':'%'+_0x341d8d['query'][_0x1c83('0x38')]+'%'};return _0x24d8c5;}})});}_0x282df2=_[_0x1c83('0x36')]({},_0x282df2,_0x341d8d[_0x1c83('0x39')]);var _0x267988={'where':_0x282df2[_0x1c83('0x34')]};return db[_0x1c83('0x25')][_0x1c83('0x1d')](_0x267988)['then'](function(_0x2a0e55){_0x2fb872[_0x1c83('0x1d')]=_0x2a0e55;if(_0x341d8d[_0x1c83('0x2b')][_0x1c83('0x3a')]){_0x282df2[_0x1c83('0x3b')]=[{'all':!![]}];}return db[_0x1c83('0x25')][_0x1c83('0x3c')](_0x282df2);})[_0x1c83('0x20')](function(_0xd9c16c){_0x2fb872[_0x1c83('0x3d')]=_0xd9c16c;return _0x2fb872;})[_0x1c83('0x20')](respondWithFilteredResult(_0x3c027b,_0x282df2))[_0x1c83('0x3e')](handleError(_0x3c027b,null));};exports[_0x1c83('0x3f')]=function(_0x3568f4,_0x5a3ae7){var _0x1ca69b={'raw':!![],'where':{'id':_0x3568f4['params']['id']}},_0x124d55={};_0x124d55[_0x1c83('0x29')]=_[_0x1c83('0x2c')](db[_0x1c83('0x25')][_0x1c83('0x40')]);_0x124d55[_0x1c83('0x2b')]=_[_0x1c83('0x2c')](_0x3568f4[_0x1c83('0x2b')]);_0x124d55[_0x1c83('0x2d')]=_['intersection'](_0x124d55[_0x1c83('0x29')],_0x124d55[_0x1c83('0x2b')]);_0x1ca69b[_0x1c83('0x2f')]=_[_0x1c83('0x2e')](_0x124d55[_0x1c83('0x29')],qs[_0x1c83('0x30')](_0x3568f4[_0x1c83('0x2b')][_0x1c83('0x30')]));_0x1ca69b['attributes']=_0x1ca69b['attributes'][_0x1c83('0x31')]?_0x1ca69b[_0x1c83('0x2f')]:_0x124d55[_0x1c83('0x29')];if(_0x3568f4[_0x1c83('0x2b')][_0x1c83('0x3a')]){_0x1ca69b['include']=[{'all':!![]}];}_0x1ca69b=_[_0x1c83('0x36')]({},_0x1ca69b,_0x3568f4['options']);return db['FaxQueueReport']['find'](_0x1ca69b)[_0x1c83('0x20')](handleEntityNotFound(_0x5a3ae7,null))['then'](respondWithResult(_0x5a3ae7,null))[_0x1c83('0x3e')](handleError(_0x5a3ae7,null));};exports[_0x1c83('0x41')]=function(_0x424a79,_0x216a07){return db[_0x1c83('0x25')][_0x1c83('0x41')](_0x424a79[_0x1c83('0x42')],{})[_0x1c83('0x20')](respondWithResult(_0x216a07,0xc9))['catch'](handleError(_0x216a07,null));};exports[_0x1c83('0x43')]=function(_0x2421d3,_0x320448){if(_0x2421d3[_0x1c83('0x42')]['id']){delete _0x2421d3[_0x1c83('0x42')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x2421d3[_0x1c83('0x44')]['id']}})[_0x1c83('0x20')](handleEntityNotFound(_0x320448,null))[_0x1c83('0x20')](saveUpdates(_0x2421d3[_0x1c83('0x42')],null))[_0x1c83('0x20')](respondWithResult(_0x320448,null))['catch'](handleError(_0x320448,null));};exports[_0x1c83('0x45')]=function(_0x901dc5,_0x16c478){return db['FaxQueueReport'][_0x1c83('0x46')]({'where':{'id':_0x901dc5[_0x1c83('0x44')]['id']}})[_0x1c83('0x20')](handleEntityNotFound(_0x16c478,null))[_0x1c83('0x20')](removeEntity(_0x16c478,null))[_0x1c83('0x3e')](handleError(_0x16c478,null));};exports[_0x1c83('0x47')]=function(_0x6377d6,_0x370291){return db['FaxQueueReport'][_0x1c83('0x47')]()[_0x1c83('0x20')](respondWithResult(_0x370291,null))[_0x1c83('0x3e')](handleError(_0x370291,null));}; \ No newline at end of file +var _0x8e63=['../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','error','name','send','index','map','FaxQueueReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','rimraf','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment'];(function(_0x88694c,_0x1f5c70){var _0x46d87a=function(_0x4a779c){while(--_0x4a779c){_0x88694c['push'](_0x88694c['shift']());}};_0x46d87a(++_0x1f5c70);}(_0x8e63,0x7c));var _0x38e6=function(_0x184c80,_0x33096b){_0x184c80=_0x184c80-0x0;var _0x230d43=_0x8e63[_0x184c80];return _0x230d43;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x38e6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x38e6('0x1'));var moment=require(_0x38e6('0x2'));var BPromise=require(_0x38e6('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x38e6('0x4'));var sox=require(_0x38e6('0x5'));var csv=require(_0x38e6('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x38e6('0x7'));var _=require(_0x38e6('0x8'));var squel=require(_0x38e6('0x9'));var crypto=require(_0x38e6('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x38e6('0x6'));var querystring=require(_0x38e6('0xb'));var Papa=require(_0x38e6('0xc'));var Redis=require(_0x38e6('0xd'));var authService=require(_0x38e6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x38e6('0xf'));var logger=require('../../config/logger')(_0x38e6('0x10'));var utils=require('../../config/utils');var config=require(_0x38e6('0x11'));var licenseUtil=require(_0x38e6('0x12'));var db=require(_0x38e6('0x13'))['db'];function respondWithStatusCode(_0x14d2cf,_0x2e2585){_0x2e2585=_0x2e2585||0xcc;return function(_0x57c207){if(_0x57c207){return _0x14d2cf[_0x38e6('0x14')](_0x2e2585);}return _0x14d2cf[_0x38e6('0x15')](_0x2e2585)['end']();};}function respondWithResult(_0x1fcdeb,_0xfd7f2){_0xfd7f2=_0xfd7f2||0xc8;return function(_0x229f18){if(_0x229f18){return _0x1fcdeb[_0x38e6('0x15')](_0xfd7f2)[_0x38e6('0x16')](_0x229f18);}};}function respondWithFilteredResult(_0x46b525,_0x55208f){return function(_0x279688){if(_0x279688){var _0x36a263=typeof _0x55208f[_0x38e6('0x17')]===_0x38e6('0x18')&&typeof _0x55208f[_0x38e6('0x19')]==='undefined';var _0x91997a=_0x279688['count'];var _0x800418=_0x36a263?0x0:_0x55208f[_0x38e6('0x17')];var _0x57ded4=_0x36a263?_0x279688[_0x38e6('0x1a')]:_0x55208f['offset']+_0x55208f[_0x38e6('0x19')];var _0x521453;if(_0x57ded4>=_0x91997a){_0x57ded4=_0x91997a;_0x521453=0xc8;}else{_0x521453=0xce;}_0x46b525[_0x38e6('0x15')](_0x521453);return _0x46b525[_0x38e6('0x1b')](_0x38e6('0x1c'),_0x800418+'-'+_0x57ded4+'/'+_0x91997a)[_0x38e6('0x16')](_0x279688);}return null;};}function patchUpdates(_0x3f1d54){return function(_0x41bb24){try{jsonpatch['apply'](_0x41bb24,_0x3f1d54,!![]);}catch(_0x5f3f67){return BPromise['reject'](_0x5f3f67);}return _0x41bb24[_0x38e6('0x1d')]();};}function saveUpdates(_0x58dc63,_0x4a82f6){return function(_0x2d995f){if(_0x2d995f){return _0x2d995f[_0x38e6('0x1e')](_0x58dc63)[_0x38e6('0x1f')](function(_0x2a8a11){return _0x2a8a11;});}return null;};}function removeEntity(_0x5f5ab2,_0x140fc3){return function(_0x4530a7){if(_0x4530a7){return _0x4530a7[_0x38e6('0x20')]()['then'](function(){_0x5f5ab2[_0x38e6('0x15')](0xcc)[_0x38e6('0x21')]();});}};}function handleEntityNotFound(_0x24e3d6,_0x9bc0b0){return function(_0x106424){if(!_0x106424){_0x24e3d6[_0x38e6('0x14')](0x194);}return _0x106424;};}function handleError(_0x179145,_0x167b28){_0x167b28=_0x167b28||0x1f4;return function(_0x4a261a){logger[_0x38e6('0x22')](_0x4a261a['stack']);if(_0x4a261a[_0x38e6('0x23')]){delete _0x4a261a[_0x38e6('0x23')];}_0x179145[_0x38e6('0x15')](_0x167b28)[_0x38e6('0x24')](_0x4a261a);};}exports[_0x38e6('0x25')]=function(_0x1afc04,_0x1d4a1b){var _0x5a4912={},_0xe93f18={},_0x1980a4={'count':0x0,'rows':[]};var _0x48f5a2=_[_0x38e6('0x26')](db[_0x38e6('0x27')]['rawAttributes'],function(_0x468310){return{'name':_0x468310[_0x38e6('0x28')],'type':_0x468310[_0x38e6('0x29')][_0x38e6('0x2a')]};});_0xe93f18[_0x38e6('0x2b')]=_[_0x38e6('0x26')](_0x48f5a2,_0x38e6('0x23'));_0xe93f18['query']=_[_0x38e6('0x2c')](_0x1afc04[_0x38e6('0x2d')]);_0xe93f18[_0x38e6('0x2e')]=_[_0x38e6('0x2f')](_0xe93f18[_0x38e6('0x2b')],_0xe93f18[_0x38e6('0x2d')]);_0x5a4912[_0x38e6('0x30')]=_['intersection'](_0xe93f18[_0x38e6('0x2b')],qs[_0x38e6('0x31')](_0x1afc04[_0x38e6('0x2d')][_0x38e6('0x31')]));_0x5a4912[_0x38e6('0x30')]=_0x5a4912[_0x38e6('0x30')][_0x38e6('0x32')]?_0x5a4912['attributes']:_0xe93f18[_0x38e6('0x2b')];if(!_0x1afc04[_0x38e6('0x2d')][_0x38e6('0x33')](_0x38e6('0x34'))){_0x5a4912['limit']=qs[_0x38e6('0x19')](_0x1afc04[_0x38e6('0x2d')]['limit']);_0x5a4912[_0x38e6('0x17')]=qs[_0x38e6('0x17')](_0x1afc04[_0x38e6('0x2d')][_0x38e6('0x17')]);}_0x5a4912['order']=qs[_0x38e6('0x35')](_0x1afc04[_0x38e6('0x2d')][_0x38e6('0x35')]);_0x5a4912[_0x38e6('0x36')]=qs['filters'](_[_0x38e6('0x37')](_0x1afc04[_0x38e6('0x2d')],_0xe93f18[_0x38e6('0x2e')]),_0x48f5a2);if(_0x1afc04[_0x38e6('0x2d')][_0x38e6('0x38')]){_0x5a4912[_0x38e6('0x36')]=_[_0x38e6('0x39')](_0x5a4912['where'],{'$or':_[_0x38e6('0x26')](_0x48f5a2,function(_0x3ac91f){if(_0x3ac91f['type']!=='VIRTUAL'){var _0x3b1eb9={};_0x3b1eb9[_0x3ac91f[_0x38e6('0x23')]]={'$like':'%'+_0x1afc04[_0x38e6('0x2d')][_0x38e6('0x38')]+'%'};return _0x3b1eb9;}})});}_0x5a4912=_[_0x38e6('0x39')]({},_0x5a4912,_0x1afc04[_0x38e6('0x3a')]);var _0x1c80eb={'where':_0x5a4912[_0x38e6('0x36')]};return db[_0x38e6('0x27')][_0x38e6('0x1a')](_0x1c80eb)['then'](function(_0x1e2e3f){_0x1980a4[_0x38e6('0x1a')]=_0x1e2e3f;if(_0x1afc04[_0x38e6('0x2d')][_0x38e6('0x3b')]){_0x5a4912[_0x38e6('0x3c')]=[{'all':!![]}];}return db['FaxQueueReport'][_0x38e6('0x3d')](_0x5a4912);})['then'](function(_0x7a8077){_0x1980a4[_0x38e6('0x3e')]=_0x7a8077;return _0x1980a4;})[_0x38e6('0x1f')](respondWithFilteredResult(_0x1d4a1b,_0x5a4912))[_0x38e6('0x3f')](handleError(_0x1d4a1b,null));};exports[_0x38e6('0x40')]=function(_0x557a25,_0x44e6af){var _0x3166fb={'raw':!![],'where':{'id':_0x557a25[_0x38e6('0x41')]['id']}},_0x5f4ae3={};_0x5f4ae3[_0x38e6('0x2b')]=_[_0x38e6('0x2c')](db['FaxQueueReport'][_0x38e6('0x42')]);_0x5f4ae3[_0x38e6('0x2d')]=_['keys'](_0x557a25[_0x38e6('0x2d')]);_0x5f4ae3[_0x38e6('0x2e')]=_[_0x38e6('0x2f')](_0x5f4ae3[_0x38e6('0x2b')],_0x5f4ae3[_0x38e6('0x2d')]);_0x3166fb['attributes']=_[_0x38e6('0x2f')](_0x5f4ae3['model'],qs[_0x38e6('0x31')](_0x557a25[_0x38e6('0x2d')]['fields']));_0x3166fb[_0x38e6('0x30')]=_0x3166fb[_0x38e6('0x30')]['length']?_0x3166fb[_0x38e6('0x30')]:_0x5f4ae3[_0x38e6('0x2b')];if(_0x557a25[_0x38e6('0x2d')]['includeAll']){_0x3166fb[_0x38e6('0x3c')]=[{'all':!![]}];}_0x3166fb=_[_0x38e6('0x39')]({},_0x3166fb,_0x557a25[_0x38e6('0x3a')]);return db['FaxQueueReport']['find'](_0x3166fb)[_0x38e6('0x1f')](handleEntityNotFound(_0x44e6af,null))[_0x38e6('0x1f')](respondWithResult(_0x44e6af,null))['catch'](handleError(_0x44e6af,null));};exports[_0x38e6('0x43')]=function(_0x191de3,_0x2eadb4){return db[_0x38e6('0x27')][_0x38e6('0x43')](_0x191de3[_0x38e6('0x44')],{})[_0x38e6('0x1f')](respondWithResult(_0x2eadb4,0xc9))['catch'](handleError(_0x2eadb4,null));};exports['update']=function(_0x447808,_0x5d1e7b){if(_0x447808[_0x38e6('0x44')]['id']){delete _0x447808[_0x38e6('0x44')]['id'];}return db['FaxQueueReport']['find']({'where':{'id':_0x447808[_0x38e6('0x41')]['id']}})[_0x38e6('0x1f')](handleEntityNotFound(_0x5d1e7b,null))['then'](saveUpdates(_0x447808[_0x38e6('0x44')],null))['then'](respondWithResult(_0x5d1e7b,null))['catch'](handleError(_0x5d1e7b,null));};exports[_0x38e6('0x20')]=function(_0x432179,_0x385de7){return db[_0x38e6('0x27')][_0x38e6('0x45')]({'where':{'id':_0x432179['params']['id']}})[_0x38e6('0x1f')](handleEntityNotFound(_0x385de7,null))[_0x38e6('0x1f')](removeEntity(_0x385de7,null))[_0x38e6('0x3f')](handleError(_0x385de7,null));};exports[_0x38e6('0x46')]=function(_0x15f2c1,_0x361ff6){return db[_0x38e6('0x27')]['describe']()['then'](respondWithResult(_0x361ff6,null))['catch'](handleError(_0x361ff6,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 4a3e4e1..9f04d05 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 _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x5e7855,_0x16db93){var _0x21b089=function(_0x75267e){while(--_0x75267e){_0x5e7855['push'](_0x5e7855['shift']());}};_0x21b089(++_0x16db93);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x6fbc80,_0x355ace){_0x6fbc80=_0x6fbc80-0x0;var _0x57c2ff=_0x7fbe[_0x6fbc80];return _0x57c2ff;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','../../config/logger','api'];(function(_0x22d588,_0x332a74){var _0x391b5e=function(_0xd21e02){while(--_0xd21e02){_0x22d588['push'](_0x22d588['shift']());}};_0x391b5e(++_0x332a74);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x38e8b0,_0x5b8cb5){_0x38e8b0=_0x38e8b0-0x0;var _0x139697=_0x7fbe[_0x38e8b0];return _0x139697;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xe7fb('0xc'),'fields':[_0xe7fb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 67902cd..fb143fa 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 _0x0cf9=['body','options','raw','where','limit','UpdateFaxQueueReport','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','FaxQueueReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0cf9,0xd8));var _0x90cf=function(_0x33b259,_0x2036be){_0x33b259=_0x33b259-0x0;var _0xf95548=_0x0cf9[_0x33b259];return _0xf95548;};'use strict';var _=require(_0x90cf('0x0'));var util=require('util');var moment=require(_0x90cf('0x1'));var BPromise=require(_0x90cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x90cf('0x3'));var db=require(_0x90cf('0x4'))['db'];var utils=require(_0x90cf('0x5'));var logger=require(_0x90cf('0x6'))(_0x90cf('0x7'));var config=require(_0x90cf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x90cf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38c052,_0x1817d1,_0x1b2dd8){return new BPromise(function(_0x16a881,_0x2395ed){return client['request'](_0x38c052,_0x1b2dd8)[_0x90cf('0xa')](function(_0x5cc908){logger[_0x90cf('0xb')](_0x90cf('0xc'),_0x1817d1,'request\x20sent');logger[_0x90cf('0xd')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1817d1,_0x90cf('0xe'),JSON[_0x90cf('0xf')](_0x5cc908));if(_0x5cc908[_0x90cf('0x10')]){if(_0x5cc908[_0x90cf('0x10')][_0x90cf('0x11')]===0x1f4){logger['error'](_0x90cf('0xc'),_0x1817d1,_0x5cc908['error'][_0x90cf('0x12')]);return _0x2395ed(_0x5cc908[_0x90cf('0x10')][_0x90cf('0x12')]);}logger[_0x90cf('0x10')](_0x90cf('0xc'),_0x1817d1,_0x5cc908[_0x90cf('0x10')]['message']);return _0x16a881(_0x5cc908[_0x90cf('0x10')]['message']);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x1817d1,_0x90cf('0xe'));_0x16a881(_0x5cc908[_0x90cf('0x13')]['message']);}})[_0x90cf('0x14')](function(_0x3c4252){logger[_0x90cf('0x10')](_0x90cf('0xc'),_0x1817d1,_0x3c4252);_0x2395ed(_0x3c4252);});});}exports[_0x90cf('0x15')]=function(_0x556059){var _0x29f4a6=this;return new Promise(function(_0x17deee,_0x305761){return db[_0x90cf('0x16')][_0x90cf('0x17')](_0x556059[_0x90cf('0x18')],{'raw':_0x556059[_0x90cf('0x19')]?_0x556059[_0x90cf('0x19')][_0x90cf('0x1a')]===undefined?!![]:![]:!![]})[_0x90cf('0xa')](function(_0x512ab3){logger[_0x90cf('0xb')](_0x90cf('0x15'),_0x556059);logger[_0x90cf('0xd')](_0x90cf('0x15'),_0x556059,JSON[_0x90cf('0xf')](_0x512ab3));_0x17deee(_0x512ab3);})[_0x90cf('0x14')](function(_0x1efe4c){logger[_0x90cf('0x10')](_0x90cf('0x15'),_0x1efe4c[_0x90cf('0x12')],_0x556059);_0x305761(_0x29f4a6[_0x90cf('0x10')](0x1f4,_0x1efe4c[_0x90cf('0x12')]));});});};exports['UpdateFaxQueueReport']=function(_0x354a9f){var _0xaf9a3f=this;return new Promise(function(_0x527f93,_0xf00fbe){return db[_0x90cf('0x16')]['update'](_0x354a9f[_0x90cf('0x18')],{'raw':_0x354a9f[_0x90cf('0x19')]?_0x354a9f[_0x90cf('0x19')][_0x90cf('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x354a9f[_0x90cf('0x19')]?_0x354a9f['options'][_0x90cf('0x1b')]||null:null,'attributes':_0x354a9f[_0x90cf('0x19')]?_0x354a9f['options']['attributes']||null:null,'limit':_0x354a9f[_0x90cf('0x19')]?_0x354a9f[_0x90cf('0x19')][_0x90cf('0x1c')]||null:null})[_0x90cf('0xa')](function(_0x1989da){logger[_0x90cf('0xb')]('UpdateFaxQueueReport',_0x354a9f);logger[_0x90cf('0xd')](_0x90cf('0x1d'),_0x354a9f,JSON['stringify'](_0x1989da));_0x527f93(_0x1989da);})[_0x90cf('0x14')](function(_0x506581){logger[_0x90cf('0x10')](_0x90cf('0x1d'),_0x506581['message'],_0x354a9f);_0xf00fbe(_0xaf9a3f[_0x90cf('0x10')](0x1f4,_0x506581['message']));});});}; \ No newline at end of file +var _0x4622=['CreateFaxQueueReport','create','raw','UpdateFaxQueueReport','FaxQueueReport','update','body','options','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch'];(function(_0x4224c9,_0x4715b4){var _0xa815d=function(_0x38a8e7){while(--_0x38a8e7){_0x4224c9['push'](_0x4224c9['shift']());}};_0xa815d(++_0x4715b4);}(_0x4622,0x1e6));var _0x2462=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0x4622[_0x1602ef];return _0x5870ee;};'use strict';var _=require(_0x2462('0x0'));var util=require('util');var moment=require(_0x2462('0x1'));var BPromise=require(_0x2462('0x2'));var rs=require(_0x2462('0x3'));var fs=require('fs');var Redis=require(_0x2462('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2462('0x5'));var logger=require(_0x2462('0x6'))(_0x2462('0x7'));var config=require(_0x2462('0x8'));var jayson=require(_0x2462('0x9'));var client=jayson[_0x2462('0xa')][_0x2462('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d8e3e,_0x17434c,_0x17506b){return new BPromise(function(_0x1cb9ca,_0x5e1a79){return client[_0x2462('0xc')](_0x2d8e3e,_0x17506b)[_0x2462('0xd')](function(_0x3292aa){logger[_0x2462('0xe')](_0x2462('0xf'),_0x17434c,_0x2462('0x10'));logger[_0x2462('0x11')](_0x2462('0x12'),_0x17434c,_0x2462('0x10'),JSON[_0x2462('0x13')](_0x3292aa));if(_0x3292aa['error']){if(_0x3292aa['error'][_0x2462('0x14')]===0x1f4){logger[_0x2462('0x15')]('FaxQueueReport,\x20%s,\x20%s',_0x17434c,_0x3292aa['error'][_0x2462('0x16')]);return _0x5e1a79(_0x3292aa[_0x2462('0x15')]['message']);}logger[_0x2462('0x15')](_0x2462('0xf'),_0x17434c,_0x3292aa['error'][_0x2462('0x16')]);return _0x1cb9ca(_0x3292aa[_0x2462('0x15')][_0x2462('0x16')]);}else{logger['info'](_0x2462('0xf'),_0x17434c,'request\x20sent');_0x1cb9ca(_0x3292aa['result']['message']);}})[_0x2462('0x17')](function(_0xea357e){logger[_0x2462('0x15')]('FaxQueueReport,\x20%s,\x20%s',_0x17434c,_0xea357e);_0x5e1a79(_0xea357e);});});}exports[_0x2462('0x18')]=function(_0x4b06c0){var _0x483d08=this;return new Promise(function(_0x5933ae,_0x2ae913){return db['FaxQueueReport'][_0x2462('0x19')](_0x4b06c0['body'],{'raw':_0x4b06c0['options']?_0x4b06c0['options'][_0x2462('0x1a')]===undefined?!![]:![]:!![]})[_0x2462('0xd')](function(_0xa9dbae){logger[_0x2462('0xe')](_0x2462('0x18'),_0x4b06c0);logger[_0x2462('0x11')](_0x2462('0x18'),_0x4b06c0,JSON[_0x2462('0x13')](_0xa9dbae));_0x5933ae(_0xa9dbae);})[_0x2462('0x17')](function(_0x571b51){logger[_0x2462('0x15')](_0x2462('0x18'),_0x571b51[_0x2462('0x16')],_0x4b06c0);_0x2ae913(_0x483d08['error'](0x1f4,_0x571b51[_0x2462('0x16')]));});});};exports[_0x2462('0x1b')]=function(_0x388c2b){var _0x5224a1=this;return new Promise(function(_0xf06453,_0x591ba6){return db[_0x2462('0x1c')][_0x2462('0x1d')](_0x388c2b[_0x2462('0x1e')],{'raw':_0x388c2b[_0x2462('0x1f')]?_0x388c2b[_0x2462('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x388c2b['options']?_0x388c2b[_0x2462('0x1f')]['where']||null:null,'attributes':_0x388c2b[_0x2462('0x1f')]?_0x388c2b[_0x2462('0x1f')][_0x2462('0x20')]||null:null,'limit':_0x388c2b['options']?_0x388c2b[_0x2462('0x1f')][_0x2462('0x21')]||null:null})[_0x2462('0xd')](function(_0x2ad960){logger[_0x2462('0xe')](_0x2462('0x1b'),_0x388c2b);logger[_0x2462('0x11')](_0x2462('0x1b'),_0x388c2b,JSON[_0x2462('0x13')](_0x2ad960));_0xf06453(_0x2ad960);})[_0x2462('0x17')](function(_0x1b578a){logger[_0x2462('0x15')](_0x2462('0x1b'),_0x1b578a['message'],_0x388c2b);_0x591ba6(_0x5224a1[_0x2462('0x15')](0x1f4,_0x1b578a[_0x2462('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 3498e61..94aebc3 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 _0x69a9=['get','isAuthenticated','index','describe','/:id','post','create','put','update','delete','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller'];(function(_0x384e08,_0xa03d79){var _0x171a0c=function(_0x4046be){while(--_0x4046be){_0x384e08['push'](_0x384e08['shift']());}};_0x171a0c(++_0xa03d79);}(_0x69a9,0x1ad));var _0x969a=function(_0x36ccc1,_0xcd7e2e){_0x36ccc1=_0x36ccc1-0x0;var _0x3ac406=_0x69a9[_0x36ccc1];return _0x3ac406;};'use strict';var multer=require(_0x969a('0x0'));var util=require(_0x969a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x969a('0x2'));var router=express[_0x969a('0x3')]();var fs_extra=require(_0x969a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x969a('0x5'));var config=require(_0x969a('0x6'));var controller=require(_0x969a('0x7'));router[_0x969a('0x8')]('/',auth[_0x969a('0x9')](),controller[_0x969a('0xa')]);router[_0x969a('0x8')]('/describe',auth[_0x969a('0x9')](),controller[_0x969a('0xb')]);router[_0x969a('0x8')](_0x969a('0xc'),auth[_0x969a('0x9')](),controller['show']);router[_0x969a('0xd')]('/',auth['isAuthenticated'](),controller[_0x969a('0xe')]);router[_0x969a('0xf')](_0x969a('0xc'),auth[_0x969a('0x9')](),controller[_0x969a('0x10')]);router[_0x969a('0x11')](_0x969a('0xc'),auth[_0x969a('0x9')](),controller['destroy']);module[_0x969a('0x12')]=router; \ No newline at end of file +var _0xd110=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','show','post','create','put','/:id','update','destroy','exports','multer','util','path'];(function(_0x586fbf,_0x3bd6d9){var _0x36da27=function(_0x31e4a9){while(--_0x31e4a9){_0x586fbf['push'](_0x586fbf['shift']());}};_0x36da27(++_0x3bd6d9);}(_0xd110,0x1e0));var _0x0d11=function(_0x3ad87b,_0x51eb29){_0x3ad87b=_0x3ad87b-0x0;var _0xccf917=_0xd110[_0x3ad87b];return _0xccf917;};'use strict';var multer=require(_0x0d11('0x0'));var util=require(_0x0d11('0x1'));var path=require(_0x0d11('0x2'));var timeout=require(_0x0d11('0x3'));var express=require(_0x0d11('0x4'));var router=express[_0x0d11('0x5')]();var fs_extra=require(_0x0d11('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x0d11('0x7'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router['get']('/',auth[_0x0d11('0x8')](),controller[_0x0d11('0x9')]);router[_0x0d11('0xa')](_0x0d11('0xb'),auth['isAuthenticated'](),controller[_0x0d11('0xc')]);router[_0x0d11('0xa')]('/:id',auth[_0x0d11('0x8')](),controller[_0x0d11('0xd')]);router[_0x0d11('0xe')]('/',auth[_0x0d11('0x8')](),controller[_0x0d11('0xf')]);router[_0x0d11('0x10')](_0x0d11('0x11'),auth[_0x0d11('0x8')](),controller[_0x0d11('0x12')]);router['delete'](_0x0d11('0x11'),auth[_0x0d11('0x8')](),controller[_0x0d11('0x13')]);module[_0x0d11('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 b44aec2..4179499 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x311cfe,_0x42e904){var _0x40ce33=function(_0x29b0f4){while(--_0x29b0f4){_0x311cfe['push'](_0x311cfe['shift']());}};_0x40ce33(++_0x42e904);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x29bb66,_0x5c50be){var _0x147810=function(_0x3239e5){while(--_0x3239e5){_0x29bb66['push'](_0x29bb66['shift']());}};_0x147810(++_0x5c50be);}(_0x70e0,0x17b));var _0x070e=function(_0x14cc97,_0x31fbcb){_0x14cc97=_0x14cc97-0x0;var _0x2a0a14=_0x70e0[_0x14cc97];return _0x2a0a14;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 8c7ae75..b333856 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 _0x92d1=['path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','error','stack','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','rows','catch','show','params','keys','includeAll','include','find','create','body','update','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x1290f9,_0x2b5543){var _0x303ba8=function(_0x458a59){while(--_0x458a59){_0x1290f9['push'](_0x1290f9['shift']());}};_0x303ba8(++_0x2b5543);}(_0x92d1,0x90));var _0x192d=function(_0x42a4ab,_0x225c6f){_0x42a4ab=_0x42a4ab-0x0;var _0x468a42=_0x92d1[_0x42a4ab];return _0x468a42;};'use strict';var emlformat=require(_0x192d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x192d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x192d('0x2'));var moment=require(_0x192d('0x3'));var BPromise=require(_0x192d('0x4'));var Mustache=require(_0x192d('0x5'));var util=require('util');var path=require(_0x192d('0x6'));var sox=require(_0x192d('0x7'));var csv=require(_0x192d('0x8'));var ejs=require(_0x192d('0x9'));var fs=require('fs');var fs_extra=require(_0x192d('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x192d('0xb'));var jsforce=require(_0x192d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x192d('0x8'));var querystring=require(_0x192d('0xd'));var Papa=require('papaparse');var Redis=require(_0x192d('0xe'));var authService=require(_0x192d('0xf'));var qs=require(_0x192d('0x10'));var as=require(_0x192d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x192d('0x12'))(_0x192d('0x13'));var utils=require(_0x192d('0x14'));var config=require(_0x192d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x192d('0x16'))['db'];function respondWithStatusCode(_0xba5c97,_0x1312c5){_0x1312c5=_0x1312c5||0xcc;return function(_0x1499a8){if(_0x1499a8){return _0xba5c97[_0x192d('0x17')](_0x1312c5);}return _0xba5c97[_0x192d('0x18')](_0x1312c5)[_0x192d('0x19')]();};}function respondWithResult(_0x38664b,_0xbeb99d){_0xbeb99d=_0xbeb99d||0xc8;return function(_0x4d1d6e){if(_0x4d1d6e){return _0x38664b['status'](_0xbeb99d)['json'](_0x4d1d6e);}};}function respondWithFilteredResult(_0x582a11,_0x164801){return function(_0x474b){if(_0x474b){var _0x23682e=typeof _0x164801[_0x192d('0x1a')]===_0x192d('0x1b')&&typeof _0x164801[_0x192d('0x1c')]===_0x192d('0x1b');var _0x52ad07=_0x474b[_0x192d('0x1d')];var _0x611490=_0x23682e?0x0:_0x164801[_0x192d('0x1a')];var _0x293b27=_0x23682e?_0x474b[_0x192d('0x1d')]:_0x164801[_0x192d('0x1a')]+_0x164801['limit'];var _0x17a90b;if(_0x293b27>=_0x52ad07){_0x293b27=_0x52ad07;_0x17a90b=0xc8;}else{_0x17a90b=0xce;}_0x582a11[_0x192d('0x18')](_0x17a90b);return _0x582a11['set'](_0x192d('0x1e'),_0x611490+'-'+_0x293b27+'/'+_0x52ad07)['json'](_0x474b);}return null;};}function patchUpdates(_0x2b966b){return function(_0x4da481){try{jsonpatch[_0x192d('0x1f')](_0x4da481,_0x2b966b,!![]);}catch(_0x329189){return BPromise[_0x192d('0x20')](_0x329189);}return _0x4da481['save']();};}function saveUpdates(_0x20d5c5,_0x41384c){return function(_0xc591fb){if(_0xc591fb){return _0xc591fb['update'](_0x20d5c5)[_0x192d('0x21')](function(_0x18af6b){return _0x18af6b;});}return null;};}function removeEntity(_0x51a0cd,_0x4abd3f){return function(_0x82aa71){if(_0x82aa71){return _0x82aa71[_0x192d('0x22')]()['then'](function(){_0x51a0cd[_0x192d('0x18')](0xcc)[_0x192d('0x19')]();});}};}function handleEntityNotFound(_0x33ce9d,_0x419b4d){return function(_0x392dca){if(!_0x392dca){_0x33ce9d['sendStatus'](0x194);}return _0x392dca;};}function handleError(_0x1f95f4,_0x15c3d3){_0x15c3d3=_0x15c3d3||0x1f4;return function(_0x36fa42){logger[_0x192d('0x23')](_0x36fa42[_0x192d('0x24')]);if(_0x36fa42['name']){delete _0x36fa42['name'];}_0x1f95f4[_0x192d('0x18')](_0x15c3d3)[_0x192d('0x25')](_0x36fa42);};}exports[_0x192d('0x26')]=function(_0x331f88,_0x15740b){var _0x36b0ef={},_0x42eac1={},_0xebaa0={'count':0x0,'rows':[]};var _0x552cc8=_[_0x192d('0x27')](db[_0x192d('0x28')][_0x192d('0x29')],function(_0x2cb0ab){return{'name':_0x2cb0ab[_0x192d('0x2a')],'type':_0x2cb0ab[_0x192d('0x2b')][_0x192d('0x2c')]};});_0x42eac1[_0x192d('0x2d')]=_[_0x192d('0x27')](_0x552cc8,'name');_0x42eac1[_0x192d('0x2e')]=_['keys'](_0x331f88[_0x192d('0x2e')]);_0x42eac1[_0x192d('0x2f')]=_[_0x192d('0x30')](_0x42eac1[_0x192d('0x2d')],_0x42eac1['query']);_0x36b0ef['attributes']=_[_0x192d('0x30')](_0x42eac1[_0x192d('0x2d')],qs[_0x192d('0x31')](_0x331f88['query'][_0x192d('0x31')]));_0x36b0ef[_0x192d('0x32')]=_0x36b0ef['attributes'][_0x192d('0x33')]?_0x36b0ef[_0x192d('0x32')]:_0x42eac1[_0x192d('0x2d')];if(!_0x331f88[_0x192d('0x2e')][_0x192d('0x34')](_0x192d('0x35'))){_0x36b0ef['limit']=qs[_0x192d('0x1c')](_0x331f88['query'][_0x192d('0x1c')]);_0x36b0ef[_0x192d('0x1a')]=qs['offset'](_0x331f88[_0x192d('0x2e')][_0x192d('0x1a')]);}_0x36b0ef[_0x192d('0x36')]=qs['sort'](_0x331f88[_0x192d('0x2e')][_0x192d('0x37')]);_0x36b0ef[_0x192d('0x38')]=qs[_0x192d('0x2f')](_[_0x192d('0x39')](_0x331f88['query'],_0x42eac1[_0x192d('0x2f')]),_0x552cc8);if(_0x331f88[_0x192d('0x2e')][_0x192d('0x3a')]){_0x36b0ef[_0x192d('0x38')]=_[_0x192d('0x3b')](_0x36b0ef[_0x192d('0x38')],{'$or':_[_0x192d('0x27')](_0x552cc8,function(_0x1a7b0a){if(_0x1a7b0a[_0x192d('0x2b')]!==_0x192d('0x3c')){var _0x42e107={};_0x42e107[_0x1a7b0a[_0x192d('0x3d')]]={'$like':'%'+_0x331f88[_0x192d('0x2e')][_0x192d('0x3a')]+'%'};return _0x42e107;}})});}_0x36b0ef=_[_0x192d('0x3b')]({},_0x36b0ef,_0x331f88[_0x192d('0x3e')]);var _0x103770={'where':_0x36b0ef[_0x192d('0x38')]};return db[_0x192d('0x28')][_0x192d('0x1d')](_0x103770)[_0x192d('0x21')](function(_0x5c12fd){_0xebaa0[_0x192d('0x1d')]=_0x5c12fd;if(_0x331f88[_0x192d('0x2e')]['includeAll']){_0x36b0ef['include']=[{'all':!![]}];}return db[_0x192d('0x28')]['findAll'](_0x36b0ef);})['then'](function(_0x25947e){_0xebaa0[_0x192d('0x3f')]=_0x25947e;return _0xebaa0;})[_0x192d('0x21')](respondWithFilteredResult(_0x15740b,_0x36b0ef))[_0x192d('0x40')](handleError(_0x15740b,null));};exports[_0x192d('0x41')]=function(_0x565ea9,_0x59ca14){var _0xd76a69={'raw':!![],'where':{'id':_0x565ea9[_0x192d('0x42')]['id']}},_0x346b20={};_0x346b20[_0x192d('0x2d')]=_[_0x192d('0x43')](db[_0x192d('0x28')][_0x192d('0x29')]);_0x346b20[_0x192d('0x2e')]=_[_0x192d('0x43')](_0x565ea9[_0x192d('0x2e')]);_0x346b20['filters']=_[_0x192d('0x30')](_0x346b20[_0x192d('0x2d')],_0x346b20['query']);_0xd76a69[_0x192d('0x32')]=_[_0x192d('0x30')](_0x346b20[_0x192d('0x2d')],qs[_0x192d('0x31')](_0x565ea9['query'][_0x192d('0x31')]));_0xd76a69[_0x192d('0x32')]=_0xd76a69[_0x192d('0x32')][_0x192d('0x33')]?_0xd76a69['attributes']:_0x346b20[_0x192d('0x2d')];if(_0x565ea9[_0x192d('0x2e')][_0x192d('0x44')]){_0xd76a69[_0x192d('0x45')]=[{'all':!![]}];}_0xd76a69=_['merge']({},_0xd76a69,_0x565ea9[_0x192d('0x3e')]);return db[_0x192d('0x28')][_0x192d('0x46')](_0xd76a69)['then'](handleEntityNotFound(_0x59ca14,null))[_0x192d('0x21')](respondWithResult(_0x59ca14,null))[_0x192d('0x40')](handleError(_0x59ca14,null));};exports['create']=function(_0x234f0b,_0x38af10){return db[_0x192d('0x28')][_0x192d('0x47')](_0x234f0b[_0x192d('0x48')],{})[_0x192d('0x21')](respondWithResult(_0x38af10,0xc9))['catch'](handleError(_0x38af10,null));};exports[_0x192d('0x49')]=function(_0x167e3f,_0x4897a2){if(_0x167e3f['body']['id']){delete _0x167e3f[_0x192d('0x48')]['id'];}return db['FaxTransferReport'][_0x192d('0x46')]({'where':{'id':_0x167e3f[_0x192d('0x42')]['id']}})[_0x192d('0x21')](handleEntityNotFound(_0x4897a2,null))[_0x192d('0x21')](saveUpdates(_0x167e3f['body'],null))[_0x192d('0x21')](respondWithResult(_0x4897a2,null))[_0x192d('0x40')](handleError(_0x4897a2,null));};exports[_0x192d('0x22')]=function(_0x4f5486,_0x2231e0){return db['FaxTransferReport'][_0x192d('0x46')]({'where':{'id':_0x4f5486[_0x192d('0x42')]['id']}})[_0x192d('0x21')](handleEntityNotFound(_0x2231e0,null))[_0x192d('0x21')](removeEntity(_0x2231e0,null))['catch'](handleError(_0x2231e0,null));};exports[_0x192d('0x4a')]=function(_0x11e57f,_0x32eb68){return db[_0x192d('0x28')]['describe']()['then'](respondWithResult(_0x32eb68,null))['catch'](handleError(_0x32eb68,null));}; \ No newline at end of file +var _0xb9de=['FaxTransferReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','include','findAll','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','send','index'];(function(_0x77853f,_0xf6ee23){var _0x49270f=function(_0x4fc18b){while(--_0x4fc18b){_0x77853f['push'](_0x77853f['shift']());}};_0x49270f(++_0xf6ee23);}(_0xb9de,0x161));var _0xeb9d=function(_0x3dd6c8,_0x3bb462){_0x3dd6c8=_0x3dd6c8-0x0;var _0x5084d1=_0xb9de[_0x3dd6c8];return _0x5084d1;};'use strict';var emlformat=require(_0xeb9d('0x0'));var rimraf=require(_0xeb9d('0x1'));var zipdir=require(_0xeb9d('0x2'));var jsonpatch=require(_0xeb9d('0x3'));var rp=require(_0xeb9d('0x4'));var moment=require(_0xeb9d('0x5'));var BPromise=require(_0xeb9d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xeb9d('0x7'));var sox=require(_0xeb9d('0x8'));var csv=require(_0xeb9d('0x9'));var ejs=require(_0xeb9d('0xa'));var fs=require('fs');var fs_extra=require(_0xeb9d('0xb'));var _=require(_0xeb9d('0xc'));var squel=require('squel');var crypto=require(_0xeb9d('0xd'));var jsforce=require(_0xeb9d('0xe'));var deskjs=require(_0xeb9d('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeb9d('0x10'));var Papa=require(_0xeb9d('0x11'));var Redis=require(_0xeb9d('0x12'));var authService=require(_0xeb9d('0x13'));var qs=require(_0xeb9d('0x14'));var as=require(_0xeb9d('0x15'));var hardwareService=require(_0xeb9d('0x16'));var logger=require(_0xeb9d('0x17'))(_0xeb9d('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xeb9d('0x19'));var db=require(_0xeb9d('0x1a'))['db'];function respondWithStatusCode(_0x248e02,_0x571ecd){_0x571ecd=_0x571ecd||0xcc;return function(_0x4684cd){if(_0x4684cd){return _0x248e02[_0xeb9d('0x1b')](_0x571ecd);}return _0x248e02[_0xeb9d('0x1c')](_0x571ecd)[_0xeb9d('0x1d')]();};}function respondWithResult(_0x298d93,_0x374942){_0x374942=_0x374942||0xc8;return function(_0x31b925){if(_0x31b925){return _0x298d93['status'](_0x374942)['json'](_0x31b925);}};}function respondWithFilteredResult(_0x48deb8,_0x32e03c){return function(_0x2becfc){if(_0x2becfc){var _0xdc28f1=typeof _0x32e03c[_0xeb9d('0x1e')]==='undefined'&&typeof _0x32e03c[_0xeb9d('0x1f')]===_0xeb9d('0x20');var _0x1eebac=_0x2becfc['count'];var _0x7784fc=_0xdc28f1?0x0:_0x32e03c[_0xeb9d('0x1e')];var _0x5e981f=_0xdc28f1?_0x2becfc[_0xeb9d('0x21')]:_0x32e03c[_0xeb9d('0x1e')]+_0x32e03c[_0xeb9d('0x1f')];var _0x19d048;if(_0x5e981f>=_0x1eebac){_0x5e981f=_0x1eebac;_0x19d048=0xc8;}else{_0x19d048=0xce;}_0x48deb8[_0xeb9d('0x1c')](_0x19d048);return _0x48deb8[_0xeb9d('0x22')](_0xeb9d('0x23'),_0x7784fc+'-'+_0x5e981f+'/'+_0x1eebac)[_0xeb9d('0x24')](_0x2becfc);}return null;};}function patchUpdates(_0x5ba43d){return function(_0x1918e9){try{jsonpatch[_0xeb9d('0x25')](_0x1918e9,_0x5ba43d,!![]);}catch(_0x22470d){return BPromise[_0xeb9d('0x26')](_0x22470d);}return _0x1918e9[_0xeb9d('0x27')]();};}function saveUpdates(_0x489f4f,_0x22d622){return function(_0x6e5c25){if(_0x6e5c25){return _0x6e5c25[_0xeb9d('0x28')](_0x489f4f)[_0xeb9d('0x29')](function(_0x36d1b1){return _0x36d1b1;});}return null;};}function removeEntity(_0x376067,_0xde1d8a){return function(_0x52fc50){if(_0x52fc50){return _0x52fc50[_0xeb9d('0x2a')]()['then'](function(){_0x376067[_0xeb9d('0x1c')](0xcc)[_0xeb9d('0x1d')]();});}};}function handleEntityNotFound(_0x2036ed,_0x5be6d3){return function(_0x3a9e1f){if(!_0x3a9e1f){_0x2036ed[_0xeb9d('0x1b')](0x194);}return _0x3a9e1f;};}function handleError(_0x4fe0fe,_0xface6a){_0xface6a=_0xface6a||0x1f4;return function(_0x49ca9a){logger[_0xeb9d('0x2b')](_0x49ca9a['stack']);if(_0x49ca9a[_0xeb9d('0x2c')]){delete _0x49ca9a[_0xeb9d('0x2c')];}_0x4fe0fe[_0xeb9d('0x1c')](_0xface6a)[_0xeb9d('0x2d')](_0x49ca9a);};}exports[_0xeb9d('0x2e')]=function(_0x189258,_0x72173f){var _0x1bc416={},_0x167ae0={},_0x32f210={'count':0x0,'rows':[]};var _0x4d5e7a=_['map'](db[_0xeb9d('0x2f')][_0xeb9d('0x30')],function(_0x1d7b43){return{'name':_0x1d7b43[_0xeb9d('0x31')],'type':_0x1d7b43[_0xeb9d('0x32')][_0xeb9d('0x33')]};});_0x167ae0[_0xeb9d('0x34')]=_['map'](_0x4d5e7a,_0xeb9d('0x2c'));_0x167ae0['query']=_[_0xeb9d('0x35')](_0x189258['query']);_0x167ae0[_0xeb9d('0x36')]=_[_0xeb9d('0x37')](_0x167ae0['model'],_0x167ae0[_0xeb9d('0x38')]);_0x1bc416[_0xeb9d('0x39')]=_['intersection'](_0x167ae0['model'],qs[_0xeb9d('0x3a')](_0x189258[_0xeb9d('0x38')][_0xeb9d('0x3a')]));_0x1bc416[_0xeb9d('0x39')]=_0x1bc416['attributes']['length']?_0x1bc416[_0xeb9d('0x39')]:_0x167ae0[_0xeb9d('0x34')];if(!_0x189258[_0xeb9d('0x38')][_0xeb9d('0x3b')](_0xeb9d('0x3c'))){_0x1bc416['limit']=qs[_0xeb9d('0x1f')](_0x189258['query'][_0xeb9d('0x1f')]);_0x1bc416['offset']=qs['offset'](_0x189258[_0xeb9d('0x38')][_0xeb9d('0x1e')]);}_0x1bc416[_0xeb9d('0x3d')]=qs[_0xeb9d('0x3e')](_0x189258[_0xeb9d('0x38')][_0xeb9d('0x3e')]);_0x1bc416['where']=qs[_0xeb9d('0x36')](_[_0xeb9d('0x3f')](_0x189258[_0xeb9d('0x38')],_0x167ae0[_0xeb9d('0x36')]),_0x4d5e7a);if(_0x189258['query'][_0xeb9d('0x40')]){_0x1bc416[_0xeb9d('0x41')]=_[_0xeb9d('0x42')](_0x1bc416[_0xeb9d('0x41')],{'$or':_[_0xeb9d('0x43')](_0x4d5e7a,function(_0x927af9){if(_0x927af9[_0xeb9d('0x32')]!==_0xeb9d('0x44')){var _0x1f195f={};_0x1f195f[_0x927af9['name']]={'$like':'%'+_0x189258['query'][_0xeb9d('0x40')]+'%'};return _0x1f195f;}})});}_0x1bc416=_['merge']({},_0x1bc416,_0x189258[_0xeb9d('0x45')]);var _0x542caa={'where':_0x1bc416[_0xeb9d('0x41')]};return db[_0xeb9d('0x2f')][_0xeb9d('0x21')](_0x542caa)[_0xeb9d('0x29')](function(_0x243a34){_0x32f210[_0xeb9d('0x21')]=_0x243a34;if(_0x189258[_0xeb9d('0x38')]['includeAll']){_0x1bc416[_0xeb9d('0x46')]=[{'all':!![]}];}return db[_0xeb9d('0x2f')][_0xeb9d('0x47')](_0x1bc416);})[_0xeb9d('0x29')](function(_0x87f9e5){_0x32f210['rows']=_0x87f9e5;return _0x32f210;})[_0xeb9d('0x29')](respondWithFilteredResult(_0x72173f,_0x1bc416))[_0xeb9d('0x48')](handleError(_0x72173f,null));};exports[_0xeb9d('0x49')]=function(_0x1db45c,_0x20ab69){var _0xa294bd={'raw':!![],'where':{'id':_0x1db45c[_0xeb9d('0x4a')]['id']}},_0x5922d7={};_0x5922d7[_0xeb9d('0x34')]=_['keys'](db[_0xeb9d('0x2f')][_0xeb9d('0x30')]);_0x5922d7['query']=_[_0xeb9d('0x35')](_0x1db45c[_0xeb9d('0x38')]);_0x5922d7[_0xeb9d('0x36')]=_[_0xeb9d('0x37')](_0x5922d7[_0xeb9d('0x34')],_0x5922d7[_0xeb9d('0x38')]);_0xa294bd[_0xeb9d('0x39')]=_['intersection'](_0x5922d7[_0xeb9d('0x34')],qs['fields'](_0x1db45c[_0xeb9d('0x38')]['fields']));_0xa294bd[_0xeb9d('0x39')]=_0xa294bd['attributes'][_0xeb9d('0x4b')]?_0xa294bd['attributes']:_0x5922d7[_0xeb9d('0x34')];if(_0x1db45c[_0xeb9d('0x38')]['includeAll']){_0xa294bd['include']=[{'all':!![]}];}_0xa294bd=_[_0xeb9d('0x42')]({},_0xa294bd,_0x1db45c['options']);return db['FaxTransferReport'][_0xeb9d('0x4c')](_0xa294bd)[_0xeb9d('0x29')](handleEntityNotFound(_0x20ab69,null))[_0xeb9d('0x29')](respondWithResult(_0x20ab69,null))['catch'](handleError(_0x20ab69,null));};exports[_0xeb9d('0x4d')]=function(_0x322e6e,_0x50c854){return db[_0xeb9d('0x2f')][_0xeb9d('0x4d')](_0x322e6e[_0xeb9d('0x4e')],{})['then'](respondWithResult(_0x50c854,0xc9))[_0xeb9d('0x48')](handleError(_0x50c854,null));};exports[_0xeb9d('0x28')]=function(_0x2e09fc,_0x12fb40){if(_0x2e09fc[_0xeb9d('0x4e')]['id']){delete _0x2e09fc['body']['id'];}return db[_0xeb9d('0x2f')][_0xeb9d('0x4c')]({'where':{'id':_0x2e09fc[_0xeb9d('0x4a')]['id']}})[_0xeb9d('0x29')](handleEntityNotFound(_0x12fb40,null))[_0xeb9d('0x29')](saveUpdates(_0x2e09fc['body'],null))[_0xeb9d('0x29')](respondWithResult(_0x12fb40,null))['catch'](handleError(_0x12fb40,null));};exports[_0xeb9d('0x2a')]=function(_0x276531,_0x5407e7){return db['FaxTransferReport'][_0xeb9d('0x4c')]({'where':{'id':_0x276531[_0xeb9d('0x4a')]['id']}})[_0xeb9d('0x29')](handleEntityNotFound(_0x5407e7,null))['then'](removeEntity(_0x5407e7,null))[_0xeb9d('0x48')](handleError(_0x5407e7,null));};exports['describe']=function(_0x4d2d1f,_0x108ec1){return db[_0xeb9d('0x2f')][_0xeb9d('0x4f')]()['then'](respondWithResult(_0x108ec1,null))[_0xeb9d('0x48')](handleError(_0x108ec1,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 836cb1b..bd99cd1 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 _0x6916=['report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport'];(function(_0x1e5704,_0x4cdb70){var _0x40346a=function(_0x456549){while(--_0x456549){_0x1e5704['push'](_0x1e5704['shift']());}};_0x40346a(++_0x4cdb70);}(_0x6916,0x86));var _0x6691=function(_0x41c9d1,_0x27e11a){_0x41c9d1=_0x41c9d1-0x0;var _0x4bdd2d=_0x6916[_0x41c9d1];return _0x4bdd2d;};'use strict';var _=require(_0x6691('0x0'));var util=require(_0x6691('0x1'));var logger=require(_0x6691('0x2'))(_0x6691('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6691('0x4'));var fs=require('fs');var path=require(_0x6691('0x5'));var rimraf=require('rimraf');var config=require(_0x6691('0x6'));var attributes=require(_0x6691('0x7'));module[_0x6691('0x8')]=function(_0x18b9d1,_0x3e86e5){return _0x18b9d1['define'](_0x6691('0x9'),attributes,{'tableName':_0x6691('0xa'),'paranoid':![],'indexes':[{'name':_0x6691('0xb'),'fields':[_0x6691('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4045=['bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','uniqueid','util','../../config/logger','api','moment'];(function(_0x5511aa,_0x454962){var _0x8c975d=function(_0x5f28b1){while(--_0x5f28b1){_0x5511aa['push'](_0x5511aa['shift']());}};_0x8c975d(++_0x454962);}(_0x4045,0x7e));var _0x5404=function(_0x3f73a8,_0x1670df){_0x3f73a8=_0x3f73a8-0x0;var _0x5e1997=_0x4045[_0x3f73a8];return _0x5e1997;};'use strict';var _=require('lodash');var util=require(_0x5404('0x0'));var logger=require(_0x5404('0x1'))(_0x5404('0x2'));var moment=require(_0x5404('0x3'));var BPromise=require(_0x5404('0x4'));var rp=require(_0x5404('0x5'));var fs=require('fs');var path=require(_0x5404('0x6'));var rimraf=require(_0x5404('0x7'));var config=require(_0x5404('0x8'));var attributes=require(_0x5404('0x9'));module[_0x5404('0xa')]=function(_0x57b5ea,_0x1a7f4f){return _0x57b5ea['define'](_0x5404('0xb'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x5404('0xc'),'fields':[_0x5404('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 8823982..91e347c 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 _0xc3c6=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment'];(function(_0x3df1e0,_0x10bf2a){var _0x595bdb=function(_0x2715e3){while(--_0x2715e3){_0x3df1e0['push'](_0x3df1e0['shift']());}};_0x595bdb(++_0x10bf2a);}(_0xc3c6,0x152));var _0x6c3c=function(_0x4bcfea,_0x487dce){_0x4bcfea=_0x4bcfea-0x0;var _0x25a86f=_0xc3c6[_0x4bcfea];return _0x25a86f;};'use strict';var _=require(_0x6c3c('0x0'));var util=require('util');var moment=require(_0x6c3c('0x1'));var BPromise=require('bluebird');var rs=require(_0x6c3c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c3c('0x3'))['db'];var utils=require(_0x6c3c('0x4'));var logger=require('../../config/logger')(_0x6c3c('0x5'));var config=require('../../config/environment');var jayson=require(_0x6c3c('0x6'));var client=jayson[_0x6c3c('0x7')][_0x6c3c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ca554,_0x15f062,_0x36d09f){return new BPromise(function(_0x2ffe64,_0x123adf){return client[_0x6c3c('0x9')](_0x1ca554,_0x36d09f)[_0x6c3c('0xa')](function(_0x49a969){logger[_0x6c3c('0xb')](_0x6c3c('0xc'),_0x15f062,_0x6c3c('0xd'));logger[_0x6c3c('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x15f062,_0x6c3c('0xd'),JSON[_0x6c3c('0xf')](_0x49a969));if(_0x49a969[_0x6c3c('0x10')]){if(_0x49a969['error']['code']===0x1f4){logger[_0x6c3c('0x10')](_0x6c3c('0xc'),_0x15f062,_0x49a969[_0x6c3c('0x10')][_0x6c3c('0x11')]);return _0x123adf(_0x49a969['error']['message']);}logger[_0x6c3c('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x15f062,_0x49a969[_0x6c3c('0x10')][_0x6c3c('0x11')]);return _0x2ffe64(_0x49a969[_0x6c3c('0x10')][_0x6c3c('0x11')]);}else{logger[_0x6c3c('0xb')](_0x6c3c('0xc'),_0x15f062,_0x6c3c('0xd'));_0x2ffe64(_0x49a969[_0x6c3c('0x12')][_0x6c3c('0x11')]);}})[_0x6c3c('0x13')](function(_0x134ec3){logger['error'](_0x6c3c('0xc'),_0x15f062,_0x134ec3);_0x123adf(_0x134ec3);});});} \ No newline at end of file +var _0xc109=['result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x4a17d6,_0x25f71a){var _0x4cb0b6=function(_0x5e5b00){while(--_0x5e5b00){_0x4a17d6['push'](_0x4a17d6['shift']());}};_0x4cb0b6(++_0x25f71a);}(_0xc109,0x1a6));var _0x9c10=function(_0x631577,_0x38e35d){_0x631577=_0x631577-0x0;var _0x517397=_0xc109[_0x631577];return _0x517397;};'use strict';var _=require(_0x9c10('0x0'));var util=require(_0x9c10('0x1'));var moment=require(_0x9c10('0x2'));var BPromise=require('bluebird');var rs=require(_0x9c10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c10('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c10('0x5'))(_0x9c10('0x6'));var config=require('../../config/environment');var jayson=require(_0x9c10('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3d3f28,_0x1125ac,_0x5e0e81){return new BPromise(function(_0x535326,_0x3114ca){return client[_0x9c10('0x8')](_0x3d3f28,_0x5e0e81)[_0x9c10('0x9')](function(_0x5d36ee){logger['info'](_0x9c10('0xa'),_0x1125ac,_0x9c10('0xb'));logger[_0x9c10('0xc')](_0x9c10('0xd'),_0x1125ac,_0x9c10('0xb'),JSON[_0x9c10('0xe')](_0x5d36ee));if(_0x5d36ee[_0x9c10('0xf')]){if(_0x5d36ee[_0x9c10('0xf')]['code']===0x1f4){logger[_0x9c10('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x1125ac,_0x5d36ee[_0x9c10('0xf')][_0x9c10('0x10')]);return _0x3114ca(_0x5d36ee[_0x9c10('0xf')][_0x9c10('0x10')]);}logger[_0x9c10('0xf')](_0x9c10('0xa'),_0x1125ac,_0x5d36ee[_0x9c10('0xf')][_0x9c10('0x10')]);return _0x535326(_0x5d36ee[_0x9c10('0xf')][_0x9c10('0x10')]);}else{logger[_0x9c10('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x1125ac,_0x9c10('0xb'));_0x535326(_0x5d36ee[_0x9c10('0x12')][_0x9c10('0x10')]);}})[_0x9c10('0x13')](function(_0x3bb711){logger[_0x9c10('0xf')](_0x9c10('0xa'),_0x1125ac,_0x3bb711);_0x3114ca(_0x3bb711);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 3cf7c2e..3d3b453 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 _0x9069=['exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','describe','show','create','put','/:id','update','destroy'];(function(_0x5acbc4,_0x33cf81){var _0xc6a4ee=function(_0x14ca9d){while(--_0x14ca9d){_0x5acbc4['push'](_0x5acbc4['shift']());}};_0xc6a4ee(++_0x33cf81);}(_0x9069,0xa3));var _0x9906=function(_0x530d5c,_0x9ec15f){_0x530d5c=_0x530d5c-0x0;var _0x4f332b=_0x9069[_0x530d5c];return _0x4f332b;};'use strict';var multer=require(_0x9906('0x0'));var util=require('util');var path=require(_0x9906('0x1'));var timeout=require('connect-timeout');var express=require(_0x9906('0x2'));var router=express[_0x9906('0x3')]();var fs_extra=require(_0x9906('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9906('0x5'));var config=require(_0x9906('0x6'));var controller=require(_0x9906('0x7'));router[_0x9906('0x8')]('/',auth[_0x9906('0x9')](),controller['index']);router[_0x9906('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x9906('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9906('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9906('0xc')]);router[_0x9906('0xd')](_0x9906('0xe'),auth['isAuthenticated'](),controller[_0x9906('0xf')]);router['delete'](_0x9906('0xe'),auth[_0x9906('0x9')](),controller[_0x9906('0x10')]);module[_0x9906('0x11')]=router; \ No newline at end of file +var _0xa22a=['/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0xa22a,0xd1));var _0xaa22=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa22a[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xaa22('0x0'));var util=require(_0xaa22('0x1'));var path=require('path');var timeout=require(_0xaa22('0x2'));var express=require(_0xaa22('0x3'));var router=express[_0xaa22('0x4')]();var fs_extra=require(_0xaa22('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaa22('0x6'));var config=require('../../config/environment');var controller=require(_0xaa22('0x7'));router[_0xaa22('0x8')]('/',auth[_0xaa22('0x9')](),controller[_0xaa22('0xa')]);router[_0xaa22('0x8')](_0xaa22('0xb'),auth[_0xaa22('0x9')](),controller[_0xaa22('0xc')]);router[_0xaa22('0x8')](_0xaa22('0xd'),auth['isAuthenticated'](),controller[_0xaa22('0xe')]);router[_0xaa22('0xf')]('/',auth[_0xaa22('0x9')](),controller[_0xaa22('0x10')]);router[_0xaa22('0x11')](_0xaa22('0xd'),auth[_0xaa22('0x9')](),controller[_0xaa22('0x12')]);router[_0xaa22('0x13')](_0xaa22('0xd'),auth['isAuthenticated'](),controller[_0xaa22('0x14')]);module[_0xaa22('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 09dbe21..f0b3c6a 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 _0x6b9f=['index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./intDeskAccount.controller','get'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x6b9f,0x1a7));var _0xf6b9=function(_0x2c3ce9,_0x23097b){_0x2c3ce9=_0x2c3ce9-0x0;var _0x18d083=_0x6b9f[_0x2c3ce9];return _0x18d083;};'use strict';var multer=require(_0xf6b9('0x0'));var util=require(_0xf6b9('0x1'));var path=require(_0xf6b9('0x2'));var timeout=require(_0xf6b9('0x3'));var express=require(_0xf6b9('0x4'));var router=express[_0xf6b9('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf6b9('0x6'));var controller=require(_0xf6b9('0x7'));router[_0xf6b9('0x8')]('/',auth['isAuthenticated'](),controller[_0xf6b9('0x9')]);router[_0xf6b9('0x8')](_0xf6b9('0xa'),auth[_0xf6b9('0xb')](),controller[_0xf6b9('0xc')]);router[_0xf6b9('0x8')](_0xf6b9('0xd'),auth['isAuthenticated'](),controller[_0xf6b9('0xe')]);router[_0xf6b9('0x8')](_0xf6b9('0xf'),auth[_0xf6b9('0xb')](),controller[_0xf6b9('0x10')]);router[_0xf6b9('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf6b9('0x11')](_0xf6b9('0xd'),auth[_0xf6b9('0xb')](),controller[_0xf6b9('0x12')]);router[_0xf6b9('0x13')](_0xf6b9('0xa'),auth[_0xf6b9('0xb')](),controller[_0xf6b9('0x14')]);router[_0xf6b9('0x15')]('/:id',auth['isAuthenticated'](),controller[_0xf6b9('0x16')]);module[_0xf6b9('0x17')]=router; \ No newline at end of file +var _0xea4a=['addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','/:id/fields','post','create'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xea4a,0xa7));var _0xaea4=function(_0x150134,_0xd32ba0){_0x150134=_0x150134-0x0;var _0x271059=_0xea4a[_0x150134];return _0x271059;};'use strict';var multer=require(_0xaea4('0x0'));var util=require(_0xaea4('0x1'));var path=require(_0xaea4('0x2'));var timeout=require(_0xaea4('0x3'));var express=require(_0xaea4('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaea4('0x5'));var interaction=require(_0xaea4('0x6'));var config=require(_0xaea4('0x7'));var controller=require(_0xaea4('0x8'));router[_0xaea4('0x9')]('/',auth[_0xaea4('0xa')](),controller['index']);router[_0xaea4('0x9')](_0xaea4('0xb'),auth['isAuthenticated'](),controller[_0xaea4('0xc')]);router[_0xaea4('0x9')](_0xaea4('0xd'),auth[_0xaea4('0xa')](),controller['getConfigurations']);router[_0xaea4('0x9')](_0xaea4('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xaea4('0xf')]('/',auth['isAuthenticated'](),controller[_0xaea4('0x10')]);router[_0xaea4('0xf')](_0xaea4('0xd'),auth[_0xaea4('0xa')](),controller[_0xaea4('0x11')]);router[_0xaea4('0x12')](_0xaea4('0xb'),auth[_0xaea4('0xa')](),controller[_0xaea4('0x13')]);router[_0xaea4('0x14')](_0xaea4('0xb'),auth[_0xaea4('0xa')](),controller[_0xaea4('0x15')]);module[_0xaea4('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 7de41dc..8dbe908 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 _0x5452=['basic','integrationTab','newTab','exports','STRING','ENUM'];(function(_0x10c6ab,_0x3260c4){var _0x491f28=function(_0x3799e5){while(--_0x3799e5){_0x10c6ab['push'](_0x10c6ab['shift']());}};_0x491f28(++_0x3260c4);}(_0x5452,0x17d));var _0x2545=function(_0xfec38d,_0xb5a9e){_0xfec38d=_0xfec38d-0x0;var _0x8b46fe=_0x5452[_0xfec38d];return _0x8b46fe;};'use strict';var Sequelize=require('sequelize');module[_0x2545('0x0')]={'name':{'type':Sequelize[_0x2545('0x1')]},'description':{'type':Sequelize[_0x2545('0x1')]},'username':{'type':Sequelize[_0x2545('0x1')]},'remoteUri':{'type':Sequelize[_0x2545('0x1')]},'authType':{'type':Sequelize[_0x2545('0x2')](_0x2545('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x2545('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x2545('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x2545('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x2545('0x2')](_0x2545('0x4'),_0x2545('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xc122=['basic','integrationTab','sequelize','STRING','ENUM'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xc122,0x98));var _0x2c12=function(_0x405bf9,_0x14a5b5){_0x405bf9=_0x405bf9-0x0;var _0x44486c=_0xc122[_0x405bf9];return _0x44486c;};'use strict';var Sequelize=require(_0x2c12('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2c12('0x1')]},'username':{'type':Sequelize[_0x2c12('0x1')]},'remoteUri':{'type':Sequelize[_0x2c12('0x1')]},'authType':{'type':Sequelize[_0x2c12('0x2')](_0x2c12('0x3')),'defaultValue':_0x2c12('0x3')},'password':{'type':Sequelize[_0x2c12('0x1')]},'consumerKey':{'type':Sequelize[_0x2c12('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x2c12('0x1')]},'tokenSecret':{'type':Sequelize[_0x2c12('0x1')]},'serverUrl':{'type':Sequelize[_0x2c12('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x2c12('0x2')](_0x2c12('0x4'),'newTab'),'defaultValue':_0x2c12('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 468ad16..701bc51 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 _0xada8=['end','json','offset','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','send','map','DeskAccount','rawAttributes','fieldName','type','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','includeAll','include','findAll','rows','show','params','options','find','catch','create','update','body','getConfigurations','DeskConfiguration','order','filter','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','%s/custom_fields','application/json','headers','Basic\x20%s','format','%s:%s','base64','concat','_embedded','statusCode','getFields','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status'];(function(_0x4e5b82,_0x21a4f9){var _0x1ace82=function(_0xf0fce){while(--_0xf0fce){_0x4e5b82['push'](_0x4e5b82['shift']());}};_0x1ace82(++_0x21a4f9);}(_0xada8,0x137));var _0x8ada=function(_0x51af3f,_0x3f911d){_0x51af3f=_0x51af3f-0x0;var _0x24be82=_0xada8[_0x51af3f];return _0x24be82;};'use strict';var emlformat=require(_0x8ada('0x0'));var rimraf=require(_0x8ada('0x1'));var zipdir=require(_0x8ada('0x2'));var jsonpatch=require(_0x8ada('0x3'));var rp=require(_0x8ada('0x4'));var moment=require('moment');var BPromise=require(_0x8ada('0x5'));var Mustache=require('mustache');var util=require(_0x8ada('0x6'));var path=require(_0x8ada('0x7'));var sox=require(_0x8ada('0x8'));var csv=require(_0x8ada('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ada('0xa'));var _=require(_0x8ada('0xb'));var squel=require(_0x8ada('0xc'));var crypto=require(_0x8ada('0xd'));var jsforce=require(_0x8ada('0xe'));var deskjs=require(_0x8ada('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ada('0x10'));var Redis=require(_0x8ada('0x11'));var authService=require(_0x8ada('0x12'));var qs=require(_0x8ada('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ada('0x14'))(_0x8ada('0x15'));var utils=require(_0x8ada('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8ada('0x17'));var db=require(_0x8ada('0x18'))['db'];var integrations=require(_0x8ada('0x19'));function respondWithStatusCode(_0x5b8bb1,_0x29acc2){_0x29acc2=_0x29acc2||0xcc;return function(_0x4bbca8){if(_0x4bbca8){return _0x5b8bb1[_0x8ada('0x1a')](_0x29acc2);}return _0x5b8bb1[_0x8ada('0x1b')](_0x29acc2)[_0x8ada('0x1c')]();};}function respondWithResult(_0x5b08d2,_0x6bfcac){_0x6bfcac=_0x6bfcac||0xc8;return function(_0x168067){if(_0x168067){return _0x5b08d2['status'](_0x6bfcac)[_0x8ada('0x1d')](_0x168067);}};}function respondWithFilteredResult(_0x288cdb,_0x23574d){return function(_0x6bc132){if(_0x6bc132){var _0x27faf8=typeof _0x23574d[_0x8ada('0x1e')]==='undefined'&&typeof _0x23574d[_0x8ada('0x1f')]==='undefined';var _0x2fef1a=_0x6bc132[_0x8ada('0x20')];var _0x390f96=_0x27faf8?0x0:_0x23574d[_0x8ada('0x1e')];var _0x375cd1=_0x27faf8?_0x6bc132['count']:_0x23574d['offset']+_0x23574d['limit'];var _0x32af40;if(_0x375cd1>=_0x2fef1a){_0x375cd1=_0x2fef1a;_0x32af40=0xc8;}else{_0x32af40=0xce;}_0x288cdb[_0x8ada('0x1b')](_0x32af40);return _0x288cdb[_0x8ada('0x21')](_0x8ada('0x22'),_0x390f96+'-'+_0x375cd1+'/'+_0x2fef1a)[_0x8ada('0x1d')](_0x6bc132);}return null;};}function patchUpdates(_0x51cd1d){return function(_0x4b11a7){try{jsonpatch['apply'](_0x4b11a7,_0x51cd1d,!![]);}catch(_0x491f20){return BPromise[_0x8ada('0x23')](_0x491f20);}return _0x4b11a7[_0x8ada('0x24')]();};}function saveUpdates(_0x53ca87,_0x5351f1){return function(_0x531984){if(_0x531984){return _0x531984['update'](_0x53ca87)[_0x8ada('0x25')](function(_0x4fe675){return _0x4fe675;});}return null;};}function removeEntity(_0x1be941,_0x988bf0){return function(_0x1f468a){if(_0x1f468a){return _0x1f468a[_0x8ada('0x26')]()[_0x8ada('0x25')](function(){_0x1be941['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x176b3c,_0x43b4e8){return function(_0x5bdc17){if(!_0x5bdc17){_0x176b3c['sendStatus'](0x194);}return _0x5bdc17;};}function handleError(_0x630b0f,_0x472206){_0x472206=_0x472206||0x1f4;return function(_0x33caff){logger[_0x8ada('0x27')](_0x33caff[_0x8ada('0x28')]);if(_0x33caff['name']){delete _0x33caff['name'];}_0x630b0f['status'](_0x472206)[_0x8ada('0x29')](_0x33caff);};}exports['index']=function(_0x7050c3,_0x2d5c91){var _0x370a6f={},_0x1c4ee6={},_0x5a92d6={'count':0x0,'rows':[]};var _0xee816f=_[_0x8ada('0x2a')](db[_0x8ada('0x2b')][_0x8ada('0x2c')],function(_0x4180eb){return{'name':_0x4180eb[_0x8ada('0x2d')],'type':_0x4180eb[_0x8ada('0x2e')]['key']};});_0x1c4ee6[_0x8ada('0x2f')]=_['map'](_0xee816f,_0x8ada('0x30'));_0x1c4ee6[_0x8ada('0x31')]=_[_0x8ada('0x32')](_0x7050c3[_0x8ada('0x31')]);_0x1c4ee6['filters']=_[_0x8ada('0x33')](_0x1c4ee6[_0x8ada('0x2f')],_0x1c4ee6[_0x8ada('0x31')]);_0x370a6f[_0x8ada('0x34')]=_[_0x8ada('0x33')](_0x1c4ee6[_0x8ada('0x2f')],qs[_0x8ada('0x35')](_0x7050c3[_0x8ada('0x31')][_0x8ada('0x35')]));_0x370a6f['attributes']=_0x370a6f[_0x8ada('0x34')][_0x8ada('0x36')]?_0x370a6f[_0x8ada('0x34')]:_0x1c4ee6[_0x8ada('0x2f')];if(!_0x7050c3[_0x8ada('0x31')][_0x8ada('0x37')](_0x8ada('0x38'))){_0x370a6f[_0x8ada('0x1f')]=qs[_0x8ada('0x1f')](_0x7050c3[_0x8ada('0x31')][_0x8ada('0x1f')]);_0x370a6f['offset']=qs[_0x8ada('0x1e')](_0x7050c3[_0x8ada('0x31')][_0x8ada('0x1e')]);}_0x370a6f['order']=qs[_0x8ada('0x39')](_0x7050c3['query'][_0x8ada('0x39')]);_0x370a6f[_0x8ada('0x3a')]=qs[_0x8ada('0x3b')](_[_0x8ada('0x3c')](_0x7050c3[_0x8ada('0x31')],_0x1c4ee6[_0x8ada('0x3b')]),_0xee816f);if(_0x7050c3[_0x8ada('0x31')]['filter']){_0x370a6f['where']=_[_0x8ada('0x3d')](_0x370a6f[_0x8ada('0x3a')],{'$or':_[_0x8ada('0x2a')](_0xee816f,function(_0x7fbb74){if(_0x7fbb74[_0x8ada('0x2e')]!=='VIRTUAL'){var _0x27c93d={};_0x27c93d[_0x7fbb74['name']]={'$like':'%'+_0x7050c3[_0x8ada('0x31')]['filter']+'%'};return _0x27c93d;}})});}_0x370a6f=_[_0x8ada('0x3d')]({},_0x370a6f,_0x7050c3['options']);var _0x11c893={'where':_0x370a6f['where']};return db['DeskAccount'][_0x8ada('0x20')](_0x11c893)[_0x8ada('0x25')](function(_0x3e0292){_0x5a92d6['count']=_0x3e0292;if(_0x7050c3['query'][_0x8ada('0x3e')]){_0x370a6f[_0x8ada('0x3f')]=[{'all':!![]}];}return db[_0x8ada('0x2b')][_0x8ada('0x40')](_0x370a6f);})['then'](function(_0x8a03db){_0x5a92d6[_0x8ada('0x41')]=_0x8a03db;return _0x5a92d6;})[_0x8ada('0x25')](respondWithFilteredResult(_0x2d5c91,_0x370a6f))['catch'](handleError(_0x2d5c91,null));};exports[_0x8ada('0x42')]=function(_0x249168,_0x6c825a){var _0x5468ac={'raw':![],'where':{'id':_0x249168[_0x8ada('0x43')]['id']}},_0x129df9={};_0x129df9['model']=_[_0x8ada('0x32')](db[_0x8ada('0x2b')][_0x8ada('0x2c')]);_0x129df9[_0x8ada('0x31')]=_[_0x8ada('0x32')](_0x249168['query']);_0x129df9[_0x8ada('0x3b')]=_['intersection'](_0x129df9[_0x8ada('0x2f')],_0x129df9[_0x8ada('0x31')]);_0x5468ac[_0x8ada('0x34')]=_[_0x8ada('0x33')](_0x129df9['model'],qs['fields'](_0x249168[_0x8ada('0x31')][_0x8ada('0x35')]));_0x5468ac[_0x8ada('0x34')]=_0x5468ac[_0x8ada('0x34')][_0x8ada('0x36')]?_0x5468ac[_0x8ada('0x34')]:_0x129df9[_0x8ada('0x2f')];if(_0x249168[_0x8ada('0x31')]['includeAll']){_0x5468ac[_0x8ada('0x3f')]=[{'all':!![]}];}_0x5468ac=_[_0x8ada('0x3d')]({},_0x5468ac,_0x249168[_0x8ada('0x44')]);return db[_0x8ada('0x2b')][_0x8ada('0x45')](_0x5468ac)[_0x8ada('0x25')](handleEntityNotFound(_0x6c825a,null))[_0x8ada('0x25')](respondWithResult(_0x6c825a,null))[_0x8ada('0x46')](handleError(_0x6c825a,null));};exports[_0x8ada('0x47')]=function(_0x2311b2,_0x2d6e6d){return db[_0x8ada('0x2b')][_0x8ada('0x47')](_0x2311b2['body'],{})[_0x8ada('0x25')](respondWithResult(_0x2d6e6d,0xc9))['catch'](handleError(_0x2d6e6d,null));};exports[_0x8ada('0x48')]=function(_0x229724,_0x1a8545){if(_0x229724[_0x8ada('0x49')]['id']){delete _0x229724[_0x8ada('0x49')]['id'];}return db[_0x8ada('0x2b')][_0x8ada('0x45')]({'where':{'id':_0x229724['params']['id']}})['then'](handleEntityNotFound(_0x1a8545,null))[_0x8ada('0x25')](saveUpdates(_0x229724[_0x8ada('0x49')],null))[_0x8ada('0x25')](respondWithResult(_0x1a8545,null))['catch'](handleError(_0x1a8545,null));};exports[_0x8ada('0x26')]=function(_0x486dff,_0x211096){return db[_0x8ada('0x2b')][_0x8ada('0x45')]({'where':{'id':_0x486dff[_0x8ada('0x43')]['id']}})[_0x8ada('0x25')](handleEntityNotFound(_0x211096,null))['then'](removeEntity(_0x211096,null))[_0x8ada('0x46')](handleError(_0x211096,null));};exports[_0x8ada('0x4a')]=function(_0x857e2,_0x2422c9,_0x41cbb9){var _0x46a409={};var _0x3d8d3f={};var _0x15858c;var _0x358e6b;return db[_0x8ada('0x2b')]['findOne']({'where':{'id':_0x857e2[_0x8ada('0x43')]['id']}})[_0x8ada('0x25')](handleEntityNotFound(_0x2422c9,null))[_0x8ada('0x25')](function(_0x46f505){if(_0x46f505){_0x15858c=_0x46f505;_0x3d8d3f[_0x8ada('0x2f')]=_[_0x8ada('0x32')](db[_0x8ada('0x4b')][_0x8ada('0x2c')]);_0x3d8d3f[_0x8ada('0x31')]=_[_0x8ada('0x32')](_0x857e2[_0x8ada('0x31')]);_0x3d8d3f[_0x8ada('0x3b')]=_['intersection'](_0x3d8d3f[_0x8ada('0x2f')],_0x3d8d3f[_0x8ada('0x31')]);_0x46a409['attributes']=_[_0x8ada('0x33')](_0x3d8d3f[_0x8ada('0x2f')],qs['fields'](_0x857e2['query']['fields']));_0x46a409['attributes']=_0x46a409[_0x8ada('0x34')][_0x8ada('0x36')]?_0x46a409[_0x8ada('0x34')]:_0x3d8d3f['model'];_0x46a409[_0x8ada('0x4c')]=qs['sort'](_0x857e2[_0x8ada('0x31')]['sort']);_0x46a409['where']=qs[_0x8ada('0x3b')](_[_0x8ada('0x3c')](_0x857e2[_0x8ada('0x31')],_0x3d8d3f[_0x8ada('0x3b')]));if(_0x857e2['query'][_0x8ada('0x4d')]){_0x46a409['where']=_['merge'](_0x46a409[_0x8ada('0x3a')],{'$or':_[_0x8ada('0x2a')](_0x46a409[_0x8ada('0x34')],function(_0x289402){var _0x3a9bac={};_0x3a9bac[_0x289402]={'$like':'%'+_0x857e2['query'][_0x8ada('0x4d')]+'%'};return _0x3a9bac;})});}_0x46a409=_[_0x8ada('0x3d')]({},_0x46a409,_0x857e2['options']);return _0x15858c['getConfigurations'](_0x46a409);}})[_0x8ada('0x25')](function(_0x4dd612){if(_0x4dd612){_0x358e6b=_0x4dd612[_0x8ada('0x36')];if(!_0x857e2['query'][_0x8ada('0x37')](_0x8ada('0x38'))){_0x46a409[_0x8ada('0x1f')]=qs[_0x8ada('0x1f')](_0x857e2[_0x8ada('0x31')][_0x8ada('0x1f')]);_0x46a409[_0x8ada('0x1e')]=qs[_0x8ada('0x1e')](_0x857e2[_0x8ada('0x31')][_0x8ada('0x1e')]);}return _0x15858c['getConfigurations'](_0x46a409);}})[_0x8ada('0x25')](function(_0x2a0a7d){if(_0x2a0a7d){return _0x2a0a7d?{'count':_0x358e6b,'rows':_0x2a0a7d}:null;}})[_0x8ada('0x25')](respondWithResult(_0x2422c9,null))['catch'](handleError(_0x2422c9,null));};exports[_0x8ada('0x4e')]=function(_0x325866,_0x212acb,_0x255d1f){if(_0x325866[_0x8ada('0x49')]['id']){delete _0x325866[_0x8ada('0x49')]['id'];}return db[_0x8ada('0x2b')][_0x8ada('0x4f')]({'where':{'id':_0x325866['params']['id']}})['then'](handleEntityNotFound(_0x212acb,null))['then'](function(_0x5eef85){if(_0x5eef85){_0x325866['body'][_0x8ada('0x50')]=_0x5eef85['id'];_0x325866[_0x8ada('0x49')]['Subjects']=integrations[_0x8ada('0x51')](_0x325866[_0x8ada('0x49')][_0x8ada('0x52')],_0x325866[_0x8ada('0x49')][_0x8ada('0x2e')]);_0x325866[_0x8ada('0x49')][_0x8ada('0x53')]=integrations[_0x8ada('0x54')](_0x325866[_0x8ada('0x49')][_0x8ada('0x52')],_0x325866[_0x8ada('0x49')][_0x8ada('0x2e')]);return db['DeskConfiguration'][_0x8ada('0x47')](_0x325866[_0x8ada('0x49')],{'include':[{'model':db[_0x8ada('0x55')],'as':_0x8ada('0x56')},{'model':db[_0x8ada('0x55')],'as':_0x8ada('0x53')}]});}return null;})[_0x8ada('0x25')](respondWithResult(_0x212acb,null))['catch'](handleError(_0x212acb,null));};exports['getFields']=function(_0x21b8eb,_0x2db97f,_0x32dc8d){var _0x24c176=[{'name':_0x8ada('0x57'),'label':_0x8ada('0x57'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x569015='';return db['DeskAccount'][_0x8ada('0x4f')]({'where':{'id':_0x21b8eb['params']['id']},'attributes':['id',_0x8ada('0x58'),_0x8ada('0x59'),_0x8ada('0x5a'),_0x8ada('0x5b'),_0x8ada('0x5c'),_0x8ada('0x5d'),_0x8ada('0x5e'),_0x8ada('0x5f')]})[_0x8ada('0x25')](handleEntityNotFound(_0x2db97f,null))[_0x8ada('0x25')](function(_0x1ae88e){if(_0x1ae88e){_0x569015=_0x1ae88e[_0x8ada('0x58')];var _0x33d8c6=_0x569015[_0x8ada('0x60')](-0x1);if(_0x33d8c6==='/'){_0x569015=_0x569015[_0x8ada('0x61')](0x0,_0x569015[_0x8ada('0x62')](_0x33d8c6));}var _0x31810b={'method':'GET','uri':util['format'](_0x8ada('0x63'),_0x569015),'headers':{'Content-Type':_0x8ada('0x64'),'Accept':_0x8ada('0x64')},'json':!![]};if(_0x1ae88e[_0x8ada('0x59')]==='basic'){_0x31810b[_0x8ada('0x65')]['Authorization']=util['format'](_0x8ada('0x66'),new Buffer(util[_0x8ada('0x67')](_0x8ada('0x68'),_0x1ae88e[_0x8ada('0x5a')],_0x1ae88e[_0x8ada('0x5b')]))['toString'](_0x8ada('0x69')));}return rp(_0x31810b)[_0x8ada('0x25')](function(_0x1e214e){return _0x24c176[_0x8ada('0x6a')](_[_0x8ada('0x2a')](_0x1e214e[_0x8ada('0x6b')]['entries'],function(_0x6ecd9b){return{'id':_0x6ecd9b[_0x8ada('0x30')],'name':_0x6ecd9b['name'],'type':_0x6ecd9b['type'],'active':_0x6ecd9b['active'],'label':_0x6ecd9b['label'],'custom':!![]};}));});}})['then'](function(_0x5a5515){return{'count':_0x5a5515[_0x8ada('0x36')],'rows':_0x5a5515};})[_0x8ada('0x25')](respondWithResult(_0x2db97f,null))[_0x8ada('0x46')](function(_0x4310c5){var _0xfe0df2=_0x21b8eb[_0x8ada('0x31')]['test']?0x1f4:_0x4310c5[_0x8ada('0x6c')]||0x1f4;logger[_0x8ada('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x8ada('0x6d'),_0xfe0df2,JSON[_0x8ada('0x6e')](_0x4310c5));delete _0x4310c5[_0x8ada('0x30')];if(_0xfe0df2===0x191){_0xfe0df2=0x190;}_0x2db97f[_0x8ada('0x1b')](_0xfe0df2)[_0x8ada('0x29')](_0x21b8eb[_0x8ada('0x31')][_0x8ada('0x6f')]?{'message':_0x8ada('0x70'),'statusCode':_0x4310c5[_0x8ada('0x6c')]}:_0x4310c5);});}; \ No newline at end of file +var _0x8654=['statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','DeskAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','findOne','DeskConfiguration','pick','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','%s/custom_fields','application/json','basic','headers','format','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','active','label'];(function(_0x49bcaa,_0x21fe96){var _0x33022e=function(_0x14ea2f){while(--_0x14ea2f){_0x49bcaa['push'](_0x49bcaa['shift']());}};_0x33022e(++_0x21fe96);}(_0x8654,0x7c));var _0x4865=function(_0x250d05,_0x1802a3){_0x250d05=_0x250d05-0x0;var _0x20ed69=_0x8654[_0x250d05];return _0x20ed69;};'use strict';var emlformat=require(_0x4865('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4865('0x1'));var jsonpatch=require(_0x4865('0x2'));var rp=require(_0x4865('0x3'));var moment=require(_0x4865('0x4'));var BPromise=require(_0x4865('0x5'));var Mustache=require(_0x4865('0x6'));var util=require(_0x4865('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4865('0x8'));var ejs=require(_0x4865('0x9'));var fs=require('fs');var fs_extra=require(_0x4865('0xa'));var _=require(_0x4865('0xb'));var squel=require(_0x4865('0xc'));var crypto=require(_0x4865('0xd'));var jsforce=require(_0x4865('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4865('0xf'));var Papa=require(_0x4865('0x10'));var Redis=require(_0x4865('0x11'));var authService=require(_0x4865('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4865('0x13'));var hardwareService=require(_0x4865('0x14'));var logger=require('../../config/logger')(_0x4865('0x15'));var utils=require('../../config/utils');var config=require(_0x4865('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4865('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2f3232,_0x3bd064){_0x3bd064=_0x3bd064||0xcc;return function(_0x15880e){if(_0x15880e){return _0x2f3232[_0x4865('0x18')](_0x3bd064);}return _0x2f3232['status'](_0x3bd064)[_0x4865('0x19')]();};}function respondWithResult(_0x1b6816,_0x5d31e2){_0x5d31e2=_0x5d31e2||0xc8;return function(_0x18a4f4){if(_0x18a4f4){return _0x1b6816[_0x4865('0x1a')](_0x5d31e2)['json'](_0x18a4f4);}};}function respondWithFilteredResult(_0x2ade86,_0xa6be14){return function(_0x4cbfee){if(_0x4cbfee){var _0x555265=typeof _0xa6be14[_0x4865('0x1b')]===_0x4865('0x1c')&&typeof _0xa6be14[_0x4865('0x1d')]===_0x4865('0x1c');var _0x258d64=_0x4cbfee[_0x4865('0x1e')];var _0x57dc36=_0x555265?0x0:_0xa6be14[_0x4865('0x1b')];var _0x236426=_0x555265?_0x4cbfee[_0x4865('0x1e')]:_0xa6be14[_0x4865('0x1b')]+_0xa6be14['limit'];var _0x1cffc9;if(_0x236426>=_0x258d64){_0x236426=_0x258d64;_0x1cffc9=0xc8;}else{_0x1cffc9=0xce;}_0x2ade86['status'](_0x1cffc9);return _0x2ade86[_0x4865('0x1f')](_0x4865('0x20'),_0x57dc36+'-'+_0x236426+'/'+_0x258d64)[_0x4865('0x21')](_0x4cbfee);}return null;};}function patchUpdates(_0x1372fe){return function(_0x5805f0){try{jsonpatch['apply'](_0x5805f0,_0x1372fe,!![]);}catch(_0x45d4e0){return BPromise[_0x4865('0x22')](_0x45d4e0);}return _0x5805f0[_0x4865('0x23')]();};}function saveUpdates(_0x301f20,_0x5696c5){return function(_0x2d63fe){if(_0x2d63fe){return _0x2d63fe[_0x4865('0x24')](_0x301f20)[_0x4865('0x25')](function(_0x4ed278){return _0x4ed278;});}return null;};}function removeEntity(_0x1614a0,_0x237aee){return function(_0x74d06){if(_0x74d06){return _0x74d06[_0x4865('0x26')]()[_0x4865('0x25')](function(){_0x1614a0[_0x4865('0x1a')](0xcc)[_0x4865('0x19')]();});}};}function handleEntityNotFound(_0x169070,_0x3cbd09){return function(_0x58127d){if(!_0x58127d){_0x169070[_0x4865('0x18')](0x194);}return _0x58127d;};}function handleError(_0x50a8c2,_0x45a856){_0x45a856=_0x45a856||0x1f4;return function(_0x522a2c){logger[_0x4865('0x27')](_0x522a2c[_0x4865('0x28')]);if(_0x522a2c['name']){delete _0x522a2c[_0x4865('0x29')];}_0x50a8c2[_0x4865('0x1a')](_0x45a856)[_0x4865('0x2a')](_0x522a2c);};}exports['index']=function(_0xb3cdd,_0x516464){var _0x43b78a={},_0x4f42e1={},_0x3a6d7a={'count':0x0,'rows':[]};var _0x436d31=_['map'](db[_0x4865('0x2b')][_0x4865('0x2c')],function(_0x2a19ed){return{'name':_0x2a19ed[_0x4865('0x2d')],'type':_0x2a19ed[_0x4865('0x2e')][_0x4865('0x2f')]};});_0x4f42e1['model']=_[_0x4865('0x30')](_0x436d31,_0x4865('0x29'));_0x4f42e1[_0x4865('0x31')]=_[_0x4865('0x32')](_0xb3cdd[_0x4865('0x31')]);_0x4f42e1[_0x4865('0x33')]=_[_0x4865('0x34')](_0x4f42e1[_0x4865('0x35')],_0x4f42e1[_0x4865('0x31')]);_0x43b78a[_0x4865('0x36')]=_['intersection'](_0x4f42e1[_0x4865('0x35')],qs['fields'](_0xb3cdd['query'][_0x4865('0x37')]));_0x43b78a['attributes']=_0x43b78a[_0x4865('0x36')][_0x4865('0x38')]?_0x43b78a[_0x4865('0x36')]:_0x4f42e1[_0x4865('0x35')];if(!_0xb3cdd[_0x4865('0x31')][_0x4865('0x39')](_0x4865('0x3a'))){_0x43b78a[_0x4865('0x1d')]=qs[_0x4865('0x1d')](_0xb3cdd[_0x4865('0x31')]['limit']);_0x43b78a[_0x4865('0x1b')]=qs[_0x4865('0x1b')](_0xb3cdd[_0x4865('0x31')]['offset']);}_0x43b78a[_0x4865('0x3b')]=qs[_0x4865('0x3c')](_0xb3cdd[_0x4865('0x31')][_0x4865('0x3c')]);_0x43b78a[_0x4865('0x3d')]=qs[_0x4865('0x33')](_['pick'](_0xb3cdd['query'],_0x4f42e1[_0x4865('0x33')]),_0x436d31);if(_0xb3cdd[_0x4865('0x31')][_0x4865('0x3e')]){_0x43b78a[_0x4865('0x3d')]=_['merge'](_0x43b78a['where'],{'$or':_[_0x4865('0x30')](_0x436d31,function(_0x904019){if(_0x904019[_0x4865('0x2e')]!==_0x4865('0x3f')){var _0x16fdde={};_0x16fdde[_0x904019[_0x4865('0x29')]]={'$like':'%'+_0xb3cdd[_0x4865('0x31')]['filter']+'%'};return _0x16fdde;}})});}_0x43b78a=_[_0x4865('0x40')]({},_0x43b78a,_0xb3cdd[_0x4865('0x41')]);var _0x5d0639={'where':_0x43b78a[_0x4865('0x3d')]};return db[_0x4865('0x2b')][_0x4865('0x1e')](_0x5d0639)[_0x4865('0x25')](function(_0x25c78a){_0x3a6d7a[_0x4865('0x1e')]=_0x25c78a;if(_0xb3cdd['query'][_0x4865('0x42')]){_0x43b78a[_0x4865('0x43')]=[{'all':!![]}];}return db['DeskAccount'][_0x4865('0x44')](_0x43b78a);})['then'](function(_0x431793){_0x3a6d7a[_0x4865('0x45')]=_0x431793;return _0x3a6d7a;})['then'](respondWithFilteredResult(_0x516464,_0x43b78a))['catch'](handleError(_0x516464,null));};exports[_0x4865('0x46')]=function(_0x1cad9b,_0x479eb1){var _0x2f865f={'raw':![],'where':{'id':_0x1cad9b[_0x4865('0x47')]['id']}},_0x4eb678={};_0x4eb678[_0x4865('0x35')]=_[_0x4865('0x32')](db[_0x4865('0x2b')]['rawAttributes']);_0x4eb678['query']=_[_0x4865('0x32')](_0x1cad9b[_0x4865('0x31')]);_0x4eb678['filters']=_[_0x4865('0x34')](_0x4eb678[_0x4865('0x35')],_0x4eb678[_0x4865('0x31')]);_0x2f865f['attributes']=_[_0x4865('0x34')](_0x4eb678[_0x4865('0x35')],qs[_0x4865('0x37')](_0x1cad9b['query']['fields']));_0x2f865f[_0x4865('0x36')]=_0x2f865f[_0x4865('0x36')][_0x4865('0x38')]?_0x2f865f[_0x4865('0x36')]:_0x4eb678[_0x4865('0x35')];if(_0x1cad9b[_0x4865('0x31')]['includeAll']){_0x2f865f[_0x4865('0x43')]=[{'all':!![]}];}_0x2f865f=_[_0x4865('0x40')]({},_0x2f865f,_0x1cad9b['options']);return db[_0x4865('0x2b')][_0x4865('0x48')](_0x2f865f)[_0x4865('0x25')](handleEntityNotFound(_0x479eb1,null))[_0x4865('0x25')](respondWithResult(_0x479eb1,null))[_0x4865('0x49')](handleError(_0x479eb1,null));};exports[_0x4865('0x4a')]=function(_0x3ed73a,_0x53c666){return db[_0x4865('0x2b')][_0x4865('0x4a')](_0x3ed73a[_0x4865('0x4b')],{})[_0x4865('0x25')](respondWithResult(_0x53c666,0xc9))['catch'](handleError(_0x53c666,null));};exports[_0x4865('0x24')]=function(_0x3806d3,_0x704f12){if(_0x3806d3[_0x4865('0x4b')]['id']){delete _0x3806d3[_0x4865('0x4b')]['id'];}return db[_0x4865('0x2b')][_0x4865('0x48')]({'where':{'id':_0x3806d3['params']['id']}})[_0x4865('0x25')](handleEntityNotFound(_0x704f12,null))['then'](saveUpdates(_0x3806d3[_0x4865('0x4b')],null))['then'](respondWithResult(_0x704f12,null))['catch'](handleError(_0x704f12,null));};exports['destroy']=function(_0x2e8292,_0x6e5fa1){return db[_0x4865('0x2b')]['find']({'where':{'id':_0x2e8292[_0x4865('0x47')]['id']}})['then'](handleEntityNotFound(_0x6e5fa1,null))['then'](removeEntity(_0x6e5fa1,null))[_0x4865('0x49')](handleError(_0x6e5fa1,null));};exports['getConfigurations']=function(_0x3f1622,_0x52aa24,_0x209610){var _0x51bb6f={};var _0x1a7cad={};var _0x579916;var _0x32d6e2;return db[_0x4865('0x2b')][_0x4865('0x4c')]({'where':{'id':_0x3f1622[_0x4865('0x47')]['id']}})[_0x4865('0x25')](handleEntityNotFound(_0x52aa24,null))[_0x4865('0x25')](function(_0x212253){if(_0x212253){_0x579916=_0x212253;_0x1a7cad['model']=_[_0x4865('0x32')](db[_0x4865('0x4d')][_0x4865('0x2c')]);_0x1a7cad[_0x4865('0x31')]=_[_0x4865('0x32')](_0x3f1622[_0x4865('0x31')]);_0x1a7cad['filters']=_['intersection'](_0x1a7cad['model'],_0x1a7cad[_0x4865('0x31')]);_0x51bb6f['attributes']=_[_0x4865('0x34')](_0x1a7cad['model'],qs[_0x4865('0x37')](_0x3f1622[_0x4865('0x31')][_0x4865('0x37')]));_0x51bb6f[_0x4865('0x36')]=_0x51bb6f[_0x4865('0x36')]['length']?_0x51bb6f[_0x4865('0x36')]:_0x1a7cad[_0x4865('0x35')];_0x51bb6f['order']=qs[_0x4865('0x3c')](_0x3f1622[_0x4865('0x31')]['sort']);_0x51bb6f['where']=qs[_0x4865('0x33')](_[_0x4865('0x4e')](_0x3f1622[_0x4865('0x31')],_0x1a7cad['filters']));if(_0x3f1622[_0x4865('0x31')][_0x4865('0x3e')]){_0x51bb6f[_0x4865('0x3d')]=_[_0x4865('0x40')](_0x51bb6f[_0x4865('0x3d')],{'$or':_[_0x4865('0x30')](_0x51bb6f['attributes'],function(_0x5a12c3){var _0x5d8868={};_0x5d8868[_0x5a12c3]={'$like':'%'+_0x3f1622[_0x4865('0x31')][_0x4865('0x3e')]+'%'};return _0x5d8868;})});}_0x51bb6f=_[_0x4865('0x40')]({},_0x51bb6f,_0x3f1622[_0x4865('0x41')]);return _0x579916[_0x4865('0x4f')](_0x51bb6f);}})['then'](function(_0x1931f6){if(_0x1931f6){_0x32d6e2=_0x1931f6[_0x4865('0x38')];if(!_0x3f1622[_0x4865('0x31')]['hasOwnProperty'](_0x4865('0x3a'))){_0x51bb6f[_0x4865('0x1d')]=qs[_0x4865('0x1d')](_0x3f1622[_0x4865('0x31')][_0x4865('0x1d')]);_0x51bb6f[_0x4865('0x1b')]=qs['offset'](_0x3f1622[_0x4865('0x31')][_0x4865('0x1b')]);}return _0x579916['getConfigurations'](_0x51bb6f);}})[_0x4865('0x25')](function(_0x417577){if(_0x417577){return _0x417577?{'count':_0x32d6e2,'rows':_0x417577}:null;}})['then'](respondWithResult(_0x52aa24,null))[_0x4865('0x49')](handleError(_0x52aa24,null));};exports['addConfiguration']=function(_0x22fd7a,_0x3e0b7e,_0x40caf3){if(_0x22fd7a['body']['id']){delete _0x22fd7a[_0x4865('0x4b')]['id'];}return db[_0x4865('0x2b')]['findOne']({'where':{'id':_0x22fd7a[_0x4865('0x47')]['id']}})[_0x4865('0x25')](handleEntityNotFound(_0x3e0b7e,null))['then'](function(_0x52367f){if(_0x52367f){_0x22fd7a[_0x4865('0x4b')][_0x4865('0x50')]=_0x52367f['id'];_0x22fd7a[_0x4865('0x4b')][_0x4865('0x51')]=integrations[_0x4865('0x52')](_0x22fd7a[_0x4865('0x4b')][_0x4865('0x53')],_0x22fd7a[_0x4865('0x4b')][_0x4865('0x2e')]);_0x22fd7a[_0x4865('0x4b')][_0x4865('0x54')]=integrations[_0x4865('0x55')](_0x22fd7a['body']['channel'],_0x22fd7a[_0x4865('0x4b')][_0x4865('0x2e')]);return db['DeskConfiguration'][_0x4865('0x4a')](_0x22fd7a[_0x4865('0x4b')],{'include':[{'model':db[_0x4865('0x56')],'as':_0x4865('0x51')},{'model':db['DeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3e0b7e,null))['catch'](handleError(_0x3e0b7e,null));};exports[_0x4865('0x57')]=function(_0x82d5c6,_0x2ef17c,_0xc3955){var _0x44ec31=[{'name':'priority','label':_0x4865('0x58'),'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 _0x25626c='';return db['DeskAccount'][_0x4865('0x4c')]({'where':{'id':_0x82d5c6[_0x4865('0x47')]['id']},'attributes':['id',_0x4865('0x59'),_0x4865('0x5a'),_0x4865('0x5b'),_0x4865('0x5c'),_0x4865('0x5d'),_0x4865('0x5e'),_0x4865('0x5f'),_0x4865('0x60')]})[_0x4865('0x25')](handleEntityNotFound(_0x2ef17c,null))[_0x4865('0x25')](function(_0x583409){if(_0x583409){_0x25626c=_0x583409[_0x4865('0x59')];var _0x10a85c=_0x25626c[_0x4865('0x61')](-0x1);if(_0x10a85c==='/'){_0x25626c=_0x25626c[_0x4865('0x62')](0x0,_0x25626c[_0x4865('0x63')](_0x10a85c));}var _0x545737={'method':_0x4865('0x64'),'uri':util['format'](_0x4865('0x65'),_0x25626c),'headers':{'Content-Type':_0x4865('0x66'),'Accept':_0x4865('0x66')},'json':!![]};if(_0x583409[_0x4865('0x5a')]===_0x4865('0x67')){_0x545737[_0x4865('0x68')]['Authorization']=util[_0x4865('0x69')](_0x4865('0x6a'),new Buffer(util['format'](_0x4865('0x6b'),_0x583409[_0x4865('0x5b')],_0x583409[_0x4865('0x5c')]))[_0x4865('0x6c')](_0x4865('0x6d')));}return rp(_0x545737)[_0x4865('0x25')](function(_0x4eff70){return _0x44ec31[_0x4865('0x6e')](_[_0x4865('0x30')](_0x4eff70[_0x4865('0x6f')]['entries'],function(_0x40852f){return{'id':_0x40852f[_0x4865('0x29')],'name':_0x40852f[_0x4865('0x29')],'type':_0x40852f[_0x4865('0x2e')],'active':_0x40852f[_0x4865('0x70')],'label':_0x40852f[_0x4865('0x71')],'custom':!![]};}));});}})[_0x4865('0x25')](function(_0x3bff20){return{'count':_0x3bff20[_0x4865('0x38')],'rows':_0x3bff20};})[_0x4865('0x25')](respondWithResult(_0x2ef17c,null))['catch'](function(_0x173a9e){var _0x3fdbde=_0x82d5c6['query']['test']?0x1f4:_0x173a9e[_0x4865('0x72')]||0x1f4;logger[_0x4865('0x27')](_0x4865('0x73'),'getFields',_0x3fdbde,JSON[_0x4865('0x74')](_0x173a9e));delete _0x173a9e['name'];if(_0x3fdbde===0x191){_0x3fdbde=0x190;}_0x2ef17c[_0x4865('0x1a')](_0x3fdbde)[_0x4865('0x2a')](_0x82d5c6[_0x4865('0x31')][_0x4865('0x75')]?{'message':_0x4865('0x76'),'statusCode':_0x173a9e[_0x4865('0x72')]}:_0x173a9e);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 9f758fb..f6cc1f8 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 _0x6c20=['rimraf','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','util','../../config/logger','bluebird','request-promise'];(function(_0x4ceda8,_0x3b91cc){var _0x122eb2=function(_0x2db4cc){while(--_0x2db4cc){_0x4ceda8['push'](_0x4ceda8['shift']());}};_0x122eb2(++_0x3b91cc);}(_0x6c20,0xe3));var _0x06c2=function(_0x23e33d,_0x31c8c8){_0x23e33d=_0x23e33d-0x0;var _0x818fc=_0x6c20[_0x23e33d];return _0x818fc;};'use strict';var _=require('lodash');var util=require(_0x06c2('0x0'));var logger=require(_0x06c2('0x1'))('api');var moment=require('moment');var BPromise=require(_0x06c2('0x2'));var rp=require(_0x06c2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06c2('0x4'));var config=require('../../config/environment');var attributes=require(_0x06c2('0x5'));var integrations=require(_0x06c2('0x6'));module[_0x06c2('0x7')]=function(_0x537cb9,_0x4b8f73){return _0x537cb9[_0x06c2('0x8')](_0x06c2('0x9'),attributes,{'tableName':_0x06c2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1394=['bluebird','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','api'];(function(_0x429141,_0x2eaf51){var _0x478a16=function(_0x4fea1c){while(--_0x4fea1c){_0x429141['push'](_0x429141['shift']());}};_0x478a16(++_0x2eaf51);}(_0x1394,0x1b8));var _0x4139=function(_0x168d46,_0x12aeb1){_0x168d46=_0x168d46-0x0;var _0x628fda=_0x1394[_0x168d46];return _0x628fda;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4139('0x0'));var moment=require('moment');var BPromise=require(_0x4139('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4139('0x2'));var config=require(_0x4139('0x3'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x4139('0x4'));module[_0x4139('0x5')]=function(_0x4f772b,_0x4da23c){return _0x4f772b[_0x4139('0x6')](_0x4139('0x7'),attributes,{'tableName':_0x4139('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index ed9054d..5d0f8d1 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 _0xee48=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDeskAccount','DeskAccount','options','raw','where','attributes','map','model','include','ShowDeskAccount','find','then','util','moment','bluebird','randomstring'];(function(_0x2dda31,_0x41f900){var _0x10735a=function(_0x147685){while(--_0x147685){_0x2dda31['push'](_0x2dda31['shift']());}};_0x10735a(++_0x41f900);}(_0xee48,0xab));var _0x8ee4=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xee48[_0x4ae625];return _0x31accf;};'use strict';var _=require('lodash');var util=require(_0x8ee4('0x0'));var moment=require(_0x8ee4('0x1'));var BPromise=require(_0x8ee4('0x2'));var rs=require(_0x8ee4('0x3'));var fs=require('fs');var Redis=require(_0x8ee4('0x4'));var db=require(_0x8ee4('0x5'))['db'];var utils=require(_0x8ee4('0x6'));var logger=require(_0x8ee4('0x7'))(_0x8ee4('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8ee4('0x9')][_0x8ee4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x541fb5,_0x58e317,_0x44f9d8){return new BPromise(function(_0x17943e,_0x1ca818){return client[_0x8ee4('0xb')](_0x541fb5,_0x44f9d8)['then'](function(_0x2ea56e){logger[_0x8ee4('0xc')](_0x8ee4('0xd'),_0x58e317,_0x8ee4('0xe'));logger[_0x8ee4('0xf')](_0x8ee4('0x10'),_0x58e317,'request\x20sent',JSON[_0x8ee4('0x11')](_0x2ea56e));if(_0x2ea56e[_0x8ee4('0x12')]){if(_0x2ea56e[_0x8ee4('0x12')][_0x8ee4('0x13')]===0x1f4){logger[_0x8ee4('0x12')](_0x8ee4('0xd'),_0x58e317,_0x2ea56e['error']['message']);return _0x1ca818(_0x2ea56e[_0x8ee4('0x12')][_0x8ee4('0x14')]);}logger[_0x8ee4('0x12')](_0x8ee4('0xd'),_0x58e317,_0x2ea56e[_0x8ee4('0x12')]['message']);return _0x17943e(_0x2ea56e[_0x8ee4('0x12')][_0x8ee4('0x14')]);}else{logger['info'](_0x8ee4('0xd'),_0x58e317,'request\x20sent');_0x17943e(_0x2ea56e[_0x8ee4('0x15')][_0x8ee4('0x14')]);}})[_0x8ee4('0x16')](function(_0x26014d){logger[_0x8ee4('0x12')](_0x8ee4('0xd'),_0x58e317,_0x26014d);_0x1ca818(_0x26014d);});});}exports[_0x8ee4('0x17')]=function(_0x5317dc){var _0x5c3232=this;return new Promise(function(_0x2f961d,_0x1c209b){return db[_0x8ee4('0x18')]['findAll']({'raw':_0x5317dc['options']?_0x5317dc[_0x8ee4('0x19')][_0x8ee4('0x1a')]===undefined?!![]:![]:!![],'where':_0x5317dc[_0x8ee4('0x19')]?_0x5317dc[_0x8ee4('0x19')][_0x8ee4('0x1b')]||null:null,'attributes':_0x5317dc[_0x8ee4('0x19')]?_0x5317dc[_0x8ee4('0x19')][_0x8ee4('0x1c')]||null:null,'limit':_0x5317dc[_0x8ee4('0x19')]?_0x5317dc[_0x8ee4('0x19')]['limit']||null:null,'include':_0x5317dc[_0x8ee4('0x19')]?_0x5317dc['options']['include']?_[_0x8ee4('0x1d')](_0x5317dc[_0x8ee4('0x19')]['include'],function(_0x15faef){return{'model':db[_0x15faef[_0x8ee4('0x1e')]],'as':_0x15faef['as'],'attributes':_0x15faef['attributes'],'include':_0x15faef[_0x8ee4('0x1f')]?_[_0x8ee4('0x1d')](_0x15faef['include'],function(_0x503a24){return{'model':db[_0x503a24[_0x8ee4('0x1e')]],'as':_0x503a24['as'],'attributes':_0x503a24['attributes'],'include':_0x503a24[_0x8ee4('0x1f')]?_['map'](_0x503a24[_0x8ee4('0x1f')],function(_0x31d40c){return{'model':db[_0x31d40c[_0x8ee4('0x1e')]],'as':_0x31d40c['as'],'attributes':_0x31d40c[_0x8ee4('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x583c9a){logger[_0x8ee4('0xc')](_0x8ee4('0x17'),_0x5317dc);logger[_0x8ee4('0xf')](_0x8ee4('0x17'),_0x5317dc,JSON['stringify'](_0x583c9a));_0x2f961d(_0x583c9a);})[_0x8ee4('0x16')](function(_0x1e0d46){logger['error'](_0x8ee4('0x17'),_0x1e0d46[_0x8ee4('0x14')],_0x5317dc);_0x1c209b(_0x5c3232[_0x8ee4('0x12')](0x1f4,_0x1e0d46[_0x8ee4('0x14')]));});});};exports[_0x8ee4('0x20')]=function(_0x62e393){var _0x475617=this;return new Promise(function(_0x446256,_0x5a4d72){return db[_0x8ee4('0x18')][_0x8ee4('0x21')]({'raw':_0x62e393[_0x8ee4('0x19')]?_0x62e393[_0x8ee4('0x19')][_0x8ee4('0x1a')]===undefined?!![]:![]:!![],'where':_0x62e393[_0x8ee4('0x19')]?_0x62e393[_0x8ee4('0x19')]['where']||null:null,'attributes':_0x62e393[_0x8ee4('0x19')]?_0x62e393[_0x8ee4('0x19')]['attributes']||null:null,'include':_0x62e393[_0x8ee4('0x19')]?_0x62e393[_0x8ee4('0x19')][_0x8ee4('0x1f')]?_[_0x8ee4('0x1d')](_0x62e393[_0x8ee4('0x19')]['include'],function(_0xadf29b){return{'model':db[_0xadf29b[_0x8ee4('0x1e')]],'as':_0xadf29b['as'],'attributes':_0xadf29b[_0x8ee4('0x1c')],'include':_0xadf29b['include']?_['map'](_0xadf29b[_0x8ee4('0x1f')],function(_0x3f1bc0){return{'model':db[_0x3f1bc0['model']],'as':_0x3f1bc0['as'],'attributes':_0x3f1bc0[_0x8ee4('0x1c')],'include':_0x3f1bc0[_0x8ee4('0x1f')]?_[_0x8ee4('0x1d')](_0x3f1bc0[_0x8ee4('0x1f')],function(_0x267087){return{'model':db[_0x267087[_0x8ee4('0x1e')]],'as':_0x267087['as'],'attributes':_0x267087['attributes']};}):[]};}):[]};}):[]:[]})[_0x8ee4('0x22')](function(_0x33539b){logger['info']('ShowDeskAccount',_0x62e393);logger['debug'](_0x8ee4('0x20'),_0x62e393,JSON[_0x8ee4('0x11')](_0x33539b));_0x446256(_0x33539b);})[_0x8ee4('0x16')](function(_0x4db03d){logger[_0x8ee4('0x12')](_0x8ee4('0x20'),_0x4db03d[_0x8ee4('0x14')],_0x62e393);_0x5a4d72(_0x475617[_0x8ee4('0x12')](0x1f4,_0x4db03d[_0x8ee4('0x14')]));});});}; \ No newline at end of file +var _0xef79=['http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','DeskAccount','findAll','options','where','attributes','include','map','model','GetDeskAccount','find','ShowDeskAccount','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4dc0c8,_0x48d51f){var _0x26bf81=function(_0x1093f6){while(--_0x1093f6){_0x4dc0c8['push'](_0x4dc0c8['shift']());}};_0x26bf81(++_0x48d51f);}(_0xef79,0xa8));var _0x9ef7=function(_0x1173a1,_0x153607){_0x1173a1=_0x1173a1-0x0;var _0x2d9039=_0xef79[_0x1173a1];return _0x2d9039;};'use strict';var _=require(_0x9ef7('0x0'));var util=require(_0x9ef7('0x1'));var moment=require(_0x9ef7('0x2'));var BPromise=require(_0x9ef7('0x3'));var rs=require(_0x9ef7('0x4'));var fs=require('fs');var Redis=require(_0x9ef7('0x5'));var db=require(_0x9ef7('0x6'))['db'];var utils=require(_0x9ef7('0x7'));var logger=require(_0x9ef7('0x8'))(_0x9ef7('0x9'));var config=require(_0x9ef7('0xa'));var jayson=require(_0x9ef7('0xb'));var client=jayson['client'][_0x9ef7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2477a9,_0x49a1e4,_0x18d706){return new BPromise(function(_0x412769,_0x1ee62d){return client[_0x9ef7('0xd')](_0x2477a9,_0x18d706)[_0x9ef7('0xe')](function(_0x54458d){logger[_0x9ef7('0xf')](_0x9ef7('0x10'),_0x49a1e4,_0x9ef7('0x11'));logger['debug'](_0x9ef7('0x12'),_0x49a1e4,_0x9ef7('0x11'),JSON[_0x9ef7('0x13')](_0x54458d));if(_0x54458d[_0x9ef7('0x14')]){if(_0x54458d[_0x9ef7('0x14')][_0x9ef7('0x15')]===0x1f4){logger['error']('DeskAccount,\x20%s,\x20%s',_0x49a1e4,_0x54458d[_0x9ef7('0x14')][_0x9ef7('0x16')]);return _0x1ee62d(_0x54458d['error'][_0x9ef7('0x16')]);}logger[_0x9ef7('0x14')]('DeskAccount,\x20%s,\x20%s',_0x49a1e4,_0x54458d['error'][_0x9ef7('0x16')]);return _0x412769(_0x54458d[_0x9ef7('0x14')][_0x9ef7('0x16')]);}else{logger['info'](_0x9ef7('0x10'),_0x49a1e4,_0x9ef7('0x11'));_0x412769(_0x54458d['result'][_0x9ef7('0x16')]);}})[_0x9ef7('0x17')](function(_0x321641){logger['error'](_0x9ef7('0x10'),_0x49a1e4,_0x321641);_0x1ee62d(_0x321641);});});}exports['GetDeskAccount']=function(_0x14c513){var _0x526051=this;return new Promise(function(_0x34e066,_0xdffc0d){return db[_0x9ef7('0x18')][_0x9ef7('0x19')]({'raw':_0x14c513[_0x9ef7('0x1a')]?_0x14c513[_0x9ef7('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x14c513[_0x9ef7('0x1a')]?_0x14c513['options'][_0x9ef7('0x1b')]||null:null,'attributes':_0x14c513[_0x9ef7('0x1a')]?_0x14c513[_0x9ef7('0x1a')][_0x9ef7('0x1c')]||null:null,'limit':_0x14c513[_0x9ef7('0x1a')]?_0x14c513['options']['limit']||null:null,'include':_0x14c513[_0x9ef7('0x1a')]?_0x14c513[_0x9ef7('0x1a')][_0x9ef7('0x1d')]?_[_0x9ef7('0x1e')](_0x14c513[_0x9ef7('0x1a')]['include'],function(_0x234993){return{'model':db[_0x234993['model']],'as':_0x234993['as'],'attributes':_0x234993[_0x9ef7('0x1c')],'include':_0x234993[_0x9ef7('0x1d')]?_[_0x9ef7('0x1e')](_0x234993['include'],function(_0x23b859){return{'model':db[_0x23b859[_0x9ef7('0x1f')]],'as':_0x23b859['as'],'attributes':_0x23b859[_0x9ef7('0x1c')],'include':_0x23b859[_0x9ef7('0x1d')]?_[_0x9ef7('0x1e')](_0x23b859[_0x9ef7('0x1d')],function(_0x197ad8){return{'model':db[_0x197ad8[_0x9ef7('0x1f')]],'as':_0x197ad8['as'],'attributes':_0x197ad8[_0x9ef7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9ef7('0xe')](function(_0x2906d5){logger[_0x9ef7('0xf')](_0x9ef7('0x20'),_0x14c513);logger['debug'](_0x9ef7('0x20'),_0x14c513,JSON[_0x9ef7('0x13')](_0x2906d5));_0x34e066(_0x2906d5);})[_0x9ef7('0x17')](function(_0x166856){logger['error'](_0x9ef7('0x20'),_0x166856['message'],_0x14c513);_0xdffc0d(_0x526051[_0x9ef7('0x14')](0x1f4,_0x166856[_0x9ef7('0x16')]));});});};exports['ShowDeskAccount']=function(_0x37e0ba){var _0x4f8216=this;return new Promise(function(_0x1e95c0,_0x361137){return db[_0x9ef7('0x18')][_0x9ef7('0x21')]({'raw':_0x37e0ba['options']?_0x37e0ba['options']['raw']===undefined?!![]:![]:!![],'where':_0x37e0ba[_0x9ef7('0x1a')]?_0x37e0ba['options']['where']||null:null,'attributes':_0x37e0ba['options']?_0x37e0ba['options'][_0x9ef7('0x1c')]||null:null,'include':_0x37e0ba[_0x9ef7('0x1a')]?_0x37e0ba[_0x9ef7('0x1a')][_0x9ef7('0x1d')]?_[_0x9ef7('0x1e')](_0x37e0ba[_0x9ef7('0x1a')][_0x9ef7('0x1d')],function(_0x34cda0){return{'model':db[_0x34cda0['model']],'as':_0x34cda0['as'],'attributes':_0x34cda0[_0x9ef7('0x1c')],'include':_0x34cda0[_0x9ef7('0x1d')]?_['map'](_0x34cda0[_0x9ef7('0x1d')],function(_0x34ec6b){return{'model':db[_0x34ec6b['model']],'as':_0x34ec6b['as'],'attributes':_0x34ec6b[_0x9ef7('0x1c')],'include':_0x34ec6b['include']?_[_0x9ef7('0x1e')](_0x34ec6b['include'],function(_0x33e6a){return{'model':db[_0x33e6a[_0x9ef7('0x1f')]],'as':_0x33e6a['as'],'attributes':_0x33e6a[_0x9ef7('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd6dd41){logger[_0x9ef7('0xf')](_0x9ef7('0x22'),_0x37e0ba);logger[_0x9ef7('0x23')](_0x9ef7('0x22'),_0x37e0ba,JSON[_0x9ef7('0x13')](_0xd6dd41));_0x1e95c0(_0xd6dd41);})['catch'](function(_0x5475a1){logger['error'](_0x9ef7('0x22'),_0x5475a1[_0x9ef7('0x16')],_0x37e0ba);_0x361137(_0x4f8216['error'](0x1f4,_0x5475a1['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index db3202d..973e2eb 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(_0x3a4a42,_0x61f1e){var _0x1ee783=function(_0x5653ee){while(--_0x5653ee){_0x3a4a42['push'](_0x3a4a42['shift']());}};_0x1ee783(++_0x61f1e);}(_0x9c44,0x178));var _0x49c4=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x9c44[_0x2d2c16];return _0x53f2fb;};'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(_0x5dab79,_0x3a1656){var _0xeaed0b=function(_0x100747){while(--_0x100747){_0x5dab79['push'](_0x5dab79['shift']());}};_0xeaed0b(++_0x3a1656);}(_0xedd9,0xfc));var _0x9edd=function(_0x4a3b65,_0x5ea0fb){_0x4a3b65=_0x4a3b65-0x0;var _0x352604=_0xedd9[_0x4a3b65];return _0x352604;};'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 7236d62..2d1b196 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 _0xdbf1=['STRING','sequelize'];(function(_0x1d908b,_0x4abdba){var _0x13559a=function(_0x4bb5f7){while(--_0x4bb5f7){_0x1d908b['push'](_0x1d908b['shift']());}};_0x13559a(++_0x4abdba);}(_0xdbf1,0xd3));var _0x1dbf=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xdbf1[_0x710815];return _0x5b3b89;};'use strict';var Sequelize=require(_0x1dbf('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1dbf('0x1')]}}; \ No newline at end of file +var _0x74fa=['sequelize','exports','STRING'];(function(_0x3c9659,_0x4ef2c0){var _0xa45331=function(_0x430b0f){while(--_0x430b0f){_0x3c9659['push'](_0x3c9659['shift']());}};_0xa45331(++_0x4ef2c0);}(_0x74fa,0x180));var _0xa74f=function(_0x12f665,_0x369186){_0x12f665=_0x12f665-0x0;var _0x148d63=_0x74fa[_0x12f665];return _0x148d63;};'use strict';var Sequelize=require(_0xa74f('0x0'));module[_0xa74f('0x1')]={'name':{'type':Sequelize[_0xa74f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 20fe29c..5dbf6f8 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 _0x9244=['sort','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','findOne','where','getFields','DeskField','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x19b1c2,_0x205062){var _0x4e1ae5=function(_0x5a1cb7){while(--_0x5a1cb7){_0x19b1c2['push'](_0x19b1c2['shift']());}};_0x4e1ae5(++_0x205062);}(_0x9244,0x72));var _0x4924=function(_0x1a8617,_0x5b6c70){_0x1a8617=_0x1a8617-0x0;var _0x15f475=_0x9244[_0x1a8617];return _0x15f475;};'use strict';var emlformat=require(_0x4924('0x0'));var rimraf=require(_0x4924('0x1'));var zipdir=require(_0x4924('0x2'));var jsonpatch=require(_0x4924('0x3'));var rp=require(_0x4924('0x4'));var moment=require(_0x4924('0x5'));var BPromise=require(_0x4924('0x6'));var Mustache=require(_0x4924('0x7'));var util=require(_0x4924('0x8'));var path=require(_0x4924('0x9'));var sox=require(_0x4924('0xa'));var csv=require('to-csv');var ejs=require(_0x4924('0xb'));var fs=require('fs');var fs_extra=require(_0x4924('0xc'));var _=require('lodash');var squel=require(_0x4924('0xd'));var crypto=require(_0x4924('0xe'));var jsforce=require(_0x4924('0xf'));var deskjs=require(_0x4924('0x10'));var toCsv=require(_0x4924('0x11'));var querystring=require(_0x4924('0x12'));var Papa=require(_0x4924('0x13'));var Redis=require(_0x4924('0x14'));var authService=require(_0x4924('0x15'));var qs=require(_0x4924('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4924('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x4924('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x4924('0x19'));var db=require(_0x4924('0x1a'))['db'];function respondWithStatusCode(_0x3ec52b,_0x534f23){_0x534f23=_0x534f23||0xcc;return function(_0x1e8995){if(_0x1e8995){return _0x3ec52b[_0x4924('0x1b')](_0x534f23);}return _0x3ec52b[_0x4924('0x1c')](_0x534f23)[_0x4924('0x1d')]();};}function respondWithResult(_0x1e6ae7,_0x3e5340){_0x3e5340=_0x3e5340||0xc8;return function(_0x31a0d8){if(_0x31a0d8){return _0x1e6ae7['status'](_0x3e5340)[_0x4924('0x1e')](_0x31a0d8);}};}function respondWithFilteredResult(_0x532c3d,_0x5ce1af){return function(_0x3f5c98){if(_0x3f5c98){var _0x37b265=typeof _0x5ce1af[_0x4924('0x1f')]===_0x4924('0x20')&&typeof _0x5ce1af[_0x4924('0x21')]===_0x4924('0x20');var _0xda4f1c=_0x3f5c98[_0x4924('0x22')];var _0x2c02b1=_0x37b265?0x0:_0x5ce1af[_0x4924('0x1f')];var _0x7f85ab=_0x37b265?_0x3f5c98['count']:_0x5ce1af[_0x4924('0x1f')]+_0x5ce1af[_0x4924('0x21')];var _0x1e90b4;if(_0x7f85ab>=_0xda4f1c){_0x7f85ab=_0xda4f1c;_0x1e90b4=0xc8;}else{_0x1e90b4=0xce;}_0x532c3d[_0x4924('0x1c')](_0x1e90b4);return _0x532c3d[_0x4924('0x23')]('Content-Range',_0x2c02b1+'-'+_0x7f85ab+'/'+_0xda4f1c)[_0x4924('0x1e')](_0x3f5c98);}return null;};}function patchUpdates(_0x296bb5){return function(_0x58e04a){try{jsonpatch[_0x4924('0x24')](_0x58e04a,_0x296bb5,!![]);}catch(_0x5d786b){return BPromise[_0x4924('0x25')](_0x5d786b);}return _0x58e04a[_0x4924('0x26')]();};}function saveUpdates(_0x1d3db1,_0x412913){return function(_0x2db207){if(_0x2db207){return _0x2db207[_0x4924('0x27')](_0x1d3db1)['then'](function(_0x54d0f8){return _0x54d0f8;});}return null;};}function removeEntity(_0x5a78be,_0x17c902){return function(_0x3d22bf){if(_0x3d22bf){return _0x3d22bf[_0x4924('0x28')]()[_0x4924('0x29')](function(){_0x5a78be[_0x4924('0x1c')](0xcc)[_0x4924('0x1d')]();});}};}function handleEntityNotFound(_0x311e7b,_0x54487a){return function(_0x5c6126){if(!_0x5c6126){_0x311e7b[_0x4924('0x1b')](0x194);}return _0x5c6126;};}function handleError(_0x13a873,_0x552994){_0x552994=_0x552994||0x1f4;return function(_0x4d4775){logger[_0x4924('0x2a')](_0x4d4775[_0x4924('0x2b')]);if(_0x4d4775[_0x4924('0x2c')]){delete _0x4d4775[_0x4924('0x2c')];}_0x13a873[_0x4924('0x1c')](_0x552994)[_0x4924('0x2d')](_0x4d4775);};}exports[_0x4924('0x2e')]=function(_0x27d5a1,_0x51aa6e){var _0xa975c2={},_0x5176b2={},_0x25d285={'count':0x0,'rows':[]};var _0x255e9d=_[_0x4924('0x2f')](db[_0x4924('0x30')][_0x4924('0x31')],function(_0xd86813){return{'name':_0xd86813['fieldName'],'type':_0xd86813['type'][_0x4924('0x32')]};});_0x5176b2[_0x4924('0x33')]=_[_0x4924('0x2f')](_0x255e9d,_0x4924('0x2c'));_0x5176b2[_0x4924('0x34')]=_[_0x4924('0x35')](_0x27d5a1[_0x4924('0x34')]);_0x5176b2[_0x4924('0x36')]=_[_0x4924('0x37')](_0x5176b2['model'],_0x5176b2[_0x4924('0x34')]);_0xa975c2[_0x4924('0x38')]=_['intersection'](_0x5176b2[_0x4924('0x33')],qs[_0x4924('0x39')](_0x27d5a1[_0x4924('0x34')][_0x4924('0x39')]));_0xa975c2[_0x4924('0x38')]=_0xa975c2[_0x4924('0x38')][_0x4924('0x3a')]?_0xa975c2[_0x4924('0x38')]:_0x5176b2[_0x4924('0x33')];if(!_0x27d5a1[_0x4924('0x34')][_0x4924('0x3b')](_0x4924('0x3c'))){_0xa975c2[_0x4924('0x21')]=qs[_0x4924('0x21')](_0x27d5a1[_0x4924('0x34')][_0x4924('0x21')]);_0xa975c2[_0x4924('0x1f')]=qs[_0x4924('0x1f')](_0x27d5a1['query'][_0x4924('0x1f')]);}_0xa975c2[_0x4924('0x3d')]=qs[_0x4924('0x3e')](_0x27d5a1[_0x4924('0x34')][_0x4924('0x3e')]);_0xa975c2['where']=qs[_0x4924('0x36')](_[_0x4924('0x3f')](_0x27d5a1[_0x4924('0x34')],_0x5176b2[_0x4924('0x36')]),_0x255e9d);if(_0x27d5a1[_0x4924('0x34')][_0x4924('0x40')]){_0xa975c2['where']=_[_0x4924('0x41')](_0xa975c2['where'],{'$or':_[_0x4924('0x2f')](_0x255e9d,function(_0x1008d1){if(_0x1008d1['type']!==_0x4924('0x42')){var _0x13a44b={};_0x13a44b[_0x1008d1[_0x4924('0x2c')]]={'$like':'%'+_0x27d5a1['query'][_0x4924('0x40')]+'%'};return _0x13a44b;}})});}_0xa975c2=_[_0x4924('0x41')]({},_0xa975c2,_0x27d5a1[_0x4924('0x43')]);var _0x439461={'where':_0xa975c2['where']};return db[_0x4924('0x30')][_0x4924('0x22')](_0x439461)[_0x4924('0x29')](function(_0x316af1){_0x25d285[_0x4924('0x22')]=_0x316af1;if(_0x27d5a1['query'][_0x4924('0x44')]){_0xa975c2[_0x4924('0x45')]=[{'all':!![]}];}return db[_0x4924('0x30')][_0x4924('0x46')](_0xa975c2);})['then'](function(_0x12495e){_0x25d285[_0x4924('0x47')]=_0x12495e;return _0x25d285;})[_0x4924('0x29')](respondWithFilteredResult(_0x51aa6e,_0xa975c2))[_0x4924('0x48')](handleError(_0x51aa6e,null));};exports[_0x4924('0x49')]=function(_0x152736,_0x136a82){var _0x100d9a={'raw':![],'where':{'id':_0x152736[_0x4924('0x4a')]['id']}},_0x23f836={};_0x23f836[_0x4924('0x33')]=_[_0x4924('0x35')](db['DeskConfiguration'][_0x4924('0x31')]);_0x23f836[_0x4924('0x34')]=_['keys'](_0x152736[_0x4924('0x34')]);_0x23f836[_0x4924('0x36')]=_['intersection'](_0x23f836[_0x4924('0x33')],_0x23f836[_0x4924('0x34')]);_0x100d9a[_0x4924('0x38')]=_[_0x4924('0x37')](_0x23f836['model'],qs['fields'](_0x152736[_0x4924('0x34')][_0x4924('0x39')]));_0x100d9a[_0x4924('0x38')]=_0x100d9a['attributes'][_0x4924('0x3a')]?_0x100d9a[_0x4924('0x38')]:_0x23f836[_0x4924('0x33')];if(_0x152736[_0x4924('0x34')][_0x4924('0x44')]){_0x100d9a[_0x4924('0x45')]=[{'all':!![]}];}_0x100d9a=_['merge']({},_0x100d9a,_0x152736[_0x4924('0x43')]);return db[_0x4924('0x30')]['find'](_0x100d9a)['then'](handleEntityNotFound(_0x136a82,null))[_0x4924('0x29')](respondWithResult(_0x136a82,null))[_0x4924('0x48')](handleError(_0x136a82,null));};exports['create']=function(_0x3775e0,_0x2e0d1f){return db[_0x4924('0x30')][_0x4924('0x4b')](_0x3775e0[_0x4924('0x4c')],{})[_0x4924('0x29')](respondWithResult(_0x2e0d1f,0xc9))['catch'](handleError(_0x2e0d1f,null));};exports[_0x4924('0x27')]=function(_0x703c4,_0x56c574){if(_0x703c4[_0x4924('0x4c')]['id']){delete _0x703c4[_0x4924('0x4c')]['id'];}return db[_0x4924('0x30')]['find']({'where':{'id':_0x703c4[_0x4924('0x4a')]['id']}})[_0x4924('0x29')](handleEntityNotFound(_0x56c574,null))[_0x4924('0x29')](saveUpdates(_0x703c4['body'],null))[_0x4924('0x29')](respondWithResult(_0x56c574,null))[_0x4924('0x48')](handleError(_0x56c574,null));};exports['destroy']=function(_0x63cc09,_0xcef06c){return db[_0x4924('0x30')][_0x4924('0x4d')]({'where':{'id':_0x63cc09['params']['id']}})['then'](handleEntityNotFound(_0xcef06c,null))[_0x4924('0x29')](removeEntity(_0xcef06c,null))[_0x4924('0x48')](handleError(_0xcef06c,null));};exports['getFields']=function(_0xbd8edd,_0x2390f5,_0x31ca41){var _0x3ef8cd={};var _0x3d88eb={};var _0x30c73b;var _0x547925;return db[_0x4924('0x30')][_0x4924('0x4e')]({'where':{'id':_0xbd8edd['params']['id']}})['then'](handleEntityNotFound(_0x2390f5,null))[_0x4924('0x29')](function(_0x1492c1){if(_0x1492c1){_0x30c73b=_0x1492c1;_0x3d88eb[_0x4924('0x33')]=_['keys'](db['DeskField'][_0x4924('0x31')]);_0x3d88eb['query']=_[_0x4924('0x35')](_0xbd8edd[_0x4924('0x34')]);_0x3d88eb[_0x4924('0x36')]=_['intersection'](_0x3d88eb[_0x4924('0x33')],_0x3d88eb[_0x4924('0x34')]);_0x3ef8cd['attributes']=_[_0x4924('0x37')](_0x3d88eb[_0x4924('0x33')],qs[_0x4924('0x39')](_0xbd8edd['query']['fields']));_0x3ef8cd[_0x4924('0x38')]=_0x3ef8cd['attributes'][_0x4924('0x3a')]?_0x3ef8cd[_0x4924('0x38')]:_0x3d88eb[_0x4924('0x33')];_0x3ef8cd[_0x4924('0x3d')]=qs[_0x4924('0x3e')](_0xbd8edd[_0x4924('0x34')][_0x4924('0x3e')]);_0x3ef8cd[_0x4924('0x4f')]=qs['filters'](_[_0x4924('0x3f')](_0xbd8edd[_0x4924('0x34')],_0x3d88eb['filters']));if(_0xbd8edd['query'][_0x4924('0x40')]){_0x3ef8cd[_0x4924('0x4f')]=_[_0x4924('0x41')](_0x3ef8cd[_0x4924('0x4f')],{'$or':_[_0x4924('0x2f')](_0x3ef8cd[_0x4924('0x38')],function(_0x17584b){var _0x158eeb={};_0x158eeb[_0x17584b]={'$like':'%'+_0xbd8edd[_0x4924('0x34')][_0x4924('0x40')]+'%'};return _0x158eeb;})});}_0x3ef8cd=_[_0x4924('0x41')]({},_0x3ef8cd,_0xbd8edd[_0x4924('0x43')]);return _0x30c73b[_0x4924('0x50')](_0x3ef8cd);}})[_0x4924('0x29')](function(_0xe7aadc){if(_0xe7aadc){_0x547925=_0xe7aadc[_0x4924('0x3a')];if(!_0xbd8edd['query']['hasOwnProperty']('nolimit')){_0x3ef8cd[_0x4924('0x21')]=qs[_0x4924('0x21')](_0xbd8edd[_0x4924('0x34')][_0x4924('0x21')]);_0x3ef8cd[_0x4924('0x1f')]=qs[_0x4924('0x1f')](_0xbd8edd[_0x4924('0x34')][_0x4924('0x1f')]);}return _0x30c73b[_0x4924('0x50')](_0x3ef8cd);}})['then'](function(_0x2eb77d){if(_0x2eb77d){return _0x2eb77d?{'count':_0x547925,'rows':_0x2eb77d}:null;}})[_0x4924('0x29')](respondWithResult(_0x2390f5,null))['catch'](handleError(_0x2390f5,null));};exports['getSubjects']=function(_0x1998e5,_0x8b1b29,_0x579c1d){var _0x208ca8={};var _0x41f89d={};var _0x2c9069;var _0x57c0ca;return db[_0x4924('0x30')][_0x4924('0x4e')]({'where':{'id':_0x1998e5[_0x4924('0x4a')]['id']}})[_0x4924('0x29')](handleEntityNotFound(_0x8b1b29,null))['then'](function(_0x3c3d6c){if(_0x3c3d6c){_0x2c9069=_0x3c3d6c;_0x41f89d['model']=_[_0x4924('0x35')](db[_0x4924('0x51')][_0x4924('0x31')]);_0x41f89d[_0x4924('0x34')]=_['keys'](_0x1998e5[_0x4924('0x34')]);_0x41f89d['filters']=_[_0x4924('0x37')](_0x41f89d[_0x4924('0x33')],_0x41f89d[_0x4924('0x34')]);_0x208ca8[_0x4924('0x38')]=_['intersection'](_0x41f89d['model'],qs[_0x4924('0x39')](_0x1998e5['query'][_0x4924('0x39')]));_0x208ca8[_0x4924('0x38')]=_0x208ca8[_0x4924('0x38')][_0x4924('0x3a')]?_0x208ca8[_0x4924('0x38')]:_0x41f89d['model'];_0x208ca8[_0x4924('0x3d')]=qs[_0x4924('0x3e')](_0x1998e5['query'][_0x4924('0x3e')]);_0x208ca8[_0x4924('0x4f')]=qs[_0x4924('0x36')](_['pick'](_0x1998e5[_0x4924('0x34')],_0x41f89d[_0x4924('0x36')]));if(_0x1998e5['query'][_0x4924('0x40')]){_0x208ca8[_0x4924('0x4f')]=_[_0x4924('0x41')](_0x208ca8[_0x4924('0x4f')],{'$or':_['map'](_0x208ca8[_0x4924('0x38')],function(_0x1d0a01){var _0x21d570={};_0x21d570[_0x1d0a01]={'$like':'%'+_0x1998e5[_0x4924('0x34')][_0x4924('0x40')]+'%'};return _0x21d570;})});}_0x208ca8=_[_0x4924('0x41')]({},_0x208ca8,_0x1998e5[_0x4924('0x43')]);return _0x2c9069[_0x4924('0x52')](_0x208ca8);}})[_0x4924('0x29')](function(_0x3ef7d5){if(_0x3ef7d5){_0x57c0ca=_0x3ef7d5['length'];if(!_0x1998e5[_0x4924('0x34')][_0x4924('0x3b')](_0x4924('0x3c'))){_0x208ca8[_0x4924('0x21')]=qs[_0x4924('0x21')](_0x1998e5[_0x4924('0x34')][_0x4924('0x21')]);_0x208ca8['offset']=qs['offset'](_0x1998e5['query'][_0x4924('0x1f')]);}return _0x2c9069[_0x4924('0x52')](_0x208ca8);}})[_0x4924('0x29')](function(_0x56f98b){if(_0x56f98b){return _0x56f98b?{'count':_0x57c0ca,'rows':_0x56f98b}:null;}})['then'](respondWithResult(_0x8b1b29,null))[_0x4924('0x48')](handleError(_0x8b1b29,null));};exports[_0x4924('0x53')]=function(_0x386611,_0x2f02e9,_0x1a7f90){var _0x3f9573={};var _0xa37606={};var _0x593029;var _0x4650c9;return db[_0x4924('0x30')][_0x4924('0x4e')]({'where':{'id':_0x386611[_0x4924('0x4a')]['id']}})[_0x4924('0x29')](handleEntityNotFound(_0x2f02e9,null))[_0x4924('0x29')](function(_0x2ef96e){if(_0x2ef96e){_0x593029=_0x2ef96e;_0xa37606[_0x4924('0x33')]=_[_0x4924('0x35')](db[_0x4924('0x51')][_0x4924('0x31')]);_0xa37606[_0x4924('0x34')]=_[_0x4924('0x35')](_0x386611[_0x4924('0x34')]);_0xa37606[_0x4924('0x36')]=_[_0x4924('0x37')](_0xa37606[_0x4924('0x33')],_0xa37606[_0x4924('0x34')]);_0x3f9573['attributes']=_['intersection'](_0xa37606['model'],qs[_0x4924('0x39')](_0x386611['query']['fields']));_0x3f9573[_0x4924('0x38')]=_0x3f9573[_0x4924('0x38')]['length']?_0x3f9573[_0x4924('0x38')]:_0xa37606[_0x4924('0x33')];_0x3f9573[_0x4924('0x3d')]=qs[_0x4924('0x3e')](_0x386611[_0x4924('0x34')]['sort']);_0x3f9573[_0x4924('0x4f')]=qs[_0x4924('0x36')](_['pick'](_0x386611[_0x4924('0x34')],_0xa37606['filters']));if(_0x386611['query'][_0x4924('0x40')]){_0x3f9573['where']=_[_0x4924('0x41')](_0x3f9573[_0x4924('0x4f')],{'$or':_[_0x4924('0x2f')](_0x3f9573[_0x4924('0x38')],function(_0x5c0904){var _0x21dcca={};_0x21dcca[_0x5c0904]={'$like':'%'+_0x386611['query'][_0x4924('0x40')]+'%'};return _0x21dcca;})});}_0x3f9573=_[_0x4924('0x41')]({},_0x3f9573,_0x386611['options']);return _0x593029[_0x4924('0x53')](_0x3f9573);}})[_0x4924('0x29')](function(_0x244795){if(_0x244795){_0x4650c9=_0x244795[_0x4924('0x3a')];if(!_0x386611[_0x4924('0x34')][_0x4924('0x3b')](_0x4924('0x3c'))){_0x3f9573[_0x4924('0x21')]=qs[_0x4924('0x21')](_0x386611[_0x4924('0x34')]['limit']);_0x3f9573[_0x4924('0x1f')]=qs[_0x4924('0x1f')](_0x386611[_0x4924('0x34')][_0x4924('0x1f')]);}return _0x593029['getDescriptions'](_0x3f9573);}})[_0x4924('0x29')](function(_0x202fb5){if(_0x202fb5){return _0x202fb5?{'count':_0x4650c9,'rows':_0x202fb5}:null;}})[_0x4924('0x29')](respondWithResult(_0x2f02e9,null))[_0x4924('0x48')](handleError(_0x2f02e9,null));};exports['getTags']=function(_0x5550b8,_0x287c66,_0x139c3b){var _0x490cea={};var _0x2cfb54={};var _0x154e45;var _0x219f4b;return db[_0x4924('0x30')][_0x4924('0x4e')]({'where':{'id':_0x5550b8['params']['id']}})['then'](handleEntityNotFound(_0x287c66,null))[_0x4924('0x29')](function(_0x1dbfbd){if(_0x1dbfbd){_0x154e45=_0x1dbfbd;_0x2cfb54[_0x4924('0x33')]=_['keys'](db[_0x4924('0x54')]['rawAttributes']);_0x2cfb54[_0x4924('0x34')]=_[_0x4924('0x35')](_0x5550b8[_0x4924('0x34')]);_0x2cfb54['filters']=_[_0x4924('0x37')](_0x2cfb54['model'],_0x2cfb54['query']);_0x490cea[_0x4924('0x38')]=_['intersection'](_0x2cfb54[_0x4924('0x33')],qs[_0x4924('0x39')](_0x5550b8['query']['fields']));_0x490cea[_0x4924('0x38')]=_0x490cea[_0x4924('0x38')][_0x4924('0x3a')]?_0x490cea[_0x4924('0x38')]:_0x2cfb54[_0x4924('0x33')];_0x490cea[_0x4924('0x3d')]=qs['sort'](_0x5550b8['query'][_0x4924('0x3e')]);_0x490cea[_0x4924('0x4f')]=qs[_0x4924('0x36')](_['pick'](_0x5550b8[_0x4924('0x34')],_0x2cfb54[_0x4924('0x36')]));if(_0x5550b8[_0x4924('0x34')]['filter']){_0x490cea[_0x4924('0x4f')]=_['merge'](_0x490cea[_0x4924('0x4f')],{'$or':_[_0x4924('0x2f')](_0x490cea[_0x4924('0x38')],function(_0x4c870b){var _0x2518fc={};_0x2518fc[_0x4c870b]={'$like':'%'+_0x5550b8['query']['filter']+'%'};return _0x2518fc;})});}_0x490cea=_[_0x4924('0x41')]({},_0x490cea,_0x5550b8['options']);return _0x154e45[_0x4924('0x55')](_0x490cea);}})[_0x4924('0x29')](function(_0x456656){if(_0x456656){_0x219f4b=_0x456656['length'];if(!_0x5550b8[_0x4924('0x34')][_0x4924('0x3b')](_0x4924('0x3c'))){_0x490cea['limit']=qs[_0x4924('0x21')](_0x5550b8[_0x4924('0x34')][_0x4924('0x21')]);_0x490cea[_0x4924('0x1f')]=qs['offset'](_0x5550b8['query'][_0x4924('0x1f')]);}return _0x154e45[_0x4924('0x55')](_0x490cea);}})[_0x4924('0x29')](function(_0x624d00){if(_0x624d00){return _0x624d00?{'count':_0x219f4b,'rows':_0x624d00}:null;}})[_0x4924('0x29')](respondWithResult(_0x287c66,null))[_0x4924('0x48')](handleError(_0x287c66,null));};exports[_0x4924('0x56')]=function(_0x24d4ed,_0x1cab93,_0x80111f){if(_0x24d4ed[_0x4924('0x4c')]['id']){delete _0x24d4ed[_0x4924('0x4c')]['id'];}return db['DeskConfiguration'][_0x4924('0x4e')]({'where':{'id':_0x24d4ed[_0x4924('0x4a')]['id']}})[_0x4924('0x29')](handleEntityNotFound(_0x1cab93,null))['then'](function(_0x152358){if(_0x152358){return _0x152358[_0x4924('0x56')](_0x24d4ed['body'][_0x4924('0x57')]||[]);}return null;})[_0x4924('0x29')](respondWithResult(_0x1cab93,null))[_0x4924('0x48')](handleError(_0x1cab93,null));}; \ No newline at end of file +var _0x8514=['length','hasOwnProperty','nolimit','where','filter','merge','options','include','findAll','rows','catch','params','keys','includeAll','body','find','getFields','findOne','DeskField','order','sort','pick','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','DeskConfiguration','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes'];(function(_0x8437f2,_0x493a1d){var _0x50cbd1=function(_0x5e29fe){while(--_0x5e29fe){_0x8437f2['push'](_0x8437f2['shift']());}};_0x50cbd1(++_0x493a1d);}(_0x8514,0x157));var _0x4851=function(_0xb02074,_0x3bb6a2){_0xb02074=_0xb02074-0x0;var _0x315141=_0x8514[_0xb02074];return _0x315141;};'use strict';var emlformat=require(_0x4851('0x0'));var rimraf=require(_0x4851('0x1'));var zipdir=require(_0x4851('0x2'));var jsonpatch=require(_0x4851('0x3'));var rp=require(_0x4851('0x4'));var moment=require(_0x4851('0x5'));var BPromise=require(_0x4851('0x6'));var Mustache=require(_0x4851('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4851('0x8'));var ejs=require(_0x4851('0x9'));var fs=require('fs');var fs_extra=require(_0x4851('0xa'));var _=require(_0x4851('0xb'));var squel=require('squel');var crypto=require(_0x4851('0xc'));var jsforce=require(_0x4851('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4851('0xe'));var Papa=require('papaparse');var Redis=require(_0x4851('0xf'));var authService=require(_0x4851('0x10'));var qs=require(_0x4851('0x11'));var as=require(_0x4851('0x12'));var hardwareService=require(_0x4851('0x13'));var logger=require('../../config/logger')(_0x4851('0x14'));var utils=require('../../config/utils');var config=require(_0x4851('0x15'));var licenseUtil=require(_0x4851('0x16'));var db=require(_0x4851('0x17'))['db'];function respondWithStatusCode(_0x4a9992,_0x240c31){_0x240c31=_0x240c31||0xcc;return function(_0x198c99){if(_0x198c99){return _0x4a9992['sendStatus'](_0x240c31);}return _0x4a9992[_0x4851('0x18')](_0x240c31)[_0x4851('0x19')]();};}function respondWithResult(_0x2c1c28,_0x4a4028){_0x4a4028=_0x4a4028||0xc8;return function(_0x52c0ec){if(_0x52c0ec){return _0x2c1c28[_0x4851('0x18')](_0x4a4028)[_0x4851('0x1a')](_0x52c0ec);}};}function respondWithFilteredResult(_0x1f6848,_0x1e95fe){return function(_0x532f57){if(_0x532f57){var _0x56f857=typeof _0x1e95fe['offset']===_0x4851('0x1b')&&typeof _0x1e95fe[_0x4851('0x1c')]===_0x4851('0x1b');var _0x370b1b=_0x532f57[_0x4851('0x1d')];var _0x30fcc7=_0x56f857?0x0:_0x1e95fe[_0x4851('0x1e')];var _0x314fcf=_0x56f857?_0x532f57['count']:_0x1e95fe['offset']+_0x1e95fe[_0x4851('0x1c')];var _0xbb98b;if(_0x314fcf>=_0x370b1b){_0x314fcf=_0x370b1b;_0xbb98b=0xc8;}else{_0xbb98b=0xce;}_0x1f6848[_0x4851('0x18')](_0xbb98b);return _0x1f6848['set'](_0x4851('0x1f'),_0x30fcc7+'-'+_0x314fcf+'/'+_0x370b1b)[_0x4851('0x1a')](_0x532f57);}return null;};}function patchUpdates(_0x549d24){return function(_0x5ba25b){try{jsonpatch[_0x4851('0x20')](_0x5ba25b,_0x549d24,!![]);}catch(_0x33e1cf){return BPromise[_0x4851('0x21')](_0x33e1cf);}return _0x5ba25b['save']();};}function saveUpdates(_0x3919d3,_0x19894a){return function(_0x3d7b00){if(_0x3d7b00){return _0x3d7b00[_0x4851('0x22')](_0x3919d3)[_0x4851('0x23')](function(_0x6abc89){return _0x6abc89;});}return null;};}function removeEntity(_0xccf686,_0x234f39){return function(_0x50091d){if(_0x50091d){return _0x50091d[_0x4851('0x24')]()[_0x4851('0x23')](function(){_0xccf686[_0x4851('0x18')](0xcc)[_0x4851('0x19')]();});}};}function handleEntityNotFound(_0x174746,_0x540fae){return function(_0x1ad2ea){if(!_0x1ad2ea){_0x174746['sendStatus'](0x194);}return _0x1ad2ea;};}function handleError(_0x404b80,_0x78e6fc){_0x78e6fc=_0x78e6fc||0x1f4;return function(_0x3e992d){logger['error'](_0x3e992d[_0x4851('0x25')]);if(_0x3e992d[_0x4851('0x26')]){delete _0x3e992d['name'];}_0x404b80['status'](_0x78e6fc)[_0x4851('0x27')](_0x3e992d);};}exports[_0x4851('0x28')]=function(_0x405022,_0x2c251a){var _0x24246c={},_0x2f3291={},_0x5ba6db={'count':0x0,'rows':[]};var _0x458418=_['map'](db[_0x4851('0x29')][_0x4851('0x2a')],function(_0x3bbbb2){return{'name':_0x3bbbb2['fieldName'],'type':_0x3bbbb2[_0x4851('0x2b')][_0x4851('0x2c')]};});_0x2f3291[_0x4851('0x2d')]=_[_0x4851('0x2e')](_0x458418,_0x4851('0x26'));_0x2f3291[_0x4851('0x2f')]=_['keys'](_0x405022[_0x4851('0x2f')]);_0x2f3291[_0x4851('0x30')]=_[_0x4851('0x31')](_0x2f3291[_0x4851('0x2d')],_0x2f3291[_0x4851('0x2f')]);_0x24246c['attributes']=_[_0x4851('0x31')](_0x2f3291[_0x4851('0x2d')],qs['fields'](_0x405022[_0x4851('0x2f')][_0x4851('0x32')]));_0x24246c[_0x4851('0x33')]=_0x24246c[_0x4851('0x33')][_0x4851('0x34')]?_0x24246c['attributes']:_0x2f3291[_0x4851('0x2d')];if(!_0x405022['query'][_0x4851('0x35')](_0x4851('0x36'))){_0x24246c['limit']=qs[_0x4851('0x1c')](_0x405022['query'][_0x4851('0x1c')]);_0x24246c[_0x4851('0x1e')]=qs[_0x4851('0x1e')](_0x405022[_0x4851('0x2f')][_0x4851('0x1e')]);}_0x24246c['order']=qs['sort'](_0x405022['query']['sort']);_0x24246c[_0x4851('0x37')]=qs[_0x4851('0x30')](_['pick'](_0x405022[_0x4851('0x2f')],_0x2f3291[_0x4851('0x30')]),_0x458418);if(_0x405022[_0x4851('0x2f')][_0x4851('0x38')]){_0x24246c[_0x4851('0x37')]=_[_0x4851('0x39')](_0x24246c[_0x4851('0x37')],{'$or':_[_0x4851('0x2e')](_0x458418,function(_0x22d9ee){if(_0x22d9ee[_0x4851('0x2b')]!=='VIRTUAL'){var _0xb26b4c={};_0xb26b4c[_0x22d9ee[_0x4851('0x26')]]={'$like':'%'+_0x405022['query'][_0x4851('0x38')]+'%'};return _0xb26b4c;}})});}_0x24246c=_[_0x4851('0x39')]({},_0x24246c,_0x405022[_0x4851('0x3a')]);var _0x47983f={'where':_0x24246c[_0x4851('0x37')]};return db[_0x4851('0x29')]['count'](_0x47983f)['then'](function(_0x58d548){_0x5ba6db[_0x4851('0x1d')]=_0x58d548;if(_0x405022[_0x4851('0x2f')]['includeAll']){_0x24246c[_0x4851('0x3b')]=[{'all':!![]}];}return db[_0x4851('0x29')][_0x4851('0x3c')](_0x24246c);})[_0x4851('0x23')](function(_0x48d474){_0x5ba6db[_0x4851('0x3d')]=_0x48d474;return _0x5ba6db;})[_0x4851('0x23')](respondWithFilteredResult(_0x2c251a,_0x24246c))[_0x4851('0x3e')](handleError(_0x2c251a,null));};exports['show']=function(_0x2e0751,_0x2015f4){var _0x5fef00={'raw':![],'where':{'id':_0x2e0751[_0x4851('0x3f')]['id']}},_0x336dc7={};_0x336dc7[_0x4851('0x2d')]=_[_0x4851('0x40')](db[_0x4851('0x29')][_0x4851('0x2a')]);_0x336dc7[_0x4851('0x2f')]=_['keys'](_0x2e0751[_0x4851('0x2f')]);_0x336dc7[_0x4851('0x30')]=_['intersection'](_0x336dc7[_0x4851('0x2d')],_0x336dc7[_0x4851('0x2f')]);_0x5fef00[_0x4851('0x33')]=_[_0x4851('0x31')](_0x336dc7[_0x4851('0x2d')],qs['fields'](_0x2e0751[_0x4851('0x2f')][_0x4851('0x32')]));_0x5fef00[_0x4851('0x33')]=_0x5fef00['attributes'][_0x4851('0x34')]?_0x5fef00['attributes']:_0x336dc7['model'];if(_0x2e0751[_0x4851('0x2f')][_0x4851('0x41')]){_0x5fef00[_0x4851('0x3b')]=[{'all':!![]}];}_0x5fef00=_[_0x4851('0x39')]({},_0x5fef00,_0x2e0751[_0x4851('0x3a')]);return db[_0x4851('0x29')]['find'](_0x5fef00)[_0x4851('0x23')](handleEntityNotFound(_0x2015f4,null))[_0x4851('0x23')](respondWithResult(_0x2015f4,null))['catch'](handleError(_0x2015f4,null));};exports['create']=function(_0x84d721,_0x23cf33){return db[_0x4851('0x29')]['create'](_0x84d721[_0x4851('0x42')],{})['then'](respondWithResult(_0x23cf33,0xc9))[_0x4851('0x3e')](handleError(_0x23cf33,null));};exports[_0x4851('0x22')]=function(_0x1aa327,_0x23286b){if(_0x1aa327['body']['id']){delete _0x1aa327[_0x4851('0x42')]['id'];}return db[_0x4851('0x29')]['find']({'where':{'id':_0x1aa327[_0x4851('0x3f')]['id']}})[_0x4851('0x23')](handleEntityNotFound(_0x23286b,null))[_0x4851('0x23')](saveUpdates(_0x1aa327['body'],null))['then'](respondWithResult(_0x23286b,null))[_0x4851('0x3e')](handleError(_0x23286b,null));};exports['destroy']=function(_0x53d736,_0x6cffa9){return db[_0x4851('0x29')][_0x4851('0x43')]({'where':{'id':_0x53d736['params']['id']}})['then'](handleEntityNotFound(_0x6cffa9,null))[_0x4851('0x23')](removeEntity(_0x6cffa9,null))[_0x4851('0x3e')](handleError(_0x6cffa9,null));};exports[_0x4851('0x44')]=function(_0x23c6d6,_0x53c256,_0x2c2a11){var _0x5850f5={};var _0x403ced={};var _0x52a409;var _0x58c104;return db[_0x4851('0x29')][_0x4851('0x45')]({'where':{'id':_0x23c6d6[_0x4851('0x3f')]['id']}})[_0x4851('0x23')](handleEntityNotFound(_0x53c256,null))[_0x4851('0x23')](function(_0x127b7f){if(_0x127b7f){_0x52a409=_0x127b7f;_0x403ced[_0x4851('0x2d')]=_['keys'](db[_0x4851('0x46')][_0x4851('0x2a')]);_0x403ced[_0x4851('0x2f')]=_[_0x4851('0x40')](_0x23c6d6[_0x4851('0x2f')]);_0x403ced[_0x4851('0x30')]=_[_0x4851('0x31')](_0x403ced[_0x4851('0x2d')],_0x403ced[_0x4851('0x2f')]);_0x5850f5[_0x4851('0x33')]=_[_0x4851('0x31')](_0x403ced[_0x4851('0x2d')],qs['fields'](_0x23c6d6[_0x4851('0x2f')][_0x4851('0x32')]));_0x5850f5['attributes']=_0x5850f5[_0x4851('0x33')][_0x4851('0x34')]?_0x5850f5[_0x4851('0x33')]:_0x403ced[_0x4851('0x2d')];_0x5850f5[_0x4851('0x47')]=qs[_0x4851('0x48')](_0x23c6d6['query'][_0x4851('0x48')]);_0x5850f5[_0x4851('0x37')]=qs[_0x4851('0x30')](_[_0x4851('0x49')](_0x23c6d6[_0x4851('0x2f')],_0x403ced[_0x4851('0x30')]));if(_0x23c6d6['query'][_0x4851('0x38')]){_0x5850f5[_0x4851('0x37')]=_[_0x4851('0x39')](_0x5850f5['where'],{'$or':_['map'](_0x5850f5['attributes'],function(_0x555420){var _0x5c9f8f={};_0x5c9f8f[_0x555420]={'$like':'%'+_0x23c6d6[_0x4851('0x2f')][_0x4851('0x38')]+'%'};return _0x5c9f8f;})});}_0x5850f5=_[_0x4851('0x39')]({},_0x5850f5,_0x23c6d6[_0x4851('0x3a')]);return _0x52a409[_0x4851('0x44')](_0x5850f5);}})['then'](function(_0x389150){if(_0x389150){_0x58c104=_0x389150[_0x4851('0x34')];if(!_0x23c6d6[_0x4851('0x2f')][_0x4851('0x35')](_0x4851('0x36'))){_0x5850f5[_0x4851('0x1c')]=qs[_0x4851('0x1c')](_0x23c6d6[_0x4851('0x2f')]['limit']);_0x5850f5[_0x4851('0x1e')]=qs[_0x4851('0x1e')](_0x23c6d6[_0x4851('0x2f')][_0x4851('0x1e')]);}return _0x52a409[_0x4851('0x44')](_0x5850f5);}})['then'](function(_0x2ebe54){if(_0x2ebe54){return _0x2ebe54?{'count':_0x58c104,'rows':_0x2ebe54}:null;}})[_0x4851('0x23')](respondWithResult(_0x53c256,null))[_0x4851('0x3e')](handleError(_0x53c256,null));};exports['getSubjects']=function(_0x466120,_0x26aaef,_0x7df590){var _0x552ec5={};var _0x40aa66={};var _0x14ab49;var _0x531335;return db[_0x4851('0x29')][_0x4851('0x45')]({'where':{'id':_0x466120[_0x4851('0x3f')]['id']}})[_0x4851('0x23')](handleEntityNotFound(_0x26aaef,null))['then'](function(_0x407cdd){if(_0x407cdd){_0x14ab49=_0x407cdd;_0x40aa66[_0x4851('0x2d')]=_['keys'](db[_0x4851('0x46')][_0x4851('0x2a')]);_0x40aa66[_0x4851('0x2f')]=_[_0x4851('0x40')](_0x466120[_0x4851('0x2f')]);_0x40aa66[_0x4851('0x30')]=_['intersection'](_0x40aa66['model'],_0x40aa66[_0x4851('0x2f')]);_0x552ec5[_0x4851('0x33')]=_['intersection'](_0x40aa66[_0x4851('0x2d')],qs[_0x4851('0x32')](_0x466120[_0x4851('0x2f')][_0x4851('0x32')]));_0x552ec5[_0x4851('0x33')]=_0x552ec5[_0x4851('0x33')][_0x4851('0x34')]?_0x552ec5[_0x4851('0x33')]:_0x40aa66[_0x4851('0x2d')];_0x552ec5['order']=qs[_0x4851('0x48')](_0x466120[_0x4851('0x2f')][_0x4851('0x48')]);_0x552ec5[_0x4851('0x37')]=qs[_0x4851('0x30')](_[_0x4851('0x49')](_0x466120['query'],_0x40aa66[_0x4851('0x30')]));if(_0x466120['query'][_0x4851('0x38')]){_0x552ec5[_0x4851('0x37')]=_['merge'](_0x552ec5['where'],{'$or':_[_0x4851('0x2e')](_0x552ec5[_0x4851('0x33')],function(_0x11fde1){var _0x347f52={};_0x347f52[_0x11fde1]={'$like':'%'+_0x466120['query'][_0x4851('0x38')]+'%'};return _0x347f52;})});}_0x552ec5=_['merge']({},_0x552ec5,_0x466120[_0x4851('0x3a')]);return _0x14ab49[_0x4851('0x4a')](_0x552ec5);}})[_0x4851('0x23')](function(_0x85dd47){if(_0x85dd47){_0x531335=_0x85dd47[_0x4851('0x34')];if(!_0x466120[_0x4851('0x2f')][_0x4851('0x35')]('nolimit')){_0x552ec5[_0x4851('0x1c')]=qs[_0x4851('0x1c')](_0x466120[_0x4851('0x2f')][_0x4851('0x1c')]);_0x552ec5[_0x4851('0x1e')]=qs[_0x4851('0x1e')](_0x466120['query'][_0x4851('0x1e')]);}return _0x14ab49[_0x4851('0x4a')](_0x552ec5);}})['then'](function(_0x1ca3b9){if(_0x1ca3b9){return _0x1ca3b9?{'count':_0x531335,'rows':_0x1ca3b9}:null;}})['then'](respondWithResult(_0x26aaef,null))[_0x4851('0x3e')](handleError(_0x26aaef,null));};exports[_0x4851('0x4b')]=function(_0x4c6109,_0x353b11,_0x57315d){var _0x52eab0={};var _0x28bfee={};var _0x59f4df;var _0x359623;return db[_0x4851('0x29')][_0x4851('0x45')]({'where':{'id':_0x4c6109[_0x4851('0x3f')]['id']}})[_0x4851('0x23')](handleEntityNotFound(_0x353b11,null))[_0x4851('0x23')](function(_0x12664c){if(_0x12664c){_0x59f4df=_0x12664c;_0x28bfee[_0x4851('0x2d')]=_[_0x4851('0x40')](db[_0x4851('0x46')][_0x4851('0x2a')]);_0x28bfee[_0x4851('0x2f')]=_[_0x4851('0x40')](_0x4c6109[_0x4851('0x2f')]);_0x28bfee[_0x4851('0x30')]=_[_0x4851('0x31')](_0x28bfee[_0x4851('0x2d')],_0x28bfee[_0x4851('0x2f')]);_0x52eab0[_0x4851('0x33')]=_[_0x4851('0x31')](_0x28bfee['model'],qs['fields'](_0x4c6109[_0x4851('0x2f')][_0x4851('0x32')]));_0x52eab0[_0x4851('0x33')]=_0x52eab0['attributes'][_0x4851('0x34')]?_0x52eab0[_0x4851('0x33')]:_0x28bfee[_0x4851('0x2d')];_0x52eab0[_0x4851('0x47')]=qs[_0x4851('0x48')](_0x4c6109[_0x4851('0x2f')][_0x4851('0x48')]);_0x52eab0[_0x4851('0x37')]=qs['filters'](_[_0x4851('0x49')](_0x4c6109[_0x4851('0x2f')],_0x28bfee[_0x4851('0x30')]));if(_0x4c6109[_0x4851('0x2f')]['filter']){_0x52eab0[_0x4851('0x37')]=_[_0x4851('0x39')](_0x52eab0[_0x4851('0x37')],{'$or':_[_0x4851('0x2e')](_0x52eab0[_0x4851('0x33')],function(_0x229d8d){var _0x1e7632={};_0x1e7632[_0x229d8d]={'$like':'%'+_0x4c6109[_0x4851('0x2f')]['filter']+'%'};return _0x1e7632;})});}_0x52eab0=_[_0x4851('0x39')]({},_0x52eab0,_0x4c6109[_0x4851('0x3a')]);return _0x59f4df[_0x4851('0x4b')](_0x52eab0);}})[_0x4851('0x23')](function(_0x521a2e){if(_0x521a2e){_0x359623=_0x521a2e[_0x4851('0x34')];if(!_0x4c6109['query'][_0x4851('0x35')](_0x4851('0x36'))){_0x52eab0['limit']=qs['limit'](_0x4c6109[_0x4851('0x2f')][_0x4851('0x1c')]);_0x52eab0[_0x4851('0x1e')]=qs[_0x4851('0x1e')](_0x4c6109[_0x4851('0x2f')][_0x4851('0x1e')]);}return _0x59f4df['getDescriptions'](_0x52eab0);}})[_0x4851('0x23')](function(_0x5dcb8a){if(_0x5dcb8a){return _0x5dcb8a?{'count':_0x359623,'rows':_0x5dcb8a}:null;}})[_0x4851('0x23')](respondWithResult(_0x353b11,null))[_0x4851('0x3e')](handleError(_0x353b11,null));};exports[_0x4851('0x4c')]=function(_0x82d2fc,_0x57e572,_0x4e6820){var _0x3577db={};var _0x15e949={};var _0x1913e7;var _0x48033c;return db[_0x4851('0x29')][_0x4851('0x45')]({'where':{'id':_0x82d2fc['params']['id']}})['then'](handleEntityNotFound(_0x57e572,null))[_0x4851('0x23')](function(_0x56f20d){if(_0x56f20d){_0x1913e7=_0x56f20d;_0x15e949[_0x4851('0x2d')]=_[_0x4851('0x40')](db['Tag'][_0x4851('0x2a')]);_0x15e949[_0x4851('0x2f')]=_[_0x4851('0x40')](_0x82d2fc[_0x4851('0x2f')]);_0x15e949[_0x4851('0x30')]=_[_0x4851('0x31')](_0x15e949[_0x4851('0x2d')],_0x15e949['query']);_0x3577db['attributes']=_[_0x4851('0x31')](_0x15e949[_0x4851('0x2d')],qs[_0x4851('0x32')](_0x82d2fc['query']['fields']));_0x3577db['attributes']=_0x3577db[_0x4851('0x33')]['length']?_0x3577db['attributes']:_0x15e949[_0x4851('0x2d')];_0x3577db[_0x4851('0x47')]=qs[_0x4851('0x48')](_0x82d2fc[_0x4851('0x2f')][_0x4851('0x48')]);_0x3577db[_0x4851('0x37')]=qs['filters'](_[_0x4851('0x49')](_0x82d2fc[_0x4851('0x2f')],_0x15e949['filters']));if(_0x82d2fc['query'][_0x4851('0x38')]){_0x3577db['where']=_[_0x4851('0x39')](_0x3577db[_0x4851('0x37')],{'$or':_[_0x4851('0x2e')](_0x3577db['attributes'],function(_0x513b36){var _0x23100c={};_0x23100c[_0x513b36]={'$like':'%'+_0x82d2fc[_0x4851('0x2f')]['filter']+'%'};return _0x23100c;})});}_0x3577db=_[_0x4851('0x39')]({},_0x3577db,_0x82d2fc[_0x4851('0x3a')]);return _0x1913e7['getTags'](_0x3577db);}})[_0x4851('0x23')](function(_0x67e0f6){if(_0x67e0f6){_0x48033c=_0x67e0f6['length'];if(!_0x82d2fc[_0x4851('0x2f')]['hasOwnProperty'](_0x4851('0x36'))){_0x3577db['limit']=qs['limit'](_0x82d2fc['query'][_0x4851('0x1c')]);_0x3577db['offset']=qs[_0x4851('0x1e')](_0x82d2fc['query'][_0x4851('0x1e')]);}return _0x1913e7[_0x4851('0x4c')](_0x3577db);}})[_0x4851('0x23')](function(_0x4c642a){if(_0x4c642a){return _0x4c642a?{'count':_0x48033c,'rows':_0x4c642a}:null;}})[_0x4851('0x23')](respondWithResult(_0x57e572,null))['catch'](handleError(_0x57e572,null));};exports[_0x4851('0x4d')]=function(_0x6a7c77,_0x1269a2,_0x3cbb45){if(_0x6a7c77[_0x4851('0x42')]['id']){delete _0x6a7c77[_0x4851('0x42')]['id'];}return db[_0x4851('0x29')][_0x4851('0x45')]({'where':{'id':_0x6a7c77[_0x4851('0x3f')]['id']}})[_0x4851('0x23')](handleEntityNotFound(_0x1269a2,null))[_0x4851('0x23')](function(_0x5b9dea){if(_0x5b9dea){return _0x5b9dea['setTags'](_0x6a7c77[_0x4851('0x42')][_0x4851('0x4e')]||[]);}return null;})[_0x4851('0x23')](respondWithResult(_0x1269a2,null))['catch'](handleError(_0x1269a2,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 0219056..7711ec5 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 _0x3bc2=['DeskConfiguration','int_desk_configurations','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define'];(function(_0x3e3ad3,_0x52585b){var _0x39e21f=function(_0x1f1822){while(--_0x1f1822){_0x3e3ad3['push'](_0x3e3ad3['shift']());}};_0x39e21f(++_0x52585b);}(_0x3bc2,0x91));var _0x23bc=function(_0x42f9b9,_0x12b35d){_0x42f9b9=_0x42f9b9-0x0;var _0x54e4f8=_0x3bc2[_0x42f9b9];return _0x54e4f8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x23bc('0x0'));var moment=require(_0x23bc('0x1'));var BPromise=require(_0x23bc('0x2'));var rp=require(_0x23bc('0x3'));var fs=require('fs');var path=require(_0x23bc('0x4'));var rimraf=require('rimraf');var config=require(_0x23bc('0x5'));var attributes=require(_0x23bc('0x6'));module[_0x23bc('0x7')]=function(_0x45890f,_0x25370b){return _0x45890f[_0x23bc('0x8')](_0x23bc('0x9'),attributes,{'tableName':_0x23bc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2c8=['int_desk_configurations','lodash','api','request-promise','path','./intDeskConfiguration.attributes','exports','define','DeskConfiguration'];(function(_0x597c16,_0x2292fe){var _0x30cc2c=function(_0x26cb58){while(--_0x26cb58){_0x597c16['push'](_0x597c16['shift']());}};_0x30cc2c(++_0x2292fe);}(_0xd2c8,0x196));var _0x8d2c=function(_0x182816,_0x2355b8){_0x182816=_0x182816-0x0;var _0x13e96f=_0xd2c8[_0x182816];return _0x13e96f;};'use strict';var _=require(_0x8d2c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8d2c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8d2c('0x2'));var fs=require('fs');var path=require(_0x8d2c('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8d2c('0x4'));module[_0x8d2c('0x5')]=function(_0x2c7078,_0x5270e2){return _0x2c7078[_0x8d2c('0x6')](_0x8d2c('0x7'),attributes,{'tableName':_0x8d2c('0x8'),'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 6e758cb..29b4738 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 _0x2ffe=['http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x3c5272,_0x1ea873){var _0x31a12a=function(_0x541b39){while(--_0x541b39){_0x3c5272['push'](_0x3c5272['shift']());}};_0x31a12a(++_0x1ea873);}(_0x2ffe,0x6a));var _0xe2ff=function(_0x187699,_0x567f8c){_0x187699=_0x187699-0x0;var _0x204eec=_0x2ffe[_0x187699];return _0x204eec;};'use strict';var _=require('lodash');var util=require(_0xe2ff('0x0'));var moment=require(_0xe2ff('0x1'));var BPromise=require(_0xe2ff('0x2'));var rs=require(_0xe2ff('0x3'));var fs=require('fs');var Redis=require(_0xe2ff('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe2ff('0x5'));var logger=require(_0xe2ff('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe2ff('0x7'));var client=jayson[_0xe2ff('0x8')][_0xe2ff('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5dee4a,_0xf24335,_0x212ecc){return new BPromise(function(_0x2a068f,_0x465da8){return client[_0xe2ff('0xa')](_0x5dee4a,_0x212ecc)[_0xe2ff('0xb')](function(_0x220ae3){logger[_0xe2ff('0xc')](_0xe2ff('0xd'),_0xf24335,_0xe2ff('0xe'));logger[_0xe2ff('0xf')](_0xe2ff('0x10'),_0xf24335,_0xe2ff('0xe'),JSON[_0xe2ff('0x11')](_0x220ae3));if(_0x220ae3[_0xe2ff('0x12')]){if(_0x220ae3[_0xe2ff('0x12')][_0xe2ff('0x13')]===0x1f4){logger['error'](_0xe2ff('0xd'),_0xf24335,_0x220ae3[_0xe2ff('0x12')]['message']);return _0x465da8(_0x220ae3[_0xe2ff('0x12')][_0xe2ff('0x14')]);}logger[_0xe2ff('0x12')](_0xe2ff('0xd'),_0xf24335,_0x220ae3[_0xe2ff('0x12')][_0xe2ff('0x14')]);return _0x2a068f(_0x220ae3[_0xe2ff('0x12')][_0xe2ff('0x14')]);}else{logger[_0xe2ff('0xc')](_0xe2ff('0xd'),_0xf24335,_0xe2ff('0xe'));_0x2a068f(_0x220ae3[_0xe2ff('0x15')][_0xe2ff('0x14')]);}})[_0xe2ff('0x16')](function(_0x3fb0f4){logger[_0xe2ff('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0xf24335,_0x3fb0f4);_0x465da8(_0x3fb0f4);});});} \ No newline at end of file +var _0xef0a=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x143251,_0x205325){var _0x49102c=function(_0x12d92b){while(--_0x12d92b){_0x143251['push'](_0x143251['shift']());}};_0x49102c(++_0x205325);}(_0xef0a,0xdd));var _0xaef0=function(_0x5d82ad,_0x2a734a){_0x5d82ad=_0x5d82ad-0x0;var _0x4ab31f=_0xef0a[_0x5d82ad];return _0x4ab31f;};'use strict';var _=require(_0xaef0('0x0'));var util=require(_0xaef0('0x1'));var moment=require(_0xaef0('0x2'));var BPromise=require(_0xaef0('0x3'));var rs=require(_0xaef0('0x4'));var fs=require('fs');var Redis=require(_0xaef0('0x5'));var db=require(_0xaef0('0x6'))['db'];var utils=require(_0xaef0('0x7'));var logger=require(_0xaef0('0x8'))(_0xaef0('0x9'));var config=require(_0xaef0('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xaef0('0xb')][_0xaef0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x273fae,_0x32f86c,_0x5c78d8){return new BPromise(function(_0x47ba50,_0x12ff96){return client[_0xaef0('0xd')](_0x273fae,_0x5c78d8)[_0xaef0('0xe')](function(_0x280d93){logger[_0xaef0('0xf')](_0xaef0('0x10'),_0x32f86c,_0xaef0('0x11'));logger[_0xaef0('0x12')](_0xaef0('0x13'),_0x32f86c,'request\x20sent',JSON[_0xaef0('0x14')](_0x280d93));if(_0x280d93[_0xaef0('0x15')]){if(_0x280d93['error'][_0xaef0('0x16')]===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x32f86c,_0x280d93[_0xaef0('0x15')][_0xaef0('0x17')]);return _0x12ff96(_0x280d93[_0xaef0('0x15')][_0xaef0('0x17')]);}logger[_0xaef0('0x15')](_0xaef0('0x10'),_0x32f86c,_0x280d93[_0xaef0('0x15')][_0xaef0('0x17')]);return _0x47ba50(_0x280d93[_0xaef0('0x15')][_0xaef0('0x17')]);}else{logger[_0xaef0('0xf')](_0xaef0('0x10'),_0x32f86c,_0xaef0('0x11'));_0x47ba50(_0x280d93['result'][_0xaef0('0x17')]);}})[_0xaef0('0x18')](function(_0x5c218b){logger[_0xaef0('0x15')](_0xaef0('0x10'),_0x32f86c,_0x5c218b);_0x12ff96(_0x5c218b);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 1a181e5..568c774 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 _0x9d5b=['isAuthenticated','index','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDeskField.controller','get'];(function(_0x189125,_0x123704){var _0xe9c2b=function(_0x329460){while(--_0x329460){_0x189125['push'](_0x189125['shift']());}};_0xe9c2b(++_0x123704);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x636fdb,_0x4782b0){_0x636fdb=_0x636fdb-0x0;var _0x6b633a=_0x9d5b[_0x636fdb];return _0x6b633a;};'use strict';var multer=require('multer');var util=require(_0xb9d5('0x0'));var path=require(_0xb9d5('0x1'));var timeout=require(_0xb9d5('0x2'));var express=require(_0xb9d5('0x3'));var router=express[_0xb9d5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb9d5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb9d5('0x6'));var controller=require(_0xb9d5('0x7'));router[_0xb9d5('0x8')]('/',auth[_0xb9d5('0x9')](),controller[_0xb9d5('0xa')]);router['get'](_0xb9d5('0xb'),auth[_0xb9d5('0x9')](),controller['show']);router[_0xb9d5('0xc')]('/',auth[_0xb9d5('0x9')](),controller[_0xb9d5('0xd')]);router[_0xb9d5('0xe')]('/:id',auth[_0xb9d5('0x9')](),controller[_0xb9d5('0xf')]);router['delete'](_0xb9d5('0xb'),auth[_0xb9d5('0x9')](),controller[_0xb9d5('0x10')]);module[_0xb9d5('0x11')]=router; \ No newline at end of file +var _0x4343=['express','Router','../../components/auth/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','path'];(function(_0x27930c,_0x172fbe){var _0x274973=function(_0x28ae78){while(--_0x28ae78){_0x27930c['push'](_0x27930c['shift']());}};_0x274973(++_0x172fbe);}(_0x4343,0x1ae));var _0x3434=function(_0x26947a,_0x326449){_0x26947a=_0x26947a-0x0;var _0x4a373c=_0x4343[_0x26947a];return _0x4a373c;};'use strict';var multer=require(_0x3434('0x0'));var util=require('util');var path=require(_0x3434('0x1'));var timeout=require('connect-timeout');var express=require(_0x3434('0x2'));var router=express[_0x3434('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3434('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3434('0x5'));var controller=require(_0x3434('0x6'));router[_0x3434('0x7')]('/',auth[_0x3434('0x8')](),controller[_0x3434('0x9')]);router[_0x3434('0x7')](_0x3434('0xa'),auth[_0x3434('0x8')](),controller[_0x3434('0xb')]);router['post']('/',auth[_0x3434('0x8')](),controller[_0x3434('0xc')]);router[_0x3434('0xd')](_0x3434('0xa'),auth[_0x3434('0x8')](),controller[_0x3434('0xe')]);router[_0x3434('0xf')]('/:id',auth[_0x3434('0x8')](),controller[_0x3434('0x10')]);module[_0x3434('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index c370e88..e08899c 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 _0x5a43=['BOOLEAN','exports','ENUM','string','picklist','STRING','variable'];(function(_0x17a29a,_0x46b1a1){var _0x42cb2f=function(_0x880a2c){while(--_0x880a2c){_0x17a29a['push'](_0x17a29a['shift']());}};_0x42cb2f(++_0x46b1a1);}(_0x5a43,0xa2));var _0x35a4=function(_0x2d4279,_0x5cc62f){_0x2d4279=_0x2d4279-0x0;var _0x21536d=_0x5a43[_0x2d4279];return _0x21536d;};'use strict';var Sequelize=require('sequelize');module[_0x35a4('0x0')]={'type':{'type':Sequelize[_0x35a4('0x1')](_0x35a4('0x2'),'variable','customVariable','keyValue',_0x35a4('0x3')),'defaultValue':_0x35a4('0x2')},'content':{'type':Sequelize[_0x35a4('0x4')]},'key':{'type':Sequelize[_0x35a4('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x35a4('0x2'),_0x35a4('0x5'),'customVariable')},'keyContent':{'type':Sequelize[_0x35a4('0x4')]},'idField':{'type':Sequelize[_0x35a4('0x4')]},'nameField':{'type':Sequelize[_0x35a4('0x4')]},'customField':{'type':Sequelize[_0x35a4('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x35a4('0x4')]}}; \ No newline at end of file +var _0x11e3=['picklist','string','STRING','BOOLEAN','sequelize','ENUM','variable','customVariable'];(function(_0x2238b1,_0x2cf83b){var _0x3bffa6=function(_0x5dd314){while(--_0x5dd314){_0x2238b1['push'](_0x2238b1['shift']());}};_0x3bffa6(++_0x2cf83b);}(_0x11e3,0x13c));var _0x311e=function(_0x5b6d1b,_0x12eac6){_0x5b6d1b=_0x5b6d1b-0x0;var _0x5496a8=_0x11e3[_0x5b6d1b];return _0x5496a8;};'use strict';var Sequelize=require(_0x311e('0x0'));module['exports']={'type':{'type':Sequelize[_0x311e('0x1')]('string',_0x311e('0x2'),_0x311e('0x3'),'keyValue',_0x311e('0x4')),'defaultValue':_0x311e('0x5')},'content':{'type':Sequelize[_0x311e('0x6')]},'key':{'type':Sequelize[_0x311e('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x311e('0x5'),_0x311e('0x2'),_0x311e('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x311e('0x6')]},'nameField':{'type':Sequelize[_0x311e('0x6')]},'customField':{'type':Sequelize[_0x311e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x311e('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 89df167..41aac0b 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 _0x66c7=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','error','stack','name','DeskField','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','includeAll','include','findAll','rows','params','merge','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x66c7,0x15c));var _0x766c=function(_0x5a57cd,_0x498a68){_0x5a57cd=_0x5a57cd-0x0;var _0x3b9e9d=_0x66c7[_0x5a57cd];return _0x3b9e9d;};'use strict';var emlformat=require(_0x766c('0x0'));var rimraf=require(_0x766c('0x1'));var zipdir=require(_0x766c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x766c('0x3'));var moment=require(_0x766c('0x4'));var BPromise=require(_0x766c('0x5'));var Mustache=require(_0x766c('0x6'));var util=require(_0x766c('0x7'));var path=require(_0x766c('0x8'));var sox=require('sox');var csv=require(_0x766c('0x9'));var ejs=require(_0x766c('0xa'));var fs=require('fs');var fs_extra=require(_0x766c('0xb'));var _=require(_0x766c('0xc'));var squel=require(_0x766c('0xd'));var crypto=require(_0x766c('0xe'));var jsforce=require(_0x766c('0xf'));var deskjs=require(_0x766c('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x766c('0x11'));var Redis=require(_0x766c('0x12'));var authService=require(_0x766c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x766c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x766c('0x15'))(_0x766c('0x16'));var utils=require(_0x766c('0x17'));var config=require(_0x766c('0x18'));var licenseUtil=require(_0x766c('0x19'));var db=require(_0x766c('0x1a'))['db'];function respondWithStatusCode(_0x2dcaa6,_0x3fcdb0){_0x3fcdb0=_0x3fcdb0||0xcc;return function(_0x9cb32b){if(_0x9cb32b){return _0x2dcaa6[_0x766c('0x1b')](_0x3fcdb0);}return _0x2dcaa6[_0x766c('0x1c')](_0x3fcdb0)[_0x766c('0x1d')]();};}function respondWithResult(_0x26dbe2,_0x44365a){_0x44365a=_0x44365a||0xc8;return function(_0x186914){if(_0x186914){return _0x26dbe2['status'](_0x44365a)['json'](_0x186914);}};}function respondWithFilteredResult(_0x491b9e,_0x35fcdc){return function(_0x3e0cf0){if(_0x3e0cf0){var _0xfadbc1=typeof _0x35fcdc[_0x766c('0x1e')]===_0x766c('0x1f')&&typeof _0x35fcdc[_0x766c('0x20')]==='undefined';var _0x529811=_0x3e0cf0[_0x766c('0x21')];var _0x23c566=_0xfadbc1?0x0:_0x35fcdc[_0x766c('0x1e')];var _0x47c887=_0xfadbc1?_0x3e0cf0[_0x766c('0x21')]:_0x35fcdc[_0x766c('0x1e')]+_0x35fcdc[_0x766c('0x20')];var _0x563546;if(_0x47c887>=_0x529811){_0x47c887=_0x529811;_0x563546=0xc8;}else{_0x563546=0xce;}_0x491b9e['status'](_0x563546);return _0x491b9e['set'](_0x766c('0x22'),_0x23c566+'-'+_0x47c887+'/'+_0x529811)['json'](_0x3e0cf0);}return null;};}function patchUpdates(_0x2736d0){return function(_0x3a0601){try{jsonpatch['apply'](_0x3a0601,_0x2736d0,!![]);}catch(_0x5dd837){return BPromise[_0x766c('0x23')](_0x5dd837);}return _0x3a0601[_0x766c('0x24')]();};}function saveUpdates(_0x41fa49,_0x508ce7){return function(_0x28304f){if(_0x28304f){return _0x28304f[_0x766c('0x25')](_0x41fa49)['then'](function(_0x504b05){return _0x504b05;});}return null;};}function removeEntity(_0x577000,_0x43d91f){return function(_0x4eb83e){if(_0x4eb83e){return _0x4eb83e[_0x766c('0x26')]()[_0x766c('0x27')](function(){_0x577000[_0x766c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44659e,_0x444310){return function(_0x19cb9b){if(!_0x19cb9b){_0x44659e[_0x766c('0x1b')](0x194);}return _0x19cb9b;};}function handleError(_0x3db6b4,_0x8ce86b){_0x8ce86b=_0x8ce86b||0x1f4;return function(_0x5ad1d6){logger[_0x766c('0x28')](_0x5ad1d6[_0x766c('0x29')]);if(_0x5ad1d6[_0x766c('0x2a')]){delete _0x5ad1d6[_0x766c('0x2a')];}_0x3db6b4[_0x766c('0x1c')](_0x8ce86b)['send'](_0x5ad1d6);};}exports['index']=function(_0x2d7de6,_0x19b6e8){var _0x1d5288={},_0x549dde={},_0x9f13ba={'count':0x0,'rows':[]};var _0x463302=_['map'](db[_0x766c('0x2b')]['rawAttributes'],function(_0x5bbefd){return{'name':_0x5bbefd[_0x766c('0x2c')],'type':_0x5bbefd[_0x766c('0x2d')][_0x766c('0x2e')]};});_0x549dde['model']=_[_0x766c('0x2f')](_0x463302,_0x766c('0x2a'));_0x549dde[_0x766c('0x30')]=_[_0x766c('0x31')](_0x2d7de6[_0x766c('0x30')]);_0x549dde['filters']=_['intersection'](_0x549dde[_0x766c('0x32')],_0x549dde[_0x766c('0x30')]);_0x1d5288[_0x766c('0x33')]=_[_0x766c('0x34')](_0x549dde[_0x766c('0x32')],qs['fields'](_0x2d7de6[_0x766c('0x30')][_0x766c('0x35')]));_0x1d5288[_0x766c('0x33')]=_0x1d5288['attributes'][_0x766c('0x36')]?_0x1d5288['attributes']:_0x549dde['model'];if(!_0x2d7de6[_0x766c('0x30')][_0x766c('0x37')](_0x766c('0x38'))){_0x1d5288[_0x766c('0x20')]=qs[_0x766c('0x20')](_0x2d7de6[_0x766c('0x30')]['limit']);_0x1d5288['offset']=qs[_0x766c('0x1e')](_0x2d7de6[_0x766c('0x30')][_0x766c('0x1e')]);}_0x1d5288[_0x766c('0x39')]=qs[_0x766c('0x3a')](_0x2d7de6[_0x766c('0x30')][_0x766c('0x3a')]);_0x1d5288[_0x766c('0x3b')]=qs[_0x766c('0x3c')](_[_0x766c('0x3d')](_0x2d7de6[_0x766c('0x30')],_0x549dde[_0x766c('0x3c')]),_0x463302);if(_0x2d7de6[_0x766c('0x30')]['filter']){_0x1d5288[_0x766c('0x3b')]=_['merge'](_0x1d5288[_0x766c('0x3b')],{'$or':_['map'](_0x463302,function(_0x1e13ee){if(_0x1e13ee[_0x766c('0x2d')]!=='VIRTUAL'){var _0xfb586={};_0xfb586[_0x1e13ee[_0x766c('0x2a')]]={'$like':'%'+_0x2d7de6['query'][_0x766c('0x3e')]+'%'};return _0xfb586;}})});}_0x1d5288=_['merge']({},_0x1d5288,_0x2d7de6['options']);var _0x5c1df6={'where':_0x1d5288[_0x766c('0x3b')]};return db['DeskField'][_0x766c('0x21')](_0x5c1df6)[_0x766c('0x27')](function(_0x3b8636){_0x9f13ba[_0x766c('0x21')]=_0x3b8636;if(_0x2d7de6[_0x766c('0x30')][_0x766c('0x3f')]){_0x1d5288[_0x766c('0x40')]=[{'all':!![]}];}return db[_0x766c('0x2b')][_0x766c('0x41')](_0x1d5288);})['then'](function(_0x246348){_0x9f13ba[_0x766c('0x42')]=_0x246348;return _0x9f13ba;})['then'](respondWithFilteredResult(_0x19b6e8,_0x1d5288))['catch'](handleError(_0x19b6e8,null));};exports['show']=function(_0x256102,_0xe8d1d0){var _0x537714={'raw':!![],'where':{'id':_0x256102[_0x766c('0x43')]['id']}},_0x2b99d1={};_0x2b99d1['model']=_[_0x766c('0x31')](db[_0x766c('0x2b')]['rawAttributes']);_0x2b99d1[_0x766c('0x30')]=_['keys'](_0x256102[_0x766c('0x30')]);_0x2b99d1[_0x766c('0x3c')]=_[_0x766c('0x34')](_0x2b99d1[_0x766c('0x32')],_0x2b99d1[_0x766c('0x30')]);_0x537714['attributes']=_[_0x766c('0x34')](_0x2b99d1[_0x766c('0x32')],qs['fields'](_0x256102[_0x766c('0x30')][_0x766c('0x35')]));_0x537714['attributes']=_0x537714['attributes'][_0x766c('0x36')]?_0x537714[_0x766c('0x33')]:_0x2b99d1[_0x766c('0x32')];if(_0x256102['query'][_0x766c('0x3f')]){_0x537714[_0x766c('0x40')]=[{'all':!![]}];}_0x537714=_[_0x766c('0x44')]({},_0x537714,_0x256102['options']);return db[_0x766c('0x2b')][_0x766c('0x45')](_0x537714)['then'](handleEntityNotFound(_0xe8d1d0,null))[_0x766c('0x27')](respondWithResult(_0xe8d1d0,null))[_0x766c('0x46')](handleError(_0xe8d1d0,null));};exports[_0x766c('0x47')]=function(_0x53c225,_0x67a4ab){return db['DeskField']['create'](_0x53c225['body'],{})[_0x766c('0x27')](respondWithResult(_0x67a4ab,0xc9))[_0x766c('0x46')](handleError(_0x67a4ab,null));};exports['update']=function(_0x2b53ca,_0xcb8c71){if(_0x2b53ca[_0x766c('0x48')]['id']){delete _0x2b53ca['body']['id'];}return db[_0x766c('0x2b')]['find']({'where':{'id':_0x2b53ca[_0x766c('0x43')]['id']}})[_0x766c('0x27')](handleEntityNotFound(_0xcb8c71,null))[_0x766c('0x27')](saveUpdates(_0x2b53ca[_0x766c('0x48')],null))[_0x766c('0x27')](respondWithResult(_0xcb8c71,null))[_0x766c('0x46')](handleError(_0xcb8c71,null));};exports[_0x766c('0x26')]=function(_0x33bd20,_0x38bb8b){return db['DeskField'][_0x766c('0x45')]({'where':{'id':_0x33bd20[_0x766c('0x43')]['id']}})[_0x766c('0x27')](handleEntityNotFound(_0x38bb8b,null))[_0x766c('0x27')](removeEntity(_0x38bb8b,null))[_0x766c('0x46')](handleError(_0x38bb8b,null));}; \ No newline at end of file +var _0x5a9e=['set','Content-Range','reject','save','then','error','stack','name','send','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset'];(function(_0x459911,_0x30a454){var _0x1939e2=function(_0x10da24){while(--_0x10da24){_0x459911['push'](_0x459911['shift']());}};_0x1939e2(++_0x30a454);}(_0x5a9e,0xbd));var _0xe5a9=function(_0x4fb1b8,_0x32d98d){_0x4fb1b8=_0x4fb1b8-0x0;var _0x146c71=_0x5a9e[_0x4fb1b8];return _0x146c71;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe5a9('0x0'));var zipdir=require(_0xe5a9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe5a9('0x2'));var BPromise=require(_0xe5a9('0x3'));var Mustache=require(_0xe5a9('0x4'));var util=require(_0xe5a9('0x5'));var path=require(_0xe5a9('0x6'));var sox=require('sox');var csv=require(_0xe5a9('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe5a9('0x8'));var _=require(_0xe5a9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe5a9('0xa'));var deskjs=require(_0xe5a9('0xb'));var toCsv=require(_0xe5a9('0x7'));var querystring=require(_0xe5a9('0xc'));var Papa=require(_0xe5a9('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe5a9('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe5a9('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xe5a9('0x10'));var config=require(_0xe5a9('0x11'));var licenseUtil=require(_0xe5a9('0x12'));var db=require(_0xe5a9('0x13'))['db'];function respondWithStatusCode(_0x2e36e6,_0x4386ec){_0x4386ec=_0x4386ec||0xcc;return function(_0x14ccdf){if(_0x14ccdf){return _0x2e36e6['sendStatus'](_0x4386ec);}return _0x2e36e6[_0xe5a9('0x14')](_0x4386ec)[_0xe5a9('0x15')]();};}function respondWithResult(_0x1e5577,_0x45770f){_0x45770f=_0x45770f||0xc8;return function(_0x1a1851){if(_0x1a1851){return _0x1e5577[_0xe5a9('0x14')](_0x45770f)[_0xe5a9('0x16')](_0x1a1851);}};}function respondWithFilteredResult(_0x56a2ba,_0x3aac0b){return function(_0x3fe6f0){if(_0x3fe6f0){var _0x1e313e=typeof _0x3aac0b['offset']==='undefined'&&typeof _0x3aac0b[_0xe5a9('0x17')]===_0xe5a9('0x18');var _0xb1d69e=_0x3fe6f0[_0xe5a9('0x19')];var _0xd5f697=_0x1e313e?0x0:_0x3aac0b[_0xe5a9('0x1a')];var _0x509cdc=_0x1e313e?_0x3fe6f0[_0xe5a9('0x19')]:_0x3aac0b['offset']+_0x3aac0b['limit'];var _0x9e77e0;if(_0x509cdc>=_0xb1d69e){_0x509cdc=_0xb1d69e;_0x9e77e0=0xc8;}else{_0x9e77e0=0xce;}_0x56a2ba[_0xe5a9('0x14')](_0x9e77e0);return _0x56a2ba[_0xe5a9('0x1b')](_0xe5a9('0x1c'),_0xd5f697+'-'+_0x509cdc+'/'+_0xb1d69e)[_0xe5a9('0x16')](_0x3fe6f0);}return null;};}function patchUpdates(_0x17479d){return function(_0x49ec65){try{jsonpatch['apply'](_0x49ec65,_0x17479d,!![]);}catch(_0x3c417b){return BPromise[_0xe5a9('0x1d')](_0x3c417b);}return _0x49ec65[_0xe5a9('0x1e')]();};}function saveUpdates(_0x374879,_0x38f8d2){return function(_0x304cda){if(_0x304cda){return _0x304cda['update'](_0x374879)[_0xe5a9('0x1f')](function(_0xdc93eb){return _0xdc93eb;});}return null;};}function removeEntity(_0x5de2dc,_0x1c15d3){return function(_0x38855b){if(_0x38855b){return _0x38855b['destroy']()[_0xe5a9('0x1f')](function(){_0x5de2dc['status'](0xcc)[_0xe5a9('0x15')]();});}};}function handleEntityNotFound(_0x1b1fff,_0x38b6a4){return function(_0x45a4c4){if(!_0x45a4c4){_0x1b1fff['sendStatus'](0x194);}return _0x45a4c4;};}function handleError(_0x8892f8,_0x1e1cd5){_0x1e1cd5=_0x1e1cd5||0x1f4;return function(_0x20e1a1){logger[_0xe5a9('0x20')](_0x20e1a1[_0xe5a9('0x21')]);if(_0x20e1a1[_0xe5a9('0x22')]){delete _0x20e1a1[_0xe5a9('0x22')];}_0x8892f8[_0xe5a9('0x14')](_0x1e1cd5)[_0xe5a9('0x23')](_0x20e1a1);};}exports['index']=function(_0x34c0db,_0x20621a){var _0x5ab6c2={},_0x9b9837={},_0x5e4266={'count':0x0,'rows':[]};var _0x227cea=_[_0xe5a9('0x24')](db[_0xe5a9('0x25')][_0xe5a9('0x26')],function(_0x40f6dd){return{'name':_0x40f6dd[_0xe5a9('0x27')],'type':_0x40f6dd[_0xe5a9('0x28')][_0xe5a9('0x29')]};});_0x9b9837[_0xe5a9('0x2a')]=_[_0xe5a9('0x24')](_0x227cea,'name');_0x9b9837[_0xe5a9('0x2b')]=_[_0xe5a9('0x2c')](_0x34c0db[_0xe5a9('0x2b')]);_0x9b9837[_0xe5a9('0x2d')]=_[_0xe5a9('0x2e')](_0x9b9837[_0xe5a9('0x2a')],_0x9b9837['query']);_0x5ab6c2[_0xe5a9('0x2f')]=_['intersection'](_0x9b9837[_0xe5a9('0x2a')],qs[_0xe5a9('0x30')](_0x34c0db[_0xe5a9('0x2b')][_0xe5a9('0x30')]));_0x5ab6c2[_0xe5a9('0x2f')]=_0x5ab6c2[_0xe5a9('0x2f')][_0xe5a9('0x31')]?_0x5ab6c2['attributes']:_0x9b9837[_0xe5a9('0x2a')];if(!_0x34c0db[_0xe5a9('0x2b')][_0xe5a9('0x32')](_0xe5a9('0x33'))){_0x5ab6c2[_0xe5a9('0x17')]=qs[_0xe5a9('0x17')](_0x34c0db['query'][_0xe5a9('0x17')]);_0x5ab6c2[_0xe5a9('0x1a')]=qs[_0xe5a9('0x1a')](_0x34c0db['query'][_0xe5a9('0x1a')]);}_0x5ab6c2[_0xe5a9('0x34')]=qs[_0xe5a9('0x35')](_0x34c0db[_0xe5a9('0x2b')][_0xe5a9('0x35')]);_0x5ab6c2[_0xe5a9('0x36')]=qs[_0xe5a9('0x2d')](_[_0xe5a9('0x37')](_0x34c0db[_0xe5a9('0x2b')],_0x9b9837[_0xe5a9('0x2d')]),_0x227cea);if(_0x34c0db[_0xe5a9('0x2b')][_0xe5a9('0x38')]){_0x5ab6c2[_0xe5a9('0x36')]=_['merge'](_0x5ab6c2['where'],{'$or':_[_0xe5a9('0x24')](_0x227cea,function(_0x1e6943){if(_0x1e6943[_0xe5a9('0x28')]!==_0xe5a9('0x39')){var _0x3716d3={};_0x3716d3[_0x1e6943['name']]={'$like':'%'+_0x34c0db[_0xe5a9('0x2b')]['filter']+'%'};return _0x3716d3;}})});}_0x5ab6c2=_[_0xe5a9('0x3a')]({},_0x5ab6c2,_0x34c0db[_0xe5a9('0x3b')]);var _0x248c4c={'where':_0x5ab6c2[_0xe5a9('0x36')]};return db[_0xe5a9('0x25')][_0xe5a9('0x19')](_0x248c4c)['then'](function(_0x30357b){_0x5e4266[_0xe5a9('0x19')]=_0x30357b;if(_0x34c0db[_0xe5a9('0x2b')][_0xe5a9('0x3c')]){_0x5ab6c2[_0xe5a9('0x3d')]=[{'all':!![]}];}return db[_0xe5a9('0x25')][_0xe5a9('0x3e')](_0x5ab6c2);})['then'](function(_0x5a11c1){_0x5e4266[_0xe5a9('0x3f')]=_0x5a11c1;return _0x5e4266;})[_0xe5a9('0x1f')](respondWithFilteredResult(_0x20621a,_0x5ab6c2))[_0xe5a9('0x40')](handleError(_0x20621a,null));};exports[_0xe5a9('0x41')]=function(_0x4c254a,_0x28ebd7){var _0x9eb161={'raw':!![],'where':{'id':_0x4c254a[_0xe5a9('0x42')]['id']}},_0x50ba41={};_0x50ba41[_0xe5a9('0x2a')]=_[_0xe5a9('0x2c')](db[_0xe5a9('0x25')][_0xe5a9('0x26')]);_0x50ba41[_0xe5a9('0x2b')]=_['keys'](_0x4c254a[_0xe5a9('0x2b')]);_0x50ba41[_0xe5a9('0x2d')]=_[_0xe5a9('0x2e')](_0x50ba41[_0xe5a9('0x2a')],_0x50ba41[_0xe5a9('0x2b')]);_0x9eb161[_0xe5a9('0x2f')]=_[_0xe5a9('0x2e')](_0x50ba41[_0xe5a9('0x2a')],qs[_0xe5a9('0x30')](_0x4c254a['query'][_0xe5a9('0x30')]));_0x9eb161[_0xe5a9('0x2f')]=_0x9eb161['attributes'][_0xe5a9('0x31')]?_0x9eb161[_0xe5a9('0x2f')]:_0x50ba41[_0xe5a9('0x2a')];if(_0x4c254a['query'][_0xe5a9('0x3c')]){_0x9eb161['include']=[{'all':!![]}];}_0x9eb161=_[_0xe5a9('0x3a')]({},_0x9eb161,_0x4c254a[_0xe5a9('0x3b')]);return db[_0xe5a9('0x25')][_0xe5a9('0x43')](_0x9eb161)['then'](handleEntityNotFound(_0x28ebd7,null))[_0xe5a9('0x1f')](respondWithResult(_0x28ebd7,null))[_0xe5a9('0x40')](handleError(_0x28ebd7,null));};exports[_0xe5a9('0x44')]=function(_0x583323,_0x2a6dec){return db[_0xe5a9('0x25')][_0xe5a9('0x44')](_0x583323[_0xe5a9('0x45')],{})[_0xe5a9('0x1f')](respondWithResult(_0x2a6dec,0xc9))[_0xe5a9('0x40')](handleError(_0x2a6dec,null));};exports[_0xe5a9('0x46')]=function(_0x3637a3,_0x2b9a03){if(_0x3637a3[_0xe5a9('0x45')]['id']){delete _0x3637a3[_0xe5a9('0x45')]['id'];}return db[_0xe5a9('0x25')][_0xe5a9('0x43')]({'where':{'id':_0x3637a3[_0xe5a9('0x42')]['id']}})[_0xe5a9('0x1f')](handleEntityNotFound(_0x2b9a03,null))[_0xe5a9('0x1f')](saveUpdates(_0x3637a3[_0xe5a9('0x45')],null))[_0xe5a9('0x1f')](respondWithResult(_0x2b9a03,null))[_0xe5a9('0x40')](handleError(_0x2b9a03,null));};exports[_0xe5a9('0x47')]=function(_0x200183,_0x3cd505){return db[_0xe5a9('0x25')][_0xe5a9('0x43')]({'where':{'id':_0x200183['params']['id']}})[_0xe5a9('0x1f')](handleEntityNotFound(_0x3cd505,null))['then'](removeEntity(_0x3cd505,null))['catch'](handleError(_0x3cd505,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 8ff520f..016ea9f 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 _0x2316=['rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','desk_unique_index','FieldId','lodash','util','api','moment','bluebird'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x2316,0x126));var _0x6231=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0x2316[_0x8ba19a];return _0x2bd8b4;};'use strict';var _=require(_0x6231('0x0'));var util=require(_0x6231('0x1'));var logger=require('../../config/logger')(_0x6231('0x2'));var moment=require(_0x6231('0x3'));var BPromise=require(_0x6231('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6231('0x5'));var config=require(_0x6231('0x6'));var attributes=require(_0x6231('0x7'));module[_0x6231('0x8')]=function(_0x38105a,_0x5a50ca){return _0x38105a[_0x6231('0x9')](_0x6231('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x6231('0xb'),'fields':['idField',_0x6231('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed22=['lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','exports','DeskField','int_desk_fields','idField','FieldId'];(function(_0xcc1266,_0x27ba6d){var _0x34e46a=function(_0x623c34){while(--_0x623c34){_0xcc1266['push'](_0xcc1266['shift']());}};_0x34e46a(++_0x27ba6d);}(_0xed22,0x84));var _0x2ed2=function(_0x107790,_0x5692f2){_0x107790=_0x107790-0x0;var _0xac4179=_0xed22[_0x107790];return _0xac4179;};'use strict';var _=require(_0x2ed2('0x0'));var util=require(_0x2ed2('0x1'));var logger=require(_0x2ed2('0x2'))('api');var moment=require(_0x2ed2('0x3'));var BPromise=require(_0x2ed2('0x4'));var rp=require(_0x2ed2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2ed2('0x6'));var attributes=require('./intDeskField.attributes');module[_0x2ed2('0x7')]=function(_0x1aa0a8,_0x18627e){return _0x1aa0a8['define'](_0x2ed2('0x8'),attributes,{'tableName':_0x2ed2('0x9'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x2ed2('0xa'),_0x2ed2('0xb')],'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 11c4ab1..66a277e 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 _0xc554=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment'];(function(_0x5d561b,_0x530379){var _0x41a4b1=function(_0x29bcae){while(--_0x29bcae){_0x5d561b['push'](_0x5d561b['shift']());}};_0x41a4b1(++_0x530379);}(_0xc554,0x162));var _0x4c55=function(_0x3f477c,_0x52b7ff){_0x3f477c=_0x3f477c-0x0;var _0x4c36b3=_0xc554[_0x3f477c];return _0x4c36b3;};'use strict';var _=require(_0x4c55('0x0'));var util=require(_0x4c55('0x1'));var moment=require(_0x4c55('0x2'));var BPromise=require(_0x4c55('0x3'));var rs=require(_0x4c55('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c55('0x5'))['db'];var utils=require(_0x4c55('0x6'));var logger=require(_0x4c55('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4c55('0x8')][_0x4c55('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41fd44,_0x5470cc,_0x28df3b){return new BPromise(function(_0x5d5b30,_0x1621d6){return client[_0x4c55('0xa')](_0x41fd44,_0x28df3b)['then'](function(_0x5bd075){logger[_0x4c55('0xb')](_0x4c55('0xc'),_0x5470cc,_0x4c55('0xd'));logger[_0x4c55('0xe')](_0x4c55('0xf'),_0x5470cc,_0x4c55('0xd'),JSON[_0x4c55('0x10')](_0x5bd075));if(_0x5bd075[_0x4c55('0x11')]){if(_0x5bd075[_0x4c55('0x11')][_0x4c55('0x12')]===0x1f4){logger[_0x4c55('0x11')](_0x4c55('0xc'),_0x5470cc,_0x5bd075[_0x4c55('0x11')][_0x4c55('0x13')]);return _0x1621d6(_0x5bd075[_0x4c55('0x11')][_0x4c55('0x13')]);}logger[_0x4c55('0x11')]('DeskField,\x20%s,\x20%s',_0x5470cc,_0x5bd075['error']['message']);return _0x5d5b30(_0x5bd075[_0x4c55('0x11')][_0x4c55('0x13')]);}else{logger[_0x4c55('0xb')]('DeskField,\x20%s,\x20%s',_0x5470cc,_0x4c55('0xd'));_0x5d5b30(_0x5bd075[_0x4c55('0x14')][_0x4c55('0x13')]);}})['catch'](function(_0x49a87c){logger[_0x4c55('0x11')](_0x4c55('0xc'),_0x5470cc,_0x49a87c);_0x1621d6(_0x49a87c);});});} \ No newline at end of file +var _0xb3ed=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5f0932,_0x3dbe4c){var _0x103361=function(_0x3f171e){while(--_0x3f171e){_0x5f0932['push'](_0x5f0932['shift']());}};_0x103361(++_0x3dbe4c);}(_0xb3ed,0x1e6));var _0xdb3e=function(_0x304a3f,_0x402e74){_0x304a3f=_0x304a3f-0x0;var _0x543f70=_0xb3ed[_0x304a3f];return _0x543f70;};'use strict';var _=require(_0xdb3e('0x0'));var util=require('util');var moment=require(_0xdb3e('0x1'));var BPromise=require(_0xdb3e('0x2'));var rs=require(_0xdb3e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb3e('0x4'))['db'];var utils=require(_0xdb3e('0x5'));var logger=require(_0xdb3e('0x6'))('rpc');var config=require(_0xdb3e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdb3e('0x8')][_0xdb3e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x251746,_0x879300,_0x2ac7e0){return new BPromise(function(_0x4293f8,_0x5ed542){return client[_0xdb3e('0xa')](_0x251746,_0x2ac7e0)[_0xdb3e('0xb')](function(_0x1bcc08){logger['info'](_0xdb3e('0xc'),_0x879300,_0xdb3e('0xd'));logger[_0xdb3e('0xe')](_0xdb3e('0xf'),_0x879300,_0xdb3e('0xd'),JSON[_0xdb3e('0x10')](_0x1bcc08));if(_0x1bcc08[_0xdb3e('0x11')]){if(_0x1bcc08['error'][_0xdb3e('0x12')]===0x1f4){logger[_0xdb3e('0x11')]('DeskField,\x20%s,\x20%s',_0x879300,_0x1bcc08['error'][_0xdb3e('0x13')]);return _0x5ed542(_0x1bcc08['error'][_0xdb3e('0x13')]);}logger[_0xdb3e('0x11')](_0xdb3e('0xc'),_0x879300,_0x1bcc08[_0xdb3e('0x11')]['message']);return _0x4293f8(_0x1bcc08[_0xdb3e('0x11')]['message']);}else{logger['info'](_0xdb3e('0xc'),_0x879300,'request\x20sent');_0x4293f8(_0x1bcc08[_0xdb3e('0x14')]['message']);}})[_0xdb3e('0x15')](function(_0x46b889){logger[_0xdb3e('0x11')](_0xdb3e('0xc'),_0x879300,_0x46b889);_0x5ed542(_0x46b889);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 5ddb8ff..b03de85 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 _0xc2d9=['show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id'];(function(_0x16c521,_0x58d4fc){var _0x13ea45=function(_0x225adc){while(--_0x225adc){_0x16c521['push'](_0x16c521['shift']());}};_0x13ea45(++_0x58d4fc);}(_0xc2d9,0x16f));var _0x9c2d=function(_0x399a0b,_0x550d4e){_0x399a0b=_0x399a0b-0x0;var _0x266bc0=_0xc2d9[_0x399a0b];return _0x266bc0;};'use strict';var multer=require(_0x9c2d('0x0'));var util=require(_0x9c2d('0x1'));var path=require(_0x9c2d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9c2d('0x3')]();var fs_extra=require(_0x9c2d('0x4'));var auth=require(_0x9c2d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9c2d('0x6'));var controller=require(_0x9c2d('0x7'));router[_0x9c2d('0x8')]('/',auth[_0x9c2d('0x9')](),controller['index']);router[_0x9c2d('0x8')](_0x9c2d('0xa'),auth[_0x9c2d('0x9')](),controller[_0x9c2d('0xb')]);router[_0x9c2d('0x8')](_0x9c2d('0xc'),auth[_0x9c2d('0x9')](),controller['getConfigurations']);router['get'](_0x9c2d('0xd'),auth[_0x9c2d('0x9')](),controller[_0x9c2d('0xe')]);router[_0x9c2d('0xf')]('/',auth['isAuthenticated'](),controller[_0x9c2d('0x10')]);router[_0x9c2d('0xf')]('/:id/configurations',auth[_0x9c2d('0x9')](),controller[_0x9c2d('0x11')]);router[_0x9c2d('0x12')](_0x9c2d('0xa'),auth[_0x9c2d('0x9')](),controller[_0x9c2d('0x13')]);router['delete'](_0x9c2d('0xa'),auth[_0x9c2d('0x9')](),controller['destroy']);module[_0x9c2d('0x14')]=router; \ No newline at end of file +var _0xf1a1=['/:id/configurations','isAuthenticated','getConfigurations','getFields','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','/:id','show'];(function(_0x1e3c16,_0x372caa){var _0x47a0c9=function(_0x47f81d){while(--_0x47f81d){_0x1e3c16['push'](_0x1e3c16['shift']());}};_0x47a0c9(++_0x372caa);}(_0xf1a1,0x82));var _0x1f1a=function(_0x1a2408,_0x23bc9e){_0x1a2408=_0x1a2408-0x0;var _0x287fba=_0xf1a1[_0x1a2408];return _0x287fba;};'use strict';var multer=require(_0x1f1a('0x0'));var util=require(_0x1f1a('0x1'));var path=require(_0x1f1a('0x2'));var timeout=require(_0x1f1a('0x3'));var express=require(_0x1f1a('0x4'));var router=express[_0x1f1a('0x5')]();var fs_extra=require(_0x1f1a('0x6'));var auth=require(_0x1f1a('0x7'));var interaction=require(_0x1f1a('0x8'));var config=require(_0x1f1a('0x9'));var controller=require(_0x1f1a('0xa'));router[_0x1f1a('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x1f1a('0xc'),auth['isAuthenticated'](),controller[_0x1f1a('0xd')]);router[_0x1f1a('0xb')](_0x1f1a('0xe'),auth[_0x1f1a('0xf')](),controller[_0x1f1a('0x10')]);router[_0x1f1a('0xb')]('/:id/fields',auth[_0x1f1a('0xf')](),controller[_0x1f1a('0x11')]);router[_0x1f1a('0x12')]('/',auth[_0x1f1a('0xf')](),controller[_0x1f1a('0x13')]);router[_0x1f1a('0x12')](_0x1f1a('0xe'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x1f1a('0x14')]('/:id',auth[_0x1f1a('0xf')](),controller[_0x1f1a('0x15')]);router[_0x1f1a('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1f1a('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 9c5bfb7..b708664 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 _0xb1e0=['STRING'];(function(_0x32b262,_0x3bf68e){var _0x562b18=function(_0xc33bb9){while(--_0xc33bb9){_0x32b262['push'](_0x32b262['shift']());}};_0x562b18(++_0x3bf68e);}(_0xb1e0,0x112));var _0x0b1e=function(_0xdeba,_0x15eb9a){_0xdeba=_0xdeba-0x0;var _0x9a69ce=_0xb1e0[_0xdeba];return _0x9a69ce;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0b1e('0x0')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0x0b1e('0x0')]},'clientId':{'type':Sequelize[_0x0b1e('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x0b1e('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x0b1e('0x0')]}}; \ No newline at end of file +var _0x75c8=['sequelize','exports','STRING'];(function(_0x1293f7,_0x4e68b0){var _0x315df8=function(_0x1523d0){while(--_0x1523d0){_0x1293f7['push'](_0x1293f7['shift']());}};_0x315df8(++_0x4e68b0);}(_0x75c8,0x1c2));var _0x875c=function(_0x446162,_0x173bff){_0x446162=_0x446162-0x0;var _0x2f1970=_0x75c8[_0x446162];return _0x2f1970;};'use strict';var Sequelize=require(_0x875c('0x0'));module[_0x875c('0x1')]={'name':{'type':Sequelize[_0x875c('0x2')]},'username':{'type':Sequelize[_0x875c('0x2')]},'password':{'type':Sequelize[_0x875c('0x2')]},'remoteUri':{'type':Sequelize[_0x875c('0x2')]},'tenantId':{'type':Sequelize[_0x875c('0x2')]},'clientId':{'type':Sequelize[_0x875c('0x2')]},'clientSecret':{'type':Sequelize[_0x875c('0x2')]},'serverUrl':{'type':Sequelize[_0x875c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x875c('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index c7aff05..d01aa7b 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 _0xc7b4=['attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Account','then','includeAll','include','findAll','rows','catch','params','find','create','body','update','destroy','getConfigurations','Dynamics365Configuration','addConfiguration','findOne','AccountId','Subjects','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','title','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidyominame','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','customeridtype','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','subjectidname','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','remoteUri','clientId','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','https://login.microsoftonline.com/','tenantId','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','StateAttributeMetadata','test','statusCode','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','count','limit','set','apply','reject','save','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','model'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xc7b4,0x15e));var _0x4c7b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc7b4[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x4c7b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4c7b('0x1'));var jsonpatch=require(_0x4c7b('0x2'));var rp=require('request-promise');var moment=require(_0x4c7b('0x3'));var BPromise=require(_0x4c7b('0x4'));var Mustache=require(_0x4c7b('0x5'));var util=require(_0x4c7b('0x6'));var path=require(_0x4c7b('0x7'));var sox=require('sox');var csv=require(_0x4c7b('0x8'));var ejs=require(_0x4c7b('0x9'));var fs=require('fs');var fs_extra=require(_0x4c7b('0xa'));var _=require(_0x4c7b('0xb'));var squel=require(_0x4c7b('0xc'));var crypto=require(_0x4c7b('0xd'));var jsforce=require(_0x4c7b('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4c7b('0xf'));var Redis=require(_0x4c7b('0x10'));var authService=require(_0x4c7b('0x11'));var qs=require(_0x4c7b('0x12'));var as=require(_0x4c7b('0x13'));var hardwareService=require(_0x4c7b('0x14'));var logger=require('../../config/logger')(_0x4c7b('0x15'));var utils=require(_0x4c7b('0x16'));var config=require(_0x4c7b('0x17'));var licenseUtil=require(_0x4c7b('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x262265,_0x18fd94){_0x18fd94=_0x18fd94||0xcc;return function(_0x13f436){if(_0x13f436){return _0x262265[_0x4c7b('0x19')](_0x18fd94);}return _0x262265[_0x4c7b('0x1a')](_0x18fd94)['end']();};}function respondWithResult(_0x5aa057,_0x4ad52f){_0x4ad52f=_0x4ad52f||0xc8;return function(_0x1c2af5){if(_0x1c2af5){return _0x5aa057['status'](_0x4ad52f)[_0x4c7b('0x1b')](_0x1c2af5);}};}function respondWithFilteredResult(_0x3ed0b2,_0x450cb8){return function(_0x135bda){if(_0x135bda){var _0x2f570f=typeof _0x450cb8[_0x4c7b('0x1c')]==='undefined'&&typeof _0x450cb8['limit']==='undefined';var _0x2f5f35=_0x135bda[_0x4c7b('0x1d')];var _0x290e79=_0x2f570f?0x0:_0x450cb8[_0x4c7b('0x1c')];var _0x2342d4=_0x2f570f?_0x135bda['count']:_0x450cb8[_0x4c7b('0x1c')]+_0x450cb8[_0x4c7b('0x1e')];var _0x42f054;if(_0x2342d4>=_0x2f5f35){_0x2342d4=_0x2f5f35;_0x42f054=0xc8;}else{_0x42f054=0xce;}_0x3ed0b2[_0x4c7b('0x1a')](_0x42f054);return _0x3ed0b2[_0x4c7b('0x1f')]('Content-Range',_0x290e79+'-'+_0x2342d4+'/'+_0x2f5f35)[_0x4c7b('0x1b')](_0x135bda);}return null;};}function patchUpdates(_0x1c3971){return function(_0xb1feda){try{jsonpatch[_0x4c7b('0x20')](_0xb1feda,_0x1c3971,!![]);}catch(_0x3a6f4b){return BPromise[_0x4c7b('0x21')](_0x3a6f4b);}return _0xb1feda[_0x4c7b('0x22')]();};}function saveUpdates(_0x30d77a,_0xe2568f){return function(_0x14f5d0){if(_0x14f5d0){return _0x14f5d0['update'](_0x30d77a)['then'](function(_0x8326c8){return _0x8326c8;});}return null;};}function removeEntity(_0x543e52,_0x28347f){return function(_0x4029d9){if(_0x4029d9){return _0x4029d9['destroy']()['then'](function(){_0x543e52['status'](0xcc)[_0x4c7b('0x23')]();});}};}function handleEntityNotFound(_0x9471c1,_0x218cb3){return function(_0x3dd52e){if(!_0x3dd52e){_0x9471c1[_0x4c7b('0x19')](0x194);}return _0x3dd52e;};}function handleError(_0x49059b,_0x350acb){_0x350acb=_0x350acb||0x1f4;return function(_0x19273f){logger[_0x4c7b('0x24')](_0x19273f[_0x4c7b('0x25')]);if(_0x19273f[_0x4c7b('0x26')]){delete _0x19273f[_0x4c7b('0x26')];}_0x49059b['status'](_0x350acb)[_0x4c7b('0x27')](_0x19273f);};}exports[_0x4c7b('0x28')]=function(_0x4e2641,_0x3a678d){var _0x2e5905={},_0x545df2={},_0x416587={'count':0x0,'rows':[]};var _0x5c580e=_['map'](db['Dynamics365Account'][_0x4c7b('0x29')],function(_0x5e4453){return{'name':_0x5e4453[_0x4c7b('0x2a')],'type':_0x5e4453[_0x4c7b('0x2b')][_0x4c7b('0x2c')]};});_0x545df2['model']=_[_0x4c7b('0x2d')](_0x5c580e,_0x4c7b('0x26'));_0x545df2[_0x4c7b('0x2e')]=_[_0x4c7b('0x2f')](_0x4e2641[_0x4c7b('0x2e')]);_0x545df2[_0x4c7b('0x30')]=_['intersection'](_0x545df2[_0x4c7b('0x31')],_0x545df2[_0x4c7b('0x2e')]);_0x2e5905[_0x4c7b('0x32')]=_[_0x4c7b('0x33')](_0x545df2[_0x4c7b('0x31')],qs[_0x4c7b('0x34')](_0x4e2641[_0x4c7b('0x2e')][_0x4c7b('0x34')]));_0x2e5905[_0x4c7b('0x32')]=_0x2e5905[_0x4c7b('0x32')][_0x4c7b('0x35')]?_0x2e5905[_0x4c7b('0x32')]:_0x545df2['model'];if(!_0x4e2641[_0x4c7b('0x2e')][_0x4c7b('0x36')](_0x4c7b('0x37'))){_0x2e5905['limit']=qs[_0x4c7b('0x1e')](_0x4e2641['query']['limit']);_0x2e5905[_0x4c7b('0x1c')]=qs['offset'](_0x4e2641[_0x4c7b('0x2e')][_0x4c7b('0x1c')]);}_0x2e5905[_0x4c7b('0x38')]=qs[_0x4c7b('0x39')](_0x4e2641[_0x4c7b('0x2e')][_0x4c7b('0x39')]);_0x2e5905[_0x4c7b('0x3a')]=qs[_0x4c7b('0x30')](_[_0x4c7b('0x3b')](_0x4e2641['query'],_0x545df2[_0x4c7b('0x30')]),_0x5c580e);if(_0x4e2641[_0x4c7b('0x2e')][_0x4c7b('0x3c')]){_0x2e5905['where']=_[_0x4c7b('0x3d')](_0x2e5905[_0x4c7b('0x3a')],{'$or':_[_0x4c7b('0x2d')](_0x5c580e,function(_0x38a8a8){if(_0x38a8a8['type']!==_0x4c7b('0x3e')){var _0xdf5517={};_0xdf5517[_0x38a8a8[_0x4c7b('0x26')]]={'$like':'%'+_0x4e2641[_0x4c7b('0x2e')][_0x4c7b('0x3c')]+'%'};return _0xdf5517;}})});}_0x2e5905=_[_0x4c7b('0x3d')]({},_0x2e5905,_0x4e2641[_0x4c7b('0x3f')]);var _0xd244c5={'where':_0x2e5905[_0x4c7b('0x3a')]};return db[_0x4c7b('0x40')][_0x4c7b('0x1d')](_0xd244c5)[_0x4c7b('0x41')](function(_0x4be296){_0x416587['count']=_0x4be296;if(_0x4e2641[_0x4c7b('0x2e')][_0x4c7b('0x42')]){_0x2e5905[_0x4c7b('0x43')]=[{'all':!![]}];}return db[_0x4c7b('0x40')][_0x4c7b('0x44')](_0x2e5905);})[_0x4c7b('0x41')](function(_0x520e44){_0x416587[_0x4c7b('0x45')]=_0x520e44;return _0x416587;})[_0x4c7b('0x41')](respondWithFilteredResult(_0x3a678d,_0x2e5905))[_0x4c7b('0x46')](handleError(_0x3a678d,null));};exports['show']=function(_0x4bc810,_0x488e24){var _0x109047={'raw':![],'where':{'id':_0x4bc810[_0x4c7b('0x47')]['id']}},_0x3dcf57={};_0x3dcf57[_0x4c7b('0x31')]=_[_0x4c7b('0x2f')](db[_0x4c7b('0x40')]['rawAttributes']);_0x3dcf57[_0x4c7b('0x2e')]=_[_0x4c7b('0x2f')](_0x4bc810[_0x4c7b('0x2e')]);_0x3dcf57[_0x4c7b('0x30')]=_[_0x4c7b('0x33')](_0x3dcf57[_0x4c7b('0x31')],_0x3dcf57[_0x4c7b('0x2e')]);_0x109047['attributes']=_[_0x4c7b('0x33')](_0x3dcf57[_0x4c7b('0x31')],qs[_0x4c7b('0x34')](_0x4bc810[_0x4c7b('0x2e')][_0x4c7b('0x34')]));_0x109047['attributes']=_0x109047['attributes'][_0x4c7b('0x35')]?_0x109047[_0x4c7b('0x32')]:_0x3dcf57['model'];if(_0x4bc810[_0x4c7b('0x2e')]['includeAll']){_0x109047[_0x4c7b('0x43')]=[{'all':!![]}];}_0x109047=_[_0x4c7b('0x3d')]({},_0x109047,_0x4bc810[_0x4c7b('0x3f')]);return db[_0x4c7b('0x40')][_0x4c7b('0x48')](_0x109047)[_0x4c7b('0x41')](handleEntityNotFound(_0x488e24,null))[_0x4c7b('0x41')](respondWithResult(_0x488e24,null))['catch'](handleError(_0x488e24,null));};exports['create']=function(_0x5959db,_0x429acf){return db[_0x4c7b('0x40')][_0x4c7b('0x49')](_0x5959db[_0x4c7b('0x4a')],{})['then'](respondWithResult(_0x429acf,0xc9))['catch'](handleError(_0x429acf,null));};exports[_0x4c7b('0x4b')]=function(_0x192f3e,_0x28cc07){if(_0x192f3e['body']['id']){delete _0x192f3e[_0x4c7b('0x4a')]['id'];}return db['Dynamics365Account'][_0x4c7b('0x48')]({'where':{'id':_0x192f3e[_0x4c7b('0x47')]['id']}})[_0x4c7b('0x41')](handleEntityNotFound(_0x28cc07,null))[_0x4c7b('0x41')](saveUpdates(_0x192f3e['body'],null))['then'](respondWithResult(_0x28cc07,null))['catch'](handleError(_0x28cc07,null));};exports[_0x4c7b('0x4c')]=function(_0x5c3fa2,_0x1ad96d){return db[_0x4c7b('0x40')][_0x4c7b('0x48')]({'where':{'id':_0x5c3fa2[_0x4c7b('0x47')]['id']}})[_0x4c7b('0x41')](handleEntityNotFound(_0x1ad96d,null))[_0x4c7b('0x41')](removeEntity(_0x1ad96d,null))[_0x4c7b('0x46')](handleError(_0x1ad96d,null));};exports[_0x4c7b('0x4d')]=function(_0x23679d,_0x3e36bb,_0x35872d){var _0x2082b6={};var _0x139836={};var _0x1db45e;var _0x260f2e;return db['Dynamics365Account']['findOne']({'where':{'id':_0x23679d[_0x4c7b('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e36bb,null))['then'](function(_0x2d0558){if(_0x2d0558){_0x1db45e=_0x2d0558;_0x139836[_0x4c7b('0x31')]=_['keys'](db[_0x4c7b('0x4e')]['rawAttributes']);_0x139836['query']=_[_0x4c7b('0x2f')](_0x23679d[_0x4c7b('0x2e')]);_0x139836[_0x4c7b('0x30')]=_[_0x4c7b('0x33')](_0x139836[_0x4c7b('0x31')],_0x139836['query']);_0x2082b6[_0x4c7b('0x32')]=_[_0x4c7b('0x33')](_0x139836[_0x4c7b('0x31')],qs[_0x4c7b('0x34')](_0x23679d[_0x4c7b('0x2e')][_0x4c7b('0x34')]));_0x2082b6[_0x4c7b('0x32')]=_0x2082b6[_0x4c7b('0x32')][_0x4c7b('0x35')]?_0x2082b6[_0x4c7b('0x32')]:_0x139836[_0x4c7b('0x31')];_0x2082b6[_0x4c7b('0x38')]=qs[_0x4c7b('0x39')](_0x23679d['query'][_0x4c7b('0x39')]);_0x2082b6[_0x4c7b('0x3a')]=qs[_0x4c7b('0x30')](_[_0x4c7b('0x3b')](_0x23679d[_0x4c7b('0x2e')],_0x139836[_0x4c7b('0x30')]));if(_0x23679d['query'][_0x4c7b('0x3c')]){_0x2082b6[_0x4c7b('0x3a')]=_[_0x4c7b('0x3d')](_0x2082b6['where'],{'$or':_[_0x4c7b('0x2d')](_0x2082b6['attributes'],function(_0x2ac504){var _0x51d8b6={};_0x51d8b6[_0x2ac504]={'$like':'%'+_0x23679d[_0x4c7b('0x2e')][_0x4c7b('0x3c')]+'%'};return _0x51d8b6;})});}_0x2082b6=_['merge']({},_0x2082b6,_0x23679d[_0x4c7b('0x3f')]);return _0x1db45e[_0x4c7b('0x4d')](_0x2082b6);}})[_0x4c7b('0x41')](function(_0xf19db3){if(_0xf19db3){_0x260f2e=_0xf19db3[_0x4c7b('0x35')];if(!_0x23679d[_0x4c7b('0x2e')][_0x4c7b('0x36')](_0x4c7b('0x37'))){_0x2082b6[_0x4c7b('0x1e')]=qs[_0x4c7b('0x1e')](_0x23679d['query'][_0x4c7b('0x1e')]);_0x2082b6[_0x4c7b('0x1c')]=qs[_0x4c7b('0x1c')](_0x23679d[_0x4c7b('0x2e')][_0x4c7b('0x1c')]);}return _0x1db45e[_0x4c7b('0x4d')](_0x2082b6);}})[_0x4c7b('0x41')](function(_0x478db9){if(_0x478db9){return _0x478db9?{'count':_0x260f2e,'rows':_0x478db9}:null;}})['then'](respondWithResult(_0x3e36bb,null))[_0x4c7b('0x46')](handleError(_0x3e36bb,null));};exports[_0x4c7b('0x4f')]=function(_0x475263,_0x2dc4df,_0x41190a){if(_0x475263['body']['id']){delete _0x475263[_0x4c7b('0x4a')]['id'];}return db[_0x4c7b('0x40')][_0x4c7b('0x50')]({'where':{'id':_0x475263['params']['id']}})[_0x4c7b('0x41')](handleEntityNotFound(_0x2dc4df,null))[_0x4c7b('0x41')](function(_0x54c2b2){if(_0x54c2b2){_0x475263[_0x4c7b('0x4a')][_0x4c7b('0x51')]=_0x54c2b2['id'];_0x475263['body'][_0x4c7b('0x52')]=integrations['getSubjects'](_0x475263[_0x4c7b('0x4a')]['channel'],_0x475263[_0x4c7b('0x4a')][_0x4c7b('0x2b')]);_0x475263['body'][_0x4c7b('0x53')]=integrations[_0x4c7b('0x54')](_0x475263['body']['channel'],_0x475263['body'][_0x4c7b('0x2b')]);return db['Dynamics365Configuration'][_0x4c7b('0x49')](_0x475263[_0x4c7b('0x4a')],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db[_0x4c7b('0x55')],'as':_0x4c7b('0x53')}]});}return null;})['then'](respondWithResult(_0x2dc4df,null))[_0x4c7b('0x46')](handleError(_0x2dc4df,null));};exports[_0x4c7b('0x56')]=function(_0x3845f6,_0x2333ee,_0x57772d){var _0x5beda9=_0x3845f6[_0x4c7b('0x2e')][_0x4c7b('0x57')];var _0xc1ce1f=_0x5beda9===_0x4c7b('0x58')?_0x4c7b('0x59'):'PhoneCall';var _0x284e87='';var _0x5bcfb3='';var _0x3ded46='';var _0x39369c='';var _0x3df6d3='';var _0x25d7ec='';var _0x170578='';var _0xf0f7ae='';var _0x216ffd=[_0x4c7b('0x5a'),'description',_0x4c7b('0x5b'),_0x4c7b('0x5c'),_0x4c7b('0x5d'),_0x4c7b('0x5e'),_0x4c7b('0x5f'),_0x4c7b('0x60'),_0x4c7b('0x61'),_0x4c7b('0x62')];var _0x45a65f=[_0x4c7b('0x63'),_0x4c7b('0x64'),_0x4c7b('0x65'),'billedserviceunits','contactidname',_0x4c7b('0x66'),'contractdetailidname','contractidname',_0x4c7b('0x67'),_0x4c7b('0x68'),_0x4c7b('0x69'),_0x4c7b('0x6a'),_0x4c7b('0x6b'),'createdonbehalfbyname','createdonbehalfbyyominame','customeridname',_0x4c7b('0x6c'),'customeridyominame','emailaddress',_0x4c7b('0x6d'),_0x4c7b('0x6e'),'entityimage_url',_0x4c7b('0x6f'),_0x4c7b('0x70'),'firstresponsebykpiidname','followupby',_0x4c7b('0x71'),_0x4c7b('0x72'),_0x4c7b('0x73'),_0x4c7b('0x74'),_0x4c7b('0x75'),_0x4c7b('0x76'),'modifiedbyexternalpartyyominame',_0x4c7b('0x77'),_0x4c7b('0x78'),_0x4c7b('0x79'),_0x4c7b('0x7a'),_0x4c7b('0x7b'),_0x4c7b('0x7c'),_0x4c7b('0x7d'),_0x4c7b('0x7e'),_0x4c7b('0x7f'),_0x4c7b('0x80'),_0x4c7b('0x81'),_0x4c7b('0x82'),'owneridyominame',_0x4c7b('0x83'),_0x4c7b('0x84'),_0x4c7b('0x85'),'prioritycodename',_0x4c7b('0x86'),_0x4c7b('0x87'),_0x4c7b('0x88'),_0x4c7b('0x89'),_0x4c7b('0x8a'),_0x4c7b('0x8b'),_0x4c7b('0x8c'),_0x4c7b('0x8d'),_0x4c7b('0x8e'),_0x4c7b('0x8f'),'socialprofileidname',_0x4c7b('0x90'),_0x4c7b('0x91'),_0x4c7b('0x92'),'ticketnumber',_0x4c7b('0x93'),_0x4c7b('0x94'),_0x4c7b('0x95'),_0x4c7b('0x96'),'versionnumber'];var _0x2c1aa9=_0x216ffd[_0x4c7b('0x97')](_0x45a65f);return db[_0x4c7b('0x40')]['findOne']({'where':{'id':_0x3845f6[_0x4c7b('0x47')]['id']},'attributes':['id',_0x4c7b('0x98'),_0x4c7b('0x99'),_0x4c7b('0x9a'),'tenantId',_0x4c7b('0x9b'),'clientSecret']})[_0x4c7b('0x41')](handleEntityNotFound(_0x2333ee,null))[_0x4c7b('0x41')](function(_0x2717c2){if(_0x2717c2){_0xf0f7ae=_0x2717c2[_0x4c7b('0x9a')];var _0x4664dd=_0xf0f7ae[_0x4c7b('0x9c')](-0x1);if(_0x4664dd==='/'){_0xf0f7ae=_0xf0f7ae[_0x4c7b('0x9d')](0x0,_0xf0f7ae[_0x4c7b('0x9e')](_0x4664dd));}_0x170578=util[_0x4c7b('0x9f')](_0x4c7b('0xa0'),_0xf0f7ae);var _0x30f1b6={'method':'POST','uri':_0x4c7b('0xa1')+_0x2717c2[_0x4c7b('0xa2')]+'/oauth2/token','form':{'client_id':_0x2717c2[_0x4c7b('0x9b')],'resource':_0xf0f7ae,'username':_0x2717c2[_0x4c7b('0x98')],'password':_0x2717c2[_0x4c7b('0x99')],'grant_type':_0x4c7b('0x99'),'client_secret':_0x2717c2['clientSecret']},'json':!![]};return rp(_0x30f1b6);}})[_0x4c7b('0x41')](function(_0x307a48){_0x25d7ec=_0x307a48[_0x4c7b('0xa3')];var _0x494a8f={'method':_0x4c7b('0xa4'),'uri':encodeURI(_0x170578+_0x4c7b('0xa5')+_0xc1ce1f+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x25d7ec,'If-None-Match':null,'OData-Version':_0x4c7b('0xa6')},'json':!![]};return rp(_0x494a8f);})[_0x4c7b('0x41')](function(_0x2712f4){var _0x11ce2a=_0x2712f4[_0x4c7b('0xa7')][0x0];var _0x33c86d=_0x11ce2a[_0x4c7b('0xa8')];var _0x27d372={'method':_0x4c7b('0xa4'),'uri':_0x170578+'EntityDefinitions('+_0x33c86d+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x25d7ec,'If-None-Match':null,'OData-Version':_0x4c7b('0xa6')},'json':!![]};return rp(_0x27d372);})[_0x4c7b('0x41')](function(_0xa9ac59){_0x284e87=_0xa9ac59;_0x5bcfb3=_0x284e87[_0x4c7b('0xa9')];_0x5bcfb3=_[_0x4c7b('0xaa')](_0x5bcfb3,function(_0x3833a3){return!_0x2c1aa9[_0x4c7b('0xab')](_0x3833a3[_0x4c7b('0xac')]);});var _0x4a98b9=[];var _0x5d41c5=[];_0x5bcfb3[_0x4c7b('0xad')](function(_0x4c1864){if(_0x4c1864['@odata.type']){var _0x537074=_0x4c1864[_0x4c7b('0xae')]['substring'](_0x4c1864[_0x4c7b('0xae')]['lastIndexOf']('.')+0x1);if(_0x537074===_0x4c7b('0xaf')){_0x4a98b9[_0x4c7b('0xb0')](getSelectList(_0x170578,_0x5beda9,_0x5d41c5,_0x284e87[_0x4c7b('0xa8')],_0x4c1864[_0x4c7b('0xa8')],_0x25d7ec));}}});return Promise[_0x4c7b('0xb1')](_0x4a98b9);})[_0x4c7b('0x41')](function(_0x5b81aa){_0x3ded46=_0x5b81aa[0x0];var _0xadbdd0=[];var _0x206962=[];_0x5bcfb3[_0x4c7b('0xad')](function(_0x32be2f){if(!_['isNil'](_0x32be2f[_0x4c7b('0xae')])){var _0x816fb4=_0x32be2f['@odata.type'][_0x4c7b('0x9d')](_0x32be2f[_0x4c7b('0xae')]['lastIndexOf']('.')+0x1);if(_0x816fb4===_0x4c7b('0xb2')){_0xadbdd0[_0x4c7b('0xb0')](getBooleanList(_0x170578,_0x5beda9,_0x206962,_0x284e87[_0x4c7b('0xa8')],_0x32be2f[_0x4c7b('0xa8')],_0x25d7ec));}}});return Promise[_0x4c7b('0xb1')](_0xadbdd0);})['then'](function(_0x4f91c8){_0x39369c=_0x4f91c8[0x0];var _0xd4bbcc=[];var _0x4881d1=[];_0x5bcfb3['forEach'](function(_0x4596c8){if(_0x4596c8[_0x4c7b('0xae')]){var _0x19dbf7=_0x4596c8['@odata.type'][_0x4c7b('0x9d')](_0x4596c8['@odata.type']['lastIndexOf']('.')+0x1);if(_0x19dbf7===_0x4c7b('0xb3')||_0x19dbf7===_0x4c7b('0xb4')||_0x19dbf7===_0x4c7b('0xb5')||_0x19dbf7==='IntegerAttributeMetadata'||_0x19dbf7==='MemoAttributeMetadata'||_0x19dbf7==='DateTimeAttributeMetadata'||_0x19dbf7==='StatusAttributeMetadata'||_0x19dbf7==='EntityNameAttributeMetadata'||_0x19dbf7===_0x4c7b('0xb6')||_0x19dbf7==='DecimalAttributeMetadata'){_0xd4bbcc[_0x4c7b('0xb0')](getInputList(_0x170578,_0x5beda9,_0x19dbf7,_0x4881d1,_0x284e87[_0x4c7b('0xa8')],_0x4596c8[_0x4c7b('0xa8')],_0x25d7ec));}}});return Promise[_0x4c7b('0xb1')](_0xd4bbcc);})[_0x4c7b('0x41')](function(_0x1bb3c0){_0x3df6d3=_0x1bb3c0[0x0];var _0x4e644f=_0x3ded46[_0x4c7b('0x97')](_0x39369c)[_0x4c7b('0x97')](_0x3df6d3);var _0x41e2b0={'count':_0x4e644f[_0x4c7b('0x35')],'rows':_0x4e644f};return _0x41e2b0;})[_0x4c7b('0x41')](respondWithResult(_0x2333ee,null))['catch'](function(_0x53adef){var _0x24cf06=_0x3845f6['query'][_0x4c7b('0xb7')]?0x1f4:_0x53adef[_0x4c7b('0xb8')]||0x1f4;logger[_0x4c7b('0x24')](_0x53adef[_0x4c7b('0x25')]);delete _0x53adef[_0x4c7b('0x26')];if(_0x24cf06===0x191){_0x24cf06=0x190;}_0x2333ee[_0x4c7b('0x1a')](_0x24cf06)[_0x4c7b('0x27')](_0x3845f6[_0x4c7b('0x2e')]['test']?{'message':_0x4c7b('0xb9'),'statusCode':_0x53adef[_0x4c7b('0xb8')]}:_0x53adef);});};function getSelectList(_0x2010d9,_0xe495a9,_0x2ac711,_0x3480ee,_0x260d09,_0x502cfa){var _0x278a58={'method':_0x4c7b('0xa4'),'uri':_0x2010d9+_0x4c7b('0xba')+_0x3480ee+_0x4c7b('0xbb')+_0x260d09+_0x4c7b('0xbc')+_0x4c7b('0xbd'),'headers':{'Authorization':_0x4c7b('0xbe')+_0x502cfa,'If-None-Match':null,'OData-Version':_0x4c7b('0xa6')},'json':!![]};return rp(_0x278a58)[_0x4c7b('0x41')](function(_0x4a224a){var _0x5b7329=[];var _0x278e99=_0x4a224a[_0x4c7b('0xbf')][_0x4c7b('0xc0')];_0x278e99[_0x4c7b('0xad')](function(_0x2e028c){_0x5b7329[_0x4c7b('0xb0')]({'name':_0x2e028c[_0x4c7b('0xc1')][_0x4c7b('0xc2')][_0x4c7b('0xc1')],'value':String(_0x2e028c[_0x4c7b('0xc3')])});});var _0x2fb6fb={'id':_0xe495a9+'_'+_0x4a224a[_0x4c7b('0xac')],'name':_0x4a224a[_0x4c7b('0xc4')][_0x4c7b('0xc2')][_0x4c7b('0xc1')],'custom':![],'options':_0x5b7329};_0x2ac711[_0x4c7b('0xb0')](_0x2fb6fb);return _0x2ac711;});}function getBooleanList(_0x2bb654,_0x9b579d,_0x23c78c,_0x3948de,_0x4d4741,_0x109258){var _0x289c5d={'method':_0x4c7b('0xa4'),'uri':_0x2bb654+_0x4c7b('0xba')+_0x3948de+_0x4c7b('0xbb')+_0x4d4741+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x4c7b('0xbe')+_0x109258,'If-None-Match':null,'OData-Version':_0x4c7b('0xa6')},'json':!![]};return rp(_0x289c5d)[_0x4c7b('0x41')](function(_0x33d9cc){var _0x4ffb6b=[];_0x4ffb6b[_0x4c7b('0xb0')]({'name':_0x33d9cc[_0x4c7b('0xbf')]['TrueOption']['Label'][_0x4c7b('0xc2')]['Label'],'value':'true'},{'name':_0x33d9cc[_0x4c7b('0xbf')]['FalseOption']['Label'][_0x4c7b('0xc2')][_0x4c7b('0xc1')],'value':_0x4c7b('0xc5')});var _0x24c327={'id':_0x9b579d+'_'+_0x33d9cc[_0x4c7b('0xac')],'name':_0x33d9cc['DisplayName']['UserLocalizedLabel']['Label'],'custom':![],'options':_0x4ffb6b};_0x23c78c['push'](_0x24c327);return _0x23c78c;});}function getInputList(_0x3c36cc,_0x4b345c,_0x36658c,_0x387bdc,_0xf950f4,_0x125196,_0x3e1114){var _0x22e6c6={'method':_0x4c7b('0xa4'),'uri':_0x3c36cc+'EntityDefinitions('+_0xf950f4+_0x4c7b('0xbb')+_0x125196+_0x4c7b('0xc6')+_0x36658c+_0x4c7b('0xc7'),'headers':{'Authorization':_0x4c7b('0xbe')+_0x3e1114,'If-None-Match':null,'OData-Version':_0x4c7b('0xa6')},'json':!![]};return rp(_0x22e6c6)['then'](function(_0x185c13){var _0x20e93d={'id':_0x4b345c+'_'+_0x185c13[_0x4c7b('0xac')],'name':_0x185c13['DisplayName']['UserLocalizedLabel']?_0x185c13[_0x4c7b('0xc4')][_0x4c7b('0xc2')][_0x4c7b('0xc1')]:_0x185c13[_0x4c7b('0xac')],'custom':![],'options':[]};_0x387bdc['push'](_0x20e93d);return _0x387bdc;});} \ No newline at end of file +var _0xd6d6=['bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','pick','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','Incident','PhoneCall','description','ownerid','subject','phonenumber','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdon','createdonbehalfbyyominame','customeridname','customeridtype','entitlementidname','entityimage_timestamp','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','owneridname','owneridtype','owneridyominame','parentcaseidname','prioritycodename','productidname','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','socialprofileidname','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientSecret','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','Bearer\x20','TrueOption','true','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','moment'];(function(_0x1004f6,_0x189d39){var _0x729258=function(_0x634303){while(--_0x634303){_0x1004f6['push'](_0x1004f6['shift']());}};_0x729258(++_0x189d39);}(_0xd6d6,0xbe));var _0x6d6d=function(_0xebac57,_0x280e6f){_0xebac57=_0xebac57-0x0;var _0xef1989=_0xd6d6[_0xebac57];return _0xef1989;};'use strict';var emlformat=require(_0x6d6d('0x0'));var rimraf=require(_0x6d6d('0x1'));var zipdir=require(_0x6d6d('0x2'));var jsonpatch=require(_0x6d6d('0x3'));var rp=require('request-promise');var moment=require(_0x6d6d('0x4'));var BPromise=require(_0x6d6d('0x5'));var Mustache=require(_0x6d6d('0x6'));var util=require(_0x6d6d('0x7'));var path=require(_0x6d6d('0x8'));var sox=require(_0x6d6d('0x9'));var csv=require(_0x6d6d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d6d('0xb'));var _=require(_0x6d6d('0xc'));var squel=require(_0x6d6d('0xd'));var crypto=require(_0x6d6d('0xe'));var jsforce=require(_0x6d6d('0xf'));var deskjs=require(_0x6d6d('0x10'));var toCsv=require(_0x6d6d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d6d('0x11'));var authService=require(_0x6d6d('0x12'));var qs=require(_0x6d6d('0x13'));var as=require(_0x6d6d('0x14'));var hardwareService=require(_0x6d6d('0x15'));var logger=require('../../config/logger')(_0x6d6d('0x16'));var utils=require(_0x6d6d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6d6d('0x18'))['db'];var integrations=require(_0x6d6d('0x19'));function respondWithStatusCode(_0xe61c36,_0x3f8542){_0x3f8542=_0x3f8542||0xcc;return function(_0x2b74ed){if(_0x2b74ed){return _0xe61c36[_0x6d6d('0x1a')](_0x3f8542);}return _0xe61c36[_0x6d6d('0x1b')](_0x3f8542)[_0x6d6d('0x1c')]();};}function respondWithResult(_0x5f4154,_0xd09ea7){_0xd09ea7=_0xd09ea7||0xc8;return function(_0x3dd4b3){if(_0x3dd4b3){return _0x5f4154[_0x6d6d('0x1b')](_0xd09ea7)[_0x6d6d('0x1d')](_0x3dd4b3);}};}function respondWithFilteredResult(_0x29cbd8,_0x5d80c0){return function(_0x2e6fdb){if(_0x2e6fdb){var _0x587338=typeof _0x5d80c0[_0x6d6d('0x1e')]===_0x6d6d('0x1f')&&typeof _0x5d80c0[_0x6d6d('0x20')]==='undefined';var _0x499c2e=_0x2e6fdb[_0x6d6d('0x21')];var _0x1a75d8=_0x587338?0x0:_0x5d80c0[_0x6d6d('0x1e')];var _0x2c5314=_0x587338?_0x2e6fdb['count']:_0x5d80c0['offset']+_0x5d80c0[_0x6d6d('0x20')];var _0x5a5855;if(_0x2c5314>=_0x499c2e){_0x2c5314=_0x499c2e;_0x5a5855=0xc8;}else{_0x5a5855=0xce;}_0x29cbd8[_0x6d6d('0x1b')](_0x5a5855);return _0x29cbd8[_0x6d6d('0x22')](_0x6d6d('0x23'),_0x1a75d8+'-'+_0x2c5314+'/'+_0x499c2e)[_0x6d6d('0x1d')](_0x2e6fdb);}return null;};}function patchUpdates(_0x40d35b){return function(_0x3242d8){try{jsonpatch[_0x6d6d('0x24')](_0x3242d8,_0x40d35b,!![]);}catch(_0x230ad7){return BPromise[_0x6d6d('0x25')](_0x230ad7);}return _0x3242d8[_0x6d6d('0x26')]();};}function saveUpdates(_0x24b10d,_0x6e58e3){return function(_0x466a29){if(_0x466a29){return _0x466a29[_0x6d6d('0x27')](_0x24b10d)[_0x6d6d('0x28')](function(_0x25a02e){return _0x25a02e;});}return null;};}function removeEntity(_0xced622,_0x583b10){return function(_0x3b73e5){if(_0x3b73e5){return _0x3b73e5[_0x6d6d('0x29')]()[_0x6d6d('0x28')](function(){_0xced622[_0x6d6d('0x1b')](0xcc)[_0x6d6d('0x1c')]();});}};}function handleEntityNotFound(_0x12fab2,_0x554f8e){return function(_0x2851dd){if(!_0x2851dd){_0x12fab2[_0x6d6d('0x1a')](0x194);}return _0x2851dd;};}function handleError(_0x235451,_0x126ac8){_0x126ac8=_0x126ac8||0x1f4;return function(_0x25c121){logger[_0x6d6d('0x2a')](_0x25c121[_0x6d6d('0x2b')]);if(_0x25c121['name']){delete _0x25c121[_0x6d6d('0x2c')];}_0x235451[_0x6d6d('0x1b')](_0x126ac8)['send'](_0x25c121);};}exports['index']=function(_0x3edcce,_0x5273cd){var _0x8a9a84={},_0x57341f={},_0xde3272={'count':0x0,'rows':[]};var _0x20255e=_[_0x6d6d('0x2d')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')],function(_0x428c17){return{'name':_0x428c17[_0x6d6d('0x30')],'type':_0x428c17[_0x6d6d('0x31')][_0x6d6d('0x32')]};});_0x57341f[_0x6d6d('0x33')]=_['map'](_0x20255e,_0x6d6d('0x2c'));_0x57341f['query']=_[_0x6d6d('0x34')](_0x3edcce[_0x6d6d('0x35')]);_0x57341f[_0x6d6d('0x36')]=_[_0x6d6d('0x37')](_0x57341f['model'],_0x57341f[_0x6d6d('0x35')]);_0x8a9a84['attributes']=_[_0x6d6d('0x37')](_0x57341f[_0x6d6d('0x33')],qs['fields'](_0x3edcce[_0x6d6d('0x35')][_0x6d6d('0x38')]));_0x8a9a84[_0x6d6d('0x39')]=_0x8a9a84[_0x6d6d('0x39')][_0x6d6d('0x3a')]?_0x8a9a84[_0x6d6d('0x39')]:_0x57341f[_0x6d6d('0x33')];if(!_0x3edcce[_0x6d6d('0x35')][_0x6d6d('0x3b')](_0x6d6d('0x3c'))){_0x8a9a84[_0x6d6d('0x20')]=qs[_0x6d6d('0x20')](_0x3edcce[_0x6d6d('0x35')][_0x6d6d('0x20')]);_0x8a9a84['offset']=qs[_0x6d6d('0x1e')](_0x3edcce[_0x6d6d('0x35')][_0x6d6d('0x1e')]);}_0x8a9a84[_0x6d6d('0x3d')]=qs['sort'](_0x3edcce['query'][_0x6d6d('0x3e')]);_0x8a9a84[_0x6d6d('0x3f')]=qs[_0x6d6d('0x36')](_['pick'](_0x3edcce[_0x6d6d('0x35')],_0x57341f[_0x6d6d('0x36')]),_0x20255e);if(_0x3edcce[_0x6d6d('0x35')][_0x6d6d('0x40')]){_0x8a9a84['where']=_['merge'](_0x8a9a84['where'],{'$or':_[_0x6d6d('0x2d')](_0x20255e,function(_0x4196f0){if(_0x4196f0[_0x6d6d('0x31')]!==_0x6d6d('0x41')){var _0x4e918b={};_0x4e918b[_0x4196f0[_0x6d6d('0x2c')]]={'$like':'%'+_0x3edcce[_0x6d6d('0x35')][_0x6d6d('0x40')]+'%'};return _0x4e918b;}})});}_0x8a9a84=_[_0x6d6d('0x42')]({},_0x8a9a84,_0x3edcce[_0x6d6d('0x43')]);var _0x38ae8c={'where':_0x8a9a84['where']};return db[_0x6d6d('0x2e')][_0x6d6d('0x21')](_0x38ae8c)[_0x6d6d('0x28')](function(_0x1f4160){_0xde3272[_0x6d6d('0x21')]=_0x1f4160;if(_0x3edcce[_0x6d6d('0x35')][_0x6d6d('0x44')]){_0x8a9a84['include']=[{'all':!![]}];}return db[_0x6d6d('0x2e')][_0x6d6d('0x45')](_0x8a9a84);})[_0x6d6d('0x28')](function(_0x2107e0){_0xde3272[_0x6d6d('0x46')]=_0x2107e0;return _0xde3272;})['then'](respondWithFilteredResult(_0x5273cd,_0x8a9a84))[_0x6d6d('0x47')](handleError(_0x5273cd,null));};exports[_0x6d6d('0x48')]=function(_0x55dba8,_0x452de2){var _0x50dc17={'raw':![],'where':{'id':_0x55dba8[_0x6d6d('0x49')]['id']}},_0x15bf62={};_0x15bf62['model']=_[_0x6d6d('0x34')](db[_0x6d6d('0x2e')][_0x6d6d('0x2f')]);_0x15bf62[_0x6d6d('0x35')]=_[_0x6d6d('0x34')](_0x55dba8['query']);_0x15bf62['filters']=_[_0x6d6d('0x37')](_0x15bf62['model'],_0x15bf62['query']);_0x50dc17[_0x6d6d('0x39')]=_[_0x6d6d('0x37')](_0x15bf62[_0x6d6d('0x33')],qs['fields'](_0x55dba8[_0x6d6d('0x35')]['fields']));_0x50dc17[_0x6d6d('0x39')]=_0x50dc17[_0x6d6d('0x39')][_0x6d6d('0x3a')]?_0x50dc17[_0x6d6d('0x39')]:_0x15bf62[_0x6d6d('0x33')];if(_0x55dba8[_0x6d6d('0x35')][_0x6d6d('0x44')]){_0x50dc17['include']=[{'all':!![]}];}_0x50dc17=_[_0x6d6d('0x42')]({},_0x50dc17,_0x55dba8[_0x6d6d('0x43')]);return db[_0x6d6d('0x2e')][_0x6d6d('0x4a')](_0x50dc17)[_0x6d6d('0x28')](handleEntityNotFound(_0x452de2,null))[_0x6d6d('0x28')](respondWithResult(_0x452de2,null))[_0x6d6d('0x47')](handleError(_0x452de2,null));};exports[_0x6d6d('0x4b')]=function(_0x24cec2,_0x5e4c04){return db['Dynamics365Account'][_0x6d6d('0x4b')](_0x24cec2[_0x6d6d('0x4c')],{})[_0x6d6d('0x28')](respondWithResult(_0x5e4c04,0xc9))[_0x6d6d('0x47')](handleError(_0x5e4c04,null));};exports[_0x6d6d('0x27')]=function(_0x492834,_0x47170d){if(_0x492834[_0x6d6d('0x4c')]['id']){delete _0x492834[_0x6d6d('0x4c')]['id'];}return db[_0x6d6d('0x2e')][_0x6d6d('0x4a')]({'where':{'id':_0x492834[_0x6d6d('0x49')]['id']}})[_0x6d6d('0x28')](handleEntityNotFound(_0x47170d,null))[_0x6d6d('0x28')](saveUpdates(_0x492834[_0x6d6d('0x4c')],null))[_0x6d6d('0x28')](respondWithResult(_0x47170d,null))[_0x6d6d('0x47')](handleError(_0x47170d,null));};exports[_0x6d6d('0x29')]=function(_0x4d9811,_0x190786){return db[_0x6d6d('0x2e')][_0x6d6d('0x4a')]({'where':{'id':_0x4d9811[_0x6d6d('0x49')]['id']}})[_0x6d6d('0x28')](handleEntityNotFound(_0x190786,null))['then'](removeEntity(_0x190786,null))[_0x6d6d('0x47')](handleError(_0x190786,null));};exports[_0x6d6d('0x4d')]=function(_0x45340b,_0x4e4c3e,_0x577f01){var _0x7e984c={};var _0x50042e={};var _0x3ea57e;var _0x995fe2;return db[_0x6d6d('0x2e')][_0x6d6d('0x4e')]({'where':{'id':_0x45340b[_0x6d6d('0x49')]['id']}})[_0x6d6d('0x28')](handleEntityNotFound(_0x4e4c3e,null))[_0x6d6d('0x28')](function(_0x26c23a){if(_0x26c23a){_0x3ea57e=_0x26c23a;_0x50042e[_0x6d6d('0x33')]=_[_0x6d6d('0x34')](db['Dynamics365Configuration'][_0x6d6d('0x2f')]);_0x50042e[_0x6d6d('0x35')]=_[_0x6d6d('0x34')](_0x45340b[_0x6d6d('0x35')]);_0x50042e[_0x6d6d('0x36')]=_[_0x6d6d('0x37')](_0x50042e[_0x6d6d('0x33')],_0x50042e['query']);_0x7e984c['attributes']=_[_0x6d6d('0x37')](_0x50042e[_0x6d6d('0x33')],qs['fields'](_0x45340b[_0x6d6d('0x35')][_0x6d6d('0x38')]));_0x7e984c[_0x6d6d('0x39')]=_0x7e984c[_0x6d6d('0x39')][_0x6d6d('0x3a')]?_0x7e984c[_0x6d6d('0x39')]:_0x50042e[_0x6d6d('0x33')];_0x7e984c[_0x6d6d('0x3d')]=qs[_0x6d6d('0x3e')](_0x45340b[_0x6d6d('0x35')][_0x6d6d('0x3e')]);_0x7e984c[_0x6d6d('0x3f')]=qs[_0x6d6d('0x36')](_[_0x6d6d('0x4f')](_0x45340b[_0x6d6d('0x35')],_0x50042e['filters']));if(_0x45340b[_0x6d6d('0x35')][_0x6d6d('0x40')]){_0x7e984c['where']=_[_0x6d6d('0x42')](_0x7e984c[_0x6d6d('0x3f')],{'$or':_[_0x6d6d('0x2d')](_0x7e984c[_0x6d6d('0x39')],function(_0x2d61cc){var _0xd0a573={};_0xd0a573[_0x2d61cc]={'$like':'%'+_0x45340b[_0x6d6d('0x35')][_0x6d6d('0x40')]+'%'};return _0xd0a573;})});}_0x7e984c=_[_0x6d6d('0x42')]({},_0x7e984c,_0x45340b['options']);return _0x3ea57e['getConfigurations'](_0x7e984c);}})[_0x6d6d('0x28')](function(_0x325fe2){if(_0x325fe2){_0x995fe2=_0x325fe2[_0x6d6d('0x3a')];if(!_0x45340b['query']['hasOwnProperty'](_0x6d6d('0x3c'))){_0x7e984c['limit']=qs[_0x6d6d('0x20')](_0x45340b['query'][_0x6d6d('0x20')]);_0x7e984c[_0x6d6d('0x1e')]=qs[_0x6d6d('0x1e')](_0x45340b[_0x6d6d('0x35')][_0x6d6d('0x1e')]);}return _0x3ea57e[_0x6d6d('0x4d')](_0x7e984c);}})['then'](function(_0x41e576){if(_0x41e576){return _0x41e576?{'count':_0x995fe2,'rows':_0x41e576}:null;}})['then'](respondWithResult(_0x4e4c3e,null))[_0x6d6d('0x47')](handleError(_0x4e4c3e,null));};exports['addConfiguration']=function(_0x2a21d8,_0x3e48f7,_0x2e9945){if(_0x2a21d8[_0x6d6d('0x4c')]['id']){delete _0x2a21d8[_0x6d6d('0x4c')]['id'];}return db[_0x6d6d('0x2e')][_0x6d6d('0x4e')]({'where':{'id':_0x2a21d8['params']['id']}})['then'](handleEntityNotFound(_0x3e48f7,null))[_0x6d6d('0x28')](function(_0x582380){if(_0x582380){_0x2a21d8[_0x6d6d('0x4c')]['AccountId']=_0x582380['id'];_0x2a21d8[_0x6d6d('0x4c')][_0x6d6d('0x50')]=integrations[_0x6d6d('0x51')](_0x2a21d8[_0x6d6d('0x4c')][_0x6d6d('0x52')],_0x2a21d8[_0x6d6d('0x4c')]['type']);_0x2a21d8[_0x6d6d('0x4c')][_0x6d6d('0x53')]=integrations[_0x6d6d('0x54')](_0x2a21d8[_0x6d6d('0x4c')][_0x6d6d('0x52')],_0x2a21d8[_0x6d6d('0x4c')][_0x6d6d('0x31')]);return db['Dynamics365Configuration'][_0x6d6d('0x4b')](_0x2a21d8[_0x6d6d('0x4c')],{'include':[{'model':db[_0x6d6d('0x55')],'as':_0x6d6d('0x50')},{'model':db[_0x6d6d('0x55')],'as':_0x6d6d('0x53')}]});}return null;})[_0x6d6d('0x28')](respondWithResult(_0x3e48f7,null))[_0x6d6d('0x47')](handleError(_0x3e48f7,null));};exports[_0x6d6d('0x56')]=function(_0x32e3bb,_0x1efc55,_0x4ea594){var _0x488b2f=_0x32e3bb[_0x6d6d('0x35')]['ticketType'];var _0x4a61f8=_0x488b2f==='incident'?_0x6d6d('0x57'):_0x6d6d('0x58');var _0x4d11e9='';var _0x9f2647='';var _0x2d4a04='';var _0x258b71='';var _0x4d4083='';var _0x48472d='';var _0x35b35c='';var _0x560090='';var _0x4c216f=['title',_0x6d6d('0x59'),'customerid',_0x6d6d('0x5a'),'caseorigincode',_0x6d6d('0x5b'),_0x6d6d('0x5c'),'regardingobjectid','directioncode',_0x6d6d('0x5d')];var _0x202bf6=[_0x6d6d('0x5e'),_0x6d6d('0x5f'),'actualserviceunits',_0x6d6d('0x60'),_0x6d6d('0x61'),_0x6d6d('0x62'),_0x6d6d('0x63'),'contractidname',_0x6d6d('0x64'),'createdbyexternalpartyyominame','createdbyname','createdbyyominame',_0x6d6d('0x65'),'createdonbehalfbyname',_0x6d6d('0x66'),_0x6d6d('0x67'),_0x6d6d('0x68'),'customeridyominame','emailaddress',_0x6d6d('0x69'),_0x6d6d('0x6a'),'entityimage_url','escalatedon',_0x6d6d('0x6b'),_0x6d6d('0x6c'),_0x6d6d('0x6d'),_0x6d6d('0x6e'),_0x6d6d('0x6f'),_0x6d6d('0x70'),_0x6d6d('0x71'),'masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon',_0x6d6d('0x72'),_0x6d6d('0x73'),_0x6d6d('0x74'),_0x6d6d('0x75'),'numberofchildincidents','onholdtime','overriddencreatedon',_0x6d6d('0x76'),_0x6d6d('0x77'),_0x6d6d('0x78'),_0x6d6d('0x79'),'primarycontactidname','primarycontactidyominame',_0x6d6d('0x7a'),_0x6d6d('0x7b'),'productserialnumber',_0x6d6d('0x7c'),_0x6d6d('0x7d'),_0x6d6d('0x7e'),_0x6d6d('0x7f'),_0x6d6d('0x80'),'sentimentvalue',_0x6d6d('0x81'),'slaname',_0x6d6d('0x82'),'statecode',_0x6d6d('0x83'),'subjectidname',_0x6d6d('0x84'),_0x6d6d('0x85'),_0x6d6d('0x86'),_0x6d6d('0x87'),_0x6d6d('0x88'),_0x6d6d('0x89')];var _0x1fb2b3=_0x4c216f[_0x6d6d('0x8a')](_0x202bf6);return db[_0x6d6d('0x2e')][_0x6d6d('0x4e')]({'where':{'id':_0x32e3bb[_0x6d6d('0x49')]['id']},'attributes':['id',_0x6d6d('0x8b'),_0x6d6d('0x8c'),_0x6d6d('0x8d'),_0x6d6d('0x8e'),_0x6d6d('0x8f'),'clientSecret']})['then'](handleEntityNotFound(_0x1efc55,null))[_0x6d6d('0x28')](function(_0x5a7b23){if(_0x5a7b23){_0x560090=_0x5a7b23[_0x6d6d('0x8d')];var _0x4ff2b3=_0x560090['slice'](-0x1);if(_0x4ff2b3==='/'){_0x560090=_0x560090['substring'](0x0,_0x560090[_0x6d6d('0x90')](_0x4ff2b3));}_0x35b35c=util['format'](_0x6d6d('0x91'),_0x560090);var _0x285307={'method':_0x6d6d('0x92'),'uri':_0x6d6d('0x93')+_0x5a7b23[_0x6d6d('0x8e')]+_0x6d6d('0x94'),'form':{'client_id':_0x5a7b23[_0x6d6d('0x8f')],'resource':_0x560090,'username':_0x5a7b23[_0x6d6d('0x8b')],'password':_0x5a7b23['password'],'grant_type':_0x6d6d('0x8c'),'client_secret':_0x5a7b23[_0x6d6d('0x95')]},'json':!![]};return rp(_0x285307);}})[_0x6d6d('0x28')](function(_0x51c1df){_0x48472d=_0x51c1df['access_token'];var _0x1fa0c3={'method':_0x6d6d('0x96'),'uri':encodeURI(_0x35b35c+_0x6d6d('0x97')+_0x4a61f8+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x48472d,'If-None-Match':null,'OData-Version':_0x6d6d('0x98')},'json':!![]};return rp(_0x1fa0c3);})[_0x6d6d('0x28')](function(_0x5d7bd1){var _0x1ba12e=_0x5d7bd1[_0x6d6d('0x99')][0x0];var _0xa8ec98=_0x1ba12e[_0x6d6d('0x9a')];var _0x21057d={'method':'GET','uri':_0x35b35c+_0x6d6d('0x9b')+_0xa8ec98+_0x6d6d('0x9c'),'headers':{'Authorization':'Bearer\x20'+_0x48472d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x21057d);})[_0x6d6d('0x28')](function(_0x34ee95){_0x4d11e9=_0x34ee95;_0x9f2647=_0x4d11e9[_0x6d6d('0x9d')];_0x9f2647=_[_0x6d6d('0x9e')](_0x9f2647,function(_0x5a8974){return!_0x1fb2b3[_0x6d6d('0x9f')](_0x5a8974['LogicalName']);});var _0x2b8c92=[];var _0x330365=[];_0x9f2647[_0x6d6d('0xa0')](function(_0x46a8fd){if(_0x46a8fd[_0x6d6d('0xa1')]){var _0x306559=_0x46a8fd[_0x6d6d('0xa1')][_0x6d6d('0xa2')](_0x46a8fd[_0x6d6d('0xa1')][_0x6d6d('0x90')]('.')+0x1);if(_0x306559===_0x6d6d('0xa3')){_0x2b8c92[_0x6d6d('0xa4')](getSelectList(_0x35b35c,_0x488b2f,_0x330365,_0x4d11e9[_0x6d6d('0x9a')],_0x46a8fd[_0x6d6d('0x9a')],_0x48472d));}}});return Promise[_0x6d6d('0xa5')](_0x2b8c92);})[_0x6d6d('0x28')](function(_0x34bec0){_0x2d4a04=_0x34bec0[0x0];var _0xccbc07=[];var _0x1e1d03=[];_0x9f2647[_0x6d6d('0xa0')](function(_0x527c11){if(!_['isNil'](_0x527c11[_0x6d6d('0xa1')])){var _0x180648=_0x527c11[_0x6d6d('0xa1')][_0x6d6d('0xa2')](_0x527c11[_0x6d6d('0xa1')][_0x6d6d('0x90')]('.')+0x1);if(_0x180648===_0x6d6d('0xa6')){_0xccbc07[_0x6d6d('0xa4')](getBooleanList(_0x35b35c,_0x488b2f,_0x1e1d03,_0x4d11e9[_0x6d6d('0x9a')],_0x527c11[_0x6d6d('0x9a')],_0x48472d));}}});return Promise[_0x6d6d('0xa5')](_0xccbc07);})[_0x6d6d('0x28')](function(_0x4512fb){_0x258b71=_0x4512fb[0x0];var _0x304086=[];var _0x37319b=[];_0x9f2647['forEach'](function(_0x146e48){if(_0x146e48[_0x6d6d('0xa1')]){var _0x20a793=_0x146e48['@odata.type']['substring'](_0x146e48['@odata.type'][_0x6d6d('0x90')]('.')+0x1);if(_0x20a793==='StringAttributeMetadata'||_0x20a793==='DoubleAttributeMetadata'||_0x20a793===_0x6d6d('0xa7')||_0x20a793===_0x6d6d('0xa8')||_0x20a793===_0x6d6d('0xa9')||_0x20a793===_0x6d6d('0xaa')||_0x20a793===_0x6d6d('0xab')||_0x20a793==='EntityNameAttributeMetadata'||_0x20a793===_0x6d6d('0xac')||_0x20a793===_0x6d6d('0xad')){_0x304086[_0x6d6d('0xa4')](getInputList(_0x35b35c,_0x488b2f,_0x20a793,_0x37319b,_0x4d11e9[_0x6d6d('0x9a')],_0x146e48[_0x6d6d('0x9a')],_0x48472d));}}});return Promise['all'](_0x304086);})[_0x6d6d('0x28')](function(_0x563f92){_0x4d4083=_0x563f92[0x0];var _0x476869=_0x2d4a04['concat'](_0x258b71)[_0x6d6d('0x8a')](_0x4d4083);var _0x49bb3a={'count':_0x476869[_0x6d6d('0x3a')],'rows':_0x476869};return _0x49bb3a;})['then'](respondWithResult(_0x1efc55,null))[_0x6d6d('0x47')](function(_0x461407){var _0x5d3f77=_0x32e3bb[_0x6d6d('0x35')][_0x6d6d('0xae')]?0x1f4:_0x461407[_0x6d6d('0xaf')]||0x1f4;logger[_0x6d6d('0x2a')](_0x461407[_0x6d6d('0x2b')]);delete _0x461407[_0x6d6d('0x2c')];if(_0x5d3f77===0x191){_0x5d3f77=0x190;}_0x1efc55['status'](_0x5d3f77)[_0x6d6d('0xb0')](_0x32e3bb[_0x6d6d('0x35')]['test']?{'message':_0x6d6d('0xb1'),'statusCode':_0x461407[_0x6d6d('0xaf')]}:_0x461407);});};function getSelectList(_0x313267,_0x30aaf1,_0x235f13,_0x5b21ae,_0x4d25bc,_0x224749){var _0xecc6fb={'method':_0x6d6d('0x96'),'uri':_0x313267+_0x6d6d('0x9b')+_0x5b21ae+_0x6d6d('0xb2')+_0x4d25bc+_0x6d6d('0xb3')+_0x6d6d('0xb4'),'headers':{'Authorization':'Bearer\x20'+_0x224749,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xecc6fb)[_0x6d6d('0x28')](function(_0x1c1b4d){var _0x4b107d=[];var _0x163b55=_0x1c1b4d[_0x6d6d('0xb5')][_0x6d6d('0xb6')];_0x163b55[_0x6d6d('0xa0')](function(_0x41f0c4){_0x4b107d['push']({'name':_0x41f0c4[_0x6d6d('0xb7')][_0x6d6d('0xb8')][_0x6d6d('0xb7')],'value':String(_0x41f0c4[_0x6d6d('0xb9')])});});var _0x2e99ef={'id':_0x30aaf1+'_'+_0x1c1b4d[_0x6d6d('0xba')],'name':_0x1c1b4d['DisplayName'][_0x6d6d('0xb8')][_0x6d6d('0xb7')],'custom':![],'options':_0x4b107d};_0x235f13[_0x6d6d('0xa4')](_0x2e99ef);return _0x235f13;});}function getBooleanList(_0x2bfe83,_0x1c03ad,_0x424450,_0x128388,_0x119634,_0x15d92c){var _0x272696={'method':_0x6d6d('0x96'),'uri':_0x2bfe83+_0x6d6d('0x9b')+_0x128388+_0x6d6d('0xb2')+_0x119634+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0x6d6d('0xbb')+_0x15d92c,'If-None-Match':null,'OData-Version':_0x6d6d('0x98')},'json':!![]};return rp(_0x272696)[_0x6d6d('0x28')](function(_0x26f094){var _0x5bc397=[];_0x5bc397[_0x6d6d('0xa4')]({'name':_0x26f094[_0x6d6d('0xb5')][_0x6d6d('0xbc')][_0x6d6d('0xb7')][_0x6d6d('0xb8')]['Label'],'value':_0x6d6d('0xbd')},{'name':_0x26f094[_0x6d6d('0xb5')][_0x6d6d('0xbe')][_0x6d6d('0xb7')]['UserLocalizedLabel'][_0x6d6d('0xb7')],'value':_0x6d6d('0xbf')});var _0x217147={'id':_0x1c03ad+'_'+_0x26f094[_0x6d6d('0xba')],'name':_0x26f094[_0x6d6d('0xc0')][_0x6d6d('0xb8')][_0x6d6d('0xb7')],'custom':![],'options':_0x5bc397};_0x424450[_0x6d6d('0xa4')](_0x217147);return _0x424450;});}function getInputList(_0x139179,_0x253658,_0x265cf5,_0x792769,_0x2f9e16,_0x20a4b6,_0x12fcae){var _0x5b292d={'method':_0x6d6d('0x96'),'uri':_0x139179+_0x6d6d('0x9b')+_0x2f9e16+')/Attributes('+_0x20a4b6+_0x6d6d('0xc1')+_0x265cf5+_0x6d6d('0xc2'),'headers':{'Authorization':_0x6d6d('0xbb')+_0x12fcae,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5b292d)[_0x6d6d('0x28')](function(_0x40fac2){var _0x336a80={'id':_0x253658+'_'+_0x40fac2[_0x6d6d('0xba')],'name':_0x40fac2[_0x6d6d('0xc0')][_0x6d6d('0xb8')]?_0x40fac2[_0x6d6d('0xc0')][_0x6d6d('0xb8')][_0x6d6d('0xb7')]:_0x40fac2[_0x6d6d('0xba')],'custom':![],'options':[]};_0x792769['push'](_0x336a80);return _0x792769;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index bb60421..43f30d5 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(_0x31e2a8,_0x53b684){var _0x1c8fb2=function(_0x333dbd){while(--_0x333dbd){_0x31e2a8['push'](_0x31e2a8['shift']());}};_0x1c8fb2(++_0x53b684);}(_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('./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(_0x25c326,_0x250137){var _0x762452=function(_0x50ce5e){while(--_0x50ce5e){_0x25c326['push'](_0x25c326['shift']());}};_0x762452(++_0x250137);}(_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 0638709..d8b23b9 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 _0x9a0c=['Dynamics365Account,\x20%s,\x20%s','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','include','map','model','catch','ShowDynamics365Account','debug','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3a5042,_0x3476a7){var _0x104ba2=function(_0x277b29){while(--_0x277b29){_0x3a5042['push'](_0x3a5042['shift']());}};_0x104ba2(++_0x3476a7);}(_0x9a0c,0x173));var _0xc9a0=function(_0x12dec1,_0x4769a8){_0x12dec1=_0x12dec1-0x0;var _0x402464=_0x9a0c[_0x12dec1];return _0x402464;};'use strict';var _=require(_0xc9a0('0x0'));var util=require(_0xc9a0('0x1'));var moment=require('moment');var BPromise=require(_0xc9a0('0x2'));var rs=require(_0xc9a0('0x3'));var fs=require('fs');var Redis=require(_0xc9a0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9a0('0x5'));var logger=require('../../config/logger')(_0xc9a0('0x6'));var config=require(_0xc9a0('0x7'));var jayson=require(_0xc9a0('0x8'));var client=jayson[_0xc9a0('0x9')][_0xc9a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ce491,_0x3560e3,_0x5c68cf){return new BPromise(function(_0xf8cc52,_0x473ba0){return client[_0xc9a0('0xb')](_0x4ce491,_0x5c68cf)[_0xc9a0('0xc')](function(_0x178b74){logger[_0xc9a0('0xd')](_0xc9a0('0xe'),_0x3560e3,'request\x20sent');logger['debug'](_0xc9a0('0xf'),_0x3560e3,_0xc9a0('0x10'),JSON[_0xc9a0('0x11')](_0x178b74));if(_0x178b74['error']){if(_0x178b74['error'][_0xc9a0('0x12')]===0x1f4){logger['error'](_0xc9a0('0xe'),_0x3560e3,_0x178b74[_0xc9a0('0x13')][_0xc9a0('0x14')]);return _0x473ba0(_0x178b74[_0xc9a0('0x13')][_0xc9a0('0x14')]);}logger[_0xc9a0('0x13')](_0xc9a0('0xe'),_0x3560e3,_0x178b74[_0xc9a0('0x13')][_0xc9a0('0x14')]);return _0xf8cc52(_0x178b74[_0xc9a0('0x13')][_0xc9a0('0x14')]);}else{logger[_0xc9a0('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x3560e3,'request\x20sent');_0xf8cc52(_0x178b74[_0xc9a0('0x15')][_0xc9a0('0x14')]);}})['catch'](function(_0x548d2d){logger[_0xc9a0('0x13')](_0xc9a0('0xe'),_0x3560e3,_0x548d2d);_0x473ba0(_0x548d2d);});});}exports[_0xc9a0('0x16')]=function(_0x5a24ee){var _0x50895d=this;return new Promise(function(_0x3fb070,_0x46fc61){return db[_0xc9a0('0x17')][_0xc9a0('0x18')]({'raw':_0x5a24ee[_0xc9a0('0x19')]?_0x5a24ee[_0xc9a0('0x19')][_0xc9a0('0x1a')]===undefined?!![]:![]:!![],'where':_0x5a24ee[_0xc9a0('0x19')]?_0x5a24ee['options'][_0xc9a0('0x1b')]||null:null,'attributes':_0x5a24ee[_0xc9a0('0x19')]?_0x5a24ee[_0xc9a0('0x19')][_0xc9a0('0x1c')]||null:null,'limit':_0x5a24ee[_0xc9a0('0x19')]?_0x5a24ee['options']['limit']||null:null,'include':_0x5a24ee[_0xc9a0('0x19')]?_0x5a24ee[_0xc9a0('0x19')][_0xc9a0('0x1d')]?_[_0xc9a0('0x1e')](_0x5a24ee[_0xc9a0('0x19')]['include'],function(_0x1f60e1){return{'model':db[_0x1f60e1[_0xc9a0('0x1f')]],'as':_0x1f60e1['as'],'attributes':_0x1f60e1[_0xc9a0('0x1c')],'include':_0x1f60e1['include']?_['map'](_0x1f60e1[_0xc9a0('0x1d')],function(_0x1c4230){return{'model':db[_0x1c4230[_0xc9a0('0x1f')]],'as':_0x1c4230['as'],'attributes':_0x1c4230[_0xc9a0('0x1c')],'include':_0x1c4230[_0xc9a0('0x1d')]?_[_0xc9a0('0x1e')](_0x1c4230[_0xc9a0('0x1d')],function(_0x4f40d1){return{'model':db[_0x4f40d1['model']],'as':_0x4f40d1['as'],'attributes':_0x4f40d1[_0xc9a0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc9a0('0xc')](function(_0x5dc075){logger['info'](_0xc9a0('0x16'),_0x5a24ee);logger['debug']('GetDynamics365Account',_0x5a24ee,JSON['stringify'](_0x5dc075));_0x3fb070(_0x5dc075);})[_0xc9a0('0x20')](function(_0x2754d4){logger[_0xc9a0('0x13')]('GetDynamics365Account',_0x2754d4['message'],_0x5a24ee);_0x46fc61(_0x50895d[_0xc9a0('0x13')](0x1f4,_0x2754d4[_0xc9a0('0x14')]));});});};exports[_0xc9a0('0x21')]=function(_0x4e1296){var _0x11783e=this;return new Promise(function(_0x1d183e,_0x149848){return db['Dynamics365Account']['find']({'raw':_0x4e1296[_0xc9a0('0x19')]?_0x4e1296[_0xc9a0('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4e1296[_0xc9a0('0x19')]?_0x4e1296[_0xc9a0('0x19')][_0xc9a0('0x1b')]||null:null,'attributes':_0x4e1296['options']?_0x4e1296[_0xc9a0('0x19')][_0xc9a0('0x1c')]||null:null,'include':_0x4e1296[_0xc9a0('0x19')]?_0x4e1296[_0xc9a0('0x19')][_0xc9a0('0x1d')]?_[_0xc9a0('0x1e')](_0x4e1296['options'][_0xc9a0('0x1d')],function(_0x15f187){return{'model':db[_0x15f187[_0xc9a0('0x1f')]],'as':_0x15f187['as'],'attributes':_0x15f187['attributes'],'include':_0x15f187['include']?_[_0xc9a0('0x1e')](_0x15f187[_0xc9a0('0x1d')],function(_0x3c08aa){return{'model':db[_0x3c08aa[_0xc9a0('0x1f')]],'as':_0x3c08aa['as'],'attributes':_0x3c08aa['attributes'],'include':_0x3c08aa[_0xc9a0('0x1d')]?_[_0xc9a0('0x1e')](_0x3c08aa[_0xc9a0('0x1d')],function(_0x119ab5){return{'model':db[_0x119ab5['model']],'as':_0x119ab5['as'],'attributes':_0x119ab5['attributes']};}):[]};}):[]};}):[]:[]})[_0xc9a0('0xc')](function(_0x5e6dd2){logger[_0xc9a0('0xd')](_0xc9a0('0x21'),_0x4e1296);logger[_0xc9a0('0x22')](_0xc9a0('0x21'),_0x4e1296,JSON[_0xc9a0('0x11')](_0x5e6dd2));_0x1d183e(_0x5e6dd2);})[_0xc9a0('0x20')](function(_0x82868){logger[_0xc9a0('0x13')](_0xc9a0('0x21'),_0x82868[_0xc9a0('0x14')],_0x4e1296);_0x149848(_0x11783e[_0xc9a0('0x13')](0x1f4,_0x82868[_0xc9a0('0x14')]));});});}; \ No newline at end of file +var _0xd479=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','attributes','limit','include','model','map','raw','where','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4b2ed7,_0x5b3100){var _0x55a953=function(_0x4b7abd){while(--_0x4b7abd){_0x4b2ed7['push'](_0x4b2ed7['shift']());}};_0x55a953(++_0x5b3100);}(_0xd479,0xfc));var _0x9d47=function(_0x31f073,_0x47c5ad){_0x31f073=_0x31f073-0x0;var _0x1f7070=_0xd479[_0x31f073];return _0x1f7070;};'use strict';var _=require(_0x9d47('0x0'));var util=require(_0x9d47('0x1'));var moment=require(_0x9d47('0x2'));var BPromise=require(_0x9d47('0x3'));var rs=require(_0x9d47('0x4'));var fs=require('fs');var Redis=require(_0x9d47('0x5'));var db=require(_0x9d47('0x6'))['db'];var utils=require(_0x9d47('0x7'));var logger=require(_0x9d47('0x8'))('rpc');var config=require(_0x9d47('0x9'));var jayson=require(_0x9d47('0xa'));var client=jayson[_0x9d47('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24a343,_0xe320a8,_0x580253){return new BPromise(function(_0x6f137,_0x500b0c){return client[_0x9d47('0xc')](_0x24a343,_0x580253)[_0x9d47('0xd')](function(_0x22800d){logger[_0x9d47('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0xe320a8,_0x9d47('0xf'));logger[_0x9d47('0x10')](_0x9d47('0x11'),_0xe320a8,_0x9d47('0xf'),JSON[_0x9d47('0x12')](_0x22800d));if(_0x22800d[_0x9d47('0x13')]){if(_0x22800d[_0x9d47('0x13')][_0x9d47('0x14')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0xe320a8,_0x22800d[_0x9d47('0x13')][_0x9d47('0x15')]);return _0x500b0c(_0x22800d[_0x9d47('0x13')][_0x9d47('0x15')]);}logger[_0x9d47('0x13')](_0x9d47('0x16'),_0xe320a8,_0x22800d[_0x9d47('0x13')][_0x9d47('0x15')]);return _0x6f137(_0x22800d['error'][_0x9d47('0x15')]);}else{logger[_0x9d47('0xe')](_0x9d47('0x16'),_0xe320a8,_0x9d47('0xf'));_0x6f137(_0x22800d[_0x9d47('0x17')]['message']);}})[_0x9d47('0x18')](function(_0x33f5ad){logger['error'](_0x9d47('0x16'),_0xe320a8,_0x33f5ad);_0x500b0c(_0x33f5ad);});});}exports[_0x9d47('0x19')]=function(_0x3461d7){var _0x3577ec=this;return new Promise(function(_0x524f16,_0x597e79){return db[_0x9d47('0x1a')][_0x9d47('0x1b')]({'raw':_0x3461d7[_0x9d47('0x1c')]?_0x3461d7[_0x9d47('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3461d7[_0x9d47('0x1c')]?_0x3461d7[_0x9d47('0x1c')]['where']||null:null,'attributes':_0x3461d7[_0x9d47('0x1c')]?_0x3461d7[_0x9d47('0x1c')][_0x9d47('0x1d')]||null:null,'limit':_0x3461d7[_0x9d47('0x1c')]?_0x3461d7[_0x9d47('0x1c')][_0x9d47('0x1e')]||null:null,'include':_0x3461d7['options']?_0x3461d7[_0x9d47('0x1c')]['include']?_['map'](_0x3461d7[_0x9d47('0x1c')][_0x9d47('0x1f')],function(_0x3c0fc6){return{'model':db[_0x3c0fc6[_0x9d47('0x20')]],'as':_0x3c0fc6['as'],'attributes':_0x3c0fc6['attributes'],'include':_0x3c0fc6[_0x9d47('0x1f')]?_[_0x9d47('0x21')](_0x3c0fc6[_0x9d47('0x1f')],function(_0x467968){return{'model':db[_0x467968['model']],'as':_0x467968['as'],'attributes':_0x467968[_0x9d47('0x1d')],'include':_0x467968[_0x9d47('0x1f')]?_[_0x9d47('0x21')](_0x467968[_0x9d47('0x1f')],function(_0x115128){return{'model':db[_0x115128['model']],'as':_0x115128['as'],'attributes':_0x115128[_0x9d47('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9d47('0xd')](function(_0x2a28ba){logger[_0x9d47('0xe')](_0x9d47('0x19'),_0x3461d7);logger[_0x9d47('0x10')](_0x9d47('0x19'),_0x3461d7,JSON[_0x9d47('0x12')](_0x2a28ba));_0x524f16(_0x2a28ba);})[_0x9d47('0x18')](function(_0x2dfe28){logger[_0x9d47('0x13')](_0x9d47('0x19'),_0x2dfe28[_0x9d47('0x15')],_0x3461d7);_0x597e79(_0x3577ec[_0x9d47('0x13')](0x1f4,_0x2dfe28[_0x9d47('0x15')]));});});};exports['ShowDynamics365Account']=function(_0x58e817){var _0x59190=this;return new Promise(function(_0x135aea,_0x298447){return db['Dynamics365Account']['find']({'raw':_0x58e817['options']?_0x58e817['options'][_0x9d47('0x22')]===undefined?!![]:![]:!![],'where':_0x58e817[_0x9d47('0x1c')]?_0x58e817[_0x9d47('0x1c')][_0x9d47('0x23')]||null:null,'attributes':_0x58e817[_0x9d47('0x1c')]?_0x58e817[_0x9d47('0x1c')]['attributes']||null:null,'include':_0x58e817[_0x9d47('0x1c')]?_0x58e817['options'][_0x9d47('0x1f')]?_[_0x9d47('0x21')](_0x58e817[_0x9d47('0x1c')][_0x9d47('0x1f')],function(_0x4929d5){return{'model':db[_0x4929d5['model']],'as':_0x4929d5['as'],'attributes':_0x4929d5[_0x9d47('0x1d')],'include':_0x4929d5['include']?_[_0x9d47('0x21')](_0x4929d5[_0x9d47('0x1f')],function(_0x1d2c3e){return{'model':db[_0x1d2c3e['model']],'as':_0x1d2c3e['as'],'attributes':_0x1d2c3e[_0x9d47('0x1d')],'include':_0x1d2c3e[_0x9d47('0x1f')]?_[_0x9d47('0x21')](_0x1d2c3e[_0x9d47('0x1f')],function(_0x56a060){return{'model':db[_0x56a060['model']],'as':_0x56a060['as'],'attributes':_0x56a060[_0x9d47('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9d47('0xd')](function(_0x3d697c){logger[_0x9d47('0xe')](_0x9d47('0x24'),_0x58e817);logger['debug'](_0x9d47('0x24'),_0x58e817,JSON[_0x9d47('0x12')](_0x3d697c));_0x135aea(_0x3d697c);})[_0x9d47('0x18')](function(_0x3771a6){logger['error'](_0x9d47('0x24'),_0x3771a6['message'],_0x58e817);_0x298447(_0x59190[_0x9d47('0x13')](0x1f4,_0x3771a6[_0x9d47('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index f1b2359..5ce631d 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 _0xd5fc=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','/:id','exports','multer','express'];(function(_0x21dd14,_0x23fbef){var _0x4bb93b=function(_0x22762d){while(--_0x22762d){_0x21dd14['push'](_0x21dd14['shift']());}};_0x4bb93b(++_0x23fbef);}(_0xd5fc,0xae));var _0xcd5f=function(_0x22ff2d,_0x936ca6){_0x22ff2d=_0x22ff2d-0x0;var _0xc80ff5=_0xd5fc[_0x22ff2d];return _0xc80ff5;};'use strict';var multer=require(_0xcd5f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcd5f('0x1'));var router=express[_0xcd5f('0x2')]();var fs_extra=require(_0xcd5f('0x3'));var auth=require(_0xcd5f('0x4'));var interaction=require(_0xcd5f('0x5'));var config=require(_0xcd5f('0x6'));var controller=require('./intDynamics365Configuration.controller');router[_0xcd5f('0x7')]('/',auth['isAuthenticated'](),controller[_0xcd5f('0x8')]);router[_0xcd5f('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xcd5f('0x7')]('/:id/fields',auth[_0xcd5f('0x9')](),controller[_0xcd5f('0xa')]);router['get'](_0xcd5f('0xb'),auth['isAuthenticated'](),controller[_0xcd5f('0xc')]);router['get'](_0xcd5f('0xd'),auth[_0xcd5f('0x9')](),controller[_0xcd5f('0xe')]);router[_0xcd5f('0xf')]('/',auth['isAuthenticated'](),controller[_0xcd5f('0x10')]);router[_0xcd5f('0x11')]('/:id',auth[_0xcd5f('0x9')](),controller[_0xcd5f('0x12')]);router[_0xcd5f('0x13')](_0xcd5f('0x14'),auth[_0xcd5f('0x9')](),controller['destroy']);module[_0xcd5f('0x15')]=router; \ No newline at end of file +var _0xbeb6=['isAuthenticated','index','show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xbeb6,0x19e));var _0x6beb=function(_0x9bea94,_0x368fca){_0x9bea94=_0x9bea94-0x0;var _0x558865=_0xbeb6[_0x9bea94];return _0x558865;};'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/fields',auth[_0x6beb('0xb')](),controller[_0x6beb('0xe')]);router[_0x6beb('0xa')]('/:id/subjects',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('0x14')](_0x6beb('0x15'),auth[_0x6beb('0xb')](),controller[_0x6beb('0x16')]);router['delete']('/:id',auth[_0x6beb('0xb')](),controller[_0x6beb('0x17')]);module[_0x6beb('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 313547c..792827a 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 _0xc04f=['incident','sequelize','exports','STRING','ENUM'];(function(_0x1034ee,_0x12998c){var _0x2922af=function(_0x13715a){while(--_0x13715a){_0x1034ee['push'](_0x1034ee['shift']());}};_0x2922af(++_0x12998c);}(_0xc04f,0x1e6));var _0xfc04=function(_0x50d94a,_0x4bb055){_0x50d94a=_0x50d94a-0x0;var _0x4b88ec=_0xc04f[_0x50d94a];return _0x4b88ec;};'use strict';var Sequelize=require(_0xfc04('0x0'));module[_0xfc04('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfc04('0x2')]},'ticketType':{'type':Sequelize[_0xfc04('0x3')]('incident','phonecall'),'defaultValue':_0xfc04('0x4')}}; \ No newline at end of file +var _0xd425=['sequelize','exports','STRING','ENUM','incident','phonecall'];(function(_0x54ab4a,_0x436e41){var _0xee6a54=function(_0xe66b1a){while(--_0xe66b1a){_0x54ab4a['push'](_0x54ab4a['shift']());}};_0xee6a54(++_0x436e41);}(_0xd425,0x18c));var _0x5d42=function(_0x3741ac,_0x5b7acd){_0x3741ac=_0x3741ac-0x0;var _0x59421a=_0xd425[_0x3741ac];return _0x59421a;};'use strict';var Sequelize=require(_0x5d42('0x0'));module[_0x5d42('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5d42('0x2')]},'ticketType':{'type':Sequelize[_0x5d42('0x3')](_0x5d42('0x4'),_0x5d42('0x5')),'defaultValue':_0x5d42('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 04b0408..b3e7a2d 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 _0xf50e=['body','destroy','getFields','findOne','order','sort','pick','hasOwnProperty','getSubjects','getDescriptions','Dynamics365Field','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','then','end','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','map','query','keys','filters','intersection','attributes','model','length','nolimit','filter','where','merge','VIRTUAL','options','include','rows','catch','show','params','fields','includeAll','find','create'];(function(_0x163cd0,_0x461c03){var _0x166213=function(_0x450910){while(--_0x450910){_0x163cd0['push'](_0x163cd0['shift']());}};_0x166213(++_0x461c03);}(_0xf50e,0xf8));var _0xef50=function(_0x543c51,_0xff0084){_0x543c51=_0x543c51-0x0;var _0x360555=_0xf50e[_0x543c51];return _0x360555;};'use strict';var emlformat=require(_0xef50('0x0'));var rimraf=require(_0xef50('0x1'));var zipdir=require(_0xef50('0x2'));var jsonpatch=require(_0xef50('0x3'));var rp=require('request-promise');var moment=require(_0xef50('0x4'));var BPromise=require(_0xef50('0x5'));var Mustache=require(_0xef50('0x6'));var util=require(_0xef50('0x7'));var path=require(_0xef50('0x8'));var sox=require(_0xef50('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xef50('0xa'));var squel=require(_0xef50('0xb'));var crypto=require(_0xef50('0xc'));var jsforce=require(_0xef50('0xd'));var deskjs=require(_0xef50('0xe'));var toCsv=require(_0xef50('0xf'));var querystring=require(_0xef50('0x10'));var Papa=require('papaparse');var Redis=require(_0xef50('0x11'));var authService=require(_0xef50('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xef50('0x13'));var logger=require('../../config/logger')(_0xef50('0x14'));var utils=require(_0xef50('0x15'));var config=require(_0xef50('0x16'));var licenseUtil=require(_0xef50('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44a2b8,_0x21981e){_0x21981e=_0x21981e||0xcc;return function(_0x2d9190){if(_0x2d9190){return _0x44a2b8[_0xef50('0x18')](_0x21981e);}return _0x44a2b8[_0xef50('0x19')](_0x21981e)['end']();};}function respondWithResult(_0x15d875,_0x1bf4ba){_0x1bf4ba=_0x1bf4ba||0xc8;return function(_0x2f11fe){if(_0x2f11fe){return _0x15d875[_0xef50('0x19')](_0x1bf4ba)[_0xef50('0x1a')](_0x2f11fe);}};}function respondWithFilteredResult(_0x36643e,_0x5dada9){return function(_0xd54d24){if(_0xd54d24){var _0x4e94ec=typeof _0x5dada9[_0xef50('0x1b')]===_0xef50('0x1c')&&typeof _0x5dada9['limit']==='undefined';var _0x4d31b5=_0xd54d24[_0xef50('0x1d')];var _0x52158f=_0x4e94ec?0x0:_0x5dada9[_0xef50('0x1b')];var _0x59b92b=_0x4e94ec?_0xd54d24[_0xef50('0x1d')]:_0x5dada9[_0xef50('0x1b')]+_0x5dada9[_0xef50('0x1e')];var _0x39578d;if(_0x59b92b>=_0x4d31b5){_0x59b92b=_0x4d31b5;_0x39578d=0xc8;}else{_0x39578d=0xce;}_0x36643e[_0xef50('0x19')](_0x39578d);return _0x36643e[_0xef50('0x1f')]('Content-Range',_0x52158f+'-'+_0x59b92b+'/'+_0x4d31b5)[_0xef50('0x1a')](_0xd54d24);}return null;};}function patchUpdates(_0x1b019f){return function(_0x203446){try{jsonpatch[_0xef50('0x20')](_0x203446,_0x1b019f,!![]);}catch(_0x56d924){return BPromise['reject'](_0x56d924);}return _0x203446[_0xef50('0x21')]();};}function saveUpdates(_0x103e50,_0x3c1b5b){return function(_0x2a776a){if(_0x2a776a){return _0x2a776a[_0xef50('0x22')](_0x103e50)[_0xef50('0x23')](function(_0x586084){return _0x586084;});}return null;};}function removeEntity(_0x371ed4,_0x4b2fcd){return function(_0x2208a){if(_0x2208a){return _0x2208a['destroy']()[_0xef50('0x23')](function(){_0x371ed4[_0xef50('0x19')](0xcc)[_0xef50('0x24')]();});}};}function handleEntityNotFound(_0x1fb64a,_0x5b6ccc){return function(_0x28811e){if(!_0x28811e){_0x1fb64a[_0xef50('0x18')](0x194);}return _0x28811e;};}function handleError(_0x23c51d,_0x342a04){_0x342a04=_0x342a04||0x1f4;return function(_0x3f981e){logger[_0xef50('0x25')](_0x3f981e[_0xef50('0x26')]);if(_0x3f981e['name']){delete _0x3f981e[_0xef50('0x27')];}_0x23c51d[_0xef50('0x19')](_0x342a04)[_0xef50('0x28')](_0x3f981e);};}exports[_0xef50('0x29')]=function(_0x625393,_0x1d1740){var _0xc0ce72={},_0x2c3c44={},_0x306a33={'count':0x0,'rows':[]};var _0x3cda62=_['map'](db[_0xef50('0x2a')][_0xef50('0x2b')],function(_0x17e0a9){return{'name':_0x17e0a9[_0xef50('0x2c')],'type':_0x17e0a9['type']['key']};});_0x2c3c44['model']=_[_0xef50('0x2d')](_0x3cda62,_0xef50('0x27'));_0x2c3c44[_0xef50('0x2e')]=_[_0xef50('0x2f')](_0x625393[_0xef50('0x2e')]);_0x2c3c44[_0xef50('0x30')]=_[_0xef50('0x31')](_0x2c3c44['model'],_0x2c3c44[_0xef50('0x2e')]);_0xc0ce72[_0xef50('0x32')]=_[_0xef50('0x31')](_0x2c3c44[_0xef50('0x33')],qs['fields'](_0x625393[_0xef50('0x2e')]['fields']));_0xc0ce72[_0xef50('0x32')]=_0xc0ce72[_0xef50('0x32')][_0xef50('0x34')]?_0xc0ce72[_0xef50('0x32')]:_0x2c3c44[_0xef50('0x33')];if(!_0x625393[_0xef50('0x2e')]['hasOwnProperty'](_0xef50('0x35'))){_0xc0ce72['limit']=qs[_0xef50('0x1e')](_0x625393[_0xef50('0x2e')][_0xef50('0x1e')]);_0xc0ce72[_0xef50('0x1b')]=qs[_0xef50('0x1b')](_0x625393['query']['offset']);}_0xc0ce72['order']=qs['sort'](_0x625393['query']['sort']);_0xc0ce72['where']=qs[_0xef50('0x30')](_['pick'](_0x625393[_0xef50('0x2e')],_0x2c3c44['filters']),_0x3cda62);if(_0x625393[_0xef50('0x2e')][_0xef50('0x36')]){_0xc0ce72[_0xef50('0x37')]=_[_0xef50('0x38')](_0xc0ce72['where'],{'$or':_[_0xef50('0x2d')](_0x3cda62,function(_0xb1daf9){if(_0xb1daf9['type']!==_0xef50('0x39')){var _0xa54ede={};_0xa54ede[_0xb1daf9[_0xef50('0x27')]]={'$like':'%'+_0x625393['query'][_0xef50('0x36')]+'%'};return _0xa54ede;}})});}_0xc0ce72=_[_0xef50('0x38')]({},_0xc0ce72,_0x625393[_0xef50('0x3a')]);var _0x2f63bc={'where':_0xc0ce72[_0xef50('0x37')]};return db['Dynamics365Configuration']['count'](_0x2f63bc)['then'](function(_0x30495f){_0x306a33['count']=_0x30495f;if(_0x625393[_0xef50('0x2e')]['includeAll']){_0xc0ce72[_0xef50('0x3b')]=[{'all':!![]}];}return db[_0xef50('0x2a')]['findAll'](_0xc0ce72);})['then'](function(_0x4b7594){_0x306a33[_0xef50('0x3c')]=_0x4b7594;return _0x306a33;})[_0xef50('0x23')](respondWithFilteredResult(_0x1d1740,_0xc0ce72))[_0xef50('0x3d')](handleError(_0x1d1740,null));};exports[_0xef50('0x3e')]=function(_0x5c1dbd,_0x530995){var _0x2a48e7={'raw':![],'where':{'id':_0x5c1dbd[_0xef50('0x3f')]['id']}},_0x102c4d={};_0x102c4d[_0xef50('0x33')]=_['keys'](db[_0xef50('0x2a')][_0xef50('0x2b')]);_0x102c4d[_0xef50('0x2e')]=_['keys'](_0x5c1dbd[_0xef50('0x2e')]);_0x102c4d[_0xef50('0x30')]=_[_0xef50('0x31')](_0x102c4d[_0xef50('0x33')],_0x102c4d[_0xef50('0x2e')]);_0x2a48e7[_0xef50('0x32')]=_[_0xef50('0x31')](_0x102c4d[_0xef50('0x33')],qs[_0xef50('0x40')](_0x5c1dbd[_0xef50('0x2e')][_0xef50('0x40')]));_0x2a48e7[_0xef50('0x32')]=_0x2a48e7[_0xef50('0x32')]['length']?_0x2a48e7[_0xef50('0x32')]:_0x102c4d[_0xef50('0x33')];if(_0x5c1dbd[_0xef50('0x2e')][_0xef50('0x41')]){_0x2a48e7['include']=[{'all':!![]}];}_0x2a48e7=_[_0xef50('0x38')]({},_0x2a48e7,_0x5c1dbd[_0xef50('0x3a')]);return db[_0xef50('0x2a')][_0xef50('0x42')](_0x2a48e7)[_0xef50('0x23')](handleEntityNotFound(_0x530995,null))['then'](respondWithResult(_0x530995,null))[_0xef50('0x3d')](handleError(_0x530995,null));};exports[_0xef50('0x43')]=function(_0x448cc2,_0x9fe573){return db[_0xef50('0x2a')]['create'](_0x448cc2[_0xef50('0x44')],{})[_0xef50('0x23')](respondWithResult(_0x9fe573,0xc9))['catch'](handleError(_0x9fe573,null));};exports[_0xef50('0x22')]=function(_0x26ca61,_0x2d8ed2){if(_0x26ca61[_0xef50('0x44')]['id']){delete _0x26ca61['body']['id'];}return db[_0xef50('0x2a')][_0xef50('0x42')]({'where':{'id':_0x26ca61[_0xef50('0x3f')]['id']}})[_0xef50('0x23')](handleEntityNotFound(_0x2d8ed2,null))[_0xef50('0x23')](saveUpdates(_0x26ca61[_0xef50('0x44')],null))[_0xef50('0x23')](respondWithResult(_0x2d8ed2,null))[_0xef50('0x3d')](handleError(_0x2d8ed2,null));};exports[_0xef50('0x45')]=function(_0x4771df,_0x1a7ce5){return db[_0xef50('0x2a')]['find']({'where':{'id':_0x4771df[_0xef50('0x3f')]['id']}})[_0xef50('0x23')](handleEntityNotFound(_0x1a7ce5,null))[_0xef50('0x23')](removeEntity(_0x1a7ce5,null))[_0xef50('0x3d')](handleError(_0x1a7ce5,null));};exports[_0xef50('0x46')]=function(_0x406769,_0x3544ac,_0x1a9ba5){var _0x2d8d77={};var _0xf04817={};var _0x285010;var _0x1f4383;return db[_0xef50('0x2a')][_0xef50('0x47')]({'where':{'id':_0x406769[_0xef50('0x3f')]['id']}})[_0xef50('0x23')](handleEntityNotFound(_0x3544ac,null))['then'](function(_0x5d891c){if(_0x5d891c){_0x285010=_0x5d891c;_0xf04817[_0xef50('0x33')]=_['keys'](db['Dynamics365Field'][_0xef50('0x2b')]);_0xf04817[_0xef50('0x2e')]=_[_0xef50('0x2f')](_0x406769[_0xef50('0x2e')]);_0xf04817[_0xef50('0x30')]=_[_0xef50('0x31')](_0xf04817[_0xef50('0x33')],_0xf04817['query']);_0x2d8d77[_0xef50('0x32')]=_[_0xef50('0x31')](_0xf04817['model'],qs[_0xef50('0x40')](_0x406769[_0xef50('0x2e')][_0xef50('0x40')]));_0x2d8d77[_0xef50('0x32')]=_0x2d8d77[_0xef50('0x32')][_0xef50('0x34')]?_0x2d8d77[_0xef50('0x32')]:_0xf04817[_0xef50('0x33')];_0x2d8d77[_0xef50('0x48')]=qs[_0xef50('0x49')](_0x406769[_0xef50('0x2e')]['sort']);_0x2d8d77[_0xef50('0x37')]=qs[_0xef50('0x30')](_[_0xef50('0x4a')](_0x406769[_0xef50('0x2e')],_0xf04817[_0xef50('0x30')]));if(_0x406769[_0xef50('0x2e')][_0xef50('0x36')]){_0x2d8d77['where']=_['merge'](_0x2d8d77['where'],{'$or':_[_0xef50('0x2d')](_0x2d8d77[_0xef50('0x32')],function(_0x552e91){var _0x5bba45={};_0x5bba45[_0x552e91]={'$like':'%'+_0x406769[_0xef50('0x2e')]['filter']+'%'};return _0x5bba45;})});}_0x2d8d77=_[_0xef50('0x38')]({},_0x2d8d77,_0x406769['options']);return _0x285010['getFields'](_0x2d8d77);}})['then'](function(_0x22d32e){if(_0x22d32e){_0x1f4383=_0x22d32e['length'];if(!_0x406769['query'][_0xef50('0x4b')]('nolimit')){_0x2d8d77[_0xef50('0x1e')]=qs[_0xef50('0x1e')](_0x406769[_0xef50('0x2e')]['limit']);_0x2d8d77[_0xef50('0x1b')]=qs[_0xef50('0x1b')](_0x406769[_0xef50('0x2e')][_0xef50('0x1b')]);}return _0x285010[_0xef50('0x46')](_0x2d8d77);}})[_0xef50('0x23')](function(_0x4b51d0){if(_0x4b51d0){return _0x4b51d0?{'count':_0x1f4383,'rows':_0x4b51d0}:null;}})[_0xef50('0x23')](respondWithResult(_0x3544ac,null))['catch'](handleError(_0x3544ac,null));};exports[_0xef50('0x4c')]=function(_0x242c4d,_0x1a9bd2,_0x3b727f){var _0x3795a6={};var _0xcb116d={};var _0x36c9a2;var _0x2570f9;return db['Dynamics365Configuration'][_0xef50('0x47')]({'where':{'id':_0x242c4d[_0xef50('0x3f')]['id']}})[_0xef50('0x23')](handleEntityNotFound(_0x1a9bd2,null))['then'](function(_0x24df5f){if(_0x24df5f){_0x36c9a2=_0x24df5f;_0xcb116d[_0xef50('0x33')]=_['keys'](db['Dynamics365Field'][_0xef50('0x2b')]);_0xcb116d[_0xef50('0x2e')]=_[_0xef50('0x2f')](_0x242c4d[_0xef50('0x2e')]);_0xcb116d[_0xef50('0x30')]=_['intersection'](_0xcb116d[_0xef50('0x33')],_0xcb116d[_0xef50('0x2e')]);_0x3795a6[_0xef50('0x32')]=_[_0xef50('0x31')](_0xcb116d[_0xef50('0x33')],qs[_0xef50('0x40')](_0x242c4d[_0xef50('0x2e')][_0xef50('0x40')]));_0x3795a6[_0xef50('0x32')]=_0x3795a6[_0xef50('0x32')]['length']?_0x3795a6['attributes']:_0xcb116d[_0xef50('0x33')];_0x3795a6[_0xef50('0x48')]=qs[_0xef50('0x49')](_0x242c4d['query'][_0xef50('0x49')]);_0x3795a6[_0xef50('0x37')]=qs[_0xef50('0x30')](_[_0xef50('0x4a')](_0x242c4d['query'],_0xcb116d['filters']));if(_0x242c4d['query'][_0xef50('0x36')]){_0x3795a6[_0xef50('0x37')]=_[_0xef50('0x38')](_0x3795a6[_0xef50('0x37')],{'$or':_[_0xef50('0x2d')](_0x3795a6['attributes'],function(_0x80f639){var _0x1a5a49={};_0x1a5a49[_0x80f639]={'$like':'%'+_0x242c4d[_0xef50('0x2e')][_0xef50('0x36')]+'%'};return _0x1a5a49;})});}_0x3795a6=_[_0xef50('0x38')]({},_0x3795a6,_0x242c4d['options']);return _0x36c9a2[_0xef50('0x4c')](_0x3795a6);}})[_0xef50('0x23')](function(_0x3bd139){if(_0x3bd139){_0x2570f9=_0x3bd139[_0xef50('0x34')];if(!_0x242c4d[_0xef50('0x2e')]['hasOwnProperty'](_0xef50('0x35'))){_0x3795a6[_0xef50('0x1e')]=qs[_0xef50('0x1e')](_0x242c4d[_0xef50('0x2e')][_0xef50('0x1e')]);_0x3795a6[_0xef50('0x1b')]=qs[_0xef50('0x1b')](_0x242c4d['query'][_0xef50('0x1b')]);}return _0x36c9a2[_0xef50('0x4c')](_0x3795a6);}})['then'](function(_0x15c661){if(_0x15c661){return _0x15c661?{'count':_0x2570f9,'rows':_0x15c661}:null;}})[_0xef50('0x23')](respondWithResult(_0x1a9bd2,null))[_0xef50('0x3d')](handleError(_0x1a9bd2,null));};exports[_0xef50('0x4d')]=function(_0x5c3eef,_0x1ee28f,_0x44be5c){var _0x28358a={};var _0xb0525e={};var _0x34b6a5;var _0x135624;return db[_0xef50('0x2a')]['findOne']({'where':{'id':_0x5c3eef[_0xef50('0x3f')]['id']}})[_0xef50('0x23')](handleEntityNotFound(_0x1ee28f,null))[_0xef50('0x23')](function(_0x54b7b9){if(_0x54b7b9){_0x34b6a5=_0x54b7b9;_0xb0525e['model']=_[_0xef50('0x2f')](db[_0xef50('0x4e')][_0xef50('0x2b')]);_0xb0525e[_0xef50('0x2e')]=_[_0xef50('0x2f')](_0x5c3eef[_0xef50('0x2e')]);_0xb0525e[_0xef50('0x30')]=_['intersection'](_0xb0525e[_0xef50('0x33')],_0xb0525e['query']);_0x28358a[_0xef50('0x32')]=_[_0xef50('0x31')](_0xb0525e['model'],qs[_0xef50('0x40')](_0x5c3eef[_0xef50('0x2e')][_0xef50('0x40')]));_0x28358a[_0xef50('0x32')]=_0x28358a[_0xef50('0x32')][_0xef50('0x34')]?_0x28358a['attributes']:_0xb0525e[_0xef50('0x33')];_0x28358a[_0xef50('0x48')]=qs[_0xef50('0x49')](_0x5c3eef[_0xef50('0x2e')]['sort']);_0x28358a[_0xef50('0x37')]=qs[_0xef50('0x30')](_[_0xef50('0x4a')](_0x5c3eef[_0xef50('0x2e')],_0xb0525e[_0xef50('0x30')]));if(_0x5c3eef[_0xef50('0x2e')]['filter']){_0x28358a['where']=_[_0xef50('0x38')](_0x28358a[_0xef50('0x37')],{'$or':_[_0xef50('0x2d')](_0x28358a['attributes'],function(_0x4ccac2){var _0x25ae14={};_0x25ae14[_0x4ccac2]={'$like':'%'+_0x5c3eef[_0xef50('0x2e')][_0xef50('0x36')]+'%'};return _0x25ae14;})});}_0x28358a=_[_0xef50('0x38')]({},_0x28358a,_0x5c3eef['options']);return _0x34b6a5[_0xef50('0x4d')](_0x28358a);}})[_0xef50('0x23')](function(_0x4bbca5){if(_0x4bbca5){_0x135624=_0x4bbca5['length'];if(!_0x5c3eef['query']['hasOwnProperty'](_0xef50('0x35'))){_0x28358a[_0xef50('0x1e')]=qs[_0xef50('0x1e')](_0x5c3eef[_0xef50('0x2e')]['limit']);_0x28358a['offset']=qs['offset'](_0x5c3eef[_0xef50('0x2e')]['offset']);}return _0x34b6a5[_0xef50('0x4d')](_0x28358a);}})[_0xef50('0x23')](function(_0x1b0e50){if(_0x1b0e50){return _0x1b0e50?{'count':_0x135624,'rows':_0x1b0e50}:null;}})[_0xef50('0x23')](respondWithResult(_0x1ee28f,null))[_0xef50('0x3d')](handleError(_0x1ee28f,null));}; \ No newline at end of file +var _0xe91e=['VIRTUAL','options','Dynamics365Configuration','includeAll','include','findAll','show','keys','find','catch','create','body','params','getFields','findOne','Dynamics365Field','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','filters','intersection','fields','attributes','length','query','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x2287df,_0x5a4a24){var _0x2afbc1=function(_0x3af10a){while(--_0x3af10a){_0x2287df['push'](_0x2287df['shift']());}};_0x2afbc1(++_0x5a4a24);}(_0xe91e,0xb7));var _0xee91=function(_0x2a4fe2,_0x3ec53a){_0x2a4fe2=_0x2a4fe2-0x0;var _0x225c4a=_0xe91e[_0x2a4fe2];return _0x225c4a;};'use strict';var emlformat=require(_0xee91('0x0'));var rimraf=require(_0xee91('0x1'));var zipdir=require(_0xee91('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xee91('0x3'));var moment=require(_0xee91('0x4'));var BPromise=require(_0xee91('0x5'));var Mustache=require('mustache');var util=require(_0xee91('0x6'));var path=require(_0xee91('0x7'));var sox=require(_0xee91('0x8'));var csv=require('to-csv');var ejs=require(_0xee91('0x9'));var fs=require('fs');var fs_extra=require(_0xee91('0xa'));var _=require('lodash');var squel=require(_0xee91('0xb'));var crypto=require('crypto');var jsforce=require(_0xee91('0xc'));var deskjs=require(_0xee91('0xd'));var toCsv=require(_0xee91('0xe'));var querystring=require(_0xee91('0xf'));var Papa=require(_0xee91('0x10'));var Redis=require(_0xee91('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xee91('0x12'));var as=require(_0xee91('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee91('0x14'))(_0xee91('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xee91('0x16'));var db=require(_0xee91('0x17'))['db'];function respondWithStatusCode(_0x44ea77,_0x2297f3){_0x2297f3=_0x2297f3||0xcc;return function(_0x107983){if(_0x107983){return _0x44ea77[_0xee91('0x18')](_0x2297f3);}return _0x44ea77[_0xee91('0x19')](_0x2297f3)[_0xee91('0x1a')]();};}function respondWithResult(_0x4c83cc,_0xe7ed11){_0xe7ed11=_0xe7ed11||0xc8;return function(_0x394ed1){if(_0x394ed1){return _0x4c83cc[_0xee91('0x19')](_0xe7ed11)[_0xee91('0x1b')](_0x394ed1);}};}function respondWithFilteredResult(_0x456c66,_0x390550){return function(_0x4121c2){if(_0x4121c2){var _0xb9d454=typeof _0x390550[_0xee91('0x1c')]===_0xee91('0x1d')&&typeof _0x390550[_0xee91('0x1e')]===_0xee91('0x1d');var _0x2110db=_0x4121c2[_0xee91('0x1f')];var _0x2a8559=_0xb9d454?0x0:_0x390550[_0xee91('0x1c')];var _0x9eb285=_0xb9d454?_0x4121c2['count']:_0x390550[_0xee91('0x1c')]+_0x390550[_0xee91('0x1e')];var _0x5c7eef;if(_0x9eb285>=_0x2110db){_0x9eb285=_0x2110db;_0x5c7eef=0xc8;}else{_0x5c7eef=0xce;}_0x456c66[_0xee91('0x19')](_0x5c7eef);return _0x456c66['set'](_0xee91('0x20'),_0x2a8559+'-'+_0x9eb285+'/'+_0x2110db)[_0xee91('0x1b')](_0x4121c2);}return null;};}function patchUpdates(_0x215661){return function(_0x1ad31e){try{jsonpatch[_0xee91('0x21')](_0x1ad31e,_0x215661,!![]);}catch(_0x45d908){return BPromise[_0xee91('0x22')](_0x45d908);}return _0x1ad31e[_0xee91('0x23')]();};}function saveUpdates(_0x466bbd,_0x5934cf){return function(_0x13ed08){if(_0x13ed08){return _0x13ed08[_0xee91('0x24')](_0x466bbd)[_0xee91('0x25')](function(_0x4f4f75){return _0x4f4f75;});}return null;};}function removeEntity(_0xd9c789,_0x385c3e){return function(_0x2e6cf3){if(_0x2e6cf3){return _0x2e6cf3[_0xee91('0x26')]()[_0xee91('0x25')](function(){_0xd9c789[_0xee91('0x19')](0xcc)[_0xee91('0x1a')]();});}};}function handleEntityNotFound(_0xb95111,_0x21a42e){return function(_0x3b0ee1){if(!_0x3b0ee1){_0xb95111['sendStatus'](0x194);}return _0x3b0ee1;};}function handleError(_0x371c8a,_0x420602){_0x420602=_0x420602||0x1f4;return function(_0x13a8d4){logger[_0xee91('0x27')](_0x13a8d4[_0xee91('0x28')]);if(_0x13a8d4[_0xee91('0x29')]){delete _0x13a8d4[_0xee91('0x29')];}_0x371c8a[_0xee91('0x19')](_0x420602)[_0xee91('0x2a')](_0x13a8d4);};}exports[_0xee91('0x2b')]=function(_0x2bd3cf,_0x541f5c){var _0x2a5eed={},_0x44cc9b={},_0x382eba={'count':0x0,'rows':[]};var _0xd83993=_[_0xee91('0x2c')](db['Dynamics365Configuration'][_0xee91('0x2d')],function(_0x5b9867){return{'name':_0x5b9867[_0xee91('0x2e')],'type':_0x5b9867[_0xee91('0x2f')][_0xee91('0x30')]};});_0x44cc9b[_0xee91('0x31')]=_[_0xee91('0x2c')](_0xd83993,_0xee91('0x29'));_0x44cc9b['query']=_['keys'](_0x2bd3cf['query']);_0x44cc9b[_0xee91('0x32')]=_[_0xee91('0x33')](_0x44cc9b['model'],_0x44cc9b['query']);_0x2a5eed['attributes']=_[_0xee91('0x33')](_0x44cc9b['model'],qs[_0xee91('0x34')](_0x2bd3cf['query'][_0xee91('0x34')]));_0x2a5eed[_0xee91('0x35')]=_0x2a5eed[_0xee91('0x35')][_0xee91('0x36')]?_0x2a5eed[_0xee91('0x35')]:_0x44cc9b[_0xee91('0x31')];if(!_0x2bd3cf[_0xee91('0x37')][_0xee91('0x38')]('nolimit')){_0x2a5eed[_0xee91('0x1e')]=qs['limit'](_0x2bd3cf['query'][_0xee91('0x1e')]);_0x2a5eed['offset']=qs[_0xee91('0x1c')](_0x2bd3cf[_0xee91('0x37')]['offset']);}_0x2a5eed[_0xee91('0x39')]=qs[_0xee91('0x3a')](_0x2bd3cf['query'][_0xee91('0x3a')]);_0x2a5eed[_0xee91('0x3b')]=qs[_0xee91('0x32')](_[_0xee91('0x3c')](_0x2bd3cf[_0xee91('0x37')],_0x44cc9b['filters']),_0xd83993);if(_0x2bd3cf[_0xee91('0x37')][_0xee91('0x3d')]){_0x2a5eed['where']=_[_0xee91('0x3e')](_0x2a5eed['where'],{'$or':_[_0xee91('0x2c')](_0xd83993,function(_0x5cc293){if(_0x5cc293[_0xee91('0x2f')]!==_0xee91('0x3f')){var _0x33a426={};_0x33a426[_0x5cc293[_0xee91('0x29')]]={'$like':'%'+_0x2bd3cf[_0xee91('0x37')][_0xee91('0x3d')]+'%'};return _0x33a426;}})});}_0x2a5eed=_['merge']({},_0x2a5eed,_0x2bd3cf[_0xee91('0x40')]);var _0x31b230={'where':_0x2a5eed[_0xee91('0x3b')]};return db[_0xee91('0x41')][_0xee91('0x1f')](_0x31b230)[_0xee91('0x25')](function(_0x1b9022){_0x382eba[_0xee91('0x1f')]=_0x1b9022;if(_0x2bd3cf['query'][_0xee91('0x42')]){_0x2a5eed[_0xee91('0x43')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xee91('0x44')](_0x2a5eed);})[_0xee91('0x25')](function(_0x4165c7){_0x382eba['rows']=_0x4165c7;return _0x382eba;})['then'](respondWithFilteredResult(_0x541f5c,_0x2a5eed))['catch'](handleError(_0x541f5c,null));};exports[_0xee91('0x45')]=function(_0x588644,_0x5b7b1b){var _0x3aa64c={'raw':![],'where':{'id':_0x588644['params']['id']}},_0x4526b5={};_0x4526b5['model']=_['keys'](db['Dynamics365Configuration'][_0xee91('0x2d')]);_0x4526b5[_0xee91('0x37')]=_[_0xee91('0x46')](_0x588644[_0xee91('0x37')]);_0x4526b5[_0xee91('0x32')]=_['intersection'](_0x4526b5[_0xee91('0x31')],_0x4526b5[_0xee91('0x37')]);_0x3aa64c[_0xee91('0x35')]=_['intersection'](_0x4526b5[_0xee91('0x31')],qs[_0xee91('0x34')](_0x588644[_0xee91('0x37')]['fields']));_0x3aa64c[_0xee91('0x35')]=_0x3aa64c[_0xee91('0x35')]['length']?_0x3aa64c[_0xee91('0x35')]:_0x4526b5[_0xee91('0x31')];if(_0x588644[_0xee91('0x37')][_0xee91('0x42')]){_0x3aa64c[_0xee91('0x43')]=[{'all':!![]}];}_0x3aa64c=_[_0xee91('0x3e')]({},_0x3aa64c,_0x588644[_0xee91('0x40')]);return db[_0xee91('0x41')][_0xee91('0x47')](_0x3aa64c)['then'](handleEntityNotFound(_0x5b7b1b,null))[_0xee91('0x25')](respondWithResult(_0x5b7b1b,null))[_0xee91('0x48')](handleError(_0x5b7b1b,null));};exports[_0xee91('0x49')]=function(_0x1cec28,_0x47181b){return db['Dynamics365Configuration'][_0xee91('0x49')](_0x1cec28['body'],{})[_0xee91('0x25')](respondWithResult(_0x47181b,0xc9))[_0xee91('0x48')](handleError(_0x47181b,null));};exports[_0xee91('0x24')]=function(_0x1600c6,_0x5869c1){if(_0x1600c6[_0xee91('0x4a')]['id']){delete _0x1600c6[_0xee91('0x4a')]['id'];}return db[_0xee91('0x41')][_0xee91('0x47')]({'where':{'id':_0x1600c6['params']['id']}})[_0xee91('0x25')](handleEntityNotFound(_0x5869c1,null))[_0xee91('0x25')](saveUpdates(_0x1600c6[_0xee91('0x4a')],null))['then'](respondWithResult(_0x5869c1,null))['catch'](handleError(_0x5869c1,null));};exports['destroy']=function(_0x194fd8,_0xaf5a6d){return db['Dynamics365Configuration'][_0xee91('0x47')]({'where':{'id':_0x194fd8[_0xee91('0x4b')]['id']}})['then'](handleEntityNotFound(_0xaf5a6d,null))[_0xee91('0x25')](removeEntity(_0xaf5a6d,null))[_0xee91('0x48')](handleError(_0xaf5a6d,null));};exports[_0xee91('0x4c')]=function(_0x3f3ab5,_0x3101cd,_0xeaadd2){var _0x15a783={};var _0x2c4b81={};var _0xf8f430;var _0x1381d0;return db[_0xee91('0x41')][_0xee91('0x4d')]({'where':{'id':_0x3f3ab5['params']['id']}})[_0xee91('0x25')](handleEntityNotFound(_0x3101cd,null))['then'](function(_0x5afe49){if(_0x5afe49){_0xf8f430=_0x5afe49;_0x2c4b81[_0xee91('0x31')]=_[_0xee91('0x46')](db['Dynamics365Field'][_0xee91('0x2d')]);_0x2c4b81[_0xee91('0x37')]=_[_0xee91('0x46')](_0x3f3ab5['query']);_0x2c4b81[_0xee91('0x32')]=_[_0xee91('0x33')](_0x2c4b81[_0xee91('0x31')],_0x2c4b81[_0xee91('0x37')]);_0x15a783[_0xee91('0x35')]=_[_0xee91('0x33')](_0x2c4b81[_0xee91('0x31')],qs[_0xee91('0x34')](_0x3f3ab5['query'][_0xee91('0x34')]));_0x15a783[_0xee91('0x35')]=_0x15a783[_0xee91('0x35')][_0xee91('0x36')]?_0x15a783[_0xee91('0x35')]:_0x2c4b81[_0xee91('0x31')];_0x15a783[_0xee91('0x39')]=qs['sort'](_0x3f3ab5[_0xee91('0x37')][_0xee91('0x3a')]);_0x15a783[_0xee91('0x3b')]=qs[_0xee91('0x32')](_[_0xee91('0x3c')](_0x3f3ab5[_0xee91('0x37')],_0x2c4b81[_0xee91('0x32')]));if(_0x3f3ab5[_0xee91('0x37')][_0xee91('0x3d')]){_0x15a783[_0xee91('0x3b')]=_['merge'](_0x15a783[_0xee91('0x3b')],{'$or':_[_0xee91('0x2c')](_0x15a783[_0xee91('0x35')],function(_0x50d39b){var _0x1417f9={};_0x1417f9[_0x50d39b]={'$like':'%'+_0x3f3ab5[_0xee91('0x37')][_0xee91('0x3d')]+'%'};return _0x1417f9;})});}_0x15a783=_[_0xee91('0x3e')]({},_0x15a783,_0x3f3ab5[_0xee91('0x40')]);return _0xf8f430[_0xee91('0x4c')](_0x15a783);}})[_0xee91('0x25')](function(_0xfafabe){if(_0xfafabe){_0x1381d0=_0xfafabe[_0xee91('0x36')];if(!_0x3f3ab5[_0xee91('0x37')]['hasOwnProperty']('nolimit')){_0x15a783['limit']=qs[_0xee91('0x1e')](_0x3f3ab5[_0xee91('0x37')][_0xee91('0x1e')]);_0x15a783[_0xee91('0x1c')]=qs['offset'](_0x3f3ab5['query'][_0xee91('0x1c')]);}return _0xf8f430['getFields'](_0x15a783);}})['then'](function(_0xfa23c0){if(_0xfa23c0){return _0xfa23c0?{'count':_0x1381d0,'rows':_0xfa23c0}:null;}})[_0xee91('0x25')](respondWithResult(_0x3101cd,null))[_0xee91('0x48')](handleError(_0x3101cd,null));};exports['getSubjects']=function(_0x592363,_0x7693b5,_0x2ba246){var _0x2cc457={};var _0x5ed718={};var _0x2b934e;var _0x5d0e23;return db[_0xee91('0x41')]['findOne']({'where':{'id':_0x592363['params']['id']}})[_0xee91('0x25')](handleEntityNotFound(_0x7693b5,null))['then'](function(_0x36695a){if(_0x36695a){_0x2b934e=_0x36695a;_0x5ed718[_0xee91('0x31')]=_[_0xee91('0x46')](db[_0xee91('0x4e')]['rawAttributes']);_0x5ed718[_0xee91('0x37')]=_[_0xee91('0x46')](_0x592363[_0xee91('0x37')]);_0x5ed718['filters']=_[_0xee91('0x33')](_0x5ed718[_0xee91('0x31')],_0x5ed718['query']);_0x2cc457[_0xee91('0x35')]=_['intersection'](_0x5ed718[_0xee91('0x31')],qs['fields'](_0x592363[_0xee91('0x37')][_0xee91('0x34')]));_0x2cc457[_0xee91('0x35')]=_0x2cc457[_0xee91('0x35')]['length']?_0x2cc457['attributes']:_0x5ed718[_0xee91('0x31')];_0x2cc457[_0xee91('0x39')]=qs[_0xee91('0x3a')](_0x592363[_0xee91('0x37')][_0xee91('0x3a')]);_0x2cc457['where']=qs['filters'](_[_0xee91('0x3c')](_0x592363[_0xee91('0x37')],_0x5ed718['filters']));if(_0x592363['query'][_0xee91('0x3d')]){_0x2cc457[_0xee91('0x3b')]=_[_0xee91('0x3e')](_0x2cc457[_0xee91('0x3b')],{'$or':_[_0xee91('0x2c')](_0x2cc457[_0xee91('0x35')],function(_0x20c305){var _0x4cc83f={};_0x4cc83f[_0x20c305]={'$like':'%'+_0x592363[_0xee91('0x37')][_0xee91('0x3d')]+'%'};return _0x4cc83f;})});}_0x2cc457=_[_0xee91('0x3e')]({},_0x2cc457,_0x592363['options']);return _0x2b934e[_0xee91('0x4f')](_0x2cc457);}})['then'](function(_0x2be15c){if(_0x2be15c){_0x5d0e23=_0x2be15c[_0xee91('0x36')];if(!_0x592363[_0xee91('0x37')][_0xee91('0x38')](_0xee91('0x50'))){_0x2cc457[_0xee91('0x1e')]=qs['limit'](_0x592363[_0xee91('0x37')][_0xee91('0x1e')]);_0x2cc457[_0xee91('0x1c')]=qs[_0xee91('0x1c')](_0x592363[_0xee91('0x37')][_0xee91('0x1c')]);}return _0x2b934e[_0xee91('0x4f')](_0x2cc457);}})[_0xee91('0x25')](function(_0xdbd431){if(_0xdbd431){return _0xdbd431?{'count':_0x5d0e23,'rows':_0xdbd431}:null;}})[_0xee91('0x25')](respondWithResult(_0x7693b5,null))[_0xee91('0x48')](handleError(_0x7693b5,null));};exports[_0xee91('0x51')]=function(_0x8a330c,_0x5a8d2,_0xee6be4){var _0x57be64={};var _0x25170e={};var _0x15ecb2;var _0x5865d0;return db['Dynamics365Configuration'][_0xee91('0x4d')]({'where':{'id':_0x8a330c[_0xee91('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a8d2,null))[_0xee91('0x25')](function(_0x1f8f41){if(_0x1f8f41){_0x15ecb2=_0x1f8f41;_0x25170e[_0xee91('0x31')]=_['keys'](db[_0xee91('0x4e')][_0xee91('0x2d')]);_0x25170e['query']=_[_0xee91('0x46')](_0x8a330c[_0xee91('0x37')]);_0x25170e[_0xee91('0x32')]=_[_0xee91('0x33')](_0x25170e['model'],_0x25170e['query']);_0x57be64[_0xee91('0x35')]=_[_0xee91('0x33')](_0x25170e[_0xee91('0x31')],qs[_0xee91('0x34')](_0x8a330c[_0xee91('0x37')][_0xee91('0x34')]));_0x57be64['attributes']=_0x57be64['attributes'][_0xee91('0x36')]?_0x57be64[_0xee91('0x35')]:_0x25170e[_0xee91('0x31')];_0x57be64[_0xee91('0x39')]=qs[_0xee91('0x3a')](_0x8a330c[_0xee91('0x37')][_0xee91('0x3a')]);_0x57be64[_0xee91('0x3b')]=qs[_0xee91('0x32')](_[_0xee91('0x3c')](_0x8a330c['query'],_0x25170e[_0xee91('0x32')]));if(_0x8a330c[_0xee91('0x37')]['filter']){_0x57be64[_0xee91('0x3b')]=_[_0xee91('0x3e')](_0x57be64[_0xee91('0x3b')],{'$or':_['map'](_0x57be64[_0xee91('0x35')],function(_0x2e84ae){var _0xe7523e={};_0xe7523e[_0x2e84ae]={'$like':'%'+_0x8a330c['query']['filter']+'%'};return _0xe7523e;})});}_0x57be64=_['merge']({},_0x57be64,_0x8a330c[_0xee91('0x40')]);return _0x15ecb2[_0xee91('0x51')](_0x57be64);}})['then'](function(_0x98918e){if(_0x98918e){_0x5865d0=_0x98918e[_0xee91('0x36')];if(!_0x8a330c['query']['hasOwnProperty'](_0xee91('0x50'))){_0x57be64[_0xee91('0x1e')]=qs[_0xee91('0x1e')](_0x8a330c['query'][_0xee91('0x1e')]);_0x57be64[_0xee91('0x1c')]=qs['offset'](_0x8a330c['query'][_0xee91('0x1c')]);}return _0x15ecb2[_0xee91('0x51')](_0x57be64);}})[_0xee91('0x25')](function(_0x40d0d8){if(_0x40d0d8){return _0x40d0d8?{'count':_0x5865d0,'rows':_0x40d0d8}:null;}})[_0xee91('0x25')](respondWithResult(_0x5a8d2,null))[_0xee91('0x48')](handleError(_0x5a8d2,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index a249de3..e8679aa 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','util'];(function(_0xa4a0e3,_0x225003){var _0x5ae8cf=function(_0x14aa43){while(--_0x14aa43){_0xa4a0e3['push'](_0xa4a0e3['shift']());}};_0x5ae8cf(++_0x225003);}(_0xedd9,0xfc));var _0x9edd=function(_0x37dbe8,_0x10e968){_0x37dbe8=_0x37dbe8-0x0;var _0x2416b6=_0xedd9[_0x37dbe8];return _0x2416b6;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00bb=['util','../../config/logger','moment','request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x357ad5,_0x77f789){var _0x141062=function(_0xf393ae){while(--_0xf393ae){_0x357ad5['push'](_0x357ad5['shift']());}};_0x141062(++_0x77f789);}(_0x00bb,0x1d8));var _0xb00b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x00bb[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var logger=require(_0xb00b('0x2'))('api');var moment=require(_0xb00b('0x3'));var BPromise=require('bluebird');var rp=require(_0xb00b('0x4'));var fs=require('fs');var path=require(_0xb00b('0x5'));var rimraf=require('rimraf');var config=require(_0xb00b('0x6'));var attributes=require(_0xb00b('0x7'));module['exports']=function(_0x574cf8,_0x532ffb){return _0x574cf8[_0xb00b('0x8')](_0xb00b('0x9'),attributes,{'tableName':_0xb00b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index fb2835b..539339b 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 _0x9114=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x12e63e,_0x30f1f7){var _0x12ff60=function(_0x2a2354){while(--_0x2a2354){_0x12e63e['push'](_0x12e63e['shift']());}};_0x12ff60(++_0x30f1f7);}(_0x9114,0x75));var _0x4911=function(_0x47e397,_0xe3831e){_0x47e397=_0x47e397-0x0;var _0x3e3825=_0x9114[_0x47e397];return _0x3e3825;};'use strict';var _=require(_0x4911('0x0'));var util=require(_0x4911('0x1'));var moment=require(_0x4911('0x2'));var BPromise=require(_0x4911('0x3'));var rs=require(_0x4911('0x4'));var fs=require('fs');var Redis=require(_0x4911('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4911('0x6'));var logger=require(_0x4911('0x7'))(_0x4911('0x8'));var config=require('../../config/environment');var jayson=require(_0x4911('0x9'));var client=jayson[_0x4911('0xa')][_0x4911('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a3a57,_0x1e0e12,_0xce6c4f){return new BPromise(function(_0x4d8b52,_0x5b6031){return client[_0x4911('0xc')](_0x4a3a57,_0xce6c4f)[_0x4911('0xd')](function(_0xc3726f){logger[_0x4911('0xe')](_0x4911('0xf'),_0x1e0e12,_0x4911('0x10'));logger[_0x4911('0x11')](_0x4911('0x12'),_0x1e0e12,_0x4911('0x10'),JSON[_0x4911('0x13')](_0xc3726f));if(_0xc3726f[_0x4911('0x14')]){if(_0xc3726f[_0x4911('0x14')][_0x4911('0x15')]===0x1f4){logger[_0x4911('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1e0e12,_0xc3726f['error'][_0x4911('0x16')]);return _0x5b6031(_0xc3726f[_0x4911('0x14')][_0x4911('0x16')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x1e0e12,_0xc3726f[_0x4911('0x14')]['message']);return _0x4d8b52(_0xc3726f[_0x4911('0x14')][_0x4911('0x16')]);}else{logger[_0x4911('0xe')](_0x4911('0xf'),_0x1e0e12,_0x4911('0x10'));_0x4d8b52(_0xc3726f['result']['message']);}})[_0x4911('0x17')](function(_0x3563f7){logger[_0x4911('0x14')](_0x4911('0xf'),_0x1e0e12,_0x3563f7);_0x5b6031(_0x3563f7);});});} \ No newline at end of file +var _0xa301=['client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Dynamics365Configuration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x438c2c,_0x5c209f){var _0x5e39ea=function(_0x369b6c){while(--_0x369b6c){_0x438c2c['push'](_0x438c2c['shift']());}};_0x5e39ea(++_0x5c209f);}(_0xa301,0x107));var _0x1a30=function(_0x478aa9,_0x361181){_0x478aa9=_0x478aa9-0x0;var _0x15130a=_0xa301[_0x478aa9];return _0x15130a;};'use strict';var _=require(_0x1a30('0x0'));var util=require(_0x1a30('0x1'));var moment=require(_0x1a30('0x2'));var BPromise=require(_0x1a30('0x3'));var rs=require(_0x1a30('0x4'));var fs=require('fs');var Redis=require(_0x1a30('0x5'));var db=require(_0x1a30('0x6'))['db'];var utils=require(_0x1a30('0x7'));var logger=require(_0x1a30('0x8'))(_0x1a30('0x9'));var config=require(_0x1a30('0xa'));var jayson=require(_0x1a30('0xb'));var client=jayson[_0x1a30('0xc')][_0x1a30('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1c7ad3,_0x42d8bf,_0xf09ad4){return new BPromise(function(_0x351530,_0x852463){return client[_0x1a30('0xe')](_0x1c7ad3,_0xf09ad4)[_0x1a30('0xf')](function(_0x2dce61){logger[_0x1a30('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x42d8bf,'request\x20sent');logger['debug'](_0x1a30('0x11'),_0x42d8bf,_0x1a30('0x12'),JSON[_0x1a30('0x13')](_0x2dce61));if(_0x2dce61[_0x1a30('0x14')]){if(_0x2dce61['error']['code']===0x1f4){logger[_0x1a30('0x14')](_0x1a30('0x15'),_0x42d8bf,_0x2dce61[_0x1a30('0x14')][_0x1a30('0x16')]);return _0x852463(_0x2dce61[_0x1a30('0x14')]['message']);}logger[_0x1a30('0x14')](_0x1a30('0x15'),_0x42d8bf,_0x2dce61[_0x1a30('0x14')][_0x1a30('0x16')]);return _0x351530(_0x2dce61[_0x1a30('0x14')][_0x1a30('0x16')]);}else{logger[_0x1a30('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x42d8bf,_0x1a30('0x12'));_0x351530(_0x2dce61[_0x1a30('0x17')]['message']);}})[_0x1a30('0x18')](function(_0x159c61){logger[_0x1a30('0x14')](_0x1a30('0x15'),_0x42d8bf,_0x159c61);_0x852463(_0x159c61);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 421e412..20aff3c 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 _0x4907=['Router','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x4cb241,_0x5de20a){var _0x3b6b11=function(_0x3bb54f){while(--_0x3bb54f){_0x4cb241['push'](_0x4cb241['shift']());}};_0x3b6b11(++_0x5de20a);}(_0x4907,0xaf));var _0x7490=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4907[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7490('0x0'));var util=require(_0x7490('0x1'));var path=require(_0x7490('0x2'));var timeout=require(_0x7490('0x3'));var express=require(_0x7490('0x4'));var router=express[_0x7490('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7490('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7490('0x7'));var controller=require(_0x7490('0x8'));router[_0x7490('0x9')]('/',auth[_0x7490('0xa')](),controller[_0x7490('0xb')]);router['get'](_0x7490('0xc'),auth[_0x7490('0xa')](),controller[_0x7490('0xd')]);router[_0x7490('0xe')]('/',auth['isAuthenticated'](),controller[_0x7490('0xf')]);router[_0x7490('0x10')]('/:id',auth[_0x7490('0xa')](),controller[_0x7490('0x11')]);router['delete'](_0x7490('0xc'),auth[_0x7490('0xa')](),controller[_0x7490('0x12')]);module[_0x7490('0x13')]=router; \ No newline at end of file +var _0xbc00=['post','create','put','/:id','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show'];(function(_0x818378,_0x7c4421){var _0x563b33=function(_0x1a0f22){while(--_0x1a0f22){_0x818378['push'](_0x818378['shift']());}};_0x563b33(++_0x7c4421);}(_0xbc00,0x8c));var _0x0bc0=function(_0x5b8b97,_0x6b4dfa){_0x5b8b97=_0x5b8b97-0x0;var _0x1fdf84=_0xbc00[_0x5b8b97];return _0x1fdf84;};'use strict';var multer=require(_0x0bc0('0x0'));var util=require('util');var path=require(_0x0bc0('0x1'));var timeout=require('connect-timeout');var express=require(_0x0bc0('0x2'));var router=express[_0x0bc0('0x3')]();var fs_extra=require(_0x0bc0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0bc0('0x5'));var config=require(_0x0bc0('0x6'));var controller=require(_0x0bc0('0x7'));router[_0x0bc0('0x8')]('/',auth[_0x0bc0('0x9')](),controller[_0x0bc0('0xa')]);router[_0x0bc0('0x8')]('/:id',auth[_0x0bc0('0x9')](),controller[_0x0bc0('0xb')]);router[_0x0bc0('0xc')]('/',auth['isAuthenticated'](),controller[_0x0bc0('0xd')]);router[_0x0bc0('0xe')](_0x0bc0('0xf'),auth[_0x0bc0('0x9')](),controller[_0x0bc0('0x10')]);router[_0x0bc0('0x11')]('/:id',auth[_0x0bc0('0x9')](),controller[_0x0bc0('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 5f29d74..8fa51a5 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 _0xdf4c=['STRING','BOOLEAN','sequelize','exports','ENUM','customVariable','keyValue','picklist','string'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xdf4c,0x65));var _0xcdf4=function(_0x4b5f91,_0x26c295){_0x4b5f91=_0x4b5f91-0x0;var _0x3c3a04=_0xdf4c[_0x4b5f91];return _0x3c3a04;};'use strict';var Sequelize=require(_0xcdf4('0x0'));module[_0xcdf4('0x1')]={'type':{'type':Sequelize[_0xcdf4('0x2')]('string','variable',_0xcdf4('0x3'),_0xcdf4('0x4'),_0xcdf4('0x5')),'defaultValue':_0xcdf4('0x6')},'content':{'type':Sequelize[_0xcdf4('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xcdf4('0x2')](_0xcdf4('0x6'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xcdf4('0x7')]},'idField':{'type':Sequelize[_0xcdf4('0x7')]},'nameField':{'type':Sequelize[_0xcdf4('0x7')]},'customField':{'type':Sequelize[_0xcdf4('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcdf4('0x7')]}}; \ No newline at end of file +var _0xbf2d=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','ENUM','string'];(function(_0x1abd5b,_0x3c7c53){var _0x3c4add=function(_0x1068cf){while(--_0x1068cf){_0x1abd5b['push'](_0x1abd5b['shift']());}};_0x3c4add(++_0x3c7c53);}(_0xbf2d,0x15c));var _0xdbf2=function(_0x3ce4d1,_0x3e2545){_0x3ce4d1=_0x3ce4d1-0x0;var _0x240364=_0xbf2d[_0x3ce4d1];return _0x240364;};'use strict';var Sequelize=require(_0xdbf2('0x0'));module['exports']={'type':{'type':Sequelize[_0xdbf2('0x1')](_0xdbf2('0x2'),_0xdbf2('0x3'),_0xdbf2('0x4'),_0xdbf2('0x5'),_0xdbf2('0x6')),'defaultValue':_0xdbf2('0x2')},'content':{'type':Sequelize[_0xdbf2('0x7')]},'key':{'type':Sequelize[_0xdbf2('0x7')]},'keyType':{'type':Sequelize[_0xdbf2('0x1')](_0xdbf2('0x2'),'variable',_0xdbf2('0x4'))},'keyContent':{'type':Sequelize[_0xdbf2('0x7')]},'idField':{'type':Sequelize[_0xdbf2('0x7')]},'nameField':{'type':Sequelize[_0xdbf2('0x7')]},'customField':{'type':Sequelize[_0xdbf2('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdbf2('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 0b02f52..8eea1d9 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 _0xef02=['ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','Dynamics365Field','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv'];(function(_0x55957e,_0x2d1769){var _0x37b31b=function(_0x48ba79){while(--_0x48ba79){_0x55957e['push'](_0x55957e['shift']());}};_0x37b31b(++_0x2d1769);}(_0xef02,0x87));var _0x2ef0=function(_0x567bcb,_0x4978c1){_0x567bcb=_0x567bcb-0x0;var _0x4eebc2=_0xef02[_0x567bcb];return _0x4eebc2;};'use strict';var emlformat=require(_0x2ef0('0x0'));var rimraf=require(_0x2ef0('0x1'));var zipdir=require(_0x2ef0('0x2'));var jsonpatch=require(_0x2ef0('0x3'));var rp=require('request-promise');var moment=require(_0x2ef0('0x4'));var BPromise=require(_0x2ef0('0x5'));var Mustache=require(_0x2ef0('0x6'));var util=require(_0x2ef0('0x7'));var path=require(_0x2ef0('0x8'));var sox=require(_0x2ef0('0x9'));var csv=require(_0x2ef0('0xa'));var ejs=require(_0x2ef0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2ef0('0xc'));var squel=require(_0x2ef0('0xd'));var crypto=require(_0x2ef0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2ef0('0xf'));var toCsv=require(_0x2ef0('0xa'));var querystring=require('querystring');var Papa=require(_0x2ef0('0x10'));var Redis=require(_0x2ef0('0x11'));var authService=require(_0x2ef0('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2ef0('0x13'));var hardwareService=require(_0x2ef0('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x2ef0('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xbf8e8f,_0x550638){_0x550638=_0x550638||0xcc;return function(_0x25f638){if(_0x25f638){return _0xbf8e8f[_0x2ef0('0x16')](_0x550638);}return _0xbf8e8f['status'](_0x550638)[_0x2ef0('0x17')]();};}function respondWithResult(_0xc204b3,_0xb5a219){_0xb5a219=_0xb5a219||0xc8;return function(_0x270f83){if(_0x270f83){return _0xc204b3[_0x2ef0('0x18')](_0xb5a219)[_0x2ef0('0x19')](_0x270f83);}};}function respondWithFilteredResult(_0x41a080,_0x2f61fa){return function(_0x4de20d){if(_0x4de20d){var _0x599bf2=typeof _0x2f61fa[_0x2ef0('0x1a')]===_0x2ef0('0x1b')&&typeof _0x2f61fa[_0x2ef0('0x1c')]===_0x2ef0('0x1b');var _0x3a23ef=_0x4de20d[_0x2ef0('0x1d')];var _0x4781e4=_0x599bf2?0x0:_0x2f61fa[_0x2ef0('0x1a')];var _0x7799eb=_0x599bf2?_0x4de20d[_0x2ef0('0x1d')]:_0x2f61fa[_0x2ef0('0x1a')]+_0x2f61fa[_0x2ef0('0x1c')];var _0x5a4adf;if(_0x7799eb>=_0x3a23ef){_0x7799eb=_0x3a23ef;_0x5a4adf=0xc8;}else{_0x5a4adf=0xce;}_0x41a080[_0x2ef0('0x18')](_0x5a4adf);return _0x41a080[_0x2ef0('0x1e')]('Content-Range',_0x4781e4+'-'+_0x7799eb+'/'+_0x3a23ef)['json'](_0x4de20d);}return null;};}function patchUpdates(_0x196ded){return function(_0xe23d2c){try{jsonpatch[_0x2ef0('0x1f')](_0xe23d2c,_0x196ded,!![]);}catch(_0x5a00a7){return BPromise[_0x2ef0('0x20')](_0x5a00a7);}return _0xe23d2c[_0x2ef0('0x21')]();};}function saveUpdates(_0x5cbcc5,_0x41bd58){return function(_0x5a6e35){if(_0x5a6e35){return _0x5a6e35[_0x2ef0('0x22')](_0x5cbcc5)[_0x2ef0('0x23')](function(_0x244e98){return _0x244e98;});}return null;};}function removeEntity(_0x5462cd,_0x560f68){return function(_0x29e095){if(_0x29e095){return _0x29e095[_0x2ef0('0x24')]()[_0x2ef0('0x23')](function(){_0x5462cd[_0x2ef0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x235770,_0x5da1dd){return function(_0x3ba431){if(!_0x3ba431){_0x235770[_0x2ef0('0x16')](0x194);}return _0x3ba431;};}function handleError(_0x397a3d,_0xa7ef5a){_0xa7ef5a=_0xa7ef5a||0x1f4;return function(_0x8a4f71){logger[_0x2ef0('0x25')](_0x8a4f71[_0x2ef0('0x26')]);if(_0x8a4f71[_0x2ef0('0x27')]){delete _0x8a4f71[_0x2ef0('0x27')];}_0x397a3d[_0x2ef0('0x18')](_0xa7ef5a)['send'](_0x8a4f71);};}exports[_0x2ef0('0x28')]=function(_0x1cf945,_0x391393){var _0x32d6ba={},_0x575935={},_0x451b73={'count':0x0,'rows':[]};var _0xe9035f=_[_0x2ef0('0x29')](db[_0x2ef0('0x2a')]['rawAttributes'],function(_0x838599){return{'name':_0x838599[_0x2ef0('0x2b')],'type':_0x838599[_0x2ef0('0x2c')][_0x2ef0('0x2d')]};});_0x575935['model']=_[_0x2ef0('0x29')](_0xe9035f,_0x2ef0('0x27'));_0x575935['query']=_[_0x2ef0('0x2e')](_0x1cf945[_0x2ef0('0x2f')]);_0x575935[_0x2ef0('0x30')]=_['intersection'](_0x575935[_0x2ef0('0x31')],_0x575935['query']);_0x32d6ba[_0x2ef0('0x32')]=_[_0x2ef0('0x33')](_0x575935[_0x2ef0('0x31')],qs[_0x2ef0('0x34')](_0x1cf945[_0x2ef0('0x2f')][_0x2ef0('0x34')]));_0x32d6ba['attributes']=_0x32d6ba[_0x2ef0('0x32')][_0x2ef0('0x35')]?_0x32d6ba[_0x2ef0('0x32')]:_0x575935[_0x2ef0('0x31')];if(!_0x1cf945[_0x2ef0('0x2f')]['hasOwnProperty'](_0x2ef0('0x36'))){_0x32d6ba[_0x2ef0('0x1c')]=qs['limit'](_0x1cf945[_0x2ef0('0x2f')][_0x2ef0('0x1c')]);_0x32d6ba['offset']=qs[_0x2ef0('0x1a')](_0x1cf945[_0x2ef0('0x2f')][_0x2ef0('0x1a')]);}_0x32d6ba[_0x2ef0('0x37')]=qs[_0x2ef0('0x38')](_0x1cf945[_0x2ef0('0x2f')][_0x2ef0('0x38')]);_0x32d6ba[_0x2ef0('0x39')]=qs[_0x2ef0('0x30')](_[_0x2ef0('0x3a')](_0x1cf945['query'],_0x575935[_0x2ef0('0x30')]),_0xe9035f);if(_0x1cf945['query'][_0x2ef0('0x3b')]){_0x32d6ba[_0x2ef0('0x39')]=_[_0x2ef0('0x3c')](_0x32d6ba['where'],{'$or':_['map'](_0xe9035f,function(_0x84661f){if(_0x84661f[_0x2ef0('0x2c')]!==_0x2ef0('0x3d')){var _0x4fc5c0={};_0x4fc5c0[_0x84661f[_0x2ef0('0x27')]]={'$like':'%'+_0x1cf945['query']['filter']+'%'};return _0x4fc5c0;}})});}_0x32d6ba=_[_0x2ef0('0x3c')]({},_0x32d6ba,_0x1cf945[_0x2ef0('0x3e')]);var _0x12ec80={'where':_0x32d6ba[_0x2ef0('0x39')]};return db['Dynamics365Field'][_0x2ef0('0x1d')](_0x12ec80)[_0x2ef0('0x23')](function(_0x116130){_0x451b73[_0x2ef0('0x1d')]=_0x116130;if(_0x1cf945[_0x2ef0('0x2f')][_0x2ef0('0x3f')]){_0x32d6ba[_0x2ef0('0x40')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x2ef0('0x41')](_0x32d6ba);})[_0x2ef0('0x23')](function(_0x632966){_0x451b73[_0x2ef0('0x42')]=_0x632966;return _0x451b73;})[_0x2ef0('0x23')](respondWithFilteredResult(_0x391393,_0x32d6ba))[_0x2ef0('0x43')](handleError(_0x391393,null));};exports[_0x2ef0('0x44')]=function(_0x3b48df,_0x3b4a7e){var _0x1f9b28={'raw':!![],'where':{'id':_0x3b48df[_0x2ef0('0x45')]['id']}},_0xc1ebde={};_0xc1ebde['model']=_['keys'](db[_0x2ef0('0x2a')]['rawAttributes']);_0xc1ebde[_0x2ef0('0x2f')]=_[_0x2ef0('0x2e')](_0x3b48df['query']);_0xc1ebde['filters']=_[_0x2ef0('0x33')](_0xc1ebde[_0x2ef0('0x31')],_0xc1ebde['query']);_0x1f9b28[_0x2ef0('0x32')]=_['intersection'](_0xc1ebde[_0x2ef0('0x31')],qs[_0x2ef0('0x34')](_0x3b48df[_0x2ef0('0x2f')][_0x2ef0('0x34')]));_0x1f9b28[_0x2ef0('0x32')]=_0x1f9b28[_0x2ef0('0x32')][_0x2ef0('0x35')]?_0x1f9b28[_0x2ef0('0x32')]:_0xc1ebde[_0x2ef0('0x31')];if(_0x3b48df['query'][_0x2ef0('0x3f')]){_0x1f9b28[_0x2ef0('0x40')]=[{'all':!![]}];}_0x1f9b28=_[_0x2ef0('0x3c')]({},_0x1f9b28,_0x3b48df[_0x2ef0('0x3e')]);return db[_0x2ef0('0x2a')][_0x2ef0('0x46')](_0x1f9b28)[_0x2ef0('0x23')](handleEntityNotFound(_0x3b4a7e,null))[_0x2ef0('0x23')](respondWithResult(_0x3b4a7e,null))[_0x2ef0('0x43')](handleError(_0x3b4a7e,null));};exports['create']=function(_0x271d63,_0x5919b7){return db[_0x2ef0('0x2a')][_0x2ef0('0x47')](_0x271d63[_0x2ef0('0x48')],{})[_0x2ef0('0x23')](respondWithResult(_0x5919b7,0xc9))['catch'](handleError(_0x5919b7,null));};exports[_0x2ef0('0x22')]=function(_0x24284a,_0x2eb266){if(_0x24284a[_0x2ef0('0x48')]['id']){delete _0x24284a[_0x2ef0('0x48')]['id'];}return db[_0x2ef0('0x2a')][_0x2ef0('0x46')]({'where':{'id':_0x24284a[_0x2ef0('0x45')]['id']}})[_0x2ef0('0x23')](handleEntityNotFound(_0x2eb266,null))[_0x2ef0('0x23')](saveUpdates(_0x24284a[_0x2ef0('0x48')],null))['then'](respondWithResult(_0x2eb266,null))[_0x2ef0('0x43')](handleError(_0x2eb266,null));};exports[_0x2ef0('0x24')]=function(_0x473b06,_0xf2ae3d){return db['Dynamics365Field'][_0x2ef0('0x46')]({'where':{'id':_0x473b06[_0x2ef0('0x45')]['id']}})[_0x2ef0('0x23')](handleEntityNotFound(_0xf2ae3d,null))[_0x2ef0('0x23')](removeEntity(_0xf2ae3d,null))[_0x2ef0('0x43')](handleError(_0xf2ae3d,null));}; \ No newline at end of file +var _0x3d29=['include','findAll','show','keys','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll'];(function(_0x45050c,_0x2c514e){var _0x43be36=function(_0x48cb3a){while(--_0x48cb3a){_0x45050c['push'](_0x45050c['shift']());}};_0x43be36(++_0x2c514e);}(_0x3d29,0x137));var _0x93d2=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0x3d29[_0x1646fa];return _0x5a47a5;};'use strict';var emlformat=require(_0x93d2('0x0'));var rimraf=require(_0x93d2('0x1'));var zipdir=require(_0x93d2('0x2'));var jsonpatch=require(_0x93d2('0x3'));var rp=require('request-promise');var moment=require(_0x93d2('0x4'));var BPromise=require(_0x93d2('0x5'));var Mustache=require(_0x93d2('0x6'));var util=require('util');var path=require(_0x93d2('0x7'));var sox=require(_0x93d2('0x8'));var csv=require(_0x93d2('0x9'));var ejs=require(_0x93d2('0xa'));var fs=require('fs');var fs_extra=require(_0x93d2('0xb'));var _=require(_0x93d2('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x93d2('0xd'));var deskjs=require(_0x93d2('0xe'));var toCsv=require(_0x93d2('0x9'));var querystring=require(_0x93d2('0xf'));var Papa=require(_0x93d2('0x10'));var Redis=require(_0x93d2('0x11'));var authService=require(_0x93d2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x93d2('0x13'));var hardwareService=require(_0x93d2('0x14'));var logger=require(_0x93d2('0x15'))(_0x93d2('0x16'));var utils=require(_0x93d2('0x17'));var config=require(_0x93d2('0x18'));var licenseUtil=require(_0x93d2('0x19'));var db=require(_0x93d2('0x1a'))['db'];function respondWithStatusCode(_0x5e1e1f,_0x3b8ef9){_0x3b8ef9=_0x3b8ef9||0xcc;return function(_0x1059b5){if(_0x1059b5){return _0x5e1e1f[_0x93d2('0x1b')](_0x3b8ef9);}return _0x5e1e1f[_0x93d2('0x1c')](_0x3b8ef9)['end']();};}function respondWithResult(_0x54264c,_0x1cc304){_0x1cc304=_0x1cc304||0xc8;return function(_0x40dfd9){if(_0x40dfd9){return _0x54264c['status'](_0x1cc304)[_0x93d2('0x1d')](_0x40dfd9);}};}function respondWithFilteredResult(_0x10976d,_0x3c2b71){return function(_0x572a62){if(_0x572a62){var _0x4f5bd3=typeof _0x3c2b71['offset']===_0x93d2('0x1e')&&typeof _0x3c2b71[_0x93d2('0x1f')]==='undefined';var _0x224790=_0x572a62[_0x93d2('0x20')];var _0x4b8443=_0x4f5bd3?0x0:_0x3c2b71['offset'];var _0x438264=_0x4f5bd3?_0x572a62[_0x93d2('0x20')]:_0x3c2b71[_0x93d2('0x21')]+_0x3c2b71[_0x93d2('0x1f')];var _0x364966;if(_0x438264>=_0x224790){_0x438264=_0x224790;_0x364966=0xc8;}else{_0x364966=0xce;}_0x10976d['status'](_0x364966);return _0x10976d[_0x93d2('0x22')](_0x93d2('0x23'),_0x4b8443+'-'+_0x438264+'/'+_0x224790)[_0x93d2('0x1d')](_0x572a62);}return null;};}function patchUpdates(_0x5d4235){return function(_0x425d51){try{jsonpatch[_0x93d2('0x24')](_0x425d51,_0x5d4235,!![]);}catch(_0x38ada4){return BPromise[_0x93d2('0x25')](_0x38ada4);}return _0x425d51[_0x93d2('0x26')]();};}function saveUpdates(_0x5df3b1,_0x1248bc){return function(_0x53d77d){if(_0x53d77d){return _0x53d77d[_0x93d2('0x27')](_0x5df3b1)[_0x93d2('0x28')](function(_0x2292cf){return _0x2292cf;});}return null;};}function removeEntity(_0x52e73f,_0x47252b){return function(_0x3a41d8){if(_0x3a41d8){return _0x3a41d8[_0x93d2('0x29')]()[_0x93d2('0x28')](function(){_0x52e73f['status'](0xcc)[_0x93d2('0x2a')]();});}};}function handleEntityNotFound(_0x171ddb,_0x1d1fb6){return function(_0x373ae5){if(!_0x373ae5){_0x171ddb[_0x93d2('0x1b')](0x194);}return _0x373ae5;};}function handleError(_0x1fae14,_0x155562){_0x155562=_0x155562||0x1f4;return function(_0x4c17f9){logger['error'](_0x4c17f9[_0x93d2('0x2b')]);if(_0x4c17f9[_0x93d2('0x2c')]){delete _0x4c17f9[_0x93d2('0x2c')];}_0x1fae14[_0x93d2('0x1c')](_0x155562)[_0x93d2('0x2d')](_0x4c17f9);};}exports[_0x93d2('0x2e')]=function(_0x45e324,_0x363059){var _0x46d870={},_0x3deec3={},_0x536898={'count':0x0,'rows':[]};var _0x143c78=_[_0x93d2('0x2f')](db[_0x93d2('0x30')][_0x93d2('0x31')],function(_0x380a4a){return{'name':_0x380a4a[_0x93d2('0x32')],'type':_0x380a4a['type'][_0x93d2('0x33')]};});_0x3deec3[_0x93d2('0x34')]=_[_0x93d2('0x2f')](_0x143c78,_0x93d2('0x2c'));_0x3deec3[_0x93d2('0x35')]=_['keys'](_0x45e324[_0x93d2('0x35')]);_0x3deec3[_0x93d2('0x36')]=_[_0x93d2('0x37')](_0x3deec3['model'],_0x3deec3[_0x93d2('0x35')]);_0x46d870[_0x93d2('0x38')]=_['intersection'](_0x3deec3[_0x93d2('0x34')],qs['fields'](_0x45e324['query'][_0x93d2('0x39')]));_0x46d870[_0x93d2('0x38')]=_0x46d870[_0x93d2('0x38')][_0x93d2('0x3a')]?_0x46d870[_0x93d2('0x38')]:_0x3deec3[_0x93d2('0x34')];if(!_0x45e324[_0x93d2('0x35')][_0x93d2('0x3b')]('nolimit')){_0x46d870['limit']=qs[_0x93d2('0x1f')](_0x45e324[_0x93d2('0x35')]['limit']);_0x46d870[_0x93d2('0x21')]=qs['offset'](_0x45e324[_0x93d2('0x35')]['offset']);}_0x46d870[_0x93d2('0x3c')]=qs['sort'](_0x45e324[_0x93d2('0x35')][_0x93d2('0x3d')]);_0x46d870[_0x93d2('0x3e')]=qs[_0x93d2('0x36')](_['pick'](_0x45e324[_0x93d2('0x35')],_0x3deec3[_0x93d2('0x36')]),_0x143c78);if(_0x45e324[_0x93d2('0x35')][_0x93d2('0x3f')]){_0x46d870[_0x93d2('0x3e')]=_['merge'](_0x46d870[_0x93d2('0x3e')],{'$or':_[_0x93d2('0x2f')](_0x143c78,function(_0x546174){if(_0x546174[_0x93d2('0x40')]!==_0x93d2('0x41')){var _0x33bcf6={};_0x33bcf6[_0x546174['name']]={'$like':'%'+_0x45e324['query']['filter']+'%'};return _0x33bcf6;}})});}_0x46d870=_[_0x93d2('0x42')]({},_0x46d870,_0x45e324[_0x93d2('0x43')]);var _0x5d5924={'where':_0x46d870[_0x93d2('0x3e')]};return db[_0x93d2('0x30')][_0x93d2('0x20')](_0x5d5924)['then'](function(_0x4b3576){_0x536898[_0x93d2('0x20')]=_0x4b3576;if(_0x45e324[_0x93d2('0x35')][_0x93d2('0x44')]){_0x46d870[_0x93d2('0x45')]=[{'all':!![]}];}return db[_0x93d2('0x30')][_0x93d2('0x46')](_0x46d870);})[_0x93d2('0x28')](function(_0x171019){_0x536898['rows']=_0x171019;return _0x536898;})[_0x93d2('0x28')](respondWithFilteredResult(_0x363059,_0x46d870))['catch'](handleError(_0x363059,null));};exports[_0x93d2('0x47')]=function(_0x50a719,_0x1ce0e8){var _0x4a2014={'raw':!![],'where':{'id':_0x50a719['params']['id']}},_0x453bd4={};_0x453bd4[_0x93d2('0x34')]=_[_0x93d2('0x48')](db[_0x93d2('0x30')][_0x93d2('0x31')]);_0x453bd4[_0x93d2('0x35')]=_[_0x93d2('0x48')](_0x50a719[_0x93d2('0x35')]);_0x453bd4[_0x93d2('0x36')]=_[_0x93d2('0x37')](_0x453bd4['model'],_0x453bd4['query']);_0x4a2014[_0x93d2('0x38')]=_[_0x93d2('0x37')](_0x453bd4[_0x93d2('0x34')],qs[_0x93d2('0x39')](_0x50a719['query'][_0x93d2('0x39')]));_0x4a2014['attributes']=_0x4a2014['attributes']['length']?_0x4a2014[_0x93d2('0x38')]:_0x453bd4[_0x93d2('0x34')];if(_0x50a719[_0x93d2('0x35')][_0x93d2('0x44')]){_0x4a2014['include']=[{'all':!![]}];}_0x4a2014=_['merge']({},_0x4a2014,_0x50a719['options']);return db[_0x93d2('0x30')]['find'](_0x4a2014)['then'](handleEntityNotFound(_0x1ce0e8,null))[_0x93d2('0x28')](respondWithResult(_0x1ce0e8,null))[_0x93d2('0x49')](handleError(_0x1ce0e8,null));};exports['create']=function(_0x5ebc5e,_0x1f4db5){return db['Dynamics365Field']['create'](_0x5ebc5e[_0x93d2('0x4a')],{})['then'](respondWithResult(_0x1f4db5,0xc9))[_0x93d2('0x49')](handleError(_0x1f4db5,null));};exports[_0x93d2('0x27')]=function(_0x3ed0bd,_0x764154){if(_0x3ed0bd[_0x93d2('0x4a')]['id']){delete _0x3ed0bd['body']['id'];}return db[_0x93d2('0x30')][_0x93d2('0x4b')]({'where':{'id':_0x3ed0bd['params']['id']}})[_0x93d2('0x28')](handleEntityNotFound(_0x764154,null))['then'](saveUpdates(_0x3ed0bd[_0x93d2('0x4a')],null))['then'](respondWithResult(_0x764154,null))[_0x93d2('0x49')](handleError(_0x764154,null));};exports[_0x93d2('0x29')]=function(_0x504445,_0x1cf934){return db['Dynamics365Field'][_0x93d2('0x4b')]({'where':{'id':_0x504445['params']['id']}})[_0x93d2('0x28')](handleEntityNotFound(_0x1cf934,null))[_0x93d2('0x28')](removeEntity(_0x1cf934,null))[_0x93d2('0x49')](handleError(_0x1cf934,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 92076ca..d113e1b 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 _0x97d5=['moment','bluebird','path','rimraf','../../config/environment','exports','define','Dynamics365Field','dynamics365_unique_index','idField','lodash','util'];(function(_0x249564,_0x4af855){var _0x2e71ef=function(_0x3a56c5){while(--_0x3a56c5){_0x249564['push'](_0x249564['shift']());}};_0x2e71ef(++_0x4af855);}(_0x97d5,0x112));var _0x597d=function(_0x38fcee,_0x250061){_0x38fcee=_0x38fcee-0x0;var _0x2b1e5a=_0x97d5[_0x38fcee];return _0x2b1e5a;};'use strict';var _=require(_0x597d('0x0'));var util=require(_0x597d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x597d('0x2'));var BPromise=require(_0x597d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x597d('0x4'));var rimraf=require(_0x597d('0x5'));var config=require(_0x597d('0x6'));var attributes=require('./intDynamics365Field.attributes');module[_0x597d('0x7')]=function(_0x306ab5,_0x3ce894){return _0x306ab5[_0x597d('0x8')](_0x597d('0x9'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x597d('0xa'),'fields':[_0x597d('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7368=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId'];(function(_0x14a34a,_0x424129){var _0x4d921e=function(_0x1982be){while(--_0x1982be){_0x14a34a['push'](_0x14a34a['shift']());}};_0x4d921e(++_0x424129);}(_0x7368,0x1d0));var _0x8736=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7368[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x8736('0x0'));var logger=require(_0x8736('0x1'))(_0x8736('0x2'));var moment=require(_0x8736('0x3'));var BPromise=require(_0x8736('0x4'));var rp=require(_0x8736('0x5'));var fs=require('fs');var path=require(_0x8736('0x6'));var rimraf=require('rimraf');var config=require(_0x8736('0x7'));var attributes=require(_0x8736('0x8'));module[_0x8736('0x9')]=function(_0x3f819a,_0x3249fb){return _0x3f819a[_0x8736('0xa')](_0x8736('0xb'),attributes,{'tableName':_0x8736('0xc'),'paranoid':![],'indexes':[{'name':_0x8736('0xd'),'fields':[_0x8736('0xe'),_0x8736('0xf')],'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 2c13778..6f41a62 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 _0x799c=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x4046fd,_0x290274){var _0x47ab97=function(_0x167c1c){while(--_0x167c1c){_0x4046fd['push'](_0x4046fd['shift']());}};_0x47ab97(++_0x290274);}(_0x799c,0xe4));var _0xc799=function(_0xd2b1d0,_0x5b3b08){_0xd2b1d0=_0xd2b1d0-0x0;var _0x4dbcc4=_0x799c[_0xd2b1d0];return _0x4dbcc4;};'use strict';var _=require(_0xc799('0x0'));var util=require(_0xc799('0x1'));var moment=require('moment');var BPromise=require(_0xc799('0x2'));var rs=require(_0xc799('0x3'));var fs=require('fs');var Redis=require(_0xc799('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc799('0x5'));var logger=require(_0xc799('0x6'))(_0xc799('0x7'));var config=require('../../config/environment');var jayson=require(_0xc799('0x8'));var client=jayson[_0xc799('0x9')][_0xc799('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x596d51,_0x4867b9,_0x3402c4){return new BPromise(function(_0x1d2787,_0x266d62){return client[_0xc799('0xb')](_0x596d51,_0x3402c4)[_0xc799('0xc')](function(_0x356a80){logger[_0xc799('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x4867b9,_0xc799('0xe'));logger['debug'](_0xc799('0xf'),_0x4867b9,_0xc799('0xe'),JSON[_0xc799('0x10')](_0x356a80));if(_0x356a80[_0xc799('0x11')]){if(_0x356a80['error'][_0xc799('0x12')]===0x1f4){logger[_0xc799('0x11')](_0xc799('0x13'),_0x4867b9,_0x356a80['error'][_0xc799('0x14')]);return _0x266d62(_0x356a80[_0xc799('0x11')]['message']);}logger[_0xc799('0x11')](_0xc799('0x13'),_0x4867b9,_0x356a80[_0xc799('0x11')][_0xc799('0x14')]);return _0x1d2787(_0x356a80[_0xc799('0x11')][_0xc799('0x14')]);}else{logger['info'](_0xc799('0x13'),_0x4867b9,_0xc799('0xe'));_0x1d2787(_0x356a80[_0xc799('0x15')]['message']);}})[_0xc799('0x16')](function(_0x466a62){logger[_0xc799('0x11')](_0xc799('0x13'),_0x4867b9,_0x466a62);_0x266d62(_0x466a62);});});} \ No newline at end of file +var _0x08ca=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0x08ca,0xb5));var _0xa08c=function(_0x20ad90,_0x426723){_0x20ad90=_0x20ad90-0x0;var _0xb4b6fb=_0x08ca[_0x20ad90];return _0xb4b6fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa08c('0x0'));var BPromise=require(_0xa08c('0x1'));var rs=require(_0xa08c('0x2'));var fs=require('fs');var Redis=require(_0xa08c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa08c('0x4'));var logger=require(_0xa08c('0x5'))(_0xa08c('0x6'));var config=require('../../config/environment');var jayson=require(_0xa08c('0x7'));var client=jayson[_0xa08c('0x8')][_0xa08c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5eb58c,_0x5726a8,_0x51eb48){return new BPromise(function(_0x108ade,_0x5e57e4){return client[_0xa08c('0xa')](_0x5eb58c,_0x51eb48)[_0xa08c('0xb')](function(_0x4ea7cd){logger[_0xa08c('0xc')](_0xa08c('0xd'),_0x5726a8,'request\x20sent');logger[_0xa08c('0xe')](_0xa08c('0xf'),_0x5726a8,_0xa08c('0x10'),JSON[_0xa08c('0x11')](_0x4ea7cd));if(_0x4ea7cd[_0xa08c('0x12')]){if(_0x4ea7cd[_0xa08c('0x12')][_0xa08c('0x13')]===0x1f4){logger['error'](_0xa08c('0xd'),_0x5726a8,_0x4ea7cd[_0xa08c('0x12')][_0xa08c('0x14')]);return _0x5e57e4(_0x4ea7cd[_0xa08c('0x12')][_0xa08c('0x14')]);}logger[_0xa08c('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0x5726a8,_0x4ea7cd[_0xa08c('0x12')][_0xa08c('0x14')]);return _0x108ade(_0x4ea7cd[_0xa08c('0x12')][_0xa08c('0x14')]);}else{logger[_0xa08c('0xc')](_0xa08c('0xd'),_0x5726a8,_0xa08c('0x10'));_0x108ade(_0x4ea7cd[_0xa08c('0x15')]['message']);}})[_0xa08c('0x16')](function(_0x3bba56){logger['error'](_0xa08c('0xd'),_0x5726a8,_0x3bba56);_0x5e57e4(_0x3bba56);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index b764904..682da09 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 _0xf83a=['addConfiguration','/:id','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','show','/:id/configurations','isAuthenticated','getConfigurations','getFields','create','post'];(function(_0x4ae4ea,_0x327b6c){var _0x45dfe7=function(_0x3a7f75){while(--_0x3a7f75){_0x4ae4ea['push'](_0x4ae4ea['shift']());}};_0x45dfe7(++_0x327b6c);}(_0xf83a,0x1a8));var _0xaf83=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xf83a[_0x173441];return _0x2423a8;};'use strict';var multer=require('multer');var util=require(_0xaf83('0x0'));var path=require(_0xaf83('0x1'));var timeout=require(_0xaf83('0x2'));var express=require('express');var router=express[_0xaf83('0x3')]();var fs_extra=require(_0xaf83('0x4'));var auth=require(_0xaf83('0x5'));var interaction=require(_0xaf83('0x6'));var config=require(_0xaf83('0x7'));var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xaf83('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xaf83('0x9')]);router[_0xaf83('0x8')](_0xaf83('0xa'),auth[_0xaf83('0xb')](),controller[_0xaf83('0xc')]);router[_0xaf83('0x8')]('/:id/fields',auth[_0xaf83('0xb')](),controller[_0xaf83('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaf83('0xe')]);router[_0xaf83('0xf')](_0xaf83('0xa'),auth[_0xaf83('0xb')](),controller[_0xaf83('0x10')]);router['put'](_0xaf83('0x11'),auth[_0xaf83('0xb')](),controller[_0xaf83('0x12')]);router[_0xaf83('0x13')](_0xaf83('0x11'),auth[_0xaf83('0xb')](),controller[_0xaf83('0x14')]);module[_0xaf83('0x15')]=router; \ No newline at end of file +var _0xcd92=['update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','/:id'];(function(_0xace5bb,_0x4322f6){var _0x37bd48=function(_0x1d31c7){while(--_0x1d31c7){_0xace5bb['push'](_0xace5bb['shift']());}};_0x37bd48(++_0x4322f6);}(_0xcd92,0x145));var _0x2cd9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcd92[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x2cd9('0x0'));var util=require(_0x2cd9('0x1'));var path=require(_0x2cd9('0x2'));var timeout=require('connect-timeout');var express=require(_0x2cd9('0x3'));var router=express[_0x2cd9('0x4')]();var fs_extra=require(_0x2cd9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2cd9('0x6'));var config=require(_0x2cd9('0x7'));var controller=require(_0x2cd9('0x8'));router['get']('/',auth[_0x2cd9('0x9')](),controller[_0x2cd9('0xa')]);router[_0x2cd9('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x2cd9('0xc')]);router[_0x2cd9('0xb')](_0x2cd9('0xd'),auth[_0x2cd9('0x9')](),controller[_0x2cd9('0xe')]);router[_0x2cd9('0xb')](_0x2cd9('0xf'),auth[_0x2cd9('0x9')](),controller['getFields']);router[_0x2cd9('0x10')]('/',auth[_0x2cd9('0x9')](),controller[_0x2cd9('0x11')]);router[_0x2cd9('0x10')](_0x2cd9('0xd'),auth[_0x2cd9('0x9')](),controller[_0x2cd9('0x12')]);router['put'](_0x2cd9('0x13'),auth[_0x2cd9('0x9')](),controller[_0x2cd9('0x14')]);router[_0x2cd9('0x15')]('/:id',auth[_0x2cd9('0x9')](),controller['destroy']);module[_0x2cd9('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 0f8211d..e4dc5e0 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 _0x4888=['exports','STRING','username'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x4888,0x198));var _0x8488=function(_0x3893da,_0x22bffb){_0x3893da=_0x3893da-0x0;var _0x1c3533=_0x4888[_0x3893da];return _0x1c3533;};'use strict';var Sequelize=require('sequelize');module[_0x8488('0x0')]={'name':{'type':Sequelize[_0x8488('0x1')]},'description':{'type':Sequelize[_0x8488('0x1')]},'username':{'type':Sequelize[_0x8488('0x1')],'unique':_0x8488('0x2')},'apiKey':{'type':Sequelize[_0x8488('0x1')]},'remoteUri':{'type':Sequelize[_0x8488('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x8488('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x02ce=['sequelize','exports','STRING','remoteUri'];(function(_0x201a2c,_0x3f9b89){var _0xc2d156=function(_0x3b80f6){while(--_0x3b80f6){_0x201a2c['push'](_0x201a2c['shift']());}};_0xc2d156(++_0x3f9b89);}(_0x02ce,0x1ac));var _0xe02c=function(_0x38c8cf,_0x4de14c){_0x38c8cf=_0x38c8cf-0x0;var _0x41e01d=_0x02ce[_0x38c8cf];return _0x41e01d;};'use strict';var Sequelize=require(_0xe02c('0x0'));module[_0xe02c('0x1')]={'name':{'type':Sequelize[_0xe02c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe02c('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xe02c('0x2')]},'remoteUri':{'type':Sequelize[_0xe02c('0x2')],'unique':_0xe02c('0x3')},'serverUrl':{'type':Sequelize[_0xe02c('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 994d994..7e73a7e 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 _0x082b=['choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','Content-Range','save','update','destroy','then','end','stack','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','where','pick','merge','VIRTUAL','filter','count','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','sort','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','description','priority','group','source','company','remove','default','custom_text','custom_dropdown','label'];(function(_0x242a4f,_0x369c57){var _0x122117=function(_0x55a797){while(--_0x55a797){_0x242a4f['push'](_0x242a4f['shift']());}};_0x122117(++_0x369c57);}(_0x082b,0x1ec));var _0xb082=function(_0x2fc9fc,_0x112f57){_0x2fc9fc=_0x2fc9fc-0x0;var _0x2e4946=_0x082b[_0x2fc9fc];return _0x2e4946;};'use strict';var emlformat=require(_0xb082('0x0'));var rimraf=require(_0xb082('0x1'));var zipdir=require(_0xb082('0x2'));var jsonpatch=require(_0xb082('0x3'));var rp=require('request-promise');var moment=require(_0xb082('0x4'));var BPromise=require(_0xb082('0x5'));var Mustache=require('mustache');var util=require(_0xb082('0x6'));var path=require(_0xb082('0x7'));var sox=require('sox');var csv=require(_0xb082('0x8'));var ejs=require(_0xb082('0x9'));var fs=require('fs');var fs_extra=require(_0xb082('0xa'));var _=require(_0xb082('0xb'));var squel=require('squel');var crypto=require(_0xb082('0xc'));var jsforce=require(_0xb082('0xd'));var deskjs=require(_0xb082('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb082('0xf'));var Papa=require(_0xb082('0x10'));var Redis=require(_0xb082('0x11'));var authService=require(_0xb082('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb082('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb082('0x14'))(_0xb082('0x15'));var utils=require(_0xb082('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb082('0x17'));var db=require(_0xb082('0x18'))['db'];var integrations=require(_0xb082('0x19'));function respondWithStatusCode(_0x4426db,_0x20a748){_0x20a748=_0x20a748||0xcc;return function(_0xe23a4c){if(_0xe23a4c){return _0x4426db[_0xb082('0x1a')](_0x20a748);}return _0x4426db[_0xb082('0x1b')](_0x20a748)['end']();};}function respondWithResult(_0x1853f3,_0xbf588f){_0xbf588f=_0xbf588f||0xc8;return function(_0x41bace){if(_0x41bace){return _0x1853f3[_0xb082('0x1b')](_0xbf588f)[_0xb082('0x1c')](_0x41bace);}};}function respondWithFilteredResult(_0x4dec1b,_0x1738f2){return function(_0x37aa44){if(_0x37aa44){var _0x1afef2=typeof _0x1738f2[_0xb082('0x1d')]===_0xb082('0x1e')&&typeof _0x1738f2[_0xb082('0x1f')]===_0xb082('0x1e');var _0x4a46ad=_0x37aa44['count'];var _0x5c81bd=_0x1afef2?0x0:_0x1738f2[_0xb082('0x1d')];var _0x410965=_0x1afef2?_0x37aa44['count']:_0x1738f2[_0xb082('0x1d')]+_0x1738f2[_0xb082('0x1f')];var _0x383b57;if(_0x410965>=_0x4a46ad){_0x410965=_0x4a46ad;_0x383b57=0xc8;}else{_0x383b57=0xce;}_0x4dec1b[_0xb082('0x1b')](_0x383b57);return _0x4dec1b['set'](_0xb082('0x20'),_0x5c81bd+'-'+_0x410965+'/'+_0x4a46ad)[_0xb082('0x1c')](_0x37aa44);}return null;};}function patchUpdates(_0x74e6cc){return function(_0x3ad816){try{jsonpatch['apply'](_0x3ad816,_0x74e6cc,!![]);}catch(_0x3d7004){return BPromise['reject'](_0x3d7004);}return _0x3ad816[_0xb082('0x21')]();};}function saveUpdates(_0x470420,_0x158caa){return function(_0x3ef4cd){if(_0x3ef4cd){return _0x3ef4cd[_0xb082('0x22')](_0x470420)['then'](function(_0x3becee){return _0x3becee;});}return null;};}function removeEntity(_0x1f7c68,_0x3c8c9f){return function(_0x53f797){if(_0x53f797){return _0x53f797[_0xb082('0x23')]()[_0xb082('0x24')](function(){_0x1f7c68[_0xb082('0x1b')](0xcc)[_0xb082('0x25')]();});}};}function handleEntityNotFound(_0x484c15,_0x5ca741){return function(_0x554a33){if(!_0x554a33){_0x484c15[_0xb082('0x1a')](0x194);}return _0x554a33;};}function handleError(_0x325e4b,_0x28e122){_0x28e122=_0x28e122||0x1f4;return function(_0x5eb860){logger['error'](_0x5eb860[_0xb082('0x26')]);if(_0x5eb860[_0xb082('0x27')]){delete _0x5eb860[_0xb082('0x27')];}_0x325e4b[_0xb082('0x1b')](_0x28e122)[_0xb082('0x28')](_0x5eb860);};}exports[_0xb082('0x29')]=function(_0x48eb43,_0x2b57e7){var _0x504d1c={},_0x569978={},_0x54b633={'count':0x0,'rows':[]};var _0xbfce1=_[_0xb082('0x2a')](db[_0xb082('0x2b')]['rawAttributes'],function(_0x22efe){return{'name':_0x22efe[_0xb082('0x2c')],'type':_0x22efe[_0xb082('0x2d')][_0xb082('0x2e')]};});_0x569978[_0xb082('0x2f')]=_[_0xb082('0x2a')](_0xbfce1,_0xb082('0x27'));_0x569978[_0xb082('0x30')]=_['keys'](_0x48eb43[_0xb082('0x30')]);_0x569978[_0xb082('0x31')]=_[_0xb082('0x32')](_0x569978[_0xb082('0x2f')],_0x569978[_0xb082('0x30')]);_0x504d1c[_0xb082('0x33')]=_[_0xb082('0x32')](_0x569978[_0xb082('0x2f')],qs[_0xb082('0x34')](_0x48eb43[_0xb082('0x30')][_0xb082('0x34')]));_0x504d1c[_0xb082('0x33')]=_0x504d1c[_0xb082('0x33')][_0xb082('0x35')]?_0x504d1c[_0xb082('0x33')]:_0x569978[_0xb082('0x2f')];if(!_0x48eb43['query']['hasOwnProperty'](_0xb082('0x36'))){_0x504d1c[_0xb082('0x1f')]=qs[_0xb082('0x1f')](_0x48eb43[_0xb082('0x30')]['limit']);_0x504d1c['offset']=qs['offset'](_0x48eb43[_0xb082('0x30')][_0xb082('0x1d')]);}_0x504d1c[_0xb082('0x37')]=qs['sort'](_0x48eb43[_0xb082('0x30')]['sort']);_0x504d1c[_0xb082('0x38')]=qs['filters'](_[_0xb082('0x39')](_0x48eb43[_0xb082('0x30')],_0x569978[_0xb082('0x31')]),_0xbfce1);if(_0x48eb43[_0xb082('0x30')]['filter']){_0x504d1c[_0xb082('0x38')]=_[_0xb082('0x3a')](_0x504d1c[_0xb082('0x38')],{'$or':_[_0xb082('0x2a')](_0xbfce1,function(_0x50ebd7){if(_0x50ebd7['type']!==_0xb082('0x3b')){var _0x5927cb={};_0x5927cb[_0x50ebd7[_0xb082('0x27')]]={'$like':'%'+_0x48eb43[_0xb082('0x30')][_0xb082('0x3c')]+'%'};return _0x5927cb;}})});}_0x504d1c=_[_0xb082('0x3a')]({},_0x504d1c,_0x48eb43['options']);var _0x12ac74={'where':_0x504d1c[_0xb082('0x38')]};return db['FreshdeskAccount'][_0xb082('0x3d')](_0x12ac74)[_0xb082('0x24')](function(_0x267c06){_0x54b633['count']=_0x267c06;if(_0x48eb43[_0xb082('0x30')][_0xb082('0x3e')]){_0x504d1c[_0xb082('0x3f')]=[{'all':!![]}];}return db[_0xb082('0x2b')][_0xb082('0x40')](_0x504d1c);})['then'](function(_0x3516cf){_0x54b633[_0xb082('0x41')]=_0x3516cf;return _0x54b633;})[_0xb082('0x24')](respondWithFilteredResult(_0x2b57e7,_0x504d1c))[_0xb082('0x42')](handleError(_0x2b57e7,null));};exports[_0xb082('0x43')]=function(_0x172c7f,_0x23d000){var _0x4038f5={'raw':![],'where':{'id':_0x172c7f[_0xb082('0x44')]['id']}},_0x2044de={};_0x2044de['model']=_[_0xb082('0x45')](db[_0xb082('0x2b')][_0xb082('0x46')]);_0x2044de[_0xb082('0x30')]=_[_0xb082('0x45')](_0x172c7f[_0xb082('0x30')]);_0x2044de[_0xb082('0x31')]=_[_0xb082('0x32')](_0x2044de[_0xb082('0x2f')],_0x2044de[_0xb082('0x30')]);_0x4038f5[_0xb082('0x33')]=_[_0xb082('0x32')](_0x2044de[_0xb082('0x2f')],qs[_0xb082('0x34')](_0x172c7f[_0xb082('0x30')][_0xb082('0x34')]));_0x4038f5[_0xb082('0x33')]=_0x4038f5[_0xb082('0x33')][_0xb082('0x35')]?_0x4038f5[_0xb082('0x33')]:_0x2044de[_0xb082('0x2f')];if(_0x172c7f[_0xb082('0x30')][_0xb082('0x3e')]){_0x4038f5[_0xb082('0x3f')]=[{'all':!![]}];}_0x4038f5=_[_0xb082('0x3a')]({},_0x4038f5,_0x172c7f[_0xb082('0x47')]);return db[_0xb082('0x2b')][_0xb082('0x48')](_0x4038f5)[_0xb082('0x24')](handleEntityNotFound(_0x23d000,null))[_0xb082('0x24')](respondWithResult(_0x23d000,null))['catch'](handleError(_0x23d000,null));};exports[_0xb082('0x49')]=function(_0x4b1b96,_0xcdf8b0){return db['FreshdeskAccount'][_0xb082('0x49')](_0x4b1b96[_0xb082('0x4a')],{})[_0xb082('0x24')](respondWithResult(_0xcdf8b0,0xc9))[_0xb082('0x42')](handleError(_0xcdf8b0,null));};exports[_0xb082('0x22')]=function(_0x20076f,_0x479a13){if(_0x20076f['body']['id']){delete _0x20076f[_0xb082('0x4a')]['id'];}return db[_0xb082('0x2b')][_0xb082('0x48')]({'where':{'id':_0x20076f[_0xb082('0x44')]['id']}})['then'](handleEntityNotFound(_0x479a13,null))[_0xb082('0x24')](saveUpdates(_0x20076f['body'],null))[_0xb082('0x24')](respondWithResult(_0x479a13,null))[_0xb082('0x42')](handleError(_0x479a13,null));};exports['destroy']=function(_0x5a1581,_0x5d93e5){return db[_0xb082('0x2b')]['find']({'where':{'id':_0x5a1581[_0xb082('0x44')]['id']}})[_0xb082('0x24')](handleEntityNotFound(_0x5d93e5,null))[_0xb082('0x24')](removeEntity(_0x5d93e5,null))[_0xb082('0x42')](handleError(_0x5d93e5,null));};exports[_0xb082('0x4b')]=function(_0x1f7895,_0x5dd96d,_0x3ea246){var _0x489385={};var _0x2936b7={};var _0x3c4c3c;var _0x113746;return db[_0xb082('0x2b')][_0xb082('0x4c')]({'where':{'id':_0x1f7895[_0xb082('0x44')]['id']}})[_0xb082('0x24')](handleEntityNotFound(_0x5dd96d,null))['then'](function(_0x3fde0c){if(_0x3fde0c){_0x3c4c3c=_0x3fde0c;_0x2936b7[_0xb082('0x2f')]=_[_0xb082('0x45')](db[_0xb082('0x4d')]['rawAttributes']);_0x2936b7[_0xb082('0x30')]=_[_0xb082('0x45')](_0x1f7895[_0xb082('0x30')]);_0x2936b7[_0xb082('0x31')]=_[_0xb082('0x32')](_0x2936b7[_0xb082('0x2f')],_0x2936b7[_0xb082('0x30')]);_0x489385[_0xb082('0x33')]=_[_0xb082('0x32')](_0x2936b7[_0xb082('0x2f')],qs[_0xb082('0x34')](_0x1f7895[_0xb082('0x30')]['fields']));_0x489385['attributes']=_0x489385[_0xb082('0x33')][_0xb082('0x35')]?_0x489385[_0xb082('0x33')]:_0x2936b7[_0xb082('0x2f')];_0x489385[_0xb082('0x37')]=qs[_0xb082('0x4e')](_0x1f7895[_0xb082('0x30')][_0xb082('0x4e')]);_0x489385[_0xb082('0x38')]=qs[_0xb082('0x31')](_[_0xb082('0x39')](_0x1f7895[_0xb082('0x30')],_0x2936b7[_0xb082('0x31')]));if(_0x1f7895[_0xb082('0x30')][_0xb082('0x3c')]){_0x489385[_0xb082('0x38')]=_[_0xb082('0x3a')](_0x489385['where'],{'$or':_[_0xb082('0x2a')](_0x489385[_0xb082('0x33')],function(_0x38fa68){var _0x59d025={};_0x59d025[_0x38fa68]={'$like':'%'+_0x1f7895[_0xb082('0x30')][_0xb082('0x3c')]+'%'};return _0x59d025;})});}_0x489385=_[_0xb082('0x3a')]({},_0x489385,_0x1f7895[_0xb082('0x47')]);return _0x3c4c3c[_0xb082('0x4b')](_0x489385);}})[_0xb082('0x24')](function(_0x2e54fd){if(_0x2e54fd){_0x113746=_0x2e54fd[_0xb082('0x35')];if(!_0x1f7895[_0xb082('0x30')][_0xb082('0x4f')](_0xb082('0x36'))){_0x489385[_0xb082('0x1f')]=qs['limit'](_0x1f7895[_0xb082('0x30')][_0xb082('0x1f')]);_0x489385['offset']=qs[_0xb082('0x1d')](_0x1f7895[_0xb082('0x30')][_0xb082('0x1d')]);}return _0x3c4c3c['getConfigurations'](_0x489385);}})['then'](function(_0x2399a0){if(_0x2399a0){return _0x2399a0?{'count':_0x113746,'rows':_0x2399a0}:null;}})[_0xb082('0x24')](respondWithResult(_0x5dd96d,null))[_0xb082('0x42')](handleError(_0x5dd96d,null));};exports[_0xb082('0x50')]=function(_0x44047c,_0x1c1c6e,_0x4016d6){if(_0x44047c['body']['id']){delete _0x44047c[_0xb082('0x4a')]['id'];}return db[_0xb082('0x2b')]['findOne']({'where':{'id':_0x44047c[_0xb082('0x44')]['id']}})[_0xb082('0x24')](handleEntityNotFound(_0x1c1c6e,null))[_0xb082('0x24')](function(_0x490010){if(_0x490010){_0x44047c[_0xb082('0x4a')][_0xb082('0x51')]=_0x490010['id'];_0x44047c['body']['Subjects']=integrations[_0xb082('0x52')](_0x44047c['body'][_0xb082('0x53')],_0x44047c[_0xb082('0x4a')][_0xb082('0x2d')]);_0x44047c[_0xb082('0x4a')][_0xb082('0x54')]=integrations[_0xb082('0x55')](_0x44047c['body']['channel'],_0x44047c[_0xb082('0x4a')][_0xb082('0x2d')]);return db[_0xb082('0x4d')][_0xb082('0x49')](_0x44047c[_0xb082('0x4a')],{'include':[{'model':db[_0xb082('0x56')],'as':_0xb082('0x57')},{'model':db[_0xb082('0x56')],'as':'Descriptions'}]});}return null;})[_0xb082('0x24')](respondWithResult(_0x1c1c6e,null))['catch'](handleError(_0x1c1c6e,null));};exports[_0xb082('0x58')]=function(_0x4db9ed,_0x1ccca4,_0x957710){var _0xb411f7='';return db[_0xb082('0x2b')][_0xb082('0x4c')]({'where':{'id':_0x4db9ed[_0xb082('0x44')]['id']},'attributes':['id',_0xb082('0x59'),_0xb082('0x5a')]})[_0xb082('0x24')](handleEntityNotFound(_0x1ccca4,null))['then'](function(_0x203d6a){if(_0x203d6a){_0xb411f7=_0x203d6a[_0xb082('0x59')];var _0x2eff43=_0xb411f7[_0xb082('0x5b')](-0x1);if(_0x2eff43==='/'){_0xb411f7=_0xb411f7['substring'](0x0,_0xb411f7[_0xb082('0x5c')](_0x2eff43));}return rp({'method':'GET','uri':util[_0xb082('0x5d')](_0xb082('0x5e'),_0xb411f7,_0xb082('0x5f')),'headers':{'Authorization':util[_0xb082('0x5d')](_0xb082('0x60'),new Buffer(util['format'](_0xb082('0x61'),_0x203d6a[_0xb082('0x5a')]))[_0xb082('0x62')](_0xb082('0x63')))},'json':!![]});}})['then'](function(_0x48a65c){if(_0x48a65c){var _0x5829d4=[_0xb082('0x64'),_0xb082('0x65'),_0xb082('0x66'),_0xb082('0x67'),_0xb082('0x1b'),_0xb082('0x68'),_0xb082('0x69'),_0xb082('0x6a'),'ticket_type',_0xb082('0x69'),_0xb082('0x6b')];_[_0xb082('0x6c')](_0x48a65c,function(_0x25c7a8){return _0x5829d4['includes'](_0x25c7a8[_0xb082('0x27')])||!_0x25c7a8[_0xb082('0x6d')]&&_0x25c7a8['type']!==_0xb082('0x6e')&&_0x25c7a8[_0xb082('0x2d')]!==_0xb082('0x6f');});return{'count':_0x48a65c['length'],'rows':_[_0xb082('0x2a')](_0x48a65c,function(_0x13f054){return{'id':_0x13f054[_0xb082('0x27')],'name':_0x13f054[_0xb082('0x70')],'custom':!_0x13f054[_0xb082('0x6d')],'options':_0x13f054[_0xb082('0x71')]?_[_0xb082('0x2a')](_0x13f054[_0xb082('0x71')],function(_0x5aaceb){return{'name':_[_0xb082('0x72')](_0x5aaceb),'value':_0x5aaceb};}):[]};})};}})['then'](respondWithResult(_0x1ccca4,null))[_0xb082('0x42')](function(_0x4258a3){var _0x3b1acd=_0x4db9ed['query'][_0xb082('0x73')]?0x1f4:_0x4258a3[_0xb082('0x74')]||0x1f4;logger[_0xb082('0x75')](_0xb082('0x76'),_0xb082('0x58'),_0x3b1acd,JSON[_0xb082('0x77')](_0x4258a3));delete _0x4258a3['name'];if(_0x3b1acd===0x191){_0x3b1acd=0x190;}_0x1ccca4['status'](_0x3b1acd)['send'](_0x4db9ed[_0xb082('0x30')][_0xb082('0x73')]?{'message':_0xb082('0x78'),'statusCode':_0x4258a3[_0xb082('0x74')]}:_0x4258a3);});}; \ No newline at end of file +var _0xd61e=['update','destroy','then','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskAccount','count','includeAll','include','findAll','rows','show','find','catch','create','body','params','getConfigurations','findOne','FreshdeskConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','apiKey','remoteUri','slice','substring','lastIndexOf','GET','api/v2/ticket_fields','format','Basic\x20%s','toString','base64','requester','subject','agent','priority','group','source','ticket_type','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../components/integrations/configuration','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save'];(function(_0x15711d,_0xfcd5d4){var _0x40518=function(_0x381fcf){while(--_0x381fcf){_0x15711d['push'](_0x15711d['shift']());}};_0x40518(++_0xfcd5d4);}(_0xd61e,0x13d));var _0xed61=function(_0xf34dd5,_0x3110c8){_0xf34dd5=_0xf34dd5-0x0;var _0x4dc5f0=_0xd61e[_0xf34dd5];return _0x4dc5f0;};'use strict';var emlformat=require(_0xed61('0x0'));var rimraf=require(_0xed61('0x1'));var zipdir=require(_0xed61('0x2'));var jsonpatch=require(_0xed61('0x3'));var rp=require(_0xed61('0x4'));var moment=require(_0xed61('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xed61('0x6'));var util=require(_0xed61('0x7'));var path=require(_0xed61('0x8'));var sox=require(_0xed61('0x9'));var csv=require(_0xed61('0xa'));var ejs=require(_0xed61('0xb'));var fs=require('fs');var fs_extra=require(_0xed61('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xed61('0xa'));var querystring=require(_0xed61('0xd'));var Papa=require(_0xed61('0xe'));var Redis=require(_0xed61('0xf'));var authService=require(_0xed61('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xed61('0x11'))(_0xed61('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xed61('0x13'));function respondWithStatusCode(_0x21511d,_0x19c74c){_0x19c74c=_0x19c74c||0xcc;return function(_0x168554){if(_0x168554){return _0x21511d['sendStatus'](_0x19c74c);}return _0x21511d[_0xed61('0x14')](_0x19c74c)[_0xed61('0x15')]();};}function respondWithResult(_0xe08d33,_0x4ac6e2){_0x4ac6e2=_0x4ac6e2||0xc8;return function(_0x445545){if(_0x445545){return _0xe08d33[_0xed61('0x14')](_0x4ac6e2)[_0xed61('0x16')](_0x445545);}};}function respondWithFilteredResult(_0x2ad52a,_0x4d3930){return function(_0x15198a){if(_0x15198a){var _0x391d53=typeof _0x4d3930[_0xed61('0x17')]===_0xed61('0x18')&&typeof _0x4d3930['limit']===_0xed61('0x18');var _0x27416b=_0x15198a['count'];var _0x31b034=_0x391d53?0x0:_0x4d3930[_0xed61('0x17')];var _0x9d980e=_0x391d53?_0x15198a['count']:_0x4d3930[_0xed61('0x17')]+_0x4d3930[_0xed61('0x19')];var _0xd5aa2d;if(_0x9d980e>=_0x27416b){_0x9d980e=_0x27416b;_0xd5aa2d=0xc8;}else{_0xd5aa2d=0xce;}_0x2ad52a['status'](_0xd5aa2d);return _0x2ad52a[_0xed61('0x1a')](_0xed61('0x1b'),_0x31b034+'-'+_0x9d980e+'/'+_0x27416b)[_0xed61('0x16')](_0x15198a);}return null;};}function patchUpdates(_0x5ee0b9){return function(_0x3bab6f){try{jsonpatch[_0xed61('0x1c')](_0x3bab6f,_0x5ee0b9,!![]);}catch(_0x481211){return BPromise[_0xed61('0x1d')](_0x481211);}return _0x3bab6f[_0xed61('0x1e')]();};}function saveUpdates(_0x864dfa,_0x5f3d0f){return function(_0x53f131){if(_0x53f131){return _0x53f131[_0xed61('0x1f')](_0x864dfa)['then'](function(_0xa17a06){return _0xa17a06;});}return null;};}function removeEntity(_0x217e93,_0x2722d0){return function(_0x39a8ff){if(_0x39a8ff){return _0x39a8ff[_0xed61('0x20')]()[_0xed61('0x21')](function(){_0x217e93['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59893f,_0x50f56d){return function(_0x405c67){if(!_0x405c67){_0x59893f['sendStatus'](0x194);}return _0x405c67;};}function handleError(_0x159418,_0x2c43ba){_0x2c43ba=_0x2c43ba||0x1f4;return function(_0x5dc3bf){logger['error'](_0x5dc3bf[_0xed61('0x22')]);if(_0x5dc3bf[_0xed61('0x23')]){delete _0x5dc3bf[_0xed61('0x23')];}_0x159418['status'](_0x2c43ba)[_0xed61('0x24')](_0x5dc3bf);};}exports[_0xed61('0x25')]=function(_0x1ac86e,_0x4c154b){var _0x35c2af={},_0x4a2d38={},_0x11fd35={'count':0x0,'rows':[]};var _0x3ec2e6=_[_0xed61('0x26')](db['FreshdeskAccount'][_0xed61('0x27')],function(_0xa5a8aa){return{'name':_0xa5a8aa[_0xed61('0x28')],'type':_0xa5a8aa[_0xed61('0x29')]['key']};});_0x4a2d38[_0xed61('0x2a')]=_['map'](_0x3ec2e6,'name');_0x4a2d38[_0xed61('0x2b')]=_[_0xed61('0x2c')](_0x1ac86e[_0xed61('0x2b')]);_0x4a2d38[_0xed61('0x2d')]=_['intersection'](_0x4a2d38['model'],_0x4a2d38[_0xed61('0x2b')]);_0x35c2af[_0xed61('0x2e')]=_[_0xed61('0x2f')](_0x4a2d38[_0xed61('0x2a')],qs[_0xed61('0x30')](_0x1ac86e[_0xed61('0x2b')][_0xed61('0x30')]));_0x35c2af['attributes']=_0x35c2af['attributes'][_0xed61('0x31')]?_0x35c2af['attributes']:_0x4a2d38[_0xed61('0x2a')];if(!_0x1ac86e['query']['hasOwnProperty']('nolimit')){_0x35c2af['limit']=qs['limit'](_0x1ac86e[_0xed61('0x2b')][_0xed61('0x19')]);_0x35c2af[_0xed61('0x17')]=qs[_0xed61('0x17')](_0x1ac86e[_0xed61('0x2b')][_0xed61('0x17')]);}_0x35c2af[_0xed61('0x32')]=qs[_0xed61('0x33')](_0x1ac86e['query']['sort']);_0x35c2af[_0xed61('0x34')]=qs[_0xed61('0x2d')](_[_0xed61('0x35')](_0x1ac86e[_0xed61('0x2b')],_0x4a2d38['filters']),_0x3ec2e6);if(_0x1ac86e[_0xed61('0x2b')][_0xed61('0x36')]){_0x35c2af['where']=_[_0xed61('0x37')](_0x35c2af[_0xed61('0x34')],{'$or':_[_0xed61('0x26')](_0x3ec2e6,function(_0x3ac45e){if(_0x3ac45e['type']!==_0xed61('0x38')){var _0x6c2723={};_0x6c2723[_0x3ac45e[_0xed61('0x23')]]={'$like':'%'+_0x1ac86e[_0xed61('0x2b')][_0xed61('0x36')]+'%'};return _0x6c2723;}})});}_0x35c2af=_[_0xed61('0x37')]({},_0x35c2af,_0x1ac86e[_0xed61('0x39')]);var _0x57e623={'where':_0x35c2af[_0xed61('0x34')]};return db[_0xed61('0x3a')][_0xed61('0x3b')](_0x57e623)[_0xed61('0x21')](function(_0x10c835){_0x11fd35[_0xed61('0x3b')]=_0x10c835;if(_0x1ac86e[_0xed61('0x2b')][_0xed61('0x3c')]){_0x35c2af[_0xed61('0x3d')]=[{'all':!![]}];}return db[_0xed61('0x3a')][_0xed61('0x3e')](_0x35c2af);})[_0xed61('0x21')](function(_0x4005dd){_0x11fd35[_0xed61('0x3f')]=_0x4005dd;return _0x11fd35;})['then'](respondWithFilteredResult(_0x4c154b,_0x35c2af))['catch'](handleError(_0x4c154b,null));};exports[_0xed61('0x40')]=function(_0x4595ba,_0x48b591){var _0x5b9bef={'raw':![],'where':{'id':_0x4595ba['params']['id']}},_0x4de103={};_0x4de103[_0xed61('0x2a')]=_[_0xed61('0x2c')](db[_0xed61('0x3a')][_0xed61('0x27')]);_0x4de103[_0xed61('0x2b')]=_[_0xed61('0x2c')](_0x4595ba['query']);_0x4de103[_0xed61('0x2d')]=_[_0xed61('0x2f')](_0x4de103[_0xed61('0x2a')],_0x4de103['query']);_0x5b9bef[_0xed61('0x2e')]=_[_0xed61('0x2f')](_0x4de103[_0xed61('0x2a')],qs[_0xed61('0x30')](_0x4595ba[_0xed61('0x2b')]['fields']));_0x5b9bef['attributes']=_0x5b9bef[_0xed61('0x2e')][_0xed61('0x31')]?_0x5b9bef[_0xed61('0x2e')]:_0x4de103[_0xed61('0x2a')];if(_0x4595ba['query'][_0xed61('0x3c')]){_0x5b9bef[_0xed61('0x3d')]=[{'all':!![]}];}_0x5b9bef=_[_0xed61('0x37')]({},_0x5b9bef,_0x4595ba['options']);return db[_0xed61('0x3a')][_0xed61('0x41')](_0x5b9bef)['then'](handleEntityNotFound(_0x48b591,null))[_0xed61('0x21')](respondWithResult(_0x48b591,null))[_0xed61('0x42')](handleError(_0x48b591,null));};exports[_0xed61('0x43')]=function(_0x3403cf,_0xdca8b8){return db[_0xed61('0x3a')][_0xed61('0x43')](_0x3403cf[_0xed61('0x44')],{})[_0xed61('0x21')](respondWithResult(_0xdca8b8,0xc9))[_0xed61('0x42')](handleError(_0xdca8b8,null));};exports[_0xed61('0x1f')]=function(_0x3a6693,_0x363a82){if(_0x3a6693[_0xed61('0x44')]['id']){delete _0x3a6693[_0xed61('0x44')]['id'];}return db[_0xed61('0x3a')][_0xed61('0x41')]({'where':{'id':_0x3a6693[_0xed61('0x45')]['id']}})[_0xed61('0x21')](handleEntityNotFound(_0x363a82,null))[_0xed61('0x21')](saveUpdates(_0x3a6693[_0xed61('0x44')],null))[_0xed61('0x21')](respondWithResult(_0x363a82,null))[_0xed61('0x42')](handleError(_0x363a82,null));};exports['destroy']=function(_0x4effa3,_0x28950f){return db[_0xed61('0x3a')][_0xed61('0x41')]({'where':{'id':_0x4effa3[_0xed61('0x45')]['id']}})['then'](handleEntityNotFound(_0x28950f,null))[_0xed61('0x21')](removeEntity(_0x28950f,null))[_0xed61('0x42')](handleError(_0x28950f,null));};exports[_0xed61('0x46')]=function(_0x53de57,_0x4df2dd,_0x531a57){var _0x1b8f08={};var _0xa3a22f={};var _0x134401;var _0x1d3b9d;return db[_0xed61('0x3a')][_0xed61('0x47')]({'where':{'id':_0x53de57[_0xed61('0x45')]['id']}})[_0xed61('0x21')](handleEntityNotFound(_0x4df2dd,null))['then'](function(_0x2bb9b9){if(_0x2bb9b9){_0x134401=_0x2bb9b9;_0xa3a22f[_0xed61('0x2a')]=_['keys'](db[_0xed61('0x48')][_0xed61('0x27')]);_0xa3a22f[_0xed61('0x2b')]=_['keys'](_0x53de57[_0xed61('0x2b')]);_0xa3a22f['filters']=_[_0xed61('0x2f')](_0xa3a22f[_0xed61('0x2a')],_0xa3a22f[_0xed61('0x2b')]);_0x1b8f08[_0xed61('0x2e')]=_[_0xed61('0x2f')](_0xa3a22f[_0xed61('0x2a')],qs[_0xed61('0x30')](_0x53de57['query'][_0xed61('0x30')]));_0x1b8f08[_0xed61('0x2e')]=_0x1b8f08[_0xed61('0x2e')][_0xed61('0x31')]?_0x1b8f08[_0xed61('0x2e')]:_0xa3a22f[_0xed61('0x2a')];_0x1b8f08['order']=qs[_0xed61('0x33')](_0x53de57['query'][_0xed61('0x33')]);_0x1b8f08['where']=qs[_0xed61('0x2d')](_[_0xed61('0x35')](_0x53de57['query'],_0xa3a22f[_0xed61('0x2d')]));if(_0x53de57[_0xed61('0x2b')][_0xed61('0x36')]){_0x1b8f08[_0xed61('0x34')]=_[_0xed61('0x37')](_0x1b8f08['where'],{'$or':_[_0xed61('0x26')](_0x1b8f08[_0xed61('0x2e')],function(_0x21aa72){var _0x1683b5={};_0x1683b5[_0x21aa72]={'$like':'%'+_0x53de57[_0xed61('0x2b')][_0xed61('0x36')]+'%'};return _0x1683b5;})});}_0x1b8f08=_[_0xed61('0x37')]({},_0x1b8f08,_0x53de57['options']);return _0x134401['getConfigurations'](_0x1b8f08);}})[_0xed61('0x21')](function(_0x4729f3){if(_0x4729f3){_0x1d3b9d=_0x4729f3[_0xed61('0x31')];if(!_0x53de57[_0xed61('0x2b')][_0xed61('0x49')]('nolimit')){_0x1b8f08[_0xed61('0x19')]=qs[_0xed61('0x19')](_0x53de57[_0xed61('0x2b')]['limit']);_0x1b8f08[_0xed61('0x17')]=qs[_0xed61('0x17')](_0x53de57[_0xed61('0x2b')][_0xed61('0x17')]);}return _0x134401[_0xed61('0x46')](_0x1b8f08);}})['then'](function(_0x55ef0b){if(_0x55ef0b){return _0x55ef0b?{'count':_0x1d3b9d,'rows':_0x55ef0b}:null;}})[_0xed61('0x21')](respondWithResult(_0x4df2dd,null))[_0xed61('0x42')](handleError(_0x4df2dd,null));};exports[_0xed61('0x4a')]=function(_0x3aa517,_0x457d66,_0x1670e5){if(_0x3aa517[_0xed61('0x44')]['id']){delete _0x3aa517[_0xed61('0x44')]['id'];}return db[_0xed61('0x3a')][_0xed61('0x47')]({'where':{'id':_0x3aa517['params']['id']}})[_0xed61('0x21')](handleEntityNotFound(_0x457d66,null))[_0xed61('0x21')](function(_0x5aeffd){if(_0x5aeffd){_0x3aa517[_0xed61('0x44')][_0xed61('0x4b')]=_0x5aeffd['id'];_0x3aa517[_0xed61('0x44')][_0xed61('0x4c')]=integrations[_0xed61('0x4d')](_0x3aa517['body'][_0xed61('0x4e')],_0x3aa517['body']['type']);_0x3aa517[_0xed61('0x44')][_0xed61('0x4f')]=integrations[_0xed61('0x50')](_0x3aa517['body'][_0xed61('0x4e')],_0x3aa517[_0xed61('0x44')][_0xed61('0x29')]);return db[_0xed61('0x48')][_0xed61('0x43')](_0x3aa517['body'],{'include':[{'model':db['FreshdeskField'],'as':_0xed61('0x4c')},{'model':db[_0xed61('0x51')],'as':_0xed61('0x4f')}]});}return null;})[_0xed61('0x21')](respondWithResult(_0x457d66,null))[_0xed61('0x42')](handleError(_0x457d66,null));};exports['getFields']=function(_0xe89a4,_0xb883f7,_0x45824f){var _0x31d1c0='';return db['FreshdeskAccount'][_0xed61('0x47')]({'where':{'id':_0xe89a4[_0xed61('0x45')]['id']},'attributes':['id','remoteUri',_0xed61('0x52')]})[_0xed61('0x21')](handleEntityNotFound(_0xb883f7,null))[_0xed61('0x21')](function(_0x121920){if(_0x121920){_0x31d1c0=_0x121920[_0xed61('0x53')];var _0x87cbe=_0x31d1c0[_0xed61('0x54')](-0x1);if(_0x87cbe==='/'){_0x31d1c0=_0x31d1c0[_0xed61('0x55')](0x0,_0x31d1c0[_0xed61('0x56')](_0x87cbe));}return rp({'method':_0xed61('0x57'),'uri':util['format']('%s/%s',_0x31d1c0,_0xed61('0x58')),'headers':{'Authorization':util[_0xed61('0x59')](_0xed61('0x5a'),new Buffer(util['format']('%s:X',_0x121920[_0xed61('0x52')]))[_0xed61('0x5b')](_0xed61('0x5c')))},'json':!![]});}})[_0xed61('0x21')](function(_0x307916){if(_0x307916){var _0x1c325a=[_0xed61('0x5d'),_0xed61('0x5e'),_0xed61('0x5f'),'description',_0xed61('0x14'),_0xed61('0x60'),_0xed61('0x61'),_0xed61('0x62'),_0xed61('0x63'),_0xed61('0x61'),_0xed61('0x64')];_[_0xed61('0x65')](_0x307916,function(_0x4e01f7){return _0x1c325a[_0xed61('0x66')](_0x4e01f7[_0xed61('0x23')])||!_0x4e01f7[_0xed61('0x67')]&&_0x4e01f7[_0xed61('0x29')]!==_0xed61('0x68')&&_0x4e01f7[_0xed61('0x29')]!==_0xed61('0x69');});return{'count':_0x307916[_0xed61('0x31')],'rows':_[_0xed61('0x26')](_0x307916,function(_0x379262){return{'id':_0x379262[_0xed61('0x23')],'name':_0x379262[_0xed61('0x6a')],'custom':!_0x379262[_0xed61('0x67')],'options':_0x379262[_0xed61('0x6b')]?_[_0xed61('0x26')](_0x379262['choices'],function(_0x1b467f){return{'name':_[_0xed61('0x6c')](_0x1b467f),'value':_0x1b467f};}):[]};})};}})[_0xed61('0x21')](respondWithResult(_0xb883f7,null))[_0xed61('0x42')](function(_0x3c16ae){var _0x465053=_0xe89a4['query'][_0xed61('0x6d')]?0x1f4:_0x3c16ae[_0xed61('0x6e')]||0x1f4;logger[_0xed61('0x6f')](_0xed61('0x70'),_0xed61('0x71'),_0x465053,JSON[_0xed61('0x72')](_0x3c16ae));delete _0x3c16ae['name'];if(_0x465053===0x191){_0x465053=0x190;}_0xb883f7[_0xed61('0x14')](_0x465053)['send'](_0xe89a4[_0xed61('0x2b')][_0xed61('0x6d')]?{'message':_0xed61('0x73'),'statusCode':_0x3c16ae['statusCode']}:_0x3c16ae);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 184760a..e0e2e96 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 _0x5b40=['lodash','../../config/logger','api','moment','bluebird','rimraf','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x44e3af,_0x5a8602){var _0x535363=function(_0x369847){while(--_0x369847){_0x44e3af['push'](_0x44e3af['shift']());}};_0x535363(++_0x5a8602);}(_0x5b40,0x90));var _0x05b4=function(_0x28fd13,_0x36b8b8){_0x28fd13=_0x28fd13-0x0;var _0x32d4cf=_0x5b40[_0x28fd13];return _0x32d4cf;};'use strict';var _=require(_0x05b4('0x0'));var util=require('util');var logger=require(_0x05b4('0x1'))(_0x05b4('0x2'));var moment=require(_0x05b4('0x3'));var BPromise=require(_0x05b4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x05b4('0x5'));var config=require('../../config/environment');var attributes=require(_0x05b4('0x6'));var integrations=require(_0x05b4('0x7'));module[_0x05b4('0x8')]=function(_0x2e4f82,_0x874b80){return _0x2e4f82[_0x05b4('0x9')](_0x05b4('0xa'),attributes,{'tableName':_0x05b4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8a3=['moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger'];(function(_0x148b49,_0xe42735){var _0x4fe39a=function(_0x2268a9){while(--_0x2268a9){_0x148b49['push'](_0x148b49['shift']());}};_0x4fe39a(++_0xe42735);}(_0xa8a3,0x169));var _0x3a8a=function(_0x4032b4,_0x4abe5a){_0x4032b4=_0x4032b4-0x0;var _0x333aeb=_0xa8a3[_0x4032b4];return _0x333aeb;};'use strict';var _=require(_0x3a8a('0x0'));var util=require(_0x3a8a('0x1'));var logger=require(_0x3a8a('0x2'))('api');var moment=require(_0x3a8a('0x3'));var BPromise=require(_0x3a8a('0x4'));var rp=require(_0x3a8a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a8a('0x6'));var config=require(_0x3a8a('0x7'));var attributes=require(_0x3a8a('0x8'));var integrations=require(_0x3a8a('0x9'));module[_0x3a8a('0xa')]=function(_0x16838e,_0x3ae051){return _0x16838e[_0x3a8a('0xb')](_0x3a8a('0xc'),attributes,{'tableName':_0x3a8a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 21d29b4..a705dd5 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 _0x1b4b=['model','attributes','map','then','ShowFreshdeskAccount','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','FreshdeskAccount,\x20%s,\x20%s','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','options','where','limit','include'];(function(_0x252884,_0x117ddf){var _0x4de0e6=function(_0x442519){while(--_0x442519){_0x252884['push'](_0x252884['shift']());}};_0x4de0e6(++_0x117ddf);}(_0x1b4b,0xd8));var _0xb1b4=function(_0x1a7e92,_0x4f0b83){_0x1a7e92=_0x1a7e92-0x0;var _0x459060=_0x1b4b[_0x1a7e92];return _0x459060;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb1b4('0x0'));var BPromise=require(_0xb1b4('0x1'));var rs=require(_0xb1b4('0x2'));var fs=require('fs');var Redis=require(_0xb1b4('0x3'));var db=require(_0xb1b4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb1b4('0x5'))(_0xb1b4('0x6'));var config=require('../../config/environment');var jayson=require(_0xb1b4('0x7'));var client=jayson['client'][_0xb1b4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x157a06,_0x36f91a,_0x5e8a62){return new BPromise(function(_0x9f9286,_0x2f880e){return client['request'](_0x157a06,_0x5e8a62)['then'](function(_0x4be80d){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x36f91a,_0xb1b4('0x9'));logger[_0xb1b4('0xa')](_0xb1b4('0xb'),_0x36f91a,'request\x20sent',JSON['stringify'](_0x4be80d));if(_0x4be80d[_0xb1b4('0xc')]){if(_0x4be80d[_0xb1b4('0xc')]['code']===0x1f4){logger[_0xb1b4('0xc')](_0xb1b4('0xd'),_0x36f91a,_0x4be80d['error'][_0xb1b4('0xe')]);return _0x2f880e(_0x4be80d[_0xb1b4('0xc')][_0xb1b4('0xe')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x36f91a,_0x4be80d[_0xb1b4('0xc')][_0xb1b4('0xe')]);return _0x9f9286(_0x4be80d[_0xb1b4('0xc')]['message']);}else{logger[_0xb1b4('0xf')](_0xb1b4('0xd'),_0x36f91a,_0xb1b4('0x9'));_0x9f9286(_0x4be80d[_0xb1b4('0x10')]['message']);}})[_0xb1b4('0x11')](function(_0x10a6cc){logger[_0xb1b4('0xc')](_0xb1b4('0xd'),_0x36f91a,_0x10a6cc);_0x2f880e(_0x10a6cc);});});}exports[_0xb1b4('0x12')]=function(_0x18e241){var _0x943577=this;return new Promise(function(_0xe3a94c,_0xe5e447){return db[_0xb1b4('0x13')]['findAll']({'raw':_0x18e241[_0xb1b4('0x14')]?_0x18e241[_0xb1b4('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x18e241[_0xb1b4('0x14')]?_0x18e241['options'][_0xb1b4('0x15')]||null:null,'attributes':_0x18e241[_0xb1b4('0x14')]?_0x18e241[_0xb1b4('0x14')]['attributes']||null:null,'limit':_0x18e241[_0xb1b4('0x14')]?_0x18e241['options'][_0xb1b4('0x16')]||null:null,'include':_0x18e241['options']?_0x18e241['options'][_0xb1b4('0x17')]?_['map'](_0x18e241['options'][_0xb1b4('0x17')],function(_0x29e636){return{'model':db[_0x29e636[_0xb1b4('0x18')]],'as':_0x29e636['as'],'attributes':_0x29e636['attributes'],'include':_0x29e636['include']?_['map'](_0x29e636['include'],function(_0x325b59){return{'model':db[_0x325b59[_0xb1b4('0x18')]],'as':_0x325b59['as'],'attributes':_0x325b59[_0xb1b4('0x19')],'include':_0x325b59[_0xb1b4('0x17')]?_[_0xb1b4('0x1a')](_0x325b59['include'],function(_0x7147ea){return{'model':db[_0x7147ea[_0xb1b4('0x18')]],'as':_0x7147ea['as'],'attributes':_0x7147ea[_0xb1b4('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb1b4('0x1b')](function(_0x110a9e){logger[_0xb1b4('0xf')](_0xb1b4('0x12'),_0x18e241);logger[_0xb1b4('0xa')](_0xb1b4('0x12'),_0x18e241,JSON['stringify'](_0x110a9e));_0xe3a94c(_0x110a9e);})['catch'](function(_0x5be548){logger['error']('GetFreshdeskAccount',_0x5be548[_0xb1b4('0xe')],_0x18e241);_0xe5e447(_0x943577['error'](0x1f4,_0x5be548[_0xb1b4('0xe')]));});});};exports[_0xb1b4('0x1c')]=function(_0x3c5515){var _0x4a944a=this;return new Promise(function(_0x36d202,_0x365b4e){return db[_0xb1b4('0x13')]['find']({'raw':_0x3c5515['options']?_0x3c5515[_0xb1b4('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x3c5515[_0xb1b4('0x14')]?_0x3c5515[_0xb1b4('0x14')][_0xb1b4('0x15')]||null:null,'attributes':_0x3c5515[_0xb1b4('0x14')]?_0x3c5515[_0xb1b4('0x14')][_0xb1b4('0x19')]||null:null,'include':_0x3c5515[_0xb1b4('0x14')]?_0x3c5515[_0xb1b4('0x14')][_0xb1b4('0x17')]?_[_0xb1b4('0x1a')](_0x3c5515[_0xb1b4('0x14')]['include'],function(_0x2a8093){return{'model':db[_0x2a8093[_0xb1b4('0x18')]],'as':_0x2a8093['as'],'attributes':_0x2a8093[_0xb1b4('0x19')],'include':_0x2a8093[_0xb1b4('0x17')]?_[_0xb1b4('0x1a')](_0x2a8093['include'],function(_0x4632e2){return{'model':db[_0x4632e2[_0xb1b4('0x18')]],'as':_0x4632e2['as'],'attributes':_0x4632e2[_0xb1b4('0x19')],'include':_0x4632e2['include']?_[_0xb1b4('0x1a')](_0x4632e2[_0xb1b4('0x17')],function(_0x7920b1){return{'model':db[_0x7920b1['model']],'as':_0x7920b1['as'],'attributes':_0x7920b1[_0xb1b4('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x322b6f){logger[_0xb1b4('0xf')]('ShowFreshdeskAccount',_0x3c5515);logger[_0xb1b4('0xa')]('ShowFreshdeskAccount',_0x3c5515,JSON[_0xb1b4('0x1d')](_0x322b6f));_0x36d202(_0x322b6f);})[_0xb1b4('0x11')](function(_0x30baba){logger['error']('ShowFreshdeskAccount',_0x30baba[_0xb1b4('0xe')],_0x3c5515);_0x365b4e(_0x4a944a[_0xb1b4('0xc')](0x1f4,_0x30baba[_0xb1b4('0xe')]));});});}; \ No newline at end of file +var _0xaaab=['FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','info','message','catch','GetFreshdeskAccount','FreshdeskAccount','options','where','attributes','limit','include','map','model','find','raw','ShowFreshdeskAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','request\x20sent','debug'];(function(_0x481d21,_0x382365){var _0xaeeb76=function(_0x10ab29){while(--_0x10ab29){_0x481d21['push'](_0x481d21['shift']());}};_0xaeeb76(++_0x382365);}(_0xaaab,0x11c));var _0xbaaa=function(_0x11015a,_0x16cc1a){_0x11015a=_0x11015a-0x0;var _0x56a2bc=_0xaaab[_0x11015a];return _0x56a2bc;};'use strict';var _=require(_0xbaaa('0x0'));var util=require(_0xbaaa('0x1'));var moment=require(_0xbaaa('0x2'));var BPromise=require(_0xbaaa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbaaa('0x4'))['db'];var utils=require(_0xbaaa('0x5'));var logger=require('../../config/logger')(_0xbaaa('0x6'));var config=require('../../config/environment');var jayson=require(_0xbaaa('0x7'));var client=jayson['client'][_0xbaaa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa13d82,_0x129ba5,_0x288e8a){return new BPromise(function(_0x2ad6ac,_0x51cf4d){return client[_0xbaaa('0x9')](_0xa13d82,_0x288e8a)[_0xbaaa('0xa')](function(_0x4a5c84){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x129ba5,_0xbaaa('0xb'));logger[_0xbaaa('0xc')](_0xbaaa('0xd'),_0x129ba5,_0xbaaa('0xb'),JSON[_0xbaaa('0xe')](_0x4a5c84));if(_0x4a5c84[_0xbaaa('0xf')]){if(_0x4a5c84[_0xbaaa('0xf')][_0xbaaa('0x10')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x129ba5,_0x4a5c84['error']['message']);return _0x51cf4d(_0x4a5c84['error']['message']);}logger['error'](_0xbaaa('0x11'),_0x129ba5,_0x4a5c84['error']['message']);return _0x2ad6ac(_0x4a5c84[_0xbaaa('0xf')]['message']);}else{logger[_0xbaaa('0x12')](_0xbaaa('0x11'),_0x129ba5,_0xbaaa('0xb'));_0x2ad6ac(_0x4a5c84['result'][_0xbaaa('0x13')]);}})[_0xbaaa('0x14')](function(_0x514267){logger[_0xbaaa('0xf')](_0xbaaa('0x11'),_0x129ba5,_0x514267);_0x51cf4d(_0x514267);});});}exports[_0xbaaa('0x15')]=function(_0x18fe3a){var _0x2bf3f6=this;return new Promise(function(_0x405386,_0x2224a0){return db[_0xbaaa('0x16')]['findAll']({'raw':_0x18fe3a[_0xbaaa('0x17')]?_0x18fe3a[_0xbaaa('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x18fe3a[_0xbaaa('0x17')]?_0x18fe3a[_0xbaaa('0x17')][_0xbaaa('0x18')]||null:null,'attributes':_0x18fe3a[_0xbaaa('0x17')]?_0x18fe3a[_0xbaaa('0x17')][_0xbaaa('0x19')]||null:null,'limit':_0x18fe3a[_0xbaaa('0x17')]?_0x18fe3a['options'][_0xbaaa('0x1a')]||null:null,'include':_0x18fe3a['options']?_0x18fe3a['options'][_0xbaaa('0x1b')]?_[_0xbaaa('0x1c')](_0x18fe3a[_0xbaaa('0x17')][_0xbaaa('0x1b')],function(_0x40bf81){return{'model':db[_0x40bf81[_0xbaaa('0x1d')]],'as':_0x40bf81['as'],'attributes':_0x40bf81['attributes'],'include':_0x40bf81['include']?_[_0xbaaa('0x1c')](_0x40bf81['include'],function(_0x32cac3){return{'model':db[_0x32cac3[_0xbaaa('0x1d')]],'as':_0x32cac3['as'],'attributes':_0x32cac3[_0xbaaa('0x19')],'include':_0x32cac3[_0xbaaa('0x1b')]?_[_0xbaaa('0x1c')](_0x32cac3[_0xbaaa('0x1b')],function(_0x19bca6){return{'model':db[_0x19bca6['model']],'as':_0x19bca6['as'],'attributes':_0x19bca6[_0xbaaa('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbaaa('0xa')](function(_0x52e83d){logger[_0xbaaa('0x12')]('GetFreshdeskAccount',_0x18fe3a);logger[_0xbaaa('0xc')](_0xbaaa('0x15'),_0x18fe3a,JSON[_0xbaaa('0xe')](_0x52e83d));_0x405386(_0x52e83d);})[_0xbaaa('0x14')](function(_0x396d7f){logger[_0xbaaa('0xf')]('GetFreshdeskAccount',_0x396d7f[_0xbaaa('0x13')],_0x18fe3a);_0x2224a0(_0x2bf3f6[_0xbaaa('0xf')](0x1f4,_0x396d7f['message']));});});};exports['ShowFreshdeskAccount']=function(_0x357571){var _0x54be25=this;return new Promise(function(_0x19afa2,_0x153743){return db[_0xbaaa('0x16')][_0xbaaa('0x1e')]({'raw':_0x357571[_0xbaaa('0x17')]?_0x357571[_0xbaaa('0x17')][_0xbaaa('0x1f')]===undefined?!![]:![]:!![],'where':_0x357571[_0xbaaa('0x17')]?_0x357571[_0xbaaa('0x17')][_0xbaaa('0x18')]||null:null,'attributes':_0x357571[_0xbaaa('0x17')]?_0x357571[_0xbaaa('0x17')][_0xbaaa('0x19')]||null:null,'include':_0x357571[_0xbaaa('0x17')]?_0x357571[_0xbaaa('0x17')][_0xbaaa('0x1b')]?_[_0xbaaa('0x1c')](_0x357571[_0xbaaa('0x17')][_0xbaaa('0x1b')],function(_0x308e9){return{'model':db[_0x308e9[_0xbaaa('0x1d')]],'as':_0x308e9['as'],'attributes':_0x308e9[_0xbaaa('0x19')],'include':_0x308e9[_0xbaaa('0x1b')]?_[_0xbaaa('0x1c')](_0x308e9[_0xbaaa('0x1b')],function(_0x117ed8){return{'model':db[_0x117ed8[_0xbaaa('0x1d')]],'as':_0x117ed8['as'],'attributes':_0x117ed8[_0xbaaa('0x19')],'include':_0x117ed8[_0xbaaa('0x1b')]?_[_0xbaaa('0x1c')](_0x117ed8[_0xbaaa('0x1b')],function(_0x20a554){return{'model':db[_0x20a554[_0xbaaa('0x1d')]],'as':_0x20a554['as'],'attributes':_0x20a554[_0xbaaa('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbaaa('0xa')](function(_0xb91347){logger[_0xbaaa('0x12')](_0xbaaa('0x20'),_0x357571);logger[_0xbaaa('0xc')](_0xbaaa('0x20'),_0x357571,JSON[_0xbaaa('0xe')](_0xb91347));_0x19afa2(_0xb91347);})[_0xbaaa('0x14')](function(_0x2be289){logger[_0xbaaa('0xf')](_0xbaaa('0x20'),_0x2be289['message'],_0x357571);_0x153743(_0x54be25[_0xbaaa('0xf')](0x1f4,_0x2be289[_0xbaaa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index e9e9acc..30d4b3b 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 _0xcf98=['destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','setTags','update','delete'];(function(_0x4e11e7,_0x42d0b6){var _0x1d7d39=function(_0x416030){while(--_0x416030){_0x4e11e7['push'](_0x4e11e7['shift']());}};_0x1d7d39(++_0x42d0b6);}(_0xcf98,0x154));var _0x8cf9=function(_0x2046ed,_0x2b1391){_0x2046ed=_0x2046ed-0x0;var _0x541a07=_0xcf98[_0x2046ed];return _0x541a07;};'use strict';var multer=require(_0x8cf9('0x0'));var util=require('util');var path=require(_0x8cf9('0x1'));var timeout=require(_0x8cf9('0x2'));var express=require(_0x8cf9('0x3'));var router=express['Router']();var fs_extra=require(_0x8cf9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8cf9('0x5'));var config=require(_0x8cf9('0x6'));var controller=require(_0x8cf9('0x7'));router[_0x8cf9('0x8')]('/',auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xa')]);router[_0x8cf9('0x8')](_0x8cf9('0xb'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xc')]);router[_0x8cf9('0x8')]('/:id/fields',auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xd')]);router['get'](_0x8cf9('0xe'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0xf')]);router['get'](_0x8cf9('0x10'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0x11')]);router[_0x8cf9('0x8')](_0x8cf9('0x12'),auth['isAuthenticated'](),controller['getTags']);router[_0x8cf9('0x13')]('/',auth[_0x8cf9('0x9')](),controller[_0x8cf9('0x14')]);router[_0x8cf9('0x13')](_0x8cf9('0x12'),auth['isAuthenticated'](),controller[_0x8cf9('0x15')]);router['put'](_0x8cf9('0xb'),auth['isAuthenticated'](),controller[_0x8cf9('0x16')]);router[_0x8cf9('0x17')](_0x8cf9('0xb'),auth[_0x8cf9('0x9')](),controller[_0x8cf9('0x18')]);module[_0x8cf9('0x19')]=router; \ No newline at end of file +var _0x6725=['isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getDescriptions','/:id/tags','getTags','post','create','put','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','index','get','/:id'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x6725,0x139));var _0x5672=function(_0x53bc7c,_0x5f4a00){_0x53bc7c=_0x53bc7c-0x0;var _0x15e0c6=_0x6725[_0x53bc7c];return _0x15e0c6;};'use strict';var multer=require(_0x5672('0x0'));var util=require('util');var path=require(_0x5672('0x1'));var timeout=require(_0x5672('0x2'));var express=require('express');var router=express[_0x5672('0x3')]();var fs_extra=require(_0x5672('0x4'));var auth=require(_0x5672('0x5'));var interaction=require(_0x5672('0x6'));var config=require(_0x5672('0x7'));var controller=require(_0x5672('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x5672('0x9')]);router[_0x5672('0xa')](_0x5672('0xb'),auth[_0x5672('0xc')](),controller[_0x5672('0xd')]);router[_0x5672('0xa')](_0x5672('0xe'),auth['isAuthenticated'](),controller[_0x5672('0xf')]);router['get'](_0x5672('0x10'),auth[_0x5672('0xc')](),controller['getSubjects']);router[_0x5672('0xa')]('/:id/descriptions',auth[_0x5672('0xc')](),controller[_0x5672('0x11')]);router['get'](_0x5672('0x12'),auth[_0x5672('0xc')](),controller[_0x5672('0x13')]);router[_0x5672('0x14')]('/',auth[_0x5672('0xc')](),controller[_0x5672('0x15')]);router['post'](_0x5672('0x12'),auth[_0x5672('0xc')](),controller['setTags']);router[_0x5672('0x16')](_0x5672('0xb'),auth[_0x5672('0xc')](),controller['update']);router['delete'](_0x5672('0xb'),auth['isAuthenticated'](),controller[_0x5672('0x17')]);module[_0x5672('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 2eeaef7..e410b8b 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 _0x27b5=['STRING','sequelize'];(function(_0x16dfb3,_0x1613fc){var _0x1d8030=function(_0x1bd5da){while(--_0x1bd5da){_0x16dfb3['push'](_0x16dfb3['shift']());}};_0x1d8030(++_0x1613fc);}(_0x27b5,0x85));var _0x527b=function(_0x34b821,_0x504e55){_0x34b821=_0x34b821-0x0;var _0x5e00a0=_0x27b5[_0x34b821];return _0x5e00a0;};'use strict';var Sequelize=require(_0x527b('0x0'));module['exports']={'name':{'type':Sequelize[_0x527b('0x1')]},'description':{'type':Sequelize[_0x527b('0x1')]}}; \ No newline at end of file +var _0x94f9=['exports','STRING'];(function(_0x1efaa8,_0x13ea3d){var _0x402028=function(_0x3d92d5){while(--_0x3d92d5){_0x1efaa8['push'](_0x1efaa8['shift']());}};_0x402028(++_0x13ea3d);}(_0x94f9,0x10a));var _0x994f=function(_0x5e38a4,_0x333514){_0x5e38a4=_0x5e38a4-0x0;var _0x401332=_0x94f9[_0x5e38a4];return _0x401332;};'use strict';var Sequelize=require('sequelize');module[_0x994f('0x0')]={'name':{'type':Sequelize[_0x994f('0x1')]},'description':{'type':Sequelize[_0x994f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 72ea18e..520b939 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 _0x1bab=['limit','count','set','Content-Range','apply','destroy','then','end','sendStatus','stack','name','index','FreshdeskConfiguration','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','getFields','findOne','pick','getSubjects','FreshdeskField','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined'];(function(_0x1a7f5b,_0x2821e9){var _0x464a32=function(_0x436e80){while(--_0x436e80){_0x1a7f5b['push'](_0x1a7f5b['shift']());}};_0x464a32(++_0x2821e9);}(_0x1bab,0x1d9));var _0xb1ba=function(_0x46c98e,_0x3bc084){_0x46c98e=_0x46c98e-0x0;var _0x5bfd75=_0x1bab[_0x46c98e];return _0x5bfd75;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb1ba('0x0'));var zipdir=require(_0xb1ba('0x1'));var jsonpatch=require(_0xb1ba('0x2'));var rp=require(_0xb1ba('0x3'));var moment=require('moment');var BPromise=require(_0xb1ba('0x4'));var Mustache=require(_0xb1ba('0x5'));var util=require(_0xb1ba('0x6'));var path=require(_0xb1ba('0x7'));var sox=require('sox');var csv=require(_0xb1ba('0x8'));var ejs=require(_0xb1ba('0x9'));var fs=require('fs');var fs_extra=require(_0xb1ba('0xa'));var _=require(_0xb1ba('0xb'));var squel=require('squel');var crypto=require(_0xb1ba('0xc'));var jsforce=require(_0xb1ba('0xd'));var deskjs=require(_0xb1ba('0xe'));var toCsv=require(_0xb1ba('0x8'));var querystring=require(_0xb1ba('0xf'));var Papa=require(_0xb1ba('0x10'));var Redis=require(_0xb1ba('0x11'));var authService=require(_0xb1ba('0x12'));var qs=require(_0xb1ba('0x13'));var as=require(_0xb1ba('0x14'));var hardwareService=require(_0xb1ba('0x15'));var logger=require(_0xb1ba('0x16'))(_0xb1ba('0x17'));var utils=require(_0xb1ba('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb1ba('0x19'));var db=require(_0xb1ba('0x1a'))['db'];function respondWithStatusCode(_0x1b213f,_0x3dc620){_0x3dc620=_0x3dc620||0xcc;return function(_0x4a69b8){if(_0x4a69b8){return _0x1b213f['sendStatus'](_0x3dc620);}return _0x1b213f[_0xb1ba('0x1b')](_0x3dc620)['end']();};}function respondWithResult(_0x2d165d,_0xdb50ba){_0xdb50ba=_0xdb50ba||0xc8;return function(_0x2d431d){if(_0x2d431d){return _0x2d165d[_0xb1ba('0x1b')](_0xdb50ba)[_0xb1ba('0x1c')](_0x2d431d);}};}function respondWithFilteredResult(_0x831041,_0x313a02){return function(_0x4ea962){if(_0x4ea962){var _0x29d9b7=typeof _0x313a02[_0xb1ba('0x1d')]===_0xb1ba('0x1e')&&typeof _0x313a02[_0xb1ba('0x1f')]==='undefined';var _0x2466bd=_0x4ea962[_0xb1ba('0x20')];var _0x4f2526=_0x29d9b7?0x0:_0x313a02[_0xb1ba('0x1d')];var _0x23e1d3=_0x29d9b7?_0x4ea962[_0xb1ba('0x20')]:_0x313a02[_0xb1ba('0x1d')]+_0x313a02[_0xb1ba('0x1f')];var _0x11eb71;if(_0x23e1d3>=_0x2466bd){_0x23e1d3=_0x2466bd;_0x11eb71=0xc8;}else{_0x11eb71=0xce;}_0x831041[_0xb1ba('0x1b')](_0x11eb71);return _0x831041[_0xb1ba('0x21')](_0xb1ba('0x22'),_0x4f2526+'-'+_0x23e1d3+'/'+_0x2466bd)[_0xb1ba('0x1c')](_0x4ea962);}return null;};}function patchUpdates(_0x48dcd3){return function(_0x4e7d18){try{jsonpatch[_0xb1ba('0x23')](_0x4e7d18,_0x48dcd3,!![]);}catch(_0x23eea9){return BPromise['reject'](_0x23eea9);}return _0x4e7d18['save']();};}function saveUpdates(_0x5bb37c,_0x54874f){return function(_0x297bd3){if(_0x297bd3){return _0x297bd3['update'](_0x5bb37c)['then'](function(_0x5cce43){return _0x5cce43;});}return null;};}function removeEntity(_0x1b1de3,_0x245e84){return function(_0x50a33c){if(_0x50a33c){return _0x50a33c[_0xb1ba('0x24')]()[_0xb1ba('0x25')](function(){_0x1b1de3[_0xb1ba('0x1b')](0xcc)[_0xb1ba('0x26')]();});}};}function handleEntityNotFound(_0x2ac327,_0x21ebd7){return function(_0x3919b9){if(!_0x3919b9){_0x2ac327[_0xb1ba('0x27')](0x194);}return _0x3919b9;};}function handleError(_0x110f31,_0x21406e){_0x21406e=_0x21406e||0x1f4;return function(_0x5d602f){logger['error'](_0x5d602f[_0xb1ba('0x28')]);if(_0x5d602f[_0xb1ba('0x29')]){delete _0x5d602f[_0xb1ba('0x29')];}_0x110f31[_0xb1ba('0x1b')](_0x21406e)['send'](_0x5d602f);};}exports[_0xb1ba('0x2a')]=function(_0x36ec82,_0x51aa4a){var _0x1b5d01={},_0x4d1e9f={},_0x418c3a={'count':0x0,'rows':[]};var _0x23fae3=_['map'](db[_0xb1ba('0x2b')][_0xb1ba('0x2c')],function(_0x5a5f6d){return{'name':_0x5a5f6d[_0xb1ba('0x2d')],'type':_0x5a5f6d['type']['key']};});_0x4d1e9f[_0xb1ba('0x2e')]=_[_0xb1ba('0x2f')](_0x23fae3,_0xb1ba('0x29'));_0x4d1e9f[_0xb1ba('0x30')]=_[_0xb1ba('0x31')](_0x36ec82['query']);_0x4d1e9f[_0xb1ba('0x32')]=_[_0xb1ba('0x33')](_0x4d1e9f[_0xb1ba('0x2e')],_0x4d1e9f[_0xb1ba('0x30')]);_0x1b5d01[_0xb1ba('0x34')]=_['intersection'](_0x4d1e9f[_0xb1ba('0x2e')],qs[_0xb1ba('0x35')](_0x36ec82[_0xb1ba('0x30')]['fields']));_0x1b5d01[_0xb1ba('0x34')]=_0x1b5d01[_0xb1ba('0x34')][_0xb1ba('0x36')]?_0x1b5d01[_0xb1ba('0x34')]:_0x4d1e9f['model'];if(!_0x36ec82[_0xb1ba('0x30')][_0xb1ba('0x37')](_0xb1ba('0x38'))){_0x1b5d01[_0xb1ba('0x1f')]=qs[_0xb1ba('0x1f')](_0x36ec82[_0xb1ba('0x30')][_0xb1ba('0x1f')]);_0x1b5d01[_0xb1ba('0x1d')]=qs[_0xb1ba('0x1d')](_0x36ec82['query'][_0xb1ba('0x1d')]);}_0x1b5d01[_0xb1ba('0x39')]=qs[_0xb1ba('0x3a')](_0x36ec82['query'][_0xb1ba('0x3a')]);_0x1b5d01['where']=qs[_0xb1ba('0x32')](_['pick'](_0x36ec82[_0xb1ba('0x30')],_0x4d1e9f['filters']),_0x23fae3);if(_0x36ec82['query'][_0xb1ba('0x3b')]){_0x1b5d01[_0xb1ba('0x3c')]=_[_0xb1ba('0x3d')](_0x1b5d01[_0xb1ba('0x3c')],{'$or':_[_0xb1ba('0x2f')](_0x23fae3,function(_0x1ea6aa){if(_0x1ea6aa[_0xb1ba('0x3e')]!==_0xb1ba('0x3f')){var _0x932b0b={};_0x932b0b[_0x1ea6aa[_0xb1ba('0x29')]]={'$like':'%'+_0x36ec82[_0xb1ba('0x30')][_0xb1ba('0x3b')]+'%'};return _0x932b0b;}})});}_0x1b5d01=_[_0xb1ba('0x3d')]({},_0x1b5d01,_0x36ec82[_0xb1ba('0x40')]);var _0x3d9074={'where':_0x1b5d01['where']};return db['FreshdeskConfiguration'][_0xb1ba('0x20')](_0x3d9074)[_0xb1ba('0x25')](function(_0x7c2537){_0x418c3a['count']=_0x7c2537;if(_0x36ec82[_0xb1ba('0x30')]['includeAll']){_0x1b5d01[_0xb1ba('0x41')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xb1ba('0x42')](_0x1b5d01);})[_0xb1ba('0x25')](function(_0x1b64dc){_0x418c3a[_0xb1ba('0x43')]=_0x1b64dc;return _0x418c3a;})['then'](respondWithFilteredResult(_0x51aa4a,_0x1b5d01))[_0xb1ba('0x44')](handleError(_0x51aa4a,null));};exports['show']=function(_0x1f8430,_0x381333){var _0x5d9bfc={'raw':![],'where':{'id':_0x1f8430[_0xb1ba('0x45')]['id']}},_0x5c3797={};_0x5c3797['model']=_[_0xb1ba('0x31')](db[_0xb1ba('0x2b')][_0xb1ba('0x2c')]);_0x5c3797['query']=_['keys'](_0x1f8430[_0xb1ba('0x30')]);_0x5c3797[_0xb1ba('0x32')]=_[_0xb1ba('0x33')](_0x5c3797[_0xb1ba('0x2e')],_0x5c3797[_0xb1ba('0x30')]);_0x5d9bfc[_0xb1ba('0x34')]=_[_0xb1ba('0x33')](_0x5c3797[_0xb1ba('0x2e')],qs[_0xb1ba('0x35')](_0x1f8430[_0xb1ba('0x30')][_0xb1ba('0x35')]));_0x5d9bfc[_0xb1ba('0x34')]=_0x5d9bfc['attributes'][_0xb1ba('0x36')]?_0x5d9bfc[_0xb1ba('0x34')]:_0x5c3797[_0xb1ba('0x2e')];if(_0x1f8430['query'][_0xb1ba('0x46')]){_0x5d9bfc[_0xb1ba('0x41')]=[{'all':!![]}];}_0x5d9bfc=_[_0xb1ba('0x3d')]({},_0x5d9bfc,_0x1f8430[_0xb1ba('0x40')]);return db['FreshdeskConfiguration'][_0xb1ba('0x47')](_0x5d9bfc)[_0xb1ba('0x25')](handleEntityNotFound(_0x381333,null))[_0xb1ba('0x25')](respondWithResult(_0x381333,null))[_0xb1ba('0x44')](handleError(_0x381333,null));};exports[_0xb1ba('0x48')]=function(_0x2b6fe8,_0x334c6f){return db[_0xb1ba('0x2b')]['create'](_0x2b6fe8['body'],{})['then'](respondWithResult(_0x334c6f,0xc9))[_0xb1ba('0x44')](handleError(_0x334c6f,null));};exports['update']=function(_0x3ce14b,_0x376e09){if(_0x3ce14b['body']['id']){delete _0x3ce14b[_0xb1ba('0x49')]['id'];}return db[_0xb1ba('0x2b')][_0xb1ba('0x47')]({'where':{'id':_0x3ce14b[_0xb1ba('0x45')]['id']}})['then'](handleEntityNotFound(_0x376e09,null))[_0xb1ba('0x25')](saveUpdates(_0x3ce14b[_0xb1ba('0x49')],null))[_0xb1ba('0x25')](respondWithResult(_0x376e09,null))[_0xb1ba('0x44')](handleError(_0x376e09,null));};exports['destroy']=function(_0x5acd30,_0x3b4d06){return db[_0xb1ba('0x2b')][_0xb1ba('0x47')]({'where':{'id':_0x5acd30[_0xb1ba('0x45')]['id']}})[_0xb1ba('0x25')](handleEntityNotFound(_0x3b4d06,null))['then'](removeEntity(_0x3b4d06,null))[_0xb1ba('0x44')](handleError(_0x3b4d06,null));};exports[_0xb1ba('0x4a')]=function(_0x2c0f81,_0x5fb877,_0x31e4f2){var _0x36dab4={};var _0x1064c8={};var _0x54d95d;var _0xeada1e;return db['FreshdeskConfiguration'][_0xb1ba('0x4b')]({'where':{'id':_0x2c0f81[_0xb1ba('0x45')]['id']}})[_0xb1ba('0x25')](handleEntityNotFound(_0x5fb877,null))[_0xb1ba('0x25')](function(_0x2cad12){if(_0x2cad12){_0x54d95d=_0x2cad12;_0x1064c8['model']=_[_0xb1ba('0x31')](db['FreshdeskField']['rawAttributes']);_0x1064c8['query']=_[_0xb1ba('0x31')](_0x2c0f81['query']);_0x1064c8[_0xb1ba('0x32')]=_[_0xb1ba('0x33')](_0x1064c8['model'],_0x1064c8[_0xb1ba('0x30')]);_0x36dab4['attributes']=_[_0xb1ba('0x33')](_0x1064c8[_0xb1ba('0x2e')],qs[_0xb1ba('0x35')](_0x2c0f81[_0xb1ba('0x30')][_0xb1ba('0x35')]));_0x36dab4[_0xb1ba('0x34')]=_0x36dab4[_0xb1ba('0x34')][_0xb1ba('0x36')]?_0x36dab4['attributes']:_0x1064c8[_0xb1ba('0x2e')];_0x36dab4[_0xb1ba('0x39')]=qs[_0xb1ba('0x3a')](_0x2c0f81[_0xb1ba('0x30')][_0xb1ba('0x3a')]);_0x36dab4[_0xb1ba('0x3c')]=qs[_0xb1ba('0x32')](_[_0xb1ba('0x4c')](_0x2c0f81['query'],_0x1064c8[_0xb1ba('0x32')]));if(_0x2c0f81[_0xb1ba('0x30')][_0xb1ba('0x3b')]){_0x36dab4[_0xb1ba('0x3c')]=_[_0xb1ba('0x3d')](_0x36dab4[_0xb1ba('0x3c')],{'$or':_[_0xb1ba('0x2f')](_0x36dab4['attributes'],function(_0x3c40ac){var _0x5dc556={};_0x5dc556[_0x3c40ac]={'$like':'%'+_0x2c0f81[_0xb1ba('0x30')][_0xb1ba('0x3b')]+'%'};return _0x5dc556;})});}_0x36dab4=_[_0xb1ba('0x3d')]({},_0x36dab4,_0x2c0f81[_0xb1ba('0x40')]);return _0x54d95d[_0xb1ba('0x4a')](_0x36dab4);}})[_0xb1ba('0x25')](function(_0x1b87f5){if(_0x1b87f5){_0xeada1e=_0x1b87f5[_0xb1ba('0x36')];if(!_0x2c0f81[_0xb1ba('0x30')][_0xb1ba('0x37')](_0xb1ba('0x38'))){_0x36dab4[_0xb1ba('0x1f')]=qs[_0xb1ba('0x1f')](_0x2c0f81[_0xb1ba('0x30')][_0xb1ba('0x1f')]);_0x36dab4[_0xb1ba('0x1d')]=qs[_0xb1ba('0x1d')](_0x2c0f81[_0xb1ba('0x30')][_0xb1ba('0x1d')]);}return _0x54d95d[_0xb1ba('0x4a')](_0x36dab4);}})[_0xb1ba('0x25')](function(_0x412a6b){if(_0x412a6b){return _0x412a6b?{'count':_0xeada1e,'rows':_0x412a6b}:null;}})[_0xb1ba('0x25')](respondWithResult(_0x5fb877,null))[_0xb1ba('0x44')](handleError(_0x5fb877,null));};exports[_0xb1ba('0x4d')]=function(_0x2e383f,_0x47f0c8,_0x176624){var _0x1038dd={};var _0x7f42eb={};var _0x4dc122;var _0x16cb12;return db[_0xb1ba('0x2b')]['findOne']({'where':{'id':_0x2e383f[_0xb1ba('0x45')]['id']}})[_0xb1ba('0x25')](handleEntityNotFound(_0x47f0c8,null))[_0xb1ba('0x25')](function(_0x931b48){if(_0x931b48){_0x4dc122=_0x931b48;_0x7f42eb[_0xb1ba('0x2e')]=_['keys'](db[_0xb1ba('0x4e')]['rawAttributes']);_0x7f42eb['query']=_['keys'](_0x2e383f[_0xb1ba('0x30')]);_0x7f42eb[_0xb1ba('0x32')]=_['intersection'](_0x7f42eb['model'],_0x7f42eb['query']);_0x1038dd['attributes']=_['intersection'](_0x7f42eb['model'],qs['fields'](_0x2e383f['query'][_0xb1ba('0x35')]));_0x1038dd[_0xb1ba('0x34')]=_0x1038dd[_0xb1ba('0x34')][_0xb1ba('0x36')]?_0x1038dd['attributes']:_0x7f42eb['model'];_0x1038dd[_0xb1ba('0x39')]=qs[_0xb1ba('0x3a')](_0x2e383f[_0xb1ba('0x30')]['sort']);_0x1038dd[_0xb1ba('0x3c')]=qs[_0xb1ba('0x32')](_[_0xb1ba('0x4c')](_0x2e383f[_0xb1ba('0x30')],_0x7f42eb[_0xb1ba('0x32')]));if(_0x2e383f[_0xb1ba('0x30')]['filter']){_0x1038dd['where']=_[_0xb1ba('0x3d')](_0x1038dd[_0xb1ba('0x3c')],{'$or':_[_0xb1ba('0x2f')](_0x1038dd[_0xb1ba('0x34')],function(_0x2dabac){var _0x258323={};_0x258323[_0x2dabac]={'$like':'%'+_0x2e383f[_0xb1ba('0x30')][_0xb1ba('0x3b')]+'%'};return _0x258323;})});}_0x1038dd=_[_0xb1ba('0x3d')]({},_0x1038dd,_0x2e383f[_0xb1ba('0x40')]);return _0x4dc122[_0xb1ba('0x4d')](_0x1038dd);}})['then'](function(_0x3594f4){if(_0x3594f4){_0x16cb12=_0x3594f4[_0xb1ba('0x36')];if(!_0x2e383f[_0xb1ba('0x30')][_0xb1ba('0x37')](_0xb1ba('0x38'))){_0x1038dd[_0xb1ba('0x1f')]=qs[_0xb1ba('0x1f')](_0x2e383f[_0xb1ba('0x30')][_0xb1ba('0x1f')]);_0x1038dd[_0xb1ba('0x1d')]=qs['offset'](_0x2e383f[_0xb1ba('0x30')]['offset']);}return _0x4dc122[_0xb1ba('0x4d')](_0x1038dd);}})[_0xb1ba('0x25')](function(_0x3f64f5){if(_0x3f64f5){return _0x3f64f5?{'count':_0x16cb12,'rows':_0x3f64f5}:null;}})[_0xb1ba('0x25')](respondWithResult(_0x47f0c8,null))[_0xb1ba('0x44')](handleError(_0x47f0c8,null));};exports[_0xb1ba('0x4f')]=function(_0x3ef9eb,_0x4b3545,_0x395f33){var _0x957e33={};var _0xfbe5b5={};var _0x22626a;var _0x436a1d;return db[_0xb1ba('0x2b')]['findOne']({'where':{'id':_0x3ef9eb[_0xb1ba('0x45')]['id']}})['then'](handleEntityNotFound(_0x4b3545,null))[_0xb1ba('0x25')](function(_0x29e071){if(_0x29e071){_0x22626a=_0x29e071;_0xfbe5b5[_0xb1ba('0x2e')]=_[_0xb1ba('0x31')](db[_0xb1ba('0x4e')]['rawAttributes']);_0xfbe5b5[_0xb1ba('0x30')]=_[_0xb1ba('0x31')](_0x3ef9eb[_0xb1ba('0x30')]);_0xfbe5b5[_0xb1ba('0x32')]=_[_0xb1ba('0x33')](_0xfbe5b5[_0xb1ba('0x2e')],_0xfbe5b5['query']);_0x957e33[_0xb1ba('0x34')]=_[_0xb1ba('0x33')](_0xfbe5b5[_0xb1ba('0x2e')],qs[_0xb1ba('0x35')](_0x3ef9eb['query'][_0xb1ba('0x35')]));_0x957e33[_0xb1ba('0x34')]=_0x957e33['attributes']['length']?_0x957e33[_0xb1ba('0x34')]:_0xfbe5b5[_0xb1ba('0x2e')];_0x957e33[_0xb1ba('0x39')]=qs[_0xb1ba('0x3a')](_0x3ef9eb['query'][_0xb1ba('0x3a')]);_0x957e33['where']=qs['filters'](_[_0xb1ba('0x4c')](_0x3ef9eb[_0xb1ba('0x30')],_0xfbe5b5[_0xb1ba('0x32')]));if(_0x3ef9eb[_0xb1ba('0x30')][_0xb1ba('0x3b')]){_0x957e33[_0xb1ba('0x3c')]=_[_0xb1ba('0x3d')](_0x957e33[_0xb1ba('0x3c')],{'$or':_[_0xb1ba('0x2f')](_0x957e33['attributes'],function(_0x11b406){var _0x56013f={};_0x56013f[_0x11b406]={'$like':'%'+_0x3ef9eb['query']['filter']+'%'};return _0x56013f;})});}_0x957e33=_[_0xb1ba('0x3d')]({},_0x957e33,_0x3ef9eb[_0xb1ba('0x40')]);return _0x22626a[_0xb1ba('0x4f')](_0x957e33);}})[_0xb1ba('0x25')](function(_0x50e22f){if(_0x50e22f){_0x436a1d=_0x50e22f[_0xb1ba('0x36')];if(!_0x3ef9eb[_0xb1ba('0x30')][_0xb1ba('0x37')](_0xb1ba('0x38'))){_0x957e33[_0xb1ba('0x1f')]=qs['limit'](_0x3ef9eb['query'][_0xb1ba('0x1f')]);_0x957e33[_0xb1ba('0x1d')]=qs[_0xb1ba('0x1d')](_0x3ef9eb['query']['offset']);}return _0x22626a[_0xb1ba('0x4f')](_0x957e33);}})[_0xb1ba('0x25')](function(_0x159484){if(_0x159484){return _0x159484?{'count':_0x436a1d,'rows':_0x159484}:null;}})['then'](respondWithResult(_0x4b3545,null))[_0xb1ba('0x44')](handleError(_0x4b3545,null));};exports[_0xb1ba('0x50')]=function(_0x5d7b83,_0x10d43a,_0x470717){var _0x529f53={};var _0x56e57e={};var _0x5d6071;var _0x1c4a43;return db[_0xb1ba('0x2b')]['findOne']({'where':{'id':_0x5d7b83[_0xb1ba('0x45')]['id']}})[_0xb1ba('0x25')](handleEntityNotFound(_0x10d43a,null))[_0xb1ba('0x25')](function(_0x1b7efe){if(_0x1b7efe){_0x5d6071=_0x1b7efe;_0x56e57e[_0xb1ba('0x2e')]=_['keys'](db[_0xb1ba('0x51')]['rawAttributes']);_0x56e57e[_0xb1ba('0x30')]=_[_0xb1ba('0x31')](_0x5d7b83[_0xb1ba('0x30')]);_0x56e57e[_0xb1ba('0x32')]=_['intersection'](_0x56e57e[_0xb1ba('0x2e')],_0x56e57e[_0xb1ba('0x30')]);_0x529f53[_0xb1ba('0x34')]=_[_0xb1ba('0x33')](_0x56e57e[_0xb1ba('0x2e')],qs[_0xb1ba('0x35')](_0x5d7b83['query']['fields']));_0x529f53[_0xb1ba('0x34')]=_0x529f53['attributes']['length']?_0x529f53[_0xb1ba('0x34')]:_0x56e57e[_0xb1ba('0x2e')];_0x529f53[_0xb1ba('0x39')]=qs['sort'](_0x5d7b83[_0xb1ba('0x30')]['sort']);_0x529f53[_0xb1ba('0x3c')]=qs[_0xb1ba('0x32')](_[_0xb1ba('0x4c')](_0x5d7b83[_0xb1ba('0x30')],_0x56e57e[_0xb1ba('0x32')]));if(_0x5d7b83[_0xb1ba('0x30')][_0xb1ba('0x3b')]){_0x529f53[_0xb1ba('0x3c')]=_[_0xb1ba('0x3d')](_0x529f53[_0xb1ba('0x3c')],{'$or':_['map'](_0x529f53['attributes'],function(_0x161f60){var _0xb67cae={};_0xb67cae[_0x161f60]={'$like':'%'+_0x5d7b83[_0xb1ba('0x30')][_0xb1ba('0x3b')]+'%'};return _0xb67cae;})});}_0x529f53=_[_0xb1ba('0x3d')]({},_0x529f53,_0x5d7b83[_0xb1ba('0x40')]);return _0x5d6071[_0xb1ba('0x50')](_0x529f53);}})[_0xb1ba('0x25')](function(_0x30adac){if(_0x30adac){_0x1c4a43=_0x30adac[_0xb1ba('0x36')];if(!_0x5d7b83['query']['hasOwnProperty'](_0xb1ba('0x38'))){_0x529f53[_0xb1ba('0x1f')]=qs[_0xb1ba('0x1f')](_0x5d7b83[_0xb1ba('0x30')][_0xb1ba('0x1f')]);_0x529f53[_0xb1ba('0x1d')]=qs[_0xb1ba('0x1d')](_0x5d7b83[_0xb1ba('0x30')][_0xb1ba('0x1d')]);}return _0x5d6071[_0xb1ba('0x50')](_0x529f53);}})[_0xb1ba('0x25')](function(_0x2b33bb){if(_0x2b33bb){return _0x2b33bb?{'count':_0x1c4a43,'rows':_0x2b33bb}:null;}})['then'](respondWithResult(_0x10d43a,null))[_0xb1ba('0x44')](handleError(_0x10d43a,null));};exports[_0xb1ba('0x52')]=function(_0x3b1197,_0x45486b,_0x770769){if(_0x3b1197[_0xb1ba('0x49')]['id']){delete _0x3b1197[_0xb1ba('0x49')]['id'];}return db[_0xb1ba('0x2b')]['findOne']({'where':{'id':_0x3b1197[_0xb1ba('0x45')]['id']}})[_0xb1ba('0x25')](handleEntityNotFound(_0x45486b,null))[_0xb1ba('0x25')](function(_0x205267){if(_0x205267){return _0x205267[_0xb1ba('0x52')](_0x3b1197[_0xb1ba('0x49')][_0xb1ba('0x53')]||[]);}return null;})[_0xb1ba('0x25')](respondWithResult(_0x45486b,null))['catch'](handleError(_0x45486b,null));}; \ No newline at end of file +var _0xed6b=['set','save','update','then','destroy','error','stack','name','send','index','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','VIRTUAL','includeAll','include','rows','show','params','keys','options','find','create','body','catch','getFields','findOne','FreshdeskField','pick','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count'];(function(_0x2181b1,_0x569637){var _0x530548=function(_0x4b31f1){while(--_0x4b31f1){_0x2181b1['push'](_0x2181b1['shift']());}};_0x530548(++_0x569637);}(_0xed6b,0x178));var _0xbed6=function(_0x5dd7c1,_0x31e14c){_0x5dd7c1=_0x5dd7c1-0x0;var _0x2ba668=_0xed6b[_0x5dd7c1];return _0x2ba668;};'use strict';var emlformat=require(_0xbed6('0x0'));var rimraf=require(_0xbed6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbed6('0x2'));var BPromise=require(_0xbed6('0x3'));var Mustache=require(_0xbed6('0x4'));var util=require(_0xbed6('0x5'));var path=require(_0xbed6('0x6'));var sox=require(_0xbed6('0x7'));var csv=require(_0xbed6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbed6('0x9'));var _=require('lodash');var squel=require(_0xbed6('0xa'));var crypto=require('crypto');var jsforce=require(_0xbed6('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xbed6('0x8'));var querystring=require(_0xbed6('0xc'));var Papa=require(_0xbed6('0xd'));var Redis=require(_0xbed6('0xe'));var authService=require(_0xbed6('0xf'));var qs=require(_0xbed6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xbed6('0x11'));var config=require(_0xbed6('0x12'));var licenseUtil=require(_0xbed6('0x13'));var db=require(_0xbed6('0x14'))['db'];function respondWithStatusCode(_0x574e5d,_0x4dbc56){_0x4dbc56=_0x4dbc56||0xcc;return function(_0x11c5e2){if(_0x11c5e2){return _0x574e5d[_0xbed6('0x15')](_0x4dbc56);}return _0x574e5d[_0xbed6('0x16')](_0x4dbc56)[_0xbed6('0x17')]();};}function respondWithResult(_0x102d12,_0x52f796){_0x52f796=_0x52f796||0xc8;return function(_0x533d61){if(_0x533d61){return _0x102d12[_0xbed6('0x16')](_0x52f796)[_0xbed6('0x18')](_0x533d61);}};}function respondWithFilteredResult(_0xae00cc,_0x2c683c){return function(_0x424482){if(_0x424482){var _0x3b358e=typeof _0x2c683c[_0xbed6('0x19')]==='undefined'&&typeof _0x2c683c[_0xbed6('0x1a')]===_0xbed6('0x1b');var _0x30d4ea=_0x424482['count'];var _0x16e3cf=_0x3b358e?0x0:_0x2c683c[_0xbed6('0x19')];var _0x459016=_0x3b358e?_0x424482[_0xbed6('0x1c')]:_0x2c683c[_0xbed6('0x19')]+_0x2c683c[_0xbed6('0x1a')];var _0x2da56c;if(_0x459016>=_0x30d4ea){_0x459016=_0x30d4ea;_0x2da56c=0xc8;}else{_0x2da56c=0xce;}_0xae00cc[_0xbed6('0x16')](_0x2da56c);return _0xae00cc[_0xbed6('0x1d')]('Content-Range',_0x16e3cf+'-'+_0x459016+'/'+_0x30d4ea)[_0xbed6('0x18')](_0x424482);}return null;};}function patchUpdates(_0x5d496a){return function(_0x48679c){try{jsonpatch['apply'](_0x48679c,_0x5d496a,!![]);}catch(_0x1b4a63){return BPromise['reject'](_0x1b4a63);}return _0x48679c[_0xbed6('0x1e')]();};}function saveUpdates(_0x3c0ec5,_0x16a106){return function(_0x185c64){if(_0x185c64){return _0x185c64[_0xbed6('0x1f')](_0x3c0ec5)[_0xbed6('0x20')](function(_0xcc8f1b){return _0xcc8f1b;});}return null;};}function removeEntity(_0x21650f,_0x150262){return function(_0x57fdc9){if(_0x57fdc9){return _0x57fdc9[_0xbed6('0x21')]()[_0xbed6('0x20')](function(){_0x21650f[_0xbed6('0x16')](0xcc)[_0xbed6('0x17')]();});}};}function handleEntityNotFound(_0x2dd229,_0x250c50){return function(_0x3f7e91){if(!_0x3f7e91){_0x2dd229[_0xbed6('0x15')](0x194);}return _0x3f7e91;};}function handleError(_0x4aa704,_0x18ae96){_0x18ae96=_0x18ae96||0x1f4;return function(_0xf712e0){logger[_0xbed6('0x22')](_0xf712e0[_0xbed6('0x23')]);if(_0xf712e0[_0xbed6('0x24')]){delete _0xf712e0[_0xbed6('0x24')];}_0x4aa704[_0xbed6('0x16')](_0x18ae96)[_0xbed6('0x25')](_0xf712e0);};}exports[_0xbed6('0x26')]=function(_0x26e37f,_0x4b3201){var _0x57042a={},_0x1ab084={},_0x326473={'count':0x0,'rows':[]};var _0x242847=_['map'](db[_0xbed6('0x27')][_0xbed6('0x28')],function(_0x365155){return{'name':_0x365155[_0xbed6('0x29')],'type':_0x365155[_0xbed6('0x2a')][_0xbed6('0x2b')]};});_0x1ab084[_0xbed6('0x2c')]=_['map'](_0x242847,_0xbed6('0x24'));_0x1ab084['query']=_['keys'](_0x26e37f[_0xbed6('0x2d')]);_0x1ab084['filters']=_['intersection'](_0x1ab084[_0xbed6('0x2c')],_0x1ab084[_0xbed6('0x2d')]);_0x57042a[_0xbed6('0x2e')]=_[_0xbed6('0x2f')](_0x1ab084[_0xbed6('0x2c')],qs[_0xbed6('0x30')](_0x26e37f[_0xbed6('0x2d')][_0xbed6('0x30')]));_0x57042a[_0xbed6('0x2e')]=_0x57042a[_0xbed6('0x2e')][_0xbed6('0x31')]?_0x57042a[_0xbed6('0x2e')]:_0x1ab084['model'];if(!_0x26e37f[_0xbed6('0x2d')][_0xbed6('0x32')](_0xbed6('0x33'))){_0x57042a[_0xbed6('0x1a')]=qs[_0xbed6('0x1a')](_0x26e37f[_0xbed6('0x2d')][_0xbed6('0x1a')]);_0x57042a['offset']=qs[_0xbed6('0x19')](_0x26e37f[_0xbed6('0x2d')][_0xbed6('0x19')]);}_0x57042a[_0xbed6('0x34')]=qs['sort'](_0x26e37f[_0xbed6('0x2d')][_0xbed6('0x35')]);_0x57042a[_0xbed6('0x36')]=qs[_0xbed6('0x37')](_['pick'](_0x26e37f[_0xbed6('0x2d')],_0x1ab084[_0xbed6('0x37')]),_0x242847);if(_0x26e37f[_0xbed6('0x2d')][_0xbed6('0x38')]){_0x57042a['where']=_[_0xbed6('0x39')](_0x57042a[_0xbed6('0x36')],{'$or':_[_0xbed6('0x3a')](_0x242847,function(_0x5f57d6){if(_0x5f57d6['type']!==_0xbed6('0x3b')){var _0x425e34={};_0x425e34[_0x5f57d6[_0xbed6('0x24')]]={'$like':'%'+_0x26e37f[_0xbed6('0x2d')][_0xbed6('0x38')]+'%'};return _0x425e34;}})});}_0x57042a=_[_0xbed6('0x39')]({},_0x57042a,_0x26e37f['options']);var _0x45a66d={'where':_0x57042a['where']};return db[_0xbed6('0x27')][_0xbed6('0x1c')](_0x45a66d)[_0xbed6('0x20')](function(_0x309208){_0x326473[_0xbed6('0x1c')]=_0x309208;if(_0x26e37f[_0xbed6('0x2d')][_0xbed6('0x3c')]){_0x57042a[_0xbed6('0x3d')]=[{'all':!![]}];}return db[_0xbed6('0x27')]['findAll'](_0x57042a);})[_0xbed6('0x20')](function(_0x188551){_0x326473[_0xbed6('0x3e')]=_0x188551;return _0x326473;})['then'](respondWithFilteredResult(_0x4b3201,_0x57042a))['catch'](handleError(_0x4b3201,null));};exports[_0xbed6('0x3f')]=function(_0x10bd70,_0x33f497){var _0x3b4983={'raw':![],'where':{'id':_0x10bd70[_0xbed6('0x40')]['id']}},_0x22b4d0={};_0x22b4d0[_0xbed6('0x2c')]=_[_0xbed6('0x41')](db[_0xbed6('0x27')]['rawAttributes']);_0x22b4d0['query']=_['keys'](_0x10bd70[_0xbed6('0x2d')]);_0x22b4d0['filters']=_[_0xbed6('0x2f')](_0x22b4d0[_0xbed6('0x2c')],_0x22b4d0[_0xbed6('0x2d')]);_0x3b4983[_0xbed6('0x2e')]=_['intersection'](_0x22b4d0[_0xbed6('0x2c')],qs[_0xbed6('0x30')](_0x10bd70[_0xbed6('0x2d')]['fields']));_0x3b4983[_0xbed6('0x2e')]=_0x3b4983[_0xbed6('0x2e')][_0xbed6('0x31')]?_0x3b4983[_0xbed6('0x2e')]:_0x22b4d0[_0xbed6('0x2c')];if(_0x10bd70['query'][_0xbed6('0x3c')]){_0x3b4983[_0xbed6('0x3d')]=[{'all':!![]}];}_0x3b4983=_[_0xbed6('0x39')]({},_0x3b4983,_0x10bd70[_0xbed6('0x42')]);return db['FreshdeskConfiguration'][_0xbed6('0x43')](_0x3b4983)[_0xbed6('0x20')](handleEntityNotFound(_0x33f497,null))[_0xbed6('0x20')](respondWithResult(_0x33f497,null))['catch'](handleError(_0x33f497,null));};exports[_0xbed6('0x44')]=function(_0x1c5846,_0x5aaa93){return db[_0xbed6('0x27')][_0xbed6('0x44')](_0x1c5846[_0xbed6('0x45')],{})[_0xbed6('0x20')](respondWithResult(_0x5aaa93,0xc9))[_0xbed6('0x46')](handleError(_0x5aaa93,null));};exports[_0xbed6('0x1f')]=function(_0x345af6,_0x46db56){if(_0x345af6[_0xbed6('0x45')]['id']){delete _0x345af6[_0xbed6('0x45')]['id'];}return db[_0xbed6('0x27')][_0xbed6('0x43')]({'where':{'id':_0x345af6[_0xbed6('0x40')]['id']}})[_0xbed6('0x20')](handleEntityNotFound(_0x46db56,null))['then'](saveUpdates(_0x345af6[_0xbed6('0x45')],null))[_0xbed6('0x20')](respondWithResult(_0x46db56,null))[_0xbed6('0x46')](handleError(_0x46db56,null));};exports[_0xbed6('0x21')]=function(_0x2ac037,_0x7b6b40){return db[_0xbed6('0x27')][_0xbed6('0x43')]({'where':{'id':_0x2ac037['params']['id']}})[_0xbed6('0x20')](handleEntityNotFound(_0x7b6b40,null))[_0xbed6('0x20')](removeEntity(_0x7b6b40,null))[_0xbed6('0x46')](handleError(_0x7b6b40,null));};exports[_0xbed6('0x47')]=function(_0x607b56,_0x399c44,_0x1e5695){var _0x506cd1={};var _0x46a0a6={};var _0x24393b;var _0x58d557;return db['FreshdeskConfiguration'][_0xbed6('0x48')]({'where':{'id':_0x607b56[_0xbed6('0x40')]['id']}})[_0xbed6('0x20')](handleEntityNotFound(_0x399c44,null))[_0xbed6('0x20')](function(_0x53c94a){if(_0x53c94a){_0x24393b=_0x53c94a;_0x46a0a6[_0xbed6('0x2c')]=_[_0xbed6('0x41')](db[_0xbed6('0x49')]['rawAttributes']);_0x46a0a6[_0xbed6('0x2d')]=_[_0xbed6('0x41')](_0x607b56['query']);_0x46a0a6[_0xbed6('0x37')]=_[_0xbed6('0x2f')](_0x46a0a6[_0xbed6('0x2c')],_0x46a0a6[_0xbed6('0x2d')]);_0x506cd1[_0xbed6('0x2e')]=_[_0xbed6('0x2f')](_0x46a0a6[_0xbed6('0x2c')],qs['fields'](_0x607b56['query'][_0xbed6('0x30')]));_0x506cd1[_0xbed6('0x2e')]=_0x506cd1[_0xbed6('0x2e')][_0xbed6('0x31')]?_0x506cd1['attributes']:_0x46a0a6[_0xbed6('0x2c')];_0x506cd1[_0xbed6('0x34')]=qs['sort'](_0x607b56['query']['sort']);_0x506cd1[_0xbed6('0x36')]=qs[_0xbed6('0x37')](_[_0xbed6('0x4a')](_0x607b56[_0xbed6('0x2d')],_0x46a0a6['filters']));if(_0x607b56[_0xbed6('0x2d')][_0xbed6('0x38')]){_0x506cd1['where']=_[_0xbed6('0x39')](_0x506cd1[_0xbed6('0x36')],{'$or':_['map'](_0x506cd1['attributes'],function(_0x2f0faf){var _0x36e6a3={};_0x36e6a3[_0x2f0faf]={'$like':'%'+_0x607b56[_0xbed6('0x2d')][_0xbed6('0x38')]+'%'};return _0x36e6a3;})});}_0x506cd1=_[_0xbed6('0x39')]({},_0x506cd1,_0x607b56[_0xbed6('0x42')]);return _0x24393b[_0xbed6('0x47')](_0x506cd1);}})['then'](function(_0x1361f0){if(_0x1361f0){_0x58d557=_0x1361f0[_0xbed6('0x31')];if(!_0x607b56[_0xbed6('0x2d')][_0xbed6('0x32')](_0xbed6('0x33'))){_0x506cd1['limit']=qs[_0xbed6('0x1a')](_0x607b56[_0xbed6('0x2d')]['limit']);_0x506cd1[_0xbed6('0x19')]=qs[_0xbed6('0x19')](_0x607b56[_0xbed6('0x2d')][_0xbed6('0x19')]);}return _0x24393b['getFields'](_0x506cd1);}})[_0xbed6('0x20')](function(_0x5ee376){if(_0x5ee376){return _0x5ee376?{'count':_0x58d557,'rows':_0x5ee376}:null;}})[_0xbed6('0x20')](respondWithResult(_0x399c44,null))[_0xbed6('0x46')](handleError(_0x399c44,null));};exports['getSubjects']=function(_0x4882ab,_0x23681e,_0x4750f7){var _0x5c3fca={};var _0x44abf9={};var _0x4e10db;var _0x22c05e;return db[_0xbed6('0x27')][_0xbed6('0x48')]({'where':{'id':_0x4882ab['params']['id']}})[_0xbed6('0x20')](handleEntityNotFound(_0x23681e,null))['then'](function(_0x1c3d5c){if(_0x1c3d5c){_0x4e10db=_0x1c3d5c;_0x44abf9[_0xbed6('0x2c')]=_[_0xbed6('0x41')](db[_0xbed6('0x49')]['rawAttributes']);_0x44abf9[_0xbed6('0x2d')]=_[_0xbed6('0x41')](_0x4882ab[_0xbed6('0x2d')]);_0x44abf9['filters']=_[_0xbed6('0x2f')](_0x44abf9[_0xbed6('0x2c')],_0x44abf9[_0xbed6('0x2d')]);_0x5c3fca[_0xbed6('0x2e')]=_[_0xbed6('0x2f')](_0x44abf9[_0xbed6('0x2c')],qs[_0xbed6('0x30')](_0x4882ab[_0xbed6('0x2d')][_0xbed6('0x30')]));_0x5c3fca['attributes']=_0x5c3fca[_0xbed6('0x2e')][_0xbed6('0x31')]?_0x5c3fca[_0xbed6('0x2e')]:_0x44abf9[_0xbed6('0x2c')];_0x5c3fca['order']=qs[_0xbed6('0x35')](_0x4882ab[_0xbed6('0x2d')][_0xbed6('0x35')]);_0x5c3fca[_0xbed6('0x36')]=qs[_0xbed6('0x37')](_['pick'](_0x4882ab[_0xbed6('0x2d')],_0x44abf9[_0xbed6('0x37')]));if(_0x4882ab[_0xbed6('0x2d')][_0xbed6('0x38')]){_0x5c3fca['where']=_[_0xbed6('0x39')](_0x5c3fca[_0xbed6('0x36')],{'$or':_[_0xbed6('0x3a')](_0x5c3fca['attributes'],function(_0x3383eb){var _0x208cba={};_0x208cba[_0x3383eb]={'$like':'%'+_0x4882ab['query'][_0xbed6('0x38')]+'%'};return _0x208cba;})});}_0x5c3fca=_['merge']({},_0x5c3fca,_0x4882ab[_0xbed6('0x42')]);return _0x4e10db['getSubjects'](_0x5c3fca);}})[_0xbed6('0x20')](function(_0x245b2d){if(_0x245b2d){_0x22c05e=_0x245b2d[_0xbed6('0x31')];if(!_0x4882ab[_0xbed6('0x2d')][_0xbed6('0x32')](_0xbed6('0x33'))){_0x5c3fca['limit']=qs[_0xbed6('0x1a')](_0x4882ab[_0xbed6('0x2d')][_0xbed6('0x1a')]);_0x5c3fca[_0xbed6('0x19')]=qs[_0xbed6('0x19')](_0x4882ab[_0xbed6('0x2d')]['offset']);}return _0x4e10db[_0xbed6('0x4b')](_0x5c3fca);}})[_0xbed6('0x20')](function(_0x4392f6){if(_0x4392f6){return _0x4392f6?{'count':_0x22c05e,'rows':_0x4392f6}:null;}})[_0xbed6('0x20')](respondWithResult(_0x23681e,null))[_0xbed6('0x46')](handleError(_0x23681e,null));};exports[_0xbed6('0x4c')]=function(_0x547286,_0x76a2c8,_0x186951){var _0x54af23={};var _0x537d26={};var _0x2a5c4b;var _0x570b0a;return db['FreshdeskConfiguration'][_0xbed6('0x48')]({'where':{'id':_0x547286[_0xbed6('0x40')]['id']}})[_0xbed6('0x20')](handleEntityNotFound(_0x76a2c8,null))['then'](function(_0x5cb960){if(_0x5cb960){_0x2a5c4b=_0x5cb960;_0x537d26[_0xbed6('0x2c')]=_[_0xbed6('0x41')](db[_0xbed6('0x49')]['rawAttributes']);_0x537d26[_0xbed6('0x2d')]=_[_0xbed6('0x41')](_0x547286[_0xbed6('0x2d')]);_0x537d26[_0xbed6('0x37')]=_[_0xbed6('0x2f')](_0x537d26[_0xbed6('0x2c')],_0x537d26[_0xbed6('0x2d')]);_0x54af23[_0xbed6('0x2e')]=_[_0xbed6('0x2f')](_0x537d26[_0xbed6('0x2c')],qs[_0xbed6('0x30')](_0x547286[_0xbed6('0x2d')][_0xbed6('0x30')]));_0x54af23[_0xbed6('0x2e')]=_0x54af23[_0xbed6('0x2e')]['length']?_0x54af23[_0xbed6('0x2e')]:_0x537d26[_0xbed6('0x2c')];_0x54af23[_0xbed6('0x34')]=qs[_0xbed6('0x35')](_0x547286[_0xbed6('0x2d')][_0xbed6('0x35')]);_0x54af23[_0xbed6('0x36')]=qs[_0xbed6('0x37')](_[_0xbed6('0x4a')](_0x547286[_0xbed6('0x2d')],_0x537d26[_0xbed6('0x37')]));if(_0x547286[_0xbed6('0x2d')]['filter']){_0x54af23[_0xbed6('0x36')]=_[_0xbed6('0x39')](_0x54af23[_0xbed6('0x36')],{'$or':_[_0xbed6('0x3a')](_0x54af23[_0xbed6('0x2e')],function(_0x2f83c1){var _0x27d5fd={};_0x27d5fd[_0x2f83c1]={'$like':'%'+_0x547286['query'][_0xbed6('0x38')]+'%'};return _0x27d5fd;})});}_0x54af23=_[_0xbed6('0x39')]({},_0x54af23,_0x547286[_0xbed6('0x42')]);return _0x2a5c4b[_0xbed6('0x4c')](_0x54af23);}})[_0xbed6('0x20')](function(_0x34f84b){if(_0x34f84b){_0x570b0a=_0x34f84b[_0xbed6('0x31')];if(!_0x547286[_0xbed6('0x2d')][_0xbed6('0x32')]('nolimit')){_0x54af23[_0xbed6('0x1a')]=qs[_0xbed6('0x1a')](_0x547286[_0xbed6('0x2d')][_0xbed6('0x1a')]);_0x54af23[_0xbed6('0x19')]=qs[_0xbed6('0x19')](_0x547286[_0xbed6('0x2d')][_0xbed6('0x19')]);}return _0x2a5c4b['getDescriptions'](_0x54af23);}})[_0xbed6('0x20')](function(_0x3176ad){if(_0x3176ad){return _0x3176ad?{'count':_0x570b0a,'rows':_0x3176ad}:null;}})[_0xbed6('0x20')](respondWithResult(_0x76a2c8,null))[_0xbed6('0x46')](handleError(_0x76a2c8,null));};exports['getTags']=function(_0x85a92a,_0x38ab7b,_0x1efef7){var _0x5f2e56={};var _0x52b466={};var _0x7d0f3c;var _0x369274;return db[_0xbed6('0x27')]['findOne']({'where':{'id':_0x85a92a['params']['id']}})[_0xbed6('0x20')](handleEntityNotFound(_0x38ab7b,null))[_0xbed6('0x20')](function(_0x247974){if(_0x247974){_0x7d0f3c=_0x247974;_0x52b466[_0xbed6('0x2c')]=_[_0xbed6('0x41')](db[_0xbed6('0x4d')][_0xbed6('0x28')]);_0x52b466[_0xbed6('0x2d')]=_[_0xbed6('0x41')](_0x85a92a['query']);_0x52b466[_0xbed6('0x37')]=_['intersection'](_0x52b466['model'],_0x52b466[_0xbed6('0x2d')]);_0x5f2e56[_0xbed6('0x2e')]=_[_0xbed6('0x2f')](_0x52b466[_0xbed6('0x2c')],qs[_0xbed6('0x30')](_0x85a92a['query'][_0xbed6('0x30')]));_0x5f2e56[_0xbed6('0x2e')]=_0x5f2e56[_0xbed6('0x2e')][_0xbed6('0x31')]?_0x5f2e56[_0xbed6('0x2e')]:_0x52b466[_0xbed6('0x2c')];_0x5f2e56[_0xbed6('0x34')]=qs[_0xbed6('0x35')](_0x85a92a[_0xbed6('0x2d')][_0xbed6('0x35')]);_0x5f2e56[_0xbed6('0x36')]=qs[_0xbed6('0x37')](_[_0xbed6('0x4a')](_0x85a92a[_0xbed6('0x2d')],_0x52b466[_0xbed6('0x37')]));if(_0x85a92a[_0xbed6('0x2d')][_0xbed6('0x38')]){_0x5f2e56[_0xbed6('0x36')]=_[_0xbed6('0x39')](_0x5f2e56[_0xbed6('0x36')],{'$or':_[_0xbed6('0x3a')](_0x5f2e56[_0xbed6('0x2e')],function(_0x2b64b2){var _0x398035={};_0x398035[_0x2b64b2]={'$like':'%'+_0x85a92a['query'][_0xbed6('0x38')]+'%'};return _0x398035;})});}_0x5f2e56=_[_0xbed6('0x39')]({},_0x5f2e56,_0x85a92a['options']);return _0x7d0f3c[_0xbed6('0x4e')](_0x5f2e56);}})['then'](function(_0x4ea346){if(_0x4ea346){_0x369274=_0x4ea346[_0xbed6('0x31')];if(!_0x85a92a[_0xbed6('0x2d')][_0xbed6('0x32')]('nolimit')){_0x5f2e56[_0xbed6('0x1a')]=qs['limit'](_0x85a92a['query'][_0xbed6('0x1a')]);_0x5f2e56[_0xbed6('0x19')]=qs[_0xbed6('0x19')](_0x85a92a[_0xbed6('0x2d')][_0xbed6('0x19')]);}return _0x7d0f3c['getTags'](_0x5f2e56);}})[_0xbed6('0x20')](function(_0x30ec65){if(_0x30ec65){return _0x30ec65?{'count':_0x369274,'rows':_0x30ec65}:null;}})[_0xbed6('0x20')](respondWithResult(_0x38ab7b,null))[_0xbed6('0x46')](handleError(_0x38ab7b,null));};exports[_0xbed6('0x4f')]=function(_0x259e1c,_0x54c71d,_0x45db9f){if(_0x259e1c[_0xbed6('0x45')]['id']){delete _0x259e1c[_0xbed6('0x45')]['id'];}return db[_0xbed6('0x27')][_0xbed6('0x48')]({'where':{'id':_0x259e1c[_0xbed6('0x40')]['id']}})['then'](handleEntityNotFound(_0x54c71d,null))['then'](function(_0x35d473){if(_0x35d473){return _0x35d473[_0xbed6('0x4f')](_0x259e1c[_0xbed6('0x45')][_0xbed6('0x50')]||[]);}return null;})[_0xbed6('0x20')](respondWithResult(_0x54c71d,null))[_0xbed6('0x46')](handleError(_0x54c71d,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 7eec989..6005527 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 _0x3025=['lodash','util','moment','path','../../config/environment','FreshdeskConfiguration'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3025,0x156));var _0x5302=function(_0x239cfb,_0x2539d9){_0x239cfb=_0x239cfb-0x0;var _0x35eab8=_0x3025[_0x239cfb];return _0x35eab8;};'use strict';var _=require(_0x5302('0x0'));var util=require(_0x5302('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5302('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5302('0x3'));var rimraf=require('rimraf');var config=require(_0x5302('0x4'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x4236ef,_0x17f39a){return _0x4236ef['define'](_0x5302('0x5'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3289=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration'];(function(_0x56a7bc,_0x41d6f6){var _0x4f5883=function(_0x23e4a4){while(--_0x23e4a4){_0x56a7bc['push'](_0x56a7bc['shift']());}};_0x4f5883(++_0x41d6f6);}(_0x3289,0x1e4));var _0x9328=function(_0x59bd08,_0x518f54){_0x59bd08=_0x59bd08-0x0;var _0xe594f7=_0x3289[_0x59bd08];return _0xe594f7;};'use strict';var _=require(_0x9328('0x0'));var util=require(_0x9328('0x1'));var logger=require(_0x9328('0x2'))(_0x9328('0x3'));var moment=require(_0x9328('0x4'));var BPromise=require(_0x9328('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9328('0x6'));var rimraf=require('rimraf');var config=require(_0x9328('0x7'));var attributes=require(_0x9328('0x8'));module['exports']=function(_0x2cfb40,_0x7cc7b5){return _0x2cfb40[_0x9328('0x9')](_0x9328('0xa'),attributes,{'tableName':'int_freshdesk_configurations','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 b7f43cd..f786096 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 _0x4ce1=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x2d5023,_0x23178e){var _0x459de3=function(_0x97d826){while(--_0x97d826){_0x2d5023['push'](_0x2d5023['shift']());}};_0x459de3(++_0x23178e);}(_0x4ce1,0x9b));var _0x14ce=function(_0x2886a4,_0x36e326){_0x2886a4=_0x2886a4-0x0;var _0x12c717=_0x4ce1[_0x2886a4];return _0x12c717;};'use strict';var _=require('lodash');var util=require(_0x14ce('0x0'));var moment=require(_0x14ce('0x1'));var BPromise=require('bluebird');var rs=require(_0x14ce('0x2'));var fs=require('fs');var Redis=require(_0x14ce('0x3'));var db=require(_0x14ce('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x14ce('0x5'))(_0x14ce('0x6'));var config=require(_0x14ce('0x7'));var jayson=require(_0x14ce('0x8'));var client=jayson[_0x14ce('0x9')][_0x14ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ec4cd,_0x2ef4df,_0x2863b1){return new BPromise(function(_0x2946fb,_0x43edbd){return client[_0x14ce('0xb')](_0x1ec4cd,_0x2863b1)[_0x14ce('0xc')](function(_0x1405cf){logger[_0x14ce('0xd')](_0x14ce('0xe'),_0x2ef4df,'request\x20sent');logger[_0x14ce('0xf')](_0x14ce('0x10'),_0x2ef4df,'request\x20sent',JSON['stringify'](_0x1405cf));if(_0x1405cf[_0x14ce('0x11')]){if(_0x1405cf[_0x14ce('0x11')][_0x14ce('0x12')]===0x1f4){logger['error'](_0x14ce('0xe'),_0x2ef4df,_0x1405cf['error'][_0x14ce('0x13')]);return _0x43edbd(_0x1405cf[_0x14ce('0x11')][_0x14ce('0x13')]);}logger[_0x14ce('0x11')](_0x14ce('0xe'),_0x2ef4df,_0x1405cf[_0x14ce('0x11')]['message']);return _0x2946fb(_0x1405cf[_0x14ce('0x11')][_0x14ce('0x13')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x2ef4df,_0x14ce('0x14'));_0x2946fb(_0x1405cf[_0x14ce('0x15')][_0x14ce('0x13')]);}})[_0x14ce('0x16')](function(_0xb970d7){logger[_0x14ce('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2ef4df,_0xb970d7);_0x43edbd(_0xb970d7);});});} \ No newline at end of file +var _0xbd5e=['message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x557aec,_0x3da85d){var _0x4a8da8=function(_0x1b44b1){while(--_0x1b44b1){_0x557aec['push'](_0x557aec['shift']());}};_0x4a8da8(++_0x3da85d);}(_0xbd5e,0xf3));var _0xebd5=function(_0x47c921,_0x86203c){_0x47c921=_0x47c921-0x0;var _0x2bfa02=_0xbd5e[_0x47c921];return _0x2bfa02;};'use strict';var _=require(_0xebd5('0x0'));var util=require('util');var moment=require(_0xebd5('0x1'));var BPromise=require(_0xebd5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xebd5('0x3'));var db=require(_0xebd5('0x4'))['db'];var utils=require(_0xebd5('0x5'));var logger=require(_0xebd5('0x6'))('rpc');var config=require(_0xebd5('0x7'));var jayson=require(_0xebd5('0x8'));var client=jayson[_0xebd5('0x9')][_0xebd5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46287f,_0x3ccf74,_0x83eaa8){return new BPromise(function(_0x2bdd25,_0x34535e){return client[_0xebd5('0xb')](_0x46287f,_0x83eaa8)[_0xebd5('0xc')](function(_0x245186){logger[_0xebd5('0xd')](_0xebd5('0xe'),_0x3ccf74,'request\x20sent');logger[_0xebd5('0xf')](_0xebd5('0x10'),_0x3ccf74,_0xebd5('0x11'),JSON[_0xebd5('0x12')](_0x245186));if(_0x245186[_0xebd5('0x13')]){if(_0x245186[_0xebd5('0x13')][_0xebd5('0x14')]===0x1f4){logger[_0xebd5('0x13')](_0xebd5('0xe'),_0x3ccf74,_0x245186[_0xebd5('0x13')][_0xebd5('0x15')]);return _0x34535e(_0x245186[_0xebd5('0x13')][_0xebd5('0x15')]);}logger['error'](_0xebd5('0xe'),_0x3ccf74,_0x245186[_0xebd5('0x13')][_0xebd5('0x15')]);return _0x2bdd25(_0x245186[_0xebd5('0x13')][_0xebd5('0x15')]);}else{logger['info'](_0xebd5('0xe'),_0x3ccf74,_0xebd5('0x11'));_0x2bdd25(_0x245186[_0xebd5('0x16')][_0xebd5('0x15')]);}})[_0xebd5('0x17')](function(_0x55e01f){logger[_0xebd5('0x13')](_0xebd5('0xe'),_0x3ccf74,_0x55e01f);_0x34535e(_0x55e01f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index c0e7d0d..f9eb519 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 _0x6b66=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','index','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x4b5fe3,_0x2ec7f6){var _0x9d9aa5=function(_0x434e5d){while(--_0x434e5d){_0x4b5fe3['push'](_0x4b5fe3['shift']());}};_0x9d9aa5(++_0x2ec7f6);}(_0x6b66,0xc3));var _0x66b6=function(_0x57962a,_0x51bab7){_0x57962a=_0x57962a-0x0;var _0x3d2141=_0x6b66[_0x57962a];return _0x3d2141;};'use strict';var multer=require('multer');var util=require(_0x66b6('0x0'));var path=require(_0x66b6('0x1'));var timeout=require(_0x66b6('0x2'));var express=require('express');var router=express[_0x66b6('0x3')]();var fs_extra=require(_0x66b6('0x4'));var auth=require(_0x66b6('0x5'));var interaction=require(_0x66b6('0x6'));var config=require('../../config/environment');var controller=require(_0x66b6('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x66b6('0x8')]);router['get'](_0x66b6('0x9'),auth[_0x66b6('0xa')](),controller['show']);router[_0x66b6('0xb')]('/',auth['isAuthenticated'](),controller[_0x66b6('0xc')]);router[_0x66b6('0xd')](_0x66b6('0x9'),auth['isAuthenticated'](),controller[_0x66b6('0xe')]);router[_0x66b6('0xf')]('/:id',auth[_0x66b6('0xa')](),controller[_0x66b6('0x10')]);module[_0x66b6('0x11')]=router; \ No newline at end of file +var _0xd602=['/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','get','show','post','create'];(function(_0x4c1714,_0x4754b2){var _0x285e11=function(_0x4edafa){while(--_0x4edafa){_0x4c1714['push'](_0x4c1714['shift']());}};_0x285e11(++_0x4754b2);}(_0xd602,0xf3));var _0x2d60=function(_0x5d592c,_0x393f2e){_0x5d592c=_0x5d592c-0x0;var _0x3e93a9=_0xd602[_0x5d592c];return _0x3e93a9;};'use strict';var multer=require(_0x2d60('0x0'));var util=require(_0x2d60('0x1'));var path=require(_0x2d60('0x2'));var timeout=require(_0x2d60('0x3'));var express=require(_0x2d60('0x4'));var router=express[_0x2d60('0x5')]();var fs_extra=require(_0x2d60('0x6'));var auth=require(_0x2d60('0x7'));var interaction=require(_0x2d60('0x8'));var config=require(_0x2d60('0x9'));var controller=require(_0x2d60('0xa'));router['get']('/',auth[_0x2d60('0xb')](),controller[_0x2d60('0xc')]);router[_0x2d60('0xd')]('/:id',auth[_0x2d60('0xb')](),controller[_0x2d60('0xe')]);router[_0x2d60('0xf')]('/',auth[_0x2d60('0xb')](),controller[_0x2d60('0x10')]);router['put'](_0x2d60('0x11'),auth[_0x2d60('0xb')](),controller['update']);router[_0x2d60('0x12')](_0x2d60('0x11'),auth[_0x2d60('0xb')](),controller[_0x2d60('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index a89b0ce..e6b9651 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 _0xa404=['sequelize','exports','string','customVariable','STRING','ENUM','variable','BOOLEAN'];(function(_0x2a0d54,_0xa5dc5d){var _0x5b6f0b=function(_0x4ab3cb){while(--_0x4ab3cb){_0x2a0d54['push'](_0x2a0d54['shift']());}};_0x5b6f0b(++_0xa5dc5d);}(_0xa404,0x100));var _0x4a40=function(_0x1fba9f,_0x2fe96f){_0x1fba9f=_0x1fba9f-0x0;var _0x34f78e=_0xa404[_0x1fba9f];return _0x34f78e;};'use strict';var Sequelize=require(_0x4a40('0x0'));module[_0x4a40('0x1')]={'type':{'type':Sequelize['ENUM'](_0x4a40('0x2'),'variable',_0x4a40('0x3'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x4a40('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x4a40('0x5')](_0x4a40('0x2'),_0x4a40('0x6'),_0x4a40('0x3'))},'keyContent':{'type':Sequelize[_0x4a40('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x4a40('0x4')]},'customField':{'type':Sequelize[_0x4a40('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4a40('0x4')]}}; \ No newline at end of file +var _0x1640=['STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable','keyValue'];(function(_0x4d8491,_0x48281a){var _0xf1ecc4=function(_0x4e905c){while(--_0x4e905c){_0x4d8491['push'](_0x4d8491['shift']());}};_0xf1ecc4(++_0x48281a);}(_0x1640,0x15b));var _0x0164=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x1640[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x0164('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x0164('0x1'),_0x0164('0x2'),_0x0164('0x3'),_0x0164('0x4'),'picklist'),'defaultValue':_0x0164('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0164('0x5')]},'keyType':{'type':Sequelize[_0x0164('0x6')](_0x0164('0x1'),_0x0164('0x2'),_0x0164('0x3'))},'keyContent':{'type':Sequelize[_0x0164('0x5')]},'idField':{'type':Sequelize[_0x0164('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0164('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0164('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 43f9419..51768ce 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 _0xf45e=['Content-Range','json','apply','reject','save','destroy','then','sendStatus','stack','index','map','rawAttributes','type','key','model','name','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','FreshdeskField','includeAll','include','findAll','rows','show','params','keys','length','merge','find','create','body','update','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set'];(function(_0x1f0390,_0xf8b214){var _0x1c43b6=function(_0x36a74f){while(--_0x36a74f){_0x1f0390['push'](_0x1f0390['shift']());}};_0x1c43b6(++_0xf8b214);}(_0xf45e,0x115));var _0xef45=function(_0x36ee51,_0x5cf108){_0x36ee51=_0x36ee51-0x0;var _0x18857b=_0xf45e[_0x36ee51];return _0x18857b;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];function respondWithStatusCode(_0x30babb,_0x433be9){_0x433be9=_0x433be9||0xcc;return function(_0x476739){if(_0x476739){return _0x30babb['sendStatus'](_0x433be9);}return _0x30babb['status'](_0x433be9)[_0xef45('0x1c')]();};}function respondWithResult(_0x47fd96,_0x2ae89a){_0x2ae89a=_0x2ae89a||0xc8;return function(_0xb0fc43){if(_0xb0fc43){return _0x47fd96[_0xef45('0x1d')](_0x2ae89a)['json'](_0xb0fc43);}};}function respondWithFilteredResult(_0x5b3136,_0x29c0c4){return function(_0x5530e6){if(_0x5530e6){var _0x11cd3a=typeof _0x29c0c4[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x29c0c4[_0xef45('0x20')]==='undefined';var _0x560b2f=_0x5530e6[_0xef45('0x21')];var _0x219778=_0x11cd3a?0x0:_0x29c0c4[_0xef45('0x1e')];var _0x258785=_0x11cd3a?_0x5530e6['count']:_0x29c0c4['offset']+_0x29c0c4[_0xef45('0x20')];var _0x20ef26;if(_0x258785>=_0x560b2f){_0x258785=_0x560b2f;_0x20ef26=0xc8;}else{_0x20ef26=0xce;}_0x5b3136[_0xef45('0x1d')](_0x20ef26);return _0x5b3136[_0xef45('0x22')](_0xef45('0x23'),_0x219778+'-'+_0x258785+'/'+_0x560b2f)[_0xef45('0x24')](_0x5530e6);}return null;};}function patchUpdates(_0x375cbd){return function(_0x4a6217){try{jsonpatch[_0xef45('0x25')](_0x4a6217,_0x375cbd,!![]);}catch(_0x3e2a47){return BPromise[_0xef45('0x26')](_0x3e2a47);}return _0x4a6217[_0xef45('0x27')]();};}function saveUpdates(_0x27322f,_0x5205bf){return function(_0x40abc8){if(_0x40abc8){return _0x40abc8['update'](_0x27322f)['then'](function(_0x7707a1){return _0x7707a1;});}return null;};}function removeEntity(_0x2b41d8,_0xbb859b){return function(_0x7817d0){if(_0x7817d0){return _0x7817d0[_0xef45('0x28')]()[_0xef45('0x29')](function(){_0x2b41d8[_0xef45('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x208b35,_0x5f0593){return function(_0x38b470){if(!_0x38b470){_0x208b35[_0xef45('0x2a')](0x194);}return _0x38b470;};}function handleError(_0x578f03,_0x46e423){_0x46e423=_0x46e423||0x1f4;return function(_0x2c356d){logger['error'](_0x2c356d[_0xef45('0x2b')]);if(_0x2c356d['name']){delete _0x2c356d['name'];}_0x578f03['status'](_0x46e423)['send'](_0x2c356d);};}exports[_0xef45('0x2c')]=function(_0x2f72ef,_0x217e8d){var _0x15ad38={},_0x5782d0={},_0x18f304={'count':0x0,'rows':[]};var _0x4f028c=_[_0xef45('0x2d')](db['FreshdeskField'][_0xef45('0x2e')],function(_0x5bfd2d){return{'name':_0x5bfd2d['fieldName'],'type':_0x5bfd2d[_0xef45('0x2f')][_0xef45('0x30')]};});_0x5782d0[_0xef45('0x31')]=_[_0xef45('0x2d')](_0x4f028c,_0xef45('0x32'));_0x5782d0['query']=_['keys'](_0x2f72ef['query']);_0x5782d0[_0xef45('0x33')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],_0x5782d0[_0xef45('0x35')]);_0x15ad38[_0xef45('0x36')]=_[_0xef45('0x34')](_0x5782d0[_0xef45('0x31')],qs['fields'](_0x2f72ef['query'][_0xef45('0x37')]));_0x15ad38['attributes']=_0x15ad38[_0xef45('0x36')]['length']?_0x15ad38[_0xef45('0x36')]:_0x5782d0[_0xef45('0x31')];if(!_0x2f72ef[_0xef45('0x35')][_0xef45('0x38')](_0xef45('0x39'))){_0x15ad38['limit']=qs[_0xef45('0x20')](_0x2f72ef[_0xef45('0x35')][_0xef45('0x20')]);_0x15ad38['offset']=qs['offset'](_0x2f72ef[_0xef45('0x35')][_0xef45('0x1e')]);}_0x15ad38['order']=qs[_0xef45('0x3a')](_0x2f72ef['query']['sort']);_0x15ad38[_0xef45('0x3b')]=qs[_0xef45('0x33')](_[_0xef45('0x3c')](_0x2f72ef['query'],_0x5782d0[_0xef45('0x33')]),_0x4f028c);if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]){_0x15ad38[_0xef45('0x3b')]=_['merge'](_0x15ad38['where'],{'$or':_[_0xef45('0x2d')](_0x4f028c,function(_0x474be1){if(_0x474be1[_0xef45('0x2f')]!==_0xef45('0x3e')){var _0x269a11={};_0x269a11[_0x474be1[_0xef45('0x32')]]={'$like':'%'+_0x2f72ef[_0xef45('0x35')][_0xef45('0x3d')]+'%'};return _0x269a11;}})});}_0x15ad38=_['merge']({},_0x15ad38,_0x2f72ef['options']);var _0x13f8b2={'where':_0x15ad38[_0xef45('0x3b')]};return db[_0xef45('0x3f')][_0xef45('0x21')](_0x13f8b2)[_0xef45('0x29')](function(_0x3bcada){_0x18f304[_0xef45('0x21')]=_0x3bcada;if(_0x2f72ef[_0xef45('0x35')][_0xef45('0x40')]){_0x15ad38[_0xef45('0x41')]=[{'all':!![]}];}return db[_0xef45('0x3f')][_0xef45('0x42')](_0x15ad38);})[_0xef45('0x29')](function(_0xd7d217){_0x18f304[_0xef45('0x43')]=_0xd7d217;return _0x18f304;})[_0xef45('0x29')](respondWithFilteredResult(_0x217e8d,_0x15ad38))['catch'](handleError(_0x217e8d,null));};exports[_0xef45('0x44')]=function(_0x5bdfad,_0x1b9d45){var _0x82c123={'raw':!![],'where':{'id':_0x5bdfad[_0xef45('0x45')]['id']}},_0x54ccb8={};_0x54ccb8['model']=_[_0xef45('0x46')](db['FreshdeskField'][_0xef45('0x2e')]);_0x54ccb8[_0xef45('0x35')]=_[_0xef45('0x46')](_0x5bdfad[_0xef45('0x35')]);_0x54ccb8[_0xef45('0x33')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],_0x54ccb8['query']);_0x82c123[_0xef45('0x36')]=_[_0xef45('0x34')](_0x54ccb8[_0xef45('0x31')],qs[_0xef45('0x37')](_0x5bdfad[_0xef45('0x35')][_0xef45('0x37')]));_0x82c123[_0xef45('0x36')]=_0x82c123[_0xef45('0x36')][_0xef45('0x47')]?_0x82c123[_0xef45('0x36')]:_0x54ccb8[_0xef45('0x31')];if(_0x5bdfad[_0xef45('0x35')][_0xef45('0x40')]){_0x82c123[_0xef45('0x41')]=[{'all':!![]}];}_0x82c123=_[_0xef45('0x48')]({},_0x82c123,_0x5bdfad['options']);return db[_0xef45('0x3f')][_0xef45('0x49')](_0x82c123)[_0xef45('0x29')](handleEntityNotFound(_0x1b9d45,null))['then'](respondWithResult(_0x1b9d45,null))['catch'](handleError(_0x1b9d45,null));};exports['create']=function(_0x29aeab,_0x18143c){return db[_0xef45('0x3f')][_0xef45('0x4a')](_0x29aeab[_0xef45('0x4b')],{})[_0xef45('0x29')](respondWithResult(_0x18143c,0xc9))['catch'](handleError(_0x18143c,null));};exports[_0xef45('0x4c')]=function(_0x463796,_0x2b2419){if(_0x463796['body']['id']){delete _0x463796['body']['id'];}return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x463796['params']['id']}})[_0xef45('0x29')](handleEntityNotFound(_0x2b2419,null))[_0xef45('0x29')](saveUpdates(_0x463796[_0xef45('0x4b')],null))[_0xef45('0x29')](respondWithResult(_0x2b2419,null))[_0xef45('0x4d')](handleError(_0x2b2419,null));};exports[_0xef45('0x28')]=function(_0x23581f,_0xfa5fdd){return db[_0xef45('0x3f')][_0xef45('0x49')]({'where':{'id':_0x23581f[_0xef45('0x45')]['id']}})[_0xef45('0x29')](handleEntityNotFound(_0xfa5fdd,null))[_0xef45('0x29')](removeEntity(_0xfa5fdd,null))[_0xef45('0x4d')](handleError(_0xfa5fdd,null));}; \ No newline at end of file +var _0x4746=['util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','FreshdeskField','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','length','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','findAll','catch','intersection','find','create','body','update','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x4746,0xc6));var _0x6474=function(_0x4b2775,_0x3c8034){_0x4b2775=_0x4b2775-0x0;var _0x39b6cc=_0x4746[_0x4b2775];return _0x39b6cc;};'use strict';var emlformat=require(_0x6474('0x0'));var rimraf=require(_0x6474('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6474('0x2'));var rp=require('request-promise');var moment=require(_0x6474('0x3'));var BPromise=require(_0x6474('0x4'));var Mustache=require(_0x6474('0x5'));var util=require(_0x6474('0x6'));var path=require(_0x6474('0x7'));var sox=require('sox');var csv=require(_0x6474('0x8'));var ejs=require(_0x6474('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6474('0xa'));var squel=require(_0x6474('0xb'));var crypto=require(_0x6474('0xc'));var jsforce=require(_0x6474('0xd'));var deskjs=require(_0x6474('0xe'));var toCsv=require(_0x6474('0x8'));var querystring=require('querystring');var Papa=require(_0x6474('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6474('0x10'));var as=require(_0x6474('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6474('0x12'))('api');var utils=require(_0x6474('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x6474('0x14'));var db=require(_0x6474('0x15'))['db'];function respondWithStatusCode(_0x5509d2,_0x4936c2){_0x4936c2=_0x4936c2||0xcc;return function(_0x5cf0de){if(_0x5cf0de){return _0x5509d2[_0x6474('0x16')](_0x4936c2);}return _0x5509d2[_0x6474('0x17')](_0x4936c2)[_0x6474('0x18')]();};}function respondWithResult(_0xad1ebe,_0x113aba){_0x113aba=_0x113aba||0xc8;return function(_0x37fe08){if(_0x37fe08){return _0xad1ebe[_0x6474('0x17')](_0x113aba)[_0x6474('0x19')](_0x37fe08);}};}function respondWithFilteredResult(_0x29b935,_0x5cf8fa){return function(_0x5ee279){if(_0x5ee279){var _0x583afa=typeof _0x5cf8fa[_0x6474('0x1a')]===_0x6474('0x1b')&&typeof _0x5cf8fa[_0x6474('0x1c')]===_0x6474('0x1b');var _0x195465=_0x5ee279['count'];var _0x1505fc=_0x583afa?0x0:_0x5cf8fa[_0x6474('0x1a')];var _0xb6ecb6=_0x583afa?_0x5ee279[_0x6474('0x1d')]:_0x5cf8fa[_0x6474('0x1a')]+_0x5cf8fa[_0x6474('0x1c')];var _0x2e33f0;if(_0xb6ecb6>=_0x195465){_0xb6ecb6=_0x195465;_0x2e33f0=0xc8;}else{_0x2e33f0=0xce;}_0x29b935[_0x6474('0x17')](_0x2e33f0);return _0x29b935['set'](_0x6474('0x1e'),_0x1505fc+'-'+_0xb6ecb6+'/'+_0x195465)['json'](_0x5ee279);}return null;};}function patchUpdates(_0xd23b18){return function(_0x1df53c){try{jsonpatch[_0x6474('0x1f')](_0x1df53c,_0xd23b18,!![]);}catch(_0x185760){return BPromise[_0x6474('0x20')](_0x185760);}return _0x1df53c[_0x6474('0x21')]();};}function saveUpdates(_0x382ebf,_0x5d0e5c){return function(_0xf3cd65){if(_0xf3cd65){return _0xf3cd65['update'](_0x382ebf)[_0x6474('0x22')](function(_0x4dc277){return _0x4dc277;});}return null;};}function removeEntity(_0x4ba645,_0x58e024){return function(_0xb67896){if(_0xb67896){return _0xb67896[_0x6474('0x23')]()[_0x6474('0x22')](function(){_0x4ba645[_0x6474('0x17')](0xcc)[_0x6474('0x18')]();});}};}function handleEntityNotFound(_0x4a9cb6,_0x7020fb){return function(_0x388d2d){if(!_0x388d2d){_0x4a9cb6[_0x6474('0x16')](0x194);}return _0x388d2d;};}function handleError(_0x698040,_0x559b33){_0x559b33=_0x559b33||0x1f4;return function(_0x587b7a){logger[_0x6474('0x24')](_0x587b7a[_0x6474('0x25')]);if(_0x587b7a[_0x6474('0x26')]){delete _0x587b7a[_0x6474('0x26')];}_0x698040['status'](_0x559b33)['send'](_0x587b7a);};}exports['index']=function(_0x4b81f3,_0x3333a8){var _0x28d445={},_0x1751bc={},_0x2387e9={'count':0x0,'rows':[]};var _0x52e64b=_[_0x6474('0x27')](db[_0x6474('0x28')][_0x6474('0x29')],function(_0x2e01fa){return{'name':_0x2e01fa[_0x6474('0x2a')],'type':_0x2e01fa[_0x6474('0x2b')][_0x6474('0x2c')]};});_0x1751bc['model']=_[_0x6474('0x27')](_0x52e64b,_0x6474('0x26'));_0x1751bc[_0x6474('0x2d')]=_[_0x6474('0x2e')](_0x4b81f3['query']);_0x1751bc['filters']=_['intersection'](_0x1751bc[_0x6474('0x2f')],_0x1751bc[_0x6474('0x2d')]);_0x28d445[_0x6474('0x30')]=_['intersection'](_0x1751bc[_0x6474('0x2f')],qs[_0x6474('0x31')](_0x4b81f3[_0x6474('0x2d')]['fields']));_0x28d445[_0x6474('0x30')]=_0x28d445[_0x6474('0x30')][_0x6474('0x32')]?_0x28d445['attributes']:_0x1751bc[_0x6474('0x2f')];if(!_0x4b81f3[_0x6474('0x2d')]['hasOwnProperty'](_0x6474('0x33'))){_0x28d445[_0x6474('0x1c')]=qs[_0x6474('0x1c')](_0x4b81f3[_0x6474('0x2d')][_0x6474('0x1c')]);_0x28d445['offset']=qs[_0x6474('0x1a')](_0x4b81f3[_0x6474('0x2d')]['offset']);}_0x28d445['order']=qs[_0x6474('0x34')](_0x4b81f3['query'][_0x6474('0x34')]);_0x28d445[_0x6474('0x35')]=qs[_0x6474('0x36')](_[_0x6474('0x37')](_0x4b81f3[_0x6474('0x2d')],_0x1751bc['filters']),_0x52e64b);if(_0x4b81f3['query'][_0x6474('0x38')]){_0x28d445[_0x6474('0x35')]=_[_0x6474('0x39')](_0x28d445['where'],{'$or':_[_0x6474('0x27')](_0x52e64b,function(_0x4d9ad7){if(_0x4d9ad7[_0x6474('0x2b')]!=='VIRTUAL'){var _0x4c486d={};_0x4c486d[_0x4d9ad7['name']]={'$like':'%'+_0x4b81f3[_0x6474('0x2d')][_0x6474('0x38')]+'%'};return _0x4c486d;}})});}_0x28d445=_[_0x6474('0x39')]({},_0x28d445,_0x4b81f3[_0x6474('0x3a')]);var _0x455069={'where':_0x28d445[_0x6474('0x35')]};return db['FreshdeskField'][_0x6474('0x1d')](_0x455069)[_0x6474('0x22')](function(_0x4c9487){_0x2387e9[_0x6474('0x1d')]=_0x4c9487;if(_0x4b81f3[_0x6474('0x2d')][_0x6474('0x3b')]){_0x28d445['include']=[{'all':!![]}];}return db[_0x6474('0x28')][_0x6474('0x3c')](_0x28d445);})[_0x6474('0x22')](function(_0x47fa33){_0x2387e9['rows']=_0x47fa33;return _0x2387e9;})[_0x6474('0x22')](respondWithFilteredResult(_0x3333a8,_0x28d445))[_0x6474('0x3d')](handleError(_0x3333a8,null));};exports['show']=function(_0x22835c,_0x44ed73){var _0x9bdba5={'raw':!![],'where':{'id':_0x22835c['params']['id']}},_0x1a4bde={};_0x1a4bde['model']=_[_0x6474('0x2e')](db['FreshdeskField'][_0x6474('0x29')]);_0x1a4bde[_0x6474('0x2d')]=_[_0x6474('0x2e')](_0x22835c['query']);_0x1a4bde[_0x6474('0x36')]=_[_0x6474('0x3e')](_0x1a4bde['model'],_0x1a4bde[_0x6474('0x2d')]);_0x9bdba5[_0x6474('0x30')]=_[_0x6474('0x3e')](_0x1a4bde[_0x6474('0x2f')],qs[_0x6474('0x31')](_0x22835c[_0x6474('0x2d')][_0x6474('0x31')]));_0x9bdba5['attributes']=_0x9bdba5[_0x6474('0x30')][_0x6474('0x32')]?_0x9bdba5['attributes']:_0x1a4bde[_0x6474('0x2f')];if(_0x22835c[_0x6474('0x2d')]['includeAll']){_0x9bdba5['include']=[{'all':!![]}];}_0x9bdba5=_['merge']({},_0x9bdba5,_0x22835c['options']);return db[_0x6474('0x28')][_0x6474('0x3f')](_0x9bdba5)[_0x6474('0x22')](handleEntityNotFound(_0x44ed73,null))[_0x6474('0x22')](respondWithResult(_0x44ed73,null))['catch'](handleError(_0x44ed73,null));};exports[_0x6474('0x40')]=function(_0x2d8504,_0x1c411e){return db[_0x6474('0x28')][_0x6474('0x40')](_0x2d8504[_0x6474('0x41')],{})['then'](respondWithResult(_0x1c411e,0xc9))[_0x6474('0x3d')](handleError(_0x1c411e,null));};exports[_0x6474('0x42')]=function(_0x394ff9,_0x495666){if(_0x394ff9[_0x6474('0x41')]['id']){delete _0x394ff9[_0x6474('0x41')]['id'];}return db['FreshdeskField'][_0x6474('0x3f')]({'where':{'id':_0x394ff9[_0x6474('0x43')]['id']}})[_0x6474('0x22')](handleEntityNotFound(_0x495666,null))[_0x6474('0x22')](saveUpdates(_0x394ff9[_0x6474('0x41')],null))[_0x6474('0x22')](respondWithResult(_0x495666,null))[_0x6474('0x3d')](handleError(_0x495666,null));};exports['destroy']=function(_0x27ebf9,_0x3697a0){return db[_0x6474('0x28')]['find']({'where':{'id':_0x27ebf9[_0x6474('0x43')]['id']}})[_0x6474('0x22')](handleEntityNotFound(_0x3697a0,null))[_0x6474('0x22')](removeEntity(_0x3697a0,null))['catch'](handleError(_0x3697a0,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 9de716d..01c26f9 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 _0x24f5=['define','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports'];(function(_0x353890,_0x11c483){var _0x33eff3=function(_0x5273fa){while(--_0x5273fa){_0x353890['push'](_0x353890['shift']());}};_0x33eff3(++_0x11c483);}(_0x24f5,0x1ee));var _0x524f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x24f5[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x524f('0x0'));var util=require(_0x524f('0x1'));var logger=require(_0x524f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x524f('0x3'));var rp=require(_0x524f('0x4'));var fs=require('fs');var path=require(_0x524f('0x5'));var rimraf=require(_0x524f('0x6'));var config=require(_0x524f('0x7'));var attributes=require(_0x524f('0x8'));module[_0x524f('0x9')]=function(_0x4fc743,_0x3b7ff4){return _0x4fc743[_0x524f('0xa')]('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x524f('0xb'),'fields':[_0x524f('0xc'),_0x524f('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f47=['./intFreshdeskField.attributes','exports','define','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x312947,_0x3eb15c){var _0x2ca0d0=function(_0x1bc9fa){while(--_0x1bc9fa){_0x312947['push'](_0x312947['shift']());}};_0x2ca0d0(++_0x3eb15c);}(_0x9f47,0x1e9));var _0x79f4=function(_0x535c47,_0x11c292){_0x535c47=_0x535c47-0x0;var _0x54fdd6=_0x9f47[_0x535c47];return _0x54fdd6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x79f4('0x0'))(_0x79f4('0x1'));var moment=require(_0x79f4('0x2'));var BPromise=require(_0x79f4('0x3'));var rp=require(_0x79f4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x79f4('0x5'));var attributes=require(_0x79f4('0x6'));module[_0x79f4('0x7')]=function(_0x554b21,_0x36db52){return _0x554b21[_0x79f4('0x8')]('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x79f4('0x9'),_0x79f4('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index d77b176..a5b130b 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 _0x63fe=['info','result','catch','lodash','util','bluebird','ioredis','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x1720d6,_0x3e2308){var _0x48b5b7=function(_0x3e0a6a){while(--_0x3e0a6a){_0x1720d6['push'](_0x1720d6['shift']());}};_0x48b5b7(++_0x3e2308);}(_0x63fe,0xe7));var _0xe63f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x63fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe63f('0x0'));var util=require(_0xe63f('0x1'));var moment=require('moment');var BPromise=require(_0xe63f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe63f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe63f('0x4'));var jayson=require(_0xe63f('0x5'));var client=jayson[_0xe63f('0x6')][_0xe63f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x53a14b,_0x16e69e,_0x297de0){return new BPromise(function(_0x278602,_0x3d2c03){return client[_0xe63f('0x8')](_0x53a14b,_0x297de0)[_0xe63f('0x9')](function(_0x27d42d){logger['info'](_0xe63f('0xa'),_0x16e69e,_0xe63f('0xb'));logger[_0xe63f('0xc')](_0xe63f('0xd'),_0x16e69e,_0xe63f('0xb'),JSON['stringify'](_0x27d42d));if(_0x27d42d[_0xe63f('0xe')]){if(_0x27d42d['error']['code']===0x1f4){logger[_0xe63f('0xe')](_0xe63f('0xa'),_0x16e69e,_0x27d42d[_0xe63f('0xe')][_0xe63f('0xf')]);return _0x3d2c03(_0x27d42d['error'][_0xe63f('0xf')]);}logger[_0xe63f('0xe')](_0xe63f('0xa'),_0x16e69e,_0x27d42d['error']['message']);return _0x278602(_0x27d42d[_0xe63f('0xe')][_0xe63f('0xf')]);}else{logger[_0xe63f('0x10')](_0xe63f('0xa'),_0x16e69e,_0xe63f('0xb'));_0x278602(_0x27d42d[_0xe63f('0x11')]['message']);}})[_0xe63f('0x12')](function(_0x43addf){logger[_0xe63f('0xe')](_0xe63f('0xa'),_0x16e69e,_0x43addf);_0x3d2c03(_0x43addf);});});} \ No newline at end of file +var _0x9145=['error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x381379,_0x3f3b86){var _0x3e1063=function(_0x4c282d){while(--_0x4c282d){_0x381379['push'](_0x381379['shift']());}};_0x3e1063(++_0x3f3b86);}(_0x9145,0x16c));var _0x5914=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9145[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x5914('0x0'));var util=require('util');var moment=require(_0x5914('0x1'));var BPromise=require(_0x5914('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5914('0x3'));var db=require(_0x5914('0x4'))['db'];var utils=require(_0x5914('0x5'));var logger=require('../../config/logger')(_0x5914('0x6'));var config=require(_0x5914('0x7'));var jayson=require(_0x5914('0x8'));var client=jayson['client'][_0x5914('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b7504,_0x1890d2,_0x3d15b9){return new BPromise(function(_0x531c78,_0x418578){return client['request'](_0x3b7504,_0x3d15b9)[_0x5914('0xa')](function(_0x44e6c0){logger[_0x5914('0xb')](_0x5914('0xc'),_0x1890d2,_0x5914('0xd'));logger['debug'](_0x5914('0xe'),_0x1890d2,_0x5914('0xd'),JSON[_0x5914('0xf')](_0x44e6c0));if(_0x44e6c0['error']){if(_0x44e6c0[_0x5914('0x10')]['code']===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x1890d2,_0x44e6c0[_0x5914('0x10')][_0x5914('0x11')]);return _0x418578(_0x44e6c0[_0x5914('0x10')][_0x5914('0x11')]);}logger[_0x5914('0x10')](_0x5914('0xc'),_0x1890d2,_0x44e6c0[_0x5914('0x10')]['message']);return _0x531c78(_0x44e6c0['error']['message']);}else{logger[_0x5914('0xb')]('FreshdeskField,\x20%s,\x20%s',_0x1890d2,_0x5914('0xd'));_0x531c78(_0x44e6c0[_0x5914('0x12')]['message']);}})[_0x5914('0x13')](function(_0x51aaa8){logger[_0x5914('0x10')](_0x5914('0xc'),_0x1890d2,_0x51aaa8);_0x418578(_0x51aaa8);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 631e547..271e837 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 _0xe605=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','getConfigurations','/:id/fields','getFields','post','/:id/configurations','put','/:id','update','delete'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe605,0x92));var _0x5e60=function(_0x56656e,_0x136e85){_0x56656e=_0x56656e-0x0;var _0x1b078b=_0xe605[_0x56656e];return _0x1b078b;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/:id',auth[_0x5e60('0xb')](),controller['show']);router['get']('/:id/configurations',auth[_0x5e60('0xb')](),controller[_0x5e60('0xd')]);router[_0x5e60('0xa')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0xf')]);router['post']('/',auth[_0x5e60('0xb')](),controller['create']);router[_0x5e60('0x10')](_0x5e60('0x11'),auth[_0x5e60('0xb')](),controller['addConfiguration']);router[_0x5e60('0x12')](_0x5e60('0x13'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x14')]);router[_0x5e60('0x15')](_0x5e60('0x13'),auth['isAuthenticated'](),controller[_0x5e60('0x16')]);module[_0x5e60('0x17')]=router; \ No newline at end of file +var _0x69d3=['path','express','Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','update','delete','multer','util'];(function(_0x30f29d,_0x5c1943){var _0x19a20a=function(_0xf9671e){while(--_0xf9671e){_0x30f29d['push'](_0x30f29d['shift']());}};_0x19a20a(++_0x5c1943);}(_0x69d3,0xda));var _0x369d=function(_0x532b84,_0x13118d){_0x532b84=_0x532b84-0x0;var _0x4c3c69=_0x69d3[_0x532b84];return _0x4c3c69;};'use strict';var multer=require(_0x369d('0x0'));var util=require(_0x369d('0x1'));var path=require(_0x369d('0x2'));var timeout=require('connect-timeout');var express=require(_0x369d('0x3'));var router=express[_0x369d('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x369d('0x5'));var config=require('../../config/environment');var controller=require('./intFreshsalesAccount.controller');router[_0x369d('0x6')]('/',auth[_0x369d('0x7')](),controller[_0x369d('0x8')]);router[_0x369d('0x6')](_0x369d('0x9'),auth[_0x369d('0x7')](),controller[_0x369d('0xa')]);router[_0x369d('0x6')](_0x369d('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x369d('0x6')](_0x369d('0xc'),auth[_0x369d('0x7')](),controller[_0x369d('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x369d('0xe')]);router[_0x369d('0xf')](_0x369d('0xb'),auth[_0x369d('0x7')](),controller[_0x369d('0x10')]);router[_0x369d('0x11')]('/:id',auth[_0x369d('0x7')](),controller[_0x369d('0x12')]);router[_0x369d('0x13')](_0x369d('0x9'),auth[_0x369d('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index a79cfe9..46c73b4 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 _0xd7d1=['sequelize','exports','STRING','username','remoteUri'];(function(_0x467899,_0x38addb){var _0x559f32=function(_0x95ad83){while(--_0x95ad83){_0x467899['push'](_0x467899['shift']());}};_0x559f32(++_0x38addb);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x478fdb,_0xa9f9ad){_0x478fdb=_0x478fdb-0x0;var _0x5858a9=_0xd7d1[_0x478fdb];return _0x5858a9;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'name':{'type':Sequelize[_0x1d7d('0x2')]},'description':{'type':Sequelize[_0x1d7d('0x2')]},'username':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x3')},'apiKey':{'type':Sequelize[_0x1d7d('0x2')]},'remoteUri':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x4')},'serverUrl':{'type':Sequelize[_0x1d7d('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x7916=['sequelize','STRING','username','remoteUri'];(function(_0x5bbc64,_0x4e2a43){var _0x378e45=function(_0x4d454a){while(--_0x4d454a){_0x5bbc64['push'](_0x5bbc64['shift']());}};_0x378e45(++_0x4e2a43);}(_0x7916,0x128));var _0x6791=function(_0x56976b,_0x4cc384){_0x56976b=_0x56976b-0x0;var _0x3b873c=_0x7916[_0x56976b];return _0x3b873c;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'name':{'type':Sequelize[_0x6791('0x1')]},'description':{'type':Sequelize[_0x6791('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6791('0x2')},'apiKey':{'type':Sequelize[_0x6791('0x1')]},'remoteUri':{'type':Sequelize[_0x6791('0x1')],'unique':_0x6791('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 08709f1..902f276 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 _0xaff3=['Token\x20token=','users','email','test','statusCode','getFields','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','FreshsalesAccount','findAll','rows','catch','show','find','create','body','update','params','destroy','getConfigurations','keys','sort','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','FreshsalesConfiguration','FreshsalesField','username','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners'];(function(_0x3b3fb2,_0x21a7a7){var _0x2c998a=function(_0x9ad1df){while(--_0x9ad1df){_0x3b3fb2['push'](_0x3b3fb2['shift']());}};_0x2c998a(++_0x21a7a7);}(_0xaff3,0x70));var _0x3aff=function(_0x29d97e,_0x366218){_0x29d97e=_0x29d97e-0x0;var _0x4c2084=_0xaff3[_0x29d97e];return _0x4c2084;};'use strict';var emlformat=require(_0x3aff('0x0'));var rimraf=require(_0x3aff('0x1'));var zipdir=require(_0x3aff('0x2'));var jsonpatch=require(_0x3aff('0x3'));var rp=require(_0x3aff('0x4'));var moment=require(_0x3aff('0x5'));var BPromise=require(_0x3aff('0x6'));var Mustache=require(_0x3aff('0x7'));var util=require(_0x3aff('0x8'));var path=require(_0x3aff('0x9'));var sox=require(_0x3aff('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3aff('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3aff('0xc'));var querystring=require(_0x3aff('0xd'));var Papa=require('papaparse');var Redis=require(_0x3aff('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3aff('0xf'));var as=require(_0x3aff('0x10'));var hardwareService=require(_0x3aff('0x11'));var logger=require('../../config/logger')(_0x3aff('0x12'));var utils=require(_0x3aff('0x13'));var config=require(_0x3aff('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3aff('0x15'))['db'];var integrations=require(_0x3aff('0x16'));function respondWithStatusCode(_0x547fa4,_0x51e642){_0x51e642=_0x51e642||0xcc;return function(_0x22fb91){if(_0x22fb91){return _0x547fa4[_0x3aff('0x17')](_0x51e642);}return _0x547fa4['status'](_0x51e642)['end']();};}function respondWithResult(_0x9ac48c,_0xbaf8a5){_0xbaf8a5=_0xbaf8a5||0xc8;return function(_0x59345a){if(_0x59345a){return _0x9ac48c[_0x3aff('0x18')](_0xbaf8a5)['json'](_0x59345a);}};}function respondWithFilteredResult(_0x6cf8da,_0x476c7b){return function(_0x567f17){if(_0x567f17){var _0x171a8f=typeof _0x476c7b[_0x3aff('0x19')]===_0x3aff('0x1a')&&typeof _0x476c7b[_0x3aff('0x1b')]===_0x3aff('0x1a');var _0x57965e=_0x567f17['count'];var _0x361410=_0x171a8f?0x0:_0x476c7b[_0x3aff('0x19')];var _0x5886fd=_0x171a8f?_0x567f17[_0x3aff('0x1c')]:_0x476c7b[_0x3aff('0x19')]+_0x476c7b[_0x3aff('0x1b')];var _0x90b4a9;if(_0x5886fd>=_0x57965e){_0x5886fd=_0x57965e;_0x90b4a9=0xc8;}else{_0x90b4a9=0xce;}_0x6cf8da[_0x3aff('0x18')](_0x90b4a9);return _0x6cf8da[_0x3aff('0x1d')](_0x3aff('0x1e'),_0x361410+'-'+_0x5886fd+'/'+_0x57965e)['json'](_0x567f17);}return null;};}function patchUpdates(_0x2547b7){return function(_0x1d5537){try{jsonpatch[_0x3aff('0x1f')](_0x1d5537,_0x2547b7,!![]);}catch(_0x4fff1e){return BPromise[_0x3aff('0x20')](_0x4fff1e);}return _0x1d5537[_0x3aff('0x21')]();};}function saveUpdates(_0xb9ede,_0x48fc56){return function(_0x2b9452){if(_0x2b9452){return _0x2b9452['update'](_0xb9ede)[_0x3aff('0x22')](function(_0x513e1f){return _0x513e1f;});}return null;};}function removeEntity(_0x212b33,_0xf30bc1){return function(_0x3c9bec){if(_0x3c9bec){return _0x3c9bec['destroy']()[_0x3aff('0x22')](function(){_0x212b33[_0x3aff('0x18')](0xcc)[_0x3aff('0x23')]();});}};}function handleEntityNotFound(_0x35f43d,_0x4bdaf9){return function(_0x2677ce){if(!_0x2677ce){_0x35f43d[_0x3aff('0x17')](0x194);}return _0x2677ce;};}function handleError(_0x32699c,_0x275964){_0x275964=_0x275964||0x1f4;return function(_0x451c7b){logger[_0x3aff('0x24')](_0x451c7b[_0x3aff('0x25')]);if(_0x451c7b[_0x3aff('0x26')]){delete _0x451c7b[_0x3aff('0x26')];}_0x32699c[_0x3aff('0x18')](_0x275964)['send'](_0x451c7b);};}exports[_0x3aff('0x27')]=function(_0x92abd9,_0x191325){var _0x1f3729={},_0x1acfc0={},_0x5aeae7={'count':0x0,'rows':[]};var _0x118a37=_[_0x3aff('0x28')](db['FreshsalesAccount'][_0x3aff('0x29')],function(_0x3694d7){return{'name':_0x3694d7[_0x3aff('0x2a')],'type':_0x3694d7[_0x3aff('0x2b')][_0x3aff('0x2c')]};});_0x1acfc0[_0x3aff('0x2d')]=_['map'](_0x118a37,'name');_0x1acfc0[_0x3aff('0x2e')]=_['keys'](_0x92abd9[_0x3aff('0x2e')]);_0x1acfc0['filters']=_[_0x3aff('0x2f')](_0x1acfc0['model'],_0x1acfc0[_0x3aff('0x2e')]);_0x1f3729['attributes']=_[_0x3aff('0x2f')](_0x1acfc0[_0x3aff('0x2d')],qs[_0x3aff('0x30')](_0x92abd9[_0x3aff('0x2e')][_0x3aff('0x30')]));_0x1f3729[_0x3aff('0x31')]=_0x1f3729[_0x3aff('0x31')][_0x3aff('0x32')]?_0x1f3729[_0x3aff('0x31')]:_0x1acfc0['model'];if(!_0x92abd9[_0x3aff('0x2e')]['hasOwnProperty'](_0x3aff('0x33'))){_0x1f3729[_0x3aff('0x1b')]=qs[_0x3aff('0x1b')](_0x92abd9['query']['limit']);_0x1f3729[_0x3aff('0x19')]=qs[_0x3aff('0x19')](_0x92abd9[_0x3aff('0x2e')]['offset']);}_0x1f3729[_0x3aff('0x34')]=qs['sort'](_0x92abd9['query']['sort']);_0x1f3729['where']=qs['filters'](_[_0x3aff('0x35')](_0x92abd9['query'],_0x1acfc0[_0x3aff('0x36')]),_0x118a37);if(_0x92abd9[_0x3aff('0x2e')][_0x3aff('0x37')]){_0x1f3729[_0x3aff('0x38')]=_[_0x3aff('0x39')](_0x1f3729[_0x3aff('0x38')],{'$or':_[_0x3aff('0x28')](_0x118a37,function(_0x1e6476){if(_0x1e6476['type']!==_0x3aff('0x3a')){var _0x110de2={};_0x110de2[_0x1e6476['name']]={'$like':'%'+_0x92abd9[_0x3aff('0x2e')][_0x3aff('0x37')]+'%'};return _0x110de2;}})});}_0x1f3729=_[_0x3aff('0x39')]({},_0x1f3729,_0x92abd9[_0x3aff('0x3b')]);var _0x436f8f={'where':_0x1f3729[_0x3aff('0x38')]};return db['FreshsalesAccount'][_0x3aff('0x1c')](_0x436f8f)[_0x3aff('0x22')](function(_0xd78ce7){_0x5aeae7[_0x3aff('0x1c')]=_0xd78ce7;if(_0x92abd9[_0x3aff('0x2e')][_0x3aff('0x3c')]){_0x1f3729[_0x3aff('0x3d')]=[{'all':!![]}];}return db[_0x3aff('0x3e')][_0x3aff('0x3f')](_0x1f3729);})[_0x3aff('0x22')](function(_0x2987a0){_0x5aeae7[_0x3aff('0x40')]=_0x2987a0;return _0x5aeae7;})[_0x3aff('0x22')](respondWithFilteredResult(_0x191325,_0x1f3729))[_0x3aff('0x41')](handleError(_0x191325,null));};exports[_0x3aff('0x42')]=function(_0x398c72,_0x5de3da){var _0x2a7952={'raw':![],'where':{'id':_0x398c72['params']['id']}},_0x2644a1={};_0x2644a1[_0x3aff('0x2d')]=_['keys'](db[_0x3aff('0x3e')][_0x3aff('0x29')]);_0x2644a1[_0x3aff('0x2e')]=_['keys'](_0x398c72[_0x3aff('0x2e')]);_0x2644a1[_0x3aff('0x36')]=_[_0x3aff('0x2f')](_0x2644a1[_0x3aff('0x2d')],_0x2644a1[_0x3aff('0x2e')]);_0x2a7952[_0x3aff('0x31')]=_['intersection'](_0x2644a1[_0x3aff('0x2d')],qs['fields'](_0x398c72['query'][_0x3aff('0x30')]));_0x2a7952[_0x3aff('0x31')]=_0x2a7952[_0x3aff('0x31')][_0x3aff('0x32')]?_0x2a7952[_0x3aff('0x31')]:_0x2644a1[_0x3aff('0x2d')];if(_0x398c72[_0x3aff('0x2e')]['includeAll']){_0x2a7952[_0x3aff('0x3d')]=[{'all':!![]}];}_0x2a7952=_['merge']({},_0x2a7952,_0x398c72[_0x3aff('0x3b')]);return db[_0x3aff('0x3e')][_0x3aff('0x43')](_0x2a7952)[_0x3aff('0x22')](handleEntityNotFound(_0x5de3da,null))[_0x3aff('0x22')](respondWithResult(_0x5de3da,null))[_0x3aff('0x41')](handleError(_0x5de3da,null));};exports[_0x3aff('0x44')]=function(_0x4bdb47,_0x132a2c){return db[_0x3aff('0x3e')]['create'](_0x4bdb47[_0x3aff('0x45')],{})[_0x3aff('0x22')](respondWithResult(_0x132a2c,0xc9))[_0x3aff('0x41')](handleError(_0x132a2c,null));};exports[_0x3aff('0x46')]=function(_0x295c18,_0x4f8fd7){if(_0x295c18[_0x3aff('0x45')]['id']){delete _0x295c18[_0x3aff('0x45')]['id'];}return db[_0x3aff('0x3e')]['find']({'where':{'id':_0x295c18[_0x3aff('0x47')]['id']}})[_0x3aff('0x22')](handleEntityNotFound(_0x4f8fd7,null))['then'](saveUpdates(_0x295c18[_0x3aff('0x45')],null))[_0x3aff('0x22')](respondWithResult(_0x4f8fd7,null))[_0x3aff('0x41')](handleError(_0x4f8fd7,null));};exports[_0x3aff('0x48')]=function(_0x4aeb15,_0x1ea376){return db['FreshsalesAccount'][_0x3aff('0x43')]({'where':{'id':_0x4aeb15[_0x3aff('0x47')]['id']}})[_0x3aff('0x22')](handleEntityNotFound(_0x1ea376,null))[_0x3aff('0x22')](removeEntity(_0x1ea376,null))[_0x3aff('0x41')](handleError(_0x1ea376,null));};exports[_0x3aff('0x49')]=function(_0x4718f0,_0x2f9535,_0xa8c30e){var _0x377b3b={};var _0x15f9ec={};var _0x5133f2;var _0x3fadb7;return db[_0x3aff('0x3e')]['findOne']({'where':{'id':_0x4718f0[_0x3aff('0x47')]['id']}})[_0x3aff('0x22')](handleEntityNotFound(_0x2f9535,null))[_0x3aff('0x22')](function(_0x37bc9e){if(_0x37bc9e){_0x5133f2=_0x37bc9e;_0x15f9ec[_0x3aff('0x2d')]=_[_0x3aff('0x4a')](db['FreshsalesConfiguration'][_0x3aff('0x29')]);_0x15f9ec['query']=_[_0x3aff('0x4a')](_0x4718f0[_0x3aff('0x2e')]);_0x15f9ec[_0x3aff('0x36')]=_[_0x3aff('0x2f')](_0x15f9ec[_0x3aff('0x2d')],_0x15f9ec[_0x3aff('0x2e')]);_0x377b3b['attributes']=_[_0x3aff('0x2f')](_0x15f9ec[_0x3aff('0x2d')],qs['fields'](_0x4718f0[_0x3aff('0x2e')][_0x3aff('0x30')]));_0x377b3b[_0x3aff('0x31')]=_0x377b3b[_0x3aff('0x31')][_0x3aff('0x32')]?_0x377b3b[_0x3aff('0x31')]:_0x15f9ec['model'];_0x377b3b[_0x3aff('0x34')]=qs[_0x3aff('0x4b')](_0x4718f0['query'][_0x3aff('0x4b')]);_0x377b3b[_0x3aff('0x38')]=qs[_0x3aff('0x36')](_[_0x3aff('0x35')](_0x4718f0[_0x3aff('0x2e')],_0x15f9ec[_0x3aff('0x36')]));if(_0x4718f0[_0x3aff('0x2e')]['filter']){_0x377b3b[_0x3aff('0x38')]=_['merge'](_0x377b3b['where'],{'$or':_[_0x3aff('0x28')](_0x377b3b[_0x3aff('0x31')],function(_0x155b36){var _0x2bf266={};_0x2bf266[_0x155b36]={'$like':'%'+_0x4718f0[_0x3aff('0x2e')][_0x3aff('0x37')]+'%'};return _0x2bf266;})});}_0x377b3b=_[_0x3aff('0x39')]({},_0x377b3b,_0x4718f0[_0x3aff('0x3b')]);return _0x5133f2[_0x3aff('0x49')](_0x377b3b);}})[_0x3aff('0x22')](function(_0x7d257b){if(_0x7d257b){_0x3fadb7=_0x7d257b[_0x3aff('0x32')];if(!_0x4718f0['query'][_0x3aff('0x4c')](_0x3aff('0x33'))){_0x377b3b['limit']=qs[_0x3aff('0x1b')](_0x4718f0['query'][_0x3aff('0x1b')]);_0x377b3b['offset']=qs[_0x3aff('0x19')](_0x4718f0[_0x3aff('0x2e')][_0x3aff('0x19')]);}return _0x5133f2[_0x3aff('0x49')](_0x377b3b);}})['then'](function(_0xe9d898){if(_0xe9d898){return _0xe9d898?{'count':_0x3fadb7,'rows':_0xe9d898}:null;}})[_0x3aff('0x22')](respondWithResult(_0x2f9535,null))[_0x3aff('0x41')](handleError(_0x2f9535,null));};exports[_0x3aff('0x4d')]=function(_0x23f28b,_0x224564,_0x3159dd){if(_0x23f28b[_0x3aff('0x45')]['id']){delete _0x23f28b[_0x3aff('0x45')]['id'];}return db[_0x3aff('0x3e')][_0x3aff('0x4e')]({'where':{'id':_0x23f28b[_0x3aff('0x47')]['id']}})[_0x3aff('0x22')](handleEntityNotFound(_0x224564,null))[_0x3aff('0x22')](function(_0x44f9e3){if(_0x44f9e3){_0x23f28b[_0x3aff('0x45')][_0x3aff('0x4f')]=_0x44f9e3['id'];_0x23f28b['body'][_0x3aff('0x50')]=integrations[_0x3aff('0x51')](_0x23f28b[_0x3aff('0x45')]['channel'],_0x23f28b[_0x3aff('0x45')]['type']);_0x23f28b['body'][_0x3aff('0x52')]=integrations['getDescriptions'](_0x23f28b[_0x3aff('0x45')]['channel'],_0x23f28b['body'][_0x3aff('0x2b')]);return db[_0x3aff('0x53')][_0x3aff('0x44')](_0x23f28b[_0x3aff('0x45')],{'include':[{'model':db[_0x3aff('0x54')],'as':_0x3aff('0x50')},{'model':db[_0x3aff('0x54')],'as':'Descriptions'}]});}return null;})[_0x3aff('0x22')](respondWithResult(_0x224564,null))[_0x3aff('0x41')](handleError(_0x224564,null));};exports['getFields']=function(_0x20e1f4,_0x562d91,_0x54fff8){var _0x3c7f16='';var _0x303c1a='';return db[_0x3aff('0x3e')][_0x3aff('0x4e')]({'where':{'id':_0x20e1f4[_0x3aff('0x47')]['id']},'attributes':['id',_0x3aff('0x55'),_0x3aff('0x56'),_0x3aff('0x57')]})[_0x3aff('0x22')](handleEntityNotFound(_0x562d91,null))[_0x3aff('0x22')](function(_0x536093){if(_0x536093){_0x303c1a=_0x536093[_0x3aff('0x55')];_0x3c7f16=_0x536093[_0x3aff('0x56')];var _0x85981f=_0x536093[_0x3aff('0x56')]['slice'](-0x1);if(_0x85981f==='/'){_0x3c7f16=_0x3c7f16[_0x3aff('0x58')](0x0,_0x3c7f16[_0x3aff('0x59')](_0x85981f));}return rp({'method':_0x3aff('0x5a'),'uri':util[_0x3aff('0x5b')](_0x3aff('0x5c'),_0x3c7f16,_0x3aff('0x5d')),'headers':{'Authorization':_0x3aff('0x5e')+_0x536093[_0x3aff('0x57')]},'json':!![]});}})[_0x3aff('0x22')](function(_0x4c1adf){if(_0x4c1adf){var _0xcada14=_0x4c1adf[_0x3aff('0x5f')];var _0xa1469c=![];var _0x33416c=null;for(_0x33416c=0x0;_0x33416c<_0xcada14[_0x3aff('0x32')];_0x33416c++){if(_0xcada14[_0x33416c][_0x3aff('0x60')]===_0x303c1a){_0xa1469c=!![];}}if(_0xa1469c){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x3aff('0x22')](respondWithResult(_0x562d91,null))[_0x3aff('0x41')](function(_0x5981b9){var _0x2c33bd=_0x20e1f4['query'][_0x3aff('0x61')]?0x1f4:_0x5981b9[_0x3aff('0x62')]||0x1f4;logger[_0x3aff('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x3aff('0x63'),_0x2c33bd,JSON[_0x3aff('0x64')](_0x5981b9));delete _0x5981b9[_0x3aff('0x26')];if(_0x2c33bd===0x191){_0x2c33bd=0x190;}_0x562d91['status'](_0x2c33bd)[_0x3aff('0x65')](_0x20e1f4[_0x3aff('0x2e')][_0x3aff('0x61')]?{'message':_0x3aff('0x66'),'statusCode':_0x5981b9[_0x3aff('0x62')]}:_0x5981b9);});}; \ No newline at end of file +var _0x4181=['sort','where','filters','filter','merge','VIRTUAL','options','findAll','rows','show','params','fields','includeAll','include','find','catch','body','getConfigurations','FreshsalesConfiguration','pick','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','create','FreshsalesField','getFields','findOne','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','length','order'];(function(_0x41682b,_0x33b6e4){var _0x137693=function(_0x3e67ac){while(--_0x3e67ac){_0x41682b['push'](_0x41682b['shift']());}};_0x137693(++_0x33b6e4);}(_0x4181,0x1e7));var _0x1418=function(_0x15a7a9,_0x4960db){_0x15a7a9=_0x15a7a9-0x0;var _0x967a6d=_0x4181[_0x15a7a9];return _0x967a6d;};'use strict';var emlformat=require(_0x1418('0x0'));var rimraf=require(_0x1418('0x1'));var zipdir=require(_0x1418('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1418('0x3'));var moment=require(_0x1418('0x4'));var BPromise=require(_0x1418('0x5'));var Mustache=require(_0x1418('0x6'));var util=require(_0x1418('0x7'));var path=require('path');var sox=require(_0x1418('0x8'));var csv=require('to-csv');var ejs=require(_0x1418('0x9'));var fs=require('fs');var fs_extra=require(_0x1418('0xa'));var _=require(_0x1418('0xb'));var squel=require(_0x1418('0xc'));var crypto=require(_0x1418('0xd'));var jsforce=require(_0x1418('0xe'));var deskjs=require(_0x1418('0xf'));var toCsv=require(_0x1418('0x10'));var querystring=require('querystring');var Papa=require(_0x1418('0x11'));var Redis=require(_0x1418('0x12'));var authService=require(_0x1418('0x13'));var qs=require(_0x1418('0x14'));var as=require(_0x1418('0x15'));var hardwareService=require(_0x1418('0x16'));var logger=require(_0x1418('0x17'))(_0x1418('0x18'));var utils=require(_0x1418('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x1418('0x1a'));function respondWithStatusCode(_0x20e987,_0x163b78){_0x163b78=_0x163b78||0xcc;return function(_0x2919c6){if(_0x2919c6){return _0x20e987[_0x1418('0x1b')](_0x163b78);}return _0x20e987[_0x1418('0x1c')](_0x163b78)[_0x1418('0x1d')]();};}function respondWithResult(_0x281bcc,_0x2e1a81){_0x2e1a81=_0x2e1a81||0xc8;return function(_0x215b04){if(_0x215b04){return _0x281bcc[_0x1418('0x1c')](_0x2e1a81)[_0x1418('0x1e')](_0x215b04);}};}function respondWithFilteredResult(_0x11af9b,_0x1d1bd6){return function(_0x1b3fbd){if(_0x1b3fbd){var _0x1fa70f=typeof _0x1d1bd6[_0x1418('0x1f')]===_0x1418('0x20')&&typeof _0x1d1bd6[_0x1418('0x21')]===_0x1418('0x20');var _0x3fb0ee=_0x1b3fbd[_0x1418('0x22')];var _0x450073=_0x1fa70f?0x0:_0x1d1bd6[_0x1418('0x1f')];var _0x14814d=_0x1fa70f?_0x1b3fbd['count']:_0x1d1bd6[_0x1418('0x1f')]+_0x1d1bd6[_0x1418('0x21')];var _0x429a2f;if(_0x14814d>=_0x3fb0ee){_0x14814d=_0x3fb0ee;_0x429a2f=0xc8;}else{_0x429a2f=0xce;}_0x11af9b[_0x1418('0x1c')](_0x429a2f);return _0x11af9b[_0x1418('0x23')](_0x1418('0x24'),_0x450073+'-'+_0x14814d+'/'+_0x3fb0ee)[_0x1418('0x1e')](_0x1b3fbd);}return null;};}function patchUpdates(_0x569152){return function(_0x106169){try{jsonpatch[_0x1418('0x25')](_0x106169,_0x569152,!![]);}catch(_0x4c9775){return BPromise['reject'](_0x4c9775);}return _0x106169[_0x1418('0x26')]();};}function saveUpdates(_0x15b9b4,_0x4bc09e){return function(_0x5f33d5){if(_0x5f33d5){return _0x5f33d5[_0x1418('0x27')](_0x15b9b4)[_0x1418('0x28')](function(_0xc78d42){return _0xc78d42;});}return null;};}function removeEntity(_0x40fe58,_0x467a46){return function(_0x4d08a1){if(_0x4d08a1){return _0x4d08a1[_0x1418('0x29')]()[_0x1418('0x28')](function(){_0x40fe58['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2331cb,_0x359b21){return function(_0x5aa18b){if(!_0x5aa18b){_0x2331cb[_0x1418('0x1b')](0x194);}return _0x5aa18b;};}function handleError(_0x275f80,_0x251f3c){_0x251f3c=_0x251f3c||0x1f4;return function(_0x1cd877){logger['error'](_0x1cd877[_0x1418('0x2a')]);if(_0x1cd877['name']){delete _0x1cd877[_0x1418('0x2b')];}_0x275f80[_0x1418('0x1c')](_0x251f3c)[_0x1418('0x2c')](_0x1cd877);};}exports[_0x1418('0x2d')]=function(_0x1ed781,_0x31426e){var _0x1252da={},_0x1fd4fe={},_0x52fd88={'count':0x0,'rows':[]};var _0x5c3251=_[_0x1418('0x2e')](db[_0x1418('0x2f')][_0x1418('0x30')],function(_0x423fce){return{'name':_0x423fce[_0x1418('0x31')],'type':_0x423fce[_0x1418('0x32')]['key']};});_0x1fd4fe[_0x1418('0x33')]=_[_0x1418('0x2e')](_0x5c3251,_0x1418('0x2b'));_0x1fd4fe[_0x1418('0x34')]=_[_0x1418('0x35')](_0x1ed781[_0x1418('0x34')]);_0x1fd4fe['filters']=_['intersection'](_0x1fd4fe[_0x1418('0x33')],_0x1fd4fe[_0x1418('0x34')]);_0x1252da[_0x1418('0x36')]=_[_0x1418('0x37')](_0x1fd4fe['model'],qs['fields'](_0x1ed781[_0x1418('0x34')]['fields']));_0x1252da[_0x1418('0x36')]=_0x1252da['attributes'][_0x1418('0x38')]?_0x1252da[_0x1418('0x36')]:_0x1fd4fe[_0x1418('0x33')];if(!_0x1ed781[_0x1418('0x34')]['hasOwnProperty']('nolimit')){_0x1252da['limit']=qs['limit'](_0x1ed781['query'][_0x1418('0x21')]);_0x1252da['offset']=qs[_0x1418('0x1f')](_0x1ed781[_0x1418('0x34')]['offset']);}_0x1252da[_0x1418('0x39')]=qs[_0x1418('0x3a')](_0x1ed781['query'][_0x1418('0x3a')]);_0x1252da[_0x1418('0x3b')]=qs[_0x1418('0x3c')](_['pick'](_0x1ed781[_0x1418('0x34')],_0x1fd4fe[_0x1418('0x3c')]),_0x5c3251);if(_0x1ed781[_0x1418('0x34')][_0x1418('0x3d')]){_0x1252da['where']=_[_0x1418('0x3e')](_0x1252da[_0x1418('0x3b')],{'$or':_[_0x1418('0x2e')](_0x5c3251,function(_0x1b4b86){if(_0x1b4b86[_0x1418('0x32')]!==_0x1418('0x3f')){var _0x55455e={};_0x55455e[_0x1b4b86[_0x1418('0x2b')]]={'$like':'%'+_0x1ed781[_0x1418('0x34')]['filter']+'%'};return _0x55455e;}})});}_0x1252da=_[_0x1418('0x3e')]({},_0x1252da,_0x1ed781[_0x1418('0x40')]);var _0x100322={'where':_0x1252da[_0x1418('0x3b')]};return db[_0x1418('0x2f')][_0x1418('0x22')](_0x100322)[_0x1418('0x28')](function(_0x287bc5){_0x52fd88[_0x1418('0x22')]=_0x287bc5;if(_0x1ed781['query']['includeAll']){_0x1252da['include']=[{'all':!![]}];}return db[_0x1418('0x2f')][_0x1418('0x41')](_0x1252da);})[_0x1418('0x28')](function(_0x301086){_0x52fd88[_0x1418('0x42')]=_0x301086;return _0x52fd88;})[_0x1418('0x28')](respondWithFilteredResult(_0x31426e,_0x1252da))['catch'](handleError(_0x31426e,null));};exports[_0x1418('0x43')]=function(_0x36fcc1,_0x3e7e9a){var _0x1bbcc7={'raw':![],'where':{'id':_0x36fcc1[_0x1418('0x44')]['id']}},_0x449745={};_0x449745[_0x1418('0x33')]=_['keys'](db[_0x1418('0x2f')][_0x1418('0x30')]);_0x449745[_0x1418('0x34')]=_['keys'](_0x36fcc1[_0x1418('0x34')]);_0x449745[_0x1418('0x3c')]=_[_0x1418('0x37')](_0x449745[_0x1418('0x33')],_0x449745['query']);_0x1bbcc7[_0x1418('0x36')]=_[_0x1418('0x37')](_0x449745[_0x1418('0x33')],qs['fields'](_0x36fcc1[_0x1418('0x34')][_0x1418('0x45')]));_0x1bbcc7[_0x1418('0x36')]=_0x1bbcc7[_0x1418('0x36')]['length']?_0x1bbcc7['attributes']:_0x449745['model'];if(_0x36fcc1[_0x1418('0x34')][_0x1418('0x46')]){_0x1bbcc7[_0x1418('0x47')]=[{'all':!![]}];}_0x1bbcc7=_[_0x1418('0x3e')]({},_0x1bbcc7,_0x36fcc1[_0x1418('0x40')]);return db[_0x1418('0x2f')][_0x1418('0x48')](_0x1bbcc7)[_0x1418('0x28')](handleEntityNotFound(_0x3e7e9a,null))[_0x1418('0x28')](respondWithResult(_0x3e7e9a,null))[_0x1418('0x49')](handleError(_0x3e7e9a,null));};exports['create']=function(_0x51f4f5,_0xa11578){return db[_0x1418('0x2f')]['create'](_0x51f4f5[_0x1418('0x4a')],{})[_0x1418('0x28')](respondWithResult(_0xa11578,0xc9))[_0x1418('0x49')](handleError(_0xa11578,null));};exports['update']=function(_0x499a6f,_0x280fd3){if(_0x499a6f[_0x1418('0x4a')]['id']){delete _0x499a6f[_0x1418('0x4a')]['id'];}return db[_0x1418('0x2f')][_0x1418('0x48')]({'where':{'id':_0x499a6f[_0x1418('0x44')]['id']}})[_0x1418('0x28')](handleEntityNotFound(_0x280fd3,null))[_0x1418('0x28')](saveUpdates(_0x499a6f['body'],null))[_0x1418('0x28')](respondWithResult(_0x280fd3,null))[_0x1418('0x49')](handleError(_0x280fd3,null));};exports[_0x1418('0x29')]=function(_0x17f374,_0x1fc9bc){return db[_0x1418('0x2f')]['find']({'where':{'id':_0x17f374['params']['id']}})[_0x1418('0x28')](handleEntityNotFound(_0x1fc9bc,null))['then'](removeEntity(_0x1fc9bc,null))[_0x1418('0x49')](handleError(_0x1fc9bc,null));};exports[_0x1418('0x4b')]=function(_0x1de708,_0x5a96ad,_0x33a3f2){var _0x55adca={};var _0x2193d0={};var _0x276235;var _0x1b9bff;return db[_0x1418('0x2f')]['findOne']({'where':{'id':_0x1de708[_0x1418('0x44')]['id']}})[_0x1418('0x28')](handleEntityNotFound(_0x5a96ad,null))[_0x1418('0x28')](function(_0x5934a3){if(_0x5934a3){_0x276235=_0x5934a3;_0x2193d0[_0x1418('0x33')]=_['keys'](db[_0x1418('0x4c')][_0x1418('0x30')]);_0x2193d0[_0x1418('0x34')]=_[_0x1418('0x35')](_0x1de708[_0x1418('0x34')]);_0x2193d0[_0x1418('0x3c')]=_[_0x1418('0x37')](_0x2193d0[_0x1418('0x33')],_0x2193d0[_0x1418('0x34')]);_0x55adca[_0x1418('0x36')]=_['intersection'](_0x2193d0[_0x1418('0x33')],qs[_0x1418('0x45')](_0x1de708['query']['fields']));_0x55adca[_0x1418('0x36')]=_0x55adca[_0x1418('0x36')][_0x1418('0x38')]?_0x55adca[_0x1418('0x36')]:_0x2193d0['model'];_0x55adca[_0x1418('0x39')]=qs[_0x1418('0x3a')](_0x1de708['query'][_0x1418('0x3a')]);_0x55adca[_0x1418('0x3b')]=qs[_0x1418('0x3c')](_[_0x1418('0x4d')](_0x1de708[_0x1418('0x34')],_0x2193d0[_0x1418('0x3c')]));if(_0x1de708['query'][_0x1418('0x3d')]){_0x55adca[_0x1418('0x3b')]=_[_0x1418('0x3e')](_0x55adca[_0x1418('0x3b')],{'$or':_[_0x1418('0x2e')](_0x55adca['attributes'],function(_0x4b9bbd){var _0x362dfb={};_0x362dfb[_0x4b9bbd]={'$like':'%'+_0x1de708['query'][_0x1418('0x3d')]+'%'};return _0x362dfb;})});}_0x55adca=_[_0x1418('0x3e')]({},_0x55adca,_0x1de708[_0x1418('0x40')]);return _0x276235[_0x1418('0x4b')](_0x55adca);}})[_0x1418('0x28')](function(_0x57d084){if(_0x57d084){_0x1b9bff=_0x57d084['length'];if(!_0x1de708[_0x1418('0x34')][_0x1418('0x4e')](_0x1418('0x4f'))){_0x55adca[_0x1418('0x21')]=qs['limit'](_0x1de708['query']['limit']);_0x55adca['offset']=qs['offset'](_0x1de708[_0x1418('0x34')][_0x1418('0x1f')]);}return _0x276235[_0x1418('0x4b')](_0x55adca);}})[_0x1418('0x28')](function(_0x257a9f){if(_0x257a9f){return _0x257a9f?{'count':_0x1b9bff,'rows':_0x257a9f}:null;}})[_0x1418('0x28')](respondWithResult(_0x5a96ad,null))[_0x1418('0x49')](handleError(_0x5a96ad,null));};exports[_0x1418('0x50')]=function(_0x33c843,_0x212736,_0x568ac4){if(_0x33c843[_0x1418('0x4a')]['id']){delete _0x33c843[_0x1418('0x4a')]['id'];}return db['FreshsalesAccount']['findOne']({'where':{'id':_0x33c843[_0x1418('0x44')]['id']}})[_0x1418('0x28')](handleEntityNotFound(_0x212736,null))[_0x1418('0x28')](function(_0xa8b2cc){if(_0xa8b2cc){_0x33c843['body'][_0x1418('0x51')]=_0xa8b2cc['id'];_0x33c843[_0x1418('0x4a')][_0x1418('0x52')]=integrations[_0x1418('0x53')](_0x33c843[_0x1418('0x4a')]['channel'],_0x33c843['body']['type']);_0x33c843[_0x1418('0x4a')][_0x1418('0x54')]=integrations['getDescriptions'](_0x33c843['body'][_0x1418('0x55')],_0x33c843['body']['type']);return db[_0x1418('0x4c')][_0x1418('0x56')](_0x33c843[_0x1418('0x4a')],{'include':[{'model':db[_0x1418('0x57')],'as':_0x1418('0x52')},{'model':db[_0x1418('0x57')],'as':_0x1418('0x54')}]});}return null;})['then'](respondWithResult(_0x212736,null))[_0x1418('0x49')](handleError(_0x212736,null));};exports[_0x1418('0x58')]=function(_0x25dfe0,_0x2b1594,_0x4526f4){var _0x36b1da='';var _0x195738='';return db[_0x1418('0x2f')][_0x1418('0x59')]({'where':{'id':_0x25dfe0[_0x1418('0x44')]['id']},'attributes':['id',_0x1418('0x5a'),_0x1418('0x5b'),_0x1418('0x5c')]})['then'](handleEntityNotFound(_0x2b1594,null))['then'](function(_0x295f04){if(_0x295f04){_0x195738=_0x295f04['username'];_0x36b1da=_0x295f04[_0x1418('0x5b')];var _0xf09edb=_0x295f04[_0x1418('0x5b')][_0x1418('0x5d')](-0x1);if(_0xf09edb==='/'){_0x36b1da=_0x36b1da[_0x1418('0x5e')](0x0,_0x36b1da[_0x1418('0x5f')](_0xf09edb));}return rp({'method':_0x1418('0x60'),'uri':util[_0x1418('0x61')](_0x1418('0x62'),_0x36b1da,_0x1418('0x63')),'headers':{'Authorization':_0x1418('0x64')+_0x295f04[_0x1418('0x5c')]},'json':!![]});}})['then'](function(_0x501029){if(_0x501029){var _0x37071c=_0x501029[_0x1418('0x65')];var _0x276947=![];var _0x15c3a4=null;for(_0x15c3a4=0x0;_0x15c3a4<_0x37071c[_0x1418('0x38')];_0x15c3a4++){if(_0x37071c[_0x15c3a4][_0x1418('0x66')]===_0x195738){_0x276947=!![];}}if(_0x276947){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1418('0x67')});}}})[_0x1418('0x28')](respondWithResult(_0x2b1594,null))['catch'](function(_0x149bce){var _0x45f921=_0x25dfe0[_0x1418('0x34')][_0x1418('0x68')]?0x1f4:_0x149bce[_0x1418('0x69')]||0x1f4;logger['error'](_0x1418('0x6a'),_0x1418('0x58'),_0x45f921,JSON[_0x1418('0x6b')](_0x149bce));delete _0x149bce[_0x1418('0x2b')];if(_0x45f921===0x191){_0x45f921=0x190;}_0x2b1594[_0x1418('0x1c')](_0x45f921)[_0x1418('0x2c')](_0x25dfe0[_0x1418('0x34')][_0x1418('0x68')]?{'message':_0x1418('0x6c'),'statusCode':_0x149bce['statusCode']}:_0x149bce);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 765d354..a9a872e 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 _0x71ab=['path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','util','api','bluebird','request-promise'];(function(_0x192431,_0x267a5c){var _0x41141b=function(_0x2fe304){while(--_0x2fe304){_0x192431['push'](_0x192431['shift']());}};_0x41141b(++_0x267a5c);}(_0x71ab,0x64));var _0xb71a=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x71ab[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var logger=require('../../config/logger')(_0xb71a('0x1'));var moment=require('moment');var BPromise=require(_0xb71a('0x2'));var rp=require(_0xb71a('0x3'));var fs=require('fs');var path=require(_0xb71a('0x4'));var rimraf=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var attributes=require(_0xb71a('0x7'));var integrations=require(_0xb71a('0x8'));module[_0xb71a('0x9')]=function(_0x22c072,_0x35a84e){return _0x22c072[_0xb71a('0xa')](_0xb71a('0xb'),attributes,{'tableName':_0xb71a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a37=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','FreshsalesAccount','lodash','util'];(function(_0x5c1b05,_0x213768){var _0x1a65e7=function(_0x2845d7){while(--_0x2845d7){_0x5c1b05['push'](_0x5c1b05['shift']());}};_0x1a65e7(++_0x213768);}(_0x1a37,0xb4));var _0x71a3=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x1a37[_0xb0f7c3];return _0x28ea68;};'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('./intFreshsalesAccount.attributes');var integrations=require(_0x71a3('0xa'));module['exports']=function(_0xd09f7,_0x45050a){return _0xd09f7[_0x71a3('0xb')](_0x71a3('0xc'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 8fc54af..290e0ec 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 _0x5f66=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','GetFreshsalesAccount','findAll','options','attributes','limit','include','model','map','ShowFreshsalesAccount','FreshsalesAccount','raw','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x5b5a8b,_0xd4ada1){var _0x50f175=function(_0x4570bc){while(--_0x4570bc){_0x5b5a8b['push'](_0x5b5a8b['shift']());}};_0x50f175(++_0xd4ada1);}(_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')]('FreshsalesAccount,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['FreshsalesAccount'][_0x65f6('0x16')]({'raw':_0x1f974c['options']?_0x1f974c['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')]['where']||null:null,'attributes':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x18')]||null:null,'limit':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x19')]||null:null,'include':_0x1f974c['options']?_0x1f974c[_0x65f6('0x17')]['include']?_['map'](_0x1f974c[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x524e42){return{'model':db[_0x524e42[_0x65f6('0x1b')]],'as':_0x524e42['as'],'attributes':_0x524e42[_0x65f6('0x18')],'include':_0x524e42[_0x65f6('0x1a')]?_[_0x65f6('0x1c')](_0x524e42['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x1b')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x18')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x1b')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x28f710){logger['info'](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')](_0x65f6('0x15'),_0x1f974c,JSON['stringify'](_0x28f710));_0x18380e(_0x28f710);})['catch'](function(_0x488d36){logger[_0x65f6('0x12')](_0x65f6('0x15'),_0x488d36[_0x65f6('0x11')],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x488d36[_0x65f6('0x11')]));});});};exports[_0x65f6('0x1d')]=function(_0x144e55){var _0x4ace4c=this;return new Promise(function(_0x4ea23d,_0x154cbd){return db[_0x65f6('0x1e')]['find']({'raw':_0x144e55['options']?_0x144e55[_0x65f6('0x17')][_0x65f6('0x1f')]===undefined?!![]:![]:!![],'where':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')][_0x65f6('0x20')]||null:null,'attributes':_0x144e55[_0x65f6('0x17')]?_0x144e55['options'][_0x65f6('0x18')]||null:null,'include':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')]['include']?_[_0x65f6('0x1c')](_0x144e55[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x45510a){return{'model':db[_0x45510a[_0x65f6('0x1b')]],'as':_0x45510a['as'],'attributes':_0x45510a[_0x65f6('0x18')],'include':_0x45510a['include']?_[_0x65f6('0x1c')](_0x45510a[_0x65f6('0x1a')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x1b')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1a')]?_['map'](_0x4f3e22[_0x65f6('0x1a')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x3b261d){logger['info']('ShowFreshsalesAccount',_0x144e55);logger[_0x65f6('0xd')]('ShowFreshsalesAccount',_0x144e55,JSON[_0x65f6('0xf')](_0x3b261d));_0x4ea23d(_0x3b261d);})['catch'](function(_0x22d760){logger[_0x65f6('0x12')]('ShowFreshsalesAccount',_0x22d760[_0x65f6('0x11')],_0x144e55);_0x154cbd(_0x4ace4c['error'](0x1f4,_0x22d760['message']));});});}; \ No newline at end of file +var _0x8ace=['client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','attributes','limit','include','map','model','then','ShowFreshsalesAccount','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x49c68e,_0x1c1673){var _0x33032b=function(_0x42ac31){while(--_0x42ac31){_0x49c68e['push'](_0x49c68e['shift']());}};_0x33032b(++_0x1c1673);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x485b5d,_0x5692b6){_0x485b5d=_0x485b5d-0x0;var _0xa90291=_0x8ace[_0x485b5d];return _0xa90291;};'use strict';var _=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var moment=require(_0xe8ac('0x2'));var BPromise=require(_0xe8ac('0x3'));var rs=require(_0xe8ac('0x4'));var fs=require('fs');var Redis=require(_0xe8ac('0x5'));var db=require(_0xe8ac('0x6'))['db'];var utils=require(_0xe8ac('0x7'));var logger=require(_0xe8ac('0x8'))(_0xe8ac('0x9'));var config=require(_0xe8ac('0xa'));var jayson=require(_0xe8ac('0xb'));var client=jayson[_0xe8ac('0xc')][_0xe8ac('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4eb087,_0x2d56f0,_0x1357ed){return new BPromise(function(_0x4f9233,_0x5c83e1){return client[_0xe8ac('0xe')](_0x4eb087,_0x1357ed)['then'](function(_0x1b5467){logger[_0xe8ac('0xf')](_0xe8ac('0x10'),_0x2d56f0,_0xe8ac('0x11'));logger[_0xe8ac('0x12')](_0xe8ac('0x13'),_0x2d56f0,'request\x20sent',JSON[_0xe8ac('0x14')](_0x1b5467));if(_0x1b5467[_0xe8ac('0x15')]){if(_0x1b5467[_0xe8ac('0x15')]['code']===0x1f4){logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x1b5467['error'][_0xe8ac('0x16')]);return _0x5c83e1(_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);}logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);return _0x4f9233(_0x1b5467[_0xe8ac('0x15')][_0xe8ac('0x16')]);}else{logger[_0xe8ac('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x2d56f0,_0xe8ac('0x11'));_0x4f9233(_0x1b5467[_0xe8ac('0x17')]['message']);}})[_0xe8ac('0x18')](function(_0x3a7939){logger[_0xe8ac('0x15')](_0xe8ac('0x10'),_0x2d56f0,_0x3a7939);_0x5c83e1(_0x3a7939);});});}exports[_0xe8ac('0x19')]=function(_0x36759c){var _0x4892d0=this;return new Promise(function(_0x59df3d,_0x5f3433){return db[_0xe8ac('0x1a')][_0xe8ac('0x1b')]({'raw':_0x36759c['options']?_0x36759c[_0xe8ac('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x36759c[_0xe8ac('0x1c')]?_0x36759c[_0xe8ac('0x1c')]['where']||null:null,'attributes':_0x36759c[_0xe8ac('0x1c')]?_0x36759c[_0xe8ac('0x1c')][_0xe8ac('0x1d')]||null:null,'limit':_0x36759c[_0xe8ac('0x1c')]?_0x36759c['options'][_0xe8ac('0x1e')]||null:null,'include':_0x36759c['options']?_0x36759c[_0xe8ac('0x1c')][_0xe8ac('0x1f')]?_[_0xe8ac('0x20')](_0x36759c[_0xe8ac('0x1c')][_0xe8ac('0x1f')],function(_0x31956a){return{'model':db[_0x31956a[_0xe8ac('0x21')]],'as':_0x31956a['as'],'attributes':_0x31956a['attributes'],'include':_0x31956a[_0xe8ac('0x1f')]?_[_0xe8ac('0x20')](_0x31956a[_0xe8ac('0x1f')],function(_0x7c3450){return{'model':db[_0x7c3450[_0xe8ac('0x21')]],'as':_0x7c3450['as'],'attributes':_0x7c3450[_0xe8ac('0x1d')],'include':_0x7c3450[_0xe8ac('0x1f')]?_[_0xe8ac('0x20')](_0x7c3450[_0xe8ac('0x1f')],function(_0x562e44){return{'model':db[_0x562e44['model']],'as':_0x562e44['as'],'attributes':_0x562e44[_0xe8ac('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xe8ac('0x22')](function(_0x59512c){logger[_0xe8ac('0xf')](_0xe8ac('0x19'),_0x36759c);logger['debug']('GetFreshsalesAccount',_0x36759c,JSON[_0xe8ac('0x14')](_0x59512c));_0x59df3d(_0x59512c);})[_0xe8ac('0x18')](function(_0x3798c5){logger[_0xe8ac('0x15')](_0xe8ac('0x19'),_0x3798c5[_0xe8ac('0x16')],_0x36759c);_0x5f3433(_0x4892d0[_0xe8ac('0x15')](0x1f4,_0x3798c5['message']));});});};exports[_0xe8ac('0x23')]=function(_0x5459e5){var _0x2aef04=this;return new Promise(function(_0x5c4089,_0x498427){return db['FreshsalesAccount']['find']({'raw':_0x5459e5[_0xe8ac('0x1c')]?_0x5459e5[_0xe8ac('0x1c')][_0xe8ac('0x24')]===undefined?!![]:![]:!![],'where':_0x5459e5[_0xe8ac('0x1c')]?_0x5459e5[_0xe8ac('0x1c')][_0xe8ac('0x25')]||null:null,'attributes':_0x5459e5[_0xe8ac('0x1c')]?_0x5459e5['options'][_0xe8ac('0x1d')]||null:null,'include':_0x5459e5['options']?_0x5459e5['options']['include']?_[_0xe8ac('0x20')](_0x5459e5[_0xe8ac('0x1c')][_0xe8ac('0x1f')],function(_0x56feff){return{'model':db[_0x56feff['model']],'as':_0x56feff['as'],'attributes':_0x56feff[_0xe8ac('0x1d')],'include':_0x56feff[_0xe8ac('0x1f')]?_[_0xe8ac('0x20')](_0x56feff[_0xe8ac('0x1f')],function(_0x54605b){return{'model':db[_0x54605b[_0xe8ac('0x21')]],'as':_0x54605b['as'],'attributes':_0x54605b[_0xe8ac('0x1d')],'include':_0x54605b[_0xe8ac('0x1f')]?_[_0xe8ac('0x20')](_0x54605b[_0xe8ac('0x1f')],function(_0x9e5777){return{'model':db[_0x9e5777[_0xe8ac('0x21')]],'as':_0x9e5777['as'],'attributes':_0x9e5777['attributes']};}):[]};}):[]};}):[]:[]})[_0xe8ac('0x22')](function(_0x131b0b){logger['info'](_0xe8ac('0x23'),_0x5459e5);logger[_0xe8ac('0x12')](_0xe8ac('0x23'),_0x5459e5,JSON[_0xe8ac('0x14')](_0x131b0b));_0x5c4089(_0x131b0b);})['catch'](function(_0x97e206){logger['error']('ShowFreshsalesAccount',_0x97e206[_0xe8ac('0x16')],_0x5459e5);_0x498427(_0x2aef04[_0xe8ac('0x15')](0x1f4,_0x97e206[_0xe8ac('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 6ffc106..df18973 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 _0x25cc=['Router','fs-extra','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0x25cc,0xdc));var _0xc25c=function(_0x430077,_0x286ded){_0x430077=_0x430077-0x0;var _0x240768=_0x25cc[_0x430077];return _0x240768;};'use strict';var multer=require(_0xc25c('0x0'));var util=require(_0xc25c('0x1'));var path=require(_0xc25c('0x2'));var timeout=require(_0xc25c('0x3'));var express=require(_0xc25c('0x4'));var router=express[_0xc25c('0x5')]();var fs_extra=require(_0xc25c('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc25c('0x7'));var controller=require(_0xc25c('0x8'));router[_0xc25c('0x9')]('/',auth[_0xc25c('0xa')](),controller['index']);router[_0xc25c('0x9')](_0xc25c('0xb'),auth[_0xc25c('0xa')](),controller[_0xc25c('0xc')]);router[_0xc25c('0x9')](_0xc25c('0xd'),auth[_0xc25c('0xa')](),controller[_0xc25c('0xe')]);router[_0xc25c('0x9')](_0xc25c('0xf'),auth[_0xc25c('0xa')](),controller[_0xc25c('0x10')]);router[_0xc25c('0x9')](_0xc25c('0x11'),auth[_0xc25c('0xa')](),controller[_0xc25c('0x12')]);router[_0xc25c('0x13')]('/',auth[_0xc25c('0xa')](),controller['create']);router[_0xc25c('0x14')](_0xc25c('0xb'),auth[_0xc25c('0xa')](),controller[_0xc25c('0x15')]);router[_0xc25c('0x16')]('/:id',auth[_0xc25c('0xa')](),controller[_0xc25c('0x17')]);module[_0xc25c('0x18')]=router; \ No newline at end of file +var _0xa2c1=['show','/:id/subjects','getDescriptions','/:id/fields','getFields','post','create','put','update','delete','/:id','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','index','get'];(function(_0x234f28,_0x1a311c){var _0x38bcb6=function(_0x2e7739){while(--_0x2e7739){_0x234f28['push'](_0x234f28['shift']());}};_0x38bcb6(++_0x1a311c);}(_0xa2c1,0x109));var _0x1a2c=function(_0x5c59d7,_0x14cff3){_0x5c59d7=_0x5c59d7-0x0;var _0x510338=_0xa2c1[_0x5c59d7];return _0x510338;};'use strict';var multer=require(_0x1a2c('0x0'));var util=require(_0x1a2c('0x1'));var path=require('path');var timeout=require(_0x1a2c('0x2'));var express=require(_0x1a2c('0x3'));var router=express[_0x1a2c('0x4')]();var fs_extra=require(_0x1a2c('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a2c('0x6'));var controller=require(_0x1a2c('0x7'));router['get']('/',auth[_0x1a2c('0x8')](),controller[_0x1a2c('0x9')]);router[_0x1a2c('0xa')]('/:id',auth[_0x1a2c('0x8')](),controller[_0x1a2c('0xb')]);router[_0x1a2c('0xa')](_0x1a2c('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x1a2c('0x8')](),controller[_0x1a2c('0xd')]);router[_0x1a2c('0xa')](_0x1a2c('0xe'),auth[_0x1a2c('0x8')](),controller[_0x1a2c('0xf')]);router[_0x1a2c('0x10')]('/',auth['isAuthenticated'](),controller[_0x1a2c('0x11')]);router[_0x1a2c('0x12')]('/:id',auth[_0x1a2c('0x8')](),controller[_0x1a2c('0x13')]);router[_0x1a2c('0x14')](_0x1a2c('0x15'),auth['isAuthenticated'](),controller[_0x1a2c('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index c2d407b..c9bf147 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 _0x7a29=['sequelize','exports'];(function(_0x47733a,_0x1c2e18){var _0x2c985b=function(_0x510e6e){while(--_0x510e6e){_0x47733a['push'](_0x47733a['shift']());}};_0x2c985b(++_0x1c2e18);}(_0x7a29,0x190));var _0x97a2=function(_0x459acc,_0x60af18){_0x459acc=_0x459acc-0x0;var _0x3ed5db=_0x7a29[_0x459acc];return _0x3ed5db;};'use strict';var Sequelize=require(_0x97a2('0x0'));module[_0x97a2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x55f4=['sequelize','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x55f4,0x10e));var _0x455f=function(_0x34a9d9,_0x5c1cff){_0x34a9d9=_0x34a9d9-0x0;var _0x1e48cc=_0x55f4[_0x34a9d9];return _0x1e48cc;};'use strict';var Sequelize=require(_0x455f('0x0'));module[_0x455f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index d823edf..ac39782 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 _0x67a0=['then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','getFields','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update'];(function(_0x44fb8f,_0x1e2ec8){var _0x4fbc0e=function(_0x2385c6){while(--_0x2385c6){_0x44fb8f['push'](_0x44fb8f['shift']());}};_0x4fbc0e(++_0x1e2ec8);}(_0x67a0,0x7e));var _0x067a=function(_0xf2a3e6,_0x2db48b){_0xf2a3e6=_0xf2a3e6-0x0;var _0x5497a7=_0x67a0[_0xf2a3e6];return _0x5497a7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x067a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x067a('0x1'));var moment=require(_0x067a('0x2'));var BPromise=require(_0x067a('0x3'));var Mustache=require(_0x067a('0x4'));var util=require(_0x067a('0x5'));var path=require(_0x067a('0x6'));var sox=require(_0x067a('0x7'));var csv=require(_0x067a('0x8'));var ejs=require(_0x067a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x067a('0xa'));var squel=require(_0x067a('0xb'));var crypto=require(_0x067a('0xc'));var jsforce=require(_0x067a('0xd'));var deskjs=require(_0x067a('0xe'));var toCsv=require(_0x067a('0x8'));var querystring=require(_0x067a('0xf'));var Papa=require('papaparse');var Redis=require(_0x067a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x067a('0x11'));var as=require(_0x067a('0x12'));var hardwareService=require(_0x067a('0x13'));var logger=require(_0x067a('0x14'))(_0x067a('0x15'));var utils=require(_0x067a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x067a('0x17'));var db=require(_0x067a('0x18'))['db'];function respondWithStatusCode(_0x1f9650,_0x4cab33){_0x4cab33=_0x4cab33||0xcc;return function(_0x57a8d7){if(_0x57a8d7){return _0x1f9650[_0x067a('0x19')](_0x4cab33);}return _0x1f9650['status'](_0x4cab33)[_0x067a('0x1a')]();};}function respondWithResult(_0x132e05,_0x10a4b3){_0x10a4b3=_0x10a4b3||0xc8;return function(_0x2bf968){if(_0x2bf968){return _0x132e05['status'](_0x10a4b3)[_0x067a('0x1b')](_0x2bf968);}};}function respondWithFilteredResult(_0x50ca38,_0x100317){return function(_0x11d75a){if(_0x11d75a){var _0x470bbd=typeof _0x100317[_0x067a('0x1c')]===_0x067a('0x1d')&&typeof _0x100317[_0x067a('0x1e')]===_0x067a('0x1d');var _0x19977e=_0x11d75a['count'];var _0xf7984c=_0x470bbd?0x0:_0x100317['offset'];var _0x759117=_0x470bbd?_0x11d75a[_0x067a('0x1f')]:_0x100317[_0x067a('0x1c')]+_0x100317[_0x067a('0x1e')];var _0x279057;if(_0x759117>=_0x19977e){_0x759117=_0x19977e;_0x279057=0xc8;}else{_0x279057=0xce;}_0x50ca38[_0x067a('0x20')](_0x279057);return _0x50ca38[_0x067a('0x21')](_0x067a('0x22'),_0xf7984c+'-'+_0x759117+'/'+_0x19977e)[_0x067a('0x1b')](_0x11d75a);}return null;};}function patchUpdates(_0x4ff29e){return function(_0x242a77){try{jsonpatch[_0x067a('0x23')](_0x242a77,_0x4ff29e,!![]);}catch(_0x42aa1c){return BPromise[_0x067a('0x24')](_0x42aa1c);}return _0x242a77['save']();};}function saveUpdates(_0x44efab,_0xe0df0f){return function(_0x4a9318){if(_0x4a9318){return _0x4a9318[_0x067a('0x25')](_0x44efab)[_0x067a('0x26')](function(_0xee8c4a){return _0xee8c4a;});}return null;};}function removeEntity(_0x408fb3,_0x2d48b7){return function(_0x1c2df0){if(_0x1c2df0){return _0x1c2df0[_0x067a('0x27')]()[_0x067a('0x26')](function(){_0x408fb3[_0x067a('0x20')](0xcc)[_0x067a('0x1a')]();});}};}function handleEntityNotFound(_0x20a02e,_0x39f5ec){return function(_0x1df23f){if(!_0x1df23f){_0x20a02e['sendStatus'](0x194);}return _0x1df23f;};}function handleError(_0x59798c,_0x9acff6){_0x9acff6=_0x9acff6||0x1f4;return function(_0xb2c47a){logger[_0x067a('0x28')](_0xb2c47a[_0x067a('0x29')]);if(_0xb2c47a[_0x067a('0x2a')]){delete _0xb2c47a[_0x067a('0x2a')];}_0x59798c['status'](_0x9acff6)[_0x067a('0x2b')](_0xb2c47a);};}exports[_0x067a('0x2c')]=function(_0x54b20c,_0x1c08a6){var _0x32a13f={},_0x13d839={},_0x20f7c5={'count':0x0,'rows':[]};var _0x3f41fa=_[_0x067a('0x2d')](db[_0x067a('0x2e')][_0x067a('0x2f')],function(_0x1c700d){return{'name':_0x1c700d[_0x067a('0x30')],'type':_0x1c700d['type'][_0x067a('0x31')]};});_0x13d839[_0x067a('0x32')]=_[_0x067a('0x2d')](_0x3f41fa,_0x067a('0x2a'));_0x13d839[_0x067a('0x33')]=_['keys'](_0x54b20c[_0x067a('0x33')]);_0x13d839[_0x067a('0x34')]=_[_0x067a('0x35')](_0x13d839[_0x067a('0x32')],_0x13d839['query']);_0x32a13f['attributes']=_[_0x067a('0x35')](_0x13d839[_0x067a('0x32')],qs[_0x067a('0x36')](_0x54b20c[_0x067a('0x33')]['fields']));_0x32a13f[_0x067a('0x37')]=_0x32a13f[_0x067a('0x37')][_0x067a('0x38')]?_0x32a13f[_0x067a('0x37')]:_0x13d839[_0x067a('0x32')];if(!_0x54b20c[_0x067a('0x33')]['hasOwnProperty'](_0x067a('0x39'))){_0x32a13f[_0x067a('0x1e')]=qs[_0x067a('0x1e')](_0x54b20c[_0x067a('0x33')][_0x067a('0x1e')]);_0x32a13f[_0x067a('0x1c')]=qs[_0x067a('0x1c')](_0x54b20c['query']['offset']);}_0x32a13f[_0x067a('0x3a')]=qs[_0x067a('0x3b')](_0x54b20c[_0x067a('0x33')][_0x067a('0x3b')]);_0x32a13f[_0x067a('0x3c')]=qs[_0x067a('0x34')](_[_0x067a('0x3d')](_0x54b20c[_0x067a('0x33')],_0x13d839[_0x067a('0x34')]),_0x3f41fa);if(_0x54b20c['query'][_0x067a('0x3e')]){_0x32a13f[_0x067a('0x3c')]=_[_0x067a('0x3f')](_0x32a13f['where'],{'$or':_[_0x067a('0x2d')](_0x3f41fa,function(_0x593859){if(_0x593859['type']!==_0x067a('0x40')){var _0x2b3456={};_0x2b3456[_0x593859['name']]={'$like':'%'+_0x54b20c[_0x067a('0x33')][_0x067a('0x3e')]+'%'};return _0x2b3456;}})});}_0x32a13f=_['merge']({},_0x32a13f,_0x54b20c[_0x067a('0x41')]);var _0x4dcc55={'where':_0x32a13f[_0x067a('0x3c')]};return db[_0x067a('0x2e')][_0x067a('0x1f')](_0x4dcc55)[_0x067a('0x26')](function(_0x4cb589){_0x20f7c5[_0x067a('0x1f')]=_0x4cb589;if(_0x54b20c[_0x067a('0x33')][_0x067a('0x42')]){_0x32a13f[_0x067a('0x43')]=[{'all':!![]}];}return db[_0x067a('0x2e')][_0x067a('0x44')](_0x32a13f);})[_0x067a('0x26')](function(_0x433e46){_0x20f7c5[_0x067a('0x45')]=_0x433e46;return _0x20f7c5;})[_0x067a('0x26')](respondWithFilteredResult(_0x1c08a6,_0x32a13f))['catch'](handleError(_0x1c08a6,null));};exports['show']=function(_0x30389c,_0x4439c6){var _0x16f901={'raw':![],'where':{'id':_0x30389c[_0x067a('0x46')]['id']}},_0x445269={};_0x445269[_0x067a('0x32')]=_['keys'](db[_0x067a('0x2e')]['rawAttributes']);_0x445269[_0x067a('0x33')]=_[_0x067a('0x47')](_0x30389c[_0x067a('0x33')]);_0x445269[_0x067a('0x34')]=_[_0x067a('0x35')](_0x445269[_0x067a('0x32')],_0x445269[_0x067a('0x33')]);_0x16f901[_0x067a('0x37')]=_['intersection'](_0x445269[_0x067a('0x32')],qs[_0x067a('0x36')](_0x30389c[_0x067a('0x33')][_0x067a('0x36')]));_0x16f901[_0x067a('0x37')]=_0x16f901[_0x067a('0x37')][_0x067a('0x38')]?_0x16f901[_0x067a('0x37')]:_0x445269['model'];if(_0x30389c[_0x067a('0x33')][_0x067a('0x42')]){_0x16f901['include']=[{'all':!![]}];}_0x16f901=_['merge']({},_0x16f901,_0x30389c['options']);return db[_0x067a('0x2e')][_0x067a('0x48')](_0x16f901)['then'](handleEntityNotFound(_0x4439c6,null))[_0x067a('0x26')](respondWithResult(_0x4439c6,null))[_0x067a('0x49')](handleError(_0x4439c6,null));};exports[_0x067a('0x4a')]=function(_0x541102,_0x55cff6){return db[_0x067a('0x2e')][_0x067a('0x4a')](_0x541102[_0x067a('0x4b')],{})[_0x067a('0x26')](respondWithResult(_0x55cff6,0xc9))[_0x067a('0x49')](handleError(_0x55cff6,null));};exports[_0x067a('0x25')]=function(_0x3acd5e,_0x5814be){if(_0x3acd5e[_0x067a('0x4b')]['id']){delete _0x3acd5e[_0x067a('0x4b')]['id'];}return db['FreshsalesConfiguration'][_0x067a('0x48')]({'where':{'id':_0x3acd5e[_0x067a('0x46')]['id']}})[_0x067a('0x26')](handleEntityNotFound(_0x5814be,null))[_0x067a('0x26')](saveUpdates(_0x3acd5e[_0x067a('0x4b')],null))[_0x067a('0x26')](respondWithResult(_0x5814be,null))[_0x067a('0x49')](handleError(_0x5814be,null));};exports[_0x067a('0x27')]=function(_0x2893ff,_0x213873){return db[_0x067a('0x2e')][_0x067a('0x48')]({'where':{'id':_0x2893ff[_0x067a('0x46')]['id']}})['then'](handleEntityNotFound(_0x213873,null))['then'](removeEntity(_0x213873,null))['catch'](handleError(_0x213873,null));};exports[_0x067a('0x4c')]=function(_0x2f7d4c,_0x3b76ba,_0x30169e){var _0x42d4b4={};var _0x51d5fc={};var _0x213bd4;var _0x24790c;return db['FreshsalesConfiguration'][_0x067a('0x4d')]({'where':{'id':_0x2f7d4c[_0x067a('0x46')]['id']}})[_0x067a('0x26')](handleEntityNotFound(_0x3b76ba,null))[_0x067a('0x26')](function(_0x85ecab){if(_0x85ecab){_0x213bd4=_0x85ecab;_0x51d5fc[_0x067a('0x32')]=_[_0x067a('0x47')](db[_0x067a('0x4e')][_0x067a('0x2f')]);_0x51d5fc[_0x067a('0x33')]=_['keys'](_0x2f7d4c[_0x067a('0x33')]);_0x51d5fc['filters']=_[_0x067a('0x35')](_0x51d5fc[_0x067a('0x32')],_0x51d5fc['query']);_0x42d4b4[_0x067a('0x37')]=_[_0x067a('0x35')](_0x51d5fc['model'],qs['fields'](_0x2f7d4c['query']['fields']));_0x42d4b4[_0x067a('0x37')]=_0x42d4b4[_0x067a('0x37')]['length']?_0x42d4b4['attributes']:_0x51d5fc[_0x067a('0x32')];_0x42d4b4['order']=qs[_0x067a('0x3b')](_0x2f7d4c[_0x067a('0x33')][_0x067a('0x3b')]);_0x42d4b4[_0x067a('0x3c')]=qs[_0x067a('0x34')](_[_0x067a('0x3d')](_0x2f7d4c['query'],_0x51d5fc[_0x067a('0x34')]));if(_0x2f7d4c['query'][_0x067a('0x3e')]){_0x42d4b4[_0x067a('0x3c')]=_[_0x067a('0x3f')](_0x42d4b4[_0x067a('0x3c')],{'$or':_['map'](_0x42d4b4[_0x067a('0x37')],function(_0x27fe34){var _0x402da4={};_0x402da4[_0x27fe34]={'$like':'%'+_0x2f7d4c[_0x067a('0x33')][_0x067a('0x3e')]+'%'};return _0x402da4;})});}_0x42d4b4=_['merge']({},_0x42d4b4,_0x2f7d4c['options']);return _0x213bd4[_0x067a('0x4c')](_0x42d4b4);}})['then'](function(_0x1426fe){if(_0x1426fe){_0x24790c=_0x1426fe[_0x067a('0x38')];if(!_0x2f7d4c[_0x067a('0x33')][_0x067a('0x4f')](_0x067a('0x39'))){_0x42d4b4[_0x067a('0x1e')]=qs[_0x067a('0x1e')](_0x2f7d4c[_0x067a('0x33')]['limit']);_0x42d4b4[_0x067a('0x1c')]=qs[_0x067a('0x1c')](_0x2f7d4c[_0x067a('0x33')]['offset']);}return _0x213bd4[_0x067a('0x4c')](_0x42d4b4);}})[_0x067a('0x26')](function(_0x4273bd){if(_0x4273bd){return _0x4273bd?{'count':_0x24790c,'rows':_0x4273bd}:null;}})['then'](respondWithResult(_0x3b76ba,null))[_0x067a('0x49')](handleError(_0x3b76ba,null));};exports[_0x067a('0x50')]=function(_0x2cc206,_0x34ba50,_0x23ba73){var _0x200a35={};var _0x2c41d7={};var _0x3500ec;var _0x1034b0;return db[_0x067a('0x2e')][_0x067a('0x4d')]({'where':{'id':_0x2cc206[_0x067a('0x46')]['id']}})[_0x067a('0x26')](handleEntityNotFound(_0x34ba50,null))[_0x067a('0x26')](function(_0x1300a1){if(_0x1300a1){_0x3500ec=_0x1300a1;_0x2c41d7[_0x067a('0x32')]=_[_0x067a('0x47')](db[_0x067a('0x4e')][_0x067a('0x2f')]);_0x2c41d7['query']=_[_0x067a('0x47')](_0x2cc206['query']);_0x2c41d7[_0x067a('0x34')]=_[_0x067a('0x35')](_0x2c41d7[_0x067a('0x32')],_0x2c41d7[_0x067a('0x33')]);_0x200a35[_0x067a('0x37')]=_['intersection'](_0x2c41d7[_0x067a('0x32')],qs[_0x067a('0x36')](_0x2cc206['query'][_0x067a('0x36')]));_0x200a35[_0x067a('0x37')]=_0x200a35[_0x067a('0x37')]['length']?_0x200a35[_0x067a('0x37')]:_0x2c41d7[_0x067a('0x32')];_0x200a35[_0x067a('0x3a')]=qs[_0x067a('0x3b')](_0x2cc206[_0x067a('0x33')][_0x067a('0x3b')]);_0x200a35[_0x067a('0x3c')]=qs[_0x067a('0x34')](_[_0x067a('0x3d')](_0x2cc206[_0x067a('0x33')],_0x2c41d7['filters']));if(_0x2cc206[_0x067a('0x33')][_0x067a('0x3e')]){_0x200a35[_0x067a('0x3c')]=_[_0x067a('0x3f')](_0x200a35[_0x067a('0x3c')],{'$or':_['map'](_0x200a35[_0x067a('0x37')],function(_0x39bfe3){var _0x29a842={};_0x29a842[_0x39bfe3]={'$like':'%'+_0x2cc206[_0x067a('0x33')][_0x067a('0x3e')]+'%'};return _0x29a842;})});}_0x200a35=_[_0x067a('0x3f')]({},_0x200a35,_0x2cc206['options']);return _0x3500ec[_0x067a('0x50')](_0x200a35);}})[_0x067a('0x26')](function(_0x1b1d12){if(_0x1b1d12){_0x1034b0=_0x1b1d12[_0x067a('0x38')];if(!_0x2cc206[_0x067a('0x33')][_0x067a('0x4f')](_0x067a('0x39'))){_0x200a35[_0x067a('0x1e')]=qs[_0x067a('0x1e')](_0x2cc206['query'][_0x067a('0x1e')]);_0x200a35[_0x067a('0x1c')]=qs['offset'](_0x2cc206[_0x067a('0x33')][_0x067a('0x1c')]);}return _0x3500ec[_0x067a('0x50')](_0x200a35);}})[_0x067a('0x26')](function(_0xcf72fb){if(_0xcf72fb){return _0xcf72fb?{'count':_0x1034b0,'rows':_0xcf72fb}:null;}})[_0x067a('0x26')](respondWithResult(_0x34ba50,null))[_0x067a('0x49')](handleError(_0x34ba50,null));};exports[_0x067a('0x51')]=function(_0x5a73c1,_0x35a3c1,_0x389a59){var _0x5916ff={};var _0x3a74d1={};var _0x4efce1;var _0x4f8725;return db['FreshsalesConfiguration'][_0x067a('0x4d')]({'where':{'id':_0x5a73c1['params']['id']}})['then'](handleEntityNotFound(_0x35a3c1,null))[_0x067a('0x26')](function(_0x22d54f){if(_0x22d54f){_0x4efce1=_0x22d54f;_0x3a74d1[_0x067a('0x32')]=_[_0x067a('0x47')](db[_0x067a('0x4e')]['rawAttributes']);_0x3a74d1[_0x067a('0x33')]=_['keys'](_0x5a73c1['query']);_0x3a74d1[_0x067a('0x34')]=_[_0x067a('0x35')](_0x3a74d1[_0x067a('0x32')],_0x3a74d1['query']);_0x5916ff[_0x067a('0x37')]=_[_0x067a('0x35')](_0x3a74d1['model'],qs['fields'](_0x5a73c1[_0x067a('0x33')][_0x067a('0x36')]));_0x5916ff[_0x067a('0x37')]=_0x5916ff[_0x067a('0x37')][_0x067a('0x38')]?_0x5916ff[_0x067a('0x37')]:_0x3a74d1['model'];_0x5916ff['order']=qs[_0x067a('0x3b')](_0x5a73c1[_0x067a('0x33')][_0x067a('0x3b')]);_0x5916ff[_0x067a('0x3c')]=qs[_0x067a('0x34')](_[_0x067a('0x3d')](_0x5a73c1['query'],_0x3a74d1[_0x067a('0x34')]));if(_0x5a73c1[_0x067a('0x33')][_0x067a('0x3e')]){_0x5916ff['where']=_[_0x067a('0x3f')](_0x5916ff[_0x067a('0x3c')],{'$or':_[_0x067a('0x2d')](_0x5916ff['attributes'],function(_0x11335e){var _0x487b84={};_0x487b84[_0x11335e]={'$like':'%'+_0x5a73c1[_0x067a('0x33')][_0x067a('0x3e')]+'%'};return _0x487b84;})});}_0x5916ff=_[_0x067a('0x3f')]({},_0x5916ff,_0x5a73c1[_0x067a('0x41')]);return _0x4efce1[_0x067a('0x51')](_0x5916ff);}})[_0x067a('0x26')](function(_0x413697){if(_0x413697){_0x4f8725=_0x413697[_0x067a('0x38')];if(!_0x5a73c1[_0x067a('0x33')]['hasOwnProperty'](_0x067a('0x39'))){_0x5916ff['limit']=qs[_0x067a('0x1e')](_0x5a73c1['query'][_0x067a('0x1e')]);_0x5916ff[_0x067a('0x1c')]=qs['offset'](_0x5a73c1[_0x067a('0x33')][_0x067a('0x1c')]);}return _0x4efce1['getFields'](_0x5916ff);}})[_0x067a('0x26')](function(_0x4e3733){if(_0x4e3733){return _0x4e3733?{'count':_0x4f8725,'rows':_0x4e3733}:null;}})[_0x067a('0x26')](respondWithResult(_0x35a3c1,null))[_0x067a('0x49')](handleError(_0x35a3c1,null));}; \ No newline at end of file +var _0xad6d=['undefined','limit','count','Content-Range','apply','save','update','destroy','then','sendStatus','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','findOne','FreshsalesField','order','pick','getSubjects','hasOwnProperty','getDescriptions','getFields','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','status','json','offset'];(function(_0x3c1ab5,_0x581d7f){var _0x4e0dd1=function(_0x4dfc01){while(--_0x4dfc01){_0x3c1ab5['push'](_0x3c1ab5['shift']());}};_0x4e0dd1(++_0x581d7f);}(_0xad6d,0x17d));var _0xdad6=function(_0x55a3c2,_0x3b79be){_0x55a3c2=_0x55a3c2-0x0;var _0x1484c7=_0xad6d[_0x55a3c2];return _0x1484c7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdad6('0x0'));var zipdir=require(_0xdad6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdad6('0x2'));var moment=require(_0xdad6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdad6('0x4'));var util=require(_0xdad6('0x5'));var path=require(_0xdad6('0x6'));var sox=require(_0xdad6('0x7'));var csv=require(_0xdad6('0x8'));var ejs=require(_0xdad6('0x9'));var fs=require('fs');var fs_extra=require(_0xdad6('0xa'));var _=require(_0xdad6('0xb'));var squel=require('squel');var crypto=require(_0xdad6('0xc'));var jsforce=require(_0xdad6('0xd'));var deskjs=require(_0xdad6('0xe'));var toCsv=require(_0xdad6('0x8'));var querystring=require(_0xdad6('0xf'));var Papa=require('papaparse');var Redis=require(_0xdad6('0x10'));var authService=require(_0xdad6('0x11'));var qs=require(_0xdad6('0x12'));var as=require(_0xdad6('0x13'));var hardwareService=require(_0xdad6('0x14'));var logger=require(_0xdad6('0x15'))(_0xdad6('0x16'));var utils=require('../../config/utils');var config=require(_0xdad6('0x17'));var licenseUtil=require(_0xdad6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58aa62,_0x160e6b){_0x160e6b=_0x160e6b||0xcc;return function(_0x5d1ed9){if(_0x5d1ed9){return _0x58aa62['sendStatus'](_0x160e6b);}return _0x58aa62['status'](_0x160e6b)[_0xdad6('0x19')]();};}function respondWithResult(_0x7baa36,_0x463372){_0x463372=_0x463372||0xc8;return function(_0x2b146b){if(_0x2b146b){return _0x7baa36[_0xdad6('0x1a')](_0x463372)[_0xdad6('0x1b')](_0x2b146b);}};}function respondWithFilteredResult(_0x31b417,_0xebf7d2){return function(_0x102b91){if(_0x102b91){var _0x571884=typeof _0xebf7d2[_0xdad6('0x1c')]===_0xdad6('0x1d')&&typeof _0xebf7d2[_0xdad6('0x1e')]===_0xdad6('0x1d');var _0x503d0c=_0x102b91[_0xdad6('0x1f')];var _0x24e332=_0x571884?0x0:_0xebf7d2[_0xdad6('0x1c')];var _0x232940=_0x571884?_0x102b91[_0xdad6('0x1f')]:_0xebf7d2[_0xdad6('0x1c')]+_0xebf7d2[_0xdad6('0x1e')];var _0x4a190f;if(_0x232940>=_0x503d0c){_0x232940=_0x503d0c;_0x4a190f=0xc8;}else{_0x4a190f=0xce;}_0x31b417['status'](_0x4a190f);return _0x31b417['set'](_0xdad6('0x20'),_0x24e332+'-'+_0x232940+'/'+_0x503d0c)[_0xdad6('0x1b')](_0x102b91);}return null;};}function patchUpdates(_0x200593){return function(_0x20a3a0){try{jsonpatch[_0xdad6('0x21')](_0x20a3a0,_0x200593,!![]);}catch(_0x39b74c){return BPromise['reject'](_0x39b74c);}return _0x20a3a0[_0xdad6('0x22')]();};}function saveUpdates(_0x56eca5,_0x3321bb){return function(_0x165c49){if(_0x165c49){return _0x165c49[_0xdad6('0x23')](_0x56eca5)['then'](function(_0xdf2587){return _0xdf2587;});}return null;};}function removeEntity(_0x67db7b,_0x36f9cb){return function(_0x2432e4){if(_0x2432e4){return _0x2432e4[_0xdad6('0x24')]()[_0xdad6('0x25')](function(){_0x67db7b[_0xdad6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x467eac,_0x2d6a58){return function(_0x376764){if(!_0x376764){_0x467eac[_0xdad6('0x26')](0x194);}return _0x376764;};}function handleError(_0x104898,_0x78e350){_0x78e350=_0x78e350||0x1f4;return function(_0x4f083d){logger['error'](_0x4f083d[_0xdad6('0x27')]);if(_0x4f083d[_0xdad6('0x28')]){delete _0x4f083d[_0xdad6('0x28')];}_0x104898[_0xdad6('0x1a')](_0x78e350)[_0xdad6('0x29')](_0x4f083d);};}exports[_0xdad6('0x2a')]=function(_0x41fa05,_0x51831a){var _0x5d36a2={},_0x496029={},_0x336548={'count':0x0,'rows':[]};var _0x4b64f5=_[_0xdad6('0x2b')](db[_0xdad6('0x2c')][_0xdad6('0x2d')],function(_0x58e96c){return{'name':_0x58e96c[_0xdad6('0x2e')],'type':_0x58e96c['type'][_0xdad6('0x2f')]};});_0x496029[_0xdad6('0x30')]=_[_0xdad6('0x2b')](_0x4b64f5,_0xdad6('0x28'));_0x496029[_0xdad6('0x31')]=_[_0xdad6('0x32')](_0x41fa05[_0xdad6('0x31')]);_0x496029[_0xdad6('0x33')]=_[_0xdad6('0x34')](_0x496029[_0xdad6('0x30')],_0x496029[_0xdad6('0x31')]);_0x5d36a2['attributes']=_[_0xdad6('0x34')](_0x496029['model'],qs[_0xdad6('0x35')](_0x41fa05['query'][_0xdad6('0x35')]));_0x5d36a2[_0xdad6('0x36')]=_0x5d36a2[_0xdad6('0x36')]['length']?_0x5d36a2[_0xdad6('0x36')]:_0x496029[_0xdad6('0x30')];if(!_0x41fa05[_0xdad6('0x31')]['hasOwnProperty'](_0xdad6('0x37'))){_0x5d36a2[_0xdad6('0x1e')]=qs[_0xdad6('0x1e')](_0x41fa05[_0xdad6('0x31')][_0xdad6('0x1e')]);_0x5d36a2[_0xdad6('0x1c')]=qs[_0xdad6('0x1c')](_0x41fa05[_0xdad6('0x31')][_0xdad6('0x1c')]);}_0x5d36a2['order']=qs['sort'](_0x41fa05[_0xdad6('0x31')][_0xdad6('0x38')]);_0x5d36a2[_0xdad6('0x39')]=qs['filters'](_['pick'](_0x41fa05[_0xdad6('0x31')],_0x496029['filters']),_0x4b64f5);if(_0x41fa05[_0xdad6('0x31')][_0xdad6('0x3a')]){_0x5d36a2['where']=_[_0xdad6('0x3b')](_0x5d36a2[_0xdad6('0x39')],{'$or':_[_0xdad6('0x2b')](_0x4b64f5,function(_0x761587){if(_0x761587[_0xdad6('0x3c')]!==_0xdad6('0x3d')){var _0x35242d={};_0x35242d[_0x761587[_0xdad6('0x28')]]={'$like':'%'+_0x41fa05[_0xdad6('0x31')]['filter']+'%'};return _0x35242d;}})});}_0x5d36a2=_[_0xdad6('0x3b')]({},_0x5d36a2,_0x41fa05[_0xdad6('0x3e')]);var _0xa1149c={'where':_0x5d36a2[_0xdad6('0x39')]};return db[_0xdad6('0x2c')]['count'](_0xa1149c)[_0xdad6('0x25')](function(_0x418b2c){_0x336548['count']=_0x418b2c;if(_0x41fa05[_0xdad6('0x31')][_0xdad6('0x3f')]){_0x5d36a2[_0xdad6('0x40')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xdad6('0x41')](_0x5d36a2);})[_0xdad6('0x25')](function(_0x490d20){_0x336548[_0xdad6('0x42')]=_0x490d20;return _0x336548;})[_0xdad6('0x25')](respondWithFilteredResult(_0x51831a,_0x5d36a2))[_0xdad6('0x43')](handleError(_0x51831a,null));};exports[_0xdad6('0x44')]=function(_0x42945a,_0x3e0ffe){var _0x724dc8={'raw':![],'where':{'id':_0x42945a[_0xdad6('0x45')]['id']}},_0x843a66={};_0x843a66[_0xdad6('0x30')]=_[_0xdad6('0x32')](db[_0xdad6('0x2c')]['rawAttributes']);_0x843a66[_0xdad6('0x31')]=_[_0xdad6('0x32')](_0x42945a[_0xdad6('0x31')]);_0x843a66['filters']=_[_0xdad6('0x34')](_0x843a66['model'],_0x843a66[_0xdad6('0x31')]);_0x724dc8['attributes']=_[_0xdad6('0x34')](_0x843a66[_0xdad6('0x30')],qs[_0xdad6('0x35')](_0x42945a[_0xdad6('0x31')][_0xdad6('0x35')]));_0x724dc8[_0xdad6('0x36')]=_0x724dc8[_0xdad6('0x36')][_0xdad6('0x46')]?_0x724dc8['attributes']:_0x843a66[_0xdad6('0x30')];if(_0x42945a[_0xdad6('0x31')][_0xdad6('0x3f')]){_0x724dc8[_0xdad6('0x40')]=[{'all':!![]}];}_0x724dc8=_[_0xdad6('0x3b')]({},_0x724dc8,_0x42945a[_0xdad6('0x3e')]);return db[_0xdad6('0x2c')][_0xdad6('0x47')](_0x724dc8)[_0xdad6('0x25')](handleEntityNotFound(_0x3e0ffe,null))['then'](respondWithResult(_0x3e0ffe,null))['catch'](handleError(_0x3e0ffe,null));};exports[_0xdad6('0x48')]=function(_0x1dd144,_0x271111){return db[_0xdad6('0x2c')][_0xdad6('0x48')](_0x1dd144[_0xdad6('0x49')],{})[_0xdad6('0x25')](respondWithResult(_0x271111,0xc9))['catch'](handleError(_0x271111,null));};exports['update']=function(_0x2e7aed,_0x1e17b4){if(_0x2e7aed['body']['id']){delete _0x2e7aed['body']['id'];}return db[_0xdad6('0x2c')]['find']({'where':{'id':_0x2e7aed[_0xdad6('0x45')]['id']}})[_0xdad6('0x25')](handleEntityNotFound(_0x1e17b4,null))['then'](saveUpdates(_0x2e7aed[_0xdad6('0x49')],null))[_0xdad6('0x25')](respondWithResult(_0x1e17b4,null))[_0xdad6('0x43')](handleError(_0x1e17b4,null));};exports[_0xdad6('0x24')]=function(_0x155c7a,_0x3ab46f){return db[_0xdad6('0x2c')]['find']({'where':{'id':_0x155c7a['params']['id']}})[_0xdad6('0x25')](handleEntityNotFound(_0x3ab46f,null))[_0xdad6('0x25')](removeEntity(_0x3ab46f,null))[_0xdad6('0x43')](handleError(_0x3ab46f,null));};exports['getSubjects']=function(_0x297131,_0x1ac7bf,_0x5e9855){var _0x484341={};var _0x10e0fd={};var _0x1fe911;var _0x320427;return db['FreshsalesConfiguration'][_0xdad6('0x4a')]({'where':{'id':_0x297131[_0xdad6('0x45')]['id']}})[_0xdad6('0x25')](handleEntityNotFound(_0x1ac7bf,null))['then'](function(_0x20b0dc){if(_0x20b0dc){_0x1fe911=_0x20b0dc;_0x10e0fd['model']=_[_0xdad6('0x32')](db[_0xdad6('0x4b')][_0xdad6('0x2d')]);_0x10e0fd[_0xdad6('0x31')]=_['keys'](_0x297131['query']);_0x10e0fd[_0xdad6('0x33')]=_[_0xdad6('0x34')](_0x10e0fd[_0xdad6('0x30')],_0x10e0fd['query']);_0x484341[_0xdad6('0x36')]=_[_0xdad6('0x34')](_0x10e0fd['model'],qs[_0xdad6('0x35')](_0x297131[_0xdad6('0x31')][_0xdad6('0x35')]));_0x484341[_0xdad6('0x36')]=_0x484341[_0xdad6('0x36')][_0xdad6('0x46')]?_0x484341[_0xdad6('0x36')]:_0x10e0fd[_0xdad6('0x30')];_0x484341[_0xdad6('0x4c')]=qs[_0xdad6('0x38')](_0x297131['query']['sort']);_0x484341[_0xdad6('0x39')]=qs['filters'](_[_0xdad6('0x4d')](_0x297131[_0xdad6('0x31')],_0x10e0fd[_0xdad6('0x33')]));if(_0x297131[_0xdad6('0x31')][_0xdad6('0x3a')]){_0x484341[_0xdad6('0x39')]=_[_0xdad6('0x3b')](_0x484341['where'],{'$or':_[_0xdad6('0x2b')](_0x484341['attributes'],function(_0x3f16ea){var _0x4d91a7={};_0x4d91a7[_0x3f16ea]={'$like':'%'+_0x297131[_0xdad6('0x31')][_0xdad6('0x3a')]+'%'};return _0x4d91a7;})});}_0x484341=_[_0xdad6('0x3b')]({},_0x484341,_0x297131[_0xdad6('0x3e')]);return _0x1fe911[_0xdad6('0x4e')](_0x484341);}})[_0xdad6('0x25')](function(_0x1e9a7f){if(_0x1e9a7f){_0x320427=_0x1e9a7f[_0xdad6('0x46')];if(!_0x297131['query'][_0xdad6('0x4f')](_0xdad6('0x37'))){_0x484341['limit']=qs[_0xdad6('0x1e')](_0x297131[_0xdad6('0x31')][_0xdad6('0x1e')]);_0x484341[_0xdad6('0x1c')]=qs[_0xdad6('0x1c')](_0x297131['query']['offset']);}return _0x1fe911[_0xdad6('0x4e')](_0x484341);}})[_0xdad6('0x25')](function(_0x46ba47){if(_0x46ba47){return _0x46ba47?{'count':_0x320427,'rows':_0x46ba47}:null;}})['then'](respondWithResult(_0x1ac7bf,null))[_0xdad6('0x43')](handleError(_0x1ac7bf,null));};exports[_0xdad6('0x50')]=function(_0x26a40d,_0x3ee18d,_0x439b70){var _0x3a8817={};var _0x3d52e3={};var _0x206cc4;var _0x3ceb43;return db[_0xdad6('0x2c')][_0xdad6('0x4a')]({'where':{'id':_0x26a40d[_0xdad6('0x45')]['id']}})[_0xdad6('0x25')](handleEntityNotFound(_0x3ee18d,null))[_0xdad6('0x25')](function(_0x3627f4){if(_0x3627f4){_0x206cc4=_0x3627f4;_0x3d52e3[_0xdad6('0x30')]=_[_0xdad6('0x32')](db['FreshsalesField'][_0xdad6('0x2d')]);_0x3d52e3['query']=_[_0xdad6('0x32')](_0x26a40d[_0xdad6('0x31')]);_0x3d52e3[_0xdad6('0x33')]=_[_0xdad6('0x34')](_0x3d52e3[_0xdad6('0x30')],_0x3d52e3[_0xdad6('0x31')]);_0x3a8817[_0xdad6('0x36')]=_[_0xdad6('0x34')](_0x3d52e3[_0xdad6('0x30')],qs[_0xdad6('0x35')](_0x26a40d[_0xdad6('0x31')][_0xdad6('0x35')]));_0x3a8817['attributes']=_0x3a8817['attributes'][_0xdad6('0x46')]?_0x3a8817[_0xdad6('0x36')]:_0x3d52e3[_0xdad6('0x30')];_0x3a8817[_0xdad6('0x4c')]=qs[_0xdad6('0x38')](_0x26a40d[_0xdad6('0x31')][_0xdad6('0x38')]);_0x3a8817[_0xdad6('0x39')]=qs[_0xdad6('0x33')](_[_0xdad6('0x4d')](_0x26a40d[_0xdad6('0x31')],_0x3d52e3[_0xdad6('0x33')]));if(_0x26a40d[_0xdad6('0x31')][_0xdad6('0x3a')]){_0x3a8817[_0xdad6('0x39')]=_[_0xdad6('0x3b')](_0x3a8817[_0xdad6('0x39')],{'$or':_[_0xdad6('0x2b')](_0x3a8817['attributes'],function(_0x8204b){var _0x3686f5={};_0x3686f5[_0x8204b]={'$like':'%'+_0x26a40d[_0xdad6('0x31')][_0xdad6('0x3a')]+'%'};return _0x3686f5;})});}_0x3a8817=_[_0xdad6('0x3b')]({},_0x3a8817,_0x26a40d['options']);return _0x206cc4[_0xdad6('0x50')](_0x3a8817);}})[_0xdad6('0x25')](function(_0x43502d){if(_0x43502d){_0x3ceb43=_0x43502d[_0xdad6('0x46')];if(!_0x26a40d['query'][_0xdad6('0x4f')](_0xdad6('0x37'))){_0x3a8817[_0xdad6('0x1e')]=qs[_0xdad6('0x1e')](_0x26a40d[_0xdad6('0x31')][_0xdad6('0x1e')]);_0x3a8817[_0xdad6('0x1c')]=qs[_0xdad6('0x1c')](_0x26a40d[_0xdad6('0x31')][_0xdad6('0x1c')]);}return _0x206cc4[_0xdad6('0x50')](_0x3a8817);}})['then'](function(_0x2166ca){if(_0x2166ca){return _0x2166ca?{'count':_0x3ceb43,'rows':_0x2166ca}:null;}})[_0xdad6('0x25')](respondWithResult(_0x3ee18d,null))[_0xdad6('0x43')](handleError(_0x3ee18d,null));};exports[_0xdad6('0x51')]=function(_0x546f80,_0x372265,_0x5864fe){var _0x3801f5={};var _0x2a9eb7={};var _0x8d0194;var _0xf4b1a6;return db[_0xdad6('0x2c')][_0xdad6('0x4a')]({'where':{'id':_0x546f80[_0xdad6('0x45')]['id']}})[_0xdad6('0x25')](handleEntityNotFound(_0x372265,null))['then'](function(_0x1310c3){if(_0x1310c3){_0x8d0194=_0x1310c3;_0x2a9eb7[_0xdad6('0x30')]=_[_0xdad6('0x32')](db['FreshsalesField']['rawAttributes']);_0x2a9eb7[_0xdad6('0x31')]=_[_0xdad6('0x32')](_0x546f80[_0xdad6('0x31')]);_0x2a9eb7[_0xdad6('0x33')]=_['intersection'](_0x2a9eb7[_0xdad6('0x30')],_0x2a9eb7[_0xdad6('0x31')]);_0x3801f5[_0xdad6('0x36')]=_[_0xdad6('0x34')](_0x2a9eb7[_0xdad6('0x30')],qs[_0xdad6('0x35')](_0x546f80['query']['fields']));_0x3801f5[_0xdad6('0x36')]=_0x3801f5[_0xdad6('0x36')][_0xdad6('0x46')]?_0x3801f5[_0xdad6('0x36')]:_0x2a9eb7[_0xdad6('0x30')];_0x3801f5[_0xdad6('0x4c')]=qs[_0xdad6('0x38')](_0x546f80[_0xdad6('0x31')][_0xdad6('0x38')]);_0x3801f5['where']=qs[_0xdad6('0x33')](_[_0xdad6('0x4d')](_0x546f80[_0xdad6('0x31')],_0x2a9eb7[_0xdad6('0x33')]));if(_0x546f80[_0xdad6('0x31')]['filter']){_0x3801f5[_0xdad6('0x39')]=_[_0xdad6('0x3b')](_0x3801f5[_0xdad6('0x39')],{'$or':_[_0xdad6('0x2b')](_0x3801f5[_0xdad6('0x36')],function(_0x3f7814){var _0x45dea2={};_0x45dea2[_0x3f7814]={'$like':'%'+_0x546f80[_0xdad6('0x31')][_0xdad6('0x3a')]+'%'};return _0x45dea2;})});}_0x3801f5=_[_0xdad6('0x3b')]({},_0x3801f5,_0x546f80[_0xdad6('0x3e')]);return _0x8d0194[_0xdad6('0x51')](_0x3801f5);}})[_0xdad6('0x25')](function(_0x3c7986){if(_0x3c7986){_0xf4b1a6=_0x3c7986[_0xdad6('0x46')];if(!_0x546f80['query'][_0xdad6('0x4f')]('nolimit')){_0x3801f5[_0xdad6('0x1e')]=qs[_0xdad6('0x1e')](_0x546f80['query'][_0xdad6('0x1e')]);_0x3801f5['offset']=qs[_0xdad6('0x1c')](_0x546f80[_0xdad6('0x31')][_0xdad6('0x1c')]);}return _0x8d0194['getFields'](_0x3801f5);}})[_0xdad6('0x25')](function(_0x537b92){if(_0x537b92){return _0x537b92?{'count':_0xf4b1a6,'rows':_0x537b92}:null;}})[_0xdad6('0x25')](respondWithResult(_0x372265,null))[_0xdad6('0x43')](handleError(_0x372265,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 922b280..f350beb 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 _0x0b02=['path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x10f8e8,_0x57865b){var _0x6699c6=function(_0xd4716d){while(--_0xd4716d){_0x10f8e8['push'](_0x10f8e8['shift']());}};_0x6699c6(++_0x57865b);}(_0x0b02,0x14c));var _0x20b0=function(_0x3ae95d,_0x3398e6){_0x3ae95d=_0x3ae95d-0x0;var _0x3435d1=_0x0b02[_0x3ae95d];return _0x3435d1;};'use strict';var _=require('lodash');var util=require(_0x20b0('0x0'));var logger=require(_0x20b0('0x1'))(_0x20b0('0x2'));var moment=require(_0x20b0('0x3'));var BPromise=require(_0x20b0('0x4'));var rp=require(_0x20b0('0x5'));var fs=require('fs');var path=require(_0x20b0('0x6'));var rimraf=require(_0x20b0('0x7'));var config=require(_0x20b0('0x8'));var attributes=require(_0x20b0('0x9'));module['exports']=function(_0x1c7f68,_0x17ecdf){return _0x1c7f68[_0x20b0('0xa')](_0x20b0('0xb'),attributes,{'tableName':_0x20b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fda=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x43aef2,_0x487abb){var _0x315116=function(_0x3dd7ae){while(--_0x3dd7ae){_0x43aef2['push'](_0x43aef2['shift']());}};_0x315116(++_0x487abb);}(_0x5fda,0x19d));var _0xa5fd=function(_0x323bf6,_0x19aed6){_0x323bf6=_0x323bf6-0x0;var _0x18da88=_0x5fda[_0x323bf6];return _0x18da88;};'use strict';var _=require(_0xa5fd('0x0'));var util=require(_0xa5fd('0x1'));var logger=require(_0xa5fd('0x2'))(_0xa5fd('0x3'));var moment=require(_0xa5fd('0x4'));var BPromise=require('bluebird');var rp=require(_0xa5fd('0x5'));var fs=require('fs');var path=require(_0xa5fd('0x6'));var rimraf=require(_0xa5fd('0x7'));var config=require(_0xa5fd('0x8'));var attributes=require(_0xa5fd('0x9'));module[_0xa5fd('0xa')]=function(_0x1fcef5,_0x230dbb){return _0x1fcef5[_0xa5fd('0xb')](_0xa5fd('0xc'),attributes,{'tableName':_0xa5fd('0xd'),'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 b765b4c..218ee81 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 _0x6058=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x68696,_0x2aef59){var _0x29d9b5=function(_0xbf7e8b){while(--_0xbf7e8b){_0x68696['push'](_0x68696['shift']());}};_0x29d9b5(++_0x2aef59);}(_0x6058,0x1ba));var _0x8605=function(_0x240362,_0x156794){_0x240362=_0x240362-0x0;var _0x26de18=_0x6058[_0x240362];return _0x26de18;};'use strict';var _=require(_0x8605('0x0'));var util=require(_0x8605('0x1'));var moment=require(_0x8605('0x2'));var BPromise=require(_0x8605('0x3'));var rs=require(_0x8605('0x4'));var fs=require('fs');var Redis=require(_0x8605('0x5'));var db=require(_0x8605('0x6'))['db'];var utils=require(_0x8605('0x7'));var logger=require(_0x8605('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8605('0x9'));var client=jayson[_0x8605('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x412d37,_0x2dd909,_0x4a7c54){return new BPromise(function(_0x414e7e,_0x32b950){return client[_0x8605('0xb')](_0x412d37,_0x4a7c54)[_0x8605('0xc')](function(_0xa233cf){logger[_0x8605('0xd')](_0x8605('0xe'),_0x2dd909,_0x8605('0xf'));logger['debug'](_0x8605('0x10'),_0x2dd909,_0x8605('0xf'),JSON[_0x8605('0x11')](_0xa233cf));if(_0xa233cf[_0x8605('0x12')]){if(_0xa233cf[_0x8605('0x12')][_0x8605('0x13')]===0x1f4){logger[_0x8605('0x12')](_0x8605('0xe'),_0x2dd909,_0xa233cf[_0x8605('0x12')]['message']);return _0x32b950(_0xa233cf[_0x8605('0x12')][_0x8605('0x14')]);}logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x2dd909,_0xa233cf['error'][_0x8605('0x14')]);return _0x414e7e(_0xa233cf[_0x8605('0x12')][_0x8605('0x14')]);}else{logger['info']('FreshsalesConfiguration,\x20%s,\x20%s',_0x2dd909,'request\x20sent');_0x414e7e(_0xa233cf[_0x8605('0x15')][_0x8605('0x14')]);}})[_0x8605('0x16')](function(_0x134a3f){logger[_0x8605('0x12')](_0x8605('0xe'),_0x2dd909,_0x134a3f);_0x32b950(_0x134a3f);});});} \ No newline at end of file +var _0x9b9d=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','then','FreshsalesConfiguration,\x20%s,\x20%s','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x5c9865,_0x1a299a){var _0x54c22b=function(_0x538537){while(--_0x538537){_0x5c9865['push'](_0x5c9865['shift']());}};_0x54c22b(++_0x1a299a);}(_0x9b9d,0x163));var _0xd9b9=function(_0x4e79ea,_0x2852cd){_0x4e79ea=_0x4e79ea-0x0;var _0x13ef80=_0x9b9d[_0x4e79ea];return _0x13ef80;};'use strict';var _=require(_0xd9b9('0x0'));var util=require(_0xd9b9('0x1'));var moment=require('moment');var BPromise=require(_0xd9b9('0x2'));var rs=require(_0xd9b9('0x3'));var fs=require('fs');var Redis=require(_0xd9b9('0x4'));var db=require(_0xd9b9('0x5'))['db'];var utils=require(_0xd9b9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd9b9('0x7'));var jayson=require(_0xd9b9('0x8'));var client=jayson['client'][_0xd9b9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa86168,_0x5aa87b,_0x584c8c){return new BPromise(function(_0x1e0ae3,_0x373ea1){return client['request'](_0xa86168,_0x584c8c)[_0xd9b9('0xa')](function(_0x158b18){logger['info'](_0xd9b9('0xb'),_0x5aa87b,'request\x20sent');logger['debug'](_0xd9b9('0xc'),_0x5aa87b,_0xd9b9('0xd'),JSON['stringify'](_0x158b18));if(_0x158b18[_0xd9b9('0xe')]){if(_0x158b18['error'][_0xd9b9('0xf')]===0x1f4){logger[_0xd9b9('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5aa87b,_0x158b18[_0xd9b9('0xe')][_0xd9b9('0x10')]);return _0x373ea1(_0x158b18[_0xd9b9('0xe')][_0xd9b9('0x10')]);}logger[_0xd9b9('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5aa87b,_0x158b18[_0xd9b9('0xe')][_0xd9b9('0x10')]);return _0x1e0ae3(_0x158b18[_0xd9b9('0xe')][_0xd9b9('0x10')]);}else{logger[_0xd9b9('0x11')](_0xd9b9('0xb'),_0x5aa87b,_0xd9b9('0xd'));_0x1e0ae3(_0x158b18[_0xd9b9('0x12')][_0xd9b9('0x10')]);}})[_0xd9b9('0x13')](function(_0x9301d0){logger[_0xd9b9('0xe')](_0xd9b9('0xb'),_0x5aa87b,_0x9301d0);_0x373ea1(_0x9301d0);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index c97dae9..99002d7 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 _0x6282=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x46f3f8,_0x12c74b){var _0xbc57cd=function(_0x34df37){while(--_0x34df37){_0x46f3f8['push'](_0x46f3f8['shift']());}};_0xbc57cd(++_0x12c74b);}(_0x6282,0x76));var _0x2628=function(_0x5bfdbb,_0xefba86){_0x5bfdbb=_0x5bfdbb-0x0;var _0x16cf9a=_0x6282[_0x5bfdbb];return _0x16cf9a;};'use strict';var multer=require(_0x2628('0x0'));var util=require(_0x2628('0x1'));var path=require(_0x2628('0x2'));var timeout=require(_0x2628('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2628('0x4'));var auth=require(_0x2628('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2628('0x6'));var controller=require(_0x2628('0x7'));router[_0x2628('0x8')]('/',auth[_0x2628('0x9')](),controller[_0x2628('0xa')]);router['get'](_0x2628('0xb'),auth[_0x2628('0x9')](),controller[_0x2628('0xc')]);router[_0x2628('0xd')]('/',auth[_0x2628('0x9')](),controller[_0x2628('0xe')]);router[_0x2628('0xf')](_0x2628('0xb'),auth[_0x2628('0x9')](),controller[_0x2628('0x10')]);router[_0x2628('0x11')](_0x2628('0xb'),auth[_0x2628('0x9')](),controller[_0x2628('0x12')]);module[_0x2628('0x13')]=router; \ No newline at end of file +var _0xcb18=['/:id','update','delete','destroy','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','isAuthenticated','post','put'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xcb18,0x159));var _0x8cb1=function(_0x2d0081,_0x1a0b2b){_0x2d0081=_0x2d0081-0x0;var _0x35ffa9=_0xcb18[_0x2d0081];return _0x35ffa9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8cb1('0x0'));var timeout=require('connect-timeout');var express=require(_0x8cb1('0x1'));var router=express['Router']();var fs_extra=require(_0x8cb1('0x2'));var auth=require(_0x8cb1('0x3'));var interaction=require(_0x8cb1('0x4'));var config=require(_0x8cb1('0x5'));var controller=require(_0x8cb1('0x6'));router[_0x8cb1('0x7')]('/',auth['isAuthenticated'](),controller[_0x8cb1('0x8')]);router[_0x8cb1('0x7')]('/:id',auth[_0x8cb1('0x9')](),controller['show']);router[_0x8cb1('0xa')]('/',auth[_0x8cb1('0x9')](),controller['create']);router[_0x8cb1('0xb')](_0x8cb1('0xc'),auth[_0x8cb1('0x9')](),controller[_0x8cb1('0xd')]);router[_0x8cb1('0xe')]('/:id',auth[_0x8cb1('0x9')](),controller[_0x8cb1('0xf')]);module[_0x8cb1('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 3f8d92a..c13e889 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 _0x11dd=['picklist','STRING','string','sequelize','ENUM','variable','customVariable','keyValue'];(function(_0x34213c,_0x1aeb61){var _0x158ab5=function(_0x41029d){while(--_0x41029d){_0x34213c['push'](_0x34213c['shift']());}};_0x158ab5(++_0x1aeb61);}(_0x11dd,0x133));var _0xd11d=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0x11dd[_0x557fd2];return _0x1b54a2;};'use strict';var Sequelize=require(_0xd11d('0x0'));module['exports']={'type':{'type':Sequelize[_0xd11d('0x1')]('string',_0xd11d('0x2'),_0xd11d('0x3'),_0xd11d('0x4'),_0xd11d('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd11d('0x6')]},'key':{'type':Sequelize[_0xd11d('0x6')]},'keyType':{'type':Sequelize[_0xd11d('0x1')](_0xd11d('0x7'),_0xd11d('0x2'),_0xd11d('0x3'))},'keyContent':{'type':Sequelize[_0xd11d('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd11d('0x6')]}}; \ No newline at end of file +var _0xf626=['string','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x2ff178,_0x4a324b){var _0xe39f0c=function(_0x48257e){while(--_0x48257e){_0x2ff178['push'](_0x2ff178['shift']());}};_0xe39f0c(++_0x4a324b);}(_0xf626,0xed));var _0x6f62=function(_0x161f03,_0x5d141b){_0x161f03=_0x161f03-0x0;var _0x2f396f=_0xf626[_0x161f03];return _0x2f396f;};'use strict';var Sequelize=require(_0x6f62('0x0'));module[_0x6f62('0x1')]={'type':{'type':Sequelize[_0x6f62('0x2')](_0x6f62('0x3'),'variable','customVariable',_0x6f62('0x4'),_0x6f62('0x5')),'defaultValue':_0x6f62('0x3')},'content':{'type':Sequelize[_0x6f62('0x6')]},'key':{'type':Sequelize[_0x6f62('0x6')]},'keyType':{'type':Sequelize[_0x6f62('0x2')](_0x6f62('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x6f62('0x6')]},'idField':{'type':Sequelize[_0x6f62('0x6')]},'nameField':{'type':Sequelize[_0x6f62('0x6')]},'customField':{'type':Sequelize[_0x6f62('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 0f16dfe..b0f089f 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 _0x8c18=['undefined','limit','count','offset','json','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','FreshsalesField','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x1ab27e,_0x224d5a){var _0x31318f=function(_0x5068f6){while(--_0x5068f6){_0x1ab27e['push'](_0x1ab27e['shift']());}};_0x31318f(++_0x224d5a);}(_0x8c18,0x163));var _0x88c1=function(_0xb5c445,_0x50f56d){_0xb5c445=_0xb5c445-0x0;var _0x339d67=_0x8c18[_0xb5c445];return _0x339d67;};'use strict';var emlformat=require(_0x88c1('0x0'));var rimraf=require(_0x88c1('0x1'));var zipdir=require(_0x88c1('0x2'));var jsonpatch=require(_0x88c1('0x3'));var rp=require(_0x88c1('0x4'));var moment=require(_0x88c1('0x5'));var BPromise=require(_0x88c1('0x6'));var Mustache=require(_0x88c1('0x7'));var util=require(_0x88c1('0x8'));var path=require('path');var sox=require(_0x88c1('0x9'));var csv=require(_0x88c1('0xa'));var ejs=require(_0x88c1('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x88c1('0xc'));var squel=require(_0x88c1('0xd'));var crypto=require(_0x88c1('0xe'));var jsforce=require(_0x88c1('0xf'));var deskjs=require(_0x88c1('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x88c1('0x11'));var authService=require(_0x88c1('0x12'));var qs=require(_0x88c1('0x13'));var as=require(_0x88c1('0x14'));var hardwareService=require(_0x88c1('0x15'));var logger=require(_0x88c1('0x16'))(_0x88c1('0x17'));var utils=require(_0x88c1('0x18'));var config=require(_0x88c1('0x19'));var licenseUtil=require(_0x88c1('0x1a'));var db=require(_0x88c1('0x1b'))['db'];function respondWithStatusCode(_0x501676,_0x212472){_0x212472=_0x212472||0xcc;return function(_0x47b867){if(_0x47b867){return _0x501676['sendStatus'](_0x212472);}return _0x501676[_0x88c1('0x1c')](_0x212472)[_0x88c1('0x1d')]();};}function respondWithResult(_0x56098c,_0x405510){_0x405510=_0x405510||0xc8;return function(_0x573b58){if(_0x573b58){return _0x56098c['status'](_0x405510)['json'](_0x573b58);}};}function respondWithFilteredResult(_0x20370e,_0x145f3a){return function(_0x152f6e){if(_0x152f6e){var _0x5d7679=typeof _0x145f3a['offset']===_0x88c1('0x1e')&&typeof _0x145f3a[_0x88c1('0x1f')]===_0x88c1('0x1e');var _0x55b9cf=_0x152f6e[_0x88c1('0x20')];var _0x29fdfd=_0x5d7679?0x0:_0x145f3a['offset'];var _0x2ec881=_0x5d7679?_0x152f6e[_0x88c1('0x20')]:_0x145f3a[_0x88c1('0x21')]+_0x145f3a[_0x88c1('0x1f')];var _0x19062b;if(_0x2ec881>=_0x55b9cf){_0x2ec881=_0x55b9cf;_0x19062b=0xc8;}else{_0x19062b=0xce;}_0x20370e[_0x88c1('0x1c')](_0x19062b);return _0x20370e['set']('Content-Range',_0x29fdfd+'-'+_0x2ec881+'/'+_0x55b9cf)[_0x88c1('0x22')](_0x152f6e);}return null;};}function patchUpdates(_0x4a3e02){return function(_0x2ecfbc){try{jsonpatch[_0x88c1('0x23')](_0x2ecfbc,_0x4a3e02,!![]);}catch(_0x32a85f){return BPromise[_0x88c1('0x24')](_0x32a85f);}return _0x2ecfbc[_0x88c1('0x25')]();};}function saveUpdates(_0x44fad7,_0x402775){return function(_0x176a66){if(_0x176a66){return _0x176a66[_0x88c1('0x26')](_0x44fad7)['then'](function(_0x17d0fb){return _0x17d0fb;});}return null;};}function removeEntity(_0x223655,_0x1ebb78){return function(_0x4a65ee){if(_0x4a65ee){return _0x4a65ee[_0x88c1('0x27')]()[_0x88c1('0x28')](function(){_0x223655[_0x88c1('0x1c')](0xcc)[_0x88c1('0x1d')]();});}};}function handleEntityNotFound(_0x1c2d63,_0x574eb9){return function(_0x144fce){if(!_0x144fce){_0x1c2d63[_0x88c1('0x29')](0x194);}return _0x144fce;};}function handleError(_0x24e576,_0x385a7a){_0x385a7a=_0x385a7a||0x1f4;return function(_0x2ceafe){logger['error'](_0x2ceafe[_0x88c1('0x2a')]);if(_0x2ceafe[_0x88c1('0x2b')]){delete _0x2ceafe[_0x88c1('0x2b')];}_0x24e576[_0x88c1('0x1c')](_0x385a7a)[_0x88c1('0x2c')](_0x2ceafe);};}exports[_0x88c1('0x2d')]=function(_0x55191c,_0x16a79c){var _0x2ebadc={},_0x1b1a24={},_0x22b381={'count':0x0,'rows':[]};var _0x411f9f=_[_0x88c1('0x2e')](db['FreshsalesField'][_0x88c1('0x2f')],function(_0x4c89bb){return{'name':_0x4c89bb[_0x88c1('0x30')],'type':_0x4c89bb[_0x88c1('0x31')][_0x88c1('0x32')]};});_0x1b1a24['model']=_[_0x88c1('0x2e')](_0x411f9f,_0x88c1('0x2b'));_0x1b1a24['query']=_['keys'](_0x55191c[_0x88c1('0x33')]);_0x1b1a24[_0x88c1('0x34')]=_[_0x88c1('0x35')](_0x1b1a24[_0x88c1('0x36')],_0x1b1a24[_0x88c1('0x33')]);_0x2ebadc[_0x88c1('0x37')]=_[_0x88c1('0x35')](_0x1b1a24[_0x88c1('0x36')],qs[_0x88c1('0x38')](_0x55191c[_0x88c1('0x33')][_0x88c1('0x38')]));_0x2ebadc[_0x88c1('0x37')]=_0x2ebadc[_0x88c1('0x37')][_0x88c1('0x39')]?_0x2ebadc[_0x88c1('0x37')]:_0x1b1a24['model'];if(!_0x55191c[_0x88c1('0x33')]['hasOwnProperty'](_0x88c1('0x3a'))){_0x2ebadc[_0x88c1('0x1f')]=qs[_0x88c1('0x1f')](_0x55191c[_0x88c1('0x33')]['limit']);_0x2ebadc[_0x88c1('0x21')]=qs[_0x88c1('0x21')](_0x55191c[_0x88c1('0x33')][_0x88c1('0x21')]);}_0x2ebadc[_0x88c1('0x3b')]=qs['sort'](_0x55191c[_0x88c1('0x33')][_0x88c1('0x3c')]);_0x2ebadc[_0x88c1('0x3d')]=qs[_0x88c1('0x34')](_[_0x88c1('0x3e')](_0x55191c[_0x88c1('0x33')],_0x1b1a24[_0x88c1('0x34')]),_0x411f9f);if(_0x55191c[_0x88c1('0x33')][_0x88c1('0x3f')]){_0x2ebadc[_0x88c1('0x3d')]=_[_0x88c1('0x40')](_0x2ebadc[_0x88c1('0x3d')],{'$or':_[_0x88c1('0x2e')](_0x411f9f,function(_0x5009a1){if(_0x5009a1[_0x88c1('0x31')]!=='VIRTUAL'){var _0x3ea682={};_0x3ea682[_0x5009a1[_0x88c1('0x2b')]]={'$like':'%'+_0x55191c[_0x88c1('0x33')][_0x88c1('0x3f')]+'%'};return _0x3ea682;}})});}_0x2ebadc=_[_0x88c1('0x40')]({},_0x2ebadc,_0x55191c[_0x88c1('0x41')]);var _0x129dca={'where':_0x2ebadc['where']};return db[_0x88c1('0x42')]['count'](_0x129dca)[_0x88c1('0x28')](function(_0x1d9456){_0x22b381[_0x88c1('0x20')]=_0x1d9456;if(_0x55191c['query'][_0x88c1('0x43')]){_0x2ebadc[_0x88c1('0x44')]=[{'all':!![]}];}return db[_0x88c1('0x42')][_0x88c1('0x45')](_0x2ebadc);})[_0x88c1('0x28')](function(_0x4e85ce){_0x22b381[_0x88c1('0x46')]=_0x4e85ce;return _0x22b381;})[_0x88c1('0x28')](respondWithFilteredResult(_0x16a79c,_0x2ebadc))[_0x88c1('0x47')](handleError(_0x16a79c,null));};exports[_0x88c1('0x48')]=function(_0x232c97,_0x2c8502){var _0x54e4c2={'raw':!![],'where':{'id':_0x232c97['params']['id']}},_0xe30d89={};_0xe30d89[_0x88c1('0x36')]=_['keys'](db['FreshsalesField'][_0x88c1('0x2f')]);_0xe30d89['query']=_['keys'](_0x232c97['query']);_0xe30d89[_0x88c1('0x34')]=_[_0x88c1('0x35')](_0xe30d89[_0x88c1('0x36')],_0xe30d89[_0x88c1('0x33')]);_0x54e4c2[_0x88c1('0x37')]=_[_0x88c1('0x35')](_0xe30d89['model'],qs[_0x88c1('0x38')](_0x232c97['query'][_0x88c1('0x38')]));_0x54e4c2[_0x88c1('0x37')]=_0x54e4c2[_0x88c1('0x37')][_0x88c1('0x39')]?_0x54e4c2[_0x88c1('0x37')]:_0xe30d89['model'];if(_0x232c97[_0x88c1('0x33')][_0x88c1('0x43')]){_0x54e4c2[_0x88c1('0x44')]=[{'all':!![]}];}_0x54e4c2=_[_0x88c1('0x40')]({},_0x54e4c2,_0x232c97['options']);return db['FreshsalesField'][_0x88c1('0x49')](_0x54e4c2)[_0x88c1('0x28')](handleEntityNotFound(_0x2c8502,null))[_0x88c1('0x28')](respondWithResult(_0x2c8502,null))['catch'](handleError(_0x2c8502,null));};exports[_0x88c1('0x4a')]=function(_0x3f7d6d,_0x4c4dba){return db[_0x88c1('0x42')][_0x88c1('0x4a')](_0x3f7d6d[_0x88c1('0x4b')],{})[_0x88c1('0x28')](respondWithResult(_0x4c4dba,0xc9))['catch'](handleError(_0x4c4dba,null));};exports[_0x88c1('0x26')]=function(_0x182fef,_0x1b72ed){if(_0x182fef[_0x88c1('0x4b')]['id']){delete _0x182fef[_0x88c1('0x4b')]['id'];}return db[_0x88c1('0x42')]['find']({'where':{'id':_0x182fef[_0x88c1('0x4c')]['id']}})[_0x88c1('0x28')](handleEntityNotFound(_0x1b72ed,null))[_0x88c1('0x28')](saveUpdates(_0x182fef[_0x88c1('0x4b')],null))[_0x88c1('0x28')](respondWithResult(_0x1b72ed,null))[_0x88c1('0x47')](handleError(_0x1b72ed,null));};exports[_0x88c1('0x27')]=function(_0x35b8c6,_0x4a8465){return db['FreshsalesField'][_0x88c1('0x49')]({'where':{'id':_0x35b8c6[_0x88c1('0x4c')]['id']}})[_0x88c1('0x28')](handleEntityNotFound(_0x4a8465,null))[_0x88c1('0x28')](removeEntity(_0x4a8465,null))['catch'](handleError(_0x4a8465,null));}; \ No newline at end of file +var _0x8b8c=['send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','where','pick','filter','VIRTUAL','options','count','includeAll','include','rows','catch','show','length','merge','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','set','Content-Range','reject','update','destroy','then','error','stack','name'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8b8c,0xf3));var _0xc8b8=function(_0xb0885d,_0x407259){_0xb0885d=_0xb0885d-0x0;var _0x175474=_0x8b8c[_0xb0885d];return _0x175474;};'use strict';var emlformat=require(_0xc8b8('0x0'));var rimraf=require(_0xc8b8('0x1'));var zipdir=require(_0xc8b8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc8b8('0x3'));var moment=require(_0xc8b8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc8b8('0x5'));var util=require('util');var path=require(_0xc8b8('0x6'));var sox=require(_0xc8b8('0x7'));var csv=require(_0xc8b8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc8b8('0x9'));var _=require('lodash');var squel=require(_0xc8b8('0xa'));var crypto=require(_0xc8b8('0xb'));var jsforce=require(_0xc8b8('0xc'));var deskjs=require(_0xc8b8('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc8b8('0xe'));var Redis=require('ioredis');var authService=require(_0xc8b8('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc8b8('0x10'));var logger=require(_0xc8b8('0x11'))('api');var utils=require(_0xc8b8('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc8b8('0x13'));var db=require(_0xc8b8('0x14'))['db'];function respondWithStatusCode(_0x2a0e3a,_0x59268e){_0x59268e=_0x59268e||0xcc;return function(_0xf51681){if(_0xf51681){return _0x2a0e3a[_0xc8b8('0x15')](_0x59268e);}return _0x2a0e3a['status'](_0x59268e)[_0xc8b8('0x16')]();};}function respondWithResult(_0x5743f4,_0x21df0f){_0x21df0f=_0x21df0f||0xc8;return function(_0x13ad99){if(_0x13ad99){return _0x5743f4[_0xc8b8('0x17')](_0x21df0f)[_0xc8b8('0x18')](_0x13ad99);}};}function respondWithFilteredResult(_0x4187cb,_0x4ab5ef){return function(_0x2a6704){if(_0x2a6704){var _0x486a8c=typeof _0x4ab5ef[_0xc8b8('0x19')]==='undefined'&&typeof _0x4ab5ef[_0xc8b8('0x1a')]===_0xc8b8('0x1b');var _0x5c987a=_0x2a6704['count'];var _0x4bf8ff=_0x486a8c?0x0:_0x4ab5ef[_0xc8b8('0x19')];var _0x56b98e=_0x486a8c?_0x2a6704['count']:_0x4ab5ef[_0xc8b8('0x19')]+_0x4ab5ef[_0xc8b8('0x1a')];var _0x33fd20;if(_0x56b98e>=_0x5c987a){_0x56b98e=_0x5c987a;_0x33fd20=0xc8;}else{_0x33fd20=0xce;}_0x4187cb[_0xc8b8('0x17')](_0x33fd20);return _0x4187cb[_0xc8b8('0x1c')](_0xc8b8('0x1d'),_0x4bf8ff+'-'+_0x56b98e+'/'+_0x5c987a)[_0xc8b8('0x18')](_0x2a6704);}return null;};}function patchUpdates(_0x250eba){return function(_0x539a21){try{jsonpatch['apply'](_0x539a21,_0x250eba,!![]);}catch(_0x192507){return BPromise[_0xc8b8('0x1e')](_0x192507);}return _0x539a21['save']();};}function saveUpdates(_0x236b33,_0xaea429){return function(_0x31903f){if(_0x31903f){return _0x31903f[_0xc8b8('0x1f')](_0x236b33)['then'](function(_0xe64b37){return _0xe64b37;});}return null;};}function removeEntity(_0x2dae2c,_0x2144e6){return function(_0x5ead09){if(_0x5ead09){return _0x5ead09[_0xc8b8('0x20')]()[_0xc8b8('0x21')](function(){_0x2dae2c[_0xc8b8('0x17')](0xcc)[_0xc8b8('0x16')]();});}};}function handleEntityNotFound(_0x394255,_0x307465){return function(_0xd5bd9c){if(!_0xd5bd9c){_0x394255[_0xc8b8('0x15')](0x194);}return _0xd5bd9c;};}function handleError(_0x3408f3,_0xc076f9){_0xc076f9=_0xc076f9||0x1f4;return function(_0x1fbc12){logger[_0xc8b8('0x22')](_0x1fbc12[_0xc8b8('0x23')]);if(_0x1fbc12[_0xc8b8('0x24')]){delete _0x1fbc12['name'];}_0x3408f3[_0xc8b8('0x17')](_0xc076f9)[_0xc8b8('0x25')](_0x1fbc12);};}exports[_0xc8b8('0x26')]=function(_0x374f9a,_0x3204e0){var _0x24773c={},_0x3129a7={},_0x177175={'count':0x0,'rows':[]};var _0x3d3209=_[_0xc8b8('0x27')](db[_0xc8b8('0x28')][_0xc8b8('0x29')],function(_0x54447a){return{'name':_0x54447a[_0xc8b8('0x2a')],'type':_0x54447a[_0xc8b8('0x2b')][_0xc8b8('0x2c')]};});_0x3129a7[_0xc8b8('0x2d')]=_[_0xc8b8('0x27')](_0x3d3209,_0xc8b8('0x24'));_0x3129a7[_0xc8b8('0x2e')]=_[_0xc8b8('0x2f')](_0x374f9a['query']);_0x3129a7[_0xc8b8('0x30')]=_['intersection'](_0x3129a7['model'],_0x3129a7['query']);_0x24773c['attributes']=_[_0xc8b8('0x31')](_0x3129a7['model'],qs[_0xc8b8('0x32')](_0x374f9a[_0xc8b8('0x2e')][_0xc8b8('0x32')]));_0x24773c[_0xc8b8('0x33')]=_0x24773c[_0xc8b8('0x33')]['length']?_0x24773c['attributes']:_0x3129a7[_0xc8b8('0x2d')];if(!_0x374f9a[_0xc8b8('0x2e')][_0xc8b8('0x34')]('nolimit')){_0x24773c[_0xc8b8('0x1a')]=qs[_0xc8b8('0x1a')](_0x374f9a[_0xc8b8('0x2e')]['limit']);_0x24773c[_0xc8b8('0x19')]=qs['offset'](_0x374f9a[_0xc8b8('0x2e')][_0xc8b8('0x19')]);}_0x24773c['order']=qs['sort'](_0x374f9a[_0xc8b8('0x2e')]['sort']);_0x24773c[_0xc8b8('0x35')]=qs[_0xc8b8('0x30')](_[_0xc8b8('0x36')](_0x374f9a[_0xc8b8('0x2e')],_0x3129a7[_0xc8b8('0x30')]),_0x3d3209);if(_0x374f9a[_0xc8b8('0x2e')][_0xc8b8('0x37')]){_0x24773c[_0xc8b8('0x35')]=_['merge'](_0x24773c['where'],{'$or':_['map'](_0x3d3209,function(_0x4ef97d){if(_0x4ef97d[_0xc8b8('0x2b')]!==_0xc8b8('0x38')){var _0x555c11={};_0x555c11[_0x4ef97d['name']]={'$like':'%'+_0x374f9a[_0xc8b8('0x2e')][_0xc8b8('0x37')]+'%'};return _0x555c11;}})});}_0x24773c=_['merge']({},_0x24773c,_0x374f9a[_0xc8b8('0x39')]);var _0x40df47={'where':_0x24773c[_0xc8b8('0x35')]};return db['FreshsalesField'][_0xc8b8('0x3a')](_0x40df47)[_0xc8b8('0x21')](function(_0x57d5bd){_0x177175[_0xc8b8('0x3a')]=_0x57d5bd;if(_0x374f9a[_0xc8b8('0x2e')][_0xc8b8('0x3b')]){_0x24773c[_0xc8b8('0x3c')]=[{'all':!![]}];}return db[_0xc8b8('0x28')]['findAll'](_0x24773c);})[_0xc8b8('0x21')](function(_0x5ed7a7){_0x177175[_0xc8b8('0x3d')]=_0x5ed7a7;return _0x177175;})[_0xc8b8('0x21')](respondWithFilteredResult(_0x3204e0,_0x24773c))[_0xc8b8('0x3e')](handleError(_0x3204e0,null));};exports[_0xc8b8('0x3f')]=function(_0x38b670,_0x3c7324){var _0x4e9dda={'raw':!![],'where':{'id':_0x38b670['params']['id']}},_0x2ae9d5={};_0x2ae9d5[_0xc8b8('0x2d')]=_[_0xc8b8('0x2f')](db[_0xc8b8('0x28')][_0xc8b8('0x29')]);_0x2ae9d5[_0xc8b8('0x2e')]=_[_0xc8b8('0x2f')](_0x38b670[_0xc8b8('0x2e')]);_0x2ae9d5[_0xc8b8('0x30')]=_[_0xc8b8('0x31')](_0x2ae9d5[_0xc8b8('0x2d')],_0x2ae9d5[_0xc8b8('0x2e')]);_0x4e9dda['attributes']=_['intersection'](_0x2ae9d5['model'],qs[_0xc8b8('0x32')](_0x38b670[_0xc8b8('0x2e')][_0xc8b8('0x32')]));_0x4e9dda[_0xc8b8('0x33')]=_0x4e9dda[_0xc8b8('0x33')][_0xc8b8('0x40')]?_0x4e9dda[_0xc8b8('0x33')]:_0x2ae9d5['model'];if(_0x38b670[_0xc8b8('0x2e')][_0xc8b8('0x3b')]){_0x4e9dda['include']=[{'all':!![]}];}_0x4e9dda=_[_0xc8b8('0x41')]({},_0x4e9dda,_0x38b670[_0xc8b8('0x39')]);return db[_0xc8b8('0x28')][_0xc8b8('0x42')](_0x4e9dda)[_0xc8b8('0x21')](handleEntityNotFound(_0x3c7324,null))['then'](respondWithResult(_0x3c7324,null))[_0xc8b8('0x3e')](handleError(_0x3c7324,null));};exports[_0xc8b8('0x43')]=function(_0x425c95,_0x500b04){return db[_0xc8b8('0x28')]['create'](_0x425c95[_0xc8b8('0x44')],{})['then'](respondWithResult(_0x500b04,0xc9))[_0xc8b8('0x3e')](handleError(_0x500b04,null));};exports[_0xc8b8('0x1f')]=function(_0x2a0434,_0x4fd0ec){if(_0x2a0434[_0xc8b8('0x44')]['id']){delete _0x2a0434[_0xc8b8('0x44')]['id'];}return db[_0xc8b8('0x28')][_0xc8b8('0x42')]({'where':{'id':_0x2a0434[_0xc8b8('0x45')]['id']}})[_0xc8b8('0x21')](handleEntityNotFound(_0x4fd0ec,null))[_0xc8b8('0x21')](saveUpdates(_0x2a0434[_0xc8b8('0x44')],null))[_0xc8b8('0x21')](respondWithResult(_0x4fd0ec,null))[_0xc8b8('0x3e')](handleError(_0x4fd0ec,null));};exports[_0xc8b8('0x20')]=function(_0x45b6a7,_0x4b3fe8){return db[_0xc8b8('0x28')][_0xc8b8('0x42')]({'where':{'id':_0x45b6a7[_0xc8b8('0x45')]['id']}})[_0xc8b8('0x21')](handleEntityNotFound(_0x4b3fe8,null))[_0xc8b8('0x21')](removeEntity(_0x4b3fe8,null))['catch'](handleError(_0x4b3fe8,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 689bf0e..debb1b6 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 _0xd943=['api','bluebird','request-promise','path','rimraf','../../config/environment','int_freshsales_fields','freshsales_unique_index','lodash','util','../../config/logger'];(function(_0x4f75d3,_0x1016c9){var _0x3688e6=function(_0x1607e7){while(--_0x1607e7){_0x4f75d3['push'](_0x4f75d3['shift']());}};_0x3688e6(++_0x1016c9);}(_0xd943,0x15d));var _0x3d94=function(_0x1de2fa,_0x701bf){_0x1de2fa=_0x1de2fa-0x0;var _0x6a79e5=_0xd943[_0x1de2fa];return _0x6a79e5;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var logger=require(_0x3d94('0x2'))(_0x3d94('0x3'));var moment=require('moment');var BPromise=require(_0x3d94('0x4'));var rp=require(_0x3d94('0x5'));var fs=require('fs');var path=require(_0x3d94('0x6'));var rimraf=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x34c9c3,_0x51cf1f){return _0x34c9c3['define']('FreshsalesField',attributes,{'tableName':_0x3d94('0x9'),'paranoid':![],'indexes':[{'name':_0x3d94('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3ef7=['moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','../../config/logger','api'];(function(_0x175ac3,_0x3977d8){var _0x1017af=function(_0x487c76){while(--_0x487c76){_0x175ac3['push'](_0x175ac3['shift']());}};_0x1017af(++_0x3977d8);}(_0x3ef7,0xa2));var _0x73ef=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3ef7[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x73ef('0x0'));var util=require('util');var logger=require(_0x73ef('0x1'))(_0x73ef('0x2'));var moment=require(_0x73ef('0x3'));var BPromise=require(_0x73ef('0x4'));var rp=require(_0x73ef('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x73ef('0x6'));var config=require(_0x73ef('0x7'));var attributes=require(_0x73ef('0x8'));module[_0x73ef('0x9')]=function(_0x4aaf96,_0x18cd10){return _0x4aaf96[_0x73ef('0xa')](_0x73ef('0xb'),attributes,{'tableName':_0x73ef('0xc'),'paranoid':![],'indexes':[{'name':_0x73ef('0xd'),'fields':['idField',_0x73ef('0xe')],'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 0c4211a..bb487ba 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 _0x2542=['info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2416ef,_0x319324){var _0x384693=function(_0x2d42ae){while(--_0x2d42ae){_0x2416ef['push'](_0x2416ef['shift']());}};_0x384693(++_0x319324);}(_0x2542,0x169));var _0x2254=function(_0x39053a,_0x45bbea){_0x39053a=_0x39053a-0x0;var _0x1fdf5a=_0x2542[_0x39053a];return _0x1fdf5a;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2fa567,_0x19cc3a){var _0x6afd0b=function(_0x4d3c16){while(--_0x4d3c16){_0x2fa567['push'](_0x2fa567['shift']());}};_0x6afd0b(++_0x19cc3a);}(_0x0295,0x1f0));var _0x5029=function(_0x135ebc,_0x123430){_0x135ebc=_0x135ebc-0x0;var _0x210162=_0x0295[_0x135ebc];return _0x210162;};'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')]('FreshsalesField,\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 diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 9311b5f..66fb86a 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(_0x58449d,_0x4e6ec6){var _0x41089d=function(_0x284ab9){while(--_0x284ab9){_0x58449d['push'](_0x58449d['shift']());}};_0x41089d(++_0x4e6ec6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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(_0x12f5bf,_0x5020e5){var _0x137c00=function(_0x38b4f0){while(--_0x38b4f0){_0x12f5bf['push'](_0x12f5bf['shift']());}};_0x137c00(++_0x5020e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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 2d78a5c..420085f 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 _0x7f7e=['ENUM','integrationTab','newTab','sequelize','STRING'];(function(_0x3776a3,_0x1503fc){var _0x3f0def=function(_0x2d353f){while(--_0x2d353f){_0x3776a3['push'](_0x3776a3['shift']());}};_0x3f0def(++_0x1503fc);}(_0x7f7e,0xc6));var _0xe7f7=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x7f7e[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0xe7f7('0x0'));module['exports']={'name':{'type':Sequelize[_0xe7f7('0x1')]},'description':{'type':Sequelize[_0xe7f7('0x1')]},'username':{'type':Sequelize[_0xe7f7('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize[_0xe7f7('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xe7f7('0x1')]},'clientSecret':{'type':Sequelize[_0xe7f7('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe7f7('0x2')](_0xe7f7('0x3'),_0xe7f7('0x4')),'defaultValue':_0xe7f7('0x3')}}; \ No newline at end of file +var _0x2133=['exports','STRING','ENUM','newTab','integrationTab'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x2133,0x1d1));var _0x3213=function(_0x3c4027,_0x465e94){_0x3c4027=_0x3c4027-0x0;var _0x5578f9=_0x2133[_0x3c4027];return _0x5578f9;};'use strict';var Sequelize=require('sequelize');module[_0x3213('0x0')]={'name':{'type':Sequelize[_0x3213('0x1')]},'description':{'type':Sequelize[_0x3213('0x1')]},'username':{'type':Sequelize[_0x3213('0x1')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x3213('0x1')]},'clientId':{'type':Sequelize[_0x3213('0x1')]},'clientSecret':{'type':Sequelize[_0x3213('0x1')]},'securityToken':{'type':Sequelize[_0x3213('0x1')]},'serverUrl':{'type':Sequelize[_0x3213('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3213('0x2')]('integrationTab',_0x3213('0x3')),'defaultValue':_0x3213('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 677a50a..3ffd998 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 _0x8c46=['../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','set','apply','reject','save','then','destroy','error','stack','name','index','SalesforceAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','count','include','findAll','rows','catch','params','includeAll','options','find','body','update','getConfigurations','findOne','SalesforceConfiguration','order','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','create','SalesforceField','getFields','Task','clientId','clientSecret','password','securityToken','remoteUri','slice','substring','Connection','login','username','isNil','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils'];(function(_0x798688,_0x17b601){var _0x205d82=function(_0x5bf59c){while(--_0x5bf59c){_0x798688['push'](_0x798688['shift']());}};_0x205d82(++_0x17b601);}(_0x8c46,0x6a));var _0x68c4=function(_0x22c027,_0x46f178){_0x22c027=_0x22c027-0x0;var _0xf9f337=_0x8c46[_0x22c027];return _0xf9f337;};'use strict';var emlformat=require(_0x68c4('0x0'));var rimraf=require(_0x68c4('0x1'));var zipdir=require(_0x68c4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x68c4('0x3'));var moment=require(_0x68c4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x68c4('0x5'));var util=require(_0x68c4('0x6'));var path=require(_0x68c4('0x7'));var sox=require(_0x68c4('0x8'));var csv=require(_0x68c4('0x9'));var ejs=require(_0x68c4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x68c4('0xb'));var crypto=require(_0x68c4('0xc'));var jsforce=require(_0x68c4('0xd'));var deskjs=require(_0x68c4('0xe'));var toCsv=require(_0x68c4('0x9'));var querystring=require(_0x68c4('0xf'));var Papa=require(_0x68c4('0x10'));var Redis=require(_0x68c4('0x11'));var authService=require(_0x68c4('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x68c4('0x13'));var utils=require(_0x68c4('0x14'));var config=require(_0x68c4('0x15'));var licenseUtil=require(_0x68c4('0x16'));var db=require(_0x68c4('0x17'))['db'];var integrations=require(_0x68c4('0x18'));function respondWithStatusCode(_0x5b8750,_0x1a804b){_0x1a804b=_0x1a804b||0xcc;return function(_0x779306){if(_0x779306){return _0x5b8750['sendStatus'](_0x1a804b);}return _0x5b8750[_0x68c4('0x19')](_0x1a804b)[_0x68c4('0x1a')]();};}function respondWithResult(_0xf9ba45,_0x2e3461){_0x2e3461=_0x2e3461||0xc8;return function(_0x339114){if(_0x339114){return _0xf9ba45['status'](_0x2e3461)[_0x68c4('0x1b')](_0x339114);}};}function respondWithFilteredResult(_0x339ec9,_0x57834f){return function(_0x31cca8){if(_0x31cca8){var _0x36fd8c=typeof _0x57834f[_0x68c4('0x1c')]===_0x68c4('0x1d')&&typeof _0x57834f[_0x68c4('0x1e')]===_0x68c4('0x1d');var _0x2513a7=_0x31cca8['count'];var _0x761bd2=_0x36fd8c?0x0:_0x57834f[_0x68c4('0x1c')];var _0x3f14a8=_0x36fd8c?_0x31cca8['count']:_0x57834f['offset']+_0x57834f[_0x68c4('0x1e')];var _0xcd447a;if(_0x3f14a8>=_0x2513a7){_0x3f14a8=_0x2513a7;_0xcd447a=0xc8;}else{_0xcd447a=0xce;}_0x339ec9[_0x68c4('0x19')](_0xcd447a);return _0x339ec9[_0x68c4('0x1f')]('Content-Range',_0x761bd2+'-'+_0x3f14a8+'/'+_0x2513a7)[_0x68c4('0x1b')](_0x31cca8);}return null;};}function patchUpdates(_0x358514){return function(_0x26181a){try{jsonpatch[_0x68c4('0x20')](_0x26181a,_0x358514,!![]);}catch(_0x116ce0){return BPromise[_0x68c4('0x21')](_0x116ce0);}return _0x26181a[_0x68c4('0x22')]();};}function saveUpdates(_0x37c715,_0x5eda56){return function(_0x120bf1){if(_0x120bf1){return _0x120bf1['update'](_0x37c715)[_0x68c4('0x23')](function(_0xd5779f){return _0xd5779f;});}return null;};}function removeEntity(_0x38c1e2,_0x2bdb6a){return function(_0x421337){if(_0x421337){return _0x421337[_0x68c4('0x24')]()[_0x68c4('0x23')](function(){_0x38c1e2[_0x68c4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f1f01,_0x3ea9f7){return function(_0x197c60){if(!_0x197c60){_0x1f1f01['sendStatus'](0x194);}return _0x197c60;};}function handleError(_0x106812,_0x4cfde0){_0x4cfde0=_0x4cfde0||0x1f4;return function(_0x549e4a){logger[_0x68c4('0x25')](_0x549e4a[_0x68c4('0x26')]);if(_0x549e4a['name']){delete _0x549e4a[_0x68c4('0x27')];}_0x106812[_0x68c4('0x19')](_0x4cfde0)['send'](_0x549e4a);};}exports[_0x68c4('0x28')]=function(_0x1a6c01,_0x23b8e1){var _0x37249b={},_0x5477c0={},_0x2538b1={'count':0x0,'rows':[]};var _0x5b5ca9=_['map'](db[_0x68c4('0x29')][_0x68c4('0x2a')],function(_0x5eb06d){return{'name':_0x5eb06d[_0x68c4('0x2b')],'type':_0x5eb06d[_0x68c4('0x2c')][_0x68c4('0x2d')]};});_0x5477c0['model']=_[_0x68c4('0x2e')](_0x5b5ca9,'name');_0x5477c0[_0x68c4('0x2f')]=_[_0x68c4('0x30')](_0x1a6c01['query']);_0x5477c0[_0x68c4('0x31')]=_[_0x68c4('0x32')](_0x5477c0[_0x68c4('0x33')],_0x5477c0[_0x68c4('0x2f')]);_0x37249b['attributes']=_[_0x68c4('0x32')](_0x5477c0[_0x68c4('0x33')],qs[_0x68c4('0x34')](_0x1a6c01['query'][_0x68c4('0x34')]));_0x37249b[_0x68c4('0x35')]=_0x37249b[_0x68c4('0x35')][_0x68c4('0x36')]?_0x37249b[_0x68c4('0x35')]:_0x5477c0[_0x68c4('0x33')];if(!_0x1a6c01['query'][_0x68c4('0x37')]('nolimit')){_0x37249b[_0x68c4('0x1e')]=qs[_0x68c4('0x1e')](_0x1a6c01[_0x68c4('0x2f')]['limit']);_0x37249b[_0x68c4('0x1c')]=qs['offset'](_0x1a6c01[_0x68c4('0x2f')][_0x68c4('0x1c')]);}_0x37249b['order']=qs[_0x68c4('0x38')](_0x1a6c01['query'][_0x68c4('0x38')]);_0x37249b[_0x68c4('0x39')]=qs['filters'](_['pick'](_0x1a6c01[_0x68c4('0x2f')],_0x5477c0['filters']),_0x5b5ca9);if(_0x1a6c01['query'][_0x68c4('0x3a')]){_0x37249b['where']=_[_0x68c4('0x3b')](_0x37249b[_0x68c4('0x39')],{'$or':_[_0x68c4('0x2e')](_0x5b5ca9,function(_0x4ee0f8){if(_0x4ee0f8[_0x68c4('0x2c')]!==_0x68c4('0x3c')){var _0x3a652c={};_0x3a652c[_0x4ee0f8[_0x68c4('0x27')]]={'$like':'%'+_0x1a6c01[_0x68c4('0x2f')][_0x68c4('0x3a')]+'%'};return _0x3a652c;}})});}_0x37249b=_[_0x68c4('0x3b')]({},_0x37249b,_0x1a6c01['options']);var _0x88db0a={'where':_0x37249b[_0x68c4('0x39')]};return db[_0x68c4('0x29')][_0x68c4('0x3d')](_0x88db0a)['then'](function(_0xe0bf49){_0x2538b1[_0x68c4('0x3d')]=_0xe0bf49;if(_0x1a6c01[_0x68c4('0x2f')]['includeAll']){_0x37249b[_0x68c4('0x3e')]=[{'all':!![]}];}return db['SalesforceAccount'][_0x68c4('0x3f')](_0x37249b);})[_0x68c4('0x23')](function(_0x19b898){_0x2538b1[_0x68c4('0x40')]=_0x19b898;return _0x2538b1;})['then'](respondWithFilteredResult(_0x23b8e1,_0x37249b))[_0x68c4('0x41')](handleError(_0x23b8e1,null));};exports['show']=function(_0x5a6041,_0x4eac29){var _0x1ece42={'raw':![],'where':{'id':_0x5a6041[_0x68c4('0x42')]['id']}},_0x418858={};_0x418858[_0x68c4('0x33')]=_[_0x68c4('0x30')](db[_0x68c4('0x29')][_0x68c4('0x2a')]);_0x418858[_0x68c4('0x2f')]=_[_0x68c4('0x30')](_0x5a6041['query']);_0x418858[_0x68c4('0x31')]=_[_0x68c4('0x32')](_0x418858[_0x68c4('0x33')],_0x418858['query']);_0x1ece42[_0x68c4('0x35')]=_[_0x68c4('0x32')](_0x418858[_0x68c4('0x33')],qs['fields'](_0x5a6041[_0x68c4('0x2f')]['fields']));_0x1ece42['attributes']=_0x1ece42[_0x68c4('0x35')][_0x68c4('0x36')]?_0x1ece42[_0x68c4('0x35')]:_0x418858[_0x68c4('0x33')];if(_0x5a6041[_0x68c4('0x2f')][_0x68c4('0x43')]){_0x1ece42[_0x68c4('0x3e')]=[{'all':!![]}];}_0x1ece42=_[_0x68c4('0x3b')]({},_0x1ece42,_0x5a6041[_0x68c4('0x44')]);return db[_0x68c4('0x29')][_0x68c4('0x45')](_0x1ece42)[_0x68c4('0x23')](handleEntityNotFound(_0x4eac29,null))[_0x68c4('0x23')](respondWithResult(_0x4eac29,null))[_0x68c4('0x41')](handleError(_0x4eac29,null));};exports['create']=function(_0x14d68f,_0x162410){return db[_0x68c4('0x29')]['create'](_0x14d68f[_0x68c4('0x46')],{})['then'](respondWithResult(_0x162410,0xc9))[_0x68c4('0x41')](handleError(_0x162410,null));};exports[_0x68c4('0x47')]=function(_0x43cf58,_0x479099){if(_0x43cf58[_0x68c4('0x46')]['id']){delete _0x43cf58[_0x68c4('0x46')]['id'];}return db[_0x68c4('0x29')][_0x68c4('0x45')]({'where':{'id':_0x43cf58[_0x68c4('0x42')]['id']}})['then'](handleEntityNotFound(_0x479099,null))[_0x68c4('0x23')](saveUpdates(_0x43cf58['body'],null))[_0x68c4('0x23')](respondWithResult(_0x479099,null))['catch'](handleError(_0x479099,null));};exports['destroy']=function(_0x43d09d,_0x31d7a1){return db[_0x68c4('0x29')][_0x68c4('0x45')]({'where':{'id':_0x43d09d[_0x68c4('0x42')]['id']}})['then'](handleEntityNotFound(_0x31d7a1,null))[_0x68c4('0x23')](removeEntity(_0x31d7a1,null))[_0x68c4('0x41')](handleError(_0x31d7a1,null));};exports[_0x68c4('0x48')]=function(_0x3becf9,_0x17a04d,_0x2c8585){var _0x3701d2={};var _0x28f3da={};var _0x3bc8e6;var _0x18fa76;return db[_0x68c4('0x29')][_0x68c4('0x49')]({'where':{'id':_0x3becf9[_0x68c4('0x42')]['id']}})[_0x68c4('0x23')](handleEntityNotFound(_0x17a04d,null))[_0x68c4('0x23')](function(_0xcfce38){if(_0xcfce38){_0x3bc8e6=_0xcfce38;_0x28f3da[_0x68c4('0x33')]=_[_0x68c4('0x30')](db[_0x68c4('0x4a')]['rawAttributes']);_0x28f3da[_0x68c4('0x2f')]=_[_0x68c4('0x30')](_0x3becf9[_0x68c4('0x2f')]);_0x28f3da[_0x68c4('0x31')]=_[_0x68c4('0x32')](_0x28f3da[_0x68c4('0x33')],_0x28f3da['query']);_0x3701d2[_0x68c4('0x35')]=_[_0x68c4('0x32')](_0x28f3da[_0x68c4('0x33')],qs['fields'](_0x3becf9[_0x68c4('0x2f')][_0x68c4('0x34')]));_0x3701d2['attributes']=_0x3701d2[_0x68c4('0x35')]['length']?_0x3701d2[_0x68c4('0x35')]:_0x28f3da[_0x68c4('0x33')];_0x3701d2[_0x68c4('0x4b')]=qs['sort'](_0x3becf9[_0x68c4('0x2f')][_0x68c4('0x38')]);_0x3701d2[_0x68c4('0x39')]=qs[_0x68c4('0x31')](_[_0x68c4('0x4c')](_0x3becf9[_0x68c4('0x2f')],_0x28f3da[_0x68c4('0x31')]));if(_0x3becf9[_0x68c4('0x2f')][_0x68c4('0x3a')]){_0x3701d2[_0x68c4('0x39')]=_[_0x68c4('0x3b')](_0x3701d2[_0x68c4('0x39')],{'$or':_[_0x68c4('0x2e')](_0x3701d2['attributes'],function(_0x2eb960){var _0x1b6856={};_0x1b6856[_0x2eb960]={'$like':'%'+_0x3becf9[_0x68c4('0x2f')]['filter']+'%'};return _0x1b6856;})});}_0x3701d2=_[_0x68c4('0x3b')]({},_0x3701d2,_0x3becf9['options']);return _0x3bc8e6['getConfigurations'](_0x3701d2);}})[_0x68c4('0x23')](function(_0x51d7f5){if(_0x51d7f5){_0x18fa76=_0x51d7f5['length'];if(!_0x3becf9['query'][_0x68c4('0x37')]('nolimit')){_0x3701d2[_0x68c4('0x1e')]=qs['limit'](_0x3becf9[_0x68c4('0x2f')][_0x68c4('0x1e')]);_0x3701d2[_0x68c4('0x1c')]=qs[_0x68c4('0x1c')](_0x3becf9[_0x68c4('0x2f')]['offset']);}return _0x3bc8e6[_0x68c4('0x48')](_0x3701d2);}})[_0x68c4('0x23')](function(_0x5f0cd9){if(_0x5f0cd9){return _0x5f0cd9?{'count':_0x18fa76,'rows':_0x5f0cd9}:null;}})[_0x68c4('0x23')](respondWithResult(_0x17a04d,null))['catch'](handleError(_0x17a04d,null));};exports[_0x68c4('0x4d')]=function(_0x34e241,_0x5a1b59,_0x229b37){if(_0x34e241[_0x68c4('0x46')]['id']){delete _0x34e241[_0x68c4('0x46')]['id'];}return db[_0x68c4('0x29')][_0x68c4('0x49')]({'where':{'id':_0x34e241[_0x68c4('0x42')]['id']}})[_0x68c4('0x23')](handleEntityNotFound(_0x5a1b59,null))[_0x68c4('0x23')](function(_0x307b1d){if(_0x307b1d){_0x34e241[_0x68c4('0x46')][_0x68c4('0x4e')]=_0x307b1d['id'];_0x34e241['body'][_0x68c4('0x4f')]=integrations[_0x68c4('0x50')](_0x34e241[_0x68c4('0x46')][_0x68c4('0x51')],_0x34e241[_0x68c4('0x46')][_0x68c4('0x2c')]);_0x34e241['body'][_0x68c4('0x52')]=integrations['getDescriptions'](_0x34e241[_0x68c4('0x46')]['channel'],_0x34e241[_0x68c4('0x46')][_0x68c4('0x2c')]);return db[_0x68c4('0x4a')][_0x68c4('0x53')](_0x34e241['body'],{'include':[{'model':db[_0x68c4('0x54')],'as':_0x68c4('0x4f')},{'model':db[_0x68c4('0x54')],'as':'Descriptions'}]});}return null;})[_0x68c4('0x23')](respondWithResult(_0x5a1b59,null))[_0x68c4('0x41')](handleError(_0x5a1b59,null));};exports[_0x68c4('0x55')]=function(_0x43600a,_0x3f12b3,_0x45cec7){var _0xc5a6cc;var _0x451ffe='';var _0xd2518d=_0x68c4('0x56');return db[_0x68c4('0x29')][_0x68c4('0x49')]({'where':{'id':_0x43600a['params']['id']},'attributes':['id','remoteUri',_0x68c4('0x57'),_0x68c4('0x58'),'username',_0x68c4('0x59'),_0x68c4('0x5a')]})['then'](handleEntityNotFound(_0x3f12b3,null))['then'](function(_0x206250){if(_0x206250){_0x451ffe=_0x206250[_0x68c4('0x5b')];var _0x15610c=_0x451ffe[_0x68c4('0x5c')](-0x1);if(_0x15610c==='/'){_0x451ffe=_0x451ffe[_0x68c4('0x5d')](0x0,_0x451ffe['lastIndexOf'](_0x15610c));}_0xc5a6cc=new jsforce[(_0x68c4('0x5e'))]({'oauth2':{'loginUrl':_0x451ffe,'clientId':_0x206250['clientId'],'clientSecret':_0x206250[_0x68c4('0x58')]}});return _0xc5a6cc[_0x68c4('0x5f')](_0x206250[_0x68c4('0x60')],_0x206250[_0x68c4('0x59')]['concat'](_0x206250['securityToken']));}})[_0x68c4('0x23')](function(_0x5553ba){if(_0x5553ba){if(!_[_0x68c4('0x61')](_0x43600a[_0x68c4('0x2f')]['ticketType'])){_0xd2518d=_0x43600a[_0x68c4('0x2f')]['ticketType'];}return _0xc5a6cc[_0x68c4('0x62')](_0xd2518d)['describe']();}})[_0x68c4('0x23')](function(_0x1b8eae){var _0x101ec1=[_0x68c4('0x63'),_0x68c4('0x64'),_0x68c4('0x65'),_0x68c4('0x66'),_0x68c4('0x67'),_0x68c4('0x68')];var _0x332ca7=[_0x68c4('0x69'),_0x68c4('0x6a'),_0x68c4('0x6b'),_0x68c4('0x6c'),_0x68c4('0x6d'),_0x68c4('0x6e'),'phone'];if(_0x1b8eae){_[_0x68c4('0x6f')](_0x1b8eae[_0x68c4('0x34')],function(_0xe26782){return _0x101ec1[_0x68c4('0x70')](_0xe26782[_0x68c4('0x27')])||!_0x332ca7['includes'](_0xe26782[_0x68c4('0x2c')]);});return{'count':_0x1b8eae[_0x68c4('0x34')][_0x68c4('0x36')],'rows':_[_0x68c4('0x2e')](_0x1b8eae['fields'],function(_0x1120ef){return{'id':_0x1120ef[_0x68c4('0x27')],'name':_0x1120ef[_0x68c4('0x71')],'custom':_0x1120ef[_0x68c4('0x72')],'options':_0x1120ef[_0x68c4('0x73')]['length']>0x0?_[_0x68c4('0x2e')](_0x1120ef[_0x68c4('0x73')],function(_0x546a78){return{'name':_0x546a78[_0x68c4('0x71')],'value':_0x546a78[_0x68c4('0x74')]};}):_0x1120ef[_0x68c4('0x2c')]==_0x68c4('0x6c')?[{'name':_0x68c4('0x75'),'value':_0x68c4('0x76')},{'name':_0x68c4('0x77'),'value':_0x68c4('0x78')}]:[]};})};}})[_0x68c4('0x23')](respondWithResult(_0x3f12b3,null))[_0x68c4('0x41')](function(_0x538270){var _0x22f78d=_0x43600a['query'][_0x68c4('0x79')]?0x1f4:_0x538270[_0x68c4('0x7a')]||0x1f4;logger[_0x68c4('0x25')](_0x68c4('0x7b'),'getFields',_0x22f78d,JSON[_0x68c4('0x7c')](_0x538270));delete _0x538270[_0x68c4('0x27')];if(_0x22f78d===0x191){_0x22f78d=0x190;}_0x3f12b3[_0x68c4('0x19')](_0x22f78d)[_0x68c4('0x7d')](_0x43600a[_0x68c4('0x2f')]['test']?{'message':_0x68c4('0x7e'),'statusCode':_0x538270[_0x68c4('0x7a')]}:_0x538270);});}; \ No newline at end of file +var _0xbb81=['fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','options','include','SalesforceAccount','findAll','rows','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','SalesforceConfiguration','nolimit','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','username','password','substring','Connection','concat','securityToken','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','picklist','boolean','email','textarea','phone','remove','includes','label','picklistValues','value','true','False','false','test','statusCode','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xbb81,0x77));var _0x1bb8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb81[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1bb8('0x0'));var rimraf=require(_0x1bb8('0x1'));var zipdir=require(_0x1bb8('0x2'));var jsonpatch=require(_0x1bb8('0x3'));var rp=require('request-promise');var moment=require(_0x1bb8('0x4'));var BPromise=require(_0x1bb8('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1bb8('0x6'));var csv=require(_0x1bb8('0x7'));var ejs=require(_0x1bb8('0x8'));var fs=require('fs');var fs_extra=require(_0x1bb8('0x9'));var _=require(_0x1bb8('0xa'));var squel=require(_0x1bb8('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1bb8('0xc'));var toCsv=require(_0x1bb8('0x7'));var querystring=require(_0x1bb8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1bb8('0xe'));var as=require(_0x1bb8('0xf'));var hardwareService=require(_0x1bb8('0x10'));var logger=require(_0x1bb8('0x11'))(_0x1bb8('0x12'));var utils=require(_0x1bb8('0x13'));var config=require(_0x1bb8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1bb8('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x31109f,_0x216625){_0x216625=_0x216625||0xcc;return function(_0x294f44){if(_0x294f44){return _0x31109f[_0x1bb8('0x16')](_0x216625);}return _0x31109f[_0x1bb8('0x17')](_0x216625)[_0x1bb8('0x18')]();};}function respondWithResult(_0x4e2716,_0x716a49){_0x716a49=_0x716a49||0xc8;return function(_0x13e43f){if(_0x13e43f){return _0x4e2716[_0x1bb8('0x17')](_0x716a49)[_0x1bb8('0x19')](_0x13e43f);}};}function respondWithFilteredResult(_0x436125,_0x5013f6){return function(_0x34ce70){if(_0x34ce70){var _0x37b619=typeof _0x5013f6[_0x1bb8('0x1a')]===_0x1bb8('0x1b')&&typeof _0x5013f6[_0x1bb8('0x1c')]==='undefined';var _0x5c6e2e=_0x34ce70[_0x1bb8('0x1d')];var _0x2d7a4c=_0x37b619?0x0:_0x5013f6[_0x1bb8('0x1a')];var _0x31e596=_0x37b619?_0x34ce70[_0x1bb8('0x1d')]:_0x5013f6[_0x1bb8('0x1a')]+_0x5013f6['limit'];var _0x42cf3c;if(_0x31e596>=_0x5c6e2e){_0x31e596=_0x5c6e2e;_0x42cf3c=0xc8;}else{_0x42cf3c=0xce;}_0x436125[_0x1bb8('0x17')](_0x42cf3c);return _0x436125[_0x1bb8('0x1e')]('Content-Range',_0x2d7a4c+'-'+_0x31e596+'/'+_0x5c6e2e)[_0x1bb8('0x19')](_0x34ce70);}return null;};}function patchUpdates(_0x43c4b3){return function(_0x2adc8c){try{jsonpatch['apply'](_0x2adc8c,_0x43c4b3,!![]);}catch(_0x2f90be){return BPromise[_0x1bb8('0x1f')](_0x2f90be);}return _0x2adc8c[_0x1bb8('0x20')]();};}function saveUpdates(_0x277fbc,_0x5e0d6b){return function(_0x1c7f79){if(_0x1c7f79){return _0x1c7f79[_0x1bb8('0x21')](_0x277fbc)[_0x1bb8('0x22')](function(_0x7b01cd){return _0x7b01cd;});}return null;};}function removeEntity(_0x51d090,_0x2c784b){return function(_0x53eca1){if(_0x53eca1){return _0x53eca1[_0x1bb8('0x23')]()['then'](function(){_0x51d090[_0x1bb8('0x17')](0xcc)[_0x1bb8('0x18')]();});}};}function handleEntityNotFound(_0x4177aa,_0x2b481a){return function(_0x26c640){if(!_0x26c640){_0x4177aa[_0x1bb8('0x16')](0x194);}return _0x26c640;};}function handleError(_0xc45e37,_0x321f11){_0x321f11=_0x321f11||0x1f4;return function(_0x16913c){logger[_0x1bb8('0x24')](_0x16913c[_0x1bb8('0x25')]);if(_0x16913c[_0x1bb8('0x26')]){delete _0x16913c[_0x1bb8('0x26')];}_0xc45e37[_0x1bb8('0x17')](_0x321f11)['send'](_0x16913c);};}exports[_0x1bb8('0x27')]=function(_0xe9f743,_0x9aab8a){var _0x25c337={},_0xe74f20={},_0x11506f={'count':0x0,'rows':[]};var _0x44d718=_[_0x1bb8('0x28')](db['SalesforceAccount'][_0x1bb8('0x29')],function(_0x28715f){return{'name':_0x28715f[_0x1bb8('0x2a')],'type':_0x28715f[_0x1bb8('0x2b')][_0x1bb8('0x2c')]};});_0xe74f20[_0x1bb8('0x2d')]=_['map'](_0x44d718,_0x1bb8('0x26'));_0xe74f20['query']=_[_0x1bb8('0x2e')](_0xe9f743[_0x1bb8('0x2f')]);_0xe74f20['filters']=_['intersection'](_0xe74f20[_0x1bb8('0x2d')],_0xe74f20[_0x1bb8('0x2f')]);_0x25c337['attributes']=_[_0x1bb8('0x30')](_0xe74f20[_0x1bb8('0x2d')],qs[_0x1bb8('0x31')](_0xe9f743[_0x1bb8('0x2f')]['fields']));_0x25c337[_0x1bb8('0x32')]=_0x25c337['attributes'][_0x1bb8('0x33')]?_0x25c337[_0x1bb8('0x32')]:_0xe74f20['model'];if(!_0xe9f743[_0x1bb8('0x2f')][_0x1bb8('0x34')]('nolimit')){_0x25c337[_0x1bb8('0x1c')]=qs[_0x1bb8('0x1c')](_0xe9f743[_0x1bb8('0x2f')]['limit']);_0x25c337[_0x1bb8('0x1a')]=qs[_0x1bb8('0x1a')](_0xe9f743[_0x1bb8('0x2f')][_0x1bb8('0x1a')]);}_0x25c337[_0x1bb8('0x35')]=qs[_0x1bb8('0x36')](_0xe9f743['query'][_0x1bb8('0x36')]);_0x25c337[_0x1bb8('0x37')]=qs[_0x1bb8('0x38')](_['pick'](_0xe9f743[_0x1bb8('0x2f')],_0xe74f20[_0x1bb8('0x38')]),_0x44d718);if(_0xe9f743[_0x1bb8('0x2f')][_0x1bb8('0x39')]){_0x25c337[_0x1bb8('0x37')]=_['merge'](_0x25c337[_0x1bb8('0x37')],{'$or':_[_0x1bb8('0x28')](_0x44d718,function(_0x53a79c){if(_0x53a79c[_0x1bb8('0x2b')]!==_0x1bb8('0x3a')){var _0x52c4c8={};_0x52c4c8[_0x53a79c[_0x1bb8('0x26')]]={'$like':'%'+_0xe9f743[_0x1bb8('0x2f')]['filter']+'%'};return _0x52c4c8;}})});}_0x25c337=_[_0x1bb8('0x3b')]({},_0x25c337,_0xe9f743[_0x1bb8('0x3c')]);var _0x560b53={'where':_0x25c337['where']};return db['SalesforceAccount'][_0x1bb8('0x1d')](_0x560b53)[_0x1bb8('0x22')](function(_0x1ad6ea){_0x11506f[_0x1bb8('0x1d')]=_0x1ad6ea;if(_0xe9f743['query']['includeAll']){_0x25c337[_0x1bb8('0x3d')]=[{'all':!![]}];}return db[_0x1bb8('0x3e')][_0x1bb8('0x3f')](_0x25c337);})[_0x1bb8('0x22')](function(_0x98d218){_0x11506f[_0x1bb8('0x40')]=_0x98d218;return _0x11506f;})['then'](respondWithFilteredResult(_0x9aab8a,_0x25c337))[_0x1bb8('0x41')](handleError(_0x9aab8a,null));};exports[_0x1bb8('0x42')]=function(_0x2211fb,_0x2d2747){var _0x51d0b9={'raw':![],'where':{'id':_0x2211fb[_0x1bb8('0x43')]['id']}},_0x27fea7={};_0x27fea7[_0x1bb8('0x2d')]=_[_0x1bb8('0x2e')](db['SalesforceAccount'][_0x1bb8('0x29')]);_0x27fea7[_0x1bb8('0x2f')]=_['keys'](_0x2211fb[_0x1bb8('0x2f')]);_0x27fea7[_0x1bb8('0x38')]=_['intersection'](_0x27fea7['model'],_0x27fea7[_0x1bb8('0x2f')]);_0x51d0b9[_0x1bb8('0x32')]=_[_0x1bb8('0x30')](_0x27fea7[_0x1bb8('0x2d')],qs[_0x1bb8('0x31')](_0x2211fb[_0x1bb8('0x2f')][_0x1bb8('0x31')]));_0x51d0b9[_0x1bb8('0x32')]=_0x51d0b9[_0x1bb8('0x32')]['length']?_0x51d0b9['attributes']:_0x27fea7[_0x1bb8('0x2d')];if(_0x2211fb[_0x1bb8('0x2f')][_0x1bb8('0x44')]){_0x51d0b9['include']=[{'all':!![]}];}_0x51d0b9=_['merge']({},_0x51d0b9,_0x2211fb[_0x1bb8('0x3c')]);return db['SalesforceAccount'][_0x1bb8('0x45')](_0x51d0b9)['then'](handleEntityNotFound(_0x2d2747,null))[_0x1bb8('0x22')](respondWithResult(_0x2d2747,null))[_0x1bb8('0x41')](handleError(_0x2d2747,null));};exports[_0x1bb8('0x46')]=function(_0x55b3bc,_0x50b9ae){return db['SalesforceAccount'][_0x1bb8('0x46')](_0x55b3bc['body'],{})[_0x1bb8('0x22')](respondWithResult(_0x50b9ae,0xc9))[_0x1bb8('0x41')](handleError(_0x50b9ae,null));};exports['update']=function(_0x371fae,_0x75b9b6){if(_0x371fae[_0x1bb8('0x47')]['id']){delete _0x371fae[_0x1bb8('0x47')]['id'];}return db[_0x1bb8('0x3e')]['find']({'where':{'id':_0x371fae[_0x1bb8('0x43')]['id']}})[_0x1bb8('0x22')](handleEntityNotFound(_0x75b9b6,null))['then'](saveUpdates(_0x371fae['body'],null))['then'](respondWithResult(_0x75b9b6,null))[_0x1bb8('0x41')](handleError(_0x75b9b6,null));};exports[_0x1bb8('0x23')]=function(_0x1cac53,_0x5b3787){return db[_0x1bb8('0x3e')][_0x1bb8('0x45')]({'where':{'id':_0x1cac53[_0x1bb8('0x43')]['id']}})[_0x1bb8('0x22')](handleEntityNotFound(_0x5b3787,null))['then'](removeEntity(_0x5b3787,null))['catch'](handleError(_0x5b3787,null));};exports[_0x1bb8('0x48')]=function(_0x3da9fa,_0x38944e,_0x16c473){var _0x5262e7={};var _0x442df2={};var _0x5534c5;var _0x53775;return db[_0x1bb8('0x3e')][_0x1bb8('0x49')]({'where':{'id':_0x3da9fa[_0x1bb8('0x43')]['id']}})[_0x1bb8('0x22')](handleEntityNotFound(_0x38944e,null))[_0x1bb8('0x22')](function(_0x4cadbf){if(_0x4cadbf){_0x5534c5=_0x4cadbf;_0x442df2[_0x1bb8('0x2d')]=_[_0x1bb8('0x2e')](db[_0x1bb8('0x4a')][_0x1bb8('0x29')]);_0x442df2[_0x1bb8('0x2f')]=_[_0x1bb8('0x2e')](_0x3da9fa[_0x1bb8('0x2f')]);_0x442df2[_0x1bb8('0x38')]=_[_0x1bb8('0x30')](_0x442df2[_0x1bb8('0x2d')],_0x442df2['query']);_0x5262e7[_0x1bb8('0x32')]=_[_0x1bb8('0x30')](_0x442df2[_0x1bb8('0x2d')],qs['fields'](_0x3da9fa[_0x1bb8('0x2f')][_0x1bb8('0x31')]));_0x5262e7[_0x1bb8('0x32')]=_0x5262e7[_0x1bb8('0x32')][_0x1bb8('0x33')]?_0x5262e7[_0x1bb8('0x32')]:_0x442df2['model'];_0x5262e7['order']=qs[_0x1bb8('0x36')](_0x3da9fa[_0x1bb8('0x2f')]['sort']);_0x5262e7[_0x1bb8('0x37')]=qs['filters'](_['pick'](_0x3da9fa[_0x1bb8('0x2f')],_0x442df2[_0x1bb8('0x38')]));if(_0x3da9fa[_0x1bb8('0x2f')][_0x1bb8('0x39')]){_0x5262e7[_0x1bb8('0x37')]=_[_0x1bb8('0x3b')](_0x5262e7['where'],{'$or':_[_0x1bb8('0x28')](_0x5262e7['attributes'],function(_0x4a165a){var _0x3700cf={};_0x3700cf[_0x4a165a]={'$like':'%'+_0x3da9fa[_0x1bb8('0x2f')][_0x1bb8('0x39')]+'%'};return _0x3700cf;})});}_0x5262e7=_['merge']({},_0x5262e7,_0x3da9fa['options']);return _0x5534c5['getConfigurations'](_0x5262e7);}})[_0x1bb8('0x22')](function(_0x36581e){if(_0x36581e){_0x53775=_0x36581e[_0x1bb8('0x33')];if(!_0x3da9fa['query']['hasOwnProperty'](_0x1bb8('0x4b'))){_0x5262e7[_0x1bb8('0x1c')]=qs[_0x1bb8('0x1c')](_0x3da9fa[_0x1bb8('0x2f')][_0x1bb8('0x1c')]);_0x5262e7[_0x1bb8('0x1a')]=qs[_0x1bb8('0x1a')](_0x3da9fa[_0x1bb8('0x2f')]['offset']);}return _0x5534c5[_0x1bb8('0x48')](_0x5262e7);}})[_0x1bb8('0x22')](function(_0x3421f4){if(_0x3421f4){return _0x3421f4?{'count':_0x53775,'rows':_0x3421f4}:null;}})['then'](respondWithResult(_0x38944e,null))[_0x1bb8('0x41')](handleError(_0x38944e,null));};exports[_0x1bb8('0x4c')]=function(_0x3e0af2,_0x3718b1,_0x51c1e2){if(_0x3e0af2[_0x1bb8('0x47')]['id']){delete _0x3e0af2[_0x1bb8('0x47')]['id'];}return db[_0x1bb8('0x3e')][_0x1bb8('0x49')]({'where':{'id':_0x3e0af2[_0x1bb8('0x43')]['id']}})['then'](handleEntityNotFound(_0x3718b1,null))[_0x1bb8('0x22')](function(_0x3ece1f){if(_0x3ece1f){_0x3e0af2[_0x1bb8('0x47')]['AccountId']=_0x3ece1f['id'];_0x3e0af2[_0x1bb8('0x47')][_0x1bb8('0x4d')]=integrations[_0x1bb8('0x4e')](_0x3e0af2['body'][_0x1bb8('0x4f')],_0x3e0af2['body'][_0x1bb8('0x2b')]);_0x3e0af2[_0x1bb8('0x47')][_0x1bb8('0x50')]=integrations[_0x1bb8('0x51')](_0x3e0af2[_0x1bb8('0x47')][_0x1bb8('0x4f')],_0x3e0af2[_0x1bb8('0x47')][_0x1bb8('0x2b')]);return db[_0x1bb8('0x4a')]['create'](_0x3e0af2[_0x1bb8('0x47')],{'include':[{'model':db['SalesforceField'],'as':_0x1bb8('0x4d')},{'model':db[_0x1bb8('0x52')],'as':_0x1bb8('0x50')}]});}return null;})['then'](respondWithResult(_0x3718b1,null))[_0x1bb8('0x41')](handleError(_0x3718b1,null));};exports[_0x1bb8('0x53')]=function(_0x242601,_0x5697fd,_0x8d9cc4){var _0x471f27;var _0x40a25a='';var _0x1f894e=_0x1bb8('0x54');return db['SalesforceAccount'][_0x1bb8('0x49')]({'where':{'id':_0x242601['params']['id']},'attributes':['id',_0x1bb8('0x55'),_0x1bb8('0x56'),_0x1bb8('0x57'),_0x1bb8('0x58'),_0x1bb8('0x59'),'securityToken']})[_0x1bb8('0x22')](handleEntityNotFound(_0x5697fd,null))[_0x1bb8('0x22')](function(_0x45ecf1){if(_0x45ecf1){_0x40a25a=_0x45ecf1['remoteUri'];var _0x484001=_0x40a25a['slice'](-0x1);if(_0x484001==='/'){_0x40a25a=_0x40a25a[_0x1bb8('0x5a')](0x0,_0x40a25a['lastIndexOf'](_0x484001));}_0x471f27=new jsforce[(_0x1bb8('0x5b'))]({'oauth2':{'loginUrl':_0x40a25a,'clientId':_0x45ecf1[_0x1bb8('0x56')],'clientSecret':_0x45ecf1[_0x1bb8('0x57')]}});return _0x471f27['login'](_0x45ecf1[_0x1bb8('0x58')],_0x45ecf1[_0x1bb8('0x59')][_0x1bb8('0x5c')](_0x45ecf1[_0x1bb8('0x5d')]));}})[_0x1bb8('0x22')](function(_0x17c5ba){if(_0x17c5ba){if(!_[_0x1bb8('0x5e')](_0x242601[_0x1bb8('0x2f')][_0x1bb8('0x5f')])){_0x1f894e=_0x242601[_0x1bb8('0x2f')][_0x1bb8('0x5f')];}return _0x471f27[_0x1bb8('0x60')](_0x1f894e)[_0x1bb8('0x61')]();}})[_0x1bb8('0x22')](function(_0x1ff5c9){var _0x43d399=['OwnerId',_0x1bb8('0x62'),_0x1bb8('0x63'),_0x1bb8('0x64'),_0x1bb8('0x65'),_0x1bb8('0x66')];var _0x126bbb=['string',_0x1bb8('0x67'),_0x1bb8('0x68'),_0x1bb8('0x69'),_0x1bb8('0x6a'),_0x1bb8('0x6b'),_0x1bb8('0x6c')];if(_0x1ff5c9){_[_0x1bb8('0x6d')](_0x1ff5c9[_0x1bb8('0x31')],function(_0x390711){return _0x43d399[_0x1bb8('0x6e')](_0x390711[_0x1bb8('0x26')])||!_0x126bbb[_0x1bb8('0x6e')](_0x390711['type']);});return{'count':_0x1ff5c9[_0x1bb8('0x31')][_0x1bb8('0x33')],'rows':_[_0x1bb8('0x28')](_0x1ff5c9[_0x1bb8('0x31')],function(_0x3d2b0a){return{'id':_0x3d2b0a[_0x1bb8('0x26')],'name':_0x3d2b0a[_0x1bb8('0x6f')],'custom':_0x3d2b0a['custom'],'options':_0x3d2b0a[_0x1bb8('0x70')][_0x1bb8('0x33')]>0x0?_[_0x1bb8('0x28')](_0x3d2b0a[_0x1bb8('0x70')],function(_0x355ecc){return{'name':_0x355ecc[_0x1bb8('0x6f')],'value':_0x355ecc[_0x1bb8('0x71')]};}):_0x3d2b0a['type']=='boolean'?[{'name':'True','value':_0x1bb8('0x72')},{'name':_0x1bb8('0x73'),'value':_0x1bb8('0x74')}]:[]};})};}})[_0x1bb8('0x22')](respondWithResult(_0x5697fd,null))[_0x1bb8('0x41')](function(_0x4c9512){var _0x362ce8=_0x242601[_0x1bb8('0x2f')][_0x1bb8('0x75')]?0x1f4:_0x4c9512[_0x1bb8('0x76')]||0x1f4;logger[_0x1bb8('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x1bb8('0x53'),_0x362ce8,JSON[_0x1bb8('0x77')](_0x4c9512));delete _0x4c9512['name'];if(_0x362ce8===0x191){_0x362ce8=0x190;}_0x5697fd[_0x1bb8('0x17')](_0x362ce8)[_0x1bb8('0x78')](_0x242601['query'][_0x1bb8('0x75')]?{'message':_0x1bb8('0x79'),'statusCode':_0x4c9512[_0x1bb8('0x76')]}:_0x4c9512);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index bce0f27..b312058 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 _0xd98a=['../../components/integrations/configuration','exports','define','SalesforceAccount','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intSalesforceAccount.attributes'];(function(_0xc5d388,_0x34433f){var _0xab136=function(_0xc1e9b){while(--_0xc1e9b){_0xc5d388['push'](_0xc5d388['shift']());}};_0xab136(++_0x34433f);}(_0xd98a,0x156));var _0xad98=function(_0xd0ec67,_0x135ace){_0xd0ec67=_0xd0ec67-0x0;var _0x343091=_0xd98a[_0xd0ec67];return _0x343091;};'use strict';var _=require(_0xad98('0x0'));var util=require(_0xad98('0x1'));var logger=require(_0xad98('0x2'))(_0xad98('0x3'));var moment=require(_0xad98('0x4'));var BPromise=require('bluebird');var rp=require(_0xad98('0x5'));var fs=require('fs');var path=require(_0xad98('0x6'));var rimraf=require('rimraf');var config=require(_0xad98('0x7'));var attributes=require(_0xad98('0x8'));var integrations=require(_0xad98('0x9'));module[_0xad98('0xa')]=function(_0x262ca7,_0x4638d8){return _0x262ca7[_0xad98('0xb')](_0xad98('0xc'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc66c=['moment','bluebird','request-promise','path','rimraf','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','api'];(function(_0x1906ee,_0x3e70fb){var _0x240ae8=function(_0x37e499){while(--_0x37e499){_0x1906ee['push'](_0x1906ee['shift']());}};_0x240ae8(++_0x3e70fb);}(_0xc66c,0x77));var _0xcc66=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xc66c[_0x465028];return _0xb783d4;};'use strict';var _=require(_0xcc66('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcc66('0x1'));var moment=require(_0xcc66('0x2'));var BPromise=require(_0xcc66('0x3'));var rp=require(_0xcc66('0x4'));var fs=require('fs');var path=require(_0xcc66('0x5'));var rimraf=require(_0xcc66('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xcc66('0x7')]=function(_0x2472d6,_0x35a04f){return _0x2472d6[_0xcc66('0x8')](_0xcc66('0x9'),attributes,{'tableName':_0xcc66('0xa'),'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 209624a..69d7d60 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 _0x6964=['request\x20sent','debug','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','findAll','options','raw','where','attributes','limit','map','include','model','GetSalesforceAccount','ShowSalesforceAccount','SalesforceAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6964,0x11c));var _0x4696=function(_0xe1a3a5,_0xd3e341){_0xe1a3a5=_0xe1a3a5-0x0;var _0x362646=_0x6964[_0xe1a3a5];return _0x362646;};'use strict';var _=require(_0x4696('0x0'));var util=require(_0x4696('0x1'));var moment=require('moment');var BPromise=require(_0x4696('0x2'));var rs=require(_0x4696('0x3'));var fs=require('fs');var Redis=require(_0x4696('0x4'));var db=require(_0x4696('0x5'))['db'];var utils=require(_0x4696('0x6'));var logger=require(_0x4696('0x7'))(_0x4696('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4696('0x9')][_0x4696('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c8e84,_0x45eb6c,_0x187191){return new BPromise(function(_0x4ef636,_0x514efb){return client['request'](_0x1c8e84,_0x187191)[_0x4696('0xb')](function(_0x3f5796){logger[_0x4696('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x45eb6c,_0x4696('0xd'));logger[_0x4696('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x45eb6c,'request\x20sent',JSON[_0x4696('0xf')](_0x3f5796));if(_0x3f5796[_0x4696('0x10')]){if(_0x3f5796[_0x4696('0x10')][_0x4696('0x11')]===0x1f4){logger[_0x4696('0x10')](_0x4696('0x12'),_0x45eb6c,_0x3f5796[_0x4696('0x10')][_0x4696('0x13')]);return _0x514efb(_0x3f5796['error'][_0x4696('0x13')]);}logger[_0x4696('0x10')](_0x4696('0x12'),_0x45eb6c,_0x3f5796['error']['message']);return _0x4ef636(_0x3f5796[_0x4696('0x10')][_0x4696('0x13')]);}else{logger[_0x4696('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x45eb6c,_0x4696('0xd'));_0x4ef636(_0x3f5796[_0x4696('0x14')]['message']);}})['catch'](function(_0x304d6f){logger[_0x4696('0x10')](_0x4696('0x12'),_0x45eb6c,_0x304d6f);_0x514efb(_0x304d6f);});});}exports['GetSalesforceAccount']=function(_0x5b22a5){var _0x55d71a=this;return new Promise(function(_0x34ba07,_0x2923c1){return db['SalesforceAccount'][_0x4696('0x15')]({'raw':_0x5b22a5['options']?_0x5b22a5[_0x4696('0x16')][_0x4696('0x17')]===undefined?!![]:![]:!![],'where':_0x5b22a5[_0x4696('0x16')]?_0x5b22a5[_0x4696('0x16')][_0x4696('0x18')]||null:null,'attributes':_0x5b22a5[_0x4696('0x16')]?_0x5b22a5[_0x4696('0x16')][_0x4696('0x19')]||null:null,'limit':_0x5b22a5[_0x4696('0x16')]?_0x5b22a5['options'][_0x4696('0x1a')]||null:null,'include':_0x5b22a5[_0x4696('0x16')]?_0x5b22a5[_0x4696('0x16')]['include']?_[_0x4696('0x1b')](_0x5b22a5[_0x4696('0x16')][_0x4696('0x1c')],function(_0x2eb8ba){return{'model':db[_0x2eb8ba[_0x4696('0x1d')]],'as':_0x2eb8ba['as'],'attributes':_0x2eb8ba[_0x4696('0x19')],'include':_0x2eb8ba[_0x4696('0x1c')]?_['map'](_0x2eb8ba[_0x4696('0x1c')],function(_0x325b16){return{'model':db[_0x325b16[_0x4696('0x1d')]],'as':_0x325b16['as'],'attributes':_0x325b16[_0x4696('0x19')],'include':_0x325b16[_0x4696('0x1c')]?_[_0x4696('0x1b')](_0x325b16[_0x4696('0x1c')],function(_0x14f2da){return{'model':db[_0x14f2da[_0x4696('0x1d')]],'as':_0x14f2da['as'],'attributes':_0x14f2da['attributes']};}):[]};}):[]};}):[]:[]})[_0x4696('0xb')](function(_0x32d11b){logger[_0x4696('0xc')]('GetSalesforceAccount',_0x5b22a5);logger['debug'](_0x4696('0x1e'),_0x5b22a5,JSON[_0x4696('0xf')](_0x32d11b));_0x34ba07(_0x32d11b);})['catch'](function(_0x4b4c55){logger[_0x4696('0x10')](_0x4696('0x1e'),_0x4b4c55[_0x4696('0x13')],_0x5b22a5);_0x2923c1(_0x55d71a[_0x4696('0x10')](0x1f4,_0x4b4c55['message']));});});};exports[_0x4696('0x1f')]=function(_0x1c006f){var _0x18117f=this;return new Promise(function(_0x3f5d0c,_0x54da7f){return db[_0x4696('0x20')]['find']({'raw':_0x1c006f[_0x4696('0x16')]?_0x1c006f[_0x4696('0x16')][_0x4696('0x17')]===undefined?!![]:![]:!![],'where':_0x1c006f[_0x4696('0x16')]?_0x1c006f['options'][_0x4696('0x18')]||null:null,'attributes':_0x1c006f['options']?_0x1c006f[_0x4696('0x16')]['attributes']||null:null,'include':_0x1c006f['options']?_0x1c006f[_0x4696('0x16')]['include']?_[_0x4696('0x1b')](_0x1c006f['options'][_0x4696('0x1c')],function(_0x3a7e52){return{'model':db[_0x3a7e52[_0x4696('0x1d')]],'as':_0x3a7e52['as'],'attributes':_0x3a7e52[_0x4696('0x19')],'include':_0x3a7e52[_0x4696('0x1c')]?_[_0x4696('0x1b')](_0x3a7e52[_0x4696('0x1c')],function(_0x22426d){return{'model':db[_0x22426d['model']],'as':_0x22426d['as'],'attributes':_0x22426d[_0x4696('0x19')],'include':_0x22426d['include']?_[_0x4696('0x1b')](_0x22426d['include'],function(_0x5ea755){return{'model':db[_0x5ea755[_0x4696('0x1d')]],'as':_0x5ea755['as'],'attributes':_0x5ea755[_0x4696('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x304c2c){logger[_0x4696('0xc')]('ShowSalesforceAccount',_0x1c006f);logger[_0x4696('0xe')](_0x4696('0x1f'),_0x1c006f,JSON[_0x4696('0xf')](_0x304c2c));_0x3f5d0c(_0x304c2c);})['catch'](function(_0x1a851e){logger[_0x4696('0x10')]('ShowSalesforceAccount',_0x1a851e[_0x4696('0x13')],_0x1c006f);_0x54da7f(_0x18117f['error'](0x1f4,_0x1a851e[_0x4696('0x13')]));});});}; \ No newline at end of file +var _0x68bc=['findAll','options','raw','limit','include','model','attributes','map','then','GetSalesforceAccount','find','where','ShowSalesforceAccount','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','SalesforceAccount'];(function(_0x591cfd,_0x501204){var _0x4d0100=function(_0xb9ff0c){while(--_0xb9ff0c){_0x591cfd['push'](_0x591cfd['shift']());}};_0x4d0100(++_0x501204);}(_0x68bc,0xbc));var _0xc68b=function(_0x16ef4c,_0x16a2d0){_0x16ef4c=_0x16ef4c-0x0;var _0x154d5e=_0x68bc[_0x16ef4c];return _0x154d5e;};'use strict';var _=require(_0xc68b('0x0'));var util=require('util');var moment=require(_0xc68b('0x1'));var BPromise=require('bluebird');var rs=require(_0xc68b('0x2'));var fs=require('fs');var Redis=require(_0xc68b('0x3'));var db=require(_0xc68b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc68b('0x5'))(_0xc68b('0x6'));var config=require(_0xc68b('0x7'));var jayson=require(_0xc68b('0x8'));var client=jayson['client'][_0xc68b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24b08f,_0x32f12a,_0x35b48a){return new BPromise(function(_0x1367fc,_0x29035b){return client[_0xc68b('0xa')](_0x24b08f,_0x35b48a)['then'](function(_0x158daa){logger[_0xc68b('0xb')](_0xc68b('0xc'),_0x32f12a,'request\x20sent');logger[_0xc68b('0xd')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x32f12a,_0xc68b('0xe'),JSON[_0xc68b('0xf')](_0x158daa));if(_0x158daa[_0xc68b('0x10')]){if(_0x158daa['error'][_0xc68b('0x11')]===0x1f4){logger[_0xc68b('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x32f12a,_0x158daa[_0xc68b('0x10')][_0xc68b('0x12')]);return _0x29035b(_0x158daa['error'][_0xc68b('0x12')]);}logger[_0xc68b('0x10')](_0xc68b('0xc'),_0x32f12a,_0x158daa['error'][_0xc68b('0x12')]);return _0x1367fc(_0x158daa[_0xc68b('0x10')]['message']);}else{logger['info'](_0xc68b('0xc'),_0x32f12a,'request\x20sent');_0x1367fc(_0x158daa[_0xc68b('0x13')][_0xc68b('0x12')]);}})[_0xc68b('0x14')](function(_0x2aa925){logger[_0xc68b('0x10')](_0xc68b('0xc'),_0x32f12a,_0x2aa925);_0x29035b(_0x2aa925);});});}exports['GetSalesforceAccount']=function(_0xdc96ab){var _0x19ef67=this;return new Promise(function(_0x27174d,_0x5e236a){return db[_0xc68b('0x15')][_0xc68b('0x16')]({'raw':_0xdc96ab[_0xc68b('0x17')]?_0xdc96ab[_0xc68b('0x17')][_0xc68b('0x18')]===undefined?!![]:![]:!![],'where':_0xdc96ab[_0xc68b('0x17')]?_0xdc96ab[_0xc68b('0x17')]['where']||null:null,'attributes':_0xdc96ab[_0xc68b('0x17')]?_0xdc96ab['options']['attributes']||null:null,'limit':_0xdc96ab[_0xc68b('0x17')]?_0xdc96ab[_0xc68b('0x17')][_0xc68b('0x19')]||null:null,'include':_0xdc96ab[_0xc68b('0x17')]?_0xdc96ab[_0xc68b('0x17')][_0xc68b('0x1a')]?_['map'](_0xdc96ab[_0xc68b('0x17')]['include'],function(_0x38f759){return{'model':db[_0x38f759[_0xc68b('0x1b')]],'as':_0x38f759['as'],'attributes':_0x38f759[_0xc68b('0x1c')],'include':_0x38f759['include']?_[_0xc68b('0x1d')](_0x38f759[_0xc68b('0x1a')],function(_0x11c5d){return{'model':db[_0x11c5d[_0xc68b('0x1b')]],'as':_0x11c5d['as'],'attributes':_0x11c5d[_0xc68b('0x1c')],'include':_0x11c5d['include']?_[_0xc68b('0x1d')](_0x11c5d['include'],function(_0x647bea){return{'model':db[_0x647bea[_0xc68b('0x1b')]],'as':_0x647bea['as'],'attributes':_0x647bea[_0xc68b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc68b('0x1e')](function(_0x417533){logger[_0xc68b('0xb')](_0xc68b('0x1f'),_0xdc96ab);logger[_0xc68b('0xd')](_0xc68b('0x1f'),_0xdc96ab,JSON['stringify'](_0x417533));_0x27174d(_0x417533);})[_0xc68b('0x14')](function(_0x23a862){logger[_0xc68b('0x10')](_0xc68b('0x1f'),_0x23a862[_0xc68b('0x12')],_0xdc96ab);_0x5e236a(_0x19ef67[_0xc68b('0x10')](0x1f4,_0x23a862[_0xc68b('0x12')]));});});};exports['ShowSalesforceAccount']=function(_0x2ef82f){var _0x412ce8=this;return new Promise(function(_0x2e1699,_0x7d8830){return db['SalesforceAccount'][_0xc68b('0x20')]({'raw':_0x2ef82f['options']?_0x2ef82f[_0xc68b('0x17')][_0xc68b('0x18')]===undefined?!![]:![]:!![],'where':_0x2ef82f['options']?_0x2ef82f[_0xc68b('0x17')][_0xc68b('0x21')]||null:null,'attributes':_0x2ef82f[_0xc68b('0x17')]?_0x2ef82f[_0xc68b('0x17')][_0xc68b('0x1c')]||null:null,'include':_0x2ef82f[_0xc68b('0x17')]?_0x2ef82f[_0xc68b('0x17')][_0xc68b('0x1a')]?_[_0xc68b('0x1d')](_0x2ef82f[_0xc68b('0x17')][_0xc68b('0x1a')],function(_0x4718a1){return{'model':db[_0x4718a1[_0xc68b('0x1b')]],'as':_0x4718a1['as'],'attributes':_0x4718a1[_0xc68b('0x1c')],'include':_0x4718a1[_0xc68b('0x1a')]?_[_0xc68b('0x1d')](_0x4718a1[_0xc68b('0x1a')],function(_0x2a095b){return{'model':db[_0x2a095b[_0xc68b('0x1b')]],'as':_0x2a095b['as'],'attributes':_0x2a095b[_0xc68b('0x1c')],'include':_0x2a095b[_0xc68b('0x1a')]?_['map'](_0x2a095b[_0xc68b('0x1a')],function(_0x571b0d){return{'model':db[_0x571b0d[_0xc68b('0x1b')]],'as':_0x571b0d['as'],'attributes':_0x571b0d[_0xc68b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc68b('0x1e')](function(_0x527d89){logger[_0xc68b('0xb')]('ShowSalesforceAccount',_0x2ef82f);logger[_0xc68b('0xd')](_0xc68b('0x22'),_0x2ef82f,JSON[_0xc68b('0xf')](_0x527d89));_0x2e1699(_0x527d89);})[_0xc68b('0x14')](function(_0x23bd5f){logger[_0xc68b('0x10')](_0xc68b('0x22'),_0x23bd5f['message'],_0x2ef82f);_0x7d8830(_0x412ce8[_0xc68b('0x10')](0x1f4,_0x23bd5f['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 4d4d1fe..f358a35 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 _0x0b0e=['post','create','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1a5946,_0x426991){_0x1a5946=_0x1a5946-0x0;var _0x25e9d5=_0x0b0e[_0x1a5946];return _0x25e9d5;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['getFields']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/descriptions',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x15')]);router['delete'](_0xe0b0('0x14'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x16')]);module[_0xe0b0('0x17')]=router; \ No newline at end of file +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(_0x2bfed1,_0x3b983e){var _0x41ec8d=function(_0x3c7786){while(--_0x3c7786){_0x2bfed1['push'](_0x2bfed1['shift']());}};_0x41ec8d(++_0x3b983e);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'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 ed9ff55..3f2c27e 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 _0xd876=['lead','account_contact_lead','account','sequelize','STRING','Case','Task','ENUM','contact_lead','contact'];(function(_0x4a4922,_0x82cb8f){var _0x55a8c6=function(_0x59712e){while(--_0x59712e){_0x4a4922['push'](_0x4a4922['shift']());}};_0x55a8c6(++_0x82cb8f);}(_0xd876,0x11b));var _0x6d87=function(_0x5c1898,_0x12825b){_0x5c1898=_0x5c1898-0x0;var _0x45e004=_0xd876[_0x5c1898];return _0x45e004;};'use strict';var Sequelize=require(_0x6d87('0x0'));module['exports']={'name':{'type':Sequelize[_0x6d87('0x1')]},'description':{'type':Sequelize[_0x6d87('0x1')]},'ticketType':{'type':Sequelize['ENUM']('Task',_0x6d87('0x2')),'defaultValue':_0x6d87('0x3')},'moduleSearch':{'type':Sequelize[_0x6d87('0x4')](_0x6d87('0x5'),_0x6d87('0x6'),_0x6d87('0x7'),_0x6d87('0x8'),_0x6d87('0x9')),'defaultValue':_0x6d87('0x5')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0x6d87('0x6'),_0x6d87('0x7'),_0x6d87('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x6d87('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x6d87('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x6d87('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9172=['Case','contact_lead','contact','lead','account','ENUM','nothing','sequelize','exports','STRING','Task'];(function(_0x3e7ca6,_0xde4ce5){var _0x4716bb=function(_0x28d921){while(--_0x28d921){_0x3e7ca6['push'](_0x3e7ca6['shift']());}};_0x4716bb(++_0xde4ce5);}(_0x9172,0x19e));var _0x2917=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x9172[_0x411017];return _0x2adeea;};'use strict';var Sequelize=require(_0x2917('0x0'));module[_0x2917('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2917('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x2917('0x3'),_0x2917('0x4')),'defaultValue':_0x2917('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0x2917('0x5'),_0x2917('0x6'),_0x2917('0x7'),'account_contact_lead',_0x2917('0x8')),'defaultValue':_0x2917('0x5')},'moduleCreate':{'type':Sequelize[_0x2917('0x9')](_0x2917('0xa'),_0x2917('0x6'),_0x2917('0x7'),_0x2917('0x8')),'defaultValue':_0x2917('0x7')},'leadId':{'type':Sequelize[_0x2917('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x2917('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x2917('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x2917('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 708b6e8..d34da12 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 _0x1bfd=['body','destroy','findOne','SalesforceField','getFields','length','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','then','error','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','params','keys','includeAll','find','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1bfd,0x1dc));var _0xd1bf=function(_0x378789,_0x894ede){_0x378789=_0x378789-0x0;var _0x493aa7=_0x1bfd[_0x378789];return _0x493aa7;};'use strict';var emlformat=require(_0xd1bf('0x0'));var rimraf=require(_0xd1bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd1bf('0x2'));var rp=require(_0xd1bf('0x3'));var moment=require(_0xd1bf('0x4'));var BPromise=require(_0xd1bf('0x5'));var Mustache=require(_0xd1bf('0x6'));var util=require(_0xd1bf('0x7'));var path=require(_0xd1bf('0x8'));var sox=require(_0xd1bf('0x9'));var csv=require(_0xd1bf('0xa'));var ejs=require(_0xd1bf('0xb'));var fs=require('fs');var fs_extra=require(_0xd1bf('0xc'));var _=require(_0xd1bf('0xd'));var squel=require('squel');var crypto=require(_0xd1bf('0xe'));var jsforce=require(_0xd1bf('0xf'));var deskjs=require(_0xd1bf('0x10'));var toCsv=require(_0xd1bf('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd1bf('0x11'));var authService=require(_0xd1bf('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd1bf('0x13'));var logger=require(_0xd1bf('0x14'))(_0xd1bf('0x15'));var utils=require('../../config/utils');var config=require(_0xd1bf('0x16'));var licenseUtil=require(_0xd1bf('0x17'));var db=require(_0xd1bf('0x18'))['db'];function respondWithStatusCode(_0x4f9f3e,_0x5d75ec){_0x5d75ec=_0x5d75ec||0xcc;return function(_0x211661){if(_0x211661){return _0x4f9f3e[_0xd1bf('0x19')](_0x5d75ec);}return _0x4f9f3e[_0xd1bf('0x1a')](_0x5d75ec)[_0xd1bf('0x1b')]();};}function respondWithResult(_0x575766,_0x3c227c){_0x3c227c=_0x3c227c||0xc8;return function(_0x7e22a0){if(_0x7e22a0){return _0x575766[_0xd1bf('0x1a')](_0x3c227c)['json'](_0x7e22a0);}};}function respondWithFilteredResult(_0x28707d,_0x1d9448){return function(_0x40d52a){if(_0x40d52a){var _0x362454=typeof _0x1d9448['offset']===_0xd1bf('0x1c')&&typeof _0x1d9448[_0xd1bf('0x1d')]===_0xd1bf('0x1c');var _0x2e7535=_0x40d52a[_0xd1bf('0x1e')];var _0x5c8165=_0x362454?0x0:_0x1d9448[_0xd1bf('0x1f')];var _0x33f2f6=_0x362454?_0x40d52a['count']:_0x1d9448[_0xd1bf('0x1f')]+_0x1d9448[_0xd1bf('0x1d')];var _0x45e4d2;if(_0x33f2f6>=_0x2e7535){_0x33f2f6=_0x2e7535;_0x45e4d2=0xc8;}else{_0x45e4d2=0xce;}_0x28707d['status'](_0x45e4d2);return _0x28707d[_0xd1bf('0x20')](_0xd1bf('0x21'),_0x5c8165+'-'+_0x33f2f6+'/'+_0x2e7535)[_0xd1bf('0x22')](_0x40d52a);}return null;};}function patchUpdates(_0x34e56d){return function(_0x10f3f7){try{jsonpatch[_0xd1bf('0x23')](_0x10f3f7,_0x34e56d,!![]);}catch(_0x5df9a9){return BPromise[_0xd1bf('0x24')](_0x5df9a9);}return _0x10f3f7['save']();};}function saveUpdates(_0x2901d6,_0x382b24){return function(_0x2e1aef){if(_0x2e1aef){return _0x2e1aef[_0xd1bf('0x25')](_0x2901d6)[_0xd1bf('0x26')](function(_0x539356){return _0x539356;});}return null;};}function removeEntity(_0xf1a9d0,_0xd19cac){return function(_0x162481){if(_0x162481){return _0x162481['destroy']()[_0xd1bf('0x26')](function(){_0xf1a9d0[_0xd1bf('0x1a')](0xcc)[_0xd1bf('0x1b')]();});}};}function handleEntityNotFound(_0x1c0591,_0x3761d3){return function(_0x11ecad){if(!_0x11ecad){_0x1c0591[_0xd1bf('0x19')](0x194);}return _0x11ecad;};}function handleError(_0x27c3b9,_0x1cdfab){_0x1cdfab=_0x1cdfab||0x1f4;return function(_0x1f8df4){logger[_0xd1bf('0x27')](_0x1f8df4['stack']);if(_0x1f8df4['name']){delete _0x1f8df4['name'];}_0x27c3b9[_0xd1bf('0x1a')](_0x1cdfab)[_0xd1bf('0x28')](_0x1f8df4);};}exports['index']=function(_0x3f83cc,_0xf976b){var _0x5c95d3={},_0x3e518f={},_0x5b15ca={'count':0x0,'rows':[]};var _0x400863=_[_0xd1bf('0x29')](db[_0xd1bf('0x2a')][_0xd1bf('0x2b')],function(_0x1c4beb){return{'name':_0x1c4beb[_0xd1bf('0x2c')],'type':_0x1c4beb[_0xd1bf('0x2d')]['key']};});_0x3e518f[_0xd1bf('0x2e')]=_[_0xd1bf('0x29')](_0x400863,'name');_0x3e518f['query']=_['keys'](_0x3f83cc['query']);_0x3e518f[_0xd1bf('0x2f')]=_[_0xd1bf('0x30')](_0x3e518f[_0xd1bf('0x2e')],_0x3e518f[_0xd1bf('0x31')]);_0x5c95d3[_0xd1bf('0x32')]=_[_0xd1bf('0x30')](_0x3e518f[_0xd1bf('0x2e')],qs['fields'](_0x3f83cc[_0xd1bf('0x31')][_0xd1bf('0x33')]));_0x5c95d3[_0xd1bf('0x32')]=_0x5c95d3[_0xd1bf('0x32')]['length']?_0x5c95d3[_0xd1bf('0x32')]:_0x3e518f['model'];if(!_0x3f83cc[_0xd1bf('0x31')][_0xd1bf('0x34')](_0xd1bf('0x35'))){_0x5c95d3['limit']=qs[_0xd1bf('0x1d')](_0x3f83cc[_0xd1bf('0x31')]['limit']);_0x5c95d3[_0xd1bf('0x1f')]=qs[_0xd1bf('0x1f')](_0x3f83cc['query'][_0xd1bf('0x1f')]);}_0x5c95d3[_0xd1bf('0x36')]=qs[_0xd1bf('0x37')](_0x3f83cc[_0xd1bf('0x31')][_0xd1bf('0x37')]);_0x5c95d3[_0xd1bf('0x38')]=qs['filters'](_[_0xd1bf('0x39')](_0x3f83cc['query'],_0x3e518f['filters']),_0x400863);if(_0x3f83cc[_0xd1bf('0x31')][_0xd1bf('0x3a')]){_0x5c95d3['where']=_['merge'](_0x5c95d3[_0xd1bf('0x38')],{'$or':_[_0xd1bf('0x29')](_0x400863,function(_0xc02901){if(_0xc02901[_0xd1bf('0x2d')]!==_0xd1bf('0x3b')){var _0x1b0a5c={};_0x1b0a5c[_0xc02901['name']]={'$like':'%'+_0x3f83cc[_0xd1bf('0x31')][_0xd1bf('0x3a')]+'%'};return _0x1b0a5c;}})});}_0x5c95d3=_[_0xd1bf('0x3c')]({},_0x5c95d3,_0x3f83cc[_0xd1bf('0x3d')]);var _0x457e18={'where':_0x5c95d3[_0xd1bf('0x38')]};return db[_0xd1bf('0x2a')][_0xd1bf('0x1e')](_0x457e18)[_0xd1bf('0x26')](function(_0x28aef){_0x5b15ca[_0xd1bf('0x1e')]=_0x28aef;if(_0x3f83cc[_0xd1bf('0x31')]['includeAll']){_0x5c95d3[_0xd1bf('0x3e')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xd1bf('0x3f')](_0x5c95d3);})[_0xd1bf('0x26')](function(_0x723f93){_0x5b15ca['rows']=_0x723f93;return _0x5b15ca;})[_0xd1bf('0x26')](respondWithFilteredResult(_0xf976b,_0x5c95d3))[_0xd1bf('0x40')](handleError(_0xf976b,null));};exports['show']=function(_0x428361,_0x4814a7){var _0x49df2e={'raw':![],'where':{'id':_0x428361[_0xd1bf('0x41')]['id']}},_0x138285={};_0x138285[_0xd1bf('0x2e')]=_[_0xd1bf('0x42')](db['SalesforceConfiguration'][_0xd1bf('0x2b')]);_0x138285[_0xd1bf('0x31')]=_[_0xd1bf('0x42')](_0x428361[_0xd1bf('0x31')]);_0x138285[_0xd1bf('0x2f')]=_['intersection'](_0x138285[_0xd1bf('0x2e')],_0x138285[_0xd1bf('0x31')]);_0x49df2e[_0xd1bf('0x32')]=_[_0xd1bf('0x30')](_0x138285['model'],qs[_0xd1bf('0x33')](_0x428361[_0xd1bf('0x31')][_0xd1bf('0x33')]));_0x49df2e[_0xd1bf('0x32')]=_0x49df2e[_0xd1bf('0x32')]['length']?_0x49df2e[_0xd1bf('0x32')]:_0x138285[_0xd1bf('0x2e')];if(_0x428361['query'][_0xd1bf('0x43')]){_0x49df2e[_0xd1bf('0x3e')]=[{'all':!![]}];}_0x49df2e=_[_0xd1bf('0x3c')]({},_0x49df2e,_0x428361[_0xd1bf('0x3d')]);return db[_0xd1bf('0x2a')][_0xd1bf('0x44')](_0x49df2e)[_0xd1bf('0x26')](handleEntityNotFound(_0x4814a7,null))[_0xd1bf('0x26')](respondWithResult(_0x4814a7,null))['catch'](handleError(_0x4814a7,null));};exports[_0xd1bf('0x45')]=function(_0xea929c,_0x4e2fc5){return db[_0xd1bf('0x2a')][_0xd1bf('0x45')](_0xea929c['body'],{})[_0xd1bf('0x26')](respondWithResult(_0x4e2fc5,0xc9))['catch'](handleError(_0x4e2fc5,null));};exports[_0xd1bf('0x25')]=function(_0x4a0e21,_0x45a8ca){if(_0x4a0e21[_0xd1bf('0x46')]['id']){delete _0x4a0e21['body']['id'];}return db['SalesforceConfiguration'][_0xd1bf('0x44')]({'where':{'id':_0x4a0e21[_0xd1bf('0x41')]['id']}})[_0xd1bf('0x26')](handleEntityNotFound(_0x45a8ca,null))[_0xd1bf('0x26')](saveUpdates(_0x4a0e21[_0xd1bf('0x46')],null))[_0xd1bf('0x26')](respondWithResult(_0x45a8ca,null))[_0xd1bf('0x40')](handleError(_0x45a8ca,null));};exports[_0xd1bf('0x47')]=function(_0x473944,_0x352360){return db['SalesforceConfiguration'][_0xd1bf('0x44')]({'where':{'id':_0x473944[_0xd1bf('0x41')]['id']}})[_0xd1bf('0x26')](handleEntityNotFound(_0x352360,null))[_0xd1bf('0x26')](removeEntity(_0x352360,null))[_0xd1bf('0x40')](handleError(_0x352360,null));};exports['getFields']=function(_0x2144cf,_0xa8b037,_0x1d3d8b){var _0x52638b={};var _0x274c0e={};var _0x1bd006;var _0x18d41f;return db[_0xd1bf('0x2a')][_0xd1bf('0x48')]({'where':{'id':_0x2144cf['params']['id']}})[_0xd1bf('0x26')](handleEntityNotFound(_0xa8b037,null))[_0xd1bf('0x26')](function(_0x4c79fe){if(_0x4c79fe){_0x1bd006=_0x4c79fe;_0x274c0e['model']=_[_0xd1bf('0x42')](db[_0xd1bf('0x49')][_0xd1bf('0x2b')]);_0x274c0e[_0xd1bf('0x31')]=_[_0xd1bf('0x42')](_0x2144cf[_0xd1bf('0x31')]);_0x274c0e['filters']=_[_0xd1bf('0x30')](_0x274c0e['model'],_0x274c0e[_0xd1bf('0x31')]);_0x52638b[_0xd1bf('0x32')]=_[_0xd1bf('0x30')](_0x274c0e[_0xd1bf('0x2e')],qs[_0xd1bf('0x33')](_0x2144cf['query'][_0xd1bf('0x33')]));_0x52638b[_0xd1bf('0x32')]=_0x52638b[_0xd1bf('0x32')]['length']?_0x52638b['attributes']:_0x274c0e[_0xd1bf('0x2e')];_0x52638b[_0xd1bf('0x36')]=qs[_0xd1bf('0x37')](_0x2144cf['query'][_0xd1bf('0x37')]);_0x52638b[_0xd1bf('0x38')]=qs[_0xd1bf('0x2f')](_['pick'](_0x2144cf[_0xd1bf('0x31')],_0x274c0e['filters']));if(_0x2144cf[_0xd1bf('0x31')]['filter']){_0x52638b[_0xd1bf('0x38')]=_[_0xd1bf('0x3c')](_0x52638b['where'],{'$or':_[_0xd1bf('0x29')](_0x52638b[_0xd1bf('0x32')],function(_0x3af6f9){var _0x30a2c2={};_0x30a2c2[_0x3af6f9]={'$like':'%'+_0x2144cf[_0xd1bf('0x31')][_0xd1bf('0x3a')]+'%'};return _0x30a2c2;})});}_0x52638b=_[_0xd1bf('0x3c')]({},_0x52638b,_0x2144cf[_0xd1bf('0x3d')]);return _0x1bd006[_0xd1bf('0x4a')](_0x52638b);}})[_0xd1bf('0x26')](function(_0x3999e7){if(_0x3999e7){_0x18d41f=_0x3999e7[_0xd1bf('0x4b')];if(!_0x2144cf[_0xd1bf('0x31')][_0xd1bf('0x34')](_0xd1bf('0x35'))){_0x52638b['limit']=qs[_0xd1bf('0x1d')](_0x2144cf[_0xd1bf('0x31')][_0xd1bf('0x1d')]);_0x52638b[_0xd1bf('0x1f')]=qs[_0xd1bf('0x1f')](_0x2144cf[_0xd1bf('0x31')][_0xd1bf('0x1f')]);}return _0x1bd006[_0xd1bf('0x4a')](_0x52638b);}})['then'](function(_0x2613cd){if(_0x2613cd){return _0x2613cd?{'count':_0x18d41f,'rows':_0x2613cd}:null;}})[_0xd1bf('0x26')](respondWithResult(_0xa8b037,null))[_0xd1bf('0x40')](handleError(_0xa8b037,null));};exports[_0xd1bf('0x4c')]=function(_0x31f445,_0x1c33f7,_0x45351f){var _0x19b03d={};var _0x30b045={};var _0x4c925d;var _0x40b99f;return db[_0xd1bf('0x2a')]['findOne']({'where':{'id':_0x31f445[_0xd1bf('0x41')]['id']}})[_0xd1bf('0x26')](handleEntityNotFound(_0x1c33f7,null))[_0xd1bf('0x26')](function(_0x1d79b4){if(_0x1d79b4){_0x4c925d=_0x1d79b4;_0x30b045['model']=_[_0xd1bf('0x42')](db[_0xd1bf('0x49')][_0xd1bf('0x2b')]);_0x30b045[_0xd1bf('0x31')]=_['keys'](_0x31f445[_0xd1bf('0x31')]);_0x30b045[_0xd1bf('0x2f')]=_['intersection'](_0x30b045[_0xd1bf('0x2e')],_0x30b045['query']);_0x19b03d[_0xd1bf('0x32')]=_[_0xd1bf('0x30')](_0x30b045[_0xd1bf('0x2e')],qs[_0xd1bf('0x33')](_0x31f445['query']['fields']));_0x19b03d['attributes']=_0x19b03d[_0xd1bf('0x32')][_0xd1bf('0x4b')]?_0x19b03d['attributes']:_0x30b045[_0xd1bf('0x2e')];_0x19b03d[_0xd1bf('0x36')]=qs[_0xd1bf('0x37')](_0x31f445[_0xd1bf('0x31')]['sort']);_0x19b03d[_0xd1bf('0x38')]=qs[_0xd1bf('0x2f')](_[_0xd1bf('0x39')](_0x31f445[_0xd1bf('0x31')],_0x30b045[_0xd1bf('0x2f')]));if(_0x31f445[_0xd1bf('0x31')][_0xd1bf('0x3a')]){_0x19b03d['where']=_[_0xd1bf('0x3c')](_0x19b03d['where'],{'$or':_[_0xd1bf('0x29')](_0x19b03d[_0xd1bf('0x32')],function(_0x260389){var _0x3fb575={};_0x3fb575[_0x260389]={'$like':'%'+_0x31f445['query']['filter']+'%'};return _0x3fb575;})});}_0x19b03d=_[_0xd1bf('0x3c')]({},_0x19b03d,_0x31f445[_0xd1bf('0x3d')]);return _0x4c925d[_0xd1bf('0x4c')](_0x19b03d);}})[_0xd1bf('0x26')](function(_0x4dfa58){if(_0x4dfa58){_0x40b99f=_0x4dfa58['length'];if(!_0x31f445[_0xd1bf('0x31')][_0xd1bf('0x34')]('nolimit')){_0x19b03d['limit']=qs['limit'](_0x31f445[_0xd1bf('0x31')][_0xd1bf('0x1d')]);_0x19b03d['offset']=qs['offset'](_0x31f445[_0xd1bf('0x31')][_0xd1bf('0x1f')]);}return _0x4c925d[_0xd1bf('0x4c')](_0x19b03d);}})['then'](function(_0x5ceeea){if(_0x5ceeea){return _0x5ceeea?{'count':_0x40b99f,'rows':_0x5ceeea}:null;}})[_0xd1bf('0x26')](respondWithResult(_0x1c33f7,null))[_0xd1bf('0x40')](handleError(_0x1c33f7,null));};exports['getDescriptions']=function(_0x56b312,_0x1cd1dd,_0x1b439c){var _0x1b4054={};var _0x2b2d14={};var _0x5ee121;var _0x29dc78;return db[_0xd1bf('0x2a')][_0xd1bf('0x48')]({'where':{'id':_0x56b312[_0xd1bf('0x41')]['id']}})[_0xd1bf('0x26')](handleEntityNotFound(_0x1cd1dd,null))[_0xd1bf('0x26')](function(_0x7c874c){if(_0x7c874c){_0x5ee121=_0x7c874c;_0x2b2d14[_0xd1bf('0x2e')]=_[_0xd1bf('0x42')](db[_0xd1bf('0x49')][_0xd1bf('0x2b')]);_0x2b2d14[_0xd1bf('0x31')]=_[_0xd1bf('0x42')](_0x56b312[_0xd1bf('0x31')]);_0x2b2d14[_0xd1bf('0x2f')]=_[_0xd1bf('0x30')](_0x2b2d14['model'],_0x2b2d14['query']);_0x1b4054['attributes']=_['intersection'](_0x2b2d14[_0xd1bf('0x2e')],qs[_0xd1bf('0x33')](_0x56b312[_0xd1bf('0x31')][_0xd1bf('0x33')]));_0x1b4054[_0xd1bf('0x32')]=_0x1b4054['attributes'][_0xd1bf('0x4b')]?_0x1b4054[_0xd1bf('0x32')]:_0x2b2d14[_0xd1bf('0x2e')];_0x1b4054[_0xd1bf('0x36')]=qs['sort'](_0x56b312['query'][_0xd1bf('0x37')]);_0x1b4054['where']=qs[_0xd1bf('0x2f')](_['pick'](_0x56b312['query'],_0x2b2d14[_0xd1bf('0x2f')]));if(_0x56b312['query'][_0xd1bf('0x3a')]){_0x1b4054['where']=_[_0xd1bf('0x3c')](_0x1b4054[_0xd1bf('0x38')],{'$or':_[_0xd1bf('0x29')](_0x1b4054[_0xd1bf('0x32')],function(_0x14cb89){var _0x1ef68a={};_0x1ef68a[_0x14cb89]={'$like':'%'+_0x56b312['query']['filter']+'%'};return _0x1ef68a;})});}_0x1b4054=_['merge']({},_0x1b4054,_0x56b312['options']);return _0x5ee121[_0xd1bf('0x4d')](_0x1b4054);}})[_0xd1bf('0x26')](function(_0x20904e){if(_0x20904e){_0x29dc78=_0x20904e[_0xd1bf('0x4b')];if(!_0x56b312[_0xd1bf('0x31')][_0xd1bf('0x34')](_0xd1bf('0x35'))){_0x1b4054[_0xd1bf('0x1d')]=qs['limit'](_0x56b312[_0xd1bf('0x31')][_0xd1bf('0x1d')]);_0x1b4054[_0xd1bf('0x1f')]=qs[_0xd1bf('0x1f')](_0x56b312[_0xd1bf('0x31')][_0xd1bf('0x1f')]);}return _0x5ee121[_0xd1bf('0x4d')](_0x1b4054);}})[_0xd1bf('0x26')](function(_0x4d2143){if(_0x4d2143){return _0x4d2143?{'count':_0x29dc78,'rows':_0x4d2143}:null;}})[_0xd1bf('0x26')](respondWithResult(_0x1cd1dd,null))[_0xd1bf('0x40')](handleError(_0x1cd1dd,null));}; \ No newline at end of file +var _0x9ca8=['status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','sendStatus','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','SalesforceConfiguration','findAll','catch','show','find','create','body','update','params','SalesforceField','length','nolimit','getFields','findOne','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9ca8,0x123));var _0x89ca=function(_0x6182ff,_0x59d492){_0x6182ff=_0x6182ff-0x0;var _0x1cec22=_0x9ca8[_0x6182ff];return _0x1cec22;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x89ca('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x89ca('0x1'));var rp=require(_0x89ca('0x2'));var moment=require(_0x89ca('0x3'));var BPromise=require(_0x89ca('0x4'));var Mustache=require(_0x89ca('0x5'));var util=require('util');var path=require(_0x89ca('0x6'));var sox=require(_0x89ca('0x7'));var csv=require(_0x89ca('0x8'));var ejs=require(_0x89ca('0x9'));var fs=require('fs');var fs_extra=require(_0x89ca('0xa'));var _=require(_0x89ca('0xb'));var squel=require(_0x89ca('0xc'));var crypto=require(_0x89ca('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x89ca('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x89ca('0xe'));var authService=require(_0x89ca('0xf'));var qs=require(_0x89ca('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x89ca('0x11'));var logger=require(_0x89ca('0x12'))(_0x89ca('0x13'));var utils=require(_0x89ca('0x14'));var config=require(_0x89ca('0x15'));var licenseUtil=require(_0x89ca('0x16'));var db=require(_0x89ca('0x17'))['db'];function respondWithStatusCode(_0x38e8a1,_0x3a84d7){_0x3a84d7=_0x3a84d7||0xcc;return function(_0xad96e7){if(_0xad96e7){return _0x38e8a1['sendStatus'](_0x3a84d7);}return _0x38e8a1['status'](_0x3a84d7)[_0x89ca('0x18')]();};}function respondWithResult(_0x566d29,_0x5949d6){_0x5949d6=_0x5949d6||0xc8;return function(_0x27eef9){if(_0x27eef9){return _0x566d29[_0x89ca('0x19')](_0x5949d6)[_0x89ca('0x1a')](_0x27eef9);}};}function respondWithFilteredResult(_0x3d0624,_0x31f26d){return function(_0x4a1210){if(_0x4a1210){var _0x3b765c=typeof _0x31f26d[_0x89ca('0x1b')]===_0x89ca('0x1c')&&typeof _0x31f26d[_0x89ca('0x1d')]===_0x89ca('0x1c');var _0x1e8038=_0x4a1210[_0x89ca('0x1e')];var _0x53d7df=_0x3b765c?0x0:_0x31f26d[_0x89ca('0x1b')];var _0x5d8bf4=_0x3b765c?_0x4a1210[_0x89ca('0x1e')]:_0x31f26d['offset']+_0x31f26d['limit'];var _0x33d84f;if(_0x5d8bf4>=_0x1e8038){_0x5d8bf4=_0x1e8038;_0x33d84f=0xc8;}else{_0x33d84f=0xce;}_0x3d0624[_0x89ca('0x19')](_0x33d84f);return _0x3d0624[_0x89ca('0x1f')](_0x89ca('0x20'),_0x53d7df+'-'+_0x5d8bf4+'/'+_0x1e8038)[_0x89ca('0x1a')](_0x4a1210);}return null;};}function patchUpdates(_0x35d987){return function(_0x3d77eb){try{jsonpatch['apply'](_0x3d77eb,_0x35d987,!![]);}catch(_0x38dd63){return BPromise[_0x89ca('0x21')](_0x38dd63);}return _0x3d77eb[_0x89ca('0x22')]();};}function saveUpdates(_0x9fa1fd,_0x5bb555){return function(_0x2c828b){if(_0x2c828b){return _0x2c828b['update'](_0x9fa1fd)[_0x89ca('0x23')](function(_0x2d9831){return _0x2d9831;});}return null;};}function removeEntity(_0x10c31c,_0x5bfa1a){return function(_0x3f0a48){if(_0x3f0a48){return _0x3f0a48['destroy']()[_0x89ca('0x23')](function(){_0x10c31c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6c6bfb,_0xfd4210){return function(_0x4a8b81){if(!_0x4a8b81){_0x6c6bfb[_0x89ca('0x24')](0x194);}return _0x4a8b81;};}function handleError(_0xb855f8,_0x32a515){_0x32a515=_0x32a515||0x1f4;return function(_0x1bb623){logger['error'](_0x1bb623[_0x89ca('0x25')]);if(_0x1bb623[_0x89ca('0x26')]){delete _0x1bb623[_0x89ca('0x26')];}_0xb855f8[_0x89ca('0x19')](_0x32a515)[_0x89ca('0x27')](_0x1bb623);};}exports[_0x89ca('0x28')]=function(_0x3bdaac,_0x5bb673){var _0x3d0e4c={},_0x53de4c={},_0x39f91b={'count':0x0,'rows':[]};var _0x1c4cbc=_[_0x89ca('0x29')](db['SalesforceConfiguration'][_0x89ca('0x2a')],function(_0x1c3d1b){return{'name':_0x1c3d1b['fieldName'],'type':_0x1c3d1b[_0x89ca('0x2b')][_0x89ca('0x2c')]};});_0x53de4c[_0x89ca('0x2d')]=_[_0x89ca('0x29')](_0x1c4cbc,'name');_0x53de4c[_0x89ca('0x2e')]=_[_0x89ca('0x2f')](_0x3bdaac[_0x89ca('0x2e')]);_0x53de4c[_0x89ca('0x30')]=_[_0x89ca('0x31')](_0x53de4c[_0x89ca('0x2d')],_0x53de4c[_0x89ca('0x2e')]);_0x3d0e4c[_0x89ca('0x32')]=_[_0x89ca('0x31')](_0x53de4c['model'],qs[_0x89ca('0x33')](_0x3bdaac[_0x89ca('0x2e')][_0x89ca('0x33')]));_0x3d0e4c['attributes']=_0x3d0e4c[_0x89ca('0x32')]['length']?_0x3d0e4c[_0x89ca('0x32')]:_0x53de4c['model'];if(!_0x3bdaac['query'][_0x89ca('0x34')]('nolimit')){_0x3d0e4c[_0x89ca('0x1d')]=qs[_0x89ca('0x1d')](_0x3bdaac[_0x89ca('0x2e')]['limit']);_0x3d0e4c['offset']=qs[_0x89ca('0x1b')](_0x3bdaac[_0x89ca('0x2e')]['offset']);}_0x3d0e4c[_0x89ca('0x35')]=qs[_0x89ca('0x36')](_0x3bdaac[_0x89ca('0x2e')]['sort']);_0x3d0e4c['where']=qs['filters'](_[_0x89ca('0x37')](_0x3bdaac[_0x89ca('0x2e')],_0x53de4c[_0x89ca('0x30')]),_0x1c4cbc);if(_0x3bdaac['query'][_0x89ca('0x38')]){_0x3d0e4c[_0x89ca('0x39')]=_[_0x89ca('0x3a')](_0x3d0e4c[_0x89ca('0x39')],{'$or':_[_0x89ca('0x29')](_0x1c4cbc,function(_0x35ebce){if(_0x35ebce[_0x89ca('0x2b')]!==_0x89ca('0x3b')){var _0x4e87b9={};_0x4e87b9[_0x35ebce[_0x89ca('0x26')]]={'$like':'%'+_0x3bdaac[_0x89ca('0x2e')][_0x89ca('0x38')]+'%'};return _0x4e87b9;}})});}_0x3d0e4c=_['merge']({},_0x3d0e4c,_0x3bdaac[_0x89ca('0x3c')]);var _0x5cc3c6={'where':_0x3d0e4c[_0x89ca('0x39')]};return db['SalesforceConfiguration'][_0x89ca('0x1e')](_0x5cc3c6)[_0x89ca('0x23')](function(_0x9f0e1c){_0x39f91b[_0x89ca('0x1e')]=_0x9f0e1c;if(_0x3bdaac['query'][_0x89ca('0x3d')]){_0x3d0e4c[_0x89ca('0x3e')]=[{'all':!![]}];}return db[_0x89ca('0x3f')][_0x89ca('0x40')](_0x3d0e4c);})[_0x89ca('0x23')](function(_0x1a38de){_0x39f91b['rows']=_0x1a38de;return _0x39f91b;})[_0x89ca('0x23')](respondWithFilteredResult(_0x5bb673,_0x3d0e4c))[_0x89ca('0x41')](handleError(_0x5bb673,null));};exports[_0x89ca('0x42')]=function(_0x13c92b,_0x2baa1e){var _0x2bea1a={'raw':![],'where':{'id':_0x13c92b['params']['id']}},_0x155074={};_0x155074[_0x89ca('0x2d')]=_[_0x89ca('0x2f')](db[_0x89ca('0x3f')][_0x89ca('0x2a')]);_0x155074[_0x89ca('0x2e')]=_['keys'](_0x13c92b[_0x89ca('0x2e')]);_0x155074['filters']=_[_0x89ca('0x31')](_0x155074[_0x89ca('0x2d')],_0x155074['query']);_0x2bea1a['attributes']=_[_0x89ca('0x31')](_0x155074[_0x89ca('0x2d')],qs[_0x89ca('0x33')](_0x13c92b['query'][_0x89ca('0x33')]));_0x2bea1a[_0x89ca('0x32')]=_0x2bea1a[_0x89ca('0x32')]['length']?_0x2bea1a[_0x89ca('0x32')]:_0x155074[_0x89ca('0x2d')];if(_0x13c92b['query'][_0x89ca('0x3d')]){_0x2bea1a[_0x89ca('0x3e')]=[{'all':!![]}];}_0x2bea1a=_['merge']({},_0x2bea1a,_0x13c92b[_0x89ca('0x3c')]);return db['SalesforceConfiguration'][_0x89ca('0x43')](_0x2bea1a)[_0x89ca('0x23')](handleEntityNotFound(_0x2baa1e,null))[_0x89ca('0x23')](respondWithResult(_0x2baa1e,null))['catch'](handleError(_0x2baa1e,null));};exports[_0x89ca('0x44')]=function(_0x4d485f,_0x2cb09c){return db[_0x89ca('0x3f')]['create'](_0x4d485f[_0x89ca('0x45')],{})[_0x89ca('0x23')](respondWithResult(_0x2cb09c,0xc9))['catch'](handleError(_0x2cb09c,null));};exports[_0x89ca('0x46')]=function(_0x1c8aeb,_0x481527){if(_0x1c8aeb[_0x89ca('0x45')]['id']){delete _0x1c8aeb['body']['id'];}return db[_0x89ca('0x3f')][_0x89ca('0x43')]({'where':{'id':_0x1c8aeb[_0x89ca('0x47')]['id']}})[_0x89ca('0x23')](handleEntityNotFound(_0x481527,null))['then'](saveUpdates(_0x1c8aeb[_0x89ca('0x45')],null))[_0x89ca('0x23')](respondWithResult(_0x481527,null))[_0x89ca('0x41')](handleError(_0x481527,null));};exports['destroy']=function(_0x5e63be,_0x17ee4b){return db[_0x89ca('0x3f')][_0x89ca('0x43')]({'where':{'id':_0x5e63be['params']['id']}})[_0x89ca('0x23')](handleEntityNotFound(_0x17ee4b,null))['then'](removeEntity(_0x17ee4b,null))[_0x89ca('0x41')](handleError(_0x17ee4b,null));};exports['getFields']=function(_0x4974c6,_0x32362c,_0x55104a){var _0x1469bc={};var _0x1c7599={};var _0x4076db;var _0x195f11;return db[_0x89ca('0x3f')]['findOne']({'where':{'id':_0x4974c6[_0x89ca('0x47')]['id']}})[_0x89ca('0x23')](handleEntityNotFound(_0x32362c,null))[_0x89ca('0x23')](function(_0xf9439b){if(_0xf9439b){_0x4076db=_0xf9439b;_0x1c7599[_0x89ca('0x2d')]=_[_0x89ca('0x2f')](db[_0x89ca('0x48')][_0x89ca('0x2a')]);_0x1c7599[_0x89ca('0x2e')]=_['keys'](_0x4974c6[_0x89ca('0x2e')]);_0x1c7599[_0x89ca('0x30')]=_[_0x89ca('0x31')](_0x1c7599[_0x89ca('0x2d')],_0x1c7599[_0x89ca('0x2e')]);_0x1469bc[_0x89ca('0x32')]=_[_0x89ca('0x31')](_0x1c7599['model'],qs['fields'](_0x4974c6[_0x89ca('0x2e')][_0x89ca('0x33')]));_0x1469bc[_0x89ca('0x32')]=_0x1469bc['attributes']['length']?_0x1469bc[_0x89ca('0x32')]:_0x1c7599[_0x89ca('0x2d')];_0x1469bc[_0x89ca('0x35')]=qs[_0x89ca('0x36')](_0x4974c6[_0x89ca('0x2e')][_0x89ca('0x36')]);_0x1469bc[_0x89ca('0x39')]=qs[_0x89ca('0x30')](_['pick'](_0x4974c6[_0x89ca('0x2e')],_0x1c7599[_0x89ca('0x30')]));if(_0x4974c6[_0x89ca('0x2e')]['filter']){_0x1469bc['where']=_[_0x89ca('0x3a')](_0x1469bc['where'],{'$or':_['map'](_0x1469bc[_0x89ca('0x32')],function(_0x358c11){var _0x5e46f0={};_0x5e46f0[_0x358c11]={'$like':'%'+_0x4974c6[_0x89ca('0x2e')][_0x89ca('0x38')]+'%'};return _0x5e46f0;})});}_0x1469bc=_[_0x89ca('0x3a')]({},_0x1469bc,_0x4974c6[_0x89ca('0x3c')]);return _0x4076db['getFields'](_0x1469bc);}})[_0x89ca('0x23')](function(_0x19f8eb){if(_0x19f8eb){_0x195f11=_0x19f8eb[_0x89ca('0x49')];if(!_0x4974c6['query'][_0x89ca('0x34')](_0x89ca('0x4a'))){_0x1469bc['limit']=qs[_0x89ca('0x1d')](_0x4974c6[_0x89ca('0x2e')][_0x89ca('0x1d')]);_0x1469bc['offset']=qs['offset'](_0x4974c6[_0x89ca('0x2e')][_0x89ca('0x1b')]);}return _0x4076db[_0x89ca('0x4b')](_0x1469bc);}})[_0x89ca('0x23')](function(_0x4820e2){if(_0x4820e2){return _0x4820e2?{'count':_0x195f11,'rows':_0x4820e2}:null;}})['then'](respondWithResult(_0x32362c,null))[_0x89ca('0x41')](handleError(_0x32362c,null));};exports['getSubjects']=function(_0x2e7df4,_0x35f546,_0x17bf76){var _0x4afbfe={};var _0x13e2ad={};var _0x3942d8;var _0x3d18fa;return db[_0x89ca('0x3f')][_0x89ca('0x4c')]({'where':{'id':_0x2e7df4['params']['id']}})[_0x89ca('0x23')](handleEntityNotFound(_0x35f546,null))[_0x89ca('0x23')](function(_0x161765){if(_0x161765){_0x3942d8=_0x161765;_0x13e2ad[_0x89ca('0x2d')]=_[_0x89ca('0x2f')](db[_0x89ca('0x48')][_0x89ca('0x2a')]);_0x13e2ad[_0x89ca('0x2e')]=_['keys'](_0x2e7df4[_0x89ca('0x2e')]);_0x13e2ad[_0x89ca('0x30')]=_[_0x89ca('0x31')](_0x13e2ad[_0x89ca('0x2d')],_0x13e2ad[_0x89ca('0x2e')]);_0x4afbfe[_0x89ca('0x32')]=_[_0x89ca('0x31')](_0x13e2ad[_0x89ca('0x2d')],qs[_0x89ca('0x33')](_0x2e7df4[_0x89ca('0x2e')]['fields']));_0x4afbfe['attributes']=_0x4afbfe[_0x89ca('0x32')][_0x89ca('0x49')]?_0x4afbfe[_0x89ca('0x32')]:_0x13e2ad[_0x89ca('0x2d')];_0x4afbfe[_0x89ca('0x35')]=qs[_0x89ca('0x36')](_0x2e7df4[_0x89ca('0x2e')]['sort']);_0x4afbfe[_0x89ca('0x39')]=qs[_0x89ca('0x30')](_[_0x89ca('0x37')](_0x2e7df4[_0x89ca('0x2e')],_0x13e2ad[_0x89ca('0x30')]));if(_0x2e7df4[_0x89ca('0x2e')][_0x89ca('0x38')]){_0x4afbfe['where']=_[_0x89ca('0x3a')](_0x4afbfe[_0x89ca('0x39')],{'$or':_[_0x89ca('0x29')](_0x4afbfe[_0x89ca('0x32')],function(_0x2d09a0){var _0x5d5140={};_0x5d5140[_0x2d09a0]={'$like':'%'+_0x2e7df4[_0x89ca('0x2e')][_0x89ca('0x38')]+'%'};return _0x5d5140;})});}_0x4afbfe=_['merge']({},_0x4afbfe,_0x2e7df4[_0x89ca('0x3c')]);return _0x3942d8[_0x89ca('0x4d')](_0x4afbfe);}})['then'](function(_0x41808f){if(_0x41808f){_0x3d18fa=_0x41808f[_0x89ca('0x49')];if(!_0x2e7df4['query'][_0x89ca('0x34')](_0x89ca('0x4a'))){_0x4afbfe[_0x89ca('0x1d')]=qs[_0x89ca('0x1d')](_0x2e7df4['query'][_0x89ca('0x1d')]);_0x4afbfe[_0x89ca('0x1b')]=qs[_0x89ca('0x1b')](_0x2e7df4['query'][_0x89ca('0x1b')]);}return _0x3942d8['getSubjects'](_0x4afbfe);}})[_0x89ca('0x23')](function(_0xed13f5){if(_0xed13f5){return _0xed13f5?{'count':_0x3d18fa,'rows':_0xed13f5}:null;}})['then'](respondWithResult(_0x35f546,null))['catch'](handleError(_0x35f546,null));};exports[_0x89ca('0x4e')]=function(_0x5abc32,_0x9ff67b,_0x15050f){var _0x18872b={};var _0x437614={};var _0x27d25a;var _0x5afe26;return db[_0x89ca('0x3f')][_0x89ca('0x4c')]({'where':{'id':_0x5abc32[_0x89ca('0x47')]['id']}})[_0x89ca('0x23')](handleEntityNotFound(_0x9ff67b,null))[_0x89ca('0x23')](function(_0x284294){if(_0x284294){_0x27d25a=_0x284294;_0x437614[_0x89ca('0x2d')]=_[_0x89ca('0x2f')](db[_0x89ca('0x48')][_0x89ca('0x2a')]);_0x437614['query']=_[_0x89ca('0x2f')](_0x5abc32['query']);_0x437614['filters']=_[_0x89ca('0x31')](_0x437614['model'],_0x437614[_0x89ca('0x2e')]);_0x18872b['attributes']=_[_0x89ca('0x31')](_0x437614[_0x89ca('0x2d')],qs[_0x89ca('0x33')](_0x5abc32[_0x89ca('0x2e')][_0x89ca('0x33')]));_0x18872b[_0x89ca('0x32')]=_0x18872b[_0x89ca('0x32')][_0x89ca('0x49')]?_0x18872b['attributes']:_0x437614[_0x89ca('0x2d')];_0x18872b['order']=qs[_0x89ca('0x36')](_0x5abc32['query'][_0x89ca('0x36')]);_0x18872b[_0x89ca('0x39')]=qs[_0x89ca('0x30')](_[_0x89ca('0x37')](_0x5abc32[_0x89ca('0x2e')],_0x437614['filters']));if(_0x5abc32[_0x89ca('0x2e')]['filter']){_0x18872b[_0x89ca('0x39')]=_[_0x89ca('0x3a')](_0x18872b[_0x89ca('0x39')],{'$or':_[_0x89ca('0x29')](_0x18872b['attributes'],function(_0x283cfe){var _0x2ab390={};_0x2ab390[_0x283cfe]={'$like':'%'+_0x5abc32['query'][_0x89ca('0x38')]+'%'};return _0x2ab390;})});}_0x18872b=_[_0x89ca('0x3a')]({},_0x18872b,_0x5abc32['options']);return _0x27d25a['getDescriptions'](_0x18872b);}})[_0x89ca('0x23')](function(_0x536d15){if(_0x536d15){_0x5afe26=_0x536d15[_0x89ca('0x49')];if(!_0x5abc32[_0x89ca('0x2e')][_0x89ca('0x34')](_0x89ca('0x4a'))){_0x18872b[_0x89ca('0x1d')]=qs[_0x89ca('0x1d')](_0x5abc32[_0x89ca('0x2e')][_0x89ca('0x1d')]);_0x18872b[_0x89ca('0x1b')]=qs[_0x89ca('0x1b')](_0x5abc32[_0x89ca('0x2e')][_0x89ca('0x1b')]);}return _0x27d25a[_0x89ca('0x4e')](_0x18872b);}})[_0x89ca('0x23')](function(_0x16037d){if(_0x16037d){return _0x16037d?{'count':_0x5afe26,'rows':_0x16037d}:null;}})[_0x89ca('0x23')](respondWithResult(_0x9ff67b,null))['catch'](handleError(_0x9ff67b,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index bf2cfd2..b55b204 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 _0xdc84=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util'];(function(_0x4a5f3d,_0x3902a8){var _0xadc96f=function(_0x1ab8d2){while(--_0x1ab8d2){_0x4a5f3d['push'](_0x4a5f3d['shift']());}};_0xadc96f(++_0x3902a8);}(_0xdc84,0x132));var _0x4dc8=function(_0x22342c,_0x218835){_0x22342c=_0x22342c-0x0;var _0xd3b434=_0xdc84[_0x22342c];return _0xd3b434;};'use strict';var _=require(_0x4dc8('0x0'));var util=require(_0x4dc8('0x1'));var logger=require(_0x4dc8('0x2'))(_0x4dc8('0x3'));var moment=require(_0x4dc8('0x4'));var BPromise=require(_0x4dc8('0x5'));var rp=require(_0x4dc8('0x6'));var fs=require('fs');var path=require(_0x4dc8('0x7'));var rimraf=require('rimraf');var config=require(_0x4dc8('0x8'));var attributes=require(_0x4dc8('0x9'));module[_0x4dc8('0xa')]=function(_0x5df835,_0x308080){return _0x5df835[_0x4dc8('0xb')](_0x4dc8('0xc'),attributes,{'tableName':_0x4dc8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x686c=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','SalesforceConfiguration','int_salesforce_configurations','lodash'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x686c,0x99));var _0xc686=function(_0x34b6ba,_0x2ebe76){_0x34b6ba=_0x34b6ba-0x0;var _0x34779a=_0x686c[_0x34b6ba];return _0x34779a;};'use strict';var _=require(_0xc686('0x0'));var util=require(_0xc686('0x1'));var logger=require(_0xc686('0x2'))(_0xc686('0x3'));var moment=require(_0xc686('0x4'));var BPromise=require(_0xc686('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc686('0x6'));var rimraf=require(_0xc686('0x7'));var config=require(_0xc686('0x8'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x4afca6,_0x55662e){return _0x4afca6['define'](_0xc686('0x9'),attributes,{'tableName':_0xc686('0xa'),'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 13fb0d7..7ac8df2 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 _0xf2da=['http','request','then','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SalesforceConfiguration,\x20%s,\x20%s','message','info','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3b1832,_0x3e7cff){var _0x5e2bc5=function(_0x369a0e){while(--_0x369a0e){_0x3b1832['push'](_0x3b1832['shift']());}};_0x5e2bc5(++_0x3e7cff);}(_0xf2da,0xd1));var _0xaf2d=function(_0x69a451,_0x49fd37){_0x69a451=_0x69a451-0x0;var _0x3d6ef5=_0xf2da[_0x69a451];return _0x3d6ef5;};'use strict';var _=require(_0xaf2d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xaf2d('0x1'));var rs=require(_0xaf2d('0x2'));var fs=require('fs');var Redis=require(_0xaf2d('0x3'));var db=require(_0xaf2d('0x4'))['db'];var utils=require(_0xaf2d('0x5'));var logger=require(_0xaf2d('0x6'))(_0xaf2d('0x7'));var config=require(_0xaf2d('0x8'));var jayson=require(_0xaf2d('0x9'));var client=jayson[_0xaf2d('0xa')][_0xaf2d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x528f6e,_0x6bf7de,_0x1b4fa6){return new BPromise(function(_0x140270,_0xeb1d2c){return client[_0xaf2d('0xc')](_0x528f6e,_0x1b4fa6)[_0xaf2d('0xd')](function(_0x5e9a95){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x6bf7de,'request\x20sent');logger[_0xaf2d('0xe')](_0xaf2d('0xf'),_0x6bf7de,_0xaf2d('0x10'),JSON[_0xaf2d('0x11')](_0x5e9a95));if(_0x5e9a95[_0xaf2d('0x12')]){if(_0x5e9a95['error']['code']===0x1f4){logger['error'](_0xaf2d('0x13'),_0x6bf7de,_0x5e9a95['error']['message']);return _0xeb1d2c(_0x5e9a95[_0xaf2d('0x12')][_0xaf2d('0x14')]);}logger[_0xaf2d('0x12')](_0xaf2d('0x13'),_0x6bf7de,_0x5e9a95['error'][_0xaf2d('0x14')]);return _0x140270(_0x5e9a95[_0xaf2d('0x12')][_0xaf2d('0x14')]);}else{logger[_0xaf2d('0x15')](_0xaf2d('0x13'),_0x6bf7de,_0xaf2d('0x10'));_0x140270(_0x5e9a95['result'][_0xaf2d('0x14')]);}})['catch'](function(_0x15ea11){logger[_0xaf2d('0x12')](_0xaf2d('0x13'),_0x6bf7de,_0x15ea11);_0xeb1d2c(_0x15ea11);});});} \ No newline at end of file +var _0x206f=['then','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','jayson/promise','request'];(function(_0x240c08,_0x33afb6){var _0x5f7da4=function(_0x647307){while(--_0x647307){_0x240c08['push'](_0x240c08['shift']());}};_0x5f7da4(++_0x33afb6);}(_0x206f,0x13b));var _0xf206=function(_0x493c00,_0x394ea7){_0x493c00=_0x493c00-0x0;var _0x29bf37=_0x206f[_0x493c00];return _0x29bf37;};'use strict';var _=require(_0xf206('0x0'));var util=require(_0xf206('0x1'));var moment=require(_0xf206('0x2'));var BPromise=require('bluebird');var rs=require(_0xf206('0x3'));var fs=require('fs');var Redis=require(_0xf206('0x4'));var db=require(_0xf206('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf206('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4389f2,_0x3ea422,_0x527f6e){return new BPromise(function(_0x5c98ca,_0x340ebe){return client[_0xf206('0x7')](_0x4389f2,_0x527f6e)[_0xf206('0x8')](function(_0x494d28){logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x3ea422,_0xf206('0x9'));logger[_0xf206('0xa')](_0xf206('0xb'),_0x3ea422,_0xf206('0x9'),JSON[_0xf206('0xc')](_0x494d28));if(_0x494d28[_0xf206('0xd')]){if(_0x494d28[_0xf206('0xd')][_0xf206('0xe')]===0x1f4){logger[_0xf206('0xd')](_0xf206('0xf'),_0x3ea422,_0x494d28[_0xf206('0xd')][_0xf206('0x10')]);return _0x340ebe(_0x494d28[_0xf206('0xd')][_0xf206('0x10')]);}logger[_0xf206('0xd')](_0xf206('0xf'),_0x3ea422,_0x494d28['error'][_0xf206('0x10')]);return _0x5c98ca(_0x494d28[_0xf206('0xd')][_0xf206('0x10')]);}else{logger['info'](_0xf206('0xf'),_0x3ea422,_0xf206('0x9'));_0x5c98ca(_0x494d28[_0xf206('0x11')][_0xf206('0x10')]);}})[_0xf206('0x12')](function(_0x1f3342){logger[_0xf206('0xd')](_0xf206('0xf'),_0x3ea422,_0x1f3342);_0x340ebe(_0x1f3342);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 615f404..f736c8b 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 _0x1fc1=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x42be26,_0x105f3f){var _0x221b19=function(_0x3554ba){while(--_0x3554ba){_0x42be26['push'](_0x42be26['shift']());}};_0x221b19(++_0x105f3f);}(_0x1fc1,0x154));var _0x11fc=function(_0x212588,_0x2e76d8){_0x212588=_0x212588-0x0;var _0x365f74=_0x1fc1[_0x212588];return _0x365f74;};'use strict';var multer=require(_0x11fc('0x0'));var util=require(_0x11fc('0x1'));var path=require(_0x11fc('0x2'));var timeout=require('connect-timeout');var express=require(_0x11fc('0x3'));var router=express[_0x11fc('0x4')]();var fs_extra=require(_0x11fc('0x5'));var auth=require(_0x11fc('0x6'));var interaction=require(_0x11fc('0x7'));var config=require(_0x11fc('0x8'));var controller=require(_0x11fc('0x9'));router[_0x11fc('0xa')]('/',auth[_0x11fc('0xb')](),controller[_0x11fc('0xc')]);router[_0x11fc('0xa')](_0x11fc('0xd'),auth[_0x11fc('0xb')](),controller[_0x11fc('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x11fc('0xf')]);router[_0x11fc('0x10')]('/:id',auth[_0x11fc('0xb')](),controller['update']);router['delete'](_0x11fc('0xd'),auth[_0x11fc('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x428f=['./intSalesforceField.controller','get','/:id','show','post','isAuthenticated','create','put','update','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x12d93d,_0x555fa2){var _0x5a330f=function(_0x3032ac){while(--_0x3032ac){_0x12d93d['push'](_0x12d93d['shift']());}};_0x5a330f(++_0x555fa2);}(_0x428f,0x93));var _0xf428=function(_0x5935a0,_0x5eed69){_0x5935a0=_0x5935a0-0x0;var _0x4e433c=_0x428f[_0x5935a0];return _0x4e433c;};'use strict';var multer=require(_0xf428('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf428('0x1'));var express=require(_0xf428('0x2'));var router=express[_0xf428('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf428('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf428('0x5'));var controller=require(_0xf428('0x6'));router[_0xf428('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf428('0x7')](_0xf428('0x8'),auth['isAuthenticated'](),controller[_0xf428('0x9')]);router[_0xf428('0xa')]('/',auth[_0xf428('0xb')](),controller[_0xf428('0xc')]);router[_0xf428('0xd')](_0xf428('0x8'),auth[_0xf428('0xb')](),controller[_0xf428('0xe')]);router['delete']('/:id',auth[_0xf428('0xb')](),controller[_0xf428('0xf')]);module[_0xf428('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 5fa7f9f..f096dfb 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 _0x68d9=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize'];(function(_0x3465b0,_0x594297){var _0x5cabe3=function(_0x121b5f){while(--_0x121b5f){_0x3465b0['push'](_0x3465b0['shift']());}};_0x5cabe3(++_0x594297);}(_0x68d9,0x6b));var _0x968d=function(_0x54bfd5,_0x4ba093){_0x54bfd5=_0x54bfd5-0x0;var _0x9bb31e=_0x68d9[_0x54bfd5];return _0x9bb31e;};'use strict';var Sequelize=require(_0x968d('0x0'));module[_0x968d('0x1')]={'type':{'type':Sequelize[_0x968d('0x2')](_0x968d('0x3'),_0x968d('0x4'),_0x968d('0x5'),_0x968d('0x6'),_0x968d('0x7')),'defaultValue':_0x968d('0x3')},'content':{'type':Sequelize[_0x968d('0x8')]},'key':{'type':Sequelize[_0x968d('0x8')]},'keyType':{'type':Sequelize['ENUM']('string',_0x968d('0x4'),_0x968d('0x5'))},'keyContent':{'type':Sequelize[_0x968d('0x8')]},'idField':{'type':Sequelize[_0x968d('0x8')]},'variableName':{'type':Sequelize[_0x968d('0x8')]}}; \ No newline at end of file +var _0xdb01=['customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x4fc488,_0xf1704f){var _0x4ca17e=function(_0x2d4c7d){while(--_0x2d4c7d){_0x4fc488['push'](_0x4fc488['shift']());}};_0x4ca17e(++_0xf1704f);}(_0xdb01,0x1b4));var _0x1db0=function(_0x1d128e,_0x2c87de){_0x1d128e=_0x1d128e-0x0;var _0x3d5236=_0xdb01[_0x1d128e];return _0x3d5236;};'use strict';var Sequelize=require(_0x1db0('0x0'));module[_0x1db0('0x1')]={'type':{'type':Sequelize[_0x1db0('0x2')](_0x1db0('0x3'),_0x1db0('0x4'),_0x1db0('0x5'),_0x1db0('0x6'),_0x1db0('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1db0('0x8')]},'key':{'type':Sequelize[_0x1db0('0x8')]},'keyType':{'type':Sequelize[_0x1db0('0x2')]('string',_0x1db0('0x4'),_0x1db0('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1db0('0x8')]},'variableName':{'type':Sequelize[_0x1db0('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 1225bf0..09851e0 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 _0xda94=['limit','count','offset','set','Content-Range','save','update','then','destroy','error','stack','name','index','map','SalesforceField','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined'];(function(_0x2fdc1f,_0x1be5ce){var _0x1e6857=function(_0xd00861){while(--_0xd00861){_0x2fdc1f['push'](_0x2fdc1f['shift']());}};_0x1e6857(++_0x1be5ce);}(_0xda94,0x77));var _0x4da9=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xda94[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require(_0x4da9('0x0'));var rimraf=require(_0x4da9('0x1'));var zipdir=require(_0x4da9('0x2'));var jsonpatch=require(_0x4da9('0x3'));var rp=require('request-promise');var moment=require(_0x4da9('0x4'));var BPromise=require(_0x4da9('0x5'));var Mustache=require('mustache');var util=require(_0x4da9('0x6'));var path=require(_0x4da9('0x7'));var sox=require(_0x4da9('0x8'));var csv=require(_0x4da9('0x9'));var ejs=require(_0x4da9('0xa'));var fs=require('fs');var fs_extra=require(_0x4da9('0xb'));var _=require(_0x4da9('0xc'));var squel=require('squel');var crypto=require(_0x4da9('0xd'));var jsforce=require(_0x4da9('0xe'));var deskjs=require(_0x4da9('0xf'));var toCsv=require(_0x4da9('0x9'));var querystring=require(_0x4da9('0x10'));var Papa=require(_0x4da9('0x11'));var Redis=require(_0x4da9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4da9('0x13'));var as=require(_0x4da9('0x14'));var hardwareService=require(_0x4da9('0x15'));var logger=require('../../config/logger')(_0x4da9('0x16'));var utils=require(_0x4da9('0x17'));var config=require(_0x4da9('0x18'));var licenseUtil=require(_0x4da9('0x19'));var db=require(_0x4da9('0x1a'))['db'];function respondWithStatusCode(_0x16c674,_0x4fcca1){_0x4fcca1=_0x4fcca1||0xcc;return function(_0x239a1c){if(_0x239a1c){return _0x16c674[_0x4da9('0x1b')](_0x4fcca1);}return _0x16c674[_0x4da9('0x1c')](_0x4fcca1)[_0x4da9('0x1d')]();};}function respondWithResult(_0x119804,_0x30c0ee){_0x30c0ee=_0x30c0ee||0xc8;return function(_0x47f329){if(_0x47f329){return _0x119804[_0x4da9('0x1c')](_0x30c0ee)['json'](_0x47f329);}};}function respondWithFilteredResult(_0x44cda1,_0x3306df){return function(_0xdc8a10){if(_0xdc8a10){var _0x211688=typeof _0x3306df['offset']===_0x4da9('0x1e')&&typeof _0x3306df[_0x4da9('0x1f')]===_0x4da9('0x1e');var _0x290304=_0xdc8a10[_0x4da9('0x20')];var _0x58de11=_0x211688?0x0:_0x3306df[_0x4da9('0x21')];var _0x5a0fdb=_0x211688?_0xdc8a10['count']:_0x3306df[_0x4da9('0x21')]+_0x3306df[_0x4da9('0x1f')];var _0x2b75b0;if(_0x5a0fdb>=_0x290304){_0x5a0fdb=_0x290304;_0x2b75b0=0xc8;}else{_0x2b75b0=0xce;}_0x44cda1[_0x4da9('0x1c')](_0x2b75b0);return _0x44cda1[_0x4da9('0x22')](_0x4da9('0x23'),_0x58de11+'-'+_0x5a0fdb+'/'+_0x290304)['json'](_0xdc8a10);}return null;};}function patchUpdates(_0x56e1fc){return function(_0x1b3795){try{jsonpatch['apply'](_0x1b3795,_0x56e1fc,!![]);}catch(_0x1fc2c0){return BPromise['reject'](_0x1fc2c0);}return _0x1b3795[_0x4da9('0x24')]();};}function saveUpdates(_0x527369,_0x300b97){return function(_0x5a62f6){if(_0x5a62f6){return _0x5a62f6[_0x4da9('0x25')](_0x527369)[_0x4da9('0x26')](function(_0x193ad4){return _0x193ad4;});}return null;};}function removeEntity(_0x38a8c4,_0x19c508){return function(_0x45ab3d){if(_0x45ab3d){return _0x45ab3d[_0x4da9('0x27')]()[_0x4da9('0x26')](function(){_0x38a8c4[_0x4da9('0x1c')](0xcc)[_0x4da9('0x1d')]();});}};}function handleEntityNotFound(_0xa2c40f,_0x59061f){return function(_0x38e633){if(!_0x38e633){_0xa2c40f[_0x4da9('0x1b')](0x194);}return _0x38e633;};}function handleError(_0x1679ff,_0x4bf044){_0x4bf044=_0x4bf044||0x1f4;return function(_0x1b30e6){logger[_0x4da9('0x28')](_0x1b30e6[_0x4da9('0x29')]);if(_0x1b30e6[_0x4da9('0x2a')]){delete _0x1b30e6[_0x4da9('0x2a')];}_0x1679ff[_0x4da9('0x1c')](_0x4bf044)['send'](_0x1b30e6);};}exports[_0x4da9('0x2b')]=function(_0x32dabb,_0x91024d){var _0x41022d={},_0x4d3c56={},_0x5722c1={'count':0x0,'rows':[]};var _0x354aec=_[_0x4da9('0x2c')](db[_0x4da9('0x2d')]['rawAttributes'],function(_0x1017ba){return{'name':_0x1017ba[_0x4da9('0x2e')],'type':_0x1017ba[_0x4da9('0x2f')][_0x4da9('0x30')]};});_0x4d3c56['model']=_[_0x4da9('0x2c')](_0x354aec,'name');_0x4d3c56['query']=_['keys'](_0x32dabb[_0x4da9('0x31')]);_0x4d3c56[_0x4da9('0x32')]=_[_0x4da9('0x33')](_0x4d3c56[_0x4da9('0x34')],_0x4d3c56[_0x4da9('0x31')]);_0x41022d[_0x4da9('0x35')]=_['intersection'](_0x4d3c56[_0x4da9('0x34')],qs[_0x4da9('0x36')](_0x32dabb['query']['fields']));_0x41022d[_0x4da9('0x35')]=_0x41022d['attributes'][_0x4da9('0x37')]?_0x41022d[_0x4da9('0x35')]:_0x4d3c56[_0x4da9('0x34')];if(!_0x32dabb[_0x4da9('0x31')][_0x4da9('0x38')]('nolimit')){_0x41022d['limit']=qs['limit'](_0x32dabb[_0x4da9('0x31')][_0x4da9('0x1f')]);_0x41022d[_0x4da9('0x21')]=qs[_0x4da9('0x21')](_0x32dabb[_0x4da9('0x31')][_0x4da9('0x21')]);}_0x41022d['order']=qs[_0x4da9('0x39')](_0x32dabb[_0x4da9('0x31')][_0x4da9('0x39')]);_0x41022d[_0x4da9('0x3a')]=qs[_0x4da9('0x32')](_[_0x4da9('0x3b')](_0x32dabb[_0x4da9('0x31')],_0x4d3c56[_0x4da9('0x32')]),_0x354aec);if(_0x32dabb[_0x4da9('0x31')][_0x4da9('0x3c')]){_0x41022d[_0x4da9('0x3a')]=_[_0x4da9('0x3d')](_0x41022d[_0x4da9('0x3a')],{'$or':_[_0x4da9('0x2c')](_0x354aec,function(_0x56c6b0){if(_0x56c6b0['type']!==_0x4da9('0x3e')){var _0x267b1b={};_0x267b1b[_0x56c6b0[_0x4da9('0x2a')]]={'$like':'%'+_0x32dabb[_0x4da9('0x31')][_0x4da9('0x3c')]+'%'};return _0x267b1b;}})});}_0x41022d=_[_0x4da9('0x3d')]({},_0x41022d,_0x32dabb[_0x4da9('0x3f')]);var _0x5dda54={'where':_0x41022d['where']};return db[_0x4da9('0x2d')][_0x4da9('0x20')](_0x5dda54)[_0x4da9('0x26')](function(_0x86af69){_0x5722c1['count']=_0x86af69;if(_0x32dabb['query']['includeAll']){_0x41022d['include']=[{'all':!![]}];}return db['SalesforceField'][_0x4da9('0x40')](_0x41022d);})[_0x4da9('0x26')](function(_0x5e94c1){_0x5722c1[_0x4da9('0x41')]=_0x5e94c1;return _0x5722c1;})[_0x4da9('0x26')](respondWithFilteredResult(_0x91024d,_0x41022d))[_0x4da9('0x42')](handleError(_0x91024d,null));};exports[_0x4da9('0x43')]=function(_0x285c3f,_0x706e90){var _0x27c022={'raw':!![],'where':{'id':_0x285c3f[_0x4da9('0x44')]['id']}},_0x1394f7={};_0x1394f7['model']=_[_0x4da9('0x45')](db[_0x4da9('0x2d')][_0x4da9('0x46')]);_0x1394f7['query']=_[_0x4da9('0x45')](_0x285c3f['query']);_0x1394f7[_0x4da9('0x32')]=_['intersection'](_0x1394f7['model'],_0x1394f7[_0x4da9('0x31')]);_0x27c022['attributes']=_['intersection'](_0x1394f7[_0x4da9('0x34')],qs[_0x4da9('0x36')](_0x285c3f[_0x4da9('0x31')][_0x4da9('0x36')]));_0x27c022['attributes']=_0x27c022[_0x4da9('0x35')][_0x4da9('0x37')]?_0x27c022[_0x4da9('0x35')]:_0x1394f7['model'];if(_0x285c3f[_0x4da9('0x31')][_0x4da9('0x47')]){_0x27c022['include']=[{'all':!![]}];}_0x27c022=_[_0x4da9('0x3d')]({},_0x27c022,_0x285c3f[_0x4da9('0x3f')]);return db[_0x4da9('0x2d')][_0x4da9('0x48')](_0x27c022)[_0x4da9('0x26')](handleEntityNotFound(_0x706e90,null))[_0x4da9('0x26')](respondWithResult(_0x706e90,null))[_0x4da9('0x42')](handleError(_0x706e90,null));};exports[_0x4da9('0x49')]=function(_0x4c84b9,_0x500dc4){return db['SalesforceField']['create'](_0x4c84b9['body'],{})[_0x4da9('0x26')](respondWithResult(_0x500dc4,0xc9))['catch'](handleError(_0x500dc4,null));};exports['update']=function(_0x4577d3,_0x2b9987){if(_0x4577d3[_0x4da9('0x4a')]['id']){delete _0x4577d3['body']['id'];}return db[_0x4da9('0x2d')]['find']({'where':{'id':_0x4577d3['params']['id']}})['then'](handleEntityNotFound(_0x2b9987,null))[_0x4da9('0x26')](saveUpdates(_0x4577d3[_0x4da9('0x4a')],null))[_0x4da9('0x26')](respondWithResult(_0x2b9987,null))[_0x4da9('0x42')](handleError(_0x2b9987,null));};exports['destroy']=function(_0x124c3d,_0xc18c7f){return db['SalesforceField']['find']({'where':{'id':_0x124c3d[_0x4da9('0x44')]['id']}})['then'](handleEntityNotFound(_0xc18c7f,null))['then'](removeEntity(_0xc18c7f,null))[_0x4da9('0x42')](handleError(_0xc18c7f,null));}; \ No newline at end of file +var _0x00f9=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','destroy','then','stack','name','send','index','map','SalesforceField','rawAttributes','type','model','keys','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','find','create','body','eml-format','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x1b02a6,_0x74f890){var _0x31c442=function(_0x185c54){while(--_0x185c54){_0x1b02a6['push'](_0x1b02a6['shift']());}};_0x31c442(++_0x74f890);}(_0x00f9,0x1d8));var _0x900f=function(_0x57975f,_0x388556){_0x57975f=_0x57975f-0x0;var _0x4793b8=_0x00f9[_0x57975f];return _0x4793b8;};'use strict';var emlformat=require(_0x900f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x900f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x900f('0x2'));var moment=require(_0x900f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x900f('0x4'));var util=require('util');var path=require(_0x900f('0x5'));var sox=require(_0x900f('0x6'));var csv=require(_0x900f('0x7'));var ejs=require(_0x900f('0x8'));var fs=require('fs');var fs_extra=require(_0x900f('0x9'));var _=require(_0x900f('0xa'));var squel=require(_0x900f('0xb'));var crypto=require(_0x900f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x900f('0xd'));var toCsv=require(_0x900f('0x7'));var querystring=require(_0x900f('0xe'));var Papa=require(_0x900f('0xf'));var Redis=require('ioredis');var authService=require(_0x900f('0x10'));var qs=require(_0x900f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x900f('0x12'));var utils=require(_0x900f('0x13'));var config=require(_0x900f('0x14'));var licenseUtil=require(_0x900f('0x15'));var db=require(_0x900f('0x16'))['db'];function respondWithStatusCode(_0x27d2a6,_0x25be5e){_0x25be5e=_0x25be5e||0xcc;return function(_0x15e57a){if(_0x15e57a){return _0x27d2a6[_0x900f('0x17')](_0x25be5e);}return _0x27d2a6[_0x900f('0x18')](_0x25be5e)[_0x900f('0x19')]();};}function respondWithResult(_0x36cbf8,_0x1f755f){_0x1f755f=_0x1f755f||0xc8;return function(_0x339e06){if(_0x339e06){return _0x36cbf8[_0x900f('0x18')](_0x1f755f)[_0x900f('0x1a')](_0x339e06);}};}function respondWithFilteredResult(_0x4ff6f8,_0x3462be){return function(_0x5a4370){if(_0x5a4370){var _0x4a91bb=typeof _0x3462be[_0x900f('0x1b')]===_0x900f('0x1c')&&typeof _0x3462be[_0x900f('0x1d')]==='undefined';var _0xfb9552=_0x5a4370[_0x900f('0x1e')];var _0x41900f=_0x4a91bb?0x0:_0x3462be[_0x900f('0x1b')];var _0x4990a9=_0x4a91bb?_0x5a4370['count']:_0x3462be[_0x900f('0x1b')]+_0x3462be[_0x900f('0x1d')];var _0x49ce05;if(_0x4990a9>=_0xfb9552){_0x4990a9=_0xfb9552;_0x49ce05=0xc8;}else{_0x49ce05=0xce;}_0x4ff6f8[_0x900f('0x18')](_0x49ce05);return _0x4ff6f8['set']('Content-Range',_0x41900f+'-'+_0x4990a9+'/'+_0xfb9552)[_0x900f('0x1a')](_0x5a4370);}return null;};}function patchUpdates(_0x2f091f){return function(_0x5112f1){try{jsonpatch[_0x900f('0x1f')](_0x5112f1,_0x2f091f,!![]);}catch(_0x1a1988){return BPromise['reject'](_0x1a1988);}return _0x5112f1[_0x900f('0x20')]();};}function saveUpdates(_0x53627b,_0x5956f7){return function(_0x20a2e4){if(_0x20a2e4){return _0x20a2e4[_0x900f('0x21')](_0x53627b)['then'](function(_0x1b8399){return _0x1b8399;});}return null;};}function removeEntity(_0x2d1d34,_0x2591f4){return function(_0x48c663){if(_0x48c663){return _0x48c663[_0x900f('0x22')]()[_0x900f('0x23')](function(){_0x2d1d34['status'](0xcc)[_0x900f('0x19')]();});}};}function handleEntityNotFound(_0x2bc789,_0x559d7a){return function(_0x269573){if(!_0x269573){_0x2bc789[_0x900f('0x17')](0x194);}return _0x269573;};}function handleError(_0x4fd990,_0x906d05){_0x906d05=_0x906d05||0x1f4;return function(_0x488ccb){logger['error'](_0x488ccb[_0x900f('0x24')]);if(_0x488ccb[_0x900f('0x25')]){delete _0x488ccb[_0x900f('0x25')];}_0x4fd990[_0x900f('0x18')](_0x906d05)[_0x900f('0x26')](_0x488ccb);};}exports[_0x900f('0x27')]=function(_0x572327,_0x9ca01){var _0x2fdddd={},_0x4b2405={},_0x20890f={'count':0x0,'rows':[]};var _0xfb6e8a=_[_0x900f('0x28')](db[_0x900f('0x29')][_0x900f('0x2a')],function(_0x2fc375){return{'name':_0x2fc375['fieldName'],'type':_0x2fc375[_0x900f('0x2b')]['key']};});_0x4b2405[_0x900f('0x2c')]=_[_0x900f('0x28')](_0xfb6e8a,_0x900f('0x25'));_0x4b2405['query']=_[_0x900f('0x2d')](_0x572327['query']);_0x4b2405[_0x900f('0x2e')]=_[_0x900f('0x2f')](_0x4b2405[_0x900f('0x2c')],_0x4b2405[_0x900f('0x30')]);_0x2fdddd[_0x900f('0x31')]=_['intersection'](_0x4b2405['model'],qs[_0x900f('0x32')](_0x572327[_0x900f('0x30')][_0x900f('0x32')]));_0x2fdddd['attributes']=_0x2fdddd['attributes'][_0x900f('0x33')]?_0x2fdddd['attributes']:_0x4b2405[_0x900f('0x2c')];if(!_0x572327[_0x900f('0x30')]['hasOwnProperty'](_0x900f('0x34'))){_0x2fdddd['limit']=qs[_0x900f('0x1d')](_0x572327[_0x900f('0x30')][_0x900f('0x1d')]);_0x2fdddd[_0x900f('0x1b')]=qs[_0x900f('0x1b')](_0x572327[_0x900f('0x30')][_0x900f('0x1b')]);}_0x2fdddd[_0x900f('0x35')]=qs[_0x900f('0x36')](_0x572327['query'][_0x900f('0x36')]);_0x2fdddd[_0x900f('0x37')]=qs[_0x900f('0x2e')](_[_0x900f('0x38')](_0x572327['query'],_0x4b2405[_0x900f('0x2e')]),_0xfb6e8a);if(_0x572327[_0x900f('0x30')][_0x900f('0x39')]){_0x2fdddd[_0x900f('0x37')]=_['merge'](_0x2fdddd[_0x900f('0x37')],{'$or':_[_0x900f('0x28')](_0xfb6e8a,function(_0x55ac15){if(_0x55ac15[_0x900f('0x2b')]!==_0x900f('0x3a')){var _0xeca200={};_0xeca200[_0x55ac15[_0x900f('0x25')]]={'$like':'%'+_0x572327['query'][_0x900f('0x39')]+'%'};return _0xeca200;}})});}_0x2fdddd=_['merge']({},_0x2fdddd,_0x572327[_0x900f('0x3b')]);var _0x1a60d0={'where':_0x2fdddd[_0x900f('0x37')]};return db[_0x900f('0x29')][_0x900f('0x1e')](_0x1a60d0)['then'](function(_0x5b5942){_0x20890f['count']=_0x5b5942;if(_0x572327[_0x900f('0x30')][_0x900f('0x3c')]){_0x2fdddd[_0x900f('0x3d')]=[{'all':!![]}];}return db[_0x900f('0x29')][_0x900f('0x3e')](_0x2fdddd);})[_0x900f('0x23')](function(_0x22efc0){_0x20890f['rows']=_0x22efc0;return _0x20890f;})['then'](respondWithFilteredResult(_0x9ca01,_0x2fdddd))[_0x900f('0x3f')](handleError(_0x9ca01,null));};exports[_0x900f('0x40')]=function(_0x4555d6,_0x51003e){var _0x38c99b={'raw':!![],'where':{'id':_0x4555d6[_0x900f('0x41')]['id']}},_0x39e2f5={};_0x39e2f5['model']=_[_0x900f('0x2d')](db[_0x900f('0x29')][_0x900f('0x2a')]);_0x39e2f5[_0x900f('0x30')]=_['keys'](_0x4555d6[_0x900f('0x30')]);_0x39e2f5[_0x900f('0x2e')]=_[_0x900f('0x2f')](_0x39e2f5['model'],_0x39e2f5[_0x900f('0x30')]);_0x38c99b[_0x900f('0x31')]=_['intersection'](_0x39e2f5[_0x900f('0x2c')],qs[_0x900f('0x32')](_0x4555d6['query'][_0x900f('0x32')]));_0x38c99b[_0x900f('0x31')]=_0x38c99b[_0x900f('0x31')][_0x900f('0x33')]?_0x38c99b[_0x900f('0x31')]:_0x39e2f5[_0x900f('0x2c')];if(_0x4555d6[_0x900f('0x30')][_0x900f('0x3c')]){_0x38c99b['include']=[{'all':!![]}];}_0x38c99b=_[_0x900f('0x42')]({},_0x38c99b,_0x4555d6[_0x900f('0x3b')]);return db[_0x900f('0x29')][_0x900f('0x43')](_0x38c99b)[_0x900f('0x23')](handleEntityNotFound(_0x51003e,null))[_0x900f('0x23')](respondWithResult(_0x51003e,null))[_0x900f('0x3f')](handleError(_0x51003e,null));};exports[_0x900f('0x44')]=function(_0x3ba18c,_0x337f35){return db['SalesforceField'][_0x900f('0x44')](_0x3ba18c['body'],{})[_0x900f('0x23')](respondWithResult(_0x337f35,0xc9))['catch'](handleError(_0x337f35,null));};exports[_0x900f('0x21')]=function(_0x504810,_0x557056){if(_0x504810[_0x900f('0x45')]['id']){delete _0x504810[_0x900f('0x45')]['id'];}return db['SalesforceField']['find']({'where':{'id':_0x504810[_0x900f('0x41')]['id']}})['then'](handleEntityNotFound(_0x557056,null))[_0x900f('0x23')](saveUpdates(_0x504810[_0x900f('0x45')],null))['then'](respondWithResult(_0x557056,null))[_0x900f('0x3f')](handleError(_0x557056,null));};exports[_0x900f('0x22')]=function(_0x28c752,_0x463277){return db[_0x900f('0x29')][_0x900f('0x43')]({'where':{'id':_0x28c752['params']['id']}})[_0x900f('0x23')](handleEntityNotFound(_0x463277,null))['then'](removeEntity(_0x463277,null))[_0x900f('0x3f')](handleError(_0x463277,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 2c0d495..30b15ab 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 _0xb84f=['path','rimraf','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','api','moment','bluebird'];(function(_0x4c3d14,_0x16bc41){var _0x54cfde=function(_0x2d6ea5){while(--_0x2d6ea5){_0x4c3d14['push'](_0x4c3d14['shift']());}};_0x54cfde(++_0x16bc41);}(_0xb84f,0x113));var _0xfb84=function(_0x44ad29,_0x3f5205){_0x44ad29=_0x44ad29-0x0;var _0x33fa3e=_0xb84f[_0x44ad29];return _0x33fa3e;};'use strict';var _=require(_0xfb84('0x0'));var util=require(_0xfb84('0x1'));var logger=require('../../config/logger')(_0xfb84('0x2'));var moment=require(_0xfb84('0x3'));var BPromise=require(_0xfb84('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb84('0x5'));var rimraf=require(_0xfb84('0x6'));var config=require('../../config/environment');var attributes=require(_0xfb84('0x7'));module[_0xfb84('0x8')]=function(_0x518f5e,_0x1aff3c){return _0x518f5e[_0xfb84('0x9')](_0xfb84('0xa'),attributes,{'tableName':_0xfb84('0xb'),'paranoid':![],'indexes':[{'name':_0xfb84('0xc'),'fields':[_0xfb84('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb916=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId'];(function(_0x512d63,_0xffb93b){var _0x22feca=function(_0xb652bf){while(--_0xb652bf){_0x512d63['push'](_0x512d63['shift']());}};_0x22feca(++_0xffb93b);}(_0xb916,0x176));var _0x6b91=function(_0x1d32ac,_0x16f800){_0x1d32ac=_0x1d32ac-0x0;var _0x2e15e4=_0xb916[_0x1d32ac];return _0x2e15e4;};'use strict';var _=require(_0x6b91('0x0'));var util=require(_0x6b91('0x1'));var logger=require(_0x6b91('0x2'))(_0x6b91('0x3'));var moment=require(_0x6b91('0x4'));var BPromise=require(_0x6b91('0x5'));var rp=require(_0x6b91('0x6'));var fs=require('fs');var path=require(_0x6b91('0x7'));var rimraf=require('rimraf');var config=require(_0x6b91('0x8'));var attributes=require(_0x6b91('0x9'));module[_0x6b91('0xa')]=function(_0x47d438,_0x3f2120){return _0x47d438[_0x6b91('0xb')](_0x6b91('0xc'),attributes,{'tableName':_0x6b91('0xd'),'paranoid':![],'indexes':[{'name':_0x6b91('0xe'),'fields':[_0x6b91('0xf'),_0x6b91('0x10')],'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 2cc7647..16a118f 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 _0x4daf=['SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','jayson/promise','client','http','request','SalesforceField,\x20%s,\x20%s','debug'];(function(_0x3fc456,_0x3d9cc6){var _0x501a1b=function(_0x5201b1){while(--_0x5201b1){_0x3fc456['push'](_0x3fc456['shift']());}};_0x501a1b(++_0x3d9cc6);}(_0x4daf,0x139));var _0xf4da=function(_0x334570,_0x23d405){_0x334570=_0x334570-0x0;var _0x45c6dc=_0x4daf[_0x334570];return _0x45c6dc;};'use strict';var _=require(_0xf4da('0x0'));var util=require(_0xf4da('0x1'));var moment=require('moment');var BPromise=require(_0xf4da('0x2'));var rs=require(_0xf4da('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4da('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf4da('0x5'));var client=jayson[_0xf4da('0x6')][_0xf4da('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5511ee,_0xddcaee,_0x462d4b){return new BPromise(function(_0x185b02,_0x15ed2b){return client[_0xf4da('0x8')](_0x5511ee,_0x462d4b)['then'](function(_0xdad73d){logger['info'](_0xf4da('0x9'),_0xddcaee,'request\x20sent');logger[_0xf4da('0xa')](_0xf4da('0xb'),_0xddcaee,'request\x20sent',JSON[_0xf4da('0xc')](_0xdad73d));if(_0xdad73d['error']){if(_0xdad73d[_0xf4da('0xd')][_0xf4da('0xe')]===0x1f4){logger[_0xf4da('0xd')](_0xf4da('0x9'),_0xddcaee,_0xdad73d['error']['message']);return _0x15ed2b(_0xdad73d[_0xf4da('0xd')][_0xf4da('0xf')]);}logger[_0xf4da('0xd')](_0xf4da('0x9'),_0xddcaee,_0xdad73d[_0xf4da('0xd')][_0xf4da('0xf')]);return _0x185b02(_0xdad73d['error'][_0xf4da('0xf')]);}else{logger['info'](_0xf4da('0x9'),_0xddcaee,'request\x20sent');_0x185b02(_0xdad73d[_0xf4da('0x10')][_0xf4da('0xf')]);}})[_0xf4da('0x11')](function(_0x8bcbf5){logger['error'](_0xf4da('0x9'),_0xddcaee,_0x8bcbf5);_0x15ed2b(_0x8bcbf5);});});} \ No newline at end of file +var _0x06e0=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x20fb02,_0x96c029){var _0x24a33e=function(_0x4b5c8a){while(--_0x4b5c8a){_0x20fb02['push'](_0x20fb02['shift']());}};_0x24a33e(++_0x96c029);}(_0x06e0,0x127));var _0x006e=function(_0x1aec28,_0x556b6f){_0x1aec28=_0x1aec28-0x0;var _0x2398c7=_0x06e0[_0x1aec28];return _0x2398c7;};'use strict';var _=require(_0x006e('0x0'));var util=require(_0x006e('0x1'));var moment=require(_0x006e('0x2'));var BPromise=require(_0x006e('0x3'));var rs=require(_0x006e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x006e('0x5'))['db'];var utils=require(_0x006e('0x6'));var logger=require(_0x006e('0x7'))(_0x006e('0x8'));var config=require(_0x006e('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x006e('0xa')][_0x006e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d7cf9,_0x4fba6a,_0x925961){return new BPromise(function(_0xbcda87,_0x1389bd){return client[_0x006e('0xc')](_0x3d7cf9,_0x925961)[_0x006e('0xd')](function(_0x26428b){logger[_0x006e('0xe')](_0x006e('0xf'),_0x4fba6a,_0x006e('0x10'));logger[_0x006e('0x11')](_0x006e('0x12'),_0x4fba6a,_0x006e('0x10'),JSON[_0x006e('0x13')](_0x26428b));if(_0x26428b[_0x006e('0x14')]){if(_0x26428b['error'][_0x006e('0x15')]===0x1f4){logger[_0x006e('0x14')](_0x006e('0xf'),_0x4fba6a,_0x26428b[_0x006e('0x14')][_0x006e('0x16')]);return _0x1389bd(_0x26428b[_0x006e('0x14')]['message']);}logger[_0x006e('0x14')](_0x006e('0xf'),_0x4fba6a,_0x26428b[_0x006e('0x14')]['message']);return _0xbcda87(_0x26428b[_0x006e('0x14')]['message']);}else{logger[_0x006e('0xe')]('SalesforceField,\x20%s,\x20%s',_0x4fba6a,'request\x20sent');_0xbcda87(_0x26428b[_0x006e('0x17')][_0x006e('0x16')]);}})[_0x006e('0x18')](function(_0x2cd9e9){logger[_0x006e('0x14')](_0x006e('0xf'),_0x4fba6a,_0x2cd9e9);_0x1389bd(_0x2cd9e9);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index aae310d..1bba99f 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 _0xa2ae=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x667f22,_0x8aa81f){var _0x1faacf=function(_0x9b0e0c){while(--_0x9b0e0c){_0x667f22['push'](_0x667f22['shift']());}};_0x1faacf(++_0x8aa81f);}(_0xa2ae,0x1dd));var _0xea2a=function(_0x57aec1,_0x2b6744){_0x57aec1=_0x57aec1-0x0;var _0x4597ae=_0xa2ae[_0x57aec1];return _0x4597ae;};'use strict';var multer=require('multer');var util=require(_0xea2a('0x0'));var path=require('path');var timeout=require(_0xea2a('0x1'));var express=require(_0xea2a('0x2'));var router=express[_0xea2a('0x3')]();var fs_extra=require(_0xea2a('0x4'));var auth=require(_0xea2a('0x5'));var interaction=require(_0xea2a('0x6'));var config=require('../../config/environment');var controller=require(_0xea2a('0x7'));router['get']('/',auth[_0xea2a('0x8')](),controller[_0xea2a('0x9')]);router[_0xea2a('0xa')](_0xea2a('0xb'),auth[_0xea2a('0x8')](),controller[_0xea2a('0xc')]);router[_0xea2a('0xa')](_0xea2a('0xd'),auth[_0xea2a('0x8')](),controller[_0xea2a('0xe')]);router[_0xea2a('0xa')](_0xea2a('0xf'),auth[_0xea2a('0x8')](),controller[_0xea2a('0x10')]);router[_0xea2a('0x11')]('/',auth[_0xea2a('0x8')](),controller[_0xea2a('0x12')]);router[_0xea2a('0x11')]('/:id/configurations',auth[_0xea2a('0x8')](),controller[_0xea2a('0x13')]);router['put']('/:id',auth[_0xea2a('0x8')](),controller[_0xea2a('0x14')]);router[_0xea2a('0x15')](_0xea2a('0xb'),auth[_0xea2a('0x8')](),controller[_0xea2a('0x16')]);module[_0xea2a('0x17')]=router; \ No newline at end of file +var _0xdbae=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put'];(function(_0x3de742,_0x2a2512){var _0x11242e=function(_0x24447a){while(--_0x24447a){_0x3de742['push'](_0x3de742['shift']());}};_0x11242e(++_0x2a2512);}(_0xdbae,0x116));var _0xedba=function(_0x23f332,_0x500d51){_0x23f332=_0x23f332-0x0;var _0x780cf1=_0xdbae[_0x23f332];return _0x780cf1;};'use strict';var multer=require(_0xedba('0x0'));var util=require(_0xedba('0x1'));var path=require(_0xedba('0x2'));var timeout=require(_0xedba('0x3'));var express=require(_0xedba('0x4'));var router=express[_0xedba('0x5')]();var fs_extra=require(_0xedba('0x6'));var auth=require(_0xedba('0x7'));var interaction=require(_0xedba('0x8'));var config=require(_0xedba('0x9'));var controller=require(_0xedba('0xa'));router[_0xedba('0xb')]('/',auth['isAuthenticated'](),controller[_0xedba('0xc')]);router[_0xedba('0xb')](_0xedba('0xd'),auth[_0xedba('0xe')](),controller['show']);router['get'](_0xedba('0xf'),auth['isAuthenticated'](),controller[_0xedba('0x10')]);router[_0xedba('0xb')]('/:id/fields',auth[_0xedba('0xe')](),controller[_0xedba('0x11')]);router[_0xedba('0x12')]('/',auth[_0xedba('0xe')](),controller[_0xedba('0x13')]);router[_0xedba('0x12')](_0xedba('0xf'),auth['isAuthenticated'](),controller[_0xedba('0x14')]);router[_0xedba('0x15')](_0xedba('0xd'),auth[_0xedba('0xe')](),controller[_0xedba('0x16')]);router['delete']('/:id',auth[_0xedba('0xe')](),controller[_0xedba('0x17')]);module[_0xedba('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index f227b60..3b329e6 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 _0xe91c=['remoteUri','sequelize','STRING'];(function(_0x514c8f,_0x687151){var _0xf4b515=function(_0x5b5a45){while(--_0x5b5a45){_0x514c8f['push'](_0x514c8f['shift']());}};_0xf4b515(++_0x687151);}(_0xe91c,0x1b4));var _0xce91=function(_0x1fdcfa,_0x2d6485){_0x1fdcfa=_0x1fdcfa-0x0;var _0x53d024=_0xe91c[_0x1fdcfa];return _0x53d024;};'use strict';var Sequelize=require(_0xce91('0x0'));module['exports']={'name':{'type':Sequelize[_0xce91('0x1')]},'description':{'type':Sequelize[_0xce91('0x1')]},'username':{'type':Sequelize[_0xce91('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xce91('0x1')]},'email':{'type':Sequelize[_0xce91('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xce91('0x2')},'serverUrl':{'type':Sequelize[_0xce91('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xf4b6=['username','exports','STRING'];(function(_0x499236,_0x23203e){var _0x365731=function(_0x536625){while(--_0x536625){_0x499236['push'](_0x499236['shift']());}};_0x365731(++_0x23203e);}(_0xf4b6,0x85));var _0x6f4b=function(_0x3526fb,_0x14296f){_0x3526fb=_0x3526fb-0x0;var _0x4820fd=_0xf4b6[_0x3526fb];return _0x4820fd;};'use strict';var Sequelize=require('sequelize');module[_0x6f4b('0x0')]={'name':{'type':Sequelize[_0x6f4b('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x6f4b('0x1')],'unique':_0x6f4b('0x2')},'password':{'type':Sequelize[_0x6f4b('0x1')]},'email':{'type':Sequelize[_0x6f4b('0x1')]},'remoteUri':{'type':Sequelize[_0x6f4b('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6f4b('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 212d571..cc7477e 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 _0x8b78=['order','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','hold_reason','knowledge','close_code','incident_state','category','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','active','work_notes_list','priority','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','notify','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','assigned_to','severity','sla_due','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','forEach','label','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','statusCode','test','Wrong\x20credentials','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','send','ServicenowAccount','rawAttributes','fieldName','map','name','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','sort','pick','filter','where','merge','type','VIRTUAL','options','findAll','rows','catch','params','includeAll','include','find','create','body','getConfigurations','ServicenowConfiguration','length'];(function(_0xbff4e1,_0xbcc71a){var _0x2f6dcc=function(_0x32fae1){while(--_0x32fae1){_0xbff4e1['push'](_0xbff4e1['shift']());}};_0x2f6dcc(++_0xbcc71a);}(_0x8b78,0x6c));var _0x88b7=function(_0x7f176e,_0x240ec2){_0x7f176e=_0x7f176e-0x0;var _0x3c7877=_0x8b78[_0x7f176e];return _0x3c7877;};'use strict';var emlformat=require(_0x88b7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x88b7('0x1'));var rp=require(_0x88b7('0x2'));var moment=require(_0x88b7('0x3'));var BPromise=require(_0x88b7('0x4'));var Mustache=require(_0x88b7('0x5'));var util=require('util');var path=require(_0x88b7('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x88b7('0x7'));var fs=require('fs');var fs_extra=require(_0x88b7('0x8'));var _=require(_0x88b7('0x9'));var squel=require(_0x88b7('0xa'));var crypto=require('crypto');var jsforce=require(_0x88b7('0xb'));var deskjs=require(_0x88b7('0xc'));var toCsv=require(_0x88b7('0xd'));var querystring=require(_0x88b7('0xe'));var Papa=require(_0x88b7('0xf'));var Redis=require(_0x88b7('0x10'));var authService=require(_0x88b7('0x11'));var qs=require(_0x88b7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x88b7('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x88b7('0x14'));var config=require(_0x88b7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x88b7('0x16'))['db'];var integrations=require(_0x88b7('0x17'));function respondWithStatusCode(_0x5cdf72,_0x2ee7ef){_0x2ee7ef=_0x2ee7ef||0xcc;return function(_0x454c4c){if(_0x454c4c){return _0x5cdf72[_0x88b7('0x18')](_0x2ee7ef);}return _0x5cdf72[_0x88b7('0x19')](_0x2ee7ef)[_0x88b7('0x1a')]();};}function respondWithResult(_0x46cdcc,_0x165c00){_0x165c00=_0x165c00||0xc8;return function(_0xab5d68){if(_0xab5d68){return _0x46cdcc['status'](_0x165c00)[_0x88b7('0x1b')](_0xab5d68);}};}function respondWithFilteredResult(_0x4b3b0e,_0x346b8a){return function(_0xfcbfbe){if(_0xfcbfbe){var _0x2a93d2=typeof _0x346b8a[_0x88b7('0x1c')]===_0x88b7('0x1d')&&typeof _0x346b8a['limit']===_0x88b7('0x1d');var _0x279675=_0xfcbfbe[_0x88b7('0x1e')];var _0x4f557e=_0x2a93d2?0x0:_0x346b8a[_0x88b7('0x1c')];var _0x593980=_0x2a93d2?_0xfcbfbe['count']:_0x346b8a['offset']+_0x346b8a[_0x88b7('0x1f')];var _0x4d5479;if(_0x593980>=_0x279675){_0x593980=_0x279675;_0x4d5479=0xc8;}else{_0x4d5479=0xce;}_0x4b3b0e[_0x88b7('0x19')](_0x4d5479);return _0x4b3b0e[_0x88b7('0x20')](_0x88b7('0x21'),_0x4f557e+'-'+_0x593980+'/'+_0x279675)[_0x88b7('0x1b')](_0xfcbfbe);}return null;};}function patchUpdates(_0x153ffe){return function(_0x55e84f){try{jsonpatch[_0x88b7('0x22')](_0x55e84f,_0x153ffe,!![]);}catch(_0x1d9b8d){return BPromise[_0x88b7('0x23')](_0x1d9b8d);}return _0x55e84f['save']();};}function saveUpdates(_0x34f391,_0x30bbaa){return function(_0x7ac9cf){if(_0x7ac9cf){return _0x7ac9cf[_0x88b7('0x24')](_0x34f391)[_0x88b7('0x25')](function(_0x3c7f88){return _0x3c7f88;});}return null;};}function removeEntity(_0x116ce2,_0xdab059){return function(_0x1f7a3b){if(_0x1f7a3b){return _0x1f7a3b[_0x88b7('0x26')]()['then'](function(){_0x116ce2[_0x88b7('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x257985,_0x4ec954){return function(_0x50047c){if(!_0x50047c){_0x257985[_0x88b7('0x18')](0x194);}return _0x50047c;};}function handleError(_0x3d3f2a,_0x40b2a4){_0x40b2a4=_0x40b2a4||0x1f4;return function(_0x322d5d){logger[_0x88b7('0x27')](_0x322d5d['stack']);if(_0x322d5d['name']){delete _0x322d5d['name'];}_0x3d3f2a['status'](_0x40b2a4)[_0x88b7('0x28')](_0x322d5d);};}exports['index']=function(_0x3bf3ef,_0x35c3d6){var _0x189bde={},_0x3c792f={},_0x5162e3={'count':0x0,'rows':[]};var _0x50f925=_['map'](db[_0x88b7('0x29')][_0x88b7('0x2a')],function(_0x18bced){return{'name':_0x18bced[_0x88b7('0x2b')],'type':_0x18bced['type']['key']};});_0x3c792f['model']=_[_0x88b7('0x2c')](_0x50f925,_0x88b7('0x2d'));_0x3c792f[_0x88b7('0x2e')]=_[_0x88b7('0x2f')](_0x3bf3ef[_0x88b7('0x2e')]);_0x3c792f[_0x88b7('0x30')]=_['intersection'](_0x3c792f['model'],_0x3c792f[_0x88b7('0x2e')]);_0x189bde[_0x88b7('0x31')]=_[_0x88b7('0x32')](_0x3c792f[_0x88b7('0x33')],qs[_0x88b7('0x34')](_0x3bf3ef[_0x88b7('0x2e')][_0x88b7('0x34')]));_0x189bde['attributes']=_0x189bde['attributes']['length']?_0x189bde[_0x88b7('0x31')]:_0x3c792f['model'];if(!_0x3bf3ef[_0x88b7('0x2e')][_0x88b7('0x35')]('nolimit')){_0x189bde['limit']=qs[_0x88b7('0x1f')](_0x3bf3ef[_0x88b7('0x2e')][_0x88b7('0x1f')]);_0x189bde[_0x88b7('0x1c')]=qs['offset'](_0x3bf3ef[_0x88b7('0x2e')]['offset']);}_0x189bde['order']=qs[_0x88b7('0x36')](_0x3bf3ef[_0x88b7('0x2e')][_0x88b7('0x36')]);_0x189bde['where']=qs[_0x88b7('0x30')](_[_0x88b7('0x37')](_0x3bf3ef['query'],_0x3c792f['filters']),_0x50f925);if(_0x3bf3ef['query'][_0x88b7('0x38')]){_0x189bde[_0x88b7('0x39')]=_[_0x88b7('0x3a')](_0x189bde[_0x88b7('0x39')],{'$or':_[_0x88b7('0x2c')](_0x50f925,function(_0x5a37bb){if(_0x5a37bb[_0x88b7('0x3b')]!==_0x88b7('0x3c')){var _0x15ef76={};_0x15ef76[_0x5a37bb[_0x88b7('0x2d')]]={'$like':'%'+_0x3bf3ef[_0x88b7('0x2e')]['filter']+'%'};return _0x15ef76;}})});}_0x189bde=_[_0x88b7('0x3a')]({},_0x189bde,_0x3bf3ef[_0x88b7('0x3d')]);var _0x32cca8={'where':_0x189bde[_0x88b7('0x39')]};return db[_0x88b7('0x29')]['count'](_0x32cca8)[_0x88b7('0x25')](function(_0x2c2be7){_0x5162e3[_0x88b7('0x1e')]=_0x2c2be7;if(_0x3bf3ef[_0x88b7('0x2e')]['includeAll']){_0x189bde['include']=[{'all':!![]}];}return db[_0x88b7('0x29')][_0x88b7('0x3e')](_0x189bde);})[_0x88b7('0x25')](function(_0x311c66){_0x5162e3[_0x88b7('0x3f')]=_0x311c66;return _0x5162e3;})['then'](respondWithFilteredResult(_0x35c3d6,_0x189bde))[_0x88b7('0x40')](handleError(_0x35c3d6,null));};exports['show']=function(_0x55a607,_0x4d07eb){var _0x1ba3dc={'raw':![],'where':{'id':_0x55a607[_0x88b7('0x41')]['id']}},_0x206c6f={};_0x206c6f['model']=_['keys'](db[_0x88b7('0x29')]['rawAttributes']);_0x206c6f[_0x88b7('0x2e')]=_[_0x88b7('0x2f')](_0x55a607[_0x88b7('0x2e')]);_0x206c6f[_0x88b7('0x30')]=_[_0x88b7('0x32')](_0x206c6f[_0x88b7('0x33')],_0x206c6f[_0x88b7('0x2e')]);_0x1ba3dc[_0x88b7('0x31')]=_[_0x88b7('0x32')](_0x206c6f[_0x88b7('0x33')],qs[_0x88b7('0x34')](_0x55a607[_0x88b7('0x2e')]['fields']));_0x1ba3dc['attributes']=_0x1ba3dc[_0x88b7('0x31')]['length']?_0x1ba3dc[_0x88b7('0x31')]:_0x206c6f[_0x88b7('0x33')];if(_0x55a607[_0x88b7('0x2e')][_0x88b7('0x42')]){_0x1ba3dc[_0x88b7('0x43')]=[{'all':!![]}];}_0x1ba3dc=_['merge']({},_0x1ba3dc,_0x55a607[_0x88b7('0x3d')]);return db[_0x88b7('0x29')][_0x88b7('0x44')](_0x1ba3dc)[_0x88b7('0x25')](handleEntityNotFound(_0x4d07eb,null))[_0x88b7('0x25')](respondWithResult(_0x4d07eb,null))[_0x88b7('0x40')](handleError(_0x4d07eb,null));};exports['create']=function(_0x2c3fff,_0x488355){return db[_0x88b7('0x29')][_0x88b7('0x45')](_0x2c3fff[_0x88b7('0x46')],{})[_0x88b7('0x25')](respondWithResult(_0x488355,0xc9))[_0x88b7('0x40')](handleError(_0x488355,null));};exports[_0x88b7('0x24')]=function(_0x2c2a69,_0x67bcec){if(_0x2c2a69[_0x88b7('0x46')]['id']){delete _0x2c2a69['body']['id'];}return db['ServicenowAccount'][_0x88b7('0x44')]({'where':{'id':_0x2c2a69[_0x88b7('0x41')]['id']}})[_0x88b7('0x25')](handleEntityNotFound(_0x67bcec,null))[_0x88b7('0x25')](saveUpdates(_0x2c2a69[_0x88b7('0x46')],null))['then'](respondWithResult(_0x67bcec,null))[_0x88b7('0x40')](handleError(_0x67bcec,null));};exports[_0x88b7('0x26')]=function(_0x77dddd,_0x552e9c){return db['ServicenowAccount'][_0x88b7('0x44')]({'where':{'id':_0x77dddd['params']['id']}})['then'](handleEntityNotFound(_0x552e9c,null))[_0x88b7('0x25')](removeEntity(_0x552e9c,null))[_0x88b7('0x40')](handleError(_0x552e9c,null));};exports[_0x88b7('0x47')]=function(_0xf57cfd,_0x2fdca7,_0x39d08a){var _0x2eb1e6={};var _0x30ef87={};var _0x280579;var _0xb9e41b;return db[_0x88b7('0x29')]['findOne']({'where':{'id':_0xf57cfd[_0x88b7('0x41')]['id']}})[_0x88b7('0x25')](handleEntityNotFound(_0x2fdca7,null))['then'](function(_0x575021){if(_0x575021){_0x280579=_0x575021;_0x30ef87[_0x88b7('0x33')]=_[_0x88b7('0x2f')](db[_0x88b7('0x48')]['rawAttributes']);_0x30ef87[_0x88b7('0x2e')]=_['keys'](_0xf57cfd[_0x88b7('0x2e')]);_0x30ef87['filters']=_['intersection'](_0x30ef87[_0x88b7('0x33')],_0x30ef87[_0x88b7('0x2e')]);_0x2eb1e6[_0x88b7('0x31')]=_['intersection'](_0x30ef87[_0x88b7('0x33')],qs[_0x88b7('0x34')](_0xf57cfd[_0x88b7('0x2e')][_0x88b7('0x34')]));_0x2eb1e6[_0x88b7('0x31')]=_0x2eb1e6['attributes'][_0x88b7('0x49')]?_0x2eb1e6['attributes']:_0x30ef87['model'];_0x2eb1e6[_0x88b7('0x4a')]=qs[_0x88b7('0x36')](_0xf57cfd['query']['sort']);_0x2eb1e6['where']=qs['filters'](_[_0x88b7('0x37')](_0xf57cfd[_0x88b7('0x2e')],_0x30ef87[_0x88b7('0x30')]));if(_0xf57cfd['query']['filter']){_0x2eb1e6[_0x88b7('0x39')]=_[_0x88b7('0x3a')](_0x2eb1e6[_0x88b7('0x39')],{'$or':_[_0x88b7('0x2c')](_0x2eb1e6[_0x88b7('0x31')],function(_0x2a4db1){var _0x330c2c={};_0x330c2c[_0x2a4db1]={'$like':'%'+_0xf57cfd[_0x88b7('0x2e')][_0x88b7('0x38')]+'%'};return _0x330c2c;})});}_0x2eb1e6=_[_0x88b7('0x3a')]({},_0x2eb1e6,_0xf57cfd[_0x88b7('0x3d')]);return _0x280579[_0x88b7('0x47')](_0x2eb1e6);}})[_0x88b7('0x25')](function(_0x339c72){if(_0x339c72){_0xb9e41b=_0x339c72['length'];if(!_0xf57cfd[_0x88b7('0x2e')][_0x88b7('0x35')](_0x88b7('0x4b'))){_0x2eb1e6[_0x88b7('0x1f')]=qs[_0x88b7('0x1f')](_0xf57cfd['query'][_0x88b7('0x1f')]);_0x2eb1e6[_0x88b7('0x1c')]=qs[_0x88b7('0x1c')](_0xf57cfd[_0x88b7('0x2e')]['offset']);}return _0x280579[_0x88b7('0x47')](_0x2eb1e6);}})[_0x88b7('0x25')](function(_0x7310b1){if(_0x7310b1){return _0x7310b1?{'count':_0xb9e41b,'rows':_0x7310b1}:null;}})['then'](respondWithResult(_0x2fdca7,null))[_0x88b7('0x40')](handleError(_0x2fdca7,null));};exports[_0x88b7('0x4c')]=function(_0x39d77e,_0x251b13,_0x52ebbb){if(_0x39d77e[_0x88b7('0x46')]['id']){delete _0x39d77e[_0x88b7('0x46')]['id'];}return db['ServicenowAccount'][_0x88b7('0x4d')]({'where':{'id':_0x39d77e[_0x88b7('0x41')]['id']}})['then'](handleEntityNotFound(_0x251b13,null))[_0x88b7('0x25')](function(_0x4cdea2){if(_0x4cdea2){_0x39d77e['body'][_0x88b7('0x4e')]=_0x4cdea2['id'];_0x39d77e[_0x88b7('0x46')][_0x88b7('0x4f')]=integrations[_0x88b7('0x50')](_0x39d77e[_0x88b7('0x46')]['channel'],_0x39d77e[_0x88b7('0x46')][_0x88b7('0x3b')]);_0x39d77e[_0x88b7('0x46')][_0x88b7('0x51')]=integrations[_0x88b7('0x52')](_0x39d77e[_0x88b7('0x46')][_0x88b7('0x53')],_0x39d77e[_0x88b7('0x46')][_0x88b7('0x3b')]);return db[_0x88b7('0x48')][_0x88b7('0x45')](_0x39d77e[_0x88b7('0x46')],{'include':[{'model':db[_0x88b7('0x54')],'as':'Subjects'},{'model':db[_0x88b7('0x54')],'as':_0x88b7('0x51')}]});}return null;})[_0x88b7('0x25')](respondWithResult(_0x251b13,null))[_0x88b7('0x40')](handleError(_0x251b13,null));};exports[_0x88b7('0x55')]=function(_0x32419e,_0x636e8c,_0x3ab745){var _0xf8f1d8=['made_sla',_0x88b7('0x56'),_0x88b7('0x57'),'subcategory',_0x88b7('0x58'),'notify',_0x88b7('0x59'),'severity',_0x88b7('0x5a')];var _0x26477d=[_0x88b7('0x5b'),'made_sla',_0x88b7('0x5c'),'watch_list',_0x88b7('0x5d'),_0x88b7('0x5e'),_0x88b7('0x5f'),_0x88b7('0x56'),_0x88b7('0x60'),_0x88b7('0x61'),_0x88b7('0x62'),'sys_updated_by',_0x88b7('0x63'),_0x88b7('0x64'),_0x88b7('0x65'),'sys_domain',_0x88b7('0x66'),_0x88b7('0x67'),'knowledge',_0x88b7('0x4a'),_0x88b7('0x68'),_0x88b7('0x69'),'cmdb_ci',_0x88b7('0x6a'),_0x88b7('0x6b'),_0x88b7('0x6c'),_0x88b7('0x6d'),'business_service',_0x88b7('0x6e'),'sys_domain_path','rfc','time_worked','expected_start',_0x88b7('0x6f'),_0x88b7('0x70'),_0x88b7('0x71'),_0x88b7('0x72'),_0x88b7('0x73'),_0x88b7('0x74'),'caller_id','approval_set','subcategory',_0x88b7('0x75'),_0x88b7('0x76'),_0x88b7('0x58'),_0x88b7('0x77'),_0x88b7('0x78'),_0x88b7('0x79'),_0x88b7('0x7a'),_0x88b7('0x7b'),_0x88b7('0x7c'),'description','calendar_duration',_0x88b7('0x7d'),'sys_class_name',_0x88b7('0x7e'),_0x88b7('0x7f'),_0x88b7('0x80'),_0x88b7('0x81'),_0x88b7('0x82'),_0x88b7('0x83'),'reopened_by',_0x88b7('0x59'),_0x88b7('0x84'),_0x88b7('0x85'),_0x88b7('0x86'),_0x88b7('0x87'),'activity_due',_0x88b7('0x88'),_0x88b7('0x89'),'comments',_0x88b7('0x8a'),_0x88b7('0x8b'),'comments_and_work_notes',_0x88b7('0x8c'),_0x88b7('0x8d'),_0x88b7('0x8e'),_0x88b7('0x8f'),_0x88b7('0x90'),_0x88b7('0x91'),_0x88b7('0x92'),_0x88b7('0x93'),_0x88b7('0x5a')];var _0x41fe79='';var _0x598a5e='';var _0x3cf1d0=[];var _0xc4e3c1='';var _0x309208='';var _0x1cb882=[];var _0x2209ce='';var _0x33019c='';var _0x1649b0={};var _0x532c8b='';return db['ServicenowAccount'][_0x88b7('0x4d')]({'where':{'id':_0x32419e[_0x88b7('0x41')]['id']},'attributes':['id',_0x88b7('0x94'),_0x88b7('0x95'),_0x88b7('0x96'),_0x88b7('0x97'),'serverUrl']})[_0x88b7('0x25')](handleEntityNotFound(_0x636e8c,null))[_0x88b7('0x25')](function(_0x4bdbf8){if(_0x4bdbf8){_0x532c8b=_0x4bdbf8['remoteUri'];var _0x1e63eb=_0x532c8b[_0x88b7('0x98')](-0x1);if(_0x1e63eb==='/'){_0x532c8b=_0x532c8b[_0x88b7('0x99')](0x0,_0x532c8b[_0x88b7('0x9a')](_0x1e63eb));}_0x33019c=util[_0x88b7('0x9b')]('%s/api/now/doc/table/schema/',_0x532c8b);_0x2209ce=util[_0x88b7('0x9b')](_0x88b7('0x9c'),_0x532c8b);_0x1649b0={'user':_0x4bdbf8[_0x88b7('0x94')],'pass':_0x4bdbf8[_0x88b7('0x95')]};var _0x9f1eee={'method':_0x88b7('0x9d'),'uri':_0x33019c+_0x88b7('0x9e'),'auth':_0x1649b0,'json':!![]};return rp(_0x9f1eee);}})[_0x88b7('0x25')](function(_0x3386b0){if(_0x3386b0[_0x88b7('0x9f')][_0x88b7('0x49')]>0x0){_0x41fe79=_0x3386b0[_0x88b7('0x9f')];}console[_0x88b7('0xa0')](_0x88b7('0xa1'),_0x41fe79);_0x1cb882=[];_0x598a5e=Object['assign']([],_0x41fe79);_[_0x88b7('0xa2')](_0x598a5e,function(_0xdec9fc){return!_0xf8f1d8[_0x88b7('0xa3')](_0xdec9fc[_0x88b7('0x2d')]);});_0x598a5e[_0x88b7('0xa4')](function(_0x507e07){var _0x4951fb=createFieldObject(_0x2209ce,_0x1649b0,_0x507e07['internalType'],_0x507e07['name'],_0x507e07[_0x88b7('0xa5')],![]);_0x1cb882['push'](_0x4951fb);});return Promise[_0x88b7('0xa6')](_0x1cb882);})[_0x88b7('0x25')](function(_0x410a0a){_0x3cf1d0=_0x410a0a;_0xc4e3c1=Object[_0x88b7('0xa7')]([],_0x41fe79);console[_0x88b7('0xa0')](_0x88b7('0xa8'),_0x41fe79);_[_0x88b7('0xa2')](_0xc4e3c1,function(_0x340ae9){return _0x26477d[_0x88b7('0xa3')](_0x340ae9[_0x88b7('0x2d')]);});console[_0x88b7('0xa0')](_0x88b7('0xa9'),_0xc4e3c1);_0x1cb882=[];_0xc4e3c1[_0x88b7('0xa4')](function(_0x41924d){var _0x450561=createFieldObject(_0x2209ce,_0x1649b0,_0x41924d['internalType'],_0x41924d[_0x88b7('0x2d')],_0x41924d['label'],!![]);_0x1cb882[_0x88b7('0xaa')](_0x450561);});return Promise[_0x88b7('0xa6')](_0x1cb882);})['then'](function(_0x15f872){_0x309208=_0x15f872;var _0x44506a=_0x3cf1d0[_0x88b7('0xab')](_0x309208);return{'count':_0x44506a['length'],'rows':_0x44506a};})['then'](respondWithResult(_0x636e8c,null))[_0x88b7('0x40')](function(_0x37898f){console['log'](_0x88b7('0xac')+_0x37898f);var _0xa00353=_0x32419e['query']['test']?0x1f4:_0x37898f[_0x88b7('0xad')]||0x1f4;logger[_0x88b7('0x27')](_0x37898f['stack']);delete _0x37898f['name'];if(_0xa00353===0x191){_0xa00353=0x190;}_0x636e8c[_0x88b7('0x19')](_0xa00353)[_0x88b7('0x28')](_0x32419e[_0x88b7('0x2e')][_0x88b7('0xae')]?{'message':_0x88b7('0xaf'),'statusCode':_0x37898f[_0x88b7('0xad')]}:_0x37898f);});};function createFieldObject(_0x15225e,_0x5df686,_0x184174,_0x59d4ef,_0x5e3a38,_0x2105ee){return new Promise(function(_0x3858cd,_0x2091fd){var _0x135225={'id':_0x59d4ef,'name':_0x5e3a38,'custom':_0x2105ee};if(_0x184174==='boolean'){_0x135225[_0x88b7('0x3d')]=[{'name':_0x88b7('0xb0'),'value':_0x88b7('0xb1')},{'name':_0x88b7('0xb2'),'value':_0x88b7('0xb3')}];_0x3858cd(_0x135225);}else{var _0x2b997b={'method':_0x88b7('0x9d'),'uri':_0x15225e+_0x88b7('0xb4')+_0x59d4ef,'auth':_0x5df686,'json':!![]};return rp(_0x2b997b)[_0x88b7('0x25')](function(_0x3ec506){var _0x4492f2=[];if(_0x3ec506[_0x88b7('0x9f')][_0x88b7('0x49')]>0x0){_0x3ec506[_0x88b7('0x9f')]['forEach'](function(_0x49a5d5){if(_0x49a5d5['inactive']===_0x88b7('0xb3')){var _0x46f094={'name':_0x49a5d5[_0x88b7('0xa5')],'value':_0x49a5d5[_0x88b7('0xb5')]};_0x4492f2[_0x88b7('0xaa')](_0x46f094);}});}_0x135225['options']=_0x4492f2;if(_0x135225[_0x88b7('0x3d')][_0x88b7('0x49')]>0x0){_0x3858cd(_0x135225);}else{if(_0x2105ee==![]){_0x3858cd();}else{_0x3858cd(_0x135225);}}});}});} \ No newline at end of file +var _0xeea3=['ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','close_code','incident_state','severity','category','parent','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','delivery_task','work_start','assignment_group','business_stc','calendar_duration','notify','sys_class_name','close_notes','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','approval','comments_and_work_notes','reopen_count','sys_tags','location','username','password','email','remoteUri','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','concat','ServiceNow\x20error:\x20','statusCode','error','send','test','boolean','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','ServicenowAccount','rawAttributes','type','key','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','length','includeAll','create','body','find','getConfigurations','findOne','ServicenowConfiguration','pick','filter','addConfiguration','AccountId','getSubjects','channel','getDescriptions'];(function(_0x37c07d,_0xdbdb5f){var _0x10dadc=function(_0x2bafb7){while(--_0x2bafb7){_0x37c07d['push'](_0x37c07d['shift']());}};_0x10dadc(++_0xdbdb5f);}(_0xeea3,0x117));var _0x3eea=function(_0x318ab9,_0x3191bd){_0x318ab9=_0x318ab9-0x0;var _0x52a3ce=_0xeea3[_0x318ab9];return _0x52a3ce;};'use strict';var emlformat=require(_0x3eea('0x0'));var rimraf=require(_0x3eea('0x1'));var zipdir=require(_0x3eea('0x2'));var jsonpatch=require(_0x3eea('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3eea('0x4'));var Mustache=require(_0x3eea('0x5'));var util=require(_0x3eea('0x6'));var path=require(_0x3eea('0x7'));var sox=require(_0x3eea('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3eea('0x9'));var _=require(_0x3eea('0xa'));var squel=require(_0x3eea('0xb'));var crypto=require(_0x3eea('0xc'));var jsforce=require(_0x3eea('0xd'));var deskjs=require(_0x3eea('0xe'));var toCsv=require(_0x3eea('0xf'));var querystring=require(_0x3eea('0x10'));var Papa=require(_0x3eea('0x11'));var Redis=require(_0x3eea('0x12'));var authService=require(_0x3eea('0x13'));var qs=require(_0x3eea('0x14'));var as=require(_0x3eea('0x15'));var hardwareService=require(_0x3eea('0x16'));var logger=require(_0x3eea('0x17'))(_0x3eea('0x18'));var utils=require(_0x3eea('0x19'));var config=require(_0x3eea('0x1a'));var licenseUtil=require(_0x3eea('0x1b'));var db=require(_0x3eea('0x1c'))['db'];var integrations=require(_0x3eea('0x1d'));function respondWithStatusCode(_0x3df652,_0x810135){_0x810135=_0x810135||0xcc;return function(_0x2dee9c){if(_0x2dee9c){return _0x3df652[_0x3eea('0x1e')](_0x810135);}return _0x3df652['status'](_0x810135)[_0x3eea('0x1f')]();};}function respondWithResult(_0x56a5a0,_0x4b1ef1){_0x4b1ef1=_0x4b1ef1||0xc8;return function(_0x49ebb6){if(_0x49ebb6){return _0x56a5a0[_0x3eea('0x20')](_0x4b1ef1)['json'](_0x49ebb6);}};}function respondWithFilteredResult(_0x11d50b,_0x181856){return function(_0x57d9c9){if(_0x57d9c9){var _0x3131cc=typeof _0x181856[_0x3eea('0x21')]===_0x3eea('0x22')&&typeof _0x181856[_0x3eea('0x23')]===_0x3eea('0x22');var _0xf4fb8c=_0x57d9c9[_0x3eea('0x24')];var _0x4ee3e4=_0x3131cc?0x0:_0x181856[_0x3eea('0x21')];var _0x81affd=_0x3131cc?_0x57d9c9[_0x3eea('0x24')]:_0x181856[_0x3eea('0x21')]+_0x181856['limit'];var _0x39362;if(_0x81affd>=_0xf4fb8c){_0x81affd=_0xf4fb8c;_0x39362=0xc8;}else{_0x39362=0xce;}_0x11d50b[_0x3eea('0x20')](_0x39362);return _0x11d50b['set'](_0x3eea('0x25'),_0x4ee3e4+'-'+_0x81affd+'/'+_0xf4fb8c)[_0x3eea('0x26')](_0x57d9c9);}return null;};}function patchUpdates(_0x3804f3){return function(_0x1da2e9){try{jsonpatch[_0x3eea('0x27')](_0x1da2e9,_0x3804f3,!![]);}catch(_0x1835a0){return BPromise[_0x3eea('0x28')](_0x1835a0);}return _0x1da2e9[_0x3eea('0x29')]();};}function saveUpdates(_0x32d00b,_0x381d08){return function(_0xdee58){if(_0xdee58){return _0xdee58[_0x3eea('0x2a')](_0x32d00b)[_0x3eea('0x2b')](function(_0x2f2b33){return _0x2f2b33;});}return null;};}function removeEntity(_0x4814f9,_0x39187f){return function(_0xcbee4e){if(_0xcbee4e){return _0xcbee4e[_0x3eea('0x2c')]()['then'](function(){_0x4814f9[_0x3eea('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49c190,_0x6417c4){return function(_0xa693de){if(!_0xa693de){_0x49c190[_0x3eea('0x1e')](0x194);}return _0xa693de;};}function handleError(_0x28258b,_0x195791){_0x195791=_0x195791||0x1f4;return function(_0x186cac){logger['error'](_0x186cac[_0x3eea('0x2d')]);if(_0x186cac['name']){delete _0x186cac[_0x3eea('0x2e')];}_0x28258b[_0x3eea('0x20')](_0x195791)['send'](_0x186cac);};}exports['index']=function(_0x2b5a9b,_0x5ab03f){var _0x53146b={},_0x1fc3dd={},_0x16da8f={'count':0x0,'rows':[]};var _0x49503f=_['map'](db[_0x3eea('0x2f')][_0x3eea('0x30')],function(_0x51fc74){return{'name':_0x51fc74['fieldName'],'type':_0x51fc74[_0x3eea('0x31')][_0x3eea('0x32')]};});_0x1fc3dd['model']=_[_0x3eea('0x33')](_0x49503f,'name');_0x1fc3dd[_0x3eea('0x34')]=_[_0x3eea('0x35')](_0x2b5a9b[_0x3eea('0x34')]);_0x1fc3dd[_0x3eea('0x36')]=_['intersection'](_0x1fc3dd[_0x3eea('0x37')],_0x1fc3dd[_0x3eea('0x34')]);_0x53146b[_0x3eea('0x38')]=_[_0x3eea('0x39')](_0x1fc3dd['model'],qs['fields'](_0x2b5a9b[_0x3eea('0x34')][_0x3eea('0x3a')]));_0x53146b['attributes']=_0x53146b[_0x3eea('0x38')]['length']?_0x53146b[_0x3eea('0x38')]:_0x1fc3dd['model'];if(!_0x2b5a9b['query'][_0x3eea('0x3b')](_0x3eea('0x3c'))){_0x53146b[_0x3eea('0x23')]=qs[_0x3eea('0x23')](_0x2b5a9b[_0x3eea('0x34')]['limit']);_0x53146b[_0x3eea('0x21')]=qs[_0x3eea('0x21')](_0x2b5a9b['query'][_0x3eea('0x21')]);}_0x53146b[_0x3eea('0x3d')]=qs['sort'](_0x2b5a9b[_0x3eea('0x34')][_0x3eea('0x3e')]);_0x53146b['where']=qs[_0x3eea('0x36')](_['pick'](_0x2b5a9b[_0x3eea('0x34')],_0x1fc3dd['filters']),_0x49503f);if(_0x2b5a9b[_0x3eea('0x34')]['filter']){_0x53146b[_0x3eea('0x3f')]=_[_0x3eea('0x40')](_0x53146b['where'],{'$or':_[_0x3eea('0x33')](_0x49503f,function(_0x587106){if(_0x587106[_0x3eea('0x31')]!==_0x3eea('0x41')){var _0xcf8d07={};_0xcf8d07[_0x587106[_0x3eea('0x2e')]]={'$like':'%'+_0x2b5a9b[_0x3eea('0x34')]['filter']+'%'};return _0xcf8d07;}})});}_0x53146b=_[_0x3eea('0x40')]({},_0x53146b,_0x2b5a9b[_0x3eea('0x42')]);var _0x480ce2={'where':_0x53146b[_0x3eea('0x3f')]};return db[_0x3eea('0x2f')][_0x3eea('0x24')](_0x480ce2)['then'](function(_0x28c2b0){_0x16da8f['count']=_0x28c2b0;if(_0x2b5a9b[_0x3eea('0x34')]['includeAll']){_0x53146b[_0x3eea('0x43')]=[{'all':!![]}];}return db[_0x3eea('0x2f')][_0x3eea('0x44')](_0x53146b);})[_0x3eea('0x2b')](function(_0x49512e){_0x16da8f[_0x3eea('0x45')]=_0x49512e;return _0x16da8f;})['then'](respondWithFilteredResult(_0x5ab03f,_0x53146b))[_0x3eea('0x46')](handleError(_0x5ab03f,null));};exports['show']=function(_0x47aa33,_0x36ebcf){var _0x29e67d={'raw':![],'where':{'id':_0x47aa33[_0x3eea('0x47')]['id']}},_0x59e0fe={};_0x59e0fe['model']=_[_0x3eea('0x35')](db[_0x3eea('0x2f')][_0x3eea('0x30')]);_0x59e0fe[_0x3eea('0x34')]=_[_0x3eea('0x35')](_0x47aa33[_0x3eea('0x34')]);_0x59e0fe['filters']=_['intersection'](_0x59e0fe[_0x3eea('0x37')],_0x59e0fe[_0x3eea('0x34')]);_0x29e67d[_0x3eea('0x38')]=_[_0x3eea('0x39')](_0x59e0fe[_0x3eea('0x37')],qs[_0x3eea('0x3a')](_0x47aa33['query'][_0x3eea('0x3a')]));_0x29e67d[_0x3eea('0x38')]=_0x29e67d[_0x3eea('0x38')][_0x3eea('0x48')]?_0x29e67d[_0x3eea('0x38')]:_0x59e0fe[_0x3eea('0x37')];if(_0x47aa33[_0x3eea('0x34')][_0x3eea('0x49')]){_0x29e67d[_0x3eea('0x43')]=[{'all':!![]}];}_0x29e67d=_['merge']({},_0x29e67d,_0x47aa33['options']);return db[_0x3eea('0x2f')]['find'](_0x29e67d)[_0x3eea('0x2b')](handleEntityNotFound(_0x36ebcf,null))[_0x3eea('0x2b')](respondWithResult(_0x36ebcf,null))['catch'](handleError(_0x36ebcf,null));};exports[_0x3eea('0x4a')]=function(_0x1ef201,_0x304b5a){return db[_0x3eea('0x2f')][_0x3eea('0x4a')](_0x1ef201[_0x3eea('0x4b')],{})[_0x3eea('0x2b')](respondWithResult(_0x304b5a,0xc9))['catch'](handleError(_0x304b5a,null));};exports[_0x3eea('0x2a')]=function(_0x53c275,_0x349809){if(_0x53c275[_0x3eea('0x4b')]['id']){delete _0x53c275[_0x3eea('0x4b')]['id'];}return db['ServicenowAccount'][_0x3eea('0x4c')]({'where':{'id':_0x53c275[_0x3eea('0x47')]['id']}})[_0x3eea('0x2b')](handleEntityNotFound(_0x349809,null))['then'](saveUpdates(_0x53c275[_0x3eea('0x4b')],null))[_0x3eea('0x2b')](respondWithResult(_0x349809,null))[_0x3eea('0x46')](handleError(_0x349809,null));};exports[_0x3eea('0x2c')]=function(_0x1ef5ca,_0x81feaf){return db[_0x3eea('0x2f')][_0x3eea('0x4c')]({'where':{'id':_0x1ef5ca[_0x3eea('0x47')]['id']}})[_0x3eea('0x2b')](handleEntityNotFound(_0x81feaf,null))[_0x3eea('0x2b')](removeEntity(_0x81feaf,null))[_0x3eea('0x46')](handleError(_0x81feaf,null));};exports[_0x3eea('0x4d')]=function(_0x139a7,_0x3ca258,_0x1f3ad4){var _0x5ed7f6={};var _0x37f807={};var _0x3e81b9;var _0x252a57;return db[_0x3eea('0x2f')][_0x3eea('0x4e')]({'where':{'id':_0x139a7[_0x3eea('0x47')]['id']}})[_0x3eea('0x2b')](handleEntityNotFound(_0x3ca258,null))[_0x3eea('0x2b')](function(_0x579482){if(_0x579482){_0x3e81b9=_0x579482;_0x37f807[_0x3eea('0x37')]=_[_0x3eea('0x35')](db[_0x3eea('0x4f')][_0x3eea('0x30')]);_0x37f807[_0x3eea('0x34')]=_['keys'](_0x139a7[_0x3eea('0x34')]);_0x37f807[_0x3eea('0x36')]=_[_0x3eea('0x39')](_0x37f807[_0x3eea('0x37')],_0x37f807[_0x3eea('0x34')]);_0x5ed7f6[_0x3eea('0x38')]=_[_0x3eea('0x39')](_0x37f807[_0x3eea('0x37')],qs[_0x3eea('0x3a')](_0x139a7['query']['fields']));_0x5ed7f6[_0x3eea('0x38')]=_0x5ed7f6[_0x3eea('0x38')][_0x3eea('0x48')]?_0x5ed7f6['attributes']:_0x37f807[_0x3eea('0x37')];_0x5ed7f6['order']=qs[_0x3eea('0x3e')](_0x139a7[_0x3eea('0x34')][_0x3eea('0x3e')]);_0x5ed7f6[_0x3eea('0x3f')]=qs[_0x3eea('0x36')](_[_0x3eea('0x50')](_0x139a7[_0x3eea('0x34')],_0x37f807[_0x3eea('0x36')]));if(_0x139a7[_0x3eea('0x34')][_0x3eea('0x51')]){_0x5ed7f6[_0x3eea('0x3f')]=_[_0x3eea('0x40')](_0x5ed7f6[_0x3eea('0x3f')],{'$or':_[_0x3eea('0x33')](_0x5ed7f6['attributes'],function(_0x3a3268){var _0x2255a2={};_0x2255a2[_0x3a3268]={'$like':'%'+_0x139a7[_0x3eea('0x34')][_0x3eea('0x51')]+'%'};return _0x2255a2;})});}_0x5ed7f6=_[_0x3eea('0x40')]({},_0x5ed7f6,_0x139a7['options']);return _0x3e81b9['getConfigurations'](_0x5ed7f6);}})[_0x3eea('0x2b')](function(_0x15b81a){if(_0x15b81a){_0x252a57=_0x15b81a[_0x3eea('0x48')];if(!_0x139a7[_0x3eea('0x34')][_0x3eea('0x3b')]('nolimit')){_0x5ed7f6['limit']=qs[_0x3eea('0x23')](_0x139a7[_0x3eea('0x34')][_0x3eea('0x23')]);_0x5ed7f6[_0x3eea('0x21')]=qs[_0x3eea('0x21')](_0x139a7[_0x3eea('0x34')][_0x3eea('0x21')]);}return _0x3e81b9[_0x3eea('0x4d')](_0x5ed7f6);}})['then'](function(_0x36bdfb){if(_0x36bdfb){return _0x36bdfb?{'count':_0x252a57,'rows':_0x36bdfb}:null;}})[_0x3eea('0x2b')](respondWithResult(_0x3ca258,null))[_0x3eea('0x46')](handleError(_0x3ca258,null));};exports[_0x3eea('0x52')]=function(_0x3671f9,_0x5ada7d,_0x4bf796){if(_0x3671f9[_0x3eea('0x4b')]['id']){delete _0x3671f9[_0x3eea('0x4b')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0x3671f9['params']['id']}})['then'](handleEntityNotFound(_0x5ada7d,null))[_0x3eea('0x2b')](function(_0x3b7ebe){if(_0x3b7ebe){_0x3671f9[_0x3eea('0x4b')][_0x3eea('0x53')]=_0x3b7ebe['id'];_0x3671f9[_0x3eea('0x4b')]['Subjects']=integrations[_0x3eea('0x54')](_0x3671f9[_0x3eea('0x4b')][_0x3eea('0x55')],_0x3671f9['body'][_0x3eea('0x31')]);_0x3671f9[_0x3eea('0x4b')]['Descriptions']=integrations[_0x3eea('0x56')](_0x3671f9[_0x3eea('0x4b')]['channel'],_0x3671f9[_0x3eea('0x4b')][_0x3eea('0x31')]);return db[_0x3eea('0x4f')][_0x3eea('0x4a')](_0x3671f9['body'],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0x3eea('0x57')],'as':_0x3eea('0x58')}]});}return null;})[_0x3eea('0x2b')](respondWithResult(_0x5ada7d,null))['catch'](handleError(_0x5ada7d,null));};exports[_0x3eea('0x59')]=function(_0x17081b,_0x4b3e9b,_0x46b265){var _0x228b56=[_0x3eea('0x5a'),_0x3eea('0x5b'),_0x3eea('0x5c'),'subcategory',_0x3eea('0x5d'),'notify',_0x3eea('0x5e'),_0x3eea('0x5f'),_0x3eea('0x60')];var _0x486d4f=[_0x3eea('0x61'),'made_sla','caused_by',_0x3eea('0x62'),'upon_reject',_0x3eea('0x63'),_0x3eea('0x64'),'hold_reason',_0x3eea('0x65'),_0x3eea('0x66'),_0x3eea('0x67'),'sys_updated_by',_0x3eea('0x68'),'user_input',_0x3eea('0x69'),'sys_domain',_0x3eea('0x6a'),_0x3eea('0x6b'),_0x3eea('0x5c'),_0x3eea('0x3d'),_0x3eea('0x6c'),_0x3eea('0x6d'),_0x3eea('0x6e'),_0x3eea('0x6f'),_0x3eea('0x70'),_0x3eea('0x71'),'work_notes_list','business_service',_0x3eea('0x72'),_0x3eea('0x73'),_0x3eea('0x74'),_0x3eea('0x75'),_0x3eea('0x76'),'opened_at',_0x3eea('0x77'),_0x3eea('0x78'),_0x3eea('0x79'),_0x3eea('0x7a'),_0x3eea('0x7b'),_0x3eea('0x7c'),_0x3eea('0x7d'),_0x3eea('0x7e'),'work_notes','short_description',_0x3eea('0x5d'),'correlation_display',_0x3eea('0x7f'),_0x3eea('0x80'),_0x3eea('0x81'),_0x3eea('0x82'),'additional_assignee_list','description',_0x3eea('0x83'),_0x3eea('0x84'),_0x3eea('0x85'),_0x3eea('0x86'),'closed_by','follow_up','parent_incident',_0x3eea('0x87'),_0x3eea('0x88'),_0x3eea('0x89'),_0x3eea('0x5e'),_0x3eea('0x8a'),_0x3eea('0x8b'),_0x3eea('0x8c'),_0x3eea('0x8d'),_0x3eea('0x8e'),_0x3eea('0x8f'),_0x3eea('0x5f'),'comments','sla_due',_0x3eea('0x90'),_0x3eea('0x91'),'due_date','sys_mod_count',_0x3eea('0x92'),_0x3eea('0x93'),'escalation','upon_approval','correlation_id',_0x3eea('0x94'),_0x3eea('0x60')];var _0x5b5380='';var _0x5f392e='';var _0x42b3c4=[];var _0x12c379='';var _0x221eac='';var _0x4174b7=[];var _0x2a0a96='';var _0x2feb72='';var _0x4d5a83={};var _0x41ecb2='';return db['ServicenowAccount'][_0x3eea('0x4e')]({'where':{'id':_0x17081b[_0x3eea('0x47')]['id']},'attributes':['id',_0x3eea('0x95'),_0x3eea('0x96'),_0x3eea('0x97'),_0x3eea('0x98'),'serverUrl']})[_0x3eea('0x2b')](handleEntityNotFound(_0x4b3e9b,null))['then'](function(_0x366b54){if(_0x366b54){_0x41ecb2=_0x366b54[_0x3eea('0x98')];var _0x4d9523=_0x41ecb2['slice'](-0x1);if(_0x4d9523==='/'){_0x41ecb2=_0x41ecb2[_0x3eea('0x99')](0x0,_0x41ecb2[_0x3eea('0x9a')](_0x4d9523));}_0x2feb72=util[_0x3eea('0x9b')](_0x3eea('0x9c'),_0x41ecb2);_0x2a0a96=util[_0x3eea('0x9b')](_0x3eea('0x9d'),_0x41ecb2);_0x4d5a83={'user':_0x366b54[_0x3eea('0x95')],'pass':_0x366b54[_0x3eea('0x96')]};var _0xa909b={'method':_0x3eea('0x9e'),'uri':_0x2feb72+'incident?sysparm_display_value=all','auth':_0x4d5a83,'json':!![]};return rp(_0xa909b);}})[_0x3eea('0x2b')](function(_0x3e24b7){if(_0x3e24b7[_0x3eea('0x9f')][_0x3eea('0x48')]>0x0){_0x5b5380=_0x3e24b7['result'];}console[_0x3eea('0xa0')](_0x3eea('0xa1'),_0x5b5380);_0x4174b7=[];_0x5f392e=Object[_0x3eea('0xa2')]([],_0x5b5380);_[_0x3eea('0xa3')](_0x5f392e,function(_0x167a27){return!_0x228b56[_0x3eea('0xa4')](_0x167a27[_0x3eea('0x2e')]);});_0x5f392e[_0x3eea('0xa5')](function(_0x17f54a){var _0x290b82=createFieldObject(_0x2a0a96,_0x4d5a83,_0x17f54a[_0x3eea('0xa6')],_0x17f54a[_0x3eea('0x2e')],_0x17f54a[_0x3eea('0xa7')],![]);_0x4174b7[_0x3eea('0xa8')](_0x290b82);});return Promise[_0x3eea('0xa9')](_0x4174b7);})[_0x3eea('0x2b')](function(_0x6d1117){_0x42b3c4=_0x6d1117;_0x12c379=Object['assign']([],_0x5b5380);console[_0x3eea('0xa0')]('TCL:\x20_object',_0x5b5380);_[_0x3eea('0xa3')](_0x12c379,function(_0x206f02){return _0x486d4f[_0x3eea('0xa4')](_0x206f02['name']);});console[_0x3eea('0xa0')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x12c379);_0x4174b7=[];_0x12c379['forEach'](function(_0x203293){var _0x167776=createFieldObject(_0x2a0a96,_0x4d5a83,_0x203293[_0x3eea('0xa6')],_0x203293[_0x3eea('0x2e')],_0x203293['label'],!![]);_0x4174b7['push'](_0x167776);});return Promise[_0x3eea('0xa9')](_0x4174b7);})['then'](function(_0x24bc9b){_0x221eac=_0x24bc9b;var _0x5ed2d4=_0x42b3c4[_0x3eea('0xaa')](_0x221eac);return{'count':_0x5ed2d4[_0x3eea('0x48')],'rows':_0x5ed2d4};})['then'](respondWithResult(_0x4b3e9b,null))[_0x3eea('0x46')](function(_0x3bf808){console[_0x3eea('0xa0')](_0x3eea('0xab')+_0x3bf808);var _0x226336=_0x17081b[_0x3eea('0x34')]['test']?0x1f4:_0x3bf808[_0x3eea('0xac')]||0x1f4;logger[_0x3eea('0xad')](_0x3bf808[_0x3eea('0x2d')]);delete _0x3bf808['name'];if(_0x226336===0x191){_0x226336=0x190;}_0x4b3e9b['status'](_0x226336)[_0x3eea('0xae')](_0x17081b[_0x3eea('0x34')][_0x3eea('0xaf')]?{'message':'Wrong\x20credentials','statusCode':_0x3bf808['statusCode']}:_0x3bf808);});};function createFieldObject(_0x10ee8d,_0x3a2db2,_0x31da67,_0x51b093,_0x29c1de,_0x5f4428){return new Promise(function(_0x3bdf2d,_0x2665e9){var _0x236802={'id':_0x51b093,'name':_0x29c1de,'custom':_0x5f4428};if(_0x31da67===_0x3eea('0xb0')){_0x236802[_0x3eea('0x42')]=[{'name':'True','value':_0x3eea('0xb1')},{'name':_0x3eea('0xb2'),'value':_0x3eea('0xb3')}];_0x3bdf2d(_0x236802);}else{var _0x28d6f2={'method':_0x3eea('0x9e'),'uri':_0x10ee8d+_0x3eea('0xb4')+_0x51b093,'auth':_0x3a2db2,'json':!![]};return rp(_0x28d6f2)[_0x3eea('0x2b')](function(_0x537f45){var _0x168c00=[];if(_0x537f45[_0x3eea('0x9f')][_0x3eea('0x48')]>0x0){_0x537f45[_0x3eea('0x9f')]['forEach'](function(_0x40127b){if(_0x40127b[_0x3eea('0xb5')]==='false'){var _0x5e0f3f={'name':_0x40127b[_0x3eea('0xa7')],'value':_0x40127b[_0x3eea('0xb6')]};_0x168c00[_0x3eea('0xa8')](_0x5e0f3f);}});}_0x236802[_0x3eea('0x42')]=_0x168c00;if(_0x236802[_0x3eea('0x42')][_0x3eea('0x48')]>0x0){_0x3bdf2d(_0x236802);}else{if(_0x5f4428==![]){_0x3bdf2d();}else{_0x3bdf2d(_0x236802);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index eec844f..a17f0ec 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 _0xafc4=['path','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x2853a2,_0x30a79c){var _0x5460ff=function(_0x4ec34e){while(--_0x4ec34e){_0x2853a2['push'](_0x2853a2['shift']());}};_0x5460ff(++_0x30a79c);}(_0xafc4,0x69));var _0x4afc=function(_0x1b04a6,_0x5825f3){_0x1b04a6=_0x1b04a6-0x0;var _0x406fdc=_0xafc4[_0x1b04a6];return _0x406fdc;};'use strict';var _=require(_0x4afc('0x0'));var util=require('util');var logger=require(_0x4afc('0x1'))('api');var moment=require(_0x4afc('0x2'));var BPromise=require(_0x4afc('0x3'));var rp=require(_0x4afc('0x4'));var fs=require('fs');var path=require(_0x4afc('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0x4afc('0x6'));module[_0x4afc('0x7')]=function(_0x16953b,_0x1bb281){return _0x16953b[_0x4afc('0x8')](_0x4afc('0x9'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['path','../../config/environment','./intServicenowAccount.attributes','exports','define','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x53ec,0x192));var _0xc53e=function(_0x3aa321,_0x5bcde5){_0x3aa321=_0x3aa321-0x0;var _0x2bc5a5=_0x53ec[_0x3aa321];return _0x2bc5a5;};'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'));var integrations=require('../../components/integrations/configuration');module[_0xc53e('0x9')]=function(_0x4f989b,_0x41a9e8){return _0x4f989b[_0xc53e('0xa')]('ServicenowAccount',attributes,{'tableName':_0xc53e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index 9d39a22..0a04336 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 _0x98f5=['then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ServicenowAccount','findAll','options','raw','attributes','include','map','model','GetServicenowAccount','ShowServicenowAccount','find','where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x41b0a8,_0x1b05cc){var _0x3a83d4=function(_0x3d1011){while(--_0x3d1011){_0x41b0a8['push'](_0x41b0a8['shift']());}};_0x3a83d4(++_0x1b05cc);}(_0x98f5,0xc6));var _0x598f=function(_0x3cab90,_0x214670){_0x3cab90=_0x3cab90-0x0;var _0x5720a3=_0x98f5[_0x3cab90];return _0x5720a3;};'use strict';var _=require(_0x598f('0x0'));var util=require('util');var moment=require(_0x598f('0x1'));var BPromise=require(_0x598f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x598f('0x3'));var db=require(_0x598f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x598f('0x5'))(_0x598f('0x6'));var config=require(_0x598f('0x7'));var jayson=require(_0x598f('0x8'));var client=jayson[_0x598f('0x9')][_0x598f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x52e361,_0x759d8,_0x4ec79f){return new BPromise(function(_0xb0076a,_0x19ba7f){return client[_0x598f('0xb')](_0x52e361,_0x4ec79f)[_0x598f('0xc')](function(_0x305984){logger[_0x598f('0xd')](_0x598f('0xe'),_0x759d8,_0x598f('0xf'));logger[_0x598f('0x10')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x759d8,'request\x20sent',JSON[_0x598f('0x11')](_0x305984));if(_0x305984[_0x598f('0x12')]){if(_0x305984[_0x598f('0x12')][_0x598f('0x13')]===0x1f4){logger[_0x598f('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x759d8,_0x305984[_0x598f('0x12')][_0x598f('0x14')]);return _0x19ba7f(_0x305984['error'][_0x598f('0x14')]);}logger[_0x598f('0x12')](_0x598f('0xe'),_0x759d8,_0x305984[_0x598f('0x12')][_0x598f('0x14')]);return _0xb0076a(_0x305984['error'][_0x598f('0x14')]);}else{logger[_0x598f('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x759d8,_0x598f('0xf'));_0xb0076a(_0x305984[_0x598f('0x15')][_0x598f('0x14')]);}})[_0x598f('0x16')](function(_0x190f3e){logger[_0x598f('0x12')](_0x598f('0xe'),_0x759d8,_0x190f3e);_0x19ba7f(_0x190f3e);});});}exports['GetServicenowAccount']=function(_0x4f79fd){var _0x47de35=this;return new Promise(function(_0x5805d0,_0x4b4c26){return db[_0x598f('0x17')][_0x598f('0x18')]({'raw':_0x4f79fd[_0x598f('0x19')]?_0x4f79fd['options'][_0x598f('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f79fd[_0x598f('0x19')]?_0x4f79fd[_0x598f('0x19')]['where']||null:null,'attributes':_0x4f79fd[_0x598f('0x19')]?_0x4f79fd[_0x598f('0x19')][_0x598f('0x1b')]||null:null,'limit':_0x4f79fd[_0x598f('0x19')]?_0x4f79fd[_0x598f('0x19')]['limit']||null:null,'include':_0x4f79fd[_0x598f('0x19')]?_0x4f79fd[_0x598f('0x19')][_0x598f('0x1c')]?_[_0x598f('0x1d')](_0x4f79fd[_0x598f('0x19')]['include'],function(_0x9b4446){return{'model':db[_0x9b4446[_0x598f('0x1e')]],'as':_0x9b4446['as'],'attributes':_0x9b4446[_0x598f('0x1b')],'include':_0x9b4446['include']?_[_0x598f('0x1d')](_0x9b4446['include'],function(_0x40f16c){return{'model':db[_0x40f16c[_0x598f('0x1e')]],'as':_0x40f16c['as'],'attributes':_0x40f16c[_0x598f('0x1b')],'include':_0x40f16c[_0x598f('0x1c')]?_['map'](_0x40f16c[_0x598f('0x1c')],function(_0x2d8839){return{'model':db[_0x2d8839[_0x598f('0x1e')]],'as':_0x2d8839['as'],'attributes':_0x2d8839[_0x598f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x598f('0xc')](function(_0xa9f226){logger[_0x598f('0xd')](_0x598f('0x1f'),_0x4f79fd);logger['debug'](_0x598f('0x1f'),_0x4f79fd,JSON[_0x598f('0x11')](_0xa9f226));_0x5805d0(_0xa9f226);})[_0x598f('0x16')](function(_0x36c3be){logger[_0x598f('0x12')]('GetServicenowAccount',_0x36c3be[_0x598f('0x14')],_0x4f79fd);_0x4b4c26(_0x47de35[_0x598f('0x12')](0x1f4,_0x36c3be['message']));});});};exports[_0x598f('0x20')]=function(_0x5a5e8b){var _0x578999=this;return new Promise(function(_0x20142f,_0x514888){return db[_0x598f('0x17')][_0x598f('0x21')]({'raw':_0x5a5e8b[_0x598f('0x19')]?_0x5a5e8b[_0x598f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5a5e8b[_0x598f('0x19')]?_0x5a5e8b[_0x598f('0x19')][_0x598f('0x22')]||null:null,'attributes':_0x5a5e8b['options']?_0x5a5e8b[_0x598f('0x19')][_0x598f('0x1b')]||null:null,'include':_0x5a5e8b[_0x598f('0x19')]?_0x5a5e8b['options']['include']?_[_0x598f('0x1d')](_0x5a5e8b['options'][_0x598f('0x1c')],function(_0x219caf){return{'model':db[_0x219caf[_0x598f('0x1e')]],'as':_0x219caf['as'],'attributes':_0x219caf[_0x598f('0x1b')],'include':_0x219caf[_0x598f('0x1c')]?_[_0x598f('0x1d')](_0x219caf[_0x598f('0x1c')],function(_0x37583d){return{'model':db[_0x37583d['model']],'as':_0x37583d['as'],'attributes':_0x37583d[_0x598f('0x1b')],'include':_0x37583d[_0x598f('0x1c')]?_[_0x598f('0x1d')](_0x37583d['include'],function(_0x1d3406){return{'model':db[_0x1d3406[_0x598f('0x1e')]],'as':_0x1d3406['as'],'attributes':_0x1d3406[_0x598f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x598f('0xc')](function(_0x4c4853){logger[_0x598f('0xd')](_0x598f('0x20'),_0x5a5e8b);logger[_0x598f('0x10')](_0x598f('0x20'),_0x5a5e8b,JSON[_0x598f('0x11')](_0x4c4853));_0x20142f(_0x4c4853);})['catch'](function(_0x36f026){logger['error'](_0x598f('0x20'),_0x36f026['message'],_0x5a5e8b);_0x514888(_0x578999['error'](0x1f4,_0x36f026[_0x598f('0x14')]));});});}; \ No newline at end of file +var _0xe93b=['ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','ServicenowAccount','findAll','options','limit','map','include','model','attributes','GetServicenowAccount','catch','ShowServicenowAccount','raw','where','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug'];(function(_0x3aa4a3,_0x4619a5){var _0x44a8cd=function(_0x51c91c){while(--_0x51c91c){_0x3aa4a3['push'](_0x3aa4a3['shift']());}};_0x44a8cd(++_0x4619a5);}(_0xe93b,0x7a));var _0xbe93=function(_0x510312,_0x43c877){_0x510312=_0x510312-0x0;var _0xfa8076=_0xe93b[_0x510312];return _0xfa8076;};'use strict';var _=require(_0xbe93('0x0'));var util=require('util');var moment=require(_0xbe93('0x1'));var BPromise=require(_0xbe93('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbe93('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe93('0x4'));var logger=require(_0xbe93('0x5'))(_0xbe93('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbe93('0x7')][_0xbe93('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x545409,_0xc1d4c0,_0x23cf3f){return new BPromise(function(_0x5496a9,_0x472218){return client[_0xbe93('0x9')](_0x545409,_0x23cf3f)[_0xbe93('0xa')](function(_0x1064a1){logger[_0xbe93('0xb')]('ServicenowAccount,\x20%s,\x20%s',_0xc1d4c0,_0xbe93('0xc'));logger[_0xbe93('0xd')](_0xbe93('0xe'),_0xc1d4c0,'request\x20sent',JSON[_0xbe93('0xf')](_0x1064a1));if(_0x1064a1[_0xbe93('0x10')]){if(_0x1064a1[_0xbe93('0x10')][_0xbe93('0x11')]===0x1f4){logger[_0xbe93('0x10')](_0xbe93('0x12'),_0xc1d4c0,_0x1064a1['error'][_0xbe93('0x13')]);return _0x472218(_0x1064a1[_0xbe93('0x10')][_0xbe93('0x13')]);}logger[_0xbe93('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0xc1d4c0,_0x1064a1[_0xbe93('0x10')][_0xbe93('0x13')]);return _0x5496a9(_0x1064a1[_0xbe93('0x10')][_0xbe93('0x13')]);}else{logger['info'](_0xbe93('0x12'),_0xc1d4c0,'request\x20sent');_0x5496a9(_0x1064a1[_0xbe93('0x14')]['message']);}})['catch'](function(_0x46ee8b){logger[_0xbe93('0x10')](_0xbe93('0x12'),_0xc1d4c0,_0x46ee8b);_0x472218(_0x46ee8b);});});}exports['GetServicenowAccount']=function(_0x44c1f1){var _0x4a6835=this;return new Promise(function(_0x40059c,_0x4ca2b6){return db[_0xbe93('0x15')][_0xbe93('0x16')]({'raw':_0x44c1f1[_0xbe93('0x17')]?_0x44c1f1[_0xbe93('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x44c1f1['options']?_0x44c1f1[_0xbe93('0x17')]['where']||null:null,'attributes':_0x44c1f1[_0xbe93('0x17')]?_0x44c1f1['options']['attributes']||null:null,'limit':_0x44c1f1[_0xbe93('0x17')]?_0x44c1f1[_0xbe93('0x17')][_0xbe93('0x18')]||null:null,'include':_0x44c1f1['options']?_0x44c1f1[_0xbe93('0x17')]['include']?_[_0xbe93('0x19')](_0x44c1f1[_0xbe93('0x17')][_0xbe93('0x1a')],function(_0x248621){return{'model':db[_0x248621[_0xbe93('0x1b')]],'as':_0x248621['as'],'attributes':_0x248621['attributes'],'include':_0x248621[_0xbe93('0x1a')]?_[_0xbe93('0x19')](_0x248621[_0xbe93('0x1a')],function(_0xb0c81b){return{'model':db[_0xb0c81b[_0xbe93('0x1b')]],'as':_0xb0c81b['as'],'attributes':_0xb0c81b[_0xbe93('0x1c')],'include':_0xb0c81b[_0xbe93('0x1a')]?_['map'](_0xb0c81b[_0xbe93('0x1a')],function(_0x4e6a30){return{'model':db[_0x4e6a30[_0xbe93('0x1b')]],'as':_0x4e6a30['as'],'attributes':_0x4e6a30[_0xbe93('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbe93('0xa')](function(_0x1e6701){logger[_0xbe93('0xb')](_0xbe93('0x1d'),_0x44c1f1);logger['debug']('GetServicenowAccount',_0x44c1f1,JSON[_0xbe93('0xf')](_0x1e6701));_0x40059c(_0x1e6701);})[_0xbe93('0x1e')](function(_0x4f1c59){logger[_0xbe93('0x10')](_0xbe93('0x1d'),_0x4f1c59[_0xbe93('0x13')],_0x44c1f1);_0x4ca2b6(_0x4a6835[_0xbe93('0x10')](0x1f4,_0x4f1c59[_0xbe93('0x13')]));});});};exports[_0xbe93('0x1f')]=function(_0x253ddf){var _0x2e21df=this;return new Promise(function(_0x22b2ea,_0x5c92c4){return db[_0xbe93('0x15')]['find']({'raw':_0x253ddf[_0xbe93('0x17')]?_0x253ddf[_0xbe93('0x17')][_0xbe93('0x20')]===undefined?!![]:![]:!![],'where':_0x253ddf['options']?_0x253ddf[_0xbe93('0x17')][_0xbe93('0x21')]||null:null,'attributes':_0x253ddf['options']?_0x253ddf[_0xbe93('0x17')][_0xbe93('0x1c')]||null:null,'include':_0x253ddf[_0xbe93('0x17')]?_0x253ddf[_0xbe93('0x17')][_0xbe93('0x1a')]?_[_0xbe93('0x19')](_0x253ddf[_0xbe93('0x17')][_0xbe93('0x1a')],function(_0x98ab71){return{'model':db[_0x98ab71['model']],'as':_0x98ab71['as'],'attributes':_0x98ab71[_0xbe93('0x1c')],'include':_0x98ab71[_0xbe93('0x1a')]?_['map'](_0x98ab71['include'],function(_0x2d184f){return{'model':db[_0x2d184f[_0xbe93('0x1b')]],'as':_0x2d184f['as'],'attributes':_0x2d184f[_0xbe93('0x1c')],'include':_0x2d184f[_0xbe93('0x1a')]?_[_0xbe93('0x19')](_0x2d184f[_0xbe93('0x1a')],function(_0x12f55b){return{'model':db[_0x12f55b[_0xbe93('0x1b')]],'as':_0x12f55b['as'],'attributes':_0x12f55b[_0xbe93('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbe93('0xa')](function(_0x3bf420){logger[_0xbe93('0xb')]('ShowServicenowAccount',_0x253ddf);logger[_0xbe93('0xd')]('ShowServicenowAccount',_0x253ddf,JSON[_0xbe93('0xf')](_0x3bf420));_0x22b2ea(_0x3bf420);})[_0xbe93('0x1e')](function(_0x3a2f45){logger[_0xbe93('0x10')](_0xbe93('0x1f'),_0x3a2f45[_0xbe93('0x13')],_0x253ddf);_0x5c92c4(_0x2e21df[_0xbe93('0x10')](0x1f4,_0x3a2f45[_0xbe93('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 851092b..33dc610 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 _0x9a28=['delete','exports','multer','path','connect-timeout','express','Router','fs-extra','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','update'];(function(_0x41db99,_0x333f4b){var _0xb8637a=function(_0x18faa9){while(--_0x18faa9){_0x41db99['push'](_0x41db99['shift']());}};_0xb8637a(++_0x333f4b);}(_0x9a28,0x95));var _0x89a2=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x9a28[_0x45f951];return _0x24756c;};'use strict';var multer=require(_0x89a2('0x0'));var util=require('util');var path=require(_0x89a2('0x1'));var timeout=require(_0x89a2('0x2'));var express=require(_0x89a2('0x3'));var router=express[_0x89a2('0x4')]();var fs_extra=require(_0x89a2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x89a2('0x6'));router[_0x89a2('0x7')]('/',auth[_0x89a2('0x8')](),controller[_0x89a2('0x9')]);router['get'](_0x89a2('0xa'),auth['isAuthenticated'](),controller[_0x89a2('0xb')]);router[_0x89a2('0x7')](_0x89a2('0xc'),auth['isAuthenticated'](),controller[_0x89a2('0xd')]);router[_0x89a2('0x7')](_0x89a2('0xe'),auth[_0x89a2('0x8')](),controller['getSubjects']);router[_0x89a2('0x7')](_0x89a2('0xf'),auth[_0x89a2('0x8')](),controller[_0x89a2('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x89a2('0x11')]);router['put'](_0x89a2('0xa'),auth[_0x89a2('0x8')](),controller[_0x89a2('0x12')]);router[_0x89a2('0x13')](_0x89a2('0xa'),auth[_0x89a2('0x8')](),controller['destroy']);module[_0x89a2('0x14')]=router; \ No newline at end of file +var _0xd555=['update','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x4d6fc0,_0x3c3e7d){var _0x2569a6=function(_0x4f5cbf){while(--_0x4f5cbf){_0x4d6fc0['push'](_0x4d6fc0['shift']());}};_0x2569a6(++_0x3c3e7d);}(_0xd555,0x10b));var _0x5d55=function(_0x291ec3,_0x2f19a7){_0x291ec3=_0x291ec3-0x0;var _0x423b99=_0xd555[_0x291ec3];return _0x423b99;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5d55('0x0'));var timeout=require(_0x5d55('0x1'));var express=require(_0x5d55('0x2'));var router=express['Router']();var fs_extra=require(_0x5d55('0x3'));var auth=require(_0x5d55('0x4'));var interaction=require(_0x5d55('0x5'));var config=require(_0x5d55('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0x5d55('0x7')]('/',auth[_0x5d55('0x8')](),controller[_0x5d55('0x9')]);router['get'](_0x5d55('0xa'),auth[_0x5d55('0x8')](),controller[_0x5d55('0xb')]);router[_0x5d55('0x7')](_0x5d55('0xc'),auth[_0x5d55('0x8')](),controller[_0x5d55('0xd')]);router[_0x5d55('0x7')](_0x5d55('0xe'),auth[_0x5d55('0x8')](),controller[_0x5d55('0xf')]);router[_0x5d55('0x7')](_0x5d55('0x10'),auth[_0x5d55('0x8')](),controller[_0x5d55('0x11')]);router[_0x5d55('0x12')]('/',auth[_0x5d55('0x8')](),controller[_0x5d55('0x13')]);router[_0x5d55('0x14')]('/:id',auth[_0x5d55('0x8')](),controller[_0x5d55('0x15')]);router['delete']('/:id',auth[_0x5d55('0x8')](),controller[_0x5d55('0x16')]);module[_0x5d55('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index ccfae83..8443249 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 _0x38df=['STRING','sequelize','exports'];(function(_0x36f284,_0x24cbd1){var _0x4ea099=function(_0xea729e){while(--_0xea729e){_0x36f284['push'](_0x36f284['shift']());}};_0x4ea099(++_0x24cbd1);}(_0x38df,0x17e));var _0xf38d=function(_0x5ef1d3,_0x1feca1){_0x5ef1d3=_0x5ef1d3-0x0;var _0x3c990e=_0x38df[_0x5ef1d3];return _0x3c990e;};'use strict';var Sequelize=require(_0xf38d('0x0'));module[_0xf38d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf38d('0x2')]}}; \ No newline at end of file +var _0x5698=['sequelize'];(function(_0x4264cd,_0xb9d8e2){var _0x28f7d3=function(_0x15b44d){while(--_0x15b44d){_0x4264cd['push'](_0x4264cd['shift']());}};_0x28f7d3(++_0xb9d8e2);}(_0x5698,0x6a));var _0x8569=function(_0x5c1eaf,_0x2d7243){_0x5c1eaf=_0x5c1eaf-0x0;var _0x5d1455=_0x5698[_0x5c1eaf];return _0x5d1455;};'use strict';var Sequelize=require(_0x8569('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index b498795..96c4550 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 _0x7ba4=['then','destroy','end','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','catch','create','body','find','params','getFields','findOne','ServicenowField','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update'];(function(_0x14e799,_0x5aba4e){var _0x45e6f0=function(_0x4d7820){while(--_0x4d7820){_0x14e799['push'](_0x14e799['shift']());}};_0x45e6f0(++_0x5aba4e);}(_0x7ba4,0xd8));var _0x47ba=function(_0x32d546,_0xa35096){_0x32d546=_0x32d546-0x0;var _0x5236bb=_0x7ba4[_0x32d546];return _0x5236bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x47ba('0x0'));var zipdir=require(_0x47ba('0x1'));var jsonpatch=require(_0x47ba('0x2'));var rp=require(_0x47ba('0x3'));var moment=require(_0x47ba('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47ba('0x5'));var util=require(_0x47ba('0x6'));var path=require(_0x47ba('0x7'));var sox=require(_0x47ba('0x8'));var csv=require(_0x47ba('0x9'));var ejs=require(_0x47ba('0xa'));var fs=require('fs');var fs_extra=require(_0x47ba('0xb'));var _=require(_0x47ba('0xc'));var squel=require(_0x47ba('0xd'));var crypto=require('crypto');var jsforce=require(_0x47ba('0xe'));var deskjs=require(_0x47ba('0xf'));var toCsv=require(_0x47ba('0x9'));var querystring=require(_0x47ba('0x10'));var Papa=require(_0x47ba('0x11'));var Redis=require('ioredis');var authService=require(_0x47ba('0x12'));var qs=require(_0x47ba('0x13'));var as=require(_0x47ba('0x14'));var hardwareService=require(_0x47ba('0x15'));var logger=require(_0x47ba('0x16'))(_0x47ba('0x17'));var utils=require(_0x47ba('0x18'));var config=require(_0x47ba('0x19'));var licenseUtil=require(_0x47ba('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c6fb5,_0x853a5a){_0x853a5a=_0x853a5a||0xcc;return function(_0x5a5bc9){if(_0x5a5bc9){return _0x5c6fb5[_0x47ba('0x1b')](_0x853a5a);}return _0x5c6fb5[_0x47ba('0x1c')](_0x853a5a)['end']();};}function respondWithResult(_0x531572,_0x21a9d9){_0x21a9d9=_0x21a9d9||0xc8;return function(_0x406bdc){if(_0x406bdc){return _0x531572[_0x47ba('0x1c')](_0x21a9d9)[_0x47ba('0x1d')](_0x406bdc);}};}function respondWithFilteredResult(_0x593432,_0x204e7d){return function(_0x324b9f){if(_0x324b9f){var _0x11945f=typeof _0x204e7d['offset']===_0x47ba('0x1e')&&typeof _0x204e7d[_0x47ba('0x1f')]===_0x47ba('0x1e');var _0x5b679a=_0x324b9f['count'];var _0x279379=_0x11945f?0x0:_0x204e7d[_0x47ba('0x20')];var _0x1f9797=_0x11945f?_0x324b9f[_0x47ba('0x21')]:_0x204e7d[_0x47ba('0x20')]+_0x204e7d['limit'];var _0x577484;if(_0x1f9797>=_0x5b679a){_0x1f9797=_0x5b679a;_0x577484=0xc8;}else{_0x577484=0xce;}_0x593432[_0x47ba('0x1c')](_0x577484);return _0x593432[_0x47ba('0x22')](_0x47ba('0x23'),_0x279379+'-'+_0x1f9797+'/'+_0x5b679a)[_0x47ba('0x1d')](_0x324b9f);}return null;};}function patchUpdates(_0x10ddfd){return function(_0x43e2f4){try{jsonpatch[_0x47ba('0x24')](_0x43e2f4,_0x10ddfd,!![]);}catch(_0x58ec3a){return BPromise['reject'](_0x58ec3a);}return _0x43e2f4[_0x47ba('0x25')]();};}function saveUpdates(_0x70f82a,_0x42b594){return function(_0x5386ac){if(_0x5386ac){return _0x5386ac[_0x47ba('0x26')](_0x70f82a)[_0x47ba('0x27')](function(_0x2901f3){return _0x2901f3;});}return null;};}function removeEntity(_0x2111e6,_0x1076be){return function(_0x610986){if(_0x610986){return _0x610986[_0x47ba('0x28')]()['then'](function(){_0x2111e6[_0x47ba('0x1c')](0xcc)[_0x47ba('0x29')]();});}};}function handleEntityNotFound(_0x170ff1,_0x230216){return function(_0x3eb2c7){if(!_0x3eb2c7){_0x170ff1['sendStatus'](0x194);}return _0x3eb2c7;};}function handleError(_0x273df9,_0xc1cefd){_0xc1cefd=_0xc1cefd||0x1f4;return function(_0x323d72){logger['error'](_0x323d72[_0x47ba('0x2a')]);if(_0x323d72[_0x47ba('0x2b')]){delete _0x323d72[_0x47ba('0x2b')];}_0x273df9[_0x47ba('0x1c')](_0xc1cefd)[_0x47ba('0x2c')](_0x323d72);};}exports[_0x47ba('0x2d')]=function(_0x3403e1,_0x5122ff){var _0x2cb043={},_0x2907d5={},_0x4541b0={'count':0x0,'rows':[]};var _0x284082=_[_0x47ba('0x2e')](db[_0x47ba('0x2f')][_0x47ba('0x30')],function(_0x38f4c1){return{'name':_0x38f4c1[_0x47ba('0x31')],'type':_0x38f4c1['type'][_0x47ba('0x32')]};});_0x2907d5[_0x47ba('0x33')]=_[_0x47ba('0x2e')](_0x284082,_0x47ba('0x2b'));_0x2907d5[_0x47ba('0x34')]=_[_0x47ba('0x35')](_0x3403e1[_0x47ba('0x34')]);_0x2907d5[_0x47ba('0x36')]=_[_0x47ba('0x37')](_0x2907d5[_0x47ba('0x33')],_0x2907d5[_0x47ba('0x34')]);_0x2cb043[_0x47ba('0x38')]=_[_0x47ba('0x37')](_0x2907d5[_0x47ba('0x33')],qs[_0x47ba('0x39')](_0x3403e1[_0x47ba('0x34')][_0x47ba('0x39')]));_0x2cb043[_0x47ba('0x38')]=_0x2cb043[_0x47ba('0x38')][_0x47ba('0x3a')]?_0x2cb043[_0x47ba('0x38')]:_0x2907d5[_0x47ba('0x33')];if(!_0x3403e1[_0x47ba('0x34')]['hasOwnProperty'](_0x47ba('0x3b'))){_0x2cb043[_0x47ba('0x1f')]=qs['limit'](_0x3403e1['query'][_0x47ba('0x1f')]);_0x2cb043[_0x47ba('0x20')]=qs[_0x47ba('0x20')](_0x3403e1[_0x47ba('0x34')][_0x47ba('0x20')]);}_0x2cb043[_0x47ba('0x3c')]=qs[_0x47ba('0x3d')](_0x3403e1[_0x47ba('0x34')][_0x47ba('0x3d')]);_0x2cb043[_0x47ba('0x3e')]=qs[_0x47ba('0x36')](_[_0x47ba('0x3f')](_0x3403e1[_0x47ba('0x34')],_0x2907d5['filters']),_0x284082);if(_0x3403e1[_0x47ba('0x34')][_0x47ba('0x40')]){_0x2cb043[_0x47ba('0x3e')]=_[_0x47ba('0x41')](_0x2cb043['where'],{'$or':_['map'](_0x284082,function(_0x1256a6){if(_0x1256a6[_0x47ba('0x42')]!==_0x47ba('0x43')){var _0x4b5e17={};_0x4b5e17[_0x1256a6['name']]={'$like':'%'+_0x3403e1[_0x47ba('0x34')][_0x47ba('0x40')]+'%'};return _0x4b5e17;}})});}_0x2cb043=_[_0x47ba('0x41')]({},_0x2cb043,_0x3403e1[_0x47ba('0x44')]);var _0x3dd34f={'where':_0x2cb043['where']};return db[_0x47ba('0x2f')][_0x47ba('0x21')](_0x3dd34f)[_0x47ba('0x27')](function(_0x380827){_0x4541b0[_0x47ba('0x21')]=_0x380827;if(_0x3403e1[_0x47ba('0x34')][_0x47ba('0x45')]){_0x2cb043[_0x47ba('0x46')]=[{'all':!![]}];}return db[_0x47ba('0x2f')][_0x47ba('0x47')](_0x2cb043);})[_0x47ba('0x27')](function(_0x351758){_0x4541b0[_0x47ba('0x48')]=_0x351758;return _0x4541b0;})[_0x47ba('0x27')](respondWithFilteredResult(_0x5122ff,_0x2cb043))['catch'](handleError(_0x5122ff,null));};exports[_0x47ba('0x49')]=function(_0x440478,_0x244d67){var _0x5ed369={'raw':![],'where':{'id':_0x440478['params']['id']}},_0x313094={};_0x313094[_0x47ba('0x33')]=_[_0x47ba('0x35')](db[_0x47ba('0x2f')][_0x47ba('0x30')]);_0x313094[_0x47ba('0x34')]=_[_0x47ba('0x35')](_0x440478[_0x47ba('0x34')]);_0x313094[_0x47ba('0x36')]=_[_0x47ba('0x37')](_0x313094['model'],_0x313094[_0x47ba('0x34')]);_0x5ed369[_0x47ba('0x38')]=_[_0x47ba('0x37')](_0x313094['model'],qs[_0x47ba('0x39')](_0x440478[_0x47ba('0x34')][_0x47ba('0x39')]));_0x5ed369[_0x47ba('0x38')]=_0x5ed369['attributes'][_0x47ba('0x3a')]?_0x5ed369[_0x47ba('0x38')]:_0x313094[_0x47ba('0x33')];if(_0x440478[_0x47ba('0x34')]['includeAll']){_0x5ed369[_0x47ba('0x46')]=[{'all':!![]}];}_0x5ed369=_[_0x47ba('0x41')]({},_0x5ed369,_0x440478[_0x47ba('0x44')]);return db['ServicenowConfiguration']['find'](_0x5ed369)[_0x47ba('0x27')](handleEntityNotFound(_0x244d67,null))[_0x47ba('0x27')](respondWithResult(_0x244d67,null))[_0x47ba('0x4a')](handleError(_0x244d67,null));};exports[_0x47ba('0x4b')]=function(_0x5af7e0,_0xc336c){return db[_0x47ba('0x2f')][_0x47ba('0x4b')](_0x5af7e0['body'],{})['then'](respondWithResult(_0xc336c,0xc9))['catch'](handleError(_0xc336c,null));};exports[_0x47ba('0x26')]=function(_0x417f44,_0x529345){if(_0x417f44[_0x47ba('0x4c')]['id']){delete _0x417f44[_0x47ba('0x4c')]['id'];}return db['ServicenowConfiguration'][_0x47ba('0x4d')]({'where':{'id':_0x417f44[_0x47ba('0x4e')]['id']}})[_0x47ba('0x27')](handleEntityNotFound(_0x529345,null))[_0x47ba('0x27')](saveUpdates(_0x417f44[_0x47ba('0x4c')],null))[_0x47ba('0x27')](respondWithResult(_0x529345,null))[_0x47ba('0x4a')](handleError(_0x529345,null));};exports['destroy']=function(_0x595ce8,_0x637d02){return db[_0x47ba('0x2f')][_0x47ba('0x4d')]({'where':{'id':_0x595ce8[_0x47ba('0x4e')]['id']}})[_0x47ba('0x27')](handleEntityNotFound(_0x637d02,null))[_0x47ba('0x27')](removeEntity(_0x637d02,null))['catch'](handleError(_0x637d02,null));};exports[_0x47ba('0x4f')]=function(_0x4418ef,_0x5e820f,_0x7d9af9){var _0xba629e={};var _0x5176ab={};var _0x37a0cb;var _0x2563d2;return db[_0x47ba('0x2f')][_0x47ba('0x50')]({'where':{'id':_0x4418ef[_0x47ba('0x4e')]['id']}})[_0x47ba('0x27')](handleEntityNotFound(_0x5e820f,null))[_0x47ba('0x27')](function(_0x169911){if(_0x169911){_0x37a0cb=_0x169911;_0x5176ab[_0x47ba('0x33')]=_[_0x47ba('0x35')](db[_0x47ba('0x51')][_0x47ba('0x30')]);_0x5176ab[_0x47ba('0x34')]=_[_0x47ba('0x35')](_0x4418ef[_0x47ba('0x34')]);_0x5176ab[_0x47ba('0x36')]=_[_0x47ba('0x37')](_0x5176ab[_0x47ba('0x33')],_0x5176ab[_0x47ba('0x34')]);_0xba629e['attributes']=_[_0x47ba('0x37')](_0x5176ab[_0x47ba('0x33')],qs[_0x47ba('0x39')](_0x4418ef['query'][_0x47ba('0x39')]));_0xba629e[_0x47ba('0x38')]=_0xba629e[_0x47ba('0x38')][_0x47ba('0x3a')]?_0xba629e['attributes']:_0x5176ab['model'];_0xba629e[_0x47ba('0x3c')]=qs[_0x47ba('0x3d')](_0x4418ef[_0x47ba('0x34')][_0x47ba('0x3d')]);_0xba629e[_0x47ba('0x3e')]=qs[_0x47ba('0x36')](_['pick'](_0x4418ef[_0x47ba('0x34')],_0x5176ab[_0x47ba('0x36')]));if(_0x4418ef[_0x47ba('0x34')][_0x47ba('0x40')]){_0xba629e[_0x47ba('0x3e')]=_[_0x47ba('0x41')](_0xba629e[_0x47ba('0x3e')],{'$or':_[_0x47ba('0x2e')](_0xba629e['attributes'],function(_0x77ed9){var _0x32acd7={};_0x32acd7[_0x77ed9]={'$like':'%'+_0x4418ef[_0x47ba('0x34')]['filter']+'%'};return _0x32acd7;})});}_0xba629e=_[_0x47ba('0x41')]({},_0xba629e,_0x4418ef[_0x47ba('0x44')]);return _0x37a0cb[_0x47ba('0x4f')](_0xba629e);}})[_0x47ba('0x27')](function(_0x21a883){if(_0x21a883){_0x2563d2=_0x21a883['length'];if(!_0x4418ef[_0x47ba('0x34')][_0x47ba('0x52')](_0x47ba('0x3b'))){_0xba629e['limit']=qs[_0x47ba('0x1f')](_0x4418ef[_0x47ba('0x34')][_0x47ba('0x1f')]);_0xba629e[_0x47ba('0x20')]=qs[_0x47ba('0x20')](_0x4418ef[_0x47ba('0x34')]['offset']);}return _0x37a0cb[_0x47ba('0x4f')](_0xba629e);}})[_0x47ba('0x27')](function(_0x1fea64){if(_0x1fea64){return _0x1fea64?{'count':_0x2563d2,'rows':_0x1fea64}:null;}})[_0x47ba('0x27')](respondWithResult(_0x5e820f,null))[_0x47ba('0x4a')](handleError(_0x5e820f,null));};exports[_0x47ba('0x53')]=function(_0x5a380f,_0x4fd965,_0x410342){var _0x5a97d4={};var _0x585954={};var _0x5a9e40;var _0x59afc8;return db[_0x47ba('0x2f')][_0x47ba('0x50')]({'where':{'id':_0x5a380f[_0x47ba('0x4e')]['id']}})[_0x47ba('0x27')](handleEntityNotFound(_0x4fd965,null))[_0x47ba('0x27')](function(_0x3a5aff){if(_0x3a5aff){_0x5a9e40=_0x3a5aff;_0x585954['model']=_[_0x47ba('0x35')](db[_0x47ba('0x51')][_0x47ba('0x30')]);_0x585954[_0x47ba('0x34')]=_[_0x47ba('0x35')](_0x5a380f['query']);_0x585954['filters']=_[_0x47ba('0x37')](_0x585954[_0x47ba('0x33')],_0x585954[_0x47ba('0x34')]);_0x5a97d4[_0x47ba('0x38')]=_['intersection'](_0x585954[_0x47ba('0x33')],qs[_0x47ba('0x39')](_0x5a380f[_0x47ba('0x34')][_0x47ba('0x39')]));_0x5a97d4[_0x47ba('0x38')]=_0x5a97d4['attributes']['length']?_0x5a97d4[_0x47ba('0x38')]:_0x585954['model'];_0x5a97d4['order']=qs[_0x47ba('0x3d')](_0x5a380f['query']['sort']);_0x5a97d4[_0x47ba('0x3e')]=qs[_0x47ba('0x36')](_['pick'](_0x5a380f[_0x47ba('0x34')],_0x585954[_0x47ba('0x36')]));if(_0x5a380f[_0x47ba('0x34')][_0x47ba('0x40')]){_0x5a97d4['where']=_[_0x47ba('0x41')](_0x5a97d4[_0x47ba('0x3e')],{'$or':_[_0x47ba('0x2e')](_0x5a97d4[_0x47ba('0x38')],function(_0x4574be){var _0x50e2fb={};_0x50e2fb[_0x4574be]={'$like':'%'+_0x5a380f[_0x47ba('0x34')][_0x47ba('0x40')]+'%'};return _0x50e2fb;})});}_0x5a97d4=_[_0x47ba('0x41')]({},_0x5a97d4,_0x5a380f[_0x47ba('0x44')]);return _0x5a9e40[_0x47ba('0x53')](_0x5a97d4);}})[_0x47ba('0x27')](function(_0x4c84c1){if(_0x4c84c1){_0x59afc8=_0x4c84c1[_0x47ba('0x3a')];if(!_0x5a380f['query'][_0x47ba('0x52')]('nolimit')){_0x5a97d4[_0x47ba('0x1f')]=qs[_0x47ba('0x1f')](_0x5a380f[_0x47ba('0x34')][_0x47ba('0x1f')]);_0x5a97d4[_0x47ba('0x20')]=qs[_0x47ba('0x20')](_0x5a380f['query']['offset']);}return _0x5a9e40[_0x47ba('0x53')](_0x5a97d4);}})[_0x47ba('0x27')](function(_0x2839fc){if(_0x2839fc){return _0x2839fc?{'count':_0x59afc8,'rows':_0x2839fc}:null;}})[_0x47ba('0x27')](respondWithResult(_0x4fd965,null))[_0x47ba('0x4a')](handleError(_0x4fd965,null));};exports[_0x47ba('0x54')]=function(_0x41d2db,_0x122bfc,_0x203569){var _0x59d2e6={};var _0x4325e7={};var _0x2738b4;var _0x243746;return db['ServicenowConfiguration'][_0x47ba('0x50')]({'where':{'id':_0x41d2db[_0x47ba('0x4e')]['id']}})['then'](handleEntityNotFound(_0x122bfc,null))['then'](function(_0x403fef){if(_0x403fef){_0x2738b4=_0x403fef;_0x4325e7['model']=_['keys'](db[_0x47ba('0x51')][_0x47ba('0x30')]);_0x4325e7[_0x47ba('0x34')]=_[_0x47ba('0x35')](_0x41d2db['query']);_0x4325e7[_0x47ba('0x36')]=_[_0x47ba('0x37')](_0x4325e7[_0x47ba('0x33')],_0x4325e7[_0x47ba('0x34')]);_0x59d2e6[_0x47ba('0x38')]=_[_0x47ba('0x37')](_0x4325e7[_0x47ba('0x33')],qs[_0x47ba('0x39')](_0x41d2db[_0x47ba('0x34')]['fields']));_0x59d2e6[_0x47ba('0x38')]=_0x59d2e6[_0x47ba('0x38')][_0x47ba('0x3a')]?_0x59d2e6[_0x47ba('0x38')]:_0x4325e7[_0x47ba('0x33')];_0x59d2e6['order']=qs['sort'](_0x41d2db['query'][_0x47ba('0x3d')]);_0x59d2e6['where']=qs['filters'](_['pick'](_0x41d2db['query'],_0x4325e7[_0x47ba('0x36')]));if(_0x41d2db[_0x47ba('0x34')][_0x47ba('0x40')]){_0x59d2e6[_0x47ba('0x3e')]=_[_0x47ba('0x41')](_0x59d2e6[_0x47ba('0x3e')],{'$or':_[_0x47ba('0x2e')](_0x59d2e6[_0x47ba('0x38')],function(_0x1912c9){var _0x55f4be={};_0x55f4be[_0x1912c9]={'$like':'%'+_0x41d2db[_0x47ba('0x34')][_0x47ba('0x40')]+'%'};return _0x55f4be;})});}_0x59d2e6=_['merge']({},_0x59d2e6,_0x41d2db['options']);return _0x2738b4[_0x47ba('0x54')](_0x59d2e6);}})[_0x47ba('0x27')](function(_0x2cdf34){if(_0x2cdf34){_0x243746=_0x2cdf34[_0x47ba('0x3a')];if(!_0x41d2db['query'][_0x47ba('0x52')](_0x47ba('0x3b'))){_0x59d2e6[_0x47ba('0x1f')]=qs['limit'](_0x41d2db[_0x47ba('0x34')][_0x47ba('0x1f')]);_0x59d2e6['offset']=qs['offset'](_0x41d2db[_0x47ba('0x34')]['offset']);}return _0x2738b4[_0x47ba('0x54')](_0x59d2e6);}})[_0x47ba('0x27')](function(_0x4f8e15){if(_0x4f8e15){return _0x4f8e15?{'count':_0x243746,'rows':_0x4f8e15}:null;}})[_0x47ba('0x27')](respondWithResult(_0x122bfc,null))['catch'](handleError(_0x122bfc,null));}; \ No newline at end of file +var _0x0941=['save','then','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','params','keys','length','find','create','body','update','getFields','findOne','ServicenowField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x0941,0xc9));var _0x1094=function(_0x49e000,_0x4ef064){_0x49e000=_0x49e000-0x0;var _0x14fac9=_0x0941[_0x49e000];return _0x14fac9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1094('0x0'));var zipdir=require(_0x1094('0x1'));var jsonpatch=require(_0x1094('0x2'));var rp=require('request-promise');var moment=require(_0x1094('0x3'));var BPromise=require(_0x1094('0x4'));var Mustache=require(_0x1094('0x5'));var util=require('util');var path=require(_0x1094('0x6'));var sox=require(_0x1094('0x7'));var csv=require(_0x1094('0x8'));var ejs=require(_0x1094('0x9'));var fs=require('fs');var fs_extra=require(_0x1094('0xa'));var _=require(_0x1094('0xb'));var squel=require(_0x1094('0xc'));var crypto=require(_0x1094('0xd'));var jsforce=require(_0x1094('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1094('0x8'));var querystring=require(_0x1094('0xf'));var Papa=require(_0x1094('0x10'));var Redis=require('ioredis');var authService=require(_0x1094('0x11'));var qs=require(_0x1094('0x12'));var as=require(_0x1094('0x13'));var hardwareService=require(_0x1094('0x14'));var logger=require(_0x1094('0x15'))('api');var utils=require(_0x1094('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1094('0x17'));var db=require(_0x1094('0x18'))['db'];function respondWithStatusCode(_0x55bcbd,_0x3be498){_0x3be498=_0x3be498||0xcc;return function(_0x22b792){if(_0x22b792){return _0x55bcbd[_0x1094('0x19')](_0x3be498);}return _0x55bcbd[_0x1094('0x1a')](_0x3be498)[_0x1094('0x1b')]();};}function respondWithResult(_0x32bfe4,_0x3fcec8){_0x3fcec8=_0x3fcec8||0xc8;return function(_0x15b8e9){if(_0x15b8e9){return _0x32bfe4[_0x1094('0x1a')](_0x3fcec8)[_0x1094('0x1c')](_0x15b8e9);}};}function respondWithFilteredResult(_0xe2d1ff,_0x4f2cb6){return function(_0x181a6b){if(_0x181a6b){var _0x53d0bf=typeof _0x4f2cb6['offset']===_0x1094('0x1d')&&typeof _0x4f2cb6['limit']===_0x1094('0x1d');var _0x94b53b=_0x181a6b[_0x1094('0x1e')];var _0x598ea8=_0x53d0bf?0x0:_0x4f2cb6[_0x1094('0x1f')];var _0x3bc769=_0x53d0bf?_0x181a6b['count']:_0x4f2cb6['offset']+_0x4f2cb6[_0x1094('0x20')];var _0x59ee71;if(_0x3bc769>=_0x94b53b){_0x3bc769=_0x94b53b;_0x59ee71=0xc8;}else{_0x59ee71=0xce;}_0xe2d1ff['status'](_0x59ee71);return _0xe2d1ff[_0x1094('0x21')](_0x1094('0x22'),_0x598ea8+'-'+_0x3bc769+'/'+_0x94b53b)[_0x1094('0x1c')](_0x181a6b);}return null;};}function patchUpdates(_0xaf1c94){return function(_0x40aaba){try{jsonpatch[_0x1094('0x23')](_0x40aaba,_0xaf1c94,!![]);}catch(_0x923cee){return BPromise['reject'](_0x923cee);}return _0x40aaba[_0x1094('0x24')]();};}function saveUpdates(_0x3d4329,_0xde9ef1){return function(_0x591a6e){if(_0x591a6e){return _0x591a6e['update'](_0x3d4329)['then'](function(_0x3e1aa7){return _0x3e1aa7;});}return null;};}function removeEntity(_0x367606,_0x2e52f9){return function(_0x269b01){if(_0x269b01){return _0x269b01['destroy']()[_0x1094('0x25')](function(){_0x367606[_0x1094('0x1a')](0xcc)[_0x1094('0x1b')]();});}};}function handleEntityNotFound(_0x32599a,_0x1b6a85){return function(_0x3987ae){if(!_0x3987ae){_0x32599a[_0x1094('0x19')](0x194);}return _0x3987ae;};}function handleError(_0xe68ff0,_0x2e23f4){_0x2e23f4=_0x2e23f4||0x1f4;return function(_0x559ee5){logger[_0x1094('0x26')](_0x559ee5[_0x1094('0x27')]);if(_0x559ee5[_0x1094('0x28')]){delete _0x559ee5['name'];}_0xe68ff0[_0x1094('0x1a')](_0x2e23f4)[_0x1094('0x29')](_0x559ee5);};}exports[_0x1094('0x2a')]=function(_0x16a129,_0x10e606){var _0x1e232f={},_0x54371c={},_0x2e6864={'count':0x0,'rows':[]};var _0x5c90d4=_[_0x1094('0x2b')](db[_0x1094('0x2c')][_0x1094('0x2d')],function(_0x36e432){return{'name':_0x36e432['fieldName'],'type':_0x36e432[_0x1094('0x2e')]['key']};});_0x54371c[_0x1094('0x2f')]=_['map'](_0x5c90d4,_0x1094('0x28'));_0x54371c['query']=_['keys'](_0x16a129[_0x1094('0x30')]);_0x54371c[_0x1094('0x31')]=_['intersection'](_0x54371c['model'],_0x54371c['query']);_0x1e232f[_0x1094('0x32')]=_[_0x1094('0x33')](_0x54371c[_0x1094('0x2f')],qs[_0x1094('0x34')](_0x16a129[_0x1094('0x30')][_0x1094('0x34')]));_0x1e232f['attributes']=_0x1e232f[_0x1094('0x32')]['length']?_0x1e232f['attributes']:_0x54371c[_0x1094('0x2f')];if(!_0x16a129[_0x1094('0x30')][_0x1094('0x35')](_0x1094('0x36'))){_0x1e232f[_0x1094('0x20')]=qs['limit'](_0x16a129[_0x1094('0x30')][_0x1094('0x20')]);_0x1e232f[_0x1094('0x1f')]=qs['offset'](_0x16a129[_0x1094('0x30')][_0x1094('0x1f')]);}_0x1e232f[_0x1094('0x37')]=qs[_0x1094('0x38')](_0x16a129[_0x1094('0x30')][_0x1094('0x38')]);_0x1e232f[_0x1094('0x39')]=qs[_0x1094('0x31')](_[_0x1094('0x3a')](_0x16a129[_0x1094('0x30')],_0x54371c[_0x1094('0x31')]),_0x5c90d4);if(_0x16a129[_0x1094('0x30')][_0x1094('0x3b')]){_0x1e232f[_0x1094('0x39')]=_['merge'](_0x1e232f[_0x1094('0x39')],{'$or':_[_0x1094('0x2b')](_0x5c90d4,function(_0x3cf2dd){if(_0x3cf2dd[_0x1094('0x2e')]!==_0x1094('0x3c')){var _0x285fe9={};_0x285fe9[_0x3cf2dd[_0x1094('0x28')]]={'$like':'%'+_0x16a129[_0x1094('0x30')][_0x1094('0x3b')]+'%'};return _0x285fe9;}})});}_0x1e232f=_[_0x1094('0x3d')]({},_0x1e232f,_0x16a129[_0x1094('0x3e')]);var _0xe25a9f={'where':_0x1e232f[_0x1094('0x39')]};return db[_0x1094('0x2c')][_0x1094('0x1e')](_0xe25a9f)[_0x1094('0x25')](function(_0x1d57de){_0x2e6864[_0x1094('0x1e')]=_0x1d57de;if(_0x16a129[_0x1094('0x30')][_0x1094('0x3f')]){_0x1e232f[_0x1094('0x40')]=[{'all':!![]}];}return db[_0x1094('0x2c')]['findAll'](_0x1e232f);})['then'](function(_0x527ce5){_0x2e6864[_0x1094('0x41')]=_0x527ce5;return _0x2e6864;})[_0x1094('0x25')](respondWithFilteredResult(_0x10e606,_0x1e232f))[_0x1094('0x42')](handleError(_0x10e606,null));};exports['show']=function(_0x129f87,_0x6b33a7){var _0x30d651={'raw':![],'where':{'id':_0x129f87[_0x1094('0x43')]['id']}},_0x90b984={};_0x90b984[_0x1094('0x2f')]=_[_0x1094('0x44')](db[_0x1094('0x2c')][_0x1094('0x2d')]);_0x90b984[_0x1094('0x30')]=_[_0x1094('0x44')](_0x129f87[_0x1094('0x30')]);_0x90b984['filters']=_[_0x1094('0x33')](_0x90b984[_0x1094('0x2f')],_0x90b984[_0x1094('0x30')]);_0x30d651[_0x1094('0x32')]=_[_0x1094('0x33')](_0x90b984[_0x1094('0x2f')],qs[_0x1094('0x34')](_0x129f87['query'][_0x1094('0x34')]));_0x30d651[_0x1094('0x32')]=_0x30d651[_0x1094('0x32')][_0x1094('0x45')]?_0x30d651[_0x1094('0x32')]:_0x90b984[_0x1094('0x2f')];if(_0x129f87[_0x1094('0x30')][_0x1094('0x3f')]){_0x30d651['include']=[{'all':!![]}];}_0x30d651=_[_0x1094('0x3d')]({},_0x30d651,_0x129f87[_0x1094('0x3e')]);return db['ServicenowConfiguration'][_0x1094('0x46')](_0x30d651)['then'](handleEntityNotFound(_0x6b33a7,null))[_0x1094('0x25')](respondWithResult(_0x6b33a7,null))[_0x1094('0x42')](handleError(_0x6b33a7,null));};exports[_0x1094('0x47')]=function(_0x2fe4a7,_0x2041c9){return db[_0x1094('0x2c')][_0x1094('0x47')](_0x2fe4a7[_0x1094('0x48')],{})['then'](respondWithResult(_0x2041c9,0xc9))[_0x1094('0x42')](handleError(_0x2041c9,null));};exports[_0x1094('0x49')]=function(_0xdcfccc,_0x44c96c){if(_0xdcfccc[_0x1094('0x48')]['id']){delete _0xdcfccc[_0x1094('0x48')]['id'];}return db[_0x1094('0x2c')]['find']({'where':{'id':_0xdcfccc[_0x1094('0x43')]['id']}})['then'](handleEntityNotFound(_0x44c96c,null))[_0x1094('0x25')](saveUpdates(_0xdcfccc[_0x1094('0x48')],null))[_0x1094('0x25')](respondWithResult(_0x44c96c,null))[_0x1094('0x42')](handleError(_0x44c96c,null));};exports['destroy']=function(_0x54efff,_0x45e2a5){return db[_0x1094('0x2c')][_0x1094('0x46')]({'where':{'id':_0x54efff[_0x1094('0x43')]['id']}})[_0x1094('0x25')](handleEntityNotFound(_0x45e2a5,null))[_0x1094('0x25')](removeEntity(_0x45e2a5,null))[_0x1094('0x42')](handleError(_0x45e2a5,null));};exports[_0x1094('0x4a')]=function(_0x3af88a,_0x4d9a5f,_0x4c8cea){var _0x18e463={};var _0x49b9c9={};var _0x2b5483;var _0x42f9f8;return db[_0x1094('0x2c')][_0x1094('0x4b')]({'where':{'id':_0x3af88a['params']['id']}})[_0x1094('0x25')](handleEntityNotFound(_0x4d9a5f,null))[_0x1094('0x25')](function(_0xd49567){if(_0xd49567){_0x2b5483=_0xd49567;_0x49b9c9[_0x1094('0x2f')]=_[_0x1094('0x44')](db[_0x1094('0x4c')]['rawAttributes']);_0x49b9c9[_0x1094('0x30')]=_[_0x1094('0x44')](_0x3af88a[_0x1094('0x30')]);_0x49b9c9['filters']=_[_0x1094('0x33')](_0x49b9c9[_0x1094('0x2f')],_0x49b9c9['query']);_0x18e463['attributes']=_[_0x1094('0x33')](_0x49b9c9[_0x1094('0x2f')],qs[_0x1094('0x34')](_0x3af88a[_0x1094('0x30')][_0x1094('0x34')]));_0x18e463[_0x1094('0x32')]=_0x18e463[_0x1094('0x32')]['length']?_0x18e463[_0x1094('0x32')]:_0x49b9c9['model'];_0x18e463[_0x1094('0x37')]=qs['sort'](_0x3af88a[_0x1094('0x30')][_0x1094('0x38')]);_0x18e463['where']=qs[_0x1094('0x31')](_['pick'](_0x3af88a['query'],_0x49b9c9['filters']));if(_0x3af88a[_0x1094('0x30')]['filter']){_0x18e463[_0x1094('0x39')]=_[_0x1094('0x3d')](_0x18e463[_0x1094('0x39')],{'$or':_[_0x1094('0x2b')](_0x18e463['attributes'],function(_0x1de85d){var _0x33f183={};_0x33f183[_0x1de85d]={'$like':'%'+_0x3af88a[_0x1094('0x30')][_0x1094('0x3b')]+'%'};return _0x33f183;})});}_0x18e463=_[_0x1094('0x3d')]({},_0x18e463,_0x3af88a[_0x1094('0x3e')]);return _0x2b5483[_0x1094('0x4a')](_0x18e463);}})[_0x1094('0x25')](function(_0x5e8b72){if(_0x5e8b72){_0x42f9f8=_0x5e8b72['length'];if(!_0x3af88a['query'][_0x1094('0x35')](_0x1094('0x36'))){_0x18e463['limit']=qs[_0x1094('0x20')](_0x3af88a[_0x1094('0x30')]['limit']);_0x18e463[_0x1094('0x1f')]=qs[_0x1094('0x1f')](_0x3af88a[_0x1094('0x30')][_0x1094('0x1f')]);}return _0x2b5483[_0x1094('0x4a')](_0x18e463);}})[_0x1094('0x25')](function(_0x5512d6){if(_0x5512d6){return _0x5512d6?{'count':_0x42f9f8,'rows':_0x5512d6}:null;}})['then'](respondWithResult(_0x4d9a5f,null))['catch'](handleError(_0x4d9a5f,null));};exports[_0x1094('0x4d')]=function(_0x3b94e6,_0x397c93,_0x1c11b5){var _0x9fd5ee={};var _0x11f69d={};var _0x19975a;var _0x35df59;return db[_0x1094('0x2c')][_0x1094('0x4b')]({'where':{'id':_0x3b94e6['params']['id']}})[_0x1094('0x25')](handleEntityNotFound(_0x397c93,null))[_0x1094('0x25')](function(_0x516002){if(_0x516002){_0x19975a=_0x516002;_0x11f69d[_0x1094('0x2f')]=_[_0x1094('0x44')](db[_0x1094('0x4c')][_0x1094('0x2d')]);_0x11f69d[_0x1094('0x30')]=_['keys'](_0x3b94e6['query']);_0x11f69d['filters']=_[_0x1094('0x33')](_0x11f69d[_0x1094('0x2f')],_0x11f69d['query']);_0x9fd5ee['attributes']=_[_0x1094('0x33')](_0x11f69d[_0x1094('0x2f')],qs[_0x1094('0x34')](_0x3b94e6[_0x1094('0x30')][_0x1094('0x34')]));_0x9fd5ee[_0x1094('0x32')]=_0x9fd5ee[_0x1094('0x32')]['length']?_0x9fd5ee['attributes']:_0x11f69d[_0x1094('0x2f')];_0x9fd5ee[_0x1094('0x37')]=qs[_0x1094('0x38')](_0x3b94e6['query'][_0x1094('0x38')]);_0x9fd5ee[_0x1094('0x39')]=qs[_0x1094('0x31')](_[_0x1094('0x3a')](_0x3b94e6[_0x1094('0x30')],_0x11f69d[_0x1094('0x31')]));if(_0x3b94e6['query']['filter']){_0x9fd5ee[_0x1094('0x39')]=_[_0x1094('0x3d')](_0x9fd5ee[_0x1094('0x39')],{'$or':_[_0x1094('0x2b')](_0x9fd5ee[_0x1094('0x32')],function(_0x490f5a){var _0x1404c4={};_0x1404c4[_0x490f5a]={'$like':'%'+_0x3b94e6[_0x1094('0x30')][_0x1094('0x3b')]+'%'};return _0x1404c4;})});}_0x9fd5ee=_[_0x1094('0x3d')]({},_0x9fd5ee,_0x3b94e6[_0x1094('0x3e')]);return _0x19975a['getSubjects'](_0x9fd5ee);}})[_0x1094('0x25')](function(_0x222d6b){if(_0x222d6b){_0x35df59=_0x222d6b['length'];if(!_0x3b94e6[_0x1094('0x30')][_0x1094('0x35')]('nolimit')){_0x9fd5ee[_0x1094('0x20')]=qs[_0x1094('0x20')](_0x3b94e6['query'][_0x1094('0x20')]);_0x9fd5ee[_0x1094('0x1f')]=qs[_0x1094('0x1f')](_0x3b94e6[_0x1094('0x30')]['offset']);}return _0x19975a[_0x1094('0x4d')](_0x9fd5ee);}})[_0x1094('0x25')](function(_0x299ac6){if(_0x299ac6){return _0x299ac6?{'count':_0x35df59,'rows':_0x299ac6}:null;}})['then'](respondWithResult(_0x397c93,null))['catch'](handleError(_0x397c93,null));};exports[_0x1094('0x4e')]=function(_0x32dad2,_0x449046,_0x4ccdf5){var _0x497c44={};var _0x278fd0={};var _0x390022;var _0x1df814;return db['ServicenowConfiguration'][_0x1094('0x4b')]({'where':{'id':_0x32dad2[_0x1094('0x43')]['id']}})[_0x1094('0x25')](handleEntityNotFound(_0x449046,null))[_0x1094('0x25')](function(_0x5d778e){if(_0x5d778e){_0x390022=_0x5d778e;_0x278fd0[_0x1094('0x2f')]=_['keys'](db[_0x1094('0x4c')]['rawAttributes']);_0x278fd0[_0x1094('0x30')]=_[_0x1094('0x44')](_0x32dad2['query']);_0x278fd0[_0x1094('0x31')]=_['intersection'](_0x278fd0[_0x1094('0x2f')],_0x278fd0[_0x1094('0x30')]);_0x497c44[_0x1094('0x32')]=_[_0x1094('0x33')](_0x278fd0[_0x1094('0x2f')],qs[_0x1094('0x34')](_0x32dad2[_0x1094('0x30')]['fields']));_0x497c44[_0x1094('0x32')]=_0x497c44[_0x1094('0x32')]['length']?_0x497c44[_0x1094('0x32')]:_0x278fd0[_0x1094('0x2f')];_0x497c44[_0x1094('0x37')]=qs[_0x1094('0x38')](_0x32dad2[_0x1094('0x30')]['sort']);_0x497c44[_0x1094('0x39')]=qs[_0x1094('0x31')](_[_0x1094('0x3a')](_0x32dad2[_0x1094('0x30')],_0x278fd0['filters']));if(_0x32dad2[_0x1094('0x30')][_0x1094('0x3b')]){_0x497c44['where']=_[_0x1094('0x3d')](_0x497c44[_0x1094('0x39')],{'$or':_[_0x1094('0x2b')](_0x497c44[_0x1094('0x32')],function(_0x94069f){var _0x3450f8={};_0x3450f8[_0x94069f]={'$like':'%'+_0x32dad2[_0x1094('0x30')]['filter']+'%'};return _0x3450f8;})});}_0x497c44=_['merge']({},_0x497c44,_0x32dad2[_0x1094('0x3e')]);return _0x390022[_0x1094('0x4e')](_0x497c44);}})[_0x1094('0x25')](function(_0x5ac9d6){if(_0x5ac9d6){_0x1df814=_0x5ac9d6['length'];if(!_0x32dad2[_0x1094('0x30')]['hasOwnProperty'](_0x1094('0x36'))){_0x497c44[_0x1094('0x20')]=qs[_0x1094('0x20')](_0x32dad2[_0x1094('0x30')][_0x1094('0x20')]);_0x497c44[_0x1094('0x1f')]=qs[_0x1094('0x1f')](_0x32dad2[_0x1094('0x30')]['offset']);}return _0x390022['getDescriptions'](_0x497c44);}})[_0x1094('0x25')](function(_0x128923){if(_0x128923){return _0x128923?{'count':_0x1df814,'rows':_0x128923}:null;}})[_0x1094('0x25')](respondWithResult(_0x449046,null))[_0x1094('0x42')](handleError(_0x449046,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 24999fc..7030506 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 _0xf65d=['../../config/logger','api','moment','bluebird','request-promise','path','exports','define','int_servicenow_configurations','lodash'];(function(_0x54e358,_0x283f4c){var _0x27211f=function(_0x40f439){while(--_0x40f439){_0x54e358['push'](_0x54e358['shift']());}};_0x27211f(++_0x283f4c);}(_0xf65d,0x9f));var _0xdf65=function(_0x47e3f8,_0x517bcd){_0x47e3f8=_0x47e3f8-0x0;var _0x4742d5=_0xf65d[_0x47e3f8];return _0x4742d5;};'use strict';var _=require(_0xdf65('0x0'));var util=require('util');var logger=require(_0xdf65('0x1'))(_0xdf65('0x2'));var moment=require(_0xdf65('0x3'));var BPromise=require(_0xdf65('0x4'));var rp=require(_0xdf65('0x5'));var fs=require('fs');var path=require(_0xdf65('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0xdf65('0x7')]=function(_0x4ac44a,_0x254ddf){return _0x4ac44a[_0xdf65('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0xdf65('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa1b=['exports','define','int_servicenow_configurations','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x4cc7c4,_0x86b3ab){var _0x5e982d=function(_0x4110a2){while(--_0x4110a2){_0x4cc7c4['push'](_0x4cc7c4['shift']());}};_0x5e982d(++_0x86b3ab);}(_0xaa1b,0x123));var _0xbaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xbaa1('0x0'));var util=require(_0xbaa1('0x1'));var logger=require(_0xbaa1('0x2'))('api');var moment=require(_0xbaa1('0x3'));var BPromise=require('bluebird');var rp=require(_0xbaa1('0x4'));var fs=require('fs');var path=require(_0xbaa1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0xbaa1('0x6')]=function(_0x27b99c,_0x4a5735){return _0x27b99c[_0xbaa1('0x7')]('ServicenowConfiguration',attributes,{'tableName':_0xbaa1('0x8'),'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 a520306..60d1698 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 _0x7ea9=['../../config/logger','rpc','jayson/promise','client','http','request','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x47a5bd,_0x508329){var _0x5c2184=function(_0x40ddea){while(--_0x40ddea){_0x47a5bd['push'](_0x47a5bd['shift']());}};_0x5c2184(++_0x508329);}(_0x7ea9,0xec));var _0x97ea=function(_0x59f54c,_0x456855){_0x59f54c=_0x59f54c-0x0;var _0x34802f=_0x7ea9[_0x59f54c];return _0x34802f;};'use strict';var _=require('lodash');var util=require(_0x97ea('0x0'));var moment=require(_0x97ea('0x1'));var BPromise=require(_0x97ea('0x2'));var rs=require(_0x97ea('0x3'));var fs=require('fs');var Redis=require(_0x97ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x97ea('0x5'));var logger=require(_0x97ea('0x6'))(_0x97ea('0x7'));var config=require('../../config/environment');var jayson=require(_0x97ea('0x8'));var client=jayson[_0x97ea('0x9')][_0x97ea('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17209a,_0x517067,_0x41fb15){return new BPromise(function(_0x424a73,_0x4af95f){return client[_0x97ea('0xb')](_0x17209a,_0x41fb15)['then'](function(_0x179953){logger['info'](_0x97ea('0xc'),_0x517067,_0x97ea('0xd'));logger['debug'](_0x97ea('0xe'),_0x517067,_0x97ea('0xd'),JSON[_0x97ea('0xf')](_0x179953));if(_0x179953[_0x97ea('0x10')]){if(_0x179953[_0x97ea('0x10')][_0x97ea('0x11')]===0x1f4){logger[_0x97ea('0x10')](_0x97ea('0xc'),_0x517067,_0x179953[_0x97ea('0x10')][_0x97ea('0x12')]);return _0x4af95f(_0x179953['error'][_0x97ea('0x12')]);}logger[_0x97ea('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x517067,_0x179953[_0x97ea('0x10')][_0x97ea('0x12')]);return _0x424a73(_0x179953[_0x97ea('0x10')]['message']);}else{logger[_0x97ea('0x13')](_0x97ea('0xc'),_0x517067,'request\x20sent');_0x424a73(_0x179953[_0x97ea('0x14')]['message']);}})[_0x97ea('0x15')](function(_0x135018){logger[_0x97ea('0x10')](_0x97ea('0xc'),_0x517067,_0x135018);_0x4af95f(_0x135018);});});} \ No newline at end of file +var _0x80d3=['error','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','moment','bluebird','../../config/utils','client','request','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x1bbc3f,_0x1b2647){var _0x4deeb1=function(_0x38fb62){while(--_0x38fb62){_0x1bbc3f['push'](_0x1bbc3f['shift']());}};_0x4deeb1(++_0x1b2647);}(_0x80d3,0x122));var _0x380d=function(_0x5853d6,_0x4b418a){_0x5853d6=_0x5853d6-0x0;var _0x4902ae=_0x80d3[_0x5853d6];return _0x4902ae;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x380d('0x0'));var BPromise=require(_0x380d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x380d('0x2'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x380d('0x3')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4be160,_0x155f17,_0x185233){return new BPromise(function(_0x49a8e0,_0x13f08a){return client[_0x380d('0x4')](_0x4be160,_0x185233)[_0x380d('0x5')](function(_0x28f797){logger[_0x380d('0x6')]('ServicenowConfiguration,\x20%s,\x20%s',_0x155f17,_0x380d('0x7'));logger[_0x380d('0x8')](_0x380d('0x9'),_0x155f17,_0x380d('0x7'),JSON['stringify'](_0x28f797));if(_0x28f797[_0x380d('0xa')]){if(_0x28f797['error']['code']===0x1f4){logger[_0x380d('0xa')](_0x380d('0xb'),_0x155f17,_0x28f797['error'][_0x380d('0xc')]);return _0x13f08a(_0x28f797[_0x380d('0xa')][_0x380d('0xc')]);}logger['error'](_0x380d('0xb'),_0x155f17,_0x28f797['error']['message']);return _0x49a8e0(_0x28f797[_0x380d('0xa')]['message']);}else{logger[_0x380d('0x6')](_0x380d('0xb'),_0x155f17,_0x380d('0x7'));_0x49a8e0(_0x28f797[_0x380d('0xd')]['message']);}})[_0x380d('0xe')](function(_0x3e9af2){logger[_0x380d('0xa')](_0x380d('0xb'),_0x155f17,_0x3e9af2);_0x13f08a(_0x3e9af2);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index e911725..529823a 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 _0x012b=['/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index'];(function(_0x26df48,_0x22aa50){var _0x209047=function(_0x1d068b){while(--_0x1d068b){_0x26df48['push'](_0x26df48['shift']());}};_0x209047(++_0x22aa50);}(_0x012b,0x6d));var _0xb012=function(_0x2a6d53,_0x4aacb3){_0x2a6d53=_0x2a6d53-0x0;var _0x5654ff=_0x012b[_0x2a6d53];return _0x5654ff;};'use strict';var multer=require('multer');var util=require(_0xb012('0x0'));var path=require(_0xb012('0x1'));var timeout=require(_0xb012('0x2'));var express=require(_0xb012('0x3'));var router=express[_0xb012('0x4')]();var fs_extra=require(_0xb012('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb012('0x6'));var controller=require(_0xb012('0x7'));router[_0xb012('0x8')]('/',auth[_0xb012('0x9')](),controller[_0xb012('0xa')]);router[_0xb012('0x8')](_0xb012('0xb'),auth['isAuthenticated'](),controller[_0xb012('0xc')]);router[_0xb012('0xd')]('/',auth[_0xb012('0x9')](),controller[_0xb012('0xe')]);router[_0xb012('0xf')](_0xb012('0xb'),auth[_0xb012('0x9')](),controller[_0xb012('0x10')]);router[_0xb012('0x11')](_0xb012('0xb'),auth['isAuthenticated'](),controller[_0xb012('0x12')]);module[_0xb012('0x13')]=router; \ No newline at end of file +var _0x4341=['create','put','/:id','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','get','show'];(function(_0x6b470b,_0x1452a2){var _0x416f4c=function(_0x344d53){while(--_0x344d53){_0x6b470b['push'](_0x6b470b['shift']());}};_0x416f4c(++_0x1452a2);}(_0x4341,0x1c8));var _0x1434=function(_0x5aea3e,_0x20d237){_0x5aea3e=_0x5aea3e-0x0;var _0x558b7b=_0x4341[_0x5aea3e];return _0x558b7b;};'use strict';var multer=require('multer');var util=require(_0x1434('0x0'));var path=require(_0x1434('0x1'));var timeout=require(_0x1434('0x2'));var express=require('express');var router=express[_0x1434('0x3')]();var fs_extra=require(_0x1434('0x4'));var auth=require(_0x1434('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1434('0x6'));var controller=require(_0x1434('0x7'));router['get']('/',auth[_0x1434('0x8')](),controller[_0x1434('0x9')]);router[_0x1434('0xa')]('/:id',auth[_0x1434('0x8')](),controller[_0x1434('0xb')]);router['post']('/',auth[_0x1434('0x8')](),controller[_0x1434('0xc')]);router[_0x1434('0xd')](_0x1434('0xe'),auth[_0x1434('0x8')](),controller[_0x1434('0xf')]);router['delete'](_0x1434('0xe'),auth[_0x1434('0x8')](),controller[_0x1434('0x10')]);module[_0x1434('0x11')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index fce5561..d601757 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 _0xa283=['keyValue','picklist','STRING','customVariable','sequelize','exports','ENUM','string','variable'];(function(_0x3ae4bf,_0x554978){var _0x27f7dd=function(_0x406997){while(--_0x406997){_0x3ae4bf['push'](_0x3ae4bf['shift']());}};_0x27f7dd(++_0x554978);}(_0xa283,0x1ab));var _0x3a28=function(_0x5d3ac6,_0x89ce9a){_0x5d3ac6=_0x5d3ac6-0x0;var _0x23eedb=_0xa283[_0x5d3ac6];return _0x23eedb;};'use strict';var Sequelize=require(_0x3a28('0x0'));module[_0x3a28('0x1')]={'type':{'type':Sequelize[_0x3a28('0x2')](_0x3a28('0x3'),_0x3a28('0x4'),'customVariable',_0x3a28('0x5'),_0x3a28('0x6')),'defaultValue':_0x3a28('0x3')},'content':{'type':Sequelize[_0x3a28('0x7')]},'key':{'type':Sequelize[_0x3a28('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x3a28('0x3'),'variable',_0x3a28('0x8'))},'keyContent':{'type':Sequelize[_0x3a28('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3a28('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5e6c=['BOOLEAN','sequelize','exports','ENUM','variable','picklist','string','STRING'];(function(_0x1df9f4,_0x27c693){var _0x29f9c5=function(_0x264487){while(--_0x264487){_0x1df9f4['push'](_0x1df9f4['shift']());}};_0x29f9c5(++_0x27c693);}(_0x5e6c,0x1e1));var _0xc5e6=function(_0xef7024,_0x4e33fe){_0xef7024=_0xef7024-0x0;var _0xc24d2d=_0x5e6c[_0xef7024];return _0xc24d2d;};'use strict';var Sequelize=require(_0xc5e6('0x0'));module[_0xc5e6('0x1')]={'type':{'type':Sequelize[_0xc5e6('0x2')]('string',_0xc5e6('0x3'),'customVariable','keyValue',_0xc5e6('0x4')),'defaultValue':_0xc5e6('0x5')},'content':{'type':Sequelize[_0xc5e6('0x6')]},'key':{'type':Sequelize[_0xc5e6('0x6')]},'keyType':{'type':Sequelize[_0xc5e6('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xc5e6('0x6')]},'idField':{'type':Sequelize[_0xc5e6('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc5e6('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc5e6('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index eb858c1..48b826b 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 _0x1559=['error','stack','name','send','ServicenowField','rawAttributes','fieldName','type','key','map','keys','intersection','query','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then'];(function(_0x20beae,_0x5eac6d){var _0xf5725=function(_0x926a3b){while(--_0x926a3b){_0x20beae['push'](_0x20beae['shift']());}};_0xf5725(++_0x5eac6d);}(_0x1559,0x188));var _0x9155=function(_0x2d01df,_0x429d33){_0x2d01df=_0x2d01df-0x0;var _0x56e944=_0x1559[_0x2d01df];return _0x56e944;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9155('0x0'));var zipdir=require(_0x9155('0x1'));var jsonpatch=require(_0x9155('0x2'));var rp=require(_0x9155('0x3'));var moment=require(_0x9155('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9155('0x5'));var util=require(_0x9155('0x6'));var path=require(_0x9155('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9155('0x8'));var _=require(_0x9155('0x9'));var squel=require('squel');var crypto=require(_0x9155('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9155('0xb'));var toCsv=require(_0x9155('0xc'));var querystring=require('querystring');var Papa=require(_0x9155('0xd'));var Redis=require(_0x9155('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9155('0xf'));var as=require(_0x9155('0x10'));var hardwareService=require(_0x9155('0x11'));var logger=require(_0x9155('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x9155('0x13'));var licenseUtil=require(_0x9155('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36f49c,_0x7192db){_0x7192db=_0x7192db||0xcc;return function(_0x24965b){if(_0x24965b){return _0x36f49c[_0x9155('0x15')](_0x7192db);}return _0x36f49c[_0x9155('0x16')](_0x7192db)[_0x9155('0x17')]();};}function respondWithResult(_0x4d3911,_0x50db7c){_0x50db7c=_0x50db7c||0xc8;return function(_0x158a95){if(_0x158a95){return _0x4d3911[_0x9155('0x16')](_0x50db7c)['json'](_0x158a95);}};}function respondWithFilteredResult(_0x52f690,_0x270795){return function(_0x49b5f5){if(_0x49b5f5){var _0x135be8=typeof _0x270795[_0x9155('0x18')]===_0x9155('0x19')&&typeof _0x270795[_0x9155('0x1a')]===_0x9155('0x19');var _0x550b95=_0x49b5f5[_0x9155('0x1b')];var _0x8555db=_0x135be8?0x0:_0x270795[_0x9155('0x18')];var _0xe42b72=_0x135be8?_0x49b5f5[_0x9155('0x1b')]:_0x270795['offset']+_0x270795['limit'];var _0x339050;if(_0xe42b72>=_0x550b95){_0xe42b72=_0x550b95;_0x339050=0xc8;}else{_0x339050=0xce;}_0x52f690[_0x9155('0x16')](_0x339050);return _0x52f690[_0x9155('0x1c')](_0x9155('0x1d'),_0x8555db+'-'+_0xe42b72+'/'+_0x550b95)['json'](_0x49b5f5);}return null;};}function patchUpdates(_0xa6656a){return function(_0xa3b193){try{jsonpatch[_0x9155('0x1e')](_0xa3b193,_0xa6656a,!![]);}catch(_0x427ad8){return BPromise['reject'](_0x427ad8);}return _0xa3b193[_0x9155('0x1f')]();};}function saveUpdates(_0x2f1ec8,_0x1c38a5){return function(_0x33196b){if(_0x33196b){return _0x33196b[_0x9155('0x20')](_0x2f1ec8)[_0x9155('0x21')](function(_0x1a463a){return _0x1a463a;});}return null;};}function removeEntity(_0x42b697,_0xd82ec1){return function(_0xe1e8ae){if(_0xe1e8ae){return _0xe1e8ae['destroy']()[_0x9155('0x21')](function(){_0x42b697['status'](0xcc)[_0x9155('0x17')]();});}};}function handleEntityNotFound(_0x1ddc2b,_0x5623d0){return function(_0x236b02){if(!_0x236b02){_0x1ddc2b[_0x9155('0x15')](0x194);}return _0x236b02;};}function handleError(_0x341fa2,_0x528317){_0x528317=_0x528317||0x1f4;return function(_0x52fcbc){logger[_0x9155('0x22')](_0x52fcbc[_0x9155('0x23')]);if(_0x52fcbc[_0x9155('0x24')]){delete _0x52fcbc[_0x9155('0x24')];}_0x341fa2[_0x9155('0x16')](_0x528317)[_0x9155('0x25')](_0x52fcbc);};}exports['index']=function(_0x5dde55,_0x1a5952){var _0x43dfb6={},_0x227f6c={},_0x58cad0={'count':0x0,'rows':[]};var _0x33fa18=_['map'](db[_0x9155('0x26')][_0x9155('0x27')],function(_0x39f651){return{'name':_0x39f651[_0x9155('0x28')],'type':_0x39f651[_0x9155('0x29')][_0x9155('0x2a')]};});_0x227f6c['model']=_[_0x9155('0x2b')](_0x33fa18,_0x9155('0x24'));_0x227f6c['query']=_[_0x9155('0x2c')](_0x5dde55['query']);_0x227f6c['filters']=_[_0x9155('0x2d')](_0x227f6c['model'],_0x227f6c[_0x9155('0x2e')]);_0x43dfb6['attributes']=_[_0x9155('0x2d')](_0x227f6c[_0x9155('0x2f')],qs[_0x9155('0x30')](_0x5dde55[_0x9155('0x2e')][_0x9155('0x30')]));_0x43dfb6[_0x9155('0x31')]=_0x43dfb6['attributes'][_0x9155('0x32')]?_0x43dfb6['attributes']:_0x227f6c[_0x9155('0x2f')];if(!_0x5dde55['query'][_0x9155('0x33')]('nolimit')){_0x43dfb6[_0x9155('0x1a')]=qs[_0x9155('0x1a')](_0x5dde55[_0x9155('0x2e')][_0x9155('0x1a')]);_0x43dfb6['offset']=qs[_0x9155('0x18')](_0x5dde55[_0x9155('0x2e')][_0x9155('0x18')]);}_0x43dfb6[_0x9155('0x34')]=qs[_0x9155('0x35')](_0x5dde55['query'][_0x9155('0x35')]);_0x43dfb6[_0x9155('0x36')]=qs[_0x9155('0x37')](_[_0x9155('0x38')](_0x5dde55[_0x9155('0x2e')],_0x227f6c[_0x9155('0x37')]),_0x33fa18);if(_0x5dde55[_0x9155('0x2e')]['filter']){_0x43dfb6[_0x9155('0x36')]=_[_0x9155('0x39')](_0x43dfb6[_0x9155('0x36')],{'$or':_[_0x9155('0x2b')](_0x33fa18,function(_0xb8f0bd){if(_0xb8f0bd[_0x9155('0x29')]!=='VIRTUAL'){var _0x56afe1={};_0x56afe1[_0xb8f0bd[_0x9155('0x24')]]={'$like':'%'+_0x5dde55[_0x9155('0x2e')][_0x9155('0x3a')]+'%'};return _0x56afe1;}})});}_0x43dfb6=_['merge']({},_0x43dfb6,_0x5dde55[_0x9155('0x3b')]);var _0x5857cc={'where':_0x43dfb6[_0x9155('0x36')]};return db['ServicenowField']['count'](_0x5857cc)[_0x9155('0x21')](function(_0x4c5883){_0x58cad0[_0x9155('0x1b')]=_0x4c5883;if(_0x5dde55[_0x9155('0x2e')][_0x9155('0x3c')]){_0x43dfb6[_0x9155('0x3d')]=[{'all':!![]}];}return db['ServicenowField'][_0x9155('0x3e')](_0x43dfb6);})[_0x9155('0x21')](function(_0x184846){_0x58cad0[_0x9155('0x3f')]=_0x184846;return _0x58cad0;})[_0x9155('0x21')](respondWithFilteredResult(_0x1a5952,_0x43dfb6))[_0x9155('0x40')](handleError(_0x1a5952,null));};exports[_0x9155('0x41')]=function(_0x36fadf,_0x2534dd){var _0x282de4={'raw':!![],'where':{'id':_0x36fadf['params']['id']}},_0x15c678={};_0x15c678[_0x9155('0x2f')]=_[_0x9155('0x2c')](db[_0x9155('0x26')][_0x9155('0x27')]);_0x15c678[_0x9155('0x2e')]=_[_0x9155('0x2c')](_0x36fadf[_0x9155('0x2e')]);_0x15c678[_0x9155('0x37')]=_[_0x9155('0x2d')](_0x15c678['model'],_0x15c678['query']);_0x282de4[_0x9155('0x31')]=_[_0x9155('0x2d')](_0x15c678['model'],qs['fields'](_0x36fadf[_0x9155('0x2e')][_0x9155('0x30')]));_0x282de4[_0x9155('0x31')]=_0x282de4['attributes'][_0x9155('0x32')]?_0x282de4[_0x9155('0x31')]:_0x15c678[_0x9155('0x2f')];if(_0x36fadf[_0x9155('0x2e')][_0x9155('0x3c')]){_0x282de4['include']=[{'all':!![]}];}_0x282de4=_[_0x9155('0x39')]({},_0x282de4,_0x36fadf[_0x9155('0x3b')]);return db['ServicenowField'][_0x9155('0x42')](_0x282de4)[_0x9155('0x21')](handleEntityNotFound(_0x2534dd,null))[_0x9155('0x21')](respondWithResult(_0x2534dd,null))[_0x9155('0x40')](handleError(_0x2534dd,null));};exports[_0x9155('0x43')]=function(_0x58d88b,_0x229e9f){return db[_0x9155('0x26')][_0x9155('0x43')](_0x58d88b[_0x9155('0x44')],{})[_0x9155('0x21')](respondWithResult(_0x229e9f,0xc9))[_0x9155('0x40')](handleError(_0x229e9f,null));};exports['update']=function(_0x17d7c5,_0x363cbe){if(_0x17d7c5['body']['id']){delete _0x17d7c5['body']['id'];}return db[_0x9155('0x26')][_0x9155('0x42')]({'where':{'id':_0x17d7c5[_0x9155('0x45')]['id']}})[_0x9155('0x21')](handleEntityNotFound(_0x363cbe,null))[_0x9155('0x21')](saveUpdates(_0x17d7c5['body'],null))[_0x9155('0x21')](respondWithResult(_0x363cbe,null))[_0x9155('0x40')](handleError(_0x363cbe,null));};exports[_0x9155('0x46')]=function(_0x2dc2bb,_0x332479){return db[_0x9155('0x26')][_0x9155('0x42')]({'where':{'id':_0x2dc2bb['params']['id']}})[_0x9155('0x21')](handleEntityNotFound(_0x332479,null))[_0x9155('0x21')](removeEntity(_0x332479,null))[_0x9155('0x40')](handleError(_0x332479,null));}; \ No newline at end of file +var _0x1625=['filter','options','ServicenowField','include','findAll','rows','catch','params','keys','fields','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','query','model','intersection','attributes','hasOwnProperty','sort','filters','pick','where','merge'];(function(_0x1148c4,_0x394df9){var _0x451564=function(_0x5ee353){while(--_0x5ee353){_0x1148c4['push'](_0x1148c4['shift']());}};_0x451564(++_0x394df9);}(_0x1625,0x1b8));var _0x5162=function(_0x8a2869,_0x214908){_0x8a2869=_0x8a2869-0x0;var _0xd32d94=_0x1625[_0x8a2869];return _0xd32d94;};'use strict';var emlformat=require(_0x5162('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5162('0x1'));var jsonpatch=require(_0x5162('0x2'));var rp=require('request-promise');var moment=require(_0x5162('0x3'));var BPromise=require(_0x5162('0x4'));var Mustache=require(_0x5162('0x5'));var util=require(_0x5162('0x6'));var path=require(_0x5162('0x7'));var sox=require('sox');var csv=require(_0x5162('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5162('0x9'));var _=require(_0x5162('0xa'));var squel=require(_0x5162('0xb'));var crypto=require('crypto');var jsforce=require(_0x5162('0xc'));var deskjs=require(_0x5162('0xd'));var toCsv=require(_0x5162('0x8'));var querystring=require(_0x5162('0xe'));var Papa=require('papaparse');var Redis=require(_0x5162('0xf'));var authService=require(_0x5162('0x10'));var qs=require(_0x5162('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5162('0x12'));var logger=require(_0x5162('0x13'))(_0x5162('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5162('0x15'));var db=require(_0x5162('0x16'))['db'];function respondWithStatusCode(_0x210391,_0x236c96){_0x236c96=_0x236c96||0xcc;return function(_0x4c215a){if(_0x4c215a){return _0x210391[_0x5162('0x17')](_0x236c96);}return _0x210391[_0x5162('0x18')](_0x236c96)[_0x5162('0x19')]();};}function respondWithResult(_0x21bbaf,_0x3b078c){_0x3b078c=_0x3b078c||0xc8;return function(_0x32060d){if(_0x32060d){return _0x21bbaf[_0x5162('0x18')](_0x3b078c)[_0x5162('0x1a')](_0x32060d);}};}function respondWithFilteredResult(_0x431df8,_0x9d08c6){return function(_0x17b6b8){if(_0x17b6b8){var _0x231de5=typeof _0x9d08c6[_0x5162('0x1b')]==='undefined'&&typeof _0x9d08c6[_0x5162('0x1c')]==='undefined';var _0x32ed74=_0x17b6b8[_0x5162('0x1d')];var _0x2e751a=_0x231de5?0x0:_0x9d08c6[_0x5162('0x1b')];var _0x4cd270=_0x231de5?_0x17b6b8[_0x5162('0x1d')]:_0x9d08c6['offset']+_0x9d08c6['limit'];var _0x47b5a2;if(_0x4cd270>=_0x32ed74){_0x4cd270=_0x32ed74;_0x47b5a2=0xc8;}else{_0x47b5a2=0xce;}_0x431df8[_0x5162('0x18')](_0x47b5a2);return _0x431df8[_0x5162('0x1e')](_0x5162('0x1f'),_0x2e751a+'-'+_0x4cd270+'/'+_0x32ed74)[_0x5162('0x1a')](_0x17b6b8);}return null;};}function patchUpdates(_0xe3c1a6){return function(_0x1ab26d){try{jsonpatch[_0x5162('0x20')](_0x1ab26d,_0xe3c1a6,!![]);}catch(_0x432fd4){return BPromise[_0x5162('0x21')](_0x432fd4);}return _0x1ab26d[_0x5162('0x22')]();};}function saveUpdates(_0x359484,_0x56882b){return function(_0x3828d9){if(_0x3828d9){return _0x3828d9[_0x5162('0x23')](_0x359484)[_0x5162('0x24')](function(_0x3b2455){return _0x3b2455;});}return null;};}function removeEntity(_0x4d3d49,_0x5e4071){return function(_0x10cc6e){if(_0x10cc6e){return _0x10cc6e[_0x5162('0x25')]()[_0x5162('0x24')](function(){_0x4d3d49['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x308ff7,_0x5c9d86){return function(_0x3cf251){if(!_0x3cf251){_0x308ff7[_0x5162('0x17')](0x194);}return _0x3cf251;};}function handleError(_0x34b8b1,_0x575738){_0x575738=_0x575738||0x1f4;return function(_0x2c33ad){logger[_0x5162('0x26')](_0x2c33ad['stack']);if(_0x2c33ad[_0x5162('0x27')]){delete _0x2c33ad[_0x5162('0x27')];}_0x34b8b1[_0x5162('0x18')](_0x575738)[_0x5162('0x28')](_0x2c33ad);};}exports[_0x5162('0x29')]=function(_0x338500,_0x5b0762){var _0x1a81c9={},_0x1a7ba8={},_0x27e783={'count':0x0,'rows':[]};var _0xb58f3b=_[_0x5162('0x2a')](db['ServicenowField'][_0x5162('0x2b')],function(_0x1b8bec){return{'name':_0x1b8bec[_0x5162('0x2c')],'type':_0x1b8bec[_0x5162('0x2d')][_0x5162('0x2e')]};});_0x1a7ba8['model']=_[_0x5162('0x2a')](_0xb58f3b,_0x5162('0x27'));_0x1a7ba8[_0x5162('0x2f')]=_['keys'](_0x338500['query']);_0x1a7ba8['filters']=_['intersection'](_0x1a7ba8[_0x5162('0x30')],_0x1a7ba8['query']);_0x1a81c9['attributes']=_[_0x5162('0x31')](_0x1a7ba8[_0x5162('0x30')],qs['fields'](_0x338500[_0x5162('0x2f')]['fields']));_0x1a81c9['attributes']=_0x1a81c9[_0x5162('0x32')]['length']?_0x1a81c9[_0x5162('0x32')]:_0x1a7ba8['model'];if(!_0x338500[_0x5162('0x2f')][_0x5162('0x33')]('nolimit')){_0x1a81c9['limit']=qs['limit'](_0x338500['query'][_0x5162('0x1c')]);_0x1a81c9[_0x5162('0x1b')]=qs[_0x5162('0x1b')](_0x338500['query'][_0x5162('0x1b')]);}_0x1a81c9['order']=qs['sort'](_0x338500[_0x5162('0x2f')][_0x5162('0x34')]);_0x1a81c9['where']=qs[_0x5162('0x35')](_[_0x5162('0x36')](_0x338500['query'],_0x1a7ba8[_0x5162('0x35')]),_0xb58f3b);if(_0x338500['query']['filter']){_0x1a81c9[_0x5162('0x37')]=_[_0x5162('0x38')](_0x1a81c9[_0x5162('0x37')],{'$or':_['map'](_0xb58f3b,function(_0x453ec5){if(_0x453ec5[_0x5162('0x2d')]!=='VIRTUAL'){var _0x5cdec6={};_0x5cdec6[_0x453ec5[_0x5162('0x27')]]={'$like':'%'+_0x338500['query'][_0x5162('0x39')]+'%'};return _0x5cdec6;}})});}_0x1a81c9=_[_0x5162('0x38')]({},_0x1a81c9,_0x338500[_0x5162('0x3a')]);var _0x786668={'where':_0x1a81c9[_0x5162('0x37')]};return db[_0x5162('0x3b')][_0x5162('0x1d')](_0x786668)['then'](function(_0x44c115){_0x27e783[_0x5162('0x1d')]=_0x44c115;if(_0x338500[_0x5162('0x2f')]['includeAll']){_0x1a81c9[_0x5162('0x3c')]=[{'all':!![]}];}return db[_0x5162('0x3b')][_0x5162('0x3d')](_0x1a81c9);})[_0x5162('0x24')](function(_0x3816e3){_0x27e783[_0x5162('0x3e')]=_0x3816e3;return _0x27e783;})[_0x5162('0x24')](respondWithFilteredResult(_0x5b0762,_0x1a81c9))[_0x5162('0x3f')](handleError(_0x5b0762,null));};exports['show']=function(_0x45f29c,_0x52bc4d){var _0x4300b1={'raw':!![],'where':{'id':_0x45f29c[_0x5162('0x40')]['id']}},_0x6f8189={};_0x6f8189[_0x5162('0x30')]=_[_0x5162('0x41')](db[_0x5162('0x3b')][_0x5162('0x2b')]);_0x6f8189[_0x5162('0x2f')]=_['keys'](_0x45f29c[_0x5162('0x2f')]);_0x6f8189[_0x5162('0x35')]=_['intersection'](_0x6f8189[_0x5162('0x30')],_0x6f8189[_0x5162('0x2f')]);_0x4300b1[_0x5162('0x32')]=_[_0x5162('0x31')](_0x6f8189[_0x5162('0x30')],qs[_0x5162('0x42')](_0x45f29c[_0x5162('0x2f')]['fields']));_0x4300b1['attributes']=_0x4300b1[_0x5162('0x32')]['length']?_0x4300b1['attributes']:_0x6f8189['model'];if(_0x45f29c[_0x5162('0x2f')][_0x5162('0x43')]){_0x4300b1[_0x5162('0x3c')]=[{'all':!![]}];}_0x4300b1=_[_0x5162('0x38')]({},_0x4300b1,_0x45f29c[_0x5162('0x3a')]);return db[_0x5162('0x3b')][_0x5162('0x44')](_0x4300b1)[_0x5162('0x24')](handleEntityNotFound(_0x52bc4d,null))['then'](respondWithResult(_0x52bc4d,null))[_0x5162('0x3f')](handleError(_0x52bc4d,null));};exports[_0x5162('0x45')]=function(_0x5343bc,_0x160b70){return db[_0x5162('0x3b')][_0x5162('0x45')](_0x5343bc['body'],{})['then'](respondWithResult(_0x160b70,0xc9))[_0x5162('0x3f')](handleError(_0x160b70,null));};exports['update']=function(_0x44c889,_0x3ab3b5){if(_0x44c889[_0x5162('0x46')]['id']){delete _0x44c889[_0x5162('0x46')]['id'];}return db[_0x5162('0x3b')][_0x5162('0x44')]({'where':{'id':_0x44c889[_0x5162('0x40')]['id']}})[_0x5162('0x24')](handleEntityNotFound(_0x3ab3b5,null))['then'](saveUpdates(_0x44c889[_0x5162('0x46')],null))[_0x5162('0x24')](respondWithResult(_0x3ab3b5,null))['catch'](handleError(_0x3ab3b5,null));};exports[_0x5162('0x25')]=function(_0x2bc75f,_0x1f7e0e){return db[_0x5162('0x3b')]['find']({'where':{'id':_0x2bc75f['params']['id']}})[_0x5162('0x24')](handleEntityNotFound(_0x1f7e0e,null))[_0x5162('0x24')](removeEntity(_0x1f7e0e,null))[_0x5162('0x3f')](handleError(_0x1f7e0e,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 66b7fd1..26db502 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 _0x570c=['exports','define','ServicenowField','servicenow_unique_index','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x570c,0xf6));var _0xc570=function(_0x427489,_0x2edbc4){_0x427489=_0x427489-0x0;var _0x51f6ab=_0x570c[_0x427489];return _0x51f6ab;};'use strict';var _=require(_0xc570('0x0'));var util=require(_0xc570('0x1'));var logger=require('../../config/logger')(_0xc570('0x2'));var moment=require(_0xc570('0x3'));var BPromise=require(_0xc570('0x4'));var rp=require(_0xc570('0x5'));var fs=require('fs');var path=require(_0xc570('0x6'));var rimraf=require('rimraf');var config=require(_0xc570('0x7'));var attributes=require(_0xc570('0x8'));module[_0xc570('0x9')]=function(_0xe4fdee,_0x131a59){return _0xe4fdee[_0xc570('0xa')](_0xc570('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xc570('0xc'),'fields':[_0xc570('0xd'),_0xc570('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x54f3=['moment','bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','servicenow_unique_index','idField','lodash','util','api'];(function(_0x22f065,_0x5227ae){var _0x4584cb=function(_0x15b494){while(--_0x15b494){_0x22f065['push'](_0x22f065['shift']());}};_0x4584cb(++_0x5227ae);}(_0x54f3,0x128));var _0x354f=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x54f3[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x354f('0x0'));var util=require(_0x354f('0x1'));var logger=require('../../config/logger')(_0x354f('0x2'));var moment=require(_0x354f('0x3'));var BPromise=require(_0x354f('0x4'));var rp=require(_0x354f('0x5'));var fs=require('fs');var path=require(_0x354f('0x6'));var rimraf=require('rimraf');var config=require(_0x354f('0x7'));var attributes=require(_0x354f('0x8'));module[_0x354f('0x9')]=function(_0x5efa09,_0x397625){return _0x5efa09['define'](_0x354f('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x354f('0xb'),'fields':[_0x354f('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 709a78f..22aaddc 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 _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5d4d36,_0x42ec13){var _0x279402=function(_0x3ca9dd){while(--_0x3ca9dd){_0x5d4d36['push'](_0x5d4d36['shift']());}};_0x279402(++_0x42ec13);}(_0xe706,0xa3));var _0x6e70=function(_0x1d5a18,_0x585dc8){_0x1d5a18=_0x1d5a18-0x0;var _0x411450=_0xe706[_0x1d5a18];return _0x411450;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xbdb7=['request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','ServicenowField,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5bb207,_0x157700){_0x5bb207=_0x5bb207-0x0;var _0x4b198e=_0xbdb7[_0x5bb207];return _0x4b198e;};'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/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 7864766..3d32498 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x35009a,_0x4c647b){var _0x41ae8a=function(_0x594c04){while(--_0x594c04){_0x35009a['push'](_0x35009a['shift']());}};_0x41ae8a(++_0x4c647b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0xac2be9,_0x5a8f0d){var _0x16e8f7=function(_0xcc34b6){while(--_0xcc34b6){_0xac2be9['push'](_0xac2be9['shift']());}};_0x16e8f7(++_0x5a8f0d);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 76921fa..dfadd96 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(_0x4e6d48,_0x51d7b5){var _0x58bc21=function(_0xb40ff){while(--_0xb40ff){_0x4e6d48['push'](_0x4e6d48['shift']());}};_0x58bc21(++_0x51d7b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x4ebe31,_0x2e0f03){var _0x2ae343=function(_0xa4abed){while(--_0xa4abed){_0x4ebe31['push'](_0x4ebe31['shift']());}};_0x2ae343(++_0x2e0f03);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 40d2195..9d4f42d 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 _0x779d=['nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','catch','show','keys','find','create','body','params','findOne','rawAttributes','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','SugarcrmField','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','xCALLY\x20Motion\x20Integration','Password\x20Expired','Calls','values','module_fields','remove','includes','endsWith','value','test','statusCode','error','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','undefined','limit','count','offset','status','set','apply','reject','update','then','end','stack','name','send','index','map','SugarcrmAccount','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x401944,_0x552dbb){var _0x5b1d81=function(_0x1ab67b){while(--_0x1ab67b){_0x401944['push'](_0x401944['shift']());}};_0x5b1d81(++_0x552dbb);}(_0x779d,0x1a2));var _0xd779=function(_0x1b68d3,_0x52bdf7){_0x1b68d3=_0x1b68d3-0x0;var _0x123897=_0x779d[_0x1b68d3];return _0x123897;};'use strict';var emlformat=require(_0xd779('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd779('0x1'));var rp=require(_0xd779('0x2'));var moment=require(_0xd779('0x3'));var BPromise=require(_0xd779('0x4'));var Mustache=require(_0xd779('0x5'));var util=require(_0xd779('0x6'));var path=require(_0xd779('0x7'));var sox=require(_0xd779('0x8'));var csv=require(_0xd779('0x9'));var ejs=require(_0xd779('0xa'));var fs=require('fs');var fs_extra=require(_0xd779('0xb'));var _=require(_0xd779('0xc'));var squel=require(_0xd779('0xd'));var crypto=require(_0xd779('0xe'));var jsforce=require(_0xd779('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd779('0x9'));var querystring=require('querystring');var Papa=require(_0xd779('0x10'));var Redis=require(_0xd779('0x11'));var authService=require(_0xd779('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd779('0x13'));var logger=require('../../config/logger')(_0xd779('0x14'));var utils=require('../../config/utils');var config=require(_0xd779('0x15'));var licenseUtil=require(_0xd779('0x16'));var db=require(_0xd779('0x17'))['db'];var integrations=require(_0xd779('0x18'));function respondWithStatusCode(_0x16055f,_0x4e736b){_0x4e736b=_0x4e736b||0xcc;return function(_0x2b85b2){if(_0x2b85b2){return _0x16055f[_0xd779('0x19')](_0x4e736b);}return _0x16055f['status'](_0x4e736b)['end']();};}function respondWithResult(_0x29d8bf,_0x583b5e){_0x583b5e=_0x583b5e||0xc8;return function(_0x1a1ba4){if(_0x1a1ba4){return _0x29d8bf['status'](_0x583b5e)[_0xd779('0x1a')](_0x1a1ba4);}};}function respondWithFilteredResult(_0x13bc7d,_0x30e29f){return function(_0x362d5a){if(_0x362d5a){var _0x18f690=typeof _0x30e29f['offset']===_0xd779('0x1b')&&typeof _0x30e29f[_0xd779('0x1c')]===_0xd779('0x1b');var _0x5784c4=_0x362d5a['count'];var _0x3290b4=_0x18f690?0x0:_0x30e29f['offset'];var _0x34708e=_0x18f690?_0x362d5a[_0xd779('0x1d')]:_0x30e29f[_0xd779('0x1e')]+_0x30e29f[_0xd779('0x1c')];var _0x5e5cad;if(_0x34708e>=_0x5784c4){_0x34708e=_0x5784c4;_0x5e5cad=0xc8;}else{_0x5e5cad=0xce;}_0x13bc7d[_0xd779('0x1f')](_0x5e5cad);return _0x13bc7d[_0xd779('0x20')]('Content-Range',_0x3290b4+'-'+_0x34708e+'/'+_0x5784c4)[_0xd779('0x1a')](_0x362d5a);}return null;};}function patchUpdates(_0x299cdb){return function(_0x57e52a){try{jsonpatch[_0xd779('0x21')](_0x57e52a,_0x299cdb,!![]);}catch(_0x50a4fc){return BPromise[_0xd779('0x22')](_0x50a4fc);}return _0x57e52a['save']();};}function saveUpdates(_0x57d4ae,_0x324edc){return function(_0x58e516){if(_0x58e516){return _0x58e516[_0xd779('0x23')](_0x57d4ae)[_0xd779('0x24')](function(_0x30293c){return _0x30293c;});}return null;};}function removeEntity(_0xc9fc89,_0xa813f4){return function(_0x4b1b32){if(_0x4b1b32){return _0x4b1b32['destroy']()[_0xd779('0x24')](function(){_0xc9fc89['status'](0xcc)[_0xd779('0x25')]();});}};}function handleEntityNotFound(_0xa89953,_0x326768){return function(_0x2cc8d7){if(!_0x2cc8d7){_0xa89953['sendStatus'](0x194);}return _0x2cc8d7;};}function handleError(_0x490763,_0x15ab23){_0x15ab23=_0x15ab23||0x1f4;return function(_0x3aad63){logger['error'](_0x3aad63[_0xd779('0x26')]);if(_0x3aad63['name']){delete _0x3aad63[_0xd779('0x27')];}_0x490763[_0xd779('0x1f')](_0x15ab23)[_0xd779('0x28')](_0x3aad63);};}exports[_0xd779('0x29')]=function(_0x9b2994,_0x2a8ad8){var _0xb4de8d={},_0x5e4686={},_0x4eb20f={'count':0x0,'rows':[]};var _0x4037e6=_[_0xd779('0x2a')](db[_0xd779('0x2b')]['rawAttributes'],function(_0x356c5b){return{'name':_0x356c5b[_0xd779('0x2c')],'type':_0x356c5b['type'][_0xd779('0x2d')]};});_0x5e4686[_0xd779('0x2e')]=_[_0xd779('0x2a')](_0x4037e6,_0xd779('0x27'));_0x5e4686[_0xd779('0x2f')]=_['keys'](_0x9b2994[_0xd779('0x2f')]);_0x5e4686[_0xd779('0x30')]=_['intersection'](_0x5e4686[_0xd779('0x2e')],_0x5e4686[_0xd779('0x2f')]);_0xb4de8d['attributes']=_[_0xd779('0x31')](_0x5e4686[_0xd779('0x2e')],qs[_0xd779('0x32')](_0x9b2994[_0xd779('0x2f')][_0xd779('0x32')]));_0xb4de8d[_0xd779('0x33')]=_0xb4de8d['attributes'][_0xd779('0x34')]?_0xb4de8d[_0xd779('0x33')]:_0x5e4686['model'];if(!_0x9b2994[_0xd779('0x2f')][_0xd779('0x35')](_0xd779('0x36'))){_0xb4de8d[_0xd779('0x1c')]=qs['limit'](_0x9b2994['query'][_0xd779('0x1c')]);_0xb4de8d[_0xd779('0x1e')]=qs['offset'](_0x9b2994[_0xd779('0x2f')][_0xd779('0x1e')]);}_0xb4de8d[_0xd779('0x37')]=qs[_0xd779('0x38')](_0x9b2994[_0xd779('0x2f')][_0xd779('0x38')]);_0xb4de8d[_0xd779('0x39')]=qs[_0xd779('0x30')](_[_0xd779('0x3a')](_0x9b2994['query'],_0x5e4686[_0xd779('0x30')]),_0x4037e6);if(_0x9b2994[_0xd779('0x2f')]['filter']){_0xb4de8d['where']=_[_0xd779('0x3b')](_0xb4de8d[_0xd779('0x39')],{'$or':_['map'](_0x4037e6,function(_0x332be8){if(_0x332be8[_0xd779('0x3c')]!=='VIRTUAL'){var _0x2a08d4={};_0x2a08d4[_0x332be8[_0xd779('0x27')]]={'$like':'%'+_0x9b2994[_0xd779('0x2f')][_0xd779('0x3d')]+'%'};return _0x2a08d4;}})});}_0xb4de8d=_['merge']({},_0xb4de8d,_0x9b2994[_0xd779('0x3e')]);var _0xf7935d={'where':_0xb4de8d[_0xd779('0x39')]};return db[_0xd779('0x2b')]['count'](_0xf7935d)[_0xd779('0x24')](function(_0x5ab8a0){_0x4eb20f[_0xd779('0x1d')]=_0x5ab8a0;if(_0x9b2994[_0xd779('0x2f')][_0xd779('0x3f')]){_0xb4de8d[_0xd779('0x40')]=[{'all':!![]}];}return db[_0xd779('0x2b')]['findAll'](_0xb4de8d);})[_0xd779('0x24')](function(_0x2cc352){_0x4eb20f['rows']=_0x2cc352;return _0x4eb20f;})[_0xd779('0x24')](respondWithFilteredResult(_0x2a8ad8,_0xb4de8d))[_0xd779('0x41')](handleError(_0x2a8ad8,null));};exports[_0xd779('0x42')]=function(_0x4894af,_0x414050){var _0x3cb0cd={'raw':![],'where':{'id':_0x4894af['params']['id']}},_0x2d16c7={};_0x2d16c7['model']=_['keys'](db[_0xd779('0x2b')]['rawAttributes']);_0x2d16c7['query']=_[_0xd779('0x43')](_0x4894af[_0xd779('0x2f')]);_0x2d16c7['filters']=_['intersection'](_0x2d16c7['model'],_0x2d16c7[_0xd779('0x2f')]);_0x3cb0cd[_0xd779('0x33')]=_[_0xd779('0x31')](_0x2d16c7[_0xd779('0x2e')],qs[_0xd779('0x32')](_0x4894af[_0xd779('0x2f')][_0xd779('0x32')]));_0x3cb0cd[_0xd779('0x33')]=_0x3cb0cd[_0xd779('0x33')][_0xd779('0x34')]?_0x3cb0cd[_0xd779('0x33')]:_0x2d16c7[_0xd779('0x2e')];if(_0x4894af[_0xd779('0x2f')][_0xd779('0x3f')]){_0x3cb0cd['include']=[{'all':!![]}];}_0x3cb0cd=_[_0xd779('0x3b')]({},_0x3cb0cd,_0x4894af[_0xd779('0x3e')]);return db['SugarcrmAccount'][_0xd779('0x44')](_0x3cb0cd)['then'](handleEntityNotFound(_0x414050,null))[_0xd779('0x24')](respondWithResult(_0x414050,null))[_0xd779('0x41')](handleError(_0x414050,null));};exports['create']=function(_0x3c8e45,_0x255eea){return db['SugarcrmAccount'][_0xd779('0x45')](_0x3c8e45['body'],{})[_0xd779('0x24')](respondWithResult(_0x255eea,0xc9))[_0xd779('0x41')](handleError(_0x255eea,null));};exports[_0xd779('0x23')]=function(_0x456426,_0x9e4057){if(_0x456426[_0xd779('0x46')]['id']){delete _0x456426[_0xd779('0x46')]['id'];}return db[_0xd779('0x2b')][_0xd779('0x44')]({'where':{'id':_0x456426[_0xd779('0x47')]['id']}})[_0xd779('0x24')](handleEntityNotFound(_0x9e4057,null))[_0xd779('0x24')](saveUpdates(_0x456426[_0xd779('0x46')],null))['then'](respondWithResult(_0x9e4057,null))[_0xd779('0x41')](handleError(_0x9e4057,null));};exports['destroy']=function(_0x5ee059,_0x4fb26f){return db[_0xd779('0x2b')]['find']({'where':{'id':_0x5ee059[_0xd779('0x47')]['id']}})['then'](handleEntityNotFound(_0x4fb26f,null))[_0xd779('0x24')](removeEntity(_0x4fb26f,null))[_0xd779('0x41')](handleError(_0x4fb26f,null));};exports['getConfigurations']=function(_0x3f9814,_0x2defbe,_0xc58910){var _0xf96f52={};var _0x55cf6b={};var _0x3d99b6;var _0x33c882;return db[_0xd779('0x2b')][_0xd779('0x48')]({'where':{'id':_0x3f9814['params']['id']}})[_0xd779('0x24')](handleEntityNotFound(_0x2defbe,null))[_0xd779('0x24')](function(_0x182d66){if(_0x182d66){_0x3d99b6=_0x182d66;_0x55cf6b[_0xd779('0x2e')]=_['keys'](db['SugarcrmConfiguration'][_0xd779('0x49')]);_0x55cf6b[_0xd779('0x2f')]=_[_0xd779('0x43')](_0x3f9814[_0xd779('0x2f')]);_0x55cf6b[_0xd779('0x30')]=_[_0xd779('0x31')](_0x55cf6b['model'],_0x55cf6b[_0xd779('0x2f')]);_0xf96f52[_0xd779('0x33')]=_[_0xd779('0x31')](_0x55cf6b[_0xd779('0x2e')],qs[_0xd779('0x32')](_0x3f9814[_0xd779('0x2f')]['fields']));_0xf96f52[_0xd779('0x33')]=_0xf96f52[_0xd779('0x33')][_0xd779('0x34')]?_0xf96f52[_0xd779('0x33')]:_0x55cf6b['model'];_0xf96f52[_0xd779('0x37')]=qs['sort'](_0x3f9814[_0xd779('0x2f')][_0xd779('0x38')]);_0xf96f52[_0xd779('0x39')]=qs['filters'](_[_0xd779('0x3a')](_0x3f9814[_0xd779('0x2f')],_0x55cf6b[_0xd779('0x30')]));if(_0x3f9814[_0xd779('0x2f')]['filter']){_0xf96f52[_0xd779('0x39')]=_[_0xd779('0x3b')](_0xf96f52[_0xd779('0x39')],{'$or':_[_0xd779('0x2a')](_0xf96f52[_0xd779('0x33')],function(_0x6d966f){var _0x543cdd={};_0x543cdd[_0x6d966f]={'$like':'%'+_0x3f9814[_0xd779('0x2f')][_0xd779('0x3d')]+'%'};return _0x543cdd;})});}_0xf96f52=_['merge']({},_0xf96f52,_0x3f9814['options']);return _0x3d99b6['getConfigurations'](_0xf96f52);}})[_0xd779('0x24')](function(_0x186a71){if(_0x186a71){_0x33c882=_0x186a71[_0xd779('0x34')];if(!_0x3f9814[_0xd779('0x2f')][_0xd779('0x35')]('nolimit')){_0xf96f52['limit']=qs[_0xd779('0x1c')](_0x3f9814['query']['limit']);_0xf96f52[_0xd779('0x1e')]=qs[_0xd779('0x1e')](_0x3f9814[_0xd779('0x2f')][_0xd779('0x1e')]);}return _0x3d99b6[_0xd779('0x4a')](_0xf96f52);}})['then'](function(_0x290276){if(_0x290276){return _0x290276?{'count':_0x33c882,'rows':_0x290276}:null;}})[_0xd779('0x24')](respondWithResult(_0x2defbe,null))[_0xd779('0x41')](handleError(_0x2defbe,null));};exports['addConfiguration']=function(_0x254ddc,_0x4741bd,_0x2514ee){if(_0x254ddc[_0xd779('0x46')]['id']){delete _0x254ddc['body']['id'];}return db[_0xd779('0x2b')]['findOne']({'where':{'id':_0x254ddc[_0xd779('0x47')]['id']}})['then'](handleEntityNotFound(_0x4741bd,null))['then'](function(_0x554b9e){if(_0x554b9e){_0x254ddc['body'][_0xd779('0x4b')]=_0x554b9e['id'];_0x254ddc['body'][_0xd779('0x4c')]=integrations[_0xd779('0x4d')](_0x254ddc[_0xd779('0x46')][_0xd779('0x4e')],_0x254ddc[_0xd779('0x46')][_0xd779('0x3c')]);_0x254ddc['body'][_0xd779('0x4f')]=integrations[_0xd779('0x50')](_0x254ddc[_0xd779('0x46')][_0xd779('0x4e')],_0x254ddc[_0xd779('0x46')][_0xd779('0x3c')]);return db[_0xd779('0x51')][_0xd779('0x45')](_0x254ddc['body'],{'include':[{'model':db[_0xd779('0x52')],'as':_0xd779('0x4c')},{'model':db[_0xd779('0x52')],'as':_0xd779('0x4f')}]});}return null;})[_0xd779('0x24')](respondWithResult(_0x4741bd,null))[_0xd779('0x41')](handleError(_0x4741bd,null));};exports[_0xd779('0x53')]=function(_0x2d29c6,_0x4d20cf,_0x38b201){var _0x369d6a='';var _0x2898bf=['id',_0xd779('0x27'),_0xd779('0x54'),'created_by',_0xd779('0x55'),_0xd779('0x56'),_0xd779('0x57'),_0xd779('0x58'),_0xd779('0x59'),'parent_type',_0xd779('0x5a'),_0xd779('0x5b')];return db[_0xd779('0x2b')][_0xd779('0x48')]({'where':{'id':_0x2d29c6['params']['id']},'attributes':['id',_0xd779('0x5c'),_0xd779('0x5d'),_0xd779('0x5e')]})[_0xd779('0x24')](handleEntityNotFound(_0x4d20cf,null))[_0xd779('0x24')](function(_0x745cb0){if(_0x745cb0){_0x369d6a=_0x745cb0[_0xd779('0x5e')];var _0x447d66=_0x369d6a[_0xd779('0x5f')](-0x1);if(_0x447d66==='/'){_0x369d6a=_0x369d6a[_0xd779('0x60')](0x0,_0x369d6a[_0xd779('0x61')](_0x447d66));}return rp({'method':_0xd779('0x62'),'uri':util[_0xd779('0x63')](_0xd779('0x64'),_0x369d6a,_0xd779('0x65')),'json':!![],'form':{'method':_0xd779('0x66'),'input_type':_0xd779('0x67'),'response_type':'JSON','rest_data':JSON[_0xd779('0x68')]({'user_auth':{'user_name':_0x745cb0[_0xd779('0x5c')],'password':_0x745cb0[_0xd779('0x5d')],'encryption':'PLAIN'},'application':_0xd779('0x69')})}});}})[_0xd779('0x24')](function(_0xad1a57){if(_0xad1a57&&_0xad1a57['name']!=='Invalid\x20Login'&&_0xad1a57['name']!==_0xd779('0x6a')){return rp({'method':_0xd779('0x62'),'uri':util['format']('%s%s',_0x369d6a,_0xd779('0x65')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xd779('0x67'),'response_type':_0xd779('0x67'),'rest_data':JSON[_0xd779('0x68')]({'session':_0xad1a57['id'],'module_name':_0xd779('0x6b')})}})[_0xd779('0x24')](function(_0x11d03e){if(_0x11d03e){var _0xe9dc2d=_[_0xd779('0x6c')](_0x11d03e[_0xd779('0x6d')]);_[_0xd779('0x6e')](_0xe9dc2d,function(_0x3cc5e5){return _0x2898bf[_0xd779('0x6f')](_0x3cc5e5[_0xd779('0x27')]);});return{'count':_0xe9dc2d[_0xd779('0x34')],'rows':_[_0xd779('0x2a')](_0xe9dc2d,function(_0x3d1a38){return{'id':_0x3d1a38[_0xd779('0x27')],'name':_0x3d1a38['label'],'custom':_[_0xd779('0x70')](_0x3d1a38[_0xd779('0x27')],'_c')?!![]:![],'options':_0x3d1a38[_0xd779('0x3e')]?_[_0xd779('0x2a')](_[_0xd779('0x6c')](_0x3d1a38[_0xd779('0x3e')]),function(_0x5d060c){return{'name':_0x5d060c[_0xd779('0x71')],'value':_0x5d060c['name']};}):[]};})};}})[_0xd779('0x24')](respondWithResult(_0x4d20cf,null))[_0xd779('0x41')](function(_0x3aa87f){var _0x47d717=_0x2d29c6[_0xd779('0x2f')][_0xd779('0x72')]?0x1f4:_0x3aa87f[_0xd779('0x73')]||0x1f4;logger[_0xd779('0x74')]('getFields,\x20%s,\x20%s,\x20%s',_0xd779('0x53'),_0x47d717,JSON[_0xd779('0x68')](_0x3aa87f));delete _0x3aa87f['name'];if(_0x47d717===0x191){_0x47d717=0x190;}_0x4d20cf[_0xd779('0x1f')](_0x47d717)[_0xd779('0x28')](_0x2d29c6[_0xd779('0x2f')][_0xd779('0x72')]?{'message':_0xd779('0x75'),'statusCode':_0x3aa87f[_0xd779('0x73')]}:_0x3aa87f);});}else{var _0x55bc33=0x1f4;_0x4d20cf['status'](_0x55bc33)[_0xd779('0x28')]({'message':_0xd779('0x75'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xa8c0=['options','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','POST','format','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','Invalid\x20Login','%s%s','get_module_fields','Calls','values','module_fields','remove','includes','label','value','statusCode','error','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','stack','name','index','SugarcrmAccount','fieldName','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','create','body','update','find','params','getConfigurations','findOne','SugarcrmConfiguration','rawAttributes'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa8c0,0x11e));var _0x0a8c=function(_0x1f7413,_0x3388c3){_0x1f7413=_0x1f7413-0x0;var _0x2d2775=_0xa8c0[_0x1f7413];return _0x2d2775;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0a8c('0x0'));var zipdir=require(_0x0a8c('0x1'));var jsonpatch=require(_0x0a8c('0x2'));var rp=require(_0x0a8c('0x3'));var moment=require('moment');var BPromise=require(_0x0a8c('0x4'));var Mustache=require('mustache');var util=require(_0x0a8c('0x5'));var path=require(_0x0a8c('0x6'));var sox=require(_0x0a8c('0x7'));var csv=require(_0x0a8c('0x8'));var ejs=require(_0x0a8c('0x9'));var fs=require('fs');var fs_extra=require(_0x0a8c('0xa'));var _=require(_0x0a8c('0xb'));var squel=require(_0x0a8c('0xc'));var crypto=require(_0x0a8c('0xd'));var jsforce=require(_0x0a8c('0xe'));var deskjs=require(_0x0a8c('0xf'));var toCsv=require(_0x0a8c('0x8'));var querystring=require(_0x0a8c('0x10'));var Papa=require('papaparse');var Redis=require(_0x0a8c('0x11'));var authService=require(_0x0a8c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0a8c('0x13'));var hardwareService=require(_0x0a8c('0x14'));var logger=require(_0x0a8c('0x15'))(_0x0a8c('0x16'));var utils=require(_0x0a8c('0x17'));var config=require(_0x0a8c('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3c5669,_0x38ed76){_0x38ed76=_0x38ed76||0xcc;return function(_0x42b9ac){if(_0x42b9ac){return _0x3c5669[_0x0a8c('0x19')](_0x38ed76);}return _0x3c5669['status'](_0x38ed76)['end']();};}function respondWithResult(_0x23a97e,_0x4fe557){_0x4fe557=_0x4fe557||0xc8;return function(_0x418dff){if(_0x418dff){return _0x23a97e[_0x0a8c('0x1a')](_0x4fe557)[_0x0a8c('0x1b')](_0x418dff);}};}function respondWithFilteredResult(_0x1f4941,_0x4b346e){return function(_0x55d1ae){if(_0x55d1ae){var _0x3a8f2c=typeof _0x4b346e[_0x0a8c('0x1c')]==='undefined'&&typeof _0x4b346e['limit']===_0x0a8c('0x1d');var _0x426463=_0x55d1ae[_0x0a8c('0x1e')];var _0x1bed55=_0x3a8f2c?0x0:_0x4b346e[_0x0a8c('0x1c')];var _0x4f63b0=_0x3a8f2c?_0x55d1ae['count']:_0x4b346e[_0x0a8c('0x1c')]+_0x4b346e[_0x0a8c('0x1f')];var _0x5a0565;if(_0x4f63b0>=_0x426463){_0x4f63b0=_0x426463;_0x5a0565=0xc8;}else{_0x5a0565=0xce;}_0x1f4941[_0x0a8c('0x1a')](_0x5a0565);return _0x1f4941[_0x0a8c('0x20')](_0x0a8c('0x21'),_0x1bed55+'-'+_0x4f63b0+'/'+_0x426463)['json'](_0x55d1ae);}return null;};}function patchUpdates(_0x3ef72d){return function(_0x3647ac){try{jsonpatch[_0x0a8c('0x22')](_0x3647ac,_0x3ef72d,!![]);}catch(_0x35ebd8){return BPromise[_0x0a8c('0x23')](_0x35ebd8);}return _0x3647ac['save']();};}function saveUpdates(_0x4a13b9,_0x2936f9){return function(_0x14a4e8){if(_0x14a4e8){return _0x14a4e8['update'](_0x4a13b9)[_0x0a8c('0x24')](function(_0x3e9d1c){return _0x3e9d1c;});}return null;};}function removeEntity(_0x3bbad5,_0x112e92){return function(_0x54ffc6){if(_0x54ffc6){return _0x54ffc6[_0x0a8c('0x25')]()['then'](function(){_0x3bbad5[_0x0a8c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7c1115,_0x35073c){return function(_0x5b86cb){if(!_0x5b86cb){_0x7c1115[_0x0a8c('0x19')](0x194);}return _0x5b86cb;};}function handleError(_0x18be03,_0x288a02){_0x288a02=_0x288a02||0x1f4;return function(_0x827aab){logger['error'](_0x827aab[_0x0a8c('0x26')]);if(_0x827aab[_0x0a8c('0x27')]){delete _0x827aab[_0x0a8c('0x27')];}_0x18be03[_0x0a8c('0x1a')](_0x288a02)['send'](_0x827aab);};}exports[_0x0a8c('0x28')]=function(_0x1b3a82,_0x3101fe){var _0x1441b6={},_0x318d49={},_0x158920={'count':0x0,'rows':[]};var _0x21961d=_['map'](db[_0x0a8c('0x29')]['rawAttributes'],function(_0x528e32){return{'name':_0x528e32[_0x0a8c('0x2a')],'type':_0x528e32['type']['key']};});_0x318d49[_0x0a8c('0x2b')]=_[_0x0a8c('0x2c')](_0x21961d,_0x0a8c('0x27'));_0x318d49[_0x0a8c('0x2d')]=_[_0x0a8c('0x2e')](_0x1b3a82[_0x0a8c('0x2d')]);_0x318d49['filters']=_[_0x0a8c('0x2f')](_0x318d49[_0x0a8c('0x2b')],_0x318d49[_0x0a8c('0x2d')]);_0x1441b6[_0x0a8c('0x30')]=_[_0x0a8c('0x2f')](_0x318d49['model'],qs[_0x0a8c('0x31')](_0x1b3a82[_0x0a8c('0x2d')][_0x0a8c('0x31')]));_0x1441b6[_0x0a8c('0x30')]=_0x1441b6[_0x0a8c('0x30')][_0x0a8c('0x32')]?_0x1441b6['attributes']:_0x318d49['model'];if(!_0x1b3a82[_0x0a8c('0x2d')][_0x0a8c('0x33')](_0x0a8c('0x34'))){_0x1441b6[_0x0a8c('0x1f')]=qs[_0x0a8c('0x1f')](_0x1b3a82[_0x0a8c('0x2d')][_0x0a8c('0x1f')]);_0x1441b6[_0x0a8c('0x1c')]=qs[_0x0a8c('0x1c')](_0x1b3a82[_0x0a8c('0x2d')][_0x0a8c('0x1c')]);}_0x1441b6[_0x0a8c('0x35')]=qs[_0x0a8c('0x36')](_0x1b3a82['query']['sort']);_0x1441b6[_0x0a8c('0x37')]=qs[_0x0a8c('0x38')](_[_0x0a8c('0x39')](_0x1b3a82[_0x0a8c('0x2d')],_0x318d49[_0x0a8c('0x38')]),_0x21961d);if(_0x1b3a82[_0x0a8c('0x2d')][_0x0a8c('0x3a')]){_0x1441b6[_0x0a8c('0x37')]=_[_0x0a8c('0x3b')](_0x1441b6[_0x0a8c('0x37')],{'$or':_['map'](_0x21961d,function(_0x229029){if(_0x229029[_0x0a8c('0x3c')]!==_0x0a8c('0x3d')){var _0x3e6482={};_0x3e6482[_0x229029[_0x0a8c('0x27')]]={'$like':'%'+_0x1b3a82[_0x0a8c('0x2d')][_0x0a8c('0x3a')]+'%'};return _0x3e6482;}})});}_0x1441b6=_[_0x0a8c('0x3b')]({},_0x1441b6,_0x1b3a82['options']);var _0x27cd7c={'where':_0x1441b6['where']};return db[_0x0a8c('0x29')][_0x0a8c('0x1e')](_0x27cd7c)['then'](function(_0x573e7b){_0x158920[_0x0a8c('0x1e')]=_0x573e7b;if(_0x1b3a82[_0x0a8c('0x2d')][_0x0a8c('0x3e')]){_0x1441b6[_0x0a8c('0x3f')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x0a8c('0x40')](_0x1441b6);})[_0x0a8c('0x24')](function(_0x1689e2){_0x158920[_0x0a8c('0x41')]=_0x1689e2;return _0x158920;})[_0x0a8c('0x24')](respondWithFilteredResult(_0x3101fe,_0x1441b6))[_0x0a8c('0x42')](handleError(_0x3101fe,null));};exports[_0x0a8c('0x43')]=function(_0x7904a5,_0x2f592c){var _0x49cc78={'raw':![],'where':{'id':_0x7904a5['params']['id']}},_0x286fb0={};_0x286fb0[_0x0a8c('0x2b')]=_[_0x0a8c('0x2e')](db[_0x0a8c('0x29')]['rawAttributes']);_0x286fb0['query']=_[_0x0a8c('0x2e')](_0x7904a5[_0x0a8c('0x2d')]);_0x286fb0[_0x0a8c('0x38')]=_[_0x0a8c('0x2f')](_0x286fb0[_0x0a8c('0x2b')],_0x286fb0[_0x0a8c('0x2d')]);_0x49cc78[_0x0a8c('0x30')]=_[_0x0a8c('0x2f')](_0x286fb0[_0x0a8c('0x2b')],qs[_0x0a8c('0x31')](_0x7904a5['query'][_0x0a8c('0x31')]));_0x49cc78[_0x0a8c('0x30')]=_0x49cc78[_0x0a8c('0x30')][_0x0a8c('0x32')]?_0x49cc78['attributes']:_0x286fb0['model'];if(_0x7904a5[_0x0a8c('0x2d')]['includeAll']){_0x49cc78[_0x0a8c('0x3f')]=[{'all':!![]}];}_0x49cc78=_['merge']({},_0x49cc78,_0x7904a5['options']);return db['SugarcrmAccount']['find'](_0x49cc78)['then'](handleEntityNotFound(_0x2f592c,null))[_0x0a8c('0x24')](respondWithResult(_0x2f592c,null))[_0x0a8c('0x42')](handleError(_0x2f592c,null));};exports[_0x0a8c('0x44')]=function(_0xbd81f7,_0x4e4579){return db[_0x0a8c('0x29')][_0x0a8c('0x44')](_0xbd81f7[_0x0a8c('0x45')],{})['then'](respondWithResult(_0x4e4579,0xc9))[_0x0a8c('0x42')](handleError(_0x4e4579,null));};exports[_0x0a8c('0x46')]=function(_0x5234b5,_0x432ba3){if(_0x5234b5[_0x0a8c('0x45')]['id']){delete _0x5234b5['body']['id'];}return db[_0x0a8c('0x29')][_0x0a8c('0x47')]({'where':{'id':_0x5234b5[_0x0a8c('0x48')]['id']}})[_0x0a8c('0x24')](handleEntityNotFound(_0x432ba3,null))['then'](saveUpdates(_0x5234b5['body'],null))[_0x0a8c('0x24')](respondWithResult(_0x432ba3,null))[_0x0a8c('0x42')](handleError(_0x432ba3,null));};exports[_0x0a8c('0x25')]=function(_0x2bd086,_0x902bc8){return db['SugarcrmAccount']['find']({'where':{'id':_0x2bd086[_0x0a8c('0x48')]['id']}})['then'](handleEntityNotFound(_0x902bc8,null))[_0x0a8c('0x24')](removeEntity(_0x902bc8,null))[_0x0a8c('0x42')](handleError(_0x902bc8,null));};exports[_0x0a8c('0x49')]=function(_0x54a789,_0x3792a0,_0x51371c){var _0x5f4ec8={};var _0x53a879={};var _0x4fca84;var _0x2e08f;return db['SugarcrmAccount'][_0x0a8c('0x4a')]({'where':{'id':_0x54a789['params']['id']}})['then'](handleEntityNotFound(_0x3792a0,null))[_0x0a8c('0x24')](function(_0x575865){if(_0x575865){_0x4fca84=_0x575865;_0x53a879['model']=_[_0x0a8c('0x2e')](db[_0x0a8c('0x4b')][_0x0a8c('0x4c')]);_0x53a879[_0x0a8c('0x2d')]=_[_0x0a8c('0x2e')](_0x54a789['query']);_0x53a879[_0x0a8c('0x38')]=_[_0x0a8c('0x2f')](_0x53a879[_0x0a8c('0x2b')],_0x53a879['query']);_0x5f4ec8[_0x0a8c('0x30')]=_[_0x0a8c('0x2f')](_0x53a879[_0x0a8c('0x2b')],qs[_0x0a8c('0x31')](_0x54a789[_0x0a8c('0x2d')][_0x0a8c('0x31')]));_0x5f4ec8['attributes']=_0x5f4ec8['attributes'][_0x0a8c('0x32')]?_0x5f4ec8[_0x0a8c('0x30')]:_0x53a879[_0x0a8c('0x2b')];_0x5f4ec8[_0x0a8c('0x35')]=qs[_0x0a8c('0x36')](_0x54a789[_0x0a8c('0x2d')][_0x0a8c('0x36')]);_0x5f4ec8[_0x0a8c('0x37')]=qs['filters'](_[_0x0a8c('0x39')](_0x54a789['query'],_0x53a879['filters']));if(_0x54a789[_0x0a8c('0x2d')][_0x0a8c('0x3a')]){_0x5f4ec8[_0x0a8c('0x37')]=_[_0x0a8c('0x3b')](_0x5f4ec8[_0x0a8c('0x37')],{'$or':_[_0x0a8c('0x2c')](_0x5f4ec8[_0x0a8c('0x30')],function(_0x503e28){var _0x89965e={};_0x89965e[_0x503e28]={'$like':'%'+_0x54a789[_0x0a8c('0x2d')]['filter']+'%'};return _0x89965e;})});}_0x5f4ec8=_[_0x0a8c('0x3b')]({},_0x5f4ec8,_0x54a789[_0x0a8c('0x4d')]);return _0x4fca84[_0x0a8c('0x49')](_0x5f4ec8);}})[_0x0a8c('0x24')](function(_0x3e4331){if(_0x3e4331){_0x2e08f=_0x3e4331[_0x0a8c('0x32')];if(!_0x54a789[_0x0a8c('0x2d')][_0x0a8c('0x33')]('nolimit')){_0x5f4ec8[_0x0a8c('0x1f')]=qs['limit'](_0x54a789['query'][_0x0a8c('0x1f')]);_0x5f4ec8[_0x0a8c('0x1c')]=qs[_0x0a8c('0x1c')](_0x54a789['query'][_0x0a8c('0x1c')]);}return _0x4fca84['getConfigurations'](_0x5f4ec8);}})[_0x0a8c('0x24')](function(_0x4a1d6f){if(_0x4a1d6f){return _0x4a1d6f?{'count':_0x2e08f,'rows':_0x4a1d6f}:null;}})[_0x0a8c('0x24')](respondWithResult(_0x3792a0,null))[_0x0a8c('0x42')](handleError(_0x3792a0,null));};exports[_0x0a8c('0x4e')]=function(_0x5f3868,_0x3b6f6b,_0x4bf5e0){if(_0x5f3868[_0x0a8c('0x45')]['id']){delete _0x5f3868[_0x0a8c('0x45')]['id'];}return db[_0x0a8c('0x29')][_0x0a8c('0x4a')]({'where':{'id':_0x5f3868[_0x0a8c('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b6f6b,null))[_0x0a8c('0x24')](function(_0x164cba){if(_0x164cba){_0x5f3868[_0x0a8c('0x45')][_0x0a8c('0x4f')]=_0x164cba['id'];_0x5f3868[_0x0a8c('0x45')][_0x0a8c('0x50')]=integrations[_0x0a8c('0x51')](_0x5f3868[_0x0a8c('0x45')][_0x0a8c('0x52')],_0x5f3868['body'][_0x0a8c('0x3c')]);_0x5f3868[_0x0a8c('0x45')]['Descriptions']=integrations[_0x0a8c('0x53')](_0x5f3868['body'][_0x0a8c('0x52')],_0x5f3868[_0x0a8c('0x45')][_0x0a8c('0x3c')]);return db[_0x0a8c('0x4b')][_0x0a8c('0x44')](_0x5f3868[_0x0a8c('0x45')],{'include':[{'model':db[_0x0a8c('0x54')],'as':'Subjects'},{'model':db[_0x0a8c('0x54')],'as':_0x0a8c('0x55')}]});}return null;})[_0x0a8c('0x24')](respondWithResult(_0x3b6f6b,null))[_0x0a8c('0x42')](handleError(_0x3b6f6b,null));};exports[_0x0a8c('0x56')]=function(_0x5eaf2d,_0x561eb8,_0x23c3d4){var _0x559900='';var _0x1ef157=['id',_0x0a8c('0x27'),_0x0a8c('0x57'),'created_by','description',_0x0a8c('0x58'),_0x0a8c('0x59'),_0x0a8c('0x5a'),_0x0a8c('0x5b'),_0x0a8c('0x5c'),_0x0a8c('0x5d'),_0x0a8c('0x5e')];return db[_0x0a8c('0x29')][_0x0a8c('0x4a')]({'where':{'id':_0x5eaf2d['params']['id']},'attributes':['id',_0x0a8c('0x5f'),_0x0a8c('0x60'),_0x0a8c('0x61')]})[_0x0a8c('0x24')](handleEntityNotFound(_0x561eb8,null))[_0x0a8c('0x24')](function(_0x38c4f4){if(_0x38c4f4){_0x559900=_0x38c4f4['remoteUri'];var _0x16800d=_0x559900[_0x0a8c('0x62')](-0x1);if(_0x16800d==='/'){_0x559900=_0x559900[_0x0a8c('0x63')](0x0,_0x559900['lastIndexOf'](_0x16800d));}return rp({'method':_0x0a8c('0x64'),'uri':util[_0x0a8c('0x65')]('%s%s',_0x559900,_0x0a8c('0x66')),'json':!![],'form':{'method':_0x0a8c('0x67'),'input_type':_0x0a8c('0x68'),'response_type':_0x0a8c('0x68'),'rest_data':JSON[_0x0a8c('0x69')]({'user_auth':{'user_name':_0x38c4f4['username'],'password':_0x38c4f4[_0x0a8c('0x60')],'encryption':_0x0a8c('0x6a')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x0a8c('0x24')](function(_0x19ae5c){if(_0x19ae5c&&_0x19ae5c['name']!==_0x0a8c('0x6b')&&_0x19ae5c[_0x0a8c('0x27')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0x0a8c('0x65')](_0x0a8c('0x6c'),_0x559900,_0x0a8c('0x66')),'json':!![],'form':{'method':_0x0a8c('0x6d'),'input_type':_0x0a8c('0x68'),'response_type':_0x0a8c('0x68'),'rest_data':JSON[_0x0a8c('0x69')]({'session':_0x19ae5c['id'],'module_name':_0x0a8c('0x6e')})}})[_0x0a8c('0x24')](function(_0x3bf5a2){if(_0x3bf5a2){var _0x706b9a=_[_0x0a8c('0x6f')](_0x3bf5a2[_0x0a8c('0x70')]);_[_0x0a8c('0x71')](_0x706b9a,function(_0x8f295c){return _0x1ef157[_0x0a8c('0x72')](_0x8f295c[_0x0a8c('0x27')]);});return{'count':_0x706b9a['length'],'rows':_[_0x0a8c('0x2c')](_0x706b9a,function(_0x87ab90){return{'id':_0x87ab90[_0x0a8c('0x27')],'name':_0x87ab90[_0x0a8c('0x73')],'custom':_['endsWith'](_0x87ab90[_0x0a8c('0x27')],'_c')?!![]:![],'options':_0x87ab90[_0x0a8c('0x4d')]?_[_0x0a8c('0x2c')](_['values'](_0x87ab90['options']),function(_0x154a36){return{'name':_0x154a36[_0x0a8c('0x74')],'value':_0x154a36[_0x0a8c('0x27')]};}):[]};})};}})[_0x0a8c('0x24')](respondWithResult(_0x561eb8,null))[_0x0a8c('0x42')](function(_0x501c33){var _0x1dd019=_0x5eaf2d[_0x0a8c('0x2d')]['test']?0x1f4:_0x501c33[_0x0a8c('0x75')]||0x1f4;logger[_0x0a8c('0x76')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x1dd019,JSON[_0x0a8c('0x69')](_0x501c33));delete _0x501c33[_0x0a8c('0x27')];if(_0x1dd019===0x191){_0x1dd019=0x190;}_0x561eb8[_0x0a8c('0x1a')](_0x1dd019)['send'](_0x5eaf2d[_0x0a8c('0x2d')][_0x0a8c('0x77')]?{'message':_0x0a8c('0x78'),'statusCode':_0x501c33['statusCode']}:_0x501c33);});}else{var _0x1952fc=0x1f4;_0x561eb8[_0x0a8c('0x1a')](_0x1952fc)['send']({'message':_0x0a8c('0x78'),'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 db81156..094eeed 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 _0xf79e=['../../config/logger','api','bluebird','request-promise','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','SugarcrmAccount','util'];(function(_0x31d6c2,_0x422dcd){var _0x295dd0=function(_0x2b5dd1){while(--_0x2b5dd1){_0x31d6c2['push'](_0x31d6c2['shift']());}};_0x295dd0(++_0x422dcd);}(_0xf79e,0x185));var _0xef79=function(_0x105114,_0x553156){_0x105114=_0x105114-0x0;var _0x511a69=_0xf79e[_0x105114];return _0x511a69;};'use strict';var _=require('lodash');var util=require(_0xef79('0x0'));var logger=require(_0xef79('0x1'))(_0xef79('0x2'));var moment=require('moment');var BPromise=require(_0xef79('0x3'));var rp=require(_0xef79('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xef79('0x5'));var attributes=require(_0xef79('0x6'));var integrations=require(_0xef79('0x7'));module[_0xef79('0x8')]=function(_0x396c51,_0x2fa668){return _0x396c51['define'](_0xef79('0x9'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x51c5=['../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x3a8567,_0x122ef9){var _0x302a4c=function(_0x32f6b8){while(--_0x32f6b8){_0x3a8567['push'](_0x3a8567['shift']());}};_0x302a4c(++_0x122ef9);}(_0x51c5,0xc8));var _0x551c=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x51c5[_0x101e7b];return _0x4995c0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x551c('0x0'))(_0x551c('0x1'));var moment=require(_0x551c('0x2'));var BPromise=require(_0x551c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x551c('0x4'));var rimraf=require(_0x551c('0x5'));var config=require(_0x551c('0x6'));var attributes=require(_0x551c('0x7'));var integrations=require(_0x551c('0x8'));module[_0x551c('0x9')]=function(_0x532235,_0x1c5309){return _0x532235[_0x551c('0xa')](_0x551c('0xb'),attributes,{'tableName':_0x551c('0xc'),'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 b2f2360..62dc158 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 _0x60ba=['../../config/environment','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','SugarcrmAccount','options','raw','attributes','limit','include','model','map','GetSugarcrmAccount','ShowSugarcrmAccount','find','where','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3d3379,_0x4c9bc1){var _0x358633=function(_0x54510c){while(--_0x54510c){_0x3d3379['push'](_0x3d3379['shift']());}};_0x358633(++_0x4c9bc1);}(_0x60ba,0x160));var _0xa60b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x60ba[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xa60b('0x0'));var util=require(_0xa60b('0x1'));var moment=require('moment');var BPromise=require(_0xa60b('0x2'));var rs=require(_0xa60b('0x3'));var fs=require('fs');var Redis=require(_0xa60b('0x4'));var db=require(_0xa60b('0x5'))['db'];var utils=require(_0xa60b('0x6'));var logger=require(_0xa60b('0x7'))('rpc');var config=require(_0xa60b('0x8'));var jayson=require(_0xa60b('0x9'));var client=jayson['client'][_0xa60b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22997f,_0x3ab1aa,_0x25b6eb){return new BPromise(function(_0x4d3155,_0x1690be){return client[_0xa60b('0xb')](_0x22997f,_0x25b6eb)[_0xa60b('0xc')](function(_0x1a61da){logger[_0xa60b('0xd')](_0xa60b('0xe'),_0x3ab1aa,'request\x20sent');logger[_0xa60b('0xf')](_0xa60b('0x10'),_0x3ab1aa,_0xa60b('0x11'),JSON[_0xa60b('0x12')](_0x1a61da));if(_0x1a61da['error']){if(_0x1a61da['error'][_0xa60b('0x13')]===0x1f4){logger[_0xa60b('0x14')](_0xa60b('0xe'),_0x3ab1aa,_0x1a61da['error'][_0xa60b('0x15')]);return _0x1690be(_0x1a61da[_0xa60b('0x14')][_0xa60b('0x15')]);}logger[_0xa60b('0x14')](_0xa60b('0xe'),_0x3ab1aa,_0x1a61da[_0xa60b('0x14')][_0xa60b('0x15')]);return _0x4d3155(_0x1a61da[_0xa60b('0x14')][_0xa60b('0x15')]);}else{logger['info'](_0xa60b('0xe'),_0x3ab1aa,_0xa60b('0x11'));_0x4d3155(_0x1a61da[_0xa60b('0x16')][_0xa60b('0x15')]);}})[_0xa60b('0x17')](function(_0x10f0b4){logger[_0xa60b('0x14')](_0xa60b('0xe'),_0x3ab1aa,_0x10f0b4);_0x1690be(_0x10f0b4);});});}exports['GetSugarcrmAccount']=function(_0x480262){var _0x177d92=this;return new Promise(function(_0x4f70a1,_0x550e2c){return db[_0xa60b('0x18')]['findAll']({'raw':_0x480262[_0xa60b('0x19')]?_0x480262[_0xa60b('0x19')][_0xa60b('0x1a')]===undefined?!![]:![]:!![],'where':_0x480262['options']?_0x480262['options']['where']||null:null,'attributes':_0x480262[_0xa60b('0x19')]?_0x480262['options'][_0xa60b('0x1b')]||null:null,'limit':_0x480262[_0xa60b('0x19')]?_0x480262['options'][_0xa60b('0x1c')]||null:null,'include':_0x480262[_0xa60b('0x19')]?_0x480262[_0xa60b('0x19')][_0xa60b('0x1d')]?_['map'](_0x480262[_0xa60b('0x19')]['include'],function(_0x197ae2){return{'model':db[_0x197ae2[_0xa60b('0x1e')]],'as':_0x197ae2['as'],'attributes':_0x197ae2['attributes'],'include':_0x197ae2['include']?_[_0xa60b('0x1f')](_0x197ae2[_0xa60b('0x1d')],function(_0x593e17){return{'model':db[_0x593e17[_0xa60b('0x1e')]],'as':_0x593e17['as'],'attributes':_0x593e17[_0xa60b('0x1b')],'include':_0x593e17['include']?_['map'](_0x593e17[_0xa60b('0x1d')],function(_0x5a5a13){return{'model':db[_0x5a5a13[_0xa60b('0x1e')]],'as':_0x5a5a13['as'],'attributes':_0x5a5a13['attributes']};}):[]};}):[]};}):[]:[]})[_0xa60b('0xc')](function(_0x50fe45){logger[_0xa60b('0xd')](_0xa60b('0x20'),_0x480262);logger[_0xa60b('0xf')](_0xa60b('0x20'),_0x480262,JSON['stringify'](_0x50fe45));_0x4f70a1(_0x50fe45);})[_0xa60b('0x17')](function(_0x2abe6f){logger[_0xa60b('0x14')](_0xa60b('0x20'),_0x2abe6f[_0xa60b('0x15')],_0x480262);_0x550e2c(_0x177d92[_0xa60b('0x14')](0x1f4,_0x2abe6f[_0xa60b('0x15')]));});});};exports[_0xa60b('0x21')]=function(_0x44b75b){var _0x28ac7b=this;return new Promise(function(_0x2f4b87,_0x24d4b6){return db[_0xa60b('0x18')][_0xa60b('0x22')]({'raw':_0x44b75b[_0xa60b('0x19')]?_0x44b75b[_0xa60b('0x19')][_0xa60b('0x1a')]===undefined?!![]:![]:!![],'where':_0x44b75b[_0xa60b('0x19')]?_0x44b75b['options'][_0xa60b('0x23')]||null:null,'attributes':_0x44b75b[_0xa60b('0x19')]?_0x44b75b['options'][_0xa60b('0x1b')]||null:null,'include':_0x44b75b[_0xa60b('0x19')]?_0x44b75b['options'][_0xa60b('0x1d')]?_[_0xa60b('0x1f')](_0x44b75b[_0xa60b('0x19')][_0xa60b('0x1d')],function(_0x20b694){return{'model':db[_0x20b694[_0xa60b('0x1e')]],'as':_0x20b694['as'],'attributes':_0x20b694[_0xa60b('0x1b')],'include':_0x20b694['include']?_[_0xa60b('0x1f')](_0x20b694[_0xa60b('0x1d')],function(_0x252ae8){return{'model':db[_0x252ae8[_0xa60b('0x1e')]],'as':_0x252ae8['as'],'attributes':_0x252ae8[_0xa60b('0x1b')],'include':_0x252ae8[_0xa60b('0x1d')]?_[_0xa60b('0x1f')](_0x252ae8['include'],function(_0x4995ae){return{'model':db[_0x4995ae['model']],'as':_0x4995ae['as'],'attributes':_0x4995ae[_0xa60b('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x40ffe3){logger[_0xa60b('0xd')]('ShowSugarcrmAccount',_0x44b75b);logger[_0xa60b('0xf')](_0xa60b('0x21'),_0x44b75b,JSON['stringify'](_0x40ffe3));_0x2f4b87(_0x40ffe3);})[_0xa60b('0x17')](function(_0x49d8a9){logger['error'](_0xa60b('0x21'),_0x49d8a9[_0xa60b('0x15')],_0x44b75b);_0x24d4b6(_0x28ac7b[_0xa60b('0x14')](0x1f4,_0x49d8a9['message']));});});}; \ No newline at end of file +var _0x9f25=['where','attributes','limit','include','map','model','GetSugarcrmAccount','stringify','ShowSugarcrmAccount','find','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','SugarcrmAccount,\x20%s,\x20%s','message','catch','findAll','options','raw'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9f25,0x1a2));var _0x59f2=function(_0x4ebdf4,_0x57d47f){_0x4ebdf4=_0x4ebdf4-0x0;var _0x18d1c1=_0x9f25[_0x4ebdf4];return _0x18d1c1;};'use strict';var _=require(_0x59f2('0x0'));var util=require(_0x59f2('0x1'));var moment=require(_0x59f2('0x2'));var BPromise=require('bluebird');var rs=require(_0x59f2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59f2('0x4'))['db'];var utils=require(_0x59f2('0x5'));var logger=require(_0x59f2('0x6'))('rpc');var config=require(_0x59f2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x59f2('0x8')][_0x59f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ee826,_0x191c7f,_0x301eb4){return new BPromise(function(_0x1ab9a3,_0x540f88){return client[_0x59f2('0xa')](_0x2ee826,_0x301eb4)[_0x59f2('0xb')](function(_0xbebe03){logger[_0x59f2('0xc')]('SugarcrmAccount,\x20%s,\x20%s',_0x191c7f,_0x59f2('0xd'));logger[_0x59f2('0xe')](_0x59f2('0xf'),_0x191c7f,_0x59f2('0xd'),JSON['stringify'](_0xbebe03));if(_0xbebe03[_0x59f2('0x10')]){if(_0xbebe03[_0x59f2('0x10')][_0x59f2('0x11')]===0x1f4){logger[_0x59f2('0x10')](_0x59f2('0x12'),_0x191c7f,_0xbebe03[_0x59f2('0x10')][_0x59f2('0x13')]);return _0x540f88(_0xbebe03[_0x59f2('0x10')][_0x59f2('0x13')]);}logger[_0x59f2('0x10')](_0x59f2('0x12'),_0x191c7f,_0xbebe03[_0x59f2('0x10')][_0x59f2('0x13')]);return _0x1ab9a3(_0xbebe03['error'][_0x59f2('0x13')]);}else{logger[_0x59f2('0xc')](_0x59f2('0x12'),_0x191c7f,_0x59f2('0xd'));_0x1ab9a3(_0xbebe03['result'][_0x59f2('0x13')]);}})[_0x59f2('0x14')](function(_0x21f286){logger[_0x59f2('0x10')](_0x59f2('0x12'),_0x191c7f,_0x21f286);_0x540f88(_0x21f286);});});}exports['GetSugarcrmAccount']=function(_0x5802b4){var _0x84f378=this;return new Promise(function(_0x44e878,_0x1629c5){return db['SugarcrmAccount'][_0x59f2('0x15')]({'raw':_0x5802b4[_0x59f2('0x16')]?_0x5802b4[_0x59f2('0x16')][_0x59f2('0x17')]===undefined?!![]:![]:!![],'where':_0x5802b4['options']?_0x5802b4[_0x59f2('0x16')][_0x59f2('0x18')]||null:null,'attributes':_0x5802b4[_0x59f2('0x16')]?_0x5802b4['options'][_0x59f2('0x19')]||null:null,'limit':_0x5802b4[_0x59f2('0x16')]?_0x5802b4[_0x59f2('0x16')][_0x59f2('0x1a')]||null:null,'include':_0x5802b4[_0x59f2('0x16')]?_0x5802b4['options'][_0x59f2('0x1b')]?_[_0x59f2('0x1c')](_0x5802b4[_0x59f2('0x16')]['include'],function(_0x5a4582){return{'model':db[_0x5a4582[_0x59f2('0x1d')]],'as':_0x5a4582['as'],'attributes':_0x5a4582[_0x59f2('0x19')],'include':_0x5a4582[_0x59f2('0x1b')]?_[_0x59f2('0x1c')](_0x5a4582[_0x59f2('0x1b')],function(_0xdb0d9a){return{'model':db[_0xdb0d9a[_0x59f2('0x1d')]],'as':_0xdb0d9a['as'],'attributes':_0xdb0d9a[_0x59f2('0x19')],'include':_0xdb0d9a[_0x59f2('0x1b')]?_[_0x59f2('0x1c')](_0xdb0d9a[_0x59f2('0x1b')],function(_0x3cd973){return{'model':db[_0x3cd973[_0x59f2('0x1d')]],'as':_0x3cd973['as'],'attributes':_0x3cd973['attributes']};}):[]};}):[]};}):[]:[]})[_0x59f2('0xb')](function(_0x5e10bd){logger[_0x59f2('0xc')]('GetSugarcrmAccount',_0x5802b4);logger['debug'](_0x59f2('0x1e'),_0x5802b4,JSON[_0x59f2('0x1f')](_0x5e10bd));_0x44e878(_0x5e10bd);})[_0x59f2('0x14')](function(_0x543656){logger[_0x59f2('0x10')](_0x59f2('0x1e'),_0x543656[_0x59f2('0x13')],_0x5802b4);_0x1629c5(_0x84f378[_0x59f2('0x10')](0x1f4,_0x543656[_0x59f2('0x13')]));});});};exports[_0x59f2('0x20')]=function(_0x5ca69e){var _0x4e93b4=this;return new Promise(function(_0xf9a16b,_0xe09178){return db['SugarcrmAccount'][_0x59f2('0x21')]({'raw':_0x5ca69e[_0x59f2('0x16')]?_0x5ca69e[_0x59f2('0x16')][_0x59f2('0x17')]===undefined?!![]:![]:!![],'where':_0x5ca69e['options']?_0x5ca69e[_0x59f2('0x16')][_0x59f2('0x18')]||null:null,'attributes':_0x5ca69e[_0x59f2('0x16')]?_0x5ca69e[_0x59f2('0x16')][_0x59f2('0x19')]||null:null,'include':_0x5ca69e[_0x59f2('0x16')]?_0x5ca69e[_0x59f2('0x16')][_0x59f2('0x1b')]?_[_0x59f2('0x1c')](_0x5ca69e[_0x59f2('0x16')][_0x59f2('0x1b')],function(_0x2ddfe9){return{'model':db[_0x2ddfe9[_0x59f2('0x1d')]],'as':_0x2ddfe9['as'],'attributes':_0x2ddfe9[_0x59f2('0x19')],'include':_0x2ddfe9[_0x59f2('0x1b')]?_[_0x59f2('0x1c')](_0x2ddfe9[_0x59f2('0x1b')],function(_0x4e42a2){return{'model':db[_0x4e42a2[_0x59f2('0x1d')]],'as':_0x4e42a2['as'],'attributes':_0x4e42a2[_0x59f2('0x19')],'include':_0x4e42a2['include']?_['map'](_0x4e42a2[_0x59f2('0x1b')],function(_0x575785){return{'model':db[_0x575785['model']],'as':_0x575785['as'],'attributes':_0x575785[_0x59f2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x59f2('0xb')](function(_0x4c887){logger['info'](_0x59f2('0x20'),_0x5ca69e);logger[_0x59f2('0xe')](_0x59f2('0x20'),_0x5ca69e,JSON[_0x59f2('0x1f')](_0x4c887));_0xf9a16b(_0x4c887);})[_0x59f2('0x14')](function(_0x1228d6){logger[_0x59f2('0x10')](_0x59f2('0x20'),_0x1228d6['message'],_0x5ca69e);_0xe09178(_0x4e93b4[_0x59f2('0x10')](0x1f4,_0x1228d6[_0x59f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 088855c..39a2d4d 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 _0x17b4=['express','Router','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','multer','path'];(function(_0x4ebd2f,_0x109629){var _0x1c0650=function(_0xc2a4e9){while(--_0xc2a4e9){_0x4ebd2f['push'](_0x4ebd2f['shift']());}};_0x1c0650(++_0x109629);}(_0x17b4,0x1b6));var _0x417b=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x17b4[_0x543084];return _0x306a57;};'use strict';var multer=require(_0x417b('0x0'));var util=require('util');var path=require(_0x417b('0x1'));var timeout=require('connect-timeout');var express=require(_0x417b('0x2'));var router=express[_0x417b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x417b('0x4'));var config=require(_0x417b('0x5'));var controller=require(_0x417b('0x6'));router[_0x417b('0x7')]('/',auth[_0x417b('0x8')](),controller[_0x417b('0x9')]);router[_0x417b('0x7')](_0x417b('0xa'),auth[_0x417b('0x8')](),controller[_0x417b('0xb')]);router['get'](_0x417b('0xc'),auth[_0x417b('0x8')](),controller[_0x417b('0xd')]);router['get'](_0x417b('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x417b('0x7')](_0x417b('0xf'),auth[_0x417b('0x8')](),controller[_0x417b('0x10')]);router['post']('/',auth[_0x417b('0x8')](),controller['create']);router[_0x417b('0x11')](_0x417b('0xa'),auth['isAuthenticated'](),controller[_0x417b('0x12')]);router[_0x417b('0x13')](_0x417b('0xa'),auth['isAuthenticated'](),controller[_0x417b('0x14')]);module[_0x417b('0x15')]=router; \ No newline at end of file +var _0x7a88=['/:id/descriptions','post','create','put','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x1f6cbd,_0x1d755f){var _0x1c51f4=function(_0xe04964){while(--_0xe04964){_0x1f6cbd['push'](_0x1f6cbd['shift']());}};_0x1c51f4(++_0x1d755f);}(_0x7a88,0x1e6));var _0x87a8=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x7a88[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0x87a8('0x0'));var util=require(_0x87a8('0x1'));var path=require(_0x87a8('0x2'));var timeout=require(_0x87a8('0x3'));var express=require(_0x87a8('0x4'));var router=express[_0x87a8('0x5')]();var fs_extra=require(_0x87a8('0x6'));var auth=require(_0x87a8('0x7'));var interaction=require(_0x87a8('0x8'));var config=require('../../config/environment');var controller=require(_0x87a8('0x9'));router[_0x87a8('0xa')]('/',auth[_0x87a8('0xb')](),controller[_0x87a8('0xc')]);router[_0x87a8('0xa')](_0x87a8('0xd'),auth[_0x87a8('0xb')](),controller['show']);router[_0x87a8('0xa')](_0x87a8('0xe'),auth[_0x87a8('0xb')](),controller[_0x87a8('0xf')]);router[_0x87a8('0xa')](_0x87a8('0x10'),auth[_0x87a8('0xb')](),controller[_0x87a8('0x11')]);router[_0x87a8('0xa')](_0x87a8('0x12'),auth[_0x87a8('0xb')](),controller['getDescriptions']);router[_0x87a8('0x13')]('/',auth['isAuthenticated'](),controller[_0x87a8('0x14')]);router[_0x87a8('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x87a8('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x87a8('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 53a13ed..1e045c5 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 _0x05c5=['exports','STRING'];(function(_0x2efccf,_0x6d7311){var _0x433d78=function(_0xc68641){while(--_0xc68641){_0x2efccf['push'](_0x2efccf['shift']());}};_0x433d78(++_0x6d7311);}(_0x05c5,0x198));var _0x505c=function(_0xa69592,_0x571583){_0xa69592=_0xa69592-0x0;var _0x4c5ec5=_0x05c5[_0xa69592];return _0x4c5ec5;};'use strict';var Sequelize=require('sequelize');module[_0x505c('0x0')]={'name':{'type':Sequelize[_0x505c('0x1')]},'description':{'type':Sequelize[_0x505c('0x1')]}}; \ No newline at end of file +var _0xe3e4=['exports','STRING'];(function(_0x2e2680,_0x403467){var _0x53cdbb=function(_0x456253){while(--_0x456253){_0x2e2680['push'](_0x2e2680['shift']());}};_0x53cdbb(++_0x403467);}(_0xe3e4,0x92));var _0x4e3e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe3e4[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x4e3e('0x0')]={'name':{'type':Sequelize[_0x4e3e('0x1')]},'description':{'type':Sequelize[_0x4e3e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index c44e1af..45cfb2a 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 _0x12b5=['index','map','SugarcrmConfiguration','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','catch','show','params','keys','rawAttributes','length','include','create','body','find','getFields','SugarcrmField','getSubjects','findOne','nolimit','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','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','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send'];(function(_0x101525,_0x31d3e3){var _0x5d5f44=function(_0xd81e33){while(--_0xd81e33){_0x101525['push'](_0x101525['shift']());}};_0x5d5f44(++_0x31d3e3);}(_0x12b5,0xc8));var _0x512b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x12b5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x512b('0x0'));var rimraf=require(_0x512b('0x1'));var zipdir=require(_0x512b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x512b('0x3'));var moment=require('moment');var BPromise=require(_0x512b('0x4'));var Mustache=require('mustache');var util=require(_0x512b('0x5'));var path=require(_0x512b('0x6'));var sox=require(_0x512b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x512b('0x8'));var _=require(_0x512b('0x9'));var squel=require(_0x512b('0xa'));var crypto=require('crypto');var jsforce=require(_0x512b('0xb'));var deskjs=require(_0x512b('0xc'));var toCsv=require(_0x512b('0xd'));var querystring=require(_0x512b('0xe'));var Papa=require(_0x512b('0xf'));var Redis=require(_0x512b('0x10'));var authService=require(_0x512b('0x11'));var qs=require(_0x512b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x512b('0x13'));var logger=require(_0x512b('0x14'))(_0x512b('0x15'));var utils=require(_0x512b('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x512b('0x17'))['db'];function respondWithStatusCode(_0x41310d,_0x49705e){_0x49705e=_0x49705e||0xcc;return function(_0x534041){if(_0x534041){return _0x41310d[_0x512b('0x18')](_0x49705e);}return _0x41310d[_0x512b('0x19')](_0x49705e)[_0x512b('0x1a')]();};}function respondWithResult(_0x45fde6,_0x22dce5){_0x22dce5=_0x22dce5||0xc8;return function(_0x3b2e57){if(_0x3b2e57){return _0x45fde6[_0x512b('0x19')](_0x22dce5)[_0x512b('0x1b')](_0x3b2e57);}};}function respondWithFilteredResult(_0x1ecbab,_0x3a06b6){return function(_0x4d1c96){if(_0x4d1c96){var _0x429c86=typeof _0x3a06b6[_0x512b('0x1c')]==='undefined'&&typeof _0x3a06b6[_0x512b('0x1d')]===_0x512b('0x1e');var _0x5b8f0e=_0x4d1c96[_0x512b('0x1f')];var _0x4fcf3c=_0x429c86?0x0:_0x3a06b6[_0x512b('0x1c')];var _0x64ae02=_0x429c86?_0x4d1c96[_0x512b('0x1f')]:_0x3a06b6['offset']+_0x3a06b6[_0x512b('0x1d')];var _0x15f114;if(_0x64ae02>=_0x5b8f0e){_0x64ae02=_0x5b8f0e;_0x15f114=0xc8;}else{_0x15f114=0xce;}_0x1ecbab['status'](_0x15f114);return _0x1ecbab[_0x512b('0x20')](_0x512b('0x21'),_0x4fcf3c+'-'+_0x64ae02+'/'+_0x5b8f0e)[_0x512b('0x1b')](_0x4d1c96);}return null;};}function patchUpdates(_0x56300b){return function(_0x3dfd60){try{jsonpatch['apply'](_0x3dfd60,_0x56300b,!![]);}catch(_0x27ff97){return BPromise[_0x512b('0x22')](_0x27ff97);}return _0x3dfd60[_0x512b('0x23')]();};}function saveUpdates(_0x28bca3,_0x155da1){return function(_0x164be3){if(_0x164be3){return _0x164be3[_0x512b('0x24')](_0x28bca3)[_0x512b('0x25')](function(_0x362f2c){return _0x362f2c;});}return null;};}function removeEntity(_0x1bcdaa,_0x27ef9f){return function(_0x2644dd){if(_0x2644dd){return _0x2644dd[_0x512b('0x26')]()['then'](function(){_0x1bcdaa[_0x512b('0x19')](0xcc)[_0x512b('0x1a')]();});}};}function handleEntityNotFound(_0xbc9d28,_0x4af69c){return function(_0x24c88e){if(!_0x24c88e){_0xbc9d28[_0x512b('0x18')](0x194);}return _0x24c88e;};}function handleError(_0xa177e7,_0x48f9ea){_0x48f9ea=_0x48f9ea||0x1f4;return function(_0x47111c){logger[_0x512b('0x27')](_0x47111c[_0x512b('0x28')]);if(_0x47111c[_0x512b('0x29')]){delete _0x47111c[_0x512b('0x29')];}_0xa177e7[_0x512b('0x19')](_0x48f9ea)[_0x512b('0x2a')](_0x47111c);};}exports[_0x512b('0x2b')]=function(_0x1b5f50,_0xa64db){var _0x520d5f={},_0x36ac37={},_0x393494={'count':0x0,'rows':[]};var _0x42fa2e=_[_0x512b('0x2c')](db[_0x512b('0x2d')]['rawAttributes'],function(_0x14d0f8){return{'name':_0x14d0f8[_0x512b('0x2e')],'type':_0x14d0f8[_0x512b('0x2f')][_0x512b('0x30')]};});_0x36ac37[_0x512b('0x31')]=_[_0x512b('0x2c')](_0x42fa2e,_0x512b('0x29'));_0x36ac37[_0x512b('0x32')]=_['keys'](_0x1b5f50[_0x512b('0x32')]);_0x36ac37[_0x512b('0x33')]=_[_0x512b('0x34')](_0x36ac37['model'],_0x36ac37[_0x512b('0x32')]);_0x520d5f['attributes']=_[_0x512b('0x34')](_0x36ac37[_0x512b('0x31')],qs[_0x512b('0x35')](_0x1b5f50[_0x512b('0x32')]['fields']));_0x520d5f[_0x512b('0x36')]=_0x520d5f['attributes']['length']?_0x520d5f[_0x512b('0x36')]:_0x36ac37[_0x512b('0x31')];if(!_0x1b5f50['query'][_0x512b('0x37')]('nolimit')){_0x520d5f['limit']=qs[_0x512b('0x1d')](_0x1b5f50[_0x512b('0x32')]['limit']);_0x520d5f[_0x512b('0x1c')]=qs['offset'](_0x1b5f50['query'][_0x512b('0x1c')]);}_0x520d5f[_0x512b('0x38')]=qs[_0x512b('0x39')](_0x1b5f50[_0x512b('0x32')][_0x512b('0x39')]);_0x520d5f['where']=qs[_0x512b('0x33')](_[_0x512b('0x3a')](_0x1b5f50[_0x512b('0x32')],_0x36ac37[_0x512b('0x33')]),_0x42fa2e);if(_0x1b5f50['query'][_0x512b('0x3b')]){_0x520d5f['where']=_[_0x512b('0x3c')](_0x520d5f[_0x512b('0x3d')],{'$or':_[_0x512b('0x2c')](_0x42fa2e,function(_0x28cfad){if(_0x28cfad[_0x512b('0x2f')]!==_0x512b('0x3e')){var _0x530c62={};_0x530c62[_0x28cfad['name']]={'$like':'%'+_0x1b5f50['query']['filter']+'%'};return _0x530c62;}})});}_0x520d5f=_[_0x512b('0x3c')]({},_0x520d5f,_0x1b5f50[_0x512b('0x3f')]);var _0x4293e5={'where':_0x520d5f[_0x512b('0x3d')]};return db[_0x512b('0x2d')][_0x512b('0x1f')](_0x4293e5)[_0x512b('0x25')](function(_0x415122){_0x393494[_0x512b('0x1f')]=_0x415122;if(_0x1b5f50[_0x512b('0x32')][_0x512b('0x40')]){_0x520d5f['include']=[{'all':!![]}];}return db[_0x512b('0x2d')]['findAll'](_0x520d5f);})[_0x512b('0x25')](function(_0xfb18db){_0x393494['rows']=_0xfb18db;return _0x393494;})[_0x512b('0x25')](respondWithFilteredResult(_0xa64db,_0x520d5f))[_0x512b('0x41')](handleError(_0xa64db,null));};exports[_0x512b('0x42')]=function(_0x3277f2,_0x22694e){var _0x277381={'raw':![],'where':{'id':_0x3277f2[_0x512b('0x43')]['id']}},_0x289c68={};_0x289c68['model']=_[_0x512b('0x44')](db['SugarcrmConfiguration'][_0x512b('0x45')]);_0x289c68[_0x512b('0x32')]=_[_0x512b('0x44')](_0x3277f2['query']);_0x289c68[_0x512b('0x33')]=_['intersection'](_0x289c68[_0x512b('0x31')],_0x289c68[_0x512b('0x32')]);_0x277381[_0x512b('0x36')]=_['intersection'](_0x289c68[_0x512b('0x31')],qs[_0x512b('0x35')](_0x3277f2[_0x512b('0x32')]['fields']));_0x277381['attributes']=_0x277381['attributes'][_0x512b('0x46')]?_0x277381[_0x512b('0x36')]:_0x289c68[_0x512b('0x31')];if(_0x3277f2[_0x512b('0x32')][_0x512b('0x40')]){_0x277381[_0x512b('0x47')]=[{'all':!![]}];}_0x277381=_[_0x512b('0x3c')]({},_0x277381,_0x3277f2['options']);return db[_0x512b('0x2d')]['find'](_0x277381)['then'](handleEntityNotFound(_0x22694e,null))[_0x512b('0x25')](respondWithResult(_0x22694e,null))[_0x512b('0x41')](handleError(_0x22694e,null));};exports[_0x512b('0x48')]=function(_0x2f6ff9,_0x31ca81){return db[_0x512b('0x2d')]['create'](_0x2f6ff9[_0x512b('0x49')],{})[_0x512b('0x25')](respondWithResult(_0x31ca81,0xc9))[_0x512b('0x41')](handleError(_0x31ca81,null));};exports[_0x512b('0x24')]=function(_0x15a564,_0xb88610){if(_0x15a564[_0x512b('0x49')]['id']){delete _0x15a564[_0x512b('0x49')]['id'];}return db[_0x512b('0x2d')][_0x512b('0x4a')]({'where':{'id':_0x15a564[_0x512b('0x43')]['id']}})[_0x512b('0x25')](handleEntityNotFound(_0xb88610,null))['then'](saveUpdates(_0x15a564[_0x512b('0x49')],null))[_0x512b('0x25')](respondWithResult(_0xb88610,null))[_0x512b('0x41')](handleError(_0xb88610,null));};exports[_0x512b('0x26')]=function(_0x58fdaa,_0x45162c){return db[_0x512b('0x2d')][_0x512b('0x4a')]({'where':{'id':_0x58fdaa[_0x512b('0x43')]['id']}})[_0x512b('0x25')](handleEntityNotFound(_0x45162c,null))[_0x512b('0x25')](removeEntity(_0x45162c,null))['catch'](handleError(_0x45162c,null));};exports[_0x512b('0x4b')]=function(_0x3157ee,_0x162a01,_0x2db32a){var _0x3035fb={};var _0x5e0a20={};var _0x45c817;var _0x2398f6;return db[_0x512b('0x2d')]['findOne']({'where':{'id':_0x3157ee[_0x512b('0x43')]['id']}})[_0x512b('0x25')](handleEntityNotFound(_0x162a01,null))['then'](function(_0x56186f){if(_0x56186f){_0x45c817=_0x56186f;_0x5e0a20[_0x512b('0x31')]=_[_0x512b('0x44')](db[_0x512b('0x4c')][_0x512b('0x45')]);_0x5e0a20[_0x512b('0x32')]=_[_0x512b('0x44')](_0x3157ee[_0x512b('0x32')]);_0x5e0a20[_0x512b('0x33')]=_[_0x512b('0x34')](_0x5e0a20[_0x512b('0x31')],_0x5e0a20['query']);_0x3035fb[_0x512b('0x36')]=_['intersection'](_0x5e0a20['model'],qs['fields'](_0x3157ee[_0x512b('0x32')][_0x512b('0x35')]));_0x3035fb[_0x512b('0x36')]=_0x3035fb['attributes']['length']?_0x3035fb[_0x512b('0x36')]:_0x5e0a20[_0x512b('0x31')];_0x3035fb[_0x512b('0x38')]=qs['sort'](_0x3157ee[_0x512b('0x32')][_0x512b('0x39')]);_0x3035fb['where']=qs[_0x512b('0x33')](_['pick'](_0x3157ee[_0x512b('0x32')],_0x5e0a20[_0x512b('0x33')]));if(_0x3157ee['query'][_0x512b('0x3b')]){_0x3035fb[_0x512b('0x3d')]=_[_0x512b('0x3c')](_0x3035fb[_0x512b('0x3d')],{'$or':_[_0x512b('0x2c')](_0x3035fb['attributes'],function(_0x1c063a){var _0x276f5c={};_0x276f5c[_0x1c063a]={'$like':'%'+_0x3157ee[_0x512b('0x32')]['filter']+'%'};return _0x276f5c;})});}_0x3035fb=_[_0x512b('0x3c')]({},_0x3035fb,_0x3157ee['options']);return _0x45c817[_0x512b('0x4b')](_0x3035fb);}})[_0x512b('0x25')](function(_0x46111b){if(_0x46111b){_0x2398f6=_0x46111b[_0x512b('0x46')];if(!_0x3157ee[_0x512b('0x32')]['hasOwnProperty']('nolimit')){_0x3035fb['limit']=qs[_0x512b('0x1d')](_0x3157ee[_0x512b('0x32')]['limit']);_0x3035fb['offset']=qs[_0x512b('0x1c')](_0x3157ee[_0x512b('0x32')][_0x512b('0x1c')]);}return _0x45c817['getFields'](_0x3035fb);}})[_0x512b('0x25')](function(_0x433c4c){if(_0x433c4c){return _0x433c4c?{'count':_0x2398f6,'rows':_0x433c4c}:null;}})[_0x512b('0x25')](respondWithResult(_0x162a01,null))[_0x512b('0x41')](handleError(_0x162a01,null));};exports[_0x512b('0x4d')]=function(_0x3f7c71,_0x465279,_0x5b7a69){var _0x37bf39={};var _0x1e61d9={};var _0x740bea;var _0x1d0051;return db['SugarcrmConfiguration'][_0x512b('0x4e')]({'where':{'id':_0x3f7c71['params']['id']}})[_0x512b('0x25')](handleEntityNotFound(_0x465279,null))[_0x512b('0x25')](function(_0x128cdd){if(_0x128cdd){_0x740bea=_0x128cdd;_0x1e61d9[_0x512b('0x31')]=_['keys'](db[_0x512b('0x4c')][_0x512b('0x45')]);_0x1e61d9['query']=_[_0x512b('0x44')](_0x3f7c71[_0x512b('0x32')]);_0x1e61d9['filters']=_[_0x512b('0x34')](_0x1e61d9['model'],_0x1e61d9['query']);_0x37bf39['attributes']=_[_0x512b('0x34')](_0x1e61d9['model'],qs[_0x512b('0x35')](_0x3f7c71[_0x512b('0x32')]['fields']));_0x37bf39[_0x512b('0x36')]=_0x37bf39[_0x512b('0x36')]['length']?_0x37bf39[_0x512b('0x36')]:_0x1e61d9['model'];_0x37bf39[_0x512b('0x38')]=qs[_0x512b('0x39')](_0x3f7c71[_0x512b('0x32')][_0x512b('0x39')]);_0x37bf39[_0x512b('0x3d')]=qs[_0x512b('0x33')](_[_0x512b('0x3a')](_0x3f7c71[_0x512b('0x32')],_0x1e61d9[_0x512b('0x33')]));if(_0x3f7c71['query'][_0x512b('0x3b')]){_0x37bf39['where']=_[_0x512b('0x3c')](_0x37bf39[_0x512b('0x3d')],{'$or':_[_0x512b('0x2c')](_0x37bf39[_0x512b('0x36')],function(_0x3be517){var _0x534575={};_0x534575[_0x3be517]={'$like':'%'+_0x3f7c71['query'][_0x512b('0x3b')]+'%'};return _0x534575;})});}_0x37bf39=_[_0x512b('0x3c')]({},_0x37bf39,_0x3f7c71['options']);return _0x740bea[_0x512b('0x4d')](_0x37bf39);}})[_0x512b('0x25')](function(_0x19434a){if(_0x19434a){_0x1d0051=_0x19434a[_0x512b('0x46')];if(!_0x3f7c71[_0x512b('0x32')][_0x512b('0x37')](_0x512b('0x4f'))){_0x37bf39[_0x512b('0x1d')]=qs[_0x512b('0x1d')](_0x3f7c71[_0x512b('0x32')][_0x512b('0x1d')]);_0x37bf39[_0x512b('0x1c')]=qs['offset'](_0x3f7c71[_0x512b('0x32')][_0x512b('0x1c')]);}return _0x740bea[_0x512b('0x4d')](_0x37bf39);}})[_0x512b('0x25')](function(_0x23cb45){if(_0x23cb45){return _0x23cb45?{'count':_0x1d0051,'rows':_0x23cb45}:null;}})[_0x512b('0x25')](respondWithResult(_0x465279,null))[_0x512b('0x41')](handleError(_0x465279,null));};exports['getDescriptions']=function(_0x151489,_0x5a483e,_0x2dcdc3){var _0x4eb5f1={};var _0xbbdbba={};var _0x13f246;var _0x38d2e3;return db['SugarcrmConfiguration'][_0x512b('0x4e')]({'where':{'id':_0x151489[_0x512b('0x43')]['id']}})[_0x512b('0x25')](handleEntityNotFound(_0x5a483e,null))[_0x512b('0x25')](function(_0x343f6a){if(_0x343f6a){_0x13f246=_0x343f6a;_0xbbdbba[_0x512b('0x31')]=_[_0x512b('0x44')](db['SugarcrmField'][_0x512b('0x45')]);_0xbbdbba[_0x512b('0x32')]=_['keys'](_0x151489[_0x512b('0x32')]);_0xbbdbba[_0x512b('0x33')]=_[_0x512b('0x34')](_0xbbdbba[_0x512b('0x31')],_0xbbdbba['query']);_0x4eb5f1[_0x512b('0x36')]=_['intersection'](_0xbbdbba[_0x512b('0x31')],qs[_0x512b('0x35')](_0x151489[_0x512b('0x32')][_0x512b('0x35')]));_0x4eb5f1[_0x512b('0x36')]=_0x4eb5f1['attributes'][_0x512b('0x46')]?_0x4eb5f1[_0x512b('0x36')]:_0xbbdbba[_0x512b('0x31')];_0x4eb5f1['order']=qs[_0x512b('0x39')](_0x151489[_0x512b('0x32')]['sort']);_0x4eb5f1[_0x512b('0x3d')]=qs['filters'](_[_0x512b('0x3a')](_0x151489[_0x512b('0x32')],_0xbbdbba[_0x512b('0x33')]));if(_0x151489['query'][_0x512b('0x3b')]){_0x4eb5f1[_0x512b('0x3d')]=_[_0x512b('0x3c')](_0x4eb5f1[_0x512b('0x3d')],{'$or':_[_0x512b('0x2c')](_0x4eb5f1['attributes'],function(_0x1f9a9a){var _0x408a7a={};_0x408a7a[_0x1f9a9a]={'$like':'%'+_0x151489[_0x512b('0x32')]['filter']+'%'};return _0x408a7a;})});}_0x4eb5f1=_[_0x512b('0x3c')]({},_0x4eb5f1,_0x151489['options']);return _0x13f246[_0x512b('0x50')](_0x4eb5f1);}})[_0x512b('0x25')](function(_0xfa6c63){if(_0xfa6c63){_0x38d2e3=_0xfa6c63[_0x512b('0x46')];if(!_0x151489['query'][_0x512b('0x37')](_0x512b('0x4f'))){_0x4eb5f1[_0x512b('0x1d')]=qs[_0x512b('0x1d')](_0x151489[_0x512b('0x32')][_0x512b('0x1d')]);_0x4eb5f1[_0x512b('0x1c')]=qs[_0x512b('0x1c')](_0x151489[_0x512b('0x32')][_0x512b('0x1c')]);}return _0x13f246['getDescriptions'](_0x4eb5f1);}})[_0x512b('0x25')](function(_0x35f016){if(_0x35f016){return _0x35f016?{'count':_0x38d2e3,'rows':_0x35f016}:null;}})[_0x512b('0x25')](respondWithResult(_0x5a483e,null))[_0x512b('0x41')](handleError(_0x5a483e,null));}; \ No newline at end of file +var _0xa4fe=['offset','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','type','key','model','query','filters','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','keys','intersection','fields','options','find','create','body','destroy','params','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit'];(function(_0x262f47,_0x300945){var _0x557f7c=function(_0x8988d0){while(--_0x8988d0){_0x262f47['push'](_0x262f47['shift']());}};_0x557f7c(++_0x300945);}(_0xa4fe,0x12f));var _0xea4f=function(_0x323201,_0x26a3e7){_0x323201=_0x323201-0x0;var _0x3e4759=_0xa4fe[_0x323201];return _0x3e4759;};'use strict';var emlformat=require(_0xea4f('0x0'));var rimraf=require(_0xea4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xea4f('0x2'));var rp=require(_0xea4f('0x3'));var moment=require('moment');var BPromise=require(_0xea4f('0x4'));var Mustache=require(_0xea4f('0x5'));var util=require(_0xea4f('0x6'));var path=require('path');var sox=require(_0xea4f('0x7'));var csv=require(_0xea4f('0x8'));var ejs=require(_0xea4f('0x9'));var fs=require('fs');var fs_extra=require(_0xea4f('0xa'));var _=require(_0xea4f('0xb'));var squel=require(_0xea4f('0xc'));var crypto=require('crypto');var jsforce=require(_0xea4f('0xd'));var deskjs=require(_0xea4f('0xe'));var toCsv=require(_0xea4f('0x8'));var querystring=require(_0xea4f('0xf'));var Papa=require(_0xea4f('0x10'));var Redis=require(_0xea4f('0x11'));var authService=require(_0xea4f('0x12'));var qs=require(_0xea4f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xea4f('0x14'));var logger=require(_0xea4f('0x15'))(_0xea4f('0x16'));var utils=require(_0xea4f('0x17'));var config=require(_0xea4f('0x18'));var licenseUtil=require(_0xea4f('0x19'));var db=require(_0xea4f('0x1a'))['db'];function respondWithStatusCode(_0x4713fb,_0x4062f5){_0x4062f5=_0x4062f5||0xcc;return function(_0xf70853){if(_0xf70853){return _0x4713fb[_0xea4f('0x1b')](_0x4062f5);}return _0x4713fb[_0xea4f('0x1c')](_0x4062f5)[_0xea4f('0x1d')]();};}function respondWithResult(_0x688cbb,_0x58a661){_0x58a661=_0x58a661||0xc8;return function(_0x439eec){if(_0x439eec){return _0x688cbb[_0xea4f('0x1c')](_0x58a661)[_0xea4f('0x1e')](_0x439eec);}};}function respondWithFilteredResult(_0x11e416,_0x2e4d50){return function(_0x4e2bd5){if(_0x4e2bd5){var _0x55b1f8=typeof _0x2e4d50['offset']===_0xea4f('0x1f')&&typeof _0x2e4d50[_0xea4f('0x20')]===_0xea4f('0x1f');var _0x268e4f=_0x4e2bd5['count'];var _0x59566b=_0x55b1f8?0x0:_0x2e4d50[_0xea4f('0x21')];var _0x4a490d=_0x55b1f8?_0x4e2bd5['count']:_0x2e4d50[_0xea4f('0x21')]+_0x2e4d50[_0xea4f('0x20')];var _0x1f6545;if(_0x4a490d>=_0x268e4f){_0x4a490d=_0x268e4f;_0x1f6545=0xc8;}else{_0x1f6545=0xce;}_0x11e416[_0xea4f('0x1c')](_0x1f6545);return _0x11e416[_0xea4f('0x22')](_0xea4f('0x23'),_0x59566b+'-'+_0x4a490d+'/'+_0x268e4f)[_0xea4f('0x1e')](_0x4e2bd5);}return null;};}function patchUpdates(_0x3150fa){return function(_0x377ce5){try{jsonpatch[_0xea4f('0x24')](_0x377ce5,_0x3150fa,!![]);}catch(_0x23efa1){return BPromise[_0xea4f('0x25')](_0x23efa1);}return _0x377ce5[_0xea4f('0x26')]();};}function saveUpdates(_0x289ec1,_0x2b2360){return function(_0x2956fb){if(_0x2956fb){return _0x2956fb[_0xea4f('0x27')](_0x289ec1)[_0xea4f('0x28')](function(_0x2fcbe0){return _0x2fcbe0;});}return null;};}function removeEntity(_0x4b6ddc,_0x20d0cf){return function(_0x4e955a){if(_0x4e955a){return _0x4e955a['destroy']()[_0xea4f('0x28')](function(){_0x4b6ddc[_0xea4f('0x1c')](0xcc)[_0xea4f('0x1d')]();});}};}function handleEntityNotFound(_0x738c1a,_0x411700){return function(_0x2ddf65){if(!_0x2ddf65){_0x738c1a[_0xea4f('0x1b')](0x194);}return _0x2ddf65;};}function handleError(_0x3be9c7,_0x1b5b07){_0x1b5b07=_0x1b5b07||0x1f4;return function(_0x916cb1){logger['error'](_0x916cb1[_0xea4f('0x29')]);if(_0x916cb1[_0xea4f('0x2a')]){delete _0x916cb1[_0xea4f('0x2a')];}_0x3be9c7[_0xea4f('0x1c')](_0x1b5b07)[_0xea4f('0x2b')](_0x916cb1);};}exports[_0xea4f('0x2c')]=function(_0x19ea42,_0x3dbfa5){var _0x249d1f={},_0x390380={},_0x69b1d2={'count':0x0,'rows':[]};var _0x5bea02=_[_0xea4f('0x2d')](db[_0xea4f('0x2e')][_0xea4f('0x2f')],function(_0x472dc0){return{'name':_0x472dc0['fieldName'],'type':_0x472dc0[_0xea4f('0x30')][_0xea4f('0x31')]};});_0x390380[_0xea4f('0x32')]=_['map'](_0x5bea02,_0xea4f('0x2a'));_0x390380[_0xea4f('0x33')]=_['keys'](_0x19ea42['query']);_0x390380[_0xea4f('0x34')]=_['intersection'](_0x390380['model'],_0x390380[_0xea4f('0x33')]);_0x249d1f[_0xea4f('0x35')]=_['intersection'](_0x390380[_0xea4f('0x32')],qs['fields'](_0x19ea42[_0xea4f('0x33')]['fields']));_0x249d1f[_0xea4f('0x35')]=_0x249d1f[_0xea4f('0x35')][_0xea4f('0x36')]?_0x249d1f[_0xea4f('0x35')]:_0x390380[_0xea4f('0x32')];if(!_0x19ea42['query'][_0xea4f('0x37')](_0xea4f('0x38'))){_0x249d1f['limit']=qs[_0xea4f('0x20')](_0x19ea42[_0xea4f('0x33')][_0xea4f('0x20')]);_0x249d1f['offset']=qs['offset'](_0x19ea42[_0xea4f('0x33')]['offset']);}_0x249d1f[_0xea4f('0x39')]=qs[_0xea4f('0x3a')](_0x19ea42[_0xea4f('0x33')]['sort']);_0x249d1f['where']=qs['filters'](_[_0xea4f('0x3b')](_0x19ea42[_0xea4f('0x33')],_0x390380[_0xea4f('0x34')]),_0x5bea02);if(_0x19ea42[_0xea4f('0x33')][_0xea4f('0x3c')]){_0x249d1f[_0xea4f('0x3d')]=_[_0xea4f('0x3e')](_0x249d1f['where'],{'$or':_[_0xea4f('0x2d')](_0x5bea02,function(_0x189bc5){if(_0x189bc5['type']!==_0xea4f('0x3f')){var _0x1f5d42={};_0x1f5d42[_0x189bc5[_0xea4f('0x2a')]]={'$like':'%'+_0x19ea42[_0xea4f('0x33')]['filter']+'%'};return _0x1f5d42;}})});}_0x249d1f=_[_0xea4f('0x3e')]({},_0x249d1f,_0x19ea42['options']);var _0x460099={'where':_0x249d1f[_0xea4f('0x3d')]};return db['SugarcrmConfiguration'][_0xea4f('0x40')](_0x460099)[_0xea4f('0x28')](function(_0x4759c8){_0x69b1d2[_0xea4f('0x40')]=_0x4759c8;if(_0x19ea42[_0xea4f('0x33')][_0xea4f('0x41')]){_0x249d1f[_0xea4f('0x42')]=[{'all':!![]}];}return db[_0xea4f('0x2e')][_0xea4f('0x43')](_0x249d1f);})[_0xea4f('0x28')](function(_0x4b2a7e){_0x69b1d2[_0xea4f('0x44')]=_0x4b2a7e;return _0x69b1d2;})[_0xea4f('0x28')](respondWithFilteredResult(_0x3dbfa5,_0x249d1f))[_0xea4f('0x45')](handleError(_0x3dbfa5,null));};exports['show']=function(_0x5be72d,_0x558da2){var _0x3dfbb7={'raw':![],'where':{'id':_0x5be72d['params']['id']}},_0x23e97d={};_0x23e97d[_0xea4f('0x32')]=_[_0xea4f('0x46')](db[_0xea4f('0x2e')][_0xea4f('0x2f')]);_0x23e97d['query']=_[_0xea4f('0x46')](_0x5be72d[_0xea4f('0x33')]);_0x23e97d[_0xea4f('0x34')]=_[_0xea4f('0x47')](_0x23e97d[_0xea4f('0x32')],_0x23e97d[_0xea4f('0x33')]);_0x3dfbb7[_0xea4f('0x35')]=_['intersection'](_0x23e97d[_0xea4f('0x32')],qs[_0xea4f('0x48')](_0x5be72d[_0xea4f('0x33')][_0xea4f('0x48')]));_0x3dfbb7['attributes']=_0x3dfbb7[_0xea4f('0x35')][_0xea4f('0x36')]?_0x3dfbb7['attributes']:_0x23e97d['model'];if(_0x5be72d['query'][_0xea4f('0x41')]){_0x3dfbb7[_0xea4f('0x42')]=[{'all':!![]}];}_0x3dfbb7=_[_0xea4f('0x3e')]({},_0x3dfbb7,_0x5be72d[_0xea4f('0x49')]);return db[_0xea4f('0x2e')][_0xea4f('0x4a')](_0x3dfbb7)['then'](handleEntityNotFound(_0x558da2,null))[_0xea4f('0x28')](respondWithResult(_0x558da2,null))[_0xea4f('0x45')](handleError(_0x558da2,null));};exports['create']=function(_0x168649,_0x4abd27){return db[_0xea4f('0x2e')][_0xea4f('0x4b')](_0x168649[_0xea4f('0x4c')],{})[_0xea4f('0x28')](respondWithResult(_0x4abd27,0xc9))[_0xea4f('0x45')](handleError(_0x4abd27,null));};exports[_0xea4f('0x27')]=function(_0x5eebf8,_0x1075e4){if(_0x5eebf8[_0xea4f('0x4c')]['id']){delete _0x5eebf8[_0xea4f('0x4c')]['id'];}return db[_0xea4f('0x2e')][_0xea4f('0x4a')]({'where':{'id':_0x5eebf8['params']['id']}})[_0xea4f('0x28')](handleEntityNotFound(_0x1075e4,null))[_0xea4f('0x28')](saveUpdates(_0x5eebf8[_0xea4f('0x4c')],null))[_0xea4f('0x28')](respondWithResult(_0x1075e4,null))[_0xea4f('0x45')](handleError(_0x1075e4,null));};exports[_0xea4f('0x4d')]=function(_0x247b88,_0x3661a4){return db[_0xea4f('0x2e')][_0xea4f('0x4a')]({'where':{'id':_0x247b88[_0xea4f('0x4e')]['id']}})[_0xea4f('0x28')](handleEntityNotFound(_0x3661a4,null))['then'](removeEntity(_0x3661a4,null))[_0xea4f('0x45')](handleError(_0x3661a4,null));};exports[_0xea4f('0x4f')]=function(_0xc03549,_0x42560d,_0x40c0d8){var _0x40cab9={};var _0xe5af1c={};var _0x259f97;var _0x5905b4;return db[_0xea4f('0x2e')][_0xea4f('0x50')]({'where':{'id':_0xc03549[_0xea4f('0x4e')]['id']}})[_0xea4f('0x28')](handleEntityNotFound(_0x42560d,null))[_0xea4f('0x28')](function(_0x212b62){if(_0x212b62){_0x259f97=_0x212b62;_0xe5af1c[_0xea4f('0x32')]=_[_0xea4f('0x46')](db[_0xea4f('0x51')][_0xea4f('0x2f')]);_0xe5af1c[_0xea4f('0x33')]=_[_0xea4f('0x46')](_0xc03549[_0xea4f('0x33')]);_0xe5af1c[_0xea4f('0x34')]=_['intersection'](_0xe5af1c['model'],_0xe5af1c[_0xea4f('0x33')]);_0x40cab9[_0xea4f('0x35')]=_[_0xea4f('0x47')](_0xe5af1c[_0xea4f('0x32')],qs[_0xea4f('0x48')](_0xc03549['query']['fields']));_0x40cab9['attributes']=_0x40cab9[_0xea4f('0x35')]['length']?_0x40cab9[_0xea4f('0x35')]:_0xe5af1c['model'];_0x40cab9[_0xea4f('0x39')]=qs[_0xea4f('0x3a')](_0xc03549[_0xea4f('0x33')][_0xea4f('0x3a')]);_0x40cab9[_0xea4f('0x3d')]=qs[_0xea4f('0x34')](_[_0xea4f('0x3b')](_0xc03549['query'],_0xe5af1c[_0xea4f('0x34')]));if(_0xc03549[_0xea4f('0x33')][_0xea4f('0x3c')]){_0x40cab9[_0xea4f('0x3d')]=_[_0xea4f('0x3e')](_0x40cab9['where'],{'$or':_[_0xea4f('0x2d')](_0x40cab9['attributes'],function(_0xbeea61){var _0xe14a0a={};_0xe14a0a[_0xbeea61]={'$like':'%'+_0xc03549[_0xea4f('0x33')][_0xea4f('0x3c')]+'%'};return _0xe14a0a;})});}_0x40cab9=_[_0xea4f('0x3e')]({},_0x40cab9,_0xc03549[_0xea4f('0x49')]);return _0x259f97[_0xea4f('0x4f')](_0x40cab9);}})[_0xea4f('0x28')](function(_0x31b4b3){if(_0x31b4b3){_0x5905b4=_0x31b4b3[_0xea4f('0x36')];if(!_0xc03549[_0xea4f('0x33')][_0xea4f('0x37')](_0xea4f('0x38'))){_0x40cab9[_0xea4f('0x20')]=qs[_0xea4f('0x20')](_0xc03549[_0xea4f('0x33')][_0xea4f('0x20')]);_0x40cab9[_0xea4f('0x21')]=qs['offset'](_0xc03549[_0xea4f('0x33')][_0xea4f('0x21')]);}return _0x259f97[_0xea4f('0x4f')](_0x40cab9);}})[_0xea4f('0x28')](function(_0x103666){if(_0x103666){return _0x103666?{'count':_0x5905b4,'rows':_0x103666}:null;}})[_0xea4f('0x28')](respondWithResult(_0x42560d,null))[_0xea4f('0x45')](handleError(_0x42560d,null));};exports[_0xea4f('0x52')]=function(_0x4034bb,_0x22173f,_0x10ab3a){var _0x45bd1b={};var _0x548ec3={};var _0x55f325;var _0x4ec26c;return db[_0xea4f('0x2e')][_0xea4f('0x50')]({'where':{'id':_0x4034bb['params']['id']}})['then'](handleEntityNotFound(_0x22173f,null))[_0xea4f('0x28')](function(_0x43ce9e){if(_0x43ce9e){_0x55f325=_0x43ce9e;_0x548ec3['model']=_[_0xea4f('0x46')](db[_0xea4f('0x51')][_0xea4f('0x2f')]);_0x548ec3[_0xea4f('0x33')]=_['keys'](_0x4034bb['query']);_0x548ec3['filters']=_['intersection'](_0x548ec3['model'],_0x548ec3[_0xea4f('0x33')]);_0x45bd1b[_0xea4f('0x35')]=_[_0xea4f('0x47')](_0x548ec3[_0xea4f('0x32')],qs['fields'](_0x4034bb['query']['fields']));_0x45bd1b[_0xea4f('0x35')]=_0x45bd1b['attributes']['length']?_0x45bd1b[_0xea4f('0x35')]:_0x548ec3[_0xea4f('0x32')];_0x45bd1b[_0xea4f('0x39')]=qs[_0xea4f('0x3a')](_0x4034bb[_0xea4f('0x33')][_0xea4f('0x3a')]);_0x45bd1b[_0xea4f('0x3d')]=qs['filters'](_[_0xea4f('0x3b')](_0x4034bb[_0xea4f('0x33')],_0x548ec3['filters']));if(_0x4034bb[_0xea4f('0x33')][_0xea4f('0x3c')]){_0x45bd1b[_0xea4f('0x3d')]=_[_0xea4f('0x3e')](_0x45bd1b[_0xea4f('0x3d')],{'$or':_[_0xea4f('0x2d')](_0x45bd1b[_0xea4f('0x35')],function(_0x16878c){var _0x15928e={};_0x15928e[_0x16878c]={'$like':'%'+_0x4034bb[_0xea4f('0x33')]['filter']+'%'};return _0x15928e;})});}_0x45bd1b=_['merge']({},_0x45bd1b,_0x4034bb[_0xea4f('0x49')]);return _0x55f325['getSubjects'](_0x45bd1b);}})[_0xea4f('0x28')](function(_0xcb737a){if(_0xcb737a){_0x4ec26c=_0xcb737a[_0xea4f('0x36')];if(!_0x4034bb[_0xea4f('0x33')]['hasOwnProperty'](_0xea4f('0x38'))){_0x45bd1b[_0xea4f('0x20')]=qs[_0xea4f('0x20')](_0x4034bb[_0xea4f('0x33')][_0xea4f('0x20')]);_0x45bd1b[_0xea4f('0x21')]=qs[_0xea4f('0x21')](_0x4034bb[_0xea4f('0x33')][_0xea4f('0x21')]);}return _0x55f325[_0xea4f('0x52')](_0x45bd1b);}})[_0xea4f('0x28')](function(_0x4b73ac){if(_0x4b73ac){return _0x4b73ac?{'count':_0x4ec26c,'rows':_0x4b73ac}:null;}})[_0xea4f('0x28')](respondWithResult(_0x22173f,null))[_0xea4f('0x45')](handleError(_0x22173f,null));};exports[_0xea4f('0x53')]=function(_0x336a06,_0x2765b7,_0x5dcd42){var _0x424ce5={};var _0x113db1={};var _0xb4439f;var _0x4a5945;return db[_0xea4f('0x2e')][_0xea4f('0x50')]({'where':{'id':_0x336a06['params']['id']}})['then'](handleEntityNotFound(_0x2765b7,null))[_0xea4f('0x28')](function(_0x2c3581){if(_0x2c3581){_0xb4439f=_0x2c3581;_0x113db1[_0xea4f('0x32')]=_[_0xea4f('0x46')](db[_0xea4f('0x51')]['rawAttributes']);_0x113db1[_0xea4f('0x33')]=_[_0xea4f('0x46')](_0x336a06[_0xea4f('0x33')]);_0x113db1[_0xea4f('0x34')]=_['intersection'](_0x113db1['model'],_0x113db1[_0xea4f('0x33')]);_0x424ce5['attributes']=_[_0xea4f('0x47')](_0x113db1['model'],qs[_0xea4f('0x48')](_0x336a06[_0xea4f('0x33')]['fields']));_0x424ce5['attributes']=_0x424ce5[_0xea4f('0x35')]['length']?_0x424ce5['attributes']:_0x113db1[_0xea4f('0x32')];_0x424ce5['order']=qs[_0xea4f('0x3a')](_0x336a06['query'][_0xea4f('0x3a')]);_0x424ce5[_0xea4f('0x3d')]=qs[_0xea4f('0x34')](_['pick'](_0x336a06[_0xea4f('0x33')],_0x113db1[_0xea4f('0x34')]));if(_0x336a06[_0xea4f('0x33')][_0xea4f('0x3c')]){_0x424ce5[_0xea4f('0x3d')]=_['merge'](_0x424ce5[_0xea4f('0x3d')],{'$or':_[_0xea4f('0x2d')](_0x424ce5['attributes'],function(_0x31706d){var _0x1cac39={};_0x1cac39[_0x31706d]={'$like':'%'+_0x336a06[_0xea4f('0x33')]['filter']+'%'};return _0x1cac39;})});}_0x424ce5=_[_0xea4f('0x3e')]({},_0x424ce5,_0x336a06[_0xea4f('0x49')]);return _0xb4439f[_0xea4f('0x53')](_0x424ce5);}})[_0xea4f('0x28')](function(_0x1fc7ac){if(_0x1fc7ac){_0x4a5945=_0x1fc7ac[_0xea4f('0x36')];if(!_0x336a06[_0xea4f('0x33')]['hasOwnProperty'](_0xea4f('0x38'))){_0x424ce5[_0xea4f('0x20')]=qs[_0xea4f('0x20')](_0x336a06[_0xea4f('0x33')][_0xea4f('0x20')]);_0x424ce5[_0xea4f('0x21')]=qs[_0xea4f('0x21')](_0x336a06[_0xea4f('0x33')]['offset']);}return _0xb4439f['getDescriptions'](_0x424ce5);}})[_0xea4f('0x28')](function(_0x29025f){if(_0x29025f){return _0x29025f?{'count':_0x4a5945,'rows':_0x29025f}:null;}})['then'](respondWithResult(_0x2765b7,null))[_0xea4f('0x45')](handleError(_0x2765b7,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 6818758..79349db 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 _0xa6d8=['moment','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','int_sugarcrm_configurations','util'];(function(_0x15d4c4,_0xff0966){var _0x1da308=function(_0x4f4772){while(--_0x4f4772){_0x15d4c4['push'](_0x15d4c4['shift']());}};_0x1da308(++_0xff0966);}(_0xa6d8,0x1dc));var _0x8a6d=function(_0x7d78f,_0x22d980){_0x7d78f=_0x7d78f-0x0;var _0x1005c3=_0xa6d8[_0x7d78f];return _0x1005c3;};'use strict';var _=require('lodash');var util=require(_0x8a6d('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8a6d('0x1'));var BPromise=require('bluebird');var rp=require(_0x8a6d('0x2'));var fs=require('fs');var path=require(_0x8a6d('0x3'));var rimraf=require('rimraf');var config=require(_0x8a6d('0x4'));var attributes=require(_0x8a6d('0x5'));module[_0x8a6d('0x6')]=function(_0x3e9bb4,_0xc279c9){return _0x3e9bb4['define'](_0x8a6d('0x7'),attributes,{'tableName':_0x8a6d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdaff=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xdaff,0xfb));var _0xfdaf=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xdaff[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xfdaf('0x0'));var util=require(_0xfdaf('0x1'));var logger=require(_0xfdaf('0x2'))(_0xfdaf('0x3'));var moment=require(_0xfdaf('0x4'));var BPromise=require(_0xfdaf('0x5'));var rp=require(_0xfdaf('0x6'));var fs=require('fs');var path=require(_0xfdaf('0x7'));var rimraf=require(_0xfdaf('0x8'));var config=require(_0xfdaf('0x9'));var attributes=require(_0xfdaf('0xa'));module[_0xfdaf('0xb')]=function(_0x37194a,_0x2a50f7){return _0x37194a[_0xfdaf('0xc')](_0xfdaf('0xd'),attributes,{'tableName':_0xfdaf('0xe'),'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 fa2716f..ece9bbe 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 _0xdae4=['error','message','result','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x92c450,_0x41f1e3){var _0x2a9599=function(_0x4f27df){while(--_0x4f27df){_0x92c450['push'](_0x92c450['shift']());}};_0x2a9599(++_0x41f1e3);}(_0xdae4,0x10e));var _0x4dae=function(_0x948d2f,_0x56b6f7){_0x948d2f=_0x948d2f-0x0;var _0x39984a=_0xdae4[_0x948d2f];return _0x39984a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4dae('0x0'));var BPromise=require(_0x4dae('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4dae('0x2'))['db'];var utils=require(_0x4dae('0x3'));var logger=require(_0x4dae('0x4'))(_0x4dae('0x5'));var config=require('../../config/environment');var jayson=require(_0x4dae('0x6'));var client=jayson['client'][_0x4dae('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f204e,_0x23432c,_0x23c803){return new BPromise(function(_0x4db7c4,_0x1a03b1){return client[_0x4dae('0x8')](_0x3f204e,_0x23c803)['then'](function(_0xbf02dc){logger[_0x4dae('0x9')](_0x4dae('0xa'),_0x23432c,_0x4dae('0xb'));logger[_0x4dae('0xc')](_0x4dae('0xd'),_0x23432c,_0x4dae('0xb'),JSON[_0x4dae('0xe')](_0xbf02dc));if(_0xbf02dc[_0x4dae('0xf')]){if(_0xbf02dc['error']['code']===0x1f4){logger[_0x4dae('0xf')](_0x4dae('0xa'),_0x23432c,_0xbf02dc[_0x4dae('0xf')][_0x4dae('0x10')]);return _0x1a03b1(_0xbf02dc[_0x4dae('0xf')]['message']);}logger['error'](_0x4dae('0xa'),_0x23432c,_0xbf02dc[_0x4dae('0xf')][_0x4dae('0x10')]);return _0x4db7c4(_0xbf02dc[_0x4dae('0xf')][_0x4dae('0x10')]);}else{logger[_0x4dae('0x9')](_0x4dae('0xa'),_0x23432c,_0x4dae('0xb'));_0x4db7c4(_0xbf02dc[_0x4dae('0x11')][_0x4dae('0x10')]);}})[_0x4dae('0x12')](function(_0x22e191){logger[_0x4dae('0xf')](_0x4dae('0xa'),_0x23432c,_0x22e191);_0x1a03b1(_0x22e191);});});} \ No newline at end of file +var _0xe839=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x423a9a,_0x2ec223){var _0x564475=function(_0x33b25a){while(--_0x33b25a){_0x423a9a['push'](_0x423a9a['shift']());}};_0x564475(++_0x2ec223);}(_0xe839,0x97));var _0x9e83=function(_0x3f578f,_0x51f172){_0x3f578f=_0x3f578f-0x0;var _0x32c754=_0xe839[_0x3f578f];return _0x32c754;};'use strict';var _=require(_0x9e83('0x0'));var util=require(_0x9e83('0x1'));var moment=require(_0x9e83('0x2'));var BPromise=require(_0x9e83('0x3'));var rs=require(_0x9e83('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9e83('0x5'))['db'];var utils=require(_0x9e83('0x6'));var logger=require(_0x9e83('0x7'))('rpc');var config=require(_0x9e83('0x8'));var jayson=require(_0x9e83('0x9'));var client=jayson[_0x9e83('0xa')][_0x9e83('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31d05a,_0x2b654e,_0x18830f){return new BPromise(function(_0x4116b0,_0x1211b3){return client[_0x9e83('0xc')](_0x31d05a,_0x18830f)['then'](function(_0x350dc4){logger[_0x9e83('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2b654e,_0x9e83('0xe'));logger[_0x9e83('0xf')](_0x9e83('0x10'),_0x2b654e,'request\x20sent',JSON['stringify'](_0x350dc4));if(_0x350dc4[_0x9e83('0x11')]){if(_0x350dc4['error'][_0x9e83('0x12')]===0x1f4){logger[_0x9e83('0x11')](_0x9e83('0x13'),_0x2b654e,_0x350dc4[_0x9e83('0x11')][_0x9e83('0x14')]);return _0x1211b3(_0x350dc4[_0x9e83('0x11')][_0x9e83('0x14')]);}logger['error'](_0x9e83('0x13'),_0x2b654e,_0x350dc4['error'][_0x9e83('0x14')]);return _0x4116b0(_0x350dc4[_0x9e83('0x11')][_0x9e83('0x14')]);}else{logger[_0x9e83('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2b654e,'request\x20sent');_0x4116b0(_0x350dc4['result']['message']);}})[_0x9e83('0x15')](function(_0x388aad){logger[_0x9e83('0x11')](_0x9e83('0x13'),_0x2b654e,_0x388aad);_0x1211b3(_0x388aad);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index da2dbf3..87d7f8d 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 _0x21f2=['get','isAuthenticated','index','show','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./intSugarcrmField.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x21f2,0x108));var _0x221f=function(_0x4ae586,_0x30a323){_0x4ae586=_0x4ae586-0x0;var _0x231890=_0x21f2[_0x4ae586];return _0x231890;};'use strict';var multer=require(_0x221f('0x0'));var util=require(_0x221f('0x1'));var path=require(_0x221f('0x2'));var timeout=require(_0x221f('0x3'));var express=require(_0x221f('0x4'));var router=express['Router']();var fs_extra=require(_0x221f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x221f('0x6'));var config=require('../../config/environment');var controller=require(_0x221f('0x7'));router[_0x221f('0x8')]('/',auth[_0x221f('0x9')](),controller[_0x221f('0xa')]);router[_0x221f('0x8')]('/:id',auth[_0x221f('0x9')](),controller[_0x221f('0xb')]);router['post']('/',auth[_0x221f('0x9')](),controller['create']);router[_0x221f('0xc')](_0x221f('0xd'),auth[_0x221f('0x9')](),controller[_0x221f('0xe')]);router[_0x221f('0xf')](_0x221f('0xd'),auth[_0x221f('0x9')](),controller[_0x221f('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4b04=['fs-extra','../../components/interaction/service','./intSugarcrmField.controller','isAuthenticated','get','/:id','show','post','put','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x111692,_0x19f8a9){var _0x11836f=function(_0x2f2714){while(--_0x2f2714){_0x111692['push'](_0x111692['shift']());}};_0x11836f(++_0x19f8a9);}(_0x4b04,0x182));var _0x44b0=function(_0x1f51c9,_0x3a1c40){_0x1f51c9=_0x1f51c9-0x0;var _0x2e795e=_0x4b04[_0x1f51c9];return _0x2e795e;};'use strict';var multer=require(_0x44b0('0x0'));var util=require(_0x44b0('0x1'));var path=require(_0x44b0('0x2'));var timeout=require('connect-timeout');var express=require(_0x44b0('0x3'));var router=express[_0x44b0('0x4')]();var fs_extra=require(_0x44b0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x44b0('0x6'));var config=require('../../config/environment');var controller=require(_0x44b0('0x7'));router['get']('/',auth[_0x44b0('0x8')](),controller['index']);router[_0x44b0('0x9')](_0x44b0('0xa'),auth[_0x44b0('0x8')](),controller[_0x44b0('0xb')]);router[_0x44b0('0xc')]('/',auth[_0x44b0('0x8')](),controller['create']);router[_0x44b0('0xd')]('/:id',auth[_0x44b0('0x8')](),controller['update']);router[_0x44b0('0xe')](_0x44b0('0xa'),auth[_0x44b0('0x8')](),controller[_0x44b0('0xf')]);module[_0x44b0('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 881b547..802cedf 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 _0xe48f=['string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM'];(function(_0xad9a4b,_0x16468d){var _0x1d044a=function(_0x13f82d){while(--_0x13f82d){_0xad9a4b['push'](_0xad9a4b['shift']());}};_0x1d044a(++_0x16468d);}(_0xe48f,0x16f));var _0xfe48=function(_0x5cbb32,_0x233ace){_0x5cbb32=_0x5cbb32-0x0;var _0x49363c=_0xe48f[_0x5cbb32];return _0x49363c;};'use strict';var Sequelize=require(_0xfe48('0x0'));module[_0xfe48('0x1')]={'type':{'type':Sequelize[_0xfe48('0x2')](_0xfe48('0x3'),'variable',_0xfe48('0x4'),_0xfe48('0x5'),_0xfe48('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfe48('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfe48('0x2')](_0xfe48('0x3'),_0xfe48('0x8'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xfe48('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xfe48('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfe48('0x7')]}}; \ No newline at end of file +var _0x0d73=['variable','picklist','string','customVariable','STRING','BOOLEAN','ENUM'];(function(_0x2fb255,_0x29586f){var _0x1d75ed=function(_0xc47ea8){while(--_0xc47ea8){_0x2fb255['push'](_0x2fb255['shift']());}};_0x1d75ed(++_0x29586f);}(_0x0d73,0x1db));var _0x30d7=function(_0x12ba9e,_0x41f416){_0x12ba9e=_0x12ba9e-0x0;var _0x3475b9=_0x0d73[_0x12ba9e];return _0x3475b9;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x30d7('0x0')]('string',_0x30d7('0x1'),'customVariable','keyValue',_0x30d7('0x2')),'defaultValue':_0x30d7('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x30d7('0x0')]('string',_0x30d7('0x1'),_0x30d7('0x4'))},'keyContent':{'type':Sequelize[_0x30d7('0x5')]},'idField':{'type':Sequelize[_0x30d7('0x5')]},'nameField':{'type':Sequelize[_0x30d7('0x5')]},'customField':{'type':Sequelize[_0x30d7('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x30d7('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 771cfcd..374e9eb 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 _0x1d52=['type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','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/environment','../../config/license/util','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','map','SugarcrmField','fieldName'];(function(_0x15a077,_0x317493){var _0x35637c=function(_0x3c97fc){while(--_0x3c97fc){_0x15a077['push'](_0x15a077['shift']());}};_0x35637c(++_0x317493);}(_0x1d52,0x1d9));var _0x21d5=function(_0x32fbd8,_0x244dd9){_0x32fbd8=_0x32fbd8-0x0;var _0x280bd8=_0x1d52[_0x32fbd8];return _0x280bd8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21d5('0x0'));var zipdir=require(_0x21d5('0x1'));var jsonpatch=require(_0x21d5('0x2'));var rp=require('request-promise');var moment=require(_0x21d5('0x3'));var BPromise=require(_0x21d5('0x4'));var Mustache=require(_0x21d5('0x5'));var util=require(_0x21d5('0x6'));var path=require(_0x21d5('0x7'));var sox=require('sox');var csv=require(_0x21d5('0x8'));var ejs=require(_0x21d5('0x9'));var fs=require('fs');var fs_extra=require(_0x21d5('0xa'));var _=require('lodash');var squel=require(_0x21d5('0xb'));var crypto=require(_0x21d5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x21d5('0xd'));var Papa=require('papaparse');var Redis=require(_0x21d5('0xe'));var authService=require(_0x21d5('0xf'));var qs=require(_0x21d5('0x10'));var as=require(_0x21d5('0x11'));var hardwareService=require(_0x21d5('0x12'));var logger=require('../../config/logger')(_0x21d5('0x13'));var utils=require(_0x21d5('0x14'));var config=require(_0x21d5('0x15'));var licenseUtil=require(_0x21d5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x577e73,_0x812ebc){_0x812ebc=_0x812ebc||0xcc;return function(_0x3c9f38){if(_0x3c9f38){return _0x577e73[_0x21d5('0x17')](_0x812ebc);}return _0x577e73['status'](_0x812ebc)[_0x21d5('0x18')]();};}function respondWithResult(_0x2dd158,_0x1456f8){_0x1456f8=_0x1456f8||0xc8;return function(_0x4d14db){if(_0x4d14db){return _0x2dd158['status'](_0x1456f8)['json'](_0x4d14db);}};}function respondWithFilteredResult(_0xa55eba,_0xa9a5e2){return function(_0x25dad5){if(_0x25dad5){var _0xd80b77=typeof _0xa9a5e2['offset']===_0x21d5('0x19')&&typeof _0xa9a5e2[_0x21d5('0x1a')]===_0x21d5('0x19');var _0x3d0992=_0x25dad5[_0x21d5('0x1b')];var _0x584a1d=_0xd80b77?0x0:_0xa9a5e2[_0x21d5('0x1c')];var _0x468e88=_0xd80b77?_0x25dad5[_0x21d5('0x1b')]:_0xa9a5e2[_0x21d5('0x1c')]+_0xa9a5e2[_0x21d5('0x1a')];var _0x4c4da3;if(_0x468e88>=_0x3d0992){_0x468e88=_0x3d0992;_0x4c4da3=0xc8;}else{_0x4c4da3=0xce;}_0xa55eba[_0x21d5('0x1d')](_0x4c4da3);return _0xa55eba[_0x21d5('0x1e')](_0x21d5('0x1f'),_0x584a1d+'-'+_0x468e88+'/'+_0x3d0992)[_0x21d5('0x20')](_0x25dad5);}return null;};}function patchUpdates(_0x54ae39){return function(_0x21f8fb){try{jsonpatch[_0x21d5('0x21')](_0x21f8fb,_0x54ae39,!![]);}catch(_0x239e05){return BPromise[_0x21d5('0x22')](_0x239e05);}return _0x21f8fb['save']();};}function saveUpdates(_0x4a357a,_0x37d560){return function(_0xe967e4){if(_0xe967e4){return _0xe967e4[_0x21d5('0x23')](_0x4a357a)[_0x21d5('0x24')](function(_0x57cfe5){return _0x57cfe5;});}return null;};}function removeEntity(_0x2d31d1,_0x3de7ef){return function(_0x48533b){if(_0x48533b){return _0x48533b[_0x21d5('0x25')]()['then'](function(){_0x2d31d1[_0x21d5('0x1d')](0xcc)[_0x21d5('0x18')]();});}};}function handleEntityNotFound(_0x5c975e,_0xe1926d){return function(_0xe0342f){if(!_0xe0342f){_0x5c975e['sendStatus'](0x194);}return _0xe0342f;};}function handleError(_0x59244c,_0x5ca053){_0x5ca053=_0x5ca053||0x1f4;return function(_0x408618){logger[_0x21d5('0x26')](_0x408618[_0x21d5('0x27')]);if(_0x408618[_0x21d5('0x28')]){delete _0x408618[_0x21d5('0x28')];}_0x59244c[_0x21d5('0x1d')](_0x5ca053)['send'](_0x408618);};}exports[_0x21d5('0x29')]=function(_0x2f0a1f,_0x43a495){var _0x57bdab={},_0x26ded2={},_0xcc618={'count':0x0,'rows':[]};var _0x2f1abf=_[_0x21d5('0x2a')](db[_0x21d5('0x2b')]['rawAttributes'],function(_0x1df6ad){return{'name':_0x1df6ad[_0x21d5('0x2c')],'type':_0x1df6ad[_0x21d5('0x2d')][_0x21d5('0x2e')]};});_0x26ded2[_0x21d5('0x2f')]=_[_0x21d5('0x2a')](_0x2f1abf,_0x21d5('0x28'));_0x26ded2[_0x21d5('0x30')]=_[_0x21d5('0x31')](_0x2f0a1f[_0x21d5('0x30')]);_0x26ded2[_0x21d5('0x32')]=_[_0x21d5('0x33')](_0x26ded2[_0x21d5('0x2f')],_0x26ded2['query']);_0x57bdab[_0x21d5('0x34')]=_['intersection'](_0x26ded2[_0x21d5('0x2f')],qs[_0x21d5('0x35')](_0x2f0a1f[_0x21d5('0x30')][_0x21d5('0x35')]));_0x57bdab['attributes']=_0x57bdab[_0x21d5('0x34')][_0x21d5('0x36')]?_0x57bdab[_0x21d5('0x34')]:_0x26ded2[_0x21d5('0x2f')];if(!_0x2f0a1f['query']['hasOwnProperty'](_0x21d5('0x37'))){_0x57bdab[_0x21d5('0x1a')]=qs[_0x21d5('0x1a')](_0x2f0a1f['query'][_0x21d5('0x1a')]);_0x57bdab['offset']=qs[_0x21d5('0x1c')](_0x2f0a1f[_0x21d5('0x30')][_0x21d5('0x1c')]);}_0x57bdab[_0x21d5('0x38')]=qs['sort'](_0x2f0a1f[_0x21d5('0x30')][_0x21d5('0x39')]);_0x57bdab[_0x21d5('0x3a')]=qs[_0x21d5('0x32')](_[_0x21d5('0x3b')](_0x2f0a1f[_0x21d5('0x30')],_0x26ded2[_0x21d5('0x32')]),_0x2f1abf);if(_0x2f0a1f['query'][_0x21d5('0x3c')]){_0x57bdab[_0x21d5('0x3a')]=_[_0x21d5('0x3d')](_0x57bdab[_0x21d5('0x3a')],{'$or':_[_0x21d5('0x2a')](_0x2f1abf,function(_0x2e20ed){if(_0x2e20ed[_0x21d5('0x2d')]!==_0x21d5('0x3e')){var _0x4fb6b3={};_0x4fb6b3[_0x2e20ed['name']]={'$like':'%'+_0x2f0a1f['query'][_0x21d5('0x3c')]+'%'};return _0x4fb6b3;}})});}_0x57bdab=_[_0x21d5('0x3d')]({},_0x57bdab,_0x2f0a1f['options']);var _0x1507d8={'where':_0x57bdab[_0x21d5('0x3a')]};return db[_0x21d5('0x2b')]['count'](_0x1507d8)[_0x21d5('0x24')](function(_0x420446){_0xcc618[_0x21d5('0x1b')]=_0x420446;if(_0x2f0a1f[_0x21d5('0x30')][_0x21d5('0x3f')]){_0x57bdab[_0x21d5('0x40')]=[{'all':!![]}];}return db[_0x21d5('0x2b')][_0x21d5('0x41')](_0x57bdab);})[_0x21d5('0x24')](function(_0xf5ef22){_0xcc618[_0x21d5('0x42')]=_0xf5ef22;return _0xcc618;})[_0x21d5('0x24')](respondWithFilteredResult(_0x43a495,_0x57bdab))[_0x21d5('0x43')](handleError(_0x43a495,null));};exports[_0x21d5('0x44')]=function(_0x476aa7,_0x2ea811){var _0x146d85={'raw':!![],'where':{'id':_0x476aa7[_0x21d5('0x45')]['id']}},_0x53c402={};_0x53c402[_0x21d5('0x2f')]=_['keys'](db[_0x21d5('0x2b')][_0x21d5('0x46')]);_0x53c402[_0x21d5('0x30')]=_[_0x21d5('0x31')](_0x476aa7[_0x21d5('0x30')]);_0x53c402['filters']=_[_0x21d5('0x33')](_0x53c402[_0x21d5('0x2f')],_0x53c402['query']);_0x146d85[_0x21d5('0x34')]=_[_0x21d5('0x33')](_0x53c402['model'],qs[_0x21d5('0x35')](_0x476aa7[_0x21d5('0x30')]['fields']));_0x146d85[_0x21d5('0x34')]=_0x146d85[_0x21d5('0x34')]['length']?_0x146d85[_0x21d5('0x34')]:_0x53c402[_0x21d5('0x2f')];if(_0x476aa7[_0x21d5('0x30')][_0x21d5('0x3f')]){_0x146d85[_0x21d5('0x40')]=[{'all':!![]}];}_0x146d85=_[_0x21d5('0x3d')]({},_0x146d85,_0x476aa7['options']);return db['SugarcrmField'][_0x21d5('0x47')](_0x146d85)[_0x21d5('0x24')](handleEntityNotFound(_0x2ea811,null))[_0x21d5('0x24')](respondWithResult(_0x2ea811,null))[_0x21d5('0x43')](handleError(_0x2ea811,null));};exports[_0x21d5('0x48')]=function(_0x182126,_0x133c6f){return db[_0x21d5('0x2b')][_0x21d5('0x48')](_0x182126['body'],{})[_0x21d5('0x24')](respondWithResult(_0x133c6f,0xc9))[_0x21d5('0x43')](handleError(_0x133c6f,null));};exports[_0x21d5('0x23')]=function(_0x5e528c,_0x66e0a0){if(_0x5e528c[_0x21d5('0x49')]['id']){delete _0x5e528c[_0x21d5('0x49')]['id'];}return db[_0x21d5('0x2b')][_0x21d5('0x47')]({'where':{'id':_0x5e528c[_0x21d5('0x45')]['id']}})[_0x21d5('0x24')](handleEntityNotFound(_0x66e0a0,null))[_0x21d5('0x24')](saveUpdates(_0x5e528c['body'],null))['then'](respondWithResult(_0x66e0a0,null))[_0x21d5('0x43')](handleError(_0x66e0a0,null));};exports[_0x21d5('0x25')]=function(_0xc146ee,_0x48eaf8){return db[_0x21d5('0x2b')][_0x21d5('0x47')]({'where':{'id':_0xc146ee['params']['id']}})['then'](handleEntityNotFound(_0x48eaf8,null))[_0x21d5('0x24')](removeEntity(_0x48eaf8,null))['catch'](handleError(_0x48eaf8,null));}; \ No newline at end of file +var _0xf19a=['attributes','fields','length','hasOwnProperty','sort','where','merge','type','VIRTUAL','filter','include','show','params','keys','options','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','SugarcrmField','rawAttributes','filters','intersection','model','query'];(function(_0x1cc9b3,_0x4fa604){var _0x3a8411=function(_0x57ea23){while(--_0x57ea23){_0x1cc9b3['push'](_0x1cc9b3['shift']());}};_0x3a8411(++_0x4fa604);}(_0xf19a,0x171));var _0xaf19=function(_0x23cc7d,_0x553e85){_0x23cc7d=_0x23cc7d-0x0;var _0x41abb3=_0xf19a[_0x23cc7d];return _0x41abb3;};'use strict';var emlformat=require(_0xaf19('0x0'));var rimraf=require(_0xaf19('0x1'));var zipdir=require(_0xaf19('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf19('0x3'));var moment=require(_0xaf19('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaf19('0x5'));var util=require('util');var path=require(_0xaf19('0x6'));var sox=require(_0xaf19('0x7'));var csv=require(_0xaf19('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaf19('0x9'));var _=require('lodash');var squel=require(_0xaf19('0xa'));var crypto=require(_0xaf19('0xb'));var jsforce=require(_0xaf19('0xc'));var deskjs=require(_0xaf19('0xd'));var toCsv=require(_0xaf19('0x8'));var querystring=require(_0xaf19('0xe'));var Papa=require(_0xaf19('0xf'));var Redis=require(_0xaf19('0x10'));var authService=require(_0xaf19('0x11'));var qs=require(_0xaf19('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaf19('0x13'));var logger=require(_0xaf19('0x14'))(_0xaf19('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaf19('0x16'));var db=require(_0xaf19('0x17'))['db'];function respondWithStatusCode(_0xff81cf,_0x34f05a){_0x34f05a=_0x34f05a||0xcc;return function(_0x2b168d){if(_0x2b168d){return _0xff81cf['sendStatus'](_0x34f05a);}return _0xff81cf[_0xaf19('0x18')](_0x34f05a)['end']();};}function respondWithResult(_0x173f3d,_0x5567fc){_0x5567fc=_0x5567fc||0xc8;return function(_0x1dca6d){if(_0x1dca6d){return _0x173f3d['status'](_0x5567fc)['json'](_0x1dca6d);}};}function respondWithFilteredResult(_0x2d898d,_0x59d250){return function(_0xd2185a){if(_0xd2185a){var _0x569de6=typeof _0x59d250[_0xaf19('0x19')]===_0xaf19('0x1a')&&typeof _0x59d250[_0xaf19('0x1b')]===_0xaf19('0x1a');var _0x376ac0=_0xd2185a[_0xaf19('0x1c')];var _0x249bc3=_0x569de6?0x0:_0x59d250['offset'];var _0x2f3ef4=_0x569de6?_0xd2185a[_0xaf19('0x1c')]:_0x59d250[_0xaf19('0x19')]+_0x59d250['limit'];var _0x2fbab2;if(_0x2f3ef4>=_0x376ac0){_0x2f3ef4=_0x376ac0;_0x2fbab2=0xc8;}else{_0x2fbab2=0xce;}_0x2d898d['status'](_0x2fbab2);return _0x2d898d[_0xaf19('0x1d')](_0xaf19('0x1e'),_0x249bc3+'-'+_0x2f3ef4+'/'+_0x376ac0)[_0xaf19('0x1f')](_0xd2185a);}return null;};}function patchUpdates(_0x3acf62){return function(_0x3d7d45){try{jsonpatch[_0xaf19('0x20')](_0x3d7d45,_0x3acf62,!![]);}catch(_0x507f4e){return BPromise[_0xaf19('0x21')](_0x507f4e);}return _0x3d7d45[_0xaf19('0x22')]();};}function saveUpdates(_0x28f136,_0x24ad43){return function(_0x105097){if(_0x105097){return _0x105097[_0xaf19('0x23')](_0x28f136)[_0xaf19('0x24')](function(_0x21ee73){return _0x21ee73;});}return null;};}function removeEntity(_0xf31c2c,_0x4ff944){return function(_0x4cceb5){if(_0x4cceb5){return _0x4cceb5[_0xaf19('0x25')]()['then'](function(){_0xf31c2c[_0xaf19('0x18')](0xcc)[_0xaf19('0x26')]();});}};}function handleEntityNotFound(_0x319edf,_0xddb741){return function(_0x3055e5){if(!_0x3055e5){_0x319edf[_0xaf19('0x27')](0x194);}return _0x3055e5;};}function handleError(_0x20a941,_0x1b108b){_0x1b108b=_0x1b108b||0x1f4;return function(_0x1a8902){logger[_0xaf19('0x28')](_0x1a8902['stack']);if(_0x1a8902['name']){delete _0x1a8902[_0xaf19('0x29')];}_0x20a941[_0xaf19('0x18')](_0x1b108b)[_0xaf19('0x2a')](_0x1a8902);};}exports[_0xaf19('0x2b')]=function(_0x576295,_0xddd242){var _0x2fa92c={},_0x3477a2={},_0x18eb9e={'count':0x0,'rows':[]};var _0x1f1b6c=_[_0xaf19('0x2c')](db[_0xaf19('0x2d')][_0xaf19('0x2e')],function(_0x2f8eec){return{'name':_0x2f8eec['fieldName'],'type':_0x2f8eec['type']['key']};});_0x3477a2['model']=_[_0xaf19('0x2c')](_0x1f1b6c,_0xaf19('0x29'));_0x3477a2['query']=_['keys'](_0x576295['query']);_0x3477a2[_0xaf19('0x2f')]=_[_0xaf19('0x30')](_0x3477a2[_0xaf19('0x31')],_0x3477a2[_0xaf19('0x32')]);_0x2fa92c[_0xaf19('0x33')]=_['intersection'](_0x3477a2['model'],qs[_0xaf19('0x34')](_0x576295[_0xaf19('0x32')]['fields']));_0x2fa92c[_0xaf19('0x33')]=_0x2fa92c[_0xaf19('0x33')][_0xaf19('0x35')]?_0x2fa92c[_0xaf19('0x33')]:_0x3477a2[_0xaf19('0x31')];if(!_0x576295['query'][_0xaf19('0x36')]('nolimit')){_0x2fa92c[_0xaf19('0x1b')]=qs[_0xaf19('0x1b')](_0x576295[_0xaf19('0x32')][_0xaf19('0x1b')]);_0x2fa92c[_0xaf19('0x19')]=qs[_0xaf19('0x19')](_0x576295[_0xaf19('0x32')][_0xaf19('0x19')]);}_0x2fa92c['order']=qs[_0xaf19('0x37')](_0x576295[_0xaf19('0x32')][_0xaf19('0x37')]);_0x2fa92c[_0xaf19('0x38')]=qs[_0xaf19('0x2f')](_['pick'](_0x576295['query'],_0x3477a2[_0xaf19('0x2f')]),_0x1f1b6c);if(_0x576295[_0xaf19('0x32')]['filter']){_0x2fa92c[_0xaf19('0x38')]=_[_0xaf19('0x39')](_0x2fa92c['where'],{'$or':_[_0xaf19('0x2c')](_0x1f1b6c,function(_0x23b2af){if(_0x23b2af[_0xaf19('0x3a')]!==_0xaf19('0x3b')){var _0x1d7294={};_0x1d7294[_0x23b2af[_0xaf19('0x29')]]={'$like':'%'+_0x576295[_0xaf19('0x32')][_0xaf19('0x3c')]+'%'};return _0x1d7294;}})});}_0x2fa92c=_[_0xaf19('0x39')]({},_0x2fa92c,_0x576295['options']);var _0x152cf8={'where':_0x2fa92c[_0xaf19('0x38')]};return db[_0xaf19('0x2d')][_0xaf19('0x1c')](_0x152cf8)[_0xaf19('0x24')](function(_0x4cf0da){_0x18eb9e[_0xaf19('0x1c')]=_0x4cf0da;if(_0x576295[_0xaf19('0x32')]['includeAll']){_0x2fa92c[_0xaf19('0x3d')]=[{'all':!![]}];}return db['SugarcrmField']['findAll'](_0x2fa92c);})[_0xaf19('0x24')](function(_0x4f6dc8){_0x18eb9e['rows']=_0x4f6dc8;return _0x18eb9e;})[_0xaf19('0x24')](respondWithFilteredResult(_0xddd242,_0x2fa92c))['catch'](handleError(_0xddd242,null));};exports[_0xaf19('0x3e')]=function(_0x5ed2a9,_0x5f333d){var _0x430c35={'raw':!![],'where':{'id':_0x5ed2a9[_0xaf19('0x3f')]['id']}},_0x315a34={};_0x315a34[_0xaf19('0x31')]=_[_0xaf19('0x40')](db[_0xaf19('0x2d')][_0xaf19('0x2e')]);_0x315a34[_0xaf19('0x32')]=_[_0xaf19('0x40')](_0x5ed2a9[_0xaf19('0x32')]);_0x315a34[_0xaf19('0x2f')]=_['intersection'](_0x315a34[_0xaf19('0x31')],_0x315a34[_0xaf19('0x32')]);_0x430c35[_0xaf19('0x33')]=_['intersection'](_0x315a34[_0xaf19('0x31')],qs[_0xaf19('0x34')](_0x5ed2a9['query'][_0xaf19('0x34')]));_0x430c35[_0xaf19('0x33')]=_0x430c35[_0xaf19('0x33')][_0xaf19('0x35')]?_0x430c35[_0xaf19('0x33')]:_0x315a34[_0xaf19('0x31')];if(_0x5ed2a9[_0xaf19('0x32')]['includeAll']){_0x430c35[_0xaf19('0x3d')]=[{'all':!![]}];}_0x430c35=_['merge']({},_0x430c35,_0x5ed2a9[_0xaf19('0x41')]);return db[_0xaf19('0x2d')][_0xaf19('0x42')](_0x430c35)['then'](handleEntityNotFound(_0x5f333d,null))[_0xaf19('0x24')](respondWithResult(_0x5f333d,null))[_0xaf19('0x43')](handleError(_0x5f333d,null));};exports[_0xaf19('0x44')]=function(_0x3c7fe4,_0x435cad){return db[_0xaf19('0x2d')][_0xaf19('0x44')](_0x3c7fe4[_0xaf19('0x45')],{})[_0xaf19('0x24')](respondWithResult(_0x435cad,0xc9))[_0xaf19('0x43')](handleError(_0x435cad,null));};exports[_0xaf19('0x23')]=function(_0x35a8f0,_0x1a5bf9){if(_0x35a8f0[_0xaf19('0x45')]['id']){delete _0x35a8f0['body']['id'];}return db[_0xaf19('0x2d')][_0xaf19('0x42')]({'where':{'id':_0x35a8f0[_0xaf19('0x3f')]['id']}})[_0xaf19('0x24')](handleEntityNotFound(_0x1a5bf9,null))['then'](saveUpdates(_0x35a8f0[_0xaf19('0x45')],null))[_0xaf19('0x24')](respondWithResult(_0x1a5bf9,null))['catch'](handleError(_0x1a5bf9,null));};exports['destroy']=function(_0x3a2877,_0x5324df){return db[_0xaf19('0x2d')][_0xaf19('0x42')]({'where':{'id':_0x3a2877[_0xaf19('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5324df,null))[_0xaf19('0x24')](removeEntity(_0x5324df,null))[_0xaf19('0x43')](handleError(_0x5324df,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index f0c2602..dbe5c12 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 _0x3b31=['SugarcrmField','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x4ff202,_0x5a5536){var _0x53fa84=function(_0x170adb){while(--_0x170adb){_0x4ff202['push'](_0x4ff202['shift']());}};_0x53fa84(++_0x5a5536);}(_0x3b31,0xc7));var _0x13b3=function(_0x3b7180,_0x307063){_0x3b7180=_0x3b7180-0x0;var _0x3accec=_0x3b31[_0x3b7180];return _0x3accec;};'use strict';var _=require(_0x13b3('0x0'));var util=require(_0x13b3('0x1'));var logger=require(_0x13b3('0x2'))(_0x13b3('0x3'));var moment=require(_0x13b3('0x4'));var BPromise=require(_0x13b3('0x5'));var rp=require(_0x13b3('0x6'));var fs=require('fs');var path=require(_0x13b3('0x7'));var rimraf=require('rimraf');var config=require(_0x13b3('0x8'));var attributes=require('./intSugarcrmField.attributes');module[_0x13b3('0x9')]=function(_0x3ebbe5,_0x213d68){return _0x3ebbe5[_0x13b3('0xa')](_0x13b3('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x13b3('0xc'),'fields':[_0x13b3('0xd'),_0x13b3('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcc54=['define','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports'];(function(_0xe83ac5,_0x279b67){var _0x3df16e=function(_0x5a1577){while(--_0x5a1577){_0xe83ac5['push'](_0xe83ac5['shift']());}};_0x3df16e(++_0x279b67);}(_0xcc54,0xe5));var _0x4cc5=function(_0x4a4c85,_0x3ab457){_0x4a4c85=_0x4a4c85-0x0;var _0x2ce580=_0xcc54[_0x4a4c85];return _0x2ce580;};'use strict';var _=require(_0x4cc5('0x0'));var util=require('util');var logger=require(_0x4cc5('0x1'))(_0x4cc5('0x2'));var moment=require(_0x4cc5('0x3'));var BPromise=require(_0x4cc5('0x4'));var rp=require(_0x4cc5('0x5'));var fs=require('fs');var path=require(_0x4cc5('0x6'));var rimraf=require(_0x4cc5('0x7'));var config=require(_0x4cc5('0x8'));var attributes=require(_0x4cc5('0x9'));module[_0x4cc5('0xa')]=function(_0x37e293,_0x2d0676){return _0x37e293[_0x4cc5('0xb')]('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x4cc5('0xc'),'fields':[_0x4cc5('0xd'),_0x4cc5('0xe')],'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 cba4188..5d522d9 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 _0xa304=['jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x29df9a,_0x42aff3){var _0x3a8e96=function(_0x70fbe7){while(--_0x70fbe7){_0x29df9a['push'](_0x29df9a['shift']());}};_0x3a8e96(++_0x42aff3);}(_0xa304,0x173));var _0x4a30=function(_0x121b1a,_0x42fdb7){_0x121b1a=_0x121b1a-0x0;var _0x2d89a6=_0xa304[_0x121b1a];return _0x2d89a6;};'use strict';var _=require(_0x4a30('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4a30('0x1'));var rs=require(_0x4a30('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a30('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a30('0x4'))(_0x4a30('0x5'));var config=require(_0x4a30('0x6'));var jayson=require(_0x4a30('0x7'));var client=jayson[_0x4a30('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x585f4e,_0x30b3bd,_0x22f202){return new BPromise(function(_0x20ac10,_0x595506){return client[_0x4a30('0x9')](_0x585f4e,_0x22f202)[_0x4a30('0xa')](function(_0x633850){logger[_0x4a30('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x30b3bd,_0x4a30('0xc'));logger[_0x4a30('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x30b3bd,_0x4a30('0xc'),JSON[_0x4a30('0xe')](_0x633850));if(_0x633850[_0x4a30('0xf')]){if(_0x633850[_0x4a30('0xf')][_0x4a30('0x10')]===0x1f4){logger[_0x4a30('0xf')](_0x4a30('0x11'),_0x30b3bd,_0x633850[_0x4a30('0xf')][_0x4a30('0x12')]);return _0x595506(_0x633850['error'][_0x4a30('0x12')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x30b3bd,_0x633850[_0x4a30('0xf')][_0x4a30('0x12')]);return _0x20ac10(_0x633850[_0x4a30('0xf')][_0x4a30('0x12')]);}else{logger[_0x4a30('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x30b3bd,_0x4a30('0xc'));_0x20ac10(_0x633850[_0x4a30('0x13')][_0x4a30('0x12')]);}})[_0x4a30('0x14')](function(_0x456683){logger['error'](_0x4a30('0x11'),_0x30b3bd,_0x456683);_0x595506(_0x456683);});});} \ No newline at end of file +var _0xdcf0=['message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x611c0e,_0x48d0ed){var _0x4372ec=function(_0x4b8b40){while(--_0x4b8b40){_0x611c0e['push'](_0x611c0e['shift']());}};_0x4372ec(++_0x48d0ed);}(_0xdcf0,0x100));var _0x0dcf=function(_0x537d86,_0x44f5da){_0x537d86=_0x537d86-0x0;var _0xb9e103=_0xdcf0[_0x537d86];return _0xb9e103;};'use strict';var _=require(_0x0dcf('0x0'));var util=require(_0x0dcf('0x1'));var moment=require(_0x0dcf('0x2'));var BPromise=require(_0x0dcf('0x3'));var rs=require(_0x0dcf('0x4'));var fs=require('fs');var Redis=require(_0x0dcf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0dcf('0x6'));var logger=require(_0x0dcf('0x7'))(_0x0dcf('0x8'));var config=require(_0x0dcf('0x9'));var jayson=require(_0x0dcf('0xa'));var client=jayson[_0x0dcf('0xb')][_0x0dcf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x167f24,_0x5467e1,_0x2a752){return new BPromise(function(_0x66e111,_0x46cad0){return client[_0x0dcf('0xd')](_0x167f24,_0x2a752)['then'](function(_0x193840){logger['info'](_0x0dcf('0xe'),_0x5467e1,_0x0dcf('0xf'));logger[_0x0dcf('0x10')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x5467e1,'request\x20sent',JSON[_0x0dcf('0x11')](_0x193840));if(_0x193840[_0x0dcf('0x12')]){if(_0x193840['error'][_0x0dcf('0x13')]===0x1f4){logger['error'](_0x0dcf('0xe'),_0x5467e1,_0x193840[_0x0dcf('0x12')][_0x0dcf('0x14')]);return _0x46cad0(_0x193840[_0x0dcf('0x12')][_0x0dcf('0x14')]);}logger[_0x0dcf('0x12')](_0x0dcf('0xe'),_0x5467e1,_0x193840[_0x0dcf('0x12')][_0x0dcf('0x14')]);return _0x66e111(_0x193840[_0x0dcf('0x12')][_0x0dcf('0x14')]);}else{logger[_0x0dcf('0x15')](_0x0dcf('0xe'),_0x5467e1,_0x0dcf('0xf'));_0x66e111(_0x193840[_0x0dcf('0x16')]['message']);}})['catch'](function(_0x10f870){logger[_0x0dcf('0x12')](_0x0dcf('0xe'),_0x5467e1,_0x10f870);_0x46cad0(_0x10f870);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 6272b97..8362fd7 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 _0x2123=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index','/:id','show','/:id/configurations','isAuthenticated','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x13f3cd,_0xad118b){var _0x82fe1a=function(_0x424372){while(--_0x424372){_0x13f3cd['push'](_0x13f3cd['shift']());}};_0x82fe1a(++_0xad118b);}(_0x2123,0x190));var _0x3212=function(_0x51dc0d,_0x17ab91){_0x51dc0d=_0x51dc0d-0x0;var _0x84f152=_0x2123[_0x51dc0d];return _0x84f152;};'use strict';var multer=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var path=require(_0x3212('0x2'));var timeout=require(_0x3212('0x3'));var express=require(_0x3212('0x4'));var router=express[_0x3212('0x5')]();var fs_extra=require(_0x3212('0x6'));var auth=require(_0x3212('0x7'));var interaction=require(_0x3212('0x8'));var config=require(_0x3212('0x9'));var controller=require(_0x3212('0xa'));router[_0x3212('0xb')]('/',auth['isAuthenticated'](),controller[_0x3212('0xc')]);router[_0x3212('0xb')](_0x3212('0xd'),auth['isAuthenticated'](),controller[_0x3212('0xe')]);router['get'](_0x3212('0xf'),auth[_0x3212('0x10')](),controller[_0x3212('0x11')]);router[_0x3212('0xb')]('/:id/fields',auth['isAuthenticated'](),controller[_0x3212('0x12')]);router[_0x3212('0x13')]('/',auth[_0x3212('0x10')](),controller[_0x3212('0x14')]);router[_0x3212('0x13')](_0x3212('0xf'),auth[_0x3212('0x10')](),controller[_0x3212('0x15')]);router[_0x3212('0x16')](_0x3212('0xd'),auth[_0x3212('0x10')](),controller[_0x3212('0x17')]);router[_0x3212('0x18')](_0x3212('0xd'),auth[_0x3212('0x10')](),controller[_0x3212('0x19')]);module[_0x3212('0x1a')]=router; \ No newline at end of file +var _0xbca0=['index','get','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','./intVtigerAccount.controller','isAuthenticated'];(function(_0x513f27,_0x37b8bc){var _0x38abee=function(_0x5c3897){while(--_0x5c3897){_0x513f27['push'](_0x513f27['shift']());}};_0x38abee(++_0x37b8bc);}(_0xbca0,0x17f));var _0x0bca=function(_0x50c930,_0x493041){_0x50c930=_0x50c930-0x0;var _0x3ac9ba=_0xbca0[_0x50c930];return _0x3ac9ba;};'use strict';var multer=require(_0x0bca('0x0'));var util=require(_0x0bca('0x1'));var path=require(_0x0bca('0x2'));var timeout=require(_0x0bca('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0bca('0x4'));var auth=require(_0x0bca('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0bca('0x6'));router['get']('/',auth[_0x0bca('0x7')](),controller[_0x0bca('0x8')]);router[_0x0bca('0x9')]('/:id',auth[_0x0bca('0x7')](),controller[_0x0bca('0xa')]);router[_0x0bca('0x9')]('/:id/configurations',auth[_0x0bca('0x7')](),controller[_0x0bca('0xb')]);router[_0x0bca('0x9')](_0x0bca('0xc'),auth[_0x0bca('0x7')](),controller[_0x0bca('0xd')]);router[_0x0bca('0xe')]('/',auth[_0x0bca('0x7')](),controller[_0x0bca('0xf')]);router[_0x0bca('0xe')](_0x0bca('0x10'),auth['isAuthenticated'](),controller[_0x0bca('0x11')]);router[_0x0bca('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x0bca('0x13')]);router[_0x0bca('0x14')](_0x0bca('0x15'),auth[_0x0bca('0x7')](),controller[_0x0bca('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 4154446..d08557c 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 _0xe160=['STRING','HelpDesk','sequelize','exports'];(function(_0x41ed78,_0x4be044){var _0x40fc6c=function(_0x3aa630){while(--_0x3aa630){_0x41ed78['push'](_0x41ed78['shift']());}};_0x40fc6c(++_0x4be044);}(_0xe160,0x1ba));var _0x0e16=function(_0x2e235a,_0x172afd){_0x2e235a=_0x2e235a-0x0;var _0x1353c3=_0xe160[_0x2e235a];return _0x1353c3;};'use strict';var Sequelize=require(_0x0e16('0x0'));module[_0x0e16('0x1')]={'name':{'type':Sequelize[_0x0e16('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x0e16('0x2')]},'username':{'type':Sequelize[_0x0e16('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x0e16('0x2')],'allowNull':![],'defaultValue':_0x0e16('0x3')},'remoteUri':{'type':Sequelize[_0x0e16('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x0e16('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x0e16('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x715e=['HelpDesk','exports','STRING'];(function(_0x418082,_0x22f950){var _0x3a57b5=function(_0x508822){while(--_0x508822){_0x418082['push'](_0x418082['shift']());}};_0x3a57b5(++_0x22f950);}(_0x715e,0x1d2));var _0xe715=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0x715e[_0x609988];return _0x159984;};'use strict';var Sequelize=require('sequelize');module[_0xe715('0x0')]={'name':{'type':Sequelize[_0xe715('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xe715('0x1')]},'username':{'type':Sequelize[_0xe715('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe715('0x2')},'remoteUri':{'type':Sequelize[_0xe715('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xe715('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xe715('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 55934da..b4cf87b 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 _0x11ea=['mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','fields','length','includeAll','create','body','find','getConfigurations','findOne','VtigerConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','VtigerField','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','%s/webservice.php','getchallenge','username','success','POST','login','result','GET','describe','sessionName','autogenerated','reference','remove','includes','editable','false','startsWith','cf_','picklist','picklistValues','value','log','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x281f02,_0xa970fb){var _0x2d773e=function(_0x496e60){while(--_0x496e60){_0x281f02['push'](_0x281f02['shift']());}};_0x2d773e(++_0xa970fb);}(_0x11ea,0x16e));var _0xa11e=function(_0x5b793f,_0x13acbc){_0x5b793f=_0x5b793f-0x0;var _0x534599=_0x11ea[_0x5b793f];return _0x534599;};'use strict';var emlformat=require(_0xa11e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa11e('0x1'));var jsonpatch=require(_0xa11e('0x2'));var rp=require(_0xa11e('0x3'));var moment=require(_0xa11e('0x4'));var BPromise=require(_0xa11e('0x5'));var Mustache=require(_0xa11e('0x6'));var util=require(_0xa11e('0x7'));var path=require('path');var sox=require(_0xa11e('0x8'));var csv=require('to-csv');var ejs=require(_0xa11e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa11e('0xa'));var squel=require('squel');var crypto=require(_0xa11e('0xb'));var jsforce=require(_0xa11e('0xc'));var deskjs=require(_0xa11e('0xd'));var toCsv=require(_0xa11e('0xe'));var querystring=require(_0xa11e('0xf'));var Papa=require(_0xa11e('0x10'));var Redis=require(_0xa11e('0x11'));var authService=require(_0xa11e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa11e('0x13'));var hardwareService=require(_0xa11e('0x14'));var logger=require('../../config/logger')(_0xa11e('0x15'));var utils=require(_0xa11e('0x16'));var config=require(_0xa11e('0x17'));var licenseUtil=require(_0xa11e('0x18'));var db=require(_0xa11e('0x19'))['db'];var integrations=require(_0xa11e('0x1a'));function respondWithStatusCode(_0x41f36d,_0x376c27){_0x376c27=_0x376c27||0xcc;return function(_0x3ddf17){if(_0x3ddf17){return _0x41f36d[_0xa11e('0x1b')](_0x376c27);}return _0x41f36d[_0xa11e('0x1c')](_0x376c27)[_0xa11e('0x1d')]();};}function respondWithResult(_0x4426de,_0x2ceb4c){_0x2ceb4c=_0x2ceb4c||0xc8;return function(_0x17f2a0){if(_0x17f2a0){return _0x4426de['status'](_0x2ceb4c)['json'](_0x17f2a0);}};}function respondWithFilteredResult(_0x2ec75c,_0x31c506){return function(_0x5247da){if(_0x5247da){var _0x55ce58=typeof _0x31c506[_0xa11e('0x1e')]===_0xa11e('0x1f')&&typeof _0x31c506[_0xa11e('0x20')]===_0xa11e('0x1f');var _0x5667aa=_0x5247da[_0xa11e('0x21')];var _0x5e26cc=_0x55ce58?0x0:_0x31c506[_0xa11e('0x1e')];var _0x524f3d=_0x55ce58?_0x5247da['count']:_0x31c506[_0xa11e('0x1e')]+_0x31c506[_0xa11e('0x20')];var _0x1619e0;if(_0x524f3d>=_0x5667aa){_0x524f3d=_0x5667aa;_0x1619e0=0xc8;}else{_0x1619e0=0xce;}_0x2ec75c[_0xa11e('0x1c')](_0x1619e0);return _0x2ec75c[_0xa11e('0x22')]('Content-Range',_0x5e26cc+'-'+_0x524f3d+'/'+_0x5667aa)['json'](_0x5247da);}return null;};}function patchUpdates(_0x6d446b){return function(_0x4dde95){try{jsonpatch[_0xa11e('0x23')](_0x4dde95,_0x6d446b,!![]);}catch(_0x2b9bbb){return BPromise[_0xa11e('0x24')](_0x2b9bbb);}return _0x4dde95[_0xa11e('0x25')]();};}function saveUpdates(_0x28d5fc,_0x2a5360){return function(_0x329051){if(_0x329051){return _0x329051[_0xa11e('0x26')](_0x28d5fc)[_0xa11e('0x27')](function(_0x28f2f3){return _0x28f2f3;});}return null;};}function removeEntity(_0xb01d82,_0x56b4f5){return function(_0x3544eb){if(_0x3544eb){return _0x3544eb['destroy']()[_0xa11e('0x27')](function(){_0xb01d82[_0xa11e('0x1c')](0xcc)[_0xa11e('0x1d')]();});}};}function handleEntityNotFound(_0xd46468,_0x17fa7e){return function(_0x31ca08){if(!_0x31ca08){_0xd46468[_0xa11e('0x1b')](0x194);}return _0x31ca08;};}function handleError(_0x57c5c0,_0x2e6b47){_0x2e6b47=_0x2e6b47||0x1f4;return function(_0x4ec650){logger[_0xa11e('0x28')](_0x4ec650[_0xa11e('0x29')]);if(_0x4ec650[_0xa11e('0x2a')]){delete _0x4ec650[_0xa11e('0x2a')];}_0x57c5c0[_0xa11e('0x1c')](_0x2e6b47)[_0xa11e('0x2b')](_0x4ec650);};}exports[_0xa11e('0x2c')]=function(_0x36af95,_0x38148a){var _0xdf1594={},_0x49f454={},_0x44e6cb={'count':0x0,'rows':[]};var _0x435770=_[_0xa11e('0x2d')](db[_0xa11e('0x2e')][_0xa11e('0x2f')],function(_0x16b15c){return{'name':_0x16b15c[_0xa11e('0x30')],'type':_0x16b15c[_0xa11e('0x31')]['key']};});_0x49f454[_0xa11e('0x32')]=_['map'](_0x435770,_0xa11e('0x2a'));_0x49f454[_0xa11e('0x33')]=_[_0xa11e('0x34')](_0x36af95['query']);_0x49f454[_0xa11e('0x35')]=_[_0xa11e('0x36')](_0x49f454['model'],_0x49f454[_0xa11e('0x33')]);_0xdf1594['attributes']=_[_0xa11e('0x36')](_0x49f454['model'],qs['fields'](_0x36af95[_0xa11e('0x33')]['fields']));_0xdf1594[_0xa11e('0x37')]=_0xdf1594['attributes']['length']?_0xdf1594[_0xa11e('0x37')]:_0x49f454[_0xa11e('0x32')];if(!_0x36af95['query'][_0xa11e('0x38')]('nolimit')){_0xdf1594['limit']=qs[_0xa11e('0x20')](_0x36af95[_0xa11e('0x33')][_0xa11e('0x20')]);_0xdf1594[_0xa11e('0x1e')]=qs[_0xa11e('0x1e')](_0x36af95['query']['offset']);}_0xdf1594[_0xa11e('0x39')]=qs[_0xa11e('0x3a')](_0x36af95[_0xa11e('0x33')][_0xa11e('0x3a')]);_0xdf1594[_0xa11e('0x3b')]=qs['filters'](_[_0xa11e('0x3c')](_0x36af95[_0xa11e('0x33')],_0x49f454[_0xa11e('0x35')]),_0x435770);if(_0x36af95['query']['filter']){_0xdf1594[_0xa11e('0x3b')]=_[_0xa11e('0x3d')](_0xdf1594[_0xa11e('0x3b')],{'$or':_[_0xa11e('0x2d')](_0x435770,function(_0x5aef1d){if(_0x5aef1d['type']!==_0xa11e('0x3e')){var _0x16a02a={};_0x16a02a[_0x5aef1d[_0xa11e('0x2a')]]={'$like':'%'+_0x36af95[_0xa11e('0x33')][_0xa11e('0x3f')]+'%'};return _0x16a02a;}})});}_0xdf1594=_[_0xa11e('0x3d')]({},_0xdf1594,_0x36af95[_0xa11e('0x40')]);var _0x1d70c6={'where':_0xdf1594[_0xa11e('0x3b')]};return db[_0xa11e('0x2e')][_0xa11e('0x21')](_0x1d70c6)[_0xa11e('0x27')](function(_0x574a1a){_0x44e6cb[_0xa11e('0x21')]=_0x574a1a;if(_0x36af95[_0xa11e('0x33')]['includeAll']){_0xdf1594[_0xa11e('0x41')]=[{'all':!![]}];}return db[_0xa11e('0x2e')][_0xa11e('0x42')](_0xdf1594);})[_0xa11e('0x27')](function(_0x27a4e4){_0x44e6cb[_0xa11e('0x43')]=_0x27a4e4;return _0x44e6cb;})[_0xa11e('0x27')](respondWithFilteredResult(_0x38148a,_0xdf1594))[_0xa11e('0x44')](handleError(_0x38148a,null));};exports[_0xa11e('0x45')]=function(_0x2a0e98,_0x1086ae){var _0x5e72cc={'raw':![],'where':{'id':_0x2a0e98[_0xa11e('0x46')]['id']}},_0x3e8a9b={};_0x3e8a9b[_0xa11e('0x32')]=_['keys'](db[_0xa11e('0x2e')]['rawAttributes']);_0x3e8a9b[_0xa11e('0x33')]=_[_0xa11e('0x34')](_0x2a0e98[_0xa11e('0x33')]);_0x3e8a9b['filters']=_[_0xa11e('0x36')](_0x3e8a9b[_0xa11e('0x32')],_0x3e8a9b[_0xa11e('0x33')]);_0x5e72cc[_0xa11e('0x37')]=_[_0xa11e('0x36')](_0x3e8a9b['model'],qs['fields'](_0x2a0e98[_0xa11e('0x33')][_0xa11e('0x47')]));_0x5e72cc[_0xa11e('0x37')]=_0x5e72cc['attributes'][_0xa11e('0x48')]?_0x5e72cc[_0xa11e('0x37')]:_0x3e8a9b['model'];if(_0x2a0e98[_0xa11e('0x33')][_0xa11e('0x49')]){_0x5e72cc[_0xa11e('0x41')]=[{'all':!![]}];}_0x5e72cc=_['merge']({},_0x5e72cc,_0x2a0e98['options']);return db['VtigerAccount']['find'](_0x5e72cc)['then'](handleEntityNotFound(_0x1086ae,null))[_0xa11e('0x27')](respondWithResult(_0x1086ae,null))[_0xa11e('0x44')](handleError(_0x1086ae,null));};exports['create']=function(_0x2f5a9a,_0x30efd4){return db['VtigerAccount'][_0xa11e('0x4a')](_0x2f5a9a['body'],{})[_0xa11e('0x27')](respondWithResult(_0x30efd4,0xc9))[_0xa11e('0x44')](handleError(_0x30efd4,null));};exports[_0xa11e('0x26')]=function(_0x3bd757,_0xd0e863){if(_0x3bd757[_0xa11e('0x4b')]['id']){delete _0x3bd757['body']['id'];}return db[_0xa11e('0x2e')][_0xa11e('0x4c')]({'where':{'id':_0x3bd757['params']['id']}})[_0xa11e('0x27')](handleEntityNotFound(_0xd0e863,null))[_0xa11e('0x27')](saveUpdates(_0x3bd757[_0xa11e('0x4b')],null))['then'](respondWithResult(_0xd0e863,null))[_0xa11e('0x44')](handleError(_0xd0e863,null));};exports['destroy']=function(_0x15e007,_0x51dcea){return db[_0xa11e('0x2e')][_0xa11e('0x4c')]({'where':{'id':_0x15e007[_0xa11e('0x46')]['id']}})[_0xa11e('0x27')](handleEntityNotFound(_0x51dcea,null))[_0xa11e('0x27')](removeEntity(_0x51dcea,null))[_0xa11e('0x44')](handleError(_0x51dcea,null));};exports[_0xa11e('0x4d')]=function(_0x2b3f4c,_0x507079,_0xe357f6){var _0x1edb1d={};var _0x5b7d69={};var _0x4b4a16;var _0x5cf8b7;return db[_0xa11e('0x2e')][_0xa11e('0x4e')]({'where':{'id':_0x2b3f4c[_0xa11e('0x46')]['id']}})['then'](handleEntityNotFound(_0x507079,null))[_0xa11e('0x27')](function(_0x3a6a4f){if(_0x3a6a4f){_0x4b4a16=_0x3a6a4f;_0x5b7d69[_0xa11e('0x32')]=_['keys'](db[_0xa11e('0x4f')][_0xa11e('0x2f')]);_0x5b7d69[_0xa11e('0x33')]=_[_0xa11e('0x34')](_0x2b3f4c[_0xa11e('0x33')]);_0x5b7d69['filters']=_['intersection'](_0x5b7d69[_0xa11e('0x32')],_0x5b7d69[_0xa11e('0x33')]);_0x1edb1d['attributes']=_['intersection'](_0x5b7d69[_0xa11e('0x32')],qs[_0xa11e('0x47')](_0x2b3f4c[_0xa11e('0x33')]['fields']));_0x1edb1d[_0xa11e('0x37')]=_0x1edb1d[_0xa11e('0x37')]['length']?_0x1edb1d[_0xa11e('0x37')]:_0x5b7d69[_0xa11e('0x32')];_0x1edb1d[_0xa11e('0x39')]=qs[_0xa11e('0x3a')](_0x2b3f4c['query']['sort']);_0x1edb1d[_0xa11e('0x3b')]=qs[_0xa11e('0x35')](_[_0xa11e('0x3c')](_0x2b3f4c[_0xa11e('0x33')],_0x5b7d69[_0xa11e('0x35')]));if(_0x2b3f4c[_0xa11e('0x33')][_0xa11e('0x3f')]){_0x1edb1d['where']=_[_0xa11e('0x3d')](_0x1edb1d['where'],{'$or':_['map'](_0x1edb1d[_0xa11e('0x37')],function(_0x3fffe0){var _0x59b8b8={};_0x59b8b8[_0x3fffe0]={'$like':'%'+_0x2b3f4c[_0xa11e('0x33')]['filter']+'%'};return _0x59b8b8;})});}_0x1edb1d=_['merge']({},_0x1edb1d,_0x2b3f4c[_0xa11e('0x40')]);return _0x4b4a16['getConfigurations'](_0x1edb1d);}})['then'](function(_0x2457cd){if(_0x2457cd){_0x5cf8b7=_0x2457cd[_0xa11e('0x48')];if(!_0x2b3f4c[_0xa11e('0x33')][_0xa11e('0x38')](_0xa11e('0x50'))){_0x1edb1d['limit']=qs[_0xa11e('0x20')](_0x2b3f4c[_0xa11e('0x33')]['limit']);_0x1edb1d[_0xa11e('0x1e')]=qs[_0xa11e('0x1e')](_0x2b3f4c[_0xa11e('0x33')]['offset']);}return _0x4b4a16[_0xa11e('0x4d')](_0x1edb1d);}})[_0xa11e('0x27')](function(_0x5e4480){if(_0x5e4480){return _0x5e4480?{'count':_0x5cf8b7,'rows':_0x5e4480}:null;}})[_0xa11e('0x27')](respondWithResult(_0x507079,null))['catch'](handleError(_0x507079,null));};exports[_0xa11e('0x51')]=function(_0xf9bb3b,_0x4de90d,_0x4e81d1){if(_0xf9bb3b['body']['id']){delete _0xf9bb3b[_0xa11e('0x4b')]['id'];}return db['VtigerAccount'][_0xa11e('0x4e')]({'where':{'id':_0xf9bb3b[_0xa11e('0x46')]['id']}})[_0xa11e('0x27')](handleEntityNotFound(_0x4de90d,null))[_0xa11e('0x27')](function(_0x448cb9){if(_0x448cb9){_0xf9bb3b[_0xa11e('0x4b')][_0xa11e('0x52')]=_0x448cb9['id'];_0xf9bb3b['body'][_0xa11e('0x53')]=integrations[_0xa11e('0x54')](_0xf9bb3b[_0xa11e('0x4b')]['channel'],_0xf9bb3b[_0xa11e('0x4b')][_0xa11e('0x31')]);_0xf9bb3b[_0xa11e('0x4b')][_0xa11e('0x55')]=integrations['getDescriptions'](_0xf9bb3b[_0xa11e('0x4b')][_0xa11e('0x56')],_0xf9bb3b[_0xa11e('0x4b')][_0xa11e('0x31')]);return db['VtigerConfiguration'][_0xa11e('0x4a')](_0xf9bb3b[_0xa11e('0x4b')],{'include':[{'model':db['VtigerField'],'as':_0xa11e('0x53')},{'model':db[_0xa11e('0x57')],'as':_0xa11e('0x55')}]});}return null;})['then'](respondWithResult(_0x4de90d,null))[_0xa11e('0x44')](handleError(_0x4de90d,null));};var md5=require(_0xa11e('0x58'));exports[_0xa11e('0x59')]=function(_0x56163e,_0x547767,_0x567d11){var _0x280772=null;var _0x2eab8f=null;var _0x23c6d2=null;var _0x354f15=null;var _0x519cc7='';return db[_0xa11e('0x2e')][_0xa11e('0x4e')]({'where':{'id':_0x56163e[_0xa11e('0x46')]['id']},'attributes':['id',_0xa11e('0x2a'),'username',_0xa11e('0x5a'),_0xa11e('0x5b'),_0xa11e('0x5c'),_0xa11e('0x5d'),'accessKey']})[_0xa11e('0x27')](handleEntityNotFound(_0x547767,null))[_0xa11e('0x27')](function(_0x5d0d7a){if(_0x5d0d7a){_0x280772=_0x5d0d7a['username'];_0x2eab8f=_0x5d0d7a[_0xa11e('0x5e')];_0x23c6d2=_0x5d0d7a[_0xa11e('0x5b')];_0x519cc7=_0x5d0d7a[_0xa11e('0x5c')];var _0x2a02d5=_0x519cc7['slice'](-0x1);if(_0x2a02d5==='/'){_0x519cc7=_0x519cc7[_0xa11e('0x5f')](0x0,_0x519cc7[_0xa11e('0x60')](_0x2a02d5));}_0x354f15=util['format'](_0xa11e('0x61'),_0x519cc7);var _0x1b7f9e={'method':'GET','uri':_0x354f15,'qs':{'operation':_0xa11e('0x62'),'username':_0x5d0d7a[_0xa11e('0x63')]},'json':!![]};return rp(_0x1b7f9e);}})[_0xa11e('0x27')](function(_0x2c20ad){if(_0x2c20ad[_0xa11e('0x64')]){var _0x510df1={'method':_0xa11e('0x65'),'uri':_0x354f15,'form':{'operation':_0xa11e('0x66'),'username':_0x280772,'accessKey':md5(_0x2c20ad[_0xa11e('0x67')]['token']+_0x2eab8f)},'json':!![]};return rp(_0x510df1);}})[_0xa11e('0x27')](function(_0x3d2f76){if(_0x3d2f76['success']){var _0x3787cd={'method':_0xa11e('0x68'),'uri':_0x354f15,'qs':{'operation':_0xa11e('0x69'),'username':_0x280772,'sessionName':_0x3d2f76[_0xa11e('0x67')][_0xa11e('0x6a')],'elementType':_0x23c6d2},'json':!![]};return rp(_0x3787cd);}})[_0xa11e('0x27')](function(_0x1ae530){if(_0x1ae530[_0xa11e('0x64')]){var _0x4be17d=[_0xa11e('0x6b'),_0xa11e('0x6c'),'owner'];_[_0xa11e('0x6d')](_0x1ae530[_0xa11e('0x67')]['fields'],function(_0x4addae){return _0x4be17d[_0xa11e('0x6e')](_0x4addae[_0xa11e('0x31')][_0xa11e('0x2a')]);});_[_0xa11e('0x6d')](_0x1ae530[_0xa11e('0x67')]['fields'],function(_0x3b53ac){return _0x3b53ac[_0xa11e('0x6f')]===_0xa11e('0x70');});return{'count':_0x1ae530['result'][_0xa11e('0x47')][_0xa11e('0x48')],'rows':_['map'](_0x1ae530[_0xa11e('0x67')][_0xa11e('0x47')],function(_0x1f50ca){return{'id':_0x1f50ca['name'],'name':_0x1f50ca['label'],'custom':_[_0xa11e('0x71')](_0x1f50ca[_0xa11e('0x2a')],_0xa11e('0x72'))?!![]:![],'options':_0x1f50ca[_0xa11e('0x31')]['name']===_0xa11e('0x73')&&_0x1f50ca['type'][_0xa11e('0x74')]['length']>0x0?_['map'](_0x1f50ca[_0xa11e('0x31')][_0xa11e('0x74')],function(_0x47c00e){return{'name':_0x47c00e['label'],'value':_0x47c00e[_0xa11e('0x75')]};}):[]};})};}})[_0xa11e('0x27')](respondWithResult(_0x547767,null))[_0xa11e('0x44')](function(_0x3d30df){console[_0xa11e('0x76')]('vTiger\x20error:\x20'+_0x3d30df);var _0x998da1=_0x56163e[_0xa11e('0x33')][_0xa11e('0x77')]?0x1f4:_0x3d30df['statusCode']||0x1f4;logger[_0xa11e('0x28')](_0xa11e('0x78'),_0xa11e('0x59'),_0x998da1,JSON[_0xa11e('0x79')](_0x3d30df));delete _0x3d30df[_0xa11e('0x2a')];if(_0x998da1===0x191){_0x998da1=0x190;}_0x547767[_0xa11e('0x1c')](_0x998da1)[_0xa11e('0x2b')](_0x56163e['query']['test']?{'message':_0xa11e('0x7a'),'statusCode':_0x3d30df[_0xa11e('0x7b')]}:_0x3d30df);});}; \ No newline at end of file +var _0x3153=['includes','remove','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','key','query','model','attributes','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','options','includeAll','VtigerAccount','findAll','rows','catch','show','params','keys','intersection','include','merge','find','create','body','getConfigurations','findOne','VtigerConfiguration','rawAttributes','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','type','Descriptions','getDescriptions','VtigerField','getFields','remoteUri','accessKey','username','moduleName','substring','lastIndexOf','format','GET','getchallenge','success','POST','login','result','token','describe','sessionName','reference','owner'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3153,0xff));var _0x3315=function(_0x39f291,_0x48fa7e){_0x39f291=_0x39f291-0x0;var _0x2e0aa2=_0x3153[_0x39f291];return _0x2e0aa2;};'use strict';var emlformat=require(_0x3315('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3315('0x1'));var rp=require(_0x3315('0x2'));var moment=require(_0x3315('0x3'));var BPromise=require(_0x3315('0x4'));var Mustache=require(_0x3315('0x5'));var util=require(_0x3315('0x6'));var path=require(_0x3315('0x7'));var sox=require('sox');var csv=require(_0x3315('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3315('0x9'));var _=require('lodash');var squel=require(_0x3315('0xa'));var crypto=require(_0x3315('0xb'));var jsforce=require(_0x3315('0xc'));var deskjs=require(_0x3315('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3315('0xe'));var Papa=require(_0x3315('0xf'));var Redis=require(_0x3315('0x10'));var authService=require(_0x3315('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3315('0x12'));var logger=require(_0x3315('0x13'))(_0x3315('0x14'));var utils=require('../../config/utils');var config=require(_0x3315('0x15'));var licenseUtil=require(_0x3315('0x16'));var db=require(_0x3315('0x17'))['db'];var integrations=require(_0x3315('0x18'));function respondWithStatusCode(_0x441e77,_0x5bd8af){_0x5bd8af=_0x5bd8af||0xcc;return function(_0xfda1cf){if(_0xfda1cf){return _0x441e77[_0x3315('0x19')](_0x5bd8af);}return _0x441e77[_0x3315('0x1a')](_0x5bd8af)[_0x3315('0x1b')]();};}function respondWithResult(_0x40f583,_0x3a2bd8){_0x3a2bd8=_0x3a2bd8||0xc8;return function(_0x2a0fee){if(_0x2a0fee){return _0x40f583[_0x3315('0x1a')](_0x3a2bd8)[_0x3315('0x1c')](_0x2a0fee);}};}function respondWithFilteredResult(_0x5b87fe,_0x3574bb){return function(_0xb6b772){if(_0xb6b772){var _0x3b7e6b=typeof _0x3574bb[_0x3315('0x1d')]===_0x3315('0x1e')&&typeof _0x3574bb[_0x3315('0x1f')]===_0x3315('0x1e');var _0x486fe2=_0xb6b772[_0x3315('0x20')];var _0x4ad50d=_0x3b7e6b?0x0:_0x3574bb[_0x3315('0x1d')];var _0x3d4f13=_0x3b7e6b?_0xb6b772[_0x3315('0x20')]:_0x3574bb[_0x3315('0x1d')]+_0x3574bb[_0x3315('0x1f')];var _0x1e3512;if(_0x3d4f13>=_0x486fe2){_0x3d4f13=_0x486fe2;_0x1e3512=0xc8;}else{_0x1e3512=0xce;}_0x5b87fe[_0x3315('0x1a')](_0x1e3512);return _0x5b87fe['set'](_0x3315('0x21'),_0x4ad50d+'-'+_0x3d4f13+'/'+_0x486fe2)[_0x3315('0x1c')](_0xb6b772);}return null;};}function patchUpdates(_0x1b1b67){return function(_0x3e622c){try{jsonpatch['apply'](_0x3e622c,_0x1b1b67,!![]);}catch(_0x3e191b){return BPromise[_0x3315('0x22')](_0x3e191b);}return _0x3e622c[_0x3315('0x23')]();};}function saveUpdates(_0x4cd907,_0x94c460){return function(_0x1f5dc2){if(_0x1f5dc2){return _0x1f5dc2[_0x3315('0x24')](_0x4cd907)[_0x3315('0x25')](function(_0x143691){return _0x143691;});}return null;};}function removeEntity(_0x21b62b,_0x6407b1){return function(_0x12c85c){if(_0x12c85c){return _0x12c85c[_0x3315('0x26')]()[_0x3315('0x25')](function(){_0x21b62b[_0x3315('0x1a')](0xcc)[_0x3315('0x1b')]();});}};}function handleEntityNotFound(_0x32f95a,_0x4f46a2){return function(_0xae6f42){if(!_0xae6f42){_0x32f95a['sendStatus'](0x194);}return _0xae6f42;};}function handleError(_0x433eb0,_0x3e9092){_0x3e9092=_0x3e9092||0x1f4;return function(_0x459537){logger[_0x3315('0x27')](_0x459537[_0x3315('0x28')]);if(_0x459537[_0x3315('0x29')]){delete _0x459537[_0x3315('0x29')];}_0x433eb0[_0x3315('0x1a')](_0x3e9092)[_0x3315('0x2a')](_0x459537);};}exports[_0x3315('0x2b')]=function(_0x3eae17,_0x55d49b){var _0x3d32c6={},_0x5f415b={},_0x1d9016={'count':0x0,'rows':[]};var _0xba9b87=_[_0x3315('0x2c')](db['VtigerAccount']['rawAttributes'],function(_0x52f40c){return{'name':_0x52f40c['fieldName'],'type':_0x52f40c['type'][_0x3315('0x2d')]};});_0x5f415b['model']=_[_0x3315('0x2c')](_0xba9b87,'name');_0x5f415b[_0x3315('0x2e')]=_['keys'](_0x3eae17[_0x3315('0x2e')]);_0x5f415b['filters']=_['intersection'](_0x5f415b[_0x3315('0x2f')],_0x5f415b[_0x3315('0x2e')]);_0x3d32c6[_0x3315('0x30')]=_['intersection'](_0x5f415b[_0x3315('0x2f')],qs[_0x3315('0x31')](_0x3eae17['query']['fields']));_0x3d32c6[_0x3315('0x30')]=_0x3d32c6[_0x3315('0x30')][_0x3315('0x32')]?_0x3d32c6[_0x3315('0x30')]:_0x5f415b[_0x3315('0x2f')];if(!_0x3eae17['query']['hasOwnProperty'](_0x3315('0x33'))){_0x3d32c6[_0x3315('0x1f')]=qs[_0x3315('0x1f')](_0x3eae17[_0x3315('0x2e')]['limit']);_0x3d32c6[_0x3315('0x1d')]=qs[_0x3315('0x1d')](_0x3eae17[_0x3315('0x2e')][_0x3315('0x1d')]);}_0x3d32c6[_0x3315('0x34')]=qs['sort'](_0x3eae17[_0x3315('0x2e')][_0x3315('0x35')]);_0x3d32c6[_0x3315('0x36')]=qs['filters'](_['pick'](_0x3eae17[_0x3315('0x2e')],_0x5f415b[_0x3315('0x37')]),_0xba9b87);if(_0x3eae17[_0x3315('0x2e')][_0x3315('0x38')]){_0x3d32c6[_0x3315('0x36')]=_['merge'](_0x3d32c6[_0x3315('0x36')],{'$or':_[_0x3315('0x2c')](_0xba9b87,function(_0x556930){if(_0x556930['type']!==_0x3315('0x39')){var _0x3bcdfb={};_0x3bcdfb[_0x556930['name']]={'$like':'%'+_0x3eae17[_0x3315('0x2e')]['filter']+'%'};return _0x3bcdfb;}})});}_0x3d32c6=_['merge']({},_0x3d32c6,_0x3eae17[_0x3315('0x3a')]);var _0x56149e={'where':_0x3d32c6['where']};return db['VtigerAccount'][_0x3315('0x20')](_0x56149e)['then'](function(_0xfe8f17){_0x1d9016[_0x3315('0x20')]=_0xfe8f17;if(_0x3eae17[_0x3315('0x2e')][_0x3315('0x3b')]){_0x3d32c6['include']=[{'all':!![]}];}return db[_0x3315('0x3c')][_0x3315('0x3d')](_0x3d32c6);})['then'](function(_0x5a1be7){_0x1d9016[_0x3315('0x3e')]=_0x5a1be7;return _0x1d9016;})[_0x3315('0x25')](respondWithFilteredResult(_0x55d49b,_0x3d32c6))[_0x3315('0x3f')](handleError(_0x55d49b,null));};exports[_0x3315('0x40')]=function(_0x709913,_0x10a1d3){var _0x53def9={'raw':![],'where':{'id':_0x709913[_0x3315('0x41')]['id']}},_0x264028={};_0x264028['model']=_['keys'](db[_0x3315('0x3c')]['rawAttributes']);_0x264028[_0x3315('0x2e')]=_[_0x3315('0x42')](_0x709913[_0x3315('0x2e')]);_0x264028[_0x3315('0x37')]=_[_0x3315('0x43')](_0x264028['model'],_0x264028[_0x3315('0x2e')]);_0x53def9['attributes']=_[_0x3315('0x43')](_0x264028['model'],qs['fields'](_0x709913[_0x3315('0x2e')][_0x3315('0x31')]));_0x53def9['attributes']=_0x53def9[_0x3315('0x30')][_0x3315('0x32')]?_0x53def9[_0x3315('0x30')]:_0x264028[_0x3315('0x2f')];if(_0x709913[_0x3315('0x2e')][_0x3315('0x3b')]){_0x53def9[_0x3315('0x44')]=[{'all':!![]}];}_0x53def9=_[_0x3315('0x45')]({},_0x53def9,_0x709913[_0x3315('0x3a')]);return db[_0x3315('0x3c')][_0x3315('0x46')](_0x53def9)[_0x3315('0x25')](handleEntityNotFound(_0x10a1d3,null))[_0x3315('0x25')](respondWithResult(_0x10a1d3,null))[_0x3315('0x3f')](handleError(_0x10a1d3,null));};exports[_0x3315('0x47')]=function(_0x4ab5e3,_0x4f1a26){return db[_0x3315('0x3c')]['create'](_0x4ab5e3[_0x3315('0x48')],{})[_0x3315('0x25')](respondWithResult(_0x4f1a26,0xc9))[_0x3315('0x3f')](handleError(_0x4f1a26,null));};exports[_0x3315('0x24')]=function(_0x5ccd4d,_0x1bbead){if(_0x5ccd4d[_0x3315('0x48')]['id']){delete _0x5ccd4d[_0x3315('0x48')]['id'];}return db['VtigerAccount'][_0x3315('0x46')]({'where':{'id':_0x5ccd4d[_0x3315('0x41')]['id']}})[_0x3315('0x25')](handleEntityNotFound(_0x1bbead,null))[_0x3315('0x25')](saveUpdates(_0x5ccd4d[_0x3315('0x48')],null))[_0x3315('0x25')](respondWithResult(_0x1bbead,null))[_0x3315('0x3f')](handleError(_0x1bbead,null));};exports[_0x3315('0x26')]=function(_0x392a7a,_0x31319d){return db[_0x3315('0x3c')][_0x3315('0x46')]({'where':{'id':_0x392a7a[_0x3315('0x41')]['id']}})['then'](handleEntityNotFound(_0x31319d,null))[_0x3315('0x25')](removeEntity(_0x31319d,null))[_0x3315('0x3f')](handleError(_0x31319d,null));};exports[_0x3315('0x49')]=function(_0x35e458,_0x467d23,_0x1926c7){var _0xcb3591={};var _0x57670f={};var _0x32b424;var _0x1ca761;return db['VtigerAccount'][_0x3315('0x4a')]({'where':{'id':_0x35e458[_0x3315('0x41')]['id']}})[_0x3315('0x25')](handleEntityNotFound(_0x467d23,null))[_0x3315('0x25')](function(_0x456959){if(_0x456959){_0x32b424=_0x456959;_0x57670f[_0x3315('0x2f')]=_[_0x3315('0x42')](db[_0x3315('0x4b')][_0x3315('0x4c')]);_0x57670f[_0x3315('0x2e')]=_[_0x3315('0x42')](_0x35e458[_0x3315('0x2e')]);_0x57670f[_0x3315('0x37')]=_['intersection'](_0x57670f['model'],_0x57670f[_0x3315('0x2e')]);_0xcb3591[_0x3315('0x30')]=_['intersection'](_0x57670f[_0x3315('0x2f')],qs[_0x3315('0x31')](_0x35e458['query'][_0x3315('0x31')]));_0xcb3591['attributes']=_0xcb3591[_0x3315('0x30')][_0x3315('0x32')]?_0xcb3591[_0x3315('0x30')]:_0x57670f['model'];_0xcb3591['order']=qs['sort'](_0x35e458[_0x3315('0x2e')][_0x3315('0x35')]);_0xcb3591[_0x3315('0x36')]=qs[_0x3315('0x37')](_['pick'](_0x35e458[_0x3315('0x2e')],_0x57670f[_0x3315('0x37')]));if(_0x35e458[_0x3315('0x2e')][_0x3315('0x38')]){_0xcb3591['where']=_['merge'](_0xcb3591['where'],{'$or':_[_0x3315('0x2c')](_0xcb3591['attributes'],function(_0x289220){var _0x2bb042={};_0x2bb042[_0x289220]={'$like':'%'+_0x35e458[_0x3315('0x2e')][_0x3315('0x38')]+'%'};return _0x2bb042;})});}_0xcb3591=_[_0x3315('0x45')]({},_0xcb3591,_0x35e458[_0x3315('0x3a')]);return _0x32b424['getConfigurations'](_0xcb3591);}})['then'](function(_0x4c044a){if(_0x4c044a){_0x1ca761=_0x4c044a[_0x3315('0x32')];if(!_0x35e458[_0x3315('0x2e')][_0x3315('0x4d')](_0x3315('0x33'))){_0xcb3591['limit']=qs['limit'](_0x35e458[_0x3315('0x2e')][_0x3315('0x1f')]);_0xcb3591[_0x3315('0x1d')]=qs['offset'](_0x35e458[_0x3315('0x2e')]['offset']);}return _0x32b424[_0x3315('0x49')](_0xcb3591);}})['then'](function(_0x564346){if(_0x564346){return _0x564346?{'count':_0x1ca761,'rows':_0x564346}:null;}})[_0x3315('0x25')](respondWithResult(_0x467d23,null))[_0x3315('0x3f')](handleError(_0x467d23,null));};exports[_0x3315('0x4e')]=function(_0x2beb6f,_0x379ccb,_0x399161){if(_0x2beb6f['body']['id']){delete _0x2beb6f[_0x3315('0x48')]['id'];}return db[_0x3315('0x3c')]['findOne']({'where':{'id':_0x2beb6f[_0x3315('0x41')]['id']}})[_0x3315('0x25')](handleEntityNotFound(_0x379ccb,null))[_0x3315('0x25')](function(_0x4cbd56){if(_0x4cbd56){_0x2beb6f[_0x3315('0x48')][_0x3315('0x4f')]=_0x4cbd56['id'];_0x2beb6f[_0x3315('0x48')][_0x3315('0x50')]=integrations['getSubjects'](_0x2beb6f[_0x3315('0x48')][_0x3315('0x51')],_0x2beb6f['body'][_0x3315('0x52')]);_0x2beb6f[_0x3315('0x48')][_0x3315('0x53')]=integrations[_0x3315('0x54')](_0x2beb6f[_0x3315('0x48')][_0x3315('0x51')],_0x2beb6f[_0x3315('0x48')][_0x3315('0x52')]);return db['VtigerConfiguration'][_0x3315('0x47')](_0x2beb6f[_0x3315('0x48')],{'include':[{'model':db[_0x3315('0x55')],'as':_0x3315('0x50')},{'model':db[_0x3315('0x55')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x379ccb,null))[_0x3315('0x3f')](handleError(_0x379ccb,null));};var md5=require('md5');exports[_0x3315('0x56')]=function(_0x302de8,_0x45dcf0,_0x3651a8){var _0x3a2f10=null;var _0x403c6c=null;var _0x54abbb=null;var _0x2d45ef=null;var _0x240d4d='';return db[_0x3315('0x3c')][_0x3315('0x4a')]({'where':{'id':_0x302de8[_0x3315('0x41')]['id']},'attributes':['id',_0x3315('0x29'),'username','description','moduleName',_0x3315('0x57'),'serverUrl',_0x3315('0x58')]})[_0x3315('0x25')](handleEntityNotFound(_0x45dcf0,null))[_0x3315('0x25')](function(_0x34b26a){if(_0x34b26a){_0x3a2f10=_0x34b26a[_0x3315('0x59')];_0x403c6c=_0x34b26a[_0x3315('0x58')];_0x54abbb=_0x34b26a[_0x3315('0x5a')];_0x240d4d=_0x34b26a[_0x3315('0x57')];var _0x54b908=_0x240d4d['slice'](-0x1);if(_0x54b908==='/'){_0x240d4d=_0x240d4d[_0x3315('0x5b')](0x0,_0x240d4d[_0x3315('0x5c')](_0x54b908));}_0x2d45ef=util[_0x3315('0x5d')]('%s/webservice.php',_0x240d4d);var _0x2f7cbd={'method':_0x3315('0x5e'),'uri':_0x2d45ef,'qs':{'operation':_0x3315('0x5f'),'username':_0x34b26a['username']},'json':!![]};return rp(_0x2f7cbd);}})[_0x3315('0x25')](function(_0x15232c){if(_0x15232c[_0x3315('0x60')]){var _0x16034f={'method':_0x3315('0x61'),'uri':_0x2d45ef,'form':{'operation':_0x3315('0x62'),'username':_0x3a2f10,'accessKey':md5(_0x15232c[_0x3315('0x63')][_0x3315('0x64')]+_0x403c6c)},'json':!![]};return rp(_0x16034f);}})['then'](function(_0x33bcc7){if(_0x33bcc7[_0x3315('0x60')]){var _0x48e4ca={'method':'GET','uri':_0x2d45ef,'qs':{'operation':_0x3315('0x65'),'username':_0x3a2f10,'sessionName':_0x33bcc7[_0x3315('0x63')][_0x3315('0x66')],'elementType':_0x54abbb},'json':!![]};return rp(_0x48e4ca);}})[_0x3315('0x25')](function(_0x1a02ff){if(_0x1a02ff[_0x3315('0x60')]){var _0x26032f=['autogenerated',_0x3315('0x67'),_0x3315('0x68')];_['remove'](_0x1a02ff[_0x3315('0x63')][_0x3315('0x31')],function(_0xe1d245){return _0x26032f[_0x3315('0x69')](_0xe1d245[_0x3315('0x52')]['name']);});_[_0x3315('0x6a')](_0x1a02ff['result']['fields'],function(_0x319933){return _0x319933['editable']===_0x3315('0x6b');});return{'count':_0x1a02ff[_0x3315('0x63')][_0x3315('0x31')][_0x3315('0x32')],'rows':_[_0x3315('0x2c')](_0x1a02ff[_0x3315('0x63')]['fields'],function(_0x3dff6b){return{'id':_0x3dff6b[_0x3315('0x29')],'name':_0x3dff6b[_0x3315('0x6c')],'custom':_[_0x3315('0x6d')](_0x3dff6b[_0x3315('0x29')],_0x3315('0x6e'))?!![]:![],'options':_0x3dff6b[_0x3315('0x52')]['name']===_0x3315('0x6f')&&_0x3dff6b[_0x3315('0x52')]['picklistValues'][_0x3315('0x32')]>0x0?_[_0x3315('0x2c')](_0x3dff6b[_0x3315('0x52')][_0x3315('0x70')],function(_0x4b8e43){return{'name':_0x4b8e43['label'],'value':_0x4b8e43[_0x3315('0x71')]};}):[]};})};}})[_0x3315('0x25')](respondWithResult(_0x45dcf0,null))[_0x3315('0x3f')](function(_0x50c418){console[_0x3315('0x72')](_0x3315('0x73')+_0x50c418);var _0x15ef5b=_0x302de8[_0x3315('0x2e')]['test']?0x1f4:_0x50c418[_0x3315('0x74')]||0x1f4;logger['error'](_0x3315('0x75'),_0x3315('0x56'),_0x15ef5b,JSON[_0x3315('0x76')](_0x50c418));delete _0x50c418[_0x3315('0x29')];if(_0x15ef5b===0x191){_0x15ef5b=0x190;}_0x45dcf0[_0x3315('0x1a')](_0x15ef5b)['send'](_0x302de8[_0x3315('0x2e')][_0x3315('0x77')]?{'message':'Wrong\x20credentials','statusCode':_0x50c418[_0x3315('0x74')]}:_0x50c418);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index d01b4ee..27fb4dc 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 _0x161d=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','define','lodash','../../config/logger','api','moment'];(function(_0x57bb26,_0xefbc2f){var _0xe63497=function(_0xa02d3a){while(--_0xa02d3a){_0x57bb26['push'](_0x57bb26['shift']());}};_0xe63497(++_0xefbc2f);}(_0x161d,0x13b));var _0xd161=function(_0x5a4fba,_0x2eea9c){_0x5a4fba=_0x5a4fba-0x0;var _0x3e99a3=_0x161d[_0x5a4fba];return _0x3e99a3;};'use strict';var _=require(_0xd161('0x0'));var util=require('util');var logger=require(_0xd161('0x1'))(_0xd161('0x2'));var moment=require(_0xd161('0x3'));var BPromise=require(_0xd161('0x4'));var rp=require(_0xd161('0x5'));var fs=require('fs');var path=require(_0xd161('0x6'));var rimraf=require(_0xd161('0x7'));var config=require(_0xd161('0x8'));var attributes=require(_0xd161('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2aa712,_0x4ec2f8){return _0x2aa712[_0xd161('0xa')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x04a2=['../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4c49a5,_0x698519){var _0x3e9d8c=function(_0x3ed3ad){while(--_0x3ed3ad){_0x4c49a5['push'](_0x4c49a5['shift']());}};_0x3e9d8c(++_0x698519);}(_0x04a2,0x147));var _0x204a=function(_0x18830c,_0x9121ca){_0x18830c=_0x18830c-0x0;var _0x145e7a=_0x04a2[_0x18830c];return _0x145e7a;};'use strict';var _=require(_0x204a('0x0'));var util=require(_0x204a('0x1'));var logger=require(_0x204a('0x2'))(_0x204a('0x3'));var moment=require(_0x204a('0x4'));var BPromise=require(_0x204a('0x5'));var rp=require(_0x204a('0x6'));var fs=require('fs');var path=require(_0x204a('0x7'));var rimraf=require(_0x204a('0x8'));var config=require(_0x204a('0x9'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x204a('0xa'));module[_0x204a('0xb')]=function(_0x286d44,_0x47448d){return _0x286d44[_0x204a('0xc')](_0x204a('0xd'),attributes,{'tableName':'int_vtiger_accounts','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 366d24b..02078be 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 _0x4fc2=['rpc','../../config/environment','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','where','attributes','include','model','map','GetVtigerAccount','VtigerAccount','find','raw','ShowVtigerAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x587439,_0x153c32){var _0x138c81=function(_0x36bb26){while(--_0x36bb26){_0x587439['push'](_0x587439['shift']());}};_0x138c81(++_0x153c32);}(_0x4fc2,0x111));var _0x24fc=function(_0x4e2861,_0x199be0){_0x4e2861=_0x4e2861-0x0;var _0x2265e3=_0x4fc2[_0x4e2861];return _0x2265e3;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var moment=require(_0x24fc('0x2'));var BPromise=require(_0x24fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24fc('0x4'));var db=require(_0x24fc('0x5'))['db'];var utils=require(_0x24fc('0x6'));var logger=require('../../config/logger')(_0x24fc('0x7'));var config=require(_0x24fc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x24fc('0x9')][_0x24fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4889f4,_0x115851,_0x22a0c8){return new BPromise(function(_0x220f9a,_0x123eff){return client[_0x24fc('0xb')](_0x4889f4,_0x22a0c8)[_0x24fc('0xc')](function(_0x5afdf1){logger[_0x24fc('0xd')](_0x24fc('0xe'),_0x115851,_0x24fc('0xf'));logger[_0x24fc('0x10')](_0x24fc('0x11'),_0x115851,_0x24fc('0xf'),JSON[_0x24fc('0x12')](_0x5afdf1));if(_0x5afdf1[_0x24fc('0x13')]){if(_0x5afdf1['error'][_0x24fc('0x14')]===0x1f4){logger[_0x24fc('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x115851,_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);return _0x123eff(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x5afdf1['error'][_0x24fc('0x15')]);return _0x220f9a(_0x5afdf1[_0x24fc('0x13')][_0x24fc('0x15')]);}else{logger[_0x24fc('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x115851,_0x24fc('0xf'));_0x220f9a(_0x5afdf1['result'][_0x24fc('0x15')]);}})[_0x24fc('0x16')](function(_0x218fb6){logger[_0x24fc('0x13')](_0x24fc('0xe'),_0x115851,_0x218fb6);_0x123eff(_0x218fb6);});});}exports['GetVtigerAccount']=function(_0x23873c){var _0x1cb3d0=this;return new Promise(function(_0x6cfa0a,_0x8ac114){return db['VtigerAccount'][_0x24fc('0x17')]({'raw':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')][_0x24fc('0x19')]||null:null,'attributes':_0x23873c[_0x24fc('0x18')]?_0x23873c['options'][_0x24fc('0x1a')]||null:null,'limit':_0x23873c['options']?_0x23873c[_0x24fc('0x18')]['limit']||null:null,'include':_0x23873c[_0x24fc('0x18')]?_0x23873c[_0x24fc('0x18')][_0x24fc('0x1b')]?_['map'](_0x23873c[_0x24fc('0x18')]['include'],function(_0x35a9c7){return{'model':db[_0x35a9c7[_0x24fc('0x1c')]],'as':_0x35a9c7['as'],'attributes':_0x35a9c7[_0x24fc('0x1a')],'include':_0x35a9c7[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x35a9c7[_0x24fc('0x1b')],function(_0x3f0875){return{'model':db[_0x3f0875[_0x24fc('0x1c')]],'as':_0x3f0875['as'],'attributes':_0x3f0875[_0x24fc('0x1a')],'include':_0x3f0875[_0x24fc('0x1b')]?_['map'](_0x3f0875[_0x24fc('0x1b')],function(_0x16f27f){return{'model':db[_0x16f27f[_0x24fc('0x1c')]],'as':_0x16f27f['as'],'attributes':_0x16f27f['attributes']};}):[]};}):[]};}):[]:[]})[_0x24fc('0xc')](function(_0x3d1ec8){logger[_0x24fc('0xd')](_0x24fc('0x1e'),_0x23873c);logger[_0x24fc('0x10')](_0x24fc('0x1e'),_0x23873c,JSON['stringify'](_0x3d1ec8));_0x6cfa0a(_0x3d1ec8);})[_0x24fc('0x16')](function(_0x29a461){logger[_0x24fc('0x13')](_0x24fc('0x1e'),_0x29a461[_0x24fc('0x15')],_0x23873c);_0x8ac114(_0x1cb3d0['error'](0x1f4,_0x29a461['message']));});});};exports['ShowVtigerAccount']=function(_0x3df6f4){var _0x574ba3=this;return new Promise(function(_0x3f2464,_0x3e6389){return db[_0x24fc('0x1f')][_0x24fc('0x20')]({'raw':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x21')]===undefined?!![]:![]:!![],'where':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x19')]||null:null,'attributes':_0x3df6f4['options']?_0x3df6f4['options'][_0x24fc('0x1a')]||null:null,'include':_0x3df6f4['options']?_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x1b')]?_['map'](_0x3df6f4[_0x24fc('0x18')][_0x24fc('0x1b')],function(_0x3b2862){return{'model':db[_0x3b2862[_0x24fc('0x1c')]],'as':_0x3b2862['as'],'attributes':_0x3b2862[_0x24fc('0x1a')],'include':_0x3b2862[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x3b2862[_0x24fc('0x1b')],function(_0x379a4a){return{'model':db[_0x379a4a['model']],'as':_0x379a4a['as'],'attributes':_0x379a4a[_0x24fc('0x1a')],'include':_0x379a4a[_0x24fc('0x1b')]?_[_0x24fc('0x1d')](_0x379a4a[_0x24fc('0x1b')],function(_0x242bd5){return{'model':db[_0x242bd5['model']],'as':_0x242bd5['as'],'attributes':_0x242bd5['attributes']};}):[]};}):[]};}):[]:[]})[_0x24fc('0xc')](function(_0x5d48fe){logger[_0x24fc('0xd')](_0x24fc('0x22'),_0x3df6f4);logger[_0x24fc('0x10')](_0x24fc('0x22'),_0x3df6f4,JSON['stringify'](_0x5d48fe));_0x3f2464(_0x5d48fe);})[_0x24fc('0x16')](function(_0x4f4ec8){logger[_0x24fc('0x13')](_0x24fc('0x22'),_0x4f4ec8[_0x24fc('0x15')],_0x3df6f4);_0x3e6389(_0x574ba3[_0x24fc('0x13')](0x1f4,_0x4f4ec8[_0x24fc('0x15')]));});});}; \ No newline at end of file +var _0x0abf=['VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','limit','include','map','model','attributes','debug','ShowVtigerAccount','then','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s'];(function(_0x13c388,_0x4b5948){var _0x45f9f2=function(_0x1477f8){while(--_0x1477f8){_0x13c388['push'](_0x13c388['shift']());}};_0x45f9f2(++_0x4b5948);}(_0x0abf,0xe8));var _0xf0ab=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0abf[_0xa464c9];return _0x3d73c4;};'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')]({'raw':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x19')]===undefined?!![]:![]:!![],'where':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1a')]||null:null,'attributes':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')]['attributes']||null:null,'limit':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1b')]||null:null,'include':_0x1803f0[_0xf0ab('0x18')]?_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x1803f0[_0xf0ab('0x18')][_0xf0ab('0x1c')],function(_0x18bb37){return{'model':db[_0x18bb37[_0xf0ab('0x1e')]],'as':_0x18bb37['as'],'attributes':_0x18bb37['attributes'],'include':_0x18bb37['include']?_['map'](_0x18bb37[_0xf0ab('0x1c')],function(_0x4f0caf){return{'model':db[_0x4f0caf[_0xf0ab('0x1e')]],'as':_0x4f0caf['as'],'attributes':_0x4f0caf[_0xf0ab('0x1f')],'include':_0x4f0caf['include']?_[_0xf0ab('0x1d')](_0x4f0caf[_0xf0ab('0x1c')],function(_0x10bf5f){return{'model':db[_0x10bf5f[_0xf0ab('0x1e')]],'as':_0x10bf5f['as'],'attributes':_0x10bf5f[_0xf0ab('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d0da7){logger['info']('GetVtigerAccount',_0x1803f0);logger[_0xf0ab('0x20')](_0xf0ab('0x15'),_0x1803f0,JSON[_0xf0ab('0xe')](_0x2d0da7));_0x776619(_0x2d0da7);})[_0xf0ab('0x14')](function(_0x43476c){logger[_0xf0ab('0xf')](_0xf0ab('0x15'),_0x43476c[_0xf0ab('0x11')],_0x1803f0);_0xb9a33(_0x1ffeb5[_0xf0ab('0xf')](0x1f4,_0x43476c[_0xf0ab('0x11')]));});});};exports[_0xf0ab('0x21')]=function(_0x199753){var _0x58cbe1=this;return new Promise(function(_0x1e1ffb,_0x35973a){return db['VtigerAccount']['find']({'raw':_0x199753[_0xf0ab('0x18')]?_0x199753[_0xf0ab('0x18')][_0xf0ab('0x19')]===undefined?!![]:![]:!![],'where':_0x199753['options']?_0x199753['options'][_0xf0ab('0x1a')]||null:null,'attributes':_0x199753['options']?_0x199753[_0xf0ab('0x18')]['attributes']||null:null,'include':_0x199753[_0xf0ab('0x18')]?_0x199753[_0xf0ab('0x18')]['include']?_['map'](_0x199753[_0xf0ab('0x18')][_0xf0ab('0x1c')],function(_0x2a3fac){return{'model':db[_0x2a3fac[_0xf0ab('0x1e')]],'as':_0x2a3fac['as'],'attributes':_0x2a3fac[_0xf0ab('0x1f')],'include':_0x2a3fac[_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x2a3fac[_0xf0ab('0x1c')],function(_0x2a2f5d){return{'model':db[_0x2a2f5d[_0xf0ab('0x1e')]],'as':_0x2a2f5d['as'],'attributes':_0x2a2f5d[_0xf0ab('0x1f')],'include':_0x2a2f5d[_0xf0ab('0x1c')]?_[_0xf0ab('0x1d')](_0x2a2f5d[_0xf0ab('0x1c')],function(_0x5d8443){return{'model':db[_0x5d8443[_0xf0ab('0x1e')]],'as':_0x5d8443['as'],'attributes':_0x5d8443[_0xf0ab('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf0ab('0x22')](function(_0x5c9192){logger[_0xf0ab('0xb')](_0xf0ab('0x21'),_0x199753);logger[_0xf0ab('0x20')]('ShowVtigerAccount',_0x199753,JSON[_0xf0ab('0xe')](_0x5c9192));_0x1e1ffb(_0x5c9192);})['catch'](function(_0xda3971){logger['error'](_0xf0ab('0x21'),_0xda3971[_0xf0ab('0x11')],_0x199753);_0x35973a(_0x58cbe1[_0xf0ab('0xf')](0x1f4,_0xda3971[_0xf0ab('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 56db0ad..a6e1d45 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 _0x4412=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','get','show','/:id/fields'];(function(_0xa16567,_0x28f3c0){var _0x28ff4c=function(_0x2f374c){while(--_0x2f374c){_0xa16567['push'](_0xa16567['shift']());}};_0x28ff4c(++_0x28f3c0);}(_0x4412,0x130));var _0x2441=function(_0x535128,_0x24e02b){_0x535128=_0x535128-0x0;var _0x1de4a8=_0x4412[_0x535128];return _0x1de4a8;};'use strict';var multer=require(_0x2441('0x0'));var util=require(_0x2441('0x1'));var path=require('path');var timeout=require(_0x2441('0x2'));var express=require(_0x2441('0x3'));var router=express[_0x2441('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2441('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2441('0x6'));var controller=require('./intVtigerConfiguration.controller');router['get']('/',auth[_0x2441('0x7')](),controller['index']);router[_0x2441('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2441('0x9')]);router['get'](_0x2441('0xa'),auth[_0x2441('0x7')](),controller['getFields']);router[_0x2441('0x8')](_0x2441('0xb'),auth[_0x2441('0x7')](),controller[_0x2441('0xc')]);router[_0x2441('0x8')](_0x2441('0xd'),auth[_0x2441('0x7')](),controller[_0x2441('0xe')]);router[_0x2441('0xf')]('/',auth[_0x2441('0x7')](),controller[_0x2441('0x10')]);router[_0x2441('0x11')](_0x2441('0x12'),auth[_0x2441('0x7')](),controller[_0x2441('0x13')]);router['delete'](_0x2441('0x12'),auth[_0x2441('0x7')](),controller[_0x2441('0x14')]);module['exports']=router; \ No newline at end of file +var _0x234a=['Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x173dd9,_0x4ecf44){var _0x5a0d5a=function(_0x4d731a){while(--_0x4d731a){_0x173dd9['push'](_0x173dd9['shift']());}};_0x5a0d5a(++_0x4ecf44);}(_0x234a,0x1a4));var _0xa234=function(_0xc0638b,_0x2fccf4){_0xc0638b=_0xc0638b-0x0;var _0xd57dfa=_0x234a[_0xc0638b];return _0xd57dfa;};'use strict';var multer=require(_0xa234('0x0'));var util=require(_0xa234('0x1'));var path=require(_0xa234('0x2'));var timeout=require(_0xa234('0x3'));var express=require(_0xa234('0x4'));var router=express[_0xa234('0x5')]();var fs_extra=require(_0xa234('0x6'));var auth=require(_0xa234('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa234('0x8'));var controller=require(_0xa234('0x9'));router['get']('/',auth[_0xa234('0xa')](),controller[_0xa234('0xb')]);router[_0xa234('0xc')](_0xa234('0xd'),auth[_0xa234('0xa')](),controller[_0xa234('0xe')]);router['get'](_0xa234('0xf'),auth[_0xa234('0xa')](),controller['getFields']);router['get'](_0xa234('0x10'),auth[_0xa234('0xa')](),controller[_0xa234('0x11')]);router['get']('/:id/descriptions',auth[_0xa234('0xa')](),controller[_0xa234('0x12')]);router[_0xa234('0x13')]('/',auth[_0xa234('0xa')](),controller[_0xa234('0x14')]);router['put'](_0xa234('0xd'),auth[_0xa234('0xa')](),controller[_0xa234('0x15')]);router[_0xa234('0x16')](_0xa234('0xd'),auth[_0xa234('0xa')](),controller[_0xa234('0x17')]);module[_0xa234('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 7d6073d..1f70256 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 _0x7e87=['sequelize'];(function(_0x1942fe,_0x19f152){var _0x2a95a4=function(_0x1b98b6){while(--_0x1b98b6){_0x1942fe['push'](_0x1942fe['shift']());}};_0x2a95a4(++_0x19f152);}(_0x7e87,0xeb));var _0x77e8=function(_0xfccf09,_0xc6c445){_0xfccf09=_0xfccf09-0x0;var _0x1793ee=_0x7e87[_0xfccf09];return _0x1793ee;};'use strict';var Sequelize=require(_0x77e8('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe88f=['STRING'];(function(_0x1940be,_0x2f89d1){var _0x2831bf=function(_0x49ebe4){while(--_0x49ebe4){_0x1940be['push'](_0x1940be['shift']());}};_0x2831bf(++_0x2f89d1);}(_0xe88f,0x8e));var _0xfe88=function(_0x4320ce,_0x49f5f5){_0x4320ce=_0x4320ce-0x0;var _0x537dae=_0xe88f[_0x4320ce];return _0x537dae;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfe88('0x0')]},'description':{'type':Sequelize[_0xfe88('0x0')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 4d2175b..ef8ae0f 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 _0x86be=['merge','includeAll','findAll','rows','show','params','include','catch','create','body','find','getFields','VtigerField','options','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x43d3b3,_0x1939aa){var _0x3fc7a9=function(_0x5215df){while(--_0x5215df){_0x43d3b3['push'](_0x43d3b3['shift']());}};_0x3fc7a9(++_0x1939aa);}(_0x86be,0x1b5));var _0xe86b=function(_0x4e9051,_0x59ec5e){_0x4e9051=_0x4e9051-0x0;var _0x3f0d7c=_0x86be[_0x4e9051];return _0x3f0d7c;};'use strict';var emlformat=require(_0xe86b('0x0'));var rimraf=require(_0xe86b('0x1'));var zipdir=require(_0xe86b('0x2'));var jsonpatch=require(_0xe86b('0x3'));var rp=require(_0xe86b('0x4'));var moment=require(_0xe86b('0x5'));var BPromise=require(_0xe86b('0x6'));var Mustache=require(_0xe86b('0x7'));var util=require(_0xe86b('0x8'));var path=require(_0xe86b('0x9'));var sox=require(_0xe86b('0xa'));var csv=require(_0xe86b('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe86b('0xc'));var _=require('lodash');var squel=require(_0xe86b('0xd'));var crypto=require('crypto');var jsforce=require(_0xe86b('0xe'));var deskjs=require(_0xe86b('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe86b('0x10'));var Papa=require('papaparse');var Redis=require(_0xe86b('0x11'));var authService=require(_0xe86b('0x12'));var qs=require(_0xe86b('0x13'));var as=require(_0xe86b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe86b('0x15'))(_0xe86b('0x16'));var utils=require(_0xe86b('0x17'));var config=require(_0xe86b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe86b('0x19'))['db'];function respondWithStatusCode(_0x15a859,_0x145ce9){_0x145ce9=_0x145ce9||0xcc;return function(_0x19b174){if(_0x19b174){return _0x15a859[_0xe86b('0x1a')](_0x145ce9);}return _0x15a859['status'](_0x145ce9)['end']();};}function respondWithResult(_0x3677a1,_0x21614d){_0x21614d=_0x21614d||0xc8;return function(_0x8e8606){if(_0x8e8606){return _0x3677a1[_0xe86b('0x1b')](_0x21614d)[_0xe86b('0x1c')](_0x8e8606);}};}function respondWithFilteredResult(_0x5f45fd,_0x4ce0d6){return function(_0x318c29){if(_0x318c29){var _0x585c2d=typeof _0x4ce0d6[_0xe86b('0x1d')]===_0xe86b('0x1e')&&typeof _0x4ce0d6['limit']===_0xe86b('0x1e');var _0x4b8e96=_0x318c29[_0xe86b('0x1f')];var _0x42f8ac=_0x585c2d?0x0:_0x4ce0d6['offset'];var _0x2eec52=_0x585c2d?_0x318c29[_0xe86b('0x1f')]:_0x4ce0d6['offset']+_0x4ce0d6[_0xe86b('0x20')];var _0x1b55a2;if(_0x2eec52>=_0x4b8e96){_0x2eec52=_0x4b8e96;_0x1b55a2=0xc8;}else{_0x1b55a2=0xce;}_0x5f45fd[_0xe86b('0x1b')](_0x1b55a2);return _0x5f45fd[_0xe86b('0x21')](_0xe86b('0x22'),_0x42f8ac+'-'+_0x2eec52+'/'+_0x4b8e96)['json'](_0x318c29);}return null;};}function patchUpdates(_0x58f491){return function(_0x9ea697){try{jsonpatch[_0xe86b('0x23')](_0x9ea697,_0x58f491,!![]);}catch(_0xb26f27){return BPromise[_0xe86b('0x24')](_0xb26f27);}return _0x9ea697[_0xe86b('0x25')]();};}function saveUpdates(_0x12321d,_0x34ad2d){return function(_0x3e1918){if(_0x3e1918){return _0x3e1918[_0xe86b('0x26')](_0x12321d)[_0xe86b('0x27')](function(_0x375d54){return _0x375d54;});}return null;};}function removeEntity(_0x1d3064,_0x49eec2){return function(_0x5903d9){if(_0x5903d9){return _0x5903d9[_0xe86b('0x28')]()[_0xe86b('0x27')](function(){_0x1d3064['status'](0xcc)[_0xe86b('0x29')]();});}};}function handleEntityNotFound(_0x5af486,_0x31c3f3){return function(_0x4c7a4e){if(!_0x4c7a4e){_0x5af486[_0xe86b('0x1a')](0x194);}return _0x4c7a4e;};}function handleError(_0x200ab6,_0x533043){_0x533043=_0x533043||0x1f4;return function(_0x25d248){logger['error'](_0x25d248[_0xe86b('0x2a')]);if(_0x25d248[_0xe86b('0x2b')]){delete _0x25d248['name'];}_0x200ab6[_0xe86b('0x1b')](_0x533043)[_0xe86b('0x2c')](_0x25d248);};}exports[_0xe86b('0x2d')]=function(_0x41e2d5,_0x5c3d17){var _0x489ed7={},_0x1e7941={},_0x29f799={'count':0x0,'rows':[]};var _0x2a3367=_[_0xe86b('0x2e')](db[_0xe86b('0x2f')][_0xe86b('0x30')],function(_0x508bef){return{'name':_0x508bef[_0xe86b('0x31')],'type':_0x508bef[_0xe86b('0x32')][_0xe86b('0x33')]};});_0x1e7941[_0xe86b('0x34')]=_[_0xe86b('0x2e')](_0x2a3367,_0xe86b('0x2b'));_0x1e7941[_0xe86b('0x35')]=_[_0xe86b('0x36')](_0x41e2d5[_0xe86b('0x35')]);_0x1e7941[_0xe86b('0x37')]=_[_0xe86b('0x38')](_0x1e7941[_0xe86b('0x34')],_0x1e7941[_0xe86b('0x35')]);_0x489ed7[_0xe86b('0x39')]=_[_0xe86b('0x38')](_0x1e7941[_0xe86b('0x34')],qs[_0xe86b('0x3a')](_0x41e2d5[_0xe86b('0x35')][_0xe86b('0x3a')]));_0x489ed7['attributes']=_0x489ed7[_0xe86b('0x39')][_0xe86b('0x3b')]?_0x489ed7['attributes']:_0x1e7941[_0xe86b('0x34')];if(!_0x41e2d5['query'][_0xe86b('0x3c')](_0xe86b('0x3d'))){_0x489ed7[_0xe86b('0x20')]=qs['limit'](_0x41e2d5['query'][_0xe86b('0x20')]);_0x489ed7[_0xe86b('0x1d')]=qs[_0xe86b('0x1d')](_0x41e2d5['query'][_0xe86b('0x1d')]);}_0x489ed7[_0xe86b('0x3e')]=qs[_0xe86b('0x3f')](_0x41e2d5[_0xe86b('0x35')]['sort']);_0x489ed7[_0xe86b('0x40')]=qs[_0xe86b('0x37')](_[_0xe86b('0x41')](_0x41e2d5[_0xe86b('0x35')],_0x1e7941[_0xe86b('0x37')]),_0x2a3367);if(_0x41e2d5['query'][_0xe86b('0x42')]){_0x489ed7[_0xe86b('0x40')]=_['merge'](_0x489ed7[_0xe86b('0x40')],{'$or':_['map'](_0x2a3367,function(_0x512823){if(_0x512823[_0xe86b('0x32')]!=='VIRTUAL'){var _0x54f7ad={};_0x54f7ad[_0x512823[_0xe86b('0x2b')]]={'$like':'%'+_0x41e2d5[_0xe86b('0x35')][_0xe86b('0x42')]+'%'};return _0x54f7ad;}})});}_0x489ed7=_[_0xe86b('0x43')]({},_0x489ed7,_0x41e2d5['options']);var _0x1d6d97={'where':_0x489ed7[_0xe86b('0x40')]};return db[_0xe86b('0x2f')][_0xe86b('0x1f')](_0x1d6d97)[_0xe86b('0x27')](function(_0x1333ba){_0x29f799[_0xe86b('0x1f')]=_0x1333ba;if(_0x41e2d5[_0xe86b('0x35')][_0xe86b('0x44')]){_0x489ed7['include']=[{'all':!![]}];}return db[_0xe86b('0x2f')][_0xe86b('0x45')](_0x489ed7);})[_0xe86b('0x27')](function(_0x2697d5){_0x29f799[_0xe86b('0x46')]=_0x2697d5;return _0x29f799;})['then'](respondWithFilteredResult(_0x5c3d17,_0x489ed7))['catch'](handleError(_0x5c3d17,null));};exports[_0xe86b('0x47')]=function(_0x34e169,_0x36cf2b){var _0x38df55={'raw':![],'where':{'id':_0x34e169[_0xe86b('0x48')]['id']}},_0x5f193d={};_0x5f193d['model']=_[_0xe86b('0x36')](db['VtigerConfiguration'][_0xe86b('0x30')]);_0x5f193d[_0xe86b('0x35')]=_[_0xe86b('0x36')](_0x34e169[_0xe86b('0x35')]);_0x5f193d[_0xe86b('0x37')]=_['intersection'](_0x5f193d['model'],_0x5f193d[_0xe86b('0x35')]);_0x38df55[_0xe86b('0x39')]=_['intersection'](_0x5f193d[_0xe86b('0x34')],qs[_0xe86b('0x3a')](_0x34e169[_0xe86b('0x35')]['fields']));_0x38df55[_0xe86b('0x39')]=_0x38df55['attributes']['length']?_0x38df55[_0xe86b('0x39')]:_0x5f193d[_0xe86b('0x34')];if(_0x34e169[_0xe86b('0x35')][_0xe86b('0x44')]){_0x38df55[_0xe86b('0x49')]=[{'all':!![]}];}_0x38df55=_['merge']({},_0x38df55,_0x34e169['options']);return db[_0xe86b('0x2f')]['find'](_0x38df55)[_0xe86b('0x27')](handleEntityNotFound(_0x36cf2b,null))[_0xe86b('0x27')](respondWithResult(_0x36cf2b,null))[_0xe86b('0x4a')](handleError(_0x36cf2b,null));};exports[_0xe86b('0x4b')]=function(_0x2ac988,_0x2ac609){return db[_0xe86b('0x2f')][_0xe86b('0x4b')](_0x2ac988[_0xe86b('0x4c')],{})[_0xe86b('0x27')](respondWithResult(_0x2ac609,0xc9))[_0xe86b('0x4a')](handleError(_0x2ac609,null));};exports['update']=function(_0xa27f8f,_0xd4182){if(_0xa27f8f['body']['id']){delete _0xa27f8f['body']['id'];}return db[_0xe86b('0x2f')][_0xe86b('0x4d')]({'where':{'id':_0xa27f8f[_0xe86b('0x48')]['id']}})[_0xe86b('0x27')](handleEntityNotFound(_0xd4182,null))[_0xe86b('0x27')](saveUpdates(_0xa27f8f[_0xe86b('0x4c')],null))[_0xe86b('0x27')](respondWithResult(_0xd4182,null))['catch'](handleError(_0xd4182,null));};exports[_0xe86b('0x28')]=function(_0x50235f,_0x52eff2){return db[_0xe86b('0x2f')][_0xe86b('0x4d')]({'where':{'id':_0x50235f[_0xe86b('0x48')]['id']}})[_0xe86b('0x27')](handleEntityNotFound(_0x52eff2,null))[_0xe86b('0x27')](removeEntity(_0x52eff2,null))[_0xe86b('0x4a')](handleError(_0x52eff2,null));};exports[_0xe86b('0x4e')]=function(_0x1bb0bd,_0x4510d6,_0x52af83){var _0x2b9baf={};var _0x1803a4={};var _0xa39de1;var _0x17f263;return db[_0xe86b('0x2f')]['findOne']({'where':{'id':_0x1bb0bd[_0xe86b('0x48')]['id']}})[_0xe86b('0x27')](handleEntityNotFound(_0x4510d6,null))['then'](function(_0x4114df){if(_0x4114df){_0xa39de1=_0x4114df;_0x1803a4[_0xe86b('0x34')]=_[_0xe86b('0x36')](db[_0xe86b('0x4f')]['rawAttributes']);_0x1803a4['query']=_[_0xe86b('0x36')](_0x1bb0bd['query']);_0x1803a4[_0xe86b('0x37')]=_[_0xe86b('0x38')](_0x1803a4[_0xe86b('0x34')],_0x1803a4[_0xe86b('0x35')]);_0x2b9baf[_0xe86b('0x39')]=_[_0xe86b('0x38')](_0x1803a4[_0xe86b('0x34')],qs[_0xe86b('0x3a')](_0x1bb0bd['query'][_0xe86b('0x3a')]));_0x2b9baf['attributes']=_0x2b9baf[_0xe86b('0x39')]['length']?_0x2b9baf['attributes']:_0x1803a4[_0xe86b('0x34')];_0x2b9baf[_0xe86b('0x3e')]=qs[_0xe86b('0x3f')](_0x1bb0bd[_0xe86b('0x35')][_0xe86b('0x3f')]);_0x2b9baf[_0xe86b('0x40')]=qs[_0xe86b('0x37')](_[_0xe86b('0x41')](_0x1bb0bd[_0xe86b('0x35')],_0x1803a4['filters']));if(_0x1bb0bd[_0xe86b('0x35')][_0xe86b('0x42')]){_0x2b9baf[_0xe86b('0x40')]=_[_0xe86b('0x43')](_0x2b9baf['where'],{'$or':_['map'](_0x2b9baf[_0xe86b('0x39')],function(_0x153f1b){var _0x1ee8ed={};_0x1ee8ed[_0x153f1b]={'$like':'%'+_0x1bb0bd[_0xe86b('0x35')][_0xe86b('0x42')]+'%'};return _0x1ee8ed;})});}_0x2b9baf=_[_0xe86b('0x43')]({},_0x2b9baf,_0x1bb0bd[_0xe86b('0x50')]);return _0xa39de1[_0xe86b('0x4e')](_0x2b9baf);}})['then'](function(_0x145120){if(_0x145120){_0x17f263=_0x145120[_0xe86b('0x3b')];if(!_0x1bb0bd['query'][_0xe86b('0x3c')](_0xe86b('0x3d'))){_0x2b9baf[_0xe86b('0x20')]=qs[_0xe86b('0x20')](_0x1bb0bd['query'][_0xe86b('0x20')]);_0x2b9baf[_0xe86b('0x1d')]=qs[_0xe86b('0x1d')](_0x1bb0bd[_0xe86b('0x35')][_0xe86b('0x1d')]);}return _0xa39de1[_0xe86b('0x4e')](_0x2b9baf);}})[_0xe86b('0x27')](function(_0x2b1fb6){if(_0x2b1fb6){return _0x2b1fb6?{'count':_0x17f263,'rows':_0x2b1fb6}:null;}})[_0xe86b('0x27')](respondWithResult(_0x4510d6,null))[_0xe86b('0x4a')](handleError(_0x4510d6,null));};exports[_0xe86b('0x51')]=function(_0x30e340,_0x42b854,_0x5db5e9){var _0x4e94bb={};var _0x2063b4={};var _0x1226cd;var _0x3523e9;return db[_0xe86b('0x2f')][_0xe86b('0x52')]({'where':{'id':_0x30e340[_0xe86b('0x48')]['id']}})[_0xe86b('0x27')](handleEntityNotFound(_0x42b854,null))[_0xe86b('0x27')](function(_0x1d8204){if(_0x1d8204){_0x1226cd=_0x1d8204;_0x2063b4['model']=_[_0xe86b('0x36')](db[_0xe86b('0x4f')]['rawAttributes']);_0x2063b4[_0xe86b('0x35')]=_[_0xe86b('0x36')](_0x30e340['query']);_0x2063b4[_0xe86b('0x37')]=_[_0xe86b('0x38')](_0x2063b4['model'],_0x2063b4['query']);_0x4e94bb[_0xe86b('0x39')]=_[_0xe86b('0x38')](_0x2063b4[_0xe86b('0x34')],qs['fields'](_0x30e340[_0xe86b('0x35')]['fields']));_0x4e94bb[_0xe86b('0x39')]=_0x4e94bb[_0xe86b('0x39')][_0xe86b('0x3b')]?_0x4e94bb[_0xe86b('0x39')]:_0x2063b4[_0xe86b('0x34')];_0x4e94bb['order']=qs[_0xe86b('0x3f')](_0x30e340[_0xe86b('0x35')][_0xe86b('0x3f')]);_0x4e94bb[_0xe86b('0x40')]=qs[_0xe86b('0x37')](_[_0xe86b('0x41')](_0x30e340['query'],_0x2063b4[_0xe86b('0x37')]));if(_0x30e340[_0xe86b('0x35')][_0xe86b('0x42')]){_0x4e94bb[_0xe86b('0x40')]=_[_0xe86b('0x43')](_0x4e94bb[_0xe86b('0x40')],{'$or':_['map'](_0x4e94bb[_0xe86b('0x39')],function(_0x15cf4f){var _0x64af41={};_0x64af41[_0x15cf4f]={'$like':'%'+_0x30e340[_0xe86b('0x35')][_0xe86b('0x42')]+'%'};return _0x64af41;})});}_0x4e94bb=_[_0xe86b('0x43')]({},_0x4e94bb,_0x30e340[_0xe86b('0x50')]);return _0x1226cd[_0xe86b('0x51')](_0x4e94bb);}})['then'](function(_0x1637b3){if(_0x1637b3){_0x3523e9=_0x1637b3[_0xe86b('0x3b')];if(!_0x30e340['query'][_0xe86b('0x3c')]('nolimit')){_0x4e94bb[_0xe86b('0x20')]=qs['limit'](_0x30e340[_0xe86b('0x35')][_0xe86b('0x20')]);_0x4e94bb[_0xe86b('0x1d')]=qs[_0xe86b('0x1d')](_0x30e340['query'][_0xe86b('0x1d')]);}return _0x1226cd[_0xe86b('0x51')](_0x4e94bb);}})[_0xe86b('0x27')](function(_0x95003d){if(_0x95003d){return _0x95003d?{'count':_0x3523e9,'rows':_0x95003d}:null;}})[_0xe86b('0x27')](respondWithResult(_0x42b854,null))[_0xe86b('0x4a')](handleError(_0x42b854,null));};exports[_0xe86b('0x53')]=function(_0x5b6dfc,_0x2f403a,_0x1913d4){var _0x383ee2={};var _0x3ba9db={};var _0x321fcc;var _0xae59b6;return db[_0xe86b('0x2f')][_0xe86b('0x52')]({'where':{'id':_0x5b6dfc[_0xe86b('0x48')]['id']}})[_0xe86b('0x27')](handleEntityNotFound(_0x2f403a,null))[_0xe86b('0x27')](function(_0x4b8a1a){if(_0x4b8a1a){_0x321fcc=_0x4b8a1a;_0x3ba9db[_0xe86b('0x34')]=_[_0xe86b('0x36')](db['VtigerField'][_0xe86b('0x30')]);_0x3ba9db[_0xe86b('0x35')]=_[_0xe86b('0x36')](_0x5b6dfc['query']);_0x3ba9db['filters']=_['intersection'](_0x3ba9db[_0xe86b('0x34')],_0x3ba9db['query']);_0x383ee2[_0xe86b('0x39')]=_[_0xe86b('0x38')](_0x3ba9db[_0xe86b('0x34')],qs[_0xe86b('0x3a')](_0x5b6dfc[_0xe86b('0x35')][_0xe86b('0x3a')]));_0x383ee2[_0xe86b('0x39')]=_0x383ee2[_0xe86b('0x39')][_0xe86b('0x3b')]?_0x383ee2[_0xe86b('0x39')]:_0x3ba9db[_0xe86b('0x34')];_0x383ee2['order']=qs[_0xe86b('0x3f')](_0x5b6dfc[_0xe86b('0x35')]['sort']);_0x383ee2['where']=qs[_0xe86b('0x37')](_['pick'](_0x5b6dfc[_0xe86b('0x35')],_0x3ba9db[_0xe86b('0x37')]));if(_0x5b6dfc[_0xe86b('0x35')]['filter']){_0x383ee2[_0xe86b('0x40')]=_[_0xe86b('0x43')](_0x383ee2[_0xe86b('0x40')],{'$or':_[_0xe86b('0x2e')](_0x383ee2[_0xe86b('0x39')],function(_0xe57610){var _0x4988d1={};_0x4988d1[_0xe57610]={'$like':'%'+_0x5b6dfc[_0xe86b('0x35')][_0xe86b('0x42')]+'%'};return _0x4988d1;})});}_0x383ee2=_[_0xe86b('0x43')]({},_0x383ee2,_0x5b6dfc['options']);return _0x321fcc[_0xe86b('0x53')](_0x383ee2);}})[_0xe86b('0x27')](function(_0x4b10fc){if(_0x4b10fc){_0xae59b6=_0x4b10fc[_0xe86b('0x3b')];if(!_0x5b6dfc[_0xe86b('0x35')][_0xe86b('0x3c')](_0xe86b('0x3d'))){_0x383ee2['limit']=qs[_0xe86b('0x20')](_0x5b6dfc[_0xe86b('0x35')][_0xe86b('0x20')]);_0x383ee2[_0xe86b('0x1d')]=qs['offset'](_0x5b6dfc[_0xe86b('0x35')]['offset']);}return _0x321fcc['getDescriptions'](_0x383ee2);}})['then'](function(_0x11d7c6){if(_0x11d7c6){return _0x11d7c6?{'count':_0xae59b6,'rows':_0x11d7c6}:null;}})[_0xe86b('0x27')](respondWithResult(_0x2f403a,null))[_0xe86b('0x4a')](handleError(_0x2f403a,null));}; \ No newline at end of file +var _0x9a62=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','VtigerConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','find','destroy','getFields','findOne','VtigerField','filter','getSubjects','map','getDescriptions','rimraf','zip-dir','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3ce2e2,_0x1621d1){var _0x3a3403=function(_0x299938){while(--_0x299938){_0x3ce2e2['push'](_0x3ce2e2['shift']());}};_0x3a3403(++_0x1621d1);}(_0x9a62,0x1bc));var _0x29a6=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9a62[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29a6('0x0'));var zipdir=require(_0x29a6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x29a6('0x2'));var moment=require(_0x29a6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29a6('0x4'));var path=require(_0x29a6('0x5'));var sox=require(_0x29a6('0x6'));var csv=require(_0x29a6('0x7'));var ejs=require(_0x29a6('0x8'));var fs=require('fs');var fs_extra=require(_0x29a6('0x9'));var _=require(_0x29a6('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x29a6('0xb'));var deskjs=require(_0x29a6('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x29a6('0xd'));var Redis=require(_0x29a6('0xe'));var authService=require(_0x29a6('0xf'));var qs=require(_0x29a6('0x10'));var as=require(_0x29a6('0x11'));var hardwareService=require(_0x29a6('0x12'));var logger=require(_0x29a6('0x13'))('api');var utils=require(_0x29a6('0x14'));var config=require(_0x29a6('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e918f,_0x1d78fa){_0x1d78fa=_0x1d78fa||0xcc;return function(_0x7acc03){if(_0x7acc03){return _0x4e918f['sendStatus'](_0x1d78fa);}return _0x4e918f[_0x29a6('0x16')](_0x1d78fa)[_0x29a6('0x17')]();};}function respondWithResult(_0x535e3a,_0x50c663){_0x50c663=_0x50c663||0xc8;return function(_0x36d6fd){if(_0x36d6fd){return _0x535e3a[_0x29a6('0x16')](_0x50c663)['json'](_0x36d6fd);}};}function respondWithFilteredResult(_0x389255,_0x22378a){return function(_0x307dd9){if(_0x307dd9){var _0x4fef5c=typeof _0x22378a[_0x29a6('0x18')]===_0x29a6('0x19')&&typeof _0x22378a[_0x29a6('0x1a')]===_0x29a6('0x19');var _0x2ccb06=_0x307dd9[_0x29a6('0x1b')];var _0xa3d845=_0x4fef5c?0x0:_0x22378a[_0x29a6('0x18')];var _0x4c8cbc=_0x4fef5c?_0x307dd9[_0x29a6('0x1b')]:_0x22378a['offset']+_0x22378a[_0x29a6('0x1a')];var _0x35bc3b;if(_0x4c8cbc>=_0x2ccb06){_0x4c8cbc=_0x2ccb06;_0x35bc3b=0xc8;}else{_0x35bc3b=0xce;}_0x389255[_0x29a6('0x16')](_0x35bc3b);return _0x389255['set'](_0x29a6('0x1c'),_0xa3d845+'-'+_0x4c8cbc+'/'+_0x2ccb06)['json'](_0x307dd9);}return null;};}function patchUpdates(_0x4da844){return function(_0x5a8d55){try{jsonpatch[_0x29a6('0x1d')](_0x5a8d55,_0x4da844,!![]);}catch(_0x319573){return BPromise[_0x29a6('0x1e')](_0x319573);}return _0x5a8d55[_0x29a6('0x1f')]();};}function saveUpdates(_0x36c103,_0x552bc7){return function(_0x13341e){if(_0x13341e){return _0x13341e[_0x29a6('0x20')](_0x36c103)[_0x29a6('0x21')](function(_0x3ed7de){return _0x3ed7de;});}return null;};}function removeEntity(_0x46fcc7,_0x2dc6c0){return function(_0xedfa4){if(_0xedfa4){return _0xedfa4['destroy']()[_0x29a6('0x21')](function(){_0x46fcc7[_0x29a6('0x16')](0xcc)[_0x29a6('0x17')]();});}};}function handleEntityNotFound(_0x2280f7,_0x1798dd){return function(_0x17b835){if(!_0x17b835){_0x2280f7[_0x29a6('0x22')](0x194);}return _0x17b835;};}function handleError(_0x4ce577,_0x483d22){_0x483d22=_0x483d22||0x1f4;return function(_0x5a67df){logger[_0x29a6('0x23')](_0x5a67df[_0x29a6('0x24')]);if(_0x5a67df[_0x29a6('0x25')]){delete _0x5a67df[_0x29a6('0x25')];}_0x4ce577[_0x29a6('0x16')](_0x483d22)['send'](_0x5a67df);};}exports['index']=function(_0x31c2e4,_0x3607b3){var _0x4c5cb8={},_0x454df0={},_0x2b6b35={'count':0x0,'rows':[]};var _0x4fa41e=_['map'](db[_0x29a6('0x26')][_0x29a6('0x27')],function(_0x1d5cf2){return{'name':_0x1d5cf2[_0x29a6('0x28')],'type':_0x1d5cf2[_0x29a6('0x29')][_0x29a6('0x2a')]};});_0x454df0['model']=_['map'](_0x4fa41e,_0x29a6('0x25'));_0x454df0[_0x29a6('0x2b')]=_[_0x29a6('0x2c')](_0x31c2e4[_0x29a6('0x2b')]);_0x454df0[_0x29a6('0x2d')]=_[_0x29a6('0x2e')](_0x454df0[_0x29a6('0x2f')],_0x454df0['query']);_0x4c5cb8[_0x29a6('0x30')]=_[_0x29a6('0x2e')](_0x454df0[_0x29a6('0x2f')],qs[_0x29a6('0x31')](_0x31c2e4[_0x29a6('0x2b')][_0x29a6('0x31')]));_0x4c5cb8[_0x29a6('0x30')]=_0x4c5cb8[_0x29a6('0x30')][_0x29a6('0x32')]?_0x4c5cb8['attributes']:_0x454df0[_0x29a6('0x2f')];if(!_0x31c2e4[_0x29a6('0x2b')][_0x29a6('0x33')](_0x29a6('0x34'))){_0x4c5cb8[_0x29a6('0x1a')]=qs[_0x29a6('0x1a')](_0x31c2e4[_0x29a6('0x2b')]['limit']);_0x4c5cb8['offset']=qs['offset'](_0x31c2e4[_0x29a6('0x2b')][_0x29a6('0x18')]);}_0x4c5cb8[_0x29a6('0x35')]=qs[_0x29a6('0x36')](_0x31c2e4[_0x29a6('0x2b')][_0x29a6('0x36')]);_0x4c5cb8['where']=qs[_0x29a6('0x2d')](_[_0x29a6('0x37')](_0x31c2e4['query'],_0x454df0[_0x29a6('0x2d')]),_0x4fa41e);if(_0x31c2e4[_0x29a6('0x2b')]['filter']){_0x4c5cb8[_0x29a6('0x38')]=_[_0x29a6('0x39')](_0x4c5cb8[_0x29a6('0x38')],{'$or':_['map'](_0x4fa41e,function(_0x435553){if(_0x435553[_0x29a6('0x29')]!==_0x29a6('0x3a')){var _0x5ba7f3={};_0x5ba7f3[_0x435553['name']]={'$like':'%'+_0x31c2e4[_0x29a6('0x2b')]['filter']+'%'};return _0x5ba7f3;}})});}_0x4c5cb8=_[_0x29a6('0x39')]({},_0x4c5cb8,_0x31c2e4[_0x29a6('0x3b')]);var _0x52c5c5={'where':_0x4c5cb8[_0x29a6('0x38')]};return db[_0x29a6('0x26')][_0x29a6('0x1b')](_0x52c5c5)[_0x29a6('0x21')](function(_0x327535){_0x2b6b35[_0x29a6('0x1b')]=_0x327535;if(_0x31c2e4[_0x29a6('0x2b')][_0x29a6('0x3c')]){_0x4c5cb8[_0x29a6('0x3d')]=[{'all':!![]}];}return db[_0x29a6('0x26')][_0x29a6('0x3e')](_0x4c5cb8);})[_0x29a6('0x21')](function(_0x44351d){_0x2b6b35['rows']=_0x44351d;return _0x2b6b35;})[_0x29a6('0x21')](respondWithFilteredResult(_0x3607b3,_0x4c5cb8))[_0x29a6('0x3f')](handleError(_0x3607b3,null));};exports[_0x29a6('0x40')]=function(_0x5514be,_0x3b71ad){var _0x5300ee={'raw':![],'where':{'id':_0x5514be[_0x29a6('0x41')]['id']}},_0x46dc89={};_0x46dc89[_0x29a6('0x2f')]=_[_0x29a6('0x2c')](db['VtigerConfiguration'][_0x29a6('0x27')]);_0x46dc89[_0x29a6('0x2b')]=_[_0x29a6('0x2c')](_0x5514be['query']);_0x46dc89[_0x29a6('0x2d')]=_[_0x29a6('0x2e')](_0x46dc89['model'],_0x46dc89[_0x29a6('0x2b')]);_0x5300ee[_0x29a6('0x30')]=_[_0x29a6('0x2e')](_0x46dc89[_0x29a6('0x2f')],qs[_0x29a6('0x31')](_0x5514be[_0x29a6('0x2b')][_0x29a6('0x31')]));_0x5300ee[_0x29a6('0x30')]=_0x5300ee[_0x29a6('0x30')][_0x29a6('0x32')]?_0x5300ee[_0x29a6('0x30')]:_0x46dc89[_0x29a6('0x2f')];if(_0x5514be[_0x29a6('0x2b')][_0x29a6('0x3c')]){_0x5300ee[_0x29a6('0x3d')]=[{'all':!![]}];}_0x5300ee=_[_0x29a6('0x39')]({},_0x5300ee,_0x5514be['options']);return db['VtigerConfiguration']['find'](_0x5300ee)[_0x29a6('0x21')](handleEntityNotFound(_0x3b71ad,null))['then'](respondWithResult(_0x3b71ad,null))[_0x29a6('0x3f')](handleError(_0x3b71ad,null));};exports['create']=function(_0x4aa244,_0x25995e){return db['VtigerConfiguration'][_0x29a6('0x42')](_0x4aa244[_0x29a6('0x43')],{})['then'](respondWithResult(_0x25995e,0xc9))[_0x29a6('0x3f')](handleError(_0x25995e,null));};exports[_0x29a6('0x20')]=function(_0x2c7556,_0x477085){if(_0x2c7556[_0x29a6('0x43')]['id']){delete _0x2c7556[_0x29a6('0x43')]['id'];}return db[_0x29a6('0x26')][_0x29a6('0x44')]({'where':{'id':_0x2c7556[_0x29a6('0x41')]['id']}})[_0x29a6('0x21')](handleEntityNotFound(_0x477085,null))['then'](saveUpdates(_0x2c7556[_0x29a6('0x43')],null))[_0x29a6('0x21')](respondWithResult(_0x477085,null))[_0x29a6('0x3f')](handleError(_0x477085,null));};exports[_0x29a6('0x45')]=function(_0x5671db,_0x3252cd){return db[_0x29a6('0x26')]['find']({'where':{'id':_0x5671db['params']['id']}})['then'](handleEntityNotFound(_0x3252cd,null))[_0x29a6('0x21')](removeEntity(_0x3252cd,null))[_0x29a6('0x3f')](handleError(_0x3252cd,null));};exports[_0x29a6('0x46')]=function(_0xdcb166,_0x5cf8cf,_0x3c3262){var _0x32327b={};var _0x5af0be={};var _0x342585;var _0x1eacb0;return db[_0x29a6('0x26')][_0x29a6('0x47')]({'where':{'id':_0xdcb166[_0x29a6('0x41')]['id']}})[_0x29a6('0x21')](handleEntityNotFound(_0x5cf8cf,null))['then'](function(_0x209805){if(_0x209805){_0x342585=_0x209805;_0x5af0be[_0x29a6('0x2f')]=_['keys'](db[_0x29a6('0x48')]['rawAttributes']);_0x5af0be[_0x29a6('0x2b')]=_['keys'](_0xdcb166[_0x29a6('0x2b')]);_0x5af0be[_0x29a6('0x2d')]=_[_0x29a6('0x2e')](_0x5af0be[_0x29a6('0x2f')],_0x5af0be['query']);_0x32327b[_0x29a6('0x30')]=_[_0x29a6('0x2e')](_0x5af0be[_0x29a6('0x2f')],qs['fields'](_0xdcb166['query']['fields']));_0x32327b['attributes']=_0x32327b['attributes'][_0x29a6('0x32')]?_0x32327b[_0x29a6('0x30')]:_0x5af0be['model'];_0x32327b[_0x29a6('0x35')]=qs['sort'](_0xdcb166[_0x29a6('0x2b')][_0x29a6('0x36')]);_0x32327b[_0x29a6('0x38')]=qs[_0x29a6('0x2d')](_[_0x29a6('0x37')](_0xdcb166[_0x29a6('0x2b')],_0x5af0be[_0x29a6('0x2d')]));if(_0xdcb166[_0x29a6('0x2b')][_0x29a6('0x49')]){_0x32327b['where']=_[_0x29a6('0x39')](_0x32327b[_0x29a6('0x38')],{'$or':_['map'](_0x32327b[_0x29a6('0x30')],function(_0x1565de){var _0x317803={};_0x317803[_0x1565de]={'$like':'%'+_0xdcb166['query']['filter']+'%'};return _0x317803;})});}_0x32327b=_[_0x29a6('0x39')]({},_0x32327b,_0xdcb166[_0x29a6('0x3b')]);return _0x342585['getFields'](_0x32327b);}})[_0x29a6('0x21')](function(_0x51f5fc){if(_0x51f5fc){_0x1eacb0=_0x51f5fc[_0x29a6('0x32')];if(!_0xdcb166['query'][_0x29a6('0x33')]('nolimit')){_0x32327b['limit']=qs[_0x29a6('0x1a')](_0xdcb166[_0x29a6('0x2b')]['limit']);_0x32327b[_0x29a6('0x18')]=qs['offset'](_0xdcb166[_0x29a6('0x2b')]['offset']);}return _0x342585[_0x29a6('0x46')](_0x32327b);}})['then'](function(_0x3c4ba4){if(_0x3c4ba4){return _0x3c4ba4?{'count':_0x1eacb0,'rows':_0x3c4ba4}:null;}})['then'](respondWithResult(_0x5cf8cf,null))[_0x29a6('0x3f')](handleError(_0x5cf8cf,null));};exports[_0x29a6('0x4a')]=function(_0x507d7f,_0x290f86,_0x1f8726){var _0x41a9e6={};var _0x2719c7={};var _0x437983;var _0x40afae;return db[_0x29a6('0x26')][_0x29a6('0x47')]({'where':{'id':_0x507d7f[_0x29a6('0x41')]['id']}})[_0x29a6('0x21')](handleEntityNotFound(_0x290f86,null))[_0x29a6('0x21')](function(_0x473742){if(_0x473742){_0x437983=_0x473742;_0x2719c7[_0x29a6('0x2f')]=_[_0x29a6('0x2c')](db[_0x29a6('0x48')][_0x29a6('0x27')]);_0x2719c7[_0x29a6('0x2b')]=_[_0x29a6('0x2c')](_0x507d7f['query']);_0x2719c7[_0x29a6('0x2d')]=_[_0x29a6('0x2e')](_0x2719c7[_0x29a6('0x2f')],_0x2719c7[_0x29a6('0x2b')]);_0x41a9e6[_0x29a6('0x30')]=_[_0x29a6('0x2e')](_0x2719c7[_0x29a6('0x2f')],qs[_0x29a6('0x31')](_0x507d7f[_0x29a6('0x2b')][_0x29a6('0x31')]));_0x41a9e6[_0x29a6('0x30')]=_0x41a9e6[_0x29a6('0x30')]['length']?_0x41a9e6['attributes']:_0x2719c7['model'];_0x41a9e6['order']=qs['sort'](_0x507d7f[_0x29a6('0x2b')][_0x29a6('0x36')]);_0x41a9e6[_0x29a6('0x38')]=qs[_0x29a6('0x2d')](_[_0x29a6('0x37')](_0x507d7f[_0x29a6('0x2b')],_0x2719c7[_0x29a6('0x2d')]));if(_0x507d7f[_0x29a6('0x2b')][_0x29a6('0x49')]){_0x41a9e6[_0x29a6('0x38')]=_['merge'](_0x41a9e6['where'],{'$or':_[_0x29a6('0x4b')](_0x41a9e6[_0x29a6('0x30')],function(_0x354bdf){var _0xd195c9={};_0xd195c9[_0x354bdf]={'$like':'%'+_0x507d7f[_0x29a6('0x2b')][_0x29a6('0x49')]+'%'};return _0xd195c9;})});}_0x41a9e6=_[_0x29a6('0x39')]({},_0x41a9e6,_0x507d7f[_0x29a6('0x3b')]);return _0x437983[_0x29a6('0x4a')](_0x41a9e6);}})['then'](function(_0x5ccb7e){if(_0x5ccb7e){_0x40afae=_0x5ccb7e[_0x29a6('0x32')];if(!_0x507d7f[_0x29a6('0x2b')][_0x29a6('0x33')](_0x29a6('0x34'))){_0x41a9e6[_0x29a6('0x1a')]=qs[_0x29a6('0x1a')](_0x507d7f[_0x29a6('0x2b')][_0x29a6('0x1a')]);_0x41a9e6[_0x29a6('0x18')]=qs['offset'](_0x507d7f[_0x29a6('0x2b')]['offset']);}return _0x437983[_0x29a6('0x4a')](_0x41a9e6);}})[_0x29a6('0x21')](function(_0x55fb39){if(_0x55fb39){return _0x55fb39?{'count':_0x40afae,'rows':_0x55fb39}:null;}})[_0x29a6('0x21')](respondWithResult(_0x290f86,null))[_0x29a6('0x3f')](handleError(_0x290f86,null));};exports[_0x29a6('0x4c')]=function(_0x3ebd32,_0x36d51d,_0x19c3b9){var _0x1302ca={};var _0x5429d4={};var _0x254e6b;var _0x113845;return db[_0x29a6('0x26')][_0x29a6('0x47')]({'where':{'id':_0x3ebd32[_0x29a6('0x41')]['id']}})[_0x29a6('0x21')](handleEntityNotFound(_0x36d51d,null))[_0x29a6('0x21')](function(_0x3ae42a){if(_0x3ae42a){_0x254e6b=_0x3ae42a;_0x5429d4['model']=_[_0x29a6('0x2c')](db[_0x29a6('0x48')][_0x29a6('0x27')]);_0x5429d4[_0x29a6('0x2b')]=_[_0x29a6('0x2c')](_0x3ebd32['query']);_0x5429d4['filters']=_[_0x29a6('0x2e')](_0x5429d4[_0x29a6('0x2f')],_0x5429d4[_0x29a6('0x2b')]);_0x1302ca[_0x29a6('0x30')]=_[_0x29a6('0x2e')](_0x5429d4['model'],qs['fields'](_0x3ebd32[_0x29a6('0x2b')][_0x29a6('0x31')]));_0x1302ca[_0x29a6('0x30')]=_0x1302ca[_0x29a6('0x30')][_0x29a6('0x32')]?_0x1302ca[_0x29a6('0x30')]:_0x5429d4[_0x29a6('0x2f')];_0x1302ca['order']=qs[_0x29a6('0x36')](_0x3ebd32[_0x29a6('0x2b')][_0x29a6('0x36')]);_0x1302ca[_0x29a6('0x38')]=qs['filters'](_['pick'](_0x3ebd32[_0x29a6('0x2b')],_0x5429d4['filters']));if(_0x3ebd32['query']['filter']){_0x1302ca[_0x29a6('0x38')]=_['merge'](_0x1302ca[_0x29a6('0x38')],{'$or':_[_0x29a6('0x4b')](_0x1302ca['attributes'],function(_0x20958b){var _0x369aac={};_0x369aac[_0x20958b]={'$like':'%'+_0x3ebd32[_0x29a6('0x2b')][_0x29a6('0x49')]+'%'};return _0x369aac;})});}_0x1302ca=_[_0x29a6('0x39')]({},_0x1302ca,_0x3ebd32[_0x29a6('0x3b')]);return _0x254e6b[_0x29a6('0x4c')](_0x1302ca);}})[_0x29a6('0x21')](function(_0x229acb){if(_0x229acb){_0x113845=_0x229acb['length'];if(!_0x3ebd32['query'][_0x29a6('0x33')](_0x29a6('0x34'))){_0x1302ca[_0x29a6('0x1a')]=qs[_0x29a6('0x1a')](_0x3ebd32['query']['limit']);_0x1302ca[_0x29a6('0x18')]=qs[_0x29a6('0x18')](_0x3ebd32['query']['offset']);}return _0x254e6b[_0x29a6('0x4c')](_0x1302ca);}})[_0x29a6('0x21')](function(_0x5ca92c){if(_0x5ca92c){return _0x5ca92c?{'count':_0x113845,'rows':_0x5ca92c}:null;}})[_0x29a6('0x21')](respondWithResult(_0x36d51d,null))[_0x29a6('0x3f')](handleError(_0x36d51d,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index fc0a7f6..9812ee1 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 _0xe22b=['./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash','util','moment','bluebird','request-promise','path'];(function(_0x3145af,_0x53a1d5){var _0x37758a=function(_0x4b1627){while(--_0x4b1627){_0x3145af['push'](_0x3145af['shift']());}};_0x37758a(++_0x53a1d5);}(_0xe22b,0x72));var _0xbe22=function(_0x26402c,_0x1623a3){_0x26402c=_0x26402c-0x0;var _0x3a4ef4=_0xe22b[_0x26402c];return _0x3a4ef4;};'use strict';var _=require(_0xbe22('0x0'));var util=require(_0xbe22('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe22('0x2'));var BPromise=require(_0xbe22('0x3'));var rp=require(_0xbe22('0x4'));var fs=require('fs');var path=require(_0xbe22('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe22('0x6'));module[_0xbe22('0x7')]=function(_0x2b4c47,_0x509271){return _0x2b4c47[_0xbe22('0x8')](_0xbe22('0x9'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1056=['exports','define','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x281827,_0x2cd788){var _0x4dfa0c=function(_0x47679d){while(--_0x47679d){_0x281827['push'](_0x281827['shift']());}};_0x4dfa0c(++_0x2cd788);}(_0x1056,0x1b0));var _0x6105=function(_0xa03db6,_0x436e2c){_0xa03db6=_0xa03db6-0x0;var _0x1e7e80=_0x1056[_0xa03db6];return _0x1e7e80;};'use strict';var _=require(_0x6105('0x0'));var util=require(_0x6105('0x1'));var logger=require(_0x6105('0x2'))(_0x6105('0x3'));var moment=require(_0x6105('0x4'));var BPromise=require(_0x6105('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6105('0x6'));var config=require(_0x6105('0x7'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x6105('0x8')]=function(_0x1091eb,_0x3804ea){return _0x1091eb[_0x6105('0x9')]('VtigerConfiguration',attributes,{'tableName':_0x6105('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js index db0c2b3..715033b 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 _0xd29a=['request','then','info','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','VtigerConfiguration,\x20%s,\x20%s','message','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x164b5b,_0x354855){var _0x4bf67f=function(_0x3c2589){while(--_0x3c2589){_0x164b5b['push'](_0x164b5b['shift']());}};_0x4bf67f(++_0x354855);}(_0xd29a,0x114));var _0xad29=function(_0x830d69,_0x50c662){_0x830d69=_0x830d69-0x0;var _0x205a08=_0xd29a[_0x830d69];return _0x205a08;};'use strict';var _=require(_0xad29('0x0'));var util=require(_0xad29('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xad29('0x2'));var db=require(_0xad29('0x3'))['db'];var utils=require(_0xad29('0x4'));var logger=require('../../config/logger')(_0xad29('0x5'));var config=require('../../config/environment');var jayson=require(_0xad29('0x6'));var client=jayson[_0xad29('0x7')][_0xad29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x17d3d6,_0x3c98d7,_0x598ca5){return new BPromise(function(_0x106585,_0x2ccab6){return client[_0xad29('0x9')](_0x17d3d6,_0x598ca5)[_0xad29('0xa')](function(_0x286847){logger[_0xad29('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0x3c98d7,_0xad29('0xc'));logger['debug'](_0xad29('0xd'),_0x3c98d7,_0xad29('0xc'),JSON['stringify'](_0x286847));if(_0x286847[_0xad29('0xe')]){if(_0x286847['error'][_0xad29('0xf')]===0x1f4){logger[_0xad29('0xe')](_0xad29('0x10'),_0x3c98d7,_0x286847[_0xad29('0xe')][_0xad29('0x11')]);return _0x2ccab6(_0x286847['error'][_0xad29('0x11')]);}logger[_0xad29('0xe')](_0xad29('0x10'),_0x3c98d7,_0x286847[_0xad29('0xe')][_0xad29('0x11')]);return _0x106585(_0x286847['error']['message']);}else{logger[_0xad29('0xb')](_0xad29('0x10'),_0x3c98d7,_0xad29('0xc'));_0x106585(_0x286847['result']['message']);}})[_0xad29('0x12')](function(_0x154adb){logger[_0xad29('0xe')](_0xad29('0x10'),_0x3c98d7,_0x154adb);_0x2ccab6(_0x154adb);});});} \ No newline at end of file +var _0x7ad6=['randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','bluebird'];(function(_0x688263,_0x3de4b2){var _0x7db12=function(_0x2d9956){while(--_0x2d9956){_0x688263['push'](_0x688263['shift']());}};_0x7db12(++_0x3de4b2);}(_0x7ad6,0x87));var _0x67ad=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x7ad6[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x67ad('0x0'));var util=require(_0x67ad('0x1'));var moment=require('moment');var BPromise=require(_0x67ad('0x2'));var rs=require(_0x67ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x67ad('0x4'))(_0x67ad('0x5'));var config=require(_0x67ad('0x6'));var jayson=require(_0x67ad('0x7'));var client=jayson[_0x67ad('0x8')][_0x67ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58410d,_0x380fa1,_0x482d03){return new BPromise(function(_0x174662,_0x15838f){return client[_0x67ad('0xa')](_0x58410d,_0x482d03)[_0x67ad('0xb')](function(_0x35308d){logger['info'](_0x67ad('0xc'),_0x380fa1,_0x67ad('0xd'));logger[_0x67ad('0xe')](_0x67ad('0xf'),_0x380fa1,_0x67ad('0xd'),JSON[_0x67ad('0x10')](_0x35308d));if(_0x35308d['error']){if(_0x35308d[_0x67ad('0x11')][_0x67ad('0x12')]===0x1f4){logger['error'](_0x67ad('0xc'),_0x380fa1,_0x35308d['error']['message']);return _0x15838f(_0x35308d['error']['message']);}logger[_0x67ad('0x11')](_0x67ad('0xc'),_0x380fa1,_0x35308d[_0x67ad('0x11')][_0x67ad('0x13')]);return _0x174662(_0x35308d['error'][_0x67ad('0x13')]);}else{logger[_0x67ad('0x14')](_0x67ad('0xc'),_0x380fa1,'request\x20sent');_0x174662(_0x35308d[_0x67ad('0x15')][_0x67ad('0x13')]);}})[_0x67ad('0x16')](function(_0x2d1d82){logger[_0x67ad('0x11')](_0x67ad('0xc'),_0x380fa1,_0x2d1d82);_0x15838f(_0x2d1d82);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 5965475..18bde6c 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 _0xd6e3=['create','put','update','delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','post'];(function(_0x440617,_0x10b888){var _0x7c113a=function(_0x58d6ec){while(--_0x58d6ec){_0x440617['push'](_0x440617['shift']());}};_0x7c113a(++_0x10b888);}(_0xd6e3,0x1bf));var _0x3d6e=function(_0x2d4835,_0x25821d){_0x2d4835=_0x2d4835-0x0;var _0x46be08=_0xd6e3[_0x2d4835];return _0x46be08;};'use strict';var multer=require('multer');var util=require(_0x3d6e('0x0'));var path=require(_0x3d6e('0x1'));var timeout=require(_0x3d6e('0x2'));var express=require('express');var router=express[_0x3d6e('0x3')]();var fs_extra=require(_0x3d6e('0x4'));var auth=require(_0x3d6e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3d6e('0x6'));var controller=require('./intVtigerField.controller');router[_0x3d6e('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3d6e('0x7')](_0x3d6e('0x8'),auth[_0x3d6e('0x9')](),controller[_0x3d6e('0xa')]);router[_0x3d6e('0xb')]('/',auth['isAuthenticated'](),controller[_0x3d6e('0xc')]);router[_0x3d6e('0xd')](_0x3d6e('0x8'),auth['isAuthenticated'](),controller[_0x3d6e('0xe')]);router[_0x3d6e('0xf')](_0x3d6e('0x8'),auth[_0x3d6e('0x9')](),controller['destroy']);module[_0x3d6e('0x10')]=router; \ No newline at end of file +var _0x1c95=['exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','show','isAuthenticated','/:id','update','delete','destroy'];(function(_0x383c49,_0x1ed38b){var _0x3cb9a6=function(_0x4d4201){while(--_0x4d4201){_0x383c49['push'](_0x383c49['shift']());}};_0x3cb9a6(++_0x1ed38b);}(_0x1c95,0xb5));var _0x51c9=function(_0x1ca9f9,_0x4276b8){_0x1ca9f9=_0x1ca9f9-0x0;var _0x255648=_0x1c95[_0x1ca9f9];return _0x255648;};'use strict';var multer=require(_0x51c9('0x0'));var util=require('util');var path=require(_0x51c9('0x1'));var timeout=require('connect-timeout');var express=require(_0x51c9('0x2'));var router=express[_0x51c9('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x51c9('0x4'));var config=require(_0x51c9('0x5'));var controller=require(_0x51c9('0x6'));router[_0x51c9('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x51c9('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x51c9('0x8')]);router['post']('/',auth[_0x51c9('0x9')](),controller['create']);router['put'](_0x51c9('0xa'),auth['isAuthenticated'](),controller[_0x51c9('0xb')]);router[_0x51c9('0xc')](_0x51c9('0xa'),auth[_0x51c9('0x9')](),controller[_0x51c9('0xd')]);module[_0x51c9('0xe')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 925ac52..e54fe66 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 _0x453c=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x1044e5,_0x498e01){var _0x5ad0dd=function(_0x458548){while(--_0x458548){_0x1044e5['push'](_0x1044e5['shift']());}};_0x5ad0dd(++_0x498e01);}(_0x453c,0x78));var _0xc453=function(_0x1d50f2,_0x3c3ec6){_0x1d50f2=_0x1d50f2-0x0;var _0x3769b8=_0x453c[_0x1d50f2];return _0x3769b8;};'use strict';var Sequelize=require(_0xc453('0x0'));module[_0xc453('0x1')]={'type':{'type':Sequelize[_0xc453('0x2')](_0xc453('0x3'),_0xc453('0x4'),_0xc453('0x5'),'keyValue',_0xc453('0x6')),'defaultValue':_0xc453('0x3')},'content':{'type':Sequelize[_0xc453('0x7')]},'key':{'type':Sequelize[_0xc453('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xc453('0x3'),_0xc453('0x4'),_0xc453('0x5'))},'keyContent':{'type':Sequelize[_0xc453('0x7')]},'idField':{'type':Sequelize[_0xc453('0x7')]},'nameField':{'type':Sequelize[_0xc453('0x7')]},'customField':{'type':Sequelize[_0xc453('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc453('0x7')]}}; \ No newline at end of file +var _0x3843=['BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x4f8519,_0x29ab6d){var _0xdaf7fa=function(_0x264b61){while(--_0x264b61){_0x4f8519['push'](_0x4f8519['shift']());}};_0xdaf7fa(++_0x29ab6d);}(_0x3843,0x14b));var _0x3384=function(_0x3edc9c,_0x5139ce){_0x3edc9c=_0x3edc9c-0x0;var _0x4a4c72=_0x3843[_0x3edc9c];return _0x4a4c72;};'use strict';var Sequelize=require(_0x3384('0x0'));module[_0x3384('0x1')]={'type':{'type':Sequelize[_0x3384('0x2')](_0x3384('0x3'),_0x3384('0x4'),'customVariable',_0x3384('0x5'),_0x3384('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x3384('0x7')]},'keyType':{'type':Sequelize[_0x3384('0x2')](_0x3384('0x3'),_0x3384('0x4'),_0x3384('0x8'))},'keyContent':{'type':Sequelize[_0x3384('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3384('0x7')]},'customField':{'type':Sequelize[_0x3384('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 538a961..d61d1c5 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 _0xaf0f=['catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','name','send','map','rawAttributes','fieldName','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','VtigerField','include','findAll','params','find'];(function(_0x295a3d,_0x56d487){var _0x23a732=function(_0x15cfc2){while(--_0x15cfc2){_0x295a3d['push'](_0x295a3d['shift']());}};_0x23a732(++_0x56d487);}(_0xaf0f,0xde));var _0xfaf0=function(_0x3a940e,_0x6ca612){_0x3a940e=_0x3a940e-0x0;var _0x1414dd=_0xaf0f[_0x3a940e];return _0x1414dd;};'use strict';var emlformat=require(_0xfaf0('0x0'));var rimraf=require(_0xfaf0('0x1'));var zipdir=require(_0xfaf0('0x2'));var jsonpatch=require(_0xfaf0('0x3'));var rp=require(_0xfaf0('0x4'));var moment=require(_0xfaf0('0x5'));var BPromise=require(_0xfaf0('0x6'));var Mustache=require(_0xfaf0('0x7'));var util=require(_0xfaf0('0x8'));var path=require(_0xfaf0('0x9'));var sox=require(_0xfaf0('0xa'));var csv=require(_0xfaf0('0xb'));var ejs=require(_0xfaf0('0xc'));var fs=require('fs');var fs_extra=require(_0xfaf0('0xd'));var _=require(_0xfaf0('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfaf0('0xf'));var deskjs=require(_0xfaf0('0x10'));var toCsv=require('to-csv');var querystring=require(_0xfaf0('0x11'));var Papa=require(_0xfaf0('0x12'));var Redis=require(_0xfaf0('0x13'));var authService=require(_0xfaf0('0x14'));var qs=require(_0xfaf0('0x15'));var as=require(_0xfaf0('0x16'));var hardwareService=require(_0xfaf0('0x17'));var logger=require(_0xfaf0('0x18'))(_0xfaf0('0x19'));var utils=require(_0xfaf0('0x1a'));var config=require(_0xfaf0('0x1b'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2289d3,_0x16f73e){_0x16f73e=_0x16f73e||0xcc;return function(_0x47db0d){if(_0x47db0d){return _0x2289d3[_0xfaf0('0x1c')](_0x16f73e);}return _0x2289d3[_0xfaf0('0x1d')](_0x16f73e)[_0xfaf0('0x1e')]();};}function respondWithResult(_0x1fe2b9,_0x3683ba){_0x3683ba=_0x3683ba||0xc8;return function(_0x3d9f4d){if(_0x3d9f4d){return _0x1fe2b9[_0xfaf0('0x1d')](_0x3683ba)[_0xfaf0('0x1f')](_0x3d9f4d);}};}function respondWithFilteredResult(_0x357275,_0x5afc39){return function(_0x675d8e){if(_0x675d8e){var _0x17b224=typeof _0x5afc39[_0xfaf0('0x20')]==='undefined'&&typeof _0x5afc39[_0xfaf0('0x21')]===_0xfaf0('0x22');var _0x2942aa=_0x675d8e[_0xfaf0('0x23')];var _0x1b4568=_0x17b224?0x0:_0x5afc39[_0xfaf0('0x20')];var _0x2488b6=_0x17b224?_0x675d8e[_0xfaf0('0x23')]:_0x5afc39[_0xfaf0('0x20')]+_0x5afc39[_0xfaf0('0x21')];var _0x8397a;if(_0x2488b6>=_0x2942aa){_0x2488b6=_0x2942aa;_0x8397a=0xc8;}else{_0x8397a=0xce;}_0x357275[_0xfaf0('0x1d')](_0x8397a);return _0x357275['set'](_0xfaf0('0x24'),_0x1b4568+'-'+_0x2488b6+'/'+_0x2942aa)[_0xfaf0('0x1f')](_0x675d8e);}return null;};}function patchUpdates(_0x5c3236){return function(_0x5ac6dc){try{jsonpatch['apply'](_0x5ac6dc,_0x5c3236,!![]);}catch(_0x245afc){return BPromise[_0xfaf0('0x25')](_0x245afc);}return _0x5ac6dc[_0xfaf0('0x26')]();};}function saveUpdates(_0x58387f,_0x39ed86){return function(_0x268d16){if(_0x268d16){return _0x268d16[_0xfaf0('0x27')](_0x58387f)[_0xfaf0('0x28')](function(_0x14a1e3){return _0x14a1e3;});}return null;};}function removeEntity(_0xc09626,_0x3a0a2a){return function(_0x2a4a65){if(_0x2a4a65){return _0x2a4a65[_0xfaf0('0x29')]()[_0xfaf0('0x28')](function(){_0xc09626[_0xfaf0('0x1d')](0xcc)[_0xfaf0('0x1e')]();});}};}function handleEntityNotFound(_0x436a1c,_0x1d67a8){return function(_0x1f4dde){if(!_0x1f4dde){_0x436a1c[_0xfaf0('0x1c')](0x194);}return _0x1f4dde;};}function handleError(_0x315de1,_0x31628e){_0x31628e=_0x31628e||0x1f4;return function(_0x47a1ca){logger['error'](_0x47a1ca['stack']);if(_0x47a1ca[_0xfaf0('0x2a')]){delete _0x47a1ca[_0xfaf0('0x2a')];}_0x315de1['status'](_0x31628e)[_0xfaf0('0x2b')](_0x47a1ca);};}exports['index']=function(_0x323ff4,_0x3416f9){var _0x23480d={},_0x430c6c={},_0x8d5065={'count':0x0,'rows':[]};var _0x3d0049=_[_0xfaf0('0x2c')](db['VtigerField'][_0xfaf0('0x2d')],function(_0x335cba){return{'name':_0x335cba[_0xfaf0('0x2e')],'type':_0x335cba['type']['key']};});_0x430c6c['model']=_['map'](_0x3d0049,_0xfaf0('0x2a'));_0x430c6c[_0xfaf0('0x2f')]=_[_0xfaf0('0x30')](_0x323ff4[_0xfaf0('0x2f')]);_0x430c6c[_0xfaf0('0x31')]=_['intersection'](_0x430c6c[_0xfaf0('0x32')],_0x430c6c['query']);_0x23480d[_0xfaf0('0x33')]=_[_0xfaf0('0x34')](_0x430c6c[_0xfaf0('0x32')],qs[_0xfaf0('0x35')](_0x323ff4[_0xfaf0('0x2f')][_0xfaf0('0x35')]));_0x23480d['attributes']=_0x23480d[_0xfaf0('0x33')][_0xfaf0('0x36')]?_0x23480d['attributes']:_0x430c6c[_0xfaf0('0x32')];if(!_0x323ff4[_0xfaf0('0x2f')][_0xfaf0('0x37')](_0xfaf0('0x38'))){_0x23480d['limit']=qs[_0xfaf0('0x21')](_0x323ff4[_0xfaf0('0x2f')][_0xfaf0('0x21')]);_0x23480d[_0xfaf0('0x20')]=qs['offset'](_0x323ff4[_0xfaf0('0x2f')][_0xfaf0('0x20')]);}_0x23480d[_0xfaf0('0x39')]=qs[_0xfaf0('0x3a')](_0x323ff4['query'][_0xfaf0('0x3a')]);_0x23480d[_0xfaf0('0x3b')]=qs[_0xfaf0('0x31')](_['pick'](_0x323ff4['query'],_0x430c6c[_0xfaf0('0x31')]),_0x3d0049);if(_0x323ff4[_0xfaf0('0x2f')][_0xfaf0('0x3c')]){_0x23480d[_0xfaf0('0x3b')]=_[_0xfaf0('0x3d')](_0x23480d[_0xfaf0('0x3b')],{'$or':_['map'](_0x3d0049,function(_0x551103){if(_0x551103[_0xfaf0('0x3e')]!==_0xfaf0('0x3f')){var _0x1005b5={};_0x1005b5[_0x551103[_0xfaf0('0x2a')]]={'$like':'%'+_0x323ff4[_0xfaf0('0x2f')][_0xfaf0('0x3c')]+'%'};return _0x1005b5;}})});}_0x23480d=_[_0xfaf0('0x3d')]({},_0x23480d,_0x323ff4[_0xfaf0('0x40')]);var _0x52d910={'where':_0x23480d[_0xfaf0('0x3b')]};return db[_0xfaf0('0x41')][_0xfaf0('0x23')](_0x52d910)['then'](function(_0x51241c){_0x8d5065['count']=_0x51241c;if(_0x323ff4['query']['includeAll']){_0x23480d[_0xfaf0('0x42')]=[{'all':!![]}];}return db[_0xfaf0('0x41')][_0xfaf0('0x43')](_0x23480d);})['then'](function(_0x57c3bc){_0x8d5065['rows']=_0x57c3bc;return _0x8d5065;})[_0xfaf0('0x28')](respondWithFilteredResult(_0x3416f9,_0x23480d))['catch'](handleError(_0x3416f9,null));};exports['show']=function(_0x20d0bc,_0x43be33){var _0x30b977={'raw':!![],'where':{'id':_0x20d0bc[_0xfaf0('0x44')]['id']}},_0x4ce2f4={};_0x4ce2f4[_0xfaf0('0x32')]=_[_0xfaf0('0x30')](db[_0xfaf0('0x41')]['rawAttributes']);_0x4ce2f4[_0xfaf0('0x2f')]=_[_0xfaf0('0x30')](_0x20d0bc[_0xfaf0('0x2f')]);_0x4ce2f4[_0xfaf0('0x31')]=_[_0xfaf0('0x34')](_0x4ce2f4[_0xfaf0('0x32')],_0x4ce2f4[_0xfaf0('0x2f')]);_0x30b977['attributes']=_[_0xfaf0('0x34')](_0x4ce2f4[_0xfaf0('0x32')],qs[_0xfaf0('0x35')](_0x20d0bc[_0xfaf0('0x2f')][_0xfaf0('0x35')]));_0x30b977[_0xfaf0('0x33')]=_0x30b977['attributes'][_0xfaf0('0x36')]?_0x30b977['attributes']:_0x4ce2f4[_0xfaf0('0x32')];if(_0x20d0bc[_0xfaf0('0x2f')]['includeAll']){_0x30b977[_0xfaf0('0x42')]=[{'all':!![]}];}_0x30b977=_[_0xfaf0('0x3d')]({},_0x30b977,_0x20d0bc[_0xfaf0('0x40')]);return db[_0xfaf0('0x41')][_0xfaf0('0x45')](_0x30b977)[_0xfaf0('0x28')](handleEntityNotFound(_0x43be33,null))['then'](respondWithResult(_0x43be33,null))[_0xfaf0('0x46')](handleError(_0x43be33,null));};exports[_0xfaf0('0x47')]=function(_0x51f020,_0x2ba3e9){return db[_0xfaf0('0x41')][_0xfaf0('0x47')](_0x51f020['body'],{})[_0xfaf0('0x28')](respondWithResult(_0x2ba3e9,0xc9))[_0xfaf0('0x46')](handleError(_0x2ba3e9,null));};exports[_0xfaf0('0x27')]=function(_0x1ed4c9,_0x30ed99){if(_0x1ed4c9['body']['id']){delete _0x1ed4c9[_0xfaf0('0x48')]['id'];}return db[_0xfaf0('0x41')][_0xfaf0('0x45')]({'where':{'id':_0x1ed4c9[_0xfaf0('0x44')]['id']}})[_0xfaf0('0x28')](handleEntityNotFound(_0x30ed99,null))[_0xfaf0('0x28')](saveUpdates(_0x1ed4c9[_0xfaf0('0x48')],null))[_0xfaf0('0x28')](respondWithResult(_0x30ed99,null))[_0xfaf0('0x46')](handleError(_0x30ed99,null));};exports[_0xfaf0('0x29')]=function(_0x240136,_0x18dd16){return db[_0xfaf0('0x41')][_0xfaf0('0x45')]({'where':{'id':_0x240136['params']['id']}})[_0xfaf0('0x28')](handleEntityNotFound(_0x18dd16,null))[_0xfaf0('0x28')](removeEntity(_0x18dd16,null))['catch'](handleError(_0x18dd16,null));}; \ No newline at end of file +var _0x3bd4=['query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','VtigerField','fieldName','key','model','map'];(function(_0x313694,_0x12c53b){var _0x227546=function(_0x6c1d10){while(--_0x6c1d10){_0x313694['push'](_0x313694['shift']());}};_0x227546(++_0x12c53b);}(_0x3bd4,0x14c));var _0x43bd=function(_0x1a381e,_0x3030ab){_0x1a381e=_0x1a381e-0x0;var _0x4d0482=_0x3bd4[_0x1a381e];return _0x4d0482;};'use strict';var emlformat=require(_0x43bd('0x0'));var rimraf=require(_0x43bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x43bd('0x2'));var rp=require(_0x43bd('0x3'));var moment=require('moment');var BPromise=require(_0x43bd('0x4'));var Mustache=require(_0x43bd('0x5'));var util=require(_0x43bd('0x6'));var path=require(_0x43bd('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x43bd('0x8'));var fs=require('fs');var fs_extra=require(_0x43bd('0x9'));var _=require(_0x43bd('0xa'));var squel=require('squel');var crypto=require(_0x43bd('0xb'));var jsforce=require(_0x43bd('0xc'));var deskjs=require(_0x43bd('0xd'));var toCsv=require(_0x43bd('0xe'));var querystring=require('querystring');var Papa=require(_0x43bd('0xf'));var Redis=require(_0x43bd('0x10'));var authService=require(_0x43bd('0x11'));var qs=require(_0x43bd('0x12'));var as=require(_0x43bd('0x13'));var hardwareService=require(_0x43bd('0x14'));var logger=require(_0x43bd('0x15'))(_0x43bd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x43bd('0x17'));var db=require(_0x43bd('0x18'))['db'];function respondWithStatusCode(_0x38325d,_0x51d540){_0x51d540=_0x51d540||0xcc;return function(_0x5a0d24){if(_0x5a0d24){return _0x38325d['sendStatus'](_0x51d540);}return _0x38325d[_0x43bd('0x19')](_0x51d540)[_0x43bd('0x1a')]();};}function respondWithResult(_0x21678f,_0xc3ae75){_0xc3ae75=_0xc3ae75||0xc8;return function(_0x260cd0){if(_0x260cd0){return _0x21678f[_0x43bd('0x19')](_0xc3ae75)[_0x43bd('0x1b')](_0x260cd0);}};}function respondWithFilteredResult(_0x203746,_0xec9370){return function(_0x4dc6e8){if(_0x4dc6e8){var _0x3b4032=typeof _0xec9370[_0x43bd('0x1c')]===_0x43bd('0x1d')&&typeof _0xec9370[_0x43bd('0x1e')]===_0x43bd('0x1d');var _0xc07fcc=_0x4dc6e8[_0x43bd('0x1f')];var _0x543f48=_0x3b4032?0x0:_0xec9370[_0x43bd('0x1c')];var _0x3a4be5=_0x3b4032?_0x4dc6e8[_0x43bd('0x1f')]:_0xec9370['offset']+_0xec9370[_0x43bd('0x1e')];var _0x4d3555;if(_0x3a4be5>=_0xc07fcc){_0x3a4be5=_0xc07fcc;_0x4d3555=0xc8;}else{_0x4d3555=0xce;}_0x203746[_0x43bd('0x19')](_0x4d3555);return _0x203746[_0x43bd('0x20')](_0x43bd('0x21'),_0x543f48+'-'+_0x3a4be5+'/'+_0xc07fcc)[_0x43bd('0x1b')](_0x4dc6e8);}return null;};}function patchUpdates(_0x41c82){return function(_0x380718){try{jsonpatch[_0x43bd('0x22')](_0x380718,_0x41c82,!![]);}catch(_0x456080){return BPromise[_0x43bd('0x23')](_0x456080);}return _0x380718[_0x43bd('0x24')]();};}function saveUpdates(_0x33fee1,_0xab7867){return function(_0x4d2281){if(_0x4d2281){return _0x4d2281[_0x43bd('0x25')](_0x33fee1)['then'](function(_0x2bac6a){return _0x2bac6a;});}return null;};}function removeEntity(_0x44e855,_0x7884cf){return function(_0x267138){if(_0x267138){return _0x267138['destroy']()[_0x43bd('0x26')](function(){_0x44e855[_0x43bd('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d8d50,_0x25d40b){return function(_0x2bc706){if(!_0x2bc706){_0x5d8d50['sendStatus'](0x194);}return _0x2bc706;};}function handleError(_0x2d0382,_0x40845d){_0x40845d=_0x40845d||0x1f4;return function(_0xa77ac0){logger['error'](_0xa77ac0[_0x43bd('0x27')]);if(_0xa77ac0[_0x43bd('0x28')]){delete _0xa77ac0['name'];}_0x2d0382[_0x43bd('0x19')](_0x40845d)[_0x43bd('0x29')](_0xa77ac0);};}exports[_0x43bd('0x2a')]=function(_0x5429b3,_0x1c7347){var _0x3ba866={},_0x1fb47a={},_0x1cc07f={'count':0x0,'rows':[]};var _0x2531eb=_['map'](db[_0x43bd('0x2b')]['rawAttributes'],function(_0xe2d27f){return{'name':_0xe2d27f[_0x43bd('0x2c')],'type':_0xe2d27f['type'][_0x43bd('0x2d')]};});_0x1fb47a[_0x43bd('0x2e')]=_[_0x43bd('0x2f')](_0x2531eb,'name');_0x1fb47a[_0x43bd('0x30')]=_[_0x43bd('0x31')](_0x5429b3[_0x43bd('0x30')]);_0x1fb47a['filters']=_[_0x43bd('0x32')](_0x1fb47a['model'],_0x1fb47a['query']);_0x3ba866[_0x43bd('0x33')]=_[_0x43bd('0x32')](_0x1fb47a[_0x43bd('0x2e')],qs[_0x43bd('0x34')](_0x5429b3[_0x43bd('0x30')]['fields']));_0x3ba866[_0x43bd('0x33')]=_0x3ba866[_0x43bd('0x33')]['length']?_0x3ba866[_0x43bd('0x33')]:_0x1fb47a[_0x43bd('0x2e')];if(!_0x5429b3['query'][_0x43bd('0x35')](_0x43bd('0x36'))){_0x3ba866['limit']=qs[_0x43bd('0x1e')](_0x5429b3[_0x43bd('0x30')]['limit']);_0x3ba866[_0x43bd('0x1c')]=qs[_0x43bd('0x1c')](_0x5429b3[_0x43bd('0x30')][_0x43bd('0x1c')]);}_0x3ba866[_0x43bd('0x37')]=qs[_0x43bd('0x38')](_0x5429b3[_0x43bd('0x30')][_0x43bd('0x38')]);_0x3ba866[_0x43bd('0x39')]=qs[_0x43bd('0x3a')](_[_0x43bd('0x3b')](_0x5429b3[_0x43bd('0x30')],_0x1fb47a[_0x43bd('0x3a')]),_0x2531eb);if(_0x5429b3['query']['filter']){_0x3ba866['where']=_[_0x43bd('0x3c')](_0x3ba866[_0x43bd('0x39')],{'$or':_['map'](_0x2531eb,function(_0x4bca83){if(_0x4bca83[_0x43bd('0x3d')]!==_0x43bd('0x3e')){var _0x217da3={};_0x217da3[_0x4bca83['name']]={'$like':'%'+_0x5429b3['query']['filter']+'%'};return _0x217da3;}})});}_0x3ba866=_[_0x43bd('0x3c')]({},_0x3ba866,_0x5429b3[_0x43bd('0x3f')]);var _0x44f3e1={'where':_0x3ba866[_0x43bd('0x39')]};return db['VtigerField'][_0x43bd('0x1f')](_0x44f3e1)[_0x43bd('0x26')](function(_0x352871){_0x1cc07f['count']=_0x352871;if(_0x5429b3['query'][_0x43bd('0x40')]){_0x3ba866[_0x43bd('0x41')]=[{'all':!![]}];}return db[_0x43bd('0x2b')][_0x43bd('0x42')](_0x3ba866);})['then'](function(_0x51a496){_0x1cc07f[_0x43bd('0x43')]=_0x51a496;return _0x1cc07f;})['then'](respondWithFilteredResult(_0x1c7347,_0x3ba866))[_0x43bd('0x44')](handleError(_0x1c7347,null));};exports[_0x43bd('0x45')]=function(_0x26f369,_0x5ae46f){var _0x32ada9={'raw':!![],'where':{'id':_0x26f369[_0x43bd('0x46')]['id']}},_0x466483={};_0x466483['model']=_['keys'](db[_0x43bd('0x2b')][_0x43bd('0x47')]);_0x466483[_0x43bd('0x30')]=_[_0x43bd('0x31')](_0x26f369['query']);_0x466483[_0x43bd('0x3a')]=_[_0x43bd('0x32')](_0x466483[_0x43bd('0x2e')],_0x466483[_0x43bd('0x30')]);_0x32ada9[_0x43bd('0x33')]=_[_0x43bd('0x32')](_0x466483['model'],qs[_0x43bd('0x34')](_0x26f369[_0x43bd('0x30')]['fields']));_0x32ada9[_0x43bd('0x33')]=_0x32ada9[_0x43bd('0x33')][_0x43bd('0x48')]?_0x32ada9[_0x43bd('0x33')]:_0x466483['model'];if(_0x26f369[_0x43bd('0x30')]['includeAll']){_0x32ada9['include']=[{'all':!![]}];}_0x32ada9=_[_0x43bd('0x3c')]({},_0x32ada9,_0x26f369[_0x43bd('0x3f')]);return db[_0x43bd('0x2b')][_0x43bd('0x49')](_0x32ada9)['then'](handleEntityNotFound(_0x5ae46f,null))[_0x43bd('0x26')](respondWithResult(_0x5ae46f,null))['catch'](handleError(_0x5ae46f,null));};exports[_0x43bd('0x4a')]=function(_0x1d32d0,_0x48e04f){return db['VtigerField'][_0x43bd('0x4a')](_0x1d32d0[_0x43bd('0x4b')],{})[_0x43bd('0x26')](respondWithResult(_0x48e04f,0xc9))['catch'](handleError(_0x48e04f,null));};exports[_0x43bd('0x25')]=function(_0x13f289,_0x109d98){if(_0x13f289['body']['id']){delete _0x13f289[_0x43bd('0x4b')]['id'];}return db[_0x43bd('0x2b')]['find']({'where':{'id':_0x13f289[_0x43bd('0x46')]['id']}})[_0x43bd('0x26')](handleEntityNotFound(_0x109d98,null))[_0x43bd('0x26')](saveUpdates(_0x13f289[_0x43bd('0x4b')],null))[_0x43bd('0x26')](respondWithResult(_0x109d98,null))[_0x43bd('0x44')](handleError(_0x109d98,null));};exports['destroy']=function(_0x3cf1ec,_0x484058){return db[_0x43bd('0x2b')][_0x43bd('0x49')]({'where':{'id':_0x3cf1ec[_0x43bd('0x46')]['id']}})['then'](handleEntityNotFound(_0x484058,null))[_0x43bd('0x26')](removeEntity(_0x484058,null))[_0x43bd('0x44')](handleError(_0x484058,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index b13a75c..e386dc2 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 _0x1d22=['vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intVtigerField.attributes','VtigerField','int_vtiger_fields'];(function(_0x414188,_0x3c81bd){var _0x209084=function(_0x49d6d0){while(--_0x49d6d0){_0x414188['push'](_0x414188['shift']());}};_0x209084(++_0x3c81bd);}(_0x1d22,0x6c));var _0x21d2=function(_0x315cb1,_0xa84f84){_0x315cb1=_0x315cb1-0x0;var _0xac454d=_0x1d22[_0x315cb1];return _0xac454d;};'use strict';var _=require(_0x21d2('0x0'));var util=require(_0x21d2('0x1'));var logger=require(_0x21d2('0x2'))(_0x21d2('0x3'));var moment=require(_0x21d2('0x4'));var BPromise=require(_0x21d2('0x5'));var rp=require(_0x21d2('0x6'));var fs=require('fs');var path=require(_0x21d2('0x7'));var rimraf=require(_0x21d2('0x8'));var config=require('../../config/environment');var attributes=require(_0x21d2('0x9'));module['exports']=function(_0x4d3742,_0x41a2e3){return _0x4d3742['define'](_0x21d2('0xa'),attributes,{'tableName':_0x21d2('0xb'),'paranoid':![],'indexes':[{'name':_0x21d2('0xc'),'fields':[_0x21d2('0xd'),_0x21d2('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x489d=['rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x24373f,_0x5304e2){var _0x4456ca=function(_0x42aadf){while(--_0x42aadf){_0x24373f['push'](_0x24373f['shift']());}};_0x4456ca(++_0x5304e2);}(_0x489d,0xd9));var _0xd489=function(_0x25c128,_0x39ca54){_0x25c128=_0x25c128-0x0;var _0x23ce84=_0x489d[_0x25c128];return _0x23ce84;};'use strict';var _=require(_0xd489('0x0'));var util=require(_0xd489('0x1'));var logger=require(_0xd489('0x2'))(_0xd489('0x3'));var moment=require(_0xd489('0x4'));var BPromise=require(_0xd489('0x5'));var rp=require(_0xd489('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd489('0x7'));var config=require(_0xd489('0x8'));var attributes=require(_0xd489('0x9'));module[_0xd489('0xa')]=function(_0x5013aa,_0x5b87d1){return _0x5013aa[_0xd489('0xb')](_0xd489('0xc'),attributes,{'tableName':_0xd489('0xd'),'paranoid':![],'indexes':[{'name':_0xd489('0xe'),'fields':[_0xd489('0xf'),'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 5eb538e..774bd1b 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 _0x7d1a=['error','code','message','VtigerField,\x20%s,\x20%s','result','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x420f2a,_0x2cc58d){var _0x28f802=function(_0x3329cc){while(--_0x3329cc){_0x420f2a['push'](_0x420f2a['shift']());}};_0x28f802(++_0x2cc58d);}(_0x7d1a,0xae));var _0xa7d1=function(_0x4a5a0e,_0x3c7fd2){_0x4a5a0e=_0x4a5a0e-0x0;var _0x62cc5c=_0x7d1a[_0x4a5a0e];return _0x62cc5c;};'use strict';var _=require(_0xa7d1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa7d1('0x1'));var rs=require(_0xa7d1('0x2'));var fs=require('fs');var Redis=require(_0xa7d1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xa7d1('0x4'));var logger=require(_0xa7d1('0x5'))(_0xa7d1('0x6'));var config=require(_0xa7d1('0x7'));var jayson=require(_0xa7d1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3f8f71,_0x38c23d,_0xe62247){return new BPromise(function(_0x56d4a3,_0x381ec0){return client['request'](_0x3f8f71,_0xe62247)[_0xa7d1('0x9')](function(_0x4fcc46){logger[_0xa7d1('0xa')]('VtigerField,\x20%s,\x20%s',_0x38c23d,_0xa7d1('0xb'));logger[_0xa7d1('0xc')](_0xa7d1('0xd'),_0x38c23d,'request\x20sent',JSON[_0xa7d1('0xe')](_0x4fcc46));if(_0x4fcc46[_0xa7d1('0xf')]){if(_0x4fcc46[_0xa7d1('0xf')][_0xa7d1('0x10')]===0x1f4){logger[_0xa7d1('0xf')]('VtigerField,\x20%s,\x20%s',_0x38c23d,_0x4fcc46[_0xa7d1('0xf')]['message']);return _0x381ec0(_0x4fcc46[_0xa7d1('0xf')][_0xa7d1('0x11')]);}logger[_0xa7d1('0xf')](_0xa7d1('0x12'),_0x38c23d,_0x4fcc46[_0xa7d1('0xf')]['message']);return _0x56d4a3(_0x4fcc46[_0xa7d1('0xf')][_0xa7d1('0x11')]);}else{logger[_0xa7d1('0xa')](_0xa7d1('0x12'),_0x38c23d,_0xa7d1('0xb'));_0x56d4a3(_0x4fcc46[_0xa7d1('0x13')][_0xa7d1('0x11')]);}})[_0xa7d1('0x14')](function(_0x130c95){logger[_0xa7d1('0xf')](_0xa7d1('0x12'),_0x38c23d,_0x130c95);_0x381ec0(_0x130c95);});});} \ No newline at end of file +var _0xa13a=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x5997f4,_0x482272){var _0xa47e6a=function(_0x451754){while(--_0x451754){_0x5997f4['push'](_0x5997f4['shift']());}};_0xa47e6a(++_0x482272);}(_0xa13a,0x80));var _0xaa13=function(_0xb99082,_0x456e10){_0xb99082=_0xb99082-0x0;var _0xe7ac28=_0xa13a[_0xb99082];return _0xe7ac28;};'use strict';var _=require(_0xaa13('0x0'));var util=require(_0xaa13('0x1'));var moment=require(_0xaa13('0x2'));var BPromise=require(_0xaa13('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaa13('0x4'));var db=require(_0xaa13('0x5'))['db'];var utils=require(_0xaa13('0x6'));var logger=require('../../config/logger')(_0xaa13('0x7'));var config=require('../../config/environment');var jayson=require(_0xaa13('0x8'));var client=jayson[_0xaa13('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x294983,_0x5cd30c,_0x23c673){return new BPromise(function(_0x3d0b9f,_0x5f148e){return client['request'](_0x294983,_0x23c673)[_0xaa13('0xa')](function(_0x29a1a9){logger[_0xaa13('0xb')](_0xaa13('0xc'),_0x5cd30c,_0xaa13('0xd'));logger[_0xaa13('0xe')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x5cd30c,_0xaa13('0xd'),JSON[_0xaa13('0xf')](_0x29a1a9));if(_0x29a1a9[_0xaa13('0x10')]){if(_0x29a1a9['error'][_0xaa13('0x11')]===0x1f4){logger[_0xaa13('0x10')](_0xaa13('0xc'),_0x5cd30c,_0x29a1a9[_0xaa13('0x10')][_0xaa13('0x12')]);return _0x5f148e(_0x29a1a9[_0xaa13('0x10')]['message']);}logger[_0xaa13('0x10')]('VtigerField,\x20%s,\x20%s',_0x5cd30c,_0x29a1a9['error']['message']);return _0x3d0b9f(_0x29a1a9[_0xaa13('0x10')][_0xaa13('0x12')]);}else{logger['info'](_0xaa13('0xc'),_0x5cd30c,_0xaa13('0xd'));_0x3d0b9f(_0x29a1a9[_0xaa13('0x13')][_0xaa13('0x12')]);}})[_0xaa13('0x14')](function(_0x4209da){logger[_0xaa13('0x10')](_0xaa13('0xc'),_0x5cd30c,_0x4209da);_0x5f148e(_0x4209da);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 5447e84..99ba015 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 _0xe685=['/:id/fields','getFields','addConfiguration','put','update','/:id','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe685,0x1ed));var _0x5e68=function(_0x136b97,_0x1eb433){_0x136b97=_0x136b97-0x0;var _0x261a19=_0xe685[_0x136b97];return _0x261a19;};'use strict';var multer=require('multer');var util=require(_0x5e68('0x0'));var path=require(_0x5e68('0x1'));var timeout=require('connect-timeout');var express=require(_0x5e68('0x2'));var router=express[_0x5e68('0x3')]();var fs_extra=require(_0x5e68('0x4'));var auth=require(_0x5e68('0x5'));var interaction=require(_0x5e68('0x6'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router[_0x5e68('0x7')]('/',auth[_0x5e68('0x8')](),controller[_0x5e68('0x9')]);router[_0x5e68('0x7')]('/:id',auth[_0x5e68('0x8')](),controller[_0x5e68('0xa')]);router[_0x5e68('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x5e68('0x7')](_0x5e68('0xb'),auth[_0x5e68('0x8')](),controller[_0x5e68('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x5e68('0x8')](),controller[_0x5e68('0xd')]);router[_0x5e68('0xe')]('/:id',auth[_0x5e68('0x8')](),controller[_0x5e68('0xf')]);router['delete'](_0x5e68('0x10'),auth['isAuthenticated'](),controller[_0x5e68('0x11')]);module['exports']=router; \ No newline at end of file +var _0x503b=['create','/:id/configurations','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','post'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x503b,0xdf));var _0xb503=function(_0x3f8ee7,_0x26a47f){_0x3f8ee7=_0x3f8ee7-0x0;var _0x254ff2=_0x503b[_0x3f8ee7];return _0x254ff2;};'use strict';var multer=require(_0xb503('0x0'));var util=require(_0xb503('0x1'));var path=require(_0xb503('0x2'));var timeout=require(_0xb503('0x3'));var express=require(_0xb503('0x4'));var router=express[_0xb503('0x5')]();var fs_extra=require(_0xb503('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb503('0x7'));var config=require(_0xb503('0x8'));var controller=require(_0xb503('0x9'));router[_0xb503('0xa')]('/',auth[_0xb503('0xb')](),controller[_0xb503('0xc')]);router[_0xb503('0xa')](_0xb503('0xd'),auth[_0xb503('0xb')](),controller[_0xb503('0xe')]);router[_0xb503('0xa')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xb503('0xf')]);router[_0xb503('0xa')]('/:id/fields',auth[_0xb503('0xb')](),controller['getFields']);router[_0xb503('0x10')]('/',auth['isAuthenticated'](),controller[_0xb503('0x11')]);router['post'](_0xb503('0x12'),auth[_0xb503('0xb')](),controller['addConfiguration']);router[_0xb503('0x13')](_0xb503('0xd'),auth['isAuthenticated'](),controller[_0xb503('0x14')]);router[_0xb503('0x15')](_0xb503('0xd'),auth[_0xb503('0xb')](),controller[_0xb503('0x16')]);module[_0xb503('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 4b844f0..32fca02 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 _0x3e24=['exports','STRING','remoteUri','ENUM','password','token','newTab','integrationTab','sequelize'];(function(_0x42623f,_0x35ba47){var _0x1a7f0e=function(_0x26ee37){while(--_0x26ee37){_0x42623f['push'](_0x42623f['shift']());}};_0x1a7f0e(++_0x35ba47);}(_0x3e24,0x167));var _0x43e2=function(_0x2d7842,_0x5e1932){_0x2d7842=_0x2d7842-0x0;var _0x35485d=_0x3e24[_0x2d7842];return _0x35485d;};'use strict';var Sequelize=require(_0x43e2('0x0'));module[_0x43e2('0x1')]={'name':{'type':Sequelize[_0x43e2('0x2')]},'description':{'type':Sequelize[_0x43e2('0x2')]},'username':{'type':Sequelize[_0x43e2('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x43e2('0x2')]},'token':{'type':Sequelize[_0x43e2('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x43e2('0x3')},'authType':{'type':Sequelize[_0x43e2('0x4')](_0x43e2('0x5'),_0x43e2('0x6')),'defaultValue':_0x43e2('0x5')},'serverUrl':{'type':Sequelize[_0x43e2('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x43e2('0x4')]('integrationTab',_0x43e2('0x7')),'defaultValue':_0x43e2('0x8')}}; \ No newline at end of file +var _0x8458=['username','remoteUri','ENUM','password','token','integrationTab','newTab','sequelize','STRING'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x8458,0x1a5));var _0x8845=function(_0x57aa83,_0x5cce9e){_0x57aa83=_0x57aa83-0x0;var _0x533428=_0x8458[_0x57aa83];return _0x533428;};'use strict';var Sequelize=require(_0x8845('0x0'));module['exports']={'name':{'type':Sequelize[_0x8845('0x1')]},'description':{'type':Sequelize[_0x8845('0x1')]},'username':{'type':Sequelize[_0x8845('0x1')],'unique':_0x8845('0x2')},'password':{'type':Sequelize[_0x8845('0x1')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8845('0x1')],'unique':_0x8845('0x3')},'authType':{'type':Sequelize[_0x8845('0x4')](_0x8845('0x5'),_0x8845('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x8845('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8845('0x7'),_0x8845('0x8')),'defaultValue':_0x8845('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 3f7dc78..ed67146 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 _0x63a5=['username','password','token','remoteUri','substring','lastIndexOf','GET','%s/%s','ticket_fields','authType','headers','format','toString','base64','Basic\x20%s','%s/token:%s','Sequelize','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','ZendeskAccount','count','includeAll','rows','params','length','include','find','catch','create','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ZendeskField','getFields'];(function(_0x5c3f8b,_0x59587a){var _0x2dbdd0=function(_0x26d0a9){while(--_0x26d0a9){_0x5c3f8b['push'](_0x5c3f8b['shift']());}};_0x2dbdd0(++_0x59587a);}(_0x63a5,0x18e));var _0x563a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x63a5[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0x563a('0x0'));var rimraf=require(_0x563a('0x1'));var zipdir=require(_0x563a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x563a('0x3'));var moment=require('moment');var BPromise=require(_0x563a('0x4'));var Mustache=require(_0x563a('0x5'));var util=require(_0x563a('0x6'));var path=require(_0x563a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x563a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x563a('0x9'));var squel=require(_0x563a('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x563a('0xb'));var toCsv=require(_0x563a('0xc'));var querystring=require(_0x563a('0xd'));var Papa=require(_0x563a('0xe'));var Redis=require(_0x563a('0xf'));var authService=require(_0x563a('0x10'));var qs=require(_0x563a('0x11'));var as=require(_0x563a('0x12'));var hardwareService=require(_0x563a('0x13'));var logger=require(_0x563a('0x14'))(_0x563a('0x15'));var utils=require(_0x563a('0x16'));var config=require(_0x563a('0x17'));var licenseUtil=require(_0x563a('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x563a('0x19'));function respondWithStatusCode(_0x214f42,_0x10de2e){_0x10de2e=_0x10de2e||0xcc;return function(_0x27034c){if(_0x27034c){return _0x214f42[_0x563a('0x1a')](_0x10de2e);}return _0x214f42[_0x563a('0x1b')](_0x10de2e)['end']();};}function respondWithResult(_0x2cf052,_0x3045ac){_0x3045ac=_0x3045ac||0xc8;return function(_0x8c3727){if(_0x8c3727){return _0x2cf052[_0x563a('0x1b')](_0x3045ac)['json'](_0x8c3727);}};}function respondWithFilteredResult(_0x504cb7,_0x414535){return function(_0x2ad667){if(_0x2ad667){var _0x5b291f=typeof _0x414535[_0x563a('0x1c')]===_0x563a('0x1d')&&typeof _0x414535[_0x563a('0x1e')]===_0x563a('0x1d');var _0x4f947d=_0x2ad667['count'];var _0xe3d2bd=_0x5b291f?0x0:_0x414535[_0x563a('0x1c')];var _0x54a3b4=_0x5b291f?_0x2ad667['count']:_0x414535['offset']+_0x414535['limit'];var _0x4c15c1;if(_0x54a3b4>=_0x4f947d){_0x54a3b4=_0x4f947d;_0x4c15c1=0xc8;}else{_0x4c15c1=0xce;}_0x504cb7[_0x563a('0x1b')](_0x4c15c1);return _0x504cb7[_0x563a('0x1f')](_0x563a('0x20'),_0xe3d2bd+'-'+_0x54a3b4+'/'+_0x4f947d)[_0x563a('0x21')](_0x2ad667);}return null;};}function patchUpdates(_0x562fce){return function(_0x4e3b67){try{jsonpatch[_0x563a('0x22')](_0x4e3b67,_0x562fce,!![]);}catch(_0x9f8b29){return BPromise[_0x563a('0x23')](_0x9f8b29);}return _0x4e3b67[_0x563a('0x24')]();};}function saveUpdates(_0x1bf502,_0x2dc7e2){return function(_0x44b460){if(_0x44b460){return _0x44b460[_0x563a('0x25')](_0x1bf502)['then'](function(_0xd59ba8){return _0xd59ba8;});}return null;};}function removeEntity(_0x5422f6,_0x44e2c1){return function(_0xd3e0ae){if(_0xd3e0ae){return _0xd3e0ae[_0x563a('0x26')]()[_0x563a('0x27')](function(){_0x5422f6[_0x563a('0x1b')](0xcc)[_0x563a('0x28')]();});}};}function handleEntityNotFound(_0x3642b3,_0x173990){return function(_0x4de4c3){if(!_0x4de4c3){_0x3642b3[_0x563a('0x1a')](0x194);}return _0x4de4c3;};}function handleError(_0x2b688e,_0x2311f2){_0x2311f2=_0x2311f2||0x1f4;return function(_0x3d79ac){logger[_0x563a('0x29')](_0x3d79ac[_0x563a('0x2a')]);if(_0x3d79ac[_0x563a('0x2b')]){delete _0x3d79ac[_0x563a('0x2b')];}_0x2b688e[_0x563a('0x1b')](_0x2311f2)[_0x563a('0x2c')](_0x3d79ac);};}exports[_0x563a('0x2d')]=function(_0x24d1a8,_0x1bdfb0){var _0x7696c2={},_0x579cb5={},_0x43379c={'count':0x0,'rows':[]};var _0x3c16d0=_[_0x563a('0x2e')](db['ZendeskAccount'][_0x563a('0x2f')],function(_0x2e5c4b){return{'name':_0x2e5c4b[_0x563a('0x30')],'type':_0x2e5c4b[_0x563a('0x31')][_0x563a('0x32')]};});_0x579cb5[_0x563a('0x33')]=_[_0x563a('0x2e')](_0x3c16d0,'name');_0x579cb5[_0x563a('0x34')]=_[_0x563a('0x35')](_0x24d1a8[_0x563a('0x34')]);_0x579cb5[_0x563a('0x36')]=_[_0x563a('0x37')](_0x579cb5['model'],_0x579cb5['query']);_0x7696c2['attributes']=_['intersection'](_0x579cb5[_0x563a('0x33')],qs[_0x563a('0x38')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x38')]));_0x7696c2[_0x563a('0x39')]=_0x7696c2[_0x563a('0x39')]['length']?_0x7696c2['attributes']:_0x579cb5[_0x563a('0x33')];if(!_0x24d1a8[_0x563a('0x34')][_0x563a('0x3a')](_0x563a('0x3b'))){_0x7696c2[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x1e')]);_0x7696c2[_0x563a('0x1c')]=qs[_0x563a('0x1c')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x1c')]);}_0x7696c2[_0x563a('0x3c')]=qs[_0x563a('0x3d')](_0x24d1a8[_0x563a('0x34')][_0x563a('0x3d')]);_0x7696c2['where']=qs[_0x563a('0x36')](_[_0x563a('0x3e')](_0x24d1a8[_0x563a('0x34')],_0x579cb5['filters']),_0x3c16d0);if(_0x24d1a8[_0x563a('0x34')]['filter']){_0x7696c2[_0x563a('0x3f')]=_[_0x563a('0x40')](_0x7696c2['where'],{'$or':_['map'](_0x3c16d0,function(_0x1b48f1){if(_0x1b48f1['type']!==_0x563a('0x41')){var _0x92bd6={};_0x92bd6[_0x1b48f1[_0x563a('0x2b')]]={'$like':'%'+_0x24d1a8[_0x563a('0x34')]['filter']+'%'};return _0x92bd6;}})});}_0x7696c2=_['merge']({},_0x7696c2,_0x24d1a8[_0x563a('0x42')]);var _0x598ee3={'where':_0x7696c2[_0x563a('0x3f')]};return db[_0x563a('0x43')][_0x563a('0x44')](_0x598ee3)[_0x563a('0x27')](function(_0x3a2eb0){_0x43379c[_0x563a('0x44')]=_0x3a2eb0;if(_0x24d1a8[_0x563a('0x34')][_0x563a('0x45')]){_0x7696c2['include']=[{'all':!![]}];}return db[_0x563a('0x43')]['findAll'](_0x7696c2);})[_0x563a('0x27')](function(_0x3de697){_0x43379c[_0x563a('0x46')]=_0x3de697;return _0x43379c;})[_0x563a('0x27')](respondWithFilteredResult(_0x1bdfb0,_0x7696c2))['catch'](handleError(_0x1bdfb0,null));};exports['show']=function(_0x54ac1e,_0x2221d4){var _0x1255da={'raw':![],'where':{'id':_0x54ac1e[_0x563a('0x47')]['id']}},_0x19b18f={};_0x19b18f[_0x563a('0x33')]=_[_0x563a('0x35')](db[_0x563a('0x43')][_0x563a('0x2f')]);_0x19b18f[_0x563a('0x34')]=_[_0x563a('0x35')](_0x54ac1e[_0x563a('0x34')]);_0x19b18f[_0x563a('0x36')]=_[_0x563a('0x37')](_0x19b18f[_0x563a('0x33')],_0x19b18f[_0x563a('0x34')]);_0x1255da[_0x563a('0x39')]=_[_0x563a('0x37')](_0x19b18f[_0x563a('0x33')],qs[_0x563a('0x38')](_0x54ac1e['query']['fields']));_0x1255da[_0x563a('0x39')]=_0x1255da[_0x563a('0x39')][_0x563a('0x48')]?_0x1255da[_0x563a('0x39')]:_0x19b18f[_0x563a('0x33')];if(_0x54ac1e[_0x563a('0x34')][_0x563a('0x45')]){_0x1255da[_0x563a('0x49')]=[{'all':!![]}];}_0x1255da=_['merge']({},_0x1255da,_0x54ac1e['options']);return db[_0x563a('0x43')][_0x563a('0x4a')](_0x1255da)[_0x563a('0x27')](handleEntityNotFound(_0x2221d4,null))[_0x563a('0x27')](respondWithResult(_0x2221d4,null))[_0x563a('0x4b')](handleError(_0x2221d4,null));};exports[_0x563a('0x4c')]=function(_0x2689b5,_0x276642){return db['ZendeskAccount'][_0x563a('0x4c')](_0x2689b5[_0x563a('0x4d')],{})['then'](respondWithResult(_0x276642,0xc9))[_0x563a('0x4b')](handleError(_0x276642,null));};exports['update']=function(_0x3ea787,_0xab7b16){if(_0x3ea787[_0x563a('0x4d')]['id']){delete _0x3ea787['body']['id'];}return db[_0x563a('0x43')][_0x563a('0x4a')]({'where':{'id':_0x3ea787[_0x563a('0x47')]['id']}})[_0x563a('0x27')](handleEntityNotFound(_0xab7b16,null))[_0x563a('0x27')](saveUpdates(_0x3ea787[_0x563a('0x4d')],null))[_0x563a('0x27')](respondWithResult(_0xab7b16,null))[_0x563a('0x4b')](handleError(_0xab7b16,null));};exports[_0x563a('0x26')]=function(_0x2008d4,_0x3c98d5){return db[_0x563a('0x43')][_0x563a('0x4a')]({'where':{'id':_0x2008d4['params']['id']}})['then'](handleEntityNotFound(_0x3c98d5,null))[_0x563a('0x27')](removeEntity(_0x3c98d5,null))[_0x563a('0x4b')](handleError(_0x3c98d5,null));};exports[_0x563a('0x4e')]=function(_0x4a807f,_0x5ae08f,_0x13530f){var _0x1fc4d2={};var _0x50ebde={};var _0x4b6ba9;var _0x51e142;return db[_0x563a('0x43')][_0x563a('0x4f')]({'where':{'id':_0x4a807f[_0x563a('0x47')]['id']}})[_0x563a('0x27')](handleEntityNotFound(_0x5ae08f,null))[_0x563a('0x27')](function(_0x2805eb){if(_0x2805eb){_0x4b6ba9=_0x2805eb;_0x50ebde['model']=_['keys'](db[_0x563a('0x50')]['rawAttributes']);_0x50ebde[_0x563a('0x34')]=_[_0x563a('0x35')](_0x4a807f[_0x563a('0x34')]);_0x50ebde[_0x563a('0x36')]=_[_0x563a('0x37')](_0x50ebde[_0x563a('0x33')],_0x50ebde[_0x563a('0x34')]);_0x1fc4d2['attributes']=_[_0x563a('0x37')](_0x50ebde[_0x563a('0x33')],qs['fields'](_0x4a807f[_0x563a('0x34')][_0x563a('0x38')]));_0x1fc4d2[_0x563a('0x39')]=_0x1fc4d2[_0x563a('0x39')][_0x563a('0x48')]?_0x1fc4d2[_0x563a('0x39')]:_0x50ebde[_0x563a('0x33')];_0x1fc4d2[_0x563a('0x3c')]=qs[_0x563a('0x3d')](_0x4a807f[_0x563a('0x34')]['sort']);_0x1fc4d2[_0x563a('0x3f')]=qs[_0x563a('0x36')](_['pick'](_0x4a807f['query'],_0x50ebde[_0x563a('0x36')]));if(_0x4a807f[_0x563a('0x34')]['filter']){_0x1fc4d2[_0x563a('0x3f')]=_['merge'](_0x1fc4d2[_0x563a('0x3f')],{'$or':_[_0x563a('0x2e')](_0x1fc4d2[_0x563a('0x39')],function(_0xbe9fff){var _0x7fa423={};_0x7fa423[_0xbe9fff]={'$like':'%'+_0x4a807f['query']['filter']+'%'};return _0x7fa423;})});}_0x1fc4d2=_['merge']({},_0x1fc4d2,_0x4a807f['options']);return _0x4b6ba9[_0x563a('0x4e')](_0x1fc4d2);}})['then'](function(_0x111444){if(_0x111444){_0x51e142=_0x111444['length'];if(!_0x4a807f[_0x563a('0x34')][_0x563a('0x3a')](_0x563a('0x3b'))){_0x1fc4d2[_0x563a('0x1e')]=qs[_0x563a('0x1e')](_0x4a807f['query'][_0x563a('0x1e')]);_0x1fc4d2['offset']=qs['offset'](_0x4a807f[_0x563a('0x34')][_0x563a('0x1c')]);}return _0x4b6ba9[_0x563a('0x4e')](_0x1fc4d2);}})[_0x563a('0x27')](function(_0x1c8ad7){if(_0x1c8ad7){return _0x1c8ad7?{'count':_0x51e142,'rows':_0x1c8ad7}:null;}})['then'](respondWithResult(_0x5ae08f,null))[_0x563a('0x4b')](handleError(_0x5ae08f,null));};exports[_0x563a('0x51')]=function(_0x20bd36,_0x3bbe7c,_0x36d40c){if(_0x20bd36['body']['id']){delete _0x20bd36[_0x563a('0x4d')]['id'];}return db['ZendeskAccount'][_0x563a('0x4f')]({'where':{'id':_0x20bd36[_0x563a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3bbe7c,null))[_0x563a('0x27')](function(_0x30bf2b){if(_0x30bf2b){_0x20bd36[_0x563a('0x4d')][_0x563a('0x52')]=_0x30bf2b['id'];_0x20bd36[_0x563a('0x4d')][_0x563a('0x53')]=integrations[_0x563a('0x54')](_0x20bd36[_0x563a('0x4d')]['channel'],_0x20bd36[_0x563a('0x4d')][_0x563a('0x31')]);_0x20bd36[_0x563a('0x4d')][_0x563a('0x55')]=integrations[_0x563a('0x56')](_0x20bd36[_0x563a('0x4d')][_0x563a('0x57')],_0x20bd36['body'][_0x563a('0x31')]);return db['ZendeskConfiguration']['create'](_0x20bd36['body'],{'include':[{'model':db[_0x563a('0x58')],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0x563a('0x55')}]});}return null;})[_0x563a('0x27')](respondWithResult(_0x3bbe7c,null))[_0x563a('0x4b')](handleError(_0x3bbe7c,null));};exports[_0x563a('0x59')]=function(_0x2e442f,_0x51220c,_0x4814b3){var _0x4c9ad7='';return db[_0x563a('0x43')][_0x563a('0x4f')]({'where':{'id':_0x2e442f[_0x563a('0x47')]['id']},'attributes':['id',_0x563a('0x5a'),_0x563a('0x5b'),_0x563a('0x5c'),'authType',_0x563a('0x5d')]})[_0x563a('0x27')](handleEntityNotFound(_0x51220c,null))['then'](function(_0x1983e5){if(_0x1983e5){_0x4c9ad7=_0x1983e5[_0x563a('0x5d')];var _0x15e9ce=_0x4c9ad7['slice'](-0x1);if(_0x15e9ce==='/'){_0x4c9ad7=_0x4c9ad7[_0x563a('0x5e')](0x0,_0x4c9ad7[_0x563a('0x5f')](_0x15e9ce));}var _0x332428={'method':_0x563a('0x60'),'uri':util['format'](_0x563a('0x61'),_0x4c9ad7,_0x563a('0x62')),'json':!![]};switch(_0x1983e5[_0x563a('0x63')]){case _0x563a('0x5b'):_0x332428[_0x563a('0x64')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x563a('0x65')]('%s:%s',_0x1983e5[_0x563a('0x5a')],_0x1983e5[_0x563a('0x5b')]))[_0x563a('0x66')](_0x563a('0x67')))};break;case _0x563a('0x5c'):_0x332428[_0x563a('0x64')]={'Authorization':util[_0x563a('0x65')](_0x563a('0x68'),new Buffer(util[_0x563a('0x65')](_0x563a('0x69'),_0x1983e5['username'],_0x1983e5[_0x563a('0x5c')]))['toString'](_0x563a('0x67')))};break;default:throw new db[(_0x563a('0x6a'))]['ValidationError'](_0x563a('0x6b'));}return rp(_0x332428);}})['then'](function(_0x41f530){if(_0x41f530){var _0x42c448=['subject',_0x563a('0x6c'),_0x563a('0x6d'),_0x563a('0x6e')];_[_0x563a('0x6f')](_0x41f530['ticket_fields'],function(_0x418646){return _0x42c448[_0x563a('0x70')](_0x418646[_0x563a('0x31')]);});return{'count':_0x41f530[_0x563a('0x62')][_0x563a('0x48')],'rows':_[_0x563a('0x2e')](_0x41f530[_0x563a('0x62')],function(_0x137d52){return{'id':_0x137d52['id'],'name':_0x137d52[_0x563a('0x71')]>0x7?_0x137d52[_0x563a('0x72')]:_0x137d52['type'],'custom':_0x137d52[_0x563a('0x71')]>0x7?!![]:![],'options':_0x137d52[_0x563a('0x73')]?_0x137d52[_0x563a('0x73')]:_0x137d52['custom_field_options']?_0x137d52[_0x563a('0x74')]:[]};})};}})[_0x563a('0x27')](respondWithResult(_0x51220c,null))[_0x563a('0x4b')](function(_0xe27e02){var _0x2cca62=_0x2e442f[_0x563a('0x34')][_0x563a('0x75')]?0x1f4:_0xe27e02[_0x563a('0x76')]||0x1f4;logger[_0x563a('0x29')](_0x563a('0x77'),_0x563a('0x59'),_0x2cca62,JSON[_0x563a('0x78')](_0xe27e02));delete _0xe27e02[_0x563a('0x2b')];if(_0x2cca62===0x191){_0x2cca62=0x190;}_0x51220c['status'](_0x2cca62)[_0x563a('0x2c')](_0x2e442f[_0x563a('0x34')]['test']?{'message':_0x563a('0x79'),'statusCode':_0xe27e02[_0x563a('0x76')]}:_0xe27e02);});}; \ No newline at end of file +var _0x5eb8=['sort','where','filter','merge','type','options','includeAll','findAll','catch','show','params','keys','length','include','find','create','body','update','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','remove','includes','title','position','system_field_options','custom_field_options','send','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','sendStatus','error','stack','name','map','ZendeskAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x53afa6,_0x59e786){var _0x51f86a=function(_0x368385){while(--_0x368385){_0x53afa6['push'](_0x53afa6['shift']());}};_0x51f86a(++_0x59e786);}(_0x5eb8,0xb0));var _0x85eb=function(_0x424357,_0x9ebe3e){_0x424357=_0x424357-0x0;var _0x29c68e=_0x5eb8[_0x424357];return _0x29c68e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85eb('0x0'));var jsonpatch=require(_0x85eb('0x1'));var rp=require(_0x85eb('0x2'));var moment=require(_0x85eb('0x3'));var BPromise=require(_0x85eb('0x4'));var Mustache=require(_0x85eb('0x5'));var util=require(_0x85eb('0x6'));var path=require(_0x85eb('0x7'));var sox=require(_0x85eb('0x8'));var csv=require(_0x85eb('0x9'));var ejs=require(_0x85eb('0xa'));var fs=require('fs');var fs_extra=require(_0x85eb('0xb'));var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0x9'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var authService=require(_0x85eb('0x11'));var qs=require(_0x85eb('0x12'));var as=require(_0x85eb('0x13'));var hardwareService=require(_0x85eb('0x14'));var logger=require(_0x85eb('0x15'))('api');var utils=require(_0x85eb('0x16'));var config=require(_0x85eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85eb('0x18'))['db'];var integrations=require(_0x85eb('0x19'));function respondWithStatusCode(_0x2f42ba,_0x259f72){_0x259f72=_0x259f72||0xcc;return function(_0x4db167){if(_0x4db167){return _0x2f42ba['sendStatus'](_0x259f72);}return _0x2f42ba[_0x85eb('0x1a')](_0x259f72)['end']();};}function respondWithResult(_0x18ca53,_0x23a82a){_0x23a82a=_0x23a82a||0xc8;return function(_0x600a7f){if(_0x600a7f){return _0x18ca53[_0x85eb('0x1a')](_0x23a82a)[_0x85eb('0x1b')](_0x600a7f);}};}function respondWithFilteredResult(_0x49efdf,_0x2e5c0a){return function(_0x59237b){if(_0x59237b){var _0x17140b=typeof _0x2e5c0a[_0x85eb('0x1c')]===_0x85eb('0x1d')&&typeof _0x2e5c0a[_0x85eb('0x1e')]==='undefined';var _0x5c5cbb=_0x59237b['count'];var _0xe198ca=_0x17140b?0x0:_0x2e5c0a[_0x85eb('0x1c')];var _0x10cf2f=_0x17140b?_0x59237b[_0x85eb('0x1f')]:_0x2e5c0a[_0x85eb('0x1c')]+_0x2e5c0a[_0x85eb('0x1e')];var _0x5acd3d;if(_0x10cf2f>=_0x5c5cbb){_0x10cf2f=_0x5c5cbb;_0x5acd3d=0xc8;}else{_0x5acd3d=0xce;}_0x49efdf[_0x85eb('0x1a')](_0x5acd3d);return _0x49efdf[_0x85eb('0x20')](_0x85eb('0x21'),_0xe198ca+'-'+_0x10cf2f+'/'+_0x5c5cbb)['json'](_0x59237b);}return null;};}function patchUpdates(_0x4b4b38){return function(_0x48bd86){try{jsonpatch['apply'](_0x48bd86,_0x4b4b38,!![]);}catch(_0x244667){return BPromise[_0x85eb('0x22')](_0x244667);}return _0x48bd86[_0x85eb('0x23')]();};}function saveUpdates(_0x255ca7,_0x465c74){return function(_0x3fc6da){if(_0x3fc6da){return _0x3fc6da['update'](_0x255ca7)['then'](function(_0x5b48d9){return _0x5b48d9;});}return null;};}function removeEntity(_0x298e84,_0x1426c8){return function(_0x3f7a4d){if(_0x3f7a4d){return _0x3f7a4d[_0x85eb('0x24')]()[_0x85eb('0x25')](function(){_0x298e84[_0x85eb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39d3fe,_0x3453cd){return function(_0x4709ad){if(!_0x4709ad){_0x39d3fe[_0x85eb('0x26')](0x194);}return _0x4709ad;};}function handleError(_0x3e2326,_0x57a03c){_0x57a03c=_0x57a03c||0x1f4;return function(_0x2e5aa3){logger[_0x85eb('0x27')](_0x2e5aa3[_0x85eb('0x28')]);if(_0x2e5aa3[_0x85eb('0x29')]){delete _0x2e5aa3[_0x85eb('0x29')];}_0x3e2326[_0x85eb('0x1a')](_0x57a03c)['send'](_0x2e5aa3);};}exports['index']=function(_0x37515c,_0x585f2a){var _0xa9b14f={},_0x5255eb={},_0x4229e9={'count':0x0,'rows':[]};var _0x3570f7=_[_0x85eb('0x2a')](db[_0x85eb('0x2b')][_0x85eb('0x2c')],function(_0xf4ac13){return{'name':_0xf4ac13[_0x85eb('0x2d')],'type':_0xf4ac13['type'][_0x85eb('0x2e')]};});_0x5255eb[_0x85eb('0x2f')]=_['map'](_0x3570f7,_0x85eb('0x29'));_0x5255eb['query']=_['keys'](_0x37515c[_0x85eb('0x30')]);_0x5255eb[_0x85eb('0x31')]=_[_0x85eb('0x32')](_0x5255eb[_0x85eb('0x2f')],_0x5255eb[_0x85eb('0x30')]);_0xa9b14f[_0x85eb('0x33')]=_[_0x85eb('0x32')](_0x5255eb[_0x85eb('0x2f')],qs[_0x85eb('0x34')](_0x37515c[_0x85eb('0x30')]['fields']));_0xa9b14f[_0x85eb('0x33')]=_0xa9b14f[_0x85eb('0x33')]['length']?_0xa9b14f['attributes']:_0x5255eb[_0x85eb('0x2f')];if(!_0x37515c[_0x85eb('0x30')][_0x85eb('0x35')](_0x85eb('0x36'))){_0xa9b14f[_0x85eb('0x1e')]=qs[_0x85eb('0x1e')](_0x37515c[_0x85eb('0x30')][_0x85eb('0x1e')]);_0xa9b14f[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x37515c[_0x85eb('0x30')][_0x85eb('0x1c')]);}_0xa9b14f[_0x85eb('0x37')]=qs[_0x85eb('0x38')](_0x37515c['query'][_0x85eb('0x38')]);_0xa9b14f[_0x85eb('0x39')]=qs['filters'](_['pick'](_0x37515c[_0x85eb('0x30')],_0x5255eb[_0x85eb('0x31')]),_0x3570f7);if(_0x37515c['query'][_0x85eb('0x3a')]){_0xa9b14f['where']=_[_0x85eb('0x3b')](_0xa9b14f['where'],{'$or':_[_0x85eb('0x2a')](_0x3570f7,function(_0x5ce7e4){if(_0x5ce7e4[_0x85eb('0x3c')]!=='VIRTUAL'){var _0x38ab0f={};_0x38ab0f[_0x5ce7e4[_0x85eb('0x29')]]={'$like':'%'+_0x37515c['query'][_0x85eb('0x3a')]+'%'};return _0x38ab0f;}})});}_0xa9b14f=_['merge']({},_0xa9b14f,_0x37515c[_0x85eb('0x3d')]);var _0x331260={'where':_0xa9b14f['where']};return db[_0x85eb('0x2b')]['count'](_0x331260)['then'](function(_0x1b8a71){_0x4229e9['count']=_0x1b8a71;if(_0x37515c[_0x85eb('0x30')][_0x85eb('0x3e')]){_0xa9b14f['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x85eb('0x3f')](_0xa9b14f);})[_0x85eb('0x25')](function(_0x48160e){_0x4229e9['rows']=_0x48160e;return _0x4229e9;})[_0x85eb('0x25')](respondWithFilteredResult(_0x585f2a,_0xa9b14f))[_0x85eb('0x40')](handleError(_0x585f2a,null));};exports[_0x85eb('0x41')]=function(_0x202681,_0x3be961){var _0x5b7411={'raw':![],'where':{'id':_0x202681[_0x85eb('0x42')]['id']}},_0x5ccf8a={};_0x5ccf8a[_0x85eb('0x2f')]=_[_0x85eb('0x43')](db[_0x85eb('0x2b')][_0x85eb('0x2c')]);_0x5ccf8a[_0x85eb('0x30')]=_[_0x85eb('0x43')](_0x202681[_0x85eb('0x30')]);_0x5ccf8a['filters']=_[_0x85eb('0x32')](_0x5ccf8a[_0x85eb('0x2f')],_0x5ccf8a['query']);_0x5b7411[_0x85eb('0x33')]=_[_0x85eb('0x32')](_0x5ccf8a[_0x85eb('0x2f')],qs[_0x85eb('0x34')](_0x202681[_0x85eb('0x30')][_0x85eb('0x34')]));_0x5b7411['attributes']=_0x5b7411[_0x85eb('0x33')][_0x85eb('0x44')]?_0x5b7411[_0x85eb('0x33')]:_0x5ccf8a[_0x85eb('0x2f')];if(_0x202681[_0x85eb('0x30')][_0x85eb('0x3e')]){_0x5b7411[_0x85eb('0x45')]=[{'all':!![]}];}_0x5b7411=_[_0x85eb('0x3b')]({},_0x5b7411,_0x202681['options']);return db[_0x85eb('0x2b')][_0x85eb('0x46')](_0x5b7411)[_0x85eb('0x25')](handleEntityNotFound(_0x3be961,null))[_0x85eb('0x25')](respondWithResult(_0x3be961,null))[_0x85eb('0x40')](handleError(_0x3be961,null));};exports[_0x85eb('0x47')]=function(_0x3c387a,_0x77fdc4){return db[_0x85eb('0x2b')][_0x85eb('0x47')](_0x3c387a[_0x85eb('0x48')],{})[_0x85eb('0x25')](respondWithResult(_0x77fdc4,0xc9))['catch'](handleError(_0x77fdc4,null));};exports[_0x85eb('0x49')]=function(_0x2c951b,_0x22d9d6){if(_0x2c951b['body']['id']){delete _0x2c951b[_0x85eb('0x48')]['id'];}return db[_0x85eb('0x2b')][_0x85eb('0x46')]({'where':{'id':_0x2c951b[_0x85eb('0x42')]['id']}})[_0x85eb('0x25')](handleEntityNotFound(_0x22d9d6,null))['then'](saveUpdates(_0x2c951b[_0x85eb('0x48')],null))[_0x85eb('0x25')](respondWithResult(_0x22d9d6,null))[_0x85eb('0x40')](handleError(_0x22d9d6,null));};exports['destroy']=function(_0xc5cb43,_0x4550fd){return db[_0x85eb('0x2b')]['find']({'where':{'id':_0xc5cb43['params']['id']}})[_0x85eb('0x25')](handleEntityNotFound(_0x4550fd,null))['then'](removeEntity(_0x4550fd,null))['catch'](handleError(_0x4550fd,null));};exports[_0x85eb('0x4a')]=function(_0x593723,_0x39316d,_0xfb0ac){var _0x4e3d96={};var _0x4abe5e={};var _0x27ce2a;var _0x249511;return db[_0x85eb('0x2b')][_0x85eb('0x4b')]({'where':{'id':_0x593723[_0x85eb('0x42')]['id']}})['then'](handleEntityNotFound(_0x39316d,null))[_0x85eb('0x25')](function(_0x30062e){if(_0x30062e){_0x27ce2a=_0x30062e;_0x4abe5e[_0x85eb('0x2f')]=_[_0x85eb('0x43')](db[_0x85eb('0x4c')]['rawAttributes']);_0x4abe5e[_0x85eb('0x30')]=_['keys'](_0x593723[_0x85eb('0x30')]);_0x4abe5e[_0x85eb('0x31')]=_['intersection'](_0x4abe5e[_0x85eb('0x2f')],_0x4abe5e[_0x85eb('0x30')]);_0x4e3d96[_0x85eb('0x33')]=_[_0x85eb('0x32')](_0x4abe5e[_0x85eb('0x2f')],qs[_0x85eb('0x34')](_0x593723['query'][_0x85eb('0x34')]));_0x4e3d96['attributes']=_0x4e3d96[_0x85eb('0x33')][_0x85eb('0x44')]?_0x4e3d96['attributes']:_0x4abe5e[_0x85eb('0x2f')];_0x4e3d96[_0x85eb('0x37')]=qs['sort'](_0x593723[_0x85eb('0x30')]['sort']);_0x4e3d96[_0x85eb('0x39')]=qs[_0x85eb('0x31')](_[_0x85eb('0x4d')](_0x593723[_0x85eb('0x30')],_0x4abe5e[_0x85eb('0x31')]));if(_0x593723[_0x85eb('0x30')]['filter']){_0x4e3d96[_0x85eb('0x39')]=_[_0x85eb('0x3b')](_0x4e3d96[_0x85eb('0x39')],{'$or':_[_0x85eb('0x2a')](_0x4e3d96[_0x85eb('0x33')],function(_0x1529dd){var _0x2024df={};_0x2024df[_0x1529dd]={'$like':'%'+_0x593723[_0x85eb('0x30')][_0x85eb('0x3a')]+'%'};return _0x2024df;})});}_0x4e3d96=_[_0x85eb('0x3b')]({},_0x4e3d96,_0x593723[_0x85eb('0x3d')]);return _0x27ce2a['getConfigurations'](_0x4e3d96);}})[_0x85eb('0x25')](function(_0x21b873){if(_0x21b873){_0x249511=_0x21b873[_0x85eb('0x44')];if(!_0x593723[_0x85eb('0x30')][_0x85eb('0x35')](_0x85eb('0x36'))){_0x4e3d96['limit']=qs[_0x85eb('0x1e')](_0x593723['query'][_0x85eb('0x1e')]);_0x4e3d96[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x593723[_0x85eb('0x30')][_0x85eb('0x1c')]);}return _0x27ce2a['getConfigurations'](_0x4e3d96);}})[_0x85eb('0x25')](function(_0x143d65){if(_0x143d65){return _0x143d65?{'count':_0x249511,'rows':_0x143d65}:null;}})[_0x85eb('0x25')](respondWithResult(_0x39316d,null))[_0x85eb('0x40')](handleError(_0x39316d,null));};exports[_0x85eb('0x4e')]=function(_0x14cab8,_0x23fcf9,_0x5de716){if(_0x14cab8['body']['id']){delete _0x14cab8[_0x85eb('0x48')]['id'];}return db['ZendeskAccount'][_0x85eb('0x4b')]({'where':{'id':_0x14cab8[_0x85eb('0x42')]['id']}})[_0x85eb('0x25')](handleEntityNotFound(_0x23fcf9,null))[_0x85eb('0x25')](function(_0x259ee3){if(_0x259ee3){_0x14cab8['body'][_0x85eb('0x4f')]=_0x259ee3['id'];_0x14cab8[_0x85eb('0x48')][_0x85eb('0x50')]=integrations[_0x85eb('0x51')](_0x14cab8[_0x85eb('0x48')][_0x85eb('0x52')],_0x14cab8['body']['type']);_0x14cab8[_0x85eb('0x48')]['Descriptions']=integrations[_0x85eb('0x53')](_0x14cab8[_0x85eb('0x48')][_0x85eb('0x52')],_0x14cab8[_0x85eb('0x48')][_0x85eb('0x3c')]);return db[_0x85eb('0x4c')]['create'](_0x14cab8[_0x85eb('0x48')],{'include':[{'model':db[_0x85eb('0x54')],'as':_0x85eb('0x50')},{'model':db[_0x85eb('0x54')],'as':'Descriptions'}]});}return null;})[_0x85eb('0x25')](respondWithResult(_0x23fcf9,null))[_0x85eb('0x40')](handleError(_0x23fcf9,null));};exports[_0x85eb('0x55')]=function(_0x14bf0e,_0x5037c7,_0x459317){var _0x2e6734='';return db[_0x85eb('0x2b')][_0x85eb('0x4b')]({'where':{'id':_0x14bf0e[_0x85eb('0x42')]['id']},'attributes':['id',_0x85eb('0x56'),_0x85eb('0x57'),_0x85eb('0x58'),_0x85eb('0x59'),_0x85eb('0x5a')]})[_0x85eb('0x25')](handleEntityNotFound(_0x5037c7,null))[_0x85eb('0x25')](function(_0x1d9d3a){if(_0x1d9d3a){_0x2e6734=_0x1d9d3a[_0x85eb('0x5a')];var _0x2f2464=_0x2e6734[_0x85eb('0x5b')](-0x1);if(_0x2f2464==='/'){_0x2e6734=_0x2e6734[_0x85eb('0x5c')](0x0,_0x2e6734[_0x85eb('0x5d')](_0x2f2464));}var _0x106caa={'method':'GET','uri':util[_0x85eb('0x5e')]('%s/%s',_0x2e6734,_0x85eb('0x5f')),'json':!![]};switch(_0x1d9d3a[_0x85eb('0x59')]){case _0x85eb('0x57'):_0x106caa[_0x85eb('0x60')]={'Authorization':util[_0x85eb('0x5e')](_0x85eb('0x61'),new Buffer(util[_0x85eb('0x5e')](_0x85eb('0x62'),_0x1d9d3a[_0x85eb('0x56')],_0x1d9d3a['password']))[_0x85eb('0x63')](_0x85eb('0x64')))};break;case _0x85eb('0x58'):_0x106caa[_0x85eb('0x60')]={'Authorization':util[_0x85eb('0x5e')]('Basic\x20%s',new Buffer(util[_0x85eb('0x5e')]('%s/token:%s',_0x1d9d3a[_0x85eb('0x56')],_0x1d9d3a[_0x85eb('0x58')]))[_0x85eb('0x63')]('base64'))};break;default:throw new db[(_0x85eb('0x65'))][(_0x85eb('0x66'))](_0x85eb('0x67'));}return rp(_0x106caa);}})['then'](function(_0x588c72){if(_0x588c72){var _0x45a1ef=[_0x85eb('0x68'),_0x85eb('0x69'),_0x85eb('0x6a'),'assignee'];_[_0x85eb('0x6b')](_0x588c72['ticket_fields'],function(_0x11a3bd){return _0x45a1ef[_0x85eb('0x6c')](_0x11a3bd[_0x85eb('0x3c')]);});return{'count':_0x588c72[_0x85eb('0x5f')][_0x85eb('0x44')],'rows':_[_0x85eb('0x2a')](_0x588c72['ticket_fields'],function(_0x9a80a1){return{'id':_0x9a80a1['id'],'name':_0x9a80a1['position']>0x7?_0x9a80a1[_0x85eb('0x6d')]:_0x9a80a1[_0x85eb('0x3c')],'custom':_0x9a80a1[_0x85eb('0x6e')]>0x7?!![]:![],'options':_0x9a80a1[_0x85eb('0x6f')]?_0x9a80a1[_0x85eb('0x6f')]:_0x9a80a1[_0x85eb('0x70')]?_0x9a80a1[_0x85eb('0x70')]:[]};})};}})[_0x85eb('0x25')](respondWithResult(_0x5037c7,null))[_0x85eb('0x40')](function(_0x543146){var _0x3358c8=_0x14bf0e[_0x85eb('0x30')]['test']?0x1f4:_0x543146['statusCode']||0x1f4;logger[_0x85eb('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x85eb('0x55'),_0x3358c8,JSON['stringify'](_0x543146));delete _0x543146[_0x85eb('0x29')];if(_0x3358c8===0x191){_0x3358c8=0x190;}_0x5037c7['status'](_0x3358c8)[_0x85eb('0x71')](_0x14bf0e[_0x85eb('0x30')]['test']?{'message':_0x85eb('0x72'),'statusCode':_0x543146[_0x85eb('0x73')]}:_0x543146);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index d32fd97..3c7928f 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 _0xa5fd=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash'];(function(_0x3a2a3c,_0x37bd31){var _0x50ac9a=function(_0x494a7f){while(--_0x494a7f){_0x3a2a3c['push'](_0x3a2a3c['shift']());}};_0x50ac9a(++_0x37bd31);}(_0xa5fd,0x1ed));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xda5f('0x0'));var util=require(_0xda5f('0x1'));var logger=require('../../config/logger')(_0xda5f('0x2'));var moment=require(_0xda5f('0x3'));var BPromise=require(_0xda5f('0x4'));var rp=require(_0xda5f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xda5f('0x6'));var config=require(_0xda5f('0x7'));var attributes=require(_0xda5f('0x8'));var integrations=require(_0xda5f('0x9'));module[_0xda5f('0xa')]=function(_0x5d62f1,_0x2bef99){return _0x5d62f1['define'](_0xda5f('0xb'),attributes,{'tableName':_0xda5f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a05=['util','../../config/logger','api','moment','path','rimraf','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts'];(function(_0x4ac13d,_0x3763bc){var _0x1d9ac9=function(_0x776a){while(--_0x776a){_0x4ac13d['push'](_0x4ac13d['shift']());}};_0x1d9ac9(++_0x3763bc);}(_0x3a05,0xe7));var _0x53a0=function(_0x1968f6,_0x3df56c){_0x1968f6=_0x1968f6-0x0;var _0x4b8bde=_0x3a05[_0x1968f6];return _0x4b8bde;};'use strict';var _=require('lodash');var util=require(_0x53a0('0x0'));var logger=require(_0x53a0('0x1'))(_0x53a0('0x2'));var moment=require(_0x53a0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x53a0('0x4'));var rimraf=require(_0x53a0('0x5'));var config=require('../../config/environment');var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x53a0('0x6'));module[_0x53a0('0x7')]=function(_0x1eb827,_0x1afef7){return _0x1eb827[_0x53a0('0x8')](_0x53a0('0x9'),attributes,{'tableName':_0x53a0('0xa'),'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 a9a7214..9174608 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 _0x5ab3=['ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','findAll','options','attributes','include','map','model','stringify','ShowZendeskAccount','ZendeskAccount','find','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info'];(function(_0x317d1e,_0x179218){var _0x40dd65=function(_0x51fc89){while(--_0x51fc89){_0x317d1e['push'](_0x317d1e['shift']());}};_0x40dd65(++_0x179218);}(_0x5ab3,0x180));var _0x35ab=function(_0x4f0cc4,_0x143255){_0x4f0cc4=_0x4f0cc4-0x0;var _0x54cb8a=_0x5ab3[_0x4f0cc4];return _0x54cb8a;};'use strict';var _=require(_0x35ab('0x0'));var util=require(_0x35ab('0x1'));var moment=require('moment');var BPromise=require(_0x35ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x35ab('0x3'));var db=require(_0x35ab('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x35ab('0x5'))(_0x35ab('0x6'));var config=require(_0x35ab('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x35ab('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x467284,_0xff8443,_0x1f5c31){return new BPromise(function(_0x3eea92,_0x2bfee7){return client[_0x35ab('0x9')](_0x467284,_0x1f5c31)[_0x35ab('0xa')](function(_0x2e12e2){logger[_0x35ab('0xb')](_0x35ab('0xc'),_0xff8443,_0x35ab('0xd'));logger[_0x35ab('0xe')](_0x35ab('0xf'),_0xff8443,_0x35ab('0xd'),JSON['stringify'](_0x2e12e2));if(_0x2e12e2[_0x35ab('0x10')]){if(_0x2e12e2[_0x35ab('0x10')][_0x35ab('0x11')]===0x1f4){logger['error'](_0x35ab('0xc'),_0xff8443,_0x2e12e2[_0x35ab('0x10')]['message']);return _0x2bfee7(_0x2e12e2[_0x35ab('0x10')][_0x35ab('0x12')]);}logger[_0x35ab('0x10')](_0x35ab('0xc'),_0xff8443,_0x2e12e2[_0x35ab('0x10')][_0x35ab('0x12')]);return _0x3eea92(_0x2e12e2['error'][_0x35ab('0x12')]);}else{logger[_0x35ab('0xb')](_0x35ab('0xc'),_0xff8443,'request\x20sent');_0x3eea92(_0x2e12e2[_0x35ab('0x13')][_0x35ab('0x12')]);}})[_0x35ab('0x14')](function(_0x2dde0c){logger[_0x35ab('0x10')](_0x35ab('0xc'),_0xff8443,_0x2dde0c);_0x2bfee7(_0x2dde0c);});});}exports[_0x35ab('0x15')]=function(_0x2f1bb3){var _0x5e4934=this;return new Promise(function(_0x15b3e3,_0x5be3b4){return db['ZendeskAccount'][_0x35ab('0x16')]({'raw':_0x2f1bb3['options']?_0x2f1bb3['options']['raw']===undefined?!![]:![]:!![],'where':_0x2f1bb3[_0x35ab('0x17')]?_0x2f1bb3['options']['where']||null:null,'attributes':_0x2f1bb3[_0x35ab('0x17')]?_0x2f1bb3[_0x35ab('0x17')][_0x35ab('0x18')]||null:null,'limit':_0x2f1bb3[_0x35ab('0x17')]?_0x2f1bb3[_0x35ab('0x17')]['limit']||null:null,'include':_0x2f1bb3[_0x35ab('0x17')]?_0x2f1bb3[_0x35ab('0x17')][_0x35ab('0x19')]?_['map'](_0x2f1bb3[_0x35ab('0x17')][_0x35ab('0x19')],function(_0x4f4448){return{'model':db[_0x4f4448['model']],'as':_0x4f4448['as'],'attributes':_0x4f4448[_0x35ab('0x18')],'include':_0x4f4448[_0x35ab('0x19')]?_[_0x35ab('0x1a')](_0x4f4448[_0x35ab('0x19')],function(_0x432d12){return{'model':db[_0x432d12[_0x35ab('0x1b')]],'as':_0x432d12['as'],'attributes':_0x432d12[_0x35ab('0x18')],'include':_0x432d12[_0x35ab('0x19')]?_[_0x35ab('0x1a')](_0x432d12[_0x35ab('0x19')],function(_0x6ac982){return{'model':db[_0x6ac982[_0x35ab('0x1b')]],'as':_0x6ac982['as'],'attributes':_0x6ac982['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x26d694){logger[_0x35ab('0xb')](_0x35ab('0x15'),_0x2f1bb3);logger[_0x35ab('0xe')](_0x35ab('0x15'),_0x2f1bb3,JSON[_0x35ab('0x1c')](_0x26d694));_0x15b3e3(_0x26d694);})[_0x35ab('0x14')](function(_0x2073a5){logger['error'](_0x35ab('0x15'),_0x2073a5[_0x35ab('0x12')],_0x2f1bb3);_0x5be3b4(_0x5e4934[_0x35ab('0x10')](0x1f4,_0x2073a5[_0x35ab('0x12')]));});});};exports[_0x35ab('0x1d')]=function(_0x242d1b){var _0x3fd5d=this;return new Promise(function(_0x4f0945,_0x218a4c){return db[_0x35ab('0x1e')][_0x35ab('0x1f')]({'raw':_0x242d1b[_0x35ab('0x17')]?_0x242d1b[_0x35ab('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x242d1b[_0x35ab('0x17')]?_0x242d1b['options'][_0x35ab('0x20')]||null:null,'attributes':_0x242d1b[_0x35ab('0x17')]?_0x242d1b[_0x35ab('0x17')][_0x35ab('0x18')]||null:null,'include':_0x242d1b['options']?_0x242d1b['options']['include']?_[_0x35ab('0x1a')](_0x242d1b[_0x35ab('0x17')][_0x35ab('0x19')],function(_0x12a406){return{'model':db[_0x12a406['model']],'as':_0x12a406['as'],'attributes':_0x12a406[_0x35ab('0x18')],'include':_0x12a406[_0x35ab('0x19')]?_['map'](_0x12a406[_0x35ab('0x19')],function(_0x48857a){return{'model':db[_0x48857a['model']],'as':_0x48857a['as'],'attributes':_0x48857a[_0x35ab('0x18')],'include':_0x48857a[_0x35ab('0x19')]?_[_0x35ab('0x1a')](_0x48857a['include'],function(_0x2202ec){return{'model':db[_0x2202ec[_0x35ab('0x1b')]],'as':_0x2202ec['as'],'attributes':_0x2202ec[_0x35ab('0x18')]};}):[]};}):[]};}):[]:[]})[_0x35ab('0xa')](function(_0x3a16fd){logger[_0x35ab('0xb')](_0x35ab('0x1d'),_0x242d1b);logger['debug'](_0x35ab('0x1d'),_0x242d1b,JSON[_0x35ab('0x1c')](_0x3a16fd));_0x4f0945(_0x3a16fd);})[_0x35ab('0x14')](function(_0x2a0676){logger[_0x35ab('0x10')](_0x35ab('0x1d'),_0x2a0676[_0x35ab('0x12')],_0x242d1b);_0x218a4c(_0x3fd5d[_0x35ab('0x10')](0x1f4,_0x2a0676['message']));});});}; \ No newline at end of file +var _0xb9fe=['result','catch','ZendeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','GetZendeskAccount','ShowZendeskAccount','then','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x272d90,_0x5e70ff){var _0x2bf4a2=function(_0x544da6){while(--_0x544da6){_0x272d90['push'](_0x272d90['shift']());}};_0x2bf4a2(++_0x5e70ff);}(_0xb9fe,0xb9));var _0xeb9f=function(_0x4d82b0,_0x1efd2f){_0x4d82b0=_0x4d82b0-0x0;var _0x2c297e=_0xb9fe[_0x4d82b0];return _0x2c297e;};'use strict';var _=require(_0xeb9f('0x0'));var util=require(_0xeb9f('0x1'));var moment=require(_0xeb9f('0x2'));var BPromise=require(_0xeb9f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb9f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeb9f('0x5'))(_0xeb9f('0x6'));var config=require(_0xeb9f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xeb9f('0x8')][_0xeb9f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x590206,_0x26ab9e,_0x144139){return new BPromise(function(_0x516fe7,_0x1a2da4){return client[_0xeb9f('0xa')](_0x590206,_0x144139)['then'](function(_0x18e766){logger[_0xeb9f('0xb')](_0xeb9f('0xc'),_0x26ab9e,_0xeb9f('0xd'));logger[_0xeb9f('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x26ab9e,_0xeb9f('0xd'),JSON[_0xeb9f('0xf')](_0x18e766));if(_0x18e766['error']){if(_0x18e766[_0xeb9f('0x10')][_0xeb9f('0x11')]===0x1f4){logger['error'](_0xeb9f('0xc'),_0x26ab9e,_0x18e766[_0xeb9f('0x10')][_0xeb9f('0x12')]);return _0x1a2da4(_0x18e766['error'][_0xeb9f('0x12')]);}logger['error'](_0xeb9f('0xc'),_0x26ab9e,_0x18e766[_0xeb9f('0x10')]['message']);return _0x516fe7(_0x18e766[_0xeb9f('0x10')][_0xeb9f('0x12')]);}else{logger[_0xeb9f('0xb')](_0xeb9f('0xc'),_0x26ab9e,_0xeb9f('0xd'));_0x516fe7(_0x18e766[_0xeb9f('0x13')][_0xeb9f('0x12')]);}})[_0xeb9f('0x14')](function(_0x4147d3){logger[_0xeb9f('0x10')](_0xeb9f('0xc'),_0x26ab9e,_0x4147d3);_0x1a2da4(_0x4147d3);});});}exports['GetZendeskAccount']=function(_0xc6717e){var _0x453068=this;return new Promise(function(_0x3e5be2,_0x4e5c73){return db[_0xeb9f('0x15')][_0xeb9f('0x16')]({'raw':_0xc6717e[_0xeb9f('0x17')]?_0xc6717e['options'][_0xeb9f('0x18')]===undefined?!![]:![]:!![],'where':_0xc6717e[_0xeb9f('0x17')]?_0xc6717e[_0xeb9f('0x17')][_0xeb9f('0x19')]||null:null,'attributes':_0xc6717e['options']?_0xc6717e[_0xeb9f('0x17')]['attributes']||null:null,'limit':_0xc6717e[_0xeb9f('0x17')]?_0xc6717e[_0xeb9f('0x17')][_0xeb9f('0x1a')]||null:null,'include':_0xc6717e[_0xeb9f('0x17')]?_0xc6717e[_0xeb9f('0x17')][_0xeb9f('0x1b')]?_[_0xeb9f('0x1c')](_0xc6717e[_0xeb9f('0x17')]['include'],function(_0x4b6900){return{'model':db[_0x4b6900[_0xeb9f('0x1d')]],'as':_0x4b6900['as'],'attributes':_0x4b6900[_0xeb9f('0x1e')],'include':_0x4b6900[_0xeb9f('0x1b')]?_[_0xeb9f('0x1c')](_0x4b6900['include'],function(_0x31dff6){return{'model':db[_0x31dff6[_0xeb9f('0x1d')]],'as':_0x31dff6['as'],'attributes':_0x31dff6[_0xeb9f('0x1e')],'include':_0x31dff6[_0xeb9f('0x1b')]?_[_0xeb9f('0x1c')](_0x31dff6[_0xeb9f('0x1b')],function(_0x2090b3){return{'model':db[_0x2090b3[_0xeb9f('0x1d')]],'as':_0x2090b3['as'],'attributes':_0x2090b3[_0xeb9f('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34d0f6){logger[_0xeb9f('0xb')](_0xeb9f('0x1f'),_0xc6717e);logger['debug'](_0xeb9f('0x1f'),_0xc6717e,JSON[_0xeb9f('0xf')](_0x34d0f6));_0x3e5be2(_0x34d0f6);})['catch'](function(_0x389c14){logger[_0xeb9f('0x10')](_0xeb9f('0x1f'),_0x389c14[_0xeb9f('0x12')],_0xc6717e);_0x4e5c73(_0x453068[_0xeb9f('0x10')](0x1f4,_0x389c14['message']));});});};exports[_0xeb9f('0x20')]=function(_0x7e8537){var _0xae1fa4=this;return new Promise(function(_0x13390e,_0x5d2fe2){return db[_0xeb9f('0x15')]['find']({'raw':_0x7e8537[_0xeb9f('0x17')]?_0x7e8537[_0xeb9f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x7e8537[_0xeb9f('0x17')]?_0x7e8537[_0xeb9f('0x17')]['where']||null:null,'attributes':_0x7e8537[_0xeb9f('0x17')]?_0x7e8537[_0xeb9f('0x17')][_0xeb9f('0x1e')]||null:null,'include':_0x7e8537[_0xeb9f('0x17')]?_0x7e8537[_0xeb9f('0x17')]['include']?_[_0xeb9f('0x1c')](_0x7e8537[_0xeb9f('0x17')][_0xeb9f('0x1b')],function(_0x43cf0b){return{'model':db[_0x43cf0b['model']],'as':_0x43cf0b['as'],'attributes':_0x43cf0b[_0xeb9f('0x1e')],'include':_0x43cf0b[_0xeb9f('0x1b')]?_[_0xeb9f('0x1c')](_0x43cf0b[_0xeb9f('0x1b')],function(_0x3190ec){return{'model':db[_0x3190ec[_0xeb9f('0x1d')]],'as':_0x3190ec['as'],'attributes':_0x3190ec[_0xeb9f('0x1e')],'include':_0x3190ec[_0xeb9f('0x1b')]?_[_0xeb9f('0x1c')](_0x3190ec[_0xeb9f('0x1b')],function(_0x3b00c3){return{'model':db[_0x3b00c3[_0xeb9f('0x1d')]],'as':_0x3b00c3['as'],'attributes':_0x3b00c3[_0xeb9f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xeb9f('0x21')](function(_0x309eba){logger[_0xeb9f('0xb')](_0xeb9f('0x20'),_0x7e8537);logger[_0xeb9f('0xe')](_0xeb9f('0x20'),_0x7e8537,JSON[_0xeb9f('0xf')](_0x309eba));_0x13390e(_0x309eba);})['catch'](function(_0x37004d){logger[_0xeb9f('0x10')](_0xeb9f('0x20'),_0x37004d[_0xeb9f('0x12')],_0x7e8537);_0x5d2fe2(_0xae1fa4['error'](0x1f4,_0x37004d[_0xeb9f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 42ead46..a0a2a80 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 _0x9ffd=['update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','put'];(function(_0x575057,_0x14baf3){var _0x49dbc8=function(_0x23599a){while(--_0x23599a){_0x575057['push'](_0x575057['shift']());}};_0x49dbc8(++_0x14baf3);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x5640cf,_0x1a1355){_0x5640cf=_0x5640cf-0x0;var _0x33f309=_0x9ffd[_0x5640cf];return _0x33f309;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xb')](_0xd9ff('0xe'),auth[_0xd9ff('0x9')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0xb')](_0xd9ff('0x10'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0xb')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['getTags']);router['post']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router[_0xd9ff('0x14')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['setTags']);router[_0xd9ff('0x15')](_0xd9ff('0xc'),auth['isAuthenticated'](),controller[_0xd9ff('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd9ff('0x17')]=router; \ No newline at end of file +var _0x4024=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id/fields','getDescriptions','/:id/tags','getTags','create','post','setTags','put','/:id','update','delete','destroy','exports','multer'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x4024,0x89));var _0x4402=function(_0x2576af,_0x824307){_0x2576af=_0x2576af-0x0;var _0xc5133=_0x4024[_0x2576af];return _0xc5133;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./intZendeskConfiguration.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['get'](_0x4402('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x4402('0x9')]('/:id/subjects',auth[_0x4402('0x7')](),controller['getSubjects']);router[_0x4402('0x9')]('/:id/descriptions',auth[_0x4402('0x7')](),controller[_0x4402('0xb')]);router['get'](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0xd')]);router['post']('/',auth[_0x4402('0x7')](),controller[_0x4402('0xe')]);router[_0x4402('0xf')](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0x10')]);router[_0x4402('0x11')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x13')]);router[_0x4402('0x14')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x15')]);module[_0x4402('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index d6e4bea..df670a3 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 _0x36c1=['STRING','sequelize','exports'];(function(_0x2d7680,_0x2e9318){var _0x4276de=function(_0x3ec76b){while(--_0x3ec76b){_0x2d7680['push'](_0x2d7680['shift']());}};_0x4276de(++_0x2e9318);}(_0x36c1,0x1ae));var _0x136c=function(_0x8b0f43,_0x1c57b8){_0x8b0f43=_0x8b0f43-0x0;var _0x3f4425=_0x36c1[_0x8b0f43];return _0x3f4425;};'use strict';var Sequelize=require(_0x136c('0x0'));module[_0x136c('0x1')]={'name':{'type':Sequelize[_0x136c('0x2')]},'description':{'type':Sequelize[_0x136c('0x2')]}}; \ No newline at end of file +var _0x27c5=['STRING','sequelize','exports'];(function(_0x37eb95,_0x1bdc09){var _0x4a6b4a=function(_0x38bba9){while(--_0x38bba9){_0x37eb95['push'](_0x37eb95['shift']());}};_0x4a6b4a(++_0x1bdc09);}(_0x27c5,0xf7));var _0x527c=function(_0x1614c2,_0x1fccfc){_0x1614c2=_0x1614c2-0x0;var _0x182c4c=_0x27c5[_0x1614c2];return _0x182c4c;};'use strict';var Sequelize=require(_0x527c('0x0'));module[_0x527c('0x1')]={'name':{'type':Sequelize[_0x527c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 1c2f3fc..10a641e 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 _0xed8a=['findAll','show','keys','rawAttributes','includeAll','include','options','find','catch','create','body','destroy','getFields','findOne','params','ZendeskField','nolimit','getSubjects','pick','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','ZendeskConfiguration','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','offset','order','sort','where','filter','merge'];(function(_0x1b02bb,_0x3d9fde){var _0x131245=function(_0x2fd1d8){while(--_0x2fd1d8){_0x1b02bb['push'](_0x1b02bb['shift']());}};_0x131245(++_0x3d9fde);}(_0xed8a,0x6e));var _0xaed8=function(_0x53c682,_0xf31a4e){_0x53c682=_0x53c682-0x0;var _0x37ed7c=_0xed8a[_0x53c682];return _0x37ed7c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaed8('0x0'));var zipdir=require(_0xaed8('0x1'));var jsonpatch=require(_0xaed8('0x2'));var rp=require(_0xaed8('0x3'));var moment=require(_0xaed8('0x4'));var BPromise=require(_0xaed8('0x5'));var Mustache=require(_0xaed8('0x6'));var util=require(_0xaed8('0x7'));var path=require(_0xaed8('0x8'));var sox=require(_0xaed8('0x9'));var csv=require(_0xaed8('0xa'));var ejs=require(_0xaed8('0xb'));var fs=require('fs');var fs_extra=require(_0xaed8('0xc'));var _=require('lodash');var squel=require(_0xaed8('0xd'));var crypto=require('crypto');var jsforce=require(_0xaed8('0xe'));var deskjs=require(_0xaed8('0xf'));var toCsv=require(_0xaed8('0xa'));var querystring=require(_0xaed8('0x10'));var Papa=require(_0xaed8('0x11'));var Redis=require(_0xaed8('0x12'));var authService=require(_0xaed8('0x13'));var qs=require(_0xaed8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaed8('0x15'))(_0xaed8('0x16'));var utils=require(_0xaed8('0x17'));var config=require(_0xaed8('0x18'));var licenseUtil=require(_0xaed8('0x19'));var db=require(_0xaed8('0x1a'))['db'];function respondWithStatusCode(_0x85b5ef,_0x31d352){_0x31d352=_0x31d352||0xcc;return function(_0x556715){if(_0x556715){return _0x85b5ef[_0xaed8('0x1b')](_0x31d352);}return _0x85b5ef[_0xaed8('0x1c')](_0x31d352)['end']();};}function respondWithResult(_0x38e979,_0x128bad){_0x128bad=_0x128bad||0xc8;return function(_0x396463){if(_0x396463){return _0x38e979[_0xaed8('0x1c')](_0x128bad)[_0xaed8('0x1d')](_0x396463);}};}function respondWithFilteredResult(_0x162067,_0x3a4519){return function(_0x16dd74){if(_0x16dd74){var _0x5593b9=typeof _0x3a4519['offset']===_0xaed8('0x1e')&&typeof _0x3a4519[_0xaed8('0x1f')]===_0xaed8('0x1e');var _0xc91ba6=_0x16dd74[_0xaed8('0x20')];var _0x1cc3c0=_0x5593b9?0x0:_0x3a4519['offset'];var _0x27e951=_0x5593b9?_0x16dd74['count']:_0x3a4519['offset']+_0x3a4519[_0xaed8('0x1f')];var _0xc01a1b;if(_0x27e951>=_0xc91ba6){_0x27e951=_0xc91ba6;_0xc01a1b=0xc8;}else{_0xc01a1b=0xce;}_0x162067[_0xaed8('0x1c')](_0xc01a1b);return _0x162067[_0xaed8('0x21')](_0xaed8('0x22'),_0x1cc3c0+'-'+_0x27e951+'/'+_0xc91ba6)[_0xaed8('0x1d')](_0x16dd74);}return null;};}function patchUpdates(_0x996349){return function(_0x3db2a9){try{jsonpatch[_0xaed8('0x23')](_0x3db2a9,_0x996349,!![]);}catch(_0x52f81c){return BPromise[_0xaed8('0x24')](_0x52f81c);}return _0x3db2a9[_0xaed8('0x25')]();};}function saveUpdates(_0x3b5a08,_0x3e70bf){return function(_0x1ed87f){if(_0x1ed87f){return _0x1ed87f[_0xaed8('0x26')](_0x3b5a08)[_0xaed8('0x27')](function(_0x25b9b4){return _0x25b9b4;});}return null;};}function removeEntity(_0x59d990,_0x27aba6){return function(_0x1cb9ee){if(_0x1cb9ee){return _0x1cb9ee['destroy']()['then'](function(){_0x59d990['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xaad365,_0x20fe66){return function(_0x154a7a){if(!_0x154a7a){_0xaad365[_0xaed8('0x1b')](0x194);}return _0x154a7a;};}function handleError(_0x51ce56,_0x1d6c91){_0x1d6c91=_0x1d6c91||0x1f4;return function(_0x50c57f){logger[_0xaed8('0x28')](_0x50c57f['stack']);if(_0x50c57f[_0xaed8('0x29')]){delete _0x50c57f[_0xaed8('0x29')];}_0x51ce56[_0xaed8('0x1c')](_0x1d6c91)[_0xaed8('0x2a')](_0x50c57f);};}exports[_0xaed8('0x2b')]=function(_0x4d116f,_0x2dd237){var _0x50bda5={},_0x5814d3={},_0x354042={'count':0x0,'rows':[]};var _0x2de16d=_[_0xaed8('0x2c')](db[_0xaed8('0x2d')]['rawAttributes'],function(_0x19f7ed){return{'name':_0x19f7ed[_0xaed8('0x2e')],'type':_0x19f7ed[_0xaed8('0x2f')]['key']};});_0x5814d3[_0xaed8('0x30')]=_[_0xaed8('0x2c')](_0x2de16d,'name');_0x5814d3[_0xaed8('0x31')]=_['keys'](_0x4d116f['query']);_0x5814d3[_0xaed8('0x32')]=_['intersection'](_0x5814d3[_0xaed8('0x30')],_0x5814d3[_0xaed8('0x31')]);_0x50bda5[_0xaed8('0x33')]=_[_0xaed8('0x34')](_0x5814d3[_0xaed8('0x30')],qs[_0xaed8('0x35')](_0x4d116f[_0xaed8('0x31')][_0xaed8('0x35')]));_0x50bda5[_0xaed8('0x33')]=_0x50bda5[_0xaed8('0x33')][_0xaed8('0x36')]?_0x50bda5['attributes']:_0x5814d3[_0xaed8('0x30')];if(!_0x4d116f['query'][_0xaed8('0x37')]('nolimit')){_0x50bda5['limit']=qs[_0xaed8('0x1f')](_0x4d116f['query'][_0xaed8('0x1f')]);_0x50bda5[_0xaed8('0x38')]=qs['offset'](_0x4d116f[_0xaed8('0x31')][_0xaed8('0x38')]);}_0x50bda5[_0xaed8('0x39')]=qs[_0xaed8('0x3a')](_0x4d116f['query'][_0xaed8('0x3a')]);_0x50bda5[_0xaed8('0x3b')]=qs[_0xaed8('0x32')](_['pick'](_0x4d116f[_0xaed8('0x31')],_0x5814d3[_0xaed8('0x32')]),_0x2de16d);if(_0x4d116f[_0xaed8('0x31')][_0xaed8('0x3c')]){_0x50bda5[_0xaed8('0x3b')]=_[_0xaed8('0x3d')](_0x50bda5['where'],{'$or':_[_0xaed8('0x2c')](_0x2de16d,function(_0x2623a0){if(_0x2623a0[_0xaed8('0x2f')]!=='VIRTUAL'){var _0x3beacc={};_0x3beacc[_0x2623a0[_0xaed8('0x29')]]={'$like':'%'+_0x4d116f['query']['filter']+'%'};return _0x3beacc;}})});}_0x50bda5=_['merge']({},_0x50bda5,_0x4d116f['options']);var _0x49bb57={'where':_0x50bda5[_0xaed8('0x3b')]};return db[_0xaed8('0x2d')][_0xaed8('0x20')](_0x49bb57)[_0xaed8('0x27')](function(_0x437318){_0x354042[_0xaed8('0x20')]=_0x437318;if(_0x4d116f[_0xaed8('0x31')]['includeAll']){_0x50bda5['include']=[{'all':!![]}];}return db[_0xaed8('0x2d')][_0xaed8('0x3e')](_0x50bda5);})[_0xaed8('0x27')](function(_0x5d8de4){_0x354042['rows']=_0x5d8de4;return _0x354042;})[_0xaed8('0x27')](respondWithFilteredResult(_0x2dd237,_0x50bda5))['catch'](handleError(_0x2dd237,null));};exports[_0xaed8('0x3f')]=function(_0x3b2c22,_0x4783e0){var _0x4bd1ed={'raw':![],'where':{'id':_0x3b2c22['params']['id']}},_0x1a8bf1={};_0x1a8bf1[_0xaed8('0x30')]=_[_0xaed8('0x40')](db[_0xaed8('0x2d')][_0xaed8('0x41')]);_0x1a8bf1['query']=_[_0xaed8('0x40')](_0x3b2c22[_0xaed8('0x31')]);_0x1a8bf1[_0xaed8('0x32')]=_[_0xaed8('0x34')](_0x1a8bf1[_0xaed8('0x30')],_0x1a8bf1[_0xaed8('0x31')]);_0x4bd1ed[_0xaed8('0x33')]=_[_0xaed8('0x34')](_0x1a8bf1[_0xaed8('0x30')],qs[_0xaed8('0x35')](_0x3b2c22['query'][_0xaed8('0x35')]));_0x4bd1ed[_0xaed8('0x33')]=_0x4bd1ed[_0xaed8('0x33')][_0xaed8('0x36')]?_0x4bd1ed[_0xaed8('0x33')]:_0x1a8bf1[_0xaed8('0x30')];if(_0x3b2c22[_0xaed8('0x31')][_0xaed8('0x42')]){_0x4bd1ed[_0xaed8('0x43')]=[{'all':!![]}];}_0x4bd1ed=_['merge']({},_0x4bd1ed,_0x3b2c22[_0xaed8('0x44')]);return db[_0xaed8('0x2d')][_0xaed8('0x45')](_0x4bd1ed)[_0xaed8('0x27')](handleEntityNotFound(_0x4783e0,null))['then'](respondWithResult(_0x4783e0,null))[_0xaed8('0x46')](handleError(_0x4783e0,null));};exports['create']=function(_0x13afec,_0x25ed82){return db[_0xaed8('0x2d')][_0xaed8('0x47')](_0x13afec[_0xaed8('0x48')],{})[_0xaed8('0x27')](respondWithResult(_0x25ed82,0xc9))[_0xaed8('0x46')](handleError(_0x25ed82,null));};exports[_0xaed8('0x26')]=function(_0x21c2b0,_0x5d237e){if(_0x21c2b0[_0xaed8('0x48')]['id']){delete _0x21c2b0[_0xaed8('0x48')]['id'];}return db[_0xaed8('0x2d')][_0xaed8('0x45')]({'where':{'id':_0x21c2b0['params']['id']}})[_0xaed8('0x27')](handleEntityNotFound(_0x5d237e,null))[_0xaed8('0x27')](saveUpdates(_0x21c2b0[_0xaed8('0x48')],null))['then'](respondWithResult(_0x5d237e,null))['catch'](handleError(_0x5d237e,null));};exports[_0xaed8('0x49')]=function(_0x348462,_0x3953ac){return db[_0xaed8('0x2d')][_0xaed8('0x45')]({'where':{'id':_0x348462['params']['id']}})[_0xaed8('0x27')](handleEntityNotFound(_0x3953ac,null))['then'](removeEntity(_0x3953ac,null))[_0xaed8('0x46')](handleError(_0x3953ac,null));};exports[_0xaed8('0x4a')]=function(_0x3a7fd7,_0x2d82f4,_0x3f6743){var _0x203b5f={};var _0x4119b9={};var _0x26ddb5;var _0x6a1ac;return db[_0xaed8('0x2d')][_0xaed8('0x4b')]({'where':{'id':_0x3a7fd7[_0xaed8('0x4c')]['id']}})[_0xaed8('0x27')](handleEntityNotFound(_0x2d82f4,null))[_0xaed8('0x27')](function(_0x33c7c5){if(_0x33c7c5){_0x26ddb5=_0x33c7c5;_0x4119b9[_0xaed8('0x30')]=_[_0xaed8('0x40')](db[_0xaed8('0x4d')][_0xaed8('0x41')]);_0x4119b9['query']=_[_0xaed8('0x40')](_0x3a7fd7[_0xaed8('0x31')]);_0x4119b9[_0xaed8('0x32')]=_[_0xaed8('0x34')](_0x4119b9[_0xaed8('0x30')],_0x4119b9[_0xaed8('0x31')]);_0x203b5f['attributes']=_[_0xaed8('0x34')](_0x4119b9[_0xaed8('0x30')],qs[_0xaed8('0x35')](_0x3a7fd7[_0xaed8('0x31')]['fields']));_0x203b5f[_0xaed8('0x33')]=_0x203b5f[_0xaed8('0x33')][_0xaed8('0x36')]?_0x203b5f[_0xaed8('0x33')]:_0x4119b9[_0xaed8('0x30')];_0x203b5f[_0xaed8('0x39')]=qs[_0xaed8('0x3a')](_0x3a7fd7['query'][_0xaed8('0x3a')]);_0x203b5f[_0xaed8('0x3b')]=qs['filters'](_['pick'](_0x3a7fd7[_0xaed8('0x31')],_0x4119b9['filters']));if(_0x3a7fd7[_0xaed8('0x31')][_0xaed8('0x3c')]){_0x203b5f[_0xaed8('0x3b')]=_[_0xaed8('0x3d')](_0x203b5f[_0xaed8('0x3b')],{'$or':_[_0xaed8('0x2c')](_0x203b5f[_0xaed8('0x33')],function(_0x190602){var _0x293dff={};_0x293dff[_0x190602]={'$like':'%'+_0x3a7fd7['query']['filter']+'%'};return _0x293dff;})});}_0x203b5f=_[_0xaed8('0x3d')]({},_0x203b5f,_0x3a7fd7[_0xaed8('0x44')]);return _0x26ddb5['getFields'](_0x203b5f);}})[_0xaed8('0x27')](function(_0x444c67){if(_0x444c67){_0x6a1ac=_0x444c67['length'];if(!_0x3a7fd7[_0xaed8('0x31')]['hasOwnProperty'](_0xaed8('0x4e'))){_0x203b5f['limit']=qs['limit'](_0x3a7fd7[_0xaed8('0x31')][_0xaed8('0x1f')]);_0x203b5f[_0xaed8('0x38')]=qs[_0xaed8('0x38')](_0x3a7fd7[_0xaed8('0x31')][_0xaed8('0x38')]);}return _0x26ddb5['getFields'](_0x203b5f);}})['then'](function(_0x13b00b){if(_0x13b00b){return _0x13b00b?{'count':_0x6a1ac,'rows':_0x13b00b}:null;}})[_0xaed8('0x27')](respondWithResult(_0x2d82f4,null))[_0xaed8('0x46')](handleError(_0x2d82f4,null));};exports[_0xaed8('0x4f')]=function(_0x36943b,_0x2acd11,_0x45602a){var _0x274265={};var _0x438079={};var _0x3b11f3;var _0x40070b;return db[_0xaed8('0x2d')][_0xaed8('0x4b')]({'where':{'id':_0x36943b[_0xaed8('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2acd11,null))['then'](function(_0x5005da){if(_0x5005da){_0x3b11f3=_0x5005da;_0x438079[_0xaed8('0x30')]=_[_0xaed8('0x40')](db['ZendeskField'][_0xaed8('0x41')]);_0x438079[_0xaed8('0x31')]=_['keys'](_0x36943b['query']);_0x438079[_0xaed8('0x32')]=_['intersection'](_0x438079['model'],_0x438079[_0xaed8('0x31')]);_0x274265[_0xaed8('0x33')]=_[_0xaed8('0x34')](_0x438079[_0xaed8('0x30')],qs['fields'](_0x36943b[_0xaed8('0x31')]['fields']));_0x274265[_0xaed8('0x33')]=_0x274265[_0xaed8('0x33')][_0xaed8('0x36')]?_0x274265[_0xaed8('0x33')]:_0x438079[_0xaed8('0x30')];_0x274265[_0xaed8('0x39')]=qs[_0xaed8('0x3a')](_0x36943b['query'][_0xaed8('0x3a')]);_0x274265[_0xaed8('0x3b')]=qs[_0xaed8('0x32')](_[_0xaed8('0x50')](_0x36943b[_0xaed8('0x31')],_0x438079['filters']));if(_0x36943b['query'][_0xaed8('0x3c')]){_0x274265[_0xaed8('0x3b')]=_[_0xaed8('0x3d')](_0x274265['where'],{'$or':_[_0xaed8('0x2c')](_0x274265[_0xaed8('0x33')],function(_0x121f9c){var _0x46ecae={};_0x46ecae[_0x121f9c]={'$like':'%'+_0x36943b[_0xaed8('0x31')][_0xaed8('0x3c')]+'%'};return _0x46ecae;})});}_0x274265=_[_0xaed8('0x3d')]({},_0x274265,_0x36943b['options']);return _0x3b11f3[_0xaed8('0x4f')](_0x274265);}})[_0xaed8('0x27')](function(_0x21b9fc){if(_0x21b9fc){_0x40070b=_0x21b9fc[_0xaed8('0x36')];if(!_0x36943b['query'][_0xaed8('0x37')](_0xaed8('0x4e'))){_0x274265['limit']=qs[_0xaed8('0x1f')](_0x36943b[_0xaed8('0x31')][_0xaed8('0x1f')]);_0x274265[_0xaed8('0x38')]=qs[_0xaed8('0x38')](_0x36943b[_0xaed8('0x31')][_0xaed8('0x38')]);}return _0x3b11f3[_0xaed8('0x4f')](_0x274265);}})['then'](function(_0x40ddc2){if(_0x40ddc2){return _0x40ddc2?{'count':_0x40070b,'rows':_0x40ddc2}:null;}})[_0xaed8('0x27')](respondWithResult(_0x2acd11,null))[_0xaed8('0x46')](handleError(_0x2acd11,null));};exports[_0xaed8('0x51')]=function(_0x3f3f4e,_0x46dbce,_0x1b3b26){var _0x331a74={};var _0x5abd22={};var _0x56ae6f;var _0x2e51ee;return db[_0xaed8('0x2d')][_0xaed8('0x4b')]({'where':{'id':_0x3f3f4e[_0xaed8('0x4c')]['id']}})[_0xaed8('0x27')](handleEntityNotFound(_0x46dbce,null))['then'](function(_0x152805){if(_0x152805){_0x56ae6f=_0x152805;_0x5abd22['model']=_[_0xaed8('0x40')](db['ZendeskField'][_0xaed8('0x41')]);_0x5abd22[_0xaed8('0x31')]=_[_0xaed8('0x40')](_0x3f3f4e['query']);_0x5abd22[_0xaed8('0x32')]=_[_0xaed8('0x34')](_0x5abd22[_0xaed8('0x30')],_0x5abd22[_0xaed8('0x31')]);_0x331a74['attributes']=_[_0xaed8('0x34')](_0x5abd22['model'],qs[_0xaed8('0x35')](_0x3f3f4e[_0xaed8('0x31')][_0xaed8('0x35')]));_0x331a74['attributes']=_0x331a74[_0xaed8('0x33')][_0xaed8('0x36')]?_0x331a74['attributes']:_0x5abd22[_0xaed8('0x30')];_0x331a74[_0xaed8('0x39')]=qs['sort'](_0x3f3f4e[_0xaed8('0x31')][_0xaed8('0x3a')]);_0x331a74[_0xaed8('0x3b')]=qs['filters'](_[_0xaed8('0x50')](_0x3f3f4e[_0xaed8('0x31')],_0x5abd22['filters']));if(_0x3f3f4e[_0xaed8('0x31')]['filter']){_0x331a74[_0xaed8('0x3b')]=_['merge'](_0x331a74['where'],{'$or':_[_0xaed8('0x2c')](_0x331a74[_0xaed8('0x33')],function(_0x5a8924){var _0x31e4c7={};_0x31e4c7[_0x5a8924]={'$like':'%'+_0x3f3f4e['query'][_0xaed8('0x3c')]+'%'};return _0x31e4c7;})});}_0x331a74=_[_0xaed8('0x3d')]({},_0x331a74,_0x3f3f4e[_0xaed8('0x44')]);return _0x56ae6f[_0xaed8('0x51')](_0x331a74);}})[_0xaed8('0x27')](function(_0x24dad2){if(_0x24dad2){_0x2e51ee=_0x24dad2[_0xaed8('0x36')];if(!_0x3f3f4e['query'][_0xaed8('0x37')](_0xaed8('0x4e'))){_0x331a74[_0xaed8('0x1f')]=qs[_0xaed8('0x1f')](_0x3f3f4e[_0xaed8('0x31')][_0xaed8('0x1f')]);_0x331a74['offset']=qs[_0xaed8('0x38')](_0x3f3f4e[_0xaed8('0x31')]['offset']);}return _0x56ae6f[_0xaed8('0x51')](_0x331a74);}})[_0xaed8('0x27')](function(_0x33fe15){if(_0x33fe15){return _0x33fe15?{'count':_0x2e51ee,'rows':_0x33fe15}:null;}})[_0xaed8('0x27')](respondWithResult(_0x46dbce,null))[_0xaed8('0x46')](handleError(_0x46dbce,null));};exports[_0xaed8('0x52')]=function(_0x413b6c,_0x2e3f1f,_0x2dd769){var _0x2199db={};var _0x3481ae={};var _0x10603e;var _0x1c9f46;return db[_0xaed8('0x2d')][_0xaed8('0x4b')]({'where':{'id':_0x413b6c[_0xaed8('0x4c')]['id']}})[_0xaed8('0x27')](handleEntityNotFound(_0x2e3f1f,null))[_0xaed8('0x27')](function(_0x451ef3){if(_0x451ef3){_0x10603e=_0x451ef3;_0x3481ae[_0xaed8('0x30')]=_[_0xaed8('0x40')](db[_0xaed8('0x53')][_0xaed8('0x41')]);_0x3481ae[_0xaed8('0x31')]=_[_0xaed8('0x40')](_0x413b6c['query']);_0x3481ae[_0xaed8('0x32')]=_[_0xaed8('0x34')](_0x3481ae['model'],_0x3481ae[_0xaed8('0x31')]);_0x2199db[_0xaed8('0x33')]=_[_0xaed8('0x34')](_0x3481ae[_0xaed8('0x30')],qs[_0xaed8('0x35')](_0x413b6c[_0xaed8('0x31')]['fields']));_0x2199db[_0xaed8('0x33')]=_0x2199db[_0xaed8('0x33')][_0xaed8('0x36')]?_0x2199db[_0xaed8('0x33')]:_0x3481ae[_0xaed8('0x30')];_0x2199db[_0xaed8('0x39')]=qs[_0xaed8('0x3a')](_0x413b6c['query'][_0xaed8('0x3a')]);_0x2199db[_0xaed8('0x3b')]=qs[_0xaed8('0x32')](_[_0xaed8('0x50')](_0x413b6c[_0xaed8('0x31')],_0x3481ae[_0xaed8('0x32')]));if(_0x413b6c[_0xaed8('0x31')][_0xaed8('0x3c')]){_0x2199db[_0xaed8('0x3b')]=_[_0xaed8('0x3d')](_0x2199db[_0xaed8('0x3b')],{'$or':_[_0xaed8('0x2c')](_0x2199db['attributes'],function(_0x38531f){var _0x47394f={};_0x47394f[_0x38531f]={'$like':'%'+_0x413b6c[_0xaed8('0x31')][_0xaed8('0x3c')]+'%'};return _0x47394f;})});}_0x2199db=_[_0xaed8('0x3d')]({},_0x2199db,_0x413b6c[_0xaed8('0x44')]);return _0x10603e[_0xaed8('0x52')](_0x2199db);}})[_0xaed8('0x27')](function(_0x2487ac){if(_0x2487ac){_0x1c9f46=_0x2487ac[_0xaed8('0x36')];if(!_0x413b6c[_0xaed8('0x31')][_0xaed8('0x37')](_0xaed8('0x4e'))){_0x2199db[_0xaed8('0x1f')]=qs[_0xaed8('0x1f')](_0x413b6c[_0xaed8('0x31')][_0xaed8('0x1f')]);_0x2199db[_0xaed8('0x38')]=qs[_0xaed8('0x38')](_0x413b6c[_0xaed8('0x31')][_0xaed8('0x38')]);}return _0x10603e['getTags'](_0x2199db);}})[_0xaed8('0x27')](function(_0x438e1a){if(_0x438e1a){return _0x438e1a?{'count':_0x1c9f46,'rows':_0x438e1a}:null;}})[_0xaed8('0x27')](respondWithResult(_0x2e3f1f,null))[_0xaed8('0x46')](handleError(_0x2e3f1f,null));};exports[_0xaed8('0x54')]=function(_0x1abcd0,_0x46bd5e,_0x5d67f8){if(_0x1abcd0[_0xaed8('0x48')]['id']){delete _0x1abcd0[_0xaed8('0x48')]['id'];}return db[_0xaed8('0x2d')]['findOne']({'where':{'id':_0x1abcd0[_0xaed8('0x4c')]['id']}})[_0xaed8('0x27')](handleEntityNotFound(_0x46bd5e,null))[_0xaed8('0x27')](function(_0x435bb0){if(_0x435bb0){return _0x435bb0[_0xaed8('0x54')](_0x1abcd0[_0xaed8('0x48')][_0xaed8('0x55')]||[]);}return null;})[_0xaed8('0x27')](respondWithResult(_0x46bd5e,null))['catch'](handleError(_0x46bd5e,null));}; \ No newline at end of file +var _0x096a=['filter','merge','type','VIRTUAL','options','ZendeskConfiguration','includeAll','include','rows','catch','show','params','find','create','body','update','ZendeskField','getSubjects','findOne','nolimit','getDescriptions','getTags','Tag','setTags','ids','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/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick'];(function(_0x7a54a1,_0xac2e28){var _0x4f6cf9=function(_0x3d7e9f){while(--_0x3d7e9f){_0x7a54a1['push'](_0x7a54a1['shift']());}};_0x4f6cf9(++_0xac2e28);}(_0x096a,0x6e));var _0xa096=function(_0xda6024,_0x1434d4){_0xda6024=_0xda6024-0x0;var _0x338ba0=_0x096a[_0xda6024];return _0x338ba0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa096('0x0'));var jsonpatch=require(_0xa096('0x1'));var rp=require(_0xa096('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa096('0x3'));var util=require(_0xa096('0x4'));var path=require('path');var sox=require(_0xa096('0x5'));var csv=require(_0xa096('0x6'));var ejs=require(_0xa096('0x7'));var fs=require('fs');var fs_extra=require(_0xa096('0x8'));var _=require(_0xa096('0x9'));var squel=require(_0xa096('0xa'));var crypto=require(_0xa096('0xb'));var jsforce=require(_0xa096('0xc'));var deskjs=require(_0xa096('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa096('0xe'));var Papa=require(_0xa096('0xf'));var Redis=require(_0xa096('0x10'));var authService=require(_0xa096('0x11'));var qs=require(_0xa096('0x12'));var as=require(_0xa096('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa096('0x14'))(_0xa096('0x15'));var utils=require('../../config/utils');var config=require(_0xa096('0x16'));var licenseUtil=require(_0xa096('0x17'));var db=require(_0xa096('0x18'))['db'];function respondWithStatusCode(_0x4d7047,_0x53eb01){_0x53eb01=_0x53eb01||0xcc;return function(_0x580272){if(_0x580272){return _0x4d7047[_0xa096('0x19')](_0x53eb01);}return _0x4d7047['status'](_0x53eb01)[_0xa096('0x1a')]();};}function respondWithResult(_0x210cde,_0xec8801){_0xec8801=_0xec8801||0xc8;return function(_0x234222){if(_0x234222){return _0x210cde[_0xa096('0x1b')](_0xec8801)['json'](_0x234222);}};}function respondWithFilteredResult(_0x1c5f3c,_0x45bbef){return function(_0x59a370){if(_0x59a370){var _0x4ff76f=typeof _0x45bbef[_0xa096('0x1c')]===_0xa096('0x1d')&&typeof _0x45bbef[_0xa096('0x1e')]===_0xa096('0x1d');var _0x33c47e=_0x59a370[_0xa096('0x1f')];var _0x398b99=_0x4ff76f?0x0:_0x45bbef['offset'];var _0x47e80c=_0x4ff76f?_0x59a370[_0xa096('0x1f')]:_0x45bbef[_0xa096('0x1c')]+_0x45bbef[_0xa096('0x1e')];var _0x4df6dd;if(_0x47e80c>=_0x33c47e){_0x47e80c=_0x33c47e;_0x4df6dd=0xc8;}else{_0x4df6dd=0xce;}_0x1c5f3c['status'](_0x4df6dd);return _0x1c5f3c[_0xa096('0x20')](_0xa096('0x21'),_0x398b99+'-'+_0x47e80c+'/'+_0x33c47e)[_0xa096('0x22')](_0x59a370);}return null;};}function patchUpdates(_0x1e1926){return function(_0x5f315d){try{jsonpatch[_0xa096('0x23')](_0x5f315d,_0x1e1926,!![]);}catch(_0xceeac9){return BPromise[_0xa096('0x24')](_0xceeac9);}return _0x5f315d['save']();};}function saveUpdates(_0x2f5caf,_0x1ef003){return function(_0x5d3fe4){if(_0x5d3fe4){return _0x5d3fe4['update'](_0x2f5caf)[_0xa096('0x25')](function(_0xd0380b){return _0xd0380b;});}return null;};}function removeEntity(_0x1beeb0,_0x24450b){return function(_0x4e5e1){if(_0x4e5e1){return _0x4e5e1[_0xa096('0x26')]()['then'](function(){_0x1beeb0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x39afe3,_0x11b87e){return function(_0x580728){if(!_0x580728){_0x39afe3[_0xa096('0x19')](0x194);}return _0x580728;};}function handleError(_0x1dae79,_0xe287d2){_0xe287d2=_0xe287d2||0x1f4;return function(_0x128fdf){logger[_0xa096('0x27')](_0x128fdf[_0xa096('0x28')]);if(_0x128fdf['name']){delete _0x128fdf[_0xa096('0x29')];}_0x1dae79['status'](_0xe287d2)['send'](_0x128fdf);};}exports[_0xa096('0x2a')]=function(_0x102915,_0x596b05){var _0x5eeed5={},_0x3c0daa={},_0x176525={'count':0x0,'rows':[]};var _0x5d783d=_[_0xa096('0x2b')](db['ZendeskConfiguration'][_0xa096('0x2c')],function(_0x58d0ee){return{'name':_0x58d0ee[_0xa096('0x2d')],'type':_0x58d0ee['type'][_0xa096('0x2e')]};});_0x3c0daa[_0xa096('0x2f')]=_[_0xa096('0x2b')](_0x5d783d,'name');_0x3c0daa[_0xa096('0x30')]=_[_0xa096('0x31')](_0x102915[_0xa096('0x30')]);_0x3c0daa['filters']=_[_0xa096('0x32')](_0x3c0daa[_0xa096('0x2f')],_0x3c0daa['query']);_0x5eeed5[_0xa096('0x33')]=_['intersection'](_0x3c0daa['model'],qs[_0xa096('0x34')](_0x102915[_0xa096('0x30')]['fields']));_0x5eeed5[_0xa096('0x33')]=_0x5eeed5[_0xa096('0x33')][_0xa096('0x35')]?_0x5eeed5[_0xa096('0x33')]:_0x3c0daa[_0xa096('0x2f')];if(!_0x102915[_0xa096('0x30')][_0xa096('0x36')]('nolimit')){_0x5eeed5['limit']=qs[_0xa096('0x1e')](_0x102915[_0xa096('0x30')]['limit']);_0x5eeed5[_0xa096('0x1c')]=qs['offset'](_0x102915[_0xa096('0x30')][_0xa096('0x1c')]);}_0x5eeed5[_0xa096('0x37')]=qs[_0xa096('0x38')](_0x102915['query'][_0xa096('0x38')]);_0x5eeed5[_0xa096('0x39')]=qs[_0xa096('0x3a')](_[_0xa096('0x3b')](_0x102915[_0xa096('0x30')],_0x3c0daa[_0xa096('0x3a')]),_0x5d783d);if(_0x102915[_0xa096('0x30')][_0xa096('0x3c')]){_0x5eeed5[_0xa096('0x39')]=_[_0xa096('0x3d')](_0x5eeed5[_0xa096('0x39')],{'$or':_[_0xa096('0x2b')](_0x5d783d,function(_0x56861a){if(_0x56861a[_0xa096('0x3e')]!==_0xa096('0x3f')){var _0x51e18f={};_0x51e18f[_0x56861a['name']]={'$like':'%'+_0x102915[_0xa096('0x30')]['filter']+'%'};return _0x51e18f;}})});}_0x5eeed5=_['merge']({},_0x5eeed5,_0x102915[_0xa096('0x40')]);var _0xdf4941={'where':_0x5eeed5[_0xa096('0x39')]};return db[_0xa096('0x41')]['count'](_0xdf4941)['then'](function(_0x289e68){_0x176525[_0xa096('0x1f')]=_0x289e68;if(_0x102915[_0xa096('0x30')][_0xa096('0x42')]){_0x5eeed5[_0xa096('0x43')]=[{'all':!![]}];}return db[_0xa096('0x41')]['findAll'](_0x5eeed5);})['then'](function(_0x11d915){_0x176525[_0xa096('0x44')]=_0x11d915;return _0x176525;})[_0xa096('0x25')](respondWithFilteredResult(_0x596b05,_0x5eeed5))[_0xa096('0x45')](handleError(_0x596b05,null));};exports[_0xa096('0x46')]=function(_0x21ed7a,_0xe47c1d){var _0x29530e={'raw':![],'where':{'id':_0x21ed7a[_0xa096('0x47')]['id']}},_0x2ba36c={};_0x2ba36c['model']=_[_0xa096('0x31')](db[_0xa096('0x41')][_0xa096('0x2c')]);_0x2ba36c[_0xa096('0x30')]=_['keys'](_0x21ed7a['query']);_0x2ba36c[_0xa096('0x3a')]=_['intersection'](_0x2ba36c['model'],_0x2ba36c[_0xa096('0x30')]);_0x29530e['attributes']=_['intersection'](_0x2ba36c[_0xa096('0x2f')],qs[_0xa096('0x34')](_0x21ed7a['query'][_0xa096('0x34')]));_0x29530e[_0xa096('0x33')]=_0x29530e[_0xa096('0x33')][_0xa096('0x35')]?_0x29530e[_0xa096('0x33')]:_0x2ba36c['model'];if(_0x21ed7a[_0xa096('0x30')][_0xa096('0x42')]){_0x29530e[_0xa096('0x43')]=[{'all':!![]}];}_0x29530e=_['merge']({},_0x29530e,_0x21ed7a['options']);return db[_0xa096('0x41')][_0xa096('0x48')](_0x29530e)[_0xa096('0x25')](handleEntityNotFound(_0xe47c1d,null))[_0xa096('0x25')](respondWithResult(_0xe47c1d,null))[_0xa096('0x45')](handleError(_0xe47c1d,null));};exports[_0xa096('0x49')]=function(_0x51c1e3,_0x4dc024){return db['ZendeskConfiguration']['create'](_0x51c1e3[_0xa096('0x4a')],{})['then'](respondWithResult(_0x4dc024,0xc9))[_0xa096('0x45')](handleError(_0x4dc024,null));};exports[_0xa096('0x4b')]=function(_0x5d2174,_0x447805){if(_0x5d2174[_0xa096('0x4a')]['id']){delete _0x5d2174[_0xa096('0x4a')]['id'];}return db[_0xa096('0x41')][_0xa096('0x48')]({'where':{'id':_0x5d2174[_0xa096('0x47')]['id']}})[_0xa096('0x25')](handleEntityNotFound(_0x447805,null))['then'](saveUpdates(_0x5d2174['body'],null))[_0xa096('0x25')](respondWithResult(_0x447805,null))[_0xa096('0x45')](handleError(_0x447805,null));};exports[_0xa096('0x26')]=function(_0x238a2e,_0xabf100){return db[_0xa096('0x41')][_0xa096('0x48')]({'where':{'id':_0x238a2e[_0xa096('0x47')]['id']}})[_0xa096('0x25')](handleEntityNotFound(_0xabf100,null))[_0xa096('0x25')](removeEntity(_0xabf100,null))[_0xa096('0x45')](handleError(_0xabf100,null));};exports['getFields']=function(_0x975a76,_0x301834,_0x25f1a1){var _0x635d04={};var _0x1403d6={};var _0x586a2e;var _0x25ebf8;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x975a76[_0xa096('0x47')]['id']}})['then'](handleEntityNotFound(_0x301834,null))[_0xa096('0x25')](function(_0x44dedb){if(_0x44dedb){_0x586a2e=_0x44dedb;_0x1403d6['model']=_[_0xa096('0x31')](db[_0xa096('0x4c')][_0xa096('0x2c')]);_0x1403d6[_0xa096('0x30')]=_['keys'](_0x975a76['query']);_0x1403d6[_0xa096('0x3a')]=_[_0xa096('0x32')](_0x1403d6[_0xa096('0x2f')],_0x1403d6[_0xa096('0x30')]);_0x635d04[_0xa096('0x33')]=_[_0xa096('0x32')](_0x1403d6[_0xa096('0x2f')],qs[_0xa096('0x34')](_0x975a76[_0xa096('0x30')][_0xa096('0x34')]));_0x635d04[_0xa096('0x33')]=_0x635d04[_0xa096('0x33')][_0xa096('0x35')]?_0x635d04[_0xa096('0x33')]:_0x1403d6[_0xa096('0x2f')];_0x635d04['order']=qs[_0xa096('0x38')](_0x975a76[_0xa096('0x30')][_0xa096('0x38')]);_0x635d04[_0xa096('0x39')]=qs[_0xa096('0x3a')](_['pick'](_0x975a76[_0xa096('0x30')],_0x1403d6[_0xa096('0x3a')]));if(_0x975a76['query'][_0xa096('0x3c')]){_0x635d04[_0xa096('0x39')]=_[_0xa096('0x3d')](_0x635d04[_0xa096('0x39')],{'$or':_[_0xa096('0x2b')](_0x635d04[_0xa096('0x33')],function(_0x187c9f){var _0x4869e5={};_0x4869e5[_0x187c9f]={'$like':'%'+_0x975a76[_0xa096('0x30')][_0xa096('0x3c')]+'%'};return _0x4869e5;})});}_0x635d04=_['merge']({},_0x635d04,_0x975a76[_0xa096('0x40')]);return _0x586a2e['getFields'](_0x635d04);}})[_0xa096('0x25')](function(_0xa1a54){if(_0xa1a54){_0x25ebf8=_0xa1a54['length'];if(!_0x975a76[_0xa096('0x30')][_0xa096('0x36')]('nolimit')){_0x635d04[_0xa096('0x1e')]=qs['limit'](_0x975a76[_0xa096('0x30')][_0xa096('0x1e')]);_0x635d04[_0xa096('0x1c')]=qs[_0xa096('0x1c')](_0x975a76[_0xa096('0x30')][_0xa096('0x1c')]);}return _0x586a2e['getFields'](_0x635d04);}})[_0xa096('0x25')](function(_0x2e0c52){if(_0x2e0c52){return _0x2e0c52?{'count':_0x25ebf8,'rows':_0x2e0c52}:null;}})[_0xa096('0x25')](respondWithResult(_0x301834,null))[_0xa096('0x45')](handleError(_0x301834,null));};exports[_0xa096('0x4d')]=function(_0x22b4fb,_0x5bab81,_0x568d46){var _0x2fc0e7={};var _0x570852={};var _0x4274b4;var _0x42f16a;return db[_0xa096('0x41')][_0xa096('0x4e')]({'where':{'id':_0x22b4fb[_0xa096('0x47')]['id']}})['then'](handleEntityNotFound(_0x5bab81,null))['then'](function(_0x2af53f){if(_0x2af53f){_0x4274b4=_0x2af53f;_0x570852[_0xa096('0x2f')]=_['keys'](db[_0xa096('0x4c')][_0xa096('0x2c')]);_0x570852[_0xa096('0x30')]=_[_0xa096('0x31')](_0x22b4fb['query']);_0x570852[_0xa096('0x3a')]=_['intersection'](_0x570852['model'],_0x570852['query']);_0x2fc0e7[_0xa096('0x33')]=_[_0xa096('0x32')](_0x570852[_0xa096('0x2f')],qs['fields'](_0x22b4fb[_0xa096('0x30')][_0xa096('0x34')]));_0x2fc0e7[_0xa096('0x33')]=_0x2fc0e7[_0xa096('0x33')]['length']?_0x2fc0e7[_0xa096('0x33')]:_0x570852[_0xa096('0x2f')];_0x2fc0e7[_0xa096('0x37')]=qs[_0xa096('0x38')](_0x22b4fb[_0xa096('0x30')]['sort']);_0x2fc0e7[_0xa096('0x39')]=qs['filters'](_[_0xa096('0x3b')](_0x22b4fb['query'],_0x570852[_0xa096('0x3a')]));if(_0x22b4fb['query'][_0xa096('0x3c')]){_0x2fc0e7[_0xa096('0x39')]=_[_0xa096('0x3d')](_0x2fc0e7['where'],{'$or':_[_0xa096('0x2b')](_0x2fc0e7[_0xa096('0x33')],function(_0x3e41ed){var _0x32e010={};_0x32e010[_0x3e41ed]={'$like':'%'+_0x22b4fb[_0xa096('0x30')]['filter']+'%'};return _0x32e010;})});}_0x2fc0e7=_[_0xa096('0x3d')]({},_0x2fc0e7,_0x22b4fb[_0xa096('0x40')]);return _0x4274b4[_0xa096('0x4d')](_0x2fc0e7);}})[_0xa096('0x25')](function(_0x219b78){if(_0x219b78){_0x42f16a=_0x219b78[_0xa096('0x35')];if(!_0x22b4fb[_0xa096('0x30')]['hasOwnProperty'](_0xa096('0x4f'))){_0x2fc0e7[_0xa096('0x1e')]=qs[_0xa096('0x1e')](_0x22b4fb[_0xa096('0x30')]['limit']);_0x2fc0e7['offset']=qs['offset'](_0x22b4fb[_0xa096('0x30')][_0xa096('0x1c')]);}return _0x4274b4[_0xa096('0x4d')](_0x2fc0e7);}})[_0xa096('0x25')](function(_0x40343f){if(_0x40343f){return _0x40343f?{'count':_0x42f16a,'rows':_0x40343f}:null;}})[_0xa096('0x25')](respondWithResult(_0x5bab81,null))[_0xa096('0x45')](handleError(_0x5bab81,null));};exports[_0xa096('0x50')]=function(_0x237efb,_0x5b51de,_0x391ade){var _0x2ee190={};var _0x1c48ab={};var _0x1d8d8a;var _0x5edec3;return db[_0xa096('0x41')][_0xa096('0x4e')]({'where':{'id':_0x237efb[_0xa096('0x47')]['id']}})[_0xa096('0x25')](handleEntityNotFound(_0x5b51de,null))['then'](function(_0x596f56){if(_0x596f56){_0x1d8d8a=_0x596f56;_0x1c48ab[_0xa096('0x2f')]=_[_0xa096('0x31')](db['ZendeskField']['rawAttributes']);_0x1c48ab[_0xa096('0x30')]=_['keys'](_0x237efb[_0xa096('0x30')]);_0x1c48ab[_0xa096('0x3a')]=_['intersection'](_0x1c48ab[_0xa096('0x2f')],_0x1c48ab[_0xa096('0x30')]);_0x2ee190['attributes']=_[_0xa096('0x32')](_0x1c48ab[_0xa096('0x2f')],qs['fields'](_0x237efb[_0xa096('0x30')][_0xa096('0x34')]));_0x2ee190['attributes']=_0x2ee190[_0xa096('0x33')][_0xa096('0x35')]?_0x2ee190[_0xa096('0x33')]:_0x1c48ab[_0xa096('0x2f')];_0x2ee190[_0xa096('0x37')]=qs[_0xa096('0x38')](_0x237efb[_0xa096('0x30')][_0xa096('0x38')]);_0x2ee190[_0xa096('0x39')]=qs[_0xa096('0x3a')](_[_0xa096('0x3b')](_0x237efb[_0xa096('0x30')],_0x1c48ab[_0xa096('0x3a')]));if(_0x237efb[_0xa096('0x30')]['filter']){_0x2ee190['where']=_['merge'](_0x2ee190[_0xa096('0x39')],{'$or':_['map'](_0x2ee190['attributes'],function(_0x51c03f){var _0x1a7930={};_0x1a7930[_0x51c03f]={'$like':'%'+_0x237efb[_0xa096('0x30')][_0xa096('0x3c')]+'%'};return _0x1a7930;})});}_0x2ee190=_[_0xa096('0x3d')]({},_0x2ee190,_0x237efb['options']);return _0x1d8d8a[_0xa096('0x50')](_0x2ee190);}})[_0xa096('0x25')](function(_0x2785ed){if(_0x2785ed){_0x5edec3=_0x2785ed[_0xa096('0x35')];if(!_0x237efb[_0xa096('0x30')][_0xa096('0x36')](_0xa096('0x4f'))){_0x2ee190[_0xa096('0x1e')]=qs[_0xa096('0x1e')](_0x237efb[_0xa096('0x30')]['limit']);_0x2ee190[_0xa096('0x1c')]=qs[_0xa096('0x1c')](_0x237efb[_0xa096('0x30')][_0xa096('0x1c')]);}return _0x1d8d8a[_0xa096('0x50')](_0x2ee190);}})[_0xa096('0x25')](function(_0x1c0c36){if(_0x1c0c36){return _0x1c0c36?{'count':_0x5edec3,'rows':_0x1c0c36}:null;}})[_0xa096('0x25')](respondWithResult(_0x5b51de,null))[_0xa096('0x45')](handleError(_0x5b51de,null));};exports[_0xa096('0x51')]=function(_0x267a82,_0x1d0765,_0x31fdbc){var _0x394e66={};var _0x393b04={};var _0x57f9bb;var _0x4edbf1;return db[_0xa096('0x41')][_0xa096('0x4e')]({'where':{'id':_0x267a82[_0xa096('0x47')]['id']}})[_0xa096('0x25')](handleEntityNotFound(_0x1d0765,null))[_0xa096('0x25')](function(_0x1d38a3){if(_0x1d38a3){_0x57f9bb=_0x1d38a3;_0x393b04[_0xa096('0x2f')]=_['keys'](db[_0xa096('0x52')][_0xa096('0x2c')]);_0x393b04[_0xa096('0x30')]=_[_0xa096('0x31')](_0x267a82['query']);_0x393b04[_0xa096('0x3a')]=_[_0xa096('0x32')](_0x393b04[_0xa096('0x2f')],_0x393b04[_0xa096('0x30')]);_0x394e66['attributes']=_[_0xa096('0x32')](_0x393b04[_0xa096('0x2f')],qs['fields'](_0x267a82['query'][_0xa096('0x34')]));_0x394e66[_0xa096('0x33')]=_0x394e66['attributes'][_0xa096('0x35')]?_0x394e66[_0xa096('0x33')]:_0x393b04['model'];_0x394e66[_0xa096('0x37')]=qs[_0xa096('0x38')](_0x267a82['query']['sort']);_0x394e66[_0xa096('0x39')]=qs[_0xa096('0x3a')](_[_0xa096('0x3b')](_0x267a82['query'],_0x393b04['filters']));if(_0x267a82['query'][_0xa096('0x3c')]){_0x394e66[_0xa096('0x39')]=_[_0xa096('0x3d')](_0x394e66[_0xa096('0x39')],{'$or':_[_0xa096('0x2b')](_0x394e66['attributes'],function(_0xd254c8){var _0x41856a={};_0x41856a[_0xd254c8]={'$like':'%'+_0x267a82[_0xa096('0x30')][_0xa096('0x3c')]+'%'};return _0x41856a;})});}_0x394e66=_['merge']({},_0x394e66,_0x267a82['options']);return _0x57f9bb[_0xa096('0x51')](_0x394e66);}})[_0xa096('0x25')](function(_0x1a21e7){if(_0x1a21e7){_0x4edbf1=_0x1a21e7[_0xa096('0x35')];if(!_0x267a82[_0xa096('0x30')][_0xa096('0x36')](_0xa096('0x4f'))){_0x394e66[_0xa096('0x1e')]=qs[_0xa096('0x1e')](_0x267a82[_0xa096('0x30')][_0xa096('0x1e')]);_0x394e66['offset']=qs['offset'](_0x267a82['query'][_0xa096('0x1c')]);}return _0x57f9bb[_0xa096('0x51')](_0x394e66);}})['then'](function(_0x45ed82){if(_0x45ed82){return _0x45ed82?{'count':_0x4edbf1,'rows':_0x45ed82}:null;}})[_0xa096('0x25')](respondWithResult(_0x1d0765,null))[_0xa096('0x45')](handleError(_0x1d0765,null));};exports['setTags']=function(_0x1b78ed,_0xce1f3b,_0x3cf58b){if(_0x1b78ed['body']['id']){delete _0x1b78ed[_0xa096('0x4a')]['id'];}return db[_0xa096('0x41')][_0xa096('0x4e')]({'where':{'id':_0x1b78ed[_0xa096('0x47')]['id']}})[_0xa096('0x25')](handleEntityNotFound(_0xce1f3b,null))['then'](function(_0x5129b2){if(_0x5129b2){return _0x5129b2[_0xa096('0x53')](_0x1b78ed['body'][_0xa096('0x54')]||[]);}return null;})[_0xa096('0x25')](respondWithResult(_0xce1f3b,null))[_0xa096('0x45')](handleError(_0xce1f3b,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 84de555..6623546 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 _0x5c00=['moment','request-promise','path','rimraf','../../config/environment','exports','define','int_zendesk_configurations','lodash','util','../../config/logger'];(function(_0x529526,_0x2b98de){var _0x3606de=function(_0x3ca40e){while(--_0x3ca40e){_0x529526['push'](_0x529526['shift']());}};_0x3606de(++_0x2b98de);}(_0x5c00,0x17e));var _0x05c0=function(_0x19cd29,_0x1ac3e7){_0x19cd29=_0x19cd29-0x0;var _0x27c96d=_0x5c00[_0x19cd29];return _0x27c96d;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var logger=require(_0x05c0('0x2'))('api');var moment=require(_0x05c0('0x3'));var BPromise=require('bluebird');var rp=require(_0x05c0('0x4'));var fs=require('fs');var path=require(_0x05c0('0x5'));var rimraf=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x05c0('0x8')]=function(_0x3521fe,_0x261624){return _0x3521fe[_0x05c0('0x9')]('ZendeskConfiguration',attributes,{'tableName':_0x05c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f66=['request-promise','path','../../config/environment','exports','ZendeskConfiguration','int_zendesk_configurations','util','api','moment','bluebird'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'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 diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index ae48189..fe65be2 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 _0xc556=['then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request'];(function(_0x2bed2c,_0x4b9a60){var _0x174f26=function(_0x205c65){while(--_0x205c65){_0x2bed2c['push'](_0x2bed2c['shift']());}};_0x174f26(++_0x4b9a60);}(_0xc556,0x11b));var _0x6c55=function(_0x1034bb,_0x4e20b3){_0x1034bb=_0x1034bb-0x0;var _0x453fdb=_0xc556[_0x1034bb];return _0x453fdb;};'use strict';var _=require('lodash');var util=require(_0x6c55('0x0'));var moment=require(_0x6c55('0x1'));var BPromise=require(_0x6c55('0x2'));var rs=require(_0x6c55('0x3'));var fs=require('fs');var Redis=require(_0x6c55('0x4'));var db=require(_0x6c55('0x5'))['db'];var utils=require(_0x6c55('0x6'));var logger=require(_0x6c55('0x7'))('rpc');var config=require(_0x6c55('0x8'));var jayson=require(_0x6c55('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4819c0,_0x50ec95,_0x4a5d29){return new BPromise(function(_0x6801cd,_0x3f67ff){return client[_0x6c55('0xa')](_0x4819c0,_0x4a5d29)[_0x6c55('0xb')](function(_0x26349d){logger[_0x6c55('0xc')](_0x6c55('0xd'),_0x50ec95,_0x6c55('0xe'));logger[_0x6c55('0xf')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x50ec95,_0x6c55('0xe'),JSON[_0x6c55('0x10')](_0x26349d));if(_0x26349d[_0x6c55('0x11')]){if(_0x26349d['error']['code']===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x50ec95,_0x26349d['error'][_0x6c55('0x12')]);return _0x3f67ff(_0x26349d[_0x6c55('0x11')]['message']);}logger[_0x6c55('0x11')](_0x6c55('0xd'),_0x50ec95,_0x26349d[_0x6c55('0x11')][_0x6c55('0x12')]);return _0x6801cd(_0x26349d[_0x6c55('0x11')][_0x6c55('0x12')]);}else{logger[_0x6c55('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x50ec95,_0x6c55('0xe'));_0x6801cd(_0x26349d[_0x6c55('0x13')][_0x6c55('0x12')]);}})[_0x6c55('0x14')](function(_0x2e574c){logger[_0x6c55('0x11')](_0x6c55('0xd'),_0x50ec95,_0x2e574c);_0x3f67ff(_0x2e574c);});});} \ No newline at end of file +var _0x5846=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x2e0bfd,_0x27e787){var _0x202119=function(_0x5bc1f2){while(--_0x5bc1f2){_0x2e0bfd['push'](_0x2e0bfd['shift']());}};_0x202119(++_0x27e787);}(_0x5846,0x164));var _0x6584=function(_0x1e06e8,_0x48b51f){_0x1e06e8=_0x1e06e8-0x0;var _0x575039=_0x5846[_0x1e06e8];return _0x575039;};'use strict';var _=require(_0x6584('0x0'));var util=require(_0x6584('0x1'));var moment=require(_0x6584('0x2'));var BPromise=require('bluebird');var rs=require(_0x6584('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6584('0x4'))['db'];var utils=require(_0x6584('0x5'));var logger=require(_0x6584('0x6'))('rpc');var config=require(_0x6584('0x7'));var jayson=require(_0x6584('0x8'));var client=jayson[_0x6584('0x9')][_0x6584('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ec60b,_0x28d1a7,_0x5dd901){return new BPromise(function(_0x1c3c26,_0x3b8eba){return client[_0x6584('0xb')](_0x3ec60b,_0x5dd901)['then'](function(_0x1cba4e){logger[_0x6584('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x28d1a7,_0x6584('0xd'));logger[_0x6584('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x28d1a7,_0x6584('0xd'),JSON[_0x6584('0xf')](_0x1cba4e));if(_0x1cba4e[_0x6584('0x10')]){if(_0x1cba4e[_0x6584('0x10')]['code']===0x1f4){logger['error'](_0x6584('0x11'),_0x28d1a7,_0x1cba4e[_0x6584('0x10')][_0x6584('0x12')]);return _0x3b8eba(_0x1cba4e[_0x6584('0x10')]['message']);}logger[_0x6584('0x10')](_0x6584('0x11'),_0x28d1a7,_0x1cba4e['error'][_0x6584('0x12')]);return _0x1c3c26(_0x1cba4e['error'][_0x6584('0x12')]);}else{logger['info'](_0x6584('0x11'),_0x28d1a7,_0x6584('0xd'));_0x1c3c26(_0x1cba4e[_0x6584('0x13')][_0x6584('0x12')]);}})[_0x6584('0x14')](function(_0x5614aa){logger[_0x6584('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x28d1a7,_0x5614aa);_0x3b8eba(_0x5614aa);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 90ddef8..e8f9452 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 _0xa8dc=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','multer','util','path','express'];(function(_0xc4d76d,_0x216adb){var _0x10eb09=function(_0x46e2e4){while(--_0x46e2e4){_0xc4d76d['push'](_0xc4d76d['shift']());}};_0x10eb09(++_0x216adb);}(_0xa8dc,0xce));var _0xca8d=function(_0x483e50,_0xf30714){_0x483e50=_0x483e50-0x0;var _0x4e3456=_0xa8dc[_0x483e50];return _0x4e3456;};'use strict';var multer=require(_0xca8d('0x0'));var util=require(_0xca8d('0x1'));var path=require(_0xca8d('0x2'));var timeout=require('connect-timeout');var express=require(_0xca8d('0x3'));var router=express[_0xca8d('0x4')]();var fs_extra=require(_0xca8d('0x5'));var auth=require(_0xca8d('0x6'));var interaction=require(_0xca8d('0x7'));var config=require(_0xca8d('0x8'));var controller=require(_0xca8d('0x9'));router['get']('/',auth[_0xca8d('0xa')](),controller[_0xca8d('0xb')]);router[_0xca8d('0xc')](_0xca8d('0xd'),auth[_0xca8d('0xa')](),controller[_0xca8d('0xe')]);router[_0xca8d('0xf')]('/',auth['isAuthenticated'](),controller[_0xca8d('0x10')]);router[_0xca8d('0x11')](_0xca8d('0xd'),auth[_0xca8d('0xa')](),controller[_0xca8d('0x12')]);router[_0xca8d('0x13')]('/:id',auth[_0xca8d('0xa')](),controller[_0xca8d('0x14')]);module['exports']=router; \ No newline at end of file +var _0x321f=['put','/:id','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','show','post'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0x321f,0x184));var _0xf321=function(_0x449607,_0x287561){_0x449607=_0x449607-0x0;var _0x972d5=_0x321f[_0x449607];return _0x972d5;};'use strict';var multer=require(_0xf321('0x0'));var util=require(_0xf321('0x1'));var path=require(_0xf321('0x2'));var timeout=require('connect-timeout');var express=require(_0xf321('0x3'));var router=express[_0xf321('0x4')]();var fs_extra=require(_0xf321('0x5'));var auth=require(_0xf321('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZendeskField.controller');router['get']('/',auth[_0xf321('0x7')](),controller[_0xf321('0x8')]);router[_0xf321('0x9')]('/:id',auth[_0xf321('0x7')](),controller[_0xf321('0xa')]);router[_0xf321('0xb')]('/',auth[_0xf321('0x7')](),controller['create']);router[_0xf321('0xc')](_0xf321('0xd'),auth['isAuthenticated'](),controller[_0xf321('0xe')]);router['delete'](_0xf321('0xd'),auth[_0xf321('0x7')](),controller['destroy']);module[_0xf321('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 15a3925..12b645d 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 _0x610e=['customVariable','keyValue','picklist','string','STRING','ENUM','variable','BOOLEAN','sequelize','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x610e,0x1f2));var _0xe610=function(_0x38cd90,_0x4a5c49){_0x38cd90=_0x38cd90-0x0;var _0x5ebe32=_0x610e[_0x38cd90];return _0x5ebe32;};'use strict';var Sequelize=require(_0xe610('0x0'));module[_0xe610('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0xe610('0x2'),_0xe610('0x3'),_0xe610('0x4')),'defaultValue':_0xe610('0x5')},'content':{'type':Sequelize[_0xe610('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe610('0x7')]('string',_0xe610('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0xe610('0x6')]},'idField':{'type':Sequelize[_0xe610('0x6')]},'nameField':{'type':Sequelize[_0xe610('0x6')]},'customField':{'type':Sequelize[_0xe610('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x997c=['picklist','string','STRING','customVariable','BOOLEAN','exports','ENUM','variable','keyValue'];(function(_0x4ffb61,_0xb28aac){var _0x37f3c4=function(_0x18dd3f){while(--_0x18dd3f){_0x4ffb61['push'](_0x4ffb61['shift']());}};_0x37f3c4(++_0xb28aac);}(_0x997c,0x137));var _0xc997=function(_0x1d11e,_0x16c11b){_0x1d11e=_0x1d11e-0x0;var _0x21c30e=_0x997c[_0x1d11e];return _0x21c30e;};'use strict';var Sequelize=require('sequelize');module[_0xc997('0x0')]={'type':{'type':Sequelize[_0xc997('0x1')]('string',_0xc997('0x2'),'customVariable',_0xc997('0x3'),_0xc997('0x4')),'defaultValue':_0xc997('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc997('0x6')]},'keyType':{'type':Sequelize[_0xc997('0x1')](_0xc997('0x5'),_0xc997('0x2'),_0xc997('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xc997('0x6')]},'customField':{'type':Sequelize[_0xc997('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 8bd5005..a22dfdf 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 _0xd45b=['find','create','body','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','sort','where','filter','type','VIRTUAL','merge','ZendeskField','includeAll','include','rows','catch','params','options'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xd45b,0x11f));var _0xbd45=function(_0x5d3c2c,_0x4f8f8d){_0x5d3c2c=_0x5d3c2c-0x0;var _0x116df2=_0xd45b[_0x5d3c2c];return _0x116df2;};'use strict';var emlformat=require(_0xbd45('0x0'));var rimraf=require(_0xbd45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbd45('0x2'));var moment=require(_0xbd45('0x3'));var BPromise=require(_0xbd45('0x4'));var Mustache=require('mustache');var util=require(_0xbd45('0x5'));var path=require(_0xbd45('0x6'));var sox=require(_0xbd45('0x7'));var csv=require(_0xbd45('0x8'));var ejs=require(_0xbd45('0x9'));var fs=require('fs');var fs_extra=require(_0xbd45('0xa'));var _=require(_0xbd45('0xb'));var squel=require(_0xbd45('0xc'));var crypto=require('crypto');var jsforce=require(_0xbd45('0xd'));var deskjs=require(_0xbd45('0xe'));var toCsv=require(_0xbd45('0x8'));var querystring=require(_0xbd45('0xf'));var Papa=require('papaparse');var Redis=require(_0xbd45('0x10'));var authService=require(_0xbd45('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd45('0x12'));var logger=require(_0xbd45('0x13'))(_0xbd45('0x14'));var utils=require(_0xbd45('0x15'));var config=require(_0xbd45('0x16'));var licenseUtil=require(_0xbd45('0x17'));var db=require(_0xbd45('0x18'))['db'];function respondWithStatusCode(_0x9e2aab,_0x5903fc){_0x5903fc=_0x5903fc||0xcc;return function(_0x460d8c){if(_0x460d8c){return _0x9e2aab[_0xbd45('0x19')](_0x5903fc);}return _0x9e2aab[_0xbd45('0x1a')](_0x5903fc)['end']();};}function respondWithResult(_0x143bfb,_0x1fa426){_0x1fa426=_0x1fa426||0xc8;return function(_0x3fe212){if(_0x3fe212){return _0x143bfb[_0xbd45('0x1a')](_0x1fa426)['json'](_0x3fe212);}};}function respondWithFilteredResult(_0x67a704,_0x566efd){return function(_0x346a1e){if(_0x346a1e){var _0x22d361=typeof _0x566efd['offset']===_0xbd45('0x1b')&&typeof _0x566efd[_0xbd45('0x1c')]===_0xbd45('0x1b');var _0x51e0e1=_0x346a1e[_0xbd45('0x1d')];var _0x467795=_0x22d361?0x0:_0x566efd[_0xbd45('0x1e')];var _0x36457f=_0x22d361?_0x346a1e[_0xbd45('0x1d')]:_0x566efd['offset']+_0x566efd[_0xbd45('0x1c')];var _0xb0c281;if(_0x36457f>=_0x51e0e1){_0x36457f=_0x51e0e1;_0xb0c281=0xc8;}else{_0xb0c281=0xce;}_0x67a704[_0xbd45('0x1a')](_0xb0c281);return _0x67a704[_0xbd45('0x1f')](_0xbd45('0x20'),_0x467795+'-'+_0x36457f+'/'+_0x51e0e1)[_0xbd45('0x21')](_0x346a1e);}return null;};}function patchUpdates(_0x55e8ee){return function(_0x56f138){try{jsonpatch['apply'](_0x56f138,_0x55e8ee,!![]);}catch(_0x1a1451){return BPromise['reject'](_0x1a1451);}return _0x56f138[_0xbd45('0x22')]();};}function saveUpdates(_0x2f3c9f,_0x4d2884){return function(_0x2d6577){if(_0x2d6577){return _0x2d6577[_0xbd45('0x23')](_0x2f3c9f)[_0xbd45('0x24')](function(_0x277a71){return _0x277a71;});}return null;};}function removeEntity(_0x26b8e0,_0x4f864d){return function(_0x2a376a){if(_0x2a376a){return _0x2a376a[_0xbd45('0x25')]()[_0xbd45('0x24')](function(){_0x26b8e0[_0xbd45('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33efe9,_0x163512){return function(_0xdf11cf){if(!_0xdf11cf){_0x33efe9[_0xbd45('0x19')](0x194);}return _0xdf11cf;};}function handleError(_0x39aeb7,_0x50f5fa){_0x50f5fa=_0x50f5fa||0x1f4;return function(_0x5f1428){logger[_0xbd45('0x26')](_0x5f1428['stack']);if(_0x5f1428['name']){delete _0x5f1428[_0xbd45('0x27')];}_0x39aeb7[_0xbd45('0x1a')](_0x50f5fa)[_0xbd45('0x28')](_0x5f1428);};}exports[_0xbd45('0x29')]=function(_0x4a8b12,_0x3d9959){var _0x43ac01={},_0x1f5798={},_0x436149={'count':0x0,'rows':[]};var _0xc46e47=_[_0xbd45('0x2a')](db['ZendeskField'][_0xbd45('0x2b')],function(_0x37655f){return{'name':_0x37655f[_0xbd45('0x2c')],'type':_0x37655f['type'][_0xbd45('0x2d')]};});_0x1f5798['model']=_[_0xbd45('0x2a')](_0xc46e47,_0xbd45('0x27'));_0x1f5798[_0xbd45('0x2e')]=_[_0xbd45('0x2f')](_0x4a8b12['query']);_0x1f5798[_0xbd45('0x30')]=_[_0xbd45('0x31')](_0x1f5798[_0xbd45('0x32')],_0x1f5798['query']);_0x43ac01[_0xbd45('0x33')]=_['intersection'](_0x1f5798[_0xbd45('0x32')],qs[_0xbd45('0x34')](_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x34')]));_0x43ac01[_0xbd45('0x33')]=_0x43ac01[_0xbd45('0x33')][_0xbd45('0x35')]?_0x43ac01[_0xbd45('0x33')]:_0x1f5798[_0xbd45('0x32')];if(!_0x4a8b12['query']['hasOwnProperty'](_0xbd45('0x36'))){_0x43ac01['limit']=qs[_0xbd45('0x1c')](_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x1c')]);_0x43ac01[_0xbd45('0x1e')]=qs[_0xbd45('0x1e')](_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x1e')]);}_0x43ac01['order']=qs[_0xbd45('0x37')](_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x37')]);_0x43ac01[_0xbd45('0x38')]=qs[_0xbd45('0x30')](_['pick'](_0x4a8b12[_0xbd45('0x2e')],_0x1f5798[_0xbd45('0x30')]),_0xc46e47);if(_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x39')]){_0x43ac01[_0xbd45('0x38')]=_['merge'](_0x43ac01[_0xbd45('0x38')],{'$or':_[_0xbd45('0x2a')](_0xc46e47,function(_0x4c8f27){if(_0x4c8f27[_0xbd45('0x3a')]!==_0xbd45('0x3b')){var _0x154cb7={};_0x154cb7[_0x4c8f27['name']]={'$like':'%'+_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x39')]+'%'};return _0x154cb7;}})});}_0x43ac01=_[_0xbd45('0x3c')]({},_0x43ac01,_0x4a8b12['options']);var _0x200cd9={'where':_0x43ac01[_0xbd45('0x38')]};return db[_0xbd45('0x3d')]['count'](_0x200cd9)[_0xbd45('0x24')](function(_0x4a9c63){_0x436149[_0xbd45('0x1d')]=_0x4a9c63;if(_0x4a8b12[_0xbd45('0x2e')][_0xbd45('0x3e')]){_0x43ac01[_0xbd45('0x3f')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x43ac01);})['then'](function(_0x111e85){_0x436149[_0xbd45('0x40')]=_0x111e85;return _0x436149;})[_0xbd45('0x24')](respondWithFilteredResult(_0x3d9959,_0x43ac01))[_0xbd45('0x41')](handleError(_0x3d9959,null));};exports['show']=function(_0x4dd69e,_0x46bd14){var _0x53b291={'raw':!![],'where':{'id':_0x4dd69e[_0xbd45('0x42')]['id']}},_0x4a4f82={};_0x4a4f82[_0xbd45('0x32')]=_[_0xbd45('0x2f')](db[_0xbd45('0x3d')][_0xbd45('0x2b')]);_0x4a4f82['query']=_[_0xbd45('0x2f')](_0x4dd69e['query']);_0x4a4f82[_0xbd45('0x30')]=_[_0xbd45('0x31')](_0x4a4f82['model'],_0x4a4f82[_0xbd45('0x2e')]);_0x53b291[_0xbd45('0x33')]=_[_0xbd45('0x31')](_0x4a4f82[_0xbd45('0x32')],qs[_0xbd45('0x34')](_0x4dd69e[_0xbd45('0x2e')]['fields']));_0x53b291['attributes']=_0x53b291['attributes'][_0xbd45('0x35')]?_0x53b291[_0xbd45('0x33')]:_0x4a4f82[_0xbd45('0x32')];if(_0x4dd69e[_0xbd45('0x2e')]['includeAll']){_0x53b291[_0xbd45('0x3f')]=[{'all':!![]}];}_0x53b291=_[_0xbd45('0x3c')]({},_0x53b291,_0x4dd69e[_0xbd45('0x43')]);return db[_0xbd45('0x3d')][_0xbd45('0x44')](_0x53b291)[_0xbd45('0x24')](handleEntityNotFound(_0x46bd14,null))['then'](respondWithResult(_0x46bd14,null))[_0xbd45('0x41')](handleError(_0x46bd14,null));};exports['create']=function(_0x563342,_0x9d12be){return db[_0xbd45('0x3d')][_0xbd45('0x45')](_0x563342[_0xbd45('0x46')],{})[_0xbd45('0x24')](respondWithResult(_0x9d12be,0xc9))[_0xbd45('0x41')](handleError(_0x9d12be,null));};exports[_0xbd45('0x23')]=function(_0x4d9c3a,_0x140a09){if(_0x4d9c3a[_0xbd45('0x46')]['id']){delete _0x4d9c3a[_0xbd45('0x46')]['id'];}return db[_0xbd45('0x3d')][_0xbd45('0x44')]({'where':{'id':_0x4d9c3a[_0xbd45('0x42')]['id']}})['then'](handleEntityNotFound(_0x140a09,null))[_0xbd45('0x24')](saveUpdates(_0x4d9c3a[_0xbd45('0x46')],null))[_0xbd45('0x24')](respondWithResult(_0x140a09,null))[_0xbd45('0x41')](handleError(_0x140a09,null));};exports[_0xbd45('0x25')]=function(_0x3d2955,_0x4e2ab8){return db[_0xbd45('0x3d')]['find']({'where':{'id':_0x3d2955[_0xbd45('0x42')]['id']}})['then'](handleEntityNotFound(_0x4e2ab8,null))[_0xbd45('0x24')](removeEntity(_0x4e2ab8,null))[_0xbd45('0x41')](handleError(_0x4e2ab8,null));}; \ No newline at end of file +var _0x87f8=['status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','send','index','map','ZendeskField','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','catch','show','rawAttributes','options','find','create','body','params','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus'];(function(_0xd556f2,_0x4ce13b){var _0x2b2b7c=function(_0x52c943){while(--_0x52c943){_0xd556f2['push'](_0xd556f2['shift']());}};_0x2b2b7c(++_0x4ce13b);}(_0x87f8,0x152));var _0x887f=function(_0x54cab3,_0x348915){_0x54cab3=_0x54cab3-0x0;var _0xbff427=_0x87f8[_0x54cab3];return _0xbff427;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x887f('0x0'));var rp=require(_0x887f('0x1'));var moment=require('moment');var BPromise=require(_0x887f('0x2'));var Mustache=require('mustache');var util=require(_0x887f('0x3'));var path=require(_0x887f('0x4'));var sox=require(_0x887f('0x5'));var csv=require(_0x887f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x887f('0x7'));var _=require(_0x887f('0x8'));var squel=require(_0x887f('0x9'));var crypto=require(_0x887f('0xa'));var jsforce=require(_0x887f('0xb'));var deskjs=require(_0x887f('0xc'));var toCsv=require(_0x887f('0x6'));var querystring=require('querystring');var Papa=require(_0x887f('0xd'));var Redis=require('ioredis');var authService=require(_0x887f('0xe'));var qs=require(_0x887f('0xf'));var as=require(_0x887f('0x10'));var hardwareService=require(_0x887f('0x11'));var logger=require('../../config/logger')(_0x887f('0x12'));var utils=require(_0x887f('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x887f('0x14'))['db'];function respondWithStatusCode(_0x32b6c4,_0x32e050){_0x32e050=_0x32e050||0xcc;return function(_0x589e92){if(_0x589e92){return _0x32b6c4[_0x887f('0x15')](_0x32e050);}return _0x32b6c4[_0x887f('0x16')](_0x32e050)['end']();};}function respondWithResult(_0x16bbc4,_0x58152e){_0x58152e=_0x58152e||0xc8;return function(_0x59b7ab){if(_0x59b7ab){return _0x16bbc4[_0x887f('0x16')](_0x58152e)[_0x887f('0x17')](_0x59b7ab);}};}function respondWithFilteredResult(_0x59ed6c,_0x3f189a){return function(_0xf69779){if(_0xf69779){var _0x9f5d78=typeof _0x3f189a['offset']===_0x887f('0x18')&&typeof _0x3f189a[_0x887f('0x19')]==='undefined';var _0x2e8999=_0xf69779[_0x887f('0x1a')];var _0x3ab397=_0x9f5d78?0x0:_0x3f189a[_0x887f('0x1b')];var _0x2399a5=_0x9f5d78?_0xf69779[_0x887f('0x1a')]:_0x3f189a[_0x887f('0x1b')]+_0x3f189a[_0x887f('0x19')];var _0x342e8e;if(_0x2399a5>=_0x2e8999){_0x2399a5=_0x2e8999;_0x342e8e=0xc8;}else{_0x342e8e=0xce;}_0x59ed6c[_0x887f('0x16')](_0x342e8e);return _0x59ed6c[_0x887f('0x1c')](_0x887f('0x1d'),_0x3ab397+'-'+_0x2399a5+'/'+_0x2e8999)[_0x887f('0x17')](_0xf69779);}return null;};}function patchUpdates(_0x4deddd){return function(_0x129106){try{jsonpatch[_0x887f('0x1e')](_0x129106,_0x4deddd,!![]);}catch(_0x49af51){return BPromise[_0x887f('0x1f')](_0x49af51);}return _0x129106[_0x887f('0x20')]();};}function saveUpdates(_0x48fd49,_0xc09608){return function(_0x56beaa){if(_0x56beaa){return _0x56beaa[_0x887f('0x21')](_0x48fd49)[_0x887f('0x22')](function(_0x566fb9){return _0x566fb9;});}return null;};}function removeEntity(_0x338777,_0x3af68e){return function(_0x3d6948){if(_0x3d6948){return _0x3d6948[_0x887f('0x23')]()['then'](function(){_0x338777[_0x887f('0x16')](0xcc)[_0x887f('0x24')]();});}};}function handleEntityNotFound(_0x5c7f41,_0x1a1657){return function(_0x42c8bd){if(!_0x42c8bd){_0x5c7f41['sendStatus'](0x194);}return _0x42c8bd;};}function handleError(_0x1811e6,_0x7eef96){_0x7eef96=_0x7eef96||0x1f4;return function(_0x108890){logger['error'](_0x108890[_0x887f('0x25')]);if(_0x108890['name']){delete _0x108890['name'];}_0x1811e6[_0x887f('0x16')](_0x7eef96)[_0x887f('0x26')](_0x108890);};}exports[_0x887f('0x27')]=function(_0x2f20ce,_0x1c5ce3){var _0x4e1fe1={},_0x59d489={},_0x4238e0={'count':0x0,'rows':[]};var _0xca31ec=_[_0x887f('0x28')](db[_0x887f('0x29')]['rawAttributes'],function(_0x39a9ce){return{'name':_0x39a9ce['fieldName'],'type':_0x39a9ce[_0x887f('0x2a')]['key']};});_0x59d489[_0x887f('0x2b')]=_[_0x887f('0x28')](_0xca31ec,_0x887f('0x2c'));_0x59d489[_0x887f('0x2d')]=_[_0x887f('0x2e')](_0x2f20ce[_0x887f('0x2d')]);_0x59d489[_0x887f('0x2f')]=_[_0x887f('0x30')](_0x59d489['model'],_0x59d489[_0x887f('0x2d')]);_0x4e1fe1[_0x887f('0x31')]=_[_0x887f('0x30')](_0x59d489[_0x887f('0x2b')],qs[_0x887f('0x32')](_0x2f20ce[_0x887f('0x2d')]['fields']));_0x4e1fe1[_0x887f('0x31')]=_0x4e1fe1[_0x887f('0x31')][_0x887f('0x33')]?_0x4e1fe1[_0x887f('0x31')]:_0x59d489[_0x887f('0x2b')];if(!_0x2f20ce['query'][_0x887f('0x34')](_0x887f('0x35'))){_0x4e1fe1['limit']=qs[_0x887f('0x19')](_0x2f20ce[_0x887f('0x2d')][_0x887f('0x19')]);_0x4e1fe1['offset']=qs[_0x887f('0x1b')](_0x2f20ce[_0x887f('0x2d')][_0x887f('0x1b')]);}_0x4e1fe1[_0x887f('0x36')]=qs['sort'](_0x2f20ce[_0x887f('0x2d')][_0x887f('0x37')]);_0x4e1fe1['where']=qs['filters'](_[_0x887f('0x38')](_0x2f20ce[_0x887f('0x2d')],_0x59d489[_0x887f('0x2f')]),_0xca31ec);if(_0x2f20ce['query'][_0x887f('0x39')]){_0x4e1fe1['where']=_['merge'](_0x4e1fe1[_0x887f('0x3a')],{'$or':_[_0x887f('0x28')](_0xca31ec,function(_0x436486){if(_0x436486['type']!==_0x887f('0x3b')){var _0xc2df3b={};_0xc2df3b[_0x436486[_0x887f('0x2c')]]={'$like':'%'+_0x2f20ce['query'][_0x887f('0x39')]+'%'};return _0xc2df3b;}})});}_0x4e1fe1=_[_0x887f('0x3c')]({},_0x4e1fe1,_0x2f20ce['options']);var _0x4022fa={'where':_0x4e1fe1[_0x887f('0x3a')]};return db[_0x887f('0x29')][_0x887f('0x1a')](_0x4022fa)[_0x887f('0x22')](function(_0xd6bf57){_0x4238e0['count']=_0xd6bf57;if(_0x2f20ce[_0x887f('0x2d')][_0x887f('0x3d')]){_0x4e1fe1[_0x887f('0x3e')]=[{'all':!![]}];}return db[_0x887f('0x29')][_0x887f('0x3f')](_0x4e1fe1);})[_0x887f('0x22')](function(_0x2be724){_0x4238e0['rows']=_0x2be724;return _0x4238e0;})[_0x887f('0x22')](respondWithFilteredResult(_0x1c5ce3,_0x4e1fe1))[_0x887f('0x40')](handleError(_0x1c5ce3,null));};exports[_0x887f('0x41')]=function(_0x34594a,_0x55e700){var _0x134f2e={'raw':!![],'where':{'id':_0x34594a['params']['id']}},_0x79cf46={};_0x79cf46[_0x887f('0x2b')]=_['keys'](db['ZendeskField'][_0x887f('0x42')]);_0x79cf46[_0x887f('0x2d')]=_[_0x887f('0x2e')](_0x34594a[_0x887f('0x2d')]);_0x79cf46[_0x887f('0x2f')]=_[_0x887f('0x30')](_0x79cf46['model'],_0x79cf46[_0x887f('0x2d')]);_0x134f2e[_0x887f('0x31')]=_[_0x887f('0x30')](_0x79cf46[_0x887f('0x2b')],qs[_0x887f('0x32')](_0x34594a[_0x887f('0x2d')][_0x887f('0x32')]));_0x134f2e[_0x887f('0x31')]=_0x134f2e[_0x887f('0x31')][_0x887f('0x33')]?_0x134f2e['attributes']:_0x79cf46[_0x887f('0x2b')];if(_0x34594a[_0x887f('0x2d')][_0x887f('0x3d')]){_0x134f2e['include']=[{'all':!![]}];}_0x134f2e=_[_0x887f('0x3c')]({},_0x134f2e,_0x34594a[_0x887f('0x43')]);return db['ZendeskField'][_0x887f('0x44')](_0x134f2e)[_0x887f('0x22')](handleEntityNotFound(_0x55e700,null))[_0x887f('0x22')](respondWithResult(_0x55e700,null))[_0x887f('0x40')](handleError(_0x55e700,null));};exports[_0x887f('0x45')]=function(_0xbd961e,_0x22b11f){return db['ZendeskField']['create'](_0xbd961e[_0x887f('0x46')],{})[_0x887f('0x22')](respondWithResult(_0x22b11f,0xc9))['catch'](handleError(_0x22b11f,null));};exports[_0x887f('0x21')]=function(_0x3fcd12,_0x2bdd65){if(_0x3fcd12[_0x887f('0x46')]['id']){delete _0x3fcd12[_0x887f('0x46')]['id'];}return db[_0x887f('0x29')]['find']({'where':{'id':_0x3fcd12['params']['id']}})[_0x887f('0x22')](handleEntityNotFound(_0x2bdd65,null))['then'](saveUpdates(_0x3fcd12[_0x887f('0x46')],null))['then'](respondWithResult(_0x2bdd65,null))[_0x887f('0x40')](handleError(_0x2bdd65,null));};exports[_0x887f('0x23')]=function(_0x32e630,_0x417c8d){return db[_0x887f('0x29')]['find']({'where':{'id':_0x32e630[_0x887f('0x47')]['id']}})[_0x887f('0x22')](handleEntityNotFound(_0x417c8d,null))[_0x887f('0x22')](removeEntity(_0x417c8d,null))[_0x887f('0x40')](handleError(_0x417c8d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 2d04cf5..7b8d1bc 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 _0xb176=['ZendeskField','zendesk_unique_index','idField','FieldId','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','define'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xb176,0x74));var _0x6b17=function(_0x36f47c,_0x38ef4d){_0x36f47c=_0x36f47c-0x0;var _0x296c55=_0xb176[_0x36f47c];return _0x296c55;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6b17('0x0'))(_0x6b17('0x1'));var moment=require(_0x6b17('0x2'));var BPromise=require(_0x6b17('0x3'));var rp=require(_0x6b17('0x4'));var fs=require('fs');var path=require(_0x6b17('0x5'));var rimraf=require('rimraf');var config=require(_0x6b17('0x6'));var attributes=require(_0x6b17('0x7'));module[_0x6b17('0x8')]=function(_0x5265d2,_0x2db88f){return _0x5265d2[_0x6b17('0x9')](_0x6b17('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x6b17('0xb'),'fields':[_0x6b17('0xc'),_0x6b17('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdf86=['../../config/logger','moment','bluebird','request-promise','rimraf','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util'];(function(_0x33e8e7,_0x3510f9){var _0x1c1877=function(_0x457356){while(--_0x457356){_0x33e8e7['push'](_0x33e8e7['shift']());}};_0x1c1877(++_0x3510f9);}(_0xdf86,0xd0));var _0x6df8=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xdf86[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x6df8('0x0'));var util=require(_0x6df8('0x1'));var logger=require(_0x6df8('0x2'))('api');var moment=require(_0x6df8('0x3'));var BPromise=require(_0x6df8('0x4'));var rp=require(_0x6df8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6df8('0x6'));var config=require('../../config/environment');var attributes=require(_0x6df8('0x7'));module[_0x6df8('0x8')]=function(_0x7f39cf,_0x6385f6){return _0x7f39cf[_0x6df8('0x9')](_0x6df8('0xa'),attributes,{'tableName':_0x6df8('0xb'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x6df8('0xc'),_0x6df8('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 5343672..fcc9b6a 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 _0xd830=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','info','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x6a020a,_0x16fd42){var _0x161aa2=function(_0x4d6846){while(--_0x4d6846){_0x6a020a['push'](_0x6a020a['shift']());}};_0x161aa2(++_0x16fd42);}(_0xd830,0xaf));var _0x0d83=function(_0x26d567,_0x58c8b3){_0x26d567=_0x26d567-0x0;var _0x597464=_0xd830[_0x26d567];return _0x597464;};'use strict';var _=require(_0x0d83('0x0'));var util=require(_0x0d83('0x1'));var moment=require(_0x0d83('0x2'));var BPromise=require(_0x0d83('0x3'));var rs=require(_0x0d83('0x4'));var fs=require('fs');var Redis=require(_0x0d83('0x5'));var db=require(_0x0d83('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x0d83('0x7'));var config=require(_0x0d83('0x8'));var jayson=require(_0x0d83('0x9'));var client=jayson[_0x0d83('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x258e28,_0x5b14c4,_0x34549c){return new BPromise(function(_0x31cefa,_0x194166){return client[_0x0d83('0xb')](_0x258e28,_0x34549c)['then'](function(_0x3fc721){logger[_0x0d83('0xc')](_0x0d83('0xd'),_0x5b14c4,'request\x20sent');logger['debug'](_0x0d83('0xe'),_0x5b14c4,_0x0d83('0xf'),JSON[_0x0d83('0x10')](_0x3fc721));if(_0x3fc721[_0x0d83('0x11')]){if(_0x3fc721[_0x0d83('0x11')][_0x0d83('0x12')]===0x1f4){logger[_0x0d83('0x11')]('ZendeskField,\x20%s,\x20%s',_0x5b14c4,_0x3fc721[_0x0d83('0x11')][_0x0d83('0x13')]);return _0x194166(_0x3fc721['error'][_0x0d83('0x13')]);}logger['error'](_0x0d83('0xd'),_0x5b14c4,_0x3fc721[_0x0d83('0x11')][_0x0d83('0x13')]);return _0x31cefa(_0x3fc721[_0x0d83('0x11')][_0x0d83('0x13')]);}else{logger[_0x0d83('0xc')](_0x0d83('0xd'),_0x5b14c4,'request\x20sent');_0x31cefa(_0x3fc721[_0x0d83('0x14')][_0x0d83('0x13')]);}})[_0x0d83('0x15')](function(_0x4cb185){logger[_0x0d83('0x11')](_0x0d83('0xd'),_0x5b14c4,_0x4cb185);_0x194166(_0x4cb185);});});} \ No newline at end of file +var _0x028e=['ZendeskField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0x028e,0x1d3));var _0xe028=function(_0x21ae9f,_0xf88390){_0x21ae9f=_0x21ae9f-0x0;var _0x3d35ab=_0x028e[_0x21ae9f];return _0x3d35ab;};'use strict';var _=require('lodash');var util=require(_0xe028('0x0'));var moment=require(_0xe028('0x1'));var BPromise=require(_0xe028('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe028('0x3'));var db=require(_0xe028('0x4'))['db'];var utils=require(_0xe028('0x5'));var logger=require(_0xe028('0x6'))('rpc');var config=require(_0xe028('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe028('0x8')][_0xe028('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x545b1f,_0x1cf766,_0x45853f){return new BPromise(function(_0x477d10,_0x694246){return client[_0xe028('0xa')](_0x545b1f,_0x45853f)[_0xe028('0xb')](function(_0x2ee46a){logger['info']('ZendeskField,\x20%s,\x20%s',_0x1cf766,_0xe028('0xc'));logger[_0xe028('0xd')](_0xe028('0xe'),_0x1cf766,_0xe028('0xc'),JSON[_0xe028('0xf')](_0x2ee46a));if(_0x2ee46a['error']){if(_0x2ee46a['error']['code']===0x1f4){logger[_0xe028('0x10')](_0xe028('0x11'),_0x1cf766,_0x2ee46a[_0xe028('0x10')][_0xe028('0x12')]);return _0x694246(_0x2ee46a[_0xe028('0x10')][_0xe028('0x12')]);}logger[_0xe028('0x10')](_0xe028('0x11'),_0x1cf766,_0x2ee46a['error'][_0xe028('0x12')]);return _0x477d10(_0x2ee46a[_0xe028('0x10')]['message']);}else{logger[_0xe028('0x13')]('ZendeskField,\x20%s,\x20%s',_0x1cf766,'request\x20sent');_0x477d10(_0x2ee46a[_0xe028('0x14')]['message']);}})[_0xe028('0x15')](function(_0x1f915a){logger[_0xe028('0x10')]('ZendeskField,\x20%s,\x20%s',_0x1cf766,_0x1f915a);_0x694246(_0x1f915a);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 3b2833e..a9f226e 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 _0x3925=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','addConfiguration','put','update','delete','multer','util','path','connect-timeout'];(function(_0x1269dc,_0x5cc0bc){var _0x2a93fb=function(_0x2950e3){while(--_0x2950e3){_0x1269dc['push'](_0x1269dc['shift']());}};_0x2a93fb(++_0x5cc0bc);}(_0x3925,0x104));var _0x5392=function(_0x25c662,_0x2a558f){_0x25c662=_0x25c662-0x0;var _0x1389a1=_0x3925[_0x25c662];return _0x1389a1;};'use strict';var multer=require(_0x5392('0x0'));var util=require(_0x5392('0x1'));var path=require(_0x5392('0x2'));var timeout=require(_0x5392('0x3'));var express=require(_0x5392('0x4'));var router=express[_0x5392('0x5')]();var fs_extra=require(_0x5392('0x6'));var auth=require(_0x5392('0x7'));var interaction=require(_0x5392('0x8'));var config=require(_0x5392('0x9'));var controller=require(_0x5392('0xa'));router[_0x5392('0xb')]('/',auth[_0x5392('0xc')](),controller[_0x5392('0xd')]);router[_0x5392('0xb')](_0x5392('0xe'),auth[_0x5392('0xc')](),controller[_0x5392('0xf')]);router[_0x5392('0xb')](_0x5392('0x10'),auth['isAuthenticated'](),controller[_0x5392('0x11')]);router[_0x5392('0xb')]('/:id/fields',auth[_0x5392('0xc')](),controller[_0x5392('0x12')]);router[_0x5392('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5392('0x13')](_0x5392('0x10'),auth[_0x5392('0xc')](),controller[_0x5392('0x14')]);router[_0x5392('0x15')](_0x5392('0xe'),auth[_0x5392('0xc')](),controller[_0x5392('0x16')]);router[_0x5392('0x17')]('/:id',auth[_0x5392('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd548=['../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1c1cf9,_0xb580dc){var _0x48a315=function(_0x45675d){while(--_0x45675d){_0x1c1cf9['push'](_0x1c1cf9['shift']());}};_0x48a315(++_0xb580dc);}(_0xd548,0x16e));var _0x8d54=function(_0x5c3608,_0x19dc48){_0x5c3608=_0x5c3608-0x0;var _0xaf6056=_0xd548[_0x5c3608];return _0xaf6056;};'use strict';var multer=require(_0x8d54('0x0'));var util=require(_0x8d54('0x1'));var path=require(_0x8d54('0x2'));var timeout=require(_0x8d54('0x3'));var express=require(_0x8d54('0x4'));var router=express[_0x8d54('0x5')]();var fs_extra=require(_0x8d54('0x6'));var auth=require(_0x8d54('0x7'));var interaction=require(_0x8d54('0x8'));var config=require(_0x8d54('0x9'));var controller=require('./intZohoAccount.controller');router[_0x8d54('0xa')]('/',auth[_0x8d54('0xb')](),controller['index']);router[_0x8d54('0xa')](_0x8d54('0xc'),auth[_0x8d54('0xb')](),controller[_0x8d54('0xd')]);router[_0x8d54('0xa')](_0x8d54('0xe'),auth[_0x8d54('0xb')](),controller[_0x8d54('0xf')]);router[_0x8d54('0xa')](_0x8d54('0x10'),auth[_0x8d54('0xb')](),controller[_0x8d54('0x11')]);router[_0x8d54('0x12')]('/',auth[_0x8d54('0xb')](),controller[_0x8d54('0x13')]);router[_0x8d54('0x12')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x8d54('0x14')]);router[_0x8d54('0x15')](_0x8d54('0xc'),auth[_0x8d54('0xb')](),controller[_0x8d54('0x16')]);router[_0x8d54('0x17')](_0x8d54('0xc'),auth['isAuthenticated'](),controller[_0x8d54('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index af01fe7..fe79409 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 _0x702d=['sequelize','exports','STRING'];(function(_0x17b28b,_0x50a595){var _0x5aed68=function(_0x5005f3){while(--_0x5005f3){_0x17b28b['push'](_0x17b28b['shift']());}};_0x5aed68(++_0x50a595);}(_0x702d,0x147));var _0xd702=function(_0x4dedee,_0x16da92){_0x4dedee=_0x4dedee-0x0;var _0x1acb8f=_0x702d[_0x4dedee];return _0x1acb8f;};'use strict';var Sequelize=require(_0xd702('0x0'));module[_0xd702('0x1')]={'name':{'type':Sequelize[_0xd702('0x2')]},'description':{'type':Sequelize[_0xd702('0x2')]},'host':{'type':Sequelize[_0xd702('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd702('0x2')]},'clientSecret':{'type':Sequelize[_0xd702('0x2')]},'serverUrl':{'type':Sequelize[_0xd702('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xd702('0x2')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x008c=['exports','STRING','sequelize'];(function(_0x48deac,_0x4d8ab8){var _0x3b5eaa=function(_0x91c61e){while(--_0x91c61e){_0x48deac['push'](_0x48deac['shift']());}};_0x3b5eaa(++_0x4d8ab8);}(_0x008c,0x188));var _0xc008=function(_0x5ce34a,_0x57887e){_0x5ce34a=_0x5ce34a-0x0;var _0x309350=_0x008c[_0x5ce34a];return _0x309350;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'name':{'type':Sequelize[_0xc008('0x2')]},'description':{'type':Sequelize[_0xc008('0x2')]},'host':{'type':Sequelize[_0xc008('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xc008('0x2')]},'clientSecret':{'type':Sequelize[_0xc008('0x2')]},'serverUrl':{'type':Sequelize[_0xc008('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xc008('0x2')]},'refreshToken':{'type':Sequelize[_0xc008('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index cd1ab4a..920219c 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 _0x72e0=['host','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','undefined','limit','count','offset','set','json','apply','reject','update','destroy','then','error','send','map','ZohoAccount','rawAttributes','key','name','keys','intersection','model','query','attributes','fields','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','params','length','includeAll','include','find','create','body','getConfigurations','hasOwnProperty','findOne','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientSecret','serverUrl','code'];(function(_0x33e96a,_0x536f82){var _0x4d4c0d=function(_0x2f2f4b){while(--_0x2f2f4b){_0x33e96a['push'](_0x33e96a['shift']());}};_0x4d4c0d(++_0x536f82);}(_0x72e0,0x124));var _0x072e=function(_0x269bce,_0x8f7efd){_0x269bce=_0x269bce-0x0;var _0x2f6671=_0x72e0[_0x269bce];return _0x2f6671;};'use strict';var emlformat=require(_0x072e('0x0'));var rimraf=require(_0x072e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x072e('0x2'));var rp=require(_0x072e('0x3'));var moment=require(_0x072e('0x4'));var BPromise=require(_0x072e('0x5'));var Mustache=require(_0x072e('0x6'));var util=require(_0x072e('0x7'));var path=require('path');var sox=require(_0x072e('0x8'));var csv=require(_0x072e('0x9'));var ejs=require(_0x072e('0xa'));var fs=require('fs');var fs_extra=require(_0x072e('0xb'));var _=require(_0x072e('0xc'));var squel=require(_0x072e('0xd'));var crypto=require(_0x072e('0xe'));var jsforce=require(_0x072e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x072e('0x9'));var querystring=require(_0x072e('0x10'));var Papa=require(_0x072e('0x11'));var Redis=require(_0x072e('0x12'));var authService=require(_0x072e('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x072e('0x14'));var hardwareService=require(_0x072e('0x15'));var logger=require(_0x072e('0x16'))(_0x072e('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x072e('0x18'));var db=require(_0x072e('0x19'))['db'];var integrations=require(_0x072e('0x1a'));function respondWithStatusCode(_0x588b49,_0x200400){_0x200400=_0x200400||0xcc;return function(_0x3030d9){if(_0x3030d9){return _0x588b49[_0x072e('0x1b')](_0x200400);}return _0x588b49['status'](_0x200400)[_0x072e('0x1c')]();};}function respondWithResult(_0x3bd4f8,_0x35588c){_0x35588c=_0x35588c||0xc8;return function(_0x38e5a0){if(_0x38e5a0){return _0x3bd4f8[_0x072e('0x1d')](_0x35588c)['json'](_0x38e5a0);}};}function respondWithFilteredResult(_0x3b76c8,_0x19dd54){return function(_0x242b11){if(_0x242b11){var _0x2f5e51=typeof _0x19dd54['offset']===_0x072e('0x1e')&&typeof _0x19dd54[_0x072e('0x1f')]===_0x072e('0x1e');var _0x52edbc=_0x242b11[_0x072e('0x20')];var _0x56a681=_0x2f5e51?0x0:_0x19dd54['offset'];var _0x33c933=_0x2f5e51?_0x242b11['count']:_0x19dd54[_0x072e('0x21')]+_0x19dd54[_0x072e('0x1f')];var _0x1e6fb2;if(_0x33c933>=_0x52edbc){_0x33c933=_0x52edbc;_0x1e6fb2=0xc8;}else{_0x1e6fb2=0xce;}_0x3b76c8[_0x072e('0x1d')](_0x1e6fb2);return _0x3b76c8[_0x072e('0x22')]('Content-Range',_0x56a681+'-'+_0x33c933+'/'+_0x52edbc)[_0x072e('0x23')](_0x242b11);}return null;};}function patchUpdates(_0x2f1a28){return function(_0x8a7cd3){try{jsonpatch[_0x072e('0x24')](_0x8a7cd3,_0x2f1a28,!![]);}catch(_0x12271e){return BPromise[_0x072e('0x25')](_0x12271e);}return _0x8a7cd3['save']();};}function saveUpdates(_0x325b82,_0x2f2384){return function(_0x324894){if(_0x324894){return _0x324894[_0x072e('0x26')](_0x325b82)['then'](function(_0x110219){return _0x110219;});}return null;};}function removeEntity(_0x29afb6,_0x3587ec){return function(_0x271c22){if(_0x271c22){return _0x271c22[_0x072e('0x27')]()[_0x072e('0x28')](function(){_0x29afb6[_0x072e('0x1d')](0xcc)[_0x072e('0x1c')]();});}};}function handleEntityNotFound(_0x3dfee6,_0x271078){return function(_0x5b17f2){if(!_0x5b17f2){_0x3dfee6[_0x072e('0x1b')](0x194);}return _0x5b17f2;};}function handleError(_0x1fc5aa,_0x26b5cc){_0x26b5cc=_0x26b5cc||0x1f4;return function(_0x322bf9){logger[_0x072e('0x29')](_0x322bf9['stack']);if(_0x322bf9['name']){delete _0x322bf9['name'];}_0x1fc5aa[_0x072e('0x1d')](_0x26b5cc)[_0x072e('0x2a')](_0x322bf9);};}exports['index']=function(_0x3abc3e,_0x2d428a){var _0x5d7fb6={},_0x5e4045={},_0x242e2e={'count':0x0,'rows':[]};var _0x5ef83d=_[_0x072e('0x2b')](db[_0x072e('0x2c')][_0x072e('0x2d')],function(_0x4ffabe){return{'name':_0x4ffabe['fieldName'],'type':_0x4ffabe['type'][_0x072e('0x2e')]};});_0x5e4045['model']=_[_0x072e('0x2b')](_0x5ef83d,_0x072e('0x2f'));_0x5e4045['query']=_[_0x072e('0x30')](_0x3abc3e['query']);_0x5e4045['filters']=_[_0x072e('0x31')](_0x5e4045[_0x072e('0x32')],_0x5e4045[_0x072e('0x33')]);_0x5d7fb6[_0x072e('0x34')]=_[_0x072e('0x31')](_0x5e4045[_0x072e('0x32')],qs[_0x072e('0x35')](_0x3abc3e[_0x072e('0x33')][_0x072e('0x35')]));_0x5d7fb6[_0x072e('0x34')]=_0x5d7fb6[_0x072e('0x34')]['length']?_0x5d7fb6[_0x072e('0x34')]:_0x5e4045[_0x072e('0x32')];if(!_0x3abc3e['query']['hasOwnProperty']('nolimit')){_0x5d7fb6[_0x072e('0x1f')]=qs['limit'](_0x3abc3e[_0x072e('0x33')]['limit']);_0x5d7fb6['offset']=qs['offset'](_0x3abc3e[_0x072e('0x33')]['offset']);}_0x5d7fb6[_0x072e('0x36')]=qs[_0x072e('0x37')](_0x3abc3e[_0x072e('0x33')]['sort']);_0x5d7fb6['where']=qs[_0x072e('0x38')](_[_0x072e('0x39')](_0x3abc3e[_0x072e('0x33')],_0x5e4045[_0x072e('0x38')]),_0x5ef83d);if(_0x3abc3e[_0x072e('0x33')][_0x072e('0x3a')]){_0x5d7fb6[_0x072e('0x3b')]=_[_0x072e('0x3c')](_0x5d7fb6['where'],{'$or':_[_0x072e('0x2b')](_0x5ef83d,function(_0x26860f){if(_0x26860f['type']!==_0x072e('0x3d')){var _0xbfcdf0={};_0xbfcdf0[_0x26860f[_0x072e('0x2f')]]={'$like':'%'+_0x3abc3e[_0x072e('0x33')]['filter']+'%'};return _0xbfcdf0;}})});}_0x5d7fb6=_[_0x072e('0x3c')]({},_0x5d7fb6,_0x3abc3e[_0x072e('0x3e')]);var _0x5edaba={'where':_0x5d7fb6[_0x072e('0x3b')]};return db[_0x072e('0x2c')][_0x072e('0x20')](_0x5edaba)['then'](function(_0x48b0e3){_0x242e2e[_0x072e('0x20')]=_0x48b0e3;if(_0x3abc3e[_0x072e('0x33')]['includeAll']){_0x5d7fb6['include']=[{'all':!![]}];}return db[_0x072e('0x2c')][_0x072e('0x3f')](_0x5d7fb6);})[_0x072e('0x28')](function(_0xbd8337){_0x242e2e[_0x072e('0x40')]=_0xbd8337;return _0x242e2e;})[_0x072e('0x28')](respondWithFilteredResult(_0x2d428a,_0x5d7fb6))[_0x072e('0x41')](handleError(_0x2d428a,null));};exports[_0x072e('0x42')]=function(_0x334de1,_0x53138a){var _0x53d505={'raw':![],'where':{'id':_0x334de1[_0x072e('0x43')]['id']}},_0x40be61={};_0x40be61['model']=_[_0x072e('0x30')](db[_0x072e('0x2c')][_0x072e('0x2d')]);_0x40be61[_0x072e('0x33')]=_[_0x072e('0x30')](_0x334de1[_0x072e('0x33')]);_0x40be61[_0x072e('0x38')]=_['intersection'](_0x40be61[_0x072e('0x32')],_0x40be61[_0x072e('0x33')]);_0x53d505[_0x072e('0x34')]=_[_0x072e('0x31')](_0x40be61['model'],qs['fields'](_0x334de1[_0x072e('0x33')][_0x072e('0x35')]));_0x53d505['attributes']=_0x53d505[_0x072e('0x34')][_0x072e('0x44')]?_0x53d505['attributes']:_0x40be61[_0x072e('0x32')];if(_0x334de1[_0x072e('0x33')][_0x072e('0x45')]){_0x53d505[_0x072e('0x46')]=[{'all':!![]}];}_0x53d505=_[_0x072e('0x3c')]({},_0x53d505,_0x334de1[_0x072e('0x3e')]);return db[_0x072e('0x2c')][_0x072e('0x47')](_0x53d505)[_0x072e('0x28')](handleEntityNotFound(_0x53138a,null))[_0x072e('0x28')](respondWithResult(_0x53138a,null))[_0x072e('0x41')](handleError(_0x53138a,null));};exports[_0x072e('0x48')]=function(_0x3e7ce9,_0x3ce3e0){return db[_0x072e('0x2c')]['create'](_0x3e7ce9[_0x072e('0x49')],{})[_0x072e('0x28')](respondWithResult(_0x3ce3e0,0xc9))[_0x072e('0x41')](handleError(_0x3ce3e0,null));};exports[_0x072e('0x26')]=function(_0x569d31,_0x8d38e5){if(_0x569d31['body']['id']){delete _0x569d31[_0x072e('0x49')]['id'];}return db[_0x072e('0x2c')][_0x072e('0x47')]({'where':{'id':_0x569d31[_0x072e('0x43')]['id']}})['then'](handleEntityNotFound(_0x8d38e5,null))[_0x072e('0x28')](saveUpdates(_0x569d31[_0x072e('0x49')],null))['then'](respondWithResult(_0x8d38e5,null))['catch'](handleError(_0x8d38e5,null));};exports['destroy']=function(_0x25b452,_0x1938fc){return db[_0x072e('0x2c')][_0x072e('0x47')]({'where':{'id':_0x25b452[_0x072e('0x43')]['id']}})['then'](handleEntityNotFound(_0x1938fc,null))[_0x072e('0x28')](removeEntity(_0x1938fc,null))[_0x072e('0x41')](handleError(_0x1938fc,null));};exports[_0x072e('0x4a')]=function(_0x2795cb,_0x493371,_0x5c52fa){var _0xc556f3={};var _0x20fa1f={};var _0x263dea;var _0x4df0e2;return db[_0x072e('0x2c')]['findOne']({'where':{'id':_0x2795cb['params']['id']}})[_0x072e('0x28')](handleEntityNotFound(_0x493371,null))['then'](function(_0x5fa6be){if(_0x5fa6be){_0x263dea=_0x5fa6be;_0x20fa1f[_0x072e('0x32')]=_[_0x072e('0x30')](db['ZohoConfiguration'][_0x072e('0x2d')]);_0x20fa1f[_0x072e('0x33')]=_[_0x072e('0x30')](_0x2795cb[_0x072e('0x33')]);_0x20fa1f[_0x072e('0x38')]=_[_0x072e('0x31')](_0x20fa1f[_0x072e('0x32')],_0x20fa1f[_0x072e('0x33')]);_0xc556f3[_0x072e('0x34')]=_['intersection'](_0x20fa1f[_0x072e('0x32')],qs[_0x072e('0x35')](_0x2795cb[_0x072e('0x33')][_0x072e('0x35')]));_0xc556f3[_0x072e('0x34')]=_0xc556f3[_0x072e('0x34')][_0x072e('0x44')]?_0xc556f3[_0x072e('0x34')]:_0x20fa1f[_0x072e('0x32')];_0xc556f3['order']=qs[_0x072e('0x37')](_0x2795cb['query'][_0x072e('0x37')]);_0xc556f3[_0x072e('0x3b')]=qs[_0x072e('0x38')](_['pick'](_0x2795cb['query'],_0x20fa1f[_0x072e('0x38')]));if(_0x2795cb['query'][_0x072e('0x3a')]){_0xc556f3[_0x072e('0x3b')]=_[_0x072e('0x3c')](_0xc556f3[_0x072e('0x3b')],{'$or':_['map'](_0xc556f3['attributes'],function(_0x480ab6){var _0x48bdd6={};_0x48bdd6[_0x480ab6]={'$like':'%'+_0x2795cb[_0x072e('0x33')][_0x072e('0x3a')]+'%'};return _0x48bdd6;})});}_0xc556f3=_[_0x072e('0x3c')]({},_0xc556f3,_0x2795cb[_0x072e('0x3e')]);return _0x263dea[_0x072e('0x4a')](_0xc556f3);}})['then'](function(_0x2c8544){if(_0x2c8544){_0x4df0e2=_0x2c8544[_0x072e('0x44')];if(!_0x2795cb['query'][_0x072e('0x4b')]('nolimit')){_0xc556f3[_0x072e('0x1f')]=qs[_0x072e('0x1f')](_0x2795cb[_0x072e('0x33')][_0x072e('0x1f')]);_0xc556f3['offset']=qs[_0x072e('0x21')](_0x2795cb[_0x072e('0x33')][_0x072e('0x21')]);}return _0x263dea[_0x072e('0x4a')](_0xc556f3);}})[_0x072e('0x28')](function(_0x7c09b7){if(_0x7c09b7){return _0x7c09b7?{'count':_0x4df0e2,'rows':_0x7c09b7}:null;}})[_0x072e('0x28')](respondWithResult(_0x493371,null))['catch'](handleError(_0x493371,null));};exports['addConfiguration']=function(_0x44ce3b,_0x525e02,_0x101e69){if(_0x44ce3b['body']['id']){delete _0x44ce3b[_0x072e('0x49')]['id'];}return db[_0x072e('0x2c')][_0x072e('0x4c')]({'where':{'id':_0x44ce3b[_0x072e('0x43')]['id']}})[_0x072e('0x28')](handleEntityNotFound(_0x525e02,null))[_0x072e('0x28')](function(_0x1a0b97){if(_0x1a0b97){_0x44ce3b[_0x072e('0x49')]['AccountId']=_0x1a0b97['id'];_0x44ce3b['body'][_0x072e('0x4d')]=integrations[_0x072e('0x4e')](_0x44ce3b[_0x072e('0x49')][_0x072e('0x4f')],_0x44ce3b[_0x072e('0x49')][_0x072e('0x50')]);_0x44ce3b[_0x072e('0x49')][_0x072e('0x51')]=integrations[_0x072e('0x52')](_0x44ce3b['body'][_0x072e('0x4f')],_0x44ce3b[_0x072e('0x49')]['type']);return db[_0x072e('0x53')]['create'](_0x44ce3b[_0x072e('0x49')],{'include':[{'model':db[_0x072e('0x54')],'as':_0x072e('0x4d')},{'model':db[_0x072e('0x54')],'as':_0x072e('0x51')}]});}return null;})[_0x072e('0x28')](respondWithResult(_0x525e02,null))['catch'](handleError(_0x525e02,null));};function getAccessToken(_0x1924e9){return new Promise(function(_0x3f5e77,_0x2bb7ce){var _0x4c2907;switch(_0x1924e9[_0x072e('0x55')]){case'US':_0x4c2907=_0x072e('0x56');break;case'AU':_0x4c2907=_0x072e('0x57');break;case'EU':_0x4c2907=_0x072e('0x58');break;case'IN':_0x4c2907=_0x072e('0x59');break;case'CN':_0x4c2907=_0x072e('0x5a');break;default:_0x4c2907=_0x072e('0x58');break;}var _0x1d17e0={'method':'POST','uri':_0x4c2907+_0x072e('0x5b'),'qs':{'refresh_token':_0x1924e9[_0x072e('0x5c')],'client_id':_0x1924e9[_0x072e('0x5d')],'client_secret':_0x1924e9['clientSecret'],'grant_type':_0x072e('0x5e')},'json':!![]};return rp(_0x1d17e0)[_0x072e('0x28')](function(_0x2e93ee){if(_0x2e93ee[_0x072e('0x5f')]){_0x3f5e77(_0x2e93ee['access_token']);}else{_0x2bb7ce(_0x072e('0x60'));}})['catch'](function(_0x5bb016){_0x2bb7ce(_0x5bb016);});});}exports[_0x072e('0x61')]=function(_0x21a411,_0xc43c58,_0x3a4890){var _0x3818a7,_0x127727,_0x257c21,_0x5f0d6c,_0xe13b98;return db[_0x072e('0x2c')][_0x072e('0x4c')]({'where':{'id':_0x21a411['params']['id']},'attributes':['id','host',_0x072e('0x55'),_0x072e('0x5d'),_0x072e('0x62'),_0x072e('0x63'),_0x072e('0x64'),_0x072e('0x5c')]})[_0x072e('0x28')](handleEntityNotFound(_0xc43c58,null))[_0x072e('0x28')](function(_0x3f3447){_0xe13b98=_0x3f3447;_0x3818a7=_0xe13b98[_0x072e('0x65')];_0x127727=_0x3818a7===_0x072e('0x66')?'eu':_0x072e('0x67');_0x257c21=_0xe13b98[_0x072e('0x63')];var _0x1499d5=_0x257c21[_0x072e('0x68')](-0x1);if(_0x1499d5==='/'||_0x1499d5==='\x5c'||_0x1499d5===':'){_0x257c21=_0x257c21['substring'](0x0,_0x257c21[_0x072e('0x69')](_0x1499d5));}if(!_0xe13b98['refreshToken']){throw new Error(_0x072e('0x6a'));}return getAccessToken(_0xe13b98);})[_0x072e('0x28')](function(_0x27fcdd){if(_0x27fcdd){return rp({'method':_0x072e('0x6b'),'uri':util[_0x072e('0x6c')](_0x072e('0x6d'),_0x127727),'qs':{'module':'Calls'},'headers':{'Authorization':_0x072e('0x6e')+_0x27fcdd},'json':!![]});}})[_0x072e('0x28')](function(_0x8c3435){if(_0x8c3435){if(_0x8c3435[_0x072e('0x6f')]&&_0x8c3435[_0x072e('0x6f')][_0x072e('0x29')]){throw new Error(_0x8c3435[_0x072e('0x6f')][_0x072e('0x29')][_0x072e('0x70')]);}var _0x45eea0=[];var _0x33fbae=[];var _0x427851=[_0x072e('0x71'),_0x072e('0x72'),_0x072e('0x73'),_0x072e('0x74'),'Call_Duration',_0x072e('0x75'),_0x072e('0x76'),_0x072e('0x77')];_0x33fbae=_[_0x072e('0x78')](_0x8c3435[_0x072e('0x35')],function(_0x3780c1){return _0x427851['includes'](_0x3780c1[_0x072e('0x79')]);});for(var _0x408afa=0x0;_0x408afa<_0x33fbae[_0x072e('0x44')];_0x408afa++){if(_0x33fbae[_0x408afa]['system_mandatory']===![]){_0x45eea0[_0x072e('0x7a')]({'id':_0x33fbae[_0x408afa]['id'],'name':_0x33fbae[_0x408afa][_0x072e('0x7b')],'custom':_0x33fbae[_0x408afa][_0x072e('0x7c')],'options':_0x33fbae[_0x408afa][_0x072e('0x7d')]===_0x072e('0x7e')&&_0x33fbae[_0x408afa][_0x072e('0x7f')]['length']>-0x1?_[_0x072e('0x2b')](_0x33fbae[_0x408afa]['pick_list_values'],function(_0x552f2c){return{'name':_0x552f2c,'value':_0x552f2c};}):[]});}}return{'count':_0x45eea0[_0x072e('0x44')],'rows':_0x45eea0};}else{return{'count':0x0,'rows':[]};}})[_0x072e('0x28')](respondWithResult(_0xc43c58,null))[_0x072e('0x41')](function(_0xaeb1c7){var _0x7d9af1=_0x21a411[_0x072e('0x33')][_0x072e('0x80')]?0x1f4:_0xaeb1c7[_0x072e('0x81')]||0x1f4;logger['error'](_0x072e('0x82'),_0x072e('0x61'),_0x7d9af1,JSON['stringify'](_0xaeb1c7));delete _0xaeb1c7[_0x072e('0x2f')];if(_0x7d9af1===0x191){_0x7d9af1=0x190;}_0xc43c58[_0x072e('0x1d')](_0x7d9af1)[_0x072e('0x2a')](_0x21a411[_0x072e('0x33')][_0x072e('0x80')]?{'message':'Wrong\x20credentials','statusCode':_0xaeb1c7[_0x072e('0x81')]}:_0xaeb1c7);});}; \ No newline at end of file +var _0xa736=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','send','index','ZohoAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','map','VIRTUAL','merge','options','include','findAll','rows','catch','show','includeAll','body','find','getConfigurations','findOne','params','ZohoConfiguration','order','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','refreshToken','zoho.eu','com','slice','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','WhoId','Call_Duration','Call_Result','Call_Start_Time','includes','api_name','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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'];(function(_0xf27a5d,_0x5a3b2f){var _0x217da7=function(_0x41f99c){while(--_0x41f99c){_0xf27a5d['push'](_0xf27a5d['shift']());}};_0x217da7(++_0x5a3b2f);}(_0xa736,0xe8));var _0x6a73=function(_0x59836b,_0x279e67){_0x59836b=_0x59836b-0x0;var _0xe6e18c=_0xa736[_0x59836b];return _0xe6e18c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a73('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a73('0x1'));var rp=require(_0x6a73('0x2'));var moment=require(_0x6a73('0x3'));var BPromise=require(_0x6a73('0x4'));var Mustache=require(_0x6a73('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6a73('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6a73('0x7'));var _=require('lodash');var squel=require(_0x6a73('0x8'));var crypto=require(_0x6a73('0x9'));var jsforce=require(_0x6a73('0xa'));var deskjs=require(_0x6a73('0xb'));var toCsv=require(_0x6a73('0x6'));var querystring=require(_0x6a73('0xc'));var Papa=require('papaparse');var Redis=require(_0x6a73('0xd'));var authService=require(_0x6a73('0xe'));var qs=require(_0x6a73('0xf'));var as=require(_0x6a73('0x10'));var hardwareService=require(_0x6a73('0x11'));var logger=require(_0x6a73('0x12'))(_0x6a73('0x13'));var utils=require(_0x6a73('0x14'));var config=require(_0x6a73('0x15'));var licenseUtil=require(_0x6a73('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x144675,_0x202f73){_0x202f73=_0x202f73||0xcc;return function(_0x1974fa){if(_0x1974fa){return _0x144675[_0x6a73('0x17')](_0x202f73);}return _0x144675['status'](_0x202f73)[_0x6a73('0x18')]();};}function respondWithResult(_0x71f53d,_0xac779d){_0xac779d=_0xac779d||0xc8;return function(_0x5a39f2){if(_0x5a39f2){return _0x71f53d['status'](_0xac779d)[_0x6a73('0x19')](_0x5a39f2);}};}function respondWithFilteredResult(_0x468ecc,_0x2886b2){return function(_0x3f943d){if(_0x3f943d){var _0x33c11d=typeof _0x2886b2[_0x6a73('0x1a')]===_0x6a73('0x1b')&&typeof _0x2886b2[_0x6a73('0x1c')]===_0x6a73('0x1b');var _0x2599ce=_0x3f943d[_0x6a73('0x1d')];var _0x4f30b0=_0x33c11d?0x0:_0x2886b2['offset'];var _0xe8e95a=_0x33c11d?_0x3f943d[_0x6a73('0x1d')]:_0x2886b2[_0x6a73('0x1a')]+_0x2886b2[_0x6a73('0x1c')];var _0x389d8f;if(_0xe8e95a>=_0x2599ce){_0xe8e95a=_0x2599ce;_0x389d8f=0xc8;}else{_0x389d8f=0xce;}_0x468ecc[_0x6a73('0x1e')](_0x389d8f);return _0x468ecc[_0x6a73('0x1f')](_0x6a73('0x20'),_0x4f30b0+'-'+_0xe8e95a+'/'+_0x2599ce)['json'](_0x3f943d);}return null;};}function patchUpdates(_0xfb7661){return function(_0x24cebf){try{jsonpatch[_0x6a73('0x21')](_0x24cebf,_0xfb7661,!![]);}catch(_0x2ad41a){return BPromise[_0x6a73('0x22')](_0x2ad41a);}return _0x24cebf[_0x6a73('0x23')]();};}function saveUpdates(_0x4154a0,_0xace9b3){return function(_0xede803){if(_0xede803){return _0xede803[_0x6a73('0x24')](_0x4154a0)[_0x6a73('0x25')](function(_0x4f3516){return _0x4f3516;});}return null;};}function removeEntity(_0x3672af,_0x4372fb){return function(_0x1e7d5c){if(_0x1e7d5c){return _0x1e7d5c[_0x6a73('0x26')]()[_0x6a73('0x25')](function(){_0x3672af[_0x6a73('0x1e')](0xcc)[_0x6a73('0x18')]();});}};}function handleEntityNotFound(_0x500148,_0x1f05f3){return function(_0x38478d){if(!_0x38478d){_0x500148['sendStatus'](0x194);}return _0x38478d;};}function handleError(_0x2edb72,_0x26e796){_0x26e796=_0x26e796||0x1f4;return function(_0x114357){logger[_0x6a73('0x27')](_0x114357['stack']);if(_0x114357['name']){delete _0x114357['name'];}_0x2edb72[_0x6a73('0x1e')](_0x26e796)[_0x6a73('0x28')](_0x114357);};}exports[_0x6a73('0x29')]=function(_0x4ab2f6,_0x4e4e13){var _0x3dff77={},_0x2d963c={},_0x3e94ab={'count':0x0,'rows':[]};var _0x3ed823=_['map'](db[_0x6a73('0x2a')][_0x6a73('0x2b')],function(_0x2d9c0a){return{'name':_0x2d9c0a[_0x6a73('0x2c')],'type':_0x2d9c0a[_0x6a73('0x2d')]['key']};});_0x2d963c['model']=_['map'](_0x3ed823,'name');_0x2d963c[_0x6a73('0x2e')]=_[_0x6a73('0x2f')](_0x4ab2f6[_0x6a73('0x2e')]);_0x2d963c[_0x6a73('0x30')]=_[_0x6a73('0x31')](_0x2d963c[_0x6a73('0x32')],_0x2d963c[_0x6a73('0x2e')]);_0x3dff77[_0x6a73('0x33')]=_[_0x6a73('0x31')](_0x2d963c[_0x6a73('0x32')],qs[_0x6a73('0x34')](_0x4ab2f6[_0x6a73('0x2e')][_0x6a73('0x34')]));_0x3dff77[_0x6a73('0x33')]=_0x3dff77[_0x6a73('0x33')][_0x6a73('0x35')]?_0x3dff77[_0x6a73('0x33')]:_0x2d963c['model'];if(!_0x4ab2f6[_0x6a73('0x2e')][_0x6a73('0x36')](_0x6a73('0x37'))){_0x3dff77[_0x6a73('0x1c')]=qs[_0x6a73('0x1c')](_0x4ab2f6['query'][_0x6a73('0x1c')]);_0x3dff77[_0x6a73('0x1a')]=qs['offset'](_0x4ab2f6['query'][_0x6a73('0x1a')]);}_0x3dff77['order']=qs[_0x6a73('0x38')](_0x4ab2f6['query'][_0x6a73('0x38')]);_0x3dff77[_0x6a73('0x39')]=qs[_0x6a73('0x30')](_['pick'](_0x4ab2f6[_0x6a73('0x2e')],_0x2d963c['filters']),_0x3ed823);if(_0x4ab2f6[_0x6a73('0x2e')][_0x6a73('0x3a')]){_0x3dff77[_0x6a73('0x39')]=_['merge'](_0x3dff77[_0x6a73('0x39')],{'$or':_[_0x6a73('0x3b')](_0x3ed823,function(_0x4d4b8d){if(_0x4d4b8d['type']!==_0x6a73('0x3c')){var _0x4b519f={};_0x4b519f[_0x4d4b8d['name']]={'$like':'%'+_0x4ab2f6[_0x6a73('0x2e')][_0x6a73('0x3a')]+'%'};return _0x4b519f;}})});}_0x3dff77=_[_0x6a73('0x3d')]({},_0x3dff77,_0x4ab2f6[_0x6a73('0x3e')]);var _0x13e617={'where':_0x3dff77[_0x6a73('0x39')]};return db[_0x6a73('0x2a')][_0x6a73('0x1d')](_0x13e617)['then'](function(_0x435702){_0x3e94ab['count']=_0x435702;if(_0x4ab2f6[_0x6a73('0x2e')]['includeAll']){_0x3dff77[_0x6a73('0x3f')]=[{'all':!![]}];}return db['ZohoAccount'][_0x6a73('0x40')](_0x3dff77);})[_0x6a73('0x25')](function(_0x4d3396){_0x3e94ab[_0x6a73('0x41')]=_0x4d3396;return _0x3e94ab;})['then'](respondWithFilteredResult(_0x4e4e13,_0x3dff77))[_0x6a73('0x42')](handleError(_0x4e4e13,null));};exports[_0x6a73('0x43')]=function(_0x30ef06,_0x1d3fee){var _0x3fdd2a={'raw':![],'where':{'id':_0x30ef06['params']['id']}},_0x175cb7={};_0x175cb7[_0x6a73('0x32')]=_[_0x6a73('0x2f')](db['ZohoAccount'][_0x6a73('0x2b')]);_0x175cb7[_0x6a73('0x2e')]=_['keys'](_0x30ef06[_0x6a73('0x2e')]);_0x175cb7[_0x6a73('0x30')]=_['intersection'](_0x175cb7[_0x6a73('0x32')],_0x175cb7['query']);_0x3fdd2a[_0x6a73('0x33')]=_[_0x6a73('0x31')](_0x175cb7[_0x6a73('0x32')],qs[_0x6a73('0x34')](_0x30ef06[_0x6a73('0x2e')][_0x6a73('0x34')]));_0x3fdd2a[_0x6a73('0x33')]=_0x3fdd2a[_0x6a73('0x33')][_0x6a73('0x35')]?_0x3fdd2a[_0x6a73('0x33')]:_0x175cb7['model'];if(_0x30ef06[_0x6a73('0x2e')][_0x6a73('0x44')]){_0x3fdd2a[_0x6a73('0x3f')]=[{'all':!![]}];}_0x3fdd2a=_[_0x6a73('0x3d')]({},_0x3fdd2a,_0x30ef06['options']);return db[_0x6a73('0x2a')]['find'](_0x3fdd2a)[_0x6a73('0x25')](handleEntityNotFound(_0x1d3fee,null))[_0x6a73('0x25')](respondWithResult(_0x1d3fee,null))[_0x6a73('0x42')](handleError(_0x1d3fee,null));};exports['create']=function(_0x22b942,_0x368931){return db['ZohoAccount']['create'](_0x22b942[_0x6a73('0x45')],{})[_0x6a73('0x25')](respondWithResult(_0x368931,0xc9))[_0x6a73('0x42')](handleError(_0x368931,null));};exports[_0x6a73('0x24')]=function(_0x1efc13,_0x4b78a5){if(_0x1efc13[_0x6a73('0x45')]['id']){delete _0x1efc13[_0x6a73('0x45')]['id'];}return db[_0x6a73('0x2a')][_0x6a73('0x46')]({'where':{'id':_0x1efc13['params']['id']}})[_0x6a73('0x25')](handleEntityNotFound(_0x4b78a5,null))[_0x6a73('0x25')](saveUpdates(_0x1efc13[_0x6a73('0x45')],null))[_0x6a73('0x25')](respondWithResult(_0x4b78a5,null))[_0x6a73('0x42')](handleError(_0x4b78a5,null));};exports[_0x6a73('0x26')]=function(_0xe828f7,_0x12810a){return db[_0x6a73('0x2a')][_0x6a73('0x46')]({'where':{'id':_0xe828f7['params']['id']}})[_0x6a73('0x25')](handleEntityNotFound(_0x12810a,null))[_0x6a73('0x25')](removeEntity(_0x12810a,null))[_0x6a73('0x42')](handleError(_0x12810a,null));};exports[_0x6a73('0x47')]=function(_0x3bcfa6,_0x542e5c,_0x5c47dd){var _0x142182={};var _0x3fee34={};var _0x1298f5;var _0x1c1a1f;return db[_0x6a73('0x2a')][_0x6a73('0x48')]({'where':{'id':_0x3bcfa6[_0x6a73('0x49')]['id']}})[_0x6a73('0x25')](handleEntityNotFound(_0x542e5c,null))[_0x6a73('0x25')](function(_0x314934){if(_0x314934){_0x1298f5=_0x314934;_0x3fee34['model']=_['keys'](db[_0x6a73('0x4a')][_0x6a73('0x2b')]);_0x3fee34[_0x6a73('0x2e')]=_['keys'](_0x3bcfa6[_0x6a73('0x2e')]);_0x3fee34[_0x6a73('0x30')]=_[_0x6a73('0x31')](_0x3fee34[_0x6a73('0x32')],_0x3fee34[_0x6a73('0x2e')]);_0x142182[_0x6a73('0x33')]=_['intersection'](_0x3fee34[_0x6a73('0x32')],qs[_0x6a73('0x34')](_0x3bcfa6['query'][_0x6a73('0x34')]));_0x142182['attributes']=_0x142182[_0x6a73('0x33')][_0x6a73('0x35')]?_0x142182[_0x6a73('0x33')]:_0x3fee34[_0x6a73('0x32')];_0x142182[_0x6a73('0x4b')]=qs[_0x6a73('0x38')](_0x3bcfa6[_0x6a73('0x2e')]['sort']);_0x142182['where']=qs[_0x6a73('0x30')](_[_0x6a73('0x4c')](_0x3bcfa6['query'],_0x3fee34[_0x6a73('0x30')]));if(_0x3bcfa6[_0x6a73('0x2e')][_0x6a73('0x3a')]){_0x142182[_0x6a73('0x39')]=_['merge'](_0x142182[_0x6a73('0x39')],{'$or':_['map'](_0x142182[_0x6a73('0x33')],function(_0x4d3f2b){var _0x6e24f0={};_0x6e24f0[_0x4d3f2b]={'$like':'%'+_0x3bcfa6['query'][_0x6a73('0x3a')]+'%'};return _0x6e24f0;})});}_0x142182=_[_0x6a73('0x3d')]({},_0x142182,_0x3bcfa6[_0x6a73('0x3e')]);return _0x1298f5[_0x6a73('0x47')](_0x142182);}})[_0x6a73('0x25')](function(_0x3b7c89){if(_0x3b7c89){_0x1c1a1f=_0x3b7c89[_0x6a73('0x35')];if(!_0x3bcfa6[_0x6a73('0x2e')][_0x6a73('0x36')]('nolimit')){_0x142182[_0x6a73('0x1c')]=qs[_0x6a73('0x1c')](_0x3bcfa6[_0x6a73('0x2e')][_0x6a73('0x1c')]);_0x142182['offset']=qs[_0x6a73('0x1a')](_0x3bcfa6['query'][_0x6a73('0x1a')]);}return _0x1298f5[_0x6a73('0x47')](_0x142182);}})['then'](function(_0x585559){if(_0x585559){return _0x585559?{'count':_0x1c1a1f,'rows':_0x585559}:null;}})[_0x6a73('0x25')](respondWithResult(_0x542e5c,null))[_0x6a73('0x42')](handleError(_0x542e5c,null));};exports[_0x6a73('0x4d')]=function(_0x58dc96,_0x333a5b,_0x2479b1){if(_0x58dc96[_0x6a73('0x45')]['id']){delete _0x58dc96[_0x6a73('0x45')]['id'];}return db[_0x6a73('0x2a')][_0x6a73('0x48')]({'where':{'id':_0x58dc96[_0x6a73('0x49')]['id']}})[_0x6a73('0x25')](handleEntityNotFound(_0x333a5b,null))[_0x6a73('0x25')](function(_0x50919d){if(_0x50919d){_0x58dc96['body'][_0x6a73('0x4e')]=_0x50919d['id'];_0x58dc96[_0x6a73('0x45')][_0x6a73('0x4f')]=integrations[_0x6a73('0x50')](_0x58dc96[_0x6a73('0x45')][_0x6a73('0x51')],_0x58dc96[_0x6a73('0x45')][_0x6a73('0x2d')]);_0x58dc96[_0x6a73('0x45')][_0x6a73('0x52')]=integrations[_0x6a73('0x53')](_0x58dc96[_0x6a73('0x45')][_0x6a73('0x51')],_0x58dc96[_0x6a73('0x45')][_0x6a73('0x2d')]);return db[_0x6a73('0x4a')][_0x6a73('0x54')](_0x58dc96[_0x6a73('0x45')],{'include':[{'model':db[_0x6a73('0x55')],'as':_0x6a73('0x4f')},{'model':db[_0x6a73('0x55')],'as':_0x6a73('0x52')}]});}return null;})['then'](respondWithResult(_0x333a5b,null))[_0x6a73('0x42')](handleError(_0x333a5b,null));};function getAccessToken(_0x586888){return new Promise(function(_0x41b1b7,_0x2e13c3){var _0x421a48;switch(_0x586888[_0x6a73('0x56')]){case'US':_0x421a48=_0x6a73('0x57');break;case'AU':_0x421a48='https://accounts.zoho.com.au';break;case'EU':_0x421a48=_0x6a73('0x58');break;case'IN':_0x421a48='https://accounts.zoho.in';break;case'CN':_0x421a48=_0x6a73('0x59');break;default:_0x421a48=_0x6a73('0x58');break;}var _0x351599={'method':_0x6a73('0x5a'),'uri':_0x421a48+'/oauth/v2/token','qs':{'refresh_token':_0x586888['refreshToken'],'client_id':_0x586888[_0x6a73('0x5b')],'client_secret':_0x586888[_0x6a73('0x5c')],'grant_type':_0x6a73('0x5d')},'json':!![]};return rp(_0x351599)[_0x6a73('0x25')](function(_0x1db8c3){if(_0x1db8c3[_0x6a73('0x5e')]){_0x41b1b7(_0x1db8c3[_0x6a73('0x5e')]);}else{_0x2e13c3(_0x6a73('0x5f'));}})[_0x6a73('0x42')](function(_0x285eb3){_0x2e13c3(_0x285eb3);});});}exports['getFields']=function(_0x5bf9ed,_0x1ebf43,_0x428db6){var _0x5692eb,_0x3e6260,_0x3b0c64,_0x3d27e5,_0x1fc7c8;return db[_0x6a73('0x2a')][_0x6a73('0x48')]({'where':{'id':_0x5bf9ed[_0x6a73('0x49')]['id']},'attributes':['id',_0x6a73('0x60'),_0x6a73('0x56'),_0x6a73('0x5b'),_0x6a73('0x5c'),_0x6a73('0x61'),_0x6a73('0x62'),_0x6a73('0x63')]})[_0x6a73('0x25')](handleEntityNotFound(_0x1ebf43,null))['then'](function(_0x8de951){_0x1fc7c8=_0x8de951;_0x5692eb=_0x1fc7c8[_0x6a73('0x60')];_0x3e6260=_0x5692eb===_0x6a73('0x64')?'eu':_0x6a73('0x65');_0x3b0c64=_0x1fc7c8[_0x6a73('0x61')];var _0x4fd892=_0x3b0c64[_0x6a73('0x66')](-0x1);if(_0x4fd892==='/'||_0x4fd892==='\x5c'||_0x4fd892===':'){_0x3b0c64=_0x3b0c64['substring'](0x0,_0x3b0c64['lastIndexOf'](_0x4fd892));}if(!_0x1fc7c8[_0x6a73('0x63')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x1fc7c8);})[_0x6a73('0x25')](function(_0x3e0fba){if(_0x3e0fba){return rp({'method':_0x6a73('0x67'),'uri':util[_0x6a73('0x68')](_0x6a73('0x69'),_0x3e6260),'qs':{'module':'Calls'},'headers':{'Authorization':_0x6a73('0x6a')+_0x3e0fba},'json':!![]});}})['then'](function(_0x3438f2){if(_0x3438f2){if(_0x3438f2[_0x6a73('0x6b')]&&_0x3438f2[_0x6a73('0x6b')]['error']){throw new Error(_0x3438f2['response'][_0x6a73('0x27')]['message']);}var _0x2f8b28=[];var _0x7024e8=[];var _0x502ad8=[_0x6a73('0x6c'),_0x6a73('0x6d'),'Description',_0x6a73('0x6e'),_0x6a73('0x6f'),_0x6a73('0x70'),_0x6a73('0x71'),'Call_Type'];_0x7024e8=_['remove'](_0x3438f2[_0x6a73('0x34')],function(_0x22833a){return _0x502ad8[_0x6a73('0x72')](_0x22833a[_0x6a73('0x73')]);});for(var _0x586583=0x0;_0x586583<_0x7024e8['length'];_0x586583++){if(_0x7024e8[_0x586583]['system_mandatory']===![]){_0x2f8b28[_0x6a73('0x74')]({'id':_0x7024e8[_0x586583]['id'],'name':_0x7024e8[_0x586583]['display_label'],'custom':_0x7024e8[_0x586583][_0x6a73('0x75')],'options':_0x7024e8[_0x586583][_0x6a73('0x76')]===_0x6a73('0x77')&&_0x7024e8[_0x586583]['pick_list_values'][_0x6a73('0x35')]>-0x1?_['map'](_0x7024e8[_0x586583][_0x6a73('0x78')],function(_0x5dbb80){return{'name':_0x5dbb80,'value':_0x5dbb80};}):[]});}}return{'count':_0x2f8b28[_0x6a73('0x35')],'rows':_0x2f8b28};}else{return{'count':0x0,'rows':[]};}})[_0x6a73('0x25')](respondWithResult(_0x1ebf43,null))['catch'](function(_0xddfb19){var _0x32de15=_0x5bf9ed['query'][_0x6a73('0x79')]?0x1f4:_0xddfb19[_0x6a73('0x7a')]||0x1f4;logger[_0x6a73('0x27')](_0x6a73('0x7b'),_0x6a73('0x7c'),_0x32de15,JSON['stringify'](_0xddfb19));delete _0xddfb19['name'];if(_0x32de15===0x191){_0x32de15=0x190;}_0x1ebf43[_0x6a73('0x1e')](_0x32de15)['send'](_0x5bf9ed[_0x6a73('0x2e')][_0x6a73('0x79')]?{'message':_0x6a73('0x7d'),'statusCode':_0xddfb19[_0x6a73('0x7a')]}:_0xddfb19);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 403131f..201dc6b 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 _0x39a3=['serverUrl','clientId','clientSecret','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','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','host','POST','refreshToken','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','zone','changed'];(function(_0x40f3f0,_0x3a681a){var _0x16802d=function(_0x378489){while(--_0x378489){_0x40f3f0['push'](_0x40f3f0['shift']());}};_0x16802d(++_0x3a681a);}(_0x39a3,0x9f));var _0x339a=function(_0xa8369a,_0x3d2319){_0xa8369a=_0xa8369a-0x0;var _0x4b74b7=_0x39a3[_0xa8369a];return _0x4b74b7;};'use strict';var _=require(_0x339a('0x0'));var util=require(_0x339a('0x1'));var logger=require(_0x339a('0x2'))(_0x339a('0x3'));var moment=require(_0x339a('0x4'));var BPromise=require(_0x339a('0x5'));var rp=require(_0x339a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x339a('0x7'));var config=require(_0x339a('0x8'));var attributes=require(_0x339a('0x9'));var integrations=require(_0x339a('0xa'));module[_0x339a('0xb')]=function(_0x46e0da,_0x21a8b9){return _0x46e0da[_0x339a('0xc')](_0x339a('0xd'),attributes,{'tableName':_0x339a('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x27b94e,_0x28746a,_0x6997e4){if(_0x27b94e['changed'](_0x339a('0xf'))||_0x27b94e[_0x339a('0x10')](_0x339a('0x11'))||_0x27b94e['changed'](_0x339a('0x12'))||_0x27b94e[_0x339a('0x10')](_0x339a('0x13'))||_0x27b94e[_0x339a('0x10')]('code')||_0x27b94e[_0x339a('0x10')]('host')){var _0x3889fd,_0x3c12f5;_0x3889fd=_0x27b94e['serverUrl'];var _0x288da8=_0x3889fd[_0x339a('0x14')](-0x1);if(_0x288da8==='/'||_0x288da8==='\x5c'||_0x288da8===':'){_0x3889fd=_0x3889fd[_0x339a('0x15')](0x0,_0x3889fd[_0x339a('0x16')](_0x288da8));}switch(_0x27b94e['zone']){case'US':_0x3c12f5=_0x339a('0x17');break;case'AU':_0x3c12f5=_0x339a('0x18');break;case'IN':_0x3c12f5=_0x339a('0x19');break;case'CN':_0x3c12f5=_0x339a('0x1a');break;default:_0x3c12f5=_0x339a('0x1b');break;}var _0x1f856b={'method':'POST','uri':_0x3c12f5+'/oauth/v2/token','form':{'grant_type':_0x339a('0x1c'),'client_id':_0x27b94e[_0x339a('0x12')],'client_secret':_0x27b94e['clientSecret'],'redirect_uri':_0x27b94e[_0x339a('0x11')],'code':_0x27b94e['code']},'headers':{'Content-Type':_0x339a('0x1d')}};return rp(_0x1f856b)[_0x339a('0x1e')](function(_0x4ebb01){var _0x5dac41=JSON[_0x339a('0x1f')](_0x4ebb01);if(_0x5dac41[_0x339a('0x20')]){_0x27b94e['refreshToken']=_0x5dac41[_0x339a('0x20')];logger[_0x339a('0x21')](util[_0x339a('0x22')](_0x339a('0x23'),_0x27b94e[_0x339a('0x24')],_0x27b94e['id']));}else{logger[_0x339a('0x25')](util[_0x339a('0x22')](_0x339a('0x26'),_0x27b94e[_0x339a('0x24')],_0x27b94e['id']),util[_0x339a('0x27')](_0x5dac41,{'showHidden':![],'depth':null}));}return _0x6997e4(null,_0x28746a);})[_0x339a('0x28')](function(_0x12fc66){logger['error'](util['format'](_0x339a('0x26'),_0x27b94e['name'],_0x27b94e['id']),util[_0x339a('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x6997e4(_0x12fc66);});}else{return _0x6997e4(null,_0x28746a);}},'beforeUpdate':function(_0x55ff13,_0x23fe3b,_0x5ef29c){if(_0x55ff13[_0x339a('0x10')](_0x339a('0xf'))||_0x55ff13[_0x339a('0x10')](_0x339a('0x11'))||_0x55ff13[_0x339a('0x10')](_0x339a('0x12'))||_0x55ff13[_0x339a('0x10')](_0x339a('0x13'))||_0x55ff13['changed']('code')||_0x55ff13[_0x339a('0x10')](_0x339a('0x29'))){var _0x38b0cb,_0x18d441;_0x38b0cb=_0x55ff13[_0x339a('0x11')];var _0x385074=_0x38b0cb[_0x339a('0x14')](-0x1);if(_0x385074==='/'||_0x385074==='\x5c'||_0x385074===':'){_0x38b0cb=_0x38b0cb['substring'](0x0,_0x38b0cb['lastIndexOf'](_0x385074));}switch(_0x55ff13[_0x339a('0xf')]){case'US':_0x18d441=_0x339a('0x17');break;case'AU':_0x18d441='https://accounts.zoho.com.au';break;case'IN':_0x18d441=_0x339a('0x19');break;case'CN':_0x18d441=_0x339a('0x1a');break;default:_0x18d441=_0x339a('0x1b');break;}var _0x3f16c2={'method':_0x339a('0x2a'),'uri':_0x18d441+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x55ff13[_0x339a('0x12')],'client_secret':_0x55ff13[_0x339a('0x13')],'redirect_uri':_0x55ff13[_0x339a('0x11')],'code':_0x55ff13['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3f16c2)[_0x339a('0x1e')](function(_0x275c75){var _0x38758a=JSON[_0x339a('0x1f')](_0x275c75);if(_0x38758a[_0x339a('0x20')]){_0x55ff13[_0x339a('0x2b')]=_0x38758a[_0x339a('0x20')];logger[_0x339a('0x21')](util['format'](_0x339a('0x23'),_0x55ff13['name'],_0x55ff13['id']));}else{logger[_0x339a('0x25')](util[_0x339a('0x22')](_0x339a('0x26'),_0x55ff13[_0x339a('0x24')],_0x55ff13['id']),util['inspect'](_0x38758a,{'showHidden':![],'depth':null}));}return _0x5ef29c(null,_0x23fe3b);})[_0x339a('0x28')](function(_0x272ed6){logger[_0x339a('0x25')](util[_0x339a('0x22')](_0x339a('0x26'),_0x55ff13[_0x339a('0x24')],_0x55ff13['id']),util[_0x339a('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x5ef29c(_0x272ed6);});}else{return _0x5ef29c(null,_0x23fe3b);}}}});}; \ No newline at end of file +var _0x586b=['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','lastIndexOf','https://accounts.zoho.com','POST','parse','lodash','util','api','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','clientId','clientSecret','code','host','serverUrl','slice','substring','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format'];(function(_0x4085c5,_0x5615b6){var _0xee1c3d=function(_0x8ad49b){while(--_0x8ad49b){_0x4085c5['push'](_0x4085c5['shift']());}};_0xee1c3d(++_0x5615b6);}(_0x586b,0xb2));var _0xb586=function(_0x56061c,_0x5c991a){_0x56061c=_0x56061c-0x0;var _0x2661ba=_0x586b[_0x56061c];return _0x2661ba;};'use strict';var _=require(_0xb586('0x0'));var util=require(_0xb586('0x1'));var logger=require('../../config/logger')(_0xb586('0x2'));var moment=require('moment');var BPromise=require(_0xb586('0x3'));var rp=require(_0xb586('0x4'));var fs=require('fs');var path=require(_0xb586('0x5'));var rimraf=require(_0xb586('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xb586('0x7'));module[_0xb586('0x8')]=function(_0x113916,_0x3e328f){return _0x113916[_0xb586('0x9')](_0xb586('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2ada30,_0x12fba5,_0x1e2fd9){if(_0x2ada30[_0xb586('0xb')](_0xb586('0xc'))||_0x2ada30[_0xb586('0xb')]('serverUrl')||_0x2ada30[_0xb586('0xb')](_0xb586('0xd'))||_0x2ada30[_0xb586('0xb')](_0xb586('0xe'))||_0x2ada30[_0xb586('0xb')](_0xb586('0xf'))||_0x2ada30[_0xb586('0xb')](_0xb586('0x10'))){var _0x2f1161,_0x202063;_0x2f1161=_0x2ada30[_0xb586('0x11')];var _0xfb9b24=_0x2f1161[_0xb586('0x12')](-0x1);if(_0xfb9b24==='/'||_0xfb9b24==='\x5c'||_0xfb9b24===':'){_0x2f1161=_0x2f1161[_0xb586('0x13')](0x0,_0x2f1161['lastIndexOf'](_0xfb9b24));}switch(_0x2ada30[_0xb586('0xc')]){case'US':_0x202063='https://accounts.zoho.com';break;case'AU':_0x202063=_0xb586('0x14');break;case'IN':_0x202063=_0xb586('0x15');break;case'CN':_0x202063=_0xb586('0x16');break;default:_0x202063=_0xb586('0x17');break;}var _0x2edaa8={'method':'POST','uri':_0x202063+_0xb586('0x18'),'form':{'grant_type':_0xb586('0x19'),'client_id':_0x2ada30['clientId'],'client_secret':_0x2ada30[_0xb586('0xe')],'redirect_uri':_0x2ada30[_0xb586('0x11')],'code':_0x2ada30[_0xb586('0xf')]},'headers':{'Content-Type':_0xb586('0x1a')}};return rp(_0x2edaa8)[_0xb586('0x1b')](function(_0x1f7642){var _0x4c6c9c=JSON['parse'](_0x1f7642);if(_0x4c6c9c[_0xb586('0x1c')]){_0x2ada30[_0xb586('0x1d')]=_0x4c6c9c[_0xb586('0x1c')];logger[_0xb586('0x1e')](util[_0xb586('0x1f')](_0xb586('0x20'),_0x2ada30[_0xb586('0x21')],_0x2ada30['id']));}else{logger[_0xb586('0x22')](util[_0xb586('0x1f')](_0xb586('0x23'),_0x2ada30['name'],_0x2ada30['id']),util[_0xb586('0x24')](_0x4c6c9c,{'showHidden':![],'depth':null}));}return _0x1e2fd9(null,_0x12fba5);})[_0xb586('0x25')](function(_0x1f024e){logger[_0xb586('0x22')](util[_0xb586('0x1f')](_0xb586('0x23'),_0x2ada30[_0xb586('0x21')],_0x2ada30['id']),util[_0xb586('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x1e2fd9(_0x1f024e);});}else{return _0x1e2fd9(null,_0x12fba5);}},'beforeUpdate':function(_0x59e963,_0x3efae9,_0x524e1a){if(_0x59e963['changed']('zone')||_0x59e963[_0xb586('0xb')](_0xb586('0x11'))||_0x59e963[_0xb586('0xb')](_0xb586('0xd'))||_0x59e963[_0xb586('0xb')]('clientSecret')||_0x59e963[_0xb586('0xb')]('code')||_0x59e963[_0xb586('0xb')](_0xb586('0x10'))){var _0x3dc338,_0x3bbff5;_0x3dc338=_0x59e963[_0xb586('0x11')];var _0x39fa33=_0x3dc338[_0xb586('0x12')](-0x1);if(_0x39fa33==='/'||_0x39fa33==='\x5c'||_0x39fa33===':'){_0x3dc338=_0x3dc338[_0xb586('0x13')](0x0,_0x3dc338[_0xb586('0x26')](_0x39fa33));}switch(_0x59e963[_0xb586('0xc')]){case'US':_0x3bbff5=_0xb586('0x27');break;case'AU':_0x3bbff5='https://accounts.zoho.com.au';break;case'IN':_0x3bbff5=_0xb586('0x15');break;case'CN':_0x3bbff5='https://accounts.zoho.com.cn';break;default:_0x3bbff5=_0xb586('0x17');break;}var _0x2b2aea={'method':_0xb586('0x28'),'uri':_0x3bbff5+_0xb586('0x18'),'form':{'grant_type':_0xb586('0x19'),'client_id':_0x59e963['clientId'],'client_secret':_0x59e963['clientSecret'],'redirect_uri':_0x59e963[_0xb586('0x11')],'code':_0x59e963[_0xb586('0xf')]},'headers':{'Content-Type':_0xb586('0x1a')}};return rp(_0x2b2aea)[_0xb586('0x1b')](function(_0x40eed6){var _0x2bd38d=JSON[_0xb586('0x29')](_0x40eed6);if(_0x2bd38d[_0xb586('0x1c')]){_0x59e963['refreshToken']=_0x2bd38d[_0xb586('0x1c')];logger['info'](util[_0xb586('0x1f')](_0xb586('0x20'),_0x59e963[_0xb586('0x21')],_0x59e963['id']));}else{logger['error'](util[_0xb586('0x1f')](_0xb586('0x23'),_0x59e963[_0xb586('0x21')],_0x59e963['id']),util[_0xb586('0x24')](_0x2bd38d,{'showHidden':![],'depth':null}));}return _0x524e1a(null,_0x3efae9);})[_0xb586('0x25')](function(_0x29c5dd){logger[_0xb586('0x22')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x59e963[_0xb586('0x21')],_0x59e963['id']),util[_0xb586('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x524e1a(_0x29c5dd);});}else{return _0x524e1a(null,_0x3efae9);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 7c53c83..dc02882 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 _0x0e56=['lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','options','raw','where','attributes','limit','include','map','model','ShowZohoAccount','ZohoAccount'];(function(_0x3811e9,_0xe0a068){var _0x20e779=function(_0x40dd69){while(--_0x40dd69){_0x3811e9['push'](_0x3811e9['shift']());}};_0x20e779(++_0xe0a068);}(_0x0e56,0xf5));var _0x60e5=function(_0x3ccea2,_0x624323){_0x3ccea2=_0x3ccea2-0x0;var _0xeb988=_0x0e56[_0x3ccea2];return _0xeb988;};'use strict';var _=require(_0x60e5('0x0'));var util=require(_0x60e5('0x1'));var moment=require('moment');var BPromise=require(_0x60e5('0x2'));var rs=require(_0x60e5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60e5('0x4'))['db'];var utils=require(_0x60e5('0x5'));var logger=require(_0x60e5('0x6'))(_0x60e5('0x7'));var config=require(_0x60e5('0x8'));var jayson=require(_0x60e5('0x9'));var client=jayson[_0x60e5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b44b9,_0x5513f2,_0x31765c){return new BPromise(function(_0x3083a0,_0x59389e){return client[_0x60e5('0xb')](_0x1b44b9,_0x31765c)[_0x60e5('0xc')](function(_0x46d531){logger[_0x60e5('0xd')](_0x60e5('0xe'),_0x5513f2,_0x60e5('0xf'));logger[_0x60e5('0x10')](_0x60e5('0x11'),_0x5513f2,_0x60e5('0xf'),JSON[_0x60e5('0x12')](_0x46d531));if(_0x46d531[_0x60e5('0x13')]){if(_0x46d531[_0x60e5('0x13')][_0x60e5('0x14')]===0x1f4){logger[_0x60e5('0x13')](_0x60e5('0xe'),_0x5513f2,_0x46d531[_0x60e5('0x13')]['message']);return _0x59389e(_0x46d531[_0x60e5('0x13')]['message']);}logger['error'](_0x60e5('0xe'),_0x5513f2,_0x46d531[_0x60e5('0x13')]['message']);return _0x3083a0(_0x46d531[_0x60e5('0x13')][_0x60e5('0x15')]);}else{logger[_0x60e5('0xd')](_0x60e5('0xe'),_0x5513f2,'request\x20sent');_0x3083a0(_0x46d531[_0x60e5('0x16')][_0x60e5('0x15')]);}})[_0x60e5('0x17')](function(_0x1ed08d){logger[_0x60e5('0x13')](_0x60e5('0xe'),_0x5513f2,_0x1ed08d);_0x59389e(_0x1ed08d);});});}exports[_0x60e5('0x18')]=function(_0x12aee7){var _0x3060b6=this;return new Promise(function(_0x51688a,_0x599dc4){return db['ZohoAccount']['findAll']({'raw':_0x12aee7[_0x60e5('0x19')]?_0x12aee7[_0x60e5('0x19')][_0x60e5('0x1a')]===undefined?!![]:![]:!![],'where':_0x12aee7['options']?_0x12aee7[_0x60e5('0x19')][_0x60e5('0x1b')]||null:null,'attributes':_0x12aee7[_0x60e5('0x19')]?_0x12aee7[_0x60e5('0x19')][_0x60e5('0x1c')]||null:null,'limit':_0x12aee7[_0x60e5('0x19')]?_0x12aee7[_0x60e5('0x19')][_0x60e5('0x1d')]||null:null,'include':_0x12aee7[_0x60e5('0x19')]?_0x12aee7[_0x60e5('0x19')][_0x60e5('0x1e')]?_['map'](_0x12aee7['options'][_0x60e5('0x1e')],function(_0x518741){return{'model':db[_0x518741['model']],'as':_0x518741['as'],'attributes':_0x518741[_0x60e5('0x1c')],'include':_0x518741['include']?_[_0x60e5('0x1f')](_0x518741[_0x60e5('0x1e')],function(_0x476d0a){return{'model':db[_0x476d0a[_0x60e5('0x20')]],'as':_0x476d0a['as'],'attributes':_0x476d0a[_0x60e5('0x1c')],'include':_0x476d0a['include']?_[_0x60e5('0x1f')](_0x476d0a['include'],function(_0xd13043){return{'model':db[_0xd13043[_0x60e5('0x20')]],'as':_0xd13043['as'],'attributes':_0xd13043[_0x60e5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xefae42){logger[_0x60e5('0xd')]('GetZohoAccount',_0x12aee7);logger[_0x60e5('0x10')](_0x60e5('0x18'),_0x12aee7,JSON[_0x60e5('0x12')](_0xefae42));_0x51688a(_0xefae42);})['catch'](function(_0xb1d302){logger[_0x60e5('0x13')](_0x60e5('0x18'),_0xb1d302[_0x60e5('0x15')],_0x12aee7);_0x599dc4(_0x3060b6[_0x60e5('0x13')](0x1f4,_0xb1d302[_0x60e5('0x15')]));});});};exports[_0x60e5('0x21')]=function(_0x22116d){var _0x2707df=this;return new Promise(function(_0x3bc937,_0x285798){return db[_0x60e5('0x22')]['find']({'raw':_0x22116d[_0x60e5('0x19')]?_0x22116d[_0x60e5('0x19')][_0x60e5('0x1a')]===undefined?!![]:![]:!![],'where':_0x22116d[_0x60e5('0x19')]?_0x22116d['options']['where']||null:null,'attributes':_0x22116d['options']?_0x22116d[_0x60e5('0x19')][_0x60e5('0x1c')]||null:null,'include':_0x22116d[_0x60e5('0x19')]?_0x22116d[_0x60e5('0x19')][_0x60e5('0x1e')]?_['map'](_0x22116d[_0x60e5('0x19')][_0x60e5('0x1e')],function(_0x2467f5){return{'model':db[_0x2467f5[_0x60e5('0x20')]],'as':_0x2467f5['as'],'attributes':_0x2467f5['attributes'],'include':_0x2467f5['include']?_[_0x60e5('0x1f')](_0x2467f5['include'],function(_0x44ae5e){return{'model':db[_0x44ae5e[_0x60e5('0x20')]],'as':_0x44ae5e['as'],'attributes':_0x44ae5e[_0x60e5('0x1c')],'include':_0x44ae5e[_0x60e5('0x1e')]?_['map'](_0x44ae5e[_0x60e5('0x1e')],function(_0x1d967a){return{'model':db[_0x1d967a[_0x60e5('0x20')]],'as':_0x1d967a['as'],'attributes':_0x1d967a[_0x60e5('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b5548){logger[_0x60e5('0xd')](_0x60e5('0x21'),_0x22116d);logger['debug'](_0x60e5('0x21'),_0x22116d,JSON[_0x60e5('0x12')](_0x3b5548));_0x3bc937(_0x3b5548);})[_0x60e5('0x17')](function(_0x2f3bfd){logger[_0x60e5('0x13')](_0x60e5('0x21'),_0x2f3bfd['message'],_0x22116d);_0x285798(_0x2707df['error'](0x1f4,_0x2f3bfd[_0x60e5('0x15')]));});});}; \ No newline at end of file +var _0x4808=['catch','GetZohoAccount','findAll','options','where','attributes','include','map','model','ShowZohoAccount','ZohoAccount','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x5ec408,_0x3db739){var _0x26644c=function(_0x19bdb3){while(--_0x19bdb3){_0x5ec408['push'](_0x5ec408['shift']());}};_0x26644c(++_0x3db739);}(_0x4808,0x160));var _0x8480=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x4808[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0x8480('0x0'));var util=require(_0x8480('0x1'));var moment=require(_0x8480('0x2'));var BPromise=require('bluebird');var rs=require(_0x8480('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8480('0x4'))['db'];var utils=require(_0x8480('0x5'));var logger=require(_0x8480('0x6'))('rpc');var config=require(_0x8480('0x7'));var jayson=require(_0x8480('0x8'));var client=jayson['client'][_0x8480('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5060aa,_0x364f22,_0x4b9f45){return new BPromise(function(_0x3480e7,_0x2b1ffb){return client[_0x8480('0xa')](_0x5060aa,_0x4b9f45)[_0x8480('0xb')](function(_0x337d1e){logger['info'](_0x8480('0xc'),_0x364f22,_0x8480('0xd'));logger[_0x8480('0xe')](_0x8480('0xf'),_0x364f22,_0x8480('0xd'),JSON[_0x8480('0x10')](_0x337d1e));if(_0x337d1e[_0x8480('0x11')]){if(_0x337d1e[_0x8480('0x11')][_0x8480('0x12')]===0x1f4){logger[_0x8480('0x11')](_0x8480('0xc'),_0x364f22,_0x337d1e[_0x8480('0x11')][_0x8480('0x13')]);return _0x2b1ffb(_0x337d1e[_0x8480('0x11')][_0x8480('0x13')]);}logger[_0x8480('0x11')](_0x8480('0xc'),_0x364f22,_0x337d1e[_0x8480('0x11')][_0x8480('0x13')]);return _0x3480e7(_0x337d1e['error'][_0x8480('0x13')]);}else{logger[_0x8480('0x14')](_0x8480('0xc'),_0x364f22,'request\x20sent');_0x3480e7(_0x337d1e[_0x8480('0x15')][_0x8480('0x13')]);}})[_0x8480('0x16')](function(_0x35dd6a){logger[_0x8480('0x11')](_0x8480('0xc'),_0x364f22,_0x35dd6a);_0x2b1ffb(_0x35dd6a);});});}exports[_0x8480('0x17')]=function(_0x484e41){var _0x2a55f1=this;return new Promise(function(_0x5040dd,_0x5eaeb9){return db['ZohoAccount'][_0x8480('0x18')]({'raw':_0x484e41['options']?_0x484e41[_0x8480('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x484e41[_0x8480('0x19')]?_0x484e41[_0x8480('0x19')][_0x8480('0x1a')]||null:null,'attributes':_0x484e41['options']?_0x484e41[_0x8480('0x19')][_0x8480('0x1b')]||null:null,'limit':_0x484e41[_0x8480('0x19')]?_0x484e41[_0x8480('0x19')]['limit']||null:null,'include':_0x484e41['options']?_0x484e41[_0x8480('0x19')][_0x8480('0x1c')]?_[_0x8480('0x1d')](_0x484e41[_0x8480('0x19')]['include'],function(_0x17b84f){return{'model':db[_0x17b84f['model']],'as':_0x17b84f['as'],'attributes':_0x17b84f['attributes'],'include':_0x17b84f[_0x8480('0x1c')]?_[_0x8480('0x1d')](_0x17b84f[_0x8480('0x1c')],function(_0x49245c){return{'model':db[_0x49245c[_0x8480('0x1e')]],'as':_0x49245c['as'],'attributes':_0x49245c['attributes'],'include':_0x49245c[_0x8480('0x1c')]?_[_0x8480('0x1d')](_0x49245c['include'],function(_0x18edd5){return{'model':db[_0x18edd5[_0x8480('0x1e')]],'as':_0x18edd5['as'],'attributes':_0x18edd5[_0x8480('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8480('0xb')](function(_0xd3e0d8){logger['info'](_0x8480('0x17'),_0x484e41);logger[_0x8480('0xe')]('GetZohoAccount',_0x484e41,JSON[_0x8480('0x10')](_0xd3e0d8));_0x5040dd(_0xd3e0d8);})[_0x8480('0x16')](function(_0x203981){logger[_0x8480('0x11')]('GetZohoAccount',_0x203981['message'],_0x484e41);_0x5eaeb9(_0x2a55f1['error'](0x1f4,_0x203981['message']));});});};exports[_0x8480('0x1f')]=function(_0x145319){var _0x2762c8=this;return new Promise(function(_0x2286b7,_0x5352a3){return db[_0x8480('0x20')]['find']({'raw':_0x145319[_0x8480('0x19')]?_0x145319['options'][_0x8480('0x21')]===undefined?!![]:![]:!![],'where':_0x145319[_0x8480('0x19')]?_0x145319[_0x8480('0x19')][_0x8480('0x1a')]||null:null,'attributes':_0x145319[_0x8480('0x19')]?_0x145319[_0x8480('0x19')][_0x8480('0x1b')]||null:null,'include':_0x145319[_0x8480('0x19')]?_0x145319[_0x8480('0x19')][_0x8480('0x1c')]?_[_0x8480('0x1d')](_0x145319[_0x8480('0x19')][_0x8480('0x1c')],function(_0x270972){return{'model':db[_0x270972[_0x8480('0x1e')]],'as':_0x270972['as'],'attributes':_0x270972[_0x8480('0x1b')],'include':_0x270972[_0x8480('0x1c')]?_[_0x8480('0x1d')](_0x270972[_0x8480('0x1c')],function(_0x346662){return{'model':db[_0x346662[_0x8480('0x1e')]],'as':_0x346662['as'],'attributes':_0x346662['attributes'],'include':_0x346662[_0x8480('0x1c')]?_[_0x8480('0x1d')](_0x346662[_0x8480('0x1c')],function(_0x437881){return{'model':db[_0x437881[_0x8480('0x1e')]],'as':_0x437881['as'],'attributes':_0x437881[_0x8480('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8480('0xb')](function(_0x395949){logger[_0x8480('0x14')](_0x8480('0x1f'),_0x145319);logger[_0x8480('0xe')](_0x8480('0x1f'),_0x145319,JSON[_0x8480('0x10')](_0x395949));_0x2286b7(_0x395949);})[_0x8480('0x16')](function(_0x2d7d0c){logger['error']('ShowZohoAccount',_0x2d7d0c[_0x8480('0x13')],_0x145319);_0x5352a3(_0x2762c8['error'](0x1f4,_0x2d7d0c['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 922a953..3058fb8 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 _0x8350=['./intZohoConfiguration.controller','get','index','/:id','show','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x346a11,_0x38b1a3){var _0x5efd8a=function(_0x2664fb){while(--_0x2664fb){_0x346a11['push'](_0x346a11['shift']());}};_0x5efd8a(++_0x38b1a3);}(_0x8350,0x196));var _0x0835=function(_0x458684,_0x51963a){_0x458684=_0x458684-0x0;var _0x41330b=_0x8350[_0x458684];return _0x41330b;};'use strict';var multer=require(_0x0835('0x0'));var util=require(_0x0835('0x1'));var path=require(_0x0835('0x2'));var timeout=require(_0x0835('0x3'));var express=require(_0x0835('0x4'));var router=express[_0x0835('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0835('0x6'));var config=require(_0x0835('0x7'));var controller=require(_0x0835('0x8'));router[_0x0835('0x9')]('/',auth['isAuthenticated'](),controller[_0x0835('0xa')]);router[_0x0835('0x9')](_0x0835('0xb'),auth['isAuthenticated'](),controller[_0x0835('0xc')]);router[_0x0835('0x9')]('/:id/fields',auth[_0x0835('0xd')](),controller[_0x0835('0xe')]);router[_0x0835('0x9')](_0x0835('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x0835('0x9')](_0x0835('0x10'),auth[_0x0835('0xd')](),controller['getDescriptions']);router[_0x0835('0x11')]('/',auth[_0x0835('0xd')](),controller[_0x0835('0x12')]);router[_0x0835('0x13')](_0x0835('0xb'),auth[_0x0835('0xd')](),controller[_0x0835('0x14')]);router[_0x0835('0x15')](_0x0835('0xb'),auth[_0x0835('0xd')](),controller['destroy']);module[_0x0835('0x16')]=router; \ No newline at end of file +var _0x7885=['getDescriptions','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects'];(function(_0x53f4eb,_0x46592e){var _0x425803=function(_0x5ca164){while(--_0x5ca164){_0x53f4eb['push'](_0x53f4eb['shift']());}};_0x425803(++_0x46592e);}(_0x7885,0xb5));var _0x5788=function(_0x25e903,_0x56e206){_0x25e903=_0x25e903-0x0;var _0xd19732=_0x7885[_0x25e903];return _0xd19732;};'use strict';var multer=require(_0x5788('0x0'));var util=require(_0x5788('0x1'));var path=require(_0x5788('0x2'));var timeout=require(_0x5788('0x3'));var express=require(_0x5788('0x4'));var router=express[_0x5788('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5788('0x6'));var interaction=require(_0x5788('0x7'));var config=require(_0x5788('0x8'));var controller=require(_0x5788('0x9'));router[_0x5788('0xa')]('/',auth[_0x5788('0xb')](),controller[_0x5788('0xc')]);router[_0x5788('0xa')](_0x5788('0xd'),auth['isAuthenticated'](),controller[_0x5788('0xe')]);router[_0x5788('0xa')](_0x5788('0xf'),auth[_0x5788('0xb')](),controller['getFields']);router[_0x5788('0xa')](_0x5788('0x10'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x5788('0xa')]('/:id/descriptions',auth[_0x5788('0xb')](),controller[_0x5788('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5788('0x12')]);router[_0x5788('0x13')](_0x5788('0xd'),auth[_0x5788('0xb')](),controller[_0x5788('0x14')]);router[_0x5788('0x15')](_0x5788('0xd'),auth['isAuthenticated'](),controller['destroy']);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 a2f2044..6d85db2 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 _0x4f1c=['lead','contact','nothing','sequelize','exports','STRING'];(function(_0x23a299,_0x30e49c){var _0x560bb3=function(_0x1c8073){while(--_0x1c8073){_0x23a299['push'](_0x23a299['shift']());}};_0x560bb3(++_0x30e49c);}(_0x4f1c,0x18f));var _0xc4f1=function(_0x2cea8f,_0x4a17c2){_0x2cea8f=_0x2cea8f-0x0;var _0x4a6eb4=_0x4f1c[_0x2cea8f];return _0x4a6eb4;};'use strict';var Sequelize=require(_0xc4f1('0x0'));module[_0xc4f1('0x1')]={'name':{'type':Sequelize[_0xc4f1('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xc4f1('0x3'),_0xc4f1('0x4'),_0xc4f1('0x5')),'defaultValue':_0xc4f1('0x3')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0xc4f1('0x4'),_0xc4f1('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xc4f1('0x2')]}}; \ No newline at end of file +var _0x4c07=['contact_lead','STRING','ENUM','lead','contact','nothing'];(function(_0x2c815b,_0x34e7c5){var _0x239c68=function(_0x31a1c3){while(--_0x31a1c3){_0x2c815b['push'](_0x2c815b['shift']());}};_0x239c68(++_0x34e7c5);}(_0x4c07,0x18d));var _0x74c0=function(_0x1ca890,_0x21d0d3){_0x1ca890=_0x1ca890-0x0;var _0x3f8e01=_0x4c07[_0x1ca890];return _0x3f8e01;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x74c0('0x0')]},'moduleCreate':{'type':Sequelize[_0x74c0('0x1')](_0x74c0('0x2'),_0x74c0('0x3'),_0x74c0('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x74c0('0x1')]('contact_lead',_0x74c0('0x3'),_0x74c0('0x2')),'defaultValue':_0x74c0('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 7a5578d..01177d2 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 _0x617d=['save','update','then','destroy','end','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','getFields','findOne','ZohoField','order','pick','hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x595c86,_0xf73913){var _0x1db390=function(_0x188ad6){while(--_0x188ad6){_0x595c86['push'](_0x595c86['shift']());}};_0x1db390(++_0xf73913);}(_0x617d,0x1ba));var _0xd617=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x617d[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd617('0x0'));var zipdir=require(_0xd617('0x1'));var jsonpatch=require(_0xd617('0x2'));var rp=require(_0xd617('0x3'));var moment=require(_0xd617('0x4'));var BPromise=require(_0xd617('0x5'));var Mustache=require('mustache');var util=require(_0xd617('0x6'));var path=require(_0xd617('0x7'));var sox=require(_0xd617('0x8'));var csv=require(_0xd617('0x9'));var ejs=require(_0xd617('0xa'));var fs=require('fs');var fs_extra=require(_0xd617('0xb'));var _=require(_0xd617('0xc'));var squel=require(_0xd617('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd617('0x9'));var querystring=require('querystring');var Papa=require(_0xd617('0xe'));var Redis=require(_0xd617('0xf'));var authService=require(_0xd617('0x10'));var qs=require(_0xd617('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd617('0x12'))(_0xd617('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd617('0x14'));var db=require(_0xd617('0x15'))['db'];function respondWithStatusCode(_0x43845f,_0x269bec){_0x269bec=_0x269bec||0xcc;return function(_0x533275){if(_0x533275){return _0x43845f[_0xd617('0x16')](_0x269bec);}return _0x43845f[_0xd617('0x17')](_0x269bec)['end']();};}function respondWithResult(_0x35348c,_0x5ca9ae){_0x5ca9ae=_0x5ca9ae||0xc8;return function(_0xe16ad2){if(_0xe16ad2){return _0x35348c['status'](_0x5ca9ae)[_0xd617('0x18')](_0xe16ad2);}};}function respondWithFilteredResult(_0x3e2b3f,_0x4032f5){return function(_0x236a29){if(_0x236a29){var _0x1f5d5c=typeof _0x4032f5[_0xd617('0x19')]===_0xd617('0x1a')&&typeof _0x4032f5[_0xd617('0x1b')]===_0xd617('0x1a');var _0x5d7281=_0x236a29[_0xd617('0x1c')];var _0x2ed4d8=_0x1f5d5c?0x0:_0x4032f5[_0xd617('0x19')];var _0x2ec07c=_0x1f5d5c?_0x236a29['count']:_0x4032f5[_0xd617('0x19')]+_0x4032f5[_0xd617('0x1b')];var _0x31cbdf;if(_0x2ec07c>=_0x5d7281){_0x2ec07c=_0x5d7281;_0x31cbdf=0xc8;}else{_0x31cbdf=0xce;}_0x3e2b3f[_0xd617('0x17')](_0x31cbdf);return _0x3e2b3f[_0xd617('0x1d')](_0xd617('0x1e'),_0x2ed4d8+'-'+_0x2ec07c+'/'+_0x5d7281)[_0xd617('0x18')](_0x236a29);}return null;};}function patchUpdates(_0x2caccb){return function(_0x169dcb){try{jsonpatch[_0xd617('0x1f')](_0x169dcb,_0x2caccb,!![]);}catch(_0x15f13d){return BPromise['reject'](_0x15f13d);}return _0x169dcb[_0xd617('0x20')]();};}function saveUpdates(_0x306d3c,_0x2dc45b){return function(_0x5e67c6){if(_0x5e67c6){return _0x5e67c6[_0xd617('0x21')](_0x306d3c)[_0xd617('0x22')](function(_0x499a02){return _0x499a02;});}return null;};}function removeEntity(_0x174c64,_0x4dbafe){return function(_0x5ee7bf){if(_0x5ee7bf){return _0x5ee7bf[_0xd617('0x23')]()[_0xd617('0x22')](function(){_0x174c64[_0xd617('0x17')](0xcc)[_0xd617('0x24')]();});}};}function handleEntityNotFound(_0x4254f4,_0x1cf7bd){return function(_0x388602){if(!_0x388602){_0x4254f4['sendStatus'](0x194);}return _0x388602;};}function handleError(_0x3236ac,_0x220e30){_0x220e30=_0x220e30||0x1f4;return function(_0x19bc17){logger['error'](_0x19bc17[_0xd617('0x25')]);if(_0x19bc17[_0xd617('0x26')]){delete _0x19bc17[_0xd617('0x26')];}_0x3236ac[_0xd617('0x17')](_0x220e30)[_0xd617('0x27')](_0x19bc17);};}exports['index']=function(_0x3ff478,_0x2acff3){var _0x1c3fa0={},_0x1950d1={},_0x4cc5fb={'count':0x0,'rows':[]};var _0x47afa6=_[_0xd617('0x28')](db[_0xd617('0x29')][_0xd617('0x2a')],function(_0x503ff7){return{'name':_0x503ff7[_0xd617('0x2b')],'type':_0x503ff7[_0xd617('0x2c')][_0xd617('0x2d')]};});_0x1950d1['model']=_['map'](_0x47afa6,_0xd617('0x26'));_0x1950d1[_0xd617('0x2e')]=_['keys'](_0x3ff478[_0xd617('0x2e')]);_0x1950d1['filters']=_[_0xd617('0x2f')](_0x1950d1[_0xd617('0x30')],_0x1950d1['query']);_0x1c3fa0[_0xd617('0x31')]=_[_0xd617('0x2f')](_0x1950d1['model'],qs['fields'](_0x3ff478[_0xd617('0x2e')][_0xd617('0x32')]));_0x1c3fa0[_0xd617('0x31')]=_0x1c3fa0[_0xd617('0x31')]['length']?_0x1c3fa0['attributes']:_0x1950d1[_0xd617('0x30')];if(!_0x3ff478[_0xd617('0x2e')]['hasOwnProperty'](_0xd617('0x33'))){_0x1c3fa0[_0xd617('0x1b')]=qs['limit'](_0x3ff478[_0xd617('0x2e')][_0xd617('0x1b')]);_0x1c3fa0[_0xd617('0x19')]=qs[_0xd617('0x19')](_0x3ff478[_0xd617('0x2e')][_0xd617('0x19')]);}_0x1c3fa0['order']=qs['sort'](_0x3ff478['query'][_0xd617('0x34')]);_0x1c3fa0['where']=qs[_0xd617('0x35')](_['pick'](_0x3ff478['query'],_0x1950d1[_0xd617('0x35')]),_0x47afa6);if(_0x3ff478['query'][_0xd617('0x36')]){_0x1c3fa0[_0xd617('0x37')]=_[_0xd617('0x38')](_0x1c3fa0[_0xd617('0x37')],{'$or':_[_0xd617('0x28')](_0x47afa6,function(_0x37fd7e){if(_0x37fd7e[_0xd617('0x2c')]!==_0xd617('0x39')){var _0x4febeb={};_0x4febeb[_0x37fd7e[_0xd617('0x26')]]={'$like':'%'+_0x3ff478[_0xd617('0x2e')][_0xd617('0x36')]+'%'};return _0x4febeb;}})});}_0x1c3fa0=_[_0xd617('0x38')]({},_0x1c3fa0,_0x3ff478[_0xd617('0x3a')]);var _0x197327={'where':_0x1c3fa0[_0xd617('0x37')]};return db[_0xd617('0x29')]['count'](_0x197327)[_0xd617('0x22')](function(_0x1c619f){_0x4cc5fb['count']=_0x1c619f;if(_0x3ff478[_0xd617('0x2e')][_0xd617('0x3b')]){_0x1c3fa0[_0xd617('0x3c')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xd617('0x3d')](_0x1c3fa0);})[_0xd617('0x22')](function(_0x148d46){_0x4cc5fb[_0xd617('0x3e')]=_0x148d46;return _0x4cc5fb;})['then'](respondWithFilteredResult(_0x2acff3,_0x1c3fa0))[_0xd617('0x3f')](handleError(_0x2acff3,null));};exports[_0xd617('0x40')]=function(_0x576dab,_0x2f398d){var _0x5077f4={'raw':![],'where':{'id':_0x576dab[_0xd617('0x41')]['id']}},_0x3e64aa={};_0x3e64aa[_0xd617('0x30')]=_[_0xd617('0x42')](db[_0xd617('0x29')]['rawAttributes']);_0x3e64aa[_0xd617('0x2e')]=_[_0xd617('0x42')](_0x576dab['query']);_0x3e64aa[_0xd617('0x35')]=_['intersection'](_0x3e64aa[_0xd617('0x30')],_0x3e64aa[_0xd617('0x2e')]);_0x5077f4[_0xd617('0x31')]=_[_0xd617('0x2f')](_0x3e64aa['model'],qs[_0xd617('0x32')](_0x576dab[_0xd617('0x2e')][_0xd617('0x32')]));_0x5077f4['attributes']=_0x5077f4[_0xd617('0x31')][_0xd617('0x43')]?_0x5077f4['attributes']:_0x3e64aa[_0xd617('0x30')];if(_0x576dab[_0xd617('0x2e')]['includeAll']){_0x5077f4[_0xd617('0x3c')]=[{'all':!![]}];}_0x5077f4=_[_0xd617('0x38')]({},_0x5077f4,_0x576dab[_0xd617('0x3a')]);return db['ZohoConfiguration'][_0xd617('0x44')](_0x5077f4)[_0xd617('0x22')](handleEntityNotFound(_0x2f398d,null))['then'](respondWithResult(_0x2f398d,null))['catch'](handleError(_0x2f398d,null));};exports[_0xd617('0x45')]=function(_0x9daf0,_0x1fe3f5){return db[_0xd617('0x29')][_0xd617('0x45')](_0x9daf0[_0xd617('0x46')],{})[_0xd617('0x22')](respondWithResult(_0x1fe3f5,0xc9))[_0xd617('0x3f')](handleError(_0x1fe3f5,null));};exports[_0xd617('0x21')]=function(_0x2f7ce3,_0x10fd9d){if(_0x2f7ce3[_0xd617('0x46')]['id']){delete _0x2f7ce3[_0xd617('0x46')]['id'];}return db[_0xd617('0x29')][_0xd617('0x44')]({'where':{'id':_0x2f7ce3['params']['id']}})[_0xd617('0x22')](handleEntityNotFound(_0x10fd9d,null))[_0xd617('0x22')](saveUpdates(_0x2f7ce3[_0xd617('0x46')],null))[_0xd617('0x22')](respondWithResult(_0x10fd9d,null))[_0xd617('0x3f')](handleError(_0x10fd9d,null));};exports['destroy']=function(_0x3f0c8c,_0x3dfc2d){return db[_0xd617('0x29')][_0xd617('0x44')]({'where':{'id':_0x3f0c8c[_0xd617('0x41')]['id']}})[_0xd617('0x22')](handleEntityNotFound(_0x3dfc2d,null))[_0xd617('0x22')](removeEntity(_0x3dfc2d,null))[_0xd617('0x3f')](handleError(_0x3dfc2d,null));};exports[_0xd617('0x47')]=function(_0x7f4c0e,_0x1d53bc,_0x3c28a6){var _0x46bf6b={};var _0x6aaebd={};var _0x1b19fe;var _0x3fa5b9;return db[_0xd617('0x29')][_0xd617('0x48')]({'where':{'id':_0x7f4c0e[_0xd617('0x41')]['id']}})[_0xd617('0x22')](handleEntityNotFound(_0x1d53bc,null))['then'](function(_0x3ba091){if(_0x3ba091){_0x1b19fe=_0x3ba091;_0x6aaebd[_0xd617('0x30')]=_['keys'](db[_0xd617('0x49')]['rawAttributes']);_0x6aaebd[_0xd617('0x2e')]=_[_0xd617('0x42')](_0x7f4c0e[_0xd617('0x2e')]);_0x6aaebd[_0xd617('0x35')]=_['intersection'](_0x6aaebd[_0xd617('0x30')],_0x6aaebd[_0xd617('0x2e')]);_0x46bf6b[_0xd617('0x31')]=_[_0xd617('0x2f')](_0x6aaebd[_0xd617('0x30')],qs[_0xd617('0x32')](_0x7f4c0e[_0xd617('0x2e')][_0xd617('0x32')]));_0x46bf6b[_0xd617('0x31')]=_0x46bf6b['attributes'][_0xd617('0x43')]?_0x46bf6b[_0xd617('0x31')]:_0x6aaebd[_0xd617('0x30')];_0x46bf6b[_0xd617('0x4a')]=qs['sort'](_0x7f4c0e[_0xd617('0x2e')][_0xd617('0x34')]);_0x46bf6b[_0xd617('0x37')]=qs[_0xd617('0x35')](_[_0xd617('0x4b')](_0x7f4c0e[_0xd617('0x2e')],_0x6aaebd[_0xd617('0x35')]));if(_0x7f4c0e[_0xd617('0x2e')][_0xd617('0x36')]){_0x46bf6b[_0xd617('0x37')]=_['merge'](_0x46bf6b[_0xd617('0x37')],{'$or':_['map'](_0x46bf6b['attributes'],function(_0x1ddec7){var _0x356939={};_0x356939[_0x1ddec7]={'$like':'%'+_0x7f4c0e[_0xd617('0x2e')][_0xd617('0x36')]+'%'};return _0x356939;})});}_0x46bf6b=_[_0xd617('0x38')]({},_0x46bf6b,_0x7f4c0e[_0xd617('0x3a')]);return _0x1b19fe[_0xd617('0x47')](_0x46bf6b);}})[_0xd617('0x22')](function(_0x42914e){if(_0x42914e){_0x3fa5b9=_0x42914e[_0xd617('0x43')];if(!_0x7f4c0e[_0xd617('0x2e')][_0xd617('0x4c')](_0xd617('0x33'))){_0x46bf6b[_0xd617('0x1b')]=qs['limit'](_0x7f4c0e[_0xd617('0x2e')][_0xd617('0x1b')]);_0x46bf6b['offset']=qs['offset'](_0x7f4c0e['query'][_0xd617('0x19')]);}return _0x1b19fe[_0xd617('0x47')](_0x46bf6b);}})[_0xd617('0x22')](function(_0x8d888e){if(_0x8d888e){return _0x8d888e?{'count':_0x3fa5b9,'rows':_0x8d888e}:null;}})[_0xd617('0x22')](respondWithResult(_0x1d53bc,null))[_0xd617('0x3f')](handleError(_0x1d53bc,null));};exports[_0xd617('0x4d')]=function(_0x5e3d61,_0x307090,_0x58ba94){var _0x24309e={};var _0x450241={};var _0x567968;var _0x2709bd;return db[_0xd617('0x29')][_0xd617('0x48')]({'where':{'id':_0x5e3d61['params']['id']}})['then'](handleEntityNotFound(_0x307090,null))[_0xd617('0x22')](function(_0x531b0c){if(_0x531b0c){_0x567968=_0x531b0c;_0x450241['model']=_['keys'](db['ZohoField']['rawAttributes']);_0x450241[_0xd617('0x2e')]=_[_0xd617('0x42')](_0x5e3d61[_0xd617('0x2e')]);_0x450241['filters']=_[_0xd617('0x2f')](_0x450241[_0xd617('0x30')],_0x450241[_0xd617('0x2e')]);_0x24309e[_0xd617('0x31')]=_[_0xd617('0x2f')](_0x450241[_0xd617('0x30')],qs[_0xd617('0x32')](_0x5e3d61[_0xd617('0x2e')][_0xd617('0x32')]));_0x24309e[_0xd617('0x31')]=_0x24309e['attributes'][_0xd617('0x43')]?_0x24309e['attributes']:_0x450241[_0xd617('0x30')];_0x24309e[_0xd617('0x4a')]=qs[_0xd617('0x34')](_0x5e3d61['query'][_0xd617('0x34')]);_0x24309e['where']=qs['filters'](_[_0xd617('0x4b')](_0x5e3d61['query'],_0x450241[_0xd617('0x35')]));if(_0x5e3d61['query'][_0xd617('0x36')]){_0x24309e[_0xd617('0x37')]=_['merge'](_0x24309e[_0xd617('0x37')],{'$or':_[_0xd617('0x28')](_0x24309e[_0xd617('0x31')],function(_0x88591d){var _0x4c6d06={};_0x4c6d06[_0x88591d]={'$like':'%'+_0x5e3d61[_0xd617('0x2e')][_0xd617('0x36')]+'%'};return _0x4c6d06;})});}_0x24309e=_['merge']({},_0x24309e,_0x5e3d61[_0xd617('0x3a')]);return _0x567968['getSubjects'](_0x24309e);}})[_0xd617('0x22')](function(_0x145c99){if(_0x145c99){_0x2709bd=_0x145c99[_0xd617('0x43')];if(!_0x5e3d61[_0xd617('0x2e')][_0xd617('0x4c')](_0xd617('0x33'))){_0x24309e['limit']=qs[_0xd617('0x1b')](_0x5e3d61[_0xd617('0x2e')][_0xd617('0x1b')]);_0x24309e[_0xd617('0x19')]=qs[_0xd617('0x19')](_0x5e3d61[_0xd617('0x2e')][_0xd617('0x19')]);}return _0x567968['getSubjects'](_0x24309e);}})[_0xd617('0x22')](function(_0x25e176){if(_0x25e176){return _0x25e176?{'count':_0x2709bd,'rows':_0x25e176}:null;}})[_0xd617('0x22')](respondWithResult(_0x307090,null))[_0xd617('0x3f')](handleError(_0x307090,null));};exports[_0xd617('0x4e')]=function(_0x1410d3,_0x58c922,_0x299c1d){var _0x3a6f64={};var _0x13abe2={};var _0x18dcf9;var _0x49115d;return db[_0xd617('0x29')][_0xd617('0x48')]({'where':{'id':_0x1410d3[_0xd617('0x41')]['id']}})['then'](handleEntityNotFound(_0x58c922,null))[_0xd617('0x22')](function(_0xb661df){if(_0xb661df){_0x18dcf9=_0xb661df;_0x13abe2[_0xd617('0x30')]=_[_0xd617('0x42')](db[_0xd617('0x49')]['rawAttributes']);_0x13abe2['query']=_[_0xd617('0x42')](_0x1410d3['query']);_0x13abe2[_0xd617('0x35')]=_[_0xd617('0x2f')](_0x13abe2[_0xd617('0x30')],_0x13abe2[_0xd617('0x2e')]);_0x3a6f64['attributes']=_[_0xd617('0x2f')](_0x13abe2[_0xd617('0x30')],qs[_0xd617('0x32')](_0x1410d3['query'][_0xd617('0x32')]));_0x3a6f64[_0xd617('0x31')]=_0x3a6f64['attributes'][_0xd617('0x43')]?_0x3a6f64[_0xd617('0x31')]:_0x13abe2['model'];_0x3a6f64['order']=qs['sort'](_0x1410d3[_0xd617('0x2e')][_0xd617('0x34')]);_0x3a6f64[_0xd617('0x37')]=qs[_0xd617('0x35')](_[_0xd617('0x4b')](_0x1410d3[_0xd617('0x2e')],_0x13abe2['filters']));if(_0x1410d3[_0xd617('0x2e')][_0xd617('0x36')]){_0x3a6f64['where']=_[_0xd617('0x38')](_0x3a6f64[_0xd617('0x37')],{'$or':_[_0xd617('0x28')](_0x3a6f64[_0xd617('0x31')],function(_0x38f49c){var _0xff481d={};_0xff481d[_0x38f49c]={'$like':'%'+_0x1410d3['query'][_0xd617('0x36')]+'%'};return _0xff481d;})});}_0x3a6f64=_[_0xd617('0x38')]({},_0x3a6f64,_0x1410d3[_0xd617('0x3a')]);return _0x18dcf9['getDescriptions'](_0x3a6f64);}})[_0xd617('0x22')](function(_0x1403a6){if(_0x1403a6){_0x49115d=_0x1403a6[_0xd617('0x43')];if(!_0x1410d3['query'][_0xd617('0x4c')](_0xd617('0x33'))){_0x3a6f64[_0xd617('0x1b')]=qs[_0xd617('0x1b')](_0x1410d3[_0xd617('0x2e')][_0xd617('0x1b')]);_0x3a6f64[_0xd617('0x19')]=qs['offset'](_0x1410d3['query']['offset']);}return _0x18dcf9[_0xd617('0x4e')](_0x3a6f64);}})[_0xd617('0x22')](function(_0x28a8cd){if(_0x28a8cd){return _0x28a8cd?{'count':_0x49115d,'rows':_0x28a8cd}:null;}})[_0xd617('0x22')](respondWithResult(_0x58c922,null))[_0xd617('0x3f')](handleError(_0x58c922,null));}; \ No newline at end of file +var _0x3efa=['jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','filter','options','includeAll','ZohoConfiguration','show','params','include','merge','catch','create','body','find','getFields','findOne','ZohoField','getSubjects','pick','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto'];(function(_0x1b1e76,_0x31695b){var _0x3d743a=function(_0x4ae27b){while(--_0x4ae27b){_0x1b1e76['push'](_0x1b1e76['shift']());}};_0x3d743a(++_0x31695b);}(_0x3efa,0xdd));var _0xa3ef=function(_0x18d03f,_0x3cb16b){_0x18d03f=_0x18d03f-0x0;var _0x237ff4=_0x3efa[_0x18d03f];return _0x237ff4;};'use strict';var emlformat=require(_0xa3ef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa3ef('0x1'));var jsonpatch=require(_0xa3ef('0x2'));var rp=require('request-promise');var moment=require(_0xa3ef('0x3'));var BPromise=require(_0xa3ef('0x4'));var Mustache=require(_0xa3ef('0x5'));var util=require(_0xa3ef('0x6'));var path=require(_0xa3ef('0x7'));var sox=require(_0xa3ef('0x8'));var csv=require(_0xa3ef('0x9'));var ejs=require(_0xa3ef('0xa'));var fs=require('fs');var fs_extra=require(_0xa3ef('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa3ef('0xc'));var jsforce=require(_0xa3ef('0xd'));var deskjs=require(_0xa3ef('0xe'));var toCsv=require(_0xa3ef('0x9'));var querystring=require('querystring');var Papa=require(_0xa3ef('0xf'));var Redis=require(_0xa3ef('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa3ef('0x11'));var hardwareService=require(_0xa3ef('0x12'));var logger=require('../../config/logger')(_0xa3ef('0x13'));var utils=require(_0xa3ef('0x14'));var config=require(_0xa3ef('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa3ef('0x16'))['db'];function respondWithStatusCode(_0x3d9739,_0x5725be){_0x5725be=_0x5725be||0xcc;return function(_0x310d96){if(_0x310d96){return _0x3d9739[_0xa3ef('0x17')](_0x5725be);}return _0x3d9739[_0xa3ef('0x18')](_0x5725be)[_0xa3ef('0x19')]();};}function respondWithResult(_0x2a8564,_0x43fd39){_0x43fd39=_0x43fd39||0xc8;return function(_0x100525){if(_0x100525){return _0x2a8564['status'](_0x43fd39)['json'](_0x100525);}};}function respondWithFilteredResult(_0x3a1748,_0x429768){return function(_0x2622d1){if(_0x2622d1){var _0x2eb89f=typeof _0x429768[_0xa3ef('0x1a')]==='undefined'&&typeof _0x429768[_0xa3ef('0x1b')]===_0xa3ef('0x1c');var _0x5931ae=_0x2622d1[_0xa3ef('0x1d')];var _0x267af1=_0x2eb89f?0x0:_0x429768[_0xa3ef('0x1a')];var _0x19a820=_0x2eb89f?_0x2622d1[_0xa3ef('0x1d')]:_0x429768[_0xa3ef('0x1a')]+_0x429768[_0xa3ef('0x1b')];var _0x5c94f9;if(_0x19a820>=_0x5931ae){_0x19a820=_0x5931ae;_0x5c94f9=0xc8;}else{_0x5c94f9=0xce;}_0x3a1748[_0xa3ef('0x18')](_0x5c94f9);return _0x3a1748[_0xa3ef('0x1e')](_0xa3ef('0x1f'),_0x267af1+'-'+_0x19a820+'/'+_0x5931ae)['json'](_0x2622d1);}return null;};}function patchUpdates(_0xf3d8b6){return function(_0x387a6a){try{jsonpatch[_0xa3ef('0x20')](_0x387a6a,_0xf3d8b6,!![]);}catch(_0x17bdd6){return BPromise['reject'](_0x17bdd6);}return _0x387a6a[_0xa3ef('0x21')]();};}function saveUpdates(_0x604f2c,_0x2f76f3){return function(_0x3a7e17){if(_0x3a7e17){return _0x3a7e17[_0xa3ef('0x22')](_0x604f2c)['then'](function(_0x35f922){return _0x35f922;});}return null;};}function removeEntity(_0x306201,_0x2c4f86){return function(_0x504ac0){if(_0x504ac0){return _0x504ac0[_0xa3ef('0x23')]()[_0xa3ef('0x24')](function(){_0x306201[_0xa3ef('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f8710,_0x5632e3){return function(_0x50c035){if(!_0x50c035){_0x2f8710['sendStatus'](0x194);}return _0x50c035;};}function handleError(_0x252163,_0x1626e0){_0x1626e0=_0x1626e0||0x1f4;return function(_0x209a9c){logger[_0xa3ef('0x25')](_0x209a9c[_0xa3ef('0x26')]);if(_0x209a9c[_0xa3ef('0x27')]){delete _0x209a9c['name'];}_0x252163['status'](_0x1626e0)[_0xa3ef('0x28')](_0x209a9c);};}exports[_0xa3ef('0x29')]=function(_0x4fc7db,_0x1947e9){var _0x1138b3={},_0x450764={},_0x1bd1d1={'count':0x0,'rows':[]};var _0x5eb281=_[_0xa3ef('0x2a')](db['ZohoConfiguration'][_0xa3ef('0x2b')],function(_0x3b9cf6){return{'name':_0x3b9cf6[_0xa3ef('0x2c')],'type':_0x3b9cf6[_0xa3ef('0x2d')]['key']};});_0x450764[_0xa3ef('0x2e')]=_['map'](_0x5eb281,'name');_0x450764['query']=_[_0xa3ef('0x2f')](_0x4fc7db[_0xa3ef('0x30')]);_0x450764['filters']=_[_0xa3ef('0x31')](_0x450764[_0xa3ef('0x2e')],_0x450764['query']);_0x1138b3[_0xa3ef('0x32')]=_[_0xa3ef('0x31')](_0x450764['model'],qs[_0xa3ef('0x33')](_0x4fc7db[_0xa3ef('0x30')][_0xa3ef('0x33')]));_0x1138b3[_0xa3ef('0x32')]=_0x1138b3[_0xa3ef('0x32')][_0xa3ef('0x34')]?_0x1138b3[_0xa3ef('0x32')]:_0x450764['model'];if(!_0x4fc7db[_0xa3ef('0x30')][_0xa3ef('0x35')](_0xa3ef('0x36'))){_0x1138b3[_0xa3ef('0x1b')]=qs[_0xa3ef('0x1b')](_0x4fc7db[_0xa3ef('0x30')][_0xa3ef('0x1b')]);_0x1138b3[_0xa3ef('0x1a')]=qs[_0xa3ef('0x1a')](_0x4fc7db[_0xa3ef('0x30')][_0xa3ef('0x1a')]);}_0x1138b3[_0xa3ef('0x37')]=qs[_0xa3ef('0x38')](_0x4fc7db[_0xa3ef('0x30')][_0xa3ef('0x38')]);_0x1138b3[_0xa3ef('0x39')]=qs[_0xa3ef('0x3a')](_['pick'](_0x4fc7db[_0xa3ef('0x30')],_0x450764[_0xa3ef('0x3a')]),_0x5eb281);if(_0x4fc7db[_0xa3ef('0x30')]['filter']){_0x1138b3[_0xa3ef('0x39')]=_['merge'](_0x1138b3['where'],{'$or':_[_0xa3ef('0x2a')](_0x5eb281,function(_0x2b7e6f){if(_0x2b7e6f[_0xa3ef('0x2d')]!==_0xa3ef('0x3b')){var _0x2e4868={};_0x2e4868[_0x2b7e6f['name']]={'$like':'%'+_0x4fc7db['query'][_0xa3ef('0x3c')]+'%'};return _0x2e4868;}})});}_0x1138b3=_['merge']({},_0x1138b3,_0x4fc7db[_0xa3ef('0x3d')]);var _0x22dd59={'where':_0x1138b3[_0xa3ef('0x39')]};return db['ZohoConfiguration'][_0xa3ef('0x1d')](_0x22dd59)['then'](function(_0x463c89){_0x1bd1d1[_0xa3ef('0x1d')]=_0x463c89;if(_0x4fc7db[_0xa3ef('0x30')][_0xa3ef('0x3e')]){_0x1138b3['include']=[{'all':!![]}];}return db[_0xa3ef('0x3f')]['findAll'](_0x1138b3);})[_0xa3ef('0x24')](function(_0x348c3b){_0x1bd1d1['rows']=_0x348c3b;return _0x1bd1d1;})['then'](respondWithFilteredResult(_0x1947e9,_0x1138b3))['catch'](handleError(_0x1947e9,null));};exports[_0xa3ef('0x40')]=function(_0xacf040,_0x15298f){var _0x4028a5={'raw':![],'where':{'id':_0xacf040[_0xa3ef('0x41')]['id']}},_0x1b6de0={};_0x1b6de0[_0xa3ef('0x2e')]=_[_0xa3ef('0x2f')](db[_0xa3ef('0x3f')][_0xa3ef('0x2b')]);_0x1b6de0[_0xa3ef('0x30')]=_[_0xa3ef('0x2f')](_0xacf040[_0xa3ef('0x30')]);_0x1b6de0[_0xa3ef('0x3a')]=_[_0xa3ef('0x31')](_0x1b6de0[_0xa3ef('0x2e')],_0x1b6de0[_0xa3ef('0x30')]);_0x4028a5[_0xa3ef('0x32')]=_[_0xa3ef('0x31')](_0x1b6de0[_0xa3ef('0x2e')],qs['fields'](_0xacf040[_0xa3ef('0x30')]['fields']));_0x4028a5[_0xa3ef('0x32')]=_0x4028a5[_0xa3ef('0x32')]['length']?_0x4028a5['attributes']:_0x1b6de0['model'];if(_0xacf040[_0xa3ef('0x30')][_0xa3ef('0x3e')]){_0x4028a5[_0xa3ef('0x42')]=[{'all':!![]}];}_0x4028a5=_[_0xa3ef('0x43')]({},_0x4028a5,_0xacf040[_0xa3ef('0x3d')]);return db[_0xa3ef('0x3f')]['find'](_0x4028a5)[_0xa3ef('0x24')](handleEntityNotFound(_0x15298f,null))[_0xa3ef('0x24')](respondWithResult(_0x15298f,null))[_0xa3ef('0x44')](handleError(_0x15298f,null));};exports['create']=function(_0x4f6c72,_0x53d844){return db[_0xa3ef('0x3f')][_0xa3ef('0x45')](_0x4f6c72[_0xa3ef('0x46')],{})[_0xa3ef('0x24')](respondWithResult(_0x53d844,0xc9))[_0xa3ef('0x44')](handleError(_0x53d844,null));};exports[_0xa3ef('0x22')]=function(_0x2d8845,_0x11f8c5){if(_0x2d8845[_0xa3ef('0x46')]['id']){delete _0x2d8845[_0xa3ef('0x46')]['id'];}return db['ZohoConfiguration'][_0xa3ef('0x47')]({'where':{'id':_0x2d8845['params']['id']}})[_0xa3ef('0x24')](handleEntityNotFound(_0x11f8c5,null))[_0xa3ef('0x24')](saveUpdates(_0x2d8845[_0xa3ef('0x46')],null))[_0xa3ef('0x24')](respondWithResult(_0x11f8c5,null))['catch'](handleError(_0x11f8c5,null));};exports[_0xa3ef('0x23')]=function(_0x12b30a,_0x20a7a7){return db[_0xa3ef('0x3f')][_0xa3ef('0x47')]({'where':{'id':_0x12b30a['params']['id']}})['then'](handleEntityNotFound(_0x20a7a7,null))[_0xa3ef('0x24')](removeEntity(_0x20a7a7,null))[_0xa3ef('0x44')](handleError(_0x20a7a7,null));};exports[_0xa3ef('0x48')]=function(_0x22462f,_0x3de766,_0x3e092b){var _0x31f550={};var _0x4176d9={};var _0x377b89;var _0x488d8b;return db[_0xa3ef('0x3f')][_0xa3ef('0x49')]({'where':{'id':_0x22462f[_0xa3ef('0x41')]['id']}})[_0xa3ef('0x24')](handleEntityNotFound(_0x3de766,null))['then'](function(_0x1e9851){if(_0x1e9851){_0x377b89=_0x1e9851;_0x4176d9['model']=_[_0xa3ef('0x2f')](db[_0xa3ef('0x4a')]['rawAttributes']);_0x4176d9[_0xa3ef('0x30')]=_[_0xa3ef('0x2f')](_0x22462f[_0xa3ef('0x30')]);_0x4176d9['filters']=_[_0xa3ef('0x31')](_0x4176d9['model'],_0x4176d9[_0xa3ef('0x30')]);_0x31f550['attributes']=_['intersection'](_0x4176d9[_0xa3ef('0x2e')],qs[_0xa3ef('0x33')](_0x22462f[_0xa3ef('0x30')][_0xa3ef('0x33')]));_0x31f550[_0xa3ef('0x32')]=_0x31f550[_0xa3ef('0x32')][_0xa3ef('0x34')]?_0x31f550['attributes']:_0x4176d9[_0xa3ef('0x2e')];_0x31f550[_0xa3ef('0x37')]=qs[_0xa3ef('0x38')](_0x22462f[_0xa3ef('0x30')][_0xa3ef('0x38')]);_0x31f550[_0xa3ef('0x39')]=qs[_0xa3ef('0x3a')](_['pick'](_0x22462f[_0xa3ef('0x30')],_0x4176d9['filters']));if(_0x22462f['query'][_0xa3ef('0x3c')]){_0x31f550[_0xa3ef('0x39')]=_[_0xa3ef('0x43')](_0x31f550[_0xa3ef('0x39')],{'$or':_[_0xa3ef('0x2a')](_0x31f550[_0xa3ef('0x32')],function(_0x49dfa5){var _0x37cd31={};_0x37cd31[_0x49dfa5]={'$like':'%'+_0x22462f[_0xa3ef('0x30')][_0xa3ef('0x3c')]+'%'};return _0x37cd31;})});}_0x31f550=_[_0xa3ef('0x43')]({},_0x31f550,_0x22462f['options']);return _0x377b89[_0xa3ef('0x48')](_0x31f550);}})[_0xa3ef('0x24')](function(_0x58d887){if(_0x58d887){_0x488d8b=_0x58d887[_0xa3ef('0x34')];if(!_0x22462f[_0xa3ef('0x30')][_0xa3ef('0x35')](_0xa3ef('0x36'))){_0x31f550[_0xa3ef('0x1b')]=qs['limit'](_0x22462f['query'][_0xa3ef('0x1b')]);_0x31f550[_0xa3ef('0x1a')]=qs['offset'](_0x22462f[_0xa3ef('0x30')][_0xa3ef('0x1a')]);}return _0x377b89[_0xa3ef('0x48')](_0x31f550);}})[_0xa3ef('0x24')](function(_0xc086d1){if(_0xc086d1){return _0xc086d1?{'count':_0x488d8b,'rows':_0xc086d1}:null;}})[_0xa3ef('0x24')](respondWithResult(_0x3de766,null))[_0xa3ef('0x44')](handleError(_0x3de766,null));};exports[_0xa3ef('0x4b')]=function(_0x441945,_0x6b213d,_0x34b532){var _0x3538f6={};var _0xd9635={};var _0x4c6dca;var _0x309d1e;return db['ZohoConfiguration'][_0xa3ef('0x49')]({'where':{'id':_0x441945[_0xa3ef('0x41')]['id']}})[_0xa3ef('0x24')](handleEntityNotFound(_0x6b213d,null))['then'](function(_0x5b5eb1){if(_0x5b5eb1){_0x4c6dca=_0x5b5eb1;_0xd9635[_0xa3ef('0x2e')]=_['keys'](db[_0xa3ef('0x4a')]['rawAttributes']);_0xd9635[_0xa3ef('0x30')]=_['keys'](_0x441945[_0xa3ef('0x30')]);_0xd9635[_0xa3ef('0x3a')]=_[_0xa3ef('0x31')](_0xd9635['model'],_0xd9635['query']);_0x3538f6[_0xa3ef('0x32')]=_[_0xa3ef('0x31')](_0xd9635['model'],qs[_0xa3ef('0x33')](_0x441945['query'][_0xa3ef('0x33')]));_0x3538f6['attributes']=_0x3538f6[_0xa3ef('0x32')]['length']?_0x3538f6[_0xa3ef('0x32')]:_0xd9635['model'];_0x3538f6[_0xa3ef('0x37')]=qs[_0xa3ef('0x38')](_0x441945[_0xa3ef('0x30')]['sort']);_0x3538f6[_0xa3ef('0x39')]=qs['filters'](_[_0xa3ef('0x4c')](_0x441945['query'],_0xd9635[_0xa3ef('0x3a')]));if(_0x441945[_0xa3ef('0x30')][_0xa3ef('0x3c')]){_0x3538f6['where']=_['merge'](_0x3538f6[_0xa3ef('0x39')],{'$or':_[_0xa3ef('0x2a')](_0x3538f6[_0xa3ef('0x32')],function(_0x4ddc0f){var _0x5f07c3={};_0x5f07c3[_0x4ddc0f]={'$like':'%'+_0x441945[_0xa3ef('0x30')][_0xa3ef('0x3c')]+'%'};return _0x5f07c3;})});}_0x3538f6=_[_0xa3ef('0x43')]({},_0x3538f6,_0x441945[_0xa3ef('0x3d')]);return _0x4c6dca['getSubjects'](_0x3538f6);}})[_0xa3ef('0x24')](function(_0x41a863){if(_0x41a863){_0x309d1e=_0x41a863[_0xa3ef('0x34')];if(!_0x441945[_0xa3ef('0x30')][_0xa3ef('0x35')](_0xa3ef('0x36'))){_0x3538f6[_0xa3ef('0x1b')]=qs['limit'](_0x441945[_0xa3ef('0x30')][_0xa3ef('0x1b')]);_0x3538f6[_0xa3ef('0x1a')]=qs['offset'](_0x441945[_0xa3ef('0x30')]['offset']);}return _0x4c6dca[_0xa3ef('0x4b')](_0x3538f6);}})[_0xa3ef('0x24')](function(_0x2b501b){if(_0x2b501b){return _0x2b501b?{'count':_0x309d1e,'rows':_0x2b501b}:null;}})[_0xa3ef('0x24')](respondWithResult(_0x6b213d,null))[_0xa3ef('0x44')](handleError(_0x6b213d,null));};exports[_0xa3ef('0x4d')]=function(_0x1a464f,_0x5b2727,_0x4e6725){var _0x1c9f08={};var _0x51f099={};var _0x16fef8;var _0x1702e2;return db[_0xa3ef('0x3f')][_0xa3ef('0x49')]({'where':{'id':_0x1a464f[_0xa3ef('0x41')]['id']}})[_0xa3ef('0x24')](handleEntityNotFound(_0x5b2727,null))[_0xa3ef('0x24')](function(_0x2c49cf){if(_0x2c49cf){_0x16fef8=_0x2c49cf;_0x51f099[_0xa3ef('0x2e')]=_[_0xa3ef('0x2f')](db[_0xa3ef('0x4a')]['rawAttributes']);_0x51f099[_0xa3ef('0x30')]=_[_0xa3ef('0x2f')](_0x1a464f[_0xa3ef('0x30')]);_0x51f099[_0xa3ef('0x3a')]=_[_0xa3ef('0x31')](_0x51f099[_0xa3ef('0x2e')],_0x51f099['query']);_0x1c9f08[_0xa3ef('0x32')]=_['intersection'](_0x51f099[_0xa3ef('0x2e')],qs[_0xa3ef('0x33')](_0x1a464f['query']['fields']));_0x1c9f08[_0xa3ef('0x32')]=_0x1c9f08[_0xa3ef('0x32')][_0xa3ef('0x34')]?_0x1c9f08[_0xa3ef('0x32')]:_0x51f099['model'];_0x1c9f08[_0xa3ef('0x37')]=qs[_0xa3ef('0x38')](_0x1a464f[_0xa3ef('0x30')][_0xa3ef('0x38')]);_0x1c9f08[_0xa3ef('0x39')]=qs[_0xa3ef('0x3a')](_[_0xa3ef('0x4c')](_0x1a464f[_0xa3ef('0x30')],_0x51f099[_0xa3ef('0x3a')]));if(_0x1a464f[_0xa3ef('0x30')][_0xa3ef('0x3c')]){_0x1c9f08[_0xa3ef('0x39')]=_['merge'](_0x1c9f08[_0xa3ef('0x39')],{'$or':_['map'](_0x1c9f08[_0xa3ef('0x32')],function(_0x5cf998){var _0x1ba6cd={};_0x1ba6cd[_0x5cf998]={'$like':'%'+_0x1a464f[_0xa3ef('0x30')][_0xa3ef('0x3c')]+'%'};return _0x1ba6cd;})});}_0x1c9f08=_[_0xa3ef('0x43')]({},_0x1c9f08,_0x1a464f[_0xa3ef('0x3d')]);return _0x16fef8[_0xa3ef('0x4d')](_0x1c9f08);}})[_0xa3ef('0x24')](function(_0x4abe26){if(_0x4abe26){_0x1702e2=_0x4abe26[_0xa3ef('0x34')];if(!_0x1a464f[_0xa3ef('0x30')][_0xa3ef('0x35')](_0xa3ef('0x36'))){_0x1c9f08['limit']=qs[_0xa3ef('0x1b')](_0x1a464f[_0xa3ef('0x30')][_0xa3ef('0x1b')]);_0x1c9f08[_0xa3ef('0x1a')]=qs[_0xa3ef('0x1a')](_0x1a464f[_0xa3ef('0x30')]['offset']);}return _0x16fef8[_0xa3ef('0x4d')](_0x1c9f08);}})[_0xa3ef('0x24')](function(_0x328af6){if(_0x328af6){return _0x328af6?{'count':_0x1702e2,'rows':_0x328af6}:null;}})[_0xa3ef('0x24')](respondWithResult(_0x5b2727,null))[_0xa3ef('0x44')](handleError(_0x5b2727,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 707ea77..0c11eb2 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 _0x855a=['moment','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','define','int_zoho_configurations','util','../../config/logger','api'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x855a,0x168));var _0xa855=function(_0x156dba,_0x4e513e){_0x156dba=_0x156dba-0x0;var _0xa401c=_0x855a[_0x156dba];return _0xa401c;};'use strict';var _=require('lodash');var util=require(_0xa855('0x0'));var logger=require(_0xa855('0x1'))(_0xa855('0x2'));var moment=require(_0xa855('0x3'));var BPromise=require('bluebird');var rp=require(_0xa855('0x4'));var fs=require('fs');var path=require(_0xa855('0x5'));var rimraf=require('rimraf');var config=require(_0xa855('0x6'));var attributes=require(_0xa855('0x7'));module[_0xa855('0x8')]=function(_0x214248,_0x7b5a9){return _0x214248[_0xa855('0x9')]('ZohoConfiguration',attributes,{'tableName':_0xa855('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x663e=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations'];(function(_0x2d6423,_0x3f3d8e){var _0x3b39a4=function(_0x4d4e29){while(--_0x4d4e29){_0x2d6423['push'](_0x2d6423['shift']());}};_0x3b39a4(++_0x3f3d8e);}(_0x663e,0x1cc));var _0xe663=function(_0x5827b5,_0x4d447b){_0x5827b5=_0x5827b5-0x0;var _0x26b301=_0x663e[_0x5827b5];return _0x26b301;};'use strict';var _=require('lodash');var util=require(_0xe663('0x0'));var logger=require(_0xe663('0x1'))('api');var moment=require(_0xe663('0x2'));var BPromise=require('bluebird');var rp=require(_0xe663('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe663('0x4'));var config=require(_0xe663('0x5'));var attributes=require(_0xe663('0x6'));module[_0xe663('0x7')]=function(_0x35d1c6,_0x2cc8fc){return _0x35d1c6['define'](_0xe663('0x8'),attributes,{'tableName':_0xe663('0x9'),'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 fb417da..d0aec2f 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 _0xb171=['jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb171,0x199));var _0x1b17=function(_0x413430,_0x51d70b){_0x413430=_0x413430-0x0;var _0x122170=_0xb171[_0x413430];return _0x122170;};'use strict';var _=require('lodash');var util=require(_0x1b17('0x0'));var moment=require(_0x1b17('0x1'));var BPromise=require(_0x1b17('0x2'));var rs=require(_0x1b17('0x3'));var fs=require('fs');var Redis=require(_0x1b17('0x4'));var db=require(_0x1b17('0x5'))['db'];var utils=require(_0x1b17('0x6'));var logger=require('../../config/logger')(_0x1b17('0x7'));var config=require(_0x1b17('0x8'));var jayson=require(_0x1b17('0x9'));var client=jayson[_0x1b17('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54b301,_0x5ebdc5,_0x5bbf75){return new BPromise(function(_0x24b894,_0x2fc557){return client[_0x1b17('0xb')](_0x54b301,_0x5bbf75)[_0x1b17('0xc')](function(_0x2c354a){logger[_0x1b17('0xd')](_0x1b17('0xe'),_0x5ebdc5,'request\x20sent');logger[_0x1b17('0xf')](_0x1b17('0x10'),_0x5ebdc5,_0x1b17('0x11'),JSON['stringify'](_0x2c354a));if(_0x2c354a[_0x1b17('0x12')]){if(_0x2c354a[_0x1b17('0x12')]['code']===0x1f4){logger[_0x1b17('0x12')](_0x1b17('0xe'),_0x5ebdc5,_0x2c354a[_0x1b17('0x12')]['message']);return _0x2fc557(_0x2c354a[_0x1b17('0x12')]['message']);}logger[_0x1b17('0x12')](_0x1b17('0xe'),_0x5ebdc5,_0x2c354a['error'][_0x1b17('0x13')]);return _0x24b894(_0x2c354a['error'][_0x1b17('0x13')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x5ebdc5,_0x1b17('0x11'));_0x24b894(_0x2c354a[_0x1b17('0x14')][_0x1b17('0x13')]);}})[_0x1b17('0x15')](function(_0x27998a){logger[_0x1b17('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x5ebdc5,_0x27998a);_0x2fc557(_0x27998a);});});} \ No newline at end of file +var _0x7d41=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x455d4b,_0x34d37b){var _0xfbab35=function(_0x10f70f){while(--_0x10f70f){_0x455d4b['push'](_0x455d4b['shift']());}};_0xfbab35(++_0x34d37b);}(_0x7d41,0x7d));var _0x17d4=function(_0x24f565,_0x5739e0){_0x24f565=_0x24f565-0x0;var _0x32e147=_0x7d41[_0x24f565];return _0x32e147;};'use strict';var _=require(_0x17d4('0x0'));var util=require(_0x17d4('0x1'));var moment=require('moment');var BPromise=require(_0x17d4('0x2'));var rs=require(_0x17d4('0x3'));var fs=require('fs');var Redis=require(_0x17d4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x17d4('0x5'));var logger=require(_0x17d4('0x6'))(_0x17d4('0x7'));var config=require(_0x17d4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x17d4('0x9')][_0x17d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d39a8,_0x357cd2,_0x3177ca){return new BPromise(function(_0x315e52,_0x3d3064){return client[_0x17d4('0xb')](_0x4d39a8,_0x3177ca)['then'](function(_0x27d088){logger[_0x17d4('0xc')](_0x17d4('0xd'),_0x357cd2,_0x17d4('0xe'));logger['debug'](_0x17d4('0xf'),_0x357cd2,'request\x20sent',JSON[_0x17d4('0x10')](_0x27d088));if(_0x27d088[_0x17d4('0x11')]){if(_0x27d088['error'][_0x17d4('0x12')]===0x1f4){logger[_0x17d4('0x11')](_0x17d4('0xd'),_0x357cd2,_0x27d088['error'][_0x17d4('0x13')]);return _0x3d3064(_0x27d088[_0x17d4('0x11')][_0x17d4('0x13')]);}logger['error'](_0x17d4('0xd'),_0x357cd2,_0x27d088[_0x17d4('0x11')][_0x17d4('0x13')]);return _0x315e52(_0x27d088[_0x17d4('0x11')][_0x17d4('0x13')]);}else{logger[_0x17d4('0xc')](_0x17d4('0xd'),_0x357cd2,_0x17d4('0xe'));_0x315e52(_0x27d088['result'][_0x17d4('0x13')]);}})[_0x17d4('0x14')](function(_0x55c458){logger[_0x17d4('0x11')](_0x17d4('0xd'),_0x357cd2,_0x55c458);_0x3d3064(_0x55c458);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 37be85f..68faa72 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 _0xa454=['/:id','show','post','update','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index'];(function(_0x4b22de,_0x2313f3){var _0x535c17=function(_0xa55161){while(--_0xa55161){_0x4b22de['push'](_0x4b22de['shift']());}};_0x535c17(++_0x2313f3);}(_0xa454,0x125));var _0x4a45=function(_0x1b08ad,_0xebd037){_0x1b08ad=_0x1b08ad-0x0;var _0xb5e51f=_0xa454[_0x1b08ad];return _0xb5e51f;};'use strict';var multer=require(_0x4a45('0x0'));var util=require(_0x4a45('0x1'));var path=require('path');var timeout=require(_0x4a45('0x2'));var express=require('express');var router=express[_0x4a45('0x3')]();var fs_extra=require(_0x4a45('0x4'));var auth=require(_0x4a45('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4a45('0x6'));var controller=require(_0x4a45('0x7'));router[_0x4a45('0x8')]('/',auth[_0x4a45('0x9')](),controller[_0x4a45('0xa')]);router[_0x4a45('0x8')](_0x4a45('0xb'),auth['isAuthenticated'](),controller[_0x4a45('0xc')]);router[_0x4a45('0xd')]('/',auth[_0x4a45('0x9')](),controller['create']);router['put'](_0x4a45('0xb'),auth[_0x4a45('0x9')](),controller[_0x4a45('0xe')]);router['delete'](_0x4a45('0xb'),auth[_0x4a45('0x9')](),controller[_0x4a45('0xf')]);module['exports']=router; \ No newline at end of file +var _0xa5f2=['Router','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','post','create','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0xc4f493,_0x30d630){var _0x51adcf=function(_0x1c5f15){while(--_0x1c5f15){_0xc4f493['push'](_0xc4f493['shift']());}};_0x51adcf(++_0x30d630);}(_0xa5f2,0x16c));var _0x2a5f=function(_0x35dd16,_0x43476f){_0x35dd16=_0x35dd16-0x0;var _0x1547f2=_0xa5f2[_0x35dd16];return _0x1547f2;};'use strict';var multer=require(_0x2a5f('0x0'));var util=require('util');var path=require(_0x2a5f('0x1'));var timeout=require(_0x2a5f('0x2'));var express=require(_0x2a5f('0x3'));var router=express[_0x2a5f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2a5f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2a5f('0x6'));var controller=require(_0x2a5f('0x7'));router[_0x2a5f('0x8')]('/',auth[_0x2a5f('0x9')](),controller['index']);router[_0x2a5f('0x8')](_0x2a5f('0xa'),auth[_0x2a5f('0x9')](),controller['show']);router[_0x2a5f('0xb')]('/',auth[_0x2a5f('0x9')](),controller[_0x2a5f('0xc')]);router['put'](_0x2a5f('0xa'),auth[_0x2a5f('0x9')](),controller[_0x2a5f('0xd')]);router[_0x2a5f('0xe')](_0x2a5f('0xa'),auth[_0x2a5f('0x9')](),controller[_0x2a5f('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 1d8c5b5..2789330 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 _0x4542=['variable','keyValue','STRING','customVariable','sequelize','ENUM','string'];(function(_0x174b74,_0x383d70){var _0x2d2ddc=function(_0x55c3cb){while(--_0x55c3cb){_0x174b74['push'](_0x174b74['shift']());}};_0x2d2ddc(++_0x383d70);}(_0x4542,0xcf));var _0x2454=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4542[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x2454('0x0'));module['exports']={'type':{'type':Sequelize[_0x2454('0x1')](_0x2454('0x2'),_0x2454('0x3'),'customVariable',_0x2454('0x4'),'picklist'),'defaultValue':_0x2454('0x2')},'content':{'type':Sequelize[_0x2454('0x5')]},'key':{'type':Sequelize[_0x2454('0x5')]},'keyType':{'type':Sequelize[_0x2454('0x1')]('string',_0x2454('0x3'),_0x2454('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2454('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2454('0x5')]}}; \ No newline at end of file +var _0x9725=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x5209ef,_0x3a4592){var _0x63f75f=function(_0x2591e1){while(--_0x2591e1){_0x5209ef['push'](_0x5209ef['shift']());}};_0x63f75f(++_0x3a4592);}(_0x9725,0xbf));var _0x5972=function(_0x9b7bcc,_0x3a4572){_0x9b7bcc=_0x9b7bcc-0x0;var _0x1755c4=_0x9725[_0x9b7bcc];return _0x1755c4;};'use strict';var Sequelize=require(_0x5972('0x0'));module[_0x5972('0x1')]={'type':{'type':Sequelize[_0x5972('0x2')](_0x5972('0x3'),_0x5972('0x4'),_0x5972('0x5'),_0x5972('0x6'),_0x5972('0x7')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5972('0x8')]},'keyType':{'type':Sequelize[_0x5972('0x2')](_0x5972('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5972('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x5972('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5972('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 3b29030..837dc36 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 _0x7599=['fields','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','reject','save','update','then','destroy','error','name','index','map','ZohoField','rawAttributes','type','key','query','filters','intersection','model','attributes'];(function(_0xadb49b,_0x4f60b5){var _0x57f89c=function(_0x1bb8b6){while(--_0x1bb8b6){_0xadb49b['push'](_0xadb49b['shift']());}};_0x57f89c(++_0x4f60b5);}(_0x7599,0xfb));var _0x9759=function(_0x41486b,_0x1c242e){_0x41486b=_0x41486b-0x0;var _0x4576a4=_0x7599[_0x41486b];return _0x4576a4;};'use strict';var emlformat=require(_0x9759('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9759('0x1'));var jsonpatch=require(_0x9759('0x2'));var rp=require(_0x9759('0x3'));var moment=require(_0x9759('0x4'));var BPromise=require(_0x9759('0x5'));var Mustache=require(_0x9759('0x6'));var util=require(_0x9759('0x7'));var path=require(_0x9759('0x8'));var sox=require(_0x9759('0x9'));var csv=require(_0x9759('0xa'));var ejs=require(_0x9759('0xb'));var fs=require('fs');var fs_extra=require(_0x9759('0xc'));var _=require(_0x9759('0xd'));var squel=require(_0x9759('0xe'));var crypto=require(_0x9759('0xf'));var jsforce=require(_0x9759('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x9759('0xa'));var querystring=require(_0x9759('0x11'));var Papa=require(_0x9759('0x12'));var Redis=require(_0x9759('0x13'));var authService=require(_0x9759('0x14'));var qs=require(_0x9759('0x15'));var as=require(_0x9759('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9759('0x17'))(_0x9759('0x18'));var utils=require('../../config/utils');var config=require(_0x9759('0x19'));var licenseUtil=require(_0x9759('0x1a'));var db=require(_0x9759('0x1b'))['db'];function respondWithStatusCode(_0x3fba27,_0x4b9b73){_0x4b9b73=_0x4b9b73||0xcc;return function(_0x326304){if(_0x326304){return _0x3fba27[_0x9759('0x1c')](_0x4b9b73);}return _0x3fba27[_0x9759('0x1d')](_0x4b9b73)[_0x9759('0x1e')]();};}function respondWithResult(_0x125882,_0x4cde92){_0x4cde92=_0x4cde92||0xc8;return function(_0x3544bc){if(_0x3544bc){return _0x125882['status'](_0x4cde92)['json'](_0x3544bc);}};}function respondWithFilteredResult(_0x484f84,_0x1e603b){return function(_0x4f6eea){if(_0x4f6eea){var _0x4b4e93=typeof _0x1e603b[_0x9759('0x1f')]===_0x9759('0x20')&&typeof _0x1e603b['limit']===_0x9759('0x20');var _0x23063d=_0x4f6eea['count'];var _0x4054e2=_0x4b4e93?0x0:_0x1e603b[_0x9759('0x1f')];var _0x5a99b6=_0x4b4e93?_0x4f6eea[_0x9759('0x21')]:_0x1e603b['offset']+_0x1e603b['limit'];var _0xf9d023;if(_0x5a99b6>=_0x23063d){_0x5a99b6=_0x23063d;_0xf9d023=0xc8;}else{_0xf9d023=0xce;}_0x484f84[_0x9759('0x1d')](_0xf9d023);return _0x484f84['set'](_0x9759('0x22'),_0x4054e2+'-'+_0x5a99b6+'/'+_0x23063d)['json'](_0x4f6eea);}return null;};}function patchUpdates(_0x40c760){return function(_0x569c31){try{jsonpatch['apply'](_0x569c31,_0x40c760,!![]);}catch(_0x487baf){return BPromise[_0x9759('0x23')](_0x487baf);}return _0x569c31[_0x9759('0x24')]();};}function saveUpdates(_0x8f3230,_0x5d2f3e){return function(_0x25778e){if(_0x25778e){return _0x25778e[_0x9759('0x25')](_0x8f3230)[_0x9759('0x26')](function(_0x291524){return _0x291524;});}return null;};}function removeEntity(_0xaee556,_0x8197d6){return function(_0x47a762){if(_0x47a762){return _0x47a762[_0x9759('0x27')]()['then'](function(){_0xaee556['status'](0xcc)[_0x9759('0x1e')]();});}};}function handleEntityNotFound(_0x442449,_0x2ed1ae){return function(_0x22c1f0){if(!_0x22c1f0){_0x442449[_0x9759('0x1c')](0x194);}return _0x22c1f0;};}function handleError(_0x19de1f,_0x52bea5){_0x52bea5=_0x52bea5||0x1f4;return function(_0x2e7007){logger[_0x9759('0x28')](_0x2e7007['stack']);if(_0x2e7007[_0x9759('0x29')]){delete _0x2e7007['name'];}_0x19de1f[_0x9759('0x1d')](_0x52bea5)['send'](_0x2e7007);};}exports[_0x9759('0x2a')]=function(_0x59f84c,_0x3042af){var _0x3e24a2={},_0x3f8153={},_0x44b076={'count':0x0,'rows':[]};var _0x178a1d=_[_0x9759('0x2b')](db[_0x9759('0x2c')][_0x9759('0x2d')],function(_0x5b96ab){return{'name':_0x5b96ab['fieldName'],'type':_0x5b96ab[_0x9759('0x2e')][_0x9759('0x2f')]};});_0x3f8153['model']=_[_0x9759('0x2b')](_0x178a1d,'name');_0x3f8153['query']=_['keys'](_0x59f84c[_0x9759('0x30')]);_0x3f8153[_0x9759('0x31')]=_[_0x9759('0x32')](_0x3f8153[_0x9759('0x33')],_0x3f8153['query']);_0x3e24a2[_0x9759('0x34')]=_[_0x9759('0x32')](_0x3f8153['model'],qs[_0x9759('0x35')](_0x59f84c[_0x9759('0x30')]['fields']));_0x3e24a2[_0x9759('0x34')]=_0x3e24a2[_0x9759('0x34')][_0x9759('0x36')]?_0x3e24a2[_0x9759('0x34')]:_0x3f8153[_0x9759('0x33')];if(!_0x59f84c[_0x9759('0x30')][_0x9759('0x37')](_0x9759('0x38'))){_0x3e24a2[_0x9759('0x39')]=qs['limit'](_0x59f84c[_0x9759('0x30')][_0x9759('0x39')]);_0x3e24a2[_0x9759('0x1f')]=qs[_0x9759('0x1f')](_0x59f84c[_0x9759('0x30')][_0x9759('0x1f')]);}_0x3e24a2[_0x9759('0x3a')]=qs['sort'](_0x59f84c[_0x9759('0x30')]['sort']);_0x3e24a2[_0x9759('0x3b')]=qs['filters'](_[_0x9759('0x3c')](_0x59f84c[_0x9759('0x30')],_0x3f8153[_0x9759('0x31')]),_0x178a1d);if(_0x59f84c[_0x9759('0x30')]['filter']){_0x3e24a2[_0x9759('0x3b')]=_[_0x9759('0x3d')](_0x3e24a2[_0x9759('0x3b')],{'$or':_[_0x9759('0x2b')](_0x178a1d,function(_0x561f2c){if(_0x561f2c[_0x9759('0x2e')]!==_0x9759('0x3e')){var _0x5ade40={};_0x5ade40[_0x561f2c[_0x9759('0x29')]]={'$like':'%'+_0x59f84c[_0x9759('0x30')][_0x9759('0x3f')]+'%'};return _0x5ade40;}})});}_0x3e24a2=_[_0x9759('0x3d')]({},_0x3e24a2,_0x59f84c[_0x9759('0x40')]);var _0x19dc98={'where':_0x3e24a2[_0x9759('0x3b')]};return db[_0x9759('0x2c')][_0x9759('0x21')](_0x19dc98)[_0x9759('0x26')](function(_0xbd6716){_0x44b076[_0x9759('0x21')]=_0xbd6716;if(_0x59f84c[_0x9759('0x30')][_0x9759('0x41')]){_0x3e24a2[_0x9759('0x42')]=[{'all':!![]}];}return db[_0x9759('0x2c')][_0x9759('0x43')](_0x3e24a2);})['then'](function(_0xec61bb){_0x44b076[_0x9759('0x44')]=_0xec61bb;return _0x44b076;})['then'](respondWithFilteredResult(_0x3042af,_0x3e24a2))[_0x9759('0x45')](handleError(_0x3042af,null));};exports[_0x9759('0x46')]=function(_0x4fb7fc,_0x19df61){var _0x358bab={'raw':!![],'where':{'id':_0x4fb7fc[_0x9759('0x47')]['id']}},_0xcaa87f={};_0xcaa87f['model']=_[_0x9759('0x48')](db['ZohoField'][_0x9759('0x2d')]);_0xcaa87f[_0x9759('0x30')]=_[_0x9759('0x48')](_0x4fb7fc[_0x9759('0x30')]);_0xcaa87f['filters']=_[_0x9759('0x32')](_0xcaa87f['model'],_0xcaa87f[_0x9759('0x30')]);_0x358bab[_0x9759('0x34')]=_[_0x9759('0x32')](_0xcaa87f[_0x9759('0x33')],qs[_0x9759('0x35')](_0x4fb7fc[_0x9759('0x30')][_0x9759('0x35')]));_0x358bab[_0x9759('0x34')]=_0x358bab[_0x9759('0x34')][_0x9759('0x36')]?_0x358bab[_0x9759('0x34')]:_0xcaa87f['model'];if(_0x4fb7fc[_0x9759('0x30')][_0x9759('0x41')]){_0x358bab[_0x9759('0x42')]=[{'all':!![]}];}_0x358bab=_[_0x9759('0x3d')]({},_0x358bab,_0x4fb7fc[_0x9759('0x40')]);return db['ZohoField'][_0x9759('0x49')](_0x358bab)[_0x9759('0x26')](handleEntityNotFound(_0x19df61,null))[_0x9759('0x26')](respondWithResult(_0x19df61,null))['catch'](handleError(_0x19df61,null));};exports['create']=function(_0x45c141,_0xa74d82){return db[_0x9759('0x2c')][_0x9759('0x4a')](_0x45c141[_0x9759('0x4b')],{})[_0x9759('0x26')](respondWithResult(_0xa74d82,0xc9))[_0x9759('0x45')](handleError(_0xa74d82,null));};exports['update']=function(_0xd1040a,_0x1267fa){if(_0xd1040a[_0x9759('0x4b')]['id']){delete _0xd1040a['body']['id'];}return db['ZohoField'][_0x9759('0x49')]({'where':{'id':_0xd1040a[_0x9759('0x47')]['id']}})['then'](handleEntityNotFound(_0x1267fa,null))[_0x9759('0x26')](saveUpdates(_0xd1040a[_0x9759('0x4b')],null))[_0x9759('0x26')](respondWithResult(_0x1267fa,null))[_0x9759('0x45')](handleError(_0x1267fa,null));};exports[_0x9759('0x27')]=function(_0x3a7aaf,_0x1b5e20){return db[_0x9759('0x2c')][_0x9759('0x49')]({'where':{'id':_0x3a7aaf[_0x9759('0x47')]['id']}})[_0x9759('0x26')](handleEntityNotFound(_0x1b5e20,null))[_0x9759('0x26')](removeEntity(_0x1b5e20,null))[_0x9759('0x45')](handleError(_0x1b5e20,null));}; \ No newline at end of file +var _0x56dd=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count','offset','set','apply','reject','save','then','destroy','end','name','send','index','map','ZohoField'];(function(_0x1322f2,_0x280cdd){var _0x44d0e0=function(_0x41d8e1){while(--_0x41d8e1){_0x1322f2['push'](_0x1322f2['shift']());}};_0x44d0e0(++_0x280cdd);}(_0x56dd,0xb3));var _0xd56d=function(_0x5eb15b,_0x6828ed){_0x5eb15b=_0x5eb15b-0x0;var _0x12f7db=_0x56dd[_0x5eb15b];return _0x12f7db;};'use strict';var emlformat=require(_0xd56d('0x0'));var rimraf=require(_0xd56d('0x1'));var zipdir=require(_0xd56d('0x2'));var jsonpatch=require(_0xd56d('0x3'));var rp=require(_0xd56d('0x4'));var moment=require(_0xd56d('0x5'));var BPromise=require(_0xd56d('0x6'));var Mustache=require('mustache');var util=require(_0xd56d('0x7'));var path=require('path');var sox=require(_0xd56d('0x8'));var csv=require(_0xd56d('0x9'));var ejs=require(_0xd56d('0xa'));var fs=require('fs');var fs_extra=require(_0xd56d('0xb'));var _=require('lodash');var squel=require(_0xd56d('0xc'));var crypto=require(_0xd56d('0xd'));var jsforce=require(_0xd56d('0xe'));var deskjs=require(_0xd56d('0xf'));var toCsv=require(_0xd56d('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd56d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd56d('0x11'));var as=require(_0xd56d('0x12'));var hardwareService=require(_0xd56d('0x13'));var logger=require(_0xd56d('0x14'))(_0xd56d('0x15'));var utils=require(_0xd56d('0x16'));var config=require(_0xd56d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xd56d('0x18'))['db'];function respondWithStatusCode(_0x583e10,_0x220737){_0x220737=_0x220737||0xcc;return function(_0xe1cc9c){if(_0xe1cc9c){return _0x583e10[_0xd56d('0x19')](_0x220737);}return _0x583e10[_0xd56d('0x1a')](_0x220737)['end']();};}function respondWithResult(_0x513e4b,_0x5276b7){_0x5276b7=_0x5276b7||0xc8;return function(_0x4374d8){if(_0x4374d8){return _0x513e4b[_0xd56d('0x1a')](_0x5276b7)[_0xd56d('0x1b')](_0x4374d8);}};}function respondWithFilteredResult(_0x2914f2,_0x5e52ff){return function(_0x52f168){if(_0x52f168){var _0x45df6a=typeof _0x5e52ff['offset']===_0xd56d('0x1c')&&typeof _0x5e52ff['limit']===_0xd56d('0x1c');var _0x3e49e6=_0x52f168[_0xd56d('0x1d')];var _0x44e0ae=_0x45df6a?0x0:_0x5e52ff[_0xd56d('0x1e')];var _0x313474=_0x45df6a?_0x52f168[_0xd56d('0x1d')]:_0x5e52ff[_0xd56d('0x1e')]+_0x5e52ff['limit'];var _0x3b60d7;if(_0x313474>=_0x3e49e6){_0x313474=_0x3e49e6;_0x3b60d7=0xc8;}else{_0x3b60d7=0xce;}_0x2914f2[_0xd56d('0x1a')](_0x3b60d7);return _0x2914f2[_0xd56d('0x1f')]('Content-Range',_0x44e0ae+'-'+_0x313474+'/'+_0x3e49e6)['json'](_0x52f168);}return null;};}function patchUpdates(_0x151d16){return function(_0x433057){try{jsonpatch[_0xd56d('0x20')](_0x433057,_0x151d16,!![]);}catch(_0x55e359){return BPromise[_0xd56d('0x21')](_0x55e359);}return _0x433057[_0xd56d('0x22')]();};}function saveUpdates(_0x521fdc,_0x131e00){return function(_0x45b459){if(_0x45b459){return _0x45b459['update'](_0x521fdc)[_0xd56d('0x23')](function(_0x4f7728){return _0x4f7728;});}return null;};}function removeEntity(_0x1e118f,_0x467d9c){return function(_0x4cb9a2){if(_0x4cb9a2){return _0x4cb9a2[_0xd56d('0x24')]()[_0xd56d('0x23')](function(){_0x1e118f[_0xd56d('0x1a')](0xcc)[_0xd56d('0x25')]();});}};}function handleEntityNotFound(_0x558645,_0x35cdd4){return function(_0x1d667c){if(!_0x1d667c){_0x558645[_0xd56d('0x19')](0x194);}return _0x1d667c;};}function handleError(_0x224bd3,_0x3d35b1){_0x3d35b1=_0x3d35b1||0x1f4;return function(_0x260426){logger['error'](_0x260426['stack']);if(_0x260426[_0xd56d('0x26')]){delete _0x260426['name'];}_0x224bd3[_0xd56d('0x1a')](_0x3d35b1)[_0xd56d('0x27')](_0x260426);};}exports[_0xd56d('0x28')]=function(_0x563b83,_0x2d38df){var _0x3ee8cb={},_0x5af1a3={},_0x36ba1a={'count':0x0,'rows':[]};var _0x12af42=_[_0xd56d('0x29')](db[_0xd56d('0x2a')][_0xd56d('0x2b')],function(_0x5c1d20){return{'name':_0x5c1d20[_0xd56d('0x2c')],'type':_0x5c1d20[_0xd56d('0x2d')][_0xd56d('0x2e')]};});_0x5af1a3[_0xd56d('0x2f')]=_[_0xd56d('0x29')](_0x12af42,'name');_0x5af1a3[_0xd56d('0x30')]=_[_0xd56d('0x31')](_0x563b83[_0xd56d('0x30')]);_0x5af1a3[_0xd56d('0x32')]=_[_0xd56d('0x33')](_0x5af1a3['model'],_0x5af1a3[_0xd56d('0x30')]);_0x3ee8cb['attributes']=_[_0xd56d('0x33')](_0x5af1a3[_0xd56d('0x2f')],qs[_0xd56d('0x34')](_0x563b83[_0xd56d('0x30')][_0xd56d('0x34')]));_0x3ee8cb['attributes']=_0x3ee8cb[_0xd56d('0x35')][_0xd56d('0x36')]?_0x3ee8cb[_0xd56d('0x35')]:_0x5af1a3[_0xd56d('0x2f')];if(!_0x563b83[_0xd56d('0x30')][_0xd56d('0x37')](_0xd56d('0x38'))){_0x3ee8cb[_0xd56d('0x39')]=qs[_0xd56d('0x39')](_0x563b83[_0xd56d('0x30')][_0xd56d('0x39')]);_0x3ee8cb[_0xd56d('0x1e')]=qs[_0xd56d('0x1e')](_0x563b83[_0xd56d('0x30')]['offset']);}_0x3ee8cb[_0xd56d('0x3a')]=qs[_0xd56d('0x3b')](_0x563b83[_0xd56d('0x30')][_0xd56d('0x3b')]);_0x3ee8cb[_0xd56d('0x3c')]=qs['filters'](_[_0xd56d('0x3d')](_0x563b83[_0xd56d('0x30')],_0x5af1a3[_0xd56d('0x32')]),_0x12af42);if(_0x563b83['query'][_0xd56d('0x3e')]){_0x3ee8cb[_0xd56d('0x3c')]=_[_0xd56d('0x3f')](_0x3ee8cb[_0xd56d('0x3c')],{'$or':_[_0xd56d('0x29')](_0x12af42,function(_0x175fe3){if(_0x175fe3[_0xd56d('0x2d')]!==_0xd56d('0x40')){var _0x411a84={};_0x411a84[_0x175fe3[_0xd56d('0x26')]]={'$like':'%'+_0x563b83[_0xd56d('0x30')][_0xd56d('0x3e')]+'%'};return _0x411a84;}})});}_0x3ee8cb=_[_0xd56d('0x3f')]({},_0x3ee8cb,_0x563b83['options']);var _0xc38a43={'where':_0x3ee8cb[_0xd56d('0x3c')]};return db['ZohoField'][_0xd56d('0x1d')](_0xc38a43)[_0xd56d('0x23')](function(_0x2daf10){_0x36ba1a[_0xd56d('0x1d')]=_0x2daf10;if(_0x563b83[_0xd56d('0x30')][_0xd56d('0x41')]){_0x3ee8cb[_0xd56d('0x42')]=[{'all':!![]}];}return db[_0xd56d('0x2a')][_0xd56d('0x43')](_0x3ee8cb);})[_0xd56d('0x23')](function(_0x4f6731){_0x36ba1a[_0xd56d('0x44')]=_0x4f6731;return _0x36ba1a;})[_0xd56d('0x23')](respondWithFilteredResult(_0x2d38df,_0x3ee8cb))[_0xd56d('0x45')](handleError(_0x2d38df,null));};exports['show']=function(_0x5c8881,_0x58bae5){var _0x3e031f={'raw':!![],'where':{'id':_0x5c8881[_0xd56d('0x46')]['id']}},_0x56accb={};_0x56accb[_0xd56d('0x2f')]=_[_0xd56d('0x31')](db['ZohoField'][_0xd56d('0x2b')]);_0x56accb[_0xd56d('0x30')]=_[_0xd56d('0x31')](_0x5c8881[_0xd56d('0x30')]);_0x56accb[_0xd56d('0x32')]=_[_0xd56d('0x33')](_0x56accb[_0xd56d('0x2f')],_0x56accb[_0xd56d('0x30')]);_0x3e031f[_0xd56d('0x35')]=_[_0xd56d('0x33')](_0x56accb[_0xd56d('0x2f')],qs[_0xd56d('0x34')](_0x5c8881[_0xd56d('0x30')][_0xd56d('0x34')]));_0x3e031f[_0xd56d('0x35')]=_0x3e031f['attributes']['length']?_0x3e031f[_0xd56d('0x35')]:_0x56accb[_0xd56d('0x2f')];if(_0x5c8881['query'][_0xd56d('0x41')]){_0x3e031f[_0xd56d('0x42')]=[{'all':!![]}];}_0x3e031f=_[_0xd56d('0x3f')]({},_0x3e031f,_0x5c8881[_0xd56d('0x47')]);return db[_0xd56d('0x2a')]['find'](_0x3e031f)[_0xd56d('0x23')](handleEntityNotFound(_0x58bae5,null))[_0xd56d('0x23')](respondWithResult(_0x58bae5,null))[_0xd56d('0x45')](handleError(_0x58bae5,null));};exports['create']=function(_0x310e4e,_0x27f1fe){return db[_0xd56d('0x2a')]['create'](_0x310e4e[_0xd56d('0x48')],{})[_0xd56d('0x23')](respondWithResult(_0x27f1fe,0xc9))[_0xd56d('0x45')](handleError(_0x27f1fe,null));};exports['update']=function(_0x186430,_0x472d6d){if(_0x186430[_0xd56d('0x48')]['id']){delete _0x186430[_0xd56d('0x48')]['id'];}return db[_0xd56d('0x2a')][_0xd56d('0x49')]({'where':{'id':_0x186430[_0xd56d('0x46')]['id']}})[_0xd56d('0x23')](handleEntityNotFound(_0x472d6d,null))[_0xd56d('0x23')](saveUpdates(_0x186430[_0xd56d('0x48')],null))['then'](respondWithResult(_0x472d6d,null))[_0xd56d('0x45')](handleError(_0x472d6d,null));};exports[_0xd56d('0x24')]=function(_0xfb9357,_0x5da7dc){return db[_0xd56d('0x2a')][_0xd56d('0x49')]({'where':{'id':_0xfb9357[_0xd56d('0x46')]['id']}})[_0xd56d('0x23')](handleEntityNotFound(_0x5da7dc,null))[_0xd56d('0x23')](removeEntity(_0x5da7dc,null))[_0xd56d('0x45')](handleError(_0x5da7dc,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 6d84826..74346c2 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 _0x1893=['rimraf','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5473da,_0x49396c){var _0x3b0928=function(_0x556ba7){while(--_0x556ba7){_0x5473da['push'](_0x5473da['shift']());}};_0x3b0928(++_0x49396c);}(_0x1893,0xa2));var _0x3189=function(_0x2a98e3,_0x488997){_0x2a98e3=_0x2a98e3-0x0;var _0x370a71=_0x1893[_0x2a98e3];return _0x370a71;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3189('0x0'))(_0x3189('0x1'));var moment=require(_0x3189('0x2'));var BPromise=require(_0x3189('0x3'));var rp=require(_0x3189('0x4'));var fs=require('fs');var path=require(_0x3189('0x5'));var rimraf=require(_0x3189('0x6'));var config=require('../../config/environment');var attributes=require(_0x3189('0x7'));module[_0x3189('0x8')]=function(_0x2333e6,_0x4080a9){return _0x2333e6[_0x3189('0x9')](_0x3189('0xa'),attributes,{'tableName':_0x3189('0xb'),'paranoid':![],'indexes':[{'name':_0x3189('0xc'),'fields':['idField',_0x3189('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7046=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','ZohoField','idField'];(function(_0x4d5b58,_0x28fbfa){var _0x13ef69=function(_0x219ae9){while(--_0x219ae9){_0x4d5b58['push'](_0x4d5b58['shift']());}};_0x13ef69(++_0x28fbfa);}(_0x7046,0x144));var _0x6704=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x7046[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var logger=require(_0x6704('0x2'))(_0x6704('0x3'));var moment=require('moment');var BPromise=require(_0x6704('0x4'));var rp=require(_0x6704('0x5'));var fs=require('fs');var path=require(_0x6704('0x6'));var rimraf=require('rimraf');var config=require(_0x6704('0x7'));var attributes=require(_0x6704('0x8'));module[_0x6704('0x9')]=function(_0x626a14,_0x2917be){return _0x626a14['define'](_0x6704('0xa'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x6704('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 79951b4..072ef95 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 _0xa177=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoField,\x20%s,\x20%s','message'];(function(_0xde13d8,_0x113262){var _0xe71924=function(_0x32ce0a){while(--_0x32ce0a){_0xde13d8['push'](_0xde13d8['shift']());}};_0xe71924(++_0x113262);}(_0xa177,0xe8));var _0x7a17=function(_0x4203a7,_0x1da276){_0x4203a7=_0x4203a7-0x0;var _0x4413a3=_0xa177[_0x4203a7];return _0x4413a3;};'use strict';var _=require(_0x7a17('0x0'));var util=require(_0x7a17('0x1'));var moment=require('moment');var BPromise=require(_0x7a17('0x2'));var rs=require(_0x7a17('0x3'));var fs=require('fs');var Redis=require(_0x7a17('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a17('0x5'));var logger=require(_0x7a17('0x6'))(_0x7a17('0x7'));var config=require(_0x7a17('0x8'));var jayson=require(_0x7a17('0x9'));var client=jayson[_0x7a17('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf67767,_0x5b49ad,_0x513c92){return new BPromise(function(_0x2dda82,_0x3a443c){return client[_0x7a17('0xb')](_0xf67767,_0x513c92)['then'](function(_0x2e0ecf){logger[_0x7a17('0xc')]('ZohoField,\x20%s,\x20%s',_0x5b49ad,_0x7a17('0xd'));logger['debug'](_0x7a17('0xe'),_0x5b49ad,_0x7a17('0xd'),JSON[_0x7a17('0xf')](_0x2e0ecf));if(_0x2e0ecf[_0x7a17('0x10')]){if(_0x2e0ecf[_0x7a17('0x10')][_0x7a17('0x11')]===0x1f4){logger['error'](_0x7a17('0x12'),_0x5b49ad,_0x2e0ecf[_0x7a17('0x10')]['message']);return _0x3a443c(_0x2e0ecf['error']['message']);}logger[_0x7a17('0x10')](_0x7a17('0x12'),_0x5b49ad,_0x2e0ecf[_0x7a17('0x10')][_0x7a17('0x13')]);return _0x2dda82(_0x2e0ecf[_0x7a17('0x10')][_0x7a17('0x13')]);}else{logger[_0x7a17('0xc')](_0x7a17('0x12'),_0x5b49ad,_0x7a17('0xd'));_0x2dda82(_0x2e0ecf['result']['message']);}})[_0x7a17('0x14')](function(_0x4d9e08){logger[_0x7a17('0x10')]('ZohoField,\x20%s,\x20%s',_0x5b49ad,_0x4d9e08);_0x3a443c(_0x4d9e08);});});} \ No newline at end of file +var _0xf22d=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s'];(function(_0x49bb93,_0x28e859){var _0x53b0c8=function(_0x8ee8b4){while(--_0x8ee8b4){_0x49bb93['push'](_0x49bb93['shift']());}};_0x53b0c8(++_0x28e859);}(_0xf22d,0xb4));var _0xdf22=function(_0xb0fe92,_0x147e42){_0xb0fe92=_0xb0fe92-0x0;var _0x41787f=_0xf22d[_0xb0fe92];return _0x41787f;};'use strict';var _=require(_0xdf22('0x0'));var util=require(_0xdf22('0x1'));var moment=require(_0xdf22('0x2'));var BPromise=require(_0xdf22('0x3'));var rs=require(_0xdf22('0x4'));var fs=require('fs');var Redis=require(_0xdf22('0x5'));var db=require(_0xdf22('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdf22('0x7'))(_0xdf22('0x8'));var config=require(_0xdf22('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdf22('0xa')][_0xdf22('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30688,_0x481e09,_0x2ac1d5){return new BPromise(function(_0x514297,_0x4209e1){return client[_0xdf22('0xc')](_0x30688,_0x2ac1d5)[_0xdf22('0xd')](function(_0x2a45a5){logger['info'](_0xdf22('0xe'),_0x481e09,_0xdf22('0xf'));logger[_0xdf22('0x10')](_0xdf22('0x11'),_0x481e09,_0xdf22('0xf'),JSON['stringify'](_0x2a45a5));if(_0x2a45a5[_0xdf22('0x12')]){if(_0x2a45a5[_0xdf22('0x12')]['code']===0x1f4){logger[_0xdf22('0x12')](_0xdf22('0xe'),_0x481e09,_0x2a45a5[_0xdf22('0x12')]['message']);return _0x4209e1(_0x2a45a5[_0xdf22('0x12')][_0xdf22('0x13')]);}logger[_0xdf22('0x12')](_0xdf22('0xe'),_0x481e09,_0x2a45a5[_0xdf22('0x12')][_0xdf22('0x13')]);return _0x514297(_0x2a45a5[_0xdf22('0x12')][_0xdf22('0x13')]);}else{logger['info'](_0xdf22('0xe'),_0x481e09,_0xdf22('0xf'));_0x514297(_0x2a45a5[_0xdf22('0x14')]['message']);}})[_0xdf22('0x15')](function(_0x30b56a){logger[_0xdf22('0x12')](_0xdf22('0xe'),_0x481e09,_0x30b56a);_0x4209e1(_0x30b56a);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 15c3660..6d2a5ea 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x36ca6e,_0x1bcabc){var _0x1e774c=function(_0x59930b){while(--_0x59930b){_0x36ca6e['push'](_0x36ca6e['shift']());}};_0x1e774c(++_0x1bcabc);}(_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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xe1f998,_0x256568){var _0xe5ee03=function(_0xa4fbc){while(--_0xa4fbc){_0xe1f998['push'](_0xe1f998['shift']());}};_0xe5ee03(++_0x256568);}(_0xedd9,0xfc));var _0x9edd=function(_0x6908b8,_0x43f354){_0x6908b8=_0x6908b8-0x0;var _0x3e72c6=_0xedd9[_0x6908b8];return _0x3e72c6;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 007ad8b..fbad6f3 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 _0xa699=['INTEGER','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x1edaa4,_0x7d9b0d){var _0x343826=function(_0x316583){while(--_0x316583){_0x1edaa4['push'](_0x1edaa4['shift']());}};_0x343826(++_0x7d9b0d);}(_0xa699,0x6b));var _0x9a69=function(_0x2d4065,_0x38dc95){_0x2d4065=_0x2d4065-0x0;var _0xef6016=_0xa699[_0x2d4065];return _0xef6016;};'use strict';var Sequelize=require(_0x9a69('0x0'));module[_0x9a69('0x1')]={'name':{'type':Sequelize[_0x9a69('0x2')],'allowNull':![],'unique':_0x9a69('0x3')},'version':{'type':Sequelize[_0x9a69('0x2')],'allowNull':![],'unique':_0x9a69('0x3')},'main':{'type':Sequelize[_0x9a69('0x2')],'defaultValue':_0x9a69('0x4')},'filename':{'type':Sequelize[_0x9a69('0x2')]},'path':{'type':Sequelize[_0x9a69('0x2')]},'type':{'type':Sequelize[_0x9a69('0x2')]},'size':{'type':Sequelize[_0x9a69('0x5')]},'active':{'type':Sequelize[_0x9a69('0x6')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x9a69('0x2')]},'state':{'type':Sequelize[_0x9a69('0x2')],'unique':_0x9a69('0x7')},'description':{'type':Sequelize[_0x9a69('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9a69('0x2')]},'link':{'type':Sequelize[_0x9a69('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x2769=['app.js','BOOLEAN','state','exports','unique_name_and_version','STRING'];(function(_0x38fe0d,_0x368a7e){var _0x1dcc3f=function(_0x38faed){while(--_0x38faed){_0x38fe0d['push'](_0x38fe0d['shift']());}};_0x1dcc3f(++_0x368a7e);}(_0x2769,0xcf));var _0x9276=function(_0x14737e,_0x3804bb){_0x14737e=_0x14737e-0x0;var _0x51abdd=_0x2769[_0x14737e];return _0x51abdd;};'use strict';var Sequelize=require('sequelize');module[_0x9276('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9276('0x1')},'version':{'type':Sequelize[_0x9276('0x2')],'allowNull':![],'unique':_0x9276('0x1')},'main':{'type':Sequelize[_0x9276('0x2')],'defaultValue':_0x9276('0x3')},'filename':{'type':Sequelize[_0x9276('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x9276('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x9276('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x9276('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x9276('0x2')],'unique':_0x9276('0x5')},'description':{'type':Sequelize[_0x9276('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9276('0x2')]},'link':{'type':Sequelize[_0x9276('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 301b3e1..60c0685 100644 --- a/server/api/integration/integration.controller.js +++ b/server/api/integration/integration.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66fa=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','Integration','findAll','rows','catch','merge','options','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x66fa,0x117));var _0xa66f=function(_0x175035,_0x25c70f){_0x175035=_0x175035-0x0;var _0x2456f5=_0x66fa[_0x175035];return _0x2456f5;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251189,_0x14af70){_0x14af70=_0x14af70||0xcc;return function(_0xca12f8){if(_0xca12f8){return _0x251189['sendStatus'](_0x14af70);}return _0x251189['status'](_0x14af70)[_0xa66f('0x15')]();};}function respondWithResult(_0x4e09cf,_0x528427){_0x528427=_0x528427||0xc8;return function(_0x5a7b16){if(_0x5a7b16){return _0x4e09cf[_0xa66f('0x16')](_0x528427)[_0xa66f('0x17')](_0x5a7b16);}};}function respondWithFilteredResult(_0x267129,_0x236d64){return function(_0xd348f9){if(_0xd348f9){var _0x567d4f=typeof _0x236d64['offset']===_0xa66f('0x18')&&typeof _0x236d64[_0xa66f('0x19')]===_0xa66f('0x18');var _0x403f4d=_0xd348f9['count'];var _0x1cbe64=_0x567d4f?0x0:_0x236d64['offset'];var _0x4a28d4=_0x567d4f?_0xd348f9[_0xa66f('0x1a')]:_0x236d64[_0xa66f('0x1b')]+_0x236d64[_0xa66f('0x19')];var _0x355ddc;if(_0x4a28d4>=_0x403f4d){_0x4a28d4=_0x403f4d;_0x355ddc=0xc8;}else{_0x355ddc=0xce;}_0x267129[_0xa66f('0x16')](_0x355ddc);return _0x267129[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x1cbe64+'-'+_0x4a28d4+'/'+_0x403f4d)[_0xa66f('0x17')](_0xd348f9);}return null;};}function patchUpdates(_0x2033a4){return function(_0x2d9602){try{jsonpatch[_0xa66f('0x1e')](_0x2d9602,_0x2033a4,!![]);}catch(_0xbba376){return BPromise[_0xa66f('0x1f')](_0xbba376);}return _0x2d9602[_0xa66f('0x20')]();};}function saveUpdates(_0x82924d,_0x5cd613){return function(_0x27f570){if(_0x27f570){return _0x27f570[_0xa66f('0x21')](_0x82924d)[_0xa66f('0x22')](function(_0x37ee13){return _0x37ee13;});}return null;};}function removeEntity(_0x5cbd82,_0x337602){return function(_0x473822){if(_0x473822){return _0x473822[_0xa66f('0x23')]()[_0xa66f('0x22')](function(){_0x5cbd82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed98b9,_0x598942){return function(_0x3a3e4f){if(!_0x3a3e4f){_0xed98b9[_0xa66f('0x24')](0x194);}return _0x3a3e4f;};}function handleError(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0x1f4;return function(_0x4683c7){logger[_0xa66f('0x25')](_0x4683c7[_0xa66f('0x26')]);if(_0x4683c7[_0xa66f('0x27')]){delete _0x4683c7[_0xa66f('0x27')];}_0x384164[_0xa66f('0x16')](_0x57da7f)[_0xa66f('0x28')](_0x4683c7);};}exports[_0xa66f('0x29')]=function(_0x20ee67,_0x117d03){var _0x45f71c={},_0x63650b={},_0x42b966={'count':0x0,'rows':[]};var _0xeeb22e=_['map'](db['Integration'][_0xa66f('0x2a')],function(_0x27ceae){return{'name':_0x27ceae['fieldName'],'type':_0x27ceae[_0xa66f('0x2b')][_0xa66f('0x2c')]};});_0x63650b['model']=_[_0xa66f('0x2d')](_0xeeb22e,_0xa66f('0x27'));_0x63650b[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x20ee67[_0xa66f('0x2e')]);_0x63650b['filters']=_[_0xa66f('0x30')](_0x63650b['model'],_0x63650b[_0xa66f('0x2e')]);_0x45f71c[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x63650b['model'],qs[_0xa66f('0x32')](_0x20ee67[_0xa66f('0x2e')]['fields']));_0x45f71c[_0xa66f('0x31')]=_0x45f71c[_0xa66f('0x31')][_0xa66f('0x33')]?_0x45f71c[_0xa66f('0x31')]:_0x63650b[_0xa66f('0x34')];if(!_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x35')](_0xa66f('0x36'))){_0x45f71c[_0xa66f('0x19')]=qs[_0xa66f('0x19')](_0x20ee67['query'][_0xa66f('0x19')]);_0x45f71c['offset']=qs[_0xa66f('0x1b')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x1b')]);}_0x45f71c[_0xa66f('0x37')]=qs[_0xa66f('0x38')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x38')]);_0x45f71c[_0xa66f('0x39')]=qs['filters'](_[_0xa66f('0x3a')](_0x20ee67['query'],_0x63650b[_0xa66f('0x3b')]),_0xeeb22e);if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3c')]){_0x45f71c['where']=_['merge'](_0x45f71c[_0xa66f('0x39')],{'$or':_[_0xa66f('0x2d')](_0xeeb22e,function(_0x20b07e){if(_0x20b07e[_0xa66f('0x2b')]!==_0xa66f('0x3d')){var _0x581dca={};_0x581dca[_0x20b07e['name']]={'$like':'%'+_0x20ee67['query'][_0xa66f('0x3c')]+'%'};return _0x581dca;}})});}_0x45f71c=_['merge']({},_0x45f71c,_0x20ee67['options']);var _0x5bf856={'where':_0x45f71c[_0xa66f('0x39')]};return db['Integration'][_0xa66f('0x1a')](_0x5bf856)[_0xa66f('0x22')](function(_0x23a546){_0x42b966[_0xa66f('0x1a')]=_0x23a546;if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3e')]){_0x45f71c[_0xa66f('0x3f')]=[{'all':!![]}];}return db[_0xa66f('0x40')][_0xa66f('0x41')](_0x45f71c);})[_0xa66f('0x22')](function(_0x3a7929){_0x42b966[_0xa66f('0x42')]=_0x3a7929;return _0x42b966;})[_0xa66f('0x22')](respondWithFilteredResult(_0x117d03,_0x45f71c))[_0xa66f('0x43')](handleError(_0x117d03,null));};exports['show']=function(_0x36037c,_0x25c2cb){var _0x58c1f2={'raw':![],'where':{'id':_0x36037c['params']['id']}},_0x248587={};_0x248587[_0xa66f('0x34')]=_[_0xa66f('0x2f')](db['Integration'][_0xa66f('0x2a')]);_0x248587[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x36037c['query']);_0x248587[_0xa66f('0x3b')]=_['intersection'](_0x248587[_0xa66f('0x34')],_0x248587[_0xa66f('0x2e')]);_0x58c1f2[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x248587[_0xa66f('0x34')],qs[_0xa66f('0x32')](_0x36037c[_0xa66f('0x2e')]['fields']));_0x58c1f2[_0xa66f('0x31')]=_0x58c1f2[_0xa66f('0x31')][_0xa66f('0x33')]?_0x58c1f2[_0xa66f('0x31')]:_0x248587[_0xa66f('0x34')];if(_0x36037c['query']['includeAll']){_0x58c1f2[_0xa66f('0x3f')]=[{'all':!![]}];}_0x58c1f2=_[_0xa66f('0x44')]({},_0x58c1f2,_0x36037c[_0xa66f('0x45')]);return db[_0xa66f('0x40')][_0xa66f('0x46')](_0x58c1f2)[_0xa66f('0x22')](handleEntityNotFound(_0x25c2cb,null))['then'](respondWithResult(_0x25c2cb,null))[_0xa66f('0x43')](handleError(_0x25c2cb,null));};exports[_0xa66f('0x47')]=function(_0x3f9cdd,_0x5651e9){return db['Integration'][_0xa66f('0x47')](_0x3f9cdd[_0xa66f('0x48')],{})[_0xa66f('0x22')](respondWithResult(_0x5651e9,0xc9))['catch'](handleError(_0x5651e9,null));};exports['update']=function(_0x52054e,_0x19e7ce){if(_0x52054e[_0xa66f('0x48')]['id']){delete _0x52054e[_0xa66f('0x48')]['id'];}return db[_0xa66f('0x40')][_0xa66f('0x46')]({'where':{'id':_0x52054e[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x19e7ce,null))[_0xa66f('0x22')](saveUpdates(_0x52054e['body'],null))[_0xa66f('0x22')](respondWithResult(_0x19e7ce,null))[_0xa66f('0x43')](handleError(_0x19e7ce,null));};exports[_0xa66f('0x23')]=function(_0x393755,_0x11597b){return db[_0xa66f('0x40')]['find']({'where':{'id':_0x393755[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x11597b,null))[_0xa66f('0x22')](removeEntity(_0x11597b,null))[_0xa66f('0x43')](handleError(_0x11597b,null));}; \ No newline at end of file +var _0xf61e=['intersection','fields','attributes','length','hasOwnProperty','order','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','find','create','update','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','destroy','then','status','error','stack','name','send','index','map','Integration','rawAttributes','key','model','query','keys','filters'];(function(_0x24a88e,_0x22a0b8){var _0x232cbb=function(_0x50b7a4){while(--_0x50b7a4){_0x24a88e['push'](_0x24a88e['shift']());}};_0x232cbb(++_0x22a0b8);}(_0xf61e,0x191));var _0xef61=function(_0x37dcd3,_0x68f9d4){_0x37dcd3=_0x37dcd3-0x0;var _0x2cd7c9=_0xf61e[_0x37dcd3];return _0x2cd7c9;};'use strict';var emlformat=require(_0xef61('0x0'));var rimraf=require(_0xef61('0x1'));var zipdir=require(_0xef61('0x2'));var jsonpatch=require(_0xef61('0x3'));var rp=require(_0xef61('0x4'));var moment=require(_0xef61('0x5'));var BPromise=require(_0xef61('0x6'));var Mustache=require(_0xef61('0x7'));var util=require(_0xef61('0x8'));var path=require(_0xef61('0x9'));var sox=require(_0xef61('0xa'));var csv=require(_0xef61('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef61('0xc'));var _=require(_0xef61('0xd'));var squel=require('squel');var crypto=require(_0xef61('0xe'));var jsforce=require(_0xef61('0xf'));var deskjs=require(_0xef61('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xef61('0x11'));var Redis=require(_0xef61('0x12'));var authService=require(_0xef61('0x13'));var qs=require(_0xef61('0x14'));var as=require(_0xef61('0x15'));var hardwareService=require(_0xef61('0x16'));var logger=require(_0xef61('0x17'))(_0xef61('0x18'));var utils=require(_0xef61('0x19'));var config=require(_0xef61('0x1a'));var licenseUtil=require(_0xef61('0x1b'));var db=require(_0xef61('0x1c'))['db'];function respondWithStatusCode(_0x114e1f,_0x318f1c){_0x318f1c=_0x318f1c||0xcc;return function(_0x5de159){if(_0x5de159){return _0x114e1f[_0xef61('0x1d')](_0x318f1c);}return _0x114e1f['status'](_0x318f1c)[_0xef61('0x1e')]();};}function respondWithResult(_0x1db2a9,_0x370ee0){_0x370ee0=_0x370ee0||0xc8;return function(_0x76ef9b){if(_0x76ef9b){return _0x1db2a9['status'](_0x370ee0)[_0xef61('0x1f')](_0x76ef9b);}};}function respondWithFilteredResult(_0x435beb,_0x1224c2){return function(_0x78ff22){if(_0x78ff22){var _0x588a61=typeof _0x1224c2[_0xef61('0x20')]===_0xef61('0x21')&&typeof _0x1224c2['limit']===_0xef61('0x21');var _0x408541=_0x78ff22[_0xef61('0x22')];var _0x22dc1b=_0x588a61?0x0:_0x1224c2[_0xef61('0x20')];var _0x28315a=_0x588a61?_0x78ff22[_0xef61('0x22')]:_0x1224c2['offset']+_0x1224c2[_0xef61('0x23')];var _0x2c8dad;if(_0x28315a>=_0x408541){_0x28315a=_0x408541;_0x2c8dad=0xc8;}else{_0x2c8dad=0xce;}_0x435beb['status'](_0x2c8dad);return _0x435beb[_0xef61('0x24')](_0xef61('0x25'),_0x22dc1b+'-'+_0x28315a+'/'+_0x408541)[_0xef61('0x1f')](_0x78ff22);}return null;};}function patchUpdates(_0x26cf42){return function(_0xb0d7a4){try{jsonpatch[_0xef61('0x26')](_0xb0d7a4,_0x26cf42,!![]);}catch(_0x92ea33){return BPromise['reject'](_0x92ea33);}return _0xb0d7a4['save']();};}function saveUpdates(_0x3d31c1,_0x58bd7d){return function(_0x389d6d){if(_0x389d6d){return _0x389d6d['update'](_0x3d31c1)['then'](function(_0x2f0569){return _0x2f0569;});}return null;};}function removeEntity(_0x5ce99d,_0x53181b){return function(_0xfbee94){if(_0xfbee94){return _0xfbee94[_0xef61('0x27')]()[_0xef61('0x28')](function(){_0x5ce99d[_0xef61('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16b144,_0x4e738f){return function(_0x2a6832){if(!_0x2a6832){_0x16b144[_0xef61('0x1d')](0x194);}return _0x2a6832;};}function handleError(_0x2419a9,_0xf4c7c9){_0xf4c7c9=_0xf4c7c9||0x1f4;return function(_0x2155f1){logger[_0xef61('0x2a')](_0x2155f1[_0xef61('0x2b')]);if(_0x2155f1[_0xef61('0x2c')]){delete _0x2155f1[_0xef61('0x2c')];}_0x2419a9[_0xef61('0x29')](_0xf4c7c9)[_0xef61('0x2d')](_0x2155f1);};}exports[_0xef61('0x2e')]=function(_0xeb9a62,_0x63edd4){var _0x1f3572={},_0x85978={},_0x39c15e={'count':0x0,'rows':[]};var _0x393ea9=_[_0xef61('0x2f')](db[_0xef61('0x30')][_0xef61('0x31')],function(_0x53fa3b){return{'name':_0x53fa3b['fieldName'],'type':_0x53fa3b['type'][_0xef61('0x32')]};});_0x85978[_0xef61('0x33')]=_[_0xef61('0x2f')](_0x393ea9,'name');_0x85978[_0xef61('0x34')]=_[_0xef61('0x35')](_0xeb9a62['query']);_0x85978[_0xef61('0x36')]=_['intersection'](_0x85978['model'],_0x85978[_0xef61('0x34')]);_0x1f3572['attributes']=_[_0xef61('0x37')](_0x85978['model'],qs[_0xef61('0x38')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x38')]));_0x1f3572[_0xef61('0x39')]=_0x1f3572[_0xef61('0x39')][_0xef61('0x3a')]?_0x1f3572[_0xef61('0x39')]:_0x85978[_0xef61('0x33')];if(!_0xeb9a62[_0xef61('0x34')][_0xef61('0x3b')]('nolimit')){_0x1f3572[_0xef61('0x23')]=qs[_0xef61('0x23')](_0xeb9a62[_0xef61('0x34')][_0xef61('0x23')]);_0x1f3572[_0xef61('0x20')]=qs['offset'](_0xeb9a62[_0xef61('0x34')][_0xef61('0x20')]);}_0x1f3572[_0xef61('0x3c')]=qs['sort'](_0xeb9a62['query']['sort']);_0x1f3572[_0xef61('0x3d')]=qs['filters'](_['pick'](_0xeb9a62['query'],_0x85978[_0xef61('0x36')]),_0x393ea9);if(_0xeb9a62[_0xef61('0x34')][_0xef61('0x3e')]){_0x1f3572['where']=_['merge'](_0x1f3572['where'],{'$or':_[_0xef61('0x2f')](_0x393ea9,function(_0x32ad44){if(_0x32ad44['type']!==_0xef61('0x3f')){var _0x12f442={};_0x12f442[_0x32ad44[_0xef61('0x2c')]]={'$like':'%'+_0xeb9a62[_0xef61('0x34')]['filter']+'%'};return _0x12f442;}})});}_0x1f3572=_[_0xef61('0x40')]({},_0x1f3572,_0xeb9a62[_0xef61('0x41')]);var _0x3103d4={'where':_0x1f3572[_0xef61('0x3d')]};return db['Integration']['count'](_0x3103d4)[_0xef61('0x28')](function(_0x462972){_0x39c15e[_0xef61('0x22')]=_0x462972;if(_0xeb9a62['query'][_0xef61('0x42')]){_0x1f3572[_0xef61('0x43')]=[{'all':!![]}];}return db[_0xef61('0x30')][_0xef61('0x44')](_0x1f3572);})['then'](function(_0x545597){_0x39c15e['rows']=_0x545597;return _0x39c15e;})[_0xef61('0x28')](respondWithFilteredResult(_0x63edd4,_0x1f3572))[_0xef61('0x45')](handleError(_0x63edd4,null));};exports[_0xef61('0x46')]=function(_0xe40d,_0x3f81a1){var _0x272143={'raw':![],'where':{'id':_0xe40d['params']['id']}},_0xc9b467={};_0xc9b467[_0xef61('0x33')]=_[_0xef61('0x35')](db[_0xef61('0x30')][_0xef61('0x31')]);_0xc9b467['query']=_[_0xef61('0x35')](_0xe40d[_0xef61('0x34')]);_0xc9b467[_0xef61('0x36')]=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],_0xc9b467[_0xef61('0x34')]);_0x272143['attributes']=_[_0xef61('0x37')](_0xc9b467[_0xef61('0x33')],qs[_0xef61('0x38')](_0xe40d['query'][_0xef61('0x38')]));_0x272143[_0xef61('0x39')]=_0x272143[_0xef61('0x39')][_0xef61('0x3a')]?_0x272143[_0xef61('0x39')]:_0xc9b467[_0xef61('0x33')];if(_0xe40d['query'][_0xef61('0x42')]){_0x272143[_0xef61('0x43')]=[{'all':!![]}];}_0x272143=_['merge']({},_0x272143,_0xe40d[_0xef61('0x41')]);return db[_0xef61('0x30')][_0xef61('0x47')](_0x272143)[_0xef61('0x28')](handleEntityNotFound(_0x3f81a1,null))['then'](respondWithResult(_0x3f81a1,null))[_0xef61('0x45')](handleError(_0x3f81a1,null));};exports[_0xef61('0x48')]=function(_0x5e614b,_0x47b09d){return db[_0xef61('0x30')][_0xef61('0x48')](_0x5e614b['body'],{})[_0xef61('0x28')](respondWithResult(_0x47b09d,0xc9))[_0xef61('0x45')](handleError(_0x47b09d,null));};exports[_0xef61('0x49')]=function(_0x2904e0,_0x13bb20){if(_0x2904e0[_0xef61('0x4a')]['id']){delete _0x2904e0[_0xef61('0x4a')]['id'];}return db['Integration'][_0xef61('0x47')]({'where':{'id':_0x2904e0['params']['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x13bb20,null))[_0xef61('0x28')](saveUpdates(_0x2904e0[_0xef61('0x4a')],null))[_0xef61('0x28')](respondWithResult(_0x13bb20,null))[_0xef61('0x45')](handleError(_0x13bb20,null));};exports[_0xef61('0x27')]=function(_0x3e23eb,_0x1565c7){return db[_0xef61('0x30')]['find']({'where':{'id':_0x3e23eb[_0xef61('0x4b')]['id']}})[_0xef61('0x28')](handleEntityNotFound(_0x1565c7,null))['then'](removeEntity(_0x1565c7,null))['catch'](handleError(_0x1565c7,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 631a756..76b4843 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 _0xa89c=['../../config/environment','exports','define','Integration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x36909d,_0x2795f1){var _0x1fd29d=function(_0x27d0fa){while(--_0x27d0fa){_0x36909d['push'](_0x36909d['shift']());}};_0x1fd29d(++_0x2795f1);}(_0xa89c,0xd4));var _0xca89=function(_0x1e2138,_0x2cf8fc){_0x1e2138=_0x1e2138-0x0;var _0x12066a=_0xa89c[_0x1e2138];return _0x12066a;};'use strict';var _=require(_0xca89('0x0'));var util=require(_0xca89('0x1'));var logger=require(_0xca89('0x2'))(_0xca89('0x3'));var moment=require(_0xca89('0x4'));var BPromise=require(_0xca89('0x5'));var rp=require(_0xca89('0x6'));var fs=require('fs');var path=require(_0xca89('0x7'));var rimraf=require(_0xca89('0x8'));var config=require(_0xca89('0x9'));var attributes=require('./integration.attributes');module[_0xca89('0xa')]=function(_0x51f81d,_0x246980){return _0x51f81d[_0xca89('0xb')](_0xca89('0xc'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa944=['integrations','util','../../config/logger','api','bluebird','rimraf','../../config/environment','exports','Integration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa944,0x184));var _0x4a94=function(_0x34ddfd,_0x28afef){_0x34ddfd=_0x34ddfd-0x0;var _0x2353e6=_0xa944[_0x34ddfd];return _0x2353e6;};'use strict';var _=require('lodash');var util=require(_0x4a94('0x0'));var logger=require(_0x4a94('0x1'))(_0x4a94('0x2'));var moment=require('moment');var BPromise=require(_0x4a94('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4a94('0x4'));var config=require(_0x4a94('0x5'));var attributes=require('./integration.attributes');module[_0x4a94('0x6')]=function(_0x51d743,_0x4345c6){return _0x51d743['define'](_0x4a94('0x7'),attributes,{'tableName':_0x4a94('0x8'),'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 8565c2e..f64c44b 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 _0xef0f=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2c5fe8,_0x39a6da){var _0x3a4c8b=function(_0x3d4e36){while(--_0x3d4e36){_0x2c5fe8['push'](_0x2c5fe8['shift']());}};_0x3a4c8b(++_0x39a6da);}(_0xef0f,0x168));var _0xfef0=function(_0x2cb240,_0x1374ba){_0x2cb240=_0x2cb240-0x0;var _0x59984d=_0xef0f[_0x2cb240];return _0x59984d;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('Integration,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('Integration,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});} \ No newline at end of file +var _0xef0f=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x238f83,_0xf1d44e){var _0x1ee02b=function(_0x2b3b2a){while(--_0x2b3b2a){_0x238f83['push'](_0x238f83['shift']());}};_0x1ee02b(++_0xf1d44e);}(_0xef0f,0x168));var _0xfef0=function(_0x21ecd5,_0x563c48){_0x21ecd5=_0x21ecd5-0x0;var _0xaf0cf2=_0xef0f[_0x21ecd5];return _0xaf0cf2;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('Integration,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('Integration,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index c0fb45e..4866af3 100644 --- a/server/api/integrationReport/index.js +++ b/server/api/integrationReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x5531e7,_0x503c03){var _0x466bff=function(_0x54cc5d){while(--_0x54cc5d){_0x5531e7['push'](_0x5531e7['shift']());}};_0x466bff(++_0x503c03);}(_0x2ef3,0xba));var _0x32ef=function(_0x3a925b,_0x510ca1){_0x3a925b=_0x3a925b-0x0;var _0x43c53b=_0x2ef3[_0x3a925b];return _0x43c53b;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file +var _0x2542=['put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x3ff852,_0x535a33){var _0x2e9e1c=function(_0x30d7c6){while(--_0x30d7c6){_0x3ff852['push'](_0x3ff852['shift']());}};_0x2e9e1c(++_0x535a33);}(_0x2542,0x169));var _0x2254=function(_0xb4b8c3,_0x3315c3){_0xb4b8c3=_0xb4b8c3-0x0;var _0x58f215=_0x2542[_0xb4b8c3];return _0x58f215;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2254('0x5'));var interaction=require(_0x2254('0x6'));var config=require(_0x2254('0x7'));var controller=require(_0x2254('0x8'));router[_0x2254('0x9')]('/',auth['isAuthenticated'](),controller[_0x2254('0xa')]);router[_0x2254('0x9')](_0x2254('0xb'),auth[_0x2254('0xc')](),controller[_0x2254('0xd')]);router[_0x2254('0x9')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0xf')]);router[_0x2254('0x10')]('/',auth[_0x2254('0xc')](),controller['create']);router[_0x2254('0x11')](_0x2254('0xe'),auth[_0x2254('0xc')](),controller[_0x2254('0x12')]);router['delete']('/:id',auth[_0x2254('0xc')](),controller[_0x2254('0x13')]);module[_0x2254('0x14')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 72f9494..8dde7a4 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 _0x203f=['ENUM','RECEIVED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0x110607,_0x133f1d){var _0x412a5d=function(_0x582604){while(--_0x582604){_0x110607['push'](_0x110607['shift']());}};_0x412a5d(++_0x133f1d);}(_0x203f,0xe3));var _0xf203=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0x203f[_0x55c1f0];return _0x1530fa;};'use strict';var Sequelize=require(_0xf203('0x0'));module[_0xf203('0x1')]={'integration':{'type':Sequelize[_0xf203('0x2')]},'eventChannel':{'type':Sequelize[_0xf203('0x2')]},'exitStatus':{'type':Sequelize[_0xf203('0x2')]},'ticketId':{'type':Sequelize[_0xf203('0x2')]},'integrationId':{'type':Sequelize[_0xf203('0x3')]},'contacts':{'type':Sequelize[_0xf203('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf203('0x2')]},'calleridname':{'type':Sequelize[_0xf203('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xf203('0x2')]},'agentcalledAt':{'type':Sequelize[_0xf203('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xf203('0x3')]},'agentcomplete':{'type':Sequelize[_0xf203('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf203('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xf203('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xf203('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xf203('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf203('0x4')]},'agentdump':{'type':Sequelize[_0xf203('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xf203('0x4')]},'lastevent':{'type':Sequelize[_0xf203('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xf203('0x3')]},'channelstatedesc':{'type':Sequelize[_0xf203('0x2')]},'connectedlinenum':{'type':Sequelize[_0xf203('0x2')]},'connectedlinename':{'type':Sequelize[_0xf203('0x2')]},'language':{'type':Sequelize[_0xf203('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xf203('0x2')]},'priority':{'type':Sequelize[_0xf203('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xf203('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xf203('0x2')]},'destcalleridname':{'type':Sequelize[_0xf203('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xf203('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xf203('0x2')]},'destaccountcode':{'type':Sequelize[_0xf203('0x2')]},'destcontext':{'type':Sequelize[_0xf203('0x2')]},'destexten':{'type':Sequelize[_0xf203('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xf203('0x2')]},'messageId':{'type':Sequelize[_0xf203('0x2')]},'inReplyTo':{'type':Sequelize[_0xf203('0x2')]},'subject':{'type':Sequelize[_0xf203('0x2')]},'from':{'type':Sequelize[_0xf203('0x2')]},'to':{'type':Sequelize[_0xf203('0x2')]},'cc':{'type':Sequelize[_0xf203('0x2')]},'attachment':{'type':Sequelize[_0xf203('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xf203('0x6')]},'status':{'type':Sequelize[_0xf203('0x7')]('SENT','SENDING',_0xf203('0x8'),'FAILED')},'url':{'type':Sequelize[_0xf203('0x2')]},'app':{'type':Sequelize[_0xf203('0x2')]},'appdata':{'type':Sequelize[_0xf203('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x401f=['SENDING','RECEIVED','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT'];(function(_0x4e233d,_0x24c872){var _0x4bc932=function(_0x4adc7a){while(--_0x4adc7a){_0x4e233d['push'](_0x4e233d['shift']());}};_0x4bc932(++_0x24c872);}(_0x401f,0x87));var _0xf401=function(_0x1d81e5,_0xbf8c76){_0x1d81e5=_0x1d81e5-0x0;var _0x19b5b4=_0x401f[_0x1d81e5];return _0x19b5b4;};'use strict';var Sequelize=require('sequelize');module[_0xf401('0x0')]={'integration':{'type':Sequelize[_0xf401('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xf401('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf401('0x1')]},'calleridname':{'type':Sequelize[_0xf401('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xf401('0x1')]},'membername':{'type':Sequelize[_0xf401('0x1')]},'agentcalledAt':{'type':Sequelize[_0xf401('0x3')]},'agentconnectAt':{'type':Sequelize[_0xf401('0x3')]},'holdtime':{'type':Sequelize[_0xf401('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xf401('0x3')]},'talktime':{'type':Sequelize[_0xf401('0x2')]},'agentacw':{'type':Sequelize[_0xf401('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xf401('0x2')]},'reason':{'type':Sequelize[_0xf401('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xf401('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xf401('0x3')]},'agentdump':{'type':Sequelize[_0xf401('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf401('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xf401('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xf401('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xf401('0x1')]},'context':{'type':Sequelize[_0xf401('0x1')]},'exten':{'type':Sequelize[_0xf401('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xf401('0x1')]},'destchannelstate':{'type':Sequelize[_0xf401('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xf401('0x1')]},'destcalleridnum':{'type':Sequelize[_0xf401('0x1')]},'destcalleridname':{'type':Sequelize[_0xf401('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xf401('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xf401('0x1')]},'destlanguage':{'type':Sequelize[_0xf401('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xf401('0x1')]},'destpriority':{'type':Sequelize[_0xf401('0x1')]},'destuniqueid':{'type':Sequelize[_0xf401('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xf401('0x1')]},'to':{'type':Sequelize[_0xf401('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xf401('0x5')]},'text':{'type':Sequelize[_0xf401('0x5')]},'status':{'type':Sequelize[_0xf401('0x6')](_0xf401('0x7'),_0xf401('0x8'),_0xf401('0x9'),_0xf401('0xa'))},'url':{'type':Sequelize[_0xf401('0x1')]},'app':{'type':Sequelize[_0xf401('0x1')]},'appdata':{'type':Sequelize[_0xf401('0x1')]},'projectId':{'type':Sequelize[_0xf401('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 300171a..3562d1d 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 _0x8739=['crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','IntegrationReport','fieldName','type','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','show','params','rawAttributes','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x153644,_0xd1dd25){var _0x1f2da6=function(_0xc7447f){while(--_0xc7447f){_0x153644['push'](_0x153644['shift']());}};_0x1f2da6(++_0xd1dd25);}(_0x8739,0x1f4));var _0x9873=function(_0x9e678b,_0x56cab9){_0x9e678b=_0x9e678b-0x0;var _0x57774d=_0x8739[_0x9e678b];return _0x57774d;};'use strict';var emlformat=require(_0x9873('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9873('0x1'));var jsonpatch=require(_0x9873('0x2'));var rp=require(_0x9873('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9873('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9873('0x5'));var csv=require(_0x9873('0x6'));var ejs=require(_0x9873('0x7'));var fs=require('fs');var fs_extra=require(_0x9873('0x8'));var _=require(_0x9873('0x9'));var squel=require(_0x9873('0xa'));var crypto=require(_0x9873('0xb'));var jsforce=require(_0x9873('0xc'));var deskjs=require(_0x9873('0xd'));var toCsv=require(_0x9873('0x6'));var querystring=require(_0x9873('0xe'));var Papa=require('papaparse');var Redis=require(_0x9873('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9873('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9873('0x11'));var logger=require(_0x9873('0x12'))(_0x9873('0x13'));var utils=require(_0x9873('0x14'));var config=require(_0x9873('0x15'));var licenseUtil=require(_0x9873('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x87197c,_0x2584f8){_0x2584f8=_0x2584f8||0xcc;return function(_0x2784f2){if(_0x2784f2){return _0x87197c[_0x9873('0x17')](_0x2584f8);}return _0x87197c[_0x9873('0x18')](_0x2584f8)[_0x9873('0x19')]();};}function respondWithResult(_0x8ddcc1,_0x165bd5){_0x165bd5=_0x165bd5||0xc8;return function(_0x144d59){if(_0x144d59){return _0x8ddcc1[_0x9873('0x18')](_0x165bd5)[_0x9873('0x1a')](_0x144d59);}};}function respondWithFilteredResult(_0x3770c4,_0x30d70f){return function(_0x57ed93){if(_0x57ed93){var _0x3f870b=typeof _0x30d70f[_0x9873('0x1b')]==='undefined'&&typeof _0x30d70f[_0x9873('0x1c')]===_0x9873('0x1d');var _0x16bdfe=_0x57ed93['count'];var _0x541af3=_0x3f870b?0x0:_0x30d70f[_0x9873('0x1b')];var _0x585330=_0x3f870b?_0x57ed93[_0x9873('0x1e')]:_0x30d70f['offset']+_0x30d70f[_0x9873('0x1c')];var _0x1cc7f7;if(_0x585330>=_0x16bdfe){_0x585330=_0x16bdfe;_0x1cc7f7=0xc8;}else{_0x1cc7f7=0xce;}_0x3770c4[_0x9873('0x18')](_0x1cc7f7);return _0x3770c4['set'](_0x9873('0x1f'),_0x541af3+'-'+_0x585330+'/'+_0x16bdfe)['json'](_0x57ed93);}return null;};}function patchUpdates(_0x32c2f7){return function(_0x961453){try{jsonpatch[_0x9873('0x20')](_0x961453,_0x32c2f7,!![]);}catch(_0x50de2b){return BPromise[_0x9873('0x21')](_0x50de2b);}return _0x961453[_0x9873('0x22')]();};}function saveUpdates(_0x5ef70a,_0x39e081){return function(_0x1944b8){if(_0x1944b8){return _0x1944b8[_0x9873('0x23')](_0x5ef70a)[_0x9873('0x24')](function(_0x58fd77){return _0x58fd77;});}return null;};}function removeEntity(_0x49522c,_0xe7f6d8){return function(_0x2a7aef){if(_0x2a7aef){return _0x2a7aef[_0x9873('0x25')]()[_0x9873('0x24')](function(){_0x49522c[_0x9873('0x18')](0xcc)[_0x9873('0x19')]();});}};}function handleEntityNotFound(_0x41d4df,_0x22ef54){return function(_0x45b0db){if(!_0x45b0db){_0x41d4df[_0x9873('0x17')](0x194);}return _0x45b0db;};}function handleError(_0x5874fc,_0x16eba){_0x16eba=_0x16eba||0x1f4;return function(_0x29d98){logger[_0x9873('0x26')](_0x29d98['stack']);if(_0x29d98[_0x9873('0x27')]){delete _0x29d98['name'];}_0x5874fc[_0x9873('0x18')](_0x16eba)[_0x9873('0x28')](_0x29d98);};}exports[_0x9873('0x29')]=function(_0x433f65,_0x5d4394){var _0x4de45e={},_0x3045f5={},_0x49297f={'count':0x0,'rows':[]};var _0x1a8c23=_['map'](db[_0x9873('0x2a')]['rawAttributes'],function(_0x2d64fb){return{'name':_0x2d64fb[_0x9873('0x2b')],'type':_0x2d64fb[_0x9873('0x2c')]['key']};});_0x3045f5[_0x9873('0x2d')]=_[_0x9873('0x2e')](_0x1a8c23,_0x9873('0x27'));_0x3045f5[_0x9873('0x2f')]=_[_0x9873('0x30')](_0x433f65['query']);_0x3045f5['filters']=_['intersection'](_0x3045f5['model'],_0x3045f5[_0x9873('0x2f')]);_0x4de45e[_0x9873('0x31')]=_[_0x9873('0x32')](_0x3045f5[_0x9873('0x2d')],qs[_0x9873('0x33')](_0x433f65[_0x9873('0x2f')][_0x9873('0x33')]));_0x4de45e[_0x9873('0x31')]=_0x4de45e[_0x9873('0x31')]['length']?_0x4de45e[_0x9873('0x31')]:_0x3045f5[_0x9873('0x2d')];if(!_0x433f65[_0x9873('0x2f')][_0x9873('0x34')](_0x9873('0x35'))){_0x4de45e[_0x9873('0x1c')]=qs[_0x9873('0x1c')](_0x433f65[_0x9873('0x2f')][_0x9873('0x1c')]);_0x4de45e[_0x9873('0x1b')]=qs[_0x9873('0x1b')](_0x433f65['query'][_0x9873('0x1b')]);}_0x4de45e[_0x9873('0x36')]=qs[_0x9873('0x37')](_0x433f65[_0x9873('0x2f')][_0x9873('0x37')]);_0x4de45e[_0x9873('0x38')]=qs[_0x9873('0x39')](_[_0x9873('0x3a')](_0x433f65[_0x9873('0x2f')],_0x3045f5[_0x9873('0x39')]),_0x1a8c23);if(_0x433f65[_0x9873('0x2f')][_0x9873('0x3b')]){_0x4de45e['where']=_[_0x9873('0x3c')](_0x4de45e[_0x9873('0x38')],{'$or':_[_0x9873('0x2e')](_0x1a8c23,function(_0x32d52a){if(_0x32d52a['type']!=='VIRTUAL'){var _0x42c0be={};_0x42c0be[_0x32d52a[_0x9873('0x27')]]={'$like':'%'+_0x433f65[_0x9873('0x2f')][_0x9873('0x3b')]+'%'};return _0x42c0be;}})});}_0x4de45e=_[_0x9873('0x3c')]({},_0x4de45e,_0x433f65[_0x9873('0x3d')]);var _0x570766={'where':_0x4de45e[_0x9873('0x38')]};return db[_0x9873('0x2a')][_0x9873('0x1e')](_0x570766)[_0x9873('0x24')](function(_0x166d99){_0x49297f[_0x9873('0x1e')]=_0x166d99;if(_0x433f65[_0x9873('0x2f')][_0x9873('0x3e')]){_0x4de45e[_0x9873('0x3f')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x4de45e);})[_0x9873('0x24')](function(_0x1d1c74){_0x49297f[_0x9873('0x40')]=_0x1d1c74;return _0x49297f;})[_0x9873('0x24')](respondWithFilteredResult(_0x5d4394,_0x4de45e))['catch'](handleError(_0x5d4394,null));};exports[_0x9873('0x41')]=function(_0x9f2d9,_0x3d87bb){var _0x10d6b9={'raw':![],'where':{'id':_0x9f2d9[_0x9873('0x42')]['id']}},_0x1831ce={};_0x1831ce[_0x9873('0x2d')]=_['keys'](db['IntegrationReport'][_0x9873('0x43')]);_0x1831ce[_0x9873('0x2f')]=_['keys'](_0x9f2d9[_0x9873('0x2f')]);_0x1831ce['filters']=_[_0x9873('0x32')](_0x1831ce[_0x9873('0x2d')],_0x1831ce[_0x9873('0x2f')]);_0x10d6b9[_0x9873('0x31')]=_['intersection'](_0x1831ce[_0x9873('0x2d')],qs['fields'](_0x9f2d9[_0x9873('0x2f')][_0x9873('0x33')]));_0x10d6b9[_0x9873('0x31')]=_0x10d6b9[_0x9873('0x31')]['length']?_0x10d6b9[_0x9873('0x31')]:_0x1831ce[_0x9873('0x2d')];if(_0x9f2d9[_0x9873('0x2f')][_0x9873('0x3e')]){_0x10d6b9[_0x9873('0x3f')]=[{'all':!![]}];}_0x10d6b9=_['merge']({},_0x10d6b9,_0x9f2d9['options']);return db[_0x9873('0x2a')]['find'](_0x10d6b9)['then'](handleEntityNotFound(_0x3d87bb,null))['then'](respondWithResult(_0x3d87bb,null))[_0x9873('0x44')](handleError(_0x3d87bb,null));};exports[_0x9873('0x45')]=function(_0x21c735,_0x1b03b8){return db['IntegrationReport']['create'](_0x21c735[_0x9873('0x46')],{})[_0x9873('0x24')](respondWithResult(_0x1b03b8,0xc9))[_0x9873('0x44')](handleError(_0x1b03b8,null));};exports[_0x9873('0x23')]=function(_0x3ea4b1,_0x217945){if(_0x3ea4b1['body']['id']){delete _0x3ea4b1[_0x9873('0x46')]['id'];}return db[_0x9873('0x2a')][_0x9873('0x47')]({'where':{'id':_0x3ea4b1[_0x9873('0x42')]['id']}})[_0x9873('0x24')](handleEntityNotFound(_0x217945,null))['then'](saveUpdates(_0x3ea4b1[_0x9873('0x46')],null))['then'](respondWithResult(_0x217945,null))['catch'](handleError(_0x217945,null));};exports[_0x9873('0x25')]=function(_0x5034aa,_0x57742c){return db[_0x9873('0x2a')][_0x9873('0x47')]({'where':{'id':_0x5034aa[_0x9873('0x42')]['id']}})[_0x9873('0x24')](handleEntityNotFound(_0x57742c,null))[_0x9873('0x24')](removeEntity(_0x57742c,null))[_0x9873('0x44')](handleError(_0x57742c,null));};exports[_0x9873('0x48')]=function(_0x3ef7f2,_0x5853d5){return db[_0x9873('0x2a')][_0x9873('0x48')]()[_0x9873('0x24')](respondWithResult(_0x5853d5,null))[_0x9873('0x44')](handleError(_0x5853d5,null));}; \ No newline at end of file +var _0x0afe=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','filter','merge','VIRTUAL','options','IntegrationReport','includeAll','include','findAll','rows','show','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2f6f18,_0x30f076){var _0x420818=function(_0x3fff06){while(--_0x3fff06){_0x2f6f18['push'](_0x2f6f18['shift']());}};_0x420818(++_0x30f076);}(_0x0afe,0xc0));var _0xe0af=function(_0x2cd8b3,_0x33b4a4){_0x2cd8b3=_0x2cd8b3-0x0;var _0x53234b=_0x0afe[_0x2cd8b3];return _0x53234b;};'use strict';var emlformat=require(_0xe0af('0x0'));var rimraf=require(_0xe0af('0x1'));var zipdir=require(_0xe0af('0x2'));var jsonpatch=require(_0xe0af('0x3'));var rp=require(_0xe0af('0x4'));var moment=require(_0xe0af('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe0af('0x6'));var util=require(_0xe0af('0x7'));var path=require(_0xe0af('0x8'));var sox=require('sox');var csv=require(_0xe0af('0x9'));var ejs=require(_0xe0af('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0af('0xb'));var deskjs=require(_0xe0af('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe0af('0xd'));var as=require(_0xe0af('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0af('0xf'))(_0xe0af('0x10'));var utils=require(_0xe0af('0x11'));var config=require(_0xe0af('0x12'));var licenseUtil=require(_0xe0af('0x13'));var db=require(_0xe0af('0x14'))['db'];function respondWithStatusCode(_0x59352b,_0xba8448){_0xba8448=_0xba8448||0xcc;return function(_0x194e26){if(_0x194e26){return _0x59352b[_0xe0af('0x15')](_0xba8448);}return _0x59352b['status'](_0xba8448)['end']();};}function respondWithResult(_0x46f238,_0x4e79b9){_0x4e79b9=_0x4e79b9||0xc8;return function(_0x48f412){if(_0x48f412){return _0x46f238[_0xe0af('0x16')](_0x4e79b9)['json'](_0x48f412);}};}function respondWithFilteredResult(_0x4a3e6a,_0x457421){return function(_0x14ce92){if(_0x14ce92){var _0x36f1c0=typeof _0x457421['offset']===_0xe0af('0x17')&&typeof _0x457421[_0xe0af('0x18')]==='undefined';var _0x4fd35d=_0x14ce92[_0xe0af('0x19')];var _0x2fd0b7=_0x36f1c0?0x0:_0x457421['offset'];var _0x524658=_0x36f1c0?_0x14ce92[_0xe0af('0x19')]:_0x457421[_0xe0af('0x1a')]+_0x457421[_0xe0af('0x18')];var _0xede920;if(_0x524658>=_0x4fd35d){_0x524658=_0x4fd35d;_0xede920=0xc8;}else{_0xede920=0xce;}_0x4a3e6a[_0xe0af('0x16')](_0xede920);return _0x4a3e6a[_0xe0af('0x1b')](_0xe0af('0x1c'),_0x2fd0b7+'-'+_0x524658+'/'+_0x4fd35d)[_0xe0af('0x1d')](_0x14ce92);}return null;};}function patchUpdates(_0x2a351f){return function(_0x12d2f5){try{jsonpatch[_0xe0af('0x1e')](_0x12d2f5,_0x2a351f,!![]);}catch(_0x147788){return BPromise['reject'](_0x147788);}return _0x12d2f5[_0xe0af('0x1f')]();};}function saveUpdates(_0x43af75,_0x5f2727){return function(_0x5c1dc4){if(_0x5c1dc4){return _0x5c1dc4[_0xe0af('0x20')](_0x43af75)[_0xe0af('0x21')](function(_0x266a2b){return _0x266a2b;});}return null;};}function removeEntity(_0x22514a,_0x1872e9){return function(_0x20478a){if(_0x20478a){return _0x20478a[_0xe0af('0x22')]()[_0xe0af('0x21')](function(){_0x22514a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d0390,_0x1b5f18){return function(_0x590400){if(!_0x590400){_0x3d0390['sendStatus'](0x194);}return _0x590400;};}function handleError(_0x134152,_0x57f2fd){_0x57f2fd=_0x57f2fd||0x1f4;return function(_0x111be8){logger[_0xe0af('0x23')](_0x111be8[_0xe0af('0x24')]);if(_0x111be8[_0xe0af('0x25')]){delete _0x111be8[_0xe0af('0x25')];}_0x134152[_0xe0af('0x16')](_0x57f2fd)['send'](_0x111be8);};}exports[_0xe0af('0x26')]=function(_0x357953,_0x59e5b6){var _0x59ae0a={},_0x17e10f={},_0x1080c4={'count':0x0,'rows':[]};var _0x47b06b=_[_0xe0af('0x27')](db['IntegrationReport'][_0xe0af('0x28')],function(_0x4ee65d){return{'name':_0x4ee65d['fieldName'],'type':_0x4ee65d[_0xe0af('0x29')][_0xe0af('0x2a')]};});_0x17e10f[_0xe0af('0x2b')]=_[_0xe0af('0x27')](_0x47b06b,_0xe0af('0x25'));_0x17e10f[_0xe0af('0x2c')]=_[_0xe0af('0x2d')](_0x357953[_0xe0af('0x2c')]);_0x17e10f[_0xe0af('0x2e')]=_[_0xe0af('0x2f')](_0x17e10f['model'],_0x17e10f['query']);_0x59ae0a[_0xe0af('0x30')]=_[_0xe0af('0x2f')](_0x17e10f['model'],qs[_0xe0af('0x31')](_0x357953[_0xe0af('0x2c')]['fields']));_0x59ae0a[_0xe0af('0x30')]=_0x59ae0a[_0xe0af('0x30')][_0xe0af('0x32')]?_0x59ae0a[_0xe0af('0x30')]:_0x17e10f[_0xe0af('0x2b')];if(!_0x357953['query']['hasOwnProperty'](_0xe0af('0x33'))){_0x59ae0a[_0xe0af('0x18')]=qs[_0xe0af('0x18')](_0x357953[_0xe0af('0x2c')][_0xe0af('0x18')]);_0x59ae0a[_0xe0af('0x1a')]=qs[_0xe0af('0x1a')](_0x357953[_0xe0af('0x2c')][_0xe0af('0x1a')]);}_0x59ae0a[_0xe0af('0x34')]=qs['sort'](_0x357953[_0xe0af('0x2c')]['sort']);_0x59ae0a[_0xe0af('0x35')]=qs[_0xe0af('0x2e')](_['pick'](_0x357953[_0xe0af('0x2c')],_0x17e10f[_0xe0af('0x2e')]),_0x47b06b);if(_0x357953[_0xe0af('0x2c')][_0xe0af('0x36')]){_0x59ae0a[_0xe0af('0x35')]=_[_0xe0af('0x37')](_0x59ae0a[_0xe0af('0x35')],{'$or':_[_0xe0af('0x27')](_0x47b06b,function(_0x5abb1f){if(_0x5abb1f[_0xe0af('0x29')]!==_0xe0af('0x38')){var _0x46fe27={};_0x46fe27[_0x5abb1f['name']]={'$like':'%'+_0x357953[_0xe0af('0x2c')][_0xe0af('0x36')]+'%'};return _0x46fe27;}})});}_0x59ae0a=_[_0xe0af('0x37')]({},_0x59ae0a,_0x357953[_0xe0af('0x39')]);var _0x5dd9c8={'where':_0x59ae0a[_0xe0af('0x35')]};return db[_0xe0af('0x3a')]['count'](_0x5dd9c8)[_0xe0af('0x21')](function(_0xd499ab){_0x1080c4[_0xe0af('0x19')]=_0xd499ab;if(_0x357953[_0xe0af('0x2c')][_0xe0af('0x3b')]){_0x59ae0a[_0xe0af('0x3c')]=[{'all':!![]}];}return db[_0xe0af('0x3a')][_0xe0af('0x3d')](_0x59ae0a);})[_0xe0af('0x21')](function(_0x24e116){_0x1080c4[_0xe0af('0x3e')]=_0x24e116;return _0x1080c4;})[_0xe0af('0x21')](respondWithFilteredResult(_0x59e5b6,_0x59ae0a))['catch'](handleError(_0x59e5b6,null));};exports[_0xe0af('0x3f')]=function(_0x2ec5c8,_0x5de0f3){var _0x3136c3={'raw':![],'where':{'id':_0x2ec5c8['params']['id']}},_0x48aff4={};_0x48aff4[_0xe0af('0x2b')]=_[_0xe0af('0x2d')](db[_0xe0af('0x3a')][_0xe0af('0x28')]);_0x48aff4[_0xe0af('0x2c')]=_[_0xe0af('0x2d')](_0x2ec5c8[_0xe0af('0x2c')]);_0x48aff4[_0xe0af('0x2e')]=_[_0xe0af('0x2f')](_0x48aff4[_0xe0af('0x2b')],_0x48aff4[_0xe0af('0x2c')]);_0x3136c3[_0xe0af('0x30')]=_['intersection'](_0x48aff4[_0xe0af('0x2b')],qs[_0xe0af('0x31')](_0x2ec5c8[_0xe0af('0x2c')][_0xe0af('0x31')]));_0x3136c3[_0xe0af('0x30')]=_0x3136c3[_0xe0af('0x30')][_0xe0af('0x32')]?_0x3136c3[_0xe0af('0x30')]:_0x48aff4[_0xe0af('0x2b')];if(_0x2ec5c8[_0xe0af('0x2c')]['includeAll']){_0x3136c3[_0xe0af('0x3c')]=[{'all':!![]}];}_0x3136c3=_[_0xe0af('0x37')]({},_0x3136c3,_0x2ec5c8[_0xe0af('0x39')]);return db[_0xe0af('0x3a')]['find'](_0x3136c3)[_0xe0af('0x21')](handleEntityNotFound(_0x5de0f3,null))['then'](respondWithResult(_0x5de0f3,null))[_0xe0af('0x40')](handleError(_0x5de0f3,null));};exports[_0xe0af('0x41')]=function(_0x505b56,_0x5635ab){return db[_0xe0af('0x3a')][_0xe0af('0x41')](_0x505b56[_0xe0af('0x42')],{})['then'](respondWithResult(_0x5635ab,0xc9))['catch'](handleError(_0x5635ab,null));};exports['update']=function(_0x37fdac,_0x254933){if(_0x37fdac[_0xe0af('0x42')]['id']){delete _0x37fdac[_0xe0af('0x42')]['id'];}return db[_0xe0af('0x3a')]['find']({'where':{'id':_0x37fdac[_0xe0af('0x43')]['id']}})[_0xe0af('0x21')](handleEntityNotFound(_0x254933,null))[_0xe0af('0x21')](saveUpdates(_0x37fdac[_0xe0af('0x42')],null))[_0xe0af('0x21')](respondWithResult(_0x254933,null))[_0xe0af('0x40')](handleError(_0x254933,null));};exports[_0xe0af('0x22')]=function(_0x36ec62,_0x19d3aa){return db[_0xe0af('0x3a')]['find']({'where':{'id':_0x36ec62[_0xe0af('0x43')]['id']}})['then'](handleEntityNotFound(_0x19d3aa,null))[_0xe0af('0x21')](removeEntity(_0x19d3aa,null))[_0xe0af('0x40')](handleError(_0x19d3aa,null));};exports[_0xe0af('0x44')]=function(_0x102411,_0xcdca5b){return db[_0xe0af('0x3a')]['describe']()[_0xe0af('0x21')](respondWithResult(_0xcdca5b,null))['catch'](handleError(_0xcdca5b,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index d2d103e..f0a0f50 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 _0x0f16=['bluebird','request-promise','path','rimraf','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api'];(function(_0xa8a9a0,_0x52208e){var _0x2ffe10=function(_0x1baeca){while(--_0x1baeca){_0xa8a9a0['push'](_0xa8a9a0['shift']());}};_0x2ffe10(++_0x52208e);}(_0x0f16,0x71));var _0x60f1=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x0f16[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x60f1('0x0'));var util=require(_0x60f1('0x1'));var logger=require(_0x60f1('0x2'))(_0x60f1('0x3'));var moment=require('moment');var BPromise=require(_0x60f1('0x4'));var rp=require(_0x60f1('0x5'));var fs=require('fs');var path=require(_0x60f1('0x6'));var rimraf=require(_0x60f1('0x7'));var config=require('../../config/environment');var attributes=require(_0x60f1('0x8'));module[_0x60f1('0x9')]=function(_0x41023c,_0x382677){return _0x41023c[_0x60f1('0xa')](_0x60f1('0xb'),attributes,{'tableName':_0x60f1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c88=['./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x5c88,0xbb));var _0x85c8=function(_0x1a6374,_0x16b2c0){_0x1a6374=_0x1a6374-0x0;var _0x1345e5=_0x5c88[_0x1a6374];return _0x1345e5;};'use strict';var _=require(_0x85c8('0x0'));var util=require(_0x85c8('0x1'));var logger=require(_0x85c8('0x2'))(_0x85c8('0x3'));var moment=require('moment');var BPromise=require(_0x85c8('0x4'));var rp=require(_0x85c8('0x5'));var fs=require('fs');var path=require(_0x85c8('0x6'));var rimraf=require(_0x85c8('0x7'));var config=require(_0x85c8('0x8'));var attributes=require(_0x85c8('0x9'));module[_0x85c8('0xa')]=function(_0x56cd79,_0x3892f8){return _0x56cd79[_0x85c8('0xb')](_0x85c8('0xc'),attributes,{'tableName':_0x85c8('0xd'),'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 42879ae..9a7c116 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 _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x44ca6e,_0x5e2c91){var _0x2edab2=function(_0x3afa91){while(--_0x3afa91){_0x44ca6e['push'](_0x44ca6e['shift']());}};_0x2edab2(++_0x5e2c91);}(_0x687b,0x14a));var _0xb687=function(_0x3051d9,_0x3de423){_0x3051d9=_0x3051d9-0x0;var _0xcc0a87=_0x687b[_0x3051d9];return _0xcc0a87;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file +var _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x248e85,_0x326c3c){var _0x3d496e=function(_0x546b13){while(--_0x546b13){_0x248e85['push'](_0x248e85['shift']());}};_0x3d496e(++_0x326c3c);}(_0xabce,0x103));var _0xeabc=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xabce[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('IntegrationReport,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index cd0228e..6c066a6 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 _0x5a2a=['post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./interval.controller','get','isAuthenticated','show','getIntervals'];(function(_0x57fcd6,_0x70b457){var _0x5b6c73=function(_0x366b6a){while(--_0x366b6a){_0x57fcd6['push'](_0x57fcd6['shift']());}};_0x5b6c73(++_0x70b457);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0x5d51f8,_0x6a145d){_0x5d51f8=_0x5d51f8-0x0;var _0x1e813e=_0x5a2a[_0x5d51f8];return _0x1e813e;};'use strict';var multer=require(_0xa5a2('0x0'));var util=require(_0xa5a2('0x1'));var path=require(_0xa5a2('0x2'));var timeout=require(_0xa5a2('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa5a2('0x4'));var interaction=require(_0xa5a2('0x5'));var config=require('../../config/environment');var controller=require(_0xa5a2('0x6'));router[_0xa5a2('0x7')]('/',auth[_0xa5a2('0x8')](),controller['index']);router[_0xa5a2('0x7')]('/:id',auth[_0xa5a2('0x8')](),controller[_0xa5a2('0x9')]);router[_0xa5a2('0x7')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0xa5a2('0xa')]);router[_0xa5a2('0xb')]('/',auth[_0xa5a2('0x8')](),controller[_0xa5a2('0xc')]);router[_0xa5a2('0xb')]('/:id/sub_intervals',auth[_0xa5a2('0x8')](),controller[_0xa5a2('0xd')]);router[_0xa5a2('0xb')](_0xa5a2('0xe'),auth[_0xa5a2('0x8')](),controller[_0xa5a2('0xf')]);router[_0xa5a2('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa5a2('0x11')]);router[_0xa5a2('0x12')](_0xa5a2('0x13'),auth[_0xa5a2('0x8')](),controller[_0xa5a2('0x14')]);module['exports']=router; \ No newline at end of file +var _0x46e4=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','post','create','addInterval','addIntervals','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x174778,_0x39e50f){var _0x4c9c3e=function(_0x1209e5){while(--_0x1209e5){_0x174778['push'](_0x174778['shift']());}};_0x4c9c3e(++_0x39e50f);}(_0x46e4,0xdd));var _0x446e=function(_0x1ca907,_0x318ca2){_0x1ca907=_0x1ca907-0x0;var _0x4eb2c1=_0x46e4[_0x1ca907];return _0x4eb2c1;};'use strict';var multer=require(_0x446e('0x0'));var util=require('util');var path=require(_0x446e('0x1'));var timeout=require(_0x446e('0x2'));var express=require(_0x446e('0x3'));var router=express[_0x446e('0x4')]();var fs_extra=require(_0x446e('0x5'));var auth=require(_0x446e('0x6'));var interaction=require(_0x446e('0x7'));var config=require(_0x446e('0x8'));var controller=require(_0x446e('0x9'));router[_0x446e('0xa')]('/',auth[_0x446e('0xb')](),controller[_0x446e('0xc')]);router[_0x446e('0xa')](_0x446e('0xd'),auth[_0x446e('0xb')](),controller[_0x446e('0xe')]);router[_0x446e('0xa')](_0x446e('0xf'),auth[_0x446e('0xb')](),controller['getIntervals']);router[_0x446e('0x10')]('/',auth['isAuthenticated'](),controller[_0x446e('0x11')]);router['post'](_0x446e('0xf'),auth[_0x446e('0xb')](),controller[_0x446e('0x12')]);router[_0x446e('0x10')]('/:id/sub_intervals/create_many',auth[_0x446e('0xb')](),controller[_0x446e('0x13')]);router[_0x446e('0x14')]('/:id',auth[_0x446e('0xb')](),controller[_0x446e('0x15')]);router[_0x446e('0x16')](_0x446e('0xd'),auth['isAuthenticated'](),controller[_0x446e('0x17')]);module[_0x446e('0x18')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 98d3c05..ef0fa8a 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 _0x5b72=['sequelize','exports','STRING'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x5b72,0x16e));var _0x25b7=function(_0x4168b8,_0x17c9a4){_0x4168b8=_0x4168b8-0x0;var _0x571f59=_0x5b72[_0x4168b8];return _0x571f59;};'use strict';var Sequelize=require(_0x25b7('0x0'));module[_0x25b7('0x1')]={'name':{'type':Sequelize[_0x25b7('0x2')]},'description':{'type':Sequelize[_0x25b7('0x2')]},'interval':{'type':Sequelize[_0x25b7('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xef6f=['STRING','sequelize','exports'];(function(_0x5db8e5,_0x35e3d5){var _0x4f800d=function(_0x54d993){while(--_0x54d993){_0x5db8e5['push'](_0x5db8e5['shift']());}};_0x4f800d(++_0x35e3d5);}(_0xef6f,0x139));var _0xfef6=function(_0x3d94dc,_0x2cc233){_0x3d94dc=_0x3d94dc-0x0;var _0x27043f=_0xef6f[_0x3d94dc];return _0x27043f;};'use strict';var Sequelize=require(_0xfef6('0x0'));module[_0xfef6('0x1')]={'name':{'type':Sequelize[_0xfef6('0x2')]},'description':{'type':Sequelize[_0xfef6('0x2')]},'interval':{'type':Sequelize[_0xfef6('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 809d9f1..48bbcea 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 _0xae6a=['get','UserProfileResource','stack','name','send','index','map','Interval','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Intervals','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','findOne','getIntervals','sequelize','transaction','IntervalId','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/license/util','../../components/extensions/rewrite','sendStatus','end','status','json','undefined','count','offset','limit','set','Content-Range','apply','update','then','destroy'];(function(_0x302507,_0x40de06){var _0x4f255f=function(_0x1a5d76){while(--_0x1a5d76){_0x302507['push'](_0x302507['shift']());}};_0x4f255f(++_0x40de06);}(_0xae6a,0x1e6));var _0xaae6=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xae6a[_0x618414];return _0x21c19a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaae6('0x0'));var jsonpatch=require(_0xaae6('0x1'));var rp=require(_0xaae6('0x2'));var moment=require(_0xaae6('0x3'));var BPromise=require(_0xaae6('0x4'));var Mustache=require(_0xaae6('0x5'));var util=require(_0xaae6('0x6'));var path=require(_0xaae6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaae6('0x8'));var fs=require('fs');var fs_extra=require(_0xaae6('0x9'));var _=require(_0xaae6('0xa'));var squel=require(_0xaae6('0xb'));var crypto=require(_0xaae6('0xc'));var jsforce=require(_0xaae6('0xd'));var deskjs=require(_0xaae6('0xe'));var toCsv=require(_0xaae6('0xf'));var querystring=require('querystring');var Papa=require(_0xaae6('0x10'));var Redis=require(_0xaae6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xaae6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaae6('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaae6('0x14'));var db=require('../../mysqldb')['db'];var extensions=require(_0xaae6('0x15'));function respondWithStatusCode(_0x30e8d2,_0x596419){_0x596419=_0x596419||0xcc;return function(_0x2970c0){if(_0x2970c0){return _0x30e8d2[_0xaae6('0x16')](_0x596419);}return _0x30e8d2['status'](_0x596419)[_0xaae6('0x17')]();};}function respondWithResult(_0x8be7e,_0x16ff96){_0x16ff96=_0x16ff96||0xc8;return function(_0x110686){if(_0x110686){return _0x8be7e[_0xaae6('0x18')](_0x16ff96)[_0xaae6('0x19')](_0x110686);}};}function respondWithFilteredResult(_0x530da1,_0x3d58c9){return function(_0x10ad21){if(_0x10ad21){var _0x278cc1=typeof _0x3d58c9['offset']===_0xaae6('0x1a')&&typeof _0x3d58c9['limit']===_0xaae6('0x1a');var _0x129167=_0x10ad21[_0xaae6('0x1b')];var _0x25af32=_0x278cc1?0x0:_0x3d58c9[_0xaae6('0x1c')];var _0xf69219=_0x278cc1?_0x10ad21[_0xaae6('0x1b')]:_0x3d58c9['offset']+_0x3d58c9[_0xaae6('0x1d')];var _0x446342;if(_0xf69219>=_0x129167){_0xf69219=_0x129167;_0x446342=0xc8;}else{_0x446342=0xce;}_0x530da1[_0xaae6('0x18')](_0x446342);return _0x530da1[_0xaae6('0x1e')](_0xaae6('0x1f'),_0x25af32+'-'+_0xf69219+'/'+_0x129167)[_0xaae6('0x19')](_0x10ad21);}return null;};}function patchUpdates(_0x2b9188){return function(_0x4b4c0f){try{jsonpatch[_0xaae6('0x20')](_0x4b4c0f,_0x2b9188,!![]);}catch(_0x2bbc5f){return BPromise['reject'](_0x2bbc5f);}return _0x4b4c0f['save']();};}function saveUpdates(_0x2dd4d0,_0x5c7a5c){return function(_0x48bf18){if(_0x48bf18){return _0x48bf18[_0xaae6('0x21')](_0x2dd4d0)[_0xaae6('0x22')](function(_0x552cb5){return _0x552cb5;});}return null;};}function removeEntity(_0x50f197,_0x5e67ca){return function(_0x20f3b3){if(_0x20f3b3){return _0x20f3b3[_0xaae6('0x23')]()[_0xaae6('0x22')](function(){var _0x52de23=_0x20f3b3[_0xaae6('0x24')]({'plain':!![]});var _0x45662e='Intervals';return db[_0xaae6('0x25')][_0xaae6('0x23')]({'where':{'type':_0x45662e,'resourceId':_0x52de23['id']}})[_0xaae6('0x22')](function(){return _0x20f3b3;});})[_0xaae6('0x22')](function(){_0x50f197[_0xaae6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xce0b7a,_0x359928){return function(_0x1aac61){if(!_0x1aac61){_0xce0b7a['sendStatus'](0x194);}return _0x1aac61;};}function handleError(_0x13f539,_0xaf1b7b){_0xaf1b7b=_0xaf1b7b||0x1f4;return function(_0x47c22b){logger['error'](_0x47c22b[_0xaae6('0x26')]);if(_0x47c22b['name']){delete _0x47c22b[_0xaae6('0x27')];}_0x13f539[_0xaae6('0x18')](_0xaf1b7b)[_0xaae6('0x28')](_0x47c22b);};}exports[_0xaae6('0x29')]=function(_0xc570a6,_0x2deeca){var _0xbea00b={},_0x268662={},_0x490e6b={'count':0x0,'rows':[]};var _0x21cf28=_[_0xaae6('0x2a')](db[_0xaae6('0x2b')][_0xaae6('0x2c')],function(_0xc1f7ed){return{'name':_0xc1f7ed['fieldName'],'type':_0xc1f7ed[_0xaae6('0x2d')][_0xaae6('0x2e')]};});_0x268662[_0xaae6('0x2f')]=_[_0xaae6('0x2a')](_0x21cf28,_0xaae6('0x27'));_0x268662[_0xaae6('0x30')]=_[_0xaae6('0x31')](_0xc570a6[_0xaae6('0x30')]);_0x268662[_0xaae6('0x32')]=_['intersection'](_0x268662[_0xaae6('0x2f')],_0x268662[_0xaae6('0x30')]);_0xbea00b['attributes']=_[_0xaae6('0x33')](_0x268662[_0xaae6('0x2f')],qs[_0xaae6('0x34')](_0xc570a6[_0xaae6('0x30')][_0xaae6('0x34')]));_0xbea00b[_0xaae6('0x35')]=_0xbea00b[_0xaae6('0x35')][_0xaae6('0x36')]?_0xbea00b[_0xaae6('0x35')]:_0x268662[_0xaae6('0x2f')];if(!_0xc570a6[_0xaae6('0x30')][_0xaae6('0x37')](_0xaae6('0x38'))){_0xbea00b['limit']=qs[_0xaae6('0x1d')](_0xc570a6['query'][_0xaae6('0x1d')]);_0xbea00b[_0xaae6('0x1c')]=qs[_0xaae6('0x1c')](_0xc570a6['query'][_0xaae6('0x1c')]);}_0xbea00b[_0xaae6('0x39')]=qs[_0xaae6('0x3a')](_0xc570a6[_0xaae6('0x30')]['sort']);_0xbea00b[_0xaae6('0x3b')]=qs['filters'](_[_0xaae6('0x3c')](_0xc570a6['query'],_0x268662[_0xaae6('0x32')]),_0x21cf28);if(_0xc570a6[_0xaae6('0x30')][_0xaae6('0x3d')]){_0xbea00b[_0xaae6('0x3b')]=_['merge'](_0xbea00b[_0xaae6('0x3b')],{'$or':_[_0xaae6('0x2a')](_0x21cf28,function(_0x3b7804){if(_0x3b7804[_0xaae6('0x2d')]!==_0xaae6('0x3e')){var _0x1a64a2={};_0x1a64a2[_0x3b7804[_0xaae6('0x27')]]={'$like':'%'+_0xc570a6['query'][_0xaae6('0x3d')]+'%'};return _0x1a64a2;}})});}_0xbea00b=_[_0xaae6('0x3f')]({},_0xbea00b,_0xc570a6[_0xaae6('0x40')]);var _0x527aa0={'where':_0xbea00b[_0xaae6('0x3b')]};return db[_0xaae6('0x2b')][_0xaae6('0x1b')](_0x527aa0)[_0xaae6('0x22')](function(_0x225026){_0x490e6b[_0xaae6('0x1b')]=_0x225026;if(_0xc570a6[_0xaae6('0x30')][_0xaae6('0x41')]){_0xbea00b[_0xaae6('0x42')]=[{'all':!![]}];}return db[_0xaae6('0x2b')][_0xaae6('0x43')](_0xbea00b);})[_0xaae6('0x22')](function(_0xbcc1a8){_0x490e6b['rows']=_0xbcc1a8;return _0x490e6b;})[_0xaae6('0x22')](respondWithFilteredResult(_0x2deeca,_0xbea00b))[_0xaae6('0x44')](handleError(_0x2deeca,null));};exports[_0xaae6('0x45')]=function(_0x1537f6,_0x3bea9c){var _0x50e2ec={'raw':!![],'where':{'id':_0x1537f6[_0xaae6('0x46')]['id']}},_0x2e6fc9={};_0x2e6fc9[_0xaae6('0x2f')]=_['keys'](db[_0xaae6('0x2b')][_0xaae6('0x2c')]);_0x2e6fc9[_0xaae6('0x30')]=_[_0xaae6('0x31')](_0x1537f6[_0xaae6('0x30')]);_0x2e6fc9[_0xaae6('0x32')]=_['intersection'](_0x2e6fc9[_0xaae6('0x2f')],_0x2e6fc9[_0xaae6('0x30')]);_0x50e2ec[_0xaae6('0x35')]=_[_0xaae6('0x33')](_0x2e6fc9[_0xaae6('0x2f')],qs[_0xaae6('0x34')](_0x1537f6[_0xaae6('0x30')][_0xaae6('0x34')]));_0x50e2ec[_0xaae6('0x35')]=_0x50e2ec[_0xaae6('0x35')]['length']?_0x50e2ec[_0xaae6('0x35')]:_0x2e6fc9['model'];if(_0x1537f6[_0xaae6('0x30')][_0xaae6('0x41')]){_0x50e2ec[_0xaae6('0x42')]=[{'all':!![]}];}_0x50e2ec=_[_0xaae6('0x3f')]({},_0x50e2ec,_0x1537f6[_0xaae6('0x40')]);return db[_0xaae6('0x2b')][_0xaae6('0x47')](_0x50e2ec)[_0xaae6('0x22')](handleEntityNotFound(_0x3bea9c,null))['then'](respondWithResult(_0x3bea9c,null))['catch'](handleError(_0x3bea9c,null));};exports['create']=function(_0x224b7e,_0x1471f7){return db[_0xaae6('0x2b')][_0xaae6('0x48')](_0x224b7e[_0xaae6('0x49')],{})[_0xaae6('0x22')](function(_0x549f23){var _0x35f5c6=_0x224b7e['user'][_0xaae6('0x24')]({'plain':!![]});if(!_0x35f5c6)throw new Error(_0xaae6('0x4a'));if(_0x35f5c6[_0xaae6('0x4b')]===_0xaae6('0x4c')){var _0x19e59a=_0x549f23['get']({'plain':!![]});var _0x562bae=_0xaae6('0x4d');return db[_0xaae6('0x4e')]['find']({'where':{'name':_0x562bae,'userProfileId':_0x35f5c6['userProfileId']},'raw':!![]})[_0xaae6('0x22')](function(_0x454ecc){if(_0x454ecc&&_0x454ecc[_0xaae6('0x4f')]===0x0){return db[_0xaae6('0x25')]['create']({'name':_0x19e59a[_0xaae6('0x27')],'resourceId':_0x19e59a['id'],'type':_0x454ecc[_0xaae6('0x27')],'sectionId':_0x454ecc['id']},{})[_0xaae6('0x22')](function(){return _0x549f23;});}else{return _0x549f23;}})['catch'](function(_0x263068){logger['error'](_0xaae6('0x50'),_0x263068);throw _0x263068;});}return _0x549f23;})['then'](respondWithResult(_0x1471f7,0xc9))[_0xaae6('0x44')](handleError(_0x1471f7,null));};exports[_0xaae6('0x21')]=function(_0x55f9a2,_0x33def7){if(_0x55f9a2[_0xaae6('0x49')]['id']){delete _0x55f9a2[_0xaae6('0x49')]['id'];}return db[_0xaae6('0x2b')]['find']({'where':{'id':_0x55f9a2[_0xaae6('0x46')]['id']}})[_0xaae6('0x22')](handleEntityNotFound(_0x33def7,null))['then'](saveUpdates(_0x55f9a2[_0xaae6('0x49')],null))[_0xaae6('0x22')](respondWithResult(_0x33def7,null))[_0xaae6('0x44')](handleError(_0x33def7,null));};exports[_0xaae6('0x23')]=function(_0x2bce64,_0x5c6353){return db['Interval'][_0xaae6('0x47')]({'where':{'id':_0x2bce64[_0xaae6('0x46')]['id']}})[_0xaae6('0x22')](handleEntityNotFound(_0x5c6353,null))['then'](removeEntity(_0x5c6353,null))[_0xaae6('0x44')](handleError(_0x5c6353,null));};exports[_0xaae6('0x51')]=function(_0x48fc3c,_0x13e158,_0xff5f87){if(_0x48fc3c['body']['id']){delete _0x48fc3c[_0xaae6('0x49')]['id'];}return db[_0xaae6('0x2b')][_0xaae6('0x47')]({'where':{'id':_0x48fc3c['params']['id']}})['then'](handleEntityNotFound(_0x13e158,null))['then'](function(_0x31f687){if(_0x31f687){_0x48fc3c[_0xaae6('0x49')]['IntervalId']=_0x31f687['id'];return db[_0xaae6('0x2b')][_0xaae6('0x48')](_0x48fc3c['body']);}})[_0xaae6('0x22')](respondWithResult(_0x13e158,null))['catch'](handleError(_0x13e158,null));};exports['getIntervals']=function(_0x2f38a0,_0x498bd1,_0x3d9b20){var _0x20db35={};var _0x12155e={};var _0x1f6ee1;var _0x484d80;return db[_0xaae6('0x2b')][_0xaae6('0x52')]({'where':{'id':_0x2f38a0[_0xaae6('0x46')]['id']}})[_0xaae6('0x22')](handleEntityNotFound(_0x498bd1,null))[_0xaae6('0x22')](function(_0x507c62){if(_0x507c62){_0x1f6ee1=_0x507c62;_0x12155e[_0xaae6('0x2f')]=_['keys'](db[_0xaae6('0x2b')][_0xaae6('0x2c')]);_0x12155e['query']=_[_0xaae6('0x31')](_0x2f38a0[_0xaae6('0x30')]);_0x12155e[_0xaae6('0x32')]=_[_0xaae6('0x33')](_0x12155e[_0xaae6('0x2f')],_0x12155e[_0xaae6('0x30')]);_0x20db35[_0xaae6('0x35')]=_[_0xaae6('0x33')](_0x12155e[_0xaae6('0x2f')],qs[_0xaae6('0x34')](_0x2f38a0[_0xaae6('0x30')][_0xaae6('0x34')]));_0x20db35[_0xaae6('0x35')]=_0x20db35['attributes'][_0xaae6('0x36')]?_0x20db35[_0xaae6('0x35')]:_0x12155e[_0xaae6('0x2f')];_0x20db35[_0xaae6('0x39')]=qs[_0xaae6('0x3a')](_0x2f38a0[_0xaae6('0x30')][_0xaae6('0x3a')]);_0x20db35[_0xaae6('0x3b')]=qs[_0xaae6('0x32')](_[_0xaae6('0x3c')](_0x2f38a0[_0xaae6('0x30')],_0x12155e['filters']));if(_0x2f38a0[_0xaae6('0x30')][_0xaae6('0x3d')]){_0x20db35[_0xaae6('0x3b')]=_[_0xaae6('0x3f')](_0x20db35[_0xaae6('0x3b')],{'$or':_[_0xaae6('0x2a')](_0x20db35[_0xaae6('0x35')],function(_0x5605e9){var _0x495e5a={};_0x495e5a[_0x5605e9]={'$like':'%'+_0x2f38a0[_0xaae6('0x30')][_0xaae6('0x3d')]+'%'};return _0x495e5a;})});}_0x20db35=_[_0xaae6('0x3f')]({},_0x20db35,_0x2f38a0[_0xaae6('0x40')]);return _0x1f6ee1[_0xaae6('0x53')](_0x20db35);}})[_0xaae6('0x22')](function(_0x3cdc38){if(_0x3cdc38){_0x484d80=_0x3cdc38[_0xaae6('0x36')];if(!_0x2f38a0['query'][_0xaae6('0x37')](_0xaae6('0x38'))){_0x20db35['limit']=qs[_0xaae6('0x1d')](_0x2f38a0[_0xaae6('0x30')][_0xaae6('0x1d')]);_0x20db35[_0xaae6('0x1c')]=qs[_0xaae6('0x1c')](_0x2f38a0[_0xaae6('0x30')][_0xaae6('0x1c')]);}return _0x1f6ee1[_0xaae6('0x53')](_0x20db35);}})[_0xaae6('0x22')](function(_0x22f082){if(_0x22f082){return _0x22f082?{'count':_0x484d80,'rows':_0x22f082}:null;}})[_0xaae6('0x22')](respondWithResult(_0x498bd1,null))[_0xaae6('0x44')](handleError(_0x498bd1,null));};exports['addIntervals']=function(_0x5b9c17,_0x2966c4,_0x3cd04a){return db[_0xaae6('0x2b')][_0xaae6('0x52')]({'where':{'id':_0x5b9c17[_0xaae6('0x46')]['id']}})[_0xaae6('0x22')](handleEntityNotFound(_0x2966c4,null))[_0xaae6('0x22')](function(_0x24e54f){if(_0x24e54f){return db[_0xaae6('0x54')][_0xaae6('0x55')](function(_0x1985d1){return db['Interval']['destroy']({'where':{'IntervalId':_0x5b9c17['params']['id']},'transaction':_0x1985d1})['then'](function(_0x2aef14){var _0x21958f=_[_0xaae6('0x2a')](_0x5b9c17['body'],function(_0x2a34a1){delete _0x2a34a1['id'];_0x2a34a1[_0xaae6('0x56')]=_0x5b9c17[_0xaae6('0x46')]['id'];return _0x2a34a1;});return db[_0xaae6('0x2b')]['bulkCreate'](_0x21958f,{'transaction':_0x1985d1});});})[_0xaae6('0x22')](function(){return db['Interval'][_0xaae6('0x43')]({'where':{'IntervalId':_0x5b9c17[_0xaae6('0x46')]['id']}});});}})[_0xaae6('0x22')](respondWithResult(_0x2966c4,null))[_0xaae6('0x44')](handleError(_0x2966c4,null));}; \ No newline at end of file +var _0x0ff6=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','Intervals','error','name','send','index','map','Interval','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','get','role','user','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addInterval','IntervalId','findOne','length','getIntervals','hasOwnProperty','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring'];(function(_0x1d0e1e,_0x415540){var _0x1831ee=function(_0x507798){while(--_0x507798){_0x1d0e1e['push'](_0x1d0e1e['shift']());}};_0x1831ee(++_0x415540);}(_0x0ff6,0x1b2));var _0x60ff=function(_0x16998e,_0x2fa920){_0x16998e=_0x16998e-0x0;var _0x1fdf13=_0x0ff6[_0x16998e];return _0x1fdf13;};'use strict';var emlformat=require(_0x60ff('0x0'));var rimraf=require(_0x60ff('0x1'));var zipdir=require(_0x60ff('0x2'));var jsonpatch=require(_0x60ff('0x3'));var rp=require(_0x60ff('0x4'));var moment=require(_0x60ff('0x5'));var BPromise=require(_0x60ff('0x6'));var Mustache=require(_0x60ff('0x7'));var util=require(_0x60ff('0x8'));var path=require(_0x60ff('0x9'));var sox=require('sox');var csv=require(_0x60ff('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x60ff('0xb'));var squel=require(_0x60ff('0xc'));var crypto=require(_0x60ff('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x60ff('0xe'));var toCsv=require(_0x60ff('0xa'));var querystring=require(_0x60ff('0xf'));var Papa=require(_0x60ff('0x10'));var Redis=require('ioredis');var authService=require(_0x60ff('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x60ff('0x12'));var hardwareService=require(_0x60ff('0x13'));var logger=require(_0x60ff('0x14'))(_0x60ff('0x15'));var utils=require(_0x60ff('0x16'));var config=require(_0x60ff('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var extensions=require(_0x60ff('0x18'));function respondWithStatusCode(_0x4d3dd3,_0xe709e4){_0xe709e4=_0xe709e4||0xcc;return function(_0x5ae447){if(_0x5ae447){return _0x4d3dd3[_0x60ff('0x19')](_0xe709e4);}return _0x4d3dd3[_0x60ff('0x1a')](_0xe709e4)[_0x60ff('0x1b')]();};}function respondWithResult(_0x53b02b,_0x35ccfd){_0x35ccfd=_0x35ccfd||0xc8;return function(_0x252cc0){if(_0x252cc0){return _0x53b02b['status'](_0x35ccfd)[_0x60ff('0x1c')](_0x252cc0);}};}function respondWithFilteredResult(_0x282ce6,_0x5d998f){return function(_0x4a38e8){if(_0x4a38e8){var _0x42e573=typeof _0x5d998f[_0x60ff('0x1d')]===_0x60ff('0x1e')&&typeof _0x5d998f[_0x60ff('0x1f')]===_0x60ff('0x1e');var _0x4c1868=_0x4a38e8[_0x60ff('0x20')];var _0xe7641=_0x42e573?0x0:_0x5d998f[_0x60ff('0x1d')];var _0x589cff=_0x42e573?_0x4a38e8[_0x60ff('0x20')]:_0x5d998f['offset']+_0x5d998f[_0x60ff('0x1f')];var _0x4213ed;if(_0x589cff>=_0x4c1868){_0x589cff=_0x4c1868;_0x4213ed=0xc8;}else{_0x4213ed=0xce;}_0x282ce6['status'](_0x4213ed);return _0x282ce6[_0x60ff('0x21')](_0x60ff('0x22'),_0xe7641+'-'+_0x589cff+'/'+_0x4c1868)[_0x60ff('0x1c')](_0x4a38e8);}return null;};}function patchUpdates(_0xc6a1c4){return function(_0x1e2455){try{jsonpatch['apply'](_0x1e2455,_0xc6a1c4,!![]);}catch(_0x545679){return BPromise['reject'](_0x545679);}return _0x1e2455[_0x60ff('0x23')]();};}function saveUpdates(_0x1eadae,_0x1e6e6d){return function(_0x4bd65c){if(_0x4bd65c){return _0x4bd65c['update'](_0x1eadae)[_0x60ff('0x24')](function(_0x5d0396){return _0x5d0396;});}return null;};}function removeEntity(_0x78cdb4,_0x159576){return function(_0x56f0c0){if(_0x56f0c0){return _0x56f0c0[_0x60ff('0x25')]()['then'](function(){var _0x446ad8=_0x56f0c0['get']({'plain':!![]});var _0x300895=_0x60ff('0x26');return db['UserProfileResource'][_0x60ff('0x25')]({'where':{'type':_0x300895,'resourceId':_0x446ad8['id']}})[_0x60ff('0x24')](function(){return _0x56f0c0;});})['then'](function(){_0x78cdb4[_0x60ff('0x1a')](0xcc)[_0x60ff('0x1b')]();});}};}function handleEntityNotFound(_0x40d458,_0x261c5f){return function(_0x25c13f){if(!_0x25c13f){_0x40d458[_0x60ff('0x19')](0x194);}return _0x25c13f;};}function handleError(_0x2a708d,_0x5380d4){_0x5380d4=_0x5380d4||0x1f4;return function(_0x33d2dc){logger[_0x60ff('0x27')](_0x33d2dc['stack']);if(_0x33d2dc[_0x60ff('0x28')]){delete _0x33d2dc[_0x60ff('0x28')];}_0x2a708d[_0x60ff('0x1a')](_0x5380d4)[_0x60ff('0x29')](_0x33d2dc);};}exports[_0x60ff('0x2a')]=function(_0x10bc25,_0x3d410d){var _0xa71536={},_0xe72e4c={},_0x4eb74c={'count':0x0,'rows':[]};var _0x399cbb=_[_0x60ff('0x2b')](db[_0x60ff('0x2c')][_0x60ff('0x2d')],function(_0x5078d7){return{'name':_0x5078d7[_0x60ff('0x2e')],'type':_0x5078d7[_0x60ff('0x2f')]['key']};});_0xe72e4c[_0x60ff('0x30')]=_[_0x60ff('0x2b')](_0x399cbb,_0x60ff('0x28'));_0xe72e4c[_0x60ff('0x31')]=_[_0x60ff('0x32')](_0x10bc25[_0x60ff('0x31')]);_0xe72e4c[_0x60ff('0x33')]=_['intersection'](_0xe72e4c[_0x60ff('0x30')],_0xe72e4c[_0x60ff('0x31')]);_0xa71536[_0x60ff('0x34')]=_['intersection'](_0xe72e4c['model'],qs[_0x60ff('0x35')](_0x10bc25['query'][_0x60ff('0x35')]));_0xa71536[_0x60ff('0x34')]=_0xa71536[_0x60ff('0x34')]['length']?_0xa71536[_0x60ff('0x34')]:_0xe72e4c['model'];if(!_0x10bc25[_0x60ff('0x31')]['hasOwnProperty'](_0x60ff('0x36'))){_0xa71536[_0x60ff('0x1f')]=qs[_0x60ff('0x1f')](_0x10bc25['query']['limit']);_0xa71536[_0x60ff('0x1d')]=qs[_0x60ff('0x1d')](_0x10bc25[_0x60ff('0x31')][_0x60ff('0x1d')]);}_0xa71536[_0x60ff('0x37')]=qs[_0x60ff('0x38')](_0x10bc25['query'][_0x60ff('0x38')]);_0xa71536['where']=qs[_0x60ff('0x33')](_[_0x60ff('0x39')](_0x10bc25['query'],_0xe72e4c[_0x60ff('0x33')]),_0x399cbb);if(_0x10bc25['query'][_0x60ff('0x3a')]){_0xa71536[_0x60ff('0x3b')]=_[_0x60ff('0x3c')](_0xa71536['where'],{'$or':_[_0x60ff('0x2b')](_0x399cbb,function(_0x53c7dd){if(_0x53c7dd[_0x60ff('0x2f')]!==_0x60ff('0x3d')){var _0x65439c={};_0x65439c[_0x53c7dd[_0x60ff('0x28')]]={'$like':'%'+_0x10bc25['query'][_0x60ff('0x3a')]+'%'};return _0x65439c;}})});}_0xa71536=_[_0x60ff('0x3c')]({},_0xa71536,_0x10bc25[_0x60ff('0x3e')]);var _0x1a1f25={'where':_0xa71536['where']};return db[_0x60ff('0x2c')][_0x60ff('0x20')](_0x1a1f25)['then'](function(_0x386deb){_0x4eb74c[_0x60ff('0x20')]=_0x386deb;if(_0x10bc25[_0x60ff('0x31')][_0x60ff('0x3f')]){_0xa71536[_0x60ff('0x40')]=[{'all':!![]}];}return db['Interval'][_0x60ff('0x41')](_0xa71536);})[_0x60ff('0x24')](function(_0x6ef876){_0x4eb74c[_0x60ff('0x42')]=_0x6ef876;return _0x4eb74c;})['then'](respondWithFilteredResult(_0x3d410d,_0xa71536))[_0x60ff('0x43')](handleError(_0x3d410d,null));};exports[_0x60ff('0x44')]=function(_0x33386e,_0x47589a){var _0xcb9371={'raw':!![],'where':{'id':_0x33386e[_0x60ff('0x45')]['id']}},_0x1c6df7={};_0x1c6df7[_0x60ff('0x30')]=_['keys'](db[_0x60ff('0x2c')][_0x60ff('0x2d')]);_0x1c6df7[_0x60ff('0x31')]=_[_0x60ff('0x32')](_0x33386e[_0x60ff('0x31')]);_0x1c6df7['filters']=_[_0x60ff('0x46')](_0x1c6df7[_0x60ff('0x30')],_0x1c6df7['query']);_0xcb9371[_0x60ff('0x34')]=_['intersection'](_0x1c6df7['model'],qs[_0x60ff('0x35')](_0x33386e[_0x60ff('0x31')][_0x60ff('0x35')]));_0xcb9371[_0x60ff('0x34')]=_0xcb9371['attributes']['length']?_0xcb9371['attributes']:_0x1c6df7[_0x60ff('0x30')];if(_0x33386e[_0x60ff('0x31')][_0x60ff('0x3f')]){_0xcb9371[_0x60ff('0x40')]=[{'all':!![]}];}_0xcb9371=_[_0x60ff('0x3c')]({},_0xcb9371,_0x33386e[_0x60ff('0x3e')]);return db[_0x60ff('0x2c')][_0x60ff('0x47')](_0xcb9371)['then'](handleEntityNotFound(_0x47589a,null))[_0x60ff('0x24')](respondWithResult(_0x47589a,null))[_0x60ff('0x43')](handleError(_0x47589a,null));};exports['create']=function(_0x5147d9,_0x57f6f0){return db['Interval'][_0x60ff('0x48')](_0x5147d9['body'],{})['then'](function(_0x2448be){var _0x4ffa31=_0x5147d9['user'][_0x60ff('0x49')]({'plain':!![]});if(!_0x4ffa31)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ffa31[_0x60ff('0x4a')]===_0x60ff('0x4b')){var _0x4ba96b=_0x2448be['get']({'plain':!![]});var _0x446270='Intervals';return db['UserProfileSection']['find']({'where':{'name':_0x446270,'userProfileId':_0x4ffa31['userProfileId']},'raw':!![]})[_0x60ff('0x24')](function(_0x486979){if(_0x486979&&_0x486979[_0x60ff('0x4c')]===0x0){return db[_0x60ff('0x4d')][_0x60ff('0x48')]({'name':_0x4ba96b[_0x60ff('0x28')],'resourceId':_0x4ba96b['id'],'type':_0x486979[_0x60ff('0x28')],'sectionId':_0x486979['id']},{})[_0x60ff('0x24')](function(){return _0x2448be;});}else{return _0x2448be;}})[_0x60ff('0x43')](function(_0x4c2811){logger['error'](_0x60ff('0x4e'),_0x4c2811);throw _0x4c2811;});}return _0x2448be;})[_0x60ff('0x24')](respondWithResult(_0x57f6f0,0xc9))[_0x60ff('0x43')](handleError(_0x57f6f0,null));};exports[_0x60ff('0x4f')]=function(_0x28bf65,_0x353d41){if(_0x28bf65[_0x60ff('0x50')]['id']){delete _0x28bf65[_0x60ff('0x50')]['id'];}return db[_0x60ff('0x2c')][_0x60ff('0x47')]({'where':{'id':_0x28bf65[_0x60ff('0x45')]['id']}})[_0x60ff('0x24')](handleEntityNotFound(_0x353d41,null))[_0x60ff('0x24')](saveUpdates(_0x28bf65[_0x60ff('0x50')],null))[_0x60ff('0x24')](respondWithResult(_0x353d41,null))[_0x60ff('0x43')](handleError(_0x353d41,null));};exports[_0x60ff('0x25')]=function(_0x91c11e,_0x343df3){return db[_0x60ff('0x2c')][_0x60ff('0x47')]({'where':{'id':_0x91c11e[_0x60ff('0x45')]['id']}})[_0x60ff('0x24')](handleEntityNotFound(_0x343df3,null))[_0x60ff('0x24')](removeEntity(_0x343df3,null))[_0x60ff('0x43')](handleError(_0x343df3,null));};exports[_0x60ff('0x51')]=function(_0x31eb7a,_0x5d0a4a,_0x203df5){if(_0x31eb7a[_0x60ff('0x50')]['id']){delete _0x31eb7a[_0x60ff('0x50')]['id'];}return db[_0x60ff('0x2c')][_0x60ff('0x47')]({'where':{'id':_0x31eb7a[_0x60ff('0x45')]['id']}})[_0x60ff('0x24')](handleEntityNotFound(_0x5d0a4a,null))[_0x60ff('0x24')](function(_0x84111){if(_0x84111){_0x31eb7a['body'][_0x60ff('0x52')]=_0x84111['id'];return db[_0x60ff('0x2c')][_0x60ff('0x48')](_0x31eb7a[_0x60ff('0x50')]);}})['then'](respondWithResult(_0x5d0a4a,null))['catch'](handleError(_0x5d0a4a,null));};exports['getIntervals']=function(_0x100417,_0x595616,_0x90e009){var _0x471145={};var _0x5cc823={};var _0x4eed00;var _0x2f4229;return db['Interval'][_0x60ff('0x53')]({'where':{'id':_0x100417[_0x60ff('0x45')]['id']}})[_0x60ff('0x24')](handleEntityNotFound(_0x595616,null))[_0x60ff('0x24')](function(_0x588436){if(_0x588436){_0x4eed00=_0x588436;_0x5cc823['model']=_[_0x60ff('0x32')](db['Interval']['rawAttributes']);_0x5cc823[_0x60ff('0x31')]=_['keys'](_0x100417[_0x60ff('0x31')]);_0x5cc823['filters']=_[_0x60ff('0x46')](_0x5cc823[_0x60ff('0x30')],_0x5cc823[_0x60ff('0x31')]);_0x471145[_0x60ff('0x34')]=_[_0x60ff('0x46')](_0x5cc823['model'],qs[_0x60ff('0x35')](_0x100417[_0x60ff('0x31')][_0x60ff('0x35')]));_0x471145['attributes']=_0x471145[_0x60ff('0x34')][_0x60ff('0x54')]?_0x471145[_0x60ff('0x34')]:_0x5cc823[_0x60ff('0x30')];_0x471145[_0x60ff('0x37')]=qs[_0x60ff('0x38')](_0x100417['query'][_0x60ff('0x38')]);_0x471145[_0x60ff('0x3b')]=qs[_0x60ff('0x33')](_[_0x60ff('0x39')](_0x100417[_0x60ff('0x31')],_0x5cc823['filters']));if(_0x100417[_0x60ff('0x31')][_0x60ff('0x3a')]){_0x471145[_0x60ff('0x3b')]=_[_0x60ff('0x3c')](_0x471145['where'],{'$or':_[_0x60ff('0x2b')](_0x471145['attributes'],function(_0x1616e2){var _0x542c6c={};_0x542c6c[_0x1616e2]={'$like':'%'+_0x100417[_0x60ff('0x31')][_0x60ff('0x3a')]+'%'};return _0x542c6c;})});}_0x471145=_[_0x60ff('0x3c')]({},_0x471145,_0x100417[_0x60ff('0x3e')]);return _0x4eed00[_0x60ff('0x55')](_0x471145);}})[_0x60ff('0x24')](function(_0x20f846){if(_0x20f846){_0x2f4229=_0x20f846[_0x60ff('0x54')];if(!_0x100417[_0x60ff('0x31')][_0x60ff('0x56')](_0x60ff('0x36'))){_0x471145[_0x60ff('0x1f')]=qs[_0x60ff('0x1f')](_0x100417[_0x60ff('0x31')][_0x60ff('0x1f')]);_0x471145[_0x60ff('0x1d')]=qs['offset'](_0x100417[_0x60ff('0x31')][_0x60ff('0x1d')]);}return _0x4eed00[_0x60ff('0x55')](_0x471145);}})[_0x60ff('0x24')](function(_0x473b4f){if(_0x473b4f){return _0x473b4f?{'count':_0x2f4229,'rows':_0x473b4f}:null;}})[_0x60ff('0x24')](respondWithResult(_0x595616,null))[_0x60ff('0x43')](handleError(_0x595616,null));};exports['addIntervals']=function(_0x59b5ba,_0x5cce3a,_0x3e6739){return db[_0x60ff('0x2c')][_0x60ff('0x53')]({'where':{'id':_0x59b5ba['params']['id']}})[_0x60ff('0x24')](handleEntityNotFound(_0x5cce3a,null))[_0x60ff('0x24')](function(_0x5e4bb7){if(_0x5e4bb7){return db[_0x60ff('0x57')][_0x60ff('0x58')](function(_0x369091){return db[_0x60ff('0x2c')][_0x60ff('0x25')]({'where':{'IntervalId':_0x59b5ba[_0x60ff('0x45')]['id']},'transaction':_0x369091})[_0x60ff('0x24')](function(_0x1f28f3){var _0x3704c9=_[_0x60ff('0x2b')](_0x59b5ba[_0x60ff('0x50')],function(_0x4d99d5){delete _0x4d99d5['id'];_0x4d99d5['IntervalId']=_0x59b5ba['params']['id'];return _0x4d99d5;});return db[_0x60ff('0x2c')][_0x60ff('0x59')](_0x3704c9,{'transaction':_0x369091});});})['then'](function(){return db[_0x60ff('0x2c')][_0x60ff('0x41')]({'where':{'IntervalId':_0x59b5ba[_0x60ff('0x45')]['id']}});});}})[_0x60ff('0x24')](respondWithResult(_0x5cce3a,null))['catch'](handleError(_0x5cce3a,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 403fc64..de016e3 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 _0xfe4a=['exports','Interval','rewrite','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','../../components/extensions/rewrite'];(function(_0x1eb1b8,_0xfb6868){var _0x61a862=function(_0x13ae47){while(--_0x13ae47){_0x1eb1b8['push'](_0x1eb1b8['shift']());}};_0x61a862(++_0xfb6868);}(_0xfe4a,0x142));var _0xafe4=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xfe4a[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0xafe4('0x0'));var logger=require(_0xafe4('0x1'))(_0xafe4('0x2'));var moment=require(_0xafe4('0x3'));var BPromise=require(_0xafe4('0x4'));var rp=require(_0xafe4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xafe4('0x6'));var attributes=require('./interval.attributes');var extensions=require(_0xafe4('0x7'));module[_0xafe4('0x8')]=function(_0x2294fa,_0x45c3c2){return _0x2294fa['define'](_0xafe4('0x9'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x19ceb1,_0x320283){extensions[_0xafe4('0xa')](_0x2294fa,_0x19ceb1);},'afterBulkCreate':function(_0x21e07c,_0x4f4ed0,_0x598569){_0x598569();extensions[_0xafe4('0xa')](_0x2294fa,_0x21e07c[0x0]);},'afterUpdate':function(_0x123e90,_0x3ece0a){extensions[_0xafe4('0xa')](_0x2294fa,_0x123e90);},'afterDestroy':function(_0x44fe2a,_0x5053af){extensions[_0xafe4('0xa')](_0x2294fa,_0x44fe2a);}}});}; \ No newline at end of file +var _0xec90=['request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','Interval','tools_intervals','rewrite','lodash','util','../../config/logger','api'];(function(_0x5a0db1,_0x103467){var _0x4f53c1=function(_0x4a9a60){while(--_0x4a9a60){_0x5a0db1['push'](_0x5a0db1['shift']());}};_0x4f53c1(++_0x103467);}(_0xec90,0x1ca));var _0x0ec9=function(_0x277b55,_0x8ba28){_0x277b55=_0x277b55-0x0;var _0xff0d15=_0xec90[_0x277b55];return _0xff0d15;};'use strict';var _=require(_0x0ec9('0x0'));var util=require(_0x0ec9('0x1'));var logger=require(_0x0ec9('0x2'))(_0x0ec9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0ec9('0x4'));var fs=require('fs');var path=require(_0x0ec9('0x5'));var rimraf=require(_0x0ec9('0x6'));var config=require(_0x0ec9('0x7'));var attributes=require(_0x0ec9('0x8'));var extensions=require(_0x0ec9('0x9'));module[_0x0ec9('0xa')]=function(_0x15a748,_0x28c8ef){return _0x15a748['define'](_0x0ec9('0xb'),attributes,{'tableName':_0x0ec9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x522e47,_0x48a8aa){extensions[_0x0ec9('0xd')](_0x15a748,_0x522e47);},'afterBulkCreate':function(_0x376516,_0x17ffae,_0xa7ea8d){_0xa7ea8d();extensions['rewrite'](_0x15a748,_0x376516[0x0]);},'afterUpdate':function(_0x432e18,_0x828fba){extensions['rewrite'](_0x15a748,_0x432e18);},'afterDestroy':function(_0x3757f9,_0x13cec6){extensions[_0x0ec9('0xd')](_0x15a748,_0x3757f9);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 4c32c5f..7213ff0 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(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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 be3f04f..2da2b53 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 _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x0b0e,0x187));var _0xe0b0=function(_0x57474e,_0x4178b8){_0x57474e=_0x57474e-0x0;var _0xfaae8c=_0x0b0e[_0x57474e];return _0xfaae8c;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x558b69,_0x2c0274){var _0x295141=function(_0x330971){while(--_0x330971){_0x558b69['push'](_0x558b69['shift']());}};_0x295141(++_0x2c0274);}(_0x5f2f,0x73));var _0xf5f2=function(_0x37a2f1,_0x2fe953){_0x37a2f1=_0x37a2f1-0x0;var _0x47f3c9=_0x5f2f[_0x37a2f1];return _0x47f3c9;};'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 5ed4bca..8c78506 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 _0x3233=['openIssue','send','body','headers','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','stringify','setEncoding','data','end','status','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x3233,0x14a));var _0x3323=function(_0x394dea,_0x5e8720){_0x394dea=_0x394dea-0x0;var _0x2d659d=_0x3233[_0x394dea];return _0x2d659d;};'use strict';var BPromise=require(_0x3323('0x0'));var https=require(_0x3323('0x1'));var logger=require(_0x3323('0x2'))(_0x3323('0x3'));var USERNAME='support';var PASSWORD=_0x3323('0x4');function openIssue(_0x41ed4f,_0x615bc1){var _0x32d74f={'fields':{'project':{'key':_0x41ed4f[_0x3323('0x5')]||_0x3323('0x6')},'summary':(_0x41ed4f[_0x3323('0x7')]||_0x3323('0x8'))+_0x3323('0x9')+_0x41ed4f['ip'],'description':_0x41ed4f[_0x3323('0xa')]||JSON['stringify'](_0x41ed4f),'issuetype':{'name':_0x41ed4f['issuetype']||_0x3323('0xb')}}};_0x32d74f[_0x3323('0xc')][_0x3323('0xd')]=_0x41ed4f[_0x3323('0xe')];_0x32d74f[_0x3323('0xc')][_0x3323('0xf')]=_0x41ed4f[_0x3323('0x10')];_0x32d74f['fields'][_0x3323('0x11')]=_0x41ed4f[_0x3323('0x12')];_0x32d74f[_0x3323('0xc')][_0x3323('0x13')]=_0x41ed4f[_0x3323('0x14')];_0x32d74f['fields']['customfield_11504']=_0x41ed4f[_0x3323('0x15')];_0x32d74f[_0x3323('0xc')][_0x3323('0x16')]=_0x41ed4f['ip'];var _0x43a420={'host':_0x3323('0x17'),'port':0x1bb,'path':_0x3323('0x18'),'method':_0x3323('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x3323('0x1a'),'Authorization':_0x3323('0x1b')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x5353ea=JSON[_0x3323('0x1c')](_0x32d74f);var _0x1cce2d=https['request'](_0x43a420,function(_0x3c4920){_0x3c4920[_0x3323('0x1d')]('utf8');var _0xbb82b='';_0x3c4920['on'](_0x3323('0x1e'),function(_0x5223bf){_0xbb82b+=_0x5223bf;});_0x3c4920['on'](_0x3323('0x1f'),function(){if(_0x615bc1){return _0x615bc1[_0x3323('0x20')](_0x3c4920['statusCode'])['json'](JSON[_0x3323('0x21')](_0xbb82b));}});});_0x1cce2d['on'](_0x3323('0x22'),function(_0x49a250){if(_0x615bc1){return _0x615bc1[_0x3323('0x20')](0x1f4)[_0x3323('0x23')]({'errors':[{'message':_0x3323('0x24'),'type':_0x3323('0x25')}]});}});_0x1cce2d['write'](_0x5353ea);_0x1cce2d['end']();}exports[_0x3323('0x26')]=openIssue;exports[_0x3323('0x27')]=function(_0x1277a6,_0x19cbbb){_0x1277a6[_0x3323('0x28')]['ip']=_0x1277a6[_0x3323('0x29')][_0x3323('0x2a')]||_0x1277a6['connection'][_0x3323('0x2b')]||_0x1277a6[_0x3323('0x2c')]['remoteAddress']||_0x1277a6[_0x3323('0x2d')][_0x3323('0x2c')][_0x3323('0x2b')];return openIssue(_0x1277a6[_0x3323('0x28')],_0x19cbbb);}; \ No newline at end of file +var _0xfb54=['status','statusCode','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','toString','base64','request','setEncoding','utf8','data','end'];(function(_0x542c45,_0x41fa0e){var _0x1ff30d=function(_0x501157){while(--_0x501157){_0x542c45['push'](_0x542c45['shift']());}};_0x1ff30d(++_0x41fa0e);}(_0xfb54,0x18e));var _0x4fb5=function(_0x306871,_0x4cd3bf){_0x306871=_0x306871-0x0;var _0xaf73c0=_0xfb54[_0x306871];return _0xaf73c0;};'use strict';var BPromise=require(_0x4fb5('0x0'));var https=require(_0x4fb5('0x1'));var logger=require(_0x4fb5('0x2'))(_0x4fb5('0x3'));var USERNAME=_0x4fb5('0x4');var PASSWORD=_0x4fb5('0x5');function openIssue(_0x56da5e,_0x29dd1a){var _0x1292c9={'fields':{'project':{'key':_0x56da5e[_0x4fb5('0x6')]||_0x4fb5('0x7')},'summary':(_0x56da5e[_0x4fb5('0x8')]||'Report')+'\x20from\x20'+_0x56da5e['ip'],'description':_0x56da5e[_0x4fb5('0x9')]||JSON[_0x4fb5('0xa')](_0x56da5e),'issuetype':{'name':_0x56da5e[_0x4fb5('0xb')]||_0x4fb5('0xc')}}};_0x1292c9[_0x4fb5('0xd')][_0x4fb5('0xe')]=_0x56da5e[_0x4fb5('0xf')];_0x1292c9[_0x4fb5('0xd')][_0x4fb5('0x10')]=_0x56da5e[_0x4fb5('0x11')];_0x1292c9[_0x4fb5('0xd')][_0x4fb5('0x12')]=_0x56da5e[_0x4fb5('0x13')];_0x1292c9[_0x4fb5('0xd')]['customfield_11503']=_0x56da5e[_0x4fb5('0x14')];_0x1292c9[_0x4fb5('0xd')][_0x4fb5('0x15')]=_0x56da5e[_0x4fb5('0x16')];_0x1292c9[_0x4fb5('0xd')][_0x4fb5('0x17')]=_0x56da5e['ip'];var _0x59fe06={'host':_0x4fb5('0x18'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x4fb5('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x4fb5('0x1a'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x4fb5('0x1b')](_0x4fb5('0x1c'))}};var _0x550f29=JSON[_0x4fb5('0xa')](_0x1292c9);var _0x3ceb7c=https[_0x4fb5('0x1d')](_0x59fe06,function(_0x585902){_0x585902[_0x4fb5('0x1e')](_0x4fb5('0x1f'));var _0x43c1a0='';_0x585902['on'](_0x4fb5('0x20'),function(_0x13acbd){_0x43c1a0+=_0x13acbd;});_0x585902['on'](_0x4fb5('0x21'),function(){if(_0x29dd1a){return _0x29dd1a[_0x4fb5('0x22')](_0x585902[_0x4fb5('0x23')])[_0x4fb5('0x24')](JSON['parse'](_0x43c1a0));}});});_0x3ceb7c['on']('error',function(_0x3fc394){if(_0x29dd1a){return _0x29dd1a[_0x4fb5('0x22')](0x1f4)['json']({'errors':[{'message':_0x4fb5('0x25'),'type':_0x4fb5('0x26')}]});}});_0x3ceb7c[_0x4fb5('0x27')](_0x550f29);_0x3ceb7c[_0x4fb5('0x21')]();}exports[_0x4fb5('0x28')]=openIssue;exports[_0x4fb5('0x29')]=function(_0x127d91,_0x4db624){_0x127d91[_0x4fb5('0x2a')]['ip']=_0x127d91[_0x4fb5('0x2b')][_0x4fb5('0x2c')]||_0x127d91[_0x4fb5('0x2d')][_0x4fb5('0x2e')]||_0x127d91[_0x4fb5('0x2f')][_0x4fb5('0x2e')]||_0x127d91[_0x4fb5('0x2d')][_0x4fb5('0x2f')]['remoteAddress'];return openIssue(_0x127d91[_0x4fb5('0x2a')],_0x4db624);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 8dcc464..9e15017 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 _0xfd28=['show','put','delete','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0xfd28,0x148));var _0x8fd2=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0xfd28[_0x32b542];return _0x554d54;};'use strict';var multer=require('multer');var util=require(_0x8fd2('0x0'));var path=require(_0x8fd2('0x1'));var timeout=require('connect-timeout');var express=require(_0x8fd2('0x2'));var router=express['Router']();var fs_extra=require(_0x8fd2('0x3'));var auth=require(_0x8fd2('0x4'));var interaction=require(_0x8fd2('0x5'));var config=require('../../config/environment');var controller=require(_0x8fd2('0x6'));router[_0x8fd2('0x7')]('/',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0x9')]);router[_0x8fd2('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x8fd2('0xa')]);router[_0x8fd2('0x7')](_0x8fd2('0xb'),auth['isAuthenticated'](),controller[_0x8fd2('0xc')]);router['post']('/',auth[_0x8fd2('0x8')](),controller['create']);router[_0x8fd2('0xd')]('/:id',auth[_0x8fd2('0x8')](),controller['update']);router[_0x8fd2('0xe')]('/:id',auth[_0x8fd2('0x8')](),controller[_0x8fd2('0xf')]);module[_0x8fd2('0x10')]=router; \ No newline at end of file +var _0x9c44=['update','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./jscriptyAnswerReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put'];(function(_0x1c7597,_0x323a35){var _0x4f9187=function(_0x40fc12){while(--_0x40fc12){_0x1c7597['push'](_0x1c7597['shift']());}};_0x4f9187(++_0x323a35);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x49c4('0xd')]);router[_0x49c4('0xe')]('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0xf')]);router['delete']('/:id',auth[_0x49c4('0x7')](),controller[_0x49c4('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index fed5ffd..0069528 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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x57c949,_0x1bebe6){_0x57c949=_0x57c949-0x0;var _0x5e5489=_0x7a54[_0x57c949];return _0x5e5489;};'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(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x7a54,0x106));var _0x47a5=function(_0x5f4b6b,_0x38a420){_0x5f4b6b=_0x5f4b6b-0x0;var _0x1bae51=_0x7a54[_0x5f4b6b];return _0x1bae51;};'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 7132a46..aa28b2c 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 _0x6657=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0x6657,0x17f));var _0x7665=function(_0x487d6e,_0x590ce7){_0x487d6e=_0x487d6e-0x0;var _0x3d0a2e=_0x6657[_0x487d6e];return _0x3d0a2e;};'use strict';var emlformat=require(_0x7665('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7665('0x1'));var jsonpatch=require(_0x7665('0x2'));var rp=require(_0x7665('0x3'));var moment=require(_0x7665('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7665('0x5'));var util=require(_0x7665('0x6'));var path=require(_0x7665('0x7'));var sox=require(_0x7665('0x8'));var csv=require(_0x7665('0x9'));var ejs=require(_0x7665('0xa'));var fs=require('fs');var fs_extra=require(_0x7665('0xb'));var _=require(_0x7665('0xc'));var squel=require('squel');var crypto=require(_0x7665('0xd'));var jsforce=require(_0x7665('0xe'));var deskjs=require(_0x7665('0xf'));var toCsv=require(_0x7665('0x9'));var querystring=require(_0x7665('0x10'));var Papa=require(_0x7665('0x11'));var Redis=require(_0x7665('0x12'));var authService=require(_0x7665('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7665('0x14'));var hardwareService=require(_0x7665('0x15'));var logger=require(_0x7665('0x16'))('api');var utils=require(_0x7665('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7665('0x18'));var db=require(_0x7665('0x19'))['db'];function respondWithStatusCode(_0x4a346f,_0xb56a8e){_0xb56a8e=_0xb56a8e||0xcc;return function(_0x2e8dda){if(_0x2e8dda){return _0x4a346f['sendStatus'](_0xb56a8e);}return _0x4a346f[_0x7665('0x1a')](_0xb56a8e)[_0x7665('0x1b')]();};}function respondWithResult(_0x4e75c2,_0x42c571){_0x42c571=_0x42c571||0xc8;return function(_0x311e63){if(_0x311e63){return _0x4e75c2[_0x7665('0x1a')](_0x42c571)[_0x7665('0x1c')](_0x311e63);}};}function respondWithFilteredResult(_0x2719c0,_0x331d8c){return function(_0x308e5c){if(_0x308e5c){var _0x3fb8cb=typeof _0x331d8c[_0x7665('0x1d')]===_0x7665('0x1e')&&typeof _0x331d8c[_0x7665('0x1f')]===_0x7665('0x1e');var _0x34dc39=_0x308e5c[_0x7665('0x20')];var _0x2dab51=_0x3fb8cb?0x0:_0x331d8c[_0x7665('0x1d')];var _0x522944=_0x3fb8cb?_0x308e5c[_0x7665('0x20')]:_0x331d8c[_0x7665('0x1d')]+_0x331d8c['limit'];var _0x32b37a;if(_0x522944>=_0x34dc39){_0x522944=_0x34dc39;_0x32b37a=0xc8;}else{_0x32b37a=0xce;}_0x2719c0[_0x7665('0x1a')](_0x32b37a);return _0x2719c0[_0x7665('0x21')](_0x7665('0x22'),_0x2dab51+'-'+_0x522944+'/'+_0x34dc39)['json'](_0x308e5c);}return null;};}function patchUpdates(_0x35ca0f){return function(_0x1c0549){try{jsonpatch[_0x7665('0x23')](_0x1c0549,_0x35ca0f,!![]);}catch(_0x468c93){return BPromise[_0x7665('0x24')](_0x468c93);}return _0x1c0549['save']();};}function saveUpdates(_0x1292a0,_0x51d577){return function(_0x37be5d){if(_0x37be5d){return _0x37be5d[_0x7665('0x25')](_0x1292a0)['then'](function(_0x5652dd){return _0x5652dd;});}return null;};}function removeEntity(_0x282ff5,_0x2b60dc){return function(_0x4a9a25){if(_0x4a9a25){return _0x4a9a25[_0x7665('0x26')]()[_0x7665('0x27')](function(){_0x282ff5[_0x7665('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b5be6,_0x566415){return function(_0x4dc736){if(!_0x4dc736){_0x5b5be6[_0x7665('0x28')](0x194);}return _0x4dc736;};}function handleError(_0x3b22f4,_0x1129c1){_0x1129c1=_0x1129c1||0x1f4;return function(_0x5809e9){logger[_0x7665('0x29')](_0x5809e9[_0x7665('0x2a')]);if(_0x5809e9['name']){delete _0x5809e9['name'];}_0x3b22f4[_0x7665('0x1a')](_0x1129c1)[_0x7665('0x2b')](_0x5809e9);};}exports[_0x7665('0x2c')]=function(_0x23e167,_0x240ee3){var _0x3bcb70={},_0x5891fb={},_0x2a63fb={'count':0x0,'rows':[]};var _0x55d046=_['map'](db[_0x7665('0x2d')][_0x7665('0x2e')],function(_0x43797a){return{'name':_0x43797a[_0x7665('0x2f')],'type':_0x43797a[_0x7665('0x30')][_0x7665('0x31')]};});_0x5891fb[_0x7665('0x32')]=_[_0x7665('0x33')](_0x55d046,_0x7665('0x34'));_0x5891fb[_0x7665('0x35')]=_[_0x7665('0x36')](_0x23e167[_0x7665('0x35')]);_0x5891fb[_0x7665('0x37')]=_[_0x7665('0x38')](_0x5891fb[_0x7665('0x32')],_0x5891fb[_0x7665('0x35')]);_0x3bcb70[_0x7665('0x39')]=_[_0x7665('0x38')](_0x5891fb[_0x7665('0x32')],qs['fields'](_0x23e167[_0x7665('0x35')][_0x7665('0x3a')]));_0x3bcb70[_0x7665('0x39')]=_0x3bcb70[_0x7665('0x39')][_0x7665('0x3b')]?_0x3bcb70[_0x7665('0x39')]:_0x5891fb['model'];if(!_0x23e167[_0x7665('0x35')][_0x7665('0x3c')](_0x7665('0x3d'))){_0x3bcb70[_0x7665('0x1f')]=qs[_0x7665('0x1f')](_0x23e167['query'][_0x7665('0x1f')]);_0x3bcb70['offset']=qs[_0x7665('0x1d')](_0x23e167['query'][_0x7665('0x1d')]);}_0x3bcb70[_0x7665('0x3e')]=qs[_0x7665('0x3f')](_0x23e167[_0x7665('0x35')][_0x7665('0x3f')]);_0x3bcb70[_0x7665('0x40')]=qs['filters'](_[_0x7665('0x41')](_0x23e167[_0x7665('0x35')],_0x5891fb[_0x7665('0x37')]),_0x55d046);if(_0x23e167[_0x7665('0x35')]['filter']){_0x3bcb70[_0x7665('0x40')]=_[_0x7665('0x42')](_0x3bcb70[_0x7665('0x40')],{'$or':_[_0x7665('0x33')](_0x55d046,function(_0x38735b){if(_0x38735b['type']!==_0x7665('0x43')){var _0x341098={};_0x341098[_0x38735b[_0x7665('0x34')]]={'$like':'%'+_0x23e167[_0x7665('0x35')][_0x7665('0x44')]+'%'};return _0x341098;}})});}_0x3bcb70=_[_0x7665('0x42')]({},_0x3bcb70,_0x23e167[_0x7665('0x45')]);var _0x46ea8a={'where':_0x3bcb70[_0x7665('0x40')]};return db[_0x7665('0x2d')]['count'](_0x46ea8a)['then'](function(_0x28f5e6){_0x2a63fb[_0x7665('0x20')]=_0x28f5e6;if(_0x23e167['query']['includeAll']){_0x3bcb70[_0x7665('0x46')]=[{'all':!![]}];}return db[_0x7665('0x2d')]['findAll'](_0x3bcb70);})[_0x7665('0x27')](function(_0x2753c7){_0x2a63fb[_0x7665('0x47')]=_0x2753c7;return _0x2a63fb;})[_0x7665('0x27')](respondWithFilteredResult(_0x240ee3,_0x3bcb70))[_0x7665('0x48')](handleError(_0x240ee3,null));};exports[_0x7665('0x49')]=function(_0x442847,_0x3dd22e){var _0x3b59da={'raw':!![],'where':{'id':_0x442847[_0x7665('0x4a')]['id']}},_0x30fe6b={};_0x30fe6b[_0x7665('0x32')]=_[_0x7665('0x36')](db[_0x7665('0x2d')]['rawAttributes']);_0x30fe6b[_0x7665('0x35')]=_['keys'](_0x442847[_0x7665('0x35')]);_0x30fe6b[_0x7665('0x37')]=_[_0x7665('0x38')](_0x30fe6b[_0x7665('0x32')],_0x30fe6b[_0x7665('0x35')]);_0x3b59da['attributes']=_[_0x7665('0x38')](_0x30fe6b[_0x7665('0x32')],qs['fields'](_0x442847[_0x7665('0x35')]['fields']));_0x3b59da[_0x7665('0x39')]=_0x3b59da[_0x7665('0x39')][_0x7665('0x3b')]?_0x3b59da['attributes']:_0x30fe6b['model'];if(_0x442847[_0x7665('0x35')][_0x7665('0x4b')]){_0x3b59da['include']=[{'all':!![]}];}_0x3b59da=_[_0x7665('0x42')]({},_0x3b59da,_0x442847[_0x7665('0x45')]);return db[_0x7665('0x2d')][_0x7665('0x4c')](_0x3b59da)[_0x7665('0x27')](handleEntityNotFound(_0x3dd22e,null))[_0x7665('0x27')](respondWithResult(_0x3dd22e,null))[_0x7665('0x48')](handleError(_0x3dd22e,null));};exports[_0x7665('0x4d')]=function(_0x2fe046,_0x287e73){return db[_0x7665('0x2d')]['create'](_0x2fe046[_0x7665('0x4e')],{})['then'](respondWithResult(_0x287e73,0xc9))[_0x7665('0x48')](handleError(_0x287e73,null));};exports[_0x7665('0x25')]=function(_0x7dc436,_0x192f8d){if(_0x7dc436['body']['id']){delete _0x7dc436[_0x7665('0x4e')]['id'];}return db[_0x7665('0x2d')][_0x7665('0x4c')]({'where':{'id':_0x7dc436[_0x7665('0x4a')]['id']}})[_0x7665('0x27')](handleEntityNotFound(_0x192f8d,null))['then'](saveUpdates(_0x7dc436[_0x7665('0x4e')],null))['then'](respondWithResult(_0x192f8d,null))[_0x7665('0x48')](handleError(_0x192f8d,null));};exports[_0x7665('0x26')]=function(_0x58b2e4,_0x4ef138){return db[_0x7665('0x2d')][_0x7665('0x4c')]({'where':{'id':_0x58b2e4[_0x7665('0x4a')]['id']}})[_0x7665('0x27')](handleEntityNotFound(_0x4ef138,null))['then'](removeEntity(_0x4ef138,null))['catch'](handleError(_0x4ef138,null));};exports[_0x7665('0x4f')]=function(_0x567c79,_0x9e40ea){return db[_0x7665('0x2d')][_0x7665('0x4f')]()['then'](respondWithResult(_0x9e40ea,null))[_0x7665('0x48')](handleError(_0x9e40ea,null));}; \ No newline at end of file +var _0x9e8a=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','JscriptyAnswerReport','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x51f4da,_0x590902){var _0x40e115=function(_0x19a2aa){while(--_0x19a2aa){_0x51f4da['push'](_0x51f4da['shift']());}};_0x40e115(++_0x590902);}(_0x9e8a,0x112));var _0xa9e8=function(_0x159364,_0x6a2e0f){_0x159364=_0x159364-0x0;var _0x5e9fdb=_0x9e8a[_0x159364];return _0x5e9fdb;};'use strict';var emlformat=require(_0xa9e8('0x0'));var rimraf=require(_0xa9e8('0x1'));var zipdir=require(_0xa9e8('0x2'));var jsonpatch=require(_0xa9e8('0x3'));var rp=require(_0xa9e8('0x4'));var moment=require(_0xa9e8('0x5'));var BPromise=require(_0xa9e8('0x6'));var Mustache=require(_0xa9e8('0x7'));var util=require(_0xa9e8('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(_0xa9e8('0x9'));var _=require(_0xa9e8('0xa'));var squel=require(_0xa9e8('0xb'));var crypto=require(_0xa9e8('0xc'));var jsforce=require(_0xa9e8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa9e8('0xe'));var querystring=require(_0xa9e8('0xf'));var Papa=require(_0xa9e8('0x10'));var Redis=require(_0xa9e8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa9e8('0x12'));var as=require(_0xa9e8('0x13'));var hardwareService=require(_0xa9e8('0x14'));var logger=require(_0xa9e8('0x15'))('api');var utils=require(_0xa9e8('0x16'));var config=require(_0xa9e8('0x17'));var licenseUtil=require(_0xa9e8('0x18'));var db=require(_0xa9e8('0x19'))['db'];function respondWithStatusCode(_0x42cee1,_0x328918){_0x328918=_0x328918||0xcc;return function(_0xa982d){if(_0xa982d){return _0x42cee1[_0xa9e8('0x1a')](_0x328918);}return _0x42cee1['status'](_0x328918)[_0xa9e8('0x1b')]();};}function respondWithResult(_0x5e2cbf,_0x514de0){_0x514de0=_0x514de0||0xc8;return function(_0x56ddfb){if(_0x56ddfb){return _0x5e2cbf['status'](_0x514de0)['json'](_0x56ddfb);}};}function respondWithFilteredResult(_0x391969,_0x62ee19){return function(_0x185068){if(_0x185068){var _0x403645=typeof _0x62ee19[_0xa9e8('0x1c')]===_0xa9e8('0x1d')&&typeof _0x62ee19[_0xa9e8('0x1e')]===_0xa9e8('0x1d');var _0x5db208=_0x185068['count'];var _0x524e4e=_0x403645?0x0:_0x62ee19[_0xa9e8('0x1c')];var _0x757a54=_0x403645?_0x185068[_0xa9e8('0x1f')]:_0x62ee19['offset']+_0x62ee19[_0xa9e8('0x1e')];var _0x29b91b;if(_0x757a54>=_0x5db208){_0x757a54=_0x5db208;_0x29b91b=0xc8;}else{_0x29b91b=0xce;}_0x391969[_0xa9e8('0x20')](_0x29b91b);return _0x391969[_0xa9e8('0x21')](_0xa9e8('0x22'),_0x524e4e+'-'+_0x757a54+'/'+_0x5db208)[_0xa9e8('0x23')](_0x185068);}return null;};}function patchUpdates(_0x266d07){return function(_0x25a5d5){try{jsonpatch[_0xa9e8('0x24')](_0x25a5d5,_0x266d07,!![]);}catch(_0x1f9fbb){return BPromise[_0xa9e8('0x25')](_0x1f9fbb);}return _0x25a5d5['save']();};}function saveUpdates(_0x51ee03,_0x40b9ea){return function(_0x6b6fab){if(_0x6b6fab){return _0x6b6fab[_0xa9e8('0x26')](_0x51ee03)[_0xa9e8('0x27')](function(_0x1ea9b6){return _0x1ea9b6;});}return null;};}function removeEntity(_0x588aea,_0x74fe20){return function(_0x561a40){if(_0x561a40){return _0x561a40[_0xa9e8('0x28')]()[_0xa9e8('0x27')](function(){_0x588aea[_0xa9e8('0x20')](0xcc)[_0xa9e8('0x1b')]();});}};}function handleEntityNotFound(_0xc015c5,_0x38672a){return function(_0x499502){if(!_0x499502){_0xc015c5[_0xa9e8('0x1a')](0x194);}return _0x499502;};}function handleError(_0x5bc39b,_0x225b36){_0x225b36=_0x225b36||0x1f4;return function(_0x3a7b7a){logger['error'](_0x3a7b7a[_0xa9e8('0x29')]);if(_0x3a7b7a['name']){delete _0x3a7b7a[_0xa9e8('0x2a')];}_0x5bc39b[_0xa9e8('0x20')](_0x225b36)[_0xa9e8('0x2b')](_0x3a7b7a);};}exports['index']=function(_0x34791e,_0x56e9bf){var _0x3a706e={},_0x3e6c63={},_0x45ade7={'count':0x0,'rows':[]};var _0x44d28b=_['map'](db[_0xa9e8('0x2c')][_0xa9e8('0x2d')],function(_0x2a966f){return{'name':_0x2a966f['fieldName'],'type':_0x2a966f[_0xa9e8('0x2e')]['key']};});_0x3e6c63[_0xa9e8('0x2f')]=_[_0xa9e8('0x30')](_0x44d28b,_0xa9e8('0x2a'));_0x3e6c63[_0xa9e8('0x31')]=_[_0xa9e8('0x32')](_0x34791e[_0xa9e8('0x31')]);_0x3e6c63[_0xa9e8('0x33')]=_[_0xa9e8('0x34')](_0x3e6c63[_0xa9e8('0x2f')],_0x3e6c63[_0xa9e8('0x31')]);_0x3a706e[_0xa9e8('0x35')]=_[_0xa9e8('0x34')](_0x3e6c63[_0xa9e8('0x2f')],qs['fields'](_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x36')]));_0x3a706e[_0xa9e8('0x35')]=_0x3a706e['attributes']['length']?_0x3a706e[_0xa9e8('0x35')]:_0x3e6c63[_0xa9e8('0x2f')];if(!_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x37')](_0xa9e8('0x38'))){_0x3a706e[_0xa9e8('0x1e')]=qs[_0xa9e8('0x1e')](_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x1e')]);_0x3a706e[_0xa9e8('0x1c')]=qs[_0xa9e8('0x1c')](_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x1c')]);}_0x3a706e[_0xa9e8('0x39')]=qs[_0xa9e8('0x3a')](_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x3a')]);_0x3a706e[_0xa9e8('0x3b')]=qs[_0xa9e8('0x33')](_['pick'](_0x34791e['query'],_0x3e6c63[_0xa9e8('0x33')]),_0x44d28b);if(_0x34791e['query'][_0xa9e8('0x3c')]){_0x3a706e[_0xa9e8('0x3b')]=_[_0xa9e8('0x3d')](_0x3a706e[_0xa9e8('0x3b')],{'$or':_[_0xa9e8('0x30')](_0x44d28b,function(_0x55be1b){if(_0x55be1b[_0xa9e8('0x2e')]!==_0xa9e8('0x3e')){var _0x2c03ba={};_0x2c03ba[_0x55be1b[_0xa9e8('0x2a')]]={'$like':'%'+_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x3c')]+'%'};return _0x2c03ba;}})});}_0x3a706e=_[_0xa9e8('0x3d')]({},_0x3a706e,_0x34791e[_0xa9e8('0x3f')]);var _0x1fb8a8={'where':_0x3a706e[_0xa9e8('0x3b')]};return db[_0xa9e8('0x2c')][_0xa9e8('0x1f')](_0x1fb8a8)[_0xa9e8('0x27')](function(_0x4d7dce){_0x45ade7[_0xa9e8('0x1f')]=_0x4d7dce;if(_0x34791e[_0xa9e8('0x31')][_0xa9e8('0x40')]){_0x3a706e[_0xa9e8('0x41')]=[{'all':!![]}];}return db[_0xa9e8('0x2c')]['findAll'](_0x3a706e);})['then'](function(_0x4c08e4){_0x45ade7[_0xa9e8('0x42')]=_0x4c08e4;return _0x45ade7;})[_0xa9e8('0x27')](respondWithFilteredResult(_0x56e9bf,_0x3a706e))[_0xa9e8('0x43')](handleError(_0x56e9bf,null));};exports[_0xa9e8('0x44')]=function(_0x4bf7f9,_0x3a05cc){var _0x1c489c={'raw':!![],'where':{'id':_0x4bf7f9[_0xa9e8('0x45')]['id']}},_0x157c05={};_0x157c05[_0xa9e8('0x2f')]=_[_0xa9e8('0x32')](db[_0xa9e8('0x2c')][_0xa9e8('0x2d')]);_0x157c05[_0xa9e8('0x31')]=_['keys'](_0x4bf7f9['query']);_0x157c05[_0xa9e8('0x33')]=_['intersection'](_0x157c05['model'],_0x157c05[_0xa9e8('0x31')]);_0x1c489c['attributes']=_[_0xa9e8('0x34')](_0x157c05[_0xa9e8('0x2f')],qs[_0xa9e8('0x36')](_0x4bf7f9['query'][_0xa9e8('0x36')]));_0x1c489c[_0xa9e8('0x35')]=_0x1c489c[_0xa9e8('0x35')]['length']?_0x1c489c[_0xa9e8('0x35')]:_0x157c05[_0xa9e8('0x2f')];if(_0x4bf7f9['query'][_0xa9e8('0x40')]){_0x1c489c['include']=[{'all':!![]}];}_0x1c489c=_['merge']({},_0x1c489c,_0x4bf7f9[_0xa9e8('0x3f')]);return db[_0xa9e8('0x2c')][_0xa9e8('0x46')](_0x1c489c)[_0xa9e8('0x27')](handleEntityNotFound(_0x3a05cc,null))[_0xa9e8('0x27')](respondWithResult(_0x3a05cc,null))[_0xa9e8('0x43')](handleError(_0x3a05cc,null));};exports['create']=function(_0x2759ea,_0x271be4){return db[_0xa9e8('0x2c')][_0xa9e8('0x47')](_0x2759ea[_0xa9e8('0x48')],{})[_0xa9e8('0x27')](respondWithResult(_0x271be4,0xc9))[_0xa9e8('0x43')](handleError(_0x271be4,null));};exports[_0xa9e8('0x26')]=function(_0x1ce67a,_0x25f55c){if(_0x1ce67a[_0xa9e8('0x48')]['id']){delete _0x1ce67a[_0xa9e8('0x48')]['id'];}return db[_0xa9e8('0x2c')][_0xa9e8('0x46')]({'where':{'id':_0x1ce67a[_0xa9e8('0x45')]['id']}})[_0xa9e8('0x27')](handleEntityNotFound(_0x25f55c,null))[_0xa9e8('0x27')](saveUpdates(_0x1ce67a[_0xa9e8('0x48')],null))[_0xa9e8('0x27')](respondWithResult(_0x25f55c,null))[_0xa9e8('0x43')](handleError(_0x25f55c,null));};exports['destroy']=function(_0x34c29e,_0x11264f){return db[_0xa9e8('0x2c')][_0xa9e8('0x46')]({'where':{'id':_0x34c29e['params']['id']}})[_0xa9e8('0x27')](handleEntityNotFound(_0x11264f,null))[_0xa9e8('0x27')](removeEntity(_0x11264f,null))[_0xa9e8('0x43')](handleError(_0x11264f,null));};exports[_0xa9e8('0x49')]=function(_0x2e5d34,_0xa2b9b5){return db[_0xa9e8('0x2c')]['describe']()['then'](respondWithResult(_0xa2b9b5,null))[_0xa9e8('0x43')](handleError(_0xa2b9b5,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index d9dc3e0..2fd6675 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 _0x2d52=['./jscriptyAnswerReport.attributes','define','report_jscripty_answers','lodash','util','api','bluebird','request-promise','path'];(function(_0x26ed75,_0x5c7dde){var _0x11a738=function(_0x58f7e2){while(--_0x58f7e2){_0x26ed75['push'](_0x26ed75['shift']());}};_0x11a738(++_0x5c7dde);}(_0x2d52,0x8a));var _0x22d5=function(_0x4adbb0,_0x5f5a74){_0x4adbb0=_0x4adbb0-0x0;var _0x5e235c=_0x2d52[_0x4adbb0];return _0x5e235c;};'use strict';var _=require(_0x22d5('0x0'));var util=require(_0x22d5('0x1'));var logger=require('../../config/logger')(_0x22d5('0x2'));var moment=require('moment');var BPromise=require(_0x22d5('0x3'));var rp=require(_0x22d5('0x4'));var fs=require('fs');var path=require(_0x22d5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x22d5('0x6'));module['exports']=function(_0x586c03,_0x58e398){return _0x586c03[_0x22d5('0x7')]('JscriptyAnswerReport',attributes,{'tableName':_0x22d5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa52d=['report_jscripty_answers','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport'];(function(_0x13f980,_0x1e1c56){var _0x27153c=function(_0x3953d5){while(--_0x3953d5){_0x13f980['push'](_0x13f980['shift']());}};_0x27153c(++_0x1e1c56);}(_0xa52d,0x6f));var _0xda52=function(_0x1fa381,_0x758c2a){_0x1fa381=_0x1fa381-0x0;var _0x47eefe=_0xa52d[_0x1fa381];return _0x47eefe;};'use strict';var _=require(_0xda52('0x0'));var util=require(_0xda52('0x1'));var logger=require(_0xda52('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xda52('0x3'));var fs=require('fs');var path=require(_0xda52('0x4'));var rimraf=require(_0xda52('0x5'));var config=require(_0xda52('0x6'));var attributes=require(_0xda52('0x7'));module['exports']=function(_0x2d26db,_0x11cf1d){return _0x2d26db[_0xda52('0x8')](_0xda52('0x9'),attributes,{'tableName':_0xda52('0xa'),'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 c5f46f1..7526adf 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 _0xb062=['info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x48cc5a,_0x5c5b07){var _0x258471=function(_0x4f4693){while(--_0x4f4693){_0x48cc5a['push'](_0x48cc5a['shift']());}};_0x258471(++_0x5c5b07);}(_0xb062,0x10b));var _0x2b06=function(_0x4d2f16,_0x87181e){_0x4d2f16=_0x4d2f16-0x0;var _0x1fd12e=_0xb062[_0x4d2f16];return _0x1fd12e;};'use strict';var _=require(_0x2b06('0x0'));var util=require(_0x2b06('0x1'));var moment=require(_0x2b06('0x2'));var BPromise=require(_0x2b06('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b06('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b06('0x5'));var logger=require('../../config/logger')(_0x2b06('0x6'));var config=require(_0x2b06('0x7'));var jayson=require(_0x2b06('0x8'));var client=jayson[_0x2b06('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbe1309,_0x252b08,_0x22d3b1){return new BPromise(function(_0x4734c1,_0x28f0d9){return client[_0x2b06('0xa')](_0xbe1309,_0x22d3b1)['then'](function(_0x3bb74b){logger['info'](_0x2b06('0xb'),_0x252b08,_0x2b06('0xc'));logger[_0x2b06('0xd')](_0x2b06('0xe'),_0x252b08,_0x2b06('0xc'),JSON[_0x2b06('0xf')](_0x3bb74b));if(_0x3bb74b['error']){if(_0x3bb74b[_0x2b06('0x10')][_0x2b06('0x11')]===0x1f4){logger[_0x2b06('0x10')](_0x2b06('0xb'),_0x252b08,_0x3bb74b[_0x2b06('0x10')]['message']);return _0x28f0d9(_0x3bb74b[_0x2b06('0x10')][_0x2b06('0x12')]);}logger[_0x2b06('0x10')](_0x2b06('0xb'),_0x252b08,_0x3bb74b[_0x2b06('0x10')][_0x2b06('0x12')]);return _0x4734c1(_0x3bb74b[_0x2b06('0x10')][_0x2b06('0x12')]);}else{logger[_0x2b06('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x252b08,_0x2b06('0xc'));_0x4734c1(_0x3bb74b[_0x2b06('0x14')][_0x2b06('0x12')]);}})[_0x2b06('0x15')](function(_0x3a2954){logger[_0x2b06('0x10')](_0x2b06('0xb'),_0x252b08,_0x3a2954);_0x28f0d9(_0x3a2954);});});} \ No newline at end of file +var _0xd757=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','code','error','message','catch'];(function(_0x29e9ca,_0x5733e8){var _0x731959=function(_0xe5e386){while(--_0xe5e386){_0x29e9ca['push'](_0x29e9ca['shift']());}};_0x731959(++_0x5733e8);}(_0xd757,0x18f));var _0x7d75=function(_0x3713b8,_0x470898){_0x3713b8=_0x3713b8-0x0;var _0x123d56=_0xd757[_0x3713b8];return _0x123d56;};'use strict';var _=require('lodash');var util=require(_0x7d75('0x0'));var moment=require(_0x7d75('0x1'));var BPromise=require(_0x7d75('0x2'));var rs=require(_0x7d75('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d75('0x4'))['db'];var utils=require(_0x7d75('0x5'));var logger=require(_0x7d75('0x6'))(_0x7d75('0x7'));var config=require(_0x7d75('0x8'));var jayson=require(_0x7d75('0x9'));var client=jayson['client'][_0x7d75('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48c131,_0x540039,_0x5a1024){return new BPromise(function(_0x320e14,_0x20051a){return client[_0x7d75('0xb')](_0x48c131,_0x5a1024)[_0x7d75('0xc')](function(_0x4cfd4c){logger['info'](_0x7d75('0xd'),_0x540039,_0x7d75('0xe'));logger[_0x7d75('0xf')](_0x7d75('0x10'),_0x540039,_0x7d75('0xe'),JSON['stringify'](_0x4cfd4c));if(_0x4cfd4c['error']){if(_0x4cfd4c['error'][_0x7d75('0x11')]===0x1f4){logger[_0x7d75('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x540039,_0x4cfd4c['error'][_0x7d75('0x13')]);return _0x20051a(_0x4cfd4c[_0x7d75('0x12')][_0x7d75('0x13')]);}logger[_0x7d75('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x540039,_0x4cfd4c[_0x7d75('0x12')][_0x7d75('0x13')]);return _0x320e14(_0x4cfd4c[_0x7d75('0x12')][_0x7d75('0x13')]);}else{logger['info'](_0x7d75('0xd'),_0x540039,'request\x20sent');_0x320e14(_0x4cfd4c['result'][_0x7d75('0x13')]);}})[_0x7d75('0x14')](function(_0x4ac761){logger[_0x7d75('0x12')](_0x7d75('0xd'),_0x540039,_0x4ac761);_0x20051a(_0x4ac761);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 0cfc2d2..6ac59aa 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 _0xe544=['get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe544,0xd0));var _0x4e54=function(_0x295660,_0x48eca){_0x295660=_0x295660-0x0;var _0x91ec93=_0xe544[_0x295660];return _0x91ec93;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4e54('0x0'));var timeout=require(_0x4e54('0x1'));var express=require(_0x4e54('0x2'));var router=express[_0x4e54('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4e54('0x4'));var interaction=require(_0x4e54('0x5'));var config=require(_0x4e54('0x6'));var controller=require(_0x4e54('0x7'));router[_0x4e54('0x8')]('/',auth['isAuthenticated'](),controller[_0x4e54('0x9')]);router['get'](_0x4e54('0xa'),auth[_0x4e54('0xb')](),controller[_0x4e54('0xc')]);router[_0x4e54('0x8')](_0x4e54('0xd'),auth[_0x4e54('0xb')](),controller[_0x4e54('0xe')]);router[_0x4e54('0x8')](_0x4e54('0xf'),auth[_0x4e54('0xb')](),controller[_0x4e54('0x10')]);router[_0x4e54('0x8')](_0x4e54('0x11'),auth[_0x4e54('0xb')](),timeout(_0x4e54('0x12')),controller['getSummary']);router[_0x4e54('0x13')]('/',auth['isAuthenticated'](),controller[_0x4e54('0x14')]);router[_0x4e54('0x13')](_0x4e54('0x15'),auth[_0x4e54('0xb')](),controller[_0x4e54('0x16')]);router[_0x4e54('0x17')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4e54('0x18')](_0x4e54('0xa'),auth[_0x4e54('0xb')](),controller[_0x4e54('0x19')]);module[_0x4e54('0x1a')]=router; \ No newline at end of file +var _0x43d1=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','/:id/clone','clone','put','update','delete'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0x43d1,0x11a));var _0x143d=function(_0x295860,_0x3099cd){_0x295860=_0x295860-0x0;var _0xea86ec=_0x43d1[_0x295860];return _0xea86ec;};'use strict';var multer=require(_0x143d('0x0'));var util=require(_0x143d('0x1'));var path=require(_0x143d('0x2'));var timeout=require(_0x143d('0x3'));var express=require(_0x143d('0x4'));var router=express['Router']();var fs_extra=require(_0x143d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x143d('0x6'));var config=require(_0x143d('0x7'));var controller=require(_0x143d('0x8'));router[_0x143d('0x9')]('/',auth[_0x143d('0xa')](),controller[_0x143d('0xb')]);router[_0x143d('0x9')](_0x143d('0xc'),auth['isAuthenticated'](),controller[_0x143d('0xd')]);router[_0x143d('0x9')](_0x143d('0xe'),auth[_0x143d('0xa')](),controller[_0x143d('0xf')]);router[_0x143d('0x9')](_0x143d('0x10'),auth[_0x143d('0xa')](),controller[_0x143d('0x11')]);router['get'](_0x143d('0x12'),auth['isAuthenticated'](),timeout('30s'),controller[_0x143d('0x13')]);router[_0x143d('0x14')]('/',auth[_0x143d('0xa')](),controller['create']);router[_0x143d('0x14')](_0x143d('0x15'),auth[_0x143d('0xa')](),controller[_0x143d('0x16')]);router[_0x143d('0x17')]('/:id',auth[_0x143d('0xa')](),controller[_0x143d('0x18')]);router[_0x143d('0x19')](_0x143d('0xc'),auth['isAuthenticated'](),controller[_0x143d('0x1a')]);module[_0x143d('0x1b')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 0ea5a16..f7e56dc 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 _0x7eb3=['name','description','BOOLEAN','sequelize','util','STRING','TEXT','long','isObjectLike','formData','stringify','isString','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x361e9e,_0x460e6d){var _0x30fd5a=function(_0x5bad01){while(--_0x5bad01){_0x361e9e['push'](_0x361e9e['shift']());}};_0x30fd5a(++_0x460e6d);}(_0x7eb3,0x1b3));var _0x37eb=function(_0x530fd7,_0x2534be){_0x530fd7=_0x530fd7-0x0;var _0x2ddad6=_0x7eb3[_0x530fd7];return _0x2ddad6;};'use strict';var Sequelize=require(_0x37eb('0x0'));var _=require('lodash');var util=require(_0x37eb('0x1'));module['exports']={'name':{'type':Sequelize[_0x37eb('0x2')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x37eb('0x3')](_0x37eb('0x4')),'set':function(_0x325907){if(_[_0x37eb('0x5')](_0x325907)){this['setDataValue'](_0x37eb('0x6'),JSON[_0x37eb('0x7')](_0x325907));}else if(_[_0x37eb('0x8')](_0x325907)){this[_0x37eb('0x9')](_0x37eb('0x6'),_0x325907);}else{this[_0x37eb('0x9')]('formData',util[_0x37eb('0xa')](_0x37eb('0xb'),this[_0x37eb('0xc')](_0x37eb('0xd'))||'',this[_0x37eb('0xc')](_0x37eb('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x37eb('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x37eb('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0xad89=['format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name','BOOLEAN','sequelize','util','exports','STRING','TEXT','isObjectLike','setDataValue','stringify','isString','formData'];(function(_0x57989b,_0x503852){var _0x295dc7=function(_0x45bc2c){while(--_0x45bc2c){_0x57989b['push'](_0x57989b['shift']());}};_0x295dc7(++_0x503852);}(_0xad89,0x1f4));var _0x9ad8=function(_0xd3b0ac,_0x2f5065){_0xd3b0ac=_0xd3b0ac-0x0;var _0x3d773e=_0xad89[_0xd3b0ac];return _0x3d773e;};'use strict';var Sequelize=require(_0x9ad8('0x0'));var _=require('lodash');var util=require(_0x9ad8('0x1'));module[_0x9ad8('0x2')]={'name':{'type':Sequelize[_0x9ad8('0x3')],'unique':'name'},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x9ad8('0x4')]('long'),'set':function(_0x506b9e){if(_[_0x9ad8('0x5')](_0x506b9e)){this[_0x9ad8('0x6')]('formData',JSON[_0x9ad8('0x7')](_0x506b9e));}else if(_[_0x9ad8('0x8')](_0x506b9e)){this[_0x9ad8('0x6')]('formData',_0x506b9e);}else{this['setDataValue'](_0x9ad8('0x9'),util[_0x9ad8('0xa')](_0x9ad8('0xb'),this[_0x9ad8('0xc')](_0x9ad8('0xd'))||'',this[_0x9ad8('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x9ad8('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x9ad8('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 0e40f64..cceb792 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 _0x8b5c=['JscriptyAnswerReport','ProjectId','number','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','setHeader','Content-type','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','get','Projects','error','stack','name','send','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','JscriptyProject','includeAll','include','findAll','rows','catch','show','params','fields','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','clone','omit','updatedAt','createdAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','nolimit','pick','getAnswers'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x8b5c,0x10d));var _0xc8b5=function(_0x427c8f,_0x92dcda){_0x427c8f=_0x427c8f-0x0;var _0x1a7eff=_0x8b5c[_0x427c8f];return _0x1a7eff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc8b5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc8b5('0x1'));var rp=require(_0xc8b5('0x2'));var moment=require('moment');var BPromise=require(_0xc8b5('0x3'));var Mustache=require(_0xc8b5('0x4'));var util=require('util');var path=require(_0xc8b5('0x5'));var sox=require('sox');var csv=require(_0xc8b5('0x6'));var ejs=require(_0xc8b5('0x7'));var fs=require('fs');var fs_extra=require(_0xc8b5('0x8'));var _=require(_0xc8b5('0x9'));var squel=require(_0xc8b5('0xa'));var crypto=require(_0xc8b5('0xb'));var jsforce=require(_0xc8b5('0xc'));var deskjs=require(_0xc8b5('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc8b5('0xe'));var Papa=require(_0xc8b5('0xf'));var Redis=require(_0xc8b5('0x10'));var authService=require(_0xc8b5('0x11'));var qs=require(_0xc8b5('0x12'));var as=require(_0xc8b5('0x13'));var hardwareService=require(_0xc8b5('0x14'));var logger=require(_0xc8b5('0x15'))(_0xc8b5('0x16'));var utils=require(_0xc8b5('0x17'));var config=require(_0xc8b5('0x18'));var licenseUtil=require(_0xc8b5('0x19'));var db=require(_0xc8b5('0x1a'))['db'];function respondWithStatusCode(_0x7e1b00,_0x17ece2){_0x17ece2=_0x17ece2||0xcc;return function(_0x19c8e5){if(_0x19c8e5){return _0x7e1b00[_0xc8b5('0x1b')](_0x17ece2);}return _0x7e1b00[_0xc8b5('0x1c')](_0x17ece2)[_0xc8b5('0x1d')]();};}function respondWithResult(_0x3d6db3,_0xe15aad){_0xe15aad=_0xe15aad||0xc8;return function(_0x26bab7){if(_0x26bab7){return _0x3d6db3[_0xc8b5('0x1c')](_0xe15aad)[_0xc8b5('0x1e')](_0x26bab7);}};}function respondWithFilteredResult(_0x4b5c21,_0x593bc1){return function(_0x5c9bc7){if(_0x5c9bc7){var _0x557f1a=typeof _0x593bc1[_0xc8b5('0x1f')]==='undefined'&&typeof _0x593bc1['limit']===_0xc8b5('0x20');var _0x546e4d=_0x5c9bc7[_0xc8b5('0x21')];var _0x5b2064=_0x557f1a?0x0:_0x593bc1[_0xc8b5('0x1f')];var _0x24820b=_0x557f1a?_0x5c9bc7[_0xc8b5('0x21')]:_0x593bc1[_0xc8b5('0x1f')]+_0x593bc1[_0xc8b5('0x22')];var _0x222fc6;if(_0x24820b>=_0x546e4d){_0x24820b=_0x546e4d;_0x222fc6=0xc8;}else{_0x222fc6=0xce;}_0x4b5c21[_0xc8b5('0x1c')](_0x222fc6);return _0x4b5c21[_0xc8b5('0x23')](_0xc8b5('0x24'),_0x5b2064+'-'+_0x24820b+'/'+_0x546e4d)['json'](_0x5c9bc7);}return null;};}function patchUpdates(_0x460630){return function(_0x2394a4){try{jsonpatch[_0xc8b5('0x25')](_0x2394a4,_0x460630,!![]);}catch(_0x46c586){return BPromise['reject'](_0x46c586);}return _0x2394a4['save']();};}function saveUpdates(_0x3642f7,_0x15ff36){return function(_0x33bec7){if(_0x33bec7){return _0x33bec7[_0xc8b5('0x26')](_0x3642f7)[_0xc8b5('0x27')](function(_0x15d9d4){return _0x15d9d4;});}return null;};}function removeEntity(_0x175525,_0x469857){return function(_0xbd2a41){if(_0xbd2a41){return _0xbd2a41[_0xc8b5('0x28')]()['then'](function(){var _0x22510f=_0xbd2a41[_0xc8b5('0x29')]({'plain':!![]});var _0x51b64f=_0xc8b5('0x2a');return db['UserProfileResource'][_0xc8b5('0x28')]({'where':{'type':_0x51b64f,'resourceId':_0x22510f['id']}})[_0xc8b5('0x27')](function(){return _0xbd2a41;});})[_0xc8b5('0x27')](function(){_0x175525['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1008c5,_0x3008b6){return function(_0x3bc71e){if(!_0x3bc71e){_0x1008c5['sendStatus'](0x194);}return _0x3bc71e;};}function handleError(_0x2ed053,_0x2cd662){_0x2cd662=_0x2cd662||0x1f4;return function(_0x5317d2){logger[_0xc8b5('0x2b')](_0x5317d2[_0xc8b5('0x2c')]);if(_0x5317d2['name']){delete _0x5317d2[_0xc8b5('0x2d')];}_0x2ed053[_0xc8b5('0x1c')](_0x2cd662)[_0xc8b5('0x2e')](_0x5317d2);};}exports['index']=function(_0x5e89d6,_0x173ae9){var _0x2067ff={},_0x1007f7={},_0x151ad5={'count':0x0,'rows':[]};var _0x46dc5f=_[_0xc8b5('0x2f')](db['JscriptyProject'][_0xc8b5('0x30')],function(_0x350471){return{'name':_0x350471[_0xc8b5('0x31')],'type':_0x350471['type'][_0xc8b5('0x32')]};});_0x1007f7[_0xc8b5('0x33')]=_[_0xc8b5('0x2f')](_0x46dc5f,_0xc8b5('0x2d'));_0x1007f7['query']=_[_0xc8b5('0x34')](_0x5e89d6[_0xc8b5('0x35')]);_0x1007f7['filters']=_[_0xc8b5('0x36')](_0x1007f7['model'],_0x1007f7[_0xc8b5('0x35')]);_0x2067ff[_0xc8b5('0x37')]=_['intersection'](_0x1007f7['model'],qs['fields'](_0x5e89d6['query']['fields']));_0x2067ff[_0xc8b5('0x37')]=_0x2067ff[_0xc8b5('0x37')][_0xc8b5('0x38')]?_0x2067ff[_0xc8b5('0x37')]:_0x1007f7[_0xc8b5('0x33')];if(!_0x5e89d6[_0xc8b5('0x35')][_0xc8b5('0x39')]('nolimit')){_0x2067ff[_0xc8b5('0x22')]=qs[_0xc8b5('0x22')](_0x5e89d6[_0xc8b5('0x35')][_0xc8b5('0x22')]);_0x2067ff[_0xc8b5('0x1f')]=qs[_0xc8b5('0x1f')](_0x5e89d6['query']['offset']);}_0x2067ff[_0xc8b5('0x3a')]=qs[_0xc8b5('0x3b')](_0x5e89d6[_0xc8b5('0x35')][_0xc8b5('0x3b')]);_0x2067ff[_0xc8b5('0x3c')]=qs[_0xc8b5('0x3d')](_['pick'](_0x5e89d6[_0xc8b5('0x35')],_0x1007f7['filters']),_0x46dc5f);if(_0x5e89d6[_0xc8b5('0x35')][_0xc8b5('0x3e')]){_0x2067ff['where']=_[_0xc8b5('0x3f')](_0x2067ff[_0xc8b5('0x3c')],{'$or':_[_0xc8b5('0x2f')](_0x46dc5f,function(_0x369e5f){if(_0x369e5f[_0xc8b5('0x40')]!==_0xc8b5('0x41')){var _0x52eeb5={};_0x52eeb5[_0x369e5f[_0xc8b5('0x2d')]]={'$like':'%'+_0x5e89d6['query']['filter']+'%'};return _0x52eeb5;}})});}_0x2067ff=_[_0xc8b5('0x3f')]({},_0x2067ff,_0x5e89d6['options']);var _0x25d113={'where':_0x2067ff[_0xc8b5('0x3c')]};return db[_0xc8b5('0x42')][_0xc8b5('0x21')](_0x25d113)[_0xc8b5('0x27')](function(_0x475b0f){_0x151ad5[_0xc8b5('0x21')]=_0x475b0f;if(_0x5e89d6['query'][_0xc8b5('0x43')]){_0x2067ff[_0xc8b5('0x44')]=[{'all':!![]}];}return db['JscriptyProject'][_0xc8b5('0x45')](_0x2067ff);})[_0xc8b5('0x27')](function(_0x45e6b3){_0x151ad5[_0xc8b5('0x46')]=_0x45e6b3;return _0x151ad5;})['then'](respondWithFilteredResult(_0x173ae9,_0x2067ff))[_0xc8b5('0x47')](handleError(_0x173ae9,null));};exports[_0xc8b5('0x48')]=function(_0x821059,_0x140548){var _0x4cadb1={'raw':![],'where':{'id':_0x821059[_0xc8b5('0x49')]['id']}},_0x4b3e6a={};_0x4b3e6a[_0xc8b5('0x33')]=_[_0xc8b5('0x34')](db[_0xc8b5('0x42')][_0xc8b5('0x30')]);_0x4b3e6a[_0xc8b5('0x35')]=_[_0xc8b5('0x34')](_0x821059[_0xc8b5('0x35')]);_0x4b3e6a[_0xc8b5('0x3d')]=_[_0xc8b5('0x36')](_0x4b3e6a[_0xc8b5('0x33')],_0x4b3e6a[_0xc8b5('0x35')]);_0x4cadb1[_0xc8b5('0x37')]=_[_0xc8b5('0x36')](_0x4b3e6a[_0xc8b5('0x33')],qs['fields'](_0x821059[_0xc8b5('0x35')][_0xc8b5('0x4a')]));_0x4cadb1[_0xc8b5('0x37')]=_0x4cadb1[_0xc8b5('0x37')][_0xc8b5('0x38')]?_0x4cadb1[_0xc8b5('0x37')]:_0x4b3e6a[_0xc8b5('0x33')];if(_0x821059['query']['includeAll']){_0x4cadb1[_0xc8b5('0x44')]=[{'all':!![]}];}_0x4cadb1=_['merge']({},_0x4cadb1,_0x821059[_0xc8b5('0x4b')]);return db[_0xc8b5('0x42')][_0xc8b5('0x4c')](_0x4cadb1)['then'](handleEntityNotFound(_0x140548,null))['then'](respondWithResult(_0x140548,null))['catch'](handleError(_0x140548,null));};exports['create']=function(_0x25a977,_0x327186){return db[_0xc8b5('0x42')][_0xc8b5('0x4d')](_0x25a977[_0xc8b5('0x4e')],{})[_0xc8b5('0x27')](function(_0x3330b7){var _0x455e18=_0x25a977[_0xc8b5('0x4f')][_0xc8b5('0x29')]({'plain':!![]});if(!_0x455e18)throw new Error(_0xc8b5('0x50'));if(_0x455e18[_0xc8b5('0x51')]==='user'){var _0x15ddce=_0x3330b7[_0xc8b5('0x29')]({'plain':!![]});var _0x284b44=_0xc8b5('0x2a');return db[_0xc8b5('0x52')][_0xc8b5('0x4c')]({'where':{'name':_0x284b44,'userProfileId':_0x455e18[_0xc8b5('0x53')]},'raw':!![]})[_0xc8b5('0x27')](function(_0x404bff){if(_0x404bff&&_0x404bff[_0xc8b5('0x54')]===0x0){return db[_0xc8b5('0x55')][_0xc8b5('0x4d')]({'name':_0x15ddce['name'],'resourceId':_0x15ddce['id'],'type':_0x404bff['name'],'sectionId':_0x404bff['id']},{})[_0xc8b5('0x27')](function(){return _0x3330b7;});}else{return _0x3330b7;}})['catch'](function(_0x346e63){logger[_0xc8b5('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x346e63);throw _0x346e63;});}return _0x3330b7;})['then'](respondWithResult(_0x327186,0xc9))[_0xc8b5('0x47')](handleError(_0x327186,null));};exports[_0xc8b5('0x56')]=function(_0x4dfb72,_0x9b7a56){var _0x29aa3b={'where':{'id':_0x4dfb72['params']['id']}},_0x5296a2={};_0x5296a2[_0xc8b5('0x33')]=_['keys'](db['JscriptyProject']['rawAttributes']);_0x29aa3b[_0xc8b5('0x37')]=_[_0xc8b5('0x36')](_0x5296a2[_0xc8b5('0x33')],qs['fields'](_0x4dfb72[_0xc8b5('0x35')]['fields']));_0x29aa3b[_0xc8b5('0x37')]=_0x29aa3b[_0xc8b5('0x37')][_0xc8b5('0x38')]?_0x29aa3b[_0xc8b5('0x37')]:_0x5296a2[_0xc8b5('0x33')];if(_0x4dfb72['query'][_0xc8b5('0x43')]){_0x29aa3b[_0xc8b5('0x44')]=[{'all':!![]}];}_0x29aa3b=_['merge']({},_0x29aa3b,_0x4dfb72[_0xc8b5('0x4b')]);return db[_0xc8b5('0x42')][_0xc8b5('0x4c')](_0x29aa3b)[_0xc8b5('0x27')](handleEntityNotFound(_0x9b7a56,null))[_0xc8b5('0x27')](function(_0x2db99c){if(_0x2db99c){var _0x166145=_0x2db99c[_0xc8b5('0x29')]({'plain':!![]});_0x166145=qs[_0xc8b5('0x57')](_0x166145,['id','createdAt',_0xc8b5('0x58')]);_0x4dfb72[_0xc8b5('0x4e')]=_[_0xc8b5('0x57')](_0x4dfb72[_0xc8b5('0x4e')],['id',_0xc8b5('0x59'),'updatedAt']);return db[_0xc8b5('0x42')]['create'](_[_0xc8b5('0x3f')](_0x166145,_0x4dfb72['body']),{'include':_0x4dfb72['query'][_0xc8b5('0x43')]?[{'all':!![]}]:undefined})[_0xc8b5('0x27')](function(_0x452546){var _0x520677=_0x4dfb72[_0xc8b5('0x4f')][_0xc8b5('0x29')]({'plain':!![]});if(!_0x520677)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x520677[_0xc8b5('0x51')]===_0xc8b5('0x4f')){var _0x4d21d8=_0x452546['get']({'plain':!![]});var _0x54e791=_0xc8b5('0x2a');return db[_0xc8b5('0x52')][_0xc8b5('0x4c')]({'where':{'name':_0x54e791,'userProfileId':_0x520677['userProfileId']},'raw':!![]})[_0xc8b5('0x27')](function(_0x1eb3e1){if(_0x1eb3e1&&_0x1eb3e1[_0xc8b5('0x54')]===0x0){return db[_0xc8b5('0x55')][_0xc8b5('0x4d')]({'name':_0x4d21d8[_0xc8b5('0x2d')],'resourceId':_0x4d21d8['id'],'type':_0x1eb3e1[_0xc8b5('0x2d')],'sectionId':_0x1eb3e1['id']},{})[_0xc8b5('0x27')](function(){return _0x452546;});}else{return _0x452546;}})[_0xc8b5('0x47')](function(_0x19f8ea){logger[_0xc8b5('0x2b')](_0xc8b5('0x5a'),_0x19f8ea);throw _0x19f8ea;});}return _0x452546;});}})[_0xc8b5('0x27')](respondWithResult(_0x9b7a56,0xc9))[_0xc8b5('0x47')](handleError(_0x9b7a56,null));};exports[_0xc8b5('0x26')]=function(_0x50e016,_0x20463a){if(_0x50e016[_0xc8b5('0x4e')]['id']){delete _0x50e016['body']['id'];}return db[_0xc8b5('0x42')]['find']({'where':{'id':_0x50e016['params']['id']}})[_0xc8b5('0x27')](handleEntityNotFound(_0x20463a,null))['then'](saveUpdates(_0x50e016[_0xc8b5('0x4e')],null))[_0xc8b5('0x27')](respondWithResult(_0x20463a,null))[_0xc8b5('0x47')](handleError(_0x20463a,null));};exports['destroy']=function(_0x183824,_0x3d0910){return db[_0xc8b5('0x42')]['find']({'where':{'id':_0x183824[_0xc8b5('0x49')]['id']}})[_0xc8b5('0x27')](handleEntityNotFound(_0x3d0910,null))['then'](removeEntity(_0x3d0910,null))[_0xc8b5('0x47')](handleError(_0x3d0910,null));};exports[_0xc8b5('0x5b')]=function(_0x17f585,_0x1f8358,_0x2f5d35){var _0x456f4a={'raw':!![],'where':{}};var _0x2f4453={};var _0x1ab9eb={'count':0x0,'rows':[]};return db[_0xc8b5('0x42')][_0xc8b5('0x5c')]({'where':{'id':_0x17f585['params']['id']}})[_0xc8b5('0x27')](handleEntityNotFound(_0x1f8358,null))[_0xc8b5('0x27')](function(_0x3aaa22){if(_0x3aaa22){_0x2f4453[_0xc8b5('0x33')]=_[_0xc8b5('0x34')](db[_0xc8b5('0x5d')][_0xc8b5('0x30')]);_0x2f4453[_0xc8b5('0x35')]=_[_0xc8b5('0x34')](_0x17f585[_0xc8b5('0x35')]);_0x2f4453[_0xc8b5('0x3d')]=_[_0xc8b5('0x36')](_0x2f4453[_0xc8b5('0x33')],_0x2f4453[_0xc8b5('0x35')]);_0x456f4a[_0xc8b5('0x37')]=_[_0xc8b5('0x36')](_0x2f4453[_0xc8b5('0x33')],qs[_0xc8b5('0x4a')](_0x17f585['query'][_0xc8b5('0x4a')]));_0x456f4a[_0xc8b5('0x37')]=_0x456f4a[_0xc8b5('0x37')][_0xc8b5('0x38')]?_0x456f4a[_0xc8b5('0x37')]:_0x2f4453[_0xc8b5('0x33')];if(!_0x17f585[_0xc8b5('0x35')]['hasOwnProperty'](_0xc8b5('0x5e'))){_0x456f4a['limit']=qs[_0xc8b5('0x22')](_0x17f585[_0xc8b5('0x35')]['limit']);_0x456f4a[_0xc8b5('0x1f')]=qs['offset'](_0x17f585[_0xc8b5('0x35')][_0xc8b5('0x1f')]);}_0x456f4a[_0xc8b5('0x3a')]=qs['sort'](_0x17f585[_0xc8b5('0x35')][_0xc8b5('0x3b')]);_0x456f4a[_0xc8b5('0x3c')]=qs[_0xc8b5('0x3d')](_[_0xc8b5('0x5f')](_0x17f585[_0xc8b5('0x35')],_0x2f4453[_0xc8b5('0x3d')]));_0x456f4a[_0xc8b5('0x3c')]['ProjectId']=_0x3aaa22['id'];if(_0x17f585[_0xc8b5('0x35')][_0xc8b5('0x3e')]){_0x456f4a['where']=_['merge'](_0x456f4a[_0xc8b5('0x3c')],{'$or':_['map'](_0x456f4a[_0xc8b5('0x37')],function(_0x5627bd){var _0x33ec10={};_0x33ec10[_0x5627bd]={'$like':'%'+_0x17f585[_0xc8b5('0x35')]['filter']+'%'};return _0x33ec10;})});}_0x456f4a=_[_0xc8b5('0x3f')]({},_0x456f4a,_0x17f585['options']);return db[_0xc8b5('0x5d')]['count']({'where':_0x456f4a[_0xc8b5('0x3c')]})['then'](function(_0xa4f145){_0x1ab9eb[_0xc8b5('0x21')]=_0xa4f145;if(_0x17f585[_0xc8b5('0x35')][_0xc8b5('0x43')]){_0x456f4a['include']=[{'all':!![]}];}return db[_0xc8b5('0x5d')][_0xc8b5('0x45')](_0x456f4a);})[_0xc8b5('0x27')](function(_0xe2bbe2){_0x1ab9eb[_0xc8b5('0x46')]=_0xe2bbe2;return _0x1ab9eb;});}})[_0xc8b5('0x27')](respondWithFilteredResult(_0x1f8358,_0x456f4a))[_0xc8b5('0x47')](handleError(_0x1f8358,null));};exports[_0xc8b5('0x60')]=function(_0x152832,_0x21a3b7,_0x4f87ff){var _0x5e062d={'raw':!![],'where':{}};var _0x5e4fbf={};var _0x17c3ed={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xc8b5('0x5c')]({'where':{'id':_0x152832[_0xc8b5('0x49')]['id']}})[_0xc8b5('0x27')](handleEntityNotFound(_0x21a3b7,null))[_0xc8b5('0x27')](function(_0x2d1418){if(_0x2d1418){_0x5e4fbf[_0xc8b5('0x33')]=_[_0xc8b5('0x34')](db[_0xc8b5('0x61')][_0xc8b5('0x30')]);_0x5e4fbf[_0xc8b5('0x35')]=_[_0xc8b5('0x34')](_0x152832[_0xc8b5('0x35')]);_0x5e4fbf[_0xc8b5('0x3d')]=_['intersection'](_0x5e4fbf[_0xc8b5('0x33')],_0x5e4fbf[_0xc8b5('0x35')]);_0x5e062d[_0xc8b5('0x37')]=_[_0xc8b5('0x36')](_0x5e4fbf[_0xc8b5('0x33')],qs[_0xc8b5('0x4a')](_0x152832['query'][_0xc8b5('0x4a')]));_0x5e062d[_0xc8b5('0x37')]=_0x5e062d[_0xc8b5('0x37')]['length']?_0x5e062d[_0xc8b5('0x37')]:_0x5e4fbf[_0xc8b5('0x33')];if(!_0x152832['query']['hasOwnProperty']('nolimit')){_0x5e062d[_0xc8b5('0x22')]=qs[_0xc8b5('0x22')](_0x152832[_0xc8b5('0x35')]['limit']);_0x5e062d[_0xc8b5('0x1f')]=qs[_0xc8b5('0x1f')](_0x152832[_0xc8b5('0x35')]['offset']);}_0x5e062d['order']=qs[_0xc8b5('0x3b')](_0x152832[_0xc8b5('0x35')][_0xc8b5('0x3b')]);_0x5e062d[_0xc8b5('0x3c')]=qs[_0xc8b5('0x3d')](_[_0xc8b5('0x5f')](_0x152832['query'],_0x5e4fbf[_0xc8b5('0x3d')]));_0x5e062d['where'][_0xc8b5('0x62')]=_0x2d1418['id'];if(_0x152832['query'][_0xc8b5('0x3e')]){_0x5e062d['where']=_['merge'](_0x5e062d[_0xc8b5('0x3c')],{'$or':_[_0xc8b5('0x2f')](_0x5e062d[_0xc8b5('0x37')],function(_0x3c004e){var _0x9ae6e9={};_0x9ae6e9[_0x3c004e]={'$like':'%'+_0x152832[_0xc8b5('0x35')][_0xc8b5('0x3e')]+'%'};return _0x9ae6e9;})});}_0x5e062d=_[_0xc8b5('0x3f')]({},_0x5e062d,_0x152832[_0xc8b5('0x4b')]);return db[_0xc8b5('0x61')][_0xc8b5('0x21')]({'where':_0x5e062d[_0xc8b5('0x3c')]})[_0xc8b5('0x27')](function(_0xdb1c93){_0x17c3ed[_0xc8b5('0x21')]=_0xdb1c93;if(_0x152832[_0xc8b5('0x35')][_0xc8b5('0x43')]){_0x5e062d[_0xc8b5('0x44')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xc8b5('0x45')](_0x5e062d);})[_0xc8b5('0x27')](function(_0x39da75){_0x17c3ed[_0xc8b5('0x46')]=_0x39da75;return _0x17c3ed;});}})['then'](respondWithFilteredResult(_0x21a3b7,_0x5e062d))['catch'](handleError(_0x21a3b7,null));};function char(_0x4555c4){return _0xc8b5('0x63')===typeof _0x4555c4?String['fromCharCode'][_0xc8b5('0x25')](null,arguments):_0x4555c4;}function needsEncapsulation(_0xbe6def){return!!_0xbe6def&&(_0xbe6def[_0xc8b5('0x64')]()[_0xc8b5('0x65')](char(0xd))>=0x0||_0xbe6def['toString']()[_0xc8b5('0x65')](char(0xa))>=0x0||_0xbe6def['toString']()['indexOf'](char(0x2c))>=0x0||_0xbe6def['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x87e46a){var _0x544607=char(0x22),_0x3ed66b='\x5c'+char(0x22),_0xc2713c=_0x87e46a[_0xc8b5('0x64')]()[_0xc8b5('0x66')](new RegExp(_0x544607,'g'),_0x3ed66b);return _0x544607+_0xc2713c+_0x544607;}exports[_0xc8b5('0x67')]=function(_0x1f9ee2,_0x318124,_0x367d65){var _0x3d2ce6,_0x415c43;var _0x2edd13={'where':{'ProjectId':_0x1f9ee2[_0xc8b5('0x49')]['id']}};if(_0x1f9ee2[_0xc8b5('0x35')][_0xc8b5('0x68')]){_0x2edd13[_0xc8b5('0x3c')][_0xc8b5('0x69')]=JSON[_0xc8b5('0x6a')](_0x1f9ee2['query']['startTime']);}return db['JscriptySessionReport'][_0xc8b5('0x45')](_0x2edd13)[_0xc8b5('0x27')](handleEntityNotFound(_0x318124,null))['then'](function(_0x3df4d9){if(_0x3df4d9){_0x3d2ce6=_0x3df4d9;return db[_0xc8b5('0x6b')]['findAll']({'where':{'SessionId':{'$in':_[_0xc8b5('0x2f')](_0x3d2ce6,'id')},'ProjectId':_0x1f9ee2[_0xc8b5('0x49')]['id']},'order':_0xc8b5('0x6c')});}})[_0xc8b5('0x27')](handleEntityNotFound(_0x318124,null))[_0xc8b5('0x27')](function(_0x56bb91){if(_0x56bb91){_0x415c43=_0x56bb91;var _0xbf4e56={};for(var _0x4890bd=0x0,_0x3ded01=_0x415c43['length'];_0x4890bd<_0x3ded01;_0x4890bd++){if(!_0xbf4e56[_0xc8b5('0x39')](_0x415c43[_0x4890bd][_0xc8b5('0x6d')])){_0xbf4e56[_0x415c43[_0x4890bd][_0xc8b5('0x6d')]]=needsEncapsulation(_0x415c43[_0x4890bd][_0xc8b5('0x6e')])?encapsulate(_0x415c43[_0x4890bd][_0xc8b5('0x6e')]):_0x415c43[_0x4890bd]['question'];}}var _0x32ecd7=[],_0x3caa41={};for(var _0x5b8b36=0x0,_0xf7bddd=_0x3d2ce6['length'];_0x5b8b36<_0xf7bddd;_0x5b8b36++){_0x3caa41={'ProjectId':_0x1f9ee2[_0xc8b5('0x49')]['id'],'SessionId':_0x3d2ce6[_0x5b8b36]['id'],'StartTime':moment(_0x3d2ce6[_0x5b8b36][_0xc8b5('0x69')])[_0xc8b5('0x6f')](_0xc8b5('0x70'))};for(var _0x1ee2df=0x0,_0x468955=_0x415c43[_0xc8b5('0x38')];_0x1ee2df<_0x468955;_0x1ee2df++){if(_0x415c43[_0x1ee2df][_0xc8b5('0x71')]==_0x3d2ce6[_0x5b8b36]['id']&&_0xbf4e56[_0xc8b5('0x39')](_0x415c43[_0x1ee2df][_0xc8b5('0x6d')])){_0x3caa41[_0xbf4e56[_0x415c43[_0x1ee2df][_0xc8b5('0x6d')]]]=_0x415c43[_0x1ee2df][_0xc8b5('0x72')];}}for(var _0x536ad6 in _0xbf4e56){if(!_0x3caa41['hasOwnProperty'](_0xbf4e56[_0x536ad6])){_0x3caa41[_0xbf4e56[_0x536ad6]]=null;}}_0x32ecd7[_0xc8b5('0x73')](_0x3caa41);}return _0x32ecd7;}})[_0xc8b5('0x27')](function(_0x55f03b){if(!_[_0xc8b5('0x74')](_0x55f03b)){var _0x2e35f0=toCsv(_0x55f03b);var _0x5bf6bd=Date[_0xc8b5('0x75')]();fs['writeFileSync'](util[_0xc8b5('0x6f')](_0xc8b5('0x76'),_0x1f9ee2[_0xc8b5('0x49')]['id'],_0x5bf6bd),_0x2e35f0);_0x318124['setHeader'](_0xc8b5('0x77'),'attachment;\x20filename='+util[_0xc8b5('0x6f')]('Jscripty_Project_%d_Summary_%s.csv',_0x1f9ee2[_0xc8b5('0x49')]['id'],_0x5bf6bd));_0x318124[_0xc8b5('0x78')](_0xc8b5('0x79'),'text/csv');return _0x318124['download'](util['format'](_0xc8b5('0x76'),_0x1f9ee2[_0xc8b5('0x49')]['id'],_0x5bf6bd));}else{return _0x318124['sendStatus'](0xcc);}})[_0xc8b5('0x47')](handleError(_0x318124,null));}; \ No newline at end of file +var _0x4f3d=['startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','answer','push','isEmpty','now','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','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/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','update','destroy','then','get','Projects','end','error','name','send','map','JscriptyProject','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','fields','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','role','UserProfileSection','userProfileId','getSessions','JscriptySessionReport','rows','getAnswers','findOne','JscriptyAnswerReport','pick','number','fromCharCode','toString','indexOf','replace','getSummary','starttime'];(function(_0x1a2ef3,_0x21186c){var _0x34f4a4=function(_0x277126){while(--_0x277126){_0x1a2ef3['push'](_0x1a2ef3['shift']());}};_0x34f4a4(++_0x21186c);}(_0x4f3d,0x171));var _0xd4f3=function(_0x2a61b0,_0x2c7e84){_0x2a61b0=_0x2a61b0-0x0;var _0x2a8b3a=_0x4f3d[_0x2a61b0];return _0x2a8b3a;};'use strict';var emlformat=require(_0xd4f3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd4f3('0x1'));var jsonpatch=require(_0xd4f3('0x2'));var rp=require(_0xd4f3('0x3'));var moment=require(_0xd4f3('0x4'));var BPromise=require(_0xd4f3('0x5'));var Mustache=require('mustache');var util=require(_0xd4f3('0x6'));var path=require(_0xd4f3('0x7'));var sox=require(_0xd4f3('0x8'));var csv=require(_0xd4f3('0x9'));var ejs=require(_0xd4f3('0xa'));var fs=require('fs');var fs_extra=require(_0xd4f3('0xb'));var _=require(_0xd4f3('0xc'));var squel=require(_0xd4f3('0xd'));var crypto=require('crypto');var jsforce=require(_0xd4f3('0xe'));var deskjs=require(_0xd4f3('0xf'));var toCsv=require(_0xd4f3('0x9'));var querystring=require(_0xd4f3('0x10'));var Papa=require(_0xd4f3('0x11'));var Redis=require(_0xd4f3('0x12'));var authService=require(_0xd4f3('0x13'));var qs=require(_0xd4f3('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4f3('0x15'));var logger=require(_0xd4f3('0x16'))('api');var utils=require(_0xd4f3('0x17'));var config=require(_0xd4f3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd4f3('0x19'))['db'];function respondWithStatusCode(_0x1e0fe6,_0x4db5b2){_0x4db5b2=_0x4db5b2||0xcc;return function(_0x4904e2){if(_0x4904e2){return _0x1e0fe6[_0xd4f3('0x1a')](_0x4db5b2);}return _0x1e0fe6[_0xd4f3('0x1b')](_0x4db5b2)['end']();};}function respondWithResult(_0x3121c3,_0x3c23e2){_0x3c23e2=_0x3c23e2||0xc8;return function(_0x154c65){if(_0x154c65){return _0x3121c3[_0xd4f3('0x1b')](_0x3c23e2)['json'](_0x154c65);}};}function respondWithFilteredResult(_0x170a0b,_0x113e7c){return function(_0xdee08d){if(_0xdee08d){var _0x25a89d=typeof _0x113e7c[_0xd4f3('0x1c')]===_0xd4f3('0x1d')&&typeof _0x113e7c[_0xd4f3('0x1e')]===_0xd4f3('0x1d');var _0x2c0292=_0xdee08d['count'];var _0x15e1c1=_0x25a89d?0x0:_0x113e7c['offset'];var _0xdaa1c1=_0x25a89d?_0xdee08d[_0xd4f3('0x1f')]:_0x113e7c[_0xd4f3('0x1c')]+_0x113e7c[_0xd4f3('0x1e')];var _0x150793;if(_0xdaa1c1>=_0x2c0292){_0xdaa1c1=_0x2c0292;_0x150793=0xc8;}else{_0x150793=0xce;}_0x170a0b[_0xd4f3('0x1b')](_0x150793);return _0x170a0b['set'](_0xd4f3('0x20'),_0x15e1c1+'-'+_0xdaa1c1+'/'+_0x2c0292)[_0xd4f3('0x21')](_0xdee08d);}return null;};}function patchUpdates(_0x437fe9){return function(_0x3f1fcf){try{jsonpatch[_0xd4f3('0x22')](_0x3f1fcf,_0x437fe9,!![]);}catch(_0x5b8e6d){return BPromise['reject'](_0x5b8e6d);}return _0x3f1fcf['save']();};}function saveUpdates(_0x4e0372,_0x59b1d0){return function(_0x158f8f){if(_0x158f8f){return _0x158f8f[_0xd4f3('0x23')](_0x4e0372)['then'](function(_0x20473f){return _0x20473f;});}return null;};}function removeEntity(_0x375885,_0x4f38cd){return function(_0x2c2715){if(_0x2c2715){return _0x2c2715[_0xd4f3('0x24')]()[_0xd4f3('0x25')](function(){var _0x2a69c0=_0x2c2715[_0xd4f3('0x26')]({'plain':!![]});var _0x31da07=_0xd4f3('0x27');return db['UserProfileResource'][_0xd4f3('0x24')]({'where':{'type':_0x31da07,'resourceId':_0x2a69c0['id']}})[_0xd4f3('0x25')](function(){return _0x2c2715;});})['then'](function(){_0x375885[_0xd4f3('0x1b')](0xcc)[_0xd4f3('0x28')]();});}};}function handleEntityNotFound(_0x15aa54,_0x2e6172){return function(_0x53ac0c){if(!_0x53ac0c){_0x15aa54['sendStatus'](0x194);}return _0x53ac0c;};}function handleError(_0x5919f3,_0xb3dc7f){_0xb3dc7f=_0xb3dc7f||0x1f4;return function(_0x560bb3){logger[_0xd4f3('0x29')](_0x560bb3['stack']);if(_0x560bb3[_0xd4f3('0x2a')]){delete _0x560bb3['name'];}_0x5919f3[_0xd4f3('0x1b')](_0xb3dc7f)[_0xd4f3('0x2b')](_0x560bb3);};}exports['index']=function(_0x258788,_0x1523f6){var _0x447b86={},_0x427f4d={},_0x3c4c49={'count':0x0,'rows':[]};var _0x1d24ec=_[_0xd4f3('0x2c')](db[_0xd4f3('0x2d')][_0xd4f3('0x2e')],function(_0x179deb){return{'name':_0x179deb[_0xd4f3('0x2f')],'type':_0x179deb[_0xd4f3('0x30')]['key']};});_0x427f4d[_0xd4f3('0x31')]=_[_0xd4f3('0x2c')](_0x1d24ec,'name');_0x427f4d[_0xd4f3('0x32')]=_[_0xd4f3('0x33')](_0x258788[_0xd4f3('0x32')]);_0x427f4d[_0xd4f3('0x34')]=_[_0xd4f3('0x35')](_0x427f4d['model'],_0x427f4d['query']);_0x447b86['attributes']=_[_0xd4f3('0x35')](_0x427f4d[_0xd4f3('0x31')],qs['fields'](_0x258788[_0xd4f3('0x32')]['fields']));_0x447b86[_0xd4f3('0x36')]=_0x447b86[_0xd4f3('0x36')][_0xd4f3('0x37')]?_0x447b86['attributes']:_0x427f4d[_0xd4f3('0x31')];if(!_0x258788['query'][_0xd4f3('0x38')](_0xd4f3('0x39'))){_0x447b86[_0xd4f3('0x1e')]=qs['limit'](_0x258788[_0xd4f3('0x32')][_0xd4f3('0x1e')]);_0x447b86[_0xd4f3('0x1c')]=qs[_0xd4f3('0x1c')](_0x258788[_0xd4f3('0x32')][_0xd4f3('0x1c')]);}_0x447b86[_0xd4f3('0x3a')]=qs[_0xd4f3('0x3b')](_0x258788[_0xd4f3('0x32')]['sort']);_0x447b86[_0xd4f3('0x3c')]=qs[_0xd4f3('0x34')](_['pick'](_0x258788['query'],_0x427f4d[_0xd4f3('0x34')]),_0x1d24ec);if(_0x258788[_0xd4f3('0x32')][_0xd4f3('0x3d')]){_0x447b86['where']=_[_0xd4f3('0x3e')](_0x447b86[_0xd4f3('0x3c')],{'$or':_[_0xd4f3('0x2c')](_0x1d24ec,function(_0x2a6445){if(_0x2a6445[_0xd4f3('0x30')]!==_0xd4f3('0x3f')){var _0x493650={};_0x493650[_0x2a6445[_0xd4f3('0x2a')]]={'$like':'%'+_0x258788[_0xd4f3('0x32')][_0xd4f3('0x3d')]+'%'};return _0x493650;}})});}_0x447b86=_[_0xd4f3('0x3e')]({},_0x447b86,_0x258788[_0xd4f3('0x40')]);var _0x27465c={'where':_0x447b86['where']};return db[_0xd4f3('0x2d')][_0xd4f3('0x1f')](_0x27465c)[_0xd4f3('0x25')](function(_0x4750a8){_0x3c4c49[_0xd4f3('0x1f')]=_0x4750a8;if(_0x258788['query'][_0xd4f3('0x41')]){_0x447b86[_0xd4f3('0x42')]=[{'all':!![]}];}return db[_0xd4f3('0x2d')][_0xd4f3('0x43')](_0x447b86);})[_0xd4f3('0x25')](function(_0x3d9a39){_0x3c4c49['rows']=_0x3d9a39;return _0x3c4c49;})[_0xd4f3('0x25')](respondWithFilteredResult(_0x1523f6,_0x447b86))['catch'](handleError(_0x1523f6,null));};exports[_0xd4f3('0x44')]=function(_0x40c017,_0x1799e4){var _0x15a1ef={'raw':![],'where':{'id':_0x40c017[_0xd4f3('0x45')]['id']}},_0x2b782d={};_0x2b782d[_0xd4f3('0x31')]=_[_0xd4f3('0x33')](db[_0xd4f3('0x2d')][_0xd4f3('0x2e')]);_0x2b782d['query']=_[_0xd4f3('0x33')](_0x40c017[_0xd4f3('0x32')]);_0x2b782d['filters']=_[_0xd4f3('0x35')](_0x2b782d[_0xd4f3('0x31')],_0x2b782d['query']);_0x15a1ef['attributes']=_[_0xd4f3('0x35')](_0x2b782d[_0xd4f3('0x31')],qs[_0xd4f3('0x46')](_0x40c017[_0xd4f3('0x32')]['fields']));_0x15a1ef[_0xd4f3('0x36')]=_0x15a1ef[_0xd4f3('0x36')][_0xd4f3('0x37')]?_0x15a1ef[_0xd4f3('0x36')]:_0x2b782d[_0xd4f3('0x31')];if(_0x40c017[_0xd4f3('0x32')][_0xd4f3('0x41')]){_0x15a1ef[_0xd4f3('0x42')]=[{'all':!![]}];}_0x15a1ef=_[_0xd4f3('0x3e')]({},_0x15a1ef,_0x40c017[_0xd4f3('0x40')]);return db[_0xd4f3('0x2d')][_0xd4f3('0x47')](_0x15a1ef)[_0xd4f3('0x25')](handleEntityNotFound(_0x1799e4,null))['then'](respondWithResult(_0x1799e4,null))[_0xd4f3('0x48')](handleError(_0x1799e4,null));};exports['create']=function(_0x3221d4,_0x327563){return db['JscriptyProject'][_0xd4f3('0x49')](_0x3221d4['body'],{})[_0xd4f3('0x25')](function(_0x1672ab){var _0x488341=_0x3221d4[_0xd4f3('0x4a')][_0xd4f3('0x26')]({'plain':!![]});if(!_0x488341)throw new Error(_0xd4f3('0x4b'));if(_0x488341['role']===_0xd4f3('0x4a')){var _0x116368=_0x1672ab[_0xd4f3('0x26')]({'plain':!![]});var _0x4b53be='Projects';return db['UserProfileSection'][_0xd4f3('0x47')]({'where':{'name':_0x4b53be,'userProfileId':_0x488341['userProfileId']},'raw':!![]})[_0xd4f3('0x25')](function(_0x19b01b){if(_0x19b01b&&_0x19b01b['autoAssociation']===0x0){return db[_0xd4f3('0x4c')][_0xd4f3('0x49')]({'name':_0x116368[_0xd4f3('0x2a')],'resourceId':_0x116368['id'],'type':_0x19b01b['name'],'sectionId':_0x19b01b['id']},{})[_0xd4f3('0x25')](function(){return _0x1672ab;});}else{return _0x1672ab;}})[_0xd4f3('0x48')](function(_0x3736cb){logger['error'](_0xd4f3('0x4d'),_0x3736cb);throw _0x3736cb;});}return _0x1672ab;})[_0xd4f3('0x25')](respondWithResult(_0x327563,0xc9))[_0xd4f3('0x48')](handleError(_0x327563,null));};exports[_0xd4f3('0x4e')]=function(_0x578764,_0x3030aa){var _0x2c6f96={'where':{'id':_0x578764[_0xd4f3('0x45')]['id']}},_0x5e49b5={};_0x5e49b5[_0xd4f3('0x31')]=_[_0xd4f3('0x33')](db[_0xd4f3('0x2d')][_0xd4f3('0x2e')]);_0x2c6f96[_0xd4f3('0x36')]=_[_0xd4f3('0x35')](_0x5e49b5['model'],qs[_0xd4f3('0x46')](_0x578764[_0xd4f3('0x32')][_0xd4f3('0x46')]));_0x2c6f96[_0xd4f3('0x36')]=_0x2c6f96['attributes'][_0xd4f3('0x37')]?_0x2c6f96[_0xd4f3('0x36')]:_0x5e49b5[_0xd4f3('0x31')];if(_0x578764[_0xd4f3('0x32')][_0xd4f3('0x41')]){_0x2c6f96[_0xd4f3('0x42')]=[{'all':!![]}];}_0x2c6f96=_[_0xd4f3('0x3e')]({},_0x2c6f96,_0x578764[_0xd4f3('0x40')]);return db[_0xd4f3('0x2d')][_0xd4f3('0x47')](_0x2c6f96)[_0xd4f3('0x25')](handleEntityNotFound(_0x3030aa,null))[_0xd4f3('0x25')](function(_0x5803af){if(_0x5803af){var _0xd66d53=_0x5803af['get']({'plain':!![]});_0xd66d53=qs[_0xd4f3('0x4f')](_0xd66d53,['id','createdAt',_0xd4f3('0x50')]);_0x578764[_0xd4f3('0x51')]=_['omit'](_0x578764[_0xd4f3('0x51')],['id','createdAt',_0xd4f3('0x50')]);return db['JscriptyProject'][_0xd4f3('0x49')](_[_0xd4f3('0x3e')](_0xd66d53,_0x578764[_0xd4f3('0x51')]),{'include':_0x578764['query']['includeAll']?[{'all':!![]}]:undefined})[_0xd4f3('0x25')](function(_0x337e15){var _0xb7da80=_0x578764[_0xd4f3('0x4a')][_0xd4f3('0x26')]({'plain':!![]});if(!_0xb7da80)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb7da80[_0xd4f3('0x52')]==='user'){var _0x2aee21=_0x337e15[_0xd4f3('0x26')]({'plain':!![]});var _0x57af32=_0xd4f3('0x27');return db[_0xd4f3('0x53')][_0xd4f3('0x47')]({'where':{'name':_0x57af32,'userProfileId':_0xb7da80[_0xd4f3('0x54')]},'raw':!![]})['then'](function(_0x2457fd){if(_0x2457fd&&_0x2457fd['autoAssociation']===0x0){return db[_0xd4f3('0x4c')]['create']({'name':_0x2aee21[_0xd4f3('0x2a')],'resourceId':_0x2aee21['id'],'type':_0x2457fd[_0xd4f3('0x2a')],'sectionId':_0x2457fd['id']},{})[_0xd4f3('0x25')](function(){return _0x337e15;});}else{return _0x337e15;}})[_0xd4f3('0x48')](function(_0x43657f){logger['error'](_0xd4f3('0x4d'),_0x43657f);throw _0x43657f;});}return _0x337e15;});}})['then'](respondWithResult(_0x3030aa,0xc9))[_0xd4f3('0x48')](handleError(_0x3030aa,null));};exports[_0xd4f3('0x23')]=function(_0x217e79,_0x2f616b){if(_0x217e79[_0xd4f3('0x51')]['id']){delete _0x217e79['body']['id'];}return db['JscriptyProject'][_0xd4f3('0x47')]({'where':{'id':_0x217e79[_0xd4f3('0x45')]['id']}})[_0xd4f3('0x25')](handleEntityNotFound(_0x2f616b,null))[_0xd4f3('0x25')](saveUpdates(_0x217e79['body'],null))[_0xd4f3('0x25')](respondWithResult(_0x2f616b,null))[_0xd4f3('0x48')](handleError(_0x2f616b,null));};exports[_0xd4f3('0x24')]=function(_0x2388e9,_0x5d08e3){return db[_0xd4f3('0x2d')]['find']({'where':{'id':_0x2388e9[_0xd4f3('0x45')]['id']}})['then'](handleEntityNotFound(_0x5d08e3,null))[_0xd4f3('0x25')](removeEntity(_0x5d08e3,null))[_0xd4f3('0x48')](handleError(_0x5d08e3,null));};exports[_0xd4f3('0x55')]=function(_0x1b54a6,_0x159236,_0x43c20a){var _0x31fe16={'raw':!![],'where':{}};var _0x110fd4={};var _0x5c4852={'count':0x0,'rows':[]};return db[_0xd4f3('0x2d')]['findOne']({'where':{'id':_0x1b54a6[_0xd4f3('0x45')]['id']}})[_0xd4f3('0x25')](handleEntityNotFound(_0x159236,null))[_0xd4f3('0x25')](function(_0xf3c536){if(_0xf3c536){_0x110fd4[_0xd4f3('0x31')]=_[_0xd4f3('0x33')](db[_0xd4f3('0x56')][_0xd4f3('0x2e')]);_0x110fd4[_0xd4f3('0x32')]=_[_0xd4f3('0x33')](_0x1b54a6[_0xd4f3('0x32')]);_0x110fd4['filters']=_[_0xd4f3('0x35')](_0x110fd4[_0xd4f3('0x31')],_0x110fd4[_0xd4f3('0x32')]);_0x31fe16[_0xd4f3('0x36')]=_[_0xd4f3('0x35')](_0x110fd4[_0xd4f3('0x31')],qs[_0xd4f3('0x46')](_0x1b54a6[_0xd4f3('0x32')][_0xd4f3('0x46')]));_0x31fe16['attributes']=_0x31fe16['attributes'][_0xd4f3('0x37')]?_0x31fe16[_0xd4f3('0x36')]:_0x110fd4['model'];if(!_0x1b54a6[_0xd4f3('0x32')][_0xd4f3('0x38')]('nolimit')){_0x31fe16[_0xd4f3('0x1e')]=qs['limit'](_0x1b54a6[_0xd4f3('0x32')][_0xd4f3('0x1e')]);_0x31fe16['offset']=qs[_0xd4f3('0x1c')](_0x1b54a6[_0xd4f3('0x32')][_0xd4f3('0x1c')]);}_0x31fe16[_0xd4f3('0x3a')]=qs[_0xd4f3('0x3b')](_0x1b54a6[_0xd4f3('0x32')][_0xd4f3('0x3b')]);_0x31fe16[_0xd4f3('0x3c')]=qs['filters'](_['pick'](_0x1b54a6[_0xd4f3('0x32')],_0x110fd4['filters']));_0x31fe16[_0xd4f3('0x3c')]['ProjectId']=_0xf3c536['id'];if(_0x1b54a6['query'][_0xd4f3('0x3d')]){_0x31fe16['where']=_[_0xd4f3('0x3e')](_0x31fe16[_0xd4f3('0x3c')],{'$or':_['map'](_0x31fe16[_0xd4f3('0x36')],function(_0x503de2){var _0x1cf373={};_0x1cf373[_0x503de2]={'$like':'%'+_0x1b54a6[_0xd4f3('0x32')][_0xd4f3('0x3d')]+'%'};return _0x1cf373;})});}_0x31fe16=_[_0xd4f3('0x3e')]({},_0x31fe16,_0x1b54a6[_0xd4f3('0x40')]);return db[_0xd4f3('0x56')][_0xd4f3('0x1f')]({'where':_0x31fe16[_0xd4f3('0x3c')]})[_0xd4f3('0x25')](function(_0x6e5cf8){_0x5c4852[_0xd4f3('0x1f')]=_0x6e5cf8;if(_0x1b54a6[_0xd4f3('0x32')][_0xd4f3('0x41')]){_0x31fe16[_0xd4f3('0x42')]=[{'all':!![]}];}return db[_0xd4f3('0x56')]['findAll'](_0x31fe16);})[_0xd4f3('0x25')](function(_0x4468d0){_0x5c4852[_0xd4f3('0x57')]=_0x4468d0;return _0x5c4852;});}})[_0xd4f3('0x25')](respondWithFilteredResult(_0x159236,_0x31fe16))[_0xd4f3('0x48')](handleError(_0x159236,null));};exports[_0xd4f3('0x58')]=function(_0x248011,_0x159f38,_0x57258c){var _0x324795={'raw':!![],'where':{}};var _0x16d749={};var _0x14ad65={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xd4f3('0x59')]({'where':{'id':_0x248011[_0xd4f3('0x45')]['id']}})['then'](handleEntityNotFound(_0x159f38,null))[_0xd4f3('0x25')](function(_0x1a7233){if(_0x1a7233){_0x16d749[_0xd4f3('0x31')]=_[_0xd4f3('0x33')](db[_0xd4f3('0x5a')][_0xd4f3('0x2e')]);_0x16d749['query']=_['keys'](_0x248011[_0xd4f3('0x32')]);_0x16d749[_0xd4f3('0x34')]=_[_0xd4f3('0x35')](_0x16d749[_0xd4f3('0x31')],_0x16d749[_0xd4f3('0x32')]);_0x324795[_0xd4f3('0x36')]=_['intersection'](_0x16d749[_0xd4f3('0x31')],qs[_0xd4f3('0x46')](_0x248011[_0xd4f3('0x32')][_0xd4f3('0x46')]));_0x324795[_0xd4f3('0x36')]=_0x324795['attributes'][_0xd4f3('0x37')]?_0x324795[_0xd4f3('0x36')]:_0x16d749[_0xd4f3('0x31')];if(!_0x248011['query']['hasOwnProperty'](_0xd4f3('0x39'))){_0x324795['limit']=qs[_0xd4f3('0x1e')](_0x248011[_0xd4f3('0x32')][_0xd4f3('0x1e')]);_0x324795['offset']=qs['offset'](_0x248011[_0xd4f3('0x32')]['offset']);}_0x324795[_0xd4f3('0x3a')]=qs[_0xd4f3('0x3b')](_0x248011[_0xd4f3('0x32')][_0xd4f3('0x3b')]);_0x324795[_0xd4f3('0x3c')]=qs[_0xd4f3('0x34')](_[_0xd4f3('0x5b')](_0x248011[_0xd4f3('0x32')],_0x16d749['filters']));_0x324795[_0xd4f3('0x3c')]['ProjectId']=_0x1a7233['id'];if(_0x248011[_0xd4f3('0x32')][_0xd4f3('0x3d')]){_0x324795[_0xd4f3('0x3c')]=_[_0xd4f3('0x3e')](_0x324795[_0xd4f3('0x3c')],{'$or':_[_0xd4f3('0x2c')](_0x324795[_0xd4f3('0x36')],function(_0x470e01){var _0x3a6f42={};_0x3a6f42[_0x470e01]={'$like':'%'+_0x248011[_0xd4f3('0x32')][_0xd4f3('0x3d')]+'%'};return _0x3a6f42;})});}_0x324795=_[_0xd4f3('0x3e')]({},_0x324795,_0x248011[_0xd4f3('0x40')]);return db[_0xd4f3('0x5a')][_0xd4f3('0x1f')]({'where':_0x324795['where']})[_0xd4f3('0x25')](function(_0x3cf7af){_0x14ad65['count']=_0x3cf7af;if(_0x248011[_0xd4f3('0x32')][_0xd4f3('0x41')]){_0x324795['include']=[{'all':!![]}];}return db[_0xd4f3('0x5a')][_0xd4f3('0x43')](_0x324795);})['then'](function(_0x162e6b){_0x14ad65[_0xd4f3('0x57')]=_0x162e6b;return _0x14ad65;});}})[_0xd4f3('0x25')](respondWithFilteredResult(_0x159f38,_0x324795))[_0xd4f3('0x48')](handleError(_0x159f38,null));};function char(_0x380c01){return _0xd4f3('0x5c')===typeof _0x380c01?String[_0xd4f3('0x5d')][_0xd4f3('0x22')](null,arguments):_0x380c01;}function needsEncapsulation(_0x2097f5){return!!_0x2097f5&&(_0x2097f5[_0xd4f3('0x5e')]()['indexOf'](char(0xd))>=0x0||_0x2097f5['toString']()[_0xd4f3('0x5f')](char(0xa))>=0x0||_0x2097f5[_0xd4f3('0x5e')]()[_0xd4f3('0x5f')](char(0x2c))>=0x0||_0x2097f5[_0xd4f3('0x5e')]()[_0xd4f3('0x5f')](char(0x22))>=0x0);}function encapsulate(_0x166ff8){var _0x351443=char(0x22),_0x4a059c='\x5c'+char(0x22),_0x4df32f=_0x166ff8[_0xd4f3('0x5e')]()[_0xd4f3('0x60')](new RegExp(_0x351443,'g'),_0x4a059c);return _0x351443+_0x4df32f+_0x351443;}exports[_0xd4f3('0x61')]=function(_0xc0d6e9,_0x39d7f2,_0x283e96){var _0x100ab5,_0x5bcb77;var _0x5bed99={'where':{'ProjectId':_0xc0d6e9['params']['id']}};if(_0xc0d6e9['query']['startTime']){_0x5bed99['where'][_0xd4f3('0x62')]=JSON['parse'](_0xc0d6e9[_0xd4f3('0x32')][_0xd4f3('0x63')]);}return db[_0xd4f3('0x56')][_0xd4f3('0x43')](_0x5bed99)['then'](handleEntityNotFound(_0x39d7f2,null))['then'](function(_0x2d7204){if(_0x2d7204){_0x100ab5=_0x2d7204;return db[_0xd4f3('0x64')][_0xd4f3('0x43')]({'where':{'SessionId':{'$in':_['map'](_0x100ab5,'id')},'ProjectId':_0xc0d6e9[_0xd4f3('0x45')]['id']},'order':_0xd4f3('0x65')});}})[_0xd4f3('0x25')](handleEntityNotFound(_0x39d7f2,null))['then'](function(_0x1ba483){if(_0x1ba483){_0x5bcb77=_0x1ba483;var _0x1f9236={};for(var _0x9b20d2=0x0,_0x33cf67=_0x5bcb77['length'];_0x9b20d2<_0x33cf67;_0x9b20d2++){if(!_0x1f9236['hasOwnProperty'](_0x5bcb77[_0x9b20d2][_0xd4f3('0x66')])){_0x1f9236[_0x5bcb77[_0x9b20d2]['questionId']]=needsEncapsulation(_0x5bcb77[_0x9b20d2][_0xd4f3('0x67')])?encapsulate(_0x5bcb77[_0x9b20d2][_0xd4f3('0x67')]):_0x5bcb77[_0x9b20d2][_0xd4f3('0x67')];}}var _0x457469=[],_0x4013e3={};for(var _0x27d09f=0x0,_0x4f116a=_0x100ab5[_0xd4f3('0x37')];_0x27d09f<_0x4f116a;_0x27d09f++){_0x4013e3={'ProjectId':_0xc0d6e9[_0xd4f3('0x45')]['id'],'SessionId':_0x100ab5[_0x27d09f]['id'],'StartTime':moment(_0x100ab5[_0x27d09f][_0xd4f3('0x62')])[_0xd4f3('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x584b7f=0x0,_0x150271=_0x5bcb77[_0xd4f3('0x37')];_0x584b7f<_0x150271;_0x584b7f++){if(_0x5bcb77[_0x584b7f]['SessionId']==_0x100ab5[_0x27d09f]['id']&&_0x1f9236[_0xd4f3('0x38')](_0x5bcb77[_0x584b7f][_0xd4f3('0x66')])){_0x4013e3[_0x1f9236[_0x5bcb77[_0x584b7f][_0xd4f3('0x66')]]]=_0x5bcb77[_0x584b7f][_0xd4f3('0x69')];}}for(var _0x100379 in _0x1f9236){if(!_0x4013e3[_0xd4f3('0x38')](_0x1f9236[_0x100379])){_0x4013e3[_0x1f9236[_0x100379]]=null;}}_0x457469[_0xd4f3('0x6a')](_0x4013e3);}return _0x457469;}})['then'](function(_0x3be732){if(!_[_0xd4f3('0x6b')](_0x3be732)){var _0x4e5063=toCsv(_0x3be732);var _0x442fbd=Date[_0xd4f3('0x6c')]();fs['writeFileSync'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0xc0d6e9[_0xd4f3('0x45')]['id'],_0x442fbd),_0x4e5063);_0x39d7f2[_0xd4f3('0x6d')](_0xd4f3('0x6e'),_0xd4f3('0x6f')+util[_0xd4f3('0x68')](_0xd4f3('0x70'),_0xc0d6e9[_0xd4f3('0x45')]['id'],_0x442fbd));_0x39d7f2[_0xd4f3('0x6d')](_0xd4f3('0x71'),_0xd4f3('0x72'));return _0x39d7f2[_0xd4f3('0x73')](util['format'](_0xd4f3('0x74'),_0xc0d6e9[_0xd4f3('0x45')]['id'],_0x442fbd));}else{return _0x39d7f2[_0xd4f3('0x1a')](0xcc);}})[_0xd4f3('0x48')](handleError(_0x39d7f2,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 3346c7e..4cebd85 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 _0xd6d6=['path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x356896,_0x50b8b2){var _0x5a1207=function(_0x20b02c){while(--_0x20b02c){_0x356896['push'](_0x356896['shift']());}};_0x5a1207(++_0x50b8b2);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x34290b,_0x149d03){_0x34290b=_0x34290b-0x0;var _0x4147d7=_0xd6d6[_0x34290b];return _0x4147d7;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0207=['JscriptyProject','jscripty_projects','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','define'];(function(_0x3ae1c8,_0x4f1c21){var _0x5a2621=function(_0x4d9dec){while(--_0x4d9dec){_0x3ae1c8['push'](_0x3ae1c8['shift']());}};_0x5a2621(++_0x4f1c21);}(_0x0207,0x162));var _0x7020=function(_0x4ab87f,_0x2589fd){_0x4ab87f=_0x4ab87f-0x0;var _0x573341=_0x0207[_0x4ab87f];return _0x573341;};'use strict';var _=require('lodash');var util=require(_0x7020('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7020('0x1'));var BPromise=require(_0x7020('0x2'));var rp=require(_0x7020('0x3'));var fs=require('fs');var path=require(_0x7020('0x4'));var rimraf=require(_0x7020('0x5'));var config=require(_0x7020('0x6'));var attributes=require(_0x7020('0x7'));module['exports']=function(_0x5074d7,_0x38c320){return _0x5074d7[_0x7020('0x8')](_0x7020('0x9'),attributes,{'tableName':_0x7020('0xa'),'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 0884670..9549a1b 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 _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x421256,_0x3bf022){var _0x5ccfe8=function(_0x19ab87){while(--_0x19ab87){_0x421256['push'](_0x421256['shift']());}};_0x5ccfe8(++_0x3bf022);}(_0x70e0,0x17b));var _0x070e=function(_0x225673,_0x527b21){_0x225673=_0x225673-0x0;var _0xb9d9f3=_0x70e0[_0x225673];return _0xb9d9f3;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x2fe2a5,_0x4cc3dd){var _0x1578b7=function(_0xfe4ab0){while(--_0xfe4ab0){_0x2fe2a5['push'](_0x2fe2a5['shift']());}};_0x1578b7(++_0x4cc3dd);}(_0xaa88,0x137));var _0x8aa8=function(_0x149083,_0x4047b6){_0x149083=_0x149083-0x0;var _0x4dc74e=_0xaa88[_0x149083];return _0x4dc74e;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index d6bee01..6bb0243 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 _0x12e5=['isAuthenticated','/describe','describe','/:id','show','create','put','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get'];(function(_0x5e9906,_0x61ae75){var _0x2b8c25=function(_0x3e1789){while(--_0x3e1789){_0x5e9906['push'](_0x5e9906['shift']());}};_0x2b8c25(++_0x61ae75);}(_0x12e5,0xd1));var _0x512e=function(_0x23da4c,_0x25a58f){_0x23da4c=_0x23da4c-0x0;var _0x359022=_0x12e5[_0x23da4c];return _0x359022;};'use strict';var multer=require(_0x512e('0x0'));var util=require(_0x512e('0x1'));var path=require('path');var timeout=require(_0x512e('0x2'));var express=require(_0x512e('0x3'));var router=express[_0x512e('0x4')]();var fs_extra=require(_0x512e('0x5'));var auth=require(_0x512e('0x6'));var interaction=require(_0x512e('0x7'));var config=require(_0x512e('0x8'));var controller=require(_0x512e('0x9'));router[_0x512e('0xa')]('/',auth[_0x512e('0xb')](),controller['index']);router[_0x512e('0xa')](_0x512e('0xc'),auth[_0x512e('0xb')](),controller[_0x512e('0xd')]);router[_0x512e('0xa')](_0x512e('0xe'),auth[_0x512e('0xb')](),controller[_0x512e('0xf')]);router['post']('/',auth[_0x512e('0xb')](),controller[_0x512e('0x10')]);router[_0x512e('0x11')]('/:id',auth[_0x512e('0xb')](),controller['update']);router['delete'](_0x512e('0xe'),auth[_0x512e('0xb')](),controller[_0x512e('0x12')]);module[_0x512e('0x13')]=router; \ No newline at end of file +var _0x3adc=['../../components/auth/service','isAuthenticated','index','get','describe','show','create','put','update','delete','/:id','destroy','exports','multer','util','express','Router','fs-extra'];(function(_0x5e8763,_0x558211){var _0x286b08=function(_0x4ceb40){while(--_0x4ceb40){_0x5e8763['push'](_0x5e8763['shift']());}};_0x286b08(++_0x558211);}(_0x3adc,0x12d));var _0xc3ad=function(_0x633a64,_0x546fe2){_0x633a64=_0x633a64-0x0;var _0x3f60e7=_0x3adc[_0x633a64];return _0x3f60e7;};'use strict';var multer=require(_0xc3ad('0x0'));var util=require(_0xc3ad('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc3ad('0x2'));var router=express[_0xc3ad('0x3')]();var fs_extra=require(_0xc3ad('0x4'));var auth=require(_0xc3ad('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0xc3ad('0x6')](),controller[_0xc3ad('0x7')]);router[_0xc3ad('0x8')]('/describe',auth[_0xc3ad('0x6')](),controller[_0xc3ad('0x9')]);router[_0xc3ad('0x8')]('/:id',auth[_0xc3ad('0x6')](),controller[_0xc3ad('0xa')]);router['post']('/',auth[_0xc3ad('0x6')](),controller[_0xc3ad('0xb')]);router[_0xc3ad('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xc3ad('0xd')]);router[_0xc3ad('0xe')](_0xc3ad('0xf'),auth['isAuthenticated'](),controller[_0xc3ad('0x10')]);module[_0xc3ad('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index e1cae9a..54e6bc1 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(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7a54,0x106));var _0x47a5=function(_0x3c4951,_0x15fdb7){_0x3c4951=_0x3c4951-0x0;var _0x10ff3e=_0x7a54[_0x3c4951];return _0x10ff3e;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7a54,0x106));var _0x47a5=function(_0x8a7493,_0x215fa2){_0x8a7493=_0x8a7493-0x0;var _0x47b53d=_0x7a54[_0x8a7493];return _0x47b53d;};'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 dbfee1e..47854a0 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 _0x9f53=['squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','then','destroy','error','name','send','index','map','JscriptyQuestionReport','fieldName','model','query','keys','filters','intersection','fields','attributes','length','limit','order','sort','pick','filter','where','merge','type','options','includeAll','catch','params','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9f53,0xfb));var _0x39f5=function(_0x192359,_0x59a2da){_0x192359=_0x192359-0x0;var _0x4ae7d1=_0x9f53[_0x192359];return _0x4ae7d1;};'use strict';var emlformat=require(_0x39f5('0x0'));var rimraf=require(_0x39f5('0x1'));var zipdir=require(_0x39f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x39f5('0x3'));var moment=require(_0x39f5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x39f5('0x5'));var util=require(_0x39f5('0x6'));var path=require(_0x39f5('0x7'));var sox=require(_0x39f5('0x8'));var csv=require(_0x39f5('0x9'));var ejs=require(_0x39f5('0xa'));var fs=require('fs');var fs_extra=require(_0x39f5('0xb'));var _=require(_0x39f5('0xc'));var squel=require(_0x39f5('0xd'));var crypto=require('crypto');var jsforce=require(_0x39f5('0xe'));var deskjs=require(_0x39f5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x39f5('0x10'));var qs=require(_0x39f5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x39f5('0x12'));var logger=require(_0x39f5('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x39f5('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26450e,_0x46f793){_0x46f793=_0x46f793||0xcc;return function(_0x19f6a0){if(_0x19f6a0){return _0x26450e[_0x39f5('0x15')](_0x46f793);}return _0x26450e[_0x39f5('0x16')](_0x46f793)[_0x39f5('0x17')]();};}function respondWithResult(_0x5255c9,_0x4ed374){_0x4ed374=_0x4ed374||0xc8;return function(_0x35e8a4){if(_0x35e8a4){return _0x5255c9['status'](_0x4ed374)['json'](_0x35e8a4);}};}function respondWithFilteredResult(_0x387500,_0x515e5b){return function(_0x4adec3){if(_0x4adec3){var _0x55d708=typeof _0x515e5b[_0x39f5('0x18')]==='undefined'&&typeof _0x515e5b['limit']===_0x39f5('0x19');var _0x224f61=_0x4adec3[_0x39f5('0x1a')];var _0x124c79=_0x55d708?0x0:_0x515e5b[_0x39f5('0x18')];var _0x3fb103=_0x55d708?_0x4adec3[_0x39f5('0x1a')]:_0x515e5b['offset']+_0x515e5b['limit'];var _0x29c93a;if(_0x3fb103>=_0x224f61){_0x3fb103=_0x224f61;_0x29c93a=0xc8;}else{_0x29c93a=0xce;}_0x387500['status'](_0x29c93a);return _0x387500[_0x39f5('0x1b')](_0x39f5('0x1c'),_0x124c79+'-'+_0x3fb103+'/'+_0x224f61)[_0x39f5('0x1d')](_0x4adec3);}return null;};}function patchUpdates(_0x58e524){return function(_0x14f950){try{jsonpatch[_0x39f5('0x1e')](_0x14f950,_0x58e524,!![]);}catch(_0x2624fd){return BPromise['reject'](_0x2624fd);}return _0x14f950['save']();};}function saveUpdates(_0x387f8c,_0x36849b){return function(_0x51d83a){if(_0x51d83a){return _0x51d83a['update'](_0x387f8c)[_0x39f5('0x1f')](function(_0x36a9ca){return _0x36a9ca;});}return null;};}function removeEntity(_0x2b1181,_0x2e20ac){return function(_0x177caa){if(_0x177caa){return _0x177caa[_0x39f5('0x20')]()[_0x39f5('0x1f')](function(){_0x2b1181[_0x39f5('0x16')](0xcc)[_0x39f5('0x17')]();});}};}function handleEntityNotFound(_0x1f3933,_0x15fd7e){return function(_0x497ba9){if(!_0x497ba9){_0x1f3933[_0x39f5('0x15')](0x194);}return _0x497ba9;};}function handleError(_0x52acfa,_0x5e3a2f){_0x5e3a2f=_0x5e3a2f||0x1f4;return function(_0x46b90a){logger[_0x39f5('0x21')](_0x46b90a['stack']);if(_0x46b90a['name']){delete _0x46b90a[_0x39f5('0x22')];}_0x52acfa['status'](_0x5e3a2f)[_0x39f5('0x23')](_0x46b90a);};}exports[_0x39f5('0x24')]=function(_0x4803c2,_0x41c3c6){var _0x3260b4={},_0x5438fa={},_0xa207e0={'count':0x0,'rows':[]};var _0x4a226e=_[_0x39f5('0x25')](db[_0x39f5('0x26')]['rawAttributes'],function(_0x17c1f8){return{'name':_0x17c1f8[_0x39f5('0x27')],'type':_0x17c1f8['type']['key']};});_0x5438fa[_0x39f5('0x28')]=_[_0x39f5('0x25')](_0x4a226e,'name');_0x5438fa[_0x39f5('0x29')]=_[_0x39f5('0x2a')](_0x4803c2[_0x39f5('0x29')]);_0x5438fa[_0x39f5('0x2b')]=_[_0x39f5('0x2c')](_0x5438fa[_0x39f5('0x28')],_0x5438fa[_0x39f5('0x29')]);_0x3260b4['attributes']=_[_0x39f5('0x2c')](_0x5438fa['model'],qs['fields'](_0x4803c2[_0x39f5('0x29')][_0x39f5('0x2d')]));_0x3260b4[_0x39f5('0x2e')]=_0x3260b4[_0x39f5('0x2e')][_0x39f5('0x2f')]?_0x3260b4[_0x39f5('0x2e')]:_0x5438fa[_0x39f5('0x28')];if(!_0x4803c2[_0x39f5('0x29')]['hasOwnProperty']('nolimit')){_0x3260b4[_0x39f5('0x30')]=qs[_0x39f5('0x30')](_0x4803c2['query'][_0x39f5('0x30')]);_0x3260b4[_0x39f5('0x18')]=qs['offset'](_0x4803c2['query'][_0x39f5('0x18')]);}_0x3260b4[_0x39f5('0x31')]=qs[_0x39f5('0x32')](_0x4803c2['query'][_0x39f5('0x32')]);_0x3260b4['where']=qs[_0x39f5('0x2b')](_[_0x39f5('0x33')](_0x4803c2[_0x39f5('0x29')],_0x5438fa[_0x39f5('0x2b')]),_0x4a226e);if(_0x4803c2[_0x39f5('0x29')][_0x39f5('0x34')]){_0x3260b4[_0x39f5('0x35')]=_[_0x39f5('0x36')](_0x3260b4[_0x39f5('0x35')],{'$or':_[_0x39f5('0x25')](_0x4a226e,function(_0x37e27c){if(_0x37e27c[_0x39f5('0x37')]!=='VIRTUAL'){var _0x2544a0={};_0x2544a0[_0x37e27c['name']]={'$like':'%'+_0x4803c2['query'][_0x39f5('0x34')]+'%'};return _0x2544a0;}})});}_0x3260b4=_['merge']({},_0x3260b4,_0x4803c2[_0x39f5('0x38')]);var _0x989b3f={'where':_0x3260b4['where']};return db[_0x39f5('0x26')]['count'](_0x989b3f)[_0x39f5('0x1f')](function(_0x2a8098){_0xa207e0[_0x39f5('0x1a')]=_0x2a8098;if(_0x4803c2[_0x39f5('0x29')][_0x39f5('0x39')]){_0x3260b4['include']=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x3260b4);})[_0x39f5('0x1f')](function(_0x24a82c){_0xa207e0['rows']=_0x24a82c;return _0xa207e0;})[_0x39f5('0x1f')](respondWithFilteredResult(_0x41c3c6,_0x3260b4))[_0x39f5('0x3a')](handleError(_0x41c3c6,null));};exports['show']=function(_0x2355a0,_0x2957c4){var _0x523fc0={'raw':!![],'where':{'id':_0x2355a0[_0x39f5('0x3b')]['id']}},_0x3f6688={};_0x3f6688['model']=_[_0x39f5('0x2a')](db[_0x39f5('0x26')]['rawAttributes']);_0x3f6688[_0x39f5('0x29')]=_['keys'](_0x2355a0[_0x39f5('0x29')]);_0x3f6688['filters']=_[_0x39f5('0x2c')](_0x3f6688[_0x39f5('0x28')],_0x3f6688['query']);_0x523fc0[_0x39f5('0x2e')]=_[_0x39f5('0x2c')](_0x3f6688[_0x39f5('0x28')],qs['fields'](_0x2355a0[_0x39f5('0x29')]['fields']));_0x523fc0[_0x39f5('0x2e')]=_0x523fc0[_0x39f5('0x2e')]['length']?_0x523fc0[_0x39f5('0x2e')]:_0x3f6688[_0x39f5('0x28')];if(_0x2355a0[_0x39f5('0x29')][_0x39f5('0x39')]){_0x523fc0[_0x39f5('0x3c')]=[{'all':!![]}];}_0x523fc0=_[_0x39f5('0x36')]({},_0x523fc0,_0x2355a0[_0x39f5('0x38')]);return db[_0x39f5('0x26')][_0x39f5('0x3d')](_0x523fc0)[_0x39f5('0x1f')](handleEntityNotFound(_0x2957c4,null))[_0x39f5('0x1f')](respondWithResult(_0x2957c4,null))[_0x39f5('0x3a')](handleError(_0x2957c4,null));};exports['create']=function(_0x27d8be,_0x581485){return db[_0x39f5('0x26')][_0x39f5('0x3e')](_0x27d8be[_0x39f5('0x3f')],{})[_0x39f5('0x1f')](respondWithResult(_0x581485,0xc9))[_0x39f5('0x3a')](handleError(_0x581485,null));};exports[_0x39f5('0x40')]=function(_0x15edeb,_0x25b119){if(_0x15edeb[_0x39f5('0x3f')]['id']){delete _0x15edeb[_0x39f5('0x3f')]['id'];}return db[_0x39f5('0x26')][_0x39f5('0x3d')]({'where':{'id':_0x15edeb['params']['id']}})[_0x39f5('0x1f')](handleEntityNotFound(_0x25b119,null))[_0x39f5('0x1f')](saveUpdates(_0x15edeb[_0x39f5('0x3f')],null))[_0x39f5('0x1f')](respondWithResult(_0x25b119,null))[_0x39f5('0x3a')](handleError(_0x25b119,null));};exports[_0x39f5('0x20')]=function(_0x3adef3,_0x1ed4a7){return db[_0x39f5('0x26')][_0x39f5('0x3d')]({'where':{'id':_0x3adef3[_0x39f5('0x3b')]['id']}})[_0x39f5('0x1f')](handleEntityNotFound(_0x1ed4a7,null))[_0x39f5('0x1f')](removeEntity(_0x1ed4a7,null))[_0x39f5('0x3a')](handleError(_0x1ed4a7,null));};exports[_0x39f5('0x41')]=function(_0x4738ff,_0x36e781){return db[_0x39f5('0x26')][_0x39f5('0x41')]()[_0x39f5('0x1f')](respondWithResult(_0x36e781,null))[_0x39f5('0x3a')](handleError(_0x36e781,null));}; \ No newline at end of file +var _0xe75a=['../../config/environment','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x289188,_0x58809f){var _0x2f8579=function(_0x4cf129){while(--_0x4cf129){_0x289188['push'](_0x289188['shift']());}};_0x2f8579(++_0x58809f);}(_0xe75a,0x161));var _0xae75=function(_0x446e61,_0x27e680){_0x446e61=_0x446e61-0x0;var _0x4160a8=_0xe75a[_0x446e61];return _0x4160a8;};'use strict';var emlformat=require(_0xae75('0x0'));var rimraf=require(_0xae75('0x1'));var zipdir=require(_0xae75('0x2'));var jsonpatch=require(_0xae75('0x3'));var rp=require(_0xae75('0x4'));var moment=require(_0xae75('0x5'));var BPromise=require(_0xae75('0x6'));var Mustache=require(_0xae75('0x7'));var util=require(_0xae75('0x8'));var path=require('path');var sox=require(_0xae75('0x9'));var csv=require(_0xae75('0xa'));var ejs=require(_0xae75('0xb'));var fs=require('fs');var fs_extra=require(_0xae75('0xc'));var _=require(_0xae75('0xd'));var squel=require(_0xae75('0xe'));var crypto=require(_0xae75('0xf'));var jsforce=require(_0xae75('0x10'));var deskjs=require(_0xae75('0x11'));var toCsv=require(_0xae75('0xa'));var querystring=require(_0xae75('0x12'));var Papa=require(_0xae75('0x13'));var Redis=require(_0xae75('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xae75('0x15'));var as=require(_0xae75('0x16'));var hardwareService=require(_0xae75('0x17'));var logger=require(_0xae75('0x18'))(_0xae75('0x19'));var utils=require(_0xae75('0x1a'));var config=require(_0xae75('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xae75('0x1c'))['db'];function respondWithStatusCode(_0x215df5,_0x3680e4){_0x3680e4=_0x3680e4||0xcc;return function(_0x47b8fe){if(_0x47b8fe){return _0x215df5[_0xae75('0x1d')](_0x3680e4);}return _0x215df5[_0xae75('0x1e')](_0x3680e4)[_0xae75('0x1f')]();};}function respondWithResult(_0x5d7e63,_0x41a09b){_0x41a09b=_0x41a09b||0xc8;return function(_0x2f2107){if(_0x2f2107){return _0x5d7e63['status'](_0x41a09b)['json'](_0x2f2107);}};}function respondWithFilteredResult(_0x238238,_0x2554bb){return function(_0x34b0b4){if(_0x34b0b4){var _0x2bd786=typeof _0x2554bb['offset']===_0xae75('0x20')&&typeof _0x2554bb[_0xae75('0x21')]===_0xae75('0x20');var _0x53a596=_0x34b0b4['count'];var _0x47ebbf=_0x2bd786?0x0:_0x2554bb[_0xae75('0x22')];var _0x8cd9ce=_0x2bd786?_0x34b0b4[_0xae75('0x23')]:_0x2554bb[_0xae75('0x22')]+_0x2554bb['limit'];var _0x216bf3;if(_0x8cd9ce>=_0x53a596){_0x8cd9ce=_0x53a596;_0x216bf3=0xc8;}else{_0x216bf3=0xce;}_0x238238[_0xae75('0x1e')](_0x216bf3);return _0x238238['set'](_0xae75('0x24'),_0x47ebbf+'-'+_0x8cd9ce+'/'+_0x53a596)[_0xae75('0x25')](_0x34b0b4);}return null;};}function patchUpdates(_0x2cbb12){return function(_0x5cfb4b){try{jsonpatch[_0xae75('0x26')](_0x5cfb4b,_0x2cbb12,!![]);}catch(_0x614de2){return BPromise[_0xae75('0x27')](_0x614de2);}return _0x5cfb4b['save']();};}function saveUpdates(_0x522de8,_0x247319){return function(_0x3d312f){if(_0x3d312f){return _0x3d312f[_0xae75('0x28')](_0x522de8)[_0xae75('0x29')](function(_0x3bbc89){return _0x3bbc89;});}return null;};}function removeEntity(_0x2c1619,_0x23de29){return function(_0x30d070){if(_0x30d070){return _0x30d070[_0xae75('0x2a')]()[_0xae75('0x29')](function(){_0x2c1619[_0xae75('0x1e')](0xcc)[_0xae75('0x1f')]();});}};}function handleEntityNotFound(_0x3c1138,_0x58cb2e){return function(_0x2b6e28){if(!_0x2b6e28){_0x3c1138['sendStatus'](0x194);}return _0x2b6e28;};}function handleError(_0x228c53,_0x113baa){_0x113baa=_0x113baa||0x1f4;return function(_0x3c55ac){logger['error'](_0x3c55ac[_0xae75('0x2b')]);if(_0x3c55ac[_0xae75('0x2c')]){delete _0x3c55ac[_0xae75('0x2c')];}_0x228c53[_0xae75('0x1e')](_0x113baa)[_0xae75('0x2d')](_0x3c55ac);};}exports[_0xae75('0x2e')]=function(_0x2d0aa5,_0x359e4){var _0xdddb93={},_0x44c825={},_0x36c424={'count':0x0,'rows':[]};var _0x197c77=_[_0xae75('0x2f')](db[_0xae75('0x30')][_0xae75('0x31')],function(_0x25b471){return{'name':_0x25b471['fieldName'],'type':_0x25b471['type'][_0xae75('0x32')]};});_0x44c825[_0xae75('0x33')]=_['map'](_0x197c77,_0xae75('0x2c'));_0x44c825[_0xae75('0x34')]=_[_0xae75('0x35')](_0x2d0aa5[_0xae75('0x34')]);_0x44c825[_0xae75('0x36')]=_[_0xae75('0x37')](_0x44c825['model'],_0x44c825[_0xae75('0x34')]);_0xdddb93[_0xae75('0x38')]=_[_0xae75('0x37')](_0x44c825[_0xae75('0x33')],qs[_0xae75('0x39')](_0x2d0aa5[_0xae75('0x34')]['fields']));_0xdddb93[_0xae75('0x38')]=_0xdddb93[_0xae75('0x38')][_0xae75('0x3a')]?_0xdddb93['attributes']:_0x44c825['model'];if(!_0x2d0aa5[_0xae75('0x34')][_0xae75('0x3b')]('nolimit')){_0xdddb93[_0xae75('0x21')]=qs['limit'](_0x2d0aa5[_0xae75('0x34')][_0xae75('0x21')]);_0xdddb93[_0xae75('0x22')]=qs[_0xae75('0x22')](_0x2d0aa5[_0xae75('0x34')]['offset']);}_0xdddb93[_0xae75('0x3c')]=qs['sort'](_0x2d0aa5['query']['sort']);_0xdddb93[_0xae75('0x3d')]=qs[_0xae75('0x36')](_[_0xae75('0x3e')](_0x2d0aa5[_0xae75('0x34')],_0x44c825[_0xae75('0x36')]),_0x197c77);if(_0x2d0aa5[_0xae75('0x34')][_0xae75('0x3f')]){_0xdddb93[_0xae75('0x3d')]=_[_0xae75('0x40')](_0xdddb93[_0xae75('0x3d')],{'$or':_[_0xae75('0x2f')](_0x197c77,function(_0xeba610){if(_0xeba610['type']!==_0xae75('0x41')){var _0x1070b2={};_0x1070b2[_0xeba610[_0xae75('0x2c')]]={'$like':'%'+_0x2d0aa5['query'][_0xae75('0x3f')]+'%'};return _0x1070b2;}})});}_0xdddb93=_[_0xae75('0x40')]({},_0xdddb93,_0x2d0aa5[_0xae75('0x42')]);var _0x1e8d49={'where':_0xdddb93['where']};return db[_0xae75('0x30')][_0xae75('0x23')](_0x1e8d49)[_0xae75('0x29')](function(_0x4503e8){_0x36c424[_0xae75('0x23')]=_0x4503e8;if(_0x2d0aa5[_0xae75('0x34')][_0xae75('0x43')]){_0xdddb93[_0xae75('0x44')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0xdddb93);})[_0xae75('0x29')](function(_0xd8954b){_0x36c424[_0xae75('0x45')]=_0xd8954b;return _0x36c424;})[_0xae75('0x29')](respondWithFilteredResult(_0x359e4,_0xdddb93))[_0xae75('0x46')](handleError(_0x359e4,null));};exports[_0xae75('0x47')]=function(_0x1423d4,_0x304181){var _0x1d47eb={'raw':!![],'where':{'id':_0x1423d4['params']['id']}},_0x4e344a={};_0x4e344a[_0xae75('0x33')]=_['keys'](db[_0xae75('0x30')][_0xae75('0x31')]);_0x4e344a[_0xae75('0x34')]=_[_0xae75('0x35')](_0x1423d4['query']);_0x4e344a['filters']=_[_0xae75('0x37')](_0x4e344a['model'],_0x4e344a[_0xae75('0x34')]);_0x1d47eb[_0xae75('0x38')]=_[_0xae75('0x37')](_0x4e344a[_0xae75('0x33')],qs[_0xae75('0x39')](_0x1423d4[_0xae75('0x34')]['fields']));_0x1d47eb[_0xae75('0x38')]=_0x1d47eb[_0xae75('0x38')]['length']?_0x1d47eb[_0xae75('0x38')]:_0x4e344a[_0xae75('0x33')];if(_0x1423d4[_0xae75('0x34')][_0xae75('0x43')]){_0x1d47eb[_0xae75('0x44')]=[{'all':!![]}];}_0x1d47eb=_[_0xae75('0x40')]({},_0x1d47eb,_0x1423d4['options']);return db[_0xae75('0x30')][_0xae75('0x48')](_0x1d47eb)['then'](handleEntityNotFound(_0x304181,null))[_0xae75('0x29')](respondWithResult(_0x304181,null))[_0xae75('0x46')](handleError(_0x304181,null));};exports[_0xae75('0x49')]=function(_0xc6b0a4,_0x2b379d){return db[_0xae75('0x30')][_0xae75('0x49')](_0xc6b0a4[_0xae75('0x4a')],{})['then'](respondWithResult(_0x2b379d,0xc9))[_0xae75('0x46')](handleError(_0x2b379d,null));};exports[_0xae75('0x28')]=function(_0x1a64cb,_0x113b70){if(_0x1a64cb[_0xae75('0x4a')]['id']){delete _0x1a64cb[_0xae75('0x4a')]['id'];}return db[_0xae75('0x30')][_0xae75('0x48')]({'where':{'id':_0x1a64cb[_0xae75('0x4b')]['id']}})[_0xae75('0x29')](handleEntityNotFound(_0x113b70,null))[_0xae75('0x29')](saveUpdates(_0x1a64cb[_0xae75('0x4a')],null))['then'](respondWithResult(_0x113b70,null))[_0xae75('0x46')](handleError(_0x113b70,null));};exports['destroy']=function(_0x2bbbad,_0x1ccdfd){return db[_0xae75('0x30')][_0xae75('0x48')]({'where':{'id':_0x2bbbad[_0xae75('0x4b')]['id']}})[_0xae75('0x29')](handleEntityNotFound(_0x1ccdfd,null))[_0xae75('0x29')](removeEntity(_0x1ccdfd,null))[_0xae75('0x46')](handleError(_0x1ccdfd,null));};exports['describe']=function(_0x215153,_0x1e1d60){return db[_0xae75('0x30')]['describe']()[_0xae75('0x29')](respondWithResult(_0x1e1d60,null))[_0xae75('0x46')](handleError(_0x1e1d60,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index d185264..e139486 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 _0xabba=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','lodash','util'];(function(_0x310abd,_0x31f749){var _0xafa4f8=function(_0x477029){while(--_0x477029){_0x310abd['push'](_0x310abd['shift']());}};_0xafa4f8(++_0x31f749);}(_0xabba,0x166));var _0xaabb=function(_0x2d55d5,_0x51e668){_0x2d55d5=_0x2d55d5-0x0;var _0x3ea899=_0xabba[_0x2d55d5];return _0x3ea899;};'use strict';var _=require(_0xaabb('0x0'));var util=require(_0xaabb('0x1'));var logger=require(_0xaabb('0x2'))(_0xaabb('0x3'));var moment=require(_0xaabb('0x4'));var BPromise=require('bluebird');var rp=require(_0xaabb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaabb('0x6'));var config=require(_0xaabb('0x7'));var attributes=require(_0xaabb('0x8'));module[_0xaabb('0x9')]=function(_0x47efa5,_0x3a1c32){return _0x47efa5[_0xaabb('0xa')](_0xaabb('0xb'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x078c=['JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define'];(function(_0x2d03cd,_0x2379c2){var _0x1b59ab=function(_0x1a7880){while(--_0x1a7880){_0x2d03cd['push'](_0x2d03cd['shift']());}};_0x1b59ab(++_0x2379c2);}(_0x078c,0xec));var _0xc078=function(_0x1e9d62,_0x25bb8e){_0x1e9d62=_0x1e9d62-0x0;var _0x56c490=_0x078c[_0x1e9d62];return _0x56c490;};'use strict';var _=require(_0xc078('0x0'));var util=require('util');var logger=require(_0xc078('0x1'))(_0xc078('0x2'));var moment=require('moment');var BPromise=require(_0xc078('0x3'));var rp=require(_0xc078('0x4'));var fs=require('fs');var path=require(_0xc078('0x5'));var rimraf=require(_0xc078('0x6'));var config=require(_0xc078('0x7'));var attributes=require(_0xc078('0x8'));module[_0xc078('0x9')]=function(_0x4e2047,_0xa4ffac){return _0x4e2047[_0xc078('0xa')](_0xc078('0xb'),attributes,{'tableName':_0xc078('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 0568185..6a19d50 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 _0x8bef=['JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x55d830,_0x45a1b0){var _0x39ee37=function(_0x4314c9){while(--_0x4314c9){_0x55d830['push'](_0x55d830['shift']());}};_0x39ee37(++_0x45a1b0);}(_0x8bef,0x66));var _0xf8be=function(_0x5fb0f1,_0x18deb0){_0x5fb0f1=_0x5fb0f1-0x0;var _0x617eaf=_0x8bef[_0x5fb0f1];return _0x617eaf;};'use strict';var _=require(_0xf8be('0x0'));var util=require(_0xf8be('0x1'));var moment=require(_0xf8be('0x2'));var BPromise=require(_0xf8be('0x3'));var rs=require(_0xf8be('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf8be('0x5'))['db'];var utils=require(_0xf8be('0x6'));var logger=require(_0xf8be('0x7'))(_0xf8be('0x8'));var config=require(_0xf8be('0x9'));var jayson=require(_0xf8be('0xa'));var client=jayson[_0xf8be('0xb')][_0xf8be('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x226cb8,_0x37cb93,_0x5a53f9){return new BPromise(function(_0x3ff5d2,_0x21f521){return client[_0xf8be('0xd')](_0x226cb8,_0x5a53f9)['then'](function(_0x5ec699){logger[_0xf8be('0xe')](_0xf8be('0xf'),_0x37cb93,_0xf8be('0x10'));logger[_0xf8be('0x11')](_0xf8be('0x12'),_0x37cb93,'request\x20sent',JSON[_0xf8be('0x13')](_0x5ec699));if(_0x5ec699[_0xf8be('0x14')]){if(_0x5ec699[_0xf8be('0x14')]['code']===0x1f4){logger['error'](_0xf8be('0xf'),_0x37cb93,_0x5ec699[_0xf8be('0x14')][_0xf8be('0x15')]);return _0x21f521(_0x5ec699[_0xf8be('0x14')][_0xf8be('0x15')]);}logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x37cb93,_0x5ec699[_0xf8be('0x14')][_0xf8be('0x15')]);return _0x3ff5d2(_0x5ec699[_0xf8be('0x14')]['message']);}else{logger[_0xf8be('0xe')](_0xf8be('0xf'),_0x37cb93,_0xf8be('0x10'));_0x3ff5d2(_0x5ec699[_0xf8be('0x16')][_0xf8be('0x15')]);}})[_0xf8be('0x17')](function(_0x35c766){logger['error'](_0xf8be('0xf'),_0x37cb93,_0x35c766);_0x21f521(_0x35c766);});});} \ No newline at end of file +var _0x40ce=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x309810,_0xd5618d){var _0x1b0668=function(_0x4241af){while(--_0x4241af){_0x309810['push'](_0x309810['shift']());}};_0x1b0668(++_0xd5618d);}(_0x40ce,0x182));var _0xe40c=function(_0x3b7560,_0x4d9d92){_0x3b7560=_0x3b7560-0x0;var _0x5df7ee=_0x40ce[_0x3b7560];return _0x5df7ee;};'use strict';var _=require(_0xe40c('0x0'));var util=require(_0xe40c('0x1'));var moment=require('moment');var BPromise=require(_0xe40c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe40c('0x3'))['db'];var utils=require(_0xe40c('0x4'));var logger=require(_0xe40c('0x5'))(_0xe40c('0x6'));var config=require(_0xe40c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe40c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x28bde4,_0x3c3130,_0x34d005){return new BPromise(function(_0x3d0af4,_0x5b6ed4){return client[_0xe40c('0x9')](_0x28bde4,_0x34d005)[_0xe40c('0xa')](function(_0x503e62){logger[_0xe40c('0xb')](_0xe40c('0xc'),_0x3c3130,'request\x20sent');logger[_0xe40c('0xd')](_0xe40c('0xe'),_0x3c3130,_0xe40c('0xf'),JSON[_0xe40c('0x10')](_0x503e62));if(_0x503e62[_0xe40c('0x11')]){if(_0x503e62[_0xe40c('0x11')][_0xe40c('0x12')]===0x1f4){logger[_0xe40c('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3c3130,_0x503e62[_0xe40c('0x11')]['message']);return _0x5b6ed4(_0x503e62[_0xe40c('0x11')][_0xe40c('0x13')]);}logger[_0xe40c('0x11')](_0xe40c('0xc'),_0x3c3130,_0x503e62[_0xe40c('0x11')][_0xe40c('0x13')]);return _0x3d0af4(_0x503e62[_0xe40c('0x11')][_0xe40c('0x13')]);}else{logger[_0xe40c('0xb')](_0xe40c('0xc'),_0x3c3130,_0xe40c('0xf'));_0x3d0af4(_0x503e62[_0xe40c('0x14')][_0xe40c('0x13')]);}})['catch'](function(_0x2f3929){logger[_0xe40c('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3c3130,_0x2f3929);_0x5b6ed4(_0x2f3929);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index e722493..36d106e 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 _0x05c6=['destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/questions','post','create','update','delete'];(function(_0x23da4d,_0x63498c){var _0x4ae55=function(_0x323d75){while(--_0x323d75){_0x23da4d['push'](_0x23da4d['shift']());}};_0x4ae55(++_0x63498c);}(_0x05c6,0xb6));var _0x605c=function(_0x1521cf,_0x1857c1){_0x1521cf=_0x1521cf-0x0;var _0x1b0dd9=_0x05c6[_0x1521cf];return _0x1b0dd9;};'use strict';var multer=require(_0x605c('0x0'));var util=require('util');var path=require(_0x605c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x605c('0x2')]();var fs_extra=require(_0x605c('0x3'));var auth=require(_0x605c('0x4'));var interaction=require(_0x605c('0x5'));var config=require(_0x605c('0x6'));var controller=require('./jscriptySessionReport.controller');router[_0x605c('0x7')]('/',auth[_0x605c('0x8')](),controller[_0x605c('0x9')]);router['get']('/describe',auth[_0x605c('0x8')](),controller['describe']);router[_0x605c('0x7')](_0x605c('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0x605c('0xb'),auth[_0x605c('0x8')](),controller['getQuestions']);router[_0x605c('0xc')]('/',auth[_0x605c('0x8')](),controller[_0x605c('0xd')]);router['put']('/:id',auth[_0x605c('0x8')](),controller[_0x605c('0xe')]);router[_0x605c('0xf')](_0x605c('0xa'),auth[_0x605c('0x8')](),controller[_0x605c('0x10')]);module[_0x605c('0x11')]=router; \ No newline at end of file +var _0x99e0=['describe','/:id','show','/:id/questions','post','create','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated'];(function(_0x4e924f,_0x2b7e01){var _0xb9a6a2=function(_0x2d78a2){while(--_0x2d78a2){_0x4e924f['push'](_0x4e924f['shift']());}};_0xb9a6a2(++_0x2b7e01);}(_0x99e0,0xdd));var _0x099e=function(_0x20278a,_0x303d5b){_0x20278a=_0x20278a-0x0;var _0x179ff8=_0x99e0[_0x20278a];return _0x179ff8;};'use strict';var multer=require(_0x099e('0x0'));var util=require(_0x099e('0x1'));var path=require(_0x099e('0x2'));var timeout=require('connect-timeout');var express=require(_0x099e('0x3'));var router=express['Router']();var fs_extra=require(_0x099e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x099e('0x5'));var config=require(_0x099e('0x6'));var controller=require(_0x099e('0x7'));router[_0x099e('0x8')]('/',auth[_0x099e('0x9')](),controller['index']);router[_0x099e('0x8')]('/describe',auth[_0x099e('0x9')](),controller[_0x099e('0xa')]);router['get'](_0x099e('0xb'),auth['isAuthenticated'](),controller[_0x099e('0xc')]);router['get'](_0x099e('0xd'),auth[_0x099e('0x9')](),controller['getQuestions']);router[_0x099e('0xe')]('/',auth[_0x099e('0x9')](),controller[_0x099e('0xf')]);router[_0x099e('0x10')]('/:id',auth[_0x099e('0x9')](),controller[_0x099e('0x11')]);router[_0x099e('0x12')](_0x099e('0xb'),auth[_0x099e('0x9')](),controller[_0x099e('0x13')]);module[_0x099e('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 35488c2..91d88fb 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 _0xbfb9=['endtime','format','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','starttime'];(function(_0x2db796,_0x2a07a3){var _0x1870dc=function(_0x1c3b92){while(--_0x1c3b92){_0x2db796['push'](_0x2db796['shift']());}};_0x1870dc(++_0x2a07a3);}(_0xbfb9,0x144));var _0x9bfb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xbfb9[_0x502c7d];return _0x30b7ed;};'use strict';var moment=require(_0x9bfb('0x0'));var Sequelize=require(_0x9bfb('0x1'));module[_0x9bfb('0x2')]={'starttime':{'type':Sequelize[_0x9bfb('0x3')],'set':function(_0x2b2402){this[_0x9bfb('0x4')](_0x9bfb('0x5'),_0x2b2402);this[_0x9bfb('0x4')](_0x9bfb('0x6'),moment()[_0x9bfb('0x7')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x9bfb('0x3')]},'membername':{'type':Sequelize[_0x9bfb('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x9bfb('0x8')]},'calleridname':{'type':Sequelize[_0x9bfb('0x8')]},'calleridnum':{'type':Sequelize[_0x9bfb('0x8')]},'completed':{'type':Sequelize[_0x9bfb('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0xcf6a=['exports','DATE','setDataValue','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x26b63c,_0x1b87e0){var _0x24a924=function(_0x5c18e4){while(--_0x5c18e4){_0x26b63c['push'](_0x26b63c['shift']());}};_0x24a924(++_0x1b87e0);}(_0xcf6a,0x132));var _0xacf6=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xcf6a[_0x1f9f37];return _0x21c080;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xacf6('0x0')]={'starttime':{'type':Sequelize[_0xacf6('0x1')],'set':function(_0x13dbc2){this[_0xacf6('0x2')]('starttime',_0x13dbc2);this['setDataValue']('endtime',moment()['format'](_0xacf6('0x3')));}},'endtime':{'type':Sequelize[_0xacf6('0x1')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xacf6('0x4')]},'uniqueid':{'type':Sequelize[_0xacf6('0x4')]},'calleridname':{'type':Sequelize[_0xacf6('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xacf6('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 4cdbe15..5e7808c 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 _0x9073=['to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','JscriptySessionReport','findAll','rows','catch','show','params','keys','find','create','body','describe','findOne','JscriptyQuestionReport','hasOwnProperty','SessionId','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x9073,0x1da));var _0x3907=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x9073[_0x4fc9e6];return _0x551d28;};'use strict';var emlformat=require(_0x3907('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3907('0x1'));var rp=require(_0x3907('0x2'));var moment=require('moment');var BPromise=require(_0x3907('0x3'));var Mustache=require(_0x3907('0x4'));var util=require('util');var path=require(_0x3907('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3907('0x6'));var fs=require('fs');var fs_extra=require(_0x3907('0x7'));var _=require(_0x3907('0x8'));var squel=require('squel');var crypto=require(_0x3907('0x9'));var jsforce=require(_0x3907('0xa'));var deskjs=require(_0x3907('0xb'));var toCsv=require(_0x3907('0xc'));var querystring=require(_0x3907('0xd'));var Papa=require(_0x3907('0xe'));var Redis=require('ioredis');var authService=require(_0x3907('0xf'));var qs=require(_0x3907('0x10'));var as=require(_0x3907('0x11'));var hardwareService=require(_0x3907('0x12'));var logger=require(_0x3907('0x13'))(_0x3907('0x14'));var utils=require('../../config/utils');var config=require(_0x3907('0x15'));var licenseUtil=require(_0x3907('0x16'));var db=require(_0x3907('0x17'))['db'];function respondWithStatusCode(_0x1c3438,_0x84e7cc){_0x84e7cc=_0x84e7cc||0xcc;return function(_0x138f72){if(_0x138f72){return _0x1c3438[_0x3907('0x18')](_0x84e7cc);}return _0x1c3438[_0x3907('0x19')](_0x84e7cc)[_0x3907('0x1a')]();};}function respondWithResult(_0x218f39,_0x32df84){_0x32df84=_0x32df84||0xc8;return function(_0x4689af){if(_0x4689af){return _0x218f39[_0x3907('0x19')](_0x32df84)[_0x3907('0x1b')](_0x4689af);}};}function respondWithFilteredResult(_0x22df63,_0x427edd){return function(_0x2c6d0f){if(_0x2c6d0f){var _0x4dd2fb=typeof _0x427edd[_0x3907('0x1c')]==='undefined'&&typeof _0x427edd[_0x3907('0x1d')]==='undefined';var _0x459d44=_0x2c6d0f[_0x3907('0x1e')];var _0x3a3778=_0x4dd2fb?0x0:_0x427edd[_0x3907('0x1c')];var _0x31528a=_0x4dd2fb?_0x2c6d0f['count']:_0x427edd[_0x3907('0x1c')]+_0x427edd['limit'];var _0x1fdb56;if(_0x31528a>=_0x459d44){_0x31528a=_0x459d44;_0x1fdb56=0xc8;}else{_0x1fdb56=0xce;}_0x22df63[_0x3907('0x19')](_0x1fdb56);return _0x22df63[_0x3907('0x1f')](_0x3907('0x20'),_0x3a3778+'-'+_0x31528a+'/'+_0x459d44)[_0x3907('0x1b')](_0x2c6d0f);}return null;};}function patchUpdates(_0x299332){return function(_0x1bb219){try{jsonpatch[_0x3907('0x21')](_0x1bb219,_0x299332,!![]);}catch(_0xe19ea1){return BPromise[_0x3907('0x22')](_0xe19ea1);}return _0x1bb219[_0x3907('0x23')]();};}function saveUpdates(_0x357269,_0x4a1f53){return function(_0xc00e52){if(_0xc00e52){return _0xc00e52[_0x3907('0x24')](_0x357269)[_0x3907('0x25')](function(_0x4cc9b8){return _0x4cc9b8;});}return null;};}function removeEntity(_0x21a2f9,_0x1d2ca0){return function(_0x45da8a){if(_0x45da8a){return _0x45da8a[_0x3907('0x26')]()['then'](function(){_0x21a2f9['status'](0xcc)[_0x3907('0x1a')]();});}};}function handleEntityNotFound(_0xea791f,_0x3e7165){return function(_0x32c38a){if(!_0x32c38a){_0xea791f[_0x3907('0x18')](0x194);}return _0x32c38a;};}function handleError(_0x1fb57b,_0xbd959){_0xbd959=_0xbd959||0x1f4;return function(_0x2bd7b4){logger['error'](_0x2bd7b4[_0x3907('0x27')]);if(_0x2bd7b4[_0x3907('0x28')]){delete _0x2bd7b4['name'];}_0x1fb57b['status'](_0xbd959)[_0x3907('0x29')](_0x2bd7b4);};}exports[_0x3907('0x2a')]=function(_0x430a74,_0x30843b){var _0x247a88={},_0x33d096={},_0x1b1390={'count':0x0,'rows':[]};var _0x36e9d0=_[_0x3907('0x2b')](db['JscriptySessionReport'][_0x3907('0x2c')],function(_0x3ce102){return{'name':_0x3ce102[_0x3907('0x2d')],'type':_0x3ce102['type'][_0x3907('0x2e')]};});_0x33d096['model']=_[_0x3907('0x2b')](_0x36e9d0,_0x3907('0x28'));_0x33d096['query']=_['keys'](_0x430a74[_0x3907('0x2f')]);_0x33d096[_0x3907('0x30')]=_[_0x3907('0x31')](_0x33d096[_0x3907('0x32')],_0x33d096['query']);_0x247a88['attributes']=_[_0x3907('0x31')](_0x33d096['model'],qs[_0x3907('0x33')](_0x430a74[_0x3907('0x2f')][_0x3907('0x33')]));_0x247a88['attributes']=_0x247a88[_0x3907('0x34')][_0x3907('0x35')]?_0x247a88[_0x3907('0x34')]:_0x33d096[_0x3907('0x32')];if(!_0x430a74[_0x3907('0x2f')]['hasOwnProperty'](_0x3907('0x36'))){_0x247a88[_0x3907('0x1d')]=qs[_0x3907('0x1d')](_0x430a74[_0x3907('0x2f')][_0x3907('0x1d')]);_0x247a88[_0x3907('0x1c')]=qs[_0x3907('0x1c')](_0x430a74[_0x3907('0x2f')][_0x3907('0x1c')]);}_0x247a88[_0x3907('0x37')]=qs[_0x3907('0x38')](_0x430a74[_0x3907('0x2f')][_0x3907('0x38')]);_0x247a88[_0x3907('0x39')]=qs[_0x3907('0x30')](_[_0x3907('0x3a')](_0x430a74[_0x3907('0x2f')],_0x33d096[_0x3907('0x30')]),_0x36e9d0);if(_0x430a74['query']['filter']){_0x247a88[_0x3907('0x39')]=_[_0x3907('0x3b')](_0x247a88['where'],{'$or':_[_0x3907('0x2b')](_0x36e9d0,function(_0x257eb4){if(_0x257eb4[_0x3907('0x3c')]!==_0x3907('0x3d')){var _0x2a1e00={};_0x2a1e00[_0x257eb4[_0x3907('0x28')]]={'$like':'%'+_0x430a74[_0x3907('0x2f')][_0x3907('0x3e')]+'%'};return _0x2a1e00;}})});}_0x247a88=_[_0x3907('0x3b')]({},_0x247a88,_0x430a74[_0x3907('0x3f')]);var _0x1c7ad4={'where':_0x247a88['where']};return db['JscriptySessionReport']['count'](_0x1c7ad4)[_0x3907('0x25')](function(_0x323530){_0x1b1390['count']=_0x323530;if(_0x430a74[_0x3907('0x2f')][_0x3907('0x40')]){_0x247a88[_0x3907('0x41')]=[{'all':!![]}];}return db[_0x3907('0x42')][_0x3907('0x43')](_0x247a88);})['then'](function(_0x2f9b65){_0x1b1390[_0x3907('0x44')]=_0x2f9b65;return _0x1b1390;})[_0x3907('0x25')](respondWithFilteredResult(_0x30843b,_0x247a88))[_0x3907('0x45')](handleError(_0x30843b,null));};exports[_0x3907('0x46')]=function(_0xec3f20,_0x436803){var _0x48f6ba={'raw':!![],'where':{'id':_0xec3f20[_0x3907('0x47')]['id']}},_0x493162={};_0x493162['model']=_[_0x3907('0x48')](db[_0x3907('0x42')][_0x3907('0x2c')]);_0x493162['query']=_['keys'](_0xec3f20[_0x3907('0x2f')]);_0x493162[_0x3907('0x30')]=_[_0x3907('0x31')](_0x493162[_0x3907('0x32')],_0x493162[_0x3907('0x2f')]);_0x48f6ba[_0x3907('0x34')]=_[_0x3907('0x31')](_0x493162[_0x3907('0x32')],qs[_0x3907('0x33')](_0xec3f20[_0x3907('0x2f')][_0x3907('0x33')]));_0x48f6ba[_0x3907('0x34')]=_0x48f6ba['attributes'][_0x3907('0x35')]?_0x48f6ba[_0x3907('0x34')]:_0x493162[_0x3907('0x32')];if(_0xec3f20['query']['includeAll']){_0x48f6ba[_0x3907('0x41')]=[{'all':!![]}];}_0x48f6ba=_[_0x3907('0x3b')]({},_0x48f6ba,_0xec3f20[_0x3907('0x3f')]);return db['JscriptySessionReport'][_0x3907('0x49')](_0x48f6ba)['then'](handleEntityNotFound(_0x436803,null))[_0x3907('0x25')](respondWithResult(_0x436803,null))[_0x3907('0x45')](handleError(_0x436803,null));};exports[_0x3907('0x4a')]=function(_0x146af6,_0x480780){return db[_0x3907('0x42')][_0x3907('0x4a')](_0x146af6[_0x3907('0x4b')],{})[_0x3907('0x25')](respondWithResult(_0x480780,0xc9))[_0x3907('0x45')](handleError(_0x480780,null));};exports['update']=function(_0x4a3322,_0x3d5b8a){if(_0x4a3322['body']['id']){delete _0x4a3322[_0x3907('0x4b')]['id'];}return db[_0x3907('0x42')]['find']({'where':{'id':_0x4a3322[_0x3907('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d5b8a,null))[_0x3907('0x25')](saveUpdates(_0x4a3322[_0x3907('0x4b')],null))[_0x3907('0x25')](respondWithResult(_0x3d5b8a,null))['catch'](handleError(_0x3d5b8a,null));};exports[_0x3907('0x26')]=function(_0x2e3a16,_0x5d480e){return db[_0x3907('0x42')][_0x3907('0x49')]({'where':{'id':_0x2e3a16[_0x3907('0x47')]['id']}})['then'](handleEntityNotFound(_0x5d480e,null))[_0x3907('0x25')](removeEntity(_0x5d480e,null))[_0x3907('0x45')](handleError(_0x5d480e,null));};exports[_0x3907('0x4c')]=function(_0x1a113a,_0x267dac){return db[_0x3907('0x42')][_0x3907('0x4c')]()[_0x3907('0x25')](respondWithResult(_0x267dac,null))[_0x3907('0x45')](handleError(_0x267dac,null));};exports['getQuestions']=function(_0x3feca9,_0x227a75,_0x4e72d3){var _0x3d1480={'raw':!![],'where':{}};var _0xb6991f={};var _0x4d2a23={'count':0x0,'rows':[]};return db[_0x3907('0x42')][_0x3907('0x4d')]({'where':{'id':_0x3feca9['params']['id']}})['then'](handleEntityNotFound(_0x227a75,null))[_0x3907('0x25')](function(_0x10d7c8){if(_0x10d7c8){_0xb6991f[_0x3907('0x32')]=_[_0x3907('0x48')](db[_0x3907('0x4e')][_0x3907('0x2c')]);_0xb6991f[_0x3907('0x2f')]=_[_0x3907('0x48')](_0x3feca9['query']);_0xb6991f[_0x3907('0x30')]=_['intersection'](_0xb6991f['model'],_0xb6991f[_0x3907('0x2f')]);_0x3d1480['attributes']=_[_0x3907('0x31')](_0xb6991f[_0x3907('0x32')],qs[_0x3907('0x33')](_0x3feca9['query'][_0x3907('0x33')]));_0x3d1480[_0x3907('0x34')]=_0x3d1480[_0x3907('0x34')]['length']?_0x3d1480[_0x3907('0x34')]:_0xb6991f[_0x3907('0x32')];if(!_0x3feca9[_0x3907('0x2f')][_0x3907('0x4f')]('nolimit')){_0x3d1480['limit']=qs[_0x3907('0x1d')](_0x3feca9[_0x3907('0x2f')][_0x3907('0x1d')]);_0x3d1480['offset']=qs[_0x3907('0x1c')](_0x3feca9[_0x3907('0x2f')][_0x3907('0x1c')]);}_0x3d1480[_0x3907('0x37')]=qs[_0x3907('0x38')](_0x3feca9[_0x3907('0x2f')]['sort']);_0x3d1480[_0x3907('0x39')]=qs[_0x3907('0x30')](_[_0x3907('0x3a')](_0x3feca9[_0x3907('0x2f')],_0xb6991f[_0x3907('0x30')]));_0x3d1480[_0x3907('0x39')][_0x3907('0x50')]=_0x10d7c8['id'];if(_0x3feca9[_0x3907('0x2f')][_0x3907('0x3e')]){_0x3d1480['where']=_[_0x3907('0x3b')](_0x3d1480[_0x3907('0x39')],{'$or':_[_0x3907('0x2b')](_0x3d1480[_0x3907('0x34')],function(_0x58fd4a){var _0x1e35f6={};_0x1e35f6[_0x58fd4a]={'$like':'%'+_0x3feca9[_0x3907('0x2f')]['filter']+'%'};return _0x1e35f6;})});}_0x3d1480=_[_0x3907('0x3b')]({},_0x3d1480,_0x3feca9['options']);return db[_0x3907('0x4e')][_0x3907('0x1e')]({'where':_0x3d1480[_0x3907('0x39')]})[_0x3907('0x25')](function(_0x4d1dc9){_0x4d2a23[_0x3907('0x1e')]=_0x4d1dc9;if(_0x3feca9[_0x3907('0x2f')][_0x3907('0x40')]){_0x3d1480[_0x3907('0x41')]=[{'all':!![]}];}return db[_0x3907('0x4e')][_0x3907('0x43')](_0x3d1480);})[_0x3907('0x25')](function(_0x1fdb60){_0x4d2a23[_0x3907('0x44')]=_0x1fdb60;return _0x4d2a23;});}})[_0x3907('0x25')](respondWithFilteredResult(_0x227a75,_0x3d1480))[_0x3907('0x45')](handleError(_0x227a75,null));}; \ No newline at end of file +var _0xdb8d=['sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','save','update','then','destroy','error','stack','name','index','map','JscriptySessionReport','rawAttributes','fieldName','type','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','include','findAll','rows','catch','params','length','includeAll','options','find','create','body','describe','findOne','JscriptyQuestionReport','order','pick','filter','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xdb8d,0x120));var _0xddb8=function(_0x15bb39,_0x42bd41){_0x15bb39=_0x15bb39-0x0;var _0x88fadc=_0xdb8d[_0x15bb39];return _0x88fadc;};'use strict';var emlformat=require(_0xddb8('0x0'));var rimraf=require(_0xddb8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xddb8('0x2'));var rp=require(_0xddb8('0x3'));var moment=require('moment');var BPromise=require(_0xddb8('0x4'));var Mustache=require(_0xddb8('0x5'));var util=require(_0xddb8('0x6'));var path=require(_0xddb8('0x7'));var sox=require(_0xddb8('0x8'));var csv=require(_0xddb8('0x9'));var ejs=require(_0xddb8('0xa'));var fs=require('fs');var fs_extra=require(_0xddb8('0xb'));var _=require('lodash');var squel=require(_0xddb8('0xc'));var crypto=require(_0xddb8('0xd'));var jsforce=require(_0xddb8('0xe'));var deskjs=require(_0xddb8('0xf'));var toCsv=require('to-csv');var querystring=require(_0xddb8('0x10'));var Papa=require(_0xddb8('0x11'));var Redis=require('ioredis');var authService=require(_0xddb8('0x12'));var qs=require(_0xddb8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xddb8('0x14'));var logger=require('../../config/logger')(_0xddb8('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xddb8('0x16'));var db=require(_0xddb8('0x17'))['db'];function respondWithStatusCode(_0x5d3b1f,_0x49c9eb){_0x49c9eb=_0x49c9eb||0xcc;return function(_0x51afa5){if(_0x51afa5){return _0x5d3b1f[_0xddb8('0x18')](_0x49c9eb);}return _0x5d3b1f['status'](_0x49c9eb)[_0xddb8('0x19')]();};}function respondWithResult(_0x3769a4,_0x505116){_0x505116=_0x505116||0xc8;return function(_0x774c1f){if(_0x774c1f){return _0x3769a4[_0xddb8('0x1a')](_0x505116)['json'](_0x774c1f);}};}function respondWithFilteredResult(_0x53540a,_0x1d008a){return function(_0x266c81){if(_0x266c81){var _0x3558a6=typeof _0x1d008a[_0xddb8('0x1b')]===_0xddb8('0x1c')&&typeof _0x1d008a[_0xddb8('0x1d')]===_0xddb8('0x1c');var _0x5310f0=_0x266c81[_0xddb8('0x1e')];var _0x3be556=_0x3558a6?0x0:_0x1d008a[_0xddb8('0x1b')];var _0x3a1850=_0x3558a6?_0x266c81[_0xddb8('0x1e')]:_0x1d008a['offset']+_0x1d008a[_0xddb8('0x1d')];var _0x5e2c92;if(_0x3a1850>=_0x5310f0){_0x3a1850=_0x5310f0;_0x5e2c92=0xc8;}else{_0x5e2c92=0xce;}_0x53540a[_0xddb8('0x1a')](_0x5e2c92);return _0x53540a['set']('Content-Range',_0x3be556+'-'+_0x3a1850+'/'+_0x5310f0)['json'](_0x266c81);}return null;};}function patchUpdates(_0x2b80c5){return function(_0x43416a){try{jsonpatch['apply'](_0x43416a,_0x2b80c5,!![]);}catch(_0x18890a){return BPromise['reject'](_0x18890a);}return _0x43416a[_0xddb8('0x1f')]();};}function saveUpdates(_0x29ca4c,_0x4b1f2e){return function(_0x4402e8){if(_0x4402e8){return _0x4402e8[_0xddb8('0x20')](_0x29ca4c)[_0xddb8('0x21')](function(_0x14408a){return _0x14408a;});}return null;};}function removeEntity(_0x1bedae,_0x587633){return function(_0x4857a6){if(_0x4857a6){return _0x4857a6[_0xddb8('0x22')]()[_0xddb8('0x21')](function(){_0x1bedae[_0xddb8('0x1a')](0xcc)[_0xddb8('0x19')]();});}};}function handleEntityNotFound(_0x7324af,_0x1c4533){return function(_0x4fe22b){if(!_0x4fe22b){_0x7324af[_0xddb8('0x18')](0x194);}return _0x4fe22b;};}function handleError(_0x411bb5,_0x40cc15){_0x40cc15=_0x40cc15||0x1f4;return function(_0x5f31a9){logger[_0xddb8('0x23')](_0x5f31a9[_0xddb8('0x24')]);if(_0x5f31a9[_0xddb8('0x25')]){delete _0x5f31a9['name'];}_0x411bb5[_0xddb8('0x1a')](_0x40cc15)['send'](_0x5f31a9);};}exports[_0xddb8('0x26')]=function(_0x315953,_0x5eff27){var _0xbd4c9c={},_0xb6f43b={},_0x49f8ff={'count':0x0,'rows':[]};var _0x554177=_[_0xddb8('0x27')](db[_0xddb8('0x28')][_0xddb8('0x29')],function(_0x45154f){return{'name':_0x45154f[_0xddb8('0x2a')],'type':_0x45154f[_0xddb8('0x2b')]['key']};});_0xb6f43b['model']=_[_0xddb8('0x27')](_0x554177,_0xddb8('0x25'));_0xb6f43b['query']=_[_0xddb8('0x2c')](_0x315953[_0xddb8('0x2d')]);_0xb6f43b[_0xddb8('0x2e')]=_['intersection'](_0xb6f43b[_0xddb8('0x2f')],_0xb6f43b[_0xddb8('0x2d')]);_0xbd4c9c[_0xddb8('0x30')]=_[_0xddb8('0x31')](_0xb6f43b['model'],qs[_0xddb8('0x32')](_0x315953['query']['fields']));_0xbd4c9c[_0xddb8('0x30')]=_0xbd4c9c['attributes']['length']?_0xbd4c9c[_0xddb8('0x30')]:_0xb6f43b[_0xddb8('0x2f')];if(!_0x315953['query'][_0xddb8('0x33')](_0xddb8('0x34'))){_0xbd4c9c['limit']=qs['limit'](_0x315953[_0xddb8('0x2d')]['limit']);_0xbd4c9c[_0xddb8('0x1b')]=qs[_0xddb8('0x1b')](_0x315953['query'][_0xddb8('0x1b')]);}_0xbd4c9c['order']=qs[_0xddb8('0x35')](_0x315953[_0xddb8('0x2d')][_0xddb8('0x35')]);_0xbd4c9c['where']=qs[_0xddb8('0x2e')](_['pick'](_0x315953[_0xddb8('0x2d')],_0xb6f43b[_0xddb8('0x2e')]),_0x554177);if(_0x315953[_0xddb8('0x2d')]['filter']){_0xbd4c9c[_0xddb8('0x36')]=_[_0xddb8('0x37')](_0xbd4c9c[_0xddb8('0x36')],{'$or':_[_0xddb8('0x27')](_0x554177,function(_0xf8e231){if(_0xf8e231['type']!==_0xddb8('0x38')){var _0x103be6={};_0x103be6[_0xf8e231[_0xddb8('0x25')]]={'$like':'%'+_0x315953['query']['filter']+'%'};return _0x103be6;}})});}_0xbd4c9c=_[_0xddb8('0x37')]({},_0xbd4c9c,_0x315953['options']);var _0x1b401c={'where':_0xbd4c9c['where']};return db['JscriptySessionReport']['count'](_0x1b401c)[_0xddb8('0x21')](function(_0x8cbd18){_0x49f8ff[_0xddb8('0x1e')]=_0x8cbd18;if(_0x315953[_0xddb8('0x2d')]['includeAll']){_0xbd4c9c[_0xddb8('0x39')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xddb8('0x3a')](_0xbd4c9c);})[_0xddb8('0x21')](function(_0x26dcc5){_0x49f8ff[_0xddb8('0x3b')]=_0x26dcc5;return _0x49f8ff;})['then'](respondWithFilteredResult(_0x5eff27,_0xbd4c9c))[_0xddb8('0x3c')](handleError(_0x5eff27,null));};exports['show']=function(_0x7e5b3f,_0x1a5a3c){var _0x9af563={'raw':!![],'where':{'id':_0x7e5b3f[_0xddb8('0x3d')]['id']}},_0x1f05b1={};_0x1f05b1[_0xddb8('0x2f')]=_[_0xddb8('0x2c')](db[_0xddb8('0x28')][_0xddb8('0x29')]);_0x1f05b1['query']=_['keys'](_0x7e5b3f[_0xddb8('0x2d')]);_0x1f05b1[_0xddb8('0x2e')]=_[_0xddb8('0x31')](_0x1f05b1[_0xddb8('0x2f')],_0x1f05b1[_0xddb8('0x2d')]);_0x9af563[_0xddb8('0x30')]=_[_0xddb8('0x31')](_0x1f05b1[_0xddb8('0x2f')],qs[_0xddb8('0x32')](_0x7e5b3f[_0xddb8('0x2d')][_0xddb8('0x32')]));_0x9af563[_0xddb8('0x30')]=_0x9af563[_0xddb8('0x30')][_0xddb8('0x3e')]?_0x9af563['attributes']:_0x1f05b1[_0xddb8('0x2f')];if(_0x7e5b3f[_0xddb8('0x2d')][_0xddb8('0x3f')]){_0x9af563[_0xddb8('0x39')]=[{'all':!![]}];}_0x9af563=_[_0xddb8('0x37')]({},_0x9af563,_0x7e5b3f[_0xddb8('0x40')]);return db[_0xddb8('0x28')][_0xddb8('0x41')](_0x9af563)[_0xddb8('0x21')](handleEntityNotFound(_0x1a5a3c,null))[_0xddb8('0x21')](respondWithResult(_0x1a5a3c,null))[_0xddb8('0x3c')](handleError(_0x1a5a3c,null));};exports['create']=function(_0x84c5fd,_0x228638){return db[_0xddb8('0x28')][_0xddb8('0x42')](_0x84c5fd[_0xddb8('0x43')],{})[_0xddb8('0x21')](respondWithResult(_0x228638,0xc9))['catch'](handleError(_0x228638,null));};exports[_0xddb8('0x20')]=function(_0x47c546,_0xabdebd){if(_0x47c546['body']['id']){delete _0x47c546[_0xddb8('0x43')]['id'];}return db[_0xddb8('0x28')]['find']({'where':{'id':_0x47c546[_0xddb8('0x3d')]['id']}})[_0xddb8('0x21')](handleEntityNotFound(_0xabdebd,null))[_0xddb8('0x21')](saveUpdates(_0x47c546[_0xddb8('0x43')],null))[_0xddb8('0x21')](respondWithResult(_0xabdebd,null))[_0xddb8('0x3c')](handleError(_0xabdebd,null));};exports[_0xddb8('0x22')]=function(_0x49949d,_0x56eed5){return db[_0xddb8('0x28')][_0xddb8('0x41')]({'where':{'id':_0x49949d[_0xddb8('0x3d')]['id']}})[_0xddb8('0x21')](handleEntityNotFound(_0x56eed5,null))['then'](removeEntity(_0x56eed5,null))['catch'](handleError(_0x56eed5,null));};exports[_0xddb8('0x44')]=function(_0x29b6f9,_0x2414fd){return db[_0xddb8('0x28')][_0xddb8('0x44')]()[_0xddb8('0x21')](respondWithResult(_0x2414fd,null))[_0xddb8('0x3c')](handleError(_0x2414fd,null));};exports['getQuestions']=function(_0x2f2924,_0x324025,_0x18a659){var _0x286839={'raw':!![],'where':{}};var _0x46e016={};var _0x4fc3fe={'count':0x0,'rows':[]};return db[_0xddb8('0x28')][_0xddb8('0x45')]({'where':{'id':_0x2f2924[_0xddb8('0x3d')]['id']}})['then'](handleEntityNotFound(_0x324025,null))['then'](function(_0x2475da){if(_0x2475da){_0x46e016[_0xddb8('0x2f')]=_[_0xddb8('0x2c')](db[_0xddb8('0x46')][_0xddb8('0x29')]);_0x46e016[_0xddb8('0x2d')]=_[_0xddb8('0x2c')](_0x2f2924[_0xddb8('0x2d')]);_0x46e016[_0xddb8('0x2e')]=_[_0xddb8('0x31')](_0x46e016['model'],_0x46e016[_0xddb8('0x2d')]);_0x286839[_0xddb8('0x30')]=_[_0xddb8('0x31')](_0x46e016[_0xddb8('0x2f')],qs['fields'](_0x2f2924[_0xddb8('0x2d')][_0xddb8('0x32')]));_0x286839[_0xddb8('0x30')]=_0x286839['attributes']['length']?_0x286839['attributes']:_0x46e016['model'];if(!_0x2f2924[_0xddb8('0x2d')][_0xddb8('0x33')]('nolimit')){_0x286839[_0xddb8('0x1d')]=qs[_0xddb8('0x1d')](_0x2f2924[_0xddb8('0x2d')][_0xddb8('0x1d')]);_0x286839[_0xddb8('0x1b')]=qs[_0xddb8('0x1b')](_0x2f2924[_0xddb8('0x2d')][_0xddb8('0x1b')]);}_0x286839[_0xddb8('0x47')]=qs[_0xddb8('0x35')](_0x2f2924[_0xddb8('0x2d')][_0xddb8('0x35')]);_0x286839[_0xddb8('0x36')]=qs[_0xddb8('0x2e')](_[_0xddb8('0x48')](_0x2f2924[_0xddb8('0x2d')],_0x46e016['filters']));_0x286839[_0xddb8('0x36')]['SessionId']=_0x2475da['id'];if(_0x2f2924[_0xddb8('0x2d')][_0xddb8('0x49')]){_0x286839[_0xddb8('0x36')]=_[_0xddb8('0x37')](_0x286839[_0xddb8('0x36')],{'$or':_['map'](_0x286839[_0xddb8('0x30')],function(_0x5c8513){var _0x283f02={};_0x283f02[_0x5c8513]={'$like':'%'+_0x2f2924[_0xddb8('0x2d')][_0xddb8('0x49')]+'%'};return _0x283f02;})});}_0x286839=_[_0xddb8('0x37')]({},_0x286839,_0x2f2924[_0xddb8('0x40')]);return db[_0xddb8('0x46')][_0xddb8('0x1e')]({'where':_0x286839[_0xddb8('0x36')]})[_0xddb8('0x21')](function(_0x957866){_0x4fc3fe[_0xddb8('0x1e')]=_0x957866;if(_0x2f2924['query'][_0xddb8('0x3f')]){_0x286839['include']=[{'all':!![]}];}return db[_0xddb8('0x46')][_0xddb8('0x3a')](_0x286839);})[_0xddb8('0x21')](function(_0x5b6455){_0x4fc3fe['rows']=_0x5b6455;return _0x4fc3fe;});}})[_0xddb8('0x21')](respondWithFilteredResult(_0x324025,_0x286839))[_0xddb8('0x3c')](handleError(_0x324025,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 786e17b..ea50cd2 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 _0x2d72=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions'];(function(_0x134032,_0x2a9876){var _0x2b87a3=function(_0x2245ae){while(--_0x2245ae){_0x134032['push'](_0x134032['shift']());}};_0x2b87a3(++_0x2a9876);}(_0x2d72,0xa8));var _0x22d7=function(_0x24b74b,_0x5df7db){_0x24b74b=_0x24b74b-0x0;var _0x4bfda3=_0x2d72[_0x24b74b];return _0x4bfda3;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var logger=require(_0x22d7('0x2'))(_0x22d7('0x3'));var moment=require(_0x22d7('0x4'));var BPromise=require(_0x22d7('0x5'));var rp=require(_0x22d7('0x6'));var fs=require('fs');var path=require(_0x22d7('0x7'));var rimraf=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var attributes=require(_0x22d7('0xa'));module[_0x22d7('0xb')]=function(_0x208b5b,_0x100426){return _0x208b5b['define'](_0x22d7('0xc'),attributes,{'tableName':_0x22d7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90b1=['define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0xf82c17,_0xdc63fe){var _0x394fcf=function(_0x455c92){while(--_0x455c92){_0xf82c17['push'](_0xf82c17['shift']());}};_0x394fcf(++_0xdc63fe);}(_0x90b1,0x1bb));var _0x190b=function(_0x3cb979,_0x21bbfd){_0x3cb979=_0x3cb979-0x0;var _0x3a5e5f=_0x90b1[_0x3cb979];return _0x3a5e5f;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'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 7b0bac9..1b19a1f 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 _0x8aad=['stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s'];(function(_0x683723,_0x568943){var _0x1e4abe=function(_0x3f8bac){while(--_0x3f8bac){_0x683723['push'](_0x683723['shift']());}};_0x1e4abe(++_0x568943);}(_0x8aad,0x146));var _0xd8aa=function(_0xaa6fc4,_0x1cf96a){_0xaa6fc4=_0xaa6fc4-0x0;var _0x285461=_0x8aad[_0xaa6fc4];return _0x285461;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var moment=require('moment');var BPromise=require(_0xd8aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8aa('0x3'));var db=require(_0xd8aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd8aa('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8aa('0x6')][_0xd8aa('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16ea12,_0x4a4b10,_0x2a559d){return new BPromise(function(_0x1da411,_0x2a23b5){return client[_0xd8aa('0x8')](_0x16ea12,_0x2a559d)['then'](function(_0x5de228){logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));logger[_0xd8aa('0xc')](_0xd8aa('0xd'),_0x4a4b10,'request\x20sent',JSON[_0xd8aa('0xe')](_0x5de228));if(_0x5de228[_0xd8aa('0xf')]){if(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x10')]===0x1f4){logger[_0xd8aa('0xf')](_0xd8aa('0xa'),_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x2a23b5(_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x4a4b10,_0x5de228[_0xd8aa('0xf')][_0xd8aa('0x11')]);return _0x1da411(_0x5de228[_0xd8aa('0xf')]['message']);}else{logger[_0xd8aa('0x9')](_0xd8aa('0xa'),_0x4a4b10,_0xd8aa('0xb'));_0x1da411(_0x5de228[_0xd8aa('0x12')]['message']);}})[_0xd8aa('0x13')](function(_0xa9ba1b){logger['error'](_0xd8aa('0xa'),_0x4a4b10,_0xa9ba1b);_0x2a23b5(_0xa9ba1b);});});} \ No newline at end of file +var _0x958a=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x42376b,_0x3bf18e){var _0x492cf=function(_0x1410f2){while(--_0x1410f2){_0x42376b['push'](_0x42376b['shift']());}};_0x492cf(++_0x3bf18e);}(_0x958a,0x128));var _0xa958=function(_0xd3d54e,_0xa40329){_0xd3d54e=_0xd3d54e-0x0;var _0x4ea5d9=_0x958a[_0xd3d54e];return _0x4ea5d9;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var moment=require('moment');var BPromise=require(_0xa958('0x2'));var rs=require(_0xa958('0x3'));var fs=require('fs');var Redis=require(_0xa958('0x4'));var db=require(_0xa958('0x5'))['db'];var utils=require(_0xa958('0x6'));var logger=require('../../config/logger')(_0xa958('0x7'));var config=require('../../config/environment');var jayson=require(_0xa958('0x8'));var client=jayson[_0xa958('0x9')][_0xa958('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ddaa9,_0x3ca01f,_0x3b2693){return new BPromise(function(_0x1895da,_0x54c0e0){return client['request'](_0x3ddaa9,_0x3b2693)[_0xa958('0xb')](function(_0x249764){logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));logger[_0xa958('0xf')](_0xa958('0x10'),_0x3ca01f,_0xa958('0xe'),JSON[_0xa958('0x11')](_0x249764));if(_0x249764[_0xa958('0x12')]){if(_0x249764[_0xa958('0x12')][_0xa958('0x13')]===0x1f4){logger[_0xa958('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x3ca01f,_0x249764['error']['message']);return _0x54c0e0(_0x249764[_0xa958('0x12')][_0xa958('0x14')]);}logger[_0xa958('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x3ca01f,_0x249764[_0xa958('0x12')]['message']);return _0x1895da(_0x249764['error']['message']);}else{logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));_0x1895da(_0x249764[_0xa958('0x15')][_0xa958('0x14')]);}})[_0xa958('0x16')](function(_0x23736f){logger[_0xa958('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x3ca01f,_0x23736f);_0x54c0e0(_0x23736f);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 4ef161d..d17b47f 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 _0x5d01=['../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','multer','path','connect-timeout','Router','fs-extra'];(function(_0x454bcb,_0x4f3bce){var _0x5f4ef5=function(_0x49dcd8){while(--_0x49dcd8){_0x454bcb['push'](_0x454bcb['shift']());}};_0x5f4ef5(++_0x4f3bce);}(_0x5d01,0xe5));var _0x15d0=function(_0x3d38b0,_0x4b8506){_0x3d38b0=_0x3d38b0-0x0;var _0x2aa708=_0x5d01[_0x3d38b0];return _0x2aa708;};'use strict';var multer=require(_0x15d0('0x0'));var util=require('util');var path=require(_0x15d0('0x1'));var timeout=require(_0x15d0('0x2'));var express=require('express');var router=express[_0x15d0('0x3')]();var fs_extra=require(_0x15d0('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x15d0('0x5'));var controller=require(_0x15d0('0x6'));router[_0x15d0('0x7')]('/',controller[_0x15d0('0x8')]);router[_0x15d0('0x9')](_0x15d0('0xa'),auth[_0x15d0('0xb')](),controller[_0x15d0('0xc')]);module['exports']=router; \ No newline at end of file +var _0x88d5=['./license.controller','get','index','put','/:id','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2eb1f8,_0x1ee318){var _0x715028=function(_0x4ad057){while(--_0x4ad057){_0x2eb1f8['push'](_0x2eb1f8['shift']());}};_0x715028(++_0x1ee318);}(_0x88d5,0x76));var _0x588d=function(_0x4f01de,_0x1ec9f6){_0x4f01de=_0x4f01de-0x0;var _0x22ae66=_0x88d5[_0x4f01de];return _0x22ae66;};'use strict';var multer=require(_0x588d('0x0'));var util=require(_0x588d('0x1'));var path=require(_0x588d('0x2'));var timeout=require(_0x588d('0x3'));var express=require(_0x588d('0x4'));var router=express['Router']();var fs_extra=require(_0x588d('0x5'));var auth=require(_0x588d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x588d('0x7'));var controller=require(_0x588d('0x8'));router[_0x588d('0x9')]('/',controller[_0x588d('0xa')]);router[_0x588d('0xb')](_0x588d('0xc'),auth['isAuthenticated'](),controller['update']);module[_0x588d('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 64807cb..2ef84bd 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 _0x3a0a=['sequelize','exports','STRING','INTEGER'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x3a0a,0xac));var _0xa3a0=function(_0x3541e3,_0x5e6812){_0x3541e3=_0x3541e3-0x0;var _0xbe2f25=_0x3a0a[_0x3541e3];return _0xbe2f25;};'use strict';var Sequelize=require(_0xa3a0('0x0'));module[_0xa3a0('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xa3a0('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xa3a0('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa0c7=['STRING','INTEGER','sequelize'];(function(_0x38d74a,_0x50c071){var _0x2f7a94=function(_0x1925be){while(--_0x1925be){_0x38d74a['push'](_0x38d74a['shift']());}};_0x2f7a94(++_0x50c071);}(_0xa0c7,0x1c1));var _0x7a0c=function(_0x2fba4f,_0xe694df){_0x2fba4f=_0x2fba4f-0x0;var _0x1e620f=_0xa0c7[_0x2fba4f];return _0x1e620f;};'use strict';var Sequelize=require(_0x7a0c('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x7a0c('0x1')]},'data2':{'type':Sequelize[_0x7a0c('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x7a0c('0x2')],'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 8f85f58..c44f60f 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 _0x0295=['demo','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','../../config/license/util','model','keys','rawAttributes','query','filters','intersection','attributes','fields','merge','options','catch','body','License','find','checkLicense','key'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x0295,0x1f0));var _0x5029=function(_0x13ec2b,_0x40b664){_0x13ec2b=_0x13ec2b-0x0;var _0x1fb3f4=_0x0295[_0x13ec2b];return _0x1fb3f4;};'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);};}var utilLicense=require(_0x5029('0x25'));exports['index']=function(_0x32da06,_0x251f99){var _0xe5313e={'raw':!![],'where':{'id':0x1}},_0x4b6f92={};_0x4b6f92[_0x5029('0x26')]=_[_0x5029('0x27')](db['License'][_0x5029('0x28')]);_0x4b6f92[_0x5029('0x29')]=_[_0x5029('0x27')](_0x32da06[_0x5029('0x29')]);_0x4b6f92[_0x5029('0x2a')]=_[_0x5029('0x2b')](_0x4b6f92[_0x5029('0x26')],_0x4b6f92[_0x5029('0x29')]);_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2b')](_0x4b6f92[_0x5029('0x26')],qs[_0x5029('0x2d')](_0x32da06['query'][_0x5029('0x2d')]));_0xe5313e['attributes']=_0xe5313e[_0x5029('0x2c')]['length']?_0xe5313e['attributes']:_0x4b6f92[_0x5029('0x26')];_0xe5313e=_[_0x5029('0x2e')]({},_0xe5313e,_0x32da06[_0x5029('0x2f')]);return utilLicense['getLicense'](_0xe5313e)[_0x5029('0x20')](respondWithResult(_0x251f99,null))[_0x5029('0x30')](handleError(_0x251f99,null));};exports[_0x5029('0x1f')]=function(_0x29c59a,_0x1bb896){if(_0x29c59a[_0x5029('0x31')]['id']){delete _0x29c59a[_0x5029('0x31')]['id'];}return db[_0x5029('0x32')][_0x5029('0x33')]({'where':{'id':_0x29c59a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x1bb896,null))[_0x5029('0x20')](function(_0xc110e8){var _0x1b3817=_0xc110e8['get']({'plain':!![]});return utilLicense[_0x5029('0x34')](_0x1b3817,_0x29c59a[_0x5029('0x31')][_0x5029('0x35')]);})['then'](function(_0x4904cc){if(!_0x4904cc[_0x5029('0x36')]){return saveUpdates(_0x29c59a[_0x5029('0x31')],null);}return _0x4904cc;})['then'](respondWithResult(_0x1bb896,null))['catch'](handleError(_0x1bb896,null));}; \ No newline at end of file +var _0xc4aa=['zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','model','keys','License','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','demo','eml-format','rimraf'];(function(_0x33155c,_0x3fdde1){var _0x5becf7=function(_0x2f7a2f){while(--_0x2f7a2f){_0x33155c['push'](_0x33155c['shift']());}};_0x5becf7(++_0x3fdde1);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc4aa[_0x88cd7b];return _0x56fcc8;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}var utilLicense=require(_0xac4a('0x15'));exports[_0xac4a('0x2a')]=function(_0x2772fe,_0x116700){var _0x4a5a9e={'raw':!![],'where':{'id':0x1}},_0x47f49c={};_0x47f49c[_0xac4a('0x2b')]=_[_0xac4a('0x2c')](db[_0xac4a('0x2d')]['rawAttributes']);_0x47f49c['query']=_[_0xac4a('0x2c')](_0x2772fe[_0xac4a('0x2e')]);_0x47f49c[_0xac4a('0x2f')]=_[_0xac4a('0x30')](_0x47f49c[_0xac4a('0x2b')],_0x47f49c['query']);_0x4a5a9e[_0xac4a('0x31')]=_['intersection'](_0x47f49c[_0xac4a('0x2b')],qs['fields'](_0x2772fe[_0xac4a('0x2e')][_0xac4a('0x32')]));_0x4a5a9e[_0xac4a('0x31')]=_0x4a5a9e[_0xac4a('0x31')][_0xac4a('0x33')]?_0x4a5a9e[_0xac4a('0x31')]:_0x47f49c[_0xac4a('0x2b')];_0x4a5a9e=_[_0xac4a('0x34')]({},_0x4a5a9e,_0x2772fe[_0xac4a('0x35')]);return utilLicense[_0xac4a('0x36')](_0x4a5a9e)[_0xac4a('0x24')](respondWithResult(_0x116700,null))[_0xac4a('0x37')](handleError(_0x116700,null));};exports[_0xac4a('0x23')]=function(_0x1a9d4e,_0x5634e2){if(_0x1a9d4e[_0xac4a('0x38')]['id']){delete _0x1a9d4e[_0xac4a('0x38')]['id'];}return db['License'][_0xac4a('0x39')]({'where':{'id':_0x1a9d4e[_0xac4a('0x3a')]['id']}})['then'](handleEntityNotFound(_0x5634e2,null))['then'](function(_0x11f0be){var _0x1ba096=_0x11f0be[_0xac4a('0x3b')]({'plain':!![]});return utilLicense[_0xac4a('0x3c')](_0x1ba096,_0x1a9d4e['body'][_0xac4a('0x3d')]);})[_0xac4a('0x24')](function(_0x4e7630){if(!_0x4e7630[_0xac4a('0x3e')]){return saveUpdates(_0x1a9d4e[_0xac4a('0x38')],null);}return _0x4e7630;})[_0xac4a('0x24')](respondWithResult(_0x5634e2,null))['catch'](handleError(_0x5634e2,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 4a790a5..ae45cc5 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 _0x10fc=['request-promise','path','rimraf','./license.attributes','define','License','license','lodash','moment','bluebird'];(function(_0x4d534b,_0x40ade7){var _0x5226bf=function(_0x570d60){while(--_0x570d60){_0x4d534b['push'](_0x4d534b['shift']());}};_0x5226bf(++_0x40ade7);}(_0x10fc,0x10b));var _0xc10f=function(_0x170337,_0xe7c4e7){_0x170337=_0x170337-0x0;var _0x5c39c1=_0x10fc[_0x170337];return _0x5c39c1;};'use strict';var _=require(_0xc10f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc10f('0x1'));var BPromise=require(_0xc10f('0x2'));var rp=require(_0xc10f('0x3'));var fs=require('fs');var path=require(_0xc10f('0x4'));var rimraf=require(_0xc10f('0x5'));var config=require('../../config/environment');var attributes=require(_0xc10f('0x6'));module['exports']=function(_0x29dc93,_0x28f6e3){return _0x29dc93[_0xc10f('0x7')](_0xc10f('0x8'),attributes,{'tableName':_0xc10f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6975=['License','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./license.attributes','exports'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0x6975,0x182));var _0x5697=function(_0x2110bb,_0x5bf49e){_0x2110bb=_0x2110bb-0x0;var _0x5cf87c=_0x6975[_0x2110bb];return _0x5cf87c;};'use strict';var _=require(_0x5697('0x0'));var util=require('util');var logger=require(_0x5697('0x1'))(_0x5697('0x2'));var moment=require(_0x5697('0x3'));var BPromise=require(_0x5697('0x4'));var rp=require(_0x5697('0x5'));var fs=require('fs');var path=require(_0x5697('0x6'));var rimraf=require(_0x5697('0x7'));var config=require('../../config/environment');var attributes=require(_0x5697('0x8'));module[_0x5697('0x9')]=function(_0x4486ff,_0x54a33b){return _0x4486ff['define'](_0x5697('0xa'),attributes,{'tableName':'license','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 1bc0f3d..be942d0 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 _0x8980=['debug','License,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','License,\x20%s,\x20%s','request\x20sent'];(function(_0x4e9665,_0x4cabd8){var _0x38e12c=function(_0x270d8c){while(--_0x270d8c){_0x4e9665['push'](_0x4e9665['shift']());}};_0x38e12c(++_0x4cabd8);}(_0x8980,0x195));var _0x0898=function(_0x588a9c,_0x434e22){_0x588a9c=_0x588a9c-0x0;var _0x32ab03=_0x8980[_0x588a9c];return _0x32ab03;};'use strict';var _=require(_0x0898('0x0'));var util=require('util');var moment=require(_0x0898('0x1'));var BPromise=require(_0x0898('0x2'));var rs=require(_0x0898('0x3'));var fs=require('fs');var Redis=require(_0x0898('0x4'));var db=require(_0x0898('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0898('0x6'))(_0x0898('0x7'));var config=require('../../config/environment');var jayson=require(_0x0898('0x8'));var client=jayson[_0x0898('0x9')][_0x0898('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x312760,_0x7a1583,_0x1f5096){return new BPromise(function(_0x1725ba,_0x3f301f){return client[_0x0898('0xb')](_0x312760,_0x1f5096)['then'](function(_0x3920d9){logger[_0x0898('0xc')](_0x0898('0xd'),_0x7a1583,_0x0898('0xe'));logger[_0x0898('0xf')](_0x0898('0x10'),_0x7a1583,'request\x20sent',JSON['stringify'](_0x3920d9));if(_0x3920d9['error']){if(_0x3920d9[_0x0898('0x11')]['code']===0x1f4){logger[_0x0898('0x11')](_0x0898('0xd'),_0x7a1583,_0x3920d9['error'][_0x0898('0x12')]);return _0x3f301f(_0x3920d9[_0x0898('0x11')][_0x0898('0x12')]);}logger[_0x0898('0x11')]('License,\x20%s,\x20%s',_0x7a1583,_0x3920d9[_0x0898('0x11')]['message']);return _0x1725ba(_0x3920d9[_0x0898('0x11')][_0x0898('0x12')]);}else{logger['info'](_0x0898('0xd'),_0x7a1583,_0x0898('0xe'));_0x1725ba(_0x3920d9['result'][_0x0898('0x12')]);}})[_0x0898('0x13')](function(_0x161f58){logger[_0x0898('0x11')](_0x0898('0xd'),_0x7a1583,_0x161f58);_0x3f301f(_0x161f58);});});} \ No newline at end of file +var _0x3e11=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util'];(function(_0x492506,_0x291693){var _0x19c58b=function(_0x2b4100){while(--_0x2b4100){_0x492506['push'](_0x492506['shift']());}};_0x19c58b(++_0x291693);}(_0x3e11,0x82));var _0x13e1=function(_0x45589d,_0x43e4d3){_0x45589d=_0x45589d-0x0;var _0xd1a00d=_0x3e11[_0x45589d];return _0xd1a00d;};'use strict';var _=require(_0x13e1('0x0'));var util=require(_0x13e1('0x1'));var moment=require(_0x13e1('0x2'));var BPromise=require(_0x13e1('0x3'));var rs=require(_0x13e1('0x4'));var fs=require('fs');var Redis=require(_0x13e1('0x5'));var db=require(_0x13e1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x13e1('0x7'))(_0x13e1('0x8'));var config=require(_0x13e1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x13e1('0xa')][_0x13e1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e6be6,_0x5d47f0,_0x40c997){return new BPromise(function(_0x46cc57,_0x59c813){return client[_0x13e1('0xc')](_0x1e6be6,_0x40c997)[_0x13e1('0xd')](function(_0xa44dd5){logger['info'](_0x13e1('0xe'),_0x5d47f0,_0x13e1('0xf'));logger[_0x13e1('0x10')](_0x13e1('0x11'),_0x5d47f0,_0x13e1('0xf'),JSON['stringify'](_0xa44dd5));if(_0xa44dd5['error']){if(_0xa44dd5[_0x13e1('0x12')][_0x13e1('0x13')]===0x1f4){logger[_0x13e1('0x12')](_0x13e1('0xe'),_0x5d47f0,_0xa44dd5[_0x13e1('0x12')][_0x13e1('0x14')]);return _0x59c813(_0xa44dd5[_0x13e1('0x12')]['message']);}logger[_0x13e1('0x12')](_0x13e1('0xe'),_0x5d47f0,_0xa44dd5['error'][_0x13e1('0x14')]);return _0x46cc57(_0xa44dd5['error'][_0x13e1('0x14')]);}else{logger['info']('License,\x20%s,\x20%s',_0x5d47f0,_0x13e1('0xf'));_0x46cc57(_0xa44dd5[_0x13e1('0x15')][_0x13e1('0x14')]);}})['catch'](function(_0x1629be){logger[_0x13e1('0x12')]('License,\x20%s,\x20%s',_0x5d47f0,_0x1629be);_0x59c813(_0x1629be);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index a3a0203..f0d05f0 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 _0x138f=['index','get','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','getAgents','post','addDisposition','addAnswer','create','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','send','/:id/users','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1dcf0b,_0x4ab222){var _0x17cf9f=function(_0x1a2048){while(--_0x1a2048){_0x1dcf0b['push'](_0x1dcf0b['shift']());}};_0x17cf9f(++_0x4ab222);}(_0x138f,0x143));var _0xf138=function(_0x1fd5eb,_0x235203){_0x1fd5eb=_0x1fd5eb-0x0;var _0x102365=_0x138f[_0x1fd5eb];return _0x102365;};'use strict';var multer=require('multer');var util=require(_0xf138('0x0'));var path=require('path');var timeout=require(_0xf138('0x1'));var express=require('express');var router=express[_0xf138('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xf138('0x3'));var interaction=require(_0xf138('0x4'));var config=require(_0xf138('0x5'));var controller=require('./mailAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xf138('0x6')]);router[_0xf138('0x7')](_0xf138('0x8'),auth[_0xf138('0x9')](),controller[_0xf138('0xa')]);router['get'](_0xf138('0xb'),auth['isAuthenticated'](),controller[_0xf138('0xc')]);router['get'](_0xf138('0xd'),auth['isAuthenticated'](),controller[_0xf138('0xe')]);router[_0xf138('0x7')](_0xf138('0xf'),auth[_0xf138('0x9')](),controller[_0xf138('0x10')]);router[_0xf138('0x7')](_0xf138('0x11'),auth['isAuthenticated'](),controller[_0xf138('0x12')]);router[_0xf138('0x7')]('/:id/out_servers',auth['isAuthenticated'](),controller['getSmtp']);router['get'](_0xf138('0x13'),auth[_0xf138('0x9')](),controller[_0xf138('0x14')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0xf138('0x15')]);router[_0xf138('0x7')](_0xf138('0x16'),auth[_0xf138('0x9')](),controller[_0xf138('0x17')]);router[_0xf138('0x7')](_0xf138('0x18'),auth[_0xf138('0x9')](),controller[_0xf138('0x19')]);router['get']('/:id/users',auth[_0xf138('0x9')](),controller[_0xf138('0x1a')]);router[_0xf138('0x1b')](_0xf138('0xd'),auth[_0xf138('0x9')](),controller[_0xf138('0x1c')]);router[_0xf138('0x1b')](_0xf138('0xf'),auth[_0xf138('0x9')](),controller[_0xf138('0x1d')]);router['post']('/',auth[_0xf138('0x9')](),controller[_0xf138('0x1e')]);router[_0xf138('0x1b')]('/:id/in_servers',auth[_0xf138('0x9')](),controller[_0xf138('0x1f')]);router['post'](_0xf138('0x20'),auth['isAuthenticated'](),controller[_0xf138('0x21')]);router[_0xf138('0x1b')]('/:id/interactions',auth[_0xf138('0x9')](),controller[_0xf138('0x22')]);router[_0xf138('0x1b')]('/:id/applications',auth[_0xf138('0x9')](),controller[_0xf138('0x23')]);router[_0xf138('0x1b')]('/:id/send',auth[_0xf138('0x9')](),controller[_0xf138('0x24')]);router[_0xf138('0x1b')](_0xf138('0x25'),auth[_0xf138('0x9')](),controller[_0xf138('0x26')]);router[_0xf138('0x27')]('/:id',auth[_0xf138('0x9')](),controller['update']);router[_0xf138('0x28')](_0xf138('0xd'),auth[_0xf138('0x9')](),controller[_0xf138('0x29')]);router['delete']('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xf138('0x2a')]);router[_0xf138('0x28')](_0xf138('0x11'),auth[_0xf138('0x9')](),controller[_0xf138('0x2b')]);router[_0xf138('0x28')](_0xf138('0x20'),auth['isAuthenticated'](),controller[_0xf138('0x2c')]);router['delete'](_0xf138('0xb'),auth[_0xf138('0x9')](),controller[_0xf138('0x2d')]);router[_0xf138('0x28')](_0xf138('0x25'),auth['isAuthenticated'](),controller[_0xf138('0x2e')]);module['exports']=router; \ No newline at end of file +var _0xf6a9=['addDisposition','addAnswer','addImap','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','/:id/in_servers','removeImap','/:id/out_servers','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/users','post'];(function(_0x1d130e,_0x314633){var _0x156c2f=function(_0x5751d2){while(--_0x5751d2){_0x1d130e['push'](_0x1d130e['shift']());}};_0x156c2f(++_0x314633);}(_0xf6a9,0xd9));var _0x9f6a=function(_0x8696fd,_0x1f748f){_0x8696fd=_0x8696fd-0x0;var _0x41c548=_0xf6a9[_0x8696fd];return _0x41c548;};'use strict';var multer=require(_0x9f6a('0x0'));var util=require(_0x9f6a('0x1'));var path=require(_0x9f6a('0x2'));var timeout=require(_0x9f6a('0x3'));var express=require(_0x9f6a('0x4'));var router=express[_0x9f6a('0x5')]();var fs_extra=require(_0x9f6a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9f6a('0x7'));var config=require(_0x9f6a('0x8'));var controller=require('./mailAccount.controller');router[_0x9f6a('0x9')]('/',auth[_0x9f6a('0xa')](),controller[_0x9f6a('0xb')]);router[_0x9f6a('0x9')](_0x9f6a('0xc'),auth['isAuthenticated'](),controller[_0x9f6a('0xd')]);router[_0x9f6a('0x9')](_0x9f6a('0xe'),auth[_0x9f6a('0xa')](),controller[_0x9f6a('0xf')]);router[_0x9f6a('0x9')](_0x9f6a('0x10'),auth[_0x9f6a('0xa')](),controller[_0x9f6a('0x11')]);router[_0x9f6a('0x9')](_0x9f6a('0x12'),auth[_0x9f6a('0xa')](),controller['getAnswers']);router[_0x9f6a('0x9')]('/:id/in_servers',auth[_0x9f6a('0xa')](),controller[_0x9f6a('0x13')]);router[_0x9f6a('0x9')]('/:id/out_servers',auth[_0x9f6a('0xa')](),controller[_0x9f6a('0x14')]);router['get'](_0x9f6a('0x15'),auth[_0x9f6a('0xa')](),controller[_0x9f6a('0x16')]);router[_0x9f6a('0x9')](_0x9f6a('0x17'),auth['isAuthenticated'](),controller[_0x9f6a('0x18')]);router['get'](_0x9f6a('0x19'),auth[_0x9f6a('0xa')](),controller['getMessages']);router[_0x9f6a('0x9')]('/:id/verify',auth[_0x9f6a('0xa')](),controller['verifySmtp']);router[_0x9f6a('0x9')](_0x9f6a('0x1a'),auth[_0x9f6a('0xa')](),controller['getAgents']);router[_0x9f6a('0x1b')]('/:id/dispositions',auth[_0x9f6a('0xa')](),controller[_0x9f6a('0x1c')]);router['post'](_0x9f6a('0x12'),auth[_0x9f6a('0xa')](),controller[_0x9f6a('0x1d')]);router['post']('/',auth[_0x9f6a('0xa')](),controller['create']);router['post']('/:id/in_servers',auth[_0x9f6a('0xa')](),controller[_0x9f6a('0x1e')]);router[_0x9f6a('0x1b')]('/:id/out_servers',auth[_0x9f6a('0xa')](),controller[_0x9f6a('0x1f')]);router[_0x9f6a('0x1b')](_0x9f6a('0x15'),auth[_0x9f6a('0xa')](),controller[_0x9f6a('0x20')]);router['post'](_0x9f6a('0x17'),auth[_0x9f6a('0xa')](),controller[_0x9f6a('0x21')]);router['post'](_0x9f6a('0x22'),auth[_0x9f6a('0xa')](),controller[_0x9f6a('0x23')]);router[_0x9f6a('0x1b')](_0x9f6a('0x1a'),auth['isAuthenticated'](),controller[_0x9f6a('0x24')]);router[_0x9f6a('0x25')](_0x9f6a('0xe'),auth['isAuthenticated'](),controller[_0x9f6a('0x26')]);router[_0x9f6a('0x27')](_0x9f6a('0x10'),auth[_0x9f6a('0xa')](),controller[_0x9f6a('0x28')]);router[_0x9f6a('0x27')](_0x9f6a('0x12'),auth['isAuthenticated'](),controller[_0x9f6a('0x29')]);router['delete'](_0x9f6a('0x2a'),auth[_0x9f6a('0xa')](),controller[_0x9f6a('0x2b')]);router[_0x9f6a('0x27')](_0x9f6a('0x2c'),auth[_0x9f6a('0xa')](),controller[_0x9f6a('0x2d')]);router[_0x9f6a('0x27')]('/:id',auth[_0x9f6a('0xa')](),controller[_0x9f6a('0x2e')]);router[_0x9f6a('0x27')](_0x9f6a('0x1a'),auth[_0x9f6a('0xa')](),controller[_0x9f6a('0x2f')]);module[_0x9f6a('0x30')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 30986e2..88e8db6 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(_0x2fbc2d,_0x2450cc){var _0x31155f=function(_0x437864){while(--_0x437864){_0x2fbc2d['push'](_0x2fbc2d['shift']());}};_0x31155f(++_0x2450cc);}(_0x7d86,0x86));var _0x67d8=function(_0x327eee,_0x48918f){_0x327eee=_0x327eee-0x0;var _0xe83c68=_0x7d86[_0x327eee];return _0xe83c68;};'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 _0x1159=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','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'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0x1159,0xf3));var _0x9115=function(_0x1a1978,_0x2616b1){_0x1a1978=_0x1a1978-0x0;var _0x6b261c=_0x1159[_0x1a1978];return _0x6b261c;};'use strict';var Sequelize=require(_0x9115('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x9115('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x9115('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x9115('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9115('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0x9115('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x9115('0x3')]},'markAsUnread':{'type':Sequelize[_0x9115('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x9115('0x1')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x9115('0x4')](0x2)[_0x9115('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9115('0x3')],'defaultValue':function(){return _0x9115('0x6');}},'notificationSound':{'type':Sequelize[_0x9115('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9115('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9115('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9115('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9115('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x9115('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9115('0x8'),'set':function(_0x170177){if(!_0x170177)this[_0x9115('0x9')](_0x9115('0xa'),null);this['setDataValue'](_0x9115('0xb'),_0x170177);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 5fc5f74..8ef7977 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 _0x35e2=['ids','CannedAnswer','create','getAnswers','removeAnswers','key','email','ListId','description','isNil','cservice','cauthentication','user','cuser','password','authentication','host','port','service','pass','cpassword','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','Owner','fullname','Tag','color','tag','addApplications','sequelize','transaction','MailApplication','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','CmList','updatedAt','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','List','Contacts','CmContact','List\x20not\x20found','subject','attach','out','messageId','Interaction','Messages','verifySmtp','VerifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','crypto','jsforce','desk.js','querystring','html-to-text','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','stack','name','index','MailServerIn','Smtp','map','MailAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Imap','MailServerOut','Pause','mandatoryDispositionPause','find','body','describe','addDisposition','MailAccountId','Disposition','getDispositions','findOne','hasOwnProperty','order','removeDispositions'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0x35e2,0x122));var _0x235e=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x35e2[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0x235e('0x0'));var rimraf=require(_0x235e('0x1'));var zipdir=require(_0x235e('0x2'));var jsonpatch=require(_0x235e('0x3'));var rp=require(_0x235e('0x4'));var moment=require(_0x235e('0x5'));var BPromise=require(_0x235e('0x6'));var Mustache=require(_0x235e('0x7'));var util=require(_0x235e('0x8'));var path=require(_0x235e('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x235e('0xa'));var _=require(_0x235e('0xb'));var squel=require('squel');var crypto=require(_0x235e('0xc'));var jsforce=require(_0x235e('0xd'));var deskjs=require(_0x235e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x235e('0xf'));var Papa=require('papaparse');var htmlToText=require(_0x235e('0x10'));var juice=require('juice');var Redis=require(_0x235e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x235e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x235e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x235e('0x14'));var licenseUtil=require(_0x235e('0x15'));var db=require(_0x235e('0x16'))['db'];config[_0x235e('0x17')]=_['defaults'](config[_0x235e('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x235e('0x18'))(new Redis(config['redis']));require(_0x235e('0x19'))[_0x235e('0x1a')](socket);var jayson=require(_0x235e('0x1b'));var client=jayson[_0x235e('0x1c')][_0x235e('0x1d')]({'port':0x232b});function respondWithRpcPromise(_0x34327f,_0x5e7deb,_0x46e490,_0x36dbdf){return new BPromise(function(_0x2fd124,_0x25c404){var _0x1fc692=_0x36dbdf||client;return _0x1fc692[_0x235e('0x1e')](_0x34327f,_0x46e490)[_0x235e('0x1f')](function(_0x21c912){logger[_0x235e('0x20')](_0x235e('0x21'),_0x5e7deb,_0x235e('0x22'));logger[_0x235e('0x23')](_0x235e('0x24'),_0x5e7deb,_0x235e('0x22'),JSON[_0x235e('0x25')](_0x21c912));if(_0x21c912['error']){if(_0x21c912['error'][_0x235e('0x26')]===0x1f4){logger[_0x235e('0x27')](_0x235e('0x21'),_0x5e7deb,_0x21c912[_0x235e('0x27')]['message']);return _0x25c404(_0x21c912[_0x235e('0x27')]['message']);}logger[_0x235e('0x27')](_0x235e('0x21'),_0x5e7deb,_0x21c912[_0x235e('0x27')][_0x235e('0x28')]);return _0x2fd124(_0x21c912[_0x235e('0x27')]['message']);}else{logger[_0x235e('0x20')](_0x235e('0x21'),_0x5e7deb,'request\x20sent');_0x2fd124(_0x21c912[_0x235e('0x29')]['message']);}})[_0x235e('0x2a')](function(_0x412cfc){logger[_0x235e('0x27')](_0x235e('0x21'),_0x5e7deb,_0x412cfc);_0x25c404(_0x412cfc);});});}function respondWithStatusCode(_0x5b8ee4,_0x5cca54){_0x5cca54=_0x5cca54||0xcc;return function(_0x3a638b){if(_0x3a638b){return _0x5b8ee4[_0x235e('0x2b')](_0x5cca54);}return _0x5b8ee4['status'](_0x5cca54)[_0x235e('0x2c')]();};}function respondWithResult(_0x5c74ca,_0x37ea03){_0x37ea03=_0x37ea03||0xc8;return function(_0x1751a5){if(_0x1751a5){return _0x5c74ca[_0x235e('0x2d')](_0x37ea03)[_0x235e('0x2e')](_0x1751a5);}};}function respondWithFilteredResult(_0x568713,_0x4c0b67){return function(_0x315d74){if(_0x315d74){var _0x5c45f6=typeof _0x4c0b67[_0x235e('0x2f')]===_0x235e('0x30')&&typeof _0x4c0b67[_0x235e('0x31')]===_0x235e('0x30');var _0x1bbafe=_0x315d74[_0x235e('0x32')];var _0x26f5a5=_0x5c45f6?0x0:_0x4c0b67[_0x235e('0x2f')];var _0x3003e1=_0x5c45f6?_0x315d74[_0x235e('0x32')]:_0x4c0b67[_0x235e('0x2f')]+_0x4c0b67[_0x235e('0x31')];var _0x1617d0;if(_0x3003e1>=_0x1bbafe){_0x3003e1=_0x1bbafe;_0x1617d0=0xc8;}else{_0x1617d0=0xce;}_0x568713['status'](_0x1617d0);return _0x568713[_0x235e('0x33')](_0x235e('0x34'),_0x26f5a5+'-'+_0x3003e1+'/'+_0x1bbafe)[_0x235e('0x2e')](_0x315d74);}return null;};}function patchUpdates(_0x25533f){return function(_0x5c14fa){try{jsonpatch['apply'](_0x5c14fa,_0x25533f,!![]);}catch(_0x21c20b){return BPromise[_0x235e('0x35')](_0x21c20b);}return _0x5c14fa[_0x235e('0x36')]();};}function saveUpdates(_0x409d53,_0x147e11){return function(_0xadccc7){if(_0xadccc7){return _0xadccc7[_0x235e('0x37')](_0x409d53)[_0x235e('0x1f')](function(_0x13f062){return _0x13f062;});}return null;};}function removeEntity(_0x5c7693,_0x48401d){return function(_0x5e123a){if(_0x5e123a){return _0x5e123a[_0x235e('0x38')]()['then'](function(){var _0x22c0d1=_0x5e123a['get']({'plain':!![]});var _0xd35541='MailAccounts';return db['UserProfileResource'][_0x235e('0x38')]({'where':{'type':_0xd35541,'resourceId':_0x22c0d1['id']}})[_0x235e('0x1f')](function(){return _0x5e123a;});})[_0x235e('0x1f')](function(){_0x5c7693[_0x235e('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x961d4a,_0x58537c){return function(_0x981a13){if(!_0x981a13){_0x961d4a['sendStatus'](0x194);}return _0x981a13;};}function handleError(_0x1aa9ba,_0x3b6228){_0x3b6228=_0x3b6228||0x1f4;return function(_0x5d34b2){logger[_0x235e('0x27')](_0x5d34b2[_0x235e('0x39')]);if(_0x5d34b2[_0x235e('0x3a')]){delete _0x5d34b2[_0x235e('0x3a')];}_0x1aa9ba['status'](_0x3b6228)['send'](_0x5d34b2);};}exports[_0x235e('0x3b')]=function(_0x372e84,_0x20fdbc){var _0x2c98e6={'include':[{'model':db[_0x235e('0x3c')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x235e('0x3d')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x343b82={},_0x5a90aa={'count':0x0,'rows':[]};var _0x5b0925=_[_0x235e('0x3e')](db[_0x235e('0x3f')][_0x235e('0x40')],function(_0x5c05dd){return{'name':_0x5c05dd[_0x235e('0x41')],'type':_0x5c05dd[_0x235e('0x42')]['key']};});_0x343b82[_0x235e('0x43')]=_[_0x235e('0x3e')](_0x5b0925,_0x235e('0x3a'));_0x343b82[_0x235e('0x44')]=_[_0x235e('0x45')](_0x372e84[_0x235e('0x44')]);_0x343b82[_0x235e('0x46')]=_[_0x235e('0x47')](_0x343b82[_0x235e('0x43')],_0x343b82['query']);_0x2c98e6[_0x235e('0x48')]=_['intersection'](_0x343b82[_0x235e('0x43')],qs['fields'](_0x372e84['query'][_0x235e('0x49')]));_0x2c98e6[_0x235e('0x48')]=_0x2c98e6[_0x235e('0x48')][_0x235e('0x4a')]?_0x2c98e6['attributes']:_0x343b82[_0x235e('0x43')];if(!_0x372e84[_0x235e('0x44')]['hasOwnProperty'](_0x235e('0x4b'))){_0x2c98e6[_0x235e('0x31')]=qs['limit'](_0x372e84[_0x235e('0x44')]['limit']);_0x2c98e6[_0x235e('0x2f')]=qs['offset'](_0x372e84['query']['offset']);}_0x2c98e6['order']=qs[_0x235e('0x4c')](_0x372e84[_0x235e('0x44')]['sort']);_0x2c98e6[_0x235e('0x4d')]=qs[_0x235e('0x46')](_[_0x235e('0x4e')](_0x372e84['query'],_0x343b82['filters']),_0x5b0925);if(_0x372e84[_0x235e('0x44')][_0x235e('0x4f')]){_0x2c98e6[_0x235e('0x4d')]=_[_0x235e('0x50')](_0x2c98e6[_0x235e('0x4d')],{'$or':_[_0x235e('0x3e')](_0x5b0925,function(_0x5440d4){if(_0x5440d4['type']!==_0x235e('0x51')){var _0x108327={};_0x108327[_0x5440d4[_0x235e('0x3a')]]={'$like':'%'+_0x372e84[_0x235e('0x44')][_0x235e('0x4f')]+'%'};return _0x108327;}})});}_0x2c98e6=_[_0x235e('0x50')]({},_0x2c98e6,_0x372e84[_0x235e('0x52')]);var _0x3e9e56={'where':_0x2c98e6[_0x235e('0x4d')]};return db[_0x235e('0x3f')][_0x235e('0x32')](_0x3e9e56)['then'](function(_0x39803b){_0x5a90aa[_0x235e('0x32')]=_0x39803b;if(_0x372e84[_0x235e('0x44')][_0x235e('0x53')]){_0x2c98e6[_0x235e('0x54')]=[{'all':!![]}];}return db[_0x235e('0x3f')][_0x235e('0x55')](_0x2c98e6);})['then'](function(_0x5cdf80){_0x5a90aa[_0x235e('0x56')]=_0x5cdf80;return _0x5a90aa;})['then'](respondWithFilteredResult(_0x20fdbc,_0x2c98e6))[_0x235e('0x2a')](handleError(_0x20fdbc,null));};exports[_0x235e('0x57')]=function(_0x1f82a6,_0x2dff67){var _0x11ed26={'raw':![],'where':{'id':_0x1f82a6[_0x235e('0x58')]['id']},'include':[{'model':db[_0x235e('0x3c')],'as':_0x235e('0x59')},{'model':db[_0x235e('0x5a')],'as':_0x235e('0x3d')},{'model':db[_0x235e('0x5b')],'as':_0x235e('0x5c')}]},_0x52cb23={};_0x52cb23[_0x235e('0x43')]=_[_0x235e('0x45')](db[_0x235e('0x3f')][_0x235e('0x40')]);_0x52cb23[_0x235e('0x44')]=_[_0x235e('0x45')](_0x1f82a6[_0x235e('0x44')]);_0x52cb23[_0x235e('0x46')]=_['intersection'](_0x52cb23['model'],_0x52cb23[_0x235e('0x44')]);_0x11ed26[_0x235e('0x48')]=_[_0x235e('0x47')](_0x52cb23[_0x235e('0x43')],qs[_0x235e('0x49')](_0x1f82a6['query'][_0x235e('0x49')]));_0x11ed26[_0x235e('0x48')]=_0x11ed26[_0x235e('0x48')]['length']?_0x11ed26[_0x235e('0x48')]:_0x52cb23[_0x235e('0x43')];if(_0x1f82a6[_0x235e('0x44')][_0x235e('0x53')]){_0x11ed26[_0x235e('0x54')]=[{'all':!![]}];}_0x11ed26=_[_0x235e('0x50')]({},_0x11ed26,_0x1f82a6[_0x235e('0x52')]);return db[_0x235e('0x3f')][_0x235e('0x5d')](_0x11ed26)['then'](handleEntityNotFound(_0x2dff67,null))[_0x235e('0x1f')](respondWithResult(_0x2dff67,null))[_0x235e('0x2a')](handleError(_0x2dff67,null));};exports[_0x235e('0x37')]=function(_0x1adcd6,_0x2fec51){if(_0x1adcd6[_0x235e('0x5e')]['id']){delete _0x1adcd6[_0x235e('0x5e')]['id'];}return db[_0x235e('0x3f')]['find']({'where':{'id':_0x1adcd6['params']['id']},'include':[{'model':db[_0x235e('0x3c')],'as':'Imap'},{'model':db[_0x235e('0x5a')],'as':_0x235e('0x3d')},{'model':db[_0x235e('0x5b')],'as':_0x235e('0x5c')}]})[_0x235e('0x1f')](handleEntityNotFound(_0x2fec51,null))[_0x235e('0x1f')](saveUpdates(_0x1adcd6['body'],null))['then'](function(_0x3d5f6b){if(_0x3d5f6b&&_0x1adcd6[_0x235e('0x5e')]['Imap']){return db[_0x235e('0x3c')][_0x235e('0x37')](_0x1adcd6[_0x235e('0x5e')][_0x235e('0x59')],{'where':{'MailAccountId':_0x3d5f6b['id']}})[_0x235e('0x1f')](function(){return _0x3d5f6b;});}return _0x3d5f6b;})[_0x235e('0x1f')](function(_0xd30dc2){if(_0xd30dc2&&_0x1adcd6[_0x235e('0x5e')][_0x235e('0x3d')]){return db[_0x235e('0x5a')]['update'](_0x1adcd6[_0x235e('0x5e')][_0x235e('0x3d')],{'where':{'MailAccountId':_0xd30dc2['id']}})[_0x235e('0x1f')](function(){return _0xd30dc2;});}return _0xd30dc2;})['then'](respondWithResult(_0x2fec51,null))['catch'](handleError(_0x2fec51,null));};exports[_0x235e('0x5f')]=function(_0x3dd019,_0xf9c864){return db['MailAccount'][_0x235e('0x5f')]()[_0x235e('0x1f')](respondWithResult(_0xf9c864,null))[_0x235e('0x2a')](handleError(_0xf9c864,null));};exports[_0x235e('0x60')]=function(_0x46cb0d,_0x157362,_0xda96da){if(_0x46cb0d[_0x235e('0x5e')]['id']){delete _0x46cb0d['body']['id'];}return db[_0x235e('0x3f')][_0x235e('0x5d')]({'where':{'id':_0x46cb0d[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x157362,null))[_0x235e('0x1f')](function(_0x4f9e51){if(_0x4f9e51){_0x46cb0d[_0x235e('0x5e')][_0x235e('0x61')]=_0x4f9e51['id'];return db[_0x235e('0x62')]['create'](_0x46cb0d[_0x235e('0x5e')]);}})[_0x235e('0x1f')](respondWithResult(_0x157362,null))[_0x235e('0x2a')](handleError(_0x157362,null));};exports[_0x235e('0x63')]=function(_0x59654d,_0x192c9d,_0x422c73){var _0x992578={'raw':![],'where':{}};var _0x4a3ef5={};var _0x3ee7d7={'count':0x0,'rows':[]};return db['MailAccount'][_0x235e('0x64')]({'where':{'id':_0x59654d['params']['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x192c9d,null))[_0x235e('0x1f')](function(_0x405569){if(_0x405569){_0x4a3ef5[_0x235e('0x43')]=_[_0x235e('0x45')](db[_0x235e('0x62')]['rawAttributes']);_0x4a3ef5[_0x235e('0x44')]=_[_0x235e('0x45')](_0x59654d[_0x235e('0x44')]);_0x4a3ef5['filters']=_[_0x235e('0x47')](_0x4a3ef5['model'],_0x4a3ef5[_0x235e('0x44')]);_0x992578[_0x235e('0x48')]=_[_0x235e('0x47')](_0x4a3ef5[_0x235e('0x43')],qs[_0x235e('0x49')](_0x59654d[_0x235e('0x44')][_0x235e('0x49')]));_0x992578[_0x235e('0x48')]=_0x992578['attributes'][_0x235e('0x4a')]?_0x992578[_0x235e('0x48')]:_0x4a3ef5[_0x235e('0x43')];if(!_0x59654d[_0x235e('0x44')][_0x235e('0x65')](_0x235e('0x4b'))){_0x992578['limit']=qs[_0x235e('0x31')](_0x59654d[_0x235e('0x44')][_0x235e('0x31')]);_0x992578[_0x235e('0x2f')]=qs[_0x235e('0x2f')](_0x59654d['query'][_0x235e('0x2f')]);}_0x992578[_0x235e('0x66')]=qs[_0x235e('0x4c')](_0x59654d['query'][_0x235e('0x4c')]);_0x992578[_0x235e('0x4d')]=qs['filters'](_[_0x235e('0x4e')](_0x59654d[_0x235e('0x44')],_0x4a3ef5[_0x235e('0x46')]));_0x992578[_0x235e('0x4d')]['MailAccountId']=_0x405569['id'];if(_0x59654d[_0x235e('0x44')][_0x235e('0x4f')]){_0x992578['where']=_[_0x235e('0x50')](_0x992578['where'],{'$or':_[_0x235e('0x3e')](_0x992578['attributes'],function(_0x4f8383){var _0x50b4e2={};_0x50b4e2[_0x4f8383]={'$like':'%'+_0x59654d[_0x235e('0x44')][_0x235e('0x4f')]+'%'};return _0x50b4e2;})});}_0x992578=_[_0x235e('0x50')]({},_0x992578,_0x59654d['options']);return db[_0x235e('0x62')]['count']({'where':_0x992578[_0x235e('0x4d')]})[_0x235e('0x1f')](function(_0x173b17){_0x3ee7d7[_0x235e('0x32')]=_0x173b17;if(_0x59654d['query']['includeAll']){_0x992578[_0x235e('0x54')]=[{'all':!![]}];}return db[_0x235e('0x62')][_0x235e('0x55')](_0x992578);})[_0x235e('0x1f')](function(_0x27a80b){_0x3ee7d7[_0x235e('0x56')]=_0x27a80b;return _0x3ee7d7;});}})['then'](respondWithFilteredResult(_0x192c9d,_0x992578))[_0x235e('0x2a')](handleError(_0x192c9d,null));};exports[_0x235e('0x67')]=function(_0x34c4db,_0x16a5e7,_0x3bc9c4){return db[_0x235e('0x3f')][_0x235e('0x5d')]({'where':{'id':_0x34c4db[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x16a5e7,null))[_0x235e('0x1f')](function(_0x586f2d){if(_0x586f2d){return _0x586f2d[_0x235e('0x67')](_0x34c4db[_0x235e('0x44')][_0x235e('0x68')]);}})[_0x235e('0x1f')](respondWithStatusCode(_0x16a5e7,null))['catch'](handleError(_0x16a5e7,null));};exports['addAnswer']=function(_0x1ffae0,_0x4e1fd7,_0x32bd16){if(_0x1ffae0[_0x235e('0x5e')]['id']){delete _0x1ffae0['body']['id'];}return db['MailAccount'][_0x235e('0x5d')]({'where':{'id':_0x1ffae0[_0x235e('0x58')]['id']}})['then'](handleEntityNotFound(_0x4e1fd7,null))[_0x235e('0x1f')](function(_0x20834d){if(_0x20834d){_0x1ffae0[_0x235e('0x5e')][_0x235e('0x61')]=_0x20834d['id'];return db[_0x235e('0x69')][_0x235e('0x6a')](_0x1ffae0[_0x235e('0x5e')]);}})[_0x235e('0x1f')](respondWithResult(_0x4e1fd7,null))[_0x235e('0x2a')](handleError(_0x4e1fd7,null));};exports[_0x235e('0x6b')]=function(_0x51f21b,_0x1529a6,_0x3aa04d){var _0x181fc8={'raw':![],'where':{}};var _0x264fdf={};var _0x9116c4={'count':0x0,'rows':[]};return db['MailAccount'][_0x235e('0x64')]({'where':{'id':_0x51f21b[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x1529a6,null))[_0x235e('0x1f')](function(_0x36ab43){if(_0x36ab43){_0x264fdf[_0x235e('0x43')]=_['keys'](db[_0x235e('0x69')][_0x235e('0x40')]);_0x264fdf[_0x235e('0x44')]=_[_0x235e('0x45')](_0x51f21b[_0x235e('0x44')]);_0x264fdf['filters']=_[_0x235e('0x47')](_0x264fdf[_0x235e('0x43')],_0x264fdf[_0x235e('0x44')]);_0x181fc8[_0x235e('0x48')]=_[_0x235e('0x47')](_0x264fdf[_0x235e('0x43')],qs[_0x235e('0x49')](_0x51f21b[_0x235e('0x44')][_0x235e('0x49')]));_0x181fc8[_0x235e('0x48')]=_0x181fc8[_0x235e('0x48')][_0x235e('0x4a')]?_0x181fc8[_0x235e('0x48')]:_0x264fdf[_0x235e('0x43')];if(!_0x51f21b['query'][_0x235e('0x65')](_0x235e('0x4b'))){_0x181fc8[_0x235e('0x31')]=qs[_0x235e('0x31')](_0x51f21b[_0x235e('0x44')]['limit']);_0x181fc8[_0x235e('0x2f')]=qs[_0x235e('0x2f')](_0x51f21b[_0x235e('0x44')][_0x235e('0x2f')]);}_0x181fc8['order']=qs['sort'](_0x51f21b[_0x235e('0x44')][_0x235e('0x4c')]);_0x181fc8[_0x235e('0x4d')]=qs['filters'](_[_0x235e('0x4e')](_0x51f21b[_0x235e('0x44')],_0x264fdf[_0x235e('0x46')]));_0x181fc8[_0x235e('0x4d')]['MailAccountId']=_0x36ab43['id'];if(_0x51f21b[_0x235e('0x44')][_0x235e('0x4f')]){_0x181fc8['where']=_[_0x235e('0x50')](_0x181fc8[_0x235e('0x4d')],{'$or':_[_0x235e('0x3e')](_0x181fc8[_0x235e('0x48')],function(_0x3f3e6f){var _0x3b708d={};_0x3b708d[_0x3f3e6f]={'$like':'%'+_0x51f21b[_0x235e('0x44')]['filter']+'%'};return _0x3b708d;})});}_0x181fc8=_['merge']({},_0x181fc8,_0x51f21b['options']);return db[_0x235e('0x69')][_0x235e('0x32')]({'where':_0x181fc8[_0x235e('0x4d')]})[_0x235e('0x1f')](function(_0x23a68d){_0x9116c4[_0x235e('0x32')]=_0x23a68d;if(_0x51f21b['query'][_0x235e('0x53')]){_0x181fc8[_0x235e('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x235e('0x55')](_0x181fc8);})['then'](function(_0x44593b){_0x9116c4['rows']=_0x44593b;return _0x9116c4;});}})[_0x235e('0x1f')](respondWithFilteredResult(_0x1529a6,_0x181fc8))[_0x235e('0x2a')](handleError(_0x1529a6,null));};exports['removeAnswers']=function(_0x57b623,_0x1146ca,_0x581a68){return db[_0x235e('0x3f')][_0x235e('0x5d')]({'where':{'id':_0x57b623[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x1146ca,null))['then'](function(_0x1213dc){if(_0x1213dc){return _0x1213dc[_0x235e('0x6c')](_0x57b623[_0x235e('0x44')][_0x235e('0x68')]);}})[_0x235e('0x1f')](respondWithStatusCode(_0x1146ca,null))[_0x235e('0x2a')](handleError(_0x1146ca,null));};exports[_0x235e('0x6a')]=function(_0x34c8e0,_0x3e5c83){var _0x17dc0b={'name':_0x34c8e0[_0x235e('0x5e')]['name'],'key':_0x34c8e0[_0x235e('0x5e')][_0x235e('0x6d')],'email':_0x34c8e0['body'][_0x235e('0x6e')],'ListId':_0x34c8e0[_0x235e('0x5e')][_0x235e('0x6f')],'active':!_['isNil'](_0x34c8e0['body']['active'])?_0x34c8e0[_0x235e('0x5e')]['active']:!![],'description':_0x34c8e0[_0x235e('0x5e')][_0x235e('0x70')]||null,'Imap':{},'Smtp':{}};if(_[_0x235e('0x71')](_0x34c8e0['body'][_0x235e('0x72')])){if(_0x34c8e0[_0x235e('0x5e')][_0x235e('0x73')]){_0x17dc0b[_0x235e('0x59')][_0x235e('0x74')]=_0x17dc0b['Smtp'][_0x235e('0x74')]=_0x34c8e0[_0x235e('0x5e')][_0x235e('0x75')];_0x17dc0b[_0x235e('0x59')][_0x235e('0x76')]=_0x17dc0b[_0x235e('0x3d')]['pass']=_0x34c8e0['body']['cpassword'];}else{_0x17dc0b[_0x235e('0x59')]['authentication']=_0x17dc0b[_0x235e('0x3d')][_0x235e('0x77')]=![];}_0x17dc0b['Imap'][_0x235e('0x78')]=_0x34c8e0[_0x235e('0x5e')]['Imap'][_0x235e('0x78')];_0x17dc0b['Imap']['port']=_0x34c8e0[_0x235e('0x5e')][_0x235e('0x59')][_0x235e('0x79')];_0x17dc0b[_0x235e('0x3d')][_0x235e('0x78')]=_0x34c8e0[_0x235e('0x5e')][_0x235e('0x3d')][_0x235e('0x78')];_0x17dc0b[_0x235e('0x3d')][_0x235e('0x79')]=_0x34c8e0['body']['Smtp'][_0x235e('0x79')];}else{_0x17dc0b[_0x235e('0x59')][_0x235e('0x7a')]=_0x17dc0b[_0x235e('0x3d')][_0x235e('0x7a')]=_0x34c8e0[_0x235e('0x5e')]['cservice'];_0x17dc0b['Imap']['user']=_0x17dc0b[_0x235e('0x3d')][_0x235e('0x74')]=_0x34c8e0[_0x235e('0x5e')][_0x235e('0x75')];_0x17dc0b['Imap'][_0x235e('0x76')]=_0x17dc0b[_0x235e('0x3d')][_0x235e('0x7b')]=_0x34c8e0[_0x235e('0x5e')][_0x235e('0x7c')];}return db[_0x235e('0x3f')]['create'](_0x17dc0b,{'include':[{'model':db[_0x235e('0x5a')],'as':_0x235e('0x3d')},{'model':db[_0x235e('0x3c')],'as':_0x235e('0x59')}]})[_0x235e('0x1f')](function(_0x8c9f82){var _0x4020be=_0x34c8e0['user'][_0x235e('0x7d')]({'plain':!![]});if(!_0x4020be)throw new Error(_0x235e('0x7e'));if(_0x4020be[_0x235e('0x7f')]===_0x235e('0x74')){var _0xa8652e=_0x8c9f82[_0x235e('0x7d')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x235e('0x80'),'userProfileId':_0x4020be[_0x235e('0x81')]},'raw':!![]})[_0x235e('0x1f')](function(_0x7e52bb){if(_0x7e52bb&&_0x7e52bb[_0x235e('0x82')]===0x0){return db[_0x235e('0x83')][_0x235e('0x6a')]({'name':_0xa8652e['name'],'resourceId':_0xa8652e['id'],'type':_0x7e52bb['name'],'sectionId':_0x7e52bb['id']},{})[_0x235e('0x1f')](function(){return _0x8c9f82;});}else{return _0x8c9f82;}})[_0x235e('0x2a')](function(_0x3fca0b){logger['error'](_0x235e('0x84'),_0x3fca0b);throw _0x3fca0b;});}return _0x8c9f82;})['then'](respondWithResult(_0x3e5c83,0xc9))[_0x235e('0x2a')](handleError(_0x3e5c83,null));};exports[_0x235e('0x85')]=function(_0x286295,_0x523bf9,_0x54ecb6){return db[_0x235e('0x3f')]['findOne']({'where':{'id':_0x286295[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x523bf9,null))[_0x235e('0x1f')](function(_0xd6ce9){if(_0xd6ce9){return _0xd6ce9[_0x235e('0x85')]();}return null;})[_0x235e('0x1f')](respondWithResult(_0x523bf9,null))[_0x235e('0x2a')](handleError(_0x523bf9,null));};exports['addImap']=function(_0x154f75,_0x11cb1b,_0x2ba4ad){if(_0x154f75[_0x235e('0x5e')]['id']){delete _0x154f75[_0x235e('0x5e')]['id'];}return db[_0x235e('0x3f')][_0x235e('0x5d')]({'where':{'id':_0x154f75[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x11cb1b,null))[_0x235e('0x1f')](function(_0x12745c){if(_0x12745c){_0x154f75[_0x235e('0x5e')][_0x235e('0x61')]=_0x12745c['id'];return db[_0x235e('0x3c')]['create'](_0x154f75[_0x235e('0x5e')]);}})[_0x235e('0x1f')](respondWithResult(_0x11cb1b,null))['catch'](handleError(_0x11cb1b,null));};exports[_0x235e('0x86')]=function(_0x523a40,_0xe2c190,_0x5843d8){return db[_0x235e('0x3f')][_0x235e('0x64')]({'where':{'id':_0x523a40[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0xe2c190,null))[_0x235e('0x1f')](function(_0x54a098){if(_0x54a098){return _0x54a098[_0x235e('0x87')](null);}return null;})[_0x235e('0x1f')](respondWithStatusCode(_0xe2c190,null))[_0x235e('0x2a')](handleError(_0xe2c190,null));};exports[_0x235e('0x88')]=function(_0xef1128,_0x3b01c2,_0x203f8e){return db[_0x235e('0x3f')][_0x235e('0x64')]({'where':{'id':_0xef1128['params']['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x3b01c2,null))[_0x235e('0x1f')](function(_0x4b50fc){if(_0x4b50fc){return _0x4b50fc[_0x235e('0x88')]();}return null;})['then'](respondWithResult(_0x3b01c2,null))[_0x235e('0x2a')](handleError(_0x3b01c2,null));};exports[_0x235e('0x89')]=function(_0x1692e5,_0x10b812,_0x2c32c5){if(_0x1692e5[_0x235e('0x5e')]['id']){delete _0x1692e5[_0x235e('0x5e')]['id'];}return db[_0x235e('0x3f')][_0x235e('0x5d')]({'where':{'id':_0x1692e5[_0x235e('0x58')]['id']}})['then'](handleEntityNotFound(_0x10b812,null))['then'](function(_0x162757){if(_0x162757){_0x1692e5['body']['MailAccountId']=_0x162757['id'];return db[_0x235e('0x5a')][_0x235e('0x6a')](_0x1692e5[_0x235e('0x5e')]);}})['then'](respondWithResult(_0x10b812,null))[_0x235e('0x2a')](handleError(_0x10b812,null));};exports['removeSmtp']=function(_0x1b0914,_0x5e1be7,_0x39aa6f){return db[_0x235e('0x3f')][_0x235e('0x64')]({'where':{'id':_0x1b0914[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x5e1be7,null))[_0x235e('0x1f')](function(_0x158a28){if(_0x158a28){return _0x158a28[_0x235e('0x8a')](null);}return null;})[_0x235e('0x1f')](respondWithStatusCode(_0x5e1be7,null))['catch'](handleError(_0x5e1be7,null));};exports[_0x235e('0x8b')]=function(_0x5c7b9b,_0x2f6ecb,_0x40fc89){return db[_0x235e('0x8c')][_0x235e('0x5d')]({'where':{'id':_0x5c7b9b[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x2f6ecb,null))[_0x235e('0x1f')](function(_0x297b84){if(_0x297b84){return _0x297b84[_0x235e('0x8b')](_0x5c7b9b[_0x235e('0x5e')]['ids'],_[_0x235e('0x8d')](_0x5c7b9b[_0x235e('0x5e')],[_0x235e('0x68'),'id'])||{});}})['then'](respondWithResult(_0x2f6ecb,null))[_0x235e('0x2a')](handleError(_0x2f6ecb,null));};exports[_0x235e('0x8e')]=function(_0x17844a,_0x2c2eff,_0x18c7f0){var _0x543a2a={'raw':![],'where':{}};var _0x2e79e6={};var _0x4f2cc6={'count':0x0,'rows':[]};return db[_0x235e('0x3f')]['findOne']({'where':{'id':_0x17844a[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x2c2eff,null))[_0x235e('0x1f')](function(_0x54e005){if(_0x54e005){_0x2e79e6['model']=_[_0x235e('0x45')](db['MailInteraction'][_0x235e('0x40')]);_0x2e79e6[_0x235e('0x44')]=_[_0x235e('0x45')](_0x17844a[_0x235e('0x44')]);_0x2e79e6['filters']=_[_0x235e('0x47')](_0x2e79e6[_0x235e('0x43')],_0x2e79e6[_0x235e('0x44')]);_0x543a2a[_0x235e('0x48')]=_['intersection'](_0x2e79e6[_0x235e('0x43')],qs[_0x235e('0x49')](_0x17844a[_0x235e('0x44')][_0x235e('0x49')]));_0x543a2a['attributes']=_0x543a2a[_0x235e('0x48')][_0x235e('0x4a')]?_0x543a2a[_0x235e('0x48')]:_0x2e79e6['model'];if(!_0x17844a['query'][_0x235e('0x65')](_0x235e('0x4b'))){_0x543a2a[_0x235e('0x31')]=qs[_0x235e('0x31')](_0x17844a[_0x235e('0x44')][_0x235e('0x31')]);_0x543a2a[_0x235e('0x2f')]=qs[_0x235e('0x2f')](_0x17844a[_0x235e('0x44')][_0x235e('0x2f')]);}_0x543a2a[_0x235e('0x66')]=qs[_0x235e('0x4c')](_0x17844a[_0x235e('0x44')][_0x235e('0x4c')]);_0x543a2a[_0x235e('0x4d')]=qs[_0x235e('0x46')](_['pick'](_0x17844a['query'],_0x2e79e6[_0x235e('0x46')]));_0x543a2a[_0x235e('0x4d')]['MailAccountId']=_0x54e005['id'];if(_0x17844a[_0x235e('0x44')][_0x235e('0x4f')]){_0x543a2a[_0x235e('0x4d')]=_['merge'](_0x543a2a[_0x235e('0x4d')],{'$or':_['map'](_0x543a2a[_0x235e('0x48')],function(_0x4f76e4){var _0x2c1025={};_0x2c1025[_0x4f76e4]={'$like':'%'+_0x17844a[_0x235e('0x44')][_0x235e('0x4f')]+'%'};return _0x2c1025;})});}_0x543a2a=_[_0x235e('0x50')]({},_0x543a2a,_0x17844a[_0x235e('0x52')]);return db[_0x235e('0x8c')][_0x235e('0x32')]({'where':_0x543a2a['where']})['then'](function(_0x370e29){_0x4f2cc6[_0x235e('0x32')]=_0x370e29;if(_0x17844a[_0x235e('0x44')][_0x235e('0x53')]){_0x543a2a[_0x235e('0x54')]=[{'model':db['CmContact'],'as':_0x235e('0x8f'),'required':![]},{'model':db['User'],'as':_0x235e('0x90'),'attributes':[_0x235e('0x3a'),_0x235e('0x91'),'internal'],'required':![]},{'model':db[_0x235e('0x92')],'as':'Tags','attributes':['id',_0x235e('0x3a'),_0x235e('0x93')],'where':_0x17844a['query'][_0x235e('0x94')]?{'id':_0x17844a[_0x235e('0x44')]['tag']}:undefined,'required':_0x17844a[_0x235e('0x44')][_0x235e('0x94')]?!![]:![]}];}return db['MailInteraction'][_0x235e('0x55')](_0x543a2a);})['then'](function(_0x482963){_0x4f2cc6[_0x235e('0x56')]=_0x482963;return _0x4f2cc6;});}})[_0x235e('0x1f')](respondWithFilteredResult(_0x2c2eff,_0x543a2a))[_0x235e('0x2a')](handleError(_0x2c2eff,null));};exports[_0x235e('0x95')]=function(_0x101573,_0x3aded8,_0x4cdc98){return db[_0x235e('0x3f')][_0x235e('0x64')]({'where':{'id':_0x101573[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x3aded8,null))[_0x235e('0x1f')](function(_0x8367d0){if(_0x8367d0){return db[_0x235e('0x96')][_0x235e('0x97')](function(_0x4361a8){return db['MailApplication'][_0x235e('0x38')]({'where':{'MailAccountId':_0x101573['params']['id']},'transaction':_0x4361a8})['then'](function(_0x80d93e){var _0x10cc04=_['map'](_0x101573['body'],function(_0x55ce62){_0x55ce62[_0x235e('0x61')]=_0x101573['params']['id'];return _0x55ce62;});return db[_0x235e('0x98')]['bulkCreate'](_0x10cc04,{'transaction':_0x4361a8});});})['then'](function(){return db[_0x235e('0x98')][_0x235e('0x99')]({'where':{'MailAccountId':_0x101573[_0x235e('0x58')]['id']},'order':_0x235e('0x9a')});});}})[_0x235e('0x1f')](respondWithResult(_0x3aded8,null))[_0x235e('0x2a')](handleError(_0x3aded8,null));};exports[_0x235e('0x9b')]=function(_0x4f621c,_0x56310c,_0x44c005){var _0x2df9ef={};var _0x139218={};var _0x3da2c8;var _0x3aecdd;return db[_0x235e('0x3f')][_0x235e('0x64')]({'where':{'id':_0x4f621c['params']['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x56310c,null))['then'](function(_0x3c6c33){if(_0x3c6c33){_0x3da2c8=_0x3c6c33;_0x139218[_0x235e('0x43')]=_[_0x235e('0x45')](db[_0x235e('0x98')]['rawAttributes']);_0x139218[_0x235e('0x44')]=_[_0x235e('0x45')](_0x4f621c['query']);_0x139218[_0x235e('0x46')]=_[_0x235e('0x47')](_0x139218[_0x235e('0x43')],_0x139218[_0x235e('0x44')]);_0x2df9ef[_0x235e('0x48')]=_['intersection'](_0x139218[_0x235e('0x43')],qs[_0x235e('0x49')](_0x4f621c[_0x235e('0x44')]['fields']));_0x2df9ef['attributes']=_0x2df9ef['attributes'][_0x235e('0x4a')]?_0x2df9ef[_0x235e('0x48')]:_0x139218[_0x235e('0x43')];_0x2df9ef[_0x235e('0x66')]=qs['sort'](_0x4f621c[_0x235e('0x44')]['sort']);_0x2df9ef[_0x235e('0x4d')]=qs[_0x235e('0x46')](_[_0x235e('0x4e')](_0x4f621c['query'],_0x139218[_0x235e('0x46')]));if(_0x4f621c[_0x235e('0x44')][_0x235e('0x4f')]){_0x2df9ef['where']=_['merge'](_0x2df9ef['where'],{'$or':_['map'](_0x2df9ef[_0x235e('0x48')],function(_0x5a957c){var _0x4c4a47={};_0x4c4a47[_0x5a957c]={'$like':'%'+_0x4f621c[_0x235e('0x44')][_0x235e('0x4f')]+'%'};return _0x4c4a47;})});}_0x2df9ef=_['merge']({},_0x2df9ef,_0x4f621c[_0x235e('0x52')]);return _0x3da2c8[_0x235e('0x9b')](_0x2df9ef);}})['then'](function(_0x51e6d9){if(_0x51e6d9){_0x3aecdd=_0x51e6d9[_0x235e('0x4a')];if(!_0x4f621c[_0x235e('0x44')][_0x235e('0x65')](_0x235e('0x4b'))){_0x2df9ef[_0x235e('0x31')]=qs[_0x235e('0x31')](_0x4f621c[_0x235e('0x44')][_0x235e('0x31')]);_0x2df9ef[_0x235e('0x2f')]=qs[_0x235e('0x2f')](_0x4f621c[_0x235e('0x44')][_0x235e('0x2f')]);}return _0x3da2c8[_0x235e('0x9b')](_0x2df9ef);}})[_0x235e('0x1f')](function(_0x1c5fd8){if(_0x1c5fd8){return _0x1c5fd8?{'count':_0x3aecdd,'rows':_0x1c5fd8}:null;}})[_0x235e('0x1f')](respondWithResult(_0x56310c,null))[_0x235e('0x2a')](handleError(_0x56310c,null));};exports[_0x235e('0x9c')]=function(_0x2e2eea,_0x5bea23,_0x5f31c8){var _0x336490={'raw':!![],'where':{}};var _0x1cc24d={};var _0x2b7ad7={'count':0x0,'rows':[]};return db[_0x235e('0x3f')][_0x235e('0x64')]({'where':{'id':_0x2e2eea[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x5bea23,null))[_0x235e('0x1f')](function(_0x58e7ba){if(_0x58e7ba){_0x1cc24d[_0x235e('0x43')]=_[_0x235e('0x45')](db[_0x235e('0x9d')]['rawAttributes']);_0x1cc24d['query']=_[_0x235e('0x45')](_0x2e2eea[_0x235e('0x44')]);_0x1cc24d['filters']=_[_0x235e('0x47')](_0x1cc24d[_0x235e('0x43')],_0x1cc24d['query']);_0x336490[_0x235e('0x48')]=_[_0x235e('0x47')](_0x1cc24d[_0x235e('0x43')],qs['fields'](_0x2e2eea[_0x235e('0x44')][_0x235e('0x49')]));_0x336490['attributes']=_0x336490[_0x235e('0x48')][_0x235e('0x4a')]?_0x336490[_0x235e('0x48')]:_0x1cc24d[_0x235e('0x43')];if(!_0x2e2eea[_0x235e('0x44')][_0x235e('0x65')](_0x235e('0x4b'))){_0x336490[_0x235e('0x31')]=qs['limit'](_0x2e2eea['query'][_0x235e('0x31')]);_0x336490[_0x235e('0x2f')]=qs['offset'](_0x2e2eea[_0x235e('0x44')][_0x235e('0x2f')]);}_0x336490['order']=qs['sort'](_0x2e2eea[_0x235e('0x44')][_0x235e('0x4c')]);_0x336490[_0x235e('0x4d')]=qs[_0x235e('0x46')](_[_0x235e('0x4e')](_0x2e2eea[_0x235e('0x44')],_0x1cc24d['filters']));_0x336490[_0x235e('0x4d')][_0x235e('0x61')]=_0x58e7ba['id'];if(_0x2e2eea[_0x235e('0x44')]['filter']){_0x336490[_0x235e('0x4d')]=_[_0x235e('0x50')](_0x336490[_0x235e('0x4d')],{'$or':_['map'](_0x336490['attributes'],function(_0x47d7b6){var _0x145491={};_0x145491[_0x47d7b6]={'$like':'%'+_0x2e2eea[_0x235e('0x44')][_0x235e('0x4f')]+'%'};return _0x145491;})});}if(_0x2e2eea[_0x235e('0x44')][_0x235e('0x9e')]){var _0x408fd2=_0x2e2eea['query'][_0x235e('0x9e')][_0x235e('0x9f')](',');var _0x4be3ce={};_0x4be3ce[_0x408fd2[0x0]]={'$gte':moment(_0x408fd2[0x1])[_0x235e('0xa0')](_0x235e('0xa1'))};_0x336490['where']=_[_0x235e('0x50')](_0x336490['where'],_0x4be3ce);}_0x336490=_[_0x235e('0x50')]({},_0x336490,_0x2e2eea[_0x235e('0x52')]);return db[_0x235e('0x9d')][_0x235e('0x32')]({'where':_0x336490[_0x235e('0x4d')]})[_0x235e('0x1f')](function(_0x192e8b){_0x2b7ad7['count']=_0x192e8b;if(_0x2e2eea[_0x235e('0x44')][_0x235e('0x53')]){_0x336490[_0x235e('0x54')]=[{'all':!![]}];}return db[_0x235e('0x9d')][_0x235e('0x55')](_0x336490);})['then'](function(_0x280522){if(_0x2e2eea[_0x235e('0x44')]['inlineCss']===_0x235e('0xa2')){for(var _0x2c7f9c=0x0;_0x2c7f9c<_0x280522['length'];_0x2c7f9c++){_0x280522[_0x2c7f9c]['body']=juice(_0x280522[_0x2c7f9c]['body']);}}_0x2b7ad7['rows']=_0x280522;return _0x2b7ad7;});}})[_0x235e('0x1f')](respondWithFilteredResult(_0x5bea23,_0x336490))[_0x235e('0x2a')](handleError(_0x5bea23,null));};exports['send']=function(_0x3db4de,_0x1f4dbf,_0x5c5758){var _0x1b5e0e,_0x1d7ad5={},_0x470266;if(_0x3db4de[_0x235e('0x5e')]['to']){_0x470266=_0x3db4de['body']['to']['split'](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x3db4de['params']['id']},'include':[{'model':db[_0x235e('0xa3')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x470266},'limit':0x1,'order':[[_0x235e('0xa4'),'DESC']]}]},{'model':db[_0x235e('0x5a')],'as':_0x235e('0x3d'),'raw':!![]}]})[_0x235e('0x1f')](handleEntityNotFound(_0x1f4dbf,null))['then'](function(_0x2ab4f9){if(_0x2ab4f9){_0x1b5e0e=_0x2ab4f9;if(_0x2ab4f9[_0x235e('0x3d')]){if(_[_0x235e('0x71')](_0x3db4de[_0x235e('0x5e')]['from'])){_0x3db4de[_0x235e('0x5e')][_0x235e('0xa5')]=util[_0x235e('0xa0')](_0x235e('0xa6'),_0x2ab4f9['name'],_0x2ab4f9[_0x235e('0x6e')]||_0x2ab4f9[_0x235e('0x3d')][_0x235e('0x74')]);}if(_0x3db4de[_0x235e('0x5e')][_0x235e('0xa7')]&&_0x3db4de[_0x235e('0x5e')][_0x235e('0xa7')][_0x235e('0x4a')]){for(var _0x2cf56d=0x0;_0x2cf56d<_0x3db4de[_0x235e('0x5e')][_0x235e('0xa7')]['length'];_0x2cf56d+=0x1){_0x3db4de[_0x235e('0x5e')][_0x235e('0xa7')][_0x2cf56d]={'filename':_0x3db4de[_0x235e('0x5e')][_0x235e('0xa7')][_0x2cf56d][_0x235e('0x3a')],'path':path[_0x235e('0xa8')](config[_0x235e('0xa9')],_0x235e('0xaa'),_0x3db4de[_0x235e('0x5e')][_0x235e('0xa7')][_0x2cf56d][_0x235e('0xab')])};}}var _0x15cf7f={'tls':{'rejectUnauthorized':![]}};if(_[_0x235e('0x71')](_0x2ab4f9[_0x235e('0x3d')][_0x235e('0x7a')])){if(_0x2ab4f9[_0x235e('0x3d')]['authentication']){_0x15cf7f[_0x235e('0xac')]={'user':_0x2ab4f9['Smtp'][_0x235e('0x74')],'pass':_0x2ab4f9[_0x235e('0x3d')][_0x235e('0x7b')]};}_0x15cf7f['host']=_0x2ab4f9[_0x235e('0x3d')]['host'];_0x15cf7f['port']=_0x2ab4f9[_0x235e('0x3d')][_0x235e('0x79')];_0x15cf7f[_0x235e('0xad')]=_0x2ab4f9[_0x235e('0x3d')][_0x235e('0xad')];}else{_0x15cf7f[_0x235e('0x7a')]=_0x2ab4f9[_0x235e('0x3d')]['service'];_0x15cf7f[_0x235e('0xac')]={'user':_0x2ab4f9[_0x235e('0x3d')][_0x235e('0x74')],'pass':_0x2ab4f9[_0x235e('0x3d')]['pass']};}return respondWithRpcPromise(_0x235e('0xae'),'sendMail',{'account':_0x15cf7f,'message':_0x3db4de[_0x235e('0x5e')]});}else{throw new Error('List\x20not\x20found');}}})[_0x235e('0x1f')](function(_0x4de3c1){if(_0x4de3c1){_0x1d7ad5=_0x4de3c1;if(_0x1b5e0e['List']){if(_0x1b5e0e[_0x235e('0xaf')][_0x235e('0xb0')][_0x235e('0x4a')]){return _0x1b5e0e[_0x235e('0xaf')][_0x235e('0xb0')][0x0];}else{return db[_0x235e('0xb1')][_0x235e('0x6a')](_['defaults'](_0x3db4de[_0x235e('0x5e')],{'firstName':_0x3db4de[_0x235e('0x5e')]['to'],'email':_0x3db4de[_0x235e('0x5e')]['to'],'phone':_0x3db4de[_0x235e('0x5e')]['to'],'ListId':_0x1b5e0e[_0x235e('0x6f')]}));}}else{throw new Error(_0x235e('0xb2'));}}})['then'](function(_0x5d9e94){if(_0x5d9e94){var _0x42f30c={'UserId':_0x3db4de[_0x235e('0x74')]['id'],'ContactId':_0x5d9e94['id'],'MailAccountId':_0x1b5e0e['id'],'inReplyTo':_0x1d7ad5['messageId'],'to':_0x3db4de['body'][_0x235e('0xa5')],'cc':_0x3db4de[_0x235e('0x5e')]['cc'],'subject':_0x3db4de['body'][_0x235e('0xb3')],'attach':_0x3db4de[_0x235e('0x5e')][_0x235e('0xb4')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x235e('0xa0')](_0x235e('0xa1')),'lastMsgDirection':_0x235e('0xb5'),'Messages':[_[_0x235e('0x50')](_0x3db4de[_0x235e('0x5e')],{'messageId':_0x1d7ad5[_0x235e('0xb6')],'sentAt':moment()[_0x235e('0xa0')](_0x235e('0xa1')),'read':!![],'MailAccountId':_0x1b5e0e['id'],'UserId':_0x3db4de[_0x235e('0x74')]['id'],'ContactId':_0x5d9e94['id']})]};if(_0x3db4de[_0x235e('0x5e')][_0x235e('0xb7')]){_0x42f30c=_[_0x235e('0x50')](_0x42f30c,_0x3db4de[_0x235e('0x5e')][_0x235e('0xb7')]);}return db['MailInteraction'][_0x235e('0x6a')](_0x42f30c,{'include':[{'model':db[_0x235e('0x9d')],'as':_0x235e('0xb8')}]});}})[_0x235e('0x1f')](respondWithResult(_0x1f4dbf,null))[_0x235e('0x2a')](handleError(_0x1f4dbf,null));};exports[_0x235e('0xb9')]=function(_0x56631f,_0xc9bf1,_0x4e00ba){return db[_0x235e('0x3f')]['find']({'where':{'id':_0x56631f[_0x235e('0x58')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x235e('0x3d'),'raw':!![]}]})[_0x235e('0x1f')](handleEntityNotFound(_0xc9bf1,null))[_0x235e('0x1f')](function(_0xea4181){if(_0xea4181&&_0xea4181[_0x235e('0x3d')]){var _0x3161cd={'id':_0xea4181['id'],'tls':{'rejectUnauthorized':![]}};if(_0xea4181[_0x235e('0x3d')]['service']){_0x3161cd['service']=_0xea4181[_0x235e('0x3d')][_0x235e('0x7a')];}else{_0x3161cd[_0x235e('0x78')]=_0xea4181[_0x235e('0x3d')][_0x235e('0x78')];_0x3161cd[_0x235e('0x79')]=_0xea4181[_0x235e('0x3d')][_0x235e('0x79')];_0x3161cd[_0x235e('0xad')]=_0xea4181[_0x235e('0x3d')]['secure'];}if(_0xea4181['Smtp'][_0x235e('0x77')]){_0x3161cd[_0x235e('0xac')]={'user':_0xea4181[_0x235e('0x3d')][_0x235e('0x74')],'pass':_0xea4181[_0x235e('0x3d')][_0x235e('0x7b')]};}return respondWithRpcPromise(_0x235e('0xba'),'verifySmtp',{'account':_0x3161cd});}})[_0x235e('0x1f')](respondWithResult(_0xc9bf1,null))[_0x235e('0x2a')](handleError(_0xc9bf1,null));};exports[_0x235e('0x38')]=function(_0x1a0fc6,_0x37157c){return db['MailAccount'][_0x235e('0x5d')]({'where':{'id':_0x1a0fc6[_0x235e('0x58')]['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x37157c,null))[_0x235e('0x1f')](function(_0x5ba3e4){if(_0x5ba3e4&&_0x5ba3e4['service']){throw new db['Sequelize'][(_0x235e('0xbb'))](_0x235e('0xbc'));}return _0x5ba3e4;})[_0x235e('0x1f')](removeEntity(_0x37157c,null))[_0x235e('0x2a')](handleError(_0x37157c,null));};exports[_0x235e('0xbd')]=function(_0x4c12d3,_0x577d05,_0x44fca1){return db[_0x235e('0x3f')][_0x235e('0x5d')]({'where':{'id':_0x4c12d3['params']['id']}})['then'](handleEntityNotFound(_0x577d05,null))[_0x235e('0x1f')](function(_0x21855f){if(_0x21855f){return _0x21855f[_0x235e('0xbd')](_0x4c12d3['body'][_0x235e('0x68')],_[_0x235e('0x8d')](_0x4c12d3['body'],['ids','id'])||{})['spread'](function(_0x4d1499){for(var _0x55b0ab=0x0;_0x55b0ab<_0x4c12d3[_0x235e('0x5e')][_0x235e('0x68')][_0x235e('0x4a')];_0x55b0ab+=0x1){socket[_0x235e('0xbe')](_0x235e('0xbf'),{'UserId':Number(_0x4c12d3['body'][_0x235e('0x68')][_0x55b0ab]),'MailAccountId':Number(_0x4c12d3[_0x235e('0x58')]['id'])});}return _0x4d1499;});}})['then'](respondWithResult(_0x577d05,null))[_0x235e('0x2a')](handleError(_0x577d05,null));};exports[_0x235e('0xc0')]=function(_0x31c4c1,_0x247153,_0x4a0ef8){return db[_0x235e('0x3f')][_0x235e('0x5d')]({'where':{'id':_0x31c4c1['params']['id']}})['then'](handleEntityNotFound(_0x247153,null))[_0x235e('0x1f')](function(_0x5e81dd){if(_0x5e81dd){return _0x5e81dd[_0x235e('0xc0')](_0x31c4c1['query'][_0x235e('0x68')])['then'](function(){if(_[_0x235e('0xc1')](_0x31c4c1[_0x235e('0x44')]['ids'])){for(var _0x2b7747=0x0;_0x2b7747<_0x31c4c1['query'][_0x235e('0x68')][_0x235e('0x4a')];_0x2b7747+=0x1){socket[_0x235e('0xbe')](_0x235e('0xc2'),{'UserId':Number(_0x31c4c1[_0x235e('0x44')][_0x235e('0x68')][_0x2b7747]),'MailAccountId':Number(_0x31c4c1[_0x235e('0x58')]['id'])});}}else{socket[_0x235e('0xbe')](_0x235e('0xc2'),{'UserId':Number(_0x31c4c1[_0x235e('0x44')][_0x235e('0x68')]),'MailAccountId':Number(_0x31c4c1[_0x235e('0x58')]['id'])});}});}})[_0x235e('0x1f')](respondWithStatusCode(_0x247153,null))['catch'](handleError(_0x247153,null));};exports[_0x235e('0xc3')]=function(_0x553682,_0x4c6a7a,_0x4cd4ae){var _0x57b397={};var _0x552657={};var _0x5191b4;var _0x4393f9;return db[_0x235e('0x3f')][_0x235e('0x64')]({'where':{'id':_0x553682['params']['id']}})[_0x235e('0x1f')](handleEntityNotFound(_0x4c6a7a,null))['then'](function(_0x45241f){if(_0x45241f){_0x5191b4=_0x45241f;_0x552657['model']=_[_0x235e('0x45')](db[_0x235e('0xc4')][_0x235e('0x40')]);_0x552657[_0x235e('0x44')]=_[_0x235e('0x45')](_0x553682[_0x235e('0x44')]);_0x552657['filters']=_[_0x235e('0x47')](_0x552657[_0x235e('0x43')],_0x552657[_0x235e('0x44')]);_0x57b397[_0x235e('0x48')]=_[_0x235e('0x47')](_0x552657[_0x235e('0x43')],qs[_0x235e('0x49')](_0x553682[_0x235e('0x44')][_0x235e('0x49')]));_0x57b397['attributes']=_0x57b397['attributes'][_0x235e('0x4a')]?_0x57b397[_0x235e('0x48')]:_0x552657['model'];_0x57b397['order']=qs[_0x235e('0x4c')](_0x553682[_0x235e('0x44')][_0x235e('0x4c')]);_0x57b397[_0x235e('0x4d')]=qs[_0x235e('0x46')](_['pick'](_0x553682['query'],_0x552657[_0x235e('0x46')]));if(_0x553682[_0x235e('0x44')]['filter']){_0x57b397[_0x235e('0x4d')]=_['merge'](_0x57b397['where'],{'$or':_[_0x235e('0x3e')](_0x57b397['attributes'],function(_0x31db69){var _0x4f73be={};_0x4f73be[_0x31db69]={'$like':'%'+_0x553682[_0x235e('0x44')][_0x235e('0x4f')]+'%'};return _0x4f73be;})});}_0x57b397=_[_0x235e('0x50')]({},_0x57b397,_0x553682['options']);return _0x5191b4[_0x235e('0xc3')](_0x57b397);}})[_0x235e('0x1f')](function(_0x3142a9){if(_0x3142a9){_0x4393f9=_0x3142a9[_0x235e('0x4a')];if(!_0x553682[_0x235e('0x44')]['hasOwnProperty'](_0x235e('0x4b'))){_0x57b397[_0x235e('0x31')]=qs[_0x235e('0x31')](_0x553682[_0x235e('0x44')]['limit']);_0x57b397[_0x235e('0x2f')]=qs[_0x235e('0x2f')](_0x553682[_0x235e('0x44')][_0x235e('0x2f')]);}return _0x5191b4[_0x235e('0xc3')](_0x57b397);}})[_0x235e('0x1f')](function(_0x3882f6){if(_0x3882f6){return _0x3882f6?{'count':_0x4393f9,'rows':_0x3882f6}:null;}})[_0x235e('0x1f')](respondWithResult(_0x4c6a7a,null))[_0x235e('0x2a')](handleError(_0x4c6a7a,null));}; \ No newline at end of file +var _0xb768=['emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','./mailAccount.socket','jayson/promise','client','http','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','MailAccounts','UserProfileResource','stack','name','send','index','Imap','MailServerOut','Smtp','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','Pause','options','find','body','params','MailServerIn','describe','addDisposition','MailAccountId','create','getDispositions','Disposition','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','email','active','description','isNil','cauthentication','user','cuser','pass','cpassword','authentication','host','port','service','password','get','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','MailApplication','destroy','bulkCreate','findAndCountAll','priority','getApplications','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','split','from','%s\x20<%s>','attachments','root','server/files/attachments','auth','secure','SendMail','sendMail','List\x20not\x20found','List','Contacts','ListId','messageId','attach','out','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xb768,0x18d));var _0x8b76=function(_0x599831,_0x5482a7){_0x599831=_0x599831-0x0;var _0x57477b=_0xb768[_0x599831];return _0x57477b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b76('0x0'));var zipdir=require(_0x8b76('0x1'));var jsonpatch=require(_0x8b76('0x2'));var rp=require(_0x8b76('0x3'));var moment=require(_0x8b76('0x4'));var BPromise=require(_0x8b76('0x5'));var Mustache=require(_0x8b76('0x6'));var util=require(_0x8b76('0x7'));var path=require(_0x8b76('0x8'));var sox=require(_0x8b76('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b76('0xa'));var _=require(_0x8b76('0xb'));var squel=require(_0x8b76('0xc'));var crypto=require('crypto');var jsforce=require(_0x8b76('0xd'));var deskjs=require(_0x8b76('0xe'));var toCsv=require(_0x8b76('0xf'));var querystring=require('querystring');var Papa=require(_0x8b76('0x10'));var htmlToText=require('html-to-text');var juice=require(_0x8b76('0x11'));var Redis=require(_0x8b76('0x12'));var authService=require(_0x8b76('0x13'));var qs=require(_0x8b76('0x14'));var as=require(_0x8b76('0x15'));var hardwareService=require(_0x8b76('0x16'));var logger=require(_0x8b76('0x17'))(_0x8b76('0x18'));var utils=require('../../config/utils');var config=require(_0x8b76('0x19'));var licenseUtil=require(_0x8b76('0x1a'));var db=require('../../mysqldb')['db'];config[_0x8b76('0x1b')]=_[_0x8b76('0x1c')](config[_0x8b76('0x1b')],{'host':_0x8b76('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b76('0x1b')]));require(_0x8b76('0x1e'))['register'](socket);var jayson=require(_0x8b76('0x1f'));var client=jayson[_0x8b76('0x20')][_0x8b76('0x21')]({'port':0x232b});function respondWithRpcPromise(_0x21d9e7,_0x382b6d,_0x5ad05d,_0x42ff4c){return new BPromise(function(_0x3c11b6,_0x311c12){var _0x4cf790=_0x42ff4c||client;return _0x4cf790['request'](_0x21d9e7,_0x5ad05d)['then'](function(_0x8cd984){logger['info']('MailAccount,\x20%s,\x20%s',_0x382b6d,_0x8b76('0x22'));logger[_0x8b76('0x23')](_0x8b76('0x24'),_0x382b6d,'request\x20sent',JSON['stringify'](_0x8cd984));if(_0x8cd984[_0x8b76('0x25')]){if(_0x8cd984['error'][_0x8b76('0x26')]===0x1f4){logger['error'](_0x8b76('0x27'),_0x382b6d,_0x8cd984[_0x8b76('0x25')][_0x8b76('0x28')]);return _0x311c12(_0x8cd984['error'][_0x8b76('0x28')]);}logger[_0x8b76('0x25')](_0x8b76('0x27'),_0x382b6d,_0x8cd984[_0x8b76('0x25')][_0x8b76('0x28')]);return _0x3c11b6(_0x8cd984[_0x8b76('0x25')][_0x8b76('0x28')]);}else{logger['info'](_0x8b76('0x27'),_0x382b6d,_0x8b76('0x22'));_0x3c11b6(_0x8cd984[_0x8b76('0x29')][_0x8b76('0x28')]);}})['catch'](function(_0x2eae08){logger[_0x8b76('0x25')](_0x8b76('0x27'),_0x382b6d,_0x2eae08);_0x311c12(_0x2eae08);});});}function respondWithStatusCode(_0xe39071,_0x51f25a){_0x51f25a=_0x51f25a||0xcc;return function(_0x76f4cc){if(_0x76f4cc){return _0xe39071[_0x8b76('0x2a')](_0x51f25a);}return _0xe39071[_0x8b76('0x2b')](_0x51f25a)[_0x8b76('0x2c')]();};}function respondWithResult(_0x14fa3c,_0x36f905){_0x36f905=_0x36f905||0xc8;return function(_0x5c49d4){if(_0x5c49d4){return _0x14fa3c['status'](_0x36f905)[_0x8b76('0x2d')](_0x5c49d4);}};}function respondWithFilteredResult(_0x14d25e,_0x1a0fab){return function(_0x1debd7){if(_0x1debd7){var _0x3e5059=typeof _0x1a0fab[_0x8b76('0x2e')]===_0x8b76('0x2f')&&typeof _0x1a0fab[_0x8b76('0x30')]===_0x8b76('0x2f');var _0xfb249d=_0x1debd7[_0x8b76('0x31')];var _0x408008=_0x3e5059?0x0:_0x1a0fab[_0x8b76('0x2e')];var _0x5bfb97=_0x3e5059?_0x1debd7[_0x8b76('0x31')]:_0x1a0fab[_0x8b76('0x2e')]+_0x1a0fab[_0x8b76('0x30')];var _0x31e340;if(_0x5bfb97>=_0xfb249d){_0x5bfb97=_0xfb249d;_0x31e340=0xc8;}else{_0x31e340=0xce;}_0x14d25e[_0x8b76('0x2b')](_0x31e340);return _0x14d25e[_0x8b76('0x32')](_0x8b76('0x33'),_0x408008+'-'+_0x5bfb97+'/'+_0xfb249d)[_0x8b76('0x2d')](_0x1debd7);}return null;};}function patchUpdates(_0x2348cc){return function(_0x4c54e8){try{jsonpatch[_0x8b76('0x34')](_0x4c54e8,_0x2348cc,!![]);}catch(_0x7b9a3a){return BPromise['reject'](_0x7b9a3a);}return _0x4c54e8['save']();};}function saveUpdates(_0x3c52cd,_0xee35e7){return function(_0x211e7f){if(_0x211e7f){return _0x211e7f[_0x8b76('0x35')](_0x3c52cd)[_0x8b76('0x36')](function(_0x162ed0){return _0x162ed0;});}return null;};}function removeEntity(_0x1b5fdb,_0x2fb6bd){return function(_0xa6a15f){if(_0xa6a15f){return _0xa6a15f['destroy']()[_0x8b76('0x36')](function(){var _0x49dcca=_0xa6a15f['get']({'plain':!![]});var _0x5bb57e=_0x8b76('0x37');return db[_0x8b76('0x38')]['destroy']({'where':{'type':_0x5bb57e,'resourceId':_0x49dcca['id']}})[_0x8b76('0x36')](function(){return _0xa6a15f;});})[_0x8b76('0x36')](function(){_0x1b5fdb['status'](0xcc)[_0x8b76('0x2c')]();});}};}function handleEntityNotFound(_0x2e0fea,_0x5eda06){return function(_0x2be4f5){if(!_0x2be4f5){_0x2e0fea['sendStatus'](0x194);}return _0x2be4f5;};}function handleError(_0x47edac,_0x4f7000){_0x4f7000=_0x4f7000||0x1f4;return function(_0x39fee8){logger[_0x8b76('0x25')](_0x39fee8[_0x8b76('0x39')]);if(_0x39fee8[_0x8b76('0x3a')]){delete _0x39fee8[_0x8b76('0x3a')];}_0x47edac[_0x8b76('0x2b')](_0x4f7000)[_0x8b76('0x3b')](_0x39fee8);};}exports[_0x8b76('0x3c')]=function(_0x382e05,_0x1cb404){var _0x3ddbf5={'include':[{'model':db['MailServerIn'],'as':_0x8b76('0x3d')},{'model':db[_0x8b76('0x3e')],'as':_0x8b76('0x3f')},{'model':db['Pause'],'as':_0x8b76('0x40')}]},_0x3fa458={},_0x2da53e={'count':0x0,'rows':[]};var _0x2bd100=_[_0x8b76('0x41')](db[_0x8b76('0x42')][_0x8b76('0x43')],function(_0x56592a){return{'name':_0x56592a[_0x8b76('0x44')],'type':_0x56592a['type'][_0x8b76('0x45')]};});_0x3fa458[_0x8b76('0x46')]=_[_0x8b76('0x41')](_0x2bd100,_0x8b76('0x3a'));_0x3fa458[_0x8b76('0x47')]=_[_0x8b76('0x48')](_0x382e05[_0x8b76('0x47')]);_0x3fa458[_0x8b76('0x49')]=_[_0x8b76('0x4a')](_0x3fa458[_0x8b76('0x46')],_0x3fa458[_0x8b76('0x47')]);_0x3ddbf5['attributes']=_[_0x8b76('0x4a')](_0x3fa458[_0x8b76('0x46')],qs['fields'](_0x382e05['query'][_0x8b76('0x4b')]));_0x3ddbf5['attributes']=_0x3ddbf5['attributes'][_0x8b76('0x4c')]?_0x3ddbf5[_0x8b76('0x4d')]:_0x3fa458[_0x8b76('0x46')];if(!_0x382e05[_0x8b76('0x47')][_0x8b76('0x4e')](_0x8b76('0x4f'))){_0x3ddbf5[_0x8b76('0x30')]=qs[_0x8b76('0x30')](_0x382e05[_0x8b76('0x47')][_0x8b76('0x30')]);_0x3ddbf5[_0x8b76('0x2e')]=qs[_0x8b76('0x2e')](_0x382e05[_0x8b76('0x47')][_0x8b76('0x2e')]);}_0x3ddbf5[_0x8b76('0x50')]=qs[_0x8b76('0x51')](_0x382e05[_0x8b76('0x47')][_0x8b76('0x51')]);_0x3ddbf5[_0x8b76('0x52')]=qs[_0x8b76('0x49')](_[_0x8b76('0x53')](_0x382e05[_0x8b76('0x47')],_0x3fa458[_0x8b76('0x49')]),_0x2bd100);if(_0x382e05[_0x8b76('0x47')][_0x8b76('0x54')]){_0x3ddbf5['where']=_[_0x8b76('0x55')](_0x3ddbf5[_0x8b76('0x52')],{'$or':_[_0x8b76('0x41')](_0x2bd100,function(_0x1b7e90){if(_0x1b7e90[_0x8b76('0x56')]!==_0x8b76('0x57')){var _0x374186={};_0x374186[_0x1b7e90['name']]={'$like':'%'+_0x382e05[_0x8b76('0x47')]['filter']+'%'};return _0x374186;}})});}_0x3ddbf5=_[_0x8b76('0x55')]({},_0x3ddbf5,_0x382e05['options']);var _0x4335ac={'where':_0x3ddbf5[_0x8b76('0x52')]};return db[_0x8b76('0x42')]['count'](_0x4335ac)[_0x8b76('0x36')](function(_0x3d9bf6){_0x2da53e[_0x8b76('0x31')]=_0x3d9bf6;if(_0x382e05[_0x8b76('0x47')][_0x8b76('0x58')]){_0x3ddbf5[_0x8b76('0x59')]=[{'all':!![]}];}return db[_0x8b76('0x42')]['findAll'](_0x3ddbf5);})[_0x8b76('0x36')](function(_0x589356){_0x2da53e[_0x8b76('0x5a')]=_0x589356;return _0x2da53e;})[_0x8b76('0x36')](respondWithFilteredResult(_0x1cb404,_0x3ddbf5))[_0x8b76('0x5b')](handleError(_0x1cb404,null));};exports[_0x8b76('0x5c')]=function(_0x1492e2,_0x17a148){var _0xfcff24={'raw':![],'where':{'id':_0x1492e2['params']['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0x8b76('0x3e')],'as':'Smtp'},{'model':db[_0x8b76('0x5d')],'as':_0x8b76('0x40')}]},_0x5d336a={};_0x5d336a['model']=_['keys'](db[_0x8b76('0x42')][_0x8b76('0x43')]);_0x5d336a[_0x8b76('0x47')]=_[_0x8b76('0x48')](_0x1492e2[_0x8b76('0x47')]);_0x5d336a[_0x8b76('0x49')]=_[_0x8b76('0x4a')](_0x5d336a[_0x8b76('0x46')],_0x5d336a[_0x8b76('0x47')]);_0xfcff24[_0x8b76('0x4d')]=_[_0x8b76('0x4a')](_0x5d336a[_0x8b76('0x46')],qs[_0x8b76('0x4b')](_0x1492e2[_0x8b76('0x47')][_0x8b76('0x4b')]));_0xfcff24[_0x8b76('0x4d')]=_0xfcff24[_0x8b76('0x4d')][_0x8b76('0x4c')]?_0xfcff24[_0x8b76('0x4d')]:_0x5d336a[_0x8b76('0x46')];if(_0x1492e2[_0x8b76('0x47')]['includeAll']){_0xfcff24['include']=[{'all':!![]}];}_0xfcff24=_[_0x8b76('0x55')]({},_0xfcff24,_0x1492e2[_0x8b76('0x5e')]);return db['MailAccount'][_0x8b76('0x5f')](_0xfcff24)[_0x8b76('0x36')](handleEntityNotFound(_0x17a148,null))[_0x8b76('0x36')](respondWithResult(_0x17a148,null))[_0x8b76('0x5b')](handleError(_0x17a148,null));};exports[_0x8b76('0x35')]=function(_0x1ab465,_0x3269e0){if(_0x1ab465['body']['id']){delete _0x1ab465[_0x8b76('0x60')]['id'];}return db[_0x8b76('0x42')][_0x8b76('0x5f')]({'where':{'id':_0x1ab465[_0x8b76('0x61')]['id']},'include':[{'model':db[_0x8b76('0x62')],'as':_0x8b76('0x3d')},{'model':db[_0x8b76('0x3e')],'as':_0x8b76('0x3f')},{'model':db['Pause'],'as':_0x8b76('0x40')}]})[_0x8b76('0x36')](handleEntityNotFound(_0x3269e0,null))[_0x8b76('0x36')](saveUpdates(_0x1ab465['body'],null))[_0x8b76('0x36')](function(_0xa3a7a4){if(_0xa3a7a4&&_0x1ab465[_0x8b76('0x60')]['Imap']){return db[_0x8b76('0x62')][_0x8b76('0x35')](_0x1ab465[_0x8b76('0x60')][_0x8b76('0x3d')],{'where':{'MailAccountId':_0xa3a7a4['id']}})[_0x8b76('0x36')](function(){return _0xa3a7a4;});}return _0xa3a7a4;})[_0x8b76('0x36')](function(_0x2ea727){if(_0x2ea727&&_0x1ab465[_0x8b76('0x60')][_0x8b76('0x3f')]){return db[_0x8b76('0x3e')][_0x8b76('0x35')](_0x1ab465[_0x8b76('0x60')][_0x8b76('0x3f')],{'where':{'MailAccountId':_0x2ea727['id']}})[_0x8b76('0x36')](function(){return _0x2ea727;});}return _0x2ea727;})['then'](respondWithResult(_0x3269e0,null))['catch'](handleError(_0x3269e0,null));};exports[_0x8b76('0x63')]=function(_0x124dd0,_0x3f1608){return db[_0x8b76('0x42')][_0x8b76('0x63')]()[_0x8b76('0x36')](respondWithResult(_0x3f1608,null))[_0x8b76('0x5b')](handleError(_0x3f1608,null));};exports[_0x8b76('0x64')]=function(_0x3aa6d6,_0x111888,_0x3c5ab0){if(_0x3aa6d6[_0x8b76('0x60')]['id']){delete _0x3aa6d6[_0x8b76('0x60')]['id'];}return db[_0x8b76('0x42')]['find']({'where':{'id':_0x3aa6d6[_0x8b76('0x61')]['id']}})[_0x8b76('0x36')](handleEntityNotFound(_0x111888,null))[_0x8b76('0x36')](function(_0x4f3e09){if(_0x4f3e09){_0x3aa6d6[_0x8b76('0x60')][_0x8b76('0x65')]=_0x4f3e09['id'];return db['Disposition'][_0x8b76('0x66')](_0x3aa6d6[_0x8b76('0x60')]);}})[_0x8b76('0x36')](respondWithResult(_0x111888,null))['catch'](handleError(_0x111888,null));};exports[_0x8b76('0x67')]=function(_0x4570d7,_0x144be8,_0x473756){var _0xbd3810={'raw':![],'where':{}};var _0x5cc3d9={};var _0x3c79b9={'count':0x0,'rows':[]};return db[_0x8b76('0x42')]['findOne']({'where':{'id':_0x4570d7[_0x8b76('0x61')]['id']}})[_0x8b76('0x36')](handleEntityNotFound(_0x144be8,null))['then'](function(_0x20fc36){if(_0x20fc36){_0x5cc3d9[_0x8b76('0x46')]=_[_0x8b76('0x48')](db['Disposition'][_0x8b76('0x43')]);_0x5cc3d9[_0x8b76('0x47')]=_['keys'](_0x4570d7[_0x8b76('0x47')]);_0x5cc3d9[_0x8b76('0x49')]=_[_0x8b76('0x4a')](_0x5cc3d9[_0x8b76('0x46')],_0x5cc3d9['query']);_0xbd3810[_0x8b76('0x4d')]=_['intersection'](_0x5cc3d9[_0x8b76('0x46')],qs['fields'](_0x4570d7[_0x8b76('0x47')][_0x8b76('0x4b')]));_0xbd3810[_0x8b76('0x4d')]=_0xbd3810['attributes'][_0x8b76('0x4c')]?_0xbd3810['attributes']:_0x5cc3d9[_0x8b76('0x46')];if(!_0x4570d7['query'][_0x8b76('0x4e')](_0x8b76('0x4f'))){_0xbd3810[_0x8b76('0x30')]=qs['limit'](_0x4570d7[_0x8b76('0x47')]['limit']);_0xbd3810['offset']=qs['offset'](_0x4570d7[_0x8b76('0x47')][_0x8b76('0x2e')]);}_0xbd3810[_0x8b76('0x50')]=qs[_0x8b76('0x51')](_0x4570d7[_0x8b76('0x47')][_0x8b76('0x51')]);_0xbd3810[_0x8b76('0x52')]=qs[_0x8b76('0x49')](_[_0x8b76('0x53')](_0x4570d7[_0x8b76('0x47')],_0x5cc3d9[_0x8b76('0x49')]));_0xbd3810[_0x8b76('0x52')][_0x8b76('0x65')]=_0x20fc36['id'];if(_0x4570d7[_0x8b76('0x47')][_0x8b76('0x54')]){_0xbd3810[_0x8b76('0x52')]=_[_0x8b76('0x55')](_0xbd3810['where'],{'$or':_[_0x8b76('0x41')](_0xbd3810[_0x8b76('0x4d')],function(_0x17cacf){var _0x3ce94a={};_0x3ce94a[_0x17cacf]={'$like':'%'+_0x4570d7[_0x8b76('0x47')][_0x8b76('0x54')]+'%'};return _0x3ce94a;})});}_0xbd3810=_['merge']({},_0xbd3810,_0x4570d7[_0x8b76('0x5e')]);return db[_0x8b76('0x68')][_0x8b76('0x31')]({'where':_0xbd3810[_0x8b76('0x52')]})[_0x8b76('0x36')](function(_0x1d6c43){_0x3c79b9[_0x8b76('0x31')]=_0x1d6c43;if(_0x4570d7['query'][_0x8b76('0x58')]){_0xbd3810[_0x8b76('0x59')]=[{'all':!![]}];}return db[_0x8b76('0x68')][_0x8b76('0x69')](_0xbd3810);})['then'](function(_0x5952c6){_0x3c79b9['rows']=_0x5952c6;return _0x3c79b9;});}})[_0x8b76('0x36')](respondWithFilteredResult(_0x144be8,_0xbd3810))['catch'](handleError(_0x144be8,null));};exports[_0x8b76('0x6a')]=function(_0x3b06a8,_0x60979d,_0xcbd82){return db['MailAccount'][_0x8b76('0x5f')]({'where':{'id':_0x3b06a8['params']['id']}})[_0x8b76('0x36')](handleEntityNotFound(_0x60979d,null))['then'](function(_0x2116cf){if(_0x2116cf){return _0x2116cf[_0x8b76('0x6a')](_0x3b06a8['query']['ids']);}})[_0x8b76('0x36')](respondWithStatusCode(_0x60979d,null))[_0x8b76('0x5b')](handleError(_0x60979d,null));};exports[_0x8b76('0x6b')]=function(_0xc7ed5a,_0x5e97d6,_0x4bbb3f){if(_0xc7ed5a[_0x8b76('0x60')]['id']){delete _0xc7ed5a[_0x8b76('0x60')]['id'];}return db['MailAccount']['find']({'where':{'id':_0xc7ed5a[_0x8b76('0x61')]['id']}})[_0x8b76('0x36')](handleEntityNotFound(_0x5e97d6,null))['then'](function(_0x5d0b04){if(_0x5d0b04){_0xc7ed5a['body'][_0x8b76('0x65')]=_0x5d0b04['id'];return db[_0x8b76('0x6c')][_0x8b76('0x66')](_0xc7ed5a[_0x8b76('0x60')]);}})[_0x8b76('0x36')](respondWithResult(_0x5e97d6,null))[_0x8b76('0x5b')](handleError(_0x5e97d6,null));};exports[_0x8b76('0x6d')]=function(_0x17451f,_0x5982e4,_0x1fc906){var _0xec3506={'raw':![],'where':{}};var _0x3f67b2={};var _0x23b55e={'count':0x0,'rows':[]};return db[_0x8b76('0x42')][_0x8b76('0x6e')]({'where':{'id':_0x17451f[_0x8b76('0x61')]['id']}})[_0x8b76('0x36')](handleEntityNotFound(_0x5982e4,null))[_0x8b76('0x36')](function(_0x2d75a8){if(_0x2d75a8){_0x3f67b2['model']=_[_0x8b76('0x48')](db[_0x8b76('0x6c')][_0x8b76('0x43')]);_0x3f67b2[_0x8b76('0x47')]=_[_0x8b76('0x48')](_0x17451f['query']);_0x3f67b2['filters']=_[_0x8b76('0x4a')](_0x3f67b2[_0x8b76('0x46')],_0x3f67b2[_0x8b76('0x47')]);_0xec3506[_0x8b76('0x4d')]=_['intersection'](_0x3f67b2[_0x8b76('0x46')],qs['fields'](_0x17451f[_0x8b76('0x47')][_0x8b76('0x4b')]));_0xec3506[_0x8b76('0x4d')]=_0xec3506[_0x8b76('0x4d')]['length']?_0xec3506[_0x8b76('0x4d')]:_0x3f67b2[_0x8b76('0x46')];if(!_0x17451f[_0x8b76('0x47')][_0x8b76('0x4e')](_0x8b76('0x4f'))){_0xec3506[_0x8b76('0x30')]=qs['limit'](_0x17451f['query'][_0x8b76('0x30')]);_0xec3506['offset']=qs['offset'](_0x17451f['query'][_0x8b76('0x2e')]);}_0xec3506[_0x8b76('0x50')]=qs[_0x8b76('0x51')](_0x17451f[_0x8b76('0x47')]['sort']);_0xec3506['where']=qs[_0x8b76('0x49')](_[_0x8b76('0x53')](_0x17451f[_0x8b76('0x47')],_0x3f67b2[_0x8b76('0x49')]));_0xec3506[_0x8b76('0x52')][_0x8b76('0x65')]=_0x2d75a8['id'];if(_0x17451f['query'][_0x8b76('0x54')]){_0xec3506[_0x8b76('0x52')]=_[_0x8b76('0x55')](_0xec3506[_0x8b76('0x52')],{'$or':_['map'](_0xec3506[_0x8b76('0x4d')],function(_0x25f19a){var _0x1456f2={};_0x1456f2[_0x25f19a]={'$like':'%'+_0x17451f[_0x8b76('0x47')]['filter']+'%'};return _0x1456f2;})});}_0xec3506=_[_0x8b76('0x55')]({},_0xec3506,_0x17451f['options']);return db[_0x8b76('0x6c')]['count']({'where':_0xec3506[_0x8b76('0x52')]})[_0x8b76('0x36')](function(_0x142720){_0x23b55e[_0x8b76('0x31')]=_0x142720;if(_0x17451f['query'][_0x8b76('0x58')]){_0xec3506[_0x8b76('0x59')]=[{'all':!![]}];}return db[_0x8b76('0x6c')]['findAll'](_0xec3506);})[_0x8b76('0x36')](function(_0x1c854a){_0x23b55e[_0x8b76('0x5a')]=_0x1c854a;return _0x23b55e;});}})[_0x8b76('0x36')](respondWithFilteredResult(_0x5982e4,_0xec3506))[_0x8b76('0x5b')](handleError(_0x5982e4,null));};exports[_0x8b76('0x6f')]=function(_0x8b5934,_0x10b324,_0x5e0c77){return db[_0x8b76('0x42')][_0x8b76('0x5f')]({'where':{'id':_0x8b5934[_0x8b76('0x61')]['id']}})[_0x8b76('0x36')](handleEntityNotFound(_0x10b324,null))[_0x8b76('0x36')](function(_0x5a2cfa){if(_0x5a2cfa){return _0x5a2cfa['removeAnswers'](_0x8b5934[_0x8b76('0x47')][_0x8b76('0x70')]);}})['then'](respondWithStatusCode(_0x10b324,null))['catch'](handleError(_0x10b324,null));};exports[_0x8b76('0x66')]=function(_0x2158f1,_0x79df22){var _0x3db427={'name':_0x2158f1[_0x8b76('0x60')]['name'],'key':_0x2158f1[_0x8b76('0x60')]['key'],'email':_0x2158f1[_0x8b76('0x60')][_0x8b76('0x71')],'ListId':_0x2158f1['body']['ListId'],'active':!_['isNil'](_0x2158f1['body']['active'])?_0x2158f1[_0x8b76('0x60')][_0x8b76('0x72')]:!![],'description':_0x2158f1['body'][_0x8b76('0x73')]||null,'Imap':{},'Smtp':{}};if(_[_0x8b76('0x74')](_0x2158f1[_0x8b76('0x60')]['cservice'])){if(_0x2158f1[_0x8b76('0x60')][_0x8b76('0x75')]){_0x3db427[_0x8b76('0x3d')][_0x8b76('0x76')]=_0x3db427['Smtp']['user']=_0x2158f1[_0x8b76('0x60')][_0x8b76('0x77')];_0x3db427[_0x8b76('0x3d')]['password']=_0x3db427[_0x8b76('0x3f')][_0x8b76('0x78')]=_0x2158f1[_0x8b76('0x60')][_0x8b76('0x79')];}else{_0x3db427[_0x8b76('0x3d')][_0x8b76('0x7a')]=_0x3db427[_0x8b76('0x3f')][_0x8b76('0x7a')]=![];}_0x3db427['Imap'][_0x8b76('0x7b')]=_0x2158f1[_0x8b76('0x60')][_0x8b76('0x3d')][_0x8b76('0x7b')];_0x3db427[_0x8b76('0x3d')][_0x8b76('0x7c')]=_0x2158f1[_0x8b76('0x60')]['Imap'][_0x8b76('0x7c')];_0x3db427['Smtp'][_0x8b76('0x7b')]=_0x2158f1['body'][_0x8b76('0x3f')]['host'];_0x3db427[_0x8b76('0x3f')][_0x8b76('0x7c')]=_0x2158f1[_0x8b76('0x60')][_0x8b76('0x3f')][_0x8b76('0x7c')];}else{_0x3db427[_0x8b76('0x3d')][_0x8b76('0x7d')]=_0x3db427[_0x8b76('0x3f')][_0x8b76('0x7d')]=_0x2158f1[_0x8b76('0x60')]['cservice'];_0x3db427[_0x8b76('0x3d')]['user']=_0x3db427[_0x8b76('0x3f')][_0x8b76('0x76')]=_0x2158f1['body'][_0x8b76('0x77')];_0x3db427[_0x8b76('0x3d')][_0x8b76('0x7e')]=_0x3db427[_0x8b76('0x3f')][_0x8b76('0x78')]=_0x2158f1['body']['cpassword'];}return db[_0x8b76('0x42')]['create'](_0x3db427,{'include':[{'model':db[_0x8b76('0x3e')],'as':_0x8b76('0x3f')},{'model':db[_0x8b76('0x62')],'as':_0x8b76('0x3d')}]})['then'](function(_0x5ba0b8){var _0x1eaffc=_0x2158f1[_0x8b76('0x76')][_0x8b76('0x7f')]({'plain':!![]});if(!_0x1eaffc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1eaffc[_0x8b76('0x80')]==='user'){var _0x24d1bf=_0x5ba0b8[_0x8b76('0x7f')]({'plain':!![]});return db[_0x8b76('0x81')]['find']({'where':{'name':_0x8b76('0x37'),'userProfileId':_0x1eaffc['userProfileId']},'raw':!![]})[_0x8b76('0x36')](function(_0x373bb4){if(_0x373bb4&&_0x373bb4[_0x8b76('0x82')]===0x0){return db[_0x8b76('0x38')][_0x8b76('0x66')]({'name':_0x24d1bf[_0x8b76('0x3a')],'resourceId':_0x24d1bf['id'],'type':_0x373bb4[_0x8b76('0x3a')],'sectionId':_0x373bb4['id']},{})['then'](function(){return _0x5ba0b8;});}else{return _0x5ba0b8;}})[_0x8b76('0x5b')](function(_0x36482f){logger[_0x8b76('0x25')](_0x8b76('0x83'),_0x36482f);throw _0x36482f;});}return _0x5ba0b8;})[_0x8b76('0x36')](respondWithResult(_0x79df22,0xc9))[_0x8b76('0x5b')](handleError(_0x79df22,null));};exports[_0x8b76('0x84')]=function(_0x2eb0c4,_0x52a4e3,_0x5f0875){return db[_0x8b76('0x42')][_0x8b76('0x6e')]({'where':{'id':_0x2eb0c4['params']['id']}})[_0x8b76('0x36')](handleEntityNotFound(_0x52a4e3,null))[_0x8b76('0x36')](function(_0x8a0e37){if(_0x8a0e37){return _0x8a0e37[_0x8b76('0x84')]();}return null;})['then'](respondWithResult(_0x52a4e3,null))[_0x8b76('0x5b')](handleError(_0x52a4e3,null));};exports[_0x8b76('0x85')]=function(_0xdb424b,_0x83775a,_0x3ddeb5){if(_0xdb424b['body']['id']){delete _0xdb424b[_0x8b76('0x60')]['id'];}return db[_0x8b76('0x42')][_0x8b76('0x5f')]({'where':{'id':_0xdb424b[_0x8b76('0x61')]['id']}})[_0x8b76('0x36')](handleEntityNotFound(_0x83775a,null))['then'](function(_0x5c3fca){if(_0x5c3fca){_0xdb424b[_0x8b76('0x60')][_0x8b76('0x65')]=_0x5c3fca['id'];return db[_0x8b76('0x62')]['create'](_0xdb424b[_0x8b76('0x60')]);}})[_0x8b76('0x36')](respondWithResult(_0x83775a,null))['catch'](handleError(_0x83775a,null));};exports['removeImap']=function(_0x89e8c2,_0x17d282,_0x99f825){return db[_0x8b76('0x42')]['findOne']({'where':{'id':_0x89e8c2[_0x8b76('0x61')]['id']}})['then'](handleEntityNotFound(_0x17d282,null))[_0x8b76('0x36')](function(_0x2c2bc5){if(_0x2c2bc5){return _0x2c2bc5[_0x8b76('0x86')](null);}return null;})[_0x8b76('0x36')](respondWithStatusCode(_0x17d282,null))[_0x8b76('0x5b')](handleError(_0x17d282,null));};exports[_0x8b76('0x87')]=function(_0x1616d0,_0x35f9f9,_0x32934c){return db[_0x8b76('0x42')][_0x8b76('0x6e')]({'where':{'id':_0x1616d0[_0x8b76('0x61')]['id']}})[_0x8b76('0x36')](handleEntityNotFound(_0x35f9f9,null))[_0x8b76('0x36')](function(_0x4a7a9d){if(_0x4a7a9d){return _0x4a7a9d['getSmtp']();}return null;})['then'](respondWithResult(_0x35f9f9,null))[_0x8b76('0x5b')](handleError(_0x35f9f9,null));};exports[_0x8b76('0x88')]=function(_0x58f340,_0x266a4b,_0x5bd8ce){if(_0x58f340['body']['id']){delete _0x58f340[_0x8b76('0x60')]['id'];}return db[_0x8b76('0x42')][_0x8b76('0x5f')]({'where':{'id':_0x58f340[_0x8b76('0x61')]['id']}})[_0x8b76('0x36')](handleEntityNotFound(_0x266a4b,null))[_0x8b76('0x36')](function(_0x9dedaf){if(_0x9dedaf){_0x58f340[_0x8b76('0x60')][_0x8b76('0x65')]=_0x9dedaf['id'];return db[_0x8b76('0x3e')][_0x8b76('0x66')](_0x58f340['body']);}})[_0x8b76('0x36')](respondWithResult(_0x266a4b,null))[_0x8b76('0x5b')](handleError(_0x266a4b,null));};exports[_0x8b76('0x89')]=function(_0xcfeaf1,_0x168ac7,_0x584971){return db[_0x8b76('0x42')][_0x8b76('0x6e')]({'where':{'id':_0xcfeaf1[_0x8b76('0x61')]['id']}})['then'](handleEntityNotFound(_0x168ac7,null))[_0x8b76('0x36')](function(_0x3d76ad){if(_0x3d76ad){return _0x3d76ad['setSmtp'](null);}return null;})[_0x8b76('0x36')](respondWithStatusCode(_0x168ac7,null))[_0x8b76('0x5b')](handleError(_0x168ac7,null));};exports[_0x8b76('0x8a')]=function(_0x50522c,_0x53a888,_0x5ac6ee){return db[_0x8b76('0x8b')][_0x8b76('0x5f')]({'where':{'id':_0x50522c['params']['id']}})[_0x8b76('0x36')](handleEntityNotFound(_0x53a888,null))['then'](function(_0x5b71db){if(_0x5b71db){return _0x5b71db['addInteraction'](_0x50522c[_0x8b76('0x60')][_0x8b76('0x70')],_[_0x8b76('0x8c')](_0x50522c[_0x8b76('0x60')],[_0x8b76('0x70'),'id'])||{});}})[_0x8b76('0x36')](respondWithResult(_0x53a888,null))[_0x8b76('0x5b')](handleError(_0x53a888,null));};exports['getInteractions']=function(_0x4df18b,_0x3ccccb,_0xdc9a21){var _0x1f0142={'raw':![],'where':{}};var _0xdc8319={};var _0x16641d={'count':0x0,'rows':[]};return db[_0x8b76('0x42')]['findOne']({'where':{'id':_0x4df18b[_0x8b76('0x61')]['id']}})['then'](handleEntityNotFound(_0x3ccccb,null))[_0x8b76('0x36')](function(_0x4187ae){if(_0x4187ae){_0xdc8319[_0x8b76('0x46')]=_[_0x8b76('0x48')](db[_0x8b76('0x8b')][_0x8b76('0x43')]);_0xdc8319['query']=_['keys'](_0x4df18b[_0x8b76('0x47')]);_0xdc8319['filters']=_[_0x8b76('0x4a')](_0xdc8319['model'],_0xdc8319[_0x8b76('0x47')]);_0x1f0142[_0x8b76('0x4d')]=_[_0x8b76('0x4a')](_0xdc8319[_0x8b76('0x46')],qs['fields'](_0x4df18b[_0x8b76('0x47')][_0x8b76('0x4b')]));_0x1f0142[_0x8b76('0x4d')]=_0x1f0142['attributes'][_0x8b76('0x4c')]?_0x1f0142['attributes']:_0xdc8319[_0x8b76('0x46')];if(!_0x4df18b[_0x8b76('0x47')]['hasOwnProperty'](_0x8b76('0x4f'))){_0x1f0142[_0x8b76('0x30')]=qs[_0x8b76('0x30')](_0x4df18b[_0x8b76('0x47')][_0x8b76('0x30')]);_0x1f0142[_0x8b76('0x2e')]=qs[_0x8b76('0x2e')](_0x4df18b[_0x8b76('0x47')]['offset']);}_0x1f0142[_0x8b76('0x50')]=qs[_0x8b76('0x51')](_0x4df18b[_0x8b76('0x47')][_0x8b76('0x51')]);_0x1f0142['where']=qs[_0x8b76('0x49')](_['pick'](_0x4df18b[_0x8b76('0x47')],_0xdc8319['filters']));_0x1f0142['where'][_0x8b76('0x65')]=_0x4187ae['id'];if(_0x4df18b[_0x8b76('0x47')][_0x8b76('0x54')]){_0x1f0142[_0x8b76('0x52')]=_['merge'](_0x1f0142[_0x8b76('0x52')],{'$or':_[_0x8b76('0x41')](_0x1f0142[_0x8b76('0x4d')],function(_0x38dff9){var _0x43fe8f={};_0x43fe8f[_0x38dff9]={'$like':'%'+_0x4df18b['query']['filter']+'%'};return _0x43fe8f;})});}_0x1f0142=_[_0x8b76('0x55')]({},_0x1f0142,_0x4df18b['options']);return db[_0x8b76('0x8b')][_0x8b76('0x31')]({'where':_0x1f0142[_0x8b76('0x52')]})[_0x8b76('0x36')](function(_0x30ac36){_0x16641d[_0x8b76('0x31')]=_0x30ac36;if(_0x4df18b['query'][_0x8b76('0x58')]){_0x1f0142[_0x8b76('0x59')]=[{'model':db[_0x8b76('0x8d')],'as':_0x8b76('0x8e'),'required':![]},{'model':db[_0x8b76('0x8f')],'as':_0x8b76('0x90'),'attributes':['name',_0x8b76('0x91'),_0x8b76('0x92')],'required':![]},{'model':db[_0x8b76('0x93')],'as':'Tags','attributes':['id',_0x8b76('0x3a'),_0x8b76('0x94')],'where':_0x4df18b['query'][_0x8b76('0x95')]?{'id':_0x4df18b['query'][_0x8b76('0x95')]}:undefined,'required':_0x4df18b[_0x8b76('0x47')][_0x8b76('0x95')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x1f0142);})[_0x8b76('0x36')](function(_0x4e752c){_0x16641d[_0x8b76('0x5a')]=_0x4e752c;return _0x16641d;});}})[_0x8b76('0x36')](respondWithFilteredResult(_0x3ccccb,_0x1f0142))[_0x8b76('0x5b')](handleError(_0x3ccccb,null));};exports[_0x8b76('0x96')]=function(_0x48baa5,_0x18b880,_0xd7cdd1){return db[_0x8b76('0x42')][_0x8b76('0x6e')]({'where':{'id':_0x48baa5['params']['id']}})['then'](handleEntityNotFound(_0x18b880,null))['then'](function(_0x1cd031){if(_0x1cd031){return db[_0x8b76('0x97')][_0x8b76('0x98')](function(_0x24d12e){return db[_0x8b76('0x99')][_0x8b76('0x9a')]({'where':{'MailAccountId':_0x48baa5['params']['id']},'transaction':_0x24d12e})['then'](function(_0x5b0dab){var _0x3c9c3c=_[_0x8b76('0x41')](_0x48baa5[_0x8b76('0x60')],function(_0x208952){_0x208952[_0x8b76('0x65')]=_0x48baa5['params']['id'];return _0x208952;});return db[_0x8b76('0x99')][_0x8b76('0x9b')](_0x3c9c3c,{'transaction':_0x24d12e});});})['then'](function(){return db[_0x8b76('0x99')][_0x8b76('0x9c')]({'where':{'MailAccountId':_0x48baa5[_0x8b76('0x61')]['id']},'order':_0x8b76('0x9d')});});}})[_0x8b76('0x36')](respondWithResult(_0x18b880,null))[_0x8b76('0x5b')](handleError(_0x18b880,null));};exports[_0x8b76('0x9e')]=function(_0x475835,_0xa8cb6b,_0x594302){var _0x131a39={};var _0x10a9a3={};var _0x3149ef;var _0x4e25e2;return db[_0x8b76('0x42')][_0x8b76('0x6e')]({'where':{'id':_0x475835[_0x8b76('0x61')]['id']}})['then'](handleEntityNotFound(_0xa8cb6b,null))[_0x8b76('0x36')](function(_0x28759e){if(_0x28759e){_0x3149ef=_0x28759e;_0x10a9a3[_0x8b76('0x46')]=_[_0x8b76('0x48')](db[_0x8b76('0x99')][_0x8b76('0x43')]);_0x10a9a3['query']=_[_0x8b76('0x48')](_0x475835[_0x8b76('0x47')]);_0x10a9a3[_0x8b76('0x49')]=_[_0x8b76('0x4a')](_0x10a9a3[_0x8b76('0x46')],_0x10a9a3['query']);_0x131a39[_0x8b76('0x4d')]=_[_0x8b76('0x4a')](_0x10a9a3[_0x8b76('0x46')],qs[_0x8b76('0x4b')](_0x475835[_0x8b76('0x47')]['fields']));_0x131a39[_0x8b76('0x4d')]=_0x131a39[_0x8b76('0x4d')][_0x8b76('0x4c')]?_0x131a39[_0x8b76('0x4d')]:_0x10a9a3['model'];_0x131a39[_0x8b76('0x50')]=qs['sort'](_0x475835[_0x8b76('0x47')]['sort']);_0x131a39[_0x8b76('0x52')]=qs[_0x8b76('0x49')](_[_0x8b76('0x53')](_0x475835[_0x8b76('0x47')],_0x10a9a3[_0x8b76('0x49')]));if(_0x475835['query'][_0x8b76('0x54')]){_0x131a39['where']=_[_0x8b76('0x55')](_0x131a39[_0x8b76('0x52')],{'$or':_['map'](_0x131a39[_0x8b76('0x4d')],function(_0x5a1d5a){var _0xbd83fb={};_0xbd83fb[_0x5a1d5a]={'$like':'%'+_0x475835[_0x8b76('0x47')]['filter']+'%'};return _0xbd83fb;})});}_0x131a39=_[_0x8b76('0x55')]({},_0x131a39,_0x475835[_0x8b76('0x5e')]);return _0x3149ef[_0x8b76('0x9e')](_0x131a39);}})[_0x8b76('0x36')](function(_0x4c5aa3){if(_0x4c5aa3){_0x4e25e2=_0x4c5aa3[_0x8b76('0x4c')];if(!_0x475835[_0x8b76('0x47')][_0x8b76('0x4e')](_0x8b76('0x4f'))){_0x131a39['limit']=qs[_0x8b76('0x30')](_0x475835[_0x8b76('0x47')][_0x8b76('0x30')]);_0x131a39[_0x8b76('0x2e')]=qs['offset'](_0x475835[_0x8b76('0x47')][_0x8b76('0x2e')]);}return _0x3149ef[_0x8b76('0x9e')](_0x131a39);}})['then'](function(_0x326150){if(_0x326150){return _0x326150?{'count':_0x4e25e2,'rows':_0x326150}:null;}})['then'](respondWithResult(_0xa8cb6b,null))[_0x8b76('0x5b')](handleError(_0xa8cb6b,null));};exports[_0x8b76('0x9f')]=function(_0x31a865,_0x4fd1f2,_0x5b7fb2){var _0x202833={'raw':!![],'where':{}};var _0x48b7cf={};var _0x22a46c={'count':0x0,'rows':[]};return db[_0x8b76('0x42')][_0x8b76('0x6e')]({'where':{'id':_0x31a865['params']['id']}})['then'](handleEntityNotFound(_0x4fd1f2,null))[_0x8b76('0x36')](function(_0x4dcf34){if(_0x4dcf34){_0x48b7cf[_0x8b76('0x46')]=_[_0x8b76('0x48')](db['MailMessage'][_0x8b76('0x43')]);_0x48b7cf['query']=_['keys'](_0x31a865[_0x8b76('0x47')]);_0x48b7cf[_0x8b76('0x49')]=_['intersection'](_0x48b7cf['model'],_0x48b7cf[_0x8b76('0x47')]);_0x202833[_0x8b76('0x4d')]=_['intersection'](_0x48b7cf[_0x8b76('0x46')],qs['fields'](_0x31a865['query']['fields']));_0x202833[_0x8b76('0x4d')]=_0x202833[_0x8b76('0x4d')][_0x8b76('0x4c')]?_0x202833[_0x8b76('0x4d')]:_0x48b7cf[_0x8b76('0x46')];if(!_0x31a865[_0x8b76('0x47')][_0x8b76('0x4e')](_0x8b76('0x4f'))){_0x202833['limit']=qs[_0x8b76('0x30')](_0x31a865['query']['limit']);_0x202833['offset']=qs['offset'](_0x31a865[_0x8b76('0x47')][_0x8b76('0x2e')]);}_0x202833[_0x8b76('0x50')]=qs[_0x8b76('0x51')](_0x31a865[_0x8b76('0x47')][_0x8b76('0x51')]);_0x202833[_0x8b76('0x52')]=qs['filters'](_[_0x8b76('0x53')](_0x31a865[_0x8b76('0x47')],_0x48b7cf[_0x8b76('0x49')]));_0x202833[_0x8b76('0x52')][_0x8b76('0x65')]=_0x4dcf34['id'];if(_0x31a865[_0x8b76('0x47')]['filter']){_0x202833[_0x8b76('0x52')]=_['merge'](_0x202833[_0x8b76('0x52')],{'$or':_[_0x8b76('0x41')](_0x202833[_0x8b76('0x4d')],function(_0x55f997){var _0x4f1d2b={};_0x4f1d2b[_0x55f997]={'$like':'%'+_0x31a865['query'][_0x8b76('0x54')]+'%'};return _0x4f1d2b;})});}if(_0x31a865[_0x8b76('0x47')][_0x8b76('0xa0')]){var _0xb261fe=_0x31a865[_0x8b76('0x47')]['$gte']['split'](',');var _0x4f65ef={};_0x4f65ef[_0xb261fe[0x0]]={'$gte':moment(_0xb261fe[0x1])[_0x8b76('0xa1')](_0x8b76('0xa2'))};_0x202833[_0x8b76('0x52')]=_[_0x8b76('0x55')](_0x202833['where'],_0x4f65ef);}_0x202833=_[_0x8b76('0x55')]({},_0x202833,_0x31a865[_0x8b76('0x5e')]);return db[_0x8b76('0xa3')]['count']({'where':_0x202833[_0x8b76('0x52')]})[_0x8b76('0x36')](function(_0x2049a0){_0x22a46c[_0x8b76('0x31')]=_0x2049a0;if(_0x31a865['query'][_0x8b76('0x58')]){_0x202833[_0x8b76('0x59')]=[{'all':!![]}];}return db[_0x8b76('0xa3')][_0x8b76('0x69')](_0x202833);})[_0x8b76('0x36')](function(_0x11dba0){if(_0x31a865[_0x8b76('0x47')][_0x8b76('0xa4')]===_0x8b76('0xa5')){for(var _0xe6ec71=0x0;_0xe6ec71<_0x11dba0[_0x8b76('0x4c')];_0xe6ec71++){_0x11dba0[_0xe6ec71][_0x8b76('0x60')]=juice(_0x11dba0[_0xe6ec71][_0x8b76('0x60')]);}}_0x22a46c['rows']=_0x11dba0;return _0x22a46c;});}})[_0x8b76('0x36')](respondWithFilteredResult(_0x4fd1f2,_0x202833))['catch'](handleError(_0x4fd1f2,null));};exports[_0x8b76('0x3b')]=function(_0x75c340,_0x198b8c,_0x1c2a54){var _0x42b370,_0x203aec={},_0x78d418;if(_0x75c340['body']['to']){_0x78d418=_0x75c340[_0x8b76('0x60')]['to'][_0x8b76('0xa6')](',')[0x0];}return db['MailAccount'][_0x8b76('0x5f')]({'where':{'id':_0x75c340[_0x8b76('0x61')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x8b76('0x8d')],'as':'Contacts','where':{'email':_0x78d418},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x8b76('0x3e')],'as':_0x8b76('0x3f'),'raw':!![]}]})[_0x8b76('0x36')](handleEntityNotFound(_0x198b8c,null))[_0x8b76('0x36')](function(_0x38a4b9){if(_0x38a4b9){_0x42b370=_0x38a4b9;if(_0x38a4b9[_0x8b76('0x3f')]){if(_[_0x8b76('0x74')](_0x75c340[_0x8b76('0x60')]['from'])){_0x75c340[_0x8b76('0x60')][_0x8b76('0xa7')]=util['format'](_0x8b76('0xa8'),_0x38a4b9['name'],_0x38a4b9[_0x8b76('0x71')]||_0x38a4b9[_0x8b76('0x3f')][_0x8b76('0x76')]);}if(_0x75c340[_0x8b76('0x60')][_0x8b76('0xa9')]&&_0x75c340[_0x8b76('0x60')][_0x8b76('0xa9')][_0x8b76('0x4c')]){for(var _0x2d3fb1=0x0;_0x2d3fb1<_0x75c340[_0x8b76('0x60')][_0x8b76('0xa9')][_0x8b76('0x4c')];_0x2d3fb1+=0x1){_0x75c340['body'][_0x8b76('0xa9')][_0x2d3fb1]={'filename':_0x75c340[_0x8b76('0x60')][_0x8b76('0xa9')][_0x2d3fb1]['name'],'path':path['join'](config[_0x8b76('0xaa')],_0x8b76('0xab'),_0x75c340[_0x8b76('0x60')][_0x8b76('0xa9')][_0x2d3fb1]['basename'])};}}var _0x4890ee={'tls':{'rejectUnauthorized':![]}};if(_[_0x8b76('0x74')](_0x38a4b9['Smtp'][_0x8b76('0x7d')])){if(_0x38a4b9[_0x8b76('0x3f')][_0x8b76('0x7a')]){_0x4890ee[_0x8b76('0xac')]={'user':_0x38a4b9[_0x8b76('0x3f')][_0x8b76('0x76')],'pass':_0x38a4b9['Smtp'][_0x8b76('0x78')]};}_0x4890ee[_0x8b76('0x7b')]=_0x38a4b9[_0x8b76('0x3f')]['host'];_0x4890ee[_0x8b76('0x7c')]=_0x38a4b9[_0x8b76('0x3f')][_0x8b76('0x7c')];_0x4890ee[_0x8b76('0xad')]=_0x38a4b9['Smtp'][_0x8b76('0xad')];}else{_0x4890ee[_0x8b76('0x7d')]=_0x38a4b9[_0x8b76('0x3f')][_0x8b76('0x7d')];_0x4890ee['auth']={'user':_0x38a4b9['Smtp'][_0x8b76('0x76')],'pass':_0x38a4b9[_0x8b76('0x3f')][_0x8b76('0x78')]};}return respondWithRpcPromise(_0x8b76('0xae'),_0x8b76('0xaf'),{'account':_0x4890ee,'message':_0x75c340[_0x8b76('0x60')]});}else{throw new Error(_0x8b76('0xb0'));}}})[_0x8b76('0x36')](function(_0x52c096){if(_0x52c096){_0x203aec=_0x52c096;if(_0x42b370[_0x8b76('0xb1')]){if(_0x42b370['List'][_0x8b76('0xb2')][_0x8b76('0x4c')]){return _0x42b370[_0x8b76('0xb1')][_0x8b76('0xb2')][0x0];}else{return db[_0x8b76('0x8d')][_0x8b76('0x66')](_[_0x8b76('0x1c')](_0x75c340[_0x8b76('0x60')],{'firstName':_0x75c340[_0x8b76('0x60')]['to'],'email':_0x75c340[_0x8b76('0x60')]['to'],'phone':_0x75c340[_0x8b76('0x60')]['to'],'ListId':_0x42b370[_0x8b76('0xb3')]}));}}else{throw new Error(_0x8b76('0xb0'));}}})['then'](function(_0xdf0c4c){if(_0xdf0c4c){var _0x49032d={'UserId':_0x75c340[_0x8b76('0x76')]['id'],'ContactId':_0xdf0c4c['id'],'MailAccountId':_0x42b370['id'],'inReplyTo':_0x203aec[_0x8b76('0xb4')],'to':_0x75c340['body'][_0x8b76('0xa7')],'cc':_0x75c340[_0x8b76('0x60')]['cc'],'subject':_0x75c340[_0x8b76('0x60')]['subject'],'attach':_0x75c340[_0x8b76('0x60')][_0x8b76('0xb5')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x8b76('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0x8b76('0xb6'),'Messages':[_[_0x8b76('0x55')](_0x75c340[_0x8b76('0x60')],{'messageId':_0x203aec['messageId'],'sentAt':moment()[_0x8b76('0xa1')](_0x8b76('0xa2')),'read':!![],'MailAccountId':_0x42b370['id'],'UserId':_0x75c340['user']['id'],'ContactId':_0xdf0c4c['id']})]};if(_0x75c340[_0x8b76('0x60')][_0x8b76('0xb7')]){_0x49032d=_[_0x8b76('0x55')](_0x49032d,_0x75c340[_0x8b76('0x60')][_0x8b76('0xb7')]);}return db['MailInteraction'][_0x8b76('0x66')](_0x49032d,{'include':[{'model':db[_0x8b76('0xa3')],'as':'Messages'}]});}})[_0x8b76('0x36')](respondWithResult(_0x198b8c,null))[_0x8b76('0x5b')](handleError(_0x198b8c,null));};exports[_0x8b76('0xb8')]=function(_0xbe09e2,_0x52b4e8,_0x1874e){return db[_0x8b76('0x42')]['find']({'where':{'id':_0xbe09e2[_0x8b76('0x61')]['id']},'include':[{'model':db[_0x8b76('0x3e')],'as':_0x8b76('0x3f'),'raw':!![]}]})[_0x8b76('0x36')](handleEntityNotFound(_0x52b4e8,null))['then'](function(_0x4a8573){if(_0x4a8573&&_0x4a8573[_0x8b76('0x3f')]){var _0x22207b={'id':_0x4a8573['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4a8573[_0x8b76('0x3f')][_0x8b76('0x7d')]){_0x22207b[_0x8b76('0x7d')]=_0x4a8573[_0x8b76('0x3f')][_0x8b76('0x7d')];}else{_0x22207b['host']=_0x4a8573['Smtp']['host'];_0x22207b['port']=_0x4a8573[_0x8b76('0x3f')]['port'];_0x22207b[_0x8b76('0xad')]=_0x4a8573[_0x8b76('0x3f')][_0x8b76('0xad')];}if(_0x4a8573[_0x8b76('0x3f')][_0x8b76('0x7a')]){_0x22207b[_0x8b76('0xac')]={'user':_0x4a8573[_0x8b76('0x3f')][_0x8b76('0x76')],'pass':_0x4a8573[_0x8b76('0x3f')][_0x8b76('0x78')]};}return respondWithRpcPromise(_0x8b76('0xb9'),_0x8b76('0xb8'),{'account':_0x22207b});}})[_0x8b76('0x36')](respondWithResult(_0x52b4e8,null))[_0x8b76('0x5b')](handleError(_0x52b4e8,null));};exports[_0x8b76('0x9a')]=function(_0x34491e,_0x52226f){return db[_0x8b76('0x42')][_0x8b76('0x5f')]({'where':{'id':_0x34491e[_0x8b76('0x61')]['id']}})[_0x8b76('0x36')](handleEntityNotFound(_0x52226f,null))[_0x8b76('0x36')](function(_0x9c73e7){if(_0x9c73e7&&_0x9c73e7['service']){throw new db[(_0x8b76('0xba'))][(_0x8b76('0xbb'))](_0x8b76('0xbc'));}return _0x9c73e7;})['then'](removeEntity(_0x52226f,null))[_0x8b76('0x5b')](handleError(_0x52226f,null));};exports[_0x8b76('0xbd')]=function(_0xeb8007,_0x3845fb,_0x317a94){return db[_0x8b76('0x42')][_0x8b76('0x5f')]({'where':{'id':_0xeb8007[_0x8b76('0x61')]['id']}})['then'](handleEntityNotFound(_0x3845fb,null))[_0x8b76('0x36')](function(_0x4ddc9d){if(_0x4ddc9d){return _0x4ddc9d[_0x8b76('0xbd')](_0xeb8007[_0x8b76('0x60')][_0x8b76('0x70')],_[_0x8b76('0x8c')](_0xeb8007[_0x8b76('0x60')],[_0x8b76('0x70'),'id'])||{})[_0x8b76('0xbe')](function(_0x3bd74a){for(var _0x5aacf8=0x0;_0x5aacf8<_0xeb8007[_0x8b76('0x60')][_0x8b76('0x70')][_0x8b76('0x4c')];_0x5aacf8+=0x1){socket[_0x8b76('0xbf')](_0x8b76('0xc0'),{'UserId':Number(_0xeb8007[_0x8b76('0x60')]['ids'][_0x5aacf8]),'MailAccountId':Number(_0xeb8007[_0x8b76('0x61')]['id'])});}return _0x3bd74a;});}})['then'](respondWithResult(_0x3845fb,null))[_0x8b76('0x5b')](handleError(_0x3845fb,null));};exports[_0x8b76('0xc1')]=function(_0x4d24dd,_0x969c23,_0x528443){return db[_0x8b76('0x42')][_0x8b76('0x5f')]({'where':{'id':_0x4d24dd[_0x8b76('0x61')]['id']}})[_0x8b76('0x36')](handleEntityNotFound(_0x969c23,null))[_0x8b76('0x36')](function(_0x138644){if(_0x138644){return _0x138644['removeAgents'](_0x4d24dd['query'][_0x8b76('0x70')])[_0x8b76('0x36')](function(){if(_['isArray'](_0x4d24dd[_0x8b76('0x47')][_0x8b76('0x70')])){for(var _0x3bf4b3=0x0;_0x3bf4b3<_0x4d24dd['query'][_0x8b76('0x70')][_0x8b76('0x4c')];_0x3bf4b3+=0x1){socket[_0x8b76('0xbf')](_0x8b76('0xc2'),{'UserId':Number(_0x4d24dd[_0x8b76('0x47')][_0x8b76('0x70')][_0x3bf4b3]),'MailAccountId':Number(_0x4d24dd['params']['id'])});}}else{socket[_0x8b76('0xbf')](_0x8b76('0xc2'),{'UserId':Number(_0x4d24dd['query'][_0x8b76('0x70')]),'MailAccountId':Number(_0x4d24dd[_0x8b76('0x61')]['id'])});}});}})[_0x8b76('0x36')](respondWithStatusCode(_0x969c23,null))['catch'](handleError(_0x969c23,null));};exports[_0x8b76('0xc3')]=function(_0x4ed91f,_0x8ff4f3,_0x4744d2){var _0x5caa04={};var _0x7dc0ff={};var _0x486842;var _0x2d8f9a;return db[_0x8b76('0x42')]['findOne']({'where':{'id':_0x4ed91f[_0x8b76('0x61')]['id']}})['then'](handleEntityNotFound(_0x8ff4f3,null))[_0x8b76('0x36')](function(_0x184f28){if(_0x184f28){_0x486842=_0x184f28;_0x7dc0ff[_0x8b76('0x46')]=_['keys'](db['User']['rawAttributes']);_0x7dc0ff[_0x8b76('0x47')]=_['keys'](_0x4ed91f[_0x8b76('0x47')]);_0x7dc0ff[_0x8b76('0x49')]=_[_0x8b76('0x4a')](_0x7dc0ff[_0x8b76('0x46')],_0x7dc0ff[_0x8b76('0x47')]);_0x5caa04[_0x8b76('0x4d')]=_['intersection'](_0x7dc0ff[_0x8b76('0x46')],qs[_0x8b76('0x4b')](_0x4ed91f['query'][_0x8b76('0x4b')]));_0x5caa04[_0x8b76('0x4d')]=_0x5caa04[_0x8b76('0x4d')][_0x8b76('0x4c')]?_0x5caa04['attributes']:_0x7dc0ff[_0x8b76('0x46')];_0x5caa04[_0x8b76('0x50')]=qs[_0x8b76('0x51')](_0x4ed91f['query'][_0x8b76('0x51')]);_0x5caa04[_0x8b76('0x52')]=qs[_0x8b76('0x49')](_[_0x8b76('0x53')](_0x4ed91f[_0x8b76('0x47')],_0x7dc0ff['filters']));if(_0x4ed91f['query'][_0x8b76('0x54')]){_0x5caa04[_0x8b76('0x52')]=_[_0x8b76('0x55')](_0x5caa04['where'],{'$or':_['map'](_0x5caa04['attributes'],function(_0x56f143){var _0x4d421f={};_0x4d421f[_0x56f143]={'$like':'%'+_0x4ed91f['query'][_0x8b76('0x54')]+'%'};return _0x4d421f;})});}_0x5caa04=_['merge']({},_0x5caa04,_0x4ed91f['options']);return _0x486842['getAgents'](_0x5caa04);}})['then'](function(_0x371890){if(_0x371890){_0x2d8f9a=_0x371890[_0x8b76('0x4c')];if(!_0x4ed91f[_0x8b76('0x47')][_0x8b76('0x4e')](_0x8b76('0x4f'))){_0x5caa04['limit']=qs['limit'](_0x4ed91f[_0x8b76('0x47')]['limit']);_0x5caa04['offset']=qs[_0x8b76('0x2e')](_0x4ed91f[_0x8b76('0x47')]['offset']);}return _0x486842['getAgents'](_0x5caa04);}})[_0x8b76('0x36')](function(_0xe344c2){if(_0xe344c2){return _0xe344c2?{'count':_0x2d8f9a,'rows':_0xe344c2}:null;}})[_0x8b76('0x36')](respondWithResult(_0x8ff4f3,null))[_0x8b76('0x5b')](handleError(_0x8ff4f3,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 6867a90..7bc79fd 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 _0xcd2f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x39a9d5,_0x3975b4){var _0x130c30=function(_0x3106df){while(--_0x3106df){_0x39a9d5['push'](_0x39a9d5['shift']());}};_0x130c30(++_0x3975b4);}(_0xcd2f,0xf8));var _0xfcd2=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xcd2f[_0x278e3c];return _0x3e2d9b;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xfcd2('0x0')](0x0);var events={'afterCreate':_0xfcd2('0x1'),'afterUpdate':_0xfcd2('0x2'),'afterDestroy':_0xfcd2('0x3')};function emitEvent(_0x131baf){return function(_0x248361,_0x8a26c,_0x11562c){MailAccountEvents['emit'](_0x131baf+':'+_0x248361['id'],_0x248361);MailAccountEvents[_0xfcd2('0x4')](_0x131baf,_0x248361);_0x11562c(null);};}for(var e in events){if(events[_0xfcd2('0x5')](e)){var event=events[e];MailAccount[_0xfcd2('0x6')](e,emitEvent(event));}}module[_0xfcd2('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x8163=['save','emit','hasOwnProperty','events','../../mysqldb','MailAccount','setMaxListeners'];(function(_0x249032,_0x199d40){var _0x4f7ff0=function(_0x167b03){while(--_0x167b03){_0x249032['push'](_0x249032['shift']());}};_0x4f7ff0(++_0x199d40);}(_0x8163,0x11b));var _0x3816=function(_0x57ff82,_0x4f269d){_0x57ff82=_0x57ff82-0x0;var _0x3e4131=_0x8163[_0x57ff82];return _0x3e4131;};'use strict';var EventEmitter=require(_0x3816('0x0'));var MailAccount=require(_0x3816('0x1'))['db'][_0x3816('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x3816('0x3')](0x0);var events={'afterCreate':_0x3816('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x46368b){return function(_0x52ce17,_0x347a7,_0x33d7d2){MailAccountEvents[_0x3816('0x5')](_0x46368b+':'+_0x52ce17['id'],_0x52ce17);MailAccountEvents['emit'](_0x46368b,_0x52ce17);_0x33d7d2(null);};}for(var e in events){if(events[_0x3816('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 672e0a3..ec89bf9 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 _0xa2ba=['util','api','moment','bluebird','request-promise','path','rimraf','exports','define','MailAccount','lodash'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0xa2ba,0xd0));var _0xaa2b=function(_0x2e893b,_0x335691){_0x2e893b=_0x2e893b-0x0;var _0x5c6338=_0xa2ba[_0x2e893b];return _0x5c6338;};'use strict';var _=require(_0xaa2b('0x0'));var util=require(_0xaa2b('0x1'));var logger=require('../../config/logger')(_0xaa2b('0x2'));var moment=require(_0xaa2b('0x3'));var BPromise=require(_0xaa2b('0x4'));var rp=require(_0xaa2b('0x5'));var fs=require('fs');var path=require(_0xaa2b('0x6'));var rimraf=require(_0xaa2b('0x7'));var config=require('../../config/environment');var attributes=require('./mailAccount.attributes');module[_0xaa2b('0x8')]=function(_0x282ad1,_0x31c318){return _0x282ad1[_0xaa2b('0x9')](_0xaa2b('0xa'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4dc=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','mail_accounts','lodash','util','../../config/logger'];(function(_0x4e6c59,_0x28f5f2){var _0xf170b2=function(_0x10a2f7){while(--_0x10a2f7){_0x4e6c59['push'](_0x4e6c59['shift']());}};_0xf170b2(++_0x28f5f2);}(_0xf4dc,0x13c));var _0xcf4d=function(_0x4a54b9,_0x774232){_0x4a54b9=_0x4a54b9-0x0;var _0x328f22=_0xf4dc[_0x4a54b9];return _0x328f22;};'use strict';var _=require(_0xcf4d('0x0'));var util=require(_0xcf4d('0x1'));var logger=require(_0xcf4d('0x2'))('api');var moment=require(_0xcf4d('0x3'));var BPromise=require(_0xcf4d('0x4'));var rp=require(_0xcf4d('0x5'));var fs=require('fs');var path=require(_0xcf4d('0x6'));var rimraf=require(_0xcf4d('0x7'));var config=require(_0xcf4d('0x8'));var attributes=require(_0xcf4d('0x9'));module['exports']=function(_0x56371e,_0x1c9a23){return _0x56371e['define']('MailAccount',attributes,{'tableName':_0xcf4d('0xa'),'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 b474de3..1922593 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 _0xdc79=['find','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','List','Contacts','DESC','MailServerOut','Smtp','get','omit','Applications','applications','list','orderBy','priority','asc','autoclose','push','close','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','update','subject','created','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','interaction','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','catch','MailAccount','findAll','options','raw','attributes','include','map','model','GetMailAccount','ShowMailAccount'];(function(_0x38aec6,_0x2ad06a){var _0x56a203=function(_0x3a3821){while(--_0x3a3821){_0x38aec6['push'](_0x38aec6['shift']());}};_0x56a203(++_0x2ad06a);}(_0xdc79,0x117));var _0x9dc7=function(_0x3c8ec4,_0x3bd8c6){_0x3c8ec4=_0x3c8ec4-0x0;var _0x2175a9=_0xdc79[_0x3c8ec4];return _0x2175a9;};'use strict';var _=require(_0x9dc7('0x0'));var util=require(_0x9dc7('0x1'));var moment=require(_0x9dc7('0x2'));var BPromise=require(_0x9dc7('0x3'));var rs=require(_0x9dc7('0x4'));var fs=require('fs');var Redis=require(_0x9dc7('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9dc7('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9dc7('0x7'));var jayson=require(_0x9dc7('0x8'));var client=jayson[_0x9dc7('0x9')][_0x9dc7('0xa')]({'port':0x232c});config[_0x9dc7('0xb')]=_[_0x9dc7('0xc')](config[_0x9dc7('0xb')],{'host':_0x9dc7('0xd'),'port':0x18eb});var socket=require(_0x9dc7('0xe'))(new Redis(config[_0x9dc7('0xb')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x103210,_0x46599c,_0x44997b){return new BPromise(function(_0x3924ae,_0x2ab051){return client[_0x9dc7('0xf')](_0x103210,_0x44997b)[_0x9dc7('0x10')](function(_0x5b6647){logger['info'](_0x9dc7('0x11'),_0x46599c,'request\x20sent');logger[_0x9dc7('0x12')](_0x9dc7('0x13'),_0x46599c,'request\x20sent',JSON[_0x9dc7('0x14')](_0x5b6647));if(_0x5b6647['error']){if(_0x5b6647['error']['code']===0x1f4){logger['error'](_0x9dc7('0x11'),_0x46599c,_0x5b6647[_0x9dc7('0x15')]['message']);return _0x2ab051(_0x5b6647[_0x9dc7('0x15')][_0x9dc7('0x16')]);}logger[_0x9dc7('0x15')](_0x9dc7('0x11'),_0x46599c,_0x5b6647[_0x9dc7('0x15')][_0x9dc7('0x16')]);return _0x3924ae(_0x5b6647[_0x9dc7('0x15')][_0x9dc7('0x16')]);}else{logger[_0x9dc7('0x17')](_0x9dc7('0x11'),_0x46599c,_0x9dc7('0x18'));_0x3924ae(_0x5b6647['result'][_0x9dc7('0x16')]);}})[_0x9dc7('0x19')](function(_0x385484){logger[_0x9dc7('0x15')](_0x9dc7('0x11'),_0x46599c,_0x385484);_0x2ab051(_0x385484);});});}exports['GetMailAccount']=function(_0x31354b){var _0x8a0ec4=this;return new Promise(function(_0x1e4c18,_0x3c000b){return db[_0x9dc7('0x1a')][_0x9dc7('0x1b')]({'raw':_0x31354b[_0x9dc7('0x1c')]?_0x31354b[_0x9dc7('0x1c')][_0x9dc7('0x1d')]===undefined?!![]:![]:!![],'where':_0x31354b['options']?_0x31354b[_0x9dc7('0x1c')]['where']||null:null,'attributes':_0x31354b['options']?_0x31354b[_0x9dc7('0x1c')][_0x9dc7('0x1e')]||null:null,'limit':_0x31354b[_0x9dc7('0x1c')]?_0x31354b['options']['limit']||null:null,'include':_0x31354b[_0x9dc7('0x1c')]?_0x31354b[_0x9dc7('0x1c')][_0x9dc7('0x1f')]?_[_0x9dc7('0x20')](_0x31354b[_0x9dc7('0x1c')][_0x9dc7('0x1f')],function(_0x54a7a0){return{'model':db[_0x54a7a0[_0x9dc7('0x21')]],'as':_0x54a7a0['as'],'attributes':_0x54a7a0['attributes'],'include':_0x54a7a0[_0x9dc7('0x1f')]?_[_0x9dc7('0x20')](_0x54a7a0['include'],function(_0x169c2a){return{'model':db[_0x169c2a[_0x9dc7('0x21')]],'as':_0x169c2a['as'],'attributes':_0x169c2a['attributes'],'include':_0x169c2a['include']?_[_0x9dc7('0x20')](_0x169c2a['include'],function(_0x1682b9){return{'model':db[_0x1682b9[_0x9dc7('0x21')]],'as':_0x1682b9['as'],'attributes':_0x1682b9['attributes']};}):[]};}):[]};}):[]:[]})[_0x9dc7('0x10')](function(_0x1aa8ec){logger[_0x9dc7('0x17')](_0x9dc7('0x22'),_0x31354b);logger[_0x9dc7('0x12')](_0x9dc7('0x22'),_0x31354b,JSON[_0x9dc7('0x14')](_0x1aa8ec));_0x1e4c18(_0x1aa8ec);})[_0x9dc7('0x19')](function(_0x6145ca){logger[_0x9dc7('0x15')](_0x9dc7('0x22'),_0x6145ca['message'],_0x31354b);_0x3c000b(_0x8a0ec4[_0x9dc7('0x15')](0x1f4,_0x6145ca['message']));});});};exports[_0x9dc7('0x23')]=function(_0x54599f){var _0x549e9f=this;return new Promise(function(_0x15e418,_0x326f3c){return db[_0x9dc7('0x1a')][_0x9dc7('0x24')]({'raw':_0x54599f['options']?_0x54599f[_0x9dc7('0x1c')][_0x9dc7('0x1d')]===undefined?!![]:![]:!![],'where':_0x54599f[_0x9dc7('0x1c')]?_0x54599f[_0x9dc7('0x1c')]['where']||null:null,'attributes':_0x54599f[_0x9dc7('0x1c')]?_0x54599f[_0x9dc7('0x1c')]['attributes']||null:null,'include':_0x54599f[_0x9dc7('0x1c')]?_0x54599f[_0x9dc7('0x1c')][_0x9dc7('0x1f')]?_[_0x9dc7('0x20')](_0x54599f['options']['include'],function(_0x478ccc){return{'model':db[_0x478ccc[_0x9dc7('0x21')]],'as':_0x478ccc['as'],'attributes':_0x478ccc[_0x9dc7('0x1e')],'include':_0x478ccc[_0x9dc7('0x1f')]?_[_0x9dc7('0x20')](_0x478ccc[_0x9dc7('0x1f')],function(_0x847d0){return{'model':db[_0x847d0['model']],'as':_0x847d0['as'],'attributes':_0x847d0['attributes'],'include':_0x847d0[_0x9dc7('0x1f')]?_[_0x9dc7('0x20')](_0x847d0['include'],function(_0x531a73){return{'model':db[_0x531a73[_0x9dc7('0x21')]],'as':_0x531a73['as'],'attributes':_0x531a73[_0x9dc7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9dc7('0x10')](function(_0x5a63e0){logger[_0x9dc7('0x17')](_0x9dc7('0x23'),_0x54599f);logger['debug'](_0x9dc7('0x23'),_0x54599f,JSON[_0x9dc7('0x14')](_0x5a63e0));_0x15e418(_0x5a63e0);})[_0x9dc7('0x19')](function(_0x4483ab){logger[_0x9dc7('0x15')](_0x9dc7('0x23'),_0x4483ab['message'],_0x54599f);_0x326f3c(_0x549e9f['error'](0x1f4,_0x4483ab[_0x9dc7('0x16')]));});});};exports[_0x9dc7('0x25')]=function(_0x5c0b14){var _0x21c94f=this;return new Promise(function(_0x5dada9,_0x13b255){var _0xe220d8={'body':_0x5c0b14[_0x9dc7('0x26')],'channel':_0x9dc7('0x27')};var _0x2e1be1=_[_0x9dc7('0x28')](_[_0x9dc7('0x29')](db[_0x9dc7('0x2a')][_0x9dc7('0x2b')]),['createdAt',_0x9dc7('0x2c'),_0x9dc7('0x2d'),_0x9dc7('0x2e')]);var _0x5642be=![];if(_0x5c0b14[_0x9dc7('0x26')]['id']){delete _0x5c0b14[_0x9dc7('0x26')]['id'];}if(_[_0x9dc7('0x2f')](_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x30')])){return _0x13b255(_0x21c94f[_0x9dc7('0x15')](0x1f4,_0x9dc7('0x31')));}if(_[_0x9dc7('0x2f')](_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x26')])||_0x5c0b14['body'][_0x9dc7('0x26')]===''){return _0x13b255(_0x21c94f[_0x9dc7('0x15')](0x1f4,_0x9dc7('0x32')));}if(_[_0x9dc7('0x2f')](_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x33')])){return _0x13b255(_0x21c94f[_0x9dc7('0x15')](0x1f4,_0x9dc7('0x34')+_0x2e1be1));}if(!_[_0x9dc7('0x35')](_0x2e1be1,_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x33')])){return _0x13b255(_0x21c94f[_0x9dc7('0x15')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2e1be1));}var _0x19081d={};_0x19081d[_0x5c0b14['body'][_0x9dc7('0x33')]]=_0x5c0b14[_0x9dc7('0x26')]['from'];return db['MailAccount'][_0x9dc7('0x24')]({'where':{'id':_0x5c0b14[_0x9dc7('0x36')]['id']},'include':[{'model':db[_0x9dc7('0x37')],'as':_0x9dc7('0x38'),'include':[{'model':db[_0x9dc7('0x2a')],'as':_0x9dc7('0x39'),'where':_0x19081d,'limit':0x1,'order':[[_0x9dc7('0x2c'),_0x9dc7('0x3a')]]}]},{'model':db['MailApplication'],'as':'Applications'},{'model':db[_0x9dc7('0x3b')],'as':_0x9dc7('0x3c')}]})['then'](function(_0x3022f9){if(_0x3022f9&&_0x3022f9[_0x9dc7('0x38')]){var _0x460727=_0x3022f9[_0x9dc7('0x3d')]({'plain':!![]});_0xe220d8[_0x9dc7('0x36')]=_[_0x9dc7('0x3e')](_0x460727,[_0x9dc7('0x3f'),'List']);_0xe220d8[_0x9dc7('0x40')]=_0x460727[_0x9dc7('0x3f')];_0xe220d8[_0x9dc7('0x41')]=_0x460727[_0x9dc7('0x38')];_0xe220d8[_0x9dc7('0x40')]=_[_0x9dc7('0x42')](_0xe220d8[_0x9dc7('0x40')],[_0x9dc7('0x43')],[_0x9dc7('0x44')]);if(_0xe220d8['account']&&_0xe220d8[_0x9dc7('0x36')][_0x9dc7('0x45')]){_0xe220d8['applications'][_0x9dc7('0x46')]({'id':0x0,'priority':_0xe220d8[_0x9dc7('0x40')]['length']+0x1,'app':_0x9dc7('0x47'),'appdata':_0x9dc7('0x45'),'interval':_0x9dc7('0x48')});}if(_0xe220d8[_0x9dc7('0x36')][_0x9dc7('0x3f')]){delete _0xe220d8[_0x9dc7('0x36')]['Applications'];}if(_0xe220d8['account'][_0x9dc7('0x38')]){delete _0xe220d8[_0x9dc7('0x36')][_0x9dc7('0x38')];}if(_0x460727[_0x9dc7('0x38')][_0x9dc7('0x39')]['length']){return _0x460727[_0x9dc7('0x38')][_0x9dc7('0x39')][0x0];}var _0x5cc5fb=_[_0x9dc7('0xc')](_0x5c0b14[_0x9dc7('0x26')],{'firstName':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x30')],'ListId':_0x460727[_0x9dc7('0x2e')]});_0x5cc5fb[_0x5c0b14[_0x9dc7('0x26')]['mapKey']]=_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x30')];return db[_0x9dc7('0x2a')][_0x9dc7('0x49')](_0x5cc5fb);}else{throw new Error(_0x9dc7('0x4a'));}})[_0x9dc7('0x10')](function(_0x33aeef){_0xe220d8[_0x9dc7('0x4b')]=_0x33aeef;if(_0x33aeef){if(!_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x4c')]){_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')]['messageId']=rs[_0x9dc7('0x4d')]()+'\x20'+_0x5c0b14['body']['message'][_0x9dc7('0x30')];}var _0x3aa28a={'ContactId':_0x33aeef['id'],'MailAccountId':_0x5c0b14[_0x9dc7('0x36')]['id'],'inReplyTo':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x4c')],'to':_0x5c0b14['body']['message'][_0x9dc7('0x30')],'cc':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')]['cc'],'subject':_0x5c0b14[_0x9dc7('0x26')]['message']['subject'],'attach':_0x5c0b14['body'][_0x9dc7('0x16')][_0x9dc7('0x4e')],'lastMsgAt':moment()[_0x9dc7('0x4f')](_0x9dc7('0x50')),'lastMsgDirection':'in'};return db[_0x9dc7('0x51')][_0x9dc7('0x24')]({'where':{'closed':![],'MailAccountId':_0x5c0b14[_0x9dc7('0x36')]['id']},'include':[{'model':db[_0x9dc7('0x52')],'as':_0x9dc7('0x53'),'attributes':['messageId'],'where':{'messageId':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x54')]}}]})[_0x9dc7('0x10')](function(_0x28d30b){if(_0x28d30b){return[_0x28d30b,![]];}return db[_0x9dc7('0x51')][_0x9dc7('0x49')](_0x3aa28a)[_0x9dc7('0x10')](function(_0x2a62d5){return[_0x2a62d5,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x9dc7('0x55')](function(_0x24d664,_0x12d27c){if(_0x24d664){_0x5642be=_0x12d27c;if(!_0x12d27c){return _0x24d664[_0x9dc7('0x56')]({'inReplyTo':_0x5c0b14[_0x9dc7('0x26')]['message'][_0x9dc7('0x4c')],'to':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x30')],'cc':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')]['cc'],'subject':_0x5c0b14['body'][_0x9dc7('0x16')][_0x9dc7('0x57')],'attach':_0x24d664[_0x9dc7('0x4e')]?_0x24d664[_0x9dc7('0x4e')]:_0x5c0b14['body'][_0x9dc7('0x16')][_0x9dc7('0x4e')],'substatus':null,'substatusAt':moment()[_0x9dc7('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x9dc7('0x4f')](_0x9dc7('0x50')),'lastMsgDirection':'in'});}else{return _0x24d664;}}})[_0x9dc7('0x10')](function(_0x12c1f0){_0xe220d8['interaction']=_0x12c1f0['get']({'plain':!![]});_0xe220d8['interaction'][_0x9dc7('0x58')]=_0x5642be;return db[_0x9dc7('0x52')][_0x9dc7('0x49')]({'body':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x26')],'MailAccountId':_0x5c0b14[_0x9dc7('0x36')]['id'],'MailInteractionId':_0x12c1f0['id'],'direction':'in','ContactId':_0xe220d8[_0x9dc7('0x4b')]['id'],'messageId':_0x5c0b14['body'][_0x9dc7('0x16')][_0x9dc7('0x4c')],'from':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')]['from'],'to':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')]['to'],'cc':_0x5c0b14['body'][_0x9dc7('0x16')]['cc'],'subject':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')]['subject'],'attach':_0x5c0b14['body'][_0x9dc7('0x16')]['attach'],'Attachments':_0x5c0b14['body'][_0x9dc7('0x16')]['attachments'],'originTo':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x59')],'originCc':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x5a')],'bcc':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x5b')],'ChatWebsiteId':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x5c')]||null,'originChannel':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x5d')]||_0x9dc7('0x5e'),'ChatOfflineMessageId':_0x5c0b14[_0x9dc7('0x26')][_0x9dc7('0x16')][_0x9dc7('0x5f')]||null},{'include':[{'model':db[_0x9dc7('0x60')],'as':'Attachments'}]});})[_0x9dc7('0x10')](function(_0x2b9f60){_0xe220d8[_0x9dc7('0x16')]=_0x2b9f60;if(_0xe220d8[_0x9dc7('0x61')][_0x9dc7('0x62')]){return db[_0x9dc7('0x63')][_0x9dc7('0x24')]({'attributes':['id','name'],'where':{'id':_0xe220d8[_0x9dc7('0x61')][_0x9dc7('0x62')]}})[_0x9dc7('0x10')](function(_0x409094){if(_0x409094){_0xe220d8[_0x9dc7('0x40')][_0x9dc7('0x64')]({'id':0x0,'priority':0x0,'app':_0x9dc7('0x65'),'appdata':_0x409094[_0x9dc7('0x66')]+','+(_0xe220d8[_0x9dc7('0x36')][_0x9dc7('0x67')]||0xa),'interval':_0x9dc7('0x48')});}return respondWithRpcPromise(_0x9dc7('0x68'),'startRouting',_0xe220d8);});}return respondWithRpcPromise(_0x9dc7('0x68'),'startRouting',_0xe220d8);})[_0x9dc7('0x10')](function(_0x308a0b){_0x5dada9(_0x308a0b);})['catch'](function(_0x5e7208){_0x13b255(_0x21c94f[_0x9dc7('0x15')](0x1f4,_0x5e7208[_0x9dc7('0x16')]));});});}; \ No newline at end of file +var _0x1bf5=['MailServerOut','Smtp','omit','List','applications','orderBy','priority','asc','push','close','autoclose','*,*,*,*','create','contact','messageId','generate','subject','attach','format','MailMessage','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','YYYY-MM-DD\x20HH:mm:ss','get','interaction','created','originTo','ChatWebsiteId','originChannel','Email','Attachments','UserId','unshift','agent','waitForTheAssignedAgent','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','register','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','include','model','map','ShowMailAccount','then','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','ListId','from','from\x20is\x20mandatory','isNil','mapKey','includes','find','account','Contacts','DESC','Applications'];(function(_0x1c5142,_0x30ea72){var _0x1268cb=function(_0xaa2299){while(--_0xaa2299){_0x1c5142['push'](_0x1c5142['shift']());}};_0x1268cb(++_0x30ea72);}(_0x1bf5,0x85));var _0x51bf=function(_0x31317e,_0x2ccb12){_0x31317e=_0x31317e-0x0;var _0x45ae37=_0x1bf5[_0x31317e];return _0x45ae37;};'use strict';var _=require(_0x51bf('0x0'));var util=require(_0x51bf('0x1'));var moment=require(_0x51bf('0x2'));var BPromise=require(_0x51bf('0x3'));var rs=require(_0x51bf('0x4'));var fs=require('fs');var Redis=require(_0x51bf('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x51bf('0x6'));var logger=require(_0x51bf('0x7'))('rpc');var config=require(_0x51bf('0x8'));var jayson=require(_0x51bf('0x9'));var client=jayson[_0x51bf('0xa')][_0x51bf('0xb')]({'port':0x232c});config['redis']=_[_0x51bf('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x51bf('0xd')]));require('./mailAccount.socket')[_0x51bf('0xe')](socket);function respondWithRpcPromise(_0x5740c5,_0x5d83a8,_0x26ede0){return new BPromise(function(_0x42b7c1,_0x555101){return client[_0x51bf('0xf')](_0x5740c5,_0x26ede0)['then'](function(_0x19bbba){logger[_0x51bf('0x10')](_0x51bf('0x11'),_0x5d83a8,_0x51bf('0x12'));logger[_0x51bf('0x13')](_0x51bf('0x14'),_0x5d83a8,_0x51bf('0x12'),JSON[_0x51bf('0x15')](_0x19bbba));if(_0x19bbba['error']){if(_0x19bbba[_0x51bf('0x16')]['code']===0x1f4){logger[_0x51bf('0x16')](_0x51bf('0x11'),_0x5d83a8,_0x19bbba['error'][_0x51bf('0x17')]);return _0x555101(_0x19bbba['error'][_0x51bf('0x17')]);}logger[_0x51bf('0x16')]('MailAccount,\x20%s,\x20%s',_0x5d83a8,_0x19bbba[_0x51bf('0x16')][_0x51bf('0x17')]);return _0x42b7c1(_0x19bbba['error'][_0x51bf('0x17')]);}else{logger[_0x51bf('0x10')](_0x51bf('0x11'),_0x5d83a8,_0x51bf('0x12'));_0x42b7c1(_0x19bbba[_0x51bf('0x18')][_0x51bf('0x17')]);}})[_0x51bf('0x19')](function(_0x6d6d8c){logger[_0x51bf('0x16')](_0x51bf('0x11'),_0x5d83a8,_0x6d6d8c);_0x555101(_0x6d6d8c);});});}exports[_0x51bf('0x1a')]=function(_0x25775a){var _0x3cb2a1=this;return new Promise(function(_0x515dfa,_0x1527ab){return db[_0x51bf('0x1b')]['findAll']({'raw':_0x25775a[_0x51bf('0x1c')]?_0x25775a[_0x51bf('0x1c')][_0x51bf('0x1d')]===undefined?!![]:![]:!![],'where':_0x25775a[_0x51bf('0x1c')]?_0x25775a['options'][_0x51bf('0x1e')]||null:null,'attributes':_0x25775a[_0x51bf('0x1c')]?_0x25775a['options'][_0x51bf('0x1f')]||null:null,'limit':_0x25775a[_0x51bf('0x1c')]?_0x25775a[_0x51bf('0x1c')]['limit']||null:null,'include':_0x25775a[_0x51bf('0x1c')]?_0x25775a['options'][_0x51bf('0x20')]?_['map'](_0x25775a[_0x51bf('0x1c')]['include'],function(_0x30723c){return{'model':db[_0x30723c[_0x51bf('0x21')]],'as':_0x30723c['as'],'attributes':_0x30723c[_0x51bf('0x1f')],'include':_0x30723c[_0x51bf('0x20')]?_[_0x51bf('0x22')](_0x30723c[_0x51bf('0x20')],function(_0x1d4176){return{'model':db[_0x1d4176['model']],'as':_0x1d4176['as'],'attributes':_0x1d4176[_0x51bf('0x1f')],'include':_0x1d4176[_0x51bf('0x20')]?_[_0x51bf('0x22')](_0x1d4176[_0x51bf('0x20')],function(_0x3ce3f9){return{'model':db[_0x3ce3f9[_0x51bf('0x21')]],'as':_0x3ce3f9['as'],'attributes':_0x3ce3f9[_0x51bf('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b0b05){logger[_0x51bf('0x10')](_0x51bf('0x1a'),_0x25775a);logger[_0x51bf('0x13')](_0x51bf('0x1a'),_0x25775a,JSON[_0x51bf('0x15')](_0x4b0b05));_0x515dfa(_0x4b0b05);})[_0x51bf('0x19')](function(_0x187a62){logger[_0x51bf('0x16')](_0x51bf('0x1a'),_0x187a62[_0x51bf('0x17')],_0x25775a);_0x1527ab(_0x3cb2a1[_0x51bf('0x16')](0x1f4,_0x187a62[_0x51bf('0x17')]));});});};exports[_0x51bf('0x23')]=function(_0x5ef9cd){var _0x5eb193=this;return new Promise(function(_0x42c8c6,_0x3a39a7){return db[_0x51bf('0x1b')]['find']({'raw':_0x5ef9cd[_0x51bf('0x1c')]?_0x5ef9cd[_0x51bf('0x1c')][_0x51bf('0x1d')]===undefined?!![]:![]:!![],'where':_0x5ef9cd[_0x51bf('0x1c')]?_0x5ef9cd[_0x51bf('0x1c')]['where']||null:null,'attributes':_0x5ef9cd[_0x51bf('0x1c')]?_0x5ef9cd[_0x51bf('0x1c')][_0x51bf('0x1f')]||null:null,'include':_0x5ef9cd[_0x51bf('0x1c')]?_0x5ef9cd[_0x51bf('0x1c')][_0x51bf('0x20')]?_[_0x51bf('0x22')](_0x5ef9cd[_0x51bf('0x1c')][_0x51bf('0x20')],function(_0x4e9b4e){return{'model':db[_0x4e9b4e[_0x51bf('0x21')]],'as':_0x4e9b4e['as'],'attributes':_0x4e9b4e[_0x51bf('0x1f')],'include':_0x4e9b4e[_0x51bf('0x20')]?_[_0x51bf('0x22')](_0x4e9b4e[_0x51bf('0x20')],function(_0x552f18){return{'model':db[_0x552f18['model']],'as':_0x552f18['as'],'attributes':_0x552f18['attributes'],'include':_0x552f18[_0x51bf('0x20')]?_[_0x51bf('0x22')](_0x552f18[_0x51bf('0x20')],function(_0x359001){return{'model':db[_0x359001[_0x51bf('0x21')]],'as':_0x359001['as'],'attributes':_0x359001[_0x51bf('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x51bf('0x24')](function(_0x46a675){logger[_0x51bf('0x10')](_0x51bf('0x23'),_0x5ef9cd);logger['debug'](_0x51bf('0x23'),_0x5ef9cd,JSON[_0x51bf('0x15')](_0x46a675));_0x42c8c6(_0x46a675);})[_0x51bf('0x19')](function(_0xaea633){logger['error'](_0x51bf('0x23'),_0xaea633[_0x51bf('0x17')],_0x5ef9cd);_0x3a39a7(_0x5eb193[_0x51bf('0x16')](0x1f4,_0xaea633[_0x51bf('0x17')]));});});};exports[_0x51bf('0x25')]=function(_0x168bf5){var _0x651cbc=this;return new Promise(function(_0x16d8c7,_0x4b802c){var _0x1c1a6d={'body':_0x168bf5[_0x51bf('0x26')],'channel':_0x51bf('0x27')};var _0x226a1f=_[_0x51bf('0x28')](_[_0x51bf('0x29')](db[_0x51bf('0x2a')][_0x51bf('0x2b')]),['createdAt','updatedAt','CompanyId',_0x51bf('0x2c')]);var _0x54a256=![];if(_0x168bf5[_0x51bf('0x26')]['id']){delete _0x168bf5[_0x51bf('0x26')]['id'];}if(_['isNil'](_0x168bf5[_0x51bf('0x26')][_0x51bf('0x2d')])){return _0x4b802c(_0x651cbc[_0x51bf('0x16')](0x1f4,_0x51bf('0x2e')));}if(_[_0x51bf('0x2f')](_0x168bf5[_0x51bf('0x26')]['body'])||_0x168bf5[_0x51bf('0x26')][_0x51bf('0x26')]===''){return _0x4b802c(_0x651cbc['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x168bf5[_0x51bf('0x26')][_0x51bf('0x30')])){return _0x4b802c(_0x651cbc[_0x51bf('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x226a1f));}if(!_[_0x51bf('0x31')](_0x226a1f,_0x168bf5[_0x51bf('0x26')][_0x51bf('0x30')])){return _0x4b802c(_0x651cbc[_0x51bf('0x16')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x226a1f));}var _0x1e4d49={};_0x1e4d49[_0x168bf5[_0x51bf('0x26')][_0x51bf('0x30')]]=_0x168bf5[_0x51bf('0x26')][_0x51bf('0x2d')];return db[_0x51bf('0x1b')][_0x51bf('0x32')]({'where':{'id':_0x168bf5[_0x51bf('0x33')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x51bf('0x2a')],'as':_0x51bf('0x34'),'where':_0x1e4d49,'limit':0x1,'order':[['updatedAt',_0x51bf('0x35')]]}]},{'model':db['MailApplication'],'as':_0x51bf('0x36')},{'model':db[_0x51bf('0x37')],'as':_0x51bf('0x38')}]})[_0x51bf('0x24')](function(_0x564250){if(_0x564250&&_0x564250['List']){var _0x49f93b=_0x564250['get']({'plain':!![]});_0x1c1a6d[_0x51bf('0x33')]=_[_0x51bf('0x39')](_0x49f93b,[_0x51bf('0x36'),_0x51bf('0x3a')]);_0x1c1a6d[_0x51bf('0x3b')]=_0x49f93b[_0x51bf('0x36')];_0x1c1a6d['list']=_0x49f93b[_0x51bf('0x3a')];_0x1c1a6d[_0x51bf('0x3b')]=_[_0x51bf('0x3c')](_0x1c1a6d[_0x51bf('0x3b')],[_0x51bf('0x3d')],[_0x51bf('0x3e')]);if(_0x1c1a6d[_0x51bf('0x33')]&&_0x1c1a6d[_0x51bf('0x33')]['autoclose']){_0x1c1a6d[_0x51bf('0x3b')][_0x51bf('0x3f')]({'id':0x0,'priority':_0x1c1a6d['applications']['length']+0x1,'app':_0x51bf('0x40'),'appdata':_0x51bf('0x41'),'interval':_0x51bf('0x42')});}if(_0x1c1a6d['account']['Applications']){delete _0x1c1a6d[_0x51bf('0x33')][_0x51bf('0x36')];}if(_0x1c1a6d[_0x51bf('0x33')]['List']){delete _0x1c1a6d[_0x51bf('0x33')][_0x51bf('0x3a')];}if(_0x49f93b[_0x51bf('0x3a')][_0x51bf('0x34')]['length']){return _0x49f93b[_0x51bf('0x3a')][_0x51bf('0x34')][0x0];}var _0x52131e=_[_0x51bf('0xc')](_0x168bf5['body'],{'firstName':_0x168bf5[_0x51bf('0x26')][_0x51bf('0x2d')],'ListId':_0x49f93b[_0x51bf('0x2c')]});_0x52131e[_0x168bf5['body'][_0x51bf('0x30')]]=_0x168bf5['body'][_0x51bf('0x2d')];return db[_0x51bf('0x2a')][_0x51bf('0x43')](_0x52131e);}else{throw new Error('List\x20not\x20found');}})[_0x51bf('0x24')](function(_0x15ad6e){_0x1c1a6d[_0x51bf('0x44')]=_0x15ad6e;if(_0x15ad6e){if(!_0x168bf5['body'][_0x51bf('0x17')][_0x51bf('0x45')]){_0x168bf5['body'][_0x51bf('0x17')][_0x51bf('0x45')]=rs[_0x51bf('0x46')]()+'\x20'+_0x168bf5[_0x51bf('0x26')][_0x51bf('0x17')]['from'];}var _0x539d75={'ContactId':_0x15ad6e['id'],'MailAccountId':_0x168bf5[_0x51bf('0x33')]['id'],'inReplyTo':_0x168bf5[_0x51bf('0x26')][_0x51bf('0x17')][_0x51bf('0x45')],'to':_0x168bf5[_0x51bf('0x26')][_0x51bf('0x17')]['from'],'cc':_0x168bf5['body'][_0x51bf('0x17')]['cc'],'subject':_0x168bf5[_0x51bf('0x26')][_0x51bf('0x17')][_0x51bf('0x47')],'attach':_0x168bf5[_0x51bf('0x26')][_0x51bf('0x17')][_0x51bf('0x48')],'lastMsgAt':moment()[_0x51bf('0x49')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x168bf5[_0x51bf('0x33')]['id']},'include':[{'model':db[_0x51bf('0x4a')],'as':_0x51bf('0x4b'),'attributes':[_0x51bf('0x45')],'where':{'messageId':_0x168bf5[_0x51bf('0x26')][_0x51bf('0x17')][_0x51bf('0x4c')]}}]})['then'](function(_0x438dc6){if(_0x438dc6){return[_0x438dc6,![]];}return db[_0x51bf('0x4d')][_0x51bf('0x43')](_0x539d75)[_0x51bf('0x24')](function(_0x45b19f){return[_0x45b19f,!![]];});});}else{throw new Error(_0x51bf('0x4e'));}})[_0x51bf('0x4f')](function(_0x486a4b,_0x3c3184){if(_0x486a4b){_0x54a256=_0x3c3184;if(!_0x3c3184){return _0x486a4b['update']({'inReplyTo':_0x168bf5['body'][_0x51bf('0x17')][_0x51bf('0x45')],'to':_0x168bf5[_0x51bf('0x26')][_0x51bf('0x17')][_0x51bf('0x2d')],'cc':_0x168bf5[_0x51bf('0x26')][_0x51bf('0x17')]['cc'],'subject':_0x168bf5[_0x51bf('0x26')][_0x51bf('0x17')][_0x51bf('0x47')],'attach':_0x486a4b[_0x51bf('0x48')]?_0x486a4b['attach']:_0x168bf5['body'][_0x51bf('0x17')][_0x51bf('0x48')],'substatus':null,'substatusAt':moment()[_0x51bf('0x49')](_0x51bf('0x50')),'lastMsgAt':moment()[_0x51bf('0x49')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x486a4b;}}})[_0x51bf('0x24')](function(_0x27bba6){_0x1c1a6d['interaction']=_0x27bba6[_0x51bf('0x51')]({'plain':!![]});_0x1c1a6d[_0x51bf('0x52')][_0x51bf('0x53')]=_0x54a256;return db[_0x51bf('0x4a')]['create']({'body':_0x168bf5[_0x51bf('0x26')]['body'],'MailAccountId':_0x168bf5['account']['id'],'MailInteractionId':_0x27bba6['id'],'direction':'in','ContactId':_0x1c1a6d[_0x51bf('0x44')]['id'],'messageId':_0x168bf5[_0x51bf('0x26')][_0x51bf('0x17')][_0x51bf('0x45')],'from':_0x168bf5[_0x51bf('0x26')]['message']['from'],'to':_0x168bf5[_0x51bf('0x26')][_0x51bf('0x17')]['to'],'cc':_0x168bf5[_0x51bf('0x26')]['message']['cc'],'subject':_0x168bf5['body'][_0x51bf('0x17')][_0x51bf('0x47')],'attach':_0x168bf5['body']['message'][_0x51bf('0x48')],'Attachments':_0x168bf5[_0x51bf('0x26')][_0x51bf('0x17')]['attachments'],'originTo':_0x168bf5['body'][_0x51bf('0x17')][_0x51bf('0x54')],'originCc':_0x168bf5[_0x51bf('0x26')][_0x51bf('0x17')]['originCc'],'bcc':_0x168bf5['body']['message']['bcc'],'ChatWebsiteId':_0x168bf5['body']['message'][_0x51bf('0x55')]||null,'originChannel':_0x168bf5['body'][_0x51bf('0x17')][_0x51bf('0x56')]||_0x51bf('0x57'),'ChatOfflineMessageId':_0x168bf5[_0x51bf('0x26')][_0x51bf('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':_0x51bf('0x58')}]});})[_0x51bf('0x24')](function(_0x52f2e7){_0x1c1a6d[_0x51bf('0x17')]=_0x52f2e7;if(_0x1c1a6d[_0x51bf('0x52')][_0x51bf('0x59')]){return db['User'][_0x51bf('0x32')]({'attributes':['id','name'],'where':{'id':_0x1c1a6d[_0x51bf('0x52')][_0x51bf('0x59')]}})[_0x51bf('0x24')](function(_0x339736){if(_0x339736){_0x1c1a6d[_0x51bf('0x3b')][_0x51bf('0x5a')]({'id':0x0,'priority':0x0,'app':_0x51bf('0x5b'),'appdata':_0x339736['name']+','+(_0x1c1a6d[_0x51bf('0x33')][_0x51bf('0x5c')]||0xa),'interval':_0x51bf('0x42')});}return respondWithRpcPromise(_0x51bf('0x5d'),'startRouting',_0x1c1a6d);});}return respondWithRpcPromise(_0x51bf('0x5d'),'startRouting',_0x1c1a6d);})['then'](function(_0x2544b1){_0x16d8c7(_0x2544b1);})['catch'](function(_0xc7041){_0x4b802c(_0x651cbc[_0x51bf('0x16')](0x1f4,_0xc7041[_0x51bf('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 068c14e..4126fce 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 _0x3eea=['emit','removeListener','register','length','mailAccount:','./mailAccount.events','save','remove'];(function(_0x3705f7,_0x2553c4){var _0x2a1cf2=function(_0x51f080){while(--_0x51f080){_0x3705f7['push'](_0x3705f7['shift']());}};_0x2a1cf2(++_0x2553c4);}(_0x3eea,0x1bd));var _0xa3ee=function(_0x557f44,_0x164975){_0x557f44=_0x557f44-0x0;var _0x5375f8=_0x3eea[_0x557f44];return _0x5375f8;};'use strict';var MailAccountEvents=require(_0xa3ee('0x0'));var events=[_0xa3ee('0x1'),_0xa3ee('0x2'),'update'];function createListener(_0x347a30,_0x137355){return function(_0x36fd22){_0x137355[_0xa3ee('0x3')](_0x347a30,_0x36fd22);};}function removeListener(_0x215a0d,_0x153906){return function(){MailAccountEvents[_0xa3ee('0x4')](_0x215a0d,_0x153906);};}exports[_0xa3ee('0x5')]=function(_0x3e19e3){for(var _0x4263f9=0x0,_0x3eedc7=events[_0xa3ee('0x6')];_0x4263f9<_0x3eedc7;_0x4263f9++){var _0x4841ef=events[_0x4263f9];var _0x21ebbb=createListener(_0xa3ee('0x7')+_0x4841ef,_0x3e19e3);MailAccountEvents['on'](_0x4841ef,_0x21ebbb);}}; \ No newline at end of file +var _0x7707=['mailAccount:','save','remove','update','emit','removeListener','register','length'];(function(_0x45dafa,_0x171e29){var _0xeb385a=function(_0x2491d0){while(--_0x2491d0){_0x45dafa['push'](_0x45dafa['shift']());}};_0xeb385a(++_0x171e29);}(_0x7707,0x199));var _0x7770=function(_0x1da4bc,_0x148afa){_0x1da4bc=_0x1da4bc-0x0;var _0x3cb3f9=_0x7707[_0x1da4bc];return _0x3cb3f9;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0x7770('0x0'),_0x7770('0x1'),_0x7770('0x2')];function createListener(_0x3bf33d,_0x14d5e9){return function(_0x5bad13){_0x14d5e9[_0x7770('0x3')](_0x3bf33d,_0x5bad13);};}function removeListener(_0x5080eb,_0x4e7d0d){return function(){MailAccountEvents[_0x7770('0x4')](_0x5080eb,_0x4e7d0d);};}exports[_0x7770('0x5')]=function(_0x373046){for(var _0x357212=0x0,_0x471e0b=events[_0x7770('0x6')];_0x357212<_0x471e0b;_0x357212++){var _0x385f99=events[_0x357212];var _0x3da5b8=createListener(_0x7770('0x7')+_0x385f99,_0x373046);MailAccountEvents['on'](_0x385f99,_0x3da5b8);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index fc93773..f57f951 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 _0xa7d0=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','put','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x249df7,_0x34e4eb){var _0xd7d77f=function(_0x50cebd){while(--_0x50cebd){_0x249df7['push'](_0x249df7['shift']());}};_0xd7d77f(++_0x34e4eb);}(_0xa7d0,0x1d6));var _0x0a7d=function(_0x409f57,_0x527b4a){_0x409f57=_0x409f57-0x0;var _0x420539=_0xa7d0[_0x409f57];return _0x420539;};'use strict';var multer=require(_0x0a7d('0x0'));var util=require(_0x0a7d('0x1'));var path=require(_0x0a7d('0x2'));var timeout=require(_0x0a7d('0x3'));var express=require(_0x0a7d('0x4'));var router=express[_0x0a7d('0x5')]();var fs_extra=require(_0x0a7d('0x6'));var auth=require(_0x0a7d('0x7'));var interaction=require(_0x0a7d('0x8'));var config=require(_0x0a7d('0x9'));var controller=require(_0x0a7d('0xa'));router[_0x0a7d('0xb')](_0x0a7d('0xc'),auth[_0x0a7d('0xd')](),controller['show']);router[_0x0a7d('0xe')](_0x0a7d('0xc'),auth[_0x0a7d('0xd')](),controller['update']);router[_0x0a7d('0xf')](_0x0a7d('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x0a7d('0x10')]=router; \ No newline at end of file +var _0x667c=['Router','fs-extra','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','exports','multer','express'];(function(_0x1054f3,_0x4c7855){var _0x5d3f56=function(_0xdc21b3){while(--_0xdc21b3){_0x1054f3['push'](_0x1054f3['shift']());}};_0x5d3f56(++_0x4c7855);}(_0x667c,0xf5));var _0xc667=function(_0x61086b,_0x40f140){_0x61086b=_0x61086b-0x0;var _0x378c35=_0x667c[_0x61086b];return _0x378c35;};'use strict';var multer=require(_0xc667('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc667('0x1'));var router=express[_0xc667('0x2')]();var fs_extra=require(_0xc667('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc667('0x4'));router[_0xc667('0x5')](_0xc667('0x6'),auth[_0xc667('0x7')](),controller[_0xc667('0x8')]);router[_0xc667('0x9')](_0xc667('0x6'),auth[_0xc667('0x7')](),controller[_0xc667('0xa')]);router[_0xc667('0xb')](_0xc667('0x6'),auth[_0xc667('0x7')](),controller['destroy']);module[_0xc667('0xc')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 3b1beb5..44dc80c 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 _0x5a67=['INTEGER','noop','TEXT','STRING','sequelize','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5a67,0x70));var _0x75a6=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x5a67[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require(_0x75a6('0x0'));module[_0x75a6('0x1')]={'priority':{'type':Sequelize[_0x75a6('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x75a6('0x3')},'appdata':{'type':Sequelize[_0x75a6('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x75a6('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x492b=['noop','*,*,*,*','sequelize','INTEGER'];(function(_0x2be7ee,_0x2ac411){var _0x48d78b=function(_0x4cbcff){while(--_0x4cbcff){_0x2be7ee['push'](_0x2be7ee['shift']());}};_0x48d78b(++_0x2ac411);}(_0x492b,0x1ea));var _0xb492=function(_0x5c8c02,_0x5c7164){_0x5c8c02=_0x5c8c02-0x0;var _0x270159=_0x492b[_0x5c8c02];return _0x270159;};'use strict';var Sequelize=require(_0xb492('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb492('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xb492('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb492('0x3')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 82b8c38..c531843 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 _0xe706=['limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0x606fe8,_0x10b084){var _0x28b517=function(_0x5e90f4){while(--_0x5e90f4){_0x606fe8['push'](_0x606fe8['shift']());}};_0x28b517(++_0x10b084);}(_0xe706,0xa3));var _0x6e70=function(_0x5a461e,_0xe83e49){_0x5a461e=_0x5a461e-0x0;var _0x1fac23=_0xe706[_0x5a461e];return _0x1fac23;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={'raw':!![],'where':{'id':_0x5d772a[_0x6e70('0x2e')]['id']}},_0xecf336={};_0xecf336[_0x6e70('0x2f')]=_[_0x6e70('0x30')](db[_0x6e70('0x31')][_0x6e70('0x32')]);_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x30')](_0x5d772a['query']);_0xecf336[_0x6e70('0x34')]=_['intersection'](_0xecf336[_0x6e70('0x2f')],_0xecf336['query']);_0x406f29[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0xecf336[_0x6e70('0x2f')],qs['fields'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x37')]));_0x406f29['attributes']=_0x406f29[_0x6e70('0x35')][_0x6e70('0x38')]?_0x406f29['attributes']:_0xecf336[_0x6e70('0x2f')];if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x39')]){_0x406f29[_0x6e70('0x3a')]=[{'all':!![]}];}_0x406f29=_[_0x6e70('0x3b')]({},_0x406f29,_0x5d772a[_0x6e70('0x3c')]);return db[_0x6e70('0x31')][_0x6e70('0x3d')](_0x406f29)[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x28')]=function(_0x4795a0,_0x23cd1a){if(_0x4795a0[_0x6e70('0x3e')]['id']){delete _0x4795a0[_0x6e70('0x3e')]['id'];}return db[_0x6e70('0x31')][_0x6e70('0x3d')]({'where':{'id':_0x4795a0[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x23cd1a,null))[_0x6e70('0x29')](saveUpdates(_0x4795a0[_0x6e70('0x3e')],null))[_0x6e70('0x29')](respondWithResult(_0x23cd1a,null))[_0x6e70('0x3f')](handleError(_0x23cd1a,null));};exports[_0x6e70('0x40')]=function(_0x5594d3,_0x501b53){return db['MailApplication']['find']({'where':{'id':_0x5594d3[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x501b53,null))[_0x6e70('0x29')](removeEntity(_0x501b53,null))[_0x6e70('0x3f')](handleError(_0x501b53,null));}; \ No newline at end of file +var _0xb43b=['name','status','send','show','params','keys','MailApplication','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','merge','options','find','then','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus'];(function(_0x48247b,_0x1cb998){var _0x292af8=function(_0x3a02fd){while(--_0x3a02fd){_0x48247b['push'](_0x48247b['shift']());}};_0x292af8(++_0x1cb998);}(_0xb43b,0x1b2));var _0xbb43=function(_0x11c177,_0x1c1a12){_0x11c177=_0x11c177-0x0;var _0x2226f0=_0xb43b[_0x11c177];return _0x2226f0;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={'raw':!![],'where':{'id':_0x40b04b[_0xbb43('0x2a')]['id']}},_0x539730={};_0x539730['model']=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x539730[_0xbb43('0x2e')]=_['keys'](_0x40b04b[_0xbb43('0x2e')]);_0x539730['filters']=_['intersection'](_0x539730['model'],_0x539730[_0xbb43('0x2e')]);_0x473828['attributes']=_[_0xbb43('0x2f')](_0x539730[_0xbb43('0x30')],qs[_0xbb43('0x31')](_0x40b04b['query'][_0xbb43('0x31')]));_0x473828[_0xbb43('0x32')]=_0x473828[_0xbb43('0x32')][_0xbb43('0x33')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x30')];if(_0x40b04b[_0xbb43('0x2e')][_0xbb43('0x34')]){_0x473828['include']=[{'all':!![]}];}_0x473828=_[_0xbb43('0x35')]({},_0x473828,_0x40b04b[_0xbb43('0x36')]);return db[_0xbb43('0x2c')][_0xbb43('0x37')](_0x473828)[_0xbb43('0x38')](handleEntityNotFound(_0x21d386,null))[_0xbb43('0x38')](respondWithResult(_0x21d386,null))[_0xbb43('0x39')](handleError(_0x21d386,null));};exports[_0xbb43('0x23')]=function(_0x349a83,_0x57105c){if(_0x349a83[_0xbb43('0x3a')]['id']){delete _0x349a83[_0xbb43('0x3a')]['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x37')]({'where':{'id':_0x349a83[_0xbb43('0x2a')]['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x57105c,null))['then'](saveUpdates(_0x349a83[_0xbb43('0x3a')],null))[_0xbb43('0x38')](respondWithResult(_0x57105c,null))['catch'](handleError(_0x57105c,null));};exports[_0xbb43('0x24')]=function(_0x2c9a7c,_0x11d384){return db['MailApplication']['find']({'where':{'id':_0x2c9a7c['params']['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x11d384,null))[_0xbb43('0x38')](removeEntity(_0x11d384,null))['catch'](handleError(_0x11d384,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 60ea095..7d90d13 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 _0x3ac9=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','define','MailApplication'];(function(_0x4a8791,_0x362a48){var _0xa8bdba=function(_0x4ad336){while(--_0x4ad336){_0x4a8791['push'](_0x4a8791['shift']());}};_0xa8bdba(++_0x362a48);}(_0x3ac9,0x16e));var _0x93ac=function(_0x21a0c5,_0x586032){_0x21a0c5=_0x21a0c5-0x0;var _0x13d439=_0x3ac9[_0x21a0c5];return _0x13d439;};'use strict';var _=require(_0x93ac('0x0'));var util=require(_0x93ac('0x1'));var logger=require(_0x93ac('0x2'))(_0x93ac('0x3'));var moment=require(_0x93ac('0x4'));var BPromise=require(_0x93ac('0x5'));var rp=require(_0x93ac('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x93ac('0x7'));var config=require(_0x93ac('0x8'));var attributes=require(_0x93ac('0x9'));module['exports']=function(_0x37f31d,_0x26f972){return _0x37f31d[_0x93ac('0xa')](_0x93ac('0xb'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x93ac('0xc'),'collate':_0x93ac('0xd')});}; \ No newline at end of file +var _0xd463=['define','MailApplication','mail_applications','utf8mb4','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd463,0xfb));var _0x3d46=function(_0xdeac17,_0x19ad66){_0xdeac17=_0xdeac17-0x0;var _0x33aabd=_0xd463[_0xdeac17];return _0x33aabd;};'use strict';var _=require('lodash');var util=require(_0x3d46('0x0'));var logger=require(_0x3d46('0x1'))(_0x3d46('0x2'));var moment=require('moment');var BPromise=require(_0x3d46('0x3'));var rp=require(_0x3d46('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d46('0x5'));var config=require(_0x3d46('0x6'));var attributes=require(_0x3d46('0x7'));module[_0x3d46('0x8')]=function(_0xe3353e,_0x5d95a9){return _0xe3353e[_0x3d46('0x9')](_0x3d46('0xa'),attributes,{'tableName':_0x3d46('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3d46('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 1316a4f..e83a211 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 _0xb4aa=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','MailApplication','update','body','raw','options','where','limit','UpdateMailApplication','lodash','util','moment','bluebird','randomstring'];(function(_0x45facf,_0x3ed4dd){var _0x1781de=function(_0x2037f7){while(--_0x2037f7){_0x45facf['push'](_0x45facf['shift']());}};_0x1781de(++_0x3ed4dd);}(_0xb4aa,0x1db));var _0xab4a=function(_0x31a577,_0x8a3c76){_0x31a577=_0x31a577-0x0;var _0x2769df=_0xb4aa[_0x31a577];return _0x2769df;};'use strict';var _=require(_0xab4a('0x0'));var util=require(_0xab4a('0x1'));var moment=require(_0xab4a('0x2'));var BPromise=require(_0xab4a('0x3'));var rs=require(_0xab4a('0x4'));var fs=require('fs');var Redis=require(_0xab4a('0x5'));var db=require(_0xab4a('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xab4a('0x7'));var config=require(_0xab4a('0x8'));var jayson=require(_0xab4a('0x9'));var client=jayson[_0xab4a('0xa')][_0xab4a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1d7266,_0x27a044,_0x46dff8){return new BPromise(function(_0x46b781,_0x248629){return client[_0xab4a('0xc')](_0x1d7266,_0x46dff8)[_0xab4a('0xd')](function(_0x3dbf32){logger[_0xab4a('0xe')](_0xab4a('0xf'),_0x27a044,_0xab4a('0x10'));logger[_0xab4a('0x11')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x27a044,_0xab4a('0x10'),JSON[_0xab4a('0x12')](_0x3dbf32));if(_0x3dbf32[_0xab4a('0x13')]){if(_0x3dbf32[_0xab4a('0x13')][_0xab4a('0x14')]===0x1f4){logger[_0xab4a('0x13')](_0xab4a('0xf'),_0x27a044,_0x3dbf32[_0xab4a('0x13')][_0xab4a('0x15')]);return _0x248629(_0x3dbf32['error'][_0xab4a('0x15')]);}logger[_0xab4a('0x13')](_0xab4a('0xf'),_0x27a044,_0x3dbf32['error'][_0xab4a('0x15')]);return _0x46b781(_0x3dbf32[_0xab4a('0x13')][_0xab4a('0x15')]);}else{logger[_0xab4a('0xe')]('MailApplication,\x20%s,\x20%s',_0x27a044,'request\x20sent');_0x46b781(_0x3dbf32[_0xab4a('0x16')][_0xab4a('0x15')]);}})[_0xab4a('0x17')](function(_0x238f69){logger[_0xab4a('0x13')]('MailApplication,\x20%s,\x20%s',_0x27a044,_0x238f69);_0x248629(_0x238f69);});});}exports['UpdateMailApplication']=function(_0x4f50f9){var _0x4da448=this;return new Promise(function(_0x4f4a7b,_0x19cb38){return db[_0xab4a('0x18')][_0xab4a('0x19')](_0x4f50f9[_0xab4a('0x1a')],{'raw':_0x4f50f9['options']?_0x4f50f9['options'][_0xab4a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f50f9['options']?_0x4f50f9[_0xab4a('0x1c')][_0xab4a('0x1d')]||null:null,'attributes':_0x4f50f9['options']?_0x4f50f9['options']['attributes']||null:null,'limit':_0x4f50f9[_0xab4a('0x1c')]?_0x4f50f9[_0xab4a('0x1c')][_0xab4a('0x1e')]||null:null})[_0xab4a('0xd')](function(_0x1f5de2){logger['info'](_0xab4a('0x1f'),_0x4f50f9);logger[_0xab4a('0x11')](_0xab4a('0x1f'),_0x4f50f9,JSON[_0xab4a('0x12')](_0x1f5de2));_0x4f4a7b(_0x1f5de2);})[_0xab4a('0x17')](function(_0x3ecc78){logger[_0xab4a('0x13')](_0xab4a('0x1f'),_0x3ecc78[_0xab4a('0x15')],_0x4f50f9);_0x19cb38(_0x4da448[_0xab4a('0x13')](0x1f4,_0x3ecc78[_0xab4a('0x15')]));});});}; \ No newline at end of file +var _0xa6e4=['error','code','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','then','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1dd27f,_0x46b677){var _0x177cc4=function(_0x112987){while(--_0x112987){_0x1dd27f['push'](_0x1dd27f['shift']());}};_0x177cc4(++_0x46b677);}(_0xa6e4,0x1a3));var _0x4a6e=function(_0x574bc5,_0x520e30){_0x574bc5=_0x574bc5-0x0;var _0x410021=_0xa6e4[_0x574bc5];return _0x410021;};'use strict';var _=require(_0x4a6e('0x0'));var util=require(_0x4a6e('0x1'));var moment=require(_0x4a6e('0x2'));var BPromise=require(_0x4a6e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a6e('0x4'));var db=require(_0x4a6e('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4a6e('0x6'));var config=require(_0x4a6e('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d2b81,_0x315ab4,_0x2cd57c){return new BPromise(function(_0x4aba31,_0x35d914){return client['request'](_0x2d2b81,_0x2cd57c)['then'](function(_0x103e09){logger[_0x4a6e('0x8')](_0x4a6e('0x9'),_0x315ab4,_0x4a6e('0xa'));logger['debug'](_0x4a6e('0xb'),_0x315ab4,_0x4a6e('0xa'),JSON[_0x4a6e('0xc')](_0x103e09));if(_0x103e09[_0x4a6e('0xd')]){if(_0x103e09[_0x4a6e('0xd')][_0x4a6e('0xe')]===0x1f4){logger[_0x4a6e('0xd')](_0x4a6e('0x9'),_0x315ab4,_0x103e09[_0x4a6e('0xd')]['message']);return _0x35d914(_0x103e09[_0x4a6e('0xd')]['message']);}logger['error'](_0x4a6e('0x9'),_0x315ab4,_0x103e09[_0x4a6e('0xd')][_0x4a6e('0xf')]);return _0x4aba31(_0x103e09['error'][_0x4a6e('0xf')]);}else{logger['info'](_0x4a6e('0x9'),_0x315ab4,_0x4a6e('0xa'));_0x4aba31(_0x103e09[_0x4a6e('0x10')][_0x4a6e('0xf')]);}})[_0x4a6e('0x11')](function(_0x92e8cb){logger['error'](_0x4a6e('0x9'),_0x315ab4,_0x92e8cb);_0x35d914(_0x92e8cb);});});}exports[_0x4a6e('0x12')]=function(_0x548741){var _0x105e06=this;return new Promise(function(_0x316155,_0x2f96c7){return db[_0x4a6e('0x13')][_0x4a6e('0x14')](_0x548741[_0x4a6e('0x15')],{'raw':_0x548741[_0x4a6e('0x16')]?_0x548741[_0x4a6e('0x16')][_0x4a6e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x548741[_0x4a6e('0x16')]?_0x548741['options'][_0x4a6e('0x18')]||null:null,'attributes':_0x548741[_0x4a6e('0x16')]?_0x548741[_0x4a6e('0x16')]['attributes']||null:null,'limit':_0x548741[_0x4a6e('0x16')]?_0x548741[_0x4a6e('0x16')]['limit']||null:null})[_0x4a6e('0x19')](function(_0x3f7266){logger['info'](_0x4a6e('0x12'),_0x548741);logger[_0x4a6e('0x1a')](_0x4a6e('0x12'),_0x548741,JSON[_0x4a6e('0xc')](_0x3f7266));_0x316155(_0x3f7266);})[_0x4a6e('0x11')](function(_0x3b6cf5){logger['error'](_0x4a6e('0x12'),_0x3b6cf5[_0x4a6e('0xf')],_0x548741);_0x2f96c7(_0x105e06[_0x4a6e('0xd')](0x1f4,_0x3b6cf5[_0x4a6e('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 32ced71..2e0eb49 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 _0x940c=['mail','addTags','put','mailinteraction:update','delete','tracked','mailinteraction:destroy','destroy','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','/describe','describe','/:id','isAuthenticated','getMessages','download','create','post','/:id/messages','/:id/tags'];(function(_0x5b311b,_0x3e0280){var _0x4fa0de=function(_0x5363ed){while(--_0x5363ed){_0x5b311b['push'](_0x5b311b['shift']());}};_0x4fa0de(++_0x3e0280);}(_0x940c,0x1b3));var _0xc940=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x940c[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0xc940('0x0'));var router=express['Router']();var auth=require(_0xc940('0x1'));var interaction=require(_0xc940('0x2'));var controller=require(_0xc940('0x3'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc940('0x4')](_0xc940('0x5'),auth['isAuthenticated'](),controller[_0xc940('0x6')]);router[_0xc940('0x4')](_0xc940('0x7'),auth[_0xc940('0x8')](),controller['show']);router[_0xc940('0x4')]('/:id/messages',auth[_0xc940('0x8')](),controller[_0xc940('0x9')]);router[_0xc940('0x4')]('/:id/download',auth[_0xc940('0x8')](),controller[_0xc940('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc940('0xb')]);router[_0xc940('0xc')](_0xc940('0xd'),auth[_0xc940('0x8')](),controller['addMessage']);router[_0xc940('0xc')](_0xc940('0xe'),auth[_0xc940('0x8')](),interaction['tracked'](_0xc940('0xf'),'mailinteraction:addtags'),controller[_0xc940('0x10')]);router[_0xc940('0x11')](_0xc940('0x7'),auth[_0xc940('0x8')](),interaction['tracked'](_0xc940('0xf'),_0xc940('0x12')),controller['update']);router[_0xc940('0x13')](_0xc940('0x7'),auth[_0xc940('0x8')](),interaction[_0xc940('0x14')](_0xc940('0xf'),_0xc940('0x15')),controller[_0xc940('0x16')]);router['delete'](_0xc940('0xe'),auth[_0xc940('0x8')](),controller[_0xc940('0x17')]);module[_0xc940('0x18')]=router; \ No newline at end of file +var _0x9736=['index','/describe','describe','/:id','show','getMessages','/:id/download','post','create','addMessage','tracked','mailinteraction:addtags','mail','mailinteraction:update','update','delete','removeTags','exports','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated'];(function(_0x192b8d,_0x2d3d45){var _0x47d1a2=function(_0x363c70){while(--_0x363c70){_0x192b8d['push'](_0x192b8d['shift']());}};_0x47d1a2(++_0x2d3d45);}(_0x9736,0x1c2));var _0x6973=function(_0x1c46e2,_0x97cb33){_0x1c46e2=_0x1c46e2-0x0;var _0x5cbf31=_0x9736[_0x1c46e2];return _0x5cbf31;};'use strict';var express=require('express');var router=express[_0x6973('0x0')]();var auth=require(_0x6973('0x1'));var interaction=require(_0x6973('0x2'));var controller=require(_0x6973('0x3'));router[_0x6973('0x4')]('/',auth[_0x6973('0x5')](),controller[_0x6973('0x6')]);router[_0x6973('0x4')](_0x6973('0x7'),auth[_0x6973('0x5')](),controller[_0x6973('0x8')]);router[_0x6973('0x4')](_0x6973('0x9'),auth[_0x6973('0x5')](),controller[_0x6973('0xa')]);router[_0x6973('0x4')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6973('0xb')]);router[_0x6973('0x4')](_0x6973('0xc'),auth[_0x6973('0x5')](),controller['download']);router[_0x6973('0xd')]('/',auth['isAuthenticated'](),controller[_0x6973('0xe')]);router[_0x6973('0xd')]('/:id/messages',auth[_0x6973('0x5')](),controller[_0x6973('0xf')]);router[_0x6973('0xd')]('/:id/tags',auth[_0x6973('0x5')](),interaction[_0x6973('0x10')]('mail',_0x6973('0x11')),controller['addTags']);router['put'](_0x6973('0x9'),auth[_0x6973('0x5')](),interaction['tracked'](_0x6973('0x12'),_0x6973('0x13')),controller[_0x6973('0x14')]);router[_0x6973('0x15')](_0x6973('0x9'),auth[_0x6973('0x5')](),interaction[_0x6973('0x10')](_0x6973('0x12'),'mailinteraction:destroy'),controller['destroy']);router[_0x6973('0x15')]('/:id/tags',auth['isAuthenticated'](),controller[_0x6973('0x16')]);module[_0x6973('0x17')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index ef5d79c..aa03b2a 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 _0x926e=['iconv','exports','BOOLEAN','DATE','STRING','TEXT','out','ENUM','sequelize'];(function(_0x71c2ac,_0x32eb1f){var _0x47582e=function(_0x2365f8){while(--_0x2365f8){_0x71c2ac['push'](_0x71c2ac['shift']());}};_0x47582e(++_0x32eb1f);}(_0x926e,0x1e5));var _0xe926=function(_0x917ac,_0x379435){_0x917ac=_0x917ac-0x0;var _0xec149c=_0x926e[_0x917ac];return _0xec149c;};'use strict';var Sequelize=require(_0xe926('0x0'));var iconv=require(_0xe926('0x1'));module[_0xe926('0x2')]={'closed':{'type':Sequelize[_0xe926('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe926('0x4')]},'disposition':{'type':Sequelize[_0xe926('0x5')]},'secondDisposition':{'type':Sequelize[_0xe926('0x5')]},'thirdDisposition':{'type':Sequelize[_0xe926('0x5')]},'note':{'type':Sequelize[_0xe926('0x5')]},'inReplyTo':{'type':Sequelize[_0xe926('0x5')](0x1fe)},'to':{'type':Sequelize[_0xe926('0x5')]},'cc':{'type':Sequelize[_0xe926('0x6')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xe926('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0xe926('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xe926('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xe926('0x8')]('in',_0xe926('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xe926('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x2598=['DATE','STRING','TEXT','ENUM','out','iconv','BOOLEAN'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x2598,0x101));var _0x8259=function(_0x4e8efd,_0x46bc20){_0x4e8efd=_0x4e8efd-0x0;var _0x31e442=_0x2598[_0x4e8efd];return _0x31e442;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x8259('0x0'));module['exports']={'closed':{'type':Sequelize[_0x8259('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8259('0x2')]},'disposition':{'type':Sequelize[_0x8259('0x3')]},'secondDisposition':{'type':Sequelize[_0x8259('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8259('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x8259('0x3')](0x1fe)},'to':{'type':Sequelize[_0x8259('0x3')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x8259('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x8259('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x8259('0x5')]('in',_0x8259('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8259('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x8259('0x5')]('in',_0x8259('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index a97c4cd..e7612e0 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(_0xe00d2e,_0x199d53){var _0x5904e2=function(_0x24629f){while(--_0x24629f){_0xe00d2e['push'](_0xe00d2e['shift']());}};_0x5904e2(++_0x199d53);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'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(_0x5f4f52,_0xbc3a5a){var _0xe2338a=function(_0x4bef0f){while(--_0x4bef0f){_0x5f4f52['push'](_0x5f4f52['shift']());}};_0xe2338a(++_0xbc3a5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 cbad3aa..94d4393 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 _0xe45e=['unreadMessages','length','emit','hook','exports','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','then','Users','map','findAll'];(function(_0x53f72a,_0x4b7999){var _0x3d49cf=function(_0xe8d3b){while(--_0xe8d3b){_0x53f72a['push'](_0x53f72a['shift']());}};_0x3d49cf(++_0x4b7999);}(_0xe45e,0x17c));var _0xee45=function(_0x1177d5,_0x22b649){_0x1177d5=_0x1177d5-0x0;var _0xc3ddc2=_0xe45e[_0x1177d5];return _0xc3ddc2;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xee45('0x0'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0xee45('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xee45('0x2')](0x0);var events={'afterCreate':_0xee45('0x3'),'afterUpdate':_0xee45('0x4'),'afterDestroy':_0xee45('0x5')};function emitEvent(_0x37efc1){return function(_0x132141,_0xddb1fe,_0x32c90a){_0x132141['getUsers']({'attributes':['id'],'raw':!![]})[_0xee45('0x6')](function(_0x21f141){_0x132141['setDataValue'](_0xee45('0x7'),_0x21f141[_0xee45('0x8')](function(_0x55888b){return{'id':_0x55888b['id']};}));return MailMessage[_0xee45('0x9')]({'where':{'MailInteractionId':_0x132141['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x2b8de7){_0x132141['setDataValue'](_0xee45('0xa'),_0x2b8de7[_0xee45('0xb')]);MailInteractionEvents['emit'](_0x37efc1+':'+_0x132141['id'],_0x132141);MailInteractionEvents[_0xee45('0xc')](_0x37efc1,_0x132141);_0x32c90a(null);})['catch'](_0x32c90a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xee45('0xd')](e,emitEvent(event));}}module[_0xee45('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0xc0e9=['then','setDataValue','Users','map','findAll','emit','catch','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers'];(function(_0x2eb799,_0x11aa6b){var _0x4d4575=function(_0x519068){while(--_0x519068){_0x2eb799['push'](_0x2eb799['shift']());}};_0x4d4575(++_0x11aa6b);}(_0xc0e9,0xab));var _0x9c0e=function(_0x3ee55e,_0x1f0d39){_0x3ee55e=_0x3ee55e-0x0;var _0x3a8f94=_0xc0e9[_0x3ee55e];return _0x3a8f94;};'use strict';var EventEmitter=require(_0x9c0e('0x0'));var MailInteraction=require(_0x9c0e('0x1'))['db'][_0x9c0e('0x2')];var MailMessage=require('../../mysqldb')['db'][_0x9c0e('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x9c0e('0x4')](0x0);var events={'afterCreate':_0x9c0e('0x5'),'afterUpdate':_0x9c0e('0x6'),'afterDestroy':_0x9c0e('0x7')};function emitEvent(_0x8918cb){return function(_0x1aa8b6,_0x2afd2d,_0x26b280){_0x1aa8b6[_0x9c0e('0x8')]({'attributes':['id'],'raw':!![]})[_0x9c0e('0x9')](function(_0x114227){_0x1aa8b6[_0x9c0e('0xa')](_0x9c0e('0xb'),_0x114227[_0x9c0e('0xc')](function(_0x1bbc57){return{'id':_0x1bbc57['id']};}));return MailMessage[_0x9c0e('0xd')]({'where':{'MailInteractionId':_0x1aa8b6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9c0e('0x9')](function(_0x15d0b8){_0x1aa8b6[_0x9c0e('0xa')]('unreadMessages',_0x15d0b8['length']);MailInteractionEvents[_0x9c0e('0xe')](_0x8918cb+':'+_0x1aa8b6['id'],_0x1aa8b6);MailInteractionEvents[_0x9c0e('0xe')](_0x8918cb,_0x1aa8b6);_0x26b280(null);})[_0x9c0e('0xf')](_0x26b280(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x9c0e('0x10')](e,emitEvent(event));}}module[_0x9c0e('0x11')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 407e970..fbdd61a 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 _0x2964=['format','YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','closed','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt'];(function(_0x46d58e,_0x14c017){var _0x23fd3d=function(_0x2afc31){while(--_0x2afc31){_0x46d58e['push'](_0x46d58e['shift']());}};_0x23fd3d(++_0x14c017);}(_0x2964,0xd1));var _0x4296=function(_0x3ed5d4,_0x4fa01a){_0x3ed5d4=_0x3ed5d4-0x0;var _0x22b925=_0x2964[_0x3ed5d4];return _0x22b925;};'use strict';var _=require(_0x4296('0x0'));var util=require(_0x4296('0x1'));var logger=require(_0x4296('0x2'))('api');var moment=require(_0x4296('0x3'));var BPromise=require('bluebird');var rp=require(_0x4296('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4296('0x5'));var attributes=require(_0x4296('0x6'));module[_0x4296('0x7')]=function(_0x74fe96,_0x3c6e18){return _0x74fe96['define'](_0x4296('0x8'),attributes,{'tableName':_0x4296('0x9'),'paranoid':![],'indexes':[{'name':_0x4296('0xa'),'fields':[_0x4296('0xb'),'to'],'type':_0x4296('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x10bc9d,_0x3367b9,_0x103a6c){if(_0x10bc9d[_0x4296('0xd')]){_0x10bc9d[_0x4296('0xe')]=moment()[_0x4296('0xf')](_0x4296('0x10'));}if(_0x10bc9d['closed']){_0x10bc9d[_0x4296('0x11')]=moment()[_0x4296('0xf')](_0x4296('0x10'));}_0x103a6c(null,_0x3367b9);},'beforeUpdate':function(_0x2bef6e,_0x394812,_0x43f2f7){if(_0x2bef6e[_0x4296('0x12')]('substatus')){_0x2bef6e[_0x4296('0xe')]=_0x2bef6e[_0x4296('0xd')]?moment()[_0x4296('0xf')](_0x4296('0x10')):null;}if(_0x2bef6e[_0x4296('0x12')](_0x4296('0x13'))){_0x2bef6e[_0x4296('0x11')]=moment()[_0x4296('0xf')](_0x4296('0x10'));_0x2bef6e[_0x4296('0xd')]=null;_0x2bef6e['substatusAt']=null;}_0x43f2f7(null,_0x2bef6e);},'afterUpdate':function(_0x2dd33c,_0x207038,_0x2a7429){var _0x47598d=_0x74fe96[_0x4296('0x14')];var _0x1349c9=_0x2dd33c[_0x4296('0x15')]({'plain':!![]});if(_0x1349c9['closed']){return _0x47598d[_0x4296('0x16')][_0x4296('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x1349c9['id']}})[_0x4296('0x18')](function(){_0x2a7429();})[_0x4296('0x19')](function(_0x2d8934){_0x2a7429(_0x2d8934);});}else{_0x2a7429();}}},'charset':_0x4296('0x1a'),'collate':_0x4296('0x1b')});}; \ No newline at end of file +var _0x3713=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','fti_mail_interactions','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatus','models','get','update','then','catch','utf8mb4','utf8mb4_unicode_ci'];(function(_0x282c93,_0x2c774c){var _0x4c2fcd=function(_0x55cee0){while(--_0x55cee0){_0x282c93['push'](_0x282c93['shift']());}};_0x4c2fcd(++_0x2c774c);}(_0x3713,0x17a));var _0x3371=function(_0x5a20c0,_0x3410da){_0x5a20c0=_0x5a20c0-0x0;var _0x23d9ef=_0x3713[_0x5a20c0];return _0x23d9ef;};'use strict';var _=require(_0x3371('0x0'));var util=require(_0x3371('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3371('0x2'));var BPromise=require(_0x3371('0x3'));var rp=require(_0x3371('0x4'));var fs=require('fs');var path=require(_0x3371('0x5'));var rimraf=require(_0x3371('0x6'));var config=require(_0x3371('0x7'));var attributes=require(_0x3371('0x8'));module[_0x3371('0x9')]=function(_0x460b67,_0x21af34){return _0x460b67[_0x3371('0xa')]('MailInteraction',attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x3371('0xb'),'fields':['subject','to'],'type':_0x3371('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x20b9cb,_0x1ad077,_0x182b37){if(_0x20b9cb['substatus']){_0x20b9cb[_0x3371('0xd')]=moment()[_0x3371('0xe')](_0x3371('0xf'));}if(_0x20b9cb[_0x3371('0x10')]){_0x20b9cb[_0x3371('0x11')]=moment()[_0x3371('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x182b37(null,_0x1ad077);},'beforeUpdate':function(_0x39c7b2,_0x16ca56,_0x121ea7){if(_0x39c7b2[_0x3371('0x12')](_0x3371('0x13'))){_0x39c7b2[_0x3371('0xd')]=_0x39c7b2['substatus']?moment()[_0x3371('0xe')](_0x3371('0xf')):null;}if(_0x39c7b2[_0x3371('0x12')](_0x3371('0x10'))){_0x39c7b2['closedAt']=moment()['format'](_0x3371('0xf'));_0x39c7b2['substatus']=null;_0x39c7b2[_0x3371('0xd')]=null;}_0x121ea7(null,_0x39c7b2);},'afterUpdate':function(_0x294d20,_0x1286b6,_0x2dc4ad){var _0x4ef035=_0x460b67[_0x3371('0x14')];var _0x20b6ac=_0x294d20[_0x3371('0x15')]({'plain':!![]});if(_0x20b6ac['closed']){return _0x4ef035['MailMessage'][_0x3371('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x20b6ac['id']}})[_0x3371('0x17')](function(){_0x2dc4ad();})[_0x3371('0x18')](function(_0x6ea8cd){_0x2dc4ad(_0x6ea8cd);});}else{_0x2dc4ad();}}},'charset':_0x3371('0x19'),'collate':_0x3371('0x1a')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index d1df210..9aae2e2 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 _0x2ba6=['result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','then','debug','find','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./mailInteraction.socket','register','request','info','MailInteraction,\x20%s,\x20%s','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x175009,_0x5a32a0){var _0x1fc420=function(_0x3b15d1){while(--_0x3b15d1){_0x175009['push'](_0x175009['shift']());}};_0x1fc420(++_0x5a32a0);}(_0x2ba6,0x1ea));var _0x62ba=function(_0x4efc41,_0x188659){_0x4efc41=_0x4efc41-0x0;var _0x5de8e7=_0x2ba6[_0x4efc41];return _0x5de8e7;};'use strict';var _=require(_0x62ba('0x0'));var util=require(_0x62ba('0x1'));var moment=require(_0x62ba('0x2'));var BPromise=require(_0x62ba('0x3'));var rs=require(_0x62ba('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62ba('0x5'))['db'];var utils=require(_0x62ba('0x6'));var logger=require(_0x62ba('0x7'))(_0x62ba('0x8'));var config=require(_0x62ba('0x9'));var jayson=require(_0x62ba('0xa'));var client=jayson['client'][_0x62ba('0xb')]({'port':0x232a});config[_0x62ba('0xc')]=_[_0x62ba('0xd')](config['redis'],{'host':_0x62ba('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x62ba('0xc')]));require(_0x62ba('0xf'))[_0x62ba('0x10')](socket);function respondWithRpcPromise(_0x15d2fa,_0x405e92,_0x1c5e97){return new BPromise(function(_0x22e81e,_0x22c473){return client[_0x62ba('0x11')](_0x15d2fa,_0x1c5e97)['then'](function(_0x1a8a5b){logger[_0x62ba('0x12')](_0x62ba('0x13'),_0x405e92,'request\x20sent');logger['debug'](_0x62ba('0x14'),_0x405e92,_0x62ba('0x15'),JSON[_0x62ba('0x16')](_0x1a8a5b));if(_0x1a8a5b[_0x62ba('0x17')]){if(_0x1a8a5b[_0x62ba('0x17')][_0x62ba('0x18')]===0x1f4){logger[_0x62ba('0x17')](_0x62ba('0x13'),_0x405e92,_0x1a8a5b[_0x62ba('0x17')][_0x62ba('0x19')]);return _0x22c473(_0x1a8a5b[_0x62ba('0x17')][_0x62ba('0x19')]);}logger['error'](_0x62ba('0x13'),_0x405e92,_0x1a8a5b[_0x62ba('0x17')][_0x62ba('0x19')]);return _0x22e81e(_0x1a8a5b[_0x62ba('0x17')]['message']);}else{logger[_0x62ba('0x12')](_0x62ba('0x13'),_0x405e92,_0x62ba('0x15'));_0x22e81e(_0x1a8a5b[_0x62ba('0x1a')][_0x62ba('0x19')]);}})[_0x62ba('0x1b')](function(_0x5750ca){logger[_0x62ba('0x17')](_0x62ba('0x13'),_0x405e92,_0x5750ca);_0x22c473(_0x5750ca);});});}exports[_0x62ba('0x1c')]=function(_0x4318cc){var _0xf00b36=this;return new Promise(function(_0x3a5679,_0x4296b9){return db[_0x62ba('0x1d')][_0x62ba('0x1e')](_0x4318cc[_0x62ba('0x1f')],{'raw':_0x4318cc[_0x62ba('0x20')]?_0x4318cc[_0x62ba('0x20')][_0x62ba('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4318cc[_0x62ba('0x20')]?_0x4318cc[_0x62ba('0x20')][_0x62ba('0x22')]||null:null,'attributes':_0x4318cc[_0x62ba('0x20')]?_0x4318cc[_0x62ba('0x20')][_0x62ba('0x23')]||null:null,'limit':_0x4318cc[_0x62ba('0x20')]?_0x4318cc[_0x62ba('0x20')][_0x62ba('0x24')]||null:null})[_0x62ba('0x25')](function(_0x5afeb1){logger[_0x62ba('0x12')](_0x62ba('0x1c'),_0x4318cc);logger[_0x62ba('0x26')](_0x62ba('0x1c'),_0x4318cc,JSON[_0x62ba('0x16')](_0x5afeb1));_0x3a5679(_0x5afeb1);})['catch'](function(_0x1f7612){logger[_0x62ba('0x17')](_0x62ba('0x1c'),_0x1f7612['message'],_0x4318cc);_0x4296b9(_0xf00b36[_0x62ba('0x17')](0x1f4,_0x1f7612[_0x62ba('0x19')]));});});};exports['AddTagsToMailInteraction']=function(_0x405a73){return new Promise(function(_0x1c0759,_0x8c0e7a){return db['MailInteraction'][_0x62ba('0x27')]({'where':_0x405a73[_0x62ba('0x20')]?_0x405a73[_0x62ba('0x20')][_0x62ba('0x22')]||null:null})[_0x62ba('0x25')](function(_0x15597a){if(_0x15597a){return _0x15597a['addTags'](_0x405a73[_0x62ba('0x1f')][_0x62ba('0x28')],_['omit'](_0x405a73[_0x62ba('0x1f')],[_0x62ba('0x28'),'id'])||{});}})[_0x62ba('0x29')](function(_0x528d2d){logger['info'](_0x62ba('0x2a'),_0x405a73);logger[_0x62ba('0x26')]('AddTags',_0x405a73,JSON['stringify'](_0x528d2d));_0x1c0759(_0x528d2d);})[_0x62ba('0x1b')](function(_0x4b09b0){logger[_0x62ba('0x17')](_0x62ba('0x2a'),_0x4b09b0[_0x62ba('0x19')],_0x405a73);_0x8c0e7a(_this[_0x62ba('0x17')](0x1f4,_0x4b09b0['message']));});});}; \ No newline at end of file +var _0x9c46=['UpdateMailInteraction','MailInteraction','update','options','raw','where','limit','AddTagsToMailInteraction','find','body','ids','omit','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','register','then','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch'];(function(_0x4c0fd9,_0x550f7e){var _0xcc40ec=function(_0xdc7f4a){while(--_0xdc7f4a){_0x4c0fd9['push'](_0x4c0fd9['shift']());}};_0xcc40ec(++_0x550f7e);}(_0x9c46,0xa5));var _0x69c4=function(_0x343337,_0x39b2a5){_0x343337=_0x343337-0x0;var _0x2feda1=_0x9c46[_0x343337];return _0x2feda1;};'use strict';var _=require('lodash');var util=require(_0x69c4('0x0'));var moment=require(_0x69c4('0x1'));var BPromise=require('bluebird');var rs=require(_0x69c4('0x2'));var fs=require('fs');var Redis=require(_0x69c4('0x3'));var db=require(_0x69c4('0x4'))['db'];var utils=require(_0x69c4('0x5'));var logger=require(_0x69c4('0x6'))(_0x69c4('0x7'));var config=require(_0x69c4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x69c4('0x9')]['http']({'port':0x232a});config[_0x69c4('0xa')]=_[_0x69c4('0xb')](config[_0x69c4('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x69c4('0xc'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0x69c4('0xd')](socket);function respondWithRpcPromise(_0x24bce0,_0x4c294f,_0x222a29){return new BPromise(function(_0x3d5437,_0x36e5bb){return client['request'](_0x24bce0,_0x222a29)[_0x69c4('0xe')](function(_0x362434){logger['info'](_0x69c4('0xf'),_0x4c294f,_0x69c4('0x10'));logger[_0x69c4('0x11')](_0x69c4('0x12'),_0x4c294f,_0x69c4('0x10'),JSON[_0x69c4('0x13')](_0x362434));if(_0x362434[_0x69c4('0x14')]){if(_0x362434[_0x69c4('0x14')][_0x69c4('0x15')]===0x1f4){logger[_0x69c4('0x14')]('MailInteraction,\x20%s,\x20%s',_0x4c294f,_0x362434[_0x69c4('0x14')][_0x69c4('0x16')]);return _0x36e5bb(_0x362434['error'][_0x69c4('0x16')]);}logger['error']('MailInteraction,\x20%s,\x20%s',_0x4c294f,_0x362434[_0x69c4('0x14')][_0x69c4('0x16')]);return _0x3d5437(_0x362434[_0x69c4('0x14')]['message']);}else{logger[_0x69c4('0x17')](_0x69c4('0xf'),_0x4c294f,_0x69c4('0x10'));_0x3d5437(_0x362434['result'][_0x69c4('0x16')]);}})[_0x69c4('0x18')](function(_0x4c86d6){logger[_0x69c4('0x14')]('MailInteraction,\x20%s,\x20%s',_0x4c294f,_0x4c86d6);_0x36e5bb(_0x4c86d6);});});}exports[_0x69c4('0x19')]=function(_0x4bd0cb){var _0x52093b=this;return new Promise(function(_0x6e0a76,_0x4c8480){return db[_0x69c4('0x1a')][_0x69c4('0x1b')](_0x4bd0cb['body'],{'raw':_0x4bd0cb[_0x69c4('0x1c')]?_0x4bd0cb['options'][_0x69c4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bd0cb[_0x69c4('0x1c')]?_0x4bd0cb['options'][_0x69c4('0x1e')]||null:null,'attributes':_0x4bd0cb[_0x69c4('0x1c')]?_0x4bd0cb[_0x69c4('0x1c')]['attributes']||null:null,'limit':_0x4bd0cb[_0x69c4('0x1c')]?_0x4bd0cb[_0x69c4('0x1c')][_0x69c4('0x1f')]||null:null})['then'](function(_0x54b64d){logger[_0x69c4('0x17')](_0x69c4('0x19'),_0x4bd0cb);logger[_0x69c4('0x11')](_0x69c4('0x19'),_0x4bd0cb,JSON['stringify'](_0x54b64d));_0x6e0a76(_0x54b64d);})['catch'](function(_0x353aba){logger[_0x69c4('0x14')](_0x69c4('0x19'),_0x353aba[_0x69c4('0x16')],_0x4bd0cb);_0x4c8480(_0x52093b[_0x69c4('0x14')](0x1f4,_0x353aba[_0x69c4('0x16')]));});});};exports[_0x69c4('0x20')]=function(_0x42a81f){return new Promise(function(_0x3740bb,_0xdcf2c0){return db['MailInteraction'][_0x69c4('0x21')]({'where':_0x42a81f[_0x69c4('0x1c')]?_0x42a81f[_0x69c4('0x1c')][_0x69c4('0x1e')]||null:null})['then'](function(_0x360b05){if(_0x360b05){return _0x360b05['addTags'](_0x42a81f[_0x69c4('0x22')][_0x69c4('0x23')],_[_0x69c4('0x24')](_0x42a81f['body'],['ids','id'])||{});}})['spread'](function(_0x1fc1e4){logger['info'](_0x69c4('0x25'),_0x42a81f);logger[_0x69c4('0x11')](_0x69c4('0x25'),_0x42a81f,JSON['stringify'](_0x1fc1e4));_0x3740bb(_0x1fc1e4);})[_0x69c4('0x18')](function(_0x1937d6){logger[_0x69c4('0x14')](_0x69c4('0x25'),_0x1937d6[_0x69c4('0x16')],_0x42a81f);_0xdcf2c0(_this['error'](0x1f4,_0x1937d6[_0x69c4('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 5468b0e..b689737 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 _0x58e9=['register','./mailInteraction.events','save','remove','update','removeListener'];(function(_0x6f9784,_0x40f20b){var _0x13a71f=function(_0x4263d9){while(--_0x4263d9){_0x6f9784['push'](_0x6f9784['shift']());}};_0x13a71f(++_0x40f20b);}(_0x58e9,0xd3));var _0x958e=function(_0x2c045f,_0x4b1fdd){_0x2c045f=_0x2c045f-0x0;var _0x272b17=_0x58e9[_0x2c045f];return _0x272b17;};'use strict';var MailInteractionEvents=require(_0x958e('0x0'));var events=[_0x958e('0x1'),_0x958e('0x2'),_0x958e('0x3')];function createListener(_0x15dce8,_0x492379){return function(_0x4765b3){_0x492379['emit'](_0x15dce8,_0x4765b3);};}function removeListener(_0x3edcc9,_0x317ab1){return function(){MailInteractionEvents[_0x958e('0x4')](_0x3edcc9,_0x317ab1);};}exports[_0x958e('0x5')]=function(_0x51bf1a){for(var _0x19ce6e=0x0,_0x3ce18=events['length'];_0x19ce6e<_0x3ce18;_0x19ce6e++){var _0x18978a=events[_0x19ce6e];var _0x2c6200=createListener('mailInteraction:'+_0x18978a,_0x51bf1a);MailInteractionEvents['on'](_0x18978a,_0x2c6200);}}; \ No newline at end of file +var _0x241d=['removeListener','length','mailInteraction:','save','remove','update'];(function(_0x28bef9,_0x28e8d6){var _0x45db81=function(_0x269033){while(--_0x269033){_0x28bef9['push'](_0x28bef9['shift']());}};_0x45db81(++_0x28e8d6);}(_0x241d,0x1e9));var _0xd241=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0x241d[_0x3c2a69];return _0x596bc8;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xd241('0x0'),_0xd241('0x1'),_0xd241('0x2')];function createListener(_0x5002de,_0x43a02f){return function(_0x4e3942){_0x43a02f['emit'](_0x5002de,_0x4e3942);};}function removeListener(_0x2ee5c7,_0xb3b4f9){return function(){MailInteractionEvents[_0xd241('0x3')](_0x2ee5c7,_0xb3b4f9);};}exports['register']=function(_0x627a9){for(var _0x1417db=0x0,_0x1acc32=events[_0xd241('0x4')];_0x1417db<_0x1acc32;_0x1417db++){var _0x83144=events[_0x1417db];var _0x5e506a=createListener(_0xd241('0x5')+_0x83144,_0x627a9);MailInteractionEvents['on'](_0x83144,_0x5e506a);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 6be27c6..eba23c0 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 _0x55ea=['accept','/:id/reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','/describe','isAuthenticated','describe','get','/:id','show','/:id/download','post','tracked','mail','mailmessage:create','put','update','/:id/accept'];(function(_0x2afb28,_0x19e8b0){var _0x41d764=function(_0x566707){while(--_0x566707){_0x2afb28['push'](_0x2afb28['shift']());}};_0x41d764(++_0x19e8b0);}(_0x55ea,0xc9));var _0xa55e=function(_0x46aaaa,_0x1078ea){_0x46aaaa=_0x46aaaa-0x0;var _0x4ff218=_0x55ea[_0x46aaaa];return _0x4ff218;};'use strict';var multer=require(_0xa55e('0x0'));var util=require(_0xa55e('0x1'));var path=require(_0xa55e('0x2'));var timeout=require('connect-timeout');var express=require(_0xa55e('0x3'));var router=express[_0xa55e('0x4')]();var fs_extra=require(_0xa55e('0x5'));var auth=require(_0xa55e('0x6'));var interaction=require(_0xa55e('0x7'));var config=require('../../config/environment');var controller=require(_0xa55e('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xa55e('0x9'),auth[_0xa55e('0xa')](),controller[_0xa55e('0xb')]);router[_0xa55e('0xc')](_0xa55e('0xd'),auth[_0xa55e('0xa')](),controller[_0xa55e('0xe')]);router[_0xa55e('0xc')](_0xa55e('0xf'),auth['isAuthenticated'](),controller['download']);router[_0xa55e('0x10')]('/',auth[_0xa55e('0xa')](),interaction[_0xa55e('0x11')](_0xa55e('0x12'),_0xa55e('0x13')),controller['create']);router[_0xa55e('0x14')]('/:id',auth[_0xa55e('0xa')](),controller[_0xa55e('0x15')]);router[_0xa55e('0x14')](_0xa55e('0x16'),auth[_0xa55e('0xa')](),controller[_0xa55e('0x17')]);router[_0xa55e('0x14')](_0xa55e('0x18'),auth[_0xa55e('0xa')](),controller['reject']);router[_0xa55e('0x19')](_0xa55e('0xd'),auth[_0xa55e('0xa')](),controller[_0xa55e('0x1a')]);module[_0xa55e('0x1b')]=router; \ No newline at end of file +var _0xa1aa=['update','/:id/accept','/:id/reject','reject','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','download','post','tracked','mail','mailmessage:create','create','put'];(function(_0x11ba83,_0xd5611a){var _0x3f3925=function(_0x3d7cb0){while(--_0x3d7cb0){_0x11ba83['push'](_0x11ba83['shift']());}};_0x3f3925(++_0xd5611a);}(_0xa1aa,0x19b));var _0xaa1a=function(_0x28cb0c,_0x15a248){_0x28cb0c=_0x28cb0c-0x0;var _0x18ecce=_0xa1aa[_0x28cb0c];return _0x18ecce;};'use strict';var multer=require('multer');var util=require(_0xaa1a('0x0'));var path=require(_0xaa1a('0x1'));var timeout=require(_0xaa1a('0x2'));var express=require(_0xaa1a('0x3'));var router=express[_0xaa1a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaa1a('0x5'));var config=require(_0xaa1a('0x6'));var controller=require('./mailMessage.controller');router[_0xaa1a('0x7')]('/',auth[_0xaa1a('0x8')](),controller[_0xaa1a('0x9')]);router['get'](_0xaa1a('0xa'),auth['isAuthenticated'](),controller[_0xaa1a('0xb')]);router['get'](_0xaa1a('0xc'),auth[_0xaa1a('0x8')](),controller['show']);router['get'](_0xaa1a('0xd'),auth[_0xaa1a('0x8')](),controller[_0xaa1a('0xe')]);router[_0xaa1a('0xf')]('/',auth['isAuthenticated'](),interaction[_0xaa1a('0x10')](_0xaa1a('0x11'),_0xaa1a('0x12')),controller[_0xaa1a('0x13')]);router[_0xaa1a('0x14')](_0xaa1a('0xc'),auth[_0xaa1a('0x8')](),controller[_0xaa1a('0x15')]);router[_0xaa1a('0x14')](_0xaa1a('0x16'),auth['isAuthenticated'](),controller['accept']);router[_0xaa1a('0x14')](_0xaa1a('0x17'),auth[_0xaa1a('0x8')](),controller[_0xaa1a('0x18')]);router[_0xaa1a('0x19')]('/:id',auth[_0xaa1a('0x8')](),controller['destroy']);module[_0xaa1a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index ea8bd5a..a0fd5ab 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 _0x4df5=['exports','TEXT','long','medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN','Email','Chat','sequelize','lodash'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x4df5,0x140));var _0x54df=function(_0x3f037c,_0x222d42){_0x3f037c=_0x3f037c-0x0;var _0x535eb7=_0x4df5[_0x3f037c];return _0x535eb7;};'use strict';var Sequelize=require(_0x54df('0x0'));var _=require(_0x54df('0x1'));module[_0x54df('0x2')]={'body':{'type':Sequelize[_0x54df('0x3')](_0x54df('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x54df('0x3')](_0x54df('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x54df('0x6')]('in',_0x54df('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x54df('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0x54df('0x4'))},'cc':{'type':Sequelize[_0x54df('0x3')](_0x54df('0x4'))},'bcc':{'type':Sequelize[_0x54df('0x3')]('long')},'subject':{'type':Sequelize[_0x54df('0x3')]},'sentAt':{'type':Sequelize[_0x54df('0x9')]},'attach':{'type':Sequelize[_0x54df('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x54df('0xb')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x54df('0x9')]},'originTo':{'type':Sequelize[_0x54df('0x3')]('long')},'originCc':{'type':Sequelize[_0x54df('0x3')](_0x54df('0x4'))},'originChannel':{'type':Sequelize[_0x54df('0x6')](_0x54df('0xc'),_0x54df('0xd')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x9f31=['exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','sequelize','lodash'];(function(_0x36630e,_0x38008d){var _0x330a46=function(_0x2025eb){while(--_0x2025eb){_0x36630e['push'](_0x36630e['shift']());}};_0x330a46(++_0x38008d);}(_0x9f31,0x8d));var _0x19f3=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0x9f31[_0x1562a2];return _0x39a636;};'use strict';var Sequelize=require(_0x19f3('0x0'));var _=require(_0x19f3('0x1'));module[_0x19f3('0x2')]={'body':{'type':Sequelize[_0x19f3('0x3')](_0x19f3('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x19f3('0x3')](_0x19f3('0x5'))},'read':{'type':Sequelize[_0x19f3('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x19f3('0x7')]('in',_0x19f3('0x8')),'defaultValue':_0x19f3('0x8'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x19f3('0x9')]},'to':{'type':Sequelize[_0x19f3('0x3')](_0x19f3('0x4'))},'cc':{'type':Sequelize[_0x19f3('0x3')](_0x19f3('0x4'))},'bcc':{'type':Sequelize['TEXT'](_0x19f3('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x19f3('0xa')]},'attach':{'type':Sequelize[_0x19f3('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x19f3('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x19f3('0xa')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0x19f3('0x3')](_0x19f3('0x4'))},'originChannel':{'type':Sequelize[_0x19f3('0x7')](_0x19f3('0xc'),'Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 0c69a8a..9b20a42 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 _0xcb3a=['../../config/environment','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','client','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','undefined','limit','count','offset','status','set','update','destroy','end','sendStatus','send','index','MailMessage','rawAttributes','fieldName','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','params','include','body','find','describe','create','MailAccount','findOne','CmList','List','CmContact','updatedAt','DESC','Smtp','isNil','service','host','port','secure','authentication','pass','auth','user','attachments','join','root','basename','Contacts','ListId','List\x20not\x20found','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','agent','MailInteraction','MailInteractionId','read1stAt','interaction','get','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','Sequelize','interface','download','unix','toString','server','files','from','bcc','subject','Attachment','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','existsSync','push','type','build','writeFileSync','eml-format','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions'];(function(_0x5196d9,_0x2d6111){var _0x29e1f4=function(_0x3a03d9){while(--_0x3a03d9){_0x5196d9['push'](_0x5196d9['shift']());}};_0x29e1f4(++_0x2d6111);}(_0xcb3a,0x1d7));var _0xacb3=function(_0x2941c4,_0x48780f){_0x2941c4=_0x2941c4-0x0;var _0x44152f=_0xcb3a[_0x2941c4];return _0x44152f;};'use strict';var emlformat=require(_0xacb3('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xacb3('0x1'));var path=require(_0xacb3('0x2'));var fs=require('fs');var _=require(_0xacb3('0x3'));var Redis=require(_0xacb3('0x4'));var htmlToText=require(_0xacb3('0x5'));var qs=require(_0xacb3('0x6'));var logger=require(_0xacb3('0x7'))('api');var interaction_log=require(_0xacb3('0x7'))(_0xacb3('0x8'));var config=require(_0xacb3('0x9'));var db=require('../../mysqldb')['db'];config[_0xacb3('0xa')]=_[_0xacb3('0xb')](config[_0xacb3('0xa')],{'host':_0xacb3('0xc'),'port':0x18eb});var socket=require(_0xacb3('0xd'))(new Redis(config[_0xacb3('0xa')]));require('./mailMessage.socket')['register'](socket);var jayson=require(_0xacb3('0xe'));var client=jayson['client'][_0xacb3('0xf')]({'port':0x232c});var client9003=jayson[_0xacb3('0x10')][_0xacb3('0xf')]({'port':0x232b});var client9002=jayson[_0xacb3('0x10')][_0xacb3('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x3c88fd,_0x3a0bd1,_0x1a7182,_0x43e8ce){return new BPromise(function(_0x45e03c,_0x354473){var _0xaa66e0=_0x43e8ce||client;return _0xaa66e0[_0xacb3('0x11')](_0x3c88fd,_0x1a7182)[_0xacb3('0x12')](function(_0x211c19){logger[_0xacb3('0x13')](_0xacb3('0x14'),_0x3a0bd1,_0xacb3('0x15'));logger[_0xacb3('0x16')](_0xacb3('0x17'),_0x3a0bd1,_0xacb3('0x15'),JSON[_0xacb3('0x18')](_0x211c19));if(_0x211c19[_0xacb3('0x19')]){if(_0x211c19['error'][_0xacb3('0x1a')]===0x1f4){logger[_0xacb3('0x19')](_0xacb3('0x14'),_0x3a0bd1,_0x211c19[_0xacb3('0x19')][_0xacb3('0x1b')]);return _0x354473(_0x211c19[_0xacb3('0x19')]['message']);}logger[_0xacb3('0x19')](_0xacb3('0x14'),_0x3a0bd1,_0x211c19[_0xacb3('0x19')][_0xacb3('0x1b')]);return _0x45e03c(_0x211c19[_0xacb3('0x19')][_0xacb3('0x1b')]);}else{logger[_0xacb3('0x13')](_0xacb3('0x14'),_0x3a0bd1,_0xacb3('0x15'));_0x45e03c(_0x211c19[_0xacb3('0x1c')][_0xacb3('0x1b')]);}})[_0xacb3('0x1d')](function(_0x1f3559){logger[_0xacb3('0x19')](_0xacb3('0x14'),_0x3a0bd1,_0x1f3559);_0x354473(_0x1f3559);});});}function respondWithResult(_0x41f05,_0x1d0b9a){_0x1d0b9a=_0x1d0b9a||0xc8;return function(_0x4dcf88){if(_0x4dcf88){return _0x41f05['status'](_0x1d0b9a)[_0xacb3('0x1e')](_0x4dcf88);}};}function respondWithFilteredResult(_0x120271,_0x2724cf){return function(_0x1a4119){if(_0x1a4119){var _0x4cb842=typeof _0x2724cf['offset']===_0xacb3('0x1f')&&typeof _0x2724cf[_0xacb3('0x20')]===_0xacb3('0x1f');var _0x40d565=_0x1a4119[_0xacb3('0x21')];var _0x4dbd29=_0x4cb842?0x0:_0x2724cf[_0xacb3('0x22')];var _0xbdb09=_0x4cb842?_0x1a4119[_0xacb3('0x21')]:_0x2724cf[_0xacb3('0x22')]+_0x2724cf[_0xacb3('0x20')];var _0x4503c6;if(_0xbdb09>=_0x40d565){_0xbdb09=_0x40d565;_0x4503c6=0xc8;}else{_0x4503c6=0xce;}_0x120271[_0xacb3('0x23')](_0x4503c6);return _0x120271[_0xacb3('0x24')]('Content-Range',_0x4dbd29+'-'+_0xbdb09+'/'+_0x40d565)[_0xacb3('0x1e')](_0x1a4119);}return null;};}function saveUpdates(_0x1b94de){return function(_0x2cebb9){if(_0x2cebb9){return _0x2cebb9[_0xacb3('0x25')](_0x1b94de)[_0xacb3('0x12')](function(_0x583337){return _0x583337;});}return null;};}function removeEntity(_0x45958d){return function(_0x29d72f){if(_0x29d72f){return _0x29d72f[_0xacb3('0x26')]()[_0xacb3('0x12')](function(){_0x45958d[_0xacb3('0x23')](0xcc)[_0xacb3('0x27')]();});}};}function handleEntityNotFound(_0x54c922){return function(_0x27475e){if(!_0x27475e){_0x54c922[_0xacb3('0x28')](0x194);}return _0x27475e;};}function handleError(_0xd67eeb,_0x3e43a9){_0x3e43a9=_0x3e43a9||0x1f4;return function(_0x59dbe5){logger[_0xacb3('0x19')](_0x59dbe5['stack']);if(_0x59dbe5['name']){delete _0x59dbe5['name'];}_0xd67eeb[_0xacb3('0x23')](_0x3e43a9)[_0xacb3('0x29')](_0x59dbe5);};}exports[_0xacb3('0x2a')]=function(_0x227cfd,_0x278cfa){var _0x2da64b={},_0x1710cd={},_0x254a34={'count':0x0,'rows':[]};var _0x5c3548=_['map'](db[_0xacb3('0x2b')][_0xacb3('0x2c')],function(_0x1bb4e9){return{'name':_0x1bb4e9[_0xacb3('0x2d')],'type':_0x1bb4e9['type'][_0xacb3('0x2e')]};});_0x1710cd[_0xacb3('0x2f')]=_[_0xacb3('0x30')](_0x5c3548,_0xacb3('0x31'));_0x1710cd[_0xacb3('0x32')]=_[_0xacb3('0x33')](_0x227cfd[_0xacb3('0x32')]);_0x1710cd[_0xacb3('0x34')]=_[_0xacb3('0x35')](_0x1710cd[_0xacb3('0x2f')],_0x1710cd[_0xacb3('0x32')]);_0x2da64b[_0xacb3('0x36')]=_[_0xacb3('0x35')](_0x1710cd[_0xacb3('0x2f')],qs[_0xacb3('0x37')](_0x227cfd[_0xacb3('0x32')]['fields']));_0x2da64b[_0xacb3('0x36')]=_0x2da64b[_0xacb3('0x36')][_0xacb3('0x38')]?_0x2da64b[_0xacb3('0x36')]:_0x1710cd[_0xacb3('0x2f')];if(!_0x227cfd[_0xacb3('0x32')][_0xacb3('0x39')](_0xacb3('0x3a'))){_0x2da64b['limit']=qs[_0xacb3('0x20')](_0x227cfd[_0xacb3('0x32')][_0xacb3('0x20')]);_0x2da64b[_0xacb3('0x22')]=qs['offset'](_0x227cfd[_0xacb3('0x32')][_0xacb3('0x22')]);}_0x2da64b['order']=qs[_0xacb3('0x3b')](_0x227cfd[_0xacb3('0x32')][_0xacb3('0x3b')]);_0x2da64b[_0xacb3('0x3c')]=qs[_0xacb3('0x34')](_[_0xacb3('0x3d')](_0x227cfd[_0xacb3('0x32')],_0x1710cd[_0xacb3('0x34')]),_0x5c3548);if(_0x227cfd[_0xacb3('0x32')][_0xacb3('0x3e')]){_0x2da64b[_0xacb3('0x3c')]=_['merge'](_0x2da64b[_0xacb3('0x3c')],{'$or':_[_0xacb3('0x30')](_0x5c3548,function(_0x2a5521){if(_0x2a5521['type']!==_0xacb3('0x3f')){var _0x93032={};_0x93032[_0x2a5521[_0xacb3('0x31')]]={'$like':'%'+_0x227cfd['query'][_0xacb3('0x3e')]+'%'};return _0x93032;}})});}_0x2da64b=_[_0xacb3('0x40')]({},_0x2da64b,_0x227cfd[_0xacb3('0x41')]);var _0x278b27={'where':_0x2da64b[_0xacb3('0x3c')]};return db[_0xacb3('0x2b')][_0xacb3('0x21')](_0x278b27)['then'](function(_0x3282ec){_0x254a34[_0xacb3('0x21')]=_0x3282ec;if(_0x227cfd[_0xacb3('0x32')][_0xacb3('0x42')]){_0x2da64b['include']=[{'all':!![]}];}return db[_0xacb3('0x2b')][_0xacb3('0x43')](_0x2da64b);})[_0xacb3('0x12')](function(_0x2c161e){_0x254a34[_0xacb3('0x44')]=_0x2c161e;return _0x254a34;})[_0xacb3('0x12')](respondWithFilteredResult(_0x278cfa,_0x2da64b))[_0xacb3('0x1d')](handleError(_0x278cfa,null));};exports['show']=function(_0x2c5417,_0x115660){var _0x24a173={'raw':!![],'where':{'id':_0x2c5417[_0xacb3('0x45')]['id']}},_0x405115={};_0x405115[_0xacb3('0x2f')]=_[_0xacb3('0x33')](db[_0xacb3('0x2b')]['rawAttributes']);_0x405115[_0xacb3('0x32')]=_[_0xacb3('0x33')](_0x2c5417[_0xacb3('0x32')]);_0x405115[_0xacb3('0x34')]=_['intersection'](_0x405115['model'],_0x405115[_0xacb3('0x32')]);_0x24a173[_0xacb3('0x36')]=_['intersection'](_0x405115[_0xacb3('0x2f')],qs['fields'](_0x2c5417[_0xacb3('0x32')][_0xacb3('0x37')]));_0x24a173[_0xacb3('0x36')]=_0x24a173[_0xacb3('0x36')]['length']?_0x24a173[_0xacb3('0x36')]:_0x405115[_0xacb3('0x2f')];if(_0x2c5417['query'][_0xacb3('0x42')]){_0x24a173[_0xacb3('0x46')]=[{'all':!![]}];}_0x24a173=_[_0xacb3('0x40')]({},_0x24a173,_0x2c5417[_0xacb3('0x41')]);return db[_0xacb3('0x2b')]['find'](_0x24a173)[_0xacb3('0x12')](handleEntityNotFound(_0x115660,null))[_0xacb3('0x12')](respondWithResult(_0x115660,null))['catch'](handleError(_0x115660,null));};exports['update']=function(_0x33aa39,_0x3c5172){if(_0x33aa39[_0xacb3('0x47')]['id']){delete _0x33aa39[_0xacb3('0x47')]['id'];}return db[_0xacb3('0x2b')][_0xacb3('0x48')]({'where':{'id':_0x33aa39[_0xacb3('0x45')]['id']}})[_0xacb3('0x12')](handleEntityNotFound(_0x3c5172,null))[_0xacb3('0x12')](saveUpdates(_0x33aa39[_0xacb3('0x47')],null))[_0xacb3('0x12')](respondWithResult(_0x3c5172,null))['catch'](handleError(_0x3c5172,null));};exports['destroy']=function(_0x34efd1,_0x5bfdd8){return db[_0xacb3('0x2b')]['find']({'where':{'id':_0x34efd1[_0xacb3('0x45')]['id']}})['then'](handleEntityNotFound(_0x5bfdd8,null))[_0xacb3('0x12')](removeEntity(_0x5bfdd8,null))[_0xacb3('0x1d')](handleError(_0x5bfdd8,null));};exports[_0xacb3('0x49')]=function(_0x1ecad8,_0xa89d61){return db[_0xacb3('0x2b')][_0xacb3('0x49')]()[_0xacb3('0x12')](respondWithResult(_0xa89d61,null))['catch'](handleError(_0xa89d61,null));};exports[_0xacb3('0x4a')]=function(_0x3a6978,_0x1e0474){return db[_0xacb3('0x2b')][_0xacb3('0x4a')](_0x3a6978['body'])[_0xacb3('0x12')](function(_0x4c121d){if(_0x4c121d){if(_0x4c121d['direction']==='out'&&!_0x4c121d['secret']){var _0x49a299,_0x36841c,_0xfdff45;if(_0x3a6978['body']['to']){_0x36841c=_0x3a6978[_0xacb3('0x47')]['to']['split'](',')[0x0];}return db[_0xacb3('0x4b')][_0xacb3('0x4c')]({'where':{'id':_0x4c121d['MailAccountId']},'include':[{'model':db[_0xacb3('0x4d')],'as':_0xacb3('0x4e'),'include':[{'model':db[_0xacb3('0x4f')],'as':'Contacts','where':{'email':_0x36841c},'limit':0x1,'order':[[_0xacb3('0x50'),_0xacb3('0x51')]]}]},{'model':db['MailServerOut'],'as':_0xacb3('0x52'),'raw':!![]}]})[_0xacb3('0x12')](function(_0x196fe6){_0x49a299=_0x196fe6;if(_0x49a299&&_0x49a299[_0xacb3('0x52')]){var _0x3ba181={'tls':{'rejectUnauthorized':![]}};if(_[_0xacb3('0x53')](_0x49a299[_0xacb3('0x52')][_0xacb3('0x54')])){_0x3ba181[_0xacb3('0x55')]=_0x49a299[_0xacb3('0x52')][_0xacb3('0x55')];_0x3ba181[_0xacb3('0x56')]=_0x49a299[_0xacb3('0x52')][_0xacb3('0x56')];_0x3ba181[_0xacb3('0x57')]=_0x49a299[_0xacb3('0x52')]['secure'];if(_0x49a299[_0xacb3('0x52')][_0xacb3('0x58')]){_0x3ba181['auth']={'user':_0x49a299[_0xacb3('0x52')]['user'],'pass':_0x49a299[_0xacb3('0x52')][_0xacb3('0x59')]};}}else{_0x3ba181['service']=_0x49a299[_0xacb3('0x52')][_0xacb3('0x54')];_0x3ba181[_0xacb3('0x5a')]={'user':_0x49a299[_0xacb3('0x52')][_0xacb3('0x5b')],'pass':_0x49a299['Smtp']['pass']};_0x3ba181[_0xacb3('0x57')]=_0x49a299['Smtp']['secure'];}if(_0x3a6978[_0xacb3('0x47')][_0xacb3('0x5c')]&&_0x3a6978[_0xacb3('0x47')][_0xacb3('0x5c')]['length']){for(var _0x51ea91=0x0;_0x51ea91<_0x3a6978[_0xacb3('0x47')][_0xacb3('0x5c')][_0xacb3('0x38')];_0x51ea91+=0x1){_0x3a6978['body'][_0xacb3('0x5c')][_0x51ea91]={'filename':_0x3a6978['body'][_0xacb3('0x5c')][_0x51ea91][_0xacb3('0x31')],'path':path[_0xacb3('0x5d')](config[_0xacb3('0x5e')],'server/files/attachments',_0x3a6978[_0xacb3('0x47')][_0xacb3('0x5c')][_0x51ea91][_0xacb3('0x5f')])};}}_0xfdff45={'account':_0x3ba181,'message':_0x3a6978[_0xacb3('0x47')]};return;}})[_0xacb3('0x12')](function(){if(_0x49a299[_0xacb3('0x4e')]){if(_0x49a299[_0xacb3('0x4e')]['Contacts'][_0xacb3('0x38')]){return _0x49a299[_0xacb3('0x4e')][_0xacb3('0x60')][0x0];}else{return db[_0xacb3('0x4f')]['create'](_[_0xacb3('0xb')](_0x3a6978[_0xacb3('0x47')],{'firstName':_0x3a6978[_0xacb3('0x47')]['to'],'email':_0x3a6978[_0xacb3('0x47')]['to'],'phone':_0x3a6978['body']['to'],'ListId':_0x49a299[_0xacb3('0x61')]}));}}else{throw new Error(_0xacb3('0x62'));}})['then'](function(){if(_0xfdff45){return respondWithRpcPromise(_0xacb3('0x63'),'sendMail',_0xfdff45,client9003)[_0xacb3('0x12')](function(_0x6cf3f7){return _0x4c121d['update']({'read':!![],'messageId':_0x6cf3f7[_0xacb3('0x64')],'sentAt':moment()[_0xacb3('0x65')](_0xacb3('0x66'))});})[_0xacb3('0x1d')](function(_0x1b8303){logger[_0xacb3('0x19')]('%s',JSON[_0xacb3('0x18')](_0x1b8303));return _0x4c121d;});}return _0x4c121d;});}return _0x4c121d;}})['then'](respondWithResult(_0x1e0474,0xc9))[_0xacb3('0x1d')](handleError(_0x1e0474,null));};exports[_0xacb3('0x67')]=function(_0x2b0f84,_0x3a9fb6){var _0x49eb49={'agent':{},'channel':_0xacb3('0x68')};if(_0x2b0f84[_0xacb3('0x47')]['id']){delete _0x2b0f84[_0xacb3('0x47')]['id'];}_0x2b0f84[_0xacb3('0x47')][_0xacb3('0x69')]=!![];_0x2b0f84['body'][_0xacb3('0x6a')]=moment()[_0xacb3('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b0f84[_0xacb3('0x47')][_0xacb3('0x6b')]=_0x2b0f84[_0xacb3('0x47')][_0xacb3('0x6b')]||_0x2b0f84['user']['id'];_0x49eb49[_0xacb3('0x6c')]['id']=_0x2b0f84[_0xacb3('0x47')]['UserId'];return db[_0xacb3('0x2b')][_0xacb3('0x48')]({'where':{'id':_0x2b0f84[_0xacb3('0x45')]['id'],'UserId':null}})[_0xacb3('0x12')](handleEntityNotFound(_0x3a9fb6,null))[_0xacb3('0x12')](saveUpdates(_0x2b0f84['body'],null))[_0xacb3('0x12')](function(_0x2c5296){if(_0x2c5296){_0x49eb49['message']=_0x2c5296['get']({'plain':!![]});return db[_0xacb3('0x6d')]['find']({'where':{'id':_0x2c5296[_0xacb3('0x6e')]}});}return null;})[_0xacb3('0x12')](handleEntityNotFound(_0x3a9fb6,null))[_0xacb3('0x12')](function(_0x84d4dc){if(_0x84d4dc){return _0x84d4dc[_0xacb3('0x25')]({'UserId':_0x2b0f84[_0xacb3('0x47')][_0xacb3('0x6b')],'read1stAt':_[_0xacb3('0x53')](_0x84d4dc[_0xacb3('0x6f')])?moment()[_0xacb3('0x65')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x5e4ae0){if(_0x5e4ae0){_0x49eb49[_0xacb3('0x70')]=_0x5e4ae0[_0xacb3('0x71')]({'plain':!![]});interaction_log[_0xacb3('0x13')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2b0f84['user']['id'],_0x2b0f84[_0xacb3('0x5b')][_0xacb3('0x31')],_0x2b0f84[_0xacb3('0x5b')]['role'],_0x49eb49[_0xacb3('0x70')]['id'],_0x2b0f84[_0xacb3('0x47')]?JSON[_0xacb3('0x18')](_0x2b0f84['body']):_0xacb3('0x72'));return respondWithRpcPromise(_0xacb3('0x73'),_0xacb3('0x74'),_0x49eb49);}return null;})[_0xacb3('0x12')](function(_0x3dda99){var _0x22c7a8=_0xacb3('0x75')+_0x3dda99['message'][_0xacb3('0x76')];return db[_0xacb3('0x77')][_0xacb3('0x32')](_0x22c7a8,{'type':db['Sequelize'][_0xacb3('0x78')][_0xacb3('0x79')],'raw':!![]})[_0xacb3('0x12')](function(_0x3f950e){return _0x3f950e;});})['then'](function(_0x471ee6){if(_0x471ee6){_0x49eb49[_0xacb3('0x1b')][_0xacb3('0x7a')]=_0x471ee6[0x0];if(!_0x2b0f84[_0xacb3('0x47')][_0xacb3('0x6b')])return;return db[_0xacb3('0x7b')][_0xacb3('0x48')]({'where':{'id':_0x2b0f84['body'][_0xacb3('0x6b')],'role':_0xacb3('0x6c')},'attributes':['id',_0xacb3('0x31'),_0xacb3('0x7c'),_0xacb3('0x7d'),_0xacb3('0x7e')],'raw':!![]});}return null;})[_0xacb3('0x12')](function(_0x524f22){if(!_0x524f22)return null;_0x49eb49['message'][_0xacb3('0x6c')]=_0x524f22;return _0x49eb49;})[_0xacb3('0x12')](function(_0x42d826){if(_0x42d826){if(_0x2b0f84[_0xacb3('0x47')][_0xacb3('0x7f')]){_0x49eb49[_0xacb3('0x1b')]['interface']=util[_0xacb3('0x65')](_0xacb3('0x80'),_0x2b0f84[_0xacb3('0x5b')][_0xacb3('0x31')]);_0x49eb49[_0xacb3('0x1b')][_0xacb3('0x81')]=_0x49eb49['channel'];_0x49eb49[_0xacb3('0x1b')][_0xacb3('0x82')]=_0x49eb49[_0xacb3('0x81')];_0x49eb49[_0xacb3('0x1b')][_0xacb3('0x83')]=_0xacb3('0x67');_0x49eb49['message'][_0xacb3('0x47')]=htmlToText[_0xacb3('0x84')](_0x49eb49[_0xacb3('0x1b')][_0xacb3('0x47')]);return respondWithRpcPromise(_0xacb3('0x85'),_0xacb3('0x85'),{'event':_0xacb3('0x86'),'message':_0x49eb49[_0xacb3('0x1b')]},client9002)['then'](function(){return _0x49eb49;});}return _0x49eb49;}return null;})[_0xacb3('0x12')](respondWithResult(_0x3a9fb6,null))[_0xacb3('0x1d')](handleError(_0x3a9fb6,null));};exports[_0xacb3('0x87')]=function(_0x565329,_0x887a1e){var _0x4780b7={'agent':{},'channel':_0xacb3('0x68')};if(_0x565329[_0xacb3('0x47')]['id']){delete _0x565329[_0xacb3('0x47')]['id'];}_0x565329[_0xacb3('0x47')][_0xacb3('0x6b')]=_0x565329[_0xacb3('0x47')]['UserId']||_0x565329[_0xacb3('0x5b')]['id'];_0x4780b7[_0xacb3('0x6c')]['id']=_0x565329[_0xacb3('0x47')][_0xacb3('0x6b')];return db[_0xacb3('0x2b')]['find']({'where':{'id':_0x565329[_0xacb3('0x45')]['id'],'UserId':null}})[_0xacb3('0x12')](handleEntityNotFound(_0x887a1e,null))[_0xacb3('0x12')](function(_0x3a7bcb){if(_0x3a7bcb){_0x4780b7[_0xacb3('0x1b')]=_0x3a7bcb[_0xacb3('0x71')]({'plain':!![]});return db[_0xacb3('0x6d')]['find']({'where':{'id':_0x3a7bcb[_0xacb3('0x6e')]}});}return null;})[_0xacb3('0x12')](handleEntityNotFound(_0x887a1e,null))['then'](function(_0x2dc9de){if(_0x2dc9de){_0x4780b7['interaction']=_0x2dc9de['get']({'plain':!![]});interaction_log[_0xacb3('0x13')](_0xacb3('0x88'),_0x565329[_0xacb3('0x5b')]['id'],_0x565329[_0xacb3('0x5b')]['name'],_0x565329[_0xacb3('0x5b')][_0xacb3('0x89')],_0x4780b7[_0xacb3('0x70')]['id'],_0x565329[_0xacb3('0x47')]?JSON[_0xacb3('0x18')](_0x565329[_0xacb3('0x47')]):_0xacb3('0x72'));return respondWithRpcPromise(_0xacb3('0x8a'),_0xacb3('0x8b'),_0x4780b7);}return null;})[_0xacb3('0x12')](function(_0x2aca79){var _0x103b02=_0xacb3('0x75')+_0x2aca79['message'][_0xacb3('0x76')];return db['sequelize'][_0xacb3('0x32')](_0x103b02,{'type':db[_0xacb3('0x8c')][_0xacb3('0x78')][_0xacb3('0x79')],'raw':!![]})['then'](function(_0x2cf689){return _0x2cf689;});})['then'](function(_0x14c968){if(_0x14c968){_0x4780b7[_0xacb3('0x1b')][_0xacb3('0x7a')]=_0x14c968[0x0];if(!_0x565329[_0xacb3('0x47')][_0xacb3('0x6b')])return;return db[_0xacb3('0x7b')][_0xacb3('0x48')]({'where':{'id':_0x565329[_0xacb3('0x47')][_0xacb3('0x6b')],'role':_0xacb3('0x6c')},'attributes':['id',_0xacb3('0x31'),_0xacb3('0x7c'),_0xacb3('0x7d'),_0xacb3('0x7e')],'raw':!![]});}return null;})[_0xacb3('0x12')](function(_0x212421){if(!_0x212421)return null;_0x4780b7[_0xacb3('0x1b')][_0xacb3('0x6c')]=_0x212421;return _0x4780b7;})[_0xacb3('0x12')](function(_0x1bbc45){if(_0x1bbc45){_0x1bbc45['message'][_0xacb3('0x8d')]=util[_0xacb3('0x65')](_0xacb3('0x80'),_0x565329[_0xacb3('0x5b')]['name']);_0x1bbc45[_0xacb3('0x1b')][_0xacb3('0x81')]=_0x4780b7[_0xacb3('0x81')];_0x1bbc45[_0xacb3('0x1b')]['motionChannel']=_0x4780b7[_0xacb3('0x81')];_0x1bbc45[_0xacb3('0x1b')][_0xacb3('0x83')]=_0xacb3('0x87');_0x1bbc45['message'][_0xacb3('0x47')]=htmlToText[_0xacb3('0x84')](_0x4780b7[_0xacb3('0x1b')][_0xacb3('0x47')]);respondWithRpcPromise(_0xacb3('0x85'),_0xacb3('0x85'),{'event':'rejectmessage','message':_0x1bbc45[_0xacb3('0x1b')]},client9002);return _0x4780b7;}return null;})[_0xacb3('0x12')](respondWithResult(_0x887a1e,null))[_0xacb3('0x1d')](handleError(_0x887a1e,null));};exports[_0xacb3('0x8e')]=function(_0x303f8d,_0x3180fa){var _0x574db0=moment()[_0xacb3('0x8f')]()[_0xacb3('0x90')]();var _0x44a88=path[_0xacb3('0x5d')](config[_0xacb3('0x5e')],_0xacb3('0x91'),'files','tmp');var _0x3a4612=path[_0xacb3('0x5d')](config[_0xacb3('0x5e')],'server',_0xacb3('0x92'),_0xacb3('0x5c'));var _0x578fd0=util['format']('message-%s.eml',_0x574db0);return db[_0xacb3('0x2b')][_0xacb3('0x48')]({'where':{'id':_0x303f8d[_0xacb3('0x45')]['id']},'attributes':['id',_0xacb3('0x47'),_0xacb3('0x93'),'to','cc',_0xacb3('0x94'),_0xacb3('0x95'),'createdAt'],'include':_0x303f8d[_0xacb3('0x32')][_0xacb3('0x5c')]?[{'model':db[_0xacb3('0x96')],'as':'Attachments'}]:undefined})[_0xacb3('0x12')](handleEntityNotFound(_0x3180fa,null))[_0xacb3('0x12')](function(_0x1bc704){if(_0x1bc704){var _0x3e1b26=_0x1bc704;var _0x3a5b8b={'from':_0x3e1b26['from'],'to':_0x3e1b26['to'],'subject':_0x3e1b26[_0xacb3('0x95')],'html':_0x3e1b26[_0xacb3('0x47')],'headers':{'Date':moment(_0x3e1b26[_0xacb3('0x97')])['format'](_0xacb3('0x98'))},'attachments':[]};if(_0x1bc704['cc']){_0x3a5b8b['headers']['Cc']=_0x1bc704['cc'];}if(_0x1bc704[_0xacb3('0x94')]){_0x3a5b8b[_0xacb3('0x99')]['Bcc']=_0x1bc704[_0xacb3('0x94')];}return new BPromise(function(_0x51e502,_0x9c793){if(_0x1bc704[_0xacb3('0x9a')]){for(var _0x35683f=0x0;_0x35683f<_0x1bc704[_0xacb3('0x9a')][_0xacb3('0x38')];_0x35683f++){var _0x28483c=_0x1bc704[_0xacb3('0x9a')][_0x35683f];var _0x100711=path['join'](_0x3a4612,_0x28483c['basename']);if(fs[_0xacb3('0x9b')](_0x100711)){_0x3a5b8b[_0xacb3('0x5c')][_0xacb3('0x9c')]({'name':_0x28483c[_0xacb3('0x31')],'contentType':_0x28483c[_0xacb3('0x9d')],'data':fs['readFileSync'](_0x100711)});}}}emlformat[_0xacb3('0x9e')](_0x3a5b8b,function(_0x52d503,_0x1e9627){if(_0x52d503)return _0x9c793(_0x52d503);fs[_0xacb3('0x9f')](path[_0xacb3('0x5d')](_0x44a88,_0x578fd0),_0x1e9627);return _0x51e502(_0x1e9627);});});}})[_0xacb3('0x12')](function(_0x30dac0){if(_0x30dac0){return _0x3180fa['download'](path[_0xacb3('0x5d')](_0x44a88,_0x578fd0),_0x578fd0,function(_0x212607){if(!_0x212607)fs['unlinkSync'](path[_0xacb3('0x5d')](_0x44a88,_0x578fd0));});}})[_0xacb3('0x1d')](handleError(_0x3180fa,null));}; \ No newline at end of file +var _0x7ed9=['from','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','readFileSync','writeFileSync','unlinkSync','eml-format','moment','bluebird','lodash','html-to-text','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../mysqldb','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','limit','undefined','count','offset','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','MailMessage','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','MailServerOut','Smtp','isNil','service','host','port','secure','auth','pass','user','attachments','join','root','server/files/attachments','basename','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','get','MailInteraction','MailInteractionId','UserId','read1stAt','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','info','rejectMessage','contact','reject','fromString','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','bcc','createdAt','Attachment'];(function(_0x5ce186,_0x2cc0ad){var _0x210518=function(_0x6c8bce){while(--_0x6c8bce){_0x5ce186['push'](_0x5ce186['shift']());}};_0x210518(++_0x2cc0ad);}(_0x7ed9,0x15b));var _0x97ed=function(_0x54049f,_0x21d7f3){_0x54049f=_0x54049f-0x0;var _0x1a07bf=_0x7ed9[_0x54049f];return _0x1a07bf;};'use strict';var emlformat=require(_0x97ed('0x0'));var moment=require(_0x97ed('0x1'));var BPromise=require(_0x97ed('0x2'));var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x97ed('0x3'));var Redis=require('ioredis');var htmlToText=require(_0x97ed('0x4'));var qs=require(_0x97ed('0x5'));var logger=require('../../config/logger')(_0x97ed('0x6'));var interaction_log=require(_0x97ed('0x7'))(_0x97ed('0x8'));var config=require('../../config/environment');var db=require(_0x97ed('0x9'))['db'];config[_0x97ed('0xa')]=_[_0x97ed('0xb')](config[_0x97ed('0xa')],{'host':_0x97ed('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x97ed('0xa')]));require(_0x97ed('0xd'))[_0x97ed('0xe')](socket);var jayson=require(_0x97ed('0xf'));var client=jayson[_0x97ed('0x10')][_0x97ed('0x11')]({'port':0x232c});var client9003=jayson[_0x97ed('0x10')]['http']({'port':0x232b});var client9002=jayson[_0x97ed('0x10')][_0x97ed('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x126db3,_0x1f95ee,_0x4c8832,_0x1d123e){return new BPromise(function(_0x3a4780,_0x275eca){var _0x147ccd=_0x1d123e||client;return _0x147ccd[_0x97ed('0x12')](_0x126db3,_0x4c8832)[_0x97ed('0x13')](function(_0x48ceea){logger['info'](_0x97ed('0x14'),_0x1f95ee,_0x97ed('0x15'));logger['debug'](_0x97ed('0x16'),_0x1f95ee,_0x97ed('0x15'),JSON[_0x97ed('0x17')](_0x48ceea));if(_0x48ceea[_0x97ed('0x18')]){if(_0x48ceea[_0x97ed('0x18')][_0x97ed('0x19')]===0x1f4){logger['error'](_0x97ed('0x14'),_0x1f95ee,_0x48ceea[_0x97ed('0x18')]['message']);return _0x275eca(_0x48ceea[_0x97ed('0x18')][_0x97ed('0x1a')]);}logger[_0x97ed('0x18')](_0x97ed('0x14'),_0x1f95ee,_0x48ceea['error'][_0x97ed('0x1a')]);return _0x3a4780(_0x48ceea[_0x97ed('0x18')][_0x97ed('0x1a')]);}else{logger['info'](_0x97ed('0x14'),_0x1f95ee,_0x97ed('0x15'));_0x3a4780(_0x48ceea[_0x97ed('0x1b')][_0x97ed('0x1a')]);}})['catch'](function(_0x242b37){logger[_0x97ed('0x18')](_0x97ed('0x14'),_0x1f95ee,_0x242b37);_0x275eca(_0x242b37);});});}function respondWithResult(_0x4d6903,_0x281d57){_0x281d57=_0x281d57||0xc8;return function(_0x220bc3){if(_0x220bc3){return _0x4d6903[_0x97ed('0x1c')](_0x281d57)['json'](_0x220bc3);}};}function respondWithFilteredResult(_0x1e3861,_0x2f5e58){return function(_0x5c4ecb){if(_0x5c4ecb){var _0x3a335d=typeof _0x2f5e58['offset']==='undefined'&&typeof _0x2f5e58[_0x97ed('0x1d')]===_0x97ed('0x1e');var _0x46eb5b=_0x5c4ecb[_0x97ed('0x1f')];var _0xac24a7=_0x3a335d?0x0:_0x2f5e58['offset'];var _0x5e18f9=_0x3a335d?_0x5c4ecb['count']:_0x2f5e58[_0x97ed('0x20')]+_0x2f5e58[_0x97ed('0x1d')];var _0x3b8b06;if(_0x5e18f9>=_0x46eb5b){_0x5e18f9=_0x46eb5b;_0x3b8b06=0xc8;}else{_0x3b8b06=0xce;}_0x1e3861[_0x97ed('0x1c')](_0x3b8b06);return _0x1e3861['set'](_0x97ed('0x21'),_0xac24a7+'-'+_0x5e18f9+'/'+_0x46eb5b)['json'](_0x5c4ecb);}return null;};}function saveUpdates(_0x1ea209){return function(_0x21454){if(_0x21454){return _0x21454[_0x97ed('0x22')](_0x1ea209)['then'](function(_0x1334af){return _0x1334af;});}return null;};}function removeEntity(_0x33d3ac){return function(_0x18e404){if(_0x18e404){return _0x18e404[_0x97ed('0x23')]()[_0x97ed('0x13')](function(){_0x33d3ac[_0x97ed('0x1c')](0xcc)[_0x97ed('0x24')]();});}};}function handleEntityNotFound(_0x2fd577){return function(_0x49a545){if(!_0x49a545){_0x2fd577[_0x97ed('0x25')](0x194);}return _0x49a545;};}function handleError(_0x342d88,_0x1e67e7){_0x1e67e7=_0x1e67e7||0x1f4;return function(_0x27636f){logger[_0x97ed('0x18')](_0x27636f[_0x97ed('0x26')]);if(_0x27636f[_0x97ed('0x27')]){delete _0x27636f[_0x97ed('0x27')];}_0x342d88[_0x97ed('0x1c')](_0x1e67e7)[_0x97ed('0x28')](_0x27636f);};}exports[_0x97ed('0x29')]=function(_0x4d744e,_0x208ade){var _0x3d5e31={},_0x3efeb8={},_0x42488e={'count':0x0,'rows':[]};var _0x442391=_['map'](db[_0x97ed('0x2a')]['rawAttributes'],function(_0x40a007){return{'name':_0x40a007[_0x97ed('0x2b')],'type':_0x40a007[_0x97ed('0x2c')][_0x97ed('0x2d')]};});_0x3efeb8[_0x97ed('0x2e')]=_[_0x97ed('0x2f')](_0x442391,_0x97ed('0x27'));_0x3efeb8[_0x97ed('0x30')]=_[_0x97ed('0x31')](_0x4d744e['query']);_0x3efeb8['filters']=_[_0x97ed('0x32')](_0x3efeb8['model'],_0x3efeb8[_0x97ed('0x30')]);_0x3d5e31[_0x97ed('0x33')]=_[_0x97ed('0x32')](_0x3efeb8[_0x97ed('0x2e')],qs[_0x97ed('0x34')](_0x4d744e[_0x97ed('0x30')][_0x97ed('0x34')]));_0x3d5e31['attributes']=_0x3d5e31['attributes'][_0x97ed('0x35')]?_0x3d5e31[_0x97ed('0x33')]:_0x3efeb8[_0x97ed('0x2e')];if(!_0x4d744e[_0x97ed('0x30')][_0x97ed('0x36')]('nolimit')){_0x3d5e31[_0x97ed('0x1d')]=qs[_0x97ed('0x1d')](_0x4d744e['query'][_0x97ed('0x1d')]);_0x3d5e31[_0x97ed('0x20')]=qs[_0x97ed('0x20')](_0x4d744e[_0x97ed('0x30')][_0x97ed('0x20')]);}_0x3d5e31[_0x97ed('0x37')]=qs[_0x97ed('0x38')](_0x4d744e[_0x97ed('0x30')][_0x97ed('0x38')]);_0x3d5e31[_0x97ed('0x39')]=qs[_0x97ed('0x3a')](_['pick'](_0x4d744e[_0x97ed('0x30')],_0x3efeb8[_0x97ed('0x3a')]),_0x442391);if(_0x4d744e[_0x97ed('0x30')][_0x97ed('0x3b')]){_0x3d5e31[_0x97ed('0x39')]=_['merge'](_0x3d5e31[_0x97ed('0x39')],{'$or':_['map'](_0x442391,function(_0x14a405){if(_0x14a405[_0x97ed('0x2c')]!==_0x97ed('0x3c')){var _0x4fba43={};_0x4fba43[_0x14a405[_0x97ed('0x27')]]={'$like':'%'+_0x4d744e[_0x97ed('0x30')][_0x97ed('0x3b')]+'%'};return _0x4fba43;}})});}_0x3d5e31=_[_0x97ed('0x3d')]({},_0x3d5e31,_0x4d744e[_0x97ed('0x3e')]);var _0x5eb509={'where':_0x3d5e31[_0x97ed('0x39')]};return db['MailMessage']['count'](_0x5eb509)[_0x97ed('0x13')](function(_0xe4519f){_0x42488e[_0x97ed('0x1f')]=_0xe4519f;if(_0x4d744e[_0x97ed('0x30')]['includeAll']){_0x3d5e31[_0x97ed('0x3f')]=[{'all':!![]}];}return db[_0x97ed('0x2a')][_0x97ed('0x40')](_0x3d5e31);})[_0x97ed('0x13')](function(_0x46179c){_0x42488e[_0x97ed('0x41')]=_0x46179c;return _0x42488e;})[_0x97ed('0x13')](respondWithFilteredResult(_0x208ade,_0x3d5e31))[_0x97ed('0x42')](handleError(_0x208ade,null));};exports[_0x97ed('0x43')]=function(_0x2575d7,_0x537894){var _0x4fe540={'raw':!![],'where':{'id':_0x2575d7[_0x97ed('0x44')]['id']}},_0x2bc707={};_0x2bc707[_0x97ed('0x2e')]=_[_0x97ed('0x31')](db[_0x97ed('0x2a')][_0x97ed('0x45')]);_0x2bc707[_0x97ed('0x30')]=_[_0x97ed('0x31')](_0x2575d7[_0x97ed('0x30')]);_0x2bc707['filters']=_[_0x97ed('0x32')](_0x2bc707[_0x97ed('0x2e')],_0x2bc707[_0x97ed('0x30')]);_0x4fe540[_0x97ed('0x33')]=_[_0x97ed('0x32')](_0x2bc707[_0x97ed('0x2e')],qs['fields'](_0x2575d7[_0x97ed('0x30')][_0x97ed('0x34')]));_0x4fe540[_0x97ed('0x33')]=_0x4fe540[_0x97ed('0x33')]['length']?_0x4fe540[_0x97ed('0x33')]:_0x2bc707[_0x97ed('0x2e')];if(_0x2575d7['query'][_0x97ed('0x46')]){_0x4fe540[_0x97ed('0x3f')]=[{'all':!![]}];}_0x4fe540=_['merge']({},_0x4fe540,_0x2575d7[_0x97ed('0x3e')]);return db[_0x97ed('0x2a')][_0x97ed('0x47')](_0x4fe540)[_0x97ed('0x13')](handleEntityNotFound(_0x537894,null))[_0x97ed('0x13')](respondWithResult(_0x537894,null))[_0x97ed('0x42')](handleError(_0x537894,null));};exports[_0x97ed('0x22')]=function(_0x55f61e,_0x5bfa38){if(_0x55f61e[_0x97ed('0x48')]['id']){delete _0x55f61e['body']['id'];}return db[_0x97ed('0x2a')][_0x97ed('0x47')]({'where':{'id':_0x55f61e[_0x97ed('0x44')]['id']}})[_0x97ed('0x13')](handleEntityNotFound(_0x5bfa38,null))[_0x97ed('0x13')](saveUpdates(_0x55f61e[_0x97ed('0x48')],null))['then'](respondWithResult(_0x5bfa38,null))[_0x97ed('0x42')](handleError(_0x5bfa38,null));};exports['destroy']=function(_0xa74f14,_0xf3e677){return db['MailMessage']['find']({'where':{'id':_0xa74f14[_0x97ed('0x44')]['id']}})[_0x97ed('0x13')](handleEntityNotFound(_0xf3e677,null))['then'](removeEntity(_0xf3e677,null))[_0x97ed('0x42')](handleError(_0xf3e677,null));};exports[_0x97ed('0x49')]=function(_0x5a7736,_0x3fd0b9){return db['MailMessage'][_0x97ed('0x49')]()[_0x97ed('0x13')](respondWithResult(_0x3fd0b9,null))[_0x97ed('0x42')](handleError(_0x3fd0b9,null));};exports[_0x97ed('0x4a')]=function(_0xfc2777,_0x5c09d8){return db[_0x97ed('0x2a')][_0x97ed('0x4a')](_0xfc2777[_0x97ed('0x48')])[_0x97ed('0x13')](function(_0x2de3ee){if(_0x2de3ee){if(_0x2de3ee[_0x97ed('0x4b')]===_0x97ed('0x4c')&&!_0x2de3ee[_0x97ed('0x4d')]){var _0x5e3055,_0x53590f,_0x36f2bd;if(_0xfc2777[_0x97ed('0x48')]['to']){_0x53590f=_0xfc2777[_0x97ed('0x48')]['to'][_0x97ed('0x4e')](',')[0x0];}return db[_0x97ed('0x4f')][_0x97ed('0x50')]({'where':{'id':_0x2de3ee[_0x97ed('0x51')]},'include':[{'model':db[_0x97ed('0x52')],'as':_0x97ed('0x53'),'include':[{'model':db[_0x97ed('0x54')],'as':_0x97ed('0x55'),'where':{'email':_0x53590f},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x97ed('0x56')],'as':'Smtp','raw':!![]}]})[_0x97ed('0x13')](function(_0x5d8fb0){_0x5e3055=_0x5d8fb0;if(_0x5e3055&&_0x5e3055[_0x97ed('0x57')]){var _0x2481fd={'tls':{'rejectUnauthorized':![]}};if(_[_0x97ed('0x58')](_0x5e3055[_0x97ed('0x57')][_0x97ed('0x59')])){_0x2481fd['host']=_0x5e3055[_0x97ed('0x57')][_0x97ed('0x5a')];_0x2481fd['port']=_0x5e3055[_0x97ed('0x57')][_0x97ed('0x5b')];_0x2481fd[_0x97ed('0x5c')]=_0x5e3055[_0x97ed('0x57')][_0x97ed('0x5c')];if(_0x5e3055[_0x97ed('0x57')]['authentication']){_0x2481fd[_0x97ed('0x5d')]={'user':_0x5e3055[_0x97ed('0x57')]['user'],'pass':_0x5e3055[_0x97ed('0x57')][_0x97ed('0x5e')]};}}else{_0x2481fd[_0x97ed('0x59')]=_0x5e3055[_0x97ed('0x57')][_0x97ed('0x59')];_0x2481fd[_0x97ed('0x5d')]={'user':_0x5e3055[_0x97ed('0x57')][_0x97ed('0x5f')],'pass':_0x5e3055['Smtp'][_0x97ed('0x5e')]};_0x2481fd['secure']=_0x5e3055['Smtp'][_0x97ed('0x5c')];}if(_0xfc2777['body'][_0x97ed('0x60')]&&_0xfc2777[_0x97ed('0x48')][_0x97ed('0x60')]['length']){for(var _0x34d121=0x0;_0x34d121<_0xfc2777[_0x97ed('0x48')]['attachments']['length'];_0x34d121+=0x1){_0xfc2777[_0x97ed('0x48')]['attachments'][_0x34d121]={'filename':_0xfc2777[_0x97ed('0x48')][_0x97ed('0x60')][_0x34d121][_0x97ed('0x27')],'path':path[_0x97ed('0x61')](config[_0x97ed('0x62')],_0x97ed('0x63'),_0xfc2777['body'][_0x97ed('0x60')][_0x34d121][_0x97ed('0x64')])};}}_0x36f2bd={'account':_0x2481fd,'message':_0xfc2777[_0x97ed('0x48')]};return;}})[_0x97ed('0x13')](function(){if(_0x5e3055[_0x97ed('0x53')]){if(_0x5e3055[_0x97ed('0x53')][_0x97ed('0x55')][_0x97ed('0x35')]){return _0x5e3055[_0x97ed('0x53')][_0x97ed('0x55')][0x0];}else{return db['CmContact'][_0x97ed('0x4a')](_['defaults'](_0xfc2777[_0x97ed('0x48')],{'firstName':_0xfc2777['body']['to'],'email':_0xfc2777['body']['to'],'phone':_0xfc2777['body']['to'],'ListId':_0x5e3055['ListId']}));}}else{throw new Error(_0x97ed('0x65'));}})[_0x97ed('0x13')](function(){if(_0x36f2bd){return respondWithRpcPromise(_0x97ed('0x66'),_0x97ed('0x67'),_0x36f2bd,client9003)['then'](function(_0x448c4a){return _0x2de3ee[_0x97ed('0x22')]({'read':!![],'messageId':_0x448c4a[_0x97ed('0x68')],'sentAt':moment()[_0x97ed('0x69')](_0x97ed('0x6a'))});})[_0x97ed('0x42')](function(_0x5704bb){logger[_0x97ed('0x18')]('%s',JSON[_0x97ed('0x17')](_0x5704bb));return _0x2de3ee;});}return _0x2de3ee;});}return _0x2de3ee;}})['then'](respondWithResult(_0x5c09d8,0xc9))[_0x97ed('0x42')](handleError(_0x5c09d8,null));};exports[_0x97ed('0x6b')]=function(_0x3c1b44,_0x2792e9){var _0x2c6250={'agent':{},'channel':_0x97ed('0x6c')};if(_0x3c1b44[_0x97ed('0x48')]['id']){delete _0x3c1b44['body']['id'];}_0x3c1b44[_0x97ed('0x48')][_0x97ed('0x6d')]=!![];_0x3c1b44[_0x97ed('0x48')][_0x97ed('0x6e')]=moment()['format'](_0x97ed('0x6a'));_0x3c1b44[_0x97ed('0x48')]['UserId']=_0x3c1b44[_0x97ed('0x48')]['UserId']||_0x3c1b44[_0x97ed('0x5f')]['id'];_0x2c6250['agent']['id']=_0x3c1b44['body']['UserId'];return db['MailMessage'][_0x97ed('0x47')]({'where':{'id':_0x3c1b44[_0x97ed('0x44')]['id'],'UserId':null}})[_0x97ed('0x13')](handleEntityNotFound(_0x2792e9,null))['then'](saveUpdates(_0x3c1b44[_0x97ed('0x48')],null))[_0x97ed('0x13')](function(_0x7eaeae){if(_0x7eaeae){_0x2c6250[_0x97ed('0x1a')]=_0x7eaeae[_0x97ed('0x6f')]({'plain':!![]});return db[_0x97ed('0x70')][_0x97ed('0x47')]({'where':{'id':_0x7eaeae[_0x97ed('0x71')]}});}return null;})[_0x97ed('0x13')](handleEntityNotFound(_0x2792e9,null))['then'](function(_0x393422){if(_0x393422){return _0x393422[_0x97ed('0x22')]({'UserId':_0x3c1b44[_0x97ed('0x48')][_0x97ed('0x72')],'read1stAt':_[_0x97ed('0x58')](_0x393422[_0x97ed('0x73')])?moment()[_0x97ed('0x69')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x97ed('0x13')](function(_0x52b2cd){if(_0x52b2cd){_0x2c6250['interaction']=_0x52b2cd['get']({'plain':!![]});interaction_log['info'](_0x97ed('0x74'),_0x3c1b44['user']['id'],_0x3c1b44[_0x97ed('0x5f')][_0x97ed('0x27')],_0x3c1b44['user'][_0x97ed('0x75')],_0x2c6250[_0x97ed('0x76')]['id'],_0x3c1b44['body']?JSON[_0x97ed('0x17')](_0x3c1b44[_0x97ed('0x48')]):_0x97ed('0x77'));return respondWithRpcPromise(_0x97ed('0x78'),_0x97ed('0x79'),_0x2c6250);}return null;})['then'](function(_0x1f9320){var _0x4d4713=_0x97ed('0x7a')+_0x1f9320[_0x97ed('0x1a')][_0x97ed('0x7b')];return db[_0x97ed('0x7c')][_0x97ed('0x30')](_0x4d4713,{'type':db[_0x97ed('0x7d')][_0x97ed('0x7e')][_0x97ed('0x7f')],'raw':!![]})[_0x97ed('0x13')](function(_0x248aaf){return _0x248aaf;});})[_0x97ed('0x13')](function(_0x1b7a8e){if(_0x1b7a8e){_0x2c6250[_0x97ed('0x1a')]['contact']=_0x1b7a8e[0x0];if(!_0x3c1b44[_0x97ed('0x48')][_0x97ed('0x72')])return;return db[_0x97ed('0x80')][_0x97ed('0x47')]({'where':{'id':_0x3c1b44[_0x97ed('0x48')][_0x97ed('0x72')],'role':_0x97ed('0x81')},'attributes':['id',_0x97ed('0x27'),_0x97ed('0x82'),_0x97ed('0x83'),_0x97ed('0x84')],'raw':!![]});}return null;})[_0x97ed('0x13')](function(_0x3fd4cf){if(!_0x3fd4cf)return null;_0x2c6250[_0x97ed('0x1a')][_0x97ed('0x81')]=_0x3fd4cf;return _0x2c6250;})[_0x97ed('0x13')](function(_0x31ce4f){if(_0x31ce4f){if(_0x3c1b44[_0x97ed('0x48')][_0x97ed('0x85')]){_0x2c6250[_0x97ed('0x1a')][_0x97ed('0x86')]=util[_0x97ed('0x69')](_0x97ed('0x87'),_0x3c1b44[_0x97ed('0x5f')][_0x97ed('0x27')]);_0x2c6250[_0x97ed('0x1a')][_0x97ed('0x88')]=_0x2c6250[_0x97ed('0x88')];_0x2c6250['message'][_0x97ed('0x89')]=_0x2c6250[_0x97ed('0x88')];_0x2c6250['message'][_0x97ed('0x8a')]=_0x97ed('0x6b');_0x2c6250[_0x97ed('0x1a')][_0x97ed('0x48')]=htmlToText['fromString'](_0x2c6250[_0x97ed('0x1a')][_0x97ed('0x48')]);return respondWithRpcPromise('EventManager',_0x97ed('0x8b'),{'event':_0x97ed('0x8c'),'message':_0x2c6250[_0x97ed('0x1a')]},client9002)['then'](function(){return _0x2c6250;});}return _0x2c6250;}return null;})[_0x97ed('0x13')](respondWithResult(_0x2792e9,null))[_0x97ed('0x42')](handleError(_0x2792e9,null));};exports['reject']=function(_0x240699,_0x1307d1){var _0x5201c7={'agent':{},'channel':'mail'};if(_0x240699[_0x97ed('0x48')]['id']){delete _0x240699[_0x97ed('0x48')]['id'];}_0x240699[_0x97ed('0x48')][_0x97ed('0x72')]=_0x240699[_0x97ed('0x48')]['UserId']||_0x240699['user']['id'];_0x5201c7[_0x97ed('0x81')]['id']=_0x240699[_0x97ed('0x48')][_0x97ed('0x72')];return db[_0x97ed('0x2a')][_0x97ed('0x47')]({'where':{'id':_0x240699[_0x97ed('0x44')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1307d1,null))['then'](function(_0x35e62c){if(_0x35e62c){_0x5201c7[_0x97ed('0x1a')]=_0x35e62c[_0x97ed('0x6f')]({'plain':!![]});return db['MailInteraction'][_0x97ed('0x47')]({'where':{'id':_0x35e62c['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x1307d1,null))[_0x97ed('0x13')](function(_0x5874bf){if(_0x5874bf){_0x5201c7['interaction']=_0x5874bf[_0x97ed('0x6f')]({'plain':!![]});interaction_log[_0x97ed('0x8d')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x240699['user']['id'],_0x240699[_0x97ed('0x5f')][_0x97ed('0x27')],_0x240699[_0x97ed('0x5f')][_0x97ed('0x75')],_0x5201c7[_0x97ed('0x76')]['id'],_0x240699[_0x97ed('0x48')]?JSON[_0x97ed('0x17')](_0x240699[_0x97ed('0x48')]):_0x97ed('0x77'));return respondWithRpcPromise('RejectMessage',_0x97ed('0x8e'),_0x5201c7);}return null;})['then'](function(_0x3c7808){var _0x2dc354=_0x97ed('0x7a')+_0x3c7808[_0x97ed('0x1a')][_0x97ed('0x7b')];return db[_0x97ed('0x7c')]['query'](_0x2dc354,{'type':db['Sequelize']['QueryTypes'][_0x97ed('0x7f')],'raw':!![]})[_0x97ed('0x13')](function(_0x1027ec){return _0x1027ec;});})[_0x97ed('0x13')](function(_0x43d8cd){if(_0x43d8cd){_0x5201c7[_0x97ed('0x1a')][_0x97ed('0x8f')]=_0x43d8cd[0x0];if(!_0x240699[_0x97ed('0x48')]['UserId'])return;return db[_0x97ed('0x80')][_0x97ed('0x47')]({'where':{'id':_0x240699['body'][_0x97ed('0x72')],'role':_0x97ed('0x81')},'attributes':['id',_0x97ed('0x27'),_0x97ed('0x82'),_0x97ed('0x83'),_0x97ed('0x84')],'raw':!![]});}return null;})[_0x97ed('0x13')](function(_0x35576b){if(!_0x35576b)return null;_0x5201c7[_0x97ed('0x1a')][_0x97ed('0x81')]=_0x35576b;return _0x5201c7;})[_0x97ed('0x13')](function(_0xbc8a5f){if(_0xbc8a5f){_0xbc8a5f[_0x97ed('0x1a')]['interface']=util[_0x97ed('0x69')](_0x97ed('0x87'),_0x240699['user']['name']);_0xbc8a5f['message'][_0x97ed('0x88')]=_0x5201c7[_0x97ed('0x88')];_0xbc8a5f['message']['motionChannel']=_0x5201c7[_0x97ed('0x88')];_0xbc8a5f['message']['event']=_0x97ed('0x90');_0xbc8a5f[_0x97ed('0x1a')][_0x97ed('0x48')]=htmlToText[_0x97ed('0x91')](_0x5201c7[_0x97ed('0x1a')][_0x97ed('0x48')]);respondWithRpcPromise(_0x97ed('0x8b'),_0x97ed('0x8b'),{'event':_0x97ed('0x92'),'message':_0xbc8a5f[_0x97ed('0x1a')]},client9002);return _0x5201c7;}return null;})[_0x97ed('0x13')](respondWithResult(_0x1307d1,null))[_0x97ed('0x42')](handleError(_0x1307d1,null));};exports[_0x97ed('0x93')]=function(_0x1ca5ca,_0x5f0979){var _0x1be73d=moment()[_0x97ed('0x94')]()[_0x97ed('0x95')]();var _0x47268e=path['join'](config[_0x97ed('0x62')],_0x97ed('0x96'),_0x97ed('0x97'),_0x97ed('0x98'));var _0x383240=path[_0x97ed('0x61')](config['root'],'server',_0x97ed('0x97'),'attachments');var _0x483b81=util[_0x97ed('0x69')](_0x97ed('0x99'),_0x1be73d);return db[_0x97ed('0x2a')]['find']({'where':{'id':_0x1ca5ca['params']['id']},'attributes':['id',_0x97ed('0x48'),'from','to','cc',_0x97ed('0x9a'),'subject',_0x97ed('0x9b')],'include':_0x1ca5ca[_0x97ed('0x30')]['attachments']?[{'model':db[_0x97ed('0x9c')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x5f0979,null))[_0x97ed('0x13')](function(_0x2374a0){if(_0x2374a0){var _0x1ae1be=_0x2374a0;var _0x110547={'from':_0x1ae1be[_0x97ed('0x9d')],'to':_0x1ae1be['to'],'subject':_0x1ae1be[_0x97ed('0x9e')],'html':_0x1ae1be[_0x97ed('0x48')],'headers':{'Date':moment(_0x1ae1be['createdAt'])['format'](_0x97ed('0x9f'))},'attachments':[]};if(_0x2374a0['cc']){_0x110547[_0x97ed('0xa0')]['Cc']=_0x2374a0['cc'];}if(_0x2374a0['bcc']){_0x110547[_0x97ed('0xa0')][_0x97ed('0xa1')]=_0x2374a0['bcc'];}return new BPromise(function(_0x392694,_0x28b68d){if(_0x2374a0[_0x97ed('0xa2')]){for(var _0x180ae1=0x0;_0x180ae1<_0x2374a0[_0x97ed('0xa2')][_0x97ed('0x35')];_0x180ae1++){var _0x1dbe7e=_0x2374a0[_0x97ed('0xa2')][_0x180ae1];var _0x436920=path[_0x97ed('0x61')](_0x383240,_0x1dbe7e[_0x97ed('0x64')]);if(fs[_0x97ed('0xa3')](_0x436920)){_0x110547[_0x97ed('0x60')][_0x97ed('0xa4')]({'name':_0x1dbe7e[_0x97ed('0x27')],'contentType':_0x1dbe7e[_0x97ed('0x2c')],'data':fs[_0x97ed('0xa5')](_0x436920)});}}}emlformat['build'](_0x110547,function(_0x3b8d7f,_0x50857a){if(_0x3b8d7f)return _0x28b68d(_0x3b8d7f);fs[_0x97ed('0xa6')](path[_0x97ed('0x61')](_0x47268e,_0x483b81),_0x50857a);return _0x392694(_0x50857a);});});}})['then'](function(_0x19a847){if(_0x19a847){return _0x5f0979[_0x97ed('0x93')](path['join'](_0x47268e,_0x483b81),_0x483b81,function(_0x4b7350){if(!_0x4b7350)fs[_0x97ed('0xa7')](path[_0x97ed('0x61')](_0x47268e,_0x483b81));});}})[_0x97ed('0x42')](handleError(_0x5f0979,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 81b3126..e63049f 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 _0x329c=['update','remove','emit','hasOwnProperty','exports','events','MailMessage','setMaxListeners'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x329c,0x9d));var _0xc329=function(_0x39e164,_0x2cb93b){_0x39e164=_0x39e164-0x0;var _0x13fa6b=_0x329c[_0x39e164];return _0x13fa6b;};'use strict';var EventEmitter=require(_0xc329('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xc329('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xc329('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc329('0x3'),'afterDestroy':_0xc329('0x4')};function emitEvent(_0x1bab1e){return function(_0x54b61c,_0x166b61,_0x2800bd){MailMessageEvents[_0xc329('0x5')](_0x1bab1e+':'+_0x54b61c['id'],_0x54b61c);MailMessageEvents[_0xc329('0x5')](_0x1bab1e,_0x54b61c);_0x2800bd(null);};}for(var e in events){if(events[_0xc329('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xc329('0x7')]=MailMessageEvents; \ No newline at end of file +var _0xa8ef=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','remove'];(function(_0x3553b2,_0x18ff06){var _0xd23346=function(_0x218098){while(--_0x218098){_0x3553b2['push'](_0x3553b2['shift']());}};_0xd23346(++_0x18ff06);}(_0xa8ef,0x9d));var _0xfa8e=function(_0xf36d2b,_0x27f4fd){_0xf36d2b=_0xf36d2b-0x0;var _0x2b8fc9=_0xa8ef[_0xf36d2b];return _0x2b8fc9;};'use strict';var EventEmitter=require(_0xfa8e('0x0'));var MailMessage=require(_0xfa8e('0x1'))['db'][_0xfa8e('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xfa8e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfa8e('0x4')};function emitEvent(_0x16f868){return function(_0x15bdca,_0x369184,_0x5850b8){MailMessageEvents[_0xfa8e('0x5')](_0x16f868+':'+_0x15bdca['id'],_0x15bdca);MailMessageEvents[_0xfa8e('0x5')](_0x16f868,_0x15bdca);_0x5850b8(null);};}for(var e in events){if(events[_0xfa8e('0x6')](e)){var event=events[e];MailMessage[_0xfa8e('0x7')](e,emitEvent(event));}}module[_0xfa8e('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 b02f7fe..02094be 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 _0xffc2=['path','../../config/environment','./mailMessage.attributes','exports','define','messageId','fti_mail_messages','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','MailInteractionId','then','update','createdAt','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xffc2,0x1b2));var _0x2ffc=function(_0x590a3a,_0xd9db9){_0x590a3a=_0x590a3a-0x0;var _0x49017f=_0xffc2[_0x590a3a];return _0x49017f;};'use strict';var _=require(_0x2ffc('0x0'));var util=require(_0x2ffc('0x1'));var logger=require(_0x2ffc('0x2'))(_0x2ffc('0x3'));var moment=require(_0x2ffc('0x4'));var BPromise=require(_0x2ffc('0x5'));var rp=require(_0x2ffc('0x6'));var htmlToText=require(_0x2ffc('0x7'));var fs=require('fs');var path=require(_0x2ffc('0x8'));var rimraf=require('rimraf');var config=require(_0x2ffc('0x9'));var attributes=require(_0x2ffc('0xa'));module[_0x2ffc('0xb')]=function(_0x442dfc,_0x25c876){return _0x442dfc[_0x2ffc('0xc')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x2ffc('0xd'),'fields':['messageId']},{'name':_0x2ffc('0xe'),'fields':['plainBody',_0x2ffc('0xf')],'type':_0x2ffc('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x446121,_0x514d8d,_0x1d1c03){if(_0x446121[_0x2ffc('0x11')]){_0x446121['plainBody']=htmlToText[_0x2ffc('0x12')](_0x446121[_0x2ffc('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1d1c03(null,_0x514d8d);},'afterCreate':function(_0x49c573,_0x5affb0,_0x2c062d){var _0x1cc490=_0x442dfc[_0x2ffc('0x13')];var _0x42a8d8=_0x49c573[_0x2ffc('0x14')]({'plain':!![]});if(_0x42a8d8[_0x2ffc('0x15')]['toLowerCase']()==='in'||_0x42a8d8[_0x2ffc('0x15')][_0x2ffc('0x16')]()===_0x2ffc('0x17')&&!_0x42a8d8[_0x2ffc('0x18')]&&!_[_0x2ffc('0x19')](_0x42a8d8[_0x2ffc('0x1a')])){_0x1cc490['MailInteraction'][_0x2ffc('0x1b')]({'where':{'id':_0x42a8d8[_0x2ffc('0x1c')]}})[_0x2ffc('0x1d')](function(_0x1e3776){if(_0x1e3776){_0x1e3776[_0x2ffc('0x1e')]({'lastMsgAt':_0x42a8d8[_0x2ffc('0x1f')],'lastMsgDirection':_0x42a8d8['direction']['toLowerCase']()});}})[_0x2ffc('0x20')](function(_0xad4883){console['error'](_0xad4883);});}_0x2c062d();}},'charset':'utf8mb4','collate':_0x2ffc('0x21')});}; \ No newline at end of file +var _0x8af1=['MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','body','fromString','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x3fb560,_0x1e301f){var _0x4999b3=function(_0x4ad22e){while(--_0x4ad22e){_0x3fb560['push'](_0x3fb560['shift']());}};_0x4999b3(++_0x1e301f);}(_0x8af1,0x91));var _0x18af=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x8af1[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0x18af('0x0'));var util=require(_0x18af('0x1'));var logger=require(_0x18af('0x2'))(_0x18af('0x3'));var moment=require('moment');var BPromise=require(_0x18af('0x4'));var rp=require('request-promise');var htmlToText=require(_0x18af('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18af('0x6'));var config=require(_0x18af('0x7'));var attributes=require(_0x18af('0x8'));module[_0x18af('0x9')]=function(_0x276a56,_0xdef507){return _0x276a56[_0x18af('0xa')](_0x18af('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x18af('0xc')]},{'name':_0x18af('0xd'),'fields':[_0x18af('0xe'),_0x18af('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x9881,_0x12a60d,_0x2180b6){if(_0x9881[_0x18af('0x10')]){_0x9881[_0x18af('0xe')]=htmlToText[_0x18af('0x11')](_0x9881[_0x18af('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2180b6(null,_0x12a60d);},'afterCreate':function(_0x28a44b,_0x549473,_0x2dcfa1){var _0x13d864=_0x276a56[_0x18af('0x12')];var _0x26cfc3=_0x28a44b[_0x18af('0x13')]({'plain':!![]});if(_0x26cfc3['direction']['toLowerCase']()==='in'||_0x26cfc3[_0x18af('0x14')][_0x18af('0x15')]()===_0x18af('0x16')&&!_0x26cfc3[_0x18af('0x17')]&&!_[_0x18af('0x18')](_0x26cfc3['UserId'])){_0x13d864[_0x18af('0x19')][_0x18af('0x1a')]({'where':{'id':_0x26cfc3['MailInteractionId']}})[_0x18af('0x1b')](function(_0x1ce31e){if(_0x1ce31e){_0x1ce31e[_0x18af('0x1c')]({'lastMsgAt':_0x26cfc3[_0x18af('0x1d')],'lastMsgDirection':_0x26cfc3['direction'][_0x18af('0x15')]()});}})[_0x18af('0x1e')](function(_0x1c43e8){console[_0x18af('0x1f')](_0x1c43e8);});}_0x2dcfa1();}},'charset':_0x18af('0x20'),'collate':_0x18af('0x21')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index bf65f8b..c1bc5fc 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 _0x8aad=['raw','catch','lodash','util','bluebird','ioredis','../../mysqldb','rpc','client','http','redis','localhost','socket.io-emitter','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateMailMessage','MailMessage','create','options'];(function(_0x296e71,_0x500b29){var _0x15ccc0=function(_0x23d34b){while(--_0x23d34b){_0x296e71['push'](_0x296e71['shift']());}};_0x15ccc0(++_0x500b29);}(_0x8aad,0x146));var _0xd8aa=function(_0x553303,_0x4135c5){_0x553303=_0x553303-0x0;var _0x3669a5=_0x8aad[_0x553303];return _0x3669a5;};'use strict';var _=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var moment=require('moment');var BPromise=require(_0xd8aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd8aa('0x3'));var db=require(_0xd8aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd8aa('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8aa('0x6')][_0xd8aa('0x7')]({'port':0x232a});config[_0xd8aa('0x8')]=_['defaults'](config[_0xd8aa('0x8')],{'host':_0xd8aa('0x9'),'port':0x18eb});var socket=require(_0xd8aa('0xa'))(new Redis(config[_0xd8aa('0x8')]));require('./mailMessage.socket')['register'](socket);function respondWithRpcPromise(_0x24f3f1,_0x1d4cf6,_0x152c0a){return new BPromise(function(_0x228fda,_0x2c7edb){return client['request'](_0x24f3f1,_0x152c0a)[_0xd8aa('0xb')](function(_0x1619c6){logger[_0xd8aa('0xc')](_0xd8aa('0xd'),_0x1d4cf6,_0xd8aa('0xe'));logger[_0xd8aa('0xf')](_0xd8aa('0x10'),_0x1d4cf6,_0xd8aa('0xe'),JSON[_0xd8aa('0x11')](_0x1619c6));if(_0x1619c6[_0xd8aa('0x12')]){if(_0x1619c6['error']['code']===0x1f4){logger[_0xd8aa('0x12')](_0xd8aa('0xd'),_0x1d4cf6,_0x1619c6[_0xd8aa('0x12')]['message']);return _0x2c7edb(_0x1619c6[_0xd8aa('0x12')][_0xd8aa('0x13')]);}logger[_0xd8aa('0x12')](_0xd8aa('0xd'),_0x1d4cf6,_0x1619c6['error'][_0xd8aa('0x13')]);return _0x228fda(_0x1619c6[_0xd8aa('0x12')]['message']);}else{logger[_0xd8aa('0xc')](_0xd8aa('0xd'),_0x1d4cf6,_0xd8aa('0xe'));_0x228fda(_0x1619c6[_0xd8aa('0x14')][_0xd8aa('0x13')]);}})['catch'](function(_0x43d3fa){logger[_0xd8aa('0x12')](_0xd8aa('0xd'),_0x1d4cf6,_0x43d3fa);_0x2c7edb(_0x43d3fa);});});}exports[_0xd8aa('0x15')]=function(_0x56936b){var _0x411b12=this;return new Promise(function(_0x3df281,_0x46d69b){return db[_0xd8aa('0x16')][_0xd8aa('0x17')](_0x56936b['body'],{'raw':_0x56936b[_0xd8aa('0x18')]?_0x56936b[_0xd8aa('0x18')][_0xd8aa('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xa7cf85){logger[_0xd8aa('0xc')](_0xd8aa('0x15'),_0x56936b);logger[_0xd8aa('0xf')](_0xd8aa('0x15'),_0x56936b,JSON[_0xd8aa('0x11')](_0xa7cf85));_0x3df281(_0xa7cf85);})[_0xd8aa('0x1a')](function(_0x34d957){logger[_0xd8aa('0x12')](_0xd8aa('0x15'),_0x34d957[_0xd8aa('0x13')],_0x56936b);_0x46d69b(_0x411b12[_0xd8aa('0x12')](0x1f4,_0x34d957[_0xd8aa('0x13')]));});});}; \ No newline at end of file +var _0x0120=['then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','body','options','raw','CreateMailMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0120,0x6f));var _0x0012=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0120[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0012('0x0'));var util=require(_0x0012('0x1'));var moment=require(_0x0012('0x2'));var BPromise=require(_0x0012('0x3'));var rs=require(_0x0012('0x4'));var fs=require('fs');var Redis=require(_0x0012('0x5'));var db=require(_0x0012('0x6'))['db'];var utils=require(_0x0012('0x7'));var logger=require(_0x0012('0x8'))(_0x0012('0x9'));var config=require(_0x0012('0xa'));var jayson=require(_0x0012('0xb'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x0012('0xc')](config[_0x0012('0xd')],{'host':_0x0012('0xe'),'port':0x18eb});var socket=require(_0x0012('0xf'))(new Redis(config[_0x0012('0xd')]));require('./mailMessage.socket')[_0x0012('0x10')](socket);function respondWithRpcPromise(_0x2d484c,_0x1dc1b2,_0x323282){return new BPromise(function(_0x520171,_0x2d4674){return client['request'](_0x2d484c,_0x323282)[_0x0012('0x11')](function(_0x1d1c02){logger[_0x0012('0x12')](_0x0012('0x13'),_0x1dc1b2,_0x0012('0x14'));logger['debug'](_0x0012('0x15'),_0x1dc1b2,'request\x20sent',JSON['stringify'](_0x1d1c02));if(_0x1d1c02['error']){if(_0x1d1c02['error'][_0x0012('0x16')]===0x1f4){logger['error'](_0x0012('0x13'),_0x1dc1b2,_0x1d1c02[_0x0012('0x17')]['message']);return _0x2d4674(_0x1d1c02[_0x0012('0x17')][_0x0012('0x18')]);}logger[_0x0012('0x17')](_0x0012('0x13'),_0x1dc1b2,_0x1d1c02['error']['message']);return _0x520171(_0x1d1c02[_0x0012('0x17')][_0x0012('0x18')]);}else{logger[_0x0012('0x12')](_0x0012('0x13'),_0x1dc1b2,_0x0012('0x14'));_0x520171(_0x1d1c02[_0x0012('0x19')][_0x0012('0x18')]);}})[_0x0012('0x1a')](function(_0x5b236f){logger[_0x0012('0x17')](_0x0012('0x13'),_0x1dc1b2,_0x5b236f);_0x2d4674(_0x5b236f);});});}exports['CreateMailMessage']=function(_0x45d00b){var _0x1f54fc=this;return new Promise(function(_0xa2e623,_0x2c837e){return db['MailMessage']['create'](_0x45d00b[_0x0012('0x1b')],{'raw':_0x45d00b[_0x0012('0x1c')]?_0x45d00b[_0x0012('0x1c')][_0x0012('0x1d')]===undefined?!![]:![]:!![]})[_0x0012('0x11')](function(_0x2e6a2c){logger[_0x0012('0x12')](_0x0012('0x1e'),_0x45d00b);logger['debug'](_0x0012('0x1e'),_0x45d00b,JSON[_0x0012('0x1f')](_0x2e6a2c));_0xa2e623(_0x2e6a2c);})['catch'](function(_0x36cf42){logger[_0x0012('0x17')](_0x0012('0x1e'),_0x36cf42[_0x0012('0x18')],_0x45d00b);_0x2c837e(_0x1f54fc[_0x0012('0x17')](0x1f4,_0x36cf42['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 00bcff5..33e8f70 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 _0x60ac=['mailMessage:','save','remove','update','emit','removeListener','register'];(function(_0x1fc3ca,_0x2b1de7){var _0xc5b490=function(_0x370bd1){while(--_0x370bd1){_0x1fc3ca['push'](_0x1fc3ca['shift']());}};_0xc5b490(++_0x2b1de7);}(_0x60ac,0xa2));var _0xc60a=function(_0x381e1d,_0x3afa2c){_0x381e1d=_0x381e1d-0x0;var _0x5f6a52=_0x60ac[_0x381e1d];return _0x5f6a52;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xc60a('0x0'),_0xc60a('0x1'),_0xc60a('0x2')];function createListener(_0x54a14c,_0x2166af){return function(_0x48a5cd){_0x2166af[_0xc60a('0x3')](_0x54a14c,_0x48a5cd);};}function removeListener(_0x3cd9db,_0x4bb263){return function(){MailMessageEvents[_0xc60a('0x4')](_0x3cd9db,_0x4bb263);};}exports[_0xc60a('0x5')]=function(_0x23f813){for(var _0x1e88ec=0x0,_0x1cf7cf=events['length'];_0x1e88ec<_0x1cf7cf;_0x1e88ec++){var _0x497391=events[_0x1e88ec];var _0x346d5d=createListener(_0xc60a('0x6')+_0x497391,_0x23f813);MailMessageEvents['on'](_0x497391,_0x346d5d);}}; \ No newline at end of file +var _0xc3b8=['./mailMessage.events','save','remove','update','register','length','mailMessage:'];(function(_0x4b4b0e,_0x6c674){var _0x4c2d91=function(_0x4d440d){while(--_0x4d440d){_0x4b4b0e['push'](_0x4b4b0e['shift']());}};_0x4c2d91(++_0x6c674);}(_0xc3b8,0x118));var _0x8c3b=function(_0x21a67f,_0xe46876){_0x21a67f=_0x21a67f-0x0;var _0x19a15c=_0xc3b8[_0x21a67f];return _0x19a15c;};'use strict';var MailMessageEvents=require(_0x8c3b('0x0'));var events=[_0x8c3b('0x1'),_0x8c3b('0x2'),_0x8c3b('0x3')];function createListener(_0xc40ccc,_0x10e440){return function(_0x38b361){_0x10e440['emit'](_0xc40ccc,_0x38b361);};}function removeListener(_0x3e8e20,_0xd67419){return function(){MailMessageEvents['removeListener'](_0x3e8e20,_0xd67419);};}exports[_0x8c3b('0x4')]=function(_0x22c949){for(var _0x4316fc=0x0,_0x1f2efe=events[_0x8c3b('0x5')];_0x4316fc<_0x1f2efe;_0x4316fc++){var _0x434ca4=events[_0x4316fc];var _0x2d488e=createListener(_0x8c3b('0x6')+_0x434ca4,_0x22c949);MailMessageEvents['on'](_0x434ca4,_0x2d488e);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index ce60a3c..ec614fe 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 _0xbbbe=['getMembers','/:id/teams','getTeams','get','post','create','/:id/users','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','describe','show','/:id/members'];(function(_0x4efc43,_0x438b37){var _0x139e2f=function(_0x30ef16){while(--_0x30ef16){_0x4efc43['push'](_0x4efc43['shift']());}};_0x139e2f(++_0x438b37);}(_0xbbbe,0x132));var _0xebbb=function(_0x3de336,_0x2bab7f){_0x3de336=_0x3de336-0x0;var _0x1ae0bd=_0xbbbe[_0x3de336];return _0x1ae0bd;};'use strict';var multer=require(_0xebbb('0x0'));var util=require(_0xebbb('0x1'));var path=require(_0xebbb('0x2'));var timeout=require(_0xebbb('0x3'));var express=require('express');var router=express[_0xebbb('0x4')]();var fs_extra=require(_0xebbb('0x5'));var auth=require(_0xebbb('0x6'));var interaction=require(_0xebbb('0x7'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router['get']('/',auth[_0xebbb('0x8')](),controller[_0xebbb('0x9')]);router['get']('/describe',auth[_0xebbb('0x8')](),controller[_0xebbb('0xa')]);router['get']('/:id',auth[_0xebbb('0x8')](),controller[_0xebbb('0xb')]);router['get'](_0xebbb('0xc'),auth[_0xebbb('0x8')](),controller[_0xebbb('0xd')]);router['get'](_0xebbb('0xe'),auth[_0xebbb('0x8')](),controller[_0xebbb('0xf')]);router[_0xebbb('0x10')]('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0xebbb('0x11')]('/',auth['isAuthenticated'](),controller[_0xebbb('0x12')]);router[_0xebbb('0x11')]('/:id/teams',auth[_0xebbb('0x8')](),controller['addTeams']);router[_0xebbb('0x11')](_0xebbb('0x13'),auth[_0xebbb('0x8')](),controller[_0xebbb('0x14')]);router[_0xebbb('0x15')](_0xebbb('0x16'),auth[_0xebbb('0x8')](),controller[_0xebbb('0x17')]);router[_0xebbb('0x18')](_0xebbb('0x16'),auth[_0xebbb('0x8')](),controller[_0xebbb('0x19')]);router[_0xebbb('0x18')](_0xebbb('0xe'),auth[_0xebbb('0x8')](),controller[_0xebbb('0x1a')]);router[_0xebbb('0x18')](_0xebbb('0x13'),auth[_0xebbb('0x8')](),controller[_0xebbb('0x1b')]);module[_0xebbb('0x1c')]=router; \ No newline at end of file +var _0x8d1c=['isAuthenticated','/describe','describe','/:id','show','/:id/teams','getTeams','post','addTeams','/:id/users','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get'];(function(_0x24a73b,_0x3b35ff){var _0x54eb91=function(_0x1ae1a7){while(--_0x1ae1a7){_0x24a73b['push'](_0x24a73b['shift']());}};_0x54eb91(++_0x3b35ff);}(_0x8d1c,0xf2));var _0xc8d1=function(_0x37352d,_0x28c3ba){_0x37352d=_0x37352d-0x0;var _0x14ba30=_0x8d1c[_0x37352d];return _0x14ba30;};'use strict';var multer=require('multer');var util=require(_0xc8d1('0x0'));var path=require(_0xc8d1('0x1'));var timeout=require(_0xc8d1('0x2'));var express=require(_0xc8d1('0x3'));var router=express[_0xc8d1('0x4')]();var fs_extra=require(_0xc8d1('0x5'));var auth=require(_0xc8d1('0x6'));var interaction=require(_0xc8d1('0x7'));var config=require('../../config/environment');var controller=require(_0xc8d1('0x8'));router[_0xc8d1('0x9')]('/',auth[_0xc8d1('0xa')](),controller['index']);router[_0xc8d1('0x9')](_0xc8d1('0xb'),auth[_0xc8d1('0xa')](),controller[_0xc8d1('0xc')]);router[_0xc8d1('0x9')](_0xc8d1('0xd'),auth[_0xc8d1('0xa')](),controller[_0xc8d1('0xe')]);router[_0xc8d1('0x9')]('/:id/members',auth[_0xc8d1('0xa')](),controller['getMembers']);router['get'](_0xc8d1('0xf'),auth[_0xc8d1('0xa')](),controller[_0xc8d1('0x10')]);router[_0xc8d1('0x9')]('/:id/users',auth[_0xc8d1('0xa')](),controller['getAgents']);router[_0xc8d1('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc8d1('0x11')](_0xc8d1('0xf'),auth[_0xc8d1('0xa')](),controller[_0xc8d1('0x12')]);router[_0xc8d1('0x11')](_0xc8d1('0x13'),auth[_0xc8d1('0xa')](),controller[_0xc8d1('0x14')]);router[_0xc8d1('0x15')](_0xc8d1('0xd'),auth[_0xc8d1('0xa')](),controller[_0xc8d1('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc8d1('0x17')]);router[_0xc8d1('0x18')]('/:id/teams',auth[_0xc8d1('0xa')](),controller[_0xc8d1('0x19')]);router[_0xc8d1('0x18')](_0xc8d1('0x13'),auth[_0xc8d1('0xa')](),controller[_0xc8d1('0x1a')]);module[_0xc8d1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index aae3334..97c1d33 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 _0xd812=['roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xd812,0xf6));var _0x2d81=function(_0x44039a,_0x2ac8a8){_0x44039a=_0x44039a-0x0;var _0x525de5=_0xd812[_0x44039a];return _0x525de5;};'use strict';var Sequelize=require(_0x2d81('0x0'));module[_0x2d81('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2d81('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2d81('0x3')]},'timeout':{'type':Sequelize[_0x2d81('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2d81('0x5')]('rrmemory','beepall',_0x2d81('0x6'))}}; \ No newline at end of file +var _0x8a8e=['exports','STRING','rrmemory','beepall','roundrobin','sequelize'];(function(_0xa30766,_0x6f613e){var _0x24e780=function(_0x3d58fb){while(--_0x3d58fb){_0xa30766['push'](_0xa30766['shift']());}};_0x24e780(++_0x6f613e);}(_0x8a8e,0x1d3));var _0xe8a8=function(_0x329421,_0x414a49){_0x329421=_0x329421-0x0;var _0x5b31e8=_0x8a8e[_0x329421];return _0x5b31e8;};'use strict';var Sequelize=require(_0xe8a8('0x0'));module[_0xe8a8('0x1')]={'name':{'type':Sequelize[_0xe8a8('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe8a8('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe8a8('0x3'),_0xe8a8('0x4'),_0xe8a8('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index d85cb42..c468414 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 _0x1502=['toString','QueryTypes','SELECT','every','includes','all','union','compact','transaction','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','MailQueues','destroy','error','stack','name','send','index','map','MailQueue','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','rows','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserMailQueue','limit','MailQueueId','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','nolimit','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','forEach','emit','userMailQueue:save','removeTeams','select','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push'];(function(_0x1bb704,_0x2b9bac){var _0x128c93=function(_0x3e3ba3){while(--_0x3e3ba3){_0x1bb704['push'](_0x1bb704['shift']());}};_0x128c93(++_0x2b9bac);}(_0x1502,0x1c3));var _0x2150=function(_0x45d57e,_0x486090){_0x45d57e=_0x45d57e-0x0;var _0x5c7271=_0x1502[_0x45d57e];return _0x5c7271;};'use strict';var emlformat=require(_0x2150('0x0'));var rimraf=require(_0x2150('0x1'));var zipdir=require(_0x2150('0x2'));var jsonpatch=require(_0x2150('0x3'));var rp=require(_0x2150('0x4'));var moment=require(_0x2150('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2150('0x6'));var util=require(_0x2150('0x7'));var path=require(_0x2150('0x8'));var sox=require(_0x2150('0x9'));var csv=require('to-csv');var ejs=require(_0x2150('0xa'));var fs=require('fs');var fs_extra=require(_0x2150('0xb'));var _=require('lodash');var squel=require(_0x2150('0xc'));var crypto=require(_0x2150('0xd'));var jsforce=require(_0x2150('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2150('0xf'));var querystring=require(_0x2150('0x10'));var Papa=require(_0x2150('0x11'));var Redis=require('ioredis');var authService=require(_0x2150('0x12'));var qs=require(_0x2150('0x13'));var as=require(_0x2150('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2150('0x15'))(_0x2150('0x16'));var utils=require(_0x2150('0x17'));var config=require(_0x2150('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x2150('0x19')]=_[_0x2150('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2150('0x1b'))(new Redis(config[_0x2150('0x19')]));require(_0x2150('0x1c'))['register'](socket);function respondWithStatusCode(_0x5d959e,_0x1b019e){_0x1b019e=_0x1b019e||0xcc;return function(_0x36e0fa){if(_0x36e0fa){return _0x5d959e[_0x2150('0x1d')](_0x1b019e);}return _0x5d959e[_0x2150('0x1e')](_0x1b019e)[_0x2150('0x1f')]();};}function respondWithResult(_0x3543a1,_0x363636){_0x363636=_0x363636||0xc8;return function(_0x3f8a72){if(_0x3f8a72){return _0x3543a1[_0x2150('0x1e')](_0x363636)[_0x2150('0x20')](_0x3f8a72);}};}function respondWithFilteredResult(_0x22effb,_0x92d79d){return function(_0x2295f6){if(_0x2295f6){var _0x42f3d1=typeof _0x92d79d[_0x2150('0x21')]===_0x2150('0x22')&&typeof _0x92d79d['limit']==='undefined';var _0x2b301b=_0x2295f6[_0x2150('0x23')];var _0x2f5db1=_0x42f3d1?0x0:_0x92d79d[_0x2150('0x21')];var _0x53a3b9=_0x42f3d1?_0x2295f6['count']:_0x92d79d[_0x2150('0x21')]+_0x92d79d['limit'];var _0xf5d6f5;if(_0x53a3b9>=_0x2b301b){_0x53a3b9=_0x2b301b;_0xf5d6f5=0xc8;}else{_0xf5d6f5=0xce;}_0x22effb[_0x2150('0x1e')](_0xf5d6f5);return _0x22effb[_0x2150('0x24')](_0x2150('0x25'),_0x2f5db1+'-'+_0x53a3b9+'/'+_0x2b301b)[_0x2150('0x20')](_0x2295f6);}return null;};}function patchUpdates(_0x4afe8c){return function(_0x46c9fc){try{jsonpatch[_0x2150('0x26')](_0x46c9fc,_0x4afe8c,!![]);}catch(_0x57ba9f){return BPromise['reject'](_0x57ba9f);}return _0x46c9fc[_0x2150('0x27')]();};}function saveUpdates(_0x26958e,_0x3d78f7){return function(_0x40bf21){if(_0x40bf21){return _0x40bf21[_0x2150('0x28')](_0x26958e)[_0x2150('0x29')](function(_0x164ba8){return _0x164ba8;});}return null;};}function removeEntity(_0x4b4400,_0x1915f6){return function(_0x5efb98){if(_0x5efb98){return _0x5efb98['destroy']()[_0x2150('0x29')](function(){var _0x399d79=_0x5efb98['get']({'plain':!![]});var _0x4df670=_0x2150('0x2a');return db['UserProfileResource'][_0x2150('0x2b')]({'where':{'type':_0x4df670,'resourceId':_0x399d79['id']}})[_0x2150('0x29')](function(){return _0x5efb98;});})[_0x2150('0x29')](function(){_0x4b4400[_0x2150('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x394c43,_0x5f43ba){return function(_0x1b1d6a){if(!_0x1b1d6a){_0x394c43['sendStatus'](0x194);}return _0x1b1d6a;};}function handleError(_0x2e4d2f,_0x299c57){_0x299c57=_0x299c57||0x1f4;return function(_0x1f997a){logger[_0x2150('0x2c')](_0x1f997a[_0x2150('0x2d')]);if(_0x1f997a[_0x2150('0x2e')]){delete _0x1f997a[_0x2150('0x2e')];}_0x2e4d2f[_0x2150('0x1e')](_0x299c57)[_0x2150('0x2f')](_0x1f997a);};}exports[_0x2150('0x30')]=function(_0x332ac0,_0x2172ad){var _0x1ee730={},_0x581b65={},_0x37a84c={'count':0x0,'rows':[]};var _0x226799=_[_0x2150('0x31')](db[_0x2150('0x32')][_0x2150('0x33')],function(_0x15ae7c){return{'name':_0x15ae7c['fieldName'],'type':_0x15ae7c['type'][_0x2150('0x34')]};});_0x581b65[_0x2150('0x35')]=_[_0x2150('0x31')](_0x226799,'name');_0x581b65[_0x2150('0x36')]=_[_0x2150('0x37')](_0x332ac0[_0x2150('0x36')]);_0x581b65['filters']=_['intersection'](_0x581b65[_0x2150('0x35')],_0x581b65[_0x2150('0x36')]);_0x1ee730[_0x2150('0x38')]=_[_0x2150('0x39')](_0x581b65[_0x2150('0x35')],qs[_0x2150('0x3a')](_0x332ac0[_0x2150('0x36')][_0x2150('0x3a')]));_0x1ee730[_0x2150('0x38')]=_0x1ee730[_0x2150('0x38')][_0x2150('0x3b')]?_0x1ee730[_0x2150('0x38')]:_0x581b65[_0x2150('0x35')];if(!_0x332ac0[_0x2150('0x36')][_0x2150('0x3c')]('nolimit')){_0x1ee730['limit']=qs['limit'](_0x332ac0[_0x2150('0x36')]['limit']);_0x1ee730[_0x2150('0x21')]=qs['offset'](_0x332ac0['query'][_0x2150('0x21')]);}_0x1ee730[_0x2150('0x3d')]=qs[_0x2150('0x3e')](_0x332ac0[_0x2150('0x36')][_0x2150('0x3e')]);_0x1ee730['where']=qs[_0x2150('0x3f')](_[_0x2150('0x40')](_0x332ac0[_0x2150('0x36')],_0x581b65['filters']),_0x226799);if(_0x332ac0['query']['filter']){_0x1ee730[_0x2150('0x41')]=_[_0x2150('0x42')](_0x1ee730['where'],{'$or':_[_0x2150('0x31')](_0x226799,function(_0x19fa7d){if(_0x19fa7d['type']!==_0x2150('0x43')){var _0x5a4f50={};_0x5a4f50[_0x19fa7d[_0x2150('0x2e')]]={'$like':'%'+_0x332ac0['query'][_0x2150('0x44')]+'%'};return _0x5a4f50;}})});}_0x1ee730=_[_0x2150('0x42')]({},_0x1ee730,_0x332ac0[_0x2150('0x45')]);var _0x13edb7={'where':_0x1ee730[_0x2150('0x41')]};return db[_0x2150('0x32')][_0x2150('0x23')](_0x13edb7)[_0x2150('0x29')](function(_0x4cf8c9){_0x37a84c[_0x2150('0x23')]=_0x4cf8c9;if(_0x332ac0[_0x2150('0x36')][_0x2150('0x46')]){_0x1ee730[_0x2150('0x47')]=[{'all':!![]}];}return db[_0x2150('0x32')]['findAll'](_0x1ee730);})['then'](function(_0x494441){_0x37a84c[_0x2150('0x48')]=_0x494441;return _0x37a84c;})[_0x2150('0x29')](respondWithFilteredResult(_0x2172ad,_0x1ee730))['catch'](handleError(_0x2172ad,null));};exports['show']=function(_0x477010,_0x369eb3){var _0x57d7de={'raw':!![],'where':{'id':_0x477010[_0x2150('0x49')]['id']}},_0x19d601={};_0x19d601[_0x2150('0x35')]=_[_0x2150('0x37')](db['MailQueue']['rawAttributes']);_0x19d601[_0x2150('0x36')]=_[_0x2150('0x37')](_0x477010[_0x2150('0x36')]);_0x19d601[_0x2150('0x3f')]=_['intersection'](_0x19d601[_0x2150('0x35')],_0x19d601[_0x2150('0x36')]);_0x57d7de[_0x2150('0x38')]=_[_0x2150('0x39')](_0x19d601['model'],qs['fields'](_0x477010[_0x2150('0x36')]['fields']));_0x57d7de[_0x2150('0x38')]=_0x57d7de[_0x2150('0x38')][_0x2150('0x3b')]?_0x57d7de[_0x2150('0x38')]:_0x19d601['model'];if(_0x477010[_0x2150('0x36')][_0x2150('0x46')]){_0x57d7de['include']=[{'all':!![]}];}_0x57d7de=_[_0x2150('0x42')]({},_0x57d7de,_0x477010[_0x2150('0x45')]);return db[_0x2150('0x32')][_0x2150('0x4a')](_0x57d7de)[_0x2150('0x29')](handleEntityNotFound(_0x369eb3,null))[_0x2150('0x29')](respondWithResult(_0x369eb3,null))[_0x2150('0x4b')](handleError(_0x369eb3,null));};exports[_0x2150('0x4c')]=function(_0x102dbb,_0x2705bf){return db['MailQueue'][_0x2150('0x4c')](_0x102dbb[_0x2150('0x4d')],{})[_0x2150('0x29')](function(_0x59c1a2){var _0x4d8aad=_0x102dbb[_0x2150('0x4e')][_0x2150('0x4f')]({'plain':!![]});if(!_0x4d8aad)throw new Error(_0x2150('0x50'));if(_0x4d8aad[_0x2150('0x51')]===_0x2150('0x4e')){var _0x1343f8=_0x59c1a2[_0x2150('0x4f')]({'plain':!![]});var _0x29644d=_0x2150('0x2a');return db[_0x2150('0x52')][_0x2150('0x4a')]({'where':{'name':_0x29644d,'userProfileId':_0x4d8aad[_0x2150('0x53')]},'raw':!![]})[_0x2150('0x29')](function(_0x26dc4a){if(_0x26dc4a&&_0x26dc4a[_0x2150('0x54')]===0x0){return db[_0x2150('0x55')][_0x2150('0x4c')]({'name':_0x1343f8[_0x2150('0x2e')],'resourceId':_0x1343f8['id'],'type':_0x26dc4a[_0x2150('0x2e')],'sectionId':_0x26dc4a['id']},{})['then'](function(){return _0x59c1a2;});}else{return _0x59c1a2;}})['catch'](function(_0x16c976){logger[_0x2150('0x2c')](_0x2150('0x56'),_0x16c976);throw _0x16c976;});}return _0x59c1a2;})['then'](respondWithResult(_0x2705bf,0xc9))['catch'](handleError(_0x2705bf,null));};exports[_0x2150('0x28')]=function(_0x388069,_0x4c15ca){if(_0x388069[_0x2150('0x4d')]['id']){delete _0x388069[_0x2150('0x4d')]['id'];}return db[_0x2150('0x32')][_0x2150('0x4a')]({'where':{'id':_0x388069[_0x2150('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c15ca,null))[_0x2150('0x29')](saveUpdates(_0x388069[_0x2150('0x4d')],null))[_0x2150('0x29')](respondWithResult(_0x4c15ca,null))[_0x2150('0x4b')](handleError(_0x4c15ca,null));};exports[_0x2150('0x2b')]=function(_0x299e50,_0x1ab8e9){return db[_0x2150('0x32')][_0x2150('0x4a')]({'where':{'id':_0x299e50['params']['id']}})[_0x2150('0x29')](handleEntityNotFound(_0x1ab8e9,null))[_0x2150('0x29')](removeEntity(_0x1ab8e9,null))[_0x2150('0x4b')](handleError(_0x1ab8e9,null));};exports['describe']=function(_0x1ff4b1,_0x3fce50){return db[_0x2150('0x32')][_0x2150('0x57')]()['then'](respondWithResult(_0x3fce50,null))['catch'](handleError(_0x3fce50,null));};exports[_0x2150('0x58')]=function(_0x50499a,_0x2a8786,_0x153038){var _0x5f3822={'raw':!![],'where':{}},_0x49b2ea={},_0x1bb0c0;return db[_0x2150('0x32')]['findOne']({'where':{'id':_0x50499a[_0x2150('0x49')]['id']}})[_0x2150('0x29')](handleEntityNotFound(_0x2a8786,null))['then'](function(_0x1d83a){if(_0x1d83a){_0x1bb0c0=_0x1d83a[_0x2150('0x4f')]({'plain':!![]});_0x49b2ea[_0x2150('0x35')]=_[_0x2150('0x37')](db[_0x2150('0x59')]['rawAttributes']);_0x49b2ea[_0x2150('0x36')]=_['keys'](_0x50499a['query']);_0x49b2ea[_0x2150('0x3f')]=_[_0x2150('0x39')](_0x49b2ea[_0x2150('0x35')],_0x49b2ea[_0x2150('0x36')]);_0x5f3822[_0x2150('0x38')]=_[_0x2150('0x39')](_0x49b2ea[_0x2150('0x35')],qs[_0x2150('0x3a')](_0x50499a[_0x2150('0x36')][_0x2150('0x3a')]));_0x5f3822[_0x2150('0x38')]=_0x5f3822[_0x2150('0x38')]['length']?_0x5f3822['attributes']:_0x49b2ea[_0x2150('0x35')];if(!_0x50499a[_0x2150('0x36')][_0x2150('0x3c')]('nolimit')){_0x5f3822[_0x2150('0x5a')]=qs[_0x2150('0x5a')](_0x50499a[_0x2150('0x36')][_0x2150('0x5a')]);_0x5f3822['offset']=qs[_0x2150('0x21')](_0x50499a[_0x2150('0x36')][_0x2150('0x21')]);}_0x5f3822['order']=qs[_0x2150('0x3e')](_0x50499a['query'][_0x2150('0x3e')]);_0x5f3822[_0x2150('0x41')]=qs['filters'](_['pick'](_0x50499a[_0x2150('0x36')],_0x49b2ea[_0x2150('0x3f')]));_0x5f3822[_0x2150('0x41')][_0x2150('0x5b')]=_0x1d83a['id'];if(_0x50499a[_0x2150('0x36')][_0x2150('0x44')]){_0x5f3822[_0x2150('0x41')]=_[_0x2150('0x42')](_0x5f3822[_0x2150('0x41')],{'$or':_[_0x2150('0x31')](_0x5f3822['attributes'],function(_0x1f46ce){var _0x50220c={};_0x50220c[_0x1f46ce]={'$like':'%'+_0x50499a[_0x2150('0x36')][_0x2150('0x44')]+'%'};return _0x50220c;})});}_0x5f3822=_[_0x2150('0x42')]({},_0x5f3822,_0x50499a[_0x2150('0x45')]);return db[_0x2150('0x59')][_0x2150('0x5c')](_0x5f3822);}})[_0x2150('0x29')](function(_0x4b1aa1){if(_0x4b1aa1){return db[_0x2150('0x5d')][_0x2150('0x5e')]({'where':{'id':_['map'](_0x4b1aa1,_0x2150('0x5f')),'role':_0x2150('0x60')},'attributes':['id',_0x2150('0x2e'),_0x2150('0x61'),_0x2150('0x62'),_0x2150('0x63')]});}})[_0x2150('0x29')](function(_0x20b998){if(_0x20b998){return{'count':_0x20b998[_0x2150('0x23')],'rows':_[_0x2150('0x31')](_0x20b998[_0x2150('0x48')],function(_0x4548da){return{'membername':_0x4548da[_0x2150('0x2e')],'UserId':_0x4548da['id'],'queue_name':_0x1bb0c0[_0x2150('0x2e')],'MailQueueId':_0x1bb0c0['id'],'interface':util[_0x2150('0x64')](_0x2150('0x65'),_0x2150('0x66'),_0x4548da[_0x2150('0x2e')]),'penalty':0x0,'paused':_0x4548da[_0x2150('0x61')],'createdAt':_0x4548da[_0x2150('0x63')],'updatedAt':_0x4548da[_0x2150('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2150('0x29')](respondWithFilteredResult(_0x2a8786,_0x5f3822))[_0x2150('0x4b')](handleError(_0x2a8786,null));};exports[_0x2150('0x67')]=function(_0x2e08a6,_0x44f51d,_0x1fa723){var _0x2bd701={};var _0x404324={};var _0x25a450;var _0x4deb78;return db['MailQueue'][_0x2150('0x68')]({'where':{'id':_0x2e08a6[_0x2150('0x49')]['id']}})[_0x2150('0x29')](handleEntityNotFound(_0x44f51d,null))[_0x2150('0x29')](function(_0x470057){if(_0x470057){_0x25a450=_0x470057;_0x404324[_0x2150('0x35')]=_[_0x2150('0x37')](db[_0x2150('0x69')]['rawAttributes']);_0x404324[_0x2150('0x36')]=_[_0x2150('0x37')](_0x2e08a6[_0x2150('0x36')]);_0x404324['filters']=_['intersection'](_0x404324['model'],_0x404324[_0x2150('0x36')]);_0x2bd701[_0x2150('0x38')]=_[_0x2150('0x39')](_0x404324['model'],qs[_0x2150('0x3a')](_0x2e08a6[_0x2150('0x36')]['fields']));_0x2bd701[_0x2150('0x38')]=_0x2bd701[_0x2150('0x38')][_0x2150('0x3b')]?_0x2bd701['attributes']:_0x404324[_0x2150('0x35')];_0x2bd701[_0x2150('0x3d')]=qs['sort'](_0x2e08a6['query']['sort']);_0x2bd701[_0x2150('0x41')]=qs[_0x2150('0x3f')](_[_0x2150('0x40')](_0x2e08a6['query'],_0x404324['filters']));if(_0x2e08a6[_0x2150('0x36')][_0x2150('0x44')]){_0x2bd701[_0x2150('0x41')]=_['merge'](_0x2bd701[_0x2150('0x41')],{'$or':_[_0x2150('0x31')](_0x2bd701[_0x2150('0x38')],function(_0x1eb2a6){var _0xf07c5c={};_0xf07c5c[_0x1eb2a6]={'$like':'%'+_0x2e08a6['query'][_0x2150('0x44')]+'%'};return _0xf07c5c;})});}_0x2bd701=_['merge']({},_0x2bd701,_0x2e08a6['options']);return _0x25a450['getTeams'](_0x2bd701);}})[_0x2150('0x29')](function(_0x50dff0){if(_0x50dff0){_0x4deb78=_0x50dff0['length'];if(!_0x2e08a6['query'][_0x2150('0x3c')](_0x2150('0x6a'))){_0x2bd701['limit']=qs[_0x2150('0x5a')](_0x2e08a6[_0x2150('0x36')][_0x2150('0x5a')]);_0x2bd701['offset']=qs[_0x2150('0x21')](_0x2e08a6[_0x2150('0x36')][_0x2150('0x21')]);}return _0x25a450[_0x2150('0x67')](_0x2bd701);}})[_0x2150('0x29')](function(_0x1c3a22){if(_0x1c3a22){return _0x1c3a22?{'count':_0x4deb78,'rows':_0x1c3a22}:null;}})['then'](respondWithResult(_0x44f51d,null))['catch'](handleError(_0x44f51d,null));};exports[_0x2150('0x6b')]=function(_0x52251c,_0x954910,_0x5800b8){var _0xaef21b=_0x52251c[_0x2150('0x4d')][_0x2150('0x6c')];return db[_0x2150('0x69')]['findAll']({'where':{'id':_0xaef21b},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2150('0x6d'),'attributes':['id','name',_0x2150('0x6e'),_0x2150('0x6f'),_0x2150('0x70')],'raw':!![]}]})[_0x2150('0x29')](function(_0x44038d){if(_0x44038d){var _0x13b603=_[_0x2150('0x71')](_0x44038d,function(_0x2a49ba){var _0x3ae089=_0x2a49ba[_0x2150('0x4f')]({'plain':!![]});return _0x3ae089[_0x2150('0x6d')];});return db['MailQueue'][_0x2150('0x4a')]({'where':{'id':_0x52251c[_0x2150('0x49')]['id']}})['then'](function(_0x55fba8){return db[_0x2150('0x72')]['transaction'](function(_0x46bc5a){return _0x55fba8[_0x2150('0x6b')](_0xaef21b,{'transaction':_0x46bc5a})[_0x2150('0x29')](function(){return BPromise[_0x2150('0x73')](_0x13b603,function(_0x3afc25){return db[_0x2150('0x59')]['findOrCreate']({'where':{'UserId':_0x3afc25['id'],'MailQueueId':_0x52251c[_0x2150('0x49')]['id']},'transaction':_0x46bc5a});});})[_0x2150('0x29')](function(){_0x13b603[_0x2150('0x74')](function(_0x25c89d){socket[_0x2150('0x75')](_0x2150('0x76'),{'UserId':_0x25c89d['id'],'MailQueueId':_0x55fba8['id']});});});});});}})['then'](respondWithStatusCode(_0x954910,null))[_0x2150('0x4b')](handleError(_0x954910,null));};exports[_0x2150('0x77')]=function(_0x472101,_0x4b165c,_0x17b233){return db[_0x2150('0x69')]['findAll']({'where':{'id':_0x472101['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x2150('0x5d')],'as':_0x2150('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x2150('0x29')](handleEntityNotFound(_0x4b165c,null))[_0x2150('0x29')](function(_0x7bd1f3){var _0x2e0fa3=_[_0x2150('0x31')](_0x7bd1f3,'id');var _0x55ab40=[];var _0x2fd048=[];var _0x429d22=squel[_0x2150('0x78')]();_0x429d22['field']('tq.TeamId')[_0x2150('0x79')](_0x2150('0x7a'),'tq')[_0x2150('0x7b')](_0x2150('0x7c'),'ut',_0x2150('0x7d'))[_0x2150('0x41')]('MailQueueId\x20=\x20?',_0x472101[_0x2150('0x49')]['id']);for(var _0x1c27cb=0x0;_0x1c27cb<_0x7bd1f3[_0x2150('0x3b')];_0x1c27cb+=0x1){let _0x4f5028=_0x7bd1f3[_0x1c27cb];for(var _0x21ed41=0x0;_0x21ed41<_0x4f5028[_0x2150('0x6d')][_0x2150('0x3b')];_0x21ed41+=0x1){let _0x46793c=_0x4f5028[_0x2150('0x6d')][_0x21ed41];var _0x589bd4=_0x429d22[_0x2150('0x7e')]();_0x589bd4[_0x2150('0x41')](_0x2150('0x7f'),_0x46793c['id']);_0x2fd048[_0x2150('0x80')](db[_0x2150('0x72')]['query'](_0x589bd4[_0x2150('0x81')](),{'type':db[_0x2150('0x72')][_0x2150('0x82')][_0x2150('0x83')]})[_0x2150('0x29')](function(_0x2145d7){if(_0x2145d7['length']===0x1){return _0x46793c['id'];}else{var _0xc4ff4=_[_0x2150('0x84')](_['map'](_0x2145d7,'TeamId'),function(_0x181202){return _[_0x2150('0x85')](_0x2e0fa3,_0x181202);});if(_0xc4ff4){return _0x46793c['id'];}}}));}}return BPromise[_0x2150('0x86')](_0x2fd048)[_0x2150('0x29')](function(_0x5a5571){_0x55ab40=_(_0x55ab40)[_0x2150('0x87')](_0x5a5571)[_0x2150('0x88')]()['value']();return db[_0x2150('0x32')]['find']({'where':{'id':_0x472101[_0x2150('0x49')]['id']}})[_0x2150('0x29')](function(_0x8fcf4){return db[_0x2150('0x72')][_0x2150('0x89')](function(_0x2f1105){return _0x8fcf4[_0x2150('0x77')](_0x472101[_0x2150('0x36')][_0x2150('0x6c')],{'transaction':_0x2f1105})[_0x2150('0x29')](function(){if(!_[_0x2150('0x8a')](_0x55ab40)){return _0x8fcf4[_0x2150('0x8b')](_0x55ab40,{'transaction':_0x2f1105});}})['then'](function(){_0x55ab40[_0x2150('0x74')](function(_0x59e17a){socket[_0x2150('0x75')](_0x2150('0x8c'),{'UserId':_0x59e17a,'MailQueueId':_0x8fcf4['id']});});});});});});})['then'](respondWithStatusCode(_0x4b165c,null))['catch'](handleError(_0x4b165c,null));};exports[_0x2150('0x8d')]=function(_0xfd0274,_0x208a26,_0x195fec){return db[_0x2150('0x32')][_0x2150('0x4a')]({'where':{'id':_0xfd0274['params']['id']}})[_0x2150('0x29')](handleEntityNotFound(_0x208a26,null))[_0x2150('0x29')](function(_0x1df43c){if(_0x1df43c){return _0x1df43c[_0x2150('0x8d')](_0xfd0274['body']['ids'],_[_0x2150('0x8e')](_0xfd0274[_0x2150('0x4d')],[_0x2150('0x6c'),'id'])||{})[_0x2150('0x8f')](function(_0x4b1203){for(var _0x221502=0x0;_0x221502<_0xfd0274[_0x2150('0x4d')][_0x2150('0x6c')][_0x2150('0x3b')];_0x221502+=0x1){socket[_0x2150('0x75')](_0x2150('0x76'),{'UserId':Number(_0xfd0274['body']['ids'][_0x221502]),'MailQueueId':Number(_0xfd0274[_0x2150('0x49')]['id'])});}return _0x4b1203;});}})[_0x2150('0x29')](respondWithResult(_0x208a26,null))['catch'](handleError(_0x208a26,null));};exports[_0x2150('0x8b')]=function(_0x1adcba,_0xe2c281,_0x1daba4){return db['MailQueue'][_0x2150('0x4a')]({'where':{'id':_0x1adcba[_0x2150('0x49')]['id']}})[_0x2150('0x29')](handleEntityNotFound(_0xe2c281,null))[_0x2150('0x29')](function(_0xcb7f12){if(_0xcb7f12){return _0xcb7f12[_0x2150('0x8b')](_0x1adcba[_0x2150('0x36')][_0x2150('0x6c')])[_0x2150('0x29')](function(){if(_['isArray'](_0x1adcba[_0x2150('0x36')][_0x2150('0x6c')])){for(var _0x37e71f=0x0;_0x37e71f<_0x1adcba[_0x2150('0x36')][_0x2150('0x6c')][_0x2150('0x3b')];_0x37e71f+=0x1){socket[_0x2150('0x75')](_0x2150('0x8c'),{'UserId':Number(_0x1adcba[_0x2150('0x36')][_0x2150('0x6c')][_0x37e71f]),'MailQueueId':Number(_0x1adcba[_0x2150('0x49')]['id'])});}}else{socket[_0x2150('0x75')](_0x2150('0x8c'),{'UserId':Number(_0x1adcba[_0x2150('0x36')][_0x2150('0x6c')]),'MailQueueId':Number(_0x1adcba['params']['id'])});}});}})[_0x2150('0x29')](respondWithStatusCode(_0xe2c281,null))[_0x2150('0x4b')](handleError(_0xe2c281,null));};exports[_0x2150('0x90')]=function(_0x4cc510,_0x3c2d5b,_0x33e30b){var _0x3416d={};var _0x25fca7={};var _0x41957e;var _0x348593;return db['MailQueue']['findOne']({'where':{'id':_0x4cc510[_0x2150('0x49')]['id']}})[_0x2150('0x29')](handleEntityNotFound(_0x3c2d5b,null))['then'](function(_0x2a2edd){if(_0x2a2edd){_0x41957e=_0x2a2edd;_0x25fca7[_0x2150('0x35')]=_[_0x2150('0x37')](db[_0x2150('0x5d')][_0x2150('0x33')]);_0x25fca7['query']=_['keys'](_0x4cc510[_0x2150('0x36')]);_0x25fca7['filters']=_[_0x2150('0x39')](_0x25fca7['model'],_0x25fca7[_0x2150('0x36')]);_0x3416d[_0x2150('0x38')]=_['intersection'](_0x25fca7[_0x2150('0x35')],qs[_0x2150('0x3a')](_0x4cc510[_0x2150('0x36')][_0x2150('0x3a')]));_0x3416d['attributes']=_0x3416d[_0x2150('0x38')][_0x2150('0x3b')]?_0x3416d[_0x2150('0x38')]:_0x25fca7[_0x2150('0x35')];_0x3416d['order']=qs['sort'](_0x4cc510[_0x2150('0x36')]['sort']);_0x3416d['where']=qs['filters'](_['pick'](_0x4cc510[_0x2150('0x36')],_0x25fca7['filters']));if(_0x4cc510[_0x2150('0x36')]['filter']){_0x3416d['where']=_[_0x2150('0x42')](_0x3416d['where'],{'$or':_[_0x2150('0x31')](_0x3416d[_0x2150('0x38')],function(_0x5d401f){var _0x1effb1={};_0x1effb1[_0x5d401f]={'$like':'%'+_0x4cc510[_0x2150('0x36')][_0x2150('0x44')]+'%'};return _0x1effb1;})});}_0x3416d=_[_0x2150('0x42')]({},_0x3416d,_0x4cc510[_0x2150('0x45')]);return _0x41957e['getAgents'](_0x3416d);}})[_0x2150('0x29')](function(_0x216277){if(_0x216277){_0x348593=_0x216277['length'];if(!_0x4cc510['query'][_0x2150('0x3c')](_0x2150('0x6a'))){_0x3416d[_0x2150('0x5a')]=qs[_0x2150('0x5a')](_0x4cc510[_0x2150('0x36')][_0x2150('0x5a')]);_0x3416d[_0x2150('0x21')]=qs[_0x2150('0x21')](_0x4cc510['query']['offset']);}return _0x41957e[_0x2150('0x90')](_0x3416d);}})[_0x2150('0x29')](function(_0x296c1e){if(_0x296c1e){return _0x296c1e?{'count':_0x348593,'rows':_0x296c1e}:null;}})[_0x2150('0x29')](respondWithResult(_0x3c2d5b,null))['catch'](handleError(_0x3c2d5b,null));}; \ No newline at end of file +var _0x9fca=['tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','TeamId','all','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','findOne','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','MailQueues','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','MailQueue','findAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','describe','UserMailQueue','hasOwnProperty','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt','rows','format','%s/%s','createdAt','getTeams','Team','addTeams','Agents','online','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','field'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0x9fca,0x1be));var _0xa9fc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9fca[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xa9fc('0x0'));var rimraf=require(_0xa9fc('0x1'));var zipdir=require(_0xa9fc('0x2'));var jsonpatch=require(_0xa9fc('0x3'));var rp=require(_0xa9fc('0x4'));var moment=require('moment');var BPromise=require(_0xa9fc('0x5'));var Mustache=require(_0xa9fc('0x6'));var util=require(_0xa9fc('0x7'));var path=require(_0xa9fc('0x8'));var sox=require(_0xa9fc('0x9'));var csv=require(_0xa9fc('0xa'));var ejs=require(_0xa9fc('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa9fc('0xc'));var crypto=require(_0xa9fc('0xd'));var jsforce=require(_0xa9fc('0xe'));var deskjs=require(_0xa9fc('0xf'));var toCsv=require(_0xa9fc('0xa'));var querystring=require('querystring');var Papa=require(_0xa9fc('0x10'));var Redis=require(_0xa9fc('0x11'));var authService=require(_0xa9fc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa9fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9fc('0x14'))(_0xa9fc('0x15'));var utils=require(_0xa9fc('0x16'));var config=require(_0xa9fc('0x17'));var licenseUtil=require(_0xa9fc('0x18'));var db=require(_0xa9fc('0x19'))['db'];config['redis']=_[_0xa9fc('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa9fc('0x1b'))(new Redis(config['redis']));require(_0xa9fc('0x1c'))[_0xa9fc('0x1d')](socket);function respondWithStatusCode(_0x3caa83,_0x424bce){_0x424bce=_0x424bce||0xcc;return function(_0x5a7c21){if(_0x5a7c21){return _0x3caa83[_0xa9fc('0x1e')](_0x424bce);}return _0x3caa83[_0xa9fc('0x1f')](_0x424bce)['end']();};}function respondWithResult(_0x9f50ba,_0x1dcdf5){_0x1dcdf5=_0x1dcdf5||0xc8;return function(_0x1e90b6){if(_0x1e90b6){return _0x9f50ba['status'](_0x1dcdf5)[_0xa9fc('0x20')](_0x1e90b6);}};}function respondWithFilteredResult(_0x3e4999,_0x385aba){return function(_0x1c04c3){if(_0x1c04c3){var _0x45d164=typeof _0x385aba[_0xa9fc('0x21')]==='undefined'&&typeof _0x385aba[_0xa9fc('0x22')]===_0xa9fc('0x23');var _0x135d55=_0x1c04c3[_0xa9fc('0x24')];var _0x26370c=_0x45d164?0x0:_0x385aba[_0xa9fc('0x21')];var _0x1ad486=_0x45d164?_0x1c04c3['count']:_0x385aba[_0xa9fc('0x21')]+_0x385aba[_0xa9fc('0x22')];var _0x17f7d8;if(_0x1ad486>=_0x135d55){_0x1ad486=_0x135d55;_0x17f7d8=0xc8;}else{_0x17f7d8=0xce;}_0x3e4999['status'](_0x17f7d8);return _0x3e4999[_0xa9fc('0x25')](_0xa9fc('0x26'),_0x26370c+'-'+_0x1ad486+'/'+_0x135d55)[_0xa9fc('0x20')](_0x1c04c3);}return null;};}function patchUpdates(_0x2d6819){return function(_0x4bfb5c){try{jsonpatch[_0xa9fc('0x27')](_0x4bfb5c,_0x2d6819,!![]);}catch(_0xd9ed89){return BPromise[_0xa9fc('0x28')](_0xd9ed89);}return _0x4bfb5c[_0xa9fc('0x29')]();};}function saveUpdates(_0xe444d5,_0x52fc77){return function(_0x51a631){if(_0x51a631){return _0x51a631[_0xa9fc('0x2a')](_0xe444d5)[_0xa9fc('0x2b')](function(_0x5114e1){return _0x5114e1;});}return null;};}function removeEntity(_0x40b9aa,_0x312129){return function(_0x3b1cd9){if(_0x3b1cd9){return _0x3b1cd9['destroy']()['then'](function(){var _0x5ee725=_0x3b1cd9[_0xa9fc('0x2c')]({'plain':!![]});var _0x4e5908=_0xa9fc('0x2d');return db['UserProfileResource'][_0xa9fc('0x2e')]({'where':{'type':_0x4e5908,'resourceId':_0x5ee725['id']}})['then'](function(){return _0x3b1cd9;});})[_0xa9fc('0x2b')](function(){_0x40b9aa[_0xa9fc('0x1f')](0xcc)[_0xa9fc('0x2f')]();});}};}function handleEntityNotFound(_0x287a1d,_0x408d93){return function(_0x586d71){if(!_0x586d71){_0x287a1d[_0xa9fc('0x1e')](0x194);}return _0x586d71;};}function handleError(_0x174316,_0x54644a){_0x54644a=_0x54644a||0x1f4;return function(_0x36cf76){logger[_0xa9fc('0x30')](_0x36cf76[_0xa9fc('0x31')]);if(_0x36cf76[_0xa9fc('0x32')]){delete _0x36cf76[_0xa9fc('0x32')];}_0x174316[_0xa9fc('0x1f')](_0x54644a)[_0xa9fc('0x33')](_0x36cf76);};}exports[_0xa9fc('0x34')]=function(_0x2bff61,_0x153ab2){var _0x19b946={},_0xdab439={},_0xc28714={'count':0x0,'rows':[]};var _0x41267d=_[_0xa9fc('0x35')](db['MailQueue'][_0xa9fc('0x36')],function(_0x1c0f54){return{'name':_0x1c0f54[_0xa9fc('0x37')],'type':_0x1c0f54[_0xa9fc('0x38')]['key']};});_0xdab439[_0xa9fc('0x39')]=_[_0xa9fc('0x35')](_0x41267d,_0xa9fc('0x32'));_0xdab439[_0xa9fc('0x3a')]=_[_0xa9fc('0x3b')](_0x2bff61[_0xa9fc('0x3a')]);_0xdab439['filters']=_[_0xa9fc('0x3c')](_0xdab439['model'],_0xdab439['query']);_0x19b946[_0xa9fc('0x3d')]=_['intersection'](_0xdab439[_0xa9fc('0x39')],qs['fields'](_0x2bff61[_0xa9fc('0x3a')][_0xa9fc('0x3e')]));_0x19b946[_0xa9fc('0x3d')]=_0x19b946['attributes'][_0xa9fc('0x3f')]?_0x19b946[_0xa9fc('0x3d')]:_0xdab439[_0xa9fc('0x39')];if(!_0x2bff61['query']['hasOwnProperty'](_0xa9fc('0x40'))){_0x19b946[_0xa9fc('0x22')]=qs['limit'](_0x2bff61[_0xa9fc('0x3a')][_0xa9fc('0x22')]);_0x19b946[_0xa9fc('0x21')]=qs[_0xa9fc('0x21')](_0x2bff61['query'][_0xa9fc('0x21')]);}_0x19b946[_0xa9fc('0x41')]=qs['sort'](_0x2bff61[_0xa9fc('0x3a')][_0xa9fc('0x42')]);_0x19b946[_0xa9fc('0x43')]=qs[_0xa9fc('0x44')](_[_0xa9fc('0x45')](_0x2bff61[_0xa9fc('0x3a')],_0xdab439['filters']),_0x41267d);if(_0x2bff61[_0xa9fc('0x3a')][_0xa9fc('0x46')]){_0x19b946['where']=_[_0xa9fc('0x47')](_0x19b946[_0xa9fc('0x43')],{'$or':_[_0xa9fc('0x35')](_0x41267d,function(_0x14d0ec){if(_0x14d0ec[_0xa9fc('0x38')]!==_0xa9fc('0x48')){var _0x576e05={};_0x576e05[_0x14d0ec[_0xa9fc('0x32')]]={'$like':'%'+_0x2bff61['query'][_0xa9fc('0x46')]+'%'};return _0x576e05;}})});}_0x19b946=_[_0xa9fc('0x47')]({},_0x19b946,_0x2bff61[_0xa9fc('0x49')]);var _0x4971d4={'where':_0x19b946[_0xa9fc('0x43')]};return db['MailQueue'][_0xa9fc('0x24')](_0x4971d4)[_0xa9fc('0x2b')](function(_0x3ecaa){_0xc28714[_0xa9fc('0x24')]=_0x3ecaa;if(_0x2bff61[_0xa9fc('0x3a')][_0xa9fc('0x4a')]){_0x19b946['include']=[{'all':!![]}];}return db[_0xa9fc('0x4b')][_0xa9fc('0x4c')](_0x19b946);})[_0xa9fc('0x2b')](function(_0x34abc3){_0xc28714['rows']=_0x34abc3;return _0xc28714;})['then'](respondWithFilteredResult(_0x153ab2,_0x19b946))[_0xa9fc('0x4d')](handleError(_0x153ab2,null));};exports[_0xa9fc('0x4e')]=function(_0x584165,_0x4decb0){var _0x5543d6={'raw':!![],'where':{'id':_0x584165[_0xa9fc('0x4f')]['id']}},_0x55bc02={};_0x55bc02[_0xa9fc('0x39')]=_['keys'](db[_0xa9fc('0x4b')]['rawAttributes']);_0x55bc02[_0xa9fc('0x3a')]=_[_0xa9fc('0x3b')](_0x584165[_0xa9fc('0x3a')]);_0x55bc02[_0xa9fc('0x44')]=_[_0xa9fc('0x3c')](_0x55bc02[_0xa9fc('0x39')],_0x55bc02[_0xa9fc('0x3a')]);_0x5543d6[_0xa9fc('0x3d')]=_[_0xa9fc('0x3c')](_0x55bc02[_0xa9fc('0x39')],qs[_0xa9fc('0x3e')](_0x584165['query'][_0xa9fc('0x3e')]));_0x5543d6['attributes']=_0x5543d6[_0xa9fc('0x3d')][_0xa9fc('0x3f')]?_0x5543d6['attributes']:_0x55bc02[_0xa9fc('0x39')];if(_0x584165['query'][_0xa9fc('0x4a')]){_0x5543d6[_0xa9fc('0x50')]=[{'all':!![]}];}_0x5543d6=_[_0xa9fc('0x47')]({},_0x5543d6,_0x584165['options']);return db[_0xa9fc('0x4b')][_0xa9fc('0x51')](_0x5543d6)[_0xa9fc('0x2b')](handleEntityNotFound(_0x4decb0,null))[_0xa9fc('0x2b')](respondWithResult(_0x4decb0,null))['catch'](handleError(_0x4decb0,null));};exports[_0xa9fc('0x52')]=function(_0x1a8d95,_0x3bd086){return db[_0xa9fc('0x4b')][_0xa9fc('0x52')](_0x1a8d95[_0xa9fc('0x53')],{})['then'](function(_0x1571ea){var _0x1f48c6=_0x1a8d95[_0xa9fc('0x54')][_0xa9fc('0x2c')]({'plain':!![]});if(!_0x1f48c6)throw new Error(_0xa9fc('0x55'));if(_0x1f48c6['role']===_0xa9fc('0x54')){var _0xf83f7e=_0x1571ea['get']({'plain':!![]});var _0x2eaafa=_0xa9fc('0x2d');return db['UserProfileSection'][_0xa9fc('0x51')]({'where':{'name':_0x2eaafa,'userProfileId':_0x1f48c6['userProfileId']},'raw':!![]})[_0xa9fc('0x2b')](function(_0x35519f){if(_0x35519f&&_0x35519f[_0xa9fc('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0xf83f7e[_0xa9fc('0x32')],'resourceId':_0xf83f7e['id'],'type':_0x35519f[_0xa9fc('0x32')],'sectionId':_0x35519f['id']},{})[_0xa9fc('0x2b')](function(){return _0x1571ea;});}else{return _0x1571ea;}})[_0xa9fc('0x4d')](function(_0x5e9b22){logger[_0xa9fc('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5e9b22);throw _0x5e9b22;});}return _0x1571ea;})[_0xa9fc('0x2b')](respondWithResult(_0x3bd086,0xc9))['catch'](handleError(_0x3bd086,null));};exports[_0xa9fc('0x2a')]=function(_0x20758e,_0x3f629a){if(_0x20758e[_0xa9fc('0x53')]['id']){delete _0x20758e[_0xa9fc('0x53')]['id'];}return db[_0xa9fc('0x4b')][_0xa9fc('0x51')]({'where':{'id':_0x20758e[_0xa9fc('0x4f')]['id']}})[_0xa9fc('0x2b')](handleEntityNotFound(_0x3f629a,null))[_0xa9fc('0x2b')](saveUpdates(_0x20758e['body'],null))[_0xa9fc('0x2b')](respondWithResult(_0x3f629a,null))[_0xa9fc('0x4d')](handleError(_0x3f629a,null));};exports['destroy']=function(_0x3678ce,_0x230f5d){return db[_0xa9fc('0x4b')][_0xa9fc('0x51')]({'where':{'id':_0x3678ce[_0xa9fc('0x4f')]['id']}})[_0xa9fc('0x2b')](handleEntityNotFound(_0x230f5d,null))[_0xa9fc('0x2b')](removeEntity(_0x230f5d,null))['catch'](handleError(_0x230f5d,null));};exports[_0xa9fc('0x57')]=function(_0xd40c5b,_0x570b9c){return db[_0xa9fc('0x4b')][_0xa9fc('0x57')]()['then'](respondWithResult(_0x570b9c,null))[_0xa9fc('0x4d')](handleError(_0x570b9c,null));};exports['getMembers']=function(_0x39c9df,_0x511470,_0x77a972){var _0x3b0732={'raw':!![],'where':{}},_0xa8a51c={},_0x22b63f;return db[_0xa9fc('0x4b')]['findOne']({'where':{'id':_0x39c9df[_0xa9fc('0x4f')]['id']}})[_0xa9fc('0x2b')](handleEntityNotFound(_0x511470,null))[_0xa9fc('0x2b')](function(_0x40bd38){if(_0x40bd38){_0x22b63f=_0x40bd38['get']({'plain':!![]});_0xa8a51c[_0xa9fc('0x39')]=_['keys'](db[_0xa9fc('0x58')][_0xa9fc('0x36')]);_0xa8a51c[_0xa9fc('0x3a')]=_[_0xa9fc('0x3b')](_0x39c9df[_0xa9fc('0x3a')]);_0xa8a51c[_0xa9fc('0x44')]=_[_0xa9fc('0x3c')](_0xa8a51c[_0xa9fc('0x39')],_0xa8a51c['query']);_0x3b0732[_0xa9fc('0x3d')]=_[_0xa9fc('0x3c')](_0xa8a51c[_0xa9fc('0x39')],qs[_0xa9fc('0x3e')](_0x39c9df[_0xa9fc('0x3a')][_0xa9fc('0x3e')]));_0x3b0732[_0xa9fc('0x3d')]=_0x3b0732[_0xa9fc('0x3d')]['length']?_0x3b0732[_0xa9fc('0x3d')]:_0xa8a51c['model'];if(!_0x39c9df[_0xa9fc('0x3a')][_0xa9fc('0x59')](_0xa9fc('0x40'))){_0x3b0732[_0xa9fc('0x22')]=qs[_0xa9fc('0x22')](_0x39c9df[_0xa9fc('0x3a')][_0xa9fc('0x22')]);_0x3b0732[_0xa9fc('0x21')]=qs[_0xa9fc('0x21')](_0x39c9df[_0xa9fc('0x3a')][_0xa9fc('0x21')]);}_0x3b0732[_0xa9fc('0x41')]=qs[_0xa9fc('0x42')](_0x39c9df[_0xa9fc('0x3a')][_0xa9fc('0x42')]);_0x3b0732[_0xa9fc('0x43')]=qs[_0xa9fc('0x44')](_['pick'](_0x39c9df['query'],_0xa8a51c[_0xa9fc('0x44')]));_0x3b0732[_0xa9fc('0x43')][_0xa9fc('0x5a')]=_0x40bd38['id'];if(_0x39c9df['query'][_0xa9fc('0x46')]){_0x3b0732[_0xa9fc('0x43')]=_[_0xa9fc('0x47')](_0x3b0732[_0xa9fc('0x43')],{'$or':_[_0xa9fc('0x35')](_0x3b0732['attributes'],function(_0x5628bd){var _0x324f3f={};_0x324f3f[_0x5628bd]={'$like':'%'+_0x39c9df[_0xa9fc('0x3a')][_0xa9fc('0x46')]+'%'};return _0x324f3f;})});}_0x3b0732=_[_0xa9fc('0x47')]({},_0x3b0732,_0x39c9df[_0xa9fc('0x49')]);return db[_0xa9fc('0x58')][_0xa9fc('0x4c')](_0x3b0732);}})[_0xa9fc('0x2b')](function(_0xaa1085){if(_0xaa1085){return db[_0xa9fc('0x5b')][_0xa9fc('0x5c')]({'where':{'id':_[_0xa9fc('0x35')](_0xaa1085,_0xa9fc('0x5d')),'role':_0xa9fc('0x5e')},'attributes':['id',_0xa9fc('0x32'),_0xa9fc('0x5f'),_0xa9fc('0x60'),'createdAt']});}})[_0xa9fc('0x2b')](function(_0x3e73f8){if(_0x3e73f8){return{'count':_0x3e73f8['count'],'rows':_[_0xa9fc('0x35')](_0x3e73f8[_0xa9fc('0x61')],function(_0x598c71){return{'membername':_0x598c71[_0xa9fc('0x32')],'UserId':_0x598c71['id'],'queue_name':_0x22b63f['name'],'MailQueueId':_0x22b63f['id'],'interface':util[_0xa9fc('0x62')](_0xa9fc('0x63'),'SIP',_0x598c71['name']),'penalty':0x0,'paused':_0x598c71[_0xa9fc('0x5f')],'createdAt':_0x598c71[_0xa9fc('0x64')],'updatedAt':_0x598c71['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x511470,_0x3b0732))[_0xa9fc('0x4d')](handleError(_0x511470,null));};exports[_0xa9fc('0x65')]=function(_0x4c6bd0,_0x182dd7,_0x2d45b5){var _0x5c6091={};var _0x518890={};var _0x5218f9;var _0x2fc131;return db[_0xa9fc('0x4b')]['findOne']({'where':{'id':_0x4c6bd0[_0xa9fc('0x4f')]['id']}})[_0xa9fc('0x2b')](handleEntityNotFound(_0x182dd7,null))[_0xa9fc('0x2b')](function(_0x2c36b7){if(_0x2c36b7){_0x5218f9=_0x2c36b7;_0x518890[_0xa9fc('0x39')]=_[_0xa9fc('0x3b')](db[_0xa9fc('0x66')]['rawAttributes']);_0x518890[_0xa9fc('0x3a')]=_[_0xa9fc('0x3b')](_0x4c6bd0['query']);_0x518890[_0xa9fc('0x44')]=_[_0xa9fc('0x3c')](_0x518890['model'],_0x518890[_0xa9fc('0x3a')]);_0x5c6091[_0xa9fc('0x3d')]=_[_0xa9fc('0x3c')](_0x518890[_0xa9fc('0x39')],qs[_0xa9fc('0x3e')](_0x4c6bd0[_0xa9fc('0x3a')]['fields']));_0x5c6091[_0xa9fc('0x3d')]=_0x5c6091[_0xa9fc('0x3d')][_0xa9fc('0x3f')]?_0x5c6091[_0xa9fc('0x3d')]:_0x518890[_0xa9fc('0x39')];_0x5c6091['order']=qs[_0xa9fc('0x42')](_0x4c6bd0[_0xa9fc('0x3a')][_0xa9fc('0x42')]);_0x5c6091['where']=qs[_0xa9fc('0x44')](_[_0xa9fc('0x45')](_0x4c6bd0[_0xa9fc('0x3a')],_0x518890[_0xa9fc('0x44')]));if(_0x4c6bd0[_0xa9fc('0x3a')]['filter']){_0x5c6091[_0xa9fc('0x43')]=_[_0xa9fc('0x47')](_0x5c6091[_0xa9fc('0x43')],{'$or':_[_0xa9fc('0x35')](_0x5c6091['attributes'],function(_0xd4eb39){var _0x275839={};_0x275839[_0xd4eb39]={'$like':'%'+_0x4c6bd0[_0xa9fc('0x3a')]['filter']+'%'};return _0x275839;})});}_0x5c6091=_[_0xa9fc('0x47')]({},_0x5c6091,_0x4c6bd0[_0xa9fc('0x49')]);return _0x5218f9[_0xa9fc('0x65')](_0x5c6091);}})[_0xa9fc('0x2b')](function(_0x48c6c9){if(_0x48c6c9){_0x2fc131=_0x48c6c9[_0xa9fc('0x3f')];if(!_0x4c6bd0[_0xa9fc('0x3a')][_0xa9fc('0x59')]('nolimit')){_0x5c6091['limit']=qs['limit'](_0x4c6bd0[_0xa9fc('0x3a')][_0xa9fc('0x22')]);_0x5c6091[_0xa9fc('0x21')]=qs[_0xa9fc('0x21')](_0x4c6bd0['query'][_0xa9fc('0x21')]);}return _0x5218f9['getTeams'](_0x5c6091);}})['then'](function(_0x1109e0){if(_0x1109e0){return _0x1109e0?{'count':_0x2fc131,'rows':_0x1109e0}:null;}})[_0xa9fc('0x2b')](respondWithResult(_0x182dd7,null))['catch'](handleError(_0x182dd7,null));};exports[_0xa9fc('0x67')]=function(_0x21cd2a,_0xe9281d,_0x538ff9){var _0x597b45=_0x21cd2a[_0xa9fc('0x53')]['ids'];return db[_0xa9fc('0x66')][_0xa9fc('0x4c')]({'where':{'id':_0x597b45},'attributes':['id'],'include':[{'model':db[_0xa9fc('0x5b')],'as':_0xa9fc('0x68'),'attributes':['id',_0xa9fc('0x32'),_0xa9fc('0x69'),'voicePause',_0xa9fc('0x6a')],'raw':!![]}]})['then'](function(_0x1cba06){if(_0x1cba06){var _0x4f719d=_[_0xa9fc('0x6b')](_0x1cba06,function(_0x590d15){var _0x11506d=_0x590d15[_0xa9fc('0x2c')]({'plain':!![]});return _0x11506d[_0xa9fc('0x68')];});return db[_0xa9fc('0x4b')][_0xa9fc('0x51')]({'where':{'id':_0x21cd2a[_0xa9fc('0x4f')]['id']}})[_0xa9fc('0x2b')](function(_0x480436){return db['sequelize'][_0xa9fc('0x6c')](function(_0x2d86ea){return _0x480436[_0xa9fc('0x67')](_0x597b45,{'transaction':_0x2d86ea})[_0xa9fc('0x2b')](function(){return BPromise[_0xa9fc('0x6d')](_0x4f719d,function(_0x5249d9){return db['UserMailQueue'][_0xa9fc('0x6e')]({'where':{'UserId':_0x5249d9['id'],'MailQueueId':_0x21cd2a[_0xa9fc('0x4f')]['id']},'transaction':_0x2d86ea});});})[_0xa9fc('0x2b')](function(){_0x4f719d[_0xa9fc('0x6f')](function(_0x5898f9){socket[_0xa9fc('0x70')](_0xa9fc('0x71'),{'UserId':_0x5898f9['id'],'MailQueueId':_0x480436['id']});});});});});}})['then'](respondWithStatusCode(_0xe9281d,null))[_0xa9fc('0x4d')](handleError(_0xe9281d,null));};exports[_0xa9fc('0x72')]=function(_0x48af23,_0x2c7e95,_0x5d500b){return db[_0xa9fc('0x66')][_0xa9fc('0x4c')]({'where':{'id':_0x48af23['query'][_0xa9fc('0x73')]},'attributes':['id'],'include':[{'model':db[_0xa9fc('0x5b')],'as':_0xa9fc('0x68'),'attributes':['id'],'raw':!![]}]})[_0xa9fc('0x2b')](handleEntityNotFound(_0x2c7e95,null))[_0xa9fc('0x2b')](function(_0x11991a){var _0x186047=_[_0xa9fc('0x35')](_0x11991a,'id');var _0x51acc4=[];var _0x38452f=[];var _0x70978a=squel[_0xa9fc('0x74')]();_0x70978a[_0xa9fc('0x75')](_0xa9fc('0x76'))[_0xa9fc('0x77')](_0xa9fc('0x78'),'tq')[_0xa9fc('0x79')]('user_has_teams','ut',_0xa9fc('0x7a'))[_0xa9fc('0x43')](_0xa9fc('0x7b'),_0x48af23[_0xa9fc('0x4f')]['id']);for(var _0x5d7e48=0x0;_0x5d7e48<_0x11991a[_0xa9fc('0x3f')];_0x5d7e48+=0x1){let _0x2455fe=_0x11991a[_0x5d7e48];for(var _0x3fb347=0x0;_0x3fb347<_0x2455fe['Agents'][_0xa9fc('0x3f')];_0x3fb347+=0x1){let _0x2cbb5a=_0x2455fe[_0xa9fc('0x68')][_0x3fb347];var _0x3983c6=_0x70978a[_0xa9fc('0x7c')]();_0x3983c6[_0xa9fc('0x43')](_0xa9fc('0x7d'),_0x2cbb5a['id']);_0x38452f['push'](db[_0xa9fc('0x7e')][_0xa9fc('0x3a')](_0x3983c6[_0xa9fc('0x7f')](),{'type':db[_0xa9fc('0x7e')][_0xa9fc('0x80')][_0xa9fc('0x81')]})[_0xa9fc('0x2b')](function(_0xefb933){if(_0xefb933[_0xa9fc('0x3f')]===0x1){return _0x2cbb5a['id'];}else{var _0x23fcf8=_['every'](_['map'](_0xefb933,_0xa9fc('0x82')),function(_0x26f622){return _['includes'](_0x186047,_0x26f622);});if(_0x23fcf8){return _0x2cbb5a['id'];}}}));}}return BPromise[_0xa9fc('0x83')](_0x38452f)[_0xa9fc('0x2b')](function(_0x344492){_0x51acc4=_(_0x51acc4)['union'](_0x344492)['compact']()['value']();return db[_0xa9fc('0x4b')]['find']({'where':{'id':_0x48af23[_0xa9fc('0x4f')]['id']}})[_0xa9fc('0x2b')](function(_0x56ee69){return db[_0xa9fc('0x7e')][_0xa9fc('0x6c')](function(_0x10f013){return _0x56ee69['removeTeams'](_0x48af23[_0xa9fc('0x3a')][_0xa9fc('0x73')],{'transaction':_0x10f013})['then'](function(){if(!_[_0xa9fc('0x84')](_0x51acc4)){return _0x56ee69[_0xa9fc('0x85')](_0x51acc4,{'transaction':_0x10f013});}})['then'](function(){_0x51acc4[_0xa9fc('0x6f')](function(_0x5bac07){socket['emit'](_0xa9fc('0x86'),{'UserId':_0x5bac07,'MailQueueId':_0x56ee69['id']});});});});});});})[_0xa9fc('0x2b')](respondWithStatusCode(_0x2c7e95,null))[_0xa9fc('0x4d')](handleError(_0x2c7e95,null));};exports[_0xa9fc('0x87')]=function(_0x3409bd,_0x4e57b4,_0x4416fd){return db['MailQueue']['find']({'where':{'id':_0x3409bd['params']['id']}})[_0xa9fc('0x2b')](handleEntityNotFound(_0x4e57b4,null))[_0xa9fc('0x2b')](function(_0x4710b1){if(_0x4710b1){return _0x4710b1[_0xa9fc('0x87')](_0x3409bd[_0xa9fc('0x53')][_0xa9fc('0x73')],_[_0xa9fc('0x88')](_0x3409bd[_0xa9fc('0x53')],[_0xa9fc('0x73'),'id'])||{})[_0xa9fc('0x89')](function(_0x3f1992){for(var _0x40c567=0x0;_0x40c567<_0x3409bd[_0xa9fc('0x53')][_0xa9fc('0x73')][_0xa9fc('0x3f')];_0x40c567+=0x1){socket[_0xa9fc('0x70')]('userMailQueue:save',{'UserId':Number(_0x3409bd[_0xa9fc('0x53')]['ids'][_0x40c567]),'MailQueueId':Number(_0x3409bd[_0xa9fc('0x4f')]['id'])});}return _0x3f1992;});}})[_0xa9fc('0x2b')](respondWithResult(_0x4e57b4,null))[_0xa9fc('0x4d')](handleError(_0x4e57b4,null));};exports[_0xa9fc('0x85')]=function(_0xfe671c,_0x165be5,_0x311f10){return db[_0xa9fc('0x4b')][_0xa9fc('0x51')]({'where':{'id':_0xfe671c[_0xa9fc('0x4f')]['id']}})[_0xa9fc('0x2b')](handleEntityNotFound(_0x165be5,null))[_0xa9fc('0x2b')](function(_0x278665){if(_0x278665){return _0x278665[_0xa9fc('0x85')](_0xfe671c['query'][_0xa9fc('0x73')])[_0xa9fc('0x2b')](function(){if(_[_0xa9fc('0x8a')](_0xfe671c[_0xa9fc('0x3a')][_0xa9fc('0x73')])){for(var _0x1867b4=0x0;_0x1867b4<_0xfe671c[_0xa9fc('0x3a')]['ids'][_0xa9fc('0x3f')];_0x1867b4+=0x1){socket[_0xa9fc('0x70')](_0xa9fc('0x86'),{'UserId':Number(_0xfe671c['query'][_0xa9fc('0x73')][_0x1867b4]),'MailQueueId':Number(_0xfe671c['params']['id'])});}}else{socket['emit'](_0xa9fc('0x86'),{'UserId':Number(_0xfe671c['query'][_0xa9fc('0x73')]),'MailQueueId':Number(_0xfe671c['params']['id'])});}});}})[_0xa9fc('0x2b')](respondWithStatusCode(_0x165be5,null))[_0xa9fc('0x4d')](handleError(_0x165be5,null));};exports['getAgents']=function(_0x4cd59a,_0x4186e9,_0x1b6885){var _0x4acd69={};var _0x26e075={};var _0x6cf714;var _0x764e53;return db[_0xa9fc('0x4b')][_0xa9fc('0x8b')]({'where':{'id':_0x4cd59a[_0xa9fc('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4186e9,null))[_0xa9fc('0x2b')](function(_0x2ed8ed){if(_0x2ed8ed){_0x6cf714=_0x2ed8ed;_0x26e075[_0xa9fc('0x39')]=_[_0xa9fc('0x3b')](db[_0xa9fc('0x5b')][_0xa9fc('0x36')]);_0x26e075['query']=_['keys'](_0x4cd59a[_0xa9fc('0x3a')]);_0x26e075['filters']=_[_0xa9fc('0x3c')](_0x26e075[_0xa9fc('0x39')],_0x26e075[_0xa9fc('0x3a')]);_0x4acd69['attributes']=_[_0xa9fc('0x3c')](_0x26e075[_0xa9fc('0x39')],qs['fields'](_0x4cd59a['query']['fields']));_0x4acd69[_0xa9fc('0x3d')]=_0x4acd69['attributes'][_0xa9fc('0x3f')]?_0x4acd69[_0xa9fc('0x3d')]:_0x26e075['model'];_0x4acd69[_0xa9fc('0x41')]=qs[_0xa9fc('0x42')](_0x4cd59a[_0xa9fc('0x3a')]['sort']);_0x4acd69['where']=qs['filters'](_[_0xa9fc('0x45')](_0x4cd59a[_0xa9fc('0x3a')],_0x26e075['filters']));if(_0x4cd59a['query'][_0xa9fc('0x46')]){_0x4acd69[_0xa9fc('0x43')]=_[_0xa9fc('0x47')](_0x4acd69[_0xa9fc('0x43')],{'$or':_[_0xa9fc('0x35')](_0x4acd69['attributes'],function(_0x59d3c5){var _0x5d80d4={};_0x5d80d4[_0x59d3c5]={'$like':'%'+_0x4cd59a[_0xa9fc('0x3a')][_0xa9fc('0x46')]+'%'};return _0x5d80d4;})});}_0x4acd69=_[_0xa9fc('0x47')]({},_0x4acd69,_0x4cd59a[_0xa9fc('0x49')]);return _0x6cf714[_0xa9fc('0x8c')](_0x4acd69);}})[_0xa9fc('0x2b')](function(_0x3febaa){if(_0x3febaa){_0x764e53=_0x3febaa[_0xa9fc('0x3f')];if(!_0x4cd59a[_0xa9fc('0x3a')][_0xa9fc('0x59')]('nolimit')){_0x4acd69[_0xa9fc('0x22')]=qs[_0xa9fc('0x22')](_0x4cd59a[_0xa9fc('0x3a')][_0xa9fc('0x22')]);_0x4acd69[_0xa9fc('0x21')]=qs[_0xa9fc('0x21')](_0x4cd59a[_0xa9fc('0x3a')][_0xa9fc('0x21')]);}return _0x6cf714[_0xa9fc('0x8c')](_0x4acd69);}})[_0xa9fc('0x2b')](function(_0x55098b){if(_0x55098b){return _0x55098b?{'count':_0x764e53,'rows':_0x55098b}:null;}})[_0xa9fc('0x2b')](respondWithResult(_0x4186e9,null))[_0xa9fc('0x4d')](handleError(_0x4186e9,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index d2aa897..45dcce3 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 _0xf5d8=['remove','emit','hasOwnProperty','hook','exports','events','MailQueue','setMaxListeners','save','update'];(function(_0x568a32,_0x17c98a){var _0x2a8e4f=function(_0x5438c9){while(--_0x5438c9){_0x568a32['push'](_0x568a32['shift']());}};_0x2a8e4f(++_0x17c98a);}(_0xf5d8,0x127));var _0x8f5d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf5d8[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x8f5d('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x8f5d('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x8f5d('0x2')](0x0);var events={'afterCreate':_0x8f5d('0x3'),'afterUpdate':_0x8f5d('0x4'),'afterDestroy':_0x8f5d('0x5')};function emitEvent(_0x4e4a08){return function(_0x3f537e,_0x4fb9b1,_0xa8a042){MailQueueEvents[_0x8f5d('0x6')](_0x4e4a08+':'+_0x3f537e['id'],_0x3f537e);MailQueueEvents['emit'](_0x4e4a08,_0x3f537e);_0xa8a042(null);};}for(var e in events){if(events[_0x8f5d('0x7')](e)){var event=events[e];MailQueue[_0x8f5d('0x8')](e,emitEvent(event));}}module[_0x8f5d('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x9151=['hook','../../mysqldb','MailQueue','setMaxListeners','save','update','remove','emit'];(function(_0x4113f9,_0x735e54){var _0x4ddd2c=function(_0x1e9a9e){while(--_0x1e9a9e){_0x4113f9['push'](_0x4113f9['shift']());}};_0x4ddd2c(++_0x735e54);}(_0x9151,0x149));var _0x1915=function(_0x18fc83,_0x205c12){_0x18fc83=_0x18fc83-0x0;var _0x397c28=_0x9151[_0x18fc83];return _0x397c28;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0x1915('0x0'))['db'][_0x1915('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x1915('0x2')](0x0);var events={'afterCreate':_0x1915('0x3'),'afterUpdate':_0x1915('0x4'),'afterDestroy':_0x1915('0x5')};function emitEvent(_0x406de1){return function(_0x58dacb,_0x3336fc,_0x308d48){MailQueueEvents['emit'](_0x406de1+':'+_0x58dacb['id'],_0x58dacb);MailQueueEvents[_0x1915('0x6')](_0x406de1,_0x58dacb);_0x308d48(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x1915('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 6586900..8eb60c0 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 _0xe870=['../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','../../config/logger','api','bluebird'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0xe870,0x88));var _0x0e87=function(_0x136169,_0x342894){_0x136169=_0x136169-0x0;var _0x6a24cf=_0xe870[_0x136169];return _0x6a24cf;};'use strict';var _=require(_0x0e87('0x0'));var util=require('util');var logger=require(_0x0e87('0x1'))(_0x0e87('0x2'));var moment=require('moment');var BPromise=require(_0x0e87('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0e87('0x4'));var attributes=require(_0x0e87('0x5'));module[_0x0e87('0x6')]=function(_0x4c32dc,_0x385523){return _0x4c32dc[_0x0e87('0x7')](_0x0e87('0x8'),attributes,{'tableName':_0x0e87('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba8f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailQueue'];(function(_0x30faec,_0x18940b){var _0x29484f=function(_0x169ae8){while(--_0x169ae8){_0x30faec['push'](_0x30faec['shift']());}};_0x29484f(++_0x18940b);}(_0xba8f,0x68));var _0xfba8=function(_0x460150,_0x232949){_0x460150=_0x460150-0x0;var _0x340677=_0xba8f[_0x460150];return _0x340677;};'use strict';var _=require(_0xfba8('0x0'));var util=require(_0xfba8('0x1'));var logger=require(_0xfba8('0x2'))(_0xfba8('0x3'));var moment=require(_0xfba8('0x4'));var BPromise=require(_0xfba8('0x5'));var rp=require(_0xfba8('0x6'));var fs=require('fs');var path=require(_0xfba8('0x7'));var rimraf=require(_0xfba8('0x8'));var config=require(_0xfba8('0x9'));var attributes=require('./mailQueue.attributes');module[_0xfba8('0xa')]=function(_0x419ba1,_0x302336){return _0x419ba1[_0xfba8('0xb')](_0xfba8('0xc'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index edf0c68..a0e6cb5 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 _0xbb1e=['map','catch','find','where','ShowMailQueue','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailQueue','findAll','options','raw','attributes','include','model'];(function(_0x29d2af,_0x4163a5){var _0x4de08a=function(_0x3fefa9){while(--_0x3fefa9){_0x29d2af['push'](_0x29d2af['shift']());}};_0x4de08a(++_0x4163a5);}(_0xbb1e,0x1bd));var _0xebb1=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbb1e[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0xebb1('0x0'));var moment=require(_0xebb1('0x1'));var BPromise=require(_0xebb1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xebb1('0x3'));var db=require(_0xebb1('0x4'))['db'];var utils=require(_0xebb1('0x5'));var logger=require(_0xebb1('0x6'))(_0xebb1('0x7'));var config=require(_0xebb1('0x8'));var jayson=require(_0xebb1('0x9'));var client=jayson[_0xebb1('0xa')][_0xebb1('0xb')]({'port':0x232a});config['redis']=_[_0xebb1('0xc')](config[_0xebb1('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xebb1('0xe'))(new Redis(config['redis']));require('./mailQueue.socket')[_0xebb1('0xf')](socket);function respondWithRpcPromise(_0x5c2b6a,_0x5d47c4,_0x19e5e4){return new BPromise(function(_0x47cb67,_0x2dc840){return client[_0xebb1('0x10')](_0x5c2b6a,_0x19e5e4)[_0xebb1('0x11')](function(_0x49e678){logger[_0xebb1('0x12')](_0xebb1('0x13'),_0x5d47c4,_0xebb1('0x14'));logger[_0xebb1('0x15')](_0xebb1('0x16'),_0x5d47c4,_0xebb1('0x14'),JSON[_0xebb1('0x17')](_0x49e678));if(_0x49e678[_0xebb1('0x18')]){if(_0x49e678['error'][_0xebb1('0x19')]===0x1f4){logger[_0xebb1('0x18')](_0xebb1('0x13'),_0x5d47c4,_0x49e678['error'][_0xebb1('0x1a')]);return _0x2dc840(_0x49e678[_0xebb1('0x18')][_0xebb1('0x1a')]);}logger[_0xebb1('0x18')]('MailQueue,\x20%s,\x20%s',_0x5d47c4,_0x49e678[_0xebb1('0x18')][_0xebb1('0x1a')]);return _0x47cb67(_0x49e678[_0xebb1('0x18')]['message']);}else{logger[_0xebb1('0x12')](_0xebb1('0x13'),_0x5d47c4,_0xebb1('0x14'));_0x47cb67(_0x49e678[_0xebb1('0x1b')][_0xebb1('0x1a')]);}})['catch'](function(_0x3549fb){logger[_0xebb1('0x18')](_0xebb1('0x13'),_0x5d47c4,_0x3549fb);_0x2dc840(_0x3549fb);});});}exports[_0xebb1('0x1c')]=function(_0x2107b7){var _0x2418c2=this;return new Promise(function(_0x416bf3,_0x4f2583){return db['MailQueue'][_0xebb1('0x1d')]({'raw':_0x2107b7['options']?_0x2107b7[_0xebb1('0x1e')][_0xebb1('0x1f')]===undefined?!![]:![]:!![],'where':_0x2107b7[_0xebb1('0x1e')]?_0x2107b7['options']['where']||null:null,'attributes':_0x2107b7[_0xebb1('0x1e')]?_0x2107b7[_0xebb1('0x1e')][_0xebb1('0x20')]||null:null,'limit':_0x2107b7[_0xebb1('0x1e')]?_0x2107b7[_0xebb1('0x1e')]['limit']||null:null,'include':_0x2107b7[_0xebb1('0x1e')]?_0x2107b7[_0xebb1('0x1e')][_0xebb1('0x21')]?_['map'](_0x2107b7['options']['include'],function(_0x29e67f){return{'model':db[_0x29e67f[_0xebb1('0x22')]],'as':_0x29e67f['as'],'attributes':_0x29e67f[_0xebb1('0x20')],'include':_0x29e67f[_0xebb1('0x21')]?_[_0xebb1('0x23')](_0x29e67f['include'],function(_0xdfce1f){return{'model':db[_0xdfce1f[_0xebb1('0x22')]],'as':_0xdfce1f['as'],'attributes':_0xdfce1f['attributes'],'include':_0xdfce1f[_0xebb1('0x21')]?_[_0xebb1('0x23')](_0xdfce1f[_0xebb1('0x21')],function(_0x38c26a){return{'model':db[_0x38c26a[_0xebb1('0x22')]],'as':_0x38c26a['as'],'attributes':_0x38c26a[_0xebb1('0x20')]};}):[]};}):[]};}):[]:[]})[_0xebb1('0x11')](function(_0xc2d853){logger[_0xebb1('0x12')](_0xebb1('0x1c'),_0x2107b7);logger['debug']('GetMailQueue',_0x2107b7,JSON['stringify'](_0xc2d853));_0x416bf3(_0xc2d853);})[_0xebb1('0x24')](function(_0x22e0a6){logger['error'](_0xebb1('0x1c'),_0x22e0a6[_0xebb1('0x1a')],_0x2107b7);_0x4f2583(_0x2418c2[_0xebb1('0x18')](0x1f4,_0x22e0a6['message']));});});};exports['ShowMailQueue']=function(_0x185802){var _0x39b2ed=this;return new Promise(function(_0x31511f,_0x1d55c7){return db['MailQueue'][_0xebb1('0x25')]({'raw':_0x185802[_0xebb1('0x1e')]?_0x185802[_0xebb1('0x1e')][_0xebb1('0x1f')]===undefined?!![]:![]:!![],'where':_0x185802[_0xebb1('0x1e')]?_0x185802[_0xebb1('0x1e')][_0xebb1('0x26')]||null:null,'attributes':_0x185802[_0xebb1('0x1e')]?_0x185802[_0xebb1('0x1e')][_0xebb1('0x20')]||null:null,'include':_0x185802[_0xebb1('0x1e')]?_0x185802[_0xebb1('0x1e')][_0xebb1('0x21')]?_['map'](_0x185802[_0xebb1('0x1e')][_0xebb1('0x21')],function(_0x1138c1){return{'model':db[_0x1138c1[_0xebb1('0x22')]],'as':_0x1138c1['as'],'attributes':_0x1138c1[_0xebb1('0x20')],'include':_0x1138c1['include']?_[_0xebb1('0x23')](_0x1138c1[_0xebb1('0x21')],function(_0x127523){return{'model':db[_0x127523[_0xebb1('0x22')]],'as':_0x127523['as'],'attributes':_0x127523[_0xebb1('0x20')],'include':_0x127523[_0xebb1('0x21')]?_[_0xebb1('0x23')](_0x127523['include'],function(_0x17a8a0){return{'model':db[_0x17a8a0[_0xebb1('0x22')]],'as':_0x17a8a0['as'],'attributes':_0x17a8a0[_0xebb1('0x20')]};}):[]};}):[]};}):[]:[]})[_0xebb1('0x11')](function(_0x17376a){logger['info'](_0xebb1('0x27'),_0x185802);logger['debug'](_0xebb1('0x27'),_0x185802,JSON['stringify'](_0x17376a));_0x31511f(_0x17376a);})[_0xebb1('0x24')](function(_0x9d9cc6){logger[_0xebb1('0x18')]('ShowMailQueue',_0x9d9cc6[_0xebb1('0x1a')],_0x185802);_0x1d55c7(_0x39b2ed['error'](0x1f4,_0x9d9cc6[_0xebb1('0x1a')]));});});}; \ No newline at end of file +var _0x7aaa=['ShowMailQueue','MailQueue','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','catch','GetMailQueue','options','raw','where','attributes','limit','include','map','model'];(function(_0x5ba1bc,_0x3286ad){var _0x4344db=function(_0x304d22){while(--_0x304d22){_0x5ba1bc['push'](_0x5ba1bc['shift']());}};_0x4344db(++_0x3286ad);}(_0x7aaa,0xcf));var _0xa7aa=function(_0x4877e4,_0x1bb839){_0x4877e4=_0x4877e4-0x0;var _0x1dbe1a=_0x7aaa[_0x4877e4];return _0x1dbe1a;};'use strict';var _=require('lodash');var util=require(_0xa7aa('0x0'));var moment=require(_0xa7aa('0x1'));var BPromise=require(_0xa7aa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7aa('0x3'));var db=require(_0xa7aa('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7aa('0x5'))(_0xa7aa('0x6'));var config=require(_0xa7aa('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa7aa('0x8')]({'port':0x232a});config[_0xa7aa('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa7aa('0xa'))(new Redis(config[_0xa7aa('0x9')]));require(_0xa7aa('0xb'))[_0xa7aa('0xc')](socket);function respondWithRpcPromise(_0x591d4b,_0x33a72c,_0x36fe6b){return new BPromise(function(_0x13bae9,_0x23ce54){return client['request'](_0x591d4b,_0x36fe6b)[_0xa7aa('0xd')](function(_0x5019dc){logger[_0xa7aa('0xe')](_0xa7aa('0xf'),_0x33a72c,'request\x20sent');logger[_0xa7aa('0x10')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x33a72c,'request\x20sent',JSON[_0xa7aa('0x11')](_0x5019dc));if(_0x5019dc[_0xa7aa('0x12')]){if(_0x5019dc['error']['code']===0x1f4){logger[_0xa7aa('0x12')](_0xa7aa('0xf'),_0x33a72c,_0x5019dc[_0xa7aa('0x12')][_0xa7aa('0x13')]);return _0x23ce54(_0x5019dc['error']['message']);}logger[_0xa7aa('0x12')](_0xa7aa('0xf'),_0x33a72c,_0x5019dc[_0xa7aa('0x12')][_0xa7aa('0x13')]);return _0x13bae9(_0x5019dc[_0xa7aa('0x12')][_0xa7aa('0x13')]);}else{logger['info'](_0xa7aa('0xf'),_0x33a72c,_0xa7aa('0x14'));_0x13bae9(_0x5019dc['result'][_0xa7aa('0x13')]);}})[_0xa7aa('0x15')](function(_0x135c6d){logger[_0xa7aa('0x12')]('MailQueue,\x20%s,\x20%s',_0x33a72c,_0x135c6d);_0x23ce54(_0x135c6d);});});}exports[_0xa7aa('0x16')]=function(_0x403bc8){var _0x34c343=this;return new Promise(function(_0x511f9a,_0x50f2b6){return db['MailQueue']['findAll']({'raw':_0x403bc8[_0xa7aa('0x17')]?_0x403bc8[_0xa7aa('0x17')][_0xa7aa('0x18')]===undefined?!![]:![]:!![],'where':_0x403bc8['options']?_0x403bc8[_0xa7aa('0x17')][_0xa7aa('0x19')]||null:null,'attributes':_0x403bc8[_0xa7aa('0x17')]?_0x403bc8['options'][_0xa7aa('0x1a')]||null:null,'limit':_0x403bc8[_0xa7aa('0x17')]?_0x403bc8[_0xa7aa('0x17')][_0xa7aa('0x1b')]||null:null,'include':_0x403bc8['options']?_0x403bc8[_0xa7aa('0x17')][_0xa7aa('0x1c')]?_[_0xa7aa('0x1d')](_0x403bc8[_0xa7aa('0x17')][_0xa7aa('0x1c')],function(_0x1f699b){return{'model':db[_0x1f699b['model']],'as':_0x1f699b['as'],'attributes':_0x1f699b[_0xa7aa('0x1a')],'include':_0x1f699b[_0xa7aa('0x1c')]?_[_0xa7aa('0x1d')](_0x1f699b[_0xa7aa('0x1c')],function(_0x47a032){return{'model':db[_0x47a032[_0xa7aa('0x1e')]],'as':_0x47a032['as'],'attributes':_0x47a032[_0xa7aa('0x1a')],'include':_0x47a032['include']?_[_0xa7aa('0x1d')](_0x47a032[_0xa7aa('0x1c')],function(_0x4d39d4){return{'model':db[_0x4d39d4[_0xa7aa('0x1e')]],'as':_0x4d39d4['as'],'attributes':_0x4d39d4[_0xa7aa('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa7aa('0xd')](function(_0x1c3333){logger[_0xa7aa('0xe')]('GetMailQueue',_0x403bc8);logger['debug'](_0xa7aa('0x16'),_0x403bc8,JSON['stringify'](_0x1c3333));_0x511f9a(_0x1c3333);})[_0xa7aa('0x15')](function(_0x46b656){logger[_0xa7aa('0x12')](_0xa7aa('0x16'),_0x46b656[_0xa7aa('0x13')],_0x403bc8);_0x50f2b6(_0x34c343[_0xa7aa('0x12')](0x1f4,_0x46b656['message']));});});};exports[_0xa7aa('0x1f')]=function(_0x2e939f){var _0x2bd21f=this;return new Promise(function(_0x228d6f,_0x18d5ad){return db[_0xa7aa('0x20')][_0xa7aa('0x21')]({'raw':_0x2e939f[_0xa7aa('0x17')]?_0x2e939f[_0xa7aa('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2e939f[_0xa7aa('0x17')]?_0x2e939f['options'][_0xa7aa('0x19')]||null:null,'attributes':_0x2e939f[_0xa7aa('0x17')]?_0x2e939f[_0xa7aa('0x17')]['attributes']||null:null,'include':_0x2e939f[_0xa7aa('0x17')]?_0x2e939f[_0xa7aa('0x17')]['include']?_[_0xa7aa('0x1d')](_0x2e939f[_0xa7aa('0x17')]['include'],function(_0x4b8c3e){return{'model':db[_0x4b8c3e[_0xa7aa('0x1e')]],'as':_0x4b8c3e['as'],'attributes':_0x4b8c3e[_0xa7aa('0x1a')],'include':_0x4b8c3e[_0xa7aa('0x1c')]?_[_0xa7aa('0x1d')](_0x4b8c3e[_0xa7aa('0x1c')],function(_0x3fba4a){return{'model':db[_0x3fba4a[_0xa7aa('0x1e')]],'as':_0x3fba4a['as'],'attributes':_0x3fba4a[_0xa7aa('0x1a')],'include':_0x3fba4a[_0xa7aa('0x1c')]?_[_0xa7aa('0x1d')](_0x3fba4a[_0xa7aa('0x1c')],function(_0x4356b3){return{'model':db[_0x4356b3['model']],'as':_0x4356b3['as'],'attributes':_0x4356b3[_0xa7aa('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa7aa('0xd')](function(_0x3ee4bd){logger['info']('ShowMailQueue',_0x2e939f);logger[_0xa7aa('0x10')]('ShowMailQueue',_0x2e939f,JSON[_0xa7aa('0x11')](_0x3ee4bd));_0x228d6f(_0x3ee4bd);})[_0xa7aa('0x15')](function(_0x4ba60f){logger[_0xa7aa('0x12')](_0xa7aa('0x1f'),_0x4ba60f[_0xa7aa('0x13')],_0x2e939f);_0x18d5ad(_0x2bd21f[_0xa7aa('0x12')](0x1f4,_0x4ba60f[_0xa7aa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 9e7e9b9..6948309 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 _0xcfd1=['./mailQueue.events','save','remove','update','emit','register','length','mailQueue:'];(function(_0xe22f40,_0x3331e2){var _0x226c12=function(_0x213935){while(--_0x213935){_0xe22f40['push'](_0xe22f40['shift']());}};_0x226c12(++_0x3331e2);}(_0xcfd1,0x1b8));var _0x1cfd=function(_0x4a79bd,_0x3f7827){_0x4a79bd=_0x4a79bd-0x0;var _0x26fd6a=_0xcfd1[_0x4a79bd];return _0x26fd6a;};'use strict';var MailQueueEvents=require(_0x1cfd('0x0'));var events=[_0x1cfd('0x1'),_0x1cfd('0x2'),_0x1cfd('0x3')];function createListener(_0x4e60dd,_0x10bd1b){return function(_0xa03e47){_0x10bd1b[_0x1cfd('0x4')](_0x4e60dd,_0xa03e47);};}function removeListener(_0x5e074b,_0x4f182d){return function(){MailQueueEvents['removeListener'](_0x5e074b,_0x4f182d);};}exports[_0x1cfd('0x5')]=function(_0x512b92){for(var _0x262146=0x0,_0x1a95c3=events[_0x1cfd('0x6')];_0x262146<_0x1a95c3;_0x262146++){var _0x4f6534=events[_0x262146];var _0x32f89f=createListener(_0x1cfd('0x7')+_0x4f6534,_0x512b92);MailQueueEvents['on'](_0x4f6534,_0x32f89f);}}; \ No newline at end of file +var _0x6c58=['update','removeListener','register','length','mailQueue:','./mailQueue.events','save','remove'];(function(_0x2110da,_0x206027){var _0x3a93c9=function(_0x5b19bd){while(--_0x5b19bd){_0x2110da['push'](_0x2110da['shift']());}};_0x3a93c9(++_0x206027);}(_0x6c58,0xcd));var _0x86c5=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x6c58[_0xa1e3e3];return _0xc980e9;};'use strict';var MailQueueEvents=require(_0x86c5('0x0'));var events=[_0x86c5('0x1'),_0x86c5('0x2'),_0x86c5('0x3')];function createListener(_0x5717ad,_0xe8d348){return function(_0x5f2ddb){_0xe8d348['emit'](_0x5717ad,_0x5f2ddb);};}function removeListener(_0x33717d,_0x15a092){return function(){MailQueueEvents[_0x86c5('0x4')](_0x33717d,_0x15a092);};}exports[_0x86c5('0x5')]=function(_0x2efdc4){for(var _0x3524c3=0x0,_0x47fcef=events[_0x86c5('0x6')];_0x3524c3<_0x47fcef;_0x3524c3++){var _0x40a1ea=events[_0x3524c3];var _0x1b7b34=createListener(_0x86c5('0x7')+_0x40a1ea,_0x2efdc4);MailQueueEvents['on'](_0x40a1ea,_0x1b7b34);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index c1a22ec..51c74fe 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 _0x7925=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer'];(function(_0x1f1aca,_0x13a17d){var _0x19e665=function(_0x568362){while(--_0x568362){_0x1f1aca['push'](_0x1f1aca['shift']());}};_0x19e665(++_0x13a17d);}(_0x7925,0x149));var _0x5792=function(_0x2d3f1e,_0x25f74a){_0x2d3f1e=_0x2d3f1e-0x0;var _0x256ee7=_0x7925[_0x2d3f1e];return _0x256ee7;};'use strict';var multer=require(_0x5792('0x0'));var util=require(_0x5792('0x1'));var path=require(_0x5792('0x2'));var timeout=require(_0x5792('0x3'));var express=require(_0x5792('0x4'));var router=express[_0x5792('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5792('0x6'));var interaction=require(_0x5792('0x7'));var config=require('../../config/environment');var controller=require(_0x5792('0x8'));router[_0x5792('0x9')]('/',auth[_0x5792('0xa')](),controller[_0x5792('0xb')]);router[_0x5792('0x9')](_0x5792('0xc'),auth['isAuthenticated'](),controller[_0x5792('0xd')]);router[_0x5792('0x9')](_0x5792('0xe'),auth[_0x5792('0xa')](),controller[_0x5792('0xf')]);router[_0x5792('0x10')]('/',auth[_0x5792('0xa')](),controller[_0x5792('0x11')]);router['put'](_0x5792('0xe'),auth[_0x5792('0xa')](),controller[_0x5792('0x12')]);router[_0x5792('0x13')](_0x5792('0xe'),auth[_0x5792('0xa')](),controller[_0x5792('0x14')]);module[_0x5792('0x15')]=router; \ No newline at end of file +var _0x7664=['describe','/:id','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7664,0x171));var _0x4766=function(_0x4a396a,_0x3d2662){_0x4a396a=_0x4a396a-0x0;var _0x5af067=_0x7664[_0x4a396a];return _0x5af067;};'use strict';var multer=require(_0x4766('0x0'));var util=require('util');var path=require(_0x4766('0x1'));var timeout=require(_0x4766('0x2'));var express=require(_0x4766('0x3'));var router=express[_0x4766('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4766('0x5'));var config=require(_0x4766('0x6'));var controller=require('./mailQueueReport.controller');router['get']('/',auth[_0x4766('0x7')](),controller[_0x4766('0x8')]);router[_0x4766('0x9')](_0x4766('0xa'),auth['isAuthenticated'](),controller[_0x4766('0xb')]);router[_0x4766('0x9')](_0x4766('0xc'),auth[_0x4766('0x7')](),controller['show']);router[_0x4766('0xd')]('/',auth[_0x4766('0x7')](),controller[_0x4766('0xe')]);router[_0x4766('0xf')](_0x4766('0xc'),auth[_0x4766('0x7')](),controller['update']);router[_0x4766('0x10')](_0x4766('0xc'),auth['isAuthenticated'](),controller[_0x4766('0x11')]);module[_0x4766('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index be4850a..4b1eb17 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 _0x93eb=['DATE','sequelize','exports','STRING'];(function(_0xe5dfdc,_0x23860f){var _0x35833c=function(_0x1ffbb3){while(--_0x1ffbb3){_0xe5dfdc['push'](_0xe5dfdc['shift']());}};_0x35833c(++_0x23860f);}(_0x93eb,0x1b5));var _0xb93e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x93eb[_0x122ef9];return _0x42fba0;};'use strict';var moment=require('moment');var Sequelize=require(_0xb93e('0x0'));module[_0xb93e('0x1')]={'uniqueid':{'type':Sequelize[_0xb93e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xb93e('0x2')]},'joinAt':{'type':Sequelize[_0xb93e('0x3')]},'leaveAt':{'type':Sequelize[_0xb93e('0x3')]},'acceptAt':{'type':Sequelize[_0xb93e('0x3')]},'exitAt':{'type':Sequelize[_0xb93e('0x3')]},'reason':{'type':Sequelize[_0xb93e('0x2')]}}; \ No newline at end of file +var _0x7401=['moment','exports','STRING','DATE'];(function(_0x37c9ad,_0x173774){var _0x5c43bd=function(_0x25a0f0){while(--_0x25a0f0){_0x37c9ad['push'](_0x37c9ad['shift']());}};_0x5c43bd(++_0x173774);}(_0x7401,0xf0));var _0x1740=function(_0x1f99d0,_0x3d070d){_0x1f99d0=_0x1f99d0-0x0;var _0xeb08f7=_0x7401[_0x1f99d0];return _0xeb08f7;};'use strict';var moment=require(_0x1740('0x0'));var Sequelize=require('sequelize');module[_0x1740('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x1740('0x2')]},'joinAt':{'type':Sequelize[_0x1740('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x1740('0x3')]},'exitAt':{'type':Sequelize[_0x1740('0x3')]},'reason':{'type':Sequelize[_0x1740('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 4e59254..c6d6c5c 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 _0xfcbb=['destroy','error','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','options','include','rows','catch','show','length','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then'];(function(_0x2005db,_0x340824){var _0x2bf6f6=function(_0x1cb7f3){while(--_0x1cb7f3){_0x2005db['push'](_0x2005db['shift']());}};_0x2bf6f6(++_0x340824);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x40c59a,_0x190bf0){_0x40c59a=_0x40c59a-0x0;var _0x3546d0=_0xfcbb[_0x40c59a];return _0x3546d0;};'use strict';var emlformat=require(_0xbfcb('0x0'));var rimraf=require(_0xbfcb('0x1'));var zipdir=require(_0xbfcb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbfcb('0x3'));var BPromise=require(_0xbfcb('0x4'));var Mustache=require(_0xbfcb('0x5'));var util=require(_0xbfcb('0x6'));var path=require(_0xbfcb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbfcb('0x8'));var fs=require('fs');var fs_extra=require(_0xbfcb('0x9'));var _=require(_0xbfcb('0xa'));var squel=require(_0xbfcb('0xb'));var crypto=require(_0xbfcb('0xc'));var jsforce=require(_0xbfcb('0xd'));var deskjs=require(_0xbfcb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbfcb('0xf'));var Papa=require(_0xbfcb('0x10'));var Redis=require(_0xbfcb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbfcb('0x12'));var as=require(_0xbfcb('0x13'));var hardwareService=require(_0xbfcb('0x14'));var logger=require(_0xbfcb('0x15'))(_0xbfcb('0x16'));var utils=require(_0xbfcb('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbfcb('0x18'));var db=require(_0xbfcb('0x19'))['db'];function respondWithStatusCode(_0xb2f601,_0x2268da){_0x2268da=_0x2268da||0xcc;return function(_0x4ba4f1){if(_0x4ba4f1){return _0xb2f601[_0xbfcb('0x1a')](_0x2268da);}return _0xb2f601['status'](_0x2268da)[_0xbfcb('0x1b')]();};}function respondWithResult(_0x1c52df,_0x44ad6c){_0x44ad6c=_0x44ad6c||0xc8;return function(_0x1047c4){if(_0x1047c4){return _0x1c52df[_0xbfcb('0x1c')](_0x44ad6c)[_0xbfcb('0x1d')](_0x1047c4);}};}function respondWithFilteredResult(_0x71304e,_0x2d314a){return function(_0x90ed8c){if(_0x90ed8c){var _0x339347=typeof _0x2d314a[_0xbfcb('0x1e')]===_0xbfcb('0x1f')&&typeof _0x2d314a[_0xbfcb('0x20')]===_0xbfcb('0x1f');var _0x318d07=_0x90ed8c[_0xbfcb('0x21')];var _0xba1d6=_0x339347?0x0:_0x2d314a[_0xbfcb('0x1e')];var _0x3404aa=_0x339347?_0x90ed8c[_0xbfcb('0x21')]:_0x2d314a[_0xbfcb('0x1e')]+_0x2d314a[_0xbfcb('0x20')];var _0x53c9e0;if(_0x3404aa>=_0x318d07){_0x3404aa=_0x318d07;_0x53c9e0=0xc8;}else{_0x53c9e0=0xce;}_0x71304e[_0xbfcb('0x1c')](_0x53c9e0);return _0x71304e[_0xbfcb('0x22')]('Content-Range',_0xba1d6+'-'+_0x3404aa+'/'+_0x318d07)[_0xbfcb('0x1d')](_0x90ed8c);}return null;};}function patchUpdates(_0x1a7225){return function(_0x48c3c8){try{jsonpatch['apply'](_0x48c3c8,_0x1a7225,!![]);}catch(_0x4199c5){return BPromise[_0xbfcb('0x23')](_0x4199c5);}return _0x48c3c8[_0xbfcb('0x24')]();};}function saveUpdates(_0x45661a,_0x1c5924){return function(_0x56c158){if(_0x56c158){return _0x56c158[_0xbfcb('0x25')](_0x45661a)[_0xbfcb('0x26')](function(_0x2d9288){return _0x2d9288;});}return null;};}function removeEntity(_0xd4d29,_0x1651e5){return function(_0x19616c){if(_0x19616c){return _0x19616c[_0xbfcb('0x27')]()[_0xbfcb('0x26')](function(){_0xd4d29[_0xbfcb('0x1c')](0xcc)[_0xbfcb('0x1b')]();});}};}function handleEntityNotFound(_0x1ca8c3,_0xf6dbb7){return function(_0x3ef71c){if(!_0x3ef71c){_0x1ca8c3[_0xbfcb('0x1a')](0x194);}return _0x3ef71c;};}function handleError(_0x3e954d,_0x2a1272){_0x2a1272=_0x2a1272||0x1f4;return function(_0x5cd703){logger[_0xbfcb('0x28')](_0x5cd703[_0xbfcb('0x29')]);if(_0x5cd703['name']){delete _0x5cd703[_0xbfcb('0x2a')];}_0x3e954d[_0xbfcb('0x1c')](_0x2a1272)[_0xbfcb('0x2b')](_0x5cd703);};}exports[_0xbfcb('0x2c')]=function(_0xf4b944,_0x3542e9){var _0x4069a7={},_0x1a5db2={},_0x434764={'count':0x0,'rows':[]};var _0x27606f=_['map'](db[_0xbfcb('0x2d')][_0xbfcb('0x2e')],function(_0x43c3c3){return{'name':_0x43c3c3[_0xbfcb('0x2f')],'type':_0x43c3c3[_0xbfcb('0x30')][_0xbfcb('0x31')]};});_0x1a5db2[_0xbfcb('0x32')]=_[_0xbfcb('0x33')](_0x27606f,_0xbfcb('0x2a'));_0x1a5db2['query']=_[_0xbfcb('0x34')](_0xf4b944[_0xbfcb('0x35')]);_0x1a5db2[_0xbfcb('0x36')]=_[_0xbfcb('0x37')](_0x1a5db2['model'],_0x1a5db2['query']);_0x4069a7[_0xbfcb('0x38')]=_[_0xbfcb('0x37')](_0x1a5db2[_0xbfcb('0x32')],qs[_0xbfcb('0x39')](_0xf4b944[_0xbfcb('0x35')][_0xbfcb('0x39')]));_0x4069a7[_0xbfcb('0x38')]=_0x4069a7['attributes']['length']?_0x4069a7['attributes']:_0x1a5db2[_0xbfcb('0x32')];if(!_0xf4b944['query'][_0xbfcb('0x3a')](_0xbfcb('0x3b'))){_0x4069a7['limit']=qs['limit'](_0xf4b944[_0xbfcb('0x35')][_0xbfcb('0x20')]);_0x4069a7[_0xbfcb('0x1e')]=qs[_0xbfcb('0x1e')](_0xf4b944['query'][_0xbfcb('0x1e')]);}_0x4069a7[_0xbfcb('0x3c')]=qs['sort'](_0xf4b944['query'][_0xbfcb('0x3d')]);_0x4069a7['where']=qs['filters'](_[_0xbfcb('0x3e')](_0xf4b944[_0xbfcb('0x35')],_0x1a5db2[_0xbfcb('0x36')]),_0x27606f);if(_0xf4b944[_0xbfcb('0x35')]['filter']){_0x4069a7[_0xbfcb('0x3f')]=_[_0xbfcb('0x40')](_0x4069a7[_0xbfcb('0x3f')],{'$or':_[_0xbfcb('0x33')](_0x27606f,function(_0x2289fd){if(_0x2289fd[_0xbfcb('0x30')]!=='VIRTUAL'){var _0x2fc01f={};_0x2fc01f[_0x2289fd['name']]={'$like':'%'+_0xf4b944[_0xbfcb('0x35')]['filter']+'%'};return _0x2fc01f;}})});}_0x4069a7=_[_0xbfcb('0x40')]({},_0x4069a7,_0xf4b944[_0xbfcb('0x41')]);var _0xe719cd={'where':_0x4069a7[_0xbfcb('0x3f')]};return db[_0xbfcb('0x2d')][_0xbfcb('0x21')](_0xe719cd)[_0xbfcb('0x26')](function(_0x149bd5){_0x434764[_0xbfcb('0x21')]=_0x149bd5;if(_0xf4b944[_0xbfcb('0x35')]['includeAll']){_0x4069a7[_0xbfcb('0x42')]=[{'all':!![]}];}return db[_0xbfcb('0x2d')]['findAll'](_0x4069a7);})[_0xbfcb('0x26')](function(_0x306ea4){_0x434764[_0xbfcb('0x43')]=_0x306ea4;return _0x434764;})[_0xbfcb('0x26')](respondWithFilteredResult(_0x3542e9,_0x4069a7))[_0xbfcb('0x44')](handleError(_0x3542e9,null));};exports[_0xbfcb('0x45')]=function(_0x500e7c,_0x96691c){var _0x10ffa0={'raw':!![],'where':{'id':_0x500e7c['params']['id']}},_0x10ea4f={};_0x10ea4f[_0xbfcb('0x32')]=_[_0xbfcb('0x34')](db[_0xbfcb('0x2d')]['rawAttributes']);_0x10ea4f[_0xbfcb('0x35')]=_[_0xbfcb('0x34')](_0x500e7c['query']);_0x10ea4f['filters']=_[_0xbfcb('0x37')](_0x10ea4f[_0xbfcb('0x32')],_0x10ea4f['query']);_0x10ffa0[_0xbfcb('0x38')]=_[_0xbfcb('0x37')](_0x10ea4f['model'],qs[_0xbfcb('0x39')](_0x500e7c[_0xbfcb('0x35')][_0xbfcb('0x39')]));_0x10ffa0[_0xbfcb('0x38')]=_0x10ffa0[_0xbfcb('0x38')][_0xbfcb('0x46')]?_0x10ffa0[_0xbfcb('0x38')]:_0x10ea4f[_0xbfcb('0x32')];if(_0x500e7c[_0xbfcb('0x35')][_0xbfcb('0x47')]){_0x10ffa0[_0xbfcb('0x42')]=[{'all':!![]}];}_0x10ffa0=_[_0xbfcb('0x40')]({},_0x10ffa0,_0x500e7c['options']);return db[_0xbfcb('0x2d')][_0xbfcb('0x48')](_0x10ffa0)[_0xbfcb('0x26')](handleEntityNotFound(_0x96691c,null))['then'](respondWithResult(_0x96691c,null))[_0xbfcb('0x44')](handleError(_0x96691c,null));};exports['create']=function(_0x4a3b40,_0x2dcfb3){return db[_0xbfcb('0x2d')][_0xbfcb('0x49')](_0x4a3b40['body'],{})[_0xbfcb('0x26')](respondWithResult(_0x2dcfb3,0xc9))['catch'](handleError(_0x2dcfb3,null));};exports['update']=function(_0x33725a,_0x588d32){if(_0x33725a[_0xbfcb('0x4a')]['id']){delete _0x33725a[_0xbfcb('0x4a')]['id'];}return db['MailQueueReport'][_0xbfcb('0x48')]({'where':{'id':_0x33725a['params']['id']}})[_0xbfcb('0x26')](handleEntityNotFound(_0x588d32,null))['then'](saveUpdates(_0x33725a[_0xbfcb('0x4a')],null))['then'](respondWithResult(_0x588d32,null))[_0xbfcb('0x44')](handleError(_0x588d32,null));};exports[_0xbfcb('0x27')]=function(_0x5efbe1,_0x131af7){return db['MailQueueReport']['find']({'where':{'id':_0x5efbe1[_0xbfcb('0x4b')]['id']}})[_0xbfcb('0x26')](handleEntityNotFound(_0x131af7,null))[_0xbfcb('0x26')](removeEntity(_0x131af7,null))['catch'](handleError(_0x131af7,null));};exports['describe']=function(_0x19dca9,_0x931bf){return db[_0xbfcb('0x2d')][_0xbfcb('0x4c')]()[_0xbfcb('0x26')](respondWithResult(_0x931bf,null))['catch'](handleError(_0x931bf,null));}; \ No newline at end of file +var _0x8aad=['sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x4b857f,_0x268ca1){var _0x61b032=function(_0x4cd983){while(--_0x4cd983){_0x4b857f['push'](_0x4b857f['shift']());}};_0x61b032(++_0x268ca1);}(_0x8aad,0x146));var _0xd8aa=function(_0x31859c,_0x2a8434){_0x31859c=_0x31859c-0x0;var _0x19e90d=_0x8aad[_0x31859c];return _0x19e90d;};'use strict';var emlformat=require(_0xd8aa('0x0'));var rimraf=require(_0xd8aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd8aa('0x2'));var rp=require('request-promise');var moment=require(_0xd8aa('0x3'));var BPromise=require(_0xd8aa('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd8aa('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd8aa('0x6'));var fs=require('fs');var fs_extra=require(_0xd8aa('0x7'));var _=require(_0xd8aa('0x8'));var squel=require('squel');var crypto=require(_0xd8aa('0x9'));var jsforce=require(_0xd8aa('0xa'));var deskjs=require(_0xd8aa('0xb'));var toCsv=require(_0xd8aa('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd8aa('0xd'));var authService=require(_0xd8aa('0xe'));var qs=require(_0xd8aa('0xf'));var as=require(_0xd8aa('0x10'));var hardwareService=require(_0xd8aa('0x11'));var logger=require('../../config/logger')(_0xd8aa('0x12'));var utils=require(_0xd8aa('0x13'));var config=require(_0xd8aa('0x14'));var licenseUtil=require(_0xd8aa('0x15'));var db=require(_0xd8aa('0x16'))['db'];function respondWithStatusCode(_0x6ec0eb,_0x549fad){_0x549fad=_0x549fad||0xcc;return function(_0x1e7db8){if(_0x1e7db8){return _0x6ec0eb[_0xd8aa('0x17')](_0x549fad);}return _0x6ec0eb[_0xd8aa('0x18')](_0x549fad)['end']();};}function respondWithResult(_0x5a8c79,_0x275eff){_0x275eff=_0x275eff||0xc8;return function(_0x319ffe){if(_0x319ffe){return _0x5a8c79[_0xd8aa('0x18')](_0x275eff)['json'](_0x319ffe);}};}function respondWithFilteredResult(_0x2678ed,_0x180c56){return function(_0x39b5bc){if(_0x39b5bc){var _0x404ed6=typeof _0x180c56['offset']===_0xd8aa('0x19')&&typeof _0x180c56[_0xd8aa('0x1a')]==='undefined';var _0x16d5c6=_0x39b5bc[_0xd8aa('0x1b')];var _0x32e2cd=_0x404ed6?0x0:_0x180c56[_0xd8aa('0x1c')];var _0x2d34ac=_0x404ed6?_0x39b5bc['count']:_0x180c56[_0xd8aa('0x1c')]+_0x180c56[_0xd8aa('0x1a')];var _0xb156e6;if(_0x2d34ac>=_0x16d5c6){_0x2d34ac=_0x16d5c6;_0xb156e6=0xc8;}else{_0xb156e6=0xce;}_0x2678ed[_0xd8aa('0x18')](_0xb156e6);return _0x2678ed['set'](_0xd8aa('0x1d'),_0x32e2cd+'-'+_0x2d34ac+'/'+_0x16d5c6)[_0xd8aa('0x1e')](_0x39b5bc);}return null;};}function patchUpdates(_0x46d69b){return function(_0x3588ee){try{jsonpatch[_0xd8aa('0x1f')](_0x3588ee,_0x46d69b,!![]);}catch(_0x4fe5d8){return BPromise[_0xd8aa('0x20')](_0x4fe5d8);}return _0x3588ee[_0xd8aa('0x21')]();};}function saveUpdates(_0xc4f55c,_0x5910b3){return function(_0xa7cf85){if(_0xa7cf85){return _0xa7cf85[_0xd8aa('0x22')](_0xc4f55c)[_0xd8aa('0x23')](function(_0x290849){return _0x290849;});}return null;};}function removeEntity(_0x3ef3a9,_0x16758a){return function(_0x1f64f8){if(_0x1f64f8){return _0x1f64f8[_0xd8aa('0x24')]()[_0xd8aa('0x23')](function(){_0x3ef3a9[_0xd8aa('0x18')](0xcc)[_0xd8aa('0x25')]();});}};}function handleEntityNotFound(_0x370d6f,_0x26cc66){return function(_0x5f1027){if(!_0x5f1027){_0x370d6f[_0xd8aa('0x17')](0x194);}return _0x5f1027;};}function handleError(_0x59eb3f,_0xd4d204){_0xd4d204=_0xd4d204||0x1f4;return function(_0x1f6ab2){logger[_0xd8aa('0x26')](_0x1f6ab2[_0xd8aa('0x27')]);if(_0x1f6ab2[_0xd8aa('0x28')]){delete _0x1f6ab2[_0xd8aa('0x28')];}_0x59eb3f[_0xd8aa('0x18')](_0xd4d204)[_0xd8aa('0x29')](_0x1f6ab2);};}exports['index']=function(_0x1f2a28,_0x34b792){var _0x214393={},_0x49a7c8={},_0x19a59d={'count':0x0,'rows':[]};var _0x51c6f4=_[_0xd8aa('0x2a')](db[_0xd8aa('0x2b')][_0xd8aa('0x2c')],function(_0x168a2e){return{'name':_0x168a2e[_0xd8aa('0x2d')],'type':_0x168a2e[_0xd8aa('0x2e')][_0xd8aa('0x2f')]};});_0x49a7c8[_0xd8aa('0x30')]=_['map'](_0x51c6f4,_0xd8aa('0x28'));_0x49a7c8[_0xd8aa('0x31')]=_[_0xd8aa('0x32')](_0x1f2a28[_0xd8aa('0x31')]);_0x49a7c8[_0xd8aa('0x33')]=_[_0xd8aa('0x34')](_0x49a7c8[_0xd8aa('0x30')],_0x49a7c8[_0xd8aa('0x31')]);_0x214393['attributes']=_[_0xd8aa('0x34')](_0x49a7c8[_0xd8aa('0x30')],qs[_0xd8aa('0x35')](_0x1f2a28['query'][_0xd8aa('0x35')]));_0x214393[_0xd8aa('0x36')]=_0x214393[_0xd8aa('0x36')][_0xd8aa('0x37')]?_0x214393[_0xd8aa('0x36')]:_0x49a7c8[_0xd8aa('0x30')];if(!_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x38')](_0xd8aa('0x39'))){_0x214393['limit']=qs[_0xd8aa('0x1a')](_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x1a')]);_0x214393[_0xd8aa('0x1c')]=qs[_0xd8aa('0x1c')](_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x1c')]);}_0x214393[_0xd8aa('0x3a')]=qs[_0xd8aa('0x3b')](_0x1f2a28['query'][_0xd8aa('0x3b')]);_0x214393['where']=qs[_0xd8aa('0x33')](_[_0xd8aa('0x3c')](_0x1f2a28['query'],_0x49a7c8[_0xd8aa('0x33')]),_0x51c6f4);if(_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x3d')]){_0x214393[_0xd8aa('0x3e')]=_[_0xd8aa('0x3f')](_0x214393['where'],{'$or':_['map'](_0x51c6f4,function(_0x25145c){if(_0x25145c['type']!==_0xd8aa('0x40')){var _0x7a6df2={};_0x7a6df2[_0x25145c[_0xd8aa('0x28')]]={'$like':'%'+_0x1f2a28[_0xd8aa('0x31')][_0xd8aa('0x3d')]+'%'};return _0x7a6df2;}})});}_0x214393=_[_0xd8aa('0x3f')]({},_0x214393,_0x1f2a28[_0xd8aa('0x41')]);var _0x3b0220={'where':_0x214393[_0xd8aa('0x3e')]};return db[_0xd8aa('0x2b')][_0xd8aa('0x1b')](_0x3b0220)['then'](function(_0x17ebb4){_0x19a59d[_0xd8aa('0x1b')]=_0x17ebb4;if(_0x1f2a28[_0xd8aa('0x31')]['includeAll']){_0x214393[_0xd8aa('0x42')]=[{'all':!![]}];}return db[_0xd8aa('0x2b')][_0xd8aa('0x43')](_0x214393);})[_0xd8aa('0x23')](function(_0x3a0284){_0x19a59d[_0xd8aa('0x44')]=_0x3a0284;return _0x19a59d;})[_0xd8aa('0x23')](respondWithFilteredResult(_0x34b792,_0x214393))[_0xd8aa('0x45')](handleError(_0x34b792,null));};exports[_0xd8aa('0x46')]=function(_0x3f5857,_0x20c7a0){var _0x3ec42f={'raw':!![],'where':{'id':_0x3f5857[_0xd8aa('0x47')]['id']}},_0x3b26c9={};_0x3b26c9[_0xd8aa('0x30')]=_[_0xd8aa('0x32')](db[_0xd8aa('0x2b')][_0xd8aa('0x2c')]);_0x3b26c9['query']=_[_0xd8aa('0x32')](_0x3f5857[_0xd8aa('0x31')]);_0x3b26c9[_0xd8aa('0x33')]=_[_0xd8aa('0x34')](_0x3b26c9[_0xd8aa('0x30')],_0x3b26c9[_0xd8aa('0x31')]);_0x3ec42f['attributes']=_[_0xd8aa('0x34')](_0x3b26c9['model'],qs[_0xd8aa('0x35')](_0x3f5857['query'][_0xd8aa('0x35')]));_0x3ec42f['attributes']=_0x3ec42f['attributes'][_0xd8aa('0x37')]?_0x3ec42f[_0xd8aa('0x36')]:_0x3b26c9[_0xd8aa('0x30')];if(_0x3f5857[_0xd8aa('0x31')][_0xd8aa('0x48')]){_0x3ec42f[_0xd8aa('0x42')]=[{'all':!![]}];}_0x3ec42f=_['merge']({},_0x3ec42f,_0x3f5857[_0xd8aa('0x41')]);return db[_0xd8aa('0x2b')][_0xd8aa('0x49')](_0x3ec42f)[_0xd8aa('0x23')](handleEntityNotFound(_0x20c7a0,null))[_0xd8aa('0x23')](respondWithResult(_0x20c7a0,null))['catch'](handleError(_0x20c7a0,null));};exports['create']=function(_0x58cf42,_0x1fd1dc){return db[_0xd8aa('0x2b')][_0xd8aa('0x4a')](_0x58cf42[_0xd8aa('0x4b')],{})[_0xd8aa('0x23')](respondWithResult(_0x1fd1dc,0xc9))[_0xd8aa('0x45')](handleError(_0x1fd1dc,null));};exports['update']=function(_0x221e2b,_0x241e23){if(_0x221e2b['body']['id']){delete _0x221e2b[_0xd8aa('0x4b')]['id'];}return db[_0xd8aa('0x2b')][_0xd8aa('0x49')]({'where':{'id':_0x221e2b['params']['id']}})[_0xd8aa('0x23')](handleEntityNotFound(_0x241e23,null))[_0xd8aa('0x23')](saveUpdates(_0x221e2b[_0xd8aa('0x4b')],null))[_0xd8aa('0x23')](respondWithResult(_0x241e23,null))[_0xd8aa('0x45')](handleError(_0x241e23,null));};exports[_0xd8aa('0x24')]=function(_0x4f494d,_0x566d52){return db[_0xd8aa('0x2b')][_0xd8aa('0x49')]({'where':{'id':_0x4f494d[_0xd8aa('0x47')]['id']}})[_0xd8aa('0x23')](handleEntityNotFound(_0x566d52,null))[_0xd8aa('0x23')](removeEntity(_0x566d52,null))[_0xd8aa('0x45')](handleError(_0x566d52,null));};exports[_0xd8aa('0x4c')]=function(_0x4f9d21,_0x9db7e3){return db[_0xd8aa('0x2b')]['describe']()[_0xd8aa('0x23')](respondWithResult(_0x9db7e3,null))['catch'](handleError(_0x9db7e3,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index b061307..4e89dde 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 _0xd2ae=['uniqueid','util','../../config/logger','moment','request-promise','path','rimraf','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue'];(function(_0x222b01,_0x13389c){var _0x2e3211=function(_0x85733a){while(--_0x85733a){_0x222b01['push'](_0x222b01['shift']());}};_0x2e3211(++_0x13389c);}(_0xd2ae,0x91));var _0xed2a=function(_0x11a1e4,_0x4c43ac){_0x11a1e4=_0x11a1e4-0x0;var _0x547c63=_0xd2ae[_0x11a1e4];return _0x547c63;};'use strict';var _=require('lodash');var util=require(_0xed2a('0x0'));var logger=require(_0xed2a('0x1'))('api');var moment=require(_0xed2a('0x2'));var BPromise=require('bluebird');var rp=require(_0xed2a('0x3'));var fs=require('fs');var path=require(_0xed2a('0x4'));var rimraf=require(_0xed2a('0x5'));var config=require('../../config/environment');var attributes=require(_0xed2a('0x6'));module[_0xed2a('0x7')]=function(_0xbcc416,_0xb1d3a4){return _0xbcc416[_0xed2a('0x8')](_0xed2a('0x9'),attributes,{'tableName':_0xed2a('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xed2a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4260=['path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xb8f65,_0x5b3d4f){var _0x537221=function(_0x157d70){while(--_0x157d70){_0xb8f65['push'](_0xb8f65['shift']());}};_0x537221(++_0x5b3d4f);}(_0x4260,0xa2));var _0x0426=function(_0x4e8043,_0x4daaf7){_0x4e8043=_0x4e8043-0x0;var _0x13921c=_0x4260[_0x4e8043];return _0x13921c;};'use strict';var _=require(_0x0426('0x0'));var util=require(_0x0426('0x1'));var logger=require(_0x0426('0x2'))(_0x0426('0x3'));var moment=require(_0x0426('0x4'));var BPromise=require(_0x0426('0x5'));var rp=require(_0x0426('0x6'));var fs=require('fs');var path=require(_0x0426('0x7'));var rimraf=require(_0x0426('0x8'));var config=require(_0x0426('0x9'));var attributes=require(_0x0426('0xa'));module[_0x0426('0xb')]=function(_0x4e4657,_0xf8d1d1){return _0x4e4657[_0x0426('0xc')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index e4755a0..589ab8f 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x25f686,_0x199629){var _0x54ad10=function(_0x1f9083){while(--_0x1f9083){_0x25f686['push'](_0x25f686['shift']());}};_0x54ad10(++_0x199629);}(_0x2ef3,0xba));var _0x32ef=function(_0x22517d,_0x1f9659){_0x22517d=_0x22517d-0x0;var _0x11e60b=_0x2ef3[_0x22517d];return _0x11e60b;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x450e2d,_0x381f14){var _0x234792=function(_0xecdc2b){while(--_0xecdc2b){_0x450e2d['push'](_0x450e2d['shift']());}};_0x234792(++_0x381f14);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2da4a4,_0x496c8e){_0x2da4a4=_0x2da4a4-0x0;var _0xbf9afd=_0x5f2f[_0x2da4a4];return _0xbf9afd;};'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')]('MailQueueReport,\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);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 56dc7fc..4e2205f 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5bf704,_0x2bb565){var _0xf3daf8=function(_0x55e495){while(--_0x55e495){_0x5bf704['push'](_0x5bf704['shift']());}};_0xf3daf8(++_0x2bb565);}(_0xe706,0xa3));var _0x6e70=function(_0x6c40ba,_0x5e39fa){_0x6c40ba=_0x6c40ba-0x0;var _0x7a54dd=_0xe706[_0x6c40ba];return _0x7a54dd;};'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(_0x4d5d4e,_0x1b7114){var _0x598c22=function(_0xa1f505){while(--_0xa1f505){_0x4d5d4e['push'](_0x4d5d4e['shift']());}};_0x598c22(++_0x1b7114);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5dfc2a,_0x1a953f){_0x5dfc2a=_0x5dfc2a-0x0;var _0x3f1a71=_0xcb91[_0x5dfc2a];return _0x3f1a71;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 9204022..71ce3fc 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 _0x049e=['INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x133fc0,_0x1edda8){var _0x4ce619=function(_0x308be5){while(--_0x308be5){_0x133fc0['push'](_0x133fc0['shift']());}};_0x4ce619(++_0x1edda8);}(_0x049e,0x16a));var _0xe049=function(_0xd336fa,_0x39d1b2){_0xd336fa=_0xd336fa-0x0;var _0x3370b1=_0x049e[_0xd336fa];return _0x3370b1;};'use strict';var Sequelize=require(_0xe049('0x0'));module[_0xe049('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xe049('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xe049('0x2')]},'password':{'type':Sequelize[_0xe049('0x2')]},'port':{'type':Sequelize[_0xe049('0x3')]},'tls':{'type':Sequelize[_0xe049('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xe049('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xe049('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xe049('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0xe049('0x2')]}}; \ No newline at end of file +var _0x06ef=['INTEGER','BOOLEAN','STRING'];(function(_0x20620f,_0x37c815){var _0x593a2f=function(_0x25479a){while(--_0x25479a){_0x20620f['push'](_0x20620f['shift']());}};_0x593a2f(++_0x37c815);}(_0x06ef,0x185));var _0xf06e=function(_0x5e586f,_0x4d823e){_0x5e586f=_0x5e586f-0x0;var _0x430f35=_0x06ef[_0x5e586f];return _0x430f35;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xf06e('0x0')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xf06e('0x1')]},'tls':{'type':Sequelize[_0xf06e('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xf06e('0x0')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xf06e('0x1')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xf06e('0x1')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 6bdfd10..bec3b3d 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 _0x5c50=['define','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports'];(function(_0x258eaa,_0xcce177){var _0x5a4641=function(_0xdc0b8d){while(--_0xdc0b8d){_0x258eaa['push'](_0x258eaa['shift']());}};_0x5a4641(++_0xcce177);}(_0x5c50,0xf3));var _0x05c5=function(_0xbced40,_0x2fa5f0){_0xbced40=_0xbced40-0x0;var _0x230f2e=_0x5c50[_0xbced40];return _0x230f2e;};'use strict';var _=require(_0x05c5('0x0'));var util=require(_0x05c5('0x1'));var logger=require(_0x05c5('0x2'))('api');var moment=require('moment');var BPromise=require(_0x05c5('0x3'));var rp=require(_0x05c5('0x4'));var fs=require('fs');var path=require(_0x05c5('0x5'));var rimraf=require(_0x05c5('0x6'));var config=require(_0x05c5('0x7'));var attributes=require(_0x05c5('0x8'));module[_0x05c5('0x9')]=function(_0x319938,_0x111511){return _0x319938[_0x05c5('0xa')]('MailServerIn',attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ce8=['util','api','moment','bluebird','request-promise','rimraf','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in'];(function(_0x4f3efa,_0xa7d512){var _0x5622ab=function(_0x212b1c){while(--_0x212b1c){_0x4f3efa['push'](_0x4f3efa['shift']());}};_0x5622ab(++_0xa7d512);}(_0x2ce8,0x129));var _0x82ce=function(_0x1162f9,_0x35f87c){_0x1162f9=_0x1162f9-0x0;var _0x75257c=_0x2ce8[_0x1162f9];return _0x75257c;};'use strict';var _=require('lodash');var util=require(_0x82ce('0x0'));var logger=require('../../config/logger')(_0x82ce('0x1'));var moment=require(_0x82ce('0x2'));var BPromise=require(_0x82ce('0x3'));var rp=require(_0x82ce('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x82ce('0x5'));var config=require('../../config/environment');var attributes=require(_0x82ce('0x6'));module[_0x82ce('0x7')]=function(_0x3b1903,_0x19e799){return _0x3b1903[_0x82ce('0x8')](_0x82ce('0x9'),attributes,{'tableName':_0x82ce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index e420da8..277fb41 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 _0xb11e=['message','result','GetMailServerIn','options','where','attributes','map','model','include','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x75b25d,_0x3fbae3){var _0x3400de=function(_0x380c27){while(--_0x380c27){_0x75b25d['push'](_0x75b25d['shift']());}};_0x3400de(++_0x3fbae3);}(_0xb11e,0x7d));var _0xeb11=function(_0x40d4ff,_0x36fa97){_0x40d4ff=_0x40d4ff-0x0;var _0x296811=_0xb11e[_0x40d4ff];return _0x296811;};'use strict';var _=require(_0xeb11('0x0'));var util=require(_0xeb11('0x1'));var moment=require(_0xeb11('0x2'));var BPromise=require(_0xeb11('0x3'));var rs=require(_0xeb11('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeb11('0x5'));var logger=require(_0xeb11('0x6'))(_0xeb11('0x7'));var config=require(_0xeb11('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xeb11('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53b7a1,_0x203d78,_0x4994a2){return new BPromise(function(_0x5e5648,_0xfa9ff7){return client[_0xeb11('0xa')](_0x53b7a1,_0x4994a2)[_0xeb11('0xb')](function(_0x4841d3){logger[_0xeb11('0xc')](_0xeb11('0xd'),_0x203d78,_0xeb11('0xe'));logger[_0xeb11('0xf')](_0xeb11('0x10'),_0x203d78,_0xeb11('0xe'),JSON[_0xeb11('0x11')](_0x4841d3));if(_0x4841d3[_0xeb11('0x12')]){if(_0x4841d3['error'][_0xeb11('0x13')]===0x1f4){logger[_0xeb11('0x12')](_0xeb11('0xd'),_0x203d78,_0x4841d3['error'][_0xeb11('0x14')]);return _0xfa9ff7(_0x4841d3['error'][_0xeb11('0x14')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x203d78,_0x4841d3[_0xeb11('0x12')][_0xeb11('0x14')]);return _0x5e5648(_0x4841d3[_0xeb11('0x12')][_0xeb11('0x14')]);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x203d78,_0xeb11('0xe'));_0x5e5648(_0x4841d3[_0xeb11('0x15')][_0xeb11('0x14')]);}})['catch'](function(_0x23acb4){logger['error'](_0xeb11('0xd'),_0x203d78,_0x23acb4);_0xfa9ff7(_0x23acb4);});});}exports[_0xeb11('0x16')]=function(_0x139ff8){var _0x4b2a4a=this;return new Promise(function(_0xf36770,_0x2ef18b){return db['MailServerIn']['findAll']({'raw':_0x139ff8[_0xeb11('0x17')]?_0x139ff8[_0xeb11('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x139ff8['options']?_0x139ff8[_0xeb11('0x17')][_0xeb11('0x18')]||null:null,'attributes':_0x139ff8['options']?_0x139ff8['options'][_0xeb11('0x19')]||null:null,'limit':_0x139ff8['options']?_0x139ff8['options']['limit']||null:null,'include':_0x139ff8[_0xeb11('0x17')]?_0x139ff8[_0xeb11('0x17')]['include']?_[_0xeb11('0x1a')](_0x139ff8[_0xeb11('0x17')]['include'],function(_0x1c526d){return{'model':db[_0x1c526d[_0xeb11('0x1b')]],'as':_0x1c526d['as'],'attributes':_0x1c526d[_0xeb11('0x19')],'include':_0x1c526d['include']?_[_0xeb11('0x1a')](_0x1c526d['include'],function(_0x5b97b5){return{'model':db[_0x5b97b5[_0xeb11('0x1b')]],'as':_0x5b97b5['as'],'attributes':_0x5b97b5[_0xeb11('0x19')],'include':_0x5b97b5[_0xeb11('0x1c')]?_['map'](_0x5b97b5['include'],function(_0xca08dd){return{'model':db[_0xca08dd['model']],'as':_0xca08dd['as'],'attributes':_0xca08dd[_0xeb11('0x19')]};}):[]};}):[]};}):[]:[]})[_0xeb11('0xb')](function(_0x377abf){logger[_0xeb11('0xc')](_0xeb11('0x16'),_0x139ff8);logger['debug'](_0xeb11('0x16'),_0x139ff8,JSON[_0xeb11('0x11')](_0x377abf));_0xf36770(_0x377abf);})['catch'](function(_0x104561){logger['error'](_0xeb11('0x16'),_0x104561[_0xeb11('0x14')],_0x139ff8);_0x2ef18b(_0x4b2a4a[_0xeb11('0x12')](0x1f4,_0x104561[_0xeb11('0x14')]));});});}; \ No newline at end of file +var _0x1b20=['../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','ioredis','../../mysqldb','rpc'];(function(_0x28f007,_0x2ff76a){var _0x5e2bac=function(_0x2a6ada){while(--_0x2a6ada){_0x28f007['push'](_0x28f007['shift']());}};_0x5e2bac(++_0x2ff76a);}(_0x1b20,0x1c8));var _0x01b2=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x1b20[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x01b2('0x0'));var util=require(_0x01b2('0x1'));var moment=require(_0x01b2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01b2('0x3'));var db=require(_0x01b2('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x01b2('0x5'));var config=require(_0x01b2('0x6'));var jayson=require(_0x01b2('0x7'));var client=jayson[_0x01b2('0x8')][_0x01b2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x297f98,_0x19c39e,_0x34fb62){return new BPromise(function(_0x1a9250,_0x2c855d){return client[_0x01b2('0xa')](_0x297f98,_0x34fb62)[_0x01b2('0xb')](function(_0x3f8e8a){logger[_0x01b2('0xc')](_0x01b2('0xd'),_0x19c39e,_0x01b2('0xe'));logger[_0x01b2('0xf')](_0x01b2('0x10'),_0x19c39e,'request\x20sent',JSON[_0x01b2('0x11')](_0x3f8e8a));if(_0x3f8e8a[_0x01b2('0x12')]){if(_0x3f8e8a[_0x01b2('0x12')][_0x01b2('0x13')]===0x1f4){logger[_0x01b2('0x12')](_0x01b2('0xd'),_0x19c39e,_0x3f8e8a[_0x01b2('0x12')]['message']);return _0x2c855d(_0x3f8e8a['error']['message']);}logger[_0x01b2('0x12')]('MailServerIn,\x20%s,\x20%s',_0x19c39e,_0x3f8e8a[_0x01b2('0x12')]['message']);return _0x1a9250(_0x3f8e8a[_0x01b2('0x12')][_0x01b2('0x14')]);}else{logger[_0x01b2('0xc')](_0x01b2('0xd'),_0x19c39e,_0x01b2('0xe'));_0x1a9250(_0x3f8e8a[_0x01b2('0x15')]['message']);}})[_0x01b2('0x16')](function(_0x33580c){logger[_0x01b2('0x12')]('MailServerIn,\x20%s,\x20%s',_0x19c39e,_0x33580c);_0x2c855d(_0x33580c);});});}exports[_0x01b2('0x17')]=function(_0x2892e4){var _0x33a1c9=this;return new Promise(function(_0x37624a,_0x4b8c44){return db[_0x01b2('0x18')]['findAll']({'raw':_0x2892e4[_0x01b2('0x19')]?_0x2892e4[_0x01b2('0x19')][_0x01b2('0x1a')]===undefined?!![]:![]:!![],'where':_0x2892e4[_0x01b2('0x19')]?_0x2892e4['options'][_0x01b2('0x1b')]||null:null,'attributes':_0x2892e4['options']?_0x2892e4['options'][_0x01b2('0x1c')]||null:null,'limit':_0x2892e4[_0x01b2('0x19')]?_0x2892e4[_0x01b2('0x19')][_0x01b2('0x1d')]||null:null,'include':_0x2892e4[_0x01b2('0x19')]?_0x2892e4[_0x01b2('0x19')][_0x01b2('0x1e')]?_[_0x01b2('0x1f')](_0x2892e4['options']['include'],function(_0x457868){return{'model':db[_0x457868[_0x01b2('0x20')]],'as':_0x457868['as'],'attributes':_0x457868[_0x01b2('0x1c')],'include':_0x457868[_0x01b2('0x1e')]?_['map'](_0x457868[_0x01b2('0x1e')],function(_0x174cb4){return{'model':db[_0x174cb4['model']],'as':_0x174cb4['as'],'attributes':_0x174cb4[_0x01b2('0x1c')],'include':_0x174cb4[_0x01b2('0x1e')]?_[_0x01b2('0x1f')](_0x174cb4[_0x01b2('0x1e')],function(_0x5d0791){return{'model':db[_0x5d0791[_0x01b2('0x20')]],'as':_0x5d0791['as'],'attributes':_0x5d0791[_0x01b2('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x01b2('0xb')](function(_0x14fd9b){logger[_0x01b2('0xc')](_0x01b2('0x17'),_0x2892e4);logger[_0x01b2('0xf')](_0x01b2('0x17'),_0x2892e4,JSON[_0x01b2('0x11')](_0x14fd9b));_0x37624a(_0x14fd9b);})['catch'](function(_0x50605){logger[_0x01b2('0x12')](_0x01b2('0x17'),_0x50605['message'],_0x2892e4);_0x4b8c44(_0x33a1c9['error'](0x1f4,_0x50605[_0x01b2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 5548471..31c35e9 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(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x7a54,0x106));var _0x47a5=function(_0x57165c,_0x492e1d){_0x57165c=_0x57165c-0x0;var _0x5c5b56=_0x7a54[_0x57165c];return _0x5c5b56;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x7a54,0x106));var _0x47a5=function(_0x4c4d19,_0x30a6b1){_0x4c4d19=_0x4c4d19-0x0;var _0x5e1273=_0x7a54[_0x4c4d19];return _0x5e1273;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 7ff2a36..444a1ad 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 _0x2bd4=['exports','STRING','BOOLEAN','sequelize'];(function(_0x57c8ba,_0x727b85){var _0x12411d=function(_0x18d56c){while(--_0x18d56c){_0x57c8ba['push'](_0x57c8ba['shift']());}};_0x12411d(++_0x727b85);}(_0x2bd4,0x103));var _0x42bd=function(_0x4e8378,_0x5c2ccc){_0x4e8378=_0x4e8378-0x0;var _0x546419=_0x2bd4[_0x4e8378];return _0x546419;};'use strict';var Sequelize=require(_0x42bd('0x0'));module[_0x42bd('0x1')]={'description':{'type':Sequelize[_0x42bd('0x2')]},'host':{'type':Sequelize[_0x42bd('0x2')]},'user':{'type':Sequelize[_0x42bd('0x2')]},'pass':{'type':Sequelize[_0x42bd('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x42bd('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x42bd('0x2')]},'authentication':{'type':Sequelize[_0x42bd('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x094f=['exports','STRING'];(function(_0x1ef881,_0x59ca82){var _0x244898=function(_0x5ea3e4){while(--_0x5ea3e4){_0x1ef881['push'](_0x1ef881['shift']());}};_0x244898(++_0x59ca82);}(_0x094f,0x150));var _0xf094=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0x094f[_0x9e0cb3];return _0x5926b7;};'use strict';var Sequelize=require('sequelize');module[_0xf094('0x0')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xf094('0x1')]},'user':{'type':Sequelize[_0xf094('0x1')]},'pass':{'type':Sequelize[_0xf094('0x1')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xf094('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 724635f..ff5a897 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 _0x89b5=['offset','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailServerOut','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x589f05,_0x1c5a16){var _0x3a11b4=function(_0x1ec7fb){while(--_0x1ec7fb){_0x589f05['push'](_0x589f05['shift']());}};_0x3a11b4(++_0x1c5a16);}(_0x89b5,0x195));var _0x589b=function(_0x35d469,_0x4b319e){_0x35d469=_0x35d469-0x0;var _0xab1023=_0x89b5[_0x35d469];return _0xab1023;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x589b('0x0'));var zipdir=require(_0x589b('0x1'));var jsonpatch=require(_0x589b('0x2'));var rp=require(_0x589b('0x3'));var moment=require(_0x589b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x589b('0x5'));var csv=require(_0x589b('0x6'));var ejs=require(_0x589b('0x7'));var fs=require('fs');var fs_extra=require(_0x589b('0x8'));var _=require(_0x589b('0x9'));var squel=require(_0x589b('0xa'));var crypto=require(_0x589b('0xb'));var jsforce=require(_0x589b('0xc'));var deskjs=require(_0x589b('0xd'));var toCsv=require(_0x589b('0x6'));var querystring=require('querystring');var Papa=require(_0x589b('0xe'));var Redis=require(_0x589b('0xf'));var authService=require(_0x589b('0x10'));var qs=require(_0x589b('0x11'));var as=require(_0x589b('0x12'));var hardwareService=require(_0x589b('0x13'));var logger=require(_0x589b('0x14'))('api');var utils=require(_0x589b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x589b('0x16'));var db=require(_0x589b('0x17'))['db'];function respondWithStatusCode(_0x447253,_0x5d78bd){_0x5d78bd=_0x5d78bd||0xcc;return function(_0x4007ca){if(_0x4007ca){return _0x447253[_0x589b('0x18')](_0x5d78bd);}return _0x447253[_0x589b('0x19')](_0x5d78bd)['end']();};}function respondWithResult(_0x2862c7,_0x72d6f6){_0x72d6f6=_0x72d6f6||0xc8;return function(_0x539f90){if(_0x539f90){return _0x2862c7[_0x589b('0x19')](_0x72d6f6)[_0x589b('0x1a')](_0x539f90);}};}function respondWithFilteredResult(_0xaedeed,_0x1cd515){return function(_0x22045b){if(_0x22045b){var _0x3d64ff=typeof _0x1cd515[_0x589b('0x1b')]==='undefined'&&typeof _0x1cd515['limit']==='undefined';var _0x2f9586=_0x22045b[_0x589b('0x1c')];var _0x36589e=_0x3d64ff?0x0:_0x1cd515[_0x589b('0x1b')];var _0x2b58e0=_0x3d64ff?_0x22045b[_0x589b('0x1c')]:_0x1cd515[_0x589b('0x1b')]+_0x1cd515['limit'];var _0x30fe12;if(_0x2b58e0>=_0x2f9586){_0x2b58e0=_0x2f9586;_0x30fe12=0xc8;}else{_0x30fe12=0xce;}_0xaedeed[_0x589b('0x19')](_0x30fe12);return _0xaedeed['set'](_0x589b('0x1d'),_0x36589e+'-'+_0x2b58e0+'/'+_0x2f9586)[_0x589b('0x1a')](_0x22045b);}return null;};}function patchUpdates(_0x54a1ac){return function(_0x26fccd){try{jsonpatch[_0x589b('0x1e')](_0x26fccd,_0x54a1ac,!![]);}catch(_0x24f22b){return BPromise[_0x589b('0x1f')](_0x24f22b);}return _0x26fccd[_0x589b('0x20')]();};}function saveUpdates(_0x1afa99,_0x53bc6a){return function(_0x10cb1e){if(_0x10cb1e){return _0x10cb1e[_0x589b('0x21')](_0x1afa99)[_0x589b('0x22')](function(_0x49d3e7){return _0x49d3e7;});}return null;};}function removeEntity(_0x8cdc96,_0x495b68){return function(_0x5431d8){if(_0x5431d8){return _0x5431d8[_0x589b('0x23')]()[_0x589b('0x22')](function(){_0x8cdc96['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x33ad97,_0x3f10e8){return function(_0x666aa9){if(!_0x666aa9){_0x33ad97[_0x589b('0x18')](0x194);}return _0x666aa9;};}function handleError(_0x36f24a,_0x5ed0a0){_0x5ed0a0=_0x5ed0a0||0x1f4;return function(_0x2c9d45){logger[_0x589b('0x24')](_0x2c9d45[_0x589b('0x25')]);if(_0x2c9d45[_0x589b('0x26')]){delete _0x2c9d45[_0x589b('0x26')];}_0x36f24a[_0x589b('0x19')](_0x5ed0a0)[_0x589b('0x27')](_0x2c9d45);};}exports[_0x589b('0x28')]=function(_0x27c908,_0x51e856){var _0x58da74={},_0x5d8c81={},_0x51bd73={'count':0x0,'rows':[]};var _0x3a161f=_[_0x589b('0x29')](db[_0x589b('0x2a')]['rawAttributes'],function(_0xca558c){return{'name':_0xca558c[_0x589b('0x2b')],'type':_0xca558c[_0x589b('0x2c')][_0x589b('0x2d')]};});_0x5d8c81[_0x589b('0x2e')]=_[_0x589b('0x29')](_0x3a161f,_0x589b('0x26'));_0x5d8c81[_0x589b('0x2f')]=_[_0x589b('0x30')](_0x27c908[_0x589b('0x2f')]);_0x5d8c81[_0x589b('0x31')]=_[_0x589b('0x32')](_0x5d8c81[_0x589b('0x2e')],_0x5d8c81['query']);_0x58da74[_0x589b('0x33')]=_[_0x589b('0x32')](_0x5d8c81['model'],qs[_0x589b('0x34')](_0x27c908[_0x589b('0x2f')][_0x589b('0x34')]));_0x58da74[_0x589b('0x33')]=_0x58da74['attributes'][_0x589b('0x35')]?_0x58da74['attributes']:_0x5d8c81['model'];if(!_0x27c908[_0x589b('0x2f')]['hasOwnProperty']('nolimit')){_0x58da74['limit']=qs[_0x589b('0x36')](_0x27c908['query'][_0x589b('0x36')]);_0x58da74['offset']=qs[_0x589b('0x1b')](_0x27c908[_0x589b('0x2f')][_0x589b('0x1b')]);}_0x58da74[_0x589b('0x37')]=qs[_0x589b('0x38')](_0x27c908[_0x589b('0x2f')][_0x589b('0x38')]);_0x58da74[_0x589b('0x39')]=qs[_0x589b('0x31')](_['pick'](_0x27c908[_0x589b('0x2f')],_0x5d8c81[_0x589b('0x31')]),_0x3a161f);if(_0x27c908['query'][_0x589b('0x3a')]){_0x58da74[_0x589b('0x39')]=_[_0x589b('0x3b')](_0x58da74['where'],{'$or':_[_0x589b('0x29')](_0x3a161f,function(_0x1f714e){if(_0x1f714e[_0x589b('0x2c')]!==_0x589b('0x3c')){var _0x34e68c={};_0x34e68c[_0x1f714e[_0x589b('0x26')]]={'$like':'%'+_0x27c908[_0x589b('0x2f')][_0x589b('0x3a')]+'%'};return _0x34e68c;}})});}_0x58da74=_['merge']({},_0x58da74,_0x27c908[_0x589b('0x3d')]);var _0x952acc={'where':_0x58da74[_0x589b('0x39')]};return db[_0x589b('0x2a')][_0x589b('0x1c')](_0x952acc)['then'](function(_0x4bebc9){_0x51bd73[_0x589b('0x1c')]=_0x4bebc9;if(_0x27c908[_0x589b('0x2f')][_0x589b('0x3e')]){_0x58da74['include']=[{'all':!![]}];}return db[_0x589b('0x2a')][_0x589b('0x3f')](_0x58da74);})[_0x589b('0x22')](function(_0x27d6d8){_0x51bd73[_0x589b('0x40')]=_0x27d6d8;return _0x51bd73;})[_0x589b('0x22')](respondWithFilteredResult(_0x51e856,_0x58da74))[_0x589b('0x41')](handleError(_0x51e856,null));};exports[_0x589b('0x42')]=function(_0x59b089,_0x36fc8a){var _0x71df7d={'raw':!![],'where':{'id':_0x59b089[_0x589b('0x43')]['id']}},_0x5dc1ef={};_0x5dc1ef[_0x589b('0x2e')]=_[_0x589b('0x30')](db[_0x589b('0x2a')]['rawAttributes']);_0x5dc1ef[_0x589b('0x2f')]=_['keys'](_0x59b089['query']);_0x5dc1ef['filters']=_[_0x589b('0x32')](_0x5dc1ef[_0x589b('0x2e')],_0x5dc1ef[_0x589b('0x2f')]);_0x71df7d[_0x589b('0x33')]=_[_0x589b('0x32')](_0x5dc1ef[_0x589b('0x2e')],qs[_0x589b('0x34')](_0x59b089[_0x589b('0x2f')][_0x589b('0x34')]));_0x71df7d['attributes']=_0x71df7d[_0x589b('0x33')]['length']?_0x71df7d['attributes']:_0x5dc1ef[_0x589b('0x2e')];if(_0x59b089['query'][_0x589b('0x3e')]){_0x71df7d[_0x589b('0x44')]=[{'all':!![]}];}_0x71df7d=_[_0x589b('0x3b')]({},_0x71df7d,_0x59b089[_0x589b('0x3d')]);return db['MailServerOut'][_0x589b('0x45')](_0x71df7d)[_0x589b('0x22')](handleEntityNotFound(_0x36fc8a,null))[_0x589b('0x22')](respondWithResult(_0x36fc8a,null))[_0x589b('0x41')](handleError(_0x36fc8a,null));};exports[_0x589b('0x46')]=function(_0x4e3bc9,_0x4d0a79){return db[_0x589b('0x2a')][_0x589b('0x46')](_0x4e3bc9[_0x589b('0x47')],{})[_0x589b('0x22')](respondWithResult(_0x4d0a79,0xc9))['catch'](handleError(_0x4d0a79,null));};exports[_0x589b('0x21')]=function(_0x3482a2,_0x1a3548){if(_0x3482a2['body']['id']){delete _0x3482a2[_0x589b('0x47')]['id'];}return db[_0x589b('0x2a')][_0x589b('0x45')]({'where':{'id':_0x3482a2[_0x589b('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a3548,null))[_0x589b('0x22')](saveUpdates(_0x3482a2[_0x589b('0x47')],null))['then'](respondWithResult(_0x1a3548,null))['catch'](handleError(_0x1a3548,null));};exports['destroy']=function(_0x1dfe14,_0xc19859){return db[_0x589b('0x2a')]['find']({'where':{'id':_0x1dfe14[_0x589b('0x43')]['id']}})[_0x589b('0x22')](handleEntityNotFound(_0xc19859,null))[_0x589b('0x22')](removeEntity(_0xc19859,null))['catch'](handleError(_0xc19859,null));}; \ No newline at end of file +var _0x1ad5=['lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','count','limit','reject','save','update','then','sendStatus','error','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','MailServerOut','includeAll','include','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x1ad5,0x87));var _0x51ad=function(_0x1e17eb,_0x2e15c5){_0x1e17eb=_0x1e17eb-0x0;var _0x4de4c7=_0x1ad5[_0x1e17eb];return _0x4de4c7;};'use strict';var emlformat=require(_0x51ad('0x0'));var rimraf=require(_0x51ad('0x1'));var zipdir=require(_0x51ad('0x2'));var jsonpatch=require(_0x51ad('0x3'));var rp=require(_0x51ad('0x4'));var moment=require(_0x51ad('0x5'));var BPromise=require(_0x51ad('0x6'));var Mustache=require(_0x51ad('0x7'));var util=require('util');var path=require('path');var sox=require(_0x51ad('0x8'));var csv=require('to-csv');var ejs=require(_0x51ad('0x9'));var fs=require('fs');var fs_extra=require(_0x51ad('0xa'));var _=require(_0x51ad('0xb'));var squel=require(_0x51ad('0xc'));var crypto=require(_0x51ad('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x51ad('0xe'));var toCsv=require(_0x51ad('0xf'));var querystring=require(_0x51ad('0x10'));var Papa=require(_0x51ad('0x11'));var Redis=require(_0x51ad('0x12'));var authService=require(_0x51ad('0x13'));var qs=require(_0x51ad('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x51ad('0x15'));var logger=require(_0x51ad('0x16'))(_0x51ad('0x17'));var utils=require(_0x51ad('0x18'));var config=require(_0x51ad('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bef9e,_0x323c67){_0x323c67=_0x323c67||0xcc;return function(_0x2540a9){if(_0x2540a9){return _0x1bef9e['sendStatus'](_0x323c67);}return _0x1bef9e[_0x51ad('0x1a')](_0x323c67)[_0x51ad('0x1b')]();};}function respondWithResult(_0x472c21,_0x4b1f9d){_0x4b1f9d=_0x4b1f9d||0xc8;return function(_0x11f963){if(_0x11f963){return _0x472c21['status'](_0x4b1f9d)[_0x51ad('0x1c')](_0x11f963);}};}function respondWithFilteredResult(_0x510223,_0x23302c){return function(_0x4bcf1c){if(_0x4bcf1c){var _0x329211=typeof _0x23302c[_0x51ad('0x1d')]===_0x51ad('0x1e')&&typeof _0x23302c['limit']==='undefined';var _0x4a18b9=_0x4bcf1c['count'];var _0x1d2903=_0x329211?0x0:_0x23302c['offset'];var _0x2b2f8a=_0x329211?_0x4bcf1c[_0x51ad('0x1f')]:_0x23302c[_0x51ad('0x1d')]+_0x23302c[_0x51ad('0x20')];var _0x5b1fba;if(_0x2b2f8a>=_0x4a18b9){_0x2b2f8a=_0x4a18b9;_0x5b1fba=0xc8;}else{_0x5b1fba=0xce;}_0x510223[_0x51ad('0x1a')](_0x5b1fba);return _0x510223['set']('Content-Range',_0x1d2903+'-'+_0x2b2f8a+'/'+_0x4a18b9)[_0x51ad('0x1c')](_0x4bcf1c);}return null;};}function patchUpdates(_0x3a69c7){return function(_0x2a1ef7){try{jsonpatch['apply'](_0x2a1ef7,_0x3a69c7,!![]);}catch(_0x1f3212){return BPromise[_0x51ad('0x21')](_0x1f3212);}return _0x2a1ef7[_0x51ad('0x22')]();};}function saveUpdates(_0x592b92,_0x238aa7){return function(_0x1ee062){if(_0x1ee062){return _0x1ee062[_0x51ad('0x23')](_0x592b92)[_0x51ad('0x24')](function(_0x5dfc20){return _0x5dfc20;});}return null;};}function removeEntity(_0x4b05c2,_0x3fde6d){return function(_0x159fc9){if(_0x159fc9){return _0x159fc9['destroy']()['then'](function(){_0x4b05c2[_0x51ad('0x1a')](0xcc)[_0x51ad('0x1b')]();});}};}function handleEntityNotFound(_0x52dbc9,_0x3f88a1){return function(_0x4b19e9){if(!_0x4b19e9){_0x52dbc9[_0x51ad('0x25')](0x194);}return _0x4b19e9;};}function handleError(_0x294a9b,_0x4d9354){_0x4d9354=_0x4d9354||0x1f4;return function(_0x24fb09){logger[_0x51ad('0x26')](_0x24fb09[_0x51ad('0x27')]);if(_0x24fb09[_0x51ad('0x28')]){delete _0x24fb09[_0x51ad('0x28')];}_0x294a9b[_0x51ad('0x1a')](_0x4d9354)[_0x51ad('0x29')](_0x24fb09);};}exports[_0x51ad('0x2a')]=function(_0x46df3f,_0x486f6f){var _0x5a58bc={},_0x4e8426={},_0x2ca774={'count':0x0,'rows':[]};var _0x2e8cdf=_[_0x51ad('0x2b')](db['MailServerOut']['rawAttributes'],function(_0xa77fa1){return{'name':_0xa77fa1[_0x51ad('0x2c')],'type':_0xa77fa1[_0x51ad('0x2d')]['key']};});_0x4e8426[_0x51ad('0x2e')]=_[_0x51ad('0x2b')](_0x2e8cdf,'name');_0x4e8426[_0x51ad('0x2f')]=_[_0x51ad('0x30')](_0x46df3f['query']);_0x4e8426[_0x51ad('0x31')]=_[_0x51ad('0x32')](_0x4e8426['model'],_0x4e8426[_0x51ad('0x2f')]);_0x5a58bc[_0x51ad('0x33')]=_[_0x51ad('0x32')](_0x4e8426[_0x51ad('0x2e')],qs[_0x51ad('0x34')](_0x46df3f[_0x51ad('0x2f')][_0x51ad('0x34')]));_0x5a58bc[_0x51ad('0x33')]=_0x5a58bc[_0x51ad('0x33')][_0x51ad('0x35')]?_0x5a58bc[_0x51ad('0x33')]:_0x4e8426['model'];if(!_0x46df3f[_0x51ad('0x2f')][_0x51ad('0x36')](_0x51ad('0x37'))){_0x5a58bc[_0x51ad('0x20')]=qs[_0x51ad('0x20')](_0x46df3f[_0x51ad('0x2f')]['limit']);_0x5a58bc[_0x51ad('0x1d')]=qs[_0x51ad('0x1d')](_0x46df3f[_0x51ad('0x2f')][_0x51ad('0x1d')]);}_0x5a58bc[_0x51ad('0x38')]=qs[_0x51ad('0x39')](_0x46df3f[_0x51ad('0x2f')]['sort']);_0x5a58bc[_0x51ad('0x3a')]=qs['filters'](_[_0x51ad('0x3b')](_0x46df3f[_0x51ad('0x2f')],_0x4e8426[_0x51ad('0x31')]),_0x2e8cdf);if(_0x46df3f[_0x51ad('0x2f')][_0x51ad('0x3c')]){_0x5a58bc[_0x51ad('0x3a')]=_[_0x51ad('0x3d')](_0x5a58bc[_0x51ad('0x3a')],{'$or':_[_0x51ad('0x2b')](_0x2e8cdf,function(_0x4c4e6c){if(_0x4c4e6c['type']!=='VIRTUAL'){var _0x42df65={};_0x42df65[_0x4c4e6c[_0x51ad('0x28')]]={'$like':'%'+_0x46df3f['query']['filter']+'%'};return _0x42df65;}})});}_0x5a58bc=_['merge']({},_0x5a58bc,_0x46df3f[_0x51ad('0x3e')]);var _0x1c662f={'where':_0x5a58bc[_0x51ad('0x3a')]};return db[_0x51ad('0x3f')][_0x51ad('0x1f')](_0x1c662f)['then'](function(_0x494741){_0x2ca774['count']=_0x494741;if(_0x46df3f[_0x51ad('0x2f')][_0x51ad('0x40')]){_0x5a58bc[_0x51ad('0x41')]=[{'all':!![]}];}return db[_0x51ad('0x3f')]['findAll'](_0x5a58bc);})[_0x51ad('0x24')](function(_0x10a9ce){_0x2ca774['rows']=_0x10a9ce;return _0x2ca774;})['then'](respondWithFilteredResult(_0x486f6f,_0x5a58bc))[_0x51ad('0x42')](handleError(_0x486f6f,null));};exports[_0x51ad('0x43')]=function(_0x31253e,_0x38cdfb){var _0x23af99={'raw':!![],'where':{'id':_0x31253e[_0x51ad('0x44')]['id']}},_0x1f7fa1={};_0x1f7fa1[_0x51ad('0x2e')]=_[_0x51ad('0x30')](db[_0x51ad('0x3f')]['rawAttributes']);_0x1f7fa1['query']=_['keys'](_0x31253e['query']);_0x1f7fa1[_0x51ad('0x31')]=_['intersection'](_0x1f7fa1[_0x51ad('0x2e')],_0x1f7fa1[_0x51ad('0x2f')]);_0x23af99[_0x51ad('0x33')]=_[_0x51ad('0x32')](_0x1f7fa1[_0x51ad('0x2e')],qs[_0x51ad('0x34')](_0x31253e[_0x51ad('0x2f')][_0x51ad('0x34')]));_0x23af99[_0x51ad('0x33')]=_0x23af99[_0x51ad('0x33')]['length']?_0x23af99[_0x51ad('0x33')]:_0x1f7fa1[_0x51ad('0x2e')];if(_0x31253e[_0x51ad('0x2f')][_0x51ad('0x40')]){_0x23af99[_0x51ad('0x41')]=[{'all':!![]}];}_0x23af99=_[_0x51ad('0x3d')]({},_0x23af99,_0x31253e[_0x51ad('0x3e')]);return db[_0x51ad('0x3f')][_0x51ad('0x45')](_0x23af99)[_0x51ad('0x24')](handleEntityNotFound(_0x38cdfb,null))[_0x51ad('0x24')](respondWithResult(_0x38cdfb,null))[_0x51ad('0x42')](handleError(_0x38cdfb,null));};exports['create']=function(_0x2d0e39,_0x1f41e3){return db['MailServerOut'][_0x51ad('0x46')](_0x2d0e39[_0x51ad('0x47')],{})[_0x51ad('0x24')](respondWithResult(_0x1f41e3,0xc9))[_0x51ad('0x42')](handleError(_0x1f41e3,null));};exports[_0x51ad('0x23')]=function(_0x3d46f4,_0x285b9e){if(_0x3d46f4[_0x51ad('0x47')]['id']){delete _0x3d46f4[_0x51ad('0x47')]['id'];}return db[_0x51ad('0x3f')][_0x51ad('0x45')]({'where':{'id':_0x3d46f4[_0x51ad('0x44')]['id']}})[_0x51ad('0x24')](handleEntityNotFound(_0x285b9e,null))[_0x51ad('0x24')](saveUpdates(_0x3d46f4[_0x51ad('0x47')],null))[_0x51ad('0x24')](respondWithResult(_0x285b9e,null))['catch'](handleError(_0x285b9e,null));};exports[_0x51ad('0x48')]=function(_0x2725c8,_0xe13688){return db['MailServerOut'][_0x51ad('0x45')]({'where':{'id':_0x2725c8['params']['id']}})[_0x51ad('0x24')](handleEntityNotFound(_0xe13688,null))[_0x51ad('0x24')](removeEntity(_0xe13688,null))[_0x51ad('0x42')](handleError(_0xe13688,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index fd06b00..a49faed 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 _0xce6a=['define','mail_servers_out','lodash','api','moment','bluebird','request-promise','path','rimraf','./mailServerOut.attributes','exports'];(function(_0x4a3466,_0x35fb36){var _0x52baa2=function(_0x4a5b03){while(--_0x4a5b03){_0x4a3466['push'](_0x4a3466['shift']());}};_0x52baa2(++_0x35fb36);}(_0xce6a,0x65));var _0xace6=function(_0x5db61c,_0x1f4f1c){_0x5db61c=_0x5db61c-0x0;var _0x5347c9=_0xce6a[_0x5db61c];return _0x5347c9;};'use strict';var _=require(_0xace6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xace6('0x1'));var moment=require(_0xace6('0x2'));var BPromise=require(_0xace6('0x3'));var rp=require(_0xace6('0x4'));var fs=require('fs');var path=require(_0xace6('0x5'));var rimraf=require(_0xace6('0x6'));var config=require('../../config/environment');var attributes=require(_0xace6('0x7'));module[_0xace6('0x8')]=function(_0x19dd5c,_0x4b16a7){return _0x19dd5c[_0xace6('0x9')]('MailServerOut',attributes,{'tableName':_0xace6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d4d=['../../config/environment','exports','define','mail_servers_out','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x6d4d,0x159));var _0xd6d4=function(_0x13fe61,_0x257256){_0x13fe61=_0x13fe61-0x0;var _0x3c1e9f=_0x6d4d[_0x13fe61];return _0x3c1e9f;};'use strict';var _=require('lodash');var util=require(_0xd6d4('0x0'));var logger=require(_0xd6d4('0x1'))(_0xd6d4('0x2'));var moment=require(_0xd6d4('0x3'));var BPromise=require(_0xd6d4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd6d4('0x5'));var rimraf=require(_0xd6d4('0x6'));var config=require(_0xd6d4('0x7'));var attributes=require('./mailServerOut.attributes');module[_0xd6d4('0x8')]=function(_0x38d4cc,_0x10d540){return _0x38d4cc[_0xd6d4('0x9')]('MailServerOut',attributes,{'tableName':_0xd6d4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 3ca9481..594984b 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(_0x81b249,_0x18f870){var _0xde41e6=function(_0x5dbdb0){while(--_0x5dbdb0){_0x81b249['push'](_0x81b249['shift']());}};_0xde41e6(++_0x18f870);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5a40d5,_0x5adac9){_0x5a40d5=_0x5a40d5-0x0;var _0x4b2731=_0x5f2f[_0x5a40d5];return _0x4b2731;};'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 _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x390cea,_0x43c078){var _0x14bf80=function(_0x196f3c){while(--_0x196f3c){_0x390cea['push'](_0x390cea['shift']());}};_0x14bf80(++_0x43c078);}(_0xadb5,0xad));var _0x5adb=function(_0x396ade,_0x8bb887){_0x396ade=_0x396ade-0x0;var _0x509c1b=_0xadb5[_0x396ade];return _0x509c1b;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailServerOut,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 3417fdc..743bb59 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 _0x2820=['create','put','update','delete','exports','util','path','express','../../config/environment','get','isAuthenticated','/describe','/:id','post'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2820,0x1a9));var _0x0282=function(_0x136973,_0x479346){_0x136973=_0x136973-0x0;var _0x5459aa=_0x2820[_0x136973];return _0x5459aa;};'use strict';var multer=require('multer');var util=require(_0x0282('0x0'));var path=require(_0x0282('0x1'));var timeout=require('connect-timeout');var express=require(_0x0282('0x2'));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(_0x0282('0x3'));var controller=require('./mailSubstatus.controller');router[_0x0282('0x4')]('/',auth[_0x0282('0x5')](),controller['index']);router[_0x0282('0x4')](_0x0282('0x6'),auth[_0x0282('0x5')](),controller['describe']);router[_0x0282('0x4')](_0x0282('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x0282('0x8')]('/',auth['isAuthenticated'](),controller[_0x0282('0x9')]);router[_0x0282('0xa')](_0x0282('0x7'),auth[_0x0282('0x5')](),controller[_0x0282('0xb')]);router[_0x0282('0xc')](_0x0282('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x0282('0xd')]=router; \ No newline at end of file +var _0x6da9=['/describe','show','create','put','update','delete','/:id','exports','util','path','Router','fs-extra','isAuthenticated','get'];(function(_0xc0638b,_0x2fccf4){var _0xd57dfa=function(_0x322fba){while(--_0x322fba){_0xc0638b['push'](_0xc0638b['shift']());}};_0xd57dfa(++_0x2fccf4);}(_0x6da9,0x158));var _0x96da=function(_0x2dc049,_0x3a5738){_0x2dc049=_0x2dc049-0x0;var _0x126a89=_0x6da9[_0x2dc049];return _0x126a89;};'use strict';var multer=require('multer');var util=require(_0x96da('0x0'));var path=require(_0x96da('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x96da('0x2')]();var fs_extra=require(_0x96da('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x96da('0x4')](),controller['index']);router[_0x96da('0x5')](_0x96da('0x6'),auth[_0x96da('0x4')](),controller['describe']);router[_0x96da('0x5')]('/:id',auth[_0x96da('0x4')](),controller[_0x96da('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x96da('0x8')]);router[_0x96da('0x9')]('/:id',auth[_0x96da('0x4')](),controller[_0x96da('0xa')]);router[_0x96da('0xb')](_0x96da('0xc'),auth[_0x96da('0x4')](),controller['destroy']);module[_0x96da('0xd')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 7280fe7..5156f3f 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 _0xdf98=['STRING','sequelize'];(function(_0x272d8b,_0x4a1218){var _0xce5c02=function(_0x379b25){while(--_0x379b25){_0x272d8b['push'](_0x272d8b['shift']());}};_0xce5c02(++_0x4a1218);}(_0xdf98,0xcf));var _0x8df9=function(_0x221a6f,_0x1674c8){_0x221a6f=_0x221a6f-0x0;var _0x3db53d=_0xdf98[_0x221a6f];return _0x3db53d;};'use strict';var Sequelize=require(_0x8df9('0x0'));module['exports']={'name':{'type':Sequelize[_0x8df9('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbeea=['sequelize','STRING','name'];(function(_0x2ff89e,_0x4aad16){var _0x581c91=function(_0x588434){while(--_0x588434){_0x2ff89e['push'](_0x2ff89e['shift']());}};_0x581c91(++_0x4aad16);}(_0xbeea,0xb1));var _0xabee=function(_0x29fdd9,_0x5a2b39){_0x29fdd9=_0x29fdd9-0x0;var _0x35f2a6=_0xbeea[_0x29fdd9];return _0x35f2a6;};'use strict';var Sequelize=require(_0xabee('0x0'));module['exports']={'name':{'type':Sequelize[_0xabee('0x1')],'unique':_0xabee('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xabee('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 4b3c2fb..72bb694 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 _0xfa76=['status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','error','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','count','includeAll','include','MailSubstatus','findAll','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x1172b6,_0x179946){var _0x2fdf5f=function(_0x47bcb2){while(--_0x47bcb2){_0x1172b6['push'](_0x1172b6['shift']());}};_0x2fdf5f(++_0x179946);}(_0xfa76,0x16a));var _0x6fa7=function(_0x537d8f,_0x40f96d){_0x537d8f=_0x537d8f-0x0;var _0x18d623=_0xfa76[_0x537d8f];return _0x18d623;};'use strict';var emlformat=require(_0x6fa7('0x0'));var rimraf=require(_0x6fa7('0x1'));var zipdir=require(_0x6fa7('0x2'));var jsonpatch=require(_0x6fa7('0x3'));var rp=require(_0x6fa7('0x4'));var moment=require(_0x6fa7('0x5'));var BPromise=require(_0x6fa7('0x6'));var Mustache=require(_0x6fa7('0x7'));var util=require(_0x6fa7('0x8'));var path=require(_0x6fa7('0x9'));var sox=require(_0x6fa7('0xa'));var csv=require('to-csv');var ejs=require(_0x6fa7('0xb'));var fs=require('fs');var fs_extra=require(_0x6fa7('0xc'));var _=require(_0x6fa7('0xd'));var squel=require('squel');var crypto=require(_0x6fa7('0xe'));var jsforce=require(_0x6fa7('0xf'));var deskjs=require(_0x6fa7('0x10'));var toCsv=require(_0x6fa7('0x11'));var querystring=require(_0x6fa7('0x12'));var Papa=require('papaparse');var Redis=require(_0x6fa7('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6fa7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6fa7('0x15'));var logger=require(_0x6fa7('0x16'))('api');var utils=require(_0x6fa7('0x17'));var config=require(_0x6fa7('0x18'));var licenseUtil=require(_0x6fa7('0x19'));var db=require(_0x6fa7('0x1a'))['db'];function respondWithStatusCode(_0x47f429,_0x4216d6){_0x4216d6=_0x4216d6||0xcc;return function(_0x5de862){if(_0x5de862){return _0x47f429[_0x6fa7('0x1b')](_0x4216d6);}return _0x47f429[_0x6fa7('0x1c')](_0x4216d6)['end']();};}function respondWithResult(_0x50d78a,_0x4b889e){_0x4b889e=_0x4b889e||0xc8;return function(_0x16ba9f){if(_0x16ba9f){return _0x50d78a['status'](_0x4b889e)[_0x6fa7('0x1d')](_0x16ba9f);}};}function respondWithFilteredResult(_0x548cea,_0x1318ef){return function(_0x2b1e12){if(_0x2b1e12){var _0x28d8cb=typeof _0x1318ef[_0x6fa7('0x1e')]===_0x6fa7('0x1f')&&typeof _0x1318ef[_0x6fa7('0x20')]===_0x6fa7('0x1f');var _0x3aaf63=_0x2b1e12['count'];var _0x327973=_0x28d8cb?0x0:_0x1318ef[_0x6fa7('0x1e')];var _0x4cb12d=_0x28d8cb?_0x2b1e12['count']:_0x1318ef[_0x6fa7('0x1e')]+_0x1318ef[_0x6fa7('0x20')];var _0x54cd79;if(_0x4cb12d>=_0x3aaf63){_0x4cb12d=_0x3aaf63;_0x54cd79=0xc8;}else{_0x54cd79=0xce;}_0x548cea[_0x6fa7('0x1c')](_0x54cd79);return _0x548cea[_0x6fa7('0x21')](_0x6fa7('0x22'),_0x327973+'-'+_0x4cb12d+'/'+_0x3aaf63)[_0x6fa7('0x1d')](_0x2b1e12);}return null;};}function patchUpdates(_0x5f2f08){return function(_0x2f2bce){try{jsonpatch[_0x6fa7('0x23')](_0x2f2bce,_0x5f2f08,!![]);}catch(_0xa1f1ae){return BPromise[_0x6fa7('0x24')](_0xa1f1ae);}return _0x2f2bce['save']();};}function saveUpdates(_0x4c3aee,_0x5e9613){return function(_0x5c87b0){if(_0x5c87b0){return _0x5c87b0[_0x6fa7('0x25')](_0x4c3aee)[_0x6fa7('0x26')](function(_0x119c96){return _0x119c96;});}return null;};}function removeEntity(_0x55b397,_0x5d5c46){return function(_0x3ce755){if(_0x3ce755){return _0x3ce755[_0x6fa7('0x27')]()[_0x6fa7('0x26')](function(){_0x55b397[_0x6fa7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x248985,_0x31672c){return function(_0x38234c){if(!_0x38234c){_0x248985[_0x6fa7('0x1b')](0x194);}return _0x38234c;};}function handleError(_0x4d9616,_0x576380){_0x576380=_0x576380||0x1f4;return function(_0x28ff5c){logger[_0x6fa7('0x28')](_0x28ff5c['stack']);if(_0x28ff5c['name']){delete _0x28ff5c['name'];}_0x4d9616['status'](_0x576380)[_0x6fa7('0x29')](_0x28ff5c);};}exports[_0x6fa7('0x2a')]=function(_0x240a50,_0x430548){var _0x5721fc={},_0x13a839={},_0x475709={'count':0x0,'rows':[]};var _0x166ee1=_[_0x6fa7('0x2b')](db['MailSubstatus'][_0x6fa7('0x2c')],function(_0x274046){return{'name':_0x274046[_0x6fa7('0x2d')],'type':_0x274046[_0x6fa7('0x2e')][_0x6fa7('0x2f')]};});_0x13a839[_0x6fa7('0x30')]=_[_0x6fa7('0x2b')](_0x166ee1,_0x6fa7('0x31'));_0x13a839[_0x6fa7('0x32')]=_[_0x6fa7('0x33')](_0x240a50['query']);_0x13a839[_0x6fa7('0x34')]=_[_0x6fa7('0x35')](_0x13a839[_0x6fa7('0x30')],_0x13a839['query']);_0x5721fc[_0x6fa7('0x36')]=_[_0x6fa7('0x35')](_0x13a839[_0x6fa7('0x30')],qs[_0x6fa7('0x37')](_0x240a50['query']['fields']));_0x5721fc[_0x6fa7('0x36')]=_0x5721fc[_0x6fa7('0x36')][_0x6fa7('0x38')]?_0x5721fc[_0x6fa7('0x36')]:_0x13a839[_0x6fa7('0x30')];if(!_0x240a50[_0x6fa7('0x32')]['hasOwnProperty'](_0x6fa7('0x39'))){_0x5721fc[_0x6fa7('0x20')]=qs['limit'](_0x240a50[_0x6fa7('0x32')][_0x6fa7('0x20')]);_0x5721fc[_0x6fa7('0x1e')]=qs[_0x6fa7('0x1e')](_0x240a50['query'][_0x6fa7('0x1e')]);}_0x5721fc[_0x6fa7('0x3a')]=qs['sort'](_0x240a50[_0x6fa7('0x32')][_0x6fa7('0x3b')]);_0x5721fc[_0x6fa7('0x3c')]=qs[_0x6fa7('0x34')](_[_0x6fa7('0x3d')](_0x240a50['query'],_0x13a839[_0x6fa7('0x34')]),_0x166ee1);if(_0x240a50[_0x6fa7('0x32')][_0x6fa7('0x3e')]){_0x5721fc[_0x6fa7('0x3c')]=_['merge'](_0x5721fc[_0x6fa7('0x3c')],{'$or':_['map'](_0x166ee1,function(_0x4fefd9){if(_0x4fefd9[_0x6fa7('0x2e')]!==_0x6fa7('0x3f')){var _0x2a22e5={};_0x2a22e5[_0x4fefd9['name']]={'$like':'%'+_0x240a50[_0x6fa7('0x32')][_0x6fa7('0x3e')]+'%'};return _0x2a22e5;}})});}_0x5721fc=_['merge']({},_0x5721fc,_0x240a50[_0x6fa7('0x40')]);var _0x30255f={'where':_0x5721fc[_0x6fa7('0x3c')]};return db['MailSubstatus'][_0x6fa7('0x41')](_0x30255f)[_0x6fa7('0x26')](function(_0x189ff){_0x475709[_0x6fa7('0x41')]=_0x189ff;if(_0x240a50['query'][_0x6fa7('0x42')]){_0x5721fc[_0x6fa7('0x43')]=[{'all':!![]}];}return db[_0x6fa7('0x44')][_0x6fa7('0x45')](_0x5721fc);})[_0x6fa7('0x26')](function(_0x280f62){_0x475709['rows']=_0x280f62;return _0x475709;})[_0x6fa7('0x26')](respondWithFilteredResult(_0x430548,_0x5721fc))[_0x6fa7('0x46')](handleError(_0x430548,null));};exports[_0x6fa7('0x47')]=function(_0x493512,_0x2c3d7a){var _0x5a9559={'raw':!![],'where':{'id':_0x493512[_0x6fa7('0x48')]['id']}},_0x3f9271={};_0x3f9271[_0x6fa7('0x30')]=_[_0x6fa7('0x33')](db[_0x6fa7('0x44')]['rawAttributes']);_0x3f9271[_0x6fa7('0x32')]=_[_0x6fa7('0x33')](_0x493512['query']);_0x3f9271['filters']=_[_0x6fa7('0x35')](_0x3f9271['model'],_0x3f9271[_0x6fa7('0x32')]);_0x5a9559[_0x6fa7('0x36')]=_[_0x6fa7('0x35')](_0x3f9271['model'],qs[_0x6fa7('0x37')](_0x493512[_0x6fa7('0x32')]['fields']));_0x5a9559[_0x6fa7('0x36')]=_0x5a9559[_0x6fa7('0x36')]['length']?_0x5a9559['attributes']:_0x3f9271[_0x6fa7('0x30')];if(_0x493512[_0x6fa7('0x32')][_0x6fa7('0x42')]){_0x5a9559['include']=[{'all':!![]}];}_0x5a9559=_[_0x6fa7('0x49')]({},_0x5a9559,_0x493512['options']);return db[_0x6fa7('0x44')][_0x6fa7('0x4a')](_0x5a9559)[_0x6fa7('0x26')](handleEntityNotFound(_0x2c3d7a,null))[_0x6fa7('0x26')](respondWithResult(_0x2c3d7a,null))['catch'](handleError(_0x2c3d7a,null));};exports[_0x6fa7('0x4b')]=function(_0x2bf95c,_0x351d30){return db[_0x6fa7('0x44')][_0x6fa7('0x4b')](_0x2bf95c[_0x6fa7('0x4c')],{})[_0x6fa7('0x26')](respondWithResult(_0x351d30,0xc9))[_0x6fa7('0x46')](handleError(_0x351d30,null));};exports[_0x6fa7('0x25')]=function(_0x120fbb,_0x3fe181){if(_0x120fbb[_0x6fa7('0x4c')]['id']){delete _0x120fbb[_0x6fa7('0x4c')]['id'];}return db[_0x6fa7('0x44')][_0x6fa7('0x4a')]({'where':{'id':_0x120fbb[_0x6fa7('0x48')]['id']}})['then'](handleEntityNotFound(_0x3fe181,null))[_0x6fa7('0x26')](saveUpdates(_0x120fbb[_0x6fa7('0x4c')],null))[_0x6fa7('0x26')](respondWithResult(_0x3fe181,null))['catch'](handleError(_0x3fe181,null));};exports['destroy']=function(_0x53dd23,_0x42b143){return db[_0x6fa7('0x44')][_0x6fa7('0x4a')]({'where':{'id':_0x53dd23[_0x6fa7('0x48')]['id']}})['then'](handleEntityNotFound(_0x42b143,null))['then'](removeEntity(_0x42b143,null))[_0x6fa7('0x46')](handleError(_0x42b143,null));};exports[_0x6fa7('0x4d')]=function(_0x459f72,_0x41059e){return db['MailSubstatus']['describe']()['then'](respondWithResult(_0x41059e,null))[_0x6fa7('0x46')](handleError(_0x41059e,null));}; \ No newline at end of file +var _0xe4dc=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','index','map','MailSubstatus','rawAttributes','fieldName','type','key','name','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe'];(function(_0x309723,_0x5e8c68){var _0x4dc9f9=function(_0x156105){while(--_0x156105){_0x309723['push'](_0x309723['shift']());}};_0x4dc9f9(++_0x5e8c68);}(_0xe4dc,0x13c));var _0xce4d=function(_0x36752b,_0x599af9){_0x36752b=_0x36752b-0x0;var _0x5012f4=_0xe4dc[_0x36752b];return _0x5012f4;};'use strict';var emlformat=require(_0xce4d('0x0'));var rimraf=require(_0xce4d('0x1'));var zipdir=require(_0xce4d('0x2'));var jsonpatch=require(_0xce4d('0x3'));var rp=require(_0xce4d('0x4'));var moment=require(_0xce4d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xce4d('0x6'));var util=require('util');var path=require(_0xce4d('0x7'));var sox=require(_0xce4d('0x8'));var csv=require(_0xce4d('0x9'));var ejs=require(_0xce4d('0xa'));var fs=require('fs');var fs_extra=require(_0xce4d('0xb'));var _=require(_0xce4d('0xc'));var squel=require(_0xce4d('0xd'));var crypto=require(_0xce4d('0xe'));var jsforce=require(_0xce4d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xce4d('0x9'));var querystring=require(_0xce4d('0x10'));var Papa=require(_0xce4d('0x11'));var Redis=require(_0xce4d('0x12'));var authService=require(_0xce4d('0x13'));var qs=require(_0xce4d('0x14'));var as=require(_0xce4d('0x15'));var hardwareService=require(_0xce4d('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xce4d('0x17'));var config=require(_0xce4d('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54bf80,_0x3cfc5b){_0x3cfc5b=_0x3cfc5b||0xcc;return function(_0x2b8106){if(_0x2b8106){return _0x54bf80['sendStatus'](_0x3cfc5b);}return _0x54bf80[_0xce4d('0x19')](_0x3cfc5b)[_0xce4d('0x1a')]();};}function respondWithResult(_0x47977,_0x214fc9){_0x214fc9=_0x214fc9||0xc8;return function(_0x458441){if(_0x458441){return _0x47977[_0xce4d('0x19')](_0x214fc9)['json'](_0x458441);}};}function respondWithFilteredResult(_0x351aa7,_0x3c278d){return function(_0x10f52b){if(_0x10f52b){var _0x4bc5ed=typeof _0x3c278d[_0xce4d('0x1b')]===_0xce4d('0x1c')&&typeof _0x3c278d['limit']===_0xce4d('0x1c');var _0x431ddb=_0x10f52b[_0xce4d('0x1d')];var _0x26412d=_0x4bc5ed?0x0:_0x3c278d['offset'];var _0x57e6a4=_0x4bc5ed?_0x10f52b[_0xce4d('0x1d')]:_0x3c278d[_0xce4d('0x1b')]+_0x3c278d[_0xce4d('0x1e')];var _0x3d7d45;if(_0x57e6a4>=_0x431ddb){_0x57e6a4=_0x431ddb;_0x3d7d45=0xc8;}else{_0x3d7d45=0xce;}_0x351aa7['status'](_0x3d7d45);return _0x351aa7[_0xce4d('0x1f')](_0xce4d('0x20'),_0x26412d+'-'+_0x57e6a4+'/'+_0x431ddb)[_0xce4d('0x21')](_0x10f52b);}return null;};}function patchUpdates(_0x403bf5){return function(_0x4aa8f0){try{jsonpatch['apply'](_0x4aa8f0,_0x403bf5,!![]);}catch(_0x2d88ff){return BPromise[_0xce4d('0x22')](_0x2d88ff);}return _0x4aa8f0[_0xce4d('0x23')]();};}function saveUpdates(_0x21cb74,_0x248a28){return function(_0x44b664){if(_0x44b664){return _0x44b664[_0xce4d('0x24')](_0x21cb74)[_0xce4d('0x25')](function(_0x1dd412){return _0x1dd412;});}return null;};}function removeEntity(_0x24f79a,_0x6d268c){return function(_0x409b19){if(_0x409b19){return _0x409b19[_0xce4d('0x26')]()[_0xce4d('0x25')](function(){_0x24f79a[_0xce4d('0x19')](0xcc)[_0xce4d('0x1a')]();});}};}function handleEntityNotFound(_0x138351,_0x1bf6b8){return function(_0x1aef11){if(!_0x1aef11){_0x138351[_0xce4d('0x27')](0x194);}return _0x1aef11;};}function handleError(_0x297c60,_0xe7785d){_0xe7785d=_0xe7785d||0x1f4;return function(_0x1addf3){logger[_0xce4d('0x28')](_0x1addf3[_0xce4d('0x29')]);if(_0x1addf3['name']){delete _0x1addf3['name'];}_0x297c60[_0xce4d('0x19')](_0xe7785d)['send'](_0x1addf3);};}exports[_0xce4d('0x2a')]=function(_0x3a2610,_0x54421a){var _0x3aa54c={},_0x404725={},_0x514a9d={'count':0x0,'rows':[]};var _0x3d30ea=_[_0xce4d('0x2b')](db[_0xce4d('0x2c')][_0xce4d('0x2d')],function(_0x151f8a){return{'name':_0x151f8a[_0xce4d('0x2e')],'type':_0x151f8a[_0xce4d('0x2f')][_0xce4d('0x30')]};});_0x404725['model']=_[_0xce4d('0x2b')](_0x3d30ea,_0xce4d('0x31'));_0x404725[_0xce4d('0x32')]=_[_0xce4d('0x33')](_0x3a2610[_0xce4d('0x32')]);_0x404725[_0xce4d('0x34')]=_['intersection'](_0x404725['model'],_0x404725[_0xce4d('0x32')]);_0x3aa54c[_0xce4d('0x35')]=_[_0xce4d('0x36')](_0x404725[_0xce4d('0x37')],qs[_0xce4d('0x38')](_0x3a2610[_0xce4d('0x32')][_0xce4d('0x38')]));_0x3aa54c['attributes']=_0x3aa54c[_0xce4d('0x35')][_0xce4d('0x39')]?_0x3aa54c[_0xce4d('0x35')]:_0x404725['model'];if(!_0x3a2610[_0xce4d('0x32')][_0xce4d('0x3a')](_0xce4d('0x3b'))){_0x3aa54c['limit']=qs['limit'](_0x3a2610[_0xce4d('0x32')]['limit']);_0x3aa54c[_0xce4d('0x1b')]=qs[_0xce4d('0x1b')](_0x3a2610[_0xce4d('0x32')][_0xce4d('0x1b')]);}_0x3aa54c[_0xce4d('0x3c')]=qs[_0xce4d('0x3d')](_0x3a2610[_0xce4d('0x32')][_0xce4d('0x3d')]);_0x3aa54c[_0xce4d('0x3e')]=qs['filters'](_[_0xce4d('0x3f')](_0x3a2610[_0xce4d('0x32')],_0x404725['filters']),_0x3d30ea);if(_0x3a2610[_0xce4d('0x32')][_0xce4d('0x40')]){_0x3aa54c[_0xce4d('0x3e')]=_[_0xce4d('0x41')](_0x3aa54c[_0xce4d('0x3e')],{'$or':_[_0xce4d('0x2b')](_0x3d30ea,function(_0x19b321){if(_0x19b321[_0xce4d('0x2f')]!==_0xce4d('0x42')){var _0x1d3b28={};_0x1d3b28[_0x19b321[_0xce4d('0x31')]]={'$like':'%'+_0x3a2610['query'][_0xce4d('0x40')]+'%'};return _0x1d3b28;}})});}_0x3aa54c=_[_0xce4d('0x41')]({},_0x3aa54c,_0x3a2610[_0xce4d('0x43')]);var _0x5e9ec3={'where':_0x3aa54c['where']};return db[_0xce4d('0x2c')][_0xce4d('0x1d')](_0x5e9ec3)[_0xce4d('0x25')](function(_0x471ea8){_0x514a9d['count']=_0x471ea8;if(_0x3a2610[_0xce4d('0x32')]['includeAll']){_0x3aa54c[_0xce4d('0x44')]=[{'all':!![]}];}return db[_0xce4d('0x2c')][_0xce4d('0x45')](_0x3aa54c);})[_0xce4d('0x25')](function(_0x1cd747){_0x514a9d[_0xce4d('0x46')]=_0x1cd747;return _0x514a9d;})[_0xce4d('0x25')](respondWithFilteredResult(_0x54421a,_0x3aa54c))[_0xce4d('0x47')](handleError(_0x54421a,null));};exports[_0xce4d('0x48')]=function(_0x2c2062,_0x58dec9){var _0x12866a={'raw':!![],'where':{'id':_0x2c2062[_0xce4d('0x49')]['id']}},_0x622d8={};_0x622d8['model']=_[_0xce4d('0x33')](db['MailSubstatus'][_0xce4d('0x2d')]);_0x622d8[_0xce4d('0x32')]=_[_0xce4d('0x33')](_0x2c2062['query']);_0x622d8[_0xce4d('0x34')]=_[_0xce4d('0x36')](_0x622d8[_0xce4d('0x37')],_0x622d8[_0xce4d('0x32')]);_0x12866a[_0xce4d('0x35')]=_[_0xce4d('0x36')](_0x622d8['model'],qs['fields'](_0x2c2062[_0xce4d('0x32')][_0xce4d('0x38')]));_0x12866a[_0xce4d('0x35')]=_0x12866a[_0xce4d('0x35')][_0xce4d('0x39')]?_0x12866a[_0xce4d('0x35')]:_0x622d8[_0xce4d('0x37')];if(_0x2c2062['query'][_0xce4d('0x4a')]){_0x12866a[_0xce4d('0x44')]=[{'all':!![]}];}_0x12866a=_[_0xce4d('0x41')]({},_0x12866a,_0x2c2062[_0xce4d('0x43')]);return db[_0xce4d('0x2c')]['find'](_0x12866a)[_0xce4d('0x25')](handleEntityNotFound(_0x58dec9,null))[_0xce4d('0x25')](respondWithResult(_0x58dec9,null))['catch'](handleError(_0x58dec9,null));};exports[_0xce4d('0x4b')]=function(_0x36f3d0,_0x51b034){return db[_0xce4d('0x2c')][_0xce4d('0x4b')](_0x36f3d0['body'],{})['then'](respondWithResult(_0x51b034,0xc9))['catch'](handleError(_0x51b034,null));};exports[_0xce4d('0x24')]=function(_0x4573ad,_0x5549d8){if(_0x4573ad[_0xce4d('0x4c')]['id']){delete _0x4573ad[_0xce4d('0x4c')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x4573ad[_0xce4d('0x49')]['id']}})[_0xce4d('0x25')](handleEntityNotFound(_0x5549d8,null))[_0xce4d('0x25')](saveUpdates(_0x4573ad[_0xce4d('0x4c')],null))[_0xce4d('0x25')](respondWithResult(_0x5549d8,null))['catch'](handleError(_0x5549d8,null));};exports['destroy']=function(_0x1cfd64,_0xf9cd2f){return db[_0xce4d('0x2c')][_0xce4d('0x4d')]({'where':{'id':_0x1cfd64[_0xce4d('0x49')]['id']}})[_0xce4d('0x25')](handleEntityNotFound(_0xf9cd2f,null))['then'](removeEntity(_0xf9cd2f,null))[_0xce4d('0x47')](handleError(_0xf9cd2f,null));};exports[_0xce4d('0x4e')]=function(_0x1a5635,_0x164418){return db[_0xce4d('0x2c')][_0xce4d('0x4e')]()[_0xce4d('0x25')](respondWithResult(_0x164418,null))['catch'](handleError(_0x164418,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 0f18fa9..05ffe26 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 _0x2c8a=['util','../../config/logger','request-promise','path','rimraf','./mailSubstatus.attributes','exports','define','MailSubstatus'];(function(_0x2b1e39,_0x3774d0){var _0xac4f7f=function(_0x5db8f9){while(--_0x5db8f9){_0x2b1e39['push'](_0x2b1e39['shift']());}};_0xac4f7f(++_0x3774d0);}(_0x2c8a,0x120));var _0xa2c8=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x2c8a[_0x5d2803];return _0xdcad2c;};'use strict';var _=require('lodash');var util=require(_0xa2c8('0x0'));var logger=require(_0xa2c8('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa2c8('0x2'));var fs=require('fs');var path=require(_0xa2c8('0x3'));var rimraf=require(_0xa2c8('0x4'));var config=require('../../config/environment');var attributes=require(_0xa2c8('0x5'));module[_0xa2c8('0x6')]=function(_0x5f4c15,_0x15ee3b){return _0x5f4c15[_0xa2c8('0x7')](_0xa2c8('0x8'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcbd1=['api','moment','bluebird','request-promise','path','rimraf','./mailSubstatus.attributes','exports','define','MailSubstatus','lodash','util','../../config/logger'];(function(_0x408b1e,_0x4fd20f){var _0x231e81=function(_0x438658){while(--_0x438658){_0x408b1e['push'](_0x408b1e['shift']());}};_0x231e81(++_0x4fd20f);}(_0xcbd1,0x11b));var _0x1cbd=function(_0x58d8d2,_0x2cfff8){_0x58d8d2=_0x58d8d2-0x0;var _0x3f27f4=_0xcbd1[_0x58d8d2];return _0x3f27f4;};'use strict';var _=require(_0x1cbd('0x0'));var util=require(_0x1cbd('0x1'));var logger=require(_0x1cbd('0x2'))(_0x1cbd('0x3'));var moment=require(_0x1cbd('0x4'));var BPromise=require(_0x1cbd('0x5'));var rp=require(_0x1cbd('0x6'));var fs=require('fs');var path=require(_0x1cbd('0x7'));var rimraf=require(_0x1cbd('0x8'));var config=require('../../config/environment');var attributes=require(_0x1cbd('0x9'));module[_0x1cbd('0xa')]=function(_0x16e0a5,_0x406fd3){return _0x16e0a5[_0x1cbd('0xb')](_0x1cbd('0xc'),attributes,{'tableName':'mail_substatuses','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 9336d4f..c6d261a 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 _0x0923=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0923,0x13c));var _0x3092=function(_0xd68210,_0x2d4a3c){_0xd68210=_0xd68210-0x0;var _0x298b83=_0x0923[_0xd68210];return _0x298b83;};'use strict';var _=require(_0x3092('0x0'));var util=require(_0x3092('0x1'));var moment=require('moment');var BPromise=require(_0x3092('0x2'));var rs=require(_0x3092('0x3'));var fs=require('fs');var Redis=require(_0x3092('0x4'));var db=require(_0x3092('0x5'))['db'];var utils=require(_0x3092('0x6'));var logger=require(_0x3092('0x7'))(_0x3092('0x8'));var config=require(_0x3092('0x9'));var jayson=require(_0x3092('0xa'));var client=jayson['client'][_0x3092('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c6c0a,_0x3f53cf,_0x52a68e){return new BPromise(function(_0x402cc5,_0x3c0bf2){return client[_0x3092('0xc')](_0x1c6c0a,_0x52a68e)[_0x3092('0xd')](function(_0x823ed4){logger[_0x3092('0xe')](_0x3092('0xf'),_0x3f53cf,'request\x20sent');logger[_0x3092('0x10')](_0x3092('0x11'),_0x3f53cf,_0x3092('0x12'),JSON['stringify'](_0x823ed4));if(_0x823ed4[_0x3092('0x13')]){if(_0x823ed4[_0x3092('0x13')][_0x3092('0x14')]===0x1f4){logger[_0x3092('0x13')](_0x3092('0xf'),_0x3f53cf,_0x823ed4[_0x3092('0x13')][_0x3092('0x15')]);return _0x3c0bf2(_0x823ed4[_0x3092('0x13')][_0x3092('0x15')]);}logger['error'](_0x3092('0xf'),_0x3f53cf,_0x823ed4[_0x3092('0x13')][_0x3092('0x15')]);return _0x402cc5(_0x823ed4[_0x3092('0x13')][_0x3092('0x15')]);}else{logger[_0x3092('0xe')](_0x3092('0xf'),_0x3f53cf,_0x3092('0x12'));_0x402cc5(_0x823ed4[_0x3092('0x16')][_0x3092('0x15')]);}})[_0x3092('0x17')](function(_0x6a97c4){logger[_0x3092('0x13')](_0x3092('0xf'),_0x3f53cf,_0x6a97c4);_0x3c0bf2(_0x6a97c4);});});} \ No newline at end of file +var _0x72b4=['http','request','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5027b0,_0x32d0dd){var _0x55779c=function(_0x465b4f){while(--_0x465b4f){_0x5027b0['push'](_0x5027b0['shift']());}};_0x55779c(++_0x32d0dd);}(_0x72b4,0x85));var _0x472b=function(_0x5bac10,_0x436643){_0x5bac10=_0x5bac10-0x0;var _0x362c49=_0x72b4[_0x5bac10];return _0x362c49;};'use strict';var _=require('lodash');var util=require(_0x472b('0x0'));var moment=require(_0x472b('0x1'));var BPromise=require('bluebird');var rs=require(_0x472b('0x2'));var fs=require('fs');var Redis=require(_0x472b('0x3'));var db=require(_0x472b('0x4'))['db'];var utils=require(_0x472b('0x5'));var logger=require(_0x472b('0x6'))(_0x472b('0x7'));var config=require(_0x472b('0x8'));var jayson=require(_0x472b('0x9'));var client=jayson[_0x472b('0xa')][_0x472b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b3247,_0x44c770,_0x110e32){return new BPromise(function(_0x3d1bd1,_0x617afa){return client[_0x472b('0xc')](_0x5b3247,_0x110e32)['then'](function(_0x22fd75){logger[_0x472b('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x44c770,_0x472b('0xe'));logger[_0x472b('0xf')](_0x472b('0x10'),_0x44c770,'request\x20sent',JSON[_0x472b('0x11')](_0x22fd75));if(_0x22fd75[_0x472b('0x12')]){if(_0x22fd75[_0x472b('0x12')][_0x472b('0x13')]===0x1f4){logger[_0x472b('0x12')](_0x472b('0x14'),_0x44c770,_0x22fd75[_0x472b('0x12')]['message']);return _0x617afa(_0x22fd75[_0x472b('0x12')][_0x472b('0x15')]);}logger[_0x472b('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x44c770,_0x22fd75['error']['message']);return _0x3d1bd1(_0x22fd75[_0x472b('0x12')][_0x472b('0x15')]);}else{logger['info'](_0x472b('0x14'),_0x44c770,_0x472b('0xe'));_0x3d1bd1(_0x22fd75[_0x472b('0x16')][_0x472b('0x15')]);}})[_0x472b('0x17')](function(_0x5c9687){logger['error'](_0x472b('0x14'),_0x44c770,_0x5c9687);_0x617afa(_0x5c9687);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index e54628e..fab3591 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 _0x4d6b=['get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./mailTransferReport.controller'];(function(_0x5e709a,_0x1d7975){var _0x57401a=function(_0x27eab5){while(--_0x27eab5){_0x5e709a['push'](_0x5e709a['shift']());}};_0x57401a(++_0x1d7975);}(_0x4d6b,0x1c4));var _0xb4d6=function(_0x75c3eb,_0x271b5a){_0x75c3eb=_0x75c3eb-0x0;var _0x6e6585=_0x4d6b[_0x75c3eb];return _0x6e6585;};'use strict';var multer=require(_0xb4d6('0x0'));var util=require(_0xb4d6('0x1'));var path=require(_0xb4d6('0x2'));var timeout=require(_0xb4d6('0x3'));var express=require(_0xb4d6('0x4'));var router=express[_0xb4d6('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb4d6('0x6'));var config=require('../../config/environment');var controller=require(_0xb4d6('0x7'));router[_0xb4d6('0x8')]('/',auth[_0xb4d6('0x9')](),controller['index']);router[_0xb4d6('0x8')](_0xb4d6('0xa'),auth['isAuthenticated'](),controller[_0xb4d6('0xb')]);router[_0xb4d6('0x8')](_0xb4d6('0xc'),auth['isAuthenticated'](),controller[_0xb4d6('0xd')]);router[_0xb4d6('0xe')]('/',auth[_0xb4d6('0x9')](),controller[_0xb4d6('0xf')]);router[_0xb4d6('0x10')](_0xb4d6('0xc'),auth[_0xb4d6('0x9')](),controller[_0xb4d6('0x11')]);router[_0xb4d6('0x12')](_0xb4d6('0xc'),auth[_0xb4d6('0x9')](),controller[_0xb4d6('0x13')]);module['exports']=router; \ No newline at end of file +var _0xb2f6=['../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xb2f6,0xcd));var _0x6b2f=function(_0x3d67d1,_0x3579b8){_0x3d67d1=_0x3d67d1-0x0;var _0x490bd0=_0xb2f6[_0x3d67d1];return _0x490bd0;};'use strict';var multer=require('multer');var util=require(_0x6b2f('0x0'));var path=require(_0x6b2f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6b2f('0x2')]();var fs_extra=require(_0x6b2f('0x3'));var auth=require(_0x6b2f('0x4'));var interaction=require(_0x6b2f('0x5'));var config=require(_0x6b2f('0x6'));var controller=require(_0x6b2f('0x7'));router[_0x6b2f('0x8')]('/',auth[_0x6b2f('0x9')](),controller[_0x6b2f('0xa')]);router[_0x6b2f('0x8')](_0x6b2f('0xb'),auth[_0x6b2f('0x9')](),controller[_0x6b2f('0xc')]);router[_0x6b2f('0x8')](_0x6b2f('0xd'),auth[_0x6b2f('0x9')](),controller[_0x6b2f('0xe')]);router[_0x6b2f('0xf')]('/',auth[_0x6b2f('0x9')](),controller[_0x6b2f('0x10')]);router[_0x6b2f('0x11')](_0x6b2f('0xd'),auth[_0x6b2f('0x9')](),controller['update']);router[_0x6b2f('0x12')](_0x6b2f('0xd'),auth['isAuthenticated'](),controller[_0x6b2f('0x13')]);module[_0x6b2f('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index d9b23f0..0fc15b5 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x45268e,_0x5ee19e){var _0x36d493=function(_0x59b799){while(--_0x59b799){_0x45268e['push'](_0x45268e['shift']());}};_0x36d493(++_0x5ee19e);}(_0x008c,0x188));var _0xc008=function(_0x477b78,_0x302499){_0x477b78=_0x477b78-0x0;var _0x2f3f99=_0x008c[_0x477b78];return _0x2f3f99;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2dee76,_0x4a877d){var _0x433ba8=function(_0x3cdf4f){while(--_0x3cdf4f){_0x2dee76['push'](_0x2dee76['shift']());}};_0x433ba8(++_0x4a877d);}(_0xaa88,0x137));var _0x8aa8=function(_0x4d0df6,_0x4634f3){_0x4d0df6=_0x4d0df6-0x0;var _0x4e2615=_0xaa88[_0x4d0df6];return _0x4e2615;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 914b873..1c46113 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 _0x2d40=['rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','type','VIRTUAL','MailTransferReport','then','includeAll','findAll','rows','catch','params','options','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','error','stack','name','send','index','map'];(function(_0x5949ac,_0x54900f){var _0x30c367=function(_0x29d457){while(--_0x29d457){_0x5949ac['push'](_0x5949ac['shift']());}};_0x30c367(++_0x54900f);}(_0x2d40,0x18d));var _0x02d4=function(_0x17bd21,_0x436810){_0x17bd21=_0x17bd21-0x0;var _0x379ba3=_0x2d40[_0x17bd21];return _0x379ba3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x02d4('0x0'));var zipdir=require(_0x02d4('0x1'));var jsonpatch=require(_0x02d4('0x2'));var rp=require('request-promise');var moment=require(_0x02d4('0x3'));var BPromise=require(_0x02d4('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x02d4('0x5'));var sox=require(_0x02d4('0x6'));var csv=require(_0x02d4('0x7'));var ejs=require(_0x02d4('0x8'));var fs=require('fs');var fs_extra=require(_0x02d4('0x9'));var _=require('lodash');var squel=require(_0x02d4('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x02d4('0xb'));var toCsv=require(_0x02d4('0x7'));var querystring=require('querystring');var Papa=require(_0x02d4('0xc'));var Redis=require(_0x02d4('0xd'));var authService=require(_0x02d4('0xe'));var qs=require(_0x02d4('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x02d4('0x10'));var logger=require(_0x02d4('0x11'))(_0x02d4('0x12'));var utils=require(_0x02d4('0x13'));var config=require(_0x02d4('0x14'));var licenseUtil=require(_0x02d4('0x15'));var db=require(_0x02d4('0x16'))['db'];function respondWithStatusCode(_0x57bd97,_0xda89f7){_0xda89f7=_0xda89f7||0xcc;return function(_0x4784a3){if(_0x4784a3){return _0x57bd97[_0x02d4('0x17')](_0xda89f7);}return _0x57bd97[_0x02d4('0x18')](_0xda89f7)[_0x02d4('0x19')]();};}function respondWithResult(_0xd46f8d,_0x416a89){_0x416a89=_0x416a89||0xc8;return function(_0x4983af){if(_0x4983af){return _0xd46f8d[_0x02d4('0x18')](_0x416a89)['json'](_0x4983af);}};}function respondWithFilteredResult(_0x4ef935,_0x16cd6f){return function(_0x346270){if(_0x346270){var _0x1c8434=typeof _0x16cd6f[_0x02d4('0x1a')]===_0x02d4('0x1b')&&typeof _0x16cd6f[_0x02d4('0x1c')]==='undefined';var _0x5cbf7c=_0x346270[_0x02d4('0x1d')];var _0x43c29e=_0x1c8434?0x0:_0x16cd6f['offset'];var _0x5485ff=_0x1c8434?_0x346270[_0x02d4('0x1d')]:_0x16cd6f[_0x02d4('0x1a')]+_0x16cd6f[_0x02d4('0x1c')];var _0x37cd81;if(_0x5485ff>=_0x5cbf7c){_0x5485ff=_0x5cbf7c;_0x37cd81=0xc8;}else{_0x37cd81=0xce;}_0x4ef935[_0x02d4('0x18')](_0x37cd81);return _0x4ef935['set'](_0x02d4('0x1e'),_0x43c29e+'-'+_0x5485ff+'/'+_0x5cbf7c)[_0x02d4('0x1f')](_0x346270);}return null;};}function patchUpdates(_0x234cda){return function(_0x4a37ad){try{jsonpatch['apply'](_0x4a37ad,_0x234cda,!![]);}catch(_0x2a62eb){return BPromise[_0x02d4('0x20')](_0x2a62eb);}return _0x4a37ad[_0x02d4('0x21')]();};}function saveUpdates(_0xcd3c6f,_0x2716c0){return function(_0x57cc9d){if(_0x57cc9d){return _0x57cc9d[_0x02d4('0x22')](_0xcd3c6f)['then'](function(_0xfbc2cc){return _0xfbc2cc;});}return null;};}function removeEntity(_0x4e1d9c,_0x1956d0){return function(_0x2a35eb){if(_0x2a35eb){return _0x2a35eb['destroy']()['then'](function(){_0x4e1d9c[_0x02d4('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x363d59,_0x2582eb){return function(_0x2c4324){if(!_0x2c4324){_0x363d59['sendStatus'](0x194);}return _0x2c4324;};}function handleError(_0x5abe3b,_0x15e9f5){_0x15e9f5=_0x15e9f5||0x1f4;return function(_0x704ccb){logger[_0x02d4('0x23')](_0x704ccb[_0x02d4('0x24')]);if(_0x704ccb['name']){delete _0x704ccb[_0x02d4('0x25')];}_0x5abe3b['status'](_0x15e9f5)[_0x02d4('0x26')](_0x704ccb);};}exports[_0x02d4('0x27')]=function(_0x341b16,_0x42efdc){var _0x35ad70={},_0x336890={},_0x46d510={'count':0x0,'rows':[]};var _0x42674d=_[_0x02d4('0x28')](db['MailTransferReport'][_0x02d4('0x29')],function(_0x4b6100){return{'name':_0x4b6100[_0x02d4('0x2a')],'type':_0x4b6100['type'][_0x02d4('0x2b')]};});_0x336890[_0x02d4('0x2c')]=_[_0x02d4('0x28')](_0x42674d,'name');_0x336890[_0x02d4('0x2d')]=_[_0x02d4('0x2e')](_0x341b16['query']);_0x336890[_0x02d4('0x2f')]=_[_0x02d4('0x30')](_0x336890['model'],_0x336890[_0x02d4('0x2d')]);_0x35ad70[_0x02d4('0x31')]=_[_0x02d4('0x30')](_0x336890[_0x02d4('0x2c')],qs[_0x02d4('0x32')](_0x341b16[_0x02d4('0x2d')][_0x02d4('0x32')]));_0x35ad70['attributes']=_0x35ad70[_0x02d4('0x31')][_0x02d4('0x33')]?_0x35ad70[_0x02d4('0x31')]:_0x336890[_0x02d4('0x2c')];if(!_0x341b16['query'][_0x02d4('0x34')](_0x02d4('0x35'))){_0x35ad70[_0x02d4('0x1c')]=qs[_0x02d4('0x1c')](_0x341b16[_0x02d4('0x2d')]['limit']);_0x35ad70[_0x02d4('0x1a')]=qs[_0x02d4('0x1a')](_0x341b16[_0x02d4('0x2d')]['offset']);}_0x35ad70['order']=qs[_0x02d4('0x36')](_0x341b16[_0x02d4('0x2d')][_0x02d4('0x36')]);_0x35ad70['where']=qs[_0x02d4('0x2f')](_[_0x02d4('0x37')](_0x341b16['query'],_0x336890[_0x02d4('0x2f')]),_0x42674d);if(_0x341b16[_0x02d4('0x2d')][_0x02d4('0x38')]){_0x35ad70['where']=_[_0x02d4('0x39')](_0x35ad70[_0x02d4('0x3a')],{'$or':_['map'](_0x42674d,function(_0x73786){if(_0x73786[_0x02d4('0x3b')]!==_0x02d4('0x3c')){var _0x2fd60a={};_0x2fd60a[_0x73786[_0x02d4('0x25')]]={'$like':'%'+_0x341b16[_0x02d4('0x2d')][_0x02d4('0x38')]+'%'};return _0x2fd60a;}})});}_0x35ad70=_[_0x02d4('0x39')]({},_0x35ad70,_0x341b16['options']);var _0x17f19b={'where':_0x35ad70['where']};return db[_0x02d4('0x3d')][_0x02d4('0x1d')](_0x17f19b)[_0x02d4('0x3e')](function(_0x37bea0){_0x46d510[_0x02d4('0x1d')]=_0x37bea0;if(_0x341b16[_0x02d4('0x2d')][_0x02d4('0x3f')]){_0x35ad70['include']=[{'all':!![]}];}return db[_0x02d4('0x3d')][_0x02d4('0x40')](_0x35ad70);})['then'](function(_0x9918ed){_0x46d510[_0x02d4('0x41')]=_0x9918ed;return _0x46d510;})['then'](respondWithFilteredResult(_0x42efdc,_0x35ad70))[_0x02d4('0x42')](handleError(_0x42efdc,null));};exports['show']=function(_0xb0c8dd,_0x4b3f6a){var _0x159c1f={'raw':!![],'where':{'id':_0xb0c8dd[_0x02d4('0x43')]['id']}},_0x3b3f41={};_0x3b3f41[_0x02d4('0x2c')]=_[_0x02d4('0x2e')](db[_0x02d4('0x3d')][_0x02d4('0x29')]);_0x3b3f41[_0x02d4('0x2d')]=_[_0x02d4('0x2e')](_0xb0c8dd[_0x02d4('0x2d')]);_0x3b3f41[_0x02d4('0x2f')]=_[_0x02d4('0x30')](_0x3b3f41['model'],_0x3b3f41[_0x02d4('0x2d')]);_0x159c1f[_0x02d4('0x31')]=_[_0x02d4('0x30')](_0x3b3f41['model'],qs[_0x02d4('0x32')](_0xb0c8dd[_0x02d4('0x2d')]['fields']));_0x159c1f[_0x02d4('0x31')]=_0x159c1f[_0x02d4('0x31')]['length']?_0x159c1f['attributes']:_0x3b3f41[_0x02d4('0x2c')];if(_0xb0c8dd[_0x02d4('0x2d')][_0x02d4('0x3f')]){_0x159c1f['include']=[{'all':!![]}];}_0x159c1f=_[_0x02d4('0x39')]({},_0x159c1f,_0xb0c8dd[_0x02d4('0x44')]);return db[_0x02d4('0x3d')][_0x02d4('0x45')](_0x159c1f)[_0x02d4('0x3e')](handleEntityNotFound(_0x4b3f6a,null))['then'](respondWithResult(_0x4b3f6a,null))[_0x02d4('0x42')](handleError(_0x4b3f6a,null));};exports[_0x02d4('0x46')]=function(_0x4c5d14,_0x38703d){return db['MailTransferReport']['create'](_0x4c5d14[_0x02d4('0x47')],{})['then'](respondWithResult(_0x38703d,0xc9))[_0x02d4('0x42')](handleError(_0x38703d,null));};exports[_0x02d4('0x22')]=function(_0x2b5b72,_0x52bce0){if(_0x2b5b72['body']['id']){delete _0x2b5b72['body']['id'];}return db['MailTransferReport'][_0x02d4('0x45')]({'where':{'id':_0x2b5b72['params']['id']}})[_0x02d4('0x3e')](handleEntityNotFound(_0x52bce0,null))['then'](saveUpdates(_0x2b5b72['body'],null))[_0x02d4('0x3e')](respondWithResult(_0x52bce0,null))[_0x02d4('0x42')](handleError(_0x52bce0,null));};exports['destroy']=function(_0x1b1c2e,_0xdc8fad){return db['MailTransferReport'][_0x02d4('0x45')]({'where':{'id':_0x1b1c2e[_0x02d4('0x43')]['id']}})[_0x02d4('0x3e')](handleEntityNotFound(_0xdc8fad,null))[_0x02d4('0x3e')](removeEntity(_0xdc8fad,null))[_0x02d4('0x42')](handleError(_0xdc8fad,null));};exports[_0x02d4('0x48')]=function(_0x66d97c,_0x413906){return db['MailTransferReport'][_0x02d4('0x48')]()[_0x02d4('0x3e')](respondWithResult(_0x413906,null))[_0x02d4('0x42')](handleError(_0x413906,null));}; \ No newline at end of file +var _0xe41f=['sort','pick','filter','where','VIRTUAL','merge','options','MailTransferReport','then','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','request-promise','moment','bluebird','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x315b8e,_0x2e9e0b){var _0x20516a=function(_0x22318e){while(--_0x22318e){_0x315b8e['push'](_0x315b8e['shift']());}};_0x20516a(++_0x2e9e0b);}(_0xe41f,0x1d7));var _0xfe41=function(_0x4c5179,_0x175196){_0x4c5179=_0x4c5179-0x0;var _0xcb6366=_0xe41f[_0x4c5179];return _0xcb6366;};'use strict';var emlformat=require(_0xfe41('0x0'));var rimraf=require(_0xfe41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfe41('0x2'));var moment=require(_0xfe41('0x3'));var BPromise=require(_0xfe41('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xfe41('0x5'));var csv=require(_0xfe41('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe41('0x7'));var _=require(_0xfe41('0x8'));var squel=require(_0xfe41('0x9'));var crypto=require('crypto');var jsforce=require(_0xfe41('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xfe41('0x6'));var querystring=require(_0xfe41('0xb'));var Papa=require(_0xfe41('0xc'));var Redis=require(_0xfe41('0xd'));var authService=require(_0xfe41('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfe41('0xf'));var hardwareService=require(_0xfe41('0x10'));var logger=require(_0xfe41('0x11'))('api');var utils=require(_0xfe41('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xfe41('0x13'));var db=require(_0xfe41('0x14'))['db'];function respondWithStatusCode(_0x4d6b57,_0x41d5c8){_0x41d5c8=_0x41d5c8||0xcc;return function(_0x490ca8){if(_0x490ca8){return _0x4d6b57[_0xfe41('0x15')](_0x41d5c8);}return _0x4d6b57[_0xfe41('0x16')](_0x41d5c8)['end']();};}function respondWithResult(_0x5cbae5,_0x136b0f){_0x136b0f=_0x136b0f||0xc8;return function(_0x4fa317){if(_0x4fa317){return _0x5cbae5[_0xfe41('0x16')](_0x136b0f)[_0xfe41('0x17')](_0x4fa317);}};}function respondWithFilteredResult(_0xd5047e,_0xf00123){return function(_0x51bcec){if(_0x51bcec){var _0x2bf946=typeof _0xf00123['offset']===_0xfe41('0x18')&&typeof _0xf00123[_0xfe41('0x19')]==='undefined';var _0x554b2f=_0x51bcec[_0xfe41('0x1a')];var _0x3298eb=_0x2bf946?0x0:_0xf00123[_0xfe41('0x1b')];var _0x10c74d=_0x2bf946?_0x51bcec[_0xfe41('0x1a')]:_0xf00123[_0xfe41('0x1b')]+_0xf00123[_0xfe41('0x19')];var _0x3ba2f4;if(_0x10c74d>=_0x554b2f){_0x10c74d=_0x554b2f;_0x3ba2f4=0xc8;}else{_0x3ba2f4=0xce;}_0xd5047e['status'](_0x3ba2f4);return _0xd5047e[_0xfe41('0x1c')](_0xfe41('0x1d'),_0x3298eb+'-'+_0x10c74d+'/'+_0x554b2f)['json'](_0x51bcec);}return null;};}function patchUpdates(_0x1b6bc5){return function(_0x262ab6){try{jsonpatch['apply'](_0x262ab6,_0x1b6bc5,!![]);}catch(_0x11bc39){return BPromise[_0xfe41('0x1e')](_0x11bc39);}return _0x262ab6[_0xfe41('0x1f')]();};}function saveUpdates(_0x771962,_0x2efca4){return function(_0x1a7b42){if(_0x1a7b42){return _0x1a7b42[_0xfe41('0x20')](_0x771962)['then'](function(_0x5a9b0a){return _0x5a9b0a;});}return null;};}function removeEntity(_0x36757a,_0x51cc01){return function(_0x32231c){if(_0x32231c){return _0x32231c['destroy']()['then'](function(){_0x36757a[_0xfe41('0x16')](0xcc)[_0xfe41('0x21')]();});}};}function handleEntityNotFound(_0x45bceb,_0x18e44f){return function(_0x5077cc){if(!_0x5077cc){_0x45bceb['sendStatus'](0x194);}return _0x5077cc;};}function handleError(_0x30a498,_0x42db5e){_0x42db5e=_0x42db5e||0x1f4;return function(_0x53eb32){logger[_0xfe41('0x22')](_0x53eb32[_0xfe41('0x23')]);if(_0x53eb32[_0xfe41('0x24')]){delete _0x53eb32['name'];}_0x30a498[_0xfe41('0x16')](_0x42db5e)[_0xfe41('0x25')](_0x53eb32);};}exports[_0xfe41('0x26')]=function(_0x457075,_0x5958a1){var _0x14b6e8={},_0x2046c1={},_0x55d789={'count':0x0,'rows':[]};var _0x16b456=_['map'](db['MailTransferReport'][_0xfe41('0x27')],function(_0x1b0d32){return{'name':_0x1b0d32[_0xfe41('0x28')],'type':_0x1b0d32[_0xfe41('0x29')][_0xfe41('0x2a')]};});_0x2046c1[_0xfe41('0x2b')]=_[_0xfe41('0x2c')](_0x16b456,_0xfe41('0x24'));_0x2046c1[_0xfe41('0x2d')]=_['keys'](_0x457075[_0xfe41('0x2d')]);_0x2046c1[_0xfe41('0x2e')]=_[_0xfe41('0x2f')](_0x2046c1[_0xfe41('0x2b')],_0x2046c1[_0xfe41('0x2d')]);_0x14b6e8[_0xfe41('0x30')]=_[_0xfe41('0x2f')](_0x2046c1[_0xfe41('0x2b')],qs[_0xfe41('0x31')](_0x457075[_0xfe41('0x2d')][_0xfe41('0x31')]));_0x14b6e8[_0xfe41('0x30')]=_0x14b6e8['attributes'][_0xfe41('0x32')]?_0x14b6e8[_0xfe41('0x30')]:_0x2046c1[_0xfe41('0x2b')];if(!_0x457075[_0xfe41('0x2d')][_0xfe41('0x33')](_0xfe41('0x34'))){_0x14b6e8['limit']=qs[_0xfe41('0x19')](_0x457075[_0xfe41('0x2d')][_0xfe41('0x19')]);_0x14b6e8[_0xfe41('0x1b')]=qs[_0xfe41('0x1b')](_0x457075[_0xfe41('0x2d')]['offset']);}_0x14b6e8[_0xfe41('0x35')]=qs[_0xfe41('0x36')](_0x457075[_0xfe41('0x2d')][_0xfe41('0x36')]);_0x14b6e8['where']=qs[_0xfe41('0x2e')](_[_0xfe41('0x37')](_0x457075[_0xfe41('0x2d')],_0x2046c1[_0xfe41('0x2e')]),_0x16b456);if(_0x457075['query'][_0xfe41('0x38')]){_0x14b6e8[_0xfe41('0x39')]=_['merge'](_0x14b6e8[_0xfe41('0x39')],{'$or':_[_0xfe41('0x2c')](_0x16b456,function(_0x682789){if(_0x682789[_0xfe41('0x29')]!==_0xfe41('0x3a')){var _0x41cba3={};_0x41cba3[_0x682789[_0xfe41('0x24')]]={'$like':'%'+_0x457075[_0xfe41('0x2d')][_0xfe41('0x38')]+'%'};return _0x41cba3;}})});}_0x14b6e8=_[_0xfe41('0x3b')]({},_0x14b6e8,_0x457075[_0xfe41('0x3c')]);var _0x4554b9={'where':_0x14b6e8[_0xfe41('0x39')]};return db[_0xfe41('0x3d')][_0xfe41('0x1a')](_0x4554b9)[_0xfe41('0x3e')](function(_0x42e648){_0x55d789['count']=_0x42e648;if(_0x457075[_0xfe41('0x2d')][_0xfe41('0x3f')]){_0x14b6e8[_0xfe41('0x40')]=[{'all':!![]}];}return db[_0xfe41('0x3d')][_0xfe41('0x41')](_0x14b6e8);})[_0xfe41('0x3e')](function(_0x18c947){_0x55d789[_0xfe41('0x42')]=_0x18c947;return _0x55d789;})['then'](respondWithFilteredResult(_0x5958a1,_0x14b6e8))[_0xfe41('0x43')](handleError(_0x5958a1,null));};exports[_0xfe41('0x44')]=function(_0x4e4ec9,_0x1a3fd0){var _0x4aa9e2={'raw':!![],'where':{'id':_0x4e4ec9[_0xfe41('0x45')]['id']}},_0x3d6f4d={};_0x3d6f4d[_0xfe41('0x2b')]=_[_0xfe41('0x46')](db[_0xfe41('0x3d')]['rawAttributes']);_0x3d6f4d[_0xfe41('0x2d')]=_[_0xfe41('0x46')](_0x4e4ec9[_0xfe41('0x2d')]);_0x3d6f4d[_0xfe41('0x2e')]=_[_0xfe41('0x2f')](_0x3d6f4d[_0xfe41('0x2b')],_0x3d6f4d['query']);_0x4aa9e2[_0xfe41('0x30')]=_['intersection'](_0x3d6f4d[_0xfe41('0x2b')],qs[_0xfe41('0x31')](_0x4e4ec9['query'][_0xfe41('0x31')]));_0x4aa9e2[_0xfe41('0x30')]=_0x4aa9e2['attributes'][_0xfe41('0x32')]?_0x4aa9e2[_0xfe41('0x30')]:_0x3d6f4d[_0xfe41('0x2b')];if(_0x4e4ec9[_0xfe41('0x2d')]['includeAll']){_0x4aa9e2['include']=[{'all':!![]}];}_0x4aa9e2=_[_0xfe41('0x3b')]({},_0x4aa9e2,_0x4e4ec9[_0xfe41('0x3c')]);return db[_0xfe41('0x3d')]['find'](_0x4aa9e2)[_0xfe41('0x3e')](handleEntityNotFound(_0x1a3fd0,null))[_0xfe41('0x3e')](respondWithResult(_0x1a3fd0,null))[_0xfe41('0x43')](handleError(_0x1a3fd0,null));};exports['create']=function(_0x4e17a8,_0x485f0d){return db[_0xfe41('0x3d')][_0xfe41('0x47')](_0x4e17a8['body'],{})['then'](respondWithResult(_0x485f0d,0xc9))[_0xfe41('0x43')](handleError(_0x485f0d,null));};exports[_0xfe41('0x20')]=function(_0x3e9fa8,_0x119129){if(_0x3e9fa8['body']['id']){delete _0x3e9fa8[_0xfe41('0x48')]['id'];}return db[_0xfe41('0x3d')][_0xfe41('0x49')]({'where':{'id':_0x3e9fa8[_0xfe41('0x45')]['id']}})[_0xfe41('0x3e')](handleEntityNotFound(_0x119129,null))[_0xfe41('0x3e')](saveUpdates(_0x3e9fa8[_0xfe41('0x48')],null))[_0xfe41('0x3e')](respondWithResult(_0x119129,null))[_0xfe41('0x43')](handleError(_0x119129,null));};exports[_0xfe41('0x4a')]=function(_0x1ba763,_0x2ed3f4){return db[_0xfe41('0x3d')][_0xfe41('0x49')]({'where':{'id':_0x1ba763['params']['id']}})['then'](handleEntityNotFound(_0x2ed3f4,null))[_0xfe41('0x3e')](removeEntity(_0x2ed3f4,null))[_0xfe41('0x43')](handleError(_0x2ed3f4,null));};exports['describe']=function(_0xaf6b10,_0x5333f5){return db[_0xfe41('0x3d')]['describe']()[_0xfe41('0x3e')](respondWithResult(_0x5333f5,null))[_0xfe41('0x43')](handleError(_0x5333f5,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 2469715..89a7402 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 _0xfcda=['api','path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','MailTransferReport','uniqueid','lodash','util'];(function(_0x27eacf,_0x5c8bf2){var _0x4276b9=function(_0x274ede){while(--_0x274ede){_0x27eacf['push'](_0x27eacf['shift']());}};_0x4276b9(++_0x5c8bf2);}(_0xfcda,0x198));var _0xafcd=function(_0x230784,_0x402618){_0x230784=_0x230784-0x0;var _0x4f54f=_0xfcda[_0x230784];return _0x4f54f;};'use strict';var _=require(_0xafcd('0x0'));var util=require(_0xafcd('0x1'));var logger=require('../../config/logger')(_0xafcd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xafcd('0x3'));var rimraf=require(_0xafcd('0x4'));var config=require(_0xafcd('0x5'));var attributes=require(_0xafcd('0x6'));module[_0xafcd('0x7')]=function(_0x412e67,_0x2623cb){return _0x412e67['define'](_0xafcd('0x8'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xafcd('0x9'),'fields':[_0xafcd('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb94=['uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer'];(function(_0x4dd657,_0x193e9e){var _0x301553=function(_0x2233c7){while(--_0x2233c7){_0x4dd657['push'](_0x4dd657['shift']());}};_0x301553(++_0x193e9e);}(_0xdb94,0xe5));var _0x4db9=function(_0x358fc6,_0x17c780){_0x358fc6=_0x358fc6-0x0;var _0x113c75=_0xdb94[_0x358fc6];return _0x113c75;};'use strict';var _=require('lodash');var util=require(_0x4db9('0x0'));var logger=require(_0x4db9('0x1'))('api');var moment=require(_0x4db9('0x2'));var BPromise=require(_0x4db9('0x3'));var rp=require(_0x4db9('0x4'));var fs=require('fs');var path=require(_0x4db9('0x5'));var rimraf=require(_0x4db9('0x6'));var config=require('../../config/environment');var attributes=require(_0x4db9('0x7'));module['exports']=function(_0x1d21a8,_0xc76bc1){return _0x1d21a8[_0x4db9('0x8')](_0x4db9('0x9'),attributes,{'tableName':_0x4db9('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x4db9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 81c15ec..5dab247 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 _0x03a6=['jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x355ca3,_0xd3e1e7){var _0x55edba=function(_0x29ec8e){while(--_0x29ec8e){_0x355ca3['push'](_0x355ca3['shift']());}};_0x55edba(++_0xd3e1e7);}(_0x03a6,0xcf));var _0x603a=function(_0x35bde6,_0x56d846){_0x35bde6=_0x35bde6-0x0;var _0x971a1a=_0x03a6[_0x35bde6];return _0x971a1a;};'use strict';var _=require(_0x603a('0x0'));var util=require(_0x603a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x603a('0x2'));var fs=require('fs');var Redis=require(_0x603a('0x3'));var db=require(_0x603a('0x4'))['db'];var utils=require(_0x603a('0x5'));var logger=require(_0x603a('0x6'))(_0x603a('0x7'));var config=require(_0x603a('0x8'));var jayson=require(_0x603a('0x9'));var client=jayson[_0x603a('0xa')][_0x603a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x386b8a,_0x379f15,_0xa02b22){return new BPromise(function(_0x3e5d4b,_0x5079f3){return client[_0x603a('0xc')](_0x386b8a,_0xa02b22)[_0x603a('0xd')](function(_0x27d70b){logger[_0x603a('0xe')](_0x603a('0xf'),_0x379f15,_0x603a('0x10'));logger[_0x603a('0x11')](_0x603a('0x12'),_0x379f15,_0x603a('0x10'),JSON[_0x603a('0x13')](_0x27d70b));if(_0x27d70b[_0x603a('0x14')]){if(_0x27d70b[_0x603a('0x14')][_0x603a('0x15')]===0x1f4){logger[_0x603a('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x379f15,_0x27d70b[_0x603a('0x14')][_0x603a('0x16')]);return _0x5079f3(_0x27d70b[_0x603a('0x14')][_0x603a('0x16')]);}logger[_0x603a('0x14')](_0x603a('0xf'),_0x379f15,_0x27d70b[_0x603a('0x14')][_0x603a('0x16')]);return _0x3e5d4b(_0x27d70b[_0x603a('0x14')][_0x603a('0x16')]);}else{logger[_0x603a('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x379f15,'request\x20sent');_0x3e5d4b(_0x27d70b['result'][_0x603a('0x16')]);}})[_0x603a('0x17')](function(_0x399241){logger[_0x603a('0x14')]('MailTransferReport,\x20%s,\x20%s',_0x379f15,_0x399241);_0x5079f3(_0x399241);});});} \ No newline at end of file +var _0x3cdf=['rpc','jayson/promise','http','request','then','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2d892a,_0x59e61a){var _0x367765=function(_0x1c9901){while(--_0x1c9901){_0x2d892a['push'](_0x2d892a['shift']());}};_0x367765(++_0x59e61a);}(_0x3cdf,0x142));var _0xf3cd=function(_0x1009fa,_0x40aa84){_0x1009fa=_0x1009fa-0x0;var _0x2508f9=_0x3cdf[_0x1009fa];return _0x2508f9;};'use strict';var _=require(_0xf3cd('0x0'));var util=require(_0xf3cd('0x1'));var moment=require(_0xf3cd('0x2'));var BPromise=require('bluebird');var rs=require(_0xf3cd('0x3'));var fs=require('fs');var Redis=require(_0xf3cd('0x4'));var db=require(_0xf3cd('0x5'))['db'];var utils=require(_0xf3cd('0x6'));var logger=require(_0xf3cd('0x7'))(_0xf3cd('0x8'));var config=require('../../config/environment');var jayson=require(_0xf3cd('0x9'));var client=jayson['client'][_0xf3cd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x195193,_0x1ac03f,_0x469750){return new BPromise(function(_0x1ba18c,_0x4161bb){return client[_0xf3cd('0xb')](_0x195193,_0x469750)[_0xf3cd('0xc')](function(_0x4be1d7){logger['info'](_0xf3cd('0xd'),_0x1ac03f,'request\x20sent');logger[_0xf3cd('0xe')](_0xf3cd('0xf'),_0x1ac03f,'request\x20sent',JSON[_0xf3cd('0x10')](_0x4be1d7));if(_0x4be1d7[_0xf3cd('0x11')]){if(_0x4be1d7['error'][_0xf3cd('0x12')]===0x1f4){logger[_0xf3cd('0x11')](_0xf3cd('0xd'),_0x1ac03f,_0x4be1d7[_0xf3cd('0x11')][_0xf3cd('0x13')]);return _0x4161bb(_0x4be1d7[_0xf3cd('0x11')][_0xf3cd('0x13')]);}logger[_0xf3cd('0x11')](_0xf3cd('0xd'),_0x1ac03f,_0x4be1d7[_0xf3cd('0x11')][_0xf3cd('0x13')]);return _0x1ba18c(_0x4be1d7[_0xf3cd('0x11')]['message']);}else{logger[_0xf3cd('0x14')](_0xf3cd('0xd'),_0x1ac03f,_0xf3cd('0x15'));_0x1ba18c(_0x4be1d7['result']['message']);}})['catch'](function(_0x3f51e4){logger[_0xf3cd('0x11')](_0xf3cd('0xd'),_0x1ac03f,_0x3f51e4);_0x4161bb(_0x3f51e4);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 20833b5..9b4c0c6 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 _0xd08d=['describe','/:id','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe'];(function(_0x137b22,_0x39adfa){var _0x46f2e9=function(_0x39f4e7){while(--_0x39f4e7){_0x137b22['push'](_0x137b22['shift']());}};_0x46f2e9(++_0x39adfa);}(_0xd08d,0x1c0));var _0xdd08=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xd08d[_0x1a36a5];return _0x746243;};'use strict';var multer=require('multer');var util=require(_0xdd08('0x0'));var path=require(_0xdd08('0x1'));var timeout=require(_0xdd08('0x2'));var express=require(_0xdd08('0x3'));var router=express[_0xdd08('0x4')]();var fs_extra=require(_0xdd08('0x5'));var auth=require(_0xdd08('0x6'));var interaction=require(_0xdd08('0x7'));var config=require(_0xdd08('0x8'));var controller=require(_0xdd08('0x9'));router[_0xdd08('0xa')]('/',auth[_0xdd08('0xb')](),controller[_0xdd08('0xc')]);router[_0xdd08('0xa')](_0xdd08('0xd'),auth['isAuthenticated'](),controller[_0xdd08('0xe')]);router['get'](_0xdd08('0xf'),auth[_0xdd08('0xb')](),controller['show']);router[_0xdd08('0x10')]('/',auth[_0xdd08('0xb')](),controller[_0xdd08('0x11')]);router[_0xdd08('0x12')](_0xdd08('0xf'),auth[_0xdd08('0xb')](),controller['update']);router[_0xdd08('0x13')]('/:id',auth[_0xdd08('0xb')](),controller[_0xdd08('0x14')]);module[_0xdd08('0x15')]=router; \ No newline at end of file +var _0x9261=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','index','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x1584ca,_0x5acb5c){var _0x16213b=function(_0x4a87c7){while(--_0x4a87c7){_0x1584ca['push'](_0x1584ca['shift']());}};_0x16213b(++_0x5acb5c);}(_0x9261,0xc2));var _0x1926=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x9261[_0x5f3f88];return _0xd08119;};'use strict';var multer=require(_0x1926('0x0'));var util=require(_0x1926('0x1'));var path=require(_0x1926('0x2'));var timeout=require(_0x1926('0x3'));var express=require(_0x1926('0x4'));var router=express[_0x1926('0x5')]();var fs_extra=require(_0x1926('0x6'));var auth=require(_0x1926('0x7'));var interaction=require(_0x1926('0x8'));var config=require(_0x1926('0x9'));var controller=require(_0x1926('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x1926('0xb')]);router[_0x1926('0xc')]('/describe',auth[_0x1926('0xd')](),controller['describe']);router[_0x1926('0xc')](_0x1926('0xe'),auth[_0x1926('0xd')](),controller['show']);router[_0x1926('0xf')]('/',auth[_0x1926('0xd')](),controller[_0x1926('0x10')]);router[_0x1926('0x11')](_0x1926('0xe'),auth[_0x1926('0xd')](),controller[_0x1926('0x12')]);router[_0x1926('0x13')]('/:id',auth[_0x1926('0xd')](),controller[_0x1926('0x14')]);module[_0x1926('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 493dce0..c56873c 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 _0x851c=['setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x815c23,_0x577e3a){var _0x357aa1=function(_0x289b7a){while(--_0x289b7a){_0x815c23['push'](_0x815c23['shift']());}};_0x357aa1(++_0x577e3a);}(_0x851c,0x19d));var _0xc851=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x851c[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xc851('0x0'));var moment=require(_0xc851('0x1'));module[_0xc851('0x2')]={'channel':{'type':Sequelize[_0xc851('0x3')]},'membername':{'type':Sequelize[_0xc851('0x3')]},'interface':{'type':Sequelize[_0xc851('0x3')]},'type':{'type':Sequelize[_0xc851('0x3')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xc851('0x4')},'duration':{'type':Sequelize[_0xc851('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc851('0x6')],'set':function(_0x272e34){var _0x535cf1=moment(_0x272e34);var _0x3067e5=moment(this['getDataValue']('enterAt'));var _0x12a405=_0x535cf1['diff'](_0x3067e5,'seconds');this[_0xc851('0x7')](_0xc851('0x8'),_0x272e34);this[_0xc851('0x7')](_0xc851('0x9'),_0x12a405||null);}},'data1':{'type':Sequelize[_0xc851('0x3')],'comment':_0xc851('0xa')},'data2':{'type':Sequelize[_0xc851('0x3')],'comment':_0xc851('0xb')},'data3':{'type':Sequelize['STRING'],'comment':_0xc851('0xc')},'data4':{'type':Sequelize[_0xc851('0x3')],'comment':_0xc851('0xd')},'data5':{'type':Sequelize[_0xc851('0x3')],'comment':_0xc851('0xe')},'role':{'type':Sequelize[_0xc851('0x3')]},'internal':{'type':Sequelize[_0xc851('0x5')]},'uniqueid':{'type':Sequelize[_0xc851('0x3')]}}; \ No newline at end of file +var _0x1e69=['DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','moment','exports','STRING'];(function(_0x1332e8,_0x49d9d9){var _0x2687d2=function(_0x2ed971){while(--_0x2ed971){_0x1332e8['push'](_0x1332e8['shift']());}};_0x2687d2(++_0x49d9d9);}(_0x1e69,0x85));var _0x91e6=function(_0x591cfd,_0x501204){_0x591cfd=_0x591cfd-0x0;var _0x4d0100=_0x1e69[_0x591cfd];return _0x4d0100;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x91e6('0x0'));module[_0x91e6('0x1')]={'channel':{'type':Sequelize[_0x91e6('0x2')]},'membername':{'type':Sequelize[_0x91e6('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0x91e6('0x3'),'comment':_0x91e6('0x4')},'duration':{'type':Sequelize[_0x91e6('0x5')]},'enterAt':{'type':Sequelize[_0x91e6('0x6')]},'exitAt':{'type':Sequelize[_0x91e6('0x6')],'set':function(_0x42fe90){var _0x4091b8=moment(_0x42fe90);var _0x2733bf=moment(this[_0x91e6('0x7')](_0x91e6('0x8')));var _0x266fe6=_0x4091b8[_0x91e6('0x9')](_0x2733bf,_0x91e6('0xa'));this['setDataValue']('exitAt',_0x42fe90);this[_0x91e6('0xb')](_0x91e6('0xc'),_0x266fe6||null);}},'data1':{'type':Sequelize[_0x91e6('0x2')],'comment':_0x91e6('0xd')},'data2':{'type':Sequelize['STRING'],'comment':_0x91e6('0xe')},'data3':{'type':Sequelize[_0x91e6('0x2')],'comment':_0x91e6('0xf')},'data4':{'type':Sequelize[_0x91e6('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x91e6('0x2')],'comment':_0x91e6('0x10')},'role':{'type':Sequelize[_0x91e6('0x2')]},'internal':{'type':Sequelize[_0x91e6('0x5')]},'uniqueid':{'type':Sequelize[_0x91e6('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index dbcab59..6680290 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 _0x9957=['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','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x19a0bc,_0x2f7125){var _0x4d6c30=function(_0x35b981){while(--_0x35b981){_0x19a0bc['push'](_0x19a0bc['shift']());}};_0x4d6c30(++_0x2f7125);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['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['MemberReport'][_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['MemberReport'][_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('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0xae10d7,_0x4346fb){var _0x5abdbf=function(_0x235193){while(--_0x235193){_0xae10d7['push'](_0xae10d7['shift']());}};_0x5abdbf(++_0x4346fb);}(_0x9c44,0x178));var _0x49c4=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x9c44[_0x543084];return _0x306a57;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 4fce45e..f5aa6ad 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 _0x2d95=['exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./memberReport.attributes'];(function(_0x54ef8a,_0x2c4f88){var _0x7d7b3a=function(_0x5b957b){while(--_0x5b957b){_0x54ef8a['push'](_0x54ef8a['shift']());}};_0x7d7b3a(++_0x2c4f88);}(_0x2d95,0xca));var _0x52d9=function(_0x520163,_0x34b794){_0x520163=_0x520163-0x0;var _0x57ab71=_0x2d95[_0x520163];return _0x57ab71;};'use strict';var _=require(_0x52d9('0x0'));var util=require('util');var logger=require(_0x52d9('0x1'))('api');var moment=require(_0x52d9('0x2'));var BPromise=require(_0x52d9('0x3'));var rp=require(_0x52d9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x52d9('0x5'));var config=require(_0x52d9('0x6'));var attributes=require(_0x52d9('0x7'));module[_0x52d9('0x8')]=function(_0x16eb99,_0x2735cc){return _0x16eb99[_0x52d9('0x9')](_0x52d9('0xa'),attributes,{'tableName':_0x52d9('0xb'),'paranoid':![],'indexes':[{'name':_0x52d9('0xc'),'fields':[_0x52d9('0xd'),_0x52d9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa204=['bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','report_member','membername_interface','membername','interface','lodash','../../config/logger','api','moment'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xa204,0xbc));var _0x4a20=function(_0x141cdc,_0xa038e9){_0x141cdc=_0x141cdc-0x0;var _0x2d7d88=_0xa204[_0x141cdc];return _0x2d7d88;};'use strict';var _=require(_0x4a20('0x0'));var util=require('util');var logger=require(_0x4a20('0x1'))(_0x4a20('0x2'));var moment=require(_0x4a20('0x3'));var BPromise=require(_0x4a20('0x4'));var rp=require(_0x4a20('0x5'));var fs=require('fs');var path=require(_0x4a20('0x6'));var rimraf=require(_0x4a20('0x7'));var config=require(_0x4a20('0x8'));var attributes=require(_0x4a20('0x9'));module['exports']=function(_0x5ce730,_0x3a0be7){return _0x5ce730[_0x4a20('0xa')](_0x4a20('0xb'),attributes,{'tableName':_0x4a20('0xc'),'paranoid':![],'indexes':[{'name':_0x4a20('0xd'),'fields':[_0x4a20('0xe'),_0x4a20('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 5d383d2..c78c1a0 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 _0x644f=['options','raw','where','attributes','limit','map','include','model','GetMemberReport','create','body','CreateMemberReport','UpdateMemberReport','update','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','MemberReport'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x644f,0xc2));var _0xf644=function(_0x329437,_0x1de73a){_0x329437=_0x329437-0x0;var _0x3789d9=_0x644f[_0x329437];return _0x3789d9;};'use strict';var _=require(_0xf644('0x0'));var util=require(_0xf644('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf644('0x2'));var fs=require('fs');var Redis=require(_0xf644('0x3'));var db=require(_0xf644('0x4'))['db'];var utils=require(_0xf644('0x5'));var logger=require(_0xf644('0x6'))(_0xf644('0x7'));var config=require(_0xf644('0x8'));var jayson=require(_0xf644('0x9'));var client=jayson[_0xf644('0xa')][_0xf644('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c7aaf,_0x454018,_0x50362e){return new BPromise(function(_0x2c2868,_0x11fa91){return client['request'](_0x2c7aaf,_0x50362e)[_0xf644('0xc')](function(_0x5746ae){logger['info'](_0xf644('0xd'),_0x454018,'request\x20sent');logger[_0xf644('0xe')](_0xf644('0xf'),_0x454018,'request\x20sent',JSON[_0xf644('0x10')](_0x5746ae));if(_0x5746ae[_0xf644('0x11')]){if(_0x5746ae[_0xf644('0x11')]['code']===0x1f4){logger[_0xf644('0x11')](_0xf644('0xd'),_0x454018,_0x5746ae['error'][_0xf644('0x12')]);return _0x11fa91(_0x5746ae[_0xf644('0x11')]['message']);}logger[_0xf644('0x11')](_0xf644('0xd'),_0x454018,_0x5746ae[_0xf644('0x11')][_0xf644('0x12')]);return _0x2c2868(_0x5746ae['error'][_0xf644('0x12')]);}else{logger[_0xf644('0x13')]('MemberReport,\x20%s,\x20%s',_0x454018,'request\x20sent');_0x2c2868(_0x5746ae['result']['message']);}})[_0xf644('0x14')](function(_0x331478){logger[_0xf644('0x11')](_0xf644('0xd'),_0x454018,_0x331478);_0x11fa91(_0x331478);});});}exports['GetMemberReport']=function(_0x5bd03c){var _0x15d065=this;return new Promise(function(_0x4650b5,_0x44fc39){return db[_0xf644('0x15')]['findAll']({'raw':_0x5bd03c['options']?_0x5bd03c[_0xf644('0x16')][_0xf644('0x17')]===undefined?!![]:![]:!![],'where':_0x5bd03c[_0xf644('0x16')]?_0x5bd03c[_0xf644('0x16')][_0xf644('0x18')]||null:null,'attributes':_0x5bd03c[_0xf644('0x16')]?_0x5bd03c[_0xf644('0x16')][_0xf644('0x19')]||null:null,'limit':_0x5bd03c['options']?_0x5bd03c[_0xf644('0x16')][_0xf644('0x1a')]||null:null,'include':_0x5bd03c[_0xf644('0x16')]?_0x5bd03c[_0xf644('0x16')]['include']?_[_0xf644('0x1b')](_0x5bd03c[_0xf644('0x16')][_0xf644('0x1c')],function(_0x17b2c6){return{'model':db[_0x17b2c6[_0xf644('0x1d')]],'as':_0x17b2c6['as'],'attributes':_0x17b2c6[_0xf644('0x19')],'include':_0x17b2c6[_0xf644('0x1c')]?_['map'](_0x17b2c6['include'],function(_0x22febe){return{'model':db[_0x22febe[_0xf644('0x1d')]],'as':_0x22febe['as'],'attributes':_0x22febe[_0xf644('0x19')],'include':_0x22febe[_0xf644('0x1c')]?_[_0xf644('0x1b')](_0x22febe[_0xf644('0x1c')],function(_0x2b2882){return{'model':db[_0x2b2882[_0xf644('0x1d')]],'as':_0x2b2882['as'],'attributes':_0x2b2882['attributes']};}):[]};}):[]};}):[]:[]})[_0xf644('0xc')](function(_0x3705a0){logger['info']('GetMemberReport',_0x5bd03c);logger[_0xf644('0xe')](_0xf644('0x1e'),_0x5bd03c,JSON[_0xf644('0x10')](_0x3705a0));_0x4650b5(_0x3705a0);})[_0xf644('0x14')](function(_0x2bcb20){logger[_0xf644('0x11')](_0xf644('0x1e'),_0x2bcb20['message'],_0x5bd03c);_0x44fc39(_0x15d065[_0xf644('0x11')](0x1f4,_0x2bcb20[_0xf644('0x12')]));});});};exports['CreateMemberReport']=function(_0x517a4e){var _0x279daa=this;return new Promise(function(_0x3efd75,_0x2cdca1){return db[_0xf644('0x15')][_0xf644('0x1f')](_0x517a4e[_0xf644('0x20')],{'raw':_0x517a4e[_0xf644('0x16')]?_0x517a4e[_0xf644('0x16')][_0xf644('0x17')]===undefined?!![]:![]:!![]})[_0xf644('0xc')](function(_0x5914d8){logger['info'](_0xf644('0x21'),_0x517a4e);logger[_0xf644('0xe')](_0xf644('0x21'),_0x517a4e,JSON[_0xf644('0x10')](_0x5914d8));_0x3efd75(_0x5914d8);})[_0xf644('0x14')](function(_0x37a72f){logger[_0xf644('0x11')]('CreateMemberReport',_0x37a72f[_0xf644('0x12')],_0x517a4e);_0x2cdca1(_0x279daa['error'](0x1f4,_0x37a72f['message']));});});};exports[_0xf644('0x22')]=function(_0x316d24){var _0xcef4ad=this;return new Promise(function(_0x54a537,_0x4f28d4){return db[_0xf644('0x15')][_0xf644('0x23')](_0x316d24[_0xf644('0x20')],{'raw':_0x316d24['options']?_0x316d24[_0xf644('0x16')][_0xf644('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x316d24['options']?_0x316d24[_0xf644('0x16')][_0xf644('0x18')]||null:null,'attributes':_0x316d24[_0xf644('0x16')]?_0x316d24[_0xf644('0x16')][_0xf644('0x19')]||null:null,'limit':_0x316d24[_0xf644('0x16')]?_0x316d24['options'][_0xf644('0x1a')]||null:null})['then'](function(_0x3f0248){logger[_0xf644('0x13')](_0xf644('0x22'),_0x316d24);logger[_0xf644('0xe')](_0xf644('0x22'),_0x316d24,JSON[_0xf644('0x10')](_0x3f0248));_0x54a537(_0x3f0248);})['catch'](function(_0x38b556){logger[_0xf644('0x11')](_0xf644('0x22'),_0x38b556['message'],_0x316d24);_0x4f28d4(_0xcef4ad['error'](0x1f4,_0x38b556[_0xf644('0x12')]));});});}; \ No newline at end of file +var _0x4873=['moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','MemberReport,\x20%s,\x20%s','result','catch','GetMemberReport','MemberReport','options','raw','where','limit','include','map','attributes','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','util'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x4873,0x1df));var _0x3487=function(_0x5f20a3,_0x325f19){_0x5f20a3=_0x5f20a3-0x0;var _0x37468a=_0x4873[_0x5f20a3];return _0x37468a;};'use strict';var _=require(_0x3487('0x0'));var util=require(_0x3487('0x1'));var moment=require(_0x3487('0x2'));var BPromise=require('bluebird');var rs=require(_0x3487('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3487('0x4'));var logger=require(_0x3487('0x5'))(_0x3487('0x6'));var config=require(_0x3487('0x7'));var jayson=require(_0x3487('0x8'));var client=jayson[_0x3487('0x9')][_0x3487('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x193589,_0x4a2407,_0x1d4cae){return new BPromise(function(_0x3df081,_0x1d0487){return client[_0x3487('0xb')](_0x193589,_0x1d4cae)[_0x3487('0xc')](function(_0x5a50e8){logger[_0x3487('0xd')]('MemberReport,\x20%s,\x20%s',_0x4a2407,_0x3487('0xe'));logger[_0x3487('0xf')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x4a2407,'request\x20sent',JSON[_0x3487('0x10')](_0x5a50e8));if(_0x5a50e8[_0x3487('0x11')]){if(_0x5a50e8['error'][_0x3487('0x12')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x4a2407,_0x5a50e8[_0x3487('0x11')][_0x3487('0x13')]);return _0x1d0487(_0x5a50e8[_0x3487('0x11')][_0x3487('0x13')]);}logger[_0x3487('0x11')](_0x3487('0x14'),_0x4a2407,_0x5a50e8['error'][_0x3487('0x13')]);return _0x3df081(_0x5a50e8[_0x3487('0x11')][_0x3487('0x13')]);}else{logger['info'](_0x3487('0x14'),_0x4a2407,_0x3487('0xe'));_0x3df081(_0x5a50e8[_0x3487('0x15')][_0x3487('0x13')]);}})[_0x3487('0x16')](function(_0x21809c){logger[_0x3487('0x11')](_0x3487('0x14'),_0x4a2407,_0x21809c);_0x1d0487(_0x21809c);});});}exports[_0x3487('0x17')]=function(_0x2fa630){var _0x3576ca=this;return new Promise(function(_0x41795b,_0xd56d94){return db[_0x3487('0x18')]['findAll']({'raw':_0x2fa630[_0x3487('0x19')]?_0x2fa630['options'][_0x3487('0x1a')]===undefined?!![]:![]:!![],'where':_0x2fa630[_0x3487('0x19')]?_0x2fa630[_0x3487('0x19')][_0x3487('0x1b')]||null:null,'attributes':_0x2fa630[_0x3487('0x19')]?_0x2fa630[_0x3487('0x19')]['attributes']||null:null,'limit':_0x2fa630[_0x3487('0x19')]?_0x2fa630[_0x3487('0x19')][_0x3487('0x1c')]||null:null,'include':_0x2fa630[_0x3487('0x19')]?_0x2fa630[_0x3487('0x19')][_0x3487('0x1d')]?_['map'](_0x2fa630[_0x3487('0x19')][_0x3487('0x1d')],function(_0x25ed9f){return{'model':db[_0x25ed9f['model']],'as':_0x25ed9f['as'],'attributes':_0x25ed9f['attributes'],'include':_0x25ed9f[_0x3487('0x1d')]?_[_0x3487('0x1e')](_0x25ed9f[_0x3487('0x1d')],function(_0x3a9d76){return{'model':db[_0x3a9d76['model']],'as':_0x3a9d76['as'],'attributes':_0x3a9d76[_0x3487('0x1f')],'include':_0x3a9d76[_0x3487('0x1d')]?_['map'](_0x3a9d76[_0x3487('0x1d')],function(_0x3fb245){return{'model':db[_0x3fb245['model']],'as':_0x3fb245['as'],'attributes':_0x3fb245['attributes']};}):[]};}):[]};}):[]:[]})[_0x3487('0xc')](function(_0x12bf8b){logger[_0x3487('0xd')](_0x3487('0x17'),_0x2fa630);logger[_0x3487('0xf')](_0x3487('0x17'),_0x2fa630,JSON[_0x3487('0x10')](_0x12bf8b));_0x41795b(_0x12bf8b);})[_0x3487('0x16')](function(_0x25e123){logger[_0x3487('0x11')](_0x3487('0x17'),_0x25e123['message'],_0x2fa630);_0xd56d94(_0x3576ca['error'](0x1f4,_0x25e123[_0x3487('0x13')]));});});};exports[_0x3487('0x20')]=function(_0x5bfc07){var _0x42e134=this;return new Promise(function(_0x895c97,_0x5dec47){return db['MemberReport'][_0x3487('0x21')](_0x5bfc07[_0x3487('0x22')],{'raw':_0x5bfc07[_0x3487('0x19')]?_0x5bfc07['options'][_0x3487('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4791e8){logger['info'](_0x3487('0x20'),_0x5bfc07);logger[_0x3487('0xf')]('CreateMemberReport',_0x5bfc07,JSON['stringify'](_0x4791e8));_0x895c97(_0x4791e8);})[_0x3487('0x16')](function(_0x4ab2a2){logger['error'](_0x3487('0x20'),_0x4ab2a2[_0x3487('0x13')],_0x5bfc07);_0x5dec47(_0x42e134[_0x3487('0x11')](0x1f4,_0x4ab2a2['message']));});});};exports[_0x3487('0x23')]=function(_0xc0e4dd){var _0x2497ae=this;return new Promise(function(_0x27c28f,_0x4e5e53){return db[_0x3487('0x18')][_0x3487('0x24')](_0xc0e4dd['body'],{'raw':_0xc0e4dd[_0x3487('0x19')]?_0xc0e4dd[_0x3487('0x19')][_0x3487('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc0e4dd[_0x3487('0x19')]?_0xc0e4dd[_0x3487('0x19')][_0x3487('0x1b')]||null:null,'attributes':_0xc0e4dd[_0x3487('0x19')]?_0xc0e4dd[_0x3487('0x19')][_0x3487('0x1f')]||null:null,'limit':_0xc0e4dd['options']?_0xc0e4dd[_0x3487('0x19')][_0x3487('0x1c')]||null:null})['then'](function(_0x5618d7){logger[_0x3487('0xd')](_0x3487('0x23'),_0xc0e4dd);logger[_0x3487('0xf')]('UpdateMemberReport',_0xc0e4dd,JSON['stringify'](_0x5618d7));_0x27c28f(_0x5618d7);})['catch'](function(_0x35e4ea){logger[_0x3487('0x11')]('UpdateMemberReport',_0x35e4ea[_0x3487('0x13')],_0xc0e4dd);_0x4e5e53(_0x2497ae[_0x3487('0x11')](0x1f4,_0x35e4ea[_0x3487('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 6abd675..61dba7f 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 _0xc29c=['Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','index','util','connect-timeout'];(function(_0x260e4b,_0x54668d){var _0x18dfba=function(_0x37b530){while(--_0x37b530){_0x260e4b['push'](_0x260e4b['shift']());}};_0x18dfba(++_0x54668d);}(_0xc29c,0x1ae));var _0xcc29=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xc29c[_0x110c3d];return _0x226d67;};'use strict';var multer=require('multer');var util=require(_0xcc29('0x0'));var path=require('path');var timeout=require(_0xcc29('0x1'));var express=require('express');var router=express[_0xcc29('0x2')]();var fs_extra=require(_0xcc29('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xcc29('0x4'));var config=require(_0xcc29('0x5'));var controller=require(_0xcc29('0x6'));router['get']('/',controller[_0xcc29('0x7')]);module['exports']=router; \ No newline at end of file +var _0x99ab=['../../components/interaction/service','../../config/environment','index','exports','util','path','connect-timeout','fs-extra'];(function(_0x2ffe1d,_0x35ace8){var _0x37a38f=function(_0x524b5b){while(--_0x524b5b){_0x2ffe1d['push'](_0x2ffe1d['shift']());}};_0x37a38f(++_0x35ace8);}(_0x99ab,0xe4));var _0xb99a=function(_0x2de2c7,_0x56689a){_0x2de2c7=_0x2de2c7-0x0;var _0x3a7d01=_0x99ab[_0x2de2c7];return _0x3a7d01;};'use strict';var multer=require('multer');var util=require(_0xb99a('0x0'));var path=require(_0xb99a('0x1'));var timeout=require(_0xb99a('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb99a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xb99a('0x4'));var config=require(_0xb99a('0x5'));var controller=require('./migration.controller');router['get']('/',controller[_0xb99a('0x6')]);module[_0xb99a('0x7')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 0b4a837..68e6b70 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 _0x9666=['sequelize','exports','version'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x9666,0x171));var _0x6966=function(_0x43a02c,_0x20b70f){_0x43a02c=_0x43a02c-0x0;var _0x171f65=_0x9666[_0x43a02c];return _0x171f65;};'use strict';var Sequelize=require(_0x6966('0x0'));module[_0x6966('0x1')]={'version':{'type':Sequelize['STRING'],'unique':_0x6966('0x2')}}; \ No newline at end of file +var _0x6aa7=['sequelize','STRING','version'];(function(_0x1d2ef3,_0xb8ad6d){var _0x55b04a=function(_0x4f8fdd){while(--_0x4f8fdd){_0x1d2ef3['push'](_0x1d2ef3['shift']());}};_0x55b04a(++_0xb8ad6d);}(_0x6aa7,0x1bf));var _0x76aa=function(_0x110e7f,_0x5acfb3){_0x110e7f=_0x110e7f-0x0;var _0x46643a=_0x6aa7[_0x110e7f];return _0x46643a;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'version':{'type':Sequelize[_0x76aa('0x1')],'unique':_0x76aa('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 58f4b62..072dbff 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 _0xd911=['rawAttributes','fieldName','type','key','model','query','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','options','Migration','then','findAll','rows','catch','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','destroy','error','stack','name','index','map'];(function(_0x5829d3,_0x2172a6){var _0x25c715=function(_0x5616d1){while(--_0x5616d1){_0x5829d3['push'](_0x5829d3['shift']());}};_0x25c715(++_0x2172a6);}(_0xd911,0x1df));var _0x1d91=function(_0x10772c,_0x1df6ad){_0x10772c=_0x10772c-0x0;var _0x806119=_0xd911[_0x10772c];return _0x806119;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1d91('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1d91('0x1'));var moment=require(_0x1d91('0x2'));var BPromise=require(_0x1d91('0x3'));var Mustache=require(_0x1d91('0x4'));var util=require(_0x1d91('0x5'));var path=require(_0x1d91('0x6'));var sox=require(_0x1d91('0x7'));var csv=require(_0x1d91('0x8'));var ejs=require(_0x1d91('0x9'));var fs=require('fs');var fs_extra=require(_0x1d91('0xa'));var _=require('lodash');var squel=require(_0x1d91('0xb'));var crypto=require(_0x1d91('0xc'));var jsforce=require(_0x1d91('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1d91('0x8'));var querystring=require(_0x1d91('0xe'));var Papa=require(_0x1d91('0xf'));var Redis=require('ioredis');var authService=require(_0x1d91('0x10'));var qs=require(_0x1d91('0x11'));var as=require(_0x1d91('0x12'));var hardwareService=require(_0x1d91('0x13'));var logger=require(_0x1d91('0x14'))(_0x1d91('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1d91('0x16'));var db=require(_0x1d91('0x17'))['db'];function respondWithStatusCode(_0x5dc335,_0x4bb6f2){_0x4bb6f2=_0x4bb6f2||0xcc;return function(_0x33bc9b){if(_0x33bc9b){return _0x5dc335[_0x1d91('0x18')](_0x4bb6f2);}return _0x5dc335[_0x1d91('0x19')](_0x4bb6f2)[_0x1d91('0x1a')]();};}function respondWithResult(_0x98807c,_0x13a65e){_0x13a65e=_0x13a65e||0xc8;return function(_0x3c211c){if(_0x3c211c){return _0x98807c['status'](_0x13a65e)['json'](_0x3c211c);}};}function respondWithFilteredResult(_0x280aef,_0x4dfdec){return function(_0x1cc3b4){if(_0x1cc3b4){var _0x3ed277=typeof _0x4dfdec[_0x1d91('0x1b')]===_0x1d91('0x1c')&&typeof _0x4dfdec[_0x1d91('0x1d')]===_0x1d91('0x1c');var _0x6b1f69=_0x1cc3b4[_0x1d91('0x1e')];var _0x3c53fb=_0x3ed277?0x0:_0x4dfdec[_0x1d91('0x1b')];var _0x274d81=_0x3ed277?_0x1cc3b4[_0x1d91('0x1e')]:_0x4dfdec['offset']+_0x4dfdec[_0x1d91('0x1d')];var _0x4d935d;if(_0x274d81>=_0x6b1f69){_0x274d81=_0x6b1f69;_0x4d935d=0xc8;}else{_0x4d935d=0xce;}_0x280aef[_0x1d91('0x19')](_0x4d935d);return _0x280aef[_0x1d91('0x1f')]('Content-Range',_0x3c53fb+'-'+_0x274d81+'/'+_0x6b1f69)['json'](_0x1cc3b4);}return null;};}function patchUpdates(_0x436b01){return function(_0x55c641){try{jsonpatch[_0x1d91('0x20')](_0x55c641,_0x436b01,!![]);}catch(_0x362fb6){return BPromise[_0x1d91('0x21')](_0x362fb6);}return _0x55c641['save']();};}function saveUpdates(_0x3632d1,_0xd37820){return function(_0x117734){if(_0x117734){return _0x117734[_0x1d91('0x22')](_0x3632d1)['then'](function(_0x496500){return _0x496500;});}return null;};}function removeEntity(_0x505542,_0x17d60e){return function(_0x430a4e){if(_0x430a4e){return _0x430a4e[_0x1d91('0x23')]()['then'](function(){_0x505542['status'](0xcc)[_0x1d91('0x1a')]();});}};}function handleEntityNotFound(_0x25c026,_0x404fa1){return function(_0x5034c5){if(!_0x5034c5){_0x25c026[_0x1d91('0x18')](0x194);}return _0x5034c5;};}function handleError(_0x7029a1,_0x5f4910){_0x5f4910=_0x5f4910||0x1f4;return function(_0x29c6b6){logger[_0x1d91('0x24')](_0x29c6b6[_0x1d91('0x25')]);if(_0x29c6b6['name']){delete _0x29c6b6[_0x1d91('0x26')];}_0x7029a1[_0x1d91('0x19')](_0x5f4910)['send'](_0x29c6b6);};}exports[_0x1d91('0x27')]=function(_0x3a649b,_0x1f1d58){var _0x1a2f48={},_0x5ba168={},_0x2c4ad2={'count':0x0,'rows':[]};var _0x5d0f75=_[_0x1d91('0x28')](db['Migration'][_0x1d91('0x29')],function(_0x18400e){return{'name':_0x18400e[_0x1d91('0x2a')],'type':_0x18400e[_0x1d91('0x2b')][_0x1d91('0x2c')]};});_0x5ba168[_0x1d91('0x2d')]=_[_0x1d91('0x28')](_0x5d0f75,_0x1d91('0x26'));_0x5ba168[_0x1d91('0x2e')]=_['keys'](_0x3a649b['query']);_0x5ba168['filters']=_[_0x1d91('0x2f')](_0x5ba168[_0x1d91('0x2d')],_0x5ba168['query']);_0x1a2f48['attributes']=_[_0x1d91('0x2f')](_0x5ba168[_0x1d91('0x2d')],qs[_0x1d91('0x30')](_0x3a649b[_0x1d91('0x2e')][_0x1d91('0x30')]));_0x1a2f48['attributes']=_0x1a2f48['attributes'][_0x1d91('0x31')]?_0x1a2f48[_0x1d91('0x32')]:_0x5ba168[_0x1d91('0x2d')];if(!_0x3a649b[_0x1d91('0x2e')][_0x1d91('0x33')]('nolimit')){_0x1a2f48[_0x1d91('0x1d')]=qs[_0x1d91('0x1d')](_0x3a649b['query'][_0x1d91('0x1d')]);_0x1a2f48[_0x1d91('0x1b')]=qs[_0x1d91('0x1b')](_0x3a649b['query'][_0x1d91('0x1b')]);}_0x1a2f48[_0x1d91('0x34')]=qs[_0x1d91('0x35')](_0x3a649b['query']['sort']);_0x1a2f48[_0x1d91('0x36')]=qs[_0x1d91('0x37')](_['pick'](_0x3a649b[_0x1d91('0x2e')],_0x5ba168[_0x1d91('0x37')]),_0x5d0f75);if(_0x3a649b[_0x1d91('0x2e')][_0x1d91('0x38')]){_0x1a2f48[_0x1d91('0x36')]=_['merge'](_0x1a2f48[_0x1d91('0x36')],{'$or':_[_0x1d91('0x28')](_0x5d0f75,function(_0x3f65dc){if(_0x3f65dc[_0x1d91('0x2b')]!==_0x1d91('0x39')){var _0xb75777={};_0xb75777[_0x3f65dc['name']]={'$like':'%'+_0x3a649b[_0x1d91('0x2e')][_0x1d91('0x38')]+'%'};return _0xb75777;}})});}_0x1a2f48=_[_0x1d91('0x3a')]({},_0x1a2f48,_0x3a649b[_0x1d91('0x3b')]);var _0x2e28ce={'where':_0x1a2f48['where']};return db[_0x1d91('0x3c')][_0x1d91('0x1e')](_0x2e28ce)[_0x1d91('0x3d')](function(_0x28453e){_0x2c4ad2[_0x1d91('0x1e')]=_0x28453e;if(_0x3a649b[_0x1d91('0x2e')]['includeAll']){_0x1a2f48['include']=[{'all':!![]}];}return db[_0x1d91('0x3c')][_0x1d91('0x3e')](_0x1a2f48);})['then'](function(_0x1bfbe7){_0x2c4ad2[_0x1d91('0x3f')]=_0x1bfbe7;return _0x2c4ad2;})[_0x1d91('0x3d')](respondWithFilteredResult(_0x1f1d58,_0x1a2f48))[_0x1d91('0x40')](handleError(_0x1f1d58,null));}; \ No newline at end of file +var _0xfff2=['pick','filter','merge','Migration','includeAll','include','findAll','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','apply','reject','save','then','send','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where'];(function(_0x2442b9,_0x3d87e9){var _0x31b571=function(_0x1e10ee){while(--_0x1e10ee){_0x2442b9['push'](_0x2442b9['shift']());}};_0x31b571(++_0x3d87e9);}(_0xfff2,0x1d0));var _0x2fff=function(_0x4b384f,_0x197348){_0x4b384f=_0x4b384f-0x0;var _0x36ec9f=_0xfff2[_0x4b384f];return _0x36ec9f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2fff('0x0'));var zipdir=require(_0x2fff('0x1'));var jsonpatch=require(_0x2fff('0x2'));var rp=require(_0x2fff('0x3'));var moment=require(_0x2fff('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2fff('0x5'));var path=require('path');var sox=require(_0x2fff('0x6'));var csv=require('to-csv');var ejs=require(_0x2fff('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2fff('0x8'));var crypto=require(_0x2fff('0x9'));var jsforce=require(_0x2fff('0xa'));var deskjs=require(_0x2fff('0xb'));var toCsv=require(_0x2fff('0xc'));var querystring=require(_0x2fff('0xd'));var Papa=require(_0x2fff('0xe'));var Redis=require(_0x2fff('0xf'));var authService=require(_0x2fff('0x10'));var qs=require(_0x2fff('0x11'));var as=require(_0x2fff('0x12'));var hardwareService=require(_0x2fff('0x13'));var logger=require(_0x2fff('0x14'))('api');var utils=require(_0x2fff('0x15'));var config=require(_0x2fff('0x16'));var licenseUtil=require(_0x2fff('0x17'));var db=require(_0x2fff('0x18'))['db'];function respondWithStatusCode(_0x5a054f,_0x7e2b28){_0x7e2b28=_0x7e2b28||0xcc;return function(_0x16adcd){if(_0x16adcd){return _0x5a054f[_0x2fff('0x19')](_0x7e2b28);}return _0x5a054f['status'](_0x7e2b28)[_0x2fff('0x1a')]();};}function respondWithResult(_0x21c0f8,_0x20a25f){_0x20a25f=_0x20a25f||0xc8;return function(_0x5c3ccf){if(_0x5c3ccf){return _0x21c0f8['status'](_0x20a25f)['json'](_0x5c3ccf);}};}function respondWithFilteredResult(_0x3b9b4b,_0x11b406){return function(_0x222166){if(_0x222166){var _0x128b08=typeof _0x11b406[_0x2fff('0x1b')]===_0x2fff('0x1c')&&typeof _0x11b406[_0x2fff('0x1d')]===_0x2fff('0x1c');var _0x3d4eec=_0x222166['count'];var _0x1582f1=_0x128b08?0x0:_0x11b406[_0x2fff('0x1b')];var _0x11113c=_0x128b08?_0x222166[_0x2fff('0x1e')]:_0x11b406[_0x2fff('0x1b')]+_0x11b406[_0x2fff('0x1d')];var _0x5b3569;if(_0x11113c>=_0x3d4eec){_0x11113c=_0x3d4eec;_0x5b3569=0xc8;}else{_0x5b3569=0xce;}_0x3b9b4b[_0x2fff('0x1f')](_0x5b3569);return _0x3b9b4b[_0x2fff('0x20')]('Content-Range',_0x1582f1+'-'+_0x11113c+'/'+_0x3d4eec)['json'](_0x222166);}return null;};}function patchUpdates(_0x3125ac){return function(_0xa834bd){try{jsonpatch[_0x2fff('0x21')](_0xa834bd,_0x3125ac,!![]);}catch(_0x2908c6){return BPromise[_0x2fff('0x22')](_0x2908c6);}return _0xa834bd[_0x2fff('0x23')]();};}function saveUpdates(_0x2c46f9,_0x2118f8){return function(_0x445abc){if(_0x445abc){return _0x445abc['update'](_0x2c46f9)['then'](function(_0x188594){return _0x188594;});}return null;};}function removeEntity(_0x1302e8,_0x44d591){return function(_0x56e1ed){if(_0x56e1ed){return _0x56e1ed['destroy']()[_0x2fff('0x24')](function(){_0x1302e8[_0x2fff('0x1f')](0xcc)[_0x2fff('0x1a')]();});}};}function handleEntityNotFound(_0x2bafeb,_0x14f72a){return function(_0x186766){if(!_0x186766){_0x2bafeb[_0x2fff('0x19')](0x194);}return _0x186766;};}function handleError(_0x46065e,_0x1b1cc5){_0x1b1cc5=_0x1b1cc5||0x1f4;return function(_0x56269a){logger['error'](_0x56269a['stack']);if(_0x56269a['name']){delete _0x56269a['name'];}_0x46065e[_0x2fff('0x1f')](_0x1b1cc5)[_0x2fff('0x25')](_0x56269a);};}exports[_0x2fff('0x26')]=function(_0x47286f,_0x23a4ca){var _0x10264b={},_0x32b9dc={},_0x5bf4ab={'count':0x0,'rows':[]};var _0x312b8d=_[_0x2fff('0x27')](db['Migration'][_0x2fff('0x28')],function(_0x127ddf){return{'name':_0x127ddf[_0x2fff('0x29')],'type':_0x127ddf[_0x2fff('0x2a')][_0x2fff('0x2b')]};});_0x32b9dc[_0x2fff('0x2c')]=_[_0x2fff('0x27')](_0x312b8d,_0x2fff('0x2d'));_0x32b9dc[_0x2fff('0x2e')]=_[_0x2fff('0x2f')](_0x47286f['query']);_0x32b9dc[_0x2fff('0x30')]=_[_0x2fff('0x31')](_0x32b9dc[_0x2fff('0x2c')],_0x32b9dc[_0x2fff('0x2e')]);_0x10264b[_0x2fff('0x32')]=_[_0x2fff('0x31')](_0x32b9dc[_0x2fff('0x2c')],qs[_0x2fff('0x33')](_0x47286f[_0x2fff('0x2e')][_0x2fff('0x33')]));_0x10264b[_0x2fff('0x32')]=_0x10264b[_0x2fff('0x32')][_0x2fff('0x34')]?_0x10264b[_0x2fff('0x32')]:_0x32b9dc[_0x2fff('0x2c')];if(!_0x47286f[_0x2fff('0x2e')]['hasOwnProperty'](_0x2fff('0x35'))){_0x10264b[_0x2fff('0x1d')]=qs[_0x2fff('0x1d')](_0x47286f['query'][_0x2fff('0x1d')]);_0x10264b['offset']=qs[_0x2fff('0x1b')](_0x47286f['query'][_0x2fff('0x1b')]);}_0x10264b[_0x2fff('0x36')]=qs['sort'](_0x47286f[_0x2fff('0x2e')]['sort']);_0x10264b[_0x2fff('0x37')]=qs[_0x2fff('0x30')](_[_0x2fff('0x38')](_0x47286f['query'],_0x32b9dc[_0x2fff('0x30')]),_0x312b8d);if(_0x47286f[_0x2fff('0x2e')][_0x2fff('0x39')]){_0x10264b[_0x2fff('0x37')]=_[_0x2fff('0x3a')](_0x10264b[_0x2fff('0x37')],{'$or':_[_0x2fff('0x27')](_0x312b8d,function(_0x537ee7){if(_0x537ee7[_0x2fff('0x2a')]!=='VIRTUAL'){var _0x4f0809={};_0x4f0809[_0x537ee7[_0x2fff('0x2d')]]={'$like':'%'+_0x47286f['query'][_0x2fff('0x39')]+'%'};return _0x4f0809;}})});}_0x10264b=_[_0x2fff('0x3a')]({},_0x10264b,_0x47286f['options']);var _0x505e15={'where':_0x10264b[_0x2fff('0x37')]};return db[_0x2fff('0x3b')][_0x2fff('0x1e')](_0x505e15)['then'](function(_0x32a9ea){_0x5bf4ab['count']=_0x32a9ea;if(_0x47286f['query'][_0x2fff('0x3c')]){_0x10264b[_0x2fff('0x3d')]=[{'all':!![]}];}return db[_0x2fff('0x3b')][_0x2fff('0x3e')](_0x10264b);})[_0x2fff('0x24')](function(_0x194b08){_0x5bf4ab[_0x2fff('0x3f')]=_0x194b08;return _0x5bf4ab;})[_0x2fff('0x24')](respondWithFilteredResult(_0x23a4ca,_0x10264b))[_0x2fff('0x40')](handleError(_0x23a4ca,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index cc95217..c4c6147 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 _0x1f46=['migrations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration'];(function(_0x50707e,_0x14fc7c){var _0x12b962=function(_0x2c77ff){while(--_0x2c77ff){_0x50707e['push'](_0x50707e['shift']());}};_0x12b962(++_0x14fc7c);}(_0x1f46,0x127));var _0x61f4=function(_0x35d733,_0x434691){_0x35d733=_0x35d733-0x0;var _0x13ebb6=_0x1f46[_0x35d733];return _0x13ebb6;};'use strict';var _=require(_0x61f4('0x0'));var util=require(_0x61f4('0x1'));var logger=require(_0x61f4('0x2'))(_0x61f4('0x3'));var moment=require('moment');var BPromise=require(_0x61f4('0x4'));var rp=require(_0x61f4('0x5'));var fs=require('fs');var path=require(_0x61f4('0x6'));var rimraf=require(_0x61f4('0x7'));var config=require(_0x61f4('0x8'));var attributes=require(_0x61f4('0x9'));module[_0x61f4('0xa')]=function(_0x192ed9,_0x4adc18){return _0x192ed9[_0x61f4('0xb')](_0x61f4('0xc'),attributes,{'tableName':_0x61f4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb43=['lodash','../../config/logger','bluebird','request-promise','../../config/environment','./migration.attributes','Migration','migrations'];(function(_0xbbc32c,_0x28dcb0){var _0x46e48a=function(_0x2591b7){while(--_0x2591b7){_0xbbc32c['push'](_0xbbc32c['shift']());}};_0x46e48a(++_0x28dcb0);}(_0xeb43,0xf0));var _0x3eb4=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xeb43[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0x3eb4('0x0'));var util=require('util');var logger=require(_0x3eb4('0x1'))('api');var moment=require('moment');var BPromise=require(_0x3eb4('0x2'));var rp=require(_0x3eb4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3eb4('0x4'));var attributes=require(_0x3eb4('0x5'));module['exports']=function(_0x2d079d,_0x45268e){return _0x2d079d['define'](_0x3eb4('0x6'),attributes,{'tableName':_0x3eb4('0x7'),'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 d5dc824..78941fb 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 _0x85de=['randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','info','Migration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x58f84a,_0x56be79){var _0x247e6b=function(_0x5b110c){while(--_0x5b110c){_0x58f84a['push'](_0x58f84a['shift']());}};_0x247e6b(++_0x56be79);}(_0x85de,0x1f0));var _0xe85d=function(_0xd1e0d4,_0x314f95){_0xd1e0d4=_0xd1e0d4-0x0;var _0xb8b67e=_0x85de[_0xd1e0d4];return _0xb8b67e;};'use strict';var _=require(_0xe85d('0x0'));var util=require(_0xe85d('0x1'));var moment=require(_0xe85d('0x2'));var BPromise=require(_0xe85d('0x3'));var rs=require(_0xe85d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe85d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe85d('0x6'));var config=require(_0xe85d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe85d('0x8')][_0xe85d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x220e10,_0xd468f9,_0x4608f4){return new BPromise(function(_0x888738,_0xc86467){return client[_0xe85d('0xa')](_0x220e10,_0x4608f4)['then'](function(_0x4128d5){logger[_0xe85d('0xb')](_0xe85d('0xc'),_0xd468f9,_0xe85d('0xd'));logger[_0xe85d('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0xd468f9,_0xe85d('0xd'),JSON['stringify'](_0x4128d5));if(_0x4128d5[_0xe85d('0xf')]){if(_0x4128d5['error'][_0xe85d('0x10')]===0x1f4){logger['error'](_0xe85d('0xc'),_0xd468f9,_0x4128d5[_0xe85d('0xf')][_0xe85d('0x11')]);return _0xc86467(_0x4128d5[_0xe85d('0xf')][_0xe85d('0x11')]);}logger[_0xe85d('0xf')](_0xe85d('0xc'),_0xd468f9,_0x4128d5['error'][_0xe85d('0x11')]);return _0x888738(_0x4128d5[_0xe85d('0xf')]['message']);}else{logger[_0xe85d('0xb')](_0xe85d('0xc'),_0xd468f9,_0xe85d('0xd'));_0x888738(_0x4128d5[_0xe85d('0x12')][_0xe85d('0x11')]);}})[_0xe85d('0x13')](function(_0x136fe6){logger[_0xe85d('0xf')](_0xe85d('0xc'),_0xd468f9,_0x136fe6);_0xc86467(_0x136fe6);});});} \ No newline at end of file +var _0xc2e8=['client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x471268,_0x5ce885){var _0x1298f3=function(_0x3f5110){while(--_0x3f5110){_0x471268['push'](_0x471268['shift']());}};_0x1298f3(++_0x5ce885);}(_0xc2e8,0x70));var _0x8c2e=function(_0x201f73,_0x17489c){_0x201f73=_0x201f73-0x0;var _0x24516d=_0xc2e8[_0x201f73];return _0x24516d;};'use strict';var _=require(_0x8c2e('0x0'));var util=require(_0x8c2e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8c2e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c2e('0x3'))['db'];var utils=require(_0x8c2e('0x4'));var logger=require(_0x8c2e('0x5'))('rpc');var config=require(_0x8c2e('0x6'));var jayson=require(_0x8c2e('0x7'));var client=jayson[_0x8c2e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bf5d0,_0x4b8f44,_0x487731){return new BPromise(function(_0x4abd39,_0xcc200c){return client[_0x8c2e('0x9')](_0x4bf5d0,_0x487731)[_0x8c2e('0xa')](function(_0x331e6d){logger[_0x8c2e('0xb')](_0x8c2e('0xc'),_0x4b8f44,_0x8c2e('0xd'));logger[_0x8c2e('0xe')]('Migration,\x20%s,\x20%s,\x20%s',_0x4b8f44,_0x8c2e('0xd'),JSON[_0x8c2e('0xf')](_0x331e6d));if(_0x331e6d[_0x8c2e('0x10')]){if(_0x331e6d['error']['code']===0x1f4){logger['error'](_0x8c2e('0xc'),_0x4b8f44,_0x331e6d[_0x8c2e('0x10')][_0x8c2e('0x11')]);return _0xcc200c(_0x331e6d[_0x8c2e('0x10')][_0x8c2e('0x11')]);}logger[_0x8c2e('0x10')](_0x8c2e('0xc'),_0x4b8f44,_0x331e6d['error']['message']);return _0x4abd39(_0x331e6d[_0x8c2e('0x10')][_0x8c2e('0x11')]);}else{logger[_0x8c2e('0xb')](_0x8c2e('0xc'),_0x4b8f44,_0x8c2e('0xd'));_0x4abd39(_0x331e6d[_0x8c2e('0x12')]['message']);}})[_0x8c2e('0x13')](function(_0x10d610){logger[_0x8c2e('0x10')](_0x8c2e('0xc'),_0x4b8f44,_0x10d610);_0xcc200c(_0x10d610);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 633766e..81e9d8b 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 _0xdca4=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','express'];(function(_0x327e47,_0x1f69a3){var _0xd2b5cd=function(_0x53feec){while(--_0x53feec){_0x327e47['push'](_0x327e47['shift']());}};_0xd2b5cd(++_0x1f69a3);}(_0xdca4,0x138));var _0x4dca=function(_0x518ac9,_0x4bbc8b){_0x518ac9=_0x518ac9-0x0;var _0x19ba5c=_0xdca4[_0x518ac9];return _0x19ba5c;};'use strict';var multer=require(_0x4dca('0x0'));var util=require('util');var path=require(_0x4dca('0x1'));var timeout=require('connect-timeout');var express=require(_0x4dca('0x2'));var router=express[_0x4dca('0x3')]();var fs_extra=require(_0x4dca('0x4'));var auth=require(_0x4dca('0x5'));var interaction=require(_0x4dca('0x6'));var config=require(_0x4dca('0x7'));var controller=require(_0x4dca('0x8'));router['get']('/',auth[_0x4dca('0x9')](),controller[_0x4dca('0xa')]);router[_0x4dca('0xb')](_0x4dca('0xc'),auth['isAuthenticated'](),controller[_0x4dca('0xd')]);router[_0x4dca('0xe')]('/',auth[_0x4dca('0x9')](),controller[_0x4dca('0xf')]);router[_0x4dca('0x10')](_0x4dca('0xc'),auth['isAuthenticated'](),controller[_0x4dca('0x11')]);router[_0x4dca('0x12')](_0x4dca('0xc'),auth['isAuthenticated'](),controller[_0x4dca('0x13')]);module[_0x4dca('0x14')]=router; \ No newline at end of file +var _0xbb3e=['create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbb3e,0x181));var _0xebb3=function(_0x655954,_0x2961cf){_0x655954=_0x655954-0x0;var _0xf5dc47=_0xbb3e[_0x655954];return _0xf5dc47;};'use strict';var multer=require(_0xebb3('0x0'));var util=require(_0xebb3('0x1'));var path=require(_0xebb3('0x2'));var timeout=require(_0xebb3('0x3'));var express=require('express');var router=express[_0xebb3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xebb3('0x5'));var interaction=require(_0xebb3('0x6'));var config=require(_0xebb3('0x7'));var controller=require(_0xebb3('0x8'));router[_0xebb3('0x9')]('/',auth[_0xebb3('0xa')](),controller[_0xebb3('0xb')]);router[_0xebb3('0x9')](_0xebb3('0xc'),auth[_0xebb3('0xa')](),controller[_0xebb3('0xd')]);router[_0xebb3('0xe')]('/',auth[_0xebb3('0xa')](),controller[_0xebb3('0xf')]);router[_0xebb3('0x10')](_0xebb3('0xc'),auth[_0xebb3('0xa')](),controller['update']);router[_0xebb3('0x11')](_0xebb3('0xc'),auth['isAuthenticated'](),controller[_0xebb3('0x12')]);module[_0xebb3('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index d03a46d..2638bec 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 _0xd785=['STRING','exports','ENUM','localnet','externip','stun','turn'];(function(_0x3ff893,_0x53e2bd){var _0x246d70=function(_0x78da15){while(--_0x78da15){_0x3ff893['push'](_0x3ff893['shift']());}};_0x246d70(++_0x53e2bd);}(_0xd785,0x15f));var _0x5d78=function(_0x484c03,_0x13c1d2){_0x484c03=_0x484c03-0x0;var _0x294127=_0xd785[_0x484c03];return _0x294127;};'use strict';var Sequelize=require('sequelize');module[_0x5d78('0x0')]={'type':{'type':Sequelize[_0x5d78('0x1')](_0x5d78('0x2'),_0x5d78('0x3'),_0x5d78('0x4'),_0x5d78('0x5'))},'value':{'type':Sequelize[_0x5d78('0x6')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x5d78('0x6')]}}; \ No newline at end of file +var _0xcf0e=['STRING','exports','ENUM','externip','stun','turn'];(function(_0x357102,_0x50e5b2){var _0x1bf298=function(_0x1c7384){while(--_0x1c7384){_0x357102['push'](_0x357102['shift']());}};_0x1bf298(++_0x50e5b2);}(_0xcf0e,0xbb));var _0xecf0=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xcf0e[_0x166d93];return _0xba708;};'use strict';var Sequelize=require('sequelize');module[_0xecf0('0x0')]={'type':{'type':Sequelize[_0xecf0('0x1')]('localnet',_0xecf0('0x2'),_0xecf0('0x3'),_0xecf0('0x4'))},'value':{'type':Sequelize[_0xecf0('0x5')]},'username':{'type':Sequelize[_0xecf0('0x5')]},'password':{'type':Sequelize[_0xecf0('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 0e0f7d2..14187a4 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 _0xd1f5=['where','pick','merge','VIRTUAL','filter','Network','includeAll','include','findAll','show','params','keys','options','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','format','chan_sip.so','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort'];(function(_0x2fd392,_0x372382){var _0x28b341=function(_0x264867){while(--_0x264867){_0x2fd392['push'](_0x2fd392['shift']());}};_0x28b341(++_0x372382);}(_0xd1f5,0x1de));var _0x5d1f=function(_0x29798b,_0xd3d41a){_0x29798b=_0x29798b-0x0;var _0x18c023=_0xd1f5[_0x29798b];return _0x18c023;};'use strict';var emlformat=require(_0x5d1f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5d1f('0x1'));var jsonpatch=require(_0x5d1f('0x2'));var rp=require('request-promise');var moment=require(_0x5d1f('0x3'));var BPromise=require(_0x5d1f('0x4'));var Mustache=require(_0x5d1f('0x5'));var util=require('util');var path=require(_0x5d1f('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5d1f('0x7'));var _=require(_0x5d1f('0x8'));var squel=require(_0x5d1f('0x9'));var crypto=require(_0x5d1f('0xa'));var jsforce=require(_0x5d1f('0xb'));var deskjs=require(_0x5d1f('0xc'));var toCsv=require(_0x5d1f('0xd'));var querystring=require('querystring');var Papa=require(_0x5d1f('0xe'));var Redis=require(_0x5d1f('0xf'));var authService=require(_0x5d1f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5d1f('0x11'));var hardwareService=require(_0x5d1f('0x12'));var logger=require('../../config/logger')(_0x5d1f('0x13'));var utils=require(_0x5d1f('0x14'));var config=require(_0x5d1f('0x15'));var licenseUtil=require(_0x5d1f('0x16'));var db=require(_0x5d1f('0x17'))['db'];var jayson=require(_0x5d1f('0x18'));var client=jayson[_0x5d1f('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x250b1e,_0x31f8aa,_0x221458,_0x103d34){return new BPromise(function(_0x530db6,_0x23e37b){var _0x43cadf=_0x103d34||client;return _0x43cadf[_0x5d1f('0x1a')](_0x250b1e,_0x221458)['then'](function(_0x95100c){logger[_0x5d1f('0x1b')](_0x5d1f('0x1c'),_0x31f8aa,'request\x20sent');logger[_0x5d1f('0x1d')](_0x5d1f('0x1e'),_0x31f8aa,_0x5d1f('0x1f'),JSON['stringify'](_0x95100c));if(_0x95100c[_0x5d1f('0x20')]){if(_0x95100c['error'][_0x5d1f('0x21')]===0x1f4){logger['error'](_0x5d1f('0x1c'),_0x31f8aa,_0x95100c[_0x5d1f('0x20')]['message']);return _0x23e37b(_0x95100c['error'][_0x5d1f('0x22')]);}logger[_0x5d1f('0x20')](_0x5d1f('0x1c'),_0x31f8aa,_0x95100c[_0x5d1f('0x20')][_0x5d1f('0x22')]);return _0x530db6(_0x95100c[_0x5d1f('0x20')]['message']);}else{logger[_0x5d1f('0x1b')]('Network,\x20%s,\x20%s',_0x31f8aa,_0x5d1f('0x1f'));_0x530db6(_0x95100c[_0x5d1f('0x23')][_0x5d1f('0x22')]);}})[_0x5d1f('0x24')](function(_0x1e0564){logger[_0x5d1f('0x20')](_0x5d1f('0x1c'),_0x31f8aa,_0x1e0564);_0x23e37b(_0x1e0564);});});}function respondWithStatusCode(_0x290a26,_0x21c79d){_0x21c79d=_0x21c79d||0xcc;return function(_0x2c7f7f){if(_0x2c7f7f){return _0x290a26['sendStatus'](_0x21c79d);}return _0x290a26[_0x5d1f('0x25')](_0x21c79d)[_0x5d1f('0x26')]();};}function respondWithResult(_0x598851,_0x41c6fd){_0x41c6fd=_0x41c6fd||0xc8;return function(_0x362879){if(_0x362879){return _0x598851['status'](_0x41c6fd)[_0x5d1f('0x27')](_0x362879);}};}function respondWithFilteredResult(_0x4d091a,_0x3c0f1d){return function(_0x21a999){if(_0x21a999){var _0x5ddd25=typeof _0x3c0f1d[_0x5d1f('0x28')]===_0x5d1f('0x29')&&typeof _0x3c0f1d[_0x5d1f('0x2a')]===_0x5d1f('0x29');var _0x541b39=_0x21a999[_0x5d1f('0x2b')];var _0x143a70=_0x5ddd25?0x0:_0x3c0f1d[_0x5d1f('0x28')];var _0x4f0152=_0x5ddd25?_0x21a999[_0x5d1f('0x2b')]:_0x3c0f1d[_0x5d1f('0x28')]+_0x3c0f1d[_0x5d1f('0x2a')];var _0x339c01;if(_0x4f0152>=_0x541b39){_0x4f0152=_0x541b39;_0x339c01=0xc8;}else{_0x339c01=0xce;}_0x4d091a['status'](_0x339c01);return _0x4d091a[_0x5d1f('0x2c')]('Content-Range',_0x143a70+'-'+_0x4f0152+'/'+_0x541b39)[_0x5d1f('0x27')](_0x21a999);}return null;};}function patchUpdates(_0x489ec4){return function(_0xacad0d){try{jsonpatch[_0x5d1f('0x2d')](_0xacad0d,_0x489ec4,!![]);}catch(_0x27afa3){return BPromise[_0x5d1f('0x2e')](_0x27afa3);}return _0xacad0d[_0x5d1f('0x2f')]();};}function saveUpdates(_0xe8055d,_0x1062d3){return function(_0x2deb35){if(_0x2deb35){return _0x2deb35[_0x5d1f('0x30')](_0xe8055d)[_0x5d1f('0x31')](function(_0x307883){return _0x307883;});}return null;};}function removeEntity(_0x29b4e0,_0x2f05fc){return function(_0x497a8f){if(_0x497a8f){return _0x497a8f[_0x5d1f('0x32')]()[_0x5d1f('0x31')](function(){_0x29b4e0[_0x5d1f('0x25')](0xcc)[_0x5d1f('0x26')]();});}};}function handleEntityNotFound(_0x3aabe5,_0x8065c1){return function(_0x71817b){if(!_0x71817b){_0x3aabe5[_0x5d1f('0x33')](0x194);}return _0x71817b;};}function handleError(_0x55ba50,_0x2787b9){_0x2787b9=_0x2787b9||0x1f4;return function(_0x368ea4){logger[_0x5d1f('0x20')](_0x368ea4[_0x5d1f('0x34')]);if(_0x368ea4['name']){delete _0x368ea4[_0x5d1f('0x35')];}_0x55ba50[_0x5d1f('0x25')](_0x2787b9)[_0x5d1f('0x36')](_0x368ea4);};}exports[_0x5d1f('0x37')]=function(_0x4df514,_0x3ea0b1){var _0x46ab8e={},_0x36635d={},_0x2b6d34={'count':0x0,'rows':[]};var _0x101902=_['map'](db['Network'][_0x5d1f('0x38')],function(_0x3f54ed){return{'name':_0x3f54ed[_0x5d1f('0x39')],'type':_0x3f54ed[_0x5d1f('0x3a')][_0x5d1f('0x3b')]};});_0x36635d['model']=_[_0x5d1f('0x3c')](_0x101902,_0x5d1f('0x35'));_0x36635d['query']=_['keys'](_0x4df514[_0x5d1f('0x3d')]);_0x36635d[_0x5d1f('0x3e')]=_[_0x5d1f('0x3f')](_0x36635d['model'],_0x36635d['query']);_0x46ab8e[_0x5d1f('0x40')]=_[_0x5d1f('0x3f')](_0x36635d['model'],qs[_0x5d1f('0x41')](_0x4df514[_0x5d1f('0x3d')]['fields']));_0x46ab8e[_0x5d1f('0x40')]=_0x46ab8e[_0x5d1f('0x40')][_0x5d1f('0x42')]?_0x46ab8e[_0x5d1f('0x40')]:_0x36635d[_0x5d1f('0x43')];if(!_0x4df514[_0x5d1f('0x3d')][_0x5d1f('0x44')](_0x5d1f('0x45'))){_0x46ab8e['limit']=qs[_0x5d1f('0x2a')](_0x4df514[_0x5d1f('0x3d')][_0x5d1f('0x2a')]);_0x46ab8e['offset']=qs[_0x5d1f('0x28')](_0x4df514[_0x5d1f('0x3d')]['offset']);}_0x46ab8e[_0x5d1f('0x46')]=qs[_0x5d1f('0x47')](_0x4df514[_0x5d1f('0x3d')][_0x5d1f('0x47')]);_0x46ab8e[_0x5d1f('0x48')]=qs[_0x5d1f('0x3e')](_[_0x5d1f('0x49')](_0x4df514[_0x5d1f('0x3d')],_0x36635d['filters']),_0x101902);if(_0x4df514['query']['filter']){_0x46ab8e['where']=_[_0x5d1f('0x4a')](_0x46ab8e[_0x5d1f('0x48')],{'$or':_[_0x5d1f('0x3c')](_0x101902,function(_0x3cd1ef){if(_0x3cd1ef[_0x5d1f('0x3a')]!==_0x5d1f('0x4b')){var _0xfe2fb1={};_0xfe2fb1[_0x3cd1ef['name']]={'$like':'%'+_0x4df514['query'][_0x5d1f('0x4c')]+'%'};return _0xfe2fb1;}})});}_0x46ab8e=_['merge']({},_0x46ab8e,_0x4df514['options']);var _0x157297={'where':_0x46ab8e['where']};return db[_0x5d1f('0x4d')][_0x5d1f('0x2b')](_0x157297)['then'](function(_0xa97909){_0x2b6d34['count']=_0xa97909;if(_0x4df514[_0x5d1f('0x3d')][_0x5d1f('0x4e')]){_0x46ab8e[_0x5d1f('0x4f')]=[{'all':!![]}];}return db[_0x5d1f('0x4d')][_0x5d1f('0x50')](_0x46ab8e);})['then'](function(_0x2e78b0){_0x2b6d34['rows']=_0x2e78b0;return _0x2b6d34;})[_0x5d1f('0x31')](respondWithFilteredResult(_0x3ea0b1,_0x46ab8e))[_0x5d1f('0x24')](handleError(_0x3ea0b1,null));};exports[_0x5d1f('0x51')]=function(_0x396cf4,_0xf9cedb){var _0x552735={'raw':!![],'where':{'id':_0x396cf4[_0x5d1f('0x52')]['id']}},_0x2e16f5={};_0x2e16f5[_0x5d1f('0x43')]=_[_0x5d1f('0x53')](db[_0x5d1f('0x4d')][_0x5d1f('0x38')]);_0x2e16f5[_0x5d1f('0x3d')]=_[_0x5d1f('0x53')](_0x396cf4[_0x5d1f('0x3d')]);_0x2e16f5['filters']=_[_0x5d1f('0x3f')](_0x2e16f5[_0x5d1f('0x43')],_0x2e16f5['query']);_0x552735[_0x5d1f('0x40')]=_[_0x5d1f('0x3f')](_0x2e16f5[_0x5d1f('0x43')],qs[_0x5d1f('0x41')](_0x396cf4[_0x5d1f('0x3d')]['fields']));_0x552735[_0x5d1f('0x40')]=_0x552735[_0x5d1f('0x40')][_0x5d1f('0x42')]?_0x552735[_0x5d1f('0x40')]:_0x2e16f5[_0x5d1f('0x43')];if(_0x396cf4[_0x5d1f('0x3d')][_0x5d1f('0x4e')]){_0x552735[_0x5d1f('0x4f')]=[{'all':!![]}];}_0x552735=_[_0x5d1f('0x4a')]({},_0x552735,_0x396cf4[_0x5d1f('0x54')]);return db[_0x5d1f('0x4d')][_0x5d1f('0x55')](_0x552735)['then'](handleEntityNotFound(_0xf9cedb,null))['then'](respondWithResult(_0xf9cedb,null))[_0x5d1f('0x24')](handleError(_0xf9cedb,null));};exports[_0x5d1f('0x56')]=function(_0x29162c,_0x56cc0b,_0x1b2c52){var _0x3ac6ee;return db[_0x5d1f('0x57')][_0x5d1f('0x58')](function(_0x1adca4){return db[_0x5d1f('0x4d')][_0x5d1f('0x56')](_0x29162c[_0x5d1f('0x59')],{'raw':!![]})[_0x5d1f('0x31')](function(_0x2a481a){_0x3ac6ee=_0x2a481a;return db[_0x5d1f('0x4d')]['findAll']({'where':{'type':_0x29162c['body'][_0x5d1f('0x3a')]},'raw':!![]});})[_0x5d1f('0x31')](function(_0x2f7583){if(_0x3ac6ee[_0x5d1f('0x3a')][_0x5d1f('0x5a')]()==_0x5d1f('0x5b')){var _0x1d1b9f=fs[_0x5d1f('0x5c')](path[_0x5d1f('0x5d')](config[_0x5d1f('0x5e')],_0x5d1f('0x5f')),_0x5d1f('0x60'));var _0x2fe25c=ejs[_0x5d1f('0x61')](_0x1d1b9f,{'networks':_0x2f7583||[]});fs[_0x5d1f('0x62')](_0x5d1f('0x63'),_0x2fe25c);return respondWithRpcPromise(_0x5d1f('0x64'),_0x5d1f('0x56'),{'module':_0x5d1f('0x65')});}else if(_0x3ac6ee[_0x5d1f('0x3a')]['toUpperCase']()==_0x5d1f('0x66')){var _0x314a36=fs['readFileSync'](path[_0x5d1f('0x5d')](config[_0x5d1f('0x5e')],_0x5d1f('0x67')),'utf8');var _0x410f19=ejs[_0x5d1f('0x61')](_0x314a36,{'networks':_0x2f7583||[]});fs[_0x5d1f('0x62')](_0x5d1f('0x68'),_0x410f19);return respondWithRpcPromise(_0x5d1f('0x64'),_0x5d1f('0x56'),{'module':_0x5d1f('0x65')});}else{var _0xc66d45=fs[_0x5d1f('0x5c')](path[_0x5d1f('0x5d')](config[_0x5d1f('0x5e')],_0x5d1f('0x69')),_0x5d1f('0x60'));var _0x11c4d1=ejs[_0x5d1f('0x61')](_0xc66d45,{'networks':_0x2f7583||[]});fs[_0x5d1f('0x62')](util['format'](_0x5d1f('0x6a'),_0x29162c[_0x5d1f('0x59')]['type'][_0x5d1f('0x6b')]()),_0x11c4d1);return respondWithRpcPromise(_0x5d1f('0x64'),_0x5d1f('0x56'),{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x3ac6ee;});})[_0x5d1f('0x31')](respondWithResult(_0x56cc0b,0xc9))['catch'](handleError(_0x56cc0b,null));};exports[_0x5d1f('0x30')]=function(_0x3b0cb4,_0x5e4336,_0x2d954b){var _0x396b05;return db[_0x5d1f('0x57')][_0x5d1f('0x58')](function(_0x2f9886){return db[_0x5d1f('0x4d')][_0x5d1f('0x55')]({'where':{'id':_0x3b0cb4[_0x5d1f('0x52')]['id']}})[_0x5d1f('0x31')](handleEntityNotFound(_0x5e4336,null))[_0x5d1f('0x31')](saveUpdates(_0x3b0cb4[_0x5d1f('0x59')],null))['then'](function(_0x14e42a){if(_0x14e42a){_0x396b05=_0x14e42a;return db[_0x5d1f('0x4d')][_0x5d1f('0x50')]({'where':{'type':_0x396b05[_0x5d1f('0x3a')]},'raw':!![]});}return null;})[_0x5d1f('0x31')](function(_0x10feb8){if(_0x396b05['type'][_0x5d1f('0x5a')]()==_0x5d1f('0x5b')){var _0xbfdadb=fs['readFileSync'](path['join'](config[_0x5d1f('0x5e')],'server/files/templates/stun_multiple.ejs'),_0x5d1f('0x60'));var _0x81057e=ejs[_0x5d1f('0x61')](_0xbfdadb,{'networks':_0x10feb8||[]});fs[_0x5d1f('0x62')]('/etc/asterisk/stun_xcally.conf',_0x81057e);return respondWithRpcPromise('Reload',_0x5d1f('0x30'),{'module':'res_stun_monitor.so'});}else if(_0x396b05['type'][_0x5d1f('0x5a')]()==_0x5d1f('0x66')){var _0x2fa740=fs[_0x5d1f('0x5c')](path[_0x5d1f('0x5d')](config['root'],_0x5d1f('0x67')),_0x5d1f('0x60'));var _0x4369dc=ejs[_0x5d1f('0x61')](_0x2fa740,{'networks':_0x10feb8||[]});fs[_0x5d1f('0x62')](_0x5d1f('0x68'),_0x4369dc);return respondWithRpcPromise('Reload',_0x5d1f('0x30'),{'module':_0x5d1f('0x65')});}else{var _0x507d9b=fs[_0x5d1f('0x5c')](path['join'](config[_0x5d1f('0x5e')],_0x5d1f('0x69')),_0x5d1f('0x60'));var _0x3c3fe6=ejs['render'](_0x507d9b,{'networks':_0x10feb8||[]});fs[_0x5d1f('0x62')](util[_0x5d1f('0x6c')]('/etc/asterisk/sip_xcally_%s.conf',_0x3b0cb4[_0x5d1f('0x59')][_0x5d1f('0x3a')]['toLowerCase']()),_0x3c3fe6);return respondWithRpcPromise(_0x5d1f('0x64'),_0x5d1f('0x30'),{'module':'chan_sip.so'});}return null;})[_0x5d1f('0x31')](function(_0x4ba620){if(_0x4ba620){return _0x396b05;}return null;});})[_0x5d1f('0x31')](respondWithResult(_0x5e4336,null))['catch'](handleError(_0x5e4336,null));};exports[_0x5d1f('0x32')]=function(_0x393c96,_0xbee9a9,_0x25bdbf){var _0x51d299;return db[_0x5d1f('0x4d')][_0x5d1f('0x55')]({'where':{'id':_0x393c96[_0x5d1f('0x52')]['id']}})[_0x5d1f('0x31')](function(_0x11ae5c){_0x51d299=_0x11ae5c;return _0x11ae5c;})[_0x5d1f('0x31')](handleEntityNotFound(_0xbee9a9,null))[_0x5d1f('0x31')](removeEntity(_0xbee9a9,null))[_0x5d1f('0x31')](function(){if(_0x51d299){return db[_0x5d1f('0x4d')][_0x5d1f('0x50')]({'where':{'type':_0x51d299[_0x5d1f('0x3a')]},'raw':!![]});}})['then'](function(_0x56b068){if(_0x51d299['type'][_0x5d1f('0x5a')]()==_0x5d1f('0x5b')){var _0x23e8ce=fs[_0x5d1f('0x5c')](path[_0x5d1f('0x5d')](config[_0x5d1f('0x5e')],'server/files/templates/stun_multiple.ejs'),_0x5d1f('0x60'));var _0xc0680f=ejs[_0x5d1f('0x61')](_0x23e8ce,{'networks':_0x56b068||[]});fs[_0x5d1f('0x62')](_0x5d1f('0x63'),_0xc0680f);return respondWithRpcPromise(_0x5d1f('0x64'),_0x5d1f('0x32'),{'module':_0x5d1f('0x65')});}else if(_0x51d299[_0x5d1f('0x3a')][_0x5d1f('0x5a')]()==_0x5d1f('0x66')){var _0x2c6c8d=fs['readFileSync'](path[_0x5d1f('0x5d')](config[_0x5d1f('0x5e')],_0x5d1f('0x67')),_0x5d1f('0x60'));var _0x36d3d8=ejs[_0x5d1f('0x61')](_0x2c6c8d,{'networks':_0x56b068||[]});fs[_0x5d1f('0x62')]('/etc/asterisk/turn_xcally.conf',_0x36d3d8);return respondWithRpcPromise(_0x5d1f('0x64'),_0x5d1f('0x32'),{'module':_0x5d1f('0x65')});}else{var _0x5528f5=fs[_0x5d1f('0x5c')](path[_0x5d1f('0x5d')](config[_0x5d1f('0x5e')],_0x5d1f('0x69')),_0x5d1f('0x60'));var _0x580b52=ejs['render'](_0x5528f5,{'networks':_0x56b068||[]});fs[_0x5d1f('0x62')](util[_0x5d1f('0x6c')](_0x5d1f('0x6a'),_0x393c96['body'][_0x5d1f('0x3a')][_0x5d1f('0x6b')]()),_0x580b52);return respondWithRpcPromise(_0x5d1f('0x64'),'destroy',{'module':_0x5d1f('0x6d')});}return null;})[_0x5d1f('0x24')](handleError(_0xbee9a9,null));}; \ No newline at end of file +var _0xabc7=['res_stun_monitor.so','TURN','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','transaction','chan_sip.so','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','name','send','index','map','Network','rawAttributes','type','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','sequelize','body','findAll','toUpperCase','STUN','readFileSync','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload'];(function(_0x5f1d60,_0x4afe15){var _0x3fc3a2=function(_0x660e7c){while(--_0x660e7c){_0x5f1d60['push'](_0x5f1d60['shift']());}};_0x3fc3a2(++_0x4afe15);}(_0xabc7,0x77));var _0x7abc=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xabc7[_0xa1e3e3];return _0xc980e9;};'use strict';var emlformat=require(_0x7abc('0x0'));var rimraf=require(_0x7abc('0x1'));var zipdir=require(_0x7abc('0x2'));var jsonpatch=require(_0x7abc('0x3'));var rp=require(_0x7abc('0x4'));var moment=require('moment');var BPromise=require(_0x7abc('0x5'));var Mustache=require(_0x7abc('0x6'));var util=require(_0x7abc('0x7'));var path=require(_0x7abc('0x8'));var sox=require('sox');var csv=require(_0x7abc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7abc('0xa'));var _=require(_0x7abc('0xb'));var squel=require(_0x7abc('0xc'));var crypto=require('crypto');var jsforce=require(_0x7abc('0xd'));var deskjs=require(_0x7abc('0xe'));var toCsv=require(_0x7abc('0x9'));var querystring=require(_0x7abc('0xf'));var Papa=require('papaparse');var Redis=require(_0x7abc('0x10'));var authService=require(_0x7abc('0x11'));var qs=require(_0x7abc('0x12'));var as=require(_0x7abc('0x13'));var hardwareService=require(_0x7abc('0x14'));var logger=require(_0x7abc('0x15'))('api');var utils=require(_0x7abc('0x16'));var config=require(_0x7abc('0x17'));var licenseUtil=require(_0x7abc('0x18'));var db=require(_0x7abc('0x19'))['db'];var jayson=require(_0x7abc('0x1a'));var client=jayson[_0x7abc('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16af7c,_0x5e11ae,_0x30cc68,_0x3b13cb){return new BPromise(function(_0x3f0022,_0xa76854){var _0xa83a37=_0x3b13cb||client;return _0xa83a37[_0x7abc('0x1c')](_0x16af7c,_0x30cc68)[_0x7abc('0x1d')](function(_0x38a3e2){logger[_0x7abc('0x1e')](_0x7abc('0x1f'),_0x5e11ae,_0x7abc('0x20'));logger[_0x7abc('0x21')]('Network,\x20%s,\x20%s,\x20%s',_0x5e11ae,_0x7abc('0x20'),JSON[_0x7abc('0x22')](_0x38a3e2));if(_0x38a3e2['error']){if(_0x38a3e2['error'][_0x7abc('0x23')]===0x1f4){logger[_0x7abc('0x24')](_0x7abc('0x1f'),_0x5e11ae,_0x38a3e2['error'][_0x7abc('0x25')]);return _0xa76854(_0x38a3e2['error']['message']);}logger[_0x7abc('0x24')](_0x7abc('0x1f'),_0x5e11ae,_0x38a3e2[_0x7abc('0x24')][_0x7abc('0x25')]);return _0x3f0022(_0x38a3e2['error']['message']);}else{logger['info'](_0x7abc('0x1f'),_0x5e11ae,_0x7abc('0x20'));_0x3f0022(_0x38a3e2[_0x7abc('0x26')][_0x7abc('0x25')]);}})['catch'](function(_0x2b10e2){logger[_0x7abc('0x24')]('Network,\x20%s,\x20%s',_0x5e11ae,_0x2b10e2);_0xa76854(_0x2b10e2);});});}function respondWithStatusCode(_0x3caa9e,_0x3d5bd9){_0x3d5bd9=_0x3d5bd9||0xcc;return function(_0x386f4a){if(_0x386f4a){return _0x3caa9e[_0x7abc('0x27')](_0x3d5bd9);}return _0x3caa9e[_0x7abc('0x28')](_0x3d5bd9)[_0x7abc('0x29')]();};}function respondWithResult(_0x464e32,_0x3a8497){_0x3a8497=_0x3a8497||0xc8;return function(_0x2f6b92){if(_0x2f6b92){return _0x464e32[_0x7abc('0x28')](_0x3a8497)[_0x7abc('0x2a')](_0x2f6b92);}};}function respondWithFilteredResult(_0x346073,_0x6b795d){return function(_0x2707e7){if(_0x2707e7){var _0x5e07bb=typeof _0x6b795d[_0x7abc('0x2b')]===_0x7abc('0x2c')&&typeof _0x6b795d[_0x7abc('0x2d')]===_0x7abc('0x2c');var _0x3963aa=_0x2707e7['count'];var _0x14cbdd=_0x5e07bb?0x0:_0x6b795d[_0x7abc('0x2b')];var _0x37e6b4=_0x5e07bb?_0x2707e7[_0x7abc('0x2e')]:_0x6b795d['offset']+_0x6b795d[_0x7abc('0x2d')];var _0x1ebda4;if(_0x37e6b4>=_0x3963aa){_0x37e6b4=_0x3963aa;_0x1ebda4=0xc8;}else{_0x1ebda4=0xce;}_0x346073[_0x7abc('0x28')](_0x1ebda4);return _0x346073['set'](_0x7abc('0x2f'),_0x14cbdd+'-'+_0x37e6b4+'/'+_0x3963aa)['json'](_0x2707e7);}return null;};}function patchUpdates(_0x26de1d){return function(_0x22edf1){try{jsonpatch[_0x7abc('0x30')](_0x22edf1,_0x26de1d,!![]);}catch(_0x2b063b){return BPromise[_0x7abc('0x31')](_0x2b063b);}return _0x22edf1[_0x7abc('0x32')]();};}function saveUpdates(_0x5dbb13,_0x31ffb3){return function(_0x302e1a){if(_0x302e1a){return _0x302e1a[_0x7abc('0x33')](_0x5dbb13)[_0x7abc('0x1d')](function(_0x23bee5){return _0x23bee5;});}return null;};}function removeEntity(_0x6bfd91,_0x4c9b00){return function(_0xff5d29){if(_0xff5d29){return _0xff5d29[_0x7abc('0x34')]()['then'](function(){_0x6bfd91[_0x7abc('0x28')](0xcc)[_0x7abc('0x29')]();});}};}function handleEntityNotFound(_0xf987d,_0x47629d){return function(_0x21d904){if(!_0x21d904){_0xf987d['sendStatus'](0x194);}return _0x21d904;};}function handleError(_0x219b50,_0x661a2f){_0x661a2f=_0x661a2f||0x1f4;return function(_0x5109c0){logger['error'](_0x5109c0['stack']);if(_0x5109c0[_0x7abc('0x35')]){delete _0x5109c0[_0x7abc('0x35')];}_0x219b50['status'](_0x661a2f)[_0x7abc('0x36')](_0x5109c0);};}exports[_0x7abc('0x37')]=function(_0x26bf1e,_0x4ca5a1){var _0x44f50a={},_0x44283a={},_0x36d5f6={'count':0x0,'rows':[]};var _0x175c6c=_[_0x7abc('0x38')](db[_0x7abc('0x39')][_0x7abc('0x3a')],function(_0x25f400){return{'name':_0x25f400['fieldName'],'type':_0x25f400[_0x7abc('0x3b')]['key']};});_0x44283a[_0x7abc('0x3c')]=_[_0x7abc('0x38')](_0x175c6c,_0x7abc('0x35'));_0x44283a[_0x7abc('0x3d')]=_[_0x7abc('0x3e')](_0x26bf1e['query']);_0x44283a[_0x7abc('0x3f')]=_[_0x7abc('0x40')](_0x44283a['model'],_0x44283a[_0x7abc('0x3d')]);_0x44f50a['attributes']=_['intersection'](_0x44283a[_0x7abc('0x3c')],qs[_0x7abc('0x41')](_0x26bf1e['query']['fields']));_0x44f50a['attributes']=_0x44f50a['attributes'][_0x7abc('0x42')]?_0x44f50a[_0x7abc('0x43')]:_0x44283a[_0x7abc('0x3c')];if(!_0x26bf1e['query'][_0x7abc('0x44')](_0x7abc('0x45'))){_0x44f50a[_0x7abc('0x2d')]=qs[_0x7abc('0x2d')](_0x26bf1e[_0x7abc('0x3d')][_0x7abc('0x2d')]);_0x44f50a[_0x7abc('0x2b')]=qs[_0x7abc('0x2b')](_0x26bf1e[_0x7abc('0x3d')][_0x7abc('0x2b')]);}_0x44f50a['order']=qs[_0x7abc('0x46')](_0x26bf1e[_0x7abc('0x3d')][_0x7abc('0x46')]);_0x44f50a['where']=qs['filters'](_['pick'](_0x26bf1e[_0x7abc('0x3d')],_0x44283a['filters']),_0x175c6c);if(_0x26bf1e[_0x7abc('0x3d')][_0x7abc('0x47')]){_0x44f50a[_0x7abc('0x48')]=_[_0x7abc('0x49')](_0x44f50a[_0x7abc('0x48')],{'$or':_[_0x7abc('0x38')](_0x175c6c,function(_0x31f522){if(_0x31f522['type']!==_0x7abc('0x4a')){var _0x548fdc={};_0x548fdc[_0x31f522[_0x7abc('0x35')]]={'$like':'%'+_0x26bf1e['query'][_0x7abc('0x47')]+'%'};return _0x548fdc;}})});}_0x44f50a=_[_0x7abc('0x49')]({},_0x44f50a,_0x26bf1e[_0x7abc('0x4b')]);var _0x1381fc={'where':_0x44f50a[_0x7abc('0x48')]};return db[_0x7abc('0x39')]['count'](_0x1381fc)[_0x7abc('0x1d')](function(_0x346411){_0x36d5f6['count']=_0x346411;if(_0x26bf1e[_0x7abc('0x3d')][_0x7abc('0x4c')]){_0x44f50a[_0x7abc('0x4d')]=[{'all':!![]}];}return db[_0x7abc('0x39')]['findAll'](_0x44f50a);})[_0x7abc('0x1d')](function(_0x117c03){_0x36d5f6[_0x7abc('0x4e')]=_0x117c03;return _0x36d5f6;})[_0x7abc('0x1d')](respondWithFilteredResult(_0x4ca5a1,_0x44f50a))[_0x7abc('0x4f')](handleError(_0x4ca5a1,null));};exports[_0x7abc('0x50')]=function(_0x3e8d6d,_0x24ce4a){var _0x18ef91={'raw':!![],'where':{'id':_0x3e8d6d[_0x7abc('0x51')]['id']}},_0x4d8439={};_0x4d8439['model']=_['keys'](db['Network'][_0x7abc('0x3a')]);_0x4d8439['query']=_[_0x7abc('0x3e')](_0x3e8d6d['query']);_0x4d8439[_0x7abc('0x3f')]=_['intersection'](_0x4d8439[_0x7abc('0x3c')],_0x4d8439['query']);_0x18ef91[_0x7abc('0x43')]=_[_0x7abc('0x40')](_0x4d8439[_0x7abc('0x3c')],qs[_0x7abc('0x41')](_0x3e8d6d[_0x7abc('0x3d')]['fields']));_0x18ef91['attributes']=_0x18ef91[_0x7abc('0x43')][_0x7abc('0x42')]?_0x18ef91[_0x7abc('0x43')]:_0x4d8439['model'];if(_0x3e8d6d['query'][_0x7abc('0x4c')]){_0x18ef91[_0x7abc('0x4d')]=[{'all':!![]}];}_0x18ef91=_['merge']({},_0x18ef91,_0x3e8d6d['options']);return db['Network'][_0x7abc('0x52')](_0x18ef91)[_0x7abc('0x1d')](handleEntityNotFound(_0x24ce4a,null))[_0x7abc('0x1d')](respondWithResult(_0x24ce4a,null))['catch'](handleError(_0x24ce4a,null));};exports[_0x7abc('0x53')]=function(_0xbd5367,_0x446c0f,_0x44876f){var _0x3a3ae0;return db[_0x7abc('0x54')]['transaction'](function(_0x485464){return db[_0x7abc('0x39')][_0x7abc('0x53')](_0xbd5367[_0x7abc('0x55')],{'raw':!![]})['then'](function(_0x2f2e9d){_0x3a3ae0=_0x2f2e9d;return db['Network'][_0x7abc('0x56')]({'where':{'type':_0xbd5367['body'][_0x7abc('0x3b')]},'raw':!![]});})[_0x7abc('0x1d')](function(_0x416891){if(_0x3a3ae0[_0x7abc('0x3b')][_0x7abc('0x57')]()==_0x7abc('0x58')){var _0x1dca45=fs[_0x7abc('0x59')](path[_0x7abc('0x5a')](config['root'],_0x7abc('0x5b')),_0x7abc('0x5c'));var _0x22ba6e=ejs[_0x7abc('0x5d')](_0x1dca45,{'networks':_0x416891||[]});fs[_0x7abc('0x5e')](_0x7abc('0x5f'),_0x22ba6e);return respondWithRpcPromise(_0x7abc('0x60'),_0x7abc('0x53'),{'module':_0x7abc('0x61')});}else if(_0x3a3ae0[_0x7abc('0x3b')][_0x7abc('0x57')]()==_0x7abc('0x62')){var _0x3d66d1=fs['readFileSync'](path[_0x7abc('0x5a')](config[_0x7abc('0x63')],_0x7abc('0x64')),_0x7abc('0x5c'));var _0x181478=ejs[_0x7abc('0x5d')](_0x3d66d1,{'networks':_0x416891||[]});fs[_0x7abc('0x5e')](_0x7abc('0x65'),_0x181478);return respondWithRpcPromise(_0x7abc('0x60'),_0x7abc('0x53'),{'module':_0x7abc('0x61')});}else{var _0x3fb53=fs[_0x7abc('0x59')](path['join'](config[_0x7abc('0x63')],_0x7abc('0x66')),_0x7abc('0x5c'));var _0x134e2d=ejs[_0x7abc('0x5d')](_0x3fb53,{'networks':_0x416891||[]});fs['writeFileSync'](util[_0x7abc('0x67')]('/etc/asterisk/sip_xcally_%s.conf',_0xbd5367[_0x7abc('0x55')][_0x7abc('0x3b')]['toLowerCase']()),_0x134e2d);return respondWithRpcPromise(_0x7abc('0x60'),_0x7abc('0x53'),{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x3a3ae0;});})['then'](respondWithResult(_0x446c0f,0xc9))[_0x7abc('0x4f')](handleError(_0x446c0f,null));};exports[_0x7abc('0x33')]=function(_0x333973,_0x37f1f1,_0x3f1ba1){var _0x455c48;return db[_0x7abc('0x54')][_0x7abc('0x68')](function(_0x4e8872){return db[_0x7abc('0x39')]['find']({'where':{'id':_0x333973['params']['id']}})[_0x7abc('0x1d')](handleEntityNotFound(_0x37f1f1,null))[_0x7abc('0x1d')](saveUpdates(_0x333973[_0x7abc('0x55')],null))['then'](function(_0x45b34b){if(_0x45b34b){_0x455c48=_0x45b34b;return db['Network'][_0x7abc('0x56')]({'where':{'type':_0x455c48['type']},'raw':!![]});}return null;})['then'](function(_0x311e54){if(_0x455c48[_0x7abc('0x3b')][_0x7abc('0x57')]()==_0x7abc('0x58')){var _0x2dabdf=fs[_0x7abc('0x59')](path[_0x7abc('0x5a')](config[_0x7abc('0x63')],_0x7abc('0x5b')),_0x7abc('0x5c'));var _0x454c26=ejs[_0x7abc('0x5d')](_0x2dabdf,{'networks':_0x311e54||[]});fs['writeFileSync'](_0x7abc('0x5f'),_0x454c26);return respondWithRpcPromise(_0x7abc('0x60'),_0x7abc('0x33'),{'module':_0x7abc('0x61')});}else if(_0x455c48['type'][_0x7abc('0x57')]()==_0x7abc('0x62')){var _0x5e41e3=fs['readFileSync'](path[_0x7abc('0x5a')](config['root'],_0x7abc('0x64')),_0x7abc('0x5c'));var _0x478fd5=ejs[_0x7abc('0x5d')](_0x5e41e3,{'networks':_0x311e54||[]});fs[_0x7abc('0x5e')]('/etc/asterisk/turn_xcally.conf',_0x478fd5);return respondWithRpcPromise('Reload',_0x7abc('0x33'),{'module':'res_stun_monitor.so'});}else{var _0x3bf981=fs['readFileSync'](path['join'](config[_0x7abc('0x63')],_0x7abc('0x66')),'utf8');var _0x3b1b06=ejs[_0x7abc('0x5d')](_0x3bf981,{'networks':_0x311e54||[]});fs[_0x7abc('0x5e')](util[_0x7abc('0x67')]('/etc/asterisk/sip_xcally_%s.conf',_0x333973[_0x7abc('0x55')]['type']['toLowerCase']()),_0x3b1b06);return respondWithRpcPromise(_0x7abc('0x60'),_0x7abc('0x33'),{'module':_0x7abc('0x69')});}return null;})[_0x7abc('0x1d')](function(_0x50160d){if(_0x50160d){return _0x455c48;}return null;});})[_0x7abc('0x1d')](respondWithResult(_0x37f1f1,null))[_0x7abc('0x4f')](handleError(_0x37f1f1,null));};exports[_0x7abc('0x34')]=function(_0x5bf596,_0x3c2dbf,_0x29039d){var _0x4c2c04;return db['Network'][_0x7abc('0x52')]({'where':{'id':_0x5bf596[_0x7abc('0x51')]['id']}})['then'](function(_0x171b6e){_0x4c2c04=_0x171b6e;return _0x171b6e;})['then'](handleEntityNotFound(_0x3c2dbf,null))[_0x7abc('0x1d')](removeEntity(_0x3c2dbf,null))['then'](function(){if(_0x4c2c04){return db[_0x7abc('0x39')][_0x7abc('0x56')]({'where':{'type':_0x4c2c04[_0x7abc('0x3b')]},'raw':!![]});}})[_0x7abc('0x1d')](function(_0xe22822){if(_0x4c2c04[_0x7abc('0x3b')][_0x7abc('0x57')]()==_0x7abc('0x58')){var _0xde8c14=fs['readFileSync'](path[_0x7abc('0x5a')](config[_0x7abc('0x63')],'server/files/templates/stun_multiple.ejs'),_0x7abc('0x5c'));var _0xfb6706=ejs[_0x7abc('0x5d')](_0xde8c14,{'networks':_0xe22822||[]});fs[_0x7abc('0x5e')](_0x7abc('0x5f'),_0xfb6706);return respondWithRpcPromise(_0x7abc('0x60'),_0x7abc('0x34'),{'module':'res_stun_monitor.so'});}else if(_0x4c2c04['type'][_0x7abc('0x57')]()==_0x7abc('0x62')){var _0x2beec1=fs['readFileSync'](path[_0x7abc('0x5a')](config[_0x7abc('0x63')],_0x7abc('0x64')),_0x7abc('0x5c'));var _0x2964da=ejs[_0x7abc('0x5d')](_0x2beec1,{'networks':_0xe22822||[]});fs[_0x7abc('0x5e')](_0x7abc('0x65'),_0x2964da);return respondWithRpcPromise(_0x7abc('0x60'),_0x7abc('0x34'),{'module':_0x7abc('0x61')});}else{var _0x140030=fs['readFileSync'](path['join'](config['root'],_0x7abc('0x66')),_0x7abc('0x5c'));var _0x1dcec6=ejs[_0x7abc('0x5d')](_0x140030,{'networks':_0xe22822||[]});fs['writeFileSync'](util[_0x7abc('0x67')](_0x7abc('0x6a'),_0x5bf596[_0x7abc('0x55')][_0x7abc('0x3b')][_0x7abc('0x6b')]()),_0x1dcec6);return respondWithRpcPromise(_0x7abc('0x60'),_0x7abc('0x34'),{'module':_0x7abc('0x69')});}return null;})[_0x7abc('0x4f')](handleError(_0x3c2dbf,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 783e1fd..40d0678 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 _0x0a12=['util','bluebird','path','rimraf','../../config/environment','./network.attributes','exports','network'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0a12,0xb8));var _0x20a1=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x0a12[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require('lodash');var util=require(_0x20a1('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x20a1('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x20a1('0x2'));var rimraf=require(_0x20a1('0x3'));var config=require(_0x20a1('0x4'));var attributes=require(_0x20a1('0x5'));module[_0x20a1('0x6')]=function(_0x2e0ad3,_0x1fedd2){return _0x2e0ad3['define']('Network',attributes,{'tableName':_0x20a1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf4eb=['./network.attributes','exports','define','network','lodash','bluebird','rimraf','../../config/environment'];(function(_0x53b67d,_0x251707){var _0xff73e7=function(_0x5bafe4){while(--_0x5bafe4){_0x53b67d['push'](_0x53b67d['shift']());}};_0xff73e7(++_0x251707);}(_0xf4eb,0xec));var _0xbf4e=function(_0x415137,_0x20bb25){_0x415137=_0x415137-0x0;var _0x4b564e=_0xf4eb[_0x415137];return _0x4b564e;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xbf4e('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xbf4e('0x2'));var config=require(_0xbf4e('0x3'));var attributes=require(_0xbf4e('0x4'));module[_0xbf4e('0x5')]=function(_0xa4dcf5,_0x2fcfed){return _0xa4dcf5[_0xbf4e('0x6')]('Network',attributes,{'tableName':_0xbf4e('0x7'),'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 1da76ce..4ebdac1 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2a4bba,_0x1194ce){var _0x40e9c4=function(_0x3502a8){while(--_0x3502a8){_0x2a4bba['push'](_0x2a4bba['shift']());}};_0x40e9c4(++_0x1194ce);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _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(_0x34b2b1,_0x53c7d7){var _0x487e1f=function(_0x40738f){while(--_0x40738f){_0x34b2b1['push'](_0x34b2b1['shift']());}};_0x487e1f(++_0x53c7d7);}(_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 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 feaf221..074a80a 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 _0x53b0=['describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','path','express','Router','../../components/interaction/service','./openchannelAccount.controller','isAuthenticated','get','/describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x53b0,0x8e));var _0x053b=function(_0x43533c,_0x4f1406){_0x43533c=_0x43533c-0x0;var _0x530f49=_0x53b0[_0x43533c];return _0x530f49;};'use strict';var multer=require(_0x053b('0x0'));var util=require(_0x053b('0x1'));var path=require(_0x053b('0x2'));var timeout=require('connect-timeout');var express=require(_0x053b('0x3'));var router=express[_0x053b('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x053b('0x5'));var config=require('../../config/environment');var controller=require(_0x053b('0x6'));router['get']('/',auth[_0x053b('0x7')](),controller['index']);router[_0x053b('0x8')](_0x053b('0x9'),auth[_0x053b('0x7')](),controller[_0x053b('0xa')]);router[_0x053b('0x8')](_0x053b('0xb'),auth[_0x053b('0x7')](),controller[_0x053b('0xc')]);router[_0x053b('0x8')](_0x053b('0xd'),auth['isAuthenticated'](),controller[_0x053b('0xe')]);router['get'](_0x053b('0xf'),auth[_0x053b('0x7')](),controller[_0x053b('0x10')]);router['get'](_0x053b('0x11'),auth[_0x053b('0x7')](),controller[_0x053b('0x12')]);router[_0x053b('0x8')](_0x053b('0x13'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x053b('0x8')]('/:id/users',auth[_0x053b('0x7')](),controller[_0x053b('0x14')]);router[_0x053b('0x15')]('/',auth[_0x053b('0x7')](),controller[_0x053b('0x16')]);router[_0x053b('0x15')](_0x053b('0xd'),auth['isAuthenticated'](),controller[_0x053b('0x17')]);router[_0x053b('0x15')](_0x053b('0xf'),auth[_0x053b('0x7')](),controller[_0x053b('0x18')]);router[_0x053b('0x15')](_0x053b('0x19'),controller[_0x053b('0x1a')]);router[_0x053b('0x15')](_0x053b('0x11'),auth['isAuthenticated'](),controller[_0x053b('0x1b')]);router[_0x053b('0x15')]('/:id/users',auth[_0x053b('0x7')](),controller[_0x053b('0x1c')]);router[_0x053b('0x15')](_0x053b('0x1d'),auth[_0x053b('0x7')](),controller[_0x053b('0x1e')]);router[_0x053b('0x1f')](_0x053b('0xb'),auth[_0x053b('0x7')](),controller[_0x053b('0x20')]);router[_0x053b('0x21')]('/:id',auth[_0x053b('0x7')](),controller[_0x053b('0x22')]);router[_0x053b('0x21')]('/:id/dispositions',auth[_0x053b('0x7')](),controller[_0x053b('0x23')]);router[_0x053b('0x21')]('/:id/canned_answers',auth[_0x053b('0x7')](),controller[_0x053b('0x24')]);router[_0x053b('0x21')]('/:id/users',auth[_0x053b('0x7')](),controller[_0x053b('0x25')]);module['exports']=router; \ No newline at end of file +var _0xd68b=['isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getApplications','/:id/interactions','getInteractions','post','create','/:id/dispositions','addAnswer','/:id/notify','addApplications','addAgents','/:id/send','send','put','delete','destroy','removeAnswers','/:id/users','removeAgents','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x5a7921,_0x16dc6d){var _0x4acca6=function(_0x4f93df){while(--_0x4f93df){_0x5a7921['push'](_0x5a7921['shift']());}};_0x4acca6(++_0x16dc6d);}(_0xd68b,0x1e3));var _0xbd68=function(_0x14e51e,_0xed289b){_0x14e51e=_0x14e51e-0x0;var _0xf93e94=_0xd68b[_0x14e51e];return _0xf93e94;};'use strict';var multer=require(_0xbd68('0x0'));var util=require(_0xbd68('0x1'));var path=require('path');var timeout=require(_0xbd68('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbd68('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbd68('0x4'));var config=require(_0xbd68('0x5'));var controller=require('./openchannelAccount.controller');router[_0xbd68('0x6')]('/',auth[_0xbd68('0x7')](),controller[_0xbd68('0x8')]);router[_0xbd68('0x6')](_0xbd68('0x9'),auth['isAuthenticated'](),controller[_0xbd68('0xa')]);router[_0xbd68('0x6')](_0xbd68('0xb'),auth[_0xbd68('0x7')](),controller[_0xbd68('0xc')]);router[_0xbd68('0x6')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xbd68('0xd')]);router[_0xbd68('0x6')](_0xbd68('0xe'),auth[_0xbd68('0x7')](),controller['getAnswers']);router[_0xbd68('0x6')](_0xbd68('0xf'),auth[_0xbd68('0x7')](),controller[_0xbd68('0x10')]);router[_0xbd68('0x6')](_0xbd68('0x11'),auth[_0xbd68('0x7')](),controller[_0xbd68('0x12')]);router[_0xbd68('0x6')]('/:id/users',auth[_0xbd68('0x7')](),controller['getAgents']);router[_0xbd68('0x13')]('/',auth[_0xbd68('0x7')](),controller[_0xbd68('0x14')]);router[_0xbd68('0x13')](_0xbd68('0x15'),auth[_0xbd68('0x7')](),controller['addDisposition']);router[_0xbd68('0x13')](_0xbd68('0xe'),auth[_0xbd68('0x7')](),controller[_0xbd68('0x16')]);router[_0xbd68('0x13')](_0xbd68('0x17'),controller['notify']);router['post'](_0xbd68('0xf'),auth['isAuthenticated'](),controller[_0xbd68('0x18')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0xbd68('0x19')]);router[_0xbd68('0x13')](_0xbd68('0x1a'),auth['isAuthenticated'](),controller[_0xbd68('0x1b')]);router[_0xbd68('0x1c')](_0xbd68('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xbd68('0x1d')](_0xbd68('0xb'),auth[_0xbd68('0x7')](),controller[_0xbd68('0x1e')]);router['delete']('/:id/dispositions',auth[_0xbd68('0x7')](),controller['removeDispositions']);router['delete'](_0xbd68('0xe'),auth['isAuthenticated'](),controller[_0xbd68('0x1f')]);router[_0xbd68('0x1d')](_0xbd68('0x20'),auth['isAuthenticated'](),controller[_0xbd68('0x21')]);module[_0xbd68('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 12cc838..3988814 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 _0xcc6d=['sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0x2e6744,_0x495160){var _0x20ef10=function(_0x5540d6){while(--_0x5540d6){_0x2e6744['push'](_0x2e6744['shift']());}};_0x20ef10(++_0x495160);}(_0xcc6d,0x118));var _0xdcc6=function(_0x3e6d1c,_0x196e1b){_0x3e6d1c=_0x3e6d1c-0x0;var _0x51f513=_0xcc6d[_0x3e6d1c];return _0x51f513;};'use strict';var Sequelize=require(_0xdcc6('0x0'));var rs=require(_0xdcc6('0x1'));module[_0xdcc6('0x2')]={'name':{'type':Sequelize[_0xdcc6('0x3')],'unique':_0xdcc6('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xdcc6('0x3')]},'token':{'type':Sequelize[_0xdcc6('0x3')],'defaultValue':function(){return rs[_0xdcc6('0x5')]();}},'replyUri':{'type':Sequelize[_0xdcc6('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xdcc6('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xdcc6('0x6')],'defaultValue':function(){return _0xdcc6('0x7');}},'notificationSound':{'type':Sequelize[_0xdcc6('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdcc6('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdcc6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xdcc6('0x3')]},'queueTransfer':{'type':Sequelize[_0xdcc6('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdcc6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdcc6('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdcc6('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdcc6('0x9')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xdcc6('0x8')],'defaultValue':![],'comment':_0xdcc6('0xa'),'set':function(_0x3e6d33){if(!_0x3e6d33)this['setDataValue'](_0xdcc6('0xb'),null);this[_0xdcc6('0xc')](_0xdcc6('0xd'),_0x3e6d33);}}}; \ No newline at end of file +var _0x19e0=['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','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING'];(function(_0x2b7c4c,_0x6e51d6){var _0x1f0876=function(_0x25e371){while(--_0x25e371){_0x2b7c4c['push'](_0x2b7c4c['shift']());}};_0x1f0876(++_0x6e51d6);}(_0x19e0,0x182));var _0x019e=function(_0x38b2d9,_0x19fd42){_0x38b2d9=_0x38b2d9-0x0;var _0x23a3e1=_0x19e0[_0x38b2d9];return _0x23a3e1;};'use strict';var Sequelize=require(_0x019e('0x0'));var rs=require(_0x019e('0x1'));module[_0x019e('0x2')]={'name':{'type':Sequelize[_0x019e('0x3')],'unique':_0x019e('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x019e('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x019e('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x019e('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x019e('0x5')],'defaultValue':function(){return _0x019e('0x6');}},'notificationSound':{'type':Sequelize[_0x019e('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x019e('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x019e('0x8')],'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[_0x019e('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x019e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x019e('0x9'),'set':function(_0x55e1ce){if(!_0x55e1ce)this['setDataValue'](_0x019e('0xa'),null);this[_0x019e('0xb')](_0x019e('0xc'),_0x55e1ce);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index c9d6d47..070f110 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 _0xc3b1=['CannedAnswer','getAnswers','removeAnswers','notify','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','ValidationError','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','Applications','List','list','applications','priority','asc','account','mapKey','firstName','lastName','threadId','externalUrl','ContactId','OpenchannelInteraction','spread','contact','messageId','interaction','created','push','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','agent','Start','startRouting','EventManager','addApplications','sequelize','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','Contact','User','Owner','Tag','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','CmList','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','./openchannelAccount.socket','register','jayson/promise','http','request','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','OpenchannelAccounts','end','stack','send','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','name','options','includeAll','include','findAll','show','params','Pause','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','order','pick','rows','removeDispositions','ids','addAnswer'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xc3b1,0x1b4));var _0x1c3b=function(_0x345f37,_0x5dc9e5){_0x345f37=_0x345f37-0x0;var _0x1f21bd=_0xc3b1[_0x345f37];return _0x1f21bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c3b('0x0'));var zipdir=require(_0x1c3b('0x1'));var jsonpatch=require(_0x1c3b('0x2'));var rp=require(_0x1c3b('0x3'));var moment=require(_0x1c3b('0x4'));var BPromise=require(_0x1c3b('0x5'));var Mustache=require(_0x1c3b('0x6'));var util=require(_0x1c3b('0x7'));var path=require(_0x1c3b('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1c3b('0x9'));var fs=require('fs');var fs_extra=require(_0x1c3b('0xa'));var _=require(_0x1c3b('0xb'));var squel=require(_0x1c3b('0xc'));var crypto=require(_0x1c3b('0xd'));var jsforce=require(_0x1c3b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1c3b('0xf'));var querystring=require('querystring');var Papa=require(_0x1c3b('0x10'));var Redis=require(_0x1c3b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1c3b('0x12'));var as=require(_0x1c3b('0x13'));var hardwareService=require(_0x1c3b('0x14'));var logger=require(_0x1c3b('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1c3b('0x16'));var db=require(_0x1c3b('0x17'))['db'];config[_0x1c3b('0x18')]=_[_0x1c3b('0x19')](config[_0x1c3b('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1c3b('0x18')]));require(_0x1c3b('0x1a'))[_0x1c3b('0x1b')](socket);var jayson=require(_0x1c3b('0x1c'));var client=jayson['client'][_0x1c3b('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x1c3b('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x274ef1,_0x42787d,_0x264a5c,_0x1a4d06){return new BPromise(function(_0x55e0b4,_0x2e7bc5){var _0x1146c1=_0x1a4d06||client;return _0x1146c1[_0x1c3b('0x1e')](_0x274ef1,_0x264a5c)['then'](function(_0x1fab88){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x42787d,_0x1c3b('0x1f'));logger['debug'](_0x1c3b('0x20'),_0x42787d,_0x1c3b('0x1f'),JSON[_0x1c3b('0x21')](_0x1fab88));if(_0x1fab88['error']){if(_0x1fab88[_0x1c3b('0x22')][_0x1c3b('0x23')]===0x1f4){logger[_0x1c3b('0x22')](_0x1c3b('0x24'),_0x42787d,_0x1fab88[_0x1c3b('0x22')][_0x1c3b('0x25')]);return _0x2e7bc5(_0x1fab88[_0x1c3b('0x22')][_0x1c3b('0x25')]);}logger[_0x1c3b('0x22')]('OpenchannelAccount,\x20%s,\x20%s',_0x42787d,_0x1fab88[_0x1c3b('0x22')]['message']);return _0x55e0b4(_0x1fab88[_0x1c3b('0x22')][_0x1c3b('0x25')]);}else{logger[_0x1c3b('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x42787d,_0x1c3b('0x1f'));_0x55e0b4(_0x1fab88[_0x1c3b('0x27')][_0x1c3b('0x25')]);}})[_0x1c3b('0x28')](function(_0x1ba3f3){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x42787d,_0x1ba3f3);_0x2e7bc5(_0x1ba3f3);});});}function respondWithStatusCode(_0x21d6f6,_0x19b4a8){_0x19b4a8=_0x19b4a8||0xcc;return function(_0x485196){if(_0x485196){return _0x21d6f6[_0x1c3b('0x29')](_0x19b4a8);}return _0x21d6f6[_0x1c3b('0x2a')](_0x19b4a8)['end']();};}function respondWithResult(_0x5bdab9,_0x48bf8f){_0x48bf8f=_0x48bf8f||0xc8;return function(_0x47a341){if(_0x47a341){return _0x5bdab9[_0x1c3b('0x2a')](_0x48bf8f)[_0x1c3b('0x2b')](_0x47a341);}};}function respondWithFilteredResult(_0x345947,_0x3d699d){return function(_0x442e31){if(_0x442e31){var _0x34815f=typeof _0x3d699d[_0x1c3b('0x2c')]==='undefined'&&typeof _0x3d699d[_0x1c3b('0x2d')]==='undefined';var _0x361fcc=_0x442e31[_0x1c3b('0x2e')];var _0x582937=_0x34815f?0x0:_0x3d699d['offset'];var _0x32b84f=_0x34815f?_0x442e31[_0x1c3b('0x2e')]:_0x3d699d[_0x1c3b('0x2c')]+_0x3d699d['limit'];var _0x3abd49;if(_0x32b84f>=_0x361fcc){_0x32b84f=_0x361fcc;_0x3abd49=0xc8;}else{_0x3abd49=0xce;}_0x345947[_0x1c3b('0x2a')](_0x3abd49);return _0x345947[_0x1c3b('0x2f')](_0x1c3b('0x30'),_0x582937+'-'+_0x32b84f+'/'+_0x361fcc)[_0x1c3b('0x2b')](_0x442e31);}return null;};}function patchUpdates(_0x11e60e){return function(_0x56b811){try{jsonpatch[_0x1c3b('0x31')](_0x56b811,_0x11e60e,!![]);}catch(_0x428f20){return BPromise[_0x1c3b('0x32')](_0x428f20);}return _0x56b811[_0x1c3b('0x33')]();};}function saveUpdates(_0x6e39ec,_0x133a24){return function(_0x14a585){if(_0x14a585){return _0x14a585[_0x1c3b('0x34')](_0x6e39ec)['then'](function(_0x125248){return _0x125248;});}return null;};}function removeEntity(_0x1096f5,_0x725b75){return function(_0x36e91b){if(_0x36e91b){return _0x36e91b[_0x1c3b('0x35')]()[_0x1c3b('0x36')](function(){var _0x148d3c=_0x36e91b[_0x1c3b('0x37')]({'plain':!![]});var _0x444e08=_0x1c3b('0x38');return db['UserProfileResource'][_0x1c3b('0x35')]({'where':{'type':_0x444e08,'resourceId':_0x148d3c['id']}})[_0x1c3b('0x36')](function(){return _0x36e91b;});})[_0x1c3b('0x36')](function(){_0x1096f5[_0x1c3b('0x2a')](0xcc)[_0x1c3b('0x39')]();});}};}function handleEntityNotFound(_0x1c7501,_0x485e46){return function(_0x314c53){if(!_0x314c53){_0x1c7501[_0x1c3b('0x29')](0x194);}return _0x314c53;};}function handleError(_0x183d21,_0x463ab4){_0x463ab4=_0x463ab4||0x1f4;return function(_0x4de0ff){logger[_0x1c3b('0x22')](_0x4de0ff[_0x1c3b('0x3a')]);if(_0x4de0ff['name']){delete _0x4de0ff['name'];}_0x183d21[_0x1c3b('0x2a')](_0x463ab4)[_0x1c3b('0x3b')](_0x4de0ff);};}exports['index']=function(_0x49c84f,_0x19da90){var _0x42dd4b={'include':[{'model':db['Pause'],'as':_0x1c3b('0x3c')}]},_0x3a68e2={},_0x4e6be8={'count':0x0,'rows':[]};var _0x41494b=_['map'](db[_0x1c3b('0x3d')][_0x1c3b('0x3e')],function(_0x2f8ded){return{'name':_0x2f8ded[_0x1c3b('0x3f')],'type':_0x2f8ded[_0x1c3b('0x40')][_0x1c3b('0x41')]};});_0x3a68e2[_0x1c3b('0x42')]=_[_0x1c3b('0x43')](_0x41494b,'name');_0x3a68e2[_0x1c3b('0x44')]=_[_0x1c3b('0x45')](_0x49c84f['query']);_0x3a68e2[_0x1c3b('0x46')]=_[_0x1c3b('0x47')](_0x3a68e2[_0x1c3b('0x42')],_0x3a68e2['query']);_0x42dd4b[_0x1c3b('0x48')]=_['intersection'](_0x3a68e2['model'],qs[_0x1c3b('0x49')](_0x49c84f[_0x1c3b('0x44')]['fields']));_0x42dd4b[_0x1c3b('0x48')]=_0x42dd4b[_0x1c3b('0x48')]['length']?_0x42dd4b[_0x1c3b('0x48')]:_0x3a68e2[_0x1c3b('0x42')];if(!_0x49c84f[_0x1c3b('0x44')][_0x1c3b('0x4a')](_0x1c3b('0x4b'))){_0x42dd4b[_0x1c3b('0x2d')]=qs[_0x1c3b('0x2d')](_0x49c84f[_0x1c3b('0x44')][_0x1c3b('0x2d')]);_0x42dd4b[_0x1c3b('0x2c')]=qs[_0x1c3b('0x2c')](_0x49c84f[_0x1c3b('0x44')][_0x1c3b('0x2c')]);}_0x42dd4b['order']=qs[_0x1c3b('0x4c')](_0x49c84f['query'][_0x1c3b('0x4c')]);_0x42dd4b[_0x1c3b('0x4d')]=qs[_0x1c3b('0x46')](_['pick'](_0x49c84f[_0x1c3b('0x44')],_0x3a68e2[_0x1c3b('0x46')]),_0x41494b);if(_0x49c84f['query'][_0x1c3b('0x4e')]){_0x42dd4b[_0x1c3b('0x4d')]=_['merge'](_0x42dd4b[_0x1c3b('0x4d')],{'$or':_['map'](_0x41494b,function(_0xb9990f){if(_0xb9990f[_0x1c3b('0x40')]!=='VIRTUAL'){var _0x5cf17a={};_0x5cf17a[_0xb9990f[_0x1c3b('0x4f')]]={'$like':'%'+_0x49c84f[_0x1c3b('0x44')][_0x1c3b('0x4e')]+'%'};return _0x5cf17a;}})});}_0x42dd4b=_['merge']({},_0x42dd4b,_0x49c84f[_0x1c3b('0x50')]);var _0x2e323a={'where':_0x42dd4b[_0x1c3b('0x4d')]};return db[_0x1c3b('0x3d')][_0x1c3b('0x2e')](_0x2e323a)[_0x1c3b('0x36')](function(_0x49d6e5){_0x4e6be8[_0x1c3b('0x2e')]=_0x49d6e5;if(_0x49c84f['query'][_0x1c3b('0x51')]){_0x42dd4b[_0x1c3b('0x52')]=[{'all':!![]}];}return db[_0x1c3b('0x3d')][_0x1c3b('0x53')](_0x42dd4b);})['then'](function(_0x11e95a){_0x4e6be8['rows']=_0x11e95a;return _0x4e6be8;})[_0x1c3b('0x36')](respondWithFilteredResult(_0x19da90,_0x42dd4b))[_0x1c3b('0x28')](handleError(_0x19da90,null));};exports[_0x1c3b('0x54')]=function(_0x5a926b,_0x2e9ca3){var _0x26cd22={'raw':![],'where':{'id':_0x5a926b[_0x1c3b('0x55')]['id']},'include':[{'model':db[_0x1c3b('0x56')],'as':'mandatoryDispositionPause'}]},_0x1a32e1={};_0x1a32e1[_0x1c3b('0x42')]=_[_0x1c3b('0x45')](db['OpenchannelAccount'][_0x1c3b('0x3e')]);_0x1a32e1[_0x1c3b('0x44')]=_[_0x1c3b('0x45')](_0x5a926b[_0x1c3b('0x44')]);_0x1a32e1[_0x1c3b('0x46')]=_[_0x1c3b('0x47')](_0x1a32e1[_0x1c3b('0x42')],_0x1a32e1[_0x1c3b('0x44')]);_0x26cd22[_0x1c3b('0x48')]=_[_0x1c3b('0x47')](_0x1a32e1[_0x1c3b('0x42')],qs['fields'](_0x5a926b[_0x1c3b('0x44')]['fields']));_0x26cd22[_0x1c3b('0x48')]=_0x26cd22['attributes'][_0x1c3b('0x57')]?_0x26cd22[_0x1c3b('0x48')]:_0x1a32e1[_0x1c3b('0x42')];if(_0x5a926b[_0x1c3b('0x44')]['includeAll']){_0x26cd22[_0x1c3b('0x52')]=[{'all':!![]}];}_0x26cd22=_[_0x1c3b('0x58')]({},_0x26cd22,_0x5a926b[_0x1c3b('0x50')]);return db['OpenchannelAccount'][_0x1c3b('0x59')](_0x26cd22)[_0x1c3b('0x36')](handleEntityNotFound(_0x2e9ca3,null))[_0x1c3b('0x36')](respondWithResult(_0x2e9ca3,null))[_0x1c3b('0x28')](handleError(_0x2e9ca3,null));};exports[_0x1c3b('0x5a')]=function(_0x119597,_0x1e358d){return db[_0x1c3b('0x3d')][_0x1c3b('0x5a')](_0x119597[_0x1c3b('0x5b')],{})['then'](function(_0x17f203){var _0x3e915a=_0x119597[_0x1c3b('0x5c')][_0x1c3b('0x37')]({'plain':!![]});if(!_0x3e915a)throw new Error(_0x1c3b('0x5d'));if(_0x3e915a[_0x1c3b('0x5e')]===_0x1c3b('0x5c')){var _0x38a556=_0x17f203[_0x1c3b('0x37')]({'plain':!![]});var _0x21abdb='OpenchannelAccounts';return db[_0x1c3b('0x5f')][_0x1c3b('0x59')]({'where':{'name':_0x21abdb,'userProfileId':_0x3e915a['userProfileId']},'raw':!![]})['then'](function(_0x30d856){if(_0x30d856&&_0x30d856[_0x1c3b('0x60')]===0x0){return db[_0x1c3b('0x61')][_0x1c3b('0x5a')]({'name':_0x38a556[_0x1c3b('0x4f')],'resourceId':_0x38a556['id'],'type':_0x30d856[_0x1c3b('0x4f')],'sectionId':_0x30d856['id']},{})[_0x1c3b('0x36')](function(){return _0x17f203;});}else{return _0x17f203;}})[_0x1c3b('0x28')](function(_0x5c1b1b){logger[_0x1c3b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c1b1b);throw _0x5c1b1b;});}return _0x17f203;})[_0x1c3b('0x36')](respondWithResult(_0x1e358d,0xc9))[_0x1c3b('0x28')](handleError(_0x1e358d,null));};exports[_0x1c3b('0x34')]=function(_0x417323,_0x530102){if(_0x417323[_0x1c3b('0x5b')]['id']){delete _0x417323['body']['id'];}return db[_0x1c3b('0x3d')]['find']({'where':{'id':_0x417323[_0x1c3b('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x1c3b('0x3c')}]})[_0x1c3b('0x36')](handleEntityNotFound(_0x530102,null))['then'](saveUpdates(_0x417323[_0x1c3b('0x5b')],null))[_0x1c3b('0x36')](respondWithResult(_0x530102,null))['catch'](handleError(_0x530102,null));};exports[_0x1c3b('0x35')]=function(_0x3b76f2,_0x5d8664){return db[_0x1c3b('0x3d')][_0x1c3b('0x59')]({'where':{'id':_0x3b76f2[_0x1c3b('0x55')]['id']}})[_0x1c3b('0x36')](handleEntityNotFound(_0x5d8664,null))[_0x1c3b('0x36')](removeEntity(_0x5d8664,null))['catch'](handleError(_0x5d8664,null));};exports['describe']=function(_0x332448,_0x20e95a){return db[_0x1c3b('0x3d')][_0x1c3b('0x62')]()[_0x1c3b('0x36')](respondWithResult(_0x20e95a,null))[_0x1c3b('0x28')](handleError(_0x20e95a,null));};exports[_0x1c3b('0x63')]=function(_0x7f00ba,_0x55878a,_0x58e750){if(_0x7f00ba[_0x1c3b('0x5b')]['id']){delete _0x7f00ba['body']['id'];}return db[_0x1c3b('0x3d')]['find']({'where':{'id':_0x7f00ba[_0x1c3b('0x55')]['id']}})[_0x1c3b('0x36')](handleEntityNotFound(_0x55878a,null))['then'](function(_0x4f9bbb){if(_0x4f9bbb){_0x7f00ba[_0x1c3b('0x5b')][_0x1c3b('0x64')]=_0x4f9bbb['id'];return db[_0x1c3b('0x65')]['create'](_0x7f00ba['body']);}})[_0x1c3b('0x36')](respondWithResult(_0x55878a,null))[_0x1c3b('0x28')](handleError(_0x55878a,null));};exports[_0x1c3b('0x66')]=function(_0x506266,_0x44ae12,_0x83d07a){var _0x3cb6a5={'raw':![],'where':{}};var _0x3c434f={};var _0x59075b={'count':0x0,'rows':[]};return db[_0x1c3b('0x3d')][_0x1c3b('0x67')]({'where':{'id':_0x506266['params']['id']}})[_0x1c3b('0x36')](handleEntityNotFound(_0x44ae12,null))[_0x1c3b('0x36')](function(_0xdce05){if(_0xdce05){_0x3c434f['model']=_[_0x1c3b('0x45')](db[_0x1c3b('0x65')][_0x1c3b('0x3e')]);_0x3c434f['query']=_[_0x1c3b('0x45')](_0x506266[_0x1c3b('0x44')]);_0x3c434f[_0x1c3b('0x46')]=_[_0x1c3b('0x47')](_0x3c434f[_0x1c3b('0x42')],_0x3c434f[_0x1c3b('0x44')]);_0x3cb6a5['attributes']=_[_0x1c3b('0x47')](_0x3c434f[_0x1c3b('0x42')],qs[_0x1c3b('0x49')](_0x506266['query']['fields']));_0x3cb6a5[_0x1c3b('0x48')]=_0x3cb6a5[_0x1c3b('0x48')][_0x1c3b('0x57')]?_0x3cb6a5[_0x1c3b('0x48')]:_0x3c434f['model'];if(!_0x506266[_0x1c3b('0x44')][_0x1c3b('0x4a')](_0x1c3b('0x4b'))){_0x3cb6a5[_0x1c3b('0x2d')]=qs[_0x1c3b('0x2d')](_0x506266[_0x1c3b('0x44')]['limit']);_0x3cb6a5[_0x1c3b('0x2c')]=qs[_0x1c3b('0x2c')](_0x506266[_0x1c3b('0x44')][_0x1c3b('0x2c')]);}_0x3cb6a5[_0x1c3b('0x68')]=qs[_0x1c3b('0x4c')](_0x506266[_0x1c3b('0x44')]['sort']);_0x3cb6a5[_0x1c3b('0x4d')]=qs[_0x1c3b('0x46')](_[_0x1c3b('0x69')](_0x506266[_0x1c3b('0x44')],_0x3c434f['filters']));_0x3cb6a5[_0x1c3b('0x4d')][_0x1c3b('0x64')]=_0xdce05['id'];if(_0x506266['query'][_0x1c3b('0x4e')]){_0x3cb6a5[_0x1c3b('0x4d')]=_[_0x1c3b('0x58')](_0x3cb6a5[_0x1c3b('0x4d')],{'$or':_['map'](_0x3cb6a5['attributes'],function(_0xd35b25){var _0x3f8400={};_0x3f8400[_0xd35b25]={'$like':'%'+_0x506266['query']['filter']+'%'};return _0x3f8400;})});}_0x3cb6a5=_[_0x1c3b('0x58')]({},_0x3cb6a5,_0x506266[_0x1c3b('0x50')]);return db[_0x1c3b('0x65')][_0x1c3b('0x2e')]({'where':_0x3cb6a5['where']})[_0x1c3b('0x36')](function(_0x320404){_0x59075b[_0x1c3b('0x2e')]=_0x320404;if(_0x506266[_0x1c3b('0x44')][_0x1c3b('0x51')]){_0x3cb6a5['include']=[{'all':!![]}];}return db[_0x1c3b('0x65')][_0x1c3b('0x53')](_0x3cb6a5);})[_0x1c3b('0x36')](function(_0x1fa6b7){_0x59075b[_0x1c3b('0x6a')]=_0x1fa6b7;return _0x59075b;});}})['then'](respondWithFilteredResult(_0x44ae12,_0x3cb6a5))['catch'](handleError(_0x44ae12,null));};exports[_0x1c3b('0x6b')]=function(_0x4603a1,_0x4de3f4,_0x46653a){return db[_0x1c3b('0x3d')]['find']({'where':{'id':_0x4603a1['params']['id']}})[_0x1c3b('0x36')](handleEntityNotFound(_0x4de3f4,null))[_0x1c3b('0x36')](function(_0x4272f6){if(_0x4272f6){return _0x4272f6[_0x1c3b('0x6b')](_0x4603a1['query'][_0x1c3b('0x6c')]);}})[_0x1c3b('0x36')](respondWithStatusCode(_0x4de3f4,null))[_0x1c3b('0x28')](handleError(_0x4de3f4,null));};exports[_0x1c3b('0x6d')]=function(_0x5be6c6,_0x4ede14,_0x21028f){if(_0x5be6c6[_0x1c3b('0x5b')]['id']){delete _0x5be6c6['body']['id'];}return db['OpenchannelAccount'][_0x1c3b('0x59')]({'where':{'id':_0x5be6c6[_0x1c3b('0x55')]['id']}})[_0x1c3b('0x36')](handleEntityNotFound(_0x4ede14,null))['then'](function(_0x16e52f){if(_0x16e52f){_0x5be6c6[_0x1c3b('0x5b')][_0x1c3b('0x64')]=_0x16e52f['id'];return db[_0x1c3b('0x6e')]['create'](_0x5be6c6['body']);}})[_0x1c3b('0x36')](respondWithResult(_0x4ede14,null))['catch'](handleError(_0x4ede14,null));};exports[_0x1c3b('0x6f')]=function(_0x3b166f,_0x76c9ba,_0x138cae){var _0x507289={'raw':![],'where':{}};var _0x504bf9={};var _0xc7362d={'count':0x0,'rows':[]};return db[_0x1c3b('0x3d')][_0x1c3b('0x67')]({'where':{'id':_0x3b166f[_0x1c3b('0x55')]['id']}})['then'](handleEntityNotFound(_0x76c9ba,null))[_0x1c3b('0x36')](function(_0x40daac){if(_0x40daac){_0x504bf9['model']=_[_0x1c3b('0x45')](db[_0x1c3b('0x6e')][_0x1c3b('0x3e')]);_0x504bf9[_0x1c3b('0x44')]=_[_0x1c3b('0x45')](_0x3b166f[_0x1c3b('0x44')]);_0x504bf9['filters']=_[_0x1c3b('0x47')](_0x504bf9['model'],_0x504bf9[_0x1c3b('0x44')]);_0x507289[_0x1c3b('0x48')]=_[_0x1c3b('0x47')](_0x504bf9[_0x1c3b('0x42')],qs[_0x1c3b('0x49')](_0x3b166f[_0x1c3b('0x44')][_0x1c3b('0x49')]));_0x507289['attributes']=_0x507289[_0x1c3b('0x48')][_0x1c3b('0x57')]?_0x507289[_0x1c3b('0x48')]:_0x504bf9[_0x1c3b('0x42')];if(!_0x3b166f['query'][_0x1c3b('0x4a')]('nolimit')){_0x507289[_0x1c3b('0x2d')]=qs[_0x1c3b('0x2d')](_0x3b166f[_0x1c3b('0x44')][_0x1c3b('0x2d')]);_0x507289[_0x1c3b('0x2c')]=qs[_0x1c3b('0x2c')](_0x3b166f[_0x1c3b('0x44')][_0x1c3b('0x2c')]);}_0x507289['order']=qs[_0x1c3b('0x4c')](_0x3b166f[_0x1c3b('0x44')][_0x1c3b('0x4c')]);_0x507289['where']=qs['filters'](_['pick'](_0x3b166f[_0x1c3b('0x44')],_0x504bf9[_0x1c3b('0x46')]));_0x507289['where'][_0x1c3b('0x64')]=_0x40daac['id'];if(_0x3b166f[_0x1c3b('0x44')][_0x1c3b('0x4e')]){_0x507289[_0x1c3b('0x4d')]=_[_0x1c3b('0x58')](_0x507289[_0x1c3b('0x4d')],{'$or':_[_0x1c3b('0x43')](_0x507289[_0x1c3b('0x48')],function(_0x3584ac){var _0x85f9d0={};_0x85f9d0[_0x3584ac]={'$like':'%'+_0x3b166f[_0x1c3b('0x44')]['filter']+'%'};return _0x85f9d0;})});}_0x507289=_[_0x1c3b('0x58')]({},_0x507289,_0x3b166f[_0x1c3b('0x50')]);return db[_0x1c3b('0x6e')][_0x1c3b('0x2e')]({'where':_0x507289[_0x1c3b('0x4d')]})['then'](function(_0x2ef488){_0xc7362d[_0x1c3b('0x2e')]=_0x2ef488;if(_0x3b166f['query'][_0x1c3b('0x51')]){_0x507289[_0x1c3b('0x52')]=[{'all':!![]}];}return db[_0x1c3b('0x6e')][_0x1c3b('0x53')](_0x507289);})[_0x1c3b('0x36')](function(_0x1f6cb0){_0xc7362d[_0x1c3b('0x6a')]=_0x1f6cb0;return _0xc7362d;});}})[_0x1c3b('0x36')](respondWithFilteredResult(_0x76c9ba,_0x507289))[_0x1c3b('0x28')](handleError(_0x76c9ba,null));};exports[_0x1c3b('0x70')]=function(_0x75f8da,_0x223035,_0xc5daf){return db['OpenchannelAccount']['find']({'where':{'id':_0x75f8da[_0x1c3b('0x55')]['id']}})['then'](handleEntityNotFound(_0x223035,null))[_0x1c3b('0x36')](function(_0x5ac743){if(_0x5ac743){return _0x5ac743[_0x1c3b('0x70')](_0x75f8da[_0x1c3b('0x44')][_0x1c3b('0x6c')]);}})[_0x1c3b('0x36')](respondWithStatusCode(_0x223035,null))[_0x1c3b('0x28')](handleError(_0x223035,null));};exports[_0x1c3b('0x71')]=function(_0x1f2290,_0x2e5158,_0x4a0add){var _0x4d2532={'body':_0x1f2290[_0x1c3b('0x5b')],'channel':'openchannel'};var _0x55e8dd=[];var _0x1bffc4=[];var _0x419223={};var _0x17a88f=![];return db[_0x1c3b('0x72')][_0x1c3b('0x62')]()['then'](function(_0x28ade2){if(!_0x28ade2){throw new db[(_0x1c3b('0x73'))]['ValidationError'](_0x1c3b('0x74'));}_0x55e8dd=_[_0x1c3b('0x75')](_[_0x1c3b('0x45')](_0x28ade2),[_0x1c3b('0x76'),'updatedAt']);_0x1bffc4=_['difference'](_['keys'](_0x28ade2),[_0x1c3b('0x76'),_0x1c3b('0x77'),_0x1c3b('0x78'),_0x1c3b('0x79')]);if(_0x1f2290[_0x1c3b('0x5b')]['id']){delete _0x1f2290[_0x1c3b('0x5b')]['id'];}if(_[_0x1c3b('0x7a')](_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x7b')])){throw new db[(_0x1c3b('0x73'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x1c3b('0x7a')](_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x5b')])||_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x5b')]===''){throw new db[(_0x1c3b('0x73'))][(_0x1c3b('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1c3b('0x7a')](_0x1f2290[_0x1c3b('0x5b')]['mapKey'])){throw new db[(_0x1c3b('0x73'))][(_0x1c3b('0x7c'))](_0x1c3b('0x7d')+_0x1bffc4);}if(!_['includes'](_0x1bffc4,_0x1f2290[_0x1c3b('0x5b')]['mapKey'])){throw new db[(_0x1c3b('0x73'))][(_0x1c3b('0x7c'))](_0x1c3b('0x7e')+_0x1bffc4);}_0x419223[_0x1f2290[_0x1c3b('0x5b')]['mapKey']]=_0x1f2290[_0x1c3b('0x5b')]['from'];})[_0x1c3b('0x36')](function(){return db[_0x1c3b('0x3d')][_0x1c3b('0x59')]({'where':{'id':_0x1f2290[_0x1c3b('0x55')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x1c3b('0x72')],'as':_0x1c3b('0x7f'),'where':_0x419223,'limit':0x1,'order':[[_0x1c3b('0x77'),_0x1c3b('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':_0x1c3b('0x81')}]});})[_0x1c3b('0x36')](handleEntityNotFound(_0x2e5158,null))[_0x1c3b('0x36')](function(_0xeb9231){if(_0xeb9231&&_0xeb9231[_0x1c3b('0x82')]){_0x4d2532['account']=_0xeb9231;_0x4d2532['applications']=_0xeb9231[_0x1c3b('0x81')];_0x4d2532[_0x1c3b('0x83')]=_0xeb9231['List'];_0x4d2532[_0x1c3b('0x84')]=_['orderBy'](_0x4d2532[_0x1c3b('0x84')],[_0x1c3b('0x85')],[_0x1c3b('0x86')]);if(_0x4d2532[_0x1c3b('0x87')][_0x1c3b('0x81')]){delete _0x4d2532[_0x1c3b('0x87')][_0x1c3b('0x81')];}if(_0x4d2532[_0x1c3b('0x87')][_0x1c3b('0x82')]&&_0x4d2532['account'][_0x1c3b('0x82')][_0x1c3b('0x7f')][_0x1c3b('0x57')]){return _0x4d2532[_0x1c3b('0x87')][_0x1c3b('0x82')][_0x1c3b('0x7f')][0x0];}var _0x3a28b8=_['defaults'](_0x1f2290[_0x1c3b('0x5b')],{'firstName':_0x1f2290['body'][_0x1c3b('0x7b')],'ListId':_0xeb9231[_0x1c3b('0x79')]});_0x3a28b8[_0x1f2290['body'][_0x1c3b('0x88')]]=_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x7b')];return db['CmContact'][_0x1c3b('0x5a')](_0x3a28b8,{'fields':_0x55e8dd,'raw':!![]});}})[_0x1c3b('0x36')](handleEntityNotFound(_0x2e5158,null))[_0x1c3b('0x36')](function(_0x16f93c){_0x4d2532['contact']=_0x16f93c;if(_0x16f93c){var _0x2a145f={'ContactId':_0x16f93c['id'],'OpenchannelAccountId':_0x1f2290['params']['id'],'from':(_0x16f93c[_0x1c3b('0x89')]||'')+'\x20'+(_0x16f93c[_0x1c3b('0x8a')]||'')};var _0x1eff0d={'OpenchannelAccountId':_0x1f2290[_0x1c3b('0x55')]['id'],'closed':![]};if(_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x8b')]){_0x1eff0d[_0x1c3b('0x8b')]=_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x8b')];return db['OpenchannelInteraction'][_0x1c3b('0x59')]({'where':_0x1eff0d})[_0x1c3b('0x36')](function(_0x50ad21){if(_0x50ad21){return[_0x50ad21,![]];}_0x2a145f['threadId']=_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x8b')];_0x2a145f[_0x1c3b('0x8c')]=_0x1f2290['body'][_0x1c3b('0x8c')];return db['OpenchannelInteraction'][_0x1c3b('0x5a')](_0x2a145f)[_0x1c3b('0x36')](function(_0x4d1c04){return[_0x4d1c04,!![]];});});}else{_0x1eff0d[_0x1c3b('0x8b')]=null;}_0x1eff0d[_0x1c3b('0x8d')]=_0x16f93c['id'];return db['OpenchannelInteraction']['find']({'where':_0x1eff0d})[_0x1c3b('0x36')](function(_0x3c19d4){if(_0x3c19d4){return[_0x3c19d4,![]];}return db[_0x1c3b('0x8e')]['create'](_0x2a145f)[_0x1c3b('0x36')](function(_0x41543c){return[_0x41543c,!![]];});});}})[_0x1c3b('0x8f')](function(_0x1fa936,_0x4b7b1c){if(_0x1fa936){_0x17a88f=_0x4b7b1c;if(!_0x4b7b1c){var _0x2699ac={'from':(_0x4d2532[_0x1c3b('0x90')][_0x1c3b('0x89')]||'')+'\x20'+(_0x4d2532[_0x1c3b('0x90')][_0x1c3b('0x8a')]||'')};if(_0x1f2290['body'][_0x1c3b('0x8b')]&&_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x91')]&&_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x8b')]!=_0x1f2290['body'][_0x1c3b('0x91')]){_0x2699ac[_0x1c3b('0x8b')]=_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x91')];}return _0x1fa936[_0x1c3b('0x34')](_0x2699ac);}else{return _0x1fa936;}}})['then'](function(_0x1ca090){_0x4d2532['interaction']=_0x1ca090[_0x1c3b('0x37')]({'plain':!![]});_0x4d2532[_0x1c3b('0x92')][_0x1c3b('0x93')]=_0x17a88f;if(_0x4d2532['interaction'][_0x1c3b('0x93')]){if(_0x4d2532['account']['autoclose']){_0x4d2532[_0x1c3b('0x84')][_0x1c3b('0x94')]({'id':0x0,'priority':_0x4d2532[_0x1c3b('0x84')][_0x1c3b('0x57')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x1c3b('0x95')});}}return db[_0x1c3b('0x96')][_0x1c3b('0x5a')]({'body':_0x1f2290['body'][_0x1c3b('0x5b')],'OpenchannelAccountId':_0x1f2290[_0x1c3b('0x55')]['id'],'OpenchannelInteractionId':_0x1ca090['id'],'direction':'in','ContactId':_0x4d2532[_0x1c3b('0x90')]['id'],'AttachmentId':_0x1f2290[_0x1c3b('0x5b')][_0x1c3b('0x97')]});})[_0x1c3b('0x36')](function(_0x13546c){_0x4d2532[_0x1c3b('0x25')]=_0x13546c;if(_0x4d2532[_0x1c3b('0x92')][_0x1c3b('0x98')]){return db['User']['find']({'attributes':['id',_0x1c3b('0x4f')],'where':{'id':_0x4d2532[_0x1c3b('0x92')][_0x1c3b('0x98')]}})[_0x1c3b('0x36')](function(_0x1ea554){if(_0x1ea554){_0x4d2532[_0x1c3b('0x84')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1c3b('0x99'),'appdata':_0x1ea554[_0x1c3b('0x4f')]+','+(_0x4d2532[_0x1c3b('0x87')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x4d2532['forcedOwnership']=![];}return respondWithRpcPromise(_0x1c3b('0x9a'),'startRouting',_0x4d2532);});}return respondWithRpcPromise('Start',_0x1c3b('0x9b'),_0x4d2532);})['then'](function(_0x478aa0){respondWithRpcPromise(_0x1c3b('0x9c'),_0x1c3b('0x9c'),{'event':_0x1c3b('0x71'),'message':_0x478aa0},client9002);return _0x478aa0;})['then'](respondWithResult(_0x2e5158,null))[_0x1c3b('0x28')](handleError(_0x2e5158,null));};exports[_0x1c3b('0x9d')]=function(_0x1c55a9,_0x11f0d9,_0x5dd3f9){return db[_0x1c3b('0x3d')]['findOne']({'where':{'id':_0x1c55a9[_0x1c3b('0x55')]['id']}})[_0x1c3b('0x36')](handleEntityNotFound(_0x11f0d9,null))['then'](function(_0x5e6408){if(_0x5e6408){return db[_0x1c3b('0x9e')][_0x1c3b('0x9f')](function(_0x2c2c61){return db['OpenchannelApplication']['destroy']({'where':{'OpenchannelAccountId':_0x1c55a9['params']['id']},'transaction':_0x2c2c61})['then'](function(_0x276ea0){var _0x1ae9c6=_['map'](_0x1c55a9['body'],function(_0x446185){_0x446185[_0x1c3b('0x64')]=_0x1c55a9[_0x1c3b('0x55')]['id'];return _0x446185;});return db[_0x1c3b('0xa0')][_0x1c3b('0xa1')](_0x1ae9c6,{'transaction':_0x2c2c61});});})[_0x1c3b('0x36')](function(){return db[_0x1c3b('0xa0')][_0x1c3b('0xa2')]({'where':{'OpenchannelAccountId':_0x1c55a9[_0x1c3b('0x55')]['id']},'order':_0x1c3b('0x85')});});}})[_0x1c3b('0x36')](respondWithResult(_0x11f0d9,null))[_0x1c3b('0x28')](handleError(_0x11f0d9,null));};exports[_0x1c3b('0xa3')]=function(_0x210044,_0x522a48,_0x21caee){var _0x2e7d75={};var _0x550d00={};var _0xc66271;var _0x2ece82;return db['OpenchannelAccount'][_0x1c3b('0x67')]({'where':{'id':_0x210044[_0x1c3b('0x55')]['id']}})[_0x1c3b('0x36')](handleEntityNotFound(_0x522a48,null))[_0x1c3b('0x36')](function(_0x5dce62){if(_0x5dce62){_0xc66271=_0x5dce62;_0x550d00[_0x1c3b('0x42')]=_[_0x1c3b('0x45')](db[_0x1c3b('0xa0')][_0x1c3b('0x3e')]);_0x550d00[_0x1c3b('0x44')]=_[_0x1c3b('0x45')](_0x210044[_0x1c3b('0x44')]);_0x550d00['filters']=_['intersection'](_0x550d00['model'],_0x550d00[_0x1c3b('0x44')]);_0x2e7d75[_0x1c3b('0x48')]=_[_0x1c3b('0x47')](_0x550d00[_0x1c3b('0x42')],qs[_0x1c3b('0x49')](_0x210044['query'][_0x1c3b('0x49')]));_0x2e7d75['attributes']=_0x2e7d75[_0x1c3b('0x48')]['length']?_0x2e7d75[_0x1c3b('0x48')]:_0x550d00['model'];_0x2e7d75[_0x1c3b('0x68')]=qs['sort'](_0x210044['query'][_0x1c3b('0x4c')]);_0x2e7d75['where']=qs[_0x1c3b('0x46')](_[_0x1c3b('0x69')](_0x210044['query'],_0x550d00[_0x1c3b('0x46')]));if(_0x210044[_0x1c3b('0x44')][_0x1c3b('0x4e')]){_0x2e7d75['where']=_[_0x1c3b('0x58')](_0x2e7d75[_0x1c3b('0x4d')],{'$or':_[_0x1c3b('0x43')](_0x2e7d75[_0x1c3b('0x48')],function(_0xb16183){var _0xf5ef12={};_0xf5ef12[_0xb16183]={'$like':'%'+_0x210044[_0x1c3b('0x44')]['filter']+'%'};return _0xf5ef12;})});}_0x2e7d75=_[_0x1c3b('0x58')]({},_0x2e7d75,_0x210044[_0x1c3b('0x50')]);return _0xc66271[_0x1c3b('0xa3')](_0x2e7d75);}})[_0x1c3b('0x36')](function(_0x5bf6fb){if(_0x5bf6fb){_0x2ece82=_0x5bf6fb['length'];if(!_0x210044[_0x1c3b('0x44')][_0x1c3b('0x4a')](_0x1c3b('0x4b'))){_0x2e7d75[_0x1c3b('0x2d')]=qs[_0x1c3b('0x2d')](_0x210044[_0x1c3b('0x44')][_0x1c3b('0x2d')]);_0x2e7d75[_0x1c3b('0x2c')]=qs[_0x1c3b('0x2c')](_0x210044[_0x1c3b('0x44')][_0x1c3b('0x2c')]);}return _0xc66271['getApplications'](_0x2e7d75);}})[_0x1c3b('0x36')](function(_0x303e53){if(_0x303e53){return _0x303e53?{'count':_0x2ece82,'rows':_0x303e53}:null;}})[_0x1c3b('0x36')](respondWithResult(_0x522a48,null))[_0x1c3b('0x28')](handleError(_0x522a48,null));};exports['getInteractions']=function(_0x35ae36,_0x25aaab,_0x3473d3){var _0x3f541c={'raw':![],'where':{}};var _0xa8b455={};var _0x50d630={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x35ae36[_0x1c3b('0x55')]['id']}})['then'](handleEntityNotFound(_0x25aaab,null))[_0x1c3b('0x36')](function(_0x4a5a04){if(_0x4a5a04){_0xa8b455['model']=_[_0x1c3b('0x45')](db[_0x1c3b('0x8e')]['rawAttributes']);_0xa8b455['query']=_[_0x1c3b('0x45')](_0x35ae36['query']);_0xa8b455[_0x1c3b('0x46')]=_[_0x1c3b('0x47')](_0xa8b455['model'],_0xa8b455[_0x1c3b('0x44')]);_0x3f541c[_0x1c3b('0x48')]=_[_0x1c3b('0x47')](_0xa8b455[_0x1c3b('0x42')],qs['fields'](_0x35ae36['query'][_0x1c3b('0x49')]));_0x3f541c[_0x1c3b('0x48')]=_0x3f541c[_0x1c3b('0x48')][_0x1c3b('0x57')]?_0x3f541c[_0x1c3b('0x48')]:_0xa8b455[_0x1c3b('0x42')];if(!_0x35ae36[_0x1c3b('0x44')][_0x1c3b('0x4a')]('nolimit')){_0x3f541c['limit']=qs[_0x1c3b('0x2d')](_0x35ae36[_0x1c3b('0x44')]['limit']);_0x3f541c[_0x1c3b('0x2c')]=qs['offset'](_0x35ae36[_0x1c3b('0x44')][_0x1c3b('0x2c')]);}_0x3f541c[_0x1c3b('0x68')]=qs[_0x1c3b('0x4c')](_0x35ae36[_0x1c3b('0x44')]['sort']);_0x3f541c[_0x1c3b('0x4d')]=qs[_0x1c3b('0x46')](_[_0x1c3b('0x69')](_0x35ae36[_0x1c3b('0x44')],_0xa8b455[_0x1c3b('0x46')]));_0x3f541c['where'][_0x1c3b('0x64')]=_0x4a5a04['id'];if(_0x35ae36[_0x1c3b('0x44')][_0x1c3b('0x4e')]){_0x3f541c['where']=_[_0x1c3b('0x58')](_0x3f541c[_0x1c3b('0x4d')],{'$or':_['map'](_0x3f541c[_0x1c3b('0x48')],function(_0x20a337){var _0x338ae3={};_0x338ae3[_0x20a337]={'$like':'%'+_0x35ae36[_0x1c3b('0x44')]['filter']+'%'};return _0x338ae3;})});}_0x3f541c=_[_0x1c3b('0x58')]({},_0x3f541c,_0x35ae36[_0x1c3b('0x50')]);return db[_0x1c3b('0x8e')][_0x1c3b('0x2e')]({'where':_0x3f541c['where']})['then'](function(_0x3a0d22){_0x50d630['count']=_0x3a0d22;if(_0x35ae36[_0x1c3b('0x44')][_0x1c3b('0x51')]){_0x3f541c[_0x1c3b('0x52')]=[{'model':db['CmContact'],'as':_0x1c3b('0xa4'),'required':![]},{'model':db[_0x1c3b('0xa5')],'as':_0x1c3b('0xa6'),'attributes':[_0x1c3b('0x4f'),'fullname','internal'],'required':![]},{'model':db[_0x1c3b('0xa7')],'as':'Tags','attributes':['id',_0x1c3b('0x4f'),_0x1c3b('0xa8')],'where':_0x35ae36['query'][_0x1c3b('0xa9')]?{'id':_0x35ae36[_0x1c3b('0x44')][_0x1c3b('0xa9')]}:undefined,'required':_0x35ae36[_0x1c3b('0x44')]['tag']?!![]:![]}];}return db[_0x1c3b('0x8e')][_0x1c3b('0x53')](_0x3f541c);})[_0x1c3b('0x36')](function(_0x366d1e){_0x50d630[_0x1c3b('0x6a')]=_0x366d1e;return _0x50d630;});}})[_0x1c3b('0x36')](respondWithFilteredResult(_0x25aaab,_0x3f541c))[_0x1c3b('0x28')](handleError(_0x25aaab,null));};exports[_0x1c3b('0xaa')]=function(_0x48ca7d,_0x1816cb,_0x76ca61){return db[_0x1c3b('0x3d')][_0x1c3b('0x59')]({'where':{'id':_0x48ca7d['params']['id']}})[_0x1c3b('0x36')](handleEntityNotFound(_0x1816cb,null))['then'](function(_0x482c84){if(_0x482c84){return _0x482c84[_0x1c3b('0xaa')](_0x48ca7d['body']['ids'],_['omit'](_0x48ca7d['body'],['ids','id'])||{})[_0x1c3b('0x8f')](function(_0x45b95a){for(var _0x412694=0x0;_0x412694<_0x48ca7d['body'][_0x1c3b('0x6c')][_0x1c3b('0x57')];_0x412694+=0x1){socket[_0x1c3b('0xab')](_0x1c3b('0xac'),{'UserId':Number(_0x48ca7d['body'][_0x1c3b('0x6c')][_0x412694]),'OpenchannelAccountId':Number(_0x48ca7d[_0x1c3b('0x55')]['id'])});}return _0x45b95a;});}})['then'](respondWithResult(_0x1816cb,null))[_0x1c3b('0x28')](handleError(_0x1816cb,null));};exports['removeAgents']=function(_0x52a96c,_0x50924c,_0x9e9a31){return db[_0x1c3b('0x3d')][_0x1c3b('0x59')]({'where':{'id':_0x52a96c[_0x1c3b('0x55')]['id']}})['then'](handleEntityNotFound(_0x50924c,null))[_0x1c3b('0x36')](function(_0x4aa75f){if(_0x4aa75f){return _0x4aa75f[_0x1c3b('0xad')](_0x52a96c[_0x1c3b('0x44')][_0x1c3b('0x6c')])[_0x1c3b('0x36')](function(){if(_[_0x1c3b('0xae')](_0x52a96c[_0x1c3b('0x44')][_0x1c3b('0x6c')])){for(var _0x4b51ff=0x0;_0x4b51ff<_0x52a96c[_0x1c3b('0x44')][_0x1c3b('0x6c')][_0x1c3b('0x57')];_0x4b51ff+=0x1){socket[_0x1c3b('0xab')]('userOpenchannelAccount:remove',{'UserId':Number(_0x52a96c[_0x1c3b('0x44')][_0x1c3b('0x6c')][_0x4b51ff]),'OpenchannelAccountId':Number(_0x52a96c['params']['id'])});}}else{socket[_0x1c3b('0xab')](_0x1c3b('0xaf'),{'UserId':Number(_0x52a96c['query'][_0x1c3b('0x6c')]),'OpenchannelAccountId':Number(_0x52a96c['params']['id'])});}});}})[_0x1c3b('0x36')](respondWithStatusCode(_0x50924c,null))[_0x1c3b('0x28')](handleError(_0x50924c,null));};exports[_0x1c3b('0xb0')]=function(_0x1b7ca4,_0x3c268c,_0x144f5b){var _0x23deeb={};var _0x28e8e9={};var _0x4663cc;var _0x1ee0eb;return db[_0x1c3b('0x3d')][_0x1c3b('0x67')]({'where':{'id':_0x1b7ca4[_0x1c3b('0x55')]['id']}})['then'](handleEntityNotFound(_0x3c268c,null))[_0x1c3b('0x36')](function(_0x513ea0){if(_0x513ea0){_0x4663cc=_0x513ea0;_0x28e8e9['model']=_[_0x1c3b('0x45')](db[_0x1c3b('0xa5')][_0x1c3b('0x3e')]);_0x28e8e9['query']=_[_0x1c3b('0x45')](_0x1b7ca4[_0x1c3b('0x44')]);_0x28e8e9[_0x1c3b('0x46')]=_['intersection'](_0x28e8e9['model'],_0x28e8e9[_0x1c3b('0x44')]);_0x23deeb['attributes']=_[_0x1c3b('0x47')](_0x28e8e9['model'],qs[_0x1c3b('0x49')](_0x1b7ca4[_0x1c3b('0x44')][_0x1c3b('0x49')]));_0x23deeb[_0x1c3b('0x48')]=_0x23deeb[_0x1c3b('0x48')]['length']?_0x23deeb['attributes']:_0x28e8e9[_0x1c3b('0x42')];_0x23deeb[_0x1c3b('0x68')]=qs[_0x1c3b('0x4c')](_0x1b7ca4['query'][_0x1c3b('0x4c')]);_0x23deeb[_0x1c3b('0x4d')]=qs['filters'](_[_0x1c3b('0x69')](_0x1b7ca4[_0x1c3b('0x44')],_0x28e8e9[_0x1c3b('0x46')]));if(_0x1b7ca4['query'][_0x1c3b('0x4e')]){_0x23deeb[_0x1c3b('0x4d')]=_[_0x1c3b('0x58')](_0x23deeb[_0x1c3b('0x4d')],{'$or':_[_0x1c3b('0x43')](_0x23deeb[_0x1c3b('0x48')],function(_0x4c7458){var _0x452829={};_0x452829[_0x4c7458]={'$like':'%'+_0x1b7ca4['query'][_0x1c3b('0x4e')]+'%'};return _0x452829;})});}_0x23deeb=_[_0x1c3b('0x58')]({},_0x23deeb,_0x1b7ca4['options']);return _0x4663cc['getAgents'](_0x23deeb);}})['then'](function(_0x3ff5ee){if(_0x3ff5ee){_0x1ee0eb=_0x3ff5ee['length'];if(!_0x1b7ca4[_0x1c3b('0x44')][_0x1c3b('0x4a')](_0x1c3b('0x4b'))){_0x23deeb[_0x1c3b('0x2d')]=qs['limit'](_0x1b7ca4['query']['limit']);_0x23deeb[_0x1c3b('0x2c')]=qs[_0x1c3b('0x2c')](_0x1b7ca4[_0x1c3b('0x44')][_0x1c3b('0x2c')]);}return _0x4663cc['getAgents'](_0x23deeb);}})[_0x1c3b('0x36')](function(_0x4fca7c){if(_0x4fca7c){return _0x4fca7c?{'count':_0x1ee0eb,'rows':_0x4fca7c}:null;}})[_0x1c3b('0x36')](respondWithResult(_0x3c268c,null))[_0x1c3b('0x28')](handleError(_0x3c268c,null));};exports['send']=function(_0x34540d,_0x530a49,_0xfba7e2){var _0x708a72,_0x2325cb,_0x244c43;if(_[_0x1c3b('0x7a')](_0x34540d['body'][_0x1c3b('0x5b')])||_0x34540d['body'][_0x1c3b('0x5b')]===''){throw new db['Sequelize'][(_0x1c3b('0x7c'))](_0x1c3b('0xb1'));}if(_['isNil'](_0x34540d[_0x1c3b('0x5b')]['to'])){}_0x708a72=_0x34540d[_0x1c3b('0x5b')]['to'];return db[_0x1c3b('0x3d')]['findOne']({'where':{'id':_0x34540d[_0x1c3b('0x55')]['id']}})['then'](handleEntityNotFound(_0x530a49,null))[_0x1c3b('0x36')](function(_0x2c1854){if(_0x2c1854){return db[_0x1c3b('0x3d')][_0x1c3b('0x59')]({'where':{'id':_0x2c1854['id']},'include':[{'model':db[_0x1c3b('0xb2')],'as':_0x1c3b('0x82'),'include':[{'model':db['CmContact'],'as':_0x1c3b('0x7f'),'where':{[_0x2c1854['mapKey']]:_0x708a72},'limit':0x1,'order':[['updatedAt',_0x1c3b('0x80')]]}]}]})['then'](handleEntityNotFound(_0x530a49,null))['then'](function(_0x4a2d64){if(_0x4a2d64&&_0x4a2d64['List']){_0x2325cb=_0x4a2d64[_0x1c3b('0x37')]({'plain':!![]});if(_0x2325cb['List']&&_0x2325cb[_0x1c3b('0x82')][_0x1c3b('0x7f')]['length']){return _0x2325cb[_0x1c3b('0x82')]['Contacts'][0x0];}return db[_0x1c3b('0x72')]['create'](_[_0x1c3b('0x19')](_0x34540d[_0x1c3b('0x5b')],{'firstName':_0x708a72,[_0x4a2d64[_0x1c3b('0x88')]]:_0x708a72,'phone':_0x708a72,'ListId':_0x2325cb[_0x1c3b('0x79')]}));}})['then'](handleEntityNotFound(_0x530a49,null))['then'](function(_0x53c476){if(_0x53c476){_0x244c43=_0x53c476;return db[_0x1c3b('0x8e')]['find']({'where':{'ContactId':_0x244c43['id'],'closed':![],'OpenchannelAccountId':_0x2325cb['id']}})[_0x1c3b('0x36')](function(_0x111c85){if(_0x111c85){return[_0x111c85,![]];}return db['OpenchannelInteraction'][_0x1c3b('0x5a')]({'UserId':_0x34540d['user']['id'],'ContactId':_0x244c43['id'],'OpenchannelAccountId':_0x2325cb['id'],'lastMsgDirection':_0x1c3b('0xb3'),'Messages':[_[_0x1c3b('0x58')](_0x34540d[_0x1c3b('0x5b')],{'read':![],'body':_0x34540d['body'][_0x1c3b('0x5b')],'OpenchannelAccountId':_0x2325cb['id'],'UserId':_0x34540d[_0x1c3b('0x5c')]['id'],'ContactId':_0x244c43['id']})]},{'include':[{'model':db[_0x1c3b('0x96')],'as':_0x1c3b('0xb4')}]})[_0x1c3b('0x36')](function(_0x342e74){return[_0x342e74,!![]];});});}})['spread'](function(_0x4c1e95,_0x17533a){if(_0x17533a){return _0x4c1e95;}return db[_0x1c3b('0x96')][_0x1c3b('0x5a')](_[_0x1c3b('0x58')](_0x34540d[_0x1c3b('0x5b')],{'read':![],'body':_0x34540d[_0x1c3b('0x5b')][_0x1c3b('0x5b')],'OpenchannelAccountId':_0x2325cb['id'],'OpenchannelInteractionId':_0x4c1e95['id'],'UserId':_0x34540d['user']['id'],'ContactId':_0x244c43['id']}))['then'](function(_0x1716f8){_0x4c1e95[_0x1c3b('0xb5')][_0x1c3b('0xb4')]=[];_0x4c1e95[_0x1c3b('0xb5')]['Messages'][_0x1c3b('0x94')](_0x1716f8[_0x1c3b('0xb5')]);return _0x4c1e95;});});}})[_0x1c3b('0x36')](respondWithResult(_0x530a49,null))[_0x1c3b('0x28')](handleError(_0x530a49,null));}; \ No newline at end of file +var _0x9c9f=['attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','findAll','rows','params','includeAll','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','hasOwnProperty','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','applications','list','orderBy','asc','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','contact','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Owner','fullname','Tag','Tags','color','tag','addAgents','omit','isArray','userOpenchannelAccount:remove','emit','getAgents','out','OpenchannelMessage','dataValues','Messages','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','OpenchannelAccount,\x20%s,\x20%s','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','query','keys','filters','intersection','model'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x9c9f,0x138));var _0xf9c9=function(_0x3077a3,_0x46aba6){_0x3077a3=_0x3077a3-0x0;var _0x184a42=_0x9c9f[_0x3077a3];return _0x184a42;};'use strict';var emlformat=require(_0xf9c9('0x0'));var rimraf=require(_0xf9c9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf9c9('0x2'));var rp=require('request-promise');var moment=require(_0xf9c9('0x3'));var BPromise=require(_0xf9c9('0x4'));var Mustache=require(_0xf9c9('0x5'));var util=require(_0xf9c9('0x6'));var path=require(_0xf9c9('0x7'));var sox=require(_0xf9c9('0x8'));var csv=require(_0xf9c9('0x9'));var ejs=require(_0xf9c9('0xa'));var fs=require('fs');var fs_extra=require(_0xf9c9('0xb'));var _=require(_0xf9c9('0xc'));var squel=require(_0xf9c9('0xd'));var crypto=require(_0xf9c9('0xe'));var jsforce=require(_0xf9c9('0xf'));var deskjs=require(_0xf9c9('0x10'));var toCsv=require(_0xf9c9('0x9'));var querystring=require(_0xf9c9('0x11'));var Papa=require('papaparse');var Redis=require(_0xf9c9('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf9c9('0x13'));var hardwareService=require(_0xf9c9('0x14'));var logger=require(_0xf9c9('0x15'))(_0xf9c9('0x16'));var utils=require(_0xf9c9('0x17'));var config=require(_0xf9c9('0x18'));var licenseUtil=require(_0xf9c9('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xf9c9('0x1a')](config[_0xf9c9('0x1b')],{'host':_0xf9c9('0x1c'),'port':0x18eb});var socket=require(_0xf9c9('0x1d'))(new Redis(config[_0xf9c9('0x1b')]));require(_0xf9c9('0x1e'))[_0xf9c9('0x1f')](socket);var jayson=require(_0xf9c9('0x20'));var client=jayson[_0xf9c9('0x21')][_0xf9c9('0x22')]({'port':0x232c});var client9002=jayson['client'][_0xf9c9('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x49c8c9,_0x456803,_0x3c7bee,_0xe86bac){return new BPromise(function(_0x52eb89,_0x4ce94e){var _0x64e5a3=_0xe86bac||client;return _0x64e5a3[_0xf9c9('0x23')](_0x49c8c9,_0x3c7bee)[_0xf9c9('0x24')](function(_0x5329ae){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x456803,_0xf9c9('0x25'));logger[_0xf9c9('0x26')](_0xf9c9('0x27'),_0x456803,'request\x20sent',JSON['stringify'](_0x5329ae));if(_0x5329ae['error']){if(_0x5329ae[_0xf9c9('0x28')][_0xf9c9('0x29')]===0x1f4){logger[_0xf9c9('0x28')]('OpenchannelAccount,\x20%s,\x20%s',_0x456803,_0x5329ae['error']['message']);return _0x4ce94e(_0x5329ae[_0xf9c9('0x28')][_0xf9c9('0x2a')]);}logger[_0xf9c9('0x28')](_0xf9c9('0x2b'),_0x456803,_0x5329ae[_0xf9c9('0x28')]['message']);return _0x52eb89(_0x5329ae['error'][_0xf9c9('0x2a')]);}else{logger[_0xf9c9('0x2c')]('OpenchannelAccount,\x20%s,\x20%s',_0x456803,_0xf9c9('0x25'));_0x52eb89(_0x5329ae[_0xf9c9('0x2d')][_0xf9c9('0x2a')]);}})[_0xf9c9('0x2e')](function(_0x3f89d0){logger[_0xf9c9('0x28')](_0xf9c9('0x2b'),_0x456803,_0x3f89d0);_0x4ce94e(_0x3f89d0);});});}function respondWithStatusCode(_0x4bbb2e,_0x124113){_0x124113=_0x124113||0xcc;return function(_0x4fb8a4){if(_0x4fb8a4){return _0x4bbb2e[_0xf9c9('0x2f')](_0x124113);}return _0x4bbb2e[_0xf9c9('0x30')](_0x124113)[_0xf9c9('0x31')]();};}function respondWithResult(_0x9a5ad9,_0x695086){_0x695086=_0x695086||0xc8;return function(_0x512725){if(_0x512725){return _0x9a5ad9[_0xf9c9('0x30')](_0x695086)[_0xf9c9('0x32')](_0x512725);}};}function respondWithFilteredResult(_0x1db035,_0x34e2fc){return function(_0x3d056e){if(_0x3d056e){var _0x18a2d8=typeof _0x34e2fc[_0xf9c9('0x33')]===_0xf9c9('0x34')&&typeof _0x34e2fc[_0xf9c9('0x35')]===_0xf9c9('0x34');var _0x1ba673=_0x3d056e['count'];var _0x1c6e50=_0x18a2d8?0x0:_0x34e2fc[_0xf9c9('0x33')];var _0x314db4=_0x18a2d8?_0x3d056e[_0xf9c9('0x36')]:_0x34e2fc[_0xf9c9('0x33')]+_0x34e2fc[_0xf9c9('0x35')];var _0x140d2d;if(_0x314db4>=_0x1ba673){_0x314db4=_0x1ba673;_0x140d2d=0xc8;}else{_0x140d2d=0xce;}_0x1db035[_0xf9c9('0x30')](_0x140d2d);return _0x1db035[_0xf9c9('0x37')](_0xf9c9('0x38'),_0x1c6e50+'-'+_0x314db4+'/'+_0x1ba673)['json'](_0x3d056e);}return null;};}function patchUpdates(_0x79088a){return function(_0x5bc1a6){try{jsonpatch[_0xf9c9('0x39')](_0x5bc1a6,_0x79088a,!![]);}catch(_0x160c38){return BPromise['reject'](_0x160c38);}return _0x5bc1a6[_0xf9c9('0x3a')]();};}function saveUpdates(_0xc618c7,_0x177ce8){return function(_0x2aa9e3){if(_0x2aa9e3){return _0x2aa9e3[_0xf9c9('0x3b')](_0xc618c7)[_0xf9c9('0x24')](function(_0x2025ea){return _0x2025ea;});}return null;};}function removeEntity(_0x2d37ef,_0x33b7be){return function(_0x44b620){if(_0x44b620){return _0x44b620['destroy']()[_0xf9c9('0x24')](function(){var _0x48a7b3=_0x44b620[_0xf9c9('0x3c')]({'plain':!![]});var _0x44a97d=_0xf9c9('0x3d');return db[_0xf9c9('0x3e')][_0xf9c9('0x3f')]({'where':{'type':_0x44a97d,'resourceId':_0x48a7b3['id']}})[_0xf9c9('0x24')](function(){return _0x44b620;});})[_0xf9c9('0x24')](function(){_0x2d37ef[_0xf9c9('0x30')](0xcc)[_0xf9c9('0x31')]();});}};}function handleEntityNotFound(_0x3fcc29,_0x56f802){return function(_0x3a4fff){if(!_0x3a4fff){_0x3fcc29['sendStatus'](0x194);}return _0x3a4fff;};}function handleError(_0x2363d1,_0x69c724){_0x69c724=_0x69c724||0x1f4;return function(_0x36e955){logger[_0xf9c9('0x28')](_0x36e955[_0xf9c9('0x40')]);if(_0x36e955[_0xf9c9('0x41')]){delete _0x36e955[_0xf9c9('0x41')];}_0x2363d1[_0xf9c9('0x30')](_0x69c724)[_0xf9c9('0x42')](_0x36e955);};}exports[_0xf9c9('0x43')]=function(_0x1d9b75,_0x4cf5b2){var _0xc9fd76={'include':[{'model':db[_0xf9c9('0x44')],'as':_0xf9c9('0x45')}]},_0x317bd1={},_0x27874d={'count':0x0,'rows':[]};var _0x53eaaf=_[_0xf9c9('0x46')](db[_0xf9c9('0x47')][_0xf9c9('0x48')],function(_0x3eacca){return{'name':_0x3eacca['fieldName'],'type':_0x3eacca[_0xf9c9('0x49')][_0xf9c9('0x4a')]};});_0x317bd1['model']=_[_0xf9c9('0x46')](_0x53eaaf,_0xf9c9('0x41'));_0x317bd1[_0xf9c9('0x4b')]=_[_0xf9c9('0x4c')](_0x1d9b75[_0xf9c9('0x4b')]);_0x317bd1[_0xf9c9('0x4d')]=_[_0xf9c9('0x4e')](_0x317bd1[_0xf9c9('0x4f')],_0x317bd1[_0xf9c9('0x4b')]);_0xc9fd76[_0xf9c9('0x50')]=_[_0xf9c9('0x4e')](_0x317bd1[_0xf9c9('0x4f')],qs[_0xf9c9('0x51')](_0x1d9b75[_0xf9c9('0x4b')]['fields']));_0xc9fd76[_0xf9c9('0x50')]=_0xc9fd76['attributes'][_0xf9c9('0x52')]?_0xc9fd76[_0xf9c9('0x50')]:_0x317bd1['model'];if(!_0x1d9b75[_0xf9c9('0x4b')]['hasOwnProperty'](_0xf9c9('0x53'))){_0xc9fd76[_0xf9c9('0x35')]=qs[_0xf9c9('0x35')](_0x1d9b75[_0xf9c9('0x4b')][_0xf9c9('0x35')]);_0xc9fd76[_0xf9c9('0x33')]=qs['offset'](_0x1d9b75['query'][_0xf9c9('0x33')]);}_0xc9fd76[_0xf9c9('0x54')]=qs[_0xf9c9('0x55')](_0x1d9b75[_0xf9c9('0x4b')][_0xf9c9('0x55')]);_0xc9fd76['where']=qs[_0xf9c9('0x4d')](_[_0xf9c9('0x56')](_0x1d9b75[_0xf9c9('0x4b')],_0x317bd1[_0xf9c9('0x4d')]),_0x53eaaf);if(_0x1d9b75[_0xf9c9('0x4b')][_0xf9c9('0x57')]){_0xc9fd76[_0xf9c9('0x58')]=_[_0xf9c9('0x59')](_0xc9fd76[_0xf9c9('0x58')],{'$or':_[_0xf9c9('0x46')](_0x53eaaf,function(_0x5be2de){if(_0x5be2de[_0xf9c9('0x49')]!==_0xf9c9('0x5a')){var _0x16cf98={};_0x16cf98[_0x5be2de[_0xf9c9('0x41')]]={'$like':'%'+_0x1d9b75[_0xf9c9('0x4b')][_0xf9c9('0x57')]+'%'};return _0x16cf98;}})});}_0xc9fd76=_['merge']({},_0xc9fd76,_0x1d9b75['options']);var _0x27b83c={'where':_0xc9fd76['where']};return db[_0xf9c9('0x47')][_0xf9c9('0x36')](_0x27b83c)[_0xf9c9('0x24')](function(_0x30cf08){_0x27874d[_0xf9c9('0x36')]=_0x30cf08;if(_0x1d9b75['query']['includeAll']){_0xc9fd76['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0xf9c9('0x5b')](_0xc9fd76);})[_0xf9c9('0x24')](function(_0x676ebc){_0x27874d[_0xf9c9('0x5c')]=_0x676ebc;return _0x27874d;})[_0xf9c9('0x24')](respondWithFilteredResult(_0x4cf5b2,_0xc9fd76))[_0xf9c9('0x2e')](handleError(_0x4cf5b2,null));};exports['show']=function(_0x119fdc,_0xec99ac){var _0x577b5d={'raw':![],'where':{'id':_0x119fdc[_0xf9c9('0x5d')]['id']},'include':[{'model':db[_0xf9c9('0x44')],'as':_0xf9c9('0x45')}]},_0x29ee44={};_0x29ee44[_0xf9c9('0x4f')]=_['keys'](db[_0xf9c9('0x47')][_0xf9c9('0x48')]);_0x29ee44[_0xf9c9('0x4b')]=_['keys'](_0x119fdc[_0xf9c9('0x4b')]);_0x29ee44['filters']=_[_0xf9c9('0x4e')](_0x29ee44[_0xf9c9('0x4f')],_0x29ee44['query']);_0x577b5d[_0xf9c9('0x50')]=_['intersection'](_0x29ee44['model'],qs[_0xf9c9('0x51')](_0x119fdc[_0xf9c9('0x4b')][_0xf9c9('0x51')]));_0x577b5d[_0xf9c9('0x50')]=_0x577b5d[_0xf9c9('0x50')][_0xf9c9('0x52')]?_0x577b5d[_0xf9c9('0x50')]:_0x29ee44[_0xf9c9('0x4f')];if(_0x119fdc['query'][_0xf9c9('0x5e')]){_0x577b5d['include']=[{'all':!![]}];}_0x577b5d=_['merge']({},_0x577b5d,_0x119fdc[_0xf9c9('0x5f')]);return db[_0xf9c9('0x47')]['find'](_0x577b5d)[_0xf9c9('0x24')](handleEntityNotFound(_0xec99ac,null))['then'](respondWithResult(_0xec99ac,null))[_0xf9c9('0x2e')](handleError(_0xec99ac,null));};exports[_0xf9c9('0x60')]=function(_0x3e89b3,_0x1b9e47){return db['OpenchannelAccount'][_0xf9c9('0x60')](_0x3e89b3[_0xf9c9('0x61')],{})[_0xf9c9('0x24')](function(_0x10e6b6){var _0x5d3f09=_0x3e89b3['user'][_0xf9c9('0x3c')]({'plain':!![]});if(!_0x5d3f09)throw new Error(_0xf9c9('0x62'));if(_0x5d3f09['role']===_0xf9c9('0x63')){var _0x580eeb=_0x10e6b6[_0xf9c9('0x3c')]({'plain':!![]});var _0x3d534b=_0xf9c9('0x3d');return db[_0xf9c9('0x64')][_0xf9c9('0x65')]({'where':{'name':_0x3d534b,'userProfileId':_0x5d3f09[_0xf9c9('0x66')]},'raw':!![]})['then'](function(_0x5040a2){if(_0x5040a2&&_0x5040a2[_0xf9c9('0x67')]===0x0){return db['UserProfileResource'][_0xf9c9('0x60')]({'name':_0x580eeb['name'],'resourceId':_0x580eeb['id'],'type':_0x5040a2[_0xf9c9('0x41')],'sectionId':_0x5040a2['id']},{})[_0xf9c9('0x24')](function(){return _0x10e6b6;});}else{return _0x10e6b6;}})[_0xf9c9('0x2e')](function(_0x4cbbda){logger[_0xf9c9('0x28')](_0xf9c9('0x68'),_0x4cbbda);throw _0x4cbbda;});}return _0x10e6b6;})[_0xf9c9('0x24')](respondWithResult(_0x1b9e47,0xc9))[_0xf9c9('0x2e')](handleError(_0x1b9e47,null));};exports['update']=function(_0x39e60d,_0x46a187){if(_0x39e60d[_0xf9c9('0x61')]['id']){delete _0x39e60d[_0xf9c9('0x61')]['id'];}return db['OpenchannelAccount'][_0xf9c9('0x65')]({'where':{'id':_0x39e60d[_0xf9c9('0x5d')]['id']},'include':[{'model':db[_0xf9c9('0x44')],'as':_0xf9c9('0x45')}]})[_0xf9c9('0x24')](handleEntityNotFound(_0x46a187,null))[_0xf9c9('0x24')](saveUpdates(_0x39e60d[_0xf9c9('0x61')],null))[_0xf9c9('0x24')](respondWithResult(_0x46a187,null))[_0xf9c9('0x2e')](handleError(_0x46a187,null));};exports[_0xf9c9('0x3f')]=function(_0x574ffe,_0x9f9e9b){return db['OpenchannelAccount'][_0xf9c9('0x65')]({'where':{'id':_0x574ffe[_0xf9c9('0x5d')]['id']}})[_0xf9c9('0x24')](handleEntityNotFound(_0x9f9e9b,null))[_0xf9c9('0x24')](removeEntity(_0x9f9e9b,null))[_0xf9c9('0x2e')](handleError(_0x9f9e9b,null));};exports[_0xf9c9('0x69')]=function(_0x4da275,_0x4db93f){return db[_0xf9c9('0x47')]['describe']()[_0xf9c9('0x24')](respondWithResult(_0x4db93f,null))[_0xf9c9('0x2e')](handleError(_0x4db93f,null));};exports['addDisposition']=function(_0x92aa5d,_0x2d15a2,_0x289235){if(_0x92aa5d[_0xf9c9('0x61')]['id']){delete _0x92aa5d[_0xf9c9('0x61')]['id'];}return db[_0xf9c9('0x47')][_0xf9c9('0x65')]({'where':{'id':_0x92aa5d[_0xf9c9('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2d15a2,null))[_0xf9c9('0x24')](function(_0x31d1f1){if(_0x31d1f1){_0x92aa5d[_0xf9c9('0x61')][_0xf9c9('0x6a')]=_0x31d1f1['id'];return db[_0xf9c9('0x6b')]['create'](_0x92aa5d[_0xf9c9('0x61')]);}})[_0xf9c9('0x24')](respondWithResult(_0x2d15a2,null))['catch'](handleError(_0x2d15a2,null));};exports[_0xf9c9('0x6c')]=function(_0x279371,_0x2fb06d,_0x172ec3){var _0x7200e7={'raw':![],'where':{}};var _0x5cfda0={};var _0x423ceb={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xf9c9('0x6d')]({'where':{'id':_0x279371[_0xf9c9('0x5d')]['id']}})[_0xf9c9('0x24')](handleEntityNotFound(_0x2fb06d,null))[_0xf9c9('0x24')](function(_0x140c42){if(_0x140c42){_0x5cfda0['model']=_[_0xf9c9('0x4c')](db[_0xf9c9('0x6b')]['rawAttributes']);_0x5cfda0[_0xf9c9('0x4b')]=_[_0xf9c9('0x4c')](_0x279371[_0xf9c9('0x4b')]);_0x5cfda0[_0xf9c9('0x4d')]=_[_0xf9c9('0x4e')](_0x5cfda0[_0xf9c9('0x4f')],_0x5cfda0['query']);_0x7200e7[_0xf9c9('0x50')]=_[_0xf9c9('0x4e')](_0x5cfda0[_0xf9c9('0x4f')],qs[_0xf9c9('0x51')](_0x279371[_0xf9c9('0x4b')][_0xf9c9('0x51')]));_0x7200e7[_0xf9c9('0x50')]=_0x7200e7[_0xf9c9('0x50')][_0xf9c9('0x52')]?_0x7200e7[_0xf9c9('0x50')]:_0x5cfda0['model'];if(!_0x279371[_0xf9c9('0x4b')][_0xf9c9('0x6e')](_0xf9c9('0x53'))){_0x7200e7[_0xf9c9('0x35')]=qs[_0xf9c9('0x35')](_0x279371['query'][_0xf9c9('0x35')]);_0x7200e7['offset']=qs['offset'](_0x279371[_0xf9c9('0x4b')][_0xf9c9('0x33')]);}_0x7200e7[_0xf9c9('0x54')]=qs[_0xf9c9('0x55')](_0x279371[_0xf9c9('0x4b')]['sort']);_0x7200e7[_0xf9c9('0x58')]=qs[_0xf9c9('0x4d')](_[_0xf9c9('0x56')](_0x279371[_0xf9c9('0x4b')],_0x5cfda0[_0xf9c9('0x4d')]));_0x7200e7[_0xf9c9('0x58')][_0xf9c9('0x6a')]=_0x140c42['id'];if(_0x279371[_0xf9c9('0x4b')][_0xf9c9('0x57')]){_0x7200e7['where']=_[_0xf9c9('0x59')](_0x7200e7[_0xf9c9('0x58')],{'$or':_[_0xf9c9('0x46')](_0x7200e7[_0xf9c9('0x50')],function(_0x4b4cbb){var _0x368e8c={};_0x368e8c[_0x4b4cbb]={'$like':'%'+_0x279371['query'][_0xf9c9('0x57')]+'%'};return _0x368e8c;})});}_0x7200e7=_[_0xf9c9('0x59')]({},_0x7200e7,_0x279371[_0xf9c9('0x5f')]);return db[_0xf9c9('0x6b')][_0xf9c9('0x36')]({'where':_0x7200e7[_0xf9c9('0x58')]})[_0xf9c9('0x24')](function(_0x50b3e3){_0x423ceb[_0xf9c9('0x36')]=_0x50b3e3;if(_0x279371['query'][_0xf9c9('0x5e')]){_0x7200e7[_0xf9c9('0x6f')]=[{'all':!![]}];}return db[_0xf9c9('0x6b')][_0xf9c9('0x5b')](_0x7200e7);})[_0xf9c9('0x24')](function(_0x1f9694){_0x423ceb[_0xf9c9('0x5c')]=_0x1f9694;return _0x423ceb;});}})['then'](respondWithFilteredResult(_0x2fb06d,_0x7200e7))[_0xf9c9('0x2e')](handleError(_0x2fb06d,null));};exports[_0xf9c9('0x70')]=function(_0x1c448e,_0x533a51,_0xffdeff){return db[_0xf9c9('0x47')]['find']({'where':{'id':_0x1c448e[_0xf9c9('0x5d')]['id']}})[_0xf9c9('0x24')](handleEntityNotFound(_0x533a51,null))[_0xf9c9('0x24')](function(_0x2f644d){if(_0x2f644d){return _0x2f644d['removeDispositions'](_0x1c448e[_0xf9c9('0x4b')][_0xf9c9('0x71')]);}})[_0xf9c9('0x24')](respondWithStatusCode(_0x533a51,null))['catch'](handleError(_0x533a51,null));};exports[_0xf9c9('0x72')]=function(_0x2dc0b5,_0x3c601b,_0x2378b3){if(_0x2dc0b5['body']['id']){delete _0x2dc0b5[_0xf9c9('0x61')]['id'];}return db[_0xf9c9('0x47')][_0xf9c9('0x65')]({'where':{'id':_0x2dc0b5['params']['id']}})[_0xf9c9('0x24')](handleEntityNotFound(_0x3c601b,null))[_0xf9c9('0x24')](function(_0x3bba15){if(_0x3bba15){_0x2dc0b5[_0xf9c9('0x61')]['OpenchannelAccountId']=_0x3bba15['id'];return db[_0xf9c9('0x73')][_0xf9c9('0x60')](_0x2dc0b5[_0xf9c9('0x61')]);}})[_0xf9c9('0x24')](respondWithResult(_0x3c601b,null))[_0xf9c9('0x2e')](handleError(_0x3c601b,null));};exports[_0xf9c9('0x74')]=function(_0xa94819,_0x2e042a,_0x3bfb8d){var _0x35e64e={'raw':![],'where':{}};var _0x3a9bb7={};var _0x4d82b9={'count':0x0,'rows':[]};return db[_0xf9c9('0x47')][_0xf9c9('0x6d')]({'where':{'id':_0xa94819[_0xf9c9('0x5d')]['id']}})[_0xf9c9('0x24')](handleEntityNotFound(_0x2e042a,null))[_0xf9c9('0x24')](function(_0x3f0752){if(_0x3f0752){_0x3a9bb7[_0xf9c9('0x4f')]=_[_0xf9c9('0x4c')](db[_0xf9c9('0x73')][_0xf9c9('0x48')]);_0x3a9bb7[_0xf9c9('0x4b')]=_[_0xf9c9('0x4c')](_0xa94819[_0xf9c9('0x4b')]);_0x3a9bb7[_0xf9c9('0x4d')]=_['intersection'](_0x3a9bb7[_0xf9c9('0x4f')],_0x3a9bb7[_0xf9c9('0x4b')]);_0x35e64e['attributes']=_[_0xf9c9('0x4e')](_0x3a9bb7[_0xf9c9('0x4f')],qs['fields'](_0xa94819['query'][_0xf9c9('0x51')]));_0x35e64e['attributes']=_0x35e64e[_0xf9c9('0x50')][_0xf9c9('0x52')]?_0x35e64e[_0xf9c9('0x50')]:_0x3a9bb7[_0xf9c9('0x4f')];if(!_0xa94819[_0xf9c9('0x4b')][_0xf9c9('0x6e')](_0xf9c9('0x53'))){_0x35e64e['limit']=qs['limit'](_0xa94819[_0xf9c9('0x4b')][_0xf9c9('0x35')]);_0x35e64e[_0xf9c9('0x33')]=qs[_0xf9c9('0x33')](_0xa94819[_0xf9c9('0x4b')]['offset']);}_0x35e64e[_0xf9c9('0x54')]=qs[_0xf9c9('0x55')](_0xa94819[_0xf9c9('0x4b')]['sort']);_0x35e64e[_0xf9c9('0x58')]=qs['filters'](_[_0xf9c9('0x56')](_0xa94819[_0xf9c9('0x4b')],_0x3a9bb7[_0xf9c9('0x4d')]));_0x35e64e[_0xf9c9('0x58')][_0xf9c9('0x6a')]=_0x3f0752['id'];if(_0xa94819[_0xf9c9('0x4b')][_0xf9c9('0x57')]){_0x35e64e[_0xf9c9('0x58')]=_[_0xf9c9('0x59')](_0x35e64e[_0xf9c9('0x58')],{'$or':_['map'](_0x35e64e['attributes'],function(_0x374108){var _0x327fd3={};_0x327fd3[_0x374108]={'$like':'%'+_0xa94819[_0xf9c9('0x4b')]['filter']+'%'};return _0x327fd3;})});}_0x35e64e=_[_0xf9c9('0x59')]({},_0x35e64e,_0xa94819[_0xf9c9('0x5f')]);return db['CannedAnswer'][_0xf9c9('0x36')]({'where':_0x35e64e['where']})[_0xf9c9('0x24')](function(_0x25413a){_0x4d82b9['count']=_0x25413a;if(_0xa94819['query']['includeAll']){_0x35e64e[_0xf9c9('0x6f')]=[{'all':!![]}];}return db[_0xf9c9('0x73')][_0xf9c9('0x5b')](_0x35e64e);})[_0xf9c9('0x24')](function(_0x309b25){_0x4d82b9[_0xf9c9('0x5c')]=_0x309b25;return _0x4d82b9;});}})[_0xf9c9('0x24')](respondWithFilteredResult(_0x2e042a,_0x35e64e))[_0xf9c9('0x2e')](handleError(_0x2e042a,null));};exports['removeAnswers']=function(_0x4ce1c7,_0x449c27,_0x2f0e87){return db[_0xf9c9('0x47')][_0xf9c9('0x65')]({'where':{'id':_0x4ce1c7[_0xf9c9('0x5d')]['id']}})[_0xf9c9('0x24')](handleEntityNotFound(_0x449c27,null))[_0xf9c9('0x24')](function(_0x5c831e){if(_0x5c831e){return _0x5c831e[_0xf9c9('0x75')](_0x4ce1c7[_0xf9c9('0x4b')][_0xf9c9('0x71')]);}})['then'](respondWithStatusCode(_0x449c27,null))['catch'](handleError(_0x449c27,null));};exports[_0xf9c9('0x76')]=function(_0x4bd621,_0x26b49d,_0x208770){var _0x604a7a={'body':_0x4bd621[_0xf9c9('0x61')],'channel':_0xf9c9('0x77')};var _0x2d598c=[];var _0x28782f=[];var _0x4db50f={};var _0x5a1a5d=![];return db[_0xf9c9('0x78')]['describe']()[_0xf9c9('0x24')](function(_0x46b718){if(!_0x46b718){throw new db[(_0xf9c9('0x79'))][(_0xf9c9('0x7a'))]('no\x20available\x20attributes');}_0x2d598c=_[_0xf9c9('0x7b')](_[_0xf9c9('0x4c')](_0x46b718),[_0xf9c9('0x7c'),_0xf9c9('0x7d')]);_0x28782f=_['difference'](_['keys'](_0x46b718),[_0xf9c9('0x7c'),_0xf9c9('0x7d'),_0xf9c9('0x7e'),_0xf9c9('0x7f')]);if(_0x4bd621[_0xf9c9('0x61')]['id']){delete _0x4bd621[_0xf9c9('0x61')]['id'];}if(_[_0xf9c9('0x80')](_0x4bd621[_0xf9c9('0x61')][_0xf9c9('0x81')])){throw new db[(_0xf9c9('0x79'))][(_0xf9c9('0x7a'))](_0xf9c9('0x82'));}if(_[_0xf9c9('0x80')](_0x4bd621['body'][_0xf9c9('0x61')])||_0x4bd621[_0xf9c9('0x61')][_0xf9c9('0x61')]===''){throw new db[(_0xf9c9('0x79'))]['ValidationError'](_0xf9c9('0x83'));}if(_[_0xf9c9('0x80')](_0x4bd621[_0xf9c9('0x61')][_0xf9c9('0x84')])){throw new db[(_0xf9c9('0x79'))][(_0xf9c9('0x7a'))](_0xf9c9('0x85')+_0x28782f);}if(!_[_0xf9c9('0x86')](_0x28782f,_0x4bd621['body'][_0xf9c9('0x84')])){throw new db[(_0xf9c9('0x79'))]['ValidationError'](_0xf9c9('0x87')+_0x28782f);}_0x4db50f[_0x4bd621[_0xf9c9('0x61')][_0xf9c9('0x84')]]=_0x4bd621[_0xf9c9('0x61')][_0xf9c9('0x81')];})[_0xf9c9('0x24')](function(){return db[_0xf9c9('0x47')][_0xf9c9('0x65')]({'where':{'id':_0x4bd621[_0xf9c9('0x5d')]['id']},'include':[{'model':db[_0xf9c9('0x88')],'as':_0xf9c9('0x89'),'include':[{'model':db['CmContact'],'as':_0xf9c9('0x8a'),'where':_0x4db50f,'limit':0x1,'order':[[_0xf9c9('0x7d'),_0xf9c9('0x8b')]]}]},{'model':db['OpenchannelApplication'],'as':_0xf9c9('0x8c')}]});})[_0xf9c9('0x24')](handleEntityNotFound(_0x26b49d,null))[_0xf9c9('0x24')](function(_0x22c9fc){if(_0x22c9fc&&_0x22c9fc[_0xf9c9('0x89')]){_0x604a7a[_0xf9c9('0x8d')]=_0x22c9fc;_0x604a7a[_0xf9c9('0x8e')]=_0x22c9fc[_0xf9c9('0x8c')];_0x604a7a[_0xf9c9('0x8f')]=_0x22c9fc[_0xf9c9('0x89')];_0x604a7a[_0xf9c9('0x8e')]=_[_0xf9c9('0x90')](_0x604a7a['applications'],['priority'],[_0xf9c9('0x91')]);if(_0x604a7a[_0xf9c9('0x8d')][_0xf9c9('0x8c')]){delete _0x604a7a[_0xf9c9('0x8d')][_0xf9c9('0x8c')];}if(_0x604a7a['account'][_0xf9c9('0x89')]&&_0x604a7a[_0xf9c9('0x8d')][_0xf9c9('0x89')]['Contacts'][_0xf9c9('0x52')]){return _0x604a7a[_0xf9c9('0x8d')][_0xf9c9('0x89')][_0xf9c9('0x8a')][0x0];}var _0x32d597=_['defaults'](_0x4bd621['body'],{'firstName':_0x4bd621['body'][_0xf9c9('0x81')],'ListId':_0x22c9fc[_0xf9c9('0x7f')]});_0x32d597[_0x4bd621['body'][_0xf9c9('0x84')]]=_0x4bd621[_0xf9c9('0x61')][_0xf9c9('0x81')];return db['CmContact'][_0xf9c9('0x60')](_0x32d597,{'fields':_0x2d598c,'raw':!![]});}})[_0xf9c9('0x24')](handleEntityNotFound(_0x26b49d,null))[_0xf9c9('0x24')](function(_0xf9d2ee){_0x604a7a['contact']=_0xf9d2ee;if(_0xf9d2ee){var _0x4aac83={'ContactId':_0xf9d2ee['id'],'OpenchannelAccountId':_0x4bd621['params']['id'],'from':(_0xf9d2ee[_0xf9c9('0x92')]||'')+'\x20'+(_0xf9d2ee[_0xf9c9('0x93')]||'')};var _0x8631a3={'OpenchannelAccountId':_0x4bd621['params']['id'],'closed':![]};if(_0x4bd621[_0xf9c9('0x61')][_0xf9c9('0x94')]){_0x8631a3[_0xf9c9('0x94')]=_0x4bd621[_0xf9c9('0x61')][_0xf9c9('0x94')];return db['OpenchannelInteraction'][_0xf9c9('0x65')]({'where':_0x8631a3})[_0xf9c9('0x24')](function(_0x5d68d0){if(_0x5d68d0){return[_0x5d68d0,![]];}_0x4aac83[_0xf9c9('0x94')]=_0x4bd621['body']['threadId'];_0x4aac83['externalUrl']=_0x4bd621[_0xf9c9('0x61')][_0xf9c9('0x95')];return db[_0xf9c9('0x96')][_0xf9c9('0x60')](_0x4aac83)[_0xf9c9('0x24')](function(_0x53ded8){return[_0x53ded8,!![]];});});}else{_0x8631a3[_0xf9c9('0x94')]=null;}_0x8631a3[_0xf9c9('0x97')]=_0xf9d2ee['id'];return db['OpenchannelInteraction'][_0xf9c9('0x65')]({'where':_0x8631a3})[_0xf9c9('0x24')](function(_0x3316df){if(_0x3316df){return[_0x3316df,![]];}return db['OpenchannelInteraction'][_0xf9c9('0x60')](_0x4aac83)[_0xf9c9('0x24')](function(_0x11023b){return[_0x11023b,!![]];});});}})[_0xf9c9('0x98')](function(_0xf230f9,_0x53f861){if(_0xf230f9){_0x5a1a5d=_0x53f861;if(!_0x53f861){var _0x2e003d={'from':(_0x604a7a[_0xf9c9('0x99')][_0xf9c9('0x92')]||'')+'\x20'+(_0x604a7a[_0xf9c9('0x99')][_0xf9c9('0x93')]||'')};if(_0x4bd621[_0xf9c9('0x61')][_0xf9c9('0x94')]&&_0x4bd621[_0xf9c9('0x61')][_0xf9c9('0x9a')]&&_0x4bd621['body'][_0xf9c9('0x94')]!=_0x4bd621[_0xf9c9('0x61')][_0xf9c9('0x9a')]){_0x2e003d['threadId']=_0x4bd621[_0xf9c9('0x61')][_0xf9c9('0x9a')];}return _0xf230f9[_0xf9c9('0x3b')](_0x2e003d);}else{return _0xf230f9;}}})[_0xf9c9('0x24')](function(_0x1a327a){_0x604a7a[_0xf9c9('0x9b')]=_0x1a327a[_0xf9c9('0x3c')]({'plain':!![]});_0x604a7a[_0xf9c9('0x9b')][_0xf9c9('0x9c')]=_0x5a1a5d;if(_0x604a7a[_0xf9c9('0x9b')][_0xf9c9('0x9c')]){if(_0x604a7a['account'][_0xf9c9('0x9d')]){_0x604a7a['applications'][_0xf9c9('0x9e')]({'id':0x0,'priority':_0x604a7a['applications'][_0xf9c9('0x52')]+0x1,'app':_0xf9c9('0x9f'),'appdata':_0xf9c9('0xa0'),'interval':_0xf9c9('0xa1')});}}return db['OpenchannelMessage'][_0xf9c9('0x60')]({'body':_0x4bd621[_0xf9c9('0x61')][_0xf9c9('0x61')],'OpenchannelAccountId':_0x4bd621['params']['id'],'OpenchannelInteractionId':_0x1a327a['id'],'direction':'in','ContactId':_0x604a7a[_0xf9c9('0x99')]['id'],'AttachmentId':_0x4bd621[_0xf9c9('0x61')][_0xf9c9('0xa2')]});})[_0xf9c9('0x24')](function(_0x37f6cd){_0x604a7a[_0xf9c9('0x2a')]=_0x37f6cd;if(_0x604a7a[_0xf9c9('0x9b')][_0xf9c9('0xa3')]){return db[_0xf9c9('0xa4')]['find']({'attributes':['id','name'],'where':{'id':_0x604a7a[_0xf9c9('0x9b')][_0xf9c9('0xa3')]}})[_0xf9c9('0x24')](function(_0x41c6e9){if(_0x41c6e9){_0x604a7a['applications'][_0xf9c9('0xa5')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x41c6e9['name']+','+(_0x604a7a[_0xf9c9('0x8d')][_0xf9c9('0xa6')]||0xa),'interval':_0xf9c9('0xa1')});_0x604a7a[_0xf9c9('0xa7')]=![];}return respondWithRpcPromise(_0xf9c9('0xa8'),_0xf9c9('0xa9'),_0x604a7a);});}return respondWithRpcPromise(_0xf9c9('0xa8'),_0xf9c9('0xa9'),_0x604a7a);})[_0xf9c9('0x24')](function(_0x3ee7f3){respondWithRpcPromise(_0xf9c9('0xaa'),_0xf9c9('0xaa'),{'event':_0xf9c9('0x76'),'message':_0x3ee7f3},client9002);return _0x3ee7f3;})['then'](respondWithResult(_0x26b49d,null))[_0xf9c9('0x2e')](handleError(_0x26b49d,null));};exports[_0xf9c9('0xab')]=function(_0x3407ec,_0x5e88e6,_0x559747){return db[_0xf9c9('0x47')]['findOne']({'where':{'id':_0x3407ec['params']['id']}})[_0xf9c9('0x24')](handleEntityNotFound(_0x5e88e6,null))[_0xf9c9('0x24')](function(_0x18a145){if(_0x18a145){return db[_0xf9c9('0xac')][_0xf9c9('0xad')](function(_0x172cdb){return db[_0xf9c9('0xae')][_0xf9c9('0x3f')]({'where':{'OpenchannelAccountId':_0x3407ec[_0xf9c9('0x5d')]['id']},'transaction':_0x172cdb})[_0xf9c9('0x24')](function(_0x53c5a6){var _0xcd8c78=_[_0xf9c9('0x46')](_0x3407ec[_0xf9c9('0x61')],function(_0x1a0936){_0x1a0936[_0xf9c9('0x6a')]=_0x3407ec[_0xf9c9('0x5d')]['id'];return _0x1a0936;});return db[_0xf9c9('0xae')][_0xf9c9('0xaf')](_0xcd8c78,{'transaction':_0x172cdb});});})['then'](function(){return db[_0xf9c9('0xae')][_0xf9c9('0xb0')]({'where':{'OpenchannelAccountId':_0x3407ec[_0xf9c9('0x5d')]['id']},'order':_0xf9c9('0xb1')});});}})[_0xf9c9('0x24')](respondWithResult(_0x5e88e6,null))['catch'](handleError(_0x5e88e6,null));};exports['getApplications']=function(_0x2fa3e6,_0x4b42e7,_0x360ffb){var _0x33d65a={};var _0x54b45f={};var _0x17cf7b;var _0x13e215;return db[_0xf9c9('0x47')][_0xf9c9('0x6d')]({'where':{'id':_0x2fa3e6[_0xf9c9('0x5d')]['id']}})[_0xf9c9('0x24')](handleEntityNotFound(_0x4b42e7,null))[_0xf9c9('0x24')](function(_0x5db052){if(_0x5db052){_0x17cf7b=_0x5db052;_0x54b45f['model']=_[_0xf9c9('0x4c')](db[_0xf9c9('0xae')][_0xf9c9('0x48')]);_0x54b45f[_0xf9c9('0x4b')]=_[_0xf9c9('0x4c')](_0x2fa3e6['query']);_0x54b45f[_0xf9c9('0x4d')]=_[_0xf9c9('0x4e')](_0x54b45f['model'],_0x54b45f[_0xf9c9('0x4b')]);_0x33d65a[_0xf9c9('0x50')]=_[_0xf9c9('0x4e')](_0x54b45f[_0xf9c9('0x4f')],qs[_0xf9c9('0x51')](_0x2fa3e6[_0xf9c9('0x4b')][_0xf9c9('0x51')]));_0x33d65a[_0xf9c9('0x50')]=_0x33d65a['attributes'][_0xf9c9('0x52')]?_0x33d65a[_0xf9c9('0x50')]:_0x54b45f[_0xf9c9('0x4f')];_0x33d65a[_0xf9c9('0x54')]=qs[_0xf9c9('0x55')](_0x2fa3e6['query'][_0xf9c9('0x55')]);_0x33d65a[_0xf9c9('0x58')]=qs['filters'](_['pick'](_0x2fa3e6[_0xf9c9('0x4b')],_0x54b45f[_0xf9c9('0x4d')]));if(_0x2fa3e6[_0xf9c9('0x4b')][_0xf9c9('0x57')]){_0x33d65a[_0xf9c9('0x58')]=_[_0xf9c9('0x59')](_0x33d65a[_0xf9c9('0x58')],{'$or':_[_0xf9c9('0x46')](_0x33d65a[_0xf9c9('0x50')],function(_0x2849b0){var _0x2dda08={};_0x2dda08[_0x2849b0]={'$like':'%'+_0x2fa3e6[_0xf9c9('0x4b')][_0xf9c9('0x57')]+'%'};return _0x2dda08;})});}_0x33d65a=_[_0xf9c9('0x59')]({},_0x33d65a,_0x2fa3e6[_0xf9c9('0x5f')]);return _0x17cf7b[_0xf9c9('0xb2')](_0x33d65a);}})['then'](function(_0x347bb5){if(_0x347bb5){_0x13e215=_0x347bb5['length'];if(!_0x2fa3e6[_0xf9c9('0x4b')][_0xf9c9('0x6e')]('nolimit')){_0x33d65a[_0xf9c9('0x35')]=qs['limit'](_0x2fa3e6[_0xf9c9('0x4b')]['limit']);_0x33d65a[_0xf9c9('0x33')]=qs['offset'](_0x2fa3e6[_0xf9c9('0x4b')][_0xf9c9('0x33')]);}return _0x17cf7b[_0xf9c9('0xb2')](_0x33d65a);}})[_0xf9c9('0x24')](function(_0x4a9742){if(_0x4a9742){return _0x4a9742?{'count':_0x13e215,'rows':_0x4a9742}:null;}})[_0xf9c9('0x24')](respondWithResult(_0x4b42e7,null))[_0xf9c9('0x2e')](handleError(_0x4b42e7,null));};exports[_0xf9c9('0xb3')]=function(_0x2ea622,_0x18ac6c,_0x54aac5){var _0x2f7d63={'raw':![],'where':{}};var _0x3aa06f={};var _0x3f02eb={'count':0x0,'rows':[]};return db[_0xf9c9('0x47')]['findOne']({'where':{'id':_0x2ea622[_0xf9c9('0x5d')]['id']}})[_0xf9c9('0x24')](handleEntityNotFound(_0x18ac6c,null))[_0xf9c9('0x24')](function(_0x36b151){if(_0x36b151){_0x3aa06f[_0xf9c9('0x4f')]=_[_0xf9c9('0x4c')](db[_0xf9c9('0x96')][_0xf9c9('0x48')]);_0x3aa06f[_0xf9c9('0x4b')]=_[_0xf9c9('0x4c')](_0x2ea622['query']);_0x3aa06f['filters']=_[_0xf9c9('0x4e')](_0x3aa06f[_0xf9c9('0x4f')],_0x3aa06f[_0xf9c9('0x4b')]);_0x2f7d63['attributes']=_[_0xf9c9('0x4e')](_0x3aa06f[_0xf9c9('0x4f')],qs[_0xf9c9('0x51')](_0x2ea622['query'][_0xf9c9('0x51')]));_0x2f7d63[_0xf9c9('0x50')]=_0x2f7d63[_0xf9c9('0x50')][_0xf9c9('0x52')]?_0x2f7d63[_0xf9c9('0x50')]:_0x3aa06f[_0xf9c9('0x4f')];if(!_0x2ea622[_0xf9c9('0x4b')]['hasOwnProperty'](_0xf9c9('0x53'))){_0x2f7d63[_0xf9c9('0x35')]=qs[_0xf9c9('0x35')](_0x2ea622['query'][_0xf9c9('0x35')]);_0x2f7d63['offset']=qs[_0xf9c9('0x33')](_0x2ea622[_0xf9c9('0x4b')][_0xf9c9('0x33')]);}_0x2f7d63[_0xf9c9('0x54')]=qs[_0xf9c9('0x55')](_0x2ea622[_0xf9c9('0x4b')][_0xf9c9('0x55')]);_0x2f7d63[_0xf9c9('0x58')]=qs[_0xf9c9('0x4d')](_[_0xf9c9('0x56')](_0x2ea622['query'],_0x3aa06f[_0xf9c9('0x4d')]));_0x2f7d63['where'][_0xf9c9('0x6a')]=_0x36b151['id'];if(_0x2ea622['query']['filter']){_0x2f7d63[_0xf9c9('0x58')]=_['merge'](_0x2f7d63[_0xf9c9('0x58')],{'$or':_['map'](_0x2f7d63[_0xf9c9('0x50')],function(_0x275740){var _0x5a5a89={};_0x5a5a89[_0x275740]={'$like':'%'+_0x2ea622['query'][_0xf9c9('0x57')]+'%'};return _0x5a5a89;})});}_0x2f7d63=_[_0xf9c9('0x59')]({},_0x2f7d63,_0x2ea622[_0xf9c9('0x5f')]);return db[_0xf9c9('0x96')][_0xf9c9('0x36')]({'where':_0x2f7d63[_0xf9c9('0x58')]})[_0xf9c9('0x24')](function(_0x230aeb){_0x3f02eb[_0xf9c9('0x36')]=_0x230aeb;if(_0x2ea622[_0xf9c9('0x4b')]['includeAll']){_0x2f7d63[_0xf9c9('0x6f')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xf9c9('0xa4')],'as':_0xf9c9('0xb4'),'attributes':[_0xf9c9('0x41'),_0xf9c9('0xb5'),'internal'],'required':![]},{'model':db[_0xf9c9('0xb6')],'as':_0xf9c9('0xb7'),'attributes':['id',_0xf9c9('0x41'),_0xf9c9('0xb8')],'where':_0x2ea622[_0xf9c9('0x4b')]['tag']?{'id':_0x2ea622[_0xf9c9('0x4b')][_0xf9c9('0xb9')]}:undefined,'required':_0x2ea622[_0xf9c9('0x4b')][_0xf9c9('0xb9')]?!![]:![]}];}return db[_0xf9c9('0x96')][_0xf9c9('0x5b')](_0x2f7d63);})['then'](function(_0x5ebae8){_0x3f02eb['rows']=_0x5ebae8;return _0x3f02eb;});}})[_0xf9c9('0x24')](respondWithFilteredResult(_0x18ac6c,_0x2f7d63))[_0xf9c9('0x2e')](handleError(_0x18ac6c,null));};exports[_0xf9c9('0xba')]=function(_0x2da4e6,_0x29ce6b,_0x5ca29a){return db[_0xf9c9('0x47')]['find']({'where':{'id':_0x2da4e6['params']['id']}})[_0xf9c9('0x24')](handleEntityNotFound(_0x29ce6b,null))[_0xf9c9('0x24')](function(_0x28a4b5){if(_0x28a4b5){return _0x28a4b5[_0xf9c9('0xba')](_0x2da4e6[_0xf9c9('0x61')][_0xf9c9('0x71')],_[_0xf9c9('0xbb')](_0x2da4e6[_0xf9c9('0x61')],['ids','id'])||{})[_0xf9c9('0x98')](function(_0x2f4337){for(var _0x2f4a6b=0x0;_0x2f4a6b<_0x2da4e6[_0xf9c9('0x61')][_0xf9c9('0x71')]['length'];_0x2f4a6b+=0x1){socket['emit']('userOpenchannelAccount:save',{'UserId':Number(_0x2da4e6[_0xf9c9('0x61')][_0xf9c9('0x71')][_0x2f4a6b]),'OpenchannelAccountId':Number(_0x2da4e6[_0xf9c9('0x5d')]['id'])});}return _0x2f4337;});}})[_0xf9c9('0x24')](respondWithResult(_0x29ce6b,null))[_0xf9c9('0x2e')](handleError(_0x29ce6b,null));};exports['removeAgents']=function(_0x2dc427,_0x5dcd7f,_0x80b088){return db[_0xf9c9('0x47')][_0xf9c9('0x65')]({'where':{'id':_0x2dc427[_0xf9c9('0x5d')]['id']}})[_0xf9c9('0x24')](handleEntityNotFound(_0x5dcd7f,null))['then'](function(_0x2c5656){if(_0x2c5656){return _0x2c5656['removeAgents'](_0x2dc427[_0xf9c9('0x4b')][_0xf9c9('0x71')])[_0xf9c9('0x24')](function(){if(_[_0xf9c9('0xbc')](_0x2dc427[_0xf9c9('0x4b')]['ids'])){for(var _0x139613=0x0;_0x139613<_0x2dc427[_0xf9c9('0x4b')][_0xf9c9('0x71')][_0xf9c9('0x52')];_0x139613+=0x1){socket['emit'](_0xf9c9('0xbd'),{'UserId':Number(_0x2dc427[_0xf9c9('0x4b')][_0xf9c9('0x71')][_0x139613]),'OpenchannelAccountId':Number(_0x2dc427['params']['id'])});}}else{socket[_0xf9c9('0xbe')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2dc427[_0xf9c9('0x4b')][_0xf9c9('0x71')]),'OpenchannelAccountId':Number(_0x2dc427[_0xf9c9('0x5d')]['id'])});}});}})[_0xf9c9('0x24')](respondWithStatusCode(_0x5dcd7f,null))[_0xf9c9('0x2e')](handleError(_0x5dcd7f,null));};exports[_0xf9c9('0xbf')]=function(_0x49126f,_0x3448bf,_0x5297c4){var _0x118eac={};var _0x211f35={};var _0x1d4185;var _0x1fd4eb;return db[_0xf9c9('0x47')][_0xf9c9('0x6d')]({'where':{'id':_0x49126f[_0xf9c9('0x5d')]['id']}})[_0xf9c9('0x24')](handleEntityNotFound(_0x3448bf,null))[_0xf9c9('0x24')](function(_0xc05507){if(_0xc05507){_0x1d4185=_0xc05507;_0x211f35['model']=_['keys'](db[_0xf9c9('0xa4')][_0xf9c9('0x48')]);_0x211f35['query']=_[_0xf9c9('0x4c')](_0x49126f[_0xf9c9('0x4b')]);_0x211f35['filters']=_['intersection'](_0x211f35[_0xf9c9('0x4f')],_0x211f35[_0xf9c9('0x4b')]);_0x118eac['attributes']=_[_0xf9c9('0x4e')](_0x211f35[_0xf9c9('0x4f')],qs['fields'](_0x49126f[_0xf9c9('0x4b')][_0xf9c9('0x51')]));_0x118eac[_0xf9c9('0x50')]=_0x118eac[_0xf9c9('0x50')][_0xf9c9('0x52')]?_0x118eac[_0xf9c9('0x50')]:_0x211f35['model'];_0x118eac['order']=qs[_0xf9c9('0x55')](_0x49126f[_0xf9c9('0x4b')][_0xf9c9('0x55')]);_0x118eac[_0xf9c9('0x58')]=qs[_0xf9c9('0x4d')](_[_0xf9c9('0x56')](_0x49126f['query'],_0x211f35[_0xf9c9('0x4d')]));if(_0x49126f[_0xf9c9('0x4b')][_0xf9c9('0x57')]){_0x118eac[_0xf9c9('0x58')]=_[_0xf9c9('0x59')](_0x118eac[_0xf9c9('0x58')],{'$or':_[_0xf9c9('0x46')](_0x118eac[_0xf9c9('0x50')],function(_0x47cbca){var _0x4ffe52={};_0x4ffe52[_0x47cbca]={'$like':'%'+_0x49126f[_0xf9c9('0x4b')][_0xf9c9('0x57')]+'%'};return _0x4ffe52;})});}_0x118eac=_[_0xf9c9('0x59')]({},_0x118eac,_0x49126f[_0xf9c9('0x5f')]);return _0x1d4185['getAgents'](_0x118eac);}})['then'](function(_0x4e655b){if(_0x4e655b){_0x1fd4eb=_0x4e655b[_0xf9c9('0x52')];if(!_0x49126f[_0xf9c9('0x4b')][_0xf9c9('0x6e')](_0xf9c9('0x53'))){_0x118eac[_0xf9c9('0x35')]=qs[_0xf9c9('0x35')](_0x49126f[_0xf9c9('0x4b')][_0xf9c9('0x35')]);_0x118eac[_0xf9c9('0x33')]=qs[_0xf9c9('0x33')](_0x49126f[_0xf9c9('0x4b')]['offset']);}return _0x1d4185[_0xf9c9('0xbf')](_0x118eac);}})[_0xf9c9('0x24')](function(_0x430151){if(_0x430151){return _0x430151?{'count':_0x1fd4eb,'rows':_0x430151}:null;}})[_0xf9c9('0x24')](respondWithResult(_0x3448bf,null))[_0xf9c9('0x2e')](handleError(_0x3448bf,null));};exports[_0xf9c9('0x42')]=function(_0x1d5acc,_0x152213,_0x3ca9ae){var _0x2891b3,_0x4734ce,_0xd8c8e6;if(_['isNil'](_0x1d5acc[_0xf9c9('0x61')][_0xf9c9('0x61')])||_0x1d5acc['body'][_0xf9c9('0x61')]===''){throw new db[(_0xf9c9('0x79'))][(_0xf9c9('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xf9c9('0x80')](_0x1d5acc['body']['to'])){}_0x2891b3=_0x1d5acc[_0xf9c9('0x61')]['to'];return db[_0xf9c9('0x47')][_0xf9c9('0x6d')]({'where':{'id':_0x1d5acc[_0xf9c9('0x5d')]['id']}})[_0xf9c9('0x24')](handleEntityNotFound(_0x152213,null))['then'](function(_0x53b644){if(_0x53b644){return db[_0xf9c9('0x47')][_0xf9c9('0x65')]({'where':{'id':_0x53b644['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0xf9c9('0x8a'),'where':{[_0x53b644[_0xf9c9('0x84')]]:_0x2891b3},'limit':0x1,'order':[[_0xf9c9('0x7d'),_0xf9c9('0x8b')]]}]}]})[_0xf9c9('0x24')](handleEntityNotFound(_0x152213,null))[_0xf9c9('0x24')](function(_0x5158dd){if(_0x5158dd&&_0x5158dd[_0xf9c9('0x89')]){_0x4734ce=_0x5158dd[_0xf9c9('0x3c')]({'plain':!![]});if(_0x4734ce[_0xf9c9('0x89')]&&_0x4734ce[_0xf9c9('0x89')][_0xf9c9('0x8a')][_0xf9c9('0x52')]){return _0x4734ce[_0xf9c9('0x89')][_0xf9c9('0x8a')][0x0];}return db['CmContact']['create'](_['defaults'](_0x1d5acc[_0xf9c9('0x61')],{'firstName':_0x2891b3,[_0x5158dd[_0xf9c9('0x84')]]:_0x2891b3,'phone':_0x2891b3,'ListId':_0x4734ce[_0xf9c9('0x7f')]}));}})[_0xf9c9('0x24')](handleEntityNotFound(_0x152213,null))[_0xf9c9('0x24')](function(_0x3a794e){if(_0x3a794e){_0xd8c8e6=_0x3a794e;return db[_0xf9c9('0x96')][_0xf9c9('0x65')]({'where':{'ContactId':_0xd8c8e6['id'],'closed':![],'OpenchannelAccountId':_0x4734ce['id']}})[_0xf9c9('0x24')](function(_0x2a7328){if(_0x2a7328){return[_0x2a7328,![]];}return db['OpenchannelInteraction'][_0xf9c9('0x60')]({'UserId':_0x1d5acc[_0xf9c9('0x63')]['id'],'ContactId':_0xd8c8e6['id'],'OpenchannelAccountId':_0x4734ce['id'],'lastMsgDirection':_0xf9c9('0xc0'),'Messages':[_[_0xf9c9('0x59')](_0x1d5acc['body'],{'read':![],'body':_0x1d5acc['body'][_0xf9c9('0x61')],'OpenchannelAccountId':_0x4734ce['id'],'UserId':_0x1d5acc[_0xf9c9('0x63')]['id'],'ContactId':_0xd8c8e6['id']})]},{'include':[{'model':db[_0xf9c9('0xc1')],'as':'Messages'}]})[_0xf9c9('0x24')](function(_0x34e93b){return[_0x34e93b,!![]];});});}})[_0xf9c9('0x98')](function(_0x473222,_0x2e3da4){if(_0x2e3da4){return _0x473222;}return db[_0xf9c9('0xc1')][_0xf9c9('0x60')](_['merge'](_0x1d5acc[_0xf9c9('0x61')],{'read':![],'body':_0x1d5acc[_0xf9c9('0x61')][_0xf9c9('0x61')],'OpenchannelAccountId':_0x4734ce['id'],'OpenchannelInteractionId':_0x473222['id'],'UserId':_0x1d5acc[_0xf9c9('0x63')]['id'],'ContactId':_0xd8c8e6['id']}))[_0xf9c9('0x24')](function(_0x22a39e){_0x473222[_0xf9c9('0xc2')][_0xf9c9('0xc3')]=[];_0x473222[_0xf9c9('0xc2')][_0xf9c9('0xc3')][_0xf9c9('0x9e')](_0x22a39e['dataValues']);return _0x473222;});});}})[_0xf9c9('0x24')](respondWithResult(_0x152213,null))[_0xf9c9('0x2e')](handleError(_0x152213,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index acafa6a..e9a8a2f 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 _0x0bb5=['events','../../mysqldb','save','update','remove','emit','hook','exports'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x0bb5,0x148));var _0x50bb=function(_0x38aed0,_0x29d056){_0x38aed0=_0x38aed0-0x0;var _0x48526e=_0x0bb5[_0x38aed0];return _0x48526e;};'use strict';var EventEmitter=require(_0x50bb('0x0'));var OpenchannelAccount=require(_0x50bb('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x50bb('0x2'),'afterUpdate':_0x50bb('0x3'),'afterDestroy':_0x50bb('0x4')};function emitEvent(_0x117e36){return function(_0x29c72b,_0xfdc9d4,_0x451b4c){OpenchannelAccountEvents[_0x50bb('0x5')](_0x117e36+':'+_0x29c72b['id'],_0x29c72b);OpenchannelAccountEvents['emit'](_0x117e36,_0x29c72b);_0x451b4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x50bb('0x6')](e,emitEvent(event));}}module[_0x50bb('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x668b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0x668b,0x140));var _0xb668=function(_0x3b56c0,_0xe100d8){_0x3b56c0=_0x3b56c0-0x0;var _0x377efe=_0x668b[_0x3b56c0];return _0x377efe;};'use strict';var EventEmitter=require(_0xb668('0x0'));var OpenchannelAccount=require(_0xb668('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb668('0x2')](0x0);var events={'afterCreate':_0xb668('0x3'),'afterUpdate':'update','afterDestroy':_0xb668('0x4')};function emitEvent(_0x5e2e83){return function(_0x2fab11,_0x4092a6,_0x2960f5){OpenchannelAccountEvents['emit'](_0x5e2e83+':'+_0x2fab11['id'],_0x2fab11);OpenchannelAccountEvents[_0xb668('0x5')](_0x5e2e83,_0x2fab11);_0x2960f5(null);};}for(var e in events){if(events[_0xb668('0x6')](e)){var event=events[e];OpenchannelAccount[_0xb668('0x7')](e,emitEvent(event));}}module[_0xb668('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 3c2a5d2..73ecede 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(_0xdfdf21,_0x112e7d){var _0x41cb81=function(_0x578ccb){while(--_0x578ccb){_0xdfdf21['push'](_0xdfdf21['shift']());}};_0x41cb81(++_0x112e7d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x2b60c8,_0x4a6394){var _0x27bc1e=function(_0x53c5ad){while(--_0x53c5ad){_0x2b60c8['push'](_0x2b60c8['shift']());}};_0x27bc1e(++_0x4a6394);}(_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 b5d95ba..f3975a1 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 _0xeffd=['redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xeffd,0x6b));var _0xdeff=function(_0x2edf1d,_0x195f6){_0x2edf1d=_0x2edf1d-0x0;var _0x1cca03=_0xeffd[_0x2edf1d];return _0x1cca03;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var moment=require(_0xdeff('0x1'));var BPromise=require(_0xdeff('0x2'));var rs=require(_0xdeff('0x3'));var fs=require('fs');var Redis=require(_0xdeff('0x4'));var db=require(_0xdeff('0x5'))['db'];var utils=require(_0xdeff('0x6'));var logger=require(_0xdeff('0x7'))(_0xdeff('0x8'));var config=require(_0xdeff('0x9'));var jayson=require(_0xdeff('0xa'));var client=jayson[_0xdeff('0xb')][_0xdeff('0xc')]({'port':0x232a});config[_0xdeff('0xd')]=_[_0xdeff('0xe')](config[_0xdeff('0xd')],{'host':_0xdeff('0xf'),'port':0x18eb});var socket=require(_0xdeff('0x10'))(new Redis(config['redis']));require(_0xdeff('0x11'))[_0xdeff('0x12')](socket);function respondWithRpcPromise(_0xf6d58d,_0x51fcb7,_0x1ff265){return new BPromise(function(_0x4423e9,_0x3c1482){return client[_0xdeff('0x13')](_0xf6d58d,_0x1ff265)[_0xdeff('0x14')](function(_0x256b73){logger[_0xdeff('0x15')](_0xdeff('0x16'),_0x51fcb7,'request\x20sent');logger[_0xdeff('0x17')](_0xdeff('0x18'),_0x51fcb7,'request\x20sent',JSON[_0xdeff('0x19')](_0x256b73));if(_0x256b73['error']){if(_0x256b73['error'][_0xdeff('0x1a')]===0x1f4){logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x256b73[_0xdeff('0x1b')]['message']);return _0x3c1482(_0x256b73[_0xdeff('0x1b')][_0xdeff('0x1c')]);}logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x256b73[_0xdeff('0x1b')][_0xdeff('0x1c')]);return _0x4423e9(_0x256b73['error']['message']);}else{logger[_0xdeff('0x15')]('OpenchannelAccount,\x20%s,\x20%s',_0x51fcb7,'request\x20sent');_0x4423e9(_0x256b73[_0xdeff('0x1d')][_0xdeff('0x1c')]);}})['catch'](function(_0x2de203){logger[_0xdeff('0x1b')](_0xdeff('0x16'),_0x51fcb7,_0x2de203);_0x3c1482(_0x2de203);});});} \ No newline at end of file +var _0x0db9=['stringify','error','code','message','info','result','catch','lodash','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s'];(function(_0x1641b0,_0x156389){var _0x452cd2=function(_0xbb3766){while(--_0xbb3766){_0x1641b0['push'](_0x1641b0['shift']());}};_0x452cd2(++_0x156389);}(_0x0db9,0xa3));var _0x90db=function(_0x571c1d,_0x3b0586){_0x571c1d=_0x571c1d-0x0;var _0x33c609=_0x0db9[_0x571c1d];return _0x33c609;};'use strict';var _=require(_0x90db('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x90db('0x1'));var fs=require('fs');var Redis=require(_0x90db('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x90db('0x3'));var logger=require('../../config/logger')(_0x90db('0x4'));var config=require(_0x90db('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x90db('0x6')][_0x90db('0x7')]({'port':0x232a});config[_0x90db('0x8')]=_[_0x90db('0x9')](config[_0x90db('0x8')],{'host':_0x90db('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x90db('0x8')]));require(_0x90db('0xb'))[_0x90db('0xc')](socket);function respondWithRpcPromise(_0x3d5bfd,_0x26eb8f,_0x9a578c){return new BPromise(function(_0xbd058e,_0x1d9f78){return client[_0x90db('0xd')](_0x3d5bfd,_0x9a578c)[_0x90db('0xe')](function(_0x2cb70b){logger['info'](_0x90db('0xf'),_0x26eb8f,_0x90db('0x10'));logger[_0x90db('0x11')](_0x90db('0x12'),_0x26eb8f,_0x90db('0x10'),JSON[_0x90db('0x13')](_0x2cb70b));if(_0x2cb70b[_0x90db('0x14')]){if(_0x2cb70b[_0x90db('0x14')][_0x90db('0x15')]===0x1f4){logger[_0x90db('0x14')](_0x90db('0xf'),_0x26eb8f,_0x2cb70b[_0x90db('0x14')][_0x90db('0x16')]);return _0x1d9f78(_0x2cb70b[_0x90db('0x14')]['message']);}logger[_0x90db('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x26eb8f,_0x2cb70b[_0x90db('0x14')][_0x90db('0x16')]);return _0xbd058e(_0x2cb70b[_0x90db('0x14')][_0x90db('0x16')]);}else{logger[_0x90db('0x17')](_0x90db('0xf'),_0x26eb8f,_0x90db('0x10'));_0xbd058e(_0x2cb70b[_0x90db('0x18')][_0x90db('0x16')]);}})[_0x90db('0x19')](function(_0x5b373b){logger[_0x90db('0x14')](_0x90db('0xf'),_0x26eb8f,_0x5b373b);_0x1d9f78(_0x5b373b);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 29deeb7..cbde2dd 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 _0xd691=['save','remove','emit','removeListener','register','openchannelAccount:','./openchannelAccount.events'];(function(_0x2a0bf3,_0x7f7285){var _0x519364=function(_0x4b6b98){while(--_0x4b6b98){_0x2a0bf3['push'](_0x2a0bf3['shift']());}};_0x519364(++_0x7f7285);}(_0xd691,0xe6));var _0x1d69=function(_0x1ca9a0,_0x17be2b){_0x1ca9a0=_0x1ca9a0-0x0;var _0x4a80d6=_0xd691[_0x1ca9a0];return _0x4a80d6;};'use strict';var OpenchannelAccountEvents=require(_0x1d69('0x0'));var events=[_0x1d69('0x1'),_0x1d69('0x2'),'update'];function createListener(_0x468419,_0x44899f){return function(_0x32502d){_0x44899f[_0x1d69('0x3')](_0x468419,_0x32502d);};}function removeListener(_0x1fbb5e,_0x2228be){return function(){OpenchannelAccountEvents[_0x1d69('0x4')](_0x1fbb5e,_0x2228be);};}exports[_0x1d69('0x5')]=function(_0xdbf1f2){for(var _0x3b36f5=0x0,_0x5a5b0c=events['length'];_0x3b36f5<_0x5a5b0c;_0x3b36f5++){var _0x267da3=events[_0x3b36f5];var _0x49f008=createListener(_0x1d69('0x6')+_0x267da3,_0xdbf1f2);OpenchannelAccountEvents['on'](_0x267da3,_0x49f008);}}; \ No newline at end of file +var _0x3189=['save','update','emit','removeListener','register','openchannelAccount:','./openchannelAccount.events'];(function(_0x463425,_0xeebe50){var _0x5428c9=function(_0x3d1878){while(--_0x3d1878){_0x463425['push'](_0x463425['shift']());}};_0x5428c9(++_0xeebe50);}(_0x3189,0xae));var _0x9318=function(_0x267073,_0x38c98a){_0x267073=_0x267073-0x0;var _0x385834=_0x3189[_0x267073];return _0x385834;};'use strict';var OpenchannelAccountEvents=require(_0x9318('0x0'));var events=[_0x9318('0x1'),'remove',_0x9318('0x2')];function createListener(_0x7351df,_0x1e5359){return function(_0x4eb59a){_0x1e5359[_0x9318('0x3')](_0x7351df,_0x4eb59a);};}function removeListener(_0x4ed87f,_0x53a864){return function(){OpenchannelAccountEvents[_0x9318('0x4')](_0x4ed87f,_0x53a864);};}exports[_0x9318('0x5')]=function(_0x50b157){for(var _0x1175d3=0x0,_0x4bb3c3=events['length'];_0x1175d3<_0x4bb3c3;_0x1175d3++){var _0x2f6831=events[_0x1175d3];var _0x324307=createListener(_0x9318('0x6')+_0x2f6831,_0x50b157);OpenchannelAccountEvents['on'](_0x2f6831,_0x324307);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 2bc02f9..35c2a35 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 _0x4c24=['../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','put','delete','/:id','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service'];(function(_0x2baf40,_0x5ebef2){var _0x2bb2cb=function(_0x1a3fc1){while(--_0x1a3fc1){_0x2baf40['push'](_0x2baf40['shift']());}};_0x2bb2cb(++_0x5ebef2);}(_0x4c24,0x1e1));var _0x44c2=function(_0x2e7002,_0x217835){_0x2e7002=_0x2e7002-0x0;var _0x2cae37=_0x4c24[_0x2e7002];return _0x2cae37;};'use strict';var multer=require(_0x44c2('0x0'));var util=require(_0x44c2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x44c2('0x2'));var router=express['Router']();var fs_extra=require(_0x44c2('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x44c2('0x4'));var config=require(_0x44c2('0x5'));var controller=require(_0x44c2('0x6'));router[_0x44c2('0x7')]('/',auth[_0x44c2('0x8')](),controller[_0x44c2('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x44c2('0xa')]);router[_0x44c2('0xb')]('/',auth['isAuthenticated'](),controller[_0x44c2('0xc')]);router[_0x44c2('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x44c2('0xe')](_0x44c2('0xf'),auth[_0x44c2('0x8')](),controller[_0x44c2('0x10')]);module[_0x44c2('0x11')]=router; \ No newline at end of file +var _0x8c5a=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x1a8f84,_0x38286a){var _0x59a65c=function(_0x5c178d){while(--_0x5c178d){_0x1a8f84['push'](_0x1a8f84['shift']());}};_0x59a65c(++_0x38286a);}(_0x8c5a,0x143));var _0xa8c5=function(_0x5cd96d,_0x283edb){_0x5cd96d=_0x5cd96d-0x0;var _0xe23df8=_0x8c5a[_0x5cd96d];return _0xe23df8;};'use strict';var multer=require('multer');var util=require(_0xa8c5('0x0'));var path=require(_0xa8c5('0x1'));var timeout=require(_0xa8c5('0x2'));var express=require(_0xa8c5('0x3'));var router=express[_0xa8c5('0x4')]();var fs_extra=require(_0xa8c5('0x5'));var auth=require(_0xa8c5('0x6'));var interaction=require(_0xa8c5('0x7'));var config=require(_0xa8c5('0x8'));var controller=require(_0xa8c5('0x9'));router[_0xa8c5('0xa')]('/',auth[_0xa8c5('0xb')](),controller[_0xa8c5('0xc')]);router[_0xa8c5('0xa')](_0xa8c5('0xd'),auth[_0xa8c5('0xb')](),controller[_0xa8c5('0xe')]);router[_0xa8c5('0xf')]('/',auth[_0xa8c5('0xb')](),controller[_0xa8c5('0x10')]);router[_0xa8c5('0x11')](_0xa8c5('0xd'),auth[_0xa8c5('0xb')](),controller[_0xa8c5('0x12')]);router['delete']('/:id',auth[_0xa8c5('0xb')](),controller['destroy']);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 291fe43..b39faea 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 _0x8ed7=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x29a91c,_0x5ac2c5){var _0x2ab4ff=function(_0x47fee7){while(--_0x47fee7){_0x29a91c['push'](_0x29a91c['shift']());}};_0x2ab4ff(++_0x5ac2c5);}(_0x8ed7,0x8d));var _0x78ed=function(_0x481413,_0x5d08ce){_0x481413=_0x481413-0x0;var _0xc1449a=_0x8ed7[_0x481413];return _0xc1449a;};'use strict';var Sequelize=require(_0x78ed('0x0'));module['exports']={'priority':{'type':Sequelize[_0x78ed('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x78ed('0x2')],'allowNull':![],'defaultValue':_0x78ed('0x3')},'appdata':{'type':Sequelize[_0x78ed('0x4')]()},'description':{'type':Sequelize[_0x78ed('0x2')]},'interval':{'type':Sequelize[_0x78ed('0x2')],'defaultValue':_0x78ed('0x5')}}; \ No newline at end of file +var _0xefe1=['exports','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x2aea41,_0x226f32){var _0x45469a=function(_0x4afe3f){while(--_0x4afe3f){_0x2aea41['push'](_0x2aea41['shift']());}};_0x45469a(++_0x226f32);}(_0xefe1,0x1a3));var _0x1efe=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xefe1[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require(_0x1efe('0x0'));module[_0x1efe('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x1efe('0x2')],'allowNull':![],'defaultValue':_0x1efe('0x3')},'appdata':{'type':Sequelize[_0x1efe('0x4')]()},'description':{'type':Sequelize[_0x1efe('0x2')]},'interval':{'type':Sequelize[_0x1efe('0x2')],'defaultValue':_0x1efe('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index f28b33a..5dd5918 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 _0x8013=['sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','error','stack','name','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','include','OpenchannelApplication','findAll','rows','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','moment','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x360697,_0x44badc){var _0xd4fe69=function(_0xd2bf65){while(--_0xd2bf65){_0x360697['push'](_0x360697['shift']());}};_0xd4fe69(++_0x44badc);}(_0x8013,0x17c));var _0x3801=function(_0x404b0e,_0x18b2e4){_0x404b0e=_0x404b0e-0x0;var _0x5638dd=_0x8013[_0x404b0e];return _0x5638dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3801('0x0'));var zipdir=require(_0x3801('0x1'));var jsonpatch=require(_0x3801('0x2'));var rp=require('request-promise');var moment=require(_0x3801('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3801('0x4'));var sox=require(_0x3801('0x5'));var csv=require('to-csv');var ejs=require(_0x3801('0x6'));var fs=require('fs');var fs_extra=require(_0x3801('0x7'));var _=require(_0x3801('0x8'));var squel=require('squel');var crypto=require(_0x3801('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x3801('0xa'));var toCsv=require(_0x3801('0xb'));var querystring=require(_0x3801('0xc'));var Papa=require(_0x3801('0xd'));var Redis=require('ioredis');var authService=require(_0x3801('0xe'));var qs=require(_0x3801('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3801('0x10'))(_0x3801('0x11'));var utils=require(_0x3801('0x12'));var config=require(_0x3801('0x13'));var licenseUtil=require(_0x3801('0x14'));var db=require(_0x3801('0x15'))['db'];function respondWithStatusCode(_0x482554,_0x4a459f){_0x4a459f=_0x4a459f||0xcc;return function(_0x483314){if(_0x483314){return _0x482554[_0x3801('0x16')](_0x4a459f);}return _0x482554['status'](_0x4a459f)[_0x3801('0x17')]();};}function respondWithResult(_0x456d3d,_0x5b4cb2){_0x5b4cb2=_0x5b4cb2||0xc8;return function(_0xe7371e){if(_0xe7371e){return _0x456d3d[_0x3801('0x18')](_0x5b4cb2)[_0x3801('0x19')](_0xe7371e);}};}function respondWithFilteredResult(_0x1807c7,_0x35bb2e){return function(_0x9f1ec7){if(_0x9f1ec7){var _0xdbb7ee=typeof _0x35bb2e[_0x3801('0x1a')]===_0x3801('0x1b')&&typeof _0x35bb2e[_0x3801('0x1c')]===_0x3801('0x1b');var _0x59e78f=_0x9f1ec7[_0x3801('0x1d')];var _0x18c82e=_0xdbb7ee?0x0:_0x35bb2e[_0x3801('0x1a')];var _0x4bdaa0=_0xdbb7ee?_0x9f1ec7['count']:_0x35bb2e['offset']+_0x35bb2e[_0x3801('0x1c')];var _0x3e5e27;if(_0x4bdaa0>=_0x59e78f){_0x4bdaa0=_0x59e78f;_0x3e5e27=0xc8;}else{_0x3e5e27=0xce;}_0x1807c7[_0x3801('0x18')](_0x3e5e27);return _0x1807c7[_0x3801('0x1e')]('Content-Range',_0x18c82e+'-'+_0x4bdaa0+'/'+_0x59e78f)['json'](_0x9f1ec7);}return null;};}function patchUpdates(_0x1a3ff0){return function(_0x1fd72d){try{jsonpatch['apply'](_0x1fd72d,_0x1a3ff0,!![]);}catch(_0x1c99ba){return BPromise[_0x3801('0x1f')](_0x1c99ba);}return _0x1fd72d[_0x3801('0x20')]();};}function saveUpdates(_0x404413,_0x55c20b){return function(_0x34cad3){if(_0x34cad3){return _0x34cad3[_0x3801('0x21')](_0x404413)['then'](function(_0x3ac70e){return _0x3ac70e;});}return null;};}function removeEntity(_0x132f65,_0x459695){return function(_0x302479){if(_0x302479){return _0x302479[_0x3801('0x22')]()[_0x3801('0x23')](function(){_0x132f65[_0x3801('0x18')](0xcc)[_0x3801('0x17')]();});}};}function handleEntityNotFound(_0x19dc01,_0x1d980d){return function(_0x5cb587){if(!_0x5cb587){_0x19dc01[_0x3801('0x16')](0x194);}return _0x5cb587;};}function handleError(_0x3f052c,_0x49436b){_0x49436b=_0x49436b||0x1f4;return function(_0x3d3de0){logger[_0x3801('0x24')](_0x3d3de0[_0x3801('0x25')]);if(_0x3d3de0[_0x3801('0x26')]){delete _0x3d3de0[_0x3801('0x26')];}_0x3f052c[_0x3801('0x18')](_0x49436b)['send'](_0x3d3de0);};}exports['index']=function(_0x3ff64b,_0x28fb1e){var _0xb71339={},_0x3fdb18={},_0x5d90e9={'count':0x0,'rows':[]};var _0x6eb0ca=_[_0x3801('0x27')](db['OpenchannelApplication'][_0x3801('0x28')],function(_0x43baca){return{'name':_0x43baca['fieldName'],'type':_0x43baca[_0x3801('0x29')][_0x3801('0x2a')]};});_0x3fdb18[_0x3801('0x2b')]=_[_0x3801('0x27')](_0x6eb0ca,'name');_0x3fdb18[_0x3801('0x2c')]=_[_0x3801('0x2d')](_0x3ff64b['query']);_0x3fdb18[_0x3801('0x2e')]=_['intersection'](_0x3fdb18['model'],_0x3fdb18[_0x3801('0x2c')]);_0xb71339[_0x3801('0x2f')]=_[_0x3801('0x30')](_0x3fdb18['model'],qs[_0x3801('0x31')](_0x3ff64b['query'][_0x3801('0x31')]));_0xb71339[_0x3801('0x2f')]=_0xb71339['attributes'][_0x3801('0x32')]?_0xb71339['attributes']:_0x3fdb18[_0x3801('0x2b')];if(!_0x3ff64b[_0x3801('0x2c')][_0x3801('0x33')]('nolimit')){_0xb71339[_0x3801('0x1c')]=qs[_0x3801('0x1c')](_0x3ff64b[_0x3801('0x2c')]['limit']);_0xb71339[_0x3801('0x1a')]=qs['offset'](_0x3ff64b[_0x3801('0x2c')]['offset']);}_0xb71339[_0x3801('0x34')]=qs[_0x3801('0x35')](_0x3ff64b['query']['sort']);_0xb71339[_0x3801('0x36')]=qs['filters'](_['pick'](_0x3ff64b['query'],_0x3fdb18['filters']),_0x6eb0ca);if(_0x3ff64b[_0x3801('0x2c')][_0x3801('0x37')]){_0xb71339[_0x3801('0x36')]=_['merge'](_0xb71339[_0x3801('0x36')],{'$or':_[_0x3801('0x27')](_0x6eb0ca,function(_0x2e9ab5){if(_0x2e9ab5['type']!=='VIRTUAL'){var _0x216eb5={};_0x216eb5[_0x2e9ab5[_0x3801('0x26')]]={'$like':'%'+_0x3ff64b['query'][_0x3801('0x37')]+'%'};return _0x216eb5;}})});}_0xb71339=_[_0x3801('0x38')]({},_0xb71339,_0x3ff64b[_0x3801('0x39')]);var _0x4f0233={'where':_0xb71339[_0x3801('0x36')]};return db['OpenchannelApplication'][_0x3801('0x1d')](_0x4f0233)[_0x3801('0x23')](function(_0x37f880){_0x5d90e9['count']=_0x37f880;if(_0x3ff64b[_0x3801('0x2c')]['includeAll']){_0xb71339[_0x3801('0x3a')]=[{'all':!![]}];}return db[_0x3801('0x3b')][_0x3801('0x3c')](_0xb71339);})['then'](function(_0x7bc983){_0x5d90e9[_0x3801('0x3d')]=_0x7bc983;return _0x5d90e9;})[_0x3801('0x23')](respondWithFilteredResult(_0x28fb1e,_0xb71339))[_0x3801('0x3e')](handleError(_0x28fb1e,null));};exports['show']=function(_0x22628e,_0x3b5460){var _0x439267={'raw':!![],'where':{'id':_0x22628e[_0x3801('0x3f')]['id']}},_0x1561ea={};_0x1561ea[_0x3801('0x2b')]=_[_0x3801('0x2d')](db[_0x3801('0x3b')][_0x3801('0x28')]);_0x1561ea[_0x3801('0x2c')]=_[_0x3801('0x2d')](_0x22628e[_0x3801('0x2c')]);_0x1561ea[_0x3801('0x2e')]=_[_0x3801('0x30')](_0x1561ea[_0x3801('0x2b')],_0x1561ea[_0x3801('0x2c')]);_0x439267[_0x3801('0x2f')]=_['intersection'](_0x1561ea[_0x3801('0x2b')],qs[_0x3801('0x31')](_0x22628e[_0x3801('0x2c')][_0x3801('0x31')]));_0x439267[_0x3801('0x2f')]=_0x439267[_0x3801('0x2f')]['length']?_0x439267[_0x3801('0x2f')]:_0x1561ea[_0x3801('0x2b')];if(_0x22628e[_0x3801('0x2c')]['includeAll']){_0x439267[_0x3801('0x3a')]=[{'all':!![]}];}_0x439267=_[_0x3801('0x38')]({},_0x439267,_0x22628e[_0x3801('0x39')]);return db['OpenchannelApplication'][_0x3801('0x40')](_0x439267)[_0x3801('0x23')](handleEntityNotFound(_0x3b5460,null))[_0x3801('0x23')](respondWithResult(_0x3b5460,null))[_0x3801('0x3e')](handleError(_0x3b5460,null));};exports[_0x3801('0x41')]=function(_0x151f7d,_0x3191fa){return db[_0x3801('0x3b')][_0x3801('0x41')](_0x151f7d[_0x3801('0x42')],{})[_0x3801('0x23')](respondWithResult(_0x3191fa,0xc9))[_0x3801('0x3e')](handleError(_0x3191fa,null));};exports[_0x3801('0x21')]=function(_0x19525a,_0xd502a8){if(_0x19525a['body']['id']){delete _0x19525a[_0x3801('0x42')]['id'];}return db[_0x3801('0x3b')][_0x3801('0x40')]({'where':{'id':_0x19525a[_0x3801('0x3f')]['id']}})[_0x3801('0x23')](handleEntityNotFound(_0xd502a8,null))['then'](saveUpdates(_0x19525a[_0x3801('0x42')],null))[_0x3801('0x23')](respondWithResult(_0xd502a8,null))[_0x3801('0x3e')](handleError(_0xd502a8,null));};exports[_0x3801('0x22')]=function(_0x230d9f,_0x2619f3){return db[_0x3801('0x3b')][_0x3801('0x40')]({'where':{'id':_0x230d9f[_0x3801('0x3f')]['id']}})[_0x3801('0x23')](handleEntityNotFound(_0x2619f3,null))[_0x3801('0x23')](removeEntity(_0x2619f3,null))[_0x3801('0x3e')](handleError(_0x2619f3,null));}; \ No newline at end of file +var _0xd48e=['util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd48e,0x1d3));var _0xed48=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xd48e[_0x9c2427];return _0x51984f;};'use strict';var emlformat=require(_0xed48('0x0'));var rimraf=require(_0xed48('0x1'));var zipdir=require(_0xed48('0x2'));var jsonpatch=require(_0xed48('0x3'));var rp=require(_0xed48('0x4'));var moment=require(_0xed48('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xed48('0x6'));var util=require(_0xed48('0x7'));var path=require(_0xed48('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xed48('0x9'));var fs=require('fs');var fs_extra=require(_0xed48('0xa'));var _=require(_0xed48('0xb'));var squel=require(_0xed48('0xc'));var crypto=require(_0xed48('0xd'));var jsforce=require(_0xed48('0xe'));var deskjs=require(_0xed48('0xf'));var toCsv=require(_0xed48('0x10'));var querystring=require('querystring');var Papa=require(_0xed48('0x11'));var Redis=require('ioredis');var authService=require(_0xed48('0x12'));var qs=require(_0xed48('0x13'));var as=require(_0xed48('0x14'));var hardwareService=require(_0xed48('0x15'));var logger=require(_0xed48('0x16'))(_0xed48('0x17'));var utils=require(_0xed48('0x18'));var config=require(_0xed48('0x19'));var licenseUtil=require(_0xed48('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4de04c,_0x19aa4d){_0x19aa4d=_0x19aa4d||0xcc;return function(_0x55fdc0){if(_0x55fdc0){return _0x4de04c[_0xed48('0x1b')](_0x19aa4d);}return _0x4de04c['status'](_0x19aa4d)[_0xed48('0x1c')]();};}function respondWithResult(_0x30b03a,_0x564fa6){_0x564fa6=_0x564fa6||0xc8;return function(_0x470f62){if(_0x470f62){return _0x30b03a[_0xed48('0x1d')](_0x564fa6)[_0xed48('0x1e')](_0x470f62);}};}function respondWithFilteredResult(_0x48285f,_0x1a9b76){return function(_0x4267d1){if(_0x4267d1){var _0x5d19c3=typeof _0x1a9b76[_0xed48('0x1f')]===_0xed48('0x20')&&typeof _0x1a9b76['limit']==='undefined';var _0x4b5770=_0x4267d1['count'];var _0x1db2fd=_0x5d19c3?0x0:_0x1a9b76[_0xed48('0x1f')];var _0x2384a2=_0x5d19c3?_0x4267d1[_0xed48('0x21')]:_0x1a9b76[_0xed48('0x1f')]+_0x1a9b76[_0xed48('0x22')];var _0x302cdd;if(_0x2384a2>=_0x4b5770){_0x2384a2=_0x4b5770;_0x302cdd=0xc8;}else{_0x302cdd=0xce;}_0x48285f[_0xed48('0x1d')](_0x302cdd);return _0x48285f[_0xed48('0x23')](_0xed48('0x24'),_0x1db2fd+'-'+_0x2384a2+'/'+_0x4b5770)[_0xed48('0x1e')](_0x4267d1);}return null;};}function patchUpdates(_0x177d83){return function(_0x59c2e5){try{jsonpatch[_0xed48('0x25')](_0x59c2e5,_0x177d83,!![]);}catch(_0x1d4de9){return BPromise[_0xed48('0x26')](_0x1d4de9);}return _0x59c2e5[_0xed48('0x27')]();};}function saveUpdates(_0x77647f,_0x2f8f01){return function(_0x170ead){if(_0x170ead){return _0x170ead[_0xed48('0x28')](_0x77647f)[_0xed48('0x29')](function(_0x5e5886){return _0x5e5886;});}return null;};}function removeEntity(_0x4eb577,_0x47e01b){return function(_0x14ca88){if(_0x14ca88){return _0x14ca88[_0xed48('0x2a')]()[_0xed48('0x29')](function(){_0x4eb577[_0xed48('0x1d')](0xcc)[_0xed48('0x1c')]();});}};}function handleEntityNotFound(_0x54c1e5,_0x619b49){return function(_0x4a615a){if(!_0x4a615a){_0x54c1e5[_0xed48('0x1b')](0x194);}return _0x4a615a;};}function handleError(_0x4aeaa7,_0x1cece0){_0x1cece0=_0x1cece0||0x1f4;return function(_0x48fac1){logger[_0xed48('0x2b')](_0x48fac1[_0xed48('0x2c')]);if(_0x48fac1[_0xed48('0x2d')]){delete _0x48fac1[_0xed48('0x2d')];}_0x4aeaa7['status'](_0x1cece0)[_0xed48('0x2e')](_0x48fac1);};}exports[_0xed48('0x2f')]=function(_0x532408,_0x26ed41){var _0x13f65b={},_0x36a213={},_0x237743={'count':0x0,'rows':[]};var _0x4a1f7f=_[_0xed48('0x30')](db[_0xed48('0x31')][_0xed48('0x32')],function(_0x2739ce){return{'name':_0x2739ce[_0xed48('0x33')],'type':_0x2739ce['type'][_0xed48('0x34')]};});_0x36a213[_0xed48('0x35')]=_[_0xed48('0x30')](_0x4a1f7f,_0xed48('0x2d'));_0x36a213['query']=_[_0xed48('0x36')](_0x532408[_0xed48('0x37')]);_0x36a213[_0xed48('0x38')]=_[_0xed48('0x39')](_0x36a213[_0xed48('0x35')],_0x36a213['query']);_0x13f65b[_0xed48('0x3a')]=_[_0xed48('0x39')](_0x36a213[_0xed48('0x35')],qs[_0xed48('0x3b')](_0x532408[_0xed48('0x37')][_0xed48('0x3b')]));_0x13f65b['attributes']=_0x13f65b[_0xed48('0x3a')][_0xed48('0x3c')]?_0x13f65b[_0xed48('0x3a')]:_0x36a213[_0xed48('0x35')];if(!_0x532408[_0xed48('0x37')]['hasOwnProperty'](_0xed48('0x3d'))){_0x13f65b['limit']=qs[_0xed48('0x22')](_0x532408[_0xed48('0x37')][_0xed48('0x22')]);_0x13f65b['offset']=qs[_0xed48('0x1f')](_0x532408[_0xed48('0x37')][_0xed48('0x1f')]);}_0x13f65b['order']=qs[_0xed48('0x3e')](_0x532408[_0xed48('0x37')][_0xed48('0x3e')]);_0x13f65b[_0xed48('0x3f')]=qs[_0xed48('0x38')](_[_0xed48('0x40')](_0x532408[_0xed48('0x37')],_0x36a213[_0xed48('0x38')]),_0x4a1f7f);if(_0x532408[_0xed48('0x37')][_0xed48('0x41')]){_0x13f65b[_0xed48('0x3f')]=_[_0xed48('0x42')](_0x13f65b[_0xed48('0x3f')],{'$or':_[_0xed48('0x30')](_0x4a1f7f,function(_0x5ba453){if(_0x5ba453[_0xed48('0x43')]!==_0xed48('0x44')){var _0x5b8a1c={};_0x5b8a1c[_0x5ba453[_0xed48('0x2d')]]={'$like':'%'+_0x532408[_0xed48('0x37')][_0xed48('0x41')]+'%'};return _0x5b8a1c;}})});}_0x13f65b=_[_0xed48('0x42')]({},_0x13f65b,_0x532408[_0xed48('0x45')]);var _0x5127ea={'where':_0x13f65b[_0xed48('0x3f')]};return db[_0xed48('0x31')]['count'](_0x5127ea)[_0xed48('0x29')](function(_0x4688f7){_0x237743[_0xed48('0x21')]=_0x4688f7;if(_0x532408['query'][_0xed48('0x46')]){_0x13f65b[_0xed48('0x47')]=[{'all':!![]}];}return db[_0xed48('0x31')][_0xed48('0x48')](_0x13f65b);})[_0xed48('0x29')](function(_0x1d3135){_0x237743[_0xed48('0x49')]=_0x1d3135;return _0x237743;})[_0xed48('0x29')](respondWithFilteredResult(_0x26ed41,_0x13f65b))[_0xed48('0x4a')](handleError(_0x26ed41,null));};exports['show']=function(_0x5aec38,_0x28072e){var _0x350b02={'raw':!![],'where':{'id':_0x5aec38[_0xed48('0x4b')]['id']}},_0x4e0c82={};_0x4e0c82[_0xed48('0x35')]=_['keys'](db['OpenchannelApplication']['rawAttributes']);_0x4e0c82['query']=_[_0xed48('0x36')](_0x5aec38[_0xed48('0x37')]);_0x4e0c82['filters']=_[_0xed48('0x39')](_0x4e0c82[_0xed48('0x35')],_0x4e0c82[_0xed48('0x37')]);_0x350b02[_0xed48('0x3a')]=_['intersection'](_0x4e0c82['model'],qs[_0xed48('0x3b')](_0x5aec38[_0xed48('0x37')][_0xed48('0x3b')]));_0x350b02['attributes']=_0x350b02[_0xed48('0x3a')][_0xed48('0x3c')]?_0x350b02[_0xed48('0x3a')]:_0x4e0c82[_0xed48('0x35')];if(_0x5aec38[_0xed48('0x37')][_0xed48('0x46')]){_0x350b02[_0xed48('0x47')]=[{'all':!![]}];}_0x350b02=_['merge']({},_0x350b02,_0x5aec38['options']);return db['OpenchannelApplication'][_0xed48('0x4c')](_0x350b02)[_0xed48('0x29')](handleEntityNotFound(_0x28072e,null))[_0xed48('0x29')](respondWithResult(_0x28072e,null))[_0xed48('0x4a')](handleError(_0x28072e,null));};exports[_0xed48('0x4d')]=function(_0x194f14,_0x272c63){return db['OpenchannelApplication']['create'](_0x194f14[_0xed48('0x4e')],{})[_0xed48('0x29')](respondWithResult(_0x272c63,0xc9))[_0xed48('0x4a')](handleError(_0x272c63,null));};exports[_0xed48('0x28')]=function(_0x4581b2,_0x264f41){if(_0x4581b2[_0xed48('0x4e')]['id']){delete _0x4581b2['body']['id'];}return db[_0xed48('0x31')][_0xed48('0x4c')]({'where':{'id':_0x4581b2[_0xed48('0x4b')]['id']}})[_0xed48('0x29')](handleEntityNotFound(_0x264f41,null))[_0xed48('0x29')](saveUpdates(_0x4581b2[_0xed48('0x4e')],null))[_0xed48('0x29')](respondWithResult(_0x264f41,null))[_0xed48('0x4a')](handleError(_0x264f41,null));};exports[_0xed48('0x2a')]=function(_0x445107,_0x4eb073){return db[_0xed48('0x31')]['find']({'where':{'id':_0x445107['params']['id']}})[_0xed48('0x29')](handleEntityNotFound(_0x4eb073,null))[_0xed48('0x29')](removeEntity(_0x4eb073,null))[_0xed48('0x4a')](handleError(_0x4eb073,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 27dc654..90b6a03 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 _0x711d=['openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','define','OpenchannelApplication'];(function(_0x303f61,_0x3b64da){var _0x76f159=function(_0x17be44){while(--_0x17be44){_0x303f61['push'](_0x303f61['shift']());}};_0x76f159(++_0x3b64da);}(_0x711d,0x7b));var _0xd711=function(_0x2efae6,_0x324fe0){_0x2efae6=_0x2efae6-0x0;var _0x4ce762=_0x711d[_0x2efae6];return _0x4ce762;};'use strict';var _=require('lodash');var util=require(_0xd711('0x0'));var logger=require(_0xd711('0x1'))(_0xd711('0x2'));var moment=require(_0xd711('0x3'));var BPromise=require('bluebird');var rp=require(_0xd711('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd711('0x5'));var config=require(_0xd711('0x6'));var attributes=require('./openchannelApplication.attributes');module['exports']=function(_0xf9ffdd,_0x210dcc){return _0xf9ffdd[_0xd711('0x7')](_0xd711('0x8'),attributes,{'tableName':_0xd711('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd711('0xa'),'collate':_0xd711('0xb')});}; \ No newline at end of file +var _0xaccc=['path','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xaccc,0x180));var _0xcacc=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0xaccc[_0x2f9467];return _0x39894c;};'use strict';var _=require('lodash');var util=require(_0xcacc('0x0'));var logger=require(_0xcacc('0x1'))(_0xcacc('0x2'));var moment=require(_0xcacc('0x3'));var BPromise=require(_0xcacc('0x4'));var rp=require(_0xcacc('0x5'));var fs=require('fs');var path=require(_0xcacc('0x6'));var rimraf=require('rimraf');var config=require(_0xcacc('0x7'));var attributes=require(_0xcacc('0x8'));module[_0xcacc('0x9')]=function(_0x17db06,_0x12d7a5){return _0x17db06[_0xcacc('0xa')](_0xcacc('0xb'),attributes,{'tableName':_0xcacc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcacc('0xd'),'collate':_0xcacc('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index a772c15..926c9e1 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 _0xc0bb=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','catch','lodash','util'];(function(_0x40359a,_0xcb63b){var _0x5efc0c=function(_0x3517df){while(--_0x3517df){_0x40359a['push'](_0x40359a['shift']());}};_0x5efc0c(++_0xcb63b);}(_0xc0bb,0x1be));var _0xbc0b=function(_0x3e5bc8,_0x457d89){_0x3e5bc8=_0x3e5bc8-0x0;var _0xfd84bc=_0xc0bb[_0x3e5bc8];return _0xfd84bc;};'use strict';var _=require(_0xbc0b('0x0'));var util=require(_0xbc0b('0x1'));var moment=require('moment');var BPromise=require(_0xbc0b('0x2'));var rs=require(_0xbc0b('0x3'));var fs=require('fs');var Redis=require(_0xbc0b('0x4'));var db=require(_0xbc0b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc0b('0x6'))(_0xbc0b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbc0b('0x8')][_0xbc0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2466d9,_0x1207a2,_0x5dab0c){return new BPromise(function(_0x234264,_0x5c6d96){return client['request'](_0x2466d9,_0x5dab0c)[_0xbc0b('0xa')](function(_0x1abd6d){logger[_0xbc0b('0xb')](_0xbc0b('0xc'),_0x1207a2,_0xbc0b('0xd'));logger[_0xbc0b('0xe')](_0xbc0b('0xf'),_0x1207a2,_0xbc0b('0xd'),JSON[_0xbc0b('0x10')](_0x1abd6d));if(_0x1abd6d[_0xbc0b('0x11')]){if(_0x1abd6d[_0xbc0b('0x11')][_0xbc0b('0x12')]===0x1f4){logger[_0xbc0b('0x11')](_0xbc0b('0xc'),_0x1207a2,_0x1abd6d[_0xbc0b('0x11')]['message']);return _0x5c6d96(_0x1abd6d[_0xbc0b('0x11')][_0xbc0b('0x13')]);}logger[_0xbc0b('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x1207a2,_0x1abd6d[_0xbc0b('0x11')][_0xbc0b('0x13')]);return _0x234264(_0x1abd6d[_0xbc0b('0x11')][_0xbc0b('0x13')]);}else{logger['info'](_0xbc0b('0xc'),_0x1207a2,_0xbc0b('0xd'));_0x234264(_0x1abd6d[_0xbc0b('0x14')][_0xbc0b('0x13')]);}})['catch'](function(_0x3cf1f7){logger[_0xbc0b('0x11')](_0xbc0b('0xc'),_0x1207a2,_0x3cf1f7);_0x5c6d96(_0x3cf1f7);});});}exports[_0xbc0b('0x15')]=function(_0x11b230){var _0x1737aa=this;return new Promise(function(_0x5af003,_0x32aa9a){return db[_0xbc0b('0x16')]['update'](_0x11b230[_0xbc0b('0x17')],{'raw':_0x11b230[_0xbc0b('0x18')]?_0x11b230[_0xbc0b('0x18')][_0xbc0b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11b230[_0xbc0b('0x18')]?_0x11b230['options'][_0xbc0b('0x1a')]||null:null,'attributes':_0x11b230[_0xbc0b('0x18')]?_0x11b230[_0xbc0b('0x18')]['attributes']||null:null,'limit':_0x11b230['options']?_0x11b230['options']['limit']||null:null})[_0xbc0b('0xa')](function(_0x1a956f){logger['info'](_0xbc0b('0x15'),_0x11b230);logger['debug'](_0xbc0b('0x15'),_0x11b230,JSON['stringify'](_0x1a956f));_0x5af003(_0x1a956f);})[_0xbc0b('0x1b')](function(_0x534e59){logger[_0xbc0b('0x11')](_0xbc0b('0x15'),_0x534e59[_0xbc0b('0x13')],_0x11b230);_0x32aa9a(_0x1737aa[_0xbc0b('0x11')](0x1f4,_0x534e59[_0xbc0b('0x13')]));});});}; \ No newline at end of file +var _0xaaed=['debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','then','util','moment','bluebird','randomstring','../../config/logger','rpc','jayson/promise','http','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xaaed,0x97));var _0xdaae=function(_0x4669a5,_0x39baa2){_0x4669a5=_0x4669a5-0x0;var _0x26a005=_0xaaed[_0x4669a5];return _0x26a005;};'use strict';var _=require('lodash');var util=require(_0xdaae('0x0'));var moment=require(_0xdaae('0x1'));var BPromise=require(_0xdaae('0x2'));var rs=require(_0xdaae('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdaae('0x4'))(_0xdaae('0x5'));var config=require('../../config/environment');var jayson=require(_0xdaae('0x6'));var client=jayson['client'][_0xdaae('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x26cfbe,_0xf5bfcc,_0x373550){return new BPromise(function(_0x2c88c2,_0x52eb83){return client['request'](_0x26cfbe,_0x373550)['then'](function(_0x46ac01){logger[_0xdaae('0x8')](_0xdaae('0x9'),_0xf5bfcc,_0xdaae('0xa'));logger[_0xdaae('0xb')](_0xdaae('0xc'),_0xf5bfcc,_0xdaae('0xa'),JSON['stringify'](_0x46ac01));if(_0x46ac01[_0xdaae('0xd')]){if(_0x46ac01[_0xdaae('0xd')][_0xdaae('0xe')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0xf5bfcc,_0x46ac01[_0xdaae('0xd')]['message']);return _0x52eb83(_0x46ac01[_0xdaae('0xd')][_0xdaae('0xf')]);}logger[_0xdaae('0xd')](_0xdaae('0x9'),_0xf5bfcc,_0x46ac01['error']['message']);return _0x2c88c2(_0x46ac01['error'][_0xdaae('0xf')]);}else{logger[_0xdaae('0x8')]('OpenchannelApplication,\x20%s,\x20%s',_0xf5bfcc,'request\x20sent');_0x2c88c2(_0x46ac01[_0xdaae('0x10')][_0xdaae('0xf')]);}})[_0xdaae('0x11')](function(_0x1b0ab7){logger[_0xdaae('0xd')](_0xdaae('0x9'),_0xf5bfcc,_0x1b0ab7);_0x52eb83(_0x1b0ab7);});});}exports[_0xdaae('0x12')]=function(_0x5d6ba3){var _0x4030e4=this;return new Promise(function(_0x53fee7,_0x501f3b){return db[_0xdaae('0x13')][_0xdaae('0x14')](_0x5d6ba3[_0xdaae('0x15')],{'raw':_0x5d6ba3[_0xdaae('0x16')]?_0x5d6ba3[_0xdaae('0x16')][_0xdaae('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d6ba3[_0xdaae('0x16')]?_0x5d6ba3['options'][_0xdaae('0x18')]||null:null,'attributes':_0x5d6ba3[_0xdaae('0x16')]?_0x5d6ba3[_0xdaae('0x16')][_0xdaae('0x19')]||null:null,'limit':_0x5d6ba3[_0xdaae('0x16')]?_0x5d6ba3['options']['limit']||null:null})[_0xdaae('0x1a')](function(_0x30d077){logger['info'](_0xdaae('0x12'),_0x5d6ba3);logger['debug']('UpdateOpenchannelApplication',_0x5d6ba3,JSON['stringify'](_0x30d077));_0x53fee7(_0x30d077);})['catch'](function(_0x613e79){logger[_0xdaae('0xd')](_0xdaae('0x12'),_0x613e79[_0xdaae('0xf')],_0x5d6ba3);_0x501f3b(_0x4030e4[_0xdaae('0xd')](0x1f4,_0x613e79[_0xdaae('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 825c08e..30e1d4e 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 _0xccc4=['/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','openchannelinteraction:update','update','delete','destroy','removeTags','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show'];(function(_0x107b43,_0x24b938){var _0x14e3a0=function(_0x2195b8){while(--_0x2195b8){_0x107b43['push'](_0x107b43['shift']());}};_0x14e3a0(++_0x24b938);}(_0xccc4,0x1f3));var _0x4ccc=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xccc4[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0x4ccc('0x0'));var path=require('path');var timeout=require(_0x4ccc('0x1'));var express=require(_0x4ccc('0x2'));var router=express[_0x4ccc('0x3')]();var fs_extra=require(_0x4ccc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4ccc('0x5'));var config=require(_0x4ccc('0x6'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0x4ccc('0x7')](),controller['index']);router[_0x4ccc('0x8')](_0x4ccc('0x9'),auth['isAuthenticated'](),controller[_0x4ccc('0xa')]);router[_0x4ccc('0x8')](_0x4ccc('0xb'),auth[_0x4ccc('0x7')](),controller[_0x4ccc('0xc')]);router[_0x4ccc('0x8')](_0x4ccc('0xd'),auth[_0x4ccc('0x7')](),controller[_0x4ccc('0xe')]);router[_0x4ccc('0x8')](_0x4ccc('0xf'),auth[_0x4ccc('0x7')](),controller[_0x4ccc('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4ccc('0x11')]);router[_0x4ccc('0x12')](_0x4ccc('0xd'),auth[_0x4ccc('0x7')](),controller[_0x4ccc('0x13')]);router['post'](_0x4ccc('0x14'),auth[_0x4ccc('0x7')](),interaction[_0x4ccc('0x15')]('openchannel',_0x4ccc('0x16')),controller[_0x4ccc('0x17')]);router[_0x4ccc('0x18')]('/:id',auth[_0x4ccc('0x7')](),interaction[_0x4ccc('0x15')](_0x4ccc('0x19'),_0x4ccc('0x1a')),controller[_0x4ccc('0x1b')]);router[_0x4ccc('0x1c')](_0x4ccc('0xb'),auth[_0x4ccc('0x7')](),interaction[_0x4ccc('0x15')](_0x4ccc('0x19'),'openchannelinteraction:destroy'),controller[_0x4ccc('0x1d')]);router[_0x4ccc('0x1c')](_0x4ccc('0x14'),auth['isAuthenticated'](),controller[_0x4ccc('0x1e')]);module[_0x4ccc('0x1f')]=router; \ No newline at end of file +var _0xb572=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','download','post','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','put','tracked','openchannelinteraction:update','update','delete','destroy','exports','multer','path'];(function(_0x194801,_0x147ece){var _0x18c56c=function(_0x236640){while(--_0x236640){_0x194801['push'](_0x194801['shift']());}};_0x18c56c(++_0x147ece);}(_0xb572,0x1b1));var _0x2b57=function(_0x151366,_0x31173a){_0x151366=_0x151366-0x0;var _0x1a9dbb=_0xb572[_0x151366];return _0x1a9dbb;};'use strict';var multer=require(_0x2b57('0x0'));var util=require('util');var path=require(_0x2b57('0x1'));var timeout=require('connect-timeout');var express=require(_0x2b57('0x2'));var router=express[_0x2b57('0x3')]();var fs_extra=require(_0x2b57('0x4'));var auth=require(_0x2b57('0x5'));var interaction=require(_0x2b57('0x6'));var config=require(_0x2b57('0x7'));var controller=require('./openchannelInteraction.controller');router[_0x2b57('0x8')]('/',auth['isAuthenticated'](),controller[_0x2b57('0x9')]);router[_0x2b57('0x8')](_0x2b57('0xa'),auth[_0x2b57('0xb')](),controller[_0x2b57('0xc')]);router[_0x2b57('0x8')](_0x2b57('0xd'),auth[_0x2b57('0xb')](),controller[_0x2b57('0xe')]);router[_0x2b57('0x8')](_0x2b57('0xf'),auth[_0x2b57('0xb')](),controller['getMessages']);router[_0x2b57('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2b57('0x10')]);router[_0x2b57('0x11')]('/',auth[_0x2b57('0xb')](),controller['create']);router['post'](_0x2b57('0xf'),auth[_0x2b57('0xb')](),controller[_0x2b57('0x12')]);router[_0x2b57('0x11')](_0x2b57('0x13'),auth[_0x2b57('0xb')](),interaction['tracked'](_0x2b57('0x14'),_0x2b57('0x15')),controller['addTags']);router[_0x2b57('0x16')](_0x2b57('0xd'),auth[_0x2b57('0xb')](),interaction[_0x2b57('0x17')](_0x2b57('0x14'),_0x2b57('0x18')),controller[_0x2b57('0x19')]);router[_0x2b57('0x1a')](_0x2b57('0xd'),auth[_0x2b57('0xb')](),interaction[_0x2b57('0x17')](_0x2b57('0x14'),'openchannelinteraction:destroy'),controller[_0x2b57('0x1b')]);router[_0x2b57('0x1a')](_0x2b57('0x13'),auth['isAuthenticated'](),controller['removeTags']);module[_0x2b57('0x1c')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 5b6c7d6..6d8a2f1 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 _0x1501=['exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x1501,0x126));var _0x1150=function(_0x16d3f8,_0x3f5dd3){_0x16d3f8=_0x16d3f8-0x0;var _0x49a172=_0x1501[_0x16d3f8];return _0x49a172;};'use strict';var Sequelize=require('sequelize');module[_0x1150('0x0')]={'closed':{'type':Sequelize[_0x1150('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1150('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x1150('0x3')]},'thirdDisposition':{'type':Sequelize[_0x1150('0x3')]},'note':{'type':Sequelize[_0x1150('0x3')]},'read1stAt':{'type':Sequelize[_0x1150('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x1150('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x1150('0x4')]('in',_0x1150('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x1150('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x1150('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x410d=['ENUM','out','exports','BOOLEAN','STRING'];(function(_0x4a4db3,_0x5d0f01){var _0x36cc28=function(_0x3216f9){while(--_0x3216f9){_0x4a4db3['push'](_0x4a4db3['shift']());}};_0x36cc28(++_0x5d0f01);}(_0x410d,0x106));var _0xd410=function(_0x22e9fe,_0x3d019f){_0x22e9fe=_0x22e9fe-0x0;var _0x47cd19=_0x410d[_0x22e9fe];return _0x47cd19;};'use strict';var Sequelize=require('sequelize');module[_0xd410('0x0')]={'closed':{'type':Sequelize[_0xd410('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xd410('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xd410('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xd410('0x2')]},'externalUrl':{'type':Sequelize[_0xd410('0x2')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xd410('0x3')]('in',_0xd410('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 467b210..30a92fb 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 _0x0070=['having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','start','body','text','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','where','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','toString','sequelize','keyBy','merge','a.key','a.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','all','show','params','include','options','create','catch','describe','ids','omit','getMessages','findOne','OpenchannelMessage','includeAll','findAll','rows','addTags','setTags','spread','emit','removeTags','download','join','root','server','files','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','direction','secret','OpenchannelAccount','Account','get','Openchannel','Owner','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Private','Messages','existsSync','pipe','createWriteStream','basename','System','views','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','fullname','TagIds','split','forEach','Tags','push','index','map','OpenchannelInteraction','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','field','color','from','tools_tags','select','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','openchannel_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','parseSearch','search','conditions','find','unreadMessages','value'];(function(_0x2bf12b,_0x4fae21){var _0x5b54f7=function(_0x5d53fa){while(--_0x5d53fa){_0x2bf12b['push'](_0x2bf12b['shift']());}};_0x5b54f7(++_0x4fae21);}(_0x0070,0x8b));var _0x0007=function(_0x3f0c06,_0x3d0ecf){_0x3f0c06=_0x3f0c06-0x0;var _0x507d9f=_0x0070[_0x3f0c06];return _0x507d9f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0007('0x0'));var zipdir=require(_0x0007('0x1'));var jsonpatch=require(_0x0007('0x2'));var rp=require(_0x0007('0x3'));var moment=require(_0x0007('0x4'));var BPromise=require(_0x0007('0x5'));var Mustache=require(_0x0007('0x6'));var util=require(_0x0007('0x7'));var path=require(_0x0007('0x8'));var sox=require(_0x0007('0x9'));var csv=require(_0x0007('0xa'));var ejs=require(_0x0007('0xb'));var fs=require('fs');var fs_extra=require(_0x0007('0xc'));var _=require(_0x0007('0xd'));var squel=require(_0x0007('0xe'));var crypto=require(_0x0007('0xf'));var jsforce=require(_0x0007('0x10'));var deskjs=require(_0x0007('0x11'));var toCsv=require(_0x0007('0xa'));var querystring=require(_0x0007('0x12'));var Papa=require('papaparse');var Redis=require(_0x0007('0x13'));var authService=require(_0x0007('0x14'));var qs=require(_0x0007('0x15'));var as=require(_0x0007('0x16'));var pdf=require(_0x0007('0x17'));var hardwareService=require(_0x0007('0x18'));var logger=require(_0x0007('0x19'))(_0x0007('0x1a'));var utils=require(_0x0007('0x1b'));var config=require(_0x0007('0x1c'));var licenseUtil=require(_0x0007('0x1d'));var db=require(_0x0007('0x1e'))['db'];config[_0x0007('0x1f')]=_['defaults'](config[_0x0007('0x1f')],{'host':_0x0007('0x20'),'port':0x18eb});var socket=require(_0x0007('0x21'))(new Redis(config[_0x0007('0x1f')]));require('./openchannelInteraction.socket')[_0x0007('0x22')](socket);function respondWithStatusCode(_0x1e1259,_0x3077d7){_0x3077d7=_0x3077d7||0xcc;return function(_0x1dc228){if(_0x1dc228){return _0x1e1259['sendStatus'](_0x3077d7);}return _0x1e1259['status'](_0x3077d7)[_0x0007('0x23')]();};}function respondWithResult(_0x1f9c35,_0x596ece){_0x596ece=_0x596ece||0xc8;return function(_0x598d76){if(_0x598d76){return _0x1f9c35[_0x0007('0x24')](_0x596ece)[_0x0007('0x25')](_0x598d76);}};}function respondWithFilteredResult(_0x35ef66,_0x16f9a3){return function(_0x4db7fe){if(_0x4db7fe){var _0x19ac54=typeof _0x16f9a3[_0x0007('0x26')]==='undefined'&&typeof _0x16f9a3[_0x0007('0x27')]===_0x0007('0x28');var _0x40336d=_0x4db7fe[_0x0007('0x29')];var _0x457819=_0x19ac54?0x0:_0x16f9a3[_0x0007('0x26')];var _0x3e0692=_0x19ac54?_0x4db7fe['count']:_0x16f9a3['offset']+_0x16f9a3[_0x0007('0x27')];var _0x3e185e;if(_0x3e0692>=_0x40336d){_0x3e0692=_0x40336d;_0x3e185e=0xc8;}else{_0x3e185e=0xce;}_0x35ef66['status'](_0x3e185e);return _0x35ef66[_0x0007('0x2a')](_0x0007('0x2b'),_0x457819+'-'+_0x3e0692+'/'+_0x40336d)['json'](_0x4db7fe);}return null;};}function patchUpdates(_0x5cecc1){return function(_0x269788){try{jsonpatch[_0x0007('0x2c')](_0x269788,_0x5cecc1,!![]);}catch(_0x195b5b){return BPromise['reject'](_0x195b5b);}return _0x269788[_0x0007('0x2d')]();};}function saveUpdates(_0xfddb8b,_0x3ebaf2){return function(_0x4f3a3c){if(_0x4f3a3c){return _0x4f3a3c[_0x0007('0x2e')](_0xfddb8b)[_0x0007('0x2f')](function(_0x2bd394){return _0x2bd394;});}return null;};}function removeEntity(_0x1e8821,_0xd6fec6){return function(_0x5b5933){if(_0x5b5933){return _0x5b5933[_0x0007('0x30')]()['then'](function(){_0x1e8821[_0x0007('0x24')](0xcc)[_0x0007('0x23')]();});}};}function handleEntityNotFound(_0x3766c5,_0x2b4b88){return function(_0x26a43b){if(!_0x26a43b){_0x3766c5[_0x0007('0x31')](0x194);}return _0x26a43b;};}function handleError(_0x50d95e,_0x330895){_0x330895=_0x330895||0x1f4;return function(_0x557c54){logger[_0x0007('0x32')](_0x557c54['stack']);if(_0x557c54['name']){delete _0x557c54[_0x0007('0x33')];}_0x50d95e[_0x0007('0x24')](_0x330895)[_0x0007('0x34')](_0x557c54);};}function getInteractionUsers(_0x4ff2d3,_0x3c4983){return new BPromise(function(_0x4a84ec,_0x9955b8){try{if(_0x3c4983[_0x4ff2d3['id']]){_0x4ff2d3['Users']=_['map'](_0x3c4983[_0x4ff2d3['id']],function(_0x15d42b){return{'id':_0x15d42b['id'],'fullname':_0x15d42b[_0x0007('0x35')]};});}}catch(_0x599416){_0x9955b8(_0x599416);}_0x4a84ec(_0x4ff2d3);});}function getInteractionTags(_0x2e2148,_0x4d32c6){return new BPromise(function(_0x885f6e,_0x2ee329){try{if(_0x2e2148[_0x0007('0x36')]){_0x2e2148['Tags']=[];_0x2e2148[_0x0007('0x36')][_0x0007('0x37')](',')[_0x0007('0x38')](function(_0x218b9b){_0x2e2148[_0x0007('0x39')][_0x0007('0x3a')](_0x4d32c6[_0x218b9b]);});}delete _0x2e2148[_0x0007('0x36')];}catch(_0x49fdb9){_0x2ee329(_0x49fdb9);}_0x885f6e(_0x2e2148);});}function updateOpenchannelInteraction(_0x2ffe36,_0x31fea9,_0x8ac873){return new BPromise(function(_0x3dacf9,_0x1e848a){return getInteractionUsers(_0x2ffe36,_0x8ac873)['then'](function(_0x407bbd){return getInteractionTags(_0x407bbd,_0x31fea9);})['then'](function(_0x113b89){_0x3dacf9(_0x113b89);})['catch'](function(_0x23f705){_0x1e848a(_0x23f705);});});}exports[_0x0007('0x3b')]=function(_0x21bdcc,_0x2b8792){var _0x1e2baf={},_0x2662ef={},_0x49d9d4={'count':0x0,'rows':[]};var _0x139c41=_[_0x0007('0x3c')](db[_0x0007('0x3d')][_0x0007('0x3e')],function(_0x415e14){return{'name':_0x415e14[_0x0007('0x3f')],'type':_0x415e14['type'][_0x0007('0x40')]};});_0x2662ef['model']=_[_0x0007('0x3c')](_0x139c41,_0x0007('0x33'));_0x2662ef[_0x0007('0x41')]=_[_0x0007('0x42')](_0x21bdcc[_0x0007('0x41')]);_0x2662ef[_0x0007('0x43')]=_['intersection'](_0x2662ef[_0x0007('0x44')],_0x2662ef[_0x0007('0x41')]);_0x1e2baf[_0x0007('0x45')]=_[_0x0007('0x46')](_0x2662ef[_0x0007('0x44')],qs[_0x0007('0x47')](_0x21bdcc['query']['fields']));_0x1e2baf['attributes']=_0x1e2baf[_0x0007('0x45')][_0x0007('0x48')]?_0x1e2baf['attributes']:_0x2662ef[_0x0007('0x44')];if(!_0x21bdcc[_0x0007('0x41')][_0x0007('0x49')](_0x0007('0x4a'))){_0x1e2baf[_0x0007('0x27')]=qs[_0x0007('0x27')](_0x21bdcc[_0x0007('0x41')]['limit']);_0x1e2baf[_0x0007('0x26')]=qs[_0x0007('0x26')](_0x21bdcc['query'][_0x0007('0x26')]);}_0x1e2baf['order']=qs[_0x0007('0x4b')](_0x21bdcc['query']['sort']);_0x1e2baf['where']=qs['filters'](_[_0x0007('0x4c')](_0x21bdcc[_0x0007('0x41')],_0x2662ef[_0x0007('0x43')]),_0x139c41);var _0x5b8872=[];var _0x4a6cf7=squel['select']()[_0x0007('0x4d')]('id')[_0x0007('0x4d')](_0x0007('0x33'))['field'](_0x0007('0x4e'))[_0x0007('0x4f')](_0x0007('0x50'));var _0x1f1408=squel[_0x0007('0x51')]()[_0x0007('0x4d')](_0x0007('0x52'))[_0x0007('0x4d')](_0x0007('0x53'))[_0x0007('0x4d')](_0x0007('0x54'))[_0x0007('0x4f')](_0x0007('0x55'),'ui')[_0x0007('0x56')](_0x0007('0x57'),'u','u.id\x20=\x20ui.UserId');var _0x37be91=squel[_0x0007('0x51')]()[_0x0007('0x4f')](_0x0007('0x58'),'i')[_0x0007('0x56')]('cm_contacts','c',_0x0007('0x59'))[_0x0007('0x56')]('users','o','o.id\x20=\x20i.UserId')[_0x0007('0x56')](_0x0007('0x5a'),'a',_0x0007('0x5b'))[_0x0007('0x56')](_0x0007('0x5c'),'me',_0x0007('0x5d'))[_0x0007('0x56')]('openchannel_interaction_has_tags','it',_0x0007('0x5e'))[_0x0007('0x56')](_0x0007('0x50'),'t',_0x0007('0x5f'));var _0x348d5b=squel['expr']();var _0x5e7090=[];var _0x3d4070=squel['expr']();var _0x2857c2;if(_0x21bdcc['query']['search']){_0x2857c2=as[_0x0007('0x60')](_0x21bdcc[_0x0007('0x41')][_0x0007('0x61')]);var _0x32c079=_0x2857c2['sqlOperator'];for(var _0x1b74d2=0x0;_0x1b74d2<_0x2857c2[_0x0007('0x62')][_0x0007('0x48')];_0x1b74d2++){var _0x4c63f9=_0x2857c2[_0x0007('0x62')][_0x1b74d2];var _0xad8a40='i';var _0x55bad2=_[_0x0007('0x63')](_0x139c41,[_0x0007('0x33'),_0x4c63f9[_0x0007('0x4d')]]);if(!_0x55bad2){switch(_0x4c63f9[_0x0007('0x4d')]){case _0x0007('0x64'):if(_0x4c63f9[_0x0007('0x65')]==0x1){_0x37be91['having']('`'+_0x4c63f9[_0x0007('0x4d')]+'`\x20=\x200');}else{_0x37be91[_0x0007('0x66')]('`'+_0x4c63f9['field']+_0x0007('0x67'));}break;case _0x0007('0x68'):if(_0x4c63f9[_0x0007('0x69')]===_0x0007('0x6a')){if(_0x4c63f9[_0x0007('0x65')]['split']('\x20')['length']>0x1){_0x348d5b[_0x32c079](_0x0007('0x6b'),qs[_0x0007('0x6c')](_0x4c63f9[_0x0007('0x65')]),null);}else{var _0x3a9cc7='%'+_0x4c63f9[_0x0007('0x65')]+'%';_0x348d5b[_0x32c079](_0x0007('0x6d'),_0x3a9cc7,_0x3a9cc7,_0x3a9cc7);}}else{_0x55bad2=_[_0x0007('0x63')](_0x139c41,[_0x0007('0x33'),_0x0007('0x6e')]);_0x4c63f9[_0x0007('0x4d')]=_0x0007('0x6e');_0xbf7553=as[_0x0007('0x6f')](_0xad8a40,_0x55bad2['type'],_0x4c63f9);_0x348d5b[_0x32c079](_0xbf7553['text'],_0xbf7553[_0x0007('0x65')]['start'],_0xbf7553[_0x0007('0x65')]['end']);}break;case _0x0007('0x70'):var _0x34d53d=_0x4c63f9[_0x0007('0x65')][_0x0007('0x37')](',')[_0x0007('0x3c')](function(_0x566b24){return Number(_0x566b24);});_0x34d53d[_0x0007('0x38')](function(_0x51e488){_0x3d4070['or'](_0x0007('0x71'),'%,'+_0x51e488+',%');});_0x5e7090=_[_0x0007('0x72')](_0x5e7090,_0x34d53d);break;case _0x0007('0x73'):if(_0x4c63f9['operator']===_0x0007('0x6a')){_0x348d5b[_0x32c079](_0x0007('0x74'),'%'+_0x4c63f9[_0x0007('0x65')]+'%',null);}else{_0x55bad2=_[_0x0007('0x63')](_0x139c41,[_0x0007('0x33'),_0x0007('0x75')]);_0x4c63f9[_0x0007('0x4d')]='UserId';_0xbf7553=as[_0x0007('0x6f')](_0xad8a40,_0x55bad2[_0x0007('0x76')],_0x4c63f9);_0x348d5b[_0x32c079](_0xbf7553['text'],_0xbf7553[_0x0007('0x65')][_0x0007('0x77')],_0xbf7553[_0x0007('0x65')]['end']);}break;case _0x0007('0x78'):_0xbf7553=as[_0x0007('0x6f')]('me',null,_0x4c63f9);_0x348d5b[_0x32c079](_0xbf7553[_0x0007('0x79')],_0xbf7553[_0x0007('0x65')][_0x0007('0x77')],_0xbf7553['value'][_0x0007('0x23')]);break;}}else{var _0xbf7553=as[_0x0007('0x6f')](_0xad8a40,_0x55bad2[_0x0007('0x76')],_0x4c63f9);_0x348d5b[_0x32c079](_0xbf7553['text'],_0xbf7553[_0x0007('0x65')]['start'],_0xbf7553[_0x0007('0x65')][_0x0007('0x23')]);}}}else{var _0x168379=_(_0x21bdcc['query'])[_0x0007('0x42')]()[_0x0007('0x3c')](function(_0xb23627){return _[_0x0007('0x7a')](_0x139c41,['name',_0xb23627])?_0xb23627:undefined;})['compact']()[_0x0007('0x65')]();if(!_[_0x0007('0x7b')](_0x168379)){_0x168379[_0x0007('0x38')](function(_0x58761d){if(_0x58761d===_0x0007('0x7c')){_0x37be91['where'](_0x0007('0x7d'),[][_0x0007('0x7e')](_0x21bdcc[_0x0007('0x41')][_0x58761d]));}else if(_0x58761d===_0x0007('0x7f')){var _0x4b2b76=JSON[_0x0007('0x80')](_0x21bdcc[_0x0007('0x41')][_0x58761d])[_0x0007('0x81')];var _0x2901c5=JSON[_0x0007('0x80')](_0x21bdcc[_0x0007('0x41')][_0x58761d])[_0x0007('0x82')];_0x37be91['where'](_0x0007('0x83'),_0x4b2b76,_0x2901c5);}else{if(_0x21bdcc[_0x0007('0x41')][_0x58761d]==='null'){_0x37be91[_0x0007('0x84')]('i.'+_0x58761d+'\x20IS\x20NULL');}else{_0x37be91['where']('i.'+_0x58761d+'\x20=\x20?',_0x21bdcc['query'][_0x58761d]);}}});}if(_0x21bdcc[_0x0007('0x41')]['read']){if(_0x21bdcc[_0x0007('0x41')][_0x0007('0x85')]==0x1){_0x37be91[_0x0007('0x66')](_0x0007('0x86'));}else{_0x37be91[_0x0007('0x66')](_0x0007('0x87'));}}if(_0x21bdcc[_0x0007('0x41')][_0x0007('0x88')]){_0x5e7090=_['isArray'](_0x21bdcc['query'][_0x0007('0x88')])?_0x21bdcc[_0x0007('0x41')][_0x0007('0x88')]:new Array(_0x21bdcc[_0x0007('0x41')][_0x0007('0x88')]);_0x5e7090[_0x0007('0x38')](function(_0x28b705){_0x3d4070['or'](_0x0007('0x71'),'%,'+_0x28b705+',%');});}if(_0x21bdcc[_0x0007('0x41')][_0x0007('0x89')]){var _0x29b47f=_0x21bdcc[_0x0007('0x41')]['filter'][_0x0007('0x8a')]('\x5c','\x5c\x5c')[_0x0007('0x8a')](/'/g,'\x27\x27');if(qs[_0x0007('0x8b')](_0x29b47f)){_0x348d5b['or']('i.id\x20LIKE\x20?',_0x29b47f+'%');}else{_0x348d5b['or'](_0x0007('0x8c'),qs['getFullTextValue'](_0x29b47f))['or'](_0x0007('0x8d'),_0x29b47f+'%')['or'](_0x0007('0x8e'),_0x29b47f+'%');}}}_0x37be91[_0x0007('0x84')](_0x348d5b);_0x37be91[_0x0007('0x8f')](_0x0007('0x90'));var _0x17b43f={'type':db['Sequelize'][_0x0007('0x91')][_0x0007('0x92')],'raw':!![]};var _0x5084ac=_0x37be91[_0x0007('0x93')]();_0x5084ac[_0x0007('0x4d')](_0x0007('0x90'));_0x5084ac[_0x0007('0x4d')](_0x0007('0x94'),_0x0007('0x64'));if(_0x1e2baf[_0x0007('0x95')]){_0x1e2baf[_0x0007('0x95')][_0x0007('0x38')](function(_0x47fa9f){var _0x2fb229=_0x47fa9f[0x0]===_0x0007('0x96')?_0x47fa9f[0x0]:'i.'+_0x47fa9f[0x0];_0x37be91['order'](_0x2fb229,_0x47fa9f[0x1]===_0x0007('0x97')?![]:!![]);});}if(!_['isEmpty'](_0x5e7090)){_0x37be91[_0x0007('0x66')](_0x3d4070);_0x5084ac[_0x0007('0x84')](_0x0007('0x98'),_0x5e7090);}BPromise[_0x0007('0x99')]()['then'](function(){if(!_0x2857c2){if(_0x21bdcc['query'][_0x0007('0x7c')])return;_0x5084ac[_0x0007('0x84')](_0x0007('0x9a'));_0x37be91[_0x0007('0x84')](_0x0007('0x9a'));return;}if(_0x21bdcc[_0x0007('0x9b')][_0x0007('0x9c')]!==_0x0007('0x9d'))return;return _0x21bdcc[_0x0007('0x9b')][_0x0007('0x9e')]({'attributes':['id'],'raw':!![]})[_0x0007('0x2f')](function(_0x4d827e){if(_[_0x0007('0x7b')](_0x4d827e)){_0x5084ac[_0x0007('0x84')](_0x0007('0x9f'));_0x37be91[_0x0007('0x84')](_0x0007('0x9f'));}else{_0x5084ac[_0x0007('0x84')](_0x0007('0x7d'),_[_0x0007('0x3c')](_0x4d827e,'id'));_0x37be91[_0x0007('0x84')](_0x0007('0x7d'),_['map'](_0x4d827e,'id'));}});})[_0x0007('0x2f')](function(){if(_0x21bdcc['user'][_0x0007('0x9c')]===_0x0007('0x9d')&&!_0x2857c2&&!_0x21bdcc[_0x0007('0x41')][_0x0007('0x7c')])return[];return db['sequelize'][_0x0007('0x41')](_0x5084ac[_0x0007('0xa0')](),_0x17b43f);})[_0x0007('0x2f')](function(_0x2e5559){_0x49d9d4[_0x0007('0x29')]=_0x2e5559[_0x0007('0x48')];if(_0x49d9d4['count']===0x0)return[];return db[_0x0007('0xa1')][_0x0007('0x41')](_0x4a6cf7[_0x0007('0xa0')](),_0x17b43f)['then'](function(_0x4ca4){_0x5b8872=_[_0x0007('0xa2')](_0x4ca4,'id');_0x17b43f=_[_0x0007('0xa3')](_0x17b43f,{'model':db[_0x0007('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x21bdcc[_0x0007('0x41')][_0x0007('0x47')]){_0x1e2baf['attributes'][_0x0007('0x38')](function(_0x1aaec5){_0x37be91[_0x0007('0x4d')]('i.'+_0x1aaec5);});}else{_0x37be91[_0x0007('0x4d')](_0x0007('0x94'),_0x0007('0x64'));_0x37be91['field'](_0x0007('0xa4'),'Account.key');_0x37be91[_0x0007('0x4d')](_0x0007('0xa5'),'Account.mandatoryDisposition');_0x37be91[_0x0007('0x4d')]('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');_0x37be91[_0x0007('0x4d')](_0x0007('0xa6'));_0x37be91[_0x0007('0x4d')](_0x0007('0xa7'),'Contact.firstName');_0x37be91[_0x0007('0x4d')](_0x0007('0xa8'),_0x0007('0xa9'));_0x37be91[_0x0007('0x4d')]('c.email',_0x0007('0xaa'));_0x37be91[_0x0007('0x4d')](_0x0007('0xab'),_0x0007('0xac'));_0x37be91[_0x0007('0x4d')]('c.mobile',_0x0007('0xad'));_0x37be91[_0x0007('0x4d')](_0x0007('0xae'),_0x0007('0xaf'));_0x37be91['field'](_0x0007('0xb0'),_0x0007('0xb1'));_0x37be91[_0x0007('0x4d')](_0x0007('0xb2'),_0x0007('0xb3'));_0x37be91[_0x0007('0x4d')](_0x0007('0xb4'),_0x0007('0x36'));}if(_0x1e2baf[_0x0007('0x27')])_0x37be91[_0x0007('0x27')](_0x1e2baf[_0x0007('0x27')]);if(_0x1e2baf[_0x0007('0x26')])_0x37be91[_0x0007('0x26')](_0x1e2baf[_0x0007('0x26')]);return db[_0x0007('0xa1')]['query'](_0x37be91[_0x0007('0xa0')](),_0x17b43f);})[_0x0007('0x2f')](function(_0x3509c0){if(_0x3509c0[_0x0007('0x48')]>0x0)_0x1f1408[_0x0007('0x84')](_0x0007('0xb5'),_[_0x0007('0x3c')](_0x3509c0,'id'));return db[_0x0007('0xa1')][_0x0007('0x41')](_0x1f1408['toString'](),_0x17b43f)[_0x0007('0x2f')](function(_0x5c3668){var _0x53e06f=_[_0x0007('0xb6')](_0x5c3668,'OpenchannelInteractionId');var _0x33f85c=[];_0x3509c0[_0x0007('0x38')](function(_0x52db37){_0x33f85c[_0x0007('0x3a')](updateOpenchannelInteraction(_0x52db37,_0x5b8872,_0x53e06f));});return BPromise[_0x0007('0xb7')](_0x33f85c);});});})[_0x0007('0x2f')](function(_0xe67d1c){_0x49d9d4['rows']=_0xe67d1c;return _0x49d9d4;})[_0x0007('0x2f')](respondWithFilteredResult(_0x2b8792,_0x1e2baf))['catch'](handleError(_0x2b8792,null));};exports[_0x0007('0xb8')]=function(_0x27525d,_0x57437e){var _0x505b1d={};if(_0x27525d[_0x0007('0x41')][_0x0007('0x76')]&&_0x27525d['query'][_0x0007('0x76')]==='from'){_0x505b1d[_0x0007('0x4f')]=_0x27525d[_0x0007('0xb9')]['id'];}else{_0x505b1d['id']=_0x27525d['params']['id'];}var _0x227398={'raw':![],'where':_0x505b1d},_0x3ae55c={};_0x3ae55c[_0x0007('0x44')]=_[_0x0007('0x42')](db[_0x0007('0x3d')][_0x0007('0x3e')]);_0x3ae55c[_0x0007('0x41')]=_[_0x0007('0x42')](_0x27525d[_0x0007('0x41')]);_0x3ae55c[_0x0007('0x43')]=_[_0x0007('0x46')](_0x3ae55c['model'],_0x3ae55c[_0x0007('0x41')]);_0x227398[_0x0007('0x45')]=_[_0x0007('0x46')](_0x3ae55c[_0x0007('0x44')],qs['fields'](_0x27525d[_0x0007('0x41')][_0x0007('0x47')]));_0x227398[_0x0007('0x45')]=_0x227398['attributes'][_0x0007('0x48')]?_0x227398[_0x0007('0x45')]:_0x3ae55c[_0x0007('0x44')];if(_0x27525d[_0x0007('0x41')]['includeAll']){_0x227398[_0x0007('0xba')]=[{'all':!![]}];}_0x227398=_['merge']({},_0x227398,_0x27525d[_0x0007('0xbb')]);return db[_0x0007('0x3d')][_0x0007('0x63')](_0x227398)['then'](handleEntityNotFound(_0x57437e,null))['then'](respondWithResult(_0x57437e,null))['catch'](handleError(_0x57437e,null));};exports[_0x0007('0xbc')]=function(_0x410a07,_0x3aa34b){return db['OpenchannelInteraction'][_0x0007('0xbc')](_0x410a07['body'],{})[_0x0007('0x2f')](respondWithResult(_0x3aa34b,0xc9))['catch'](handleError(_0x3aa34b,null));};exports['update']=function(_0x557dc1,_0x49a574){if(_0x557dc1[_0x0007('0x78')]['id']){delete _0x557dc1[_0x0007('0x78')]['id'];}return db['OpenchannelInteraction'][_0x0007('0x63')]({'where':{'id':_0x557dc1[_0x0007('0xb9')]['id']}})[_0x0007('0x2f')](handleEntityNotFound(_0x49a574,null))[_0x0007('0x2f')](saveUpdates(_0x557dc1[_0x0007('0x78')],null))[_0x0007('0x2f')](respondWithResult(_0x49a574,null))[_0x0007('0xbd')](handleError(_0x49a574,null));};exports[_0x0007('0x30')]=function(_0x3042ae,_0x41498f){return db[_0x0007('0x3d')][_0x0007('0x63')]({'where':{'id':_0x3042ae[_0x0007('0xb9')]['id']}})[_0x0007('0x2f')](handleEntityNotFound(_0x41498f,null))[_0x0007('0x2f')](removeEntity(_0x41498f,null))[_0x0007('0xbd')](handleError(_0x41498f,null));};exports[_0x0007('0xbe')]=function(_0x2303be,_0x428dac){return db[_0x0007('0x3d')][_0x0007('0xbe')]()['then'](respondWithResult(_0x428dac,null))[_0x0007('0xbd')](handleError(_0x428dac,null));};exports['addMessage']=function(_0x50f5b6,_0x245faa,_0x1ec121){return db['OpenchannelMessage'][_0x0007('0x63')]({'where':{'id':_0x50f5b6[_0x0007('0xb9')]['id']}})[_0x0007('0x2f')](handleEntityNotFound(_0x245faa,null))['then'](function(_0x16b245){if(_0x16b245){return _0x16b245['addMessage'](_0x50f5b6[_0x0007('0x78')][_0x0007('0xbf')],_[_0x0007('0xc0')](_0x50f5b6[_0x0007('0x78')],[_0x0007('0xbf'),'id'])||{});}})['then'](respondWithResult(_0x245faa,null))[_0x0007('0xbd')](handleError(_0x245faa,null));};exports[_0x0007('0xc1')]=function(_0x45741f,_0x6777ee,_0x24fea5){var _0x152bff={'raw':![],'where':{}};var _0x27ad0a={};var _0x117b33={'count':0x0,'rows':[]};return db[_0x0007('0x3d')][_0x0007('0xc2')]({'where':{'id':_0x45741f['params']['id']}})[_0x0007('0x2f')](handleEntityNotFound(_0x6777ee,null))['then'](function(_0x36eb2d){if(_0x36eb2d){_0x27ad0a[_0x0007('0x44')]=_[_0x0007('0x42')](db[_0x0007('0xc3')][_0x0007('0x3e')]);_0x27ad0a[_0x0007('0x41')]=_[_0x0007('0x42')](_0x45741f[_0x0007('0x41')]);_0x27ad0a['filters']=_[_0x0007('0x46')](_0x27ad0a[_0x0007('0x44')],_0x27ad0a[_0x0007('0x41')]);_0x152bff[_0x0007('0x45')]=_['intersection'](_0x27ad0a['model'],qs['fields'](_0x45741f['query']['fields']));_0x152bff[_0x0007('0x45')]=_0x152bff[_0x0007('0x45')][_0x0007('0x48')]?_0x152bff[_0x0007('0x45')]:_0x27ad0a['model'];if(!_0x45741f[_0x0007('0x41')][_0x0007('0x49')](_0x0007('0x4a'))){_0x152bff['limit']=qs['limit'](_0x45741f[_0x0007('0x41')][_0x0007('0x27')]);_0x152bff[_0x0007('0x26')]=qs['offset'](_0x45741f[_0x0007('0x41')][_0x0007('0x26')]);}_0x152bff[_0x0007('0x95')]=qs[_0x0007('0x4b')](_0x45741f['query']['sort']);_0x152bff[_0x0007('0x84')]=qs[_0x0007('0x43')](_[_0x0007('0x4c')](_0x45741f[_0x0007('0x41')],_0x27ad0a[_0x0007('0x43')]));_0x152bff[_0x0007('0x84')]['OpenchannelInteractionId']=_0x36eb2d['id'];if(_0x45741f['query'][_0x0007('0x89')]){_0x152bff[_0x0007('0x84')]=_[_0x0007('0xa3')](_0x152bff['where'],{'$or':_['map'](_0x152bff['attributes'],function(_0x1e5660){var _0x594035={};_0x594035[_0x1e5660]={'$like':'%'+_0x45741f[_0x0007('0x41')][_0x0007('0x89')]+'%'};return _0x594035;})});}if(_0x45741f[_0x0007('0x41')][_0x0007('0x81')]){var _0x161f58=_0x45741f[_0x0007('0x41')][_0x0007('0x81')][_0x0007('0x37')](',');var _0x3998ac={};_0x3998ac[_0x161f58[0x0]]={'$gte':moment(_0x161f58[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x152bff[_0x0007('0x84')]=_[_0x0007('0xa3')](_0x152bff[_0x0007('0x84')],_0x3998ac);}_0x152bff=_[_0x0007('0xa3')]({},_0x152bff,_0x45741f[_0x0007('0xbb')]);return db[_0x0007('0xc3')][_0x0007('0x29')]({'where':_0x152bff[_0x0007('0x84')]})[_0x0007('0x2f')](function(_0x2a3c9f){_0x117b33[_0x0007('0x29')]=_0x2a3c9f;if(_0x45741f['query'][_0x0007('0xc4')]){_0x152bff[_0x0007('0xba')]=[{'all':!![]}];}return db[_0x0007('0xc3')][_0x0007('0xc5')](_0x152bff);})[_0x0007('0x2f')](function(_0x2010f7){_0x117b33[_0x0007('0xc6')]=_0x2010f7;return _0x117b33;});}})[_0x0007('0x2f')](respondWithFilteredResult(_0x6777ee,_0x152bff))[_0x0007('0xbd')](handleError(_0x6777ee,null));};exports[_0x0007('0xc7')]=function(_0x49fb7c,_0x390761,_0x1c3c85){return db['OpenchannelInteraction'][_0x0007('0x63')]({'where':{'id':_0x49fb7c['params']['id']}})[_0x0007('0x2f')](handleEntityNotFound(_0x390761,null))[_0x0007('0x2f')](function(_0xaa4855){if(_0xaa4855){return _0xaa4855[_0x0007('0xc8')](_0x49fb7c['body'][_0x0007('0xbf')],_[_0x0007('0xc0')](_0x49fb7c[_0x0007('0x78')],[_0x0007('0xbf'),'id'])||{})[_0x0007('0xc9')](function(){return db['Tag'][_0x0007('0xc5')]({'attributes':['id',_0x0007('0x33'),_0x0007('0x4e')],'where':{'id':_0x49fb7c[_0x0007('0x78')][_0x0007('0xbf')]}});})['then'](function(_0x1680a8){socket[_0x0007('0xca')]('openchannelInteractionTags:save',{'id':Number(_0x49fb7c[_0x0007('0xb9')]['id']),'tags':_0x1680a8||[]});return{'id':Number(_0x49fb7c[_0x0007('0xb9')]['id']),'tags':_0x1680a8||[]};});}})[_0x0007('0x2f')](respondWithResult(_0x390761,null))[_0x0007('0xbd')](handleError(_0x390761,null));};exports[_0x0007('0xcb')]=function(_0x312c6b,_0x47374e,_0x4b5040){return db[_0x0007('0x3d')]['find']({'where':{'id':_0x312c6b['params']['id']}})[_0x0007('0x2f')](handleEntityNotFound(_0x47374e,null))[_0x0007('0x2f')](function(_0x13d21c){if(_0x13d21c){return _0x13d21c[_0x0007('0xcb')](_0x312c6b[_0x0007('0x41')][_0x0007('0xbf')]);}})[_0x0007('0x2f')](respondWithStatusCode(_0x47374e,null))['catch'](handleError(_0x47374e,null));};exports[_0x0007('0xcc')]=function(_0x561f2d,_0x153506){var _0x1cf6a6=moment()['unix']()[_0x0007('0xa0')]();var _0x5c028f=path[_0x0007('0xcd')](config[_0x0007('0xce')],_0x0007('0xcf'),_0x0007('0xd0'),'tmp');var _0x26d56c=path['join'](config[_0x0007('0xce')],_0x0007('0xcf'),_0x0007('0xd0'),'attachments');var _0x852f1b=path['join'](_0x5c028f,_0x1cf6a6);var _0x20aea8=util[_0x0007('0xd1')](_0x0007('0xd2'),_0x561f2d['params']['id'],_0x1cf6a6);var _0x1899bc=path[_0x0007('0xcd')](_0x5c028f,_0x20aea8);var _0x5a8804=[];_0x5a8804[_0x0007('0x3a')]({'model':db[_0x0007('0x73')],'as':_0x0007('0x73'),'attributes':['id',_0x0007('0x35')],'raw':!![]});_0x5a8804[_0x0007('0x3a')]({'model':db[_0x0007('0xd3')],'as':_0x0007('0x68'),'attributes':['id',_0x0007('0xd4'),_0x0007('0xd5')],'raw':!![]});if(_0x561f2d[_0x0007('0x41')]['attachments']){_0x5a8804['push']({'model':db[_0x0007('0xd6')],'as':_0x0007('0xd6'),'raw':!![]});}var _0x4f8ca9=[{'model':db[_0x0007('0xc3')],'as':'Messages','attributes':['id',_0x0007('0x78'),_0x0007('0x7f'),_0x0007('0xd7'),_0x0007('0xd8'),_0x0007('0x85')],'include':_0x5a8804}];_0x4f8ca9['push']({'model':db[_0x0007('0xd9')],'as':_0x0007('0xda'),'attributes':['id','name']});_0x4f8ca9[_0x0007('0x3a')]({'model':db[_0x0007('0x73')],'as':'Owner','attributes':['id',_0x0007('0x35')]});return db[_0x0007('0x3d')]['find']({'where':{'id':_0x561f2d['params']['id']},'include':_0x4f8ca9})[_0x0007('0x2f')](handleEntityNotFound(_0x153506,null))[_0x0007('0x2f')](function(_0xefee98){if(_0xefee98){var _0x3393d8=_0xefee98[_0x0007('0xdb')]({'plain':!![]});fs['mkdirSync'](_0x852f1b);var _0x121d36={'channel':_0x0007('0xdc'),'account':_0x3393d8[_0x0007('0xda')][_0x0007('0x33')],'agent':_0x3393d8[_0x0007('0xdd')]?_0x3393d8[_0x0007('0xdd')][_0x0007('0x35')]:'N.A.','createdAt':moment(_0x3393d8['createdAt'])[_0x0007('0xd1')](_0x0007('0xde'))['toString'](),'closedAt':_0x3393d8[_0x0007('0xdf')]?moment(_0x3393d8[_0x0007('0xe0')])[_0x0007('0xd1')](_0x0007('0xde'))[_0x0007('0xa0')]():'','disposition':_0x3393d8[_0x0007('0xe1')],'visibility':_0x3393d8[_0x0007('0xe2')]?'Public':_0x0007('0xe3'),'messages':_(_0x3393d8[_0x0007('0xe4')])[_0x0007('0x89')]({'secret':![]})[_0x0007('0x3c')](function(_0x223794){if(_0x223794[_0x0007('0xd6')]){var _0x56f783=path[_0x0007('0xcd')](_0x26d56c,_0x223794[_0x0007('0xd6')]['basename']);if(fs[_0x0007('0xe5')](_0x56f783)){fs['createReadStream'](_0x56f783)[_0x0007('0xe6')](fs[_0x0007('0xe7')](path[_0x0007('0xcd')](_0x852f1b,_0x223794[_0x0007('0xd6')][_0x0007('0xe8')])));}}return{'date':moment(_0x223794[_0x0007('0x7f')])['format'](_0x0007('0xde'))[_0x0007('0xa0')](),'sender':_0x223794['direction']==='out'?_0x223794[_0x0007('0x73')]?_0x223794[_0x0007('0x73')][_0x0007('0x35')]:_0x0007('0xe9'):_0x223794['Contact'][_0x0007('0xd4')]+(_0x223794['Contact'][_0x0007('0xd5')]?'\x20'+_0x223794[_0x0007('0x68')]['lastName']:''),'body':_0x223794[_0x0007('0xd6')]?_0x223794[_0x0007('0xd6')][_0x0007('0xe8')]:_0x223794[_0x0007('0x78')],'direction':_0x223794[_0x0007('0xd7')]==='out'?'A':'C','secret':_0x223794['secret'],'read':_0x223794[_0x0007('0x85')],'attachment':_0x223794[_0x0007('0xd6')]};})[_0x0007('0x65')]()};return ejs['renderFile'](path[_0x0007('0xcd')](config[_0x0007('0xce')],_0x0007('0xcf'),_0x0007('0xea'),'downloadInteraction.ejs'),{'interaction':_0x121d36})[_0x0007('0x2f')](function(_0xea6930){var _0x49aef0=path[_0x0007('0xcd')](_0x852f1b,_0x0007('0xeb')+_0x3393d8['id']+'-'+_0x1cf6a6+_0x0007('0xec'));var _0x3e8e38={'path':_0x49aef0,'channel':_0x0007('0xdc'),'interactionId':_0x3393d8['id']};return pdf[_0x0007('0xed')](_0xea6930,_0x3e8e38);})[_0x0007('0x2f')](function(){return new BPromise(function(_0x42a36d,_0x1efa39){zipdir(_0x852f1b,{'saveTo':_0x1899bc},function(_0xeb191b,_0x4c14be){if(_0xeb191b)return _0x1efa39(_0xeb191b);return _0x42a36d(_0x4c14be);});})[_0x0007('0x2f')](function(){return new BPromise(function(_0x56cd11,_0x2f1af2){rimraf(_0x852f1b,function(_0x25973a){if(_0x25973a)_0x2f1af2(_0x25973a);return _0x56cd11();});});})[_0x0007('0x2f')](function(){return _0x153506[_0x0007('0xcc')](_0x1899bc,_0x20aea8,function(_0x17fda6){if(_0x17fda6){console[_0x0007('0xee')](_0x0007('0xef'),_0x17fda6);}else{fs[_0x0007('0xf0')](_0x1899bc);}});});});}else{return _0x153506[_0x0007('0x31')](0xc8);}})['catch'](handleError(_0x153506,null));}; \ No newline at end of file +var _0x799b=['socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','offset','undefined','limit','set','Content-Range','json','reject','save','update','then','destroy','stack','name','send','map','TagIds','Tags','split','forEach','push','index','OpenchannelInteraction','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','select','field','from','u.id','u.fullname','left_join','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','openchannel_accounts','openchannel_messages','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','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?','ContactId','buildExpression','text','start','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','type','body','some','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','parse','$gte','$lte','null','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)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','Contact.firstName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','rows','catch','show','params','includeAll','include','options','create','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','OpenchannelInteractionId','format','count','findAll','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','fullname','CmContact','firstName','lastName','Messages','direction','secret','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Public','Private','Attachment','basename','createReadStream','pipe','createWriteStream','out','System','Contact','renderFile','views','transcript-','.pdf','log','err','rimraf','zip-dir','fast-json-patch','moment','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x36cbe0,_0x45ddaa){var _0x876529=function(_0x14c6fb){while(--_0x14c6fb){_0x36cbe0['push'](_0x36cbe0['shift']());}};_0x876529(++_0x45ddaa);}(_0x799b,0xd5));var _0xb799=function(_0x29b8e3,_0x508f07){_0x29b8e3=_0x29b8e3-0x0;var _0x4039f0=_0x799b[_0x29b8e3];return _0x4039f0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb799('0x0'));var zipdir=require(_0xb799('0x1'));var jsonpatch=require(_0xb799('0x2'));var rp=require('request-promise');var moment=require(_0xb799('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb799('0x4'));var path=require(_0xb799('0x5'));var sox=require('sox');var csv=require(_0xb799('0x6'));var ejs=require(_0xb799('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb799('0x8'));var squel=require(_0xb799('0x9'));var crypto=require(_0xb799('0xa'));var jsforce=require(_0xb799('0xb'));var deskjs=require(_0xb799('0xc'));var toCsv=require(_0xb799('0x6'));var querystring=require(_0xb799('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0xb799('0xe'));var hardwareService=require(_0xb799('0xf'));var logger=require(_0xb799('0x10'))('api');var utils=require(_0xb799('0x11'));var config=require(_0xb799('0x12'));var licenseUtil=require(_0xb799('0x13'));var db=require(_0xb799('0x14'))['db'];config[_0xb799('0x15')]=_[_0xb799('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb799('0x17'))(new Redis(config['redis']));require(_0xb799('0x18'))[_0xb799('0x19')](socket);function respondWithStatusCode(_0x470613,_0x258a9f){_0x258a9f=_0x258a9f||0xcc;return function(_0xeb7d1){if(_0xeb7d1){return _0x470613[_0xb799('0x1a')](_0x258a9f);}return _0x470613[_0xb799('0x1b')](_0x258a9f)['end']();};}function respondWithResult(_0xe0afc1,_0x4a5e45){_0x4a5e45=_0x4a5e45||0xc8;return function(_0x123ee1){if(_0x123ee1){return _0xe0afc1[_0xb799('0x1b')](_0x4a5e45)['json'](_0x123ee1);}};}function respondWithFilteredResult(_0x420ef7,_0x3d3a81){return function(_0x2f7761){if(_0x2f7761){var _0x4aa3a2=typeof _0x3d3a81[_0xb799('0x1c')]===_0xb799('0x1d')&&typeof _0x3d3a81[_0xb799('0x1e')]===_0xb799('0x1d');var _0xff442e=_0x2f7761['count'];var _0x101e9c=_0x4aa3a2?0x0:_0x3d3a81['offset'];var _0x5ecc71=_0x4aa3a2?_0x2f7761['count']:_0x3d3a81[_0xb799('0x1c')]+_0x3d3a81[_0xb799('0x1e')];var _0x8f535d;if(_0x5ecc71>=_0xff442e){_0x5ecc71=_0xff442e;_0x8f535d=0xc8;}else{_0x8f535d=0xce;}_0x420ef7[_0xb799('0x1b')](_0x8f535d);return _0x420ef7[_0xb799('0x1f')](_0xb799('0x20'),_0x101e9c+'-'+_0x5ecc71+'/'+_0xff442e)[_0xb799('0x21')](_0x2f7761);}return null;};}function patchUpdates(_0x27b8e9){return function(_0x1870a9){try{jsonpatch['apply'](_0x1870a9,_0x27b8e9,!![]);}catch(_0x26cf8d){return BPromise[_0xb799('0x22')](_0x26cf8d);}return _0x1870a9[_0xb799('0x23')]();};}function saveUpdates(_0x414482,_0x2979bf){return function(_0x36b1a4){if(_0x36b1a4){return _0x36b1a4[_0xb799('0x24')](_0x414482)[_0xb799('0x25')](function(_0x378597){return _0x378597;});}return null;};}function removeEntity(_0x42cc0f,_0x11d94b){return function(_0x80bb77){if(_0x80bb77){return _0x80bb77[_0xb799('0x26')]()['then'](function(){_0x42cc0f[_0xb799('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x430765,_0x2c8779){return function(_0x2755e5){if(!_0x2755e5){_0x430765[_0xb799('0x1a')](0x194);}return _0x2755e5;};}function handleError(_0x5937cd,_0x4bab54){_0x4bab54=_0x4bab54||0x1f4;return function(_0x4c7419){logger['error'](_0x4c7419[_0xb799('0x27')]);if(_0x4c7419['name']){delete _0x4c7419[_0xb799('0x28')];}_0x5937cd[_0xb799('0x1b')](_0x4bab54)[_0xb799('0x29')](_0x4c7419);};}function getInteractionUsers(_0xddf4b7,_0x186c9d){return new BPromise(function(_0x4b5e8d,_0x532bdc){try{if(_0x186c9d[_0xddf4b7['id']]){_0xddf4b7['Users']=_[_0xb799('0x2a')](_0x186c9d[_0xddf4b7['id']],function(_0x3a34d8){return{'id':_0x3a34d8['id'],'fullname':_0x3a34d8['fullname']};});}}catch(_0x1f2e07){_0x532bdc(_0x1f2e07);}_0x4b5e8d(_0xddf4b7);});}function getInteractionTags(_0xb835f4,_0xf5fd0){return new BPromise(function(_0x118ff7,_0x4144e4){try{if(_0xb835f4[_0xb799('0x2b')]){_0xb835f4[_0xb799('0x2c')]=[];_0xb835f4['TagIds'][_0xb799('0x2d')](',')[_0xb799('0x2e')](function(_0x45669b){_0xb835f4[_0xb799('0x2c')][_0xb799('0x2f')](_0xf5fd0[_0x45669b]);});}delete _0xb835f4[_0xb799('0x2b')];}catch(_0x54936e){_0x4144e4(_0x54936e);}_0x118ff7(_0xb835f4);});}function updateOpenchannelInteraction(_0x327452,_0x2f96cf,_0xac7704){return new BPromise(function(_0xfbec51,_0xb9b17c){return getInteractionUsers(_0x327452,_0xac7704)['then'](function(_0x516b3a){return getInteractionTags(_0x516b3a,_0x2f96cf);})['then'](function(_0x10e488){_0xfbec51(_0x10e488);})['catch'](function(_0x4f631b){_0xb9b17c(_0x4f631b);});});}exports[_0xb799('0x30')]=function(_0x56f5ee,_0x43a267){var _0x19a65e={},_0x92cb42={},_0x3c6a91={'count':0x0,'rows':[]};var _0x1e3ab4=_[_0xb799('0x2a')](db[_0xb799('0x31')][_0xb799('0x32')],function(_0x378bdb){return{'name':_0x378bdb['fieldName'],'type':_0x378bdb['type'][_0xb799('0x33')]};});_0x92cb42[_0xb799('0x34')]=_[_0xb799('0x2a')](_0x1e3ab4,'name');_0x92cb42[_0xb799('0x35')]=_[_0xb799('0x36')](_0x56f5ee[_0xb799('0x35')]);_0x92cb42[_0xb799('0x37')]=_[_0xb799('0x38')](_0x92cb42[_0xb799('0x34')],_0x92cb42[_0xb799('0x35')]);_0x19a65e[_0xb799('0x39')]=_[_0xb799('0x38')](_0x92cb42[_0xb799('0x34')],qs[_0xb799('0x3a')](_0x56f5ee[_0xb799('0x35')][_0xb799('0x3a')]));_0x19a65e[_0xb799('0x39')]=_0x19a65e[_0xb799('0x39')][_0xb799('0x3b')]?_0x19a65e['attributes']:_0x92cb42[_0xb799('0x34')];if(!_0x56f5ee['query'][_0xb799('0x3c')](_0xb799('0x3d'))){_0x19a65e[_0xb799('0x1e')]=qs[_0xb799('0x1e')](_0x56f5ee[_0xb799('0x35')][_0xb799('0x1e')]);_0x19a65e['offset']=qs[_0xb799('0x1c')](_0x56f5ee[_0xb799('0x35')][_0xb799('0x1c')]);}_0x19a65e[_0xb799('0x3e')]=qs[_0xb799('0x3f')](_0x56f5ee[_0xb799('0x35')]['sort']);_0x19a65e['where']=qs[_0xb799('0x37')](_['pick'](_0x56f5ee[_0xb799('0x35')],_0x92cb42[_0xb799('0x37')]),_0x1e3ab4);var _0x32e57d=[];var _0x54fe26=squel[_0xb799('0x40')]()[_0xb799('0x41')]('id')[_0xb799('0x41')](_0xb799('0x28'))[_0xb799('0x41')]('color')[_0xb799('0x42')]('tools_tags');var _0x26f7f4=squel[_0xb799('0x40')]()[_0xb799('0x41')](_0xb799('0x43'))[_0xb799('0x41')](_0xb799('0x44'))['field']('ui.OpenchannelInteractionId')['from']('user_has_openchannel_interactions','ui')[_0xb799('0x45')]('users','u',_0xb799('0x46'));var _0x4beed9=squel[_0xb799('0x40')]()[_0xb799('0x42')]('openchannel_interactions','i')[_0xb799('0x45')]('cm_contacts','c',_0xb799('0x47'))['left_join'](_0xb799('0x48'),'o',_0xb799('0x49'))[_0xb799('0x45')](_0xb799('0x4a'),'a','a.id\x20=\x20i.OpenchannelAccountId')['left_join'](_0xb799('0x4b'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0xb799('0x45')](_0xb799('0x4c'),'it',_0xb799('0x4d'))[_0xb799('0x45')](_0xb799('0x4e'),'t',_0xb799('0x4f'));var _0x546f44=squel[_0xb799('0x50')]();var _0x1ce75f=[];var _0x327204=squel[_0xb799('0x50')]();var _0x22030b;if(_0x56f5ee[_0xb799('0x35')]['search']){_0x22030b=as[_0xb799('0x51')](_0x56f5ee[_0xb799('0x35')][_0xb799('0x52')]);var _0x2e6bf9=_0x22030b['sqlOperator'];for(var _0x48faaa=0x0;_0x48faaa<_0x22030b[_0xb799('0x53')][_0xb799('0x3b')];_0x48faaa++){var _0xcfed9e=_0x22030b[_0xb799('0x53')][_0x48faaa];var _0x28ff73='i';var _0x39ee8b=_[_0xb799('0x54')](_0x1e3ab4,[_0xb799('0x28'),_0xcfed9e[_0xb799('0x41')]]);if(!_0x39ee8b){switch(_0xcfed9e['field']){case _0xb799('0x55'):if(_0xcfed9e['value']==0x1){_0x4beed9[_0xb799('0x56')]('`'+_0xcfed9e[_0xb799('0x41')]+_0xb799('0x57'));}else{_0x4beed9[_0xb799('0x56')]('`'+_0xcfed9e[_0xb799('0x41')]+_0xb799('0x58'));}break;case'Contact':if(_0xcfed9e[_0xb799('0x59')]===_0xb799('0x5a')){if(_0xcfed9e[_0xb799('0x5b')][_0xb799('0x2d')]('\x20')[_0xb799('0x3b')]>0x1){_0x546f44[_0x2e6bf9](_0xb799('0x5c'),qs[_0xb799('0x5d')](_0xcfed9e[_0xb799('0x5b')]),null);}else{var _0x3cc0dc='%'+_0xcfed9e['value']+'%';_0x546f44[_0x2e6bf9](_0xb799('0x5e'),_0x3cc0dc,_0x3cc0dc,_0x3cc0dc);}}else{_0x39ee8b=_[_0xb799('0x54')](_0x1e3ab4,[_0xb799('0x28'),_0xb799('0x5f')]);_0xcfed9e['field']=_0xb799('0x5f');_0x3b208b=as[_0xb799('0x60')](_0x28ff73,_0x39ee8b['type'],_0xcfed9e);_0x546f44[_0x2e6bf9](_0x3b208b[_0xb799('0x61')],_0x3b208b[_0xb799('0x5b')][_0xb799('0x62')],_0x3b208b[_0xb799('0x5b')][_0xb799('0x63')]);}break;case _0xb799('0x64'):var _0x4621f7=_0xcfed9e['value']['split'](',')[_0xb799('0x2a')](function(_0x567471){return Number(_0x567471);});_0x4621f7[_0xb799('0x2e')](function(_0x11cde6){_0x327204['or'](_0xb799('0x65'),'%,'+_0x11cde6+',%');});_0x1ce75f=_[_0xb799('0x66')](_0x1ce75f,_0x4621f7);break;case _0xb799('0x67'):if(_0xcfed9e['operator']===_0xb799('0x5a')){_0x546f44[_0x2e6bf9](_0xb799('0x68'),'%'+_0xcfed9e[_0xb799('0x5b')]+'%',null);}else{_0x39ee8b=_[_0xb799('0x54')](_0x1e3ab4,[_0xb799('0x28'),_0xb799('0x69')]);_0xcfed9e[_0xb799('0x41')]=_0xb799('0x69');_0x3b208b=as[_0xb799('0x60')](_0x28ff73,_0x39ee8b[_0xb799('0x6a')],_0xcfed9e);_0x546f44[_0x2e6bf9](_0x3b208b[_0xb799('0x61')],_0x3b208b[_0xb799('0x5b')][_0xb799('0x62')],_0x3b208b['value'][_0xb799('0x63')]);}break;case _0xb799('0x6b'):_0x3b208b=as[_0xb799('0x60')]('me',null,_0xcfed9e);_0x546f44[_0x2e6bf9](_0x3b208b[_0xb799('0x61')],_0x3b208b[_0xb799('0x5b')][_0xb799('0x62')],_0x3b208b[_0xb799('0x5b')][_0xb799('0x63')]);break;}}else{var _0x3b208b=as['buildExpression'](_0x28ff73,_0x39ee8b[_0xb799('0x6a')],_0xcfed9e);_0x546f44[_0x2e6bf9](_0x3b208b['text'],_0x3b208b['value'][_0xb799('0x62')],_0x3b208b[_0xb799('0x5b')][_0xb799('0x63')]);}}}else{var _0x1b72ee=_(_0x56f5ee[_0xb799('0x35')])[_0xb799('0x36')]()[_0xb799('0x2a')](function(_0x13baad){return _[_0xb799('0x6c')](_0x1e3ab4,['name',_0x13baad])?_0x13baad:undefined;})[_0xb799('0x6d')]()[_0xb799('0x5b')]();if(!_[_0xb799('0x6e')](_0x1b72ee)){_0x1b72ee[_0xb799('0x2e')](function(_0x3ddc87){if(_0x3ddc87===_0xb799('0x6f')){_0x4beed9[_0xb799('0x70')](_0xb799('0x71'),[][_0xb799('0x72')](_0x56f5ee[_0xb799('0x35')][_0x3ddc87]));}else if(_0x3ddc87==='createdAt'){var _0x15a7e0=JSON[_0xb799('0x73')](_0x56f5ee[_0xb799('0x35')][_0x3ddc87])[_0xb799('0x74')];var _0x1a6238=JSON['parse'](_0x56f5ee[_0xb799('0x35')][_0x3ddc87])[_0xb799('0x75')];_0x4beed9[_0xb799('0x70')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x15a7e0,_0x1a6238);}else{if(_0x56f5ee[_0xb799('0x35')][_0x3ddc87]===_0xb799('0x76')){_0x4beed9[_0xb799('0x70')]('i.'+_0x3ddc87+'\x20IS\x20NULL');}else{_0x4beed9[_0xb799('0x70')]('i.'+_0x3ddc87+'\x20=\x20?',_0x56f5ee[_0xb799('0x35')][_0x3ddc87]);}}});}if(_0x56f5ee[_0xb799('0x35')][_0xb799('0x77')]){if(_0x56f5ee[_0xb799('0x35')][_0xb799('0x77')]==0x1){_0x4beed9[_0xb799('0x56')](_0xb799('0x78'));}else{_0x4beed9['having'](_0xb799('0x79'));}}if(_0x56f5ee[_0xb799('0x35')][_0xb799('0x7a')]){_0x1ce75f=_[_0xb799('0x7b')](_0x56f5ee[_0xb799('0x35')][_0xb799('0x7a')])?_0x56f5ee[_0xb799('0x35')][_0xb799('0x7a')]:new Array(_0x56f5ee[_0xb799('0x35')][_0xb799('0x7a')]);_0x1ce75f[_0xb799('0x2e')](function(_0x2c5d5e){_0x327204['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2c5d5e+',%');});}if(_0x56f5ee[_0xb799('0x35')][_0xb799('0x7c')]){var _0x200501=_0x56f5ee[_0xb799('0x35')][_0xb799('0x7c')][_0xb799('0x7d')]('\x5c','\x5c\x5c')[_0xb799('0x7d')](/'/g,'\x27\x27');if(qs[_0xb799('0x7e')](_0x200501)){_0x546f44['or'](_0xb799('0x7f'),_0x200501+'%');}else{_0x546f44['or'](_0xb799('0x80'),qs['getFullTextValue'](_0x200501))['or']('i.from\x20LIKE\x20?',_0x200501+'%')['or'](_0xb799('0x81'),_0x200501+'%');}}}_0x4beed9['where'](_0x546f44);_0x4beed9[_0xb799('0x82')]('i.id');var _0xeca5c7={'type':db[_0xb799('0x83')][_0xb799('0x84')][_0xb799('0x85')],'raw':!![]};var _0x5f8765=_0x4beed9['clone']();_0x5f8765[_0xb799('0x41')](_0xb799('0x86'));_0x5f8765['field'](_0xb799('0x87'),_0xb799('0x55'));if(_0x19a65e[_0xb799('0x3e')]){_0x19a65e[_0xb799('0x3e')]['forEach'](function(_0x52bf6b){var _0x488049=_0x52bf6b[0x0]==='contactName'?_0x52bf6b[0x0]:'i.'+_0x52bf6b[0x0];_0x4beed9['order'](_0x488049,_0x52bf6b[0x1]===_0xb799('0x88')?![]:!![]);});}if(!_[_0xb799('0x6e')](_0x1ce75f)){_0x4beed9[_0xb799('0x56')](_0x327204);_0x5f8765[_0xb799('0x70')](_0xb799('0x89'),_0x1ce75f);}BPromise['resolve']()['then'](function(){if(!_0x22030b){if(_0x56f5ee['query'][_0xb799('0x6f')])return;_0x5f8765[_0xb799('0x70')](_0xb799('0x8a'));_0x4beed9['where'](_0xb799('0x8a'));return;}if(_0x56f5ee[_0xb799('0x8b')][_0xb799('0x8c')]!==_0xb799('0x8d'))return;return _0x56f5ee[_0xb799('0x8b')][_0xb799('0x8e')]({'attributes':['id'],'raw':!![]})[_0xb799('0x25')](function(_0x5761f9){if(_[_0xb799('0x6e')](_0x5761f9)){_0x5f8765[_0xb799('0x70')](_0xb799('0x8f'));_0x4beed9['where'](_0xb799('0x8f'));}else{_0x5f8765[_0xb799('0x70')](_0xb799('0x71'),_['map'](_0x5761f9,'id'));_0x4beed9[_0xb799('0x70')](_0xb799('0x71'),_[_0xb799('0x2a')](_0x5761f9,'id'));}});})[_0xb799('0x25')](function(){if(_0x56f5ee[_0xb799('0x8b')]['role']===_0xb799('0x8d')&&!_0x22030b&&!_0x56f5ee[_0xb799('0x35')][_0xb799('0x6f')])return[];return db[_0xb799('0x90')][_0xb799('0x35')](_0x5f8765[_0xb799('0x91')](),_0xeca5c7);})['then'](function(_0x52e665){_0x3c6a91['count']=_0x52e665[_0xb799('0x3b')];if(_0x3c6a91['count']===0x0)return[];return db[_0xb799('0x90')][_0xb799('0x35')](_0x54fe26['toString'](),_0xeca5c7)[_0xb799('0x25')](function(_0x237a43){_0x32e57d=_[_0xb799('0x92')](_0x237a43,'id');_0xeca5c7=_[_0xb799('0x93')](_0xeca5c7,{'model':db[_0xb799('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x56f5ee[_0xb799('0x35')][_0xb799('0x3a')]){_0x19a65e[_0xb799('0x39')][_0xb799('0x2e')](function(_0x56c7eb){_0x4beed9[_0xb799('0x41')]('i.'+_0x56c7eb);});}else{_0x4beed9['field'](_0xb799('0x87'),_0xb799('0x55'));_0x4beed9[_0xb799('0x41')]('a.key','Account.key');_0x4beed9[_0xb799('0x41')](_0xb799('0x94'),_0xb799('0x95'));_0x4beed9[_0xb799('0x41')](_0xb799('0x96'),_0xb799('0x97'));_0x4beed9['field'](_0xb799('0x98'));_0x4beed9[_0xb799('0x41')]('c.firstName',_0xb799('0x99'));_0x4beed9[_0xb799('0x41')]('c.lastName',_0xb799('0x9a'));_0x4beed9['field']('c.email',_0xb799('0x9b'));_0x4beed9[_0xb799('0x41')](_0xb799('0x9c'),_0xb799('0x9d'));_0x4beed9['field'](_0xb799('0x9e'),_0xb799('0x9f'));_0x4beed9['field']('c.fax',_0xb799('0xa0'));_0x4beed9[_0xb799('0x41')](_0xb799('0xa1'),'Owner.fullname');_0x4beed9[_0xb799('0x41')](_0xb799('0xa2'),_0xb799('0xa3'));_0x4beed9[_0xb799('0x41')](_0xb799('0xa4'),_0xb799('0x2b'));}if(_0x19a65e[_0xb799('0x1e')])_0x4beed9[_0xb799('0x1e')](_0x19a65e[_0xb799('0x1e')]);if(_0x19a65e[_0xb799('0x1c')])_0x4beed9[_0xb799('0x1c')](_0x19a65e[_0xb799('0x1c')]);return db[_0xb799('0x90')][_0xb799('0x35')](_0x4beed9['toString'](),_0xeca5c7);})[_0xb799('0x25')](function(_0x21ddd7){if(_0x21ddd7[_0xb799('0x3b')]>0x0)_0x26f7f4['where'](_0xb799('0xa5'),_['map'](_0x21ddd7,'id'));return db[_0xb799('0x90')][_0xb799('0x35')](_0x26f7f4[_0xb799('0x91')](),_0xeca5c7)[_0xb799('0x25')](function(_0x2f7b52){var _0x2fdd76=_['groupBy'](_0x2f7b52,'OpenchannelInteractionId');var _0x1c2db0=[];_0x21ddd7[_0xb799('0x2e')](function(_0x3afa05){_0x1c2db0[_0xb799('0x2f')](updateOpenchannelInteraction(_0x3afa05,_0x32e57d,_0x2fdd76));});return BPromise['all'](_0x1c2db0);});});})[_0xb799('0x25')](function(_0x4ae8e5){_0x3c6a91[_0xb799('0xa6')]=_0x4ae8e5;return _0x3c6a91;})[_0xb799('0x25')](respondWithFilteredResult(_0x43a267,_0x19a65e))[_0xb799('0xa7')](handleError(_0x43a267,null));};exports[_0xb799('0xa8')]=function(_0x1849bd,_0x49c51c){var _0x373c4f={};if(_0x1849bd[_0xb799('0x35')][_0xb799('0x6a')]&&_0x1849bd[_0xb799('0x35')]['type']==='from'){_0x373c4f[_0xb799('0x42')]=_0x1849bd[_0xb799('0xa9')]['id'];}else{_0x373c4f['id']=_0x1849bd[_0xb799('0xa9')]['id'];}var _0x10e406={'raw':![],'where':_0x373c4f},_0xfc3c82={};_0xfc3c82['model']=_['keys'](db[_0xb799('0x31')][_0xb799('0x32')]);_0xfc3c82[_0xb799('0x35')]=_[_0xb799('0x36')](_0x1849bd[_0xb799('0x35')]);_0xfc3c82[_0xb799('0x37')]=_[_0xb799('0x38')](_0xfc3c82[_0xb799('0x34')],_0xfc3c82[_0xb799('0x35')]);_0x10e406[_0xb799('0x39')]=_[_0xb799('0x38')](_0xfc3c82['model'],qs[_0xb799('0x3a')](_0x1849bd[_0xb799('0x35')][_0xb799('0x3a')]));_0x10e406['attributes']=_0x10e406[_0xb799('0x39')][_0xb799('0x3b')]?_0x10e406[_0xb799('0x39')]:_0xfc3c82[_0xb799('0x34')];if(_0x1849bd['query'][_0xb799('0xaa')]){_0x10e406[_0xb799('0xab')]=[{'all':!![]}];}_0x10e406=_[_0xb799('0x93')]({},_0x10e406,_0x1849bd[_0xb799('0xac')]);return db[_0xb799('0x31')]['find'](_0x10e406)[_0xb799('0x25')](handleEntityNotFound(_0x49c51c,null))['then'](respondWithResult(_0x49c51c,null))['catch'](handleError(_0x49c51c,null));};exports[_0xb799('0xad')]=function(_0x4aadc9,_0xb219b9){return db[_0xb799('0x31')][_0xb799('0xad')](_0x4aadc9['body'],{})[_0xb799('0x25')](respondWithResult(_0xb219b9,0xc9))['catch'](handleError(_0xb219b9,null));};exports[_0xb799('0x24')]=function(_0xca2c00,_0x26a91c){if(_0xca2c00[_0xb799('0x6b')]['id']){delete _0xca2c00[_0xb799('0x6b')]['id'];}return db[_0xb799('0x31')][_0xb799('0x54')]({'where':{'id':_0xca2c00[_0xb799('0xa9')]['id']}})['then'](handleEntityNotFound(_0x26a91c,null))[_0xb799('0x25')](saveUpdates(_0xca2c00[_0xb799('0x6b')],null))[_0xb799('0x25')](respondWithResult(_0x26a91c,null))[_0xb799('0xa7')](handleError(_0x26a91c,null));};exports[_0xb799('0x26')]=function(_0x21d28f,_0x1304d2){return db[_0xb799('0x31')][_0xb799('0x54')]({'where':{'id':_0x21d28f[_0xb799('0xa9')]['id']}})['then'](handleEntityNotFound(_0x1304d2,null))[_0xb799('0x25')](removeEntity(_0x1304d2,null))['catch'](handleError(_0x1304d2,null));};exports[_0xb799('0xae')]=function(_0x465322,_0x319b8c){return db[_0xb799('0x31')][_0xb799('0xae')]()['then'](respondWithResult(_0x319b8c,null))[_0xb799('0xa7')](handleError(_0x319b8c,null));};exports[_0xb799('0xaf')]=function(_0x19b432,_0x4511f7,_0x4c564d){return db['OpenchannelMessage'][_0xb799('0x54')]({'where':{'id':_0x19b432[_0xb799('0xa9')]['id']}})[_0xb799('0x25')](handleEntityNotFound(_0x4511f7,null))['then'](function(_0x2af4da){if(_0x2af4da){return _0x2af4da['addMessage'](_0x19b432['body'][_0xb799('0xb0')],_[_0xb799('0xb1')](_0x19b432[_0xb799('0x6b')],['ids','id'])||{});}})[_0xb799('0x25')](respondWithResult(_0x4511f7,null))['catch'](handleError(_0x4511f7,null));};exports[_0xb799('0xb2')]=function(_0xfe67fb,_0x4f10d2,_0x61ffb0){var _0x365361={'raw':![],'where':{}};var _0x17ddd9={};var _0x28e099={'count':0x0,'rows':[]};return db[_0xb799('0x31')][_0xb799('0xb3')]({'where':{'id':_0xfe67fb[_0xb799('0xa9')]['id']}})[_0xb799('0x25')](handleEntityNotFound(_0x4f10d2,null))[_0xb799('0x25')](function(_0x43b975){if(_0x43b975){_0x17ddd9[_0xb799('0x34')]=_[_0xb799('0x36')](db[_0xb799('0xb4')][_0xb799('0x32')]);_0x17ddd9[_0xb799('0x35')]=_[_0xb799('0x36')](_0xfe67fb['query']);_0x17ddd9[_0xb799('0x37')]=_['intersection'](_0x17ddd9[_0xb799('0x34')],_0x17ddd9[_0xb799('0x35')]);_0x365361[_0xb799('0x39')]=_[_0xb799('0x38')](_0x17ddd9[_0xb799('0x34')],qs[_0xb799('0x3a')](_0xfe67fb[_0xb799('0x35')][_0xb799('0x3a')]));_0x365361[_0xb799('0x39')]=_0x365361['attributes']['length']?_0x365361[_0xb799('0x39')]:_0x17ddd9[_0xb799('0x34')];if(!_0xfe67fb['query']['hasOwnProperty'](_0xb799('0x3d'))){_0x365361[_0xb799('0x1e')]=qs[_0xb799('0x1e')](_0xfe67fb[_0xb799('0x35')][_0xb799('0x1e')]);_0x365361[_0xb799('0x1c')]=qs[_0xb799('0x1c')](_0xfe67fb['query'][_0xb799('0x1c')]);}_0x365361[_0xb799('0x3e')]=qs[_0xb799('0x3f')](_0xfe67fb[_0xb799('0x35')][_0xb799('0x3f')]);_0x365361['where']=qs[_0xb799('0x37')](_['pick'](_0xfe67fb[_0xb799('0x35')],_0x17ddd9[_0xb799('0x37')]));_0x365361[_0xb799('0x70')][_0xb799('0xb5')]=_0x43b975['id'];if(_0xfe67fb['query'][_0xb799('0x7c')]){_0x365361[_0xb799('0x70')]=_[_0xb799('0x93')](_0x365361['where'],{'$or':_[_0xb799('0x2a')](_0x365361[_0xb799('0x39')],function(_0x13f4ed){var _0xda3feb={};_0xda3feb[_0x13f4ed]={'$like':'%'+_0xfe67fb[_0xb799('0x35')][_0xb799('0x7c')]+'%'};return _0xda3feb;})});}if(_0xfe67fb['query']['$gte']){var _0x5c87f4=_0xfe67fb['query'][_0xb799('0x74')][_0xb799('0x2d')](',');var _0x47e132={};_0x47e132[_0x5c87f4[0x0]]={'$gte':moment(_0x5c87f4[0x1])[_0xb799('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')};_0x365361[_0xb799('0x70')]=_[_0xb799('0x93')](_0x365361['where'],_0x47e132);}_0x365361=_['merge']({},_0x365361,_0xfe67fb[_0xb799('0xac')]);return db[_0xb799('0xb4')][_0xb799('0xb7')]({'where':_0x365361[_0xb799('0x70')]})[_0xb799('0x25')](function(_0x3208b4){_0x28e099[_0xb799('0xb7')]=_0x3208b4;if(_0xfe67fb[_0xb799('0x35')][_0xb799('0xaa')]){_0x365361[_0xb799('0xab')]=[{'all':!![]}];}return db[_0xb799('0xb4')][_0xb799('0xb8')](_0x365361);})[_0xb799('0x25')](function(_0x297fb1){_0x28e099[_0xb799('0xa6')]=_0x297fb1;return _0x28e099;});}})[_0xb799('0x25')](respondWithFilteredResult(_0x4f10d2,_0x365361))[_0xb799('0xa7')](handleError(_0x4f10d2,null));};exports[_0xb799('0xb9')]=function(_0x4ccca2,_0x306b6f,_0x3194c9){return db[_0xb799('0x31')]['find']({'where':{'id':_0x4ccca2[_0xb799('0xa9')]['id']}})[_0xb799('0x25')](handleEntityNotFound(_0x306b6f,null))[_0xb799('0x25')](function(_0xc6250){if(_0xc6250){return _0xc6250[_0xb799('0xba')](_0x4ccca2[_0xb799('0x6b')][_0xb799('0xb0')],_[_0xb799('0xb1')](_0x4ccca2['body'],[_0xb799('0xb0'),'id'])||{})[_0xb799('0xbb')](function(){return db[_0xb799('0x64')]['findAll']({'attributes':['id',_0xb799('0x28'),_0xb799('0xbc')],'where':{'id':_0x4ccca2[_0xb799('0x6b')][_0xb799('0xb0')]}});})[_0xb799('0x25')](function(_0x4615fa){socket[_0xb799('0xbd')](_0xb799('0xbe'),{'id':Number(_0x4ccca2['params']['id']),'tags':_0x4615fa||[]});return{'id':Number(_0x4ccca2[_0xb799('0xa9')]['id']),'tags':_0x4615fa||[]};});}})[_0xb799('0x25')](respondWithResult(_0x306b6f,null))[_0xb799('0xa7')](handleError(_0x306b6f,null));};exports[_0xb799('0xbf')]=function(_0x16a7f6,_0x1e5a94,_0x15a3e6){return db[_0xb799('0x31')][_0xb799('0x54')]({'where':{'id':_0x16a7f6[_0xb799('0xa9')]['id']}})[_0xb799('0x25')](handleEntityNotFound(_0x1e5a94,null))[_0xb799('0x25')](function(_0x2c5471){if(_0x2c5471){return _0x2c5471[_0xb799('0xbf')](_0x16a7f6[_0xb799('0x35')][_0xb799('0xb0')]);}})[_0xb799('0x25')](respondWithStatusCode(_0x1e5a94,null))[_0xb799('0xa7')](handleError(_0x1e5a94,null));};exports[_0xb799('0xc0')]=function(_0x18abab,_0x4b8c32){var _0x153591=moment()[_0xb799('0xc1')]()[_0xb799('0x91')]();var _0x4657f4=path[_0xb799('0xc2')](config[_0xb799('0xc3')],_0xb799('0xc4'),_0xb799('0xc5'),_0xb799('0xc6'));var _0x338a31=path[_0xb799('0xc2')](config[_0xb799('0xc3')],_0xb799('0xc4'),'files',_0xb799('0xc7'));var _0x5db9b1=path[_0xb799('0xc2')](_0x4657f4,_0x153591);var _0xeed2c6=util[_0xb799('0xb6')](_0xb799('0xc8'),_0x18abab['params']['id'],_0x153591);var _0xc27d08=path[_0xb799('0xc2')](_0x4657f4,_0xeed2c6);var _0x18e00b=[];_0x18e00b[_0xb799('0x2f')]({'model':db[_0xb799('0x67')],'as':'User','attributes':['id',_0xb799('0xc9')],'raw':!![]});_0x18e00b[_0xb799('0x2f')]({'model':db[_0xb799('0xca')],'as':'Contact','attributes':['id',_0xb799('0xcb'),_0xb799('0xcc')],'raw':!![]});if(_0x18abab[_0xb799('0x35')][_0xb799('0xc7')]){_0x18e00b[_0xb799('0x2f')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});}var _0x1f7107=[{'model':db[_0xb799('0xb4')],'as':_0xb799('0xcd'),'attributes':['id',_0xb799('0x6b'),'createdAt',_0xb799('0xce'),_0xb799('0xcf'),_0xb799('0x77')],'include':_0x18e00b}];_0x1f7107[_0xb799('0x2f')]({'model':db[_0xb799('0xd0')],'as':_0xb799('0xd1'),'attributes':['id',_0xb799('0x28')]});_0x1f7107[_0xb799('0x2f')]({'model':db[_0xb799('0x67')],'as':'Owner','attributes':['id',_0xb799('0xc9')]});return db[_0xb799('0x31')][_0xb799('0x54')]({'where':{'id':_0x18abab[_0xb799('0xa9')]['id']},'include':_0x1f7107})[_0xb799('0x25')](handleEntityNotFound(_0x4b8c32,null))['then'](function(_0x54ef6f){if(_0x54ef6f){var _0x2bd820=_0x54ef6f[_0xb799('0xd2')]({'plain':!![]});fs[_0xb799('0xd3')](_0x5db9b1);var _0xd847cb={'channel':_0xb799('0xd4'),'account':_0x2bd820['Account'][_0xb799('0x28')],'agent':_0x2bd820[_0xb799('0xd5')]?_0x2bd820['Owner'][_0xb799('0xc9')]:_0xb799('0xd6'),'createdAt':moment(_0x2bd820[_0xb799('0xd7')])[_0xb799('0xb6')](_0xb799('0xd8'))[_0xb799('0x91')](),'closedAt':_0x2bd820[_0xb799('0xd9')]?moment(_0x2bd820[_0xb799('0xda')])[_0xb799('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb799('0x91')]():'','disposition':_0x2bd820[_0xb799('0xdb')],'visibility':_0x2bd820['threadId']?_0xb799('0xdc'):_0xb799('0xdd'),'messages':_(_0x2bd820[_0xb799('0xcd')])[_0xb799('0x7c')]({'secret':![]})[_0xb799('0x2a')](function(_0x33af74){if(_0x33af74[_0xb799('0xde')]){var _0x1f72cc=path[_0xb799('0xc2')](_0x338a31,_0x33af74[_0xb799('0xde')][_0xb799('0xdf')]);if(fs['existsSync'](_0x1f72cc)){fs[_0xb799('0xe0')](_0x1f72cc)[_0xb799('0xe1')](fs[_0xb799('0xe2')](path[_0xb799('0xc2')](_0x5db9b1,_0x33af74[_0xb799('0xde')][_0xb799('0xdf')])));}}return{'date':moment(_0x33af74[_0xb799('0xd7')])[_0xb799('0xb6')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb799('0x91')](),'sender':_0x33af74[_0xb799('0xce')]===_0xb799('0xe3')?_0x33af74[_0xb799('0x67')]?_0x33af74['User'][_0xb799('0xc9')]:_0xb799('0xe4'):_0x33af74[_0xb799('0xe5')]['firstName']+(_0x33af74[_0xb799('0xe5')][_0xb799('0xcc')]?'\x20'+_0x33af74[_0xb799('0xe5')]['lastName']:''),'body':_0x33af74[_0xb799('0xde')]?_0x33af74[_0xb799('0xde')][_0xb799('0xdf')]:_0x33af74[_0xb799('0x6b')],'direction':_0x33af74[_0xb799('0xce')]===_0xb799('0xe3')?'A':'C','secret':_0x33af74[_0xb799('0xcf')],'read':_0x33af74['read'],'attachment':_0x33af74[_0xb799('0xde')]};})['value']()};return ejs[_0xb799('0xe6')](path['join'](config[_0xb799('0xc3')],_0xb799('0xc4'),_0xb799('0xe7'),'downloadInteraction.ejs'),{'interaction':_0xd847cb})['then'](function(_0x3a60ca){var _0x497d06=path[_0xb799('0xc2')](_0x5db9b1,_0xb799('0xe8')+_0x2bd820['id']+'-'+_0x153591+_0xb799('0xe9'));var _0x5303d0={'path':_0x497d06,'channel':_0xb799('0xd4'),'interactionId':_0x2bd820['id']};return pdf['createPdfFromHTML'](_0x3a60ca,_0x5303d0);})[_0xb799('0x25')](function(){return new BPromise(function(_0x447e7f,_0x35cbb2){zipdir(_0x5db9b1,{'saveTo':_0xc27d08},function(_0x5c2603,_0x599a11){if(_0x5c2603)return _0x35cbb2(_0x5c2603);return _0x447e7f(_0x599a11);});})[_0xb799('0x25')](function(){return new BPromise(function(_0x20e91e,_0x46d0d1){rimraf(_0x5db9b1,function(_0x233134){if(_0x233134)_0x46d0d1(_0x233134);return _0x20e91e();});});})[_0xb799('0x25')](function(){return _0x4b8c32[_0xb799('0xc0')](_0xc27d08,_0xeed2c6,function(_0x89a1f2){if(_0x89a1f2){console[_0xb799('0xea')](_0xb799('0xeb'),_0x89a1f2);}else{fs['unlinkSync'](_0xc27d08);}});});});}else{return _0x4b8c32[_0xb799('0x1a')](0xc8);}})[_0xb799('0xa7')](handleError(_0x4b8c32,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index c6dd48b..04bb24d 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 _0xe10b=['save','remove','then','setDataValue','map','findAll','unreadMessages','emit','catch','exports','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners'];(function(_0x4927dc,_0x54b3f6){var _0x45e1c3=function(_0x45f4f7){while(--_0x45f4f7){_0x4927dc['push'](_0x4927dc['shift']());}};_0x45e1c3(++_0x54b3f6);}(_0xe10b,0x1f4));var _0xbe10=function(_0x410e4f,_0xd72138){_0x410e4f=_0x410e4f-0x0;var _0x4d1d6f=_0xe10b[_0x410e4f];return _0x4d1d6f;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0xbe10('0x0'))['db'][_0xbe10('0x1')];var OpenchannelMessage=require(_0xbe10('0x0'))['db'][_0xbe10('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xbe10('0x3')](0x0);var events={'afterCreate':_0xbe10('0x4'),'afterUpdate':'update','afterDestroy':_0xbe10('0x5')};function emitEvent(_0x4ef7fa){return function(_0x45e724,_0x8433d8,_0x5d4c2c){_0x45e724['getUsers']({'attributes':['id'],'raw':!![]})[_0xbe10('0x6')](function(_0x1bb39a){_0x45e724[_0xbe10('0x7')]('Users',_0x1bb39a[_0xbe10('0x8')](function(_0x2779c2){return{'id':_0x2779c2['id']};}));return OpenchannelMessage[_0xbe10('0x9')]({'where':{'OpenchannelInteractionId':_0x45e724['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbe10('0x6')](function(_0x42311e){_0x45e724[_0xbe10('0x7')](_0xbe10('0xa'),_0x42311e['length']);OpenchannelInteractionEvents[_0xbe10('0xb')](_0x4ef7fa+':'+_0x45e724['id'],_0x45e724);OpenchannelInteractionEvents['emit'](_0x4ef7fa,_0x45e724);_0x5d4c2c(null);})[_0xbe10('0xc')](_0x5d4c2c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xbe10('0xd')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x468a=['emit','catch','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','update','remove','map','findAll','then','setDataValue','unreadMessages','length'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x468a,0x123));var _0xa468=function(_0x2a5181,_0x53edb6){_0x2a5181=_0x2a5181-0x0;var _0x23c87d=_0x468a[_0x2a5181];return _0x23c87d;};'use strict';var EventEmitter=require(_0xa468('0x0'));var OpenchannelInteraction=require(_0xa468('0x1'))['db'][_0xa468('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xa468('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa468('0x4'),'afterUpdate':_0xa468('0x5'),'afterDestroy':_0xa468('0x6')};function emitEvent(_0x5b0fe0){return function(_0x237117,_0xabc26a,_0x55ca2e){_0x237117['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x2194f5){_0x237117['setDataValue']('Users',_0x2194f5[_0xa468('0x7')](function(_0x9474aa){return{'id':_0x9474aa['id']};}));return OpenchannelMessage[_0xa468('0x8')]({'where':{'OpenchannelInteractionId':_0x237117['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa468('0x9')](function(_0x25ef39){_0x237117[_0xa468('0xa')](_0xa468('0xb'),_0x25ef39[_0xa468('0xc')]);OpenchannelInteractionEvents[_0xa468('0xd')](_0x5b0fe0+':'+_0x237117['id'],_0x237117);OpenchannelInteractionEvents[_0xa468('0xd')](_0x5b0fe0,_0x237117);_0x55ca2e(null);})[_0xa468('0xe')](_0x55ca2e(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xa468('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 b61c7a1..3ad8a1d 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 _0xac4b=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','format'];(function(_0xffd829,_0x3944a9){var _0x501df3=function(_0x34caa3){while(--_0x34caa3){_0xffd829['push'](_0xffd829['shift']());}};_0x501df3(++_0x3944a9);}(_0xac4b,0x145));var _0xbac4=function(_0x246a9c,_0x4df087){_0x246a9c=_0x246a9c-0x0;var _0x4bd0b3=_0xac4b[_0x246a9c];return _0x4bd0b3;};'use strict';var _=require(_0xbac4('0x0'));var util=require(_0xbac4('0x1'));var logger=require(_0xbac4('0x2'))(_0xbac4('0x3'));var moment=require(_0xbac4('0x4'));var BPromise=require(_0xbac4('0x5'));var rp=require(_0xbac4('0x6'));var fs=require('fs');var path=require(_0xbac4('0x7'));var rimraf=require(_0xbac4('0x8'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0xbac4('0x9')]=function(_0x3f5ef4,_0xba4dae){return _0x3f5ef4[_0xbac4('0xa')]('OpenchannelInteraction',attributes,{'tableName':_0xbac4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbac4('0xc'),'collate':_0xbac4('0xd'),'hooks':{'beforeUpdate':function(_0x127824,_0x2913b5,_0xd9d62d){if(_0x127824[_0xbac4('0xe')]('closed')){_0x127824[_0xbac4('0xf')]=moment()[_0xbac4('0x10')](_0xbac4('0x11'));}_0xd9d62d(null,_0x127824);}}});}; \ No newline at end of file +var _0xd05f=['openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction'];(function(_0x4f1af9,_0xc95c63){var _0x11a60e=function(_0x19de7f){while(--_0x19de7f){_0x4f1af9['push'](_0x4f1af9['shift']());}};_0x11a60e(++_0xc95c63);}(_0xd05f,0x102));var _0xfd05=function(_0x1ed3bd,_0x17227d){_0x1ed3bd=_0x1ed3bd-0x0;var _0x24dc3e=_0xd05f[_0x1ed3bd];return _0x24dc3e;};'use strict';var _=require(_0xfd05('0x0'));var util=require(_0xfd05('0x1'));var logger=require(_0xfd05('0x2'))(_0xfd05('0x3'));var moment=require(_0xfd05('0x4'));var BPromise=require(_0xfd05('0x5'));var rp=require(_0xfd05('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfd05('0x7'));var config=require('../../config/environment');var attributes=require(_0xfd05('0x8'));module[_0xfd05('0x9')]=function(_0x81cb98,_0x5eefac){return _0x81cb98[_0xfd05('0xa')](_0xfd05('0xb'),attributes,{'tableName':_0xfd05('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfd05('0xd'),'collate':_0xfd05('0xe'),'hooks':{'beforeUpdate':function(_0x1e540d,_0x36df12,_0x49fde9){if(_0x1e540d[_0xfd05('0xf')]('closed')){_0x1e540d[_0xfd05('0x10')]=moment()['format'](_0xfd05('0x11'));}_0x49fde9(null,_0x1e540d);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 23f2d6a..63ed9f6 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 _0x8871=['../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateOpenchannelInteraction','update','body','raw','options','where','limit','stringify','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x28e424,_0x4d6508){var _0x25ab59=function(_0x3ff7b4){while(--_0x3ff7b4){_0x28e424['push'](_0x28e424['shift']());}};_0x25ab59(++_0x4d6508);}(_0x8871,0xd4));var _0x1887=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x8871[_0x102ff9];return _0x24fa97;};'use strict';var _=require(_0x1887('0x0'));var util=require(_0x1887('0x1'));var moment=require(_0x1887('0x2'));var BPromise=require(_0x1887('0x3'));var rs=require(_0x1887('0x4'));var fs=require('fs');var Redis=require(_0x1887('0x5'));var db=require(_0x1887('0x6'))['db'];var utils=require(_0x1887('0x7'));var logger=require(_0x1887('0x8'))('rpc');var config=require(_0x1887('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1887('0xa')]({'port':0x232a});config[_0x1887('0xb')]=_['defaults'](config['redis'],{'host':_0x1887('0xc'),'port':0x18eb});var socket=require(_0x1887('0xd'))(new Redis(config[_0x1887('0xb')]));require(_0x1887('0xe'))[_0x1887('0xf')](socket);function respondWithRpcPromise(_0x29428f,_0x2e39a7,_0x2c4917){return new BPromise(function(_0x44fde8,_0x2f6112){return client[_0x1887('0x10')](_0x29428f,_0x2c4917)[_0x1887('0x11')](function(_0x4c728c){logger[_0x1887('0x12')](_0x1887('0x13'),_0x2e39a7,_0x1887('0x14'));logger[_0x1887('0x15')](_0x1887('0x16'),_0x2e39a7,'request\x20sent',JSON['stringify'](_0x4c728c));if(_0x4c728c[_0x1887('0x17')]){if(_0x4c728c['error'][_0x1887('0x18')]===0x1f4){logger['error'](_0x1887('0x13'),_0x2e39a7,_0x4c728c[_0x1887('0x17')]['message']);return _0x2f6112(_0x4c728c['error'][_0x1887('0x19')]);}logger['error'](_0x1887('0x13'),_0x2e39a7,_0x4c728c[_0x1887('0x17')][_0x1887('0x19')]);return _0x44fde8(_0x4c728c['error'][_0x1887('0x19')]);}else{logger[_0x1887('0x12')](_0x1887('0x13'),_0x2e39a7,'request\x20sent');_0x44fde8(_0x4c728c[_0x1887('0x1a')][_0x1887('0x19')]);}})[_0x1887('0x1b')](function(_0x4a3b5f){logger[_0x1887('0x17')](_0x1887('0x13'),_0x2e39a7,_0x4a3b5f);_0x2f6112(_0x4a3b5f);});});}exports[_0x1887('0x1c')]=function(_0x130b52){var _0x2cf4b0=this;return new Promise(function(_0x4bc4a8,_0x4876e2){return db['OpenchannelInteraction'][_0x1887('0x1d')](_0x130b52[_0x1887('0x1e')],{'raw':_0x130b52['options']?_0x130b52['options'][_0x1887('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x130b52[_0x1887('0x20')]?_0x130b52['options'][_0x1887('0x21')]||null:null,'attributes':_0x130b52[_0x1887('0x20')]?_0x130b52[_0x1887('0x20')]['attributes']||null:null,'limit':_0x130b52[_0x1887('0x20')]?_0x130b52['options'][_0x1887('0x22')]||null:null})[_0x1887('0x11')](function(_0x4d76e9){logger['info'](_0x1887('0x1c'),_0x130b52);logger[_0x1887('0x15')](_0x1887('0x1c'),_0x130b52,JSON[_0x1887('0x23')](_0x4d76e9));_0x4bc4a8(_0x4d76e9);})[_0x1887('0x1b')](function(_0x24107b){logger[_0x1887('0x17')](_0x1887('0x1c'),_0x24107b['message'],_0x130b52);_0x4876e2(_0x2cf4b0[_0x1887('0x17')](0x1f4,_0x24107b['message']));});});};exports[_0x1887('0x24')]=function(_0x5dea24){return new Promise(function(_0x3c00ea,_0x4243f3){return db[_0x1887('0x25')][_0x1887('0x26')]({'where':_0x5dea24[_0x1887('0x20')]?_0x5dea24[_0x1887('0x20')][_0x1887('0x21')]||null:null})[_0x1887('0x11')](function(_0x2b7cef){if(_0x2b7cef){return _0x2b7cef[_0x1887('0x27')](_0x5dea24[_0x1887('0x1e')][_0x1887('0x28')],_[_0x1887('0x29')](_0x5dea24[_0x1887('0x1e')],['ids','id'])||{});}})[_0x1887('0x2a')](function(_0x30e1e4){logger[_0x1887('0x12')](_0x1887('0x2b'),_0x5dea24);logger[_0x1887('0x15')]('AddTags',_0x5dea24,JSON[_0x1887('0x23')](_0x30e1e4));_0x3c00ea(_0x30e1e4);})[_0x1887('0x1b')](function(_0x7512a1){logger[_0x1887('0x17')](_0x1887('0x2b'),_0x7512a1[_0x1887('0x19')],_0x5dea24);_0x4243f3(_this[_0x1887('0x17')](0x1f4,_0x7512a1[_0x1887('0x19')]));});});}; \ No newline at end of file +var _0x50bc=['options','raw','where','limit','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','../../mysqldb','../../config/logger','jayson/promise','client','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','OpenchannelInteraction','body'];(function(_0x55b8b0,_0x113f0a){var _0x4a45cf=function(_0xedf064){while(--_0xedf064){_0x55b8b0['push'](_0x55b8b0['shift']());}};_0x4a45cf(++_0x113f0a);}(_0x50bc,0x162));var _0xc50b=function(_0xa22a3d,_0x26ab3d){_0xa22a3d=_0xa22a3d-0x0;var _0x3ea5a6=_0x50bc[_0xa22a3d];return _0x3ea5a6;};'use strict';var _=require(_0xc50b('0x0'));var util=require('util');var moment=require(_0xc50b('0x1'));var BPromise=require(_0xc50b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc50b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc50b('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc50b('0x5'));var client=jayson[_0xc50b('0x6')]['http']({'port':0x232a});config[_0xc50b('0x7')]=_[_0xc50b('0x8')](config[_0xc50b('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xc50b('0x9'))(new Redis(config[_0xc50b('0x7')]));require(_0xc50b('0xa'))[_0xc50b('0xb')](socket);function respondWithRpcPromise(_0x2b16fb,_0x48839e,_0x907466){return new BPromise(function(_0xc3747d,_0x371677){return client[_0xc50b('0xc')](_0x2b16fb,_0x907466)[_0xc50b('0xd')](function(_0x293a0e){logger[_0xc50b('0xe')](_0xc50b('0xf'),_0x48839e,_0xc50b('0x10'));logger[_0xc50b('0x11')](_0xc50b('0x12'),_0x48839e,'request\x20sent',JSON[_0xc50b('0x13')](_0x293a0e));if(_0x293a0e['error']){if(_0x293a0e[_0xc50b('0x14')]['code']===0x1f4){logger[_0xc50b('0x14')](_0xc50b('0xf'),_0x48839e,_0x293a0e[_0xc50b('0x14')]['message']);return _0x371677(_0x293a0e[_0xc50b('0x14')][_0xc50b('0x15')]);}logger['error'](_0xc50b('0xf'),_0x48839e,_0x293a0e[_0xc50b('0x14')]['message']);return _0xc3747d(_0x293a0e[_0xc50b('0x14')][_0xc50b('0x15')]);}else{logger[_0xc50b('0xe')]('OpenchannelInteraction,\x20%s,\x20%s',_0x48839e,'request\x20sent');_0xc3747d(_0x293a0e[_0xc50b('0x16')][_0xc50b('0x15')]);}})[_0xc50b('0x17')](function(_0x2eb69b){logger[_0xc50b('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x48839e,_0x2eb69b);_0x371677(_0x2eb69b);});});}exports['UpdateOpenchannelInteraction']=function(_0x597842){var _0x1ac98d=this;return new Promise(function(_0x2648a9,_0x155c22){return db[_0xc50b('0x18')]['update'](_0x597842[_0xc50b('0x19')],{'raw':_0x597842[_0xc50b('0x1a')]?_0x597842[_0xc50b('0x1a')][_0xc50b('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x597842[_0xc50b('0x1a')]?_0x597842[_0xc50b('0x1a')][_0xc50b('0x1c')]||null:null,'attributes':_0x597842[_0xc50b('0x1a')]?_0x597842[_0xc50b('0x1a')]['attributes']||null:null,'limit':_0x597842[_0xc50b('0x1a')]?_0x597842[_0xc50b('0x1a')][_0xc50b('0x1d')]||null:null})[_0xc50b('0xd')](function(_0x221e94){logger[_0xc50b('0xe')](_0xc50b('0x1e'),_0x597842);logger[_0xc50b('0x11')](_0xc50b('0x1e'),_0x597842,JSON['stringify'](_0x221e94));_0x2648a9(_0x221e94);})['catch'](function(_0x4cd4eb){logger[_0xc50b('0x14')](_0xc50b('0x1e'),_0x4cd4eb[_0xc50b('0x15')],_0x597842);_0x155c22(_0x1ac98d['error'](0x1f4,_0x4cd4eb[_0xc50b('0x15')]));});});};exports[_0xc50b('0x1f')]=function(_0x33eb9b){return new Promise(function(_0x3c523f,_0x1ddafb){return db[_0xc50b('0x18')][_0xc50b('0x20')]({'where':_0x33eb9b[_0xc50b('0x1a')]?_0x33eb9b[_0xc50b('0x1a')][_0xc50b('0x1c')]||null:null})[_0xc50b('0xd')](function(_0x171141){if(_0x171141){return _0x171141[_0xc50b('0x21')](_0x33eb9b[_0xc50b('0x19')][_0xc50b('0x22')],_[_0xc50b('0x23')](_0x33eb9b[_0xc50b('0x19')],['ids','id'])||{});}})[_0xc50b('0x24')](function(_0x379b8f){logger['info'](_0xc50b('0x25'),_0x33eb9b);logger[_0xc50b('0x11')]('AddTags',_0x33eb9b,JSON['stringify'](_0x379b8f));_0x3c523f(_0x379b8f);})[_0xc50b('0x17')](function(_0x277bf4){logger[_0xc50b('0x14')](_0xc50b('0x25'),_0x277bf4['message'],_0x33eb9b);_0x1ddafb(_this['error'](0x1f4,_0x277bf4[_0xc50b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 25456a8..f8369e5 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 _0x24a4=['removeListener','register','length','save','emit'];(function(_0x45f111,_0x3a1a4a){var _0x483508=function(_0x3131ab){while(--_0x3131ab){_0x45f111['push'](_0x45f111['shift']());}};_0x483508(++_0x3a1a4a);}(_0x24a4,0x14d));var _0x424a=function(_0x1ba9da,_0x42ddc4){_0x1ba9da=_0x1ba9da-0x0;var _0x585e27=_0x24a4[_0x1ba9da];return _0x585e27;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x424a('0x0'),'remove','update'];function createListener(_0x999647,_0x3f5aa4){return function(_0x5f2a84){_0x3f5aa4[_0x424a('0x1')](_0x999647,_0x5f2a84);};}function removeListener(_0xd00027,_0xbbf7c8){return function(){OpenchannelInteractionEvents[_0x424a('0x2')](_0xd00027,_0xbbf7c8);};}exports[_0x424a('0x3')]=function(_0x51503d){for(var _0x273a43=0x0,_0x1657a5=events[_0x424a('0x4')];_0x273a43<_0x1657a5;_0x273a43++){var _0x436d55=events[_0x273a43];var _0x142889=createListener('openchannelInteraction:'+_0x436d55,_0x51503d);OpenchannelInteractionEvents['on'](_0x436d55,_0x142889);}}; \ No newline at end of file +var _0x03ed=['remove','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x546187,_0x43c286){var _0x4c2179=function(_0x2f32cc){while(--_0x2f32cc){_0x546187['push'](_0x546187['shift']());}};_0x4c2179(++_0x43c286);}(_0x03ed,0x173));var _0xd03e=function(_0x11b4cb,_0x251962){_0x11b4cb=_0x11b4cb-0x0;var _0x27dc3c=_0x03ed[_0x11b4cb];return _0x27dc3c;};'use strict';var OpenchannelInteractionEvents=require(_0xd03e('0x0'));var events=['save',_0xd03e('0x1'),'update'];function createListener(_0x543b2c,_0x59d0c3){return function(_0x2e3e8a){_0x59d0c3['emit'](_0x543b2c,_0x2e3e8a);};}function removeListener(_0x4cdf98,_0x3ecbc1){return function(){OpenchannelInteractionEvents[_0xd03e('0x2')](_0x4cdf98,_0x3ecbc1);};}exports[_0xd03e('0x3')]=function(_0x468308){for(var _0x4ecff3=0x0,_0x502eae=events[_0xd03e('0x4')];_0x4ecff3<_0x502eae;_0x4ecff3++){var _0x2f1faf=events[_0x4ecff3];var _0x4e8fb4=createListener(_0xd03e('0x5')+_0x2f1faf,_0x468308);OpenchannelInteractionEvents['on'](_0x2f1faf,_0x4e8fb4);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index bc9eee3..44c2529 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0xf7a357,_0x1b9a26){var _0x57c8b=function(_0x509f6e){while(--_0x509f6e){_0xf7a357['push'](_0xf7a357['shift']());}};_0x57c8b(++_0x1b9a26);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x12b5c2,_0x29152f){var _0x4ef0a4=function(_0x3e2f8f){while(--_0x3e2f8f){_0x12b5c2['push'](_0x12b5c2['shift']());}};_0x4ef0a4(++_0x29152f);}(_0xedd9,0xfc));var _0x9edd=function(_0x3a46b9,_0x3d6102){_0x3a46b9=_0x3a46b9-0x0;var _0x496c35=_0xedd9[_0x3a46b9];return _0x496c35;};'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['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),interaction[_0x9edd('0x10')](_0x9edd('0x11'),'openchannelmessage:create'),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')](_0x9edd('0x15'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x16')]);router[_0x9edd('0x13')](_0x9edd('0x17'),auth['isAuthenticated'](),controller[_0x9edd('0x18')]);router[_0x9edd('0x19')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x1a')]);module[_0x9edd('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 5b407c4..467676c 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 _0x7916=['out','STRING','sequelize','TEXT','medium','BOOLEAN','ENUM'];(function(_0x59bb17,_0x2a1cc5){var _0x57fda3=function(_0x475844){while(--_0x475844){_0x59bb17['push'](_0x59bb17['shift']());}};_0x57fda3(++_0x2a1cc5);}(_0x7916,0x128));var _0x6791=function(_0x282e7a,_0x36d4ed){_0x282e7a=_0x282e7a-0x0;var _0x1395cc=_0x7916[_0x282e7a];return _0x1395cc;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'body':{'type':Sequelize[_0x6791('0x1')](_0x6791('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x6791('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6791('0x4')]('in',_0x6791('0x5')),'defaultValue':_0x6791('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x6791('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x94df=['out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0xb98ff9,_0x1cace9){var _0x3e25a2=function(_0x99b96e){while(--_0x99b96e){_0xb98ff9['push'](_0xb98ff9['shift']());}};_0x3e25a2(++_0x1cace9);}(_0x94df,0xa3));var _0xf94d=function(_0x4ff481,_0x27a565){_0x4ff481=_0x4ff481-0x0;var _0x301900=_0x94df[_0x4ff481];return _0x301900;};'use strict';var Sequelize=require(_0xf94d('0x0'));module[_0xf94d('0x1')]={'body':{'type':Sequelize[_0xf94d('0x2')](_0xf94d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf94d('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xf94d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf94d('0x5')),'defaultValue':_0xf94d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xf94d('0x6')]},'providerName':{'type':Sequelize[_0xf94d('0x7')]},'providerResponse':{'type':Sequelize[_0xf94d('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 24a4eeb..71acbdf 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 _0x6217=['show','params','find','create','body','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','user','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','User','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','null','RejectMessage','rejectMessage','fullname','email','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelMessage.socket','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','stack','name','send','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','OpenchannelMessage','includeAll','include','rows'];(function(_0x3c2db8,_0x336c5d){var _0x4759eb=function(_0x5a4639){while(--_0x5a4639){_0x3c2db8['push'](_0x3c2db8['shift']());}};_0x4759eb(++_0x336c5d);}(_0x6217,0x1bc));var _0x7621=function(_0x3fa296,_0x2bd315){_0x3fa296=_0x3fa296-0x0;var _0x10b19f=_0x6217[_0x3fa296];return _0x10b19f;};'use strict';var emlformat=require(_0x7621('0x0'));var rimraf=require(_0x7621('0x1'));var zipdir=require(_0x7621('0x2'));var jsonpatch=require(_0x7621('0x3'));var rp=require(_0x7621('0x4'));var moment=require(_0x7621('0x5'));var BPromise=require(_0x7621('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7621('0x7'));var sox=require(_0x7621('0x8'));var csv=require(_0x7621('0x9'));var ejs=require(_0x7621('0xa'));var fs=require('fs');var fs_extra=require(_0x7621('0xb'));var _=require(_0x7621('0xc'));var squel=require(_0x7621('0xd'));var crypto=require(_0x7621('0xe'));var jsforce=require(_0x7621('0xf'));var deskjs=require(_0x7621('0x10'));var toCsv=require(_0x7621('0x9'));var querystring=require(_0x7621('0x11'));var Papa=require(_0x7621('0x12'));var Redis=require(_0x7621('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7621('0x14'));var as=require(_0x7621('0x15'));var hardwareService=require(_0x7621('0x16'));var logger=require('../../config/logger')(_0x7621('0x17'));var utils=require(_0x7621('0x18'));var config=require(_0x7621('0x19'));var licenseUtil=require(_0x7621('0x1a'));var db=require(_0x7621('0x1b'))['db'];config[_0x7621('0x1c')]=_[_0x7621('0x1d')](config[_0x7621('0x1c')],{'host':_0x7621('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7621('0x1c')]));require(_0x7621('0x1f'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x7621('0x20')]['http']({'port':0x232c});var client9002=jayson['client'][_0x7621('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1c6570,_0x19ba7e,_0x29d327,_0x3e7fcd){return new BPromise(function(_0x4bb86d,_0x35dd1a){var _0x13f53d=_0x3e7fcd||client;return _0x13f53d[_0x7621('0x22')](_0x1c6570,_0x29d327)['then'](function(_0x54ccc6){logger[_0x7621('0x23')](_0x7621('0x24'),_0x19ba7e,_0x7621('0x25'));logger['debug'](_0x7621('0x26'),_0x19ba7e,_0x7621('0x25'),JSON['stringify'](_0x54ccc6));if(_0x54ccc6[_0x7621('0x27')]){if(_0x54ccc6[_0x7621('0x27')]['code']===0x1f4){logger[_0x7621('0x27')](_0x7621('0x24'),_0x19ba7e,_0x54ccc6[_0x7621('0x27')][_0x7621('0x28')]);return _0x35dd1a(_0x54ccc6[_0x7621('0x27')]['message']);}logger[_0x7621('0x27')](_0x7621('0x24'),_0x19ba7e,_0x54ccc6['error'][_0x7621('0x28')]);return _0x4bb86d(_0x54ccc6[_0x7621('0x27')][_0x7621('0x28')]);}else{logger[_0x7621('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x19ba7e,_0x7621('0x25'));_0x4bb86d(_0x54ccc6['result']['message']);}})[_0x7621('0x29')](function(_0xcdbf53){logger[_0x7621('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x19ba7e,_0xcdbf53);_0x35dd1a(_0xcdbf53);});});}function respondWithStatusCode(_0x134463,_0x535cfe){_0x535cfe=_0x535cfe||0xcc;return function(_0xfbe9f7){if(_0xfbe9f7){return _0x134463[_0x7621('0x2a')](_0x535cfe);}return _0x134463[_0x7621('0x2b')](_0x535cfe)['end']();};}function respondWithResult(_0x15289e,_0x1c783d){_0x1c783d=_0x1c783d||0xc8;return function(_0x445ca6){if(_0x445ca6){return _0x15289e['status'](_0x1c783d)[_0x7621('0x2c')](_0x445ca6);}};}function respondWithFilteredResult(_0x8b071a,_0x115692){return function(_0x534e61){if(_0x534e61){var _0x3ecba6=typeof _0x115692[_0x7621('0x2d')]===_0x7621('0x2e')&&typeof _0x115692[_0x7621('0x2f')]===_0x7621('0x2e');var _0x4d8e21=_0x534e61[_0x7621('0x30')];var _0x59d511=_0x3ecba6?0x0:_0x115692[_0x7621('0x2d')];var _0x1564cd=_0x3ecba6?_0x534e61['count']:_0x115692['offset']+_0x115692[_0x7621('0x2f')];var _0xc45051;if(_0x1564cd>=_0x4d8e21){_0x1564cd=_0x4d8e21;_0xc45051=0xc8;}else{_0xc45051=0xce;}_0x8b071a[_0x7621('0x2b')](_0xc45051);return _0x8b071a[_0x7621('0x31')]('Content-Range',_0x59d511+'-'+_0x1564cd+'/'+_0x4d8e21)[_0x7621('0x2c')](_0x534e61);}return null;};}function patchUpdates(_0x549596){return function(_0x266d0a){try{jsonpatch[_0x7621('0x32')](_0x266d0a,_0x549596,!![]);}catch(_0x5d97dd){return BPromise[_0x7621('0x33')](_0x5d97dd);}return _0x266d0a['save']();};}function saveUpdates(_0x34b1ee,_0xb6eb6d){return function(_0x387bc1){if(_0x387bc1){return _0x387bc1[_0x7621('0x34')](_0x34b1ee)[_0x7621('0x35')](function(_0x4890a4){return _0x4890a4;});}return null;};}function removeEntity(_0x7190e1,_0x3384c1){return function(_0x481999){if(_0x481999){return _0x481999[_0x7621('0x36')]()['then'](function(){_0x7190e1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4228d5,_0x1b0eca){return function(_0x4e1d0b){if(!_0x4e1d0b){_0x4228d5[_0x7621('0x2a')](0x194);}return _0x4e1d0b;};}function handleError(_0x26be67,_0x381336){_0x381336=_0x381336||0x1f4;return function(_0x33cfb1){logger[_0x7621('0x27')](_0x33cfb1[_0x7621('0x37')]);if(_0x33cfb1[_0x7621('0x38')]){delete _0x33cfb1['name'];}_0x26be67[_0x7621('0x2b')](_0x381336)[_0x7621('0x39')](_0x33cfb1);};}exports['index']=function(_0x931884,_0x434eeb){var _0x304b4e={},_0x2be32d={},_0x443e60={'count':0x0,'rows':[]};var _0x23b2b2=_[_0x7621('0x3a')](db['OpenchannelMessage'][_0x7621('0x3b')],function(_0x2cb59d){return{'name':_0x2cb59d['fieldName'],'type':_0x2cb59d[_0x7621('0x3c')][_0x7621('0x3d')]};});_0x2be32d[_0x7621('0x3e')]=_[_0x7621('0x3a')](_0x23b2b2,_0x7621('0x38'));_0x2be32d[_0x7621('0x3f')]=_[_0x7621('0x40')](_0x931884[_0x7621('0x3f')]);_0x2be32d['filters']=_[_0x7621('0x41')](_0x2be32d[_0x7621('0x3e')],_0x2be32d[_0x7621('0x3f')]);_0x304b4e[_0x7621('0x42')]=_[_0x7621('0x41')](_0x2be32d[_0x7621('0x3e')],qs['fields'](_0x931884[_0x7621('0x3f')][_0x7621('0x43')]));_0x304b4e['attributes']=_0x304b4e['attributes'][_0x7621('0x44')]?_0x304b4e['attributes']:_0x2be32d[_0x7621('0x3e')];if(!_0x931884[_0x7621('0x3f')][_0x7621('0x45')](_0x7621('0x46'))){_0x304b4e[_0x7621('0x2f')]=qs[_0x7621('0x2f')](_0x931884[_0x7621('0x3f')][_0x7621('0x2f')]);_0x304b4e[_0x7621('0x2d')]=qs[_0x7621('0x2d')](_0x931884[_0x7621('0x3f')][_0x7621('0x2d')]);}_0x304b4e[_0x7621('0x47')]=qs[_0x7621('0x48')](_0x931884[_0x7621('0x3f')][_0x7621('0x48')]);_0x304b4e[_0x7621('0x49')]=qs['filters'](_[_0x7621('0x4a')](_0x931884['query'],_0x2be32d[_0x7621('0x4b')]),_0x23b2b2);if(_0x931884['query'][_0x7621('0x4c')]){_0x304b4e[_0x7621('0x49')]=_[_0x7621('0x4d')](_0x304b4e['where'],{'$or':_['map'](_0x23b2b2,function(_0x3ea33b){if(_0x3ea33b[_0x7621('0x3c')]!==_0x7621('0x4e')){var _0x5a550d={};_0x5a550d[_0x3ea33b[_0x7621('0x38')]]={'$like':'%'+_0x931884[_0x7621('0x3f')][_0x7621('0x4c')]+'%'};return _0x5a550d;}})});}_0x304b4e=_[_0x7621('0x4d')]({},_0x304b4e,_0x931884[_0x7621('0x4f')]);var _0x2d4e3c={'where':_0x304b4e[_0x7621('0x49')]};return db[_0x7621('0x50')][_0x7621('0x30')](_0x2d4e3c)[_0x7621('0x35')](function(_0x4c1011){_0x443e60[_0x7621('0x30')]=_0x4c1011;if(_0x931884[_0x7621('0x3f')][_0x7621('0x51')]){_0x304b4e[_0x7621('0x52')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x304b4e);})[_0x7621('0x35')](function(_0x307d01){_0x443e60[_0x7621('0x53')]=_0x307d01;return _0x443e60;})['then'](respondWithFilteredResult(_0x434eeb,_0x304b4e))['catch'](handleError(_0x434eeb,null));};exports[_0x7621('0x54')]=function(_0x29b5b3,_0x1d6db8){var _0x1ce6ad={'raw':!![],'where':{'id':_0x29b5b3[_0x7621('0x55')]['id']}},_0xb79d59={};_0xb79d59['model']=_[_0x7621('0x40')](db[_0x7621('0x50')]['rawAttributes']);_0xb79d59[_0x7621('0x3f')]=_['keys'](_0x29b5b3[_0x7621('0x3f')]);_0xb79d59[_0x7621('0x4b')]=_[_0x7621('0x41')](_0xb79d59['model'],_0xb79d59['query']);_0x1ce6ad[_0x7621('0x42')]=_[_0x7621('0x41')](_0xb79d59[_0x7621('0x3e')],qs['fields'](_0x29b5b3['query'][_0x7621('0x43')]));_0x1ce6ad['attributes']=_0x1ce6ad[_0x7621('0x42')][_0x7621('0x44')]?_0x1ce6ad[_0x7621('0x42')]:_0xb79d59[_0x7621('0x3e')];if(_0x29b5b3['query']['includeAll']){_0x1ce6ad['include']=[{'all':!![]}];}_0x1ce6ad=_[_0x7621('0x4d')]({},_0x1ce6ad,_0x29b5b3[_0x7621('0x4f')]);return db['OpenchannelMessage'][_0x7621('0x56')](_0x1ce6ad)[_0x7621('0x35')](handleEntityNotFound(_0x1d6db8,null))[_0x7621('0x35')](respondWithResult(_0x1d6db8,null))[_0x7621('0x29')](handleError(_0x1d6db8,null));};exports[_0x7621('0x57')]=function(_0x1fe707,_0x3e6450){return db[_0x7621('0x50')][_0x7621('0x57')](_0x1fe707['body'],{})[_0x7621('0x35')](respondWithResult(_0x3e6450,0xc9))[_0x7621('0x29')](handleError(_0x3e6450,null));};exports['update']=function(_0x4a0de1,_0x669243){if(_0x4a0de1[_0x7621('0x58')]['id']){delete _0x4a0de1['body']['id'];}return db[_0x7621('0x50')][_0x7621('0x56')]({'where':{'id':_0x4a0de1[_0x7621('0x55')]['id']}})['then'](handleEntityNotFound(_0x669243,null))[_0x7621('0x35')](saveUpdates(_0x4a0de1[_0x7621('0x58')],null))[_0x7621('0x35')](respondWithResult(_0x669243,null))[_0x7621('0x29')](handleError(_0x669243,null));};exports[_0x7621('0x36')]=function(_0x2c9eaa,_0xbab93e){return db[_0x7621('0x50')]['find']({'where':{'id':_0x2c9eaa[_0x7621('0x55')]['id']}})[_0x7621('0x35')](handleEntityNotFound(_0xbab93e,null))['then'](removeEntity(_0xbab93e,null))['catch'](handleError(_0xbab93e,null));};exports[_0x7621('0x59')]=function(_0x3888cd,_0x2c9c00){return db[_0x7621('0x50')][_0x7621('0x59')]()[_0x7621('0x35')](respondWithResult(_0x2c9c00,null))[_0x7621('0x29')](handleError(_0x2c9c00,null));};var interaction_log=require(_0x7621('0x5a'))(_0x7621('0x5b'));exports[_0x7621('0x5c')]=function(_0x2899f7,_0x3cc08b,_0x781528){var _0x4b08d2={'agent':{},'channel':_0x7621('0x5d')};if(_0x2899f7[_0x7621('0x58')]['id']){delete _0x2899f7[_0x7621('0x58')]['id'];}_0x2899f7[_0x7621('0x58')][_0x7621('0x5e')]=!![];_0x2899f7[_0x7621('0x58')][_0x7621('0x5f')]=moment()[_0x7621('0x60')](_0x7621('0x61'));_0x2899f7[_0x7621('0x58')][_0x7621('0x62')]=_0x2899f7[_0x7621('0x58')]['UserId']||_0x2899f7['user']['id'];_0x4b08d2[_0x7621('0x63')]['id']=_0x2899f7[_0x7621('0x58')][_0x7621('0x62')];return db['OpenchannelMessage'][_0x7621('0x56')]({'where':{'id':_0x2899f7[_0x7621('0x55')]['id'],'UserId':null}})[_0x7621('0x35')](handleEntityNotFound(_0x3cc08b,null))[_0x7621('0x35')](saveUpdates(_0x2899f7['body'],null))[_0x7621('0x35')](function(_0x2e91d4){if(_0x2e91d4){_0x4b08d2['message']=_0x2e91d4[_0x7621('0x64')]({'plain':!![]});return db[_0x7621('0x65')][_0x7621('0x56')]({'where':{'id':_0x2e91d4[_0x7621('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x3cc08b,null))[_0x7621('0x35')](function(_0x23a656){if(_0x23a656){return _0x23a656['update']({'UserId':_0x2899f7[_0x7621('0x58')][_0x7621('0x62')],'read1stAt':_[_0x7621('0x67')](_0x23a656[_0x7621('0x68')])?moment()[_0x7621('0x60')](_0x7621('0x61')):undefined});}return null;})[_0x7621('0x35')](function(_0x2f3b6b){if(_0x2f3b6b){_0x4b08d2[_0x7621('0x69')]=_0x2f3b6b['get']({'plain':!![]});interaction_log[_0x7621('0x23')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2899f7[_0x7621('0x6a')]['id'],_0x2899f7[_0x7621('0x6a')][_0x7621('0x38')],_0x2899f7[_0x7621('0x6a')][_0x7621('0x6b')],_0x4b08d2[_0x7621('0x69')]['id'],_0x2899f7[_0x7621('0x58')]?JSON[_0x7621('0x6c')](_0x2899f7[_0x7621('0x58')]):'null');return respondWithRpcPromise(_0x7621('0x6d'),_0x7621('0x6e'),_0x4b08d2);}return null;})['then'](function(_0x223866){var _0x34fd6c=_0x7621('0x6f')+_0x223866[_0x7621('0x28')][_0x7621('0x70')];return db[_0x7621('0x71')][_0x7621('0x3f')](_0x34fd6c,{'type':db[_0x7621('0x72')][_0x7621('0x73')]['SELECT'],'raw':!![]})[_0x7621('0x35')](function(_0xc3cabe){return _0xc3cabe;});})[_0x7621('0x35')](function(_0x2be5cc){if(_0x2be5cc){_0x4b08d2[_0x7621('0x28')][_0x7621('0x74')]=_0x2be5cc[0x0];if(!_0x2899f7[_0x7621('0x58')][_0x7621('0x62')])return;return db[_0x7621('0x75')][_0x7621('0x56')]({'where':{'id':_0x2899f7[_0x7621('0x58')][_0x7621('0x62')],'role':_0x7621('0x63')},'attributes':['id',_0x7621('0x38'),'fullname','email','internal'],'raw':!![]});}return null;})[_0x7621('0x35')](function(_0x717f39){if(!_0x717f39)return null;_0x4b08d2[_0x7621('0x28')][_0x7621('0x63')]=_0x717f39;return _0x4b08d2;})[_0x7621('0x35')](function(_0x154dd7){if(_0x154dd7){if(_0x2899f7[_0x7621('0x58')][_0x7621('0x76')]){_0x4b08d2[_0x7621('0x28')][_0x7621('0x77')]=util[_0x7621('0x60')]('SIP/%s',_0x2899f7[_0x7621('0x6a')]['name']);_0x4b08d2['message'][_0x7621('0x78')]=_0x4b08d2[_0x7621('0x78')];_0x4b08d2[_0x7621('0x28')][_0x7621('0x79')]=_0x4b08d2[_0x7621('0x78')];_0x4b08d2['message'][_0x7621('0x7a')]=_0x7621('0x5c');return respondWithRpcPromise(_0x7621('0x7b'),'EventManager',{'event':_0x7621('0x7c'),'message':_0x4b08d2[_0x7621('0x28')]},client9002)[_0x7621('0x35')](function(){return _0x4b08d2;});}return _0x4b08d2;}return null;})['then'](respondWithResult(_0x3cc08b,null))[_0x7621('0x29')](handleError(_0x3cc08b,null));};var interaction_log=require(_0x7621('0x5a'))('openchannel-interactions');exports[_0x7621('0x33')]=function(_0xf9772a,_0x48c7a9,_0x4028a4){var _0x47439c={'agent':{},'channel':_0x7621('0x5d')};if(_0xf9772a[_0x7621('0x58')]['id']){delete _0xf9772a[_0x7621('0x58')]['id'];}_0xf9772a[_0x7621('0x58')][_0x7621('0x62')]=_0xf9772a[_0x7621('0x58')][_0x7621('0x62')]||_0xf9772a[_0x7621('0x6a')]['id'];_0x47439c[_0x7621('0x63')]['id']=_0xf9772a['body'][_0x7621('0x62')];return db[_0x7621('0x50')][_0x7621('0x56')]({'where':{'id':_0xf9772a[_0x7621('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x48c7a9,null))[_0x7621('0x35')](function(_0x1abe70){if(_0x1abe70){_0x47439c['message']=_0x1abe70[_0x7621('0x64')]({'plain':!![]});return db[_0x7621('0x65')][_0x7621('0x56')]({'where':{'id':_0x1abe70[_0x7621('0x66')]}});}return null;})[_0x7621('0x35')](handleEntityNotFound(_0x48c7a9,null))[_0x7621('0x35')](function(_0x494718){if(_0x494718){_0x47439c[_0x7621('0x69')]=_0x494718['get']({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xf9772a['user']['id'],_0xf9772a[_0x7621('0x6a')][_0x7621('0x38')],_0xf9772a[_0x7621('0x6a')]['role'],_0x47439c['interaction']['id'],_0xf9772a[_0x7621('0x58')]?JSON[_0x7621('0x6c')](_0xf9772a[_0x7621('0x58')]):_0x7621('0x7d'));return respondWithRpcPromise(_0x7621('0x7e'),_0x7621('0x7f'),_0x47439c);}return null;})['then'](function(_0x23ac9a){var _0x106c32=_0x7621('0x6f')+_0x23ac9a[_0x7621('0x28')][_0x7621('0x70')];return db['sequelize'][_0x7621('0x3f')](_0x106c32,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x498a9d){return _0x498a9d;});})['then'](function(_0x4df97c){if(_0x4df97c){_0x47439c[_0x7621('0x28')][_0x7621('0x74')]=_0x4df97c[0x0];if(!_0xf9772a[_0x7621('0x58')][_0x7621('0x62')])return;return db[_0x7621('0x75')]['find']({'where':{'id':_0xf9772a[_0x7621('0x58')][_0x7621('0x62')],'role':_0x7621('0x63')},'attributes':['id','name',_0x7621('0x80'),_0x7621('0x81'),'internal'],'raw':!![]});}return null;})['then'](function(_0x3ddd90){if(!_0x3ddd90)return null;_0x47439c[_0x7621('0x28')][_0x7621('0x63')]=_0x3ddd90;return _0x47439c;})['then'](function(_0x152808){if(_0x152808){_0x152808[_0x7621('0x28')][_0x7621('0x77')]=util[_0x7621('0x60')](_0x7621('0x82'),_0xf9772a[_0x7621('0x6a')]['name']);_0x152808['message'][_0x7621('0x78')]=_0x47439c[_0x7621('0x78')];_0x152808[_0x7621('0x28')][_0x7621('0x79')]=_0x47439c['channel'];_0x152808['message'][_0x7621('0x7a')]=_0x7621('0x33');respondWithRpcPromise(_0x7621('0x7b'),_0x7621('0x7b'),{'event':_0x7621('0x83'),'message':_0x152808[_0x7621('0x28')]},client9002);return _0x47439c;}return null;})[_0x7621('0x35')](respondWithResult(_0x48c7a9,null))[_0x7621('0x29')](handleError(_0x48c7a9,null));}; \ No newline at end of file +var _0xdf32=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','create','body','find','describe','openchannel-interactions','accept','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','OpenchannelInteractionId','isNil','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','contact','email','internal','manual','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','Sequelize','User','agent','SIP/%s','rejectmessage','rimraf','zip-dir','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','jayson/promise','http','client','request','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','json','offset','undefined','count','status','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','index','map','OpenchannelMessage','fieldName','type','model','keys','query'];(function(_0x2da2c6,_0x4289b2){var _0x1fc34f=function(_0xcc25d2){while(--_0xcc25d2){_0x2da2c6['push'](_0x2da2c6['shift']());}};_0x1fc34f(++_0x4289b2);}(_0xdf32,0x1bc));var _0x2df3=function(_0x50b3c1,_0x36a50c){_0x50b3c1=_0x50b3c1-0x0;var _0xa87c25=_0xdf32[_0x50b3c1];return _0xa87c25;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2df3('0x0'));var zipdir=require(_0x2df3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2df3('0x2'));var BPromise=require(_0x2df3('0x3'));var Mustache=require(_0x2df3('0x4'));var util=require('util');var path=require(_0x2df3('0x5'));var sox=require(_0x2df3('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2df3('0x7'));var _=require(_0x2df3('0x8'));var squel=require(_0x2df3('0x9'));var crypto=require(_0x2df3('0xa'));var jsforce=require(_0x2df3('0xb'));var deskjs=require(_0x2df3('0xc'));var toCsv=require(_0x2df3('0xd'));var querystring=require(_0x2df3('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2df3('0xf'));var as=require(_0x2df3('0x10'));var hardwareService=require(_0x2df3('0x11'));var logger=require(_0x2df3('0x12'))('api');var utils=require(_0x2df3('0x13'));var config=require(_0x2df3('0x14'));var licenseUtil=require(_0x2df3('0x15'));var db=require('../../mysqldb')['db'];config[_0x2df3('0x16')]=_[_0x2df3('0x17')](config[_0x2df3('0x16')],{'host':_0x2df3('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2df3('0x16')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x2df3('0x19'));var client=jayson['client'][_0x2df3('0x1a')]({'port':0x232c});var client9002=jayson[_0x2df3('0x1b')][_0x2df3('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x457c22,_0x13db5b,_0x4695bf,_0x53127b){return new BPromise(function(_0x2e487b,_0x16ee36){var _0x2e70e3=_0x53127b||client;return _0x2e70e3[_0x2df3('0x1c')](_0x457c22,_0x4695bf)['then'](function(_0x5d55ba){logger['info'](_0x2df3('0x1d'),_0x13db5b,_0x2df3('0x1e'));logger[_0x2df3('0x1f')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x13db5b,'request\x20sent',JSON[_0x2df3('0x20')](_0x5d55ba));if(_0x5d55ba[_0x2df3('0x21')]){if(_0x5d55ba[_0x2df3('0x21')][_0x2df3('0x22')]===0x1f4){logger[_0x2df3('0x21')](_0x2df3('0x1d'),_0x13db5b,_0x5d55ba[_0x2df3('0x21')][_0x2df3('0x23')]);return _0x16ee36(_0x5d55ba[_0x2df3('0x21')]['message']);}logger['error'](_0x2df3('0x1d'),_0x13db5b,_0x5d55ba[_0x2df3('0x21')][_0x2df3('0x23')]);return _0x2e487b(_0x5d55ba[_0x2df3('0x21')][_0x2df3('0x23')]);}else{logger[_0x2df3('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x13db5b,_0x2df3('0x1e'));_0x2e487b(_0x5d55ba[_0x2df3('0x25')][_0x2df3('0x23')]);}})[_0x2df3('0x26')](function(_0x76d4f8){logger[_0x2df3('0x21')](_0x2df3('0x1d'),_0x13db5b,_0x76d4f8);_0x16ee36(_0x76d4f8);});});}function respondWithStatusCode(_0x394504,_0x5cf6a2){_0x5cf6a2=_0x5cf6a2||0xcc;return function(_0x223a31){if(_0x223a31){return _0x394504['sendStatus'](_0x5cf6a2);}return _0x394504['status'](_0x5cf6a2)['end']();};}function respondWithResult(_0x2eb363,_0x3d310e){_0x3d310e=_0x3d310e||0xc8;return function(_0x3b1a92){if(_0x3b1a92){return _0x2eb363['status'](_0x3d310e)[_0x2df3('0x27')](_0x3b1a92);}};}function respondWithFilteredResult(_0x2634bb,_0x41cdfa){return function(_0x2a224b){if(_0x2a224b){var _0x2bc077=typeof _0x41cdfa[_0x2df3('0x28')]==='undefined'&&typeof _0x41cdfa['limit']===_0x2df3('0x29');var _0x5c011e=_0x2a224b['count'];var _0x2270a5=_0x2bc077?0x0:_0x41cdfa['offset'];var _0x3641ce=_0x2bc077?_0x2a224b[_0x2df3('0x2a')]:_0x41cdfa[_0x2df3('0x28')]+_0x41cdfa['limit'];var _0x22ea8f;if(_0x3641ce>=_0x5c011e){_0x3641ce=_0x5c011e;_0x22ea8f=0xc8;}else{_0x22ea8f=0xce;}_0x2634bb[_0x2df3('0x2b')](_0x22ea8f);return _0x2634bb[_0x2df3('0x2c')](_0x2df3('0x2d'),_0x2270a5+'-'+_0x3641ce+'/'+_0x5c011e)[_0x2df3('0x27')](_0x2a224b);}return null;};}function patchUpdates(_0x297786){return function(_0x980b15){try{jsonpatch[_0x2df3('0x2e')](_0x980b15,_0x297786,!![]);}catch(_0x286e5b){return BPromise[_0x2df3('0x2f')](_0x286e5b);}return _0x980b15[_0x2df3('0x30')]();};}function saveUpdates(_0x3c011e,_0x4893d3){return function(_0x38661a){if(_0x38661a){return _0x38661a[_0x2df3('0x31')](_0x3c011e)[_0x2df3('0x32')](function(_0x4b3104){return _0x4b3104;});}return null;};}function removeEntity(_0x53379c,_0x154c88){return function(_0x3f50a5){if(_0x3f50a5){return _0x3f50a5[_0x2df3('0x33')]()[_0x2df3('0x32')](function(){_0x53379c[_0x2df3('0x2b')](0xcc)[_0x2df3('0x34')]();});}};}function handleEntityNotFound(_0x2b96b2,_0x3c58e3){return function(_0x33c27b){if(!_0x33c27b){_0x2b96b2[_0x2df3('0x35')](0x194);}return _0x33c27b;};}function handleError(_0x5ecda8,_0x13e5bd){_0x13e5bd=_0x13e5bd||0x1f4;return function(_0x5568a3){logger[_0x2df3('0x21')](_0x5568a3[_0x2df3('0x36')]);if(_0x5568a3[_0x2df3('0x37')]){delete _0x5568a3['name'];}_0x5ecda8[_0x2df3('0x2b')](_0x13e5bd)['send'](_0x5568a3);};}exports[_0x2df3('0x38')]=function(_0x533c37,_0x5e6b43){var _0xae43bd={},_0x408868={},_0x13f9b5={'count':0x0,'rows':[]};var _0x152a2a=_[_0x2df3('0x39')](db[_0x2df3('0x3a')]['rawAttributes'],function(_0x2d5cd9){return{'name':_0x2d5cd9[_0x2df3('0x3b')],'type':_0x2d5cd9[_0x2df3('0x3c')]['key']};});_0x408868[_0x2df3('0x3d')]=_[_0x2df3('0x39')](_0x152a2a,'name');_0x408868['query']=_[_0x2df3('0x3e')](_0x533c37[_0x2df3('0x3f')]);_0x408868[_0x2df3('0x40')]=_[_0x2df3('0x41')](_0x408868['model'],_0x408868[_0x2df3('0x3f')]);_0xae43bd[_0x2df3('0x42')]=_[_0x2df3('0x41')](_0x408868['model'],qs[_0x2df3('0x43')](_0x533c37[_0x2df3('0x3f')][_0x2df3('0x43')]));_0xae43bd[_0x2df3('0x42')]=_0xae43bd[_0x2df3('0x42')][_0x2df3('0x44')]?_0xae43bd[_0x2df3('0x42')]:_0x408868[_0x2df3('0x3d')];if(!_0x533c37[_0x2df3('0x3f')][_0x2df3('0x45')](_0x2df3('0x46'))){_0xae43bd[_0x2df3('0x47')]=qs[_0x2df3('0x47')](_0x533c37[_0x2df3('0x3f')]['limit']);_0xae43bd[_0x2df3('0x28')]=qs[_0x2df3('0x28')](_0x533c37['query'][_0x2df3('0x28')]);}_0xae43bd[_0x2df3('0x48')]=qs[_0x2df3('0x49')](_0x533c37['query'][_0x2df3('0x49')]);_0xae43bd[_0x2df3('0x4a')]=qs[_0x2df3('0x40')](_['pick'](_0x533c37['query'],_0x408868[_0x2df3('0x40')]),_0x152a2a);if(_0x533c37[_0x2df3('0x3f')][_0x2df3('0x4b')]){_0xae43bd[_0x2df3('0x4a')]=_[_0x2df3('0x4c')](_0xae43bd['where'],{'$or':_[_0x2df3('0x39')](_0x152a2a,function(_0x1eab5d){if(_0x1eab5d[_0x2df3('0x3c')]!==_0x2df3('0x4d')){var _0x47f760={};_0x47f760[_0x1eab5d[_0x2df3('0x37')]]={'$like':'%'+_0x533c37[_0x2df3('0x3f')]['filter']+'%'};return _0x47f760;}})});}_0xae43bd=_['merge']({},_0xae43bd,_0x533c37[_0x2df3('0x4e')]);var _0x1fcb52={'where':_0xae43bd[_0x2df3('0x4a')]};return db[_0x2df3('0x3a')]['count'](_0x1fcb52)['then'](function(_0xedf460){_0x13f9b5[_0x2df3('0x2a')]=_0xedf460;if(_0x533c37[_0x2df3('0x3f')][_0x2df3('0x4f')]){_0xae43bd[_0x2df3('0x50')]=[{'all':!![]}];}return db[_0x2df3('0x3a')][_0x2df3('0x51')](_0xae43bd);})[_0x2df3('0x32')](function(_0x4eeba2){_0x13f9b5[_0x2df3('0x52')]=_0x4eeba2;return _0x13f9b5;})[_0x2df3('0x32')](respondWithFilteredResult(_0x5e6b43,_0xae43bd))[_0x2df3('0x26')](handleError(_0x5e6b43,null));};exports['show']=function(_0x40b227,_0x33e766){var _0x2a991c={'raw':!![],'where':{'id':_0x40b227[_0x2df3('0x53')]['id']}},_0x53b066={};_0x53b066[_0x2df3('0x3d')]=_[_0x2df3('0x3e')](db[_0x2df3('0x3a')][_0x2df3('0x54')]);_0x53b066[_0x2df3('0x3f')]=_[_0x2df3('0x3e')](_0x40b227[_0x2df3('0x3f')]);_0x53b066[_0x2df3('0x40')]=_['intersection'](_0x53b066[_0x2df3('0x3d')],_0x53b066[_0x2df3('0x3f')]);_0x2a991c[_0x2df3('0x42')]=_[_0x2df3('0x41')](_0x53b066[_0x2df3('0x3d')],qs[_0x2df3('0x43')](_0x40b227[_0x2df3('0x3f')][_0x2df3('0x43')]));_0x2a991c[_0x2df3('0x42')]=_0x2a991c[_0x2df3('0x42')][_0x2df3('0x44')]?_0x2a991c['attributes']:_0x53b066[_0x2df3('0x3d')];if(_0x40b227[_0x2df3('0x3f')]['includeAll']){_0x2a991c[_0x2df3('0x50')]=[{'all':!![]}];}_0x2a991c=_[_0x2df3('0x4c')]({},_0x2a991c,_0x40b227[_0x2df3('0x4e')]);return db[_0x2df3('0x3a')]['find'](_0x2a991c)['then'](handleEntityNotFound(_0x33e766,null))[_0x2df3('0x32')](respondWithResult(_0x33e766,null))[_0x2df3('0x26')](handleError(_0x33e766,null));};exports[_0x2df3('0x55')]=function(_0x391c28,_0x548dfc){return db[_0x2df3('0x3a')]['create'](_0x391c28['body'],{})[_0x2df3('0x32')](respondWithResult(_0x548dfc,0xc9))[_0x2df3('0x26')](handleError(_0x548dfc,null));};exports[_0x2df3('0x31')]=function(_0x1cee6e,_0x588068){if(_0x1cee6e[_0x2df3('0x56')]['id']){delete _0x1cee6e['body']['id'];}return db['OpenchannelMessage'][_0x2df3('0x57')]({'where':{'id':_0x1cee6e['params']['id']}})[_0x2df3('0x32')](handleEntityNotFound(_0x588068,null))['then'](saveUpdates(_0x1cee6e[_0x2df3('0x56')],null))['then'](respondWithResult(_0x588068,null))[_0x2df3('0x26')](handleError(_0x588068,null));};exports[_0x2df3('0x33')]=function(_0x527250,_0x3cb687){return db[_0x2df3('0x3a')][_0x2df3('0x57')]({'where':{'id':_0x527250['params']['id']}})[_0x2df3('0x32')](handleEntityNotFound(_0x3cb687,null))[_0x2df3('0x32')](removeEntity(_0x3cb687,null))[_0x2df3('0x26')](handleError(_0x3cb687,null));};exports[_0x2df3('0x58')]=function(_0x574b46,_0x3d11e3){return db[_0x2df3('0x3a')][_0x2df3('0x58')]()[_0x2df3('0x32')](respondWithResult(_0x3d11e3,null))['catch'](handleError(_0x3d11e3,null));};var interaction_log=require(_0x2df3('0x12'))(_0x2df3('0x59'));exports[_0x2df3('0x5a')]=function(_0x367172,_0x111b81,_0x55546f){var _0x131ff9={'agent':{},'channel':_0x2df3('0x5b')};if(_0x367172[_0x2df3('0x56')]['id']){delete _0x367172[_0x2df3('0x56')]['id'];}_0x367172[_0x2df3('0x56')]['read']=!![];_0x367172[_0x2df3('0x56')][_0x2df3('0x5c')]=moment()[_0x2df3('0x5d')](_0x2df3('0x5e'));_0x367172[_0x2df3('0x56')]['UserId']=_0x367172[_0x2df3('0x56')][_0x2df3('0x5f')]||_0x367172[_0x2df3('0x60')]['id'];_0x131ff9['agent']['id']=_0x367172[_0x2df3('0x56')][_0x2df3('0x5f')];return db[_0x2df3('0x3a')][_0x2df3('0x57')]({'where':{'id':_0x367172['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x111b81,null))[_0x2df3('0x32')](saveUpdates(_0x367172[_0x2df3('0x56')],null))[_0x2df3('0x32')](function(_0x23d7ff){if(_0x23d7ff){_0x131ff9[_0x2df3('0x23')]=_0x23d7ff[_0x2df3('0x61')]({'plain':!![]});return db['OpenchannelInteraction'][_0x2df3('0x57')]({'where':{'id':_0x23d7ff[_0x2df3('0x62')]}});}return null;})[_0x2df3('0x32')](handleEntityNotFound(_0x111b81,null))[_0x2df3('0x32')](function(_0x544710){if(_0x544710){return _0x544710[_0x2df3('0x31')]({'UserId':_0x367172['body']['UserId'],'read1stAt':_[_0x2df3('0x63')](_0x544710['read1stAt'])?moment()['format'](_0x2df3('0x5e')):undefined});}return null;})[_0x2df3('0x32')](function(_0x2eee0e){if(_0x2eee0e){_0x131ff9['interaction']=_0x2eee0e[_0x2df3('0x61')]({'plain':!![]});interaction_log[_0x2df3('0x24')](_0x2df3('0x64'),_0x367172['user']['id'],_0x367172[_0x2df3('0x60')][_0x2df3('0x37')],_0x367172['user'][_0x2df3('0x65')],_0x131ff9[_0x2df3('0x66')]['id'],_0x367172[_0x2df3('0x56')]?JSON['stringify'](_0x367172['body']):_0x2df3('0x67'));return respondWithRpcPromise('AcceptMessage',_0x2df3('0x68'),_0x131ff9);}return null;})['then'](function(_0x13a204){var _0x2eb4ca=_0x2df3('0x69')+_0x13a204['message']['ContactId'];return db['sequelize'][_0x2df3('0x3f')](_0x2eb4ca,{'type':db['Sequelize'][_0x2df3('0x6a')][_0x2df3('0x6b')],'raw':!![]})[_0x2df3('0x32')](function(_0x23138d){return _0x23138d;});})[_0x2df3('0x32')](function(_0x56632a){if(_0x56632a){_0x131ff9[_0x2df3('0x23')][_0x2df3('0x6c')]=_0x56632a[0x0];if(!_0x367172[_0x2df3('0x56')]['UserId'])return;return db['User']['find']({'where':{'id':_0x367172['body'][_0x2df3('0x5f')],'role':'agent'},'attributes':['id','name','fullname',_0x2df3('0x6d'),_0x2df3('0x6e')],'raw':!![]});}return null;})['then'](function(_0x494a51){if(!_0x494a51)return null;_0x131ff9['message']['agent']=_0x494a51;return _0x131ff9;})[_0x2df3('0x32')](function(_0x7ca4a9){if(_0x7ca4a9){if(_0x367172[_0x2df3('0x56')][_0x2df3('0x6f')]){_0x131ff9[_0x2df3('0x23')]['interface']=util['format']('SIP/%s',_0x367172[_0x2df3('0x60')]['name']);_0x131ff9['message'][_0x2df3('0x70')]=_0x131ff9[_0x2df3('0x70')];_0x131ff9[_0x2df3('0x23')][_0x2df3('0x71')]=_0x131ff9[_0x2df3('0x70')];_0x131ff9[_0x2df3('0x23')][_0x2df3('0x72')]=_0x2df3('0x5a');return respondWithRpcPromise(_0x2df3('0x73'),_0x2df3('0x73'),{'event':_0x2df3('0x74'),'message':_0x131ff9[_0x2df3('0x23')]},client9002)['then'](function(){return _0x131ff9;});}return _0x131ff9;}return null;})[_0x2df3('0x32')](respondWithResult(_0x111b81,null))[_0x2df3('0x26')](handleError(_0x111b81,null));};var interaction_log=require(_0x2df3('0x12'))('openchannel-interactions');exports[_0x2df3('0x2f')]=function(_0x2d156f,_0x2c8207,_0x3072f3){var _0x197f0e={'agent':{},'channel':_0x2df3('0x5b')};if(_0x2d156f[_0x2df3('0x56')]['id']){delete _0x2d156f[_0x2df3('0x56')]['id'];}_0x2d156f[_0x2df3('0x56')]['UserId']=_0x2d156f['body'][_0x2df3('0x5f')]||_0x2d156f['user']['id'];_0x197f0e['agent']['id']=_0x2d156f[_0x2df3('0x56')][_0x2df3('0x5f')];return db[_0x2df3('0x3a')][_0x2df3('0x57')]({'where':{'id':_0x2d156f[_0x2df3('0x53')]['id'],'UserId':null}})[_0x2df3('0x32')](handleEntityNotFound(_0x2c8207,null))[_0x2df3('0x32')](function(_0x386337){if(_0x386337){_0x197f0e['message']=_0x386337[_0x2df3('0x61')]({'plain':!![]});return db[_0x2df3('0x75')][_0x2df3('0x57')]({'where':{'id':_0x386337['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2c8207,null))[_0x2df3('0x32')](function(_0x4ca619){if(_0x4ca619){_0x197f0e[_0x2df3('0x66')]=_0x4ca619[_0x2df3('0x61')]({'plain':!![]});interaction_log[_0x2df3('0x24')](_0x2df3('0x76'),_0x2d156f[_0x2df3('0x60')]['id'],_0x2d156f[_0x2df3('0x60')][_0x2df3('0x37')],_0x2d156f[_0x2df3('0x60')][_0x2df3('0x65')],_0x197f0e[_0x2df3('0x66')]['id'],_0x2d156f[_0x2df3('0x56')]?JSON[_0x2df3('0x20')](_0x2d156f[_0x2df3('0x56')]):'null');return respondWithRpcPromise(_0x2df3('0x77'),_0x2df3('0x78'),_0x197f0e);}return null;})[_0x2df3('0x32')](function(_0x510300){var _0x5818dc=_0x2df3('0x69')+_0x510300[_0x2df3('0x23')][_0x2df3('0x79')];return db['sequelize'][_0x2df3('0x3f')](_0x5818dc,{'type':db[_0x2df3('0x7a')][_0x2df3('0x6a')][_0x2df3('0x6b')],'raw':!![]})[_0x2df3('0x32')](function(_0x1e10e9){return _0x1e10e9;});})[_0x2df3('0x32')](function(_0x3882d5){if(_0x3882d5){_0x197f0e[_0x2df3('0x23')]['contact']=_0x3882d5[0x0];if(!_0x2d156f[_0x2df3('0x56')][_0x2df3('0x5f')])return;return db[_0x2df3('0x7b')][_0x2df3('0x57')]({'where':{'id':_0x2d156f['body'][_0x2df3('0x5f')],'role':_0x2df3('0x7c')},'attributes':['id',_0x2df3('0x37'),'fullname','email',_0x2df3('0x6e')],'raw':!![]});}return null;})[_0x2df3('0x32')](function(_0x5bcf37){if(!_0x5bcf37)return null;_0x197f0e['message'][_0x2df3('0x7c')]=_0x5bcf37;return _0x197f0e;})[_0x2df3('0x32')](function(_0x42c4f4){if(_0x42c4f4){_0x42c4f4[_0x2df3('0x23')]['interface']=util[_0x2df3('0x5d')](_0x2df3('0x7d'),_0x2d156f['user'][_0x2df3('0x37')]);_0x42c4f4[_0x2df3('0x23')][_0x2df3('0x70')]=_0x197f0e[_0x2df3('0x70')];_0x42c4f4[_0x2df3('0x23')][_0x2df3('0x71')]=_0x197f0e[_0x2df3('0x70')];_0x42c4f4[_0x2df3('0x23')]['event']=_0x2df3('0x2f');respondWithRpcPromise(_0x2df3('0x73'),'EventManager',{'event':_0x2df3('0x7e'),'message':_0x42c4f4[_0x2df3('0x23')]},client9002);return _0x197f0e;}return null;})[_0x2df3('0x32')](respondWithResult(_0x2c8207,null))[_0x2df3('0x26')](handleError(_0x2c8207,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 9475b3e..0f5c20b 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 _0x26c1=['remove','emit','events','OpenchannelMessage','setMaxListeners','update'];(function(_0x1d81f1,_0x26d68f){var _0x8c5808=function(_0x22c219){while(--_0x22c219){_0x1d81f1['push'](_0x1d81f1['shift']());}};_0x8c5808(++_0x26d68f);}(_0x26c1,0x128));var _0x126c=function(_0x521e8d,_0x23a290){_0x521e8d=_0x521e8d-0x0;var _0x518bbd=_0x26c1[_0x521e8d];return _0x518bbd;};'use strict';var EventEmitter=require(_0x126c('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x126c('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x126c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x126c('0x3'),'afterDestroy':_0x126c('0x4')};function emitEvent(_0x57400e){return function(_0x571e21,_0x37edff,_0x138d6d){OpenchannelMessageEvents[_0x126c('0x5')](_0x57400e+':'+_0x571e21['id'],_0x571e21);OpenchannelMessageEvents[_0x126c('0x5')](_0x57400e,_0x571e21);_0x138d6d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x588e=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x24dc3f,_0x368a6f){var _0x95c744=function(_0x43180e){while(--_0x43180e){_0x24dc3f['push'](_0x24dc3f['shift']());}};_0x95c744(++_0x368a6f);}(_0x588e,0x7d));var _0xe588=function(_0x3c3982,_0x163010){_0x3c3982=_0x3c3982-0x0;var _0x66448f=_0x588e[_0x3c3982];return _0x66448f;};'use strict';var EventEmitter=require(_0xe588('0x0'));var OpenchannelMessage=require(_0xe588('0x1'))['db'][_0xe588('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xe588('0x3')](0x0);var events={'afterCreate':_0xe588('0x4'),'afterUpdate':_0xe588('0x5'),'afterDestroy':_0xe588('0x6')};function emitEvent(_0x5ad027){return function(_0x26e5aa,_0x2da7a9,_0xd03b71){OpenchannelMessageEvents[_0xe588('0x7')](_0x5ad027+':'+_0x26e5aa['id'],_0x26e5aa);OpenchannelMessageEvents[_0xe588('0x7')](_0x5ad027,_0x26e5aa);_0xd03b71(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xe588('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 fb6f4e4..9d4850f 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 _0x8f4c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','out','secret','isNil','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','catch','error','direction','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','CmContact','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4_unicode_ci'];(function(_0x342eaa,_0x528349){var _0x5b09b4=function(_0x5c0096){while(--_0x5c0096){_0x342eaa['push'](_0x342eaa['shift']());}};_0x5b09b4(++_0x528349);}(_0x8f4c,0x113));var _0xc8f4=function(_0x3446af,_0x3b2f92){_0x3446af=_0x3446af-0x0;var _0x252b14=_0x8f4c[_0x3446af];return _0x252b14;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var logger=require(_0xc8f4('0x2'))(_0xc8f4('0x3'));var moment=require(_0xc8f4('0x4'));var BPromise=require(_0xc8f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8f4('0x6'));var rimraf=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var attributes=require('./openchannelMessage.attributes');module[_0xc8f4('0x9')]=function(_0x5208da,_0x4c86f8){return _0x5208da['define'](_0xc8f4('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xc8f4('0xb'),'fields':[_0xc8f4('0xc')],'type':_0xc8f4('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x39ed63,_0x34f05f,_0x599de3){var _0x38c41b=_0x5208da[_0xc8f4('0xe')];var _0x2fba62=_0x39ed63[_0xc8f4('0xf')]({'plain':!![]});if(_0x2fba62['direction'][_0xc8f4('0x10')]()==='in'||_0x2fba62['direction'][_0xc8f4('0x10')]()===_0xc8f4('0x11')&&!_0x2fba62[_0xc8f4('0x12')]&&!_[_0xc8f4('0x13')](_0x2fba62[_0xc8f4('0x14')])){_0x38c41b['OpenchannelInteraction'][_0xc8f4('0x15')]({'where':{'id':_0x2fba62[_0xc8f4('0x16')]}})[_0xc8f4('0x17')](function(_0x14bc11){if(_0x14bc11){_0x14bc11[_0xc8f4('0x18')]({'lastMsgAt':_0x2fba62[_0xc8f4('0x19')],'lastMsgDirection':_0x2fba62['direction'][_0xc8f4('0x10')]()});}})[_0xc8f4('0x1a')](function(_0x1518a6){console[_0xc8f4('0x1b')](_0x1518a6);});}if(_0x2fba62[_0xc8f4('0x1c')]==='out'&&!_0x2fba62[_0xc8f4('0x12')]){var _0x4d2b77;_0x38c41b['CmContact'][_0xc8f4('0x1d')]()[_0xc8f4('0x17')](function(_0x108076){return _0x38c41b[_0xc8f4('0x1e')][_0xc8f4('0x1f')]({'where':{'id':_0x2fba62[_0xc8f4('0x20')]},'include':[{'model':_0x38c41b[_0xc8f4('0x21')],'as':_0xc8f4('0x22'),'where':{'id':_0x2fba62[_0xc8f4('0x16')]},'limit':0x1,'include':[{'model':_0x38c41b[_0xc8f4('0x23')],'as':_0xc8f4('0x24'),'attributes':_[_0xc8f4('0x25')](_0x108076)}]}]});})[_0xc8f4('0x17')](function(_0x5f3264){_0x4d2b77=_0x5f3264[_0xc8f4('0xf')]({'plain':!![]});if(_0x4d2b77&&_0x4d2b77[_0xc8f4('0x26')]){logger[_0xc8f4('0x27')](_0xc8f4('0x28'),_0xc8f4('0x29'),util[_0xc8f4('0x2a')](_0xc8f4('0x2b'),_0x2fba62['id'],_0x4d2b77[_0xc8f4('0x26')]));if(_0x4d2b77['Interactions']&&_0x4d2b77[_0xc8f4('0x22')][_0xc8f4('0x2c')]){_0x2fba62[_0xc8f4('0x2d')]=_[_0xc8f4('0x2e')](_0x4d2b77['Interactions'][0x0],_0xc8f4('0x24'));_0x2fba62['Contact']=_0x4d2b77[_0xc8f4('0x22')][0x0]['Contact'];}var _0x34f05f={'method':_0xc8f4('0x2f'),'uri':encodeURI(_0x4d2b77['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x34f05f[_0xc8f4('0x30')]){case _0xc8f4('0x31'):_0x34f05f['qs']=_0x2fba62;break;case _0xc8f4('0x2f'):_0x34f05f[_0xc8f4('0xc')]=_0x2fba62;break;}return rp(_0x34f05f)['then'](function(_0x3db490){logger[_0xc8f4('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0xc8f4('0x29'),util[_0xc8f4('0x2a')](_0xc8f4('0x32'),_0x2fba62['id'],_0x4d2b77[_0xc8f4('0x26')]));if(_0x3db490[_0xc8f4('0xc')][_0xc8f4('0x33')]&&_0x3db490['body'][_0xc8f4('0x33')]!=_0x2fba62[_0xc8f4('0x2d')][_0xc8f4('0x33')]){return _0x38c41b['OpenchannelInteraction'][_0xc8f4('0x18')]({'threadId':_0x3db490[_0xc8f4('0xc')]['threadId']},{'logging':!![],'where':{'id':_0x2fba62['Interaction']['id']}});}else{return;}})['then'](function(){return _0x39ed63[_0xc8f4('0x18')]({'read':!![]});})[_0xc8f4('0x1a')](function(_0x2e9a2a){logger[_0xc8f4('0x1b')](_0xc8f4('0x28'),_0xc8f4('0x29'),util[_0xc8f4('0x34')](_0x2e9a2a,{'showHidden':![],'depth':null}));_0x599de3();});}else{_0x599de3();}})[_0xc8f4('0x35')](function(){_0x599de3();});}else{_0x599de3();}}},'charset':'utf8mb4','collate':_0xc8f4('0x36')});}; \ No newline at end of file +var _0x3423=['update','createdAt','catch','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','get','info','OpenchannelMessage,\x20%s,\x20%s','format','replyUri','length','Interaction','omit','POST','GET','afterCreate','threadId','error','inspect','finally','utf8mb4','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','toLowerCase','direction','out','isNil','UserId','findOne','OpenchannelInteractionId','then'];(function(_0x5de179,_0x33de49){var _0x5dd5a4=function(_0x362358){while(--_0x362358){_0x5de179['push'](_0x5de179['shift']());}};_0x5dd5a4(++_0x33de49);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3342('0x0'))(_0x3342('0x1'));var moment=require(_0x3342('0x2'));var BPromise=require(_0x3342('0x3'));var rp=require(_0x3342('0x4'));var fs=require('fs');var path=require(_0x3342('0x5'));var rimraf=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var attributes=require(_0x3342('0x8'));module[_0x3342('0x9')]=function(_0x467453,_0x2ccbe0){return _0x467453[_0x3342('0xa')](_0x3342('0xb'),attributes,{'tableName':_0x3342('0xc'),'paranoid':![],'indexes':[{'name':_0x3342('0xd'),'fields':[_0x3342('0xe')],'type':_0x3342('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x9cc419,_0x4ae4f3,_0x582c37){var _0x2d0cb0=_0x467453['models'];var _0x5a1fba=_0x9cc419['get']({'plain':!![]});if(_0x5a1fba['direction'][_0x3342('0x10')]()==='in'||_0x5a1fba[_0x3342('0x11')]['toLowerCase']()===_0x3342('0x12')&&!_0x5a1fba['secret']&&!_[_0x3342('0x13')](_0x5a1fba[_0x3342('0x14')])){_0x2d0cb0['OpenchannelInteraction'][_0x3342('0x15')]({'where':{'id':_0x5a1fba[_0x3342('0x16')]}})[_0x3342('0x17')](function(_0xe4689e){if(_0xe4689e){_0xe4689e[_0x3342('0x18')]({'lastMsgAt':_0x5a1fba[_0x3342('0x19')],'lastMsgDirection':_0x5a1fba[_0x3342('0x11')]['toLowerCase']()});}})[_0x3342('0x1a')](function(_0x19bd71){console['error'](_0x19bd71);});}if(_0x5a1fba[_0x3342('0x11')]===_0x3342('0x12')&&!_0x5a1fba['secret']){var _0x554f9c;_0x2d0cb0[_0x3342('0x1b')][_0x3342('0x1c')]()[_0x3342('0x17')](function(_0x2075cb){return _0x2d0cb0[_0x3342('0x1d')][_0x3342('0x1e')]({'where':{'id':_0x5a1fba[_0x3342('0x1f')]},'include':[{'model':_0x2d0cb0[_0x3342('0x20')],'as':_0x3342('0x21'),'where':{'id':_0x5a1fba['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x2d0cb0[_0x3342('0x1b')],'as':_0x3342('0x22'),'attributes':_[_0x3342('0x23')](_0x2075cb)}]}]});})['then'](function(_0x3cb86f){_0x554f9c=_0x3cb86f[_0x3342('0x24')]({'plain':!![]});if(_0x554f9c&&_0x554f9c['replyUri']){logger[_0x3342('0x25')](_0x3342('0x26'),'afterCreate',util[_0x3342('0x27')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x5a1fba['id'],_0x554f9c[_0x3342('0x28')]));if(_0x554f9c[_0x3342('0x21')]&&_0x554f9c[_0x3342('0x21')][_0x3342('0x29')]){_0x5a1fba[_0x3342('0x2a')]=_[_0x3342('0x2b')](_0x554f9c[_0x3342('0x21')][0x0],_0x3342('0x22'));_0x5a1fba['Contact']=_0x554f9c[_0x3342('0x21')][0x0]['Contact'];}var _0x4ae4f3={'method':_0x3342('0x2c'),'uri':encodeURI(_0x554f9c['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4ae4f3['method']){case _0x3342('0x2d'):_0x4ae4f3['qs']=_0x5a1fba;break;case'POST':_0x4ae4f3[_0x3342('0xe')]=_0x5a1fba;break;}return rp(_0x4ae4f3)['then'](function(_0x524286){logger['info'](_0x3342('0x26'),_0x3342('0x2e'),util[_0x3342('0x27')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x5a1fba['id'],_0x554f9c[_0x3342('0x28')]));if(_0x524286[_0x3342('0xe')][_0x3342('0x2f')]&&_0x524286[_0x3342('0xe')]['threadId']!=_0x5a1fba[_0x3342('0x2a')][_0x3342('0x2f')]){return _0x2d0cb0[_0x3342('0x20')][_0x3342('0x18')]({'threadId':_0x524286[_0x3342('0xe')][_0x3342('0x2f')]},{'logging':!![],'where':{'id':_0x5a1fba[_0x3342('0x2a')]['id']}});}else{return;}})['then'](function(){return _0x9cc419[_0x3342('0x18')]({'read':!![]});})['catch'](function(_0x9c9def){logger[_0x3342('0x30')]('OpenchannelMessage,\x20%s,\x20%s',_0x3342('0x2e'),util[_0x3342('0x31')](_0x9c9def,{'showHidden':![],'depth':null}));_0x582c37();});}else{_0x582c37();}})[_0x3342('0x32')](function(){_0x582c37();});}else{_0x582c37();}}},'charset':_0x3342('0x33'),'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 3ace8f1..8016959 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(_0x1ded25,_0x26be3d){var _0x8ec99f=function(_0x3017ac){while(--_0x3017ac){_0x1ded25['push'](_0x1ded25['shift']());}};_0x8ec99f(++_0x26be3d);}(_0xdb28,0x106));var _0x8db2=function(_0x5a21d7,_0x43c6ae){_0x5a21d7=_0x5a21d7-0x0;var _0x372af8=_0xdb28[_0x5a21d7];return _0x372af8;};'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(_0x3e8c21,_0x35e102){var _0x5aca44=function(_0x21acfc){while(--_0x21acfc){_0x3e8c21['push'](_0x3e8c21['shift']());}};_0x5aca44(++_0x35e102);}(_0x2ef3,0xba));var _0x32ef=function(_0x34e95e,_0x13958d){_0x34e95e=_0x34e95e-0x0;var _0x25a9c8=_0x2ef3[_0x34e95e];return _0x25a9c8;};'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 2752967..10d384a 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 _0xe51b=['register','./openchannelMessage.events','save','update','emit'];(function(_0x485457,_0x3ef5ae){var _0x208e90=function(_0xabb4de){while(--_0xabb4de){_0x485457['push'](_0x485457['shift']());}};_0x208e90(++_0x3ef5ae);}(_0xe51b,0x92));var _0xbe51=function(_0x2d6cae,_0x4578a7){_0x2d6cae=_0x2d6cae-0x0;var _0x1fc654=_0xe51b[_0x2d6cae];return _0x1fc654;};'use strict';var OpenchannelMessageEvents=require(_0xbe51('0x0'));var events=[_0xbe51('0x1'),'remove',_0xbe51('0x2')];function createListener(_0xc6213b,_0x102613){return function(_0x561484){_0x102613[_0xbe51('0x3')](_0xc6213b,_0x561484);};}function removeListener(_0xe3f02f,_0x38fe4c){return function(){OpenchannelMessageEvents['removeListener'](_0xe3f02f,_0x38fe4c);};}exports[_0xbe51('0x4')]=function(_0x1e589b){for(var _0x5d75dc=0x0,_0x1fb3c1=events['length'];_0x5d75dc<_0x1fb3c1;_0x5d75dc++){var _0x4b2308=events[_0x5d75dc];var _0x10ad9c=createListener('openchannelMessage:'+_0x4b2308,_0x1e589b);OpenchannelMessageEvents['on'](_0x4b2308,_0x10ad9c);}}; \ No newline at end of file +var _0x3805=['./openchannelMessage.events','save','remove','update','emit','removeListener','length'];(function(_0x538508,_0x2e7932){var _0x24d800=function(_0x1e876b){while(--_0x1e876b){_0x538508['push'](_0x538508['shift']());}};_0x24d800(++_0x2e7932);}(_0x3805,0x111));var _0x5380=function(_0x8c1005,_0x1f3f16){_0x8c1005=_0x8c1005-0x0;var _0x175354=_0x3805[_0x8c1005];return _0x175354;};'use strict';var OpenchannelMessageEvents=require(_0x5380('0x0'));var events=[_0x5380('0x1'),_0x5380('0x2'),_0x5380('0x3')];function createListener(_0x1a6ba7,_0x2c9a78){return function(_0x40a3ea){_0x2c9a78[_0x5380('0x4')](_0x1a6ba7,_0x40a3ea);};}function removeListener(_0x1a44c1,_0x38aa20){return function(){OpenchannelMessageEvents[_0x5380('0x5')](_0x1a44c1,_0x38aa20);};}exports['register']=function(_0x35f2c4){for(var _0x2ed1d8=0x0,_0x302f57=events[_0x5380('0x6')];_0x2ed1d8<_0x302f57;_0x2ed1d8++){var _0x97466a=events[_0x2ed1d8];var _0xdb98c0=createListener('openchannelMessage:'+_0x97466a,_0x35f2c4);OpenchannelMessageEvents['on'](_0x97466a,_0xdb98c0);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 766fde5..3cff822 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 _0xbaf6=['index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','post','addTeams','/:id/users','put','update','delete','destroy','removeTeams','removeAgents','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x5623cb,_0x20b099){var _0x368ce6=function(_0x3439ad){while(--_0x3439ad){_0x5623cb['push'](_0x5623cb['shift']());}};_0x368ce6(++_0x20b099);}(_0xbaf6,0x1b2));var _0x6baf=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0xbaf6[_0x3be7ff];return _0x186721;};'use strict';var multer=require('multer');var util=require(_0x6baf('0x0'));var path=require('path');var timeout=require(_0x6baf('0x1'));var express=require('express');var router=express[_0x6baf('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6baf('0x3'));var interaction=require(_0x6baf('0x4'));var config=require(_0x6baf('0x5'));var controller=require('./openchannelQueue.controller');router[_0x6baf('0x6')]('/',auth[_0x6baf('0x7')](),controller[_0x6baf('0x8')]);router[_0x6baf('0x6')](_0x6baf('0x9'),auth[_0x6baf('0x7')](),controller[_0x6baf('0xa')]);router[_0x6baf('0x6')](_0x6baf('0xb'),auth[_0x6baf('0x7')](),controller['show']);router[_0x6baf('0x6')](_0x6baf('0xc'),auth[_0x6baf('0x7')](),controller[_0x6baf('0xd')]);router[_0x6baf('0x6')](_0x6baf('0xe'),auth['isAuthenticated'](),controller[_0x6baf('0xf')]);router[_0x6baf('0x6')]('/:id/users',auth[_0x6baf('0x7')](),controller['getAgents']);router[_0x6baf('0x10')]('/',auth[_0x6baf('0x7')](),controller['create']);router['post']('/:id/teams',auth[_0x6baf('0x7')](),controller[_0x6baf('0x11')]);router[_0x6baf('0x10')](_0x6baf('0x12'),auth[_0x6baf('0x7')](),controller['addAgents']);router[_0x6baf('0x13')](_0x6baf('0xb'),auth[_0x6baf('0x7')](),controller[_0x6baf('0x14')]);router[_0x6baf('0x15')](_0x6baf('0xb'),auth[_0x6baf('0x7')](),controller[_0x6baf('0x16')]);router[_0x6baf('0x15')](_0x6baf('0xe'),auth[_0x6baf('0x7')](),controller[_0x6baf('0x17')]);router[_0x6baf('0x15')]('/:id/users',auth[_0x6baf('0x7')](),controller[_0x6baf('0x18')]);module[_0x6baf('0x19')]=router; \ No newline at end of file +var _0x4953=['../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1f750b,_0x888e6d){var _0x570ea8=function(_0x98ee84){while(--_0x98ee84){_0x1f750b['push'](_0x1f750b['shift']());}};_0x570ea8(++_0x888e6d);}(_0x4953,0xad));var _0x3495=function(_0x4fdba1,_0x560a40){_0x4fdba1=_0x4fdba1-0x0;var _0x165b10=_0x4953[_0x4fdba1];return _0x165b10;};'use strict';var multer=require(_0x3495('0x0'));var util=require('util');var path=require(_0x3495('0x1'));var timeout=require(_0x3495('0x2'));var express=require(_0x3495('0x3'));var router=express[_0x3495('0x4')]();var fs_extra=require(_0x3495('0x5'));var auth=require(_0x3495('0x6'));var interaction=require(_0x3495('0x7'));var config=require(_0x3495('0x8'));var controller=require(_0x3495('0x9'));router[_0x3495('0xa')]('/',auth[_0x3495('0xb')](),controller[_0x3495('0xc')]);router[_0x3495('0xa')](_0x3495('0xd'),auth[_0x3495('0xb')](),controller[_0x3495('0xe')]);router[_0x3495('0xa')](_0x3495('0xf'),auth[_0x3495('0xb')](),controller[_0x3495('0x10')]);router[_0x3495('0xa')](_0x3495('0x11'),auth[_0x3495('0xb')](),controller['getMembers']);router[_0x3495('0xa')](_0x3495('0x12'),auth['isAuthenticated'](),controller[_0x3495('0x13')]);router['get'](_0x3495('0x14'),auth[_0x3495('0xb')](),controller['getAgents']);router[_0x3495('0x15')]('/',auth[_0x3495('0xb')](),controller[_0x3495('0x16')]);router[_0x3495('0x15')]('/:id/teams',auth['isAuthenticated'](),controller[_0x3495('0x17')]);router[_0x3495('0x15')](_0x3495('0x14'),auth[_0x3495('0xb')](),controller[_0x3495('0x18')]);router[_0x3495('0x19')]('/:id',auth[_0x3495('0xb')](),controller['update']);router[_0x3495('0x1a')](_0x3495('0xf'),auth[_0x3495('0xb')](),controller[_0x3495('0x1b')]);router[_0x3495('0x1a')]('/:id/teams',auth[_0x3495('0xb')](),controller[_0x3495('0x1c')]);router[_0x3495('0x1a')](_0x3495('0x14'),auth[_0x3495('0xb')](),controller[_0x3495('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 5a9f6a5..5f9c8c7 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 _0x1e5b=['roundrobin','exports','name','STRING','INTEGER','ENUM','beepall'];(function(_0x3f3e50,_0x2459ee){var _0x2082c4=function(_0x1e64c5){while(--_0x1e64c5){_0x3f3e50['push'](_0x3f3e50['shift']());}};_0x2082c4(++_0x2459ee);}(_0x1e5b,0x143));var _0xb1e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e5b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xb1e5('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xb1e5('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb1e5('0x2')]},'timeout':{'type':Sequelize[_0xb1e5('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb1e5('0x4')]('rrmemory',_0xb1e5('0x5'),_0xb1e5('0x6'))}}; \ No newline at end of file +var _0xc901=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x3a7793,_0x2ea699){var _0x5d76d8=function(_0x17d19d){while(--_0x17d19d){_0x3a7793['push'](_0x3a7793['shift']());}};_0x5d76d8(++_0x2ea699);}(_0xc901,0x87));var _0x1c90=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc901[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require('sequelize');module[_0x1c90('0x0')]={'name':{'type':Sequelize[_0x1c90('0x1')],'unique':_0x1c90('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1c90('0x1')]},'timeout':{'type':Sequelize[_0x1c90('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1c90('0x4')](_0x1c90('0x5'),_0x1c90('0x6'),_0x1c90('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 46ea141..692e8f9 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 _0x586a=['../../config/utils','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','name','send','index','map','OpenchannelQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','catch','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','userProfileId','autoAssociation','error','describe','findOne','UserOpenchannelQueue','hasOwnProperty','order','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','flatMap','transaction','findOrCreate','forEach','removeTeams','field','from','team_has_openchannel_queues','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','push','sequelize','toString','QueryTypes','SELECT','every','includes','all','compact','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','emit','userOpenchannelQueue:save','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x2af29a,_0x21fd79){var _0x38d79=function(_0x22f591){while(--_0x22f591){_0x2af29a['push'](_0x2af29a['shift']());}};_0x38d79(++_0x21fd79);}(_0x586a,0x77));var _0xa586=function(_0x6ddae,_0x312d18){_0x6ddae=_0x6ddae-0x0;var _0x33889d=_0x586a[_0x6ddae];return _0x33889d;};'use strict';var emlformat=require(_0xa586('0x0'));var rimraf=require(_0xa586('0x1'));var zipdir=require(_0xa586('0x2'));var jsonpatch=require(_0xa586('0x3'));var rp=require(_0xa586('0x4'));var moment=require(_0xa586('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa586('0x6'));var util=require(_0xa586('0x7'));var path=require(_0xa586('0x8'));var sox=require(_0xa586('0x9'));var csv=require(_0xa586('0xa'));var ejs=require(_0xa586('0xb'));var fs=require('fs');var fs_extra=require(_0xa586('0xc'));var _=require('lodash');var squel=require(_0xa586('0xd'));var crypto=require(_0xa586('0xe'));var jsforce=require(_0xa586('0xf'));var deskjs=require(_0xa586('0x10'));var toCsv=require(_0xa586('0xa'));var querystring=require(_0xa586('0x11'));var Papa=require(_0xa586('0x12'));var Redis=require(_0xa586('0x13'));var authService=require(_0xa586('0x14'));var qs=require(_0xa586('0x15'));var as=require(_0xa586('0x16'));var hardwareService=require(_0xa586('0x17'));var logger=require(_0xa586('0x18'))(_0xa586('0x19'));var utils=require(_0xa586('0x1a'));var config=require(_0xa586('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xa586('0x1c'))['db'];config['redis']=_[_0xa586('0x1d')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa586('0x1e'))(new Redis(config[_0xa586('0x1f')]));require(_0xa586('0x20'))[_0xa586('0x21')](socket);function respondWithStatusCode(_0x17d914,_0x17ccbb){_0x17ccbb=_0x17ccbb||0xcc;return function(_0x2e0012){if(_0x2e0012){return _0x17d914[_0xa586('0x22')](_0x17ccbb);}return _0x17d914[_0xa586('0x23')](_0x17ccbb)[_0xa586('0x24')]();};}function respondWithResult(_0x47a256,_0x3ddd99){_0x3ddd99=_0x3ddd99||0xc8;return function(_0x12174b){if(_0x12174b){return _0x47a256[_0xa586('0x23')](_0x3ddd99)[_0xa586('0x25')](_0x12174b);}};}function respondWithFilteredResult(_0x9432e4,_0x26dfd5){return function(_0x2c2627){if(_0x2c2627){var _0x478f28=typeof _0x26dfd5[_0xa586('0x26')]===_0xa586('0x27')&&typeof _0x26dfd5['limit']===_0xa586('0x27');var _0x241410=_0x2c2627[_0xa586('0x28')];var _0x287172=_0x478f28?0x0:_0x26dfd5['offset'];var _0x5768f3=_0x478f28?_0x2c2627[_0xa586('0x28')]:_0x26dfd5[_0xa586('0x26')]+_0x26dfd5[_0xa586('0x29')];var _0x179d30;if(_0x5768f3>=_0x241410){_0x5768f3=_0x241410;_0x179d30=0xc8;}else{_0x179d30=0xce;}_0x9432e4['status'](_0x179d30);return _0x9432e4[_0xa586('0x2a')](_0xa586('0x2b'),_0x287172+'-'+_0x5768f3+'/'+_0x241410)['json'](_0x2c2627);}return null;};}function patchUpdates(_0x284176){return function(_0x32d3bc){try{jsonpatch[_0xa586('0x2c')](_0x32d3bc,_0x284176,!![]);}catch(_0x17cf02){return BPromise[_0xa586('0x2d')](_0x17cf02);}return _0x32d3bc[_0xa586('0x2e')]();};}function saveUpdates(_0x234a57,_0x1bc0c3){return function(_0x2e12a7){if(_0x2e12a7){return _0x2e12a7[_0xa586('0x2f')](_0x234a57)[_0xa586('0x30')](function(_0x24cc3e){return _0x24cc3e;});}return null;};}function removeEntity(_0x151056,_0x479e4d){return function(_0x55e164){if(_0x55e164){return _0x55e164[_0xa586('0x31')]()['then'](function(){var _0x3b57cc=_0x55e164['get']({'plain':!![]});var _0x65db12='OpenchannelQueues';return db[_0xa586('0x32')][_0xa586('0x31')]({'where':{'type':_0x65db12,'resourceId':_0x3b57cc['id']}})[_0xa586('0x30')](function(){return _0x55e164;});})[_0xa586('0x30')](function(){_0x151056[_0xa586('0x23')](0xcc)[_0xa586('0x24')]();});}};}function handleEntityNotFound(_0x26d214,_0x209e62){return function(_0x2668d6){if(!_0x2668d6){_0x26d214[_0xa586('0x22')](0x194);}return _0x2668d6;};}function handleError(_0x376512,_0x1c260d){_0x1c260d=_0x1c260d||0x1f4;return function(_0x4b7c82){logger['error'](_0x4b7c82['stack']);if(_0x4b7c82['name']){delete _0x4b7c82[_0xa586('0x33')];}_0x376512[_0xa586('0x23')](_0x1c260d)[_0xa586('0x34')](_0x4b7c82);};}exports[_0xa586('0x35')]=function(_0x3a388c,_0x1bb31c){var _0x42365b={},_0x1fff99={},_0x1eccd5={'count':0x0,'rows':[]};var _0x20aeaf=_[_0xa586('0x36')](db[_0xa586('0x37')][_0xa586('0x38')],function(_0x42485d){return{'name':_0x42485d['fieldName'],'type':_0x42485d[_0xa586('0x39')][_0xa586('0x3a')]};});_0x1fff99[_0xa586('0x3b')]=_[_0xa586('0x36')](_0x20aeaf,_0xa586('0x33'));_0x1fff99[_0xa586('0x3c')]=_[_0xa586('0x3d')](_0x3a388c['query']);_0x1fff99[_0xa586('0x3e')]=_[_0xa586('0x3f')](_0x1fff99[_0xa586('0x3b')],_0x1fff99[_0xa586('0x3c')]);_0x42365b[_0xa586('0x40')]=_[_0xa586('0x3f')](_0x1fff99[_0xa586('0x3b')],qs[_0xa586('0x41')](_0x3a388c[_0xa586('0x3c')][_0xa586('0x41')]));_0x42365b['attributes']=_0x42365b[_0xa586('0x40')][_0xa586('0x42')]?_0x42365b[_0xa586('0x40')]:_0x1fff99[_0xa586('0x3b')];if(!_0x3a388c[_0xa586('0x3c')]['hasOwnProperty'](_0xa586('0x43'))){_0x42365b['limit']=qs['limit'](_0x3a388c[_0xa586('0x3c')][_0xa586('0x29')]);_0x42365b['offset']=qs['offset'](_0x3a388c[_0xa586('0x3c')][_0xa586('0x26')]);}_0x42365b['order']=qs[_0xa586('0x44')](_0x3a388c[_0xa586('0x3c')][_0xa586('0x44')]);_0x42365b['where']=qs[_0xa586('0x3e')](_[_0xa586('0x45')](_0x3a388c['query'],_0x1fff99['filters']),_0x20aeaf);if(_0x3a388c['query'][_0xa586('0x46')]){_0x42365b['where']=_['merge'](_0x42365b[_0xa586('0x47')],{'$or':_[_0xa586('0x36')](_0x20aeaf,function(_0x3bab3c){if(_0x3bab3c[_0xa586('0x39')]!==_0xa586('0x48')){var _0x4a063d={};_0x4a063d[_0x3bab3c['name']]={'$like':'%'+_0x3a388c[_0xa586('0x3c')][_0xa586('0x46')]+'%'};return _0x4a063d;}})});}_0x42365b=_[_0xa586('0x49')]({},_0x42365b,_0x3a388c['options']);var _0x1458ff={'where':_0x42365b['where']};return db[_0xa586('0x37')][_0xa586('0x28')](_0x1458ff)[_0xa586('0x30')](function(_0x58843f){_0x1eccd5[_0xa586('0x28')]=_0x58843f;if(_0x3a388c['query']['includeAll']){_0x42365b[_0xa586('0x4a')]=[{'all':!![]}];}return db[_0xa586('0x37')][_0xa586('0x4b')](_0x42365b);})[_0xa586('0x30')](function(_0x36a176){_0x1eccd5[_0xa586('0x4c')]=_0x36a176;return _0x1eccd5;})['then'](respondWithFilteredResult(_0x1bb31c,_0x42365b))[_0xa586('0x4d')](handleError(_0x1bb31c,null));};exports['show']=function(_0x4d2400,_0x325281){var _0x2a3a22={'raw':!![],'where':{'id':_0x4d2400[_0xa586('0x4e')]['id']}},_0x480085={};_0x480085[_0xa586('0x3b')]=_['keys'](db[_0xa586('0x37')][_0xa586('0x38')]);_0x480085['query']=_['keys'](_0x4d2400[_0xa586('0x3c')]);_0x480085['filters']=_[_0xa586('0x3f')](_0x480085[_0xa586('0x3b')],_0x480085[_0xa586('0x3c')]);_0x2a3a22[_0xa586('0x40')]=_[_0xa586('0x3f')](_0x480085[_0xa586('0x3b')],qs[_0xa586('0x41')](_0x4d2400['query'][_0xa586('0x41')]));_0x2a3a22['attributes']=_0x2a3a22[_0xa586('0x40')]['length']?_0x2a3a22[_0xa586('0x40')]:_0x480085[_0xa586('0x3b')];if(_0x4d2400[_0xa586('0x3c')]['includeAll']){_0x2a3a22[_0xa586('0x4a')]=[{'all':!![]}];}_0x2a3a22=_[_0xa586('0x49')]({},_0x2a3a22,_0x4d2400[_0xa586('0x4f')]);return db['OpenchannelQueue'][_0xa586('0x50')](_0x2a3a22)[_0xa586('0x30')](handleEntityNotFound(_0x325281,null))[_0xa586('0x30')](respondWithResult(_0x325281,null))[_0xa586('0x4d')](handleError(_0x325281,null));};exports[_0xa586('0x51')]=function(_0x346f4c,_0x204701){return db['OpenchannelQueue']['create'](_0x346f4c[_0xa586('0x52')],{})[_0xa586('0x30')](function(_0x41de25){var _0xb3787=_0x346f4c[_0xa586('0x53')][_0xa586('0x54')]({'plain':!![]});if(!_0xb3787)throw new Error(_0xa586('0x55'));if(_0xb3787[_0xa586('0x56')]===_0xa586('0x53')){var _0x36a4cc=_0x41de25[_0xa586('0x54')]({'plain':!![]});var _0x284ae6=_0xa586('0x57');return db['UserProfileSection'][_0xa586('0x50')]({'where':{'name':_0x284ae6,'userProfileId':_0xb3787[_0xa586('0x58')]},'raw':!![]})[_0xa586('0x30')](function(_0x27a720){if(_0x27a720&&_0x27a720[_0xa586('0x59')]===0x0){return db[_0xa586('0x32')][_0xa586('0x51')]({'name':_0x36a4cc[_0xa586('0x33')],'resourceId':_0x36a4cc['id'],'type':_0x27a720[_0xa586('0x33')],'sectionId':_0x27a720['id']},{})['then'](function(){return _0x41de25;});}else{return _0x41de25;}})[_0xa586('0x4d')](function(_0x24cad9){logger[_0xa586('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24cad9);throw _0x24cad9;});}return _0x41de25;})[_0xa586('0x30')](respondWithResult(_0x204701,0xc9))['catch'](handleError(_0x204701,null));};exports['update']=function(_0x1cc018,_0x4e0efc){if(_0x1cc018['body']['id']){delete _0x1cc018[_0xa586('0x52')]['id'];}return db[_0xa586('0x37')][_0xa586('0x50')]({'where':{'id':_0x1cc018[_0xa586('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4e0efc,null))['then'](saveUpdates(_0x1cc018[_0xa586('0x52')],null))['then'](respondWithResult(_0x4e0efc,null))[_0xa586('0x4d')](handleError(_0x4e0efc,null));};exports['destroy']=function(_0x4703ab,_0x321e63){return db['OpenchannelQueue'][_0xa586('0x50')]({'where':{'id':_0x4703ab[_0xa586('0x4e')]['id']}})[_0xa586('0x30')](handleEntityNotFound(_0x321e63,null))[_0xa586('0x30')](removeEntity(_0x321e63,null))[_0xa586('0x4d')](handleError(_0x321e63,null));};exports['describe']=function(_0x5a43dd,_0xd2f92f){return db[_0xa586('0x37')][_0xa586('0x5b')]()[_0xa586('0x30')](respondWithResult(_0xd2f92f,null))[_0xa586('0x4d')](handleError(_0xd2f92f,null));};exports['getMembers']=function(_0x4e0de7,_0x1a3aaa,_0x2aba21){var _0x3a4176={'raw':!![],'where':{}},_0x3fe9ce={},_0x1cae11;return db['OpenchannelQueue'][_0xa586('0x5c')]({'where':{'id':_0x4e0de7[_0xa586('0x4e')]['id']}})[_0xa586('0x30')](handleEntityNotFound(_0x1a3aaa,null))['then'](function(_0x3a2b4a){if(_0x3a2b4a){_0x1cae11=_0x3a2b4a[_0xa586('0x54')]({'plain':!![]});_0x3fe9ce[_0xa586('0x3b')]=_[_0xa586('0x3d')](db[_0xa586('0x5d')][_0xa586('0x38')]);_0x3fe9ce[_0xa586('0x3c')]=_[_0xa586('0x3d')](_0x4e0de7['query']);_0x3fe9ce[_0xa586('0x3e')]=_[_0xa586('0x3f')](_0x3fe9ce[_0xa586('0x3b')],_0x3fe9ce[_0xa586('0x3c')]);_0x3a4176[_0xa586('0x40')]=_['intersection'](_0x3fe9ce['model'],qs[_0xa586('0x41')](_0x4e0de7[_0xa586('0x3c')][_0xa586('0x41')]));_0x3a4176[_0xa586('0x40')]=_0x3a4176['attributes']['length']?_0x3a4176[_0xa586('0x40')]:_0x3fe9ce[_0xa586('0x3b')];if(!_0x4e0de7[_0xa586('0x3c')][_0xa586('0x5e')]('nolimit')){_0x3a4176[_0xa586('0x29')]=qs['limit'](_0x4e0de7[_0xa586('0x3c')][_0xa586('0x29')]);_0x3a4176[_0xa586('0x26')]=qs[_0xa586('0x26')](_0x4e0de7[_0xa586('0x3c')]['offset']);}_0x3a4176[_0xa586('0x5f')]=qs[_0xa586('0x44')](_0x4e0de7[_0xa586('0x3c')][_0xa586('0x44')]);_0x3a4176[_0xa586('0x47')]=qs[_0xa586('0x3e')](_[_0xa586('0x45')](_0x4e0de7[_0xa586('0x3c')],_0x3fe9ce['filters']));_0x3a4176[_0xa586('0x47')][_0xa586('0x60')]=_0x3a2b4a['id'];if(_0x4e0de7[_0xa586('0x3c')][_0xa586('0x46')]){_0x3a4176[_0xa586('0x47')]=_[_0xa586('0x49')](_0x3a4176[_0xa586('0x47')],{'$or':_[_0xa586('0x36')](_0x3a4176['attributes'],function(_0x90ce09){var _0x4e8771={};_0x4e8771[_0x90ce09]={'$like':'%'+_0x4e0de7[_0xa586('0x3c')][_0xa586('0x46')]+'%'};return _0x4e8771;})});}_0x3a4176=_[_0xa586('0x49')]({},_0x3a4176,_0x4e0de7[_0xa586('0x4f')]);return db[_0xa586('0x5d')][_0xa586('0x4b')](_0x3a4176);}})[_0xa586('0x30')](function(_0x55fb9e){if(_0x55fb9e){return db[_0xa586('0x61')][_0xa586('0x62')]({'where':{'id':_[_0xa586('0x36')](_0x55fb9e,_0xa586('0x63')),'role':_0xa586('0x64')},'attributes':['id',_0xa586('0x33'),_0xa586('0x65'),_0xa586('0x66'),_0xa586('0x67')]});}})[_0xa586('0x30')](function(_0x5358ad){if(_0x5358ad){return{'count':_0x5358ad[_0xa586('0x28')],'rows':_[_0xa586('0x36')](_0x5358ad[_0xa586('0x4c')],function(_0xc9841f){return{'membername':_0xc9841f['name'],'UserId':_0xc9841f['id'],'queue_name':_0x1cae11[_0xa586('0x33')],'OpenchannelQueueId':_0x1cae11['id'],'interface':util[_0xa586('0x68')](_0xa586('0x69'),_0xa586('0x6a'),_0xc9841f[_0xa586('0x33')]),'penalty':0x0,'paused':_0xc9841f[_0xa586('0x65')],'createdAt':_0xc9841f[_0xa586('0x67')],'updatedAt':_0xc9841f[_0xa586('0x66')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa586('0x30')](respondWithFilteredResult(_0x1a3aaa,_0x3a4176))[_0xa586('0x4d')](handleError(_0x1a3aaa,null));};exports[_0xa586('0x6b')]=function(_0x53bc48,_0x235182,_0x108b41){var _0x3f1810={};var _0x266cf4={};var _0x7af81;var _0x356106;return db[_0xa586('0x37')][_0xa586('0x5c')]({'where':{'id':_0x53bc48['params']['id']}})[_0xa586('0x30')](handleEntityNotFound(_0x235182,null))[_0xa586('0x30')](function(_0x3f6e78){if(_0x3f6e78){_0x7af81=_0x3f6e78;_0x266cf4[_0xa586('0x3b')]=_[_0xa586('0x3d')](db['Team'][_0xa586('0x38')]);_0x266cf4['query']=_[_0xa586('0x3d')](_0x53bc48['query']);_0x266cf4['filters']=_[_0xa586('0x3f')](_0x266cf4[_0xa586('0x3b')],_0x266cf4[_0xa586('0x3c')]);_0x3f1810['attributes']=_[_0xa586('0x3f')](_0x266cf4[_0xa586('0x3b')],qs['fields'](_0x53bc48[_0xa586('0x3c')][_0xa586('0x41')]));_0x3f1810[_0xa586('0x40')]=_0x3f1810[_0xa586('0x40')][_0xa586('0x42')]?_0x3f1810['attributes']:_0x266cf4[_0xa586('0x3b')];_0x3f1810[_0xa586('0x5f')]=qs[_0xa586('0x44')](_0x53bc48[_0xa586('0x3c')]['sort']);_0x3f1810[_0xa586('0x47')]=qs[_0xa586('0x3e')](_[_0xa586('0x45')](_0x53bc48['query'],_0x266cf4[_0xa586('0x3e')]));if(_0x53bc48[_0xa586('0x3c')][_0xa586('0x46')]){_0x3f1810[_0xa586('0x47')]=_[_0xa586('0x49')](_0x3f1810[_0xa586('0x47')],{'$or':_[_0xa586('0x36')](_0x3f1810['attributes'],function(_0x3dc4ed){var _0x2a37ef={};_0x2a37ef[_0x3dc4ed]={'$like':'%'+_0x53bc48[_0xa586('0x3c')][_0xa586('0x46')]+'%'};return _0x2a37ef;})});}_0x3f1810=_[_0xa586('0x49')]({},_0x3f1810,_0x53bc48[_0xa586('0x4f')]);return _0x7af81[_0xa586('0x6b')](_0x3f1810);}})[_0xa586('0x30')](function(_0x3dcc66){if(_0x3dcc66){_0x356106=_0x3dcc66[_0xa586('0x42')];if(!_0x53bc48[_0xa586('0x3c')]['hasOwnProperty']('nolimit')){_0x3f1810[_0xa586('0x29')]=qs[_0xa586('0x29')](_0x53bc48[_0xa586('0x3c')][_0xa586('0x29')]);_0x3f1810[_0xa586('0x26')]=qs['offset'](_0x53bc48['query'][_0xa586('0x26')]);}return _0x7af81[_0xa586('0x6b')](_0x3f1810);}})[_0xa586('0x30')](function(_0x5bd513){if(_0x5bd513){return _0x5bd513?{'count':_0x356106,'rows':_0x5bd513}:null;}})['then'](respondWithResult(_0x235182,null))[_0xa586('0x4d')](handleError(_0x235182,null));};exports[_0xa586('0x6c')]=function(_0xefc86f,_0x2fcc24,_0x15f1be){var _0x21cda0=_0xefc86f[_0xa586('0x52')][_0xa586('0x6d')];return db[_0xa586('0x6e')]['findAll']({'where':{'id':_0x21cda0},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa586('0x6f'),'attributes':['id',_0xa586('0x33'),_0xa586('0x70'),_0xa586('0x71'),'interface'],'raw':!![]}]})['then'](function(_0xd958ae){if(_0xd958ae){var _0x3aec3f=_[_0xa586('0x72')](_0xd958ae,function(_0x26683b){var _0x5ac6ca=_0x26683b[_0xa586('0x54')]({'plain':!![]});return _0x5ac6ca['Agents'];});return db[_0xa586('0x37')][_0xa586('0x50')]({'where':{'id':_0xefc86f['params']['id']}})[_0xa586('0x30')](function(_0x55f53e){return db['sequelize'][_0xa586('0x73')](function(_0x297b81){return _0x55f53e[_0xa586('0x6c')](_0x21cda0,{'transaction':_0x297b81})[_0xa586('0x30')](function(){return BPromise['each'](_0x3aec3f,function(_0x4417fc){return db[_0xa586('0x5d')][_0xa586('0x74')]({'where':{'UserId':_0x4417fc['id'],'OpenchannelQueueId':_0xefc86f[_0xa586('0x4e')]['id']},'transaction':_0x297b81});});})[_0xa586('0x30')](function(){_0x3aec3f[_0xa586('0x75')](function(_0x286d80){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x286d80['id'],'OpenchannelQueueId':_0x55f53e['id']});});});});});}})[_0xa586('0x30')](respondWithStatusCode(_0x2fcc24,null))['catch'](handleError(_0x2fcc24,null));};exports[_0xa586('0x76')]=function(_0x1efaf5,_0x41cff1,_0x2db2cb){return db[_0xa586('0x6e')][_0xa586('0x4b')]({'where':{'id':_0x1efaf5['query'][_0xa586('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xa586('0x61')],'as':_0xa586('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xa586('0x30')](handleEntityNotFound(_0x41cff1,null))[_0xa586('0x30')](function(_0x4b164e){var _0x1f1705=_[_0xa586('0x36')](_0x4b164e,'id');var _0x13734b=[];var _0x58086f=[];var _0x297a97=squel['select']();_0x297a97[_0xa586('0x77')]('tq.TeamId')[_0xa586('0x78')](_0xa586('0x79'),'tq')['join'](_0xa586('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa586('0x47')](_0xa586('0x7b'),_0x1efaf5['params']['id']);for(var _0x14b677=0x0;_0x14b677<_0x4b164e['length'];_0x14b677+=0x1){let _0x117b23=_0x4b164e[_0x14b677];for(var _0x57bee1=0x0;_0x57bee1<_0x117b23['Agents'][_0xa586('0x42')];_0x57bee1+=0x1){let _0x5cedf3=_0x117b23['Agents'][_0x57bee1];var _0x21f9f6=_0x297a97[_0xa586('0x7c')]();_0x21f9f6['where']('ut.UserId\x20=\x20?',_0x5cedf3['id']);_0x58086f[_0xa586('0x7d')](db[_0xa586('0x7e')][_0xa586('0x3c')](_0x21f9f6[_0xa586('0x7f')](),{'type':db['sequelize'][_0xa586('0x80')][_0xa586('0x81')]})['then'](function(_0x2fdbbf){if(_0x2fdbbf[_0xa586('0x42')]===0x1){return _0x5cedf3['id'];}else{var _0x4e2811=_[_0xa586('0x82')](_['map'](_0x2fdbbf,'TeamId'),function(_0x208228){return _[_0xa586('0x83')](_0x1f1705,_0x208228);});if(_0x4e2811){return _0x5cedf3['id'];}}}));}}return BPromise[_0xa586('0x84')](_0x58086f)[_0xa586('0x30')](function(_0x11a72e){_0x13734b=_(_0x13734b)['union'](_0x11a72e)[_0xa586('0x85')]()[_0xa586('0x86')]();return db[_0xa586('0x37')][_0xa586('0x50')]({'where':{'id':_0x1efaf5[_0xa586('0x4e')]['id']}})[_0xa586('0x30')](function(_0xa5571f){return db[_0xa586('0x7e')][_0xa586('0x73')](function(_0xfafd84){return _0xa5571f[_0xa586('0x76')](_0x1efaf5[_0xa586('0x3c')]['ids'],{'transaction':_0xfafd84})[_0xa586('0x30')](function(){if(!_[_0xa586('0x87')](_0x13734b)){return _0xa5571f[_0xa586('0x88')](_0x13734b,{'transaction':_0xfafd84});}})[_0xa586('0x30')](function(){_0x13734b['forEach'](function(_0x245184){socket['emit'](_0xa586('0x89'),{'UserId':_0x245184,'OpenchannelQueueId':_0xa5571f['id']});});});});});});})[_0xa586('0x30')](respondWithStatusCode(_0x41cff1,null))[_0xa586('0x4d')](handleError(_0x41cff1,null));};exports[_0xa586('0x8a')]=function(_0x5becf7,_0x48c74e,_0x52078e){return db[_0xa586('0x37')][_0xa586('0x50')]({'where':{'id':_0x5becf7['params']['id']}})['then'](handleEntityNotFound(_0x48c74e,null))[_0xa586('0x30')](function(_0x512a0d){if(_0x512a0d){return _0x512a0d['addAgents'](_0x5becf7[_0xa586('0x52')][_0xa586('0x6d')],_[_0xa586('0x8b')](_0x5becf7[_0xa586('0x52')],['ids','id'])||{})[_0xa586('0x8c')](function(_0x55fd0f){for(var _0x585b1f=0x0;_0x585b1f<_0x5becf7[_0xa586('0x52')]['ids'][_0xa586('0x42')];_0x585b1f+=0x1){socket[_0xa586('0x8d')](_0xa586('0x8e'),{'UserId':Number(_0x5becf7[_0xa586('0x52')]['ids'][_0x585b1f]),'OpenchannelQueueId':Number(_0x5becf7[_0xa586('0x4e')]['id'])});}return _0x55fd0f;});}})[_0xa586('0x30')](respondWithResult(_0x48c74e,null))[_0xa586('0x4d')](handleError(_0x48c74e,null));};exports[_0xa586('0x88')]=function(_0x55360a,_0x597a81,_0x556614){return db[_0xa586('0x37')][_0xa586('0x50')]({'where':{'id':_0x55360a[_0xa586('0x4e')]['id']}})[_0xa586('0x30')](handleEntityNotFound(_0x597a81,null))['then'](function(_0x10e5d6){if(_0x10e5d6){return _0x10e5d6[_0xa586('0x88')](_0x55360a[_0xa586('0x3c')][_0xa586('0x6d')])[_0xa586('0x30')](function(){if(_[_0xa586('0x8f')](_0x55360a[_0xa586('0x3c')]['ids'])){for(var _0x1b247b=0x0;_0x1b247b<_0x55360a['query']['ids'][_0xa586('0x42')];_0x1b247b+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x55360a[_0xa586('0x3c')][_0xa586('0x6d')][_0x1b247b]),'OpenchannelQueueId':Number(_0x55360a[_0xa586('0x4e')]['id'])});}}else{socket[_0xa586('0x8d')](_0xa586('0x89'),{'UserId':Number(_0x55360a[_0xa586('0x3c')][_0xa586('0x6d')]),'OpenchannelQueueId':Number(_0x55360a[_0xa586('0x4e')]['id'])});}});}})[_0xa586('0x30')](respondWithStatusCode(_0x597a81,null))[_0xa586('0x4d')](handleError(_0x597a81,null));};exports[_0xa586('0x90')]=function(_0x9ec1cd,_0x149319,_0x1cbac3){var _0x4de130={};var _0x113321={};var _0x1cf3b1;var _0x1cccc8;return db[_0xa586('0x37')][_0xa586('0x5c')]({'where':{'id':_0x9ec1cd['params']['id']}})[_0xa586('0x30')](handleEntityNotFound(_0x149319,null))[_0xa586('0x30')](function(_0x74e164){if(_0x74e164){_0x1cf3b1=_0x74e164;_0x113321['model']=_[_0xa586('0x3d')](db['User'][_0xa586('0x38')]);_0x113321[_0xa586('0x3c')]=_['keys'](_0x9ec1cd[_0xa586('0x3c')]);_0x113321[_0xa586('0x3e')]=_['intersection'](_0x113321[_0xa586('0x3b')],_0x113321[_0xa586('0x3c')]);_0x4de130[_0xa586('0x40')]=_[_0xa586('0x3f')](_0x113321[_0xa586('0x3b')],qs['fields'](_0x9ec1cd[_0xa586('0x3c')][_0xa586('0x41')]));_0x4de130[_0xa586('0x40')]=_0x4de130[_0xa586('0x40')][_0xa586('0x42')]?_0x4de130[_0xa586('0x40')]:_0x113321[_0xa586('0x3b')];_0x4de130[_0xa586('0x5f')]=qs[_0xa586('0x44')](_0x9ec1cd[_0xa586('0x3c')]['sort']);_0x4de130[_0xa586('0x47')]=qs[_0xa586('0x3e')](_['pick'](_0x9ec1cd[_0xa586('0x3c')],_0x113321['filters']));if(_0x9ec1cd['query']['filter']){_0x4de130['where']=_[_0xa586('0x49')](_0x4de130[_0xa586('0x47')],{'$or':_[_0xa586('0x36')](_0x4de130[_0xa586('0x40')],function(_0x3c1206){var _0x52ca39={};_0x52ca39[_0x3c1206]={'$like':'%'+_0x9ec1cd['query'][_0xa586('0x46')]+'%'};return _0x52ca39;})});}_0x4de130=_[_0xa586('0x49')]({},_0x4de130,_0x9ec1cd[_0xa586('0x4f')]);return _0x1cf3b1[_0xa586('0x90')](_0x4de130);}})[_0xa586('0x30')](function(_0x20dd77){if(_0x20dd77){_0x1cccc8=_0x20dd77['length'];if(!_0x9ec1cd[_0xa586('0x3c')][_0xa586('0x5e')](_0xa586('0x43'))){_0x4de130['limit']=qs[_0xa586('0x29')](_0x9ec1cd[_0xa586('0x3c')][_0xa586('0x29')]);_0x4de130['offset']=qs['offset'](_0x9ec1cd[_0xa586('0x3c')]['offset']);}return _0x1cf3b1['getAgents'](_0x4de130);}})[_0xa586('0x30')](function(_0x57ff7e){if(_0x57ff7e){return _0x57ff7e?{'count':_0x1cccc8,'rows':_0x57ff7e}:null;}})[_0xa586('0x30')](respondWithResult(_0x149319,null))[_0xa586('0x4d')](handleError(_0x149319,null));}; \ No newline at end of file +var _0xb00d=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./openchannelQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','destroy','get','OpenchannelQueues','stack','name','send','map','OpenchannelQueue','fieldName','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','filters','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','order','OpenchannelQueueId','findAndCountAll','agent','createdAt','format','SIP','openchannelPause','updatedAt','getTeams','rawAttributes','pick','addTeams','ids','Team','User','Agents','online','voicePause','interface','flatMap','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb00d,0x8a));var _0xdb00=function(_0x53b93b,_0x1bfab1){_0x53b93b=_0x53b93b-0x0;var _0x485761=_0xb00d[_0x53b93b];return _0x485761;};'use strict';var emlformat=require(_0xdb00('0x0'));var rimraf=require(_0xdb00('0x1'));var zipdir=require(_0xdb00('0x2'));var jsonpatch=require(_0xdb00('0x3'));var rp=require('request-promise');var moment=require(_0xdb00('0x4'));var BPromise=require(_0xdb00('0x5'));var Mustache=require(_0xdb00('0x6'));var util=require('util');var path=require(_0xdb00('0x7'));var sox=require(_0xdb00('0x8'));var csv=require(_0xdb00('0x9'));var ejs=require(_0xdb00('0xa'));var fs=require('fs');var fs_extra=require(_0xdb00('0xb'));var _=require(_0xdb00('0xc'));var squel=require(_0xdb00('0xd'));var crypto=require(_0xdb00('0xe'));var jsforce=require(_0xdb00('0xf'));var deskjs=require(_0xdb00('0x10'));var toCsv=require(_0xdb00('0x9'));var querystring=require(_0xdb00('0x11'));var Papa=require(_0xdb00('0x12'));var Redis=require('ioredis');var authService=require(_0xdb00('0x13'));var qs=require(_0xdb00('0x14'));var as=require(_0xdb00('0x15'));var hardwareService=require(_0xdb00('0x16'));var logger=require(_0xdb00('0x17'))(_0xdb00('0x18'));var utils=require(_0xdb00('0x19'));var config=require(_0xdb00('0x1a'));var licenseUtil=require(_0xdb00('0x1b'));var db=require('../../mysqldb')['db'];config[_0xdb00('0x1c')]=_[_0xdb00('0x1d')](config[_0xdb00('0x1c')],{'host':_0xdb00('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdb00('0x1c')]));require(_0xdb00('0x1f'))[_0xdb00('0x20')](socket);function respondWithStatusCode(_0x4ea75b,_0x2aa350){_0x2aa350=_0x2aa350||0xcc;return function(_0x25a8d8){if(_0x25a8d8){return _0x4ea75b[_0xdb00('0x21')](_0x2aa350);}return _0x4ea75b[_0xdb00('0x22')](_0x2aa350)[_0xdb00('0x23')]();};}function respondWithResult(_0x15d89e,_0x4136ee){_0x4136ee=_0x4136ee||0xc8;return function(_0x456645){if(_0x456645){return _0x15d89e[_0xdb00('0x22')](_0x4136ee)[_0xdb00('0x24')](_0x456645);}};}function respondWithFilteredResult(_0x57bf1e,_0x4a375f){return function(_0xd822f0){if(_0xd822f0){var _0x340a94=typeof _0x4a375f[_0xdb00('0x25')]==='undefined'&&typeof _0x4a375f[_0xdb00('0x26')]===_0xdb00('0x27');var _0x5cdf4d=_0xd822f0[_0xdb00('0x28')];var _0x19d71f=_0x340a94?0x0:_0x4a375f['offset'];var _0x40e45c=_0x340a94?_0xd822f0[_0xdb00('0x28')]:_0x4a375f[_0xdb00('0x25')]+_0x4a375f[_0xdb00('0x26')];var _0x3299d2;if(_0x40e45c>=_0x5cdf4d){_0x40e45c=_0x5cdf4d;_0x3299d2=0xc8;}else{_0x3299d2=0xce;}_0x57bf1e['status'](_0x3299d2);return _0x57bf1e[_0xdb00('0x29')]('Content-Range',_0x19d71f+'-'+_0x40e45c+'/'+_0x5cdf4d)[_0xdb00('0x24')](_0xd822f0);}return null;};}function patchUpdates(_0x731bb8){return function(_0xae9d5f){try{jsonpatch[_0xdb00('0x2a')](_0xae9d5f,_0x731bb8,!![]);}catch(_0x2f059e){return BPromise[_0xdb00('0x2b')](_0x2f059e);}return _0xae9d5f[_0xdb00('0x2c')]();};}function saveUpdates(_0x130184,_0x5e6f8a){return function(_0x1b6d35){if(_0x1b6d35){return _0x1b6d35['update'](_0x130184)[_0xdb00('0x2d')](function(_0x2d6d6c){return _0x2d6d6c;});}return null;};}function removeEntity(_0x1fab93,_0x150777){return function(_0x23fa27){if(_0x23fa27){return _0x23fa27[_0xdb00('0x2e')]()['then'](function(){var _0x2e845a=_0x23fa27[_0xdb00('0x2f')]({'plain':!![]});var _0x802214=_0xdb00('0x30');return db['UserProfileResource'][_0xdb00('0x2e')]({'where':{'type':_0x802214,'resourceId':_0x2e845a['id']}})['then'](function(){return _0x23fa27;});})[_0xdb00('0x2d')](function(){_0x1fab93['status'](0xcc)[_0xdb00('0x23')]();});}};}function handleEntityNotFound(_0x2333ba,_0x52117c){return function(_0x720f38){if(!_0x720f38){_0x2333ba['sendStatus'](0x194);}return _0x720f38;};}function handleError(_0x31fb8b,_0x3bbe1b){_0x3bbe1b=_0x3bbe1b||0x1f4;return function(_0x59d10c){logger['error'](_0x59d10c[_0xdb00('0x31')]);if(_0x59d10c[_0xdb00('0x32')]){delete _0x59d10c[_0xdb00('0x32')];}_0x31fb8b[_0xdb00('0x22')](_0x3bbe1b)[_0xdb00('0x33')](_0x59d10c);};}exports['index']=function(_0x125837,_0x283d20){var _0x558838={},_0x2cb690={},_0x573a43={'count':0x0,'rows':[]};var _0x13f09f=_[_0xdb00('0x34')](db[_0xdb00('0x35')]['rawAttributes'],function(_0xd4e1f3){return{'name':_0xd4e1f3[_0xdb00('0x36')],'type':_0xd4e1f3['type'][_0xdb00('0x37')]};});_0x2cb690[_0xdb00('0x38')]=_[_0xdb00('0x34')](_0x13f09f,_0xdb00('0x32'));_0x2cb690['query']=_[_0xdb00('0x39')](_0x125837['query']);_0x2cb690['filters']=_[_0xdb00('0x3a')](_0x2cb690[_0xdb00('0x38')],_0x2cb690[_0xdb00('0x3b')]);_0x558838[_0xdb00('0x3c')]=_[_0xdb00('0x3a')](_0x2cb690[_0xdb00('0x38')],qs[_0xdb00('0x3d')](_0x125837[_0xdb00('0x3b')]['fields']));_0x558838['attributes']=_0x558838[_0xdb00('0x3c')]['length']?_0x558838[_0xdb00('0x3c')]:_0x2cb690[_0xdb00('0x38')];if(!_0x125837[_0xdb00('0x3b')][_0xdb00('0x3e')](_0xdb00('0x3f'))){_0x558838[_0xdb00('0x26')]=qs[_0xdb00('0x26')](_0x125837[_0xdb00('0x3b')][_0xdb00('0x26')]);_0x558838[_0xdb00('0x25')]=qs[_0xdb00('0x25')](_0x125837[_0xdb00('0x3b')][_0xdb00('0x25')]);}_0x558838['order']=qs[_0xdb00('0x40')](_0x125837[_0xdb00('0x3b')][_0xdb00('0x40')]);_0x558838['where']=qs[_0xdb00('0x41')](_['pick'](_0x125837[_0xdb00('0x3b')],_0x2cb690[_0xdb00('0x41')]),_0x13f09f);if(_0x125837[_0xdb00('0x3b')]['filter']){_0x558838[_0xdb00('0x42')]=_[_0xdb00('0x43')](_0x558838[_0xdb00('0x42')],{'$or':_['map'](_0x13f09f,function(_0x177527){if(_0x177527[_0xdb00('0x44')]!==_0xdb00('0x45')){var _0x2ac07c={};_0x2ac07c[_0x177527['name']]={'$like':'%'+_0x125837['query'][_0xdb00('0x46')]+'%'};return _0x2ac07c;}})});}_0x558838=_['merge']({},_0x558838,_0x125837[_0xdb00('0x47')]);var _0x408c87={'where':_0x558838['where']};return db[_0xdb00('0x35')][_0xdb00('0x28')](_0x408c87)[_0xdb00('0x2d')](function(_0xd8a6dc){_0x573a43[_0xdb00('0x28')]=_0xd8a6dc;if(_0x125837['query'][_0xdb00('0x48')]){_0x558838[_0xdb00('0x49')]=[{'all':!![]}];}return db[_0xdb00('0x35')][_0xdb00('0x4a')](_0x558838);})[_0xdb00('0x2d')](function(_0xa7bb44){_0x573a43[_0xdb00('0x4b')]=_0xa7bb44;return _0x573a43;})['then'](respondWithFilteredResult(_0x283d20,_0x558838))['catch'](handleError(_0x283d20,null));};exports[_0xdb00('0x4c')]=function(_0x41afe8,_0x388db8){var _0x4701aa={'raw':!![],'where':{'id':_0x41afe8[_0xdb00('0x4d')]['id']}},_0x591ae7={};_0x591ae7[_0xdb00('0x38')]=_[_0xdb00('0x39')](db[_0xdb00('0x35')]['rawAttributes']);_0x591ae7[_0xdb00('0x3b')]=_[_0xdb00('0x39')](_0x41afe8[_0xdb00('0x3b')]);_0x591ae7[_0xdb00('0x41')]=_[_0xdb00('0x3a')](_0x591ae7[_0xdb00('0x38')],_0x591ae7[_0xdb00('0x3b')]);_0x4701aa[_0xdb00('0x3c')]=_[_0xdb00('0x3a')](_0x591ae7[_0xdb00('0x38')],qs[_0xdb00('0x3d')](_0x41afe8[_0xdb00('0x3b')][_0xdb00('0x3d')]));_0x4701aa['attributes']=_0x4701aa[_0xdb00('0x3c')][_0xdb00('0x4e')]?_0x4701aa[_0xdb00('0x3c')]:_0x591ae7[_0xdb00('0x38')];if(_0x41afe8[_0xdb00('0x3b')][_0xdb00('0x48')]){_0x4701aa[_0xdb00('0x49')]=[{'all':!![]}];}_0x4701aa=_[_0xdb00('0x43')]({},_0x4701aa,_0x41afe8[_0xdb00('0x47')]);return db['OpenchannelQueue'][_0xdb00('0x4f')](_0x4701aa)['then'](handleEntityNotFound(_0x388db8,null))['then'](respondWithResult(_0x388db8,null))[_0xdb00('0x50')](handleError(_0x388db8,null));};exports[_0xdb00('0x51')]=function(_0x51b0a4,_0x203e1d){return db['OpenchannelQueue']['create'](_0x51b0a4[_0xdb00('0x52')],{})[_0xdb00('0x2d')](function(_0x230127){var _0x426612=_0x51b0a4[_0xdb00('0x53')][_0xdb00('0x2f')]({'plain':!![]});if(!_0x426612)throw new Error(_0xdb00('0x54'));if(_0x426612[_0xdb00('0x55')]===_0xdb00('0x53')){var _0x29931e=_0x230127[_0xdb00('0x2f')]({'plain':!![]});var _0x162992=_0xdb00('0x30');return db[_0xdb00('0x56')][_0xdb00('0x4f')]({'where':{'name':_0x162992,'userProfileId':_0x426612[_0xdb00('0x57')]},'raw':!![]})[_0xdb00('0x2d')](function(_0x14e473){if(_0x14e473&&_0x14e473[_0xdb00('0x58')]===0x0){return db[_0xdb00('0x59')][_0xdb00('0x51')]({'name':_0x29931e['name'],'resourceId':_0x29931e['id'],'type':_0x14e473[_0xdb00('0x32')],'sectionId':_0x14e473['id']},{})[_0xdb00('0x2d')](function(){return _0x230127;});}else{return _0x230127;}})[_0xdb00('0x50')](function(_0x1b5adb){logger['error'](_0xdb00('0x5a'),_0x1b5adb);throw _0x1b5adb;});}return _0x230127;})[_0xdb00('0x2d')](respondWithResult(_0x203e1d,0xc9))['catch'](handleError(_0x203e1d,null));};exports['update']=function(_0x1cc9e3,_0x1e11a7){if(_0x1cc9e3[_0xdb00('0x52')]['id']){delete _0x1cc9e3['body']['id'];}return db['OpenchannelQueue'][_0xdb00('0x4f')]({'where':{'id':_0x1cc9e3[_0xdb00('0x4d')]['id']}})[_0xdb00('0x2d')](handleEntityNotFound(_0x1e11a7,null))['then'](saveUpdates(_0x1cc9e3[_0xdb00('0x52')],null))[_0xdb00('0x2d')](respondWithResult(_0x1e11a7,null))[_0xdb00('0x50')](handleError(_0x1e11a7,null));};exports[_0xdb00('0x2e')]=function(_0x11c034,_0x4422c5){return db[_0xdb00('0x35')][_0xdb00('0x4f')]({'where':{'id':_0x11c034[_0xdb00('0x4d')]['id']}})[_0xdb00('0x2d')](handleEntityNotFound(_0x4422c5,null))[_0xdb00('0x2d')](removeEntity(_0x4422c5,null))['catch'](handleError(_0x4422c5,null));};exports[_0xdb00('0x5b')]=function(_0x1ac754,_0x410699){return db[_0xdb00('0x35')]['describe']()[_0xdb00('0x2d')](respondWithResult(_0x410699,null))[_0xdb00('0x50')](handleError(_0x410699,null));};exports[_0xdb00('0x5c')]=function(_0x5270c0,_0x59e820,_0xccb6cd){var _0x80de8a={'raw':!![],'where':{}},_0x18a0dc={},_0x420e59;return db[_0xdb00('0x35')][_0xdb00('0x5d')]({'where':{'id':_0x5270c0[_0xdb00('0x4d')]['id']}})[_0xdb00('0x2d')](handleEntityNotFound(_0x59e820,null))['then'](function(_0x396333){if(_0x396333){_0x420e59=_0x396333[_0xdb00('0x2f')]({'plain':!![]});_0x18a0dc[_0xdb00('0x38')]=_['keys'](db[_0xdb00('0x5e')]['rawAttributes']);_0x18a0dc['query']=_[_0xdb00('0x39')](_0x5270c0[_0xdb00('0x3b')]);_0x18a0dc[_0xdb00('0x41')]=_[_0xdb00('0x3a')](_0x18a0dc[_0xdb00('0x38')],_0x18a0dc[_0xdb00('0x3b')]);_0x80de8a[_0xdb00('0x3c')]=_[_0xdb00('0x3a')](_0x18a0dc[_0xdb00('0x38')],qs[_0xdb00('0x3d')](_0x5270c0[_0xdb00('0x3b')][_0xdb00('0x3d')]));_0x80de8a[_0xdb00('0x3c')]=_0x80de8a[_0xdb00('0x3c')]['length']?_0x80de8a[_0xdb00('0x3c')]:_0x18a0dc[_0xdb00('0x38')];if(!_0x5270c0[_0xdb00('0x3b')][_0xdb00('0x3e')](_0xdb00('0x3f'))){_0x80de8a[_0xdb00('0x26')]=qs[_0xdb00('0x26')](_0x5270c0[_0xdb00('0x3b')][_0xdb00('0x26')]);_0x80de8a[_0xdb00('0x25')]=qs[_0xdb00('0x25')](_0x5270c0['query'][_0xdb00('0x25')]);}_0x80de8a[_0xdb00('0x5f')]=qs['sort'](_0x5270c0[_0xdb00('0x3b')]['sort']);_0x80de8a[_0xdb00('0x42')]=qs[_0xdb00('0x41')](_['pick'](_0x5270c0[_0xdb00('0x3b')],_0x18a0dc[_0xdb00('0x41')]));_0x80de8a[_0xdb00('0x42')][_0xdb00('0x60')]=_0x396333['id'];if(_0x5270c0['query'][_0xdb00('0x46')]){_0x80de8a[_0xdb00('0x42')]=_[_0xdb00('0x43')](_0x80de8a[_0xdb00('0x42')],{'$or':_[_0xdb00('0x34')](_0x80de8a[_0xdb00('0x3c')],function(_0x43caee){var _0x50890d={};_0x50890d[_0x43caee]={'$like':'%'+_0x5270c0[_0xdb00('0x3b')][_0xdb00('0x46')]+'%'};return _0x50890d;})});}_0x80de8a=_[_0xdb00('0x43')]({},_0x80de8a,_0x5270c0[_0xdb00('0x47')]);return db['UserOpenchannelQueue'][_0xdb00('0x4a')](_0x80de8a);}})[_0xdb00('0x2d')](function(_0x4f5a6e){if(_0x4f5a6e){return db['User'][_0xdb00('0x61')]({'where':{'id':_[_0xdb00('0x34')](_0x4f5a6e,'UserId'),'role':_0xdb00('0x62')},'attributes':['id',_0xdb00('0x32'),'openchannelPause','updatedAt',_0xdb00('0x63')]});}})[_0xdb00('0x2d')](function(_0x281156){if(_0x281156){return{'count':_0x281156[_0xdb00('0x28')],'rows':_[_0xdb00('0x34')](_0x281156['rows'],function(_0x4d1469){return{'membername':_0x4d1469[_0xdb00('0x32')],'UserId':_0x4d1469['id'],'queue_name':_0x420e59[_0xdb00('0x32')],'OpenchannelQueueId':_0x420e59['id'],'interface':util[_0xdb00('0x64')]('%s/%s',_0xdb00('0x65'),_0x4d1469['name']),'penalty':0x0,'paused':_0x4d1469[_0xdb00('0x66')],'createdAt':_0x4d1469['createdAt'],'updatedAt':_0x4d1469[_0xdb00('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x59e820,_0x80de8a))[_0xdb00('0x50')](handleError(_0x59e820,null));};exports[_0xdb00('0x68')]=function(_0x17989a,_0x226543,_0x2a1452){var _0x406722={};var _0x5690bd={};var _0x450de9;var _0x1edc16;return db[_0xdb00('0x35')][_0xdb00('0x5d')]({'where':{'id':_0x17989a[_0xdb00('0x4d')]['id']}})[_0xdb00('0x2d')](handleEntityNotFound(_0x226543,null))['then'](function(_0x19827a){if(_0x19827a){_0x450de9=_0x19827a;_0x5690bd['model']=_[_0xdb00('0x39')](db['Team'][_0xdb00('0x69')]);_0x5690bd['query']=_[_0xdb00('0x39')](_0x17989a[_0xdb00('0x3b')]);_0x5690bd[_0xdb00('0x41')]=_['intersection'](_0x5690bd[_0xdb00('0x38')],_0x5690bd[_0xdb00('0x3b')]);_0x406722[_0xdb00('0x3c')]=_['intersection'](_0x5690bd[_0xdb00('0x38')],qs[_0xdb00('0x3d')](_0x17989a['query'][_0xdb00('0x3d')]));_0x406722['attributes']=_0x406722[_0xdb00('0x3c')][_0xdb00('0x4e')]?_0x406722['attributes']:_0x5690bd[_0xdb00('0x38')];_0x406722['order']=qs[_0xdb00('0x40')](_0x17989a['query']['sort']);_0x406722['where']=qs['filters'](_[_0xdb00('0x6a')](_0x17989a['query'],_0x5690bd[_0xdb00('0x41')]));if(_0x17989a[_0xdb00('0x3b')][_0xdb00('0x46')]){_0x406722[_0xdb00('0x42')]=_['merge'](_0x406722[_0xdb00('0x42')],{'$or':_[_0xdb00('0x34')](_0x406722[_0xdb00('0x3c')],function(_0x43799e){var _0x32ece5={};_0x32ece5[_0x43799e]={'$like':'%'+_0x17989a[_0xdb00('0x3b')]['filter']+'%'};return _0x32ece5;})});}_0x406722=_[_0xdb00('0x43')]({},_0x406722,_0x17989a[_0xdb00('0x47')]);return _0x450de9[_0xdb00('0x68')](_0x406722);}})['then'](function(_0x37381c){if(_0x37381c){_0x1edc16=_0x37381c[_0xdb00('0x4e')];if(!_0x17989a['query']['hasOwnProperty'](_0xdb00('0x3f'))){_0x406722['limit']=qs[_0xdb00('0x26')](_0x17989a[_0xdb00('0x3b')]['limit']);_0x406722[_0xdb00('0x25')]=qs['offset'](_0x17989a[_0xdb00('0x3b')]['offset']);}return _0x450de9[_0xdb00('0x68')](_0x406722);}})[_0xdb00('0x2d')](function(_0x4644dc){if(_0x4644dc){return _0x4644dc?{'count':_0x1edc16,'rows':_0x4644dc}:null;}})[_0xdb00('0x2d')](respondWithResult(_0x226543,null))[_0xdb00('0x50')](handleError(_0x226543,null));};exports[_0xdb00('0x6b')]=function(_0x442e25,_0x13e4d2,_0x5c4a58){var _0x40e97f=_0x442e25['body'][_0xdb00('0x6c')];return db[_0xdb00('0x6d')][_0xdb00('0x4a')]({'where':{'id':_0x40e97f},'attributes':['id'],'include':[{'model':db[_0xdb00('0x6e')],'as':_0xdb00('0x6f'),'attributes':['id',_0xdb00('0x32'),_0xdb00('0x70'),_0xdb00('0x71'),_0xdb00('0x72')],'raw':!![]}]})[_0xdb00('0x2d')](function(_0x50f340){if(_0x50f340){var _0x199616=_[_0xdb00('0x73')](_0x50f340,function(_0x502d50){var _0x171095=_0x502d50[_0xdb00('0x2f')]({'plain':!![]});return _0x171095['Agents'];});return db[_0xdb00('0x35')][_0xdb00('0x4f')]({'where':{'id':_0x442e25[_0xdb00('0x4d')]['id']}})[_0xdb00('0x2d')](function(_0x17391e){return db['sequelize'][_0xdb00('0x74')](function(_0x385398){return _0x17391e['addTeams'](_0x40e97f,{'transaction':_0x385398})[_0xdb00('0x2d')](function(){return BPromise['each'](_0x199616,function(_0x589e40){return db[_0xdb00('0x5e')][_0xdb00('0x75')]({'where':{'UserId':_0x589e40['id'],'OpenchannelQueueId':_0x442e25[_0xdb00('0x4d')]['id']},'transaction':_0x385398});});})[_0xdb00('0x2d')](function(){_0x199616[_0xdb00('0x76')](function(_0x3c33ab){socket[_0xdb00('0x77')](_0xdb00('0x78'),{'UserId':_0x3c33ab['id'],'OpenchannelQueueId':_0x17391e['id']});});});});});}})[_0xdb00('0x2d')](respondWithStatusCode(_0x13e4d2,null))[_0xdb00('0x50')](handleError(_0x13e4d2,null));};exports['removeTeams']=function(_0x123e94,_0x19c25c,_0x2a97f8){return db[_0xdb00('0x6d')][_0xdb00('0x4a')]({'where':{'id':_0x123e94[_0xdb00('0x3b')][_0xdb00('0x6c')]},'attributes':['id'],'include':[{'model':db[_0xdb00('0x6e')],'as':_0xdb00('0x6f'),'attributes':['id'],'raw':!![]}]})[_0xdb00('0x2d')](handleEntityNotFound(_0x19c25c,null))[_0xdb00('0x2d')](function(_0x449834){var _0xc313ba=_[_0xdb00('0x34')](_0x449834,'id');var _0x5d776a=[];var _0x422dc7=[];var _0x1a2c2c=squel[_0xdb00('0x79')]();_0x1a2c2c[_0xdb00('0x7a')](_0xdb00('0x7b'))[_0xdb00('0x7c')]('team_has_openchannel_queues','tq')[_0xdb00('0x7d')](_0xdb00('0x7e'),'ut',_0xdb00('0x7f'))[_0xdb00('0x42')](_0xdb00('0x80'),_0x123e94[_0xdb00('0x4d')]['id']);for(var _0x54578d=0x0;_0x54578d<_0x449834[_0xdb00('0x4e')];_0x54578d+=0x1){let _0x2d369e=_0x449834[_0x54578d];for(var _0x503855=0x0;_0x503855<_0x2d369e[_0xdb00('0x6f')][_0xdb00('0x4e')];_0x503855+=0x1){let _0x49ea47=_0x2d369e[_0xdb00('0x6f')][_0x503855];var _0x2d8c01=_0x1a2c2c['clone']();_0x2d8c01['where'](_0xdb00('0x81'),_0x49ea47['id']);_0x422dc7['push'](db[_0xdb00('0x82')][_0xdb00('0x3b')](_0x2d8c01[_0xdb00('0x83')](),{'type':db[_0xdb00('0x82')][_0xdb00('0x84')][_0xdb00('0x85')]})['then'](function(_0x3776d2){if(_0x3776d2[_0xdb00('0x4e')]===0x1){return _0x49ea47['id'];}else{var _0x19fa3e=_[_0xdb00('0x86')](_[_0xdb00('0x34')](_0x3776d2,'TeamId'),function(_0xa1d528){return _[_0xdb00('0x87')](_0xc313ba,_0xa1d528);});if(_0x19fa3e){return _0x49ea47['id'];}}}));}}return BPromise[_0xdb00('0x88')](_0x422dc7)[_0xdb00('0x2d')](function(_0x2b6b25){_0x5d776a=_(_0x5d776a)[_0xdb00('0x89')](_0x2b6b25)['compact']()['value']();return db[_0xdb00('0x35')][_0xdb00('0x4f')]({'where':{'id':_0x123e94[_0xdb00('0x4d')]['id']}})['then'](function(_0x27ffef){return db[_0xdb00('0x82')][_0xdb00('0x74')](function(_0x4812ee){return _0x27ffef[_0xdb00('0x8a')](_0x123e94[_0xdb00('0x3b')][_0xdb00('0x6c')],{'transaction':_0x4812ee})[_0xdb00('0x2d')](function(){if(!_[_0xdb00('0x8b')](_0x5d776a)){return _0x27ffef[_0xdb00('0x8c')](_0x5d776a,{'transaction':_0x4812ee});}})['then'](function(){_0x5d776a[_0xdb00('0x76')](function(_0x588d17){socket[_0xdb00('0x77')](_0xdb00('0x8d'),{'UserId':_0x588d17,'OpenchannelQueueId':_0x27ffef['id']});});});});});});})[_0xdb00('0x2d')](respondWithStatusCode(_0x19c25c,null))[_0xdb00('0x50')](handleError(_0x19c25c,null));};exports[_0xdb00('0x8e')]=function(_0xd28baf,_0x2a8c2c,_0xda680){return db[_0xdb00('0x35')][_0xdb00('0x4f')]({'where':{'id':_0xd28baf[_0xdb00('0x4d')]['id']}})[_0xdb00('0x2d')](handleEntityNotFound(_0x2a8c2c,null))[_0xdb00('0x2d')](function(_0x3bf104){if(_0x3bf104){return _0x3bf104[_0xdb00('0x8e')](_0xd28baf[_0xdb00('0x52')]['ids'],_[_0xdb00('0x8f')](_0xd28baf[_0xdb00('0x52')],['ids','id'])||{})[_0xdb00('0x90')](function(_0x81917){for(var _0x3448e2=0x0;_0x3448e2<_0xd28baf[_0xdb00('0x52')]['ids']['length'];_0x3448e2+=0x1){socket[_0xdb00('0x77')](_0xdb00('0x78'),{'UserId':Number(_0xd28baf[_0xdb00('0x52')][_0xdb00('0x6c')][_0x3448e2]),'OpenchannelQueueId':Number(_0xd28baf['params']['id'])});}return _0x81917;});}})['then'](respondWithResult(_0x2a8c2c,null))[_0xdb00('0x50')](handleError(_0x2a8c2c,null));};exports[_0xdb00('0x8c')]=function(_0x1f6b54,_0x331fc4,_0x55743c){return db[_0xdb00('0x35')]['find']({'where':{'id':_0x1f6b54[_0xdb00('0x4d')]['id']}})[_0xdb00('0x2d')](handleEntityNotFound(_0x331fc4,null))[_0xdb00('0x2d')](function(_0x5539bb){if(_0x5539bb){return _0x5539bb[_0xdb00('0x8c')](_0x1f6b54[_0xdb00('0x3b')][_0xdb00('0x6c')])[_0xdb00('0x2d')](function(){if(_['isArray'](_0x1f6b54['query'][_0xdb00('0x6c')])){for(var _0x334db9=0x0;_0x334db9<_0x1f6b54[_0xdb00('0x3b')][_0xdb00('0x6c')][_0xdb00('0x4e')];_0x334db9+=0x1){socket[_0xdb00('0x77')](_0xdb00('0x8d'),{'UserId':Number(_0x1f6b54[_0xdb00('0x3b')][_0xdb00('0x6c')][_0x334db9]),'OpenchannelQueueId':Number(_0x1f6b54[_0xdb00('0x4d')]['id'])});}}else{socket[_0xdb00('0x77')](_0xdb00('0x8d'),{'UserId':Number(_0x1f6b54['query'][_0xdb00('0x6c')]),'OpenchannelQueueId':Number(_0x1f6b54[_0xdb00('0x4d')]['id'])});}});}})[_0xdb00('0x2d')](respondWithStatusCode(_0x331fc4,null))[_0xdb00('0x50')](handleError(_0x331fc4,null));};exports[_0xdb00('0x91')]=function(_0x2609e3,_0x488f82,_0x146924){var _0x15b249={};var _0x2b84c4={};var _0x16e00d;var _0x4cf79d;return db[_0xdb00('0x35')][_0xdb00('0x5d')]({'where':{'id':_0x2609e3[_0xdb00('0x4d')]['id']}})[_0xdb00('0x2d')](handleEntityNotFound(_0x488f82,null))[_0xdb00('0x2d')](function(_0x48fe69){if(_0x48fe69){_0x16e00d=_0x48fe69;_0x2b84c4['model']=_['keys'](db['User'][_0xdb00('0x69')]);_0x2b84c4[_0xdb00('0x3b')]=_[_0xdb00('0x39')](_0x2609e3[_0xdb00('0x3b')]);_0x2b84c4[_0xdb00('0x41')]=_[_0xdb00('0x3a')](_0x2b84c4[_0xdb00('0x38')],_0x2b84c4[_0xdb00('0x3b')]);_0x15b249[_0xdb00('0x3c')]=_['intersection'](_0x2b84c4[_0xdb00('0x38')],qs[_0xdb00('0x3d')](_0x2609e3[_0xdb00('0x3b')][_0xdb00('0x3d')]));_0x15b249[_0xdb00('0x3c')]=_0x15b249[_0xdb00('0x3c')][_0xdb00('0x4e')]?_0x15b249['attributes']:_0x2b84c4['model'];_0x15b249[_0xdb00('0x5f')]=qs[_0xdb00('0x40')](_0x2609e3['query'][_0xdb00('0x40')]);_0x15b249[_0xdb00('0x42')]=qs[_0xdb00('0x41')](_[_0xdb00('0x6a')](_0x2609e3['query'],_0x2b84c4[_0xdb00('0x41')]));if(_0x2609e3[_0xdb00('0x3b')][_0xdb00('0x46')]){_0x15b249['where']=_[_0xdb00('0x43')](_0x15b249['where'],{'$or':_['map'](_0x15b249[_0xdb00('0x3c')],function(_0x164a2a){var _0x2a18e8={};_0x2a18e8[_0x164a2a]={'$like':'%'+_0x2609e3[_0xdb00('0x3b')][_0xdb00('0x46')]+'%'};return _0x2a18e8;})});}_0x15b249=_[_0xdb00('0x43')]({},_0x15b249,_0x2609e3[_0xdb00('0x47')]);return _0x16e00d[_0xdb00('0x91')](_0x15b249);}})['then'](function(_0x85abbe){if(_0x85abbe){_0x4cf79d=_0x85abbe[_0xdb00('0x4e')];if(!_0x2609e3[_0xdb00('0x3b')]['hasOwnProperty'](_0xdb00('0x3f'))){_0x15b249['limit']=qs[_0xdb00('0x26')](_0x2609e3[_0xdb00('0x3b')][_0xdb00('0x26')]);_0x15b249['offset']=qs['offset'](_0x2609e3[_0xdb00('0x3b')][_0xdb00('0x25')]);}return _0x16e00d[_0xdb00('0x91')](_0x15b249);}})[_0xdb00('0x2d')](function(_0xee60f){if(_0xee60f){return _0xee60f?{'count':_0x4cf79d,'rows':_0xee60f}:null;}})[_0xdb00('0x2d')](respondWithResult(_0x488f82,null))['catch'](handleError(_0x488f82,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 34e6d4a..449a9d8 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 _0x95d3=['emit','hasOwnProperty','hook','exports','events','OpenchannelQueue','setMaxListeners','save','update','remove'];(function(_0x43776a,_0x4eb74c){var _0x18eb8f=function(_0x319afb){while(--_0x319afb){_0x43776a['push'](_0x43776a['shift']());}};_0x18eb8f(++_0x4eb74c);}(_0x95d3,0x126));var _0x395d=function(_0x53bf29,_0x1d05f1){_0x53bf29=_0x53bf29-0x0;var _0xd7eecd=_0x95d3[_0x53bf29];return _0xd7eecd;};'use strict';var EventEmitter=require(_0x395d('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x395d('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x395d('0x2')](0x0);var events={'afterCreate':_0x395d('0x3'),'afterUpdate':_0x395d('0x4'),'afterDestroy':_0x395d('0x5')};function emitEvent(_0x17b3b3){return function(_0x3c4252,_0x388ba5,_0x22c05d){OpenchannelQueueEvents[_0x395d('0x6')](_0x17b3b3+':'+_0x3c4252['id'],_0x3c4252);OpenchannelQueueEvents[_0x395d('0x6')](_0x17b3b3,_0x3c4252);_0x22c05d(null);};}for(var e in events){if(events[_0x395d('0x7')](e)){var event=events[e];OpenchannelQueue[_0x395d('0x8')](e,emitEvent(event));}}module[_0x395d('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x5883=['hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x2d0d89,_0xfd2191){var _0x558f45=function(_0x380a59){while(--_0x380a59){_0x2d0d89['push'](_0x2d0d89['shift']());}};_0x558f45(++_0xfd2191);}(_0x5883,0x1c3));var _0x3588=function(_0x2ff77f,_0x374d5d){_0x2ff77f=_0x2ff77f-0x0;var _0x5558f5=_0x5883[_0x2ff77f];return _0x5558f5;};'use strict';var EventEmitter=require(_0x3588('0x0'));var OpenchannelQueue=require(_0x3588('0x1'))['db'][_0x3588('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x3588('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3588('0x4'),'afterDestroy':_0x3588('0x5')};function emitEvent(_0x2b02c4){return function(_0x1d06f7,_0x3e2c46,_0x30f94d){OpenchannelQueueEvents[_0x3588('0x6')](_0x2b02c4+':'+_0x1d06f7['id'],_0x1d06f7);OpenchannelQueueEvents[_0x3588('0x6')](_0x2b02c4,_0x1d06f7);_0x30f94d(null);};}for(var e in events){if(events[_0x3588('0x7')](e)){var event=events[e];OpenchannelQueue[_0x3588('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 2a3a9c1..31eb9a4 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 _0x884f=['moment','bluebird','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','../../config/logger','api'];(function(_0x1d3c9e,_0x258d5b){var _0x17c826=function(_0x40d8f7){while(--_0x40d8f7){_0x1d3c9e['push'](_0x1d3c9e['shift']());}};_0x17c826(++_0x258d5b);}(_0x884f,0x81));var _0xf884=function(_0x3a58e9,_0x320aeb){_0x3a58e9=_0x3a58e9-0x0;var _0x5bda87=_0x884f[_0x3a58e9];return _0x5bda87;};'use strict';var _=require(_0xf884('0x0'));var util=require('util');var logger=require(_0xf884('0x1'))(_0xf884('0x2'));var moment=require(_0xf884('0x3'));var BPromise=require(_0xf884('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf884('0x5'));var config=require(_0xf884('0x6'));var attributes=require(_0xf884('0x7'));module[_0xf884('0x8')]=function(_0x632c10,_0x4de21f){return _0x632c10[_0xf884('0x9')](_0xf884('0xa'),attributes,{'tableName':_0xf884('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8720=['OpenchannelQueue','openchannel_queues','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x3aacd1,_0x13b72e){var _0xec5062=function(_0x3ddaad){while(--_0x3ddaad){_0x3aacd1['push'](_0x3aacd1['shift']());}};_0xec5062(++_0x13b72e);}(_0x8720,0x82));var _0x0872=function(_0x37f713,_0x55c936){_0x37f713=_0x37f713-0x0;var _0x5413dd=_0x8720[_0x37f713];return _0x5413dd;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0872('0x0'));var BPromise=require(_0x0872('0x1'));var rp=require(_0x0872('0x2'));var fs=require('fs');var path=require(_0x0872('0x3'));var rimraf=require('rimraf');var config=require(_0x0872('0x4'));var attributes=require('./openchannelQueue.attributes');module[_0x0872('0x5')]=function(_0xc57ecd,_0x3d6f8d){return _0xc57ecd['define'](_0x0872('0x6'),attributes,{'tableName':_0x0872('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 37fc14e..3e60201 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 _0x986d=['map','model','attributes','then','ShowOpenchannelQueue','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','include'];(function(_0x141c88,_0x1e1412){var _0x319ad3=function(_0x2ec83d){while(--_0x2ec83d){_0x141c88['push'](_0x141c88['shift']());}};_0x319ad3(++_0x1e1412);}(_0x986d,0x77));var _0xd986=function(_0x8320e8,_0x26030f){_0x8320e8=_0x8320e8-0x0;var _0xd04d0=_0x986d[_0x8320e8];return _0xd04d0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd986('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd986('0x1'));var db=require(_0xd986('0x2'))['db'];var utils=require(_0xd986('0x3'));var logger=require(_0xd986('0x4'))('rpc');var config=require(_0xd986('0x5'));var jayson=require(_0xd986('0x6'));var client=jayson[_0xd986('0x7')][_0xd986('0x8')]({'port':0x232a});config[_0xd986('0x9')]=_[_0xd986('0xa')](config[_0xd986('0x9')],{'host':_0xd986('0xb'),'port':0x18eb});var socket=require(_0xd986('0xc'))(new Redis(config['redis']));require(_0xd986('0xd'))[_0xd986('0xe')](socket);function respondWithRpcPromise(_0x365553,_0x1ef635,_0x1a5171){return new BPromise(function(_0x2f9d6b,_0xb5a1b){return client['request'](_0x365553,_0x1a5171)['then'](function(_0xda7de){logger[_0xd986('0xf')](_0xd986('0x10'),_0x1ef635,_0xd986('0x11'));logger[_0xd986('0x12')](_0xd986('0x13'),_0x1ef635,_0xd986('0x11'),JSON[_0xd986('0x14')](_0xda7de));if(_0xda7de['error']){if(_0xda7de['error'][_0xd986('0x15')]===0x1f4){logger[_0xd986('0x16')](_0xd986('0x10'),_0x1ef635,_0xda7de[_0xd986('0x16')][_0xd986('0x17')]);return _0xb5a1b(_0xda7de[_0xd986('0x16')][_0xd986('0x17')]);}logger[_0xd986('0x16')](_0xd986('0x10'),_0x1ef635,_0xda7de['error']['message']);return _0x2f9d6b(_0xda7de[_0xd986('0x16')][_0xd986('0x17')]);}else{logger[_0xd986('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0x1ef635,_0xd986('0x11'));_0x2f9d6b(_0xda7de[_0xd986('0x18')][_0xd986('0x17')]);}})[_0xd986('0x19')](function(_0x1e8e8a){logger['error'](_0xd986('0x10'),_0x1ef635,_0x1e8e8a);_0xb5a1b(_0x1e8e8a);});});}exports[_0xd986('0x1a')]=function(_0xcada25){var _0x4d1aee=this;return new Promise(function(_0x555401,_0x2f1d30){return db[_0xd986('0x1b')][_0xd986('0x1c')]({'raw':_0xcada25[_0xd986('0x1d')]?_0xcada25[_0xd986('0x1d')][_0xd986('0x1e')]===undefined?!![]:![]:!![],'where':_0xcada25['options']?_0xcada25[_0xd986('0x1d')][_0xd986('0x1f')]||null:null,'attributes':_0xcada25[_0xd986('0x1d')]?_0xcada25[_0xd986('0x1d')]['attributes']||null:null,'limit':_0xcada25[_0xd986('0x1d')]?_0xcada25[_0xd986('0x1d')]['limit']||null:null,'include':_0xcada25['options']?_0xcada25[_0xd986('0x1d')][_0xd986('0x20')]?_[_0xd986('0x21')](_0xcada25[_0xd986('0x1d')][_0xd986('0x20')],function(_0x56503b){return{'model':db[_0x56503b[_0xd986('0x22')]],'as':_0x56503b['as'],'attributes':_0x56503b[_0xd986('0x23')],'include':_0x56503b[_0xd986('0x20')]?_[_0xd986('0x21')](_0x56503b[_0xd986('0x20')],function(_0x27725f){return{'model':db[_0x27725f[_0xd986('0x22')]],'as':_0x27725f['as'],'attributes':_0x27725f[_0xd986('0x23')],'include':_0x27725f[_0xd986('0x20')]?_[_0xd986('0x21')](_0x27725f[_0xd986('0x20')],function(_0x177e09){return{'model':db[_0x177e09['model']],'as':_0x177e09['as'],'attributes':_0x177e09[_0xd986('0x23')]};}):[]};}):[]};}):[]:[]})[_0xd986('0x24')](function(_0x3b35a4){logger[_0xd986('0xf')]('GetOpenchannelQueue',_0xcada25);logger[_0xd986('0x12')](_0xd986('0x1a'),_0xcada25,JSON[_0xd986('0x14')](_0x3b35a4));_0x555401(_0x3b35a4);})['catch'](function(_0x331754){logger[_0xd986('0x16')](_0xd986('0x1a'),_0x331754[_0xd986('0x17')],_0xcada25);_0x2f1d30(_0x4d1aee[_0xd986('0x16')](0x1f4,_0x331754[_0xd986('0x17')]));});});};exports[_0xd986('0x25')]=function(_0x207f25){var _0x1fca91=this;return new Promise(function(_0x4be557,_0x52e94d){return db['OpenchannelQueue']['find']({'raw':_0x207f25[_0xd986('0x1d')]?_0x207f25[_0xd986('0x1d')][_0xd986('0x1e')]===undefined?!![]:![]:!![],'where':_0x207f25['options']?_0x207f25[_0xd986('0x1d')][_0xd986('0x1f')]||null:null,'attributes':_0x207f25[_0xd986('0x1d')]?_0x207f25[_0xd986('0x1d')]['attributes']||null:null,'include':_0x207f25[_0xd986('0x1d')]?_0x207f25[_0xd986('0x1d')]['include']?_[_0xd986('0x21')](_0x207f25[_0xd986('0x1d')][_0xd986('0x20')],function(_0x4a5cbd){return{'model':db[_0x4a5cbd[_0xd986('0x22')]],'as':_0x4a5cbd['as'],'attributes':_0x4a5cbd[_0xd986('0x23')],'include':_0x4a5cbd[_0xd986('0x20')]?_[_0xd986('0x21')](_0x4a5cbd[_0xd986('0x20')],function(_0x3beec7){return{'model':db[_0x3beec7['model']],'as':_0x3beec7['as'],'attributes':_0x3beec7[_0xd986('0x23')],'include':_0x3beec7[_0xd986('0x20')]?_[_0xd986('0x21')](_0x3beec7['include'],function(_0x39a598){return{'model':db[_0x39a598['model']],'as':_0x39a598['as'],'attributes':_0x39a598[_0xd986('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39fa12){logger[_0xd986('0xf')]('ShowOpenchannelQueue',_0x207f25);logger[_0xd986('0x12')](_0xd986('0x25'),_0x207f25,JSON['stringify'](_0x39fa12));_0x4be557(_0x39fa12);})[_0xd986('0x19')](function(_0x56123f){logger['error'](_0xd986('0x25'),_0x56123f[_0xd986('0x17')],_0x207f25);_0x52e94d(_0x1fca91['error'](0x1f4,_0x56123f[_0xd986('0x17')]));});});}; \ No newline at end of file +var _0xbbf2=['model','GetOpenchannelQueue','ShowOpenchannelQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelQueue,\x20%s,\x20%s','message','catch','OpenchannelQueue','findAll','options','raw','attributes','include','map'];(function(_0x41c654,_0x1195c5){var _0x66edae=function(_0x2cc3d0){while(--_0x2cc3d0){_0x41c654['push'](_0x41c654['shift']());}};_0x66edae(++_0x1195c5);}(_0xbbf2,0xfb));var _0x2bbf=function(_0x4382bc,_0x231a2d){_0x4382bc=_0x4382bc-0x0;var _0x13c82a=_0xbbf2[_0x4382bc];return _0x13c82a;};'use strict';var _=require(_0x2bbf('0x0'));var util=require(_0x2bbf('0x1'));var moment=require(_0x2bbf('0x2'));var BPromise=require(_0x2bbf('0x3'));var rs=require(_0x2bbf('0x4'));var fs=require('fs');var Redis=require(_0x2bbf('0x5'));var db=require(_0x2bbf('0x6'))['db'];var utils=require(_0x2bbf('0x7'));var logger=require(_0x2bbf('0x8'))('rpc');var config=require(_0x2bbf('0x9'));var jayson=require(_0x2bbf('0xa'));var client=jayson[_0x2bbf('0xb')][_0x2bbf('0xc')]({'port':0x232a});config['redis']=_['defaults'](config[_0x2bbf('0xd')],{'host':_0x2bbf('0xe'),'port':0x18eb});var socket=require(_0x2bbf('0xf'))(new Redis(config['redis']));require(_0x2bbf('0x10'))[_0x2bbf('0x11')](socket);function respondWithRpcPromise(_0x2ddb95,_0x3dbff2,_0x3587c5){return new BPromise(function(_0x5bd402,_0x56feac){return client[_0x2bbf('0x12')](_0x2ddb95,_0x3587c5)[_0x2bbf('0x13')](function(_0x32ca79){logger[_0x2bbf('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x3dbff2,_0x2bbf('0x15'));logger[_0x2bbf('0x16')](_0x2bbf('0x17'),_0x3dbff2,_0x2bbf('0x15'),JSON[_0x2bbf('0x18')](_0x32ca79));if(_0x32ca79[_0x2bbf('0x19')]){if(_0x32ca79[_0x2bbf('0x19')]['code']===0x1f4){logger[_0x2bbf('0x19')](_0x2bbf('0x1a'),_0x3dbff2,_0x32ca79['error'][_0x2bbf('0x1b')]);return _0x56feac(_0x32ca79[_0x2bbf('0x19')]['message']);}logger[_0x2bbf('0x19')](_0x2bbf('0x1a'),_0x3dbff2,_0x32ca79[_0x2bbf('0x19')][_0x2bbf('0x1b')]);return _0x5bd402(_0x32ca79[_0x2bbf('0x19')]['message']);}else{logger['info'](_0x2bbf('0x1a'),_0x3dbff2,_0x2bbf('0x15'));_0x5bd402(_0x32ca79['result'][_0x2bbf('0x1b')]);}})[_0x2bbf('0x1c')](function(_0x2facf3){logger[_0x2bbf('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x3dbff2,_0x2facf3);_0x56feac(_0x2facf3);});});}exports['GetOpenchannelQueue']=function(_0x518da9){var _0x1f65bb=this;return new Promise(function(_0x284351,_0x51841c){return db[_0x2bbf('0x1d')][_0x2bbf('0x1e')]({'raw':_0x518da9[_0x2bbf('0x1f')]?_0x518da9['options'][_0x2bbf('0x20')]===undefined?!![]:![]:!![],'where':_0x518da9[_0x2bbf('0x1f')]?_0x518da9[_0x2bbf('0x1f')]['where']||null:null,'attributes':_0x518da9[_0x2bbf('0x1f')]?_0x518da9[_0x2bbf('0x1f')][_0x2bbf('0x21')]||null:null,'limit':_0x518da9[_0x2bbf('0x1f')]?_0x518da9['options']['limit']||null:null,'include':_0x518da9[_0x2bbf('0x1f')]?_0x518da9[_0x2bbf('0x1f')][_0x2bbf('0x22')]?_[_0x2bbf('0x23')](_0x518da9['options'][_0x2bbf('0x22')],function(_0x1899ec){return{'model':db[_0x1899ec[_0x2bbf('0x24')]],'as':_0x1899ec['as'],'attributes':_0x1899ec['attributes'],'include':_0x1899ec[_0x2bbf('0x22')]?_[_0x2bbf('0x23')](_0x1899ec[_0x2bbf('0x22')],function(_0x305f05){return{'model':db[_0x305f05[_0x2bbf('0x24')]],'as':_0x305f05['as'],'attributes':_0x305f05['attributes'],'include':_0x305f05[_0x2bbf('0x22')]?_[_0x2bbf('0x23')](_0x305f05['include'],function(_0x4f9eac){return{'model':db[_0x4f9eac[_0x2bbf('0x24')]],'as':_0x4f9eac['as'],'attributes':_0x4f9eac[_0x2bbf('0x21')]};}):[]};}):[]};}):[]:[]})[_0x2bbf('0x13')](function(_0x543351){logger[_0x2bbf('0x14')](_0x2bbf('0x25'),_0x518da9);logger[_0x2bbf('0x16')](_0x2bbf('0x25'),_0x518da9,JSON[_0x2bbf('0x18')](_0x543351));_0x284351(_0x543351);})[_0x2bbf('0x1c')](function(_0x3d76d0){logger[_0x2bbf('0x19')](_0x2bbf('0x25'),_0x3d76d0[_0x2bbf('0x1b')],_0x518da9);_0x51841c(_0x1f65bb[_0x2bbf('0x19')](0x1f4,_0x3d76d0[_0x2bbf('0x1b')]));});});};exports[_0x2bbf('0x26')]=function(_0x5dc43f){var _0x495b18=this;return new Promise(function(_0x34a2e8,_0x3c3771){return db[_0x2bbf('0x1d')][_0x2bbf('0x27')]({'raw':_0x5dc43f[_0x2bbf('0x1f')]?_0x5dc43f[_0x2bbf('0x1f')][_0x2bbf('0x20')]===undefined?!![]:![]:!![],'where':_0x5dc43f[_0x2bbf('0x1f')]?_0x5dc43f['options'][_0x2bbf('0x28')]||null:null,'attributes':_0x5dc43f[_0x2bbf('0x1f')]?_0x5dc43f[_0x2bbf('0x1f')][_0x2bbf('0x21')]||null:null,'include':_0x5dc43f[_0x2bbf('0x1f')]?_0x5dc43f[_0x2bbf('0x1f')][_0x2bbf('0x22')]?_['map'](_0x5dc43f[_0x2bbf('0x1f')][_0x2bbf('0x22')],function(_0x3b1f1d){return{'model':db[_0x3b1f1d['model']],'as':_0x3b1f1d['as'],'attributes':_0x3b1f1d[_0x2bbf('0x21')],'include':_0x3b1f1d[_0x2bbf('0x22')]?_[_0x2bbf('0x23')](_0x3b1f1d[_0x2bbf('0x22')],function(_0x45d0e7){return{'model':db[_0x45d0e7[_0x2bbf('0x24')]],'as':_0x45d0e7['as'],'attributes':_0x45d0e7[_0x2bbf('0x21')],'include':_0x45d0e7[_0x2bbf('0x22')]?_['map'](_0x45d0e7[_0x2bbf('0x22')],function(_0x25b90b){return{'model':db[_0x25b90b[_0x2bbf('0x24')]],'as':_0x25b90b['as'],'attributes':_0x25b90b[_0x2bbf('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48e72c){logger['info']('ShowOpenchannelQueue',_0x5dc43f);logger[_0x2bbf('0x16')](_0x2bbf('0x26'),_0x5dc43f,JSON['stringify'](_0x48e72c));_0x34a2e8(_0x48e72c);})[_0x2bbf('0x1c')](function(_0x26e2e){logger[_0x2bbf('0x19')](_0x2bbf('0x26'),_0x26e2e[_0x2bbf('0x1b')],_0x5dc43f);_0x3c3771(_0x495b18[_0x2bbf('0x19')](0x1f4,_0x26e2e[_0x2bbf('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 8019da8..bc3fea8 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 _0x35a9=['./openchannelQueue.events','save','remove','emit','register','length','openchannelQueue:'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x35a9,0xe7));var _0x935a=function(_0x2c8c20,_0x295f94){_0x2c8c20=_0x2c8c20-0x0;var _0x11b8df=_0x35a9[_0x2c8c20];return _0x11b8df;};'use strict';var OpenchannelQueueEvents=require(_0x935a('0x0'));var events=[_0x935a('0x1'),_0x935a('0x2'),'update'];function createListener(_0x41fd18,_0x122ead){return function(_0x5c51a0){_0x122ead[_0x935a('0x3')](_0x41fd18,_0x5c51a0);};}function removeListener(_0x11164c,_0x7e1413){return function(){OpenchannelQueueEvents['removeListener'](_0x11164c,_0x7e1413);};}exports[_0x935a('0x4')]=function(_0x261356){for(var _0x16c3b6=0x0,_0x275f87=events[_0x935a('0x5')];_0x16c3b6<_0x275f87;_0x16c3b6++){var _0xbe858a=events[_0x16c3b6];var _0x40d58d=createListener(_0x935a('0x6')+_0xbe858a,_0x261356);OpenchannelQueueEvents['on'](_0xbe858a,_0x40d58d);}}; \ No newline at end of file +var _0x0edf=['remove','removeListener','register','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x4fb5a3,_0x35a3d2){var _0x53f361=function(_0x40a800){while(--_0x40a800){_0x4fb5a3['push'](_0x4fb5a3['shift']());}};_0x53f361(++_0x35a3d2);}(_0x0edf,0x7d));var _0xf0ed=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0x0edf[_0x2b7764];return _0x848dcb;};'use strict';var OpenchannelQueueEvents=require(_0xf0ed('0x0'));var events=['save',_0xf0ed('0x1'),'update'];function createListener(_0x504dc3,_0x1e1d72){return function(_0x280fef){_0x1e1d72['emit'](_0x504dc3,_0x280fef);};}function removeListener(_0x50d25f,_0x5b8f08){return function(){OpenchannelQueueEvents[_0xf0ed('0x2')](_0x50d25f,_0x5b8f08);};}exports[_0xf0ed('0x3')]=function(_0x2c37f5){for(var _0x5176f3=0x0,_0x355e2d=events[_0xf0ed('0x4')];_0x5176f3<_0x355e2d;_0x5176f3++){var _0x296285=events[_0x5176f3];var _0x34d200=createListener(_0xf0ed('0x5')+_0x296285,_0x2c37f5);OpenchannelQueueEvents['on'](_0x296285,_0x34d200);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 11dcd89..f2a51b5 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 _0x0936=['multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','isAuthenticated','index','describe','get','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x35efc4,_0x3b7a25){var _0x5b5369=function(_0x32938a){while(--_0x32938a){_0x35efc4['push'](_0x35efc4['shift']());}};_0x5b5369(++_0x3b7a25);}(_0x0936,0x118));var _0x6093=function(_0x2aec86,_0x2f919a){_0x2aec86=_0x2aec86-0x0;var _0x103b5e=_0x0936[_0x2aec86];return _0x103b5e;};'use strict';var multer=require(_0x6093('0x0'));var util=require(_0x6093('0x1'));var path=require(_0x6093('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6093('0x3')]();var fs_extra=require(_0x6093('0x4'));var auth=require(_0x6093('0x5'));var interaction=require(_0x6093('0x6'));var config=require('../../config/environment');var controller=require(_0x6093('0x7'));router['get']('/',auth[_0x6093('0x8')](),controller[_0x6093('0x9')]);router['get']('/describe',auth[_0x6093('0x8')](),controller[_0x6093('0xa')]);router[_0x6093('0xb')](_0x6093('0xc'),auth[_0x6093('0x8')](),controller['show']);router[_0x6093('0xd')]('/',auth[_0x6093('0x8')](),controller[_0x6093('0xe')]);router[_0x6093('0xf')](_0x6093('0xc'),auth[_0x6093('0x8')](),controller[_0x6093('0x10')]);router[_0x6093('0x11')]('/:id',auth[_0x6093('0x8')](),controller[_0x6093('0x12')]);module[_0x6093('0x13')]=router; \ No newline at end of file +var _0xdd80=['util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x15731b,_0x4384c0){var _0x2a9176=function(_0x596ccf){while(--_0x596ccf){_0x15731b['push'](_0x15731b['shift']());}};_0x2a9176(++_0x4384c0);}(_0xdd80,0x17c));var _0x0dd8=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xdd80[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require('multer');var util=require(_0x0dd8('0x0'));var path=require('path');var timeout=require(_0x0dd8('0x1'));var express=require(_0x0dd8('0x2'));var router=express[_0x0dd8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0dd8('0x4'));var config=require(_0x0dd8('0x5'));var controller=require('./openchannelQueueReport.controller');router[_0x0dd8('0x6')]('/',auth[_0x0dd8('0x7')](),controller['index']);router['get'](_0x0dd8('0x8'),auth[_0x0dd8('0x7')](),controller[_0x0dd8('0x9')]);router['get'](_0x0dd8('0xa'),auth[_0x0dd8('0x7')](),controller[_0x0dd8('0xb')]);router[_0x0dd8('0xc')]('/',auth[_0x0dd8('0x7')](),controller[_0x0dd8('0xd')]);router[_0x0dd8('0xe')](_0x0dd8('0xa'),auth[_0x0dd8('0x7')](),controller[_0x0dd8('0xf')]);router[_0x0dd8('0x10')](_0x0dd8('0xa'),auth[_0x0dd8('0x7')](),controller[_0x0dd8('0x11')]);module[_0x0dd8('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 2370883..152c7d0 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 _0x6599=['STRING','DATE','moment','sequelize','exports'];(function(_0x3ae8b7,_0x4f92f9){var _0x2c7ffd=function(_0x2de99e){while(--_0x2de99e){_0x3ae8b7['push'](_0x3ae8b7['shift']());}};_0x2c7ffd(++_0x4f92f9);}(_0x6599,0xa7));var _0x9659=function(_0x4e9274,_0x49576e){_0x4e9274=_0x4e9274-0x0;var _0x8b474c=_0x6599[_0x4e9274];return _0x8b474c;};'use strict';var moment=require(_0x9659('0x0'));var Sequelize=require(_0x9659('0x1'));module[_0x9659('0x2')]={'uniqueid':{'type':Sequelize[_0x9659('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9659('0x3')]},'joinAt':{'type':Sequelize[_0x9659('0x4')]},'leaveAt':{'type':Sequelize[_0x9659('0x4')]},'acceptAt':{'type':Sequelize[_0x9659('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x730d=['moment','sequelize','STRING','DATE'];(function(_0x473708,_0x11832b){var _0x2b7cb4=function(_0x21b220){while(--_0x21b220){_0x473708['push'](_0x473708['shift']());}};_0x2b7cb4(++_0x11832b);}(_0x730d,0x110));var _0xd730=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0x730d[_0x2cf2e9];return _0xd3670d;};'use strict';var moment=require(_0xd730('0x0'));var Sequelize=require(_0xd730('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xd730('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd730('0x2')]},'joinAt':{'type':Sequelize[_0xd730('0x3')]},'leaveAt':{'type':Sequelize[_0xd730('0x3')]},'acceptAt':{'type':Sequelize[_0xd730('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xd730('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index a1fa0a3..f64357b 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 _0xcbf3=['bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','then','error','name','send','map','OpenchannelQueueReport','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','rawAttributes','find','create','update','body','params','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x2f0e53,_0x38b7b6){var _0x1557a0=function(_0x426e35){while(--_0x426e35){_0x2f0e53['push'](_0x2f0e53['shift']());}};_0x1557a0(++_0x38b7b6);}(_0xcbf3,0x8b));var _0x3cbf=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xcbf3[_0x47fd36];return _0x21a0fc;};'use strict';var emlformat=require(_0x3cbf('0x0'));var rimraf=require(_0x3cbf('0x1'));var zipdir=require(_0x3cbf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3cbf('0x3'));var moment=require(_0x3cbf('0x4'));var BPromise=require(_0x3cbf('0x5'));var Mustache=require(_0x3cbf('0x6'));var util=require(_0x3cbf('0x7'));var path=require(_0x3cbf('0x8'));var sox=require('sox');var csv=require(_0x3cbf('0x9'));var ejs=require(_0x3cbf('0xa'));var fs=require('fs');var fs_extra=require(_0x3cbf('0xb'));var _=require(_0x3cbf('0xc'));var squel=require(_0x3cbf('0xd'));var crypto=require('crypto');var jsforce=require(_0x3cbf('0xe'));var deskjs=require(_0x3cbf('0xf'));var toCsv=require(_0x3cbf('0x9'));var querystring=require('querystring');var Papa=require(_0x3cbf('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3cbf('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3cbf('0x12'))(_0x3cbf('0x13'));var utils=require(_0x3cbf('0x14'));var config=require(_0x3cbf('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3cbf('0x16'))['db'];function respondWithStatusCode(_0xfba889,_0x21de87){_0x21de87=_0x21de87||0xcc;return function(_0x572e0d){if(_0x572e0d){return _0xfba889[_0x3cbf('0x17')](_0x21de87);}return _0xfba889[_0x3cbf('0x18')](_0x21de87)[_0x3cbf('0x19')]();};}function respondWithResult(_0x202f1e,_0x19b24a){_0x19b24a=_0x19b24a||0xc8;return function(_0x1788a7){if(_0x1788a7){return _0x202f1e['status'](_0x19b24a)[_0x3cbf('0x1a')](_0x1788a7);}};}function respondWithFilteredResult(_0x39b9cc,_0x4f728b){return function(_0x1069da){if(_0x1069da){var _0x4e4e2f=typeof _0x4f728b[_0x3cbf('0x1b')]===_0x3cbf('0x1c')&&typeof _0x4f728b[_0x3cbf('0x1d')]===_0x3cbf('0x1c');var _0x13d35d=_0x1069da[_0x3cbf('0x1e')];var _0x1780c3=_0x4e4e2f?0x0:_0x4f728b[_0x3cbf('0x1b')];var _0x12d9ec=_0x4e4e2f?_0x1069da[_0x3cbf('0x1e')]:_0x4f728b[_0x3cbf('0x1b')]+_0x4f728b[_0x3cbf('0x1d')];var _0x4226d8;if(_0x12d9ec>=_0x13d35d){_0x12d9ec=_0x13d35d;_0x4226d8=0xc8;}else{_0x4226d8=0xce;}_0x39b9cc['status'](_0x4226d8);return _0x39b9cc['set']('Content-Range',_0x1780c3+'-'+_0x12d9ec+'/'+_0x13d35d)[_0x3cbf('0x1a')](_0x1069da);}return null;};}function patchUpdates(_0x42518f){return function(_0x46d567){try{jsonpatch[_0x3cbf('0x1f')](_0x46d567,_0x42518f,!![]);}catch(_0xcc4ea1){return BPromise[_0x3cbf('0x20')](_0xcc4ea1);}return _0x46d567['save']();};}function saveUpdates(_0x1b821b,_0x5c97d6){return function(_0x2f7fcf){if(_0x2f7fcf){return _0x2f7fcf['update'](_0x1b821b)['then'](function(_0x2ac8db){return _0x2ac8db;});}return null;};}function removeEntity(_0x24de6f,_0x303997){return function(_0x1b8356){if(_0x1b8356){return _0x1b8356['destroy']()[_0x3cbf('0x21')](function(){_0x24de6f[_0x3cbf('0x18')](0xcc)[_0x3cbf('0x19')]();});}};}function handleEntityNotFound(_0x5ac1b1,_0x44883a){return function(_0x5f254e){if(!_0x5f254e){_0x5ac1b1[_0x3cbf('0x17')](0x194);}return _0x5f254e;};}function handleError(_0x3b94bc,_0x133f94){_0x133f94=_0x133f94||0x1f4;return function(_0x513981){logger[_0x3cbf('0x22')](_0x513981['stack']);if(_0x513981[_0x3cbf('0x23')]){delete _0x513981[_0x3cbf('0x23')];}_0x3b94bc[_0x3cbf('0x18')](_0x133f94)[_0x3cbf('0x24')](_0x513981);};}exports['index']=function(_0x1da838,_0xe45f97){var _0x1330a3={},_0x53d9cb={},_0x197e49={'count':0x0,'rows':[]};var _0x5980e4=_[_0x3cbf('0x25')](db[_0x3cbf('0x26')]['rawAttributes'],function(_0x438ce2){return{'name':_0x438ce2[_0x3cbf('0x27')],'type':_0x438ce2['type'][_0x3cbf('0x28')]};});_0x53d9cb[_0x3cbf('0x29')]=_[_0x3cbf('0x25')](_0x5980e4,_0x3cbf('0x23'));_0x53d9cb[_0x3cbf('0x2a')]=_[_0x3cbf('0x2b')](_0x1da838['query']);_0x53d9cb['filters']=_[_0x3cbf('0x2c')](_0x53d9cb[_0x3cbf('0x29')],_0x53d9cb[_0x3cbf('0x2a')]);_0x1330a3[_0x3cbf('0x2d')]=_[_0x3cbf('0x2c')](_0x53d9cb['model'],qs[_0x3cbf('0x2e')](_0x1da838[_0x3cbf('0x2a')][_0x3cbf('0x2e')]));_0x1330a3[_0x3cbf('0x2d')]=_0x1330a3[_0x3cbf('0x2d')][_0x3cbf('0x2f')]?_0x1330a3['attributes']:_0x53d9cb[_0x3cbf('0x29')];if(!_0x1da838[_0x3cbf('0x2a')][_0x3cbf('0x30')](_0x3cbf('0x31'))){_0x1330a3[_0x3cbf('0x1d')]=qs['limit'](_0x1da838[_0x3cbf('0x2a')]['limit']);_0x1330a3['offset']=qs[_0x3cbf('0x1b')](_0x1da838['query'][_0x3cbf('0x1b')]);}_0x1330a3[_0x3cbf('0x32')]=qs['sort'](_0x1da838[_0x3cbf('0x2a')][_0x3cbf('0x33')]);_0x1330a3[_0x3cbf('0x34')]=qs[_0x3cbf('0x35')](_[_0x3cbf('0x36')](_0x1da838[_0x3cbf('0x2a')],_0x53d9cb[_0x3cbf('0x35')]),_0x5980e4);if(_0x1da838[_0x3cbf('0x2a')][_0x3cbf('0x37')]){_0x1330a3[_0x3cbf('0x34')]=_[_0x3cbf('0x38')](_0x1330a3[_0x3cbf('0x34')],{'$or':_['map'](_0x5980e4,function(_0x18330a){if(_0x18330a[_0x3cbf('0x39')]!==_0x3cbf('0x3a')){var _0x49ee48={};_0x49ee48[_0x18330a['name']]={'$like':'%'+_0x1da838[_0x3cbf('0x2a')][_0x3cbf('0x37')]+'%'};return _0x49ee48;}})});}_0x1330a3=_[_0x3cbf('0x38')]({},_0x1330a3,_0x1da838[_0x3cbf('0x3b')]);var _0x416242={'where':_0x1330a3[_0x3cbf('0x34')]};return db[_0x3cbf('0x26')][_0x3cbf('0x1e')](_0x416242)[_0x3cbf('0x21')](function(_0x32825d){_0x197e49['count']=_0x32825d;if(_0x1da838['query'][_0x3cbf('0x3c')]){_0x1330a3[_0x3cbf('0x3d')]=[{'all':!![]}];}return db[_0x3cbf('0x26')]['findAll'](_0x1330a3);})[_0x3cbf('0x21')](function(_0x225909){_0x197e49[_0x3cbf('0x3e')]=_0x225909;return _0x197e49;})[_0x3cbf('0x21')](respondWithFilteredResult(_0xe45f97,_0x1330a3))[_0x3cbf('0x3f')](handleError(_0xe45f97,null));};exports['show']=function(_0x10455f,_0x1d371a){var _0x28bdad={'raw':!![],'where':{'id':_0x10455f['params']['id']}},_0x387991={};_0x387991[_0x3cbf('0x29')]=_[_0x3cbf('0x2b')](db[_0x3cbf('0x26')][_0x3cbf('0x40')]);_0x387991[_0x3cbf('0x2a')]=_[_0x3cbf('0x2b')](_0x10455f[_0x3cbf('0x2a')]);_0x387991[_0x3cbf('0x35')]=_[_0x3cbf('0x2c')](_0x387991['model'],_0x387991[_0x3cbf('0x2a')]);_0x28bdad['attributes']=_[_0x3cbf('0x2c')](_0x387991[_0x3cbf('0x29')],qs[_0x3cbf('0x2e')](_0x10455f[_0x3cbf('0x2a')]['fields']));_0x28bdad['attributes']=_0x28bdad[_0x3cbf('0x2d')]['length']?_0x28bdad[_0x3cbf('0x2d')]:_0x387991['model'];if(_0x10455f[_0x3cbf('0x2a')][_0x3cbf('0x3c')]){_0x28bdad[_0x3cbf('0x3d')]=[{'all':!![]}];}_0x28bdad=_[_0x3cbf('0x38')]({},_0x28bdad,_0x10455f[_0x3cbf('0x3b')]);return db['OpenchannelQueueReport'][_0x3cbf('0x41')](_0x28bdad)[_0x3cbf('0x21')](handleEntityNotFound(_0x1d371a,null))['then'](respondWithResult(_0x1d371a,null))[_0x3cbf('0x3f')](handleError(_0x1d371a,null));};exports[_0x3cbf('0x42')]=function(_0x31b084,_0xce1865){return db[_0x3cbf('0x26')][_0x3cbf('0x42')](_0x31b084['body'],{})[_0x3cbf('0x21')](respondWithResult(_0xce1865,0xc9))[_0x3cbf('0x3f')](handleError(_0xce1865,null));};exports[_0x3cbf('0x43')]=function(_0x288659,_0x5c6b78){if(_0x288659[_0x3cbf('0x44')]['id']){delete _0x288659[_0x3cbf('0x44')]['id'];}return db[_0x3cbf('0x26')][_0x3cbf('0x41')]({'where':{'id':_0x288659[_0x3cbf('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c6b78,null))[_0x3cbf('0x21')](saveUpdates(_0x288659[_0x3cbf('0x44')],null))[_0x3cbf('0x21')](respondWithResult(_0x5c6b78,null))[_0x3cbf('0x3f')](handleError(_0x5c6b78,null));};exports[_0x3cbf('0x46')]=function(_0x54c6b3,_0x11a503){return db[_0x3cbf('0x26')][_0x3cbf('0x41')]({'where':{'id':_0x54c6b3[_0x3cbf('0x45')]['id']}})[_0x3cbf('0x21')](handleEntityNotFound(_0x11a503,null))[_0x3cbf('0x21')](removeEntity(_0x11a503,null))[_0x3cbf('0x3f')](handleError(_0x11a503,null));};exports[_0x3cbf('0x47')]=function(_0x4f2ff4,_0x110c7a){return db[_0x3cbf('0x26')][_0x3cbf('0x47')]()[_0x3cbf('0x21')](respondWithResult(_0x110c7a,null))[_0x3cbf('0x3f')](handleError(_0x110c7a,null));}; \ No newline at end of file +var _0xdeda=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','count','offset','limit','set','Content-Range','json','reject','update','then','sendStatus','stack','name','send','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','destroy','describe','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/parsers/qs'];(function(_0x374ba3,_0x4af646){var _0x51d852=function(_0x131009){while(--_0x131009){_0x374ba3['push'](_0x374ba3['shift']());}};_0x51d852(++_0x4af646);}(_0xdeda,0x109));var _0xaded=function(_0x43c585,_0x5637af){_0x43c585=_0x43c585-0x0;var _0x45a36d=_0xdeda[_0x43c585];return _0x45a36d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaded('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaded('0x1'));var rp=require('request-promise');var moment=require(_0xaded('0x2'));var BPromise=require(_0xaded('0x3'));var Mustache=require(_0xaded('0x4'));var util=require('util');var path=require(_0xaded('0x5'));var sox=require(_0xaded('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaded('0x7'));var _=require(_0xaded('0x8'));var squel=require(_0xaded('0x9'));var crypto=require(_0xaded('0xa'));var jsforce=require(_0xaded('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xaded('0xc'));var querystring=require('querystring');var Papa=require(_0xaded('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaded('0xe'));var as=require(_0xaded('0xf'));var hardwareService=require(_0xaded('0x10'));var logger=require(_0xaded('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xaded('0x12'));var licenseUtil=require(_0xaded('0x13'));var db=require(_0xaded('0x14'))['db'];function respondWithStatusCode(_0x5d8b78,_0x481eb1){_0x481eb1=_0x481eb1||0xcc;return function(_0x3be7ef){if(_0x3be7ef){return _0x5d8b78['sendStatus'](_0x481eb1);}return _0x5d8b78['status'](_0x481eb1)['end']();};}function respondWithResult(_0x1b7a14,_0x4d1bc7){_0x4d1bc7=_0x4d1bc7||0xc8;return function(_0x375b01){if(_0x375b01){return _0x1b7a14[_0xaded('0x15')](_0x4d1bc7)['json'](_0x375b01);}};}function respondWithFilteredResult(_0x48eaea,_0x26ccef){return function(_0x415957){if(_0x415957){var _0x4f3c04=typeof _0x26ccef['offset']==='undefined'&&typeof _0x26ccef['limit']===_0xaded('0x16');var _0x481542=_0x415957[_0xaded('0x17')];var _0x675507=_0x4f3c04?0x0:_0x26ccef['offset'];var _0x2547f3=_0x4f3c04?_0x415957[_0xaded('0x17')]:_0x26ccef[_0xaded('0x18')]+_0x26ccef[_0xaded('0x19')];var _0xbe3c12;if(_0x2547f3>=_0x481542){_0x2547f3=_0x481542;_0xbe3c12=0xc8;}else{_0xbe3c12=0xce;}_0x48eaea[_0xaded('0x15')](_0xbe3c12);return _0x48eaea[_0xaded('0x1a')](_0xaded('0x1b'),_0x675507+'-'+_0x2547f3+'/'+_0x481542)[_0xaded('0x1c')](_0x415957);}return null;};}function patchUpdates(_0xd9274a){return function(_0x31cf8c){try{jsonpatch['apply'](_0x31cf8c,_0xd9274a,!![]);}catch(_0x48a9aa){return BPromise[_0xaded('0x1d')](_0x48a9aa);}return _0x31cf8c['save']();};}function saveUpdates(_0xc303e4,_0x181e0e){return function(_0x754304){if(_0x754304){return _0x754304[_0xaded('0x1e')](_0xc303e4)[_0xaded('0x1f')](function(_0x31c3cb){return _0x31c3cb;});}return null;};}function removeEntity(_0x4a62c0,_0x477941){return function(_0x4a87fc){if(_0x4a87fc){return _0x4a87fc['destroy']()[_0xaded('0x1f')](function(){_0x4a62c0[_0xaded('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x550e36,_0x4f4935){return function(_0x3fdbd5){if(!_0x3fdbd5){_0x550e36[_0xaded('0x20')](0x194);}return _0x3fdbd5;};}function handleError(_0x18e7bc,_0xe7b9e5){_0xe7b9e5=_0xe7b9e5||0x1f4;return function(_0x5b160c){logger['error'](_0x5b160c[_0xaded('0x21')]);if(_0x5b160c[_0xaded('0x22')]){delete _0x5b160c[_0xaded('0x22')];}_0x18e7bc[_0xaded('0x15')](_0xe7b9e5)[_0xaded('0x23')](_0x5b160c);};}exports['index']=function(_0x23663c,_0x19d734){var _0xc37845={},_0x2927f1={},_0x43456b={'count':0x0,'rows':[]};var _0x3461c6=_[_0xaded('0x24')](db[_0xaded('0x25')][_0xaded('0x26')],function(_0x34df70){return{'name':_0x34df70[_0xaded('0x27')],'type':_0x34df70[_0xaded('0x28')]['key']};});_0x2927f1[_0xaded('0x29')]=_[_0xaded('0x24')](_0x3461c6,_0xaded('0x22'));_0x2927f1[_0xaded('0x2a')]=_['keys'](_0x23663c['query']);_0x2927f1[_0xaded('0x2b')]=_[_0xaded('0x2c')](_0x2927f1[_0xaded('0x29')],_0x2927f1[_0xaded('0x2a')]);_0xc37845[_0xaded('0x2d')]=_[_0xaded('0x2c')](_0x2927f1[_0xaded('0x29')],qs[_0xaded('0x2e')](_0x23663c[_0xaded('0x2a')]['fields']));_0xc37845['attributes']=_0xc37845['attributes'][_0xaded('0x2f')]?_0xc37845[_0xaded('0x2d')]:_0x2927f1['model'];if(!_0x23663c[_0xaded('0x2a')]['hasOwnProperty'](_0xaded('0x30'))){_0xc37845['limit']=qs[_0xaded('0x19')](_0x23663c[_0xaded('0x2a')][_0xaded('0x19')]);_0xc37845[_0xaded('0x18')]=qs[_0xaded('0x18')](_0x23663c[_0xaded('0x2a')][_0xaded('0x18')]);}_0xc37845[_0xaded('0x31')]=qs[_0xaded('0x32')](_0x23663c[_0xaded('0x2a')][_0xaded('0x32')]);_0xc37845[_0xaded('0x33')]=qs[_0xaded('0x2b')](_[_0xaded('0x34')](_0x23663c['query'],_0x2927f1[_0xaded('0x2b')]),_0x3461c6);if(_0x23663c[_0xaded('0x2a')][_0xaded('0x35')]){_0xc37845[_0xaded('0x33')]=_[_0xaded('0x36')](_0xc37845[_0xaded('0x33')],{'$or':_[_0xaded('0x24')](_0x3461c6,function(_0x2f2c6e){if(_0x2f2c6e[_0xaded('0x28')]!==_0xaded('0x37')){var _0x4f1e9c={};_0x4f1e9c[_0x2f2c6e[_0xaded('0x22')]]={'$like':'%'+_0x23663c[_0xaded('0x2a')][_0xaded('0x35')]+'%'};return _0x4f1e9c;}})});}_0xc37845=_[_0xaded('0x36')]({},_0xc37845,_0x23663c['options']);var _0x5d8a63={'where':_0xc37845['where']};return db[_0xaded('0x25')][_0xaded('0x17')](_0x5d8a63)[_0xaded('0x1f')](function(_0x2a887f){_0x43456b[_0xaded('0x17')]=_0x2a887f;if(_0x23663c[_0xaded('0x2a')][_0xaded('0x38')]){_0xc37845[_0xaded('0x39')]=[{'all':!![]}];}return db[_0xaded('0x25')][_0xaded('0x3a')](_0xc37845);})[_0xaded('0x1f')](function(_0x3b5db2){_0x43456b[_0xaded('0x3b')]=_0x3b5db2;return _0x43456b;})[_0xaded('0x1f')](respondWithFilteredResult(_0x19d734,_0xc37845))[_0xaded('0x3c')](handleError(_0x19d734,null));};exports[_0xaded('0x3d')]=function(_0x2b9921,_0x114ee1){var _0x2e1d0e={'raw':!![],'where':{'id':_0x2b9921['params']['id']}},_0x5073eb={};_0x5073eb[_0xaded('0x29')]=_['keys'](db[_0xaded('0x25')][_0xaded('0x26')]);_0x5073eb['query']=_[_0xaded('0x3e')](_0x2b9921[_0xaded('0x2a')]);_0x5073eb[_0xaded('0x2b')]=_[_0xaded('0x2c')](_0x5073eb[_0xaded('0x29')],_0x5073eb[_0xaded('0x2a')]);_0x2e1d0e[_0xaded('0x2d')]=_[_0xaded('0x2c')](_0x5073eb[_0xaded('0x29')],qs[_0xaded('0x2e')](_0x2b9921[_0xaded('0x2a')][_0xaded('0x2e')]));_0x2e1d0e[_0xaded('0x2d')]=_0x2e1d0e[_0xaded('0x2d')][_0xaded('0x2f')]?_0x2e1d0e[_0xaded('0x2d')]:_0x5073eb['model'];if(_0x2b9921[_0xaded('0x2a')][_0xaded('0x38')]){_0x2e1d0e[_0xaded('0x39')]=[{'all':!![]}];}_0x2e1d0e=_['merge']({},_0x2e1d0e,_0x2b9921[_0xaded('0x3f')]);return db['OpenchannelQueueReport'][_0xaded('0x40')](_0x2e1d0e)[_0xaded('0x1f')](handleEntityNotFound(_0x114ee1,null))[_0xaded('0x1f')](respondWithResult(_0x114ee1,null))[_0xaded('0x3c')](handleError(_0x114ee1,null));};exports['create']=function(_0x123abb,_0x53672f){return db[_0xaded('0x25')][_0xaded('0x41')](_0x123abb[_0xaded('0x42')],{})[_0xaded('0x1f')](respondWithResult(_0x53672f,0xc9))[_0xaded('0x3c')](handleError(_0x53672f,null));};exports[_0xaded('0x1e')]=function(_0x7eafc1,_0x1c4f56){if(_0x7eafc1[_0xaded('0x42')]['id']){delete _0x7eafc1[_0xaded('0x42')]['id'];}return db[_0xaded('0x25')][_0xaded('0x40')]({'where':{'id':_0x7eafc1[_0xaded('0x43')]['id']}})[_0xaded('0x1f')](handleEntityNotFound(_0x1c4f56,null))[_0xaded('0x1f')](saveUpdates(_0x7eafc1[_0xaded('0x42')],null))['then'](respondWithResult(_0x1c4f56,null))[_0xaded('0x3c')](handleError(_0x1c4f56,null));};exports[_0xaded('0x44')]=function(_0x29297f,_0xa7ed0f){return db[_0xaded('0x25')]['find']({'where':{'id':_0x29297f[_0xaded('0x43')]['id']}})[_0xaded('0x1f')](handleEntityNotFound(_0xa7ed0f,null))[_0xaded('0x1f')](removeEntity(_0xa7ed0f,null))[_0xaded('0x3c')](handleError(_0xa7ed0f,null));};exports['describe']=function(_0x4f3f21,_0x265a7e){return db['OpenchannelQueueReport'][_0xaded('0x45')]()[_0xaded('0x1f')](respondWithResult(_0x265a7e,null))[_0xaded('0x3c')](handleError(_0x265a7e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 841c709..e8f6be9 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0xd1ead3,_0x112d6b){var _0x430828=function(_0x359bc7){while(--_0x359bc7){_0xd1ead3['push'](_0xd1ead3['shift']());}};_0x430828(++_0x112d6b);}(_0x5fc3,0xa8));var _0x35fc=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0x5fc3[_0x19ac6e];return _0x1cdcf3;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','moment'];(function(_0x1ae7b0,_0x2301a2){var _0x2d83dc=function(_0x32a63f){while(--_0x32a63f){_0x1ae7b0['push'](_0x1ae7b0['shift']());}};_0x2d83dc(++_0x2301a2);}(_0xe14b,0x93));var _0xbe14=function(_0x1ec8c9,_0x5b8503){_0x1ec8c9=_0x1ec8c9-0x0;var _0x3a957a=_0xe14b[_0x1ec8c9];return _0x3a957a;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 28da1d8..7f07554 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 _0x7334=['jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','CreateOpenchannelQueueReport','create','body','options','raw','catch','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','where','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x59d117,_0x5d376c){var _0x2d74b6=function(_0x3ea062){while(--_0x3ea062){_0x59d117['push'](_0x59d117['shift']());}};_0x2d74b6(++_0x5d376c);}(_0x7334,0x184));var _0x4733=function(_0x1a2c1d,_0x6faec5){_0x1a2c1d=_0x1a2c1d-0x0;var _0x1b22db=_0x7334[_0x1a2c1d];return _0x1b22db;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4733('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4733('0x4'));var logger=require(_0x4733('0x5'))(_0x4733('0x6'));var config=require(_0x4733('0x7'));var jayson=require(_0x4733('0x8'));var client=jayson[_0x4733('0x9')][_0x4733('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x283754,_0x12cafa,_0x43d95c){return new BPromise(function(_0x8257cf,_0x3562b7){return client[_0x4733('0xb')](_0x283754,_0x43d95c)[_0x4733('0xc')](function(_0x2d5fde){logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,'request\x20sent');logger[_0x4733('0xf')](_0x4733('0x10'),_0x12cafa,'request\x20sent',JSON[_0x4733('0x11')](_0x2d5fde));if(_0x2d5fde['error']){if(_0x2d5fde[_0x4733('0x12')][_0x4733('0x13')]===0x1f4){logger[_0x4733('0x12')](_0x4733('0xe'),_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x3562b7(_0x2d5fde[_0x4733('0x12')]['message']);}logger[_0x4733('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x12cafa,_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);return _0x8257cf(_0x2d5fde[_0x4733('0x12')][_0x4733('0x14')]);}else{logger[_0x4733('0xd')](_0x4733('0xe'),_0x12cafa,_0x4733('0x15'));_0x8257cf(_0x2d5fde[_0x4733('0x16')][_0x4733('0x14')]);}})['catch'](function(_0x2c0031){logger[_0x4733('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x12cafa,_0x2c0031);_0x3562b7(_0x2c0031);});});}exports[_0x4733('0x17')]=function(_0x1d2fb6){var _0x2aa223=this;return new Promise(function(_0x384e0c,_0x579f67){return db['OpenchannelQueueReport'][_0x4733('0x18')](_0x1d2fb6[_0x4733('0x19')],{'raw':_0x1d2fb6['options']?_0x1d2fb6[_0x4733('0x1a')][_0x4733('0x1b')]===undefined?!![]:![]:!![]})[_0x4733('0xc')](function(_0x7a4e0){logger['info'](_0x4733('0x17'),_0x1d2fb6);logger[_0x4733('0xf')]('CreateOpenchannelQueueReport',_0x1d2fb6,JSON[_0x4733('0x11')](_0x7a4e0));_0x384e0c(_0x7a4e0);})[_0x4733('0x1c')](function(_0x478e34){logger[_0x4733('0x12')](_0x4733('0x17'),_0x478e34[_0x4733('0x14')],_0x1d2fb6);_0x579f67(_0x2aa223[_0x4733('0x12')](0x1f4,_0x478e34[_0x4733('0x14')]));});});};exports[_0x4733('0x1d')]=function(_0x180049){var _0x2bb78f=this;return new Promise(function(_0x523697,_0x3e6976){return db[_0x4733('0x1e')][_0x4733('0x1f')](_0x180049[_0x4733('0x19')],{'raw':_0x180049[_0x4733('0x1a')]?_0x180049[_0x4733('0x1a')][_0x4733('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x180049[_0x4733('0x1a')]?_0x180049[_0x4733('0x1a')][_0x4733('0x20')]||null:null,'attributes':_0x180049['options']?_0x180049[_0x4733('0x1a')]['attributes']||null:null,'limit':_0x180049['options']?_0x180049[_0x4733('0x1a')]['limit']||null:null})[_0x4733('0xc')](function(_0x479989){logger['info']('UpdateOpenchannelQueueReport',_0x180049);logger[_0x4733('0xf')](_0x4733('0x1d'),_0x180049,JSON[_0x4733('0x11')](_0x479989));_0x523697(_0x479989);})[_0x4733('0x1c')](function(_0x4fee4a){logger['error']('UpdateOpenchannelQueueReport',_0x4fee4a[_0x4733('0x14')],_0x180049);_0x3e6976(_0x2bb78f['error'](0x1f4,_0x4fee4a['message']));});});}; \ No newline at end of file +var _0x63a5=['code','message','result','catch','options','raw','CreateOpenchannelQueueReport','OpenchannelQueueReport','update','body','where','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3d1ce2,_0x2a9d26){var _0x43c682=function(_0x1d3031){while(--_0x1d3031){_0x3d1ce2['push'](_0x3d1ce2['shift']());}};_0x43c682(++_0x2a9d26);}(_0x63a5,0x18e));var _0x563a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x63a5[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0x563a('0x0'));var util=require(_0x563a('0x1'));var moment=require(_0x563a('0x2'));var BPromise=require('bluebird');var rs=require(_0x563a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x563a('0x4'))['db'];var utils=require(_0x563a('0x5'));var logger=require(_0x563a('0x6'))(_0x563a('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x563a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2662f7,_0x4f89b4,_0x4d71a0){return new BPromise(function(_0x543920,_0xff1f59){return client[_0x563a('0x9')](_0x2662f7,_0x4d71a0)[_0x563a('0xa')](function(_0x606235){logger[_0x563a('0xb')](_0x563a('0xc'),_0x4f89b4,_0x563a('0xd'));logger[_0x563a('0xe')](_0x563a('0xf'),_0x4f89b4,_0x563a('0xd'),JSON[_0x563a('0x10')](_0x606235));if(_0x606235[_0x563a('0x11')]){if(_0x606235[_0x563a('0x11')][_0x563a('0x12')]===0x1f4){logger['error'](_0x563a('0xc'),_0x4f89b4,_0x606235[_0x563a('0x11')][_0x563a('0x13')]);return _0xff1f59(_0x606235[_0x563a('0x11')][_0x563a('0x13')]);}logger[_0x563a('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x4f89b4,_0x606235[_0x563a('0x11')][_0x563a('0x13')]);return _0x543920(_0x606235[_0x563a('0x11')][_0x563a('0x13')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x4f89b4,_0x563a('0xd'));_0x543920(_0x606235[_0x563a('0x14')]['message']);}})[_0x563a('0x15')](function(_0x43fb16){logger[_0x563a('0x11')](_0x563a('0xc'),_0x4f89b4,_0x43fb16);_0xff1f59(_0x43fb16);});});}exports['CreateOpenchannelQueueReport']=function(_0x598693){var _0xe3d2bd=this;return new Promise(function(_0x422aaf,_0x54a3b4){return db['OpenchannelQueueReport']['create'](_0x598693['body'],{'raw':_0x598693['options']?_0x598693[_0x563a('0x16')][_0x563a('0x17')]===undefined?!![]:![]:!![]})[_0x563a('0xa')](function(_0x43b7a8){logger['info']('CreateOpenchannelQueueReport',_0x598693);logger[_0x563a('0xe')](_0x563a('0x18'),_0x598693,JSON[_0x563a('0x10')](_0x43b7a8));_0x422aaf(_0x43b7a8);})[_0x563a('0x15')](function(_0x1bf502){logger[_0x563a('0x11')](_0x563a('0x18'),_0x1bf502[_0x563a('0x13')],_0x598693);_0x54a3b4(_0xe3d2bd['error'](0x1f4,_0x1bf502[_0x563a('0x13')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x44e2c1){var _0xd3e0ae=this;return new Promise(function(_0x3a36a4,_0x1250e6){return db[_0x563a('0x19')][_0x563a('0x1a')](_0x44e2c1[_0x563a('0x1b')],{'raw':_0x44e2c1[_0x563a('0x16')]?_0x44e2c1['options'][_0x563a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44e2c1[_0x563a('0x16')]?_0x44e2c1[_0x563a('0x16')][_0x563a('0x1c')]||null:null,'attributes':_0x44e2c1[_0x563a('0x16')]?_0x44e2c1[_0x563a('0x16')][_0x563a('0x1d')]||null:null,'limit':_0x44e2c1[_0x563a('0x16')]?_0x44e2c1[_0x563a('0x16')][_0x563a('0x1e')]||null:null})[_0x563a('0xa')](function(_0x24d1a8){logger[_0x563a('0xb')](_0x563a('0x1f'),_0x44e2c1);logger['debug'](_0x563a('0x1f'),_0x44e2c1,JSON[_0x563a('0x10')](_0x24d1a8));_0x3a36a4(_0x24d1a8);})[_0x563a('0x15')](function(_0x4aaa3d){logger[_0x563a('0x11')](_0x563a('0x1f'),_0x4aaa3d[_0x563a('0x13')],_0x44e2c1);_0x1250e6(_0xd3e0ae[_0x563a('0x11')](0x1f4,_0x4aaa3d[_0x563a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 2a0bed5..5a6ca34 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 _0x2725=['isAuthenticated','index','describe','/:id','post','put','update','delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get'];(function(_0x15af11,_0x244124){var _0x3f59de=function(_0x3a5517){while(--_0x3a5517){_0x15af11['push'](_0x15af11['shift']());}};_0x3f59de(++_0x244124);}(_0x2725,0x195));var _0x5272=function(_0x47623f,_0x148f3a){_0x47623f=_0x47623f-0x0;var _0x282ce8=_0x2725[_0x47623f];return _0x282ce8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5272('0x0'));var timeout=require(_0x5272('0x1'));var express=require(_0x5272('0x2'));var router=express[_0x5272('0x3')]();var fs_extra=require(_0x5272('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5272('0x5'));var config=require(_0x5272('0x6'));var controller=require(_0x5272('0x7'));router[_0x5272('0x8')]('/',auth[_0x5272('0x9')](),controller[_0x5272('0xa')]);router[_0x5272('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x5272('0xb')]);router[_0x5272('0x8')](_0x5272('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x5272('0xd')]('/',auth[_0x5272('0x9')](),controller['create']);router[_0x5272('0xe')](_0x5272('0xc'),auth['isAuthenticated'](),controller[_0x5272('0xf')]);router[_0x5272('0x10')]('/:id',auth[_0x5272('0x9')](),controller['destroy']);module[_0x5272('0x11')]=router; \ No newline at end of file +var _0x0c15=['../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra'];(function(_0x1b3ed9,_0x23c04){var _0x5a8e35=function(_0x3247d8){while(--_0x3247d8){_0x1b3ed9['push'](_0x1b3ed9['shift']());}};_0x5a8e35(++_0x23c04);}(_0x0c15,0x14f));var _0x50c1=function(_0x345b8b,_0x3830a9){_0x345b8b=_0x345b8b-0x0;var _0x23cc4a=_0x0c15[_0x345b8b];return _0x23cc4a;};'use strict';var multer=require(_0x50c1('0x0'));var util=require(_0x50c1('0x1'));var path=require(_0x50c1('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x50c1('0x3')]();var fs_extra=require(_0x50c1('0x4'));var auth=require(_0x50c1('0x5'));var interaction=require(_0x50c1('0x6'));var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router[_0x50c1('0x7')]('/',auth['isAuthenticated'](),controller[_0x50c1('0x8')]);router[_0x50c1('0x7')](_0x50c1('0x9'),auth[_0x50c1('0xa')](),controller[_0x50c1('0xb')]);router[_0x50c1('0x7')](_0x50c1('0xc'),auth[_0x50c1('0xa')](),controller['show']);router[_0x50c1('0xd')]('/',auth[_0x50c1('0xa')](),controller[_0x50c1('0xe')]);router[_0x50c1('0xf')](_0x50c1('0xc'),auth[_0x50c1('0xa')](),controller[_0x50c1('0x10')]);router[_0x50c1('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x50c1('0x12')]);module[_0x50c1('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 274a022..101bff9 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x4a7095,_0x570f2d){var _0x392629=function(_0x552ef6){while(--_0x552ef6){_0x4a7095['push'](_0x4a7095['shift']());}};_0x392629(++_0x570f2d);}(_0xaa88,0x137));var _0x8aa8=function(_0x60df74,_0x458e29){_0x60df74=_0x60df74-0x0;var _0x5ee872=_0xaa88[_0x60df74];return _0x5ee872;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x100b96,_0x1bac2c){var _0x44bbcf=function(_0x3ed853){while(--_0x3ed853){_0x100b96['push'](_0x100b96['shift']());}};_0x44bbcf(++_0x1bac2c);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index eb8beaf..da32393 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 _0x23b2=['options','includeAll','findAll','catch','show','params','keys','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','to-csv','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','error','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0xbb692,_0x2d903e){var _0x382b4a=function(_0x1f48ae){while(--_0x1f48ae){_0xbb692['push'](_0xbb692['shift']());}};_0x382b4a(++_0x2d903e);}(_0x23b2,0x1c8));var _0x223b=function(_0x41bf13,_0x2eda5c){_0x41bf13=_0x41bf13-0x0;var _0x73c5d0=_0x23b2[_0x41bf13];return _0x73c5d0;};'use strict';var emlformat=require(_0x223b('0x0'));var rimraf=require(_0x223b('0x1'));var zipdir=require(_0x223b('0x2'));var jsonpatch=require(_0x223b('0x3'));var rp=require(_0x223b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x223b('0x5'));var util=require(_0x223b('0x6'));var path=require(_0x223b('0x7'));var sox=require(_0x223b('0x8'));var csv=require('to-csv');var ejs=require(_0x223b('0x9'));var fs=require('fs');var fs_extra=require(_0x223b('0xa'));var _=require(_0x223b('0xb'));var squel=require(_0x223b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x223b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x223b('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x223b('0xf'));var logger=require(_0x223b('0x10'))(_0x223b('0x11'));var utils=require(_0x223b('0x12'));var config=require(_0x223b('0x13'));var licenseUtil=require(_0x223b('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14d48e,_0x356b73){_0x356b73=_0x356b73||0xcc;return function(_0x1811fe){if(_0x1811fe){return _0x14d48e[_0x223b('0x15')](_0x356b73);}return _0x14d48e[_0x223b('0x16')](_0x356b73)['end']();};}function respondWithResult(_0x5ae189,_0x5cd689){_0x5cd689=_0x5cd689||0xc8;return function(_0x402440){if(_0x402440){return _0x5ae189['status'](_0x5cd689)[_0x223b('0x17')](_0x402440);}};}function respondWithFilteredResult(_0x4234cc,_0x5f0680){return function(_0x18c1d4){if(_0x18c1d4){var _0x261354=typeof _0x5f0680[_0x223b('0x18')]==='undefined'&&typeof _0x5f0680[_0x223b('0x19')]===_0x223b('0x1a');var _0x5230ba=_0x18c1d4[_0x223b('0x1b')];var _0x5ea7d9=_0x261354?0x0:_0x5f0680['offset'];var _0x4e0838=_0x261354?_0x18c1d4['count']:_0x5f0680['offset']+_0x5f0680[_0x223b('0x19')];var _0xeb8cd5;if(_0x4e0838>=_0x5230ba){_0x4e0838=_0x5230ba;_0xeb8cd5=0xc8;}else{_0xeb8cd5=0xce;}_0x4234cc[_0x223b('0x16')](_0xeb8cd5);return _0x4234cc[_0x223b('0x1c')](_0x223b('0x1d'),_0x5ea7d9+'-'+_0x4e0838+'/'+_0x5230ba)[_0x223b('0x17')](_0x18c1d4);}return null;};}function patchUpdates(_0x30ffac){return function(_0x5acacb){try{jsonpatch[_0x223b('0x1e')](_0x5acacb,_0x30ffac,!![]);}catch(_0x116a72){return BPromise[_0x223b('0x1f')](_0x116a72);}return _0x5acacb[_0x223b('0x20')]();};}function saveUpdates(_0x278ae6,_0x2ab0b8){return function(_0x235c7a){if(_0x235c7a){return _0x235c7a[_0x223b('0x21')](_0x278ae6)[_0x223b('0x22')](function(_0x5a3f06){return _0x5a3f06;});}return null;};}function removeEntity(_0x3fe507,_0x46aff8){return function(_0x5478f2){if(_0x5478f2){return _0x5478f2['destroy']()[_0x223b('0x22')](function(){_0x3fe507[_0x223b('0x16')](0xcc)[_0x223b('0x23')]();});}};}function handleEntityNotFound(_0x4ad362,_0x1705d9){return function(_0x11b398){if(!_0x11b398){_0x4ad362['sendStatus'](0x194);}return _0x11b398;};}function handleError(_0x4516ab,_0x48be0c){_0x48be0c=_0x48be0c||0x1f4;return function(_0x297e34){logger[_0x223b('0x24')](_0x297e34['stack']);if(_0x297e34[_0x223b('0x25')]){delete _0x297e34[_0x223b('0x25')];}_0x4516ab['status'](_0x48be0c)[_0x223b('0x26')](_0x297e34);};}exports[_0x223b('0x27')]=function(_0x53085d,_0x3da11c){var _0x23f5b8={},_0x2b3c7a={},_0x192417={'count':0x0,'rows':[]};var _0x19980d=_[_0x223b('0x28')](db[_0x223b('0x29')][_0x223b('0x2a')],function(_0x49e5dc){return{'name':_0x49e5dc[_0x223b('0x2b')],'type':_0x49e5dc[_0x223b('0x2c')][_0x223b('0x2d')]};});_0x2b3c7a[_0x223b('0x2e')]=_[_0x223b('0x28')](_0x19980d,'name');_0x2b3c7a[_0x223b('0x2f')]=_['keys'](_0x53085d[_0x223b('0x2f')]);_0x2b3c7a[_0x223b('0x30')]=_[_0x223b('0x31')](_0x2b3c7a['model'],_0x2b3c7a[_0x223b('0x2f')]);_0x23f5b8[_0x223b('0x32')]=_[_0x223b('0x31')](_0x2b3c7a[_0x223b('0x2e')],qs[_0x223b('0x33')](_0x53085d['query'][_0x223b('0x33')]));_0x23f5b8[_0x223b('0x32')]=_0x23f5b8['attributes'][_0x223b('0x34')]?_0x23f5b8[_0x223b('0x32')]:_0x2b3c7a['model'];if(!_0x53085d[_0x223b('0x2f')][_0x223b('0x35')](_0x223b('0x36'))){_0x23f5b8[_0x223b('0x19')]=qs[_0x223b('0x19')](_0x53085d['query'][_0x223b('0x19')]);_0x23f5b8[_0x223b('0x18')]=qs['offset'](_0x53085d['query'][_0x223b('0x18')]);}_0x23f5b8[_0x223b('0x37')]=qs[_0x223b('0x38')](_0x53085d[_0x223b('0x2f')]['sort']);_0x23f5b8[_0x223b('0x39')]=qs[_0x223b('0x30')](_[_0x223b('0x3a')](_0x53085d[_0x223b('0x2f')],_0x2b3c7a[_0x223b('0x30')]),_0x19980d);if(_0x53085d['query'][_0x223b('0x3b')]){_0x23f5b8['where']=_[_0x223b('0x3c')](_0x23f5b8['where'],{'$or':_[_0x223b('0x28')](_0x19980d,function(_0x548b99){if(_0x548b99[_0x223b('0x2c')]!==_0x223b('0x3d')){var _0x111b14={};_0x111b14[_0x548b99[_0x223b('0x25')]]={'$like':'%'+_0x53085d[_0x223b('0x2f')][_0x223b('0x3b')]+'%'};return _0x111b14;}})});}_0x23f5b8=_[_0x223b('0x3c')]({},_0x23f5b8,_0x53085d[_0x223b('0x3e')]);var _0x1cec45={'where':_0x23f5b8['where']};return db[_0x223b('0x29')]['count'](_0x1cec45)[_0x223b('0x22')](function(_0x438528){_0x192417[_0x223b('0x1b')]=_0x438528;if(_0x53085d[_0x223b('0x2f')][_0x223b('0x3f')]){_0x23f5b8['include']=[{'all':!![]}];}return db[_0x223b('0x29')][_0x223b('0x40')](_0x23f5b8);})['then'](function(_0x218cf8){_0x192417['rows']=_0x218cf8;return _0x192417;})['then'](respondWithFilteredResult(_0x3da11c,_0x23f5b8))[_0x223b('0x41')](handleError(_0x3da11c,null));};exports[_0x223b('0x42')]=function(_0xcf21a2,_0x170c65){var _0x168196={'raw':!![],'where':{'id':_0xcf21a2[_0x223b('0x43')]['id']}},_0x38a38c={};_0x38a38c[_0x223b('0x2e')]=_['keys'](db[_0x223b('0x29')][_0x223b('0x2a')]);_0x38a38c[_0x223b('0x2f')]=_[_0x223b('0x44')](_0xcf21a2['query']);_0x38a38c[_0x223b('0x30')]=_[_0x223b('0x31')](_0x38a38c[_0x223b('0x2e')],_0x38a38c[_0x223b('0x2f')]);_0x168196[_0x223b('0x32')]=_[_0x223b('0x31')](_0x38a38c[_0x223b('0x2e')],qs[_0x223b('0x33')](_0xcf21a2[_0x223b('0x2f')]['fields']));_0x168196[_0x223b('0x32')]=_0x168196[_0x223b('0x32')][_0x223b('0x34')]?_0x168196['attributes']:_0x38a38c[_0x223b('0x2e')];if(_0xcf21a2[_0x223b('0x2f')]['includeAll']){_0x168196['include']=[{'all':!![]}];}_0x168196=_['merge']({},_0x168196,_0xcf21a2[_0x223b('0x3e')]);return db[_0x223b('0x29')][_0x223b('0x45')](_0x168196)['then'](handleEntityNotFound(_0x170c65,null))[_0x223b('0x22')](respondWithResult(_0x170c65,null))[_0x223b('0x41')](handleError(_0x170c65,null));};exports[_0x223b('0x46')]=function(_0x2a9051,_0x4cedd7){return db[_0x223b('0x29')][_0x223b('0x46')](_0x2a9051['body'],{})[_0x223b('0x22')](respondWithResult(_0x4cedd7,0xc9))[_0x223b('0x41')](handleError(_0x4cedd7,null));};exports['update']=function(_0xe96752,_0x545152){if(_0xe96752['body']['id']){delete _0xe96752[_0x223b('0x47')]['id'];}return db[_0x223b('0x29')][_0x223b('0x45')]({'where':{'id':_0xe96752['params']['id']}})[_0x223b('0x22')](handleEntityNotFound(_0x545152,null))[_0x223b('0x22')](saveUpdates(_0xe96752[_0x223b('0x47')],null))[_0x223b('0x22')](respondWithResult(_0x545152,null))[_0x223b('0x41')](handleError(_0x545152,null));};exports[_0x223b('0x48')]=function(_0x2471db,_0x2aaa68){return db[_0x223b('0x29')][_0x223b('0x45')]({'where':{'id':_0x2471db[_0x223b('0x43')]['id']}})['then'](handleEntityNotFound(_0x2aaa68,null))[_0x223b('0x22')](removeEntity(_0x2aaa68,null))['catch'](handleError(_0x2aaa68,null));};exports['describe']=function(_0x4d6080,_0x1a5306){return db['OpenchannelTransferReport'][_0x223b('0x49')]()[_0x223b('0x22')](respondWithResult(_0x1a5306,null))[_0x223b('0x41')](handleError(_0x1a5306,null));}; \ No newline at end of file +var _0xdc1e=['util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','limit','undefined','count','offset','set','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','OpenchannelTransferReport','includeAll','include','catch','show','length','find','create','body','update','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x40e11f,_0x56fa5d){var _0x1e1527=function(_0x3924bc){while(--_0x3924bc){_0x40e11f['push'](_0x40e11f['shift']());}};_0x1e1527(++_0x56fa5d);}(_0xdc1e,0xde));var _0xedc1=function(_0x2947bc,_0x1290bc){_0x2947bc=_0x2947bc-0x0;var _0x2377f5=_0xdc1e[_0x2947bc];return _0x2377f5;};'use strict';var emlformat=require(_0xedc1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xedc1('0x1'));var jsonpatch=require(_0xedc1('0x2'));var rp=require(_0xedc1('0x3'));var moment=require(_0xedc1('0x4'));var BPromise=require(_0xedc1('0x5'));var Mustache=require('mustache');var util=require(_0xedc1('0x6'));var path=require('path');var sox=require(_0xedc1('0x7'));var csv=require(_0xedc1('0x8'));var ejs=require(_0xedc1('0x9'));var fs=require('fs');var fs_extra=require(_0xedc1('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xedc1('0xb'));var jsforce=require(_0xedc1('0xc'));var deskjs=require(_0xedc1('0xd'));var toCsv=require(_0xedc1('0x8'));var querystring=require(_0xedc1('0xe'));var Papa=require(_0xedc1('0xf'));var Redis=require(_0xedc1('0x10'));var authService=require(_0xedc1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xedc1('0x12'));var hardwareService=require(_0xedc1('0x13'));var logger=require(_0xedc1('0x14'))(_0xedc1('0x15'));var utils=require('../../config/utils');var config=require(_0xedc1('0x16'));var licenseUtil=require(_0xedc1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ec089,_0x5bd3cb){_0x5bd3cb=_0x5bd3cb||0xcc;return function(_0x1b26d6){if(_0x1b26d6){return _0x5ec089[_0xedc1('0x18')](_0x5bd3cb);}return _0x5ec089[_0xedc1('0x19')](_0x5bd3cb)[_0xedc1('0x1a')]();};}function respondWithResult(_0x480716,_0x11ae33){_0x11ae33=_0x11ae33||0xc8;return function(_0x3f9753){if(_0x3f9753){return _0x480716[_0xedc1('0x19')](_0x11ae33)['json'](_0x3f9753);}};}function respondWithFilteredResult(_0x238f0d,_0x1d06e9){return function(_0x15aeb3){if(_0x15aeb3){var _0x36d5a3=typeof _0x1d06e9['offset']==='undefined'&&typeof _0x1d06e9[_0xedc1('0x1b')]===_0xedc1('0x1c');var _0x9b5d14=_0x15aeb3[_0xedc1('0x1d')];var _0x5c71d7=_0x36d5a3?0x0:_0x1d06e9[_0xedc1('0x1e')];var _0x5aa368=_0x36d5a3?_0x15aeb3['count']:_0x1d06e9[_0xedc1('0x1e')]+_0x1d06e9[_0xedc1('0x1b')];var _0x97ae2;if(_0x5aa368>=_0x9b5d14){_0x5aa368=_0x9b5d14;_0x97ae2=0xc8;}else{_0x97ae2=0xce;}_0x238f0d[_0xedc1('0x19')](_0x97ae2);return _0x238f0d[_0xedc1('0x1f')]('Content-Range',_0x5c71d7+'-'+_0x5aa368+'/'+_0x9b5d14)[_0xedc1('0x20')](_0x15aeb3);}return null;};}function patchUpdates(_0x1cfaba){return function(_0x197926){try{jsonpatch[_0xedc1('0x21')](_0x197926,_0x1cfaba,!![]);}catch(_0x18e22f){return BPromise[_0xedc1('0x22')](_0x18e22f);}return _0x197926[_0xedc1('0x23')]();};}function saveUpdates(_0x870c87,_0x1b8260){return function(_0x38c755){if(_0x38c755){return _0x38c755['update'](_0x870c87)[_0xedc1('0x24')](function(_0x7b4248){return _0x7b4248;});}return null;};}function removeEntity(_0x2db7a2,_0x34e4f4){return function(_0x32ebc2){if(_0x32ebc2){return _0x32ebc2[_0xedc1('0x25')]()[_0xedc1('0x24')](function(){_0x2db7a2['status'](0xcc)[_0xedc1('0x1a')]();});}};}function handleEntityNotFound(_0xc8827e,_0x3f1ad0){return function(_0x192bff){if(!_0x192bff){_0xc8827e[_0xedc1('0x18')](0x194);}return _0x192bff;};}function handleError(_0x18a2f4,_0x1e931a){_0x1e931a=_0x1e931a||0x1f4;return function(_0x46b1de){logger[_0xedc1('0x26')](_0x46b1de[_0xedc1('0x27')]);if(_0x46b1de['name']){delete _0x46b1de[_0xedc1('0x28')];}_0x18a2f4[_0xedc1('0x19')](_0x1e931a)[_0xedc1('0x29')](_0x46b1de);};}exports[_0xedc1('0x2a')]=function(_0x2123ed,_0x1ccc3e){var _0xb6ca47={},_0x12f8de={},_0x4da478={'count':0x0,'rows':[]};var _0x498e11=_[_0xedc1('0x2b')](db['OpenchannelTransferReport'][_0xedc1('0x2c')],function(_0x41e173){return{'name':_0x41e173[_0xedc1('0x2d')],'type':_0x41e173[_0xedc1('0x2e')][_0xedc1('0x2f')]};});_0x12f8de[_0xedc1('0x30')]=_[_0xedc1('0x2b')](_0x498e11,'name');_0x12f8de[_0xedc1('0x31')]=_[_0xedc1('0x32')](_0x2123ed[_0xedc1('0x31')]);_0x12f8de[_0xedc1('0x33')]=_[_0xedc1('0x34')](_0x12f8de[_0xedc1('0x30')],_0x12f8de[_0xedc1('0x31')]);_0xb6ca47[_0xedc1('0x35')]=_[_0xedc1('0x34')](_0x12f8de[_0xedc1('0x30')],qs[_0xedc1('0x36')](_0x2123ed[_0xedc1('0x31')]['fields']));_0xb6ca47['attributes']=_0xb6ca47[_0xedc1('0x35')]['length']?_0xb6ca47[_0xedc1('0x35')]:_0x12f8de[_0xedc1('0x30')];if(!_0x2123ed[_0xedc1('0x31')][_0xedc1('0x37')]('nolimit')){_0xb6ca47[_0xedc1('0x1b')]=qs[_0xedc1('0x1b')](_0x2123ed['query'][_0xedc1('0x1b')]);_0xb6ca47['offset']=qs['offset'](_0x2123ed[_0xedc1('0x31')][_0xedc1('0x1e')]);}_0xb6ca47[_0xedc1('0x38')]=qs['sort'](_0x2123ed['query'][_0xedc1('0x39')]);_0xb6ca47['where']=qs['filters'](_[_0xedc1('0x3a')](_0x2123ed['query'],_0x12f8de['filters']),_0x498e11);if(_0x2123ed[_0xedc1('0x31')][_0xedc1('0x3b')]){_0xb6ca47[_0xedc1('0x3c')]=_[_0xedc1('0x3d')](_0xb6ca47[_0xedc1('0x3c')],{'$or':_[_0xedc1('0x2b')](_0x498e11,function(_0x155a30){if(_0x155a30[_0xedc1('0x2e')]!==_0xedc1('0x3e')){var _0xc38af3={};_0xc38af3[_0x155a30[_0xedc1('0x28')]]={'$like':'%'+_0x2123ed[_0xedc1('0x31')][_0xedc1('0x3b')]+'%'};return _0xc38af3;}})});}_0xb6ca47=_[_0xedc1('0x3d')]({},_0xb6ca47,_0x2123ed[_0xedc1('0x3f')]);var _0x26aa6a={'where':_0xb6ca47['where']};return db[_0xedc1('0x40')][_0xedc1('0x1d')](_0x26aa6a)[_0xedc1('0x24')](function(_0x18b229){_0x4da478['count']=_0x18b229;if(_0x2123ed[_0xedc1('0x31')][_0xedc1('0x41')]){_0xb6ca47[_0xedc1('0x42')]=[{'all':!![]}];}return db[_0xedc1('0x40')]['findAll'](_0xb6ca47);})[_0xedc1('0x24')](function(_0x2e9a68){_0x4da478['rows']=_0x2e9a68;return _0x4da478;})[_0xedc1('0x24')](respondWithFilteredResult(_0x1ccc3e,_0xb6ca47))[_0xedc1('0x43')](handleError(_0x1ccc3e,null));};exports[_0xedc1('0x44')]=function(_0x1b968c,_0xa9f8b1){var _0x2ec382={'raw':!![],'where':{'id':_0x1b968c['params']['id']}},_0x38aaed={};_0x38aaed[_0xedc1('0x30')]=_[_0xedc1('0x32')](db['OpenchannelTransferReport'][_0xedc1('0x2c')]);_0x38aaed['query']=_['keys'](_0x1b968c[_0xedc1('0x31')]);_0x38aaed[_0xedc1('0x33')]=_[_0xedc1('0x34')](_0x38aaed['model'],_0x38aaed[_0xedc1('0x31')]);_0x2ec382['attributes']=_['intersection'](_0x38aaed[_0xedc1('0x30')],qs['fields'](_0x1b968c[_0xedc1('0x31')][_0xedc1('0x36')]));_0x2ec382[_0xedc1('0x35')]=_0x2ec382['attributes'][_0xedc1('0x45')]?_0x2ec382[_0xedc1('0x35')]:_0x38aaed['model'];if(_0x1b968c[_0xedc1('0x31')][_0xedc1('0x41')]){_0x2ec382[_0xedc1('0x42')]=[{'all':!![]}];}_0x2ec382=_[_0xedc1('0x3d')]({},_0x2ec382,_0x1b968c['options']);return db[_0xedc1('0x40')][_0xedc1('0x46')](_0x2ec382)[_0xedc1('0x24')](handleEntityNotFound(_0xa9f8b1,null))[_0xedc1('0x24')](respondWithResult(_0xa9f8b1,null))[_0xedc1('0x43')](handleError(_0xa9f8b1,null));};exports[_0xedc1('0x47')]=function(_0x4d1cf9,_0x8fae04){return db[_0xedc1('0x40')][_0xedc1('0x47')](_0x4d1cf9[_0xedc1('0x48')],{})[_0xedc1('0x24')](respondWithResult(_0x8fae04,0xc9))['catch'](handleError(_0x8fae04,null));};exports[_0xedc1('0x49')]=function(_0x591a5e,_0x5efcb4){if(_0x591a5e[_0xedc1('0x48')]['id']){delete _0x591a5e['body']['id'];}return db[_0xedc1('0x40')][_0xedc1('0x46')]({'where':{'id':_0x591a5e['params']['id']}})['then'](handleEntityNotFound(_0x5efcb4,null))[_0xedc1('0x24')](saveUpdates(_0x591a5e['body'],null))[_0xedc1('0x24')](respondWithResult(_0x5efcb4,null))['catch'](handleError(_0x5efcb4,null));};exports['destroy']=function(_0x1f07e2,_0x125de9){return db[_0xedc1('0x40')][_0xedc1('0x46')]({'where':{'id':_0x1f07e2[_0xedc1('0x4a')]['id']}})[_0xedc1('0x24')](handleEntityNotFound(_0x125de9,null))[_0xedc1('0x24')](removeEntity(_0x125de9,null))[_0xedc1('0x43')](handleError(_0x125de9,null));};exports[_0xedc1('0x4b')]=function(_0x5f59f1,_0x5c9472){return db[_0xedc1('0x40')][_0xedc1('0x4b')]()[_0xedc1('0x24')](respondWithResult(_0x5c9472,null))[_0xedc1('0x43')](handleError(_0x5c9472,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 97a9437..3513f85 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 _0xc928=['path','rimraf','../../config/environment','exports','define','report_openchannel_transfer','uniqueid','util','../../config/logger','api','bluebird'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0xc928,0xf9));var _0x8c92=function(_0x26ab85,_0x197fce){_0x26ab85=_0x26ab85-0x0;var _0x4de276=_0xc928[_0x26ab85];return _0x4de276;};'use strict';var _=require('lodash');var util=require(_0x8c92('0x0'));var logger=require(_0x8c92('0x1'))(_0x8c92('0x2'));var moment=require('moment');var BPromise=require(_0x8c92('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c92('0x4'));var rimraf=require(_0x8c92('0x5'));var config=require(_0x8c92('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0x8c92('0x7')]=function(_0x433eda,_0x394ed0){return _0x433eda[_0x8c92('0x8')]('OpenchannelTransferReport',attributes,{'tableName':_0x8c92('0x9'),'paranoid':![],'indexes':[{'name':_0x8c92('0xa'),'fields':[_0x8c92('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x307e=['report_openchannel_transfer','uniqueid','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport'];(function(_0x50f817,_0xb60fff){var _0x1dffec=function(_0x259dd8){while(--_0x259dd8){_0x50f817['push'](_0x50f817['shift']());}};_0x1dffec(++_0xb60fff);}(_0x307e,0x12d));var _0xe307=function(_0x524b02,_0x43008f){_0x524b02=_0x524b02-0x0;var _0x3ca7e4=_0x307e[_0x524b02];return _0x3ca7e4;};'use strict';var _=require('lodash');var util=require(_0xe307('0x0'));var logger=require(_0xe307('0x1'))('api');var moment=require(_0xe307('0x2'));var BPromise=require(_0xe307('0x3'));var rp=require(_0xe307('0x4'));var fs=require('fs');var path=require(_0xe307('0x5'));var rimraf=require('rimraf');var config=require(_0xe307('0x6'));var attributes=require(_0xe307('0x7'));module[_0xe307('0x8')]=function(_0x19b7ad,_0x377a89){return _0x19b7ad[_0xe307('0x9')](_0xe307('0xa'),attributes,{'tableName':_0xe307('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe307('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 2807880..a0eb3f6 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 _0x37c5=['../../config/environment','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xa365e3,_0x695438){var _0x318a0b=function(_0x11f3f3){while(--_0x11f3f3){_0xa365e3['push'](_0xa365e3['shift']());}};_0x318a0b(++_0x695438);}(_0x37c5,0xa7));var _0x537c=function(_0x3d79d5,_0x93a1a7){_0x3d79d5=_0x3d79d5-0x0;var _0x3c664c=_0x37c5[_0x3d79d5];return _0x3c664c;};'use strict';var _=require('lodash');var util=require(_0x537c('0x0'));var moment=require(_0x537c('0x1'));var BPromise=require(_0x537c('0x2'));var rs=require(_0x537c('0x3'));var fs=require('fs');var Redis=require(_0x537c('0x4'));var db=require(_0x537c('0x5'))['db'];var utils=require(_0x537c('0x6'));var logger=require(_0x537c('0x7'))(_0x537c('0x8'));var config=require(_0x537c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x537c('0xa')][_0x537c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x336920,_0x57666f,_0x36bf4a){return new BPromise(function(_0x67f986,_0x32b9c7){return client[_0x537c('0xc')](_0x336920,_0x36bf4a)['then'](function(_0x2c2f06){logger[_0x537c('0xd')](_0x537c('0xe'),_0x57666f,'request\x20sent');logger[_0x537c('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x57666f,'request\x20sent',JSON[_0x537c('0x10')](_0x2c2f06));if(_0x2c2f06['error']){if(_0x2c2f06[_0x537c('0x11')][_0x537c('0x12')]===0x1f4){logger[_0x537c('0x11')](_0x537c('0xe'),_0x57666f,_0x2c2f06[_0x537c('0x11')][_0x537c('0x13')]);return _0x32b9c7(_0x2c2f06[_0x537c('0x11')][_0x537c('0x13')]);}logger[_0x537c('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x57666f,_0x2c2f06[_0x537c('0x11')][_0x537c('0x13')]);return _0x67f986(_0x2c2f06[_0x537c('0x11')][_0x537c('0x13')]);}else{logger[_0x537c('0xd')](_0x537c('0xe'),_0x57666f,_0x537c('0x14'));_0x67f986(_0x2c2f06[_0x537c('0x15')][_0x537c('0x13')]);}})['catch'](function(_0x3ae729){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x57666f,_0x3ae729);_0x32b9c7(_0x3ae729);});});} \ No newline at end of file +var _0xc03e=['catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1646fa,_0x4e5bd7){var _0x5a47a5=function(_0x2db820){while(--_0x2db820){_0x1646fa['push'](_0x1646fa['shift']());}};_0x5a47a5(++_0x4e5bd7);}(_0xc03e,0x15a));var _0xec03=function(_0x1ec65c,_0x354923){_0x1ec65c=_0x1ec65c-0x0;var _0x5249c2=_0xc03e[_0x1ec65c];return _0x5249c2;};'use strict';var _=require(_0xec03('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xec03('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xec03('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xec03('0x3'));var logger=require(_0xec03('0x4'))(_0xec03('0x5'));var config=require(_0xec03('0x6'));var jayson=require(_0xec03('0x7'));var client=jayson[_0xec03('0x8')][_0xec03('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xcaaf03,_0x278f90,_0x529ebd){return new BPromise(function(_0x4205e9,_0xb0638e){return client[_0xec03('0xa')](_0xcaaf03,_0x529ebd)[_0xec03('0xb')](function(_0x4d7e09){logger[_0xec03('0xc')](_0xec03('0xd'),_0x278f90,_0xec03('0xe'));logger[_0xec03('0xf')](_0xec03('0x10'),_0x278f90,_0xec03('0xe'),JSON[_0xec03('0x11')](_0x4d7e09));if(_0x4d7e09[_0xec03('0x12')]){if(_0x4d7e09['error'][_0xec03('0x13')]===0x1f4){logger[_0xec03('0x12')](_0xec03('0xd'),_0x278f90,_0x4d7e09[_0xec03('0x12')][_0xec03('0x14')]);return _0xb0638e(_0x4d7e09[_0xec03('0x12')][_0xec03('0x14')]);}logger[_0xec03('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x278f90,_0x4d7e09['error']['message']);return _0x4205e9(_0x4d7e09[_0xec03('0x12')][_0xec03('0x14')]);}else{logger[_0xec03('0xc')](_0xec03('0xd'),_0x278f90,_0xec03('0xe'));_0x4205e9(_0x4d7e09[_0xec03('0x15')][_0xec03('0x14')]);}})[_0xec03('0x16')](function(_0x5c2f1a){logger[_0xec03('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x278f90,_0x5c2f1a);_0xb0638e(_0x5c2f1a);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index cc09e36..93458a2 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 _0xcc22=['post','create','isAuthenticated','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get','/:id'];(function(_0x306290,_0x104eb0){var _0x28bd17=function(_0xa17e39){while(--_0xa17e39){_0x306290['push'](_0x306290['shift']());}};_0x28bd17(++_0x104eb0);}(_0xcc22,0x66));var _0x2cc2=function(_0x4431a2,_0x3c298d){_0x4431a2=_0x4431a2-0x0;var _0x31edb5=_0xcc22[_0x4431a2];return _0x31edb5;};'use strict';var multer=require(_0x2cc2('0x0'));var util=require(_0x2cc2('0x1'));var path=require(_0x2cc2('0x2'));var timeout=require('connect-timeout');var express=require(_0x2cc2('0x3'));var router=express[_0x2cc2('0x4')]();var fs_extra=require(_0x2cc2('0x5'));var auth=require(_0x2cc2('0x6'));var interaction=require(_0x2cc2('0x7'));var config=require(_0x2cc2('0x8'));var controller=require(_0x2cc2('0x9'));router[_0x2cc2('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2cc2('0xa')](_0x2cc2('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x2cc2('0xc')]('/',auth['isAuthenticated'](),controller[_0x2cc2('0xd')]);router['put']('/:id',auth[_0x2cc2('0xe')](),controller[_0x2cc2('0xf')]);router[_0x2cc2('0x10')](_0x2cc2('0xb'),auth[_0x2cc2('0xe')](),controller[_0x2cc2('0x11')]);module[_0x2cc2('0x12')]=router; \ No newline at end of file +var _0xd189=['index','show','post','create','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated'];(function(_0x41987c,_0x557cd1){var _0x4f0204=function(_0x4c03d9){while(--_0x4c03d9){_0x41987c['push'](_0x41987c['shift']());}};_0x4f0204(++_0x557cd1);}(_0xd189,0x9f));var _0x9d18=function(_0xf91b83,_0x2729d8){_0xf91b83=_0xf91b83-0x0;var _0x3de6f7=_0xd189[_0xf91b83];return _0x3de6f7;};'use strict';var multer=require(_0x9d18('0x0'));var util=require(_0x9d18('0x1'));var path=require(_0x9d18('0x2'));var timeout=require(_0x9d18('0x3'));var express=require(_0x9d18('0x4'));var router=express[_0x9d18('0x5')]();var fs_extra=require(_0x9d18('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9d18('0x7'));var config=require(_0x9d18('0x8'));var controller=require(_0x9d18('0x9'));router[_0x9d18('0xa')]('/',auth[_0x9d18('0xb')](),controller[_0x9d18('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9d18('0xd')]);router[_0x9d18('0xe')]('/',auth[_0x9d18('0xb')](),controller[_0x9d18('0xf')]);router['put'](_0x9d18('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x9d18('0x11')]('/:id',auth[_0x9d18('0xb')](),controller['destroy']);module[_0x9d18('0x12')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 457e504..bb9384c 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 _0xfc70=['sequelize','exports','STRING','name'];(function(_0x4ceb9e,_0x291e82){var _0x259d85=function(_0x374762){while(--_0x374762){_0x4ceb9e['push'](_0x4ceb9e['shift']());}};_0x259d85(++_0x291e82);}(_0xfc70,0x8c));var _0x0fc7=function(_0x111f77,_0x804e1e){_0x111f77=_0x111f77-0x0;var _0x504550=_0xfc70[_0x111f77];return _0x504550;};'use strict';var Sequelize=require(_0x0fc7('0x0'));module[_0x0fc7('0x1')]={'name':{'type':Sequelize[_0x0fc7('0x2')],'unique':_0x0fc7('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x0fc7('0x2')]}}; \ No newline at end of file +var _0xb422=['sequelize','exports','STRING'];(function(_0x41e8c4,_0x30d9ff){var _0x54ffbe=function(_0x4131af){while(--_0x4131af){_0x41e8c4['push'](_0x41e8c4['shift']());}};_0x54ffbe(++_0x30d9ff);}(_0xb422,0x1c8));var _0x2b42=function(_0x353b9d,_0x2c89df){_0x353b9d=_0x353b9d-0x0;var _0x22fde7=_0xb422[_0x353b9d];return _0x22fde7;};'use strict';var Sequelize=require(_0x2b42('0x0'));module[_0x2b42('0x1')]={'name':{'type':Sequelize[_0x2b42('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x2b42('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 3b3578b..30364ee 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 _0x18ff=['../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Pauses','UserProfileResource','end','stack','name','send','index','Pause','rawAttributes','fieldName','map','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','show','params','options','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','error','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0x18ff,0x136));var _0xf18f=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x18ff[_0x37bd26];return _0xe83dc4;};'use strict';var emlformat=require(_0xf18f('0x0'));var rimraf=require(_0xf18f('0x1'));var zipdir=require(_0xf18f('0x2'));var jsonpatch=require(_0xf18f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf18f('0x4'));var Mustache=require('mustache');var util=require(_0xf18f('0x5'));var path=require('path');var sox=require(_0xf18f('0x6'));var csv=require(_0xf18f('0x7'));var ejs=require(_0xf18f('0x8'));var fs=require('fs');var fs_extra=require(_0xf18f('0x9'));var _=require(_0xf18f('0xa'));var squel=require(_0xf18f('0xb'));var crypto=require(_0xf18f('0xc'));var jsforce=require(_0xf18f('0xd'));var deskjs=require(_0xf18f('0xe'));var toCsv=require(_0xf18f('0x7'));var querystring=require('querystring');var Papa=require(_0xf18f('0xf'));var Redis=require(_0xf18f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf18f('0x11'));var as=require(_0xf18f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf18f('0x13'));var utils=require('../../config/utils');var config=require(_0xf18f('0x14'));var licenseUtil=require(_0xf18f('0x15'));var db=require(_0xf18f('0x16'))['db'];function respondWithStatusCode(_0x476947,_0x288565){_0x288565=_0x288565||0xcc;return function(_0x519a6d){if(_0x519a6d){return _0x476947[_0xf18f('0x17')](_0x288565);}return _0x476947[_0xf18f('0x18')](_0x288565)['end']();};}function respondWithResult(_0x143806,_0x1b0c35){_0x1b0c35=_0x1b0c35||0xc8;return function(_0x3e1ce1){if(_0x3e1ce1){return _0x143806['status'](_0x1b0c35)[_0xf18f('0x19')](_0x3e1ce1);}};}function respondWithFilteredResult(_0x17af43,_0x2a5091){return function(_0x54680d){if(_0x54680d){var _0x2a3778=typeof _0x2a5091[_0xf18f('0x1a')]===_0xf18f('0x1b')&&typeof _0x2a5091[_0xf18f('0x1c')]===_0xf18f('0x1b');var _0x16b116=_0x54680d[_0xf18f('0x1d')];var _0x47fa28=_0x2a3778?0x0:_0x2a5091[_0xf18f('0x1a')];var _0x247823=_0x2a3778?_0x54680d['count']:_0x2a5091[_0xf18f('0x1a')]+_0x2a5091[_0xf18f('0x1c')];var _0x238a24;if(_0x247823>=_0x16b116){_0x247823=_0x16b116;_0x238a24=0xc8;}else{_0x238a24=0xce;}_0x17af43[_0xf18f('0x18')](_0x238a24);return _0x17af43[_0xf18f('0x1e')](_0xf18f('0x1f'),_0x47fa28+'-'+_0x247823+'/'+_0x16b116)['json'](_0x54680d);}return null;};}function patchUpdates(_0x5ef5a5){return function(_0x4b1ef0){try{jsonpatch[_0xf18f('0x20')](_0x4b1ef0,_0x5ef5a5,!![]);}catch(_0x26112f){return BPromise[_0xf18f('0x21')](_0x26112f);}return _0x4b1ef0[_0xf18f('0x22')]();};}function saveUpdates(_0x503323,_0x401db3){return function(_0x4d95b0){if(_0x4d95b0){return _0x4d95b0['update'](_0x503323)[_0xf18f('0x23')](function(_0x4a6fe9){return _0x4a6fe9;});}return null;};}function removeEntity(_0x447387,_0x12fd0b){return function(_0x542555){if(_0x542555){return _0x542555[_0xf18f('0x24')]()[_0xf18f('0x23')](function(){var _0x2b5db9=_0x542555[_0xf18f('0x25')]({'plain':!![]});var _0x4c5ac9=_0xf18f('0x26');return db[_0xf18f('0x27')][_0xf18f('0x24')]({'where':{'type':_0x4c5ac9,'resourceId':_0x2b5db9['id']}})[_0xf18f('0x23')](function(){return _0x542555;});})[_0xf18f('0x23')](function(){_0x447387[_0xf18f('0x18')](0xcc)[_0xf18f('0x28')]();});}};}function handleEntityNotFound(_0x51229e,_0x3c886f){return function(_0x31d931){if(!_0x31d931){_0x51229e['sendStatus'](0x194);}return _0x31d931;};}function handleError(_0x2a7fee,_0x403c34){_0x403c34=_0x403c34||0x1f4;return function(_0x10644a){logger['error'](_0x10644a[_0xf18f('0x29')]);if(_0x10644a[_0xf18f('0x2a')]){delete _0x10644a[_0xf18f('0x2a')];}_0x2a7fee['status'](_0x403c34)[_0xf18f('0x2b')](_0x10644a);};}exports[_0xf18f('0x2c')]=function(_0x318f95,_0x54c8d0){var _0x2ce8c0={},_0x5ce72e={},_0x438f26={'count':0x0,'rows':[]};var _0x39008f=_['map'](db[_0xf18f('0x2d')][_0xf18f('0x2e')],function(_0x39c2ee){return{'name':_0x39c2ee[_0xf18f('0x2f')],'type':_0x39c2ee['type']['key']};});_0x5ce72e['model']=_[_0xf18f('0x30')](_0x39008f,_0xf18f('0x2a'));_0x5ce72e[_0xf18f('0x31')]=_[_0xf18f('0x32')](_0x318f95[_0xf18f('0x31')]);_0x5ce72e['filters']=_['intersection'](_0x5ce72e[_0xf18f('0x33')],_0x5ce72e[_0xf18f('0x31')]);_0x2ce8c0[_0xf18f('0x34')]=_[_0xf18f('0x35')](_0x5ce72e['model'],qs[_0xf18f('0x36')](_0x318f95[_0xf18f('0x31')][_0xf18f('0x36')]));_0x2ce8c0[_0xf18f('0x34')]=_0x2ce8c0['attributes'][_0xf18f('0x37')]?_0x2ce8c0['attributes']:_0x5ce72e[_0xf18f('0x33')];if(!_0x318f95[_0xf18f('0x31')][_0xf18f('0x38')](_0xf18f('0x39'))){_0x2ce8c0['limit']=qs[_0xf18f('0x1c')](_0x318f95['query'][_0xf18f('0x1c')]);_0x2ce8c0[_0xf18f('0x1a')]=qs[_0xf18f('0x1a')](_0x318f95[_0xf18f('0x31')][_0xf18f('0x1a')]);}_0x2ce8c0[_0xf18f('0x3a')]=qs[_0xf18f('0x3b')](_0x318f95[_0xf18f('0x31')]['sort']);_0x2ce8c0[_0xf18f('0x3c')]=qs[_0xf18f('0x3d')](_['pick'](_0x318f95[_0xf18f('0x31')],_0x5ce72e[_0xf18f('0x3d')]),_0x39008f);if(_0x318f95['query'][_0xf18f('0x3e')]){_0x2ce8c0[_0xf18f('0x3c')]=_[_0xf18f('0x3f')](_0x2ce8c0[_0xf18f('0x3c')],{'$or':_[_0xf18f('0x30')](_0x39008f,function(_0x503fcb){if(_0x503fcb[_0xf18f('0x40')]!==_0xf18f('0x41')){var _0x11fac3={};_0x11fac3[_0x503fcb[_0xf18f('0x2a')]]={'$like':'%'+_0x318f95[_0xf18f('0x31')][_0xf18f('0x3e')]+'%'};return _0x11fac3;}})});}_0x2ce8c0=_[_0xf18f('0x3f')]({},_0x2ce8c0,_0x318f95['options']);var _0x28497e={'where':_0x2ce8c0['where']};return db['Pause'][_0xf18f('0x1d')](_0x28497e)['then'](function(_0x27bf41){_0x438f26[_0xf18f('0x1d')]=_0x27bf41;if(_0x318f95['query'][_0xf18f('0x42')]){_0x2ce8c0[_0xf18f('0x43')]=[{'all':!![]}];}return db[_0xf18f('0x2d')][_0xf18f('0x44')](_0x2ce8c0);})[_0xf18f('0x23')](function(_0x6be1b7){_0x438f26['rows']=_0x6be1b7;return _0x438f26;})[_0xf18f('0x23')](respondWithFilteredResult(_0x54c8d0,_0x2ce8c0))['catch'](handleError(_0x54c8d0,null));};exports[_0xf18f('0x45')]=function(_0x3b0b5e,_0x3df725){var _0x5f1f0d={'raw':!![],'where':{'id':_0x3b0b5e[_0xf18f('0x46')]['id']}},_0x16644e={};_0x16644e[_0xf18f('0x33')]=_[_0xf18f('0x32')](db[_0xf18f('0x2d')][_0xf18f('0x2e')]);_0x16644e[_0xf18f('0x31')]=_[_0xf18f('0x32')](_0x3b0b5e[_0xf18f('0x31')]);_0x16644e[_0xf18f('0x3d')]=_[_0xf18f('0x35')](_0x16644e['model'],_0x16644e[_0xf18f('0x31')]);_0x5f1f0d[_0xf18f('0x34')]=_[_0xf18f('0x35')](_0x16644e[_0xf18f('0x33')],qs['fields'](_0x3b0b5e[_0xf18f('0x31')][_0xf18f('0x36')]));_0x5f1f0d['attributes']=_0x5f1f0d['attributes'][_0xf18f('0x37')]?_0x5f1f0d['attributes']:_0x16644e[_0xf18f('0x33')];if(_0x3b0b5e[_0xf18f('0x31')][_0xf18f('0x42')]){_0x5f1f0d[_0xf18f('0x43')]=[{'all':!![]}];}_0x5f1f0d=_[_0xf18f('0x3f')]({},_0x5f1f0d,_0x3b0b5e[_0xf18f('0x47')]);return db[_0xf18f('0x2d')]['find'](_0x5f1f0d)['then'](handleEntityNotFound(_0x3df725,null))[_0xf18f('0x23')](respondWithResult(_0x3df725,null))['catch'](handleError(_0x3df725,null));};exports[_0xf18f('0x48')]=function(_0x38ed22,_0x15b44b){return db[_0xf18f('0x2d')][_0xf18f('0x48')](_0x38ed22[_0xf18f('0x49')],{})[_0xf18f('0x23')](function(_0x3f2906){var _0x52a185=_0x38ed22[_0xf18f('0x4a')][_0xf18f('0x25')]({'plain':!![]});if(!_0x52a185)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52a185[_0xf18f('0x4b')]===_0xf18f('0x4a')){var _0x4dbbef=_0x3f2906['get']({'plain':!![]});var _0x496daa='Pauses';return db[_0xf18f('0x4c')][_0xf18f('0x4d')]({'where':{'name':_0x496daa,'userProfileId':_0x52a185[_0xf18f('0x4e')]},'raw':!![]})[_0xf18f('0x23')](function(_0x15b9de){if(_0x15b9de&&_0x15b9de[_0xf18f('0x4f')]===0x0){return db['UserProfileResource'][_0xf18f('0x48')]({'name':_0x4dbbef['name'],'resourceId':_0x4dbbef['id'],'type':_0x15b9de[_0xf18f('0x2a')],'sectionId':_0x15b9de['id']},{})[_0xf18f('0x23')](function(){return _0x3f2906;});}else{return _0x3f2906;}})[_0xf18f('0x50')](function(_0x2fe0d5){logger[_0xf18f('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2fe0d5);throw _0x2fe0d5;});}return _0x3f2906;})[_0xf18f('0x23')](respondWithResult(_0x15b44b,0xc9))['catch'](handleError(_0x15b44b,null));};exports['update']=function(_0x578c0f,_0x53039b){if(_0x578c0f[_0xf18f('0x49')]['id']){delete _0x578c0f[_0xf18f('0x49')]['id'];}return db['Pause']['find']({'where':{'id':_0x578c0f['params']['id']}})[_0xf18f('0x23')](handleEntityNotFound(_0x53039b,null))[_0xf18f('0x23')](saveUpdates(_0x578c0f[_0xf18f('0x49')],null))[_0xf18f('0x23')](respondWithResult(_0x53039b,null))[_0xf18f('0x50')](handleError(_0x53039b,null));};exports[_0xf18f('0x24')]=function(_0x240c54,_0x40bd66){return db['Pause'][_0xf18f('0x4d')]({'where':{'id':_0x240c54[_0xf18f('0x46')]['id']}})[_0xf18f('0x23')](handleEntityNotFound(_0x40bd66,null))[_0xf18f('0x23')](removeEntity(_0x40bd66,null))[_0xf18f('0x50')](handleError(_0x40bd66,null));}; \ No newline at end of file +var _0xb5a2=['model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','params','includeAll','include','find','create','body','user','role','Pauses','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','Content-Range','reject','update','then','get','UserProfileResource','destroy','error','stack','name','send','Pause','rawAttributes','fieldName','type'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0xb5a2,0xc1));var _0x2b5a=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb5a2[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2b5a('0x0'));var rp=require('request-promise');var moment=require(_0x2b5a('0x1'));var BPromise=require(_0x2b5a('0x2'));var Mustache=require(_0x2b5a('0x3'));var util=require(_0x2b5a('0x4'));var path=require(_0x2b5a('0x5'));var sox=require('sox');var csv=require(_0x2b5a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b5a('0x7'));var _=require(_0x2b5a('0x8'));var squel=require(_0x2b5a('0x9'));var crypto=require(_0x2b5a('0xa'));var jsforce=require(_0x2b5a('0xb'));var deskjs=require(_0x2b5a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2b5a('0xd'));var Papa=require(_0x2b5a('0xe'));var Redis=require(_0x2b5a('0xf'));var authService=require(_0x2b5a('0x10'));var qs=require(_0x2b5a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b5a('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x2b5a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2b5a('0x14'));var db=require(_0x2b5a('0x15'))['db'];function respondWithStatusCode(_0x12e756,_0x293459){_0x293459=_0x293459||0xcc;return function(_0x5cea3e){if(_0x5cea3e){return _0x12e756[_0x2b5a('0x16')](_0x293459);}return _0x12e756[_0x2b5a('0x17')](_0x293459)[_0x2b5a('0x18')]();};}function respondWithResult(_0x3a7148,_0x28e7d6){_0x28e7d6=_0x28e7d6||0xc8;return function(_0x382e54){if(_0x382e54){return _0x3a7148[_0x2b5a('0x17')](_0x28e7d6)[_0x2b5a('0x19')](_0x382e54);}};}function respondWithFilteredResult(_0x5db5e4,_0x38db6c){return function(_0x6f4e6e){if(_0x6f4e6e){var _0x2ce8a6=typeof _0x38db6c[_0x2b5a('0x1a')]==='undefined'&&typeof _0x38db6c['limit']==='undefined';var _0x1b307d=_0x6f4e6e[_0x2b5a('0x1b')];var _0x38267d=_0x2ce8a6?0x0:_0x38db6c[_0x2b5a('0x1a')];var _0x2997de=_0x2ce8a6?_0x6f4e6e[_0x2b5a('0x1b')]:_0x38db6c[_0x2b5a('0x1a')]+_0x38db6c[_0x2b5a('0x1c')];var _0x1cd6ca;if(_0x2997de>=_0x1b307d){_0x2997de=_0x1b307d;_0x1cd6ca=0xc8;}else{_0x1cd6ca=0xce;}_0x5db5e4[_0x2b5a('0x17')](_0x1cd6ca);return _0x5db5e4['set'](_0x2b5a('0x1d'),_0x38267d+'-'+_0x2997de+'/'+_0x1b307d)[_0x2b5a('0x19')](_0x6f4e6e);}return null;};}function patchUpdates(_0x390a7c){return function(_0x4b26f3){try{jsonpatch['apply'](_0x4b26f3,_0x390a7c,!![]);}catch(_0x56f02b){return BPromise[_0x2b5a('0x1e')](_0x56f02b);}return _0x4b26f3['save']();};}function saveUpdates(_0x2e9761,_0x39ea1){return function(_0x531983){if(_0x531983){return _0x531983[_0x2b5a('0x1f')](_0x2e9761)[_0x2b5a('0x20')](function(_0x5063cc){return _0x5063cc;});}return null;};}function removeEntity(_0x42b80d,_0x4eed6a){return function(_0x14d340){if(_0x14d340){return _0x14d340['destroy']()[_0x2b5a('0x20')](function(){var _0x29e8b1=_0x14d340[_0x2b5a('0x21')]({'plain':!![]});var _0x3052a3='Pauses';return db[_0x2b5a('0x22')][_0x2b5a('0x23')]({'where':{'type':_0x3052a3,'resourceId':_0x29e8b1['id']}})['then'](function(){return _0x14d340;});})[_0x2b5a('0x20')](function(){_0x42b80d[_0x2b5a('0x17')](0xcc)[_0x2b5a('0x18')]();});}};}function handleEntityNotFound(_0x3cd735,_0x2cf256){return function(_0x2d5b9c){if(!_0x2d5b9c){_0x3cd735[_0x2b5a('0x16')](0x194);}return _0x2d5b9c;};}function handleError(_0x4a593e,_0x4ef75c){_0x4ef75c=_0x4ef75c||0x1f4;return function(_0xca1221){logger[_0x2b5a('0x24')](_0xca1221[_0x2b5a('0x25')]);if(_0xca1221[_0x2b5a('0x26')]){delete _0xca1221[_0x2b5a('0x26')];}_0x4a593e['status'](_0x4ef75c)[_0x2b5a('0x27')](_0xca1221);};}exports['index']=function(_0x5c2b16,_0x4a7d2c){var _0x4545d1={},_0x1468f9={},_0x5cbdea={'count':0x0,'rows':[]};var _0x8dd5b6=_['map'](db[_0x2b5a('0x28')][_0x2b5a('0x29')],function(_0x515740){return{'name':_0x515740[_0x2b5a('0x2a')],'type':_0x515740[_0x2b5a('0x2b')]['key']};});_0x1468f9[_0x2b5a('0x2c')]=_[_0x2b5a('0x2d')](_0x8dd5b6,_0x2b5a('0x26'));_0x1468f9['query']=_[_0x2b5a('0x2e')](_0x5c2b16[_0x2b5a('0x2f')]);_0x1468f9[_0x2b5a('0x30')]=_[_0x2b5a('0x31')](_0x1468f9[_0x2b5a('0x2c')],_0x1468f9[_0x2b5a('0x2f')]);_0x4545d1[_0x2b5a('0x32')]=_[_0x2b5a('0x31')](_0x1468f9[_0x2b5a('0x2c')],qs[_0x2b5a('0x33')](_0x5c2b16[_0x2b5a('0x2f')][_0x2b5a('0x33')]));_0x4545d1['attributes']=_0x4545d1['attributes'][_0x2b5a('0x34')]?_0x4545d1[_0x2b5a('0x32')]:_0x1468f9[_0x2b5a('0x2c')];if(!_0x5c2b16[_0x2b5a('0x2f')][_0x2b5a('0x35')](_0x2b5a('0x36'))){_0x4545d1['limit']=qs[_0x2b5a('0x1c')](_0x5c2b16[_0x2b5a('0x2f')][_0x2b5a('0x1c')]);_0x4545d1[_0x2b5a('0x1a')]=qs['offset'](_0x5c2b16['query'][_0x2b5a('0x1a')]);}_0x4545d1[_0x2b5a('0x37')]=qs['sort'](_0x5c2b16[_0x2b5a('0x2f')][_0x2b5a('0x38')]);_0x4545d1[_0x2b5a('0x39')]=qs['filters'](_[_0x2b5a('0x3a')](_0x5c2b16[_0x2b5a('0x2f')],_0x1468f9[_0x2b5a('0x30')]),_0x8dd5b6);if(_0x5c2b16['query'][_0x2b5a('0x3b')]){_0x4545d1[_0x2b5a('0x39')]=_['merge'](_0x4545d1[_0x2b5a('0x39')],{'$or':_['map'](_0x8dd5b6,function(_0x197160){if(_0x197160[_0x2b5a('0x2b')]!==_0x2b5a('0x3c')){var _0x20a865={};_0x20a865[_0x197160[_0x2b5a('0x26')]]={'$like':'%'+_0x5c2b16[_0x2b5a('0x2f')]['filter']+'%'};return _0x20a865;}})});}_0x4545d1=_[_0x2b5a('0x3d')]({},_0x4545d1,_0x5c2b16[_0x2b5a('0x3e')]);var _0x56cb1b={'where':_0x4545d1[_0x2b5a('0x39')]};return db[_0x2b5a('0x28')][_0x2b5a('0x1b')](_0x56cb1b)[_0x2b5a('0x20')](function(_0x1ddbf9){_0x5cbdea[_0x2b5a('0x1b')]=_0x1ddbf9;if(_0x5c2b16[_0x2b5a('0x2f')]['includeAll']){_0x4545d1['include']=[{'all':!![]}];}return db[_0x2b5a('0x28')][_0x2b5a('0x3f')](_0x4545d1);})['then'](function(_0x4ea9de){_0x5cbdea[_0x2b5a('0x40')]=_0x4ea9de;return _0x5cbdea;})[_0x2b5a('0x20')](respondWithFilteredResult(_0x4a7d2c,_0x4545d1))[_0x2b5a('0x41')](handleError(_0x4a7d2c,null));};exports['show']=function(_0x5b185a,_0x1fe6ce){var _0x288614={'raw':!![],'where':{'id':_0x5b185a[_0x2b5a('0x42')]['id']}},_0x2c2cb6={};_0x2c2cb6[_0x2b5a('0x2c')]=_[_0x2b5a('0x2e')](db['Pause'][_0x2b5a('0x29')]);_0x2c2cb6[_0x2b5a('0x2f')]=_['keys'](_0x5b185a['query']);_0x2c2cb6['filters']=_[_0x2b5a('0x31')](_0x2c2cb6['model'],_0x2c2cb6['query']);_0x288614['attributes']=_[_0x2b5a('0x31')](_0x2c2cb6[_0x2b5a('0x2c')],qs[_0x2b5a('0x33')](_0x5b185a[_0x2b5a('0x2f')][_0x2b5a('0x33')]));_0x288614[_0x2b5a('0x32')]=_0x288614[_0x2b5a('0x32')][_0x2b5a('0x34')]?_0x288614['attributes']:_0x2c2cb6[_0x2b5a('0x2c')];if(_0x5b185a[_0x2b5a('0x2f')][_0x2b5a('0x43')]){_0x288614[_0x2b5a('0x44')]=[{'all':!![]}];}_0x288614=_['merge']({},_0x288614,_0x5b185a['options']);return db[_0x2b5a('0x28')][_0x2b5a('0x45')](_0x288614)[_0x2b5a('0x20')](handleEntityNotFound(_0x1fe6ce,null))[_0x2b5a('0x20')](respondWithResult(_0x1fe6ce,null))[_0x2b5a('0x41')](handleError(_0x1fe6ce,null));};exports[_0x2b5a('0x46')]=function(_0x3ae7cd,_0x12b632){return db[_0x2b5a('0x28')][_0x2b5a('0x46')](_0x3ae7cd[_0x2b5a('0x47')],{})[_0x2b5a('0x20')](function(_0x227121){var _0x5bb247=_0x3ae7cd[_0x2b5a('0x48')]['get']({'plain':!![]});if(!_0x5bb247)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5bb247[_0x2b5a('0x49')]===_0x2b5a('0x48')){var _0x1af0d1=_0x227121[_0x2b5a('0x21')]({'plain':!![]});var _0x1eb0fd=_0x2b5a('0x4a');return db[_0x2b5a('0x4b')][_0x2b5a('0x45')]({'where':{'name':_0x1eb0fd,'userProfileId':_0x5bb247[_0x2b5a('0x4c')]},'raw':!![]})[_0x2b5a('0x20')](function(_0x5f2f4f){if(_0x5f2f4f&&_0x5f2f4f[_0x2b5a('0x4d')]===0x0){return db[_0x2b5a('0x22')][_0x2b5a('0x46')]({'name':_0x1af0d1[_0x2b5a('0x26')],'resourceId':_0x1af0d1['id'],'type':_0x5f2f4f['name'],'sectionId':_0x5f2f4f['id']},{})[_0x2b5a('0x20')](function(){return _0x227121;});}else{return _0x227121;}})[_0x2b5a('0x41')](function(_0x43b799){logger['error'](_0x2b5a('0x4e'),_0x43b799);throw _0x43b799;});}return _0x227121;})[_0x2b5a('0x20')](respondWithResult(_0x12b632,0xc9))[_0x2b5a('0x41')](handleError(_0x12b632,null));};exports[_0x2b5a('0x1f')]=function(_0x95744d,_0x6e92b4){if(_0x95744d[_0x2b5a('0x47')]['id']){delete _0x95744d[_0x2b5a('0x47')]['id'];}return db[_0x2b5a('0x28')][_0x2b5a('0x45')]({'where':{'id':_0x95744d['params']['id']}})['then'](handleEntityNotFound(_0x6e92b4,null))['then'](saveUpdates(_0x95744d[_0x2b5a('0x47')],null))['then'](respondWithResult(_0x6e92b4,null))[_0x2b5a('0x41')](handleError(_0x6e92b4,null));};exports[_0x2b5a('0x23')]=function(_0x2dbf17,_0x2f1326){return db[_0x2b5a('0x28')][_0x2b5a('0x45')]({'where':{'id':_0x2dbf17['params']['id']}})['then'](handleEntityNotFound(_0x2f1326,null))[_0x2b5a('0x20')](removeEntity(_0x2f1326,null))['catch'](handleError(_0x2f1326,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index c7d3377..3e1bece 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 _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_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 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':'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(_0x2c00c2,_0x3922fc){var _0x12fbb9=function(_0x440196){while(--_0x440196){_0x2c00c2['push'](_0x2c00c2['shift']());}};_0x12fbb9(++_0x3922fc);}(_0x53ec,0x192));var _0xc53e=function(_0x1a2973,_0x1c87f2){_0x1a2973=_0x1a2973-0x0;var _0x318b2e=_0x53ec[_0x1a2973];return _0x318b2e;};'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 615982b..b60cad8 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x53df8f,_0x11fec8){var _0x32c6d8=function(_0x1d9351){while(--_0x1d9351){_0x53df8f['push'](_0x53df8f['shift']());}};_0x32c6d8(++_0x11fec8);}(_0x7a54,0x106));var _0x47a5=function(_0x151908,_0x389063){_0x151908=_0x151908-0x0;var _0x55470a=_0x7a54[_0x151908];return _0x55470a;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x271ce3,_0x2f4e48){var _0x29eee8=function(_0x1a8500){while(--_0x1a8500){_0x271ce3['push'](_0x271ce3['shift']());}};_0x29eee8(++_0x2f4e48);}(_0x7a54,0x106));var _0x47a5=function(_0x3eed28,_0x3e626c){_0x3eed28=_0x3eed28-0x0;var _0xcc5817=_0x7a54[_0x3eed28];return _0xcc5817;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 048ebe1..1163791 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 _0x7bae=['../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s','extname','now','upload','update','delete','exports','path','connect-timeout','Router','../../components/auth/service'];(function(_0x5b984b,_0x355e68){var _0x52e07d=function(_0x5b5064){while(--_0x5b5064){_0x5b984b['push'](_0x5b984b['shift']());}};_0x52e07d(++_0x355e68);}(_0x7bae,0x13b));var _0xe7ba=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x7bae[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe7ba('0x3'));var interaction=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var controller=require(_0xe7ba('0x6'));router[_0xe7ba('0x7')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x9')]);router[_0xe7ba('0x7')](_0xe7ba('0xa'),controller[_0xe7ba('0xb')]);router[_0xe7ba('0x7')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xd')]);router['get'](_0xe7ba('0xe'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xf')]);var upload=multer({'storage':multer[_0xe7ba('0x10')]({'destination':function(_0x15083a,_0x1672f0,_0x99a86f){_0x99a86f(null,path[_0xe7ba('0x11')](config[_0xe7ba('0x12')],'server/files/plugins'));},'filename':function(_0xf4fcb0,_0x588c8b,_0x602b1){_0x588c8b[_0xe7ba('0x13')]=_0x588c8b[_0xe7ba('0x13')][_0xe7ba('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x602b1(null,util[_0xe7ba('0x15')](_0xe7ba('0x16'),path['basename'](_0x588c8b['originalname'],path[_0xe7ba('0x17')](_0x588c8b[_0xe7ba('0x13')])),Date[_0xe7ba('0x18')](),path['extname'](_0x588c8b[_0xe7ba('0x13')])));}})});router['post']('/',upload['single']('file'),controller[_0xe7ba('0x19')]);router['post'](_0xe7ba('0xa'),controller['webhookPost']);router['put']('/:id',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x1a')]);router[_0xe7ba('0x1b')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller['delete']);module[_0xe7ba('0x1c')]=router; \ No newline at end of file +var _0x0a9a=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','webhookGet','/:id','show','download','root','originalname','replace','format','basename','extname','now','post','upload','/webhook','webhookPost','update','delete','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x4942f2,_0x455947){var _0x534e74=function(_0x4f796d){while(--_0x4f796d){_0x4942f2['push'](_0x4942f2['shift']());}};_0x534e74(++_0x455947);}(_0x0a9a,0x183));var _0xa0a9=function(_0x10bec7,_0x2a0d4e){_0x10bec7=_0x10bec7-0x0;var _0x2859dd=_0x0a9a[_0x10bec7];return _0x2859dd;};'use strict';var multer=require('multer');var util=require(_0xa0a9('0x0'));var path=require('path');var timeout=require(_0xa0a9('0x1'));var express=require(_0xa0a9('0x2'));var router=express[_0xa0a9('0x3')]();var fs_extra=require(_0xa0a9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var controller=require('./plugin.controller');router[_0xa0a9('0x7')]('/',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x9')]);router[_0xa0a9('0x7')]('/webhook',controller[_0xa0a9('0xa')]);router['get'](_0xa0a9('0xb'),auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xc')]);router[_0xa0a9('0x7')]('/:id/download',auth[_0xa0a9('0x8')](),controller[_0xa0a9('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5909cf,_0x13dc4a,_0x33f54f){_0x33f54f(null,path['join'](config[_0xa0a9('0xe')],'server/files/plugins'));},'filename':function(_0x1c39ff,_0x4b7913,_0xb87a94){_0x4b7913[_0xa0a9('0xf')]=_0x4b7913[_0xa0a9('0xf')][_0xa0a9('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xb87a94(null,util[_0xa0a9('0x11')]('%s-%s%s',path[_0xa0a9('0x12')](_0x4b7913[_0xa0a9('0xf')],path[_0xa0a9('0x13')](_0x4b7913[_0xa0a9('0xf')])),Date[_0xa0a9('0x14')](),path[_0xa0a9('0x13')](_0x4b7913['originalname'])));}})});router[_0xa0a9('0x15')]('/',upload['single']('file'),controller[_0xa0a9('0x16')]);router[_0xa0a9('0x15')](_0xa0a9('0x17'),controller[_0xa0a9('0x18')]);router['put'](_0xa0a9('0xb'),auth[_0xa0a9('0x8')](),controller[_0xa0a9('0x19')]);router[_0xa0a9('0x1a')](_0xa0a9('0xb'),auth[_0xa0a9('0x8')](),controller['delete']);module[_0xa0a9('0x1b')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 53a6330..c9654cd 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 _0x4abb=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','adminOnly','agentOnly','always','never','sequelize','STRING','ENUM','html','script'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x4abb,0xb6));var _0xb4ab=function(_0x2918f9,_0x54494c){_0x2918f9=_0x2918f9-0x0;var _0x457968=_0x4abb[_0x2918f9];return _0x457968;};'use strict';var Sequelize=require(_0xb4ab('0x0'));module['exports']={'name':{'type':Sequelize[_0xb4ab('0x1')]},'type':{'type':Sequelize[_0xb4ab('0x2')](_0xb4ab('0x3'),_0xb4ab('0x4'))},'description':{'type':Sequelize[_0xb4ab('0x5')]},'version':{'type':Sequelize[_0xb4ab('0x5')]},'path':{'type':Sequelize[_0xb4ab('0x1')],'comment':_0xb4ab('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xb4ab('0x2')](_0xb4ab('0x7'),_0xb4ab('0x8'),_0xb4ab('0x9'),_0xb4ab('0xa')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xb4ab('0x1')]},'agentUrl':{'type':Sequelize[_0xb4ab('0x1')]},'scriptName':{'type':Sequelize[_0xb4ab('0x1')]},'scriptPath':{'type':Sequelize[_0xb4ab('0x1')]}}; \ No newline at end of file +var _0x8d71=['script','TEXT','ENUM','agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING'];(function(_0x209db9,_0x36e516){var _0x36b16a=function(_0x55b56f){while(--_0x55b56f){_0x209db9['push'](_0x209db9['shift']());}};_0x36b16a(++_0x36e516);}(_0x8d71,0x1c0));var _0x18d7=function(_0x31beb3,_0x36d81a){_0x31beb3=_0x31beb3-0x0;var _0x311506=_0x8d71[_0x31beb3];return _0x311506;};'use strict';var Sequelize=require(_0x18d7('0x0'));module['exports']={'name':{'type':Sequelize[_0x18d7('0x1')]},'type':{'type':Sequelize['ENUM']('html',_0x18d7('0x2'))},'description':{'type':Sequelize[_0x18d7('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x18d7('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x18d7('0x4')]('adminOnly',_0x18d7('0x5'),'always',_0x18d7('0x6')),'defaultValue':_0x18d7('0x7'),'comment':_0x18d7('0x8')},'icon':{'type':Sequelize[_0x18d7('0x1')]},'adminUrl':{'type':Sequelize[_0x18d7('0x1')]},'agentUrl':{'type':Sequelize[_0x18d7('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 5fef175..eae8d9b 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 _0xbf3f=['nolimit','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','find','root','server/files/plugins','format','basename','path','createWriteStream','warning','code','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','join','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','update','delete','dirname','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','offset','limit','undefined','count','status','Content-Range','json','apply','save','then','Plugins','error','stack','name','send','map','Plugin','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x14342f,_0x1e978c){var _0x58bf4f=function(_0x34a303){while(--_0x34a303){_0x14342f['push'](_0x14342f['shift']());}};_0x58bf4f(++_0x1e978c);}(_0xbf3f,0x11e));var _0xfbf3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf3f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfbf3('0x0'));var rimraf=require(_0xfbf3('0x1'));var zipdir=require(_0xfbf3('0x2'));var jsonpatch=require(_0xfbf3('0x3'));var rp=require(_0xfbf3('0x4'));var moment=require(_0xfbf3('0x5'));var BPromise=require(_0xfbf3('0x6'));var Mustache=require('mustache');var util=require(_0xfbf3('0x7'));var path=require('path');var sox=require(_0xfbf3('0x8'));var csv=require(_0xfbf3('0x9'));var ejs=require(_0xfbf3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfbf3('0xb'));var squel=require(_0xfbf3('0xc'));var crypto=require(_0xfbf3('0xd'));var jsforce=require(_0xfbf3('0xe'));var deskjs=require(_0xfbf3('0xf'));var toCsv=require(_0xfbf3('0x9'));var querystring=require(_0xfbf3('0x10'));var Papa=require(_0xfbf3('0x11'));var extract=require(_0xfbf3('0x12'));var rimraf=require(_0xfbf3('0x1'));var archiver=require(_0xfbf3('0x13'));var Redis=require(_0xfbf3('0x14'));var authService=require(_0xfbf3('0x15'));var qs=require(_0xfbf3('0x16'));var as=require(_0xfbf3('0x17'));var hardwareService=require(_0xfbf3('0x18'));var logger=require('../../config/logger')(_0xfbf3('0x19'));var utils=require('../../config/utils');var config=require(_0xfbf3('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xfbf3('0x1b'))['db'];config[_0xfbf3('0x1c')]=_[_0xfbf3('0x1d')](config[_0xfbf3('0x1c')],{'host':_0xfbf3('0x1e'),'port':0x18eb});var socket=require(_0xfbf3('0x1f'))(new Redis(config[_0xfbf3('0x1c')]));require('./plugin.socket')[_0xfbf3('0x20')](socket);function respondWithStatusCode(_0x425b16,_0xa987fa){_0xa987fa=_0xa987fa||0xcc;return function(_0xb3e1e1){if(_0xb3e1e1){return _0x425b16[_0xfbf3('0x21')](_0xa987fa);}return _0x425b16['status'](_0xa987fa)[_0xfbf3('0x22')]();};}function respondWithResult(_0xcb2a9f,_0x32f6b2){_0x32f6b2=_0x32f6b2||0xc8;return function(_0x16b753){if(_0x16b753){return _0xcb2a9f['status'](_0x32f6b2)['json'](_0x16b753);}};}function respondWithFilteredResult(_0x4488b1,_0x5b1b00){return function(_0x520a81){if(_0x520a81){var _0x4fce85=typeof _0x5b1b00[_0xfbf3('0x23')]==='undefined'&&typeof _0x5b1b00[_0xfbf3('0x24')]===_0xfbf3('0x25');var _0xdf038d=_0x520a81[_0xfbf3('0x26')];var _0x5ebae0=_0x4fce85?0x0:_0x5b1b00[_0xfbf3('0x23')];var _0x5b7ffd=_0x4fce85?_0x520a81[_0xfbf3('0x26')]:_0x5b1b00[_0xfbf3('0x23')]+_0x5b1b00['limit'];var _0x5cb245;if(_0x5b7ffd>=_0xdf038d){_0x5b7ffd=_0xdf038d;_0x5cb245=0xc8;}else{_0x5cb245=0xce;}_0x4488b1[_0xfbf3('0x27')](_0x5cb245);return _0x4488b1['set'](_0xfbf3('0x28'),_0x5ebae0+'-'+_0x5b7ffd+'/'+_0xdf038d)[_0xfbf3('0x29')](_0x520a81);}return null;};}function patchUpdates(_0x452f7b){return function(_0x4b4ff6){try{jsonpatch[_0xfbf3('0x2a')](_0x4b4ff6,_0x452f7b,!![]);}catch(_0x4618a8){return BPromise['reject'](_0x4618a8);}return _0x4b4ff6[_0xfbf3('0x2b')]();};}function saveUpdates(_0x3104cf,_0x222914){return function(_0x4f2118){if(_0x4f2118){return _0x4f2118['update'](_0x3104cf)[_0xfbf3('0x2c')](function(_0x5b4af4){return _0x5b4af4;});}return null;};}function removeEntity(_0x29b757,_0x37438b){return function(_0xf3f444){if(_0xf3f444){return _0xf3f444['destroy']()[_0xfbf3('0x2c')](function(){var _0x4c25e8=_0xf3f444['get']({'plain':!![]});var _0x559322=_0xfbf3('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x559322,'resourceId':_0x4c25e8['id']}})[_0xfbf3('0x2c')](function(){return _0xf3f444;});})[_0xfbf3('0x2c')](function(){_0x29b757[_0xfbf3('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48ec92,_0x347740){return function(_0x361dc7){if(!_0x361dc7){_0x48ec92[_0xfbf3('0x21')](0x194);}return _0x361dc7;};}function handleError(_0x3ff55a,_0x5cca72){_0x5cca72=_0x5cca72||0x1f4;return function(_0x27bfd3){logger[_0xfbf3('0x2e')](_0x27bfd3[_0xfbf3('0x2f')]);if(_0x27bfd3[_0xfbf3('0x30')]){delete _0x27bfd3[_0xfbf3('0x30')];}_0x3ff55a['status'](_0x5cca72)[_0xfbf3('0x31')](_0x27bfd3);};}exports['index']=function(_0x41de63,_0x4e68bf){var _0x2fe4f6={},_0x562d1c={},_0x281f63={'count':0x0,'rows':[]};var _0x84bd4a=_[_0xfbf3('0x32')](db[_0xfbf3('0x33')][_0xfbf3('0x34')],function(_0xa6fb28){return{'name':_0xa6fb28[_0xfbf3('0x35')],'type':_0xa6fb28[_0xfbf3('0x36')][_0xfbf3('0x37')]};});_0x562d1c[_0xfbf3('0x38')]=_[_0xfbf3('0x32')](_0x84bd4a,_0xfbf3('0x30'));_0x562d1c[_0xfbf3('0x39')]=_['keys'](_0x41de63[_0xfbf3('0x39')]);_0x562d1c[_0xfbf3('0x3a')]=_[_0xfbf3('0x3b')](_0x562d1c['model'],_0x562d1c[_0xfbf3('0x39')]);_0x2fe4f6['attributes']=_[_0xfbf3('0x3b')](_0x562d1c[_0xfbf3('0x38')],qs[_0xfbf3('0x3c')](_0x41de63[_0xfbf3('0x39')][_0xfbf3('0x3c')]));_0x2fe4f6[_0xfbf3('0x3d')]=_0x2fe4f6[_0xfbf3('0x3d')][_0xfbf3('0x3e')]?_0x2fe4f6[_0xfbf3('0x3d')]:_0x562d1c[_0xfbf3('0x38')];if(!_0x41de63['query'][_0xfbf3('0x3f')](_0xfbf3('0x40'))){_0x2fe4f6[_0xfbf3('0x24')]=qs['limit'](_0x41de63[_0xfbf3('0x39')][_0xfbf3('0x24')]);_0x2fe4f6['offset']=qs[_0xfbf3('0x23')](_0x41de63[_0xfbf3('0x39')][_0xfbf3('0x23')]);}_0x2fe4f6[_0xfbf3('0x41')]=qs[_0xfbf3('0x42')](_0x41de63[_0xfbf3('0x39')][_0xfbf3('0x42')]);_0x2fe4f6[_0xfbf3('0x43')]=qs[_0xfbf3('0x3a')](_['pick'](_0x41de63['query'],_0x562d1c[_0xfbf3('0x3a')]),_0x84bd4a);if(_0x41de63['query']['filter']){_0x2fe4f6['where']=_[_0xfbf3('0x44')](_0x2fe4f6['where'],{'$or':_['map'](_0x84bd4a,function(_0x2a45c3){if(_0x2a45c3[_0xfbf3('0x36')]!==_0xfbf3('0x45')){var _0xac71f={};_0xac71f[_0x2a45c3[_0xfbf3('0x30')]]={'$like':'%'+_0x41de63[_0xfbf3('0x39')][_0xfbf3('0x46')]+'%'};return _0xac71f;}})});}_0x2fe4f6=_[_0xfbf3('0x44')]({},_0x2fe4f6,_0x41de63[_0xfbf3('0x47')]);var _0x1d3dc6={'where':_0x2fe4f6['where']};return db[_0xfbf3('0x33')]['count'](_0x1d3dc6)[_0xfbf3('0x2c')](function(_0x207ce1){_0x281f63[_0xfbf3('0x26')]=_0x207ce1;if(_0x41de63['query']['includeAll']){_0x2fe4f6[_0xfbf3('0x48')]=[{'all':!![]}];}return db[_0xfbf3('0x33')][_0xfbf3('0x49')](_0x2fe4f6);})['then'](function(_0x2feda3){_0x281f63[_0xfbf3('0x4a')]=_0x2feda3;return _0x281f63;})[_0xfbf3('0x2c')](respondWithFilteredResult(_0x4e68bf,_0x2fe4f6))[_0xfbf3('0x4b')](handleError(_0x4e68bf,null));};exports[_0xfbf3('0x4c')]=function(_0x5718c1,_0x512886){var _0x5880b7={'raw':!![],'where':{'id':_0x5718c1[_0xfbf3('0x4d')]['id']}},_0x5e5593={};_0x5e5593[_0xfbf3('0x38')]=_[_0xfbf3('0x4e')](db[_0xfbf3('0x33')][_0xfbf3('0x34')]);_0x5e5593[_0xfbf3('0x39')]=_['keys'](_0x5718c1[_0xfbf3('0x39')]);_0x5e5593[_0xfbf3('0x3a')]=_['intersection'](_0x5e5593[_0xfbf3('0x38')],_0x5e5593[_0xfbf3('0x39')]);_0x5880b7[_0xfbf3('0x3d')]=_[_0xfbf3('0x3b')](_0x5e5593[_0xfbf3('0x38')],qs[_0xfbf3('0x3c')](_0x5718c1['query'][_0xfbf3('0x3c')]));_0x5880b7[_0xfbf3('0x3d')]=_0x5880b7[_0xfbf3('0x3d')][_0xfbf3('0x3e')]?_0x5880b7[_0xfbf3('0x3d')]:_0x5e5593['model'];if(_0x5718c1[_0xfbf3('0x39')]['includeAll']){_0x5880b7[_0xfbf3('0x48')]=[{'all':!![]}];}_0x5880b7=_['merge']({},_0x5880b7,_0x5718c1[_0xfbf3('0x47')]);return db['Plugin'][_0xfbf3('0x4f')](_0x5880b7)[_0xfbf3('0x2c')](handleEntityNotFound(_0x512886,null))['then'](respondWithResult(_0x512886,null))[_0xfbf3('0x4b')](handleError(_0x512886,null));};exports['download']=function(_0xd6556b,_0x241d43,_0x184ed9){return db[_0xfbf3('0x33')]['find']({'where':{'id':_0xd6556b[_0xfbf3('0x4d')]['id']},'attributes':['name','path'],'raw':!![]})[_0xfbf3('0x2c')](handleEntityNotFound(_0x241d43,null))['then'](function(_0x377bf4){if(_0x377bf4){var _0x3f6b98=path['join'](config[_0xfbf3('0x50')],_0xfbf3('0x51'),util[_0xfbf3('0x52')]('%s.zip',path[_0xfbf3('0x53')](_0x377bf4[_0xfbf3('0x54')])));var _0x3be2f8=fs[_0xfbf3('0x55')](_0x3f6b98);var _0x4f2bdb=archiver('zip',{'zlib':{'level':0x9}});_0x4f2bdb['on'](_0xfbf3('0x56'),function(_0x4e89f0){if(_0x4e89f0[_0xfbf3('0x57')]===_0xfbf3('0x58')){logger['error'](_0x4e89f0);}else{throw new db[(_0xfbf3('0x59'))]['Error'](_0xfbf3('0x5a'));}});_0x4f2bdb['on'](_0xfbf3('0x2e'),function(_0x4e0906){throw new db[(_0xfbf3('0x59'))][(_0xfbf3('0x5b'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x4f2bdb[_0xfbf3('0x5c')](_0x3be2f8);_0x4f2bdb[_0xfbf3('0x5d')](_0xfbf3('0x5e'),{'cwd':path[_0xfbf3('0x5f')](config[_0xfbf3('0x50')],_0xfbf3('0x51'),path['dirname'](_0x377bf4[_0xfbf3('0x54')])),'ignore':[path[_0xfbf3('0x5f')](path[_0xfbf3('0x53')](_0x377bf4[_0xfbf3('0x54')]),_0xfbf3('0x60')),path[_0xfbf3('0x5f')](path['basename'](_0x377bf4['path']),_0xfbf3('0x61'))],'nodir':!![]})[_0xfbf3('0x62')]();_0x3be2f8['on'](_0xfbf3('0x63'),function(){if(!fs[_0xfbf3('0x64')](_0x3f6b98)){throw new db[(_0xfbf3('0x59'))][(_0xfbf3('0x5b'))](_0xfbf3('0x65'));}return _0x241d43[_0xfbf3('0x66')](_0x3f6b98,util[_0xfbf3('0x52')](_0xfbf3('0x67'),path[_0xfbf3('0x53')](_0x377bf4['path'])),function(_0x17e813){if(_0x17e813){throw new db[(_0xfbf3('0x59'))][(_0xfbf3('0x5b'))](_0xfbf3('0x68'));}fs[_0xfbf3('0x69')](_0x3f6b98);logger[_0xfbf3('0x6a')](_0xfbf3('0x6b'));logger['info'](_0xfbf3('0x6c'));});});}return null;})[_0xfbf3('0x4b')](handleError(_0x241d43,null));};exports[_0xfbf3('0x6d')]=function(_0x456ed7,_0x3218ba,_0x1b8037){var _0x58d072=path[_0xfbf3('0x53')](_0x456ed7[_0xfbf3('0x6e')][_0xfbf3('0x6f')],path[_0xfbf3('0x70')](_0x456ed7['file'][_0xfbf3('0x6f')]));var _0x4aee8c=path[_0xfbf3('0x5f')](config[_0xfbf3('0x50')],'server/files/plugins',_0x456ed7['file'][_0xfbf3('0x6f')]);var _0x17ed75=path['join'](config[_0xfbf3('0x50')],_0xfbf3('0x51'),_0x58d072);logger[_0xfbf3('0x6a')]('Plugin\x20upload\x20filepath:\x20%s',_0x4aee8c);logger[_0xfbf3('0x6a')](_0xfbf3('0x71'),_0x17ed75);try{fs[_0xfbf3('0x72')](_0x4aee8c,parseInt(_0xfbf3('0x73'),0x8));extract(_0x4aee8c,{'dir':_0x17ed75},function(_0x4db6d1){if(_0x4db6d1){logger['error'](_0x4db6d1);handleError(_0x4db6d1,!![]);};var _0x14763a=fs[_0xfbf3('0x74')](_0x17ed75);if(_0x14763a[_0xfbf3('0x3e')]>0x1){removeReferences(_0x4aee8c,_0x17ed75);logger[_0xfbf3('0x2e')](_0xfbf3('0x75'));return _0x1b8037(new Error('Invalid\x20plugin\x20structure'));}var _0x4d9921=fs[_0xfbf3('0x76')](path[_0xfbf3('0x5f')](_0x17ed75,_0x14763a[0x0]));if(_0x4d9921['isFile']()){removeReferences(_0x4aee8c,_0x17ed75);logger[_0xfbf3('0x2e')]('Invalid\x20plugin\x20structure');return _0x1b8037(new Error('Invalid\x20plugin\x20structure'));}if(_0x4d9921['isDirectory']()){var _0x303248=fs['readdirSync'](path[_0xfbf3('0x5f')](_0x17ed75,_0x14763a[0x0]));if(_0x303248['length']===0x0){removeReferences(_0x4aee8c,_0x17ed75);logger['error'](_0xfbf3('0x75'));return _0x1b8037(new Error(_0xfbf3('0x75')));}var _0x3c11cf=_0x303248[_0xfbf3('0x77')](function(_0x219f55){return _0x219f55===_0xfbf3('0x78');});if(!_0x3c11cf){return _0x1b8037(new Error(_0xfbf3('0x79')));}var _0x2dcb6d=fs[_0xfbf3('0x7a')](path[_0xfbf3('0x5f')](_0x17ed75,_0x14763a[0x0],_0xfbf3('0x78')));var _0x4bfc1f=JSON[_0xfbf3('0x7b')](_0x2dcb6d);if(_0xfbf3('0x25')==typeof _0x4bfc1f[_0xfbf3('0x30')]){return _0x1b8037(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xfbf3('0x25')==typeof _0x4bfc1f[_0xfbf3('0x36')]){return _0x1b8037(new Error(_0xfbf3('0x7c')));}if('undefined'==typeof _0x4bfc1f[_0xfbf3('0x7d')]){return _0x1b8037(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xfbf3('0x25')==typeof _0x4bfc1f[_0xfbf3('0x7e')]){return _0x1b8037(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x4bfc1f[_0xfbf3('0x36')]===_0xfbf3('0x7f')){if('undefined'==typeof _0x4bfc1f[_0xfbf3('0x7e')][_0xfbf3('0x80')]){return _0x1b8037(new Error(_0xfbf3('0x81')));}if(_0xfbf3('0x25')==typeof _0x4bfc1f[_0xfbf3('0x7e')][_0xfbf3('0x80')][_0xfbf3('0x82')]&&_0xfbf3('0x25')==typeof _0x4bfc1f['parameters'][_0xfbf3('0x80')][_0xfbf3('0x83')]){return _0x1b8037(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x4bfc1f[_0xfbf3('0x36')]===_0xfbf3('0x84')){if(_0xfbf3('0x25')==typeof _0x4bfc1f['parameters'][_0xfbf3('0x85')]){return _0x1b8037(new Error(_0xfbf3('0x86')));}if('undefined'==typeof _0x4bfc1f[_0xfbf3('0x7e')][_0xfbf3('0x87')]){return _0x1b8037(new Error(_0xfbf3('0x88')));}}else{return _0x1b8037(new Error(_0xfbf3('0x89')));}var _0x354e04=_0x4bfc1f[_0xfbf3('0x30')];var _0x50dc7f=_0x4bfc1f[_0xfbf3('0x8a')];var _0x5d47c3=_0x4bfc1f['type'];var _0x40d9cd=_0x4bfc1f[_0xfbf3('0x8b')]?_0x4bfc1f[_0xfbf3('0x8b')]:_0xfbf3('0x8c');var _0x488d30=_0x4bfc1f[_0xfbf3('0x8d')]?_0x4bfc1f[_0xfbf3('0x8d')]:_0xfbf3('0x8e');var _0x146ea1='';var _0x53801d='';var _0x1d1755='';var _0x1894fe='';var _0x5ccbb4=_0x4bfc1f[_0xfbf3('0x7d')];if(_0x5d47c3==='html'){if(_0xfbf3('0x25')!=typeof _0x4bfc1f[_0xfbf3('0x7e')][_0xfbf3('0x80')][_0xfbf3('0x82')]){var _0x34b9f3=_0x4bfc1f['parameters'][_0xfbf3('0x80')][_0xfbf3('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x34b9f3)){_0x146ea1=path[_0xfbf3('0x5f')](_0xfbf3('0x8f'),_0x58d072,_0x14763a[0x0],_0x34b9f3);}else{_0x146ea1=_0x34b9f3;}}else{logger[_0xfbf3('0x6a')](_0xfbf3('0x90'));}if(_0xfbf3('0x25')!=typeof _0x4bfc1f[_0xfbf3('0x7e')][_0xfbf3('0x80')][_0xfbf3('0x83')]){var _0x23e267=_0x4bfc1f['parameters']['views'][_0xfbf3('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xfbf3('0x91')](_0x23e267)){_0x53801d=path[_0xfbf3('0x5f')](_0xfbf3('0x8f'),_0x58d072,_0x14763a[0x0],_0x23e267);}else{_0x53801d=_0x23e267;}}else{logger['info'](_0xfbf3('0x92'));}}else if(_0x5d47c3==='script'){_0x1d1755=_0x4bfc1f[_0xfbf3('0x7e')][_0xfbf3('0x85')];_0x1894fe=_0x4bfc1f[_0xfbf3('0x7e')]['scriptPath'];if(_0xfbf3('0x25')!=typeof _0x4bfc1f[_0xfbf3('0x7e')][_0xfbf3('0x80')]){if(_0xfbf3('0x25')!=typeof _0x4bfc1f[_0xfbf3('0x7e')][_0xfbf3('0x80')][_0xfbf3('0x82')]){var _0x34b9f3=_0x4bfc1f[_0xfbf3('0x7e')]['views'][_0xfbf3('0x82')];if(!/^(f|ht)tps?:\/\//i['test'](_0x34b9f3)){_0x146ea1=path['join'](_0xfbf3('0x8f'),_0x58d072,_0x14763a[0x0],_0x34b9f3);}else{_0x146ea1=_0x34b9f3;}}if(_0xfbf3('0x25')!=typeof _0x4bfc1f[_0xfbf3('0x7e')]['views']['agent']){var _0x23e267=_0x4bfc1f[_0xfbf3('0x7e')][_0xfbf3('0x80')][_0xfbf3('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xfbf3('0x91')](_0x23e267)){_0x53801d=path[_0xfbf3('0x5f')](_0xfbf3('0x8f'),_0x58d072,_0x14763a[0x0],_0x23e267);}else{_0x53801d=_0x23e267;}}}}var _0x1a6af5={'name':_0x354e04,'description':_0x50dc7f,'path':path[_0xfbf3('0x5f')](_0x58d072,_0x14763a[0x0]),'type':_0x5d47c3,'sidebar':_0x40d9cd,'icon':_0x488d30,'adminUrl':_0x146ea1,'agentUrl':_0x53801d,'scriptName':_0x1d1755,'scriptPath':_0x1894fe,'version':_0x5ccbb4};removeReferences(_0x4aee8c,null);return db[_0xfbf3('0x33')][_0xfbf3('0x93')](_0x1a6af5)[_0xfbf3('0x2c')](function(_0x2d3a62){var _0x397f50={'role':_0x456ed7[_0xfbf3('0x94')][_0xfbf3('0x95')],'userProfileId':_0x456ed7[_0xfbf3('0x94')]['userProfileId']};if(!_0x397f50)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x397f50[_0xfbf3('0x95')]===_0xfbf3('0x96')){var _0x4c0026=_0x2d3a62['get']({'plain':!![]});return db[_0xfbf3('0x97')][_0xfbf3('0x4f')]({'where':{'name':_0xfbf3('0x2d'),'userProfileId':_0x397f50['userProfileId']},'raw':!![]})[_0xfbf3('0x2c')](function(_0x3658c8){if(_0x3658c8&&_0x3658c8['autoAssociation']===0x0){return db[_0xfbf3('0x98')][_0xfbf3('0x93')]({'name':_0x4c0026['name'],'resourceId':_0x4c0026['id'],'type':_0x3658c8['name'],'sectionId':_0x3658c8['id']},{})[_0xfbf3('0x2c')](function(){return _0x2d3a62;});}else{return _0x2d3a62;}})[_0xfbf3('0x4b')](function(_0xc439e0){logger[_0xfbf3('0x2e')](_0xfbf3('0x99'),_0xc439e0);throw _0xc439e0;});}return _0x2d3a62;})[_0xfbf3('0x2c')](respondWithResult(_0x3218ba,null))[_0xfbf3('0x4b')](handleError(_0x3218ba,null));}});}catch(_0x10dcf8){_0x3218ba[_0xfbf3('0x27')](0x1f4)['send'](_0x10dcf8);}};function removeReferences(_0x466b53,_0x53f30c){try{if(_0x466b53){fs[_0xfbf3('0x69')](_0x466b53);logger['info']('Zip\x20archive\x20removed');}if(_0x53f30c){rimraf(_0x53f30c,function(){});logger[_0xfbf3('0x6a')](_0xfbf3('0x9a'));}}catch(_0x110041){logger[_0xfbf3('0x2e')](_0x110041);}}exports[_0xfbf3('0x9b')]=function(_0xd4cd0e,_0x21bd40,_0x1fb1e9){return db[_0xfbf3('0x33')][_0xfbf3('0x4f')]({'where':{'id':_0xd4cd0e['params']['id']}})['then'](handleEntityNotFound(_0x21bd40,null))[_0xfbf3('0x2c')](saveUpdates(_0xd4cd0e[_0xfbf3('0x94')],null))[_0xfbf3('0x2c')](respondWithResult(_0x21bd40,null))[_0xfbf3('0x4b')](handleError(_0x21bd40,null));};exports[_0xfbf3('0x9c')]=function(_0x52bfc5,_0x481c09,_0x453bb4){return db['Plugin'][_0xfbf3('0x4f')]({'where':{'id':_0x52bfc5[_0xfbf3('0x4d')]['id']}})[_0xfbf3('0x2c')](function(_0x39c726){if(_0x39c726){return _0x39c726['destroy']();}})['then'](function(_0x116d70){rimraf(path[_0xfbf3('0x5f')](config[_0xfbf3('0x50')],_0xfbf3('0x51'),path[_0xfbf3('0x9d')](_0x116d70[_0xfbf3('0x54')])),function(){});return _0x116d70;})['then'](handleEntityNotFound(_0x481c09,null))[_0xfbf3('0x2c')](respondWithStatusCode(_0x481c09,null))[_0xfbf3('0x4b')](handleError(_0x481c09,null));};exports[_0xfbf3('0x9e')]=function(_0x219731,_0x2b78ba,_0xf26b88){return BPromise[_0xfbf3('0x9f')]()[_0xfbf3('0x2c')](function(){if(!_0x219731[_0xfbf3('0x39')][_0xfbf3('0x54')]){throw new Error(_0xfbf3('0xa0'));}if(!_0x219731[_0xfbf3('0x39')][_0xfbf3('0xa1')]){throw new Error(_0xfbf3('0xa2'));}var _0x23d8f3=_0x219731[_0xfbf3('0x39')][_0xfbf3('0xa3')]?_0x219731[_0xfbf3('0x39')]['hostname']+':'+_0x219731[_0xfbf3('0x39')][_0xfbf3('0xa1')]:_0xfbf3('0xa4')+_0x219731['query'][_0xfbf3('0xa1')];var _0x4febf5=_0x219731[_0xfbf3('0x39')][_0xfbf3('0x29')]?_0x219731[_0xfbf3('0x39')][_0xfbf3('0x29')]:!![];var _0x36ac03=_0x219731[_0xfbf3('0x39')][_0xfbf3('0xa5')]?_0x219731[_0xfbf3('0x39')]['encoding']:null;var _0x44f827={'method':_0x219731[_0xfbf3('0xa6')],'uri':util['format'](_0xfbf3('0xa7'),_0x23d8f3,_0x219731[_0xfbf3('0x39')][_0xfbf3('0x54')]),'json':_0x4febf5,'resolveWithFullResponse':!![],'encoding':_0x36ac03,'qs':_0x219731['query']};if(_0x219731[_0xfbf3('0xa8')]){_0x44f827[_0xfbf3('0xa8')]=_0x219731['headers'];if(_0x44f827['headers'][_0xfbf3('0xa9')]){delete _0x44f827['headers'][_0xfbf3('0xa9')];}}if(_0x44f827[_0xfbf3('0xa8')][_0xfbf3('0xaa')]){delete _0x44f827[_0xfbf3('0xa8')][_0xfbf3('0xaa')];}return rp(_0x44f827);})[_0xfbf3('0x2c')](function(_0x41bd80){if(_0x41bd80){_0x2b78ba[_0xfbf3('0xab')](_0x41bd80[_0xfbf3('0xa8')]);logger['info'](_0x41bd80[_0xfbf3('0x94')]);if(_[_0xfbf3('0xac')](_0x219731[_0xfbf3('0x39')][_0xfbf3('0x54')],_0xfbf3('0x66'))&&_0x41bd80['statusCode']==0x1f4){return _0x2b78ba[_0xfbf3('0x21')](_0x41bd80['statusCode']);}else{return _0x2b78ba[_0xfbf3('0x27')](_0x41bd80[_0xfbf3('0xad')])[_0xfbf3('0x31')](_0x41bd80['body']);}}else{return _0x2b78ba['sendStatus'](0xc8);}})['catch'](handleError(_0x2b78ba,null));};exports[_0xfbf3('0xae')]=function(_0x56f522,_0x20e955,_0x1c81ec){return BPromise[_0xfbf3('0x9f')]()[_0xfbf3('0x2c')](function(){if(!_0x56f522['query'][_0xfbf3('0x54')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x56f522[_0xfbf3('0x39')][_0xfbf3('0xa1')]){throw new Error(_0xfbf3('0xa2'));}var _0x595fed=_0x56f522[_0xfbf3('0x39')][_0xfbf3('0xa3')]?_0x56f522[_0xfbf3('0x39')]['hostname']+':'+_0x56f522[_0xfbf3('0x39')]['port']:'http://localhost:'+_0x56f522[_0xfbf3('0x39')][_0xfbf3('0xa1')];var _0x30075e=_0x56f522[_0xfbf3('0x39')][_0xfbf3('0x29')]?_0x56f522[_0xfbf3('0x39')][_0xfbf3('0x29')]:!![];var _0x1f5c93=_0x56f522[_0xfbf3('0x39')][_0xfbf3('0xa5')]?_0x56f522['query'][_0xfbf3('0xa5')]:null;var _0x2d6165={'method':_0x56f522[_0xfbf3('0xa6')],'uri':util[_0xfbf3('0x52')]('%s%s',_0x595fed,_0x56f522['query'][_0xfbf3('0x54')]),'json':_0x30075e,'resolveWithFullResponse':!![],'encoding':_0x1f5c93,'body':_0x56f522[_0xfbf3('0x94')]};if(_0x56f522['headers']){_0x2d6165[_0xfbf3('0xa8')]=_0x56f522[_0xfbf3('0xa8')];if(_0x2d6165[_0xfbf3('0xa8')][_0xfbf3('0xa9')]){delete _0x2d6165[_0xfbf3('0xa8')][_0xfbf3('0xa9')];}}if(_0x2d6165[_0xfbf3('0xa8')][_0xfbf3('0xaa')]){delete _0x2d6165[_0xfbf3('0xa8')]['content-type'];}return rp(_0x2d6165);})['then'](function(_0x3d2b2e){if(_0x3d2b2e){_0x20e955[_0xfbf3('0xab')](_0x3d2b2e['headers']);logger[_0xfbf3('0x6a')](_0x3d2b2e[_0xfbf3('0x94')]);return _0x20e955[_0xfbf3('0x27')](_0x3d2b2e[_0xfbf3('0xad')])[_0xfbf3('0x31')](_0x3d2b2e[_0xfbf3('0x94')]);}else{return _0x20e955[_0xfbf3('0x21')](0xc8);}})[_0xfbf3('0x4b')](handleError(_0x20e955,null));}; \ No newline at end of file +var _0xf168=['sidebar','always','icon','icon-apps','version','html','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Plugins','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','statusCode','webhookPost','method','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','archiver','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./plugin.socket','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','Plugin','include','findAll','rows','catch','show','rawAttributes','includeAll','find','download','params','join','root','server/files/plugins','%s.zip','basename','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','glob','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','upload','file','extname','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','Invalid\x20manifest:\x20views\x20missing','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing'];(function(_0x2ffc49,_0x38b12e){var _0x2e6532=function(_0x9365c7){while(--_0x9365c7){_0x2ffc49['push'](_0x2ffc49['shift']());}};_0x2e6532(++_0x38b12e);}(_0xf168,0xd4));var _0x8f16=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0xf168[_0x587fb5];return _0x551105;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f16('0x0'));var zipdir=require(_0x8f16('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8f16('0x2'));var moment=require('moment');var BPromise=require(_0x8f16('0x3'));var Mustache=require(_0x8f16('0x4'));var util=require(_0x8f16('0x5'));var path=require(_0x8f16('0x6'));var sox=require('sox');var csv=require(_0x8f16('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f16('0x8'));var _=require('lodash');var squel=require(_0x8f16('0x9'));var crypto=require(_0x8f16('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8f16('0xb'));var toCsv=require(_0x8f16('0x7'));var querystring=require(_0x8f16('0xc'));var Papa=require(_0x8f16('0xd'));var extract=require('extract-zip');var rimraf=require('rimraf');var archiver=require(_0x8f16('0xe'));var Redis=require('ioredis');var authService=require(_0x8f16('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8f16('0x10'));var hardwareService=require(_0x8f16('0x11'));var logger=require(_0x8f16('0x12'))('api');var utils=require(_0x8f16('0x13'));var config=require(_0x8f16('0x14'));var licenseUtil=require(_0x8f16('0x15'));var db=require(_0x8f16('0x16'))['db'];config['redis']=_[_0x8f16('0x17')](config[_0x8f16('0x18')],{'host':_0x8f16('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8f16('0x1a'))['register'](socket);function respondWithStatusCode(_0x782dcf,_0x284e06){_0x284e06=_0x284e06||0xcc;return function(_0x1cf692){if(_0x1cf692){return _0x782dcf[_0x8f16('0x1b')](_0x284e06);}return _0x782dcf[_0x8f16('0x1c')](_0x284e06)[_0x8f16('0x1d')]();};}function respondWithResult(_0x380fa0,_0x20c833){_0x20c833=_0x20c833||0xc8;return function(_0x1c3622){if(_0x1c3622){return _0x380fa0['status'](_0x20c833)[_0x8f16('0x1e')](_0x1c3622);}};}function respondWithFilteredResult(_0x5e9fac,_0x375702){return function(_0x2b3e1c){if(_0x2b3e1c){var _0x429e57=typeof _0x375702[_0x8f16('0x1f')]==='undefined'&&typeof _0x375702[_0x8f16('0x20')]===_0x8f16('0x21');var _0x568030=_0x2b3e1c[_0x8f16('0x22')];var _0x1e6b7c=_0x429e57?0x0:_0x375702['offset'];var _0x4fe8fb=_0x429e57?_0x2b3e1c[_0x8f16('0x22')]:_0x375702['offset']+_0x375702[_0x8f16('0x20')];var _0x13d24d;if(_0x4fe8fb>=_0x568030){_0x4fe8fb=_0x568030;_0x13d24d=0xc8;}else{_0x13d24d=0xce;}_0x5e9fac[_0x8f16('0x1c')](_0x13d24d);return _0x5e9fac[_0x8f16('0x23')](_0x8f16('0x24'),_0x1e6b7c+'-'+_0x4fe8fb+'/'+_0x568030)[_0x8f16('0x1e')](_0x2b3e1c);}return null;};}function patchUpdates(_0x18cbe1){return function(_0x1daded){try{jsonpatch[_0x8f16('0x25')](_0x1daded,_0x18cbe1,!![]);}catch(_0x13b306){return BPromise[_0x8f16('0x26')](_0x13b306);}return _0x1daded[_0x8f16('0x27')]();};}function saveUpdates(_0xf15feb,_0x3c4238){return function(_0x21e827){if(_0x21e827){return _0x21e827[_0x8f16('0x28')](_0xf15feb)[_0x8f16('0x29')](function(_0x52fc4c){return _0x52fc4c;});}return null;};}function removeEntity(_0x244ab3,_0x623948){return function(_0x41324f){if(_0x41324f){return _0x41324f[_0x8f16('0x2a')]()[_0x8f16('0x29')](function(){var _0x26277a=_0x41324f[_0x8f16('0x2b')]({'plain':!![]});var _0x43f802='Plugins';return db[_0x8f16('0x2c')]['destroy']({'where':{'type':_0x43f802,'resourceId':_0x26277a['id']}})['then'](function(){return _0x41324f;});})['then'](function(){_0x244ab3[_0x8f16('0x1c')](0xcc)[_0x8f16('0x1d')]();});}};}function handleEntityNotFound(_0x20f7c2,_0x4f7234){return function(_0x11d9fa){if(!_0x11d9fa){_0x20f7c2[_0x8f16('0x1b')](0x194);}return _0x11d9fa;};}function handleError(_0x33e74a,_0x23bb3c){_0x23bb3c=_0x23bb3c||0x1f4;return function(_0x2b7665){logger[_0x8f16('0x2d')](_0x2b7665[_0x8f16('0x2e')]);if(_0x2b7665[_0x8f16('0x2f')]){delete _0x2b7665[_0x8f16('0x2f')];}_0x33e74a[_0x8f16('0x1c')](_0x23bb3c)['send'](_0x2b7665);};}exports[_0x8f16('0x30')]=function(_0x309193,_0x4337bd){var _0x942bbc={},_0x46fbeb={},_0xbd691e={'count':0x0,'rows':[]};var _0x29ed0c=_['map'](db['Plugin']['rawAttributes'],function(_0x2c61f9){return{'name':_0x2c61f9[_0x8f16('0x31')],'type':_0x2c61f9[_0x8f16('0x32')]['key']};});_0x46fbeb[_0x8f16('0x33')]=_[_0x8f16('0x34')](_0x29ed0c,_0x8f16('0x2f'));_0x46fbeb[_0x8f16('0x35')]=_[_0x8f16('0x36')](_0x309193['query']);_0x46fbeb['filters']=_[_0x8f16('0x37')](_0x46fbeb[_0x8f16('0x33')],_0x46fbeb[_0x8f16('0x35')]);_0x942bbc[_0x8f16('0x38')]=_['intersection'](_0x46fbeb['model'],qs[_0x8f16('0x39')](_0x309193[_0x8f16('0x35')][_0x8f16('0x39')]));_0x942bbc[_0x8f16('0x38')]=_0x942bbc['attributes'][_0x8f16('0x3a')]?_0x942bbc[_0x8f16('0x38')]:_0x46fbeb['model'];if(!_0x309193[_0x8f16('0x35')][_0x8f16('0x3b')](_0x8f16('0x3c'))){_0x942bbc[_0x8f16('0x20')]=qs[_0x8f16('0x20')](_0x309193[_0x8f16('0x35')][_0x8f16('0x20')]);_0x942bbc[_0x8f16('0x1f')]=qs[_0x8f16('0x1f')](_0x309193[_0x8f16('0x35')]['offset']);}_0x942bbc['order']=qs[_0x8f16('0x3d')](_0x309193[_0x8f16('0x35')][_0x8f16('0x3d')]);_0x942bbc[_0x8f16('0x3e')]=qs[_0x8f16('0x3f')](_[_0x8f16('0x40')](_0x309193[_0x8f16('0x35')],_0x46fbeb['filters']),_0x29ed0c);if(_0x309193[_0x8f16('0x35')][_0x8f16('0x41')]){_0x942bbc[_0x8f16('0x3e')]=_[_0x8f16('0x42')](_0x942bbc[_0x8f16('0x3e')],{'$or':_[_0x8f16('0x34')](_0x29ed0c,function(_0x2bc700){if(_0x2bc700[_0x8f16('0x32')]!==_0x8f16('0x43')){var _0x40074f={};_0x40074f[_0x2bc700[_0x8f16('0x2f')]]={'$like':'%'+_0x309193[_0x8f16('0x35')][_0x8f16('0x41')]+'%'};return _0x40074f;}})});}_0x942bbc=_[_0x8f16('0x42')]({},_0x942bbc,_0x309193['options']);var _0x1b3812={'where':_0x942bbc[_0x8f16('0x3e')]};return db[_0x8f16('0x44')][_0x8f16('0x22')](_0x1b3812)[_0x8f16('0x29')](function(_0x26bc65){_0xbd691e['count']=_0x26bc65;if(_0x309193[_0x8f16('0x35')]['includeAll']){_0x942bbc[_0x8f16('0x45')]=[{'all':!![]}];}return db[_0x8f16('0x44')][_0x8f16('0x46')](_0x942bbc);})[_0x8f16('0x29')](function(_0x2415c7){_0xbd691e[_0x8f16('0x47')]=_0x2415c7;return _0xbd691e;})['then'](respondWithFilteredResult(_0x4337bd,_0x942bbc))[_0x8f16('0x48')](handleError(_0x4337bd,null));};exports[_0x8f16('0x49')]=function(_0x324885,_0x28bc45){var _0x56a3e8={'raw':!![],'where':{'id':_0x324885['params']['id']}},_0x3d3baf={};_0x3d3baf[_0x8f16('0x33')]=_[_0x8f16('0x36')](db[_0x8f16('0x44')][_0x8f16('0x4a')]);_0x3d3baf[_0x8f16('0x35')]=_[_0x8f16('0x36')](_0x324885[_0x8f16('0x35')]);_0x3d3baf[_0x8f16('0x3f')]=_[_0x8f16('0x37')](_0x3d3baf[_0x8f16('0x33')],_0x3d3baf['query']);_0x56a3e8[_0x8f16('0x38')]=_[_0x8f16('0x37')](_0x3d3baf[_0x8f16('0x33')],qs[_0x8f16('0x39')](_0x324885[_0x8f16('0x35')]['fields']));_0x56a3e8[_0x8f16('0x38')]=_0x56a3e8['attributes']['length']?_0x56a3e8[_0x8f16('0x38')]:_0x3d3baf['model'];if(_0x324885[_0x8f16('0x35')][_0x8f16('0x4b')]){_0x56a3e8[_0x8f16('0x45')]=[{'all':!![]}];}_0x56a3e8=_[_0x8f16('0x42')]({},_0x56a3e8,_0x324885['options']);return db[_0x8f16('0x44')][_0x8f16('0x4c')](_0x56a3e8)[_0x8f16('0x29')](handleEntityNotFound(_0x28bc45,null))[_0x8f16('0x29')](respondWithResult(_0x28bc45,null))['catch'](handleError(_0x28bc45,null));};exports[_0x8f16('0x4d')]=function(_0x26beb9,_0x355961,_0x1bfaac){return db[_0x8f16('0x44')][_0x8f16('0x4c')]({'where':{'id':_0x26beb9[_0x8f16('0x4e')]['id']},'attributes':[_0x8f16('0x2f'),_0x8f16('0x6')],'raw':!![]})[_0x8f16('0x29')](handleEntityNotFound(_0x355961,null))[_0x8f16('0x29')](function(_0x137a02){if(_0x137a02){var _0x27f525=path[_0x8f16('0x4f')](config[_0x8f16('0x50')],_0x8f16('0x51'),util['format'](_0x8f16('0x52'),path[_0x8f16('0x53')](_0x137a02[_0x8f16('0x6')])));var _0x3206fd=fs['createWriteStream'](_0x27f525);var _0x34f75f=archiver(_0x8f16('0x54'),{'zlib':{'level':0x9}});_0x34f75f['on'](_0x8f16('0x55'),function(_0x57a81a){if(_0x57a81a[_0x8f16('0x56')]===_0x8f16('0x57')){logger[_0x8f16('0x2d')](_0x57a81a);}else{throw new db['Sequelize'][(_0x8f16('0x58'))](_0x8f16('0x59'));}});_0x34f75f['on']('error',function(_0x90702a){throw new db[(_0x8f16('0x5a'))][(_0x8f16('0x58'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x34f75f['pipe'](_0x3206fd);_0x34f75f[_0x8f16('0x5b')](_0x8f16('0x5c'),{'cwd':path['join'](config[_0x8f16('0x50')],_0x8f16('0x51'),path[_0x8f16('0x5d')](_0x137a02[_0x8f16('0x6')])),'ignore':[path[_0x8f16('0x4f')](path[_0x8f16('0x53')](_0x137a02[_0x8f16('0x6')]),_0x8f16('0x5e')),path['join'](path[_0x8f16('0x53')](_0x137a02[_0x8f16('0x6')]),_0x8f16('0x5f'))],'nodir':!![]})[_0x8f16('0x60')]();_0x3206fd['on'](_0x8f16('0x61'),function(){if(!fs[_0x8f16('0x62')](_0x27f525)){throw new db['Sequelize'][(_0x8f16('0x58'))](_0x8f16('0x63'));}return _0x355961[_0x8f16('0x4d')](_0x27f525,util['format'](_0x8f16('0x52'),path[_0x8f16('0x53')](_0x137a02[_0x8f16('0x6')])),function(_0x4d7345){if(_0x4d7345){throw new db[(_0x8f16('0x5a'))][(_0x8f16('0x58'))](_0x8f16('0x64'));}fs[_0x8f16('0x65')](_0x27f525);logger['info']('Download\x20completed');logger[_0x8f16('0x66')]('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x355961,null));};exports[_0x8f16('0x67')]=function(_0x9f2211,_0x443284,_0x58ea9b){var _0x5893a2=path[_0x8f16('0x53')](_0x9f2211[_0x8f16('0x68')]['filename'],path[_0x8f16('0x69')](_0x9f2211[_0x8f16('0x68')][_0x8f16('0x6a')]));var _0x56838f=path['join'](config[_0x8f16('0x50')],_0x8f16('0x51'),_0x9f2211[_0x8f16('0x68')][_0x8f16('0x6a')]);var _0x20dc48=path[_0x8f16('0x4f')](config[_0x8f16('0x50')],_0x8f16('0x51'),_0x5893a2);logger[_0x8f16('0x66')](_0x8f16('0x6b'),_0x56838f);logger[_0x8f16('0x66')](_0x8f16('0x6c'),_0x20dc48);try{fs['chmodSync'](_0x56838f,parseInt(_0x8f16('0x6d'),0x8));extract(_0x56838f,{'dir':_0x20dc48},function(_0x5cafb4){if(_0x5cafb4){logger['error'](_0x5cafb4);handleError(_0x5cafb4,!![]);};var _0x3785a9=fs[_0x8f16('0x6e')](_0x20dc48);if(_0x3785a9[_0x8f16('0x3a')]>0x1){removeReferences(_0x56838f,_0x20dc48);logger[_0x8f16('0x2d')]('Invalid\x20plugin\x20structure');return _0x58ea9b(new Error(_0x8f16('0x6f')));}var _0x2dfa4b=fs[_0x8f16('0x70')](path[_0x8f16('0x4f')](_0x20dc48,_0x3785a9[0x0]));if(_0x2dfa4b[_0x8f16('0x71')]()){removeReferences(_0x56838f,_0x20dc48);logger[_0x8f16('0x2d')](_0x8f16('0x6f'));return _0x58ea9b(new Error(_0x8f16('0x6f')));}if(_0x2dfa4b[_0x8f16('0x72')]()){var _0x4e5ce2=fs[_0x8f16('0x6e')](path[_0x8f16('0x4f')](_0x20dc48,_0x3785a9[0x0]));if(_0x4e5ce2[_0x8f16('0x3a')]===0x0){removeReferences(_0x56838f,_0x20dc48);logger[_0x8f16('0x2d')]('Invalid\x20plugin\x20structure');return _0x58ea9b(new Error('Invalid\x20plugin\x20structure'));}var _0x4c07f6=_0x4e5ce2[_0x8f16('0x73')](function(_0x43eeb9){return _0x43eeb9==='manifest.json';});if(!_0x4c07f6){return _0x58ea9b(new Error(_0x8f16('0x74')));}var _0x1a8172=fs[_0x8f16('0x75')](path[_0x8f16('0x4f')](_0x20dc48,_0x3785a9[0x0],_0x8f16('0x76')));var _0x176765=JSON[_0x8f16('0x77')](_0x1a8172);if('undefined'==typeof _0x176765[_0x8f16('0x2f')]){return _0x58ea9b(new Error(_0x8f16('0x78')));}if(_0x8f16('0x21')==typeof _0x176765[_0x8f16('0x32')]){return _0x58ea9b(new Error(_0x8f16('0x79')));}if(_0x8f16('0x21')==typeof _0x176765['version']){return _0x58ea9b(new Error(_0x8f16('0x7a')));}if(_0x8f16('0x21')==typeof _0x176765[_0x8f16('0x7b')]){return _0x58ea9b(new Error(_0x8f16('0x7c')));}if(_0x176765[_0x8f16('0x32')]==='html'){if(_0x8f16('0x21')==typeof _0x176765[_0x8f16('0x7b')]['views']){return _0x58ea9b(new Error(_0x8f16('0x7d')));}if(_0x8f16('0x21')==typeof _0x176765[_0x8f16('0x7b')][_0x8f16('0x7e')]['admin']&&_0x8f16('0x21')==typeof _0x176765[_0x8f16('0x7b')][_0x8f16('0x7e')][_0x8f16('0x7f')]){return _0x58ea9b(new Error(_0x8f16('0x80')));}}else if(_0x176765[_0x8f16('0x32')]===_0x8f16('0x81')){if('undefined'==typeof _0x176765[_0x8f16('0x7b')][_0x8f16('0x82')]){return _0x58ea9b(new Error(_0x8f16('0x83')));}if(_0x8f16('0x21')==typeof _0x176765[_0x8f16('0x7b')][_0x8f16('0x84')]){return _0x58ea9b(new Error(_0x8f16('0x85')));}}else{return _0x58ea9b(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x5e843e=_0x176765['name'];var _0x1a2623=_0x176765['description'];var _0x470f24=_0x176765[_0x8f16('0x32')];var _0x4e39b9=_0x176765[_0x8f16('0x86')]?_0x176765['sidebar']:_0x8f16('0x87');var _0x365ec7=_0x176765[_0x8f16('0x88')]?_0x176765['icon']:_0x8f16('0x89');var _0x213d91='';var _0x311231='';var _0x8b5873='';var _0x359126='';var _0x35369b=_0x176765[_0x8f16('0x8a')];if(_0x470f24===_0x8f16('0x8b')){if(_0x8f16('0x21')!=typeof _0x176765['parameters'][_0x8f16('0x7e')]['admin']){var _0x3b0a9a=_0x176765[_0x8f16('0x7b')][_0x8f16('0x7e')][_0x8f16('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x8f16('0x8d')](_0x3b0a9a)){_0x213d91=path[_0x8f16('0x4f')](_0x8f16('0x8e'),_0x5893a2,_0x3785a9[0x0],_0x3b0a9a);}else{_0x213d91=_0x3b0a9a;}}else{logger['info'](_0x8f16('0x8f'));}if(_0x8f16('0x21')!=typeof _0x176765[_0x8f16('0x7b')][_0x8f16('0x7e')]['agent']){var _0x4550ad=_0x176765[_0x8f16('0x7b')]['views'][_0x8f16('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x8f16('0x8d')](_0x4550ad)){_0x311231=path['join']('plugins',_0x5893a2,_0x3785a9[0x0],_0x4550ad);}else{_0x311231=_0x4550ad;}}else{logger[_0x8f16('0x66')](_0x8f16('0x90'));}}else if(_0x470f24===_0x8f16('0x81')){_0x8b5873=_0x176765[_0x8f16('0x7b')][_0x8f16('0x82')];_0x359126=_0x176765['parameters'][_0x8f16('0x84')];if(_0x8f16('0x21')!=typeof _0x176765['parameters'][_0x8f16('0x7e')]){if(_0x8f16('0x21')!=typeof _0x176765[_0x8f16('0x7b')][_0x8f16('0x7e')]['admin']){var _0x3b0a9a=_0x176765[_0x8f16('0x7b')]['views'][_0x8f16('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x8f16('0x8d')](_0x3b0a9a)){_0x213d91=path['join']('plugins',_0x5893a2,_0x3785a9[0x0],_0x3b0a9a);}else{_0x213d91=_0x3b0a9a;}}if(_0x8f16('0x21')!=typeof _0x176765[_0x8f16('0x7b')]['views'][_0x8f16('0x7f')]){var _0x4550ad=_0x176765[_0x8f16('0x7b')][_0x8f16('0x7e')][_0x8f16('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x8f16('0x8d')](_0x4550ad)){_0x311231=path['join'](_0x8f16('0x8e'),_0x5893a2,_0x3785a9[0x0],_0x4550ad);}else{_0x311231=_0x4550ad;}}}}var _0x2961bf={'name':_0x5e843e,'description':_0x1a2623,'path':path['join'](_0x5893a2,_0x3785a9[0x0]),'type':_0x470f24,'sidebar':_0x4e39b9,'icon':_0x365ec7,'adminUrl':_0x213d91,'agentUrl':_0x311231,'scriptName':_0x8b5873,'scriptPath':_0x359126,'version':_0x35369b};removeReferences(_0x56838f,null);return db[_0x8f16('0x44')][_0x8f16('0x91')](_0x2961bf)[_0x8f16('0x29')](function(_0x188891){var _0x105858={'role':_0x9f2211[_0x8f16('0x92')][_0x8f16('0x93')],'userProfileId':_0x9f2211['body'][_0x8f16('0x94')]};if(!_0x105858)throw new Error(_0x8f16('0x95'));if(_0x105858[_0x8f16('0x93')]===_0x8f16('0x96')){var _0x15d275=_0x188891['get']({'plain':!![]});return db[_0x8f16('0x97')][_0x8f16('0x4c')]({'where':{'name':_0x8f16('0x98'),'userProfileId':_0x105858[_0x8f16('0x94')]},'raw':!![]})['then'](function(_0x4787b9){if(_0x4787b9&&_0x4787b9['autoAssociation']===0x0){return db[_0x8f16('0x2c')][_0x8f16('0x91')]({'name':_0x15d275['name'],'resourceId':_0x15d275['id'],'type':_0x4787b9[_0x8f16('0x2f')],'sectionId':_0x4787b9['id']},{})[_0x8f16('0x29')](function(){return _0x188891;});}else{return _0x188891;}})['catch'](function(_0x3a68e5){logger[_0x8f16('0x2d')](_0x8f16('0x99'),_0x3a68e5);throw _0x3a68e5;});}return _0x188891;})[_0x8f16('0x29')](respondWithResult(_0x443284,null))['catch'](handleError(_0x443284,null));}});}catch(_0x5aa026){_0x443284[_0x8f16('0x1c')](0x1f4)[_0x8f16('0x9a')](_0x5aa026);}};function removeReferences(_0x1b1d7a,_0x52c853){try{if(_0x1b1d7a){fs['unlinkSync'](_0x1b1d7a);logger[_0x8f16('0x66')](_0x8f16('0x9b'));}if(_0x52c853){rimraf(_0x52c853,function(){});logger[_0x8f16('0x66')](_0x8f16('0x9c'));}}catch(_0x42260e){logger[_0x8f16('0x2d')](_0x42260e);}}exports[_0x8f16('0x28')]=function(_0x35bc98,_0x5bade9,_0x535724){return db[_0x8f16('0x44')][_0x8f16('0x4c')]({'where':{'id':_0x35bc98[_0x8f16('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5bade9,null))['then'](saveUpdates(_0x35bc98[_0x8f16('0x92')],null))[_0x8f16('0x29')](respondWithResult(_0x5bade9,null))[_0x8f16('0x48')](handleError(_0x5bade9,null));};exports[_0x8f16('0x9d')]=function(_0x134acc,_0x58c548,_0x31219d){return db[_0x8f16('0x44')]['find']({'where':{'id':_0x134acc[_0x8f16('0x4e')]['id']}})[_0x8f16('0x29')](function(_0x127715){if(_0x127715){return _0x127715['destroy']();}})[_0x8f16('0x29')](function(_0x50a495){rimraf(path[_0x8f16('0x4f')](config['root'],_0x8f16('0x51'),path[_0x8f16('0x5d')](_0x50a495[_0x8f16('0x6')])),function(){});return _0x50a495;})['then'](handleEntityNotFound(_0x58c548,null))[_0x8f16('0x29')](respondWithStatusCode(_0x58c548,null))[_0x8f16('0x48')](handleError(_0x58c548,null));};exports[_0x8f16('0x9e')]=function(_0x253b8b,_0x8c7b86,_0x3f4fbd){return BPromise[_0x8f16('0x9f')]()[_0x8f16('0x29')](function(){if(!_0x253b8b[_0x8f16('0x35')][_0x8f16('0x6')]){throw new Error(_0x8f16('0xa0'));}if(!_0x253b8b[_0x8f16('0x35')][_0x8f16('0xa1')]){throw new Error(_0x8f16('0xa2'));}var _0x509630=_0x253b8b[_0x8f16('0x35')][_0x8f16('0xa3')]?_0x253b8b[_0x8f16('0x35')]['hostname']+':'+_0x253b8b[_0x8f16('0x35')][_0x8f16('0xa1')]:_0x8f16('0xa4')+_0x253b8b[_0x8f16('0x35')][_0x8f16('0xa1')];var _0x142724=_0x253b8b[_0x8f16('0x35')]['json']?_0x253b8b['query'][_0x8f16('0x1e')]:!![];var _0x5d07c1=_0x253b8b['query'][_0x8f16('0xa5')]?_0x253b8b['query']['encoding']:null;var _0x51c3bd={'method':_0x253b8b['method'],'uri':util['format'](_0x8f16('0xa6'),_0x509630,_0x253b8b[_0x8f16('0x35')]['path']),'json':_0x142724,'resolveWithFullResponse':!![],'encoding':_0x5d07c1,'qs':_0x253b8b[_0x8f16('0x35')]};if(_0x253b8b['headers']){_0x51c3bd[_0x8f16('0xa7')]=_0x253b8b[_0x8f16('0xa7')];if(_0x51c3bd['headers'][_0x8f16('0xa8')]){delete _0x51c3bd[_0x8f16('0xa7')][_0x8f16('0xa8')];}}if(_0x51c3bd[_0x8f16('0xa7')][_0x8f16('0xa9')]){delete _0x51c3bd[_0x8f16('0xa7')][_0x8f16('0xa9')];}return rp(_0x51c3bd);})[_0x8f16('0x29')](function(_0x153dfd){if(_0x153dfd){_0x8c7b86[_0x8f16('0x23')](_0x153dfd[_0x8f16('0xa7')]);logger[_0x8f16('0x66')](_0x153dfd['body']);if(_['endsWith'](_0x253b8b[_0x8f16('0x35')][_0x8f16('0x6')],_0x8f16('0x4d'))&&_0x153dfd[_0x8f16('0xaa')]==0x1f4){return _0x8c7b86[_0x8f16('0x1b')](_0x153dfd[_0x8f16('0xaa')]);}else{return _0x8c7b86[_0x8f16('0x1c')](_0x153dfd[_0x8f16('0xaa')])['send'](_0x153dfd[_0x8f16('0x92')]);}}else{return _0x8c7b86[_0x8f16('0x1b')](0xc8);}})['catch'](handleError(_0x8c7b86,null));};exports[_0x8f16('0xab')]=function(_0x10086e,_0x357bc2,_0x3e5045){return BPromise['resolve']()['then'](function(){if(!_0x10086e[_0x8f16('0x35')][_0x8f16('0x6')]){throw new Error(_0x8f16('0xa0'));}if(!_0x10086e[_0x8f16('0x35')][_0x8f16('0xa1')]){throw new Error(_0x8f16('0xa2'));}var _0x2e165d=_0x10086e[_0x8f16('0x35')][_0x8f16('0xa3')]?_0x10086e[_0x8f16('0x35')][_0x8f16('0xa3')]+':'+_0x10086e['query']['port']:_0x8f16('0xa4')+_0x10086e[_0x8f16('0x35')]['port'];var _0xb3f204=_0x10086e[_0x8f16('0x35')]['json']?_0x10086e[_0x8f16('0x35')]['json']:!![];var _0x3d0971=_0x10086e[_0x8f16('0x35')]['encoding']?_0x10086e[_0x8f16('0x35')]['encoding']:null;var _0x328c25={'method':_0x10086e[_0x8f16('0xac')],'uri':util['format'](_0x8f16('0xa6'),_0x2e165d,_0x10086e[_0x8f16('0x35')][_0x8f16('0x6')]),'json':_0xb3f204,'resolveWithFullResponse':!![],'encoding':_0x3d0971,'body':_0x10086e[_0x8f16('0x92')]};if(_0x10086e[_0x8f16('0xa7')]){_0x328c25[_0x8f16('0xa7')]=_0x10086e[_0x8f16('0xa7')];if(_0x328c25[_0x8f16('0xa7')]['content-length']){delete _0x328c25[_0x8f16('0xa7')]['content-length'];}}if(_0x328c25[_0x8f16('0xa7')][_0x8f16('0xa9')]){delete _0x328c25[_0x8f16('0xa7')]['content-type'];}return rp(_0x328c25);})[_0x8f16('0x29')](function(_0x461ed6){if(_0x461ed6){_0x357bc2['set'](_0x461ed6[_0x8f16('0xa7')]);logger[_0x8f16('0x66')](_0x461ed6[_0x8f16('0x92')]);return _0x357bc2[_0x8f16('0x1c')](_0x461ed6[_0x8f16('0xaa')])[_0x8f16('0x9a')](_0x461ed6[_0x8f16('0x92')]);}else{return _0x357bc2['sendStatus'](0xc8);}})['catch'](handleError(_0x357bc2,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index c4e93b8..84b0db6 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 _0x0f9f=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','Plugin','setMaxListeners','save','update'];(function(_0x2736dc,_0x5f5ca6){var _0x314e56=function(_0x54b759){while(--_0x54b759){_0x2736dc['push'](_0x2736dc['shift']());}};_0x314e56(++_0x5f5ca6);}(_0x0f9f,0xae));var _0xf0f9=function(_0x1ba9bd,_0x3299e8){_0x1ba9bd=_0x1ba9bd-0x0;var _0x19aae2=_0x0f9f[_0x1ba9bd];return _0x19aae2;};'use strict';var EventEmitter=require(_0xf0f9('0x0'));var Plugin=require(_0xf0f9('0x1'))['db'][_0xf0f9('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xf0f9('0x3')](0x0);var events={'afterCreate':_0xf0f9('0x4'),'afterUpdate':_0xf0f9('0x5'),'afterDestroy':_0xf0f9('0x6')};function emitEvent(_0x672fab){return function(_0x1d7a76,_0x1b4d6c,_0x4ed571){PluginEvents['emit'](_0x672fab+':'+_0x1d7a76['id'],_0x1d7a76);PluginEvents[_0xf0f9('0x7')](_0x672fab,_0x1d7a76);_0x4ed571(null);};}for(var e in events){if(events[_0xf0f9('0x8')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xf0f9('0x9')]=PluginEvents; \ No newline at end of file +var _0x8110=['update','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x38e8c1,_0xa58479){var _0x2dd9f8=function(_0xcf827a){while(--_0xcf827a){_0x38e8c1['push'](_0x38e8c1['shift']());}};_0x2dd9f8(++_0xa58479);}(_0x8110,0x185));var _0x0811=function(_0x4b9330,_0x3ec031){_0x4b9330=_0x4b9330-0x0;var _0x160c39=_0x8110[_0x4b9330];return _0x160c39;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x0811('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0811('0x1'),'afterDestroy':'remove'};function emitEvent(_0x16057f){return function(_0x266310,_0x424170,_0x419fd7){PluginEvents[_0x0811('0x2')](_0x16057f+':'+_0x266310['id'],_0x266310);PluginEvents['emit'](_0x16057f,_0x266310);_0x419fd7(null);};}for(var e in events){if(events[_0x0811('0x3')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x0811('0x4')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 9eeaf2b..2d62833 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 _0xe321=['./plugin.attributes','exports','Plugin','plugins','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x18867f,_0x39fe2f){var _0x282c81=function(_0x15a9ad){while(--_0x15a9ad){_0x18867f['push'](_0x18867f['shift']());}};_0x282c81(++_0x39fe2f);}(_0xe321,0x100));var _0x1e32=function(_0x4877e4,_0x1bb839){_0x4877e4=_0x4877e4-0x0;var _0x1dbe1a=_0xe321[_0x4877e4];return _0x1dbe1a;};'use strict';var _=require(_0x1e32('0x0'));var util=require(_0x1e32('0x1'));var logger=require(_0x1e32('0x2'))(_0x1e32('0x3'));var moment=require('moment');var BPromise=require(_0x1e32('0x4'));var rp=require(_0x1e32('0x5'));var fs=require('fs');var path=require(_0x1e32('0x6'));var rimraf=require('rimraf');var config=require(_0x1e32('0x7'));var attributes=require(_0x1e32('0x8'));module[_0x1e32('0x9')]=function(_0x64724d,_0x2de8b6){return _0x64724d['define'](_0x1e32('0xa'),attributes,{'tableName':_0x1e32('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1744=['plugins','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','define','Plugin'];(function(_0x421bbf,_0x257f48){var _0x39fa06=function(_0x533cec){while(--_0x533cec){_0x421bbf['push'](_0x421bbf['shift']());}};_0x39fa06(++_0x257f48);}(_0x1744,0xa1));var _0x4174=function(_0x336e1b,_0x3ec3a4){_0x336e1b=_0x336e1b-0x0;var _0x1d6189=_0x1744[_0x336e1b];return _0x1d6189;};'use strict';var _=require(_0x4174('0x0'));var util=require('util');var logger=require(_0x4174('0x1'))(_0x4174('0x2'));var moment=require(_0x4174('0x3'));var BPromise=require('bluebird');var rp=require(_0x4174('0x4'));var fs=require('fs');var path=require(_0x4174('0x5'));var rimraf=require('rimraf');var config=require(_0x4174('0x6'));var attributes=require('./plugin.attributes');module['exports']=function(_0x155dde,_0x1eb6f0){return _0x155dde[_0x4174('0x7')](_0x4174('0x8'),attributes,{'tableName':_0x4174('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 2f8a26e..c0ef3be 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 _0xa811=['then','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','./plugin.socket','register','request','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','CreatePlugin','Plugin','create','body','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa811,0x1de));var _0x1a81=function(_0x3d0d33,_0xd3c0d4){_0x3d0d33=_0x3d0d33-0x0;var _0x27f88=_0xa811[_0x3d0d33];return _0x27f88;};'use strict';var _=require(_0x1a81('0x0'));var util=require(_0x1a81('0x1'));var moment=require(_0x1a81('0x2'));var BPromise=require(_0x1a81('0x3'));var rs=require(_0x1a81('0x4'));var fs=require('fs');var Redis=require(_0x1a81('0x5'));var db=require(_0x1a81('0x6'))['db'];var utils=require(_0x1a81('0x7'));var logger=require(_0x1a81('0x8'))(_0x1a81('0x9'));var config=require(_0x1a81('0xa'));var jayson=require(_0x1a81('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0x1a81('0xc')]=_['defaults'](config[_0x1a81('0xc')],{'host':_0x1a81('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a81('0xc')]));require(_0x1a81('0xe'))[_0x1a81('0xf')](socket);function respondWithRpcPromise(_0x55c28d,_0x1ed250,_0x2696b6){return new BPromise(function(_0x33445b,_0x4a43eb){return client[_0x1a81('0x10')](_0x55c28d,_0x2696b6)['then'](function(_0x218fcf){logger[_0x1a81('0x11')](_0x1a81('0x12'),_0x1ed250,'request\x20sent');logger[_0x1a81('0x13')](_0x1a81('0x14'),_0x1ed250,_0x1a81('0x15'),JSON['stringify'](_0x218fcf));if(_0x218fcf['error']){if(_0x218fcf['error'][_0x1a81('0x16')]===0x1f4){logger['error'](_0x1a81('0x12'),_0x1ed250,_0x218fcf[_0x1a81('0x17')]['message']);return _0x4a43eb(_0x218fcf[_0x1a81('0x17')][_0x1a81('0x18')]);}logger[_0x1a81('0x17')](_0x1a81('0x12'),_0x1ed250,_0x218fcf[_0x1a81('0x17')][_0x1a81('0x18')]);return _0x33445b(_0x218fcf['error']['message']);}else{logger['info']('Plugin,\x20%s,\x20%s',_0x1ed250,'request\x20sent');_0x33445b(_0x218fcf[_0x1a81('0x19')][_0x1a81('0x18')]);}})[_0x1a81('0x1a')](function(_0x35f9f7){logger[_0x1a81('0x17')](_0x1a81('0x12'),_0x1ed250,_0x35f9f7);_0x4a43eb(_0x35f9f7);});});}exports[_0x1a81('0x1b')]=function(_0x535da4){var _0xe57b46=this;return new Promise(function(_0x1f5a47,_0x4f7c99){return db[_0x1a81('0x1c')][_0x1a81('0x1d')](_0x535da4[_0x1a81('0x1e')],{'raw':_0x535da4[_0x1a81('0x1f')]?_0x535da4[_0x1a81('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x1a81('0x20')](function(_0x1ecfa2){logger[_0x1a81('0x11')](_0x1a81('0x1b'),_0x535da4);logger[_0x1a81('0x13')](_0x1a81('0x1b'),_0x535da4,JSON[_0x1a81('0x21')](_0x1ecfa2));_0x1f5a47(_0x1ecfa2);})[_0x1a81('0x1a')](function(_0xd425ce){logger[_0x1a81('0x17')](_0x1a81('0x1b'),_0xd425ce[_0x1a81('0x18')],_0x535da4);_0x4f7c99(_0xe57b46[_0x1a81('0x17')](0x1f4,_0xd425ce[_0x1a81('0x18')]));});});}; \ No newline at end of file +var _0x8262=['message','catch','CreatePlugin','create','body','options','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x40bdc0,_0x3abab9){var _0x53c64e=function(_0x5c5fb3){while(--_0x5c5fb3){_0x40bdc0['push'](_0x40bdc0['shift']());}};_0x53c64e(++_0x3abab9);}(_0x8262,0x9d));var _0x2826=function(_0x3f1215,_0x6ce23c){_0x3f1215=_0x3f1215-0x0;var _0x26136c=_0x8262[_0x3f1215];return _0x26136c;};'use strict';var _=require(_0x2826('0x0'));var util=require(_0x2826('0x1'));var moment=require(_0x2826('0x2'));var BPromise=require(_0x2826('0x3'));var rs=require(_0x2826('0x4'));var fs=require('fs');var Redis=require(_0x2826('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2826('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2826('0x7'));var client=jayson[_0x2826('0x8')][_0x2826('0x9')]({'port':0x232a});config[_0x2826('0xa')]=_[_0x2826('0xb')](config[_0x2826('0xa')],{'host':_0x2826('0xc'),'port':0x18eb});var socket=require(_0x2826('0xd'))(new Redis(config[_0x2826('0xa')]));require('./plugin.socket')[_0x2826('0xe')](socket);function respondWithRpcPromise(_0x2bda0a,_0x1ca0e0,_0x557d41){return new BPromise(function(_0x2a5f71,_0x415c8b){return client[_0x2826('0xf')](_0x2bda0a,_0x557d41)[_0x2826('0x10')](function(_0x23f048){logger[_0x2826('0x11')](_0x2826('0x12'),_0x1ca0e0,'request\x20sent');logger['debug'](_0x2826('0x13'),_0x1ca0e0,_0x2826('0x14'),JSON[_0x2826('0x15')](_0x23f048));if(_0x23f048[_0x2826('0x16')]){if(_0x23f048[_0x2826('0x16')]['code']===0x1f4){logger[_0x2826('0x16')]('Plugin,\x20%s,\x20%s',_0x1ca0e0,_0x23f048['error'][_0x2826('0x17')]);return _0x415c8b(_0x23f048[_0x2826('0x16')][_0x2826('0x17')]);}logger[_0x2826('0x16')](_0x2826('0x12'),_0x1ca0e0,_0x23f048['error'][_0x2826('0x17')]);return _0x2a5f71(_0x23f048[_0x2826('0x16')][_0x2826('0x17')]);}else{logger[_0x2826('0x11')](_0x2826('0x12'),_0x1ca0e0,_0x2826('0x14'));_0x2a5f71(_0x23f048['result'][_0x2826('0x17')]);}})[_0x2826('0x18')](function(_0x21ee84){logger[_0x2826('0x16')](_0x2826('0x12'),_0x1ca0e0,_0x21ee84);_0x415c8b(_0x21ee84);});});}exports[_0x2826('0x19')]=function(_0x4f8aa2){var _0x131285=this;return new Promise(function(_0x388e3b,_0x749a7d){return db['Plugin'][_0x2826('0x1a')](_0x4f8aa2[_0x2826('0x1b')],{'raw':_0x4f8aa2[_0x2826('0x1c')]?_0x4f8aa2[_0x2826('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x2826('0x10')](function(_0x48bbb3){logger['info'](_0x2826('0x19'),_0x4f8aa2);logger[_0x2826('0x1d')](_0x2826('0x19'),_0x4f8aa2,JSON[_0x2826('0x15')](_0x48bbb3));_0x388e3b(_0x48bbb3);})['catch'](function(_0x399a22){logger[_0x2826('0x16')](_0x2826('0x19'),_0x399a22[_0x2826('0x17')],_0x4f8aa2);_0x749a7d(_0x131285[_0x2826('0x16')](0x1f4,_0x399a22['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 4f1e6df..0bf467a 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 _0xa33e=['./plugin.events','remove','update','removeListener','register','length','plugin:'];(function(_0x1f6310,_0x588981){var _0x65dd66=function(_0x593527){while(--_0x593527){_0x1f6310['push'](_0x1f6310['shift']());}};_0x65dd66(++_0x588981);}(_0xa33e,0x1b2));var _0xea33=function(_0x5d1b98,_0x178cb2){_0x5d1b98=_0x5d1b98-0x0;var _0x521582=_0xa33e[_0x5d1b98];return _0x521582;};'use strict';var PluginEvents=require(_0xea33('0x0'));var events=['save',_0xea33('0x1'),_0xea33('0x2')];function createListener(_0x519ab0,_0x8d3eb1){return function(_0x16b323){_0x8d3eb1['emit'](_0x519ab0,_0x16b323);};}function removeListener(_0x5ee1c5,_0x43c267){return function(){PluginEvents[_0xea33('0x3')](_0x5ee1c5,_0x43c267);};}exports[_0xea33('0x4')]=function(_0xae1294){for(var _0x2d8c7c=0x0,_0x461e1d=events[_0xea33('0x5')];_0x2d8c7c<_0x461e1d;_0x2d8c7c++){var _0x34b680=events[_0x2d8c7c];var _0x2afb01=createListener(_0xea33('0x6')+_0x34b680,_0xae1294);PluginEvents['on'](_0x34b680,_0x2afb01);}}; \ No newline at end of file +var _0x1adb=['register','plugin:','save','remove','update','emit','removeListener'];(function(_0x551852,_0x4d01e2){var _0x3e6131=function(_0x3a4726){while(--_0x3a4726){_0x551852['push'](_0x551852['shift']());}};_0x3e6131(++_0x4d01e2);}(_0x1adb,0x87));var _0xb1ad=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x1adb[_0xfae23b];return _0x200640;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xb1ad('0x0'),_0xb1ad('0x1'),_0xb1ad('0x2')];function createListener(_0x3a9e34,_0x186977){return function(_0x1d53fb){_0x186977[_0xb1ad('0x3')](_0x3a9e34,_0x1d53fb);};}function removeListener(_0x277b0b,_0x111be2){return function(){PluginEvents[_0xb1ad('0x4')](_0x277b0b,_0x111be2);};}exports[_0xb1ad('0x5')]=function(_0x963880){for(var _0x3f13cd=0x0,_0x18a28f=events['length'];_0x3f13cd<_0x18a28f;_0x3f13cd++){var _0x1db099=events[_0x3f13cd];var _0x54eb1f=createListener(_0xb1ad('0x6')+_0x1db099,_0x963880);PluginEvents['on'](_0x1db099,_0x54eb1f);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 55a5390..474d09f 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(_0x4b9b28,_0x49c88a){var _0x3243f2=function(_0x46cc7b){while(--_0x46cc7b){_0x4b9b28['push'](_0x4b9b28['shift']());}};_0x3243f2(++_0x49c88a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x258fdf,_0x3f9ee5){var _0x53c37e=function(_0x2ece57){while(--_0x2ece57){_0x258fdf['push'](_0x258fdf['shift']());}};_0x53c37e(++_0x3f9ee5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 6a7d037..33d5923 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 _0x2750=['exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','list','then','motion2','catch','body','script','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','stop','hasOwnProperty','params','Unknown\x20status','destroy','lodash','../../config/logger','api','path','child_process'];(function(_0x28d8d1,_0x1cd375){var _0x4eb781=function(_0x17f639){while(--_0x17f639){_0x28d8d1['push'](_0x28d8d1['shift']());}};_0x4eb781(++_0x1cd375);}(_0x2750,0x13b));var _0x0275=function(_0x543a91,_0x236841){_0x543a91=_0x543a91-0x0;var _0x51fd2d=_0x2750[_0x543a91];return _0x51fd2d;};'use strict';var _=require(_0x0275('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var path=require(_0x0275('0x3'));var exec=require(_0x0275('0x4'))[_0x0275('0x5')];var BPromise=require(_0x0275('0x6'));function handleEntityNotFound(_0x20273d,_0x4960){return function(_0x3d0c9c){if(!_0x3d0c9c){_0x20273d[_0x0275('0x7')](0x194);;}return _0x3d0c9c;};}function respondWithResult(_0x5953f9,_0x3f645f){_0x3f645f=_0x3f645f||0xc8;return function(_0x2421fd){if(_0x2421fd){return _0x5953f9[_0x0275('0x8')](_0x3f645f)[_0x0275('0x9')](_0x2421fd);}return null;};}function handleError(_0x4dffd1,_0x1f7c4a){_0x1f7c4a=_0x1f7c4a||0x1f4;return function(_0x30632d){logger[_0x0275('0xa')](_0x30632d['stack']);if(_0x30632d['name']){delete _0x30632d[_0x0275('0xb')];}_0x4dffd1['status'](_0x1f7c4a)[_0x0275('0xc')](_0x30632d);};}function execChildProcess(){return new BPromise(function(_0x377087,_0x14f68c){exec(_0x0275('0xd'),function(_0x14bc3e,_0x5ae208,_0x2e8723){logger[_0x0275('0xe')](_0x5ae208);logger[_0x0275('0xe')](_0x2e8723);if(_0x14bc3e){logger['error'](_0x14bc3e);return _0x14f68c(_0x14bc3e);}return _0x377087(_0x5ae208);});});}exports['index']=function(_0x292f93,_0x395398){return pm2[_0x0275('0xf')]()[_0x0275('0x10')](function(_0x28827b){if(_0x28827b){var _0x36921c=_['reject'](_0x28827b,function(_0x3e0791){return _0x3e0791[_0x0275('0xb')]==='express'||_0x3e0791[_0x0275('0xb')]===_0x0275('0x11');});return{'rows':_0x36921c,'count':_0x36921c['length']};}return null;})[_0x0275('0x10')](respondWithResult(_0x395398,null))[_0x0275('0x12')](handleError(_0x395398,null));};exports['show']=function(_0x5e7466,_0x56e719){return pm2['describe'](_0x5e7466['params']['id'])[_0x0275('0x10')](respondWithResult(_0x56e719,null))[_0x0275('0x10')](handleEntityNotFound(_0x56e719,null))[_0x0275('0x12')](handleError(_0x56e719,null));};exports['create']=function(_0x7075c9,_0x30730a){if(_0x7075c9[_0x0275('0x13')]['name']&&_0x7075c9[_0x0275('0x13')][_0x0275('0x14')]){var _0x575786=path['join'](__dirname,_0x0275('0x15'),_0x7075c9[_0x0275('0x13')][_0x0275('0x14')]);var _0x592a53=process[_0x0275('0x16')]();process['chdir'](path[_0x0275('0x17')](_0x575786));return execChildProcess()['then'](function(_0x26f2c2){process[_0x0275('0x18')](_0x592a53);return pm2['start']({'name':_0x7075c9[_0x0275('0x13')][_0x0275('0xb')],'script':_0x575786});})[_0x0275('0x10')](function(_0x52946b){pm2[_0x0275('0x19')]();return _0x52946b[0x0];})[_0x0275('0x10')](respondWithResult(_0x30730a,0xc9))[_0x0275('0x12')](handleError(_0x30730a,null));}else{return _0x30730a[_0x0275('0x8')](0x1f4)[_0x0275('0xc')]({'message':_0x0275('0x1a')});}};exports['update']=function(_0x35343c,_0x14d7d8){if(_0x35343c[_0x0275('0x13')]['id']){delete _0x35343c[_0x0275('0x13')]['id'];}var _0x4689a3={'online':'restart','stopped':_0x0275('0x1b')};if(_0x4689a3[_0x0275('0x1c')](_0x35343c[_0x0275('0x13')][_0x0275('0x8')])){return pm2[_0x4689a3[_0x35343c[_0x0275('0x13')]['status']]](_0x35343c[_0x0275('0x1d')]['id'])[_0x0275('0x10')](respondWithResult(_0x14d7d8,0xc8))[_0x0275('0x12')](handleError(_0x14d7d8,null));}else{return _0x14d7d8['status'](0x1f4)['send']({'message':_0x0275('0x1e')});}};exports[_0x0275('0x1f')]=function(_0x5dc2bc,_0x7eff96){if(_0x5dc2bc[_0x0275('0x13')]['id']){delete _0x5dc2bc[_0x0275('0x13')]['id'];}if(_0x5dc2bc[_0x0275('0x1d')]['id']){return pm2['delete'](_0x5dc2bc[_0x0275('0x1d')]['id'])[_0x0275('0x10')](function(_0x3bba47){pm2[_0x0275('0x19')]();return _0x3bba47[0x0];})['then'](respondWithResult(_0x7eff96,null))[_0x0275('0x12')](handleError(_0x7eff96,null));}else{return _0x7eff96['status'](0x1f4)[_0x0275('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xf72b=['hasOwnProperty','Unknown\x20status','destroy','params','delete','lodash','../../config/logger','path','child_process','bluebird','sendStatus','status','json','stack','name','npm\x20install','info','index','then','express','motion2','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','dirname','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0xf72b,0x1d9));var _0xbf72=function(_0x2bd4f4,_0x562504){_0x2bd4f4=_0x2bd4f4-0x0;var _0x984cb7=_0xf72b[_0x2bd4f4];return _0x984cb7;};'use strict';var _=require(_0xbf72('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xbf72('0x1'))('api');var path=require(_0xbf72('0x2'));var exec=require(_0xbf72('0x3'))['exec'];var BPromise=require(_0xbf72('0x4'));function handleEntityNotFound(_0x550a9e,_0x37afc8){return function(_0x3d3a6f){if(!_0x3d3a6f){_0x550a9e[_0xbf72('0x5')](0x194);;}return _0x3d3a6f;};}function respondWithResult(_0x2b8440,_0x5ee060){_0x5ee060=_0x5ee060||0xc8;return function(_0x41c11d){if(_0x41c11d){return _0x2b8440[_0xbf72('0x6')](_0x5ee060)[_0xbf72('0x7')](_0x41c11d);}return null;};}function handleError(_0xd0402c,_0xdd6177){_0xdd6177=_0xdd6177||0x1f4;return function(_0x1b6d38){logger['error'](_0x1b6d38[_0xbf72('0x8')]);if(_0x1b6d38['name']){delete _0x1b6d38[_0xbf72('0x9')];}_0xd0402c[_0xbf72('0x6')](_0xdd6177)['send'](_0x1b6d38);};}function execChildProcess(){return new BPromise(function(_0xaec095,_0x1c3453){exec(_0xbf72('0xa'),function(_0x145acb,_0x2957c5,_0x44ce73){logger[_0xbf72('0xb')](_0x2957c5);logger[_0xbf72('0xb')](_0x44ce73);if(_0x145acb){logger['error'](_0x145acb);return _0x1c3453(_0x145acb);}return _0xaec095(_0x2957c5);});});}exports[_0xbf72('0xc')]=function(_0x227a35,_0x57cccf){return pm2['list']()[_0xbf72('0xd')](function(_0x4f4fa5){if(_0x4f4fa5){var _0x5625b3=_['reject'](_0x4f4fa5,function(_0x32a0a5){return _0x32a0a5[_0xbf72('0x9')]===_0xbf72('0xe')||_0x32a0a5[_0xbf72('0x9')]===_0xbf72('0xf');});return{'rows':_0x5625b3,'count':_0x5625b3[_0xbf72('0x10')]};}return null;})['then'](respondWithResult(_0x57cccf,null))[_0xbf72('0x11')](handleError(_0x57cccf,null));};exports[_0xbf72('0x12')]=function(_0x2a8609,_0x3d4dea){return pm2[_0xbf72('0x13')](_0x2a8609['params']['id'])['then'](respondWithResult(_0x3d4dea,null))[_0xbf72('0xd')](handleEntityNotFound(_0x3d4dea,null))[_0xbf72('0x11')](handleError(_0x3d4dea,null));};exports[_0xbf72('0x14')]=function(_0x2584d9,_0x27e58e){if(_0x2584d9[_0xbf72('0x15')][_0xbf72('0x9')]&&_0x2584d9['body'][_0xbf72('0x16')]){var _0x42a193=path[_0xbf72('0x17')](__dirname,_0xbf72('0x18'),_0x2584d9[_0xbf72('0x15')]['script']);var _0x3cd181=process[_0xbf72('0x19')]();process['chdir'](path[_0xbf72('0x1a')](_0x42a193));return execChildProcess()[_0xbf72('0xd')](function(_0x267c41){process['chdir'](_0x3cd181);return pm2[_0xbf72('0x1b')]({'name':_0x2584d9[_0xbf72('0x15')][_0xbf72('0x9')],'script':_0x42a193});})[_0xbf72('0xd')](function(_0x4f4dc0){pm2[_0xbf72('0x1c')]();return _0x4f4dc0[0x0];})[_0xbf72('0xd')](respondWithResult(_0x27e58e,0xc9))[_0xbf72('0x11')](handleError(_0x27e58e,null));}else{return _0x27e58e['status'](0x1f4)[_0xbf72('0x1d')]({'message':_0xbf72('0x1e')});}};exports[_0xbf72('0x1f')]=function(_0x1a2f55,_0x15d60d){if(_0x1a2f55[_0xbf72('0x15')]['id']){delete _0x1a2f55[_0xbf72('0x15')]['id'];}var _0x25ecdf={'online':_0xbf72('0x20'),'stopped':_0xbf72('0x21')};if(_0x25ecdf[_0xbf72('0x22')](_0x1a2f55[_0xbf72('0x15')][_0xbf72('0x6')])){return pm2[_0x25ecdf[_0x1a2f55[_0xbf72('0x15')][_0xbf72('0x6')]]](_0x1a2f55['params']['id'])[_0xbf72('0xd')](respondWithResult(_0x15d60d,0xc8))[_0xbf72('0x11')](handleError(_0x15d60d,null));}else{return _0x15d60d[_0xbf72('0x6')](0x1f4)[_0xbf72('0x1d')]({'message':_0xbf72('0x23')});}};exports[_0xbf72('0x24')]=function(_0x35ecdc,_0x209b2b){if(_0x35ecdc[_0xbf72('0x15')]['id']){delete _0x35ecdc[_0xbf72('0x15')]['id'];}if(_0x35ecdc[_0xbf72('0x25')]['id']){return pm2[_0xbf72('0x26')](_0x35ecdc[_0xbf72('0x25')]['id'])[_0xbf72('0xd')](function(_0x4e2472){pm2[_0xbf72('0x1c')]();return _0x4e2472[0x0];})[_0xbf72('0xd')](respondWithResult(_0x209b2b,null))[_0xbf72('0x11')](handleError(_0x209b2b,null));}else{return _0x209b2b['status'](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index f51f561..cd5650e 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 _0x2a2b=['./realtime.controller','get','/queues','express','Router'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x2a2b,0x1de));var _0xb2a2=function(_0x1da80f,_0x62bf9e){_0x1da80f=_0x1da80f-0x0;var _0x3c46e4=_0x2a2b[_0x1da80f];return _0x3c46e4;};'use strict';var express=require(_0xb2a2('0x0'));var router=express[_0xb2a2('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xb2a2('0x2'));router[_0xb2a2('0x3')](_0xb2a2('0x4'),auth['isAuthenticated'](),controller['getQueues']);module['exports']=router; \ No newline at end of file +var _0x5a43=['get','/queues','isAuthenticated','express','Router','../../components/auth/service','./realtime.controller'];(function(_0x5b9d52,_0x5eecfb){var _0x51829f=function(_0x777aef){while(--_0x777aef){_0x5b9d52['push'](_0x5b9d52['shift']());}};_0x51829f(++_0x5eecfb);}(_0x5a43,0xf1));var _0x35a4=function(_0x4e4e71,_0x150931){_0x4e4e71=_0x4e4e71-0x0;var _0x3ee2f4=_0x5a43[_0x4e4e71];return _0x3ee2f4;};'use strict';var express=require(_0x35a4('0x0'));var router=express[_0x35a4('0x1')]();var auth=require(_0x35a4('0x2'));var controller=require(_0x35a4('0x3'));router[_0x35a4('0x4')](_0x35a4('0x5'),auth[_0x35a4('0x6')](),controller['getQueues']);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 7273abb..8a6e3d7 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 _0xef17=['send','getQueues','mail','sms','openchannel','channel','query','toLowerCase','startCase','Queue','map','rawAttributes','type','key','getOptions','user','role','outbound','QueueCampaigns','filter','UserProfile','getResources','then','request','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','waiting','talking','voice','pTalking','originated','message','dialActive','Trunk','startPredictive','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','paused','loggedInDb','loggedIn','available','agents','find','merge','pick','getAgents','online','getMembers','length','UserId','User','Pause','QueueId','findAll','agent','push','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','http','limit','undefined','count','offset','set','error','stack','name','status'];(function(_0x818500,_0xe7620c){var _0x342023=function(_0x17c939){while(--_0x17c939){_0x818500['push'](_0x818500['shift']());}};_0x342023(++_0xe7620c);}(_0xef17,0x136));var _0x7ef1=function(_0x593122,_0x2e8bc7){_0x593122=_0x593122-0x0;var _0x4ae55b=_0xef17[_0x593122];return _0x4ae55b;};'use strict';var util=require(_0x7ef1('0x0'));var _=require(_0x7ef1('0x1'));var jayson=require(_0x7ef1('0x2'));var qs=require(_0x7ef1('0x3'));var logger=require(_0x7ef1('0x4'))(_0x7ef1('0x5'));var db=require(_0x7ef1('0x6'))['db'];var client=jayson[_0x7ef1('0x7')][_0x7ef1('0x8')]({'port':0x232a});var routingClient=jayson['client'][_0x7ef1('0x8')]({'port':0x232c});function respondWithFilteredResult(_0x514b70,_0x138ed1){return function(_0x498596){if(_0x498596){var _0x34a040=typeof _0x138ed1['offset']==='undefined'&&typeof _0x138ed1[_0x7ef1('0x9')]===_0x7ef1('0xa');var _0x56ab07=_0x498596[_0x7ef1('0xb')];var _0x1d5b33=_0x34a040?0x0:_0x138ed1[_0x7ef1('0xc')];var _0x3d47e2=_0x34a040?_0x498596[_0x7ef1('0xb')]:_0x138ed1[_0x7ef1('0xc')]+_0x138ed1[_0x7ef1('0x9')];var _0x4bedd1;if(_0x3d47e2>=_0x56ab07){_0x3d47e2=_0x56ab07;_0x4bedd1=0xc8;}else{_0x4bedd1=0xce;}_0x514b70['status'](_0x4bedd1);return _0x514b70[_0x7ef1('0xd')]('Content-Range',_0x1d5b33+'-'+_0x3d47e2+'/'+_0x56ab07)['json'](_0x498596);}return null;};}function handleError(_0x4d60ae,_0x122c8a){_0x122c8a=_0x122c8a||0x1f4;return function(_0x51e226){logger[_0x7ef1('0xe')](_0x51e226[_0x7ef1('0xf')]);if(_0x51e226[_0x7ef1('0x10')]){delete _0x51e226[_0x7ef1('0x10')];}_0x4d60ae[_0x7ef1('0x11')](_0x122c8a)[_0x7ef1('0x12')](_0x51e226);};}exports[_0x7ef1('0x13')]=function(_0x44d304,_0x57296a){var _0x4de80f=[_0x7ef1('0x14'),'chat',_0x7ef1('0x15'),_0x7ef1('0x16'),'fax','whatsapp','voice'];var _0x300645={'count':0x0,'rows':[]},_0x4da0fa={},_0x3a5835;Promise['resolve']()['then'](function(){if(_0x44d304['query'][_0x7ef1('0x17')]){if(!_['includes'](_0x4de80f,_0x44d304[_0x7ef1('0x18')][_0x7ef1('0x17')]['toLowerCase']()))throw new Error('Invalid\x20channel');_0x3a5835=_0x44d304[_0x7ef1('0x18')]['channel'][_0x7ef1('0x19')]();}var _0x33f89b=_[_0x7ef1('0x1a')](_0x3a5835)+_0x7ef1('0x1b');var _0x38edd8=_[_0x7ef1('0x1c')](db[_0x33f89b][_0x7ef1('0x1d')],function(_0xd71594){return{'name':_0xd71594['fieldName'],'type':_0xd71594[_0x7ef1('0x1e')][_0x7ef1('0x1f')]};});_0x4da0fa=qs[_0x7ef1('0x20')](_0x38edd8,_0x44d304);if(_0x44d304[_0x7ef1('0x21')][_0x7ef1('0x22')]===_0x7ef1('0x21')){var _0x423c42={'params':{'id':_0x44d304[_0x7ef1('0x21')]['userProfileId']},'query':{'section':_0x3a5835==='voice'&&_0x44d304[_0x7ef1('0x18')][_0x7ef1('0x1e')]===_0x7ef1('0x23')?_0x7ef1('0x24'):_[_0x7ef1('0x1a')](_0x3a5835)+'Queues','type':_0x44d304[_0x7ef1('0x18')][_0x7ef1('0x1e')],'nolimit':!![],'sort':_0x7ef1('0x10'),'filter':_0x44d304[_0x7ef1('0x18')][_0x7ef1('0x25')]}};return db[_0x7ef1('0x26')][_0x7ef1('0x27')](_0x423c42);}return db[_0x33f89b]['findAndCountAll'](_0x4da0fa);})[_0x7ef1('0x28')](function(_0x4b0380){_0x300645[_0x7ef1('0xb')]=_0x4b0380[_0x7ef1('0xb')];var _0x4b5fde=_0x3a5835==='voice'?client:routingClient;return _0x4b5fde[_0x7ef1('0x29')](_[_0x7ef1('0x1a')](_0x3a5835)+'Queues',_0x44d304)[_0x7ef1('0x28')](function(_0x56fe40){if(_0x56fe40[_0x7ef1('0xe')])throw new Error(util['format'](_0x7ef1('0x2a'),_0x3a5835));var _0x23414f=_0x56fe40['result'];var _0x536083=['loggedIn','available',_0x7ef1('0x2b'),_0x7ef1('0x2c'),'paused'];if(_0x3a5835===_0x7ef1('0x2d')&&_0x44d304['query']['type']===_0x7ef1('0x23')){_0x536083['push'](_0x7ef1('0x2e'),_0x7ef1('0x2f'),_0x7ef1('0x30'),_0x7ef1('0x31'),'dialMethod',_0x7ef1('0x32'),_0x7ef1('0x33'),'startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate',_0x7ef1('0x34'),'dialPredictiveInterval',_0x7ef1('0x35'),_0x7ef1('0x36'),_0x7ef1('0x37'),_0x7ef1('0x38'),_0x7ef1('0x39'),_0x7ef1('0x3a'),_0x7ef1('0x3b'),_0x7ef1('0x3c'),_0x7ef1('0x3d'));}var _0x3eb9a3=_0x4b0380[_0x7ef1('0x3e')]['map'](function(_0x3a45df){var _0x1e9080=_0x3a45df['get']({'plain':!![]});_0x1e9080[_0x7ef1('0x3f')]=0x0;_0x1e9080[_0x7ef1('0x40')]=0x0;_0x1e9080[_0x7ef1('0x41')]=0x0;_0x1e9080[_0x7ef1('0x42')]=0x0;_0x1e9080[_0x7ef1('0x3f')]=0x0;_0x1e9080['waiting']=0x0;if(_0x3a5835===_0x7ef1('0x2d')){_0x1e9080[_0x7ef1('0x2c')]=0x0;if(_0x44d304[_0x7ef1('0x18')][_0x7ef1('0x1e')]===_0x7ef1('0x23')){_0x1e9080[_0x7ef1('0x2e')]=0x0;_0x1e9080[_0x7ef1('0x2f')]=0x0;}}_0x1e9080[_0x7ef1('0x43')]=[];var _0x1433df=_[_0x7ef1('0x44')](_0x23414f[_0x7ef1('0x3e')],['id',_0x1e9080['id']]);if(_0x1433df)_[_0x7ef1('0x45')](_0x1e9080,_[_0x7ef1('0x46')](_0x1433df,_0x536083));if(_0x3a5835===_0x7ef1('0x2d')){return _0x3a45df[_0x7ef1('0x47')]({'attributes':['id','name',_0x7ef1('0x48')],'joinTableAttributes':[],'raw':!![]})[_0x7ef1('0x28')](function(_0x302212){return _0x3a45df[_0x7ef1('0x49')]({'raw':!![]})[_0x7ef1('0x28')](function(_0x1328e2){for(var _0x18a3b3=0x0;_0x18a3b3<_0x302212[_0x7ef1('0x4a')];_0x18a3b3++){var _0xf76a03=_[_0x7ef1('0x44')](_0x1328e2,[_0x7ef1('0x4b'),_0x302212[_0x18a3b3]['id']]);var _0x374bf5={'id':_0x302212[_0x18a3b3]['id'],'name':_0x302212[_0x18a3b3][_0x7ef1('0x10')],'online':Boolean(_0x302212[_0x18a3b3]['online']),'paused':_0xf76a03?Boolean(_0xf76a03[_0x7ef1('0x3f')]):![]};if(_0x374bf5[_0x7ef1('0x48')])_0x1e9080[_0x7ef1('0x40')]++;if(_0x374bf5[_0x7ef1('0x3f')])_0x1e9080[_0x7ef1('0x3f')]++;_0x1e9080[_0x7ef1('0x43')]['push'](_0x374bf5);}return _0x1e9080;});});}else{var _0x4448ca=_0x7ef1('0x4c')+_[_0x7ef1('0x1a')](_0x3a5835)+_0x7ef1('0x1b');var _0x41debc=_0x3a5835+_0x7ef1('0x4d');return db[_0x4448ca]['findAll']({'where':{[_[_0x7ef1('0x1a')](_0x3a5835)+_0x7ef1('0x4e')]:_0x3a45df['id']},'raw':!![]})[_0x7ef1('0x28')](function(_0x43262e){return db['User'][_0x7ef1('0x4f')]({'attributes':['id','name','online',_0x41debc],'where':{'id':_[_0x7ef1('0x1c')](_0x43262e,'UserId'),'role':_0x7ef1('0x50')},'raw':!![]});})['then'](function(_0x45ab6){for(var _0x17e41f=0x0;_0x17e41f<_0x45ab6[_0x7ef1('0x4a')];_0x17e41f++){var _0x267903={'id':_0x45ab6[_0x17e41f]['id'],'name':_0x45ab6[_0x17e41f][_0x7ef1('0x10')],'online':Boolean(_0x45ab6[_0x17e41f][_0x7ef1('0x48')]),'paused':Boolean(_0x45ab6[_0x17e41f][_0x41debc])};if(_0x267903[_0x7ef1('0x48')])_0x1e9080[_0x7ef1('0x40')]++;if(_0x267903['paused'])_0x1e9080['paused']++;_0x1e9080[_0x7ef1('0x43')][_0x7ef1('0x51')](_0x267903);}return _0x1e9080;});}});return Promise['all'](_0x3eb9a3);});})[_0x7ef1('0x28')](function(_0x2b1141){_0x300645[_0x7ef1('0x3e')]=_0x2b1141;return _0x300645;})['then'](respondWithFilteredResult(_0x57296a,_0x4da0fa))['catch'](handleError(_0x57296a,null));}; \ No newline at end of file +var _0xfb11=['User','findAll','length','catch','util','jayson/promise','../../components/parsers/qs','api','client','http','offset','undefined','limit','count','status','Content-Range','json','error','name','send','getQueues','mail','openchannel','fax','whatsapp','resolve','then','query','channel','includes','toLowerCase','Queue','fieldName','type','key','getOptions','role','user','userProfileId','voice','QueueCampaigns','startCase','Queues','filter','UserProfile','getResources','findAndCountAll','request','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','loggedIn','waiting','talking','paused','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangAbandonmentRate','dialPredictiveInterval','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','loggedInDb','agents','find','rows','merge','pick','getAgents','online','getMembers','UserId','Pause','QueueId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xfb11[_0x56482c];return _0x5aae7a;};'use strict';var util=require(_0x1fb1('0x0'));var _=require('lodash');var jayson=require(_0x1fb1('0x1'));var qs=require(_0x1fb1('0x2'));var logger=require('../../config/logger')(_0x1fb1('0x3'));var db=require('../../mysqldb')['db'];var client=jayson[_0x1fb1('0x4')]['http']({'port':0x232a});var routingClient=jayson[_0x1fb1('0x4')][_0x1fb1('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x5af469,_0x25d44f){return function(_0x133727){if(_0x133727){var _0x4c098d=typeof _0x25d44f[_0x1fb1('0x6')]===_0x1fb1('0x7')&&typeof _0x25d44f[_0x1fb1('0x8')]===_0x1fb1('0x7');var _0x161e1b=_0x133727[_0x1fb1('0x9')];var _0x438d15=_0x4c098d?0x0:_0x25d44f[_0x1fb1('0x6')];var _0x377aae=_0x4c098d?_0x133727[_0x1fb1('0x9')]:_0x25d44f['offset']+_0x25d44f[_0x1fb1('0x8')];var _0x53f30e;if(_0x377aae>=_0x161e1b){_0x377aae=_0x161e1b;_0x53f30e=0xc8;}else{_0x53f30e=0xce;}_0x5af469[_0x1fb1('0xa')](_0x53f30e);return _0x5af469['set'](_0x1fb1('0xb'),_0x438d15+'-'+_0x377aae+'/'+_0x161e1b)[_0x1fb1('0xc')](_0x133727);}return null;};}function handleError(_0xd39b52,_0x10bcac){_0x10bcac=_0x10bcac||0x1f4;return function(_0x333229){logger[_0x1fb1('0xd')](_0x333229['stack']);if(_0x333229[_0x1fb1('0xe')]){delete _0x333229[_0x1fb1('0xe')];}_0xd39b52[_0x1fb1('0xa')](_0x10bcac)[_0x1fb1('0xf')](_0x333229);};}exports[_0x1fb1('0x10')]=function(_0x46cf8e,_0x151152){var _0x316fe5=[_0x1fb1('0x11'),'chat','sms',_0x1fb1('0x12'),_0x1fb1('0x13'),_0x1fb1('0x14'),'voice'];var _0x161ca3={'count':0x0,'rows':[]},_0x23f1f5={},_0x24d4df;Promise[_0x1fb1('0x15')]()[_0x1fb1('0x16')](function(){if(_0x46cf8e[_0x1fb1('0x17')][_0x1fb1('0x18')]){if(!_[_0x1fb1('0x19')](_0x316fe5,_0x46cf8e[_0x1fb1('0x17')]['channel'][_0x1fb1('0x1a')]()))throw new Error('Invalid\x20channel');_0x24d4df=_0x46cf8e['query'][_0x1fb1('0x18')][_0x1fb1('0x1a')]();}var _0x1eaf9e=_['startCase'](_0x24d4df)+_0x1fb1('0x1b');var _0x4ed51a=_['map'](db[_0x1eaf9e]['rawAttributes'],function(_0x31178c){return{'name':_0x31178c[_0x1fb1('0x1c')],'type':_0x31178c[_0x1fb1('0x1d')][_0x1fb1('0x1e')]};});_0x23f1f5=qs[_0x1fb1('0x1f')](_0x4ed51a,_0x46cf8e);if(_0x46cf8e['user'][_0x1fb1('0x20')]===_0x1fb1('0x21')){var _0x1dc03f={'params':{'id':_0x46cf8e[_0x1fb1('0x21')][_0x1fb1('0x22')]},'query':{'section':_0x24d4df===_0x1fb1('0x23')&&_0x46cf8e[_0x1fb1('0x17')][_0x1fb1('0x1d')]==='outbound'?_0x1fb1('0x24'):_[_0x1fb1('0x25')](_0x24d4df)+_0x1fb1('0x26'),'type':_0x46cf8e[_0x1fb1('0x17')][_0x1fb1('0x1d')],'nolimit':!![],'sort':_0x1fb1('0xe'),'filter':_0x46cf8e[_0x1fb1('0x17')][_0x1fb1('0x27')]}};return db[_0x1fb1('0x28')][_0x1fb1('0x29')](_0x1dc03f);}return db[_0x1eaf9e][_0x1fb1('0x2a')](_0x23f1f5);})[_0x1fb1('0x16')](function(_0x39fc43){_0x161ca3[_0x1fb1('0x9')]=_0x39fc43[_0x1fb1('0x9')];var _0x520ee2=_0x24d4df===_0x1fb1('0x23')?client:routingClient;return _0x520ee2[_0x1fb1('0x2b')](_[_0x1fb1('0x25')](_0x24d4df)+_0x1fb1('0x26'),_0x46cf8e)['then'](function(_0x245f84){if(_0x245f84[_0x1fb1('0xd')])throw new Error(util['format'](_0x1fb1('0x2c'),_0x24d4df));var _0x566530=_0x245f84['result'];var _0x354e92=[_0x1fb1('0x2d'),'available',_0x1fb1('0x2e'),_0x1fb1('0x2f'),_0x1fb1('0x30')];if(_0x24d4df===_0x1fb1('0x23')&&_0x46cf8e[_0x1fb1('0x17')]['type']===_0x1fb1('0x31')){_0x354e92[_0x1fb1('0x32')](_0x1fb1('0x33'),_0x1fb1('0x34'),_0x1fb1('0x35'),_0x1fb1('0x36'),_0x1fb1('0x37'),_0x1fb1('0x38'),_0x1fb1('0x39'),'startProgressive',_0x1fb1('0x3a'),'erlangCallToSecond',_0x1fb1('0x3b'),'erlangBusyFactor',_0x1fb1('0x3c'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x1fb1('0x3d'),_0x1fb1('0x3e'),_0x1fb1('0x3f'),_0x1fb1('0x40'),'predictiveIntervalDroppedCallsCallersExit',_0x1fb1('0x41'),_0x1fb1('0x42'));}var _0x3bdf14=_0x39fc43['rows'][_0x1fb1('0x43')](function(_0x35aa83){var _0x228235=_0x35aa83[_0x1fb1('0x44')]({'plain':!![]});_0x228235[_0x1fb1('0x30')]=0x0;_0x228235[_0x1fb1('0x45')]=0x0;_0x228235[_0x1fb1('0x2d')]=0x0;_0x228235['available']=0x0;_0x228235[_0x1fb1('0x30')]=0x0;_0x228235[_0x1fb1('0x2e')]=0x0;if(_0x24d4df==='voice'){_0x228235[_0x1fb1('0x2f')]=0x0;if(_0x46cf8e['query'][_0x1fb1('0x1d')]===_0x1fb1('0x31')){_0x228235[_0x1fb1('0x33')]=0x0;_0x228235[_0x1fb1('0x34')]=0x0;}}_0x228235[_0x1fb1('0x46')]=[];var _0x344f7f=_[_0x1fb1('0x47')](_0x566530[_0x1fb1('0x48')],['id',_0x228235['id']]);if(_0x344f7f)_[_0x1fb1('0x49')](_0x228235,_[_0x1fb1('0x4a')](_0x344f7f,_0x354e92));if(_0x24d4df===_0x1fb1('0x23')){return _0x35aa83[_0x1fb1('0x4b')]({'attributes':['id',_0x1fb1('0xe'),_0x1fb1('0x4c')],'joinTableAttributes':[],'raw':!![]})[_0x1fb1('0x16')](function(_0x5184eb){return _0x35aa83[_0x1fb1('0x4d')]({'raw':!![]})[_0x1fb1('0x16')](function(_0x2ff635){for(var _0x19211f=0x0;_0x19211f<_0x5184eb['length'];_0x19211f++){var _0x556416=_[_0x1fb1('0x47')](_0x2ff635,[_0x1fb1('0x4e'),_0x5184eb[_0x19211f]['id']]);var _0x307faf={'id':_0x5184eb[_0x19211f]['id'],'name':_0x5184eb[_0x19211f][_0x1fb1('0xe')],'online':Boolean(_0x5184eb[_0x19211f][_0x1fb1('0x4c')]),'paused':_0x556416?Boolean(_0x556416[_0x1fb1('0x30')]):![]};if(_0x307faf[_0x1fb1('0x4c')])_0x228235[_0x1fb1('0x45')]++;if(_0x307faf[_0x1fb1('0x30')])_0x228235[_0x1fb1('0x30')]++;_0x228235['agents'][_0x1fb1('0x32')](_0x307faf);}return _0x228235;});});}else{var _0x543eb3='User'+_[_0x1fb1('0x25')](_0x24d4df)+_0x1fb1('0x1b');var _0x1e7000=_0x24d4df+_0x1fb1('0x4f');return db[_0x543eb3]['findAll']({'where':{[_['startCase'](_0x24d4df)+_0x1fb1('0x50')]:_0x35aa83['id']},'raw':!![]})[_0x1fb1('0x16')](function(_0xcab3ad){return db[_0x1fb1('0x51')][_0x1fb1('0x52')]({'attributes':['id',_0x1fb1('0xe'),_0x1fb1('0x4c'),_0x1e7000],'where':{'id':_[_0x1fb1('0x43')](_0xcab3ad,_0x1fb1('0x4e')),'role':'agent'},'raw':!![]});})['then'](function(_0x2fd49e){for(var _0x5687b6=0x0;_0x5687b6<_0x2fd49e[_0x1fb1('0x53')];_0x5687b6++){var _0x220eda={'id':_0x2fd49e[_0x5687b6]['id'],'name':_0x2fd49e[_0x5687b6][_0x1fb1('0xe')],'online':Boolean(_0x2fd49e[_0x5687b6][_0x1fb1('0x4c')]),'paused':Boolean(_0x2fd49e[_0x5687b6][_0x1e7000])};if(_0x220eda[_0x1fb1('0x4c')])_0x228235[_0x1fb1('0x45')]++;if(_0x220eda['paused'])_0x228235[_0x1fb1('0x30')]++;_0x228235[_0x1fb1('0x46')][_0x1fb1('0x32')](_0x220eda);}return _0x228235;});}});return Promise['all'](_0x3bdf14);});})[_0x1fb1('0x16')](function(_0x4861b4){_0x161ca3[_0x1fb1('0x48')]=_0x4861b4;return _0x161ca3;})[_0x1fb1('0x16')](respondWithFilteredResult(_0x151152,_0x23f1f5))[_0x1fb1('0x54')](handleError(_0x151152,null));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index b594cfa..2b5db66 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x10f6f0,_0x5aa2af){var _0xb630fd=function(_0x4035ba){while(--_0x4035ba){_0x10f6f0['push'](_0x10f6f0['shift']());}};_0xb630fd(++_0x5aa2af);}(_0xe706,0xa3));var _0x6e70=function(_0x4932a6,_0x530e29){_0x4932a6=_0x4932a6-0x0;var _0x3b45b9=_0xe706[_0x4932a6];return _0x3b45b9;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x518a20,_0x5be0a6){var _0x4168c6=function(_0x39c183){while(--_0x39c183){_0x518a20['push'](_0x518a20['shift']());}};_0x4168c6(++_0x5be0a6);}(_0xe706,0xa3));var _0x6e70=function(_0x4b7a20,_0x470a22){_0x4b7a20=_0x4b7a20-0x0;var _0x302aa4=_0xe706[_0x4b7a20];return _0x302aa4;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 5b325d6..c8e606c 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 _0x1a28=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x2213aa,_0x173e2a){var _0x4786e3=function(_0x8663e2){while(--_0x8663e2){_0x2213aa['push'](_0x2213aa['shift']());}};_0x4786e3(++_0x173e2a);}(_0x1a28,0x10e));var _0x81a2=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0x1a28[_0x5a6de2];return _0x2c0525;};'use strict';var Sequelize=require(_0x81a2('0x0'));module[_0x81a2('0x1')]={'state':{'type':Sequelize[_0x81a2('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x81a2('0x3')]},'scheduledat':{'type':Sequelize[_0x81a2('0x4')]},'uniqueid':{'type':Sequelize[_0x81a2('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x81a2('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x81a2('0x3')]},'campaigntype':{'type':Sequelize[_0x81a2('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x624c=['STRING','DATE','exports','INTEGER'];(function(_0x3b9e08,_0xfd3ee){var _0x53d93f=function(_0x58f6fc){while(--_0x58f6fc){_0x3b9e08['push'](_0x3b9e08['shift']());}};_0x53d93f(++_0xfd3ee);}(_0x624c,0x1ee));var _0xc624=function(_0x4a2ba2,_0x5901b9){_0x4a2ba2=_0x4a2ba2-0x0;var _0x1d09fd=_0x624c[_0x4a2ba2];return _0x1d09fd;};'use strict';var Sequelize=require('sequelize');module[_0xc624('0x0')]={'state':{'type':Sequelize[_0xc624('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xc624('0x2')]},'scheduledat':{'type':Sequelize[_0xc624('0x3')]},'uniqueid':{'type':Sequelize[_0xc624('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xc624('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xc624('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc624('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 4b50b7a..8b40cc0 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 _0x24d9=['define','ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x28d786,_0x21c3ac){var _0x1d8044=function(_0x10bce5){while(--_0x10bce5){_0x28d786['push'](_0x28d786['shift']());}};_0x1d8044(++_0x21c3ac);}(_0x24d9,0x1cb));var _0x924d=function(_0x250e25,_0x37faa3){_0x250e25=_0x250e25-0x0;var _0x1a1428=_0x24d9[_0x250e25];return _0x1a1428;};'use strict';var _=require(_0x924d('0x0'));var util=require(_0x924d('0x1'));var logger=require(_0x924d('0x2'))(_0x924d('0x3'));var moment=require(_0x924d('0x4'));var BPromise=require(_0x924d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x924d('0x6'));var config=require(_0x924d('0x7'));var attributes=require(_0x924d('0x8'));module['exports']=function(_0x4d8a3d,_0x12f305){return _0x4d8a3d[_0x924d('0x9')](_0x924d('0xa'),attributes,{'tableName':_0x924d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa98d=['report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./reportAgentPreview.attributes','define','ReportAgentPreview'];(function(_0x173113,_0x316a7c){var _0x3bea89=function(_0xd33ac1){while(--_0xd33ac1){_0x173113['push'](_0x173113['shift']());}};_0x3bea89(++_0x316a7c);}(_0xa98d,0x91));var _0xda98=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa98d[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xda98('0x0'));var util=require(_0xda98('0x1'));var logger=require(_0xda98('0x2'))(_0xda98('0x3'));var moment=require(_0xda98('0x4'));var BPromise=require(_0xda98('0x5'));var rp=require(_0xda98('0x6'));var fs=require('fs');var path=require(_0xda98('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xda98('0x8'));module['exports']=function(_0x1c519c,_0x4ddd93){return _0x1c519c[_0xda98('0x9')](_0xda98('0xa'),attributes,{'tableName':_0xda98('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.rpc.js b/server/api/reportAgentPreview/reportAgentPreview.rpc.js index d35b14a..ecae676 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 _0x918d=['CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','debug','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','ReportAgentPreview,\x20%s,\x20%s','message','info','result','catch'];(function(_0x5a50e1,_0x23facf){var _0x25ba7f=function(_0x1c7b4a){while(--_0x1c7b4a){_0x5a50e1['push'](_0x5a50e1['shift']());}};_0x25ba7f(++_0x23facf);}(_0x918d,0x1ba));var _0xd918=function(_0x3544de,_0x358d94){_0x3544de=_0x3544de-0x0;var _0x54d68b=_0x918d[_0x3544de];return _0x54d68b;};'use strict';var _=require('lodash');var util=require(_0xd918('0x0'));var moment=require(_0xd918('0x1'));var BPromise=require(_0xd918('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd918('0x3'));var db=require(_0xd918('0x4'))['db'];var utils=require(_0xd918('0x5'));var logger=require(_0xd918('0x6'))(_0xd918('0x7'));var config=require(_0xd918('0x8'));var jayson=require(_0xd918('0x9'));var client=jayson[_0xd918('0xa')][_0xd918('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d34d5,_0x48b211,_0x1523d3){return new BPromise(function(_0x2994a7,_0x1375b7){return client[_0xd918('0xc')](_0x5d34d5,_0x1523d3)[_0xd918('0xd')](function(_0x2f1548){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x48b211,_0xd918('0xe'));logger['debug'](_0xd918('0xf'),_0x48b211,_0xd918('0xe'),JSON['stringify'](_0x2f1548));if(_0x2f1548['error']){if(_0x2f1548[_0xd918('0x10')][_0xd918('0x11')]===0x1f4){logger[_0xd918('0x10')](_0xd918('0x12'),_0x48b211,_0x2f1548['error'][_0xd918('0x13')]);return _0x1375b7(_0x2f1548[_0xd918('0x10')]['message']);}logger[_0xd918('0x10')](_0xd918('0x12'),_0x48b211,_0x2f1548['error'][_0xd918('0x13')]);return _0x2994a7(_0x2f1548[_0xd918('0x10')][_0xd918('0x13')]);}else{logger[_0xd918('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x48b211,'request\x20sent');_0x2994a7(_0x2f1548[_0xd918('0x15')][_0xd918('0x13')]);}})[_0xd918('0x16')](function(_0x55219b){logger['error'](_0xd918('0x12'),_0x48b211,_0x55219b);_0x1375b7(_0x55219b);});});}exports[_0xd918('0x17')]=function(_0x92185d){var _0x287b64=this;return new Promise(function(_0x2af17c,_0x3e7ae2){return db[_0xd918('0x18')][_0xd918('0x19')](_0x92185d[_0xd918('0x1a')],{'raw':_0x92185d['options']?_0x92185d[_0xd918('0x1b')][_0xd918('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x2715c5){logger[_0xd918('0x14')](_0xd918('0x17'),_0x92185d);logger[_0xd918('0x1d')]('CreateReportAgentPreview',_0x92185d,JSON[_0xd918('0x1e')](_0x2715c5));_0x2af17c(_0x2715c5);})[_0xd918('0x16')](function(_0x40d2b3){logger['error'](_0xd918('0x17'),_0x40d2b3[_0xd918('0x13')],_0x92185d);_0x3e7ae2(_0x287b64[_0xd918('0x10')](0x1f4,_0x40d2b3[_0xd918('0x13')]));});});}; \ No newline at end of file +var _0x6e0b=['create','body','options','raw','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e0b,0x19a));var _0xb6e0=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x6e0b[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0xb6e0('0x0'));var util=require(_0xb6e0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb6e0('0x2'));var fs=require('fs');var Redis=require(_0xb6e0('0x3'));var db=require(_0xb6e0('0x4'))['db'];var utils=require(_0xb6e0('0x5'));var logger=require('../../config/logger')(_0xb6e0('0x6'));var config=require(_0xb6e0('0x7'));var jayson=require(_0xb6e0('0x8'));var client=jayson[_0xb6e0('0x9')][_0xb6e0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe22043,_0x3bf552,_0x543781){return new BPromise(function(_0x1e1866,_0x1cd05e){return client[_0xb6e0('0xb')](_0xe22043,_0x543781)[_0xb6e0('0xc')](function(_0x27975f){logger[_0xb6e0('0xd')](_0xb6e0('0xe'),_0x3bf552,_0xb6e0('0xf'));logger['debug'](_0xb6e0('0x10'),_0x3bf552,_0xb6e0('0xf'),JSON[_0xb6e0('0x11')](_0x27975f));if(_0x27975f[_0xb6e0('0x12')]){if(_0x27975f[_0xb6e0('0x12')][_0xb6e0('0x13')]===0x1f4){logger[_0xb6e0('0x12')](_0xb6e0('0xe'),_0x3bf552,_0x27975f[_0xb6e0('0x12')][_0xb6e0('0x14')]);return _0x1cd05e(_0x27975f[_0xb6e0('0x12')][_0xb6e0('0x14')]);}logger['error'](_0xb6e0('0xe'),_0x3bf552,_0x27975f[_0xb6e0('0x12')][_0xb6e0('0x14')]);return _0x1e1866(_0x27975f['error'][_0xb6e0('0x14')]);}else{logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x3bf552,'request\x20sent');_0x1e1866(_0x27975f[_0xb6e0('0x15')]['message']);}})[_0xb6e0('0x16')](function(_0x1f6bba){logger[_0xb6e0('0x12')](_0xb6e0('0xe'),_0x3bf552,_0x1f6bba);_0x1cd05e(_0x1f6bba);});});}exports[_0xb6e0('0x17')]=function(_0x3b5ac3){var _0x181037=this;return new Promise(function(_0x181eee,_0x39f3db){return db[_0xb6e0('0x18')][_0xb6e0('0x19')](_0x3b5ac3[_0xb6e0('0x1a')],{'raw':_0x3b5ac3[_0xb6e0('0x1b')]?_0x3b5ac3[_0xb6e0('0x1b')][_0xb6e0('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x1c904c){logger[_0xb6e0('0xd')]('CreateReportAgentPreview',_0x3b5ac3);logger['debug'](_0xb6e0('0x17'),_0x3b5ac3,JSON[_0xb6e0('0x11')](_0x1c904c));_0x181eee(_0x1c904c);})[_0xb6e0('0x16')](function(_0x277b38){logger[_0xb6e0('0x12')](_0xb6e0('0x17'),_0x277b38[_0xb6e0('0x14')],_0x3b5ac3);_0x39f3db(_0x181037['error'](0x1f4,_0x277b38[_0xb6e0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 62f27ea..8825c28 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 _0x9496=['agentCapacity','/telephones','/trunks','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','../../components/auth/service','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','outbound','/outbound/channels','/agents','/agents/:id/capacity'];(function(_0x4ce66b,_0x4130cb){var _0x1e732e=function(_0x195e99){while(--_0x195e99){_0x4ce66b['push'](_0x4ce66b['shift']());}};_0x1e732e(++_0x4130cb);}(_0x9496,0xc4));var _0x6949=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x9496[_0xaa1b3e];return _0x454d7d;};'use strict';var multer=require(_0x6949('0x0'));var util=require(_0x6949('0x1'));var path=require('path');var express=require(_0x6949('0x2'));var router=express['Router']();var auth=require(_0x6949('0x3'));var controller=require('./rpc.controller');router[_0x6949('0x4')](_0x6949('0x5'),auth['isAuthenticated'](),controller[_0x6949('0x6')]);router[_0x6949('0x4')](_0x6949('0x7'),auth[_0x6949('0x8')](),controller[_0x6949('0x9')]);router[_0x6949('0x4')](_0x6949('0xa'),auth[_0x6949('0x8')](),controller[_0x6949('0xb')]);router[_0x6949('0x4')]('/voice/queues',auth[_0x6949('0x8')](),controller[_0x6949('0xc')]);router[_0x6949('0x4')](_0x6949('0xd'),auth[_0x6949('0x8')](),controller[_0x6949('0xe')]);router[_0x6949('0x4')](_0x6949('0xf'),auth[_0x6949('0x8')](),controller['mailQueues']);router[_0x6949('0x4')](_0x6949('0x10'),auth['isAuthenticated'](),controller['mailAccounts']);router[_0x6949('0x4')](_0x6949('0x11'),auth['isAuthenticated'](),controller[_0x6949('0x12')]);router[_0x6949('0x4')](_0x6949('0x13'),auth[_0x6949('0x8')](),controller[_0x6949('0x14')]);router[_0x6949('0x4')]('/whatsapp/queues',auth['isAuthenticated'](),controller['whatsappQueues']);router[_0x6949('0x4')](_0x6949('0x15'),auth[_0x6949('0x8')](),controller['faxQueues']);router[_0x6949('0x4')](_0x6949('0x16'),auth[_0x6949('0x8')](),controller[_0x6949('0x17')]);router['get'](_0x6949('0x18'),auth[_0x6949('0x8')](),controller['voiceQueuesChannels']);router['get'](_0x6949('0x19'),auth[_0x6949('0x8')](),controller[_0x6949('0x1a')]);router[_0x6949('0x4')](_0x6949('0x1b'),auth[_0x6949('0x8')](),controller[_0x6949('0x1c')]);router[_0x6949('0x4')](_0x6949('0x1d'),auth['isAuthenticated'](),controller[_0x6949('0x1e')]);router[_0x6949('0x4')]('/voice/queues/:id',auth[_0x6949('0x8')](),controller[_0x6949('0x1f')]);router[_0x6949('0x20')](_0x6949('0x21'),auth[_0x6949('0x8')](),controller['updateVoiceQueue']);router[_0x6949('0x4')]('/outbound',auth[_0x6949('0x8')](),controller[_0x6949('0x22')]);router[_0x6949('0x4')](_0x6949('0x23'),auth[_0x6949('0x8')](),controller['outboundChannels']);router[_0x6949('0x4')](_0x6949('0x24'),auth[_0x6949('0x8')](),controller['agents']);router[_0x6949('0x20')](_0x6949('0x25'),auth[_0x6949('0x8')](),controller[_0x6949('0x26')]);router['get'](_0x6949('0x27'),auth[_0x6949('0x8')](),controller['telephones']);router[_0x6949('0x4')](_0x6949('0x28'),auth['isAuthenticated'](),controller['trunks']);router[_0x6949('0x4')]('/campaigns',auth['isAuthenticated'](),controller['campaigns']);router[_0x6949('0x4')](_0x6949('0x29'),auth['isAuthenticated'](),controller[_0x6949('0x2a')]);router[_0x6949('0x4')](_0x6949('0x2b'),auth[_0x6949('0x8')](),controller[_0x6949('0x2c')]);router['get'](_0x6949('0x2d'),auth[_0x6949('0x8')](),controller[_0x6949('0x2e')]);router[_0x6949('0x4')](_0x6949('0x2f'),auth[_0x6949('0x8')](),controller[_0x6949('0x30')]);router[_0x6949('0x4')](_0x6949('0x31'),auth[_0x6949('0x8')](),controller[_0x6949('0x32')]);router[_0x6949('0x4')]('/sms/queues/waitinginteractions',auth[_0x6949('0x8')](),controller[_0x6949('0x33')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x6949('0x8')](),controller[_0x6949('0x34')]);router[_0x6949('0x4')](_0x6949('0x35'),auth[_0x6949('0x8')](),controller[_0x6949('0x36')]);router[_0x6949('0x37')](_0x6949('0x38'),auth[_0x6949('0x8')](),controller[_0x6949('0x39')](_0x6949('0x3a')));router[_0x6949('0x4')]('/mail/queues/:id',auth[_0x6949('0x8')](),controller[_0x6949('0x3b')]);router[_0x6949('0x37')](_0x6949('0x3c'),auth['isAuthenticated'](),controller[_0x6949('0x39')](_0x6949('0x3d')));router[_0x6949('0x4')](_0x6949('0x3e'),auth[_0x6949('0x8')](),controller['showChatQueues']);router[_0x6949('0x37')](_0x6949('0x3f'),auth[_0x6949('0x8')](),controller[_0x6949('0x39')](_0x6949('0x40')));router[_0x6949('0x4')]('/fax/queues/:id',auth[_0x6949('0x8')](),controller[_0x6949('0x41')]);router[_0x6949('0x37')](_0x6949('0x42'),auth[_0x6949('0x8')](),controller[_0x6949('0x39')](_0x6949('0x43')));router[_0x6949('0x4')](_0x6949('0x44'),auth[_0x6949('0x8')](),controller[_0x6949('0x45')]);router['post'](_0x6949('0x46'),auth['isAuthenticated'](),controller[_0x6949('0x39')](_0x6949('0x47')));router[_0x6949('0x37')](_0x6949('0x48'),auth[_0x6949('0x8')](),controller[_0x6949('0x39')]('whatsapp'));router[_0x6949('0x4')]('/sms/queues/:id',auth['isAuthenticated'](),controller['showSmsQueues']);router[_0x6949('0x4')](_0x6949('0x49'),auth[_0x6949('0x8')](),controller[_0x6949('0x4a')]);router[_0x6949('0x37')](_0x6949('0x4b'),auth[_0x6949('0x8')](),controller[_0x6949('0x4c')]);module[_0x6949('0x4d')]=router; \ No newline at end of file +var _0x8eef=['/chat/queues/:id','/fax/queues/:id/notify','fax','/fax/queues/:id','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/whatsapp/queues/:id/notify','whatsapp','/whatsapp/queues/:id','/agents/:id/notify','multer','util','path','express','Router','./rpc.controller','/voice/channels','voiceChannels','get','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','/telephones','telephones','trunks','/campaigns','campaigns','/fax/accounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify'];(function(_0x5e5658,_0x5ceb37){var _0x501ff8=function(_0x359ef1){while(--_0x359ef1){_0x5e5658['push'](_0x5e5658['shift']());}};_0x501ff8(++_0x5ceb37);}(_0x8eef,0xb2));var _0xf8ee=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x8eef[_0x178e48];return _0x440d7e;};'use strict';var multer=require(_0xf8ee('0x0'));var util=require(_0xf8ee('0x1'));var path=require(_0xf8ee('0x2'));var express=require(_0xf8ee('0x3'));var router=express[_0xf8ee('0x4')]();var auth=require('../../components/auth/service');var controller=require(_0xf8ee('0x5'));router['get'](_0xf8ee('0x6'),auth['isAuthenticated'](),controller[_0xf8ee('0x7')]);router[_0xf8ee('0x8')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xf8ee('0x9')](),controller[_0xf8ee('0xa')]);router[_0xf8ee('0x8')](_0xf8ee('0xb'),auth[_0xf8ee('0x9')](),controller[_0xf8ee('0xc')]);router[_0xf8ee('0x8')](_0xf8ee('0xd'),auth['isAuthenticated'](),controller[_0xf8ee('0xe')]);router[_0xf8ee('0x8')](_0xf8ee('0xf'),auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x10')]);router[_0xf8ee('0x8')](_0xf8ee('0x11'),auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x12')]);router['get'](_0xf8ee('0x13'),auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x14')]);router['get']('/openchannel/queues',auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x15')]);router[_0xf8ee('0x8')](_0xf8ee('0x16'),auth[_0xf8ee('0x9')](),controller['smsQueues']);router[_0xf8ee('0x8')](_0xf8ee('0x17'),auth[_0xf8ee('0x9')](),controller['whatsappQueues']);router[_0xf8ee('0x8')](_0xf8ee('0x18'),auth['isAuthenticated'](),controller[_0xf8ee('0x19')]);router['get'](_0xf8ee('0x1a'),auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x1b')]);router[_0xf8ee('0x8')](_0xf8ee('0x1c'),auth[_0xf8ee('0x9')](),controller['voiceQueuesChannels']);router[_0xf8ee('0x8')](_0xf8ee('0x1d'),auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x1e')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x1f')]);router[_0xf8ee('0x8')](_0xf8ee('0x20'),auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x21')]);router[_0xf8ee('0x8')](_0xf8ee('0x22'),auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x23')]);router['put'](_0xf8ee('0x22'),auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x24')]);router[_0xf8ee('0x8')](_0xf8ee('0x25'),auth['isAuthenticated'](),controller[_0xf8ee('0x26')]);router[_0xf8ee('0x8')](_0xf8ee('0x27'),auth['isAuthenticated'](),controller[_0xf8ee('0x28')]);router[_0xf8ee('0x8')](_0xf8ee('0x29'),auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x2a')]);router[_0xf8ee('0x2b')](_0xf8ee('0x2c'),auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x2d')]);router[_0xf8ee('0x8')](_0xf8ee('0x2e'),auth['isAuthenticated'](),controller[_0xf8ee('0x2f')]);router[_0xf8ee('0x8')]('/trunks',auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x30')]);router[_0xf8ee('0x8')](_0xf8ee('0x31'),auth['isAuthenticated'](),controller[_0xf8ee('0x32')]);router[_0xf8ee('0x8')](_0xf8ee('0x33'),auth[_0xf8ee('0x9')](),controller['faxAccounts']);router[_0xf8ee('0x8')](_0xf8ee('0x34'),auth['isAuthenticated'](),controller[_0xf8ee('0x35')]);router[_0xf8ee('0x8')](_0xf8ee('0x36'),auth['isAuthenticated'](),controller[_0xf8ee('0x37')]);router[_0xf8ee('0x8')](_0xf8ee('0x38'),auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x39')]);router['get'](_0xf8ee('0x3a'),auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x3b')]);router[_0xf8ee('0x8')](_0xf8ee('0x3c'),auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x3d')]);router['get'](_0xf8ee('0x3e'),auth['isAuthenticated'](),controller[_0xf8ee('0x3f')]);router['get'](_0xf8ee('0x40'),auth[_0xf8ee('0x9')](),controller['faxQueuesWaitingInteractions']);router[_0xf8ee('0x41')]('/mail/queues/:id/notify',auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x42')](_0xf8ee('0x43')));router[_0xf8ee('0x8')](_0xf8ee('0x44'),auth['isAuthenticated'](),controller[_0xf8ee('0x45')]);router[_0xf8ee('0x41')](_0xf8ee('0x46'),auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x42')]('chat'));router[_0xf8ee('0x8')](_0xf8ee('0x47'),auth[_0xf8ee('0x9')](),controller['showChatQueues']);router['post'](_0xf8ee('0x48'),auth[_0xf8ee('0x9')](),controller['queueNotify'](_0xf8ee('0x49')));router['get'](_0xf8ee('0x4a'),auth['isAuthenticated'](),controller['showFaxQueues']);router[_0xf8ee('0x41')](_0xf8ee('0x4b'),auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x42')](_0xf8ee('0x4c')));router['get'](_0xf8ee('0x4d'),auth[_0xf8ee('0x9')](),controller[_0xf8ee('0x4e')]);router[_0xf8ee('0x41')]('/sms/queues/:id/notify',auth[_0xf8ee('0x9')](),controller['queueNotify']('sms'));router['post'](_0xf8ee('0x4f'),auth[_0xf8ee('0x9')](),controller['queueNotify'](_0xf8ee('0x50')));router[_0xf8ee('0x8')]('/sms/queues/:id',auth[_0xf8ee('0x9')](),controller['showSmsQueues']);router[_0xf8ee('0x8')](_0xf8ee('0x51'),auth[_0xf8ee('0x9')](),controller['showWhatsappQueues']);router[_0xf8ee('0x41')](_0xf8ee('0x52'),auth[_0xf8ee('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 8bfa2f3..10135f7 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 _0xd6d6=['capacity','Telephones','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','FaxQueues','showFaxQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','indexOf','SmsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','queue','MessageId','InteractionId','From','QueueId','create','Start','*,*,*,*','agentNotify','channel','capitalize','User','Agent\x20not\x20found','TransferReport','agentTransferTimeout','bluebird','moment','lodash','util','../../config/logger','api','jayson/promise','client','http','error','code','message','status','json','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','then','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','agent','internal'];(function(_0x4f14bd,_0x28b9db){var _0x515b8b=function(_0x523703){while(--_0x523703){_0x4f14bd['push'](_0x4f14bd['shift']());}};_0x515b8b(++_0x28b9db);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x479d7d,_0x36af63){_0x479d7d=_0x479d7d-0x0;var _0x6048c8=_0xd6d6[_0x479d7d];return _0x6048c8;};'use strict';var BPromise=require(_0x6d6d('0x0'));var moment=require(_0x6d6d('0x1'));var _=require(_0x6d6d('0x2'));var util=require(_0x6d6d('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x6d6d('0x4'))(_0x6d6d('0x5'));var jayson=require(_0x6d6d('0x6'));var amiClient=jayson[_0x6d6d('0x7')][_0x6d6d('0x8')]({'port':0x232a});var mailClient=jayson[_0x6d6d('0x7')][_0x6d6d('0x8')]({'port':0x232b});var routingClient=jayson['client'][_0x6d6d('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x1bf731,_0x44f83d,_0x18f824){return new BPromise(function(_0xd49f57,_0x408f88){var _0x3e69a4=_0x18f824?_0x18f824:amiClient;return _0x3e69a4['request'](_0x1bf731,_0x44f83d)['then'](function(_0x404c88){if(_0x404c88[_0x6d6d('0x9')]){if(_0x404c88[_0x6d6d('0x9')][_0x6d6d('0xa')]===0x1f4){return _0x408f88(_0x404c88[_0x6d6d('0x9')]['message']);}return _0xd49f57(_0x404c88[_0x6d6d('0x9')][_0x6d6d('0xb')]);}else{_0xd49f57(_0x404c88['result']);}})['catch'](function(_0x176618){_0x408f88(_0x176618);});});}function respondWithResult(_0x32146d,_0xe61c36){_0xe61c36=_0xe61c36||0xc8;return function(_0x3f8542){if(_0x3f8542){return _0x32146d[_0x6d6d('0xc')](_0xe61c36)[_0x6d6d('0xd')](_0x3f8542);}return _0x32146d[_0x6d6d('0xe')](0x194);};}function handleError(_0x2cb2dd,_0x5f4154){_0x5f4154=_0x5f4154||0x1f4;return function(_0xd09ea7){logger[_0x6d6d('0x9')](_0xd09ea7[_0x6d6d('0xf')]);if(_0xd09ea7[_0x6d6d('0x10')]){delete _0xd09ea7[_0x6d6d('0x10')];}_0x2cb2dd['status'](_0x5f4154)[_0x6d6d('0x11')](_0xd09ea7);};}function findById(_0x587338){return function(_0x27830d){if(!_[_0x6d6d('0x12')](_0x587338)&&!_[_0x6d6d('0x12')](_0x27830d)&&!_['isNil'](_0x27830d['rows'])){return _[_0x6d6d('0x13')](_0x27830d[_0x6d6d('0x14')],function(_0x2b59d4){return _0x2b59d4['id']==_0x587338;});}return null;};}exports[_0x6d6d('0x15')]=function(_0x51fff6,_0x554392){return respondWithRpcPromise(_0x6d6d('0x16'),_0x51fff6['query'])[_0x6d6d('0x17')](respondWithResult(_0x554392,null))[_0x6d6d('0x18')](handleError(_0x554392,null));};exports[_0x6d6d('0x19')]=function(_0x450352,_0x40d35b){return respondWithRpcPromise(_0x6d6d('0x1a'),_[_0x6d6d('0x1b')](_0x450352[_0x6d6d('0x1c')],_0x450352[_0x6d6d('0x1d')]))[_0x6d6d('0x17')](respondWithResult(_0x40d35b,null))[_0x6d6d('0x18')](handleError(_0x40d35b,null));};exports[_0x6d6d('0x1e')]=function(_0x466a29,_0x21b95d){return respondWithRpcPromise(_0x6d6d('0x1f'),_[_0x6d6d('0x1b')](_0x466a29[_0x6d6d('0x1c')],_0x466a29['params']))[_0x6d6d('0x17')](respondWithResult(_0x21b95d,null))[_0x6d6d('0x18')](handleError(_0x21b95d,null));};exports[_0x6d6d('0x20')]=function(_0x97ec9e,_0xf0df7f){return respondWithRpcPromise(_0x6d6d('0x21'),_0x97ec9e['query'])[_0x6d6d('0x17')](respondWithResult(_0xf0df7f,null))[_0x6d6d('0x18')](handleError(_0xf0df7f,null));};exports[_0x6d6d('0x22')]=function(_0x126ac8,_0x25c121){return respondWithRpcPromise(_0x6d6d('0x21'),_0x126ac8[_0x6d6d('0x1c')])['then'](findById(_0x126ac8[_0x6d6d('0x1d')]['id']))[_0x6d6d('0x17')](respondWithResult(_0x25c121,null))['catch'](handleError(_0x25c121,null));};exports['updateVoiceQueue']=function(_0x3edcce,_0x5273cd){return respondWithRpcPromise(_0x6d6d('0x23'),_['merge'](_0x3edcce[_0x6d6d('0x24')],_0x3edcce[_0x6d6d('0x1d')]))[_0x6d6d('0x17')](respondWithResult(_0x5273cd,null))[_0x6d6d('0x18')](handleError(_0x5273cd,null));};exports[_0x6d6d('0x25')]=function(_0x428c17,_0xdda3f2){return respondWithRpcPromise(_0x6d6d('0x26'),_[_0x6d6d('0x1b')](_0x428c17[_0x6d6d('0x1c')],_0x428c17['params']))[_0x6d6d('0x17')](respondWithResult(_0xdda3f2,null))['catch'](handleError(_0xdda3f2,null));};exports[_0x6d6d('0x27')]=function(_0x1ea9b2,_0xf527da){return respondWithRpcPromise(_0x6d6d('0x28'),_0x1ea9b2['query'])[_0x6d6d('0x17')](respondWithResult(_0xf527da,null))['catch'](handleError(_0xf527da,null));};exports[_0x6d6d('0x29')]=function(_0x219fd4,_0x5be8da){return respondWithRpcPromise(_0x6d6d('0x2a'),_[_0x6d6d('0x1b')](_0x219fd4[_0x6d6d('0x1c')],_0x219fd4[_0x6d6d('0x1d')]))[_0x6d6d('0x17')](respondWithResult(_0x5be8da,null))[_0x6d6d('0x18')](handleError(_0x5be8da,null));};exports[_0x6d6d('0x2b')]=function(_0x2d524d,_0x243555){return respondWithRpcPromise(_0x6d6d('0x2c'),_[_0x6d6d('0x1b')](_0x2d524d[_0x6d6d('0x1c')],_0x2d524d[_0x6d6d('0x1d')]))[_0x6d6d('0x17')](respondWithResult(_0x243555,null))['catch'](handleError(_0x243555,null));};exports[_0x6d6d('0x2d')]=function(_0xf98bfa,_0x3e2415){return respondWithRpcPromise(_0x6d6d('0x2e'),_['merge'](_0xf98bfa['query'],_0xf98bfa[_0x6d6d('0x1d')]))[_0x6d6d('0x17')](respondWithResult(_0x3e2415,null))[_0x6d6d('0x18')](handleError(_0x3e2415,null));};exports['outbound']=function(_0x2a3f67,_0x2607c1){return respondWithRpcPromise(_0x6d6d('0x2f'),_0x2a3f67[_0x6d6d('0x1c')])['then'](respondWithResult(_0x2607c1,null))['catch'](handleError(_0x2607c1,null));};exports['outboundChannels']=function(_0x62620d,_0x4196f0){return respondWithRpcPromise(_0x6d6d('0x30'),_0x62620d[_0x6d6d('0x1c')])['then'](respondWithResult(_0x4196f0,null))[_0x6d6d('0x18')](handleError(_0x4196f0,null));};exports[_0x6d6d('0x31')]=function(_0x344f6f,_0x3c6d23){var _0x3d632c;return respondWithRpcPromise(_0x6d6d('0x32'),_0x344f6f['query'])[_0x6d6d('0x17')](function(_0x3c7292){_0x3d632c=_0x3c7292;return respondWithRpcPromise(_0x6d6d('0x32'),_0x344f6f[_0x6d6d('0x1c')],routingClient);})[_0x6d6d('0x17')](function(_0x3e27b7){return _[_0x6d6d('0x1b')]({},_0x3e27b7,_0x3d632c);})['then'](respondWithResult(_0x3c6d23,null))[_0x6d6d('0x18')](handleError(_0x3c6d23,null));};exports[_0x6d6d('0x33')]=function(_0x16e177,_0x2107e0){if(_0x16e177[_0x6d6d('0x24')]&&_0x16e177['body'][_0x6d6d('0x34')]&&_0x16e177[_0x6d6d('0x35')]&&_0x16e177['user'][_0x6d6d('0x10')]){for(var _0x50dc17 in _0x16e177[_0x6d6d('0x24')][_0x6d6d('0x34')]){if(_0x16e177['body'][_0x6d6d('0x34')][_0x6d6d('0x36')](_0x50dc17)){db[_0x6d6d('0x37')][_0x6d6d('0x38')]({'where':{'channel':_0x50dc17,'membername':_0x16e177[_0x6d6d('0x35')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x16e177[_0x6d6d('0x24')]['interaction'][_0x50dc17]&&_0x16e177['body'][_0x6d6d('0x34')][_0x50dc17][_0x6d6d('0x39')]?{'$notIn':_0x16e177[_0x6d6d('0x24')]['interaction'][_0x50dc17]}:{'$ne':null}}})[_0x6d6d('0x17')](function(_0x4cff80){var _0x1a2d4c=moment()[_0x6d6d('0x3a')](_0x6d6d('0x3b'));for(var _0x4606eb=0x0,_0x75f298=_0x4cff80[_0x6d6d('0x39')];_0x4606eb<_0x75f298;_0x4606eb+=0x1){_0x4cff80[_0x4606eb][_0x6d6d('0x3c')]({'exitAt':_0x1a2d4c});}});for(var _0x5c0495=0x0;_0x5c0495<_0x16e177[_0x6d6d('0x24')][_0x6d6d('0x34')][_0x50dc17][_0x6d6d('0x39')];_0x5c0495+=0x1){db[_0x6d6d('0x37')][_0x6d6d('0x3d')]({'where':{'channel':_0x50dc17,'membername':_0x16e177[_0x6d6d('0x35')][_0x6d6d('0x10')],'type':_0x6d6d('0x3e'),'uniqueid':_0x16e177[_0x6d6d('0x24')]['interaction'][_0x50dc17][_0x5c0495],'exitAt':null},'defaults':{'channel':_0x50dc17,'membername':_0x16e177['user'][_0x6d6d('0x10')],'interface':_[_0x6d6d('0x12')](_0x16e177[_0x6d6d('0x35')][_0x6d6d('0x3f')])?util[_0x6d6d('0x3a')]('SIP/%s',_0x16e177[_0x6d6d('0x35')][_0x6d6d('0x10')]):_0x16e177[_0x6d6d('0x35')][_0x6d6d('0x3f')],'type':_0x6d6d('0x3e'),'enterAt':moment()[_0x6d6d('0x3a')](_0x6d6d('0x3b')),'role':_0x6d6d('0x40'),'internal':_0x16e177[_0x6d6d('0x35')][_0x6d6d('0x41')],'uniqueid':_0x16e177[_0x6d6d('0x24')][_0x6d6d('0x34')][_0x50dc17][_0x5c0495]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x16e177[_0x6d6d('0x1d')]['id'],'capacity':_0x16e177[_0x6d6d('0x24')][_0x6d6d('0x42')]},routingClient)[_0x6d6d('0x17')](respondWithResult(_0x2107e0,null))[_0x6d6d('0x18')](handleError(_0x2107e0,null));};exports['telephones']=function(_0x38c307,_0x36bc5a){return respondWithRpcPromise(_0x6d6d('0x43'),_0x38c307['query'])['then'](respondWithResult(_0x36bc5a,null))[_0x6d6d('0x18')](handleError(_0x36bc5a,null));};exports['trunks']=function(_0x3ea57e,_0x995fe2){return respondWithRpcPromise(_0x6d6d('0x44'),_0x3ea57e[_0x6d6d('0x1c')])[_0x6d6d('0x17')](respondWithResult(_0x995fe2,null))[_0x6d6d('0x18')](handleError(_0x995fe2,null));};exports[_0x6d6d('0x45')]=function(_0x26c23a,_0x1a8f33){return respondWithRpcPromise(_0x6d6d('0x46'),_0x26c23a['query'])[_0x6d6d('0x17')](respondWithResult(_0x1a8f33,null))[_0x6d6d('0x18')](handleError(_0x1a8f33,null));};exports[_0x6d6d('0x47')]=function(_0x8000b6,_0x1f98d4){return respondWithRpcPromise(_0x6d6d('0x48'),_0x8000b6[_0x6d6d('0x1c')],routingClient)['then'](respondWithResult(_0x1f98d4,null))['catch'](handleError(_0x1f98d4,null));};exports[_0x6d6d('0x49')]=function(_0x122865,_0x5cc644){return respondWithRpcPromise(_0x6d6d('0x48'),_0x122865[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](findById(_0x122865[_0x6d6d('0x1d')]['id']))[_0x6d6d('0x17')](respondWithResult(_0x5cc644,null))[_0x6d6d('0x18')](handleError(_0x5cc644,null));};exports[_0x6d6d('0x4a')]=function(_0x1ef7fb,_0x2abd8c){return respondWithRpcPromise(_0x6d6d('0x4b'),_0x1ef7fb[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](respondWithResult(_0x2abd8c,null))[_0x6d6d('0x18')](handleError(_0x2abd8c,null));};exports[_0x6d6d('0x4c')]=function(_0x3065ea,_0x50d8dd){return respondWithRpcPromise(_0x6d6d('0x4b'),_0x3065ea[_0x6d6d('0x1c')],routingClient)['then'](findById(_0x3065ea[_0x6d6d('0x1d')]['id']))[_0x6d6d('0x17')](respondWithResult(_0x50d8dd,null))[_0x6d6d('0x18')](handleError(_0x50d8dd,null));};exports[_0x6d6d('0x4d')]=function(_0x2d61cc,_0xd0a573){return respondWithRpcPromise(_0x6d6d('0x4e'),_0x2d61cc[_0x6d6d('0x1c')],mailClient)[_0x6d6d('0x17')](respondWithResult(_0xd0a573,null))['catch'](handleError(_0xd0a573,null));};exports['openchannelQueues']=function(_0x22c3a1,_0x325fe2){return respondWithRpcPromise(_0x6d6d('0x4f'),_0x22c3a1['query'],routingClient)['then'](respondWithResult(_0x325fe2,null))[_0x6d6d('0x18')](handleError(_0x325fe2,null));};exports['showOpenchannelQueues']=function(_0x30badc,_0x5b6f58){return respondWithRpcPromise(_0x6d6d('0x4f'),_0x30badc[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](findById(_0x30badc[_0x6d6d('0x1d')]['id']))[_0x6d6d('0x17')](respondWithResult(_0x5b6f58,null))[_0x6d6d('0x18')](handleError(_0x5b6f58,null));};exports['smsQueues']=function(_0x41e576,_0x5eb78f){return respondWithRpcPromise(_0x6d6d('0x50'),_0x41e576['query'],routingClient)[_0x6d6d('0x17')](respondWithResult(_0x5eb78f,null))[_0x6d6d('0x18')](handleError(_0x5eb78f,null));};exports[_0x6d6d('0x51')]=function(_0xa71db1,_0x29b68b){return respondWithRpcPromise(_0x6d6d('0x50'),_0xa71db1[_0x6d6d('0x1c')],routingClient)['then'](findById(_0xa71db1['params']['id']))[_0x6d6d('0x17')](respondWithResult(_0x29b68b,null))['catch'](handleError(_0x29b68b,null));};exports[_0x6d6d('0x52')]=function(_0x53b77a,_0xe19d23){return respondWithRpcPromise(_0x6d6d('0x53'),_0x53b77a[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](respondWithResult(_0xe19d23,null))[_0x6d6d('0x18')](handleError(_0xe19d23,null));};exports[_0x6d6d('0x54')]=function(_0x5dd3b0,_0x3cedc0){return respondWithRpcPromise(_0x6d6d('0x53'),_0x5dd3b0[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](findById(_0x5dd3b0[_0x6d6d('0x1d')]['id']))[_0x6d6d('0x17')](respondWithResult(_0x3cedc0,null))[_0x6d6d('0x18')](handleError(_0x3cedc0,null));};exports['faxQueues']=function(_0x3fa820,_0x4ec43e){return respondWithRpcPromise(_0x6d6d('0x55'),_0x3fa820[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](respondWithResult(_0x4ec43e,null))[_0x6d6d('0x18')](handleError(_0x4ec43e,null));};exports[_0x6d6d('0x56')]=function(_0x1d1d1d,_0x56feda){return respondWithRpcPromise(_0x6d6d('0x55'),_0x1d1d1d[_0x6d6d('0x1c')],routingClient)['then'](findById(_0x1d1d1d['params']['id']))[_0x6d6d('0x17')](respondWithResult(_0x56feda,null))['catch'](handleError(_0x56feda,null));};exports['faxAccounts']=function(_0x5b6ca7,_0x1e3b17){return respondWithRpcPromise(_0x6d6d('0x57'),_0x5b6ca7[_0x6d6d('0x1c')])[_0x6d6d('0x17')](respondWithResult(_0x1e3b17,null))[_0x6d6d('0x18')](handleError(_0x1e3b17,null));};exports[_0x6d6d('0x58')]=function(_0x4d4083,_0x48472d){return respondWithRpcPromise(_0x6d6d('0x59'),_0x4d4083['query'],routingClient)['then'](respondWithResult(_0x48472d,null))['catch'](handleError(_0x48472d,null));};exports[_0x6d6d('0x5a')]=function(_0x5cd494,_0x45a374){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x5cd494[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](respondWithResult(_0x45a374,null))['catch'](handleError(_0x45a374,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x167d0c,_0x202bf6){return respondWithRpcPromise(_0x6d6d('0x5b'),_0x167d0c[_0x6d6d('0x1c')],routingClient)['then'](respondWithResult(_0x202bf6,null))[_0x6d6d('0x18')](handleError(_0x202bf6,null));};exports[_0x6d6d('0x5c')]=function(_0x1fb21d,_0x2b53eb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1fb21d[_0x6d6d('0x1c')],routingClient)['then'](function(_0x4b6594){if(_0x1fb21d['query'][_0x6d6d('0x5d')]!==undefined){var _0x5bcfbd=_(_0x4b6594[_0x6d6d('0x14')])[_0x6d6d('0x5e')]([_0x1fb21d[_0x6d6d('0x1c')]['type'],_0x1fb21d['params']['id']])[_0x6d6d('0x5f')](_0x6d6d('0x60'))['uniq']()['value']();return _0x4b6594[_0x6d6d('0x14')][_0x6d6d('0x5e')](function(_0x14feba){return _0x5bcfbd[_0x6d6d('0x61')](_0x14feba[_0x6d6d('0x60')])>-0x1;});}else{return _0x4b6594[_0x6d6d('0x14')][_0x6d6d('0x5e')](function(_0x52f758){return _0x52f758['queue_id']===parseInt(_0x1fb21d['params']['id']);});}})['then'](respondWithResult(_0x2b53eb,null))['catch'](handleError(_0x2b53eb,null));};exports['smsQueuesWaitingInteractions']=function(_0x87dd34,_0x21e5a8){return respondWithRpcPromise(_0x6d6d('0x62'),_0x87dd34[_0x6d6d('0x1c')],routingClient)['then'](respondWithResult(_0x21e5a8,null))['catch'](handleError(_0x21e5a8,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x39b34e,_0xfbad7a){return respondWithRpcPromise(_0x6d6d('0x63'),_0x39b34e[_0x6d6d('0x1c')],routingClient)['then'](respondWithResult(_0xfbad7a,null))['catch'](handleError(_0xfbad7a,null));};exports[_0x6d6d('0x64')]=function(_0x1e1c4e,_0x478ed4){return respondWithRpcPromise(_0x6d6d('0x65'),_0x1e1c4e[_0x6d6d('0x1c')],routingClient)[_0x6d6d('0x17')](respondWithResult(_0x478ed4,null))[_0x6d6d('0x18')](handleError(_0x478ed4,null));};exports[_0x6d6d('0x66')]=function(_0x581027){return function(_0xf5586f,_0x50eea6){var _0x39f986,_0x5885c5;var _0x108108=_['capitalize'](_0x581027);var _0x445196=_0x581027===_0x6d6d('0x67')?_0x6d6d('0x68'):_0x6d6d('0x69');return db[_0x108108+_0x6d6d('0x6a')][_0x6d6d('0x6b')]({'raw':!![],'where':{'id':_0xf5586f[_0x6d6d('0x1d')]['id']}})[_0x6d6d('0x17')](function(_0x139a7){if(_[_0x6d6d('0x12')](_0x139a7)){throw new Error(_0x108108+_0x6d6d('0x6c'));}_0x39f986=_0x139a7;return db[_0x108108+_0x6d6d('0x6d')][_0x6d6d('0x6b')]({'where':{'id':_0xf5586f[_0x6d6d('0x24')][_0x6d6d('0x6e')]},'include':[{'model':db[_0x108108+_0x6d6d('0x6f')],'as':'Interaction'},{'model':db[_0x108108+_0x445196],'as':'Account'}]});})[_0x6d6d('0x17')](function(_0x5a7b23){if(_[_0x6d6d('0x12')](_0x5a7b23)){throw new Error(_0x108108+_0x6d6d('0x70'));}_0x5885c5=_0x5a7b23;return _0x5a7b23['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x1d2668={'uniqueid':_0x581027+'.'+_0x5885c5['id']+'.'+_0x5885c5['Interaction']['id'],'FromUserId':_0xf5586f[_0x6d6d('0x35')]['id'],'type':_0x6d6d('0x71')};_0x1d2668[_0x108108+_0x6d6d('0x72')]=_0x5885c5['id'];_0x1d2668[_0x108108+_0x6d6d('0x73')]=_0x5885c5[_0x6d6d('0x6f')]['id'];_0x1d2668[_0x6d6d('0x74')+_0x108108+_0x445196+'Id']=_0x5885c5[_0x6d6d('0x69')]['id'];_0x1d2668['To'+_0x108108+_0x6d6d('0x75')]=_0x39f986['id'];return db[_0x108108+'TransferReport'][_0x6d6d('0x76')](_0x1d2668);})[_0x6d6d('0x17')](function(){return respondWithRpcPromise(_0x6d6d('0x77'),{'channel':_0x581027,'interaction':_0x5885c5['Interaction'],'message':_0x5885c5,'account':_0x5885c5['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x6d6d('0x71'),'appdata':_0x39f986[_0x6d6d('0x10')]+','+(_0x5885c5[_0x6d6d('0x69')]['queueTransferTimeout']||0x12c),'interval':_0x6d6d('0x78')}]},routingClient);})[_0x6d6d('0x17')](respondWithResult(_0x50eea6,null))['catch'](handleError(_0x50eea6,null));};};exports[_0x6d6d('0x79')]=function(_0x721d98,_0xa8ec98){var _0x155edb,_0x21057d;if(_['isNil'](_0x721d98[_0x6d6d('0x24')][_0x6d6d('0x7a')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x56825d=_0x721d98[_0x6d6d('0x24')][_0x6d6d('0x7a')];var _0xe80727=_[_0x6d6d('0x7b')](_0x56825d);var _0x5a8974=_0x56825d===_0x6d6d('0x67')?'Website':_0x6d6d('0x69');return db[_0x6d6d('0x7c')][_0x6d6d('0x6b')]({'raw':!![],'where':{'id':_0x721d98[_0x6d6d('0x1d')]['id'],'role':_0x6d6d('0x40')}})[_0x6d6d('0x17')](function(_0x39c1a5){if(_[_0x6d6d('0x12')](_0x39c1a5)){throw new Error(_0x6d6d('0x7d'));}_0x155edb=_0x39c1a5;return db[_0xe80727+_0x6d6d('0x6d')][_0x6d6d('0x6b')]({'where':{'id':_0x721d98[_0x6d6d('0x24')][_0x6d6d('0x6e')]},'include':[{'model':db[_0xe80727+_0x6d6d('0x6f')],'as':_0x6d6d('0x6f')},{'model':db[_0xe80727+_0x5a8974],'as':_0x6d6d('0x69')}]});})[_0x6d6d('0x17')](function(_0xccbc07){if(_[_0x6d6d('0x12')](_0xccbc07)){throw new Error(_0xe80727+_0x6d6d('0x70'));}_0x21057d=_0xccbc07;return _0xccbc07['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3445f5={'uniqueid':_0x56825d+'.'+_0x21057d['id']+'.'+_0x21057d[_0x6d6d('0x6f')]['id'],'FromUserId':_0x721d98[_0x6d6d('0x35')]['id'],'type':_0x6d6d('0x71'),'ToUserId':_0x155edb['id']};_0x3445f5[_0xe80727+_0x6d6d('0x72')]=_0x21057d['id'];_0x3445f5[_0xe80727+_0x6d6d('0x73')]=_0x21057d[_0x6d6d('0x6f')]['id'];_0x3445f5[_0x6d6d('0x74')+_0xe80727+_0x5a8974+'Id']=_0x21057d[_0x6d6d('0x69')]['id'];return db[_0xe80727+_0x6d6d('0x7e')][_0x6d6d('0x76')](_0x3445f5);})[_0x6d6d('0x17')](function(){return respondWithRpcPromise(_0x6d6d('0x77'),{'channel':_0x56825d,'interaction':_0x21057d[_0x6d6d('0x6f')],'message':_0x21057d,'account':_0x21057d[_0x6d6d('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x155edb[_0x6d6d('0x10')]+','+(_0x21057d[_0x6d6d('0x69')][_0x6d6d('0x7f')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0xa8ec98,null))['catch'](handleError(_0xa8ec98,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(_0x442b41,_0x22dc53){var _0x140d06=function(_0x5afa6d){while(--_0x5afa6d){_0x442b41['push'](_0x442b41['shift']());}};_0x140d06(++_0x22dc53);}(_0xabce,0x103));var _0xeabc=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xabce[_0x311c35];return _0x5cc50c;};'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 6f96484..98426be 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 _0x49b3=['get','/:id','show','/:id/run','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./schedule.controller','isAuthenticated','index'];(function(_0x5cec25,_0x183dfe){var _0x2e221a=function(_0x4a721a){while(--_0x4a721a){_0x5cec25['push'](_0x5cec25['shift']());}};_0x2e221a(++_0x183dfe);}(_0x49b3,0x11b));var _0x349b=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x49b3[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x349b('0x0'));var util=require(_0x349b('0x1'));var path=require(_0x349b('0x2'));var timeout=require(_0x349b('0x3'));var express=require(_0x349b('0x4'));var router=express[_0x349b('0x5')]();var fs_extra=require(_0x349b('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x349b('0x7'));var config=require('../../config/environment');var controller=require(_0x349b('0x8'));router['get']('/',auth[_0x349b('0x9')](),controller[_0x349b('0xa')]);router[_0x349b('0xb')](_0x349b('0xc'),auth[_0x349b('0x9')](),controller[_0x349b('0xd')]);router[_0x349b('0xb')](_0x349b('0xe'),auth[_0x349b('0x9')](),controller['run']);router[_0x349b('0xf')]('/',auth[_0x349b('0x9')](),controller[_0x349b('0x10')]);router[_0x349b('0x11')](_0x349b('0xc'),auth[_0x349b('0x9')](),controller[_0x349b('0x12')]);router[_0x349b('0x13')](_0x349b('0xc'),auth[_0x349b('0x9')](),controller['destroy']);module[_0x349b('0x14')]=router; \ No newline at end of file +var _0xc38b=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run','run','post','create','put','update','delete','exports','multer'];(function(_0x34be36,_0x31a0ae){var _0x238730=function(_0x4369fb){while(--_0x4369fb){_0x34be36['push'](_0x34be36['shift']());}};_0x238730(++_0x31a0ae);}(_0xc38b,0x1df));var _0xbc38=function(_0x55ce99,_0x188012){_0x55ce99=_0x55ce99-0x0;var _0x4b05d7=_0xc38b[_0x55ce99];return _0x4b05d7;};'use strict';var multer=require(_0xbc38('0x0'));var util=require(_0xbc38('0x1'));var path=require('path');var timeout=require(_0xbc38('0x2'));var express=require(_0xbc38('0x3'));var router=express[_0xbc38('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbc38('0x5'));var interaction=require(_0xbc38('0x6'));var config=require('../../config/environment');var controller=require(_0xbc38('0x7'));router[_0xbc38('0x8')]('/',auth[_0xbc38('0x9')](),controller[_0xbc38('0xa')]);router[_0xbc38('0x8')](_0xbc38('0xb'),auth[_0xbc38('0x9')](),controller['show']);router[_0xbc38('0x8')](_0xbc38('0xc'),auth['isAuthenticated'](),controller[_0xbc38('0xd')]);router[_0xbc38('0xe')]('/',auth[_0xbc38('0x9')](),controller[_0xbc38('0xf')]);router[_0xbc38('0x10')](_0xbc38('0xb'),auth[_0xbc38('0x9')](),controller[_0xbc38('0x11')]);router[_0xbc38('0x12')](_0xbc38('0xb'),auth[_0xbc38('0x9')](),controller['destroy']);module[_0xbc38('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 466619c..4864602 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 _0xfad2=['custom','default','STRING','TEXT','sequelize','exports','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','weeks','days','hours','minutes','csv','pdf','xlsx'];(function(_0x5b6f2c,_0x1f6ad3){var _0x5e0fb5=function(_0x270a2d){while(--_0x270a2d){_0x5b6f2c['push'](_0x5b6f2c['shift']());}};_0x5e0fb5(++_0x1f6ad3);}(_0xfad2,0x10e));var _0x2fad=function(_0x32f826,_0x209f22){_0x32f826=_0x32f826-0x0;var _0x180492=_0xfad2[_0x32f826];return _0x180492;};'use strict';var Sequelize=require(_0x2fad('0x0'));module[_0x2fad('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x2fad('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x2fad('0x3')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0x2fad('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x2fad('0x5')](_0x2fad('0x6'),_0x2fad('0x7'),'months',_0x2fad('0x8'),_0x2fad('0x9'),_0x2fad('0xa'),_0x2fad('0xb')),'allowNull':![],'defaultValue':_0x2fad('0x9')},'output':{'type':Sequelize[_0x2fad('0x5')](_0x2fad('0xc'),_0x2fad('0xd'),_0x2fad('0xe')),'allowNull':![],'defaultValue':_0x2fad('0xc')},'type':{'type':Sequelize[_0x2fad('0x5')](_0x2fad('0xf'),_0x2fad('0x10')),'allowNull':![],'defaultValue':_0x2fad('0xf')},'sendMail':{'type':Sequelize[_0x2fad('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x2fad('0x11')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x2fad('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x2fad('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7a71=['weeks','days','hours','minutes','ENUM','csv','pdf','xlsx','default','custom','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','years','quarters','months'];(function(_0x1ac4a6,_0x48e358){var _0x570508=function(_0x27f071){while(--_0x27f071){_0x1ac4a6['push'](_0x1ac4a6['shift']());}};_0x570508(++_0x48e358);}(_0x7a71,0x122));var _0x17a7=function(_0x336fa0,_0x4e8281){_0x336fa0=_0x336fa0-0x0;var _0x4d1399=_0x7a71[_0x336fa0];return _0x4d1399;};'use strict';var Sequelize=require(_0x17a7('0x0'));module[_0x17a7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x17a7('0x2')]},'active':{'type':Sequelize[_0x17a7('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x17a7('0x4')},'startAt':{'type':Sequelize[_0x17a7('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x17a7('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x17a7('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x17a7('0x7'),_0x17a7('0x8'),_0x17a7('0x9'),_0x17a7('0xa'),_0x17a7('0xb'),_0x17a7('0xc'),_0x17a7('0xd')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x17a7('0xe')](_0x17a7('0xf'),_0x17a7('0x10'),_0x17a7('0x11')),'allowNull':![],'defaultValue':_0x17a7('0xf')},'type':{'type':Sequelize[_0x17a7('0xe')]('custom',_0x17a7('0x12')),'allowNull':![],'defaultValue':_0x17a7('0x13')},'sendMail':{'type':Sequelize[_0x17a7('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x17a7('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x17a7('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 b479e2f..1ca12b5 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 _0xec06=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','save','update','then','destroy','get','Scheduler','UserProfileResource','error','map','rawAttributes','type','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','Schedule','count','findAll','catch','show','includeAll','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x4639d7,_0x2e3b56){var _0x369329=function(_0x469c37){while(--_0x469c37){_0x4639d7['push'](_0x4639d7['shift']());}};_0x369329(++_0x2e3b56);}(_0xec06,0x1b1));var _0x6ec0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec06[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x6ec0('0x0'));var rimraf=require(_0x6ec0('0x1'));var zipdir=require(_0x6ec0('0x2'));var jsonpatch=require(_0x6ec0('0x3'));var rp=require(_0x6ec0('0x4'));var moment=require(_0x6ec0('0x5'));var BPromise=require(_0x6ec0('0x6'));var Mustache=require(_0x6ec0('0x7'));var util=require(_0x6ec0('0x8'));var path=require(_0x6ec0('0x9'));var sox=require('sox');var csv=require(_0x6ec0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ec0('0xb'));var squel=require(_0x6ec0('0xc'));var crypto=require(_0x6ec0('0xd'));var jsforce=require(_0x6ec0('0xe'));var deskjs=require(_0x6ec0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6ec0('0x10'));var Papa=require(_0x6ec0('0x11'));var Redis=require(_0x6ec0('0x12'));var authService=require(_0x6ec0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6ec0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ec0('0x15'))(_0x6ec0('0x16'));var utils=require(_0x6ec0('0x17'));var config=require(_0x6ec0('0x18'));var licenseUtil=require(_0x6ec0('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11f0e4,_0x5a29ec){_0x5a29ec=_0x5a29ec||0xcc;return function(_0x84a971){if(_0x84a971){return _0x11f0e4[_0x6ec0('0x1a')](_0x5a29ec);}return _0x11f0e4[_0x6ec0('0x1b')](_0x5a29ec)[_0x6ec0('0x1c')]();};}function respondWithResult(_0x26e45e,_0x4cce9f){_0x4cce9f=_0x4cce9f||0xc8;return function(_0x29dbdd){if(_0x29dbdd){return _0x26e45e[_0x6ec0('0x1b')](_0x4cce9f)['json'](_0x29dbdd);}};}function respondWithFilteredResult(_0x3230a3,_0x293e8a){return function(_0x558c17){if(_0x558c17){var _0x4a56a6=typeof _0x293e8a[_0x6ec0('0x1d')]===_0x6ec0('0x1e')&&typeof _0x293e8a[_0x6ec0('0x1f')]===_0x6ec0('0x1e');var _0x133e9d=_0x558c17['count'];var _0x245a3a=_0x4a56a6?0x0:_0x293e8a['offset'];var _0x3e9686=_0x4a56a6?_0x558c17['count']:_0x293e8a[_0x6ec0('0x1d')]+_0x293e8a[_0x6ec0('0x1f')];var _0x16c71d;if(_0x3e9686>=_0x133e9d){_0x3e9686=_0x133e9d;_0x16c71d=0xc8;}else{_0x16c71d=0xce;}_0x3230a3[_0x6ec0('0x1b')](_0x16c71d);return _0x3230a3[_0x6ec0('0x20')]('Content-Range',_0x245a3a+'-'+_0x3e9686+'/'+_0x133e9d)[_0x6ec0('0x21')](_0x558c17);}return null;};}function patchUpdates(_0x5baf44){return function(_0x365d92){try{jsonpatch[_0x6ec0('0x22')](_0x365d92,_0x5baf44,!![]);}catch(_0x3b1fbd){return BPromise[_0x6ec0('0x23')](_0x3b1fbd);}return _0x365d92[_0x6ec0('0x24')]();};}function saveUpdates(_0x4c1621,_0x41891c){return function(_0x344cb2){if(_0x344cb2){return _0x344cb2[_0x6ec0('0x25')](_0x4c1621)[_0x6ec0('0x26')](function(_0x56da7a){return _0x56da7a;});}return null;};}function removeEntity(_0x45ae09,_0x3f51b9){return function(_0x110972){if(_0x110972){return _0x110972[_0x6ec0('0x27')]()[_0x6ec0('0x26')](function(){var _0x334171=_0x110972[_0x6ec0('0x28')]({'plain':!![]});var _0x25aa57=_0x6ec0('0x29');return db[_0x6ec0('0x2a')][_0x6ec0('0x27')]({'where':{'type':_0x25aa57,'resourceId':_0x334171['id']}})['then'](function(){return _0x110972;});})[_0x6ec0('0x26')](function(){_0x45ae09[_0x6ec0('0x1b')](0xcc)[_0x6ec0('0x1c')]();});}};}function handleEntityNotFound(_0x481ef5,_0x4376fb){return function(_0x113dd7){if(!_0x113dd7){_0x481ef5[_0x6ec0('0x1a')](0x194);}return _0x113dd7;};}function handleError(_0x72bc2f,_0x55289f){_0x55289f=_0x55289f||0x1f4;return function(_0x24aba6){logger[_0x6ec0('0x2b')](_0x24aba6['stack']);if(_0x24aba6['name']){delete _0x24aba6['name'];}_0x72bc2f[_0x6ec0('0x1b')](_0x55289f)['send'](_0x24aba6);};}exports['index']=function(_0x401769,_0x2b08ad){var _0x3e301e={},_0x4064dd={},_0x21b75d={'count':0x0,'rows':[]};var _0x58bf45=_[_0x6ec0('0x2c')](db['Schedule'][_0x6ec0('0x2d')],function(_0x590c33){return{'name':_0x590c33['fieldName'],'type':_0x590c33[_0x6ec0('0x2e')]['key']};});_0x4064dd[_0x6ec0('0x2f')]=_[_0x6ec0('0x2c')](_0x58bf45,_0x6ec0('0x30'));_0x4064dd['query']=_[_0x6ec0('0x31')](_0x401769[_0x6ec0('0x32')]);_0x4064dd[_0x6ec0('0x33')]=_[_0x6ec0('0x34')](_0x4064dd[_0x6ec0('0x2f')],_0x4064dd[_0x6ec0('0x32')]);_0x3e301e[_0x6ec0('0x35')]=_['intersection'](_0x4064dd[_0x6ec0('0x2f')],qs['fields'](_0x401769[_0x6ec0('0x32')][_0x6ec0('0x36')]));_0x3e301e[_0x6ec0('0x35')]=_0x3e301e[_0x6ec0('0x35')][_0x6ec0('0x37')]?_0x3e301e[_0x6ec0('0x35')]:_0x4064dd[_0x6ec0('0x2f')];if(!_0x401769[_0x6ec0('0x32')][_0x6ec0('0x38')]('nolimit')){_0x3e301e[_0x6ec0('0x1f')]=qs['limit'](_0x401769[_0x6ec0('0x32')][_0x6ec0('0x1f')]);_0x3e301e['offset']=qs[_0x6ec0('0x1d')](_0x401769[_0x6ec0('0x32')][_0x6ec0('0x1d')]);}_0x3e301e[_0x6ec0('0x39')]=qs['sort'](_0x401769[_0x6ec0('0x32')][_0x6ec0('0x3a')]);_0x3e301e[_0x6ec0('0x3b')]=qs[_0x6ec0('0x33')](_[_0x6ec0('0x3c')](_0x401769[_0x6ec0('0x32')],_0x4064dd[_0x6ec0('0x33')]),_0x58bf45);if(_0x401769[_0x6ec0('0x32')]['filter']){_0x3e301e[_0x6ec0('0x3b')]=_[_0x6ec0('0x3d')](_0x3e301e['where'],{'$or':_[_0x6ec0('0x2c')](_0x58bf45,function(_0x183dc2){if(_0x183dc2[_0x6ec0('0x2e')]!==_0x6ec0('0x3e')){var _0x1c897b={};_0x1c897b[_0x183dc2[_0x6ec0('0x30')]]={'$like':'%'+_0x401769[_0x6ec0('0x32')][_0x6ec0('0x3f')]+'%'};return _0x1c897b;}})});}_0x3e301e=_[_0x6ec0('0x3d')]({},_0x3e301e,_0x401769[_0x6ec0('0x40')]);var _0x5d86fc={'where':_0x3e301e[_0x6ec0('0x3b')]};return db[_0x6ec0('0x41')]['count'](_0x5d86fc)[_0x6ec0('0x26')](function(_0x42974b){_0x21b75d[_0x6ec0('0x42')]=_0x42974b;if(_0x401769[_0x6ec0('0x32')]['includeAll']){_0x3e301e['include']=[{'all':!![]}];}return db[_0x6ec0('0x41')][_0x6ec0('0x43')](_0x3e301e);})[_0x6ec0('0x26')](function(_0x23f260){_0x21b75d['rows']=_0x23f260;return _0x21b75d;})[_0x6ec0('0x26')](respondWithFilteredResult(_0x2b08ad,_0x3e301e))[_0x6ec0('0x44')](handleError(_0x2b08ad,null));};exports[_0x6ec0('0x45')]=function(_0x46ee87,_0x11c16f){var _0x30aa1a={'raw':![],'where':{'id':_0x46ee87['params']['id']}},_0x5c1fdc={};_0x5c1fdc[_0x6ec0('0x2f')]=_['keys'](db[_0x6ec0('0x41')][_0x6ec0('0x2d')]);_0x5c1fdc[_0x6ec0('0x32')]=_[_0x6ec0('0x31')](_0x46ee87[_0x6ec0('0x32')]);_0x5c1fdc[_0x6ec0('0x33')]=_['intersection'](_0x5c1fdc['model'],_0x5c1fdc[_0x6ec0('0x32')]);_0x30aa1a[_0x6ec0('0x35')]=_[_0x6ec0('0x34')](_0x5c1fdc[_0x6ec0('0x2f')],qs['fields'](_0x46ee87[_0x6ec0('0x32')][_0x6ec0('0x36')]));_0x30aa1a[_0x6ec0('0x35')]=_0x30aa1a[_0x6ec0('0x35')]['length']?_0x30aa1a[_0x6ec0('0x35')]:_0x5c1fdc[_0x6ec0('0x2f')];if(_0x46ee87[_0x6ec0('0x32')][_0x6ec0('0x46')]){_0x30aa1a[_0x6ec0('0x47')]=[{'all':!![]}];}_0x30aa1a=_['merge']({},_0x30aa1a,_0x46ee87[_0x6ec0('0x40')]);return db[_0x6ec0('0x41')][_0x6ec0('0x48')](_0x30aa1a)[_0x6ec0('0x26')](handleEntityNotFound(_0x11c16f,null))[_0x6ec0('0x26')](respondWithResult(_0x11c16f,null))['catch'](handleError(_0x11c16f,null));};exports[_0x6ec0('0x49')]=function(_0x113df4,_0x28c2d7){return db[_0x6ec0('0x41')]['create'](_0x113df4['body'],{})[_0x6ec0('0x26')](function(_0x2096cf){var _0x4e40db=_0x113df4[_0x6ec0('0x4a')][_0x6ec0('0x28')]({'plain':!![]});if(!_0x4e40db)throw new Error(_0x6ec0('0x4b'));if(_0x4e40db[_0x6ec0('0x4c')]===_0x6ec0('0x4a')){var _0x169972=_0x2096cf[_0x6ec0('0x28')]({'plain':!![]});var _0x2cab10=_0x6ec0('0x29');return db[_0x6ec0('0x4d')][_0x6ec0('0x48')]({'where':{'name':_0x2cab10,'userProfileId':_0x4e40db[_0x6ec0('0x4e')]},'raw':!![]})[_0x6ec0('0x26')](function(_0x2ece18){if(_0x2ece18&&_0x2ece18[_0x6ec0('0x4f')]===0x0){return db[_0x6ec0('0x2a')][_0x6ec0('0x49')]({'name':_0x169972[_0x6ec0('0x30')],'resourceId':_0x169972['id'],'type':_0x2ece18[_0x6ec0('0x30')],'sectionId':_0x2ece18['id']},{})['then'](function(){return _0x2096cf;});}else{return _0x2096cf;}})[_0x6ec0('0x44')](function(_0x32bf0b){logger['error'](_0x6ec0('0x50'),_0x32bf0b);throw _0x32bf0b;});}return _0x2096cf;})[_0x6ec0('0x26')](respondWithResult(_0x28c2d7,0xc9))[_0x6ec0('0x44')](handleError(_0x28c2d7,null));};exports[_0x6ec0('0x25')]=function(_0x15b614,_0x4f9a33){if(_0x15b614[_0x6ec0('0x51')]['id']){delete _0x15b614['body']['id'];}return db[_0x6ec0('0x41')][_0x6ec0('0x48')]({'where':{'id':_0x15b614['params']['id']}})[_0x6ec0('0x26')](handleEntityNotFound(_0x4f9a33,null))[_0x6ec0('0x26')](saveUpdates(_0x15b614['body'],null))[_0x6ec0('0x26')](respondWithResult(_0x4f9a33,null))[_0x6ec0('0x44')](handleError(_0x4f9a33,null));};exports['destroy']=function(_0x5d19b5,_0x272530){return db[_0x6ec0('0x41')][_0x6ec0('0x48')]({'where':{'id':_0x5d19b5[_0x6ec0('0x52')]['id']}})[_0x6ec0('0x26')](handleEntityNotFound(_0x272530,null))[_0x6ec0('0x26')](removeEntity(_0x272530,null))['catch'](handleError(_0x272530,null));};exports[_0x6ec0('0x53')]=function(_0x3f6df8,_0x2d9eed,_0x3413a6){var _0x443b3e=require(_0x6ec0('0x54'));return db[_0x6ec0('0x41')]['find']({'where':{'id':_0x3f6df8[_0x6ec0('0x52')]['id']},'raw':!![]})[_0x6ec0('0x26')](handleEntityNotFound(_0x2d9eed,null))[_0x6ec0('0x26')](function(){_0x443b3e[_0x6ec0('0x53')](_0x3f6df8[_0x6ec0('0x52')]['id']);})[_0x6ec0('0x26')](respondWithStatusCode(_0x2d9eed,null))['catch'](handleError(_0x2d9eed,null));}; \ No newline at end of file +var _0xbd2f=['stack','name','send','map','Schedule','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','filters','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','Scheduler','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','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','sendStatus','error'];(function(_0x35bf16,_0x14e83f){var _0x159527=function(_0x1d715c){while(--_0x1d715c){_0x35bf16['push'](_0x35bf16['shift']());}};_0x159527(++_0x14e83f);}(_0xbd2f,0xea));var _0xfbd2=function(_0x581b68,_0xe59a0){_0x581b68=_0x581b68-0x0;var _0x214ea0=_0xbd2f[_0x581b68];return _0x214ea0;};'use strict';var emlformat=require(_0xfbd2('0x0'));var rimraf=require(_0xfbd2('0x1'));var zipdir=require(_0xfbd2('0x2'));var jsonpatch=require(_0xfbd2('0x3'));var rp=require('request-promise');var moment=require(_0xfbd2('0x4'));var BPromise=require(_0xfbd2('0x5'));var Mustache=require('mustache');var util=require(_0xfbd2('0x6'));var path=require(_0xfbd2('0x7'));var sox=require(_0xfbd2('0x8'));var csv=require(_0xfbd2('0x9'));var ejs=require(_0xfbd2('0xa'));var fs=require('fs');var fs_extra=require(_0xfbd2('0xb'));var _=require(_0xfbd2('0xc'));var squel=require(_0xfbd2('0xd'));var crypto=require(_0xfbd2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfbd2('0xf'));var toCsv=require(_0xfbd2('0x9'));var querystring=require(_0xfbd2('0x10'));var Papa=require(_0xfbd2('0x11'));var Redis=require(_0xfbd2('0x12'));var authService=require(_0xfbd2('0x13'));var qs=require(_0xfbd2('0x14'));var as=require(_0xfbd2('0x15'));var hardwareService=require(_0xfbd2('0x16'));var logger=require(_0xfbd2('0x17'))('api');var utils=require(_0xfbd2('0x18'));var config=require(_0xfbd2('0x19'));var licenseUtil=require(_0xfbd2('0x1a'));var db=require(_0xfbd2('0x1b'))['db'];function respondWithStatusCode(_0x22ea75,_0x122854){_0x122854=_0x122854||0xcc;return function(_0x51a7b9){if(_0x51a7b9){return _0x22ea75['sendStatus'](_0x122854);}return _0x22ea75[_0xfbd2('0x1c')](_0x122854)[_0xfbd2('0x1d')]();};}function respondWithResult(_0x2d0bb5,_0x414a02){_0x414a02=_0x414a02||0xc8;return function(_0x414ccf){if(_0x414ccf){return _0x2d0bb5[_0xfbd2('0x1c')](_0x414a02)[_0xfbd2('0x1e')](_0x414ccf);}};}function respondWithFilteredResult(_0x330265,_0x16a955){return function(_0x92d970){if(_0x92d970){var _0x32715a=typeof _0x16a955[_0xfbd2('0x1f')]===_0xfbd2('0x20')&&typeof _0x16a955[_0xfbd2('0x21')]===_0xfbd2('0x20');var _0x4c74a1=_0x92d970[_0xfbd2('0x22')];var _0x1a69fa=_0x32715a?0x0:_0x16a955['offset'];var _0x43d301=_0x32715a?_0x92d970[_0xfbd2('0x22')]:_0x16a955[_0xfbd2('0x1f')]+_0x16a955['limit'];var _0x2dc229;if(_0x43d301>=_0x4c74a1){_0x43d301=_0x4c74a1;_0x2dc229=0xc8;}else{_0x2dc229=0xce;}_0x330265[_0xfbd2('0x1c')](_0x2dc229);return _0x330265['set'](_0xfbd2('0x23'),_0x1a69fa+'-'+_0x43d301+'/'+_0x4c74a1)['json'](_0x92d970);}return null;};}function patchUpdates(_0x350596){return function(_0x144f98){try{jsonpatch[_0xfbd2('0x24')](_0x144f98,_0x350596,!![]);}catch(_0x3bb766){return BPromise[_0xfbd2('0x25')](_0x3bb766);}return _0x144f98[_0xfbd2('0x26')]();};}function saveUpdates(_0x27040c,_0x2f0499){return function(_0x527ea5){if(_0x527ea5){return _0x527ea5[_0xfbd2('0x27')](_0x27040c)[_0xfbd2('0x28')](function(_0x5e7f9f){return _0x5e7f9f;});}return null;};}function removeEntity(_0x5a9124,_0x264f4a){return function(_0x7d2d9d){if(_0x7d2d9d){return _0x7d2d9d[_0xfbd2('0x29')]()[_0xfbd2('0x28')](function(){var _0x2a1a19=_0x7d2d9d['get']({'plain':!![]});var _0x2efffb='Scheduler';return db[_0xfbd2('0x2a')][_0xfbd2('0x29')]({'where':{'type':_0x2efffb,'resourceId':_0x2a1a19['id']}})[_0xfbd2('0x28')](function(){return _0x7d2d9d;});})[_0xfbd2('0x28')](function(){_0x5a9124['status'](0xcc)[_0xfbd2('0x1d')]();});}};}function handleEntityNotFound(_0xcea0db,_0x16ed09){return function(_0x11a67f){if(!_0x11a67f){_0xcea0db[_0xfbd2('0x2b')](0x194);}return _0x11a67f;};}function handleError(_0x44c34c,_0x55a606){_0x55a606=_0x55a606||0x1f4;return function(_0x35ea72){logger[_0xfbd2('0x2c')](_0x35ea72[_0xfbd2('0x2d')]);if(_0x35ea72[_0xfbd2('0x2e')]){delete _0x35ea72[_0xfbd2('0x2e')];}_0x44c34c['status'](_0x55a606)[_0xfbd2('0x2f')](_0x35ea72);};}exports['index']=function(_0x14b575,_0x1a60da){var _0x43c01f={},_0x34d096={},_0x1141c8={'count':0x0,'rows':[]};var _0x839fc4=_[_0xfbd2('0x30')](db[_0xfbd2('0x31')][_0xfbd2('0x32')],function(_0x24301c){return{'name':_0x24301c[_0xfbd2('0x33')],'type':_0x24301c[_0xfbd2('0x34')][_0xfbd2('0x35')]};});_0x34d096[_0xfbd2('0x36')]=_[_0xfbd2('0x30')](_0x839fc4,_0xfbd2('0x2e'));_0x34d096['query']=_[_0xfbd2('0x37')](_0x14b575[_0xfbd2('0x38')]);_0x34d096['filters']=_[_0xfbd2('0x39')](_0x34d096['model'],_0x34d096[_0xfbd2('0x38')]);_0x43c01f[_0xfbd2('0x3a')]=_[_0xfbd2('0x39')](_0x34d096[_0xfbd2('0x36')],qs[_0xfbd2('0x3b')](_0x14b575[_0xfbd2('0x38')][_0xfbd2('0x3b')]));_0x43c01f[_0xfbd2('0x3a')]=_0x43c01f['attributes'][_0xfbd2('0x3c')]?_0x43c01f['attributes']:_0x34d096[_0xfbd2('0x36')];if(!_0x14b575['query'][_0xfbd2('0x3d')](_0xfbd2('0x3e'))){_0x43c01f['limit']=qs[_0xfbd2('0x21')](_0x14b575[_0xfbd2('0x38')]['limit']);_0x43c01f[_0xfbd2('0x1f')]=qs[_0xfbd2('0x1f')](_0x14b575[_0xfbd2('0x38')][_0xfbd2('0x1f')]);}_0x43c01f[_0xfbd2('0x3f')]=qs[_0xfbd2('0x40')](_0x14b575['query'][_0xfbd2('0x40')]);_0x43c01f[_0xfbd2('0x41')]=qs['filters'](_[_0xfbd2('0x42')](_0x14b575[_0xfbd2('0x38')],_0x34d096['filters']),_0x839fc4);if(_0x14b575['query'][_0xfbd2('0x43')]){_0x43c01f[_0xfbd2('0x41')]=_[_0xfbd2('0x44')](_0x43c01f[_0xfbd2('0x41')],{'$or':_[_0xfbd2('0x30')](_0x839fc4,function(_0x31f75a){if(_0x31f75a['type']!==_0xfbd2('0x45')){var _0x4ab2c0={};_0x4ab2c0[_0x31f75a[_0xfbd2('0x2e')]]={'$like':'%'+_0x14b575[_0xfbd2('0x38')][_0xfbd2('0x43')]+'%'};return _0x4ab2c0;}})});}_0x43c01f=_['merge']({},_0x43c01f,_0x14b575[_0xfbd2('0x46')]);var _0x2f6782={'where':_0x43c01f[_0xfbd2('0x41')]};return db[_0xfbd2('0x31')][_0xfbd2('0x22')](_0x2f6782)['then'](function(_0x25c2de){_0x1141c8['count']=_0x25c2de;if(_0x14b575[_0xfbd2('0x38')][_0xfbd2('0x47')]){_0x43c01f[_0xfbd2('0x48')]=[{'all':!![]}];}return db[_0xfbd2('0x31')][_0xfbd2('0x49')](_0x43c01f);})[_0xfbd2('0x28')](function(_0x15dce2){_0x1141c8[_0xfbd2('0x4a')]=_0x15dce2;return _0x1141c8;})[_0xfbd2('0x28')](respondWithFilteredResult(_0x1a60da,_0x43c01f))[_0xfbd2('0x4b')](handleError(_0x1a60da,null));};exports[_0xfbd2('0x4c')]=function(_0x237493,_0xd14d61){var _0x38b6ef={'raw':![],'where':{'id':_0x237493['params']['id']}},_0x4af8c8={};_0x4af8c8[_0xfbd2('0x36')]=_['keys'](db['Schedule']['rawAttributes']);_0x4af8c8[_0xfbd2('0x38')]=_[_0xfbd2('0x37')](_0x237493[_0xfbd2('0x38')]);_0x4af8c8[_0xfbd2('0x4d')]=_[_0xfbd2('0x39')](_0x4af8c8['model'],_0x4af8c8[_0xfbd2('0x38')]);_0x38b6ef[_0xfbd2('0x3a')]=_['intersection'](_0x4af8c8[_0xfbd2('0x36')],qs[_0xfbd2('0x3b')](_0x237493[_0xfbd2('0x38')][_0xfbd2('0x3b')]));_0x38b6ef[_0xfbd2('0x3a')]=_0x38b6ef[_0xfbd2('0x3a')][_0xfbd2('0x3c')]?_0x38b6ef[_0xfbd2('0x3a')]:_0x4af8c8[_0xfbd2('0x36')];if(_0x237493[_0xfbd2('0x38')][_0xfbd2('0x47')]){_0x38b6ef[_0xfbd2('0x48')]=[{'all':!![]}];}_0x38b6ef=_[_0xfbd2('0x44')]({},_0x38b6ef,_0x237493['options']);return db['Schedule'][_0xfbd2('0x4e')](_0x38b6ef)[_0xfbd2('0x28')](handleEntityNotFound(_0xd14d61,null))['then'](respondWithResult(_0xd14d61,null))[_0xfbd2('0x4b')](handleError(_0xd14d61,null));};exports['create']=function(_0x2b23c2,_0x39be2e){return db[_0xfbd2('0x31')][_0xfbd2('0x4f')](_0x2b23c2[_0xfbd2('0x50')],{})[_0xfbd2('0x28')](function(_0x4c5985){var _0x554044=_0x2b23c2['user']['get']({'plain':!![]});if(!_0x554044)throw new Error(_0xfbd2('0x51'));if(_0x554044[_0xfbd2('0x52')]===_0xfbd2('0x53')){var _0x20783b=_0x4c5985[_0xfbd2('0x54')]({'plain':!![]});var _0x1248d9=_0xfbd2('0x55');return db[_0xfbd2('0x56')][_0xfbd2('0x4e')]({'where':{'name':_0x1248d9,'userProfileId':_0x554044[_0xfbd2('0x57')]},'raw':!![]})[_0xfbd2('0x28')](function(_0x3346c9){if(_0x3346c9&&_0x3346c9[_0xfbd2('0x58')]===0x0){return db[_0xfbd2('0x2a')]['create']({'name':_0x20783b['name'],'resourceId':_0x20783b['id'],'type':_0x3346c9[_0xfbd2('0x2e')],'sectionId':_0x3346c9['id']},{})[_0xfbd2('0x28')](function(){return _0x4c5985;});}else{return _0x4c5985;}})[_0xfbd2('0x4b')](function(_0x547847){logger['error'](_0xfbd2('0x59'),_0x547847);throw _0x547847;});}return _0x4c5985;})[_0xfbd2('0x28')](respondWithResult(_0x39be2e,0xc9))[_0xfbd2('0x4b')](handleError(_0x39be2e,null));};exports[_0xfbd2('0x27')]=function(_0x265f44,_0x52e737){if(_0x265f44[_0xfbd2('0x50')]['id']){delete _0x265f44['body']['id'];}return db['Schedule'][_0xfbd2('0x4e')]({'where':{'id':_0x265f44[_0xfbd2('0x5a')]['id']}})[_0xfbd2('0x28')](handleEntityNotFound(_0x52e737,null))[_0xfbd2('0x28')](saveUpdates(_0x265f44[_0xfbd2('0x50')],null))[_0xfbd2('0x28')](respondWithResult(_0x52e737,null))['catch'](handleError(_0x52e737,null));};exports['destroy']=function(_0x89c0af,_0x97f52d){return db[_0xfbd2('0x31')][_0xfbd2('0x4e')]({'where':{'id':_0x89c0af[_0xfbd2('0x5a')]['id']}})['then'](handleEntityNotFound(_0x97f52d,null))[_0xfbd2('0x28')](removeEntity(_0x97f52d,null))['catch'](handleError(_0x97f52d,null));};exports[_0xfbd2('0x5b')]=function(_0x1f0dd1,_0x1bb58e,_0x7b1582){var _0x3e80e1=require(_0xfbd2('0x5c'));return db['Schedule']['find']({'where':{'id':_0x1f0dd1['params']['id']},'raw':!![]})[_0xfbd2('0x28')](handleEntityNotFound(_0x1bb58e,null))[_0xfbd2('0x28')](function(){_0x3e80e1[_0xfbd2('0x5b')](_0x1f0dd1[_0xfbd2('0x5a')]['id']);})['then'](respondWithStatusCode(_0x1bb58e,null))['catch'](handleError(_0x1bb58e,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 3209af5..815afab 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 _0xedd9=['../../config/logger','api','bluebird','request-promise','path','rimraf','./schedule.attributes','tools_schedules','lodash','util'];(function(_0x286e63,_0x90bf8f){var _0x4535eb=function(_0x1d71b4){while(--_0x1d71b4){_0x286e63['push'](_0x286e63['shift']());}};_0x4535eb(++_0x90bf8f);}(_0xedd9,0x10c));var _0x9edd=function(_0x58e9c6,_0x5a0779){_0x58e9c6=_0x58e9c6-0x0;var _0x7bed7f=_0xedd9[_0x58e9c6];return _0x7bed7f;};'use strict';var _=require(_0x9edd('0x0'));var util=require(_0x9edd('0x1'));var logger=require(_0x9edd('0x2'))(_0x9edd('0x3'));var moment=require('moment');var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module['exports']=function(_0x67e964,_0x28a32d){return _0x67e964['define']('Schedule',attributes,{'tableName':_0x9edd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x731e=['path','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','util','../../config/logger','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x731e,0x15c));var _0xe731=function(_0x17abc5,_0x4c8a69){_0x17abc5=_0x17abc5-0x0;var _0x393a6b=_0x731e[_0x17abc5];return _0x393a6b;};'use strict';var _=require('lodash');var util=require(_0xe731('0x0'));var logger=require(_0xe731('0x1'))('api');var moment=require(_0xe731('0x2'));var BPromise=require('bluebird');var rp=require(_0xe731('0x3'));var fs=require('fs');var path=require(_0xe731('0x4'));var rimraf=require('rimraf');var config=require(_0xe731('0x5'));var attributes=require(_0xe731('0x6'));module[_0xe731('0x7')]=function(_0x110303,_0x4f3fb9){return _0x110303[_0xe731('0x8')](_0xe731('0x9'),attributes,{'tableName':_0xe731('0xa'),'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 ea5bb8e..e4ad0b2 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 _0xb1e6=['request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s'];(function(_0x485083,_0x3b371c){var _0x3414f3=function(_0x34ee07){while(--_0x34ee07){_0x485083['push'](_0x485083['shift']());}};_0x3414f3(++_0x3b371c);}(_0xb1e6,0x70));var _0x6b1e=function(_0x5de532,_0x2941c4){_0x5de532=_0x5de532-0x0;var _0x4e9192=_0xb1e6[_0x5de532];return _0x4e9192;};'use strict';var _=require(_0x6b1e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6b1e('0x1'));var fs=require('fs');var Redis=require(_0x6b1e('0x2'));var db=require(_0x6b1e('0x3'))['db'];var utils=require(_0x6b1e('0x4'));var logger=require(_0x6b1e('0x5'))(_0x6b1e('0x6'));var config=require('../../config/environment');var jayson=require(_0x6b1e('0x7'));var client=jayson[_0x6b1e('0x8')][_0x6b1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58b1ec,_0x51cc29,_0x49b523){return new BPromise(function(_0x38a659,_0xd282ef){return client[_0x6b1e('0xa')](_0x58b1ec,_0x49b523)[_0x6b1e('0xb')](function(_0x53b30c){logger[_0x6b1e('0xc')](_0x6b1e('0xd'),_0x51cc29,_0x6b1e('0xe'));logger[_0x6b1e('0xf')](_0x6b1e('0x10'),_0x51cc29,_0x6b1e('0xe'),JSON['stringify'](_0x53b30c));if(_0x53b30c['error']){if(_0x53b30c['error']['code']===0x1f4){logger[_0x6b1e('0x11')]('Schedule,\x20%s,\x20%s',_0x51cc29,_0x53b30c[_0x6b1e('0x11')][_0x6b1e('0x12')]);return _0xd282ef(_0x53b30c['error'][_0x6b1e('0x12')]);}logger[_0x6b1e('0x11')](_0x6b1e('0xd'),_0x51cc29,_0x53b30c[_0x6b1e('0x11')][_0x6b1e('0x12')]);return _0x38a659(_0x53b30c['error'][_0x6b1e('0x12')]);}else{logger['info'](_0x6b1e('0xd'),_0x51cc29,'request\x20sent');_0x38a659(_0x53b30c[_0x6b1e('0x13')][_0x6b1e('0x12')]);}})[_0x6b1e('0x14')](function(_0x120439){logger[_0x6b1e('0x11')](_0x6b1e('0xd'),_0x51cc29,_0x120439);_0xd282ef(_0x120439);});});} \ No newline at end of file +var _0x7654=['http','then','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5b184c,_0x5616f8){var _0xf5ff82=function(_0x93d4be){while(--_0x93d4be){_0x5b184c['push'](_0x5b184c['shift']());}};_0xf5ff82(++_0x5616f8);}(_0x7654,0x155));var _0x4765=function(_0x378fd3,_0x2f4c61){_0x378fd3=_0x378fd3-0x0;var _0x2a0b96=_0x7654[_0x378fd3];return _0x2a0b96;};'use strict';var _=require(_0x4765('0x0'));var util=require(_0x4765('0x1'));var moment=require(_0x4765('0x2'));var BPromise=require(_0x4765('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4765('0x4'));var db=require(_0x4765('0x5'))['db'];var utils=require(_0x4765('0x6'));var logger=require(_0x4765('0x7'))(_0x4765('0x8'));var config=require(_0x4765('0x9'));var jayson=require(_0x4765('0xa'));var client=jayson['client'][_0x4765('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x190f6e,_0x43da18,_0x52fac6){return new BPromise(function(_0x27cba7,_0x5b84b2){return client['request'](_0x190f6e,_0x52fac6)[_0x4765('0xc')](function(_0x31cbad){logger['info'](_0x4765('0xd'),_0x43da18,'request\x20sent');logger[_0x4765('0xe')](_0x4765('0xf'),_0x43da18,_0x4765('0x10'),JSON[_0x4765('0x11')](_0x31cbad));if(_0x31cbad['error']){if(_0x31cbad[_0x4765('0x12')][_0x4765('0x13')]===0x1f4){logger['error'](_0x4765('0xd'),_0x43da18,_0x31cbad['error']['message']);return _0x5b84b2(_0x31cbad['error'][_0x4765('0x14')]);}logger[_0x4765('0x12')](_0x4765('0xd'),_0x43da18,_0x31cbad[_0x4765('0x12')][_0x4765('0x14')]);return _0x27cba7(_0x31cbad[_0x4765('0x12')][_0x4765('0x14')]);}else{logger[_0x4765('0x15')](_0x4765('0xd'),_0x43da18,'request\x20sent');_0x27cba7(_0x31cbad['result'][_0x4765('0x14')]);}})['catch'](function(_0x4e8994){logger[_0x4765('0x12')]('Schedule,\x20%s,\x20%s',_0x43da18,_0x4e8994);_0x5b84b2(_0x4e8994);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 6ea5c09..f94417c 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 _0x9d9c=['isAuthenticated','get','describe','/:id/download','download','post','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller'];(function(_0x4a2bd6,_0xa1a75c){var _0x1ec54f=function(_0x569431){while(--_0x569431){_0x4a2bd6['push'](_0x4a2bd6['shift']());}};_0x1ec54f(++_0xa1a75c);}(_0x9d9c,0x17c));var _0xc9d9=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x9d9c[_0x45b034];return _0x509cb0;};'use strict';var multer=require(_0xc9d9('0x0'));var util=require(_0xc9d9('0x1'));var path=require(_0xc9d9('0x2'));var timeout=require(_0xc9d9('0x3'));var express=require(_0xc9d9('0x4'));var router=express[_0xc9d9('0x5')]();var fs_extra=require(_0xc9d9('0x6'));var auth=require(_0xc9d9('0x7'));var interaction=require(_0xc9d9('0x8'));var config=require(_0xc9d9('0x9'));var controller=require(_0xc9d9('0xa'));router['get']('/',auth[_0xc9d9('0xb')](),controller['index']);router[_0xc9d9('0xc')]('/describe',auth[_0xc9d9('0xb')](),controller[_0xc9d9('0xd')]);router[_0xc9d9('0xc')]('/:id',auth[_0xc9d9('0xb')](),controller['show']);router['get'](_0xc9d9('0xe'),auth['isAuthenticated'](),controller[_0xc9d9('0xf')]);router[_0xc9d9('0x10')]('/',auth[_0xc9d9('0xb')](),controller[_0xc9d9('0x11')]);router[_0xc9d9('0x12')](_0xc9d9('0x13'),auth[_0xc9d9('0xb')](),controller[_0xc9d9('0x14')]);router[_0xc9d9('0x15')](_0xc9d9('0x13'),auth[_0xc9d9('0xb')](),controller['destroy']);module[_0xc9d9('0x16')]=router; \ No newline at end of file +var _0x5467=['index','/describe','describe','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated'];(function(_0x245327,_0x2bbe5f){var _0x4d441c=function(_0x281a13){while(--_0x281a13){_0x245327['push'](_0x245327['shift']());}};_0x4d441c(++_0x2bbe5f);}(_0x5467,0x86));var _0x7546=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5467[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0x7546('0x0'));var util=require('util');var path=require(_0x7546('0x1'));var timeout=require('connect-timeout');var express=require(_0x7546('0x2'));var router=express[_0x7546('0x3')]();var fs_extra=require(_0x7546('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7546('0x5'));var config=require(_0x7546('0x6'));var controller=require(_0x7546('0x7'));router[_0x7546('0x8')]('/',auth[_0x7546('0x9')](),controller[_0x7546('0xa')]);router[_0x7546('0x8')](_0x7546('0xb'),auth[_0x7546('0x9')](),controller[_0x7546('0xc')]);router[_0x7546('0x8')](_0x7546('0xd'),auth[_0x7546('0x9')](),controller[_0x7546('0xe')]);router['get'](_0x7546('0xf'),auth['isAuthenticated'](),controller[_0x7546('0x10')]);router[_0x7546('0x11')]('/',auth[_0x7546('0x9')](),controller[_0x7546('0x12')]);router[_0x7546('0x13')](_0x7546('0xd'),auth['isAuthenticated'](),controller[_0x7546('0x14')]);router[_0x7546('0x15')](_0x7546('0xd'),auth[_0x7546('0x9')](),controller[_0x7546('0x16')]);module[_0x7546('0x17')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 4436f70..d026bdc 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 _0x1c52=['startedAt','subtract','setDataValue','DATE','getDataValue','format','toString','closedAt','MM-DD-YYYY\x20HH:mm','createdAt','sequelize','moment','path','../../config/environment','value','extname','STRING','replace','INTEGER'];(function(_0x227378,_0x2073f2){var _0x502efe=function(_0x4c6818){while(--_0x4c6818){_0x227378['push'](_0x227378['shift']());}};_0x502efe(++_0x2073f2);}(_0x1c52,0x7c));var _0x21c5=function(_0x2cca86,_0x59432f){_0x2cca86=_0x2cca86-0x0;var _0x9fce42=_0x1c52[_0x2cca86];return _0x9fce42;};'use strict';var Sequelize=require(_0x21c5('0x0'));var moment=require(_0x21c5('0x1'));var path=require(_0x21c5('0x2'));var config=require(_0x21c5('0x3'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x21c5('0x4'))?path[_0x21c5('0x5')](this['getDataValue'](_0x21c5('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x21c5('0x6')]},'channel':{'type':Sequelize[_0x21c5('0x6')]},'value':{'type':Sequelize[_0x21c5('0x6')],'set':function(_0x5b12d5){var _0xed0195=_0x5b12d5[_0x21c5('0x7')](/\\/g,'/');this['setDataValue'](_0x21c5('0x4'),_0xed0195);}},'rating':{'type':Sequelize[_0x21c5('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x21c5('0x8')],'set':function(_0x27389f){this['setDataValue'](_0x21c5('0x9'),moment()[_0x21c5('0xa')](_0x27389f,'ms'));this[_0x21c5('0xb')]('closedAt',moment());this[_0x21c5('0xb')]('duration',_0x27389f);}},'startedAt':{'type':Sequelize[_0x21c5('0xc')],'get':function(){return moment(this[_0x21c5('0xd')](_0x21c5('0x9')))[_0x21c5('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x21c5('0xf')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x21c5('0xd')](_0x21c5('0x10')))['format'](_0x21c5('0x11'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x21c5('0xd')](_0x21c5('0x12')))[_0x21c5('0xe')](_0x21c5('0x11'))[_0x21c5('0xf')]();}},'updatedAt':{'type':Sequelize[_0x21c5('0xc')],'get':function(){return moment(this[_0x21c5('0xd')]('updatedAt'))[_0x21c5('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0x235b=['../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','startedAt','subtract','closedAt','duration','format','toString','MM-DD-YYYY\x20HH:mm','DATE','updatedAt','sequelize'];(function(_0x1c0902,_0xa0d2c6){var _0x90cd8e=function(_0x25468c){while(--_0x25468c){_0x1c0902['push'](_0x1c0902['shift']());}};_0x90cd8e(++_0xa0d2c6);}(_0x235b,0x1ed));var _0xb235=function(_0x8fde51,_0x4ed9e1){_0x8fde51=_0x8fde51-0x0;var _0x14479c=_0x235b[_0x8fde51];return _0x14479c;};'use strict';var Sequelize=require(_0xb235('0x0'));var moment=require('moment');var path=require('path');var config=require(_0xb235('0x1'));module[_0xb235('0x2')]={'format':{'type':Sequelize[_0xb235('0x3')],'get':function(){return this[_0xb235('0x4')](_0xb235('0x5'))?path[_0xb235('0x6')](this['getDataValue'](_0xb235('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0xb235('0x7')]},'channel':{'type':Sequelize[_0xb235('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x12d0ae){var _0x44559a=_0x12d0ae[_0xb235('0x8')](/\\/g,'/');this[_0xb235('0x9')](_0xb235('0x5'),_0x44559a);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0xecf759){this[_0xb235('0x9')](_0xb235('0xa'),moment()[_0xb235('0xb')](_0xecf759,'ms'));this[_0xb235('0x9')](_0xb235('0xc'),moment());this[_0xb235('0x9')](_0xb235('0xd'),_0xecf759);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb235('0x4')](_0xb235('0xa')))[_0xb235('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xb235('0xf')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xb235('0x4')](_0xb235('0xc')))[_0xb235('0xe')](_0xb235('0x10'))[_0xb235('0xf')]();}},'createdAt':{'type':Sequelize[_0xb235('0x11')],'get':function(){return moment(this[_0xb235('0x4')]('createdAt'))[_0xb235('0xe')](_0xb235('0x10'))[_0xb235('0xf')]();}},'updatedAt':{'type':Sequelize[_0xb235('0x11')],'get':function(){return moment(this[_0xb235('0x4')](_0xb235('0x12')))[_0xb235('0xe')](_0xb235('0x10'))[_0xb235('0xf')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index c2c028e..f412741 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 _0x4c4e=['findAll','rows','catch','params','keys','find','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','destroy','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','sendStatus','name','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include'];(function(_0x16dbfd,_0x2f9431){var _0x382254=function(_0x19dade){while(--_0x19dade){_0x16dbfd['push'](_0x16dbfd['shift']());}};_0x382254(++_0x2f9431);}(_0x4c4e,0x152));var _0xe4c4=function(_0x367fa7,_0x2f52c8){_0x367fa7=_0x367fa7-0x0;var _0x387ccb=_0x4c4e[_0x367fa7];return _0x387ccb;};'use strict';var emlformat=require(_0xe4c4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe4c4('0x1'));var jsonpatch=require(_0xe4c4('0x2'));var rp=require(_0xe4c4('0x3'));var moment=require('moment');var BPromise=require(_0xe4c4('0x4'));var Mustache=require(_0xe4c4('0x5'));var util=require(_0xe4c4('0x6'));var path=require('path');var sox=require(_0xe4c4('0x7'));var csv=require('to-csv');var ejs=require(_0xe4c4('0x8'));var fs=require('fs');var fs_extra=require(_0xe4c4('0x9'));var _=require(_0xe4c4('0xa'));var squel=require(_0xe4c4('0xb'));var crypto=require(_0xe4c4('0xc'));var jsforce=require(_0xe4c4('0xd'));var deskjs=require(_0xe4c4('0xe'));var toCsv=require(_0xe4c4('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe4c4('0x10'));var authService=require(_0xe4c4('0x11'));var qs=require(_0xe4c4('0x12'));var as=require(_0xe4c4('0x13'));var hardwareService=require(_0xe4c4('0x14'));var logger=require(_0xe4c4('0x15'))('api');var utils=require(_0xe4c4('0x16'));var config=require(_0xe4c4('0x17'));var licenseUtil=require(_0xe4c4('0x18'));var db=require(_0xe4c4('0x19'))['db'];function respondWithStatusCode(_0x50bfab,_0x262083){_0x262083=_0x262083||0xcc;return function(_0x115802){if(_0x115802){return _0x50bfab['sendStatus'](_0x262083);}return _0x50bfab[_0xe4c4('0x1a')](_0x262083)[_0xe4c4('0x1b')]();};}function respondWithResult(_0x5aa89b,_0x42ce9e){_0x42ce9e=_0x42ce9e||0xc8;return function(_0x29766a){if(_0x29766a){return _0x5aa89b['status'](_0x42ce9e)[_0xe4c4('0x1c')](_0x29766a);}};}function respondWithFilteredResult(_0x465c9b,_0x26ea05){return function(_0x40a36e){if(_0x40a36e){var _0x19e59b=typeof _0x26ea05[_0xe4c4('0x1d')]===_0xe4c4('0x1e')&&typeof _0x26ea05[_0xe4c4('0x1f')]===_0xe4c4('0x1e');var _0x36b10c=_0x40a36e[_0xe4c4('0x20')];var _0x42242c=_0x19e59b?0x0:_0x26ea05[_0xe4c4('0x1d')];var _0x43a9ce=_0x19e59b?_0x40a36e[_0xe4c4('0x20')]:_0x26ea05['offset']+_0x26ea05[_0xe4c4('0x1f')];var _0x24f946;if(_0x43a9ce>=_0x36b10c){_0x43a9ce=_0x36b10c;_0x24f946=0xc8;}else{_0x24f946=0xce;}_0x465c9b[_0xe4c4('0x1a')](_0x24f946);return _0x465c9b[_0xe4c4('0x21')]('Content-Range',_0x42242c+'-'+_0x43a9ce+'/'+_0x36b10c)[_0xe4c4('0x1c')](_0x40a36e);}return null;};}function patchUpdates(_0x1cad5d){return function(_0x1727eb){try{jsonpatch[_0xe4c4('0x22')](_0x1727eb,_0x1cad5d,!![]);}catch(_0x2c5aea){return BPromise[_0xe4c4('0x23')](_0x2c5aea);}return _0x1727eb[_0xe4c4('0x24')]();};}function saveUpdates(_0x393c96,_0x21bbb1){return function(_0x1a7690){if(_0x1a7690){return _0x1a7690[_0xe4c4('0x25')](_0x393c96)[_0xe4c4('0x26')](function(_0x138ead){return _0x138ead;});}return null;};}function removeEntity(_0x1db719,_0x15873e){return function(_0x59498e){if(_0x59498e){return _0x59498e['destroy']()[_0xe4c4('0x26')](function(){_0x1db719['status'](0xcc)[_0xe4c4('0x1b')]();});}};}function handleEntityNotFound(_0x5374fd,_0x3adfcb){return function(_0x5efc4c){if(!_0x5efc4c){_0x5374fd[_0xe4c4('0x27')](0x194);}return _0x5efc4c;};}function handleError(_0x583393,_0xba53ef){_0xba53ef=_0xba53ef||0x1f4;return function(_0x4a0199){logger['error'](_0x4a0199['stack']);if(_0x4a0199['name']){delete _0x4a0199[_0xe4c4('0x28')];}_0x583393['status'](_0xba53ef)['send'](_0x4a0199);};}exports[_0xe4c4('0x29')]=function(_0x11deab,_0x4bb911){var _0x57ba43={},_0x7428ad={},_0x33de43={'count':0x0,'rows':[]};var _0x4aa6c1=_[_0xe4c4('0x2a')](db[_0xe4c4('0x2b')][_0xe4c4('0x2c')],function(_0x48060e){return{'name':_0x48060e['fieldName'],'type':_0x48060e[_0xe4c4('0x2d')][_0xe4c4('0x2e')]};});_0x7428ad[_0xe4c4('0x2f')]=_[_0xe4c4('0x30')](_['map'](_0x4aa6c1,'name'),[_0xe4c4('0x31')]);_0x7428ad[_0xe4c4('0x32')]=_['keys'](_0x11deab[_0xe4c4('0x32')]);_0x7428ad[_0xe4c4('0x33')]=_[_0xe4c4('0x34')](_0x7428ad['model'],_0x7428ad[_0xe4c4('0x32')]);_0x57ba43['attributes']=_[_0xe4c4('0x34')](_0x7428ad[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0x57ba43[_0xe4c4('0x36')]=_0x57ba43[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0x57ba43[_0xe4c4('0x36')]:_0x7428ad[_0xe4c4('0x2f')];if(!_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x38')]('nolimit')){_0x57ba43[_0xe4c4('0x1f')]=qs[_0xe4c4('0x1f')](_0x11deab[_0xe4c4('0x32')]['limit']);_0x57ba43[_0xe4c4('0x1d')]=qs[_0xe4c4('0x1d')](_0x11deab[_0xe4c4('0x32')]['offset']);}_0x57ba43[_0xe4c4('0x39')]=qs[_0xe4c4('0x3a')](_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x3a')]);_0x57ba43[_0xe4c4('0x3b')]=qs[_0xe4c4('0x33')](_[_0xe4c4('0x3c')](_0x11deab[_0xe4c4('0x32')],_0x7428ad[_0xe4c4('0x33')]),_0x4aa6c1);if(_0x11deab[_0xe4c4('0x32')]['filter']){_0x57ba43[_0xe4c4('0x3b')]=_[_0xe4c4('0x3d')](_0x57ba43[_0xe4c4('0x3b')],{'$or':_[_0xe4c4('0x2a')](_0x4aa6c1,function(_0x4c5551){if(_0x4c5551[_0xe4c4('0x2d')]!==_0xe4c4('0x3e')){var _0x4e6bd9={};_0x4e6bd9[_0x4c5551[_0xe4c4('0x28')]]={'$like':'%'+_0x11deab[_0xe4c4('0x32')]['filter']+'%'};return _0x4e6bd9;}})});}_0x57ba43=_[_0xe4c4('0x3d')]({},_0x57ba43,_0x11deab[_0xe4c4('0x3f')]);var _0x127bcd={'where':_0x57ba43[_0xe4c4('0x3b')]};return db[_0xe4c4('0x2b')][_0xe4c4('0x20')](_0x127bcd)[_0xe4c4('0x26')](function(_0x43201e){_0x33de43[_0xe4c4('0x20')]=_0x43201e;if(_0x11deab[_0xe4c4('0x32')][_0xe4c4('0x40')]){_0x57ba43[_0xe4c4('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xe4c4('0x42')](_0x57ba43);})[_0xe4c4('0x26')](function(_0x2b306d){_0x33de43[_0xe4c4('0x43')]=_0x2b306d;return _0x33de43;})[_0xe4c4('0x26')](respondWithFilteredResult(_0x4bb911,_0x57ba43))[_0xe4c4('0x44')](handleError(_0x4bb911,null));};exports['show']=function(_0x312a49,_0x526bef){var _0xca07dc={'raw':![],'where':{'id':_0x312a49[_0xe4c4('0x45')]['id']}},_0x3c067a={};_0x3c067a[_0xe4c4('0x2f')]=_[_0xe4c4('0x46')](db['ScreenRecording']['rawAttributes']);_0x3c067a[_0xe4c4('0x32')]=_[_0xe4c4('0x46')](_0x312a49[_0xe4c4('0x32')]);_0x3c067a['filters']=_[_0xe4c4('0x34')](_0x3c067a[_0xe4c4('0x2f')],_0x3c067a[_0xe4c4('0x32')]);_0xca07dc[_0xe4c4('0x36')]=_['intersection'](_0x3c067a[_0xe4c4('0x2f')],qs[_0xe4c4('0x35')](_0x312a49[_0xe4c4('0x32')][_0xe4c4('0x35')]));_0xca07dc[_0xe4c4('0x36')]=_0xca07dc[_0xe4c4('0x36')][_0xe4c4('0x37')]?_0xca07dc[_0xe4c4('0x36')]:_0x3c067a[_0xe4c4('0x2f')];if(_0x312a49['query'][_0xe4c4('0x40')]){_0xca07dc['include']=[{'all':!![]}];}_0xca07dc=_[_0xe4c4('0x3d')]({},_0xca07dc,_0x312a49[_0xe4c4('0x3f')]);return db[_0xe4c4('0x2b')][_0xe4c4('0x47')](_0xca07dc)[_0xe4c4('0x26')](handleEntityNotFound(_0x526bef,null))[_0xe4c4('0x26')](respondWithResult(_0x526bef,null))[_0xe4c4('0x44')](handleError(_0x526bef,null));};exports[_0xe4c4('0x48')]=function(_0x36f8ad,_0x18fb82){return db[_0xe4c4('0x2b')][_0xe4c4('0x48')](_0x36f8ad[_0xe4c4('0x49')],{})[_0xe4c4('0x26')](respondWithResult(_0x18fb82,0xc9))['catch'](handleError(_0x18fb82,null));};exports['update']=function(_0xe0e351,_0x198961){if(_0xe0e351['body']['id']){delete _0xe0e351[_0xe4c4('0x49')]['id'];}delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4a')];delete _0xe0e351[_0xe4c4('0x49')][_0xe4c4('0x4b')];delete _0xe0e351['body'][_0xe4c4('0x4c')];delete _0xe0e351[_0xe4c4('0x49')]['value'];return db[_0xe4c4('0x2b')][_0xe4c4('0x47')]({'where':{'id':_0xe0e351['params']['id']}})[_0xe4c4('0x26')](handleEntityNotFound(_0x198961,null))['then'](saveUpdates(_0xe0e351[_0xe4c4('0x49')],null))[_0xe4c4('0x26')](respondWithResult(_0x198961,null))[_0xe4c4('0x44')](handleError(_0x198961,null));};exports[_0xe4c4('0x4d')]=function(_0x12eaed,_0x525534){return db[_0xe4c4('0x2b')][_0xe4c4('0x4d')]()[_0xe4c4('0x26')](respondWithResult(_0x525534,null))[_0xe4c4('0x44')](handleError(_0x525534,null));};exports[_0xe4c4('0x4e')]=function(_0x32a50e,_0x3ddcbe,_0x3aa205){var _0x1a96ba=require(_0xe4c4('0x4f'));var _0x1fe354=![];var _0x1940e3={};if(_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]&&_0x32a50e[_0xe4c4('0x32')][_0xe4c4('0x2d')]==='uniqueid'){_0x1940e3[_0xe4c4('0x50')]=_0x32a50e[_0xe4c4('0x45')]['id'];}else{_0x1940e3['id']=_0x32a50e[_0xe4c4('0x45')]['id'];}return db['ScreenRecording'][_0xe4c4('0x47')]({'where':_0x1940e3,'attributes':['id',_0xe4c4('0x51')],'raw':!![]})[_0xe4c4('0x26')](handleEntityNotFound(_0x3ddcbe,null))['then'](function(_0x45f959){if(_0x45f959){var _0x485c50=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x45f959['value']);var _0x479361=util[_0xe4c4('0x31')](_0xe4c4('0x55'),_0x485c50);if(fs[_0xe4c4('0x56')](_0x479361)){_0x1fe354=!![];return _0x1a96ba['decryptFile'](_0x479361,_0x485c50,config[_0xe4c4('0x57')]['recording'])['then'](function(){return _0x45f959;});}return _0x45f959;}})['then'](function(_0x4e08ec){if(_0x4e08ec){var _0x1ca931=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x4e08ec[_0xe4c4('0x51')]);if(!fs[_0xe4c4('0x56')](_0x1ca931)){throw new db['Sequelize'][(_0xe4c4('0x58'))](_0xe4c4('0x59'));}if(_0x4e08ec[_0xe4c4('0x5a')]){return _0x3ddcbe[_0xe4c4('0x4e')](_0x1ca931,_0x4e08ec[_0xe4c4('0x5a')]+path[_0xe4c4('0x5b')](_0x1ca931),function(){if(_0x1fe354){fs['unlink'](_0x1ca931);}});}else{return _0x3ddcbe['download'](_0x1ca931,function(_0x27599b){if(_0x1fe354){fs[_0xe4c4('0x5c')](_0x1ca931);}});}}})[_0xe4c4('0x44')](function(_0x3c8e44){if(_0x3c8e44[_0xe4c4('0x5d')]===_0xe4c4('0x59')){_0x3ddcbe[_0xe4c4('0x1a')](0x194)[_0xe4c4('0x5e')](_0xe4c4('0x5f'));}else{return handleError(_0x3ddcbe,null);}});};exports['destroy']=function(_0x59f033,_0x5a4138){return db['ScreenRecording'][_0xe4c4('0x47')]({'where':{'id':_0x59f033[_0xe4c4('0x45')]['id']}})[_0xe4c4('0x26')](function(_0x58f2dd){if(_[_0xe4c4('0x60')](_0x58f2dd)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58f2dd;})[_0xe4c4('0x26')](function(_0x56ead3){var _0x5d6c0a=path[_0xe4c4('0x52')](config[_0xe4c4('0x53')],_0xe4c4('0x54'),_0x56ead3['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x5d6c0a);if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs['existsSync'](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}_0x5d6c0a=_0x5d6c0a+'.cypher';if(!_[_0xe4c4('0x60')](_0x56ead3[_0xe4c4('0x51')])&&fs[_0xe4c4('0x56')](_0x5d6c0a)){logger[_0xe4c4('0x61')](_0xe4c4('0x62')+_0x5d6c0a+_0xe4c4('0x63'));fs['unlinkSync'](_0x5d6c0a);}return _0x56ead3;})[_0xe4c4('0x26')](function(_0x1bddd5){if(!_0x1bddd5)throw new InternalError();return _0x1bddd5[_0xe4c4('0x64')]();})['then'](function(){_0x5a4138[_0xe4c4('0x1a')](0xcc)[_0xe4c4('0x1b')]();})[_0xe4c4('0x44')](handleError(_0x5a4138,null));}; \ No newline at end of file +var _0x81bd=['Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','duration','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','root','%s.cypher','existsSync','secrets','recording','join','server/files/screen_recordings'];(function(_0x3bc65a,_0x547543){var _0x3dd8ab=function(_0x3d2b87){while(--_0x3d2b87){_0x3bc65a['push'](_0x3bc65a['shift']());}};_0x3dd8ab(++_0x547543);}(_0x81bd,0x7c));var _0xd81b=function(_0x2d056d,_0x53f6c3){_0x2d056d=_0x2d056d-0x0;var _0x430fca=_0x81bd[_0x2d056d];return _0x430fca;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xcc;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x1b')](_0x57f71d);}return _0x21dfff['status'](_0x57f71d)[_0xd81b('0x1c')]();};}function respondWithResult(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0xc8;return function(_0x41bf7a){if(_0x41bf7a){return _0x47dd04[_0xd81b('0x1d')](_0x13dd00)[_0xd81b('0x1e')](_0x41bf7a);}};}function respondWithFilteredResult(_0x128162,_0x552215){return function(_0x1c620d){if(_0x1c620d){var _0x27b7a0=typeof _0x552215['offset']===_0xd81b('0x1f')&&typeof _0x552215[_0xd81b('0x20')]===_0xd81b('0x1f');var _0x15e860=_0x1c620d[_0xd81b('0x21')];var _0xc49b8d=_0x27b7a0?0x0:_0x552215[_0xd81b('0x22')];var _0x3d4d34=_0x27b7a0?_0x1c620d[_0xd81b('0x21')]:_0x552215[_0xd81b('0x22')]+_0x552215[_0xd81b('0x20')];var _0x453952;if(_0x3d4d34>=_0x15e860){_0x3d4d34=_0x15e860;_0x453952=0xc8;}else{_0x453952=0xce;}_0x128162[_0xd81b('0x1d')](_0x453952);return _0x128162[_0xd81b('0x23')](_0xd81b('0x24'),_0xc49b8d+'-'+_0x3d4d34+'/'+_0x15e860)[_0xd81b('0x1e')](_0x1c620d);}return null;};}function patchUpdates(_0x5f101a){return function(_0x4d566e){try{jsonpatch[_0xd81b('0x25')](_0x4d566e,_0x5f101a,!![]);}catch(_0x1b7876){return BPromise[_0xd81b('0x26')](_0x1b7876);}return _0x4d566e['save']();};}function saveUpdates(_0x19ed0e,_0x6571a6){return function(_0x542ee2){if(_0x542ee2){return _0x542ee2[_0xd81b('0x27')](_0x19ed0e)[_0xd81b('0x28')](function(_0x1670cd){return _0x1670cd;});}return null;};}function removeEntity(_0x1ad65c,_0x279176){return function(_0xcb4f91){if(_0xcb4f91){return _0xcb4f91[_0xd81b('0x29')]()[_0xd81b('0x28')](function(){_0x1ad65c[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();});}};}function handleEntityNotFound(_0x2ccedf,_0x1bf351){return function(_0x596389){if(!_0x596389){_0x2ccedf[_0xd81b('0x1b')](0x194);}return _0x596389;};}function handleError(_0x99dbc9,_0xe3637a){_0xe3637a=_0xe3637a||0x1f4;return function(_0x31b9fd){logger[_0xd81b('0x2a')](_0x31b9fd[_0xd81b('0x2b')]);if(_0x31b9fd[_0xd81b('0x2c')]){delete _0x31b9fd[_0xd81b('0x2c')];}_0x99dbc9[_0xd81b('0x1d')](_0xe3637a)['send'](_0x31b9fd);};}exports[_0xd81b('0x2d')]=function(_0x4e2eff,_0x5c8aee){var _0xb9ff9f={},_0x260310={},_0x5141e6={'count':0x0,'rows':[]};var _0x481454=_[_0xd81b('0x2e')](db[_0xd81b('0x2f')][_0xd81b('0x30')],function(_0x289f54){return{'name':_0x289f54[_0xd81b('0x31')],'type':_0x289f54[_0xd81b('0x32')]['key']};});_0x260310[_0xd81b('0x33')]=_[_0xd81b('0x34')](_['map'](_0x481454,'name'),[_0xd81b('0x35')]);_0x260310[_0xd81b('0x36')]=_['keys'](_0x4e2eff['query']);_0x260310['filters']=_[_0xd81b('0x37')](_0x260310[_0xd81b('0x33')],_0x260310[_0xd81b('0x36')]);_0xb9ff9f[_0xd81b('0x38')]=_[_0xd81b('0x37')](_0x260310[_0xd81b('0x33')],qs[_0xd81b('0x39')](_0x4e2eff['query'][_0xd81b('0x39')]));_0xb9ff9f['attributes']=_0xb9ff9f[_0xd81b('0x38')][_0xd81b('0x3a')]?_0xb9ff9f[_0xd81b('0x38')]:_0x260310[_0xd81b('0x33')];if(!_0x4e2eff[_0xd81b('0x36')][_0xd81b('0x3b')](_0xd81b('0x3c'))){_0xb9ff9f[_0xd81b('0x20')]=qs[_0xd81b('0x20')](_0x4e2eff[_0xd81b('0x36')][_0xd81b('0x20')]);_0xb9ff9f[_0xd81b('0x22')]=qs[_0xd81b('0x22')](_0x4e2eff['query']['offset']);}_0xb9ff9f[_0xd81b('0x3d')]=qs[_0xd81b('0x3e')](_0x4e2eff[_0xd81b('0x36')]['sort']);_0xb9ff9f[_0xd81b('0x3f')]=qs[_0xd81b('0x40')](_['pick'](_0x4e2eff[_0xd81b('0x36')],_0x260310[_0xd81b('0x40')]),_0x481454);if(_0x4e2eff['query'][_0xd81b('0x41')]){_0xb9ff9f['where']=_[_0xd81b('0x42')](_0xb9ff9f[_0xd81b('0x3f')],{'$or':_[_0xd81b('0x2e')](_0x481454,function(_0x3f6deb){if(_0x3f6deb['type']!==_0xd81b('0x43')){var _0x3444d4={};_0x3444d4[_0x3f6deb[_0xd81b('0x2c')]]={'$like':'%'+_0x4e2eff[_0xd81b('0x36')][_0xd81b('0x41')]+'%'};return _0x3444d4;}})});}_0xb9ff9f=_[_0xd81b('0x42')]({},_0xb9ff9f,_0x4e2eff[_0xd81b('0x44')]);var _0x532ada={'where':_0xb9ff9f[_0xd81b('0x3f')]};return db[_0xd81b('0x2f')][_0xd81b('0x21')](_0x532ada)['then'](function(_0x3bea7d){_0x5141e6[_0xd81b('0x21')]=_0x3bea7d;if(_0x4e2eff[_0xd81b('0x36')][_0xd81b('0x45')]){_0xb9ff9f[_0xd81b('0x46')]=[{'all':!![]}];}return db['ScreenRecording'][_0xd81b('0x47')](_0xb9ff9f);})[_0xd81b('0x28')](function(_0x448e24){_0x5141e6[_0xd81b('0x48')]=_0x448e24;return _0x5141e6;})[_0xd81b('0x28')](respondWithFilteredResult(_0x5c8aee,_0xb9ff9f))[_0xd81b('0x49')](handleError(_0x5c8aee,null));};exports[_0xd81b('0x4a')]=function(_0x486f0d,_0x4405a8){var _0x3ba339={'raw':![],'where':{'id':_0x486f0d['params']['id']}},_0x1e3690={};_0x1e3690[_0xd81b('0x33')]=_[_0xd81b('0x4b')](db[_0xd81b('0x2f')][_0xd81b('0x30')]);_0x1e3690[_0xd81b('0x36')]=_[_0xd81b('0x4b')](_0x486f0d[_0xd81b('0x36')]);_0x1e3690[_0xd81b('0x40')]=_['intersection'](_0x1e3690['model'],_0x1e3690[_0xd81b('0x36')]);_0x3ba339[_0xd81b('0x38')]=_[_0xd81b('0x37')](_0x1e3690[_0xd81b('0x33')],qs[_0xd81b('0x39')](_0x486f0d[_0xd81b('0x36')][_0xd81b('0x39')]));_0x3ba339[_0xd81b('0x38')]=_0x3ba339[_0xd81b('0x38')][_0xd81b('0x3a')]?_0x3ba339[_0xd81b('0x38')]:_0x1e3690[_0xd81b('0x33')];if(_0x486f0d['query'][_0xd81b('0x45')]){_0x3ba339[_0xd81b('0x46')]=[{'all':!![]}];}_0x3ba339=_[_0xd81b('0x42')]({},_0x3ba339,_0x486f0d[_0xd81b('0x44')]);return db[_0xd81b('0x2f')][_0xd81b('0x4c')](_0x3ba339)[_0xd81b('0x28')](handleEntityNotFound(_0x4405a8,null))[_0xd81b('0x28')](respondWithResult(_0x4405a8,null))[_0xd81b('0x49')](handleError(_0x4405a8,null));};exports['create']=function(_0xf401e0,_0x2368dd){return db[_0xd81b('0x2f')][_0xd81b('0x4d')](_0xf401e0['body'],{})[_0xd81b('0x28')](respondWithResult(_0x2368dd,0xc9))[_0xd81b('0x49')](handleError(_0x2368dd,null));};exports[_0xd81b('0x27')]=function(_0xe874b6,_0x2699e6){if(_0xe874b6[_0xd81b('0x4e')]['id']){delete _0xe874b6[_0xd81b('0x4e')]['id'];}delete _0xe874b6[_0xd81b('0x4e')][_0xd81b('0x4f')];delete _0xe874b6['body']['createdAt'];delete _0xe874b6[_0xd81b('0x4e')][_0xd81b('0x50')];delete _0xe874b6[_0xd81b('0x4e')][_0xd81b('0x51')];return db[_0xd81b('0x2f')][_0xd81b('0x4c')]({'where':{'id':_0xe874b6[_0xd81b('0x52')]['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x2699e6,null))['then'](saveUpdates(_0xe874b6[_0xd81b('0x4e')],null))[_0xd81b('0x28')](respondWithResult(_0x2699e6,null))[_0xd81b('0x49')](handleError(_0x2699e6,null));};exports[_0xd81b('0x53')]=function(_0x4651d3,_0x59b13b){return db[_0xd81b('0x2f')][_0xd81b('0x53')]()['then'](respondWithResult(_0x59b13b,null))[_0xd81b('0x49')](handleError(_0x59b13b,null));};exports[_0xd81b('0x54')]=function(_0x100319,_0x3b7ed7,_0x21cd71){var _0xa366c8=require(_0xd81b('0x55'));var _0x22f588=![];var _0x3ed626={};if(_0x100319[_0xd81b('0x36')][_0xd81b('0x32')]&&_0x100319['query'][_0xd81b('0x32')]==='uniqueid'){_0x3ed626[_0xd81b('0x56')]=_0x100319[_0xd81b('0x52')]['id'];}else{_0x3ed626['id']=_0x100319[_0xd81b('0x52')]['id'];}return db[_0xd81b('0x2f')][_0xd81b('0x4c')]({'where':_0x3ed626,'attributes':['id',_0xd81b('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x3b7ed7,null))[_0xd81b('0x28')](function(_0xe0c9c6){if(_0xe0c9c6){var _0x51f5a1=path['join'](config[_0xd81b('0x57')],'server/files/screen_recordings',_0xe0c9c6[_0xd81b('0x51')]);var _0x51f066=util[_0xd81b('0x35')](_0xd81b('0x58'),_0x51f5a1);if(fs[_0xd81b('0x59')](_0x51f066)){_0x22f588=!![];return _0xa366c8['decryptFile'](_0x51f066,_0x51f5a1,config[_0xd81b('0x5a')][_0xd81b('0x5b')])['then'](function(){return _0xe0c9c6;});}return _0xe0c9c6;}})[_0xd81b('0x28')](function(_0x108aaf){if(_0x108aaf){var _0x5951ec=path[_0xd81b('0x5c')](config['root'],_0xd81b('0x5d'),_0x108aaf[_0xd81b('0x51')]);if(!fs[_0xd81b('0x59')](_0x5951ec)){throw new db[(_0xd81b('0x5e'))][(_0xd81b('0x5f'))](_0xd81b('0x60'));}if(_0x108aaf[_0xd81b('0x61')]){return _0x3b7ed7[_0xd81b('0x54')](_0x5951ec,_0x108aaf[_0xd81b('0x61')]+path[_0xd81b('0x62')](_0x5951ec),function(){if(_0x22f588){fs['unlink'](_0x5951ec);}});}else{return _0x3b7ed7[_0xd81b('0x54')](_0x5951ec,function(_0x434434){if(_0x22f588){fs[_0xd81b('0x63')](_0x5951ec);}});}}})[_0xd81b('0x49')](function(_0x1bdf37){if(_0x1bdf37[_0xd81b('0x64')]===_0xd81b('0x60')){_0x3b7ed7['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x3b7ed7,null);}});};exports[_0xd81b('0x29')]=function(_0x12b0bf,_0x37507e){return db[_0xd81b('0x2f')][_0xd81b('0x4c')]({'where':{'id':_0x12b0bf[_0xd81b('0x52')]['id']}})[_0xd81b('0x28')](function(_0x5afecf){if(_[_0xd81b('0x65')](_0x5afecf)){throw new ReferenceError(_0xd81b('0x66'));}return _0x5afecf;})[_0xd81b('0x28')](function(_0x2090e9){var _0x41719b=path[_0xd81b('0x5c')](config[_0xd81b('0x57')],'server/files/screen_recordings',_0x2090e9[_0xd81b('0x51')]);logger[_0xd81b('0x67')](_0xd81b('0x68'),_0x41719b);if(!_[_0xd81b('0x65')](_0x2090e9[_0xd81b('0x51')])&&fs[_0xd81b('0x59')](_0x41719b)){logger[_0xd81b('0x67')](_0xd81b('0x69')+_0x41719b+_0xd81b('0x6a'));fs[_0xd81b('0x6b')](_0x41719b);}_0x41719b=_0x41719b+_0xd81b('0x6c');if(!_[_0xd81b('0x65')](_0x2090e9['value'])&&fs[_0xd81b('0x59')](_0x41719b)){logger['info'](_0xd81b('0x69')+_0x41719b+_0xd81b('0x6a'));fs[_0xd81b('0x6b')](_0x41719b);}return _0x2090e9;})[_0xd81b('0x28')](function(_0xb94a69){if(!_0xb94a69)throw new InternalError();return _0xb94a69[_0xd81b('0x29')]();})[_0xd81b('0x28')](function(){_0x37507e[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();})[_0xd81b('0x49')](handleError(_0x37507e,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 63bf66c..d54506f 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 _0xb8d1=['rimraf','./screenRecording.attributes','exports','screen_recordings','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1ce262,_0x2d930c){var _0x1a9c95=function(_0x18cea0){while(--_0x18cea0){_0x1ce262['push'](_0x1ce262['shift']());}};_0x1a9c95(++_0x2d930c);}(_0xb8d1,0x1d9));var _0x1b8d=function(_0x38c632,_0x14e8e6){_0x38c632=_0x38c632-0x0;var _0x12737e=_0xb8d1[_0x38c632];return _0x12737e;};'use strict';var _=require(_0x1b8d('0x0'));var util=require(_0x1b8d('0x1'));var logger=require(_0x1b8d('0x2'))(_0x1b8d('0x3'));var moment=require(_0x1b8d('0x4'));var BPromise=require(_0x1b8d('0x5'));var rp=require(_0x1b8d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1b8d('0x7'));var config=require('../../config/environment');var attributes=require(_0x1b8d('0x8'));module[_0x1b8d('0x9')]=function(_0x215c21,_0x1c77a8){return _0x215c21['define']('ScreenRecording',attributes,{'tableName':_0x1b8d('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x1b8d('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9d9a=['exports','define','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api','moment','bluebird','path','rimraf','./screenRecording.attributes'];(function(_0x2fd69d,_0xeb1037){var _0x5d5ef3=function(_0xa9ea9e){while(--_0xa9ea9e){_0x2fd69d['push'](_0x2fd69d['shift']());}};_0x5d5ef3(++_0xeb1037);}(_0x9d9a,0x6d));var _0xa9d9=function(_0x3797b1,_0x110134){_0x3797b1=_0x3797b1-0x0;var _0x5092d4=_0x9d9a[_0x3797b1];return _0x5092d4;};'use strict';var _=require('lodash');var util=require(_0xa9d9('0x0'));var logger=require(_0xa9d9('0x1'))(_0xa9d9('0x2'));var moment=require(_0xa9d9('0x3'));var BPromise=require(_0xa9d9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa9d9('0x5'));var rimraf=require(_0xa9d9('0x6'));var config=require('../../config/environment');var attributes=require(_0xa9d9('0x7'));module[_0xa9d9('0x8')]=function(_0x1101a5,_0x51ff51){return _0x1101a5[_0xa9d9('0x9')](_0xa9d9('0xa'),attributes,{'tableName':_0xa9d9('0xb'),'paranoid':![],'indexes':[{'name':_0xa9d9('0xc'),'fields':[_0xa9d9('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 143d625..a1bbe68 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 _0x3cff=['ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2aae4f,_0x1c80ea){var _0x5adc6f=function(_0x2287a1){while(--_0x2287a1){_0x2aae4f['push'](_0x2aae4f['shift']());}};_0x5adc6f(++_0x1c80ea);}(_0x3cff,0xb0));var _0xf3cf=function(_0x2a4095,_0x13f4f0){_0x2a4095=_0x2a4095-0x0;var _0x52eeab=_0x3cff[_0x2a4095];return _0x52eeab;};'use strict';var _=require(_0xf3cf('0x0'));var util=require(_0xf3cf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3cf('0x2'));var db=require(_0xf3cf('0x3'))['db'];var utils=require(_0xf3cf('0x4'));var logger=require('../../config/logger')(_0xf3cf('0x5'));var config=require(_0xf3cf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf3cf('0x7')][_0xf3cf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x57d8f8,_0x48f128,_0x4e58c1){return new BPromise(function(_0x4a5a5a,_0x393400){return client[_0xf3cf('0x9')](_0x57d8f8,_0x4e58c1)[_0xf3cf('0xa')](function(_0x2dd0e2){logger['info'](_0xf3cf('0xb'),_0x48f128,_0xf3cf('0xc'));logger[_0xf3cf('0xd')](_0xf3cf('0xe'),_0x48f128,_0xf3cf('0xc'),JSON[_0xf3cf('0xf')](_0x2dd0e2));if(_0x2dd0e2[_0xf3cf('0x10')]){if(_0x2dd0e2[_0xf3cf('0x10')][_0xf3cf('0x11')]===0x1f4){logger[_0xf3cf('0x10')](_0xf3cf('0xb'),_0x48f128,_0x2dd0e2['error'][_0xf3cf('0x12')]);return _0x393400(_0x2dd0e2[_0xf3cf('0x10')][_0xf3cf('0x12')]);}logger['error']('ScreenRecording,\x20%s,\x20%s',_0x48f128,_0x2dd0e2[_0xf3cf('0x10')][_0xf3cf('0x12')]);return _0x4a5a5a(_0x2dd0e2[_0xf3cf('0x10')]['message']);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x48f128,_0xf3cf('0xc'));_0x4a5a5a(_0x2dd0e2['result'][_0xf3cf('0x12')]);}})['catch'](function(_0x36bd69){logger[_0xf3cf('0x10')](_0xf3cf('0xb'),_0x48f128,_0x36bd69);_0x393400(_0x36bd69);});});} \ No newline at end of file +var _0x14d0=['stringify','code','error','message','catch','util','moment','bluebird','../../config/utils','../../config/logger','client','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x14d0,0xcb));var _0x014d=function(_0x591cfd,_0x501204){_0x591cfd=_0x591cfd-0x0;var _0x4d0100=_0x14d0[_0x591cfd];return _0x4d0100;};'use strict';var _=require('lodash');var util=require(_0x014d('0x0'));var moment=require(_0x014d('0x1'));var BPromise=require(_0x014d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x014d('0x3'));var logger=require(_0x014d('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x014d('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48813c,_0x3fe953,_0x19333e){return new BPromise(function(_0x466815,_0x34d060){return client[_0x014d('0x6')](_0x48813c,_0x19333e)[_0x014d('0x7')](function(_0x1ec1e3){logger[_0x014d('0x8')](_0x014d('0x9'),_0x3fe953,_0x014d('0xa'));logger[_0x014d('0xb')](_0x014d('0xc'),_0x3fe953,_0x014d('0xa'),JSON[_0x014d('0xd')](_0x1ec1e3));if(_0x1ec1e3['error']){if(_0x1ec1e3['error'][_0x014d('0xe')]===0x1f4){logger[_0x014d('0xf')](_0x014d('0x9'),_0x3fe953,_0x1ec1e3[_0x014d('0xf')][_0x014d('0x10')]);return _0x34d060(_0x1ec1e3[_0x014d('0xf')][_0x014d('0x10')]);}logger[_0x014d('0xf')](_0x014d('0x9'),_0x3fe953,_0x1ec1e3[_0x014d('0xf')][_0x014d('0x10')]);return _0x466815(_0x1ec1e3[_0x014d('0xf')][_0x014d('0x10')]);}else{logger['info']('ScreenRecording,\x20%s,\x20%s',_0x3fe953,'request\x20sent');_0x466815(_0x1ec1e3['result'][_0x014d('0x10')]);}})[_0x014d('0x11')](function(_0x28eaa9){logger[_0x014d('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x3fe953,_0x28eaa9);_0x34d060(_0x28eaa9);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 19c7c17..5db05a1 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 _0x5f3e=['/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','originalname','post','single','file','addLogo','%s%s','extname','addPreferred','favicon','addFavicon','put','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/now','getDate','/:id'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x5f3e,0x1aa));var _0xe5f3=function(_0x3cf730,_0x1bc146){_0x3cf730=_0x3cf730-0x0;var _0x2079e9=_0x5f3e[_0x3cf730];return _0x2079e9;};'use strict';var multer=require(_0xe5f3('0x0'));var util=require('util');var path=require(_0xe5f3('0x1'));var timeout=require(_0xe5f3('0x2'));var express=require(_0xe5f3('0x3'));var router=express[_0xe5f3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe5f3('0x5'));var interaction=require(_0xe5f3('0x6'));var config=require(_0xe5f3('0x7'));var controller=require('./setting.controller');router[_0xe5f3('0x8')]('/',auth[_0xe5f3('0x9')](),controller[_0xe5f3('0xa')]);router['get'](_0xe5f3('0xb'),controller[_0xe5f3('0xc')]);router['get'](_0xe5f3('0xd'),controller['show']);router[_0xe5f3('0x8')](_0xe5f3('0xe'),controller[_0xe5f3('0xf')]);router[_0xe5f3('0x8')](_0xe5f3('0x10'),controller[_0xe5f3('0x11')]);router['get'](_0xe5f3('0x12'),controller['gdpr']);router[_0xe5f3('0x8')](_0xe5f3('0x13'),controller[_0xe5f3('0x14')]);router[_0xe5f3('0x8')](_0xe5f3('0x15'),controller[_0xe5f3('0x16')]);var upload=multer({'storage':multer[_0xe5f3('0x17')]({'destination':function(_0x41776e,_0x34f285,_0x5e0472){_0x5e0472(null,path[_0xe5f3('0x18')](config[_0xe5f3('0x19')],_0xe5f3('0x1a')));},'filename':function(_0x11d5df,_0x3dbedb,_0x5ec1d0){_0x5ec1d0(null,util[_0xe5f3('0x1b')]('%s%s','logo',path['extname'](_0x3dbedb[_0xe5f3('0x1c')])));}})});router[_0xe5f3('0x1d')](_0xe5f3('0xe'),upload[_0xe5f3('0x1e')](_0xe5f3('0x1f')),controller[_0xe5f3('0x20')]);var upload=multer({'storage':multer[_0xe5f3('0x17')]({'destination':function(_0x49f74d,_0x4ec5b6,_0xbdb5c6){_0xbdb5c6(null,path[_0xe5f3('0x18')](config[_0xe5f3('0x19')],_0xe5f3('0x1a')));},'filename':function(_0x1ceab6,_0x3aa49d,_0x2658f9){_0x2658f9(null,util[_0xe5f3('0x1b')](_0xe5f3('0x21'),'logologin',path[_0xe5f3('0x22')](_0x3aa49d[_0xe5f3('0x1c')])));}})});router[_0xe5f3('0x1d')]('/:id/logo_login',upload[_0xe5f3('0x1e')](_0xe5f3('0x1f')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0xe5f3('0x17')]({'destination':function(_0x4c657a,_0x8af6de,_0x35f38f){_0x35f38f(null,path['join'](config['root'],_0xe5f3('0x1a')));},'filename':function(_0x4c4570,_0x288125,_0x29047c){_0x29047c(null,util[_0xe5f3('0x1b')](_0xe5f3('0x21'),'preferred',path[_0xe5f3('0x22')](_0x288125['originalname'])));}})});router[_0xe5f3('0x1d')]('/:id/preferred',upload[_0xe5f3('0x1e')](_0xe5f3('0x1f')),controller[_0xe5f3('0x23')]);var upload=multer({'storage':multer[_0xe5f3('0x17')]({'destination':function(_0x32b07a,_0x121311,_0x3b4e40){_0x3b4e40(null,path[_0xe5f3('0x18')](config[_0xe5f3('0x19')],_0xe5f3('0x1a')));},'filename':function(_0x496a3e,_0x4cc7a7,_0x5189fe){_0x5189fe(null,util[_0xe5f3('0x1b')](_0xe5f3('0x21'),_0xe5f3('0x24'),path[_0xe5f3('0x22')](_0x4cc7a7[_0xe5f3('0x1c')])));}})});router[_0xe5f3('0x1d')](_0xe5f3('0x15'),upload[_0xe5f3('0x1e')]('file'),controller[_0xe5f3('0x25')]);router[_0xe5f3('0x26')](_0xe5f3('0xd'),auth[_0xe5f3('0x9')](),controller['update']);module[_0xe5f3('0x27')]=router; \ No newline at end of file +var _0xa9b5=['format','logologin','addLogoLogin','%s%s','preferred','file','favicon','addFavicon','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','/:id','show','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','extname','originalname','post','/:id/logo','single','addLogo','root'];(function(_0x1eff83,_0x598a1c){var _0x20f2fa=function(_0x25a530){while(--_0x25a530){_0x1eff83['push'](_0x1eff83['shift']());}};_0x20f2fa(++_0x598a1c);}(_0xa9b5,0x196));var _0x5a9b=function(_0x29dc59,_0x1dde21){_0x29dc59=_0x29dc59-0x0;var _0x1ec45a=_0xa9b5[_0x29dc59];return _0x1ec45a;};'use strict';var multer=require(_0x5a9b('0x0'));var util=require(_0x5a9b('0x1'));var path=require(_0x5a9b('0x2'));var timeout=require(_0x5a9b('0x3'));var express=require(_0x5a9b('0x4'));var router=express[_0x5a9b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5a9b('0x6'));var interaction=require(_0x5a9b('0x7'));var config=require(_0x5a9b('0x8'));var controller=require(_0x5a9b('0x9'));router[_0x5a9b('0xa')]('/',auth[_0x5a9b('0xb')](),controller[_0x5a9b('0xc')]);router['get'](_0x5a9b('0xd'),controller['getDate']);router[_0x5a9b('0xa')](_0x5a9b('0xe'),controller[_0x5a9b('0xf')]);router[_0x5a9b('0xa')]('/:id/logo',controller['getLogo']);router[_0x5a9b('0xa')](_0x5a9b('0x10'),controller[_0x5a9b('0x11')]);router[_0x5a9b('0xa')](_0x5a9b('0x12'),controller[_0x5a9b('0x13')]);router[_0x5a9b('0xa')](_0x5a9b('0x14'),controller[_0x5a9b('0x15')]);router[_0x5a9b('0xa')](_0x5a9b('0x16'),controller[_0x5a9b('0x17')]);var upload=multer({'storage':multer[_0x5a9b('0x18')]({'destination':function(_0x45db15,_0x5a0bf7,_0x4b4542){_0x4b4542(null,path[_0x5a9b('0x19')](config['root'],_0x5a9b('0x1a')));},'filename':function(_0x3e4033,_0x35b624,_0x3c0295){_0x3c0295(null,util['format']('%s%s','logo',path[_0x5a9b('0x1b')](_0x35b624[_0x5a9b('0x1c')])));}})});router[_0x5a9b('0x1d')](_0x5a9b('0x1e'),upload[_0x5a9b('0x1f')]('file'),controller[_0x5a9b('0x20')]);var upload=multer({'storage':multer[_0x5a9b('0x18')]({'destination':function(_0x237eb3,_0x5f480d,_0x28d0b6){_0x28d0b6(null,path[_0x5a9b('0x19')](config[_0x5a9b('0x21')],_0x5a9b('0x1a')));},'filename':function(_0xe08c12,_0xc04db9,_0x2a1750){_0x2a1750(null,util[_0x5a9b('0x22')]('%s%s',_0x5a9b('0x23'),path[_0x5a9b('0x1b')](_0xc04db9['originalname'])));}})});router[_0x5a9b('0x1d')]('/:id/logo_login',upload[_0x5a9b('0x1f')]('file'),controller[_0x5a9b('0x24')]);var upload=multer({'storage':multer[_0x5a9b('0x18')]({'destination':function(_0x3a0f91,_0x4a9fdb,_0x58c356){_0x58c356(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x5177ee,_0x1e76ab,_0x5e26de){_0x5e26de(null,util[_0x5a9b('0x22')](_0x5a9b('0x25'),_0x5a9b('0x26'),path['extname'](_0x1e76ab[_0x5a9b('0x1c')])));}})});router[_0x5a9b('0x1d')]('/:id/preferred',upload[_0x5a9b('0x1f')](_0x5a9b('0x27')),controller['addPreferred']);var upload=multer({'storage':multer[_0x5a9b('0x18')]({'destination':function(_0xacf7e,_0x50db43,_0x3788a5){_0x3788a5(null,path[_0x5a9b('0x19')](config['root'],'server/files/images/logos/'));},'filename':function(_0x33606e,_0x252d98,_0x5c4a2e){_0x5c4a2e(null,util[_0x5a9b('0x22')](_0x5a9b('0x25'),_0x5a9b('0x28'),path[_0x5a9b('0x1b')](_0x252d98[_0x5a9b('0x1c')])));}})});router[_0x5a9b('0x1d')](_0x5a9b('0x16'),upload[_0x5a9b('0x1f')](_0x5a9b('0x27')),controller[_0x5a9b('0x29')]);router[_0x5a9b('0x2a')](_0x5a9b('0xe'),auth[_0x5a9b('0xb')](),controller[_0x5a9b('0x2b')]);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 6c3d24e..60790ef 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 _0x2ef3=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize','exports','INTEGER','min_internal'];(function(_0x2dac3c,_0x3a1b8f){var _0x3fbfdb=function(_0x15501b){while(--_0x15501b){_0x2dac3c['push'](_0x2dac3c['shift']());}};_0x3fbfdb(++_0x3a1b8f);}(_0x2ef3,0xba));var _0x32ef=function(_0x2e01c7,_0x3b6a6b){_0x2e01c7=_0x2e01c7-0x0;var _0x55be17=_0x2ef3[_0x2e01c7];return _0x55be17;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'min_internal':{'type':Sequelize[_0x32ef('0x2')](0xb),'unique':_0x32ef('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x32ef('0x2')](0xb),'unique':_0x32ef('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x32ef('0x5')],'defaultValue':_0x32ef('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x32ef('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x32ef('0x5')]},'turnaddr':{'type':Sequelize[_0x32ef('0x5')]},'turnusername':{'type':Sequelize[_0x32ef('0x5')]},'turnpassword':{'type':Sequelize[_0x32ef('0x5')]},'pageTitle':{'type':Sequelize[_0x32ef('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x32ef('0x5')],'defaultValue':_0x32ef('0x8')},'enableEmailPreview':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x32ef('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x32ef('0x5')]},'defaultFavicon':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x32ef('0x2')]},'transcribeRegion':{'type':Sequelize[_0x32ef('0x5')]},'sentiment':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x32ef('0x5')]},'language':{'type':Sequelize[_0x32ef('0x5')]},'bucket':{'type':Sequelize[_0x32ef('0x5')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x32ef('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x32ef('0x2')](0x2)[_0x32ef('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x32ef('0x2')](0x2)[_0x32ef('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x32ef('0x2')](0x2)[_0x32ef('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0x2ef3=['min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED','sequelize','exports','INTEGER','min_internal'];(function(_0x33f54d,_0x41586b){var _0x11bf6f=function(_0x179274){while(--_0x179274){_0x33f54d['push'](_0x33f54d['shift']());}};_0x11bf6f(++_0x41586b);}(_0x2ef3,0xba));var _0x32ef=function(_0x3feb68,_0x482f3e){_0x3feb68=_0x3feb68-0x0;var _0x534984=_0x2ef3[_0x3feb68];return _0x534984;};'use strict';var Sequelize=require(_0x32ef('0x0'));module[_0x32ef('0x1')]={'min_internal':{'type':Sequelize[_0x32ef('0x2')](0xb),'unique':_0x32ef('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x32ef('0x2')](0xb),'unique':_0x32ef('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x32ef('0x5')],'defaultValue':_0x32ef('0x6')},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x32ef('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x32ef('0x5')]},'turnaddr':{'type':Sequelize[_0x32ef('0x5')]},'turnusername':{'type':Sequelize[_0x32ef('0x5')]},'turnpassword':{'type':Sequelize[_0x32ef('0x5')]},'pageTitle':{'type':Sequelize[_0x32ef('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x32ef('0x5')],'defaultValue':_0x32ef('0x8')},'enableEmailPreview':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'split':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x32ef('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x32ef('0x5')]},'defaultFavicon':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x32ef('0x2')]},'transcribeRegion':{'type':Sequelize[_0x32ef('0x5')]},'sentiment':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0x32ef('0x5')]},'language':{'type':Sequelize[_0x32ef('0x5')]},'bucket':{'type':Sequelize[_0x32ef('0x5')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x32ef('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x32ef('0x2')](0x2)[_0x32ef('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x32ef('0x2')](0x2)[_0x32ef('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x32ef('0x2')](0x2)[_0x32ef('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x32ef('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x32ef('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index ee730fa..ccf98f1 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 _0x520e=['ValidationError','upperFirst','\x20not\x20found','download','defaultLogo','defaultFavicon','gdpr','addPreferred','preferred','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','stack','name','Setting','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','options','find','catch','body','params','file','filename','logo','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLoginLogo','defaultPreferred','join','root','toLower','default_logo.svg','default','custom','existsSync','Sequelize'];(function(_0x29411b,_0x29fe3d){var _0x14afde=function(_0x28c831){while(--_0x28c831){_0x29411b['push'](_0x29411b['shift']());}};_0x14afde(++_0x29fe3d);}(_0x520e,0x90));var _0xe520=function(_0x30bd66,_0x36a93d){_0x30bd66=_0x30bd66-0x0;var _0x74c9dd=_0x520e[_0x30bd66];return _0x74c9dd;};'use strict';var emlformat=require(_0xe520('0x0'));var rimraf=require(_0xe520('0x1'));var zipdir=require(_0xe520('0x2'));var jsonpatch=require(_0xe520('0x3'));var rp=require(_0xe520('0x4'));var moment=require(_0xe520('0x5'));var BPromise=require(_0xe520('0x6'));var Mustache=require('mustache');var util=require(_0xe520('0x7'));var path=require(_0xe520('0x8'));var sox=require('sox');var csv=require(_0xe520('0x9'));var ejs=require(_0xe520('0xa'));var fs=require('fs');var fs_extra=require(_0xe520('0xb'));var _=require(_0xe520('0xc'));var squel=require(_0xe520('0xd'));var crypto=require(_0xe520('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe520('0xf'));var toCsv=require(_0xe520('0x9'));var querystring=require(_0xe520('0x10'));var Papa=require(_0xe520('0x11'));var Redis=require(_0xe520('0x12'));var authService=require(_0xe520('0x13'));var qs=require(_0xe520('0x14'));var as=require(_0xe520('0x15'));var hardwareService=require(_0xe520('0x16'));var logger=require(_0xe520('0x17'))(_0xe520('0x18'));var utils=require(_0xe520('0x19'));var config=require(_0xe520('0x1a'));var licenseUtil=require(_0xe520('0x1b'));var db=require(_0xe520('0x1c'))['db'];var jayson=require(_0xe520('0x1d'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c0889,_0x4c1bc8,_0x43ca74,_0x24a5a0){return new BPromise(function(_0x51a02b,_0x2bf1f6){var _0xf21274=_0x24a5a0||client;return _0xf21274[_0xe520('0x1e')](_0x1c0889,_0x43ca74)[_0xe520('0x1f')](function(_0x37d265){logger[_0xe520('0x20')](_0xe520('0x21'),_0x4c1bc8,_0xe520('0x22'));logger[_0xe520('0x23')]('Setting,\x20%s,\x20%s,\x20%s',_0x4c1bc8,_0xe520('0x22'),JSON['stringify'](_0x37d265));if(_0x37d265[_0xe520('0x24')]){if(_0x37d265[_0xe520('0x24')][_0xe520('0x25')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x4c1bc8,_0x37d265[_0xe520('0x24')]['message']);return _0x2bf1f6(_0x37d265[_0xe520('0x24')][_0xe520('0x26')]);}logger[_0xe520('0x24')](_0xe520('0x21'),_0x4c1bc8,_0x37d265['error'][_0xe520('0x26')]);return _0x51a02b(_0x37d265['error']['message']);}else{logger[_0xe520('0x20')](_0xe520('0x21'),_0x4c1bc8,'request\x20sent');_0x51a02b(_0x37d265[_0xe520('0x27')][_0xe520('0x26')]);}})['catch'](function(_0x5ef8bd){logger['error'](_0xe520('0x21'),_0x4c1bc8,_0x5ef8bd);_0x2bf1f6(_0x5ef8bd);});});}function respondWithStatusCode(_0x28f61c,_0x3b8ee7){_0x3b8ee7=_0x3b8ee7||0xcc;return function(_0x20f5f3){if(_0x20f5f3){return _0x28f61c[_0xe520('0x28')](_0x3b8ee7);}return _0x28f61c[_0xe520('0x29')](_0x3b8ee7)[_0xe520('0x2a')]();};}function respondWithResult(_0x27b6ce,_0x288f7e){_0x288f7e=_0x288f7e||0xc8;return function(_0x24faa1){if(_0x24faa1){return _0x27b6ce['status'](_0x288f7e)[_0xe520('0x2b')](_0x24faa1);}};}function respondWithFilteredResult(_0x51dd73,_0x3bdcc8){return function(_0xa491ce){if(_0xa491ce){var _0x48cdde=typeof _0x3bdcc8[_0xe520('0x2c')]===_0xe520('0x2d')&&typeof _0x3bdcc8[_0xe520('0x2e')]===_0xe520('0x2d');var _0x1c3cc2=_0xa491ce['count'];var _0x480514=_0x48cdde?0x0:_0x3bdcc8['offset'];var _0x37b0ec=_0x48cdde?_0xa491ce[_0xe520('0x2f')]:_0x3bdcc8['offset']+_0x3bdcc8[_0xe520('0x2e')];var _0x3b0aaa;if(_0x37b0ec>=_0x1c3cc2){_0x37b0ec=_0x1c3cc2;_0x3b0aaa=0xc8;}else{_0x3b0aaa=0xce;}_0x51dd73['status'](_0x3b0aaa);return _0x51dd73[_0xe520('0x30')](_0xe520('0x31'),_0x480514+'-'+_0x37b0ec+'/'+_0x1c3cc2)[_0xe520('0x2b')](_0xa491ce);}return null;};}function patchUpdates(_0x24de92){return function(_0x32418e){try{jsonpatch['apply'](_0x32418e,_0x24de92,!![]);}catch(_0x2031be){return BPromise[_0xe520('0x32')](_0x2031be);}return _0x32418e[_0xe520('0x33')]();};}function saveUpdates(_0x36319a,_0x3b13d0){return function(_0x2e5cbf){if(_0x2e5cbf){return _0x2e5cbf[_0xe520('0x34')](_0x36319a)['then'](function(_0x595554){return _0x595554;});}return null;};}function removeEntity(_0x36ea57,_0x1fcb4c){return function(_0x5a21b5){if(_0x5a21b5){return _0x5a21b5[_0xe520('0x35')]()[_0xe520('0x1f')](function(){_0x36ea57[_0xe520('0x29')](0xcc)[_0xe520('0x2a')]();});}};}function handleEntityNotFound(_0x3bcb06,_0x5127e9){return function(_0x5a39e8){if(!_0x5a39e8){_0x3bcb06['sendStatus'](0x194);}return _0x5a39e8;};}function handleError(_0x57ede5,_0x1aacce){_0x1aacce=_0x1aacce||0x1f4;return function(_0x3b86b7){logger[_0xe520('0x24')](_0x3b86b7[_0xe520('0x36')]);if(_0x3b86b7[_0xe520('0x37')]){delete _0x3b86b7[_0xe520('0x37')];}_0x57ede5['status'](_0x1aacce)['send'](_0x3b86b7);};}exports['index']=function(_0x108416,_0x473f48){var _0x1ea115={},_0x38af9a={},_0x27ddcb={'count':0x0,'rows':[]};var _0x2a87ee=_['map'](db[_0xe520('0x38')][_0xe520('0x39')],function(_0x179c36){return{'name':_0x179c36[_0xe520('0x3a')],'type':_0x179c36[_0xe520('0x3b')][_0xe520('0x3c')]};});_0x38af9a['model']=_[_0xe520('0x3d')](_0x2a87ee,_0xe520('0x37'));_0x38af9a[_0xe520('0x3e')]=_[_0xe520('0x3f')](_0x108416['query']);_0x38af9a[_0xe520('0x40')]=_[_0xe520('0x41')](_0x38af9a[_0xe520('0x42')],_0x38af9a['query']);_0x1ea115[_0xe520('0x43')]=_[_0xe520('0x41')](_0x38af9a['model'],qs[_0xe520('0x44')](_0x108416[_0xe520('0x3e')]['fields']));_0x1ea115[_0xe520('0x43')]=_0x1ea115['attributes'][_0xe520('0x45')]?_0x1ea115[_0xe520('0x43')]:_0x38af9a[_0xe520('0x42')];if(!_0x108416['query'][_0xe520('0x46')]('nolimit')){_0x1ea115[_0xe520('0x2e')]=qs['limit'](_0x108416['query'][_0xe520('0x2e')]);_0x1ea115['offset']=qs[_0xe520('0x2c')](_0x108416[_0xe520('0x3e')][_0xe520('0x2c')]);}_0x1ea115[_0xe520('0x47')]=qs[_0xe520('0x48')](_0x108416['query'][_0xe520('0x48')]);_0x1ea115[_0xe520('0x49')]=qs['filters'](_[_0xe520('0x4a')](_0x108416[_0xe520('0x3e')],_0x38af9a[_0xe520('0x40')]),_0x2a87ee);if(_0x108416['query'][_0xe520('0x4b')]){_0x1ea115[_0xe520('0x49')]=_[_0xe520('0x4c')](_0x1ea115['where'],{'$or':_[_0xe520('0x3d')](_0x2a87ee,function(_0x1746fb){if(_0x1746fb[_0xe520('0x3b')]!==_0xe520('0x4d')){var _0x7016f6={};_0x7016f6[_0x1746fb[_0xe520('0x37')]]={'$like':'%'+_0x108416['query'][_0xe520('0x4b')]+'%'};return _0x7016f6;}})});}_0x1ea115=_[_0xe520('0x4c')]({},_0x1ea115,_0x108416['options']);var _0x3ef218={'where':_0x1ea115[_0xe520('0x49')]};return db[_0xe520('0x38')][_0xe520('0x2f')](_0x3ef218)['then'](function(_0x1b62b5){_0x27ddcb[_0xe520('0x2f')]=_0x1b62b5;if(_0x108416['query'][_0xe520('0x4e')]){_0x1ea115[_0xe520('0x4f')]=[{'all':!![]}];}return db['Setting'][_0xe520('0x50')](_0x1ea115);})[_0xe520('0x1f')](function(_0x4e5b96){_0x27ddcb['rows']=_0x4e5b96;return _0x27ddcb;})[_0xe520('0x1f')](respondWithFilteredResult(_0x473f48,_0x1ea115))['catch'](handleError(_0x473f48,null));};exports['show']=function(_0x1cc96d,_0x33f921){var _0x243132={'raw':![],'where':{'id':_0x1cc96d['params']['id']}},_0x2cba3b={};_0x2cba3b[_0xe520('0x42')]=_[_0xe520('0x3f')](db[_0xe520('0x38')][_0xe520('0x39')]);_0x2cba3b[_0xe520('0x3e')]=_[_0xe520('0x3f')](_0x1cc96d[_0xe520('0x3e')]);_0x2cba3b[_0xe520('0x40')]=_[_0xe520('0x41')](_0x2cba3b['model'],_0x2cba3b['query']);_0x243132[_0xe520('0x43')]=_[_0xe520('0x41')](_0x2cba3b[_0xe520('0x42')],qs[_0xe520('0x44')](_0x1cc96d['query'][_0xe520('0x44')]));_0x243132[_0xe520('0x43')]=_0x243132[_0xe520('0x43')][_0xe520('0x45')]?_0x243132[_0xe520('0x43')]:_0x2cba3b['model'];if(_0x1cc96d['query'][_0xe520('0x4e')]){_0x243132['include']=[{'all':!![]}];}_0x243132=_[_0xe520('0x4c')]({},_0x243132,_0x1cc96d[_0xe520('0x51')]);return db['Setting'][_0xe520('0x52')](_0x243132)[_0xe520('0x1f')](handleEntityNotFound(_0x33f921,null))[_0xe520('0x1f')](respondWithResult(_0x33f921,null))[_0xe520('0x53')](handleError(_0x33f921,null));};exports[_0xe520('0x34')]=function(_0x5d9293,_0x261932){if(_0x5d9293['body']['id']){delete _0x5d9293[_0xe520('0x54')]['id'];}return db[_0xe520('0x38')]['find']({'where':{'id':_0x5d9293[_0xe520('0x55')]['id']}})[_0xe520('0x1f')](handleEntityNotFound(_0x261932,null))[_0xe520('0x1f')](saveUpdates(_0x5d9293[_0xe520('0x54')],null))[_0xe520('0x1f')](respondWithResult(_0x261932,null))[_0xe520('0x53')](handleError(_0x261932,null));};exports['addLogo']=function(_0x29a2d5,_0x56aee5,_0x1f4eb6){if(_0x29a2d5[_0xe520('0x56')]&&_0x29a2d5['file'][_0xe520('0x57')]){_0x29a2d5[_0xe520('0x54')][_0xe520('0x58')]=_0x29a2d5[_0xe520('0x56')][_0xe520('0x57')];}return db[_0xe520('0x38')][_0xe520('0x52')]({'where':{'id':_0x29a2d5[_0xe520('0x55')]['id']}})[_0xe520('0x1f')](handleEntityNotFound(_0x56aee5,null))[_0xe520('0x1f')](saveUpdates(_0x29a2d5[_0xe520('0x54')],null))[_0xe520('0x1f')](respondWithResult(_0x56aee5,null))[_0xe520('0x53')](handleError(_0x56aee5,null));};exports['addLogoLogin']=function(_0x3bce92,_0x380bac,_0xd07bc3){if(_0x3bce92['file']&&_0x3bce92['file']['filename']){_0x3bce92[_0xe520('0x54')][_0xe520('0x59')]=_0x3bce92[_0xe520('0x56')][_0xe520('0x57')];}return db[_0xe520('0x38')][_0xe520('0x52')]({'where':{'id':_0x3bce92[_0xe520('0x55')]['id']}})['then'](handleEntityNotFound(_0x380bac,null))[_0xe520('0x1f')](saveUpdates(_0x3bce92[_0xe520('0x54')],null))['then'](respondWithResult(_0x380bac,null))[_0xe520('0x53')](handleError(_0x380bac,null));};var utilLicense=require('../../config/license/util');exports[_0xe520('0x5a')]=function(_0x708b7e,_0x23d91d,_0x530a44){var _0x198bff=_0xe520('0x5b');var _0x11c772={'custom':![]};return utilLicense[_0xe520('0x5c')]()['then'](function(_0x111b00){if(_0x111b00){_0x11c772=_0x111b00;}return db[_0xe520('0x38')]['find']({'where':{'id':_0x708b7e[_0xe520('0x55')]['id']},'attributes':[_0xe520('0x58'),'loginLogo','preferred',_0xe520('0x5d'),'defaultLogo',_0xe520('0x5e'),_0xe520('0x5f'),'defaultFavicon'],'raw':!![]});})[_0xe520('0x1f')](handleEntityNotFound(_0x23d91d,null))[_0xe520('0x1f')](function(_0x2eaaef){if(_0x2eaaef){var _0x35582f=_0x2eaaef[_0xe520('0x58')]&&fs['existsSync'](path[_0xe520('0x60')](config[_0xe520('0x61')],_0x198bff,_[_0xe520('0x62')](_0x2eaaef['logo'])))?path[_0xe520('0x60')](config[_0xe520('0x61')],_0x198bff,_[_0xe520('0x62')](_0x2eaaef[_0xe520('0x58')])):path['join'](config[_0xe520('0x61')],_0x198bff,_[_0xe520('0x62')](_0xe520('0x63')));var _0x566d6b=_0xe520('0x64')+_['upperFirst'](_0xe520('0x58'));if(_0x2eaaef[_0x566d6b]||!_0x11c772[_0xe520('0x65')]){_0x35582f=path[_0xe520('0x60')](config[_0xe520('0x61')],_0x198bff,_[_0xe520('0x62')](_0xe520('0x63')));}if(!fs[_0xe520('0x66')](_0x35582f)){throw new db[(_0xe520('0x67'))][(_0xe520('0x68'))](_[_0xe520('0x69')](_0xe520('0x58'))+_0xe520('0x6a'));}return _0x23d91d[_0xe520('0x6b')](_0x35582f);}})[_0xe520('0x53')](handleError(_0x23d91d,null));};var utilLicense=require(_0xe520('0x1b'));exports['getLogoLogin']=function(_0x4f6d8e,_0x479836,_0x46f1be){var _0x8ffc43=_0xe520('0x5b');var _0x5403f4={'custom':![]};return utilLicense[_0xe520('0x5c')]()[_0xe520('0x1f')](function(_0x2d75d8){if(_0x2d75d8){_0x5403f4=_0x2d75d8;}return db[_0xe520('0x38')][_0xe520('0x52')]({'where':{'id':_0x4f6d8e[_0xe520('0x55')]['id']},'attributes':[_0xe520('0x58'),'loginLogo','preferred',_0xe520('0x5d'),_0xe520('0x6c'),_0xe520('0x5e'),_0xe520('0x5f'),_0xe520('0x6d')],'raw':!![]});})[_0xe520('0x1f')](handleEntityNotFound(_0x479836,null))['then'](function(_0x8b3e2){if(_0x8b3e2){var _0xa829f4=_0x8b3e2[_0xe520('0x59')]&&fs[_0xe520('0x66')](path[_0xe520('0x60')](config[_0xe520('0x61')],_0x8ffc43,_[_0xe520('0x62')](_0x8b3e2[_0xe520('0x59')])))?path[_0xe520('0x60')](config[_0xe520('0x61')],_0x8ffc43,_[_0xe520('0x62')](_0x8b3e2[_0xe520('0x59')])):path[_0xe520('0x60')](config[_0xe520('0x61')],_0x8ffc43,_[_0xe520('0x62')]('default_loginLogo.svg'));var _0x103618=_0xe520('0x64')+_[_0xe520('0x69')](_0xe520('0x59'));if(_0x8b3e2[_0x103618]||!_0x5403f4['custom']){_0xa829f4=path[_0xe520('0x60')](config[_0xe520('0x61')],_0x8ffc43,_[_0xe520('0x62')]('default_loginLogo.svg'));}if(!fs[_0xe520('0x66')](_0xa829f4)){throw new db['Sequelize'][(_0xe520('0x68'))](_['upperFirst'](_0xe520('0x59'))+_0xe520('0x6a'));}return _0x479836['download'](_0xa829f4);}})['catch'](handleError(_0x479836,null));};exports[_0xe520('0x6e')]=function(_0x58c7d7,_0x294ef6){return db[_0xe520('0x38')]['find']({'where':{'id':_0x58c7d7[_0xe520('0x55')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x294ef6,null))[_0xe520('0x53')](handleError(_0x294ef6,null));};exports[_0xe520('0x6f')]=function(_0x4660f4,_0x2731c1,_0x24b657){if(_0x4660f4[_0xe520('0x56')]&&_0x4660f4[_0xe520('0x56')]['filename']){_0x4660f4[_0xe520('0x54')][_0xe520('0x70')]=_0x4660f4[_0xe520('0x56')]['filename'];}return db[_0xe520('0x38')][_0xe520('0x52')]({'where':{'id':_0x4660f4[_0xe520('0x55')]['id']}})[_0xe520('0x1f')](handleEntityNotFound(_0x2731c1,null))[_0xe520('0x1f')](saveUpdates(_0x4660f4[_0xe520('0x54')],null))['then'](respondWithResult(_0x2731c1,null))[_0xe520('0x53')](handleError(_0x2731c1,null));};var utilLicense=require(_0xe520('0x1b'));exports[_0xe520('0x71')]=function(_0x2bf177,_0xb3279b,_0x27d21c){var _0x3a53e1=_0xe520('0x5b');var _0xe2e6b2={'custom':![]};return utilLicense['getLicense']()[_0xe520('0x1f')](function(_0x441754){if(_0x441754){_0xe2e6b2=_0x441754;}return db['Setting'][_0xe520('0x52')]({'where':{'id':_0x2bf177['params']['id']},'attributes':['logo',_0xe520('0x59'),_0xe520('0x70'),_0xe520('0x5d'),_0xe520('0x6c'),_0xe520('0x5e'),_0xe520('0x5f'),_0xe520('0x6d')],'raw':!![]});})[_0xe520('0x1f')](handleEntityNotFound(_0xb3279b,null))[_0xe520('0x1f')](function(_0x46ef0e){if(_0x46ef0e){var _0x7f5cd4=_0x46ef0e[_0xe520('0x70')]&&fs[_0xe520('0x66')](path['join'](config['root'],_0x3a53e1,_['toLower'](_0x46ef0e['preferred'])))?path['join'](config[_0xe520('0x61')],_0x3a53e1,_[_0xe520('0x62')](_0x46ef0e['preferred'])):path[_0xe520('0x60')](config[_0xe520('0x61')],_0x3a53e1,_[_0xe520('0x62')](_0xe520('0x72')));var _0xa12696=_0xe520('0x64')+_[_0xe520('0x69')]('preferred');if(_0x46ef0e[_0xa12696]||!_0xe2e6b2[_0xe520('0x65')]||!_0xe2e6b2[_0xe520('0x70')]){_0x7f5cd4=path[_0xe520('0x60')](config[_0xe520('0x61')],_0x3a53e1,_[_0xe520('0x62')]('default_preferred.png'));}if(!fs[_0xe520('0x66')](_0x7f5cd4)){throw new db[(_0xe520('0x67'))][(_0xe520('0x68'))](_[_0xe520('0x69')](_0xe520('0x70'))+_0xe520('0x6a'));}return _0xb3279b['download'](_0x7f5cd4);}})['catch'](handleError(_0xb3279b,null));};exports[_0xe520('0x73')]=function(_0xb8c6d4,_0x111522,_0x40d7ba){if(_0xb8c6d4[_0xe520('0x56')]&&_0xb8c6d4[_0xe520('0x56')][_0xe520('0x57')]){_0xb8c6d4[_0xe520('0x54')][_0xe520('0x5d')]=_0xb8c6d4[_0xe520('0x56')]['filename'];}return db['Setting'][_0xe520('0x52')]({'where':{'id':_0xb8c6d4[_0xe520('0x55')]['id']}})[_0xe520('0x1f')](handleEntityNotFound(_0x111522,null))[_0xe520('0x1f')](saveUpdates(_0xb8c6d4[_0xe520('0x54')],null))['then'](respondWithResult(_0x111522,null))['catch'](handleError(_0x111522,null));};var utilLicense=require('../../config/license/util');exports[_0xe520('0x74')]=function(_0x3eee7d,_0x169ca9,_0x1201ab){var _0x2770a2=_0xe520('0x5b');var _0x45bea8={'custom':![]};return utilLicense[_0xe520('0x5c')]()[_0xe520('0x1f')](function(_0x356f5b){if(_0x356f5b){_0x45bea8=_0x356f5b;}return db[_0xe520('0x38')][_0xe520('0x52')]({'where':{'id':_0x3eee7d[_0xe520('0x55')]['id']},'attributes':[_0xe520('0x58'),_0xe520('0x59'),'preferred',_0xe520('0x5d'),'defaultLogo',_0xe520('0x5e'),'defaultPreferred',_0xe520('0x6d')],'raw':!![]});})[_0xe520('0x1f')](handleEntityNotFound(_0x169ca9,null))[_0xe520('0x1f')](function(_0x697a7c){if(_0x697a7c){var _0x3893f9=_0x697a7c[_0xe520('0x5d')]&&fs[_0xe520('0x66')](path[_0xe520('0x60')](config[_0xe520('0x61')],_0x2770a2,_[_0xe520('0x62')](_0x697a7c[_0xe520('0x5d')])))?path[_0xe520('0x60')](config[_0xe520('0x61')],_0x2770a2,_[_0xe520('0x62')](_0x697a7c[_0xe520('0x5d')])):path[_0xe520('0x60')](config['root'],_0x2770a2,_['toLower']('default_favicon.ico'));var _0x18ac33=_0xe520('0x64')+_[_0xe520('0x69')]('favicon');if(_0x697a7c[_0x18ac33]||!_0x45bea8[_0xe520('0x65')]){_0x3893f9=path['join'](config['root'],_0x2770a2,_[_0xe520('0x62')](_0xe520('0x75')));}if(!fs[_0xe520('0x66')](_0x3893f9)){throw new db['Sequelize'][(_0xe520('0x68'))](_['upperFirst']('favicon')+_0xe520('0x6a'));}return _0x169ca9[_0xe520('0x6b')](_0x3893f9);}})[_0xe520('0x53')](handleError(_0x169ca9,null));};exports[_0xe520('0x76')]=function(_0x1ffb68,_0x19d9c4){var _0x454f89={'offset':moment()[_0xe520('0x77')]()};_0x454f89[_0xe520('0x78')]=moment()[_0xe520('0x77')](_0x454f89['offset'])[_0xe520('0x79')](_0xe520('0x7a'));return _0x19d9c4['status'](0xc8)[_0xe520('0x7b')](_0x454f89);}; \ No newline at end of file +var _0x90ae=['defaultPreferred','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','Sequelize','ValidationError','download','getLogoLogin','server/files/images/logos','preferred','defaultLogo','defaultLoginLogo','defaultFavicon','default_loginLogo.svg','custom','\x20not\x20found','gdpr','addPreferred','getPreferred','favicon','default_preferred.png','getFavicon','default_favicon.ico','utcOffset','now','format','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','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/logger','../../config/utils','../../config/environment','jayson/promise','client','request','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','key','model','keys','query','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','params','body','find','addLogo','file','filename','logo','addLogoLogin','loginLogo','../../config/license/util','getLogo','getLicense'];(function(_0x3b7127,_0xbc1362){var _0x3a055c=function(_0x25df20){while(--_0x25df20){_0x3b7127['push'](_0x3b7127['shift']());}};_0x3a055c(++_0xbc1362);}(_0x90ae,0x195));var _0xe90a=function(_0x2b129f,_0x217e7f){_0x2b129f=_0x2b129f-0x0;var _0x2d0501=_0x90ae[_0x2b129f];return _0x2d0501;};'use strict';var emlformat=require(_0xe90a('0x0'));var rimraf=require(_0xe90a('0x1'));var zipdir=require(_0xe90a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe90a('0x3'));var moment=require(_0xe90a('0x4'));var BPromise=require(_0xe90a('0x5'));var Mustache=require(_0xe90a('0x6'));var util=require(_0xe90a('0x7'));var path=require(_0xe90a('0x8'));var sox=require(_0xe90a('0x9'));var csv=require(_0xe90a('0xa'));var ejs=require(_0xe90a('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe90a('0xc'));var squel=require(_0xe90a('0xd'));var crypto=require(_0xe90a('0xe'));var jsforce=require(_0xe90a('0xf'));var deskjs=require(_0xe90a('0x10'));var toCsv=require(_0xe90a('0xa'));var querystring=require('querystring');var Papa=require(_0xe90a('0x11'));var Redis=require(_0xe90a('0x12'));var authService=require(_0xe90a('0x13'));var qs=require(_0xe90a('0x14'));var as=require(_0xe90a('0x15'));var hardwareService=require(_0xe90a('0x16'));var logger=require(_0xe90a('0x17'))('api');var utils=require(_0xe90a('0x18'));var config=require(_0xe90a('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xe90a('0x1a'));var client=jayson[_0xe90a('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e1ee9,_0xd215c8,_0x20ea41,_0x5e550e){return new BPromise(function(_0x2e9d5f,_0x3d845e){var _0x4fd825=_0x5e550e||client;return _0x4fd825[_0xe90a('0x1c')](_0x2e1ee9,_0x20ea41)['then'](function(_0x5342d7){logger['info'](_0xe90a('0x1d'),_0xd215c8,_0xe90a('0x1e'));logger[_0xe90a('0x1f')](_0xe90a('0x20'),_0xd215c8,_0xe90a('0x1e'),JSON[_0xe90a('0x21')](_0x5342d7));if(_0x5342d7[_0xe90a('0x22')]){if(_0x5342d7[_0xe90a('0x22')][_0xe90a('0x23')]===0x1f4){logger[_0xe90a('0x22')](_0xe90a('0x1d'),_0xd215c8,_0x5342d7[_0xe90a('0x22')][_0xe90a('0x24')]);return _0x3d845e(_0x5342d7['error'][_0xe90a('0x24')]);}logger[_0xe90a('0x22')](_0xe90a('0x1d'),_0xd215c8,_0x5342d7[_0xe90a('0x22')]['message']);return _0x2e9d5f(_0x5342d7[_0xe90a('0x22')][_0xe90a('0x24')]);}else{logger[_0xe90a('0x25')]('Setting,\x20%s,\x20%s',_0xd215c8,_0xe90a('0x1e'));_0x2e9d5f(_0x5342d7[_0xe90a('0x26')][_0xe90a('0x24')]);}})[_0xe90a('0x27')](function(_0x3f9c51){logger[_0xe90a('0x22')]('Setting,\x20%s,\x20%s',_0xd215c8,_0x3f9c51);_0x3d845e(_0x3f9c51);});});}function respondWithStatusCode(_0x461c01,_0x4f8888){_0x4f8888=_0x4f8888||0xcc;return function(_0x2f75c2){if(_0x2f75c2){return _0x461c01[_0xe90a('0x28')](_0x4f8888);}return _0x461c01[_0xe90a('0x29')](_0x4f8888)[_0xe90a('0x2a')]();};}function respondWithResult(_0x431c09,_0x2eeda9){_0x2eeda9=_0x2eeda9||0xc8;return function(_0x57bede){if(_0x57bede){return _0x431c09[_0xe90a('0x29')](_0x2eeda9)[_0xe90a('0x2b')](_0x57bede);}};}function respondWithFilteredResult(_0x4d1bec,_0x15a36b){return function(_0x334f5c){if(_0x334f5c){var _0x486e2e=typeof _0x15a36b[_0xe90a('0x2c')]===_0xe90a('0x2d')&&typeof _0x15a36b[_0xe90a('0x2e')]===_0xe90a('0x2d');var _0x5b1061=_0x334f5c[_0xe90a('0x2f')];var _0x2dc8e9=_0x486e2e?0x0:_0x15a36b['offset'];var _0x1bd5d7=_0x486e2e?_0x334f5c[_0xe90a('0x2f')]:_0x15a36b[_0xe90a('0x2c')]+_0x15a36b[_0xe90a('0x2e')];var _0x211892;if(_0x1bd5d7>=_0x5b1061){_0x1bd5d7=_0x5b1061;_0x211892=0xc8;}else{_0x211892=0xce;}_0x4d1bec[_0xe90a('0x29')](_0x211892);return _0x4d1bec['set'](_0xe90a('0x30'),_0x2dc8e9+'-'+_0x1bd5d7+'/'+_0x5b1061)[_0xe90a('0x2b')](_0x334f5c);}return null;};}function patchUpdates(_0x559e83){return function(_0xd1c7b3){try{jsonpatch[_0xe90a('0x31')](_0xd1c7b3,_0x559e83,!![]);}catch(_0x1ccc0a){return BPromise[_0xe90a('0x32')](_0x1ccc0a);}return _0xd1c7b3[_0xe90a('0x33')]();};}function saveUpdates(_0x2c02f,_0x432ab3){return function(_0x4a1997){if(_0x4a1997){return _0x4a1997['update'](_0x2c02f)[_0xe90a('0x34')](function(_0x3ac7b6){return _0x3ac7b6;});}return null;};}function removeEntity(_0x3344ff,_0x3f5f7e){return function(_0x5d8796){if(_0x5d8796){return _0x5d8796[_0xe90a('0x35')]()[_0xe90a('0x34')](function(){_0x3344ff[_0xe90a('0x29')](0xcc)[_0xe90a('0x2a')]();});}};}function handleEntityNotFound(_0x31c5d0,_0x20fb37){return function(_0x21b696){if(!_0x21b696){_0x31c5d0[_0xe90a('0x28')](0x194);}return _0x21b696;};}function handleError(_0x9cee5,_0x596835){_0x596835=_0x596835||0x1f4;return function(_0x5216ab){logger[_0xe90a('0x22')](_0x5216ab[_0xe90a('0x36')]);if(_0x5216ab[_0xe90a('0x37')]){delete _0x5216ab[_0xe90a('0x37')];}_0x9cee5['status'](_0x596835)[_0xe90a('0x38')](_0x5216ab);};}exports[_0xe90a('0x39')]=function(_0x3d1cfa,_0x3df17a){var _0x1f0c4a={},_0x36ade1={},_0x5d5e9c={'count':0x0,'rows':[]};var _0x2cf726=_[_0xe90a('0x3a')](db[_0xe90a('0x3b')][_0xe90a('0x3c')],function(_0x535833){return{'name':_0x535833[_0xe90a('0x3d')],'type':_0x535833['type'][_0xe90a('0x3e')]};});_0x36ade1[_0xe90a('0x3f')]=_[_0xe90a('0x3a')](_0x2cf726,_0xe90a('0x37'));_0x36ade1['query']=_[_0xe90a('0x40')](_0x3d1cfa[_0xe90a('0x41')]);_0x36ade1[_0xe90a('0x42')]=_['intersection'](_0x36ade1['model'],_0x36ade1['query']);_0x1f0c4a[_0xe90a('0x43')]=_[_0xe90a('0x44')](_0x36ade1[_0xe90a('0x3f')],qs[_0xe90a('0x45')](_0x3d1cfa['query'][_0xe90a('0x45')]));_0x1f0c4a[_0xe90a('0x43')]=_0x1f0c4a[_0xe90a('0x43')][_0xe90a('0x46')]?_0x1f0c4a['attributes']:_0x36ade1[_0xe90a('0x3f')];if(!_0x3d1cfa['query']['hasOwnProperty'](_0xe90a('0x47'))){_0x1f0c4a['limit']=qs[_0xe90a('0x2e')](_0x3d1cfa[_0xe90a('0x41')][_0xe90a('0x2e')]);_0x1f0c4a[_0xe90a('0x2c')]=qs[_0xe90a('0x2c')](_0x3d1cfa[_0xe90a('0x41')][_0xe90a('0x2c')]);}_0x1f0c4a['order']=qs[_0xe90a('0x48')](_0x3d1cfa[_0xe90a('0x41')]['sort']);_0x1f0c4a[_0xe90a('0x49')]=qs[_0xe90a('0x42')](_[_0xe90a('0x4a')](_0x3d1cfa[_0xe90a('0x41')],_0x36ade1['filters']),_0x2cf726);if(_0x3d1cfa[_0xe90a('0x41')][_0xe90a('0x4b')]){_0x1f0c4a[_0xe90a('0x49')]=_[_0xe90a('0x4c')](_0x1f0c4a[_0xe90a('0x49')],{'$or':_[_0xe90a('0x3a')](_0x2cf726,function(_0x2b3c75){if(_0x2b3c75[_0xe90a('0x4d')]!==_0xe90a('0x4e')){var _0x528896={};_0x528896[_0x2b3c75['name']]={'$like':'%'+_0x3d1cfa['query'][_0xe90a('0x4b')]+'%'};return _0x528896;}})});}_0x1f0c4a=_[_0xe90a('0x4c')]({},_0x1f0c4a,_0x3d1cfa[_0xe90a('0x4f')]);var _0x568597={'where':_0x1f0c4a[_0xe90a('0x49')]};return db[_0xe90a('0x3b')]['count'](_0x568597)[_0xe90a('0x34')](function(_0x28c7f5){_0x5d5e9c['count']=_0x28c7f5;if(_0x3d1cfa[_0xe90a('0x41')]['includeAll']){_0x1f0c4a[_0xe90a('0x50')]=[{'all':!![]}];}return db[_0xe90a('0x3b')][_0xe90a('0x51')](_0x1f0c4a);})[_0xe90a('0x34')](function(_0x5d6099){_0x5d5e9c[_0xe90a('0x52')]=_0x5d6099;return _0x5d5e9c;})[_0xe90a('0x34')](respondWithFilteredResult(_0x3df17a,_0x1f0c4a))['catch'](handleError(_0x3df17a,null));};exports['show']=function(_0x3dddb8,_0x327690){var _0x203aa6={'raw':![],'where':{'id':_0x3dddb8[_0xe90a('0x53')]['id']}},_0x12c95b={};_0x12c95b[_0xe90a('0x3f')]=_[_0xe90a('0x40')](db[_0xe90a('0x3b')][_0xe90a('0x3c')]);_0x12c95b[_0xe90a('0x41')]=_['keys'](_0x3dddb8['query']);_0x12c95b[_0xe90a('0x42')]=_[_0xe90a('0x44')](_0x12c95b[_0xe90a('0x3f')],_0x12c95b[_0xe90a('0x41')]);_0x203aa6['attributes']=_['intersection'](_0x12c95b[_0xe90a('0x3f')],qs[_0xe90a('0x45')](_0x3dddb8[_0xe90a('0x41')][_0xe90a('0x45')]));_0x203aa6[_0xe90a('0x43')]=_0x203aa6['attributes'][_0xe90a('0x46')]?_0x203aa6[_0xe90a('0x43')]:_0x12c95b['model'];if(_0x3dddb8[_0xe90a('0x41')]['includeAll']){_0x203aa6[_0xe90a('0x50')]=[{'all':!![]}];}_0x203aa6=_[_0xe90a('0x4c')]({},_0x203aa6,_0x3dddb8[_0xe90a('0x4f')]);return db[_0xe90a('0x3b')]['find'](_0x203aa6)[_0xe90a('0x34')](handleEntityNotFound(_0x327690,null))[_0xe90a('0x34')](respondWithResult(_0x327690,null))[_0xe90a('0x27')](handleError(_0x327690,null));};exports['update']=function(_0x12b599,_0x20da56){if(_0x12b599[_0xe90a('0x54')]['id']){delete _0x12b599['body']['id'];}return db[_0xe90a('0x3b')][_0xe90a('0x55')]({'where':{'id':_0x12b599[_0xe90a('0x53')]['id']}})[_0xe90a('0x34')](handleEntityNotFound(_0x20da56,null))['then'](saveUpdates(_0x12b599[_0xe90a('0x54')],null))[_0xe90a('0x34')](respondWithResult(_0x20da56,null))[_0xe90a('0x27')](handleError(_0x20da56,null));};exports[_0xe90a('0x56')]=function(_0x250fe4,_0xe2d539,_0x7b8c94){if(_0x250fe4['file']&&_0x250fe4[_0xe90a('0x57')][_0xe90a('0x58')]){_0x250fe4[_0xe90a('0x54')][_0xe90a('0x59')]=_0x250fe4[_0xe90a('0x57')][_0xe90a('0x58')];}return db['Setting']['find']({'where':{'id':_0x250fe4[_0xe90a('0x53')]['id']}})[_0xe90a('0x34')](handleEntityNotFound(_0xe2d539,null))[_0xe90a('0x34')](saveUpdates(_0x250fe4['body'],null))[_0xe90a('0x34')](respondWithResult(_0xe2d539,null))[_0xe90a('0x27')](handleError(_0xe2d539,null));};exports[_0xe90a('0x5a')]=function(_0x5f0a2e,_0x3d1a91,_0x463285){if(_0x5f0a2e[_0xe90a('0x57')]&&_0x5f0a2e[_0xe90a('0x57')][_0xe90a('0x58')]){_0x5f0a2e['body'][_0xe90a('0x5b')]=_0x5f0a2e['file'][_0xe90a('0x58')];}return db[_0xe90a('0x3b')][_0xe90a('0x55')]({'where':{'id':_0x5f0a2e['params']['id']}})[_0xe90a('0x34')](handleEntityNotFound(_0x3d1a91,null))['then'](saveUpdates(_0x5f0a2e[_0xe90a('0x54')],null))[_0xe90a('0x34')](respondWithResult(_0x3d1a91,null))['catch'](handleError(_0x3d1a91,null));};var utilLicense=require(_0xe90a('0x5c'));exports[_0xe90a('0x5d')]=function(_0x3fece3,_0x26cc03,_0x5b588f){var _0xd4d1fc='server/files/images/logos';var _0x42a5c0={'custom':![]};return utilLicense[_0xe90a('0x5e')]()['then'](function(_0x4b5e2d){if(_0x4b5e2d){_0x42a5c0=_0x4b5e2d;}return db[_0xe90a('0x3b')]['find']({'where':{'id':_0x3fece3[_0xe90a('0x53')]['id']},'attributes':['logo',_0xe90a('0x5b'),'preferred','favicon','defaultLogo','defaultLoginLogo',_0xe90a('0x5f'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x26cc03,null))[_0xe90a('0x34')](function(_0x159e59){if(_0x159e59){var _0x5d0d18=_0x159e59[_0xe90a('0x59')]&&fs[_0xe90a('0x60')](path[_0xe90a('0x61')](config[_0xe90a('0x62')],_0xd4d1fc,_[_0xe90a('0x63')](_0x159e59[_0xe90a('0x59')])))?path[_0xe90a('0x61')](config[_0xe90a('0x62')],_0xd4d1fc,_[_0xe90a('0x63')](_0x159e59[_0xe90a('0x59')])):path[_0xe90a('0x61')](config[_0xe90a('0x62')],_0xd4d1fc,_[_0xe90a('0x63')](_0xe90a('0x64')));var _0x444c2d=_0xe90a('0x65')+_[_0xe90a('0x66')](_0xe90a('0x59'));if(_0x159e59[_0x444c2d]||!_0x42a5c0['custom']){_0x5d0d18=path[_0xe90a('0x61')](config[_0xe90a('0x62')],_0xd4d1fc,_[_0xe90a('0x63')](_0xe90a('0x64')));}if(!fs['existsSync'](_0x5d0d18)){throw new db[(_0xe90a('0x67'))][(_0xe90a('0x68'))](_[_0xe90a('0x66')](_0xe90a('0x59'))+'\x20not\x20found');}return _0x26cc03[_0xe90a('0x69')](_0x5d0d18);}})[_0xe90a('0x27')](handleError(_0x26cc03,null));};var utilLicense=require(_0xe90a('0x5c'));exports[_0xe90a('0x6a')]=function(_0x4ee1b6,_0x130238,_0x1cf894){var _0x499cfa=_0xe90a('0x6b');var _0x222151={'custom':![]};return utilLicense[_0xe90a('0x5e')]()[_0xe90a('0x34')](function(_0x2043f7){if(_0x2043f7){_0x222151=_0x2043f7;}return db[_0xe90a('0x3b')][_0xe90a('0x55')]({'where':{'id':_0x4ee1b6[_0xe90a('0x53')]['id']},'attributes':[_0xe90a('0x59'),_0xe90a('0x5b'),_0xe90a('0x6c'),'favicon',_0xe90a('0x6d'),_0xe90a('0x6e'),'defaultPreferred',_0xe90a('0x6f')],'raw':!![]});})[_0xe90a('0x34')](handleEntityNotFound(_0x130238,null))[_0xe90a('0x34')](function(_0x3878af){if(_0x3878af){var _0x2b43c4=_0x3878af[_0xe90a('0x5b')]&&fs[_0xe90a('0x60')](path['join'](config[_0xe90a('0x62')],_0x499cfa,_[_0xe90a('0x63')](_0x3878af[_0xe90a('0x5b')])))?path[_0xe90a('0x61')](config[_0xe90a('0x62')],_0x499cfa,_['toLower'](_0x3878af[_0xe90a('0x5b')])):path[_0xe90a('0x61')](config[_0xe90a('0x62')],_0x499cfa,_[_0xe90a('0x63')](_0xe90a('0x70')));var _0x5155ff=_0xe90a('0x65')+_[_0xe90a('0x66')](_0xe90a('0x5b'));if(_0x3878af[_0x5155ff]||!_0x222151[_0xe90a('0x71')]){_0x2b43c4=path['join'](config['root'],_0x499cfa,_[_0xe90a('0x63')](_0xe90a('0x70')));}if(!fs[_0xe90a('0x60')](_0x2b43c4)){throw new db[(_0xe90a('0x67'))][(_0xe90a('0x68'))](_[_0xe90a('0x66')](_0xe90a('0x5b'))+_0xe90a('0x72'));}return _0x130238[_0xe90a('0x69')](_0x2b43c4);}})[_0xe90a('0x27')](handleError(_0x130238,null));};exports[_0xe90a('0x73')]=function(_0x252e6e,_0x522d5d){return db[_0xe90a('0x3b')]['find']({'where':{'id':_0x252e6e[_0xe90a('0x53')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x522d5d,null))['catch'](handleError(_0x522d5d,null));};exports[_0xe90a('0x74')]=function(_0x48fb83,_0x3fe963,_0x14ec9a){if(_0x48fb83['file']&&_0x48fb83[_0xe90a('0x57')][_0xe90a('0x58')]){_0x48fb83[_0xe90a('0x54')][_0xe90a('0x6c')]=_0x48fb83[_0xe90a('0x57')][_0xe90a('0x58')];}return db[_0xe90a('0x3b')][_0xe90a('0x55')]({'where':{'id':_0x48fb83['params']['id']}})[_0xe90a('0x34')](handleEntityNotFound(_0x3fe963,null))['then'](saveUpdates(_0x48fb83[_0xe90a('0x54')],null))[_0xe90a('0x34')](respondWithResult(_0x3fe963,null))[_0xe90a('0x27')](handleError(_0x3fe963,null));};var utilLicense=require(_0xe90a('0x5c'));exports[_0xe90a('0x75')]=function(_0x124a25,_0x9f4d4e,_0x686bba){var _0x13ffff=_0xe90a('0x6b');var _0x49e5fa={'custom':![]};return utilLicense[_0xe90a('0x5e')]()[_0xe90a('0x34')](function(_0x31531f){if(_0x31531f){_0x49e5fa=_0x31531f;}return db['Setting'][_0xe90a('0x55')]({'where':{'id':_0x124a25[_0xe90a('0x53')]['id']},'attributes':['logo',_0xe90a('0x5b'),'preferred',_0xe90a('0x76'),'defaultLogo','defaultLoginLogo',_0xe90a('0x5f'),_0xe90a('0x6f')],'raw':!![]});})[_0xe90a('0x34')](handleEntityNotFound(_0x9f4d4e,null))['then'](function(_0x531147){if(_0x531147){var _0x15a4c5=_0x531147[_0xe90a('0x6c')]&&fs[_0xe90a('0x60')](path[_0xe90a('0x61')](config['root'],_0x13ffff,_[_0xe90a('0x63')](_0x531147['preferred'])))?path[_0xe90a('0x61')](config[_0xe90a('0x62')],_0x13ffff,_[_0xe90a('0x63')](_0x531147[_0xe90a('0x6c')])):path['join'](config[_0xe90a('0x62')],_0x13ffff,_[_0xe90a('0x63')]('default_preferred.png'));var _0x3cb9fa=_0xe90a('0x65')+_['upperFirst']('preferred');if(_0x531147[_0x3cb9fa]||!_0x49e5fa[_0xe90a('0x71')]||!_0x49e5fa[_0xe90a('0x6c')]){_0x15a4c5=path[_0xe90a('0x61')](config[_0xe90a('0x62')],_0x13ffff,_[_0xe90a('0x63')](_0xe90a('0x77')));}if(!fs[_0xe90a('0x60')](_0x15a4c5)){throw new db['Sequelize'][(_0xe90a('0x68'))](_[_0xe90a('0x66')](_0xe90a('0x6c'))+_0xe90a('0x72'));}return _0x9f4d4e[_0xe90a('0x69')](_0x15a4c5);}})[_0xe90a('0x27')](handleError(_0x9f4d4e,null));};exports['addFavicon']=function(_0x4190ed,_0x29debf,_0x20ded4){if(_0x4190ed[_0xe90a('0x57')]&&_0x4190ed[_0xe90a('0x57')][_0xe90a('0x58')]){_0x4190ed['body'][_0xe90a('0x76')]=_0x4190ed[_0xe90a('0x57')][_0xe90a('0x58')];}return db[_0xe90a('0x3b')][_0xe90a('0x55')]({'where':{'id':_0x4190ed[_0xe90a('0x53')]['id']}})[_0xe90a('0x34')](handleEntityNotFound(_0x29debf,null))[_0xe90a('0x34')](saveUpdates(_0x4190ed[_0xe90a('0x54')],null))[_0xe90a('0x34')](respondWithResult(_0x29debf,null))[_0xe90a('0x27')](handleError(_0x29debf,null));};var utilLicense=require(_0xe90a('0x5c'));exports[_0xe90a('0x78')]=function(_0x572fb5,_0x4b229e,_0x3eb26e){var _0x4cb716=_0xe90a('0x6b');var _0x1dd8ee={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x4d5659){if(_0x4d5659){_0x1dd8ee=_0x4d5659;}return db[_0xe90a('0x3b')][_0xe90a('0x55')]({'where':{'id':_0x572fb5[_0xe90a('0x53')]['id']},'attributes':[_0xe90a('0x59'),_0xe90a('0x5b'),_0xe90a('0x6c'),_0xe90a('0x76'),'defaultLogo',_0xe90a('0x6e'),'defaultPreferred',_0xe90a('0x6f')],'raw':!![]});})['then'](handleEntityNotFound(_0x4b229e,null))['then'](function(_0x3d008b){if(_0x3d008b){var _0x4a5944=_0x3d008b[_0xe90a('0x76')]&&fs[_0xe90a('0x60')](path[_0xe90a('0x61')](config[_0xe90a('0x62')],_0x4cb716,_[_0xe90a('0x63')](_0x3d008b['favicon'])))?path[_0xe90a('0x61')](config['root'],_0x4cb716,_[_0xe90a('0x63')](_0x3d008b[_0xe90a('0x76')])):path['join'](config['root'],_0x4cb716,_['toLower'](_0xe90a('0x79')));var _0x5022e3=_0xe90a('0x65')+_[_0xe90a('0x66')]('favicon');if(_0x3d008b[_0x5022e3]||!_0x1dd8ee[_0xe90a('0x71')]){_0x4a5944=path['join'](config[_0xe90a('0x62')],_0x4cb716,_[_0xe90a('0x63')](_0xe90a('0x79')));}if(!fs[_0xe90a('0x60')](_0x4a5944)){throw new db[(_0xe90a('0x67'))][(_0xe90a('0x68'))](_['upperFirst']('favicon')+_0xe90a('0x72'));}return _0x4b229e['download'](_0x4a5944);}})['catch'](handleError(_0x4b229e,null));};exports['getDate']=function(_0x28e9ef,_0x236559){var _0x3f7e34={'offset':moment()[_0xe90a('0x7a')]()};_0x3f7e34[_0xe90a('0x7b')]=moment()[_0xe90a('0x7a')](_0x3f7e34[_0xe90a('0x2c')])[_0xe90a('0x7c')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x236559['status'](0xc8)[_0xe90a('0x38')](_0x3f7e34);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index c3e1101..a166e3c 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 _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x483e3a,_0x568361){var _0x43fca9=function(_0x273d7e){while(--_0x273d7e){_0x483e3a['push'](_0x483e3a['shift']());}};_0x43fca9(++_0x568361);}(_0x3e74,0x175));var _0x43e7=function(_0x9b6b87,_0x735747){_0x9b6b87=_0x9b6b87-0x0;var _0x151d54=_0x3e74[_0x9b6b87];return _0x151d54;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x5ff2a7,_0x2c7e8c){var _0x23601e=function(_0x1b1f24){while(--_0x1b1f24){_0x5ff2a7['push'](_0x5ff2a7['shift']());}};_0x23601e(++_0x2c7e8c);}(_0xe14b,0x93));var _0xbe14=function(_0x416eae,_0x4ab7db){_0x416eae=_0x416eae-0x0;var _0x59dcb8=_0xe14b[_0x416eae];return _0x59dcb8;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index ba08a6a..e63fdf2 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 _0xa930=['then','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','ShowSetting','find','options','raw','attributes','include','model','map','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client'];(function(_0x2c49a4,_0x50ac70){var _0x1c042f=function(_0x16d8d7){while(--_0x16d8d7){_0x2c49a4['push'](_0x2c49a4['shift']());}};_0x1c042f(++_0x50ac70);}(_0xa930,0x1ef));var _0x0a93=function(_0xc65e1f,_0x3ac3c5){_0xc65e1f=_0xc65e1f-0x0;var _0xbbee91=_0xa930[_0xc65e1f];return _0xbbee91;};'use strict';var _=require(_0x0a93('0x0'));var util=require(_0x0a93('0x1'));var moment=require(_0x0a93('0x2'));var BPromise=require(_0x0a93('0x3'));var rs=require(_0x0a93('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0a93('0x5'))(_0x0a93('0x6'));var config=require(_0x0a93('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0a93('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45d992,_0x5b2e70,_0x31c339){return new BPromise(function(_0x226893,_0x389701){return client['request'](_0x45d992,_0x31c339)[_0x0a93('0x9')](function(_0x3dd01d){logger['info'](_0x0a93('0xa'),_0x5b2e70,'request\x20sent');logger[_0x0a93('0xb')](_0x0a93('0xc'),_0x5b2e70,_0x0a93('0xd'),JSON[_0x0a93('0xe')](_0x3dd01d));if(_0x3dd01d[_0x0a93('0xf')]){if(_0x3dd01d[_0x0a93('0xf')][_0x0a93('0x10')]===0x1f4){logger[_0x0a93('0xf')](_0x0a93('0xa'),_0x5b2e70,_0x3dd01d[_0x0a93('0xf')]['message']);return _0x389701(_0x3dd01d['error'][_0x0a93('0x11')]);}logger[_0x0a93('0xf')](_0x0a93('0xa'),_0x5b2e70,_0x3dd01d['error'][_0x0a93('0x11')]);return _0x226893(_0x3dd01d[_0x0a93('0xf')][_0x0a93('0x11')]);}else{logger[_0x0a93('0x12')](_0x0a93('0xa'),_0x5b2e70,_0x0a93('0xd'));_0x226893(_0x3dd01d['result']['message']);}})['catch'](function(_0x4f78e3){logger['error']('Setting,\x20%s,\x20%s',_0x5b2e70,_0x4f78e3);_0x389701(_0x4f78e3);});});}exports[_0x0a93('0x13')]=function(_0xdf37fe){var _0x13872e=this;return new Promise(function(_0x3fd276,_0x5bf970){return db['Setting'][_0x0a93('0x14')]({'raw':_0xdf37fe[_0x0a93('0x15')]?_0xdf37fe[_0x0a93('0x15')][_0x0a93('0x16')]===undefined?!![]:![]:!![],'where':_0xdf37fe[_0x0a93('0x15')]?_0xdf37fe['options']['where']||null:null,'attributes':_0xdf37fe[_0x0a93('0x15')]?_0xdf37fe['options'][_0x0a93('0x17')]||null:null,'include':_0xdf37fe['options']?_0xdf37fe[_0x0a93('0x15')]['include']?_['map'](_0xdf37fe['options'][_0x0a93('0x18')],function(_0x74d7e6){return{'model':db[_0x74d7e6[_0x0a93('0x19')]],'as':_0x74d7e6['as'],'attributes':_0x74d7e6[_0x0a93('0x17')],'include':_0x74d7e6[_0x0a93('0x18')]?_[_0x0a93('0x1a')](_0x74d7e6[_0x0a93('0x18')],function(_0x8e4539){return{'model':db[_0x8e4539['model']],'as':_0x8e4539['as'],'attributes':_0x8e4539[_0x0a93('0x17')],'include':_0x8e4539[_0x0a93('0x18')]?_[_0x0a93('0x1a')](_0x8e4539[_0x0a93('0x18')],function(_0x511ca1){return{'model':db[_0x511ca1[_0x0a93('0x19')]],'as':_0x511ca1['as'],'attributes':_0x511ca1[_0x0a93('0x17')]};}):[]};}):[]};}):[]:[]})[_0x0a93('0x9')](function(_0x1aa6c6){logger[_0x0a93('0x12')]('ShowSetting',_0xdf37fe);logger[_0x0a93('0xb')]('ShowSetting',_0xdf37fe,JSON[_0x0a93('0xe')](_0x1aa6c6));_0x3fd276(_0x1aa6c6);})[_0x0a93('0x1b')](function(_0x353765){logger[_0x0a93('0xf')]('ShowSetting',_0x353765[_0x0a93('0x11')],_0xdf37fe);_0x5bf970(_0x13872e[_0x0a93('0xf')](0x1f4,_0x353765[_0x0a93('0x11')]));});});}; \ No newline at end of file +var _0xe5cd=['raw','attributes','include','map','model','lodash','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','ShowSetting','options'];(function(_0x5a0ca6,_0x5ccc57){var _0x1fb132=function(_0x4adc88){while(--_0x4adc88){_0x5a0ca6['push'](_0x5a0ca6['shift']());}};_0x1fb132(++_0x5ccc57);}(_0xe5cd,0xa1));var _0xde5c=function(_0x1ac63b,_0x28235e){_0x1ac63b=_0x1ac63b-0x0;var _0x51158d=_0xe5cd[_0x1ac63b];return _0x51158d;};'use strict';var _=require(_0xde5c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xde5c('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde5c('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xde5c('0x3'))(_0xde5c('0x4'));var config=require('../../config/environment');var jayson=require(_0xde5c('0x5'));var client=jayson[_0xde5c('0x6')][_0xde5c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x30738e,_0x555754,_0x3abb1a){return new BPromise(function(_0x176870,_0x5ddaeb){return client['request'](_0x30738e,_0x3abb1a)[_0xde5c('0x8')](function(_0x14f7d5){logger['info'](_0xde5c('0x9'),_0x555754,_0xde5c('0xa'));logger[_0xde5c('0xb')](_0xde5c('0xc'),_0x555754,_0xde5c('0xa'),JSON[_0xde5c('0xd')](_0x14f7d5));if(_0x14f7d5[_0xde5c('0xe')]){if(_0x14f7d5[_0xde5c('0xe')]['code']===0x1f4){logger[_0xde5c('0xe')](_0xde5c('0x9'),_0x555754,_0x14f7d5[_0xde5c('0xe')]['message']);return _0x5ddaeb(_0x14f7d5[_0xde5c('0xe')][_0xde5c('0xf')]);}logger['error'](_0xde5c('0x9'),_0x555754,_0x14f7d5['error'][_0xde5c('0xf')]);return _0x176870(_0x14f7d5['error'][_0xde5c('0xf')]);}else{logger[_0xde5c('0x10')]('Setting,\x20%s,\x20%s',_0x555754,_0xde5c('0xa'));_0x176870(_0x14f7d5[_0xde5c('0x11')][_0xde5c('0xf')]);}})[_0xde5c('0x12')](function(_0x289061){logger[_0xde5c('0xe')](_0xde5c('0x9'),_0x555754,_0x289061);_0x5ddaeb(_0x289061);});});}exports[_0xde5c('0x13')]=function(_0x53804f){var _0x49d92a=this;return new Promise(function(_0x481fa1,_0x10ef95){return db['Setting']['find']({'raw':_0x53804f[_0xde5c('0x14')]?_0x53804f[_0xde5c('0x14')][_0xde5c('0x15')]===undefined?!![]:![]:!![],'where':_0x53804f['options']?_0x53804f[_0xde5c('0x14')]['where']||null:null,'attributes':_0x53804f['options']?_0x53804f['options'][_0xde5c('0x16')]||null:null,'include':_0x53804f[_0xde5c('0x14')]?_0x53804f['options'][_0xde5c('0x17')]?_[_0xde5c('0x18')](_0x53804f[_0xde5c('0x14')][_0xde5c('0x17')],function(_0x3b5856){return{'model':db[_0x3b5856[_0xde5c('0x19')]],'as':_0x3b5856['as'],'attributes':_0x3b5856[_0xde5c('0x16')],'include':_0x3b5856['include']?_[_0xde5c('0x18')](_0x3b5856[_0xde5c('0x17')],function(_0x9c668){return{'model':db[_0x9c668[_0xde5c('0x19')]],'as':_0x9c668['as'],'attributes':_0x9c668[_0xde5c('0x16')],'include':_0x9c668[_0xde5c('0x17')]?_[_0xde5c('0x18')](_0x9c668['include'],function(_0x7a3923){return{'model':db[_0x7a3923[_0xde5c('0x19')]],'as':_0x7a3923['as'],'attributes':_0x7a3923[_0xde5c('0x16')]};}):[]};}):[]};}):[]:[]})[_0xde5c('0x8')](function(_0x4deb75){logger[_0xde5c('0x10')](_0xde5c('0x13'),_0x53804f);logger['debug'](_0xde5c('0x13'),_0x53804f,JSON['stringify'](_0x4deb75));_0x481fa1(_0x4deb75);})[_0xde5c('0x12')](function(_0xe9117a){logger['error'](_0xde5c('0x13'),_0xe9117a[_0xde5c('0xf')],_0x53804f);_0x10ef95(_0x49d92a[_0xde5c('0xe')](0x1f4,_0xe9117a[_0xde5c('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 801aeba..c782988 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 _0x5fc3=['/:id','show','getDispositions','/:id/canned_answers','/:id/applications','getInteractions','/:id/status','statusGet','post','create','/:id/dispositions','addAnswer','/:id/notify','/:id/send','send','status','/:id/users','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','describe'];(function(_0x36c0c6,_0x5b5e53){var _0x4d3e0a=function(_0x39731c){while(--_0x39731c){_0x36c0c6['push'](_0x36c0c6['shift']());}};_0x4d3e0a(++_0x5b5e53);}(_0x5fc3,0xa8));var _0x35fc=function(_0xcda377,_0x1e2678){_0xcda377=_0xcda377-0x0;var _0x1c024f=_0x5fc3[_0xcda377];return _0x1c024f;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/dispositions',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getAnswers']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0x35fc('0x9')]('/:id/interactions',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router[_0x35fc('0x9')](_0x35fc('0x12'),controller[_0x35fc('0x13')]);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x14')]('/',auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x14')](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller['addDisposition']);router[_0x35fc('0x14')](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x14')](_0x35fc('0x18'),controller['notify']);router[_0x35fc('0x14')](_0x35fc('0x10'),auth[_0x35fc('0xa')](),controller['addApplications']);router[_0x35fc('0x14')](_0x35fc('0x19'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1a')]);router[_0x35fc('0x14')](_0x35fc('0x12'),controller[_0x35fc('0x1b')]);router[_0x35fc('0x14')](_0x35fc('0x1c'),auth[_0x35fc('0xa')](),controller['addAgents']);router[_0x35fc('0x1d')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x1e')]);router[_0x35fc('0x1f')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x20')]);router['delete'](_0x35fc('0x16'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x21')]);router['delete'](_0x35fc('0xf'),auth['isAuthenticated'](),controller[_0x35fc('0x22')]);router[_0x35fc('0x1f')]('/:id/users',auth['isAuthenticated'](),controller[_0x35fc('0x23')]);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(_0x59f249,_0x5c86e4){var _0x16e330=function(_0x42ccb0){while(--_0x42ccb0){_0x59f249['push'](_0x59f249['shift']());}};_0x16e330(++_0x5c86e4);}(_0x6aa7,0x178));var _0x76aa=function(_0x479260,_0x1e8953){_0x479260=_0x479260-0x0;var _0x5c9ecd=_0x6aa7[_0x479260];return _0x5c9ecd;};'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 080d8a9..b7da268 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 _0x9ff4=['randomstring','exports','STRING','name','generate','twilio','skebby','clickatell','bandwidth','csc','infobip','ENUM','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x5abf93,_0x3fb6c9){var _0x5b2f78=function(_0x57f994){while(--_0x57f994){_0x5abf93['push'](_0x5abf93['shift']());}};_0x5b2f78(++_0x3fb6c9);}(_0x9ff4,0x69));var _0x49ff=function(_0x13eb2e,_0x47965c){_0x13eb2e=_0x13eb2e-0x0;var _0x112507=_0x9ff4[_0x13eb2e];return _0x112507;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x49ff('0x0'));module[_0x49ff('0x1')]={'name':{'type':Sequelize[_0x49ff('0x2')],'unique':_0x49ff('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x49ff('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x49ff('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x49ff('0x2')],'defaultValue':function(){return rs[_0x49ff('0x4')]();}},'phone':{'type':Sequelize[_0x49ff('0x2')]},'type':{'type':Sequelize['ENUM'](_0x49ff('0x5'),_0x49ff('0x6'),'connectel','clicksend','plivo',_0x49ff('0x7'),_0x49ff('0x8'),_0x49ff('0x9'),_0x49ff('0xa'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x49ff('0x2')]},'authToken':{'type':Sequelize[_0x49ff('0x2')]},'smsMethod':{'type':Sequelize[_0x49ff('0xb')]('SI','TI','GP')},'username':{'type':Sequelize[_0x49ff('0x2')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x49ff('0x2')]},'applicationId':{'type':Sequelize[_0x49ff('0x2')]},'accountId':{'type':Sequelize[_0x49ff('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x49ff('0xc')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x49ff('0xd')],'defaultValue':function(){return _0x49ff('0xe');}},'notificationSound':{'type':Sequelize[_0x49ff('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x49ff('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x49ff('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x49ff('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x49ff('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x49ff('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x49ff('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x49ff('0xf')],'comment':_0x49ff('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x49ff('0xc')],'defaultValue':![],'comment':_0x49ff('0x11'),'set':function(_0x441a29){if(!_0x441a29)this[_0x49ff('0x12')](_0x49ff('0x13'),null);this[_0x49ff('0x12')](_0x49ff('0x14'),_0x441a29);}}}; \ No newline at end of file +var _0xd3d1=['clicksend','plivo','clickatell','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','ENUM','twilio'];(function(_0x319a03,_0x4456d4){var _0x3b6704=function(_0x1f3476){while(--_0x1f3476){_0x319a03['push'](_0x319a03['shift']());}};_0x3b6704(++_0x4456d4);}(_0xd3d1,0x1d5));var _0x1d3d=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xd3d1[_0x36eaaa];return _0x461349;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x1d3d('0x0'));module[_0x1d3d('0x1')]={'name':{'type':Sequelize[_0x1d3d('0x2')],'unique':_0x1d3d('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x1d3d('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x1d3d('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x1d3d('0x2')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1d3d('0x4')](_0x1d3d('0x5'),'skebby','connectel',_0x1d3d('0x6'),_0x1d3d('0x7'),_0x1d3d('0x8'),'bandwidth',_0x1d3d('0x9'),'infobip',_0x1d3d('0xa'))},'accountSid':{'type':Sequelize[_0x1d3d('0x2')]},'authId':{'type':Sequelize[_0x1d3d('0x2')]},'authToken':{'type':Sequelize[_0x1d3d('0x2')]},'smsMethod':{'type':Sequelize[_0x1d3d('0x4')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x1d3d('0x2')]},'applicationId':{'type':Sequelize[_0x1d3d('0x2')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x1d3d('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x1d3d('0x2')]},'notificationTemplate':{'type':Sequelize[_0x1d3d('0xc')],'defaultValue':function(){return _0x1d3d('0xd');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1d3d('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1d3d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1d3d('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1d3d('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1d3d('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x1d3d('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1d3d('0xe')],'comment':_0x1d3d('0xf')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x1d3d('0x10'),'set':function(_0x2c7e9c){if(!_0x2c7e9c)this['setDataValue'](_0x1d3d('0x11'),null);this['setDataValue'](_0x1d3d('0x12'),_0x2c7e9c);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 2508b0e..ebafb11 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 _0x9484=['message_id','plivo','Text','MessageUUID','infobip','results','originatingAddress','segmentedMessage','fromNumber','bandwidth','intelepeer','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','list','contact','SmsInteraction','spread','interaction','created','autoclose','applications','close','unmanaged','SmsMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','findOne','sequelize','transaction','findAndCountAll','getApplications','nolimit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','out','dataValues','Messages','push','received\x20delivery\x20report\x20from','skebby','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','DELIVERED','groupName','clickatell','redif','error_code','inspect','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','csc','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','limit','undefined','count','set','json','apply','save','update','destroy','get','SmsAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','type','VIRTUAL','filter','include','findAll','rows','show','params','includeAll','merge','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','create','describe','SmsAccountId','Disposition','getDispositions','hasOwnProperty','options','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','notify','sms','SmsApplication','account','orderBy','Applications','priority','asc','CmContact','Sequelize','ValidationError','createdAt','difference','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','sender','text','connectel'];(function(_0x1833cd,_0x4ffdd9){var _0x1956a2=function(_0x4a6016){while(--_0x4a6016){_0x1833cd['push'](_0x1833cd['shift']());}};_0x1956a2(++_0x4ffdd9);}(_0x9484,0x141));var _0x4948=function(_0x3b87f4,_0x112243){_0x3b87f4=_0x3b87f4-0x0;var _0x63d16e=_0x9484[_0x3b87f4];return _0x63d16e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4948('0x0'));var zipdir=require(_0x4948('0x1'));var jsonpatch=require(_0x4948('0x2'));var rp=require(_0x4948('0x3'));var moment=require(_0x4948('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4948('0x5'));var util=require(_0x4948('0x6'));var path=require(_0x4948('0x7'));var sox=require('sox');var csv=require(_0x4948('0x8'));var ejs=require(_0x4948('0x9'));var fs=require('fs');var fs_extra=require(_0x4948('0xa'));var _=require(_0x4948('0xb'));var squel=require(_0x4948('0xc'));var crypto=require(_0x4948('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4948('0xe'));var Papa=require(_0x4948('0xf'));var Redis=require(_0x4948('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4948('0x11'));var as=require(_0x4948('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4948('0x13'))(_0x4948('0x14'));var utils=require(_0x4948('0x15'));var config=require(_0x4948('0x16'));var licenseUtil=require(_0x4948('0x17'));var db=require(_0x4948('0x18'))['db'];config['redis']=_[_0x4948('0x19')](config['redis'],{'host':_0x4948('0x1a'),'port':0x18eb});var socket=require(_0x4948('0x1b'))(new Redis(config[_0x4948('0x1c')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x4948('0x1d'));var client=jayson[_0x4948('0x1e')][_0x4948('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x19690a,_0x38d861,_0x1d0b8e,_0xea576f){return new BPromise(function(_0x25336,_0x10424f){var _0xa8c4c=_0xea576f||client;return _0xa8c4c[_0x4948('0x20')](_0x19690a,_0x1d0b8e)[_0x4948('0x21')](function(_0x3a08fc){logger[_0x4948('0x22')](_0x4948('0x23'),_0x38d861,_0x4948('0x24'));logger[_0x4948('0x25')](_0x4948('0x26'),_0x38d861,_0x4948('0x24'),JSON[_0x4948('0x27')](_0x3a08fc));if(_0x3a08fc[_0x4948('0x28')]){if(_0x3a08fc['error'][_0x4948('0x29')]===0x1f4){logger[_0x4948('0x28')]('SmsAccount,\x20%s,\x20%s',_0x38d861,_0x3a08fc['error'][_0x4948('0x2a')]);return _0x10424f(_0x3a08fc['error']['message']);}logger['error'](_0x4948('0x23'),_0x38d861,_0x3a08fc[_0x4948('0x28')]['message']);return _0x25336(_0x3a08fc[_0x4948('0x28')]['message']);}else{logger['info'](_0x4948('0x23'),_0x38d861,_0x4948('0x24'));_0x25336(_0x3a08fc[_0x4948('0x2b')]['message']);}})[_0x4948('0x2c')](function(_0x967cb7){logger['error'](_0x4948('0x23'),_0x38d861,_0x967cb7);_0x10424f(_0x967cb7);});});}function respondWithStatusCode(_0x343499,_0x732681){_0x732681=_0x732681||0xcc;return function(_0xf1d45f){if(_0xf1d45f){return _0x343499['sendStatus'](_0x732681);}return _0x343499[_0x4948('0x2d')](_0x732681)[_0x4948('0x2e')]();};}function respondWithResult(_0x4ecb76,_0x646409){_0x646409=_0x646409||0xc8;return function(_0x32b2fa){if(_0x32b2fa){return _0x4ecb76[_0x4948('0x2d')](_0x646409)['json'](_0x32b2fa);}};}function respondWithFilteredResult(_0x3da4d4,_0x8962b4){return function(_0x34df8f){if(_0x34df8f){var _0x3c876e=typeof _0x8962b4[_0x4948('0x2f')]==='undefined'&&typeof _0x8962b4[_0x4948('0x30')]===_0x4948('0x31');var _0x57a0ea=_0x34df8f['count'];var _0x153a02=_0x3c876e?0x0:_0x8962b4['offset'];var _0x33708d=_0x3c876e?_0x34df8f[_0x4948('0x32')]:_0x8962b4['offset']+_0x8962b4['limit'];var _0x573db6;if(_0x33708d>=_0x57a0ea){_0x33708d=_0x57a0ea;_0x573db6=0xc8;}else{_0x573db6=0xce;}_0x3da4d4[_0x4948('0x2d')](_0x573db6);return _0x3da4d4[_0x4948('0x33')]('Content-Range',_0x153a02+'-'+_0x33708d+'/'+_0x57a0ea)[_0x4948('0x34')](_0x34df8f);}return null;};}function patchUpdates(_0x384d20){return function(_0x4af2de){try{jsonpatch[_0x4948('0x35')](_0x4af2de,_0x384d20,!![]);}catch(_0x1bc034){return BPromise['reject'](_0x1bc034);}return _0x4af2de[_0x4948('0x36')]();};}function saveUpdates(_0x4e0f48,_0x5e57e7){return function(_0x3784a0){if(_0x3784a0){return _0x3784a0[_0x4948('0x37')](_0x4e0f48)[_0x4948('0x21')](function(_0x2b1ec5){return _0x2b1ec5;});}return null;};}function removeEntity(_0x167619,_0x147180){return function(_0x17422){if(_0x17422){return _0x17422[_0x4948('0x38')]()['then'](function(){var _0x5bab67=_0x17422[_0x4948('0x39')]({'plain':!![]});var _0x5b11b2=_0x4948('0x3a');return db[_0x4948('0x3b')]['destroy']({'where':{'type':_0x5b11b2,'resourceId':_0x5bab67['id']}})[_0x4948('0x21')](function(){return _0x17422;});})[_0x4948('0x21')](function(){_0x167619['status'](0xcc)[_0x4948('0x2e')]();});}};}function handleEntityNotFound(_0x20910b,_0xf3731f){return function(_0x899bee){if(!_0x899bee){_0x20910b['sendStatus'](0x194);}return _0x899bee;};}function handleError(_0x10aea8,_0x4684d2){_0x4684d2=_0x4684d2||0x1f4;return function(_0x39747c){logger[_0x4948('0x28')](_0x39747c['stack']);if(_0x39747c[_0x4948('0x3c')]){delete _0x39747c[_0x4948('0x3c')];}_0x10aea8[_0x4948('0x2d')](_0x4684d2)[_0x4948('0x3d')](_0x39747c);};}exports[_0x4948('0x3e')]=function(_0x4962fa,_0x5ec097){var _0x35d4ab={'include':[{'model':db[_0x4948('0x3f')],'as':_0x4948('0x40')}]},_0x195705={},_0x4d4244={'count':0x0,'rows':[]};var _0x537185=_[_0x4948('0x41')](db[_0x4948('0x42')][_0x4948('0x43')],function(_0x5413d6){return{'name':_0x5413d6[_0x4948('0x44')],'type':_0x5413d6['type'][_0x4948('0x45')]};});_0x195705[_0x4948('0x46')]=_['map'](_0x537185,_0x4948('0x3c'));_0x195705[_0x4948('0x47')]=_[_0x4948('0x48')](_0x4962fa[_0x4948('0x47')]);_0x195705[_0x4948('0x49')]=_[_0x4948('0x4a')](_0x195705['model'],_0x195705[_0x4948('0x47')]);_0x35d4ab['attributes']=_[_0x4948('0x4a')](_0x195705['model'],qs[_0x4948('0x4b')](_0x4962fa[_0x4948('0x47')][_0x4948('0x4b')]));_0x35d4ab[_0x4948('0x4c')]=_0x35d4ab[_0x4948('0x4c')][_0x4948('0x4d')]?_0x35d4ab[_0x4948('0x4c')]:_0x195705[_0x4948('0x46')];if(!_0x4962fa['query']['hasOwnProperty']('nolimit')){_0x35d4ab[_0x4948('0x30')]=qs[_0x4948('0x30')](_0x4962fa[_0x4948('0x47')][_0x4948('0x30')]);_0x35d4ab[_0x4948('0x2f')]=qs[_0x4948('0x2f')](_0x4962fa['query'][_0x4948('0x2f')]);}_0x35d4ab[_0x4948('0x4e')]=qs[_0x4948('0x4f')](_0x4962fa[_0x4948('0x47')]['sort']);_0x35d4ab[_0x4948('0x50')]=qs['filters'](_[_0x4948('0x51')](_0x4962fa[_0x4948('0x47')],_0x195705[_0x4948('0x49')]),_0x537185);if(_0x4962fa[_0x4948('0x47')]['filter']){_0x35d4ab[_0x4948('0x50')]=_['merge'](_0x35d4ab[_0x4948('0x50')],{'$or':_['map'](_0x537185,function(_0x56f5bd){if(_0x56f5bd[_0x4948('0x52')]!==_0x4948('0x53')){var _0xeac911={};_0xeac911[_0x56f5bd[_0x4948('0x3c')]]={'$like':'%'+_0x4962fa[_0x4948('0x47')][_0x4948('0x54')]+'%'};return _0xeac911;}})});}_0x35d4ab=_['merge']({},_0x35d4ab,_0x4962fa['options']);var _0x43d718={'where':_0x35d4ab['where']};return db[_0x4948('0x42')][_0x4948('0x32')](_0x43d718)[_0x4948('0x21')](function(_0x14655c){_0x4d4244['count']=_0x14655c;if(_0x4962fa[_0x4948('0x47')]['includeAll']){_0x35d4ab[_0x4948('0x55')]=[{'all':!![]}];}return db[_0x4948('0x42')][_0x4948('0x56')](_0x35d4ab);})[_0x4948('0x21')](function(_0x5ba553){_0x4d4244[_0x4948('0x57')]=_0x5ba553;return _0x4d4244;})[_0x4948('0x21')](respondWithFilteredResult(_0x5ec097,_0x35d4ab))[_0x4948('0x2c')](handleError(_0x5ec097,null));};exports[_0x4948('0x58')]=function(_0xf7c266,_0x540b9a){var _0x58b67c={'raw':![],'where':{'id':_0xf7c266[_0x4948('0x59')]['id']},'include':[{'model':db[_0x4948('0x3f')],'as':_0x4948('0x40')}]},_0x22263c={};_0x22263c[_0x4948('0x46')]=_['keys'](db['SmsAccount'][_0x4948('0x43')]);_0x22263c['query']=_[_0x4948('0x48')](_0xf7c266[_0x4948('0x47')]);_0x22263c[_0x4948('0x49')]=_[_0x4948('0x4a')](_0x22263c[_0x4948('0x46')],_0x22263c['query']);_0x58b67c['attributes']=_[_0x4948('0x4a')](_0x22263c[_0x4948('0x46')],qs[_0x4948('0x4b')](_0xf7c266[_0x4948('0x47')]['fields']));_0x58b67c[_0x4948('0x4c')]=_0x58b67c[_0x4948('0x4c')]['length']?_0x58b67c['attributes']:_0x22263c[_0x4948('0x46')];if(_0xf7c266[_0x4948('0x47')][_0x4948('0x5a')]){_0x58b67c['include']=[{'all':!![]}];}_0x58b67c=_[_0x4948('0x5b')]({},_0x58b67c,_0xf7c266['options']);return db[_0x4948('0x42')][_0x4948('0x5c')](_0x58b67c)[_0x4948('0x21')](handleEntityNotFound(_0x540b9a,null))[_0x4948('0x21')](respondWithResult(_0x540b9a,null))[_0x4948('0x2c')](handleError(_0x540b9a,null));};exports['create']=function(_0x15dc47,_0x30779b){return db[_0x4948('0x42')]['create'](_0x15dc47[_0x4948('0x5d')],{})[_0x4948('0x21')](function(_0x12da52){var _0x214b88=_0x15dc47[_0x4948('0x5e')][_0x4948('0x39')]({'plain':!![]});if(!_0x214b88)throw new Error(_0x4948('0x5f'));if(_0x214b88[_0x4948('0x60')]===_0x4948('0x5e')){var _0x4f54d6=_0x12da52[_0x4948('0x39')]({'plain':!![]});var _0x50e3e6=_0x4948('0x3a');return db[_0x4948('0x61')][_0x4948('0x5c')]({'where':{'name':_0x50e3e6,'userProfileId':_0x214b88['userProfileId']},'raw':!![]})[_0x4948('0x21')](function(_0x1e23c2){if(_0x1e23c2&&_0x1e23c2[_0x4948('0x62')]===0x0){return db['UserProfileResource'][_0x4948('0x63')]({'name':_0x4f54d6[_0x4948('0x3c')],'resourceId':_0x4f54d6['id'],'type':_0x1e23c2[_0x4948('0x3c')],'sectionId':_0x1e23c2['id']},{})[_0x4948('0x21')](function(){return _0x12da52;});}else{return _0x12da52;}})['catch'](function(_0x9f6c4e){logger[_0x4948('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9f6c4e);throw _0x9f6c4e;});}return _0x12da52;})[_0x4948('0x21')](respondWithResult(_0x30779b,0xc9))[_0x4948('0x2c')](handleError(_0x30779b,null));};exports[_0x4948('0x37')]=function(_0x563438,_0x32900e){if(_0x563438[_0x4948('0x5d')]['id']){delete _0x563438[_0x4948('0x5d')]['id'];}return db[_0x4948('0x42')][_0x4948('0x5c')]({'where':{'id':_0x563438[_0x4948('0x59')]['id']},'include':[{'model':db[_0x4948('0x3f')],'as':_0x4948('0x40')}]})[_0x4948('0x21')](handleEntityNotFound(_0x32900e,null))[_0x4948('0x21')](saveUpdates(_0x563438['body'],null))['then'](respondWithResult(_0x32900e,null))[_0x4948('0x2c')](handleError(_0x32900e,null));};exports[_0x4948('0x38')]=function(_0x531aca,_0x1be0da){return db['SmsAccount']['find']({'where':{'id':_0x531aca[_0x4948('0x59')]['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x1be0da,null))[_0x4948('0x21')](removeEntity(_0x1be0da,null))['catch'](handleError(_0x1be0da,null));};exports[_0x4948('0x64')]=function(_0x56cbb2,_0x21fe7a){return db[_0x4948('0x42')]['describe']()['then'](respondWithResult(_0x21fe7a,null))[_0x4948('0x2c')](handleError(_0x21fe7a,null));};exports['addDisposition']=function(_0x26b789,_0x23f1ab,_0x25a7d1){if(_0x26b789[_0x4948('0x5d')]['id']){delete _0x26b789[_0x4948('0x5d')]['id'];}return db['SmsAccount'][_0x4948('0x5c')]({'where':{'id':_0x26b789['params']['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x23f1ab,null))['then'](function(_0x20aa3a){if(_0x20aa3a){_0x26b789[_0x4948('0x5d')][_0x4948('0x65')]=_0x20aa3a['id'];return db[_0x4948('0x66')]['create'](_0x26b789[_0x4948('0x5d')]);}})[_0x4948('0x21')](respondWithResult(_0x23f1ab,null))[_0x4948('0x2c')](handleError(_0x23f1ab,null));};exports[_0x4948('0x67')]=function(_0x427f43,_0x27f677,_0x1b5d2a){var _0x54fdbd={'raw':![],'where':{}};var _0x3a207a={};var _0x6b492e={'count':0x0,'rows':[]};return db[_0x4948('0x42')]['findOne']({'where':{'id':_0x427f43[_0x4948('0x59')]['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x27f677,null))[_0x4948('0x21')](function(_0x1ed27c){if(_0x1ed27c){_0x3a207a[_0x4948('0x46')]=_['keys'](db[_0x4948('0x66')][_0x4948('0x43')]);_0x3a207a[_0x4948('0x47')]=_[_0x4948('0x48')](_0x427f43['query']);_0x3a207a[_0x4948('0x49')]=_[_0x4948('0x4a')](_0x3a207a[_0x4948('0x46')],_0x3a207a['query']);_0x54fdbd[_0x4948('0x4c')]=_[_0x4948('0x4a')](_0x3a207a[_0x4948('0x46')],qs[_0x4948('0x4b')](_0x427f43['query']['fields']));_0x54fdbd['attributes']=_0x54fdbd[_0x4948('0x4c')][_0x4948('0x4d')]?_0x54fdbd[_0x4948('0x4c')]:_0x3a207a[_0x4948('0x46')];if(!_0x427f43[_0x4948('0x47')][_0x4948('0x68')]('nolimit')){_0x54fdbd[_0x4948('0x30')]=qs['limit'](_0x427f43[_0x4948('0x47')]['limit']);_0x54fdbd[_0x4948('0x2f')]=qs[_0x4948('0x2f')](_0x427f43[_0x4948('0x47')]['offset']);}_0x54fdbd[_0x4948('0x4e')]=qs['sort'](_0x427f43[_0x4948('0x47')][_0x4948('0x4f')]);_0x54fdbd[_0x4948('0x50')]=qs[_0x4948('0x49')](_[_0x4948('0x51')](_0x427f43[_0x4948('0x47')],_0x3a207a[_0x4948('0x49')]));_0x54fdbd[_0x4948('0x50')][_0x4948('0x65')]=_0x1ed27c['id'];if(_0x427f43['query'][_0x4948('0x54')]){_0x54fdbd[_0x4948('0x50')]=_[_0x4948('0x5b')](_0x54fdbd[_0x4948('0x50')],{'$or':_[_0x4948('0x41')](_0x54fdbd[_0x4948('0x4c')],function(_0x2d78e0){var _0x41bf8d={};_0x41bf8d[_0x2d78e0]={'$like':'%'+_0x427f43[_0x4948('0x47')][_0x4948('0x54')]+'%'};return _0x41bf8d;})});}_0x54fdbd=_[_0x4948('0x5b')]({},_0x54fdbd,_0x427f43[_0x4948('0x69')]);return db[_0x4948('0x66')][_0x4948('0x32')]({'where':_0x54fdbd[_0x4948('0x50')]})[_0x4948('0x21')](function(_0x1e17bc){_0x6b492e[_0x4948('0x32')]=_0x1e17bc;if(_0x427f43[_0x4948('0x47')]['includeAll']){_0x54fdbd[_0x4948('0x55')]=[{'all':!![]}];}return db[_0x4948('0x66')]['findAll'](_0x54fdbd);})[_0x4948('0x21')](function(_0x5b99f5){_0x6b492e[_0x4948('0x57')]=_0x5b99f5;return _0x6b492e;});}})['then'](respondWithFilteredResult(_0x27f677,_0x54fdbd))['catch'](handleError(_0x27f677,null));};exports[_0x4948('0x6a')]=function(_0x3e025f,_0x6b2abe,_0x1ef41c){return db['SmsAccount'][_0x4948('0x5c')]({'where':{'id':_0x3e025f['params']['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x6b2abe,null))['then'](function(_0x40a7dd){if(_0x40a7dd){return _0x40a7dd['removeDispositions'](_0x3e025f[_0x4948('0x47')]['ids']);}})[_0x4948('0x21')](respondWithStatusCode(_0x6b2abe,null))[_0x4948('0x2c')](handleError(_0x6b2abe,null));};exports[_0x4948('0x6b')]=function(_0x2148bf,_0x2767e9,_0x3e2e33){if(_0x2148bf[_0x4948('0x5d')]['id']){delete _0x2148bf[_0x4948('0x5d')]['id'];}return db[_0x4948('0x42')]['find']({'where':{'id':_0x2148bf[_0x4948('0x59')]['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x2767e9,null))[_0x4948('0x21')](function(_0x1257b8){if(_0x1257b8){_0x2148bf[_0x4948('0x5d')][_0x4948('0x65')]=_0x1257b8['id'];return db['CannedAnswer'][_0x4948('0x63')](_0x2148bf['body']);}})[_0x4948('0x21')](respondWithResult(_0x2767e9,null))[_0x4948('0x2c')](handleError(_0x2767e9,null));};exports['getAnswers']=function(_0x1fb998,_0x4e2b58,_0x144eaf){var _0x33aa37={'raw':![],'where':{}};var _0x329da5={};var _0x2ef75a={'count':0x0,'rows':[]};return db[_0x4948('0x42')]['findOne']({'where':{'id':_0x1fb998['params']['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x4e2b58,null))[_0x4948('0x21')](function(_0x27345e){if(_0x27345e){_0x329da5[_0x4948('0x46')]=_['keys'](db[_0x4948('0x6c')]['rawAttributes']);_0x329da5['query']=_[_0x4948('0x48')](_0x1fb998['query']);_0x329da5[_0x4948('0x49')]=_[_0x4948('0x4a')](_0x329da5[_0x4948('0x46')],_0x329da5[_0x4948('0x47')]);_0x33aa37[_0x4948('0x4c')]=_['intersection'](_0x329da5[_0x4948('0x46')],qs['fields'](_0x1fb998['query'][_0x4948('0x4b')]));_0x33aa37[_0x4948('0x4c')]=_0x33aa37[_0x4948('0x4c')]['length']?_0x33aa37[_0x4948('0x4c')]:_0x329da5[_0x4948('0x46')];if(!_0x1fb998['query'][_0x4948('0x68')]('nolimit')){_0x33aa37['limit']=qs[_0x4948('0x30')](_0x1fb998[_0x4948('0x47')][_0x4948('0x30')]);_0x33aa37['offset']=qs[_0x4948('0x2f')](_0x1fb998[_0x4948('0x47')]['offset']);}_0x33aa37[_0x4948('0x4e')]=qs[_0x4948('0x4f')](_0x1fb998[_0x4948('0x47')][_0x4948('0x4f')]);_0x33aa37['where']=qs['filters'](_['pick'](_0x1fb998[_0x4948('0x47')],_0x329da5['filters']));_0x33aa37[_0x4948('0x50')][_0x4948('0x65')]=_0x27345e['id'];if(_0x1fb998['query'][_0x4948('0x54')]){_0x33aa37[_0x4948('0x50')]=_[_0x4948('0x5b')](_0x33aa37['where'],{'$or':_[_0x4948('0x41')](_0x33aa37[_0x4948('0x4c')],function(_0x57650b){var _0x5f0b4f={};_0x5f0b4f[_0x57650b]={'$like':'%'+_0x1fb998[_0x4948('0x47')][_0x4948('0x54')]+'%'};return _0x5f0b4f;})});}_0x33aa37=_[_0x4948('0x5b')]({},_0x33aa37,_0x1fb998[_0x4948('0x69')]);return db[_0x4948('0x6c')][_0x4948('0x32')]({'where':_0x33aa37[_0x4948('0x50')]})[_0x4948('0x21')](function(_0x18d371){_0x2ef75a[_0x4948('0x32')]=_0x18d371;if(_0x1fb998[_0x4948('0x47')][_0x4948('0x5a')]){_0x33aa37['include']=[{'all':!![]}];}return db[_0x4948('0x6c')][_0x4948('0x56')](_0x33aa37);})[_0x4948('0x21')](function(_0x1019d0){_0x2ef75a[_0x4948('0x57')]=_0x1019d0;return _0x2ef75a;});}})[_0x4948('0x21')](respondWithFilteredResult(_0x4e2b58,_0x33aa37))[_0x4948('0x2c')](handleError(_0x4e2b58,null));};exports[_0x4948('0x6d')]=function(_0x5bd38e,_0x470163,_0xd456a4){return db['SmsAccount'][_0x4948('0x5c')]({'where':{'id':_0x5bd38e['params']['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x470163,null))[_0x4948('0x21')](function(_0x441af6){if(_0x441af6){return _0x441af6[_0x4948('0x6d')](_0x5bd38e[_0x4948('0x47')][_0x4948('0x6e')]);}})[_0x4948('0x21')](respondWithStatusCode(_0x470163,null))[_0x4948('0x2c')](handleError(_0x470163,null));};exports[_0x4948('0x6f')]=function(_0x19fca7,_0x11a505,_0x141096){var _0x426dc2={'channel':_0x4948('0x70')};var _0xa31d0f=[];var _0x1e63ef=[];var _0x107cf7={};return db[_0x4948('0x42')][_0x4948('0x5c')]({'where':{'id':_0x19fca7['params']['id']},'include':[{'model':db[_0x4948('0x71')],'as':'Applications'}]})[_0x4948('0x21')](handleEntityNotFound(_0x11a505,null))[_0x4948('0x21')](function(_0x2f8b19){_0x426dc2[_0x4948('0x72')]=_0x2f8b19;_0x426dc2['applications']=_[_0x4948('0x73')](_0x2f8b19[_0x4948('0x74')],[_0x4948('0x75')],[_0x4948('0x76')]);if(_0x426dc2[_0x4948('0x72')]['Applications']){delete _0x426dc2[_0x4948('0x72')][_0x4948('0x74')];}return db[_0x4948('0x77')][_0x4948('0x64')]();})['then'](function(_0x2ff57e){if(!_0x2ff57e){throw new db[(_0x4948('0x78'))][(_0x4948('0x79'))]('no\x20available\x20attributes');}_0xa31d0f=_['difference'](_[_0x4948('0x48')](_0x2ff57e),[_0x4948('0x7a'),'updatedAt']);_0x1e63ef=_[_0x4948('0x7b')](_[_0x4948('0x48')](_0x2ff57e),[_0x4948('0x7a'),_0x4948('0x7c'),_0x4948('0x7d'),_0x4948('0x7e')]);_0x426dc2[_0x4948('0x5d')]={'mapKey':_0x4948('0x7f')};if(_0x426dc2[_0x4948('0x72')][_0x4948('0x52')]){switch(_0x426dc2['account'][_0x4948('0x52')]){case _0x4948('0x80'):_0x426dc2['body'][_0x4948('0x81')]=_0x19fca7[_0x4948('0x5d')][_0x4948('0x82')];_0x426dc2[_0x4948('0x5d')][_0x4948('0x5d')]=_0x19fca7[_0x4948('0x5d')][_0x4948('0x83')];_0x426dc2['body'][_0x4948('0x84')]=_0x19fca7['body'][_0x4948('0x85')];break;case'skebby':_0x426dc2[_0x4948('0x5d')][_0x4948('0x81')]='+'+_0x19fca7[_0x4948('0x5d')][_0x4948('0x86')];_0x426dc2[_0x4948('0x5d')][_0x4948('0x5d')]=_0x19fca7[_0x4948('0x5d')][_0x4948('0x87')];break;case _0x4948('0x88'):_0x426dc2['body'][_0x4948('0x81')]=_0x19fca7['body'][_0x4948('0x81')];_0x426dc2[_0x4948('0x5d')][_0x4948('0x5d')]=_0x19fca7['body']['message'];break;case'clicksend':_0x426dc2[_0x4948('0x5d')]['from']=_0x19fca7[_0x4948('0x5d')]['from'];_0x426dc2['body'][_0x4948('0x5d')]=_0x19fca7[_0x4948('0x5d')][_0x4948('0x5d')];_0x426dc2[_0x4948('0x5d')][_0x4948('0x84')]=_0x19fca7[_0x4948('0x5d')][_0x4948('0x89')];break;case _0x4948('0x8a'):_0x426dc2[_0x4948('0x5d')][_0x4948('0x81')]=_0x19fca7['body'][_0x4948('0x82')];_0x426dc2[_0x4948('0x5d')][_0x4948('0x5d')]=_0x19fca7[_0x4948('0x5d')][_0x4948('0x8b')];_0x426dc2[_0x4948('0x5d')]['messageId']=_0x19fca7[_0x4948('0x5d')][_0x4948('0x8c')];break;case _0x4948('0x8d'):_0x426dc2[_0x4948('0x5d')][_0x4948('0x81')]='+'+_0x19fca7[_0x4948('0x5d')][_0x4948('0x8e')][0x0][_0x4948('0x81')];_0x426dc2['body']['body']=_0x19fca7[_0x4948('0x5d')][_0x4948('0x8e')][0x0]['text'];_0x426dc2[_0x4948('0x5d')]['messageId']=_0x19fca7[_0x4948('0x5d')]['results'][0x0][_0x4948('0x84')];break;case'csc':_0x426dc2[_0x4948('0x5d')][_0x4948('0x81')]=_0x19fca7['body'][_0x4948('0x8f')];_0x426dc2[_0x4948('0x5d')]['body']=_0x19fca7[_0x4948('0x5d')][_0x4948('0x90')][_0x4948('0x2a')];break;case'clickatell':_0x426dc2[_0x4948('0x5d')]['from']=_0x19fca7[_0x4948('0x5d')][_0x4948('0x91')];_0x426dc2['body']['body']=_0x19fca7[_0x4948('0x5d')][_0x4948('0x87')];_0x426dc2[_0x4948('0x5d')][_0x4948('0x84')]=_0x19fca7[_0x4948('0x5d')]['replyMessageId'];break;case _0x4948('0x92'):_0x426dc2['body'][_0x4948('0x84')]=_0x19fca7[_0x4948('0x5d')][0x0][_0x4948('0x2a')]['id'];_0x426dc2['body']['from']=_0x19fca7[_0x4948('0x5d')][0x0][_0x4948('0x2a')][_0x4948('0x81')];_0x426dc2['body'][_0x4948('0x5d')]=_0x19fca7['body'][0x0][_0x4948('0x2a')][_0x4948('0x87')];break;case _0x4948('0x93'):_0x426dc2[_0x4948('0x5d')][_0x4948('0x81')]=_0x19fca7['body']['from'];_0x426dc2[_0x4948('0x5d')]['body']=_0x19fca7[_0x4948('0x5d')][_0x4948('0x2a')];_0x426dc2['body']['messageId']=_0x19fca7['body']['refid'];break;}}if(_0x426dc2['body']['id']){delete _0x426dc2['body']['id'];}if(_[_0x4948('0x94')](_0x426dc2['body']['from'])){throw new db[(_0x4948('0x78'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x4948('0x94')](_0x426dc2[_0x4948('0x5d')][_0x4948('0x5d')])||_0x426dc2[_0x4948('0x5d')][_0x4948('0x5d')]===''){throw new db[(_0x4948('0x78'))]['ValidationError'](_0x4948('0x95'));}if(_[_0x4948('0x94')](_0x426dc2[_0x4948('0x5d')]['mapKey'])){throw new db[(_0x4948('0x78'))][(_0x4948('0x79'))](_0x4948('0x96')+_0x1e63ef);}if(!_[_0x4948('0x97')](_0x1e63ef,_0x426dc2['body'][_0x4948('0x98')])){throw new db[(_0x4948('0x78'))][(_0x4948('0x79'))](_0x4948('0x99')+_0x1e63ef);}_0x107cf7[_0x426dc2[_0x4948('0x5d')][_0x4948('0x98')]]=_0x426dc2[_0x4948('0x5d')][_0x4948('0x81')];return db[_0x4948('0x9a')][_0x4948('0x5c')]({'where':{'id':_0x426dc2[_0x4948('0x72')][_0x4948('0x7e')]},'include':[{'model':db[_0x4948('0x77')],'as':_0x4948('0x9b'),'where':_0x107cf7,'limit':0x1,'order':[[_0x4948('0x7c'),'DESC']]}]});})[_0x4948('0x21')](handleEntityNotFound(_0x11a505,null))['then'](function(_0x2e2cfb){if(_0x2e2cfb){_0x426dc2[_0x4948('0x9c')]=_['omit'](_0x2e2cfb,[_0x4948('0x9b')]);if(_0x2e2cfb[_0x4948('0x9b')][_0x4948('0x4d')]){return _0x2e2cfb[_0x4948('0x9b')][0x0];}var _0x5a20fe=_['defaults'](_0x426dc2[_0x4948('0x5d')],{'firstName':_0x426dc2['body'][_0x4948('0x81')],'ListId':_0x2e2cfb['id']});_0x5a20fe[_0x426dc2[_0x4948('0x5d')]['mapKey']]=_0x426dc2[_0x4948('0x5d')][_0x4948('0x81')];return db[_0x4948('0x77')][_0x4948('0x63')](_0x5a20fe,{'fields':_0xa31d0f,'raw':!![]});}})['then'](handleEntityNotFound(_0x11a505,null))[_0x4948('0x21')](function(_0x3180a9){if(_0x3180a9){_0x426dc2[_0x4948('0x9d')]=_0x3180a9;var _0x58b1c8={'ContactId':_0x3180a9['id'],'phone':_0x426dc2[_0x4948('0x5d')]['from'],'SmsAccountId':_0x19fca7['params']['id']};var _0x5c4d13={'ContactId':_0x3180a9['id'],'SmsAccountId':_0x19fca7[_0x4948('0x59')]['id'],'closed':![]};return db[_0x4948('0x9e')]['find']({'where':_0x5c4d13})[_0x4948('0x21')](function(_0x584a11){if(_0x584a11){return[_0x584a11,![]];}return db[_0x4948('0x9e')][_0x4948('0x63')](_0x58b1c8)[_0x4948('0x21')](function(_0x319090){return[_0x319090,!![]];});});}})[_0x4948('0x9f')](function(_0x4b42fd,_0x5d9dab){_0x426dc2[_0x4948('0xa0')]=_0x4b42fd[_0x4948('0x39')]({'plain':!![]});_0x426dc2[_0x4948('0xa0')][_0x4948('0xa1')]=![];if(_0x5d9dab){if(_0x426dc2['account'][_0x4948('0xa2')]){_0x426dc2['applications']['push']({'id':0x0,'priority':_0x426dc2[_0x4948('0xa3')][_0x4948('0x4d')]+0x1,'app':_0x4948('0xa4'),'appdata':_0x4948('0xa5'),'interval':'*,*,*,*'});}_0x426dc2[_0x4948('0xa0')][_0x4948('0xa1')]=!![];}return db[_0x4948('0xa6')][_0x4948('0x63')]({'phone':_0x426dc2[_0x4948('0x5d')]['from'],'messageId':_0x426dc2[_0x4948('0x5d')][_0x4948('0x84')],'body':_0x426dc2[_0x4948('0x5d')][_0x4948('0x5d')],'SmsAccountId':_0x19fca7[_0x4948('0x59')]['id'],'SmsInteractionId':_0x4b42fd['id'],'direction':'in','ContactId':_0x4b42fd['ContactId'],'AttachmentId':_0x426dc2[_0x4948('0x5d')][_0x4948('0xa7')]});})[_0x4948('0x21')](function(_0x320286){_0x426dc2[_0x4948('0x2a')]=_0x320286;if(_0x426dc2[_0x4948('0xa0')][_0x4948('0xa8')]){return db['User']['find']({'attributes':['id',_0x4948('0x3c')],'where':{'id':_0x426dc2[_0x4948('0xa0')]['UserId']}})['then'](function(_0x47c76e){if(_0x47c76e){_0x426dc2[_0x4948('0xa3')][_0x4948('0xa9')]({'id':0x0,'priority':0x0,'app':_0x4948('0xaa'),'appdata':_0x47c76e[_0x4948('0x3c')]+','+(_0x426dc2['account'][_0x4948('0xab')]||0xa),'interval':_0x4948('0xac')});}return respondWithRpcPromise(_0x4948('0xad'),_0x4948('0xae'),_0x426dc2);});}return respondWithRpcPromise(_0x4948('0xad'),'startRouting',_0x426dc2);})[_0x4948('0x21')](function(_0x1dd462){if(_0x1dd462){var _0x3da1bf=0xc8;var _0x4a853b=_0x4948('0xaf');logger[_0x4948('0x22')](_0x4948('0x26'),_0x4a853b,_0x3da1bf,_0x4948('0xb0'));logger[_0x4948('0x25')](_0x4948('0xb1'),_0x4a853b,_0x3da1bf,_0x4948('0xb0'),JSON['stringify'](_0x1dd462));if(_0x426dc2[_0x4948('0x72')][_0x4948('0x52')]===_0x4948('0x80')){return _0x11a505[_0x4948('0x2d')](_0x3da1bf)[_0x4948('0x33')](_0x4948('0xb2'),_0x4948('0xb3'))[_0x4948('0x3d')](_0x4948('0xb4'));}else{return _0x11a505[_0x4948('0x2d')](_0x3da1bf)[_0x4948('0x34')](_0x1dd462);}}})[_0x4948('0x2c')](handleError(_0x11a505,null));};exports['addApplications']=function(_0x4d5cd4,_0x31e224,_0x1b3c84){return db[_0x4948('0x42')][_0x4948('0xb5')]({'where':{'id':_0x4d5cd4[_0x4948('0x59')]['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x31e224,null))[_0x4948('0x21')](function(_0x45e209){if(_0x45e209){return db[_0x4948('0xb6')][_0x4948('0xb7')](function(_0x30cb8e){return db[_0x4948('0x71')][_0x4948('0x38')]({'where':{'SmsAccountId':_0x4d5cd4[_0x4948('0x59')]['id']},'transaction':_0x30cb8e})['then'](function(_0x2dff96){var _0xed184c=_[_0x4948('0x41')](_0x4d5cd4[_0x4948('0x5d')],function(_0x165539){_0x165539[_0x4948('0x65')]=_0x4d5cd4[_0x4948('0x59')]['id'];return _0x165539;});return db[_0x4948('0x71')]['bulkCreate'](_0xed184c,{'transaction':_0x30cb8e});});})['then'](function(){return db[_0x4948('0x71')][_0x4948('0xb8')]({'where':{'SmsAccountId':_0x4d5cd4[_0x4948('0x59')]['id']},'order':_0x4948('0x75')});});}})['then'](respondWithResult(_0x31e224,null))['catch'](handleError(_0x31e224,null));};exports[_0x4948('0xb9')]=function(_0x32c426,_0x3ba04e,_0x423a53){var _0x18155e={};var _0x2e2ed1={};var _0x132b6d;var _0xcbea1e;return db[_0x4948('0x42')][_0x4948('0xb5')]({'where':{'id':_0x32c426['params']['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x3ba04e,null))[_0x4948('0x21')](function(_0x19ba64){if(_0x19ba64){_0x132b6d=_0x19ba64;_0x2e2ed1[_0x4948('0x46')]=_[_0x4948('0x48')](db[_0x4948('0x71')][_0x4948('0x43')]);_0x2e2ed1['query']=_['keys'](_0x32c426[_0x4948('0x47')]);_0x2e2ed1[_0x4948('0x49')]=_['intersection'](_0x2e2ed1[_0x4948('0x46')],_0x2e2ed1['query']);_0x18155e[_0x4948('0x4c')]=_[_0x4948('0x4a')](_0x2e2ed1[_0x4948('0x46')],qs['fields'](_0x32c426[_0x4948('0x47')][_0x4948('0x4b')]));_0x18155e[_0x4948('0x4c')]=_0x18155e['attributes'][_0x4948('0x4d')]?_0x18155e[_0x4948('0x4c')]:_0x2e2ed1[_0x4948('0x46')];_0x18155e[_0x4948('0x4e')]=qs['sort'](_0x32c426[_0x4948('0x47')][_0x4948('0x4f')]);_0x18155e[_0x4948('0x50')]=qs[_0x4948('0x49')](_[_0x4948('0x51')](_0x32c426['query'],_0x2e2ed1[_0x4948('0x49')]));if(_0x32c426[_0x4948('0x47')][_0x4948('0x54')]){_0x18155e['where']=_[_0x4948('0x5b')](_0x18155e[_0x4948('0x50')],{'$or':_[_0x4948('0x41')](_0x18155e['attributes'],function(_0x17fdaa){var _0x4a510b={};_0x4a510b[_0x17fdaa]={'$like':'%'+_0x32c426['query']['filter']+'%'};return _0x4a510b;})});}_0x18155e=_[_0x4948('0x5b')]({},_0x18155e,_0x32c426[_0x4948('0x69')]);return _0x132b6d[_0x4948('0xb9')](_0x18155e);}})[_0x4948('0x21')](function(_0x7b3b43){if(_0x7b3b43){_0xcbea1e=_0x7b3b43[_0x4948('0x4d')];if(!_0x32c426[_0x4948('0x47')]['hasOwnProperty'](_0x4948('0xba'))){_0x18155e[_0x4948('0x30')]=qs[_0x4948('0x30')](_0x32c426[_0x4948('0x47')][_0x4948('0x30')]);_0x18155e[_0x4948('0x2f')]=qs[_0x4948('0x2f')](_0x32c426[_0x4948('0x47')]['offset']);}return _0x132b6d[_0x4948('0xb9')](_0x18155e);}})[_0x4948('0x21')](function(_0x3dcda5){if(_0x3dcda5){return _0x3dcda5?{'count':_0xcbea1e,'rows':_0x3dcda5}:null;}})['then'](respondWithResult(_0x3ba04e,null))[_0x4948('0x2c')](handleError(_0x3ba04e,null));};exports[_0x4948('0xbb')]=function(_0x4e252b,_0x5b55a3,_0x2df950){var _0xa6d099={'raw':![],'where':{}};var _0x1d698e={};var _0x1588c7={'count':0x0,'rows':[]};return db[_0x4948('0x42')][_0x4948('0xb5')]({'where':{'id':_0x4e252b['params']['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x5b55a3,null))[_0x4948('0x21')](function(_0xf6f736){if(_0xf6f736){_0x1d698e['model']=_[_0x4948('0x48')](db[_0x4948('0x9e')][_0x4948('0x43')]);_0x1d698e[_0x4948('0x47')]=_[_0x4948('0x48')](_0x4e252b['query']);_0x1d698e['filters']=_['intersection'](_0x1d698e['model'],_0x1d698e[_0x4948('0x47')]);_0xa6d099[_0x4948('0x4c')]=_[_0x4948('0x4a')](_0x1d698e[_0x4948('0x46')],qs[_0x4948('0x4b')](_0x4e252b[_0x4948('0x47')][_0x4948('0x4b')]));_0xa6d099[_0x4948('0x4c')]=_0xa6d099['attributes'][_0x4948('0x4d')]?_0xa6d099[_0x4948('0x4c')]:_0x1d698e[_0x4948('0x46')];if(!_0x4e252b[_0x4948('0x47')][_0x4948('0x68')](_0x4948('0xba'))){_0xa6d099[_0x4948('0x30')]=qs['limit'](_0x4e252b[_0x4948('0x47')]['limit']);_0xa6d099[_0x4948('0x2f')]=qs[_0x4948('0x2f')](_0x4e252b['query']['offset']);}_0xa6d099[_0x4948('0x4e')]=qs[_0x4948('0x4f')](_0x4e252b[_0x4948('0x47')][_0x4948('0x4f')]);_0xa6d099[_0x4948('0x50')]=qs[_0x4948('0x49')](_['pick'](_0x4e252b[_0x4948('0x47')],_0x1d698e['filters']));_0xa6d099[_0x4948('0x50')][_0x4948('0x65')]=_0xf6f736['id'];if(_0x4e252b[_0x4948('0x47')]['filter']){_0xa6d099[_0x4948('0x50')]=_[_0x4948('0x5b')](_0xa6d099['where'],{'$or':_[_0x4948('0x41')](_0xa6d099['attributes'],function(_0x13e5d4){var _0x35c2cf={};_0x35c2cf[_0x13e5d4]={'$like':'%'+_0x4e252b[_0x4948('0x47')]['filter']+'%'};return _0x35c2cf;})});}_0xa6d099=_[_0x4948('0x5b')]({},_0xa6d099,_0x4e252b['options']);return db[_0x4948('0x9e')]['count']({'where':_0xa6d099[_0x4948('0x50')]})[_0x4948('0x21')](function(_0x4602b9){_0x1588c7[_0x4948('0x32')]=_0x4602b9;if(_0x4e252b[_0x4948('0x47')][_0x4948('0x5a')]){_0xa6d099[_0x4948('0x55')]=[{'model':db[_0x4948('0x77')],'as':_0x4948('0xbc'),'required':![]},{'model':db['User'],'as':_0x4948('0xbd'),'attributes':['name',_0x4948('0xbe'),_0x4948('0xbf')],'required':![]},{'model':db[_0x4948('0xc0')],'as':_0x4948('0xc1'),'attributes':['id',_0x4948('0x3c'),_0x4948('0xc2')],'where':_0x4e252b[_0x4948('0x47')]['tag']?{'id':_0x4e252b[_0x4948('0x47')][_0x4948('0xc3')]}:undefined,'required':_0x4e252b[_0x4948('0x47')][_0x4948('0xc3')]?!![]:![]}];}return db['SmsInteraction']['findAll'](_0xa6d099);})[_0x4948('0x21')](function(_0xa49583){_0x1588c7[_0x4948('0x57')]=_0xa49583;return _0x1588c7;});}})[_0x4948('0x21')](respondWithFilteredResult(_0x5b55a3,_0xa6d099))[_0x4948('0x2c')](handleError(_0x5b55a3,null));};exports['send']=function(_0x2b2552,_0x3a9f66,_0x4b637e){var _0x33fbf1,_0x1fffb6,_0x5e5a2c;if(_[_0x4948('0x94')](_0x2b2552[_0x4948('0x5d')]['body'])||_0x2b2552[_0x4948('0x5d')][_0x4948('0x5d')]===''){throw new db['Sequelize']['ValidationError'](_0x4948('0x95'));}if(_[_0x4948('0x94')](_0x2b2552[_0x4948('0x5d')]['to'])){throw new db[(_0x4948('0x78'))][(_0x4948('0x79'))](_0x4948('0xc4'));}_0x33fbf1=_0x2b2552[_0x4948('0x5d')]['to'];return db[_0x4948('0x42')][_0x4948('0x5c')]({'where':{'id':_0x2b2552[_0x4948('0x59')]['id']},'include':[{'model':db[_0x4948('0x9a')],'as':_0x4948('0xc5'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x33fbf1},'limit':0x1,'order':[[_0x4948('0x7c'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x3a9f66,null))['then'](function(_0x54ea25){if(_0x54ea25&&_0x54ea25[_0x4948('0xc5')]){_0x1fffb6=_0x54ea25[_0x4948('0x39')]({'plain':!![]});if(_0x1fffb6['List']&&_0x1fffb6['List'][_0x4948('0x9b')][_0x4948('0x4d')]){return _0x1fffb6[_0x4948('0xc5')][_0x4948('0x9b')][0x0];}return db['CmContact']['create'](_[_0x4948('0x19')](_0x2b2552[_0x4948('0x5d')],{'firstName':_0x33fbf1,'mobile':_0x33fbf1,'phone':_0x33fbf1,'ListId':_0x1fffb6[_0x4948('0x7e')]}));}})[_0x4948('0x21')](handleEntityNotFound(_0x3a9f66,null))['then'](function(_0x5c021b){if(_0x5c021b){_0x5e5a2c=_0x5c021b;return db[_0x4948('0x9e')]['find']({'where':{'ContactId':_0x5e5a2c['id'],'closed':![],'SmsAccountId':_0x1fffb6['id']}})['then'](function(_0x4590fa){if(_0x4590fa){return[_0x4590fa,![]];}return db[_0x4948('0x9e')]['create']({'UserId':_0x2b2552[_0x4948('0x5e')]['id'],'ContactId':_0x5e5a2c['id'],'SmsAccountId':_0x1fffb6['id'],'phone':_0x33fbf1,'firstMsgDirection':_0x4948('0xc6'),'Messages':[_[_0x4948('0x5b')](_0x2b2552['body'],{'read':![],'body':_0x2b2552[_0x4948('0x5d')][_0x4948('0x5d')],'phone':_0x33fbf1,'SmsAccountId':_0x1fffb6['id'],'UserId':_0x2b2552[_0x4948('0x5e')]['id'],'ContactId':_0x5e5a2c['id']})]},{'include':[{'model':db[_0x4948('0xa6')],'as':'Messages'}]})[_0x4948('0x21')](function(_0x378522){return[_0x378522,!![]];});});}})['spread'](function(_0x1e0fcc,_0x2f12df){if(_0x2f12df){return _0x1e0fcc;}return db[_0x4948('0xa6')][_0x4948('0x63')](_['merge'](_0x2b2552[_0x4948('0x5d')],{'read':![],'body':_0x2b2552['body']['body'],'phone':_0x33fbf1,'SmsAccountId':_0x1fffb6['id'],'SmsInteractionId':_0x1e0fcc['id'],'UserId':_0x2b2552[_0x4948('0x5e')]['id'],'ContactId':_0x5e5a2c['id']}))['then'](function(_0x603469){_0x1e0fcc[_0x4948('0xc7')][_0x4948('0xc8')]=[];_0x1e0fcc['dataValues'][_0x4948('0xc8')][_0x4948('0xc9')](_0x603469[_0x4948('0xc7')]);return _0x1e0fcc;});})[_0x4948('0x21')](respondWithResult(_0x3a9f66,null))[_0x4948('0x2c')](handleError(_0x3a9f66,null));};exports[_0x4948('0x2d')]=function(_0x4cc86b,_0x47c3f5,_0x4b34b8){if(_0x4cc86b[_0x4948('0x5d')]['id']){delete _0x4cc86b[_0x4948('0x5d')]['id'];}var _0x5ba5dd,_0x69b10d,_0xc1c042;return db[_0x4948('0x42')][_0x4948('0x5c')]({'where':{'id':_0x4cc86b[_0x4948('0x59')]['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x47c3f5,null))['then'](function(_0x3dca3){if(_0x3dca3){_0xc1c042=_0x3dca3;logger[_0x4948('0x25')](_0x4948('0x26'),'status',_0x4948('0xca'),_0x3dca3['type'],util['inspect'](_0x4cc86b[_0x4948('0x5d')],{'showHidden':![],'depth':null}));switch(_0x3dca3['type']){case _0x4948('0xcb'):if(_0x4cc86b[_0x4948('0x5d')][_0x4948('0xcc')]&&_0x4cc86b[_0x4948('0x5d')][_0x4948('0x2d')]){_0x69b10d=_0x4cc86b[_0x4948('0x5d')][_0x4948('0x2d')];return db[_0x4948('0xa6')][_0x4948('0x5c')]({'where':{'messageId':_0x4cc86b[_0x4948('0x5d')][_0x4948('0xcc')]}});}break;case _0x4948('0x88'):if(_0x4cc86b['body'][_0x4948('0xcd')]&&_0x4cc86b['body'][_0x4948('0xce')]){_0x69b10d=_0x4cc86b[_0x4948('0x5d')][_0x4948('0xce')];return db[_0x4948('0xa6')]['find']({'where':{'messageId':_0x4cc86b[_0x4948('0x5d')][_0x4948('0xcd')]}});}break;case _0x4948('0xcf'):if(_0x4cc86b[_0x4948('0x5d')][_0x4948('0x89')]&&_0x4cc86b[_0x4948('0x5d')]['status_code']){_0x69b10d=_0x4cc86b[_0x4948('0x5d')][_0x4948('0xd0')];return db[_0x4948('0xa6')][_0x4948('0x5c')]({'where':{'messageId':_0x4cc86b['body'][_0x4948('0x89')]}});}break;case _0x4948('0x8d'):var _0x452e9e=_0x4cc86b['body']['results'][0x0];if(_0x452e9e[_0x4948('0x84')]&&_0x452e9e[_0x4948('0x2d')]['groupName']===_0x4948('0xd1')){_0x69b10d=_0x452e9e[_0x4948('0x2d')][_0x4948('0xd2')];return db[_0x4948('0xa6')]['find']({'where':{'messageId':_0x452e9e['messageId']}});}break;case _0x4948('0xd3'):if(_0x4cc86b[_0x4948('0x5d')]['messageId']&&_0x4cc86b[_0x4948('0x5d')][_0x4948('0x2d')]){_0x69b10d=_0x4cc86b['body']['status'];return db['SmsMessage'][_0x4948('0x5c')]({'where':{'messageId':_0x4cc86b[_0x4948('0x5d')][_0x4948('0x84')]}});}break;case'bandwidth':if(_0x4cc86b[_0x4948('0x5d')][0x0][_0x4948('0x2a')]['id']){_0x69b10d=_0x4cc86b['body'][0x0][_0x4948('0x52')];return db[_0x4948('0xa6')][_0x4948('0x5c')]({'where':{'messageId':_0x4cc86b[_0x4948('0x5d')][0x0][_0x4948('0x2a')]['id']}});}break;case _0x4948('0x93'):if(_0x4cc86b['body'][_0x4948('0xd4')]&&_0x4cc86b['body'][_0x4948('0x2d')]){_0x69b10d=_0x4cc86b[_0x4948('0x5d')][_0x4948('0x2d')];return db['SmsMessage'][_0x4948('0x5c')]({'where':{'messageId':_0x4cc86b[_0x4948('0x5d')][_0x4948('0xd4')]}});}break;}}})[_0x4948('0x21')](handleEntityNotFound(_0x47c3f5,null))['then'](function(_0x2853a8){if(_0x2853a8){_0x5ba5dd=_0x2853a8;switch(_0xc1c042['type']){case _0x4948('0xcb'):if(_0x69b10d===_0x4948('0xd1')){return _0x5ba5dd['update']({'read':!![]});}else{logger[_0x4948('0x28')](_0x4948('0x26'),_0x4948('0x2d'),_0x4948('0xcb'),util['inspect'](_0x4cc86b['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x69b10d==='1'){return _0x5ba5dd[_0x4948('0x37')]({'read':!![]});}else{logger[_0x4948('0x28')](_0x4948('0x26'),_0x4948('0x2d'),_0x4948('0xcb'),util['inspect'](_0x4cc86b['body'],{'showHidden':![],'depth':null}));}break;case _0x4948('0xcf'):if(!_0x4cc86b[_0x4948('0x5d')][_0x4948('0xd5')]&&_0x69b10d>=0xc8&&_0x69b10d<=0xce){return _0x5ba5dd[_0x4948('0x37')]({'read':!![]});}else{logger[_0x4948('0x28')](_0x4948('0x26'),_0x4948('0x2d'),_0x4948('0xcf'),util[_0x4948('0xd6')](_0x4cc86b[_0x4948('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x4948('0x8d'):var _0x229690=_0x4cc86b[_0x4948('0x5d')][_0x4948('0x8e')][0x0];if(_0x229690[_0x4948('0x2d')][_0x4948('0xd2')]===_0x4948('0xd1')){return _0x5ba5dd[_0x4948('0x37')]({'read':!![]});}else{logger[_0x4948('0x28')](_0x4948('0x26'),_0x4948('0x2d'),_0x4948('0x8d'),util[_0x4948('0xd6')](_0x4cc86b[_0x4948('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x4948('0xd3'):if(_0x69b10d==_0x4948('0xd7')||_0x69b10d=='RECEIVED_BY_RECIPIENT'){return _0x5ba5dd[_0x4948('0x37')]({'read':!![]});}else{logger['error'](_0x4948('0x26'),'status',_0x4948('0xd3'),util[_0x4948('0xd6')](_0x4cc86b[_0x4948('0x5d')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x69b10d==_0x4948('0xd8')){return _0x5ba5dd[_0x4948('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4948('0x2d'),_0x4948('0x92'),util[_0x4948('0xd6')](_0x4cc86b[_0x4948('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x4948('0x93'):if(_0x69b10d===_0x4948('0xd9')||_0x69b10d===_0x4948('0xda')){return _0x5ba5dd[_0x4948('0x37')]({'read':!![]});}else{logger[_0x4948('0x28')](_0x4948('0x26'),_0x4948('0x2d'),'intelepeer',util[_0x4948('0xd6')](_0x4cc86b['body'],{'showHidden':![],'depth':null}));}break;}return _0x5ba5dd;}})['then'](respondWithResult(_0x47c3f5,null))['catch'](handleError(_0x47c3f5,null));};exports[_0x4948('0xdb')]=function(_0x2d15d6,_0x308df7,_0x3dd8e3){var _0x4cd486,_0x520f00,_0x1bedca;return db[_0x4948('0x42')][_0x4948('0x5c')]({'where':{'id':_0x2d15d6[_0x4948('0x59')]['id']}})['then'](handleEntityNotFound(_0x308df7,null))[_0x4948('0x21')](function(_0x4bd578){if(_0x4bd578){_0x1bedca=_0x4bd578;logger[_0x4948('0x25')](_0x4948('0x26'),_0x4948('0x2d'),_0x4948('0xca'),_0x4bd578['type'],util['inspect'](_0x2d15d6[_0x4948('0x47')],{'showHidden':![],'depth':null}));switch(_0x4bd578[_0x4948('0x52')]){case'csc':if(_0x2d15d6[_0x4948('0x47')][_0x4948('0xdc')]&&_0x2d15d6['query']['state']){_0x520f00=_0x2d15d6[_0x4948('0x47')]['state'];return db[_0x4948('0xa6')][_0x4948('0x5c')]({'where':{'messageId':_0x2d15d6[_0x4948('0x47')]['message-id']}});}break;}}})[_0x4948('0x21')](handleEntityNotFound(_0x308df7,null))[_0x4948('0x21')](function(_0x3aa595){if(_0x3aa595){_0x4cd486=_0x3aa595;switch(_0x1bedca['type']){case _0x4948('0xdd'):if(_0x520f00==='2'||_0x520f00==='6'){return _0x4cd486[_0x4948('0x37')]({'read':!![]});}else{logger[_0x4948('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4948('0x2d'),_0x4948('0xdd'),util[_0x4948('0xd6')](_0x2d15d6[_0x4948('0x47')],{'showHidden':![],'depth':null}));};break;}return _0x4cd486;}})[_0x4948('0x21')](respondWithResult(_0x308df7,null))[_0x4948('0x2c')](handleError(_0x308df7,null));};exports[_0x4948('0xde')]=function(_0x1c2063,_0x525cb6,_0x482f10){return db[_0x4948('0x42')]['find']({'where':{'id':_0x1c2063['params']['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x525cb6,null))['then'](function(_0x2881ca){if(_0x2881ca){return _0x2881ca[_0x4948('0xde')](_0x1c2063[_0x4948('0x5d')][_0x4948('0x6e')],_['omit'](_0x1c2063[_0x4948('0x5d')],['ids','id'])||{})[_0x4948('0x9f')](function(_0x1ea276){for(var _0x2439d3=0x0;_0x2439d3<_0x1c2063[_0x4948('0x5d')][_0x4948('0x6e')][_0x4948('0x4d')];_0x2439d3+=0x1){socket[_0x4948('0xdf')](_0x4948('0xe0'),{'UserId':Number(_0x1c2063[_0x4948('0x5d')][_0x4948('0x6e')][_0x2439d3]),'SmsAccountId':Number(_0x1c2063[_0x4948('0x59')]['id'])});}return _0x1ea276;});}})[_0x4948('0x21')](respondWithResult(_0x525cb6,null))[_0x4948('0x2c')](handleError(_0x525cb6,null));};exports[_0x4948('0xe1')]=function(_0xdc7a99,_0x2fdef0,_0x1a93ce){return db[_0x4948('0x42')][_0x4948('0x5c')]({'where':{'id':_0xdc7a99['params']['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x2fdef0,null))[_0x4948('0x21')](function(_0x199e0f){if(_0x199e0f){return _0x199e0f[_0x4948('0xe1')](_0xdc7a99[_0x4948('0x47')]['ids'])[_0x4948('0x21')](function(){if(_['isArray'](_0xdc7a99[_0x4948('0x47')][_0x4948('0x6e')])){for(var _0x16625f=0x0;_0x16625f<_0xdc7a99['query']['ids'][_0x4948('0x4d')];_0x16625f+=0x1){socket['emit'](_0x4948('0xe2'),{'UserId':Number(_0xdc7a99[_0x4948('0x47')]['ids'][_0x16625f]),'SmsAccountId':Number(_0xdc7a99[_0x4948('0x59')]['id'])});}}else{socket['emit'](_0x4948('0xe2'),{'UserId':Number(_0xdc7a99[_0x4948('0x47')][_0x4948('0x6e')]),'SmsAccountId':Number(_0xdc7a99[_0x4948('0x59')]['id'])});}});}})[_0x4948('0x21')](respondWithStatusCode(_0x2fdef0,null))['catch'](handleError(_0x2fdef0,null));};exports[_0x4948('0xe3')]=function(_0x270bbd,_0x1d2df9,_0x34c910){var _0x7b7f7d={};var _0x40cfe5={};var _0x11f44a;var _0x2710d1;return db[_0x4948('0x42')][_0x4948('0xb5')]({'where':{'id':_0x270bbd[_0x4948('0x59')]['id']}})[_0x4948('0x21')](handleEntityNotFound(_0x1d2df9,null))[_0x4948('0x21')](function(_0x2c9b68){if(_0x2c9b68){_0x11f44a=_0x2c9b68;_0x40cfe5[_0x4948('0x46')]=_[_0x4948('0x48')](db[_0x4948('0xe4')]['rawAttributes']);_0x40cfe5[_0x4948('0x47')]=_['keys'](_0x270bbd[_0x4948('0x47')]);_0x40cfe5[_0x4948('0x49')]=_[_0x4948('0x4a')](_0x40cfe5['model'],_0x40cfe5['query']);_0x7b7f7d['attributes']=_['intersection'](_0x40cfe5[_0x4948('0x46')],qs['fields'](_0x270bbd[_0x4948('0x47')][_0x4948('0x4b')]));_0x7b7f7d[_0x4948('0x4c')]=_0x7b7f7d['attributes'][_0x4948('0x4d')]?_0x7b7f7d['attributes']:_0x40cfe5[_0x4948('0x46')];_0x7b7f7d[_0x4948('0x4e')]=qs['sort'](_0x270bbd['query'][_0x4948('0x4f')]);_0x7b7f7d[_0x4948('0x50')]=qs[_0x4948('0x49')](_[_0x4948('0x51')](_0x270bbd[_0x4948('0x47')],_0x40cfe5[_0x4948('0x49')]));if(_0x270bbd[_0x4948('0x47')]['filter']){_0x7b7f7d[_0x4948('0x50')]=_['merge'](_0x7b7f7d[_0x4948('0x50')],{'$or':_[_0x4948('0x41')](_0x7b7f7d[_0x4948('0x4c')],function(_0x3ed0b6){var _0xe5bf6a={};_0xe5bf6a[_0x3ed0b6]={'$like':'%'+_0x270bbd[_0x4948('0x47')][_0x4948('0x54')]+'%'};return _0xe5bf6a;})});}_0x7b7f7d=_[_0x4948('0x5b')]({},_0x7b7f7d,_0x270bbd[_0x4948('0x69')]);return _0x11f44a[_0x4948('0xe3')](_0x7b7f7d);}})[_0x4948('0x21')](function(_0x40d54e){if(_0x40d54e){_0x2710d1=_0x40d54e[_0x4948('0x4d')];if(!_0x270bbd[_0x4948('0x47')][_0x4948('0x68')](_0x4948('0xba'))){_0x7b7f7d[_0x4948('0x30')]=qs['limit'](_0x270bbd[_0x4948('0x47')][_0x4948('0x30')]);_0x7b7f7d[_0x4948('0x2f')]=qs['offset'](_0x270bbd[_0x4948('0x47')][_0x4948('0x2f')]);}return _0x11f44a[_0x4948('0xe3')](_0x7b7f7d);}})[_0x4948('0x21')](function(_0x4863af){if(_0x4863af){return _0x4863af?{'count':_0x2710d1,'rows':_0x4863af}:null;}})[_0x4948('0x21')](respondWithResult(_0x1d2df9,null))['catch'](handleError(_0x1d2df9,null));}; \ No newline at end of file +var _0xc433=['reject','save','update','destroy','SmsAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','autoAssociation','params','Pause','describe','addDisposition','SmsAccountId','Disposition','getDispositions','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','sms','Applications','applications','orderBy','priority','asc','account','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','twilio','From','messageId','MessageSid','text','connectel','from','clicksend','message_id','plivo','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','intelepeer','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','SmsMessage','User','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','stringify','set','Content-Type','\x0a','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','bandwidth','redif','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','register','jayson/promise','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','offset','limit','count','json','apply'];(function(_0x539329,_0x1ffbd8){var _0x5386b3=function(_0x5476dc){while(--_0x5476dc){_0x539329['push'](_0x539329['shift']());}};_0x5386b3(++_0x1ffbd8);}(_0xc433,0xac));var _0x3c43=function(_0xe261ee,_0x2a2183){_0xe261ee=_0xe261ee-0x0;var _0x1e06b3=_0xc433[_0xe261ee];return _0x1e06b3;};'use strict';var emlformat=require(_0x3c43('0x0'));var rimraf=require(_0x3c43('0x1'));var zipdir=require(_0x3c43('0x2'));var jsonpatch=require(_0x3c43('0x3'));var rp=require('request-promise');var moment=require(_0x3c43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3c43('0x5'));var util=require(_0x3c43('0x6'));var path=require(_0x3c43('0x7'));var sox=require(_0x3c43('0x8'));var csv=require(_0x3c43('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3c43('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3c43('0xb'));var deskjs=require(_0x3c43('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3c43('0xd'));var Papa=require(_0x3c43('0xe'));var Redis=require(_0x3c43('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3c43('0x10'));var as=require(_0x3c43('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c43('0x12'))(_0x3c43('0x13'));var utils=require(_0x3c43('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3c43('0x15'));var db=require(_0x3c43('0x16'))['db'];config[_0x3c43('0x17')]=_[_0x3c43('0x18')](config[_0x3c43('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsAccount.socket')[_0x3c43('0x19')](socket);var jayson=require(_0x3c43('0x1a'));var client=jayson['client'][_0x3c43('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x4735bd,_0x1ac697,_0x1b3aaf,_0x4e4749){return new BPromise(function(_0x50b161,_0x3570cb){var _0x483baa=_0x4e4749||client;return _0x483baa[_0x3c43('0x1c')](_0x4735bd,_0x1b3aaf)[_0x3c43('0x1d')](function(_0x171c5b){logger[_0x3c43('0x1e')](_0x3c43('0x1f'),_0x1ac697,_0x3c43('0x20'));logger[_0x3c43('0x21')](_0x3c43('0x22'),_0x1ac697,'request\x20sent',JSON['stringify'](_0x171c5b));if(_0x171c5b[_0x3c43('0x23')]){if(_0x171c5b['error'][_0x3c43('0x24')]===0x1f4){logger[_0x3c43('0x23')](_0x3c43('0x1f'),_0x1ac697,_0x171c5b['error']['message']);return _0x3570cb(_0x171c5b[_0x3c43('0x23')][_0x3c43('0x25')]);}logger[_0x3c43('0x23')](_0x3c43('0x1f'),_0x1ac697,_0x171c5b[_0x3c43('0x23')]['message']);return _0x50b161(_0x171c5b[_0x3c43('0x23')]['message']);}else{logger[_0x3c43('0x1e')](_0x3c43('0x1f'),_0x1ac697,_0x3c43('0x20'));_0x50b161(_0x171c5b[_0x3c43('0x26')][_0x3c43('0x25')]);}})[_0x3c43('0x27')](function(_0x5dab06){logger[_0x3c43('0x23')](_0x3c43('0x1f'),_0x1ac697,_0x5dab06);_0x3570cb(_0x5dab06);});});}function respondWithStatusCode(_0x1469aa,_0x5b8def){_0x5b8def=_0x5b8def||0xcc;return function(_0x220a2c){if(_0x220a2c){return _0x1469aa[_0x3c43('0x28')](_0x5b8def);}return _0x1469aa[_0x3c43('0x29')](_0x5b8def)[_0x3c43('0x2a')]();};}function respondWithResult(_0x16d43b,_0x43c49d){_0x43c49d=_0x43c49d||0xc8;return function(_0x47183b){if(_0x47183b){return _0x16d43b[_0x3c43('0x29')](_0x43c49d)['json'](_0x47183b);}};}function respondWithFilteredResult(_0x42c861,_0x49216a){return function(_0x3d02ae){if(_0x3d02ae){var _0x3f6ea7=typeof _0x49216a[_0x3c43('0x2b')]==='undefined'&&typeof _0x49216a[_0x3c43('0x2c')]==='undefined';var _0x107754=_0x3d02ae['count'];var _0x35af96=_0x3f6ea7?0x0:_0x49216a[_0x3c43('0x2b')];var _0x89bea7=_0x3f6ea7?_0x3d02ae[_0x3c43('0x2d')]:_0x49216a['offset']+_0x49216a['limit'];var _0x5d7f5b;if(_0x89bea7>=_0x107754){_0x89bea7=_0x107754;_0x5d7f5b=0xc8;}else{_0x5d7f5b=0xce;}_0x42c861[_0x3c43('0x29')](_0x5d7f5b);return _0x42c861['set']('Content-Range',_0x35af96+'-'+_0x89bea7+'/'+_0x107754)[_0x3c43('0x2e')](_0x3d02ae);}return null;};}function patchUpdates(_0x103fca){return function(_0x3bafc8){try{jsonpatch[_0x3c43('0x2f')](_0x3bafc8,_0x103fca,!![]);}catch(_0x2d8e13){return BPromise[_0x3c43('0x30')](_0x2d8e13);}return _0x3bafc8[_0x3c43('0x31')]();};}function saveUpdates(_0x175324,_0x4e3365){return function(_0x530d26){if(_0x530d26){return _0x530d26[_0x3c43('0x32')](_0x175324)[_0x3c43('0x1d')](function(_0x522483){return _0x522483;});}return null;};}function removeEntity(_0x468937,_0x4d8f77){return function(_0x5aba00){if(_0x5aba00){return _0x5aba00[_0x3c43('0x33')]()[_0x3c43('0x1d')](function(){var _0x2ca237=_0x5aba00['get']({'plain':!![]});var _0x42a5fc=_0x3c43('0x34');return db[_0x3c43('0x35')][_0x3c43('0x33')]({'where':{'type':_0x42a5fc,'resourceId':_0x2ca237['id']}})['then'](function(){return _0x5aba00;});})['then'](function(){_0x468937[_0x3c43('0x29')](0xcc)[_0x3c43('0x2a')]();});}};}function handleEntityNotFound(_0x2ec1c4,_0x5f761){return function(_0x327925){if(!_0x327925){_0x2ec1c4[_0x3c43('0x28')](0x194);}return _0x327925;};}function handleError(_0x133dc5,_0x46dfb0){_0x46dfb0=_0x46dfb0||0x1f4;return function(_0xe051cb){logger[_0x3c43('0x23')](_0xe051cb[_0x3c43('0x36')]);if(_0xe051cb['name']){delete _0xe051cb[_0x3c43('0x37')];}_0x133dc5['status'](_0x46dfb0)[_0x3c43('0x38')](_0xe051cb);};}exports[_0x3c43('0x39')]=function(_0xb588c,_0x40f0d5){var _0x1e245f={'include':[{'model':db['Pause'],'as':_0x3c43('0x3a')}]},_0x1c4cdd={},_0x2abdd8={'count':0x0,'rows':[]};var _0x59c65f=_[_0x3c43('0x3b')](db[_0x3c43('0x3c')][_0x3c43('0x3d')],function(_0x5f39c1){return{'name':_0x5f39c1[_0x3c43('0x3e')],'type':_0x5f39c1['type'][_0x3c43('0x3f')]};});_0x1c4cdd[_0x3c43('0x40')]=_[_0x3c43('0x3b')](_0x59c65f,'name');_0x1c4cdd[_0x3c43('0x41')]=_[_0x3c43('0x42')](_0xb588c[_0x3c43('0x41')]);_0x1c4cdd[_0x3c43('0x43')]=_[_0x3c43('0x44')](_0x1c4cdd['model'],_0x1c4cdd[_0x3c43('0x41')]);_0x1e245f['attributes']=_['intersection'](_0x1c4cdd[_0x3c43('0x40')],qs[_0x3c43('0x45')](_0xb588c['query'][_0x3c43('0x45')]));_0x1e245f[_0x3c43('0x46')]=_0x1e245f[_0x3c43('0x46')][_0x3c43('0x47')]?_0x1e245f[_0x3c43('0x46')]:_0x1c4cdd[_0x3c43('0x40')];if(!_0xb588c[_0x3c43('0x41')][_0x3c43('0x48')](_0x3c43('0x49'))){_0x1e245f[_0x3c43('0x2c')]=qs[_0x3c43('0x2c')](_0xb588c[_0x3c43('0x41')][_0x3c43('0x2c')]);_0x1e245f[_0x3c43('0x2b')]=qs[_0x3c43('0x2b')](_0xb588c[_0x3c43('0x41')][_0x3c43('0x2b')]);}_0x1e245f[_0x3c43('0x4a')]=qs[_0x3c43('0x4b')](_0xb588c['query'][_0x3c43('0x4b')]);_0x1e245f[_0x3c43('0x4c')]=qs[_0x3c43('0x43')](_[_0x3c43('0x4d')](_0xb588c['query'],_0x1c4cdd[_0x3c43('0x43')]),_0x59c65f);if(_0xb588c[_0x3c43('0x41')][_0x3c43('0x4e')]){_0x1e245f[_0x3c43('0x4c')]=_[_0x3c43('0x4f')](_0x1e245f['where'],{'$or':_[_0x3c43('0x3b')](_0x59c65f,function(_0x33c3de){if(_0x33c3de[_0x3c43('0x50')]!=='VIRTUAL'){var _0x5c4eee={};_0x5c4eee[_0x33c3de[_0x3c43('0x37')]]={'$like':'%'+_0xb588c[_0x3c43('0x41')]['filter']+'%'};return _0x5c4eee;}})});}_0x1e245f=_[_0x3c43('0x4f')]({},_0x1e245f,_0xb588c[_0x3c43('0x51')]);var _0x439072={'where':_0x1e245f[_0x3c43('0x4c')]};return db[_0x3c43('0x3c')]['count'](_0x439072)[_0x3c43('0x1d')](function(_0x4e51c8){_0x2abdd8[_0x3c43('0x2d')]=_0x4e51c8;if(_0xb588c['query'][_0x3c43('0x52')]){_0x1e245f[_0x3c43('0x53')]=[{'all':!![]}];}return db[_0x3c43('0x3c')][_0x3c43('0x54')](_0x1e245f);})[_0x3c43('0x1d')](function(_0x596d1c){_0x2abdd8['rows']=_0x596d1c;return _0x2abdd8;})[_0x3c43('0x1d')](respondWithFilteredResult(_0x40f0d5,_0x1e245f))[_0x3c43('0x27')](handleError(_0x40f0d5,null));};exports[_0x3c43('0x55')]=function(_0xd7fe25,_0x5f5005){var _0x197ff4={'raw':![],'where':{'id':_0xd7fe25['params']['id']},'include':[{'model':db['Pause'],'as':_0x3c43('0x3a')}]},_0x3fdc89={};_0x3fdc89[_0x3c43('0x40')]=_[_0x3c43('0x42')](db[_0x3c43('0x3c')][_0x3c43('0x3d')]);_0x3fdc89[_0x3c43('0x41')]=_[_0x3c43('0x42')](_0xd7fe25[_0x3c43('0x41')]);_0x3fdc89[_0x3c43('0x43')]=_['intersection'](_0x3fdc89[_0x3c43('0x40')],_0x3fdc89[_0x3c43('0x41')]);_0x197ff4[_0x3c43('0x46')]=_[_0x3c43('0x44')](_0x3fdc89[_0x3c43('0x40')],qs[_0x3c43('0x45')](_0xd7fe25[_0x3c43('0x41')][_0x3c43('0x45')]));_0x197ff4[_0x3c43('0x46')]=_0x197ff4[_0x3c43('0x46')]['length']?_0x197ff4[_0x3c43('0x46')]:_0x3fdc89[_0x3c43('0x40')];if(_0xd7fe25[_0x3c43('0x41')][_0x3c43('0x52')]){_0x197ff4[_0x3c43('0x53')]=[{'all':!![]}];}_0x197ff4=_[_0x3c43('0x4f')]({},_0x197ff4,_0xd7fe25[_0x3c43('0x51')]);return db[_0x3c43('0x3c')][_0x3c43('0x56')](_0x197ff4)['then'](handleEntityNotFound(_0x5f5005,null))[_0x3c43('0x1d')](respondWithResult(_0x5f5005,null))[_0x3c43('0x27')](handleError(_0x5f5005,null));};exports[_0x3c43('0x57')]=function(_0x4b713b,_0x39d896){return db['SmsAccount'][_0x3c43('0x57')](_0x4b713b[_0x3c43('0x58')],{})[_0x3c43('0x1d')](function(_0x5db739){var _0x2a7098=_0x4b713b[_0x3c43('0x59')]['get']({'plain':!![]});if(!_0x2a7098)throw new Error(_0x3c43('0x5a'));if(_0x2a7098['role']===_0x3c43('0x59')){var _0x4bdee2=_0x5db739[_0x3c43('0x5b')]({'plain':!![]});var _0x275dc8=_0x3c43('0x34');return db['UserProfileSection'][_0x3c43('0x56')]({'where':{'name':_0x275dc8,'userProfileId':_0x2a7098['userProfileId']},'raw':!![]})['then'](function(_0x586ea6){if(_0x586ea6&&_0x586ea6[_0x3c43('0x5c')]===0x0){return db[_0x3c43('0x35')][_0x3c43('0x57')]({'name':_0x4bdee2['name'],'resourceId':_0x4bdee2['id'],'type':_0x586ea6[_0x3c43('0x37')],'sectionId':_0x586ea6['id']},{})[_0x3c43('0x1d')](function(){return _0x5db739;});}else{return _0x5db739;}})['catch'](function(_0x54b51b){logger[_0x3c43('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x54b51b);throw _0x54b51b;});}return _0x5db739;})[_0x3c43('0x1d')](respondWithResult(_0x39d896,0xc9))[_0x3c43('0x27')](handleError(_0x39d896,null));};exports[_0x3c43('0x32')]=function(_0x371ac1,_0xc46d94){if(_0x371ac1[_0x3c43('0x58')]['id']){delete _0x371ac1[_0x3c43('0x58')]['id'];}return db[_0x3c43('0x3c')][_0x3c43('0x56')]({'where':{'id':_0x371ac1[_0x3c43('0x5d')]['id']},'include':[{'model':db[_0x3c43('0x5e')],'as':_0x3c43('0x3a')}]})['then'](handleEntityNotFound(_0xc46d94,null))[_0x3c43('0x1d')](saveUpdates(_0x371ac1[_0x3c43('0x58')],null))[_0x3c43('0x1d')](respondWithResult(_0xc46d94,null))[_0x3c43('0x27')](handleError(_0xc46d94,null));};exports['destroy']=function(_0x17ac1f,_0x35aa86){return db[_0x3c43('0x3c')][_0x3c43('0x56')]({'where':{'id':_0x17ac1f[_0x3c43('0x5d')]['id']}})['then'](handleEntityNotFound(_0x35aa86,null))[_0x3c43('0x1d')](removeEntity(_0x35aa86,null))[_0x3c43('0x27')](handleError(_0x35aa86,null));};exports['describe']=function(_0x454c6d,_0x4a18f4){return db[_0x3c43('0x3c')][_0x3c43('0x5f')]()[_0x3c43('0x1d')](respondWithResult(_0x4a18f4,null))['catch'](handleError(_0x4a18f4,null));};exports[_0x3c43('0x60')]=function(_0x13629b,_0x5c1c85,_0x474db3){if(_0x13629b[_0x3c43('0x58')]['id']){delete _0x13629b[_0x3c43('0x58')]['id'];}return db[_0x3c43('0x3c')][_0x3c43('0x56')]({'where':{'id':_0x13629b[_0x3c43('0x5d')]['id']}})[_0x3c43('0x1d')](handleEntityNotFound(_0x5c1c85,null))[_0x3c43('0x1d')](function(_0x2664f2){if(_0x2664f2){_0x13629b[_0x3c43('0x58')][_0x3c43('0x61')]=_0x2664f2['id'];return db[_0x3c43('0x62')][_0x3c43('0x57')](_0x13629b[_0x3c43('0x58')]);}})[_0x3c43('0x1d')](respondWithResult(_0x5c1c85,null))[_0x3c43('0x27')](handleError(_0x5c1c85,null));};exports[_0x3c43('0x63')]=function(_0x177ef2,_0x13115c,_0xbb8afa){var _0x1838a0={'raw':![],'where':{}};var _0x3499b8={};var _0x5c726b={'count':0x0,'rows':[]};return db[_0x3c43('0x3c')]['findOne']({'where':{'id':_0x177ef2[_0x3c43('0x5d')]['id']}})['then'](handleEntityNotFound(_0x13115c,null))['then'](function(_0x538ece){if(_0x538ece){_0x3499b8[_0x3c43('0x40')]=_[_0x3c43('0x42')](db[_0x3c43('0x62')][_0x3c43('0x3d')]);_0x3499b8[_0x3c43('0x41')]=_[_0x3c43('0x42')](_0x177ef2[_0x3c43('0x41')]);_0x3499b8[_0x3c43('0x43')]=_[_0x3c43('0x44')](_0x3499b8[_0x3c43('0x40')],_0x3499b8[_0x3c43('0x41')]);_0x1838a0[_0x3c43('0x46')]=_['intersection'](_0x3499b8['model'],qs['fields'](_0x177ef2[_0x3c43('0x41')][_0x3c43('0x45')]));_0x1838a0[_0x3c43('0x46')]=_0x1838a0['attributes'][_0x3c43('0x47')]?_0x1838a0['attributes']:_0x3499b8[_0x3c43('0x40')];if(!_0x177ef2[_0x3c43('0x41')][_0x3c43('0x48')](_0x3c43('0x49'))){_0x1838a0[_0x3c43('0x2c')]=qs['limit'](_0x177ef2[_0x3c43('0x41')][_0x3c43('0x2c')]);_0x1838a0['offset']=qs[_0x3c43('0x2b')](_0x177ef2[_0x3c43('0x41')][_0x3c43('0x2b')]);}_0x1838a0[_0x3c43('0x4a')]=qs[_0x3c43('0x4b')](_0x177ef2[_0x3c43('0x41')]['sort']);_0x1838a0['where']=qs[_0x3c43('0x43')](_[_0x3c43('0x4d')](_0x177ef2[_0x3c43('0x41')],_0x3499b8[_0x3c43('0x43')]));_0x1838a0[_0x3c43('0x4c')][_0x3c43('0x61')]=_0x538ece['id'];if(_0x177ef2[_0x3c43('0x41')][_0x3c43('0x4e')]){_0x1838a0['where']=_[_0x3c43('0x4f')](_0x1838a0['where'],{'$or':_[_0x3c43('0x3b')](_0x1838a0[_0x3c43('0x46')],function(_0x4d7a6d){var _0x131838={};_0x131838[_0x4d7a6d]={'$like':'%'+_0x177ef2[_0x3c43('0x41')][_0x3c43('0x4e')]+'%'};return _0x131838;})});}_0x1838a0=_[_0x3c43('0x4f')]({},_0x1838a0,_0x177ef2[_0x3c43('0x51')]);return db[_0x3c43('0x62')][_0x3c43('0x2d')]({'where':_0x1838a0[_0x3c43('0x4c')]})[_0x3c43('0x1d')](function(_0x1f8eed){_0x5c726b['count']=_0x1f8eed;if(_0x177ef2[_0x3c43('0x41')][_0x3c43('0x52')]){_0x1838a0['include']=[{'all':!![]}];}return db[_0x3c43('0x62')][_0x3c43('0x54')](_0x1838a0);})['then'](function(_0x52f1c6){_0x5c726b[_0x3c43('0x64')]=_0x52f1c6;return _0x5c726b;});}})[_0x3c43('0x1d')](respondWithFilteredResult(_0x13115c,_0x1838a0))['catch'](handleError(_0x13115c,null));};exports[_0x3c43('0x65')]=function(_0x231e67,_0x56348c,_0x505440){return db[_0x3c43('0x3c')][_0x3c43('0x56')]({'where':{'id':_0x231e67[_0x3c43('0x5d')]['id']}})[_0x3c43('0x1d')](handleEntityNotFound(_0x56348c,null))[_0x3c43('0x1d')](function(_0x4cb5de){if(_0x4cb5de){return _0x4cb5de[_0x3c43('0x65')](_0x231e67['query'][_0x3c43('0x66')]);}})[_0x3c43('0x1d')](respondWithStatusCode(_0x56348c,null))['catch'](handleError(_0x56348c,null));};exports[_0x3c43('0x67')]=function(_0x5547d9,_0x899083,_0x1c5175){if(_0x5547d9[_0x3c43('0x58')]['id']){delete _0x5547d9['body']['id'];}return db[_0x3c43('0x3c')][_0x3c43('0x56')]({'where':{'id':_0x5547d9[_0x3c43('0x5d')]['id']}})[_0x3c43('0x1d')](handleEntityNotFound(_0x899083,null))[_0x3c43('0x1d')](function(_0x33bb3f){if(_0x33bb3f){_0x5547d9['body'][_0x3c43('0x61')]=_0x33bb3f['id'];return db[_0x3c43('0x68')][_0x3c43('0x57')](_0x5547d9[_0x3c43('0x58')]);}})['then'](respondWithResult(_0x899083,null))[_0x3c43('0x27')](handleError(_0x899083,null));};exports[_0x3c43('0x69')]=function(_0x3018b2,_0x4e0db4,_0x525b93){var _0x5cb4c2={'raw':![],'where':{}};var _0xee54c2={};var _0x93c2a0={'count':0x0,'rows':[]};return db[_0x3c43('0x3c')][_0x3c43('0x6a')]({'where':{'id':_0x3018b2[_0x3c43('0x5d')]['id']}})[_0x3c43('0x1d')](handleEntityNotFound(_0x4e0db4,null))[_0x3c43('0x1d')](function(_0x1f3e6d){if(_0x1f3e6d){_0xee54c2[_0x3c43('0x40')]=_[_0x3c43('0x42')](db['CannedAnswer']['rawAttributes']);_0xee54c2[_0x3c43('0x41')]=_[_0x3c43('0x42')](_0x3018b2[_0x3c43('0x41')]);_0xee54c2[_0x3c43('0x43')]=_[_0x3c43('0x44')](_0xee54c2[_0x3c43('0x40')],_0xee54c2['query']);_0x5cb4c2[_0x3c43('0x46')]=_[_0x3c43('0x44')](_0xee54c2['model'],qs['fields'](_0x3018b2[_0x3c43('0x41')]['fields']));_0x5cb4c2[_0x3c43('0x46')]=_0x5cb4c2[_0x3c43('0x46')]['length']?_0x5cb4c2['attributes']:_0xee54c2[_0x3c43('0x40')];if(!_0x3018b2['query']['hasOwnProperty']('nolimit')){_0x5cb4c2[_0x3c43('0x2c')]=qs['limit'](_0x3018b2['query']['limit']);_0x5cb4c2[_0x3c43('0x2b')]=qs[_0x3c43('0x2b')](_0x3018b2[_0x3c43('0x41')][_0x3c43('0x2b')]);}_0x5cb4c2[_0x3c43('0x4a')]=qs['sort'](_0x3018b2['query']['sort']);_0x5cb4c2[_0x3c43('0x4c')]=qs['filters'](_['pick'](_0x3018b2[_0x3c43('0x41')],_0xee54c2['filters']));_0x5cb4c2[_0x3c43('0x4c')][_0x3c43('0x61')]=_0x1f3e6d['id'];if(_0x3018b2[_0x3c43('0x41')][_0x3c43('0x4e')]){_0x5cb4c2['where']=_[_0x3c43('0x4f')](_0x5cb4c2[_0x3c43('0x4c')],{'$or':_[_0x3c43('0x3b')](_0x5cb4c2[_0x3c43('0x46')],function(_0x95570b){var _0x5273b0={};_0x5273b0[_0x95570b]={'$like':'%'+_0x3018b2[_0x3c43('0x41')][_0x3c43('0x4e')]+'%'};return _0x5273b0;})});}_0x5cb4c2=_[_0x3c43('0x4f')]({},_0x5cb4c2,_0x3018b2['options']);return db['CannedAnswer'][_0x3c43('0x2d')]({'where':_0x5cb4c2[_0x3c43('0x4c')]})[_0x3c43('0x1d')](function(_0x57366a){_0x93c2a0[_0x3c43('0x2d')]=_0x57366a;if(_0x3018b2[_0x3c43('0x41')]['includeAll']){_0x5cb4c2['include']=[{'all':!![]}];}return db[_0x3c43('0x68')][_0x3c43('0x54')](_0x5cb4c2);})[_0x3c43('0x1d')](function(_0x1d3264){_0x93c2a0[_0x3c43('0x64')]=_0x1d3264;return _0x93c2a0;});}})[_0x3c43('0x1d')](respondWithFilteredResult(_0x4e0db4,_0x5cb4c2))[_0x3c43('0x27')](handleError(_0x4e0db4,null));};exports[_0x3c43('0x6b')]=function(_0xa538,_0x30a7d9,_0x305e0d){return db[_0x3c43('0x3c')]['find']({'where':{'id':_0xa538[_0x3c43('0x5d')]['id']}})['then'](handleEntityNotFound(_0x30a7d9,null))[_0x3c43('0x1d')](function(_0x36b8ef){if(_0x36b8ef){return _0x36b8ef[_0x3c43('0x6b')](_0xa538['query'][_0x3c43('0x66')]);}})[_0x3c43('0x1d')](respondWithStatusCode(_0x30a7d9,null))[_0x3c43('0x27')](handleError(_0x30a7d9,null));};exports['notify']=function(_0x3f4558,_0x5dd2cd,_0x448df0){var _0x1ff12c={'channel':_0x3c43('0x6c')};var _0xd31c78=[];var _0x3146d2=[];var _0x229d2c={};return db[_0x3c43('0x3c')][_0x3c43('0x56')]({'where':{'id':_0x3f4558[_0x3c43('0x5d')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x3c43('0x6d')}]})['then'](handleEntityNotFound(_0x5dd2cd,null))[_0x3c43('0x1d')](function(_0x28b6fd){_0x1ff12c['account']=_0x28b6fd;_0x1ff12c[_0x3c43('0x6e')]=_[_0x3c43('0x6f')](_0x28b6fd['Applications'],[_0x3c43('0x70')],[_0x3c43('0x71')]);if(_0x1ff12c[_0x3c43('0x72')][_0x3c43('0x6d')]){delete _0x1ff12c[_0x3c43('0x72')][_0x3c43('0x6d')];}return db[_0x3c43('0x73')][_0x3c43('0x5f')]();})['then'](function(_0x89855){if(!_0x89855){throw new db[(_0x3c43('0x74'))]['ValidationError'](_0x3c43('0x75'));}_0xd31c78=_[_0x3c43('0x76')](_[_0x3c43('0x42')](_0x89855),['createdAt',_0x3c43('0x77')]);_0x3146d2=_[_0x3c43('0x76')](_[_0x3c43('0x42')](_0x89855),[_0x3c43('0x78'),_0x3c43('0x77'),_0x3c43('0x79'),_0x3c43('0x7a')]);_0x1ff12c[_0x3c43('0x58')]={'mapKey':'mobile'};if(_0x1ff12c[_0x3c43('0x72')][_0x3c43('0x50')]){switch(_0x1ff12c[_0x3c43('0x72')][_0x3c43('0x50')]){case _0x3c43('0x7b'):_0x1ff12c[_0x3c43('0x58')]['from']=_0x3f4558[_0x3c43('0x58')][_0x3c43('0x7c')];_0x1ff12c[_0x3c43('0x58')]['body']=_0x3f4558[_0x3c43('0x58')]['Body'];_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x7d')]=_0x3f4558[_0x3c43('0x58')][_0x3c43('0x7e')];break;case'skebby':_0x1ff12c[_0x3c43('0x58')]['from']='+'+_0x3f4558['body']['sender'];_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x58')]=_0x3f4558[_0x3c43('0x58')][_0x3c43('0x7f')];break;case _0x3c43('0x80'):_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x81')]=_0x3f4558['body'][_0x3c43('0x81')];_0x1ff12c['body'][_0x3c43('0x58')]=_0x3f4558[_0x3c43('0x58')][_0x3c43('0x25')];break;case _0x3c43('0x82'):_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x81')]=_0x3f4558[_0x3c43('0x58')][_0x3c43('0x81')];_0x1ff12c['body']['body']=_0x3f4558[_0x3c43('0x58')]['body'];_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x7d')]=_0x3f4558[_0x3c43('0x58')][_0x3c43('0x83')];break;case _0x3c43('0x84'):_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x81')]=_0x3f4558['body'][_0x3c43('0x7c')];_0x1ff12c['body']['body']=_0x3f4558[_0x3c43('0x58')]['Text'];_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x7d')]=_0x3f4558[_0x3c43('0x58')][_0x3c43('0x85')];break;case _0x3c43('0x86'):_0x1ff12c['body'][_0x3c43('0x81')]='+'+_0x3f4558['body'][_0x3c43('0x87')][0x0][_0x3c43('0x81')];_0x1ff12c['body'][_0x3c43('0x58')]=_0x3f4558[_0x3c43('0x58')]['results'][0x0]['text'];_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x7d')]=_0x3f4558['body']['results'][0x0]['messageId'];break;case _0x3c43('0x88'):_0x1ff12c[_0x3c43('0x58')]['from']=_0x3f4558[_0x3c43('0x58')][_0x3c43('0x89')];_0x1ff12c[_0x3c43('0x58')]['body']=_0x3f4558[_0x3c43('0x58')][_0x3c43('0x8a')][_0x3c43('0x25')];break;case _0x3c43('0x8b'):_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x81')]=_0x3f4558[_0x3c43('0x58')][_0x3c43('0x8c')];_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x58')]=_0x3f4558[_0x3c43('0x58')][_0x3c43('0x7f')];_0x1ff12c['body'][_0x3c43('0x7d')]=_0x3f4558[_0x3c43('0x58')]['replyMessageId'];break;case'bandwidth':_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x7d')]=_0x3f4558['body'][0x0]['message']['id'];_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x81')]=_0x3f4558[_0x3c43('0x58')][0x0][_0x3c43('0x25')][_0x3c43('0x81')];_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x58')]=_0x3f4558[_0x3c43('0x58')][0x0]['message'][_0x3c43('0x7f')];break;case _0x3c43('0x8d'):_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x81')]=_0x3f4558['body'][_0x3c43('0x81')];_0x1ff12c['body']['body']=_0x3f4558[_0x3c43('0x58')][_0x3c43('0x25')];_0x1ff12c['body'][_0x3c43('0x7d')]=_0x3f4558['body']['refid'];break;}}if(_0x1ff12c[_0x3c43('0x58')]['id']){delete _0x1ff12c[_0x3c43('0x58')]['id'];}if(_['isNil'](_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x81')])){throw new db['Sequelize'][(_0x3c43('0x8e'))](_0x3c43('0x8f'));}if(_[_0x3c43('0x90')](_0x1ff12c['body'][_0x3c43('0x58')])||_0x1ff12c[_0x3c43('0x58')]['body']===''){throw new db['Sequelize'][(_0x3c43('0x8e'))](_0x3c43('0x91'));}if(_[_0x3c43('0x90')](_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x92')])){throw new db[(_0x3c43('0x74'))][(_0x3c43('0x8e'))](_0x3c43('0x93')+_0x3146d2);}if(!_[_0x3c43('0x94')](_0x3146d2,_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x92')])){throw new db[(_0x3c43('0x74'))][(_0x3c43('0x8e'))](_0x3c43('0x95')+_0x3146d2);}_0x229d2c[_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x92')]]=_0x1ff12c['body'][_0x3c43('0x81')];return db['CmList']['find']({'where':{'id':_0x1ff12c[_0x3c43('0x72')][_0x3c43('0x7a')]},'include':[{'model':db[_0x3c43('0x73')],'as':_0x3c43('0x96'),'where':_0x229d2c,'limit':0x1,'order':[[_0x3c43('0x77'),_0x3c43('0x97')]]}]});})[_0x3c43('0x1d')](handleEntityNotFound(_0x5dd2cd,null))[_0x3c43('0x1d')](function(_0x2cf7f0){if(_0x2cf7f0){_0x1ff12c[_0x3c43('0x98')]=_[_0x3c43('0x99')](_0x2cf7f0,[_0x3c43('0x96')]);if(_0x2cf7f0[_0x3c43('0x96')]['length']){return _0x2cf7f0[_0x3c43('0x96')][0x0];}var _0x4f5b3b=_[_0x3c43('0x18')](_0x1ff12c['body'],{'firstName':_0x1ff12c[_0x3c43('0x58')]['from'],'ListId':_0x2cf7f0['id']});_0x4f5b3b[_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x92')]]=_0x1ff12c[_0x3c43('0x58')][_0x3c43('0x81')];return db[_0x3c43('0x73')][_0x3c43('0x57')](_0x4f5b3b,{'fields':_0xd31c78,'raw':!![]});}})['then'](handleEntityNotFound(_0x5dd2cd,null))[_0x3c43('0x1d')](function(_0x3e3f25){if(_0x3e3f25){_0x1ff12c['contact']=_0x3e3f25;var _0xf20926={'ContactId':_0x3e3f25['id'],'phone':_0x1ff12c[_0x3c43('0x58')]['from'],'SmsAccountId':_0x3f4558[_0x3c43('0x5d')]['id']};var _0xbe0f26={'ContactId':_0x3e3f25['id'],'SmsAccountId':_0x3f4558[_0x3c43('0x5d')]['id'],'closed':![]};return db[_0x3c43('0x9a')][_0x3c43('0x56')]({'where':_0xbe0f26})[_0x3c43('0x1d')](function(_0xcc10e3){if(_0xcc10e3){return[_0xcc10e3,![]];}return db[_0x3c43('0x9a')][_0x3c43('0x57')](_0xf20926)[_0x3c43('0x1d')](function(_0x57ca6b){return[_0x57ca6b,!![]];});});}})[_0x3c43('0x9b')](function(_0x5d5ab7,_0x297ae1){_0x1ff12c[_0x3c43('0x9c')]=_0x5d5ab7['get']({'plain':!![]});_0x1ff12c['interaction'][_0x3c43('0x9d')]=![];if(_0x297ae1){if(_0x1ff12c[_0x3c43('0x72')]['autoclose']){_0x1ff12c[_0x3c43('0x6e')][_0x3c43('0x9e')]({'id':0x0,'priority':_0x1ff12c[_0x3c43('0x6e')]['length']+0x1,'app':_0x3c43('0x9f'),'appdata':_0x3c43('0xa0'),'interval':_0x3c43('0xa1')});}_0x1ff12c[_0x3c43('0x9c')][_0x3c43('0x9d')]=!![];}return db[_0x3c43('0xa2')][_0x3c43('0x57')]({'phone':_0x1ff12c['body'][_0x3c43('0x81')],'messageId':_0x1ff12c['body'][_0x3c43('0x7d')],'body':_0x1ff12c['body'][_0x3c43('0x58')],'SmsAccountId':_0x3f4558[_0x3c43('0x5d')]['id'],'SmsInteractionId':_0x5d5ab7['id'],'direction':'in','ContactId':_0x5d5ab7['ContactId'],'AttachmentId':_0x1ff12c[_0x3c43('0x58')]['AttachmentId']});})[_0x3c43('0x1d')](function(_0x49831d){_0x1ff12c[_0x3c43('0x25')]=_0x49831d;if(_0x1ff12c[_0x3c43('0x9c')]['UserId']){return db[_0x3c43('0xa3')][_0x3c43('0x56')]({'attributes':['id',_0x3c43('0x37')],'where':{'id':_0x1ff12c[_0x3c43('0x9c')][_0x3c43('0xa4')]}})[_0x3c43('0x1d')](function(_0x369ca7){if(_0x369ca7){_0x1ff12c[_0x3c43('0x6e')][_0x3c43('0xa5')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x369ca7['name']+','+(_0x1ff12c[_0x3c43('0x72')][_0x3c43('0xa6')]||0xa),'interval':_0x3c43('0xa1')});}return respondWithRpcPromise(_0x3c43('0xa7'),_0x3c43('0xa8'),_0x1ff12c);});}return respondWithRpcPromise(_0x3c43('0xa7'),_0x3c43('0xa8'),_0x1ff12c);})[_0x3c43('0x1d')](function(_0x1bc8bb){if(_0x1bc8bb){var _0x347e69=0xc8;var _0x302c74=_0x3c43('0xa9');logger[_0x3c43('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x302c74,_0x347e69,'entity\x20found');logger[_0x3c43('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x302c74,_0x347e69,_0x3c43('0xaa'),JSON[_0x3c43('0xab')](_0x1bc8bb));if(_0x1ff12c[_0x3c43('0x72')][_0x3c43('0x50')]===_0x3c43('0x7b')){return _0x5dd2cd[_0x3c43('0x29')](_0x347e69)[_0x3c43('0xac')](_0x3c43('0xad'),'text/xml')[_0x3c43('0x38')](_0x3c43('0xae'));}else{return _0x5dd2cd[_0x3c43('0x29')](_0x347e69)[_0x3c43('0x2e')](_0x1bc8bb);}}})['catch'](handleError(_0x5dd2cd,null));};exports[_0x3c43('0xaf')]=function(_0x47e713,_0x4adb40,_0x5b2e0f){return db[_0x3c43('0x3c')][_0x3c43('0x6a')]({'where':{'id':_0x47e713['params']['id']}})['then'](handleEntityNotFound(_0x4adb40,null))[_0x3c43('0x1d')](function(_0x248043){if(_0x248043){return db[_0x3c43('0xb0')][_0x3c43('0xb1')](function(_0x536383){return db[_0x3c43('0xb2')][_0x3c43('0x33')]({'where':{'SmsAccountId':_0x47e713[_0x3c43('0x5d')]['id']},'transaction':_0x536383})['then'](function(_0x9101e8){var _0xec2de2=_[_0x3c43('0x3b')](_0x47e713[_0x3c43('0x58')],function(_0x1d6c72){_0x1d6c72[_0x3c43('0x61')]=_0x47e713[_0x3c43('0x5d')]['id'];return _0x1d6c72;});return db[_0x3c43('0xb2')][_0x3c43('0xb3')](_0xec2de2,{'transaction':_0x536383});});})[_0x3c43('0x1d')](function(){return db['SmsApplication'][_0x3c43('0xb4')]({'where':{'SmsAccountId':_0x47e713[_0x3c43('0x5d')]['id']},'order':_0x3c43('0x70')});});}})[_0x3c43('0x1d')](respondWithResult(_0x4adb40,null))[_0x3c43('0x27')](handleError(_0x4adb40,null));};exports['getApplications']=function(_0x497cbc,_0x459225,_0x1a1896){var _0x1b8e7a={};var _0x55ce38={};var _0xaacdc7;var _0x84a957;return db['SmsAccount'][_0x3c43('0x6a')]({'where':{'id':_0x497cbc[_0x3c43('0x5d')]['id']}})['then'](handleEntityNotFound(_0x459225,null))['then'](function(_0x20116d){if(_0x20116d){_0xaacdc7=_0x20116d;_0x55ce38[_0x3c43('0x40')]=_[_0x3c43('0x42')](db[_0x3c43('0xb2')][_0x3c43('0x3d')]);_0x55ce38[_0x3c43('0x41')]=_[_0x3c43('0x42')](_0x497cbc[_0x3c43('0x41')]);_0x55ce38[_0x3c43('0x43')]=_[_0x3c43('0x44')](_0x55ce38[_0x3c43('0x40')],_0x55ce38[_0x3c43('0x41')]);_0x1b8e7a['attributes']=_[_0x3c43('0x44')](_0x55ce38[_0x3c43('0x40')],qs[_0x3c43('0x45')](_0x497cbc[_0x3c43('0x41')][_0x3c43('0x45')]));_0x1b8e7a['attributes']=_0x1b8e7a[_0x3c43('0x46')][_0x3c43('0x47')]?_0x1b8e7a[_0x3c43('0x46')]:_0x55ce38[_0x3c43('0x40')];_0x1b8e7a['order']=qs[_0x3c43('0x4b')](_0x497cbc[_0x3c43('0x41')][_0x3c43('0x4b')]);_0x1b8e7a['where']=qs[_0x3c43('0x43')](_['pick'](_0x497cbc[_0x3c43('0x41')],_0x55ce38[_0x3c43('0x43')]));if(_0x497cbc[_0x3c43('0x41')]['filter']){_0x1b8e7a[_0x3c43('0x4c')]=_[_0x3c43('0x4f')](_0x1b8e7a[_0x3c43('0x4c')],{'$or':_['map'](_0x1b8e7a['attributes'],function(_0x81c8e2){var _0x3ea1b5={};_0x3ea1b5[_0x81c8e2]={'$like':'%'+_0x497cbc[_0x3c43('0x41')][_0x3c43('0x4e')]+'%'};return _0x3ea1b5;})});}_0x1b8e7a=_[_0x3c43('0x4f')]({},_0x1b8e7a,_0x497cbc[_0x3c43('0x51')]);return _0xaacdc7['getApplications'](_0x1b8e7a);}})[_0x3c43('0x1d')](function(_0x53e891){if(_0x53e891){_0x84a957=_0x53e891['length'];if(!_0x497cbc['query'][_0x3c43('0x48')](_0x3c43('0x49'))){_0x1b8e7a[_0x3c43('0x2c')]=qs['limit'](_0x497cbc[_0x3c43('0x41')][_0x3c43('0x2c')]);_0x1b8e7a[_0x3c43('0x2b')]=qs[_0x3c43('0x2b')](_0x497cbc['query'][_0x3c43('0x2b')]);}return _0xaacdc7[_0x3c43('0xb5')](_0x1b8e7a);}})[_0x3c43('0x1d')](function(_0xd64c6d){if(_0xd64c6d){return _0xd64c6d?{'count':_0x84a957,'rows':_0xd64c6d}:null;}})['then'](respondWithResult(_0x459225,null))[_0x3c43('0x27')](handleError(_0x459225,null));};exports['getInteractions']=function(_0x180fc7,_0x2e274f,_0x47be69){var _0x5e6e4a={'raw':![],'where':{}};var _0x36fd15={};var _0x569442={'count':0x0,'rows':[]};return db['SmsAccount'][_0x3c43('0x6a')]({'where':{'id':_0x180fc7[_0x3c43('0x5d')]['id']}})['then'](handleEntityNotFound(_0x2e274f,null))[_0x3c43('0x1d')](function(_0x855aa1){if(_0x855aa1){_0x36fd15['model']=_[_0x3c43('0x42')](db[_0x3c43('0x9a')][_0x3c43('0x3d')]);_0x36fd15[_0x3c43('0x41')]=_[_0x3c43('0x42')](_0x180fc7[_0x3c43('0x41')]);_0x36fd15[_0x3c43('0x43')]=_[_0x3c43('0x44')](_0x36fd15['model'],_0x36fd15['query']);_0x5e6e4a[_0x3c43('0x46')]=_[_0x3c43('0x44')](_0x36fd15[_0x3c43('0x40')],qs['fields'](_0x180fc7['query'][_0x3c43('0x45')]));_0x5e6e4a[_0x3c43('0x46')]=_0x5e6e4a['attributes'][_0x3c43('0x47')]?_0x5e6e4a[_0x3c43('0x46')]:_0x36fd15[_0x3c43('0x40')];if(!_0x180fc7[_0x3c43('0x41')][_0x3c43('0x48')]('nolimit')){_0x5e6e4a[_0x3c43('0x2c')]=qs['limit'](_0x180fc7[_0x3c43('0x41')][_0x3c43('0x2c')]);_0x5e6e4a['offset']=qs[_0x3c43('0x2b')](_0x180fc7[_0x3c43('0x41')][_0x3c43('0x2b')]);}_0x5e6e4a[_0x3c43('0x4a')]=qs['sort'](_0x180fc7[_0x3c43('0x41')][_0x3c43('0x4b')]);_0x5e6e4a['where']=qs[_0x3c43('0x43')](_[_0x3c43('0x4d')](_0x180fc7[_0x3c43('0x41')],_0x36fd15['filters']));_0x5e6e4a[_0x3c43('0x4c')][_0x3c43('0x61')]=_0x855aa1['id'];if(_0x180fc7['query']['filter']){_0x5e6e4a['where']=_['merge'](_0x5e6e4a[_0x3c43('0x4c')],{'$or':_[_0x3c43('0x3b')](_0x5e6e4a[_0x3c43('0x46')],function(_0xd8b59a){var _0x437c91={};_0x437c91[_0xd8b59a]={'$like':'%'+_0x180fc7[_0x3c43('0x41')]['filter']+'%'};return _0x437c91;})});}_0x5e6e4a=_[_0x3c43('0x4f')]({},_0x5e6e4a,_0x180fc7[_0x3c43('0x51')]);return db[_0x3c43('0x9a')]['count']({'where':_0x5e6e4a[_0x3c43('0x4c')]})[_0x3c43('0x1d')](function(_0x22fa6d){_0x569442[_0x3c43('0x2d')]=_0x22fa6d;if(_0x180fc7[_0x3c43('0x41')][_0x3c43('0x52')]){_0x5e6e4a[_0x3c43('0x53')]=[{'model':db[_0x3c43('0x73')],'as':_0x3c43('0xb6'),'required':![]},{'model':db[_0x3c43('0xa3')],'as':_0x3c43('0xb7'),'attributes':['name',_0x3c43('0xb8'),_0x3c43('0xb9')],'required':![]},{'model':db[_0x3c43('0xba')],'as':_0x3c43('0xbb'),'attributes':['id','name',_0x3c43('0xbc')],'where':_0x180fc7[_0x3c43('0x41')]['tag']?{'id':_0x180fc7[_0x3c43('0x41')][_0x3c43('0xbd')]}:undefined,'required':_0x180fc7['query'][_0x3c43('0xbd')]?!![]:![]}];}return db[_0x3c43('0x9a')]['findAll'](_0x5e6e4a);})[_0x3c43('0x1d')](function(_0x25f041){_0x569442['rows']=_0x25f041;return _0x569442;});}})['then'](respondWithFilteredResult(_0x2e274f,_0x5e6e4a))['catch'](handleError(_0x2e274f,null));};exports[_0x3c43('0x38')]=function(_0x50b30c,_0x27593f,_0x15c762){var _0x3fa159,_0x434ecb,_0x4dddfb;if(_[_0x3c43('0x90')](_0x50b30c['body'][_0x3c43('0x58')])||_0x50b30c['body']['body']===''){throw new db[(_0x3c43('0x74'))][(_0x3c43('0x8e'))](_0x3c43('0x91'));}if(_[_0x3c43('0x90')](_0x50b30c[_0x3c43('0x58')]['to'])){throw new db[(_0x3c43('0x74'))][(_0x3c43('0x8e'))](_0x3c43('0xbe'));}_0x3fa159=_0x50b30c[_0x3c43('0x58')]['to'];return db[_0x3c43('0x3c')][_0x3c43('0x56')]({'where':{'id':_0x50b30c['params']['id']},'include':[{'model':db[_0x3c43('0xbf')],'as':'List','include':[{'model':db[_0x3c43('0x73')],'as':_0x3c43('0x96'),'where':{'mobile':_0x3fa159},'limit':0x1,'order':[[_0x3c43('0x77'),'DESC']]}]}]})[_0x3c43('0x1d')](handleEntityNotFound(_0x27593f,null))['then'](function(_0x14b8c0){if(_0x14b8c0&&_0x14b8c0[_0x3c43('0xc0')]){_0x434ecb=_0x14b8c0[_0x3c43('0x5b')]({'plain':!![]});if(_0x434ecb[_0x3c43('0xc0')]&&_0x434ecb['List'][_0x3c43('0x96')][_0x3c43('0x47')]){return _0x434ecb[_0x3c43('0xc0')][_0x3c43('0x96')][0x0];}return db[_0x3c43('0x73')][_0x3c43('0x57')](_[_0x3c43('0x18')](_0x50b30c['body'],{'firstName':_0x3fa159,'mobile':_0x3fa159,'phone':_0x3fa159,'ListId':_0x434ecb['ListId']}));}})[_0x3c43('0x1d')](handleEntityNotFound(_0x27593f,null))[_0x3c43('0x1d')](function(_0xeb73f5){if(_0xeb73f5){_0x4dddfb=_0xeb73f5;return db[_0x3c43('0x9a')][_0x3c43('0x56')]({'where':{'ContactId':_0x4dddfb['id'],'closed':![],'SmsAccountId':_0x434ecb['id']}})[_0x3c43('0x1d')](function(_0x16b25e){if(_0x16b25e){return[_0x16b25e,![]];}return db['SmsInteraction'][_0x3c43('0x57')]({'UserId':_0x50b30c[_0x3c43('0x59')]['id'],'ContactId':_0x4dddfb['id'],'SmsAccountId':_0x434ecb['id'],'phone':_0x3fa159,'firstMsgDirection':_0x3c43('0xc1'),'Messages':[_[_0x3c43('0x4f')](_0x50b30c['body'],{'read':![],'body':_0x50b30c[_0x3c43('0x58')][_0x3c43('0x58')],'phone':_0x3fa159,'SmsAccountId':_0x434ecb['id'],'UserId':_0x50b30c[_0x3c43('0x59')]['id'],'ContactId':_0x4dddfb['id']})]},{'include':[{'model':db[_0x3c43('0xa2')],'as':'Messages'}]})[_0x3c43('0x1d')](function(_0x33e30e){return[_0x33e30e,!![]];});});}})[_0x3c43('0x9b')](function(_0x20ec12,_0xcdbde8){if(_0xcdbde8){return _0x20ec12;}return db[_0x3c43('0xa2')]['create'](_[_0x3c43('0x4f')](_0x50b30c[_0x3c43('0x58')],{'read':![],'body':_0x50b30c[_0x3c43('0x58')][_0x3c43('0x58')],'phone':_0x3fa159,'SmsAccountId':_0x434ecb['id'],'SmsInteractionId':_0x20ec12['id'],'UserId':_0x50b30c[_0x3c43('0x59')]['id'],'ContactId':_0x4dddfb['id']}))['then'](function(_0x310361){_0x20ec12['dataValues'][_0x3c43('0xc2')]=[];_0x20ec12[_0x3c43('0xc3')][_0x3c43('0xc2')][_0x3c43('0x9e')](_0x310361['dataValues']);return _0x20ec12;});})[_0x3c43('0x1d')](respondWithResult(_0x27593f,null))['catch'](handleError(_0x27593f,null));};exports[_0x3c43('0x29')]=function(_0x5a2529,_0x49102e,_0x3015cc){if(_0x5a2529['body']['id']){delete _0x5a2529[_0x3c43('0x58')]['id'];}var _0x366cf6,_0x10d0f2,_0x2141b6;return db['SmsAccount']['find']({'where':{'id':_0x5a2529[_0x3c43('0x5d')]['id']}})[_0x3c43('0x1d')](handleEntityNotFound(_0x49102e,null))[_0x3c43('0x1d')](function(_0x38ecbd){if(_0x38ecbd){_0x2141b6=_0x38ecbd;logger[_0x3c43('0x21')](_0x3c43('0x22'),_0x3c43('0x29'),'received\x20delivery\x20report\x20from',_0x38ecbd[_0x3c43('0x50')],util[_0x3c43('0xc4')](_0x5a2529['body'],{'showHidden':![],'depth':null}));switch(_0x38ecbd[_0x3c43('0x50')]){case _0x3c43('0xc5'):if(_0x5a2529[_0x3c43('0x58')][_0x3c43('0xc6')]&&_0x5a2529['body'][_0x3c43('0x29')]){_0x10d0f2=_0x5a2529[_0x3c43('0x58')][_0x3c43('0x29')];return db['SmsMessage'][_0x3c43('0x56')]({'where':{'messageId':_0x5a2529['body'][_0x3c43('0xc6')]}});}break;case _0x3c43('0x80'):if(_0x5a2529[_0x3c43('0x58')][_0x3c43('0xc7')]&&_0x5a2529[_0x3c43('0x58')][_0x3c43('0xc8')]){_0x10d0f2=_0x5a2529[_0x3c43('0x58')][_0x3c43('0xc8')];return db['SmsMessage'][_0x3c43('0x56')]({'where':{'messageId':_0x5a2529[_0x3c43('0x58')][_0x3c43('0xc7')]}});}break;case _0x3c43('0x82'):if(_0x5a2529[_0x3c43('0x58')]['message_id']&&_0x5a2529['body']['status_code']){_0x10d0f2=_0x5a2529[_0x3c43('0x58')][_0x3c43('0xc9')];return db[_0x3c43('0xa2')][_0x3c43('0x56')]({'where':{'messageId':_0x5a2529[_0x3c43('0x58')][_0x3c43('0x83')]}});}break;case _0x3c43('0x86'):var _0x1b2619=_0x5a2529[_0x3c43('0x58')][_0x3c43('0x87')][0x0];if(_0x1b2619[_0x3c43('0x7d')]&&_0x1b2619[_0x3c43('0x29')][_0x3c43('0xca')]===_0x3c43('0xcb')){_0x10d0f2=_0x1b2619[_0x3c43('0x29')]['groupName'];return db[_0x3c43('0xa2')]['find']({'where':{'messageId':_0x1b2619['messageId']}});}break;case _0x3c43('0x8b'):if(_0x5a2529['body'][_0x3c43('0x7d')]&&_0x5a2529[_0x3c43('0x58')]['status']){_0x10d0f2=_0x5a2529[_0x3c43('0x58')][_0x3c43('0x29')];return db[_0x3c43('0xa2')][_0x3c43('0x56')]({'where':{'messageId':_0x5a2529[_0x3c43('0x58')][_0x3c43('0x7d')]}});}break;case _0x3c43('0xcc'):if(_0x5a2529['body'][0x0][_0x3c43('0x25')]['id']){_0x10d0f2=_0x5a2529['body'][0x0]['type'];return db[_0x3c43('0xa2')][_0x3c43('0x56')]({'where':{'messageId':_0x5a2529[_0x3c43('0x58')][0x0][_0x3c43('0x25')]['id']}});}break;case _0x3c43('0x8d'):if(_0x5a2529[_0x3c43('0x58')]['redif']&&_0x5a2529[_0x3c43('0x58')][_0x3c43('0x29')]){_0x10d0f2=_0x5a2529[_0x3c43('0x58')][_0x3c43('0x29')];return db[_0x3c43('0xa2')][_0x3c43('0x56')]({'where':{'messageId':_0x5a2529[_0x3c43('0x58')][_0x3c43('0xcd')]}});}break;}}})['then'](handleEntityNotFound(_0x49102e,null))[_0x3c43('0x1d')](function(_0x567c5b){if(_0x567c5b){_0x366cf6=_0x567c5b;switch(_0x2141b6[_0x3c43('0x50')]){case _0x3c43('0xc5'):if(_0x10d0f2==='DELIVERED'){return _0x366cf6[_0x3c43('0x32')]({'read':!![]});}else{logger[_0x3c43('0x23')](_0x3c43('0x22'),_0x3c43('0x29'),_0x3c43('0xc5'),util[_0x3c43('0xc4')](_0x5a2529[_0x3c43('0x58')],{'showHidden':![],'depth':null}));}break;case _0x3c43('0x80'):if(_0x10d0f2==='1'){return _0x366cf6['update']({'read':!![]});}else{logger[_0x3c43('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3c43('0x29'),_0x3c43('0xc5'),util[_0x3c43('0xc4')](_0x5a2529['body'],{'showHidden':![],'depth':null}));}break;case _0x3c43('0x82'):if(!_0x5a2529[_0x3c43('0x58')]['error_code']&&_0x10d0f2>=0xc8&&_0x10d0f2<=0xce){return _0x366cf6['update']({'read':!![]});}else{logger[_0x3c43('0x23')](_0x3c43('0x22'),'status','clicksend',util[_0x3c43('0xc4')](_0x5a2529['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x4bb59a=_0x5a2529[_0x3c43('0x58')][_0x3c43('0x87')][0x0];if(_0x4bb59a[_0x3c43('0x29')]['groupName']==='DELIVERED'){return _0x366cf6[_0x3c43('0x32')]({'read':!![]});}else{logger['error'](_0x3c43('0x22'),_0x3c43('0x29'),_0x3c43('0x86'),util[_0x3c43('0xc4')](_0x5a2529['body'],{'showHidden':![],'depth':null}));}break;case _0x3c43('0x8b'):if(_0x10d0f2==_0x3c43('0xce')||_0x10d0f2==_0x3c43('0xcf')){return _0x366cf6[_0x3c43('0x32')]({'read':!![]});}else{logger[_0x3c43('0x23')](_0x3c43('0x22'),_0x3c43('0x29'),_0x3c43('0x8b'),util['inspect'](_0x5a2529[_0x3c43('0x58')],{'showHidden':![],'depth':null}));}break;case _0x3c43('0xcc'):if(_0x10d0f2=='message-delivered'){return _0x366cf6[_0x3c43('0x32')]({'read':!![]});}else{logger[_0x3c43('0x23')](_0x3c43('0x22'),'status',_0x3c43('0xcc'),util['inspect'](_0x5a2529[_0x3c43('0x58')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x10d0f2===_0x3c43('0xd0')||_0x10d0f2===_0x3c43('0xd1')){return _0x366cf6[_0x3c43('0x32')]({'read':!![]});}else{logger[_0x3c43('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x3c43('0x8d'),util['inspect'](_0x5a2529[_0x3c43('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x366cf6;}})[_0x3c43('0x1d')](respondWithResult(_0x49102e,null))[_0x3c43('0x27')](handleError(_0x49102e,null));};exports[_0x3c43('0xd2')]=function(_0x565b0d,_0x512496,_0x5d7ec3){var _0x1d18bd,_0x5e87c3,_0x27c108;return db[_0x3c43('0x3c')][_0x3c43('0x56')]({'where':{'id':_0x565b0d[_0x3c43('0x5d')]['id']}})[_0x3c43('0x1d')](handleEntityNotFound(_0x512496,null))[_0x3c43('0x1d')](function(_0x2c0fd2){if(_0x2c0fd2){_0x27c108=_0x2c0fd2;logger[_0x3c43('0x21')](_0x3c43('0x22'),_0x3c43('0x29'),_0x3c43('0xd3'),_0x2c0fd2[_0x3c43('0x50')],util[_0x3c43('0xc4')](_0x565b0d[_0x3c43('0x41')],{'showHidden':![],'depth':null}));switch(_0x2c0fd2[_0x3c43('0x50')]){case _0x3c43('0x88'):if(_0x565b0d[_0x3c43('0x41')]['message-id']&&_0x565b0d[_0x3c43('0x41')][_0x3c43('0xd4')]){_0x5e87c3=_0x565b0d[_0x3c43('0x41')][_0x3c43('0xd4')];return db['SmsMessage'][_0x3c43('0x56')]({'where':{'messageId':_0x565b0d[_0x3c43('0x41')][_0x3c43('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x512496,null))[_0x3c43('0x1d')](function(_0x2f65c6){if(_0x2f65c6){_0x1d18bd=_0x2f65c6;switch(_0x27c108['type']){case _0x3c43('0x88'):if(_0x5e87c3==='2'||_0x5e87c3==='6'){return _0x1d18bd[_0x3c43('0x32')]({'read':!![]});}else{logger['error'](_0x3c43('0x22'),'status',_0x3c43('0x88'),util['inspect'](_0x565b0d[_0x3c43('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x1d18bd;}})[_0x3c43('0x1d')](respondWithResult(_0x512496,null))[_0x3c43('0x27')](handleError(_0x512496,null));};exports['addAgents']=function(_0x524c87,_0x4afee6,_0x46666f){return db[_0x3c43('0x3c')][_0x3c43('0x56')]({'where':{'id':_0x524c87[_0x3c43('0x5d')]['id']}})[_0x3c43('0x1d')](handleEntityNotFound(_0x4afee6,null))[_0x3c43('0x1d')](function(_0x389a6d){if(_0x389a6d){return _0x389a6d[_0x3c43('0xd6')](_0x524c87[_0x3c43('0x58')][_0x3c43('0x66')],_[_0x3c43('0x99')](_0x524c87[_0x3c43('0x58')],[_0x3c43('0x66'),'id'])||{})['spread'](function(_0x438131){for(var _0x542455=0x0;_0x542455<_0x524c87[_0x3c43('0x58')][_0x3c43('0x66')][_0x3c43('0x47')];_0x542455+=0x1){socket[_0x3c43('0xd7')](_0x3c43('0xd8'),{'UserId':Number(_0x524c87['body'][_0x3c43('0x66')][_0x542455]),'SmsAccountId':Number(_0x524c87['params']['id'])});}return _0x438131;});}})['then'](respondWithResult(_0x4afee6,null))['catch'](handleError(_0x4afee6,null));};exports[_0x3c43('0xd9')]=function(_0x2c76e8,_0x531dfb,_0x7795a){return db[_0x3c43('0x3c')]['find']({'where':{'id':_0x2c76e8[_0x3c43('0x5d')]['id']}})[_0x3c43('0x1d')](handleEntityNotFound(_0x531dfb,null))[_0x3c43('0x1d')](function(_0x21fd19){if(_0x21fd19){return _0x21fd19[_0x3c43('0xd9')](_0x2c76e8[_0x3c43('0x41')]['ids'])[_0x3c43('0x1d')](function(){if(_['isArray'](_0x2c76e8[_0x3c43('0x41')]['ids'])){for(var _0x1ca726=0x0;_0x1ca726<_0x2c76e8[_0x3c43('0x41')][_0x3c43('0x66')]['length'];_0x1ca726+=0x1){socket[_0x3c43('0xd7')]('userSmsAccount:remove',{'UserId':Number(_0x2c76e8[_0x3c43('0x41')][_0x3c43('0x66')][_0x1ca726]),'SmsAccountId':Number(_0x2c76e8['params']['id'])});}}else{socket[_0x3c43('0xd7')](_0x3c43('0xda'),{'UserId':Number(_0x2c76e8[_0x3c43('0x41')]['ids']),'SmsAccountId':Number(_0x2c76e8[_0x3c43('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x531dfb,null))[_0x3c43('0x27')](handleError(_0x531dfb,null));};exports['getAgents']=function(_0x3ca541,_0x4833cf,_0x3bc1d4){var _0x10ddec={};var _0x477e8c={};var _0x57679f;var _0x34602f;return db[_0x3c43('0x3c')]['findOne']({'where':{'id':_0x3ca541[_0x3c43('0x5d')]['id']}})[_0x3c43('0x1d')](handleEntityNotFound(_0x4833cf,null))['then'](function(_0x444339){if(_0x444339){_0x57679f=_0x444339;_0x477e8c[_0x3c43('0x40')]=_[_0x3c43('0x42')](db[_0x3c43('0xa3')]['rawAttributes']);_0x477e8c[_0x3c43('0x41')]=_['keys'](_0x3ca541[_0x3c43('0x41')]);_0x477e8c[_0x3c43('0x43')]=_[_0x3c43('0x44')](_0x477e8c[_0x3c43('0x40')],_0x477e8c[_0x3c43('0x41')]);_0x10ddec['attributes']=_[_0x3c43('0x44')](_0x477e8c[_0x3c43('0x40')],qs[_0x3c43('0x45')](_0x3ca541[_0x3c43('0x41')][_0x3c43('0x45')]));_0x10ddec[_0x3c43('0x46')]=_0x10ddec[_0x3c43('0x46')]['length']?_0x10ddec['attributes']:_0x477e8c[_0x3c43('0x40')];_0x10ddec[_0x3c43('0x4a')]=qs[_0x3c43('0x4b')](_0x3ca541[_0x3c43('0x41')][_0x3c43('0x4b')]);_0x10ddec[_0x3c43('0x4c')]=qs[_0x3c43('0x43')](_[_0x3c43('0x4d')](_0x3ca541[_0x3c43('0x41')],_0x477e8c['filters']));if(_0x3ca541[_0x3c43('0x41')]['filter']){_0x10ddec[_0x3c43('0x4c')]=_[_0x3c43('0x4f')](_0x10ddec['where'],{'$or':_[_0x3c43('0x3b')](_0x10ddec[_0x3c43('0x46')],function(_0x415fb3){var _0x8b2c84={};_0x8b2c84[_0x415fb3]={'$like':'%'+_0x3ca541[_0x3c43('0x41')]['filter']+'%'};return _0x8b2c84;})});}_0x10ddec=_[_0x3c43('0x4f')]({},_0x10ddec,_0x3ca541[_0x3c43('0x51')]);return _0x57679f[_0x3c43('0xdb')](_0x10ddec);}})['then'](function(_0x31ca0e){if(_0x31ca0e){_0x34602f=_0x31ca0e[_0x3c43('0x47')];if(!_0x3ca541[_0x3c43('0x41')]['hasOwnProperty']('nolimit')){_0x10ddec[_0x3c43('0x2c')]=qs[_0x3c43('0x2c')](_0x3ca541[_0x3c43('0x41')][_0x3c43('0x2c')]);_0x10ddec['offset']=qs[_0x3c43('0x2b')](_0x3ca541['query'][_0x3c43('0x2b')]);}return _0x57679f[_0x3c43('0xdb')](_0x10ddec);}})[_0x3c43('0x1d')](function(_0x5eca74){if(_0x5eca74){return _0x5eca74?{'count':_0x34602f,'rows':_0x5eca74}:null;}})[_0x3c43('0x1d')](respondWithResult(_0x4833cf,null))['catch'](handleError(_0x4833cf,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 5ef8647..019c947 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 _0x29e9=['../../mysqldb','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x23fdb9,_0x30002e){var _0x4144bf=function(_0x1deb8d){while(--_0x1deb8d){_0x23fdb9['push'](_0x23fdb9['shift']());}};_0x4144bf(++_0x30002e);}(_0x29e9,0xaf));var _0x929e=function(_0x564ac8,_0x2972f1){_0x564ac8=_0x564ac8-0x0;var _0x11d63e=_0x29e9[_0x564ac8];return _0x11d63e;};'use strict';var EventEmitter=require(_0x929e('0x0'));var SmsAccount=require(_0x929e('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x929e('0x2')](0x0);var events={'afterCreate':_0x929e('0x3'),'afterUpdate':_0x929e('0x4'),'afterDestroy':_0x929e('0x5')};function emitEvent(_0x312d29){return function(_0x4d7efa,_0x93431a,_0x2596f0){SmsAccountEvents[_0x929e('0x6')](_0x312d29+':'+_0x4d7efa['id'],_0x4d7efa);SmsAccountEvents[_0x929e('0x6')](_0x312d29,_0x4d7efa);_0x2596f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x929e('0x7')]=SmsAccountEvents; \ No newline at end of file +var _0x3998=['emit','hasOwnProperty','hook','events','setMaxListeners','update'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x3998,0x183));var _0x8399=function(_0x457a7a,_0x49d9b1){_0x457a7a=_0x457a7a-0x0;var _0x532478=_0x3998[_0x457a7a];return _0x532478;};'use strict';var EventEmitter=require(_0x8399('0x0'));var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8399('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8399('0x2'),'afterDestroy':'remove'};function emitEvent(_0x4cf78f){return function(_0x544c79,_0x262a2e,_0x38783b){SmsAccountEvents[_0x8399('0x3')](_0x4cf78f+':'+_0x544c79['id'],_0x544c79);SmsAccountEvents[_0x8399('0x3')](_0x4cf78f,_0x544c79);_0x38783b(null);};}for(var e in events){if(events[_0x8399('0x4')](e)){var event=events[e];SmsAccount[_0x8399('0x5')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index fca7c81..efa4083 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 _0xe59f=['exports','define','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./smsAccount.attributes'];(function(_0x158f75,_0x486108){var _0x201e02=function(_0x3a67da){while(--_0x3a67da){_0x158f75['push'](_0x158f75['shift']());}};_0x201e02(++_0x486108);}(_0xe59f,0x1a4));var _0xfe59=function(_0x747395,_0x5d4b37){_0x747395=_0x747395-0x0;var _0x2b5206=_0xe59f[_0x747395];return _0x2b5206;};'use strict';var _=require(_0xfe59('0x0'));var util=require(_0xfe59('0x1'));var logger=require(_0xfe59('0x2'))(_0xfe59('0x3'));var moment=require('moment');var BPromise=require(_0xfe59('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe59('0x5'));var rimraf=require(_0xfe59('0x6'));var config=require(_0xfe59('0x7'));var attributes=require(_0xfe59('0x8'));module[_0xfe59('0x9')]=function(_0x46f691,_0x40a438){return _0x46f691[_0xfe59('0xa')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b31=['lodash','util','moment','path','rimraf','../../config/environment','exports','define','SmsAccount','sms_accounts'];(function(_0x514764,_0x122ae2){var _0x28f7fd=function(_0xbdf22e){while(--_0xbdf22e){_0x514764['push'](_0x514764['shift']());}};_0x28f7fd(++_0x122ae2);}(_0x3b31,0x64));var _0x13b3=function(_0x21f133,_0x2fc85f){_0x21f133=_0x21f133-0x0;var _0x95433a=_0x3b31[_0x21f133];return _0x95433a;};'use strict';var _=require(_0x13b3('0x0'));var util=require(_0x13b3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x13b3('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x13b3('0x3'));var rimraf=require(_0x13b3('0x4'));var config=require(_0x13b3('0x5'));var attributes=require('./smsAccount.attributes');module[_0x13b3('0x6')]=function(_0x504d3e,_0x4abfc6){return _0x504d3e[_0x13b3('0x7')](_0x13b3('0x8'),attributes,{'tableName':_0x13b3('0x9'),'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 01ede5c..f1b6fb4 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 _0xa472=['redis','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsAccount','find','options','raw','where','attributes','include','map','model','ShowSmsAccount','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x542837,_0x1db83e){var _0x4503fb=function(_0x5bf73d){while(--_0x5bf73d){_0x542837['push'](_0x542837['shift']());}};_0x4503fb(++_0x1db83e);}(_0xa472,0x6a));var _0x2a47=function(_0x581a89,_0x8f087c){_0x581a89=_0x581a89-0x0;var _0xf5ee99=_0xa472[_0x581a89];return _0xf5ee99;};'use strict';var _=require(_0x2a47('0x0'));var util=require('util');var moment=require(_0x2a47('0x1'));var BPromise=require(_0x2a47('0x2'));var rs=require(_0x2a47('0x3'));var fs=require('fs');var Redis=require(_0x2a47('0x4'));var db=require(_0x2a47('0x5'))['db'];var utils=require(_0x2a47('0x6'));var logger=require(_0x2a47('0x7'))(_0x2a47('0x8'));var config=require(_0x2a47('0x9'));var jayson=require(_0x2a47('0xa'));var client=jayson[_0x2a47('0xb')][_0x2a47('0xc')]({'port':0x232a});config['redis']=_[_0x2a47('0xd')](config[_0x2a47('0xe')],{'host':_0x2a47('0xf'),'port':0x18eb});var socket=require(_0x2a47('0x10'))(new Redis(config[_0x2a47('0xe')]));require(_0x2a47('0x11'))['register'](socket);function respondWithRpcPromise(_0x3e33bd,_0x49367f,_0x58a27d){return new BPromise(function(_0x335b07,_0x4d7630){return client[_0x2a47('0x12')](_0x3e33bd,_0x58a27d)[_0x2a47('0x13')](function(_0x34c67f){logger[_0x2a47('0x14')](_0x2a47('0x15'),_0x49367f,_0x2a47('0x16'));logger[_0x2a47('0x17')](_0x2a47('0x18'),_0x49367f,_0x2a47('0x16'),JSON[_0x2a47('0x19')](_0x34c67f));if(_0x34c67f['error']){if(_0x34c67f[_0x2a47('0x1a')][_0x2a47('0x1b')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x49367f,_0x34c67f[_0x2a47('0x1a')]['message']);return _0x4d7630(_0x34c67f[_0x2a47('0x1a')][_0x2a47('0x1c')]);}logger[_0x2a47('0x1a')](_0x2a47('0x15'),_0x49367f,_0x34c67f['error'][_0x2a47('0x1c')]);return _0x335b07(_0x34c67f['error'][_0x2a47('0x1c')]);}else{logger[_0x2a47('0x14')](_0x2a47('0x15'),_0x49367f,_0x2a47('0x16'));_0x335b07(_0x34c67f['result']['message']);}})['catch'](function(_0x41c793){logger[_0x2a47('0x1a')](_0x2a47('0x15'),_0x49367f,_0x41c793);_0x4d7630(_0x41c793);});});}exports['ShowSmsAccount']=function(_0x4a494a){var _0x13b586=this;return new Promise(function(_0x1a64e6,_0x17a970){return db[_0x2a47('0x1d')][_0x2a47('0x1e')]({'raw':_0x4a494a[_0x2a47('0x1f')]?_0x4a494a[_0x2a47('0x1f')][_0x2a47('0x20')]===undefined?!![]:![]:!![],'where':_0x4a494a[_0x2a47('0x1f')]?_0x4a494a[_0x2a47('0x1f')][_0x2a47('0x21')]||null:null,'attributes':_0x4a494a[_0x2a47('0x1f')]?_0x4a494a[_0x2a47('0x1f')][_0x2a47('0x22')]||null:null,'include':_0x4a494a['options']?_0x4a494a[_0x2a47('0x1f')][_0x2a47('0x23')]?_['map'](_0x4a494a[_0x2a47('0x1f')][_0x2a47('0x23')],function(_0x3850ce){return{'model':db[_0x3850ce['model']],'as':_0x3850ce['as'],'attributes':_0x3850ce[_0x2a47('0x22')],'include':_0x3850ce[_0x2a47('0x23')]?_[_0x2a47('0x24')](_0x3850ce[_0x2a47('0x23')],function(_0x1d4058){return{'model':db[_0x1d4058[_0x2a47('0x25')]],'as':_0x1d4058['as'],'attributes':_0x1d4058[_0x2a47('0x22')],'include':_0x1d4058[_0x2a47('0x23')]?_[_0x2a47('0x24')](_0x1d4058[_0x2a47('0x23')],function(_0xcb4a74){return{'model':db[_0xcb4a74[_0x2a47('0x25')]],'as':_0xcb4a74['as'],'attributes':_0xcb4a74[_0x2a47('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2a47('0x13')](function(_0x10d5cb){logger[_0x2a47('0x14')](_0x2a47('0x26'),_0x4a494a);logger[_0x2a47('0x17')](_0x2a47('0x26'),_0x4a494a,JSON[_0x2a47('0x19')](_0x10d5cb));_0x1a64e6(_0x10d5cb);})[_0x2a47('0x27')](function(_0x450811){logger['error'](_0x2a47('0x26'),_0x450811[_0x2a47('0x1c')],_0x4a494a);_0x17a970(_0x13b586[_0x2a47('0x1a')](0x1f4,_0x450811[_0x2a47('0x1c')]));});});}; \ No newline at end of file +var _0x05fa=['SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SmsAccount','options','raw','where','attributes','include','model','ShowSmsAccount','debug','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x5cbec6,_0x5f2354){var _0x50e735=function(_0x51910c){while(--_0x51910c){_0x5cbec6['push'](_0x5cbec6['shift']());}};_0x50e735(++_0x5f2354);}(_0x05fa,0x186));var _0xa05f=function(_0x1ca4fc,_0x292296){_0x1ca4fc=_0x1ca4fc-0x0;var _0x159709=_0x05fa[_0x1ca4fc];return _0x159709;};'use strict';var _=require(_0xa05f('0x0'));var util=require('util');var moment=require(_0xa05f('0x1'));var BPromise=require(_0xa05f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa05f('0x3'));var db=require(_0xa05f('0x4'))['db'];var utils=require(_0xa05f('0x5'));var logger=require('../../config/logger')(_0xa05f('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa05f('0x7')]({'port':0x232a});config[_0xa05f('0x8')]=_[_0xa05f('0x9')](config['redis'],{'host':_0xa05f('0xa'),'port':0x18eb});var socket=require(_0xa05f('0xb'))(new Redis(config['redis']));require(_0xa05f('0xc'))['register'](socket);function respondWithRpcPromise(_0x213b9d,_0x585cdc,_0x417b0c){return new BPromise(function(_0x291805,_0x3259c3){return client[_0xa05f('0xd')](_0x213b9d,_0x417b0c)[_0xa05f('0xe')](function(_0xba395f){logger[_0xa05f('0xf')](_0xa05f('0x10'),_0x585cdc,_0xa05f('0x11'));logger['debug'](_0xa05f('0x12'),_0x585cdc,_0xa05f('0x11'),JSON[_0xa05f('0x13')](_0xba395f));if(_0xba395f[_0xa05f('0x14')]){if(_0xba395f[_0xa05f('0x14')][_0xa05f('0x15')]===0x1f4){logger[_0xa05f('0x14')](_0xa05f('0x10'),_0x585cdc,_0xba395f[_0xa05f('0x14')]['message']);return _0x3259c3(_0xba395f['error']['message']);}logger[_0xa05f('0x14')]('SmsAccount,\x20%s,\x20%s',_0x585cdc,_0xba395f[_0xa05f('0x14')]['message']);return _0x291805(_0xba395f[_0xa05f('0x14')][_0xa05f('0x16')]);}else{logger[_0xa05f('0xf')]('SmsAccount,\x20%s,\x20%s',_0x585cdc,_0xa05f('0x11'));_0x291805(_0xba395f[_0xa05f('0x17')]['message']);}})[_0xa05f('0x18')](function(_0x2a7088){logger[_0xa05f('0x14')]('SmsAccount,\x20%s,\x20%s',_0x585cdc,_0x2a7088);_0x3259c3(_0x2a7088);});});}exports['ShowSmsAccount']=function(_0x5896e4){var _0x65019f=this;return new Promise(function(_0x50fa4b,_0x48ee93){return db[_0xa05f('0x19')]['find']({'raw':_0x5896e4['options']?_0x5896e4[_0xa05f('0x1a')][_0xa05f('0x1b')]===undefined?!![]:![]:!![],'where':_0x5896e4[_0xa05f('0x1a')]?_0x5896e4[_0xa05f('0x1a')][_0xa05f('0x1c')]||null:null,'attributes':_0x5896e4[_0xa05f('0x1a')]?_0x5896e4[_0xa05f('0x1a')][_0xa05f('0x1d')]||null:null,'include':_0x5896e4[_0xa05f('0x1a')]?_0x5896e4[_0xa05f('0x1a')][_0xa05f('0x1e')]?_['map'](_0x5896e4[_0xa05f('0x1a')]['include'],function(_0x5502ed){return{'model':db[_0x5502ed[_0xa05f('0x1f')]],'as':_0x5502ed['as'],'attributes':_0x5502ed[_0xa05f('0x1d')],'include':_0x5502ed['include']?_['map'](_0x5502ed[_0xa05f('0x1e')],function(_0x5202a4){return{'model':db[_0x5202a4[_0xa05f('0x1f')]],'as':_0x5202a4['as'],'attributes':_0x5202a4['attributes'],'include':_0x5202a4[_0xa05f('0x1e')]?_['map'](_0x5202a4[_0xa05f('0x1e')],function(_0x1124a3){return{'model':db[_0x1124a3[_0xa05f('0x1f')]],'as':_0x1124a3['as'],'attributes':_0x1124a3['attributes']};}):[]};}):[]};}):[]:[]})[_0xa05f('0xe')](function(_0x7c60ff){logger[_0xa05f('0xf')](_0xa05f('0x20'),_0x5896e4);logger[_0xa05f('0x21')](_0xa05f('0x20'),_0x5896e4,JSON[_0xa05f('0x13')](_0x7c60ff));_0x50fa4b(_0x7c60ff);})[_0xa05f('0x18')](function(_0x377930){logger[_0xa05f('0x14')](_0xa05f('0x20'),_0x377930[_0xa05f('0x16')],_0x5896e4);_0x48ee93(_0x65019f[_0xa05f('0x14')](0x1f4,_0x377930[_0xa05f('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 626140b..00ae063 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 106b4b6..2da6023 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 _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5a7607,_0xc2687b){var _0x195ad1=function(_0x57dcf5){while(--_0x57dcf5){_0x5a7607['push'](_0x5a7607['shift']());}};_0x195ad1(++_0xc2687b);}(_0xedd9,0xfc));var _0x9edd=function(_0x20729b,_0xc75321){_0x20729b=_0x20729b-0x0;var _0x5ea823=_0xedd9[_0x20729b];return _0x5ea823;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index eeba5cb..ef7cd02 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 _0x3f92=['STRING','noop','TEXT','exports','INTEGER'];(function(_0x2cc0b3,_0x120bf1){var _0x1667ef=function(_0x3abcb4){while(--_0x3abcb4){_0x2cc0b3['push'](_0x2cc0b3['shift']());}};_0x1667ef(++_0x120bf1);}(_0x3f92,0x1bb));var _0x23f9=function(_0x100c9c,_0x2183f3){_0x100c9c=_0x100c9c-0x0;var _0x566727=_0x3f92[_0x100c9c];return _0x566727;};'use strict';var Sequelize=require('sequelize');module[_0x23f9('0x0')]={'priority':{'type':Sequelize[_0x23f9('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x23f9('0x2')],'allowNull':![],'defaultValue':_0x23f9('0x3')},'appdata':{'type':Sequelize[_0x23f9('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x23f9('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xcb28=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xcb28,0xda));var _0x8cb2=function(_0x3050ca,_0x3e36b0){_0x3050ca=_0x3050ca-0x0;var _0x1eed1d=_0xcb28[_0x3050ca];return _0x1eed1d;};'use strict';var Sequelize=require(_0x8cb2('0x0'));module[_0x8cb2('0x1')]={'priority':{'type':Sequelize[_0x8cb2('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8cb2('0x3')],'allowNull':![],'defaultValue':_0x8cb2('0x4')},'appdata':{'type':Sequelize[_0x8cb2('0x5')]()},'description':{'type':Sequelize[_0x8cb2('0x3')]},'interval':{'type':Sequelize[_0x8cb2('0x3')],'defaultValue':_0x8cb2('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 3bafea8..1a03f82 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 _0x5096=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','save','update','then','destroy','stack','name','index','SmsApplication','rawAttributes','fieldName','type','map','query','keys','filters','intersection','attributes','model','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','fields','includeAll','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x4cb05a,_0x598bc8){var _0x196217=function(_0x13d609){while(--_0x13d609){_0x4cb05a['push'](_0x4cb05a['shift']());}};_0x196217(++_0x598bc8);}(_0x5096,0x1e6));var _0x6509=function(_0x441eab,_0x583ba5){_0x441eab=_0x441eab-0x0;var _0xe6ff41=_0x5096[_0x441eab];return _0xe6ff41;};'use strict';var emlformat=require(_0x6509('0x0'));var rimraf=require(_0x6509('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6509('0x2'));var rp=require(_0x6509('0x3'));var moment=require(_0x6509('0x4'));var BPromise=require(_0x6509('0x5'));var Mustache=require(_0x6509('0x6'));var util=require(_0x6509('0x7'));var path=require(_0x6509('0x8'));var sox=require(_0x6509('0x9'));var csv=require(_0x6509('0xa'));var ejs=require(_0x6509('0xb'));var fs=require('fs');var fs_extra=require(_0x6509('0xc'));var _=require(_0x6509('0xd'));var squel=require(_0x6509('0xe'));var crypto=require(_0x6509('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x6509('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6509('0x11'));var Papa=require(_0x6509('0x12'));var Redis=require(_0x6509('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x6509('0x14'));var as=require(_0x6509('0x15'));var hardwareService=require(_0x6509('0x16'));var logger=require(_0x6509('0x17'))(_0x6509('0x18'));var utils=require(_0x6509('0x19'));var config=require(_0x6509('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x6509('0x1b'))['db'];function respondWithStatusCode(_0x5642e3,_0xf9b61f){_0xf9b61f=_0xf9b61f||0xcc;return function(_0x4c36d7){if(_0x4c36d7){return _0x5642e3[_0x6509('0x1c')](_0xf9b61f);}return _0x5642e3[_0x6509('0x1d')](_0xf9b61f)['end']();};}function respondWithResult(_0x549974,_0x4f6030){_0x4f6030=_0x4f6030||0xc8;return function(_0x989d63){if(_0x989d63){return _0x549974['status'](_0x4f6030)[_0x6509('0x1e')](_0x989d63);}};}function respondWithFilteredResult(_0x456d92,_0x17db58){return function(_0x4e7a6a){if(_0x4e7a6a){var _0x3367a9=typeof _0x17db58['offset']===_0x6509('0x1f')&&typeof _0x17db58[_0x6509('0x20')]===_0x6509('0x1f');var _0x125288=_0x4e7a6a[_0x6509('0x21')];var _0x5cba54=_0x3367a9?0x0:_0x17db58[_0x6509('0x22')];var _0x13d185=_0x3367a9?_0x4e7a6a[_0x6509('0x21')]:_0x17db58[_0x6509('0x22')]+_0x17db58[_0x6509('0x20')];var _0x406936;if(_0x13d185>=_0x125288){_0x13d185=_0x125288;_0x406936=0xc8;}else{_0x406936=0xce;}_0x456d92[_0x6509('0x1d')](_0x406936);return _0x456d92['set']('Content-Range',_0x5cba54+'-'+_0x13d185+'/'+_0x125288)[_0x6509('0x1e')](_0x4e7a6a);}return null;};}function patchUpdates(_0x47f812){return function(_0x2a9863){try{jsonpatch['apply'](_0x2a9863,_0x47f812,!![]);}catch(_0x83e0){return BPromise['reject'](_0x83e0);}return _0x2a9863[_0x6509('0x23')]();};}function saveUpdates(_0x2a6eb1,_0x487e8a){return function(_0xe6c9c5){if(_0xe6c9c5){return _0xe6c9c5[_0x6509('0x24')](_0x2a6eb1)[_0x6509('0x25')](function(_0x572593){return _0x572593;});}return null;};}function removeEntity(_0xa232ac,_0x282a89){return function(_0x5473e5){if(_0x5473e5){return _0x5473e5[_0x6509('0x26')]()[_0x6509('0x25')](function(){_0xa232ac['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2eb767,_0x35ce42){return function(_0x671a72){if(!_0x671a72){_0x2eb767[_0x6509('0x1c')](0x194);}return _0x671a72;};}function handleError(_0x39ebcf,_0x52bd22){_0x52bd22=_0x52bd22||0x1f4;return function(_0x14787e){logger['error'](_0x14787e[_0x6509('0x27')]);if(_0x14787e[_0x6509('0x28')]){delete _0x14787e['name'];}_0x39ebcf['status'](_0x52bd22)['send'](_0x14787e);};}exports[_0x6509('0x29')]=function(_0x1a0ccc,_0x86e042){var _0x355834={},_0x3ec47b={},_0x568f31={'count':0x0,'rows':[]};var _0x3bbf5a=_['map'](db[_0x6509('0x2a')][_0x6509('0x2b')],function(_0x36ee7a){return{'name':_0x36ee7a[_0x6509('0x2c')],'type':_0x36ee7a[_0x6509('0x2d')]['key']};});_0x3ec47b['model']=_[_0x6509('0x2e')](_0x3bbf5a,_0x6509('0x28'));_0x3ec47b[_0x6509('0x2f')]=_[_0x6509('0x30')](_0x1a0ccc[_0x6509('0x2f')]);_0x3ec47b[_0x6509('0x31')]=_[_0x6509('0x32')](_0x3ec47b['model'],_0x3ec47b['query']);_0x355834[_0x6509('0x33')]=_[_0x6509('0x32')](_0x3ec47b[_0x6509('0x34')],qs['fields'](_0x1a0ccc[_0x6509('0x2f')]['fields']));_0x355834[_0x6509('0x33')]=_0x355834['attributes'][_0x6509('0x35')]?_0x355834[_0x6509('0x33')]:_0x3ec47b['model'];if(!_0x1a0ccc['query'][_0x6509('0x36')](_0x6509('0x37'))){_0x355834['limit']=qs[_0x6509('0x20')](_0x1a0ccc[_0x6509('0x2f')][_0x6509('0x20')]);_0x355834[_0x6509('0x22')]=qs[_0x6509('0x22')](_0x1a0ccc[_0x6509('0x2f')]['offset']);}_0x355834['order']=qs[_0x6509('0x38')](_0x1a0ccc['query'][_0x6509('0x38')]);_0x355834[_0x6509('0x39')]=qs[_0x6509('0x31')](_[_0x6509('0x3a')](_0x1a0ccc[_0x6509('0x2f')],_0x3ec47b[_0x6509('0x31')]),_0x3bbf5a);if(_0x1a0ccc[_0x6509('0x2f')][_0x6509('0x3b')]){_0x355834[_0x6509('0x39')]=_[_0x6509('0x3c')](_0x355834['where'],{'$or':_[_0x6509('0x2e')](_0x3bbf5a,function(_0x360f6f){if(_0x360f6f[_0x6509('0x2d')]!==_0x6509('0x3d')){var _0x9cb89={};_0x9cb89[_0x360f6f[_0x6509('0x28')]]={'$like':'%'+_0x1a0ccc['query']['filter']+'%'};return _0x9cb89;}})});}_0x355834=_['merge']({},_0x355834,_0x1a0ccc[_0x6509('0x3e')]);var _0x566886={'where':_0x355834['where']};return db[_0x6509('0x2a')][_0x6509('0x21')](_0x566886)[_0x6509('0x25')](function(_0x16b3b2){_0x568f31[_0x6509('0x21')]=_0x16b3b2;if(_0x1a0ccc[_0x6509('0x2f')]['includeAll']){_0x355834[_0x6509('0x3f')]=[{'all':!![]}];}return db['SmsApplication']['findAll'](_0x355834);})[_0x6509('0x25')](function(_0x38f4b3){_0x568f31[_0x6509('0x40')]=_0x38f4b3;return _0x568f31;})['then'](respondWithFilteredResult(_0x86e042,_0x355834))['catch'](handleError(_0x86e042,null));};exports[_0x6509('0x41')]=function(_0x448670,_0x35bcd9){var _0x3a9ecc={'raw':!![],'where':{'id':_0x448670['params']['id']}},_0x56e0b9={};_0x56e0b9['model']=_['keys'](db[_0x6509('0x2a')][_0x6509('0x2b')]);_0x56e0b9[_0x6509('0x2f')]=_[_0x6509('0x30')](_0x448670[_0x6509('0x2f')]);_0x56e0b9['filters']=_[_0x6509('0x32')](_0x56e0b9[_0x6509('0x34')],_0x56e0b9[_0x6509('0x2f')]);_0x3a9ecc[_0x6509('0x33')]=_[_0x6509('0x32')](_0x56e0b9[_0x6509('0x34')],qs[_0x6509('0x42')](_0x448670[_0x6509('0x2f')][_0x6509('0x42')]));_0x3a9ecc[_0x6509('0x33')]=_0x3a9ecc[_0x6509('0x33')][_0x6509('0x35')]?_0x3a9ecc[_0x6509('0x33')]:_0x56e0b9['model'];if(_0x448670[_0x6509('0x2f')][_0x6509('0x43')]){_0x3a9ecc[_0x6509('0x3f')]=[{'all':!![]}];}_0x3a9ecc=_[_0x6509('0x3c')]({},_0x3a9ecc,_0x448670[_0x6509('0x3e')]);return db[_0x6509('0x2a')][_0x6509('0x44')](_0x3a9ecc)[_0x6509('0x25')](handleEntityNotFound(_0x35bcd9,null))[_0x6509('0x25')](respondWithResult(_0x35bcd9,null))[_0x6509('0x45')](handleError(_0x35bcd9,null));};exports['create']=function(_0x4d798f,_0xe03972){return db[_0x6509('0x2a')][_0x6509('0x46')](_0x4d798f[_0x6509('0x47')],{})[_0x6509('0x25')](respondWithResult(_0xe03972,0xc9))[_0x6509('0x45')](handleError(_0xe03972,null));};exports[_0x6509('0x24')]=function(_0x62aee2,_0x528365){if(_0x62aee2[_0x6509('0x47')]['id']){delete _0x62aee2[_0x6509('0x47')]['id'];}return db[_0x6509('0x2a')][_0x6509('0x44')]({'where':{'id':_0x62aee2[_0x6509('0x48')]['id']}})[_0x6509('0x25')](handleEntityNotFound(_0x528365,null))[_0x6509('0x25')](saveUpdates(_0x62aee2['body'],null))[_0x6509('0x25')](respondWithResult(_0x528365,null))[_0x6509('0x45')](handleError(_0x528365,null));};exports['destroy']=function(_0x5d2ec3,_0xea4f0b){return db[_0x6509('0x2a')]['find']({'where':{'id':_0x5d2ec3[_0x6509('0x48')]['id']}})['then'](handleEntityNotFound(_0xea4f0b,null))[_0x6509('0x25')](removeEntity(_0xea4f0b,null))['catch'](handleError(_0xea4f0b,null));}; \ No newline at end of file +var _0xf816=['json','undefined','limit','offset','count','reject','update','then','destroy','end','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','SmsApplication','includeAll','include','findAll','catch','show','params','keys','length','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0xf816,0xc1));var _0x6f81=function(_0xf056eb,_0x1fb33f){_0xf056eb=_0xf056eb-0x0;var _0x2f635e=_0xf816[_0xf056eb];return _0x2f635e;};'use strict';var emlformat=require(_0x6f81('0x0'));var rimraf=require(_0x6f81('0x1'));var zipdir=require(_0x6f81('0x2'));var jsonpatch=require(_0x6f81('0x3'));var rp=require('request-promise');var moment=require(_0x6f81('0x4'));var BPromise=require(_0x6f81('0x5'));var Mustache=require(_0x6f81('0x6'));var util=require(_0x6f81('0x7'));var path=require(_0x6f81('0x8'));var sox=require(_0x6f81('0x9'));var csv=require(_0x6f81('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6f81('0xb'));var _=require('lodash');var squel=require(_0x6f81('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6f81('0xd'));var toCsv=require(_0x6f81('0xa'));var querystring=require(_0x6f81('0xe'));var Papa=require(_0x6f81('0xf'));var Redis=require('ioredis');var authService=require(_0x6f81('0x10'));var qs=require(_0x6f81('0x11'));var as=require(_0x6f81('0x12'));var hardwareService=require(_0x6f81('0x13'));var logger=require(_0x6f81('0x14'))(_0x6f81('0x15'));var utils=require(_0x6f81('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6f81('0x17'));var db=require(_0x6f81('0x18'))['db'];function respondWithStatusCode(_0x3d90f9,_0x5ec7c5){_0x5ec7c5=_0x5ec7c5||0xcc;return function(_0x50eb8){if(_0x50eb8){return _0x3d90f9['sendStatus'](_0x5ec7c5);}return _0x3d90f9[_0x6f81('0x19')](_0x5ec7c5)['end']();};}function respondWithResult(_0x5a0ad5,_0x427648){_0x427648=_0x427648||0xc8;return function(_0x274303){if(_0x274303){return _0x5a0ad5[_0x6f81('0x19')](_0x427648)[_0x6f81('0x1a')](_0x274303);}};}function respondWithFilteredResult(_0x554f4a,_0x1de4bb){return function(_0x3d66fc){if(_0x3d66fc){var _0x49e554=typeof _0x1de4bb['offset']===_0x6f81('0x1b')&&typeof _0x1de4bb[_0x6f81('0x1c')]===_0x6f81('0x1b');var _0x46e762=_0x3d66fc['count'];var _0x1cd485=_0x49e554?0x0:_0x1de4bb[_0x6f81('0x1d')];var _0x1d0883=_0x49e554?_0x3d66fc[_0x6f81('0x1e')]:_0x1de4bb['offset']+_0x1de4bb[_0x6f81('0x1c')];var _0x37ec2b;if(_0x1d0883>=_0x46e762){_0x1d0883=_0x46e762;_0x37ec2b=0xc8;}else{_0x37ec2b=0xce;}_0x554f4a[_0x6f81('0x19')](_0x37ec2b);return _0x554f4a['set']('Content-Range',_0x1cd485+'-'+_0x1d0883+'/'+_0x46e762)[_0x6f81('0x1a')](_0x3d66fc);}return null;};}function patchUpdates(_0x406a97){return function(_0x425929){try{jsonpatch['apply'](_0x425929,_0x406a97,!![]);}catch(_0x251763){return BPromise[_0x6f81('0x1f')](_0x251763);}return _0x425929['save']();};}function saveUpdates(_0x35f522,_0xc0df4f){return function(_0x570731){if(_0x570731){return _0x570731[_0x6f81('0x20')](_0x35f522)[_0x6f81('0x21')](function(_0x439a81){return _0x439a81;});}return null;};}function removeEntity(_0x2cb9b8,_0x4471b5){return function(_0x50f312){if(_0x50f312){return _0x50f312[_0x6f81('0x22')]()[_0x6f81('0x21')](function(){_0x2cb9b8[_0x6f81('0x19')](0xcc)[_0x6f81('0x23')]();});}};}function handleEntityNotFound(_0xb16a4b,_0x5cf270){return function(_0x1a9ff1){if(!_0x1a9ff1){_0xb16a4b[_0x6f81('0x24')](0x194);}return _0x1a9ff1;};}function handleError(_0x165db2,_0x152d61){_0x152d61=_0x152d61||0x1f4;return function(_0x4b10be){logger[_0x6f81('0x25')](_0x4b10be[_0x6f81('0x26')]);if(_0x4b10be['name']){delete _0x4b10be[_0x6f81('0x27')];}_0x165db2[_0x6f81('0x19')](_0x152d61)['send'](_0x4b10be);};}exports[_0x6f81('0x28')]=function(_0x46bf66,_0x26e19a){var _0x304388={},_0x1cd810={},_0x429609={'count':0x0,'rows':[]};var _0x411025=_[_0x6f81('0x29')](db['SmsApplication'][_0x6f81('0x2a')],function(_0x5434fd){return{'name':_0x5434fd[_0x6f81('0x2b')],'type':_0x5434fd[_0x6f81('0x2c')][_0x6f81('0x2d')]};});_0x1cd810[_0x6f81('0x2e')]=_[_0x6f81('0x29')](_0x411025,_0x6f81('0x27'));_0x1cd810[_0x6f81('0x2f')]=_['keys'](_0x46bf66[_0x6f81('0x2f')]);_0x1cd810[_0x6f81('0x30')]=_['intersection'](_0x1cd810[_0x6f81('0x2e')],_0x1cd810['query']);_0x304388['attributes']=_[_0x6f81('0x31')](_0x1cd810[_0x6f81('0x2e')],qs['fields'](_0x46bf66[_0x6f81('0x2f')][_0x6f81('0x32')]));_0x304388[_0x6f81('0x33')]=_0x304388[_0x6f81('0x33')]['length']?_0x304388[_0x6f81('0x33')]:_0x1cd810[_0x6f81('0x2e')];if(!_0x46bf66[_0x6f81('0x2f')][_0x6f81('0x34')](_0x6f81('0x35'))){_0x304388[_0x6f81('0x1c')]=qs[_0x6f81('0x1c')](_0x46bf66[_0x6f81('0x2f')][_0x6f81('0x1c')]);_0x304388[_0x6f81('0x1d')]=qs[_0x6f81('0x1d')](_0x46bf66['query'][_0x6f81('0x1d')]);}_0x304388[_0x6f81('0x36')]=qs[_0x6f81('0x37')](_0x46bf66[_0x6f81('0x2f')][_0x6f81('0x37')]);_0x304388[_0x6f81('0x38')]=qs[_0x6f81('0x30')](_['pick'](_0x46bf66[_0x6f81('0x2f')],_0x1cd810[_0x6f81('0x30')]),_0x411025);if(_0x46bf66[_0x6f81('0x2f')][_0x6f81('0x39')]){_0x304388[_0x6f81('0x38')]=_[_0x6f81('0x3a')](_0x304388['where'],{'$or':_['map'](_0x411025,function(_0x3602ff){if(_0x3602ff[_0x6f81('0x2c')]!==_0x6f81('0x3b')){var _0x54d0e3={};_0x54d0e3[_0x3602ff['name']]={'$like':'%'+_0x46bf66[_0x6f81('0x2f')][_0x6f81('0x39')]+'%'};return _0x54d0e3;}})});}_0x304388=_[_0x6f81('0x3a')]({},_0x304388,_0x46bf66[_0x6f81('0x3c')]);var _0x587469={'where':_0x304388[_0x6f81('0x38')]};return db[_0x6f81('0x3d')][_0x6f81('0x1e')](_0x587469)[_0x6f81('0x21')](function(_0xed7304){_0x429609[_0x6f81('0x1e')]=_0xed7304;if(_0x46bf66[_0x6f81('0x2f')][_0x6f81('0x3e')]){_0x304388[_0x6f81('0x3f')]=[{'all':!![]}];}return db[_0x6f81('0x3d')][_0x6f81('0x40')](_0x304388);})[_0x6f81('0x21')](function(_0x477133){_0x429609['rows']=_0x477133;return _0x429609;})[_0x6f81('0x21')](respondWithFilteredResult(_0x26e19a,_0x304388))[_0x6f81('0x41')](handleError(_0x26e19a,null));};exports[_0x6f81('0x42')]=function(_0x5e251d,_0x3fe315){var _0x3f65c8={'raw':!![],'where':{'id':_0x5e251d[_0x6f81('0x43')]['id']}},_0x5bc40c={};_0x5bc40c[_0x6f81('0x2e')]=_['keys'](db[_0x6f81('0x3d')]['rawAttributes']);_0x5bc40c[_0x6f81('0x2f')]=_[_0x6f81('0x44')](_0x5e251d[_0x6f81('0x2f')]);_0x5bc40c[_0x6f81('0x30')]=_[_0x6f81('0x31')](_0x5bc40c[_0x6f81('0x2e')],_0x5bc40c['query']);_0x3f65c8[_0x6f81('0x33')]=_['intersection'](_0x5bc40c['model'],qs[_0x6f81('0x32')](_0x5e251d[_0x6f81('0x2f')][_0x6f81('0x32')]));_0x3f65c8['attributes']=_0x3f65c8[_0x6f81('0x33')][_0x6f81('0x45')]?_0x3f65c8[_0x6f81('0x33')]:_0x5bc40c[_0x6f81('0x2e')];if(_0x5e251d[_0x6f81('0x2f')][_0x6f81('0x3e')]){_0x3f65c8['include']=[{'all':!![]}];}_0x3f65c8=_['merge']({},_0x3f65c8,_0x5e251d[_0x6f81('0x3c')]);return db[_0x6f81('0x3d')]['find'](_0x3f65c8)[_0x6f81('0x21')](handleEntityNotFound(_0x3fe315,null))[_0x6f81('0x21')](respondWithResult(_0x3fe315,null))['catch'](handleError(_0x3fe315,null));};exports[_0x6f81('0x46')]=function(_0x3524a1,_0x24cb7c){return db[_0x6f81('0x3d')]['create'](_0x3524a1['body'],{})['then'](respondWithResult(_0x24cb7c,0xc9))[_0x6f81('0x41')](handleError(_0x24cb7c,null));};exports[_0x6f81('0x20')]=function(_0x4df3d7,_0x1a5f94){if(_0x4df3d7[_0x6f81('0x47')]['id']){delete _0x4df3d7[_0x6f81('0x47')]['id'];}return db[_0x6f81('0x3d')][_0x6f81('0x48')]({'where':{'id':_0x4df3d7[_0x6f81('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a5f94,null))[_0x6f81('0x21')](saveUpdates(_0x4df3d7['body'],null))[_0x6f81('0x21')](respondWithResult(_0x1a5f94,null))[_0x6f81('0x41')](handleError(_0x1a5f94,null));};exports[_0x6f81('0x22')]=function(_0x11fedc,_0x1ae29a){return db['SmsApplication'][_0x6f81('0x48')]({'where':{'id':_0x11fedc[_0x6f81('0x43')]['id']}})[_0x6f81('0x21')](handleEntityNotFound(_0x1ae29a,null))[_0x6f81('0x21')](removeEntity(_0x1ae29a,null))['catch'](handleError(_0x1ae29a,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 45e11a9..01a95d6 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 _0xee24=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications'];(function(_0x3c511b,_0x5b546f){var _0x52c6a4=function(_0x4859a0){while(--_0x4859a0){_0x3c511b['push'](_0x3c511b['shift']());}};_0x52c6a4(++_0x5b546f);}(_0xee24,0x1a6));var _0x4ee2=function(_0x56808f,_0x41c9c0){_0x56808f=_0x56808f-0x0;var _0x29b2d7=_0xee24[_0x56808f];return _0x29b2d7;};'use strict';var _=require('lodash');var util=require(_0x4ee2('0x0'));var logger=require(_0x4ee2('0x1'))('api');var moment=require(_0x4ee2('0x2'));var BPromise=require(_0x4ee2('0x3'));var rp=require(_0x4ee2('0x4'));var fs=require('fs');var path=require(_0x4ee2('0x5'));var rimraf=require('rimraf');var config=require(_0x4ee2('0x6'));var attributes=require(_0x4ee2('0x7'));module[_0x4ee2('0x8')]=function(_0x1993de,_0x5c778f){return _0x1993de[_0x4ee2('0x9')](_0x4ee2('0xa'),attributes,{'tableName':_0x4ee2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4ee2('0xc'),'collate':_0x4ee2('0xd')});}; \ No newline at end of file +var _0xc827=['./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x7e6cd0,_0x390d8b){var _0x2404f7=function(_0x73d5ce){while(--_0x73d5ce){_0x7e6cd0['push'](_0x7e6cd0['shift']());}};_0x2404f7(++_0x390d8b);}(_0xc827,0x149));var _0x7c82=function(_0x329641,_0x225a3b){_0x329641=_0x329641-0x0;var _0x5020f0=_0xc827[_0x329641];return _0x5020f0;};'use strict';var _=require(_0x7c82('0x0'));var util=require('util');var logger=require(_0x7c82('0x1'))('api');var moment=require(_0x7c82('0x2'));var BPromise=require('bluebird');var rp=require(_0x7c82('0x3'));var fs=require('fs');var path=require(_0x7c82('0x4'));var rimraf=require(_0x7c82('0x5'));var config=require(_0x7c82('0x6'));var attributes=require(_0x7c82('0x7'));module[_0x7c82('0x8')]=function(_0xe22c3a,_0xa344dc){return _0xe22c3a[_0x7c82('0x9')](_0x7c82('0xa'),attributes,{'tableName':_0x7c82('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7c82('0xc'),'collate':_0x7c82('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 29f5ea0..7b53e42 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 _0x7177=['stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SmsApplication,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7177,0x101));var _0x7717=function(_0x50ee83,_0x106751){_0x50ee83=_0x50ee83-0x0;var _0x3099ea=_0x7177[_0x50ee83];return _0x3099ea;};'use strict';var _=require(_0x7717('0x0'));var util=require('util');var moment=require(_0x7717('0x1'));var BPromise=require('bluebird');var rs=require(_0x7717('0x2'));var fs=require('fs');var Redis=require(_0x7717('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7717('0x4'));var logger=require(_0x7717('0x5'))('rpc');var config=require(_0x7717('0x6'));var jayson=require(_0x7717('0x7'));var client=jayson[_0x7717('0x8')][_0x7717('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe3d36b,_0x3db511,_0xaca6aa){return new BPromise(function(_0x2ded67,_0x29a980){return client[_0x7717('0xa')](_0xe3d36b,_0xaca6aa)[_0x7717('0xb')](function(_0x51d2a6){logger[_0x7717('0xc')](_0x7717('0xd'),_0x3db511,'request\x20sent');logger[_0x7717('0xe')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x3db511,_0x7717('0xf'),JSON[_0x7717('0x10')](_0x51d2a6));if(_0x51d2a6[_0x7717('0x11')]){if(_0x51d2a6[_0x7717('0x11')][_0x7717('0x12')]===0x1f4){logger['error'](_0x7717('0xd'),_0x3db511,_0x51d2a6[_0x7717('0x11')][_0x7717('0x13')]);return _0x29a980(_0x51d2a6[_0x7717('0x11')][_0x7717('0x13')]);}logger[_0x7717('0x11')](_0x7717('0xd'),_0x3db511,_0x51d2a6['error'][_0x7717('0x13')]);return _0x2ded67(_0x51d2a6[_0x7717('0x11')][_0x7717('0x13')]);}else{logger[_0x7717('0xc')](_0x7717('0xd'),_0x3db511,_0x7717('0xf'));_0x2ded67(_0x51d2a6[_0x7717('0x14')]['message']);}})['catch'](function(_0x4071ff){logger['error'](_0x7717('0xd'),_0x3db511,_0x4071ff);_0x29a980(_0x4071ff);});});} \ No newline at end of file +var _0x0eeb=['client','http','request','then','info','SmsApplication,\x20%s,\x20%s','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x372657,_0x43ec13){var _0x483a75=function(_0x2a2d1e){while(--_0x2a2d1e){_0x372657['push'](_0x372657['shift']());}};_0x483a75(++_0x43ec13);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0eeb[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xb0ee('0x0'));var util=require(_0xb0ee('0x1'));var moment=require(_0xb0ee('0x2'));var BPromise=require(_0xb0ee('0x3'));var rs=require(_0xb0ee('0x4'));var fs=require('fs');var Redis=require(_0xb0ee('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb0ee('0x6'))(_0xb0ee('0x7'));var config=require(_0xb0ee('0x8'));var jayson=require(_0xb0ee('0x9'));var client=jayson[_0xb0ee('0xa')][_0xb0ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17f445,_0x5377b4,_0x207a85){return new BPromise(function(_0x586bc9,_0x13c198){return client[_0xb0ee('0xc')](_0x17f445,_0x207a85)[_0xb0ee('0xd')](function(_0x308603){logger[_0xb0ee('0xe')](_0xb0ee('0xf'),_0x5377b4,'request\x20sent');logger['debug'](_0xb0ee('0x10'),_0x5377b4,_0xb0ee('0x11'),JSON['stringify'](_0x308603));if(_0x308603['error']){if(_0x308603[_0xb0ee('0x12')][_0xb0ee('0x13')]===0x1f4){logger[_0xb0ee('0x12')](_0xb0ee('0xf'),_0x5377b4,_0x308603['error'][_0xb0ee('0x14')]);return _0x13c198(_0x308603['error']['message']);}logger['error'](_0xb0ee('0xf'),_0x5377b4,_0x308603[_0xb0ee('0x12')]['message']);return _0x586bc9(_0x308603[_0xb0ee('0x12')][_0xb0ee('0x14')]);}else{logger[_0xb0ee('0xe')](_0xb0ee('0xf'),_0x5377b4,_0xb0ee('0x11'));_0x586bc9(_0x308603[_0xb0ee('0x15')][_0xb0ee('0x14')]);}})[_0xb0ee('0x16')](function(_0x549e64){logger['error'](_0xb0ee('0xf'),_0x5377b4,_0x549e64);_0x13c198(_0x549e64);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 5da755a..89a22a6 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 _0x5c00=['smsinteraction:addtags','addTags','/:id','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','post','create','addMessage','/:id/tags','tracked','sms'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x5c00,0x17e));var _0x05c0=function(_0x591a90,_0x5525b0){_0x591a90=_0x591a90-0x0;var _0x551587=_0x5c00[_0x591a90];return _0x551587;};'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('./smsInteraction.controller');router[_0x05c0('0x8')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0xa')]);router[_0x05c0('0x8')]('/describe',auth[_0x05c0('0x9')](),controller[_0x05c0('0xb')]);router[_0x05c0('0x8')]('/:id',auth[_0x05c0('0x9')](),controller[_0x05c0('0xc')]);router[_0x05c0('0x8')](_0x05c0('0xd'),auth[_0x05c0('0x9')](),controller[_0x05c0('0xe')]);router['get']('/:id/download',auth[_0x05c0('0x9')](),controller['download']);router[_0x05c0('0xf')]('/',auth[_0x05c0('0x9')](),controller[_0x05c0('0x10')]);router['post'](_0x05c0('0xd'),auth['isAuthenticated'](),controller[_0x05c0('0x11')]);router[_0x05c0('0xf')](_0x05c0('0x12'),auth[_0x05c0('0x9')](),interaction[_0x05c0('0x13')](_0x05c0('0x14'),_0x05c0('0x15')),controller[_0x05c0('0x16')]);router['put'](_0x05c0('0x17'),auth[_0x05c0('0x9')](),interaction[_0x05c0('0x13')](_0x05c0('0x14'),_0x05c0('0x18')),controller[_0x05c0('0x19')]);router[_0x05c0('0x1a')](_0x05c0('0x17'),auth[_0x05c0('0x9')](),interaction['tracked'](_0x05c0('0x14'),_0x05c0('0x1b')),controller[_0x05c0('0x1c')]);router['delete'](_0x05c0('0x12'),auth[_0x05c0('0x9')](),controller[_0x05c0('0x1d')]);module[_0x05c0('0x1e')]=router; \ No newline at end of file +var _0x2547=['/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3f964c,_0x5d0ab9){var _0x592e20=function(_0x396f56){while(--_0x396f56){_0x3f964c['push'](_0x3f964c['shift']());}};_0x592e20(++_0x5d0ab9);}(_0x2547,0x1cd));var _0x7254=function(_0x54f51f,_0x16851f){_0x54f51f=_0x54f51f-0x0;var _0x192132=_0x2547[_0x54f51f];return _0x192132;};'use strict';var multer=require('multer');var util=require(_0x7254('0x0'));var path=require(_0x7254('0x1'));var timeout=require(_0x7254('0x2'));var express=require(_0x7254('0x3'));var router=express[_0x7254('0x4')]();var fs_extra=require(_0x7254('0x5'));var auth=require(_0x7254('0x6'));var interaction=require(_0x7254('0x7'));var config=require('../../config/environment');var controller=require(_0x7254('0x8'));router[_0x7254('0x9')]('/',auth[_0x7254('0xa')](),controller[_0x7254('0xb')]);router['get'](_0x7254('0xc'),auth[_0x7254('0xa')](),controller[_0x7254('0xd')]);router['get'](_0x7254('0xe'),auth['isAuthenticated'](),controller['show']);router['get'](_0x7254('0xf'),auth[_0x7254('0xa')](),controller[_0x7254('0x10')]);router[_0x7254('0x9')](_0x7254('0x11'),auth[_0x7254('0xa')](),controller['download']);router[_0x7254('0x12')]('/',auth['isAuthenticated'](),controller[_0x7254('0x13')]);router['post'](_0x7254('0xf'),auth[_0x7254('0xa')](),controller[_0x7254('0x14')]);router[_0x7254('0x12')](_0x7254('0x15'),auth[_0x7254('0xa')](),interaction[_0x7254('0x16')](_0x7254('0x17'),_0x7254('0x18')),controller[_0x7254('0x19')]);router[_0x7254('0x1a')](_0x7254('0xe'),auth[_0x7254('0xa')](),interaction['tracked'](_0x7254('0x17'),_0x7254('0x1b')),controller[_0x7254('0x1c')]);router[_0x7254('0x1d')](_0x7254('0xe'),auth[_0x7254('0xa')](),interaction[_0x7254('0x16')]('sms',_0x7254('0x1e')),controller[_0x7254('0x1f')]);router[_0x7254('0x1d')](_0x7254('0x15'),auth[_0x7254('0xa')](),controller[_0x7254('0x20')]);module[_0x7254('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index c01712e..10f8466 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 _0x3079=['exports','BOOLEAN','DATE','STRING','ENUM','out','moment'];(function(_0x2b3c36,_0x2692e1){var _0x1c1840=function(_0x559719){while(--_0x559719){_0x2b3c36['push'](_0x2b3c36['shift']());}};_0x1c1840(++_0x2692e1);}(_0x3079,0x110));var _0x9307=function(_0x337b70,_0x34d970){_0x337b70=_0x337b70-0x0;var _0x2ef5c7=_0x3079[_0x337b70];return _0x2ef5c7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9307('0x0'));module[_0x9307('0x1')]={'closed':{'type':Sequelize[_0x9307('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9307('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x9307('0x4')]},'thirdDisposition':{'type':Sequelize[_0x9307('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9307('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x9307('0x5')]('in',_0x9307('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9307('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x9307('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb6f1=['sequelize','exports','DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xb6f1,0x118));var _0x1b6f=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb6f1[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x1b6f('0x0'));var moment=require('moment');module[_0x1b6f('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1b6f('0x2')]},'disposition':{'type':Sequelize[_0x1b6f('0x3')]},'secondDisposition':{'type':Sequelize[_0x1b6f('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x1b6f('0x3')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x1b6f('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x1b6f('0x4')]('in',_0x1b6f('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1b6f('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1b6f('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 3999d0d..cedcaa1 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 _0x352e=['sort','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','union','$substring','UserId','body','some','compact','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','order','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','toString','count','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','SmsInteractionId','all','rows','show','SmsInteraction','rawAttributes','includeAll','include','options','create','params','describe','SmsMessage','ids','omit','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','unix','join','root','server','files','attachments','transcript-%d-%s.zip','User','CmContact','firstName','lastName','direction','read','SmsAccount','Account','Owner','fullname','get','mkdirSync','Sms','closed','closedAt','disposition','Messages','out','System','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','apply','save','update','then','error','stack','name','Users','TagIds','Tags','split','forEach','push','catch','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0xa05c60,_0x4e1a83){var _0x512da3=function(_0x35b305){while(--_0x35b305){_0xa05c60['push'](_0xa05c60['shift']());}};_0x512da3(++_0x4e1a83);}(_0x352e,0x1a6));var _0xe352=function(_0x3f9ed6,_0x455440){_0x3f9ed6=_0x3f9ed6-0x0;var _0x23eb5e=_0x352e[_0x3f9ed6];return _0x23eb5e;};'use strict';var emlformat=require(_0xe352('0x0'));var rimraf=require(_0xe352('0x1'));var zipdir=require(_0xe352('0x2'));var jsonpatch=require(_0xe352('0x3'));var rp=require(_0xe352('0x4'));var moment=require(_0xe352('0x5'));var BPromise=require(_0xe352('0x6'));var Mustache=require(_0xe352('0x7'));var util=require('util');var path=require(_0xe352('0x8'));var sox=require(_0xe352('0x9'));var csv=require('to-csv');var ejs=require(_0xe352('0xa'));var fs=require('fs');var fs_extra=require(_0xe352('0xb'));var _=require(_0xe352('0xc'));var squel=require(_0xe352('0xd'));var crypto=require('crypto');var jsforce=require(_0xe352('0xe'));var deskjs=require(_0xe352('0xf'));var toCsv=require(_0xe352('0x10'));var querystring=require(_0xe352('0x11'));var Papa=require('papaparse');var Redis=require(_0xe352('0x12'));var authService=require(_0xe352('0x13'));var qs=require(_0xe352('0x14'));var as=require(_0xe352('0x15'));var pdf=require(_0xe352('0x16'));var hardwareService=require(_0xe352('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xe352('0x18'));var config=require(_0xe352('0x19'));var licenseUtil=require(_0xe352('0x1a'));var db=require(_0xe352('0x1b'))['db'];config[_0xe352('0x1c')]=_[_0xe352('0x1d')](config['redis'],{'host':_0xe352('0x1e'),'port':0x18eb});var socket=require(_0xe352('0x1f'))(new Redis(config['redis']));require(_0xe352('0x20'))[_0xe352('0x21')](socket);function respondWithStatusCode(_0x56afa0,_0x3d8c66){_0x3d8c66=_0x3d8c66||0xcc;return function(_0x2e8845){if(_0x2e8845){return _0x56afa0[_0xe352('0x22')](_0x3d8c66);}return _0x56afa0[_0xe352('0x23')](_0x3d8c66)[_0xe352('0x24')]();};}function respondWithResult(_0xa00062,_0x31e417){_0x31e417=_0x31e417||0xc8;return function(_0x1fede5){if(_0x1fede5){return _0xa00062['status'](_0x31e417)[_0xe352('0x25')](_0x1fede5);}};}function respondWithFilteredResult(_0x5c1967,_0x5b969a){return function(_0x413f08){if(_0x413f08){var _0x4472a9=typeof _0x5b969a['offset']==='undefined'&&typeof _0x5b969a[_0xe352('0x26')]===_0xe352('0x27');var _0x759b6=_0x413f08['count'];var _0x2687c4=_0x4472a9?0x0:_0x5b969a[_0xe352('0x28')];var _0xa70d53=_0x4472a9?_0x413f08['count']:_0x5b969a['offset']+_0x5b969a[_0xe352('0x26')];var _0x39961f;if(_0xa70d53>=_0x759b6){_0xa70d53=_0x759b6;_0x39961f=0xc8;}else{_0x39961f=0xce;}_0x5c1967[_0xe352('0x23')](_0x39961f);return _0x5c1967[_0xe352('0x29')](_0xe352('0x2a'),_0x2687c4+'-'+_0xa70d53+'/'+_0x759b6)['json'](_0x413f08);}return null;};}function patchUpdates(_0x295529){return function(_0x30e8f0){try{jsonpatch[_0xe352('0x2b')](_0x30e8f0,_0x295529,!![]);}catch(_0x3b23ce){return BPromise['reject'](_0x3b23ce);}return _0x30e8f0[_0xe352('0x2c')]();};}function saveUpdates(_0x53cf17,_0x3cc4f7){return function(_0x55ff39){if(_0x55ff39){return _0x55ff39[_0xe352('0x2d')](_0x53cf17)[_0xe352('0x2e')](function(_0x41e235){return _0x41e235;});}return null;};}function removeEntity(_0x1b1245,_0x319aca){return function(_0x2bc93f){if(_0x2bc93f){return _0x2bc93f['destroy']()['then'](function(){_0x1b1245['status'](0xcc)[_0xe352('0x24')]();});}};}function handleEntityNotFound(_0x55347e,_0x37f1cf){return function(_0x168327){if(!_0x168327){_0x55347e[_0xe352('0x22')](0x194);}return _0x168327;};}function handleError(_0x252eab,_0x30028b){_0x30028b=_0x30028b||0x1f4;return function(_0xd3c70a){logger[_0xe352('0x2f')](_0xd3c70a[_0xe352('0x30')]);if(_0xd3c70a[_0xe352('0x31')]){delete _0xd3c70a[_0xe352('0x31')];}_0x252eab[_0xe352('0x23')](_0x30028b)['send'](_0xd3c70a);};}function getInteractionUsers(_0x43d174,_0x4b48b5){return new BPromise(function(_0x584fb3,_0x3fc7ac){try{if(_0x4b48b5[_0x43d174['id']]){_0x43d174[_0xe352('0x32')]=_['map'](_0x4b48b5[_0x43d174['id']],function(_0x499d5b){return{'id':_0x499d5b['id'],'fullname':_0x499d5b['fullname']};});}}catch(_0x5d8533){_0x3fc7ac(_0x5d8533);}_0x584fb3(_0x43d174);});}function getInteractionTags(_0x125ae5,_0x144d2c){return new BPromise(function(_0x739f4a,_0x157576){try{if(_0x125ae5[_0xe352('0x33')]){_0x125ae5[_0xe352('0x34')]=[];_0x125ae5['TagIds'][_0xe352('0x35')](',')[_0xe352('0x36')](function(_0x343d5d){_0x125ae5[_0xe352('0x34')][_0xe352('0x37')](_0x144d2c[_0x343d5d]);});}delete _0x125ae5[_0xe352('0x33')];}catch(_0x507f50){_0x157576(_0x507f50);}_0x739f4a(_0x125ae5);});}function updateSmsInteraction(_0x2c2f04,_0x551f3e,_0x3445ee){return new BPromise(function(_0xd73099,_0x5538e7){return getInteractionUsers(_0x2c2f04,_0x3445ee)['then'](function(_0xf88f5b){return getInteractionTags(_0xf88f5b,_0x551f3e);})['then'](function(_0x13aef5){_0xd73099(_0x13aef5);})[_0xe352('0x38')](function(_0x29a280){_0x5538e7(_0x29a280);});});}exports[_0xe352('0x39')]=function(_0x3e74aa,_0xe5aa6d){var _0x5e56e0={},_0x3d173a={},_0x54b6da={'count':0x0,'rows':[]};var _0x27852d=_[_0xe352('0x3a')](db['SmsInteraction']['rawAttributes'],function(_0x842408){return{'name':_0x842408[_0xe352('0x3b')],'type':_0x842408[_0xe352('0x3c')][_0xe352('0x3d')]};});_0x3d173a[_0xe352('0x3e')]=_[_0xe352('0x3a')](_0x27852d,'name');_0x3d173a[_0xe352('0x3f')]=_[_0xe352('0x40')](_0x3e74aa[_0xe352('0x3f')]);_0x3d173a[_0xe352('0x41')]=_[_0xe352('0x42')](_0x3d173a[_0xe352('0x3e')],_0x3d173a[_0xe352('0x3f')]);_0x5e56e0[_0xe352('0x43')]=_[_0xe352('0x42')](_0x3d173a[_0xe352('0x3e')],qs[_0xe352('0x44')](_0x3e74aa[_0xe352('0x3f')]['fields']));_0x5e56e0[_0xe352('0x43')]=_0x5e56e0[_0xe352('0x43')][_0xe352('0x45')]?_0x5e56e0[_0xe352('0x43')]:_0x3d173a[_0xe352('0x3e')];if(!_0x3e74aa['query'][_0xe352('0x46')](_0xe352('0x47'))){_0x5e56e0[_0xe352('0x26')]=qs[_0xe352('0x26')](_0x3e74aa[_0xe352('0x3f')][_0xe352('0x26')]);_0x5e56e0['offset']=qs[_0xe352('0x28')](_0x3e74aa['query'][_0xe352('0x28')]);}_0x5e56e0['order']=qs[_0xe352('0x48')](_0x3e74aa[_0xe352('0x3f')][_0xe352('0x48')]);_0x5e56e0['where']=qs['filters'](_[_0xe352('0x49')](_0x3e74aa[_0xe352('0x3f')],_0x3d173a['filters']),_0x27852d);var _0xb4658c=[];var _0x252a22=squel[_0xe352('0x4a')]()[_0xe352('0x4b')]('id')[_0xe352('0x4b')]('name')['field'](_0xe352('0x4c'))[_0xe352('0x4d')](_0xe352('0x4e'));var _0x426b80=squel[_0xe352('0x4a')]()[_0xe352('0x4b')](_0xe352('0x4f'))[_0xe352('0x4b')](_0xe352('0x50'))['field'](_0xe352('0x51'))['from'](_0xe352('0x52'),'ui')[_0xe352('0x53')]('users','u',_0xe352('0x54'));var _0x105ec9=squel[_0xe352('0x4a')]()[_0xe352('0x4d')]('sms_interactions','i')[_0xe352('0x53')](_0xe352('0x55'),'c',_0xe352('0x56'))['left_join'](_0xe352('0x57'),'o',_0xe352('0x58'))[_0xe352('0x53')](_0xe352('0x59'),'a',_0xe352('0x5a'))[_0xe352('0x53')](_0xe352('0x5b'),'me',_0xe352('0x5c'))[_0xe352('0x53')]('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')[_0xe352('0x53')](_0xe352('0x4e'),'t',_0xe352('0x5d'));var _0x1389ce=squel[_0xe352('0x5e')]();var _0xe7f8b9=[];var _0x42a452=squel[_0xe352('0x5e')]();var _0x4fbc22;if(_0x3e74aa[_0xe352('0x3f')]['search']){_0x4fbc22=as[_0xe352('0x5f')](_0x3e74aa[_0xe352('0x3f')][_0xe352('0x60')]);var _0x1443d9=_0x4fbc22[_0xe352('0x61')];for(var _0xe95c0b=0x0;_0xe95c0b<_0x4fbc22['conditions']['length'];_0xe95c0b++){var _0x3ef23e=_0x4fbc22[_0xe352('0x62')][_0xe95c0b];var _0x4d2380='i';var _0x4020a5=_[_0xe352('0x63')](_0x27852d,['name',_0x3ef23e[_0xe352('0x4b')]]);if(!_0x4020a5){switch(_0x3ef23e[_0xe352('0x4b')]){case _0xe352('0x64'):if(_0x3ef23e[_0xe352('0x65')]==0x1){_0x105ec9[_0xe352('0x66')]('`'+_0x3ef23e[_0xe352('0x4b')]+'`\x20=\x200');}else{_0x105ec9['having']('`'+_0x3ef23e[_0xe352('0x4b')]+_0xe352('0x67'));}break;case _0xe352('0x68'):if(_0x3ef23e[_0xe352('0x69')]==='$substring'){if(_0x3ef23e[_0xe352('0x65')][_0xe352('0x35')]('\x20')['length']>0x1){_0x1389ce[_0x1443d9](_0xe352('0x6a'),qs[_0xe352('0x6b')](_0x3ef23e['value']),null);}else{var _0xed7d57='%'+_0x3ef23e[_0xe352('0x65')]+'%';_0x1389ce[_0x1443d9](_0xe352('0x6c'),_0xed7d57,_0xed7d57,_0xed7d57);}}else{_0x4020a5=_[_0xe352('0x63')](_0x27852d,['name',_0xe352('0x6d')]);_0x3ef23e[_0xe352('0x4b')]=_0xe352('0x6d');_0x4e849e=as[_0xe352('0x6e')](_0x4d2380,_0x4020a5[_0xe352('0x3c')],_0x3ef23e);_0x1389ce[_0x1443d9](_0x4e849e[_0xe352('0x6f')],_0x4e849e[_0xe352('0x65')][_0xe352('0x70')],_0x4e849e['value'][_0xe352('0x24')]);}break;case _0xe352('0x71'):var _0x3d8be7=_0x3ef23e[_0xe352('0x65')][_0xe352('0x35')](',')[_0xe352('0x3a')](function(_0x3f3e36){return Number(_0x3f3e36);});_0x3d8be7[_0xe352('0x36')](function(_0x49f804){_0x42a452['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x49f804+',%');});_0xe7f8b9=_[_0xe352('0x72')](_0xe7f8b9,_0x3d8be7);break;case'User':if(_0x3ef23e['operator']===_0xe352('0x73')){_0x1389ce[_0x1443d9]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3ef23e['value']+'%',null);}else{_0x4020a5=_[_0xe352('0x63')](_0x27852d,[_0xe352('0x31'),_0xe352('0x74')]);_0x3ef23e[_0xe352('0x4b')]=_0xe352('0x74');_0x4e849e=as[_0xe352('0x6e')](_0x4d2380,_0x4020a5[_0xe352('0x3c')],_0x3ef23e);_0x1389ce[_0x1443d9](_0x4e849e[_0xe352('0x6f')],_0x4e849e[_0xe352('0x65')][_0xe352('0x70')],_0x4e849e[_0xe352('0x65')][_0xe352('0x24')]);}break;case _0xe352('0x75'):_0x4e849e=as[_0xe352('0x6e')]('me',null,_0x3ef23e);_0x1389ce[_0x1443d9](_0x4e849e['text'],_0x4e849e[_0xe352('0x65')][_0xe352('0x70')],_0x4e849e[_0xe352('0x65')][_0xe352('0x24')]);break;}}else{var _0x4e849e=as[_0xe352('0x6e')](_0x4d2380,_0x4020a5['type'],_0x3ef23e);_0x1389ce[_0x1443d9](_0x4e849e['text'],_0x4e849e[_0xe352('0x65')][_0xe352('0x70')],_0x4e849e[_0xe352('0x65')][_0xe352('0x24')]);}}}else{var _0x1903bb=_(_0x3e74aa[_0xe352('0x3f')])[_0xe352('0x40')]()[_0xe352('0x3a')](function(_0x1fb7ef){return _[_0xe352('0x76')](_0x27852d,[_0xe352('0x31'),_0x1fb7ef])?_0x1fb7ef:undefined;})[_0xe352('0x77')]()[_0xe352('0x65')]();if(!_['isEmpty'](_0x1903bb)){_0x1903bb[_0xe352('0x36')](function(_0x2ebdf0){if(_0x2ebdf0===_0xe352('0x78')){_0x105ec9[_0xe352('0x79')](_0xe352('0x7a'),[]['concat'](_0x3e74aa[_0xe352('0x3f')][_0x2ebdf0]));}else if(_0x2ebdf0===_0xe352('0x7b')){var _0x2a03ea=JSON[_0xe352('0x7c')](_0x3e74aa['query'][_0x2ebdf0])['$gte'];var _0x3b1da9=JSON[_0xe352('0x7c')](_0x3e74aa[_0xe352('0x3f')][_0x2ebdf0])[_0xe352('0x7d')];_0x105ec9[_0xe352('0x79')](_0xe352('0x7e'),_0x2a03ea,_0x3b1da9);}else{if(_0x3e74aa[_0xe352('0x3f')][_0x2ebdf0]===_0xe352('0x7f')){_0x105ec9['where']('i.'+_0x2ebdf0+_0xe352('0x80'));}else{_0x105ec9[_0xe352('0x79')]('i.'+_0x2ebdf0+'\x20=\x20?',_0x3e74aa[_0xe352('0x3f')][_0x2ebdf0]);}}});}if(_0x3e74aa[_0xe352('0x3f')]['read']){if(_0x3e74aa['query']['read']==0x1){_0x105ec9[_0xe352('0x66')](_0xe352('0x81'));}else{_0x105ec9[_0xe352('0x66')](_0xe352('0x82'));}}if(_0x3e74aa[_0xe352('0x3f')][_0xe352('0x83')]){_0xe7f8b9=_[_0xe352('0x84')](_0x3e74aa[_0xe352('0x3f')]['tag'])?_0x3e74aa['query'][_0xe352('0x83')]:new Array(_0x3e74aa[_0xe352('0x3f')]['tag']);_0xe7f8b9[_0xe352('0x36')](function(_0xf22f08){_0x42a452['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0xf22f08+',%');});}if(_0x3e74aa['query'][_0xe352('0x85')]){var _0x490792=_0x3e74aa[_0xe352('0x3f')][_0xe352('0x85')][_0xe352('0x86')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xe352('0x87')](_0x490792)){_0x1389ce['or'](_0xe352('0x88'),_0x490792+'%')['or'](_0xe352('0x89'),_0x490792+'%');}else{_0x1389ce['or'](_0xe352('0x8a'),qs['getFullTextValue'](_0x490792))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x490792+'%');}}}_0x105ec9[_0xe352('0x79')](_0x1389ce);_0x105ec9[_0xe352('0x8b')](_0xe352('0x8c'));var _0x50596d={'type':db[_0xe352('0x8d')][_0xe352('0x8e')][_0xe352('0x8f')],'raw':!![]};var _0x5432a8=_0x105ec9[_0xe352('0x90')]();_0x5432a8[_0xe352('0x4b')](_0xe352('0x8c'));_0x5432a8[_0xe352('0x4b')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xe352('0x64'));if(_0x5e56e0[_0xe352('0x91')]){_0x5e56e0[_0xe352('0x91')]['forEach'](function(_0x573be3){var _0x1cfabb=_0x573be3[0x0]===_0xe352('0x92')?_0x573be3[0x0]:'i.'+_0x573be3[0x0];_0x105ec9[_0xe352('0x91')](_0x1cfabb,_0x573be3[0x1]===_0xe352('0x93')?![]:!![]);});}if(!_[_0xe352('0x94')](_0xe7f8b9)){_0x105ec9['having'](_0x42a452);_0x5432a8['where'](_0xe352('0x95'),_0xe7f8b9);}BPromise[_0xe352('0x96')]()[_0xe352('0x2e')](function(){if(!_0x4fbc22){if(_0x3e74aa[_0xe352('0x3f')][_0xe352('0x78')])return;_0x5432a8['where'](_0xe352('0x97'));_0x105ec9['where'](_0xe352('0x97'));return;}if(_0x3e74aa[_0xe352('0x98')][_0xe352('0x99')]!==_0xe352('0x9a'))return;return _0x3e74aa[_0xe352('0x98')][_0xe352('0x9b')]({'attributes':['id'],'raw':!![]})[_0xe352('0x2e')](function(_0x3b6ae1){if(_[_0xe352('0x94')](_0x3b6ae1)){_0x5432a8[_0xe352('0x79')](_0xe352('0x9c'));_0x105ec9[_0xe352('0x79')]('i.SmsAccountId\x20IS\x20NULL');}else{_0x5432a8[_0xe352('0x79')](_0xe352('0x7a'),_['map'](_0x3b6ae1,'id'));_0x105ec9[_0xe352('0x79')]('i.SmsAccountId\x20IN\x20?',_[_0xe352('0x3a')](_0x3b6ae1,'id'));}});})[_0xe352('0x2e')](function(){if(_0x3e74aa[_0xe352('0x98')][_0xe352('0x99')]===_0xe352('0x9a')&&!_0x4fbc22&&!_0x3e74aa[_0xe352('0x3f')][_0xe352('0x78')])return[];return db['sequelize'][_0xe352('0x3f')](_0x5432a8[_0xe352('0x9d')](),_0x50596d);})[_0xe352('0x2e')](function(_0x24427d){_0x54b6da['count']=_0x24427d[_0xe352('0x45')];if(_0x54b6da[_0xe352('0x9e')]===0x0)return[];return db['sequelize'][_0xe352('0x3f')](_0x252a22[_0xe352('0x9d')](),_0x50596d)[_0xe352('0x2e')](function(_0x9883e3){_0xb4658c=_[_0xe352('0x9f')](_0x9883e3,'id');_0x50596d=_[_0xe352('0xa0')](_0x50596d,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3e74aa[_0xe352('0x3f')][_0xe352('0x44')]){_0x5e56e0[_0xe352('0x43')][_0xe352('0x36')](function(_0x3096a1){_0x105ec9[_0xe352('0x4b')]('i.'+_0x3096a1);});}else{_0x105ec9[_0xe352('0x4b')](_0xe352('0xa1'),_0xe352('0x64'));_0x105ec9[_0xe352('0x4b')](_0xe352('0xa2'),_0xe352('0xa3'));_0x105ec9[_0xe352('0x4b')](_0xe352('0xa4'),_0xe352('0xa5'));_0x105ec9[_0xe352('0x4b')](_0xe352('0xa6'),'contactName');_0x105ec9[_0xe352('0x4b')](_0xe352('0xa7'));_0x105ec9['field'](_0xe352('0xa8'),_0xe352('0xa9'));_0x105ec9['field'](_0xe352('0xaa'),_0xe352('0xab'));_0x105ec9[_0xe352('0x4b')](_0xe352('0xac'),_0xe352('0xad'));_0x105ec9['field'](_0xe352('0xae'),_0xe352('0xaf'));_0x105ec9[_0xe352('0x4b')]('c.mobile',_0xe352('0xb0'));_0x105ec9['field'](_0xe352('0xb1'),_0xe352('0xb2'));_0x105ec9['field'](_0xe352('0xb3'),_0xe352('0xb4'));_0x105ec9[_0xe352('0x4b')](_0xe352('0xb5'),_0xe352('0xb6'));_0x105ec9[_0xe352('0x4b')](_0xe352('0xb7'),_0xe352('0x33'));}if(_0x5e56e0[_0xe352('0x26')])_0x105ec9[_0xe352('0x26')](_0x5e56e0['limit']);if(_0x5e56e0['offset'])_0x105ec9['offset'](_0x5e56e0[_0xe352('0x28')]);return db['sequelize'][_0xe352('0x3f')](_0x105ec9['toString'](),_0x50596d);})[_0xe352('0x2e')](function(_0x3387f3){if(_0x3387f3[_0xe352('0x45')]>0x0)_0x426b80[_0xe352('0x79')]('ui.SmsInteractionId\x20IN\x20?',_[_0xe352('0x3a')](_0x3387f3,'id'));return db['sequelize'][_0xe352('0x3f')](_0x426b80[_0xe352('0x9d')](),_0x50596d)['then'](function(_0x436df4){var _0x98b65e=_['groupBy'](_0x436df4,_0xe352('0xb8'));var _0x120e72=[];_0x3387f3['forEach'](function(_0xec5917){_0x120e72[_0xe352('0x37')](updateSmsInteraction(_0xec5917,_0xb4658c,_0x98b65e));});return BPromise[_0xe352('0xb9')](_0x120e72);});});})[_0xe352('0x2e')](function(_0x453517){_0x54b6da[_0xe352('0xba')]=_0x453517;return _0x54b6da;})['then'](respondWithFilteredResult(_0xe5aa6d,_0x5e56e0))[_0xe352('0x38')](handleError(_0xe5aa6d,null));};exports[_0xe352('0xbb')]=function(_0x494186,_0x12d9d0){var _0x3e6243={'raw':![],'where':{'id':_0x494186['params']['id']}},_0x306665={};_0x306665[_0xe352('0x3e')]=_[_0xe352('0x40')](db[_0xe352('0xbc')][_0xe352('0xbd')]);_0x306665['query']=_[_0xe352('0x40')](_0x494186[_0xe352('0x3f')]);_0x306665[_0xe352('0x41')]=_[_0xe352('0x42')](_0x306665[_0xe352('0x3e')],_0x306665[_0xe352('0x3f')]);_0x3e6243[_0xe352('0x43')]=_[_0xe352('0x42')](_0x306665[_0xe352('0x3e')],qs[_0xe352('0x44')](_0x494186[_0xe352('0x3f')][_0xe352('0x44')]));_0x3e6243[_0xe352('0x43')]=_0x3e6243['attributes']['length']?_0x3e6243[_0xe352('0x43')]:_0x306665[_0xe352('0x3e')];if(_0x494186[_0xe352('0x3f')][_0xe352('0xbe')]){_0x3e6243[_0xe352('0xbf')]=[{'all':!![]}];}_0x3e6243=_[_0xe352('0xa0')]({},_0x3e6243,_0x494186[_0xe352('0xc0')]);return db[_0xe352('0xbc')][_0xe352('0x63')](_0x3e6243)[_0xe352('0x2e')](handleEntityNotFound(_0x12d9d0,null))[_0xe352('0x2e')](respondWithResult(_0x12d9d0,null))[_0xe352('0x38')](handleError(_0x12d9d0,null));};exports[_0xe352('0xc1')]=function(_0x2c6ffc,_0x123a63){return db[_0xe352('0xbc')][_0xe352('0xc1')](_0x2c6ffc[_0xe352('0x75')],{})[_0xe352('0x2e')](respondWithResult(_0x123a63,0xc9))[_0xe352('0x38')](handleError(_0x123a63,null));};exports['update']=function(_0x38a3c8,_0x2cbcf3){if(_0x38a3c8[_0xe352('0x75')]['id']){delete _0x38a3c8[_0xe352('0x75')]['id'];}return db['SmsInteraction'][_0xe352('0x63')]({'where':{'id':_0x38a3c8[_0xe352('0xc2')]['id']}})[_0xe352('0x2e')](handleEntityNotFound(_0x2cbcf3,null))[_0xe352('0x2e')](saveUpdates(_0x38a3c8[_0xe352('0x75')],null))[_0xe352('0x2e')](respondWithResult(_0x2cbcf3,null))[_0xe352('0x38')](handleError(_0x2cbcf3,null));};exports['destroy']=function(_0x1bbc07,_0xb29dbc){return db[_0xe352('0xbc')]['find']({'where':{'id':_0x1bbc07[_0xe352('0xc2')]['id']}})[_0xe352('0x2e')](handleEntityNotFound(_0xb29dbc,null))[_0xe352('0x2e')](removeEntity(_0xb29dbc,null))['catch'](handleError(_0xb29dbc,null));};exports[_0xe352('0xc3')]=function(_0x68513d,_0x31647f){return db[_0xe352('0xbc')]['describe']()[_0xe352('0x2e')](respondWithResult(_0x31647f,null))['catch'](handleError(_0x31647f,null));};exports['addMessage']=function(_0x217fda,_0xde1b77,_0x5698f8){return db[_0xe352('0xc4')][_0xe352('0x63')]({'where':{'id':_0x217fda[_0xe352('0xc2')]['id']}})[_0xe352('0x2e')](handleEntityNotFound(_0xde1b77,null))[_0xe352('0x2e')](function(_0x37f580){if(_0x37f580){return _0x37f580['addMessage'](_0x217fda['body'][_0xe352('0xc5')],_[_0xe352('0xc6')](_0x217fda[_0xe352('0x75')],[_0xe352('0xc5'),'id'])||{});}})['then'](respondWithResult(_0xde1b77,null))[_0xe352('0x38')](handleError(_0xde1b77,null));};exports[_0xe352('0xc7')]=function(_0x41e282,_0x53e29d,_0x576336){var _0xd72038={'raw':![],'where':{}};var _0x4c092b={};var _0x5ca702={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xe352('0xc8')]({'where':{'id':_0x41e282[_0xe352('0xc2')]['id']}})[_0xe352('0x2e')](handleEntityNotFound(_0x53e29d,null))[_0xe352('0x2e')](function(_0x587bc6){if(_0x587bc6){_0x4c092b['model']=_[_0xe352('0x40')](db[_0xe352('0xc4')][_0xe352('0xbd')]);_0x4c092b[_0xe352('0x3f')]=_['keys'](_0x41e282[_0xe352('0x3f')]);_0x4c092b[_0xe352('0x41')]=_['intersection'](_0x4c092b['model'],_0x4c092b['query']);_0xd72038[_0xe352('0x43')]=_['intersection'](_0x4c092b[_0xe352('0x3e')],qs[_0xe352('0x44')](_0x41e282[_0xe352('0x3f')][_0xe352('0x44')]));_0xd72038['attributes']=_0xd72038[_0xe352('0x43')][_0xe352('0x45')]?_0xd72038[_0xe352('0x43')]:_0x4c092b[_0xe352('0x3e')];if(!_0x41e282[_0xe352('0x3f')]['hasOwnProperty'](_0xe352('0x47'))){_0xd72038['limit']=qs[_0xe352('0x26')](_0x41e282[_0xe352('0x3f')][_0xe352('0x26')]);_0xd72038[_0xe352('0x28')]=qs[_0xe352('0x28')](_0x41e282[_0xe352('0x3f')][_0xe352('0x28')]);}_0xd72038['order']=qs[_0xe352('0x48')](_0x41e282[_0xe352('0x3f')]['sort']);_0xd72038[_0xe352('0x79')]=qs[_0xe352('0x41')](_['pick'](_0x41e282['query'],_0x4c092b[_0xe352('0x41')]));_0xd72038[_0xe352('0x79')][_0xe352('0xb8')]=_0x587bc6['id'];if(_0x41e282['query'][_0xe352('0x85')]){_0xd72038[_0xe352('0x79')]=_['merge'](_0xd72038[_0xe352('0x79')],{'$or':_[_0xe352('0x3a')](_0xd72038[_0xe352('0x43')],function(_0x122eb3){var _0x10f1f4={};_0x10f1f4[_0x122eb3]={'$like':'%'+_0x41e282[_0xe352('0x3f')][_0xe352('0x85')]+'%'};return _0x10f1f4;})});}if(_0x41e282['query'][_0xe352('0xc9')]){var _0x1ae830=_0x41e282[_0xe352('0x3f')][_0xe352('0xc9')][_0xe352('0x35')](',');var _0x45a1f2={};_0x45a1f2[_0x1ae830[0x0]]={'$gte':moment(_0x1ae830[0x1])[_0xe352('0xca')](_0xe352('0xcb'))};_0xd72038[_0xe352('0x79')]=_[_0xe352('0xa0')](_0xd72038[_0xe352('0x79')],_0x45a1f2);}_0xd72038=_[_0xe352('0xa0')]({},_0xd72038,_0x41e282['options']);return db[_0xe352('0xc4')][_0xe352('0x9e')]({'where':_0xd72038[_0xe352('0x79')]})[_0xe352('0x2e')](function(_0x4dd357){_0x5ca702[_0xe352('0x9e')]=_0x4dd357;if(_0x41e282['query']['includeAll']){_0xd72038[_0xe352('0xbf')]=[{'all':!![]}];}return db[_0xe352('0xc4')][_0xe352('0xcc')](_0xd72038);})['then'](function(_0x5afd1f){_0x5ca702[_0xe352('0xba')]=_0x5afd1f;return _0x5ca702;});}})[_0xe352('0x2e')](respondWithFilteredResult(_0x53e29d,_0xd72038))['catch'](handleError(_0x53e29d,null));};exports[_0xe352('0xcd')]=function(_0x2be0c8,_0x242318,_0x386272){return db[_0xe352('0xbc')][_0xe352('0x63')]({'where':{'id':_0x2be0c8[_0xe352('0xc2')]['id']}})[_0xe352('0x2e')](handleEntityNotFound(_0x242318,null))[_0xe352('0x2e')](function(_0x2957ba){if(_0x2957ba){return _0x2957ba[_0xe352('0xce')](_0x2be0c8['body'][_0xe352('0xc5')],_[_0xe352('0xc6')](_0x2be0c8[_0xe352('0x75')],['ids','id'])||{})[_0xe352('0xcf')](function(){return db[_0xe352('0x71')][_0xe352('0xcc')]({'attributes':['id',_0xe352('0x31'),'color'],'where':{'id':_0x2be0c8[_0xe352('0x75')][_0xe352('0xc5')]}});})[_0xe352('0x2e')](function(_0x35c401){socket[_0xe352('0xd0')](_0xe352('0xd1'),{'id':Number(_0x2be0c8['params']['id']),'tags':_0x35c401||[]});return{'id':Number(_0x2be0c8[_0xe352('0xc2')]['id']),'tags':_0x35c401||[]};});}})[_0xe352('0x2e')](respondWithResult(_0x242318,null))[_0xe352('0x38')](handleError(_0x242318,null));};exports[_0xe352('0xd2')]=function(_0x2e8663,_0x1e8edb,_0x1f3bef){return db['SmsInteraction'][_0xe352('0x63')]({'where':{'id':_0x2e8663[_0xe352('0xc2')]['id']}})[_0xe352('0x2e')](handleEntityNotFound(_0x1e8edb,null))[_0xe352('0x2e')](function(_0x25b6e2){if(_0x25b6e2){return _0x25b6e2['removeTags'](_0x2e8663['query'][_0xe352('0xc5')]);}})[_0xe352('0x2e')](respondWithStatusCode(_0x1e8edb,null))[_0xe352('0x38')](handleError(_0x1e8edb,null));};exports['download']=function(_0x448cb5,_0x503748){var _0x56f025=moment()[_0xe352('0xd3')]()['toString']();var _0x379959=path[_0xe352('0xd4')](config[_0xe352('0xd5')],_0xe352('0xd6'),'files','tmp');var _0x5cca6b=path[_0xe352('0xd4')](config[_0xe352('0xd5')],_0xe352('0xd6'),_0xe352('0xd7'),_0xe352('0xd8'));var _0x4aafed=path[_0xe352('0xd4')](_0x379959,_0x56f025);var _0x596de0=util[_0xe352('0xca')](_0xe352('0xd9'),_0x448cb5[_0xe352('0xc2')]['id'],_0x56f025);var _0x4cc879=path[_0xe352('0xd4')](_0x379959,_0x596de0);var _0x5ac868=[];_0x5ac868['push']({'model':db[_0xe352('0xda')],'as':_0xe352('0xda'),'attributes':['id','fullname'],'raw':!![]});_0x5ac868[_0xe352('0x37')]({'model':db[_0xe352('0xdb')],'as':_0xe352('0x68'),'attributes':['id',_0xe352('0xdc'),_0xe352('0xdd')],'raw':!![]});var _0x4e4b22=[{'model':db[_0xe352('0xc4')],'as':'Messages','attributes':['id','body',_0xe352('0x7b'),_0xe352('0xde'),'secret',_0xe352('0xdf')],'include':_0x5ac868}];_0x4e4b22['push']({'model':db[_0xe352('0xe0')],'as':_0xe352('0xe1'),'attributes':['id',_0xe352('0x31')]});_0x4e4b22[_0xe352('0x37')]({'model':db[_0xe352('0xda')],'as':_0xe352('0xe2'),'attributes':['id',_0xe352('0xe3')]});return db[_0xe352('0xbc')]['find']({'where':{'id':_0x448cb5[_0xe352('0xc2')]['id']},'include':_0x4e4b22})[_0xe352('0x2e')](handleEntityNotFound(_0x503748,null))[_0xe352('0x2e')](function(_0x2a2066){if(_0x2a2066){var _0x582935=_0x2a2066[_0xe352('0xe4')]({'plain':!![]});fs[_0xe352('0xe5')](_0x4aafed);var _0x490cb1={'channel':_0xe352('0xe6'),'account':_0x582935[_0xe352('0xe1')][_0xe352('0x31')],'agent':_0x582935[_0xe352('0xe2')]?_0x582935['Owner'][_0xe352('0xe3')]:'N.A.','createdAt':moment(_0x582935[_0xe352('0x7b')])[_0xe352('0xca')](_0xe352('0xcb'))[_0xe352('0x9d')](),'closedAt':_0x582935[_0xe352('0xe7')]?moment(_0x582935[_0xe352('0xe8')])[_0xe352('0xca')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe352('0x9d')]():'','disposition':_0x582935[_0xe352('0xe9')],'messages':_(_0x582935[_0xe352('0xea')])['filter']({'secret':![]})[_0xe352('0x3a')](function(_0xcc5320){return{'date':moment(_0xcc5320['createdAt'])[_0xe352('0xca')]('YYYY-MM-DD\x20HH:mm:ss')[_0xe352('0x9d')](),'sender':_0xcc5320[_0xe352('0xde')]===_0xe352('0xeb')?_0xcc5320[_0xe352('0xda')]?_0xcc5320[_0xe352('0xda')]['fullname']:_0xe352('0xec'):_0xcc5320['Contact'][_0xe352('0xdc')]+(_0xcc5320[_0xe352('0x68')][_0xe352('0xdd')]?'\x20'+_0xcc5320[_0xe352('0x68')][_0xe352('0xdd')]:''),'body':_0xcc5320['body'],'direction':_0xcc5320[_0xe352('0xde')]===_0xe352('0xeb')?'A':'C','secret':_0xcc5320['secret'],'read':_0xcc5320[_0xe352('0xdf')]};})['value']()};return ejs[_0xe352('0xed')](path[_0xe352('0xd4')](config[_0xe352('0xd5')],_0xe352('0xd6'),_0xe352('0xee'),_0xe352('0xef')),{'interaction':_0x490cb1})[_0xe352('0x2e')](function(_0xa225b5){var _0x23a640=path[_0xe352('0xd4')](_0x4aafed,_0xe352('0xf0')+_0x582935['id']+'-'+_0x56f025+_0xe352('0xf1'));var _0x5055f9={'path':_0x23a640,'channel':_0xe352('0xe6'),'interactionId':_0x582935['id']};return pdf[_0xe352('0xf2')](_0xa225b5,_0x5055f9);})[_0xe352('0x2e')](function(){return new BPromise(function(_0x56680d,_0xd492e1){zipdir(_0x4aafed,{'saveTo':_0x4cc879},function(_0x17afb4,_0x31f733){if(_0x17afb4)return _0xd492e1(_0x17afb4);return _0x56680d(_0x31f733);});})[_0xe352('0x2e')](function(){return new BPromise(function(_0x272aee,_0x372425){rimraf(_0x4aafed,function(_0x357cdb){if(_0x357cdb)_0x372425(_0x357cdb);return _0x272aee();});});})[_0xe352('0x2e')](function(){return _0x503748[_0xe352('0xf3')](_0x4cc879,_0x596de0,function(_0x326cc5){if(_0x326cc5){console[_0xe352('0xf4')](_0xe352('0xf5'),_0x326cc5);}else{fs[_0xe352('0xf6')](_0x4cc879);}});});});}else{return _0x503748[_0xe352('0x22')](0xc8);}})[_0xe352('0x38')](handleError(_0x503748,null));}; \ No newline at end of file +var _0x4e0c=['SmsInteraction','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','order','filters','pick','select','field','color','from','u.id','u.fullname','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','end','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','text','body','keys','some','compact','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','fields','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','SmsInteractionId','all','rows','catch','show','includeAll','include','create','params','describe','addMessage','ids','omit','SmsMessage','nolimit','sort','format','YYYY-MM-DD\x20HH:mm:ss','options','addTags','setTags','findAll','emit','removeTags','unix','join','root','server','files','attachments','transcript-%d-%s.zip','push','fullname','CmContact','Contact','Messages','createdAt','secret','Account','Owner','get','mkdirSync','N.A.','disposition','out','System','firstName','lastName','direction','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Sms','createPdfFromHTML','log','rimraf','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','map','TagIds','split','Tags','index'];(function(_0x524b5d,_0x5e5d52){var _0x5773a5=function(_0x26a18d){while(--_0x26a18d){_0x524b5d['push'](_0x524b5d['shift']());}};_0x5773a5(++_0x5e5d52);}(_0x4e0c,0xb2));var _0xc4e0=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x4e0c[_0x31ced5];return _0x10d9e5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc4e0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc4e0('0x1'));var moment=require(_0xc4e0('0x2'));var BPromise=require(_0xc4e0('0x3'));var Mustache=require(_0xc4e0('0x4'));var util=require('util');var path=require('path');var sox=require(_0xc4e0('0x5'));var csv=require('to-csv');var ejs=require(_0xc4e0('0x6'));var fs=require('fs');var fs_extra=require(_0xc4e0('0x7'));var _=require(_0xc4e0('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc4e0('0x9'));var deskjs=require(_0xc4e0('0xa'));var toCsv=require(_0xc4e0('0xb'));var querystring=require('querystring');var Papa=require(_0xc4e0('0xc'));var Redis=require(_0xc4e0('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xc4e0('0xe'));var as=require(_0xc4e0('0xf'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0xc4e0('0x10'));var logger=require(_0xc4e0('0x11'))(_0xc4e0('0x12'));var utils=require('../../config/utils');var config=require(_0xc4e0('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xc4e0('0x14'))['db'];config[_0xc4e0('0x15')]=_[_0xc4e0('0x16')](config[_0xc4e0('0x15')],{'host':_0xc4e0('0x17'),'port':0x18eb});var socket=require(_0xc4e0('0x18'))(new Redis(config['redis']));require(_0xc4e0('0x19'))[_0xc4e0('0x1a')](socket);function respondWithStatusCode(_0x34147a,_0x293bf2){_0x293bf2=_0x293bf2||0xcc;return function(_0x5c601d){if(_0x5c601d){return _0x34147a[_0xc4e0('0x1b')](_0x293bf2);}return _0x34147a[_0xc4e0('0x1c')](_0x293bf2)['end']();};}function respondWithResult(_0x55664e,_0x33d16a){_0x33d16a=_0x33d16a||0xc8;return function(_0x471fba){if(_0x471fba){return _0x55664e['status'](_0x33d16a)[_0xc4e0('0x1d')](_0x471fba);}};}function respondWithFilteredResult(_0x5dd2d9,_0x238ab4){return function(_0x205405){if(_0x205405){var _0x412a8c=typeof _0x238ab4[_0xc4e0('0x1e')]===_0xc4e0('0x1f')&&typeof _0x238ab4[_0xc4e0('0x20')]===_0xc4e0('0x1f');var _0x4a2077=_0x205405['count'];var _0x28f146=_0x412a8c?0x0:_0x238ab4[_0xc4e0('0x1e')];var _0x19bc6d=_0x412a8c?_0x205405[_0xc4e0('0x21')]:_0x238ab4[_0xc4e0('0x1e')]+_0x238ab4[_0xc4e0('0x20')];var _0x16047d;if(_0x19bc6d>=_0x4a2077){_0x19bc6d=_0x4a2077;_0x16047d=0xc8;}else{_0x16047d=0xce;}_0x5dd2d9['status'](_0x16047d);return _0x5dd2d9[_0xc4e0('0x22')](_0xc4e0('0x23'),_0x28f146+'-'+_0x19bc6d+'/'+_0x4a2077)[_0xc4e0('0x1d')](_0x205405);}return null;};}function patchUpdates(_0x5e79d7){return function(_0x4bcfca){try{jsonpatch[_0xc4e0('0x24')](_0x4bcfca,_0x5e79d7,!![]);}catch(_0x125438){return BPromise[_0xc4e0('0x25')](_0x125438);}return _0x4bcfca['save']();};}function saveUpdates(_0x311557,_0x17714b){return function(_0x5c9435){if(_0x5c9435){return _0x5c9435[_0xc4e0('0x26')](_0x311557)[_0xc4e0('0x27')](function(_0x15b0d3){return _0x15b0d3;});}return null;};}function removeEntity(_0x26a45b,_0xa44e06){return function(_0x23e0f9){if(_0x23e0f9){return _0x23e0f9[_0xc4e0('0x28')]()[_0xc4e0('0x27')](function(){_0x26a45b[_0xc4e0('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x242afd,_0x1ae2b2){return function(_0x29db7f){if(!_0x29db7f){_0x242afd['sendStatus'](0x194);}return _0x29db7f;};}function handleError(_0x5cbe6c,_0x46b597){_0x46b597=_0x46b597||0x1f4;return function(_0x113bc3){logger[_0xc4e0('0x29')](_0x113bc3['stack']);if(_0x113bc3[_0xc4e0('0x2a')]){delete _0x113bc3['name'];}_0x5cbe6c[_0xc4e0('0x1c')](_0x46b597)['send'](_0x113bc3);};}function getInteractionUsers(_0x419016,_0x5cf7d9){return new BPromise(function(_0x270aca,_0x32c993){try{if(_0x5cf7d9[_0x419016['id']]){_0x419016['Users']=_[_0xc4e0('0x2b')](_0x5cf7d9[_0x419016['id']],function(_0x34f3c2){return{'id':_0x34f3c2['id'],'fullname':_0x34f3c2['fullname']};});}}catch(_0xb51cd8){_0x32c993(_0xb51cd8);}_0x270aca(_0x419016);});}function getInteractionTags(_0x4ba604,_0x31148d){return new BPromise(function(_0x255fe2,_0x11bc65){try{if(_0x4ba604[_0xc4e0('0x2c')]){_0x4ba604['Tags']=[];_0x4ba604[_0xc4e0('0x2c')][_0xc4e0('0x2d')](',')['forEach'](function(_0x290b64){_0x4ba604[_0xc4e0('0x2e')]['push'](_0x31148d[_0x290b64]);});}delete _0x4ba604[_0xc4e0('0x2c')];}catch(_0x32264e){_0x11bc65(_0x32264e);}_0x255fe2(_0x4ba604);});}function updateSmsInteraction(_0x1ba236,_0x5b823a,_0x3e59e5){return new BPromise(function(_0x564e12,_0x3858dd){return getInteractionUsers(_0x1ba236,_0x3e59e5)[_0xc4e0('0x27')](function(_0x43843b){return getInteractionTags(_0x43843b,_0x5b823a);})[_0xc4e0('0x27')](function(_0xb85aba){_0x564e12(_0xb85aba);})['catch'](function(_0x5e517d){_0x3858dd(_0x5e517d);});});}exports[_0xc4e0('0x2f')]=function(_0x5ae3f0,_0x3c599e){var _0x748c04={},_0x15e788={},_0x2be93a={'count':0x0,'rows':[]};var _0x2b95ec=_[_0xc4e0('0x2b')](db[_0xc4e0('0x30')][_0xc4e0('0x31')],function(_0x54515a){return{'name':_0x54515a[_0xc4e0('0x32')],'type':_0x54515a[_0xc4e0('0x33')][_0xc4e0('0x34')]};});_0x15e788[_0xc4e0('0x35')]=_[_0xc4e0('0x2b')](_0x2b95ec,'name');_0x15e788[_0xc4e0('0x36')]=_['keys'](_0x5ae3f0[_0xc4e0('0x36')]);_0x15e788['filters']=_['intersection'](_0x15e788[_0xc4e0('0x35')],_0x15e788[_0xc4e0('0x36')]);_0x748c04['attributes']=_[_0xc4e0('0x37')](_0x15e788['model'],qs['fields'](_0x5ae3f0[_0xc4e0('0x36')]['fields']));_0x748c04[_0xc4e0('0x38')]=_0x748c04[_0xc4e0('0x38')][_0xc4e0('0x39')]?_0x748c04['attributes']:_0x15e788[_0xc4e0('0x35')];if(!_0x5ae3f0[_0xc4e0('0x36')][_0xc4e0('0x3a')]('nolimit')){_0x748c04[_0xc4e0('0x20')]=qs[_0xc4e0('0x20')](_0x5ae3f0[_0xc4e0('0x36')]['limit']);_0x748c04[_0xc4e0('0x1e')]=qs[_0xc4e0('0x1e')](_0x5ae3f0[_0xc4e0('0x36')][_0xc4e0('0x1e')]);}_0x748c04[_0xc4e0('0x3b')]=qs['sort'](_0x5ae3f0[_0xc4e0('0x36')]['sort']);_0x748c04['where']=qs[_0xc4e0('0x3c')](_[_0xc4e0('0x3d')](_0x5ae3f0['query'],_0x15e788['filters']),_0x2b95ec);var _0x3a145a=[];var _0x543707=squel[_0xc4e0('0x3e')]()[_0xc4e0('0x3f')]('id')[_0xc4e0('0x3f')](_0xc4e0('0x2a'))[_0xc4e0('0x3f')](_0xc4e0('0x40'))[_0xc4e0('0x41')]('tools_tags');var _0x484c9e=squel['select']()[_0xc4e0('0x3f')](_0xc4e0('0x42'))[_0xc4e0('0x3f')](_0xc4e0('0x43'))[_0xc4e0('0x3f')]('ui.SmsInteractionId')[_0xc4e0('0x41')](_0xc4e0('0x44'),'ui')[_0xc4e0('0x45')](_0xc4e0('0x46'),'u',_0xc4e0('0x47'));var _0x5c5392=squel['select']()['from'](_0xc4e0('0x48'),'i')['left_join'](_0xc4e0('0x49'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xc4e0('0x45')](_0xc4e0('0x46'),'o','o.id\x20=\x20i.UserId')['left_join'](_0xc4e0('0x4a'),'a',_0xc4e0('0x4b'))[_0xc4e0('0x45')](_0xc4e0('0x4c'),'me','me.SmsInteractionId\x20=\x20i.id')[_0xc4e0('0x45')](_0xc4e0('0x4d'),'it',_0xc4e0('0x4e'))[_0xc4e0('0x45')](_0xc4e0('0x4f'),'t',_0xc4e0('0x50'));var _0x4d2f75=squel[_0xc4e0('0x51')]();var _0x486d14=[];var _0x54f56b=squel['expr']();var _0x134ad2;if(_0x5ae3f0[_0xc4e0('0x36')]['search']){_0x134ad2=as['parseSearch'](_0x5ae3f0[_0xc4e0('0x36')]['search']);var _0x1a333a=_0x134ad2[_0xc4e0('0x52')];for(var _0x5d7415=0x0;_0x5d7415<_0x134ad2[_0xc4e0('0x53')][_0xc4e0('0x39')];_0x5d7415++){var _0x3034d6=_0x134ad2['conditions'][_0x5d7415];var _0x168350='i';var _0x24f103=_[_0xc4e0('0x54')](_0x2b95ec,[_0xc4e0('0x2a'),_0x3034d6['field']]);if(!_0x24f103){switch(_0x3034d6[_0xc4e0('0x3f')]){case _0xc4e0('0x55'):if(_0x3034d6[_0xc4e0('0x56')]==0x1){_0x5c5392[_0xc4e0('0x57')]('`'+_0x3034d6[_0xc4e0('0x3f')]+_0xc4e0('0x58'));}else{_0x5c5392[_0xc4e0('0x57')]('`'+_0x3034d6[_0xc4e0('0x3f')]+_0xc4e0('0x59'));}break;case'Contact':if(_0x3034d6[_0xc4e0('0x5a')]===_0xc4e0('0x5b')){if(_0x3034d6['value'][_0xc4e0('0x2d')]('\x20')[_0xc4e0('0x39')]>0x1){_0x4d2f75[_0x1a333a]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc4e0('0x5c')](_0x3034d6[_0xc4e0('0x56')]),null);}else{var _0x1c594d='%'+_0x3034d6[_0xc4e0('0x56')]+'%';_0x4d2f75[_0x1a333a](_0xc4e0('0x5d'),_0x1c594d,_0x1c594d,_0x1c594d);}}else{_0x24f103=_[_0xc4e0('0x54')](_0x2b95ec,[_0xc4e0('0x2a'),_0xc4e0('0x5e')]);_0x3034d6[_0xc4e0('0x3f')]=_0xc4e0('0x5e');_0x5aca8c=as['buildExpression'](_0x168350,_0x24f103[_0xc4e0('0x33')],_0x3034d6);_0x4d2f75[_0x1a333a](_0x5aca8c['text'],_0x5aca8c[_0xc4e0('0x56')][_0xc4e0('0x5f')],_0x5aca8c[_0xc4e0('0x56')][_0xc4e0('0x60')]);}break;case _0xc4e0('0x61'):var _0x34847f=_0x3034d6[_0xc4e0('0x56')]['split'](',')[_0xc4e0('0x2b')](function(_0x25a404){return Number(_0x25a404);});_0x34847f[_0xc4e0('0x62')](function(_0x494af5){_0x54f56b['or'](_0xc4e0('0x63'),'%,'+_0x494af5+',%');});_0x486d14=_[_0xc4e0('0x64')](_0x486d14,_0x34847f);break;case _0xc4e0('0x65'):if(_0x3034d6[_0xc4e0('0x5a')]===_0xc4e0('0x5b')){_0x4d2f75[_0x1a333a](_0xc4e0('0x66'),'%'+_0x3034d6['value']+'%',null);}else{_0x24f103=_['find'](_0x2b95ec,['name',_0xc4e0('0x67')]);_0x3034d6['field']=_0xc4e0('0x67');_0x5aca8c=as[_0xc4e0('0x68')](_0x168350,_0x24f103['type'],_0x3034d6);_0x4d2f75[_0x1a333a](_0x5aca8c[_0xc4e0('0x69')],_0x5aca8c[_0xc4e0('0x56')]['start'],_0x5aca8c[_0xc4e0('0x56')][_0xc4e0('0x60')]);}break;case _0xc4e0('0x6a'):_0x5aca8c=as[_0xc4e0('0x68')]('me',null,_0x3034d6);_0x4d2f75[_0x1a333a](_0x5aca8c[_0xc4e0('0x69')],_0x5aca8c[_0xc4e0('0x56')]['start'],_0x5aca8c[_0xc4e0('0x56')][_0xc4e0('0x60')]);break;}}else{var _0x5aca8c=as['buildExpression'](_0x168350,_0x24f103[_0xc4e0('0x33')],_0x3034d6);_0x4d2f75[_0x1a333a](_0x5aca8c[_0xc4e0('0x69')],_0x5aca8c[_0xc4e0('0x56')][_0xc4e0('0x5f')],_0x5aca8c['value'][_0xc4e0('0x60')]);}}}else{var _0x2bc0f5=_(_0x5ae3f0['query'])[_0xc4e0('0x6b')]()[_0xc4e0('0x2b')](function(_0x53a90b){return _[_0xc4e0('0x6c')](_0x2b95ec,[_0xc4e0('0x2a'),_0x53a90b])?_0x53a90b:undefined;})[_0xc4e0('0x6d')]()[_0xc4e0('0x56')]();if(!_[_0xc4e0('0x6e')](_0x2bc0f5)){_0x2bc0f5[_0xc4e0('0x62')](function(_0x1f4420){if(_0x1f4420===_0xc4e0('0x6f')){_0x5c5392['where'](_0xc4e0('0x70'),[]['concat'](_0x5ae3f0[_0xc4e0('0x36')][_0x1f4420]));}else if(_0x1f4420==='createdAt'){var _0x8e3f49=JSON[_0xc4e0('0x71')](_0x5ae3f0[_0xc4e0('0x36')][_0x1f4420])[_0xc4e0('0x72')];var _0x55c0c1=JSON[_0xc4e0('0x71')](_0x5ae3f0['query'][_0x1f4420])[_0xc4e0('0x73')];_0x5c5392[_0xc4e0('0x74')](_0xc4e0('0x75'),_0x8e3f49,_0x55c0c1);}else{if(_0x5ae3f0[_0xc4e0('0x36')][_0x1f4420]===_0xc4e0('0x76')){_0x5c5392[_0xc4e0('0x74')]('i.'+_0x1f4420+_0xc4e0('0x77'));}else{_0x5c5392[_0xc4e0('0x74')]('i.'+_0x1f4420+_0xc4e0('0x78'),_0x5ae3f0[_0xc4e0('0x36')][_0x1f4420]);}}});}if(_0x5ae3f0['query'][_0xc4e0('0x79')]){if(_0x5ae3f0[_0xc4e0('0x36')]['read']==0x1){_0x5c5392[_0xc4e0('0x57')](_0xc4e0('0x7a'));}else{_0x5c5392[_0xc4e0('0x57')](_0xc4e0('0x7b'));}}if(_0x5ae3f0[_0xc4e0('0x36')][_0xc4e0('0x7c')]){_0x486d14=_['isArray'](_0x5ae3f0[_0xc4e0('0x36')][_0xc4e0('0x7c')])?_0x5ae3f0[_0xc4e0('0x36')]['tag']:new Array(_0x5ae3f0['query'][_0xc4e0('0x7c')]);_0x486d14[_0xc4e0('0x62')](function(_0x295298){_0x54f56b['or'](_0xc4e0('0x63'),'%,'+_0x295298+',%');});}if(_0x5ae3f0[_0xc4e0('0x36')][_0xc4e0('0x7d')]){var _0x1b1d42=_0x5ae3f0[_0xc4e0('0x36')][_0xc4e0('0x7d')]['replace']('\x5c','\x5c\x5c')[_0xc4e0('0x7e')](/'/g,'\x27\x27');if(qs[_0xc4e0('0x7f')](_0x1b1d42)){_0x4d2f75['or'](_0xc4e0('0x80'),_0x1b1d42+'%')['or'](_0xc4e0('0x81'),_0x1b1d42+'%');}else{_0x4d2f75['or'](_0xc4e0('0x82'),qs[_0xc4e0('0x5c')](_0x1b1d42))['or'](_0xc4e0('0x83'),_0x1b1d42+'%');}}}_0x5c5392[_0xc4e0('0x74')](_0x4d2f75);_0x5c5392['group'](_0xc4e0('0x84'));var _0x4ce38a={'type':db[_0xc4e0('0x85')][_0xc4e0('0x86')]['SELECT'],'raw':!![]};var _0x46b5e1=_0x5c5392['clone']();_0x46b5e1[_0xc4e0('0x3f')]('i.id');_0x46b5e1[_0xc4e0('0x3f')](_0xc4e0('0x87'),_0xc4e0('0x55'));if(_0x748c04[_0xc4e0('0x3b')]){_0x748c04[_0xc4e0('0x3b')]['forEach'](function(_0x352fb0){var _0x1a904b=_0x352fb0[0x0]===_0xc4e0('0x88')?_0x352fb0[0x0]:'i.'+_0x352fb0[0x0];_0x5c5392['order'](_0x1a904b,_0x352fb0[0x1]==='DESC'?![]:!![]);});}if(!_[_0xc4e0('0x6e')](_0x486d14)){_0x5c5392[_0xc4e0('0x57')](_0x54f56b);_0x46b5e1['where'](_0xc4e0('0x89'),_0x486d14);}BPromise[_0xc4e0('0x8a')]()[_0xc4e0('0x27')](function(){if(!_0x134ad2){if(_0x5ae3f0[_0xc4e0('0x36')]['SmsAccountId'])return;_0x46b5e1['where'](_0xc4e0('0x8b'));_0x5c5392[_0xc4e0('0x74')](_0xc4e0('0x8b'));return;}if(_0x5ae3f0[_0xc4e0('0x8c')][_0xc4e0('0x8d')]!=='agent')return;return _0x5ae3f0[_0xc4e0('0x8c')][_0xc4e0('0x8e')]({'attributes':['id'],'raw':!![]})[_0xc4e0('0x27')](function(_0x15a4af){if(_['isEmpty'](_0x15a4af)){_0x46b5e1[_0xc4e0('0x74')](_0xc4e0('0x8f'));_0x5c5392[_0xc4e0('0x74')](_0xc4e0('0x8f'));}else{_0x46b5e1[_0xc4e0('0x74')]('i.SmsAccountId\x20IN\x20?',_['map'](_0x15a4af,'id'));_0x5c5392[_0xc4e0('0x74')](_0xc4e0('0x70'),_[_0xc4e0('0x2b')](_0x15a4af,'id'));}});})[_0xc4e0('0x27')](function(){if(_0x5ae3f0['user'][_0xc4e0('0x8d')]==='agent'&&!_0x134ad2&&!_0x5ae3f0[_0xc4e0('0x36')][_0xc4e0('0x6f')])return[];return db['sequelize'][_0xc4e0('0x36')](_0x46b5e1['toString'](),_0x4ce38a);})[_0xc4e0('0x27')](function(_0x3a4be2){_0x2be93a[_0xc4e0('0x21')]=_0x3a4be2['length'];if(_0x2be93a[_0xc4e0('0x21')]===0x0)return[];return db[_0xc4e0('0x90')][_0xc4e0('0x36')](_0x543707[_0xc4e0('0x91')](),_0x4ce38a)[_0xc4e0('0x27')](function(_0x4dc140){_0x3a145a=_[_0xc4e0('0x92')](_0x4dc140,'id');_0x4ce38a=_[_0xc4e0('0x93')](_0x4ce38a,{'model':db[_0xc4e0('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5ae3f0[_0xc4e0('0x36')][_0xc4e0('0x94')]){_0x748c04[_0xc4e0('0x38')][_0xc4e0('0x62')](function(_0x4eefdd){_0x5c5392[_0xc4e0('0x3f')]('i.'+_0x4eefdd);});}else{_0x5c5392[_0xc4e0('0x3f')](_0xc4e0('0x87'),_0xc4e0('0x55'));_0x5c5392[_0xc4e0('0x3f')](_0xc4e0('0x95'),_0xc4e0('0x96'));_0x5c5392['field']('a.mandatoryDisposition',_0xc4e0('0x97'));_0x5c5392[_0xc4e0('0x3f')](_0xc4e0('0x98'),'contactName');_0x5c5392[_0xc4e0('0x3f')](_0xc4e0('0x99'));_0x5c5392[_0xc4e0('0x3f')](_0xc4e0('0x9a'),_0xc4e0('0x9b'));_0x5c5392[_0xc4e0('0x3f')](_0xc4e0('0x9c'),'Contact.lastName');_0x5c5392[_0xc4e0('0x3f')](_0xc4e0('0x9d'),_0xc4e0('0x9e'));_0x5c5392['field'](_0xc4e0('0x9f'),_0xc4e0('0xa0'));_0x5c5392[_0xc4e0('0x3f')](_0xc4e0('0xa1'),'Contact.mobile');_0x5c5392[_0xc4e0('0x3f')](_0xc4e0('0xa2'),_0xc4e0('0xa3'));_0x5c5392[_0xc4e0('0x3f')](_0xc4e0('0xa4'),'Owner.fullname');_0x5c5392['field'](_0xc4e0('0xa5'),_0xc4e0('0xa6'));_0x5c5392['field'](_0xc4e0('0xa7'),'TagIds');}if(_0x748c04['limit'])_0x5c5392[_0xc4e0('0x20')](_0x748c04[_0xc4e0('0x20')]);if(_0x748c04[_0xc4e0('0x1e')])_0x5c5392[_0xc4e0('0x1e')](_0x748c04[_0xc4e0('0x1e')]);return db[_0xc4e0('0x90')][_0xc4e0('0x36')](_0x5c5392[_0xc4e0('0x91')](),_0x4ce38a);})[_0xc4e0('0x27')](function(_0x19e44a){if(_0x19e44a[_0xc4e0('0x39')]>0x0)_0x484c9e[_0xc4e0('0x74')]('ui.SmsInteractionId\x20IN\x20?',_['map'](_0x19e44a,'id'));return db[_0xc4e0('0x90')]['query'](_0x484c9e[_0xc4e0('0x91')](),_0x4ce38a)[_0xc4e0('0x27')](function(_0xa0c365){var _0x2b8403=_[_0xc4e0('0xa8')](_0xa0c365,_0xc4e0('0xa9'));var _0xb18b64=[];_0x19e44a[_0xc4e0('0x62')](function(_0x5473e0){_0xb18b64['push'](updateSmsInteraction(_0x5473e0,_0x3a145a,_0x2b8403));});return BPromise[_0xc4e0('0xaa')](_0xb18b64);});});})[_0xc4e0('0x27')](function(_0x29e27d){_0x2be93a[_0xc4e0('0xab')]=_0x29e27d;return _0x2be93a;})[_0xc4e0('0x27')](respondWithFilteredResult(_0x3c599e,_0x748c04))[_0xc4e0('0xac')](handleError(_0x3c599e,null));};exports[_0xc4e0('0xad')]=function(_0x5c0f96,_0x3e7a05){var _0x34cf76={'raw':![],'where':{'id':_0x5c0f96['params']['id']}},_0x7e91f8={};_0x7e91f8[_0xc4e0('0x35')]=_[_0xc4e0('0x6b')](db[_0xc4e0('0x30')]['rawAttributes']);_0x7e91f8[_0xc4e0('0x36')]=_['keys'](_0x5c0f96[_0xc4e0('0x36')]);_0x7e91f8[_0xc4e0('0x3c')]=_['intersection'](_0x7e91f8[_0xc4e0('0x35')],_0x7e91f8[_0xc4e0('0x36')]);_0x34cf76[_0xc4e0('0x38')]=_['intersection'](_0x7e91f8[_0xc4e0('0x35')],qs['fields'](_0x5c0f96[_0xc4e0('0x36')][_0xc4e0('0x94')]));_0x34cf76['attributes']=_0x34cf76['attributes'][_0xc4e0('0x39')]?_0x34cf76[_0xc4e0('0x38')]:_0x7e91f8[_0xc4e0('0x35')];if(_0x5c0f96[_0xc4e0('0x36')][_0xc4e0('0xae')]){_0x34cf76[_0xc4e0('0xaf')]=[{'all':!![]}];}_0x34cf76=_[_0xc4e0('0x93')]({},_0x34cf76,_0x5c0f96['options']);return db['SmsInteraction'][_0xc4e0('0x54')](_0x34cf76)[_0xc4e0('0x27')](handleEntityNotFound(_0x3e7a05,null))[_0xc4e0('0x27')](respondWithResult(_0x3e7a05,null))[_0xc4e0('0xac')](handleError(_0x3e7a05,null));};exports[_0xc4e0('0xb0')]=function(_0x3ed8ed,_0x1cc3e4){return db[_0xc4e0('0x30')]['create'](_0x3ed8ed[_0xc4e0('0x6a')],{})['then'](respondWithResult(_0x1cc3e4,0xc9))[_0xc4e0('0xac')](handleError(_0x1cc3e4,null));};exports[_0xc4e0('0x26')]=function(_0x1f9162,_0x24d48e){if(_0x1f9162[_0xc4e0('0x6a')]['id']){delete _0x1f9162[_0xc4e0('0x6a')]['id'];}return db[_0xc4e0('0x30')][_0xc4e0('0x54')]({'where':{'id':_0x1f9162['params']['id']}})[_0xc4e0('0x27')](handleEntityNotFound(_0x24d48e,null))['then'](saveUpdates(_0x1f9162['body'],null))['then'](respondWithResult(_0x24d48e,null))[_0xc4e0('0xac')](handleError(_0x24d48e,null));};exports[_0xc4e0('0x28')]=function(_0x54a45b,_0x22353c){return db[_0xc4e0('0x30')][_0xc4e0('0x54')]({'where':{'id':_0x54a45b[_0xc4e0('0xb1')]['id']}})[_0xc4e0('0x27')](handleEntityNotFound(_0x22353c,null))[_0xc4e0('0x27')](removeEntity(_0x22353c,null))['catch'](handleError(_0x22353c,null));};exports['describe']=function(_0x119b0d,_0x5c9896){return db[_0xc4e0('0x30')][_0xc4e0('0xb2')]()[_0xc4e0('0x27')](respondWithResult(_0x5c9896,null))[_0xc4e0('0xac')](handleError(_0x5c9896,null));};exports[_0xc4e0('0xb3')]=function(_0x28b371,_0x225112,_0x56e239){return db['SmsMessage'][_0xc4e0('0x54')]({'where':{'id':_0x28b371['params']['id']}})[_0xc4e0('0x27')](handleEntityNotFound(_0x225112,null))[_0xc4e0('0x27')](function(_0x2367b3){if(_0x2367b3){return _0x2367b3[_0xc4e0('0xb3')](_0x28b371[_0xc4e0('0x6a')][_0xc4e0('0xb4')],_[_0xc4e0('0xb5')](_0x28b371[_0xc4e0('0x6a')],[_0xc4e0('0xb4'),'id'])||{});}})[_0xc4e0('0x27')](respondWithResult(_0x225112,null))[_0xc4e0('0xac')](handleError(_0x225112,null));};exports['getMessages']=function(_0x530e28,_0x1a4100,_0x4115e1){var _0xe48e1c={'raw':![],'where':{}};var _0x2c059b={};var _0x5cc9a3={'count':0x0,'rows':[]};return db[_0xc4e0('0x30')]['findOne']({'where':{'id':_0x530e28[_0xc4e0('0xb1')]['id']}})[_0xc4e0('0x27')](handleEntityNotFound(_0x1a4100,null))[_0xc4e0('0x27')](function(_0x233cd4){if(_0x233cd4){_0x2c059b[_0xc4e0('0x35')]=_[_0xc4e0('0x6b')](db[_0xc4e0('0xb6')][_0xc4e0('0x31')]);_0x2c059b[_0xc4e0('0x36')]=_[_0xc4e0('0x6b')](_0x530e28[_0xc4e0('0x36')]);_0x2c059b[_0xc4e0('0x3c')]=_[_0xc4e0('0x37')](_0x2c059b['model'],_0x2c059b[_0xc4e0('0x36')]);_0xe48e1c[_0xc4e0('0x38')]=_[_0xc4e0('0x37')](_0x2c059b[_0xc4e0('0x35')],qs[_0xc4e0('0x94')](_0x530e28[_0xc4e0('0x36')][_0xc4e0('0x94')]));_0xe48e1c[_0xc4e0('0x38')]=_0xe48e1c[_0xc4e0('0x38')][_0xc4e0('0x39')]?_0xe48e1c[_0xc4e0('0x38')]:_0x2c059b['model'];if(!_0x530e28[_0xc4e0('0x36')][_0xc4e0('0x3a')](_0xc4e0('0xb7'))){_0xe48e1c[_0xc4e0('0x20')]=qs[_0xc4e0('0x20')](_0x530e28[_0xc4e0('0x36')][_0xc4e0('0x20')]);_0xe48e1c[_0xc4e0('0x1e')]=qs[_0xc4e0('0x1e')](_0x530e28[_0xc4e0('0x36')][_0xc4e0('0x1e')]);}_0xe48e1c[_0xc4e0('0x3b')]=qs[_0xc4e0('0xb8')](_0x530e28[_0xc4e0('0x36')][_0xc4e0('0xb8')]);_0xe48e1c[_0xc4e0('0x74')]=qs[_0xc4e0('0x3c')](_[_0xc4e0('0x3d')](_0x530e28['query'],_0x2c059b[_0xc4e0('0x3c')]));_0xe48e1c['where'][_0xc4e0('0xa9')]=_0x233cd4['id'];if(_0x530e28[_0xc4e0('0x36')][_0xc4e0('0x7d')]){_0xe48e1c['where']=_[_0xc4e0('0x93')](_0xe48e1c['where'],{'$or':_['map'](_0xe48e1c[_0xc4e0('0x38')],function(_0x2d58f8){var _0x2f834d={};_0x2f834d[_0x2d58f8]={'$like':'%'+_0x530e28[_0xc4e0('0x36')][_0xc4e0('0x7d')]+'%'};return _0x2f834d;})});}if(_0x530e28[_0xc4e0('0x36')][_0xc4e0('0x72')]){var _0x1d1943=_0x530e28[_0xc4e0('0x36')]['$gte'][_0xc4e0('0x2d')](',');var _0x4b5c5d={};_0x4b5c5d[_0x1d1943[0x0]]={'$gte':moment(_0x1d1943[0x1])[_0xc4e0('0xb9')](_0xc4e0('0xba'))};_0xe48e1c[_0xc4e0('0x74')]=_[_0xc4e0('0x93')](_0xe48e1c[_0xc4e0('0x74')],_0x4b5c5d);}_0xe48e1c=_[_0xc4e0('0x93')]({},_0xe48e1c,_0x530e28[_0xc4e0('0xbb')]);return db['SmsMessage'][_0xc4e0('0x21')]({'where':_0xe48e1c[_0xc4e0('0x74')]})['then'](function(_0x12603e){_0x5cc9a3[_0xc4e0('0x21')]=_0x12603e;if(_0x530e28['query'][_0xc4e0('0xae')]){_0xe48e1c[_0xc4e0('0xaf')]=[{'all':!![]}];}return db[_0xc4e0('0xb6')]['findAll'](_0xe48e1c);})['then'](function(_0x3d5add){_0x5cc9a3[_0xc4e0('0xab')]=_0x3d5add;return _0x5cc9a3;});}})[_0xc4e0('0x27')](respondWithFilteredResult(_0x1a4100,_0xe48e1c))[_0xc4e0('0xac')](handleError(_0x1a4100,null));};exports[_0xc4e0('0xbc')]=function(_0x51d82e,_0x255f76,_0x3b6c63){return db[_0xc4e0('0x30')]['find']({'where':{'id':_0x51d82e[_0xc4e0('0xb1')]['id']}})[_0xc4e0('0x27')](handleEntityNotFound(_0x255f76,null))['then'](function(_0x16448b){if(_0x16448b){return _0x16448b[_0xc4e0('0xbd')](_0x51d82e[_0xc4e0('0x6a')][_0xc4e0('0xb4')],_[_0xc4e0('0xb5')](_0x51d82e['body'],[_0xc4e0('0xb4'),'id'])||{})['spread'](function(){return db['Tag'][_0xc4e0('0xbe')]({'attributes':['id','name',_0xc4e0('0x40')],'where':{'id':_0x51d82e[_0xc4e0('0x6a')][_0xc4e0('0xb4')]}});})[_0xc4e0('0x27')](function(_0x3df5f8){socket[_0xc4e0('0xbf')]('smsInteractionTags:save',{'id':Number(_0x51d82e[_0xc4e0('0xb1')]['id']),'tags':_0x3df5f8||[]});return{'id':Number(_0x51d82e[_0xc4e0('0xb1')]['id']),'tags':_0x3df5f8||[]};});}})['then'](respondWithResult(_0x255f76,null))[_0xc4e0('0xac')](handleError(_0x255f76,null));};exports[_0xc4e0('0xc0')]=function(_0x366d1f,_0x22f5de,_0x397c63){return db[_0xc4e0('0x30')][_0xc4e0('0x54')]({'where':{'id':_0x366d1f[_0xc4e0('0xb1')]['id']}})['then'](handleEntityNotFound(_0x22f5de,null))[_0xc4e0('0x27')](function(_0x58ebec){if(_0x58ebec){return _0x58ebec[_0xc4e0('0xc0')](_0x366d1f[_0xc4e0('0x36')]['ids']);}})[_0xc4e0('0x27')](respondWithStatusCode(_0x22f5de,null))[_0xc4e0('0xac')](handleError(_0x22f5de,null));};exports['download']=function(_0x47b913,_0x1d540d){var _0xd34e5b=moment()[_0xc4e0('0xc1')]()[_0xc4e0('0x91')]();var _0x4dbea2=path[_0xc4e0('0xc2')](config[_0xc4e0('0xc3')],_0xc4e0('0xc4'),_0xc4e0('0xc5'),'tmp');var _0x1bb988=path[_0xc4e0('0xc2')](config['root'],_0xc4e0('0xc4'),_0xc4e0('0xc5'),_0xc4e0('0xc6'));var _0x3b0f05=path[_0xc4e0('0xc2')](_0x4dbea2,_0xd34e5b);var _0x3bcbd6=util[_0xc4e0('0xb9')](_0xc4e0('0xc7'),_0x47b913[_0xc4e0('0xb1')]['id'],_0xd34e5b);var _0x2a418f=path[_0xc4e0('0xc2')](_0x4dbea2,_0x3bcbd6);var _0x9d37b4=[];_0x9d37b4[_0xc4e0('0xc8')]({'model':db[_0xc4e0('0x65')],'as':_0xc4e0('0x65'),'attributes':['id',_0xc4e0('0xc9')],'raw':!![]});_0x9d37b4[_0xc4e0('0xc8')]({'model':db[_0xc4e0('0xca')],'as':_0xc4e0('0xcb'),'attributes':['id','firstName','lastName'],'raw':!![]});var _0x3868ea=[{'model':db[_0xc4e0('0xb6')],'as':_0xc4e0('0xcc'),'attributes':['id',_0xc4e0('0x6a'),_0xc4e0('0xcd'),'direction',_0xc4e0('0xce'),_0xc4e0('0x79')],'include':_0x9d37b4}];_0x3868ea[_0xc4e0('0xc8')]({'model':db['SmsAccount'],'as':_0xc4e0('0xcf'),'attributes':['id',_0xc4e0('0x2a')]});_0x3868ea[_0xc4e0('0xc8')]({'model':db['User'],'as':_0xc4e0('0xd0'),'attributes':['id',_0xc4e0('0xc9')]});return db[_0xc4e0('0x30')][_0xc4e0('0x54')]({'where':{'id':_0x47b913[_0xc4e0('0xb1')]['id']},'include':_0x3868ea})['then'](handleEntityNotFound(_0x1d540d,null))[_0xc4e0('0x27')](function(_0x3aa8cb){if(_0x3aa8cb){var _0x5496b3=_0x3aa8cb[_0xc4e0('0xd1')]({'plain':!![]});fs[_0xc4e0('0xd2')](_0x3b0f05);var _0x3ef81e={'channel':'Sms','account':_0x5496b3[_0xc4e0('0xcf')][_0xc4e0('0x2a')],'agent':_0x5496b3[_0xc4e0('0xd0')]?_0x5496b3[_0xc4e0('0xd0')][_0xc4e0('0xc9')]:_0xc4e0('0xd3'),'createdAt':moment(_0x5496b3[_0xc4e0('0xcd')])[_0xc4e0('0xb9')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc4e0('0x91')](),'closedAt':_0x5496b3['closed']?moment(_0x5496b3['closedAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x5496b3[_0xc4e0('0xd4')],'messages':_(_0x5496b3['Messages'])['filter']({'secret':![]})[_0xc4e0('0x2b')](function(_0x2319bf){return{'date':moment(_0x2319bf[_0xc4e0('0xcd')])[_0xc4e0('0xb9')](_0xc4e0('0xba'))[_0xc4e0('0x91')](),'sender':_0x2319bf['direction']===_0xc4e0('0xd5')?_0x2319bf['User']?_0x2319bf[_0xc4e0('0x65')][_0xc4e0('0xc9')]:_0xc4e0('0xd6'):_0x2319bf['Contact'][_0xc4e0('0xd7')]+(_0x2319bf['Contact'][_0xc4e0('0xd8')]?'\x20'+_0x2319bf[_0xc4e0('0xcb')][_0xc4e0('0xd8')]:''),'body':_0x2319bf[_0xc4e0('0x6a')],'direction':_0x2319bf[_0xc4e0('0xd9')]===_0xc4e0('0xd5')?'A':'C','secret':_0x2319bf[_0xc4e0('0xce')],'read':_0x2319bf[_0xc4e0('0x79')]};})[_0xc4e0('0x56')]()};return ejs[_0xc4e0('0xda')](path[_0xc4e0('0xc2')](config[_0xc4e0('0xc3')],'server',_0xc4e0('0xdb'),_0xc4e0('0xdc')),{'interaction':_0x3ef81e})[_0xc4e0('0x27')](function(_0x8e4dd7){var _0x1ee0e8=path[_0xc4e0('0xc2')](_0x3b0f05,_0xc4e0('0xdd')+_0x5496b3['id']+'-'+_0xd34e5b+_0xc4e0('0xde'));var _0xa2297={'path':_0x1ee0e8,'channel':_0xc4e0('0xdf'),'interactionId':_0x5496b3['id']};return pdf[_0xc4e0('0xe0')](_0x8e4dd7,_0xa2297);})[_0xc4e0('0x27')](function(){return new BPromise(function(_0x4bc017,_0xc52390){zipdir(_0x3b0f05,{'saveTo':_0x2a418f},function(_0x33688f,_0xe67bc5){if(_0x33688f)return _0xc52390(_0x33688f);return _0x4bc017(_0xe67bc5);});})[_0xc4e0('0x27')](function(){return new BPromise(function(_0x1fd5df,_0x538f0d){rimraf(_0x3b0f05,function(_0x3ca572){if(_0x3ca572)_0x538f0d(_0x3ca572);return _0x1fd5df();});});})[_0xc4e0('0x27')](function(){return _0x1d540d['download'](_0x2a418f,_0x3bcbd6,function(_0x4f9da5){if(_0x4f9da5){console[_0xc4e0('0xe1')]('err',_0x4f9da5);}else{fs['unlinkSync'](_0x2a418f);}});});});}else{return _0x1d540d[_0xc4e0('0x1b')](0xc8);}})[_0xc4e0('0xac')](handleError(_0x1d540d,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 8aec5bc..69f59fe 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 _0xfb11=['setMaxListeners','update','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','emit','catch','hook','exports','events','SmsInteraction','../../mysqldb'];(function(_0x5b4c44,_0x2e495e){var _0x58485a=function(_0x13299b){while(--_0x13299b){_0x5b4c44['push'](_0x5b4c44['shift']());}};_0x58485a(++_0x2e495e);}(_0xfb11,0x1ad));var _0x1fb1=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xfb11[_0xae7c2f];return _0x5d7001;};'use strict';var EventEmitter=require(_0x1fb1('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0x1fb1('0x1')];var SmsMessage=require(_0x1fb1('0x2'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x1fb1('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1fb1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x190f74){return function(_0x2ae20f,_0x5af469,_0x25d44f){_0x2ae20f[_0x1fb1('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1859da){_0x2ae20f[_0x1fb1('0x6')](_0x1fb1('0x7'),_0x1859da[_0x1fb1('0x8')](function(_0x161e1b){return{'id':_0x161e1b['id']};}));return SmsMessage[_0x1fb1('0x9')]({'where':{'SmsInteractionId':_0x2ae20f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1fb1('0xa')](function(_0x416625){_0x2ae20f[_0x1fb1('0x6')](_0x1fb1('0xb'),_0x416625['length']);SmsInteractionEvents[_0x1fb1('0xc')](_0x190f74+':'+_0x2ae20f['id'],_0x2ae20f);SmsInteractionEvents['emit'](_0x190f74,_0x2ae20f);_0x25d44f(null);})[_0x1fb1('0xd')](_0x25d44f(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0x1fb1('0xe')](e,emitEvent(event));}}module[_0x1fb1('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x47c5=['setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage'];(function(_0x531b1e,_0x301978){var _0x1208b6=function(_0x3af74a){while(--_0x3af74a){_0x531b1e['push'](_0x531b1e['shift']());}};_0x1208b6(++_0x301978);}(_0x47c5,0x165));var _0x547c=function(_0x38782c,_0x5c9fef){_0x38782c=_0x38782c-0x0;var _0x3708bf=_0x47c5[_0x38782c];return _0x3708bf;};'use strict';var EventEmitter=require(_0x547c('0x0'));var SmsInteraction=require(_0x547c('0x1'))['db'][_0x547c('0x2')];var SmsMessage=require(_0x547c('0x1'))['db'][_0x547c('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x547c('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x547c('0x5'),'afterDestroy':_0x547c('0x6')};function emitEvent(_0x5b48c9){return function(_0x3e827e,_0x468220,_0x51ab7f){_0x3e827e[_0x547c('0x7')]({'attributes':['id'],'raw':!![]})[_0x547c('0x8')](function(_0x381f2e){_0x3e827e[_0x547c('0x9')](_0x547c('0xa'),_0x381f2e[_0x547c('0xb')](function(_0x3e2279){return{'id':_0x3e2279['id']};}));return SmsMessage[_0x547c('0xc')]({'where':{'SmsInteractionId':_0x3e827e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x547c('0x8')](function(_0x44a581){_0x3e827e[_0x547c('0x9')](_0x547c('0xd'),_0x44a581[_0x547c('0xe')]);SmsInteractionEvents[_0x547c('0xf')](_0x5b48c9+':'+_0x3e827e['id'],_0x3e827e);SmsInteractionEvents[_0x547c('0xf')](_0x5b48c9,_0x3e827e);_0x51ab7f(null);})[_0x547c('0x10')](_0x51ab7f(null));};}for(var e in events){if(events[_0x547c('0x11')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x547c('0x12')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index b5efc16..e32f806 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 _0xcfd1=['api','bluebird','request-promise','path','rimraf','../../config/environment','sms_interactions','changed','closed','closedAt','format','lodash','util','../../config/logger'];(function(_0x24c553,_0x533f6f){var _0x2b3671=function(_0x554063){while(--_0x554063){_0x24c553['push'](_0x24c553['shift']());}};_0x2b3671(++_0x533f6f);}(_0xcfd1,0x123));var _0x1cfd=function(_0x2aa22e,_0x69ec01){_0x2aa22e=_0x2aa22e-0x0;var _0x12bc07=_0xcfd1[_0x2aa22e];return _0x12bc07;};'use strict';var _=require(_0x1cfd('0x0'));var util=require(_0x1cfd('0x1'));var logger=require(_0x1cfd('0x2'))(_0x1cfd('0x3'));var moment=require('moment');var BPromise=require(_0x1cfd('0x4'));var rp=require(_0x1cfd('0x5'));var fs=require('fs');var path=require(_0x1cfd('0x6'));var rimraf=require(_0x1cfd('0x7'));var config=require(_0x1cfd('0x8'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x18faf9,_0xf3e22){return _0x18faf9['define']('SmsInteraction',attributes,{'tableName':_0x1cfd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x399780,_0x55a826,_0x18eea0){if(_0x399780[_0x1cfd('0xa')](_0x1cfd('0xb'))){_0x399780[_0x1cfd('0xc')]=moment()[_0x1cfd('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x18eea0(null,_0x399780);}}});}; \ No newline at end of file +var _0xe2f9=['define','SmsInteraction','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0xe2f9,0x73));var _0x9e2f=function(_0xc40ef6,_0x259173){_0xc40ef6=_0xc40ef6-0x0;var _0x38aa26=_0xe2f9[_0xc40ef6];return _0x38aa26;};'use strict';var _=require('lodash');var util=require(_0x9e2f('0x0'));var logger=require(_0x9e2f('0x1'))(_0x9e2f('0x2'));var moment=require(_0x9e2f('0x3'));var BPromise=require(_0x9e2f('0x4'));var rp=require(_0x9e2f('0x5'));var fs=require('fs');var path=require(_0x9e2f('0x6'));var rimraf=require(_0x9e2f('0x7'));var config=require(_0x9e2f('0x8'));var attributes=require(_0x9e2f('0x9'));module[_0x9e2f('0xa')]=function(_0x192f54,_0x52089b){return _0x192f54[_0x9e2f('0xb')](_0x9e2f('0xc'),attributes,{'tableName':_0x9e2f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b6d39,_0x5a23fe,_0x443c92){if(_0x4b6d39[_0x9e2f('0xe')]('closed')){_0x4b6d39[_0x9e2f('0xf')]=moment()[_0x9e2f('0x10')](_0x9e2f('0x11'));}_0x443c92(null,_0x4b6d39);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 54d9f5f..517457e 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 _0x18b3=['then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','AddTagsToSmsInteraction','find','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request'];(function(_0x25cf75,_0x549314){var _0x26c9f0=function(_0x1465c6){while(--_0x1465c6){_0x25cf75['push'](_0x25cf75['shift']());}};_0x26c9f0(++_0x549314);}(_0x18b3,0x1dc));var _0x318b=function(_0x20e7b2,_0x49d52a){_0x20e7b2=_0x20e7b2-0x0;var _0x4fdda9=_0x18b3[_0x20e7b2];return _0x4fdda9;};'use strict';var _=require(_0x318b('0x0'));var util=require('util');var moment=require(_0x318b('0x1'));var BPromise=require(_0x318b('0x2'));var rs=require(_0x318b('0x3'));var fs=require('fs');var Redis=require(_0x318b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x318b('0x5'))(_0x318b('0x6'));var config=require(_0x318b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x318b('0x8')]['http']({'port':0x232a});config[_0x318b('0x9')]=_[_0x318b('0xa')](config[_0x318b('0x9')],{'host':_0x318b('0xb'),'port':0x18eb});var socket=require(_0x318b('0xc'))(new Redis(config[_0x318b('0x9')]));require(_0x318b('0xd'))[_0x318b('0xe')](socket);function respondWithRpcPromise(_0x48afc4,_0x5c1265,_0x5bb66a){return new BPromise(function(_0x401b30,_0x25e338){return client[_0x318b('0xf')](_0x48afc4,_0x5bb66a)[_0x318b('0x10')](function(_0xcea963){logger[_0x318b('0x11')](_0x318b('0x12'),_0x5c1265,'request\x20sent');logger[_0x318b('0x13')](_0x318b('0x14'),_0x5c1265,_0x318b('0x15'),JSON[_0x318b('0x16')](_0xcea963));if(_0xcea963[_0x318b('0x17')]){if(_0xcea963['error']['code']===0x1f4){logger[_0x318b('0x17')](_0x318b('0x12'),_0x5c1265,_0xcea963['error'][_0x318b('0x18')]);return _0x25e338(_0xcea963['error'][_0x318b('0x18')]);}logger['error'](_0x318b('0x12'),_0x5c1265,_0xcea963[_0x318b('0x17')][_0x318b('0x18')]);return _0x401b30(_0xcea963[_0x318b('0x17')][_0x318b('0x18')]);}else{logger[_0x318b('0x11')](_0x318b('0x12'),_0x5c1265,_0x318b('0x15'));_0x401b30(_0xcea963[_0x318b('0x19')][_0x318b('0x18')]);}})[_0x318b('0x1a')](function(_0x38a80f){logger[_0x318b('0x17')](_0x318b('0x12'),_0x5c1265,_0x38a80f);_0x25e338(_0x38a80f);});});}exports[_0x318b('0x1b')]=function(_0x36a910){var _0x588455=this;return new Promise(function(_0x57c1de,_0x5e6b76){return db[_0x318b('0x1c')][_0x318b('0x1d')](_0x36a910[_0x318b('0x1e')],{'raw':_0x36a910[_0x318b('0x1f')]?_0x36a910['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36a910[_0x318b('0x1f')]?_0x36a910[_0x318b('0x1f')][_0x318b('0x20')]||null:null,'attributes':_0x36a910['options']?_0x36a910['options'][_0x318b('0x21')]||null:null,'limit':_0x36a910[_0x318b('0x1f')]?_0x36a910['options'][_0x318b('0x22')]||null:null})['then'](function(_0x519065){logger[_0x318b('0x11')](_0x318b('0x1b'),_0x36a910);logger[_0x318b('0x13')](_0x318b('0x1b'),_0x36a910,JSON['stringify'](_0x519065));_0x57c1de(_0x519065);})['catch'](function(_0x1cc5fc){logger['error']('UpdateSmsInteraction',_0x1cc5fc[_0x318b('0x18')],_0x36a910);_0x5e6b76(_0x588455[_0x318b('0x17')](0x1f4,_0x1cc5fc[_0x318b('0x18')]));});});};exports[_0x318b('0x23')]=function(_0x2636bd){return new Promise(function(_0x50473b,_0x52d383){return db[_0x318b('0x1c')][_0x318b('0x24')]({'where':_0x2636bd['options']?_0x2636bd[_0x318b('0x1f')]['where']||null:null})[_0x318b('0x10')](function(_0x1c4d6e){if(_0x1c4d6e){return _0x1c4d6e['addTags'](_0x2636bd[_0x318b('0x1e')][_0x318b('0x25')],_[_0x318b('0x26')](_0x2636bd[_0x318b('0x1e')],[_0x318b('0x25'),'id'])||{});}})[_0x318b('0x27')](function(_0x4ab26a){logger[_0x318b('0x11')]('AddTags',_0x2636bd);logger[_0x318b('0x13')](_0x318b('0x28'),_0x2636bd,JSON[_0x318b('0x16')](_0x4ab26a));_0x50473b(_0x4ab26a);})['catch'](function(_0x289697){logger[_0x318b('0x17')](_0x318b('0x28'),_0x289697[_0x318b('0x18')],_0x2636bd);_0x52d383(_this[_0x318b('0x17')](0x1f4,_0x289697[_0x318b('0x18')]));});});}; \ No newline at end of file +var _0x9d5d=['rpc','jayson/promise','client','http','defaults','redis','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','UpdateSmsInteraction','update','body','options','raw','where','attributes','limit','stringify','AddTagsToSmsInteraction','SmsInteraction','find','ids','omit','spread','AddTags','util','moment','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x369993,_0x2275e7){var _0x5f080b=function(_0x418c07){while(--_0x418c07){_0x369993['push'](_0x369993['shift']());}};_0x5f080b(++_0x2275e7);}(_0x9d5d,0x18b));var _0xd9d5=function(_0x3749e5,_0x157c71){_0x3749e5=_0x3749e5-0x0;var _0x5de565=_0x9d5d[_0x3749e5];return _0x5de565;};'use strict';var _=require('lodash');var util=require(_0xd9d5('0x0'));var moment=require(_0xd9d5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9d5('0x2'))['db'];var utils=require(_0xd9d5('0x3'));var logger=require(_0xd9d5('0x4'))(_0xd9d5('0x5'));var config=require('../../config/environment');var jayson=require(_0xd9d5('0x6'));var client=jayson[_0xd9d5('0x7')][_0xd9d5('0x8')]({'port':0x232a});config['redis']=_[_0xd9d5('0x9')](config[_0xd9d5('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd9d5('0xa')]));require(_0xd9d5('0xb'))[_0xd9d5('0xc')](socket);function respondWithRpcPromise(_0x6ede89,_0x57ec54,_0x134022){return new BPromise(function(_0x5c81f2,_0x773e03){return client[_0xd9d5('0xd')](_0x6ede89,_0x134022)[_0xd9d5('0xe')](function(_0x4e6800){logger['info'](_0xd9d5('0xf'),_0x57ec54,_0xd9d5('0x10'));logger[_0xd9d5('0x11')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x57ec54,_0xd9d5('0x10'),JSON['stringify'](_0x4e6800));if(_0x4e6800[_0xd9d5('0x12')]){if(_0x4e6800[_0xd9d5('0x12')][_0xd9d5('0x13')]===0x1f4){logger[_0xd9d5('0x12')](_0xd9d5('0xf'),_0x57ec54,_0x4e6800[_0xd9d5('0x12')]['message']);return _0x773e03(_0x4e6800[_0xd9d5('0x12')][_0xd9d5('0x14')]);}logger[_0xd9d5('0x12')](_0xd9d5('0xf'),_0x57ec54,_0x4e6800[_0xd9d5('0x12')]['message']);return _0x5c81f2(_0x4e6800['error']['message']);}else{logger[_0xd9d5('0x15')](_0xd9d5('0xf'),_0x57ec54,_0xd9d5('0x10'));_0x5c81f2(_0x4e6800[_0xd9d5('0x16')][_0xd9d5('0x14')]);}})[_0xd9d5('0x17')](function(_0x4cff77){logger[_0xd9d5('0x12')](_0xd9d5('0xf'),_0x57ec54,_0x4cff77);_0x773e03(_0x4cff77);});});}exports[_0xd9d5('0x18')]=function(_0x59e450){var _0x40df97=this;return new Promise(function(_0x322909,_0x5d4b4b){return db['SmsInteraction'][_0xd9d5('0x19')](_0x59e450[_0xd9d5('0x1a')],{'raw':_0x59e450[_0xd9d5('0x1b')]?_0x59e450[_0xd9d5('0x1b')][_0xd9d5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59e450[_0xd9d5('0x1b')]?_0x59e450[_0xd9d5('0x1b')][_0xd9d5('0x1d')]||null:null,'attributes':_0x59e450['options']?_0x59e450[_0xd9d5('0x1b')][_0xd9d5('0x1e')]||null:null,'limit':_0x59e450['options']?_0x59e450[_0xd9d5('0x1b')][_0xd9d5('0x1f')]||null:null})[_0xd9d5('0xe')](function(_0x4d7028){logger[_0xd9d5('0x15')](_0xd9d5('0x18'),_0x59e450);logger[_0xd9d5('0x11')](_0xd9d5('0x18'),_0x59e450,JSON[_0xd9d5('0x20')](_0x4d7028));_0x322909(_0x4d7028);})['catch'](function(_0xade5e8){logger[_0xd9d5('0x12')](_0xd9d5('0x18'),_0xade5e8[_0xd9d5('0x14')],_0x59e450);_0x5d4b4b(_0x40df97[_0xd9d5('0x12')](0x1f4,_0xade5e8[_0xd9d5('0x14')]));});});};exports[_0xd9d5('0x21')]=function(_0x557026){return new Promise(function(_0x527afe,_0x523974){return db[_0xd9d5('0x22')][_0xd9d5('0x23')]({'where':_0x557026[_0xd9d5('0x1b')]?_0x557026['options']['where']||null:null})['then'](function(_0x41578b){if(_0x41578b){return _0x41578b['addTags'](_0x557026[_0xd9d5('0x1a')][_0xd9d5('0x24')],_[_0xd9d5('0x25')](_0x557026[_0xd9d5('0x1a')],[_0xd9d5('0x24'),'id'])||{});}})[_0xd9d5('0x26')](function(_0x58e9db){logger[_0xd9d5('0x15')](_0xd9d5('0x27'),_0x557026);logger[_0xd9d5('0x11')](_0xd9d5('0x27'),_0x557026,JSON[_0xd9d5('0x20')](_0x58e9db));_0x527afe(_0x58e9db);})[_0xd9d5('0x17')](function(_0x26d6e8){logger['error']('AddTags',_0x26d6e8[_0xd9d5('0x14')],_0x557026);_0x523974(_this[_0xd9d5('0x12')](0x1f4,_0x26d6e8[_0xd9d5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 23111ad..ea40282 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 _0xbcf0=['./smsInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xbcf0,0xe7));var _0x0bcf=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xbcf0[_0x31e29a];return _0x32d892;};'use strict';var SmsInteractionEvents=require(_0x0bcf('0x0'));var events=[_0x0bcf('0x1'),_0x0bcf('0x2'),_0x0bcf('0x3')];function createListener(_0xa2bdd9,_0x355e35){return function(_0x5ee637){_0x355e35[_0x0bcf('0x4')](_0xa2bdd9,_0x5ee637);};}function removeListener(_0x5b0897,_0x3ecb7c){return function(){SmsInteractionEvents[_0x0bcf('0x5')](_0x5b0897,_0x3ecb7c);};}exports[_0x0bcf('0x6')]=function(_0x3ae75f){for(var _0xda9b4c=0x0,_0x41e80b=events['length'];_0xda9b4c<_0x41e80b;_0xda9b4c++){var _0x155293=events[_0xda9b4c];var _0x2fcd98=createListener('smsInteraction:'+_0x155293,_0x3ae75f);SmsInteractionEvents['on'](_0x155293,_0x2fcd98);}}; \ No newline at end of file +var _0x4184=['remove','update','emit','removeListener','length','smsInteraction:','./smsInteraction.events','save'];(function(_0x11cf4b,_0x16f6b2){var _0x1d2d59=function(_0x1ac3db){while(--_0x1ac3db){_0x11cf4b['push'](_0x11cf4b['shift']());}};_0x1d2d59(++_0x16f6b2);}(_0x4184,0xf6));var _0x4418=function(_0x325cb1,_0x12ecc9){_0x325cb1=_0x325cb1-0x0;var _0x17c757=_0x4184[_0x325cb1];return _0x17c757;};'use strict';var SmsInteractionEvents=require(_0x4418('0x0'));var events=[_0x4418('0x1'),_0x4418('0x2'),_0x4418('0x3')];function createListener(_0x154b5f,_0x3f3272){return function(_0x1640fc){_0x3f3272[_0x4418('0x4')](_0x154b5f,_0x1640fc);};}function removeListener(_0x3ea40d,_0x56e40f){return function(){SmsInteractionEvents[_0x4418('0x5')](_0x3ea40d,_0x56e40f);};}exports['register']=function(_0x11c3ad){for(var _0x4eead6=0x0,_0x106de7=events[_0x4418('0x6')];_0x4eead6<_0x106de7;_0x4eead6++){var _0x4daf80=events[_0x4eead6];var _0x22e046=createListener(_0x4418('0x7')+_0x4daf80,_0x11c3ad);SmsInteractionEvents['on'](_0x4daf80,_0x22e046);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 9e41388..1221afd 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 _0x1abc=['/:id','show','post','tracked','smsmessage:create','create','/:id/status','status','put','/:id/accept','accept','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','/describe','describe'];(function(_0x5106ee,_0x4a284b){var _0x469f0c=function(_0x3f7753){while(--_0x3f7753){_0x5106ee['push'](_0x5106ee['shift']());}};_0x469f0c(++_0x4a284b);}(_0x1abc,0x1ae));var _0xc1ab=function(_0x17913c,_0x5c687b){_0x17913c=_0x17913c-0x0;var _0x2c71af=_0x1abc[_0x17913c];return _0x2c71af;};'use strict';var multer=require(_0xc1ab('0x0'));var util=require(_0xc1ab('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc1ab('0x2')]();var fs_extra=require(_0xc1ab('0x3'));var auth=require(_0xc1ab('0x4'));var interaction=require(_0xc1ab('0x5'));var config=require(_0xc1ab('0x6'));var controller=require(_0xc1ab('0x7'));router[_0xc1ab('0x8')]('/',auth[_0xc1ab('0x9')](),controller['index']);router[_0xc1ab('0x8')](_0xc1ab('0xa'),auth[_0xc1ab('0x9')](),controller[_0xc1ab('0xb')]);router[_0xc1ab('0x8')](_0xc1ab('0xc'),auth['isAuthenticated'](),controller[_0xc1ab('0xd')]);router[_0xc1ab('0xe')]('/',auth[_0xc1ab('0x9')](),interaction[_0xc1ab('0xf')]('sms',_0xc1ab('0x10')),controller[_0xc1ab('0x11')]);router[_0xc1ab('0xe')](_0xc1ab('0x12'),controller[_0xc1ab('0x13')]);router[_0xc1ab('0x14')](_0xc1ab('0xc'),auth[_0xc1ab('0x9')](),controller['update']);router[_0xc1ab('0x14')](_0xc1ab('0x15'),auth[_0xc1ab('0x9')](),controller[_0xc1ab('0x16')]);router[_0xc1ab('0x14')]('/:id/reject',auth[_0xc1ab('0x9')](),controller['reject']);router[_0xc1ab('0x17')](_0xc1ab('0xc'),auth['isAuthenticated'](),controller[_0xc1ab('0x18')]);module[_0xc1ab('0x19')]=router; \ No newline at end of file +var _0x3ce9=['fs-extra','../../components/auth/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','post','tracked','smsmessage:create','/:id','update','/:id/accept','accept','put','reject','destroy','multer','path','connect-timeout','express','Router'];(function(_0x514d1b,_0x4f9d74){var _0x46021c=function(_0x587d3a){while(--_0x587d3a){_0x514d1b['push'](_0x514d1b['shift']());}};_0x46021c(++_0x4f9d74);}(_0x3ce9,0x85));var _0x93ce=function(_0x90e132,_0x57c03c){_0x90e132=_0x90e132-0x0;var _0x3c0e5e=_0x3ce9[_0x90e132];return _0x3c0e5e;};'use strict';var multer=require(_0x93ce('0x0'));var util=require('util');var path=require(_0x93ce('0x1'));var timeout=require(_0x93ce('0x2'));var express=require(_0x93ce('0x3'));var router=express[_0x93ce('0x4')]();var fs_extra=require(_0x93ce('0x5'));var auth=require(_0x93ce('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x93ce('0x7'));var controller=require(_0x93ce('0x8'));router[_0x93ce('0x9')]('/',auth[_0x93ce('0xa')](),controller[_0x93ce('0xb')]);router['get'](_0x93ce('0xc'),auth[_0x93ce('0xa')](),controller['describe']);router['get']('/:id',auth[_0x93ce('0xa')](),controller['show']);router[_0x93ce('0xd')]('/',auth['isAuthenticated'](),interaction[_0x93ce('0xe')]('sms',_0x93ce('0xf')),controller['create']);router['post']('/:id/status',controller['status']);router['put'](_0x93ce('0x10'),auth[_0x93ce('0xa')](),controller[_0x93ce('0x11')]);router['put'](_0x93ce('0x12'),auth['isAuthenticated'](),controller[_0x93ce('0x13')]);router[_0x93ce('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0x93ce('0x15')]);router['delete'](_0x93ce('0x10'),auth['isAuthenticated'](),controller[_0x93ce('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 18ccc9c..573938d 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 _0xe927=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x22c5a9,_0x300517){var _0x4729a0=function(_0x3998a3){while(--_0x3998a3){_0x22c5a9['push'](_0x22c5a9['shift']());}};_0x4729a0(++_0x300517);}(_0xe927,0x88));var _0x7e92=function(_0x99c2dd,_0x1d32eb){_0x99c2dd=_0x99c2dd-0x0;var _0x173349=_0xe927[_0x99c2dd];return _0x173349;};'use strict';var Sequelize=require(_0x7e92('0x0'));module['exports']={'body':{'type':Sequelize[_0x7e92('0x1')](_0x7e92('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7e92('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7e92('0x4')]('in',_0x7e92('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x7e92('0x6')](0xbe)},'phone':{'type':Sequelize[_0x7e92('0x6')]},'readAt':{'type':Sequelize[_0x7e92('0x7')]},'secret':{'type':Sequelize[_0x7e92('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xeb00=['STRING','DATE','TEXT','sequelize','exports','BOOLEAN','ENUM','out'];(function(_0x435149,_0x17b083){var _0x3b7975=function(_0x3feb61){while(--_0x3feb61){_0x435149['push'](_0x435149['shift']());}};_0x3b7975(++_0x17b083);}(_0xeb00,0x1bb));var _0x0eb0=function(_0x37fc0e,_0x472a64){_0x37fc0e=_0x37fc0e-0x0;var _0x47eddd=_0xeb00[_0x37fc0e];return _0x47eddd;};'use strict';var Sequelize=require(_0x0eb0('0x0'));module[_0x0eb0('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x0eb0('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0eb0('0x3')]('in',_0x0eb0('0x4')),'defaultValue':_0x0eb0('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0eb0('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x0eb0('0x6')]},'secret':{'type':Sequelize[_0x0eb0('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0eb0('0x5')]},'providerResponse':{'type':Sequelize[_0x0eb0('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 385f69f..0754684 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 _0xab9c=['include','rows','show','params','length','merge','find','create','update','body','describe','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','acceptmessage','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','QueryTypes','SELECT','event','EventManager','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','MessageUUID','messageId','indexOf','sent','delivered','SmsAccount,\x20%s,\x20%s,\x20%s','plivio','infobip','results','groupName','DELIVERED','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsMessage.socket','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','set','Content-Range','save','destroy','name','send','map','SmsMessage','fieldName','model','keys','filters','intersection','fields','query','attributes','hasOwnProperty','limit','order','pick','filter','where','type','options','includeAll'];(function(_0x4410a1,_0xd641ad){var _0x3687a0=function(_0x5bd24f){while(--_0x5bd24f){_0x4410a1['push'](_0x4410a1['shift']());}};_0x3687a0(++_0xd641ad);}(_0xab9c,0xd0));var _0xcab9=function(_0x3c3111,_0x2c1d33){_0x3c3111=_0x3c3111-0x0;var _0x4bb36f=_0xab9c[_0x3c3111];return _0x4bb36f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcab9('0x0'));var zipdir=require(_0xcab9('0x1'));var jsonpatch=require(_0xcab9('0x2'));var rp=require(_0xcab9('0x3'));var moment=require(_0xcab9('0x4'));var BPromise=require(_0xcab9('0x5'));var Mustache=require(_0xcab9('0x6'));var util=require(_0xcab9('0x7'));var path=require(_0xcab9('0x8'));var sox=require('sox');var csv=require(_0xcab9('0x9'));var ejs=require(_0xcab9('0xa'));var fs=require('fs');var fs_extra=require(_0xcab9('0xb'));var _=require('lodash');var squel=require(_0xcab9('0xc'));var crypto=require(_0xcab9('0xd'));var jsforce=require(_0xcab9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcab9('0x9'));var querystring=require(_0xcab9('0xf'));var Papa=require(_0xcab9('0x10'));var Redis=require(_0xcab9('0x11'));var authService=require(_0xcab9('0x12'));var qs=require(_0xcab9('0x13'));var as=require(_0xcab9('0x14'));var hardwareService=require(_0xcab9('0x15'));var logger=require(_0xcab9('0x16'))(_0xcab9('0x17'));var utils=require(_0xcab9('0x18'));var config=require(_0xcab9('0x19'));var licenseUtil=require(_0xcab9('0x1a'));var db=require(_0xcab9('0x1b'))['db'];config[_0xcab9('0x1c')]=_[_0xcab9('0x1d')](config[_0xcab9('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0xcab9('0x1e'))(new Redis(config[_0xcab9('0x1c')]));require(_0xcab9('0x1f'))['register'](socket);var jayson=require(_0xcab9('0x20'));var client=jayson[_0xcab9('0x21')][_0xcab9('0x22')]({'port':0x232c});var client9002=jayson[_0xcab9('0x21')][_0xcab9('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x4aa8db,_0x55f5fe,_0x13a650,_0x2b6625){return new BPromise(function(_0x75f08d,_0x187ac2){var _0x6aeb72=_0x2b6625||client;return _0x6aeb72[_0xcab9('0x23')](_0x4aa8db,_0x13a650)[_0xcab9('0x24')](function(_0x14bf60){logger[_0xcab9('0x25')](_0xcab9('0x26'),_0x55f5fe,_0xcab9('0x27'));logger[_0xcab9('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x55f5fe,'request\x20sent',JSON[_0xcab9('0x29')](_0x14bf60));if(_0x14bf60[_0xcab9('0x2a')]){if(_0x14bf60[_0xcab9('0x2a')][_0xcab9('0x2b')]===0x1f4){logger[_0xcab9('0x2a')](_0xcab9('0x26'),_0x55f5fe,_0x14bf60[_0xcab9('0x2a')][_0xcab9('0x2c')]);return _0x187ac2(_0x14bf60['error'][_0xcab9('0x2c')]);}logger[_0xcab9('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x55f5fe,_0x14bf60[_0xcab9('0x2a')][_0xcab9('0x2c')]);return _0x75f08d(_0x14bf60[_0xcab9('0x2a')][_0xcab9('0x2c')]);}else{logger[_0xcab9('0x25')](_0xcab9('0x26'),_0x55f5fe,_0xcab9('0x27'));_0x75f08d(_0x14bf60[_0xcab9('0x2d')]['message']);}})[_0xcab9('0x2e')](function(_0x5e1969){logger[_0xcab9('0x2a')]('SmsMessage,\x20%s,\x20%s',_0x55f5fe,_0x5e1969);_0x187ac2(_0x5e1969);});});}function respondWithStatusCode(_0x3ac15a,_0x467f80){_0x467f80=_0x467f80||0xcc;return function(_0x33ee8a){if(_0x33ee8a){return _0x3ac15a[_0xcab9('0x2f')](_0x467f80);}return _0x3ac15a[_0xcab9('0x30')](_0x467f80)[_0xcab9('0x31')]();};}function respondWithResult(_0x50b72f,_0x1f0e27){_0x1f0e27=_0x1f0e27||0xc8;return function(_0x393e0a){if(_0x393e0a){return _0x50b72f[_0xcab9('0x30')](_0x1f0e27)[_0xcab9('0x32')](_0x393e0a);}};}function respondWithFilteredResult(_0x29ae30,_0x2e7d42){return function(_0x2eb703){if(_0x2eb703){var _0x23e31e=typeof _0x2e7d42[_0xcab9('0x33')]==='undefined'&&typeof _0x2e7d42['limit']===_0xcab9('0x34');var _0x5efc62=_0x2eb703['count'];var _0xd8003=_0x23e31e?0x0:_0x2e7d42[_0xcab9('0x33')];var _0x5b0c51=_0x23e31e?_0x2eb703['count']:_0x2e7d42[_0xcab9('0x33')]+_0x2e7d42['limit'];var _0xeb273e;if(_0x5b0c51>=_0x5efc62){_0x5b0c51=_0x5efc62;_0xeb273e=0xc8;}else{_0xeb273e=0xce;}_0x29ae30[_0xcab9('0x30')](_0xeb273e);return _0x29ae30[_0xcab9('0x35')](_0xcab9('0x36'),_0xd8003+'-'+_0x5b0c51+'/'+_0x5efc62)['json'](_0x2eb703);}return null;};}function patchUpdates(_0xd4fe1a){return function(_0x387ce9){try{jsonpatch['apply'](_0x387ce9,_0xd4fe1a,!![]);}catch(_0x52d377){return BPromise['reject'](_0x52d377);}return _0x387ce9[_0xcab9('0x37')]();};}function saveUpdates(_0x25d1bb,_0x4ed73d){return function(_0x21459){if(_0x21459){return _0x21459['update'](_0x25d1bb)['then'](function(_0x518593){return _0x518593;});}return null;};}function removeEntity(_0x29de90,_0x3bb4a6){return function(_0x461545){if(_0x461545){return _0x461545[_0xcab9('0x38')]()[_0xcab9('0x24')](function(){_0x29de90[_0xcab9('0x30')](0xcc)[_0xcab9('0x31')]();});}};}function handleEntityNotFound(_0x363832,_0x441aea){return function(_0x49795e){if(!_0x49795e){_0x363832[_0xcab9('0x2f')](0x194);}return _0x49795e;};}function handleError(_0x985017,_0x58fe14){_0x58fe14=_0x58fe14||0x1f4;return function(_0x5da3d5){logger[_0xcab9('0x2a')](_0x5da3d5['stack']);if(_0x5da3d5['name']){delete _0x5da3d5[_0xcab9('0x39')];}_0x985017[_0xcab9('0x30')](_0x58fe14)[_0xcab9('0x3a')](_0x5da3d5);};}exports['index']=function(_0x552c59,_0x2cd74d){var _0x4fe417={},_0x43fea2={},_0x3df0a3={'count':0x0,'rows':[]};var _0x142b4c=_[_0xcab9('0x3b')](db[_0xcab9('0x3c')]['rawAttributes'],function(_0x3cfe57){return{'name':_0x3cfe57[_0xcab9('0x3d')],'type':_0x3cfe57['type']['key']};});_0x43fea2[_0xcab9('0x3e')]=_[_0xcab9('0x3b')](_0x142b4c,_0xcab9('0x39'));_0x43fea2['query']=_[_0xcab9('0x3f')](_0x552c59['query']);_0x43fea2[_0xcab9('0x40')]=_[_0xcab9('0x41')](_0x43fea2[_0xcab9('0x3e')],_0x43fea2['query']);_0x4fe417['attributes']=_[_0xcab9('0x41')](_0x43fea2[_0xcab9('0x3e')],qs[_0xcab9('0x42')](_0x552c59[_0xcab9('0x43')]['fields']));_0x4fe417[_0xcab9('0x44')]=_0x4fe417[_0xcab9('0x44')]['length']?_0x4fe417[_0xcab9('0x44')]:_0x43fea2[_0xcab9('0x3e')];if(!_0x552c59['query'][_0xcab9('0x45')]('nolimit')){_0x4fe417[_0xcab9('0x46')]=qs['limit'](_0x552c59['query'][_0xcab9('0x46')]);_0x4fe417[_0xcab9('0x33')]=qs[_0xcab9('0x33')](_0x552c59[_0xcab9('0x43')]['offset']);}_0x4fe417[_0xcab9('0x47')]=qs['sort'](_0x552c59[_0xcab9('0x43')]['sort']);_0x4fe417['where']=qs[_0xcab9('0x40')](_[_0xcab9('0x48')](_0x552c59[_0xcab9('0x43')],_0x43fea2['filters']),_0x142b4c);if(_0x552c59[_0xcab9('0x43')][_0xcab9('0x49')]){_0x4fe417[_0xcab9('0x4a')]=_['merge'](_0x4fe417[_0xcab9('0x4a')],{'$or':_[_0xcab9('0x3b')](_0x142b4c,function(_0x4d89eb){if(_0x4d89eb[_0xcab9('0x4b')]!=='VIRTUAL'){var _0x458b1c={};_0x458b1c[_0x4d89eb[_0xcab9('0x39')]]={'$like':'%'+_0x552c59['query'][_0xcab9('0x49')]+'%'};return _0x458b1c;}})});}_0x4fe417=_['merge']({},_0x4fe417,_0x552c59[_0xcab9('0x4c')]);var _0x499130={'where':_0x4fe417[_0xcab9('0x4a')]};return db[_0xcab9('0x3c')]['count'](_0x499130)[_0xcab9('0x24')](function(_0x31095f){_0x3df0a3['count']=_0x31095f;if(_0x552c59[_0xcab9('0x43')][_0xcab9('0x4d')]){_0x4fe417[_0xcab9('0x4e')]=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x4fe417);})[_0xcab9('0x24')](function(_0x22b218){_0x3df0a3[_0xcab9('0x4f')]=_0x22b218;return _0x3df0a3;})['then'](respondWithFilteredResult(_0x2cd74d,_0x4fe417))['catch'](handleError(_0x2cd74d,null));};exports[_0xcab9('0x50')]=function(_0x116d9f,_0x520b0e){var _0x548f49={'raw':!![],'where':{'id':_0x116d9f[_0xcab9('0x51')]['id']}},_0x55ac39={};_0x55ac39[_0xcab9('0x3e')]=_[_0xcab9('0x3f')](db[_0xcab9('0x3c')]['rawAttributes']);_0x55ac39['query']=_[_0xcab9('0x3f')](_0x116d9f['query']);_0x55ac39[_0xcab9('0x40')]=_[_0xcab9('0x41')](_0x55ac39[_0xcab9('0x3e')],_0x55ac39[_0xcab9('0x43')]);_0x548f49[_0xcab9('0x44')]=_[_0xcab9('0x41')](_0x55ac39[_0xcab9('0x3e')],qs[_0xcab9('0x42')](_0x116d9f[_0xcab9('0x43')][_0xcab9('0x42')]));_0x548f49['attributes']=_0x548f49[_0xcab9('0x44')][_0xcab9('0x52')]?_0x548f49[_0xcab9('0x44')]:_0x55ac39[_0xcab9('0x3e')];if(_0x116d9f['query']['includeAll']){_0x548f49[_0xcab9('0x4e')]=[{'all':!![]}];}_0x548f49=_[_0xcab9('0x53')]({},_0x548f49,_0x116d9f[_0xcab9('0x4c')]);return db[_0xcab9('0x3c')][_0xcab9('0x54')](_0x548f49)[_0xcab9('0x24')](handleEntityNotFound(_0x520b0e,null))[_0xcab9('0x24')](respondWithResult(_0x520b0e,null))[_0xcab9('0x2e')](handleError(_0x520b0e,null));};exports[_0xcab9('0x55')]=function(_0x5282f4,_0x58280c){return db[_0xcab9('0x3c')][_0xcab9('0x55')](_0x5282f4['body'],{})['then'](respondWithResult(_0x58280c,0xc9))[_0xcab9('0x2e')](handleError(_0x58280c,null));};exports[_0xcab9('0x56')]=function(_0x2bee8e,_0x5a2ce0){if(_0x2bee8e[_0xcab9('0x57')]['id']){delete _0x2bee8e[_0xcab9('0x57')]['id'];}return db[_0xcab9('0x3c')][_0xcab9('0x54')]({'where':{'id':_0x2bee8e['params']['id']}})[_0xcab9('0x24')](handleEntityNotFound(_0x5a2ce0,null))['then'](saveUpdates(_0x2bee8e[_0xcab9('0x57')],null))[_0xcab9('0x24')](respondWithResult(_0x5a2ce0,null))['catch'](handleError(_0x5a2ce0,null));};exports[_0xcab9('0x38')]=function(_0x4cea1d,_0x374eb3){return db['SmsMessage'][_0xcab9('0x54')]({'where':{'id':_0x4cea1d[_0xcab9('0x51')]['id']}})[_0xcab9('0x24')](handleEntityNotFound(_0x374eb3,null))[_0xcab9('0x24')](removeEntity(_0x374eb3,null))['catch'](handleError(_0x374eb3,null));};exports[_0xcab9('0x58')]=function(_0x400642,_0xdcfade){return db[_0xcab9('0x3c')][_0xcab9('0x58')]()[_0xcab9('0x24')](respondWithResult(_0xdcfade,null))[_0xcab9('0x2e')](handleError(_0xdcfade,null));};var interaction_log=require(_0xcab9('0x16'))(_0xcab9('0x59'));exports['accept']=function(_0x4df123,_0x810f74,_0x26aedf){var _0x454fa4={'agent':{},'channel':_0xcab9('0x5a')};if(_0x4df123[_0xcab9('0x57')]['id']){delete _0x4df123[_0xcab9('0x57')]['id'];}_0x4df123[_0xcab9('0x57')][_0xcab9('0x5b')]=!![];_0x4df123[_0xcab9('0x57')][_0xcab9('0x5c')]=moment()[_0xcab9('0x5d')](_0xcab9('0x5e'));_0x4df123['body'][_0xcab9('0x5f')]=_0x4df123[_0xcab9('0x57')][_0xcab9('0x5f')]||_0x4df123[_0xcab9('0x60')]['id'];_0x454fa4[_0xcab9('0x61')]['id']=_0x4df123[_0xcab9('0x57')][_0xcab9('0x5f')];return db[_0xcab9('0x3c')][_0xcab9('0x54')]({'where':{'id':_0x4df123[_0xcab9('0x51')]['id'],'UserId':null}})[_0xcab9('0x24')](handleEntityNotFound(_0x810f74,null))[_0xcab9('0x24')](saveUpdates(_0x4df123[_0xcab9('0x57')],null))[_0xcab9('0x24')](function(_0x4822f8){if(_0x4822f8){_0x454fa4[_0xcab9('0x2c')]=_0x4822f8[_0xcab9('0x62')]({'plain':!![]});return db[_0xcab9('0x63')][_0xcab9('0x54')]({'where':{'id':_0x4822f8[_0xcab9('0x64')]}});}return null;})[_0xcab9('0x24')](handleEntityNotFound(_0x810f74,null))['then'](function(_0x436340){if(_0x436340){return _0x436340['update']({'UserId':_0x4df123['body'][_0xcab9('0x5f')],'read1stAt':_[_0xcab9('0x65')](_0x436340[_0xcab9('0x66')])?moment()[_0xcab9('0x5d')](_0xcab9('0x5e')):undefined});}return null;})[_0xcab9('0x24')](function(_0x15ff3e){if(_0x15ff3e){_0x454fa4[_0xcab9('0x67')]=_0x15ff3e[_0xcab9('0x62')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4df123[_0xcab9('0x60')]['id'],_0x4df123[_0xcab9('0x60')][_0xcab9('0x39')],_0x4df123[_0xcab9('0x60')][_0xcab9('0x68')],_0x454fa4[_0xcab9('0x67')]['id'],_0x4df123['body']?JSON[_0xcab9('0x29')](_0x4df123[_0xcab9('0x57')]):_0xcab9('0x69'));return respondWithRpcPromise(_0xcab9('0x6a'),_0xcab9('0x6b'),_0x454fa4);}return null;})[_0xcab9('0x24')](function(_0x1517b7){var _0x2a6a47='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1517b7['message'][_0xcab9('0x6c')];return db[_0xcab9('0x6d')][_0xcab9('0x43')](_0x2a6a47,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0xcab9('0x24')](function(_0x5137d7){return _0x5137d7;});})[_0xcab9('0x24')](function(_0x272f39){if(_0x272f39){_0x454fa4[_0xcab9('0x2c')][_0xcab9('0x6e')]=_0x272f39[0x0];if(!_0x4df123[_0xcab9('0x57')][_0xcab9('0x5f')])return;return db[_0xcab9('0x6f')][_0xcab9('0x54')]({'where':{'id':_0x4df123['body']['UserId'],'role':_0xcab9('0x61')},'attributes':['id',_0xcab9('0x39'),_0xcab9('0x70'),_0xcab9('0x71'),_0xcab9('0x72')],'raw':!![]});}return null;})[_0xcab9('0x24')](function(_0x1407fc){if(!_0x1407fc)return null;_0x454fa4[_0xcab9('0x2c')][_0xcab9('0x61')]=_0x1407fc;return _0x454fa4;})[_0xcab9('0x24')](function(_0x2681a9){if(_0x2681a9){if(_0x4df123[_0xcab9('0x57')][_0xcab9('0x73')]){_0x454fa4[_0xcab9('0x2c')][_0xcab9('0x74')]=util[_0xcab9('0x5d')]('SIP/%s',_0x4df123[_0xcab9('0x60')][_0xcab9('0x39')]);_0x454fa4['message'][_0xcab9('0x75')]=_0x454fa4['channel'];_0x454fa4['message'][_0xcab9('0x76')]=_0x454fa4[_0xcab9('0x75')];_0x454fa4['message']['event']='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':_0xcab9('0x77'),'message':_0x454fa4[_0xcab9('0x2c')]},client9002)[_0xcab9('0x24')](function(){return _0x454fa4;});}return _0x454fa4;}return null;})[_0xcab9('0x24')](respondWithResult(_0x810f74,null))['catch'](handleError(_0x810f74,null));};var interaction_log=require(_0xcab9('0x16'))('sms-interactions');exports[_0xcab9('0x78')]=function(_0x58a2b1,_0x15426d,_0x49d87c){var _0x471b55={'agent':{},'channel':_0xcab9('0x5a')};if(_0x58a2b1[_0xcab9('0x57')]['id']){delete _0x58a2b1[_0xcab9('0x57')]['id'];}_0x58a2b1[_0xcab9('0x57')][_0xcab9('0x5f')]=_0x58a2b1[_0xcab9('0x57')][_0xcab9('0x5f')]||_0x58a2b1[_0xcab9('0x60')]['id'];_0x471b55['agent']['id']=_0x58a2b1[_0xcab9('0x57')][_0xcab9('0x5f')];return db[_0xcab9('0x3c')]['find']({'where':{'id':_0x58a2b1[_0xcab9('0x51')]['id'],'UserId':null}})[_0xcab9('0x24')](handleEntityNotFound(_0x15426d,null))[_0xcab9('0x24')](function(_0x504c17){if(_0x504c17){_0x471b55['message']=_0x504c17[_0xcab9('0x62')]({'plain':!![]});return db[_0xcab9('0x63')][_0xcab9('0x54')]({'where':{'id':_0x504c17['SmsInteractionId']}});}return null;})[_0xcab9('0x24')](handleEntityNotFound(_0x15426d,null))['then'](function(_0x4c84a9){if(_0x4c84a9){_0x471b55[_0xcab9('0x67')]=_0x4c84a9[_0xcab9('0x62')]({'plain':!![]});interaction_log[_0xcab9('0x25')](_0xcab9('0x79'),_0x58a2b1[_0xcab9('0x60')]['id'],_0x58a2b1['user'][_0xcab9('0x39')],_0x58a2b1[_0xcab9('0x60')]['role'],_0x471b55[_0xcab9('0x67')]['id'],_0x58a2b1['body']?JSON['stringify'](_0x58a2b1['body']):_0xcab9('0x69'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x471b55);}return null;})[_0xcab9('0x24')](function(_0x7c2d79){var _0x52aaf9='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x7c2d79['message'][_0xcab9('0x6c')];return db[_0xcab9('0x6d')][_0xcab9('0x43')](_0x52aaf9,{'type':db['Sequelize'][_0xcab9('0x7a')][_0xcab9('0x7b')],'raw':!![]})[_0xcab9('0x24')](function(_0x4696a0){return _0x4696a0;});})['then'](function(_0x34957d){if(_0x34957d){_0x471b55[_0xcab9('0x2c')][_0xcab9('0x6e')]=_0x34957d[0x0];if(!_0x58a2b1[_0xcab9('0x57')][_0xcab9('0x5f')])return;return db[_0xcab9('0x6f')]['find']({'where':{'id':_0x58a2b1[_0xcab9('0x57')][_0xcab9('0x5f')],'role':_0xcab9('0x61')},'attributes':['id',_0xcab9('0x39'),_0xcab9('0x70'),_0xcab9('0x71'),_0xcab9('0x72')],'raw':!![]});}return null;})[_0xcab9('0x24')](function(_0x2a080b){if(!_0x2a080b)return null;_0x471b55[_0xcab9('0x2c')][_0xcab9('0x61')]=_0x2a080b;return _0x471b55;})[_0xcab9('0x24')](function(_0x47ac27){if(_0x47ac27){_0x47ac27[_0xcab9('0x2c')][_0xcab9('0x74')]=util['format']('SIP/%s',_0x58a2b1['user']['name']);_0x47ac27['message']['channel']=_0x471b55[_0xcab9('0x75')];_0x47ac27[_0xcab9('0x2c')][_0xcab9('0x76')]=_0x471b55[_0xcab9('0x75')];_0x47ac27[_0xcab9('0x2c')][_0xcab9('0x7c')]=_0xcab9('0x78');respondWithRpcPromise('EventManager',_0xcab9('0x7d'),{'event':_0xcab9('0x7e'),'message':_0x47ac27['message']},client9002);return _0x471b55;}return null;})[_0xcab9('0x24')](respondWithResult(_0x15426d,null))[_0xcab9('0x2e')](handleError(_0x15426d,null));};exports[_0xcab9('0x30')]=function(_0x25b5bb,_0x4a2c6b,_0x1b4ff3){if(_0x25b5bb[_0xcab9('0x57')]['id']){delete _0x25b5bb[_0xcab9('0x57')]['id'];}var _0x12dfbb;return db[_0xcab9('0x3c')][_0xcab9('0x54')]({'where':{'id':_0x25b5bb[_0xcab9('0x51')]['id']}})[_0xcab9('0x24')](handleEntityNotFound(_0x4a2c6b,null))['then'](function(_0x432706){if(_0x432706){_0x12dfbb=_0x432706;return db[_0xcab9('0x7f')][_0xcab9('0x54')]({'where':{'id':_0x432706[_0xcab9('0x80')]}});}})[_0xcab9('0x24')](handleEntityNotFound(_0x4a2c6b,null))[_0xcab9('0x24')](function(_0x193570){if(_0x193570){logger['debug'](_0xcab9('0x81'),_0xcab9('0x30'),'received\x20delivery\x20report\x20from',_0x193570[_0xcab9('0x4b')],util[_0xcab9('0x82')](_0x25b5bb['body'],{'showHidden':![],'depth':null}));switch(_0x193570[_0xcab9('0x4b')]){case'twilio':if(_0x25b5bb['body']['MessageSid']&&_0x25b5bb[_0xcab9('0x57')][_0xcab9('0x83')]===_0x12dfbb['messageId']){return _0x12dfbb['update']({'read':!![]});}else{logger[_0xcab9('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcab9('0x30'),'twilio',util['inspect'](_0x25b5bb['body'],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x25b5bb[_0xcab9('0x57')][_0xcab9('0x84')]&&_0x25b5bb[_0xcab9('0x57')][_0xcab9('0x84')]===_0x12dfbb[_0xcab9('0x85')]&&_[_0xcab9('0x86')]([_0xcab9('0x87'),_0xcab9('0x88')],_0x25b5bb[_0xcab9('0x57')]['Status'])>=0x0){return _0x12dfbb[_0xcab9('0x56')]({'read':!![]});}else{logger[_0xcab9('0x2a')](_0xcab9('0x89'),_0xcab9('0x30'),_0xcab9('0x8a'),util[_0xcab9('0x82')](_0x25b5bb['body'],{'showHidden':![],'depth':null}));}break;case _0xcab9('0x8b'):var _0x4522f8=_0x25b5bb[_0xcab9('0x57')][_0xcab9('0x8c')][0x0];if(_0x4522f8[_0xcab9('0x30')][_0xcab9('0x8d')]===_0xcab9('0x8e')){return _0x12dfbb[_0xcab9('0x56')]({'read':!![]});}else{logger[_0xcab9('0x2a')](_0xcab9('0x89'),_0xcab9('0x30'),_0xcab9('0x8b'),util[_0xcab9('0x82')](_0x25b5bb[_0xcab9('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x12dfbb;}})[_0xcab9('0x24')](respondWithResult(_0x4a2c6b,null))[_0xcab9('0x2e')](handleError(_0x4a2c6b,null));}; \ No newline at end of file +var _0xa880=['SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','status','json','offset','limit','count','set','Content-Range','apply','reject','save','destroy','end','sendStatus','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','SmsMessage','findAll','rows','params','find','create','body','describe','accept','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteractionId','update','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','internal','agent','interface','SIP/%s','channel','event','EventManager','acceptmessage','sms-interactions','SmsInteraction','rejectMessage','ContactId','Sequelize','email','motionChannel','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','plivo','MessageUUID','messageId','sent','plivio','infobip','results','groupName','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','../../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','./smsMessage.socket','register','jayson/promise','http','client','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x26ec1c,_0x274d1b){var _0x3759c0=function(_0x27f626){while(--_0x27f626){_0x26ec1c['push'](_0x26ec1c['shift']());}};_0x3759c0(++_0x274d1b);}(_0xa880,0x106));var _0x0a88=function(_0x529a0f,_0x328763){_0x529a0f=_0x529a0f-0x0;var _0x187a88=_0xa880[_0x529a0f];return _0x187a88;};'use strict';var emlformat=require(_0x0a88('0x0'));var rimraf=require(_0x0a88('0x1'));var zipdir=require(_0x0a88('0x2'));var jsonpatch=require(_0x0a88('0x3'));var rp=require(_0x0a88('0x4'));var moment=require(_0x0a88('0x5'));var BPromise=require(_0x0a88('0x6'));var Mustache=require(_0x0a88('0x7'));var util=require(_0x0a88('0x8'));var path=require(_0x0a88('0x9'));var sox=require(_0x0a88('0xa'));var csv=require('to-csv');var ejs=require(_0x0a88('0xb'));var fs=require('fs');var fs_extra=require(_0x0a88('0xc'));var _=require(_0x0a88('0xd'));var squel=require(_0x0a88('0xe'));var crypto=require('crypto');var jsforce=require(_0x0a88('0xf'));var deskjs=require(_0x0a88('0x10'));var toCsv=require(_0x0a88('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0a88('0x12'));var qs=require(_0x0a88('0x13'));var as=require(_0x0a88('0x14'));var hardwareService=require(_0x0a88('0x15'));var logger=require(_0x0a88('0x16'))(_0x0a88('0x17'));var utils=require(_0x0a88('0x18'));var config=require(_0x0a88('0x19'));var licenseUtil=require(_0x0a88('0x1a'));var db=require(_0x0a88('0x1b'))['db'];config['redis']=_[_0x0a88('0x1c')](config[_0x0a88('0x1d')],{'host':_0x0a88('0x1e'),'port':0x18eb});var socket=require(_0x0a88('0x1f'))(new Redis(config['redis']));require(_0x0a88('0x20'))[_0x0a88('0x21')](socket);var jayson=require(_0x0a88('0x22'));var client=jayson['client'][_0x0a88('0x23')]({'port':0x232c});var client9002=jayson[_0x0a88('0x24')][_0x0a88('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x371834,_0x15ea01,_0x5bbe54,_0x42e3e8){return new BPromise(function(_0xe8c4c4,_0x68dbf9){var _0x4ce28d=_0x42e3e8||client;return _0x4ce28d[_0x0a88('0x25')](_0x371834,_0x5bbe54)[_0x0a88('0x26')](function(_0x22e3fe){logger['info'](_0x0a88('0x27'),_0x15ea01,_0x0a88('0x28'));logger[_0x0a88('0x29')](_0x0a88('0x2a'),_0x15ea01,_0x0a88('0x28'),JSON['stringify'](_0x22e3fe));if(_0x22e3fe[_0x0a88('0x2b')]){if(_0x22e3fe[_0x0a88('0x2b')][_0x0a88('0x2c')]===0x1f4){logger[_0x0a88('0x2b')](_0x0a88('0x27'),_0x15ea01,_0x22e3fe[_0x0a88('0x2b')][_0x0a88('0x2d')]);return _0x68dbf9(_0x22e3fe[_0x0a88('0x2b')][_0x0a88('0x2d')]);}logger[_0x0a88('0x2b')](_0x0a88('0x27'),_0x15ea01,_0x22e3fe[_0x0a88('0x2b')][_0x0a88('0x2d')]);return _0xe8c4c4(_0x22e3fe['error'][_0x0a88('0x2d')]);}else{logger[_0x0a88('0x2e')]('SmsMessage,\x20%s,\x20%s',_0x15ea01,_0x0a88('0x28'));_0xe8c4c4(_0x22e3fe[_0x0a88('0x2f')][_0x0a88('0x2d')]);}})[_0x0a88('0x30')](function(_0x2cd66d){logger['error']('SmsMessage,\x20%s,\x20%s',_0x15ea01,_0x2cd66d);_0x68dbf9(_0x2cd66d);});});}function respondWithStatusCode(_0x177b73,_0x4f5add){_0x4f5add=_0x4f5add||0xcc;return function(_0x53af1a){if(_0x53af1a){return _0x177b73['sendStatus'](_0x4f5add);}return _0x177b73['status'](_0x4f5add)['end']();};}function respondWithResult(_0x24ab6f,_0x330ed7){_0x330ed7=_0x330ed7||0xc8;return function(_0x5cee64){if(_0x5cee64){return _0x24ab6f[_0x0a88('0x31')](_0x330ed7)[_0x0a88('0x32')](_0x5cee64);}};}function respondWithFilteredResult(_0x5e40e7,_0xf29ba5){return function(_0x4deb90){if(_0x4deb90){var _0x4d8044=typeof _0xf29ba5[_0x0a88('0x33')]==='undefined'&&typeof _0xf29ba5[_0x0a88('0x34')]==='undefined';var _0x59a17d=_0x4deb90[_0x0a88('0x35')];var _0x28a8f3=_0x4d8044?0x0:_0xf29ba5[_0x0a88('0x33')];var _0x6cdf8=_0x4d8044?_0x4deb90[_0x0a88('0x35')]:_0xf29ba5[_0x0a88('0x33')]+_0xf29ba5['limit'];var _0x59bfd2;if(_0x6cdf8>=_0x59a17d){_0x6cdf8=_0x59a17d;_0x59bfd2=0xc8;}else{_0x59bfd2=0xce;}_0x5e40e7[_0x0a88('0x31')](_0x59bfd2);return _0x5e40e7[_0x0a88('0x36')](_0x0a88('0x37'),_0x28a8f3+'-'+_0x6cdf8+'/'+_0x59a17d)[_0x0a88('0x32')](_0x4deb90);}return null;};}function patchUpdates(_0x3d81ca){return function(_0x2de872){try{jsonpatch[_0x0a88('0x38')](_0x2de872,_0x3d81ca,!![]);}catch(_0x12f2ab){return BPromise[_0x0a88('0x39')](_0x12f2ab);}return _0x2de872[_0x0a88('0x3a')]();};}function saveUpdates(_0x1dad4a,_0x5db53d){return function(_0x58b48d){if(_0x58b48d){return _0x58b48d['update'](_0x1dad4a)[_0x0a88('0x26')](function(_0x1bdf8e){return _0x1bdf8e;});}return null;};}function removeEntity(_0x15ddbc,_0xfb9cc3){return function(_0x1e8477){if(_0x1e8477){return _0x1e8477[_0x0a88('0x3b')]()[_0x0a88('0x26')](function(){_0x15ddbc[_0x0a88('0x31')](0xcc)[_0x0a88('0x3c')]();});}};}function handleEntityNotFound(_0x165cec,_0x57233a){return function(_0x1a922a){if(!_0x1a922a){_0x165cec[_0x0a88('0x3d')](0x194);}return _0x1a922a;};}function handleError(_0x3f16c7,_0x440cc2){_0x440cc2=_0x440cc2||0x1f4;return function(_0x376514){logger['error'](_0x376514[_0x0a88('0x3e')]);if(_0x376514[_0x0a88('0x3f')]){delete _0x376514['name'];}_0x3f16c7[_0x0a88('0x31')](_0x440cc2)['send'](_0x376514);};}exports[_0x0a88('0x40')]=function(_0x148faa,_0x1f636e){var _0x1c0fa8={},_0x4454be={},_0x102f91={'count':0x0,'rows':[]};var _0x263e64=_[_0x0a88('0x41')](db['SmsMessage'][_0x0a88('0x42')],function(_0x25747a){return{'name':_0x25747a[_0x0a88('0x43')],'type':_0x25747a['type'][_0x0a88('0x44')]};});_0x4454be[_0x0a88('0x45')]=_[_0x0a88('0x41')](_0x263e64,_0x0a88('0x3f'));_0x4454be[_0x0a88('0x46')]=_[_0x0a88('0x47')](_0x148faa['query']);_0x4454be[_0x0a88('0x48')]=_['intersection'](_0x4454be[_0x0a88('0x45')],_0x4454be['query']);_0x1c0fa8[_0x0a88('0x49')]=_[_0x0a88('0x4a')](_0x4454be[_0x0a88('0x45')],qs[_0x0a88('0x4b')](_0x148faa[_0x0a88('0x46')][_0x0a88('0x4b')]));_0x1c0fa8[_0x0a88('0x49')]=_0x1c0fa8[_0x0a88('0x49')][_0x0a88('0x4c')]?_0x1c0fa8[_0x0a88('0x49')]:_0x4454be[_0x0a88('0x45')];if(!_0x148faa[_0x0a88('0x46')][_0x0a88('0x4d')](_0x0a88('0x4e'))){_0x1c0fa8[_0x0a88('0x34')]=qs['limit'](_0x148faa[_0x0a88('0x46')][_0x0a88('0x34')]);_0x1c0fa8['offset']=qs[_0x0a88('0x33')](_0x148faa[_0x0a88('0x46')]['offset']);}_0x1c0fa8['order']=qs['sort'](_0x148faa[_0x0a88('0x46')][_0x0a88('0x4f')]);_0x1c0fa8[_0x0a88('0x50')]=qs['filters'](_[_0x0a88('0x51')](_0x148faa[_0x0a88('0x46')],_0x4454be[_0x0a88('0x48')]),_0x263e64);if(_0x148faa['query']['filter']){_0x1c0fa8[_0x0a88('0x50')]=_[_0x0a88('0x52')](_0x1c0fa8[_0x0a88('0x50')],{'$or':_[_0x0a88('0x41')](_0x263e64,function(_0x258f52){if(_0x258f52[_0x0a88('0x53')]!==_0x0a88('0x54')){var _0x30dbd8={};_0x30dbd8[_0x258f52[_0x0a88('0x3f')]]={'$like':'%'+_0x148faa['query'][_0x0a88('0x55')]+'%'};return _0x30dbd8;}})});}_0x1c0fa8=_[_0x0a88('0x52')]({},_0x1c0fa8,_0x148faa[_0x0a88('0x56')]);var _0x26c563={'where':_0x1c0fa8[_0x0a88('0x50')]};return db['SmsMessage']['count'](_0x26c563)[_0x0a88('0x26')](function(_0x3597b2){_0x102f91[_0x0a88('0x35')]=_0x3597b2;if(_0x148faa['query'][_0x0a88('0x57')]){_0x1c0fa8[_0x0a88('0x58')]=[{'all':!![]}];}return db[_0x0a88('0x59')][_0x0a88('0x5a')](_0x1c0fa8);})['then'](function(_0x164e2e){_0x102f91[_0x0a88('0x5b')]=_0x164e2e;return _0x102f91;})[_0x0a88('0x26')](respondWithFilteredResult(_0x1f636e,_0x1c0fa8))[_0x0a88('0x30')](handleError(_0x1f636e,null));};exports['show']=function(_0x871812,_0x5cf277){var _0x54c92b={'raw':!![],'where':{'id':_0x871812[_0x0a88('0x5c')]['id']}},_0x4e60eb={};_0x4e60eb[_0x0a88('0x45')]=_[_0x0a88('0x47')](db['SmsMessage']['rawAttributes']);_0x4e60eb[_0x0a88('0x46')]=_[_0x0a88('0x47')](_0x871812[_0x0a88('0x46')]);_0x4e60eb[_0x0a88('0x48')]=_[_0x0a88('0x4a')](_0x4e60eb[_0x0a88('0x45')],_0x4e60eb[_0x0a88('0x46')]);_0x54c92b[_0x0a88('0x49')]=_[_0x0a88('0x4a')](_0x4e60eb['model'],qs['fields'](_0x871812[_0x0a88('0x46')][_0x0a88('0x4b')]));_0x54c92b['attributes']=_0x54c92b[_0x0a88('0x49')][_0x0a88('0x4c')]?_0x54c92b['attributes']:_0x4e60eb[_0x0a88('0x45')];if(_0x871812[_0x0a88('0x46')][_0x0a88('0x57')]){_0x54c92b[_0x0a88('0x58')]=[{'all':!![]}];}_0x54c92b=_[_0x0a88('0x52')]({},_0x54c92b,_0x871812[_0x0a88('0x56')]);return db['SmsMessage'][_0x0a88('0x5d')](_0x54c92b)['then'](handleEntityNotFound(_0x5cf277,null))[_0x0a88('0x26')](respondWithResult(_0x5cf277,null))[_0x0a88('0x30')](handleError(_0x5cf277,null));};exports['create']=function(_0x1857ba,_0x5b2e37){return db[_0x0a88('0x59')][_0x0a88('0x5e')](_0x1857ba[_0x0a88('0x5f')],{})[_0x0a88('0x26')](respondWithResult(_0x5b2e37,0xc9))['catch'](handleError(_0x5b2e37,null));};exports['update']=function(_0x350ff3,_0x1d92e3){if(_0x350ff3[_0x0a88('0x5f')]['id']){delete _0x350ff3[_0x0a88('0x5f')]['id'];}return db['SmsMessage']['find']({'where':{'id':_0x350ff3[_0x0a88('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1d92e3,null))[_0x0a88('0x26')](saveUpdates(_0x350ff3[_0x0a88('0x5f')],null))[_0x0a88('0x26')](respondWithResult(_0x1d92e3,null))['catch'](handleError(_0x1d92e3,null));};exports[_0x0a88('0x3b')]=function(_0x2b72e3,_0x301643){return db[_0x0a88('0x59')][_0x0a88('0x5d')]({'where':{'id':_0x2b72e3[_0x0a88('0x5c')]['id']}})[_0x0a88('0x26')](handleEntityNotFound(_0x301643,null))[_0x0a88('0x26')](removeEntity(_0x301643,null))[_0x0a88('0x30')](handleError(_0x301643,null));};exports[_0x0a88('0x60')]=function(_0xb3f0fe,_0x30603d){return db['SmsMessage']['describe']()[_0x0a88('0x26')](respondWithResult(_0x30603d,null))[_0x0a88('0x30')](handleError(_0x30603d,null));};var interaction_log=require(_0x0a88('0x16'))('sms-interactions');exports[_0x0a88('0x61')]=function(_0x13dab6,_0x401e4e,_0x537f3c){var _0x427953={'agent':{},'channel':_0x0a88('0x62')};if(_0x13dab6[_0x0a88('0x5f')]['id']){delete _0x13dab6[_0x0a88('0x5f')]['id'];}_0x13dab6[_0x0a88('0x5f')][_0x0a88('0x63')]=!![];_0x13dab6[_0x0a88('0x5f')][_0x0a88('0x64')]=moment()[_0x0a88('0x65')](_0x0a88('0x66'));_0x13dab6[_0x0a88('0x5f')][_0x0a88('0x67')]=_0x13dab6['body'][_0x0a88('0x67')]||_0x13dab6[_0x0a88('0x68')]['id'];_0x427953['agent']['id']=_0x13dab6[_0x0a88('0x5f')][_0x0a88('0x67')];return db[_0x0a88('0x59')]['find']({'where':{'id':_0x13dab6['params']['id'],'UserId':null}})[_0x0a88('0x26')](handleEntityNotFound(_0x401e4e,null))[_0x0a88('0x26')](saveUpdates(_0x13dab6['body'],null))[_0x0a88('0x26')](function(_0x13cd21){if(_0x13cd21){_0x427953['message']=_0x13cd21[_0x0a88('0x69')]({'plain':!![]});return db['SmsInteraction'][_0x0a88('0x5d')]({'where':{'id':_0x13cd21[_0x0a88('0x6a')]}});}return null;})[_0x0a88('0x26')](handleEntityNotFound(_0x401e4e,null))[_0x0a88('0x26')](function(_0x3078cf){if(_0x3078cf){return _0x3078cf[_0x0a88('0x6b')]({'UserId':_0x13dab6[_0x0a88('0x5f')]['UserId'],'read1stAt':_[_0x0a88('0x6c')](_0x3078cf[_0x0a88('0x6d')])?moment()[_0x0a88('0x65')](_0x0a88('0x66')):undefined});}return null;})[_0x0a88('0x26')](function(_0x2082e8){if(_0x2082e8){_0x427953[_0x0a88('0x6e')]=_0x2082e8[_0x0a88('0x69')]({'plain':!![]});interaction_log[_0x0a88('0x2e')](_0x0a88('0x6f'),_0x13dab6['user']['id'],_0x13dab6[_0x0a88('0x68')][_0x0a88('0x3f')],_0x13dab6[_0x0a88('0x68')][_0x0a88('0x70')],_0x427953[_0x0a88('0x6e')]['id'],_0x13dab6[_0x0a88('0x5f')]?JSON[_0x0a88('0x71')](_0x13dab6['body']):'null');return respondWithRpcPromise(_0x0a88('0x72'),_0x0a88('0x73'),_0x427953);}return null;})[_0x0a88('0x26')](function(_0x2d314b){var _0x567a5a=_0x0a88('0x74')+_0x2d314b['message']['ContactId'];return db[_0x0a88('0x75')][_0x0a88('0x46')](_0x567a5a,{'type':db['Sequelize'][_0x0a88('0x76')]['SELECT'],'raw':!![]})[_0x0a88('0x26')](function(_0xeb8236){return _0xeb8236;});})['then'](function(_0x376296){if(_0x376296){_0x427953[_0x0a88('0x2d')][_0x0a88('0x77')]=_0x376296[0x0];if(!_0x13dab6[_0x0a88('0x5f')][_0x0a88('0x67')])return;return db['User'][_0x0a88('0x5d')]({'where':{'id':_0x13dab6['body'][_0x0a88('0x67')],'role':'agent'},'attributes':['id',_0x0a88('0x3f'),'fullname','email',_0x0a88('0x78')],'raw':!![]});}return null;})['then'](function(_0x1c1f20){if(!_0x1c1f20)return null;_0x427953[_0x0a88('0x2d')][_0x0a88('0x79')]=_0x1c1f20;return _0x427953;})[_0x0a88('0x26')](function(_0x2e69ad){if(_0x2e69ad){if(_0x13dab6[_0x0a88('0x5f')]['manual']){_0x427953[_0x0a88('0x2d')][_0x0a88('0x7a')]=util[_0x0a88('0x65')](_0x0a88('0x7b'),_0x13dab6[_0x0a88('0x68')][_0x0a88('0x3f')]);_0x427953[_0x0a88('0x2d')][_0x0a88('0x7c')]=_0x427953['channel'];_0x427953[_0x0a88('0x2d')]['motionChannel']=_0x427953['channel'];_0x427953[_0x0a88('0x2d')][_0x0a88('0x7d')]=_0x0a88('0x61');return respondWithRpcPromise(_0x0a88('0x7e'),_0x0a88('0x7e'),{'event':_0x0a88('0x7f'),'message':_0x427953['message']},client9002)[_0x0a88('0x26')](function(){return _0x427953;});}return _0x427953;}return null;})[_0x0a88('0x26')](respondWithResult(_0x401e4e,null))[_0x0a88('0x30')](handleError(_0x401e4e,null));};var interaction_log=require(_0x0a88('0x16'))(_0x0a88('0x80'));exports[_0x0a88('0x39')]=function(_0x4d658b,_0x4ac92d,_0x3b1bf8){var _0x562a95={'agent':{},'channel':_0x0a88('0x62')};if(_0x4d658b[_0x0a88('0x5f')]['id']){delete _0x4d658b['body']['id'];}_0x4d658b[_0x0a88('0x5f')][_0x0a88('0x67')]=_0x4d658b[_0x0a88('0x5f')][_0x0a88('0x67')]||_0x4d658b['user']['id'];_0x562a95[_0x0a88('0x79')]['id']=_0x4d658b['body'][_0x0a88('0x67')];return db[_0x0a88('0x59')]['find']({'where':{'id':_0x4d658b[_0x0a88('0x5c')]['id'],'UserId':null}})[_0x0a88('0x26')](handleEntityNotFound(_0x4ac92d,null))[_0x0a88('0x26')](function(_0x5327ca){if(_0x5327ca){_0x562a95[_0x0a88('0x2d')]=_0x5327ca[_0x0a88('0x69')]({'plain':!![]});return db[_0x0a88('0x81')][_0x0a88('0x5d')]({'where':{'id':_0x5327ca[_0x0a88('0x6a')]}});}return null;})[_0x0a88('0x26')](handleEntityNotFound(_0x4ac92d,null))[_0x0a88('0x26')](function(_0xea58bc){if(_0xea58bc){_0x562a95[_0x0a88('0x6e')]=_0xea58bc[_0x0a88('0x69')]({'plain':!![]});interaction_log[_0x0a88('0x2e')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4d658b[_0x0a88('0x68')]['id'],_0x4d658b[_0x0a88('0x68')][_0x0a88('0x3f')],_0x4d658b['user'][_0x0a88('0x70')],_0x562a95[_0x0a88('0x6e')]['id'],_0x4d658b['body']?JSON[_0x0a88('0x71')](_0x4d658b[_0x0a88('0x5f')]):'null');return respondWithRpcPromise('RejectMessage',_0x0a88('0x82'),_0x562a95);}return null;})[_0x0a88('0x26')](function(_0x482ffc){var _0x343a3c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x482ffc[_0x0a88('0x2d')][_0x0a88('0x83')];return db[_0x0a88('0x75')][_0x0a88('0x46')](_0x343a3c,{'type':db[_0x0a88('0x84')][_0x0a88('0x76')]['SELECT'],'raw':!![]})[_0x0a88('0x26')](function(_0x2048e0){return _0x2048e0;});})[_0x0a88('0x26')](function(_0x31af26){if(_0x31af26){_0x562a95['message'][_0x0a88('0x77')]=_0x31af26[0x0];if(!_0x4d658b['body'][_0x0a88('0x67')])return;return db['User'][_0x0a88('0x5d')]({'where':{'id':_0x4d658b['body'][_0x0a88('0x67')],'role':_0x0a88('0x79')},'attributes':['id',_0x0a88('0x3f'),'fullname',_0x0a88('0x85'),_0x0a88('0x78')],'raw':!![]});}return null;})[_0x0a88('0x26')](function(_0x478c2b){if(!_0x478c2b)return null;_0x562a95['message']['agent']=_0x478c2b;return _0x562a95;})[_0x0a88('0x26')](function(_0x962ddb){if(_0x962ddb){_0x962ddb['message']['interface']=util[_0x0a88('0x65')](_0x0a88('0x7b'),_0x4d658b[_0x0a88('0x68')][_0x0a88('0x3f')]);_0x962ddb[_0x0a88('0x2d')][_0x0a88('0x7c')]=_0x562a95[_0x0a88('0x7c')];_0x962ddb[_0x0a88('0x2d')][_0x0a88('0x86')]=_0x562a95[_0x0a88('0x7c')];_0x962ddb['message'][_0x0a88('0x7d')]=_0x0a88('0x39');respondWithRpcPromise(_0x0a88('0x7e'),'EventManager',{'event':_0x0a88('0x87'),'message':_0x962ddb[_0x0a88('0x2d')]},client9002);return _0x562a95;}return null;})['then'](respondWithResult(_0x4ac92d,null))[_0x0a88('0x30')](handleError(_0x4ac92d,null));};exports[_0x0a88('0x31')]=function(_0x5809c0,_0x59ae88,_0x57b4ed){if(_0x5809c0[_0x0a88('0x5f')]['id']){delete _0x5809c0[_0x0a88('0x5f')]['id'];}var _0x3c73da;return db[_0x0a88('0x59')][_0x0a88('0x5d')]({'where':{'id':_0x5809c0[_0x0a88('0x5c')]['id']}})[_0x0a88('0x26')](handleEntityNotFound(_0x59ae88,null))['then'](function(_0x120574){if(_0x120574){_0x3c73da=_0x120574;return db[_0x0a88('0x88')][_0x0a88('0x5d')]({'where':{'id':_0x120574[_0x0a88('0x89')]}});}})[_0x0a88('0x26')](handleEntityNotFound(_0x59ae88,null))[_0x0a88('0x26')](function(_0x912112){if(_0x912112){logger[_0x0a88('0x29')](_0x0a88('0x2a'),_0x0a88('0x31'),_0x0a88('0x8a'),_0x912112['type'],util[_0x0a88('0x8b')](_0x5809c0[_0x0a88('0x5f')],{'showHidden':![],'depth':null}));switch(_0x912112[_0x0a88('0x53')]){case _0x0a88('0x8c'):if(_0x5809c0['body'][_0x0a88('0x8d')]&&_0x5809c0['body']['MessageSid']===_0x3c73da['messageId']){return _0x3c73da[_0x0a88('0x6b')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0a88('0x31'),_0x0a88('0x8c'),util['inspect'](_0x5809c0[_0x0a88('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x0a88('0x8e'):if(_0x5809c0[_0x0a88('0x5f')][_0x0a88('0x8f')]&&_0x5809c0[_0x0a88('0x5f')]['MessageUUID']===_0x3c73da[_0x0a88('0x90')]&&_['indexOf']([_0x0a88('0x91'),'delivered'],_0x5809c0[_0x0a88('0x5f')]['Status'])>=0x0){return _0x3c73da[_0x0a88('0x6b')]({'read':!![]});}else{logger[_0x0a88('0x2b')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0a88('0x31'),_0x0a88('0x92'),util[_0x0a88('0x8b')](_0x5809c0[_0x0a88('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x0a88('0x93'):var _0x5ec9bc=_0x5809c0[_0x0a88('0x5f')][_0x0a88('0x94')][0x0];if(_0x5ec9bc[_0x0a88('0x31')][_0x0a88('0x95')]===_0x0a88('0x96')){return _0x3c73da[_0x0a88('0x6b')]({'read':!![]});}else{logger[_0x0a88('0x2b')](_0x0a88('0x97'),_0x0a88('0x31'),_0x0a88('0x93'),util[_0x0a88('0x8b')](_0x5809c0[_0x0a88('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x3c73da;}})[_0x0a88('0x26')](respondWithResult(_0x59ae88,null))[_0x0a88('0x30')](handleError(_0x59ae88,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index e87ad77..68d7772 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 _0x4b1b=['remove','emit','hasOwnProperty','hook','exports','events','SmsMessage','setMaxListeners'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x4b1b,0x1c5));var _0xb4b1=function(_0x319fd6,_0x3c5f29){_0x319fd6=_0x319fd6-0x0;var _0x83b5ca=_0x4b1b[_0x319fd6];return _0x83b5ca;};'use strict';var EventEmitter=require(_0xb4b1('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xb4b1('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xb4b1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb4b1('0x3')};function emitEvent(_0x56c7a5){return function(_0x4b2af2,_0x1652db,_0x21643c){SmsMessageEvents['emit'](_0x56c7a5+':'+_0x4b2af2['id'],_0x4b2af2);SmsMessageEvents[_0xb4b1('0x4')](_0x56c7a5,_0x4b2af2);_0x21643c(null);};}for(var e in events){if(events[_0xb4b1('0x5')](e)){var event=events[e];SmsMessage[_0xb4b1('0x6')](e,emitEvent(event));}}module[_0xb4b1('0x7')]=SmsMessageEvents; \ No newline at end of file +var _0xa1cc=['../../mysqldb','setMaxListeners','save','update','remove','emit','exports','events'];(function(_0x2d6e55,_0x56d3cb){var _0x348186=function(_0x4267ee){while(--_0x4267ee){_0x2d6e55['push'](_0x2d6e55['shift']());}};_0x348186(++_0x56d3cb);}(_0xa1cc,0x19f));var _0xca1c=function(_0x4636ec,_0x4a9ff6){_0x4636ec=_0x4636ec-0x0;var _0x192e3b=_0xa1cc[_0x4636ec];return _0x192e3b;};'use strict';var EventEmitter=require(_0xca1c('0x0'));var SmsMessage=require(_0xca1c('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xca1c('0x2')](0x0);var events={'afterCreate':_0xca1c('0x3'),'afterUpdate':_0xca1c('0x4'),'afterDestroy':_0xca1c('0x5')};function emitEvent(_0x9649b4){return function(_0x41038c,_0x131d66,_0x46c1ed){SmsMessageEvents[_0xca1c('0x6')](_0x9649b4+':'+_0x41038c['id'],_0x41038c);SmsMessageEvents[_0xca1c('0x6')](_0x9649b4,_0x41038c);_0x46c1ed(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xca1c('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 325ef58..74f5460 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 _0x8db0=['isNil','UserId','SmsInteraction','findOne','update','createdAt','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','body','/status?token=','token','sid','catch','afterCreate','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','login?username=','password','GET','split','sms','POST','session_key','deliveryReport','read','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','connectel','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','remote','/api/sms/messages/','IBSSO\x20','infobip','csc','crypto','apiKey','login','sender','text','timestamp','keys','sort','length','createHash','md5','digest','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','bandwidth','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','code','message','status','finally','utf8mb4','lodash','util','api','moment','bluebird','path','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','models','get','direction','toLowerCase','out','secret'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x8db0,0x65));var _0x08db=function(_0x11e05d,_0x3a4491){_0x11e05d=_0x11e05d-0x0;var _0x335588=_0x8db0[_0x11e05d];return _0x335588;};'use strict';var _=require(_0x08db('0x0'));var util=require(_0x08db('0x1'));var logger=require('../../config/logger')(_0x08db('0x2'));var moment=require(_0x08db('0x3'));var BPromise=require(_0x08db('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x08db('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0x08db('0x6')]=function(_0x55af6b,_0x14b0e6){return _0x55af6b['define'](_0x08db('0x7'),attributes,{'tableName':_0x08db('0x8'),'paranoid':![],'indexes':[{'name':_0x08db('0x9'),'fields':[_0x08db('0x9')]},{'name':_0x08db('0xa'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x182b0c,_0x2fe457,_0x1242af){var _0x2d623c=_0x55af6b[_0x08db('0xb')];var _0x16ad14=_0x182b0c[_0x08db('0xc')]({'plain':!![]});if(_0x16ad14[_0x08db('0xd')][_0x08db('0xe')]()==='in'||_0x16ad14[_0x08db('0xd')][_0x08db('0xe')]()===_0x08db('0xf')&&!_0x16ad14[_0x08db('0x10')]&&!_[_0x08db('0x11')](_0x16ad14[_0x08db('0x12')])){_0x2d623c[_0x08db('0x13')][_0x08db('0x14')]({'where':{'id':_0x16ad14['SmsInteractionId']}})['then'](function(_0x541875){if(_0x541875){_0x541875[_0x08db('0x15')]({'lastMsgAt':_0x16ad14[_0x08db('0x16')],'lastMsgDirection':_0x16ad14[_0x08db('0xd')][_0x08db('0xe')]()});}})['catch'](function(_0x13345a){console['error'](_0x13345a);});}if(_0x16ad14[_0x08db('0xd')]==='out'&&!_0x16ad14[_0x08db('0x10')]){var _0x1b9169;_0x2d623c['SmsAccount'][_0x08db('0x17')]({'where':{'id':_0x16ad14[_0x08db('0x18')]},'raw':!![]})[_0x08db('0x19')](function(_0x4c9830){_0x1b9169=_0x4c9830;if(_0x1b9169&&_0x1b9169[_0x08db('0x1a')]){switch(_0x1b9169[_0x08db('0x1a')]){case _0x08db('0x1b'):var _0x27dc5c=require(_0x08db('0x1b'));if(_0x1b9169[_0x08db('0x1c')]&&_0x1b9169[_0x08db('0x1d')]&&_0x1b9169[_0x08db('0x1e')]){var _0x46e555=new _0x27dc5c(_0x1b9169[_0x08db('0x1c')],_0x1b9169['authToken']);_0x46e555[_0x08db('0x1f')][_0x08db('0x20')]({'body':_0x16ad14[_0x08db('0x21')],'to':_0x16ad14[_0x08db('0x1e')],'from':_0x1b9169['phone'],'statusCallback':_0x1b9169['remote']+'/api/sms/messages/'+_0x16ad14['id']+_0x08db('0x22')+_0x1b9169[_0x08db('0x23')]})['then'](function(_0x49b072){if(_0x49b072['sid']){return _0x182b0c['update']({'messageId':_0x49b072[_0x08db('0x24')]});}})[_0x08db('0x25')](function(_0xa44dce){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),'twilio',util['inspect'](_0xa44dce,{'showHidden':![],'depth':null}));});}else{logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),_0x08db('0x1b'),_0x08db('0x28'));}break;case _0x08db('0x29'):var _0x18911f=_0x08db('0x2a');if(_0x1b9169[_0x08db('0x2b')]&&_0x1b9169['password']){var _0x40e0d2={'recipient':[_0x16ad14[_0x08db('0x1e')]],'message':_0x16ad14[_0x08db('0x21')],'message_type':_0x1b9169[_0x08db('0x2c')]};if(_0x1b9169[_0x08db('0x2c')]&&_0x1b9169[_0x08db('0x2c')]!=='SI'){_0x40e0d2['sender']=_0x1b9169['phone'];}var _0x5de081={'url':_0x18911f+_0x08db('0x2d')+_0x1b9169['username']+'&password='+_0x1b9169[_0x08db('0x2e')],'method':_0x08db('0x2f')};rp(_0x5de081)[_0x08db('0x19')](function(_0xe09027){var _0x39c8b2=_0xe09027[_0x08db('0x30')](';');var _0x4b2c69={'user_key':_0x39c8b2[0x0],'session_key':_0x39c8b2[0x1]};_0x5de081={'url':_0x18911f+_0x08db('0x31'),'method':_0x08db('0x32'),'headers':{'user_key':_0x4b2c69['user_key'],'Session_key':_0x4b2c69[_0x08db('0x33')]},'json':!![],'body':_0x40e0d2};return rp(_0x5de081);})[_0x08db('0x19')](function(_0x2b95bf){if(_0x2b95bf['total_sent']>=0x1){var _0x2ef037={'messageId':_0x2b95bf['internal_order_id']};if(_0x1b9169[_0x08db('0x2c')]!=='GP'||!_0x1b9169[_0x08db('0x34')]){_0x2ef037[_0x08db('0x35')]=!![];}return _0x182b0c[_0x08db('0x15')](_0x2ef037);}else{return logger[_0x08db('0x27')](_0x08db('0x36'),_0x08db('0x26'),_0x08db('0x29'),util[_0x08db('0x37')](_0x2b95bf,{'showHidden':![],'depth':null}));}})[_0x08db('0x25')](function(_0x593021){return logger['error'](_0x08db('0x36'),_0x08db('0x26'),_0x08db('0x29'),util[_0x08db('0x37')](_0x593021,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),'skebby',_0x08db('0x38'));}break;case'connectel':if(_0x1b9169[_0x08db('0x1d')]){var _0x1feaf6={'recipient':_0x16ad14[_0x08db('0x1e')],'message':_0x16ad14['body'],'sender':_0x1b9169[_0x08db('0x39')]||_0x1b9169[_0x08db('0x1e')],'authorization':_0x1b9169[_0x08db('0x1d')]};var _0x2fe457={'method':_0x08db('0x32'),'uri':_0x08db('0x3a'),'body':_0x1feaf6,'json':!![]};rp(_0x2fe457)[_0x08db('0x19')](function(_0x59f077){var _0x713418={'messageId':_0x59f077['requestid']};if(!_0x1b9169[_0x08db('0x34')]){_0x713418['read']=!![];}return _0x182b0c[_0x08db('0x15')](_0x713418);})[_0x08db('0x25')](function(_0x2d7c97){logger[_0x08db('0x27')](_0x08db('0x36'),_0x08db('0x26'),_0x08db('0x3b'),util[_0x08db('0x37')](_0x2d7c97,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x08db('0x36'),'afterCreate',_0x08db('0x3b'),'Missing\x20parameters:\x20authToken');}break;case _0x08db('0x3c'):if(_0x1b9169[_0x08db('0x2b')]&&_0x1b9169[_0x08db('0x2e')]){var _0x1feaf6={'messages':[{'source':_0x08db('0x3d'),'to':_0x16ad14[_0x08db('0x1e')],'body':_0x16ad14[_0x08db('0x21')],'from':_0x1b9169[_0x08db('0x39')]||_0x1b9169[_0x08db('0x1e')]}]};var _0x59638f=util[_0x08db('0x3e')](_0x08db('0x3f'),_0x1b9169[_0x08db('0x2b')],_0x1b9169['password']);var _0x2fe457={'method':_0x08db('0x32'),'uri':_0x08db('0x40'),'body':_0x1feaf6,'headers':{'Authorization':util[_0x08db('0x3e')](_0x08db('0x41'),new Buffer(_0x59638f)[_0x08db('0x42')](_0x08db('0x43')))},'json':!![]};rp(_0x2fe457)[_0x08db('0x19')](function(_0x88926d){if(_0x88926d[_0x08db('0x44')]>=0xc8&&_0x88926d['http_code']<=0xce){if(_0x88926d[_0x08db('0x45')]&&_0x88926d[_0x08db('0x45')][_0x08db('0x46')]>0x0){var _0x3c11a1=_[_0x08db('0x47')](_0x88926d[_0x08db('0x45')][_0x08db('0x1f')]);var _0x500552={'messageId':_0x3c11a1[_0x08db('0x48')]};if(!_0x1b9169[_0x08db('0x34')]){_0x500552[_0x08db('0x35')]=!![];}return _0x182b0c[_0x08db('0x15')](_0x500552);}else{logger[_0x08db('0x27')](_0x08db('0x36'),_0x08db('0x26'),_0x08db('0x49'),util['inspect'](_0x88926d,{'showHidden':![],'depth':null}));}}else{logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),'clickSend',util[_0x08db('0x37')](_0x88926d,{'showHidden':![],'depth':null}));}})[_0x08db('0x25')](function(_0x5d6c27){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),_0x08db('0x49'),util[_0x08db('0x37')](_0x5d6c27,{'showHidden':![],'depth':null}));});}else{logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),_0x08db('0x49'),_0x08db('0x38'));}break;case _0x08db('0x4a'):if(_0x1b9169['authId']&&_0x1b9169['authToken']){var _0x1feaf6={'dst':_0x16ad14[_0x08db('0x1e')],'text':_0x16ad14[_0x08db('0x21')],'src':_0x1b9169['senderString']||_0x1b9169['phone'],'url':_0x1b9169['remote']+'/api/sms/messages/'+_0x16ad14['id']+_0x08db('0x22')+_0x1b9169[_0x08db('0x23')]};var _0x59638f=util['format'](_0x08db('0x3f'),_0x1b9169[_0x08db('0x4b')],_0x1b9169['authToken']);var _0x2fe457={'method':_0x08db('0x32'),'uri':util[_0x08db('0x3e')](_0x08db('0x4c'),_0x1b9169['authId']),'body':_0x1feaf6,'headers':{'Authorization':util[_0x08db('0x3e')](_0x08db('0x41'),new Buffer(_0x59638f)[_0x08db('0x42')](_0x08db('0x43')))},'json':!![]};rp(_0x2fe457)['then'](function(_0x44e663){var _0x529183={'messageId':_0x44e663[_0x08db('0x4d')][0x0]};return _0x182b0c[_0x08db('0x15')](_0x529183);})['catch'](function(_0x257175){logger[_0x08db('0x27')](_0x08db('0x36'),_0x08db('0x26'),'plivo',util[_0x08db('0x37')](_0x257175,{'showHidden':![],'depth':null}));});}else{logger[_0x08db('0x27')](_0x08db('0x36'),'afterCreate',_0x08db('0x4a'),_0x08db('0x4e'));}break;case'infobip':if(_0x1b9169[_0x08db('0x2b')]&&_0x1b9169[_0x08db('0x2e')]){if(_0x1b9169[_0x08db('0x4f')]){var _0x497ed5={'method':'POST','uri':_0x1b9169[_0x08db('0x4f')]+_0x08db('0x50'),'body':{'username':_0x1b9169[_0x08db('0x2b')],'password':_0x1b9169[_0x08db('0x2e')]},'json':!![]};return rp(_0x497ed5)['then'](function(_0x55e05a){var _0x4deca1={'method':_0x08db('0x32'),'uri':_0x1b9169['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x1b9169[_0x08db('0x1e')],'destinations':[{'to':_0x16ad14[_0x08db('0x1e')]}],'text':_0x16ad14[_0x08db('0x21')],'notifyUrl':_0x1b9169[_0x08db('0x51')]+_0x08db('0x52')+_0x16ad14['id']+'/status?token='+_0x1b9169[_0x08db('0x23')],'notifyContentType':'application/json','callbackData':_0x1b9169['phone']+';'+_0x16ad14[_0x08db('0x21')]}]},'headers':{'Authorization':_0x08db('0x53')+_0x55e05a['token']},'json':!![]};return rp(_0x4deca1)[_0x08db('0x19')](function(_0x272ada){if(_0x272ada[_0x08db('0x1f')]){var _0x5742f5={'messageId':_0x272ada[_0x08db('0x1f')][0x0][_0x08db('0x9')]};if(!_0x1b9169['deliveryReport']){_0x5742f5['read']=!![];}return _0x182b0c['update'](_0x5742f5);}else{return logger[_0x08db('0x27')](_0x08db('0x36'),'afterCreate',_0x08db('0x54'),util[_0x08db('0x37')](_0x272ada,{'showHidden':![],'depth':null}));}});})[_0x08db('0x25')](function(_0x4b773e){return logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),_0x08db('0x54'),util[_0x08db('0x37')](_0x4b773e,{'showHidden':![],'depth':null}));});}else{logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),_0x08db('0x54'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x08db('0x27')](_0x08db('0x36'),_0x08db('0x26'),_0x08db('0x54'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x08db('0x55'):var _0x4ace4e=require(_0x08db('0x56'));if(_0x1b9169[_0x08db('0x57')]){var _0x4c6614={};_0x4c6614[_0x08db('0x58')]=_0x1b9169[_0x08db('0x2b')];_0x4c6614['phone']=_0x16ad14[_0x08db('0x1e')];_0x4c6614[_0x08db('0x59')]=_0x1b9169['phone'];_0x4c6614[_0x08db('0x5a')]=_0x16ad14[_0x08db('0x21')];_0x4c6614[_0x08db('0x5b')]=+new Date();var _0x43c76c='';var _0x23a99b='';var _0x5b07b3=Object[_0x08db('0x5c')](_0x4c6614);_0x5b07b3[_0x08db('0x5d')]();for(var _0x13eb95=0x0;_0x13eb95<_0x5b07b3[_0x08db('0x5e')];_0x13eb95++){if(_0x43c76c!=''){_0x43c76c+='&';}_0x43c76c+=_0x5b07b3[_0x13eb95]+'='+encodeURIComponent(_0x4c6614[_0x5b07b3[_0x13eb95]]);_0x23a99b+=_0x4c6614[_0x5b07b3[_0x13eb95]];}_0x23a99b+=_0x1b9169['apiKey'];_0x23a99b=_0x4ace4e[_0x08db('0x5f')](_0x08db('0x60'))[_0x08db('0x15')](_0x23a99b)[_0x08db('0x61')](_0x08db('0x62'));if(_0x43c76c!==''){_0x43c76c+='&';}_0x43c76c+='signature='+_0x23a99b;var _0x5de081={'method':'GET','uri':_0x1b9169[_0x08db('0x4f')]+_0x08db('0x63')+_0x43c76c,'json':!![]};return rp(_0x5de081)[_0x08db('0x19')](function(_0x2463c1){var _0x18024=Object[_0x08db('0x5c')](_0x2463c1);if(_0x2463c1[_0x18024[0x0]][_0x08db('0x27')]&&parseInt(_0x2463c1[_0x18024[0x0]][_0x08db('0x27')])===0x0){var _0x2a1d51={'messageId':_0x2463c1[_0x18024[0x0]][_0x08db('0x64')]};if(!_0x1b9169['deliveryReport']){_0x2a1d51[_0x08db('0x35')]=!![];}return _0x182b0c[_0x08db('0x15')](_0x2a1d51);}else{return logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),'csc',util[_0x08db('0x37')](_0x2463c1[_0x08db('0x27')],{'showHidden':![],'depth':null}));}})[_0x08db('0x25')](function(_0xf979c4){return logger['error'](_0x08db('0x36'),_0x08db('0x26'),'csc',util[_0x08db('0x37')](_0xf979c4,{'showHidden':![],'depth':null}));});}else{logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),_0x08db('0x55'),_0x08db('0x65'));}break;case _0x08db('0x66'):if(_0x1b9169[_0x08db('0x57')]){var _0x553141={'method':_0x08db('0x32'),'uri':_0x08db('0x67'),'headers':{'Authorization':_0x1b9169['apiKey']},'body':{'content':_0x16ad14[_0x08db('0x21')],'to':[_0x16ad14[_0x08db('0x1e')]],'from':_0x1b9169[_0x08db('0x1e')],'binary':![],'clientMessageId':_0x08db('0x68'),'charset':_0x08db('0x69')},'json':!![]};rp(_0x553141)[_0x08db('0x19')](function(_0x38c7d9){if(!_0x38c7d9[_0x08db('0x27')]){var _0x19534d={'messageId':_0x38c7d9[_0x08db('0x1f')][0x0][_0x08db('0x6a')]};if(!_0x1b9169[_0x08db('0x34')]){_0x19534d['read']=!![];}return _0x182b0c[_0x08db('0x15')](_0x19534d);}else{return logger[_0x08db('0x27')](_0x08db('0x36'),_0x08db('0x26'),_0x08db('0x66'),util[_0x08db('0x37')](_0x38c7d9[_0x08db('0x27')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x48df0f){return logger[_0x08db('0x27')](_0x08db('0x36'),_0x08db('0x26'),_0x08db('0x66'),util[_0x08db('0x37')](_0x48df0f,{'showHidden':![],'depth':null}));});}else{logger[_0x08db('0x27')](_0x08db('0x36'),_0x08db('0x26'),'clickatell',_0x08db('0x65'));}break;case _0x08db('0x6b'):if(_0x1b9169['username']&&_0x1b9169[_0x08db('0x2e')]){var _0x59638f=util[_0x08db('0x3e')](_0x08db('0x3f'),_0x1b9169[_0x08db('0x2b')],_0x1b9169[_0x08db('0x2e')]);var _0x2fe457={'method':_0x08db('0x32'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x1b9169['accountId']+_0x08db('0x6c'),'body':{'to':[_0x16ad14[_0x08db('0x1e')]],'text':_0x16ad14[_0x08db('0x21')],'from':_0x1b9169[_0x08db('0x1e')],'applicationId':_0x1b9169[_0x08db('0x6d')]},'headers':{'Authorization':util[_0x08db('0x3e')]('Basic\x20%s',new Buffer(_0x59638f)[_0x08db('0x42')]('base64'))},'json':!![]};rp(_0x2fe457)[_0x08db('0x19')](function(_0x5324ca){if(_0x5324ca['id']){var _0xc4f994={'messageId':_0x5324ca['id']};return _0x182b0c[_0x08db('0x15')](_0xc4f994);}else{logger[_0x08db('0x27')](_0x08db('0x36'),'afterCreate','bandwidth',util[_0x08db('0x37')](_0x5324ca,{'showHidden':![],'depth':null}));}})[_0x08db('0x25')](function(_0x712338){logger[_0x08db('0x27')](_0x08db('0x36'),_0x08db('0x26'),'bandwidth',util[_0x08db('0x37')](_0x712338,{'showHidden':![],'depth':null}));});}else{logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x08db('0x6b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x08db('0x6e'):if(_0x1b9169[_0x08db('0x57')]){var _0x49d4a1={};var _0x5de081={'method':_0x08db('0x32'),'uri':_0x08db('0x6f'),'headers':{'Authorization':'Bearer\x20'+_0x1b9169[_0x08db('0x57')],'Content-Type':_0x08db('0x70')},'body':{'from':_0x1b9169[_0x08db('0x1e')],'to':_0x16ad14[_0x08db('0x1e')],'text':_0x16ad14[_0x08db('0x21')]},'json':!![]};return rp(_0x5de081)[_0x08db('0x19')](function(_0x199974){if(_0x199974[_0x08db('0x71')]==0xca){_0x49d4a1[_0x08db('0x72')]=_0x199974;var _0x47f260={'method':_0x08db('0x32'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':'Bearer\x20'+_0x1b9169['apiKey'],'Content-Type':_0x08db('0x70')},'body':{'refid':_0x49d4a1[_0x08db('0x72')]['refid']},'json':!![]};return rp(_0x47f260)[_0x08db('0x19')](function(_0x16aaaa){_0x49d4a1[_0x08db('0x73')]=_0x16aaaa;var _0x512a12={'messageId':_0x49d4a1['message']['refid'],'read':!![]};return _0x182b0c[_0x08db('0x15')](_0x512a12);});}else{return logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),_0x08db('0x6e'),util[_0x08db('0x37')](_0x199974,{'showHidden':![],'depth':null}));}})[_0x08db('0x25')](function(_0xc68fa8){return logger[_0x08db('0x27')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x08db('0x26'),_0x08db('0x6e'),util[_0x08db('0x37')](_0xc68fa8,{'showHidden':![],'depth':null}));});}else{return logger[_0x08db('0x27')](_0x08db('0x36'),'afterCreate',_0x08db('0x6e'),'Token\x20not\x20received');}break;}}})[_0x08db('0x74')](function(){_0x1242af();});}else{_0x1242af();}}},'charset':_0x08db('0x75'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1d5b=['read','skebby','Missing\x20parameters:\x20username,\x20password','connectel','senderString','requestid','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','remote','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','/status?token=','application/json','crypto','login','timestamp','keys','sort','length','apiKey','createHash','md5','digest','hex','signature=','GET','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','utf8mb4','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','findOne','SmsInteractionId','then','update','createdAt','catch','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','create','body','/api/sms/messages/','token','sid','error','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','split','sms','POST','user_key','session_key','total_sent','deliveryReport'];(function(_0xccbdd9,_0x36771b){var _0x1b0fe3=function(_0x4d4afb){while(--_0x4d4afb){_0xccbdd9['push'](_0xccbdd9['shift']());}};_0x1b0fe3(++_0x36771b);}(_0x1d5b,0x13c));var _0xb1d5=function(_0x17347d,_0x546035){_0x17347d=_0x17347d-0x0;var _0x58f451=_0x1d5b[_0x17347d];return _0x58f451;};'use strict';var _=require(_0xb1d5('0x0'));var util=require(_0xb1d5('0x1'));var logger=require(_0xb1d5('0x2'))('api');var moment=require(_0xb1d5('0x3'));var BPromise=require('bluebird');var rp=require(_0xb1d5('0x4'));var fs=require('fs');var path=require(_0xb1d5('0x5'));var rimraf=require(_0xb1d5('0x6'));var config=require(_0xb1d5('0x7'));var attributes=require('./smsMessage.attributes');module['exports']=function(_0x1413e8,_0x131721){return _0x1413e8[_0xb1d5('0x8')](_0xb1d5('0x9'),attributes,{'tableName':_0xb1d5('0xa'),'paranoid':![],'indexes':[{'name':_0xb1d5('0xb'),'fields':[_0xb1d5('0xb')]},{'name':_0xb1d5('0xc'),'fields':['body'],'type':_0xb1d5('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1cc749,_0x56fc2d,_0x4f15ca){var _0x33ebf7=_0x1413e8[_0xb1d5('0xe')];var _0xa7a8b8=_0x1cc749['get']({'plain':!![]});if(_0xa7a8b8[_0xb1d5('0xf')][_0xb1d5('0x10')]()==='in'||_0xa7a8b8[_0xb1d5('0xf')]['toLowerCase']()===_0xb1d5('0x11')&&!_0xa7a8b8[_0xb1d5('0x12')]&&!_[_0xb1d5('0x13')](_0xa7a8b8[_0xb1d5('0x14')])){_0x33ebf7['SmsInteraction'][_0xb1d5('0x15')]({'where':{'id':_0xa7a8b8[_0xb1d5('0x16')]}})[_0xb1d5('0x17')](function(_0x53e1b3){if(_0x53e1b3){_0x53e1b3[_0xb1d5('0x18')]({'lastMsgAt':_0xa7a8b8[_0xb1d5('0x19')],'lastMsgDirection':_0xa7a8b8[_0xb1d5('0xf')][_0xb1d5('0x10')]()});}})[_0xb1d5('0x1a')](function(_0x16a6d0){console['error'](_0x16a6d0);});}if(_0xa7a8b8[_0xb1d5('0xf')]==='out'&&!_0xa7a8b8[_0xb1d5('0x12')]){var _0x43aae9;_0x33ebf7['SmsAccount'][_0xb1d5('0x1b')]({'where':{'id':_0xa7a8b8[_0xb1d5('0x1c')]},'raw':!![]})[_0xb1d5('0x17')](function(_0x5853e9){_0x43aae9=_0x5853e9;if(_0x43aae9&&_0x43aae9[_0xb1d5('0x1d')]){switch(_0x43aae9[_0xb1d5('0x1d')]){case'twilio':var _0x3ce6a9=require(_0xb1d5('0x1e'));if(_0x43aae9[_0xb1d5('0x1f')]&&_0x43aae9[_0xb1d5('0x20')]&&_0x43aae9[_0xb1d5('0x21')]){var _0x4dde74=new _0x3ce6a9(_0x43aae9[_0xb1d5('0x1f')],_0x43aae9[_0xb1d5('0x20')]);_0x4dde74[_0xb1d5('0x22')][_0xb1d5('0x23')]({'body':_0xa7a8b8[_0xb1d5('0x24')],'to':_0xa7a8b8['phone'],'from':_0x43aae9[_0xb1d5('0x21')],'statusCallback':_0x43aae9['remote']+_0xb1d5('0x25')+_0xa7a8b8['id']+'/status?token='+_0x43aae9[_0xb1d5('0x26')]})[_0xb1d5('0x17')](function(_0x4178f0){if(_0x4178f0['sid']){return _0x1cc749['update']({'messageId':_0x4178f0[_0xb1d5('0x27')]});}})[_0xb1d5('0x1a')](function(_0x30c4d0){logger[_0xb1d5('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb1d5('0x29'),_0xb1d5('0x1e'),util[_0xb1d5('0x2a')](_0x30c4d0,{'showHidden':![],'depth':null}));});}else{logger[_0xb1d5('0x28')](_0xb1d5('0x2b'),_0xb1d5('0x29'),_0xb1d5('0x1e'),_0xb1d5('0x2c'));}break;case'skebby':var _0x1adea8=_0xb1d5('0x2d');if(_0x43aae9[_0xb1d5('0x2e')]&&_0x43aae9[_0xb1d5('0x2f')]){var _0x4e36bf={'recipient':[_0xa7a8b8[_0xb1d5('0x21')]],'message':_0xa7a8b8[_0xb1d5('0x24')],'message_type':_0x43aae9[_0xb1d5('0x30')]};if(_0x43aae9[_0xb1d5('0x30')]&&_0x43aae9[_0xb1d5('0x30')]!=='SI'){_0x4e36bf[_0xb1d5('0x31')]=_0x43aae9['phone'];}var _0x4bb903={'url':_0x1adea8+_0xb1d5('0x32')+_0x43aae9[_0xb1d5('0x2e')]+_0xb1d5('0x33')+_0x43aae9[_0xb1d5('0x2f')],'method':'GET'};rp(_0x4bb903)['then'](function(_0x1fae41){var _0x1b4801=_0x1fae41[_0xb1d5('0x34')](';');var _0x357d9a={'user_key':_0x1b4801[0x0],'session_key':_0x1b4801[0x1]};_0x4bb903={'url':_0x1adea8+_0xb1d5('0x35'),'method':_0xb1d5('0x36'),'headers':{'user_key':_0x357d9a[_0xb1d5('0x37')],'Session_key':_0x357d9a[_0xb1d5('0x38')]},'json':!![],'body':_0x4e36bf};return rp(_0x4bb903);})['then'](function(_0x32678f){if(_0x32678f[_0xb1d5('0x39')]>=0x1){var _0x37b10b={'messageId':_0x32678f['internal_order_id']};if(_0x43aae9['smsMethod']!=='GP'||!_0x43aae9[_0xb1d5('0x3a')]){_0x37b10b[_0xb1d5('0x3b')]=!![];}return _0x1cc749[_0xb1d5('0x18')](_0x37b10b);}else{return logger[_0xb1d5('0x28')](_0xb1d5('0x2b'),_0xb1d5('0x29'),_0xb1d5('0x3c'),util[_0xb1d5('0x2a')](_0x32678f,{'showHidden':![],'depth':null}));}})[_0xb1d5('0x1a')](function(_0x2ba8b6){return logger[_0xb1d5('0x28')](_0xb1d5('0x2b'),'afterCreate','skebby',util[_0xb1d5('0x2a')](_0x2ba8b6,{'showHidden':![],'depth':null}));});}else{logger[_0xb1d5('0x28')](_0xb1d5('0x2b'),_0xb1d5('0x29'),_0xb1d5('0x3c'),_0xb1d5('0x3d'));}break;case _0xb1d5('0x3e'):if(_0x43aae9['authToken']){var _0xaef3b9={'recipient':_0xa7a8b8[_0xb1d5('0x21')],'message':_0xa7a8b8['body'],'sender':_0x43aae9[_0xb1d5('0x3f')]||_0x43aae9[_0xb1d5('0x21')],'authorization':_0x43aae9[_0xb1d5('0x20')]};var _0x56fc2d={'method':_0xb1d5('0x36'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0xaef3b9,'json':!![]};rp(_0x56fc2d)[_0xb1d5('0x17')](function(_0x168b35){var _0x3f664e={'messageId':_0x168b35[_0xb1d5('0x40')]};if(!_0x43aae9[_0xb1d5('0x3a')]){_0x3f664e['read']=!![];}return _0x1cc749[_0xb1d5('0x18')](_0x3f664e);})[_0xb1d5('0x1a')](function(_0x5b8db0){logger[_0xb1d5('0x28')](_0xb1d5('0x2b'),_0xb1d5('0x29'),_0xb1d5('0x3e'),util['inspect'](_0x5b8db0,{'showHidden':![],'depth':null}));});}else{logger[_0xb1d5('0x28')](_0xb1d5('0x2b'),_0xb1d5('0x29'),_0xb1d5('0x3e'),_0xb1d5('0x41'));}break;case _0xb1d5('0x42'):if(_0x43aae9['username']&&_0x43aae9['password']){var _0xaef3b9={'messages':[{'source':'xCALLY\x20Motion','to':_0xa7a8b8[_0xb1d5('0x21')],'body':_0xa7a8b8[_0xb1d5('0x24')],'from':_0x43aae9['senderString']||_0x43aae9[_0xb1d5('0x21')]}]};var _0x1df819=util[_0xb1d5('0x43')](_0xb1d5('0x44'),_0x43aae9['username'],_0x43aae9['password']);var _0x56fc2d={'method':_0xb1d5('0x36'),'uri':_0xb1d5('0x45'),'body':_0xaef3b9,'headers':{'Authorization':util[_0xb1d5('0x43')](_0xb1d5('0x46'),new Buffer(_0x1df819)[_0xb1d5('0x47')](_0xb1d5('0x48')))},'json':!![]};rp(_0x56fc2d)[_0xb1d5('0x17')](function(_0x3981f7){if(_0x3981f7[_0xb1d5('0x49')]>=0xc8&&_0x3981f7['http_code']<=0xce){if(_0x3981f7[_0xb1d5('0x4a')]&&_0x3981f7[_0xb1d5('0x4a')][_0xb1d5('0x4b')]>0x0){var _0x23b743=_[_0xb1d5('0x4c')](_0x3981f7[_0xb1d5('0x4a')][_0xb1d5('0x22')]);var _0x3a3e50={'messageId':_0x23b743[_0xb1d5('0x4d')]};if(!_0x43aae9['deliveryReport']){_0x3a3e50[_0xb1d5('0x3b')]=!![];}return _0x1cc749['update'](_0x3a3e50);}else{logger[_0xb1d5('0x28')](_0xb1d5('0x2b'),_0xb1d5('0x29'),_0xb1d5('0x4e'),util[_0xb1d5('0x2a')](_0x3981f7,{'showHidden':![],'depth':null}));}}else{logger[_0xb1d5('0x28')](_0xb1d5('0x2b'),_0xb1d5('0x29'),'clickSend',util[_0xb1d5('0x2a')](_0x3981f7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5354ea){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb1d5('0x29'),_0xb1d5('0x4e'),util[_0xb1d5('0x2a')](_0x5354ea,{'showHidden':![],'depth':null}));});}else{logger[_0xb1d5('0x28')](_0xb1d5('0x2b'),_0xb1d5('0x29'),'clickSend',_0xb1d5('0x3d'));}break;case _0xb1d5('0x4f'):if(_0x43aae9[_0xb1d5('0x50')]&&_0x43aae9[_0xb1d5('0x20')]){var _0xaef3b9={'dst':_0xa7a8b8[_0xb1d5('0x21')],'text':_0xa7a8b8[_0xb1d5('0x24')],'src':_0x43aae9[_0xb1d5('0x3f')]||_0x43aae9['phone'],'url':_0x43aae9[_0xb1d5('0x51')]+_0xb1d5('0x25')+_0xa7a8b8['id']+'/status?token='+_0x43aae9['token']};var _0x1df819=util[_0xb1d5('0x43')](_0xb1d5('0x44'),_0x43aae9[_0xb1d5('0x50')],_0x43aae9[_0xb1d5('0x20')]);var _0x56fc2d={'method':_0xb1d5('0x36'),'uri':util[_0xb1d5('0x43')]('https://api.plivo.com/v1/Account/%s/Message/',_0x43aae9[_0xb1d5('0x50')]),'body':_0xaef3b9,'headers':{'Authorization':util[_0xb1d5('0x43')](_0xb1d5('0x46'),new Buffer(_0x1df819)[_0xb1d5('0x47')](_0xb1d5('0x48')))},'json':!![]};rp(_0x56fc2d)[_0xb1d5('0x17')](function(_0x36ef9e){var _0x186da3={'messageId':_0x36ef9e[_0xb1d5('0x52')][0x0]};return _0x1cc749[_0xb1d5('0x18')](_0x186da3);})[_0xb1d5('0x1a')](function(_0x24f394){logger[_0xb1d5('0x28')](_0xb1d5('0x2b'),'afterCreate',_0xb1d5('0x4f'),util[_0xb1d5('0x2a')](_0x24f394,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb1d5('0x29'),'plivo',_0xb1d5('0x53'));}break;case _0xb1d5('0x54'):if(_0x43aae9[_0xb1d5('0x2e')]&&_0x43aae9[_0xb1d5('0x2f')]){if(_0x43aae9['baseUrl']){var _0x11a207={'method':_0xb1d5('0x36'),'uri':_0x43aae9[_0xb1d5('0x55')]+_0xb1d5('0x56'),'body':{'username':_0x43aae9[_0xb1d5('0x2e')],'password':_0x43aae9['password']},'json':!![]};return rp(_0x11a207)['then'](function(_0x400678){var _0x31cea9={'method':_0xb1d5('0x36'),'uri':_0x43aae9[_0xb1d5('0x55')]+_0xb1d5('0x57'),'body':{'messages':[{'from':_0x43aae9[_0xb1d5('0x21')],'destinations':[{'to':_0xa7a8b8[_0xb1d5('0x21')]}],'text':_0xa7a8b8['body'],'notifyUrl':_0x43aae9[_0xb1d5('0x51')]+_0xb1d5('0x25')+_0xa7a8b8['id']+_0xb1d5('0x58')+_0x43aae9[_0xb1d5('0x26')],'notifyContentType':_0xb1d5('0x59'),'callbackData':_0x43aae9['phone']+';'+_0xa7a8b8[_0xb1d5('0x24')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x400678[_0xb1d5('0x26')]},'json':!![]};return rp(_0x31cea9)[_0xb1d5('0x17')](function(_0x258aba){if(_0x258aba[_0xb1d5('0x22')]){var _0x4be750={'messageId':_0x258aba[_0xb1d5('0x22')][0x0][_0xb1d5('0xb')]};if(!_0x43aae9[_0xb1d5('0x3a')]){_0x4be750[_0xb1d5('0x3b')]=!![];}return _0x1cc749[_0xb1d5('0x18')](_0x4be750);}else{return logger[_0xb1d5('0x28')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xb1d5('0x29'),_0xb1d5('0x54'),util[_0xb1d5('0x2a')](_0x258aba,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x3f3af0){return logger['error'](_0xb1d5('0x2b'),'afterCreate',_0xb1d5('0x54'),util[_0xb1d5('0x2a')](_0x3f3af0,{'showHidden':![],'depth':null}));});}else{logger[_0xb1d5('0x28')](_0xb1d5('0x2b'),_0xb1d5('0x29'),_0xb1d5('0x54'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xb1d5('0x28')](_0xb1d5('0x2b'),_0xb1d5('0x29'),'infobip',_0xb1d5('0x3d'));}break;case'csc':var _0x1d7892=require(_0xb1d5('0x5a'));if(_0x43aae9['apiKey']){var _0x414a45={};_0x414a45[_0xb1d5('0x5b')]=_0x43aae9['username'];_0x414a45[_0xb1d5('0x21')]=_0xa7a8b8[_0xb1d5('0x21')];_0x414a45['sender']=_0x43aae9['phone'];_0x414a45['text']=_0xa7a8b8[_0xb1d5('0x24')];_0x414a45[_0xb1d5('0x5c')]=+new Date();var _0x53c3da='';var _0x2eca33='';var _0x1903df=Object[_0xb1d5('0x5d')](_0x414a45);_0x1903df[_0xb1d5('0x5e')]();for(var _0x36505b=0x0;_0x36505b<_0x1903df[_0xb1d5('0x5f')];_0x36505b++){if(_0x53c3da!=''){_0x53c3da+='&';}_0x53c3da+=_0x1903df[_0x36505b]+'='+encodeURIComponent(_0x414a45[_0x1903df[_0x36505b]]);_0x2eca33+=_0x414a45[_0x1903df[_0x36505b]];}_0x2eca33+=_0x43aae9[_0xb1d5('0x60')];_0x2eca33=_0x1d7892[_0xb1d5('0x61')](_0xb1d5('0x62'))[_0xb1d5('0x18')](_0x2eca33)[_0xb1d5('0x63')](_0xb1d5('0x64'));if(_0x53c3da!==''){_0x53c3da+='&';}_0x53c3da+=_0xb1d5('0x65')+_0x2eca33;var _0x4bb903={'method':_0xb1d5('0x66'),'uri':_0x43aae9[_0xb1d5('0x55')]+_0xb1d5('0x67')+_0x53c3da,'json':!![]};return rp(_0x4bb903)[_0xb1d5('0x17')](function(_0x25ac5b){var _0x366efb=Object[_0xb1d5('0x5d')](_0x25ac5b);if(_0x25ac5b[_0x366efb[0x0]][_0xb1d5('0x28')]&&parseInt(_0x25ac5b[_0x366efb[0x0]][_0xb1d5('0x28')])===0x0){var _0x5dacc1={'messageId':_0x25ac5b[_0x366efb[0x0]][_0xb1d5('0x68')]};if(!_0x43aae9['deliveryReport']){_0x5dacc1[_0xb1d5('0x3b')]=!![];}return _0x1cc749[_0xb1d5('0x18')](_0x5dacc1);}else{return logger['error'](_0xb1d5('0x2b'),_0xb1d5('0x29'),_0xb1d5('0x69'),util[_0xb1d5('0x2a')](_0x25ac5b[_0xb1d5('0x28')],{'showHidden':![],'depth':null}));}})[_0xb1d5('0x1a')](function(_0x19475c){return logger[_0xb1d5('0x28')](_0xb1d5('0x2b'),_0xb1d5('0x29'),_0xb1d5('0x69'),util[_0xb1d5('0x2a')](_0x19475c,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb1d5('0x2b'),'afterCreate',_0xb1d5('0x69'),_0xb1d5('0x6a'));}break;case _0xb1d5('0x6b'):if(_0x43aae9[_0xb1d5('0x60')]){var _0x9b4b91={'method':_0xb1d5('0x36'),'uri':_0xb1d5('0x6c'),'headers':{'Authorization':_0x43aae9[_0xb1d5('0x60')]},'body':{'content':_0xa7a8b8[_0xb1d5('0x24')],'to':[_0xa7a8b8[_0xb1d5('0x21')]],'from':_0x43aae9[_0xb1d5('0x21')],'binary':![],'clientMessageId':_0xb1d5('0x6d'),'charset':_0xb1d5('0x6e')},'json':!![]};rp(_0x9b4b91)[_0xb1d5('0x17')](function(_0x241557){if(!_0x241557[_0xb1d5('0x28')]){var _0xdb0f0e={'messageId':_0x241557['messages'][0x0]['apiMessageId']};if(!_0x43aae9[_0xb1d5('0x3a')]){_0xdb0f0e[_0xb1d5('0x3b')]=!![];}return _0x1cc749[_0xb1d5('0x18')](_0xdb0f0e);}else{return logger['error'](_0xb1d5('0x2b'),_0xb1d5('0x29'),_0xb1d5('0x6b'),util['inspect'](_0x241557[_0xb1d5('0x28')],{'showHidden':![],'depth':null}));}})[_0xb1d5('0x1a')](function(_0x44aa23){return logger[_0xb1d5('0x28')](_0xb1d5('0x2b'),'afterCreate',_0xb1d5('0x6b'),util[_0xb1d5('0x2a')](_0x44aa23,{'showHidden':![],'depth':null}));});}else{logger[_0xb1d5('0x28')](_0xb1d5('0x2b'),_0xb1d5('0x29'),_0xb1d5('0x6b'),'Missing\x20parameters:\x20apiKey');}break;case _0xb1d5('0x6f'):if(_0x43aae9[_0xb1d5('0x2e')]&&_0x43aae9[_0xb1d5('0x2f')]){var _0x1df819=util[_0xb1d5('0x43')]('%s:%s',_0x43aae9[_0xb1d5('0x2e')],_0x43aae9['password']);var _0x56fc2d={'method':_0xb1d5('0x36'),'uri':_0xb1d5('0x70')+_0x43aae9[_0xb1d5('0x71')]+_0xb1d5('0x72'),'body':{'to':[_0xa7a8b8[_0xb1d5('0x21')]],'text':_0xa7a8b8[_0xb1d5('0x24')],'from':_0x43aae9['phone'],'applicationId':_0x43aae9[_0xb1d5('0x73')]},'headers':{'Authorization':util[_0xb1d5('0x43')](_0xb1d5('0x46'),new Buffer(_0x1df819)[_0xb1d5('0x47')](_0xb1d5('0x48')))},'json':!![]};rp(_0x56fc2d)[_0xb1d5('0x17')](function(_0x4bf6cf){if(_0x4bf6cf['id']){var _0x178689={'messageId':_0x4bf6cf['id']};return _0x1cc749['update'](_0x178689);}else{logger['error'](_0xb1d5('0x2b'),'afterCreate',_0xb1d5('0x6f'),util[_0xb1d5('0x2a')](_0x4bf6cf,{'showHidden':![],'depth':null}));}})['catch'](function(_0x437027){logger[_0xb1d5('0x28')](_0xb1d5('0x2b'),_0xb1d5('0x29'),_0xb1d5('0x6f'),util[_0xb1d5('0x2a')](_0x437027,{'showHidden':![],'depth':null}));});}else{logger[_0xb1d5('0x28')](_0xb1d5('0x2b'),'afterCreate',_0xb1d5('0x6f'),_0xb1d5('0x3d'));}break;case'intelepeer':if(_0x43aae9[_0xb1d5('0x60')]){var _0x1abdc4={};var _0x4bb903={'method':_0xb1d5('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xb1d5('0x74')+_0x43aae9['apiKey'],'Content-Type':_0xb1d5('0x59')},'body':{'from':_0x43aae9['phone'],'to':_0xa7a8b8[_0xb1d5('0x21')],'text':_0xa7a8b8[_0xb1d5('0x24')]},'json':!![]};return rp(_0x4bb903)[_0xb1d5('0x17')](function(_0x48ea48){if(_0x48ea48[_0xb1d5('0x75')]==0xca){_0x1abdc4[_0xb1d5('0x76')]=_0x48ea48;var _0x21864b={'method':_0xb1d5('0x36'),'uri':_0xb1d5('0x77'),'headers':{'Authorization':_0xb1d5('0x74')+_0x43aae9[_0xb1d5('0x60')],'Content-Type':'application/json'},'body':{'refid':_0x1abdc4[_0xb1d5('0x76')][_0xb1d5('0x78')]},'json':!![]};return rp(_0x21864b)['then'](function(_0xfa83c8){_0x1abdc4[_0xb1d5('0x79')]=_0xfa83c8;var _0x1b54fe={'messageId':_0x1abdc4[_0xb1d5('0x76')][_0xb1d5('0x78')],'read':!![]};return _0x1cc749[_0xb1d5('0x18')](_0x1b54fe);});}else{return logger[_0xb1d5('0x28')](_0xb1d5('0x2b'),_0xb1d5('0x29'),_0xb1d5('0x7a'),util[_0xb1d5('0x2a')](_0x48ea48,{'showHidden':![],'depth':null}));}})[_0xb1d5('0x1a')](function(_0x26ae62){return logger[_0xb1d5('0x28')](_0xb1d5('0x2b'),_0xb1d5('0x29'),_0xb1d5('0x7a'),util['inspect'](_0x26ae62,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xb1d5('0x2b'),'afterCreate','intelepeer',_0xb1d5('0x7b'));}break;}}})['finally'](function(){_0x4f15ca();});}else{_0x4f15ca();}}},'charset':_0xb1d5('0x7c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 4d17101..2abfc3e 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 _0x2a1a=['body','options','raw','then','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','socket.io-emitter','register','request','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','CreateSmsMessage','SmsMessage','create'];(function(_0x24c246,_0x2d19d5){var _0x558612=function(_0x296597){while(--_0x296597){_0x24c246['push'](_0x24c246['shift']());}};_0x558612(++_0x2d19d5);}(_0x2a1a,0x179));var _0xa2a1=function(_0x2224bd,_0xd2e945){_0x2224bd=_0x2224bd-0x0;var _0x54f18f=_0x2a1a[_0x2224bd];return _0x54f18f;};'use strict';var _=require(_0xa2a1('0x0'));var util=require(_0xa2a1('0x1'));var moment=require('moment');var BPromise=require(_0xa2a1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa2a1('0x3'));var db=require(_0xa2a1('0x4'))['db'];var utils=require(_0xa2a1('0x5'));var logger=require(_0xa2a1('0x6'))(_0xa2a1('0x7'));var config=require('../../config/environment');var jayson=require(_0xa2a1('0x8'));var client=jayson['client'][_0xa2a1('0x9')]({'port':0x232a});config[_0xa2a1('0xa')]=_['defaults'](config[_0xa2a1('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa2a1('0xb'))(new Redis(config[_0xa2a1('0xa')]));require('./smsMessage.socket')[_0xa2a1('0xc')](socket);function respondWithRpcPromise(_0xcd63b1,_0x183466,_0x277116){return new BPromise(function(_0x2968be,_0xbd13d1){return client[_0xa2a1('0xd')](_0xcd63b1,_0x277116)['then'](function(_0x7a3b23){logger[_0xa2a1('0xe')](_0xa2a1('0xf'),_0x183466,'request\x20sent');logger[_0xa2a1('0x10')](_0xa2a1('0x11'),_0x183466,_0xa2a1('0x12'),JSON['stringify'](_0x7a3b23));if(_0x7a3b23[_0xa2a1('0x13')]){if(_0x7a3b23[_0xa2a1('0x13')][_0xa2a1('0x14')]===0x1f4){logger[_0xa2a1('0x13')](_0xa2a1('0xf'),_0x183466,_0x7a3b23['error'][_0xa2a1('0x15')]);return _0xbd13d1(_0x7a3b23[_0xa2a1('0x13')][_0xa2a1('0x15')]);}logger[_0xa2a1('0x13')](_0xa2a1('0xf'),_0x183466,_0x7a3b23['error'][_0xa2a1('0x15')]);return _0x2968be(_0x7a3b23[_0xa2a1('0x13')]['message']);}else{logger[_0xa2a1('0xe')](_0xa2a1('0xf'),_0x183466,_0xa2a1('0x12'));_0x2968be(_0x7a3b23['result'][_0xa2a1('0x15')]);}})[_0xa2a1('0x16')](function(_0x4c458a){logger[_0xa2a1('0x13')](_0xa2a1('0xf'),_0x183466,_0x4c458a);_0xbd13d1(_0x4c458a);});});}exports[_0xa2a1('0x17')]=function(_0x214220){var _0x4d0652=this;return new Promise(function(_0x28b23a,_0x2345d9){return db[_0xa2a1('0x18')][_0xa2a1('0x19')](_0x214220[_0xa2a1('0x1a')],{'raw':_0x214220[_0xa2a1('0x1b')]?_0x214220[_0xa2a1('0x1b')][_0xa2a1('0x1c')]===undefined?!![]:![]:!![]})[_0xa2a1('0x1d')](function(_0x23b1a5){logger[_0xa2a1('0xe')]('CreateSmsMessage',_0x214220);logger['debug'](_0xa2a1('0x17'),_0x214220,JSON[_0xa2a1('0x1e')](_0x23b1a5));_0x28b23a(_0x23b1a5);})[_0xa2a1('0x16')](function(_0x261a9f){logger['error'](_0xa2a1('0x17'),_0x261a9f[_0xa2a1('0x15')],_0x214220);_0x2345d9(_0x4d0652[_0xa2a1('0x13')](0x1f4,_0x261a9f[_0xa2a1('0x15')]));});});}; \ No newline at end of file +var _0x2833=['catch','CreateSmsMessage','SmsMessage','body','options','raw','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','then','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result'];(function(_0x18fa31,_0x138489){var _0x5df50b=function(_0x3f7019){while(--_0x3f7019){_0x18fa31['push'](_0x18fa31['shift']());}};_0x5df50b(++_0x138489);}(_0x2833,0x9c));var _0x3283=function(_0x57b762,_0x22253a){_0x57b762=_0x57b762-0x0;var _0x3f8c76=_0x2833[_0x57b762];return _0x3f8c76;};'use strict';var _=require(_0x3283('0x0'));var util=require(_0x3283('0x1'));var moment=require(_0x3283('0x2'));var BPromise=require(_0x3283('0x3'));var rs=require(_0x3283('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3283('0x5'));var config=require(_0x3283('0x6'));var jayson=require(_0x3283('0x7'));var client=jayson[_0x3283('0x8')]['http']({'port':0x232a});config[_0x3283('0x9')]=_[_0x3283('0xa')](config['redis'],{'host':_0x3283('0xb'),'port':0x18eb});var socket=require(_0x3283('0xc'))(new Redis(config[_0x3283('0x9')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x54191d,_0x17b5bf,_0x30f9e9){return new BPromise(function(_0x1bed77,_0x4c0ceb){return client['request'](_0x54191d,_0x30f9e9)[_0x3283('0xd')](function(_0x1495ed){logger['info'](_0x3283('0xe'),_0x17b5bf,'request\x20sent');logger[_0x3283('0xf')](_0x3283('0x10'),_0x17b5bf,_0x3283('0x11'),JSON[_0x3283('0x12')](_0x1495ed));if(_0x1495ed[_0x3283('0x13')]){if(_0x1495ed[_0x3283('0x13')][_0x3283('0x14')]===0x1f4){logger[_0x3283('0x13')]('SmsMessage,\x20%s,\x20%s',_0x17b5bf,_0x1495ed[_0x3283('0x13')][_0x3283('0x15')]);return _0x4c0ceb(_0x1495ed[_0x3283('0x13')][_0x3283('0x15')]);}logger['error'](_0x3283('0xe'),_0x17b5bf,_0x1495ed[_0x3283('0x13')][_0x3283('0x15')]);return _0x1bed77(_0x1495ed['error']['message']);}else{logger[_0x3283('0x16')]('SmsMessage,\x20%s,\x20%s',_0x17b5bf,'request\x20sent');_0x1bed77(_0x1495ed[_0x3283('0x17')]['message']);}})[_0x3283('0x18')](function(_0x3b2cd){logger[_0x3283('0x13')]('SmsMessage,\x20%s,\x20%s',_0x17b5bf,_0x3b2cd);_0x4c0ceb(_0x3b2cd);});});}exports[_0x3283('0x19')]=function(_0x1b6aca){var _0x5f51c1=this;return new Promise(function(_0x540674,_0x551f1f){return db[_0x3283('0x1a')]['create'](_0x1b6aca[_0x3283('0x1b')],{'raw':_0x1b6aca[_0x3283('0x1c')]?_0x1b6aca[_0x3283('0x1c')][_0x3283('0x1d')]===undefined?!![]:![]:!![]})[_0x3283('0xd')](function(_0x22e25b){logger['info'](_0x3283('0x19'),_0x1b6aca);logger['debug'](_0x3283('0x19'),_0x1b6aca,JSON[_0x3283('0x12')](_0x22e25b));_0x540674(_0x22e25b);})[_0x3283('0x18')](function(_0x7a9a6a){logger[_0x3283('0x13')](_0x3283('0x19'),_0x7a9a6a[_0x3283('0x15')],_0x1b6aca);_0x551f1f(_0x5f51c1[_0x3283('0x13')](0x1f4,_0x7a9a6a[_0x3283('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 45ccfac..a6275ca 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 _0xb47c=['removeListener','register','length','./smsMessage.events','save','remove','update'];(function(_0x4ee2f3,_0x275bca){var _0x1748cc=function(_0x54db9c){while(--_0x54db9c){_0x4ee2f3['push'](_0x4ee2f3['shift']());}};_0x1748cc(++_0x275bca);}(_0xb47c,0x16f));var _0xcb47=function(_0x25d4ab,_0x307164){_0x25d4ab=_0x25d4ab-0x0;var _0x3b31f3=_0xb47c[_0x25d4ab];return _0x3b31f3;};'use strict';var SmsMessageEvents=require(_0xcb47('0x0'));var events=[_0xcb47('0x1'),_0xcb47('0x2'),_0xcb47('0x3')];function createListener(_0x474e03,_0x1cf8c8){return function(_0x14cdb4){_0x1cf8c8['emit'](_0x474e03,_0x14cdb4);};}function removeListener(_0x34496c,_0x2211fa){return function(){SmsMessageEvents[_0xcb47('0x4')](_0x34496c,_0x2211fa);};}exports[_0xcb47('0x5')]=function(_0xe751b1){for(var _0x16dbaf=0x0,_0x5cc1e0=events[_0xcb47('0x6')];_0x16dbaf<_0x5cc1e0;_0x16dbaf++){var _0x4c673e=events[_0x16dbaf];var _0x2d4a4d=createListener('smsMessage:'+_0x4c673e,_0xe751b1);SmsMessageEvents['on'](_0x4c673e,_0x2d4a4d);}}; \ No newline at end of file +var _0x40b2=['removeListener','length','./smsMessage.events','save','update'];(function(_0x5243fa,_0x4deaaa){var _0x37d6ea=function(_0x7dcd65){while(--_0x7dcd65){_0x5243fa['push'](_0x5243fa['shift']());}};_0x37d6ea(++_0x4deaaa);}(_0x40b2,0x174));var _0x240b=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x40b2[_0x2b5eae];return _0x5f3ac9;};'use strict';var SmsMessageEvents=require(_0x240b('0x0'));var events=[_0x240b('0x1'),'remove',_0x240b('0x2')];function createListener(_0x4f484b,_0x207f1c){return function(_0x8875ce){_0x207f1c['emit'](_0x4f484b,_0x8875ce);};}function removeListener(_0x673e40,_0x3a9bb0){return function(){SmsMessageEvents[_0x240b('0x3')](_0x673e40,_0x3a9bb0);};}exports['register']=function(_0x554527){for(var _0x268499=0x0,_0x357b7c=events[_0x240b('0x4')];_0x268499<_0x357b7c;_0x268499++){var _0x465658=events[_0x268499];var _0x50fcde=createListener('smsMessage:'+_0x465658,_0x554527);SmsMessageEvents['on'](_0x465658,_0x50fcde);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 493579c..95de7a9 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 _0xc747=['Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','util','path','connect-timeout'];(function(_0x112b9a,_0x23c0b2){var _0xd17c7a=function(_0x4b6ac8){while(--_0x4b6ac8){_0x112b9a['push'](_0x112b9a['shift']());}};_0xd17c7a(++_0x23c0b2);}(_0xc747,0x71));var _0x7c74=function(_0x595e7b,_0x32000d){_0x595e7b=_0x595e7b-0x0;var _0x330302=_0xc747[_0x595e7b];return _0x330302;};'use strict';var multer=require('multer');var util=require(_0x7c74('0x0'));var path=require(_0x7c74('0x1'));var timeout=require(_0x7c74('0x2'));var express=require('express');var router=express[_0x7c74('0x3')]();var fs_extra=require(_0x7c74('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7c74('0x5'));var config=require(_0x7c74('0x6'));var controller=require(_0x7c74('0x7'));router[_0x7c74('0x8')]('/',auth['isAuthenticated'](),controller[_0x7c74('0x9')]);router[_0x7c74('0x8')](_0x7c74('0xa'),auth[_0x7c74('0xb')](),controller[_0x7c74('0xc')]);router[_0x7c74('0x8')](_0x7c74('0xd'),auth[_0x7c74('0xb')](),controller[_0x7c74('0xe')]);router[_0x7c74('0x8')](_0x7c74('0xf'),auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x7c74('0x10'),auth[_0x7c74('0xb')](),controller['getTeams']);router[_0x7c74('0x8')](_0x7c74('0x11'),auth[_0x7c74('0xb')](),controller[_0x7c74('0x12')]);router[_0x7c74('0x13')]('/',auth[_0x7c74('0xb')](),controller[_0x7c74('0x14')]);router[_0x7c74('0x13')](_0x7c74('0x10'),auth['isAuthenticated'](),controller[_0x7c74('0x15')]);router['post']('/:id/users',auth[_0x7c74('0xb')](),controller[_0x7c74('0x16')]);router[_0x7c74('0x17')]('/:id',auth[_0x7c74('0xb')](),controller[_0x7c74('0x18')]);router[_0x7c74('0x19')](_0x7c74('0xd'),auth[_0x7c74('0xb')](),controller[_0x7c74('0x1a')]);router[_0x7c74('0x19')](_0x7c74('0x10'),auth[_0x7c74('0xb')](),controller[_0x7c74('0x1b')]);router[_0x7c74('0x19')](_0x7c74('0x11'),auth[_0x7c74('0xb')](),controller['removeAgents']);module[_0x7c74('0x1c')]=router; \ No newline at end of file +var _0xad2e=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xad2e,0xd9));var _0xead2=function(_0x184aaa,_0x3a6b97){_0x184aaa=_0x184aaa-0x0;var _0x148ddb=_0xad2e[_0x184aaa];return _0x148ddb;};'use strict';var multer=require('multer');var util=require(_0xead2('0x0'));var path=require(_0xead2('0x1'));var timeout=require(_0xead2('0x2'));var express=require('express');var router=express[_0xead2('0x3')]();var fs_extra=require(_0xead2('0x4'));var auth=require(_0xead2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xead2('0x6'));var controller=require(_0xead2('0x7'));router[_0xead2('0x8')]('/',auth[_0xead2('0x9')](),controller[_0xead2('0xa')]);router[_0xead2('0x8')](_0xead2('0xb'),auth[_0xead2('0x9')](),controller[_0xead2('0xc')]);router['get'](_0xead2('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0xead2('0xe'),auth[_0xead2('0x9')](),controller[_0xead2('0xf')]);router[_0xead2('0x8')](_0xead2('0x10'),auth[_0xead2('0x9')](),controller[_0xead2('0x11')]);router[_0xead2('0x8')](_0xead2('0x12'),auth['isAuthenticated'](),controller[_0xead2('0x13')]);router[_0xead2('0x14')]('/',auth[_0xead2('0x9')](),controller[_0xead2('0x15')]);router[_0xead2('0x14')](_0xead2('0x10'),auth[_0xead2('0x9')](),controller['addTeams']);router[_0xead2('0x14')](_0xead2('0x12'),auth[_0xead2('0x9')](),controller[_0xead2('0x16')]);router[_0xead2('0x17')](_0xead2('0xd'),auth[_0xead2('0x9')](),controller['update']);router[_0xead2('0x18')](_0xead2('0xd'),auth['isAuthenticated'](),controller[_0xead2('0x19')]);router[_0xead2('0x18')]('/:id/teams',auth[_0xead2('0x9')](),controller[_0xead2('0x1a')]);router[_0xead2('0x18')](_0xead2('0x12'),auth[_0xead2('0x9')](),controller[_0xead2('0x1b')]);module[_0xead2('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index c7f5a0d..abad149 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 _0x2fca=['exports','STRING','ENUM','beepall','sequelize'];(function(_0x5f2d31,_0x4a7572){var _0x39f6e8=function(_0x4f87e5){while(--_0x4f87e5){_0x5f2d31['push'](_0x5f2d31['shift']());}};_0x39f6e8(++_0x4a7572);}(_0x2fca,0x9f));var _0xa2fc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2fca[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xa2fc('0x0'));module[_0xa2fc('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa2fc('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa2fc('0x3')]('rrmemory',_0xa2fc('0x4'),'roundrobin')}}; \ No newline at end of file +var _0x481c=['STRING','name','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x481c,0xb5));var _0xc481=function(_0xa3cc86,_0x3efe21){_0xa3cc86=_0xa3cc86-0x0;var _0x14526f=_0x481c[_0xa3cc86];return _0x14526f;};'use strict';var Sequelize=require('sequelize');module[_0xc481('0x0')]={'name':{'type':Sequelize[_0xc481('0x1')],'unique':_0xc481('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc481('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc481('0x3')](_0xc481('0x4'),_0xc481('0x5'),_0xc481('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 2561433..8ffc1da 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 _0xd664=['every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','get','SmsQueues','UserProfileResource','destroy','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserSmsQueue','order','SmsQueueId','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','hasOwnProperty','addTeams','voicePause','interface','flatMap','Agents','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','ids','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','push','sequelize','toString','QueryTypes'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xd664,0xa5));var _0x4d66=function(_0x288d36,_0x1b283c){_0x288d36=_0x288d36-0x0;var _0x35590e=_0xd664[_0x288d36];return _0x35590e;};'use strict';var emlformat=require(_0x4d66('0x0'));var rimraf=require(_0x4d66('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4d66('0x2'));var BPromise=require(_0x4d66('0x3'));var Mustache=require('mustache');var util=require(_0x4d66('0x4'));var path=require(_0x4d66('0x5'));var sox=require(_0x4d66('0x6'));var csv=require(_0x4d66('0x7'));var ejs=require(_0x4d66('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d66('0x9'));var squel=require(_0x4d66('0xa'));var crypto=require(_0x4d66('0xb'));var jsforce=require(_0x4d66('0xc'));var deskjs=require(_0x4d66('0xd'));var toCsv=require(_0x4d66('0x7'));var querystring=require(_0x4d66('0xe'));var Papa=require(_0x4d66('0xf'));var Redis=require(_0x4d66('0x10'));var authService=require(_0x4d66('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4d66('0x12'));var hardwareService=require(_0x4d66('0x13'));var logger=require(_0x4d66('0x14'))(_0x4d66('0x15'));var utils=require(_0x4d66('0x16'));var config=require(_0x4d66('0x17'));var licenseUtil=require(_0x4d66('0x18'));var db=require(_0x4d66('0x19'))['db'];config[_0x4d66('0x1a')]=_[_0x4d66('0x1b')](config[_0x4d66('0x1a')],{'host':_0x4d66('0x1c'),'port':0x18eb});var socket=require(_0x4d66('0x1d'))(new Redis(config[_0x4d66('0x1a')]));require('./smsQueue.socket')[_0x4d66('0x1e')](socket);function respondWithStatusCode(_0x5e1de3,_0x175519){_0x175519=_0x175519||0xcc;return function(_0x3624db){if(_0x3624db){return _0x5e1de3[_0x4d66('0x1f')](_0x175519);}return _0x5e1de3['status'](_0x175519)[_0x4d66('0x20')]();};}function respondWithResult(_0x3d3cda,_0x54ec23){_0x54ec23=_0x54ec23||0xc8;return function(_0x4f0150){if(_0x4f0150){return _0x3d3cda[_0x4d66('0x21')](_0x54ec23)[_0x4d66('0x22')](_0x4f0150);}};}function respondWithFilteredResult(_0x2710f5,_0x57fbfb){return function(_0x2c621a){if(_0x2c621a){var _0x2e5fb3=typeof _0x57fbfb[_0x4d66('0x23')]===_0x4d66('0x24')&&typeof _0x57fbfb[_0x4d66('0x25')]===_0x4d66('0x24');var _0x1b2101=_0x2c621a[_0x4d66('0x26')];var _0x1c8fc1=_0x2e5fb3?0x0:_0x57fbfb['offset'];var _0x28f938=_0x2e5fb3?_0x2c621a[_0x4d66('0x26')]:_0x57fbfb[_0x4d66('0x23')]+_0x57fbfb[_0x4d66('0x25')];var _0x3d9f93;if(_0x28f938>=_0x1b2101){_0x28f938=_0x1b2101;_0x3d9f93=0xc8;}else{_0x3d9f93=0xce;}_0x2710f5['status'](_0x3d9f93);return _0x2710f5[_0x4d66('0x27')](_0x4d66('0x28'),_0x1c8fc1+'-'+_0x28f938+'/'+_0x1b2101)[_0x4d66('0x22')](_0x2c621a);}return null;};}function patchUpdates(_0x309e63){return function(_0x526933){try{jsonpatch[_0x4d66('0x29')](_0x526933,_0x309e63,!![]);}catch(_0x2a2fd6){return BPromise[_0x4d66('0x2a')](_0x2a2fd6);}return _0x526933[_0x4d66('0x2b')]();};}function saveUpdates(_0x4f01d3,_0x1dff79){return function(_0x149f7d){if(_0x149f7d){return _0x149f7d['update'](_0x4f01d3)['then'](function(_0x3266aa){return _0x3266aa;});}return null;};}function removeEntity(_0x5b7a31,_0x2a39ed){return function(_0x51760a){if(_0x51760a){return _0x51760a['destroy']()[_0x4d66('0x2c')](function(){var _0x5063ba=_0x51760a[_0x4d66('0x2d')]({'plain':!![]});var _0x55b74e=_0x4d66('0x2e');return db[_0x4d66('0x2f')][_0x4d66('0x30')]({'where':{'type':_0x55b74e,'resourceId':_0x5063ba['id']}})[_0x4d66('0x2c')](function(){return _0x51760a;});})['then'](function(){_0x5b7a31[_0x4d66('0x21')](0xcc)[_0x4d66('0x20')]();});}};}function handleEntityNotFound(_0x3e1626,_0x1043fa){return function(_0x37fde8){if(!_0x37fde8){_0x3e1626['sendStatus'](0x194);}return _0x37fde8;};}function handleError(_0x558afd,_0x4f0504){_0x4f0504=_0x4f0504||0x1f4;return function(_0x53348e){logger['error'](_0x53348e[_0x4d66('0x31')]);if(_0x53348e['name']){delete _0x53348e[_0x4d66('0x32')];}_0x558afd[_0x4d66('0x21')](_0x4f0504)[_0x4d66('0x33')](_0x53348e);};}exports[_0x4d66('0x34')]=function(_0x108add,_0x1456b9){var _0x5b9e45={},_0x39c2b6={},_0x126694={'count':0x0,'rows':[]};var _0x576416=_[_0x4d66('0x35')](db[_0x4d66('0x36')][_0x4d66('0x37')],function(_0x37dcd8){return{'name':_0x37dcd8[_0x4d66('0x38')],'type':_0x37dcd8[_0x4d66('0x39')][_0x4d66('0x3a')]};});_0x39c2b6[_0x4d66('0x3b')]=_[_0x4d66('0x35')](_0x576416,_0x4d66('0x32'));_0x39c2b6['query']=_[_0x4d66('0x3c')](_0x108add[_0x4d66('0x3d')]);_0x39c2b6['filters']=_[_0x4d66('0x3e')](_0x39c2b6['model'],_0x39c2b6['query']);_0x5b9e45['attributes']=_[_0x4d66('0x3e')](_0x39c2b6[_0x4d66('0x3b')],qs[_0x4d66('0x3f')](_0x108add[_0x4d66('0x3d')][_0x4d66('0x3f')]));_0x5b9e45[_0x4d66('0x40')]=_0x5b9e45[_0x4d66('0x40')][_0x4d66('0x41')]?_0x5b9e45[_0x4d66('0x40')]:_0x39c2b6['model'];if(!_0x108add['query']['hasOwnProperty'](_0x4d66('0x42'))){_0x5b9e45[_0x4d66('0x25')]=qs[_0x4d66('0x25')](_0x108add[_0x4d66('0x3d')]['limit']);_0x5b9e45['offset']=qs[_0x4d66('0x23')](_0x108add[_0x4d66('0x3d')][_0x4d66('0x23')]);}_0x5b9e45['order']=qs[_0x4d66('0x43')](_0x108add[_0x4d66('0x3d')][_0x4d66('0x43')]);_0x5b9e45[_0x4d66('0x44')]=qs[_0x4d66('0x45')](_[_0x4d66('0x46')](_0x108add[_0x4d66('0x3d')],_0x39c2b6[_0x4d66('0x45')]),_0x576416);if(_0x108add['query'][_0x4d66('0x47')]){_0x5b9e45['where']=_[_0x4d66('0x48')](_0x5b9e45[_0x4d66('0x44')],{'$or':_[_0x4d66('0x35')](_0x576416,function(_0x540d06){if(_0x540d06['type']!==_0x4d66('0x49')){var _0x57652a={};_0x57652a[_0x540d06[_0x4d66('0x32')]]={'$like':'%'+_0x108add['query'][_0x4d66('0x47')]+'%'};return _0x57652a;}})});}_0x5b9e45=_[_0x4d66('0x48')]({},_0x5b9e45,_0x108add[_0x4d66('0x4a')]);var _0x1c447e={'where':_0x5b9e45[_0x4d66('0x44')]};return db[_0x4d66('0x36')][_0x4d66('0x26')](_0x1c447e)['then'](function(_0x4bf45d){_0x126694[_0x4d66('0x26')]=_0x4bf45d;if(_0x108add[_0x4d66('0x3d')][_0x4d66('0x4b')]){_0x5b9e45[_0x4d66('0x4c')]=[{'all':!![]}];}return db[_0x4d66('0x36')]['findAll'](_0x5b9e45);})[_0x4d66('0x2c')](function(_0xfe3cd4){_0x126694['rows']=_0xfe3cd4;return _0x126694;})[_0x4d66('0x2c')](respondWithFilteredResult(_0x1456b9,_0x5b9e45))[_0x4d66('0x4d')](handleError(_0x1456b9,null));};exports['show']=function(_0x4858bc,_0x11924f){var _0xa45315={'raw':!![],'where':{'id':_0x4858bc[_0x4d66('0x4e')]['id']}},_0x36acec={};_0x36acec[_0x4d66('0x3b')]=_[_0x4d66('0x3c')](db[_0x4d66('0x36')][_0x4d66('0x37')]);_0x36acec[_0x4d66('0x3d')]=_['keys'](_0x4858bc[_0x4d66('0x3d')]);_0x36acec[_0x4d66('0x45')]=_[_0x4d66('0x3e')](_0x36acec['model'],_0x36acec[_0x4d66('0x3d')]);_0xa45315[_0x4d66('0x40')]=_['intersection'](_0x36acec[_0x4d66('0x3b')],qs[_0x4d66('0x3f')](_0x4858bc[_0x4d66('0x3d')][_0x4d66('0x3f')]));_0xa45315[_0x4d66('0x40')]=_0xa45315['attributes'][_0x4d66('0x41')]?_0xa45315[_0x4d66('0x40')]:_0x36acec[_0x4d66('0x3b')];if(_0x4858bc[_0x4d66('0x3d')]['includeAll']){_0xa45315[_0x4d66('0x4c')]=[{'all':!![]}];}_0xa45315=_[_0x4d66('0x48')]({},_0xa45315,_0x4858bc['options']);return db[_0x4d66('0x36')][_0x4d66('0x4f')](_0xa45315)[_0x4d66('0x2c')](handleEntityNotFound(_0x11924f,null))[_0x4d66('0x2c')](respondWithResult(_0x11924f,null))[_0x4d66('0x4d')](handleError(_0x11924f,null));};exports[_0x4d66('0x50')]=function(_0x51cc22,_0x4a7971){return db[_0x4d66('0x36')][_0x4d66('0x50')](_0x51cc22[_0x4d66('0x51')],{})['then'](function(_0x223ff0){var _0x24cdc1=_0x51cc22[_0x4d66('0x52')][_0x4d66('0x2d')]({'plain':!![]});if(!_0x24cdc1)throw new Error(_0x4d66('0x53'));if(_0x24cdc1[_0x4d66('0x54')]==='user'){var _0x387a0c=_0x223ff0[_0x4d66('0x2d')]({'plain':!![]});var _0x25c938=_0x4d66('0x2e');return db[_0x4d66('0x55')][_0x4d66('0x4f')]({'where':{'name':_0x25c938,'userProfileId':_0x24cdc1[_0x4d66('0x56')]},'raw':!![]})['then'](function(_0xe498b2){if(_0xe498b2&&_0xe498b2[_0x4d66('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x387a0c[_0x4d66('0x32')],'resourceId':_0x387a0c['id'],'type':_0xe498b2[_0x4d66('0x32')],'sectionId':_0xe498b2['id']},{})[_0x4d66('0x2c')](function(){return _0x223ff0;});}else{return _0x223ff0;}})[_0x4d66('0x4d')](function(_0x4fee79){logger[_0x4d66('0x58')](_0x4d66('0x59'),_0x4fee79);throw _0x4fee79;});}return _0x223ff0;})[_0x4d66('0x2c')](respondWithResult(_0x4a7971,0xc9))['catch'](handleError(_0x4a7971,null));};exports[_0x4d66('0x5a')]=function(_0x4c673e,_0x13db1c){if(_0x4c673e[_0x4d66('0x51')]['id']){delete _0x4c673e[_0x4d66('0x51')]['id'];}return db[_0x4d66('0x36')][_0x4d66('0x4f')]({'where':{'id':_0x4c673e[_0x4d66('0x4e')]['id']}})[_0x4d66('0x2c')](handleEntityNotFound(_0x13db1c,null))[_0x4d66('0x2c')](saveUpdates(_0x4c673e[_0x4d66('0x51')],null))[_0x4d66('0x2c')](respondWithResult(_0x13db1c,null))[_0x4d66('0x4d')](handleError(_0x13db1c,null));};exports[_0x4d66('0x30')]=function(_0x151f94,_0x108f40){return db[_0x4d66('0x36')][_0x4d66('0x4f')]({'where':{'id':_0x151f94[_0x4d66('0x4e')]['id']}})[_0x4d66('0x2c')](handleEntityNotFound(_0x108f40,null))['then'](removeEntity(_0x108f40,null))['catch'](handleError(_0x108f40,null));};exports['describe']=function(_0x54bf85,_0xce5da2){return db[_0x4d66('0x36')][_0x4d66('0x5b')]()[_0x4d66('0x2c')](respondWithResult(_0xce5da2,null))[_0x4d66('0x4d')](handleError(_0xce5da2,null));};exports[_0x4d66('0x5c')]=function(_0x5b47c2,_0x17cce5,_0x2e6330){var _0xaea24f={'raw':!![],'where':{}},_0x23285d={},_0x4af3f4;return db[_0x4d66('0x36')][_0x4d66('0x5d')]({'where':{'id':_0x5b47c2[_0x4d66('0x4e')]['id']}})[_0x4d66('0x2c')](handleEntityNotFound(_0x17cce5,null))['then'](function(_0x4bdbb3){if(_0x4bdbb3){_0x4af3f4=_0x4bdbb3[_0x4d66('0x2d')]({'plain':!![]});_0x23285d['model']=_[_0x4d66('0x3c')](db[_0x4d66('0x5e')][_0x4d66('0x37')]);_0x23285d[_0x4d66('0x3d')]=_[_0x4d66('0x3c')](_0x5b47c2[_0x4d66('0x3d')]);_0x23285d[_0x4d66('0x45')]=_[_0x4d66('0x3e')](_0x23285d[_0x4d66('0x3b')],_0x23285d['query']);_0xaea24f[_0x4d66('0x40')]=_['intersection'](_0x23285d[_0x4d66('0x3b')],qs[_0x4d66('0x3f')](_0x5b47c2[_0x4d66('0x3d')][_0x4d66('0x3f')]));_0xaea24f[_0x4d66('0x40')]=_0xaea24f['attributes'][_0x4d66('0x41')]?_0xaea24f[_0x4d66('0x40')]:_0x23285d[_0x4d66('0x3b')];if(!_0x5b47c2[_0x4d66('0x3d')]['hasOwnProperty'](_0x4d66('0x42'))){_0xaea24f[_0x4d66('0x25')]=qs[_0x4d66('0x25')](_0x5b47c2['query'][_0x4d66('0x25')]);_0xaea24f[_0x4d66('0x23')]=qs[_0x4d66('0x23')](_0x5b47c2[_0x4d66('0x3d')][_0x4d66('0x23')]);}_0xaea24f[_0x4d66('0x5f')]=qs[_0x4d66('0x43')](_0x5b47c2[_0x4d66('0x3d')][_0x4d66('0x43')]);_0xaea24f['where']=qs[_0x4d66('0x45')](_[_0x4d66('0x46')](_0x5b47c2[_0x4d66('0x3d')],_0x23285d[_0x4d66('0x45')]));_0xaea24f[_0x4d66('0x44')][_0x4d66('0x60')]=_0x4bdbb3['id'];if(_0x5b47c2[_0x4d66('0x3d')][_0x4d66('0x47')]){_0xaea24f[_0x4d66('0x44')]=_[_0x4d66('0x48')](_0xaea24f['where'],{'$or':_[_0x4d66('0x35')](_0xaea24f[_0x4d66('0x40')],function(_0xcedf19){var _0x2ada4c={};_0x2ada4c[_0xcedf19]={'$like':'%'+_0x5b47c2[_0x4d66('0x3d')]['filter']+'%'};return _0x2ada4c;})});}_0xaea24f=_['merge']({},_0xaea24f,_0x5b47c2[_0x4d66('0x4a')]);return db['UserSmsQueue'][_0x4d66('0x61')](_0xaea24f);}})[_0x4d66('0x2c')](function(_0x1950b5){if(_0x1950b5){return db[_0x4d66('0x62')][_0x4d66('0x63')]({'where':{'id':_['map'](_0x1950b5,_0x4d66('0x64')),'role':_0x4d66('0x65')},'attributes':['id',_0x4d66('0x32'),_0x4d66('0x66'),_0x4d66('0x67'),_0x4d66('0x68')]});}})[_0x4d66('0x2c')](function(_0x4545fa){if(_0x4545fa){return{'count':_0x4545fa[_0x4d66('0x26')],'rows':_[_0x4d66('0x35')](_0x4545fa[_0x4d66('0x69')],function(_0x47ec1d){return{'membername':_0x47ec1d['name'],'UserId':_0x47ec1d['id'],'queue_name':_0x4af3f4[_0x4d66('0x32')],'SmsQueueId':_0x4af3f4['id'],'interface':util[_0x4d66('0x6a')](_0x4d66('0x6b'),_0x4d66('0x6c'),_0x47ec1d[_0x4d66('0x32')]),'penalty':0x0,'paused':_0x47ec1d[_0x4d66('0x66')],'createdAt':_0x47ec1d[_0x4d66('0x68')],'updatedAt':_0x47ec1d[_0x4d66('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x17cce5,_0xaea24f))[_0x4d66('0x4d')](handleError(_0x17cce5,null));};exports[_0x4d66('0x6d')]=function(_0x231fcb,_0x5dd4c7,_0x5e75b8){var _0x59acbb={};var _0xffc27={};var _0x368f7d;var _0x27bf46;return db[_0x4d66('0x36')]['findOne']({'where':{'id':_0x231fcb[_0x4d66('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5dd4c7,null))['then'](function(_0x5134a5){if(_0x5134a5){_0x368f7d=_0x5134a5;_0xffc27[_0x4d66('0x3b')]=_[_0x4d66('0x3c')](db[_0x4d66('0x6e')][_0x4d66('0x37')]);_0xffc27[_0x4d66('0x3d')]=_[_0x4d66('0x3c')](_0x231fcb[_0x4d66('0x3d')]);_0xffc27[_0x4d66('0x45')]=_[_0x4d66('0x3e')](_0xffc27[_0x4d66('0x3b')],_0xffc27[_0x4d66('0x3d')]);_0x59acbb[_0x4d66('0x40')]=_['intersection'](_0xffc27['model'],qs[_0x4d66('0x3f')](_0x231fcb[_0x4d66('0x3d')][_0x4d66('0x3f')]));_0x59acbb[_0x4d66('0x40')]=_0x59acbb[_0x4d66('0x40')]['length']?_0x59acbb['attributes']:_0xffc27['model'];_0x59acbb[_0x4d66('0x5f')]=qs['sort'](_0x231fcb[_0x4d66('0x3d')][_0x4d66('0x43')]);_0x59acbb[_0x4d66('0x44')]=qs['filters'](_[_0x4d66('0x46')](_0x231fcb['query'],_0xffc27['filters']));if(_0x231fcb[_0x4d66('0x3d')][_0x4d66('0x47')]){_0x59acbb[_0x4d66('0x44')]=_[_0x4d66('0x48')](_0x59acbb[_0x4d66('0x44')],{'$or':_[_0x4d66('0x35')](_0x59acbb[_0x4d66('0x40')],function(_0x16d599){var _0x493200={};_0x493200[_0x16d599]={'$like':'%'+_0x231fcb[_0x4d66('0x3d')][_0x4d66('0x47')]+'%'};return _0x493200;})});}_0x59acbb=_['merge']({},_0x59acbb,_0x231fcb[_0x4d66('0x4a')]);return _0x368f7d['getTeams'](_0x59acbb);}})[_0x4d66('0x2c')](function(_0x3de064){if(_0x3de064){_0x27bf46=_0x3de064['length'];if(!_0x231fcb[_0x4d66('0x3d')][_0x4d66('0x6f')](_0x4d66('0x42'))){_0x59acbb['limit']=qs[_0x4d66('0x25')](_0x231fcb['query'][_0x4d66('0x25')]);_0x59acbb[_0x4d66('0x23')]=qs[_0x4d66('0x23')](_0x231fcb[_0x4d66('0x3d')][_0x4d66('0x23')]);}return _0x368f7d[_0x4d66('0x6d')](_0x59acbb);}})['then'](function(_0x3ea83a){if(_0x3ea83a){return _0x3ea83a?{'count':_0x27bf46,'rows':_0x3ea83a}:null;}})[_0x4d66('0x2c')](respondWithResult(_0x5dd4c7,null))['catch'](handleError(_0x5dd4c7,null));};exports[_0x4d66('0x70')]=function(_0x419694,_0x2935ff,_0x15cb85){var _0x68e79=_0x419694['body']['ids'];return db[_0x4d66('0x6e')][_0x4d66('0x61')]({'where':{'id':_0x68e79},'attributes':['id'],'include':[{'model':db[_0x4d66('0x62')],'as':'Agents','attributes':['id',_0x4d66('0x32'),'online',_0x4d66('0x71'),_0x4d66('0x72')],'raw':!![]}]})[_0x4d66('0x2c')](function(_0x203510){if(_0x203510){var _0x1b2235=_[_0x4d66('0x73')](_0x203510,function(_0x5d8d33){var _0x465882=_0x5d8d33[_0x4d66('0x2d')]({'plain':!![]});return _0x465882[_0x4d66('0x74')];});return db[_0x4d66('0x36')][_0x4d66('0x4f')]({'where':{'id':_0x419694[_0x4d66('0x4e')]['id']}})[_0x4d66('0x2c')](function(_0x403b8c){return db['sequelize'][_0x4d66('0x75')](function(_0x4950fd){return _0x403b8c[_0x4d66('0x70')](_0x68e79,{'transaction':_0x4950fd})[_0x4d66('0x2c')](function(){return BPromise[_0x4d66('0x76')](_0x1b2235,function(_0x3a6b84){return db[_0x4d66('0x5e')][_0x4d66('0x77')]({'where':{'UserId':_0x3a6b84['id'],'SmsQueueId':_0x419694[_0x4d66('0x4e')]['id']},'transaction':_0x4950fd});});})['then'](function(){_0x1b2235[_0x4d66('0x78')](function(_0x32b77b){socket[_0x4d66('0x79')](_0x4d66('0x7a'),{'UserId':_0x32b77b['id'],'SmsQueueId':_0x403b8c['id']});});});});});}})[_0x4d66('0x2c')](respondWithStatusCode(_0x2935ff,null))[_0x4d66('0x4d')](handleError(_0x2935ff,null));};exports['removeTeams']=function(_0x22256f,_0x37d26a,_0x486e60){return db[_0x4d66('0x6e')][_0x4d66('0x61')]({'where':{'id':_0x22256f[_0x4d66('0x3d')][_0x4d66('0x7b')]},'attributes':['id'],'include':[{'model':db[_0x4d66('0x62')],'as':_0x4d66('0x74'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x37d26a,null))['then'](function(_0x5f1290){var _0x31abd3=_['map'](_0x5f1290,'id');var _0x309016=[];var _0x389860=[];var _0x131e89=squel[_0x4d66('0x7c')]();_0x131e89[_0x4d66('0x7d')]('tq.TeamId')[_0x4d66('0x7e')](_0x4d66('0x7f'),'tq')[_0x4d66('0x80')](_0x4d66('0x81'),'ut',_0x4d66('0x82'))['where'](_0x4d66('0x83'),_0x22256f[_0x4d66('0x4e')]['id']);for(var _0x161492=0x0;_0x161492<_0x5f1290[_0x4d66('0x41')];_0x161492+=0x1){let _0x1ce448=_0x5f1290[_0x161492];for(var _0x2665fe=0x0;_0x2665fe<_0x1ce448[_0x4d66('0x74')][_0x4d66('0x41')];_0x2665fe+=0x1){let _0x53d095=_0x1ce448[_0x4d66('0x74')][_0x2665fe];var _0x59e9d1=_0x131e89[_0x4d66('0x84')]();_0x59e9d1['where']('ut.UserId\x20=\x20?',_0x53d095['id']);_0x389860[_0x4d66('0x85')](db[_0x4d66('0x86')][_0x4d66('0x3d')](_0x59e9d1[_0x4d66('0x87')](),{'type':db[_0x4d66('0x86')][_0x4d66('0x88')]['SELECT']})[_0x4d66('0x2c')](function(_0x58b82a){if(_0x58b82a[_0x4d66('0x41')]===0x1){return _0x53d095['id'];}else{var _0x141b86=_[_0x4d66('0x89')](_[_0x4d66('0x35')](_0x58b82a,_0x4d66('0x8a')),function(_0x32a0a8){return _[_0x4d66('0x8b')](_0x31abd3,_0x32a0a8);});if(_0x141b86){return _0x53d095['id'];}}}));}}return BPromise[_0x4d66('0x8c')](_0x389860)[_0x4d66('0x2c')](function(_0x22a6d2){_0x309016=_(_0x309016)[_0x4d66('0x8d')](_0x22a6d2)[_0x4d66('0x8e')]()[_0x4d66('0x8f')]();return db[_0x4d66('0x36')][_0x4d66('0x4f')]({'where':{'id':_0x22256f[_0x4d66('0x4e')]['id']}})[_0x4d66('0x2c')](function(_0x642eb7){return db[_0x4d66('0x86')]['transaction'](function(_0x595a33){return _0x642eb7['removeTeams'](_0x22256f[_0x4d66('0x3d')][_0x4d66('0x7b')],{'transaction':_0x595a33})[_0x4d66('0x2c')](function(){if(!_[_0x4d66('0x90')](_0x309016)){return _0x642eb7[_0x4d66('0x91')](_0x309016,{'transaction':_0x595a33});}})[_0x4d66('0x2c')](function(){_0x309016[_0x4d66('0x78')](function(_0x123404){socket[_0x4d66('0x79')](_0x4d66('0x92'),{'UserId':_0x123404,'SmsQueueId':_0x642eb7['id']});});});});});});})[_0x4d66('0x2c')](respondWithStatusCode(_0x37d26a,null))[_0x4d66('0x4d')](handleError(_0x37d26a,null));};exports[_0x4d66('0x93')]=function(_0x130b35,_0x5d5680,_0x55fc8c){return db[_0x4d66('0x36')]['find']({'where':{'id':_0x130b35[_0x4d66('0x4e')]['id']}})[_0x4d66('0x2c')](handleEntityNotFound(_0x5d5680,null))[_0x4d66('0x2c')](function(_0x347ce0){if(_0x347ce0){return _0x347ce0[_0x4d66('0x93')](_0x130b35[_0x4d66('0x51')][_0x4d66('0x7b')],_[_0x4d66('0x94')](_0x130b35[_0x4d66('0x51')],[_0x4d66('0x7b'),'id'])||{})[_0x4d66('0x95')](function(_0x451947){for(var _0xd9c505=0x0;_0xd9c505<_0x130b35[_0x4d66('0x51')][_0x4d66('0x7b')][_0x4d66('0x41')];_0xd9c505+=0x1){socket[_0x4d66('0x79')](_0x4d66('0x7a'),{'UserId':Number(_0x130b35[_0x4d66('0x51')][_0x4d66('0x7b')][_0xd9c505]),'SmsQueueId':Number(_0x130b35[_0x4d66('0x4e')]['id'])});}return _0x451947;});}})['then'](respondWithResult(_0x5d5680,null))[_0x4d66('0x4d')](handleError(_0x5d5680,null));};exports[_0x4d66('0x91')]=function(_0x9312b4,_0x45cf7c,_0x4ede29){return db[_0x4d66('0x36')][_0x4d66('0x4f')]({'where':{'id':_0x9312b4[_0x4d66('0x4e')]['id']}})[_0x4d66('0x2c')](handleEntityNotFound(_0x45cf7c,null))['then'](function(_0x20a918){if(_0x20a918){return _0x20a918[_0x4d66('0x91')](_0x9312b4['query'][_0x4d66('0x7b')])['then'](function(){if(_['isArray'](_0x9312b4[_0x4d66('0x3d')][_0x4d66('0x7b')])){for(var _0x556a08=0x0;_0x556a08<_0x9312b4[_0x4d66('0x3d')][_0x4d66('0x7b')]['length'];_0x556a08+=0x1){socket['emit'](_0x4d66('0x92'),{'UserId':Number(_0x9312b4[_0x4d66('0x3d')][_0x4d66('0x7b')][_0x556a08]),'SmsQueueId':Number(_0x9312b4[_0x4d66('0x4e')]['id'])});}}else{socket[_0x4d66('0x79')](_0x4d66('0x92'),{'UserId':Number(_0x9312b4[_0x4d66('0x3d')][_0x4d66('0x7b')]),'SmsQueueId':Number(_0x9312b4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x45cf7c,null))[_0x4d66('0x4d')](handleError(_0x45cf7c,null));};exports[_0x4d66('0x96')]=function(_0x3d88fd,_0x11e71e,_0x1a850e){var _0x1d417d={};var _0x25b954={};var _0x3e98ab;var _0x21c8e3;return db['SmsQueue'][_0x4d66('0x5d')]({'where':{'id':_0x3d88fd['params']['id']}})[_0x4d66('0x2c')](handleEntityNotFound(_0x11e71e,null))['then'](function(_0x3c9b63){if(_0x3c9b63){_0x3e98ab=_0x3c9b63;_0x25b954[_0x4d66('0x3b')]=_[_0x4d66('0x3c')](db[_0x4d66('0x62')][_0x4d66('0x37')]);_0x25b954[_0x4d66('0x3d')]=_[_0x4d66('0x3c')](_0x3d88fd[_0x4d66('0x3d')]);_0x25b954[_0x4d66('0x45')]=_[_0x4d66('0x3e')](_0x25b954['model'],_0x25b954[_0x4d66('0x3d')]);_0x1d417d['attributes']=_[_0x4d66('0x3e')](_0x25b954['model'],qs[_0x4d66('0x3f')](_0x3d88fd[_0x4d66('0x3d')][_0x4d66('0x3f')]));_0x1d417d[_0x4d66('0x40')]=_0x1d417d['attributes'][_0x4d66('0x41')]?_0x1d417d[_0x4d66('0x40')]:_0x25b954[_0x4d66('0x3b')];_0x1d417d[_0x4d66('0x5f')]=qs[_0x4d66('0x43')](_0x3d88fd['query'][_0x4d66('0x43')]);_0x1d417d[_0x4d66('0x44')]=qs[_0x4d66('0x45')](_[_0x4d66('0x46')](_0x3d88fd[_0x4d66('0x3d')],_0x25b954['filters']));if(_0x3d88fd[_0x4d66('0x3d')][_0x4d66('0x47')]){_0x1d417d[_0x4d66('0x44')]=_[_0x4d66('0x48')](_0x1d417d['where'],{'$or':_['map'](_0x1d417d[_0x4d66('0x40')],function(_0x239656){var _0x4194f4={};_0x4194f4[_0x239656]={'$like':'%'+_0x3d88fd['query']['filter']+'%'};return _0x4194f4;})});}_0x1d417d=_[_0x4d66('0x48')]({},_0x1d417d,_0x3d88fd[_0x4d66('0x4a')]);return _0x3e98ab[_0x4d66('0x96')](_0x1d417d);}})[_0x4d66('0x2c')](function(_0x1947ce){if(_0x1947ce){_0x21c8e3=_0x1947ce[_0x4d66('0x41')];if(!_0x3d88fd['query'][_0x4d66('0x6f')](_0x4d66('0x42'))){_0x1d417d['limit']=qs[_0x4d66('0x25')](_0x3d88fd[_0x4d66('0x3d')]['limit']);_0x1d417d[_0x4d66('0x23')]=qs[_0x4d66('0x23')](_0x3d88fd[_0x4d66('0x3d')]['offset']);}return _0x3e98ab['getAgents'](_0x1d417d);}})[_0x4d66('0x2c')](function(_0x5a43e6){if(_0x5a43e6){return _0x5a43e6?{'count':_0x21c8e3,'rows':_0x5a43e6}:null;}})[_0x4d66('0x2c')](respondWithResult(_0x11e71e,null))['catch'](handleError(_0x11e71e,null));}; \ No newline at end of file +var _0x647b=['fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./smsQueue.socket','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','update','destroy','then','SmsQueues','UserProfileResource','error','stack','name','send','index','map','SmsQueue','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','length','UserSmsQueue','findAndCountAll','UserId','smsPause','updatedAt','rows','format','%s/%s','createdAt','getTeams','Team','addTeams','ids','User','Agents','online','interface','sequelize','each','findOrCreate','forEach','emit','removeTeams','field','tq.TeamId','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','union','value','transaction','removeAgents','userSmsQueue:remove','addAgents','userSmsQueue:save','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs'];(function(_0x5af565,_0x3aa64b){var _0x50bb5f=function(_0x46a5b3){while(--_0x46a5b3){_0x5af565['push'](_0x5af565['shift']());}};_0x50bb5f(++_0x3aa64b);}(_0x647b,0x7c));var _0xb647=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x647b[_0x465a0c];return _0x1e202e;};'use strict';var emlformat=require(_0xb647('0x0'));var rimraf=require(_0xb647('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb647('0x2'));var rp=require(_0xb647('0x3'));var moment=require('moment');var BPromise=require(_0xb647('0x4'));var Mustache=require(_0xb647('0x5'));var util=require('util');var path=require(_0xb647('0x6'));var sox=require('sox');var csv=require(_0xb647('0x7'));var ejs=require(_0xb647('0x8'));var fs=require('fs');var fs_extra=require(_0xb647('0x9'));var _=require('lodash');var squel=require(_0xb647('0xa'));var crypto=require('crypto');var jsforce=require(_0xb647('0xb'));var deskjs=require(_0xb647('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb647('0xd'));var Papa=require(_0xb647('0xe'));var Redis=require(_0xb647('0xf'));var authService=require(_0xb647('0x10'));var qs=require(_0xb647('0x11'));var as=require(_0xb647('0x12'));var hardwareService=require(_0xb647('0x13'));var logger=require(_0xb647('0x14'))(_0xb647('0x15'));var utils=require(_0xb647('0x16'));var config=require(_0xb647('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xb647('0x18'))['db'];config[_0xb647('0x19')]=_[_0xb647('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb647('0x1b'))(new Redis(config[_0xb647('0x19')]));require(_0xb647('0x1c'))['register'](socket);function respondWithStatusCode(_0x117df7,_0x5c6832){_0x5c6832=_0x5c6832||0xcc;return function(_0x26426a){if(_0x26426a){return _0x117df7[_0xb647('0x1d')](_0x5c6832);}return _0x117df7[_0xb647('0x1e')](_0x5c6832)['end']();};}function respondWithResult(_0x5bf4c8,_0x44c811){_0x44c811=_0x44c811||0xc8;return function(_0x3c216f){if(_0x3c216f){return _0x5bf4c8[_0xb647('0x1e')](_0x44c811)[_0xb647('0x1f')](_0x3c216f);}};}function respondWithFilteredResult(_0x31f305,_0x216b94){return function(_0x367519){if(_0x367519){var _0x1ce77b=typeof _0x216b94[_0xb647('0x20')]==='undefined'&&typeof _0x216b94[_0xb647('0x21')]===_0xb647('0x22');var _0x188c18=_0x367519[_0xb647('0x23')];var _0x3563f2=_0x1ce77b?0x0:_0x216b94[_0xb647('0x20')];var _0x24b29f=_0x1ce77b?_0x367519[_0xb647('0x23')]:_0x216b94[_0xb647('0x20')]+_0x216b94[_0xb647('0x21')];var _0x38f20d;if(_0x24b29f>=_0x188c18){_0x24b29f=_0x188c18;_0x38f20d=0xc8;}else{_0x38f20d=0xce;}_0x31f305['status'](_0x38f20d);return _0x31f305['set'](_0xb647('0x24'),_0x3563f2+'-'+_0x24b29f+'/'+_0x188c18)[_0xb647('0x1f')](_0x367519);}return null;};}function patchUpdates(_0x428cd7){return function(_0x34358d){try{jsonpatch['apply'](_0x34358d,_0x428cd7,!![]);}catch(_0xa740ad){return BPromise[_0xb647('0x25')](_0xa740ad);}return _0x34358d['save']();};}function saveUpdates(_0x21d943,_0x3bab25){return function(_0x4505ee){if(_0x4505ee){return _0x4505ee[_0xb647('0x26')](_0x21d943)['then'](function(_0x409daa){return _0x409daa;});}return null;};}function removeEntity(_0x5a2b5a,_0x1ff957){return function(_0x56c092){if(_0x56c092){return _0x56c092[_0xb647('0x27')]()[_0xb647('0x28')](function(){var _0x3d6172=_0x56c092['get']({'plain':!![]});var _0x3f15eb=_0xb647('0x29');return db[_0xb647('0x2a')][_0xb647('0x27')]({'where':{'type':_0x3f15eb,'resourceId':_0x3d6172['id']}})[_0xb647('0x28')](function(){return _0x56c092;});})['then'](function(){_0x5a2b5a[_0xb647('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f2750,_0x495c85){return function(_0x155b70){if(!_0x155b70){_0x1f2750['sendStatus'](0x194);}return _0x155b70;};}function handleError(_0x4c0d80,_0x2c7c6b){_0x2c7c6b=_0x2c7c6b||0x1f4;return function(_0x5f3945){logger[_0xb647('0x2b')](_0x5f3945[_0xb647('0x2c')]);if(_0x5f3945[_0xb647('0x2d')]){delete _0x5f3945[_0xb647('0x2d')];}_0x4c0d80[_0xb647('0x1e')](_0x2c7c6b)[_0xb647('0x2e')](_0x5f3945);};}exports[_0xb647('0x2f')]=function(_0x17fa31,_0xa90d28){var _0x41806c={},_0x5c80a4={},_0x8ddaa4={'count':0x0,'rows':[]};var _0x324167=_[_0xb647('0x30')](db[_0xb647('0x31')]['rawAttributes'],function(_0x291625){return{'name':_0x291625[_0xb647('0x32')],'type':_0x291625[_0xb647('0x33')]['key']};});_0x5c80a4[_0xb647('0x34')]=_[_0xb647('0x30')](_0x324167,'name');_0x5c80a4[_0xb647('0x35')]=_[_0xb647('0x36')](_0x17fa31[_0xb647('0x35')]);_0x5c80a4[_0xb647('0x37')]=_[_0xb647('0x38')](_0x5c80a4[_0xb647('0x34')],_0x5c80a4[_0xb647('0x35')]);_0x41806c[_0xb647('0x39')]=_[_0xb647('0x38')](_0x5c80a4[_0xb647('0x34')],qs['fields'](_0x17fa31['query'][_0xb647('0x3a')]));_0x41806c[_0xb647('0x39')]=_0x41806c['attributes']['length']?_0x41806c[_0xb647('0x39')]:_0x5c80a4['model'];if(!_0x17fa31[_0xb647('0x35')][_0xb647('0x3b')](_0xb647('0x3c'))){_0x41806c[_0xb647('0x21')]=qs[_0xb647('0x21')](_0x17fa31[_0xb647('0x35')]['limit']);_0x41806c[_0xb647('0x20')]=qs['offset'](_0x17fa31[_0xb647('0x35')][_0xb647('0x20')]);}_0x41806c[_0xb647('0x3d')]=qs[_0xb647('0x3e')](_0x17fa31[_0xb647('0x35')][_0xb647('0x3e')]);_0x41806c[_0xb647('0x3f')]=qs[_0xb647('0x37')](_[_0xb647('0x40')](_0x17fa31[_0xb647('0x35')],_0x5c80a4[_0xb647('0x37')]),_0x324167);if(_0x17fa31[_0xb647('0x35')][_0xb647('0x41')]){_0x41806c[_0xb647('0x3f')]=_[_0xb647('0x42')](_0x41806c[_0xb647('0x3f')],{'$or':_['map'](_0x324167,function(_0x11b90b){if(_0x11b90b[_0xb647('0x33')]!==_0xb647('0x43')){var _0x2f2298={};_0x2f2298[_0x11b90b['name']]={'$like':'%'+_0x17fa31[_0xb647('0x35')][_0xb647('0x41')]+'%'};return _0x2f2298;}})});}_0x41806c=_[_0xb647('0x42')]({},_0x41806c,_0x17fa31[_0xb647('0x44')]);var _0x358bdd={'where':_0x41806c['where']};return db['SmsQueue'][_0xb647('0x23')](_0x358bdd)[_0xb647('0x28')](function(_0x5abedb){_0x8ddaa4['count']=_0x5abedb;if(_0x17fa31['query']['includeAll']){_0x41806c[_0xb647('0x45')]=[{'all':!![]}];}return db[_0xb647('0x31')][_0xb647('0x46')](_0x41806c);})['then'](function(_0x42eabd){_0x8ddaa4['rows']=_0x42eabd;return _0x8ddaa4;})[_0xb647('0x28')](respondWithFilteredResult(_0xa90d28,_0x41806c))[_0xb647('0x47')](handleError(_0xa90d28,null));};exports[_0xb647('0x48')]=function(_0x52b565,_0x3d8478){var _0x4dadad={'raw':!![],'where':{'id':_0x52b565[_0xb647('0x49')]['id']}},_0x35760b={};_0x35760b['model']=_[_0xb647('0x36')](db[_0xb647('0x31')][_0xb647('0x4a')]);_0x35760b[_0xb647('0x35')]=_['keys'](_0x52b565['query']);_0x35760b['filters']=_['intersection'](_0x35760b['model'],_0x35760b[_0xb647('0x35')]);_0x4dadad[_0xb647('0x39')]=_[_0xb647('0x38')](_0x35760b['model'],qs[_0xb647('0x3a')](_0x52b565[_0xb647('0x35')][_0xb647('0x3a')]));_0x4dadad[_0xb647('0x39')]=_0x4dadad[_0xb647('0x39')]['length']?_0x4dadad['attributes']:_0x35760b['model'];if(_0x52b565[_0xb647('0x35')]['includeAll']){_0x4dadad['include']=[{'all':!![]}];}_0x4dadad=_[_0xb647('0x42')]({},_0x4dadad,_0x52b565[_0xb647('0x44')]);return db['SmsQueue'][_0xb647('0x4b')](_0x4dadad)[_0xb647('0x28')](handleEntityNotFound(_0x3d8478,null))[_0xb647('0x28')](respondWithResult(_0x3d8478,null))[_0xb647('0x47')](handleError(_0x3d8478,null));};exports['create']=function(_0x5de235,_0x1f4d5e){return db['SmsQueue'][_0xb647('0x4c')](_0x5de235[_0xb647('0x4d')],{})[_0xb647('0x28')](function(_0x352e54){var _0x8fddeb=_0x5de235[_0xb647('0x4e')][_0xb647('0x4f')]({'plain':!![]});if(!_0x8fddeb)throw new Error(_0xb647('0x50'));if(_0x8fddeb[_0xb647('0x51')]===_0xb647('0x4e')){var _0x1fee0d=_0x352e54[_0xb647('0x4f')]({'plain':!![]});var _0x24d063='SmsQueues';return db[_0xb647('0x52')]['find']({'where':{'name':_0x24d063,'userProfileId':_0x8fddeb[_0xb647('0x53')]},'raw':!![]})[_0xb647('0x28')](function(_0x158d7e){if(_0x158d7e&&_0x158d7e[_0xb647('0x54')]===0x0){return db[_0xb647('0x2a')][_0xb647('0x4c')]({'name':_0x1fee0d[_0xb647('0x2d')],'resourceId':_0x1fee0d['id'],'type':_0x158d7e[_0xb647('0x2d')],'sectionId':_0x158d7e['id']},{})[_0xb647('0x28')](function(){return _0x352e54;});}else{return _0x352e54;}})[_0xb647('0x47')](function(_0x405511){logger[_0xb647('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x405511);throw _0x405511;});}return _0x352e54;})[_0xb647('0x28')](respondWithResult(_0x1f4d5e,0xc9))[_0xb647('0x47')](handleError(_0x1f4d5e,null));};exports['update']=function(_0xf31aaf,_0x504a44){if(_0xf31aaf[_0xb647('0x4d')]['id']){delete _0xf31aaf[_0xb647('0x4d')]['id'];}return db[_0xb647('0x31')][_0xb647('0x4b')]({'where':{'id':_0xf31aaf['params']['id']}})['then'](handleEntityNotFound(_0x504a44,null))['then'](saveUpdates(_0xf31aaf[_0xb647('0x4d')],null))[_0xb647('0x28')](respondWithResult(_0x504a44,null))[_0xb647('0x47')](handleError(_0x504a44,null));};exports[_0xb647('0x27')]=function(_0x48228b,_0x32dad1){return db[_0xb647('0x31')]['find']({'where':{'id':_0x48228b[_0xb647('0x49')]['id']}})[_0xb647('0x28')](handleEntityNotFound(_0x32dad1,null))[_0xb647('0x28')](removeEntity(_0x32dad1,null))[_0xb647('0x47')](handleError(_0x32dad1,null));};exports[_0xb647('0x55')]=function(_0x50a962,_0x3fbf64){return db[_0xb647('0x31')][_0xb647('0x55')]()[_0xb647('0x28')](respondWithResult(_0x3fbf64,null))[_0xb647('0x47')](handleError(_0x3fbf64,null));};exports[_0xb647('0x56')]=function(_0xe9e65c,_0x477e86,_0x111f17){var _0x12e535={'raw':!![],'where':{}},_0x34e864={},_0x151f15;return db[_0xb647('0x31')][_0xb647('0x57')]({'where':{'id':_0xe9e65c[_0xb647('0x49')]['id']}})[_0xb647('0x28')](handleEntityNotFound(_0x477e86,null))[_0xb647('0x28')](function(_0x51dd87){if(_0x51dd87){_0x151f15=_0x51dd87[_0xb647('0x4f')]({'plain':!![]});_0x34e864[_0xb647('0x34')]=_[_0xb647('0x36')](db['UserSmsQueue']['rawAttributes']);_0x34e864[_0xb647('0x35')]=_[_0xb647('0x36')](_0xe9e65c[_0xb647('0x35')]);_0x34e864[_0xb647('0x37')]=_[_0xb647('0x38')](_0x34e864[_0xb647('0x34')],_0x34e864[_0xb647('0x35')]);_0x12e535[_0xb647('0x39')]=_['intersection'](_0x34e864[_0xb647('0x34')],qs[_0xb647('0x3a')](_0xe9e65c[_0xb647('0x35')][_0xb647('0x3a')]));_0x12e535[_0xb647('0x39')]=_0x12e535[_0xb647('0x39')][_0xb647('0x58')]?_0x12e535[_0xb647('0x39')]:_0x34e864[_0xb647('0x34')];if(!_0xe9e65c['query'][_0xb647('0x3b')]('nolimit')){_0x12e535[_0xb647('0x21')]=qs['limit'](_0xe9e65c[_0xb647('0x35')]['limit']);_0x12e535['offset']=qs[_0xb647('0x20')](_0xe9e65c[_0xb647('0x35')][_0xb647('0x20')]);}_0x12e535[_0xb647('0x3d')]=qs['sort'](_0xe9e65c[_0xb647('0x35')]['sort']);_0x12e535['where']=qs[_0xb647('0x37')](_[_0xb647('0x40')](_0xe9e65c[_0xb647('0x35')],_0x34e864[_0xb647('0x37')]));_0x12e535[_0xb647('0x3f')]['SmsQueueId']=_0x51dd87['id'];if(_0xe9e65c[_0xb647('0x35')]['filter']){_0x12e535['where']=_[_0xb647('0x42')](_0x12e535['where'],{'$or':_['map'](_0x12e535['attributes'],function(_0x41d77b){var _0x2fce3e={};_0x2fce3e[_0x41d77b]={'$like':'%'+_0xe9e65c[_0xb647('0x35')][_0xb647('0x41')]+'%'};return _0x2fce3e;})});}_0x12e535=_['merge']({},_0x12e535,_0xe9e65c[_0xb647('0x44')]);return db[_0xb647('0x59')][_0xb647('0x46')](_0x12e535);}})['then'](function(_0x483d85){if(_0x483d85){return db['User'][_0xb647('0x5a')]({'where':{'id':_[_0xb647('0x30')](_0x483d85,_0xb647('0x5b')),'role':'agent'},'attributes':['id','name',_0xb647('0x5c'),_0xb647('0x5d'),'createdAt']});}})['then'](function(_0x345532){if(_0x345532){return{'count':_0x345532[_0xb647('0x23')],'rows':_[_0xb647('0x30')](_0x345532[_0xb647('0x5e')],function(_0x1f3333){return{'membername':_0x1f3333[_0xb647('0x2d')],'UserId':_0x1f3333['id'],'queue_name':_0x151f15[_0xb647('0x2d')],'SmsQueueId':_0x151f15['id'],'interface':util[_0xb647('0x5f')](_0xb647('0x60'),'SIP',_0x1f3333[_0xb647('0x2d')]),'penalty':0x0,'paused':_0x1f3333[_0xb647('0x5c')],'createdAt':_0x1f3333[_0xb647('0x61')],'updatedAt':_0x1f3333[_0xb647('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb647('0x28')](respondWithFilteredResult(_0x477e86,_0x12e535))['catch'](handleError(_0x477e86,null));};exports[_0xb647('0x62')]=function(_0x5cb0d7,_0x3a381e,_0x134b87){var _0x4e261f={};var _0x5160ba={};var _0x7673c4;var _0x3b7e3a;return db[_0xb647('0x31')][_0xb647('0x57')]({'where':{'id':_0x5cb0d7[_0xb647('0x49')]['id']}})[_0xb647('0x28')](handleEntityNotFound(_0x3a381e,null))[_0xb647('0x28')](function(_0x3547e5){if(_0x3547e5){_0x7673c4=_0x3547e5;_0x5160ba['model']=_[_0xb647('0x36')](db[_0xb647('0x63')][_0xb647('0x4a')]);_0x5160ba[_0xb647('0x35')]=_[_0xb647('0x36')](_0x5cb0d7[_0xb647('0x35')]);_0x5160ba['filters']=_[_0xb647('0x38')](_0x5160ba[_0xb647('0x34')],_0x5160ba[_0xb647('0x35')]);_0x4e261f[_0xb647('0x39')]=_[_0xb647('0x38')](_0x5160ba[_0xb647('0x34')],qs[_0xb647('0x3a')](_0x5cb0d7['query'][_0xb647('0x3a')]));_0x4e261f[_0xb647('0x39')]=_0x4e261f[_0xb647('0x39')]['length']?_0x4e261f['attributes']:_0x5160ba[_0xb647('0x34')];_0x4e261f[_0xb647('0x3d')]=qs[_0xb647('0x3e')](_0x5cb0d7[_0xb647('0x35')][_0xb647('0x3e')]);_0x4e261f[_0xb647('0x3f')]=qs[_0xb647('0x37')](_['pick'](_0x5cb0d7[_0xb647('0x35')],_0x5160ba[_0xb647('0x37')]));if(_0x5cb0d7[_0xb647('0x35')][_0xb647('0x41')]){_0x4e261f[_0xb647('0x3f')]=_['merge'](_0x4e261f[_0xb647('0x3f')],{'$or':_['map'](_0x4e261f[_0xb647('0x39')],function(_0x52718d){var _0x3a9435={};_0x3a9435[_0x52718d]={'$like':'%'+_0x5cb0d7['query'][_0xb647('0x41')]+'%'};return _0x3a9435;})});}_0x4e261f=_['merge']({},_0x4e261f,_0x5cb0d7[_0xb647('0x44')]);return _0x7673c4[_0xb647('0x62')](_0x4e261f);}})[_0xb647('0x28')](function(_0x1266cc){if(_0x1266cc){_0x3b7e3a=_0x1266cc[_0xb647('0x58')];if(!_0x5cb0d7[_0xb647('0x35')]['hasOwnProperty'](_0xb647('0x3c'))){_0x4e261f[_0xb647('0x21')]=qs[_0xb647('0x21')](_0x5cb0d7[_0xb647('0x35')]['limit']);_0x4e261f[_0xb647('0x20')]=qs[_0xb647('0x20')](_0x5cb0d7[_0xb647('0x35')]['offset']);}return _0x7673c4[_0xb647('0x62')](_0x4e261f);}})['then'](function(_0x15316f){if(_0x15316f){return _0x15316f?{'count':_0x3b7e3a,'rows':_0x15316f}:null;}})[_0xb647('0x28')](respondWithResult(_0x3a381e,null))['catch'](handleError(_0x3a381e,null));};exports[_0xb647('0x64')]=function(_0x7a158b,_0x2b5c6c,_0x50137f){var _0x595e8b=_0x7a158b[_0xb647('0x4d')][_0xb647('0x65')];return db[_0xb647('0x63')][_0xb647('0x46')]({'where':{'id':_0x595e8b},'attributes':['id'],'include':[{'model':db[_0xb647('0x66')],'as':_0xb647('0x67'),'attributes':['id',_0xb647('0x2d'),_0xb647('0x68'),'voicePause',_0xb647('0x69')],'raw':!![]}]})[_0xb647('0x28')](function(_0x6090de){if(_0x6090de){var _0x58f81e=_['flatMap'](_0x6090de,function(_0x3f638b){var _0x187776=_0x3f638b['get']({'plain':!![]});return _0x187776[_0xb647('0x67')];});return db[_0xb647('0x31')]['find']({'where':{'id':_0x7a158b['params']['id']}})[_0xb647('0x28')](function(_0x47f4dc){return db[_0xb647('0x6a')]['transaction'](function(_0x4cd80d){return _0x47f4dc['addTeams'](_0x595e8b,{'transaction':_0x4cd80d})[_0xb647('0x28')](function(){return BPromise[_0xb647('0x6b')](_0x58f81e,function(_0x5963e7){return db['UserSmsQueue'][_0xb647('0x6c')]({'where':{'UserId':_0x5963e7['id'],'SmsQueueId':_0x7a158b[_0xb647('0x49')]['id']},'transaction':_0x4cd80d});});})[_0xb647('0x28')](function(){_0x58f81e[_0xb647('0x6d')](function(_0x3a6a87){socket[_0xb647('0x6e')]('userSmsQueue:save',{'UserId':_0x3a6a87['id'],'SmsQueueId':_0x47f4dc['id']});});});});});}})[_0xb647('0x28')](respondWithStatusCode(_0x2b5c6c,null))[_0xb647('0x47')](handleError(_0x2b5c6c,null));};exports[_0xb647('0x6f')]=function(_0x120179,_0x1d5641,_0x79d842){return db[_0xb647('0x63')][_0xb647('0x46')]({'where':{'id':_0x120179['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xb647('0x66')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb647('0x28')](handleEntityNotFound(_0x1d5641,null))[_0xb647('0x28')](function(_0x24028a){var _0x486e1e=_['map'](_0x24028a,'id');var _0x4b6314=[];var _0x585686=[];var _0x93d827=squel['select']();_0x93d827[_0xb647('0x70')](_0xb647('0x71'))['from']('team_has_sms_queues','tq')['join'](_0xb647('0x72'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xb647('0x3f')](_0xb647('0x73'),_0x120179[_0xb647('0x49')]['id']);for(var _0x250bfb=0x0;_0x250bfb<_0x24028a['length'];_0x250bfb+=0x1){let _0x29fb1b=_0x24028a[_0x250bfb];for(var _0x4f1258=0x0;_0x4f1258<_0x29fb1b[_0xb647('0x67')][_0xb647('0x58')];_0x4f1258+=0x1){let _0x23b0a7=_0x29fb1b[_0xb647('0x67')][_0x4f1258];var _0x553bad=_0x93d827[_0xb647('0x74')]();_0x553bad[_0xb647('0x3f')](_0xb647('0x75'),_0x23b0a7['id']);_0x585686[_0xb647('0x76')](db['sequelize'][_0xb647('0x35')](_0x553bad[_0xb647('0x77')](),{'type':db[_0xb647('0x6a')]['QueryTypes'][_0xb647('0x78')]})[_0xb647('0x28')](function(_0x94667e){if(_0x94667e[_0xb647('0x58')]===0x1){return _0x23b0a7['id'];}else{var _0x1068c5=_[_0xb647('0x79')](_['map'](_0x94667e,_0xb647('0x7a')),function(_0x12fac5){return _[_0xb647('0x7b')](_0x486e1e,_0x12fac5);});if(_0x1068c5){return _0x23b0a7['id'];}}}));}}return BPromise['all'](_0x585686)[_0xb647('0x28')](function(_0x5b3fb6){_0x4b6314=_(_0x4b6314)[_0xb647('0x7c')](_0x5b3fb6)['compact']()[_0xb647('0x7d')]();return db[_0xb647('0x31')][_0xb647('0x4b')]({'where':{'id':_0x120179[_0xb647('0x49')]['id']}})['then'](function(_0x354b36){return db[_0xb647('0x6a')][_0xb647('0x7e')](function(_0x36b49c){return _0x354b36[_0xb647('0x6f')](_0x120179[_0xb647('0x35')]['ids'],{'transaction':_0x36b49c})['then'](function(){if(!_['isEmpty'](_0x4b6314)){return _0x354b36[_0xb647('0x7f')](_0x4b6314,{'transaction':_0x36b49c});}})[_0xb647('0x28')](function(){_0x4b6314[_0xb647('0x6d')](function(_0x93733f){socket['emit'](_0xb647('0x80'),{'UserId':_0x93733f,'SmsQueueId':_0x354b36['id']});});});});});});})['then'](respondWithStatusCode(_0x1d5641,null))[_0xb647('0x47')](handleError(_0x1d5641,null));};exports[_0xb647('0x81')]=function(_0x42e8f2,_0x5c7f7d,_0x5573d9){return db[_0xb647('0x31')][_0xb647('0x4b')]({'where':{'id':_0x42e8f2[_0xb647('0x49')]['id']}})[_0xb647('0x28')](handleEntityNotFound(_0x5c7f7d,null))[_0xb647('0x28')](function(_0x2ba468){if(_0x2ba468){return _0x2ba468[_0xb647('0x81')](_0x42e8f2[_0xb647('0x4d')][_0xb647('0x65')],_['omit'](_0x42e8f2[_0xb647('0x4d')],[_0xb647('0x65'),'id'])||{})['spread'](function(_0x334746){for(var _0x1ad724=0x0;_0x1ad724<_0x42e8f2[_0xb647('0x4d')][_0xb647('0x65')]['length'];_0x1ad724+=0x1){socket[_0xb647('0x6e')](_0xb647('0x82'),{'UserId':Number(_0x42e8f2[_0xb647('0x4d')][_0xb647('0x65')][_0x1ad724]),'SmsQueueId':Number(_0x42e8f2[_0xb647('0x49')]['id'])});}return _0x334746;});}})[_0xb647('0x28')](respondWithResult(_0x5c7f7d,null))['catch'](handleError(_0x5c7f7d,null));};exports[_0xb647('0x7f')]=function(_0x16d8be,_0x54fbc8,_0x8b34b7){return db['SmsQueue'][_0xb647('0x4b')]({'where':{'id':_0x16d8be[_0xb647('0x49')]['id']}})[_0xb647('0x28')](handleEntityNotFound(_0x54fbc8,null))['then'](function(_0x213563){if(_0x213563){return _0x213563['removeAgents'](_0x16d8be['query'][_0xb647('0x65')])[_0xb647('0x28')](function(){if(_[_0xb647('0x83')](_0x16d8be[_0xb647('0x35')][_0xb647('0x65')])){for(var _0x4ef1e0=0x0;_0x4ef1e0<_0x16d8be[_0xb647('0x35')][_0xb647('0x65')][_0xb647('0x58')];_0x4ef1e0+=0x1){socket[_0xb647('0x6e')](_0xb647('0x80'),{'UserId':Number(_0x16d8be['query'][_0xb647('0x65')][_0x4ef1e0]),'SmsQueueId':Number(_0x16d8be[_0xb647('0x49')]['id'])});}}else{socket[_0xb647('0x6e')]('userSmsQueue:remove',{'UserId':Number(_0x16d8be[_0xb647('0x35')][_0xb647('0x65')]),'SmsQueueId':Number(_0x16d8be['params']['id'])});}});}})[_0xb647('0x28')](respondWithStatusCode(_0x54fbc8,null))[_0xb647('0x47')](handleError(_0x54fbc8,null));};exports[_0xb647('0x84')]=function(_0x5883e1,_0x214373,_0xffb389){var _0xa31ad9={};var _0x4ae4c3={};var _0x38b865;var _0x425489;return db[_0xb647('0x31')][_0xb647('0x57')]({'where':{'id':_0x5883e1[_0xb647('0x49')]['id']}})['then'](handleEntityNotFound(_0x214373,null))[_0xb647('0x28')](function(_0x2fd0e5){if(_0x2fd0e5){_0x38b865=_0x2fd0e5;_0x4ae4c3[_0xb647('0x34')]=_['keys'](db[_0xb647('0x66')]['rawAttributes']);_0x4ae4c3[_0xb647('0x35')]=_[_0xb647('0x36')](_0x5883e1[_0xb647('0x35')]);_0x4ae4c3[_0xb647('0x37')]=_[_0xb647('0x38')](_0x4ae4c3[_0xb647('0x34')],_0x4ae4c3[_0xb647('0x35')]);_0xa31ad9['attributes']=_[_0xb647('0x38')](_0x4ae4c3[_0xb647('0x34')],qs['fields'](_0x5883e1[_0xb647('0x35')][_0xb647('0x3a')]));_0xa31ad9[_0xb647('0x39')]=_0xa31ad9[_0xb647('0x39')]['length']?_0xa31ad9[_0xb647('0x39')]:_0x4ae4c3[_0xb647('0x34')];_0xa31ad9[_0xb647('0x3d')]=qs[_0xb647('0x3e')](_0x5883e1[_0xb647('0x35')][_0xb647('0x3e')]);_0xa31ad9['where']=qs[_0xb647('0x37')](_[_0xb647('0x40')](_0x5883e1[_0xb647('0x35')],_0x4ae4c3['filters']));if(_0x5883e1[_0xb647('0x35')]['filter']){_0xa31ad9[_0xb647('0x3f')]=_[_0xb647('0x42')](_0xa31ad9[_0xb647('0x3f')],{'$or':_[_0xb647('0x30')](_0xa31ad9['attributes'],function(_0x2d82cf){var _0x1f6695={};_0x1f6695[_0x2d82cf]={'$like':'%'+_0x5883e1[_0xb647('0x35')][_0xb647('0x41')]+'%'};return _0x1f6695;})});}_0xa31ad9=_[_0xb647('0x42')]({},_0xa31ad9,_0x5883e1[_0xb647('0x44')]);return _0x38b865[_0xb647('0x84')](_0xa31ad9);}})[_0xb647('0x28')](function(_0x186c3a){if(_0x186c3a){_0x425489=_0x186c3a[_0xb647('0x58')];if(!_0x5883e1['query']['hasOwnProperty']('nolimit')){_0xa31ad9[_0xb647('0x21')]=qs[_0xb647('0x21')](_0x5883e1['query']['limit']);_0xa31ad9[_0xb647('0x20')]=qs['offset'](_0x5883e1[_0xb647('0x35')][_0xb647('0x20')]);}return _0x38b865[_0xb647('0x84')](_0xa31ad9);}})[_0xb647('0x28')](function(_0x152991){if(_0x152991){return _0x152991?{'count':_0x425489,'rows':_0x152991}:null;}})[_0xb647('0x28')](respondWithResult(_0x214373,null))[_0xb647('0x47')](handleError(_0x214373,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 5ffed2b..56ac3a8 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 _0x8aed=['save','update','remove','emit','hook','exports','events','SmsQueue','setMaxListeners'];(function(_0x255e5e,_0x485b66){var _0x237f14=function(_0x4154cf){while(--_0x4154cf){_0x255e5e['push'](_0x255e5e['shift']());}};_0x237f14(++_0x485b66);}(_0x8aed,0x1ec));var _0xd8ae=function(_0x5367be,_0x58105a){_0x5367be=_0x5367be-0x0;var _0xcc9296=_0x8aed[_0x5367be];return _0xcc9296;};'use strict';var EventEmitter=require(_0xd8ae('0x0'));var SmsQueue=require('../../mysqldb')['db'][_0xd8ae('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xd8ae('0x2')](0x0);var events={'afterCreate':_0xd8ae('0x3'),'afterUpdate':_0xd8ae('0x4'),'afterDestroy':_0xd8ae('0x5')};function emitEvent(_0x560123){return function(_0x18abcd,_0x28f27b,_0x1bbcda){SmsQueueEvents[_0xd8ae('0x6')](_0x560123+':'+_0x18abcd['id'],_0x18abcd);SmsQueueEvents['emit'](_0x560123,_0x18abcd);_0x1bbcda(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xd8ae('0x7')](e,emitEvent(event));}}module[_0xd8ae('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xeb3d=['SmsQueue','save','emit','exports','events','../../mysqldb'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xeb3d,0xf4));var _0xdeb3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xeb3d[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xdeb3('0x0'));var SmsQueue=require(_0xdeb3('0x1'))['db'][_0xdeb3('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xdeb3('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x27217a){return function(_0x10e6c7,_0x400193,_0x3e1600){SmsQueueEvents[_0xdeb3('0x4')](_0x27217a+':'+_0x10e6c7['id'],_0x10e6c7);SmsQueueEvents[_0xdeb3('0x4')](_0x27217a,_0x10e6c7);_0x3e1600(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xdeb3('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 02c5d5d..5bd8ac0 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 _0x81d2=['util','api','bluebird','request-promise','path','../../config/environment','./smsQueue.attributes','exports','SmsQueue','lodash'];(function(_0x19cdb3,_0x21848f){var _0x493c90=function(_0x203331){while(--_0x203331){_0x19cdb3['push'](_0x19cdb3['shift']());}};_0x493c90(++_0x21848f);}(_0x81d2,0x1e9));var _0x281d=function(_0x373898,_0x3c6df5){_0x373898=_0x373898-0x0;var _0x4bad81=_0x81d2[_0x373898];return _0x4bad81;};'use strict';var _=require(_0x281d('0x0'));var util=require(_0x281d('0x1'));var logger=require('../../config/logger')(_0x281d('0x2'));var moment=require('moment');var BPromise=require(_0x281d('0x3'));var rp=require(_0x281d('0x4'));var fs=require('fs');var path=require(_0x281d('0x5'));var rimraf=require('rimraf');var config=require(_0x281d('0x6'));var attributes=require(_0x281d('0x7'));module[_0x281d('0x8')]=function(_0x226569,_0x17e47f){return _0x226569['define'](_0x281d('0x9'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f35=['util','../../config/logger','api','request-promise','path','../../config/environment','define','SmsQueue','lodash'];(function(_0x3291ff,_0xb1c752){var _0x5aab48=function(_0x513ce3){while(--_0x513ce3){_0x3291ff['push'](_0x3291ff['shift']());}};_0x5aab48(++_0xb1c752);}(_0x8f35,0x1d3));var _0x58f3=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x8f35[_0x35da42];return _0x370035;};'use strict';var _=require(_0x58f3('0x0'));var util=require(_0x58f3('0x1'));var logger=require(_0x58f3('0x2'))(_0x58f3('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x58f3('0x4'));var fs=require('fs');var path=require(_0x58f3('0x5'));var rimraf=require('rimraf');var config=require(_0x58f3('0x6'));var attributes=require('./smsQueue.attributes');module['exports']=function(_0x12c482,_0x30bb3a){return _0x12c482[_0x58f3('0x7')](_0x58f3('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 1e42ddd..1e4dfe5 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 _0xc537=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetSmsQueue','SmsQueue','findAll','raw','options','attributes','limit','include','model','map','find','where','ShowSmsQueue','lodash'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xc537,0xfb));var _0x7c53=function(_0xb73dfa,_0x58b466){_0xb73dfa=_0xb73dfa-0x0;var _0x50204a=_0xc537[_0xb73dfa];return _0x50204a;};'use strict';var _=require(_0x7c53('0x0'));var util=require(_0x7c53('0x1'));var moment=require(_0x7c53('0x2'));var BPromise=require(_0x7c53('0x3'));var rs=require(_0x7c53('0x4'));var fs=require('fs');var Redis=require(_0x7c53('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7c53('0x6'));var logger=require('../../config/logger')(_0x7c53('0x7'));var config=require(_0x7c53('0x8'));var jayson=require(_0x7c53('0x9'));var client=jayson[_0x7c53('0xa')][_0x7c53('0xb')]({'port':0x232a});config[_0x7c53('0xc')]=_[_0x7c53('0xd')](config[_0x7c53('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x7c53('0xe'))(new Redis(config['redis']));require(_0x7c53('0xf'))[_0x7c53('0x10')](socket);function respondWithRpcPromise(_0x8c0a93,_0x3a6b8b,_0x575329){return new BPromise(function(_0x4c6a87,_0x5907ed){return client[_0x7c53('0x11')](_0x8c0a93,_0x575329)[_0x7c53('0x12')](function(_0x588ffe){logger['info'](_0x7c53('0x13'),_0x3a6b8b,_0x7c53('0x14'));logger[_0x7c53('0x15')](_0x7c53('0x16'),_0x3a6b8b,_0x7c53('0x14'),JSON[_0x7c53('0x17')](_0x588ffe));if(_0x588ffe[_0x7c53('0x18')]){if(_0x588ffe[_0x7c53('0x18')]['code']===0x1f4){logger[_0x7c53('0x18')](_0x7c53('0x13'),_0x3a6b8b,_0x588ffe['error'][_0x7c53('0x19')]);return _0x5907ed(_0x588ffe[_0x7c53('0x18')][_0x7c53('0x19')]);}logger[_0x7c53('0x18')]('SmsQueue,\x20%s,\x20%s',_0x3a6b8b,_0x588ffe['error']['message']);return _0x4c6a87(_0x588ffe[_0x7c53('0x18')][_0x7c53('0x19')]);}else{logger[_0x7c53('0x1a')](_0x7c53('0x13'),_0x3a6b8b,_0x7c53('0x14'));_0x4c6a87(_0x588ffe[_0x7c53('0x1b')][_0x7c53('0x19')]);}})[_0x7c53('0x1c')](function(_0x2ef4c6){logger[_0x7c53('0x18')]('SmsQueue,\x20%s,\x20%s',_0x3a6b8b,_0x2ef4c6);_0x5907ed(_0x2ef4c6);});});}exports[_0x7c53('0x1d')]=function(_0x2dd624){var _0x2d4808=this;return new Promise(function(_0x4824cb,_0x461a99){return db[_0x7c53('0x1e')][_0x7c53('0x1f')]({'raw':_0x2dd624['options']?_0x2dd624['options'][_0x7c53('0x20')]===undefined?!![]:![]:!![],'where':_0x2dd624[_0x7c53('0x21')]?_0x2dd624[_0x7c53('0x21')]['where']||null:null,'attributes':_0x2dd624[_0x7c53('0x21')]?_0x2dd624[_0x7c53('0x21')][_0x7c53('0x22')]||null:null,'limit':_0x2dd624[_0x7c53('0x21')]?_0x2dd624[_0x7c53('0x21')][_0x7c53('0x23')]||null:null,'include':_0x2dd624[_0x7c53('0x21')]?_0x2dd624[_0x7c53('0x21')][_0x7c53('0x24')]?_['map'](_0x2dd624[_0x7c53('0x21')]['include'],function(_0x2042c9){return{'model':db[_0x2042c9[_0x7c53('0x25')]],'as':_0x2042c9['as'],'attributes':_0x2042c9[_0x7c53('0x22')],'include':_0x2042c9[_0x7c53('0x24')]?_[_0x7c53('0x26')](_0x2042c9['include'],function(_0x1e1536){return{'model':db[_0x1e1536[_0x7c53('0x25')]],'as':_0x1e1536['as'],'attributes':_0x1e1536['attributes'],'include':_0x1e1536[_0x7c53('0x24')]?_[_0x7c53('0x26')](_0x1e1536[_0x7c53('0x24')],function(_0x47f7e3){return{'model':db[_0x47f7e3[_0x7c53('0x25')]],'as':_0x47f7e3['as'],'attributes':_0x47f7e3['attributes']};}):[]};}):[]};}):[]:[]})[_0x7c53('0x12')](function(_0x1c020a){logger['info']('GetSmsQueue',_0x2dd624);logger[_0x7c53('0x15')](_0x7c53('0x1d'),_0x2dd624,JSON[_0x7c53('0x17')](_0x1c020a));_0x4824cb(_0x1c020a);})['catch'](function(_0x4c52df){logger[_0x7c53('0x18')](_0x7c53('0x1d'),_0x4c52df[_0x7c53('0x19')],_0x2dd624);_0x461a99(_0x2d4808[_0x7c53('0x18')](0x1f4,_0x4c52df[_0x7c53('0x19')]));});});};exports['ShowSmsQueue']=function(_0x34b427){var _0x40af14=this;return new Promise(function(_0x42178e,_0x26d4d7){return db[_0x7c53('0x1e')][_0x7c53('0x27')]({'raw':_0x34b427['options']?_0x34b427[_0x7c53('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x34b427['options']?_0x34b427[_0x7c53('0x21')][_0x7c53('0x28')]||null:null,'attributes':_0x34b427[_0x7c53('0x21')]?_0x34b427[_0x7c53('0x21')][_0x7c53('0x22')]||null:null,'include':_0x34b427['options']?_0x34b427[_0x7c53('0x21')]['include']?_['map'](_0x34b427[_0x7c53('0x21')][_0x7c53('0x24')],function(_0x5e9152){return{'model':db[_0x5e9152[_0x7c53('0x25')]],'as':_0x5e9152['as'],'attributes':_0x5e9152[_0x7c53('0x22')],'include':_0x5e9152['include']?_[_0x7c53('0x26')](_0x5e9152[_0x7c53('0x24')],function(_0x370da1){return{'model':db[_0x370da1[_0x7c53('0x25')]],'as':_0x370da1['as'],'attributes':_0x370da1[_0x7c53('0x22')],'include':_0x370da1[_0x7c53('0x24')]?_[_0x7c53('0x26')](_0x370da1[_0x7c53('0x24')],function(_0x43805e){return{'model':db[_0x43805e[_0x7c53('0x25')]],'as':_0x43805e['as'],'attributes':_0x43805e[_0x7c53('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7c53('0x12')](function(_0x4df905){logger[_0x7c53('0x1a')](_0x7c53('0x29'),_0x34b427);logger[_0x7c53('0x15')]('ShowSmsQueue',_0x34b427,JSON[_0x7c53('0x17')](_0x4df905));_0x42178e(_0x4df905);})['catch'](function(_0x972e5){logger[_0x7c53('0x18')](_0x7c53('0x29'),_0x972e5[_0x7c53('0x19')],_0x34b427);_0x26d4d7(_0x40af14[_0x7c53('0x18')](0x1f4,_0x972e5['message']));});});}; \ No newline at end of file +var _0x753b=['lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','limit','include','model','attributes','map','ShowSmsQueue','find'];(function(_0x4059bd,_0x52134e){var _0x3e4cb1=function(_0x19f29e){while(--_0x19f29e){_0x4059bd['push'](_0x4059bd['shift']());}};_0x3e4cb1(++_0x52134e);}(_0x753b,0x190));var _0xb753=function(_0xd9f102,_0x5a0d28){_0xd9f102=_0xd9f102-0x0;var _0x2652e4=_0x753b[_0xd9f102];return _0x2652e4;};'use strict';var _=require(_0xb753('0x0'));var util=require(_0xb753('0x1'));var moment=require(_0xb753('0x2'));var BPromise=require('bluebird');var rs=require(_0xb753('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb753('0x4'));var logger=require(_0xb753('0x5'))(_0xb753('0x6'));var config=require(_0xb753('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb753('0x8')]['http']({'port':0x232a});config[_0xb753('0x9')]=_[_0xb753('0xa')](config[_0xb753('0x9')],{'host':_0xb753('0xb'),'port':0x18eb});var socket=require(_0xb753('0xc'))(new Redis(config[_0xb753('0x9')]));require(_0xb753('0xd'))[_0xb753('0xe')](socket);function respondWithRpcPromise(_0x3769c0,_0x783138,_0x467a4a){return new BPromise(function(_0x3caca2,_0x534e2b){return client[_0xb753('0xf')](_0x3769c0,_0x467a4a)[_0xb753('0x10')](function(_0x51faf1){logger[_0xb753('0x11')]('SmsQueue,\x20%s,\x20%s',_0x783138,'request\x20sent');logger[_0xb753('0x12')](_0xb753('0x13'),_0x783138,'request\x20sent',JSON[_0xb753('0x14')](_0x51faf1));if(_0x51faf1[_0xb753('0x15')]){if(_0x51faf1['error']['code']===0x1f4){logger[_0xb753('0x15')](_0xb753('0x16'),_0x783138,_0x51faf1[_0xb753('0x15')]['message']);return _0x534e2b(_0x51faf1[_0xb753('0x15')][_0xb753('0x17')]);}logger[_0xb753('0x15')](_0xb753('0x16'),_0x783138,_0x51faf1['error'][_0xb753('0x17')]);return _0x3caca2(_0x51faf1[_0xb753('0x15')]['message']);}else{logger[_0xb753('0x11')](_0xb753('0x16'),_0x783138,_0xb753('0x18'));_0x3caca2(_0x51faf1[_0xb753('0x19')][_0xb753('0x17')]);}})[_0xb753('0x1a')](function(_0x45e70c){logger[_0xb753('0x15')](_0xb753('0x16'),_0x783138,_0x45e70c);_0x534e2b(_0x45e70c);});});}exports[_0xb753('0x1b')]=function(_0x32af93){var _0x17eb3b=this;return new Promise(function(_0x4b9fff,_0x28d102){return db[_0xb753('0x1c')][_0xb753('0x1d')]({'raw':_0x32af93[_0xb753('0x1e')]?_0x32af93['options'][_0xb753('0x1f')]===undefined?!![]:![]:!![],'where':_0x32af93['options']?_0x32af93[_0xb753('0x1e')][_0xb753('0x20')]||null:null,'attributes':_0x32af93['options']?_0x32af93['options']['attributes']||null:null,'limit':_0x32af93[_0xb753('0x1e')]?_0x32af93[_0xb753('0x1e')][_0xb753('0x21')]||null:null,'include':_0x32af93[_0xb753('0x1e')]?_0x32af93['options'][_0xb753('0x22')]?_['map'](_0x32af93[_0xb753('0x1e')]['include'],function(_0x1a0798){return{'model':db[_0x1a0798[_0xb753('0x23')]],'as':_0x1a0798['as'],'attributes':_0x1a0798[_0xb753('0x24')],'include':_0x1a0798['include']?_[_0xb753('0x25')](_0x1a0798['include'],function(_0x3ac120){return{'model':db[_0x3ac120[_0xb753('0x23')]],'as':_0x3ac120['as'],'attributes':_0x3ac120[_0xb753('0x24')],'include':_0x3ac120[_0xb753('0x22')]?_[_0xb753('0x25')](_0x3ac120[_0xb753('0x22')],function(_0x220a91){return{'model':db[_0x220a91[_0xb753('0x23')]],'as':_0x220a91['as'],'attributes':_0x220a91[_0xb753('0x24')]};}):[]};}):[]};}):[]:[]})[_0xb753('0x10')](function(_0x2ab53d){logger['info'](_0xb753('0x1b'),_0x32af93);logger[_0xb753('0x12')]('GetSmsQueue',_0x32af93,JSON[_0xb753('0x14')](_0x2ab53d));_0x4b9fff(_0x2ab53d);})[_0xb753('0x1a')](function(_0x3dd425){logger['error'](_0xb753('0x1b'),_0x3dd425[_0xb753('0x17')],_0x32af93);_0x28d102(_0x17eb3b[_0xb753('0x15')](0x1f4,_0x3dd425[_0xb753('0x17')]));});});};exports[_0xb753('0x26')]=function(_0x5dd6a6){var _0x16bdcd=this;return new Promise(function(_0x26222b,_0x11d9a5){return db[_0xb753('0x1c')][_0xb753('0x27')]({'raw':_0x5dd6a6[_0xb753('0x1e')]?_0x5dd6a6['options']['raw']===undefined?!![]:![]:!![],'where':_0x5dd6a6[_0xb753('0x1e')]?_0x5dd6a6[_0xb753('0x1e')][_0xb753('0x20')]||null:null,'attributes':_0x5dd6a6[_0xb753('0x1e')]?_0x5dd6a6[_0xb753('0x1e')][_0xb753('0x24')]||null:null,'include':_0x5dd6a6[_0xb753('0x1e')]?_0x5dd6a6['options'][_0xb753('0x22')]?_[_0xb753('0x25')](_0x5dd6a6[_0xb753('0x1e')][_0xb753('0x22')],function(_0x524e07){return{'model':db[_0x524e07['model']],'as':_0x524e07['as'],'attributes':_0x524e07[_0xb753('0x24')],'include':_0x524e07[_0xb753('0x22')]?_[_0xb753('0x25')](_0x524e07[_0xb753('0x22')],function(_0x17f434){return{'model':db[_0x17f434[_0xb753('0x23')]],'as':_0x17f434['as'],'attributes':_0x17f434['attributes'],'include':_0x17f434[_0xb753('0x22')]?_[_0xb753('0x25')](_0x17f434['include'],function(_0x52ee11){return{'model':db[_0x52ee11[_0xb753('0x23')]],'as':_0x52ee11['as'],'attributes':_0x52ee11[_0xb753('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27c638){logger[_0xb753('0x11')]('ShowSmsQueue',_0x5dd6a6);logger['debug'](_0xb753('0x26'),_0x5dd6a6,JSON[_0xb753('0x14')](_0x27c638));_0x26222b(_0x27c638);})[_0xb753('0x1a')](function(_0x4d2930){logger[_0xb753('0x15')]('ShowSmsQueue',_0x4d2930[_0xb753('0x17')],_0x5dd6a6);_0x11d9a5(_0x16bdcd[_0xb753('0x15')](0x1f4,_0x4d2930[_0xb753('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 825bd5d..30d4d66 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 _0xa3b0=['update','emit','removeListener','register','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x478c55,_0x4d8760){var _0x161eb2=function(_0x402d4e){while(--_0x402d4e){_0x478c55['push'](_0x478c55['shift']());}};_0x161eb2(++_0x4d8760);}(_0xa3b0,0x96));var _0x0a3b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa3b0[_0x3dd15e];return _0x231fd0;};'use strict';var SmsQueueEvents=require(_0x0a3b('0x0'));var events=[_0x0a3b('0x1'),_0x0a3b('0x2'),_0x0a3b('0x3')];function createListener(_0xbb40ae,_0x3b62f5){return function(_0x2ba61a){_0x3b62f5[_0x0a3b('0x4')](_0xbb40ae,_0x2ba61a);};}function removeListener(_0x871dd8,_0x116168){return function(){SmsQueueEvents[_0x0a3b('0x5')](_0x871dd8,_0x116168);};}exports[_0x0a3b('0x6')]=function(_0x185217){for(var _0x20739b=0x0,_0x31c8ca=events[_0x0a3b('0x7')];_0x20739b<_0x31c8ca;_0x20739b++){var _0x5adbb2=events[_0x20739b];var _0x5b08a8=createListener(_0x0a3b('0x8')+_0x5adbb2,_0x185217);SmsQueueEvents['on'](_0x5adbb2,_0x5b08a8);}}; \ No newline at end of file +var _0x8583=['save','remove','update','emit','register','length','./smsQueue.events'];(function(_0x3424f5,_0x58ab1c){var _0x363149=function(_0x5db299){while(--_0x5db299){_0x3424f5['push'](_0x3424f5['shift']());}};_0x363149(++_0x58ab1c);}(_0x8583,0x1b8));var _0x3858=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8583[_0x20a584];return _0x4b41a8;};'use strict';var SmsQueueEvents=require(_0x3858('0x0'));var events=[_0x3858('0x1'),_0x3858('0x2'),_0x3858('0x3')];function createListener(_0x3118fe,_0x51662c){return function(_0x5a9345){_0x51662c[_0x3858('0x4')](_0x3118fe,_0x5a9345);};}function removeListener(_0x43276c,_0x40a379){return function(){SmsQueueEvents['removeListener'](_0x43276c,_0x40a379);};}exports[_0x3858('0x5')]=function(_0x26b118){for(var _0x2fb440=0x0,_0x42746e=events[_0x3858('0x6')];_0x2fb440<_0x42746e;_0x2fb440++){var _0xe90dda=events[_0x2fb440];var _0xe09da7=createListener('smsQueue:'+_0xe90dda,_0x26b118);SmsQueueEvents['on'](_0xe90dda,_0xe09da7);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 9a2199b..5a30647 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 _0x6753=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0xc7ea5b,_0x5c7070){var _0x2328f2=function(_0x45aed4){while(--_0x45aed4){_0xc7ea5b['push'](_0xc7ea5b['shift']());}};_0x2328f2(++_0x5c7070);}(_0x6753,0xa1));var _0x3675=function(_0x4942f7,_0x501153){_0x4942f7=_0x4942f7-0x0;var _0x208d96=_0x6753[_0x4942f7];return _0x208d96;};'use strict';var multer=require(_0x3675('0x0'));var util=require(_0x3675('0x1'));var path=require(_0x3675('0x2'));var timeout=require(_0x3675('0x3'));var express=require('express');var router=express[_0x3675('0x4')]();var fs_extra=require(_0x3675('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3675('0x6'));var config=require(_0x3675('0x7'));var controller=require('./smsQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x3675('0x8')]);router[_0x3675('0x9')](_0x3675('0xa'),auth[_0x3675('0xb')](),controller[_0x3675('0xc')]);router[_0x3675('0x9')](_0x3675('0xd'),auth[_0x3675('0xb')](),controller[_0x3675('0xe')]);router[_0x3675('0xf')]('/',auth[_0x3675('0xb')](),controller[_0x3675('0x10')]);router[_0x3675('0x11')](_0x3675('0xd'),auth['isAuthenticated'](),controller[_0x3675('0x12')]);router[_0x3675('0x13')]('/:id',auth[_0x3675('0xb')](),controller[_0x3675('0x14')]);module[_0x3675('0x15')]=router; \ No newline at end of file +var _0x36ba=['get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','exports','path','express','Router','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36ba,0x1aa));var _0xa36b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x36ba[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa36b('0x0'));var timeout=require('connect-timeout');var express=require(_0xa36b('0x1'));var router=express[_0xa36b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa36b('0x3'));var interaction=require(_0xa36b('0x4'));var config=require('../../config/environment');var controller=require(_0xa36b('0x5'));router[_0xa36b('0x6')]('/',auth[_0xa36b('0x7')](),controller['index']);router['get'](_0xa36b('0x8'),auth[_0xa36b('0x7')](),controller[_0xa36b('0x9')]);router[_0xa36b('0x6')](_0xa36b('0xa'),auth['isAuthenticated'](),controller[_0xa36b('0xb')]);router[_0xa36b('0xc')]('/',auth[_0xa36b('0x7')](),controller[_0xa36b('0xd')]);router[_0xa36b('0xe')](_0xa36b('0xa'),auth['isAuthenticated'](),controller[_0xa36b('0xf')]);router[_0xa36b('0x10')]('/:id',auth[_0xa36b('0x7')](),controller['destroy']);module[_0xa36b('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 024f0e2..3c982fe 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 _0x4556=['exports','STRING','DATE','moment'];(function(_0x30fdf9,_0x89096d){var _0x3c43bb=function(_0x40a755){while(--_0x40a755){_0x30fdf9['push'](_0x30fdf9['shift']());}};_0x3c43bb(++_0x89096d);}(_0x4556,0x8f));var _0x6455=function(_0x115c30,_0x56b56d){_0x115c30=_0x115c30-0x0;var _0x4dacef=_0x4556[_0x115c30];return _0x4dacef;};'use strict';var moment=require(_0x6455('0x0'));var Sequelize=require('sequelize');module[_0x6455('0x1')]={'uniqueid':{'type':Sequelize[_0x6455('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6455('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6455('0x3')]},'reason':{'type':Sequelize[_0x6455('0x2')]}}; \ No newline at end of file +var _0x7b80=['STRING','DATE','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7b80,0x98));var _0x07b8=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7b80[_0x2641f9];return _0x585741;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x07b8('0x0')]={'uniqueid':{'type':Sequelize[_0x07b8('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x07b8('0x1')]},'joinAt':{'type':Sequelize[_0x07b8('0x2')]},'leaveAt':{'type':Sequelize[_0x07b8('0x2')]},'acceptAt':{'type':Sequelize[_0x07b8('0x2')]},'exitAt':{'type':Sequelize[_0x07b8('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index d90c17f..29a01e7 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 _0x36e5=['options','includeAll','include','findAll','catch','show','params','length','find','SmsQueueReport','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x36e5,0x1e1));var _0x536e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x36e5[_0x38a7ac];return _0x53061a;};'use strict';var emlformat=require(_0x536e('0x0'));var rimraf=require(_0x536e('0x1'));var zipdir=require(_0x536e('0x2'));var jsonpatch=require(_0x536e('0x3'));var rp=require(_0x536e('0x4'));var moment=require(_0x536e('0x5'));var BPromise=require(_0x536e('0x6'));var Mustache=require(_0x536e('0x7'));var util=require(_0x536e('0x8'));var path=require('path');var sox=require(_0x536e('0x9'));var csv=require(_0x536e('0xa'));var ejs=require(_0x536e('0xb'));var fs=require('fs');var fs_extra=require(_0x536e('0xc'));var _=require(_0x536e('0xd'));var squel=require(_0x536e('0xe'));var crypto=require(_0x536e('0xf'));var jsforce=require(_0x536e('0x10'));var deskjs=require(_0x536e('0x11'));var toCsv=require('to-csv');var querystring=require(_0x536e('0x12'));var Papa=require(_0x536e('0x13'));var Redis=require(_0x536e('0x14'));var authService=require(_0x536e('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x536e('0x16'));var hardwareService=require(_0x536e('0x17'));var logger=require(_0x536e('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x536e('0x19'));var db=require(_0x536e('0x1a'))['db'];function respondWithStatusCode(_0x495b26,_0x1f8041){_0x1f8041=_0x1f8041||0xcc;return function(_0x1e9def){if(_0x1e9def){return _0x495b26[_0x536e('0x1b')](_0x1f8041);}return _0x495b26[_0x536e('0x1c')](_0x1f8041)[_0x536e('0x1d')]();};}function respondWithResult(_0x2d4bca,_0x1e3126){_0x1e3126=_0x1e3126||0xc8;return function(_0x3f2343){if(_0x3f2343){return _0x2d4bca[_0x536e('0x1c')](_0x1e3126)[_0x536e('0x1e')](_0x3f2343);}};}function respondWithFilteredResult(_0x187032,_0x47fe56){return function(_0x559361){if(_0x559361){var _0x5c946a=typeof _0x47fe56[_0x536e('0x1f')]===_0x536e('0x20')&&typeof _0x47fe56[_0x536e('0x21')]===_0x536e('0x20');var _0x295334=_0x559361[_0x536e('0x22')];var _0x383217=_0x5c946a?0x0:_0x47fe56[_0x536e('0x1f')];var _0x4bda16=_0x5c946a?_0x559361['count']:_0x47fe56[_0x536e('0x1f')]+_0x47fe56[_0x536e('0x21')];var _0x287eda;if(_0x4bda16>=_0x295334){_0x4bda16=_0x295334;_0x287eda=0xc8;}else{_0x287eda=0xce;}_0x187032[_0x536e('0x1c')](_0x287eda);return _0x187032[_0x536e('0x23')]('Content-Range',_0x383217+'-'+_0x4bda16+'/'+_0x295334)[_0x536e('0x1e')](_0x559361);}return null;};}function patchUpdates(_0x10583a){return function(_0x108681){try{jsonpatch[_0x536e('0x24')](_0x108681,_0x10583a,!![]);}catch(_0x2dc4d4){return BPromise['reject'](_0x2dc4d4);}return _0x108681[_0x536e('0x25')]();};}function saveUpdates(_0x4ad6d9,_0x193e00){return function(_0x3af18d){if(_0x3af18d){return _0x3af18d[_0x536e('0x26')](_0x4ad6d9)[_0x536e('0x27')](function(_0x42a033){return _0x42a033;});}return null;};}function removeEntity(_0x174ee8,_0x14245e){return function(_0x5a9c4e){if(_0x5a9c4e){return _0x5a9c4e[_0x536e('0x28')]()['then'](function(){_0x174ee8['status'](0xcc)[_0x536e('0x1d')]();});}};}function handleEntityNotFound(_0x58e6dd,_0x47d9cd){return function(_0x42bb19){if(!_0x42bb19){_0x58e6dd['sendStatus'](0x194);}return _0x42bb19;};}function handleError(_0x4b5e0d,_0x15b13b){_0x15b13b=_0x15b13b||0x1f4;return function(_0x32b1a0){logger['error'](_0x32b1a0[_0x536e('0x29')]);if(_0x32b1a0[_0x536e('0x2a')]){delete _0x32b1a0[_0x536e('0x2a')];}_0x4b5e0d[_0x536e('0x1c')](_0x15b13b)[_0x536e('0x2b')](_0x32b1a0);};}exports['index']=function(_0x306cb1,_0x557b1b){var _0x33c670={},_0x5b280b={},_0x38aded={'count':0x0,'rows':[]};var _0x46305c=_[_0x536e('0x2c')](db['SmsQueueReport'][_0x536e('0x2d')],function(_0x27f616){return{'name':_0x27f616[_0x536e('0x2e')],'type':_0x27f616[_0x536e('0x2f')][_0x536e('0x30')]};});_0x5b280b['model']=_[_0x536e('0x2c')](_0x46305c,_0x536e('0x2a'));_0x5b280b[_0x536e('0x31')]=_[_0x536e('0x32')](_0x306cb1[_0x536e('0x31')]);_0x5b280b['filters']=_[_0x536e('0x33')](_0x5b280b[_0x536e('0x34')],_0x5b280b['query']);_0x33c670['attributes']=_[_0x536e('0x33')](_0x5b280b[_0x536e('0x34')],qs[_0x536e('0x35')](_0x306cb1[_0x536e('0x31')]['fields']));_0x33c670[_0x536e('0x36')]=_0x33c670[_0x536e('0x36')]['length']?_0x33c670[_0x536e('0x36')]:_0x5b280b[_0x536e('0x34')];if(!_0x306cb1[_0x536e('0x31')][_0x536e('0x37')](_0x536e('0x38'))){_0x33c670[_0x536e('0x21')]=qs[_0x536e('0x21')](_0x306cb1[_0x536e('0x31')]['limit']);_0x33c670[_0x536e('0x1f')]=qs[_0x536e('0x1f')](_0x306cb1['query'][_0x536e('0x1f')]);}_0x33c670[_0x536e('0x39')]=qs[_0x536e('0x3a')](_0x306cb1['query']['sort']);_0x33c670[_0x536e('0x3b')]=qs[_0x536e('0x3c')](_[_0x536e('0x3d')](_0x306cb1[_0x536e('0x31')],_0x5b280b[_0x536e('0x3c')]),_0x46305c);if(_0x306cb1['query'][_0x536e('0x3e')]){_0x33c670[_0x536e('0x3b')]=_[_0x536e('0x3f')](_0x33c670[_0x536e('0x3b')],{'$or':_[_0x536e('0x2c')](_0x46305c,function(_0x34bdca){if(_0x34bdca[_0x536e('0x2f')]!==_0x536e('0x40')){var _0x1f02e5={};_0x1f02e5[_0x34bdca[_0x536e('0x2a')]]={'$like':'%'+_0x306cb1['query']['filter']+'%'};return _0x1f02e5;}})});}_0x33c670=_[_0x536e('0x3f')]({},_0x33c670,_0x306cb1[_0x536e('0x41')]);var _0xeace3d={'where':_0x33c670[_0x536e('0x3b')]};return db['SmsQueueReport'][_0x536e('0x22')](_0xeace3d)[_0x536e('0x27')](function(_0x547d72){_0x38aded['count']=_0x547d72;if(_0x306cb1[_0x536e('0x31')][_0x536e('0x42')]){_0x33c670[_0x536e('0x43')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x536e('0x44')](_0x33c670);})[_0x536e('0x27')](function(_0x465aef){_0x38aded['rows']=_0x465aef;return _0x38aded;})['then'](respondWithFilteredResult(_0x557b1b,_0x33c670))[_0x536e('0x45')](handleError(_0x557b1b,null));};exports[_0x536e('0x46')]=function(_0x3474f9,_0x599970){var _0x5c057e={'raw':!![],'where':{'id':_0x3474f9[_0x536e('0x47')]['id']}},_0x5b88d4={};_0x5b88d4[_0x536e('0x34')]=_['keys'](db['SmsQueueReport']['rawAttributes']);_0x5b88d4['query']=_[_0x536e('0x32')](_0x3474f9[_0x536e('0x31')]);_0x5b88d4['filters']=_[_0x536e('0x33')](_0x5b88d4[_0x536e('0x34')],_0x5b88d4[_0x536e('0x31')]);_0x5c057e[_0x536e('0x36')]=_[_0x536e('0x33')](_0x5b88d4['model'],qs[_0x536e('0x35')](_0x3474f9['query'][_0x536e('0x35')]));_0x5c057e[_0x536e('0x36')]=_0x5c057e[_0x536e('0x36')][_0x536e('0x48')]?_0x5c057e[_0x536e('0x36')]:_0x5b88d4[_0x536e('0x34')];if(_0x3474f9[_0x536e('0x31')][_0x536e('0x42')]){_0x5c057e[_0x536e('0x43')]=[{'all':!![]}];}_0x5c057e=_[_0x536e('0x3f')]({},_0x5c057e,_0x3474f9[_0x536e('0x41')]);return db['SmsQueueReport'][_0x536e('0x49')](_0x5c057e)[_0x536e('0x27')](handleEntityNotFound(_0x599970,null))[_0x536e('0x27')](respondWithResult(_0x599970,null))['catch'](handleError(_0x599970,null));};exports['create']=function(_0x258b2b,_0xba625d){return db[_0x536e('0x4a')][_0x536e('0x4b')](_0x258b2b[_0x536e('0x4c')],{})[_0x536e('0x27')](respondWithResult(_0xba625d,0xc9))[_0x536e('0x45')](handleError(_0xba625d,null));};exports['update']=function(_0x334af3,_0x26e16b){if(_0x334af3['body']['id']){delete _0x334af3[_0x536e('0x4c')]['id'];}return db[_0x536e('0x4a')]['find']({'where':{'id':_0x334af3[_0x536e('0x47')]['id']}})[_0x536e('0x27')](handleEntityNotFound(_0x26e16b,null))['then'](saveUpdates(_0x334af3[_0x536e('0x4c')],null))['then'](respondWithResult(_0x26e16b,null))[_0x536e('0x45')](handleError(_0x26e16b,null));};exports[_0x536e('0x28')]=function(_0x4e1545,_0x3b1213){return db[_0x536e('0x4a')][_0x536e('0x49')]({'where':{'id':_0x4e1545['params']['id']}})[_0x536e('0x27')](handleEntityNotFound(_0x3b1213,null))[_0x536e('0x27')](removeEntity(_0x3b1213,null))['catch'](handleError(_0x3b1213,null));};exports[_0x536e('0x4d')]=function(_0x25263e,_0x11d1e4){return db[_0x536e('0x4a')]['describe']()[_0x536e('0x27')](respondWithResult(_0x11d1e4,null))[_0x536e('0x45')](handleError(_0x11d1e4,null));}; \ No newline at end of file +var _0x2709=['sort','where','pick','merge','type','VIRTUAL','filter','options','SmsQueueReport','findAll','rows','catch','includeAll','include','create','body','params','find','describe','eml-format','rimraf','zip-dir','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x2caf73,_0x39f399){var _0x4ee1aa=function(_0x1e2618){while(--_0x1e2618){_0x2caf73['push'](_0x2caf73['shift']());}};_0x4ee1aa(++_0x39f399);}(_0x2709,0xb1));var _0x9270=function(_0x3d9c2d,_0x2d7133){_0x3d9c2d=_0x3d9c2d-0x0;var _0x5a5176=_0x2709[_0x3d9c2d];return _0x5a5176;};'use strict';var emlformat=require(_0x9270('0x0'));var rimraf=require(_0x9270('0x1'));var zipdir=require(_0x9270('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9270('0x3'));var util=require('util');var path=require(_0x9270('0x4'));var sox=require(_0x9270('0x5'));var csv=require('to-csv');var ejs=require(_0x9270('0x6'));var fs=require('fs');var fs_extra=require(_0x9270('0x7'));var _=require(_0x9270('0x8'));var squel=require(_0x9270('0x9'));var crypto=require(_0x9270('0xa'));var jsforce=require(_0x9270('0xb'));var deskjs=require(_0x9270('0xc'));var toCsv=require(_0x9270('0xd'));var querystring=require(_0x9270('0xe'));var Papa=require(_0x9270('0xf'));var Redis=require(_0x9270('0x10'));var authService=require(_0x9270('0x11'));var qs=require(_0x9270('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9270('0x13'));var logger=require(_0x9270('0x14'))(_0x9270('0x15'));var utils=require(_0x9270('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9270('0x17'));var db=require(_0x9270('0x18'))['db'];function respondWithStatusCode(_0x1c6920,_0x277b02){_0x277b02=_0x277b02||0xcc;return function(_0x33e400){if(_0x33e400){return _0x1c6920['sendStatus'](_0x277b02);}return _0x1c6920[_0x9270('0x19')](_0x277b02)[_0x9270('0x1a')]();};}function respondWithResult(_0x5d7cb6,_0x8ac1e5){_0x8ac1e5=_0x8ac1e5||0xc8;return function(_0x4487be){if(_0x4487be){return _0x5d7cb6[_0x9270('0x19')](_0x8ac1e5)[_0x9270('0x1b')](_0x4487be);}};}function respondWithFilteredResult(_0xb8ec12,_0x5cd088){return function(_0x52fd37){if(_0x52fd37){var _0x3ffa6b=typeof _0x5cd088[_0x9270('0x1c')]==='undefined'&&typeof _0x5cd088['limit']===_0x9270('0x1d');var _0x4807de=_0x52fd37[_0x9270('0x1e')];var _0x2f55ab=_0x3ffa6b?0x0:_0x5cd088[_0x9270('0x1c')];var _0x259cdf=_0x3ffa6b?_0x52fd37[_0x9270('0x1e')]:_0x5cd088['offset']+_0x5cd088['limit'];var _0x399537;if(_0x259cdf>=_0x4807de){_0x259cdf=_0x4807de;_0x399537=0xc8;}else{_0x399537=0xce;}_0xb8ec12[_0x9270('0x19')](_0x399537);return _0xb8ec12['set'](_0x9270('0x1f'),_0x2f55ab+'-'+_0x259cdf+'/'+_0x4807de)[_0x9270('0x1b')](_0x52fd37);}return null;};}function patchUpdates(_0x43345c){return function(_0x1c2334){try{jsonpatch[_0x9270('0x20')](_0x1c2334,_0x43345c,!![]);}catch(_0x9dbc1){return BPromise[_0x9270('0x21')](_0x9dbc1);}return _0x1c2334[_0x9270('0x22')]();};}function saveUpdates(_0x36e025,_0x595e04){return function(_0x401a0f){if(_0x401a0f){return _0x401a0f[_0x9270('0x23')](_0x36e025)[_0x9270('0x24')](function(_0x16e951){return _0x16e951;});}return null;};}function removeEntity(_0x521e33,_0x21e093){return function(_0x32c876){if(_0x32c876){return _0x32c876[_0x9270('0x25')]()[_0x9270('0x24')](function(){_0x521e33['status'](0xcc)[_0x9270('0x1a')]();});}};}function handleEntityNotFound(_0x57cc94,_0x586743){return function(_0x519603){if(!_0x519603){_0x57cc94[_0x9270('0x26')](0x194);}return _0x519603;};}function handleError(_0x1065ce,_0x3996f6){_0x3996f6=_0x3996f6||0x1f4;return function(_0x188bfb){logger[_0x9270('0x27')](_0x188bfb[_0x9270('0x28')]);if(_0x188bfb[_0x9270('0x29')]){delete _0x188bfb['name'];}_0x1065ce['status'](_0x3996f6)[_0x9270('0x2a')](_0x188bfb);};}exports[_0x9270('0x2b')]=function(_0x181e87,_0x55263e){var _0x478299={},_0x4ec34c={},_0x3f93f0={'count':0x0,'rows':[]};var _0x309834=_[_0x9270('0x2c')](db['SmsQueueReport'][_0x9270('0x2d')],function(_0x23a620){return{'name':_0x23a620[_0x9270('0x2e')],'type':_0x23a620['type'][_0x9270('0x2f')]};});_0x4ec34c[_0x9270('0x30')]=_[_0x9270('0x2c')](_0x309834,'name');_0x4ec34c['query']=_[_0x9270('0x31')](_0x181e87[_0x9270('0x32')]);_0x4ec34c[_0x9270('0x33')]=_[_0x9270('0x34')](_0x4ec34c[_0x9270('0x30')],_0x4ec34c['query']);_0x478299[_0x9270('0x35')]=_[_0x9270('0x34')](_0x4ec34c['model'],qs['fields'](_0x181e87[_0x9270('0x32')][_0x9270('0x36')]));_0x478299[_0x9270('0x35')]=_0x478299[_0x9270('0x35')][_0x9270('0x37')]?_0x478299[_0x9270('0x35')]:_0x4ec34c[_0x9270('0x30')];if(!_0x181e87[_0x9270('0x32')][_0x9270('0x38')](_0x9270('0x39'))){_0x478299[_0x9270('0x3a')]=qs[_0x9270('0x3a')](_0x181e87['query'][_0x9270('0x3a')]);_0x478299['offset']=qs['offset'](_0x181e87[_0x9270('0x32')]['offset']);}_0x478299[_0x9270('0x3b')]=qs[_0x9270('0x3c')](_0x181e87[_0x9270('0x32')][_0x9270('0x3c')]);_0x478299[_0x9270('0x3d')]=qs[_0x9270('0x33')](_[_0x9270('0x3e')](_0x181e87[_0x9270('0x32')],_0x4ec34c[_0x9270('0x33')]),_0x309834);if(_0x181e87['query']['filter']){_0x478299[_0x9270('0x3d')]=_[_0x9270('0x3f')](_0x478299[_0x9270('0x3d')],{'$or':_['map'](_0x309834,function(_0x21743b){if(_0x21743b[_0x9270('0x40')]!==_0x9270('0x41')){var _0x41b874={};_0x41b874[_0x21743b[_0x9270('0x29')]]={'$like':'%'+_0x181e87[_0x9270('0x32')][_0x9270('0x42')]+'%'};return _0x41b874;}})});}_0x478299=_['merge']({},_0x478299,_0x181e87[_0x9270('0x43')]);var _0x151e66={'where':_0x478299[_0x9270('0x3d')]};return db[_0x9270('0x44')][_0x9270('0x1e')](_0x151e66)[_0x9270('0x24')](function(_0x3cb00c){_0x3f93f0[_0x9270('0x1e')]=_0x3cb00c;if(_0x181e87[_0x9270('0x32')]['includeAll']){_0x478299['include']=[{'all':!![]}];}return db[_0x9270('0x44')][_0x9270('0x45')](_0x478299);})[_0x9270('0x24')](function(_0x2be34b){_0x3f93f0[_0x9270('0x46')]=_0x2be34b;return _0x3f93f0;})['then'](respondWithFilteredResult(_0x55263e,_0x478299))[_0x9270('0x47')](handleError(_0x55263e,null));};exports['show']=function(_0x3a0225,_0x31e59e){var _0x27d024={'raw':!![],'where':{'id':_0x3a0225['params']['id']}},_0x40995f={};_0x40995f[_0x9270('0x30')]=_[_0x9270('0x31')](db[_0x9270('0x44')][_0x9270('0x2d')]);_0x40995f['query']=_[_0x9270('0x31')](_0x3a0225[_0x9270('0x32')]);_0x40995f[_0x9270('0x33')]=_[_0x9270('0x34')](_0x40995f[_0x9270('0x30')],_0x40995f[_0x9270('0x32')]);_0x27d024[_0x9270('0x35')]=_['intersection'](_0x40995f[_0x9270('0x30')],qs[_0x9270('0x36')](_0x3a0225['query'][_0x9270('0x36')]));_0x27d024['attributes']=_0x27d024[_0x9270('0x35')][_0x9270('0x37')]?_0x27d024[_0x9270('0x35')]:_0x40995f[_0x9270('0x30')];if(_0x3a0225[_0x9270('0x32')][_0x9270('0x48')]){_0x27d024[_0x9270('0x49')]=[{'all':!![]}];}_0x27d024=_[_0x9270('0x3f')]({},_0x27d024,_0x3a0225[_0x9270('0x43')]);return db[_0x9270('0x44')]['find'](_0x27d024)[_0x9270('0x24')](handleEntityNotFound(_0x31e59e,null))[_0x9270('0x24')](respondWithResult(_0x31e59e,null))[_0x9270('0x47')](handleError(_0x31e59e,null));};exports['create']=function(_0x5d4126,_0x212532){return db[_0x9270('0x44')][_0x9270('0x4a')](_0x5d4126[_0x9270('0x4b')],{})[_0x9270('0x24')](respondWithResult(_0x212532,0xc9))[_0x9270('0x47')](handleError(_0x212532,null));};exports[_0x9270('0x23')]=function(_0x545cee,_0x184c02){if(_0x545cee[_0x9270('0x4b')]['id']){delete _0x545cee[_0x9270('0x4b')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x545cee[_0x9270('0x4c')]['id']}})[_0x9270('0x24')](handleEntityNotFound(_0x184c02,null))[_0x9270('0x24')](saveUpdates(_0x545cee[_0x9270('0x4b')],null))[_0x9270('0x24')](respondWithResult(_0x184c02,null))['catch'](handleError(_0x184c02,null));};exports[_0x9270('0x25')]=function(_0x411ba5,_0x112885){return db['SmsQueueReport'][_0x9270('0x4d')]({'where':{'id':_0x411ba5['params']['id']}})[_0x9270('0x24')](handleEntityNotFound(_0x112885,null))['then'](removeEntity(_0x112885,null))[_0x9270('0x47')](handleError(_0x112885,null));};exports['describe']=function(_0xa13bf5,_0x355928){return db[_0x9270('0x44')][_0x9270('0x4e')]()[_0x9270('0x24')](respondWithResult(_0x355928,null))['catch'](handleError(_0x355928,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 486b05b..ded6ec7 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 _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'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':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x182587,_0x3d017d){var _0x110b4a=function(_0x232f1d){while(--_0x232f1d){_0x182587['push'](_0x182587['shift']());}};_0x110b4a(++_0x3d017d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x232ec0,_0x45fdd0){_0x232ec0=_0x232ec0-0x0;var _0x356705=_0xcb91[_0x232ec0];return _0x356705;};'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')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'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 db8fb0a..ff2e8d2 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 _0x1185=['UpdateSmsQueueReport','update','attributes','limit','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','info','result','CreateSmsQueueReport','create','body','options','then','debug','catch'];(function(_0x4dbe5f,_0x209297){var _0x31ca72=function(_0x442dda){while(--_0x442dda){_0x4dbe5f['push'](_0x4dbe5f['shift']());}};_0x31ca72(++_0x209297);}(_0x1185,0x130));var _0x5118=function(_0x40febe,_0x1e6b1a){_0x40febe=_0x40febe-0x0;var _0x112ef2=_0x1185[_0x40febe];return _0x112ef2;};'use strict';var _=require('lodash');var util=require(_0x5118('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5118('0x1'));var db=require(_0x5118('0x2'))['db'];var utils=require(_0x5118('0x3'));var logger=require(_0x5118('0x4'))(_0x5118('0x5'));var config=require(_0x5118('0x6'));var jayson=require(_0x5118('0x7'));var client=jayson[_0x5118('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x244d81,_0x1f4fa8,_0x2b1ca2){return new BPromise(function(_0x2c65af,_0x15e120){return client[_0x5118('0x9')](_0x244d81,_0x2b1ca2)['then'](function(_0x10b992){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0x1f4fa8,_0x5118('0xa'));logger['debug'](_0x5118('0xb'),_0x1f4fa8,'request\x20sent',JSON[_0x5118('0xc')](_0x10b992));if(_0x10b992[_0x5118('0xd')]){if(_0x10b992[_0x5118('0xd')][_0x5118('0xe')]===0x1f4){logger[_0x5118('0xd')](_0x5118('0xf'),_0x1f4fa8,_0x10b992[_0x5118('0xd')]['message']);return _0x15e120(_0x10b992[_0x5118('0xd')]['message']);}logger[_0x5118('0xd')](_0x5118('0xf'),_0x1f4fa8,_0x10b992[_0x5118('0xd')][_0x5118('0x10')]);return _0x2c65af(_0x10b992[_0x5118('0xd')][_0x5118('0x10')]);}else{logger[_0x5118('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x1f4fa8,_0x5118('0xa'));_0x2c65af(_0x10b992[_0x5118('0x12')][_0x5118('0x10')]);}})['catch'](function(_0x477d84){logger[_0x5118('0xd')](_0x5118('0xf'),_0x1f4fa8,_0x477d84);_0x15e120(_0x477d84);});});}exports[_0x5118('0x13')]=function(_0x761b03){var _0x356618=this;return new Promise(function(_0x1461c0,_0x59b0d9){return db['SmsQueueReport'][_0x5118('0x14')](_0x761b03[_0x5118('0x15')],{'raw':_0x761b03[_0x5118('0x16')]?_0x761b03[_0x5118('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x5118('0x17')](function(_0x345858){logger['info'](_0x5118('0x13'),_0x761b03);logger[_0x5118('0x18')](_0x5118('0x13'),_0x761b03,JSON[_0x5118('0xc')](_0x345858));_0x1461c0(_0x345858);})[_0x5118('0x19')](function(_0x4f1782){logger[_0x5118('0xd')]('CreateSmsQueueReport',_0x4f1782[_0x5118('0x10')],_0x761b03);_0x59b0d9(_0x356618['error'](0x1f4,_0x4f1782[_0x5118('0x10')]));});});};exports[_0x5118('0x1a')]=function(_0x2c6cbf){var _0x58f90a=this;return new Promise(function(_0x4b80e,_0x5379ba){return db['SmsQueueReport'][_0x5118('0x1b')](_0x2c6cbf[_0x5118('0x15')],{'raw':_0x2c6cbf[_0x5118('0x16')]?_0x2c6cbf[_0x5118('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c6cbf[_0x5118('0x16')]?_0x2c6cbf[_0x5118('0x16')]['where']||null:null,'attributes':_0x2c6cbf[_0x5118('0x16')]?_0x2c6cbf[_0x5118('0x16')][_0x5118('0x1c')]||null:null,'limit':_0x2c6cbf['options']?_0x2c6cbf[_0x5118('0x16')][_0x5118('0x1d')]||null:null})[_0x5118('0x17')](function(_0x59d26a){logger[_0x5118('0x11')](_0x5118('0x1a'),_0x2c6cbf);logger[_0x5118('0x18')](_0x5118('0x1a'),_0x2c6cbf,JSON[_0x5118('0xc')](_0x59d26a));_0x4b80e(_0x59d26a);})['catch'](function(_0x1ae1a4){logger[_0x5118('0xd')](_0x5118('0x1a'),_0x1ae1a4[_0x5118('0x10')],_0x2c6cbf);_0x5379ba(_0x58f90a[_0x5118('0xd')](0x1f4,_0x1ae1a4[_0x5118('0x10')]));});});}; \ No newline at end of file +var _0x82ae=['catch','SmsQueueReport','body','options','raw','CreateSmsQueueReport','UpdateSmsQueueReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x5b1364,_0x4086e2){var _0x45a2cb=function(_0x101f49){while(--_0x101f49){_0x5b1364['push'](_0x5b1364['shift']());}};_0x45a2cb(++_0x4086e2);}(_0x82ae,0x118));var _0xe82a=function(_0x1fb0d7,_0x27a9c5){_0x1fb0d7=_0x1fb0d7-0x0;var _0x12f0ab=_0x82ae[_0x1fb0d7];return _0x12f0ab;};'use strict';var _=require(_0xe82a('0x0'));var util=require(_0xe82a('0x1'));var moment=require(_0xe82a('0x2'));var BPromise=require(_0xe82a('0x3'));var rs=require(_0xe82a('0x4'));var fs=require('fs');var Redis=require(_0xe82a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe82a('0x6'));var logger=require('../../config/logger')(_0xe82a('0x7'));var config=require('../../config/environment');var jayson=require(_0xe82a('0x8'));var client=jayson[_0xe82a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2298cf,_0x3bc4e7,_0x57fa66){return new BPromise(function(_0x2052a4,_0xb8409a){return client['request'](_0x2298cf,_0x57fa66)[_0xe82a('0xa')](function(_0x1cce32){logger[_0xe82a('0xb')](_0xe82a('0xc'),_0x3bc4e7,_0xe82a('0xd'));logger[_0xe82a('0xe')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x3bc4e7,'request\x20sent',JSON[_0xe82a('0xf')](_0x1cce32));if(_0x1cce32[_0xe82a('0x10')]){if(_0x1cce32[_0xe82a('0x10')][_0xe82a('0x11')]===0x1f4){logger['error'](_0xe82a('0xc'),_0x3bc4e7,_0x1cce32[_0xe82a('0x10')]['message']);return _0xb8409a(_0x1cce32['error'][_0xe82a('0x12')]);}logger[_0xe82a('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x3bc4e7,_0x1cce32[_0xe82a('0x10')][_0xe82a('0x12')]);return _0x2052a4(_0x1cce32[_0xe82a('0x10')]['message']);}else{logger[_0xe82a('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x3bc4e7,_0xe82a('0xd'));_0x2052a4(_0x1cce32[_0xe82a('0x13')][_0xe82a('0x12')]);}})[_0xe82a('0x14')](function(_0x7e4269){logger[_0xe82a('0x10')](_0xe82a('0xc'),_0x3bc4e7,_0x7e4269);_0xb8409a(_0x7e4269);});});}exports['CreateSmsQueueReport']=function(_0x3d392e){var _0x3ae0a2=this;return new Promise(function(_0x1b9288,_0x2fa438){return db[_0xe82a('0x15')]['create'](_0x3d392e[_0xe82a('0x16')],{'raw':_0x3d392e[_0xe82a('0x17')]?_0x3d392e[_0xe82a('0x17')][_0xe82a('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x59dad0){logger[_0xe82a('0xb')](_0xe82a('0x19'),_0x3d392e);logger[_0xe82a('0xe')](_0xe82a('0x19'),_0x3d392e,JSON[_0xe82a('0xf')](_0x59dad0));_0x1b9288(_0x59dad0);})[_0xe82a('0x14')](function(_0x20f4c4){logger['error'](_0xe82a('0x19'),_0x20f4c4[_0xe82a('0x12')],_0x3d392e);_0x2fa438(_0x3ae0a2[_0xe82a('0x10')](0x1f4,_0x20f4c4[_0xe82a('0x12')]));});});};exports[_0xe82a('0x1a')]=function(_0x1e9f0f){var _0x1ff2c1=this;return new Promise(function(_0x8540bc,_0x37981f){return db['SmsQueueReport'][_0xe82a('0x1b')](_0x1e9f0f[_0xe82a('0x16')],{'raw':_0x1e9f0f[_0xe82a('0x17')]?_0x1e9f0f[_0xe82a('0x17')][_0xe82a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e9f0f[_0xe82a('0x17')]?_0x1e9f0f[_0xe82a('0x17')][_0xe82a('0x1c')]||null:null,'attributes':_0x1e9f0f[_0xe82a('0x17')]?_0x1e9f0f[_0xe82a('0x17')]['attributes']||null:null,'limit':_0x1e9f0f['options']?_0x1e9f0f[_0xe82a('0x17')][_0xe82a('0x1d')]||null:null})[_0xe82a('0xa')](function(_0x374fce){logger[_0xe82a('0xb')](_0xe82a('0x1a'),_0x1e9f0f);logger[_0xe82a('0xe')]('UpdateSmsQueueReport',_0x1e9f0f,JSON[_0xe82a('0xf')](_0x374fce));_0x8540bc(_0x374fce);})[_0xe82a('0x14')](function(_0x478964){logger[_0xe82a('0x10')](_0xe82a('0x1a'),_0x478964[_0xe82a('0x12')],_0x1e9f0f);_0x37981f(_0x1ff2c1['error'](0x1f4,_0x478964['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 77cb502..ce8e050 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 _0xbd50=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','create','delete','exports','multer','util'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xbd50,0x196));var _0x0bd5=function(_0x38825b,_0x205455){_0x38825b=_0x38825b-0x0;var _0x60dc6a=_0xbd50[_0x38825b];return _0x60dc6a;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),auth[_0x0bd5('0x8')](),controller['describe']);router['get'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router['post']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);router['put'](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['update']);router[_0x0bd5('0xf')](_0x0bd5('0xc'),auth[_0x0bd5('0x8')](),controller['destroy']);module[_0x0bd5('0x10')]=router; \ No newline at end of file +var _0x2123=['../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x32072a,_0x36d93d){var _0x50e74f=function(_0x2e40fe){while(--_0x2e40fe){_0x32072a['push'](_0x32072a['shift']());}};_0x50e74f(++_0x36d93d);}(_0x2123,0x190));var _0x3212=function(_0x2623ab,_0x52944b){_0x2623ab=_0x2623ab-0x0;var _0x4476d2=_0x2123[_0x2623ab];return _0x4476d2;};'use strict';var multer=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var path=require(_0x3212('0x2'));var timeout=require(_0x3212('0x3'));var express=require(_0x3212('0x4'));var router=express[_0x3212('0x5')]();var fs_extra=require(_0x3212('0x6'));var auth=require(_0x3212('0x7'));var interaction=require(_0x3212('0x8'));var config=require(_0x3212('0x9'));var controller=require(_0x3212('0xa'));router[_0x3212('0xb')]('/',auth['isAuthenticated'](),controller[_0x3212('0xc')]);router[_0x3212('0xb')](_0x3212('0xd'),auth['isAuthenticated'](),controller[_0x3212('0xe')]);router['get'](_0x3212('0xf'),auth[_0x3212('0x10')](),controller[_0x3212('0x11')]);router[_0x3212('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3212('0x13')](_0x3212('0xf'),auth[_0x3212('0x10')](),controller[_0x3212('0x14')]);router[_0x3212('0x15')](_0x3212('0xf'),auth[_0x3212('0x10')](),controller[_0x3212('0x16')]);module[_0x3212('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index d79e7d5..4c54002 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x5f4d59,_0x554969){var _0x4d5dea=function(_0x2f23c5){while(--_0x2f23c5){_0x5f4d59['push'](_0x5f4d59['shift']());}};_0x4d5dea(++_0x554969);}(_0x34e8,0x12c));var _0x834e=function(_0x51e57b,_0x4aa041){_0x51e57b=_0x51e57b-0x0;var _0x3c31cd=_0x34e8[_0x51e57b];return _0x3c31cd;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x3bfb0d,_0x48fc7f){var _0x5f2ede=function(_0x5813dc){while(--_0x5813dc){_0x3bfb0d['push'](_0x3bfb0d['shift']());}};_0x5f2ede(++_0x48fc7f);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x00bb[_0x4cf98e];return _0x1623ac;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 3f007a1..d5006a3 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 _0x8fcd=['order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','rows','catch','params','intersection','merge','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','then','destroy','end','error','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3be939,_0x380e72){var _0x40a889=function(_0x2b865d){while(--_0x2b865d){_0x3be939['push'](_0x3be939['shift']());}};_0x40a889(++_0x380e72);}(_0x8fcd,0xa1));var _0xd8fc=function(_0x1e3e34,_0x1e7dfe){_0x1e3e34=_0x1e3e34-0x0;var _0x167846=_0x8fcd[_0x1e3e34];return _0x167846;};'use strict';var emlformat=require(_0xd8fc('0x0'));var rimraf=require(_0xd8fc('0x1'));var zipdir=require(_0xd8fc('0x2'));var jsonpatch=require(_0xd8fc('0x3'));var rp=require(_0xd8fc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd8fc('0x5'));var util=require(_0xd8fc('0x6'));var path=require(_0xd8fc('0x7'));var sox=require(_0xd8fc('0x8'));var csv=require(_0xd8fc('0x9'));var ejs=require(_0xd8fc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd8fc('0xb'));var crypto=require('crypto');var jsforce=require(_0xd8fc('0xc'));var deskjs=require(_0xd8fc('0xd'));var toCsv=require(_0xd8fc('0x9'));var querystring=require(_0xd8fc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd8fc('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd8fc('0x10'));var logger=require(_0xd8fc('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xd8fc('0x12'));var licenseUtil=require(_0xd8fc('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c41e9,_0x955550){_0x955550=_0x955550||0xcc;return function(_0x2b9d7e){if(_0x2b9d7e){return _0x3c41e9[_0xd8fc('0x14')](_0x955550);}return _0x3c41e9[_0xd8fc('0x15')](_0x955550)['end']();};}function respondWithResult(_0x32b375,_0x4f1064){_0x4f1064=_0x4f1064||0xc8;return function(_0x4761f){if(_0x4761f){return _0x32b375[_0xd8fc('0x15')](_0x4f1064)[_0xd8fc('0x16')](_0x4761f);}};}function respondWithFilteredResult(_0x524bac,_0x426e56){return function(_0x233c7e){if(_0x233c7e){var _0x57838b=typeof _0x426e56['offset']===_0xd8fc('0x17')&&typeof _0x426e56[_0xd8fc('0x18')]===_0xd8fc('0x17');var _0x4daf69=_0x233c7e[_0xd8fc('0x19')];var _0x1c744d=_0x57838b?0x0:_0x426e56[_0xd8fc('0x1a')];var _0x1cb0d4=_0x57838b?_0x233c7e[_0xd8fc('0x19')]:_0x426e56[_0xd8fc('0x1a')]+_0x426e56[_0xd8fc('0x18')];var _0x1d7e77;if(_0x1cb0d4>=_0x4daf69){_0x1cb0d4=_0x4daf69;_0x1d7e77=0xc8;}else{_0x1d7e77=0xce;}_0x524bac[_0xd8fc('0x15')](_0x1d7e77);return _0x524bac['set'](_0xd8fc('0x1b'),_0x1c744d+'-'+_0x1cb0d4+'/'+_0x4daf69)[_0xd8fc('0x16')](_0x233c7e);}return null;};}function patchUpdates(_0x24001d){return function(_0x3f9d57){try{jsonpatch[_0xd8fc('0x1c')](_0x3f9d57,_0x24001d,!![]);}catch(_0xd24b3f){return BPromise['reject'](_0xd24b3f);}return _0x3f9d57[_0xd8fc('0x1d')]();};}function saveUpdates(_0x3f0196,_0x5cd1f9){return function(_0x37a93b){if(_0x37a93b){return _0x37a93b['update'](_0x3f0196)[_0xd8fc('0x1e')](function(_0x370a62){return _0x370a62;});}return null;};}function removeEntity(_0x59b0ef,_0x5c852a){return function(_0x47ccff){if(_0x47ccff){return _0x47ccff[_0xd8fc('0x1f')]()[_0xd8fc('0x1e')](function(){_0x59b0ef[_0xd8fc('0x15')](0xcc)[_0xd8fc('0x20')]();});}};}function handleEntityNotFound(_0x495bd2,_0x71dcc1){return function(_0x45ac21){if(!_0x45ac21){_0x495bd2['sendStatus'](0x194);}return _0x45ac21;};}function handleError(_0x270204,_0x5e50c4){_0x5e50c4=_0x5e50c4||0x1f4;return function(_0x200a2b){logger[_0xd8fc('0x21')](_0x200a2b[_0xd8fc('0x22')]);if(_0x200a2b[_0xd8fc('0x23')]){delete _0x200a2b['name'];}_0x270204[_0xd8fc('0x15')](_0x5e50c4)['send'](_0x200a2b);};}exports[_0xd8fc('0x24')]=function(_0x1692d0,_0x4e823d){var _0x4a5383={},_0x56a980={},_0x3bec97={'count':0x0,'rows':[]};var _0x2081ca=_[_0xd8fc('0x25')](db[_0xd8fc('0x26')][_0xd8fc('0x27')],function(_0x281559){return{'name':_0x281559[_0xd8fc('0x28')],'type':_0x281559[_0xd8fc('0x29')][_0xd8fc('0x2a')]};});_0x56a980['model']=_[_0xd8fc('0x25')](_0x2081ca,_0xd8fc('0x23'));_0x56a980['query']=_[_0xd8fc('0x2b')](_0x1692d0[_0xd8fc('0x2c')]);_0x56a980[_0xd8fc('0x2d')]=_['intersection'](_0x56a980[_0xd8fc('0x2e')],_0x56a980[_0xd8fc('0x2c')]);_0x4a5383[_0xd8fc('0x2f')]=_['intersection'](_0x56a980['model'],qs['fields'](_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x30')]));_0x4a5383[_0xd8fc('0x2f')]=_0x4a5383[_0xd8fc('0x2f')][_0xd8fc('0x31')]?_0x4a5383[_0xd8fc('0x2f')]:_0x56a980[_0xd8fc('0x2e')];if(!_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x32')](_0xd8fc('0x33'))){_0x4a5383['limit']=qs[_0xd8fc('0x18')](_0x1692d0['query'][_0xd8fc('0x18')]);_0x4a5383['offset']=qs['offset'](_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x1a')]);}_0x4a5383[_0xd8fc('0x34')]=qs[_0xd8fc('0x35')](_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x35')]);_0x4a5383['where']=qs[_0xd8fc('0x2d')](_[_0xd8fc('0x36')](_0x1692d0[_0xd8fc('0x2c')],_0x56a980['filters']),_0x2081ca);if(_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x37')]){_0x4a5383['where']=_['merge'](_0x4a5383[_0xd8fc('0x38')],{'$or':_['map'](_0x2081ca,function(_0x1ac864){if(_0x1ac864['type']!==_0xd8fc('0x39')){var _0x2cd726={};_0x2cd726[_0x1ac864[_0xd8fc('0x23')]]={'$like':'%'+_0x1692d0['query'][_0xd8fc('0x37')]+'%'};return _0x2cd726;}})});}_0x4a5383=_['merge']({},_0x4a5383,_0x1692d0[_0xd8fc('0x3a')]);var _0x16f411={'where':_0x4a5383['where']};return db[_0xd8fc('0x26')][_0xd8fc('0x19')](_0x16f411)[_0xd8fc('0x1e')](function(_0x17dba2){_0x3bec97['count']=_0x17dba2;if(_0x1692d0[_0xd8fc('0x2c')][_0xd8fc('0x3b')]){_0x4a5383[_0xd8fc('0x3c')]=[{'all':!![]}];}return db['SmsTransferReport']['findAll'](_0x4a5383);})['then'](function(_0x17ffbb){_0x3bec97[_0xd8fc('0x3d')]=_0x17ffbb;return _0x3bec97;})[_0xd8fc('0x1e')](respondWithFilteredResult(_0x4e823d,_0x4a5383))[_0xd8fc('0x3e')](handleError(_0x4e823d,null));};exports['show']=function(_0x32c555,_0x145f37){var _0xaaa4b2={'raw':!![],'where':{'id':_0x32c555[_0xd8fc('0x3f')]['id']}},_0x126ff4={};_0x126ff4[_0xd8fc('0x2e')]=_[_0xd8fc('0x2b')](db['SmsTransferReport'][_0xd8fc('0x27')]);_0x126ff4[_0xd8fc('0x2c')]=_['keys'](_0x32c555[_0xd8fc('0x2c')]);_0x126ff4[_0xd8fc('0x2d')]=_[_0xd8fc('0x40')](_0x126ff4[_0xd8fc('0x2e')],_0x126ff4[_0xd8fc('0x2c')]);_0xaaa4b2[_0xd8fc('0x2f')]=_[_0xd8fc('0x40')](_0x126ff4[_0xd8fc('0x2e')],qs[_0xd8fc('0x30')](_0x32c555[_0xd8fc('0x2c')][_0xd8fc('0x30')]));_0xaaa4b2[_0xd8fc('0x2f')]=_0xaaa4b2[_0xd8fc('0x2f')][_0xd8fc('0x31')]?_0xaaa4b2['attributes']:_0x126ff4['model'];if(_0x32c555['query'][_0xd8fc('0x3b')]){_0xaaa4b2[_0xd8fc('0x3c')]=[{'all':!![]}];}_0xaaa4b2=_[_0xd8fc('0x41')]({},_0xaaa4b2,_0x32c555[_0xd8fc('0x3a')]);return db['SmsTransferReport'][_0xd8fc('0x42')](_0xaaa4b2)[_0xd8fc('0x1e')](handleEntityNotFound(_0x145f37,null))[_0xd8fc('0x1e')](respondWithResult(_0x145f37,null))[_0xd8fc('0x3e')](handleError(_0x145f37,null));};exports[_0xd8fc('0x43')]=function(_0x19b43e,_0xc12ace){return db['SmsTransferReport']['create'](_0x19b43e['body'],{})[_0xd8fc('0x1e')](respondWithResult(_0xc12ace,0xc9))[_0xd8fc('0x3e')](handleError(_0xc12ace,null));};exports[_0xd8fc('0x44')]=function(_0x13cd5d,_0x2dd8e0){if(_0x13cd5d[_0xd8fc('0x45')]['id']){delete _0x13cd5d[_0xd8fc('0x45')]['id'];}return db[_0xd8fc('0x26')][_0xd8fc('0x42')]({'where':{'id':_0x13cd5d['params']['id']}})['then'](handleEntityNotFound(_0x2dd8e0,null))[_0xd8fc('0x1e')](saveUpdates(_0x13cd5d['body'],null))[_0xd8fc('0x1e')](respondWithResult(_0x2dd8e0,null))['catch'](handleError(_0x2dd8e0,null));};exports[_0xd8fc('0x1f')]=function(_0x3d913a,_0x57206c){return db[_0xd8fc('0x26')][_0xd8fc('0x42')]({'where':{'id':_0x3d913a[_0xd8fc('0x3f')]['id']}})[_0xd8fc('0x1e')](handleEntityNotFound(_0x57206c,null))[_0xd8fc('0x1e')](removeEntity(_0x57206c,null))[_0xd8fc('0x3e')](handleError(_0x57206c,null));};exports[_0xd8fc('0x46')]=function(_0x53b2cb,_0x1d1d40){return db[_0xd8fc('0x26')]['describe']()['then'](respondWithResult(_0x1d1d40,null))[_0xd8fc('0x3e')](handleError(_0x1d1d40,null));}; \ No newline at end of file +var _0xc408=['pick','where','type','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','SmsTransferReport','fieldName','key','model','name','query','keys','filters','intersection','fields','attributes','length','sort'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xc408,0x1c2));var _0x8c40=function(_0x54f1f8,_0x5ed613){_0x54f1f8=_0x54f1f8-0x0;var _0x44f663=_0xc408[_0x54f1f8];return _0x44f663;};'use strict';var emlformat=require(_0x8c40('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c40('0x1'));var jsonpatch=require(_0x8c40('0x2'));var rp=require('request-promise');var moment=require(_0x8c40('0x3'));var BPromise=require(_0x8c40('0x4'));var Mustache=require(_0x8c40('0x5'));var util=require(_0x8c40('0x6'));var path=require(_0x8c40('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8c40('0x8'));var fs=require('fs');var fs_extra=require(_0x8c40('0x9'));var _=require(_0x8c40('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8c40('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8c40('0xc'));var querystring=require(_0x8c40('0xd'));var Papa=require(_0x8c40('0xe'));var Redis=require(_0x8c40('0xf'));var authService=require(_0x8c40('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8c40('0x11'));var logger=require(_0x8c40('0x12'))('api');var utils=require(_0x8c40('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x8c40('0x14'));var db=require(_0x8c40('0x15'))['db'];function respondWithStatusCode(_0x28f25f,_0x40ccbb){_0x40ccbb=_0x40ccbb||0xcc;return function(_0x237c97){if(_0x237c97){return _0x28f25f[_0x8c40('0x16')](_0x40ccbb);}return _0x28f25f[_0x8c40('0x17')](_0x40ccbb)[_0x8c40('0x18')]();};}function respondWithResult(_0x12e6a3,_0x4a26de){_0x4a26de=_0x4a26de||0xc8;return function(_0x1e144a){if(_0x1e144a){return _0x12e6a3[_0x8c40('0x17')](_0x4a26de)[_0x8c40('0x19')](_0x1e144a);}};}function respondWithFilteredResult(_0x51b54f,_0x17a848){return function(_0x5332ac){if(_0x5332ac){var _0x3300ff=typeof _0x17a848['offset']==='undefined'&&typeof _0x17a848['limit']===_0x8c40('0x1a');var _0x2f5105=_0x5332ac[_0x8c40('0x1b')];var _0x407f45=_0x3300ff?0x0:_0x17a848[_0x8c40('0x1c')];var _0x4db519=_0x3300ff?_0x5332ac['count']:_0x17a848['offset']+_0x17a848[_0x8c40('0x1d')];var _0x3f42e;if(_0x4db519>=_0x2f5105){_0x4db519=_0x2f5105;_0x3f42e=0xc8;}else{_0x3f42e=0xce;}_0x51b54f[_0x8c40('0x17')](_0x3f42e);return _0x51b54f['set'](_0x8c40('0x1e'),_0x407f45+'-'+_0x4db519+'/'+_0x2f5105)[_0x8c40('0x19')](_0x5332ac);}return null;};}function patchUpdates(_0x48b6a0){return function(_0x49a040){try{jsonpatch[_0x8c40('0x1f')](_0x49a040,_0x48b6a0,!![]);}catch(_0x530a77){return BPromise[_0x8c40('0x20')](_0x530a77);}return _0x49a040[_0x8c40('0x21')]();};}function saveUpdates(_0x44f566,_0x5f15db){return function(_0x570e65){if(_0x570e65){return _0x570e65[_0x8c40('0x22')](_0x44f566)[_0x8c40('0x23')](function(_0x57e42f){return _0x57e42f;});}return null;};}function removeEntity(_0x28f5c0,_0x274f0e){return function(_0x458ed7){if(_0x458ed7){return _0x458ed7[_0x8c40('0x24')]()[_0x8c40('0x23')](function(){_0x28f5c0[_0x8c40('0x17')](0xcc)[_0x8c40('0x18')]();});}};}function handleEntityNotFound(_0x5edf60,_0x387bfd){return function(_0x594275){if(!_0x594275){_0x5edf60[_0x8c40('0x16')](0x194);}return _0x594275;};}function handleError(_0x368a70,_0x3a9f12){_0x3a9f12=_0x3a9f12||0x1f4;return function(_0x196226){logger[_0x8c40('0x25')](_0x196226[_0x8c40('0x26')]);if(_0x196226['name']){delete _0x196226['name'];}_0x368a70[_0x8c40('0x17')](_0x3a9f12)[_0x8c40('0x27')](_0x196226);};}exports['index']=function(_0x1bae72,_0x23dc75){var _0x4ebca8={},_0x175315={},_0xc77371={'count':0x0,'rows':[]};var _0x1725f0=_[_0x8c40('0x28')](db[_0x8c40('0x29')]['rawAttributes'],function(_0x2d3a93){return{'name':_0x2d3a93[_0x8c40('0x2a')],'type':_0x2d3a93['type'][_0x8c40('0x2b')]};});_0x175315[_0x8c40('0x2c')]=_[_0x8c40('0x28')](_0x1725f0,_0x8c40('0x2d'));_0x175315[_0x8c40('0x2e')]=_[_0x8c40('0x2f')](_0x1bae72['query']);_0x175315[_0x8c40('0x30')]=_[_0x8c40('0x31')](_0x175315[_0x8c40('0x2c')],_0x175315['query']);_0x4ebca8['attributes']=_[_0x8c40('0x31')](_0x175315[_0x8c40('0x2c')],qs[_0x8c40('0x32')](_0x1bae72[_0x8c40('0x2e')][_0x8c40('0x32')]));_0x4ebca8[_0x8c40('0x33')]=_0x4ebca8[_0x8c40('0x33')][_0x8c40('0x34')]?_0x4ebca8[_0x8c40('0x33')]:_0x175315[_0x8c40('0x2c')];if(!_0x1bae72[_0x8c40('0x2e')]['hasOwnProperty']('nolimit')){_0x4ebca8[_0x8c40('0x1d')]=qs['limit'](_0x1bae72['query'][_0x8c40('0x1d')]);_0x4ebca8[_0x8c40('0x1c')]=qs['offset'](_0x1bae72[_0x8c40('0x2e')][_0x8c40('0x1c')]);}_0x4ebca8['order']=qs[_0x8c40('0x35')](_0x1bae72[_0x8c40('0x2e')][_0x8c40('0x35')]);_0x4ebca8['where']=qs[_0x8c40('0x30')](_[_0x8c40('0x36')](_0x1bae72[_0x8c40('0x2e')],_0x175315[_0x8c40('0x30')]),_0x1725f0);if(_0x1bae72[_0x8c40('0x2e')]['filter']){_0x4ebca8[_0x8c40('0x37')]=_['merge'](_0x4ebca8['where'],{'$or':_[_0x8c40('0x28')](_0x1725f0,function(_0x31a741){if(_0x31a741[_0x8c40('0x38')]!=='VIRTUAL'){var _0x4f5464={};_0x4f5464[_0x31a741[_0x8c40('0x2d')]]={'$like':'%'+_0x1bae72[_0x8c40('0x2e')][_0x8c40('0x39')]+'%'};return _0x4f5464;}})});}_0x4ebca8=_[_0x8c40('0x3a')]({},_0x4ebca8,_0x1bae72[_0x8c40('0x3b')]);var _0x1fbadf={'where':_0x4ebca8[_0x8c40('0x37')]};return db[_0x8c40('0x29')]['count'](_0x1fbadf)[_0x8c40('0x23')](function(_0x70c9e3){_0xc77371[_0x8c40('0x1b')]=_0x70c9e3;if(_0x1bae72[_0x8c40('0x2e')][_0x8c40('0x3c')]){_0x4ebca8[_0x8c40('0x3d')]=[{'all':!![]}];}return db[_0x8c40('0x29')][_0x8c40('0x3e')](_0x4ebca8);})['then'](function(_0x628050){_0xc77371[_0x8c40('0x3f')]=_0x628050;return _0xc77371;})['then'](respondWithFilteredResult(_0x23dc75,_0x4ebca8))[_0x8c40('0x40')](handleError(_0x23dc75,null));};exports[_0x8c40('0x41')]=function(_0x21c574,_0x1c23ea){var _0x20a69a={'raw':!![],'where':{'id':_0x21c574[_0x8c40('0x42')]['id']}},_0x186545={};_0x186545['model']=_[_0x8c40('0x2f')](db[_0x8c40('0x29')][_0x8c40('0x43')]);_0x186545[_0x8c40('0x2e')]=_['keys'](_0x21c574[_0x8c40('0x2e')]);_0x186545['filters']=_['intersection'](_0x186545[_0x8c40('0x2c')],_0x186545[_0x8c40('0x2e')]);_0x20a69a['attributes']=_[_0x8c40('0x31')](_0x186545[_0x8c40('0x2c')],qs[_0x8c40('0x32')](_0x21c574[_0x8c40('0x2e')][_0x8c40('0x32')]));_0x20a69a[_0x8c40('0x33')]=_0x20a69a['attributes'][_0x8c40('0x34')]?_0x20a69a[_0x8c40('0x33')]:_0x186545[_0x8c40('0x2c')];if(_0x21c574[_0x8c40('0x2e')][_0x8c40('0x3c')]){_0x20a69a[_0x8c40('0x3d')]=[{'all':!![]}];}_0x20a69a=_[_0x8c40('0x3a')]({},_0x20a69a,_0x21c574[_0x8c40('0x3b')]);return db[_0x8c40('0x29')]['find'](_0x20a69a)[_0x8c40('0x23')](handleEntityNotFound(_0x1c23ea,null))[_0x8c40('0x23')](respondWithResult(_0x1c23ea,null))[_0x8c40('0x40')](handleError(_0x1c23ea,null));};exports[_0x8c40('0x44')]=function(_0x22928f,_0x1caa4c){return db[_0x8c40('0x29')][_0x8c40('0x44')](_0x22928f['body'],{})[_0x8c40('0x23')](respondWithResult(_0x1caa4c,0xc9))['catch'](handleError(_0x1caa4c,null));};exports[_0x8c40('0x22')]=function(_0xc70b54,_0x4f870a){if(_0xc70b54['body']['id']){delete _0xc70b54[_0x8c40('0x45')]['id'];}return db[_0x8c40('0x29')]['find']({'where':{'id':_0xc70b54['params']['id']}})[_0x8c40('0x23')](handleEntityNotFound(_0x4f870a,null))[_0x8c40('0x23')](saveUpdates(_0xc70b54[_0x8c40('0x45')],null))[_0x8c40('0x23')](respondWithResult(_0x4f870a,null))[_0x8c40('0x40')](handleError(_0x4f870a,null));};exports[_0x8c40('0x24')]=function(_0x52b296,_0xc13d8){return db['SmsTransferReport'][_0x8c40('0x46')]({'where':{'id':_0x52b296[_0x8c40('0x42')]['id']}})[_0x8c40('0x23')](handleEntityNotFound(_0xc13d8,null))[_0x8c40('0x23')](removeEntity(_0xc13d8,null))[_0x8c40('0x40')](handleError(_0xc13d8,null));};exports[_0x8c40('0x47')]=function(_0x2f5bfa,_0x3bafb0){return db[_0x8c40('0x29')]['describe']()[_0x8c40('0x23')](respondWithResult(_0x3bafb0,null))[_0x8c40('0x40')](handleError(_0x3bafb0,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 4e9e0cf..2e22f07 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 _0x046e=['request-promise','rimraf','exports','define','report_sms_transfer','uniqueid','lodash','../../config/logger','moment','bluebird'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x046e,0x1b4));var _0xe046=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x046e[_0x47a7d0];return _0xb9bd08;};'use strict';var _=require(_0xe046('0x0'));var util=require('util');var logger=require(_0xe046('0x1'))('api');var moment=require(_0xe046('0x2'));var BPromise=require(_0xe046('0x3'));var rp=require(_0xe046('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe046('0x5'));var config=require('../../config/environment');var attributes=require('./smsTransferReport.attributes');module[_0xe046('0x6')]=function(_0x59fa28,_0x57db0c){return _0x59fa28[_0xe046('0x7')]('SmsTransferReport',attributes,{'tableName':_0xe046('0x8'),'paranoid':![],'indexes':[{'name':_0xe046('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c3c=['define','SmsTransferReport','uniqueid','lodash','util','api','request-promise','../../config/environment','./smsTransferReport.attributes','exports'];(function(_0x4e2022,_0x3477a9){var _0x44c976=function(_0x581191){while(--_0x581191){_0x4e2022['push'](_0x4e2022['shift']());}};_0x44c976(++_0x3477a9);}(_0x4c3c,0x1e3));var _0xc4c3=function(_0x3b1047,_0x268928){_0x3b1047=_0x3b1047-0x0;var _0x4e7ccd=_0x4c3c[_0x3b1047];return _0x4e7ccd;};'use strict';var _=require(_0xc4c3('0x0'));var util=require(_0xc4c3('0x1'));var logger=require('../../config/logger')(_0xc4c3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc4c3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc4c3('0x4'));var attributes=require(_0xc4c3('0x5'));module[_0xc4c3('0x6')]=function(_0x36cea1,_0x1cb620){return _0x36cea1[_0xc4c3('0x7')](_0xc4c3('0x8'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xc4c3('0x9'),'fields':[_0xc4c3('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index c23c080..39339e5 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 _0xfd7b=['SmsTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfd7b,0x1df));var _0xbfd7=function(_0x8ba19a,_0x1d2b2b){_0x8ba19a=_0x8ba19a-0x0;var _0x2bd8b4=_0xfd7b[_0x8ba19a];return _0x2bd8b4;};'use strict';var _=require('lodash');var util=require(_0xbfd7('0x0'));var moment=require(_0xbfd7('0x1'));var BPromise=require(_0xbfd7('0x2'));var rs=require(_0xbfd7('0x3'));var fs=require('fs');var Redis=require(_0xbfd7('0x4'));var db=require(_0xbfd7('0x5'))['db'];var utils=require(_0xbfd7('0x6'));var logger=require(_0xbfd7('0x7'))(_0xbfd7('0x8'));var config=require(_0xbfd7('0x9'));var jayson=require(_0xbfd7('0xa'));var client=jayson[_0xbfd7('0xb')][_0xbfd7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f3067,_0x38b1ef,_0x48f2aa){return new BPromise(function(_0x33dab1,_0x5cee3d){return client[_0xbfd7('0xd')](_0x5f3067,_0x48f2aa)[_0xbfd7('0xe')](function(_0x5a3d78){logger[_0xbfd7('0xf')]('SmsTransferReport,\x20%s,\x20%s',_0x38b1ef,_0xbfd7('0x10'));logger[_0xbfd7('0x11')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x38b1ef,'request\x20sent',JSON[_0xbfd7('0x12')](_0x5a3d78));if(_0x5a3d78[_0xbfd7('0x13')]){if(_0x5a3d78[_0xbfd7('0x13')][_0xbfd7('0x14')]===0x1f4){logger[_0xbfd7('0x13')]('SmsTransferReport,\x20%s,\x20%s',_0x38b1ef,_0x5a3d78[_0xbfd7('0x13')]['message']);return _0x5cee3d(_0x5a3d78[_0xbfd7('0x13')]['message']);}logger['error'](_0xbfd7('0x15'),_0x38b1ef,_0x5a3d78[_0xbfd7('0x13')][_0xbfd7('0x16')]);return _0x33dab1(_0x5a3d78[_0xbfd7('0x13')]['message']);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x38b1ef,_0xbfd7('0x10'));_0x33dab1(_0x5a3d78[_0xbfd7('0x17')][_0xbfd7('0x16')]);}})[_0xbfd7('0x18')](function(_0x30c721){logger[_0xbfd7('0x13')](_0xbfd7('0x15'),_0x38b1ef,_0x30c721);_0x5cee3d(_0x30c721);});});} \ No newline at end of file +var _0x1354=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1354,0x95));var _0x4135=function(_0x2efd1d,_0x44f696){_0x2efd1d=_0x2efd1d-0x0;var _0x1ef3f6=_0x1354[_0x2efd1d];return _0x1ef3f6;};'use strict';var _=require(_0x4135('0x0'));var util=require(_0x4135('0x1'));var moment=require(_0x4135('0x2'));var BPromise=require(_0x4135('0x3'));var rs=require(_0x4135('0x4'));var fs=require('fs');var Redis=require(_0x4135('0x5'));var db=require(_0x4135('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4135('0x7'))(_0x4135('0x8'));var config=require(_0x4135('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4135('0xa')][_0x4135('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e355d,_0x419ad4,_0x1dcce0){return new BPromise(function(_0x3e7ae3,_0x50ef3f){return client[_0x4135('0xc')](_0x5e355d,_0x1dcce0)['then'](function(_0x365d9b){logger[_0x4135('0xd')](_0x4135('0xe'),_0x419ad4,_0x4135('0xf'));logger['debug'](_0x4135('0x10'),_0x419ad4,'request\x20sent',JSON['stringify'](_0x365d9b));if(_0x365d9b[_0x4135('0x11')]){if(_0x365d9b[_0x4135('0x11')][_0x4135('0x12')]===0x1f4){logger['error'](_0x4135('0xe'),_0x419ad4,_0x365d9b[_0x4135('0x11')][_0x4135('0x13')]);return _0x50ef3f(_0x365d9b[_0x4135('0x11')][_0x4135('0x13')]);}logger[_0x4135('0x11')]('SmsTransferReport,\x20%s,\x20%s',_0x419ad4,_0x365d9b['error'][_0x4135('0x13')]);return _0x3e7ae3(_0x365d9b[_0x4135('0x11')][_0x4135('0x13')]);}else{logger[_0x4135('0xd')]('SmsTransferReport,\x20%s,\x20%s',_0x419ad4,_0x4135('0xf'));_0x3e7ae3(_0x365d9b[_0x4135('0x14')]['message']);}})['catch'](function(_0x32b4db){logger['error'](_0x4135('0xe'),_0x419ad4,_0x32b4db);_0x50ef3f(_0x32b4db);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 208c62d..9c4d386 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 _0xdaff=['express','fs-extra','get','isAuthenticated','index','/:id','show','/:id/download','diskStorage','join','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','now','extname','post','single','file','put','update','delete','exports','multer','util','connect-timeout'];(function(_0x2b786a,_0xc9e29){var _0x5dc09b=function(_0x5affd7){while(--_0x5affd7){_0x2b786a['push'](_0x2b786a['shift']());}};_0x5dc09b(++_0xc9e29);}(_0xdaff,0x192));var _0xfdaf=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xdaff[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xfdaf('0x0'));var util=require(_0xfdaf('0x1'));var path=require('path');var timeout=require(_0xfdaf('0x2'));var express=require(_0xfdaf('0x3'));var router=express['Router']();var fs_extra=require(_0xfdaf('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./sound.controller');router[_0xfdaf('0x5')]('/',auth[_0xfdaf('0x6')](),controller[_0xfdaf('0x7')]);router[_0xfdaf('0x5')](_0xfdaf('0x8'),auth[_0xfdaf('0x6')](),controller[_0xfdaf('0x9')]);router[_0xfdaf('0x5')](_0xfdaf('0xa'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xfdaf('0xb')]({'destination':function(_0x2ad209,_0x4b1741,_0x42d74f){_0x42d74f(null,path[_0xfdaf('0xc')](config['root'],_0xfdaf('0xd')));},'filename':function(_0x3d2cdf,_0x3b8bb8,_0x1b9e65){_0x3b8bb8[_0xfdaf('0xe')]=_0x3b8bb8[_0xfdaf('0xe')][_0xfdaf('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1b9e65(null,util['format'](_0xfdaf('0x10'),path[_0xfdaf('0x11')](_0x3b8bb8[_0xfdaf('0xe')],path['extname'](_0x3b8bb8['originalname'])),Date[_0xfdaf('0x12')](),path[_0xfdaf('0x13')](_0x3b8bb8[_0xfdaf('0xe')])));}})});router[_0xfdaf('0x14')]('/',upload[_0xfdaf('0x15')](_0xfdaf('0x16')),controller['create']);router[_0xfdaf('0x17')](_0xfdaf('0x8'),auth['isAuthenticated'](),controller[_0xfdaf('0x18')]);router[_0xfdaf('0x19')](_0xfdaf('0x8'),auth[_0xfdaf('0x6')](),controller[_0xfdaf('0x19')]);module[_0xfdaf('0x1a')]=router; \ No newline at end of file +var _0x40da=['update','delete','/:id','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','replace','format','%s-%s%s','basename','originalname','extname','now','post','file','create'];(function(_0xccf869,_0x2556a5){var _0x21a9db=function(_0xcc4835){while(--_0xcc4835){_0xccf869['push'](_0xccf869['shift']());}};_0x21a9db(++_0x2556a5);}(_0x40da,0x16b));var _0xa40d=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x40da[_0x1969a7];return _0x3d665f;};'use strict';var multer=require(_0xa40d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa40d('0x1'));var router=express[_0xa40d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xa40d('0x3'));var interaction=require(_0xa40d('0x4'));var config=require(_0xa40d('0x5'));var controller=require(_0xa40d('0x6'));router[_0xa40d('0x7')]('/',auth[_0xa40d('0x8')](),controller[_0xa40d('0x9')]);router['get']('/:id',auth[_0xa40d('0x8')](),controller[_0xa40d('0xa')]);router[_0xa40d('0x7')](_0xa40d('0xb'),auth[_0xa40d('0x8')](),controller[_0xa40d('0xc')]);var upload=multer({'storage':multer[_0xa40d('0xd')]({'destination':function(_0x43e442,_0x344534,_0x1d2e10){_0x1d2e10(null,path[_0xa40d('0xe')](config[_0xa40d('0xf')],_0xa40d('0x10')));},'filename':function(_0x32fff2,_0x507d24,_0x3b1b4f){_0x507d24['originalname']=_0x507d24['originalname'][_0xa40d('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3b1b4f(null,util[_0xa40d('0x12')](_0xa40d('0x13'),path[_0xa40d('0x14')](_0x507d24[_0xa40d('0x15')],path[_0xa40d('0x16')](_0x507d24[_0xa40d('0x15')])),Date[_0xa40d('0x17')](),path[_0xa40d('0x16')](_0x507d24[_0xa40d('0x15')])));}})});router[_0xa40d('0x18')]('/',upload['single'](_0xa40d('0x19')),controller[_0xa40d('0x1a')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa40d('0x1b')]);router[_0xa40d('0x1c')](_0xa40d('0x1d'),auth[_0xa40d('0x8')](),controller['delete']);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 16d3b73..2ea4b07 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 _0x71e7=['INTEGER','FLOAT','sequelize','STRING','BIGINT'];(function(_0x134951,_0x11c6dd){var _0x141d60=function(_0x52ec12){while(--_0x52ec12){_0x134951['push'](_0x134951['shift']());}};_0x141d60(++_0x11c6dd);}(_0x71e7,0x188));var _0x771e=function(_0x2e7ba0,_0x551e11){_0x2e7ba0=_0x2e7ba0-0x0;var _0x4e6f3a=_0x71e7[_0x2e7ba0];return _0x4e6f3a;};'use strict';var Sequelize=require(_0x771e('0x0'));module['exports']={'name':{'type':Sequelize[_0x771e('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x771e('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x771e('0x1')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x771e('0x2')]},'original_channelCount':{'type':Sequelize[_0x771e('0x3')]},'original_bitRate':{'type':Sequelize[_0x771e('0x2')]},'original_sampleRate':{'type':Sequelize[_0x771e('0x3')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0x771e('0x4')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x771e('0x3')]},'converted_bitRate':{'type':Sequelize[_0x771e('0x2')]},'converted_sampleRate':{'type':Sequelize[_0x771e('0x3')]}}; \ No newline at end of file +var _0xca6c=['INTEGER','sequelize','exports','STRING','name','FLOAT','BIGINT'];(function(_0xbee3d3,_0x43abd3){var _0x41dd6d=function(_0x5f4334){while(--_0x5f4334){_0xbee3d3['push'](_0xbee3d3['shift']());}};_0x41dd6d(++_0x43abd3);}(_0xca6c,0x16d));var _0xcca6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xca6c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xcca6('0x0'));module[_0xcca6('0x1')]={'name':{'type':Sequelize[_0xcca6('0x2')],'unique':_0xcca6('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0xcca6('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0xcca6('0x2')]},'original_format':{'type':Sequelize[_0xcca6('0x2')]},'original_duration':{'type':Sequelize[_0xcca6('0x4')]},'original_sampleCount':{'type':Sequelize[_0xcca6('0x5')]},'original_channelCount':{'type':Sequelize[_0xcca6('0x6')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xcca6('0x6')]},'converted_format':{'type':Sequelize[_0xcca6('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xcca6('0x6')]},'converted_bitRate':{'type':Sequelize[_0xcca6('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xcca6('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 3239576..7dfe01b 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 _0xb639=['fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','Sounds','UserProfileResource','name','send','Sound','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','merge','where','includeAll','include','findAll','catch','show','params','keys','options','find','converted_format','root','save_name','Sequelize','ValidationError','download','join','server/files/sounds/converted','format','%s.%s','create','basename','file','originalname','extname','wav','server/files/sounds/original','filename','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','original_format','eml-format','rimraf','zip-dir'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xb639,0x17a));var _0x9b63=function(_0x3accdb,_0x187888){_0x3accdb=_0x3accdb-0x0;var _0x4dab57=_0xb639[_0x3accdb];return _0x4dab57;};'use strict';var emlformat=require(_0x9b63('0x0'));var rimraf=require(_0x9b63('0x1'));var zipdir=require(_0x9b63('0x2'));var jsonpatch=require(_0x9b63('0x3'));var rp=require('request-promise');var moment=require(_0x9b63('0x4'));var BPromise=require(_0x9b63('0x5'));var Mustache=require(_0x9b63('0x6'));var util=require(_0x9b63('0x7'));var path=require(_0x9b63('0x8'));var sox=require('sox');var csv=require(_0x9b63('0x9'));var ejs=require(_0x9b63('0xa'));var fs=require('fs');var fs_extra=require(_0x9b63('0xb'));var _=require(_0x9b63('0xc'));var squel=require(_0x9b63('0xd'));var crypto=require(_0x9b63('0xe'));var jsforce=require(_0x9b63('0xf'));var deskjs=require(_0x9b63('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9b63('0x11'));var Papa=require(_0x9b63('0x12'));var Redis=require(_0x9b63('0x13'));var authService=require(_0x9b63('0x14'));var qs=require(_0x9b63('0x15'));var as=require(_0x9b63('0x16'));var hardwareService=require(_0x9b63('0x17'));var logger=require(_0x9b63('0x18'))(_0x9b63('0x19'));var utils=require(_0x9b63('0x1a'));var config=require(_0x9b63('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b63('0x1c'))['db'];function respondWithStatusCode(_0x5a4a41,_0x2e9080){_0x2e9080=_0x2e9080||0xcc;return function(_0x483804){if(_0x483804){return _0x5a4a41[_0x9b63('0x1d')](_0x2e9080);}return _0x5a4a41[_0x9b63('0x1e')](_0x2e9080)[_0x9b63('0x1f')]();};}function respondWithResult(_0x3692d2,_0x1d399e){_0x1d399e=_0x1d399e||0xc8;return function(_0x75958c){if(_0x75958c){return _0x3692d2[_0x9b63('0x1e')](_0x1d399e)[_0x9b63('0x20')](_0x75958c);}};}function respondWithFilteredResult(_0x3a236d,_0x80c9b3){return function(_0x261287){if(_0x261287){var _0x6643cc=typeof _0x80c9b3[_0x9b63('0x21')]===_0x9b63('0x22')&&typeof _0x80c9b3[_0x9b63('0x23')]===_0x9b63('0x22');var _0x1f00b4=_0x261287[_0x9b63('0x24')];var _0x4aa835=_0x6643cc?0x0:_0x80c9b3[_0x9b63('0x21')];var _0x339235=_0x6643cc?_0x261287['count']:_0x80c9b3[_0x9b63('0x21')]+_0x80c9b3[_0x9b63('0x23')];var _0x3ccdef;if(_0x339235>=_0x1f00b4){_0x339235=_0x1f00b4;_0x3ccdef=0xc8;}else{_0x3ccdef=0xce;}_0x3a236d[_0x9b63('0x1e')](_0x3ccdef);return _0x3a236d[_0x9b63('0x25')]('Content-Range',_0x4aa835+'-'+_0x339235+'/'+_0x1f00b4)[_0x9b63('0x20')](_0x261287);}return null;};}function patchUpdates(_0x2a9d32){return function(_0x242479){try{jsonpatch[_0x9b63('0x26')](_0x242479,_0x2a9d32,!![]);}catch(_0x2bdc52){return BPromise[_0x9b63('0x27')](_0x2bdc52);}return _0x242479[_0x9b63('0x28')]();};}function saveUpdates(_0x1ef50e,_0x17c93b){return function(_0x13f49d){if(_0x13f49d){return _0x13f49d[_0x9b63('0x29')](_0x1ef50e)[_0x9b63('0x2a')](function(_0x5e7d76){return _0x5e7d76;});}return null;};}function removeEntity(_0x482f5e,_0x224f63){return function(_0x117574){if(_0x117574){return _0x117574[_0x9b63('0x2b')]()[_0x9b63('0x2a')](function(){var _0x54da2c=_0x117574['get']({'plain':!![]});var _0x34adb8=_0x9b63('0x2c');return db[_0x9b63('0x2d')][_0x9b63('0x2b')]({'where':{'type':_0x34adb8,'resourceId':_0x54da2c['id']}})[_0x9b63('0x2a')](function(){return _0x117574;});})[_0x9b63('0x2a')](function(){_0x482f5e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fcb9c,_0x45a3fc){return function(_0x2a6524){if(!_0x2a6524){_0x3fcb9c[_0x9b63('0x1d')](0x194);}return _0x2a6524;};}function handleError(_0x6bbc5a,_0x2e8e37){_0x2e8e37=_0x2e8e37||0x1f4;return function(_0x112f25){logger['error'](_0x112f25['stack']);if(_0x112f25['name']){delete _0x112f25[_0x9b63('0x2e')];}_0x6bbc5a[_0x9b63('0x1e')](_0x2e8e37)[_0x9b63('0x2f')](_0x112f25);};}exports['index']=function(_0x561816,_0xbd2532){var _0x57ce10={},_0x5c39e7={},_0x46d031={'count':0x0,'rows':[]};var _0x551089=_['map'](db[_0x9b63('0x30')][_0x9b63('0x31')],function(_0x3498a5){return{'name':_0x3498a5[_0x9b63('0x32')],'type':_0x3498a5[_0x9b63('0x33')]['key']};});_0x5c39e7['model']=_[_0x9b63('0x34')](_0x551089,_0x9b63('0x2e'));_0x5c39e7[_0x9b63('0x35')]=_['keys'](_0x561816['query']);_0x5c39e7[_0x9b63('0x36')]=_[_0x9b63('0x37')](_0x5c39e7[_0x9b63('0x38')],_0x5c39e7['query']);_0x57ce10[_0x9b63('0x39')]=_[_0x9b63('0x37')](_0x5c39e7[_0x9b63('0x38')],qs[_0x9b63('0x3a')](_0x561816[_0x9b63('0x35')]['fields']));_0x57ce10['attributes']=_0x57ce10[_0x9b63('0x39')][_0x9b63('0x3b')]?_0x57ce10[_0x9b63('0x39')]:_0x5c39e7[_0x9b63('0x38')];if(!_0x561816[_0x9b63('0x35')][_0x9b63('0x3c')](_0x9b63('0x3d'))){_0x57ce10[_0x9b63('0x23')]=qs[_0x9b63('0x23')](_0x561816[_0x9b63('0x35')][_0x9b63('0x23')]);_0x57ce10[_0x9b63('0x21')]=qs[_0x9b63('0x21')](_0x561816[_0x9b63('0x35')]['offset']);}_0x57ce10['order']=qs['sort'](_0x561816[_0x9b63('0x35')]['sort']);_0x57ce10['where']=qs[_0x9b63('0x36')](_[_0x9b63('0x3e')](_0x561816[_0x9b63('0x35')],_0x5c39e7[_0x9b63('0x36')]),_0x551089);if(_0x561816['query'][_0x9b63('0x3f')]){_0x57ce10['where']=_[_0x9b63('0x40')](_0x57ce10[_0x9b63('0x41')],{'$or':_[_0x9b63('0x34')](_0x551089,function(_0x1c1bc5){if(_0x1c1bc5['type']!=='VIRTUAL'){var _0x1ee941={};_0x1ee941[_0x1c1bc5[_0x9b63('0x2e')]]={'$like':'%'+_0x561816[_0x9b63('0x35')]['filter']+'%'};return _0x1ee941;}})});}_0x57ce10=_[_0x9b63('0x40')]({},_0x57ce10,_0x561816['options']);var _0x1ccb11={'where':_0x57ce10['where']};return db[_0x9b63('0x30')][_0x9b63('0x24')](_0x1ccb11)['then'](function(_0x418ecb){_0x46d031['count']=_0x418ecb;if(_0x561816[_0x9b63('0x35')][_0x9b63('0x42')]){_0x57ce10[_0x9b63('0x43')]=[{'all':!![]}];}return db[_0x9b63('0x30')][_0x9b63('0x44')](_0x57ce10);})[_0x9b63('0x2a')](function(_0x5170dd){_0x46d031['rows']=_0x5170dd;return _0x46d031;})['then'](respondWithFilteredResult(_0xbd2532,_0x57ce10))[_0x9b63('0x45')](handleError(_0xbd2532,null));};exports[_0x9b63('0x46')]=function(_0xd46d1b,_0x593d7d){var _0x302419={'raw':!![],'where':{'id':_0xd46d1b[_0x9b63('0x47')]['id']}},_0x3481e5={};_0x3481e5[_0x9b63('0x38')]=_[_0x9b63('0x48')](db['Sound']['rawAttributes']);_0x3481e5[_0x9b63('0x35')]=_[_0x9b63('0x48')](_0xd46d1b[_0x9b63('0x35')]);_0x3481e5[_0x9b63('0x36')]=_[_0x9b63('0x37')](_0x3481e5['model'],_0x3481e5[_0x9b63('0x35')]);_0x302419[_0x9b63('0x39')]=_[_0x9b63('0x37')](_0x3481e5['model'],qs['fields'](_0xd46d1b['query'][_0x9b63('0x3a')]));_0x302419['attributes']=_0x302419['attributes'][_0x9b63('0x3b')]?_0x302419['attributes']:_0x3481e5[_0x9b63('0x38')];if(_0xd46d1b[_0x9b63('0x35')]['includeAll']){_0x302419[_0x9b63('0x43')]=[{'all':!![]}];}_0x302419=_[_0x9b63('0x40')]({},_0x302419,_0xd46d1b[_0x9b63('0x49')]);return db[_0x9b63('0x30')]['find'](_0x302419)[_0x9b63('0x2a')](handleEntityNotFound(_0x593d7d,null))[_0x9b63('0x2a')](respondWithResult(_0x593d7d,null))[_0x9b63('0x45')](handleError(_0x593d7d,null));};exports['download']=function(_0x16cae0,_0x4025bb,_0x132a47){return db['Sound'][_0x9b63('0x4a')]({'where':{'id':_0x16cae0[_0x9b63('0x47')]['id']},'attributes':[_0x9b63('0x2e'),'save_name',_0x9b63('0x4b')],'raw':!![]})[_0x9b63('0x2a')](handleEntityNotFound(_0x4025bb,null))[_0x9b63('0x2a')](function(_0x3e1194){if(_0x3e1194){if(!fs['existsSync'](path['join'](config[_0x9b63('0x4c')],'server/files/sounds/converted',_0x3e1194[_0x9b63('0x4d')]+'.'+_0x3e1194[_0x9b63('0x4b')]))){throw new db[(_0x9b63('0x4e'))][(_0x9b63('0x4f'))]('Sound\x20not\x20found');}return _0x4025bb[_0x9b63('0x50')](path[_0x9b63('0x51')](config[_0x9b63('0x4c')],_0x9b63('0x52'),util[_0x9b63('0x53')](_0x9b63('0x54'),_0x3e1194[_0x9b63('0x4d')],_0x3e1194[_0x9b63('0x4b')])),util[_0x9b63('0x53')](_0x9b63('0x54'),_0x3e1194[_0x9b63('0x2e')],_0x3e1194['converted_format']));}return null;})[_0x9b63('0x45')](handleError(_0x4025bb,null));};exports[_0x9b63('0x55')]=function(_0x43982c,_0xe7ab8d,_0x5300a4){var _0x1e98c9={'name':path[_0x9b63('0x56')](_0x43982c[_0x9b63('0x57')][_0x9b63('0x58')],path['extname'](_0x43982c['file'][_0x9b63('0x58')])),'save_name':path[_0x9b63('0x56')](_0x43982c[_0x9b63('0x57')]['filename'],path[_0x9b63('0x59')](_0x43982c[_0x9b63('0x57')]['filename'])),'original_format':path[_0x9b63('0x59')](_0x43982c['file'][_0x9b63('0x58')])['substring'](0x1),'converted_format':_0x9b63('0x5a')};var _0x547250=path[_0x9b63('0x51')](config['root'],_0x9b63('0x5b'),_0x43982c[_0x9b63('0x57')]['filename']);var _0x25cf20=path[_0x9b63('0x51')](config[_0x9b63('0x4c')],'server/files/sounds/converted',util['format'](_0x9b63('0x54'),path['basename'](_0x43982c[_0x9b63('0x57')][_0x9b63('0x5c')],path['extname'](_0x43982c[_0x9b63('0x57')]['filename'])),_0x1e98c9[_0x9b63('0x4b')]));logger['info'](_0x9b63('0x5d'),_0x547250);logger[_0x9b63('0x5e')](_0x9b63('0x5f'),_0x25cf20);try{fs[_0x9b63('0x60')](_0x547250,parseInt(_0x9b63('0x61'),0x8));var _0x1f2896=sox[_0x9b63('0x62')](_0x547250,_0x25cf20,{'sampleRate':0x1f40,'format':_0x9b63('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1f2896['on'](_0x9b63('0x63'),function(_0x5ad897){fs[_0x9b63('0x64')](_0x547250);_0xe7ab8d['status'](0x1f4)[_0x9b63('0x2f')](_0x5ad897);});_0x1f2896['on'](_0x9b63('0x65'),function(_0x41b475){_0x1e98c9[_0x9b63('0x66')]=isNaN(_0x41b475[_0x9b63('0x67')])?null:_0x41b475[_0x9b63('0x67')]*0x3e8;_0x1e98c9['original_sampleCount']=isNaN(_0x41b475[_0x9b63('0x68')])?null:_0x41b475['sampleCount'];_0x1e98c9[_0x9b63('0x69')]=isNaN(_0x41b475[_0x9b63('0x6a')])?null:_0x41b475['channelCount'];_0x1e98c9[_0x9b63('0x6b')]=isNaN(_0x41b475['bitRate'])?null:_0x41b475[_0x9b63('0x6c')];_0x1e98c9[_0x9b63('0x6d')]=isNaN(_0x41b475[_0x9b63('0x6e')])?null:_0x41b475[_0x9b63('0x6e')];});_0x1f2896['on'](_0x9b63('0x6f'),function(_0x59bf14){_0x1e98c9[_0x9b63('0x70')]=isNaN(_0x59bf14[_0x9b63('0x67')])?null:_0x59bf14[_0x9b63('0x67')]*0x3e8;_0x1e98c9[_0x9b63('0x71')]=isNaN(_0x59bf14[_0x9b63('0x68')])?null:_0x59bf14['sampleCount'];_0x1e98c9['converted_channelCount']=isNaN(_0x59bf14['channelCount'])?null:_0x59bf14[_0x9b63('0x6a')];_0x1e98c9[_0x9b63('0x72')]=isNaN(_0x59bf14[_0x9b63('0x6c')])?null:_0x59bf14[_0x9b63('0x6c')];_0x1e98c9[_0x9b63('0x73')]=isNaN(_0x59bf14[_0x9b63('0x6e')])?null:_0x59bf14['sampleRate'];});_0x1f2896['on'](_0x9b63('0x1f'),function(){fs[_0x9b63('0x60')](_0x25cf20,parseInt('0777',0x8));return db[_0x9b63('0x30')][_0x9b63('0x55')](_0x1e98c9)[_0x9b63('0x2a')](function(_0x176293){var _0x506143={'role':_0x43982c[_0x9b63('0x74')]['role'],'userProfileId':_0x43982c[_0x9b63('0x74')]['userProfileId']};if(!_0x506143)throw new Error(_0x9b63('0x75'));if(_0x506143[_0x9b63('0x76')]===_0x9b63('0x77')){var _0x11ee7b=_0x176293[_0x9b63('0x78')]({'plain':!![]});return db[_0x9b63('0x79')][_0x9b63('0x4a')]({'where':{'name':_0x9b63('0x2c'),'userProfileId':_0x506143['userProfileId']},'raw':!![]})[_0x9b63('0x2a')](function(_0x25a016){if(_0x25a016&&_0x25a016[_0x9b63('0x7a')]===0x0){return db[_0x9b63('0x2d')][_0x9b63('0x55')]({'name':_0x11ee7b[_0x9b63('0x2e')],'resourceId':_0x11ee7b['id'],'type':_0x25a016['name'],'sectionId':_0x25a016['id']},{})[_0x9b63('0x2a')](function(){return _0x176293;});}else{return _0x176293;}})['catch'](function(_0x1cf5f2){logger[_0x9b63('0x63')](_0x9b63('0x7b'),_0x1cf5f2);throw _0x1cf5f2;});}return _0x176293;})['then'](respondWithResult(_0xe7ab8d,null))['catch'](handleError(_0xe7ab8d,null));});_0x1f2896['start']();}catch(_0x329f8b){_0xe7ab8d[_0x9b63('0x1e')](0x1f4)[_0x9b63('0x2f')](_0x329f8b);}};exports[_0x9b63('0x29')]=function(_0x4b136e,_0x380be1,_0x4d4c8a){return db['Sound'][_0x9b63('0x4a')]({'where':{'id':_0x4b136e[_0x9b63('0x47')]['id']}})[_0x9b63('0x2a')](handleEntityNotFound(_0x380be1,null))[_0x9b63('0x2a')](saveUpdates(_[_0x9b63('0x3e')](_0x4b136e[_0x9b63('0x74')],[_0x9b63('0x2e'),_0x9b63('0x7c')]),null))[_0x9b63('0x2a')](respondWithResult(_0x380be1,null))['catch'](handleError(_0x380be1,null));};exports[_0x9b63('0x7d')]=function(_0x15b913,_0x283abb,_0x1ccd0c){return db[_0x9b63('0x30')][_0x9b63('0x4a')]({'where':{'id':_0x15b913[_0x9b63('0x47')]['id']}})[_0x9b63('0x2a')](function(_0x24277f){if(_0x24277f){return _0x24277f[_0x9b63('0x2b')]();}})['then'](function(_0x41a85a){var _0x17451c=path[_0x9b63('0x51')](config[_0x9b63('0x4c')],_0x9b63('0x5b'),util[_0x9b63('0x53')](_0x9b63('0x54'),_0x41a85a['save_name'],_0x41a85a[_0x9b63('0x7e')]));var _0x3ed163=path[_0x9b63('0x51')](config['root'],_0x9b63('0x52'),util['format'](_0x9b63('0x54'),_0x41a85a[_0x9b63('0x4d')],_0x41a85a[_0x9b63('0x4b')]));fs['unlinkSync'](_0x17451c);fs[_0x9b63('0x64')](_0x3ed163);return _0x41a85a;})['then'](function(_0x1043cc){if(_0x1043cc){return _0x283abb[_0x9b63('0x1e')](0xcc)[_0x9b63('0x1f')]();}})[_0x9b63('0x2a')](handleEntityNotFound(_0x283abb,null))[_0x9b63('0x45')](handleError(_0x283abb,null));}; \ No newline at end of file +var _0x3d88=['fields','length','nolimit','order','sort','pick','filter','where','type','VIRTUAL','includeAll','Sound','rows','catch','show','params','include','download','save_name','converted_format','join','root','Sequelize','ValidationError','Sound\x20not\x20found','server/files/sounds/converted','format','%s.%s','basename','file','originalname','extname','filename','wav','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','start','update','description','delete','find','original_format','rimraf','zip-dir','fast-json-patch','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','save','then','get','UserProfileResource','destroy','error','name','send','index','map','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes'];(function(_0x52ff69,_0x39e318){var _0x44da5b=function(_0x3f3f71){while(--_0x3f3f71){_0x52ff69['push'](_0x52ff69['shift']());}};_0x44da5b(++_0x39e318);}(_0x3d88,0x128));var _0x83d8=function(_0x3e92d2,_0x106c66){_0x3e92d2=_0x3e92d2-0x0;var _0x4b431c=_0x3d88[_0x3e92d2];return _0x4b431c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x83d8('0x0'));var zipdir=require(_0x83d8('0x1'));var jsonpatch=require(_0x83d8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x83d8('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x83d8('0x4'));var csv=require(_0x83d8('0x5'));var ejs=require(_0x83d8('0x6'));var fs=require('fs');var fs_extra=require(_0x83d8('0x7'));var _=require('lodash');var squel=require(_0x83d8('0x8'));var crypto=require(_0x83d8('0x9'));var jsforce=require(_0x83d8('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x83d8('0x5'));var querystring=require('querystring');var Papa=require(_0x83d8('0xb'));var Redis=require(_0x83d8('0xc'));var authService=require(_0x83d8('0xd'));var qs=require(_0x83d8('0xe'));var as=require(_0x83d8('0xf'));var hardwareService=require(_0x83d8('0x10'));var logger=require(_0x83d8('0x11'))(_0x83d8('0x12'));var utils=require(_0x83d8('0x13'));var config=require(_0x83d8('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x83d8('0x15'))['db'];function respondWithStatusCode(_0x46885b,_0x400118){_0x400118=_0x400118||0xcc;return function(_0x267eaa){if(_0x267eaa){return _0x46885b[_0x83d8('0x16')](_0x400118);}return _0x46885b['status'](_0x400118)[_0x83d8('0x17')]();};}function respondWithResult(_0x5b6a35,_0x59b18d){_0x59b18d=_0x59b18d||0xc8;return function(_0x94f33){if(_0x94f33){return _0x5b6a35['status'](_0x59b18d)['json'](_0x94f33);}};}function respondWithFilteredResult(_0x3e1873,_0x2abff0){return function(_0x5e15b6){if(_0x5e15b6){var _0x175ebf=typeof _0x2abff0[_0x83d8('0x18')]===_0x83d8('0x19')&&typeof _0x2abff0[_0x83d8('0x1a')]==='undefined';var _0xe6f6c2=_0x5e15b6[_0x83d8('0x1b')];var _0x1ff2df=_0x175ebf?0x0:_0x2abff0[_0x83d8('0x18')];var _0x539475=_0x175ebf?_0x5e15b6[_0x83d8('0x1b')]:_0x2abff0[_0x83d8('0x18')]+_0x2abff0[_0x83d8('0x1a')];var _0x14b7df;if(_0x539475>=_0xe6f6c2){_0x539475=_0xe6f6c2;_0x14b7df=0xc8;}else{_0x14b7df=0xce;}_0x3e1873[_0x83d8('0x1c')](_0x14b7df);return _0x3e1873[_0x83d8('0x1d')](_0x83d8('0x1e'),_0x1ff2df+'-'+_0x539475+'/'+_0xe6f6c2)[_0x83d8('0x1f')](_0x5e15b6);}return null;};}function patchUpdates(_0x7319b0){return function(_0x13ead0){try{jsonpatch[_0x83d8('0x20')](_0x13ead0,_0x7319b0,!![]);}catch(_0x19098){return BPromise['reject'](_0x19098);}return _0x13ead0[_0x83d8('0x21')]();};}function saveUpdates(_0x46c7c0,_0x496d71){return function(_0x3bbf18){if(_0x3bbf18){return _0x3bbf18['update'](_0x46c7c0)[_0x83d8('0x22')](function(_0xe2c538){return _0xe2c538;});}return null;};}function removeEntity(_0x229e20,_0x5d75d9){return function(_0x813d94){if(_0x813d94){return _0x813d94['destroy']()['then'](function(){var _0x294d2e=_0x813d94[_0x83d8('0x23')]({'plain':!![]});var _0x3fb32e='Sounds';return db[_0x83d8('0x24')][_0x83d8('0x25')]({'where':{'type':_0x3fb32e,'resourceId':_0x294d2e['id']}})['then'](function(){return _0x813d94;});})[_0x83d8('0x22')](function(){_0x229e20[_0x83d8('0x1c')](0xcc)[_0x83d8('0x17')]();});}};}function handleEntityNotFound(_0x2dd7be,_0x487178){return function(_0x37ac43){if(!_0x37ac43){_0x2dd7be[_0x83d8('0x16')](0x194);}return _0x37ac43;};}function handleError(_0x3bf7ca,_0x1c7296){_0x1c7296=_0x1c7296||0x1f4;return function(_0x2d9fcb){logger[_0x83d8('0x26')](_0x2d9fcb['stack']);if(_0x2d9fcb[_0x83d8('0x27')]){delete _0x2d9fcb[_0x83d8('0x27')];}_0x3bf7ca['status'](_0x1c7296)[_0x83d8('0x28')](_0x2d9fcb);};}exports[_0x83d8('0x29')]=function(_0x20c6cb,_0x5a6c68){var _0x5808ed={},_0x174b2c={},_0x2c32b8={'count':0x0,'rows':[]};var _0x215d15=_[_0x83d8('0x2a')](db['Sound'][_0x83d8('0x2b')],function(_0x21f030){return{'name':_0x21f030[_0x83d8('0x2c')],'type':_0x21f030['type'][_0x83d8('0x2d')]};});_0x174b2c['model']=_['map'](_0x215d15,'name');_0x174b2c[_0x83d8('0x2e')]=_[_0x83d8('0x2f')](_0x20c6cb[_0x83d8('0x2e')]);_0x174b2c[_0x83d8('0x30')]=_[_0x83d8('0x31')](_0x174b2c[_0x83d8('0x32')],_0x174b2c['query']);_0x5808ed[_0x83d8('0x33')]=_[_0x83d8('0x31')](_0x174b2c[_0x83d8('0x32')],qs['fields'](_0x20c6cb[_0x83d8('0x2e')][_0x83d8('0x34')]));_0x5808ed[_0x83d8('0x33')]=_0x5808ed['attributes'][_0x83d8('0x35')]?_0x5808ed[_0x83d8('0x33')]:_0x174b2c[_0x83d8('0x32')];if(!_0x20c6cb[_0x83d8('0x2e')]['hasOwnProperty'](_0x83d8('0x36'))){_0x5808ed[_0x83d8('0x1a')]=qs[_0x83d8('0x1a')](_0x20c6cb['query'][_0x83d8('0x1a')]);_0x5808ed['offset']=qs[_0x83d8('0x18')](_0x20c6cb[_0x83d8('0x2e')][_0x83d8('0x18')]);}_0x5808ed[_0x83d8('0x37')]=qs[_0x83d8('0x38')](_0x20c6cb[_0x83d8('0x2e')][_0x83d8('0x38')]);_0x5808ed['where']=qs['filters'](_[_0x83d8('0x39')](_0x20c6cb[_0x83d8('0x2e')],_0x174b2c['filters']),_0x215d15);if(_0x20c6cb[_0x83d8('0x2e')][_0x83d8('0x3a')]){_0x5808ed[_0x83d8('0x3b')]=_['merge'](_0x5808ed[_0x83d8('0x3b')],{'$or':_[_0x83d8('0x2a')](_0x215d15,function(_0x17352f){if(_0x17352f[_0x83d8('0x3c')]!==_0x83d8('0x3d')){var _0x5b29d9={};_0x5b29d9[_0x17352f[_0x83d8('0x27')]]={'$like':'%'+_0x20c6cb[_0x83d8('0x2e')]['filter']+'%'};return _0x5b29d9;}})});}_0x5808ed=_['merge']({},_0x5808ed,_0x20c6cb['options']);var _0x38789b={'where':_0x5808ed[_0x83d8('0x3b')]};return db['Sound']['count'](_0x38789b)[_0x83d8('0x22')](function(_0x3afcdc){_0x2c32b8[_0x83d8('0x1b')]=_0x3afcdc;if(_0x20c6cb['query'][_0x83d8('0x3e')]){_0x5808ed['include']=[{'all':!![]}];}return db[_0x83d8('0x3f')]['findAll'](_0x5808ed);})[_0x83d8('0x22')](function(_0x8cbe4e){_0x2c32b8[_0x83d8('0x40')]=_0x8cbe4e;return _0x2c32b8;})[_0x83d8('0x22')](respondWithFilteredResult(_0x5a6c68,_0x5808ed))[_0x83d8('0x41')](handleError(_0x5a6c68,null));};exports[_0x83d8('0x42')]=function(_0x25ffe1,_0x55d5fd){var _0x176701={'raw':!![],'where':{'id':_0x25ffe1[_0x83d8('0x43')]['id']}},_0x377fa0={};_0x377fa0[_0x83d8('0x32')]=_['keys'](db[_0x83d8('0x3f')][_0x83d8('0x2b')]);_0x377fa0[_0x83d8('0x2e')]=_[_0x83d8('0x2f')](_0x25ffe1['query']);_0x377fa0[_0x83d8('0x30')]=_['intersection'](_0x377fa0[_0x83d8('0x32')],_0x377fa0[_0x83d8('0x2e')]);_0x176701[_0x83d8('0x33')]=_[_0x83d8('0x31')](_0x377fa0['model'],qs[_0x83d8('0x34')](_0x25ffe1[_0x83d8('0x2e')][_0x83d8('0x34')]));_0x176701['attributes']=_0x176701[_0x83d8('0x33')][_0x83d8('0x35')]?_0x176701[_0x83d8('0x33')]:_0x377fa0['model'];if(_0x25ffe1[_0x83d8('0x2e')][_0x83d8('0x3e')]){_0x176701[_0x83d8('0x44')]=[{'all':!![]}];}_0x176701=_['merge']({},_0x176701,_0x25ffe1['options']);return db[_0x83d8('0x3f')]['find'](_0x176701)['then'](handleEntityNotFound(_0x55d5fd,null))['then'](respondWithResult(_0x55d5fd,null))[_0x83d8('0x41')](handleError(_0x55d5fd,null));};exports[_0x83d8('0x45')]=function(_0x28f619,_0x4d6e9c,_0xc5b404){return db[_0x83d8('0x3f')]['find']({'where':{'id':_0x28f619[_0x83d8('0x43')]['id']},'attributes':['name',_0x83d8('0x46'),_0x83d8('0x47')],'raw':!![]})[_0x83d8('0x22')](handleEntityNotFound(_0x4d6e9c,null))['then'](function(_0xff2cb2){if(_0xff2cb2){if(!fs['existsSync'](path[_0x83d8('0x48')](config[_0x83d8('0x49')],'server/files/sounds/converted',_0xff2cb2[_0x83d8('0x46')]+'.'+_0xff2cb2[_0x83d8('0x47')]))){throw new db[(_0x83d8('0x4a'))][(_0x83d8('0x4b'))](_0x83d8('0x4c'));}return _0x4d6e9c[_0x83d8('0x45')](path['join'](config[_0x83d8('0x49')],_0x83d8('0x4d'),util[_0x83d8('0x4e')](_0x83d8('0x4f'),_0xff2cb2[_0x83d8('0x46')],_0xff2cb2[_0x83d8('0x47')])),util[_0x83d8('0x4e')](_0x83d8('0x4f'),_0xff2cb2['name'],_0xff2cb2[_0x83d8('0x47')]));}return null;})['catch'](handleError(_0x4d6e9c,null));};exports['create']=function(_0xa36b21,_0x57c24f,_0x4122d6){var _0x442ef4={'name':path[_0x83d8('0x50')](_0xa36b21[_0x83d8('0x51')][_0x83d8('0x52')],path[_0x83d8('0x53')](_0xa36b21[_0x83d8('0x51')][_0x83d8('0x52')])),'save_name':path[_0x83d8('0x50')](_0xa36b21[_0x83d8('0x51')][_0x83d8('0x54')],path[_0x83d8('0x53')](_0xa36b21[_0x83d8('0x51')][_0x83d8('0x54')])),'original_format':path[_0x83d8('0x53')](_0xa36b21[_0x83d8('0x51')][_0x83d8('0x52')])['substring'](0x1),'converted_format':_0x83d8('0x55')};var _0x45da38=path[_0x83d8('0x48')](config[_0x83d8('0x49')],'server/files/sounds/original',_0xa36b21[_0x83d8('0x51')][_0x83d8('0x54')]);var _0x37f0fd=path['join'](config[_0x83d8('0x49')],_0x83d8('0x4d'),util['format'](_0x83d8('0x4f'),path[_0x83d8('0x50')](_0xa36b21[_0x83d8('0x51')][_0x83d8('0x54')],path[_0x83d8('0x53')](_0xa36b21['file'][_0x83d8('0x54')])),_0x442ef4[_0x83d8('0x47')]));logger[_0x83d8('0x56')]('Sound\x20upload\x20filepath:\x20%s',_0x45da38);logger[_0x83d8('0x56')](_0x83d8('0x57'),_0x37f0fd);try{fs[_0x83d8('0x58')](_0x45da38,parseInt(_0x83d8('0x59'),0x8));var _0x2c0874=sox['transcode'](_0x45da38,_0x37f0fd,{'sampleRate':0x1f40,'format':_0x83d8('0x55'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2c0874['on'](_0x83d8('0x26'),function(_0x306131){fs[_0x83d8('0x5a')](_0x45da38);_0x57c24f[_0x83d8('0x1c')](0x1f4)[_0x83d8('0x28')](_0x306131);});_0x2c0874['on']('src',function(_0x58d754){_0x442ef4[_0x83d8('0x5b')]=isNaN(_0x58d754[_0x83d8('0x5c')])?null:_0x58d754[_0x83d8('0x5c')]*0x3e8;_0x442ef4[_0x83d8('0x5d')]=isNaN(_0x58d754[_0x83d8('0x5e')])?null:_0x58d754[_0x83d8('0x5e')];_0x442ef4[_0x83d8('0x5f')]=isNaN(_0x58d754[_0x83d8('0x60')])?null:_0x58d754[_0x83d8('0x60')];_0x442ef4['original_bitRate']=isNaN(_0x58d754[_0x83d8('0x61')])?null:_0x58d754['bitRate'];_0x442ef4[_0x83d8('0x62')]=isNaN(_0x58d754[_0x83d8('0x63')])?null:_0x58d754['sampleRate'];});_0x2c0874['on'](_0x83d8('0x64'),function(_0x1b578e){_0x442ef4[_0x83d8('0x65')]=isNaN(_0x1b578e[_0x83d8('0x5c')])?null:_0x1b578e[_0x83d8('0x5c')]*0x3e8;_0x442ef4[_0x83d8('0x66')]=isNaN(_0x1b578e[_0x83d8('0x5e')])?null:_0x1b578e[_0x83d8('0x5e')];_0x442ef4['converted_channelCount']=isNaN(_0x1b578e['channelCount'])?null:_0x1b578e[_0x83d8('0x60')];_0x442ef4['converted_bitRate']=isNaN(_0x1b578e[_0x83d8('0x61')])?null:_0x1b578e[_0x83d8('0x61')];_0x442ef4['converted_sampleRate']=isNaN(_0x1b578e[_0x83d8('0x63')])?null:_0x1b578e[_0x83d8('0x63')];});_0x2c0874['on']('end',function(){fs['chmodSync'](_0x37f0fd,parseInt(_0x83d8('0x59'),0x8));return db[_0x83d8('0x3f')][_0x83d8('0x67')](_0x442ef4)[_0x83d8('0x22')](function(_0x9cc2ad){var _0x540c47={'role':_0xa36b21['body']['role'],'userProfileId':_0xa36b21[_0x83d8('0x68')][_0x83d8('0x69')]};if(!_0x540c47)throw new Error(_0x83d8('0x6a'));if(_0x540c47[_0x83d8('0x6b')]==='user'){var _0x34bab9=_0x9cc2ad['get']({'plain':!![]});return db[_0x83d8('0x6c')]['find']({'where':{'name':'Sounds','userProfileId':_0x540c47[_0x83d8('0x69')]},'raw':!![]})[_0x83d8('0x22')](function(_0x225cb9){if(_0x225cb9&&_0x225cb9[_0x83d8('0x6d')]===0x0){return db[_0x83d8('0x24')]['create']({'name':_0x34bab9[_0x83d8('0x27')],'resourceId':_0x34bab9['id'],'type':_0x225cb9[_0x83d8('0x27')],'sectionId':_0x225cb9['id']},{})[_0x83d8('0x22')](function(){return _0x9cc2ad;});}else{return _0x9cc2ad;}})[_0x83d8('0x41')](function(_0x3c512d){logger[_0x83d8('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c512d);throw _0x3c512d;});}return _0x9cc2ad;})[_0x83d8('0x22')](respondWithResult(_0x57c24f,null))['catch'](handleError(_0x57c24f,null));});_0x2c0874[_0x83d8('0x6e')]();}catch(_0x3fc938){_0x57c24f[_0x83d8('0x1c')](0x1f4)[_0x83d8('0x28')](_0x3fc938);}};exports[_0x83d8('0x6f')]=function(_0x25b260,_0xa6fa95,_0x30c144){return db[_0x83d8('0x3f')]['find']({'where':{'id':_0x25b260['params']['id']}})[_0x83d8('0x22')](handleEntityNotFound(_0xa6fa95,null))[_0x83d8('0x22')](saveUpdates(_[_0x83d8('0x39')](_0x25b260[_0x83d8('0x68')],['name',_0x83d8('0x70')]),null))['then'](respondWithResult(_0xa6fa95,null))['catch'](handleError(_0xa6fa95,null));};exports[_0x83d8('0x71')]=function(_0x3e4db5,_0x58a18f,_0x4a6ce3){return db[_0x83d8('0x3f')][_0x83d8('0x72')]({'where':{'id':_0x3e4db5[_0x83d8('0x43')]['id']}})['then'](function(_0x4c3071){if(_0x4c3071){return _0x4c3071[_0x83d8('0x25')]();}})[_0x83d8('0x22')](function(_0x1aeaf9){var _0x2a4125=path['join'](config[_0x83d8('0x49')],'server/files/sounds/original',util['format']('%s.%s',_0x1aeaf9[_0x83d8('0x46')],_0x1aeaf9[_0x83d8('0x73')]));var _0x227052=path[_0x83d8('0x48')](config[_0x83d8('0x49')],_0x83d8('0x4d'),util[_0x83d8('0x4e')]('%s.%s',_0x1aeaf9[_0x83d8('0x46')],_0x1aeaf9[_0x83d8('0x47')]));fs[_0x83d8('0x5a')](_0x2a4125);fs['unlinkSync'](_0x227052);return _0x1aeaf9;})['then'](function(_0xde742b){if(_0xde742b){return _0x58a18f[_0x83d8('0x1c')](0xcc)[_0x83d8('0x17')]();}})['then'](handleEntityNotFound(_0x58a18f,null))[_0x83d8('0x41')](handleError(_0x58a18f,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index e74d63a..f992dc4 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 _0x8558=['api','bluebird','request-promise','rimraf','../../config/environment','exports','Sound','tools_sounds','lodash','util','../../config/logger'];(function(_0x5f0f7a,_0x244c53){var _0x8742e7=function(_0x48ff6e){while(--_0x48ff6e){_0x5f0f7a['push'](_0x5f0f7a['shift']());}};_0x8742e7(++_0x244c53);}(_0x8558,0x110));var _0x8855=function(_0x46da05,_0x197480){_0x46da05=_0x46da05-0x0;var _0x2333f4=_0x8558[_0x46da05];return _0x2333f4;};'use strict';var _=require(_0x8855('0x0'));var util=require(_0x8855('0x1'));var logger=require(_0x8855('0x2'))(_0x8855('0x3'));var moment=require('moment');var BPromise=require(_0x8855('0x4'));var rp=require(_0x8855('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8855('0x6'));var config=require(_0x8855('0x7'));var attributes=require('./sound.attributes');module[_0x8855('0x8')]=function(_0x257f97,_0x249dac){return _0x257f97['define'](_0x8855('0x9'),attributes,{'tableName':_0x8855('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x777e=['define','Sound','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./sound.attributes','exports'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x777e,0x7a));var _0xe777=function(_0x50e67a,_0x1784b8){_0x50e67a=_0x50e67a-0x0;var _0x34ff8d=_0x777e[_0x50e67a];return _0x34ff8d;};'use strict';var _=require(_0xe777('0x0'));var util=require(_0xe777('0x1'));var logger=require(_0xe777('0x2'))(_0xe777('0x3'));var moment=require(_0xe777('0x4'));var BPromise=require(_0xe777('0x5'));var rp=require(_0xe777('0x6'));var fs=require('fs');var path=require(_0xe777('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe777('0x8'));module[_0xe777('0x9')]=function(_0x5d3d6d,_0x280ad5){return _0x5d3d6d[_0xe777('0xa')](_0xe777('0xb'),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 7e7f615..c25b8ae 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 _0xf223=['../../config/utils','rpc','jayson/promise','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSound','Sound','options','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x52e68e,_0x309912){var _0x3211a4=function(_0x467c01){while(--_0x467c01){_0x52e68e['push'](_0x52e68e['shift']());}};_0x3211a4(++_0x309912);}(_0xf223,0x19d));var _0x3f22=function(_0x4446e3,_0x2ae79b){_0x4446e3=_0x4446e3-0x0;var _0x1e8ce6=_0xf223[_0x4446e3];return _0x1e8ce6;};'use strict';var _=require(_0x3f22('0x0'));var util=require(_0x3f22('0x1'));var moment=require(_0x3f22('0x2'));var BPromise=require(_0x3f22('0x3'));var rs=require(_0x3f22('0x4'));var fs=require('fs');var Redis=require(_0x3f22('0x5'));var db=require(_0x3f22('0x6'))['db'];var utils=require(_0x3f22('0x7'));var logger=require('../../config/logger')(_0x3f22('0x8'));var config=require('../../config/environment');var jayson=require(_0x3f22('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x562aea,_0x12b0e9,_0x36ad84){return new BPromise(function(_0x3f546e,_0x1a7481){return client[_0x3f22('0xa')](_0x562aea,_0x36ad84)[_0x3f22('0xb')](function(_0x4f8d7e){logger[_0x3f22('0xc')](_0x3f22('0xd'),_0x12b0e9,_0x3f22('0xe'));logger[_0x3f22('0xf')](_0x3f22('0x10'),_0x12b0e9,_0x3f22('0xe'),JSON[_0x3f22('0x11')](_0x4f8d7e));if(_0x4f8d7e[_0x3f22('0x12')]){if(_0x4f8d7e[_0x3f22('0x12')][_0x3f22('0x13')]===0x1f4){logger[_0x3f22('0x12')]('Sound,\x20%s,\x20%s',_0x12b0e9,_0x4f8d7e['error']['message']);return _0x1a7481(_0x4f8d7e[_0x3f22('0x12')][_0x3f22('0x14')]);}logger['error']('Sound,\x20%s,\x20%s',_0x12b0e9,_0x4f8d7e['error']['message']);return _0x3f546e(_0x4f8d7e[_0x3f22('0x12')]['message']);}else{logger[_0x3f22('0xc')](_0x3f22('0xd'),_0x12b0e9,_0x3f22('0xe'));_0x3f546e(_0x4f8d7e[_0x3f22('0x15')][_0x3f22('0x14')]);}})[_0x3f22('0x16')](function(_0x98b12e){logger[_0x3f22('0x12')](_0x3f22('0xd'),_0x12b0e9,_0x98b12e);_0x1a7481(_0x98b12e);});});}exports[_0x3f22('0x17')]=function(_0x218e7f){var _0x1f2f94=this;return new Promise(function(_0x5ec6fc,_0x5859a9){return db[_0x3f22('0x18')]['find']({'raw':_0x218e7f[_0x3f22('0x19')]?_0x218e7f['options']['raw']===undefined?!![]:![]:!![],'where':_0x218e7f[_0x3f22('0x19')]?_0x218e7f['options']['where']||null:null,'attributes':_0x218e7f[_0x3f22('0x19')]?_0x218e7f[_0x3f22('0x19')][_0x3f22('0x1a')]||null:null,'include':_0x218e7f[_0x3f22('0x19')]?_0x218e7f['options'][_0x3f22('0x1b')]?_[_0x3f22('0x1c')](_0x218e7f[_0x3f22('0x19')][_0x3f22('0x1b')],function(_0x1885dc){return{'model':db[_0x1885dc[_0x3f22('0x1d')]],'as':_0x1885dc['as'],'attributes':_0x1885dc[_0x3f22('0x1a')],'include':_0x1885dc[_0x3f22('0x1b')]?_[_0x3f22('0x1c')](_0x1885dc[_0x3f22('0x1b')],function(_0x4b3800){return{'model':db[_0x4b3800[_0x3f22('0x1d')]],'as':_0x4b3800['as'],'attributes':_0x4b3800[_0x3f22('0x1a')],'include':_0x4b3800[_0x3f22('0x1b')]?_['map'](_0x4b3800[_0x3f22('0x1b')],function(_0x469c26){return{'model':db[_0x469c26['model']],'as':_0x469c26['as'],'attributes':_0x469c26['attributes']};}):[]};}):[]};}):[]:[]})[_0x3f22('0xb')](function(_0x4dff83){logger[_0x3f22('0xc')](_0x3f22('0x17'),_0x218e7f);logger[_0x3f22('0xf')]('ShowSound',_0x218e7f,JSON[_0x3f22('0x11')](_0x4dff83));_0x5ec6fc(_0x4dff83);})['catch'](function(_0x2124a4){logger['error'](_0x3f22('0x17'),_0x2124a4[_0x3f22('0x14')],_0x218e7f);_0x5859a9(_0x1f2f94[_0x3f22('0x12')](0x1f4,_0x2124a4[_0x3f22('0x14')]));});});}; \ No newline at end of file +var _0x8fde=['request\x20sent','stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','ShowSound','Sound','options','raw','where','include','map','attributes','then','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','Sound,\x20%s,\x20%s,\x20%s'];(function(_0x4487aa,_0x8f8f97){var _0x61d320=function(_0x29e376){while(--_0x29e376){_0x4487aa['push'](_0x4487aa['shift']());}};_0x61d320(++_0x8f8f97);}(_0x8fde,0x1be));var _0xe8fd=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x8fde[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require(_0xe8fd('0x0'));var util=require(_0xe8fd('0x1'));var moment=require(_0xe8fd('0x2'));var BPromise=require(_0xe8fd('0x3'));var rs=require(_0xe8fd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe8fd('0x5'));var logger=require(_0xe8fd('0x6'))(_0xe8fd('0x7'));var config=require(_0xe8fd('0x8'));var jayson=require(_0xe8fd('0x9'));var client=jayson[_0xe8fd('0xa')][_0xe8fd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36d3d8,_0x5bdff6,_0x3a7599){return new BPromise(function(_0x3b72c5,_0xaee38a){return client[_0xe8fd('0xc')](_0x36d3d8,_0x3a7599)['then'](function(_0x2ec7a4){logger[_0xe8fd('0xd')]('Sound,\x20%s,\x20%s',_0x5bdff6,'request\x20sent');logger[_0xe8fd('0xe')](_0xe8fd('0xf'),_0x5bdff6,_0xe8fd('0x10'),JSON[_0xe8fd('0x11')](_0x2ec7a4));if(_0x2ec7a4[_0xe8fd('0x12')]){if(_0x2ec7a4[_0xe8fd('0x12')][_0xe8fd('0x13')]===0x1f4){logger['error'](_0xe8fd('0x14'),_0x5bdff6,_0x2ec7a4[_0xe8fd('0x12')][_0xe8fd('0x15')]);return _0xaee38a(_0x2ec7a4[_0xe8fd('0x12')][_0xe8fd('0x15')]);}logger[_0xe8fd('0x12')](_0xe8fd('0x14'),_0x5bdff6,_0x2ec7a4[_0xe8fd('0x12')]['message']);return _0x3b72c5(_0x2ec7a4[_0xe8fd('0x12')][_0xe8fd('0x15')]);}else{logger[_0xe8fd('0xd')](_0xe8fd('0x14'),_0x5bdff6,'request\x20sent');_0x3b72c5(_0x2ec7a4[_0xe8fd('0x16')][_0xe8fd('0x15')]);}})[_0xe8fd('0x17')](function(_0x260c93){logger[_0xe8fd('0x12')](_0xe8fd('0x14'),_0x5bdff6,_0x260c93);_0xaee38a(_0x260c93);});});}exports[_0xe8fd('0x18')]=function(_0x25b695){var _0x3c4e6f=this;return new Promise(function(_0x515758,_0x8f4726){return db[_0xe8fd('0x19')]['find']({'raw':_0x25b695[_0xe8fd('0x1a')]?_0x25b695['options'][_0xe8fd('0x1b')]===undefined?!![]:![]:!![],'where':_0x25b695['options']?_0x25b695[_0xe8fd('0x1a')][_0xe8fd('0x1c')]||null:null,'attributes':_0x25b695[_0xe8fd('0x1a')]?_0x25b695[_0xe8fd('0x1a')]['attributes']||null:null,'include':_0x25b695[_0xe8fd('0x1a')]?_0x25b695['options'][_0xe8fd('0x1d')]?_[_0xe8fd('0x1e')](_0x25b695[_0xe8fd('0x1a')][_0xe8fd('0x1d')],function(_0x19e3d0){return{'model':db[_0x19e3d0['model']],'as':_0x19e3d0['as'],'attributes':_0x19e3d0[_0xe8fd('0x1f')],'include':_0x19e3d0['include']?_[_0xe8fd('0x1e')](_0x19e3d0[_0xe8fd('0x1d')],function(_0x170b42){return{'model':db[_0x170b42['model']],'as':_0x170b42['as'],'attributes':_0x170b42[_0xe8fd('0x1f')],'include':_0x170b42[_0xe8fd('0x1d')]?_['map'](_0x170b42[_0xe8fd('0x1d')],function(_0x2cb4fb){return{'model':db[_0x2cb4fb['model']],'as':_0x2cb4fb['as'],'attributes':_0x2cb4fb[_0xe8fd('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe8fd('0x20')](function(_0x5e1bcb){logger['info'](_0xe8fd('0x18'),_0x25b695);logger['debug']('ShowSound',_0x25b695,JSON['stringify'](_0x5e1bcb));_0x515758(_0x5e1bcb);})['catch'](function(_0x1f2237){logger['error']('ShowSound',_0x1f2237['message'],_0x25b695);_0x8f4726(_0x3c4e6f[_0xe8fd('0x12')](0x1f4,_0x1f2237['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index d5353ca..e62f25f 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 _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x582c98,_0x53b3a0){var _0x593449=function(_0x39834c){while(--_0x39834c){_0x582c98['push'](_0x582c98['shift']());}};_0x593449(++_0x53b3a0);}(_0x2032,0xd9));var _0x2203=function(_0x5c4e27,_0x1e37a3){_0x5c4e27=_0x5c4e27-0x0;var _0x1479b3=_0x2032[_0x5c4e27];return _0x1479b3;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file +var _0x757a=['destroy','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','/:id','update','delete'];(function(_0x21bbbe,_0x253b64){var _0x30db93=function(_0x4c7517){while(--_0x4c7517){_0x21bbbe['push'](_0x21bbbe['shift']());}};_0x30db93(++_0x253b64);}(_0x757a,0xde));var _0xa757=function(_0x5aba0e,_0xb26dae){_0x5aba0e=_0x5aba0e-0x0;var _0x57864e=_0x757a[_0x5aba0e];return _0x57864e;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0xb')]('/',auth[_0xa757('0x9')](),controller[_0xa757('0xc')]);router['put'](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);router[_0xa757('0xf')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index b2401b5..045aad6 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 _0x6266=['STRING','TEXT','medium','ENUM','out','sequelize','exports'];(function(_0x143e87,_0x23d17f){var _0x3f9620=function(_0x1a8594){while(--_0x1a8594){_0x143e87['push'](_0x143e87['shift']());}};_0x3f9620(++_0x23d17f);}(_0x6266,0x9f));var _0x6626=function(_0x22674f,_0x3f5a25){_0x22674f=_0x22674f-0x0;var _0x17532a=_0x6266[_0x22674f];return _0x17532a;};'use strict';var Sequelize=require(_0x6626('0x0'));module[_0x6626('0x1')]={'uniqueid':{'type':Sequelize[_0x6626('0x2')]},'body':{'type':Sequelize[_0x6626('0x3')](_0x6626('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x6626('0x5')]('in',_0x6626('0x6')),'defaultValue':_0x6626('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x6626('0x2')]},'providerResponse':{'type':Sequelize[_0x6626('0x3')]}}; \ No newline at end of file +var _0xb2d0=['TEXT','ENUM','out','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb2d0,0x134));var _0x0b2d=function(_0x411c4a,_0x1769a5){_0x411c4a=_0x411c4a-0x0;var _0xdca442=_0xb2d0[_0x411c4a];return _0xdca442;};'use strict';var Sequelize=require('sequelize');module[_0x0b2d('0x0')]={'uniqueid':{'type':Sequelize[_0x0b2d('0x1')]},'body':{'type':Sequelize[_0x0b2d('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x0b2d('0x3')]('in',_0x0b2d('0x4')),'defaultValue':_0x0b2d('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x0b2d('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index cdf3c2d..6cca335 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 _0xa3b9=['name','send','index','map','SquareMessage','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','rawAttributes','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x3b2e0a,_0x49a3f9){var _0x4a84bd=function(_0x3aa487){while(--_0x3aa487){_0x3b2e0a['push'](_0x3b2e0a['shift']());}};_0x4a84bd(++_0x49a3f9);}(_0xa3b9,0x6b));var _0x9a3b=function(_0x92b376,_0x5d5826){_0x92b376=_0x92b376-0x0;var _0x23b700=_0xa3b9[_0x92b376];return _0x23b700;};'use strict';var emlformat=require(_0x9a3b('0x0'));var rimraf=require(_0x9a3b('0x1'));var zipdir=require(_0x9a3b('0x2'));var jsonpatch=require(_0x9a3b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9a3b('0x4'));var Mustache=require(_0x9a3b('0x5'));var util=require(_0x9a3b('0x6'));var path=require(_0x9a3b('0x7'));var sox=require('sox');var csv=require(_0x9a3b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9a3b('0x9'));var _=require(_0x9a3b('0xa'));var squel=require(_0x9a3b('0xb'));var crypto=require(_0x9a3b('0xc'));var jsforce=require(_0x9a3b('0xd'));var deskjs=require(_0x9a3b('0xe'));var toCsv=require(_0x9a3b('0x8'));var querystring=require(_0x9a3b('0xf'));var Papa=require(_0x9a3b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9a3b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a3b('0x12'));var logger=require('../../config/logger')(_0x9a3b('0x13'));var utils=require('../../config/utils');var config=require(_0x9a3b('0x14'));var licenseUtil=require(_0x9a3b('0x15'));var db=require(_0x9a3b('0x16'))['db'];function respondWithStatusCode(_0x1450ff,_0x42aa98){_0x42aa98=_0x42aa98||0xcc;return function(_0x4d2c82){if(_0x4d2c82){return _0x1450ff['sendStatus'](_0x42aa98);}return _0x1450ff[_0x9a3b('0x17')](_0x42aa98)[_0x9a3b('0x18')]();};}function respondWithResult(_0x375f69,_0x35387c){_0x35387c=_0x35387c||0xc8;return function(_0x3524cd){if(_0x3524cd){return _0x375f69[_0x9a3b('0x17')](_0x35387c)[_0x9a3b('0x19')](_0x3524cd);}};}function respondWithFilteredResult(_0x94de05,_0x114819){return function(_0x5ab393){if(_0x5ab393){var _0x21b399=typeof _0x114819[_0x9a3b('0x1a')]===_0x9a3b('0x1b')&&typeof _0x114819[_0x9a3b('0x1c')]===_0x9a3b('0x1b');var _0xaba387=_0x5ab393[_0x9a3b('0x1d')];var _0x27f393=_0x21b399?0x0:_0x114819[_0x9a3b('0x1a')];var _0x94426c=_0x21b399?_0x5ab393[_0x9a3b('0x1d')]:_0x114819[_0x9a3b('0x1a')]+_0x114819[_0x9a3b('0x1c')];var _0x5ace77;if(_0x94426c>=_0xaba387){_0x94426c=_0xaba387;_0x5ace77=0xc8;}else{_0x5ace77=0xce;}_0x94de05[_0x9a3b('0x17')](_0x5ace77);return _0x94de05['set'](_0x9a3b('0x1e'),_0x27f393+'-'+_0x94426c+'/'+_0xaba387)[_0x9a3b('0x19')](_0x5ab393);}return null;};}function patchUpdates(_0xdafdc8){return function(_0x3bf87e){try{jsonpatch[_0x9a3b('0x1f')](_0x3bf87e,_0xdafdc8,!![]);}catch(_0x25f749){return BPromise[_0x9a3b('0x20')](_0x25f749);}return _0x3bf87e[_0x9a3b('0x21')]();};}function saveUpdates(_0x3ef434,_0x2aa973){return function(_0x5c296b){if(_0x5c296b){return _0x5c296b[_0x9a3b('0x22')](_0x3ef434)[_0x9a3b('0x23')](function(_0x3d3352){return _0x3d3352;});}return null;};}function removeEntity(_0x2da536,_0x2ef869){return function(_0x4abf5f){if(_0x4abf5f){return _0x4abf5f[_0x9a3b('0x24')]()[_0x9a3b('0x23')](function(){_0x2da536[_0x9a3b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xdd0e19,_0x4c3492){return function(_0x24aadd){if(!_0x24aadd){_0xdd0e19['sendStatus'](0x194);}return _0x24aadd;};}function handleError(_0x57d3c5,_0x38830d){_0x38830d=_0x38830d||0x1f4;return function(_0x5ccb42){logger[_0x9a3b('0x25')](_0x5ccb42[_0x9a3b('0x26')]);if(_0x5ccb42[_0x9a3b('0x27')]){delete _0x5ccb42[_0x9a3b('0x27')];}_0x57d3c5[_0x9a3b('0x17')](_0x38830d)[_0x9a3b('0x28')](_0x5ccb42);};}exports[_0x9a3b('0x29')]=function(_0x168728,_0x20a458){var _0x3c2aa8={},_0x2b7ca1={},_0x5c70d5={'count':0x0,'rows':[]};var _0x1dc5e6=_[_0x9a3b('0x2a')](db[_0x9a3b('0x2b')]['rawAttributes'],function(_0x5b5f73){return{'name':_0x5b5f73[_0x9a3b('0x2c')],'type':_0x5b5f73[_0x9a3b('0x2d')][_0x9a3b('0x2e')]};});_0x2b7ca1[_0x9a3b('0x2f')]=_[_0x9a3b('0x2a')](_0x1dc5e6,_0x9a3b('0x27'));_0x2b7ca1[_0x9a3b('0x30')]=_[_0x9a3b('0x31')](_0x168728[_0x9a3b('0x30')]);_0x2b7ca1['filters']=_[_0x9a3b('0x32')](_0x2b7ca1[_0x9a3b('0x2f')],_0x2b7ca1[_0x9a3b('0x30')]);_0x3c2aa8[_0x9a3b('0x33')]=_[_0x9a3b('0x32')](_0x2b7ca1[_0x9a3b('0x2f')],qs[_0x9a3b('0x34')](_0x168728[_0x9a3b('0x30')][_0x9a3b('0x34')]));_0x3c2aa8[_0x9a3b('0x33')]=_0x3c2aa8[_0x9a3b('0x33')]['length']?_0x3c2aa8[_0x9a3b('0x33')]:_0x2b7ca1[_0x9a3b('0x2f')];if(!_0x168728[_0x9a3b('0x30')]['hasOwnProperty'](_0x9a3b('0x35'))){_0x3c2aa8[_0x9a3b('0x1c')]=qs['limit'](_0x168728['query'][_0x9a3b('0x1c')]);_0x3c2aa8[_0x9a3b('0x1a')]=qs[_0x9a3b('0x1a')](_0x168728['query'][_0x9a3b('0x1a')]);}_0x3c2aa8['order']=qs[_0x9a3b('0x36')](_0x168728['query'][_0x9a3b('0x36')]);_0x3c2aa8[_0x9a3b('0x37')]=qs[_0x9a3b('0x38')](_[_0x9a3b('0x39')](_0x168728[_0x9a3b('0x30')],_0x2b7ca1['filters']),_0x1dc5e6);if(_0x168728[_0x9a3b('0x30')][_0x9a3b('0x3a')]){_0x3c2aa8['where']=_['merge'](_0x3c2aa8[_0x9a3b('0x37')],{'$or':_[_0x9a3b('0x2a')](_0x1dc5e6,function(_0x5df585){if(_0x5df585[_0x9a3b('0x2d')]!==_0x9a3b('0x3b')){var _0x56f894={};_0x56f894[_0x5df585[_0x9a3b('0x27')]]={'$like':'%'+_0x168728[_0x9a3b('0x30')]['filter']+'%'};return _0x56f894;}})});}_0x3c2aa8=_[_0x9a3b('0x3c')]({},_0x3c2aa8,_0x168728[_0x9a3b('0x3d')]);var _0x55cf32={'where':_0x3c2aa8['where']};return db['SquareMessage'][_0x9a3b('0x1d')](_0x55cf32)[_0x9a3b('0x23')](function(_0x51370c){_0x5c70d5[_0x9a3b('0x1d')]=_0x51370c;if(_0x168728['query'][_0x9a3b('0x3e')]){_0x3c2aa8[_0x9a3b('0x3f')]=[{'all':!![]}];}return db[_0x9a3b('0x2b')]['findAll'](_0x3c2aa8);})[_0x9a3b('0x23')](function(_0x2f07f3){_0x5c70d5[_0x9a3b('0x40')]=_0x2f07f3;return _0x5c70d5;})[_0x9a3b('0x23')](respondWithFilteredResult(_0x20a458,_0x3c2aa8))['catch'](handleError(_0x20a458,null));};exports[_0x9a3b('0x41')]=function(_0x5b64fb,_0x37ba91){var _0x327d51={'raw':!![],'where':{'id':_0x5b64fb[_0x9a3b('0x42')]['id']}},_0x1443b4={};_0x1443b4[_0x9a3b('0x2f')]=_[_0x9a3b('0x31')](db[_0x9a3b('0x2b')][_0x9a3b('0x43')]);_0x1443b4[_0x9a3b('0x30')]=_[_0x9a3b('0x31')](_0x5b64fb[_0x9a3b('0x30')]);_0x1443b4[_0x9a3b('0x38')]=_[_0x9a3b('0x32')](_0x1443b4['model'],_0x1443b4[_0x9a3b('0x30')]);_0x327d51[_0x9a3b('0x33')]=_[_0x9a3b('0x32')](_0x1443b4[_0x9a3b('0x2f')],qs['fields'](_0x5b64fb[_0x9a3b('0x30')][_0x9a3b('0x34')]));_0x327d51[_0x9a3b('0x33')]=_0x327d51['attributes'][_0x9a3b('0x44')]?_0x327d51[_0x9a3b('0x33')]:_0x1443b4[_0x9a3b('0x2f')];if(_0x5b64fb['query'][_0x9a3b('0x3e')]){_0x327d51[_0x9a3b('0x3f')]=[{'all':!![]}];}_0x327d51=_[_0x9a3b('0x3c')]({},_0x327d51,_0x5b64fb[_0x9a3b('0x3d')]);return db[_0x9a3b('0x2b')][_0x9a3b('0x45')](_0x327d51)[_0x9a3b('0x23')](handleEntityNotFound(_0x37ba91,null))[_0x9a3b('0x23')](respondWithResult(_0x37ba91,null))[_0x9a3b('0x46')](handleError(_0x37ba91,null));};exports[_0x9a3b('0x47')]=function(_0x5e8ffb,_0x3703a1){return db[_0x9a3b('0x2b')]['create'](_0x5e8ffb['body'],{})[_0x9a3b('0x23')](respondWithResult(_0x3703a1,0xc9))[_0x9a3b('0x46')](handleError(_0x3703a1,null));};exports['update']=function(_0x5d7d89,_0xf47d60){if(_0x5d7d89[_0x9a3b('0x48')]['id']){delete _0x5d7d89[_0x9a3b('0x48')]['id'];}return db[_0x9a3b('0x2b')][_0x9a3b('0x45')]({'where':{'id':_0x5d7d89[_0x9a3b('0x42')]['id']}})[_0x9a3b('0x23')](handleEntityNotFound(_0xf47d60,null))[_0x9a3b('0x23')](saveUpdates(_0x5d7d89['body'],null))[_0x9a3b('0x23')](respondWithResult(_0xf47d60,null))['catch'](handleError(_0xf47d60,null));};exports[_0x9a3b('0x24')]=function(_0xff5fa9,_0x15a908){return db[_0x9a3b('0x2b')][_0x9a3b('0x45')]({'where':{'id':_0xff5fa9[_0x9a3b('0x42')]['id']}})['then'](handleEntityNotFound(_0x15a908,null))['then'](removeEntity(_0x15a908,null))[_0x9a3b('0x46')](handleError(_0x15a908,null));}; \ No newline at end of file +var _0xe2bb=['count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','SquareMessage','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','includeAll','find','create','body','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset'];(function(_0x45f4e9,_0x5246fd){var _0x559d8f=function(_0x591e11){while(--_0x591e11){_0x45f4e9['push'](_0x45f4e9['shift']());}};_0x559d8f(++_0x5246fd);}(_0xe2bb,0x76));var _0xbe2b=function(_0x420791,_0x595f73){_0x420791=_0x420791-0x0;var _0xd471bf=_0xe2bb[_0x420791];return _0xd471bf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbe2b('0x0'));var moment=require(_0xbe2b('0x1'));var BPromise=require(_0xbe2b('0x2'));var Mustache=require(_0xbe2b('0x3'));var util=require(_0xbe2b('0x4'));var path=require(_0xbe2b('0x5'));var sox=require(_0xbe2b('0x6'));var csv=require(_0xbe2b('0x7'));var ejs=require(_0xbe2b('0x8'));var fs=require('fs');var fs_extra=require(_0xbe2b('0x9'));var _=require(_0xbe2b('0xa'));var squel=require(_0xbe2b('0xb'));var crypto=require('crypto');var jsforce=require(_0xbe2b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbe2b('0x7'));var querystring=require(_0xbe2b('0xd'));var Papa=require('papaparse');var Redis=require(_0xbe2b('0xe'));var authService=require(_0xbe2b('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe2b('0x10'));var logger=require(_0xbe2b('0x11'))(_0xbe2b('0x12'));var utils=require(_0xbe2b('0x13'));var config=require(_0xbe2b('0x14'));var licenseUtil=require(_0xbe2b('0x15'));var db=require(_0xbe2b('0x16'))['db'];function respondWithStatusCode(_0x3a85fb,_0x1c0ca3){_0x1c0ca3=_0x1c0ca3||0xcc;return function(_0x1d8aca){if(_0x1d8aca){return _0x3a85fb[_0xbe2b('0x17')](_0x1c0ca3);}return _0x3a85fb[_0xbe2b('0x18')](_0x1c0ca3)[_0xbe2b('0x19')]();};}function respondWithResult(_0xb4b88d,_0x2b2c5a){_0x2b2c5a=_0x2b2c5a||0xc8;return function(_0xee5a87){if(_0xee5a87){return _0xb4b88d['status'](_0x2b2c5a)[_0xbe2b('0x1a')](_0xee5a87);}};}function respondWithFilteredResult(_0x438db7,_0x511e08){return function(_0x56c08b){if(_0x56c08b){var _0x4c76af=typeof _0x511e08['offset']===_0xbe2b('0x1b')&&typeof _0x511e08[_0xbe2b('0x1c')]===_0xbe2b('0x1b');var _0x3a9382=_0x56c08b['count'];var _0x11b82d=_0x4c76af?0x0:_0x511e08[_0xbe2b('0x1d')];var _0x25c992=_0x4c76af?_0x56c08b[_0xbe2b('0x1e')]:_0x511e08[_0xbe2b('0x1d')]+_0x511e08[_0xbe2b('0x1c')];var _0x3c54f7;if(_0x25c992>=_0x3a9382){_0x25c992=_0x3a9382;_0x3c54f7=0xc8;}else{_0x3c54f7=0xce;}_0x438db7[_0xbe2b('0x18')](_0x3c54f7);return _0x438db7[_0xbe2b('0x1f')](_0xbe2b('0x20'),_0x11b82d+'-'+_0x25c992+'/'+_0x3a9382)[_0xbe2b('0x1a')](_0x56c08b);}return null;};}function patchUpdates(_0x309edd){return function(_0x4e305a){try{jsonpatch['apply'](_0x4e305a,_0x309edd,!![]);}catch(_0x234108){return BPromise[_0xbe2b('0x21')](_0x234108);}return _0x4e305a[_0xbe2b('0x22')]();};}function saveUpdates(_0x4135bc,_0x4f5d4b){return function(_0x397111){if(_0x397111){return _0x397111[_0xbe2b('0x23')](_0x4135bc)[_0xbe2b('0x24')](function(_0x12772f){return _0x12772f;});}return null;};}function removeEntity(_0x1dcd5d,_0x4b96ec){return function(_0x1145bd){if(_0x1145bd){return _0x1145bd[_0xbe2b('0x25')]()[_0xbe2b('0x24')](function(){_0x1dcd5d[_0xbe2b('0x18')](0xcc)[_0xbe2b('0x19')]();});}};}function handleEntityNotFound(_0x2e2541,_0x3f03b0){return function(_0x368d99){if(!_0x368d99){_0x2e2541[_0xbe2b('0x17')](0x194);}return _0x368d99;};}function handleError(_0x1627d0,_0x4d850e){_0x4d850e=_0x4d850e||0x1f4;return function(_0x2255eb){logger[_0xbe2b('0x26')](_0x2255eb[_0xbe2b('0x27')]);if(_0x2255eb['name']){delete _0x2255eb[_0xbe2b('0x28')];}_0x1627d0[_0xbe2b('0x18')](_0x4d850e)[_0xbe2b('0x29')](_0x2255eb);};}exports[_0xbe2b('0x2a')]=function(_0x6f50d5,_0x55a41a){var _0x53f44a={},_0x1d2fda={},_0x2a326b={'count':0x0,'rows':[]};var _0x165a3a=_['map'](db[_0xbe2b('0x2b')][_0xbe2b('0x2c')],function(_0x576bc9){return{'name':_0x576bc9['fieldName'],'type':_0x576bc9[_0xbe2b('0x2d')][_0xbe2b('0x2e')]};});_0x1d2fda[_0xbe2b('0x2f')]=_[_0xbe2b('0x30')](_0x165a3a,'name');_0x1d2fda['query']=_['keys'](_0x6f50d5[_0xbe2b('0x31')]);_0x1d2fda['filters']=_[_0xbe2b('0x32')](_0x1d2fda[_0xbe2b('0x2f')],_0x1d2fda[_0xbe2b('0x31')]);_0x53f44a[_0xbe2b('0x33')]=_[_0xbe2b('0x32')](_0x1d2fda[_0xbe2b('0x2f')],qs[_0xbe2b('0x34')](_0x6f50d5['query'][_0xbe2b('0x34')]));_0x53f44a[_0xbe2b('0x33')]=_0x53f44a[_0xbe2b('0x33')][_0xbe2b('0x35')]?_0x53f44a['attributes']:_0x1d2fda[_0xbe2b('0x2f')];if(!_0x6f50d5['query'][_0xbe2b('0x36')](_0xbe2b('0x37'))){_0x53f44a['limit']=qs[_0xbe2b('0x1c')](_0x6f50d5[_0xbe2b('0x31')][_0xbe2b('0x1c')]);_0x53f44a[_0xbe2b('0x1d')]=qs[_0xbe2b('0x1d')](_0x6f50d5[_0xbe2b('0x31')][_0xbe2b('0x1d')]);}_0x53f44a[_0xbe2b('0x38')]=qs[_0xbe2b('0x39')](_0x6f50d5[_0xbe2b('0x31')][_0xbe2b('0x39')]);_0x53f44a['where']=qs[_0xbe2b('0x3a')](_['pick'](_0x6f50d5[_0xbe2b('0x31')],_0x1d2fda[_0xbe2b('0x3a')]),_0x165a3a);if(_0x6f50d5['query'][_0xbe2b('0x3b')]){_0x53f44a[_0xbe2b('0x3c')]=_[_0xbe2b('0x3d')](_0x53f44a[_0xbe2b('0x3c')],{'$or':_[_0xbe2b('0x30')](_0x165a3a,function(_0xa5477){if(_0xa5477['type']!==_0xbe2b('0x3e')){var _0x2d1007={};_0x2d1007[_0xa5477['name']]={'$like':'%'+_0x6f50d5[_0xbe2b('0x31')]['filter']+'%'};return _0x2d1007;}})});}_0x53f44a=_[_0xbe2b('0x3d')]({},_0x53f44a,_0x6f50d5[_0xbe2b('0x3f')]);var _0x4146e1={'where':_0x53f44a[_0xbe2b('0x3c')]};return db[_0xbe2b('0x2b')][_0xbe2b('0x1e')](_0x4146e1)[_0xbe2b('0x24')](function(_0x267398){_0x2a326b[_0xbe2b('0x1e')]=_0x267398;if(_0x6f50d5['query']['includeAll']){_0x53f44a[_0xbe2b('0x40')]=[{'all':!![]}];}return db[_0xbe2b('0x2b')][_0xbe2b('0x41')](_0x53f44a);})[_0xbe2b('0x24')](function(_0x6bda03){_0x2a326b[_0xbe2b('0x42')]=_0x6bda03;return _0x2a326b;})[_0xbe2b('0x24')](respondWithFilteredResult(_0x55a41a,_0x53f44a))[_0xbe2b('0x43')](handleError(_0x55a41a,null));};exports['show']=function(_0x56ccab,_0x1c3df2){var _0x4b5831={'raw':!![],'where':{'id':_0x56ccab[_0xbe2b('0x44')]['id']}},_0x5d615e={};_0x5d615e[_0xbe2b('0x2f')]=_[_0xbe2b('0x45')](db[_0xbe2b('0x2b')]['rawAttributes']);_0x5d615e['query']=_[_0xbe2b('0x45')](_0x56ccab[_0xbe2b('0x31')]);_0x5d615e[_0xbe2b('0x3a')]=_[_0xbe2b('0x32')](_0x5d615e[_0xbe2b('0x2f')],_0x5d615e[_0xbe2b('0x31')]);_0x4b5831['attributes']=_[_0xbe2b('0x32')](_0x5d615e['model'],qs[_0xbe2b('0x34')](_0x56ccab['query']['fields']));_0x4b5831[_0xbe2b('0x33')]=_0x4b5831[_0xbe2b('0x33')][_0xbe2b('0x35')]?_0x4b5831[_0xbe2b('0x33')]:_0x5d615e['model'];if(_0x56ccab[_0xbe2b('0x31')][_0xbe2b('0x46')]){_0x4b5831[_0xbe2b('0x40')]=[{'all':!![]}];}_0x4b5831=_[_0xbe2b('0x3d')]({},_0x4b5831,_0x56ccab['options']);return db[_0xbe2b('0x2b')][_0xbe2b('0x47')](_0x4b5831)[_0xbe2b('0x24')](handleEntityNotFound(_0x1c3df2,null))[_0xbe2b('0x24')](respondWithResult(_0x1c3df2,null))[_0xbe2b('0x43')](handleError(_0x1c3df2,null));};exports[_0xbe2b('0x48')]=function(_0x5591b0,_0x5b3b6c){return db[_0xbe2b('0x2b')][_0xbe2b('0x48')](_0x5591b0[_0xbe2b('0x49')],{})[_0xbe2b('0x24')](respondWithResult(_0x5b3b6c,0xc9))['catch'](handleError(_0x5b3b6c,null));};exports[_0xbe2b('0x23')]=function(_0x5038a3,_0x4c1817){if(_0x5038a3[_0xbe2b('0x49')]['id']){delete _0x5038a3['body']['id'];}return db[_0xbe2b('0x2b')][_0xbe2b('0x47')]({'where':{'id':_0x5038a3['params']['id']}})['then'](handleEntityNotFound(_0x4c1817,null))[_0xbe2b('0x24')](saveUpdates(_0x5038a3[_0xbe2b('0x49')],null))[_0xbe2b('0x24')](respondWithResult(_0x4c1817,null))[_0xbe2b('0x43')](handleError(_0x4c1817,null));};exports[_0xbe2b('0x25')]=function(_0x27b12a,_0x1e3fa4){return db[_0xbe2b('0x2b')][_0xbe2b('0x47')]({'where':{'id':_0x27b12a['params']['id']}})[_0xbe2b('0x24')](handleEntityNotFound(_0x1e3fa4,null))['then'](removeEntity(_0x1e3fa4,null))[_0xbe2b('0x43')](handleError(_0x1e3fa4,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index f8f7f04..100d70d 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 _0x4b8b=['square_messages','lodash','moment','bluebird','request-promise','./squareMessage.attributes','exports'];(function(_0x149a9b,_0x5bb275){var _0x2c2bf6=function(_0xfe0c14){while(--_0xfe0c14){_0x149a9b['push'](_0x149a9b['shift']());}};_0x2c2bf6(++_0x5bb275);}(_0x4b8b,0x14a));var _0xb4b8=function(_0x5ea51f,_0x1e3a5b){_0x5ea51f=_0x5ea51f-0x0;var _0x28f6ab=_0x4b8b[_0x5ea51f];return _0x28f6ab;};'use strict';var _=require(_0xb4b8('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb4b8('0x1'));var BPromise=require(_0xb4b8('0x2'));var rp=require(_0xb4b8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb4b8('0x4'));module[_0xb4b8('0x5')]=function(_0x53a076,_0x5a4669){return _0x53a076['define']('SquareMessage',attributes,{'tableName':_0xb4b8('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53e0=['moment','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','../../config/logger','api'];(function(_0x390163,_0x3263d8){var _0x1b8c45=function(_0x2bf5ea){while(--_0x2bf5ea){_0x390163['push'](_0x390163['shift']());}};_0x1b8c45(++_0x3263d8);}(_0x53e0,0x169));var _0x053e=function(_0x4314c9,_0x1a6d36){_0x4314c9=_0x4314c9-0x0;var _0x1f8798=_0x53e0[_0x4314c9];return _0x1f8798;};'use strict';var _=require(_0x053e('0x0'));var util=require('util');var logger=require(_0x053e('0x1'))(_0x053e('0x2'));var moment=require(_0x053e('0x3'));var BPromise=require('bluebird');var rp=require(_0x053e('0x4'));var fs=require('fs');var path=require(_0x053e('0x5'));var rimraf=require(_0x053e('0x6'));var config=require(_0x053e('0x7'));var attributes=require(_0x053e('0x8'));module[_0x053e('0x9')]=function(_0x283813,_0x497438){return _0x283813[_0x053e('0xa')](_0x053e('0xb'),attributes,{'tableName':_0x053e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 700be63..08e9b48 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 _0xb8e3=['client','http','request','then','info','request\x20sent','error','code','SquareMessage,\x20%s,\x20%s','message','result','catch','CreateSquareMessage','create','body','options','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xb8e3,0x1d1));var _0x3b8e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb8e3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b8e('0x0'));var util=require(_0x3b8e('0x1'));var moment=require(_0x3b8e('0x2'));var BPromise=require(_0x3b8e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b8e('0x4'));var db=require(_0x3b8e('0x5'))['db'];var utils=require(_0x3b8e('0x6'));var logger=require(_0x3b8e('0x7'))(_0x3b8e('0x8'));var config=require(_0x3b8e('0x9'));var jayson=require(_0x3b8e('0xa'));var client=jayson[_0x3b8e('0xb')][_0x3b8e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x16c5ce,_0x59b2e8,_0x2ce7d6){return new BPromise(function(_0x2f41ac,_0x6e5430){return client[_0x3b8e('0xd')](_0x16c5ce,_0x2ce7d6)[_0x3b8e('0xe')](function(_0x4a04ad){logger[_0x3b8e('0xf')]('SquareMessage,\x20%s,\x20%s',_0x59b2e8,_0x3b8e('0x10'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x59b2e8,_0x3b8e('0x10'),JSON['stringify'](_0x4a04ad));if(_0x4a04ad[_0x3b8e('0x11')]){if(_0x4a04ad[_0x3b8e('0x11')][_0x3b8e('0x12')]===0x1f4){logger[_0x3b8e('0x11')](_0x3b8e('0x13'),_0x59b2e8,_0x4a04ad['error'][_0x3b8e('0x14')]);return _0x6e5430(_0x4a04ad[_0x3b8e('0x11')][_0x3b8e('0x14')]);}logger[_0x3b8e('0x11')]('SquareMessage,\x20%s,\x20%s',_0x59b2e8,_0x4a04ad['error']['message']);return _0x2f41ac(_0x4a04ad[_0x3b8e('0x11')][_0x3b8e('0x14')]);}else{logger[_0x3b8e('0xf')](_0x3b8e('0x13'),_0x59b2e8,_0x3b8e('0x10'));_0x2f41ac(_0x4a04ad[_0x3b8e('0x15')][_0x3b8e('0x14')]);}})[_0x3b8e('0x16')](function(_0x3134a6){logger['error'](_0x3b8e('0x13'),_0x59b2e8,_0x3134a6);_0x6e5430(_0x3134a6);});});}exports[_0x3b8e('0x17')]=function(_0x2b7a58){var _0x2e1e6e=this;return new Promise(function(_0x32fe95,_0x2b5401){return db['SquareMessage'][_0x3b8e('0x18')](_0x2b7a58[_0x3b8e('0x19')],{'raw':_0x2b7a58[_0x3b8e('0x1a')]?_0x2b7a58[_0x3b8e('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x3b8e('0xe')](function(_0x42a7ad){logger['info'](_0x3b8e('0x17'),_0x2b7a58);logger[_0x3b8e('0x1b')](_0x3b8e('0x17'),_0x2b7a58,JSON['stringify'](_0x42a7ad));_0x32fe95(_0x42a7ad);})[_0x3b8e('0x16')](function(_0x4a356e){logger['error']('CreateSquareMessage',_0x4a356e[_0x3b8e('0x14')],_0x2b7a58);_0x2b5401(_0x2e1e6e['error'](0x1f4,_0x4a356e[_0x3b8e('0x14')]));});});}; \ No newline at end of file +var _0x76d6=['stringify','error','message','result','catch','CreateSquareMessage','create','body','options','raw','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s'];(function(_0x590189,_0x3b230b){var _0x2bf78b=function(_0x3145c3){while(--_0x3145c3){_0x590189['push'](_0x590189['shift']());}};_0x2bf78b(++_0x3b230b);}(_0x76d6,0x1d5));var _0x676d=function(_0x111adb,_0x391e64){_0x111adb=_0x111adb-0x0;var _0x145dfb=_0x76d6[_0x111adb];return _0x145dfb;};'use strict';var _=require('lodash');var util=require(_0x676d('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x676d('0x1'));var fs=require('fs');var Redis=require(_0x676d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x676d('0x3'));var logger=require(_0x676d('0x4'))(_0x676d('0x5'));var config=require(_0x676d('0x6'));var jayson=require(_0x676d('0x7'));var client=jayson[_0x676d('0x8')][_0x676d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x35f1ff,_0x44072c,_0x31cd3f){return new BPromise(function(_0x1de670,_0x26d00f){return client[_0x676d('0xa')](_0x35f1ff,_0x31cd3f)[_0x676d('0xb')](function(_0x4adc02){logger[_0x676d('0xc')](_0x676d('0xd'),_0x44072c,_0x676d('0xe'));logger[_0x676d('0xf')](_0x676d('0x10'),_0x44072c,_0x676d('0xe'),JSON[_0x676d('0x11')](_0x4adc02));if(_0x4adc02[_0x676d('0x12')]){if(_0x4adc02['error']['code']===0x1f4){logger[_0x676d('0x12')](_0x676d('0xd'),_0x44072c,_0x4adc02[_0x676d('0x12')][_0x676d('0x13')]);return _0x26d00f(_0x4adc02[_0x676d('0x12')][_0x676d('0x13')]);}logger[_0x676d('0x12')](_0x676d('0xd'),_0x44072c,_0x4adc02[_0x676d('0x12')]['message']);return _0x1de670(_0x4adc02['error']['message']);}else{logger['info'](_0x676d('0xd'),_0x44072c,_0x676d('0xe'));_0x1de670(_0x4adc02[_0x676d('0x14')][_0x676d('0x13')]);}})[_0x676d('0x15')](function(_0xfde386){logger[_0x676d('0x12')]('SquareMessage,\x20%s,\x20%s',_0x44072c,_0xfde386);_0x26d00f(_0xfde386);});});}exports[_0x676d('0x16')]=function(_0x46c956){var _0x5d85c0=this;return new Promise(function(_0x41a3bf,_0x4ef4f8){return db['SquareMessage'][_0x676d('0x17')](_0x46c956[_0x676d('0x18')],{'raw':_0x46c956[_0x676d('0x19')]?_0x46c956['options'][_0x676d('0x1a')]===undefined?!![]:![]:!![]})[_0x676d('0xb')](function(_0x2633f3){logger['info']('CreateSquareMessage',_0x46c956);logger[_0x676d('0xf')](_0x676d('0x16'),_0x46c956,JSON['stringify'](_0x2633f3));_0x41a3bf(_0x2633f3);})[_0x676d('0x15')](function(_0x46022d){logger[_0x676d('0x12')](_0x676d('0x16'),_0x46022d['message'],_0x46c956);_0x4ef4f8(_0x5d85c0['error'](0x1f4,_0x46022d['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index e667e57..3e9a953 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 _0xfde1=['./squareOdbc.controller','get','isAuthenticated','index','/:id','show','create','update','delete','exports','multer','util','path','connect-timeout','express','../../config/environment'];(function(_0xf62b7d,_0x385d7c){var _0x2252f2=function(_0x588b4a){while(--_0x588b4a){_0xf62b7d['push'](_0xf62b7d['shift']());}};_0x2252f2(++_0x385d7c);}(_0xfde1,0x11a));var _0x1fde=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfde1[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x1fde('0x0'));var util=require(_0x1fde('0x1'));var path=require(_0x1fde('0x2'));var timeout=require(_0x1fde('0x3'));var express=require(_0x1fde('0x4'));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(_0x1fde('0x5'));var controller=require(_0x1fde('0x6'));router[_0x1fde('0x7')]('/',auth[_0x1fde('0x8')](),controller[_0x1fde('0x9')]);router['get'](_0x1fde('0xa'),auth[_0x1fde('0x8')](),controller[_0x1fde('0xb')]);router[_0x1fde('0x7')]('/:id/test',auth['isAuthenticated'](),timeout('15s'),controller['test']);router['post']('/',auth[_0x1fde('0x8')](),controller[_0x1fde('0xc')]);router['put'](_0x1fde('0xa'),auth[_0x1fde('0x8')](),controller[_0x1fde('0xd')]);router[_0x1fde('0xe')](_0x1fde('0xa'),auth[_0x1fde('0x8')](),controller['destroy']);module[_0x1fde('0xf')]=router; \ No newline at end of file +var _0x8b84=['Router','fs-extra','../../components/interaction/service','./squareOdbc.controller','get','isAuthenticated','/:id','/:id/test','15s','test','post','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8b84,0x161));var _0x48b8=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x8b84[_0x24061a];return _0x82054e;};'use strict';var multer=require(_0x48b8('0x0'));var util=require(_0x48b8('0x1'));var path=require(_0x48b8('0x2'));var timeout=require('connect-timeout');var express=require(_0x48b8('0x3'));var router=express[_0x48b8('0x4')]();var fs_extra=require(_0x48b8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x48b8('0x6'));var config=require('../../config/environment');var controller=require(_0x48b8('0x7'));router[_0x48b8('0x8')]('/',auth[_0x48b8('0x9')](),controller['index']);router[_0x48b8('0x8')](_0x48b8('0xa'),auth[_0x48b8('0x9')](),controller['show']);router[_0x48b8('0x8')](_0x48b8('0xb'),auth['isAuthenticated'](),timeout(_0x48b8('0xc')),controller[_0x48b8('0xd')]);router[_0x48b8('0xe')]('/',auth['isAuthenticated'](),controller[_0x48b8('0xf')]);router[_0x48b8('0x10')](_0x48b8('0xa'),auth[_0x48b8('0x9')](),controller[_0x48b8('0x11')]);router[_0x48b8('0x12')](_0x48b8('0xa'),auth[_0x48b8('0x9')](),controller[_0x48b8('0x13')]);module[_0x48b8('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 43abece..3b54e25 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 _0xebf1=['sequelize','exports','STRING','name'];(function(_0x2b0683,_0x5e49b0){var _0x381408=function(_0x3d22a7){while(--_0x3d22a7){_0x2b0683['push'](_0x2b0683['shift']());}};_0x381408(++_0x5e49b0);}(_0xebf1,0xc0));var _0x1ebf=function(_0x16a223,_0x31b6e8){_0x16a223=_0x16a223-0x0;var _0x5ded66=_0xebf1[_0x16a223];return _0x5ded66;};'use strict';var Sequelize=require(_0x1ebf('0x0'));module[_0x1ebf('0x1')]={'name':{'type':Sequelize[_0x1ebf('0x2')],'unique':_0x1ebf('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x1ebf('0x2')]},'description':{'type':Sequelize[_0x1ebf('0x2')]}}; \ No newline at end of file +var _0xe1f0=['sequelize','exports','STRING'];(function(_0xc60fda,_0x1cd6a){var _0x244247=function(_0x39d99d){while(--_0x39d99d){_0xc60fda['push'](_0xc60fda['shift']());}};_0x244247(++_0x1cd6a);}(_0xe1f0,0x117));var _0x0e1f=function(_0x65a22c,_0x3f71c3){_0x65a22c=_0x65a22c-0x0;var _0x3e72ef=_0xe1f0[_0x65a22c];return _0x3e72ef;};'use strict';var Sequelize=require(_0x0e1f('0x0'));module[_0x0e1f('0x1')]={'name':{'type':Sequelize[_0x0e1f('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x0e1f('0x2')]},'description':{'type':Sequelize[_0x0e1f('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index b47996e..8a84547 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 _0xfe32=['closeSync','eml-format','zip-dir','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','get','ODBC','error','stack','name','send','map','SquareOdbc','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc'];(function(_0x1aa3c9,_0x4801c2){var _0x2280c7=function(_0x58db4f){while(--_0x58db4f){_0x1aa3c9['push'](_0x1aa3c9['shift']());}};_0x2280c7(++_0x4801c2);}(_0xfe32,0xfa));var _0x2fe3=function(_0x5b8587,_0x3743e3){_0x5b8587=_0x5b8587-0x0;var _0x3248d3=_0xfe32[_0x5b8587];return _0x3248d3;};'use strict';var emlformat=require(_0x2fe3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2fe3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2fe3('0x2'));var moment=require(_0x2fe3('0x3'));var BPromise=require(_0x2fe3('0x4'));var Mustache=require('mustache');var util=require(_0x2fe3('0x5'));var path=require('path');var sox=require(_0x2fe3('0x6'));var csv=require('to-csv');var ejs=require(_0x2fe3('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2fe3('0x8'));var squel=require(_0x2fe3('0x9'));var crypto=require('crypto');var jsforce=require(_0x2fe3('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x2fe3('0xb'));var querystring=require(_0x2fe3('0xc'));var Papa=require(_0x2fe3('0xd'));var Redis=require(_0x2fe3('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2fe3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2fe3('0x10'));var logger=require(_0x2fe3('0x11'))(_0x2fe3('0x12'));var utils=require('../../config/utils');var config=require(_0x2fe3('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2fe3('0x14'))['db'];function respondWithStatusCode(_0x5973c3,_0x1d6d96){_0x1d6d96=_0x1d6d96||0xcc;return function(_0x1a058b){if(_0x1a058b){return _0x5973c3[_0x2fe3('0x15')](_0x1d6d96);}return _0x5973c3[_0x2fe3('0x16')](_0x1d6d96)[_0x2fe3('0x17')]();};}function respondWithResult(_0x25e474,_0x5c315f){_0x5c315f=_0x5c315f||0xc8;return function(_0x22b132){if(_0x22b132){return _0x25e474[_0x2fe3('0x16')](_0x5c315f)[_0x2fe3('0x18')](_0x22b132);}};}function respondWithFilteredResult(_0x575150,_0x2758c0){return function(_0x407f10){if(_0x407f10){var _0x37b841=typeof _0x2758c0[_0x2fe3('0x19')]===_0x2fe3('0x1a')&&typeof _0x2758c0[_0x2fe3('0x1b')]===_0x2fe3('0x1a');var _0x50d990=_0x407f10[_0x2fe3('0x1c')];var _0x16c157=_0x37b841?0x0:_0x2758c0[_0x2fe3('0x19')];var _0x35e02d=_0x37b841?_0x407f10[_0x2fe3('0x1c')]:_0x2758c0[_0x2fe3('0x19')]+_0x2758c0[_0x2fe3('0x1b')];var _0x4784c0;if(_0x35e02d>=_0x50d990){_0x35e02d=_0x50d990;_0x4784c0=0xc8;}else{_0x4784c0=0xce;}_0x575150[_0x2fe3('0x16')](_0x4784c0);return _0x575150[_0x2fe3('0x1d')]('Content-Range',_0x16c157+'-'+_0x35e02d+'/'+_0x50d990)['json'](_0x407f10);}return null;};}function patchUpdates(_0x1b8562){return function(_0x5f2b7f){try{jsonpatch[_0x2fe3('0x1e')](_0x5f2b7f,_0x1b8562,!![]);}catch(_0xa9f188){return BPromise[_0x2fe3('0x1f')](_0xa9f188);}return _0x5f2b7f['save']();};}function saveUpdates(_0x531ab0,_0x558850){return function(_0x1e02b4){if(_0x1e02b4){return _0x1e02b4[_0x2fe3('0x20')](_0x531ab0)['then'](function(_0x62cf50){return _0x62cf50;});}return null;};}function removeEntity(_0x1e5102,_0x200aa0){return function(_0x5870b){if(_0x5870b){return _0x5870b[_0x2fe3('0x21')]()[_0x2fe3('0x22')](function(){var _0x1c832f=_0x5870b[_0x2fe3('0x23')]({'plain':!![]});var _0x32eefa=_0x2fe3('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x32eefa,'resourceId':_0x1c832f['id']}})['then'](function(){return _0x5870b;});})['then'](function(){_0x1e5102[_0x2fe3('0x16')](0xcc)[_0x2fe3('0x17')]();});}};}function handleEntityNotFound(_0x3127c3,_0x50eb1b){return function(_0x5cd0bf){if(!_0x5cd0bf){_0x3127c3[_0x2fe3('0x15')](0x194);}return _0x5cd0bf;};}function handleError(_0x3808c5,_0x3adedc){_0x3adedc=_0x3adedc||0x1f4;return function(_0x15a5d4){logger[_0x2fe3('0x25')](_0x15a5d4[_0x2fe3('0x26')]);if(_0x15a5d4['name']){delete _0x15a5d4[_0x2fe3('0x27')];}_0x3808c5[_0x2fe3('0x16')](_0x3adedc)[_0x2fe3('0x28')](_0x15a5d4);};}exports['index']=function(_0x32eed9,_0x31e7d4){var _0x15ca11={},_0x4d48eb={},_0xec2278={'count':0x0,'rows':[]};var _0xb75c4c=_[_0x2fe3('0x29')](db[_0x2fe3('0x2a')][_0x2fe3('0x2b')],function(_0x19d9f2){return{'name':_0x19d9f2['fieldName'],'type':_0x19d9f2[_0x2fe3('0x2c')][_0x2fe3('0x2d')]};});_0x4d48eb['model']=_[_0x2fe3('0x29')](_0xb75c4c,_0x2fe3('0x27'));_0x4d48eb[_0x2fe3('0x2e')]=_[_0x2fe3('0x2f')](_0x32eed9[_0x2fe3('0x2e')]);_0x4d48eb[_0x2fe3('0x30')]=_[_0x2fe3('0x31')](_0x4d48eb[_0x2fe3('0x32')],_0x4d48eb[_0x2fe3('0x2e')]);_0x15ca11[_0x2fe3('0x33')]=_[_0x2fe3('0x31')](_0x4d48eb[_0x2fe3('0x32')],qs['fields'](_0x32eed9[_0x2fe3('0x2e')]['fields']));_0x15ca11[_0x2fe3('0x33')]=_0x15ca11[_0x2fe3('0x33')]['length']?_0x15ca11['attributes']:_0x4d48eb[_0x2fe3('0x32')];if(!_0x32eed9[_0x2fe3('0x2e')][_0x2fe3('0x34')](_0x2fe3('0x35'))){_0x15ca11[_0x2fe3('0x1b')]=qs[_0x2fe3('0x1b')](_0x32eed9['query'][_0x2fe3('0x1b')]);_0x15ca11[_0x2fe3('0x19')]=qs[_0x2fe3('0x19')](_0x32eed9[_0x2fe3('0x2e')][_0x2fe3('0x19')]);}_0x15ca11[_0x2fe3('0x36')]=qs[_0x2fe3('0x37')](_0x32eed9[_0x2fe3('0x2e')]['sort']);_0x15ca11[_0x2fe3('0x38')]=qs[_0x2fe3('0x30')](_['pick'](_0x32eed9[_0x2fe3('0x2e')],_0x4d48eb['filters']),_0xb75c4c);if(_0x32eed9['query']['filter']){_0x15ca11[_0x2fe3('0x38')]=_[_0x2fe3('0x39')](_0x15ca11['where'],{'$or':_['map'](_0xb75c4c,function(_0x119f1e){if(_0x119f1e[_0x2fe3('0x2c')]!==_0x2fe3('0x3a')){var _0x4b8167={};_0x4b8167[_0x119f1e[_0x2fe3('0x27')]]={'$like':'%'+_0x32eed9[_0x2fe3('0x2e')][_0x2fe3('0x3b')]+'%'};return _0x4b8167;}})});}_0x15ca11=_['merge']({},_0x15ca11,_0x32eed9[_0x2fe3('0x3c')]);var _0x51539f={'where':_0x15ca11['where']};return db[_0x2fe3('0x2a')][_0x2fe3('0x1c')](_0x51539f)['then'](function(_0x5dfc97){_0xec2278[_0x2fe3('0x1c')]=_0x5dfc97;if(_0x32eed9[_0x2fe3('0x2e')][_0x2fe3('0x3d')]){_0x15ca11[_0x2fe3('0x3e')]=[{'all':!![]}];}return db['SquareOdbc'][_0x2fe3('0x3f')](_0x15ca11);})[_0x2fe3('0x22')](function(_0x2dbe13){_0xec2278[_0x2fe3('0x40')]=_0x2dbe13;return _0xec2278;})[_0x2fe3('0x22')](respondWithFilteredResult(_0x31e7d4,_0x15ca11))[_0x2fe3('0x41')](handleError(_0x31e7d4,null));};exports[_0x2fe3('0x42')]=function(_0x354744,_0x367da0){var _0x348e24={'raw':!![],'where':{'id':_0x354744[_0x2fe3('0x43')]['id']}},_0x464600={};_0x464600[_0x2fe3('0x32')]=_[_0x2fe3('0x2f')](db['SquareOdbc'][_0x2fe3('0x2b')]);_0x464600['query']=_[_0x2fe3('0x2f')](_0x354744[_0x2fe3('0x2e')]);_0x464600[_0x2fe3('0x30')]=_[_0x2fe3('0x31')](_0x464600[_0x2fe3('0x32')],_0x464600[_0x2fe3('0x2e')]);_0x348e24[_0x2fe3('0x33')]=_[_0x2fe3('0x31')](_0x464600[_0x2fe3('0x32')],qs[_0x2fe3('0x44')](_0x354744[_0x2fe3('0x2e')][_0x2fe3('0x44')]));_0x348e24['attributes']=_0x348e24[_0x2fe3('0x33')][_0x2fe3('0x45')]?_0x348e24['attributes']:_0x464600[_0x2fe3('0x32')];if(_0x354744[_0x2fe3('0x2e')][_0x2fe3('0x3d')]){_0x348e24[_0x2fe3('0x3e')]=[{'all':!![]}];}_0x348e24=_['merge']({},_0x348e24,_0x354744[_0x2fe3('0x3c')]);return db[_0x2fe3('0x2a')][_0x2fe3('0x46')](_0x348e24)[_0x2fe3('0x22')](handleEntityNotFound(_0x367da0,null))[_0x2fe3('0x22')](respondWithResult(_0x367da0,null))[_0x2fe3('0x41')](handleError(_0x367da0,null));};exports[_0x2fe3('0x47')]=function(_0xe89a53,_0x1811ee){return db[_0x2fe3('0x2a')][_0x2fe3('0x47')](_0xe89a53[_0x2fe3('0x48')],{})[_0x2fe3('0x22')](function(_0x323bc2){var _0x3df475=_0xe89a53['user'][_0x2fe3('0x23')]({'plain':!![]});if(!_0x3df475)throw new Error(_0x2fe3('0x49'));if(_0x3df475['role']===_0x2fe3('0x4a')){var _0x5a5f30=_0x323bc2[_0x2fe3('0x23')]({'plain':!![]});var _0x4514b2=_0x2fe3('0x24');return db['UserProfileSection'][_0x2fe3('0x46')]({'where':{'name':_0x4514b2,'userProfileId':_0x3df475[_0x2fe3('0x4b')]},'raw':!![]})[_0x2fe3('0x22')](function(_0x1a4789){if(_0x1a4789&&_0x1a4789[_0x2fe3('0x4c')]===0x0){return db[_0x2fe3('0x4d')][_0x2fe3('0x47')]({'name':_0x5a5f30[_0x2fe3('0x27')],'resourceId':_0x5a5f30['id'],'type':_0x1a4789[_0x2fe3('0x27')],'sectionId':_0x1a4789['id']},{})['then'](function(){return _0x323bc2;});}else{return _0x323bc2;}})['catch'](function(_0x7bbfb1){logger['error'](_0x2fe3('0x4e'),_0x7bbfb1);throw _0x7bbfb1;});}return _0x323bc2;})[_0x2fe3('0x22')](respondWithResult(_0x1811ee,0xc9))['catch'](handleError(_0x1811ee,null));};exports[_0x2fe3('0x20')]=function(_0x34fb82,_0x2a939f){if(_0x34fb82[_0x2fe3('0x48')]['id']){delete _0x34fb82[_0x2fe3('0x48')]['id'];}return db['SquareOdbc'][_0x2fe3('0x46')]({'where':{'id':_0x34fb82[_0x2fe3('0x43')]['id']}})[_0x2fe3('0x22')](handleEntityNotFound(_0x2a939f,null))[_0x2fe3('0x22')](saveUpdates(_0x34fb82[_0x2fe3('0x48')],null))[_0x2fe3('0x22')](respondWithResult(_0x2a939f,null))[_0x2fe3('0x41')](handleError(_0x2a939f,null));};exports[_0x2fe3('0x21')]=function(_0x1d568e,_0x379cf3){return db[_0x2fe3('0x2a')][_0x2fe3('0x46')]({'where':{'id':_0x1d568e[_0x2fe3('0x43')]['id']}})[_0x2fe3('0x22')](handleEntityNotFound(_0x379cf3,null))['then'](removeEntity(_0x379cf3,null))['catch'](handleError(_0x379cf3,null));};exports[_0x2fe3('0x4f')]=function(_0x4d8038,_0x2fb98b,_0x53bdf0){var _0x591c8b;return db[_0x2fe3('0x2a')][_0x2fe3('0x46')]({'where':{'id':_0x4d8038[_0x2fe3('0x43')]['id']},'attributes':['id',_0x2fe3('0x50')]})[_0x2fe3('0x22')](handleEntityNotFound(_0x2fb98b,null))[_0x2fe3('0x22')](function(_0x2290c0){if(_0x2290c0){var _0x5063d5=require(_0x2fe3('0x51'))();_0x5063d5['openSync'](_0x2290c0[_0x2fe3('0x50')]);_0x5063d5[_0x2fe3('0x52')]();return _0x2290c0;}})[_0x2fe3('0x22')](respondWithResult(_0x2fb98b,null))['catch'](handleError(_0x2fb98b,null));}; \ No newline at end of file +var _0x2075=['fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','count','includeAll','include','SquareOdbc','findAll','params','length','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','test','dsn','odbc','openSync','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../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','set','Content-Range','reject','save','update','then','ODBC','UserProfileResource','end','error','stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes'];(function(_0x3bd31c,_0x53a8d9){var _0xb7771d=function(_0x3f2df8){while(--_0x3f2df8){_0x3bd31c['push'](_0x3bd31c['shift']());}};_0xb7771d(++_0x53a8d9);}(_0x2075,0x175));var _0x5207=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x2075[_0x26462c];return _0x509a42;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5207('0x0'));var zipdir=require(_0x5207('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5207('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5207('0x3'));var util=require(_0x5207('0x4'));var path=require(_0x5207('0x5'));var sox=require(_0x5207('0x6'));var csv=require(_0x5207('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5207('0x8'));var _=require(_0x5207('0x9'));var squel=require(_0x5207('0xa'));var crypto=require('crypto');var jsforce=require(_0x5207('0xb'));var deskjs=require(_0x5207('0xc'));var toCsv=require(_0x5207('0x7'));var querystring=require(_0x5207('0xd'));var Papa=require(_0x5207('0xe'));var Redis=require('ioredis');var authService=require(_0x5207('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x5207('0x10'));var hardwareService=require(_0x5207('0x11'));var logger=require(_0x5207('0x12'))(_0x5207('0x13'));var utils=require(_0x5207('0x14'));var config=require(_0x5207('0x15'));var licenseUtil=require(_0x5207('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e0f95,_0x32cd00){_0x32cd00=_0x32cd00||0xcc;return function(_0x47878f){if(_0x47878f){return _0x2e0f95[_0x5207('0x17')](_0x32cd00);}return _0x2e0f95[_0x5207('0x18')](_0x32cd00)['end']();};}function respondWithResult(_0x2059c7,_0x3f5a01){_0x3f5a01=_0x3f5a01||0xc8;return function(_0x2a808c){if(_0x2a808c){return _0x2059c7[_0x5207('0x18')](_0x3f5a01)[_0x5207('0x19')](_0x2a808c);}};}function respondWithFilteredResult(_0x38d397,_0x3b6b63){return function(_0x5c388a){if(_0x5c388a){var _0x2b4b0b=typeof _0x3b6b63[_0x5207('0x1a')]===_0x5207('0x1b')&&typeof _0x3b6b63[_0x5207('0x1c')]===_0x5207('0x1b');var _0x442991=_0x5c388a['count'];var _0xa5d5f6=_0x2b4b0b?0x0:_0x3b6b63[_0x5207('0x1a')];var _0xf9a7f9=_0x2b4b0b?_0x5c388a['count']:_0x3b6b63[_0x5207('0x1a')]+_0x3b6b63[_0x5207('0x1c')];var _0x325855;if(_0xf9a7f9>=_0x442991){_0xf9a7f9=_0x442991;_0x325855=0xc8;}else{_0x325855=0xce;}_0x38d397[_0x5207('0x18')](_0x325855);return _0x38d397[_0x5207('0x1d')](_0x5207('0x1e'),_0xa5d5f6+'-'+_0xf9a7f9+'/'+_0x442991)[_0x5207('0x19')](_0x5c388a);}return null;};}function patchUpdates(_0x4af028){return function(_0x568409){try{jsonpatch['apply'](_0x568409,_0x4af028,!![]);}catch(_0x12b4fe){return BPromise[_0x5207('0x1f')](_0x12b4fe);}return _0x568409[_0x5207('0x20')]();};}function saveUpdates(_0x131aa1,_0x2ca946){return function(_0x434ed8){if(_0x434ed8){return _0x434ed8[_0x5207('0x21')](_0x131aa1)[_0x5207('0x22')](function(_0xfc888f){return _0xfc888f;});}return null;};}function removeEntity(_0x102659,_0x2e72f5){return function(_0x2c9d22){if(_0x2c9d22){return _0x2c9d22['destroy']()[_0x5207('0x22')](function(){var _0x5a8725=_0x2c9d22['get']({'plain':!![]});var _0x3d6991=_0x5207('0x23');return db[_0x5207('0x24')]['destroy']({'where':{'type':_0x3d6991,'resourceId':_0x5a8725['id']}})['then'](function(){return _0x2c9d22;});})[_0x5207('0x22')](function(){_0x102659[_0x5207('0x18')](0xcc)[_0x5207('0x25')]();});}};}function handleEntityNotFound(_0x385402,_0x44959d){return function(_0x4c51aa){if(!_0x4c51aa){_0x385402[_0x5207('0x17')](0x194);}return _0x4c51aa;};}function handleError(_0xeeac76,_0x399c68){_0x399c68=_0x399c68||0x1f4;return function(_0x340252){logger[_0x5207('0x26')](_0x340252[_0x5207('0x27')]);if(_0x340252[_0x5207('0x28')]){delete _0x340252[_0x5207('0x28')];}_0xeeac76['status'](_0x399c68)[_0x5207('0x29')](_0x340252);};}exports[_0x5207('0x2a')]=function(_0x33caa1,_0x1e1105){var _0x58bd63={},_0x14bfff={},_0x1636bc={'count':0x0,'rows':[]};var _0x591922=_['map'](db['SquareOdbc'][_0x5207('0x2b')],function(_0x377957){return{'name':_0x377957[_0x5207('0x2c')],'type':_0x377957['type'][_0x5207('0x2d')]};});_0x14bfff[_0x5207('0x2e')]=_['map'](_0x591922,_0x5207('0x28'));_0x14bfff[_0x5207('0x2f')]=_[_0x5207('0x30')](_0x33caa1['query']);_0x14bfff[_0x5207('0x31')]=_[_0x5207('0x32')](_0x14bfff[_0x5207('0x2e')],_0x14bfff[_0x5207('0x2f')]);_0x58bd63[_0x5207('0x33')]=_[_0x5207('0x32')](_0x14bfff[_0x5207('0x2e')],qs[_0x5207('0x34')](_0x33caa1[_0x5207('0x2f')][_0x5207('0x34')]));_0x58bd63[_0x5207('0x33')]=_0x58bd63[_0x5207('0x33')]['length']?_0x58bd63[_0x5207('0x33')]:_0x14bfff['model'];if(!_0x33caa1[_0x5207('0x2f')][_0x5207('0x35')](_0x5207('0x36'))){_0x58bd63[_0x5207('0x1c')]=qs[_0x5207('0x1c')](_0x33caa1[_0x5207('0x2f')][_0x5207('0x1c')]);_0x58bd63[_0x5207('0x1a')]=qs[_0x5207('0x1a')](_0x33caa1[_0x5207('0x2f')]['offset']);}_0x58bd63[_0x5207('0x37')]=qs[_0x5207('0x38')](_0x33caa1['query'][_0x5207('0x38')]);_0x58bd63['where']=qs[_0x5207('0x31')](_['pick'](_0x33caa1[_0x5207('0x2f')],_0x14bfff[_0x5207('0x31')]),_0x591922);if(_0x33caa1[_0x5207('0x2f')][_0x5207('0x39')]){_0x58bd63[_0x5207('0x3a')]=_[_0x5207('0x3b')](_0x58bd63[_0x5207('0x3a')],{'$or':_['map'](_0x591922,function(_0x44902a){if(_0x44902a['type']!==_0x5207('0x3c')){var _0x29e32b={};_0x29e32b[_0x44902a[_0x5207('0x28')]]={'$like':'%'+_0x33caa1[_0x5207('0x2f')][_0x5207('0x39')]+'%'};return _0x29e32b;}})});}_0x58bd63=_['merge']({},_0x58bd63,_0x33caa1['options']);var _0x165c17={'where':_0x58bd63[_0x5207('0x3a')]};return db['SquareOdbc'][_0x5207('0x3d')](_0x165c17)['then'](function(_0x1d305c){_0x1636bc[_0x5207('0x3d')]=_0x1d305c;if(_0x33caa1['query'][_0x5207('0x3e')]){_0x58bd63[_0x5207('0x3f')]=[{'all':!![]}];}return db[_0x5207('0x40')][_0x5207('0x41')](_0x58bd63);})['then'](function(_0x6f9089){_0x1636bc['rows']=_0x6f9089;return _0x1636bc;})[_0x5207('0x22')](respondWithFilteredResult(_0x1e1105,_0x58bd63))['catch'](handleError(_0x1e1105,null));};exports['show']=function(_0x446922,_0x1309a5){var _0x4d67f9={'raw':!![],'where':{'id':_0x446922[_0x5207('0x42')]['id']}},_0x303f34={};_0x303f34['model']=_[_0x5207('0x30')](db[_0x5207('0x40')]['rawAttributes']);_0x303f34['query']=_['keys'](_0x446922[_0x5207('0x2f')]);_0x303f34[_0x5207('0x31')]=_[_0x5207('0x32')](_0x303f34[_0x5207('0x2e')],_0x303f34[_0x5207('0x2f')]);_0x4d67f9[_0x5207('0x33')]=_[_0x5207('0x32')](_0x303f34[_0x5207('0x2e')],qs[_0x5207('0x34')](_0x446922[_0x5207('0x2f')][_0x5207('0x34')]));_0x4d67f9[_0x5207('0x33')]=_0x4d67f9[_0x5207('0x33')][_0x5207('0x43')]?_0x4d67f9[_0x5207('0x33')]:_0x303f34[_0x5207('0x2e')];if(_0x446922[_0x5207('0x2f')][_0x5207('0x3e')]){_0x4d67f9[_0x5207('0x3f')]=[{'all':!![]}];}_0x4d67f9=_[_0x5207('0x3b')]({},_0x4d67f9,_0x446922[_0x5207('0x44')]);return db[_0x5207('0x40')][_0x5207('0x45')](_0x4d67f9)['then'](handleEntityNotFound(_0x1309a5,null))[_0x5207('0x22')](respondWithResult(_0x1309a5,null))[_0x5207('0x46')](handleError(_0x1309a5,null));};exports[_0x5207('0x47')]=function(_0xfec466,_0x42af73){return db[_0x5207('0x40')][_0x5207('0x47')](_0xfec466[_0x5207('0x48')],{})[_0x5207('0x22')](function(_0x5c5ea8){var _0x5231ff=_0xfec466[_0x5207('0x49')]['get']({'plain':!![]});if(!_0x5231ff)throw new Error(_0x5207('0x4a'));if(_0x5231ff[_0x5207('0x4b')]==='user'){var _0x527e98=_0x5c5ea8[_0x5207('0x4c')]({'plain':!![]});var _0x476a72=_0x5207('0x23');return db[_0x5207('0x4d')]['find']({'where':{'name':_0x476a72,'userProfileId':_0x5231ff['userProfileId']},'raw':!![]})[_0x5207('0x22')](function(_0x442f07){if(_0x442f07&&_0x442f07[_0x5207('0x4e')]===0x0){return db['UserProfileResource'][_0x5207('0x47')]({'name':_0x527e98[_0x5207('0x28')],'resourceId':_0x527e98['id'],'type':_0x442f07['name'],'sectionId':_0x442f07['id']},{})[_0x5207('0x22')](function(){return _0x5c5ea8;});}else{return _0x5c5ea8;}})[_0x5207('0x46')](function(_0x26ff12){logger[_0x5207('0x26')](_0x5207('0x4f'),_0x26ff12);throw _0x26ff12;});}return _0x5c5ea8;})[_0x5207('0x22')](respondWithResult(_0x42af73,0xc9))[_0x5207('0x46')](handleError(_0x42af73,null));};exports[_0x5207('0x21')]=function(_0x31860e,_0x1bd2f3){if(_0x31860e['body']['id']){delete _0x31860e[_0x5207('0x48')]['id'];}return db[_0x5207('0x40')][_0x5207('0x45')]({'where':{'id':_0x31860e[_0x5207('0x42')]['id']}})[_0x5207('0x22')](handleEntityNotFound(_0x1bd2f3,null))[_0x5207('0x22')](saveUpdates(_0x31860e[_0x5207('0x48')],null))[_0x5207('0x22')](respondWithResult(_0x1bd2f3,null))[_0x5207('0x46')](handleError(_0x1bd2f3,null));};exports[_0x5207('0x50')]=function(_0x5ad81c,_0x596176){return db[_0x5207('0x40')][_0x5207('0x45')]({'where':{'id':_0x5ad81c[_0x5207('0x42')]['id']}})[_0x5207('0x22')](handleEntityNotFound(_0x596176,null))[_0x5207('0x22')](removeEntity(_0x596176,null))[_0x5207('0x46')](handleError(_0x596176,null));};exports[_0x5207('0x51')]=function(_0x4d8480,_0xe9a802,_0x384edb){var _0x9df8cb;return db[_0x5207('0x40')][_0x5207('0x45')]({'where':{'id':_0x4d8480['params']['id']},'attributes':['id',_0x5207('0x52')]})[_0x5207('0x22')](handleEntityNotFound(_0xe9a802,null))[_0x5207('0x22')](function(_0x2b8e06){if(_0x2b8e06){var _0x49e77e=require(_0x5207('0x53'))();_0x49e77e[_0x5207('0x54')](_0x2b8e06['dsn']);_0x49e77e['closeSync']();return _0x2b8e06;}})[_0x5207('0x22')](respondWithResult(_0xe9a802,null))[_0x5207('0x46')](handleError(_0xe9a802,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index c28d878..ec8a913 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 _0x0558=['rimraf','../../config/environment','./squareOdbc.attributes','exports','define','square_odbc','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5a6e9f,_0x45b335){var _0x3dd5c4=function(_0x5e37a7){while(--_0x5e37a7){_0x5a6e9f['push'](_0x5a6e9f['shift']());}};_0x3dd5c4(++_0x45b335);}(_0x0558,0xea));var _0x8055=function(_0x22f5ea,_0x3a6a30){_0x22f5ea=_0x22f5ea-0x0;var _0xe5955=_0x0558[_0x22f5ea];return _0xe5955;};'use strict';var _=require('lodash');var util=require(_0x8055('0x0'));var logger=require(_0x8055('0x1'))(_0x8055('0x2'));var moment=require(_0x8055('0x3'));var BPromise=require(_0x8055('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8055('0x5'));var rimraf=require(_0x8055('0x6'));var config=require(_0x8055('0x7'));var attributes=require(_0x8055('0x8'));module[_0x8055('0x9')]=function(_0x1f705c,_0x11223a){return _0x1f705c[_0x8055('0xa')]('SquareOdbc',attributes,{'tableName':_0x8055('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f94=['../../config/environment','exports','SquareOdbc','square_odbc','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7f94,0xf6));var _0x47f9=function(_0x11dc16,_0x52146e){_0x11dc16=_0x11dc16-0x0;var _0x30fe9b=_0x7f94[_0x11dc16];return _0x30fe9b;};'use strict';var _=require(_0x47f9('0x0'));var util=require('util');var logger=require(_0x47f9('0x1'))(_0x47f9('0x2'));var moment=require(_0x47f9('0x3'));var BPromise=require('bluebird');var rp=require(_0x47f9('0x4'));var fs=require('fs');var path=require(_0x47f9('0x5'));var rimraf=require(_0x47f9('0x6'));var config=require(_0x47f9('0x7'));var attributes=require('./squareOdbc.attributes');module[_0x47f9('0x8')]=function(_0x12e54b,_0x174f0e){return _0x12e54b['define'](_0x47f9('0x9'),attributes,{'tableName':_0x47f9('0xa'),'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 df72a0b..e243253 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 _0xe3f0=['../../config/utils','rpc','../../config/environment','jayson/promise','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','result','SquareOdbc','find','options','raw','where','include','map','attributes','model','ShowSquareOdbc','stringify','catch','lodash','util','moment','randomstring'];(function(_0xb6e43,_0x1568fc){var _0x47c40f=function(_0x107786){while(--_0x107786){_0xb6e43['push'](_0xb6e43['shift']());}};_0x47c40f(++_0x1568fc);}(_0xe3f0,0x158));var _0x0e3f=function(_0xdd2673,_0x360364){_0xdd2673=_0xdd2673-0x0;var _0x3f61eb=_0xe3f0[_0xdd2673];return _0x3f61eb;};'use strict';var _=require(_0x0e3f('0x0'));var util=require(_0x0e3f('0x1'));var moment=require(_0x0e3f('0x2'));var BPromise=require('bluebird');var rs=require(_0x0e3f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0e3f('0x4'));var logger=require('../../config/logger')(_0x0e3f('0x5'));var config=require(_0x0e3f('0x6'));var jayson=require(_0x0e3f('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xedcf9,_0x3b284c,_0x48cd02){return new BPromise(function(_0x31a08f,_0x1f2753){return client['request'](_0xedcf9,_0x48cd02)[_0x0e3f('0x8')](function(_0x4cd8db){logger['info'](_0x0e3f('0x9'),_0x3b284c,_0x0e3f('0xa'));logger[_0x0e3f('0xb')](_0x0e3f('0xc'),_0x3b284c,_0x0e3f('0xa'),JSON['stringify'](_0x4cd8db));if(_0x4cd8db[_0x0e3f('0xd')]){if(_0x4cd8db[_0x0e3f('0xd')][_0x0e3f('0xe')]===0x1f4){logger[_0x0e3f('0xd')](_0x0e3f('0x9'),_0x3b284c,_0x4cd8db['error'][_0x0e3f('0xf')]);return _0x1f2753(_0x4cd8db[_0x0e3f('0xd')][_0x0e3f('0xf')]);}logger[_0x0e3f('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x3b284c,_0x4cd8db[_0x0e3f('0xd')]['message']);return _0x31a08f(_0x4cd8db['error'][_0x0e3f('0xf')]);}else{logger['info'](_0x0e3f('0x9'),_0x3b284c,_0x0e3f('0xa'));_0x31a08f(_0x4cd8db[_0x0e3f('0x10')][_0x0e3f('0xf')]);}})['catch'](function(_0xd99e70){logger['error'](_0x0e3f('0x9'),_0x3b284c,_0xd99e70);_0x1f2753(_0xd99e70);});});}exports['ShowSquareOdbc']=function(_0x431f55){var _0x4be13f=this;return new Promise(function(_0x14f3f7,_0x58a378){return db[_0x0e3f('0x11')][_0x0e3f('0x12')]({'raw':_0x431f55[_0x0e3f('0x13')]?_0x431f55['options'][_0x0e3f('0x14')]===undefined?!![]:![]:!![],'where':_0x431f55[_0x0e3f('0x13')]?_0x431f55[_0x0e3f('0x13')][_0x0e3f('0x15')]||null:null,'attributes':_0x431f55['options']?_0x431f55[_0x0e3f('0x13')]['attributes']||null:null,'include':_0x431f55[_0x0e3f('0x13')]?_0x431f55[_0x0e3f('0x13')][_0x0e3f('0x16')]?_[_0x0e3f('0x17')](_0x431f55[_0x0e3f('0x13')][_0x0e3f('0x16')],function(_0x3578c2){return{'model':db[_0x3578c2['model']],'as':_0x3578c2['as'],'attributes':_0x3578c2[_0x0e3f('0x18')],'include':_0x3578c2[_0x0e3f('0x16')]?_[_0x0e3f('0x17')](_0x3578c2[_0x0e3f('0x16')],function(_0x365f0e){return{'model':db[_0x365f0e[_0x0e3f('0x19')]],'as':_0x365f0e['as'],'attributes':_0x365f0e[_0x0e3f('0x18')],'include':_0x365f0e['include']?_['map'](_0x365f0e[_0x0e3f('0x16')],function(_0x3e3f1e){return{'model':db[_0x3e3f1e[_0x0e3f('0x19')]],'as':_0x3e3f1e['as'],'attributes':_0x3e3f1e['attributes']};}):[]};}):[]};}):[]:[]})[_0x0e3f('0x8')](function(_0x27849e){logger['info'](_0x0e3f('0x1a'),_0x431f55);logger[_0x0e3f('0xb')]('ShowSquareOdbc',_0x431f55,JSON[_0x0e3f('0x1b')](_0x27849e));_0x14f3f7(_0x27849e);})[_0x0e3f('0x1c')](function(_0x493ec0){logger['error'](_0x0e3f('0x1a'),_0x493ec0[_0x0e3f('0xf')],_0x431f55);_0x58a378(_0x4be13f[_0x0e3f('0xd')](0x1f4,_0x493ec0[_0x0e3f('0xf')]));});});}; \ No newline at end of file +var _0xd2e8=['code','SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc','SquareOdbc','options','raw','where','attributes','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xd2e8,0x96));var _0x8d2e=function(_0x575783,_0x4f66f6){_0x575783=_0x575783-0x0;var _0x1aeae0=_0xd2e8[_0x575783];return _0x1aeae0;};'use strict';var _=require(_0x8d2e('0x0'));var util=require(_0x8d2e('0x1'));var moment=require(_0x8d2e('0x2'));var BPromise=require('bluebird');var rs=require(_0x8d2e('0x3'));var fs=require('fs');var Redis=require(_0x8d2e('0x4'));var db=require(_0x8d2e('0x5'))['db'];var utils=require(_0x8d2e('0x6'));var logger=require(_0x8d2e('0x7'))(_0x8d2e('0x8'));var config=require(_0x8d2e('0x9'));var jayson=require(_0x8d2e('0xa'));var client=jayson[_0x8d2e('0xb')][_0x8d2e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2da2d4,_0x769e95,_0x4a40c6){return new BPromise(function(_0xb93db0,_0x299055){return client['request'](_0x2da2d4,_0x4a40c6)[_0x8d2e('0xd')](function(_0x524f8f){logger[_0x8d2e('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x769e95,_0x8d2e('0xf'));logger[_0x8d2e('0x10')](_0x8d2e('0x11'),_0x769e95,_0x8d2e('0xf'),JSON[_0x8d2e('0x12')](_0x524f8f));if(_0x524f8f[_0x8d2e('0x13')]){if(_0x524f8f[_0x8d2e('0x13')][_0x8d2e('0x14')]===0x1f4){logger[_0x8d2e('0x13')](_0x8d2e('0x15'),_0x769e95,_0x524f8f[_0x8d2e('0x13')]['message']);return _0x299055(_0x524f8f['error']['message']);}logger[_0x8d2e('0x13')](_0x8d2e('0x15'),_0x769e95,_0x524f8f['error']['message']);return _0xb93db0(_0x524f8f['error'][_0x8d2e('0x16')]);}else{logger[_0x8d2e('0xe')](_0x8d2e('0x15'),_0x769e95,_0x8d2e('0xf'));_0xb93db0(_0x524f8f[_0x8d2e('0x17')][_0x8d2e('0x16')]);}})[_0x8d2e('0x18')](function(_0x315f54){logger[_0x8d2e('0x13')](_0x8d2e('0x15'),_0x769e95,_0x315f54);_0x299055(_0x315f54);});});}exports[_0x8d2e('0x19')]=function(_0x5097bf){var _0x397f47=this;return new Promise(function(_0x59f528,_0x56f6f2){return db[_0x8d2e('0x1a')]['find']({'raw':_0x5097bf['options']?_0x5097bf[_0x8d2e('0x1b')][_0x8d2e('0x1c')]===undefined?!![]:![]:!![],'where':_0x5097bf['options']?_0x5097bf['options'][_0x8d2e('0x1d')]||null:null,'attributes':_0x5097bf['options']?_0x5097bf[_0x8d2e('0x1b')][_0x8d2e('0x1e')]||null:null,'include':_0x5097bf[_0x8d2e('0x1b')]?_0x5097bf[_0x8d2e('0x1b')][_0x8d2e('0x1f')]?_[_0x8d2e('0x20')](_0x5097bf['options']['include'],function(_0x5ec685){return{'model':db[_0x5ec685['model']],'as':_0x5ec685['as'],'attributes':_0x5ec685[_0x8d2e('0x1e')],'include':_0x5ec685[_0x8d2e('0x1f')]?_[_0x8d2e('0x20')](_0x5ec685[_0x8d2e('0x1f')],function(_0x3ea38a){return{'model':db[_0x3ea38a[_0x8d2e('0x21')]],'as':_0x3ea38a['as'],'attributes':_0x3ea38a[_0x8d2e('0x1e')],'include':_0x3ea38a[_0x8d2e('0x1f')]?_['map'](_0x3ea38a['include'],function(_0x15eed4){return{'model':db[_0x15eed4['model']],'as':_0x15eed4['as'],'attributes':_0x15eed4[_0x8d2e('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x596900){logger[_0x8d2e('0xe')](_0x8d2e('0x19'),_0x5097bf);logger[_0x8d2e('0x10')](_0x8d2e('0x19'),_0x5097bf,JSON[_0x8d2e('0x12')](_0x596900));_0x59f528(_0x596900);})[_0x8d2e('0x18')](function(_0x109869){logger[_0x8d2e('0x13')](_0x8d2e('0x19'),_0x109869[_0x8d2e('0x16')],_0x5097bf);_0x56f6f2(_0x397f47['error'](0x1f4,_0x109869[_0x8d2e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 6cec93d..08a7aa8 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 _0x7f7e=['/:id/users','getUsers','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x59b439,_0x14ae7b){var _0x521ea3=function(_0x5af627){while(--_0x5af627){_0x59b439['push'](_0x59b439['shift']());}};_0x521ea3(++_0x14ae7b);}(_0x7f7e,0xc6));var _0xe7f7=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7f7e[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0xe7f7('0x0'));var util=require('util');var path=require(_0xe7f7('0x1'));var timeout=require(_0xe7f7('0x2'));var express=require(_0xe7f7('0x3'));var router=express['Router']();var fs_extra=require(_0xe7f7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe7f7('0x5'));var config=require(_0xe7f7('0x6'));var controller=require('./squareProject.controller');router['get']('/',auth[_0xe7f7('0x7')](),controller[_0xe7f7('0x8')]);router[_0xe7f7('0x9')](_0xe7f7('0xa'),auth[_0xe7f7('0x7')](),controller['show']);router[_0xe7f7('0x9')](_0xe7f7('0xb'),auth['isAuthenticated'](),controller[_0xe7f7('0xc')]);router[_0xe7f7('0xd')]('/',auth[_0xe7f7('0x7')](),controller[_0xe7f7('0xe')]);router[_0xe7f7('0xd')]('/:id/users',auth[_0xe7f7('0x7')](),controller['addUsers']);router[_0xe7f7('0xf')](_0xe7f7('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe7f7('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xe7f7('0x11')]);router[_0xe7f7('0x10')](_0xe7f7('0xb'),auth[_0xe7f7('0x7')](),controller['removeUsers']);module[_0xe7f7('0x12')]=router; \ No newline at end of file +var _0x66d4=['create','post','addUsers','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareProject.controller','isAuthenticated','index','get','/:id','/:id/users','getUsers'];(function(_0x54bdf6,_0x1af123){var _0x14123a=function(_0xed8ddc){while(--_0xed8ddc){_0x54bdf6['push'](_0x54bdf6['shift']());}};_0x14123a(++_0x1af123);}(_0x66d4,0x10b));var _0x466d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x66d4[_0x19950b];return _0x3c6b41;};'use strict';var multer=require('multer');var util=require(_0x466d('0x0'));var path=require('path');var timeout=require(_0x466d('0x1'));var express=require(_0x466d('0x2'));var router=express[_0x466d('0x3')]();var fs_extra=require(_0x466d('0x4'));var auth=require(_0x466d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x466d('0x6'));router['get']('/',auth[_0x466d('0x7')](),controller[_0x466d('0x8')]);router[_0x466d('0x9')](_0x466d('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x466d('0x9')](_0x466d('0xb'),auth[_0x466d('0x7')](),controller[_0x466d('0xc')]);router['post']('/',auth[_0x466d('0x7')](),controller[_0x466d('0xd')]);router[_0x466d('0xe')](_0x466d('0xb'),auth[_0x466d('0x7')](),controller[_0x466d('0xf')]);router[_0x466d('0x10')](_0x466d('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x466d('0x11')](_0x466d('0xa'),auth[_0x466d('0x7')](),controller[_0x466d('0x12')]);router[_0x466d('0x11')](_0x466d('0xb'),auth[_0x466d('0x7')](),controller['removeUsers']);module[_0x466d('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index e5c839d..0a8f3cf 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 _0x2c5e=['TEXT','BLOB','getDataValue','preproduction','toString','utf8','long','production','DATE','exports','STRING','name'];(function(_0x5ce43f,_0x168cef){var _0x111d45=function(_0x587309){while(--_0x587309){_0x5ce43f['push'](_0x5ce43f['shift']());}};_0x111d45(++_0x168cef);}(_0x2c5e,0x165));var _0xe2c5=function(_0x3f6c73,_0x3f815f){_0x3f6c73=_0x3f6c73-0x0;var _0x4ab118=_0x2c5e[_0x3f6c73];return _0x4ab118;};'use strict';var Sequelize=require('sequelize');module[_0xe2c5('0x0')]={'name':{'type':Sequelize[_0xe2c5('0x1')],'unique':_0xe2c5('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xe2c5('0x3')]},'preproduction':{'type':Sequelize[_0xe2c5('0x4')]('long'),'get':function(){if(this['getDataValue']('preproduction')){return this[_0xe2c5('0x5')](_0xe2c5('0x6'))[_0xe2c5('0x7')](_0xe2c5('0x8'));}}},'production':{'type':Sequelize[_0xe2c5('0x4')](_0xe2c5('0x9')),'get':function(){if(this[_0xe2c5('0x5')]('production')){return this['getDataValue'](_0xe2c5('0xa'))[_0xe2c5('0x7')](_0xe2c5('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xe2c5('0xb')]}}; \ No newline at end of file +var _0xcebb=['long','getDataValue','preproduction','toString','utf8','BLOB','production','DATE','sequelize','exports','STRING','TEXT'];(function(_0x4f26c9,_0x44c8e7){var _0x5f8cdf=function(_0x52baf0){while(--_0x52baf0){_0x4f26c9['push'](_0x4f26c9['shift']());}};_0x5f8cdf(++_0x44c8e7);}(_0xcebb,0x8c));var _0xbceb=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xcebb[_0x1deb03];return _0x189fe7;};'use strict';var Sequelize=require(_0xbceb('0x0'));module[_0xbceb('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xbceb('0x2')]},'notes':{'type':Sequelize[_0xbceb('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0xbceb('0x4')),'get':function(){if(this[_0xbceb('0x5')](_0xbceb('0x6'))){return this[_0xbceb('0x5')](_0xbceb('0x6'))[_0xbceb('0x7')](_0xbceb('0x8'));}}},'production':{'type':Sequelize[_0xbceb('0x9')](_0xbceb('0x4')),'get':function(){if(this['getDataValue']('production')){return this[_0xbceb('0x5')](_0xbceb('0xa'))[_0xbceb('0x7')](_0xbceb('0x8'));}}},'savedAt':{'type':Sequelize[_0xbceb('0xb')]},'publishedAt':{'type':Sequelize[_0xbceb('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index b09f0f7..7c7adf1 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 _0xe18e=['update','then','destroy','SquareProjects','UserProfileResource','error','stack','name','send','index','SquareProject','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','intersection','options','find','create','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addUsers','ids','omit','removeUsers','isArray','length','emit','userSquareProject:remove','getUsers','findOne','User','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xe18e,0x1b7));var _0xee18=function(_0x538c3a,_0x4e8042){_0x538c3a=_0x538c3a-0x0;var _0x5570ce=_0xe18e[_0x538c3a];return _0x5570ce;};'use strict';var emlformat=require(_0xee18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee18('0x1'));var jsonpatch=require(_0xee18('0x2'));var rp=require(_0xee18('0x3'));var moment=require('moment');var BPromise=require(_0xee18('0x4'));var Mustache=require(_0xee18('0x5'));var util=require(_0xee18('0x6'));var path=require('path');var sox=require(_0xee18('0x7'));var csv=require('to-csv');var ejs=require(_0xee18('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee18('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xee18('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xee18('0xb'));var Redis=require(_0xee18('0xc'));var authService=require(_0xee18('0xd'));var qs=require(_0xee18('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee18('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0xee18('0x10'));var config=require(_0xee18('0x11'));var licenseUtil=require(_0xee18('0x12'));var db=require(_0xee18('0x13'))['db'];config[_0xee18('0x14')]=_[_0xee18('0x15')](config[_0xee18('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xee18('0x16'))(new Redis(config[_0xee18('0x14')]));require(_0xee18('0x17'))[_0xee18('0x18')](socket);function respondWithStatusCode(_0x5cbf96,_0x15fcdf){_0x15fcdf=_0x15fcdf||0xcc;return function(_0x4ad0f7){if(_0x4ad0f7){return _0x5cbf96[_0xee18('0x19')](_0x15fcdf);}return _0x5cbf96[_0xee18('0x1a')](_0x15fcdf)[_0xee18('0x1b')]();};}function respondWithResult(_0x5dd29f,_0x20e46b){_0x20e46b=_0x20e46b||0xc8;return function(_0x25ccb5){if(_0x25ccb5){return _0x5dd29f['status'](_0x20e46b)['json'](_0x25ccb5);}};}function respondWithFilteredResult(_0x2bed2a,_0x4a1135){return function(_0x40707f){if(_0x40707f){var _0x498c97=typeof _0x4a1135[_0xee18('0x1c')]===_0xee18('0x1d')&&typeof _0x4a1135[_0xee18('0x1e')]===_0xee18('0x1d');var _0x13055b=_0x40707f[_0xee18('0x1f')];var _0x5e7321=_0x498c97?0x0:_0x4a1135[_0xee18('0x1c')];var _0x2e92ff=_0x498c97?_0x40707f[_0xee18('0x1f')]:_0x4a1135['offset']+_0x4a1135['limit'];var _0x1a1940;if(_0x2e92ff>=_0x13055b){_0x2e92ff=_0x13055b;_0x1a1940=0xc8;}else{_0x1a1940=0xce;}_0x2bed2a[_0xee18('0x1a')](_0x1a1940);return _0x2bed2a[_0xee18('0x20')](_0xee18('0x21'),_0x5e7321+'-'+_0x2e92ff+'/'+_0x13055b)['json'](_0x40707f);}return null;};}function patchUpdates(_0x102e56){return function(_0x4ee7a2){try{jsonpatch[_0xee18('0x22')](_0x4ee7a2,_0x102e56,!![]);}catch(_0x3d55c2){return BPromise['reject'](_0x3d55c2);}return _0x4ee7a2[_0xee18('0x23')]();};}function saveUpdates(_0x2809b6,_0x225e8a){return function(_0x55a4b7){if(_0x55a4b7){return _0x55a4b7[_0xee18('0x24')](_0x2809b6)[_0xee18('0x25')](function(_0x510ca7){return _0x510ca7;});}return null;};}function removeEntity(_0x4e5432,_0x66e3b3){return function(_0x5f4144){if(_0x5f4144){return _0x5f4144[_0xee18('0x26')]()[_0xee18('0x25')](function(){var _0x12a1d9=_0x5f4144['get']({'plain':!![]});var _0x28b389=_0xee18('0x27');return db[_0xee18('0x28')][_0xee18('0x26')]({'where':{'type':_0x28b389,'resourceId':_0x12a1d9['id']}})['then'](function(){return _0x5f4144;});})[_0xee18('0x25')](function(){_0x4e5432['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43d483,_0x49e495){return function(_0x126353){if(!_0x126353){_0x43d483[_0xee18('0x19')](0x194);}return _0x126353;};}function handleError(_0x565d54,_0x4a4bff){_0x4a4bff=_0x4a4bff||0x1f4;return function(_0x48639c){logger[_0xee18('0x29')](_0x48639c[_0xee18('0x2a')]);if(_0x48639c[_0xee18('0x2b')]){delete _0x48639c[_0xee18('0x2b')];}_0x565d54[_0xee18('0x1a')](_0x4a4bff)[_0xee18('0x2c')](_0x48639c);};}exports[_0xee18('0x2d')]=function(_0x3f1496,_0xe23f98){var _0x191b1f={},_0x1c8e25={},_0x30010d={'count':0x0,'rows':[]};var _0x4766a9=_['map'](db[_0xee18('0x2e')][_0xee18('0x2f')],function(_0x267905){return{'name':_0x267905[_0xee18('0x30')],'type':_0x267905[_0xee18('0x31')][_0xee18('0x32')]};});_0x1c8e25[_0xee18('0x33')]=_[_0xee18('0x34')](_0x4766a9,_0xee18('0x2b'));_0x1c8e25[_0xee18('0x35')]=_['keys'](_0x3f1496[_0xee18('0x35')]);_0x1c8e25[_0xee18('0x36')]=_['intersection'](_0x1c8e25['model'],_0x1c8e25[_0xee18('0x35')]);_0x191b1f[_0xee18('0x37')]=_['intersection'](_0x1c8e25[_0xee18('0x33')],qs[_0xee18('0x38')](_0x3f1496['query'][_0xee18('0x38')]));_0x191b1f[_0xee18('0x37')]=_0x191b1f['attributes']['length']?_0x191b1f[_0xee18('0x37')]:_0x1c8e25[_0xee18('0x33')];if(!_0x3f1496[_0xee18('0x35')]['hasOwnProperty'](_0xee18('0x39'))){_0x191b1f[_0xee18('0x1e')]=qs[_0xee18('0x1e')](_0x3f1496[_0xee18('0x35')][_0xee18('0x1e')]);_0x191b1f[_0xee18('0x1c')]=qs['offset'](_0x3f1496['query'][_0xee18('0x1c')]);}_0x191b1f[_0xee18('0x3a')]=qs[_0xee18('0x3b')](_0x3f1496[_0xee18('0x35')][_0xee18('0x3b')]);_0x191b1f[_0xee18('0x3c')]=qs[_0xee18('0x36')](_[_0xee18('0x3d')](_0x3f1496['query'],_0x1c8e25[_0xee18('0x36')]),_0x4766a9);if(_0x3f1496[_0xee18('0x35')][_0xee18('0x3e')]){_0x191b1f['where']=_[_0xee18('0x3f')](_0x191b1f[_0xee18('0x3c')],{'$or':_[_0xee18('0x34')](_0x4766a9,function(_0x41338e){if(_0x41338e['type']!==_0xee18('0x40')){var _0x2a519b={};_0x2a519b[_0x41338e[_0xee18('0x2b')]]={'$like':'%'+_0x3f1496[_0xee18('0x35')][_0xee18('0x3e')]+'%'};return _0x2a519b;}})});}_0x191b1f=_[_0xee18('0x3f')]({},_0x191b1f,_0x3f1496['options']);var _0x4a9abd={'where':_0x191b1f['where']};return db[_0xee18('0x2e')][_0xee18('0x1f')](_0x4a9abd)['then'](function(_0x46699f){_0x30010d[_0xee18('0x1f')]=_0x46699f;if(_0x3f1496[_0xee18('0x35')][_0xee18('0x41')]){_0x191b1f[_0xee18('0x42')]=[{'all':!![]}];}return db[_0xee18('0x2e')][_0xee18('0x43')](_0x191b1f);})[_0xee18('0x25')](function(_0x185295){_0x30010d[_0xee18('0x44')]=_0x185295;return _0x30010d;})['then'](respondWithFilteredResult(_0xe23f98,_0x191b1f))[_0xee18('0x45')](handleError(_0xe23f98,null));};exports[_0xee18('0x46')]=function(_0x102317,_0x3d71d2){var _0x5dd26e={'raw':![],'where':{'id':_0x102317[_0xee18('0x47')]['id']}},_0x210dbb={};_0x210dbb['model']=_[_0xee18('0x48')](db[_0xee18('0x2e')][_0xee18('0x2f')]);_0x210dbb[_0xee18('0x35')]=_[_0xee18('0x48')](_0x102317[_0xee18('0x35')]);_0x210dbb[_0xee18('0x36')]=_[_0xee18('0x49')](_0x210dbb[_0xee18('0x33')],_0x210dbb[_0xee18('0x35')]);_0x5dd26e['attributes']=_['intersection'](_0x210dbb[_0xee18('0x33')],qs['fields'](_0x102317[_0xee18('0x35')][_0xee18('0x38')]));_0x5dd26e[_0xee18('0x37')]=_0x5dd26e[_0xee18('0x37')]['length']?_0x5dd26e[_0xee18('0x37')]:_0x210dbb[_0xee18('0x33')];if(_0x102317[_0xee18('0x35')][_0xee18('0x41')]){_0x5dd26e[_0xee18('0x42')]=[{'all':!![]}];}_0x5dd26e=_[_0xee18('0x3f')]({},_0x5dd26e,_0x102317[_0xee18('0x4a')]);return db['SquareProject'][_0xee18('0x4b')](_0x5dd26e)[_0xee18('0x25')](handleEntityNotFound(_0x3d71d2,null))[_0xee18('0x25')](respondWithResult(_0x3d71d2,null))[_0xee18('0x45')](handleError(_0x3d71d2,null));};exports[_0xee18('0x4c')]=function(_0x481f4b,_0x40235e){return db['SquareProject']['create'](_0x481f4b['body'],{})['then'](function(_0x504094){var _0x3cedda=_0x481f4b['user'][_0xee18('0x4d')]({'plain':!![]});if(!_0x3cedda)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cedda[_0xee18('0x4e')]==='user'){var _0x3c11ee=_0x504094['get']({'plain':!![]});var _0x1bea6e=_0xee18('0x27');return db[_0xee18('0x4f')][_0xee18('0x4b')]({'where':{'name':_0x1bea6e,'userProfileId':_0x3cedda[_0xee18('0x50')]},'raw':!![]})['then'](function(_0x5749dc){if(_0x5749dc&&_0x5749dc[_0xee18('0x51')]===0x0){return db[_0xee18('0x28')]['create']({'name':_0x3c11ee[_0xee18('0x2b')],'resourceId':_0x3c11ee['id'],'type':_0x5749dc[_0xee18('0x2b')],'sectionId':_0x5749dc['id']},{})[_0xee18('0x25')](function(){return _0x504094;});}else{return _0x504094;}})[_0xee18('0x45')](function(_0x1cb0da){logger['error'](_0xee18('0x52'),_0x1cb0da);throw _0x1cb0da;});}return _0x504094;})['then'](respondWithResult(_0x40235e,0xc9))['catch'](handleError(_0x40235e,null));};exports[_0xee18('0x24')]=function(_0x426c89,_0x3e8a75){if(_0x426c89['body']['id']){delete _0x426c89['body']['id'];}return db[_0xee18('0x2e')][_0xee18('0x4b')]({'where':{'id':_0x426c89[_0xee18('0x47')]['id']}})[_0xee18('0x25')](handleEntityNotFound(_0x3e8a75,null))[_0xee18('0x25')](saveUpdates(_0x426c89[_0xee18('0x53')],null))[_0xee18('0x25')](respondWithResult(_0x3e8a75,null))[_0xee18('0x45')](handleError(_0x3e8a75,null));};exports[_0xee18('0x26')]=function(_0x2ae85b,_0x19d11b){return db['SquareProject'][_0xee18('0x4b')]({'where':{'id':_0x2ae85b[_0xee18('0x47')]['id']}})['then'](handleEntityNotFound(_0x19d11b,null))['then'](removeEntity(_0x19d11b,null))[_0xee18('0x45')](handleError(_0x19d11b,null));};exports[_0xee18('0x54')]=function(_0x20d0c5,_0x3d2084,_0x132ab6){return db[_0xee18('0x2e')][_0xee18('0x4b')]({'where':{'id':_0x20d0c5[_0xee18('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d2084,null))[_0xee18('0x25')](function(_0x57e0b0){if(_0x57e0b0){return _0x57e0b0[_0xee18('0x54')](_0x20d0c5[_0xee18('0x53')][_0xee18('0x55')],_[_0xee18('0x56')](_0x20d0c5[_0xee18('0x53')],['ids','id'])||{});}})['then'](respondWithResult(_0x3d2084,null))[_0xee18('0x45')](handleError(_0x3d2084,null));};exports['removeUsers']=function(_0x29af9b,_0x31db85,_0x37e35d){return db['SquareProject'][_0xee18('0x4b')]({'where':{'id':_0x29af9b[_0xee18('0x47')]['id']}})['then'](handleEntityNotFound(_0x31db85,null))['then'](function(_0x145a35){if(_0x145a35){return _0x145a35[_0xee18('0x57')](_0x29af9b[_0xee18('0x35')][_0xee18('0x55')])[_0xee18('0x25')](function(){if(_[_0xee18('0x58')](_0x29af9b[_0xee18('0x35')][_0xee18('0x55')])){for(var _0x30c909=0x0;_0x30c909<_0x29af9b['query'][_0xee18('0x55')][_0xee18('0x59')];_0x30c909+=0x1){socket[_0xee18('0x5a')](_0xee18('0x5b'),{'UserId':Number(_0x29af9b[_0xee18('0x35')][_0xee18('0x55')][_0x30c909]),'SquareProjectId':Number(_0x29af9b[_0xee18('0x47')]['id'])});}}else{socket['emit'](_0xee18('0x5b'),{'UserId':Number(_0x29af9b['query'][_0xee18('0x55')]),'SquareProjectId':Number(_0x29af9b[_0xee18('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x31db85,null))['catch'](handleError(_0x31db85,null));};exports[_0xee18('0x5c')]=function(_0x331038,_0x4be92,_0x2315a0){var _0x163ae9={};var _0x59c61d={};var _0x310860;var _0x590024;return db[_0xee18('0x2e')][_0xee18('0x5d')]({'where':{'id':_0x331038['params']['id']}})[_0xee18('0x25')](handleEntityNotFound(_0x4be92,null))[_0xee18('0x25')](function(_0x155c28){if(_0x155c28){_0x310860=_0x155c28;_0x59c61d[_0xee18('0x33')]=_[_0xee18('0x48')](db[_0xee18('0x5e')][_0xee18('0x2f')]);_0x59c61d[_0xee18('0x35')]=_[_0xee18('0x48')](_0x331038[_0xee18('0x35')]);_0x59c61d[_0xee18('0x36')]=_[_0xee18('0x49')](_0x59c61d[_0xee18('0x33')],_0x59c61d['query']);_0x163ae9[_0xee18('0x37')]=_[_0xee18('0x49')](_0x59c61d[_0xee18('0x33')],qs['fields'](_0x331038[_0xee18('0x35')]['fields']));_0x163ae9['attributes']=_0x163ae9[_0xee18('0x37')][_0xee18('0x59')]?_0x163ae9['attributes']:_0x59c61d[_0xee18('0x33')];_0x163ae9['order']=qs[_0xee18('0x3b')](_0x331038[_0xee18('0x35')][_0xee18('0x3b')]);_0x163ae9[_0xee18('0x3c')]=qs['filters'](_['pick'](_0x331038['query'],_0x59c61d[_0xee18('0x36')]));if(_0x331038[_0xee18('0x35')]['filter']){_0x163ae9['where']=_[_0xee18('0x3f')](_0x163ae9[_0xee18('0x3c')],{'$or':_['map'](_0x163ae9[_0xee18('0x37')],function(_0x4b896d){var _0x3d30a3={};_0x3d30a3[_0x4b896d]={'$like':'%'+_0x331038[_0xee18('0x35')][_0xee18('0x3e')]+'%'};return _0x3d30a3;})});}_0x163ae9=_[_0xee18('0x3f')]({},_0x163ae9,_0x331038[_0xee18('0x4a')]);return _0x310860[_0xee18('0x5c')](_0x163ae9);}})[_0xee18('0x25')](function(_0x46a99f){if(_0x46a99f){_0x590024=_0x46a99f[_0xee18('0x59')];if(!_0x331038['query']['hasOwnProperty'](_0xee18('0x39'))){_0x163ae9[_0xee18('0x1e')]=qs['limit'](_0x331038[_0xee18('0x35')]['limit']);_0x163ae9[_0xee18('0x1c')]=qs['offset'](_0x331038[_0xee18('0x35')][_0xee18('0x1c')]);}return _0x310860[_0xee18('0x5c')](_0x163ae9);}})[_0xee18('0x25')](function(_0x5d7ebf){if(_0x5d7ebf){return _0x5d7ebf?{'count':_0x590024,'rows':_0x5d7ebf}:null;}})[_0xee18('0x25')](respondWithResult(_0x4be92,null))[_0xee18('0x45')](handleError(_0x4be92,null));}; \ No newline at end of file +var _0xd3a4=['rows','catch','show','includeAll','create','user','role','SquareProjects','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','getUsers','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','get','UserProfileResource','error','stack','name','index','map','SquareProject','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll'];(function(_0x33eb5c,_0x4a7d98){var _0x253328=function(_0x3b23a0){while(--_0x3b23a0){_0x33eb5c['push'](_0x33eb5c['shift']());}};_0x253328(++_0x4a7d98);}(_0xd3a4,0xd5));var _0x4d3a=function(_0x7738a7,_0x2fc935){_0x7738a7=_0x7738a7-0x0;var _0x4302a2=_0xd3a4[_0x7738a7];return _0x4302a2;};'use strict';var emlformat=require(_0x4d3a('0x0'));var rimraf=require(_0x4d3a('0x1'));var zipdir=require(_0x4d3a('0x2'));var jsonpatch=require(_0x4d3a('0x3'));var rp=require(_0x4d3a('0x4'));var moment=require('moment');var BPromise=require(_0x4d3a('0x5'));var Mustache=require(_0x4d3a('0x6'));var util=require(_0x4d3a('0x7'));var path=require(_0x4d3a('0x8'));var sox=require(_0x4d3a('0x9'));var csv=require('to-csv');var ejs=require(_0x4d3a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4d3a('0xb'));var crypto=require(_0x4d3a('0xc'));var jsforce=require(_0x4d3a('0xd'));var deskjs=require(_0x4d3a('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4d3a('0xf'));var Papa=require(_0x4d3a('0x10'));var Redis=require(_0x4d3a('0x11'));var authService=require(_0x4d3a('0x12'));var qs=require(_0x4d3a('0x13'));var as=require(_0x4d3a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4d3a('0x15'));var config=require(_0x4d3a('0x16'));var licenseUtil=require(_0x4d3a('0x17'));var db=require('../../mysqldb')['db'];config[_0x4d3a('0x18')]=_[_0x4d3a('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4d3a('0x1a'))(new Redis(config['redis']));require(_0x4d3a('0x1b'))[_0x4d3a('0x1c')](socket);function respondWithStatusCode(_0x23a0c3,_0x50270a){_0x50270a=_0x50270a||0xcc;return function(_0x1b0c2c){if(_0x1b0c2c){return _0x23a0c3[_0x4d3a('0x1d')](_0x50270a);}return _0x23a0c3[_0x4d3a('0x1e')](_0x50270a)[_0x4d3a('0x1f')]();};}function respondWithResult(_0x8a714,_0x278c37){_0x278c37=_0x278c37||0xc8;return function(_0x181379){if(_0x181379){return _0x8a714[_0x4d3a('0x1e')](_0x278c37)['json'](_0x181379);}};}function respondWithFilteredResult(_0x51362f,_0x37994e){return function(_0x509891){if(_0x509891){var _0x4a8777=typeof _0x37994e[_0x4d3a('0x20')]===_0x4d3a('0x21')&&typeof _0x37994e['limit']===_0x4d3a('0x21');var _0x3ac7a1=_0x509891[_0x4d3a('0x22')];var _0x4d0fd3=_0x4a8777?0x0:_0x37994e[_0x4d3a('0x20')];var _0x72213a=_0x4a8777?_0x509891['count']:_0x37994e['offset']+_0x37994e[_0x4d3a('0x23')];var _0x3dc9ac;if(_0x72213a>=_0x3ac7a1){_0x72213a=_0x3ac7a1;_0x3dc9ac=0xc8;}else{_0x3dc9ac=0xce;}_0x51362f[_0x4d3a('0x1e')](_0x3dc9ac);return _0x51362f[_0x4d3a('0x24')](_0x4d3a('0x25'),_0x4d0fd3+'-'+_0x72213a+'/'+_0x3ac7a1)['json'](_0x509891);}return null;};}function patchUpdates(_0x133912){return function(_0x372e48){try{jsonpatch[_0x4d3a('0x26')](_0x372e48,_0x133912,!![]);}catch(_0x5bdac3){return BPromise['reject'](_0x5bdac3);}return _0x372e48[_0x4d3a('0x27')]();};}function saveUpdates(_0x45c712,_0x1ec005){return function(_0xddfa32){if(_0xddfa32){return _0xddfa32[_0x4d3a('0x28')](_0x45c712)[_0x4d3a('0x29')](function(_0x23f21a){return _0x23f21a;});}return null;};}function removeEntity(_0xedfb9a,_0x23ce37){return function(_0x3c8f34){if(_0x3c8f34){return _0x3c8f34['destroy']()['then'](function(){var _0x4a7af2=_0x3c8f34[_0x4d3a('0x2a')]({'plain':!![]});var _0x498be5='SquareProjects';return db[_0x4d3a('0x2b')]['destroy']({'where':{'type':_0x498be5,'resourceId':_0x4a7af2['id']}})[_0x4d3a('0x29')](function(){return _0x3c8f34;});})[_0x4d3a('0x29')](function(){_0xedfb9a[_0x4d3a('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x170b63,_0x52509f){return function(_0x2eff20){if(!_0x2eff20){_0x170b63[_0x4d3a('0x1d')](0x194);}return _0x2eff20;};}function handleError(_0x47d6e8,_0x193e37){_0x193e37=_0x193e37||0x1f4;return function(_0x5b485d){logger[_0x4d3a('0x2c')](_0x5b485d[_0x4d3a('0x2d')]);if(_0x5b485d['name']){delete _0x5b485d[_0x4d3a('0x2e')];}_0x47d6e8[_0x4d3a('0x1e')](_0x193e37)['send'](_0x5b485d);};}exports[_0x4d3a('0x2f')]=function(_0x32bfd3,_0xa666c6){var _0x5df676={},_0x3f2d39={},_0x417c66={'count':0x0,'rows':[]};var _0x2282d5=_[_0x4d3a('0x30')](db[_0x4d3a('0x31')][_0x4d3a('0x32')],function(_0x5e9193){return{'name':_0x5e9193['fieldName'],'type':_0x5e9193[_0x4d3a('0x33')][_0x4d3a('0x34')]};});_0x3f2d39[_0x4d3a('0x35')]=_[_0x4d3a('0x30')](_0x2282d5,'name');_0x3f2d39[_0x4d3a('0x36')]=_[_0x4d3a('0x37')](_0x32bfd3[_0x4d3a('0x36')]);_0x3f2d39[_0x4d3a('0x38')]=_[_0x4d3a('0x39')](_0x3f2d39['model'],_0x3f2d39[_0x4d3a('0x36')]);_0x5df676[_0x4d3a('0x3a')]=_[_0x4d3a('0x39')](_0x3f2d39[_0x4d3a('0x35')],qs[_0x4d3a('0x3b')](_0x32bfd3[_0x4d3a('0x36')][_0x4d3a('0x3b')]));_0x5df676[_0x4d3a('0x3a')]=_0x5df676[_0x4d3a('0x3a')][_0x4d3a('0x3c')]?_0x5df676[_0x4d3a('0x3a')]:_0x3f2d39[_0x4d3a('0x35')];if(!_0x32bfd3[_0x4d3a('0x36')][_0x4d3a('0x3d')](_0x4d3a('0x3e'))){_0x5df676['limit']=qs[_0x4d3a('0x23')](_0x32bfd3['query'][_0x4d3a('0x23')]);_0x5df676[_0x4d3a('0x20')]=qs[_0x4d3a('0x20')](_0x32bfd3[_0x4d3a('0x36')][_0x4d3a('0x20')]);}_0x5df676[_0x4d3a('0x3f')]=qs['sort'](_0x32bfd3[_0x4d3a('0x36')][_0x4d3a('0x40')]);_0x5df676[_0x4d3a('0x41')]=qs['filters'](_[_0x4d3a('0x42')](_0x32bfd3['query'],_0x3f2d39['filters']),_0x2282d5);if(_0x32bfd3[_0x4d3a('0x36')][_0x4d3a('0x43')]){_0x5df676[_0x4d3a('0x41')]=_[_0x4d3a('0x44')](_0x5df676['where'],{'$or':_[_0x4d3a('0x30')](_0x2282d5,function(_0x1cce51){if(_0x1cce51[_0x4d3a('0x33')]!=='VIRTUAL'){var _0x56baec={};_0x56baec[_0x1cce51[_0x4d3a('0x2e')]]={'$like':'%'+_0x32bfd3[_0x4d3a('0x36')][_0x4d3a('0x43')]+'%'};return _0x56baec;}})});}_0x5df676=_[_0x4d3a('0x44')]({},_0x5df676,_0x32bfd3[_0x4d3a('0x45')]);var _0xfc5059={'where':_0x5df676[_0x4d3a('0x41')]};return db['SquareProject'][_0x4d3a('0x22')](_0xfc5059)[_0x4d3a('0x29')](function(_0x1c9ca2){_0x417c66[_0x4d3a('0x22')]=_0x1c9ca2;if(_0x32bfd3[_0x4d3a('0x36')]['includeAll']){_0x5df676[_0x4d3a('0x46')]=[{'all':!![]}];}return db[_0x4d3a('0x31')][_0x4d3a('0x47')](_0x5df676);})[_0x4d3a('0x29')](function(_0x2d88c4){_0x417c66[_0x4d3a('0x48')]=_0x2d88c4;return _0x417c66;})[_0x4d3a('0x29')](respondWithFilteredResult(_0xa666c6,_0x5df676))[_0x4d3a('0x49')](handleError(_0xa666c6,null));};exports[_0x4d3a('0x4a')]=function(_0xdc8249,_0x410bb5){var _0x24332a={'raw':![],'where':{'id':_0xdc8249['params']['id']}},_0x5d88a1={};_0x5d88a1[_0x4d3a('0x35')]=_[_0x4d3a('0x37')](db[_0x4d3a('0x31')][_0x4d3a('0x32')]);_0x5d88a1[_0x4d3a('0x36')]=_[_0x4d3a('0x37')](_0xdc8249[_0x4d3a('0x36')]);_0x5d88a1[_0x4d3a('0x38')]=_[_0x4d3a('0x39')](_0x5d88a1[_0x4d3a('0x35')],_0x5d88a1['query']);_0x24332a[_0x4d3a('0x3a')]=_[_0x4d3a('0x39')](_0x5d88a1[_0x4d3a('0x35')],qs[_0x4d3a('0x3b')](_0xdc8249[_0x4d3a('0x36')][_0x4d3a('0x3b')]));_0x24332a[_0x4d3a('0x3a')]=_0x24332a[_0x4d3a('0x3a')][_0x4d3a('0x3c')]?_0x24332a[_0x4d3a('0x3a')]:_0x5d88a1[_0x4d3a('0x35')];if(_0xdc8249[_0x4d3a('0x36')][_0x4d3a('0x4b')]){_0x24332a[_0x4d3a('0x46')]=[{'all':!![]}];}_0x24332a=_[_0x4d3a('0x44')]({},_0x24332a,_0xdc8249['options']);return db['SquareProject']['find'](_0x24332a)[_0x4d3a('0x29')](handleEntityNotFound(_0x410bb5,null))['then'](respondWithResult(_0x410bb5,null))['catch'](handleError(_0x410bb5,null));};exports['create']=function(_0x59478b,_0x544589){return db[_0x4d3a('0x31')][_0x4d3a('0x4c')](_0x59478b['body'],{})[_0x4d3a('0x29')](function(_0x4e43fd){var _0x2c2feb=_0x59478b[_0x4d3a('0x4d')][_0x4d3a('0x2a')]({'plain':!![]});if(!_0x2c2feb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c2feb[_0x4d3a('0x4e')]==='user'){var _0x5eeefc=_0x4e43fd[_0x4d3a('0x2a')]({'plain':!![]});var _0x194f7f=_0x4d3a('0x4f');return db[_0x4d3a('0x50')][_0x4d3a('0x51')]({'where':{'name':_0x194f7f,'userProfileId':_0x2c2feb['userProfileId']},'raw':!![]})[_0x4d3a('0x29')](function(_0x211b88){if(_0x211b88&&_0x211b88['autoAssociation']===0x0){return db[_0x4d3a('0x2b')][_0x4d3a('0x4c')]({'name':_0x5eeefc['name'],'resourceId':_0x5eeefc['id'],'type':_0x211b88[_0x4d3a('0x2e')],'sectionId':_0x211b88['id']},{})[_0x4d3a('0x29')](function(){return _0x4e43fd;});}else{return _0x4e43fd;}})[_0x4d3a('0x49')](function(_0x2d31b4){logger['error'](_0x4d3a('0x52'),_0x2d31b4);throw _0x2d31b4;});}return _0x4e43fd;})['then'](respondWithResult(_0x544589,0xc9))[_0x4d3a('0x49')](handleError(_0x544589,null));};exports['update']=function(_0x21ec65,_0x1e06ab){if(_0x21ec65[_0x4d3a('0x53')]['id']){delete _0x21ec65[_0x4d3a('0x53')]['id'];}return db[_0x4d3a('0x31')][_0x4d3a('0x51')]({'where':{'id':_0x21ec65[_0x4d3a('0x54')]['id']}})[_0x4d3a('0x29')](handleEntityNotFound(_0x1e06ab,null))[_0x4d3a('0x29')](saveUpdates(_0x21ec65[_0x4d3a('0x53')],null))[_0x4d3a('0x29')](respondWithResult(_0x1e06ab,null))[_0x4d3a('0x49')](handleError(_0x1e06ab,null));};exports['destroy']=function(_0xd59702,_0xd4cb0){return db[_0x4d3a('0x31')][_0x4d3a('0x51')]({'where':{'id':_0xd59702[_0x4d3a('0x54')]['id']}})['then'](handleEntityNotFound(_0xd4cb0,null))['then'](removeEntity(_0xd4cb0,null))['catch'](handleError(_0xd4cb0,null));};exports[_0x4d3a('0x55')]=function(_0x55c430,_0x20d6bd,_0x280b6a){return db[_0x4d3a('0x31')][_0x4d3a('0x51')]({'where':{'id':_0x55c430[_0x4d3a('0x54')]['id']}})[_0x4d3a('0x29')](handleEntityNotFound(_0x20d6bd,null))[_0x4d3a('0x29')](function(_0x1d278d){if(_0x1d278d){return _0x1d278d[_0x4d3a('0x55')](_0x55c430['body'][_0x4d3a('0x56')],_[_0x4d3a('0x57')](_0x55c430[_0x4d3a('0x53')],[_0x4d3a('0x56'),'id'])||{});}})[_0x4d3a('0x29')](respondWithResult(_0x20d6bd,null))['catch'](handleError(_0x20d6bd,null));};exports[_0x4d3a('0x58')]=function(_0xcca709,_0x3e4535,_0x39fdb0){return db[_0x4d3a('0x31')]['find']({'where':{'id':_0xcca709[_0x4d3a('0x54')]['id']}})[_0x4d3a('0x29')](handleEntityNotFound(_0x3e4535,null))[_0x4d3a('0x29')](function(_0x76d9d0){if(_0x76d9d0){return _0x76d9d0[_0x4d3a('0x58')](_0xcca709[_0x4d3a('0x36')][_0x4d3a('0x56')])['then'](function(){if(_[_0x4d3a('0x59')](_0xcca709[_0x4d3a('0x36')][_0x4d3a('0x56')])){for(var _0x30a57b=0x0;_0x30a57b<_0xcca709[_0x4d3a('0x36')][_0x4d3a('0x56')][_0x4d3a('0x3c')];_0x30a57b+=0x1){socket[_0x4d3a('0x5a')](_0x4d3a('0x5b'),{'UserId':Number(_0xcca709[_0x4d3a('0x36')][_0x4d3a('0x56')][_0x30a57b]),'SquareProjectId':Number(_0xcca709['params']['id'])});}}else{socket[_0x4d3a('0x5a')]('userSquareProject:remove',{'UserId':Number(_0xcca709['query']['ids']),'SquareProjectId':Number(_0xcca709['params']['id'])});}});}})[_0x4d3a('0x29')](respondWithStatusCode(_0x3e4535,null))['catch'](handleError(_0x3e4535,null));};exports['getUsers']=function(_0x2c0f3e,_0x1db58f,_0x35af4f){var _0x306857={};var _0x399f74={};var _0x5412d4;var _0x2b18f0;return db[_0x4d3a('0x31')][_0x4d3a('0x5c')]({'where':{'id':_0x2c0f3e['params']['id']}})[_0x4d3a('0x29')](handleEntityNotFound(_0x1db58f,null))[_0x4d3a('0x29')](function(_0x1241cb){if(_0x1241cb){_0x5412d4=_0x1241cb;_0x399f74[_0x4d3a('0x35')]=_[_0x4d3a('0x37')](db[_0x4d3a('0x5d')][_0x4d3a('0x32')]);_0x399f74[_0x4d3a('0x36')]=_[_0x4d3a('0x37')](_0x2c0f3e[_0x4d3a('0x36')]);_0x399f74[_0x4d3a('0x38')]=_['intersection'](_0x399f74[_0x4d3a('0x35')],_0x399f74[_0x4d3a('0x36')]);_0x306857[_0x4d3a('0x3a')]=_[_0x4d3a('0x39')](_0x399f74[_0x4d3a('0x35')],qs[_0x4d3a('0x3b')](_0x2c0f3e['query'][_0x4d3a('0x3b')]));_0x306857[_0x4d3a('0x3a')]=_0x306857[_0x4d3a('0x3a')][_0x4d3a('0x3c')]?_0x306857[_0x4d3a('0x3a')]:_0x399f74[_0x4d3a('0x35')];_0x306857[_0x4d3a('0x3f')]=qs['sort'](_0x2c0f3e[_0x4d3a('0x36')][_0x4d3a('0x40')]);_0x306857[_0x4d3a('0x41')]=qs['filters'](_[_0x4d3a('0x42')](_0x2c0f3e['query'],_0x399f74[_0x4d3a('0x38')]));if(_0x2c0f3e[_0x4d3a('0x36')][_0x4d3a('0x43')]){_0x306857['where']=_[_0x4d3a('0x44')](_0x306857['where'],{'$or':_[_0x4d3a('0x30')](_0x306857[_0x4d3a('0x3a')],function(_0x148d9e){var _0x547f9a={};_0x547f9a[_0x148d9e]={'$like':'%'+_0x2c0f3e[_0x4d3a('0x36')][_0x4d3a('0x43')]+'%'};return _0x547f9a;})});}_0x306857=_['merge']({},_0x306857,_0x2c0f3e[_0x4d3a('0x45')]);return _0x5412d4[_0x4d3a('0x5e')](_0x306857);}})['then'](function(_0xb61d6c){if(_0xb61d6c){_0x2b18f0=_0xb61d6c['length'];if(!_0x2c0f3e['query'][_0x4d3a('0x3d')]('nolimit')){_0x306857['limit']=qs[_0x4d3a('0x23')](_0x2c0f3e[_0x4d3a('0x36')][_0x4d3a('0x23')]);_0x306857[_0x4d3a('0x20')]=qs[_0x4d3a('0x20')](_0x2c0f3e[_0x4d3a('0x36')]['offset']);}return _0x5412d4[_0x4d3a('0x5e')](_0x306857);}})[_0x4d3a('0x29')](function(_0x338387){if(_0x338387){return _0x338387?{'count':_0x2b18f0,'rows':_0x338387}:null;}})['then'](respondWithResult(_0x1db58f,null))[_0x4d3a('0x49')](handleError(_0x1db58f,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 82f5f48..17b99a6 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 _0x0202=['exports','events','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x308374,_0x550e85){var _0x1f71e0=function(_0x18377d){while(--_0x18377d){_0x308374['push'](_0x308374['shift']());}};_0x1f71e0(++_0x550e85);}(_0x0202,0x7f));var _0x2020=function(_0x50af98,_0x2faf82){_0x50af98=_0x50af98-0x0;var _0x1acfa1=_0x0202[_0x50af98];return _0x1acfa1;};'use strict';var EventEmitter=require(_0x2020('0x0'));var SquareProject=require(_0x2020('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x2020('0x2')](0x0);var events={'afterCreate':_0x2020('0x3'),'afterUpdate':'update','afterDestroy':_0x2020('0x4')};function emitEvent(_0x4dd1cb){return function(_0x84a8ad,_0x2c74c6,_0x122862){SquareProjectEvents['emit'](_0x4dd1cb+':'+_0x84a8ad['id'],_0x84a8ad);SquareProjectEvents[_0x2020('0x5')](_0x4dd1cb,_0x84a8ad);_0x122862(null);};}for(var e in events){if(events[_0x2020('0x6')](e)){var event=events[e];SquareProject[_0x2020('0x7')](e,emitEvent(event));}}module[_0x2020('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x99cb=['save','remove','hasOwnProperty','hook','exports','../../mysqldb','SquareProject','setMaxListeners'];(function(_0x4a09a8,_0x4ed12d){var _0x7d30a9=function(_0x459184){while(--_0x459184){_0x4a09a8['push'](_0x4a09a8['shift']());}};_0x7d30a9(++_0x4ed12d);}(_0x99cb,0xdd));var _0xb99c=function(_0xd8c497,_0x5c309a){_0xd8c497=_0xd8c497-0x0;var _0x11b0c0=_0x99cb[_0xd8c497];return _0x11b0c0;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xb99c('0x0'))['db'][_0xb99c('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xb99c('0x2')](0x0);var events={'afterCreate':_0xb99c('0x3'),'afterUpdate':'update','afterDestroy':_0xb99c('0x4')};function emitEvent(_0x26d9e0){return function(_0xcfa5bd,_0x303022,_0x235b41){SquareProjectEvents['emit'](_0x26d9e0+':'+_0xcfa5bd['id'],_0xcfa5bd);SquareProjectEvents['emit'](_0x26d9e0,_0xcfa5bd);_0x235b41(null);};}for(var e in events){if(events[_0xb99c('0x5')](e)){var event=events[e];SquareProject[_0xb99c('0x6')](e,emitEvent(event));}}module[_0xb99c('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 574c500..5f22aaa 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 _0x9a64=['YYYY-MM-DD\x20HH:mm:ss','publishedAt','format','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SquareProject','square_projects','changed','preproduction','savedAt'];(function(_0x306081,_0x293f4a){var _0x4b2509=function(_0xf04478){while(--_0xf04478){_0x306081['push'](_0x306081['shift']());}};_0x4b2509(++_0x293f4a);}(_0x9a64,0x10d));var _0x49a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a64[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x49a6('0x0'));var util=require(_0x49a6('0x1'));var logger=require(_0x49a6('0x2'))(_0x49a6('0x3'));var moment=require(_0x49a6('0x4'));var BPromise=require(_0x49a6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x49a6('0x6'));var rimraf=require(_0x49a6('0x7'));var config=require(_0x49a6('0x8'));var attributes=require('./squareProject.attributes');module[_0x49a6('0x9')]=function(_0x470521,_0x455a4e){return _0x470521[_0x49a6('0xa')](_0x49a6('0xb'),attributes,{'tableName':_0x49a6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xf90c61,_0x443734,_0x4ee0be){if(_0xf90c61[_0x49a6('0xd')](_0x49a6('0xe'))){_0xf90c61[_0x49a6('0xf')]=moment()['format'](_0x49a6('0x10'));}if(_0xf90c61[_0x49a6('0xd')]('production')){_0xf90c61[_0x49a6('0x11')]=moment()[_0x49a6('0x12')](_0x49a6('0x10'));}_0x4ee0be(null,_0xf90c61);}}});}; \ No newline at end of file +var _0xa67e=['exports','SquareProject','square_projects','changed','preproduction','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','../../config/environment','./squareProject.attributes'];(function(_0x5bf34e,_0x893718){var _0x1ca9dc=function(_0x4476ea){while(--_0x4476ea){_0x5bf34e['push'](_0x5bf34e['shift']());}};_0x1ca9dc(++_0x893718);}(_0xa67e,0x11a));var _0xea67=function(_0x294fca,_0x5ec8a0){_0x294fca=_0x294fca-0x0;var _0x2d1d06=_0xa67e[_0x294fca];return _0x2d1d06;};'use strict';var _=require(_0xea67('0x0'));var util=require(_0xea67('0x1'));var logger=require(_0xea67('0x2'))('api');var moment=require(_0xea67('0x3'));var BPromise=require(_0xea67('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xea67('0x5'));var attributes=require(_0xea67('0x6'));module[_0xea67('0x7')]=function(_0x4ec6e4,_0x43c7de){return _0x4ec6e4['define'](_0xea67('0x8'),attributes,{'tableName':_0xea67('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57dd1b,_0x5ea831,_0x1a71b8){if(_0x57dd1b[_0xea67('0xa')](_0xea67('0xb'))){_0x57dd1b[_0xea67('0xc')]=moment()[_0xea67('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x57dd1b[_0xea67('0xa')](_0xea67('0xe'))){_0x57dd1b[_0xea67('0xf')]=moment()[_0xea67('0xd')](_0xea67('0x10'));}_0x1a71b8(null,_0x57dd1b);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 7976b63..74fb809 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 _0x723f=['map','catch','lodash','moment','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./squareProject.socket','register','then','info','SquareProject,\x20%s,\x20%s','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','ShowSquareProject','SquareProject','find','options','where','attributes','include','model'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x723f,0x1de));var _0xf723=function(_0x5d0606,_0x4bfe2e){_0x5d0606=_0x5d0606-0x0;var _0x513ee1=_0x723f[_0x5d0606];return _0x513ee1;};'use strict';var _=require(_0xf723('0x0'));var util=require('util');var moment=require(_0xf723('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf723('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xf723('0x3'))('rpc');var config=require(_0xf723('0x4'));var jayson=require(_0xf723('0x5'));var client=jayson[_0xf723('0x6')][_0xf723('0x7')]({'port':0x232a});config[_0xf723('0x8')]=_[_0xf723('0x9')](config[_0xf723('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xf723('0xa'))(new Redis(config[_0xf723('0x8')]));require(_0xf723('0xb'))[_0xf723('0xc')](socket);function respondWithRpcPromise(_0x43c0f1,_0x13a22d,_0x165d75){return new BPromise(function(_0x5cf234,_0x546c64){return client['request'](_0x43c0f1,_0x165d75)[_0xf723('0xd')](function(_0x57e749){logger[_0xf723('0xe')](_0xf723('0xf'),_0x13a22d,'request\x20sent');logger[_0xf723('0x10')](_0xf723('0x11'),_0x13a22d,'request\x20sent',JSON[_0xf723('0x12')](_0x57e749));if(_0x57e749[_0xf723('0x13')]){if(_0x57e749[_0xf723('0x13')][_0xf723('0x14')]===0x1f4){logger[_0xf723('0x13')](_0xf723('0xf'),_0x13a22d,_0x57e749[_0xf723('0x13')][_0xf723('0x15')]);return _0x546c64(_0x57e749[_0xf723('0x13')]['message']);}logger['error'](_0xf723('0xf'),_0x13a22d,_0x57e749[_0xf723('0x13')][_0xf723('0x15')]);return _0x5cf234(_0x57e749[_0xf723('0x13')]['message']);}else{logger[_0xf723('0xe')]('SquareProject,\x20%s,\x20%s',_0x13a22d,_0xf723('0x16'));_0x5cf234(_0x57e749[_0xf723('0x17')][_0xf723('0x15')]);}})['catch'](function(_0x4cd8b){logger[_0xf723('0x13')](_0xf723('0xf'),_0x13a22d,_0x4cd8b);_0x546c64(_0x4cd8b);});});}exports[_0xf723('0x18')]=function(_0x2ac15c){var _0x1910da=this;return new Promise(function(_0x17e287,_0x11eec9){return db[_0xf723('0x19')][_0xf723('0x1a')]({'raw':_0x2ac15c['options']?_0x2ac15c[_0xf723('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2ac15c[_0xf723('0x1b')]?_0x2ac15c['options'][_0xf723('0x1c')]||null:null,'attributes':_0x2ac15c[_0xf723('0x1b')]?_0x2ac15c[_0xf723('0x1b')][_0xf723('0x1d')]||null:null,'include':_0x2ac15c[_0xf723('0x1b')]?_0x2ac15c[_0xf723('0x1b')]['include']?_['map'](_0x2ac15c[_0xf723('0x1b')][_0xf723('0x1e')],function(_0x24adc7){return{'model':db[_0x24adc7[_0xf723('0x1f')]],'as':_0x24adc7['as'],'attributes':_0x24adc7[_0xf723('0x1d')],'include':_0x24adc7[_0xf723('0x1e')]?_[_0xf723('0x20')](_0x24adc7['include'],function(_0x173bdc){return{'model':db[_0x173bdc['model']],'as':_0x173bdc['as'],'attributes':_0x173bdc['attributes'],'include':_0x173bdc['include']?_['map'](_0x173bdc[_0xf723('0x1e')],function(_0x147371){return{'model':db[_0x147371[_0xf723('0x1f')]],'as':_0x147371['as'],'attributes':_0x147371[_0xf723('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf723('0xd')](function(_0x2b4fa1){logger[_0xf723('0xe')](_0xf723('0x18'),_0x2ac15c);logger[_0xf723('0x10')]('ShowSquareProject',_0x2ac15c,JSON[_0xf723('0x12')](_0x2b4fa1));_0x17e287(_0x2b4fa1);})[_0xf723('0x21')](function(_0x34c0ee){logger['error']('ShowSquareProject',_0x34c0ee[_0xf723('0x15')],_0x2ac15c);_0x11eec9(_0x1910da[_0xf723('0x13')](0x1f4,_0x34c0ee[_0xf723('0x15')]));});});}; \ No newline at end of file +var _0xcdf7=['moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','then','info','request\x20sent','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','SquareProject,\x20%s,\x20%s','message','result','catch','ShowSquareProject','SquareProject','find','options','where','attributes','include','map','model'];(function(_0x38d887,_0x261d68){var _0x84c717=function(_0x4c5a40){while(--_0x4c5a40){_0x38d887['push'](_0x38d887['shift']());}};_0x84c717(++_0x261d68);}(_0xcdf7,0x108));var _0x7cdf=function(_0x13db38,_0x3d1295){_0x13db38=_0x13db38-0x0;var _0x478fa7=_0xcdf7[_0x13db38];return _0x478fa7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7cdf('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7cdf('0x1'))['db'];var utils=require(_0x7cdf('0x2'));var logger=require('../../config/logger')(_0x7cdf('0x3'));var config=require(_0x7cdf('0x4'));var jayson=require(_0x7cdf('0x5'));var client=jayson[_0x7cdf('0x6')][_0x7cdf('0x7')]({'port':0x232a});config['redis']=_[_0x7cdf('0x8')](config[_0x7cdf('0x9')],{'host':_0x7cdf('0xa'),'port':0x18eb});var socket=require(_0x7cdf('0xb'))(new Redis(config[_0x7cdf('0x9')]));require(_0x7cdf('0xc'))[_0x7cdf('0xd')](socket);function respondWithRpcPromise(_0x4a7799,_0x41493e,_0xa2361){return new BPromise(function(_0x1259f3,_0x42c676){return client['request'](_0x4a7799,_0xa2361)[_0x7cdf('0xe')](function(_0x4eb095){logger[_0x7cdf('0xf')]('SquareProject,\x20%s,\x20%s',_0x41493e,_0x7cdf('0x10'));logger['debug'](_0x7cdf('0x11'),_0x41493e,_0x7cdf('0x10'),JSON[_0x7cdf('0x12')](_0x4eb095));if(_0x4eb095[_0x7cdf('0x13')]){if(_0x4eb095[_0x7cdf('0x13')]['code']===0x1f4){logger[_0x7cdf('0x13')](_0x7cdf('0x14'),_0x41493e,_0x4eb095[_0x7cdf('0x13')][_0x7cdf('0x15')]);return _0x42c676(_0x4eb095['error'][_0x7cdf('0x15')]);}logger[_0x7cdf('0x13')](_0x7cdf('0x14'),_0x41493e,_0x4eb095[_0x7cdf('0x13')][_0x7cdf('0x15')]);return _0x1259f3(_0x4eb095[_0x7cdf('0x13')][_0x7cdf('0x15')]);}else{logger[_0x7cdf('0xf')](_0x7cdf('0x14'),_0x41493e,_0x7cdf('0x10'));_0x1259f3(_0x4eb095[_0x7cdf('0x16')][_0x7cdf('0x15')]);}})[_0x7cdf('0x17')](function(_0x30defd){logger[_0x7cdf('0x13')]('SquareProject,\x20%s,\x20%s',_0x41493e,_0x30defd);_0x42c676(_0x30defd);});});}exports[_0x7cdf('0x18')]=function(_0x54ce63){var _0x1ff48f=this;return new Promise(function(_0x214f96,_0x571d26){return db[_0x7cdf('0x19')][_0x7cdf('0x1a')]({'raw':_0x54ce63['options']?_0x54ce63[_0x7cdf('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x54ce63['options']?_0x54ce63['options'][_0x7cdf('0x1c')]||null:null,'attributes':_0x54ce63[_0x7cdf('0x1b')]?_0x54ce63[_0x7cdf('0x1b')][_0x7cdf('0x1d')]||null:null,'include':_0x54ce63[_0x7cdf('0x1b')]?_0x54ce63[_0x7cdf('0x1b')][_0x7cdf('0x1e')]?_[_0x7cdf('0x1f')](_0x54ce63[_0x7cdf('0x1b')][_0x7cdf('0x1e')],function(_0x424ab7){return{'model':db[_0x424ab7[_0x7cdf('0x20')]],'as':_0x424ab7['as'],'attributes':_0x424ab7[_0x7cdf('0x1d')],'include':_0x424ab7[_0x7cdf('0x1e')]?_[_0x7cdf('0x1f')](_0x424ab7[_0x7cdf('0x1e')],function(_0x104b00){return{'model':db[_0x104b00[_0x7cdf('0x20')]],'as':_0x104b00['as'],'attributes':_0x104b00[_0x7cdf('0x1d')],'include':_0x104b00[_0x7cdf('0x1e')]?_[_0x7cdf('0x1f')](_0x104b00['include'],function(_0x662852){return{'model':db[_0x662852[_0x7cdf('0x20')]],'as':_0x662852['as'],'attributes':_0x662852['attributes']};}):[]};}):[]};}):[]:[]})[_0x7cdf('0xe')](function(_0xe05b2d){logger[_0x7cdf('0xf')]('ShowSquareProject',_0x54ce63);logger['debug'](_0x7cdf('0x18'),_0x54ce63,JSON[_0x7cdf('0x12')](_0xe05b2d));_0x214f96(_0xe05b2d);})[_0x7cdf('0x17')](function(_0x2f5fa8){logger[_0x7cdf('0x13')](_0x7cdf('0x18'),_0x2f5fa8[_0x7cdf('0x15')],_0x54ce63);_0x571d26(_0x1ff48f[_0x7cdf('0x13')](0x1f4,_0x2f5fa8['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index f706318..dc14cac 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 _0xd160=['./squareProject.events','remove','emit','removeListener'];(function(_0x1a8bbc,_0x17a086){var _0x212fc2=function(_0x55c718){while(--_0x55c718){_0x1a8bbc['push'](_0x1a8bbc['shift']());}};_0x212fc2(++_0x17a086);}(_0xd160,0x16c));var _0x0d16=function(_0x1a9204,_0x1c9e00){_0x1a9204=_0x1a9204-0x0;var _0x17ca68=_0xd160[_0x1a9204];return _0x17ca68;};'use strict';var SquareProjectEvents=require(_0x0d16('0x0'));var events=['save',_0x0d16('0x1'),'update'];function createListener(_0x476668,_0x1dd46f){return function(_0x76e688){_0x1dd46f[_0x0d16('0x2')](_0x476668,_0x76e688);};}function removeListener(_0xa5e2aa,_0x1d83d2){return function(){SquareProjectEvents[_0x0d16('0x3')](_0xa5e2aa,_0x1d83d2);};}exports['register']=function(_0x160865){for(var _0x219890=0x0,_0x5b1966=events['length'];_0x219890<_0x5b1966;_0x219890++){var _0x39675c=events[_0x219890];var _0x16e8f3=createListener('squareProject:'+_0x39675c,_0x160865);SquareProjectEvents['on'](_0x39675c,_0x16e8f3);}}; \ No newline at end of file +var _0xdf88=['./squareProject.events','save','remove','update','emit','removeListener','register','squareProject:'];(function(_0x460237,_0x26b2fb){var _0x492f24=function(_0x47c3f9){while(--_0x47c3f9){_0x460237['push'](_0x460237['shift']());}};_0x492f24(++_0x26b2fb);}(_0xdf88,0xe8));var _0x8df8=function(_0x2b774b,_0x5e2c7d){_0x2b774b=_0x2b774b-0x0;var _0x1ce126=_0xdf88[_0x2b774b];return _0x1ce126;};'use strict';var SquareProjectEvents=require(_0x8df8('0x0'));var events=[_0x8df8('0x1'),_0x8df8('0x2'),_0x8df8('0x3')];function createListener(_0x82a825,_0x2cb9f4){return function(_0x1dcc16){_0x2cb9f4[_0x8df8('0x4')](_0x82a825,_0x1dcc16);};}function removeListener(_0x44983d,_0x1041c4){return function(){SquareProjectEvents[_0x8df8('0x5')](_0x44983d,_0x1041c4);};}exports[_0x8df8('0x6')]=function(_0x504588){for(var _0x28ce0d=0x0,_0x390c12=events['length'];_0x28ce0d<_0x390c12;_0x28ce0d++){var _0x5a6c64=events[_0x28ce0d];var _0x577912=createListener(_0x8df8('0x7')+_0x5a6c64,_0x504588);SquareProjectEvents['on'](_0x5a6c64,_0x577912);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index d2dbc62..5b23d45 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 _0x0295=['isAuthenticated','index','post','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x0295,0x1f0));var _0x5029=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0x0295[_0x3e69ae];return _0x3d7f42;};'use strict';var multer=require(_0x5029('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5029('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5029('0x2'));var auth=require(_0x5029('0x3'));var interaction=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var controller=require(_0x5029('0x6'));router[_0x5029('0x7')]('/',auth[_0x5029('0x8')](),controller[_0x5029('0x9')]);router[_0x5029('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5029('0x7')]('/:id/download',auth[_0x5029('0x8')](),controller['download']);router[_0x5029('0xa')]('/',auth['isAuthenticated'](),controller[_0x5029('0xb')]);router[_0x5029('0xc')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0xe')]);router[_0x5029('0xf')](_0x5029('0xd'),auth['isAuthenticated'](),controller[_0x5029('0x10')]);module[_0x5029('0x11')]=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x54a242,_0x32dafb){var _0x5733a1=function(_0x5179ca){while(--_0x5179ca){_0x54a242['push'](_0x54a242['shift']());}};_0x5733a1(++_0x32dafb);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xc4aa[_0x273c39];return _0x46d6b5;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 6c9b8cf..86428bd 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 _0x7dfd=['substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','savePath'];(function(_0x282ae8,_0x5826e4){var _0xf67a2d=function(_0x2995f6){while(--_0x2995f6){_0x282ae8['push'](_0x282ae8['shift']());}};_0xf67a2d(++_0x5826e4);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'uniqueid':{'type':Sequelize[_0xd7df('0x2')]},'callerid':{'type':Sequelize[_0xd7df('0x2')]},'calleridname':{'type':Sequelize[_0xd7df('0x2')]},'context':{'type':Sequelize[_0xd7df('0x2')]},'extension':{'type':Sequelize[_0xd7df('0x2')]},'priority':{'type':Sequelize[_0xd7df('0x2')]},'accountcode':{'type':Sequelize[_0xd7df('0x2')]},'dnid':{'type':Sequelize[_0xd7df('0x2')]},'projectName':{'type':Sequelize[_0xd7df('0x2')]},'saveName':{'type':Sequelize[_0xd7df('0x2')]},'filename':{'type':Sequelize[_0xd7df('0x2')]},'savePath':{'type':Sequelize[_0xd7df('0x2')]},'format':{'type':Sequelize[_0xd7df('0x3')],'get':function(){var _0x16e50='';var _0x2c48a4=this['getDataValue'](_0xd7df('0x4'));if(_0x2c48a4){_0x16e50=_0x2c48a4[_0xd7df('0x5')](_0x2c48a4[_0xd7df('0x6')]('.'));}return _0x16e50;}}}; \ No newline at end of file +var _0xac31=['STRING','VIRTUAL','savePath','lastIndexOf','sequelize','exports'];(function(_0x6364f,_0x24393e){var _0x4bf4c6=function(_0x4d0fe2){while(--_0x4d0fe2){_0x6364f['push'](_0x6364f['shift']());}};_0x4bf4c6(++_0x24393e);}(_0xac31,0xca));var _0x1ac3=function(_0x5931aa,_0x48892a){_0x5931aa=_0x5931aa-0x0;var _0x53b80a=_0xac31[_0x5931aa];return _0x53b80a;};'use strict';var Sequelize=require(_0x1ac3('0x0'));module[_0x1ac3('0x1')]={'uniqueid':{'type':Sequelize[_0x1ac3('0x2')]},'callerid':{'type':Sequelize[_0x1ac3('0x2')]},'calleridname':{'type':Sequelize[_0x1ac3('0x2')]},'context':{'type':Sequelize[_0x1ac3('0x2')]},'extension':{'type':Sequelize[_0x1ac3('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1ac3('0x2')]},'dnid':{'type':Sequelize[_0x1ac3('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x1ac3('0x2')]},'savePath':{'type':Sequelize[_0x1ac3('0x2')]},'format':{'type':Sequelize[_0x1ac3('0x3')],'get':function(){var _0x1be223='';var _0x157604=this['getDataValue'](_0x1ac3('0x4'));if(_0x157604){_0x1be223=_0x157604['substring'](_0x157604[_0x1ac3('0x5')]('.'));}return _0x1be223;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 0a54481..88fec0b 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 _0x073a=['stack','name','index','map','SquareRecording','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','send','Not\x20found','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','error'];(function(_0x5b5af1,_0x1db01b){var _0x45ab7b=function(_0x1e353a){while(--_0x1e353a){_0x5b5af1['push'](_0x5b5af1['shift']());}};_0x45ab7b(++_0x1db01b);}(_0x073a,0x9d));var _0xa073=function(_0x18abe6,_0x2f15e2){_0x18abe6=_0x18abe6-0x0;var _0x19c0d0=_0x073a[_0x18abe6];return _0x19c0d0;};'use strict';var emlformat=require(_0xa073('0x0'));var rimraf=require(_0xa073('0x1'));var zipdir=require(_0xa073('0x2'));var jsonpatch=require(_0xa073('0x3'));var rp=require(_0xa073('0x4'));var moment=require(_0xa073('0x5'));var BPromise=require(_0xa073('0x6'));var Mustache=require(_0xa073('0x7'));var util=require('util');var path=require(_0xa073('0x8'));var sox=require(_0xa073('0x9'));var csv=require(_0xa073('0xa'));var ejs=require(_0xa073('0xb'));var fs=require('fs');var fs_extra=require(_0xa073('0xc'));var _=require(_0xa073('0xd'));var squel=require(_0xa073('0xe'));var crypto=require('crypto');var jsforce=require(_0xa073('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa073('0xa'));var querystring=require('querystring');var Papa=require(_0xa073('0x10'));var Redis=require(_0xa073('0x11'));var authService=require(_0xa073('0x12'));var qs=require(_0xa073('0x13'));var as=require(_0xa073('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa073('0x15'))(_0xa073('0x16'));var utils=require(_0xa073('0x17'));var config=require(_0xa073('0x18'));var licenseUtil=require(_0xa073('0x19'));var db=require(_0xa073('0x1a'))['db'];function respondWithStatusCode(_0x2d5781,_0x4ef3a9){_0x4ef3a9=_0x4ef3a9||0xcc;return function(_0x4d3da4){if(_0x4d3da4){return _0x2d5781[_0xa073('0x1b')](_0x4ef3a9);}return _0x2d5781[_0xa073('0x1c')](_0x4ef3a9)[_0xa073('0x1d')]();};}function respondWithResult(_0x3b1758,_0x140e3a){_0x140e3a=_0x140e3a||0xc8;return function(_0x53234b){if(_0x53234b){return _0x3b1758[_0xa073('0x1c')](_0x140e3a)[_0xa073('0x1e')](_0x53234b);}};}function respondWithFilteredResult(_0x5a3ed5,_0x77fb37){return function(_0xc3f80d){if(_0xc3f80d){var _0x17e362=typeof _0x77fb37[_0xa073('0x1f')]===_0xa073('0x20')&&typeof _0x77fb37[_0xa073('0x21')]==='undefined';var _0x69656f=_0xc3f80d['count'];var _0x3d141d=_0x17e362?0x0:_0x77fb37[_0xa073('0x1f')];var _0x42910f=_0x17e362?_0xc3f80d[_0xa073('0x22')]:_0x77fb37[_0xa073('0x1f')]+_0x77fb37[_0xa073('0x21')];var _0x527f41;if(_0x42910f>=_0x69656f){_0x42910f=_0x69656f;_0x527f41=0xc8;}else{_0x527f41=0xce;}_0x5a3ed5['status'](_0x527f41);return _0x5a3ed5['set'](_0xa073('0x23'),_0x3d141d+'-'+_0x42910f+'/'+_0x69656f)[_0xa073('0x1e')](_0xc3f80d);}return null;};}function patchUpdates(_0x5d4e1e){return function(_0x21b2ec){try{jsonpatch[_0xa073('0x24')](_0x21b2ec,_0x5d4e1e,!![]);}catch(_0x46d536){return BPromise['reject'](_0x46d536);}return _0x21b2ec[_0xa073('0x25')]();};}function saveUpdates(_0x13d627,_0x26c3bb){return function(_0x2eea8c){if(_0x2eea8c){return _0x2eea8c[_0xa073('0x26')](_0x13d627)[_0xa073('0x27')](function(_0x534ba2){return _0x534ba2;});}return null;};}function removeEntity(_0x244855,_0x5bec8c){return function(_0x11bed0){if(_0x11bed0){return _0x11bed0['destroy']()[_0xa073('0x27')](function(){_0x244855['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a4df6,_0x55b6c9){return function(_0x258e7e){if(!_0x258e7e){_0x4a4df6['sendStatus'](0x194);}return _0x258e7e;};}function handleError(_0x372e3c,_0x477a5b){_0x477a5b=_0x477a5b||0x1f4;return function(_0x3229dd){logger[_0xa073('0x28')](_0x3229dd[_0xa073('0x29')]);if(_0x3229dd['name']){delete _0x3229dd[_0xa073('0x2a')];}_0x372e3c[_0xa073('0x1c')](_0x477a5b)['send'](_0x3229dd);};}exports[_0xa073('0x2b')]=function(_0x2ae277,_0x5f3669){var _0x4689b6={},_0x5ab1dc={},_0x148a4c={'count':0x0,'rows':[]};var _0x123820=_[_0xa073('0x2c')](db[_0xa073('0x2d')]['rawAttributes'],function(_0x56e58a){return{'name':_0x56e58a[_0xa073('0x2e')],'type':_0x56e58a[_0xa073('0x2f')][_0xa073('0x30')]};});_0x5ab1dc[_0xa073('0x31')]=_[_0xa073('0x2c')](_0x123820,'name');_0x5ab1dc[_0xa073('0x32')]=_[_0xa073('0x33')](_0x2ae277[_0xa073('0x32')]);_0x5ab1dc['filters']=_['intersection'](_0x5ab1dc['model'],_0x5ab1dc[_0xa073('0x32')]);_0x4689b6[_0xa073('0x34')]=_[_0xa073('0x35')](_0x5ab1dc[_0xa073('0x31')],qs[_0xa073('0x36')](_0x2ae277[_0xa073('0x32')][_0xa073('0x36')]));_0x4689b6[_0xa073('0x34')]=_0x4689b6['attributes'][_0xa073('0x37')]?_0x4689b6[_0xa073('0x34')]:_0x5ab1dc[_0xa073('0x31')];if(!_0x2ae277[_0xa073('0x32')]['hasOwnProperty'](_0xa073('0x38'))){_0x4689b6[_0xa073('0x21')]=qs[_0xa073('0x21')](_0x2ae277[_0xa073('0x32')][_0xa073('0x21')]);_0x4689b6['offset']=qs[_0xa073('0x1f')](_0x2ae277[_0xa073('0x32')][_0xa073('0x1f')]);}_0x4689b6[_0xa073('0x39')]=qs[_0xa073('0x3a')](_0x2ae277[_0xa073('0x32')][_0xa073('0x3a')]);_0x4689b6[_0xa073('0x3b')]=qs['filters'](_[_0xa073('0x3c')](_0x2ae277[_0xa073('0x32')],_0x5ab1dc[_0xa073('0x3d')]),_0x123820);if(_0x2ae277[_0xa073('0x32')][_0xa073('0x3e')]){_0x4689b6[_0xa073('0x3b')]=_[_0xa073('0x3f')](_0x4689b6[_0xa073('0x3b')],{'$or':_['map'](_0x123820,function(_0x11c56a){if(_0x11c56a['type']!=='VIRTUAL'){var _0x135750={};_0x135750[_0x11c56a['name']]={'$like':'%'+_0x2ae277['query'][_0xa073('0x3e')]+'%'};return _0x135750;}})});}_0x4689b6=_[_0xa073('0x3f')]({},_0x4689b6,_0x2ae277['options']);var _0x6cabf9={'where':_0x4689b6[_0xa073('0x3b')]};return db['SquareRecording'][_0xa073('0x22')](_0x6cabf9)[_0xa073('0x27')](function(_0x5798db){_0x148a4c[_0xa073('0x22')]=_0x5798db;if(_0x2ae277[_0xa073('0x32')][_0xa073('0x40')]){_0x4689b6[_0xa073('0x41')]=[{'all':!![]}];}return db[_0xa073('0x2d')][_0xa073('0x42')](_0x4689b6);})[_0xa073('0x27')](function(_0x4a5f39){_0x148a4c[_0xa073('0x43')]=_0x4a5f39;return _0x148a4c;})[_0xa073('0x27')](respondWithFilteredResult(_0x5f3669,_0x4689b6))[_0xa073('0x44')](handleError(_0x5f3669,null));};exports['show']=function(_0x340c90,_0x52881a){var _0x591fbb={'raw':!![],'where':{'id':_0x340c90[_0xa073('0x45')]['id']}},_0x3bf288={};_0x3bf288[_0xa073('0x31')]=_[_0xa073('0x33')](db[_0xa073('0x2d')][_0xa073('0x46')]);_0x3bf288[_0xa073('0x32')]=_[_0xa073('0x33')](_0x340c90['query']);_0x3bf288[_0xa073('0x3d')]=_[_0xa073('0x35')](_0x3bf288[_0xa073('0x31')],_0x3bf288[_0xa073('0x32')]);_0x591fbb['attributes']=_[_0xa073('0x35')](_0x3bf288[_0xa073('0x31')],qs['fields'](_0x340c90[_0xa073('0x32')][_0xa073('0x36')]));_0x591fbb[_0xa073('0x34')]=_0x591fbb[_0xa073('0x34')][_0xa073('0x37')]?_0x591fbb[_0xa073('0x34')]:_0x3bf288[_0xa073('0x31')];if(_0x340c90[_0xa073('0x32')]['includeAll']){_0x591fbb[_0xa073('0x41')]=[{'all':!![]}];}_0x591fbb=_[_0xa073('0x3f')]({},_0x591fbb,_0x340c90[_0xa073('0x47')]);return db[_0xa073('0x2d')][_0xa073('0x48')](_0x591fbb)[_0xa073('0x27')](handleEntityNotFound(_0x52881a,null))[_0xa073('0x27')](respondWithResult(_0x52881a,null))[_0xa073('0x44')](handleError(_0x52881a,null));};exports['create']=function(_0x47e0ee,_0x4e1e0d){return db['SquareRecording'][_0xa073('0x49')](_0x47e0ee[_0xa073('0x4a')],{})['then'](respondWithResult(_0x4e1e0d,0xc9))[_0xa073('0x44')](handleError(_0x4e1e0d,null));};exports[_0xa073('0x26')]=function(_0x278b5c,_0x3deb91){if(_0x278b5c['body']['id']){delete _0x278b5c[_0xa073('0x4a')]['id'];}return db[_0xa073('0x2d')][_0xa073('0x48')]({'where':{'id':_0x278b5c[_0xa073('0x45')]['id']}})[_0xa073('0x27')](handleEntityNotFound(_0x3deb91,null))[_0xa073('0x27')](saveUpdates(_0x278b5c['body'],null))['then'](respondWithResult(_0x3deb91,null))[_0xa073('0x44')](handleError(_0x3deb91,null));};exports[_0xa073('0x4b')]=function(_0x57d95f,_0x5e93dc,_0x44a922){var _0x1ce919=require(_0xa073('0x4c'));var _0x4dc39c=![];var _0x41407b={};if(_0x57d95f[_0xa073('0x32')]['type']&&_0x57d95f[_0xa073('0x32')][_0xa073('0x2f')]===_0xa073('0x4d')){_0x41407b[_0xa073('0x4d')]=_0x57d95f['params']['id'];}else{_0x41407b['id']=_0x57d95f[_0xa073('0x45')]['id'];}return db[_0xa073('0x2d')][_0xa073('0x48')]({'where':_0x41407b,'attributes':['id',_0xa073('0x4e'),_0xa073('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x5e93dc,null))['then'](function(_0x396774){if(_0x396774){var _0x39d8d3=_0x396774[_0xa073('0x4e')];var _0x250e5a=util[_0xa073('0x50')]('%s.cypher',_0x39d8d3);if(fs[_0xa073('0x51')](_0x250e5a)){_0x4dc39c=!![];return _0x1ce919[_0xa073('0x52')](_0x250e5a,_0x39d8d3,config['secrets'][_0xa073('0x53')])[_0xa073('0x27')](function(){return _0x396774;});}return _0x396774;}})[_0xa073('0x27')](function(_0x42b2d5){if(_0x42b2d5){var _0x3b2431=_0x42b2d5[_0xa073('0x4e')];if(!fs['existsSync'](_0x3b2431)){throw new db[(_0xa073('0x54'))][(_0xa073('0x55'))](_0xa073('0x56'));}if(_0x42b2d5[_0xa073('0x4f')]){return _0x5e93dc['download'](_0x3b2431,_0x42b2d5['filename']+path[_0xa073('0x57')](_0x3b2431),function(){if(_0x4dc39c){fs['unlink'](_0x3b2431);}});}else{return _0x5e93dc['download'](_0x3b2431,function(_0x2328a5){if(_0x4dc39c){fs[_0xa073('0x58')](_0x3b2431);}});}}})['catch'](function(_0x4a70b1){if(_0x4a70b1['message']===_0xa073('0x56')){_0x5e93dc[_0xa073('0x1c')](0x194)[_0xa073('0x59')](_0xa073('0x5a'));}else{return handleError(_0x5e93dc,null);}});};exports[_0xa073('0x5b')]=function(_0x595b88,_0x71864d){return db[_0xa073('0x2d')][_0xa073('0x48')]({'where':{'id':_0x595b88[_0xa073('0x45')]['id']}})[_0xa073('0x27')](function(_0x3edfa5){if(_[_0xa073('0x5c')](_0x3edfa5)){throw new ReferenceError(_0xa073('0x5d'));}return _0x3edfa5;})[_0xa073('0x27')](function(_0x4920cf){var _0x4786b4=_0x4920cf['savePath'];logger[_0xa073('0x5e')](_0xa073('0x5f'),_0x4786b4);if(!_[_0xa073('0x5c')](_0x4920cf[_0xa073('0x4e')])&&fs['existsSync'](_0x4786b4)){logger[_0xa073('0x5e')](_0xa073('0x60')+_0x4786b4+_0xa073('0x61'));fs['unlinkSync'](_0x4786b4);}_0x4786b4=_0x4786b4+_0xa073('0x62');if(!_['isNil'](_0x4920cf[_0xa073('0x4e')])&&fs['existsSync'](_0x4786b4)){logger['info'](_0xa073('0x60')+_0x4786b4+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x4786b4);}return _0x4920cf;})[_0xa073('0x27')](function(_0x12514a){if(!_0x12514a)throw new InternalError();return _0x12514a['destroy']();})['then'](function(){_0x71864d['status'](0xcc)[_0xa073('0x1d')]();})[_0xa073('0x44')](handleError(_0x71864d,null));}; \ No newline at end of file +var _0xfd39=['Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','map','SquareRecording','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','VIRTUAL','merge','includeAll','include','findAll','catch','show','rawAttributes','options','find','create','body','update','params','download','../../components/encryptor','type','uniqueid','filename','savePath','format','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message'];(function(_0x3419e0,_0x2c5320){var _0x1a1c29=function(_0x46fe8e){while(--_0x46fe8e){_0x3419e0['push'](_0x3419e0['shift']());}};_0x1a1c29(++_0x2c5320);}(_0xfd39,0x195));var _0x9fd3=function(_0x224e54,_0x18f319){_0x224e54=_0x224e54-0x0;var _0x326488=_0xfd39[_0x224e54];return _0x326488;};'use strict';var emlformat=require(_0x9fd3('0x0'));var rimraf=require(_0x9fd3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fd3('0x2'));var rp=require(_0x9fd3('0x3'));var moment=require(_0x9fd3('0x4'));var BPromise=require(_0x9fd3('0x5'));var Mustache=require(_0x9fd3('0x6'));var util=require(_0x9fd3('0x7'));var path=require(_0x9fd3('0x8'));var sox=require(_0x9fd3('0x9'));var csv=require(_0x9fd3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9fd3('0xb'));var _=require(_0x9fd3('0xc'));var squel=require(_0x9fd3('0xd'));var crypto=require('crypto');var jsforce=require(_0x9fd3('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x9fd3('0xa'));var querystring=require(_0x9fd3('0xf'));var Papa=require(_0x9fd3('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9fd3('0x11'));var as=require(_0x9fd3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9fd3('0x13'))(_0x9fd3('0x14'));var utils=require(_0x9fd3('0x15'));var config=require(_0x9fd3('0x16'));var licenseUtil=require(_0x9fd3('0x17'));var db=require(_0x9fd3('0x18'))['db'];function respondWithStatusCode(_0x43b14e,_0x101f04){_0x101f04=_0x101f04||0xcc;return function(_0xf3c287){if(_0xf3c287){return _0x43b14e[_0x9fd3('0x19')](_0x101f04);}return _0x43b14e[_0x9fd3('0x1a')](_0x101f04)[_0x9fd3('0x1b')]();};}function respondWithResult(_0xc6ae63,_0x472314){_0x472314=_0x472314||0xc8;return function(_0x4b747b){if(_0x4b747b){return _0xc6ae63['status'](_0x472314)['json'](_0x4b747b);}};}function respondWithFilteredResult(_0x186475,_0xd0f0a2){return function(_0x30a94b){if(_0x30a94b){var _0x4d42b9=typeof _0xd0f0a2[_0x9fd3('0x1c')]===_0x9fd3('0x1d')&&typeof _0xd0f0a2[_0x9fd3('0x1e')]===_0x9fd3('0x1d');var _0x473ab2=_0x30a94b[_0x9fd3('0x1f')];var _0x3403db=_0x4d42b9?0x0:_0xd0f0a2['offset'];var _0x3f84eb=_0x4d42b9?_0x30a94b[_0x9fd3('0x1f')]:_0xd0f0a2['offset']+_0xd0f0a2[_0x9fd3('0x1e')];var _0x7d8c67;if(_0x3f84eb>=_0x473ab2){_0x3f84eb=_0x473ab2;_0x7d8c67=0xc8;}else{_0x7d8c67=0xce;}_0x186475[_0x9fd3('0x1a')](_0x7d8c67);return _0x186475[_0x9fd3('0x20')](_0x9fd3('0x21'),_0x3403db+'-'+_0x3f84eb+'/'+_0x473ab2)['json'](_0x30a94b);}return null;};}function patchUpdates(_0x377727){return function(_0x45db50){try{jsonpatch[_0x9fd3('0x22')](_0x45db50,_0x377727,!![]);}catch(_0x284958){return BPromise[_0x9fd3('0x23')](_0x284958);}return _0x45db50[_0x9fd3('0x24')]();};}function saveUpdates(_0x4c4453,_0x22fc69){return function(_0x2a6968){if(_0x2a6968){return _0x2a6968['update'](_0x4c4453)[_0x9fd3('0x25')](function(_0xf186){return _0xf186;});}return null;};}function removeEntity(_0x52a33f,_0x4afc4d){return function(_0x3ec82c){if(_0x3ec82c){return _0x3ec82c[_0x9fd3('0x26')]()['then'](function(){_0x52a33f[_0x9fd3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a67b6,_0x2b4ccd){return function(_0x1dec1e){if(!_0x1dec1e){_0x2a67b6[_0x9fd3('0x19')](0x194);}return _0x1dec1e;};}function handleError(_0x25d93b,_0x481ab2){_0x481ab2=_0x481ab2||0x1f4;return function(_0x1aa2d0){logger[_0x9fd3('0x27')](_0x1aa2d0['stack']);if(_0x1aa2d0['name']){delete _0x1aa2d0[_0x9fd3('0x28')];}_0x25d93b[_0x9fd3('0x1a')](_0x481ab2)[_0x9fd3('0x29')](_0x1aa2d0);};}exports['index']=function(_0x50b467,_0x455d47){var _0x35dd08={},_0x22087b={},_0x2aecfc={'count':0x0,'rows':[]};var _0x24ee32=_[_0x9fd3('0x2a')](db[_0x9fd3('0x2b')]['rawAttributes'],function(_0x1b1a92){return{'name':_0x1b1a92['fieldName'],'type':_0x1b1a92['type'][_0x9fd3('0x2c')]};});_0x22087b[_0x9fd3('0x2d')]=_[_0x9fd3('0x2a')](_0x24ee32,'name');_0x22087b['query']=_[_0x9fd3('0x2e')](_0x50b467[_0x9fd3('0x2f')]);_0x22087b['filters']=_[_0x9fd3('0x30')](_0x22087b[_0x9fd3('0x2d')],_0x22087b[_0x9fd3('0x2f')]);_0x35dd08[_0x9fd3('0x31')]=_['intersection'](_0x22087b[_0x9fd3('0x2d')],qs[_0x9fd3('0x32')](_0x50b467[_0x9fd3('0x2f')][_0x9fd3('0x32')]));_0x35dd08[_0x9fd3('0x31')]=_0x35dd08[_0x9fd3('0x31')][_0x9fd3('0x33')]?_0x35dd08[_0x9fd3('0x31')]:_0x22087b['model'];if(!_0x50b467[_0x9fd3('0x2f')][_0x9fd3('0x34')](_0x9fd3('0x35'))){_0x35dd08[_0x9fd3('0x1e')]=qs['limit'](_0x50b467[_0x9fd3('0x2f')][_0x9fd3('0x1e')]);_0x35dd08[_0x9fd3('0x1c')]=qs[_0x9fd3('0x1c')](_0x50b467['query'][_0x9fd3('0x1c')]);}_0x35dd08[_0x9fd3('0x36')]=qs[_0x9fd3('0x37')](_0x50b467[_0x9fd3('0x2f')][_0x9fd3('0x37')]);_0x35dd08['where']=qs[_0x9fd3('0x38')](_['pick'](_0x50b467[_0x9fd3('0x2f')],_0x22087b[_0x9fd3('0x38')]),_0x24ee32);if(_0x50b467['query'][_0x9fd3('0x39')]){_0x35dd08[_0x9fd3('0x3a')]=_['merge'](_0x35dd08[_0x9fd3('0x3a')],{'$or':_[_0x9fd3('0x2a')](_0x24ee32,function(_0x5a5dbd){if(_0x5a5dbd['type']!==_0x9fd3('0x3b')){var _0x224330={};_0x224330[_0x5a5dbd['name']]={'$like':'%'+_0x50b467[_0x9fd3('0x2f')][_0x9fd3('0x39')]+'%'};return _0x224330;}})});}_0x35dd08=_[_0x9fd3('0x3c')]({},_0x35dd08,_0x50b467['options']);var _0x95ca20={'where':_0x35dd08[_0x9fd3('0x3a')]};return db[_0x9fd3('0x2b')][_0x9fd3('0x1f')](_0x95ca20)['then'](function(_0x127230){_0x2aecfc[_0x9fd3('0x1f')]=_0x127230;if(_0x50b467['query'][_0x9fd3('0x3d')]){_0x35dd08[_0x9fd3('0x3e')]=[{'all':!![]}];}return db[_0x9fd3('0x2b')][_0x9fd3('0x3f')](_0x35dd08);})[_0x9fd3('0x25')](function(_0x1351b0){_0x2aecfc['rows']=_0x1351b0;return _0x2aecfc;})[_0x9fd3('0x25')](respondWithFilteredResult(_0x455d47,_0x35dd08))[_0x9fd3('0x40')](handleError(_0x455d47,null));};exports[_0x9fd3('0x41')]=function(_0x3eaac8,_0x41bbe5){var _0x30d2ac={'raw':!![],'where':{'id':_0x3eaac8['params']['id']}},_0x4fe2cb={};_0x4fe2cb[_0x9fd3('0x2d')]=_[_0x9fd3('0x2e')](db[_0x9fd3('0x2b')][_0x9fd3('0x42')]);_0x4fe2cb[_0x9fd3('0x2f')]=_['keys'](_0x3eaac8[_0x9fd3('0x2f')]);_0x4fe2cb[_0x9fd3('0x38')]=_['intersection'](_0x4fe2cb[_0x9fd3('0x2d')],_0x4fe2cb[_0x9fd3('0x2f')]);_0x30d2ac[_0x9fd3('0x31')]=_['intersection'](_0x4fe2cb[_0x9fd3('0x2d')],qs[_0x9fd3('0x32')](_0x3eaac8[_0x9fd3('0x2f')]['fields']));_0x30d2ac[_0x9fd3('0x31')]=_0x30d2ac[_0x9fd3('0x31')][_0x9fd3('0x33')]?_0x30d2ac[_0x9fd3('0x31')]:_0x4fe2cb['model'];if(_0x3eaac8['query'][_0x9fd3('0x3d')]){_0x30d2ac[_0x9fd3('0x3e')]=[{'all':!![]}];}_0x30d2ac=_[_0x9fd3('0x3c')]({},_0x30d2ac,_0x3eaac8[_0x9fd3('0x43')]);return db['SquareRecording'][_0x9fd3('0x44')](_0x30d2ac)['then'](handleEntityNotFound(_0x41bbe5,null))['then'](respondWithResult(_0x41bbe5,null))['catch'](handleError(_0x41bbe5,null));};exports['create']=function(_0xfe0584,_0x1d15ec){return db[_0x9fd3('0x2b')][_0x9fd3('0x45')](_0xfe0584[_0x9fd3('0x46')],{})[_0x9fd3('0x25')](respondWithResult(_0x1d15ec,0xc9))[_0x9fd3('0x40')](handleError(_0x1d15ec,null));};exports[_0x9fd3('0x47')]=function(_0x1f8182,_0xc9b979){if(_0x1f8182[_0x9fd3('0x46')]['id']){delete _0x1f8182[_0x9fd3('0x46')]['id'];}return db['SquareRecording'][_0x9fd3('0x44')]({'where':{'id':_0x1f8182[_0x9fd3('0x48')]['id']}})[_0x9fd3('0x25')](handleEntityNotFound(_0xc9b979,null))[_0x9fd3('0x25')](saveUpdates(_0x1f8182[_0x9fd3('0x46')],null))['then'](respondWithResult(_0xc9b979,null))['catch'](handleError(_0xc9b979,null));};exports[_0x9fd3('0x49')]=function(_0x4176d1,_0x56782b,_0xcc4ada){var _0x4b49ec=require(_0x9fd3('0x4a'));var _0x223ed3=![];var _0x48bdb3={};if(_0x4176d1['query']['type']&&_0x4176d1[_0x9fd3('0x2f')][_0x9fd3('0x4b')]===_0x9fd3('0x4c')){_0x48bdb3[_0x9fd3('0x4c')]=_0x4176d1[_0x9fd3('0x48')]['id'];}else{_0x48bdb3['id']=_0x4176d1[_0x9fd3('0x48')]['id'];}return db[_0x9fd3('0x2b')][_0x9fd3('0x44')]({'where':_0x48bdb3,'attributes':['id','savePath',_0x9fd3('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x56782b,null))[_0x9fd3('0x25')](function(_0x1f540c){if(_0x1f540c){var _0x3cb4f5=_0x1f540c[_0x9fd3('0x4e')];var _0x5148ba=util[_0x9fd3('0x4f')](_0x9fd3('0x50'),_0x3cb4f5);if(fs[_0x9fd3('0x51')](_0x5148ba)){_0x223ed3=!![];return _0x4b49ec['decryptFile'](_0x5148ba,_0x3cb4f5,config[_0x9fd3('0x52')][_0x9fd3('0x53')])[_0x9fd3('0x25')](function(){return _0x1f540c;});}return _0x1f540c;}})[_0x9fd3('0x25')](function(_0x58d8ff){if(_0x58d8ff){var _0x542fd4=_0x58d8ff[_0x9fd3('0x4e')];if(!fs['existsSync'](_0x542fd4)){throw new db[(_0x9fd3('0x54'))][(_0x9fd3('0x55'))](_0x9fd3('0x56'));}if(_0x58d8ff[_0x9fd3('0x4d')]){return _0x56782b[_0x9fd3('0x49')](_0x542fd4,_0x58d8ff['filename']+path[_0x9fd3('0x57')](_0x542fd4),function(){if(_0x223ed3){fs[_0x9fd3('0x58')](_0x542fd4);}});}else{return _0x56782b['download'](_0x542fd4,function(_0x53956c){if(_0x223ed3){fs['unlink'](_0x542fd4);}});}}})[_0x9fd3('0x40')](function(_0x514e54){if(_0x514e54[_0x9fd3('0x59')]===_0x9fd3('0x56')){_0x56782b[_0x9fd3('0x1a')](0x194)[_0x9fd3('0x29')](_0x9fd3('0x5a'));}else{return handleError(_0x56782b,null);}});};exports[_0x9fd3('0x26')]=function(_0x58897b,_0x8c99a7){return db[_0x9fd3('0x2b')][_0x9fd3('0x44')]({'where':{'id':_0x58897b[_0x9fd3('0x48')]['id']}})[_0x9fd3('0x25')](function(_0x36d7ff){if(_['isNil'](_0x36d7ff)){throw new ReferenceError(_0x9fd3('0x5b'));}return _0x36d7ff;})['then'](function(_0x5e9eee){var _0x218a41=_0x5e9eee[_0x9fd3('0x4e')];logger[_0x9fd3('0x5c')](_0x9fd3('0x5d'),_0x218a41);if(!_[_0x9fd3('0x5e')](_0x5e9eee['savePath'])&&fs[_0x9fd3('0x51')](_0x218a41)){logger[_0x9fd3('0x5c')](_0x9fd3('0x5f')+_0x218a41+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x9fd3('0x60')](_0x218a41);}_0x218a41=_0x218a41+_0x9fd3('0x61');if(!_[_0x9fd3('0x5e')](_0x5e9eee[_0x9fd3('0x4e')])&&fs[_0x9fd3('0x51')](_0x218a41)){logger[_0x9fd3('0x5c')](_0x9fd3('0x5f')+_0x218a41+_0x9fd3('0x62'));fs[_0x9fd3('0x60')](_0x218a41);}return _0x5e9eee;})[_0x9fd3('0x25')](function(_0x1c192c){if(!_0x1c192c)throw new InternalError();return _0x1c192c['destroy']();})['then'](function(){_0x8c99a7['status'](0xcc)[_0x9fd3('0x1b')]();})[_0x9fd3('0x40')](handleError(_0x8c99a7,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index e15fc47..d06b4b4 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 _0x1bb4=['request-promise','rimraf','./squareRecording.attributes','define','square_recordings','lodash','util','../../config/logger','api','moment'];(function(_0x32ba42,_0x483a94){var _0x2bb273=function(_0x1474e9){while(--_0x1474e9){_0x32ba42['push'](_0x32ba42['shift']());}};_0x2bb273(++_0x483a94);}(_0x1bb4,0x1c7));var _0x41bb=function(_0x2da597,_0x5a2ea6){_0x2da597=_0x2da597-0x0;var _0xecc61b=_0x1bb4[_0x2da597];return _0xecc61b;};'use strict';var _=require(_0x41bb('0x0'));var util=require(_0x41bb('0x1'));var logger=require(_0x41bb('0x2'))(_0x41bb('0x3'));var moment=require(_0x41bb('0x4'));var BPromise=require('bluebird');var rp=require(_0x41bb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x41bb('0x6'));var config=require('../../config/environment');var attributes=require(_0x41bb('0x7'));module['exports']=function(_0x232b17,_0x3ab646){return _0x232b17[_0x41bb('0x8')]('SquareRecording',attributes,{'tableName':_0x41bb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6faf=['bluebird','request-promise','rimraf','./squareRecording.attributes','define','SquareRecording','square_recordings','util','../../config/logger','api','moment'];(function(_0xc9659d,_0x36e5f3){var _0x61299e=function(_0x27abe1){while(--_0x27abe1){_0xc9659d['push'](_0xc9659d['shift']());}};_0x61299e(++_0x36e5f3);}(_0x6faf,0xf9));var _0xf6fa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6faf[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xf6fa('0x0'));var logger=require(_0xf6fa('0x1'))(_0xf6fa('0x2'));var moment=require(_0xf6fa('0x3'));var BPromise=require(_0xf6fa('0x4'));var rp=require(_0xf6fa('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6fa('0x6'));var config=require('../../config/environment');var attributes=require(_0xf6fa('0x7'));module['exports']=function(_0xe883dd,_0x3c91fc){return _0xe883dd[_0xf6fa('0x8')](_0xf6fa('0x9'),attributes,{'tableName':_0xf6fa('0xa'),'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 a75dbfa..de3e8e3 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 _0xd2e3=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','CreateSquareRecording','lodash','util','moment','randomstring'];(function(_0xfff28b,_0x204443){var _0x13c9f0=function(_0x4d9f58){while(--_0x4d9f58){_0xfff28b['push'](_0xfff28b['shift']());}};_0x13c9f0(++_0x204443);}(_0xd2e3,0x1ac));var _0x3d2e=function(_0x1c93f7,_0x1eaa23){_0x1c93f7=_0x1c93f7-0x0;var _0x4264ad=_0xd2e3[_0x1c93f7];return _0x4264ad;};'use strict';var _=require(_0x3d2e('0x0'));var util=require(_0x3d2e('0x1'));var moment=require(_0x3d2e('0x2'));var BPromise=require('bluebird');var rs=require(_0x3d2e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d2e('0x4'))['db'];var utils=require(_0x3d2e('0x5'));var logger=require(_0x3d2e('0x6'))(_0x3d2e('0x7'));var config=require(_0x3d2e('0x8'));var jayson=require(_0x3d2e('0x9'));var client=jayson[_0x3d2e('0xa')][_0x3d2e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fd37b,_0x5a89a1,_0x10d3fe){return new BPromise(function(_0x26410d,_0x5e4da1){return client['request'](_0x4fd37b,_0x10d3fe)['then'](function(_0x126463){logger[_0x3d2e('0xc')](_0x3d2e('0xd'),_0x5a89a1,_0x3d2e('0xe'));logger[_0x3d2e('0xf')](_0x3d2e('0x10'),_0x5a89a1,'request\x20sent',JSON[_0x3d2e('0x11')](_0x126463));if(_0x126463[_0x3d2e('0x12')]){if(_0x126463[_0x3d2e('0x12')][_0x3d2e('0x13')]===0x1f4){logger[_0x3d2e('0x12')](_0x3d2e('0xd'),_0x5a89a1,_0x126463[_0x3d2e('0x12')][_0x3d2e('0x14')]);return _0x5e4da1(_0x126463[_0x3d2e('0x12')]['message']);}logger[_0x3d2e('0x12')](_0x3d2e('0xd'),_0x5a89a1,_0x126463[_0x3d2e('0x12')][_0x3d2e('0x14')]);return _0x26410d(_0x126463['error']['message']);}else{logger['info'](_0x3d2e('0xd'),_0x5a89a1,_0x3d2e('0xe'));_0x26410d(_0x126463[_0x3d2e('0x15')][_0x3d2e('0x14')]);}})[_0x3d2e('0x16')](function(_0x1ac98f){logger[_0x3d2e('0x12')]('SquareRecording,\x20%s,\x20%s',_0x5a89a1,_0x1ac98f);_0x5e4da1(_0x1ac98f);});});}exports['CreateSquareRecording']=function(_0x21ca35){var _0x41431b=this;return new Promise(function(_0x2f8700,_0x3532ab){return db['SquareRecording'][_0x3d2e('0x17')](_0x21ca35[_0x3d2e('0x18')],{'raw':_0x21ca35['options']?_0x21ca35[_0x3d2e('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x51eaf4){logger['info'](_0x3d2e('0x1a'),_0x21ca35);logger[_0x3d2e('0xf')](_0x3d2e('0x1a'),_0x21ca35,JSON['stringify'](_0x51eaf4));_0x2f8700(_0x51eaf4);})['catch'](function(_0x171042){logger['error'](_0x3d2e('0x1a'),_0x171042[_0x3d2e('0x14')],_0x21ca35);_0x3532ab(_0x41431b[_0x3d2e('0x12')](0x1f4,_0x171042[_0x3d2e('0x14')]));});});}; \ No newline at end of file +var _0x8fa6=['then','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','catch','SquareRecording','body','options','raw','CreateSquareRecording','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x217b59,_0xce1e4){var _0x5c98c0=function(_0x54b003){while(--_0x54b003){_0x217b59['push'](_0x217b59['shift']());}};_0x5c98c0(++_0xce1e4);}(_0x8fa6,0x1c0));var _0x68fa=function(_0x1d9c18,_0x3410e9){_0x1d9c18=_0x1d9c18-0x0;var _0x4c29e5=_0x8fa6[_0x1d9c18];return _0x4c29e5;};'use strict';var _=require('lodash');var util=require(_0x68fa('0x0'));var moment=require(_0x68fa('0x1'));var BPromise=require('bluebird');var rs=require(_0x68fa('0x2'));var fs=require('fs');var Redis=require(_0x68fa('0x3'));var db=require(_0x68fa('0x4'))['db'];var utils=require(_0x68fa('0x5'));var logger=require(_0x68fa('0x6'))(_0x68fa('0x7'));var config=require(_0x68fa('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x68fa('0x9')][_0x68fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11dc50,_0x208d5a,_0x3e3c0e){return new BPromise(function(_0x4e3ce8,_0x273c41){return client['request'](_0x11dc50,_0x3e3c0e)[_0x68fa('0xb')](function(_0xdee61e){logger['info']('SquareRecording,\x20%s,\x20%s',_0x208d5a,_0x68fa('0xc'));logger[_0x68fa('0xd')](_0x68fa('0xe'),_0x208d5a,_0x68fa('0xc'),JSON[_0x68fa('0xf')](_0xdee61e));if(_0xdee61e[_0x68fa('0x10')]){if(_0xdee61e[_0x68fa('0x10')][_0x68fa('0x11')]===0x1f4){logger['error'](_0x68fa('0x12'),_0x208d5a,_0xdee61e['error'][_0x68fa('0x13')]);return _0x273c41(_0xdee61e[_0x68fa('0x10')][_0x68fa('0x13')]);}logger[_0x68fa('0x10')](_0x68fa('0x12'),_0x208d5a,_0xdee61e[_0x68fa('0x10')][_0x68fa('0x13')]);return _0x4e3ce8(_0xdee61e['error']['message']);}else{logger['info'](_0x68fa('0x12'),_0x208d5a,_0x68fa('0xc'));_0x4e3ce8(_0xdee61e[_0x68fa('0x14')][_0x68fa('0x13')]);}})[_0x68fa('0x15')](function(_0x1e3377){logger[_0x68fa('0x10')](_0x68fa('0x12'),_0x208d5a,_0x1e3377);_0x273c41(_0x1e3377);});});}exports['CreateSquareRecording']=function(_0x2bf94d){var _0x4e827f=this;return new Promise(function(_0x4724de,_0x4d19ca){return db[_0x68fa('0x16')]['create'](_0x2bf94d[_0x68fa('0x17')],{'raw':_0x2bf94d[_0x68fa('0x18')]?_0x2bf94d['options'][_0x68fa('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1e7fd9){logger['info'](_0x68fa('0x1a'),_0x2bf94d);logger['debug']('CreateSquareRecording',_0x2bf94d,JSON['stringify'](_0x1e7fd9));_0x4724de(_0x1e7fd9);})['catch'](function(_0x23a386){logger[_0x68fa('0x10')]('CreateSquareRecording',_0x23a386['message'],_0x2bf94d);_0x4d19ca(_0x4e827f[_0x68fa('0x10')](0x1f4,_0x23a386[_0x68fa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index c78d873..964db7d 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 _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(_0x349eda,_0x3ef742){var _0x3144c4=function(_0x3c4770){while(--_0x3c4770){_0x349eda['push'](_0x349eda['shift']());}};_0x3144c4(++_0x3ef742);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ca995,_0x458edc){_0x1ca995=_0x1ca995-0x0;var _0x6c1cbb=_0xb10b[_0x1ca995];return _0x6c1cbb;};'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 _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(_0x1fe96e,_0xae22e4){var _0x4ea1c5=function(_0x2a7a70){while(--_0x2a7a70){_0x1fe96e['push'](_0x1fe96e['shift']());}};_0x4ea1c5(++_0xae22e4);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f42d3,_0x362e7a){_0x2f42d3=_0x2f42d3-0x0;var _0x25a67e=_0xb10b[_0x2f42d3];return _0x25a67e;};'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 110dc24..00c2fbb 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 _0xff8f=['sequelize','STRING','DATE','BOOLEAN'];(function(_0x4f2ab7,_0x4daac6){var _0x56b181=function(_0x532e2c){while(--_0x532e2c){_0x4f2ab7['push'](_0x4f2ab7['shift']());}};_0x56b181(++_0x4daac6);}(_0xff8f,0x1e0));var _0xfff8=function(_0x46058c,_0x2becc4){_0x46058c=_0x46058c-0x0;var _0x2d1e6d=_0xff8f[_0x46058c];return _0x2d1e6d;};'use strict';var Sequelize=require(_0xfff8('0x0'));module['exports']={'network':{'type':Sequelize[_0xfff8('0x1')]},'network_script':{'type':Sequelize[_0xfff8('0x1')]},'request':{'type':Sequelize[_0xfff8('0x1')]},'channel':{'type':Sequelize[_0xfff8('0x1')]},'language':{'type':Sequelize[_0xfff8('0x1')]},'type':{'type':Sequelize[_0xfff8('0x1')]},'uniqueid':{'type':Sequelize[_0xfff8('0x1')]},'version':{'type':Sequelize[_0xfff8('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xfff8('0x1')]},'callingpres':{'type':Sequelize[_0xfff8('0x1')]},'callingani2':{'type':Sequelize[_0xfff8('0x1')]},'callington':{'type':Sequelize[_0xfff8('0x1')]},'callingtns':{'type':Sequelize[_0xfff8('0x1')]},'dnid':{'type':Sequelize[_0xfff8('0x1')]},'rdnis':{'type':Sequelize[_0xfff8('0x1')]},'context':{'type':Sequelize[_0xfff8('0x1')]},'extension':{'type':Sequelize[_0xfff8('0x1')]},'priority':{'type':Sequelize[_0xfff8('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xfff8('0x1')]},'threadid':{'type':Sequelize[_0xfff8('0x1')]},'project_name':{'type':Sequelize[_0xfff8('0x1')]},'joinAt':{'type':Sequelize[_0xfff8('0x2')]},'leaveAt':{'type':Sequelize[_0xfff8('0x2')]},'bot':{'type':Sequelize[_0xfff8('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x2214=['STRING','DATE','BOOLEAN','sequelize'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x2214,0x193));var _0x4221=function(_0x258d58,_0xa70cc0){_0x258d58=_0x258d58-0x0;var _0xdcbc04=_0x2214[_0x258d58];return _0xdcbc04;};'use strict';var Sequelize=require(_0x4221('0x0'));module['exports']={'network':{'type':Sequelize[_0x4221('0x1')]},'network_script':{'type':Sequelize[_0x4221('0x1')]},'request':{'type':Sequelize[_0x4221('0x1')]},'channel':{'type':Sequelize[_0x4221('0x1')]},'language':{'type':Sequelize[_0x4221('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4221('0x1')]},'version':{'type':Sequelize[_0x4221('0x1')]},'callerid':{'type':Sequelize[_0x4221('0x1')]},'calleridname':{'type':Sequelize[_0x4221('0x1')]},'callingpres':{'type':Sequelize[_0x4221('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x4221('0x1')]},'callingtns':{'type':Sequelize[_0x4221('0x1')]},'dnid':{'type':Sequelize[_0x4221('0x1')]},'rdnis':{'type':Sequelize[_0x4221('0x1')]},'context':{'type':Sequelize[_0x4221('0x1')]},'extension':{'type':Sequelize[_0x4221('0x1')]},'priority':{'type':Sequelize[_0x4221('0x1')]},'enhanced':{'type':Sequelize[_0x4221('0x1')]},'accountcode':{'type':Sequelize[_0x4221('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4221('0x2')]},'leaveAt':{'type':Sequelize[_0x4221('0x2')]},'bot':{'type':Sequelize[_0x4221('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 7c3e6e8..3e5cfb4 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 _0x118a=['find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','end','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','stack','name','send','index','SquareReport','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','options','where','include','findAll','rows','catch','show','params','filters','includeAll'];(function(_0x2de5cf,_0x4668fc){var _0x131b2b=function(_0x552987){while(--_0x552987){_0x2de5cf['push'](_0x2de5cf['shift']());}};_0x131b2b(++_0x4668fc);}(_0x118a,0x1a8));var _0xa118=function(_0x9c839,_0x3512b8){_0x9c839=_0x9c839-0x0;var _0x2586af=_0x118a[_0x9c839];return _0x2586af;};'use strict';var emlformat=require(_0xa118('0x0'));var rimraf=require(_0xa118('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa118('0x2'));var rp=require(_0xa118('0x3'));var moment=require('moment');var BPromise=require(_0xa118('0x4'));var Mustache=require('mustache');var util=require(_0xa118('0x5'));var path=require(_0xa118('0x6'));var sox=require('sox');var csv=require(_0xa118('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa118('0x8'));var _=require(_0xa118('0x9'));var squel=require(_0xa118('0xa'));var crypto=require(_0xa118('0xb'));var jsforce=require(_0xa118('0xc'));var deskjs=require(_0xa118('0xd'));var toCsv=require(_0xa118('0x7'));var querystring=require(_0xa118('0xe'));var Papa=require(_0xa118('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa118('0x10'));var as=require(_0xa118('0x11'));var hardwareService=require(_0xa118('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa118('0x13'));var licenseUtil=require(_0xa118('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x225390,_0x228b8a){_0x228b8a=_0x228b8a||0xcc;return function(_0x35a222){if(_0x35a222){return _0x225390['sendStatus'](_0x228b8a);}return _0x225390['status'](_0x228b8a)[_0xa118('0x15')]();};}function respondWithResult(_0xb655cc,_0x3d2cd2){_0x3d2cd2=_0x3d2cd2||0xc8;return function(_0x37334e){if(_0x37334e){return _0xb655cc[_0xa118('0x16')](_0x3d2cd2)[_0xa118('0x17')](_0x37334e);}};}function respondWithFilteredResult(_0x2d2fad,_0x580fa1){return function(_0x1dd0f1){if(_0x1dd0f1){var _0x12a7a9=typeof _0x580fa1[_0xa118('0x18')]===_0xa118('0x19')&&typeof _0x580fa1[_0xa118('0x1a')]==='undefined';var _0x13dc05=_0x1dd0f1[_0xa118('0x1b')];var _0x318de0=_0x12a7a9?0x0:_0x580fa1[_0xa118('0x18')];var _0x576994=_0x12a7a9?_0x1dd0f1[_0xa118('0x1b')]:_0x580fa1[_0xa118('0x18')]+_0x580fa1[_0xa118('0x1a')];var _0x4b0ba4;if(_0x576994>=_0x13dc05){_0x576994=_0x13dc05;_0x4b0ba4=0xc8;}else{_0x4b0ba4=0xce;}_0x2d2fad[_0xa118('0x16')](_0x4b0ba4);return _0x2d2fad['set'](_0xa118('0x1c'),_0x318de0+'-'+_0x576994+'/'+_0x13dc05)['json'](_0x1dd0f1);}return null;};}function patchUpdates(_0x44a8e7){return function(_0x276811){try{jsonpatch['apply'](_0x276811,_0x44a8e7,!![]);}catch(_0x266840){return BPromise['reject'](_0x266840);}return _0x276811[_0xa118('0x1d')]();};}function saveUpdates(_0x3ff23d,_0x2d9315){return function(_0x3918e7){if(_0x3918e7){return _0x3918e7[_0xa118('0x1e')](_0x3ff23d)[_0xa118('0x1f')](function(_0x297512){return _0x297512;});}return null;};}function removeEntity(_0x53e264,_0x416314){return function(_0x2fdc12){if(_0x2fdc12){return _0x2fdc12[_0xa118('0x20')]()[_0xa118('0x1f')](function(){_0x53e264[_0xa118('0x16')](0xcc)[_0xa118('0x15')]();});}};}function handleEntityNotFound(_0x1855f3,_0x7189c5){return function(_0x3881f1){if(!_0x3881f1){_0x1855f3['sendStatus'](0x194);}return _0x3881f1;};}function handleError(_0x4ebeb3,_0x1b3c86){_0x1b3c86=_0x1b3c86||0x1f4;return function(_0x1908e4){logger['error'](_0x1908e4[_0xa118('0x21')]);if(_0x1908e4['name']){delete _0x1908e4[_0xa118('0x22')];}_0x4ebeb3[_0xa118('0x16')](_0x1b3c86)[_0xa118('0x23')](_0x1908e4);};}exports[_0xa118('0x24')]=function(_0x3806e3,_0xc43ac2){var _0x4ae3b6={},_0x45095e={},_0x2da316={'count':0x0,'rows':[]};var _0xab5fe4=_['map'](db[_0xa118('0x25')][_0xa118('0x26')],function(_0x314c75){return{'name':_0x314c75[_0xa118('0x27')],'type':_0x314c75[_0xa118('0x28')][_0xa118('0x29')]};});_0x45095e[_0xa118('0x2a')]=_[_0xa118('0x2b')](_0xab5fe4,_0xa118('0x22'));_0x45095e[_0xa118('0x2c')]=_[_0xa118('0x2d')](_0x3806e3[_0xa118('0x2c')]);_0x45095e['filters']=_[_0xa118('0x2e')](_0x45095e['model'],_0x45095e['query']);_0x4ae3b6['attributes']=_[_0xa118('0x2e')](_0x45095e['model'],qs[_0xa118('0x2f')](_0x3806e3[_0xa118('0x2c')][_0xa118('0x2f')]));_0x4ae3b6[_0xa118('0x30')]=_0x4ae3b6['attributes']['length']?_0x4ae3b6[_0xa118('0x30')]:_0x45095e[_0xa118('0x2a')];if(!_0x3806e3['query'][_0xa118('0x31')]('nolimit')){_0x4ae3b6[_0xa118('0x1a')]=qs[_0xa118('0x1a')](_0x3806e3[_0xa118('0x2c')][_0xa118('0x1a')]);_0x4ae3b6[_0xa118('0x18')]=qs[_0xa118('0x18')](_0x3806e3[_0xa118('0x2c')][_0xa118('0x18')]);}_0x4ae3b6[_0xa118('0x32')]=qs['sort'](_0x3806e3[_0xa118('0x2c')][_0xa118('0x33')]);_0x4ae3b6['where']=qs['filters'](_[_0xa118('0x34')](_0x3806e3['query'],_0x45095e['filters']),_0xab5fe4);if(_0x3806e3[_0xa118('0x2c')][_0xa118('0x35')]){_0x4ae3b6['where']=_[_0xa118('0x36')](_0x4ae3b6['where'],{'$or':_['map'](_0xab5fe4,function(_0x2c6da5){if(_0x2c6da5[_0xa118('0x28')]!==_0xa118('0x37')){var _0x378cfb={};_0x378cfb[_0x2c6da5[_0xa118('0x22')]]={'$like':'%'+_0x3806e3[_0xa118('0x2c')][_0xa118('0x35')]+'%'};return _0x378cfb;}})});}_0x4ae3b6=_[_0xa118('0x36')]({},_0x4ae3b6,_0x3806e3[_0xa118('0x38')]);var _0x10fdfd={'where':_0x4ae3b6[_0xa118('0x39')]};return db[_0xa118('0x25')][_0xa118('0x1b')](_0x10fdfd)['then'](function(_0x4fa51a){_0x2da316['count']=_0x4fa51a;if(_0x3806e3[_0xa118('0x2c')]['includeAll']){_0x4ae3b6[_0xa118('0x3a')]=[{'all':!![]}];}return db['SquareReport'][_0xa118('0x3b')](_0x4ae3b6);})['then'](function(_0x246c1b){_0x2da316[_0xa118('0x3c')]=_0x246c1b;return _0x2da316;})[_0xa118('0x1f')](respondWithFilteredResult(_0xc43ac2,_0x4ae3b6))[_0xa118('0x3d')](handleError(_0xc43ac2,null));};exports[_0xa118('0x3e')]=function(_0x5b4785,_0x395cc4){var _0x39fe9d={'raw':!![],'where':{'id':_0x5b4785[_0xa118('0x3f')]['id']}},_0x3451f7={};_0x3451f7[_0xa118('0x2a')]=_['keys'](db[_0xa118('0x25')]['rawAttributes']);_0x3451f7[_0xa118('0x2c')]=_['keys'](_0x5b4785[_0xa118('0x2c')]);_0x3451f7[_0xa118('0x40')]=_['intersection'](_0x3451f7[_0xa118('0x2a')],_0x3451f7[_0xa118('0x2c')]);_0x39fe9d[_0xa118('0x30')]=_[_0xa118('0x2e')](_0x3451f7['model'],qs[_0xa118('0x2f')](_0x5b4785[_0xa118('0x2c')][_0xa118('0x2f')]));_0x39fe9d['attributes']=_0x39fe9d[_0xa118('0x30')]['length']?_0x39fe9d[_0xa118('0x30')]:_0x3451f7[_0xa118('0x2a')];if(_0x5b4785[_0xa118('0x2c')][_0xa118('0x41')]){_0x39fe9d['include']=[{'all':!![]}];}_0x39fe9d=_['merge']({},_0x39fe9d,_0x5b4785[_0xa118('0x38')]);return db[_0xa118('0x25')][_0xa118('0x42')](_0x39fe9d)[_0xa118('0x1f')](handleEntityNotFound(_0x395cc4,null))[_0xa118('0x1f')](respondWithResult(_0x395cc4,null))[_0xa118('0x3d')](handleError(_0x395cc4,null));};exports[_0xa118('0x43')]=function(_0x16d596,_0x28b525){return db[_0xa118('0x25')]['create'](_0x16d596[_0xa118('0x44')],{})[_0xa118('0x1f')](respondWithResult(_0x28b525,0xc9))[_0xa118('0x3d')](handleError(_0x28b525,null));};exports['update']=function(_0xabdb1b,_0x249c5e){if(_0xabdb1b[_0xa118('0x44')]['id']){delete _0xabdb1b['body']['id'];}return db[_0xa118('0x25')]['find']({'where':{'id':_0xabdb1b[_0xa118('0x3f')]['id']}})[_0xa118('0x1f')](handleEntityNotFound(_0x249c5e,null))[_0xa118('0x1f')](saveUpdates(_0xabdb1b['body'],null))[_0xa118('0x1f')](respondWithResult(_0x249c5e,null))['catch'](handleError(_0x249c5e,null));};exports[_0xa118('0x20')]=function(_0x57b3a6,_0x4ad9b3){return db[_0xa118('0x25')][_0xa118('0x42')]({'where':{'id':_0x57b3a6[_0xa118('0x3f')]['id']}})[_0xa118('0x1f')](handleEntityNotFound(_0x4ad9b3,null))[_0xa118('0x1f')](removeEntity(_0x4ad9b3,null))[_0xa118('0x3d')](handleError(_0x4ad9b3,null));};exports[_0xa118('0x45')]=function(_0x5d2ab0,_0x2afba1){return db[_0xa118('0x25')]['describe']()[_0xa118('0x1f')](respondWithResult(_0x2afba1,null))[_0xa118('0x3d')](handleError(_0x2afba1,null));}; \ No newline at end of file +var _0xad2e=['map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','where','pick','filter','merge','options','SquareReport','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','Content-Range','reject','update','then','destroy','error','name','send','rawAttributes','type','key'];(function(_0x345ae6,_0x10f6c7){var _0x22912c=function(_0x382750){while(--_0x382750){_0x345ae6['push'](_0x345ae6['shift']());}};_0x22912c(++_0x10f6c7);}(_0xad2e,0x1d3));var _0xead2=function(_0x17d800,_0x5c6297){_0x17d800=_0x17d800-0x0;var _0x760776=_0xad2e[_0x17d800];return _0x760776;};'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(_0xead2('0x4'));var moment=require(_0xead2('0x5'));var BPromise=require(_0xead2('0x6'));var Mustache=require(_0xead2('0x7'));var util=require('util');var path=require(_0xead2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xead2('0x9'));var fs=require('fs');var fs_extra=require(_0xead2('0xa'));var _=require('lodash');var squel=require(_0xead2('0xb'));var crypto=require('crypto');var jsforce=require(_0xead2('0xc'));var deskjs=require(_0xead2('0xd'));var toCsv=require('to-csv');var querystring=require(_0xead2('0xe'));var Papa=require(_0xead2('0xf'));var Redis=require(_0xead2('0x10'));var authService=require(_0xead2('0x11'));var qs=require(_0xead2('0x12'));var as=require(_0xead2('0x13'));var hardwareService=require(_0xead2('0x14'));var logger=require(_0xead2('0x15'))('api');var utils=require(_0xead2('0x16'));var config=require(_0xead2('0x17'));var licenseUtil=require(_0xead2('0x18'));var db=require(_0xead2('0x19'))['db'];function respondWithStatusCode(_0x25cdb6,_0x1c7c8a){_0x1c7c8a=_0x1c7c8a||0xcc;return function(_0x21537e){if(_0x21537e){return _0x25cdb6[_0xead2('0x1a')](_0x1c7c8a);}return _0x25cdb6[_0xead2('0x1b')](_0x1c7c8a)[_0xead2('0x1c')]();};}function respondWithResult(_0x26ddc6,_0xe13e70){_0xe13e70=_0xe13e70||0xc8;return function(_0x4f4a92){if(_0x4f4a92){return _0x26ddc6[_0xead2('0x1b')](_0xe13e70)[_0xead2('0x1d')](_0x4f4a92);}};}function respondWithFilteredResult(_0x254f74,_0x376978){return function(_0x3d6bb2){if(_0x3d6bb2){var _0x4ea4a1=typeof _0x376978['offset']===_0xead2('0x1e')&&typeof _0x376978['limit']===_0xead2('0x1e');var _0x5b501f=_0x3d6bb2[_0xead2('0x1f')];var _0x578a04=_0x4ea4a1?0x0:_0x376978[_0xead2('0x20')];var _0x4dc1a=_0x4ea4a1?_0x3d6bb2[_0xead2('0x1f')]:_0x376978[_0xead2('0x20')]+_0x376978['limit'];var _0x411563;if(_0x4dc1a>=_0x5b501f){_0x4dc1a=_0x5b501f;_0x411563=0xc8;}else{_0x411563=0xce;}_0x254f74[_0xead2('0x1b')](_0x411563);return _0x254f74['set'](_0xead2('0x21'),_0x578a04+'-'+_0x4dc1a+'/'+_0x5b501f)[_0xead2('0x1d')](_0x3d6bb2);}return null;};}function patchUpdates(_0x327524){return function(_0x4885de){try{jsonpatch['apply'](_0x4885de,_0x327524,!![]);}catch(_0x56f80b){return BPromise[_0xead2('0x22')](_0x56f80b);}return _0x4885de['save']();};}function saveUpdates(_0x543e15,_0x38a503){return function(_0x2c2c58){if(_0x2c2c58){return _0x2c2c58[_0xead2('0x23')](_0x543e15)[_0xead2('0x24')](function(_0xc2be23){return _0xc2be23;});}return null;};}function removeEntity(_0x467925,_0x11f4c7){return function(_0x30a130){if(_0x30a130){return _0x30a130[_0xead2('0x25')]()[_0xead2('0x24')](function(){_0x467925['status'](0xcc)[_0xead2('0x1c')]();});}};}function handleEntityNotFound(_0x238770,_0x2e5634){return function(_0x28a3f3){if(!_0x28a3f3){_0x238770[_0xead2('0x1a')](0x194);}return _0x28a3f3;};}function handleError(_0x39ef30,_0x5df215){_0x5df215=_0x5df215||0x1f4;return function(_0x2be247){logger[_0xead2('0x26')](_0x2be247['stack']);if(_0x2be247['name']){delete _0x2be247[_0xead2('0x27')];}_0x39ef30['status'](_0x5df215)[_0xead2('0x28')](_0x2be247);};}exports['index']=function(_0x420ec0,_0x558815){var _0x15d9ae={},_0xa49cb3={},_0x4dbfa9={'count':0x0,'rows':[]};var _0x1b73cc=_['map'](db['SquareReport'][_0xead2('0x29')],function(_0x366739){return{'name':_0x366739['fieldName'],'type':_0x366739[_0xead2('0x2a')][_0xead2('0x2b')]};});_0xa49cb3['model']=_[_0xead2('0x2c')](_0x1b73cc,_0xead2('0x27'));_0xa49cb3[_0xead2('0x2d')]=_[_0xead2('0x2e')](_0x420ec0[_0xead2('0x2d')]);_0xa49cb3[_0xead2('0x2f')]=_[_0xead2('0x30')](_0xa49cb3[_0xead2('0x31')],_0xa49cb3[_0xead2('0x2d')]);_0x15d9ae[_0xead2('0x32')]=_[_0xead2('0x30')](_0xa49cb3[_0xead2('0x31')],qs[_0xead2('0x33')](_0x420ec0['query'][_0xead2('0x33')]));_0x15d9ae[_0xead2('0x32')]=_0x15d9ae[_0xead2('0x32')][_0xead2('0x34')]?_0x15d9ae['attributes']:_0xa49cb3['model'];if(!_0x420ec0[_0xead2('0x2d')]['hasOwnProperty'](_0xead2('0x35'))){_0x15d9ae[_0xead2('0x36')]=qs['limit'](_0x420ec0[_0xead2('0x2d')][_0xead2('0x36')]);_0x15d9ae['offset']=qs['offset'](_0x420ec0[_0xead2('0x2d')]['offset']);}_0x15d9ae[_0xead2('0x37')]=qs['sort'](_0x420ec0['query']['sort']);_0x15d9ae[_0xead2('0x38')]=qs[_0xead2('0x2f')](_[_0xead2('0x39')](_0x420ec0[_0xead2('0x2d')],_0xa49cb3[_0xead2('0x2f')]),_0x1b73cc);if(_0x420ec0[_0xead2('0x2d')][_0xead2('0x3a')]){_0x15d9ae[_0xead2('0x38')]=_[_0xead2('0x3b')](_0x15d9ae[_0xead2('0x38')],{'$or':_['map'](_0x1b73cc,function(_0x7307b9){if(_0x7307b9[_0xead2('0x2a')]!=='VIRTUAL'){var _0x3e4d2e={};_0x3e4d2e[_0x7307b9[_0xead2('0x27')]]={'$like':'%'+_0x420ec0[_0xead2('0x2d')][_0xead2('0x3a')]+'%'};return _0x3e4d2e;}})});}_0x15d9ae=_[_0xead2('0x3b')]({},_0x15d9ae,_0x420ec0[_0xead2('0x3c')]);var _0x491a4f={'where':_0x15d9ae[_0xead2('0x38')]};return db[_0xead2('0x3d')][_0xead2('0x1f')](_0x491a4f)[_0xead2('0x24')](function(_0x39a613){_0x4dbfa9[_0xead2('0x1f')]=_0x39a613;if(_0x420ec0['query'][_0xead2('0x3e')]){_0x15d9ae[_0xead2('0x3f')]=[{'all':!![]}];}return db[_0xead2('0x3d')][_0xead2('0x40')](_0x15d9ae);})[_0xead2('0x24')](function(_0x4b4214){_0x4dbfa9[_0xead2('0x41')]=_0x4b4214;return _0x4dbfa9;})[_0xead2('0x24')](respondWithFilteredResult(_0x558815,_0x15d9ae))['catch'](handleError(_0x558815,null));};exports[_0xead2('0x42')]=function(_0x4cae39,_0x4e0a71){var _0x55223c={'raw':!![],'where':{'id':_0x4cae39[_0xead2('0x43')]['id']}},_0x3a1f25={};_0x3a1f25[_0xead2('0x31')]=_[_0xead2('0x2e')](db[_0xead2('0x3d')][_0xead2('0x29')]);_0x3a1f25[_0xead2('0x2d')]=_[_0xead2('0x2e')](_0x4cae39[_0xead2('0x2d')]);_0x3a1f25['filters']=_[_0xead2('0x30')](_0x3a1f25['model'],_0x3a1f25[_0xead2('0x2d')]);_0x55223c['attributes']=_[_0xead2('0x30')](_0x3a1f25[_0xead2('0x31')],qs[_0xead2('0x33')](_0x4cae39['query']['fields']));_0x55223c[_0xead2('0x32')]=_0x55223c[_0xead2('0x32')]['length']?_0x55223c[_0xead2('0x32')]:_0x3a1f25[_0xead2('0x31')];if(_0x4cae39[_0xead2('0x2d')][_0xead2('0x3e')]){_0x55223c[_0xead2('0x3f')]=[{'all':!![]}];}_0x55223c=_['merge']({},_0x55223c,_0x4cae39['options']);return db[_0xead2('0x3d')][_0xead2('0x44')](_0x55223c)['then'](handleEntityNotFound(_0x4e0a71,null))[_0xead2('0x24')](respondWithResult(_0x4e0a71,null))[_0xead2('0x45')](handleError(_0x4e0a71,null));};exports[_0xead2('0x46')]=function(_0x37c28e,_0x1c31cd){return db[_0xead2('0x3d')][_0xead2('0x46')](_0x37c28e[_0xead2('0x47')],{})[_0xead2('0x24')](respondWithResult(_0x1c31cd,0xc9))[_0xead2('0x45')](handleError(_0x1c31cd,null));};exports[_0xead2('0x23')]=function(_0x4a3bf3,_0x131acd){if(_0x4a3bf3[_0xead2('0x47')]['id']){delete _0x4a3bf3[_0xead2('0x47')]['id'];}return db[_0xead2('0x3d')]['find']({'where':{'id':_0x4a3bf3['params']['id']}})['then'](handleEntityNotFound(_0x131acd,null))['then'](saveUpdates(_0x4a3bf3[_0xead2('0x47')],null))[_0xead2('0x24')](respondWithResult(_0x131acd,null))['catch'](handleError(_0x131acd,null));};exports[_0xead2('0x25')]=function(_0x35b34c,_0x2f51cf){return db[_0xead2('0x3d')][_0xead2('0x44')]({'where':{'id':_0x35b34c['params']['id']}})[_0xead2('0x24')](handleEntityNotFound(_0x2f51cf,null))[_0xead2('0x24')](removeEntity(_0x2f51cf,null))[_0xead2('0x45')](handleError(_0x2f51cf,null));};exports[_0xead2('0x48')]=function(_0x142951,_0x2021bf){return db['SquareReport'][_0xead2('0x48')]()[_0xead2('0x24')](respondWithResult(_0x2021bf,null))['catch'](handleError(_0x2021bf,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 98898ee..7977588 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 _0x91d4=['../../config/environment','./squareReport.attributes','exports','define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x3bd792,_0x171a3e){var _0x405c0f=function(_0x3c2cae){while(--_0x3c2cae){_0x3bd792['push'](_0x3bd792['shift']());}};_0x405c0f(++_0x171a3e);}(_0x91d4,0x89));var _0x491d=function(_0x5a3f3a,_0x3ae10e){_0x5a3f3a=_0x5a3f3a-0x0;var _0x5a6216=_0x91d4[_0x5a3f3a];return _0x5a6216;};'use strict';var _=require(_0x491d('0x0'));var util=require(_0x491d('0x1'));var logger=require(_0x491d('0x2'))('api');var moment=require(_0x491d('0x3'));var BPromise=require(_0x491d('0x4'));var rp=require(_0x491d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x491d('0x6'));var config=require(_0x491d('0x7'));var attributes=require(_0x491d('0x8'));module[_0x491d('0x9')]=function(_0xef7d3c,_0x36fc3e){return _0xef7d3c[_0x491d('0xa')]('SquareReport',attributes,{'tableName':_0x491d('0xb'),'paranoid':![],'indexes':[{'name':_0x491d('0xc'),'fields':[_0x491d('0xd'),_0x491d('0xe')]},{'name':_0x491d('0xf'),'fields':[_0x491d('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4e8d=['leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid'];(function(_0x5110c9,_0x99ee79){var _0x14e539=function(_0x1c8ec9){while(--_0x1c8ec9){_0x5110c9['push'](_0x5110c9['shift']());}};_0x14e539(++_0x99ee79);}(_0x4e8d,0x171));var _0xd4e8=function(_0x512faa,_0x1ce57a){_0x512faa=_0x512faa-0x0;var _0x391e52=_0x4e8d[_0x512faa];return _0x391e52;};'use strict';var _=require(_0xd4e8('0x0'));var util=require(_0xd4e8('0x1'));var logger=require(_0xd4e8('0x2'))(_0xd4e8('0x3'));var moment=require(_0xd4e8('0x4'));var BPromise=require(_0xd4e8('0x5'));var rp=require(_0xd4e8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd4e8('0x7'));var attributes=require(_0xd4e8('0x8'));module[_0xd4e8('0x9')]=function(_0x134a77,_0x11baba){return _0x134a77[_0xd4e8('0xa')](_0xd4e8('0xb'),attributes,{'tableName':_0xd4e8('0xc'),'paranoid':![],'indexes':[{'name':_0xd4e8('0xd'),'fields':[_0xd4e8('0xe'),'project_name']},{'name':'leaveAt','fields':[_0xd4e8('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index cd6d2de..b432ed3 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 _0xce77=['../../config/environment','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SquareReport,\x20%s,\x20%s','SquareReport','create','raw','CreateSquareReport','debug','catch','update','body','options','where','attributes','limit','UpdateSquareReport','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x30c7c5,_0x168208){var _0x29e24e=function(_0x427d3e){while(--_0x427d3e){_0x30c7c5['push'](_0x30c7c5['shift']());}};_0x29e24e(++_0x168208);}(_0xce77,0x13a));var _0x7ce7=function(_0xdff113,_0x789db6){_0xdff113=_0xdff113-0x0;var _0x502ea0=_0xce77[_0xdff113];return _0x502ea0;};'use strict';var _=require(_0x7ce7('0x0'));var util=require('util');var moment=require(_0x7ce7('0x1'));var BPromise=require('bluebird');var rs=require(_0x7ce7('0x2'));var fs=require('fs');var Redis=require(_0x7ce7('0x3'));var db=require(_0x7ce7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7ce7('0x5'))('rpc');var config=require(_0x7ce7('0x6'));var jayson=require(_0x7ce7('0x7'));var client=jayson[_0x7ce7('0x8')][_0x7ce7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1dab87,_0x47e14c,_0x2f1131){return new BPromise(function(_0x5c5405,_0x44fda3){return client[_0x7ce7('0xa')](_0x1dab87,_0x2f1131)[_0x7ce7('0xb')](function(_0x5c7e3d){logger[_0x7ce7('0xc')]('SquareReport,\x20%s,\x20%s',_0x47e14c,'request\x20sent');logger['debug'](_0x7ce7('0xd'),_0x47e14c,_0x7ce7('0xe'),JSON[_0x7ce7('0xf')](_0x5c7e3d));if(_0x5c7e3d[_0x7ce7('0x10')]){if(_0x5c7e3d[_0x7ce7('0x10')]['code']===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0x47e14c,_0x5c7e3d[_0x7ce7('0x10')]['message']);return _0x44fda3(_0x5c7e3d[_0x7ce7('0x10')][_0x7ce7('0x11')]);}logger[_0x7ce7('0x10')]('SquareReport,\x20%s,\x20%s',_0x47e14c,_0x5c7e3d[_0x7ce7('0x10')][_0x7ce7('0x11')]);return _0x5c5405(_0x5c7e3d[_0x7ce7('0x10')]['message']);}else{logger[_0x7ce7('0xc')](_0x7ce7('0x12'),_0x47e14c,'request\x20sent');_0x5c5405(_0x5c7e3d['result'][_0x7ce7('0x11')]);}})['catch'](function(_0x3a0352){logger['error']('SquareReport,\x20%s,\x20%s',_0x47e14c,_0x3a0352);_0x44fda3(_0x3a0352);});});}exports['CreateSquareReport']=function(_0x2c60a6){var _0x40993e=this;return new Promise(function(_0x258b8a,_0x195a42){return db[_0x7ce7('0x13')][_0x7ce7('0x14')](_0x2c60a6['body'],{'raw':_0x2c60a6['options']?_0x2c60a6['options'][_0x7ce7('0x15')]===undefined?!![]:![]:!![]})[_0x7ce7('0xb')](function(_0x3c76f8){logger['info'](_0x7ce7('0x16'),_0x2c60a6);logger[_0x7ce7('0x17')](_0x7ce7('0x16'),_0x2c60a6,JSON[_0x7ce7('0xf')](_0x3c76f8));_0x258b8a(_0x3c76f8);})[_0x7ce7('0x18')](function(_0x3aa657){logger[_0x7ce7('0x10')](_0x7ce7('0x16'),_0x3aa657[_0x7ce7('0x11')],_0x2c60a6);_0x195a42(_0x40993e[_0x7ce7('0x10')](0x1f4,_0x3aa657[_0x7ce7('0x11')]));});});};exports['UpdateSquareReport']=function(_0x4f5827){var _0x4fc6bc=this;return new Promise(function(_0x57aea1,_0x57a1ae){return db[_0x7ce7('0x13')][_0x7ce7('0x19')](_0x4f5827[_0x7ce7('0x1a')],{'raw':_0x4f5827[_0x7ce7('0x1b')]?_0x4f5827[_0x7ce7('0x1b')][_0x7ce7('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f5827[_0x7ce7('0x1b')]?_0x4f5827['options'][_0x7ce7('0x1c')]||null:null,'attributes':_0x4f5827[_0x7ce7('0x1b')]?_0x4f5827[_0x7ce7('0x1b')][_0x7ce7('0x1d')]||null:null,'limit':_0x4f5827[_0x7ce7('0x1b')]?_0x4f5827[_0x7ce7('0x1b')][_0x7ce7('0x1e')]||null:null})[_0x7ce7('0xb')](function(_0x1b73be){logger[_0x7ce7('0xc')](_0x7ce7('0x1f'),_0x4f5827);logger[_0x7ce7('0x17')](_0x7ce7('0x1f'),_0x4f5827,JSON['stringify'](_0x1b73be));_0x57aea1(_0x1b73be);})[_0x7ce7('0x18')](function(_0x22c584){logger[_0x7ce7('0x10')](_0x7ce7('0x1f'),_0x22c584['message'],_0x4f5827);_0x57a1ae(_0x4fc6bc[_0x7ce7('0x10')](0x1f4,_0x22c584['message']));});});}; \ No newline at end of file +var _0x8411=['bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','CreateSquareReport','SquareReport','body','options','stringify','UpdateSquareReport','update','raw','where','attributes','limit','catch','util'];(function(_0x5af5bc,_0x541227){var _0x2bd20d=function(_0x30030c){while(--_0x30030c){_0x5af5bc['push'](_0x5af5bc['shift']());}};_0x2bd20d(++_0x541227);}(_0x8411,0x185));var _0x1841=function(_0x2b597d,_0x42f366){_0x2b597d=_0x2b597d-0x0;var _0x262607=_0x8411[_0x2b597d];return _0x262607;};'use strict';var _=require('lodash');var util=require(_0x1841('0x0'));var moment=require('moment');var BPromise=require(_0x1841('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1841('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1841('0x3'));var logger=require('../../config/logger')(_0x1841('0x4'));var config=require('../../config/environment');var jayson=require(_0x1841('0x5'));var client=jayson[_0x1841('0x6')][_0x1841('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x51beaa,_0x1c587f,_0x40f04d){return new BPromise(function(_0x2027c3,_0x18ad87){return client[_0x1841('0x8')](_0x51beaa,_0x40f04d)[_0x1841('0x9')](function(_0x5670dc){logger['info'](_0x1841('0xa'),_0x1c587f,_0x1841('0xb'));logger[_0x1841('0xc')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x1c587f,_0x1841('0xb'),JSON['stringify'](_0x5670dc));if(_0x5670dc[_0x1841('0xd')]){if(_0x5670dc['error'][_0x1841('0xe')]===0x1f4){logger[_0x1841('0xd')](_0x1841('0xa'),_0x1c587f,_0x5670dc['error'][_0x1841('0xf')]);return _0x18ad87(_0x5670dc[_0x1841('0xd')]['message']);}logger['error'](_0x1841('0xa'),_0x1c587f,_0x5670dc[_0x1841('0xd')][_0x1841('0xf')]);return _0x2027c3(_0x5670dc[_0x1841('0xd')][_0x1841('0xf')]);}else{logger[_0x1841('0x10')](_0x1841('0xa'),_0x1c587f,_0x1841('0xb'));_0x2027c3(_0x5670dc[_0x1841('0x11')]['message']);}})['catch'](function(_0x30f4ec){logger['error'](_0x1841('0xa'),_0x1c587f,_0x30f4ec);_0x18ad87(_0x30f4ec);});});}exports[_0x1841('0x12')]=function(_0x13356c){var _0x313481=this;return new Promise(function(_0x379d7a,_0xf2d5c){return db[_0x1841('0x13')]['create'](_0x13356c[_0x1841('0x14')],{'raw':_0x13356c[_0x1841('0x15')]?_0x13356c[_0x1841('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x1841('0x9')](function(_0x4b7d09){logger['info'](_0x1841('0x12'),_0x13356c);logger[_0x1841('0xc')](_0x1841('0x12'),_0x13356c,JSON[_0x1841('0x16')](_0x4b7d09));_0x379d7a(_0x4b7d09);})['catch'](function(_0x22ecc4){logger[_0x1841('0xd')]('CreateSquareReport',_0x22ecc4[_0x1841('0xf')],_0x13356c);_0xf2d5c(_0x313481['error'](0x1f4,_0x22ecc4['message']));});});};exports[_0x1841('0x17')]=function(_0x2a2f62){var _0x251ba0=this;return new Promise(function(_0x3e18dd,_0x3342c1){return db['SquareReport'][_0x1841('0x18')](_0x2a2f62[_0x1841('0x14')],{'raw':_0x2a2f62['options']?_0x2a2f62['options'][_0x1841('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a2f62[_0x1841('0x15')]?_0x2a2f62[_0x1841('0x15')][_0x1841('0x1a')]||null:null,'attributes':_0x2a2f62[_0x1841('0x15')]?_0x2a2f62['options'][_0x1841('0x1b')]||null:null,'limit':_0x2a2f62[_0x1841('0x15')]?_0x2a2f62[_0x1841('0x15')][_0x1841('0x1c')]||null:null})[_0x1841('0x9')](function(_0x526cf5){logger[_0x1841('0x10')]('UpdateSquareReport',_0x2a2f62);logger['debug'](_0x1841('0x17'),_0x2a2f62,JSON['stringify'](_0x526cf5));_0x3e18dd(_0x526cf5);})[_0x1841('0x1d')](function(_0x187861){logger[_0x1841('0xd')](_0x1841('0x17'),_0x187861[_0x1841('0xf')],_0x2a2f62);_0x3342c1(_0x251ba0['error'](0x1f4,_0x187861['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index ed93789..89d3602 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 _0x0748=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0748,0xf9));var _0x8074=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x0748[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x8074('0x0'));var util=require(_0x8074('0x1'));var path=require(_0x8074('0x2'));var timeout=require(_0x8074('0x3'));var express=require(_0x8074('0x4'));var router=express[_0x8074('0x5')]();var fs_extra=require(_0x8074('0x6'));var auth=require(_0x8074('0x7'));var interaction=require(_0x8074('0x8'));var config=require(_0x8074('0x9'));var controller=require(_0x8074('0xa'));router[_0x8074('0xb')]('/',auth[_0x8074('0xc')](),controller[_0x8074('0xd')]);router[_0x8074('0xb')](_0x8074('0xe'),auth[_0x8074('0xc')](),controller[_0x8074('0xf')]);router[_0x8074('0xb')](_0x8074('0x10'),auth[_0x8074('0xc')](),controller['show']);router[_0x8074('0x11')]('/',auth[_0x8074('0xc')](),controller[_0x8074('0x12')]);router[_0x8074('0x13')](_0x8074('0x10'),auth[_0x8074('0xc')](),controller['update']);router[_0x8074('0x14')]('/:id',auth[_0x8074('0xc')](),controller[_0x8074('0x15')]);module[_0x8074('0x16')]=router; \ No newline at end of file +var _0xdc4d=['show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','get','/describe','describe'];(function(_0x49fed4,_0x50e0dc){var _0x1d5618=function(_0xd848a2){while(--_0xd848a2){_0x49fed4['push'](_0x49fed4['shift']());}};_0x1d5618(++_0x50e0dc);}(_0xdc4d,0x6b));var _0xddc4=function(_0x39e945,_0x1124ed){_0x39e945=_0x39e945-0x0;var _0x1f158a=_0xdc4d[_0x39e945];return _0x1f158a;};'use strict';var multer=require(_0xddc4('0x0'));var util=require(_0xddc4('0x1'));var path=require('path');var timeout=require(_0xddc4('0x2'));var express=require('express');var router=express[_0xddc4('0x3')]();var fs_extra=require(_0xddc4('0x4'));var auth=require(_0xddc4('0x5'));var interaction=require(_0xddc4('0x6'));var config=require(_0xddc4('0x7'));var controller=require(_0xddc4('0x8'));router['get']('/',auth[_0xddc4('0x9')](),controller['index']);router[_0xddc4('0xa')](_0xddc4('0xb'),auth[_0xddc4('0x9')](),controller[_0xddc4('0xc')]);router[_0xddc4('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xddc4('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xddc4('0xe')]);router[_0xddc4('0xf')]('/:id',auth[_0xddc4('0x9')](),controller[_0xddc4('0x10')]);router[_0xddc4('0x11')]('/:id',auth[_0xddc4('0x9')](),controller[_0xddc4('0x12')]);module[_0xddc4('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 469e50e..e7e008f 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 _0x8b86=['TEXT','sequelize','exports','STRING'];(function(_0x24ea5f,_0x14413d){var _0x4e549a=function(_0x364c69){while(--_0x364c69){_0x24ea5f['push'](_0x24ea5f['shift']());}};_0x4e549a(++_0x14413d);}(_0x8b86,0xcd));var _0x68b8=function(_0x276015,_0x57eb3d){_0x276015=_0x276015-0x0;var _0x385345=_0x8b86[_0x276015];return _0x385345;};'use strict';var Sequelize=require(_0x68b8('0x0'));module[_0x68b8('0x1')]={'uniqueid':{'type':Sequelize[_0x68b8('0x2')]},'node':{'type':Sequelize[_0x68b8('0x2')]},'application':{'type':Sequelize[_0x68b8('0x2')]},'data':{'type':Sequelize[_0x68b8('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x68b8('0x2')]}}; \ No newline at end of file +var _0x0601=['exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0601,0x140));var _0x1060=function(_0xd97ecc,_0x5d6a2f){_0xd97ecc=_0xd97ecc-0x0;var _0xa70368=_0x0601[_0xd97ecc];return _0xa70368;};'use strict';var Sequelize=require('sequelize');module[_0x1060('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x1060('0x1')]},'application':{'type':Sequelize[_0x1060('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x1060('0x1')]},'callerid':{'type':Sequelize[_0x1060('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index a4a54d3..37d6219 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 _0x3c8b=['map','SquareDetailsReport','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','include','rows','catch','params','keys','rawAttributes','options','find','create','body','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','squel','crypto','desk.js','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','index'];(function(_0x3ab129,_0x3cdadf){var _0xa3d799=function(_0x466818){while(--_0x466818){_0x3ab129['push'](_0x3ab129['shift']());}};_0xa3d799(++_0x3cdadf);}(_0x3c8b,0x9c));var _0xb3c8=function(_0x571a66,_0x1e0bc7){_0x571a66=_0x571a66-0x0;var _0x599936=_0x3c8b[_0x571a66];return _0x599936;};'use strict';var emlformat=require(_0xb3c8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb3c8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb3c8('0x2'));var BPromise=require(_0xb3c8('0x3'));var Mustache=require(_0xb3c8('0x4'));var util=require(_0xb3c8('0x5'));var path=require(_0xb3c8('0x6'));var sox=require('sox');var csv=require(_0xb3c8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb3c8('0x8'));var crypto=require(_0xb3c8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xb3c8('0xa'));var toCsv=require(_0xb3c8('0x7'));var querystring=require(_0xb3c8('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xb3c8('0xc'));var hardwareService=require(_0xb3c8('0xd'));var logger=require(_0xb3c8('0xe'))(_0xb3c8('0xf'));var utils=require('../../config/utils');var config=require(_0xb3c8('0x10'));var licenseUtil=require(_0xb3c8('0x11'));var db=require(_0xb3c8('0x12'))['db'];function respondWithStatusCode(_0x59eeaf,_0x10e0d6){_0x10e0d6=_0x10e0d6||0xcc;return function(_0x3b61b3){if(_0x3b61b3){return _0x59eeaf['sendStatus'](_0x10e0d6);}return _0x59eeaf[_0xb3c8('0x13')](_0x10e0d6)[_0xb3c8('0x14')]();};}function respondWithResult(_0x3ebacd,_0x24e83f){_0x24e83f=_0x24e83f||0xc8;return function(_0x2ae974){if(_0x2ae974){return _0x3ebacd[_0xb3c8('0x13')](_0x24e83f)[_0xb3c8('0x15')](_0x2ae974);}};}function respondWithFilteredResult(_0xb2fb57,_0x25f08e){return function(_0x2e4440){if(_0x2e4440){var _0x46e5a8=typeof _0x25f08e[_0xb3c8('0x16')]==='undefined'&&typeof _0x25f08e[_0xb3c8('0x17')]==='undefined';var _0x274f8f=_0x2e4440[_0xb3c8('0x18')];var _0x4a909d=_0x46e5a8?0x0:_0x25f08e[_0xb3c8('0x16')];var _0x303d1b=_0x46e5a8?_0x2e4440[_0xb3c8('0x18')]:_0x25f08e[_0xb3c8('0x16')]+_0x25f08e['limit'];var _0x203834;if(_0x303d1b>=_0x274f8f){_0x303d1b=_0x274f8f;_0x203834=0xc8;}else{_0x203834=0xce;}_0xb2fb57[_0xb3c8('0x13')](_0x203834);return _0xb2fb57[_0xb3c8('0x19')](_0xb3c8('0x1a'),_0x4a909d+'-'+_0x303d1b+'/'+_0x274f8f)[_0xb3c8('0x15')](_0x2e4440);}return null;};}function patchUpdates(_0x4039a1){return function(_0x1a09f8){try{jsonpatch['apply'](_0x1a09f8,_0x4039a1,!![]);}catch(_0x34ec99){return BPromise[_0xb3c8('0x1b')](_0x34ec99);}return _0x1a09f8[_0xb3c8('0x1c')]();};}function saveUpdates(_0x3e4423,_0x4e76b7){return function(_0x3d748d){if(_0x3d748d){return _0x3d748d[_0xb3c8('0x1d')](_0x3e4423)[_0xb3c8('0x1e')](function(_0x4e4083){return _0x4e4083;});}return null;};}function removeEntity(_0x56ecbb,_0xc28dca){return function(_0x36b358){if(_0x36b358){return _0x36b358['destroy']()[_0xb3c8('0x1e')](function(){_0x56ecbb[_0xb3c8('0x13')](0xcc)[_0xb3c8('0x14')]();});}};}function handleEntityNotFound(_0x335991,_0x30587b){return function(_0x2ec2a9){if(!_0x2ec2a9){_0x335991[_0xb3c8('0x1f')](0x194);}return _0x2ec2a9;};}function handleError(_0x418452,_0x15a82a){_0x15a82a=_0x15a82a||0x1f4;return function(_0x45ad8f){logger[_0xb3c8('0x20')](_0x45ad8f[_0xb3c8('0x21')]);if(_0x45ad8f[_0xb3c8('0x22')]){delete _0x45ad8f['name'];}_0x418452[_0xb3c8('0x13')](_0x15a82a)['send'](_0x45ad8f);};}exports[_0xb3c8('0x23')]=function(_0x51ca32,_0x5bca44){var _0x156a08={},_0x283914={},_0x4ed175={'count':0x0,'rows':[]};var _0x4f910b=_[_0xb3c8('0x24')](db[_0xb3c8('0x25')]['rawAttributes'],function(_0x5dd92c){return{'name':_0x5dd92c['fieldName'],'type':_0x5dd92c[_0xb3c8('0x26')]['key']};});_0x283914[_0xb3c8('0x27')]=_[_0xb3c8('0x24')](_0x4f910b,_0xb3c8('0x22'));_0x283914['query']=_['keys'](_0x51ca32[_0xb3c8('0x28')]);_0x283914[_0xb3c8('0x29')]=_['intersection'](_0x283914['model'],_0x283914[_0xb3c8('0x28')]);_0x156a08[_0xb3c8('0x2a')]=_[_0xb3c8('0x2b')](_0x283914[_0xb3c8('0x27')],qs['fields'](_0x51ca32[_0xb3c8('0x28')][_0xb3c8('0x2c')]));_0x156a08['attributes']=_0x156a08[_0xb3c8('0x2a')][_0xb3c8('0x2d')]?_0x156a08['attributes']:_0x283914[_0xb3c8('0x27')];if(!_0x51ca32[_0xb3c8('0x28')][_0xb3c8('0x2e')](_0xb3c8('0x2f'))){_0x156a08[_0xb3c8('0x17')]=qs['limit'](_0x51ca32[_0xb3c8('0x28')][_0xb3c8('0x17')]);_0x156a08[_0xb3c8('0x16')]=qs[_0xb3c8('0x16')](_0x51ca32[_0xb3c8('0x28')][_0xb3c8('0x16')]);}_0x156a08['order']=qs[_0xb3c8('0x30')](_0x51ca32[_0xb3c8('0x28')]['sort']);_0x156a08[_0xb3c8('0x31')]=qs[_0xb3c8('0x29')](_[_0xb3c8('0x32')](_0x51ca32[_0xb3c8('0x28')],_0x283914[_0xb3c8('0x29')]),_0x4f910b);if(_0x51ca32[_0xb3c8('0x28')]['filter']){_0x156a08[_0xb3c8('0x31')]=_[_0xb3c8('0x33')](_0x156a08[_0xb3c8('0x31')],{'$or':_[_0xb3c8('0x24')](_0x4f910b,function(_0x3dea60){if(_0x3dea60[_0xb3c8('0x26')]!=='VIRTUAL'){var _0x1ec304={};_0x1ec304[_0x3dea60[_0xb3c8('0x22')]]={'$like':'%'+_0x51ca32[_0xb3c8('0x28')][_0xb3c8('0x34')]+'%'};return _0x1ec304;}})});}_0x156a08=_[_0xb3c8('0x33')]({},_0x156a08,_0x51ca32['options']);var _0x203021={'where':_0x156a08['where']};return db[_0xb3c8('0x25')][_0xb3c8('0x18')](_0x203021)[_0xb3c8('0x1e')](function(_0x4a2788){_0x4ed175[_0xb3c8('0x18')]=_0x4a2788;if(_0x51ca32[_0xb3c8('0x28')]['includeAll']){_0x156a08[_0xb3c8('0x35')]=[{'all':!![]}];}return db[_0xb3c8('0x25')]['findAll'](_0x156a08);})[_0xb3c8('0x1e')](function(_0x45e361){_0x4ed175[_0xb3c8('0x36')]=_0x45e361;return _0x4ed175;})['then'](respondWithFilteredResult(_0x5bca44,_0x156a08))[_0xb3c8('0x37')](handleError(_0x5bca44,null));};exports['show']=function(_0x1a4991,_0x2131a4){var _0x25ddfd={'raw':!![],'where':{'id':_0x1a4991[_0xb3c8('0x38')]['id']}},_0x10cb85={};_0x10cb85[_0xb3c8('0x27')]=_[_0xb3c8('0x39')](db['SquareDetailsReport'][_0xb3c8('0x3a')]);_0x10cb85['query']=_[_0xb3c8('0x39')](_0x1a4991[_0xb3c8('0x28')]);_0x10cb85[_0xb3c8('0x29')]=_[_0xb3c8('0x2b')](_0x10cb85[_0xb3c8('0x27')],_0x10cb85[_0xb3c8('0x28')]);_0x25ddfd[_0xb3c8('0x2a')]=_['intersection'](_0x10cb85[_0xb3c8('0x27')],qs[_0xb3c8('0x2c')](_0x1a4991[_0xb3c8('0x28')][_0xb3c8('0x2c')]));_0x25ddfd[_0xb3c8('0x2a')]=_0x25ddfd[_0xb3c8('0x2a')][_0xb3c8('0x2d')]?_0x25ddfd[_0xb3c8('0x2a')]:_0x10cb85[_0xb3c8('0x27')];if(_0x1a4991[_0xb3c8('0x28')]['includeAll']){_0x25ddfd[_0xb3c8('0x35')]=[{'all':!![]}];}_0x25ddfd=_[_0xb3c8('0x33')]({},_0x25ddfd,_0x1a4991[_0xb3c8('0x3b')]);return db[_0xb3c8('0x25')][_0xb3c8('0x3c')](_0x25ddfd)[_0xb3c8('0x1e')](handleEntityNotFound(_0x2131a4,null))[_0xb3c8('0x1e')](respondWithResult(_0x2131a4,null))[_0xb3c8('0x37')](handleError(_0x2131a4,null));};exports[_0xb3c8('0x3d')]=function(_0x145dd6,_0x20217d){return db[_0xb3c8('0x25')][_0xb3c8('0x3d')](_0x145dd6[_0xb3c8('0x3e')],{})[_0xb3c8('0x1e')](respondWithResult(_0x20217d,0xc9))[_0xb3c8('0x37')](handleError(_0x20217d,null));};exports[_0xb3c8('0x1d')]=function(_0x335724,_0xaa2ba3){if(_0x335724[_0xb3c8('0x3e')]['id']){delete _0x335724[_0xb3c8('0x3e')]['id'];}return db[_0xb3c8('0x25')][_0xb3c8('0x3c')]({'where':{'id':_0x335724[_0xb3c8('0x38')]['id']}})[_0xb3c8('0x1e')](handleEntityNotFound(_0xaa2ba3,null))[_0xb3c8('0x1e')](saveUpdates(_0x335724['body'],null))['then'](respondWithResult(_0xaa2ba3,null))['catch'](handleError(_0xaa2ba3,null));};exports['destroy']=function(_0x1c9f0f,_0x36eca9){return db[_0xb3c8('0x25')][_0xb3c8('0x3c')]({'where':{'id':_0x1c9f0f[_0xb3c8('0x38')]['id']}})[_0xb3c8('0x1e')](handleEntityNotFound(_0x36eca9,null))[_0xb3c8('0x1e')](removeEntity(_0x36eca9,null))[_0xb3c8('0x37')](handleError(_0x36eca9,null));};exports[_0xb3c8('0x3f')]=function(_0x1f29f9,_0x2d51e4){return db[_0xb3c8('0x25')][_0xb3c8('0x3f')]()['then'](respondWithResult(_0x2d51e4,null))['catch'](handleError(_0x2d51e4,null));}; \ No newline at end of file +var _0xc4ff=['include','rows','show','params','SquareDetailsReport','includeAll','find','catch','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','limit','set','Content-Range','apply','reject','then','end','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options'];(function(_0x388914,_0x3c63f9){var _0x1f9111=function(_0x23dd69){while(--_0x23dd69){_0x388914['push'](_0x388914['shift']());}};_0x1f9111(++_0x3c63f9);}(_0xc4ff,0x1cd));var _0xfc4f=function(_0x5219ed,_0x54087e){_0x5219ed=_0x5219ed-0x0;var _0x510b27=_0xc4ff[_0x5219ed];return _0x510b27;};'use strict';var emlformat=require(_0xfc4f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfc4f('0x1'));var jsonpatch=require(_0xfc4f('0x2'));var rp=require(_0xfc4f('0x3'));var moment=require(_0xfc4f('0x4'));var BPromise=require(_0xfc4f('0x5'));var Mustache=require(_0xfc4f('0x6'));var util=require(_0xfc4f('0x7'));var path=require(_0xfc4f('0x8'));var sox=require(_0xfc4f('0x9'));var csv=require('to-csv');var ejs=require(_0xfc4f('0xa'));var fs=require('fs');var fs_extra=require(_0xfc4f('0xb'));var _=require(_0xfc4f('0xc'));var squel=require('squel');var crypto=require(_0xfc4f('0xd'));var jsforce=require(_0xfc4f('0xe'));var deskjs=require(_0xfc4f('0xf'));var toCsv=require(_0xfc4f('0x10'));var querystring=require(_0xfc4f('0x11'));var Papa=require(_0xfc4f('0x12'));var Redis=require('ioredis');var authService=require(_0xfc4f('0x13'));var qs=require(_0xfc4f('0x14'));var as=require(_0xfc4f('0x15'));var hardwareService=require(_0xfc4f('0x16'));var logger=require(_0xfc4f('0x17'))(_0xfc4f('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfc4f('0x19'));var db=require(_0xfc4f('0x1a'))['db'];function respondWithStatusCode(_0x531440,_0x1b28a3){_0x1b28a3=_0x1b28a3||0xcc;return function(_0x36e7e4){if(_0x36e7e4){return _0x531440[_0xfc4f('0x1b')](_0x1b28a3);}return _0x531440[_0xfc4f('0x1c')](_0x1b28a3)['end']();};}function respondWithResult(_0x5e99df,_0x5616e2){_0x5616e2=_0x5616e2||0xc8;return function(_0x422104){if(_0x422104){return _0x5e99df['status'](_0x5616e2)[_0xfc4f('0x1d')](_0x422104);}};}function respondWithFilteredResult(_0x2aca8f,_0x2bdd0a){return function(_0x4cae33){if(_0x4cae33){var _0x53f164=typeof _0x2bdd0a[_0xfc4f('0x1e')]==='undefined'&&typeof _0x2bdd0a['limit']==='undefined';var _0x37c050=_0x4cae33[_0xfc4f('0x1f')];var _0x1d20d7=_0x53f164?0x0:_0x2bdd0a['offset'];var _0x110989=_0x53f164?_0x4cae33[_0xfc4f('0x1f')]:_0x2bdd0a[_0xfc4f('0x1e')]+_0x2bdd0a[_0xfc4f('0x20')];var _0x325b20;if(_0x110989>=_0x37c050){_0x110989=_0x37c050;_0x325b20=0xc8;}else{_0x325b20=0xce;}_0x2aca8f[_0xfc4f('0x1c')](_0x325b20);return _0x2aca8f[_0xfc4f('0x21')](_0xfc4f('0x22'),_0x1d20d7+'-'+_0x110989+'/'+_0x37c050)[_0xfc4f('0x1d')](_0x4cae33);}return null;};}function patchUpdates(_0x2a85ef){return function(_0x358444){try{jsonpatch[_0xfc4f('0x23')](_0x358444,_0x2a85ef,!![]);}catch(_0x256ae1){return BPromise[_0xfc4f('0x24')](_0x256ae1);}return _0x358444['save']();};}function saveUpdates(_0x1adbff,_0x367691){return function(_0x4c4960){if(_0x4c4960){return _0x4c4960['update'](_0x1adbff)[_0xfc4f('0x25')](function(_0x5e6a71){return _0x5e6a71;});}return null;};}function removeEntity(_0x4db7d7,_0x2b5ed4){return function(_0x5d8766){if(_0x5d8766){return _0x5d8766['destroy']()[_0xfc4f('0x25')](function(){_0x4db7d7['status'](0xcc)[_0xfc4f('0x26')]();});}};}function handleEntityNotFound(_0x5bad9c,_0x3d9503){return function(_0x4d7842){if(!_0x4d7842){_0x5bad9c[_0xfc4f('0x1b')](0x194);}return _0x4d7842;};}function handleError(_0xeae093,_0x410b33){_0x410b33=_0x410b33||0x1f4;return function(_0x199b8d){logger[_0xfc4f('0x27')](_0x199b8d[_0xfc4f('0x28')]);if(_0x199b8d[_0xfc4f('0x29')]){delete _0x199b8d[_0xfc4f('0x29')];}_0xeae093['status'](_0x410b33)[_0xfc4f('0x2a')](_0x199b8d);};}exports['index']=function(_0x22c550,_0x264171){var _0x551365={},_0x3f0d16={},_0x1f78a9={'count':0x0,'rows':[]};var _0x54f0d3=_[_0xfc4f('0x2b')](db['SquareDetailsReport'][_0xfc4f('0x2c')],function(_0x410633){return{'name':_0x410633['fieldName'],'type':_0x410633[_0xfc4f('0x2d')][_0xfc4f('0x2e')]};});_0x3f0d16[_0xfc4f('0x2f')]=_[_0xfc4f('0x2b')](_0x54f0d3,'name');_0x3f0d16[_0xfc4f('0x30')]=_[_0xfc4f('0x31')](_0x22c550[_0xfc4f('0x30')]);_0x3f0d16[_0xfc4f('0x32')]=_[_0xfc4f('0x33')](_0x3f0d16['model'],_0x3f0d16[_0xfc4f('0x30')]);_0x551365[_0xfc4f('0x34')]=_[_0xfc4f('0x33')](_0x3f0d16[_0xfc4f('0x2f')],qs[_0xfc4f('0x35')](_0x22c550[_0xfc4f('0x30')][_0xfc4f('0x35')]));_0x551365[_0xfc4f('0x34')]=_0x551365[_0xfc4f('0x34')][_0xfc4f('0x36')]?_0x551365[_0xfc4f('0x34')]:_0x3f0d16[_0xfc4f('0x2f')];if(!_0x22c550[_0xfc4f('0x30')][_0xfc4f('0x37')](_0xfc4f('0x38'))){_0x551365[_0xfc4f('0x20')]=qs[_0xfc4f('0x20')](_0x22c550['query']['limit']);_0x551365[_0xfc4f('0x1e')]=qs[_0xfc4f('0x1e')](_0x22c550['query'][_0xfc4f('0x1e')]);}_0x551365[_0xfc4f('0x39')]=qs[_0xfc4f('0x3a')](_0x22c550[_0xfc4f('0x30')]['sort']);_0x551365[_0xfc4f('0x3b')]=qs[_0xfc4f('0x32')](_[_0xfc4f('0x3c')](_0x22c550[_0xfc4f('0x30')],_0x3f0d16[_0xfc4f('0x32')]),_0x54f0d3);if(_0x22c550[_0xfc4f('0x30')]['filter']){_0x551365[_0xfc4f('0x3b')]=_[_0xfc4f('0x3d')](_0x551365[_0xfc4f('0x3b')],{'$or':_[_0xfc4f('0x2b')](_0x54f0d3,function(_0x30df10){if(_0x30df10['type']!==_0xfc4f('0x3e')){var _0x35b5f5={};_0x35b5f5[_0x30df10[_0xfc4f('0x29')]]={'$like':'%'+_0x22c550['query']['filter']+'%'};return _0x35b5f5;}})});}_0x551365=_['merge']({},_0x551365,_0x22c550[_0xfc4f('0x3f')]);var _0x1a7a03={'where':_0x551365['where']};return db['SquareDetailsReport']['count'](_0x1a7a03)[_0xfc4f('0x25')](function(_0x2b584c){_0x1f78a9[_0xfc4f('0x1f')]=_0x2b584c;if(_0x22c550[_0xfc4f('0x30')]['includeAll']){_0x551365[_0xfc4f('0x40')]=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x551365);})['then'](function(_0x4bf2dc){_0x1f78a9[_0xfc4f('0x41')]=_0x4bf2dc;return _0x1f78a9;})['then'](respondWithFilteredResult(_0x264171,_0x551365))['catch'](handleError(_0x264171,null));};exports[_0xfc4f('0x42')]=function(_0x1e411c,_0x42e94a){var _0x1b0052={'raw':!![],'where':{'id':_0x1e411c[_0xfc4f('0x43')]['id']}},_0x53a8ed={};_0x53a8ed[_0xfc4f('0x2f')]=_[_0xfc4f('0x31')](db[_0xfc4f('0x44')][_0xfc4f('0x2c')]);_0x53a8ed[_0xfc4f('0x30')]=_[_0xfc4f('0x31')](_0x1e411c[_0xfc4f('0x30')]);_0x53a8ed['filters']=_['intersection'](_0x53a8ed[_0xfc4f('0x2f')],_0x53a8ed['query']);_0x1b0052[_0xfc4f('0x34')]=_['intersection'](_0x53a8ed[_0xfc4f('0x2f')],qs[_0xfc4f('0x35')](_0x1e411c[_0xfc4f('0x30')][_0xfc4f('0x35')]));_0x1b0052[_0xfc4f('0x34')]=_0x1b0052[_0xfc4f('0x34')][_0xfc4f('0x36')]?_0x1b0052[_0xfc4f('0x34')]:_0x53a8ed['model'];if(_0x1e411c[_0xfc4f('0x30')][_0xfc4f('0x45')]){_0x1b0052[_0xfc4f('0x40')]=[{'all':!![]}];}_0x1b0052=_[_0xfc4f('0x3d')]({},_0x1b0052,_0x1e411c[_0xfc4f('0x3f')]);return db['SquareDetailsReport'][_0xfc4f('0x46')](_0x1b0052)[_0xfc4f('0x25')](handleEntityNotFound(_0x42e94a,null))[_0xfc4f('0x25')](respondWithResult(_0x42e94a,null))[_0xfc4f('0x47')](handleError(_0x42e94a,null));};exports['create']=function(_0xc3a158,_0x59f80a){return db['SquareDetailsReport']['create'](_0xc3a158[_0xfc4f('0x48')],{})[_0xfc4f('0x25')](respondWithResult(_0x59f80a,0xc9))[_0xfc4f('0x47')](handleError(_0x59f80a,null));};exports[_0xfc4f('0x49')]=function(_0x356b2f,_0x534ed3){if(_0x356b2f[_0xfc4f('0x48')]['id']){delete _0x356b2f[_0xfc4f('0x48')]['id'];}return db[_0xfc4f('0x44')][_0xfc4f('0x46')]({'where':{'id':_0x356b2f[_0xfc4f('0x43')]['id']}})[_0xfc4f('0x25')](handleEntityNotFound(_0x534ed3,null))[_0xfc4f('0x25')](saveUpdates(_0x356b2f[_0xfc4f('0x48')],null))[_0xfc4f('0x25')](respondWithResult(_0x534ed3,null))[_0xfc4f('0x47')](handleError(_0x534ed3,null));};exports['destroy']=function(_0x563728,_0x2e7f7e){return db[_0xfc4f('0x44')][_0xfc4f('0x46')]({'where':{'id':_0x563728[_0xfc4f('0x43')]['id']}})[_0xfc4f('0x25')](handleEntityNotFound(_0x2e7f7e,null))[_0xfc4f('0x25')](removeEntity(_0x2e7f7e,null))['catch'](handleError(_0x2e7f7e,null));};exports[_0xfc4f('0x4a')]=function(_0x41caa4,_0x4dee8b){return db[_0xfc4f('0x44')][_0xfc4f('0x4a')]()['then'](respondWithResult(_0x4dee8b,null))[_0xfc4f('0x47')](handleError(_0x4dee8b,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 25b134d..2831529 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 _0x476c=['request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport'];(function(_0x56418e,_0x362812){var _0x5b160c=function(_0x5b44cb){while(--_0x5b44cb){_0x56418e['push'](_0x56418e['shift']());}};_0x5b160c(++_0x362812);}(_0x476c,0x111));var _0xc476=function(_0x3c8480,_0x32b679){_0x3c8480=_0x3c8480-0x0;var _0x4f4a52=_0x476c[_0x3c8480];return _0x4f4a52;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc476('0x0'));var fs=require('fs');var path=require(_0xc476('0x1'));var rimraf=require(_0xc476('0x2'));var config=require(_0xc476('0x3'));var attributes=require(_0xc476('0x4'));module['exports']=function(_0x57ac0b,_0x2953e8){return _0x57ac0b[_0xc476('0x5')](_0xc476('0x6'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6427=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details'];(function(_0x24809f,_0x21163a){var _0x4e98f1=function(_0x62e0c8){while(--_0x62e0c8){_0x24809f['push'](_0x24809f['shift']());}};_0x4e98f1(++_0x21163a);}(_0x6427,0xdc));var _0x7642=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x6427[_0x5bd426];return _0x23a7eb;};'use strict';var _=require('lodash');var util=require(_0x7642('0x0'));var logger=require(_0x7642('0x1'))('api');var moment=require(_0x7642('0x2'));var BPromise=require('bluebird');var rp=require(_0x7642('0x3'));var fs=require('fs');var path=require(_0x7642('0x4'));var rimraf=require(_0x7642('0x5'));var config=require(_0x7642('0x6'));var attributes=require(_0x7642('0x7'));module[_0x7642('0x8')]=function(_0x371240,_0x21f7a1){return _0x371240['define'](_0x7642('0x9'),attributes,{'tableName':_0x7642('0xa'),'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 0c39888..57b780e 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 _0x4e81=['stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s'];(function(_0x1bc7ac,_0x1eed0e){var _0x5a35d7=function(_0x1496c6){while(--_0x1496c6){_0x1bc7ac['push'](_0x1bc7ac['shift']());}};_0x5a35d7(++_0x1eed0e);}(_0x4e81,0x1bc));var _0x14e8=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0x4e81[_0x64aff8];return _0x5488a3;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var moment=require(_0x14e8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x14e8('0x3'))['db'];var utils=require(_0x14e8('0x4'));var logger=require(_0x14e8('0x5'))(_0x14e8('0x6'));var config=require(_0x14e8('0x7'));var jayson=require(_0x14e8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e73d2,_0x449fa3,_0x21f860){return new BPromise(function(_0x3c1b93,_0x11ec3b){return client[_0x14e8('0x9')](_0x3e73d2,_0x21f860)[_0x14e8('0xa')](function(_0x1d8402){logger[_0x14e8('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x449fa3,_0x14e8('0xc'));logger[_0x14e8('0xd')](_0x14e8('0xe'),_0x449fa3,_0x14e8('0xc'),JSON[_0x14e8('0xf')](_0x1d8402));if(_0x1d8402[_0x14e8('0x10')]){if(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x11')]===0x1f4){logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x11ec3b(_0x1d8402[_0x14e8('0x10')][_0x14e8('0x13')]);}logger['error'](_0x14e8('0x12'),_0x449fa3,_0x1d8402['error'][_0x14e8('0x13')]);return _0x3c1b93(_0x1d8402['error'][_0x14e8('0x13')]);}else{logger[_0x14e8('0xb')](_0x14e8('0x12'),_0x449fa3,_0x14e8('0xc'));_0x3c1b93(_0x1d8402['result'][_0x14e8('0x13')]);}})[_0x14e8('0x14')](function(_0x30581){logger[_0x14e8('0x10')](_0x14e8('0x12'),_0x449fa3,_0x30581);_0x11ec3b(_0x30581);});});}exports[_0x14e8('0x15')]=function(_0x10dc8b){var _0x462259=this;return new Promise(function(_0x5a38c1,_0x328c5a){return db[_0x14e8('0x16')][_0x14e8('0x17')](_0x10dc8b[_0x14e8('0x18')],{'raw':_0x10dc8b[_0x14e8('0x19')]?_0x10dc8b['options'][_0x14e8('0x1a')]===undefined?!![]:![]:!![]})[_0x14e8('0xa')](function(_0x2abfec){logger['info'](_0x14e8('0x15'),_0x10dc8b);logger['debug'](_0x14e8('0x15'),_0x10dc8b,JSON[_0x14e8('0xf')](_0x2abfec));_0x5a38c1(_0x2abfec);})[_0x14e8('0x14')](function(_0x117b00){logger[_0x14e8('0x10')]('CreateSquareDetailsReport',_0x117b00[_0x14e8('0x13')],_0x10dc8b);_0x328c5a(_0x462259['error'](0x1f4,_0x117b00[_0x14e8('0x13')]));});});}; \ No newline at end of file +var _0xdc9b=['code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc9b,0x70));var _0xbdc9=function(_0x34a89b,_0x5e7e72){_0x34a89b=_0x34a89b-0x0;var _0x362a60=_0xdc9b[_0x34a89b];return _0x362a60;};'use strict';var _=require(_0xbdc9('0x0'));var util=require(_0xbdc9('0x1'));var moment=require(_0xbdc9('0x2'));var BPromise=require('bluebird');var rs=require(_0xbdc9('0x3'));var fs=require('fs');var Redis=require(_0xbdc9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbdc9('0x5'))(_0xbdc9('0x6'));var config=require('../../config/environment');var jayson=require(_0xbdc9('0x7'));var client=jayson[_0xbdc9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x472956,_0x597a18,_0x3a3dc9){return new BPromise(function(_0x15236a,_0x3b3cbd){return client[_0xbdc9('0x9')](_0x472956,_0x3a3dc9)[_0xbdc9('0xa')](function(_0x33f353){logger[_0xbdc9('0xb')](_0xbdc9('0xc'),_0x597a18,_0xbdc9('0xd'));logger[_0xbdc9('0xe')](_0xbdc9('0xf'),_0x597a18,_0xbdc9('0xd'),JSON[_0xbdc9('0x10')](_0x33f353));if(_0x33f353[_0xbdc9('0x11')]){if(_0x33f353[_0xbdc9('0x11')][_0xbdc9('0x12')]===0x1f4){logger[_0xbdc9('0x11')](_0xbdc9('0xc'),_0x597a18,_0x33f353[_0xbdc9('0x11')][_0xbdc9('0x13')]);return _0x3b3cbd(_0x33f353[_0xbdc9('0x11')]['message']);}logger[_0xbdc9('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x597a18,_0x33f353['error'][_0xbdc9('0x13')]);return _0x15236a(_0x33f353[_0xbdc9('0x11')]['message']);}else{logger[_0xbdc9('0xb')](_0xbdc9('0xc'),_0x597a18,_0xbdc9('0xd'));_0x15236a(_0x33f353[_0xbdc9('0x14')][_0xbdc9('0x13')]);}})[_0xbdc9('0x15')](function(_0x4f6125){logger['error'](_0xbdc9('0xc'),_0x597a18,_0x4f6125);_0x3b3cbd(_0x4f6125);});});}exports[_0xbdc9('0x16')]=function(_0x32b094){var _0x54add5=this;return new Promise(function(_0x4f60f4,_0x333488){return db[_0xbdc9('0x17')]['create'](_0x32b094[_0xbdc9('0x18')],{'raw':_0x32b094[_0xbdc9('0x19')]?_0x32b094[_0xbdc9('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xbdc9('0xa')](function(_0x37e81f){logger[_0xbdc9('0xb')](_0xbdc9('0x16'),_0x32b094);logger[_0xbdc9('0xe')](_0xbdc9('0x16'),_0x32b094,JSON['stringify'](_0x37e81f));_0x4f60f4(_0x37e81f);})['catch'](function(_0x2d9831){logger[_0xbdc9('0x11')](_0xbdc9('0x16'),_0x2d9831['message'],_0x32b094);_0x333488(_0x54add5[_0xbdc9('0x11')](0x1f4,_0x2d9831[_0xbdc9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 6261aa9..7685e71 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 _0xd112=['./system.controller','isAuthenticated','index','get','killProcess','Router','../../components/auth/service'];(function(_0x14477e,_0x44d4da){var _0x5d4a05=function(_0x5e0fa3){while(--_0x5e0fa3){_0x14477e['push'](_0x14477e['shift']());}};_0x5d4a05(++_0x44d4da);}(_0xd112,0x98));var _0x2d11=function(_0x241eb9,_0x5ccc3f){_0x241eb9=_0x241eb9-0x0;var _0x4f916b=_0xd112[_0x241eb9];return _0x4f916b;};'use strict';var express=require('express');var router=express[_0x2d11('0x0')]();var auth=require(_0x2d11('0x1'));var controller=require(_0x2d11('0x2'));router['get']('/',auth[_0x2d11('0x3')](),controller[_0x2d11('0x4')]);router[_0x2d11('0x5')]('/process/:pid/kill',auth[_0x2d11('0x3')](),controller[_0x2d11('0x6')]);module['exports']=router; \ No newline at end of file +var _0xcd4e=['index','get','isAuthenticated','killProcess','../../components/auth/service','./system.controller'];(function(_0x7474e4,_0x18096f){var _0x322f8d=function(_0x33b7e5){while(--_0x33b7e5){_0x7474e4['push'](_0x7474e4['shift']());}};_0x322f8d(++_0x18096f);}(_0xcd4e,0x1d2));var _0xecd4=function(_0x1fd3f4,_0x302234){_0x1fd3f4=_0x1fd3f4-0x0;var _0x494a9e=_0xcd4e[_0x1fd3f4];return _0x494a9e;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xecd4('0x0'));var controller=require(_0xecd4('0x1'));router['get']('/',auth['isAuthenticated'](),controller[_0xecd4('0x2')]);router[_0xecd4('0x3')]('/process/:pid/kill',auth[_0xecd4('0x4')](),controller[_0xecd4('0x5')]);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 b2d8e1e..d4497c3 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 _0xf59e=['kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','child_process','exec','../../config/logger','api','lodash','inspect','index','getAllData','then','status','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0xf59e,0xf3));var _0xef59=function(_0x47078c,_0xe8242f){_0x47078c=_0x47078c-0x0;var _0x359335=_0xf59e[_0x47078c];return _0x359335;};'use strict';var info=require(_0xef59('0x0'));var exec=require(_0xef59('0x1'))[_0xef59('0x2')];var logger=require(_0xef59('0x3'))(_0xef59('0x4'));var util=require('util');var BPromise=require('bluebird');var _=require(_0xef59('0x5'));function handleError(_0x2a6252,_0x3307b0,_0x275664){_0x3307b0=_0x3307b0||0x1f4;return function(_0x3ea39d){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x275664,_0x3307b0,util[_0xef59('0x6')](_0x3ea39d,{'showHidden':![],'depth':null}));delete _0x3ea39d['name'];_0x2a6252['status'](_0x3307b0)['send'](_0x3ea39d);};}exports[_0xef59('0x7')]=function(_0x4729b5,_0x2f1765){return info[_0xef59('0x8')]()[_0xef59('0x9')](function(_0x3722bf){return _0x2f1765[_0xef59('0xa')](0xc8)[_0xef59('0xb')](_0x3722bf);})['catch'](function(_0x97b6){return _0x2f1765[_0xef59('0xa')](0x1f4)[_0xef59('0xb')](_0x97b6);});};exports[_0xef59('0xc')]=function(_0x84594f,_0x496e6d){var _0x3337f3=[_0xef59('0xd')];return new BPromise(function(_0xffe173,_0x1824a7){return exec(util[_0xef59('0xe')](_0xef59('0xf'),_0x84594f[_0xef59('0x10')][_0xef59('0x11')]),function(_0x1422a2,_0x128d06,_0x18d1f){if(_0x1422a2){return _0x1824a7(_0x1422a2);}return _0xffe173(_0x128d06);});})[_0xef59('0x9')](function(_0x5af2dc){var _0x32adea=![];var _0x5438e5=_0x5af2dc[_0xef59('0x12')](/\n/);for(var _0x2b5ce3=0x0,_0x59d537=_0x3337f3['length'];_0x2b5ce3<_0x59d537,_0x32adea===![];_0x2b5ce3+=0x1){if(_0x5af2dc[_0xef59('0x13')](_0x3337f3[_0x2b5ce3])>=0x0){_0x32adea=!![];}}if(!_0x32adea){throw new Error(util[_0xef59('0xe')](_0xef59('0x14'),_0x84594f[_0xef59('0x10')][_0xef59('0x11')]));}process[_0xef59('0x15')](_0x84594f['params'][_0xef59('0x11')],'SIGINT');return _0x496e6d['status'](0xc8)['json']({'message':util[_0xef59('0xe')](_0xef59('0x16'),_0x84594f['params']['pid'])});})[_0xef59('0x17')](handleError(_0x496e6d,null,'killProcess'));}; \ No newline at end of file +var _0xa4e3=['util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','json','catch','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','exec','api'];(function(_0x56d024,_0xb5106e){var _0x1e0d54=function(_0x4f8515){while(--_0x4f8515){_0x56d024['push'](_0x56d024['shift']());}};_0x1e0d54(++_0xb5106e);}(_0xa4e3,0x129));var _0x3a4e=function(_0x3bb682,_0x2fa20e){_0x3bb682=_0x3bb682-0x0;var _0x466baa=_0xa4e3[_0x3bb682];return _0x466baa;};'use strict';var info=require(_0x3a4e('0x0'));var exec=require('child_process')[_0x3a4e('0x1')];var logger=require('../../config/logger')(_0x3a4e('0x2'));var util=require(_0x3a4e('0x3'));var BPromise=require(_0x3a4e('0x4'));var _=require(_0x3a4e('0x5'));function handleError(_0x223215,_0x41591b,_0x15db7d){_0x41591b=_0x41591b||0x1f4;return function(_0x29b8cb){logger[_0x3a4e('0x6')](_0x3a4e('0x7'),_0x15db7d,_0x41591b,util[_0x3a4e('0x8')](_0x29b8cb,{'showHidden':![],'depth':null}));delete _0x29b8cb[_0x3a4e('0x9')];_0x223215[_0x3a4e('0xa')](_0x41591b)['send'](_0x29b8cb);};}exports[_0x3a4e('0xb')]=function(_0x54b924,_0x4c5b69){return info['getAllData']()['then'](function(_0x1ab00c){return _0x4c5b69[_0x3a4e('0xa')](0xc8)[_0x3a4e('0xc')](_0x1ab00c);})[_0x3a4e('0xd')](function(_0x2708bf){return _0x4c5b69[_0x3a4e('0xa')](0x1f4)[_0x3a4e('0xc')](_0x2708bf);});};exports['killProcess']=function(_0x257fbd,_0x67a797){var _0x609e82=[_0x3a4e('0xe')];return new BPromise(function(_0x51cdbb,_0x3f0589){return exec(util[_0x3a4e('0xf')](_0x3a4e('0x10'),_0x257fbd[_0x3a4e('0x11')]['pid']),function(_0x2b4636,_0x37138f,_0x287bfd){if(_0x2b4636){return _0x3f0589(_0x2b4636);}return _0x51cdbb(_0x37138f);});})['then'](function(_0x27f333){var _0x1e55eb=![];var _0x3dbda9=_0x27f333[_0x3a4e('0x12')](/\n/);for(var _0x13802a=0x0,_0x1deda0=_0x609e82[_0x3a4e('0x13')];_0x13802a<_0x1deda0,_0x1e55eb===![];_0x13802a+=0x1){if(_0x27f333[_0x3a4e('0x14')](_0x609e82[_0x13802a])>=0x0){_0x1e55eb=!![];}}if(!_0x1e55eb){throw new Error(util[_0x3a4e('0xf')](_0x3a4e('0x15'),_0x257fbd[_0x3a4e('0x11')][_0x3a4e('0x16')]));}process['kill'](_0x257fbd[_0x3a4e('0x11')]['pid'],'SIGINT');return _0x67a797['status'](0xc8)[_0x3a4e('0xc')]({'message':util[_0x3a4e('0xf')](_0x3a4e('0x17'),_0x257fbd[_0x3a4e('0x11')][_0x3a4e('0x16')])});})[_0x3a4e('0xd')](handleError(_0x67a797,null,_0x3a4e('0x18')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 30bde9a..4e15aaf 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 _0x72a0=['post','create','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./tag.controller','isAuthenticated','get','/:id'];(function(_0x24537c,_0x3c4582){var _0x4e134a=function(_0xe945a1){while(--_0xe945a1){_0x24537c['push'](_0x24537c['shift']());}};_0x4e134a(++_0x3c4582);}(_0x72a0,0x194));var _0x072a=function(_0x537b91,_0x4e078a){_0x537b91=_0x537b91-0x0;var _0x42ec4f=_0x72a0[_0x537b91];return _0x42ec4f;};'use strict';var multer=require(_0x072a('0x0'));var util=require(_0x072a('0x1'));var path=require(_0x072a('0x2'));var timeout=require(_0x072a('0x3'));var express=require(_0x072a('0x4'));var router=express[_0x072a('0x5')]();var fs_extra=require(_0x072a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x072a('0x7'));var config=require('../../config/environment');var controller=require(_0x072a('0x8'));router['get']('/',auth[_0x072a('0x9')](),controller['index']);router[_0x072a('0xa')](_0x072a('0xb'),auth[_0x072a('0x9')](),controller['show']);router[_0x072a('0xc')]('/',auth[_0x072a('0x9')](),controller[_0x072a('0xd')]);router['put'](_0x072a('0xb'),auth['isAuthenticated'](),controller[_0x072a('0xe')]);router[_0x072a('0xf')](_0x072a('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd0ce=['./tag.controller','get','index','isAuthenticated','show','post','create','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x11228c,_0x59ecb6){var _0x4dbd3d=function(_0x28e17a){while(--_0x28e17a){_0x11228c['push'](_0x11228c['shift']());}};_0x4dbd3d(++_0x59ecb6);}(_0xd0ce,0x174));var _0xed0c=function(_0x321df4,_0x3efec5){_0x321df4=_0x321df4-0x0;var _0x50d06c=_0xd0ce[_0x321df4];return _0x50d06c;};'use strict';var multer=require(_0xed0c('0x0'));var util=require(_0xed0c('0x1'));var path=require(_0xed0c('0x2'));var timeout=require(_0xed0c('0x3'));var express=require('express');var router=express[_0xed0c('0x4')]();var fs_extra=require(_0xed0c('0x5'));var auth=require(_0xed0c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xed0c('0x7'));var controller=require(_0xed0c('0x8'));router[_0xed0c('0x9')]('/',auth['isAuthenticated'](),controller[_0xed0c('0xa')]);router['get']('/:id',auth[_0xed0c('0xb')](),controller[_0xed0c('0xc')]);router[_0xed0c('0xd')]('/',auth[_0xed0c('0xb')](),controller[_0xed0c('0xe')]);router['put']('/:id',auth[_0xed0c('0xb')](),controller[_0xed0c('0xf')]);router[_0xed0c('0x10')](_0xed0c('0x11'),auth[_0xed0c('0xb')](),controller[_0xed0c('0x12')]);module[_0xed0c('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 509a898..e13456c 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 _0x4977=['name','sequelize','exports','STRING'];(function(_0x53ae6a,_0x5ac499){var _0x99445=function(_0x5be53c){while(--_0x5be53c){_0x53ae6a['push'](_0x53ae6a['shift']());}};_0x99445(++_0x5ac499);}(_0x4977,0x1cd));var _0x7497=function(_0x9aafca,_0x3af57c){_0x9aafca=_0x9aafca-0x0;var _0x556ea1=_0x4977[_0x9aafca];return _0x556ea1;};'use strict';var Sequelize=require(_0x7497('0x0'));module[_0x7497('0x1')]={'name':{'type':Sequelize[_0x7497('0x2')],'unique':_0x7497('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x7497('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x7497('0x2')]}}; \ No newline at end of file +var _0x902b=['name','#0091EA','sequelize','STRING'];(function(_0x4261ea,_0x400544){var _0x2e115c=function(_0x51e110){while(--_0x51e110){_0x4261ea['push'](_0x4261ea['shift']());}};_0x2e115c(++_0x400544);}(_0x902b,0x6a));var _0xb902=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x902b[_0x1deb03];return _0x189fe7;};'use strict';var Sequelize=require(_0xb902('0x0'));module['exports']={'name':{'type':Sequelize[_0xb902('0x1')],'unique':_0xb902('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xb902('0x1')],'defaultValue':_0xb902('0x3')},'description':{'type':Sequelize[_0xb902('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 5c4e575..3c8fa00 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 _0x0f9f=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','map','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','Tag','include','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','update','params','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x41e5dd,_0x3ed56f){var _0x3ba850=function(_0x15ecb7){while(--_0x15ecb7){_0x41e5dd['push'](_0x41e5dd['shift']());}};_0x3ba850(++_0x3ed56f);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x526c9a,_0x571d87){_0x526c9a=_0x526c9a-0x0;var _0x22f2eb=_0x0f9f[_0x526c9a];return _0x22f2eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf0f9('0x0'));var zipdir=require(_0xf0f9('0x1'));var jsonpatch=require(_0xf0f9('0x2'));var rp=require('request-promise');var moment=require(_0xf0f9('0x3'));var BPromise=require(_0xf0f9('0x4'));var Mustache=require(_0xf0f9('0x5'));var util=require(_0xf0f9('0x6'));var path=require(_0xf0f9('0x7'));var sox=require(_0xf0f9('0x8'));var csv=require(_0xf0f9('0x9'));var ejs=require(_0xf0f9('0xa'));var fs=require('fs');var fs_extra=require(_0xf0f9('0xb'));var _=require(_0xf0f9('0xc'));var squel=require('squel');var crypto=require(_0xf0f9('0xd'));var jsforce=require(_0xf0f9('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf0f9('0x9'));var querystring=require(_0xf0f9('0xf'));var Papa=require(_0xf0f9('0x10'));var Redis=require('ioredis');var authService=require(_0xf0f9('0x11'));var qs=require(_0xf0f9('0x12'));var as=require(_0xf0f9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf0f9('0x14'));var utils=require(_0xf0f9('0x15'));var config=require(_0xf0f9('0x16'));var licenseUtil=require(_0xf0f9('0x17'));var db=require(_0xf0f9('0x18'))['db'];function respondWithStatusCode(_0x32d17f,_0x2360eb){_0x2360eb=_0x2360eb||0xcc;return function(_0x4f27c2){if(_0x4f27c2){return _0x32d17f[_0xf0f9('0x19')](_0x2360eb);}return _0x32d17f[_0xf0f9('0x1a')](_0x2360eb)[_0xf0f9('0x1b')]();};}function respondWithResult(_0x200514,_0x524169){_0x524169=_0x524169||0xc8;return function(_0x51d78a){if(_0x51d78a){return _0x200514[_0xf0f9('0x1a')](_0x524169)[_0xf0f9('0x1c')](_0x51d78a);}};}function respondWithFilteredResult(_0xa7d48c,_0x2e2955){return function(_0x2b05e3){if(_0x2b05e3){var _0x2f5bec=typeof _0x2e2955[_0xf0f9('0x1d')]===_0xf0f9('0x1e')&&typeof _0x2e2955[_0xf0f9('0x1f')]===_0xf0f9('0x1e');var _0x4d3534=_0x2b05e3['count'];var _0x350a48=_0x2f5bec?0x0:_0x2e2955[_0xf0f9('0x1d')];var _0x4c4e17=_0x2f5bec?_0x2b05e3[_0xf0f9('0x20')]:_0x2e2955['offset']+_0x2e2955['limit'];var _0x42c157;if(_0x4c4e17>=_0x4d3534){_0x4c4e17=_0x4d3534;_0x42c157=0xc8;}else{_0x42c157=0xce;}_0xa7d48c[_0xf0f9('0x1a')](_0x42c157);return _0xa7d48c[_0xf0f9('0x21')](_0xf0f9('0x22'),_0x350a48+'-'+_0x4c4e17+'/'+_0x4d3534)[_0xf0f9('0x1c')](_0x2b05e3);}return null;};}function patchUpdates(_0x4ed9ff){return function(_0x5ccbc9){try{jsonpatch['apply'](_0x5ccbc9,_0x4ed9ff,!![]);}catch(_0x102336){return BPromise[_0xf0f9('0x23')](_0x102336);}return _0x5ccbc9[_0xf0f9('0x24')]();};}function saveUpdates(_0x5d87a9,_0x4a8726){return function(_0x209cd4){if(_0x209cd4){return _0x209cd4['update'](_0x5d87a9)[_0xf0f9('0x25')](function(_0x414f87){return _0x414f87;});}return null;};}function removeEntity(_0x173c79,_0x570c68){return function(_0x33dfca){if(_0x33dfca){return _0x33dfca[_0xf0f9('0x26')]()[_0xf0f9('0x25')](function(){var _0x49a2dd=_0x33dfca[_0xf0f9('0x27')]({'plain':!![]});var _0x33f070=_0xf0f9('0x28');return db[_0xf0f9('0x29')][_0xf0f9('0x26')]({'where':{'type':_0x33f070,'resourceId':_0x49a2dd['id']}})[_0xf0f9('0x25')](function(){return _0x33dfca;});})['then'](function(){_0x173c79[_0xf0f9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1288e0,_0x30e85c){return function(_0x519a46){if(!_0x519a46){_0x1288e0['sendStatus'](0x194);}return _0x519a46;};}function handleError(_0x119793,_0x50e7f6){_0x50e7f6=_0x50e7f6||0x1f4;return function(_0x2121b8){logger[_0xf0f9('0x2a')](_0x2121b8[_0xf0f9('0x2b')]);if(_0x2121b8[_0xf0f9('0x2c')]){delete _0x2121b8[_0xf0f9('0x2c')];}_0x119793[_0xf0f9('0x1a')](_0x50e7f6)[_0xf0f9('0x2d')](_0x2121b8);};}exports[_0xf0f9('0x2e')]=function(_0x37c093,_0x4e4e08){var _0x2e79f9={},_0x28da31={},_0x534083={'count':0x0,'rows':[]};var _0x48ef2a=_[_0xf0f9('0x2f')](db['Tag']['rawAttributes'],function(_0x14f3cb){return{'name':_0x14f3cb['fieldName'],'type':_0x14f3cb[_0xf0f9('0x30')][_0xf0f9('0x31')]};});_0x28da31['model']=_['map'](_0x48ef2a,_0xf0f9('0x2c'));_0x28da31[_0xf0f9('0x32')]=_[_0xf0f9('0x33')](_0x37c093[_0xf0f9('0x32')]);_0x28da31[_0xf0f9('0x34')]=_[_0xf0f9('0x35')](_0x28da31[_0xf0f9('0x36')],_0x28da31[_0xf0f9('0x32')]);_0x2e79f9[_0xf0f9('0x37')]=_[_0xf0f9('0x35')](_0x28da31[_0xf0f9('0x36')],qs[_0xf0f9('0x38')](_0x37c093[_0xf0f9('0x32')]['fields']));_0x2e79f9[_0xf0f9('0x37')]=_0x2e79f9['attributes'][_0xf0f9('0x39')]?_0x2e79f9[_0xf0f9('0x37')]:_0x28da31[_0xf0f9('0x36')];if(!_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x3a')](_0xf0f9('0x3b'))){_0x2e79f9[_0xf0f9('0x1f')]=qs['limit'](_0x37c093['query'][_0xf0f9('0x1f')]);_0x2e79f9[_0xf0f9('0x1d')]=qs[_0xf0f9('0x1d')](_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x1d')]);}_0x2e79f9['order']=qs[_0xf0f9('0x3c')](_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x3c')]);_0x2e79f9[_0xf0f9('0x3d')]=qs[_0xf0f9('0x34')](_['pick'](_0x37c093[_0xf0f9('0x32')],_0x28da31[_0xf0f9('0x34')]),_0x48ef2a);if(_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x3e')]){_0x2e79f9[_0xf0f9('0x3d')]=_[_0xf0f9('0x3f')](_0x2e79f9['where'],{'$or':_[_0xf0f9('0x2f')](_0x48ef2a,function(_0x1b84ef){if(_0x1b84ef[_0xf0f9('0x30')]!=='VIRTUAL'){var _0x3b52e3={};_0x3b52e3[_0x1b84ef[_0xf0f9('0x2c')]]={'$like':'%'+_0x37c093[_0xf0f9('0x32')][_0xf0f9('0x3e')]+'%'};return _0x3b52e3;}})});}_0x2e79f9=_[_0xf0f9('0x3f')]({},_0x2e79f9,_0x37c093[_0xf0f9('0x40')]);var _0x1e1805={'where':_0x2e79f9[_0xf0f9('0x3d')]};return db[_0xf0f9('0x41')][_0xf0f9('0x20')](_0x1e1805)[_0xf0f9('0x25')](function(_0x149870){_0x534083[_0xf0f9('0x20')]=_0x149870;if(_0x37c093['query']['includeAll']){_0x2e79f9[_0xf0f9('0x42')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x2e79f9);})['then'](function(_0x2cb95d){_0x534083[_0xf0f9('0x43')]=_0x2cb95d;return _0x534083;})[_0xf0f9('0x25')](respondWithFilteredResult(_0x4e4e08,_0x2e79f9))[_0xf0f9('0x44')](handleError(_0x4e4e08,null));};exports[_0xf0f9('0x45')]=function(_0xfef8ad,_0xc0c34c){var _0x2e1556={'raw':!![],'where':{'id':_0xfef8ad['params']['id']}},_0x1a3a6b={};_0x1a3a6b[_0xf0f9('0x36')]=_[_0xf0f9('0x33')](db[_0xf0f9('0x41')]['rawAttributes']);_0x1a3a6b[_0xf0f9('0x32')]=_[_0xf0f9('0x33')](_0xfef8ad[_0xf0f9('0x32')]);_0x1a3a6b['filters']=_[_0xf0f9('0x35')](_0x1a3a6b[_0xf0f9('0x36')],_0x1a3a6b['query']);_0x2e1556[_0xf0f9('0x37')]=_[_0xf0f9('0x35')](_0x1a3a6b[_0xf0f9('0x36')],qs[_0xf0f9('0x38')](_0xfef8ad['query'][_0xf0f9('0x38')]));_0x2e1556[_0xf0f9('0x37')]=_0x2e1556[_0xf0f9('0x37')][_0xf0f9('0x39')]?_0x2e1556[_0xf0f9('0x37')]:_0x1a3a6b[_0xf0f9('0x36')];if(_0xfef8ad['query'][_0xf0f9('0x46')]){_0x2e1556['include']=[{'all':!![]}];}_0x2e1556=_[_0xf0f9('0x3f')]({},_0x2e1556,_0xfef8ad[_0xf0f9('0x40')]);return db[_0xf0f9('0x41')][_0xf0f9('0x47')](_0x2e1556)[_0xf0f9('0x25')](handleEntityNotFound(_0xc0c34c,null))[_0xf0f9('0x25')](respondWithResult(_0xc0c34c,null))[_0xf0f9('0x44')](handleError(_0xc0c34c,null));};exports[_0xf0f9('0x48')]=function(_0x1f47fa,_0x13bb13){return db[_0xf0f9('0x41')][_0xf0f9('0x48')](_0x1f47fa[_0xf0f9('0x49')],{})[_0xf0f9('0x25')](function(_0x45a165){var _0x3cb91a=_0x1f47fa[_0xf0f9('0x4a')][_0xf0f9('0x27')]({'plain':!![]});if(!_0x3cb91a)throw new Error(_0xf0f9('0x4b'));if(_0x3cb91a[_0xf0f9('0x4c')]===_0xf0f9('0x4a')){var _0x40711c=_0x45a165[_0xf0f9('0x27')]({'plain':!![]});var _0x37a928='Tags';return db['UserProfileSection'][_0xf0f9('0x47')]({'where':{'name':_0x37a928,'userProfileId':_0x3cb91a['userProfileId']},'raw':!![]})[_0xf0f9('0x25')](function(_0x2c364c){if(_0x2c364c&&_0x2c364c[_0xf0f9('0x4d')]===0x0){return db['UserProfileResource'][_0xf0f9('0x48')]({'name':_0x40711c['name'],'resourceId':_0x40711c['id'],'type':_0x2c364c[_0xf0f9('0x2c')],'sectionId':_0x2c364c['id']},{})[_0xf0f9('0x25')](function(){return _0x45a165;});}else{return _0x45a165;}})[_0xf0f9('0x44')](function(_0xfe9072){logger[_0xf0f9('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xfe9072);throw _0xfe9072;});}return _0x45a165;})[_0xf0f9('0x25')](respondWithResult(_0x13bb13,0xc9))['catch'](handleError(_0x13bb13,null));};exports[_0xf0f9('0x4e')]=function(_0x1b0186,_0xb3467e){if(_0x1b0186[_0xf0f9('0x49')]['id']){delete _0x1b0186[_0xf0f9('0x49')]['id'];}return db['Tag'][_0xf0f9('0x47')]({'where':{'id':_0x1b0186[_0xf0f9('0x4f')]['id']}})[_0xf0f9('0x25')](handleEntityNotFound(_0xb3467e,null))[_0xf0f9('0x25')](saveUpdates(_0x1b0186[_0xf0f9('0x49')],null))[_0xf0f9('0x25')](respondWithResult(_0xb3467e,null))[_0xf0f9('0x44')](handleError(_0xb3467e,null));};exports[_0xf0f9('0x26')]=function(_0x15f3b3,_0x406b45){return db[_0xf0f9('0x41')][_0xf0f9('0x47')]({'where':{'id':_0x15f3b3[_0xf0f9('0x4f')]['id']}})[_0xf0f9('0x25')](handleEntityNotFound(_0x406b45,null))['then'](removeEntity(_0x406b45,null))[_0xf0f9('0x44')](handleError(_0x406b45,null));}; \ No newline at end of file +var _0x24cd=['undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','get','Tags','error','stack','name','send','index','Tag','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','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/license/util','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x3e840f,_0x527897){var _0x1691a4=function(_0x2f6cc8){while(--_0x2f6cc8){_0x3e840f['push'](_0x3e840f['shift']());}};_0x1691a4(++_0x527897);}(_0x24cd,0x83));var _0xd24c=function(_0x491f18,_0x5b08aa){_0x491f18=_0x491f18-0x0;var _0x29e6c7=_0x24cd[_0x491f18];return _0x29e6c7;};'use strict';var emlformat=require(_0xd24c('0x0'));var rimraf=require(_0xd24c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd24c('0x2'));var rp=require('request-promise');var moment=require(_0xd24c('0x3'));var BPromise=require(_0xd24c('0x4'));var Mustache=require(_0xd24c('0x5'));var util=require('util');var path=require(_0xd24c('0x6'));var sox=require(_0xd24c('0x7'));var csv=require('to-csv');var ejs=require(_0xd24c('0x8'));var fs=require('fs');var fs_extra=require(_0xd24c('0x9'));var _=require(_0xd24c('0xa'));var squel=require(_0xd24c('0xb'));var crypto=require(_0xd24c('0xc'));var jsforce=require(_0xd24c('0xd'));var deskjs=require(_0xd24c('0xe'));var toCsv=require(_0xd24c('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd24c('0x10'));var authService=require(_0xd24c('0x11'));var qs=require(_0xd24c('0x12'));var as=require(_0xd24c('0x13'));var hardwareService=require(_0xd24c('0x14'));var logger=require(_0xd24c('0x15'))(_0xd24c('0x16'));var utils=require(_0xd24c('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd24c('0x18'));var db=require(_0xd24c('0x19'))['db'];function respondWithStatusCode(_0x55de4d,_0x3296ea){_0x3296ea=_0x3296ea||0xcc;return function(_0x3bed2){if(_0x3bed2){return _0x55de4d[_0xd24c('0x1a')](_0x3296ea);}return _0x55de4d[_0xd24c('0x1b')](_0x3296ea)[_0xd24c('0x1c')]();};}function respondWithResult(_0x6a81d9,_0x2c29c6){_0x2c29c6=_0x2c29c6||0xc8;return function(_0x20b624){if(_0x20b624){return _0x6a81d9['status'](_0x2c29c6)[_0xd24c('0x1d')](_0x20b624);}};}function respondWithFilteredResult(_0xe096c,_0x528489){return function(_0x34aa92){if(_0x34aa92){var _0x3aa193=typeof _0x528489[_0xd24c('0x1e')]===_0xd24c('0x1f')&&typeof _0x528489['limit']==='undefined';var _0xc87bb7=_0x34aa92[_0xd24c('0x20')];var _0x170d59=_0x3aa193?0x0:_0x528489['offset'];var _0x9f2d2d=_0x3aa193?_0x34aa92[_0xd24c('0x20')]:_0x528489[_0xd24c('0x1e')]+_0x528489[_0xd24c('0x21')];var _0x478a0f;if(_0x9f2d2d>=_0xc87bb7){_0x9f2d2d=_0xc87bb7;_0x478a0f=0xc8;}else{_0x478a0f=0xce;}_0xe096c[_0xd24c('0x1b')](_0x478a0f);return _0xe096c['set'](_0xd24c('0x22'),_0x170d59+'-'+_0x9f2d2d+'/'+_0xc87bb7)[_0xd24c('0x1d')](_0x34aa92);}return null;};}function patchUpdates(_0x1b3a2f){return function(_0x38c380){try{jsonpatch[_0xd24c('0x23')](_0x38c380,_0x1b3a2f,!![]);}catch(_0x4964e5){return BPromise[_0xd24c('0x24')](_0x4964e5);}return _0x38c380[_0xd24c('0x25')]();};}function saveUpdates(_0x17375b,_0x206ce7){return function(_0x48fffd){if(_0x48fffd){return _0x48fffd[_0xd24c('0x26')](_0x17375b)[_0xd24c('0x27')](function(_0x2549d0){return _0x2549d0;});}return null;};}function removeEntity(_0x5c862f,_0x44471f){return function(_0x2c3328){if(_0x2c3328){return _0x2c3328[_0xd24c('0x28')]()['then'](function(){var _0x4539e7=_0x2c3328[_0xd24c('0x29')]({'plain':!![]});var _0x848e0e=_0xd24c('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x848e0e,'resourceId':_0x4539e7['id']}})[_0xd24c('0x27')](function(){return _0x2c3328;});})['then'](function(){_0x5c862f[_0xd24c('0x1b')](0xcc)[_0xd24c('0x1c')]();});}};}function handleEntityNotFound(_0x325fcc,_0x4c0d99){return function(_0x4cb1b3){if(!_0x4cb1b3){_0x325fcc[_0xd24c('0x1a')](0x194);}return _0x4cb1b3;};}function handleError(_0x14d44a,_0x1a18b7){_0x1a18b7=_0x1a18b7||0x1f4;return function(_0x160f03){logger[_0xd24c('0x2b')](_0x160f03[_0xd24c('0x2c')]);if(_0x160f03[_0xd24c('0x2d')]){delete _0x160f03[_0xd24c('0x2d')];}_0x14d44a[_0xd24c('0x1b')](_0x1a18b7)[_0xd24c('0x2e')](_0x160f03);};}exports[_0xd24c('0x2f')]=function(_0x59cbb6,_0x4e128b){var _0x305e90={},_0x445bc6={},_0x1dc70b={'count':0x0,'rows':[]};var _0x56260c=_['map'](db[_0xd24c('0x30')][_0xd24c('0x31')],function(_0x34a64c){return{'name':_0x34a64c[_0xd24c('0x32')],'type':_0x34a64c['type'][_0xd24c('0x33')]};});_0x445bc6[_0xd24c('0x34')]=_[_0xd24c('0x35')](_0x56260c,_0xd24c('0x2d'));_0x445bc6[_0xd24c('0x36')]=_[_0xd24c('0x37')](_0x59cbb6[_0xd24c('0x36')]);_0x445bc6[_0xd24c('0x38')]=_[_0xd24c('0x39')](_0x445bc6['model'],_0x445bc6[_0xd24c('0x36')]);_0x305e90['attributes']=_['intersection'](_0x445bc6[_0xd24c('0x34')],qs[_0xd24c('0x3a')](_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x3a')]));_0x305e90[_0xd24c('0x3b')]=_0x305e90[_0xd24c('0x3b')][_0xd24c('0x3c')]?_0x305e90['attributes']:_0x445bc6[_0xd24c('0x34')];if(!_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x3d')](_0xd24c('0x3e'))){_0x305e90[_0xd24c('0x21')]=qs[_0xd24c('0x21')](_0x59cbb6['query'][_0xd24c('0x21')]);_0x305e90[_0xd24c('0x1e')]=qs['offset'](_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x1e')]);}_0x305e90['order']=qs[_0xd24c('0x3f')](_0x59cbb6[_0xd24c('0x36')]['sort']);_0x305e90[_0xd24c('0x40')]=qs[_0xd24c('0x38')](_[_0xd24c('0x41')](_0x59cbb6[_0xd24c('0x36')],_0x445bc6['filters']),_0x56260c);if(_0x59cbb6[_0xd24c('0x36')]['filter']){_0x305e90[_0xd24c('0x40')]=_['merge'](_0x305e90['where'],{'$or':_['map'](_0x56260c,function(_0x4160fb){if(_0x4160fb['type']!=='VIRTUAL'){var _0x66f45={};_0x66f45[_0x4160fb[_0xd24c('0x2d')]]={'$like':'%'+_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x42')]+'%'};return _0x66f45;}})});}_0x305e90=_['merge']({},_0x305e90,_0x59cbb6[_0xd24c('0x43')]);var _0x54a924={'where':_0x305e90[_0xd24c('0x40')]};return db[_0xd24c('0x30')][_0xd24c('0x20')](_0x54a924)[_0xd24c('0x27')](function(_0x27eefa){_0x1dc70b[_0xd24c('0x20')]=_0x27eefa;if(_0x59cbb6[_0xd24c('0x36')][_0xd24c('0x44')]){_0x305e90[_0xd24c('0x45')]=[{'all':!![]}];}return db[_0xd24c('0x30')]['findAll'](_0x305e90);})[_0xd24c('0x27')](function(_0x742082){_0x1dc70b['rows']=_0x742082;return _0x1dc70b;})[_0xd24c('0x27')](respondWithFilteredResult(_0x4e128b,_0x305e90))[_0xd24c('0x46')](handleError(_0x4e128b,null));};exports['show']=function(_0x2f2981,_0x5d91fe){var _0x39cd94={'raw':!![],'where':{'id':_0x2f2981[_0xd24c('0x47')]['id']}},_0x2d46b8={};_0x2d46b8[_0xd24c('0x34')]=_[_0xd24c('0x37')](db['Tag'][_0xd24c('0x31')]);_0x2d46b8['query']=_[_0xd24c('0x37')](_0x2f2981['query']);_0x2d46b8[_0xd24c('0x38')]=_[_0xd24c('0x39')](_0x2d46b8['model'],_0x2d46b8[_0xd24c('0x36')]);_0x39cd94[_0xd24c('0x3b')]=_['intersection'](_0x2d46b8[_0xd24c('0x34')],qs['fields'](_0x2f2981['query']['fields']));_0x39cd94[_0xd24c('0x3b')]=_0x39cd94[_0xd24c('0x3b')]['length']?_0x39cd94['attributes']:_0x2d46b8[_0xd24c('0x34')];if(_0x2f2981[_0xd24c('0x36')][_0xd24c('0x44')]){_0x39cd94[_0xd24c('0x45')]=[{'all':!![]}];}_0x39cd94=_['merge']({},_0x39cd94,_0x2f2981[_0xd24c('0x43')]);return db[_0xd24c('0x30')]['find'](_0x39cd94)[_0xd24c('0x27')](handleEntityNotFound(_0x5d91fe,null))[_0xd24c('0x27')](respondWithResult(_0x5d91fe,null))[_0xd24c('0x46')](handleError(_0x5d91fe,null));};exports['create']=function(_0x3039aa,_0x4b10c6){return db[_0xd24c('0x30')][_0xd24c('0x48')](_0x3039aa[_0xd24c('0x49')],{})[_0xd24c('0x27')](function(_0x47d5ce){var _0x14684c=_0x3039aa[_0xd24c('0x4a')][_0xd24c('0x29')]({'plain':!![]});if(!_0x14684c)throw new Error(_0xd24c('0x4b'));if(_0x14684c[_0xd24c('0x4c')]===_0xd24c('0x4a')){var _0x3ce7d0=_0x47d5ce[_0xd24c('0x29')]({'plain':!![]});var _0x47067c=_0xd24c('0x2a');return db[_0xd24c('0x4d')]['find']({'where':{'name':_0x47067c,'userProfileId':_0x14684c[_0xd24c('0x4e')]},'raw':!![]})[_0xd24c('0x27')](function(_0x48f011){if(_0x48f011&&_0x48f011['autoAssociation']===0x0){return db['UserProfileResource'][_0xd24c('0x48')]({'name':_0x3ce7d0[_0xd24c('0x2d')],'resourceId':_0x3ce7d0['id'],'type':_0x48f011[_0xd24c('0x2d')],'sectionId':_0x48f011['id']},{})[_0xd24c('0x27')](function(){return _0x47d5ce;});}else{return _0x47d5ce;}})[_0xd24c('0x46')](function(_0x2ea05a){logger[_0xd24c('0x2b')](_0xd24c('0x4f'),_0x2ea05a);throw _0x2ea05a;});}return _0x47d5ce;})[_0xd24c('0x27')](respondWithResult(_0x4b10c6,0xc9))[_0xd24c('0x46')](handleError(_0x4b10c6,null));};exports[_0xd24c('0x26')]=function(_0x4fbb0b,_0x3a8e76){if(_0x4fbb0b[_0xd24c('0x49')]['id']){delete _0x4fbb0b['body']['id'];}return db[_0xd24c('0x30')][_0xd24c('0x50')]({'where':{'id':_0x4fbb0b[_0xd24c('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a8e76,null))['then'](saveUpdates(_0x4fbb0b[_0xd24c('0x49')],null))[_0xd24c('0x27')](respondWithResult(_0x3a8e76,null))[_0xd24c('0x46')](handleError(_0x3a8e76,null));};exports[_0xd24c('0x28')]=function(_0x148685,_0x3dee09){return db[_0xd24c('0x30')][_0xd24c('0x50')]({'where':{'id':_0x148685['params']['id']}})[_0xd24c('0x27')](handleEntityNotFound(_0x3dee09,null))['then'](removeEntity(_0x3dee09,null))['catch'](handleError(_0x3dee09,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 48acd95..ad081f8 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 _0xb17f=['tools_tags','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./tag.attributes','exports','define'];(function(_0x551e63,_0x204390){var _0x2f477a=function(_0x476639){while(--_0x476639){_0x551e63['push'](_0x551e63['shift']());}};_0x2f477a(++_0x204390);}(_0xb17f,0x1ae));var _0xfb17=function(_0x1950ca,_0x3a9b6f){_0x1950ca=_0x1950ca-0x0;var _0x31d8a5=_0xb17f[_0x1950ca];return _0x31d8a5;};'use strict';var _=require(_0xfb17('0x0'));var util=require(_0xfb17('0x1'));var logger=require(_0xfb17('0x2'))('api');var moment=require(_0xfb17('0x3'));var BPromise=require('bluebird');var rp=require(_0xfb17('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfb17('0x5'));var config=require(_0xfb17('0x6'));var attributes=require(_0xfb17('0x7'));module[_0xfb17('0x8')]=function(_0x19547d,_0x18fff9){return _0x19547d[_0xfb17('0x9')]('Tag',attributes,{'tableName':_0xfb17('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9db=['tools_tags','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./tag.attributes','exports','define','Tag'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xf9db,0x189));var _0xbf9d=function(_0x50df13,_0x43674a){_0x50df13=_0x50df13-0x0;var _0x49376b=_0xf9db[_0x50df13];return _0x49376b;};'use strict';var _=require(_0xbf9d('0x0'));var util=require(_0xbf9d('0x1'));var logger=require(_0xbf9d('0x2'))(_0xbf9d('0x3'));var moment=require(_0xbf9d('0x4'));var BPromise=require(_0xbf9d('0x5'));var rp=require(_0xbf9d('0x6'));var fs=require('fs');var path=require(_0xbf9d('0x7'));var rimraf=require(_0xbf9d('0x8'));var config=require('../../config/environment');var attributes=require(_0xbf9d('0x9'));module[_0xbf9d('0xa')]=function(_0x3aba8d,_0x39c670){return _0x3aba8d[_0xbf9d('0xb')](_0xbf9d('0xc'),attributes,{'tableName':_0xbf9d('0xd'),'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 c18f609..2b90f0c 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 _0xc6d8=['debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent'];(function(_0x36710f,_0x3cfbb8){var _0x344f0d=function(_0x3a7abc){while(--_0x3a7abc){_0x36710f['push'](_0x36710f['shift']());}};_0x344f0d(++_0x3cfbb8);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x2ff1f6,_0x1bc588){_0x2ff1f6=_0x2ff1f6-0x0;var _0xbae96d=_0xc6d8[_0x2ff1f6];return _0xbae96d;};'use strict';var _=require(_0x8c6d('0x0'));var util=require('util');var moment=require(_0x8c6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c6d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c6d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8c6d('0x4'));var config=require(_0x8c6d('0x5'));var jayson=require(_0x8c6d('0x6'));var client=jayson[_0x8c6d('0x7')][_0x8c6d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2dbb52,_0x98cae4,_0x5529f1){return new BPromise(function(_0x1496ba,_0x75c49f){return client[_0x8c6d('0x9')](_0x2dbb52,_0x5529f1)['then'](function(_0x3cecc1){logger[_0x8c6d('0xa')](_0x8c6d('0xb'),_0x98cae4,_0x8c6d('0xc'));logger[_0x8c6d('0xd')](_0x8c6d('0xe'),_0x98cae4,_0x8c6d('0xc'),JSON[_0x8c6d('0xf')](_0x3cecc1));if(_0x3cecc1['error']){if(_0x3cecc1[_0x8c6d('0x10')]['code']===0x1f4){logger['error'](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x75c49f(_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);}logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x3cecc1[_0x8c6d('0x10')][_0x8c6d('0x11')]);return _0x1496ba(_0x3cecc1[_0x8c6d('0x10')]['message']);}else{logger[_0x8c6d('0xa')]('Tag,\x20%s,\x20%s',_0x98cae4,_0x8c6d('0xc'));_0x1496ba(_0x3cecc1['result'][_0x8c6d('0x11')]);}})[_0x8c6d('0x12')](function(_0x52ed7b){logger[_0x8c6d('0x10')](_0x8c6d('0xb'),_0x98cae4,_0x52ed7b);_0x75c49f(_0x52ed7b);});});} \ No newline at end of file +var _0x9649=['bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Tag,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x4b209e,_0x57defc){var _0x1615dd=function(_0x4c69bb){while(--_0x4c69bb){_0x4b209e['push'](_0x4b209e['shift']());}};_0x1615dd(++_0x57defc);}(_0x9649,0x19f));var _0x9964=function(_0xd45e5a,_0x345e6c){_0xd45e5a=_0xd45e5a-0x0;var _0x4e82b2=_0x9649[_0xd45e5a];return _0x4e82b2;};'use strict';var _=require(_0x9964('0x0'));var util=require(_0x9964('0x1'));var moment=require(_0x9964('0x2'));var BPromise=require(_0x9964('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9964('0x4'));var db=require(_0x9964('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9964('0x6'))('rpc');var config=require(_0x9964('0x7'));var jayson=require(_0x9964('0x8'));var client=jayson[_0x9964('0x9')][_0x9964('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40c60b,_0x1338e7,_0x3fa639){return new BPromise(function(_0x4bec88,_0x45dda7){return client[_0x9964('0xb')](_0x40c60b,_0x3fa639)['then'](function(_0x10b88b){logger[_0x9964('0xc')]('Tag,\x20%s,\x20%s',_0x1338e7,'request\x20sent');logger[_0x9964('0xd')](_0x9964('0xe'),_0x1338e7,_0x9964('0xf'),JSON[_0x9964('0x10')](_0x10b88b));if(_0x10b88b[_0x9964('0x11')]){if(_0x10b88b['error'][_0x9964('0x12')]===0x1f4){logger['error'](_0x9964('0x13'),_0x1338e7,_0x10b88b[_0x9964('0x11')]['message']);return _0x45dda7(_0x10b88b[_0x9964('0x11')][_0x9964('0x14')]);}logger['error'](_0x9964('0x13'),_0x1338e7,_0x10b88b[_0x9964('0x11')][_0x9964('0x14')]);return _0x4bec88(_0x10b88b[_0x9964('0x11')][_0x9964('0x14')]);}else{logger['info'](_0x9964('0x13'),_0x1338e7,_0x9964('0xf'));_0x4bec88(_0x10b88b['result'][_0x9964('0x14')]);}})[_0x9964('0x15')](function(_0x57fe55){logger[_0x9964('0x11')](_0x9964('0x13'),_0x1338e7,_0x57fe55);_0x45dda7(_0x57fe55);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index d44ea93..6e7dc1b 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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 1f556fd..4ca68ac 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['name','exports','STRING'];(function(_0x4cdb9c,_0x41c9b6){var _0x2aea5d=function(_0x46bc04){while(--_0x46bc04){_0x4cdb9c['push'](_0x4cdb9c['shift']());}};_0x2aea5d(++_0x41c9b6);}(_0x2032,0xd9));var _0x2203=function(_0x550713,_0x1dfd47){_0x550713=_0x550713-0x0;var _0x4aaba9=_0x2032[_0x550713];return _0x4aaba9;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x484315,_0x5c0c7e){var _0xb6a9b3=function(_0x3a3882){while(--_0x3a3882){_0x484315['push'](_0x484315['shift']());}};_0xb6a9b3(++_0x5c0c7e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 1771032..4f4094e 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 _0x9c44=['redis','socket.io-emitter','./team.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','reject','save','then','destroy','UserProfileResource','error','stack','name','index','map','Team','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','findAll','catch','show','params','includeAll','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','update','channel','isValidChannel','Sequelize','ValidationError','capitalize','length','toLowerCase','Queues','addQueues','findOne','add','ids','removeQueues','Unknown\x20channel','remove','addAgents','isArray','Voice','Mail','Fax','Openchannel','Whatsapp','sequelize','transaction','through','penalty','User','findOrCreate','Queue:save','QueueId','online','interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','voicePause','TeamVoiceQueue','all','TeamVoicePrefix','UserVoicePrefix','spread','removeAgents','Sms','emit','Queue:remove','VoicePrefixId','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','defaults'];(function(_0x10bbae,_0x408367){var _0x1f21db=function(_0x5149b9){while(--_0x5149b9){_0x10bbae['push'](_0x10bbae['shift']());}};_0x1f21db(++_0x408367);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];config['redis']=_[_0x49c4('0x16')](config[_0x49c4('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x49c4('0x18'))(new Redis(config[_0x49c4('0x17')]));require(_0x49c4('0x19'))[_0x49c4('0x1a')](socket);function respondWithStatusCode(_0x12777c,_0x18211c){_0x18211c=_0x18211c||0xcc;return function(_0x75ea8){if(_0x75ea8){return _0x12777c[_0x49c4('0x1b')](_0x18211c);}return _0x12777c['status'](_0x18211c)[_0x49c4('0x1c')]();};}function respondWithResult(_0x141003,_0x13a2db){_0x13a2db=_0x13a2db||0xc8;return function(_0x81e831){if(_0x81e831){return _0x141003[_0x49c4('0x1d')](_0x13a2db)['json'](_0x81e831);}};}function respondWithFilteredResult(_0x44e607,_0x2891f4){return function(_0x4c3253){if(_0x4c3253){var _0x512650=typeof _0x2891f4[_0x49c4('0x1e')]===_0x49c4('0x1f')&&typeof _0x2891f4[_0x49c4('0x20')]==='undefined';var _0x24856d=_0x4c3253['count'];var _0x2cbd50=_0x512650?0x0:_0x2891f4[_0x49c4('0x1e')];var _0xe31fcc=_0x512650?_0x4c3253[_0x49c4('0x21')]:_0x2891f4[_0x49c4('0x1e')]+_0x2891f4[_0x49c4('0x20')];var _0x280893;if(_0xe31fcc>=_0x24856d){_0xe31fcc=_0x24856d;_0x280893=0xc8;}else{_0x280893=0xce;}_0x44e607[_0x49c4('0x1d')](_0x280893);return _0x44e607[_0x49c4('0x22')]('Content-Range',_0x2cbd50+'-'+_0xe31fcc+'/'+_0x24856d)['json'](_0x4c3253);}return null;};}function patchUpdates(_0x57f502){return function(_0x1c99b1){try{jsonpatch['apply'](_0x1c99b1,_0x57f502,!![]);}catch(_0x592bb8){return BPromise[_0x49c4('0x23')](_0x592bb8);}return _0x1c99b1[_0x49c4('0x24')]();};}function saveUpdates(_0x26c640,_0xd335e4){return function(_0x4811c4){if(_0x4811c4){return _0x4811c4['update'](_0x26c640)[_0x49c4('0x25')](function(_0x9cb797){return _0x9cb797;});}return null;};}function removeEntity(_0x565423,_0x207358){return function(_0x43e014){if(_0x43e014){return _0x43e014[_0x49c4('0x26')]()[_0x49c4('0x25')](function(){var _0x531d92=_0x43e014['get']({'plain':!![]});var _0x449960='Teams';return db[_0x49c4('0x27')][_0x49c4('0x26')]({'where':{'type':_0x449960,'resourceId':_0x531d92['id']}})[_0x49c4('0x25')](function(){return _0x43e014;});})[_0x49c4('0x25')](function(){_0x565423['status'](0xcc)[_0x49c4('0x1c')]();});}};}function handleEntityNotFound(_0x2b2793,_0x46e04d){return function(_0x4f28a2){if(!_0x4f28a2){_0x2b2793[_0x49c4('0x1b')](0x194);}return _0x4f28a2;};}function handleError(_0x29f835,_0x26ba17){_0x26ba17=_0x26ba17||0x1f4;return function(_0x427b26){logger[_0x49c4('0x28')](_0x427b26[_0x49c4('0x29')]);if(_0x427b26[_0x49c4('0x2a')]){delete _0x427b26['name'];}_0x29f835['status'](_0x26ba17)['send'](_0x427b26);};}exports[_0x49c4('0x2b')]=function(_0x7ee704,_0x1eb035){var _0x27e467={},_0x28eb47={},_0x574fd3={'count':0x0,'rows':[]};var _0x38ad77=_[_0x49c4('0x2c')](db[_0x49c4('0x2d')][_0x49c4('0x2e')],function(_0x58e252){return{'name':_0x58e252['fieldName'],'type':_0x58e252[_0x49c4('0x2f')][_0x49c4('0x30')]};});_0x28eb47[_0x49c4('0x31')]=_[_0x49c4('0x2c')](_0x38ad77,_0x49c4('0x2a'));_0x28eb47['query']=_[_0x49c4('0x32')](_0x7ee704[_0x49c4('0x33')]);_0x28eb47[_0x49c4('0x34')]=_['intersection'](_0x28eb47['model'],_0x28eb47[_0x49c4('0x33')]);_0x27e467[_0x49c4('0x35')]=_[_0x49c4('0x36')](_0x28eb47[_0x49c4('0x31')],qs[_0x49c4('0x37')](_0x7ee704[_0x49c4('0x33')][_0x49c4('0x37')]));_0x27e467[_0x49c4('0x35')]=_0x27e467[_0x49c4('0x35')]['length']?_0x27e467[_0x49c4('0x35')]:_0x28eb47['model'];if(!_0x7ee704[_0x49c4('0x33')][_0x49c4('0x38')](_0x49c4('0x39'))){_0x27e467[_0x49c4('0x20')]=qs['limit'](_0x7ee704[_0x49c4('0x33')][_0x49c4('0x20')]);_0x27e467[_0x49c4('0x1e')]=qs['offset'](_0x7ee704[_0x49c4('0x33')][_0x49c4('0x1e')]);}_0x27e467[_0x49c4('0x3a')]=qs[_0x49c4('0x3b')](_0x7ee704[_0x49c4('0x33')][_0x49c4('0x3b')]);_0x27e467[_0x49c4('0x3c')]=qs[_0x49c4('0x34')](_[_0x49c4('0x3d')](_0x7ee704[_0x49c4('0x33')],_0x28eb47[_0x49c4('0x34')]),_0x38ad77);if(_0x7ee704['query'][_0x49c4('0x3e')]){_0x27e467[_0x49c4('0x3c')]=_[_0x49c4('0x3f')](_0x27e467[_0x49c4('0x3c')],{'$or':_[_0x49c4('0x2c')](_0x38ad77,function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x2f')]!==_0x49c4('0x40')){var _0x248c0a={};_0x248c0a[_0x29dd5d[_0x49c4('0x2a')]]={'$like':'%'+_0x7ee704[_0x49c4('0x33')][_0x49c4('0x3e')]+'%'};return _0x248c0a;}})});}_0x27e467=_[_0x49c4('0x3f')]({},_0x27e467,_0x7ee704['options']);var _0x212366={'where':_0x27e467['where']};return db[_0x49c4('0x2d')][_0x49c4('0x21')](_0x212366)[_0x49c4('0x25')](function(_0x1480da){_0x574fd3[_0x49c4('0x21')]=_0x1480da;if(_0x7ee704[_0x49c4('0x33')]['includeAll']){_0x27e467['include']=[{'all':!![]}];}return db[_0x49c4('0x2d')][_0x49c4('0x41')](_0x27e467);})[_0x49c4('0x25')](function(_0x117151){_0x574fd3['rows']=_0x117151;return _0x574fd3;})[_0x49c4('0x25')](respondWithFilteredResult(_0x1eb035,_0x27e467))[_0x49c4('0x42')](handleError(_0x1eb035,null));};exports[_0x49c4('0x43')]=function(_0x444270,_0x81a674){var _0x3bde49={'raw':![],'where':{'id':_0x444270[_0x49c4('0x44')]['id']}},_0x1a9593={};_0x1a9593[_0x49c4('0x31')]=_['keys'](db[_0x49c4('0x2d')]['rawAttributes']);_0x1a9593[_0x49c4('0x33')]=_[_0x49c4('0x32')](_0x444270[_0x49c4('0x33')]);_0x1a9593[_0x49c4('0x34')]=_[_0x49c4('0x36')](_0x1a9593['model'],_0x1a9593[_0x49c4('0x33')]);_0x3bde49[_0x49c4('0x35')]=_[_0x49c4('0x36')](_0x1a9593[_0x49c4('0x31')],qs[_0x49c4('0x37')](_0x444270[_0x49c4('0x33')][_0x49c4('0x37')]));_0x3bde49['attributes']=_0x3bde49[_0x49c4('0x35')]['length']?_0x3bde49[_0x49c4('0x35')]:_0x1a9593[_0x49c4('0x31')];if(_0x444270[_0x49c4('0x33')][_0x49c4('0x45')]){_0x3bde49[_0x49c4('0x46')]=[{'all':!![]}];}_0x3bde49=_[_0x49c4('0x3f')]({},_0x3bde49,_0x444270[_0x49c4('0x47')]);return db['Team'][_0x49c4('0x48')](_0x3bde49)[_0x49c4('0x25')](handleEntityNotFound(_0x81a674,null))['then'](respondWithResult(_0x81a674,null))[_0x49c4('0x42')](handleError(_0x81a674,null));};exports[_0x49c4('0x49')]=function(_0xfbe179,_0x242afc){return db['Team']['create'](_0xfbe179[_0x49c4('0x4a')],{})['then'](function(_0x4597c3){var _0x1f941f=_0xfbe179[_0x49c4('0x4b')][_0x49c4('0x4c')]({'plain':!![]});if(!_0x1f941f)throw new Error(_0x49c4('0x4d'));if(_0x1f941f[_0x49c4('0x4e')]===_0x49c4('0x4b')){var _0x563f0b=_0x4597c3[_0x49c4('0x4c')]({'plain':!![]});var _0x1550ce=_0x49c4('0x4f');return db[_0x49c4('0x50')][_0x49c4('0x48')]({'where':{'name':_0x1550ce,'userProfileId':_0x1f941f[_0x49c4('0x51')]},'raw':!![]})[_0x49c4('0x25')](function(_0x25d174){if(_0x25d174&&_0x25d174[_0x49c4('0x52')]===0x0){return db[_0x49c4('0x27')]['create']({'name':_0x563f0b['name'],'resourceId':_0x563f0b['id'],'type':_0x25d174[_0x49c4('0x2a')],'sectionId':_0x25d174['id']},{})[_0x49c4('0x25')](function(){return _0x4597c3;});}else{return _0x4597c3;}})['catch'](function(_0x59a8bc){logger[_0x49c4('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x59a8bc);throw _0x59a8bc;});}return _0x4597c3;})['then'](respondWithResult(_0x242afc,0xc9))[_0x49c4('0x42')](handleError(_0x242afc,null));};exports[_0x49c4('0x53')]=function(_0x4a0a93,_0x38c480){if(_0x4a0a93[_0x49c4('0x4a')]['id']){delete _0x4a0a93[_0x49c4('0x4a')]['id'];}return db[_0x49c4('0x2d')]['find']({'where':{'id':_0x4a0a93[_0x49c4('0x44')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x38c480,null))[_0x49c4('0x25')](saveUpdates(_0x4a0a93[_0x49c4('0x4a')],null))[_0x49c4('0x25')](respondWithResult(_0x38c480,null))[_0x49c4('0x42')](handleError(_0x38c480,null));};exports['destroy']=function(_0x5c7ddd,_0x1ef0c1){return db[_0x49c4('0x2d')][_0x49c4('0x48')]({'where':{'id':_0x5c7ddd[_0x49c4('0x44')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x1ef0c1,null))[_0x49c4('0x25')](removeEntity(_0x1ef0c1,null))[_0x49c4('0x42')](handleError(_0x1ef0c1,null));};exports['getQueues']=function(_0x45d715,_0x33c9a6,_0x4ba4eb){return db[_0x49c4('0x2d')]['findOne']({'where':{'id':_0x45d715[_0x49c4('0x44')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x33c9a6,null))[_0x49c4('0x25')](function(_0x2fe89a){if(!_0x45d715[_0x49c4('0x33')][_0x49c4('0x54')]||!utils[_0x49c4('0x55')](_0x45d715[_0x49c4('0x33')]['channel'])){throw new db[(_0x49c4('0x56'))][(_0x49c4('0x57'))]('Unknown\x20channel');}var _0x10dec7={};var _0x299e74={};_0x299e74['model']=_[_0x49c4('0x32')](db[_[_0x49c4('0x58')](_0x45d715['query']['channel']['toLowerCase']())+'Queue'][_0x49c4('0x2e')]);_0x299e74['query']=_[_0x49c4('0x32')](_0x45d715[_0x49c4('0x33')]);_0x299e74['filters']=_[_0x49c4('0x36')](_0x299e74[_0x49c4('0x31')],_0x299e74['query']);_0x10dec7[_0x49c4('0x35')]=_[_0x49c4('0x36')](_0x299e74[_0x49c4('0x31')],qs[_0x49c4('0x37')](_0x45d715['query'][_0x49c4('0x37')]));_0x10dec7[_0x49c4('0x35')]=_0x10dec7[_0x49c4('0x35')][_0x49c4('0x59')]?_0x10dec7['attributes']:_0x299e74[_0x49c4('0x31')];_0x10dec7['limit']=qs['limit'](_0x45d715['query']['limit']);_0x10dec7[_0x49c4('0x1e')]=qs[_0x49c4('0x1e')](_0x45d715[_0x49c4('0x33')][_0x49c4('0x1e')]);_0x10dec7['order']=qs['sort'](_0x45d715[_0x49c4('0x33')][_0x49c4('0x3b')]);_0x10dec7[_0x49c4('0x3c')]=qs[_0x49c4('0x34')](_[_0x49c4('0x3d')](_0x45d715[_0x49c4('0x33')],_0x299e74[_0x49c4('0x34')]));_0x10dec7=_[_0x49c4('0x3f')]({},_0x10dec7,_0x45d715['options']);return _0x2fe89a[_0x49c4('0x4c')+_['capitalize'](_0x45d715[_0x49c4('0x33')][_0x49c4('0x54')][_0x49c4('0x5a')]())+_0x49c4('0x5b')](_0x10dec7);})[_0x49c4('0x25')](respondWithResult(_0x33c9a6,null))[_0x49c4('0x42')](handleError(_0x33c9a6,null));};exports[_0x49c4('0x5c')]=function(_0x3feb0b,_0x13d951,_0x1743d0){return db[_0x49c4('0x2d')][_0x49c4('0x5d')]({'where':{'id':_0x3feb0b[_0x49c4('0x44')]['id']}})[_0x49c4('0x25')](function(_0x2d5f63){if(_0x2d5f63){if(!_0x3feb0b[_0x49c4('0x4a')][_0x49c4('0x54')]||!utils[_0x49c4('0x55')](_0x3feb0b['body']['channel'])){throw new db[(_0x49c4('0x56'))][(_0x49c4('0x57'))]('Unknown\x20channel');}return _0x2d5f63[_0x49c4('0x5e')+_[_0x49c4('0x58')](_0x3feb0b[_0x49c4('0x4a')][_0x49c4('0x54')]['toLowerCase']())+'Queues'](_0x3feb0b['body'][_0x49c4('0x5f')]);}return null;})[_0x49c4('0x25')](handleEntityNotFound(_0x13d951,null))[_0x49c4('0x25')](respondWithStatusCode(_0x13d951,null))[_0x49c4('0x42')](handleError(_0x13d951,null));};exports[_0x49c4('0x60')]=function(_0x146706,_0x191afb,_0x3692a4){return db[_0x49c4('0x2d')]['findOne']({'where':{'id':_0x146706[_0x49c4('0x44')]['id']}})[_0x49c4('0x25')](function(_0x342f8f){if(_0x342f8f){if(!_0x146706['query'][_0x49c4('0x54')]||!utils[_0x49c4('0x55')](_0x146706[_0x49c4('0x33')][_0x49c4('0x54')])){throw new db[(_0x49c4('0x56'))][(_0x49c4('0x57'))](_0x49c4('0x61'));}return _0x342f8f[_0x49c4('0x62')+_['capitalize'](_0x146706[_0x49c4('0x33')][_0x49c4('0x54')][_0x49c4('0x5a')]())+_0x49c4('0x5b')](_0x146706[_0x49c4('0x33')]['ids']);}return null;})['then'](handleEntityNotFound(_0x191afb,null))[_0x49c4('0x25')](respondWithStatusCode(_0x191afb,null))['catch'](handleError(_0x191afb,null));};exports[_0x49c4('0x63')]=function(_0x558880,_0x23516e){var _0x27b77d=_[_0x49c4('0x64')](_0x558880[_0x49c4('0x4a')]['ids'])?_0x558880[_0x49c4('0x4a')][_0x49c4('0x5f')]:[_0x558880[_0x49c4('0x4a')][_0x49c4('0x5f')]];var _0x100bc4=_0x558880[_0x49c4('0x44')]['id'];return db[_0x49c4('0x2d')][_0x49c4('0x48')]({'where':{'id':_0x100bc4}})[_0x49c4('0x25')](handleEntityNotFound(_0x23516e,null))[_0x49c4('0x25')](function(_0x5e7f45){if(_0x5e7f45){var _0x228189=[_0x49c4('0x65'),'Chat',_0x49c4('0x66'),'Sms',_0x49c4('0x67'),_0x49c4('0x68'),_0x49c4('0x69')];return db[_0x49c4('0x6a')][_0x49c4('0x6b')](function(_0x58b90c){var _0x16f618=_[_0x49c4('0x2c')](_0x228189,function(_0x596a9e){var _0x2b5136={'attributes':['id',_0x49c4('0x2a')]};if(_0x596a9e==='Voice'){_0x2b5136[_0x49c4('0x6c')]={'attributes':[_0x49c4('0x6d')]};}return _0x5e7f45['get'+_0x596a9e+_0x49c4('0x5b')](_0x2b5136)[_0x49c4('0x25')](function(_0x25989a){var _0x33dc39=_['map'](_0x25989a,function(_0x999ae2){var _0x7212ce=_['map'](_0x27b77d,function(_0x45df7c){var _0x5f0188={'where':{'UserId':_0x45df7c,[_0x596a9e+'QueueId']:_0x999ae2['id']},'transaction':_0x58b90c};if(_0x596a9e===_0x49c4('0x65')){_0x5f0188['defaults']={'penalty':_0x999ae2['TeamVoiceQueue'][_0x49c4('0x6d')]};}return db[_0x49c4('0x6e')+_0x596a9e+'Queue'][_0x49c4('0x6f')](_0x5f0188)['then'](function(){socket['emit']('user'+_0x596a9e+_0x49c4('0x70'),{'UserId':_0x45df7c,[_0x596a9e+_0x49c4('0x71')]:_0x999ae2['id']});if(_0x596a9e!==_0x49c4('0x65')){return;}return db[_0x49c4('0x6e')]['findAll']({'where':{'id':_0x27b77d,'online':0x1},'attributes':['id','name',_0x49c4('0x72'),'voicePause',_0x49c4('0x73')],'raw':!![]})['then'](function(_0x4e381c){var _0x10a048=_[_0x49c4('0x2c')](_0x4e381c,function(_0x1076be){return db[_0x49c4('0x74')][_0x49c4('0x75')]({'membername':_0x1076be[_0x49c4('0x2a')],'UserId':_0x1076be['id'],'queue_name':_0x999ae2['name'],'VoiceQueueId':_0x999ae2['id'],'interface':_[_0x49c4('0x76')](_0x1076be[_0x49c4('0x73')])?util[_0x49c4('0x77')](_0x49c4('0x78'),_0x1076be[_0x49c4('0x2a')]):_0x1076be['interface'],'paused':_0x1076be[_0x49c4('0x79')]||![],'penalty':_0x999ae2[_0x49c4('0x7a')][_0x49c4('0x6d')]},{'transaction':_0x58b90c});});return Promise['all'](_0x10a048);});});});return Promise['all'](_0x7212ce);});return Promise[_0x49c4('0x7b')](_0x33dc39);})[_0x49c4('0x25')](function(){return db[_0x49c4('0x7c')][_0x49c4('0x5d')]({'where':{'teamId':_0x100bc4}})[_0x49c4('0x25')](function(_0x4e1c71){if(_0x4e1c71){var _0x83b5f2=_[_0x49c4('0x2c')](_0x27b77d,function(_0x191974){db[_0x49c4('0x7d')]['upsert']({'UserId':_0x191974,'VoicePrefixId':_0x4e1c71['VoicePrefixId']});});return Promise[_0x49c4('0x7b')](_0x83b5f2);}});});});return Promise[_0x49c4('0x7b')](_0x16f618)[_0x49c4('0x25')](function(){return _0x5e7f45[_0x49c4('0x63')](_0x27b77d,{'transaction':_0x58b90c})[_0x49c4('0x7e')](function(_0x5413d8){return _0x5413d8;});});});}})[_0x49c4('0x25')](respondWithResult(_0x23516e,null))[_0x49c4('0x42')](handleError(_0x23516e,null));};exports[_0x49c4('0x7f')]=function(_0x1b0111,_0x2cddc1){var _0x8f37e5=_['isArray'](_0x1b0111[_0x49c4('0x33')][_0x49c4('0x5f')])?_0x1b0111[_0x49c4('0x33')][_0x49c4('0x5f')]:[_0x1b0111['query']['ids']];var _0xa96f53=_0x1b0111['params']['id'];return db[_0x49c4('0x2d')]['find']({'where':{'id':_0xa96f53}})[_0x49c4('0x25')](handleEntityNotFound(_0x2cddc1,null))[_0x49c4('0x25')](function(_0x25afc3){if(_0x25afc3){var _0x20bec7=['Voice','Chat',_0x49c4('0x66'),_0x49c4('0x80'),_0x49c4('0x67'),'Openchannel','Whatsapp'];return db[_0x49c4('0x6a')]['transaction'](function(_0x5c4742){var _0x1b9473=_['map'](_0x20bec7,function(_0x22668b){var _0x3cfa95={'attributes':['id','name']};return _0x25afc3[_0x49c4('0x4c')+_0x22668b+_0x49c4('0x5b')](_0x3cfa95)['then'](function(_0x5428a9){var _0xdb9820=_['map'](_0x5428a9,function(_0x43fe1c){return _0x43fe1c[_0x49c4('0x7f')](_0x8f37e5,{'transaction':_0x5c4742})[_0x49c4('0x25')](function(){var _0x352733=_[_0x49c4('0x2c')](_0x8f37e5,function(_0x4483fc){socket[_0x49c4('0x81')]('user'+_0x22668b+_0x49c4('0x82'),{'UserId':Number(_0x4483fc),[_0x22668b+_0x49c4('0x71')]:_0x43fe1c['id']});if(_0x22668b!==_0x49c4('0x65')){return;}return db[_0x49c4('0x74')][_0x49c4('0x26')]({'where':{'VoiceQueueId':_0x43fe1c['id'],'UserId':_0x4483fc},'transaction':_0x5c4742});});return Promise['all'](_0x352733);});});return Promise[_0x49c4('0x7b')](_0xdb9820);});});return Promise['all'](_0x1b9473)[_0x49c4('0x25')](function(){return _0x25afc3[_0x49c4('0x7f')](_0x8f37e5,{'transaction':_0x5c4742});})[_0x49c4('0x25')](function(){return db[_0x49c4('0x7c')]['findOne']({'where':{'teamId':_0xa96f53}})[_0x49c4('0x25')](function(_0x139696){if(_0x139696){var _0x312b02=_[_0x49c4('0x2c')](_0x8f37e5,function(_0x332173){db[_0x49c4('0x7d')]['destroy']({'where':{'UserId':_0x332173,'VoicePrefixId':_0x139696[_0x49c4('0x83')]}});});return Promise['all'](_0x312b02);}});});});}})[_0x49c4('0x25')](respondWithStatusCode(_0x2cddc1,null))[_0x49c4('0x42')](handleError(_0x2cddc1,null));};exports[_0x49c4('0x84')]=function(_0x2722fe,_0x5d864b,_0x46eaa1){var _0x17e7c6={};var _0x5829bc={};var _0x1e0b7d;var _0x3c321f;return db['Team']['findOne']({'where':{'id':_0x2722fe[_0x49c4('0x44')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x5d864b,null))[_0x49c4('0x25')](function(_0x1aa3a3){if(_0x1aa3a3){_0x1e0b7d=_0x1aa3a3;_0x5829bc[_0x49c4('0x31')]=_[_0x49c4('0x32')](db[_0x49c4('0x6e')][_0x49c4('0x2e')]);_0x5829bc[_0x49c4('0x33')]=_[_0x49c4('0x32')](_0x2722fe[_0x49c4('0x33')]);_0x5829bc['filters']=_['intersection'](_0x5829bc[_0x49c4('0x31')],_0x5829bc[_0x49c4('0x33')]);_0x17e7c6[_0x49c4('0x35')]=_['intersection'](_0x5829bc[_0x49c4('0x31')],qs[_0x49c4('0x37')](_0x2722fe['query'][_0x49c4('0x37')]));_0x17e7c6['attributes']=_0x17e7c6[_0x49c4('0x35')][_0x49c4('0x59')]?_0x17e7c6[_0x49c4('0x35')]:_0x5829bc[_0x49c4('0x31')];_0x17e7c6['order']=qs[_0x49c4('0x3b')](_0x2722fe[_0x49c4('0x33')][_0x49c4('0x3b')]);_0x17e7c6[_0x49c4('0x3c')]=qs[_0x49c4('0x34')](_['pick'](_0x2722fe['query'],_0x5829bc['filters']));if(_0x2722fe[_0x49c4('0x33')][_0x49c4('0x3e')]){_0x17e7c6[_0x49c4('0x3c')]=_[_0x49c4('0x3f')](_0x17e7c6[_0x49c4('0x3c')],{'$or':_['map'](_0x17e7c6[_0x49c4('0x35')],function(_0x41ef7c){var _0x265dc3={};_0x265dc3[_0x41ef7c]={'$like':'%'+_0x2722fe[_0x49c4('0x33')]['filter']+'%'};return _0x265dc3;})});}_0x17e7c6=_[_0x49c4('0x3f')]({},_0x17e7c6,_0x2722fe[_0x49c4('0x47')]);return _0x1e0b7d[_0x49c4('0x84')](_0x17e7c6);}})[_0x49c4('0x25')](function(_0x2fda4f){if(_0x2fda4f){_0x3c321f=_0x2fda4f['length'];if(!_0x2722fe[_0x49c4('0x33')][_0x49c4('0x38')](_0x49c4('0x39'))){_0x17e7c6['limit']=qs[_0x49c4('0x20')](_0x2722fe[_0x49c4('0x33')][_0x49c4('0x20')]);_0x17e7c6['offset']=qs[_0x49c4('0x1e')](_0x2722fe['query']['offset']);}return _0x1e0b7d[_0x49c4('0x84')](_0x17e7c6);}})[_0x49c4('0x25')](function(_0x4ef4aa){if(_0x4ef4aa){return _0x4ef4aa?{'count':_0x3c321f,'rows':_0x4ef4aa}:null;}})[_0x49c4('0x25')](respondWithResult(_0x5d864b,null))[_0x49c4('0x42')](handleError(_0x5d864b,null));}; \ No newline at end of file +var _0x70e0=['papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','end','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','get','UserProfileResource','status','sendStatus','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','merge','VIRTUAL','filter','Team','include','findAll','show','params','length','includeAll','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','Queues','addQueues','Sequelize','Unknown\x20channel','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Whatsapp','sequelize','through','penalty','TeamVoiceQueue','User','Queue','Queue:save','QueueId','online','interface','UserVoiceQueueRt','upsert','SIP/%s','voicePause','all','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','spread','removeAgents','isArray','Openchannel','transaction','emit','Queue:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0x70e0,0x17b));var _0x070e=function(_0xcfc9f6,_0x5614e2){_0xcfc9f6=_0xcfc9f6-0x0;var _0xf34d1e=_0x70e0[_0xcfc9f6];return _0xf34d1e;};'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'];config[_0x070e('0x18')]=_[_0x070e('0x19')](config[_0x070e('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x070e('0x18')]));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x5bae0f,_0x11d2ce){_0x11d2ce=_0x11d2ce||0xcc;return function(_0x14c3fd){if(_0x14c3fd){return _0x5bae0f['sendStatus'](_0x11d2ce);}return _0x5bae0f['status'](_0x11d2ce)[_0x070e('0x1a')]();};}function respondWithResult(_0xeae1a5,_0x180897){_0x180897=_0x180897||0xc8;return function(_0x19d9da){if(_0x19d9da){return _0xeae1a5['status'](_0x180897)['json'](_0x19d9da);}};}function respondWithFilteredResult(_0x17e2e4,_0x2bd937){return function(_0x38f6e6){if(_0x38f6e6){var _0x2060cc=typeof _0x2bd937[_0x070e('0x1b')]==='undefined'&&typeof _0x2bd937[_0x070e('0x1c')]===_0x070e('0x1d');var _0x1ad3de=_0x38f6e6[_0x070e('0x1e')];var _0x259893=_0x2060cc?0x0:_0x2bd937['offset'];var _0x5b2f48=_0x2060cc?_0x38f6e6['count']:_0x2bd937[_0x070e('0x1b')]+_0x2bd937[_0x070e('0x1c')];var _0x20dc60;if(_0x5b2f48>=_0x1ad3de){_0x5b2f48=_0x1ad3de;_0x20dc60=0xc8;}else{_0x20dc60=0xce;}_0x17e2e4['status'](_0x20dc60);return _0x17e2e4[_0x070e('0x1f')]('Content-Range',_0x259893+'-'+_0x5b2f48+'/'+_0x1ad3de)[_0x070e('0x20')](_0x38f6e6);}return null;};}function patchUpdates(_0x3f6985){return function(_0x27a01e){try{jsonpatch[_0x070e('0x21')](_0x27a01e,_0x3f6985,!![]);}catch(_0x28a1c3){return BPromise[_0x070e('0x22')](_0x28a1c3);}return _0x27a01e[_0x070e('0x23')]();};}function saveUpdates(_0x164cdf,_0x595c7e){return function(_0x2f8055){if(_0x2f8055){return _0x2f8055[_0x070e('0x24')](_0x164cdf)[_0x070e('0x25')](function(_0x503f4d){return _0x503f4d;});}return null;};}function removeEntity(_0xf17c56,_0x5f3e9d){return function(_0x4a2dbd){if(_0x4a2dbd){return _0x4a2dbd[_0x070e('0x26')]()[_0x070e('0x25')](function(){var _0x41deb1=_0x4a2dbd[_0x070e('0x27')]({'plain':!![]});var _0x4763c6='Teams';return db[_0x070e('0x28')][_0x070e('0x26')]({'where':{'type':_0x4763c6,'resourceId':_0x41deb1['id']}})[_0x070e('0x25')](function(){return _0x4a2dbd;});})[_0x070e('0x25')](function(){_0xf17c56[_0x070e('0x29')](0xcc)[_0x070e('0x1a')]();});}};}function handleEntityNotFound(_0x1a1892,_0x26373b){return function(_0x5e8326){if(!_0x5e8326){_0x1a1892[_0x070e('0x2a')](0x194);}return _0x5e8326;};}function handleError(_0x351641,_0x3a16d0){_0x3a16d0=_0x3a16d0||0x1f4;return function(_0x56fc12){logger['error'](_0x56fc12[_0x070e('0x2b')]);if(_0x56fc12[_0x070e('0x2c')]){delete _0x56fc12[_0x070e('0x2c')];}_0x351641['status'](_0x3a16d0)[_0x070e('0x2d')](_0x56fc12);};}exports[_0x070e('0x2e')]=function(_0x3a9425,_0x5f2bee){var _0x53d473={},_0x5bf522={},_0x523b75={'count':0x0,'rows':[]};var _0x59c5b4=_[_0x070e('0x2f')](db['Team'][_0x070e('0x30')],function(_0x323cf1){return{'name':_0x323cf1['fieldName'],'type':_0x323cf1['type'][_0x070e('0x31')]};});_0x5bf522[_0x070e('0x32')]=_['map'](_0x59c5b4,'name');_0x5bf522[_0x070e('0x33')]=_[_0x070e('0x34')](_0x3a9425[_0x070e('0x33')]);_0x5bf522[_0x070e('0x35')]=_[_0x070e('0x36')](_0x5bf522['model'],_0x5bf522['query']);_0x53d473[_0x070e('0x37')]=_[_0x070e('0x36')](_0x5bf522[_0x070e('0x32')],qs[_0x070e('0x38')](_0x3a9425[_0x070e('0x33')]['fields']));_0x53d473[_0x070e('0x37')]=_0x53d473[_0x070e('0x37')]['length']?_0x53d473[_0x070e('0x37')]:_0x5bf522[_0x070e('0x32')];if(!_0x3a9425['query']['hasOwnProperty']('nolimit')){_0x53d473[_0x070e('0x1c')]=qs[_0x070e('0x1c')](_0x3a9425[_0x070e('0x33')][_0x070e('0x1c')]);_0x53d473[_0x070e('0x1b')]=qs['offset'](_0x3a9425[_0x070e('0x33')][_0x070e('0x1b')]);}_0x53d473[_0x070e('0x39')]=qs['sort'](_0x3a9425[_0x070e('0x33')][_0x070e('0x3a')]);_0x53d473[_0x070e('0x3b')]=qs['filters'](_[_0x070e('0x3c')](_0x3a9425[_0x070e('0x33')],_0x5bf522['filters']),_0x59c5b4);if(_0x3a9425[_0x070e('0x33')]['filter']){_0x53d473[_0x070e('0x3b')]=_[_0x070e('0x3d')](_0x53d473[_0x070e('0x3b')],{'$or':_[_0x070e('0x2f')](_0x59c5b4,function(_0xd03404){if(_0xd03404['type']!==_0x070e('0x3e')){var _0x5db2ce={};_0x5db2ce[_0xd03404['name']]={'$like':'%'+_0x3a9425[_0x070e('0x33')][_0x070e('0x3f')]+'%'};return _0x5db2ce;}})});}_0x53d473=_[_0x070e('0x3d')]({},_0x53d473,_0x3a9425['options']);var _0x2ad56c={'where':_0x53d473[_0x070e('0x3b')]};return db[_0x070e('0x40')][_0x070e('0x1e')](_0x2ad56c)['then'](function(_0x13e4e0){_0x523b75['count']=_0x13e4e0;if(_0x3a9425['query']['includeAll']){_0x53d473[_0x070e('0x41')]=[{'all':!![]}];}return db[_0x070e('0x40')][_0x070e('0x42')](_0x53d473);})[_0x070e('0x25')](function(_0x34f23e){_0x523b75['rows']=_0x34f23e;return _0x523b75;})[_0x070e('0x25')](respondWithFilteredResult(_0x5f2bee,_0x53d473))['catch'](handleError(_0x5f2bee,null));};exports[_0x070e('0x43')]=function(_0x42245d,_0xff760c){var _0x52fcea={'raw':![],'where':{'id':_0x42245d[_0x070e('0x44')]['id']}},_0x54285a={};_0x54285a['model']=_[_0x070e('0x34')](db[_0x070e('0x40')][_0x070e('0x30')]);_0x54285a['query']=_[_0x070e('0x34')](_0x42245d[_0x070e('0x33')]);_0x54285a['filters']=_['intersection'](_0x54285a[_0x070e('0x32')],_0x54285a[_0x070e('0x33')]);_0x52fcea[_0x070e('0x37')]=_[_0x070e('0x36')](_0x54285a[_0x070e('0x32')],qs['fields'](_0x42245d[_0x070e('0x33')][_0x070e('0x38')]));_0x52fcea[_0x070e('0x37')]=_0x52fcea[_0x070e('0x37')][_0x070e('0x45')]?_0x52fcea[_0x070e('0x37')]:_0x54285a[_0x070e('0x32')];if(_0x42245d[_0x070e('0x33')][_0x070e('0x46')]){_0x52fcea[_0x070e('0x41')]=[{'all':!![]}];}_0x52fcea=_[_0x070e('0x3d')]({},_0x52fcea,_0x42245d[_0x070e('0x47')]);return db[_0x070e('0x40')][_0x070e('0x48')](_0x52fcea)[_0x070e('0x25')](handleEntityNotFound(_0xff760c,null))['then'](respondWithResult(_0xff760c,null))[_0x070e('0x49')](handleError(_0xff760c,null));};exports[_0x070e('0x4a')]=function(_0x40298a,_0x249e3f){return db[_0x070e('0x40')][_0x070e('0x4a')](_0x40298a[_0x070e('0x4b')],{})[_0x070e('0x25')](function(_0x1c64d2){var _0x5744c5=_0x40298a[_0x070e('0x4c')]['get']({'plain':!![]});if(!_0x5744c5)throw new Error(_0x070e('0x4d'));if(_0x5744c5[_0x070e('0x4e')]==='user'){var _0x991d23=_0x1c64d2[_0x070e('0x27')]({'plain':!![]});var _0x25466f=_0x070e('0x4f');return db[_0x070e('0x50')][_0x070e('0x48')]({'where':{'name':_0x25466f,'userProfileId':_0x5744c5[_0x070e('0x51')]},'raw':!![]})['then'](function(_0x296978){if(_0x296978&&_0x296978['autoAssociation']===0x0){return db['UserProfileResource'][_0x070e('0x4a')]({'name':_0x991d23[_0x070e('0x2c')],'resourceId':_0x991d23['id'],'type':_0x296978[_0x070e('0x2c')],'sectionId':_0x296978['id']},{})[_0x070e('0x25')](function(){return _0x1c64d2;});}else{return _0x1c64d2;}})[_0x070e('0x49')](function(_0x7948ed){logger[_0x070e('0x52')](_0x070e('0x53'),_0x7948ed);throw _0x7948ed;});}return _0x1c64d2;})['then'](respondWithResult(_0x249e3f,0xc9))[_0x070e('0x49')](handleError(_0x249e3f,null));};exports['update']=function(_0x564d82,_0x3a76e2){if(_0x564d82[_0x070e('0x4b')]['id']){delete _0x564d82['body']['id'];}return db[_0x070e('0x40')][_0x070e('0x48')]({'where':{'id':_0x564d82[_0x070e('0x44')]['id']}})[_0x070e('0x25')](handleEntityNotFound(_0x3a76e2,null))[_0x070e('0x25')](saveUpdates(_0x564d82[_0x070e('0x4b')],null))[_0x070e('0x25')](respondWithResult(_0x3a76e2,null))['catch'](handleError(_0x3a76e2,null));};exports['destroy']=function(_0x5943e3,_0x3087e5){return db[_0x070e('0x40')][_0x070e('0x48')]({'where':{'id':_0x5943e3[_0x070e('0x44')]['id']}})['then'](handleEntityNotFound(_0x3087e5,null))[_0x070e('0x25')](removeEntity(_0x3087e5,null))['catch'](handleError(_0x3087e5,null));};exports[_0x070e('0x54')]=function(_0x1cbb7e,_0x476804,_0x24f303){return db[_0x070e('0x40')][_0x070e('0x55')]({'where':{'id':_0x1cbb7e['params']['id']}})[_0x070e('0x25')](handleEntityNotFound(_0x476804,null))[_0x070e('0x25')](function(_0x8aaf00){if(!_0x1cbb7e['query'][_0x070e('0x56')]||!utils[_0x070e('0x57')](_0x1cbb7e['query'][_0x070e('0x56')])){throw new db['Sequelize'][(_0x070e('0x58'))]('Unknown\x20channel');}var _0x4cb86f={};var _0x4b354d={};_0x4b354d[_0x070e('0x32')]=_[_0x070e('0x34')](db[_[_0x070e('0x59')](_0x1cbb7e[_0x070e('0x33')][_0x070e('0x56')][_0x070e('0x5a')]())+'Queue'][_0x070e('0x30')]);_0x4b354d['query']=_[_0x070e('0x34')](_0x1cbb7e['query']);_0x4b354d[_0x070e('0x35')]=_[_0x070e('0x36')](_0x4b354d['model'],_0x4b354d[_0x070e('0x33')]);_0x4cb86f['attributes']=_[_0x070e('0x36')](_0x4b354d[_0x070e('0x32')],qs[_0x070e('0x38')](_0x1cbb7e[_0x070e('0x33')][_0x070e('0x38')]));_0x4cb86f[_0x070e('0x37')]=_0x4cb86f[_0x070e('0x37')][_0x070e('0x45')]?_0x4cb86f[_0x070e('0x37')]:_0x4b354d[_0x070e('0x32')];_0x4cb86f[_0x070e('0x1c')]=qs[_0x070e('0x1c')](_0x1cbb7e[_0x070e('0x33')][_0x070e('0x1c')]);_0x4cb86f['offset']=qs[_0x070e('0x1b')](_0x1cbb7e[_0x070e('0x33')][_0x070e('0x1b')]);_0x4cb86f[_0x070e('0x39')]=qs['sort'](_0x1cbb7e[_0x070e('0x33')][_0x070e('0x3a')]);_0x4cb86f[_0x070e('0x3b')]=qs[_0x070e('0x35')](_[_0x070e('0x3c')](_0x1cbb7e[_0x070e('0x33')],_0x4b354d['filters']));_0x4cb86f=_[_0x070e('0x3d')]({},_0x4cb86f,_0x1cbb7e[_0x070e('0x47')]);return _0x8aaf00[_0x070e('0x27')+_[_0x070e('0x59')](_0x1cbb7e['query'][_0x070e('0x56')]['toLowerCase']())+_0x070e('0x5b')](_0x4cb86f);})[_0x070e('0x25')](respondWithResult(_0x476804,null))[_0x070e('0x49')](handleError(_0x476804,null));};exports[_0x070e('0x5c')]=function(_0x2a20d4,_0x50ef9f,_0x2e48f9){return db[_0x070e('0x40')][_0x070e('0x55')]({'where':{'id':_0x2a20d4[_0x070e('0x44')]['id']}})['then'](function(_0x26b2c0){if(_0x26b2c0){if(!_0x2a20d4['body'][_0x070e('0x56')]||!utils[_0x070e('0x57')](_0x2a20d4[_0x070e('0x4b')]['channel'])){throw new db[(_0x070e('0x5d'))]['ValidationError'](_0x070e('0x5e'));}return _0x26b2c0['add'+_[_0x070e('0x59')](_0x2a20d4[_0x070e('0x4b')]['channel'][_0x070e('0x5a')]())+'Queues'](_0x2a20d4[_0x070e('0x4b')][_0x070e('0x5f')]);}return null;})['then'](handleEntityNotFound(_0x50ef9f,null))['then'](respondWithStatusCode(_0x50ef9f,null))[_0x070e('0x49')](handleError(_0x50ef9f,null));};exports[_0x070e('0x60')]=function(_0xf67cfd,_0x17cf15,_0x25f1d0){return db[_0x070e('0x40')][_0x070e('0x55')]({'where':{'id':_0xf67cfd[_0x070e('0x44')]['id']}})[_0x070e('0x25')](function(_0x1d1f44){if(_0x1d1f44){if(!_0xf67cfd[_0x070e('0x33')][_0x070e('0x56')]||!utils[_0x070e('0x57')](_0xf67cfd['query'][_0x070e('0x56')])){throw new db[(_0x070e('0x5d'))]['ValidationError']('Unknown\x20channel');}return _0x1d1f44[_0x070e('0x61')+_[_0x070e('0x59')](_0xf67cfd[_0x070e('0x33')][_0x070e('0x56')][_0x070e('0x5a')]())+_0x070e('0x5b')](_0xf67cfd[_0x070e('0x33')][_0x070e('0x5f')]);}return null;})[_0x070e('0x25')](handleEntityNotFound(_0x17cf15,null))[_0x070e('0x25')](respondWithStatusCode(_0x17cf15,null))[_0x070e('0x49')](handleError(_0x17cf15,null));};exports[_0x070e('0x62')]=function(_0x46ec49,_0x595e2e){var _0x4f720f=_['isArray'](_0x46ec49[_0x070e('0x4b')][_0x070e('0x5f')])?_0x46ec49[_0x070e('0x4b')][_0x070e('0x5f')]:[_0x46ec49['body'][_0x070e('0x5f')]];var _0x332022=_0x46ec49[_0x070e('0x44')]['id'];return db[_0x070e('0x40')][_0x070e('0x48')]({'where':{'id':_0x332022}})[_0x070e('0x25')](handleEntityNotFound(_0x595e2e,null))['then'](function(_0xb2954d){if(_0xb2954d){var _0x5c56bd=[_0x070e('0x63'),_0x070e('0x64'),_0x070e('0x65'),_0x070e('0x66'),_0x070e('0x67'),'Openchannel',_0x070e('0x68')];return db[_0x070e('0x69')]['transaction'](function(_0x421392){var _0x1e1d27=_['map'](_0x5c56bd,function(_0xb8ae48){var _0x6efb89={'attributes':['id',_0x070e('0x2c')]};if(_0xb8ae48==='Voice'){_0x6efb89[_0x070e('0x6a')]={'attributes':[_0x070e('0x6b')]};}return _0xb2954d[_0x070e('0x27')+_0xb8ae48+_0x070e('0x5b')](_0x6efb89)[_0x070e('0x25')](function(_0x17975c){var _0x3961a6=_[_0x070e('0x2f')](_0x17975c,function(_0x206b97){var _0x31ab81=_[_0x070e('0x2f')](_0x4f720f,function(_0x46d2b7){var _0x18c27a={'where':{'UserId':_0x46d2b7,[_0xb8ae48+'QueueId']:_0x206b97['id']},'transaction':_0x421392};if(_0xb8ae48===_0x070e('0x63')){_0x18c27a[_0x070e('0x19')]={'penalty':_0x206b97[_0x070e('0x6c')][_0x070e('0x6b')]};}return db[_0x070e('0x6d')+_0xb8ae48+_0x070e('0x6e')]['findOrCreate'](_0x18c27a)['then'](function(){socket['emit'](_0x070e('0x4c')+_0xb8ae48+_0x070e('0x6f'),{'UserId':_0x46d2b7,[_0xb8ae48+_0x070e('0x70')]:_0x206b97['id']});if(_0xb8ae48!==_0x070e('0x63')){return;}return db['User'][_0x070e('0x42')]({'where':{'id':_0x4f720f,'online':0x1},'attributes':['id',_0x070e('0x2c'),_0x070e('0x71'),'voicePause',_0x070e('0x72')],'raw':!![]})['then'](function(_0x237e3b){var _0x396902=_['map'](_0x237e3b,function(_0x59fe3e){return db[_0x070e('0x73')][_0x070e('0x74')]({'membername':_0x59fe3e['name'],'UserId':_0x59fe3e['id'],'queue_name':_0x206b97[_0x070e('0x2c')],'VoiceQueueId':_0x206b97['id'],'interface':_['isNil'](_0x59fe3e['interface'])?util['format'](_0x070e('0x75'),_0x59fe3e[_0x070e('0x2c')]):_0x59fe3e[_0x070e('0x72')],'paused':_0x59fe3e[_0x070e('0x76')]||![],'penalty':_0x206b97[_0x070e('0x6c')][_0x070e('0x6b')]},{'transaction':_0x421392});});return Promise[_0x070e('0x77')](_0x396902);});});});return Promise[_0x070e('0x77')](_0x31ab81);});return Promise[_0x070e('0x77')](_0x3961a6);})[_0x070e('0x25')](function(){return db[_0x070e('0x78')][_0x070e('0x55')]({'where':{'teamId':_0x332022}})[_0x070e('0x25')](function(_0x767dcc){if(_0x767dcc){var _0x11e125=_[_0x070e('0x2f')](_0x4f720f,function(_0x1c6cf3){db[_0x070e('0x79')][_0x070e('0x74')]({'UserId':_0x1c6cf3,'VoicePrefixId':_0x767dcc[_0x070e('0x7a')]});});return Promise[_0x070e('0x77')](_0x11e125);}});});});return Promise[_0x070e('0x77')](_0x1e1d27)['then'](function(){return _0xb2954d[_0x070e('0x62')](_0x4f720f,{'transaction':_0x421392})[_0x070e('0x7b')](function(_0x449337){return _0x449337;});});});}})[_0x070e('0x25')](respondWithResult(_0x595e2e,null))['catch'](handleError(_0x595e2e,null));};exports[_0x070e('0x7c')]=function(_0x32fa3b,_0x2230ff){var _0x2bad43=_[_0x070e('0x7d')](_0x32fa3b[_0x070e('0x33')]['ids'])?_0x32fa3b['query']['ids']:[_0x32fa3b[_0x070e('0x33')]['ids']];var _0x26e9c1=_0x32fa3b[_0x070e('0x44')]['id'];return db['Team'][_0x070e('0x48')]({'where':{'id':_0x26e9c1}})[_0x070e('0x25')](handleEntityNotFound(_0x2230ff,null))['then'](function(_0x56f389){if(_0x56f389){var _0x13af96=[_0x070e('0x63'),_0x070e('0x64'),_0x070e('0x65'),_0x070e('0x66'),'Fax',_0x070e('0x7e'),'Whatsapp'];return db[_0x070e('0x69')][_0x070e('0x7f')](function(_0x490641){var _0x22cbfb=_[_0x070e('0x2f')](_0x13af96,function(_0x356448){var _0x16e190={'attributes':['id',_0x070e('0x2c')]};return _0x56f389[_0x070e('0x27')+_0x356448+'Queues'](_0x16e190)[_0x070e('0x25')](function(_0x3b75f3){var _0xde8455=_[_0x070e('0x2f')](_0x3b75f3,function(_0x259ac4){return _0x259ac4['removeAgents'](_0x2bad43,{'transaction':_0x490641})[_0x070e('0x25')](function(){var _0x3f03aa=_[_0x070e('0x2f')](_0x2bad43,function(_0x350c28){socket[_0x070e('0x80')](_0x070e('0x4c')+_0x356448+_0x070e('0x81'),{'UserId':Number(_0x350c28),[_0x356448+_0x070e('0x70')]:_0x259ac4['id']});if(_0x356448!==_0x070e('0x63')){return;}return db[_0x070e('0x73')][_0x070e('0x26')]({'where':{'VoiceQueueId':_0x259ac4['id'],'UserId':_0x350c28},'transaction':_0x490641});});return Promise[_0x070e('0x77')](_0x3f03aa);});});return Promise[_0x070e('0x77')](_0xde8455);});});return Promise[_0x070e('0x77')](_0x22cbfb)[_0x070e('0x25')](function(){return _0x56f389[_0x070e('0x7c')](_0x2bad43,{'transaction':_0x490641});})['then'](function(){return db['TeamVoicePrefix'][_0x070e('0x55')]({'where':{'teamId':_0x26e9c1}})[_0x070e('0x25')](function(_0x4ceba3){if(_0x4ceba3){var _0x5d8c9f=_['map'](_0x2bad43,function(_0x4cb7b2){db[_0x070e('0x79')][_0x070e('0x26')]({'where':{'UserId':_0x4cb7b2,'VoicePrefixId':_0x4ceba3[_0x070e('0x7a')]}});});return Promise[_0x070e('0x77')](_0x5d8c9f);}});});});}})[_0x070e('0x25')](respondWithStatusCode(_0x2230ff,null))[_0x070e('0x49')](handleError(_0x2230ff,null));};exports[_0x070e('0x82')]=function(_0x1e1da8,_0x44a0be,_0x3cc623){var _0x51f064={};var _0x89e855={};var _0x36cfe2;var _0x49c66a;return db[_0x070e('0x40')][_0x070e('0x55')]({'where':{'id':_0x1e1da8[_0x070e('0x44')]['id']}})[_0x070e('0x25')](handleEntityNotFound(_0x44a0be,null))['then'](function(_0x2d46fb){if(_0x2d46fb){_0x36cfe2=_0x2d46fb;_0x89e855[_0x070e('0x32')]=_[_0x070e('0x34')](db[_0x070e('0x6d')]['rawAttributes']);_0x89e855[_0x070e('0x33')]=_[_0x070e('0x34')](_0x1e1da8[_0x070e('0x33')]);_0x89e855[_0x070e('0x35')]=_[_0x070e('0x36')](_0x89e855[_0x070e('0x32')],_0x89e855[_0x070e('0x33')]);_0x51f064[_0x070e('0x37')]=_[_0x070e('0x36')](_0x89e855[_0x070e('0x32')],qs[_0x070e('0x38')](_0x1e1da8['query'][_0x070e('0x38')]));_0x51f064[_0x070e('0x37')]=_0x51f064['attributes']['length']?_0x51f064[_0x070e('0x37')]:_0x89e855['model'];_0x51f064[_0x070e('0x39')]=qs[_0x070e('0x3a')](_0x1e1da8[_0x070e('0x33')][_0x070e('0x3a')]);_0x51f064[_0x070e('0x3b')]=qs[_0x070e('0x35')](_[_0x070e('0x3c')](_0x1e1da8['query'],_0x89e855[_0x070e('0x35')]));if(_0x1e1da8[_0x070e('0x33')][_0x070e('0x3f')]){_0x51f064[_0x070e('0x3b')]=_['merge'](_0x51f064['where'],{'$or':_[_0x070e('0x2f')](_0x51f064[_0x070e('0x37')],function(_0x2e92f0){var _0x5b727f={};_0x5b727f[_0x2e92f0]={'$like':'%'+_0x1e1da8[_0x070e('0x33')][_0x070e('0x3f')]+'%'};return _0x5b727f;})});}_0x51f064=_['merge']({},_0x51f064,_0x1e1da8[_0x070e('0x47')]);return _0x36cfe2[_0x070e('0x82')](_0x51f064);}})[_0x070e('0x25')](function(_0x33009c){if(_0x33009c){_0x49c66a=_0x33009c[_0x070e('0x45')];if(!_0x1e1da8[_0x070e('0x33')]['hasOwnProperty']('nolimit')){_0x51f064[_0x070e('0x1c')]=qs['limit'](_0x1e1da8[_0x070e('0x33')][_0x070e('0x1c')]);_0x51f064['offset']=qs[_0x070e('0x1b')](_0x1e1da8['query'][_0x070e('0x1b')]);}return _0x36cfe2[_0x070e('0x82')](_0x51f064);}})[_0x070e('0x25')](function(_0x362def){if(_0x362def){return _0x362def?{'count':_0x49c66a,'rows':_0x362def}:null;}})[_0x070e('0x25')](respondWithResult(_0x44a0be,null))[_0x070e('0x49')](handleError(_0x44a0be,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 172ce70..461a09e 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 _0x4e65=['save','update','remove','emit','hasOwnProperty','hook','exports','events','Team','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e65,0x115));var _0x54e6=function(_0x425419,_0x59d24c){_0x425419=_0x425419-0x0;var _0x4eadab=_0x4e65[_0x425419];return _0x4eadab;};'use strict';var EventEmitter=require(_0x54e6('0x0'));var Team=require('../../mysqldb')['db'][_0x54e6('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x54e6('0x2')](0x0);var events={'afterCreate':_0x54e6('0x3'),'afterUpdate':_0x54e6('0x4'),'afterDestroy':_0x54e6('0x5')};function emitEvent(_0x5415b3){return function(_0x3806c5,_0x2d1867,_0x4cf760){TeamEvents[_0x54e6('0x6')](_0x5415b3+':'+_0x3806c5['id'],_0x3806c5);TeamEvents[_0x54e6('0x6')](_0x5415b3,_0x3806c5);_0x4cf760(null);};}for(var e in events){if(events[_0x54e6('0x7')](e)){var event=events[e];Team[_0x54e6('0x8')](e,emitEvent(event));}}module[_0x54e6('0x9')]=TeamEvents; \ No newline at end of file +var _0xa459=['events','update','remove','emit','hook','exports'];(function(_0x148535,_0x8ebc37){var _0x213962=function(_0x52150b){while(--_0x52150b){_0x148535['push'](_0x148535['shift']());}};_0x213962(++_0x8ebc37);}(_0xa459,0xae));var _0x9a45=function(_0x2ce9c3,_0x20a165){_0x2ce9c3=_0x2ce9c3-0x0;var _0x109b3a=_0xa459[_0x2ce9c3];return _0x109b3a;};'use strict';var EventEmitter=require(_0x9a45('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x9a45('0x1'),'afterDestroy':_0x9a45('0x2')};function emitEvent(_0x37f33c){return function(_0x3d64a1,_0x309ab9,_0x40f237){TeamEvents[_0x9a45('0x3')](_0x37f33c+':'+_0x3d64a1['id'],_0x3d64a1);TeamEvents[_0x9a45('0x3')](_0x37f33c,_0x3d64a1);_0x40f237(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x9a45('0x4')](e,emitEvent(event));}}module[_0x9a45('0x5')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 8ced0e6..b5a4413 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 _0x5f4c=['../../config/logger','bluebird','path','rimraf','../../config/environment','Team','teams','lodash','util'];(function(_0x216a28,_0x4f021e){var _0x4f4901=function(_0x285775){while(--_0x285775){_0x216a28['push'](_0x216a28['shift']());}};_0x4f4901(++_0x4f021e);}(_0x5f4c,0x6a));var _0xc5f4=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x5f4c[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xc5f4('0x0'));var util=require(_0xc5f4('0x1'));var logger=require(_0xc5f4('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc5f4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc5f4('0x4'));var rimraf=require(_0xc5f4('0x5'));var config=require(_0xc5f4('0x6'));var attributes=require('./team.attributes');module['exports']=function(_0x5e94c0,_0x4bc2b7){return _0x5e94c0['define'](_0xc5f4('0x7'),attributes,{'tableName':_0xc5f4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x974d=['rimraf','../../config/environment','./team.attributes','exports','define','Team','teams','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x25e6b9,_0x9d17ea){var _0x4bfb70=function(_0x5aafec){while(--_0x5aafec){_0x25e6b9['push'](_0x25e6b9['shift']());}};_0x4bfb70(++_0x9d17ea);}(_0x974d,0xca));var _0xd974=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x974d[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xd974('0x0'));var util=require(_0xd974('0x1'));var logger=require(_0xd974('0x2'))('api');var moment=require(_0xd974('0x3'));var BPromise=require(_0xd974('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd974('0x5'));var rimraf=require(_0xd974('0x6'));var config=require(_0xd974('0x7'));var attributes=require(_0xd974('0x8'));module[_0xd974('0x9')]=function(_0x476cb5,_0x5a1a1e){return _0x476cb5[_0xd974('0xa')](_0xd974('0xb'),attributes,{'tableName':_0xd974('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index c9e8fba..e9f992d 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 _0x26bd=['client','http','redis','localhost','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x25d086,_0x1f468d){var _0x3e6718=function(_0x4a1bc2){while(--_0x4a1bc2){_0x25d086['push'](_0x25d086['shift']());}};_0x3e6718(++_0x1f468d);}(_0x26bd,0x9f));var _0xd26b=function(_0x57a0d1,_0x191119){_0x57a0d1=_0x57a0d1-0x0;var _0x90c2ac=_0x26bd[_0x57a0d1];return _0x90c2ac;};'use strict';var _=require(_0xd26b('0x0'));var util=require(_0xd26b('0x1'));var moment=require('moment');var BPromise=require(_0xd26b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd26b('0x3'));var db=require(_0xd26b('0x4'))['db'];var utils=require(_0xd26b('0x5'));var logger=require('../../config/logger')(_0xd26b('0x6'));var config=require(_0xd26b('0x7'));var jayson=require(_0xd26b('0x8'));var client=jayson[_0xd26b('0x9')][_0xd26b('0xa')]({'port':0x232a});config[_0xd26b('0xb')]=_['defaults'](config[_0xd26b('0xb')],{'host':_0xd26b('0xc'),'port':0x18eb});var socket=require(_0xd26b('0xd'))(new Redis(config[_0xd26b('0xb')]));require(_0xd26b('0xe'))['register'](socket);function respondWithRpcPromise(_0x3c01b4,_0x5f0277,_0x6a4ec3){return new BPromise(function(_0x5d6e82,_0x465205){return client[_0xd26b('0xf')](_0x3c01b4,_0x6a4ec3)[_0xd26b('0x10')](function(_0x4925cf){logger[_0xd26b('0x11')](_0xd26b('0x12'),_0x5f0277,'request\x20sent');logger['debug'](_0xd26b('0x13'),_0x5f0277,_0xd26b('0x14'),JSON['stringify'](_0x4925cf));if(_0x4925cf['error']){if(_0x4925cf['error']['code']===0x1f4){logger[_0xd26b('0x15')](_0xd26b('0x12'),_0x5f0277,_0x4925cf[_0xd26b('0x15')]['message']);return _0x465205(_0x4925cf[_0xd26b('0x15')][_0xd26b('0x16')]);}logger[_0xd26b('0x15')](_0xd26b('0x12'),_0x5f0277,_0x4925cf[_0xd26b('0x15')][_0xd26b('0x16')]);return _0x5d6e82(_0x4925cf['error'][_0xd26b('0x16')]);}else{logger[_0xd26b('0x11')]('Team,\x20%s,\x20%s',_0x5f0277,_0xd26b('0x14'));_0x5d6e82(_0x4925cf[_0xd26b('0x17')][_0xd26b('0x16')]);}})['catch'](function(_0x2ceddb){logger['error'](_0xd26b('0x12'),_0x5f0277,_0x2ceddb);_0x465205(_0x2ceddb);});});} \ No newline at end of file +var _0xf8ef=['catch','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','then','info','request\x20sent','debug','stringify','error','Team,\x20%s,\x20%s','message','result'];(function(_0x2c2780,_0x115889){var _0x31894e=function(_0x5d7fe2){while(--_0x5d7fe2){_0x2c2780['push'](_0x2c2780['shift']());}};_0x31894e(++_0x115889);}(_0xf8ef,0x114));var _0xff8e=function(_0x3ac2f6,_0x373dcc){_0x3ac2f6=_0x3ac2f6-0x0;var _0x241b5a=_0xf8ef[_0x3ac2f6];return _0x241b5a;};'use strict';var _=require(_0xff8e('0x0'));var util=require(_0xff8e('0x1'));var moment=require(_0xff8e('0x2'));var BPromise=require(_0xff8e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xff8e('0x4'));var logger=require('../../config/logger')(_0xff8e('0x5'));var config=require(_0xff8e('0x6'));var jayson=require(_0xff8e('0x7'));var client=jayson[_0xff8e('0x8')][_0xff8e('0x9')]({'port':0x232a});config[_0xff8e('0xa')]=_[_0xff8e('0xb')](config[_0xff8e('0xa')],{'host':_0xff8e('0xc'),'port':0x18eb});var socket=require(_0xff8e('0xd'))(new Redis(config['redis']));require(_0xff8e('0xe'))['register'](socket);function respondWithRpcPromise(_0x3e18a7,_0x2aa680,_0xda2b6){return new BPromise(function(_0x416ade,_0x45894e){return client['request'](_0x3e18a7,_0xda2b6)[_0xff8e('0xf')](function(_0x28da5d){logger[_0xff8e('0x10')]('Team,\x20%s,\x20%s',_0x2aa680,_0xff8e('0x11'));logger[_0xff8e('0x12')]('Team,\x20%s,\x20%s,\x20%s',_0x2aa680,_0xff8e('0x11'),JSON[_0xff8e('0x13')](_0x28da5d));if(_0x28da5d[_0xff8e('0x14')]){if(_0x28da5d[_0xff8e('0x14')]['code']===0x1f4){logger[_0xff8e('0x14')](_0xff8e('0x15'),_0x2aa680,_0x28da5d[_0xff8e('0x14')][_0xff8e('0x16')]);return _0x45894e(_0x28da5d[_0xff8e('0x14')][_0xff8e('0x16')]);}logger['error'](_0xff8e('0x15'),_0x2aa680,_0x28da5d[_0xff8e('0x14')][_0xff8e('0x16')]);return _0x416ade(_0x28da5d[_0xff8e('0x14')][_0xff8e('0x16')]);}else{logger[_0xff8e('0x10')](_0xff8e('0x15'),_0x2aa680,_0xff8e('0x11'));_0x416ade(_0x28da5d[_0xff8e('0x17')][_0xff8e('0x16')]);}})[_0xff8e('0x18')](function(_0x16ac96){logger[_0xff8e('0x14')](_0xff8e('0x15'),_0x2aa680,_0x16ac96);_0x45894e(_0x16ac96);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 547b587..f87844b 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 _0xa87e=['save','remove','update','emit','register','length','team:'];(function(_0x4ba124,_0x27a966){var _0x1be63f=function(_0x364b29){while(--_0x364b29){_0x4ba124['push'](_0x4ba124['shift']());}};_0x1be63f(++_0x27a966);}(_0xa87e,0x173));var _0xea87=function(_0x57fde6,_0x1b5272){_0x57fde6=_0x57fde6-0x0;var _0x37e94d=_0xa87e[_0x57fde6];return _0x37e94d;};'use strict';var TeamEvents=require('./team.events');var events=[_0xea87('0x0'),_0xea87('0x1'),_0xea87('0x2')];function createListener(_0x4adb8c,_0x26b38e){return function(_0x1e58a3){_0x26b38e[_0xea87('0x3')](_0x4adb8c,_0x1e58a3);};}function removeListener(_0x712f90,_0x222160){return function(){TeamEvents['removeListener'](_0x712f90,_0x222160);};}exports[_0xea87('0x4')]=function(_0x13c12b){for(var _0x586100=0x0,_0x2f3c3a=events[_0xea87('0x5')];_0x586100<_0x2f3c3a;_0x586100++){var _0x36352b=events[_0x586100];var _0xd0dd3b=createListener(_0xea87('0x6')+_0x36352b,_0x13c12b);TeamEvents['on'](_0x36352b,_0xd0dd3b);}}; \ No newline at end of file +var _0x777d=['update','removeListener','team:','save','remove'];(function(_0x2fae4d,_0x4ce1ad){var _0x1dbfce=function(_0x3dc018){while(--_0x3dc018){_0x2fae4d['push'](_0x2fae4d['shift']());}};_0x1dbfce(++_0x4ce1ad);}(_0x777d,0xe9));var _0xd777=function(_0x4a2183,_0x53e74d){_0x4a2183=_0x4a2183-0x0;var _0xc7c01d=_0x777d[_0x4a2183];return _0xc7c01d;};'use strict';var TeamEvents=require('./team.events');var events=[_0xd777('0x0'),_0xd777('0x1'),_0xd777('0x2')];function createListener(_0x4b7e85,_0x474b87){return function(_0x317c06){_0x474b87['emit'](_0x4b7e85,_0x317c06);};}function removeListener(_0x5e0f79,_0x514817){return function(){TeamEvents[_0xd777('0x3')](_0x5e0f79,_0x514817);};}exports['register']=function(_0x253dc1){for(var _0x51e918=0x0,_0xc7c954=events['length'];_0x51e918<_0xc7c954;_0x51e918++){var _0x57d67f=events[_0x51e918];var _0x49d55d=createListener(_0xd777('0x4')+_0x57d67f,_0x253dc1);TeamEvents['on'](_0x57d67f,_0x49d55d);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 7d5ea50..e569d50 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 _0x2557=['sequelize','INTEGER'];(function(_0x180a87,_0x3c3463){var _0x281e81=function(_0x15cacd){while(--_0x15cacd){_0x180a87['push'](_0x180a87['shift']());}};_0x281e81(++_0x3c3463);}(_0x2557,0x11e));var _0x7255=function(_0x39d276,_0x4e889e){_0x39d276=_0x39d276-0x0;var _0x5caf46=_0x2557[_0x39d276];return _0x5caf46;};'use strict';var Sequelize=require(_0x7255('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x7255('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x7255('0x1')]}}; \ No newline at end of file +var _0x15ab=['exports','INTEGER','sequelize'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x15ab,0xda));var _0xb15a=function(_0x36bc6e,_0x2affb2){_0x36bc6e=_0x36bc6e-0x0;var _0xf4145c=_0x15ab[_0x36bc6e];return _0xf4145c;};'use strict';var Sequelize=require(_0xb15a('0x0'));module[_0xb15a('0x1')]={'TeamId':{'type':Sequelize[_0xb15a('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xb15a('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index e6a84e5..6a819fd 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 _0x9a86=['define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x9a86,0x1ed));var _0x69a8=function(_0x36fbef,_0x4ffc84){_0x36fbef=_0x36fbef-0x0;var _0x45e270=_0x9a86[_0x36fbef];return _0x45e270;};'use strict';var _=require(_0x69a8('0x0'));var util=require(_0x69a8('0x1'));var logger=require('../../config/logger')(_0x69a8('0x2'));var moment=require(_0x69a8('0x3'));var BPromise=require(_0x69a8('0x4'));var rp=require(_0x69a8('0x5'));var fs=require('fs');var path=require(_0x69a8('0x6'));var rimraf=require(_0x69a8('0x7'));var config=require(_0x69a8('0x8'));var attributes=require(_0x69a8('0x9'));module[_0x69a8('0xa')]=function(_0x36c9ac,_0x3ed1d5){return _0x36c9ac[_0x69a8('0xb')](_0x69a8('0xc'),attributes,{'tableName':_0x69a8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9c02=['../../config/logger','path','../../config/environment','exports','define','TeamVoicePrefix','lodash','util'];(function(_0x15b9e6,_0x3f4cf6){var _0x183a31=function(_0x4ffc6c){while(--_0x4ffc6c){_0x15b9e6['push'](_0x15b9e6['shift']());}};_0x183a31(++_0x3f4cf6);}(_0x9c02,0x196));var _0x29c0=function(_0x4c40cd,_0x3b6bf7){_0x4c40cd=_0x4c40cd-0x0;var _0x5ccfaa=_0x9c02[_0x4c40cd];return _0x5ccfaa;};'use strict';var _=require(_0x29c0('0x0'));var util=require(_0x29c0('0x1'));var logger=require(_0x29c0('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x29c0('0x3'));var rimraf=require('rimraf');var config=require(_0x29c0('0x4'));var attributes=require('./teamVoicePrefix.attributes');module[_0x29c0('0x5')]=function(_0x4bc5cf,_0x2fb607){return _0x4bc5cf[_0x29c0('0x6')](_0x29c0('0x7'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 5eebeb0..602b430 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2979d3,_0x54ff61){var _0x2a9a36=function(_0x215f64){while(--_0x215f64){_0x2979d3['push'](_0x2979d3['shift']());}};_0x2a9a36(++_0x54ff61);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x34e568,_0x4e6ce5){var _0x17784e=function(_0xd3e767){while(--_0xd3e767){_0x34e568['push'](_0x34e568['shift']());}};_0x17784e(++_0x4e6ce5);}(_0xe706,0xa3));var _0x6e70=function(_0x347379,_0x37de29){_0x347379=_0x347379-0x0;var _0x1e6dbf=_0xe706[_0x347379];return _0x1e6dbf;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 1c2a55b..6c026ec 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 _0x8a90=['sequelize','exports','INTEGER'];(function(_0x313d6f,_0x122c8d){var _0x2059ac=function(_0x49c551){while(--_0x49c551){_0x313d6f['push'](_0x313d6f['shift']());}};_0x2059ac(++_0x122c8d);}(_0x8a90,0x138));var _0x08a9=function(_0x4349cd,_0xc9bf81){_0x4349cd=_0x4349cd-0x0;var _0x3df0ef=_0x8a90[_0x4349cd];return _0x3df0ef;};'use strict';var Sequelize=require(_0x08a9('0x0'));module[_0x08a9('0x1')]={'penalty':{'type':Sequelize[_0x08a9('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x770c=['exports'];(function(_0x2d7c96,_0x284db3){var _0x256697=function(_0x15a083){while(--_0x15a083){_0x2d7c96['push'](_0x2d7c96['shift']());}};_0x256697(++_0x284db3);}(_0x770c,0x7f));var _0xc770=function(_0x41cfd4,_0x1ed2cc){_0x41cfd4=_0x41cfd4-0x0;var _0x190f48=_0x770c[_0x41cfd4];return _0x190f48;};'use strict';var Sequelize=require('sequelize');module[_0xc770('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index a328b10..9be54a5 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 _0xa049=['path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xa049,0x1db));var _0x9a04=function(_0xb68772,_0x5253ac){_0xb68772=_0xb68772-0x0;var _0x4189bb=_0xa049[_0xb68772];return _0x4189bb;};'use strict';var _=require(_0x9a04('0x0'));var util=require(_0x9a04('0x1'));var logger=require('../../config/logger')(_0x9a04('0x2'));var moment=require(_0x9a04('0x3'));var BPromise=require(_0x9a04('0x4'));var rp=require(_0x9a04('0x5'));var fs=require('fs');var path=require(_0x9a04('0x6'));var rimraf=require(_0x9a04('0x7'));var config=require(_0x9a04('0x8'));var attributes=require(_0x9a04('0x9'));module[_0x9a04('0xa')]=function(_0x570be2,_0x3cacca){return _0x570be2[_0x9a04('0xb')]('TeamVoiceQueue',attributes,{'tableName':_0x9a04('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8eb=['bluebird','request-promise','rimraf','../../config/environment','exports','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','moment'];(function(_0x103dbb,_0x3093c4){var _0x4b8ae9=function(_0xfb2bb2){while(--_0xfb2bb2){_0x103dbb['push'](_0x103dbb['shift']());}};_0x4b8ae9(++_0x3093c4);}(_0xa8eb,0x179));var _0xba8e=function(_0xe183da,_0x26b480){_0xe183da=_0xe183da-0x0;var _0x14f5f2=_0xa8eb[_0xe183da];return _0x14f5f2;};'use strict';var _=require(_0xba8e('0x0'));var util=require('util');var logger=require(_0xba8e('0x1'))('api');var moment=require(_0xba8e('0x2'));var BPromise=require(_0xba8e('0x3'));var rp=require(_0xba8e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba8e('0x5'));var config=require(_0xba8e('0x6'));var attributes=require('./teamVoiceQueue.attributes');module[_0xba8e('0x7')]=function(_0x57e345,_0x14c3ac){return _0x57e345['define'](_0xba8e('0x8'),attributes,{'tableName':_0xba8e('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 25481e8..a687393 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 _0x98d5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x2a219a,_0x5ed797){var _0x471b5b=function(_0x5623fd){while(--_0x5623fd){_0x2a219a['push'](_0x2a219a['shift']());}};_0x471b5b(++_0x5ed797);}(_0x98d5,0xfb));var _0x598d=function(_0x39dd73,_0x5c0b2b){_0x39dd73=_0x39dd73-0x0;var _0x1a9540=_0x98d5[_0x39dd73];return _0x1a9540;};'use strict';var _=require(_0x598d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x598d('0x1'));var rs=require(_0x598d('0x2'));var fs=require('fs');var Redis=require(_0x598d('0x3'));var db=require(_0x598d('0x4'))['db'];var utils=require(_0x598d('0x5'));var logger=require(_0x598d('0x6'))(_0x598d('0x7'));var config=require(_0x598d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x598d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x286d2a,_0x507285,_0x4de6f3){return new BPromise(function(_0x26d1cb,_0x2fa217){return client['request'](_0x286d2a,_0x4de6f3)[_0x598d('0xa')](function(_0x27653b){logger[_0x598d('0xb')](_0x598d('0xc'),_0x507285,_0x598d('0xd'));logger[_0x598d('0xe')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x507285,'request\x20sent',JSON[_0x598d('0xf')](_0x27653b));if(_0x27653b[_0x598d('0x10')]){if(_0x27653b[_0x598d('0x10')][_0x598d('0x11')]===0x1f4){logger[_0x598d('0x10')](_0x598d('0xc'),_0x507285,_0x27653b[_0x598d('0x10')][_0x598d('0x12')]);return _0x2fa217(_0x27653b[_0x598d('0x10')][_0x598d('0x12')]);}logger[_0x598d('0x10')](_0x598d('0xc'),_0x507285,_0x27653b['error'][_0x598d('0x12')]);return _0x26d1cb(_0x27653b['error'][_0x598d('0x12')]);}else{logger[_0x598d('0xb')](_0x598d('0xc'),_0x507285,_0x598d('0xd'));_0x26d1cb(_0x27653b[_0x598d('0x13')]['message']);}})[_0x598d('0x14')](function(_0x18cbd2){logger['error'](_0x598d('0xc'),_0x507285,_0x18cbd2);_0x2fa217(_0x18cbd2);});});} \ No newline at end of file +var _0x6a55=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','TeamVoiceQueue,\x20%s,\x20%s','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x45346d,_0xffd56b){var _0x5ce7ca=function(_0x27ce87){while(--_0x27ce87){_0x45346d['push'](_0x45346d['shift']());}};_0x5ce7ca(++_0xffd56b);}(_0x6a55,0x154));var _0x56a5=function(_0x2e030a,_0x8e4c48){_0x2e030a=_0x2e030a-0x0;var _0x597df6=_0x6a55[_0x2e030a];return _0x597df6;};'use strict';var _=require(_0x56a5('0x0'));var util=require('util');var moment=require(_0x56a5('0x1'));var BPromise=require(_0x56a5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56a5('0x3'));var db=require(_0x56a5('0x4'))['db'];var utils=require(_0x56a5('0x5'));var logger=require(_0x56a5('0x6'))(_0x56a5('0x7'));var config=require(_0x56a5('0x8'));var jayson=require(_0x56a5('0x9'));var client=jayson[_0x56a5('0xa')][_0x56a5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x454c49,_0x32025d,_0x460908){return new BPromise(function(_0x163899,_0x27d701){return client['request'](_0x454c49,_0x460908)[_0x56a5('0xc')](function(_0x4600a2){logger['info'](_0x56a5('0xd'),_0x32025d,'request\x20sent');logger['debug'](_0x56a5('0xe'),_0x32025d,_0x56a5('0xf'),JSON[_0x56a5('0x10')](_0x4600a2));if(_0x4600a2[_0x56a5('0x11')]){if(_0x4600a2[_0x56a5('0x11')][_0x56a5('0x12')]===0x1f4){logger[_0x56a5('0x11')](_0x56a5('0xd'),_0x32025d,_0x4600a2[_0x56a5('0x11')]['message']);return _0x27d701(_0x4600a2[_0x56a5('0x11')][_0x56a5('0x13')]);}logger['error'](_0x56a5('0xd'),_0x32025d,_0x4600a2[_0x56a5('0x11')][_0x56a5('0x13')]);return _0x163899(_0x4600a2[_0x56a5('0x11')]['message']);}else{logger[_0x56a5('0x14')](_0x56a5('0xd'),_0x32025d,_0x56a5('0xf'));_0x163899(_0x4600a2[_0x56a5('0x15')][_0x56a5('0x13')]);}})[_0x56a5('0x16')](function(_0x1d6a04){logger[_0x56a5('0x11')](_0x56a5('0xd'),_0x32025d,_0x1d6a04);_0x27d701(_0x1d6a04);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 98d8d92..ae54f59 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 _0xd7d1=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x131fe7,_0x21fcdb){var _0x2eddf3=function(_0x1be350){while(--_0x1be350){_0x131fe7['push'](_0x131fe7['shift']());}};_0x2eddf3(++_0x21fcdb);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x2a28a9,_0x1e0365){_0x2a28a9=_0x2a28a9-0x0;var _0x5c43dd=_0xd7d1[_0x2a28a9];return _0x5c43dd;};'use strict';var multer=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var path=require(_0x1d7d('0x2'));var timeout=require(_0x1d7d('0x3'));var express=require(_0x1d7d('0x4'));var router=express[_0x1d7d('0x5')]();var fs_extra=require(_0x1d7d('0x6'));var auth=require(_0x1d7d('0x7'));var interaction=require(_0x1d7d('0x8'));var config=require(_0x1d7d('0x9'));var controller=require(_0x1d7d('0xa'));router[_0x1d7d('0xb')]('/',auth[_0x1d7d('0xc')](),controller['index']);router[_0x1d7d('0xb')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0xe')]);router[_0x1d7d('0xf')]('/',auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x10')]);router[_0x1d7d('0x11')](_0x1d7d('0xd'),auth[_0x1d7d('0xc')](),controller[_0x1d7d('0x12')]);router['delete'](_0x1d7d('0xd'),auth['isAuthenticated'](),controller[_0x1d7d('0x13')]);module[_0x1d7d('0x14')]=router; \ No newline at end of file +var _0x0c19=['isAuthenticated','/:id','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x472362,_0x5bf95d){var _0x5ae4d6=function(_0x3368f9){while(--_0x3368f9){_0x472362['push'](_0x472362['shift']());}};_0x5ae4d6(++_0x5bf95d);}(_0x0c19,0xf5));var _0x90c1=function(_0x17b774,_0x5f5893){_0x17b774=_0x17b774-0x0;var _0xf0b272=_0x0c19[_0x17b774];return _0xf0b272;};'use strict';var multer=require(_0x90c1('0x0'));var util=require(_0x90c1('0x1'));var path=require(_0x90c1('0x2'));var timeout=require(_0x90c1('0x3'));var express=require(_0x90c1('0x4'));var router=express[_0x90c1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x90c1('0x6'));var interaction=require(_0x90c1('0x7'));var config=require(_0x90c1('0x8'));var controller=require('./template.controller');router[_0x90c1('0x9')]('/',auth[_0x90c1('0xa')](),controller['index']);router[_0x90c1('0x9')](_0x90c1('0xb'),auth[_0x90c1('0xa')](),controller[_0x90c1('0xc')]);router[_0x90c1('0xd')]('/',auth[_0x90c1('0xa')](),controller[_0x90c1('0xe')]);router['put'](_0x90c1('0xb'),auth[_0x90c1('0xa')](),controller['update']);router[_0x90c1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x90c1('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 72e22f6..b773527 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 _0x4f2b=['sequelize','STRING'];(function(_0x2211ed,_0x1bca0b){var _0x4d78cc=function(_0x467b59){while(--_0x467b59){_0x2211ed['push'](_0x2211ed['shift']());}};_0x4d78cc(++_0x1bca0b);}(_0x4f2b,0x19e));var _0xb4f2=function(_0x289014,_0x2068b3){_0x289014=_0x289014-0x0;var _0x5ed9f4=_0x4f2b[_0x289014];return _0x5ed9f4;};'use strict';var Sequelize=require(_0xb4f2('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb4f2('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xc4dc=['STRING','exports'];(function(_0x3457a1,_0x4b1008){var _0x344f22=function(_0x107689){while(--_0x107689){_0x3457a1['push'](_0x3457a1['shift']());}};_0x344f22(++_0x4b1008);}(_0xc4dc,0x1cd));var _0xcc4d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xc4dc[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0xcc4d('0x0')]={'name':{'type':Sequelize[_0xcc4d('0x1')]},'description':{'type':Sequelize[_0xcc4d('0x1')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index e02e445..bf7d8b7 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 _0xefc2=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','Templates','UserProfileResource','sendStatus','error','stack','name','send','index','Template','rawAttributes','fieldName','type','key','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1fcd5c,_0x14052d){var _0x28c845=function(_0x3416eb){while(--_0x3416eb){_0x1fcd5c['push'](_0x1fcd5c['shift']());}};_0x28c845(++_0x14052d);}(_0xefc2,0xa2));var _0x2efc=function(_0x5322fe,_0x3a7102){_0x5322fe=_0x5322fe-0x0;var _0x5d3dba=_0xefc2[_0x5322fe];return _0x5d3dba;};'use strict';var emlformat=require(_0x2efc('0x0'));var rimraf=require(_0x2efc('0x1'));var zipdir=require(_0x2efc('0x2'));var jsonpatch=require(_0x2efc('0x3'));var rp=require(_0x2efc('0x4'));var moment=require(_0x2efc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2efc('0x6'));var util=require(_0x2efc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2efc('0x8'));var ejs=require(_0x2efc('0x9'));var fs=require('fs');var fs_extra=require(_0x2efc('0xa'));var _=require(_0x2efc('0xb'));var squel=require(_0x2efc('0xc'));var crypto=require(_0x2efc('0xd'));var jsforce=require(_0x2efc('0xe'));var deskjs=require(_0x2efc('0xf'));var toCsv=require(_0x2efc('0x8'));var querystring=require(_0x2efc('0x10'));var Papa=require(_0x2efc('0x11'));var Redis=require(_0x2efc('0x12'));var authService=require(_0x2efc('0x13'));var qs=require(_0x2efc('0x14'));var as=require(_0x2efc('0x15'));var hardwareService=require(_0x2efc('0x16'));var logger=require(_0x2efc('0x17'))(_0x2efc('0x18'));var utils=require(_0x2efc('0x19'));var config=require(_0x2efc('0x1a'));var licenseUtil=require(_0x2efc('0x1b'));var db=require(_0x2efc('0x1c'))['db'];function respondWithStatusCode(_0x6bdf93,_0x132df7){_0x132df7=_0x132df7||0xcc;return function(_0x1191e0){if(_0x1191e0){return _0x6bdf93['sendStatus'](_0x132df7);}return _0x6bdf93[_0x2efc('0x1d')](_0x132df7)[_0x2efc('0x1e')]();};}function respondWithResult(_0xebbf4e,_0x3c572c){_0x3c572c=_0x3c572c||0xc8;return function(_0x586f59){if(_0x586f59){return _0xebbf4e[_0x2efc('0x1d')](_0x3c572c)['json'](_0x586f59);}};}function respondWithFilteredResult(_0x3c9def,_0x53de0a){return function(_0x140b50){if(_0x140b50){var _0x5a93cd=typeof _0x53de0a[_0x2efc('0x1f')]===_0x2efc('0x20')&&typeof _0x53de0a[_0x2efc('0x21')]===_0x2efc('0x20');var _0x3e7820=_0x140b50[_0x2efc('0x22')];var _0x4ca2dc=_0x5a93cd?0x0:_0x53de0a[_0x2efc('0x1f')];var _0xa359aa=_0x5a93cd?_0x140b50['count']:_0x53de0a['offset']+_0x53de0a['limit'];var _0xc2cd52;if(_0xa359aa>=_0x3e7820){_0xa359aa=_0x3e7820;_0xc2cd52=0xc8;}else{_0xc2cd52=0xce;}_0x3c9def[_0x2efc('0x1d')](_0xc2cd52);return _0x3c9def[_0x2efc('0x23')](_0x2efc('0x24'),_0x4ca2dc+'-'+_0xa359aa+'/'+_0x3e7820)['json'](_0x140b50);}return null;};}function patchUpdates(_0x5b26b8){return function(_0x8c76b){try{jsonpatch[_0x2efc('0x25')](_0x8c76b,_0x5b26b8,!![]);}catch(_0x294e6a){return BPromise['reject'](_0x294e6a);}return _0x8c76b[_0x2efc('0x26')]();};}function saveUpdates(_0x1509db,_0x1f770a){return function(_0x18a89b){if(_0x18a89b){return _0x18a89b[_0x2efc('0x27')](_0x1509db)[_0x2efc('0x28')](function(_0x5a6590){return _0x5a6590;});}return null;};}function removeEntity(_0x3ad13e,_0x17c8c6){return function(_0x457737){if(_0x457737){return _0x457737[_0x2efc('0x29')]()[_0x2efc('0x28')](function(){var _0x187dfe=_0x457737[_0x2efc('0x2a')]({'plain':!![]});var _0x49f6ec=_0x2efc('0x2b');return db[_0x2efc('0x2c')][_0x2efc('0x29')]({'where':{'type':_0x49f6ec,'resourceId':_0x187dfe['id']}})[_0x2efc('0x28')](function(){return _0x457737;});})[_0x2efc('0x28')](function(){_0x3ad13e['status'](0xcc)[_0x2efc('0x1e')]();});}};}function handleEntityNotFound(_0x54883a,_0x5ea36b){return function(_0x9134cd){if(!_0x9134cd){_0x54883a[_0x2efc('0x2d')](0x194);}return _0x9134cd;};}function handleError(_0x7cc206,_0x1ae972){_0x1ae972=_0x1ae972||0x1f4;return function(_0x3108a1){logger[_0x2efc('0x2e')](_0x3108a1[_0x2efc('0x2f')]);if(_0x3108a1['name']){delete _0x3108a1[_0x2efc('0x30')];}_0x7cc206['status'](_0x1ae972)[_0x2efc('0x31')](_0x3108a1);};}exports[_0x2efc('0x32')]=function(_0x77e212,_0x43a2ae){var _0x2eb947={},_0x472c3a={},_0x50a4ff={'count':0x0,'rows':[]};var _0x9e0702=_['map'](db[_0x2efc('0x33')][_0x2efc('0x34')],function(_0x36e49f){return{'name':_0x36e49f[_0x2efc('0x35')],'type':_0x36e49f[_0x2efc('0x36')][_0x2efc('0x37')]};});_0x472c3a['model']=_[_0x2efc('0x38')](_0x9e0702,_0x2efc('0x30'));_0x472c3a[_0x2efc('0x39')]=_['keys'](_0x77e212['query']);_0x472c3a[_0x2efc('0x3a')]=_['intersection'](_0x472c3a[_0x2efc('0x3b')],_0x472c3a[_0x2efc('0x39')]);_0x2eb947[_0x2efc('0x3c')]=_[_0x2efc('0x3d')](_0x472c3a['model'],qs['fields'](_0x77e212[_0x2efc('0x39')][_0x2efc('0x3e')]));_0x2eb947[_0x2efc('0x3c')]=_0x2eb947[_0x2efc('0x3c')][_0x2efc('0x3f')]?_0x2eb947[_0x2efc('0x3c')]:_0x472c3a[_0x2efc('0x3b')];if(!_0x77e212[_0x2efc('0x39')][_0x2efc('0x40')](_0x2efc('0x41'))){_0x2eb947[_0x2efc('0x21')]=qs[_0x2efc('0x21')](_0x77e212[_0x2efc('0x39')][_0x2efc('0x21')]);_0x2eb947['offset']=qs[_0x2efc('0x1f')](_0x77e212[_0x2efc('0x39')][_0x2efc('0x1f')]);}_0x2eb947[_0x2efc('0x42')]=qs[_0x2efc('0x43')](_0x77e212[_0x2efc('0x39')]['sort']);_0x2eb947[_0x2efc('0x44')]=qs[_0x2efc('0x3a')](_[_0x2efc('0x45')](_0x77e212[_0x2efc('0x39')],_0x472c3a[_0x2efc('0x3a')]),_0x9e0702);if(_0x77e212[_0x2efc('0x39')][_0x2efc('0x46')]){_0x2eb947[_0x2efc('0x44')]=_[_0x2efc('0x47')](_0x2eb947[_0x2efc('0x44')],{'$or':_[_0x2efc('0x38')](_0x9e0702,function(_0x3fa9a5){if(_0x3fa9a5['type']!==_0x2efc('0x48')){var _0x1aebf3={};_0x1aebf3[_0x3fa9a5[_0x2efc('0x30')]]={'$like':'%'+_0x77e212[_0x2efc('0x39')][_0x2efc('0x46')]+'%'};return _0x1aebf3;}})});}_0x2eb947=_[_0x2efc('0x47')]({},_0x2eb947,_0x77e212[_0x2efc('0x49')]);var _0x8539c3={'where':_0x2eb947[_0x2efc('0x44')]};return db[_0x2efc('0x33')][_0x2efc('0x22')](_0x8539c3)[_0x2efc('0x28')](function(_0x4cf9ad){_0x50a4ff[_0x2efc('0x22')]=_0x4cf9ad;if(_0x77e212[_0x2efc('0x39')][_0x2efc('0x4a')]){_0x2eb947['include']=[{'all':!![]}];}return db[_0x2efc('0x33')][_0x2efc('0x4b')](_0x2eb947);})[_0x2efc('0x28')](function(_0x546e67){_0x50a4ff[_0x2efc('0x4c')]=_0x546e67;return _0x50a4ff;})[_0x2efc('0x28')](respondWithFilteredResult(_0x43a2ae,_0x2eb947))[_0x2efc('0x4d')](handleError(_0x43a2ae,null));};exports[_0x2efc('0x4e')]=function(_0x333636,_0x17e77e){var _0x29ac2d={'raw':!![],'where':{'id':_0x333636['params']['id']}},_0x102851={};_0x102851[_0x2efc('0x3b')]=_[_0x2efc('0x4f')](db[_0x2efc('0x33')][_0x2efc('0x34')]);_0x102851[_0x2efc('0x39')]=_['keys'](_0x333636[_0x2efc('0x39')]);_0x102851[_0x2efc('0x3a')]=_[_0x2efc('0x3d')](_0x102851['model'],_0x102851['query']);_0x29ac2d[_0x2efc('0x3c')]=_['intersection'](_0x102851[_0x2efc('0x3b')],qs['fields'](_0x333636['query']['fields']));_0x29ac2d[_0x2efc('0x3c')]=_0x29ac2d['attributes'][_0x2efc('0x3f')]?_0x29ac2d[_0x2efc('0x3c')]:_0x102851['model'];if(_0x333636[_0x2efc('0x39')][_0x2efc('0x4a')]){_0x29ac2d[_0x2efc('0x50')]=[{'all':!![]}];}_0x29ac2d=_[_0x2efc('0x47')]({},_0x29ac2d,_0x333636[_0x2efc('0x49')]);return db['Template'][_0x2efc('0x51')](_0x29ac2d)['then'](handleEntityNotFound(_0x17e77e,null))[_0x2efc('0x28')](respondWithResult(_0x17e77e,null))[_0x2efc('0x4d')](handleError(_0x17e77e,null));};exports['create']=function(_0x4534bc,_0x262dd9){return db[_0x2efc('0x33')][_0x2efc('0x52')](_0x4534bc['body'],{})['then'](function(_0x10fda6){var _0x5bdfb3=_0x4534bc['user']['get']({'plain':!![]});if(!_0x5bdfb3)throw new Error(_0x2efc('0x53'));if(_0x5bdfb3[_0x2efc('0x54')]===_0x2efc('0x55')){var _0x548d7f=_0x10fda6[_0x2efc('0x2a')]({'plain':!![]});var _0x504a23=_0x2efc('0x2b');return db[_0x2efc('0x56')][_0x2efc('0x51')]({'where':{'name':_0x504a23,'userProfileId':_0x5bdfb3[_0x2efc('0x57')]},'raw':!![]})['then'](function(_0x3c0516){if(_0x3c0516&&_0x3c0516[_0x2efc('0x58')]===0x0){return db[_0x2efc('0x2c')][_0x2efc('0x52')]({'name':_0x548d7f[_0x2efc('0x30')],'resourceId':_0x548d7f['id'],'type':_0x3c0516[_0x2efc('0x30')],'sectionId':_0x3c0516['id']},{})[_0x2efc('0x28')](function(){return _0x10fda6;});}else{return _0x10fda6;}})['catch'](function(_0x2f91a2){logger[_0x2efc('0x2e')](_0x2efc('0x59'),_0x2f91a2);throw _0x2f91a2;});}return _0x10fda6;})[_0x2efc('0x28')](respondWithResult(_0x262dd9,0xc9))['catch'](handleError(_0x262dd9,null));};exports['update']=function(_0x1be273,_0x3477ae){if(_0x1be273[_0x2efc('0x5a')]['id']){delete _0x1be273['body']['id'];}return db[_0x2efc('0x33')]['find']({'where':{'id':_0x1be273['params']['id']}})[_0x2efc('0x28')](handleEntityNotFound(_0x3477ae,null))[_0x2efc('0x28')](saveUpdates(_0x1be273['body'],null))[_0x2efc('0x28')](respondWithResult(_0x3477ae,null))[_0x2efc('0x4d')](handleError(_0x3477ae,null));};exports[_0x2efc('0x29')]=function(_0x2d3fc5,_0x318567){return db[_0x2efc('0x33')][_0x2efc('0x51')]({'where':{'id':_0x2d3fc5[_0x2efc('0x5b')]['id']}})[_0x2efc('0x28')](handleEntityNotFound(_0x318567,null))[_0x2efc('0x28')](removeEntity(_0x318567,null))['catch'](handleError(_0x318567,null));}; \ No newline at end of file +var _0xbe2d=['merge','options','Template','includeAll','include','findAll','rows','catch','show','params','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','save','update','destroy','then','UserProfileResource','sendStatus','stack','index','rawAttributes','fieldName','type','map','name','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','where','filter'];(function(_0x4f0606,_0x2df7a4){var _0x449366=function(_0x153d83){while(--_0x153d83){_0x4f0606['push'](_0x4f0606['shift']());}};_0x449366(++_0x2df7a4);}(_0xbe2d,0x166));var _0xdbe2=function(_0x89788b,_0x1bdb6a){_0x89788b=_0x89788b-0x0;var _0x1f2fa5=_0xbe2d[_0x89788b];return _0x1f2fa5;};'use strict';var emlformat=require(_0xdbe2('0x0'));var rimraf=require(_0xdbe2('0x1'));var zipdir=require(_0xdbe2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbe2('0x3'));var moment=require(_0xdbe2('0x4'));var BPromise=require(_0xdbe2('0x5'));var Mustache=require(_0xdbe2('0x6'));var util=require('util');var path=require(_0xdbe2('0x7'));var sox=require('sox');var csv=require(_0xdbe2('0x8'));var ejs=require(_0xdbe2('0x9'));var fs=require('fs');var fs_extra=require(_0xdbe2('0xa'));var _=require('lodash');var squel=require(_0xdbe2('0xb'));var crypto=require(_0xdbe2('0xc'));var jsforce=require(_0xdbe2('0xd'));var deskjs=require(_0xdbe2('0xe'));var toCsv=require(_0xdbe2('0x8'));var querystring=require(_0xdbe2('0xf'));var Papa=require(_0xdbe2('0x10'));var Redis=require(_0xdbe2('0x11'));var authService=require(_0xdbe2('0x12'));var qs=require(_0xdbe2('0x13'));var as=require(_0xdbe2('0x14'));var hardwareService=require(_0xdbe2('0x15'));var logger=require(_0xdbe2('0x16'))(_0xdbe2('0x17'));var utils=require(_0xdbe2('0x18'));var config=require(_0xdbe2('0x19'));var licenseUtil=require(_0xdbe2('0x1a'));var db=require(_0xdbe2('0x1b'))['db'];function respondWithStatusCode(_0x4b19f6,_0x4cb28d){_0x4cb28d=_0x4cb28d||0xcc;return function(_0x255482){if(_0x255482){return _0x4b19f6['sendStatus'](_0x4cb28d);}return _0x4b19f6[_0xdbe2('0x1c')](_0x4cb28d)[_0xdbe2('0x1d')]();};}function respondWithResult(_0x53e877,_0x2dad6d){_0x2dad6d=_0x2dad6d||0xc8;return function(_0x573a68){if(_0x573a68){return _0x53e877['status'](_0x2dad6d)[_0xdbe2('0x1e')](_0x573a68);}};}function respondWithFilteredResult(_0x59f159,_0x310400){return function(_0x48cf3b){if(_0x48cf3b){var _0x1fdd18=typeof _0x310400[_0xdbe2('0x1f')]===_0xdbe2('0x20')&&typeof _0x310400[_0xdbe2('0x21')]===_0xdbe2('0x20');var _0x27a76c=_0x48cf3b['count'];var _0x55a8ef=_0x1fdd18?0x0:_0x310400[_0xdbe2('0x1f')];var _0x4f27f7=_0x1fdd18?_0x48cf3b[_0xdbe2('0x22')]:_0x310400[_0xdbe2('0x1f')]+_0x310400['limit'];var _0x86cded;if(_0x4f27f7>=_0x27a76c){_0x4f27f7=_0x27a76c;_0x86cded=0xc8;}else{_0x86cded=0xce;}_0x59f159[_0xdbe2('0x1c')](_0x86cded);return _0x59f159['set']('Content-Range',_0x55a8ef+'-'+_0x4f27f7+'/'+_0x27a76c)['json'](_0x48cf3b);}return null;};}function patchUpdates(_0x303df5){return function(_0x131396){try{jsonpatch['apply'](_0x131396,_0x303df5,!![]);}catch(_0x5bc642){return BPromise['reject'](_0x5bc642);}return _0x131396[_0xdbe2('0x23')]();};}function saveUpdates(_0x300a33,_0x1b3b2a){return function(_0x1bed6a){if(_0x1bed6a){return _0x1bed6a[_0xdbe2('0x24')](_0x300a33)['then'](function(_0x51d3ca){return _0x51d3ca;});}return null;};}function removeEntity(_0x454ff5,_0x47843d){return function(_0x192b13){if(_0x192b13){return _0x192b13[_0xdbe2('0x25')]()[_0xdbe2('0x26')](function(){var _0x5135bd=_0x192b13['get']({'plain':!![]});var _0x530f97='Templates';return db[_0xdbe2('0x27')][_0xdbe2('0x25')]({'where':{'type':_0x530f97,'resourceId':_0x5135bd['id']}})[_0xdbe2('0x26')](function(){return _0x192b13;});})[_0xdbe2('0x26')](function(){_0x454ff5[_0xdbe2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f0233,_0x5bf408){return function(_0x5f2018){if(!_0x5f2018){_0x3f0233[_0xdbe2('0x28')](0x194);}return _0x5f2018;};}function handleError(_0x559757,_0x483036){_0x483036=_0x483036||0x1f4;return function(_0x318e04){logger['error'](_0x318e04[_0xdbe2('0x29')]);if(_0x318e04['name']){delete _0x318e04['name'];}_0x559757['status'](_0x483036)['send'](_0x318e04);};}exports[_0xdbe2('0x2a')]=function(_0x5607c0,_0x29dade){var _0x1299ce={},_0x4d9eb9={},_0x44fa21={'count':0x0,'rows':[]};var _0x4c27d3=_['map'](db['Template'][_0xdbe2('0x2b')],function(_0x5eb66d){return{'name':_0x5eb66d[_0xdbe2('0x2c')],'type':_0x5eb66d[_0xdbe2('0x2d')]['key']};});_0x4d9eb9['model']=_[_0xdbe2('0x2e')](_0x4c27d3,_0xdbe2('0x2f'));_0x4d9eb9[_0xdbe2('0x30')]=_[_0xdbe2('0x31')](_0x5607c0[_0xdbe2('0x30')]);_0x4d9eb9[_0xdbe2('0x32')]=_[_0xdbe2('0x33')](_0x4d9eb9[_0xdbe2('0x34')],_0x4d9eb9[_0xdbe2('0x30')]);_0x1299ce['attributes']=_['intersection'](_0x4d9eb9[_0xdbe2('0x34')],qs[_0xdbe2('0x35')](_0x5607c0[_0xdbe2('0x30')][_0xdbe2('0x35')]));_0x1299ce['attributes']=_0x1299ce[_0xdbe2('0x36')][_0xdbe2('0x37')]?_0x1299ce[_0xdbe2('0x36')]:_0x4d9eb9[_0xdbe2('0x34')];if(!_0x5607c0[_0xdbe2('0x30')]['hasOwnProperty'](_0xdbe2('0x38'))){_0x1299ce[_0xdbe2('0x21')]=qs[_0xdbe2('0x21')](_0x5607c0[_0xdbe2('0x30')][_0xdbe2('0x21')]);_0x1299ce[_0xdbe2('0x1f')]=qs[_0xdbe2('0x1f')](_0x5607c0[_0xdbe2('0x30')][_0xdbe2('0x1f')]);}_0x1299ce[_0xdbe2('0x39')]=qs[_0xdbe2('0x3a')](_0x5607c0[_0xdbe2('0x30')][_0xdbe2('0x3a')]);_0x1299ce['where']=qs[_0xdbe2('0x32')](_[_0xdbe2('0x3b')](_0x5607c0[_0xdbe2('0x30')],_0x4d9eb9[_0xdbe2('0x32')]),_0x4c27d3);if(_0x5607c0[_0xdbe2('0x30')]['filter']){_0x1299ce[_0xdbe2('0x3c')]=_['merge'](_0x1299ce['where'],{'$or':_[_0xdbe2('0x2e')](_0x4c27d3,function(_0x3a81c7){if(_0x3a81c7[_0xdbe2('0x2d')]!=='VIRTUAL'){var _0x225e63={};_0x225e63[_0x3a81c7[_0xdbe2('0x2f')]]={'$like':'%'+_0x5607c0['query'][_0xdbe2('0x3d')]+'%'};return _0x225e63;}})});}_0x1299ce=_[_0xdbe2('0x3e')]({},_0x1299ce,_0x5607c0[_0xdbe2('0x3f')]);var _0x1d8ed6={'where':_0x1299ce[_0xdbe2('0x3c')]};return db[_0xdbe2('0x40')]['count'](_0x1d8ed6)['then'](function(_0x327107){_0x44fa21['count']=_0x327107;if(_0x5607c0[_0xdbe2('0x30')][_0xdbe2('0x41')]){_0x1299ce[_0xdbe2('0x42')]=[{'all':!![]}];}return db[_0xdbe2('0x40')][_0xdbe2('0x43')](_0x1299ce);})[_0xdbe2('0x26')](function(_0x42db6b){_0x44fa21[_0xdbe2('0x44')]=_0x42db6b;return _0x44fa21;})[_0xdbe2('0x26')](respondWithFilteredResult(_0x29dade,_0x1299ce))[_0xdbe2('0x45')](handleError(_0x29dade,null));};exports[_0xdbe2('0x46')]=function(_0xc548df,_0x25478e){var _0x5d70d4={'raw':!![],'where':{'id':_0xc548df[_0xdbe2('0x47')]['id']}},_0x274d0c={};_0x274d0c[_0xdbe2('0x34')]=_[_0xdbe2('0x31')](db[_0xdbe2('0x40')]['rawAttributes']);_0x274d0c[_0xdbe2('0x30')]=_[_0xdbe2('0x31')](_0xc548df['query']);_0x274d0c[_0xdbe2('0x32')]=_['intersection'](_0x274d0c[_0xdbe2('0x34')],_0x274d0c[_0xdbe2('0x30')]);_0x5d70d4[_0xdbe2('0x36')]=_[_0xdbe2('0x33')](_0x274d0c[_0xdbe2('0x34')],qs[_0xdbe2('0x35')](_0xc548df['query'][_0xdbe2('0x35')]));_0x5d70d4[_0xdbe2('0x36')]=_0x5d70d4[_0xdbe2('0x36')][_0xdbe2('0x37')]?_0x5d70d4[_0xdbe2('0x36')]:_0x274d0c['model'];if(_0xc548df['query'][_0xdbe2('0x41')]){_0x5d70d4[_0xdbe2('0x42')]=[{'all':!![]}];}_0x5d70d4=_['merge']({},_0x5d70d4,_0xc548df[_0xdbe2('0x3f')]);return db['Template'][_0xdbe2('0x48')](_0x5d70d4)[_0xdbe2('0x26')](handleEntityNotFound(_0x25478e,null))[_0xdbe2('0x26')](respondWithResult(_0x25478e,null))[_0xdbe2('0x45')](handleError(_0x25478e,null));};exports[_0xdbe2('0x49')]=function(_0xdddede,_0x2dde61){return db[_0xdbe2('0x40')]['create'](_0xdddede['body'],{})[_0xdbe2('0x26')](function(_0x47df84){var _0x420f51=_0xdddede[_0xdbe2('0x4a')][_0xdbe2('0x4b')]({'plain':!![]});if(!_0x420f51)throw new Error(_0xdbe2('0x4c'));if(_0x420f51[_0xdbe2('0x4d')]===_0xdbe2('0x4a')){var _0x474a54=_0x47df84['get']({'plain':!![]});var _0x49e737=_0xdbe2('0x4e');return db['UserProfileSection'][_0xdbe2('0x48')]({'where':{'name':_0x49e737,'userProfileId':_0x420f51[_0xdbe2('0x4f')]},'raw':!![]})[_0xdbe2('0x26')](function(_0x310efa){if(_0x310efa&&_0x310efa[_0xdbe2('0x50')]===0x0){return db[_0xdbe2('0x27')][_0xdbe2('0x49')]({'name':_0x474a54['name'],'resourceId':_0x474a54['id'],'type':_0x310efa[_0xdbe2('0x2f')],'sectionId':_0x310efa['id']},{})[_0xdbe2('0x26')](function(){return _0x47df84;});}else{return _0x47df84;}})['catch'](function(_0x3a9204){logger[_0xdbe2('0x51')](_0xdbe2('0x52'),_0x3a9204);throw _0x3a9204;});}return _0x47df84;})[_0xdbe2('0x26')](respondWithResult(_0x2dde61,0xc9))[_0xdbe2('0x45')](handleError(_0x2dde61,null));};exports[_0xdbe2('0x24')]=function(_0x2c44bc,_0x3b5cb4){if(_0x2c44bc['body']['id']){delete _0x2c44bc['body']['id'];}return db[_0xdbe2('0x40')]['find']({'where':{'id':_0x2c44bc['params']['id']}})[_0xdbe2('0x26')](handleEntityNotFound(_0x3b5cb4,null))[_0xdbe2('0x26')](saveUpdates(_0x2c44bc[_0xdbe2('0x53')],null))['then'](respondWithResult(_0x3b5cb4,null))['catch'](handleError(_0x3b5cb4,null));};exports[_0xdbe2('0x25')]=function(_0x3a61fa,_0x236b4f){return db[_0xdbe2('0x40')]['find']({'where':{'id':_0x3a61fa['params']['id']}})[_0xdbe2('0x26')](handleEntityNotFound(_0x236b4f,null))[_0xdbe2('0x26')](removeEntity(_0x236b4f,null))[_0xdbe2('0x45')](handleError(_0x236b4f,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 6d7775f..fad4627 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 _0xc397=['util','../../config/logger','api','request-promise','path','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash'];(function(_0x27371f,_0x469ecb){var _0x464729=function(_0x2137d5){while(--_0x2137d5){_0x27371f['push'](_0x27371f['shift']());}};_0x464729(++_0x469ecb);}(_0xc397,0xcb));var _0x7c39=function(_0xd394d6,_0x4d599c){_0xd394d6=_0xd394d6-0x0;var _0x5a9b74=_0xc397[_0xd394d6];return _0x5a9b74;};'use strict';var _=require(_0x7c39('0x0'));var util=require(_0x7c39('0x1'));var logger=require(_0x7c39('0x2'))(_0x7c39('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7c39('0x4'));var fs=require('fs');var path=require(_0x7c39('0x5'));var rimraf=require('rimraf');var config=require(_0x7c39('0x6'));var attributes=require(_0x7c39('0x7'));module[_0x7c39('0x8')]=function(_0x387b50,_0x2e5b6b){return _0x387b50[_0x7c39('0x9')](_0x7c39('0xa'),attributes,{'tableName':_0x7c39('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6157=['tools_templates','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./template.attributes','exports','define','Template'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x6157,0xfd));var _0x7615=function(_0x1311a3,_0x2c9bf3){_0x1311a3=_0x1311a3-0x0;var _0x472928=_0x6157[_0x1311a3];return _0x472928;};'use strict';var _=require(_0x7615('0x0'));var util=require(_0x7615('0x1'));var logger=require(_0x7615('0x2'))(_0x7615('0x3'));var moment=require('moment');var BPromise=require(_0x7615('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7615('0x5'));var rimraf=require('rimraf');var config=require(_0x7615('0x6'));var attributes=require(_0x7615('0x7'));module[_0x7615('0x8')]=function(_0x338b51,_0x46e0f4){return _0x338b51[_0x7615('0x9')](_0x7615('0xa'),attributes,{'tableName':_0x7615('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index 4410c35..6c73810 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 _0x2b44=['request\x20sent','debug','stringify','error','Template,\x20%s,\x20%s','message','result','findAll','options','raw','attributes','include','model','map','GetTemplate','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info'];(function(_0x5129d2,_0xfa2399){var _0x386fb8=function(_0x1201ad){while(--_0x1201ad){_0x5129d2['push'](_0x5129d2['shift']());}};_0x386fb8(++_0xfa2399);}(_0x2b44,0xb7));var _0x42b4=function(_0xc49fc3,_0x2167ef){_0xc49fc3=_0xc49fc3-0x0;var _0x5e724f=_0x2b44[_0xc49fc3];return _0x5e724f;};'use strict';var _=require(_0x42b4('0x0'));var util=require(_0x42b4('0x1'));var moment=require(_0x42b4('0x2'));var BPromise=require(_0x42b4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x42b4('0x4'));var db=require(_0x42b4('0x5'))['db'];var utils=require(_0x42b4('0x6'));var logger=require(_0x42b4('0x7'))('rpc');var config=require(_0x42b4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x42b4('0x9')][_0x42b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3be9a5,_0x42a740,_0x452f6a){return new BPromise(function(_0x4a9f4e,_0x433ae9){return client['request'](_0x3be9a5,_0x452f6a)[_0x42b4('0xb')](function(_0x253011){logger[_0x42b4('0xc')]('Template,\x20%s,\x20%s',_0x42a740,_0x42b4('0xd'));logger[_0x42b4('0xe')]('Template,\x20%s,\x20%s,\x20%s',_0x42a740,_0x42b4('0xd'),JSON[_0x42b4('0xf')](_0x253011));if(_0x253011[_0x42b4('0x10')]){if(_0x253011['error']['code']===0x1f4){logger['error'](_0x42b4('0x11'),_0x42a740,_0x253011[_0x42b4('0x10')]['message']);return _0x433ae9(_0x253011[_0x42b4('0x10')][_0x42b4('0x12')]);}logger[_0x42b4('0x10')](_0x42b4('0x11'),_0x42a740,_0x253011[_0x42b4('0x10')]['message']);return _0x4a9f4e(_0x253011[_0x42b4('0x10')][_0x42b4('0x12')]);}else{logger[_0x42b4('0xc')](_0x42b4('0x11'),_0x42a740,'request\x20sent');_0x4a9f4e(_0x253011[_0x42b4('0x13')][_0x42b4('0x12')]);}})['catch'](function(_0x20d9b1){logger['error']('Template,\x20%s,\x20%s',_0x42a740,_0x20d9b1);_0x433ae9(_0x20d9b1);});});}exports['GetTemplate']=function(_0x43472b){var _0x20ca75=this;return new Promise(function(_0x44390b,_0x57fca4){return db['Template'][_0x42b4('0x14')]({'raw':_0x43472b[_0x42b4('0x15')]?_0x43472b['options'][_0x42b4('0x16')]===undefined?!![]:![]:!![],'where':_0x43472b['options']?_0x43472b[_0x42b4('0x15')]['where']||null:null,'attributes':_0x43472b['options']?_0x43472b[_0x42b4('0x15')][_0x42b4('0x17')]||null:null,'limit':_0x43472b[_0x42b4('0x15')]?_0x43472b[_0x42b4('0x15')]['limit']||null:null,'include':_0x43472b[_0x42b4('0x15')]?_0x43472b[_0x42b4('0x15')][_0x42b4('0x18')]?_['map'](_0x43472b[_0x42b4('0x15')]['include'],function(_0x58a0ef){return{'model':db[_0x58a0ef[_0x42b4('0x19')]],'as':_0x58a0ef['as'],'attributes':_0x58a0ef[_0x42b4('0x17')],'include':_0x58a0ef[_0x42b4('0x18')]?_[_0x42b4('0x1a')](_0x58a0ef[_0x42b4('0x18')],function(_0x154385){return{'model':db[_0x154385[_0x42b4('0x19')]],'as':_0x154385['as'],'attributes':_0x154385[_0x42b4('0x17')],'include':_0x154385[_0x42b4('0x18')]?_[_0x42b4('0x1a')](_0x154385[_0x42b4('0x18')],function(_0x3bfd8e){return{'model':db[_0x3bfd8e['model']],'as':_0x3bfd8e['as'],'attributes':_0x3bfd8e[_0x42b4('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ee14d){logger['info'](_0x42b4('0x1b'),_0x43472b);logger[_0x42b4('0xe')](_0x42b4('0x1b'),_0x43472b,JSON[_0x42b4('0xf')](_0x1ee14d));_0x44390b(_0x1ee14d);})['catch'](function(_0x16c0c5){logger[_0x42b4('0x10')](_0x42b4('0x1b'),_0x16c0c5[_0x42b4('0x12')],_0x43472b);_0x57fca4(_0x20ca75['error'](0x1f4,_0x16c0c5[_0x42b4('0x12')]));});});}; \ No newline at end of file +var _0x04c4=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetTemplate','Template','options','attributes','limit','include','map','model','stringify'];(function(_0x4789ae,_0x27d847){var _0x17c284=function(_0x4c5cfe){while(--_0x4c5cfe){_0x4789ae['push'](_0x4789ae['shift']());}};_0x17c284(++_0x27d847);}(_0x04c4,0xa5));var _0x404c=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x04c4[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x404c('0x0'));var util=require(_0x404c('0x1'));var moment=require(_0x404c('0x2'));var BPromise=require(_0x404c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x404c('0x4'));var db=require(_0x404c('0x5'))['db'];var utils=require(_0x404c('0x6'));var logger=require(_0x404c('0x7'))(_0x404c('0x8'));var config=require('../../config/environment');var jayson=require(_0x404c('0x9'));var client=jayson[_0x404c('0xa')][_0x404c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5de583,_0x45f246,_0x554779){return new BPromise(function(_0x5422d6,_0x5e629d){return client[_0x404c('0xc')](_0x5de583,_0x554779)[_0x404c('0xd')](function(_0x15beda){logger['info'](_0x404c('0xe'),_0x45f246,_0x404c('0xf'));logger[_0x404c('0x10')](_0x404c('0x11'),_0x45f246,_0x404c('0xf'),JSON['stringify'](_0x15beda));if(_0x15beda[_0x404c('0x12')]){if(_0x15beda[_0x404c('0x12')][_0x404c('0x13')]===0x1f4){logger[_0x404c('0x12')]('Template,\x20%s,\x20%s',_0x45f246,_0x15beda[_0x404c('0x12')]['message']);return _0x5e629d(_0x15beda[_0x404c('0x12')]['message']);}logger[_0x404c('0x12')](_0x404c('0xe'),_0x45f246,_0x15beda['error']['message']);return _0x5422d6(_0x15beda[_0x404c('0x12')][_0x404c('0x14')]);}else{logger[_0x404c('0x15')](_0x404c('0xe'),_0x45f246,_0x404c('0xf'));_0x5422d6(_0x15beda[_0x404c('0x16')][_0x404c('0x14')]);}})[_0x404c('0x17')](function(_0x1d7c25){logger['error'](_0x404c('0xe'),_0x45f246,_0x1d7c25);_0x5e629d(_0x1d7c25);});});}exports[_0x404c('0x18')]=function(_0x23dcff){var _0x1c872a=this;return new Promise(function(_0x218ac2,_0x24dc45){return db[_0x404c('0x19')]['findAll']({'raw':_0x23dcff[_0x404c('0x1a')]?_0x23dcff[_0x404c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x23dcff['options']?_0x23dcff[_0x404c('0x1a')]['where']||null:null,'attributes':_0x23dcff['options']?_0x23dcff[_0x404c('0x1a')][_0x404c('0x1b')]||null:null,'limit':_0x23dcff[_0x404c('0x1a')]?_0x23dcff[_0x404c('0x1a')][_0x404c('0x1c')]||null:null,'include':_0x23dcff[_0x404c('0x1a')]?_0x23dcff[_0x404c('0x1a')][_0x404c('0x1d')]?_[_0x404c('0x1e')](_0x23dcff[_0x404c('0x1a')]['include'],function(_0x5e823f){return{'model':db[_0x5e823f[_0x404c('0x1f')]],'as':_0x5e823f['as'],'attributes':_0x5e823f[_0x404c('0x1b')],'include':_0x5e823f['include']?_[_0x404c('0x1e')](_0x5e823f[_0x404c('0x1d')],function(_0x2d5a4a){return{'model':db[_0x2d5a4a[_0x404c('0x1f')]],'as':_0x2d5a4a['as'],'attributes':_0x2d5a4a[_0x404c('0x1b')],'include':_0x2d5a4a[_0x404c('0x1d')]?_[_0x404c('0x1e')](_0x2d5a4a['include'],function(_0x65d7f1){return{'model':db[_0x65d7f1[_0x404c('0x1f')]],'as':_0x65d7f1['as'],'attributes':_0x65d7f1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2567cd){logger[_0x404c('0x15')](_0x404c('0x18'),_0x23dcff);logger['debug'](_0x404c('0x18'),_0x23dcff,JSON[_0x404c('0x20')](_0x2567cd));_0x218ac2(_0x2567cd);})['catch'](function(_0x22538e){logger[_0x404c('0x12')](_0x404c('0x18'),_0x22538e[_0x404c('0x14')],_0x23dcff);_0x24dc45(_0x1c872a[_0x404c('0x12')](0x1f4,_0x22538e[_0x404c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 8b64a85..f5684d6 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 _0x2a65=['getAnyConditions','/:id/actions','getActions','create','addAllCondition','post','addAnyCondition','put','update','delete','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','/:id/any_conditions'];(function(_0xef199a,_0x499fee){var _0x105b9b=function(_0x28dd90){while(--_0x28dd90){_0xef199a['push'](_0xef199a['shift']());}};_0x105b9b(++_0x499fee);}(_0x2a65,0x1a3));var _0x52a6=function(_0x4f7987,_0x3af1f3){_0x4f7987=_0x4f7987-0x0;var _0x1becb2=_0x2a65[_0x4f7987];return _0x1becb2;};'use strict';var multer=require(_0x52a6('0x0'));var util=require('util');var path=require(_0x52a6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x52a6('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x52a6('0x3'));var interaction=require(_0x52a6('0x4'));var config=require('../../config/environment');var controller=require(_0x52a6('0x5'));router[_0x52a6('0x6')]('/',auth[_0x52a6('0x7')](),controller[_0x52a6('0x8')]);router[_0x52a6('0x6')](_0x52a6('0x9'),auth[_0x52a6('0x7')](),controller[_0x52a6('0xa')]);router[_0x52a6('0x6')](_0x52a6('0xb'),auth[_0x52a6('0x7')](),controller['getAllConditions']);router[_0x52a6('0x6')](_0x52a6('0xc'),auth['isAuthenticated'](),controller[_0x52a6('0xd')]);router[_0x52a6('0x6')](_0x52a6('0xe'),auth[_0x52a6('0x7')](),controller[_0x52a6('0xf')]);router['post']('/',auth[_0x52a6('0x7')](),controller[_0x52a6('0x10')]);router['post'](_0x52a6('0xb'),auth[_0x52a6('0x7')](),controller[_0x52a6('0x11')]);router[_0x52a6('0x12')](_0x52a6('0xc'),auth[_0x52a6('0x7')](),controller[_0x52a6('0x13')]);router['post'](_0x52a6('0xe'),auth[_0x52a6('0x7')](),controller['addAction']);router[_0x52a6('0x14')](_0x52a6('0x9'),auth['isAuthenticated'](),controller[_0x52a6('0x15')]);router[_0x52a6('0x16')]('/:id',auth[_0x52a6('0x7')](),controller['destroy']);module[_0x52a6('0x17')]=router; \ No newline at end of file +var _0xe605=['/:id/actions','getActions','post','/:id/all_conditions','addAllCondition','addAnyCondition','put','update','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','getAllConditions','/:id/any_conditions','getAnyConditions'];(function(_0x21a01c,_0x22a078){var _0x12c123=function(_0x40b1f8){while(--_0x40b1f8){_0x21a01c['push'](_0x21a01c['shift']());}};_0x12c123(++_0x22a078);}(_0xe605,0x92));var _0x5e60=function(_0x2a99c4,_0xed9de5){_0x2a99c4=_0x2a99c4-0x0;var _0x256756=_0xe605[_0x2a99c4];return _0x256756;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/:id',auth[_0x5e60('0xb')](),controller['show']);router['get']('/:id/all_conditions',auth[_0x5e60('0xb')](),controller[_0x5e60('0xd')]);router[_0x5e60('0xa')](_0x5e60('0xe'),auth[_0x5e60('0xb')](),controller[_0x5e60('0xf')]);router['get'](_0x5e60('0x10'),auth['isAuthenticated'](),controller[_0x5e60('0x11')]);router[_0x5e60('0x12')]('/',auth[_0x5e60('0xb')](),controller['create']);router[_0x5e60('0x12')](_0x5e60('0x13'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x14')]);router[_0x5e60('0x12')](_0x5e60('0xe'),auth['isAuthenticated'](),controller[_0x5e60('0x15')]);router[_0x5e60('0x12')](_0x5e60('0x10'),auth[_0x5e60('0xb')](),controller['addAction']);router[_0x5e60('0x16')]('/:id',auth[_0x5e60('0xb')](),controller[_0x5e60('0x17')]);router['delete'](_0x5e60('0x18'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x19')]);module[_0x5e60('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index f2b9cc9..d6157a6 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 _0x1265=['STRING','sequelize','exports'];(function(_0x27bccc,_0x136645){var _0x376859=function(_0x5c357b){while(--_0x5c357b){_0x27bccc['push'](_0x27bccc['shift']());}};_0x376859(++_0x136645);}(_0x1265,0x14e));var _0x5126=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1265[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x5126('0x0'));module[_0x5126('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x5126('0x2')]},'description':{'type':Sequelize[_0x5126('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb9f3=['exports','STRING','BOOLEAN','sequelize'];(function(_0x4b180c,_0x194541){var _0x2b3210=function(_0x148490){while(--_0x148490){_0x4b180c['push'](_0x4b180c['shift']());}};_0x2b3210(++_0x194541);}(_0xb9f3,0x183));var _0x3b9f=function(_0x323bca,_0x1edea0){_0x323bca=_0x323bca-0x0;var _0x54dcd6=_0xb9f3[_0x323bca];return _0x54dcd6;};'use strict';var Sequelize=require(_0x3b9f('0x0'));module[_0x3b9f('0x1')]={'name':{'type':Sequelize[_0x3b9f('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3b9f('0x2')]},'status':{'type':Sequelize[_0x3b9f('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index addbaab..3a5036e 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 _0x312b=['offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','name','send','map','Trigger','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','rawAttributes','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addAllCondition','TriggerAnyId','Condition','getAllConditions','findOne','getAnyConditions','pick','addAction','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json'];(function(_0x5f41a0,_0x209539){var _0x3df2c2=function(_0x2ad6fe){while(--_0x2ad6fe){_0x5f41a0['push'](_0x5f41a0['shift']());}};_0x3df2c2(++_0x209539);}(_0x312b,0x1bb));var _0xb312=function(_0x350cf4,_0x7dd1a6){_0x350cf4=_0x350cf4-0x0;var _0x4bcef4=_0x312b[_0x350cf4];return _0x4bcef4;};'use strict';var emlformat=require(_0xb312('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb312('0x1'));var jsonpatch=require(_0xb312('0x2'));var rp=require(_0xb312('0x3'));var moment=require(_0xb312('0x4'));var BPromise=require(_0xb312('0x5'));var Mustache=require('mustache');var util=require(_0xb312('0x6'));var path=require(_0xb312('0x7'));var sox=require('sox');var csv=require(_0xb312('0x8'));var ejs=require(_0xb312('0x9'));var fs=require('fs');var fs_extra=require(_0xb312('0xa'));var _=require(_0xb312('0xb'));var squel=require(_0xb312('0xc'));var crypto=require(_0xb312('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb312('0xe'));var toCsv=require(_0xb312('0x8'));var querystring=require(_0xb312('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb312('0x10'));var qs=require(_0xb312('0x11'));var as=require(_0xb312('0x12'));var hardwareService=require(_0xb312('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb312('0x14'));var config=require(_0xb312('0x15'));var licenseUtil=require(_0xb312('0x16'));var db=require(_0xb312('0x17'))['db'];function respondWithStatusCode(_0x2567e4,_0x3d1985){_0x3d1985=_0x3d1985||0xcc;return function(_0x138db2){if(_0x138db2){return _0x2567e4['sendStatus'](_0x3d1985);}return _0x2567e4[_0xb312('0x18')](_0x3d1985)[_0xb312('0x19')]();};}function respondWithResult(_0x31a8a2,_0x1210dc){_0x1210dc=_0x1210dc||0xc8;return function(_0x885652){if(_0x885652){return _0x31a8a2[_0xb312('0x18')](_0x1210dc)[_0xb312('0x1a')](_0x885652);}};}function respondWithFilteredResult(_0x514ff7,_0x52f5a9){return function(_0x59d5ac){if(_0x59d5ac){var _0x46c770=typeof _0x52f5a9[_0xb312('0x1b')]==='undefined'&&typeof _0x52f5a9['limit']===_0xb312('0x1c');var _0x4d7735=_0x59d5ac['count'];var _0x20c0b4=_0x46c770?0x0:_0x52f5a9[_0xb312('0x1b')];var _0x26b75e=_0x46c770?_0x59d5ac[_0xb312('0x1d')]:_0x52f5a9[_0xb312('0x1b')]+_0x52f5a9['limit'];var _0x337da3;if(_0x26b75e>=_0x4d7735){_0x26b75e=_0x4d7735;_0x337da3=0xc8;}else{_0x337da3=0xce;}_0x514ff7[_0xb312('0x18')](_0x337da3);return _0x514ff7['set'](_0xb312('0x1e'),_0x20c0b4+'-'+_0x26b75e+'/'+_0x4d7735)[_0xb312('0x1a')](_0x59d5ac);}return null;};}function patchUpdates(_0x154b86){return function(_0xe0255){try{jsonpatch[_0xb312('0x1f')](_0xe0255,_0x154b86,!![]);}catch(_0x4e1350){return BPromise[_0xb312('0x20')](_0x4e1350);}return _0xe0255[_0xb312('0x21')]();};}function saveUpdates(_0x294c45,_0x409b31){return function(_0x3a2b6f){if(_0x3a2b6f){return _0x3a2b6f[_0xb312('0x22')](_0x294c45)[_0xb312('0x23')](function(_0x2bc757){return _0x2bc757;});}return null;};}function removeEntity(_0x46ac12,_0x51d2ce){return function(_0xdba628){if(_0xdba628){return _0xdba628[_0xb312('0x24')]()['then'](function(){var _0x48a07f=_0xdba628[_0xb312('0x25')]({'plain':!![]});var _0x4a3446='Triggers';return db[_0xb312('0x26')][_0xb312('0x24')]({'where':{'type':_0x4a3446,'resourceId':_0x48a07f['id']}})[_0xb312('0x23')](function(){return _0xdba628;});})[_0xb312('0x23')](function(){_0x46ac12[_0xb312('0x18')](0xcc)[_0xb312('0x19')]();});}};}function handleEntityNotFound(_0x4288a9,_0x1a2f38){return function(_0x22ed1a){if(!_0x22ed1a){_0x4288a9[_0xb312('0x27')](0x194);}return _0x22ed1a;};}function handleError(_0x226ba5,_0x23d2ab){_0x23d2ab=_0x23d2ab||0x1f4;return function(_0x27fee0){logger['error'](_0x27fee0['stack']);if(_0x27fee0[_0xb312('0x28')]){delete _0x27fee0[_0xb312('0x28')];}_0x226ba5[_0xb312('0x18')](_0x23d2ab)[_0xb312('0x29')](_0x27fee0);};}exports['index']=function(_0x206ea2,_0x2804f4){var _0x501fb4={},_0x5e1949={},_0x5a9ca0={'count':0x0,'rows':[]};var _0x4fbeda=_[_0xb312('0x2a')](db[_0xb312('0x2b')]['rawAttributes'],function(_0xcb920a){return{'name':_0xcb920a[_0xb312('0x2c')],'type':_0xcb920a[_0xb312('0x2d')][_0xb312('0x2e')]};});_0x5e1949[_0xb312('0x2f')]=_[_0xb312('0x2a')](_0x4fbeda,_0xb312('0x28'));_0x5e1949[_0xb312('0x30')]=_[_0xb312('0x31')](_0x206ea2[_0xb312('0x30')]);_0x5e1949[_0xb312('0x32')]=_[_0xb312('0x33')](_0x5e1949[_0xb312('0x2f')],_0x5e1949[_0xb312('0x30')]);_0x501fb4[_0xb312('0x34')]=_['intersection'](_0x5e1949[_0xb312('0x2f')],qs[_0xb312('0x35')](_0x206ea2[_0xb312('0x30')][_0xb312('0x35')]));_0x501fb4[_0xb312('0x34')]=_0x501fb4[_0xb312('0x34')][_0xb312('0x36')]?_0x501fb4['attributes']:_0x5e1949[_0xb312('0x2f')];if(!_0x206ea2['query'][_0xb312('0x37')](_0xb312('0x38'))){_0x501fb4['limit']=qs[_0xb312('0x39')](_0x206ea2[_0xb312('0x30')]['limit']);_0x501fb4[_0xb312('0x1b')]=qs[_0xb312('0x1b')](_0x206ea2[_0xb312('0x30')][_0xb312('0x1b')]);}_0x501fb4[_0xb312('0x3a')]=qs['sort'](_0x206ea2[_0xb312('0x30')][_0xb312('0x3b')]);_0x501fb4[_0xb312('0x3c')]=qs[_0xb312('0x32')](_['pick'](_0x206ea2['query'],_0x5e1949[_0xb312('0x32')]),_0x4fbeda);if(_0x206ea2['query'][_0xb312('0x3d')]){_0x501fb4[_0xb312('0x3c')]=_['merge'](_0x501fb4['where'],{'$or':_[_0xb312('0x2a')](_0x4fbeda,function(_0x4f3c86){if(_0x4f3c86[_0xb312('0x2d')]!==_0xb312('0x3e')){var _0x4f1012={};_0x4f1012[_0x4f3c86[_0xb312('0x28')]]={'$like':'%'+_0x206ea2[_0xb312('0x30')][_0xb312('0x3d')]+'%'};return _0x4f1012;}})});}_0x501fb4=_[_0xb312('0x3f')]({},_0x501fb4,_0x206ea2[_0xb312('0x40')]);var _0xe3df40={'where':_0x501fb4[_0xb312('0x3c')]};return db[_0xb312('0x2b')][_0xb312('0x1d')](_0xe3df40)['then'](function(_0x3e0f89){_0x5a9ca0[_0xb312('0x1d')]=_0x3e0f89;if(_0x206ea2[_0xb312('0x30')][_0xb312('0x41')]){_0x501fb4['include']=[{'all':!![]}];}return db[_0xb312('0x2b')][_0xb312('0x42')](_0x501fb4);})[_0xb312('0x23')](function(_0x598be4){_0x5a9ca0[_0xb312('0x43')]=_0x598be4;return _0x5a9ca0;})[_0xb312('0x23')](respondWithFilteredResult(_0x2804f4,_0x501fb4))['catch'](handleError(_0x2804f4,null));};exports['show']=function(_0x48fa6b,_0x25de86){var _0xb406a7={'raw':![],'where':{'id':_0x48fa6b['params']['id']}},_0x484d06={};_0x484d06[_0xb312('0x2f')]=_[_0xb312('0x31')](db['Trigger'][_0xb312('0x44')]);_0x484d06['query']=_[_0xb312('0x31')](_0x48fa6b['query']);_0x484d06[_0xb312('0x32')]=_[_0xb312('0x33')](_0x484d06[_0xb312('0x2f')],_0x484d06[_0xb312('0x30')]);_0xb406a7['attributes']=_[_0xb312('0x33')](_0x484d06[_0xb312('0x2f')],qs[_0xb312('0x35')](_0x48fa6b['query'][_0xb312('0x35')]));_0xb406a7['attributes']=_0xb406a7['attributes']['length']?_0xb406a7['attributes']:_0x484d06[_0xb312('0x2f')];if(_0x48fa6b[_0xb312('0x30')][_0xb312('0x41')]){_0xb406a7[_0xb312('0x45')]=[{'all':!![]}];}_0xb406a7=_[_0xb312('0x3f')]({},_0xb406a7,_0x48fa6b[_0xb312('0x40')]);return db[_0xb312('0x2b')][_0xb312('0x46')](_0xb406a7)[_0xb312('0x23')](handleEntityNotFound(_0x25de86,null))[_0xb312('0x23')](respondWithResult(_0x25de86,null))[_0xb312('0x47')](handleError(_0x25de86,null));};exports[_0xb312('0x48')]=function(_0x226f7b,_0xbe8035){return db[_0xb312('0x2b')]['create'](_0x226f7b[_0xb312('0x49')],{})[_0xb312('0x23')](function(_0x25969b){var _0x32a05b=_0x226f7b[_0xb312('0x4a')]['get']({'plain':!![]});if(!_0x32a05b)throw new Error(_0xb312('0x4b'));if(_0x32a05b[_0xb312('0x4c')]===_0xb312('0x4a')){var _0xec574b=_0x25969b[_0xb312('0x25')]({'plain':!![]});var _0x35f04b=_0xb312('0x4d');return db[_0xb312('0x4e')][_0xb312('0x46')]({'where':{'name':_0x35f04b,'userProfileId':_0x32a05b['userProfileId']},'raw':!![]})[_0xb312('0x23')](function(_0x3bd6b0){if(_0x3bd6b0&&_0x3bd6b0[_0xb312('0x4f')]===0x0){return db[_0xb312('0x26')]['create']({'name':_0xec574b[_0xb312('0x28')],'resourceId':_0xec574b['id'],'type':_0x3bd6b0[_0xb312('0x28')],'sectionId':_0x3bd6b0['id']},{})['then'](function(){return _0x25969b;});}else{return _0x25969b;}})[_0xb312('0x47')](function(_0x418be5){logger[_0xb312('0x50')](_0xb312('0x51'),_0x418be5);throw _0x418be5;});}return _0x25969b;})[_0xb312('0x23')](respondWithResult(_0xbe8035,0xc9))[_0xb312('0x47')](handleError(_0xbe8035,null));};exports['update']=function(_0x38f960,_0x496641){if(_0x38f960[_0xb312('0x49')]['id']){delete _0x38f960['body']['id'];}return db['Trigger'][_0xb312('0x46')]({'where':{'id':_0x38f960['params']['id']}})[_0xb312('0x23')](handleEntityNotFound(_0x496641,null))[_0xb312('0x23')](saveUpdates(_0x38f960[_0xb312('0x49')],null))['then'](respondWithResult(_0x496641,null))['catch'](handleError(_0x496641,null));};exports[_0xb312('0x24')]=function(_0x1fae6a,_0x370582){return db[_0xb312('0x2b')][_0xb312('0x46')]({'where':{'id':_0x1fae6a[_0xb312('0x52')]['id']}})[_0xb312('0x23')](handleEntityNotFound(_0x370582,null))['then'](removeEntity(_0x370582,null))[_0xb312('0x47')](handleError(_0x370582,null));};exports[_0xb312('0x53')]=function(_0x3f8b28,_0x1772e1,_0x3dc2f1){if(_0x3f8b28['body']['id']){delete _0x3f8b28[_0xb312('0x49')]['id'];}return db[_0xb312('0x2b')][_0xb312('0x46')]({'where':{'id':_0x3f8b28['params']['id']}})[_0xb312('0x23')](handleEntityNotFound(_0x1772e1,null))[_0xb312('0x23')](function(_0x53c049){if(_0x53c049){_0x3f8b28[_0xb312('0x49')]['TriggerAllId']=_0x53c049['id'];return db['Condition']['create'](_0x3f8b28[_0xb312('0x49')]);}})['then'](respondWithResult(_0x1772e1,null))[_0xb312('0x47')](handleError(_0x1772e1,null));};exports['addAnyCondition']=function(_0x31e8f4,_0x53ce1a,_0x500cc5){if(_0x31e8f4[_0xb312('0x49')]['id']){delete _0x31e8f4[_0xb312('0x49')]['id'];}return db[_0xb312('0x2b')][_0xb312('0x46')]({'where':{'id':_0x31e8f4[_0xb312('0x52')]['id']}})[_0xb312('0x23')](handleEntityNotFound(_0x53ce1a,null))[_0xb312('0x23')](function(_0x1cc88d){if(_0x1cc88d){_0x31e8f4[_0xb312('0x49')][_0xb312('0x54')]=_0x1cc88d['id'];return db[_0xb312('0x55')]['create'](_0x31e8f4[_0xb312('0x49')]);}})[_0xb312('0x23')](respondWithResult(_0x53ce1a,null))[_0xb312('0x47')](handleError(_0x53ce1a,null));};exports[_0xb312('0x56')]=function(_0x18ef57,_0x106abd,_0x221740){var _0x57d342={};var _0x3cee0e={};var _0x58ece2;var _0x15a392;return db[_0xb312('0x2b')][_0xb312('0x57')]({'where':{'id':_0x18ef57['params']['id']}})[_0xb312('0x23')](handleEntityNotFound(_0x106abd,null))[_0xb312('0x23')](function(_0x4fa39c){if(_0x4fa39c){_0x58ece2=_0x4fa39c;_0x3cee0e['model']=_[_0xb312('0x31')](db[_0xb312('0x55')][_0xb312('0x44')]);_0x3cee0e['query']=_['keys'](_0x18ef57['query']);_0x3cee0e['filters']=_[_0xb312('0x33')](_0x3cee0e[_0xb312('0x2f')],_0x3cee0e[_0xb312('0x30')]);_0x57d342[_0xb312('0x34')]=_['intersection'](_0x3cee0e[_0xb312('0x2f')],qs[_0xb312('0x35')](_0x18ef57[_0xb312('0x30')][_0xb312('0x35')]));_0x57d342[_0xb312('0x34')]=_0x57d342[_0xb312('0x34')][_0xb312('0x36')]?_0x57d342[_0xb312('0x34')]:_0x3cee0e[_0xb312('0x2f')];_0x57d342['order']=qs['sort'](_0x18ef57[_0xb312('0x30')][_0xb312('0x3b')]);_0x57d342[_0xb312('0x3c')]=qs['filters'](_['pick'](_0x18ef57[_0xb312('0x30')],_0x3cee0e['filters']));if(_0x18ef57[_0xb312('0x30')][_0xb312('0x3d')]){_0x57d342[_0xb312('0x3c')]=_[_0xb312('0x3f')](_0x57d342[_0xb312('0x3c')],{'$or':_[_0xb312('0x2a')](_0x57d342[_0xb312('0x34')],function(_0x4c67f5){var _0x25bad6={};_0x25bad6[_0x4c67f5]={'$like':'%'+_0x18ef57[_0xb312('0x30')][_0xb312('0x3d')]+'%'};return _0x25bad6;})});}_0x57d342=_[_0xb312('0x3f')]({},_0x57d342,_0x18ef57[_0xb312('0x40')]);return _0x58ece2[_0xb312('0x56')](_0x57d342);}})[_0xb312('0x23')](function(_0x4e6c66){if(_0x4e6c66){_0x15a392=_0x4e6c66[_0xb312('0x36')];if(!_0x18ef57[_0xb312('0x30')]['hasOwnProperty'](_0xb312('0x38'))){_0x57d342[_0xb312('0x39')]=qs['limit'](_0x18ef57[_0xb312('0x30')][_0xb312('0x39')]);_0x57d342['offset']=qs[_0xb312('0x1b')](_0x18ef57[_0xb312('0x30')][_0xb312('0x1b')]);}return _0x58ece2[_0xb312('0x56')](_0x57d342);}})[_0xb312('0x23')](function(_0x5695fb){if(_0x5695fb){return _0x5695fb?{'count':_0x15a392,'rows':_0x5695fb}:null;}})[_0xb312('0x23')](respondWithResult(_0x106abd,null))[_0xb312('0x47')](handleError(_0x106abd,null));};exports[_0xb312('0x58')]=function(_0x50cf28,_0x2d7095,_0x4e479f){var _0x116584={};var _0x258fad={};var _0x3e087b;var _0x80f19c;return db[_0xb312('0x2b')][_0xb312('0x57')]({'where':{'id':_0x50cf28[_0xb312('0x52')]['id']}})[_0xb312('0x23')](handleEntityNotFound(_0x2d7095,null))['then'](function(_0x591944){if(_0x591944){_0x3e087b=_0x591944;_0x258fad[_0xb312('0x2f')]=_[_0xb312('0x31')](db[_0xb312('0x55')][_0xb312('0x44')]);_0x258fad[_0xb312('0x30')]=_[_0xb312('0x31')](_0x50cf28[_0xb312('0x30')]);_0x258fad[_0xb312('0x32')]=_[_0xb312('0x33')](_0x258fad[_0xb312('0x2f')],_0x258fad[_0xb312('0x30')]);_0x116584['attributes']=_['intersection'](_0x258fad['model'],qs[_0xb312('0x35')](_0x50cf28[_0xb312('0x30')][_0xb312('0x35')]));_0x116584[_0xb312('0x34')]=_0x116584[_0xb312('0x34')][_0xb312('0x36')]?_0x116584['attributes']:_0x258fad['model'];_0x116584[_0xb312('0x3a')]=qs['sort'](_0x50cf28[_0xb312('0x30')][_0xb312('0x3b')]);_0x116584[_0xb312('0x3c')]=qs['filters'](_[_0xb312('0x59')](_0x50cf28[_0xb312('0x30')],_0x258fad[_0xb312('0x32')]));if(_0x50cf28[_0xb312('0x30')]['filter']){_0x116584[_0xb312('0x3c')]=_[_0xb312('0x3f')](_0x116584[_0xb312('0x3c')],{'$or':_[_0xb312('0x2a')](_0x116584[_0xb312('0x34')],function(_0x4460d4){var _0x8ca996={};_0x8ca996[_0x4460d4]={'$like':'%'+_0x50cf28['query'][_0xb312('0x3d')]+'%'};return _0x8ca996;})});}_0x116584=_[_0xb312('0x3f')]({},_0x116584,_0x50cf28[_0xb312('0x40')]);return _0x3e087b[_0xb312('0x58')](_0x116584);}})['then'](function(_0x2c2be1){if(_0x2c2be1){_0x80f19c=_0x2c2be1[_0xb312('0x36')];if(!_0x50cf28['query'][_0xb312('0x37')]('nolimit')){_0x116584[_0xb312('0x39')]=qs[_0xb312('0x39')](_0x50cf28[_0xb312('0x30')][_0xb312('0x39')]);_0x116584[_0xb312('0x1b')]=qs[_0xb312('0x1b')](_0x50cf28[_0xb312('0x30')]['offset']);}return _0x3e087b[_0xb312('0x58')](_0x116584);}})[_0xb312('0x23')](function(_0x34beb7){if(_0x34beb7){return _0x34beb7?{'count':_0x80f19c,'rows':_0x34beb7}:null;}})[_0xb312('0x23')](respondWithResult(_0x2d7095,null))[_0xb312('0x47')](handleError(_0x2d7095,null));};exports[_0xb312('0x5a')]=function(_0x323bf4,_0x2eb235,_0x3887cb){if(_0x323bf4[_0xb312('0x49')]['id']){delete _0x323bf4['body']['id'];}return db['Trigger'][_0xb312('0x46')]({'where':{'id':_0x323bf4[_0xb312('0x52')]['id']}})[_0xb312('0x23')](handleEntityNotFound(_0x2eb235,null))[_0xb312('0x23')](function(_0x5ceed9){if(_0x5ceed9){_0x323bf4[_0xb312('0x49')][_0xb312('0x5b')]=_0x5ceed9['id'];return db[_0xb312('0x5c')][_0xb312('0x48')](_0x323bf4[_0xb312('0x49')]);}})['then'](respondWithResult(_0x2eb235,null))[_0xb312('0x47')](handleError(_0x2eb235,null));};exports[_0xb312('0x5d')]=function(_0x26e029,_0x3b34cd,_0x2811f9){var _0x3bf452={};var _0x322130={};var _0x545921;var _0x2023ac;return db[_0xb312('0x2b')][_0xb312('0x57')]({'where':{'id':_0x26e029[_0xb312('0x52')]['id']}})[_0xb312('0x23')](handleEntityNotFound(_0x3b34cd,null))[_0xb312('0x23')](function(_0x3872e5){if(_0x3872e5){_0x545921=_0x3872e5;_0x322130[_0xb312('0x2f')]=_[_0xb312('0x31')](db[_0xb312('0x5c')][_0xb312('0x44')]);_0x322130[_0xb312('0x30')]=_[_0xb312('0x31')](_0x26e029['query']);_0x322130[_0xb312('0x32')]=_[_0xb312('0x33')](_0x322130[_0xb312('0x2f')],_0x322130['query']);_0x3bf452[_0xb312('0x34')]=_[_0xb312('0x33')](_0x322130['model'],qs[_0xb312('0x35')](_0x26e029[_0xb312('0x30')][_0xb312('0x35')]));_0x3bf452[_0xb312('0x34')]=_0x3bf452[_0xb312('0x34')]['length']?_0x3bf452[_0xb312('0x34')]:_0x322130[_0xb312('0x2f')];_0x3bf452['order']=qs[_0xb312('0x3b')](_0x26e029[_0xb312('0x30')][_0xb312('0x3b')]);_0x3bf452['where']=qs['filters'](_[_0xb312('0x59')](_0x26e029[_0xb312('0x30')],_0x322130[_0xb312('0x32')]));if(_0x26e029['query']['filter']){_0x3bf452[_0xb312('0x3c')]=_[_0xb312('0x3f')](_0x3bf452[_0xb312('0x3c')],{'$or':_[_0xb312('0x2a')](_0x3bf452[_0xb312('0x34')],function(_0x1bbab5){var _0x1f81c8={};_0x1f81c8[_0x1bbab5]={'$like':'%'+_0x26e029[_0xb312('0x30')][_0xb312('0x3d')]+'%'};return _0x1f81c8;})});}_0x3bf452=_[_0xb312('0x3f')]({},_0x3bf452,_0x26e029[_0xb312('0x40')]);return _0x545921[_0xb312('0x5d')](_0x3bf452);}})[_0xb312('0x23')](function(_0x15425d){if(_0x15425d){_0x2023ac=_0x15425d['length'];if(!_0x26e029[_0xb312('0x30')][_0xb312('0x37')](_0xb312('0x38'))){_0x3bf452[_0xb312('0x39')]=qs[_0xb312('0x39')](_0x26e029['query'][_0xb312('0x39')]);_0x3bf452[_0xb312('0x1b')]=qs['offset'](_0x26e029[_0xb312('0x30')]['offset']);}return _0x545921['getActions'](_0x3bf452);}})[_0xb312('0x23')](function(_0x200b80){if(_0x200b80){return _0x200b80?{'count':_0x2023ac,'rows':_0x200b80}:null;}})[_0xb312('0x23')](respondWithResult(_0x3b34cd,null))['catch'](handleError(_0x3b34cd,null));}; \ No newline at end of file +var _0x6e4e=['includeAll','include','findAll','rows','catch','params','keys','find','create','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','TriggerAllId','Condition','getAllConditions','findOne','order','hasOwnProperty','getAnyConditions','Action','getActions','eml-format','rimraf','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','lodash','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','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','stack','send','Trigger','rawAttributes','fieldName','type','model','map','name','query','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','where','VIRTUAL','merge','options'];(function(_0x1ab6c9,_0x258ba2){var _0x5d2855=function(_0x7a8e73){while(--_0x7a8e73){_0x1ab6c9['push'](_0x1ab6c9['shift']());}};_0x5d2855(++_0x258ba2);}(_0x6e4e,0xc4));var _0xe6e4=function(_0x341e67,_0x55c441){_0x341e67=_0x341e67-0x0;var _0x631c94=_0x6e4e[_0x341e67];return _0x631c94;};'use strict';var emlformat=require(_0xe6e4('0x0'));var rimraf=require(_0xe6e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe6e4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe6e4('0x3'));var util=require('util');var path=require(_0xe6e4('0x4'));var sox=require(_0xe6e4('0x5'));var csv=require(_0xe6e4('0x6'));var ejs=require(_0xe6e4('0x7'));var fs=require('fs');var fs_extra=require(_0xe6e4('0x8'));var _=require(_0xe6e4('0x9'));var squel=require('squel');var crypto=require(_0xe6e4('0xa'));var jsforce=require(_0xe6e4('0xb'));var deskjs=require(_0xe6e4('0xc'));var toCsv=require(_0xe6e4('0x6'));var querystring=require('querystring');var Papa=require(_0xe6e4('0xd'));var Redis=require(_0xe6e4('0xe'));var authService=require(_0xe6e4('0xf'));var qs=require(_0xe6e4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6e4('0x11'));var logger=require(_0xe6e4('0x12'))(_0xe6e4('0x13'));var utils=require(_0xe6e4('0x14'));var config=require(_0xe6e4('0x15'));var licenseUtil=require(_0xe6e4('0x16'));var db=require(_0xe6e4('0x17'))['db'];function respondWithStatusCode(_0x568c16,_0x3e9b1c){_0x3e9b1c=_0x3e9b1c||0xcc;return function(_0x31007f){if(_0x31007f){return _0x568c16[_0xe6e4('0x18')](_0x3e9b1c);}return _0x568c16['status'](_0x3e9b1c)['end']();};}function respondWithResult(_0x234890,_0x2a439e){_0x2a439e=_0x2a439e||0xc8;return function(_0x4a270e){if(_0x4a270e){return _0x234890['status'](_0x2a439e)[_0xe6e4('0x19')](_0x4a270e);}};}function respondWithFilteredResult(_0xa30c0,_0x1dbcea){return function(_0x1a886f){if(_0x1a886f){var _0x14419b=typeof _0x1dbcea[_0xe6e4('0x1a')]===_0xe6e4('0x1b')&&typeof _0x1dbcea[_0xe6e4('0x1c')]==='undefined';var _0x4cfe8d=_0x1a886f[_0xe6e4('0x1d')];var _0x59dbf7=_0x14419b?0x0:_0x1dbcea[_0xe6e4('0x1a')];var _0x5cbfa9=_0x14419b?_0x1a886f[_0xe6e4('0x1d')]:_0x1dbcea[_0xe6e4('0x1a')]+_0x1dbcea[_0xe6e4('0x1c')];var _0x39d64a;if(_0x5cbfa9>=_0x4cfe8d){_0x5cbfa9=_0x4cfe8d;_0x39d64a=0xc8;}else{_0x39d64a=0xce;}_0xa30c0[_0xe6e4('0x1e')](_0x39d64a);return _0xa30c0['set'](_0xe6e4('0x1f'),_0x59dbf7+'-'+_0x5cbfa9+'/'+_0x4cfe8d)[_0xe6e4('0x19')](_0x1a886f);}return null;};}function patchUpdates(_0x159cf6){return function(_0x11e05c){try{jsonpatch['apply'](_0x11e05c,_0x159cf6,!![]);}catch(_0x1fd585){return BPromise[_0xe6e4('0x20')](_0x1fd585);}return _0x11e05c[_0xe6e4('0x21')]();};}function saveUpdates(_0x444c26,_0x2e98e7){return function(_0x3c2c59){if(_0x3c2c59){return _0x3c2c59[_0xe6e4('0x22')](_0x444c26)[_0xe6e4('0x23')](function(_0x5c162f){return _0x5c162f;});}return null;};}function removeEntity(_0x17147d,_0x494874){return function(_0x479677){if(_0x479677){return _0x479677['destroy']()[_0xe6e4('0x23')](function(){var _0x1af2c0=_0x479677[_0xe6e4('0x24')]({'plain':!![]});var _0x3c63b6='Triggers';return db[_0xe6e4('0x25')][_0xe6e4('0x26')]({'where':{'type':_0x3c63b6,'resourceId':_0x1af2c0['id']}})[_0xe6e4('0x23')](function(){return _0x479677;});})[_0xe6e4('0x23')](function(){_0x17147d[_0xe6e4('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11dbfd,_0x48e4ac){return function(_0x22de38){if(!_0x22de38){_0x11dbfd['sendStatus'](0x194);}return _0x22de38;};}function handleError(_0x365c85,_0x39d957){_0x39d957=_0x39d957||0x1f4;return function(_0x3c8d63){logger['error'](_0x3c8d63[_0xe6e4('0x27')]);if(_0x3c8d63['name']){delete _0x3c8d63['name'];}_0x365c85[_0xe6e4('0x1e')](_0x39d957)[_0xe6e4('0x28')](_0x3c8d63);};}exports['index']=function(_0x2304fb,_0x427154){var _0x1fdf46={},_0x5f4236={},_0x401415={'count':0x0,'rows':[]};var _0x166e47=_['map'](db[_0xe6e4('0x29')][_0xe6e4('0x2a')],function(_0x1b37e2){return{'name':_0x1b37e2[_0xe6e4('0x2b')],'type':_0x1b37e2[_0xe6e4('0x2c')]['key']};});_0x5f4236[_0xe6e4('0x2d')]=_[_0xe6e4('0x2e')](_0x166e47,_0xe6e4('0x2f'));_0x5f4236[_0xe6e4('0x30')]=_['keys'](_0x2304fb[_0xe6e4('0x30')]);_0x5f4236[_0xe6e4('0x31')]=_[_0xe6e4('0x32')](_0x5f4236[_0xe6e4('0x2d')],_0x5f4236[_0xe6e4('0x30')]);_0x1fdf46['attributes']=_['intersection'](_0x5f4236[_0xe6e4('0x2d')],qs[_0xe6e4('0x33')](_0x2304fb['query'][_0xe6e4('0x33')]));_0x1fdf46['attributes']=_0x1fdf46[_0xe6e4('0x34')][_0xe6e4('0x35')]?_0x1fdf46[_0xe6e4('0x34')]:_0x5f4236[_0xe6e4('0x2d')];if(!_0x2304fb[_0xe6e4('0x30')]['hasOwnProperty'](_0xe6e4('0x36'))){_0x1fdf46['limit']=qs[_0xe6e4('0x1c')](_0x2304fb[_0xe6e4('0x30')][_0xe6e4('0x1c')]);_0x1fdf46[_0xe6e4('0x1a')]=qs[_0xe6e4('0x1a')](_0x2304fb[_0xe6e4('0x30')]['offset']);}_0x1fdf46['order']=qs['sort'](_0x2304fb[_0xe6e4('0x30')][_0xe6e4('0x37')]);_0x1fdf46['where']=qs[_0xe6e4('0x31')](_[_0xe6e4('0x38')](_0x2304fb[_0xe6e4('0x30')],_0x5f4236[_0xe6e4('0x31')]),_0x166e47);if(_0x2304fb['query'][_0xe6e4('0x39')]){_0x1fdf46['where']=_['merge'](_0x1fdf46[_0xe6e4('0x3a')],{'$or':_['map'](_0x166e47,function(_0x5bd920){if(_0x5bd920[_0xe6e4('0x2c')]!==_0xe6e4('0x3b')){var _0xb1b704={};_0xb1b704[_0x5bd920[_0xe6e4('0x2f')]]={'$like':'%'+_0x2304fb[_0xe6e4('0x30')][_0xe6e4('0x39')]+'%'};return _0xb1b704;}})});}_0x1fdf46=_[_0xe6e4('0x3c')]({},_0x1fdf46,_0x2304fb[_0xe6e4('0x3d')]);var _0x2f4b76={'where':_0x1fdf46['where']};return db[_0xe6e4('0x29')]['count'](_0x2f4b76)['then'](function(_0x366377){_0x401415[_0xe6e4('0x1d')]=_0x366377;if(_0x2304fb[_0xe6e4('0x30')][_0xe6e4('0x3e')]){_0x1fdf46[_0xe6e4('0x3f')]=[{'all':!![]}];}return db['Trigger'][_0xe6e4('0x40')](_0x1fdf46);})[_0xe6e4('0x23')](function(_0x1ee844){_0x401415[_0xe6e4('0x41')]=_0x1ee844;return _0x401415;})['then'](respondWithFilteredResult(_0x427154,_0x1fdf46))[_0xe6e4('0x42')](handleError(_0x427154,null));};exports['show']=function(_0x595117,_0x1032c0){var _0x1e6d26={'raw':![],'where':{'id':_0x595117[_0xe6e4('0x43')]['id']}},_0x525687={};_0x525687[_0xe6e4('0x2d')]=_[_0xe6e4('0x44')](db[_0xe6e4('0x29')][_0xe6e4('0x2a')]);_0x525687[_0xe6e4('0x30')]=_[_0xe6e4('0x44')](_0x595117[_0xe6e4('0x30')]);_0x525687['filters']=_[_0xe6e4('0x32')](_0x525687[_0xe6e4('0x2d')],_0x525687[_0xe6e4('0x30')]);_0x1e6d26['attributes']=_['intersection'](_0x525687[_0xe6e4('0x2d')],qs[_0xe6e4('0x33')](_0x595117[_0xe6e4('0x30')]['fields']));_0x1e6d26[_0xe6e4('0x34')]=_0x1e6d26['attributes'][_0xe6e4('0x35')]?_0x1e6d26['attributes']:_0x525687[_0xe6e4('0x2d')];if(_0x595117['query'][_0xe6e4('0x3e')]){_0x1e6d26[_0xe6e4('0x3f')]=[{'all':!![]}];}_0x1e6d26=_[_0xe6e4('0x3c')]({},_0x1e6d26,_0x595117[_0xe6e4('0x3d')]);return db[_0xe6e4('0x29')][_0xe6e4('0x45')](_0x1e6d26)[_0xe6e4('0x23')](handleEntityNotFound(_0x1032c0,null))[_0xe6e4('0x23')](respondWithResult(_0x1032c0,null))['catch'](handleError(_0x1032c0,null));};exports['create']=function(_0x143a22,_0x8b56fa){return db[_0xe6e4('0x29')][_0xe6e4('0x46')](_0x143a22['body'],{})['then'](function(_0x1b62eb){var _0x36185b=_0x143a22[_0xe6e4('0x47')][_0xe6e4('0x24')]({'plain':!![]});if(!_0x36185b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36185b[_0xe6e4('0x48')]==='user'){var _0x2cfa69=_0x1b62eb[_0xe6e4('0x24')]({'plain':!![]});var _0xd59646='Triggers';return db[_0xe6e4('0x49')]['find']({'where':{'name':_0xd59646,'userProfileId':_0x36185b[_0xe6e4('0x4a')]},'raw':!![]})[_0xe6e4('0x23')](function(_0x35c355){if(_0x35c355&&_0x35c355['autoAssociation']===0x0){return db[_0xe6e4('0x25')][_0xe6e4('0x46')]({'name':_0x2cfa69[_0xe6e4('0x2f')],'resourceId':_0x2cfa69['id'],'type':_0x35c355[_0xe6e4('0x2f')],'sectionId':_0x35c355['id']},{})[_0xe6e4('0x23')](function(){return _0x1b62eb;});}else{return _0x1b62eb;}})[_0xe6e4('0x42')](function(_0x53e919){logger['error'](_0xe6e4('0x4b'),_0x53e919);throw _0x53e919;});}return _0x1b62eb;})['then'](respondWithResult(_0x8b56fa,0xc9))[_0xe6e4('0x42')](handleError(_0x8b56fa,null));};exports[_0xe6e4('0x22')]=function(_0x24a33c,_0x1ffb5a){if(_0x24a33c[_0xe6e4('0x4c')]['id']){delete _0x24a33c[_0xe6e4('0x4c')]['id'];}return db[_0xe6e4('0x29')]['find']({'where':{'id':_0x24a33c['params']['id']}})[_0xe6e4('0x23')](handleEntityNotFound(_0x1ffb5a,null))[_0xe6e4('0x23')](saveUpdates(_0x24a33c[_0xe6e4('0x4c')],null))[_0xe6e4('0x23')](respondWithResult(_0x1ffb5a,null))[_0xe6e4('0x42')](handleError(_0x1ffb5a,null));};exports[_0xe6e4('0x26')]=function(_0x54e538,_0x1b29e0){return db[_0xe6e4('0x29')]['find']({'where':{'id':_0x54e538['params']['id']}})['then'](handleEntityNotFound(_0x1b29e0,null))[_0xe6e4('0x23')](removeEntity(_0x1b29e0,null))[_0xe6e4('0x42')](handleError(_0x1b29e0,null));};exports['addAllCondition']=function(_0x113a10,_0x2a64cf,_0xf796ef){if(_0x113a10[_0xe6e4('0x4c')]['id']){delete _0x113a10['body']['id'];}return db[_0xe6e4('0x29')][_0xe6e4('0x45')]({'where':{'id':_0x113a10['params']['id']}})[_0xe6e4('0x23')](handleEntityNotFound(_0x2a64cf,null))[_0xe6e4('0x23')](function(_0x29675c){if(_0x29675c){_0x113a10[_0xe6e4('0x4c')][_0xe6e4('0x4d')]=_0x29675c['id'];return db['Condition']['create'](_0x113a10[_0xe6e4('0x4c')]);}})[_0xe6e4('0x23')](respondWithResult(_0x2a64cf,null))[_0xe6e4('0x42')](handleError(_0x2a64cf,null));};exports['addAnyCondition']=function(_0x5eb9a7,_0xd9576,_0x1bdd9d){if(_0x5eb9a7[_0xe6e4('0x4c')]['id']){delete _0x5eb9a7['body']['id'];}return db[_0xe6e4('0x29')]['find']({'where':{'id':_0x5eb9a7[_0xe6e4('0x43')]['id']}})[_0xe6e4('0x23')](handleEntityNotFound(_0xd9576,null))[_0xe6e4('0x23')](function(_0x1cddb1){if(_0x1cddb1){_0x5eb9a7[_0xe6e4('0x4c')]['TriggerAnyId']=_0x1cddb1['id'];return db[_0xe6e4('0x4e')][_0xe6e4('0x46')](_0x5eb9a7[_0xe6e4('0x4c')]);}})[_0xe6e4('0x23')](respondWithResult(_0xd9576,null))[_0xe6e4('0x42')](handleError(_0xd9576,null));};exports[_0xe6e4('0x4f')]=function(_0x3ab9de,_0x1035b9,_0x2f65e4){var _0x4239a0={};var _0x1b9a15={};var _0x1b77e8;var _0x16335f;return db['Trigger'][_0xe6e4('0x50')]({'where':{'id':_0x3ab9de[_0xe6e4('0x43')]['id']}})['then'](handleEntityNotFound(_0x1035b9,null))[_0xe6e4('0x23')](function(_0x5a9e82){if(_0x5a9e82){_0x1b77e8=_0x5a9e82;_0x1b9a15[_0xe6e4('0x2d')]=_[_0xe6e4('0x44')](db['Condition'][_0xe6e4('0x2a')]);_0x1b9a15[_0xe6e4('0x30')]=_[_0xe6e4('0x44')](_0x3ab9de[_0xe6e4('0x30')]);_0x1b9a15[_0xe6e4('0x31')]=_[_0xe6e4('0x32')](_0x1b9a15['model'],_0x1b9a15['query']);_0x4239a0['attributes']=_['intersection'](_0x1b9a15[_0xe6e4('0x2d')],qs[_0xe6e4('0x33')](_0x3ab9de[_0xe6e4('0x30')][_0xe6e4('0x33')]));_0x4239a0[_0xe6e4('0x34')]=_0x4239a0[_0xe6e4('0x34')]['length']?_0x4239a0['attributes']:_0x1b9a15[_0xe6e4('0x2d')];_0x4239a0[_0xe6e4('0x51')]=qs[_0xe6e4('0x37')](_0x3ab9de[_0xe6e4('0x30')][_0xe6e4('0x37')]);_0x4239a0[_0xe6e4('0x3a')]=qs['filters'](_[_0xe6e4('0x38')](_0x3ab9de[_0xe6e4('0x30')],_0x1b9a15[_0xe6e4('0x31')]));if(_0x3ab9de[_0xe6e4('0x30')]['filter']){_0x4239a0[_0xe6e4('0x3a')]=_[_0xe6e4('0x3c')](_0x4239a0['where'],{'$or':_[_0xe6e4('0x2e')](_0x4239a0[_0xe6e4('0x34')],function(_0x3b38d9){var _0x27ba89={};_0x27ba89[_0x3b38d9]={'$like':'%'+_0x3ab9de[_0xe6e4('0x30')][_0xe6e4('0x39')]+'%'};return _0x27ba89;})});}_0x4239a0=_['merge']({},_0x4239a0,_0x3ab9de[_0xe6e4('0x3d')]);return _0x1b77e8[_0xe6e4('0x4f')](_0x4239a0);}})[_0xe6e4('0x23')](function(_0x44058d){if(_0x44058d){_0x16335f=_0x44058d[_0xe6e4('0x35')];if(!_0x3ab9de[_0xe6e4('0x30')][_0xe6e4('0x52')](_0xe6e4('0x36'))){_0x4239a0['limit']=qs['limit'](_0x3ab9de['query'][_0xe6e4('0x1c')]);_0x4239a0[_0xe6e4('0x1a')]=qs[_0xe6e4('0x1a')](_0x3ab9de[_0xe6e4('0x30')][_0xe6e4('0x1a')]);}return _0x1b77e8[_0xe6e4('0x4f')](_0x4239a0);}})[_0xe6e4('0x23')](function(_0x447096){if(_0x447096){return _0x447096?{'count':_0x16335f,'rows':_0x447096}:null;}})['then'](respondWithResult(_0x1035b9,null))[_0xe6e4('0x42')](handleError(_0x1035b9,null));};exports['getAnyConditions']=function(_0xeee9e6,_0x25d94d,_0x3df8f7){var _0x1996cb={};var _0x15ab53={};var _0x225230;var _0x1d3731;return db[_0xe6e4('0x29')][_0xe6e4('0x50')]({'where':{'id':_0xeee9e6['params']['id']}})[_0xe6e4('0x23')](handleEntityNotFound(_0x25d94d,null))[_0xe6e4('0x23')](function(_0x5ac186){if(_0x5ac186){_0x225230=_0x5ac186;_0x15ab53['model']=_[_0xe6e4('0x44')](db[_0xe6e4('0x4e')][_0xe6e4('0x2a')]);_0x15ab53[_0xe6e4('0x30')]=_[_0xe6e4('0x44')](_0xeee9e6[_0xe6e4('0x30')]);_0x15ab53['filters']=_[_0xe6e4('0x32')](_0x15ab53['model'],_0x15ab53[_0xe6e4('0x30')]);_0x1996cb[_0xe6e4('0x34')]=_[_0xe6e4('0x32')](_0x15ab53[_0xe6e4('0x2d')],qs['fields'](_0xeee9e6[_0xe6e4('0x30')][_0xe6e4('0x33')]));_0x1996cb[_0xe6e4('0x34')]=_0x1996cb[_0xe6e4('0x34')][_0xe6e4('0x35')]?_0x1996cb[_0xe6e4('0x34')]:_0x15ab53['model'];_0x1996cb[_0xe6e4('0x51')]=qs[_0xe6e4('0x37')](_0xeee9e6[_0xe6e4('0x30')]['sort']);_0x1996cb['where']=qs[_0xe6e4('0x31')](_['pick'](_0xeee9e6['query'],_0x15ab53[_0xe6e4('0x31')]));if(_0xeee9e6[_0xe6e4('0x30')][_0xe6e4('0x39')]){_0x1996cb[_0xe6e4('0x3a')]=_[_0xe6e4('0x3c')](_0x1996cb[_0xe6e4('0x3a')],{'$or':_[_0xe6e4('0x2e')](_0x1996cb[_0xe6e4('0x34')],function(_0x5d37eb){var _0x1d04bb={};_0x1d04bb[_0x5d37eb]={'$like':'%'+_0xeee9e6[_0xe6e4('0x30')]['filter']+'%'};return _0x1d04bb;})});}_0x1996cb=_[_0xe6e4('0x3c')]({},_0x1996cb,_0xeee9e6[_0xe6e4('0x3d')]);return _0x225230[_0xe6e4('0x53')](_0x1996cb);}})[_0xe6e4('0x23')](function(_0x2c8a54){if(_0x2c8a54){_0x1d3731=_0x2c8a54['length'];if(!_0xeee9e6[_0xe6e4('0x30')][_0xe6e4('0x52')](_0xe6e4('0x36'))){_0x1996cb[_0xe6e4('0x1c')]=qs[_0xe6e4('0x1c')](_0xeee9e6[_0xe6e4('0x30')]['limit']);_0x1996cb[_0xe6e4('0x1a')]=qs[_0xe6e4('0x1a')](_0xeee9e6[_0xe6e4('0x30')][_0xe6e4('0x1a')]);}return _0x225230[_0xe6e4('0x53')](_0x1996cb);}})['then'](function(_0x3f3025){if(_0x3f3025){return _0x3f3025?{'count':_0x1d3731,'rows':_0x3f3025}:null;}})[_0xe6e4('0x23')](respondWithResult(_0x25d94d,null))[_0xe6e4('0x42')](handleError(_0x25d94d,null));};exports['addAction']=function(_0x2dc978,_0x161ff9,_0x3430fc){if(_0x2dc978['body']['id']){delete _0x2dc978['body']['id'];}return db['Trigger'][_0xe6e4('0x45')]({'where':{'id':_0x2dc978[_0xe6e4('0x43')]['id']}})[_0xe6e4('0x23')](handleEntityNotFound(_0x161ff9,null))[_0xe6e4('0x23')](function(_0x16ca93){if(_0x16ca93){_0x2dc978['body']['TriggerId']=_0x16ca93['id'];return db[_0xe6e4('0x54')][_0xe6e4('0x46')](_0x2dc978['body']);}})[_0xe6e4('0x23')](respondWithResult(_0x161ff9,null))['catch'](handleError(_0x161ff9,null));};exports[_0xe6e4('0x55')]=function(_0x47a5b1,_0x1309f5,_0x1235e4){var _0x3bcd07={};var _0x51d5f3={};var _0x2a29aa;var _0x291b5d;return db[_0xe6e4('0x29')][_0xe6e4('0x50')]({'where':{'id':_0x47a5b1['params']['id']}})[_0xe6e4('0x23')](handleEntityNotFound(_0x1309f5,null))[_0xe6e4('0x23')](function(_0x5751ef){if(_0x5751ef){_0x2a29aa=_0x5751ef;_0x51d5f3[_0xe6e4('0x2d')]=_['keys'](db[_0xe6e4('0x54')]['rawAttributes']);_0x51d5f3['query']=_[_0xe6e4('0x44')](_0x47a5b1[_0xe6e4('0x30')]);_0x51d5f3[_0xe6e4('0x31')]=_[_0xe6e4('0x32')](_0x51d5f3[_0xe6e4('0x2d')],_0x51d5f3['query']);_0x3bcd07[_0xe6e4('0x34')]=_[_0xe6e4('0x32')](_0x51d5f3[_0xe6e4('0x2d')],qs['fields'](_0x47a5b1[_0xe6e4('0x30')][_0xe6e4('0x33')]));_0x3bcd07[_0xe6e4('0x34')]=_0x3bcd07[_0xe6e4('0x34')][_0xe6e4('0x35')]?_0x3bcd07[_0xe6e4('0x34')]:_0x51d5f3['model'];_0x3bcd07['order']=qs[_0xe6e4('0x37')](_0x47a5b1[_0xe6e4('0x30')][_0xe6e4('0x37')]);_0x3bcd07[_0xe6e4('0x3a')]=qs[_0xe6e4('0x31')](_[_0xe6e4('0x38')](_0x47a5b1['query'],_0x51d5f3[_0xe6e4('0x31')]));if(_0x47a5b1[_0xe6e4('0x30')][_0xe6e4('0x39')]){_0x3bcd07[_0xe6e4('0x3a')]=_['merge'](_0x3bcd07[_0xe6e4('0x3a')],{'$or':_[_0xe6e4('0x2e')](_0x3bcd07[_0xe6e4('0x34')],function(_0x2c9ab9){var _0x54159e={};_0x54159e[_0x2c9ab9]={'$like':'%'+_0x47a5b1[_0xe6e4('0x30')]['filter']+'%'};return _0x54159e;})});}_0x3bcd07=_[_0xe6e4('0x3c')]({},_0x3bcd07,_0x47a5b1[_0xe6e4('0x3d')]);return _0x2a29aa[_0xe6e4('0x55')](_0x3bcd07);}})[_0xe6e4('0x23')](function(_0x33cd79){if(_0x33cd79){_0x291b5d=_0x33cd79[_0xe6e4('0x35')];if(!_0x47a5b1[_0xe6e4('0x30')]['hasOwnProperty']('nolimit')){_0x3bcd07[_0xe6e4('0x1c')]=qs[_0xe6e4('0x1c')](_0x47a5b1[_0xe6e4('0x30')][_0xe6e4('0x1c')]);_0x3bcd07[_0xe6e4('0x1a')]=qs[_0xe6e4('0x1a')](_0x47a5b1[_0xe6e4('0x30')][_0xe6e4('0x1a')]);}return _0x2a29aa['getActions'](_0x3bcd07);}})['then'](function(_0x263da1){if(_0x263da1){return _0x263da1?{'count':_0x291b5d,'rows':_0x263da1}:null;}})[_0xe6e4('0x23')](respondWithResult(_0x1309f5,null))[_0xe6e4('0x42')](handleError(_0x1309f5,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index df2d0d0..932628f 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 _0x6e16=['exports','Trigger','tools_triggers','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0xcafa4b,_0x572040){var _0x4e3260=function(_0xfa5aba){while(--_0xfa5aba){_0xcafa4b['push'](_0xcafa4b['shift']());}};_0x4e3260(++_0x572040);}(_0x6e16,0x1d3));var _0x66e1=function(_0x4f0539,_0x356db0){_0x4f0539=_0x4f0539-0x0;var _0x1f45d9=_0x6e16[_0x4f0539];return _0x1f45d9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x66e1('0x0'))('api');var moment=require(_0x66e1('0x1'));var BPromise=require('bluebird');var rp=require(_0x66e1('0x2'));var fs=require('fs');var path=require(_0x66e1('0x3'));var rimraf=require('rimraf');var config=require(_0x66e1('0x4'));var attributes=require('./trigger.attributes');module[_0x66e1('0x5')]=function(_0x204db8,_0x3f95fa){return _0x204db8['define'](_0x66e1('0x6'),attributes,{'tableName':_0x66e1('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d92=['rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','api','moment','request-promise','path'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x9d92,0xdf));var _0x29d9=function(_0x490be3,_0xf0fca3){_0x490be3=_0x490be3-0x0;var _0x3f5140=_0x9d92[_0x490be3];return _0x3f5140;};'use strict';var _=require(_0x29d9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x29d9('0x1'));var moment=require(_0x29d9('0x2'));var BPromise=require('bluebird');var rp=require(_0x29d9('0x3'));var fs=require('fs');var path=require(_0x29d9('0x4'));var rimraf=require(_0x29d9('0x5'));var config=require(_0x29d9('0x6'));var attributes=require(_0x29d9('0x7'));module[_0x29d9('0x8')]=function(_0x27d032,_0x52932b){return _0x27d032[_0x29d9('0x9')](_0x29d9('0xa'),attributes,{'tableName':_0x29d9('0xb'),'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 b219a5e..dd4ce8b 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 _0x1cf5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','code','Trigger,\x20%s,\x20%s','error','message','result','catch','GetTrigger','Trigger','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowTrigger','find','lodash','util','moment','bluebird','randomstring'];(function(_0x58d6f1,_0x1c3944){var _0x269bbe=function(_0x39a423){while(--_0x39a423){_0x58d6f1['push'](_0x58d6f1['shift']());}};_0x269bbe(++_0x1c3944);}(_0x1cf5,0xaf));var _0x51cf=function(_0x50d2a0,_0x13168b){_0x50d2a0=_0x50d2a0-0x0;var _0x11fe24=_0x1cf5[_0x50d2a0];return _0x11fe24;};'use strict';var _=require(_0x51cf('0x0'));var util=require(_0x51cf('0x1'));var moment=require(_0x51cf('0x2'));var BPromise=require(_0x51cf('0x3'));var rs=require(_0x51cf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51cf('0x5'))['db'];var utils=require(_0x51cf('0x6'));var logger=require(_0x51cf('0x7'))(_0x51cf('0x8'));var config=require(_0x51cf('0x9'));var jayson=require(_0x51cf('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb456c9,_0x20e16e,_0xfd7b35){return new BPromise(function(_0x3524dd,_0xb8a71a){return client[_0x51cf('0xb')](_0xb456c9,_0xfd7b35)[_0x51cf('0xc')](function(_0x18d52a){logger[_0x51cf('0xd')]('Trigger,\x20%s,\x20%s',_0x20e16e,_0x51cf('0xe'));logger['debug'](_0x51cf('0xf'),_0x20e16e,'request\x20sent',JSON['stringify'](_0x18d52a));if(_0x18d52a['error']){if(_0x18d52a['error'][_0x51cf('0x10')]===0x1f4){logger['error'](_0x51cf('0x11'),_0x20e16e,_0x18d52a[_0x51cf('0x12')]['message']);return _0xb8a71a(_0x18d52a[_0x51cf('0x12')][_0x51cf('0x13')]);}logger[_0x51cf('0x12')](_0x51cf('0x11'),_0x20e16e,_0x18d52a[_0x51cf('0x12')]['message']);return _0x3524dd(_0x18d52a[_0x51cf('0x12')]['message']);}else{logger[_0x51cf('0xd')](_0x51cf('0x11'),_0x20e16e,_0x51cf('0xe'));_0x3524dd(_0x18d52a[_0x51cf('0x14')][_0x51cf('0x13')]);}})[_0x51cf('0x15')](function(_0x30dfb4){logger[_0x51cf('0x12')](_0x51cf('0x11'),_0x20e16e,_0x30dfb4);_0xb8a71a(_0x30dfb4);});});}exports[_0x51cf('0x16')]=function(_0x38f59f){var _0x22dc71=this;return new Promise(function(_0x2eaf21,_0x585a01){return db[_0x51cf('0x17')]['findAll']({'raw':_0x38f59f[_0x51cf('0x18')]?_0x38f59f[_0x51cf('0x18')][_0x51cf('0x19')]===undefined?!![]:![]:!![],'where':_0x38f59f[_0x51cf('0x18')]?_0x38f59f[_0x51cf('0x18')][_0x51cf('0x1a')]||null:null,'attributes':_0x38f59f[_0x51cf('0x18')]?_0x38f59f[_0x51cf('0x18')][_0x51cf('0x1b')]||null:null,'limit':_0x38f59f['options']?_0x38f59f[_0x51cf('0x18')][_0x51cf('0x1c')]||null:null,'include':_0x38f59f[_0x51cf('0x18')]?_0x38f59f['options'][_0x51cf('0x1d')]?_['map'](_0x38f59f[_0x51cf('0x18')][_0x51cf('0x1d')],function(_0x21b32f){return{'model':db[_0x21b32f['model']],'as':_0x21b32f['as'],'attributes':_0x21b32f[_0x51cf('0x1b')],'include':_0x21b32f[_0x51cf('0x1d')]?_[_0x51cf('0x1e')](_0x21b32f[_0x51cf('0x1d')],function(_0x333a3a){return{'model':db[_0x333a3a[_0x51cf('0x1f')]],'as':_0x333a3a['as'],'attributes':_0x333a3a[_0x51cf('0x1b')],'include':_0x333a3a[_0x51cf('0x1d')]?_['map'](_0x333a3a[_0x51cf('0x1d')],function(_0x5b4970){return{'model':db[_0x5b4970['model']],'as':_0x5b4970['as'],'attributes':_0x5b4970[_0x51cf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x51cf('0xc')](function(_0x4802c7){logger[_0x51cf('0xd')]('GetTrigger',_0x38f59f);logger[_0x51cf('0x20')]('GetTrigger',_0x38f59f,JSON[_0x51cf('0x21')](_0x4802c7));_0x2eaf21(_0x4802c7);})[_0x51cf('0x15')](function(_0x5b48a5){logger[_0x51cf('0x12')](_0x51cf('0x16'),_0x5b48a5['message'],_0x38f59f);_0x585a01(_0x22dc71[_0x51cf('0x12')](0x1f4,_0x5b48a5[_0x51cf('0x13')]));});});};exports[_0x51cf('0x22')]=function(_0x3018e1){var _0x646d91=this;return new Promise(function(_0x706c63,_0x4270f6){return db['Trigger'][_0x51cf('0x23')]({'raw':_0x3018e1[_0x51cf('0x18')]?_0x3018e1[_0x51cf('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3018e1[_0x51cf('0x18')]?_0x3018e1[_0x51cf('0x18')][_0x51cf('0x1a')]||null:null,'attributes':_0x3018e1[_0x51cf('0x18')]?_0x3018e1['options']['attributes']||null:null,'include':_0x3018e1[_0x51cf('0x18')]?_0x3018e1[_0x51cf('0x18')][_0x51cf('0x1d')]?_[_0x51cf('0x1e')](_0x3018e1[_0x51cf('0x18')][_0x51cf('0x1d')],function(_0x2ea53d){return{'model':db[_0x2ea53d['model']],'as':_0x2ea53d['as'],'attributes':_0x2ea53d[_0x51cf('0x1b')],'include':_0x2ea53d['include']?_['map'](_0x2ea53d[_0x51cf('0x1d')],function(_0x4b7123){return{'model':db[_0x4b7123[_0x51cf('0x1f')]],'as':_0x4b7123['as'],'attributes':_0x4b7123[_0x51cf('0x1b')],'include':_0x4b7123[_0x51cf('0x1d')]?_[_0x51cf('0x1e')](_0x4b7123[_0x51cf('0x1d')],function(_0x1d3335){return{'model':db[_0x1d3335['model']],'as':_0x1d3335['as'],'attributes':_0x1d3335[_0x51cf('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x595b6a){logger[_0x51cf('0xd')](_0x51cf('0x22'),_0x3018e1);logger[_0x51cf('0x20')](_0x51cf('0x22'),_0x3018e1,JSON[_0x51cf('0x21')](_0x595b6a));_0x706c63(_0x595b6a);})[_0x51cf('0x15')](function(_0x3e7f1f){logger['error'](_0x51cf('0x22'),_0x3e7f1f['message'],_0x3018e1);_0x4270f6(_0x646d91[_0x51cf('0x12')](0x1f4,_0x3e7f1f['message']));});});}; \ No newline at end of file +var _0x9375=['../../config/environment','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowTrigger','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x16eb69,_0x4effb4){var _0x8e5e6b=function(_0x3e5da2){while(--_0x3e5da2){_0x16eb69['push'](_0x16eb69['shift']());}};_0x8e5e6b(++_0x4effb4);}(_0x9375,0x169));var _0x5937=function(_0x3105a7,_0x4696d4){_0x3105a7=_0x3105a7-0x0;var _0x4eb210=_0x9375[_0x3105a7];return _0x4eb210;};'use strict';var _=require(_0x5937('0x0'));var util=require(_0x5937('0x1'));var moment=require(_0x5937('0x2'));var BPromise=require(_0x5937('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5937('0x4'));var db=require(_0x5937('0x5'))['db'];var utils=require(_0x5937('0x6'));var logger=require(_0x5937('0x7'))(_0x5937('0x8'));var config=require(_0x5937('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5937('0xa')][_0x5937('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3eeb1e,_0x69d002,_0x135440){return new BPromise(function(_0x496a2f,_0x5ec528){return client[_0x5937('0xc')](_0x3eeb1e,_0x135440)[_0x5937('0xd')](function(_0x3e22a2){logger[_0x5937('0xe')](_0x5937('0xf'),_0x69d002,_0x5937('0x10'));logger[_0x5937('0x11')]('Trigger,\x20%s,\x20%s,\x20%s',_0x69d002,_0x5937('0x10'),JSON['stringify'](_0x3e22a2));if(_0x3e22a2['error']){if(_0x3e22a2[_0x5937('0x12')][_0x5937('0x13')]===0x1f4){logger[_0x5937('0x12')](_0x5937('0xf'),_0x69d002,_0x3e22a2[_0x5937('0x12')][_0x5937('0x14')]);return _0x5ec528(_0x3e22a2[_0x5937('0x12')][_0x5937('0x14')]);}logger[_0x5937('0x12')](_0x5937('0xf'),_0x69d002,_0x3e22a2[_0x5937('0x12')]['message']);return _0x496a2f(_0x3e22a2['error'][_0x5937('0x14')]);}else{logger[_0x5937('0xe')](_0x5937('0xf'),_0x69d002,'request\x20sent');_0x496a2f(_0x3e22a2[_0x5937('0x15')][_0x5937('0x14')]);}})[_0x5937('0x16')](function(_0x307dae){logger[_0x5937('0x12')](_0x5937('0xf'),_0x69d002,_0x307dae);_0x5ec528(_0x307dae);});});}exports[_0x5937('0x17')]=function(_0xb856f2){var _0x2cdce1=this;return new Promise(function(_0x1a9e51,_0x1414b9){return db[_0x5937('0x18')][_0x5937('0x19')]({'raw':_0xb856f2[_0x5937('0x1a')]?_0xb856f2[_0x5937('0x1a')][_0x5937('0x1b')]===undefined?!![]:![]:!![],'where':_0xb856f2[_0x5937('0x1a')]?_0xb856f2[_0x5937('0x1a')][_0x5937('0x1c')]||null:null,'attributes':_0xb856f2[_0x5937('0x1a')]?_0xb856f2[_0x5937('0x1a')][_0x5937('0x1d')]||null:null,'limit':_0xb856f2['options']?_0xb856f2['options'][_0x5937('0x1e')]||null:null,'include':_0xb856f2[_0x5937('0x1a')]?_0xb856f2[_0x5937('0x1a')][_0x5937('0x1f')]?_[_0x5937('0x20')](_0xb856f2[_0x5937('0x1a')][_0x5937('0x1f')],function(_0x2875b2){return{'model':db[_0x2875b2[_0x5937('0x21')]],'as':_0x2875b2['as'],'attributes':_0x2875b2['attributes'],'include':_0x2875b2[_0x5937('0x1f')]?_[_0x5937('0x20')](_0x2875b2['include'],function(_0x493833){return{'model':db[_0x493833[_0x5937('0x21')]],'as':_0x493833['as'],'attributes':_0x493833[_0x5937('0x1d')],'include':_0x493833['include']?_[_0x5937('0x20')](_0x493833[_0x5937('0x1f')],function(_0x1931e8){return{'model':db[_0x1931e8['model']],'as':_0x1931e8['as'],'attributes':_0x1931e8[_0x5937('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5937('0xd')](function(_0xcea0c8){logger['info'](_0x5937('0x17'),_0xb856f2);logger[_0x5937('0x11')](_0x5937('0x17'),_0xb856f2,JSON[_0x5937('0x22')](_0xcea0c8));_0x1a9e51(_0xcea0c8);})[_0x5937('0x16')](function(_0x526a5c){logger[_0x5937('0x12')](_0x5937('0x17'),_0x526a5c['message'],_0xb856f2);_0x1414b9(_0x2cdce1[_0x5937('0x12')](0x1f4,_0x526a5c[_0x5937('0x14')]));});});};exports[_0x5937('0x23')]=function(_0x198a51){var _0x5d943e=this;return new Promise(function(_0x35a31a,_0x96ef3){return db['Trigger'][_0x5937('0x24')]({'raw':_0x198a51[_0x5937('0x1a')]?_0x198a51[_0x5937('0x1a')][_0x5937('0x1b')]===undefined?!![]:![]:!![],'where':_0x198a51[_0x5937('0x1a')]?_0x198a51['options'][_0x5937('0x1c')]||null:null,'attributes':_0x198a51[_0x5937('0x1a')]?_0x198a51[_0x5937('0x1a')]['attributes']||null:null,'include':_0x198a51['options']?_0x198a51['options']['include']?_[_0x5937('0x20')](_0x198a51[_0x5937('0x1a')]['include'],function(_0x4acb44){return{'model':db[_0x4acb44[_0x5937('0x21')]],'as':_0x4acb44['as'],'attributes':_0x4acb44[_0x5937('0x1d')],'include':_0x4acb44[_0x5937('0x1f')]?_[_0x5937('0x20')](_0x4acb44[_0x5937('0x1f')],function(_0x3ac904){return{'model':db[_0x3ac904['model']],'as':_0x3ac904['as'],'attributes':_0x3ac904['attributes'],'include':_0x3ac904[_0x5937('0x1f')]?_[_0x5937('0x20')](_0x3ac904[_0x5937('0x1f')],function(_0x54d1b4){return{'model':db[_0x54d1b4[_0x5937('0x21')]],'as':_0x54d1b4['as'],'attributes':_0x54d1b4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x33d7a3){logger['info'](_0x5937('0x23'),_0x198a51);logger[_0x5937('0x11')](_0x5937('0x23'),_0x198a51,JSON[_0x5937('0x22')](_0x33d7a3));_0x35a31a(_0x33d7a3);})[_0x5937('0x16')](function(_0x43e1a5){logger[_0x5937('0x12')]('ShowTrigger',_0x43e1a5['message'],_0x198a51);_0x96ef3(_0x5d943e[_0x5937('0x12')](0x1f4,_0x43e1a5[_0x5937('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index e3a01f3..3f4f9b9 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 _0x092e=['show','post','clone','create','put','update','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','/:id'];(function(_0x3c9def,_0x5384ea){var _0x591e39=function(_0x38a6ba){while(--_0x38a6ba){_0x3c9def['push'](_0x3c9def['shift']());}};_0x591e39(++_0x5384ea);}(_0x092e,0xf2));var _0xe092=function(_0x34849c,_0x48c9f4){_0x34849c=_0x34849c-0x0;var _0x39162c=_0x092e[_0x34849c];return _0x39162c;};'use strict';var multer=require('multer');var util=require(_0xe092('0x0'));var path=require(_0xe092('0x1'));var timeout=require('connect-timeout');var express=require(_0xe092('0x2'));var router=express[_0xe092('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe092('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe092('0x5'));var controller=require(_0xe092('0x6'));router[_0xe092('0x7')]('/',auth[_0xe092('0x8')](),controller['index']);router['get'](_0xe092('0x9'),auth['isAuthenticated'](),controller[_0xe092('0xa')]);router[_0xe092('0xb')]('/:id/clone',auth[_0xe092('0x8')](),controller[_0xe092('0xc')]);router['post']('/',auth[_0xe092('0x8')](),controller[_0xe092('0xd')]);router[_0xe092('0xe')]('/:id',auth[_0xe092('0x8')](),controller[_0xe092('0xf')]);router['delete'](_0xe092('0x9'),auth[_0xe092('0x8')](),controller[_0xe092('0x10')]);module[_0xe092('0x11')]=router; \ No newline at end of file +var _0xdce8=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','/:id','isAuthenticated','show','post','/:id/clone','clone','create','put','update','delete','exports'];(function(_0x20409b,_0x512ea9){var _0x1e78c6=function(_0x413b72){while(--_0x413b72){_0x20409b['push'](_0x20409b['shift']());}};_0x1e78c6(++_0x512ea9);}(_0xdce8,0x150));var _0x8dce=function(_0x6b0475,_0x55b38f){_0x6b0475=_0x6b0475-0x0;var _0x288e70=_0xdce8[_0x6b0475];return _0x288e70;};'use strict';var multer=require(_0x8dce('0x0'));var util=require(_0x8dce('0x1'));var path=require(_0x8dce('0x2'));var timeout=require(_0x8dce('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8dce('0x4'));var auth=require(_0x8dce('0x5'));var interaction=require(_0x8dce('0x6'));var config=require(_0x8dce('0x7'));var controller=require(_0x8dce('0x8'));router[_0x8dce('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8dce('0x9')](_0x8dce('0xa'),auth[_0x8dce('0xb')](),controller[_0x8dce('0xc')]);router[_0x8dce('0xd')](_0x8dce('0xe'),auth[_0x8dce('0xb')](),controller[_0x8dce('0xf')]);router['post']('/',auth[_0x8dce('0xb')](),controller[_0x8dce('0x10')]);router[_0x8dce('0x11')](_0x8dce('0xa'),auth[_0x8dce('0xb')](),controller[_0x8dce('0x12')]);router[_0x8dce('0x13')](_0x8dce('0xa'),auth[_0x8dce('0xb')](),controller['destroy']);module[_0x8dce('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 0070382..862b8ae 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 _0x0d36=['from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','originate','uac','uas','pai','fingerprint','certificate','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','ENUM','friend','user','peer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0d36,0x95));var _0x60d3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0d36[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x60d3('0x0'));module[_0x60d3('0x1')]={'name':{'type':Sequelize[_0x60d3('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x4'),_0x60d3('0x5'),_0x60d3('0x6')),'allowNull':![],'defaultValue':_0x60d3('0x4')},'context':{'type':Sequelize[_0x60d3('0x2')],'allowNull':![],'defaultValue':_0x60d3('0x7')},'callingpres':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x8'),_0x60d3('0x9'),'ALLOWED_FAILED_SCREEN',_0x60d3('0xa'),_0x60d3('0xb'),_0x60d3('0xc'),_0x60d3('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0x60d3('0x2')]},'permit':{'type':Sequelize[_0x60d3('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x60d3('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x60d3('0x2')],'defaultValue':_0x60d3('0xe'),'set':function(_0x387d78){this[_0x60d3('0xf')](_0x60d3('0x10'),_0x387d78?_0x387d78['join'](','):null);},'get':function(){return this['getDataValue'](_0x60d3('0x10'))?this[_0x60d3('0x11')]('transport')[_0x60d3('0x12')](','):null;},'comment':_0x60d3('0x13')},'dtmfmode':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x14'),_0x60d3('0x15'),_0x60d3('0x16'),_0x60d3('0x17'),_0x60d3('0x18')),'defaultValue':_0x60d3('0x14')},'directmedia':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no','nonat',_0x60d3('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x60d3('0x2')]},'directmediadeny':{'type':Sequelize[_0x60d3('0x2')]},'nat':{'type':Sequelize[_0x60d3('0x2')],'defaultValue':_0x60d3('0x1b'),'set':function(_0x323df1){this[_0x60d3('0xf')](_0x60d3('0x1c'),_0x323df1?_0x323df1[_0x60d3('0x1d')](','):null);},'get':function(){return this[_0x60d3('0x11')]('nat')?this[_0x60d3('0x11')]('nat')[_0x60d3('0x12')](','):null;},'comment':_0x60d3('0x1e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x60d3('0x2')]},'pickupgroup':{'type':Sequelize[_0x60d3('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x60d3('0x2')]},'language':{'type':Sequelize[_0x60d3('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x60d3('0x1f'),'set':function(_0x1388d0){this['setDataValue']('allow',_0x1388d0?_0x1388d0['join'](';'):_0x60d3('0x1f'));},'get':function(){return this[_0x60d3('0x11')](_0x60d3('0x20'))?this[_0x60d3('0x11')](_0x60d3('0x20'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'insecure':{'type':Sequelize[_0x60d3('0x2')],'defaultValue':_0x60d3('0x21'),'set':function(_0x1da877){this[_0x60d3('0xf')](_0x60d3('0x22'),_0x1da877?_0x1da877['join'](','):null);},'get':function(){return this[_0x60d3('0x11')](_0x60d3('0x22'))?this[_0x60d3('0x11')](_0x60d3('0x22'))[_0x60d3('0x12')](','):null;},'comment':_0x60d3('0x23')},'trustrpid':{'type':Sequelize[_0x60d3('0x3')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no',_0x60d3('0x24'))},'promiscredir':{'type':Sequelize['ENUM'](_0x60d3('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'accountcode':{'type':Sequelize[_0x60d3('0x25')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x60d3('0x2')],'defaultValue':_0x60d3('0x26')},'amaflags':{'type':Sequelize[_0x60d3('0x2')]},'callcounter':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no'),'defaultValue':_0x60d3('0x19')},'busylevel':{'type':Sequelize[_0x60d3('0x25')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x60d3('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x60d3('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize[_0x60d3('0x2')]},'template':{'type':Sequelize[_0x60d3('0x2')]},'videosupport':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no',_0x60d3('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x60d3('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'mailbox':{'type':Sequelize[_0x60d3('0x2')]},'session_timers':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x28'),'refuse',_0x60d3('0x29'))},'session_expires':{'type':Sequelize[_0x60d3('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x60d3('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x2a'),_0x60d3('0x2b')),'defaultValue':_0x60d3('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x60d3('0x2')]},'regexten':{'type':Sequelize[_0x60d3('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x60d3('0x2')]},'port':{'type':Sequelize[_0x60d3('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x60d3('0x19')},'keepalive':{'type':Sequelize[_0x60d3('0x25')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x60d3('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x60d3('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x60d3('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no',_0x60d3('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x60d3('0x2')]},'callbackextension':{'type':Sequelize[_0x60d3('0x2')]},'timert1':{'type':Sequelize[_0x60d3('0x25')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x60d3('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x60d3('0x2')]},'contactdeny':{'type':Sequelize[_0x60d3('0x2')]},'contactacl':{'type':Sequelize[_0x60d3('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x60d3('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x60d3('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'force_avp':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x60d3('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no',_0x60d3('0x2d'),_0x60d3('0x2e'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0x60d3('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x60d3('0x2')]},'dtlscafile':{'type':Sequelize[_0x60d3('0x2')]},'dtlscapath':{'type':Sequelize[_0x60d3('0x2')]},'dtlssetup':{'type':Sequelize[_0x60d3('0x3')]('active',_0x60d3('0x2f'),_0x60d3('0x30')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x60d3('0x2')]},'usereqphone':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x60d3('0x2')]},'recordofffeature':{'type':Sequelize[_0x60d3('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no')},'vmexten':{'type':Sequelize[_0x60d3('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x60d3('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x60d3('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x60d3('0x31')},'canreinvite':{'type':Sequelize[_0x60d3('0x3')](_0x60d3('0x19'),'no','nonat',_0x60d3('0x1a'),_0x60d3('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x60d3('0x2')]},'otherFields':{'type':Sequelize[_0x60d3('0x2')]},'active':{'type':Sequelize[_0x60d3('0x33')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x60d3('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x2cfc=['friend','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','inband','rfc2833','yes','outgoing','force_rport,comedia','nat','all','ulaw;alaw;gsm','setDataValue','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','always','refuse','originate','uac','uas','pai','fingerprint','passive','nonat','update','update,nonat','sequelize','STRING','name','ENUM'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2cfc,0x137));var _0xc2cf=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x2cfc[_0x1d24eb];return _0x1dc576;};'use strict';var Sequelize=require(_0xc2cf('0x0'));module['exports']={'name':{'type':Sequelize[_0xc2cf('0x1')],'allowNull':![],'unique':_0xc2cf('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc2cf('0x3')](_0xc2cf('0x4'),'user',_0xc2cf('0x5')),'allowNull':![],'defaultValue':_0xc2cf('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc2cf('0x6')},'callingpres':{'type':Sequelize[_0xc2cf('0x3')]('ALLOWED_NOT_SCREENED',_0xc2cf('0x7'),_0xc2cf('0x8'),_0xc2cf('0x9'),_0xc2cf('0xa'),_0xc2cf('0xb'),'PROHIB_FAILED_SCREEN',_0xc2cf('0xc'))},'deny':{'type':Sequelize[_0xc2cf('0x1')]},'permit':{'type':Sequelize[_0xc2cf('0x1')]},'secret':{'type':Sequelize[_0xc2cf('0x1')]},'md5secret':{'type':Sequelize[_0xc2cf('0x1')]},'remotesecret':{'type':Sequelize[_0xc2cf('0x1')]},'transport':{'type':Sequelize[_0xc2cf('0x1')],'defaultValue':'udp','set':function(_0x36c90b){this['setDataValue'](_0xc2cf('0xd'),_0x36c90b?_0x36c90b[_0xc2cf('0xe')](','):null);},'get':function(){return this[_0xc2cf('0xf')](_0xc2cf('0xd'))?this[_0xc2cf('0xf')](_0xc2cf('0xd'))['split'](','):null;},'comment':_0xc2cf('0x10')},'dtmfmode':{'type':Sequelize[_0xc2cf('0x3')]('rfc2833',_0xc2cf('0x11'),'shortinfo',_0xc2cf('0x12'),'auto'),'defaultValue':_0xc2cf('0x13')},'directmedia':{'type':Sequelize[_0xc2cf('0x3')](_0xc2cf('0x14'),'no','nonat','update',_0xc2cf('0x15')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc2cf('0x3')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc2cf('0x1')]},'directmediadeny':{'type':Sequelize[_0xc2cf('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xc2cf('0x16'),'set':function(_0x59e44a){this['setDataValue'](_0xc2cf('0x17'),_0x59e44a?_0x59e44a['join'](','):null);},'get':function(){return this[_0xc2cf('0xf')]('nat')?this[_0xc2cf('0xf')](_0xc2cf('0x17'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0xc2cf('0x1')]},'namedcallgroup':{'type':Sequelize[_0xc2cf('0x1')]},'pickupgroup':{'type':Sequelize[_0xc2cf('0x1')]},'namedpickupgroup':{'type':Sequelize[_0xc2cf('0x1')]},'language':{'type':Sequelize[_0xc2cf('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc2cf('0x1')],'defaultValue':_0xc2cf('0x18')},'allow':{'type':Sequelize[_0xc2cf('0x1')],'allowNull':![],'defaultValue':_0xc2cf('0x19'),'set':function(_0x5c8a7f){this[_0xc2cf('0x1a')](_0xc2cf('0x1b'),_0x5c8a7f?_0x5c8a7f[_0xc2cf('0xe')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xc2cf('0xf')](_0xc2cf('0x1b'))?this[_0xc2cf('0xf')](_0xc2cf('0x1b'))['split'](';'):null;},'comment':_0xc2cf('0x1c')},'autoframing':{'type':Sequelize[_0xc2cf('0x3')](_0xc2cf('0x14'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0xc2cf('0x1d'),'set':function(_0x1b6273){this['setDataValue'](_0xc2cf('0x1e'),_0x1b6273?_0x1b6273['join'](','):null);},'get':function(){return this[_0xc2cf('0xf')](_0xc2cf('0x1e'))?this[_0xc2cf('0xf')](_0xc2cf('0x1e'))[_0xc2cf('0x1f')](','):null;},'comment':_0xc2cf('0x20')},'trustrpid':{'type':Sequelize[_0xc2cf('0x3')](_0xc2cf('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc2cf('0x3')](_0xc2cf('0x14'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc2cf('0x3')]('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize[_0xc2cf('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0xc2cf('0x21')](0xb)},'setvar':{'type':Sequelize[_0xc2cf('0x1')]},'callerid':{'type':Sequelize[_0xc2cf('0x1')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xc2cf('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0xc2cf('0x14'),'no'),'defaultValue':_0xc2cf('0x14')},'busylevel':{'type':Sequelize[_0xc2cf('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0xc2cf('0x3')](_0xc2cf('0x14'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xc2cf('0x14'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xc2cf('0x1')]},'videosupport':{'type':Sequelize['ENUM'](_0xc2cf('0x14'),'no',_0xc2cf('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xc2cf('0x3')](_0xc2cf('0x14'),'no')},'mailbox':{'type':Sequelize[_0xc2cf('0x1')]},'session_timers':{'type':Sequelize[_0xc2cf('0x3')]('accept',_0xc2cf('0x23'),_0xc2cf('0x24'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xc2cf('0x3')](_0xc2cf('0x25'),_0xc2cf('0x26')),'defaultValue':_0xc2cf('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0xc2cf('0x1')]},'regexten':{'type':Sequelize[_0xc2cf('0x1')]},'fromdomain':{'type':Sequelize[_0xc2cf('0x1')]},'fromuser':{'type':Sequelize[_0xc2cf('0x1')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xc2cf('0x3')](_0xc2cf('0x14'),'no'),'defaultValue':_0xc2cf('0x14')},'keepalive':{'type':Sequelize[_0xc2cf('0x21')](0xb)},'defaultip':{'type':Sequelize[_0xc2cf('0x1')]},'defaultuser':{'type':Sequelize[_0xc2cf('0x1')]},'rtptimeout':{'type':Sequelize[_0xc2cf('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xc2cf('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xc2cf('0x14'),'no',_0xc2cf('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc2cf('0x1')]},'callbackextension':{'type':Sequelize[_0xc2cf('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xc2cf('0x21')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xc2cf('0x1')]},'contactdeny':{'type':Sequelize[_0xc2cf('0x1')]},'contactacl':{'type':Sequelize[_0xc2cf('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0xc2cf('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xc2cf('0x21')](0xb)},'encryption':{'type':Sequelize[_0xc2cf('0x3')](_0xc2cf('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc2cf('0x3')](_0xc2cf('0x14'),'no')},'force_avp':{'type':Sequelize[_0xc2cf('0x3')](_0xc2cf('0x14'),'no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0xc2cf('0x3')](_0xc2cf('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0xc2cf('0x3')](_0xc2cf('0x14'),'no',_0xc2cf('0x28'),'certificate')},'dtlsrekey':{'type':Sequelize[_0xc2cf('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0xc2cf('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xc2cf('0x1')]},'dtlscipher':{'type':Sequelize[_0xc2cf('0x1')]},'dtlscafile':{'type':Sequelize[_0xc2cf('0x1')]},'dtlscapath':{'type':Sequelize[_0xc2cf('0x1')]},'dtlssetup':{'type':Sequelize[_0xc2cf('0x3')]('active',_0xc2cf('0x29'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc2cf('0x1')]},'usereqphone':{'type':Sequelize['ENUM'](_0xc2cf('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xc2cf('0x1')]},'call_limit':{'type':Sequelize[_0xc2cf('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xc2cf('0x14'),'no')},'subscribemwi':{'type':Sequelize[_0xc2cf('0x3')](_0xc2cf('0x14'),'no')},'vmexten':{'type':Sequelize[_0xc2cf('0x1')]},'mohinterpret':{'type':Sequelize[_0xc2cf('0x1')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xc2cf('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0xc2cf('0x3')]('yes','no',_0xc2cf('0x2a'),_0xc2cf('0x2b'),_0xc2cf('0x2c')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc2cf('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc2cf('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 5a2b21a..54a30f3 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 _0x9a19=['query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','show','include','find','clone','params','omit','updatedAt','body','createdAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','autoAssociation','findAll','readFileSync','writeFileSync','Reload','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','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type'];(function(_0x36c230,_0x1c7cfd){var _0x321e0e=function(_0xf13413){while(--_0xf13413){_0x36c230['push'](_0x36c230['shift']());}};_0x321e0e(++_0x1c7cfd);}(_0x9a19,0x114));var _0x99a1=function(_0x4eafed,_0x26e2bc){_0x4eafed=_0x4eafed-0x0;var _0x159c85=_0x9a19[_0x4eafed];return _0x159c85;};'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'];var jayson=require(_0x99a1('0x19'));var client=jayson[_0x99a1('0x1a')][_0x99a1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xf713b9,_0x40c19c,_0x3a865c,_0x47815e){return new BPromise(function(_0xe1a1f,_0x3c9ef4){var _0x39ee55=_0x47815e||client;return _0x39ee55['request'](_0xf713b9,_0x3a865c)[_0x99a1('0x1c')](function(_0x3e45d4){logger[_0x99a1('0x1d')](_0x99a1('0x1e'),_0x40c19c,_0x99a1('0x1f'));logger[_0x99a1('0x20')](_0x99a1('0x21'),_0x40c19c,'request\x20sent',JSON['stringify'](_0x3e45d4));if(_0x3e45d4[_0x99a1('0x22')]){if(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x23')]===0x1f4){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);return _0x3c9ef4(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);}logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4['error'][_0x99a1('0x24')]);return _0xe1a1f(_0x3e45d4[_0x99a1('0x22')]['message']);}else{logger[_0x99a1('0x1d')]('Trunk,\x20%s,\x20%s',_0x40c19c,_0x99a1('0x1f'));_0xe1a1f(_0x3e45d4[_0x99a1('0x25')][_0x99a1('0x24')]);}})[_0x99a1('0x26')](function(_0x5a88c6){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x5a88c6);_0x3c9ef4(_0x5a88c6);});});}function respondWithStatusCode(_0x483c17,_0x44df2d){_0x44df2d=_0x44df2d||0xcc;return function(_0x5b5dfa){if(_0x5b5dfa){return _0x483c17[_0x99a1('0x27')](_0x44df2d);}return _0x483c17[_0x99a1('0x28')](_0x44df2d)[_0x99a1('0x29')]();};}function respondWithResult(_0xdaa27d,_0x3c813){_0x3c813=_0x3c813||0xc8;return function(_0x491341){if(_0x491341){return _0xdaa27d['status'](_0x3c813)[_0x99a1('0x2a')](_0x491341);}};}function respondWithFilteredResult(_0x5dabd9,_0x5dc733){return function(_0xafea84){if(_0xafea84){var _0x440879=typeof _0x5dc733[_0x99a1('0x2b')]===_0x99a1('0x2c')&&typeof _0x5dc733[_0x99a1('0x2d')]===_0x99a1('0x2c');var _0x183037=_0xafea84['count'];var _0xf41b0d=_0x440879?0x0:_0x5dc733['offset'];var _0x255197=_0x440879?_0xafea84[_0x99a1('0x2e')]:_0x5dc733[_0x99a1('0x2b')]+_0x5dc733['limit'];var _0x371edf;if(_0x255197>=_0x183037){_0x255197=_0x183037;_0x371edf=0xc8;}else{_0x371edf=0xce;}_0x5dabd9[_0x99a1('0x28')](_0x371edf);return _0x5dabd9['set'](_0x99a1('0x2f'),_0xf41b0d+'-'+_0x255197+'/'+_0x183037)[_0x99a1('0x2a')](_0xafea84);}return null;};}function patchUpdates(_0x36aa34){return function(_0x303d1e){try{jsonpatch[_0x99a1('0x30')](_0x303d1e,_0x36aa34,!![]);}catch(_0x969f6e){return BPromise[_0x99a1('0x31')](_0x969f6e);}return _0x303d1e[_0x99a1('0x32')]();};}function saveUpdates(_0x52da8d,_0x4960e4){return function(_0x3fa342){if(_0x3fa342){return _0x3fa342['update'](_0x52da8d)[_0x99a1('0x1c')](function(_0x400581){return _0x400581;});}return null;};}function removeEntity(_0x5b1a79,_0xa5972b){return function(_0x3503d5){if(_0x3503d5){return _0x3503d5[_0x99a1('0x33')]()[_0x99a1('0x1c')](function(){var _0x13f4db=_0x3503d5[_0x99a1('0x34')]({'plain':!![]});var _0x3081cd=_0x99a1('0x35');return db[_0x99a1('0x36')][_0x99a1('0x33')]({'where':{'type':_0x3081cd,'resourceId':_0x13f4db['id']}})[_0x99a1('0x1c')](function(){return _0x3503d5;});})[_0x99a1('0x1c')](function(){_0x5b1a79[_0x99a1('0x28')](0xcc)[_0x99a1('0x29')]();});}};}function handleEntityNotFound(_0x55005e,_0x53fed5){return function(_0x46e3f2){if(!_0x46e3f2){_0x55005e[_0x99a1('0x27')](0x194);}return _0x46e3f2;};}function handleError(_0x416a36,_0x4131e0){_0x4131e0=_0x4131e0||0x1f4;return function(_0x2690bd){logger[_0x99a1('0x22')](_0x2690bd[_0x99a1('0x37')]);if(_0x2690bd['name']){delete _0x2690bd[_0x99a1('0x38')];}_0x416a36[_0x99a1('0x28')](_0x4131e0)['send'](_0x2690bd);};}exports[_0x99a1('0x39')]=function(_0x2d328c,_0x391afa){var _0x3cd1a0={},_0x430cbc={},_0x399fd4={'count':0x0,'rows':[]};var _0x30e8a9=_[_0x99a1('0x3a')](db[_0x99a1('0x3b')][_0x99a1('0x3c')],function(_0x1da3e7){return{'name':_0x1da3e7[_0x99a1('0x3d')],'type':_0x1da3e7[_0x99a1('0x3e')]['key']};});_0x430cbc['model']=_['map'](_0x30e8a9,_0x99a1('0x38'));_0x430cbc[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x2d328c[_0x99a1('0x3f')]);_0x430cbc[_0x99a1('0x41')]=_['intersection'](_0x430cbc[_0x99a1('0x42')],_0x430cbc[_0x99a1('0x3f')]);_0x3cd1a0[_0x99a1('0x43')]=_['intersection'](_0x430cbc['model'],qs[_0x99a1('0x44')](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x3cd1a0['attributes']=_0x3cd1a0[_0x99a1('0x43')][_0x99a1('0x45')]?_0x3cd1a0[_0x99a1('0x43')]:_0x430cbc[_0x99a1('0x42')];if(!_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x46')](_0x99a1('0x47'))){_0x3cd1a0[_0x99a1('0x2d')]=qs[_0x99a1('0x2d')](_0x2d328c[_0x99a1('0x3f')]['limit']);_0x3cd1a0[_0x99a1('0x2b')]=qs[_0x99a1('0x2b')](_0x2d328c[_0x99a1('0x3f')]['offset']);}_0x3cd1a0[_0x99a1('0x48')]=qs['sort'](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x49')]);_0x3cd1a0[_0x99a1('0x4a')]=qs[_0x99a1('0x41')](_[_0x99a1('0x4b')](_0x2d328c[_0x99a1('0x3f')],_0x430cbc['filters']),_0x30e8a9);if(_0x2d328c[_0x99a1('0x3f')]['filter']){_0x3cd1a0[_0x99a1('0x4a')]=_[_0x99a1('0x4c')](_0x3cd1a0[_0x99a1('0x4a')],{'$or':_[_0x99a1('0x3a')](_0x30e8a9,function(_0x3a0b44){if(_0x3a0b44[_0x99a1('0x3e')]!==_0x99a1('0x4d')){var _0x3861b6={};_0x3861b6[_0x3a0b44[_0x99a1('0x38')]]={'$like':'%'+_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x4e')]+'%'};return _0x3861b6;}})});}_0x3cd1a0=_['merge']({},_0x3cd1a0,_0x2d328c[_0x99a1('0x4f')]);var _0x330e3b={'where':_0x3cd1a0['where']};return db[_0x99a1('0x3b')][_0x99a1('0x2e')](_0x330e3b)[_0x99a1('0x1c')](function(_0x2e377b){_0x399fd4[_0x99a1('0x2e')]=_0x2e377b;if(_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x50')]){_0x3cd1a0['include']=[{'all':!![]}];}return db[_0x99a1('0x3b')]['findAll'](_0x3cd1a0);})[_0x99a1('0x1c')](function(_0x269798){_0x399fd4['rows']=_0x269798;return _0x399fd4;})['then'](respondWithFilteredResult(_0x391afa,_0x3cd1a0))[_0x99a1('0x26')](handleError(_0x391afa,null));};exports[_0x99a1('0x51')]=function(_0x462c15,_0x4519fb){var _0xee2b1b={'raw':![],'where':{'id':_0x462c15['params']['id']}},_0x597836={};_0x597836['model']=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x597836[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x462c15[_0x99a1('0x3f')]);_0x597836[_0x99a1('0x41')]=_['intersection'](_0x597836[_0x99a1('0x42')],_0x597836[_0x99a1('0x3f')]);_0xee2b1b[_0x99a1('0x43')]=_['intersection'](_0x597836[_0x99a1('0x42')],qs['fields'](_0x462c15['query'][_0x99a1('0x44')]));_0xee2b1b[_0x99a1('0x43')]=_0xee2b1b[_0x99a1('0x43')][_0x99a1('0x45')]?_0xee2b1b[_0x99a1('0x43')]:_0x597836[_0x99a1('0x42')];if(_0x462c15[_0x99a1('0x3f')][_0x99a1('0x50')]){_0xee2b1b[_0x99a1('0x52')]=[{'all':!![]}];}_0xee2b1b=_['merge']({},_0xee2b1b,_0x462c15[_0x99a1('0x4f')]);return db['Trunk'][_0x99a1('0x53')](_0xee2b1b)[_0x99a1('0x1c')](handleEntityNotFound(_0x4519fb,null))['then'](respondWithResult(_0x4519fb,null))[_0x99a1('0x26')](handleError(_0x4519fb,null));};exports[_0x99a1('0x54')]=function(_0x469e10,_0x2b2d63){var _0x2800d5={'where':{'id':_0x469e10[_0x99a1('0x55')]['id']}},_0x1bff78={};_0x1bff78[_0x99a1('0x42')]=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x2800d5[_0x99a1('0x43')]=_['intersection'](_0x1bff78['model'],qs[_0x99a1('0x44')](_0x469e10[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x2800d5[_0x99a1('0x43')]=_0x2800d5[_0x99a1('0x43')]['length']?_0x2800d5[_0x99a1('0x43')]:_0x1bff78[_0x99a1('0x42')];if(_0x469e10['query'][_0x99a1('0x50')]){_0x2800d5[_0x99a1('0x52')]=[{'all':!![]}];}_0x2800d5=_[_0x99a1('0x4c')]({},_0x2800d5,_0x469e10[_0x99a1('0x4f')]);return db[_0x99a1('0x3b')]['find'](_0x2800d5)[_0x99a1('0x1c')](handleEntityNotFound(_0x2b2d63,null))[_0x99a1('0x1c')](function(_0x1bb1cb){if(_0x1bb1cb){var _0x22811f=_0x1bb1cb[_0x99a1('0x34')]({'plain':!![]});_0x22811f=qs[_0x99a1('0x56')](_0x22811f,['id','createdAt',_0x99a1('0x57')]);_0x469e10[_0x99a1('0x58')]=_['omit'](_0x469e10[_0x99a1('0x58')],['id',_0x99a1('0x59'),_0x99a1('0x57')]);return db[_0x99a1('0x3b')][_0x99a1('0x5a')](_['merge'](_0x22811f,_0x469e10[_0x99a1('0x58')]),{'include':_0x469e10['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x38ce3c){var _0x3f7c16=_0x469e10['user']['get']({'plain':!![]});if(!_0x3f7c16)throw new Error(_0x99a1('0x5b'));if(_0x3f7c16['role']===_0x99a1('0x5c')){var _0x263db3=_0x38ce3c[_0x99a1('0x34')]({'plain':!![]});var _0x180c1e='Trunks';return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x180c1e,'userProfileId':_0x3f7c16[_0x99a1('0x5e')]},'raw':!![]})['then'](function(_0x3a62c6){if(_0x3a62c6&&_0x3a62c6['autoAssociation']===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x263db3[_0x99a1('0x38')],'resourceId':_0x263db3['id'],'type':_0x3a62c6[_0x99a1('0x38')],'sectionId':_0x3a62c6['id']},{})[_0x99a1('0x1c')](function(){return _0x38ce3c;});}else{return _0x38ce3c;}})['catch'](function(_0x4d37f8){logger['error'](_0x99a1('0x5f'),_0x4d37f8);throw _0x4d37f8;});}return _0x38ce3c;});}})[_0x99a1('0x1c')](respondWithResult(_0x2b2d63,0xc9))['catch'](handleError(_0x2b2d63,null));};exports['create']=function(_0x1fe7af,_0x2f5587,_0x401c8f){var _0x509d4f;return db['Trunk'][_0x99a1('0x5a')](_0x1fe7af['body'],{'raw':!![]})[_0x99a1('0x1c')](function(_0x129690){_0x509d4f=_0x129690;return db[_0x99a1('0x3b')]['findAll']({'raw':!![]});})[_0x99a1('0x1c')](function(_0x28c7d8){var _0x4ac99e=fs['readFileSync'](path[_0x99a1('0x60')](config['root'],_0x99a1('0x61')),_0x99a1('0x62'));var _0x30a0a5=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x3d0ff6=ejs['render'](_0x4ac99e,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x65'),_0x3d0ff6);if(_0x509d4f[_0x99a1('0x66')]){var _0x1750d5=ejs[_0x99a1('0x67')](_0x30a0a5,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x68'),_0x1750d5);}})['then'](function(){return respondWithRpcPromise('Reload',_0x99a1('0x5a'),{'module':_0x99a1('0x69')});})[_0x99a1('0x1c')](function(){var _0x525969=_0x1fe7af[_0x99a1('0x5c')][_0x99a1('0x34')]({'plain':!![]});if(!_0x525969)throw new Error(_0x99a1('0x5b'));if(_0x525969[_0x99a1('0x6a')]===_0x99a1('0x5c')){var _0x4ae313=_0x509d4f[_0x99a1('0x34')]({'plain':!![]});return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x99a1('0x35'),'userProfileId':_0x525969[_0x99a1('0x5e')]},'raw':!![]})[_0x99a1('0x1c')](function(_0x5e42be){if(_0x5e42be&&_0x5e42be[_0x99a1('0x6b')]===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x4ae313[_0x99a1('0x38')],'resourceId':_0x4ae313['id'],'type':_0x5e42be[_0x99a1('0x38')],'sectionId':_0x5e42be['id']},{})['then'](function(){return _0x509d4f;});}else{return _0x509d4f;}})[_0x99a1('0x26')](function(_0x68c944){logger[_0x99a1('0x22')](_0x99a1('0x5f'),_0x68c944);throw _0x68c944;});}return _0x509d4f;})[_0x99a1('0x1c')](respondWithResult(_0x2f5587,0xc9))[_0x99a1('0x26')](handleError(_0x2f5587,null));};exports['update']=function(_0xaa953e,_0x33d96b,_0x4a5617){var _0x56716a;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0xaa953e['params']['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x33d96b,null))[_0x99a1('0x1c')](saveUpdates(_0xaa953e[_0x99a1('0x58')],null))[_0x99a1('0x1c')](function(_0x43156f){if(_0x43156f){_0x56716a=_0x43156f;return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});}})[_0x99a1('0x1c')](function(_0x4260d7){if(_0x4260d7){var _0x3e099c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],'server/files/templates/trunk.ejs'),_0x99a1('0x62'));var _0x5a9a7d=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0xbbbe26=ejs[_0x99a1('0x67')](_0x3e099c,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0xbbbe26);var _0x361ce6=ejs['render'](_0x5a9a7d,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x68'),_0x361ce6);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x70'),{'module':_0x99a1('0x69')});}return null;})[_0x99a1('0x1c')](function(_0x6dab29){if(_0x6dab29){return _0x56716a;}})[_0x99a1('0x1c')](respondWithResult(_0x33d96b,null))['catch'](handleError(_0x33d96b,null));};exports['destroy']=function(_0x51c289,_0x2dd29b,_0x353f25){var _0x53cdb3;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0x51c289[_0x99a1('0x55')]['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x2dd29b,null))['then'](removeEntity(_0x2dd29b,null))[_0x99a1('0x1c')](function(){return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});})[_0x99a1('0x1c')](function(_0x4e9fe9){var _0x24aa05=fs['readFileSync'](path['join'](config['root'],_0x99a1('0x61')),'utf8');var _0xb7744c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x444e43=ejs['render'](_0x24aa05,{'trunks':_0x4e9fe9});var _0x4fcd65=ejs[_0x99a1('0x67')](_0xb7744c,{'trunks':_0x4e9fe9});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0x444e43);fs['writeFileSync'](_0x99a1('0x68'),_0x4fcd65);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x33'),{'module':'chan_sip.so'});})[_0x99a1('0x26')](handleError(_0x2dd29b,null));}; \ No newline at end of file +var _0x55ca=['catch','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','destroy','get','UserProfileResource','end','stack','name','send','Trunk','rawAttributes','type','model','map','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','length','options','find','clone','omit','updatedAt','body','createdAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','render','Reload','chan_sip.so','readFileSync','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x346ed7,_0x5fb186){var _0x4021dc=function(_0x285aef){while(--_0x285aef){_0x346ed7['push'](_0x346ed7['shift']());}};_0x4021dc(++_0x5fb186);}(_0x55ca,0x126));var _0xa55c=function(_0x59ee9c,_0x43f62d){_0x59ee9c=_0x59ee9c-0x0;var _0x44a2a8=_0x55ca[_0x59ee9c];return _0x44a2a8;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xa55c('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x576044,_0x5a3672,_0x59ea8d,_0x18ee85){return new BPromise(function(_0x3930e4,_0x462cd6){var _0x938bd6=_0x18ee85||client;return _0x938bd6[_0xa55c('0x19')](_0x576044,_0x59ea8d)[_0xa55c('0x1a')](function(_0x4e0b2f){logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,_0xa55c('0x1d'));logger[_0xa55c('0x1e')](_0xa55c('0x1f'),_0x5a3672,_0xa55c('0x1d'),JSON[_0xa55c('0x20')](_0x4e0b2f));if(_0x4e0b2f[_0xa55c('0x21')]){if(_0x4e0b2f[_0xa55c('0x21')]['code']===0x1f4){logger[_0xa55c('0x21')](_0xa55c('0x1c'),_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x462cd6(_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x5a3672,_0x4e0b2f[_0xa55c('0x21')][_0xa55c('0x22')]);return _0x3930e4(_0x4e0b2f[_0xa55c('0x21')]['message']);}else{logger[_0xa55c('0x1b')](_0xa55c('0x1c'),_0x5a3672,'request\x20sent');_0x3930e4(_0x4e0b2f[_0xa55c('0x23')][_0xa55c('0x22')]);}})[_0xa55c('0x24')](function(_0x1965f1){logger[_0xa55c('0x21')]('Trunk,\x20%s,\x20%s',_0x5a3672,_0x1965f1);_0x462cd6(_0x1965f1);});});}function respondWithStatusCode(_0x1fc828,_0x504c24){_0x504c24=_0x504c24||0xcc;return function(_0x5ba836){if(_0x5ba836){return _0x1fc828['sendStatus'](_0x504c24);}return _0x1fc828[_0xa55c('0x25')](_0x504c24)['end']();};}function respondWithResult(_0x3ecbe7,_0x190757){_0x190757=_0x190757||0xc8;return function(_0x3f64de){if(_0x3f64de){return _0x3ecbe7[_0xa55c('0x25')](_0x190757)[_0xa55c('0x26')](_0x3f64de);}};}function respondWithFilteredResult(_0x170ba4,_0x1da633){return function(_0x11e7f7){if(_0x11e7f7){var _0x192df2=typeof _0x1da633[_0xa55c('0x27')]===_0xa55c('0x28')&&typeof _0x1da633['limit']===_0xa55c('0x28');var _0x28814f=_0x11e7f7[_0xa55c('0x29')];var _0x906caa=_0x192df2?0x0:_0x1da633['offset'];var _0x1377b0=_0x192df2?_0x11e7f7[_0xa55c('0x29')]:_0x1da633[_0xa55c('0x27')]+_0x1da633[_0xa55c('0x2a')];var _0x45ee8d;if(_0x1377b0>=_0x28814f){_0x1377b0=_0x28814f;_0x45ee8d=0xc8;}else{_0x45ee8d=0xce;}_0x170ba4[_0xa55c('0x25')](_0x45ee8d);return _0x170ba4['set'](_0xa55c('0x2b'),_0x906caa+'-'+_0x1377b0+'/'+_0x28814f)['json'](_0x11e7f7);}return null;};}function patchUpdates(_0x35c9c2){return function(_0x1d730b){try{jsonpatch[_0xa55c('0x2c')](_0x1d730b,_0x35c9c2,!![]);}catch(_0x223813){return BPromise['reject'](_0x223813);}return _0x1d730b[_0xa55c('0x2d')]();};}function saveUpdates(_0x2096ae,_0x331e58){return function(_0x20da31){if(_0x20da31){return _0x20da31[_0xa55c('0x2e')](_0x2096ae)[_0xa55c('0x1a')](function(_0x29748a){return _0x29748a;});}return null;};}function removeEntity(_0x24d44d,_0x2808e9){return function(_0xcbaf2e){if(_0xcbaf2e){return _0xcbaf2e[_0xa55c('0x2f')]()['then'](function(){var _0x54ca97=_0xcbaf2e[_0xa55c('0x30')]({'plain':!![]});var _0x19733e='Trunks';return db[_0xa55c('0x31')][_0xa55c('0x2f')]({'where':{'type':_0x19733e,'resourceId':_0x54ca97['id']}})[_0xa55c('0x1a')](function(){return _0xcbaf2e;});})[_0xa55c('0x1a')](function(){_0x24d44d[_0xa55c('0x25')](0xcc)[_0xa55c('0x32')]();});}};}function handleEntityNotFound(_0x3ce1b3,_0x222d4b){return function(_0x3959e3){if(!_0x3959e3){_0x3ce1b3['sendStatus'](0x194);}return _0x3959e3;};}function handleError(_0x5f3e99,_0x4b23d3){_0x4b23d3=_0x4b23d3||0x1f4;return function(_0x3fd75f){logger[_0xa55c('0x21')](_0x3fd75f[_0xa55c('0x33')]);if(_0x3fd75f['name']){delete _0x3fd75f[_0xa55c('0x34')];}_0x5f3e99['status'](_0x4b23d3)[_0xa55c('0x35')](_0x3fd75f);};}exports['index']=function(_0x18c6f1,_0x39267c){var _0x3c0ec1={},_0x4d3eb5={},_0x7c4a47={'count':0x0,'rows':[]};var _0x30f23b=_['map'](db[_0xa55c('0x36')][_0xa55c('0x37')],function(_0x4d9083){return{'name':_0x4d9083['fieldName'],'type':_0x4d9083[_0xa55c('0x38')]['key']};});_0x4d3eb5[_0xa55c('0x39')]=_[_0xa55c('0x3a')](_0x30f23b,'name');_0x4d3eb5['query']=_['keys'](_0x18c6f1['query']);_0x4d3eb5[_0xa55c('0x3b')]=_[_0xa55c('0x3c')](_0x4d3eb5[_0xa55c('0x39')],_0x4d3eb5[_0xa55c('0x3d')]);_0x3c0ec1[_0xa55c('0x3e')]=_['intersection'](_0x4d3eb5[_0xa55c('0x39')],qs[_0xa55c('0x3f')](_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x3f')]));_0x3c0ec1[_0xa55c('0x3e')]=_0x3c0ec1[_0xa55c('0x3e')]['length']?_0x3c0ec1[_0xa55c('0x3e')]:_0x4d3eb5['model'];if(!_0x18c6f1['query'][_0xa55c('0x40')](_0xa55c('0x41'))){_0x3c0ec1['limit']=qs[_0xa55c('0x2a')](_0x18c6f1['query']['limit']);_0x3c0ec1[_0xa55c('0x27')]=qs[_0xa55c('0x27')](_0x18c6f1[_0xa55c('0x3d')]['offset']);}_0x3c0ec1[_0xa55c('0x42')]=qs[_0xa55c('0x43')](_0x18c6f1['query'][_0xa55c('0x43')]);_0x3c0ec1['where']=qs[_0xa55c('0x3b')](_[_0xa55c('0x44')](_0x18c6f1['query'],_0x4d3eb5[_0xa55c('0x3b')]),_0x30f23b);if(_0x18c6f1[_0xa55c('0x3d')]['filter']){_0x3c0ec1[_0xa55c('0x45')]=_[_0xa55c('0x46')](_0x3c0ec1[_0xa55c('0x45')],{'$or':_['map'](_0x30f23b,function(_0x334f52){if(_0x334f52['type']!==_0xa55c('0x47')){var _0x3a8af4={};_0x3a8af4[_0x334f52[_0xa55c('0x34')]]={'$like':'%'+_0x18c6f1['query'][_0xa55c('0x48')]+'%'};return _0x3a8af4;}})});}_0x3c0ec1=_[_0xa55c('0x46')]({},_0x3c0ec1,_0x18c6f1['options']);var _0x3d19f5={'where':_0x3c0ec1[_0xa55c('0x45')]};return db['Trunk'][_0xa55c('0x29')](_0x3d19f5)[_0xa55c('0x1a')](function(_0x52f9a7){_0x7c4a47[_0xa55c('0x29')]=_0x52f9a7;if(_0x18c6f1[_0xa55c('0x3d')][_0xa55c('0x49')]){_0x3c0ec1[_0xa55c('0x4a')]=[{'all':!![]}];}return db['Trunk'][_0xa55c('0x4b')](_0x3c0ec1);})['then'](function(_0x2157d6){_0x7c4a47[_0xa55c('0x4c')]=_0x2157d6;return _0x7c4a47;})[_0xa55c('0x1a')](respondWithFilteredResult(_0x39267c,_0x3c0ec1))['catch'](handleError(_0x39267c,null));};exports[_0xa55c('0x4d')]=function(_0x250b00,_0x574fe9){var _0x5be06={'raw':![],'where':{'id':_0x250b00[_0xa55c('0x4e')]['id']}},_0x34de95={};_0x34de95[_0xa55c('0x39')]=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x34de95[_0xa55c('0x3d')]=_[_0xa55c('0x4f')](_0x250b00[_0xa55c('0x3d')]);_0x34de95['filters']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],_0x34de95[_0xa55c('0x3d')]);_0x5be06['attributes']=_[_0xa55c('0x3c')](_0x34de95[_0xa55c('0x39')],qs['fields'](_0x250b00[_0xa55c('0x3d')]['fields']));_0x5be06[_0xa55c('0x3e')]=_0x5be06[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x5be06[_0xa55c('0x3e')]:_0x34de95[_0xa55c('0x39')];if(_0x250b00['query'][_0xa55c('0x49')]){_0x5be06[_0xa55c('0x4a')]=[{'all':!![]}];}_0x5be06=_['merge']({},_0x5be06,_0x250b00[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x5be06)[_0xa55c('0x1a')](handleEntityNotFound(_0x574fe9,null))['then'](respondWithResult(_0x574fe9,null))['catch'](handleError(_0x574fe9,null));};exports[_0xa55c('0x53')]=function(_0x250dea,_0x3ca5b8){var _0x44ac57={'where':{'id':_0x250dea[_0xa55c('0x4e')]['id']}},_0x54cbde={};_0x54cbde['model']=_[_0xa55c('0x4f')](db[_0xa55c('0x36')][_0xa55c('0x37')]);_0x44ac57[_0xa55c('0x3e')]=_[_0xa55c('0x3c')](_0x54cbde['model'],qs[_0xa55c('0x3f')](_0x250dea['query'][_0xa55c('0x3f')]));_0x44ac57[_0xa55c('0x3e')]=_0x44ac57[_0xa55c('0x3e')][_0xa55c('0x50')]?_0x44ac57[_0xa55c('0x3e')]:_0x54cbde[_0xa55c('0x39')];if(_0x250dea[_0xa55c('0x3d')]['includeAll']){_0x44ac57[_0xa55c('0x4a')]=[{'all':!![]}];}_0x44ac57=_[_0xa55c('0x46')]({},_0x44ac57,_0x250dea[_0xa55c('0x51')]);return db[_0xa55c('0x36')][_0xa55c('0x52')](_0x44ac57)['then'](handleEntityNotFound(_0x3ca5b8,null))[_0xa55c('0x1a')](function(_0x3cd40d){if(_0x3cd40d){var _0x28bac4=_0x3cd40d[_0xa55c('0x30')]({'plain':!![]});_0x28bac4=qs[_0xa55c('0x54')](_0x28bac4,['id','createdAt',_0xa55c('0x55')]);_0x250dea[_0xa55c('0x56')]=_[_0xa55c('0x54')](_0x250dea[_0xa55c('0x56')],['id',_0xa55c('0x57'),'updatedAt']);return db[_0xa55c('0x36')]['create'](_[_0xa55c('0x46')](_0x28bac4,_0x250dea['body']),{'include':_0x250dea[_0xa55c('0x3d')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x1a')](function(_0x1333da){var _0x21d6b4=_0x250dea[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x21d6b4)throw new Error(_0xa55c('0x59'));if(_0x21d6b4[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0x14b515=_0x1333da[_0xa55c('0x30')]({'plain':!![]});var _0x51c736=_0xa55c('0x5b');return db[_0xa55c('0x5c')]['find']({'where':{'name':_0x51c736,'userProfileId':_0x21d6b4[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x3e3b4b){if(_0x3e3b4b&&_0x3e3b4b[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')][_0xa55c('0x5f')]({'name':_0x14b515[_0xa55c('0x34')],'resourceId':_0x14b515['id'],'type':_0x3e3b4b[_0xa55c('0x34')],'sectionId':_0x3e3b4b['id']},{})['then'](function(){return _0x1333da;});}else{return _0x1333da;}})[_0xa55c('0x24')](function(_0x475131){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x475131);throw _0x475131;});}return _0x1333da;});}})[_0xa55c('0x1a')](respondWithResult(_0x3ca5b8,0xc9))[_0xa55c('0x24')](handleError(_0x3ca5b8,null));};exports[_0xa55c('0x5f')]=function(_0x4249c1,_0x25d5a1,_0x4a08ca){var _0x347562;return db[_0xa55c('0x36')][_0xa55c('0x5f')](_0x4249c1[_0xa55c('0x56')],{'raw':!![]})[_0xa55c('0x1a')](function(_0x10e711){_0x347562=_0x10e711;return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x3178a6){var _0x3bbc4b=fs['readFileSync'](path[_0xa55c('0x61')](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0x129bb4=fs['readFileSync'](path['join'](config[_0xa55c('0x64')],_0xa55c('0x65')),_0xa55c('0x63'));var _0x42529f=ejs['render'](_0x3bbc4b,{'trunks':_0x3178a6||[]});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x42529f);if(_0x347562[_0xa55c('0x68')]){var _0x3a9910=ejs[_0xa55c('0x69')](_0x129bb4,{'trunks':_0x3178a6||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x3a9910);}})[_0xa55c('0x1a')](function(){return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x5f'),{'module':_0xa55c('0x6b')});})[_0xa55c('0x1a')](function(){var _0x4b2032=_0x4249c1[_0xa55c('0x58')][_0xa55c('0x30')]({'plain':!![]});if(!_0x4b2032)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b2032[_0xa55c('0x5a')]===_0xa55c('0x58')){var _0xa340fb=_0x347562['get']({'plain':!![]});return db[_0xa55c('0x5c')][_0xa55c('0x52')]({'where':{'name':_0xa55c('0x5b'),'userProfileId':_0x4b2032[_0xa55c('0x5d')]},'raw':!![]})[_0xa55c('0x1a')](function(_0x506f74){if(_0x506f74&&_0x506f74[_0xa55c('0x5e')]===0x0){return db[_0xa55c('0x31')]['create']({'name':_0xa340fb['name'],'resourceId':_0xa340fb['id'],'type':_0x506f74[_0xa55c('0x34')],'sectionId':_0x506f74['id']},{})['then'](function(){return _0x347562;});}else{return _0x347562;}})[_0xa55c('0x24')](function(_0x5ca0bc){logger[_0xa55c('0x21')](_0xa55c('0x60'),_0x5ca0bc);throw _0x5ca0bc;});}return _0x347562;})[_0xa55c('0x1a')](respondWithResult(_0x25d5a1,0xc9))[_0xa55c('0x24')](handleError(_0x25d5a1,null));};exports[_0xa55c('0x2e')]=function(_0xff7b1c,_0x16dfc6,_0x5d8551){var _0x463195;return db[_0xa55c('0x36')][_0xa55c('0x52')]({'where':{'id':_0xff7b1c[_0xa55c('0x4e')]['id']}})['then'](handleEntityNotFound(_0x16dfc6,null))[_0xa55c('0x1a')](saveUpdates(_0xff7b1c[_0xa55c('0x56')],null))[_0xa55c('0x1a')](function(_0x2298ac){if(_0x2298ac){_0x463195=_0x2298ac;return db['Trunk']['findAll']({'raw':!![]});}})[_0xa55c('0x1a')](function(_0x428872){if(_0x428872){var _0x12e3a8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x62')),_0xa55c('0x63'));var _0xd33c9c=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x65')),'utf8');var _0x19497b=ejs['render'](_0x12e3a8,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x19497b);var _0x36ded7=ejs[_0xa55c('0x69')](_0xd33c9c,{'trunks':_0x428872||[]});fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x36ded7);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2e'),{'module':_0xa55c('0x6b')});}return null;})[_0xa55c('0x1a')](function(_0x576a1b){if(_0x576a1b){return _0x463195;}})['then'](respondWithResult(_0x16dfc6,null))[_0xa55c('0x24')](handleError(_0x16dfc6,null));};exports[_0xa55c('0x2f')]=function(_0xc2ad5c,_0x256db0,_0x1622cb){var _0x137728;return db['Trunk'][_0xa55c('0x52')]({'where':{'id':_0xc2ad5c[_0xa55c('0x4e')]['id']}})[_0xa55c('0x1a')](handleEntityNotFound(_0x256db0,null))[_0xa55c('0x1a')](removeEntity(_0x256db0,null))[_0xa55c('0x1a')](function(){return db[_0xa55c('0x36')][_0xa55c('0x4b')]({'raw':!![]});})[_0xa55c('0x1a')](function(_0x58b670){var _0x25d09d=fs[_0xa55c('0x6c')](path[_0xa55c('0x61')](config[_0xa55c('0x64')],_0xa55c('0x62')),'utf8');var _0x2685d8=fs[_0xa55c('0x6c')](path['join'](config['root'],_0xa55c('0x65')),_0xa55c('0x63'));var _0x5c2229=ejs['render'](_0x25d09d,{'trunks':_0x58b670});var _0x579726=ejs['render'](_0x2685d8,{'trunks':_0x58b670});fs[_0xa55c('0x66')](_0xa55c('0x67'),_0x5c2229);fs[_0xa55c('0x66')](_0xa55c('0x6d'),_0x579726);return respondWithRpcPromise(_0xa55c('0x6a'),_0xa55c('0x2f'),{'module':'chan_sip.so'});})[_0xa55c('0x24')](handleError(_0x256db0,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 899853e..7728b58 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 _0xf225=['rimraf','./trunk.attributes','define','Trunk','util','../../config/logger','api'];(function(_0x4753b7,_0x2660d1){var _0x3e6fa9=function(_0x4877c1){while(--_0x4877c1){_0x4753b7['push'](_0x4753b7['shift']());}};_0x3e6fa9(++_0x2660d1);}(_0xf225,0x6d));var _0x5f22=function(_0x48d9fb,_0x1f8af9){_0x48d9fb=_0x48d9fb-0x0;var _0x3a39fe=_0xf225[_0x48d9fb];return _0x3a39fe;};'use strict';var _=require('lodash');var util=require(_0x5f22('0x0'));var logger=require(_0x5f22('0x1'))(_0x5f22('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(_0x5f22('0x3'));var config=require('../../config/environment');var attributes=require(_0x5f22('0x4'));module['exports']=function(_0x43a02e,_0x51c3be){return _0x43a02e[_0x5f22('0x5')](_0x5f22('0x6'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe891=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./trunk.attributes','exports','tools_trunks','lodash'];(function(_0x1e5b90,_0x3975c1){var _0x3dccd4=function(_0x33c0ec){while(--_0x33c0ec){_0x1e5b90['push'](_0x1e5b90['shift']());}};_0x3dccd4(++_0x3975c1);}(_0xe891,0xbd));var _0x1e89=function(_0x21ed8b,_0x3c8014){_0x21ed8b=_0x21ed8b-0x0;var _0x25ef29=_0xe891[_0x21ed8b];return _0x25ef29;};'use strict';var _=require(_0x1e89('0x0'));var util=require('util');var logger=require(_0x1e89('0x1'))('api');var moment=require(_0x1e89('0x2'));var BPromise=require(_0x1e89('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e89('0x4'));var rimraf=require(_0x1e89('0x5'));var config=require(_0x1e89('0x6'));var attributes=require(_0x1e89('0x7'));module[_0x1e89('0x8')]=function(_0x71a954,_0x287cc5){return _0x71a954['define']('Trunk',attributes,{'tableName':_0x1e89('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 3012d91..8641516 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 _0x6991=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','map','include','model','ShowTrunk','find','lodash','moment','ioredis','rpc'];(function(_0x1a6a02,_0x1c090f){var _0x3b19f5=function(_0x4b8d69){while(--_0x4b8d69){_0x1a6a02['push'](_0x1a6a02['shift']());}};_0x3b19f5(++_0x1c090f);}(_0x6991,0x1ca));var _0x1699=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x6991[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x1699('0x0'));var util=require('util');var moment=require(_0x1699('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1699('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1699('0x3'));var config=require(_0x1699('0x4'));var jayson=require(_0x1699('0x5'));var client=jayson[_0x1699('0x6')][_0x1699('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x53225c,_0x401b57,_0x59478c){return new BPromise(function(_0x341973,_0x182ed2){return client[_0x1699('0x8')](_0x53225c,_0x59478c)[_0x1699('0x9')](function(_0x469545){logger[_0x1699('0xa')]('Trunk,\x20%s,\x20%s',_0x401b57,_0x1699('0xb'));logger[_0x1699('0xc')](_0x1699('0xd'),_0x401b57,_0x1699('0xb'),JSON[_0x1699('0xe')](_0x469545));if(_0x469545[_0x1699('0xf')]){if(_0x469545[_0x1699('0xf')]['code']===0x1f4){logger[_0x1699('0xf')](_0x1699('0x10'),_0x401b57,_0x469545['error'][_0x1699('0x11')]);return _0x182ed2(_0x469545[_0x1699('0xf')][_0x1699('0x11')]);}logger['error'](_0x1699('0x10'),_0x401b57,_0x469545[_0x1699('0xf')][_0x1699('0x11')]);return _0x341973(_0x469545[_0x1699('0xf')][_0x1699('0x11')]);}else{logger[_0x1699('0xa')]('Trunk,\x20%s,\x20%s',_0x401b57,_0x1699('0xb'));_0x341973(_0x469545[_0x1699('0x12')][_0x1699('0x11')]);}})[_0x1699('0x13')](function(_0x5edb98){logger['error'](_0x1699('0x10'),_0x401b57,_0x5edb98);_0x182ed2(_0x5edb98);});});}exports[_0x1699('0x14')]=function(_0x4e8507){var _0x5c52fb=this;return new Promise(function(_0x190938,_0x11a224){return db[_0x1699('0x15')][_0x1699('0x16')]({'raw':_0x4e8507[_0x1699('0x17')]?_0x4e8507[_0x1699('0x17')][_0x1699('0x18')]===undefined?!![]:![]:!![],'where':_0x4e8507[_0x1699('0x17')]?_0x4e8507[_0x1699('0x17')][_0x1699('0x19')]||null:null,'attributes':_0x4e8507[_0x1699('0x17')]?_0x4e8507[_0x1699('0x17')][_0x1699('0x1a')]||null:null,'limit':_0x4e8507[_0x1699('0x17')]?_0x4e8507['options'][_0x1699('0x1b')]||null:null,'include':_0x4e8507[_0x1699('0x17')]?_0x4e8507[_0x1699('0x17')]['include']?_[_0x1699('0x1c')](_0x4e8507['options'][_0x1699('0x1d')],function(_0x59e1fb){return{'model':db[_0x59e1fb['model']],'as':_0x59e1fb['as'],'attributes':_0x59e1fb['attributes'],'include':_0x59e1fb[_0x1699('0x1d')]?_[_0x1699('0x1c')](_0x59e1fb['include'],function(_0x4da622){return{'model':db[_0x4da622[_0x1699('0x1e')]],'as':_0x4da622['as'],'attributes':_0x4da622[_0x1699('0x1a')],'include':_0x4da622[_0x1699('0x1d')]?_[_0x1699('0x1c')](_0x4da622[_0x1699('0x1d')],function(_0x427ae6){return{'model':db[_0x427ae6[_0x1699('0x1e')]],'as':_0x427ae6['as'],'attributes':_0x427ae6[_0x1699('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x1699('0x9')](function(_0x4bd7f7){logger[_0x1699('0xa')](_0x1699('0x14'),_0x4e8507);logger[_0x1699('0xc')]('GetTrunk',_0x4e8507,JSON[_0x1699('0xe')](_0x4bd7f7));_0x190938(_0x4bd7f7);})['catch'](function(_0x3ad5e1){logger['error'](_0x1699('0x14'),_0x3ad5e1[_0x1699('0x11')],_0x4e8507);_0x11a224(_0x5c52fb[_0x1699('0xf')](0x1f4,_0x3ad5e1['message']));});});};exports[_0x1699('0x1f')]=function(_0x5a1ef0){var _0x28660c=this;return new Promise(function(_0x4b84c4,_0xfd4592){return db['Trunk'][_0x1699('0x20')]({'raw':_0x5a1ef0[_0x1699('0x17')]?_0x5a1ef0[_0x1699('0x17')][_0x1699('0x18')]===undefined?!![]:![]:!![],'where':_0x5a1ef0['options']?_0x5a1ef0[_0x1699('0x17')][_0x1699('0x19')]||null:null,'attributes':_0x5a1ef0[_0x1699('0x17')]?_0x5a1ef0[_0x1699('0x17')]['attributes']||null:null,'include':_0x5a1ef0[_0x1699('0x17')]?_0x5a1ef0[_0x1699('0x17')]['include']?_['map'](_0x5a1ef0[_0x1699('0x17')]['include'],function(_0x66fc1b){return{'model':db[_0x66fc1b[_0x1699('0x1e')]],'as':_0x66fc1b['as'],'attributes':_0x66fc1b[_0x1699('0x1a')],'include':_0x66fc1b['include']?_[_0x1699('0x1c')](_0x66fc1b[_0x1699('0x1d')],function(_0x1057e2){return{'model':db[_0x1057e2[_0x1699('0x1e')]],'as':_0x1057e2['as'],'attributes':_0x1057e2[_0x1699('0x1a')],'include':_0x1057e2[_0x1699('0x1d')]?_[_0x1699('0x1c')](_0x1057e2[_0x1699('0x1d')],function(_0x22c6f7){return{'model':db[_0x22c6f7[_0x1699('0x1e')]],'as':_0x22c6f7['as'],'attributes':_0x22c6f7['attributes']};}):[]};}):[]};}):[]:[]})[_0x1699('0x9')](function(_0x28d78f){logger['info'](_0x1699('0x1f'),_0x5a1ef0);logger[_0x1699('0xc')](_0x1699('0x1f'),_0x5a1ef0,JSON[_0x1699('0xe')](_0x28d78f));_0x4b84c4(_0x28d78f);})[_0x1699('0x13')](function(_0x4f8f0d){logger[_0x1699('0xf')](_0x1699('0x1f'),_0x4f8f0d['message'],_0x5a1ef0);_0xfd4592(_0x28660c[_0x1699('0xf')](0x1f4,_0x4f8f0d[_0x1699('0x11')]));});});}; \ No newline at end of file +var _0x0685=['client','http','request','then','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','map','include','model','stringify','catch','ShowTrunk','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3f97de,_0x41ad30){var _0x582c67=function(_0x27625e){while(--_0x27625e){_0x3f97de['push'](_0x3f97de['shift']());}};_0x582c67(++_0x41ad30);}(_0x0685,0xe4));var _0x5068=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x0685[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x5068('0x0'));var util=require(_0x5068('0x1'));var moment=require(_0x5068('0x2'));var BPromise=require(_0x5068('0x3'));var rs=require(_0x5068('0x4'));var fs=require('fs');var Redis=require(_0x5068('0x5'));var db=require(_0x5068('0x6'))['db'];var utils=require(_0x5068('0x7'));var logger=require(_0x5068('0x8'))(_0x5068('0x9'));var config=require(_0x5068('0xa'));var jayson=require(_0x5068('0xb'));var client=jayson[_0x5068('0xc')][_0x5068('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1cda1f,_0x222be9,_0x3ac709){return new BPromise(function(_0x2a01d2,_0x262787){return client[_0x5068('0xe')](_0x1cda1f,_0x3ac709)[_0x5068('0xf')](function(_0x174dba){logger['info'](_0x5068('0x10'),_0x222be9,'request\x20sent');logger[_0x5068('0x11')](_0x5068('0x12'),_0x222be9,_0x5068('0x13'),JSON['stringify'](_0x174dba));if(_0x174dba[_0x5068('0x14')]){if(_0x174dba['error'][_0x5068('0x15')]===0x1f4){logger[_0x5068('0x14')](_0x5068('0x10'),_0x222be9,_0x174dba[_0x5068('0x14')][_0x5068('0x16')]);return _0x262787(_0x174dba[_0x5068('0x14')]['message']);}logger[_0x5068('0x14')](_0x5068('0x10'),_0x222be9,_0x174dba['error']['message']);return _0x2a01d2(_0x174dba[_0x5068('0x14')]['message']);}else{logger[_0x5068('0x17')](_0x5068('0x10'),_0x222be9,_0x5068('0x13'));_0x2a01d2(_0x174dba[_0x5068('0x18')][_0x5068('0x16')]);}})['catch'](function(_0xf7e5be){logger[_0x5068('0x14')](_0x5068('0x10'),_0x222be9,_0xf7e5be);_0x262787(_0xf7e5be);});});}exports[_0x5068('0x19')]=function(_0x111c6b){var _0x32f19f=this;return new Promise(function(_0xc757bb,_0x320f3f){return db[_0x5068('0x1a')][_0x5068('0x1b')]({'raw':_0x111c6b[_0x5068('0x1c')]?_0x111c6b['options'][_0x5068('0x1d')]===undefined?!![]:![]:!![],'where':_0x111c6b[_0x5068('0x1c')]?_0x111c6b[_0x5068('0x1c')][_0x5068('0x1e')]||null:null,'attributes':_0x111c6b[_0x5068('0x1c')]?_0x111c6b[_0x5068('0x1c')][_0x5068('0x1f')]||null:null,'limit':_0x111c6b[_0x5068('0x1c')]?_0x111c6b[_0x5068('0x1c')][_0x5068('0x20')]||null:null,'include':_0x111c6b[_0x5068('0x1c')]?_0x111c6b['options']['include']?_[_0x5068('0x21')](_0x111c6b[_0x5068('0x1c')][_0x5068('0x22')],function(_0x2d6b43){return{'model':db[_0x2d6b43[_0x5068('0x23')]],'as':_0x2d6b43['as'],'attributes':_0x2d6b43['attributes'],'include':_0x2d6b43[_0x5068('0x22')]?_[_0x5068('0x21')](_0x2d6b43[_0x5068('0x22')],function(_0x8ffca4){return{'model':db[_0x8ffca4[_0x5068('0x23')]],'as':_0x8ffca4['as'],'attributes':_0x8ffca4[_0x5068('0x1f')],'include':_0x8ffca4[_0x5068('0x22')]?_[_0x5068('0x21')](_0x8ffca4['include'],function(_0x1639f1){return{'model':db[_0x1639f1[_0x5068('0x23')]],'as':_0x1639f1['as'],'attributes':_0x1639f1[_0x5068('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x129643){logger[_0x5068('0x17')](_0x5068('0x19'),_0x111c6b);logger[_0x5068('0x11')]('GetTrunk',_0x111c6b,JSON[_0x5068('0x24')](_0x129643));_0xc757bb(_0x129643);})[_0x5068('0x25')](function(_0x3233f3){logger['error'](_0x5068('0x19'),_0x3233f3[_0x5068('0x16')],_0x111c6b);_0x320f3f(_0x32f19f[_0x5068('0x14')](0x1f4,_0x3233f3[_0x5068('0x16')]));});});};exports[_0x5068('0x26')]=function(_0x4fe37a){var _0x5aab8d=this;return new Promise(function(_0x3ef637,_0x2f8d65){return db[_0x5068('0x1a')][_0x5068('0x27')]({'raw':_0x4fe37a[_0x5068('0x1c')]?_0x4fe37a[_0x5068('0x1c')][_0x5068('0x1d')]===undefined?!![]:![]:!![],'where':_0x4fe37a[_0x5068('0x1c')]?_0x4fe37a['options'][_0x5068('0x1e')]||null:null,'attributes':_0x4fe37a[_0x5068('0x1c')]?_0x4fe37a['options']['attributes']||null:null,'include':_0x4fe37a['options']?_0x4fe37a['options'][_0x5068('0x22')]?_[_0x5068('0x21')](_0x4fe37a['options'][_0x5068('0x22')],function(_0x256cf4){return{'model':db[_0x256cf4[_0x5068('0x23')]],'as':_0x256cf4['as'],'attributes':_0x256cf4['attributes'],'include':_0x256cf4[_0x5068('0x22')]?_[_0x5068('0x21')](_0x256cf4['include'],function(_0x4feb2d){return{'model':db[_0x4feb2d['model']],'as':_0x4feb2d['as'],'attributes':_0x4feb2d[_0x5068('0x1f')],'include':_0x4feb2d[_0x5068('0x22')]?_[_0x5068('0x21')](_0x4feb2d[_0x5068('0x22')],function(_0xeeb5c9){return{'model':db[_0xeeb5c9[_0x5068('0x23')]],'as':_0xeeb5c9['as'],'attributes':_0xeeb5c9[_0x5068('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5068('0xf')](function(_0x4200c6){logger[_0x5068('0x17')](_0x5068('0x26'),_0x4fe37a);logger['debug']('ShowTrunk',_0x4fe37a,JSON[_0x5068('0x24')](_0x4200c6));_0x3ef637(_0x4200c6);})['catch'](function(_0x4bb915){logger['error'](_0x5068('0x26'),_0x4bb915[_0x5068('0x16')],_0x4fe37a);_0x2f8d65(_0x5aab8d[_0x5068('0x14')](0x1f4,_0x4bb915[_0x5068('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 66e32e4..643fbb2 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 _0x4b80=['/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/lists','getLists','/:id/agents','/:id/prefixes','getFaxAccounts','/:id/mail_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','diskStorage','join','root','server/files/images/','format','%s-%s','now','originalname','single','file','/:id/login','login','/:id/logout','pause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id','/:id/password','changePassword','delete','removeQueues','/:id/teams','destroy','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeSmsAccounts','removeChatWebsites','/:id/square_projects','removeSquareProjects','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','isAuthenticated','index','get','/describe','whoami','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues'];(function(_0x32c51c,_0x5b47a0){var _0x1a105e=function(_0x2c5ad7){while(--_0x2c5ad7){_0x32c51c['push'](_0x32c51c['shift']());}};_0x1a105e(++_0x5b47a0);}(_0x4b80,0x136));var _0x04b8=function(_0x4f5582,_0x1cb46d){_0x4f5582=_0x4f5582-0x0;var _0x13d279=_0x4b80[_0x4f5582];return _0x13d279;};'use strict';var multer=require(_0x04b8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x04b8('0x1'));var express=require(_0x04b8('0x2'));var router=express[_0x04b8('0x3')]();var fs_extra=require(_0x04b8('0x4'));var auth=require(_0x04b8('0x5'));var interaction=require(_0x04b8('0x6'));var config=require('../../config/environment');var controller=require(_0x04b8('0x7'));router['get']('/',auth[_0x04b8('0x8')](),controller[_0x04b8('0x9')]);router[_0x04b8('0xa')](_0x04b8('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x04b8('0xa')]('/whoami',auth[_0x04b8('0x8')](),controller[_0x04b8('0xc')]);router[_0x04b8('0xa')](_0x04b8('0xd'),auth[_0x04b8('0x8')](),controller[_0x04b8('0xe')]);router[_0x04b8('0xa')]('/:id',auth[_0x04b8('0x8')](),controller[_0x04b8('0xf')]);router[_0x04b8('0xa')](_0x04b8('0x10'),controller[_0x04b8('0x11')]);router[_0x04b8('0xa')](_0x04b8('0x12'),auth[_0x04b8('0x8')](),controller['getOpenTabs']);router[_0x04b8('0xa')](_0x04b8('0x13'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x14')]);router[_0x04b8('0xa')](_0x04b8('0x15'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x16')]);router['get']('/:id/queues_rt',auth[_0x04b8('0x8')](),controller['getVoiceQueuesRt']);router['get'](_0x04b8('0x17'),auth['isAuthenticated'](),controller[_0x04b8('0x18')]);router['get'](_0x04b8('0x19'),auth['isAuthenticated'](),controller[_0x04b8('0x1a')]);router[_0x04b8('0xa')](_0x04b8('0x1b'),auth[_0x04b8('0x8')](),controller['getScreenRecordings']);router[_0x04b8('0xa')]('/:id/chat/interactions',auth[_0x04b8('0x8')](),controller[_0x04b8('0x1c')]);router[_0x04b8('0xa')](_0x04b8('0x1d'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x1e')]);router[_0x04b8('0xa')](_0x04b8('0x1f'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x20')]);router[_0x04b8('0xa')](_0x04b8('0x21'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0x04b8('0xa')](_0x04b8('0x22'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x23')]);router[_0x04b8('0xa')]('/:id/whatsapp/interactions',auth[_0x04b8('0x8')](),controller['getWhatsappInteractions']);router[_0x04b8('0xa')]('/:id/teams',auth[_0x04b8('0x8')](),controller['getTeams']);router[_0x04b8('0xa')](_0x04b8('0x24'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x25')]);router[_0x04b8('0xa')](_0x04b8('0x26'),auth[_0x04b8('0x8')](),controller['getAgents']);router[_0x04b8('0xa')](_0x04b8('0x27'),auth[_0x04b8('0x8')](),controller['getVoicePrefixes']);router[_0x04b8('0xa')]('/:id/fax_accounts',auth[_0x04b8('0x8')](),controller[_0x04b8('0x28')]);router[_0x04b8('0xa')](_0x04b8('0x29'),auth[_0x04b8('0x8')](),controller['getMailAccounts']);router[_0x04b8('0xa')]('/:id/openchannel_accounts',auth[_0x04b8('0x8')](),controller[_0x04b8('0x2a')]);router[_0x04b8('0xa')](_0x04b8('0x2b'),auth['isAuthenticated'](),controller[_0x04b8('0x2c')]);router['get'](_0x04b8('0x2d'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x2e')]);router['get']('/:id/whatsapp_accounts',auth[_0x04b8('0x8')](),controller[_0x04b8('0x2f')]);router[_0x04b8('0xa')]('/:id/square_projects',auth[_0x04b8('0x8')](),controller['getSquareProjects']);router[_0x04b8('0xa')](_0x04b8('0x30'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x31')]);router['get'](_0x04b8('0x32'),auth['isAuthenticated'](),controller[_0x04b8('0x33')]);router[_0x04b8('0x34')](_0x04b8('0x13'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x35')]);router['post']('/',auth[_0x04b8('0x8')](),controller[_0x04b8('0x36')]);router[_0x04b8('0x34')](_0x04b8('0x37'),auth['isAuthenticated'](),controller[_0x04b8('0x38')]);router[_0x04b8('0x34')](_0x04b8('0x15'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x04b8('0x39')]({'destination':function(_0x8369a8,_0x2de7e3,_0x47174c){_0x47174c(null,path[_0x04b8('0x3a')](config[_0x04b8('0x3b')],_0x04b8('0x3c')));},'filename':function(_0x7f3331,_0x40ff7f,_0x1fb4e3){_0x1fb4e3(null,util[_0x04b8('0x3d')](_0x04b8('0x3e'),Date[_0x04b8('0x3f')](),_0x40ff7f[_0x04b8('0x40')]));}})});router[_0x04b8('0x34')](_0x04b8('0x10'),upload[_0x04b8('0x41')](_0x04b8('0x42')),controller['addAvatar']);router[_0x04b8('0x34')](_0x04b8('0x43'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x44')]);router[_0x04b8('0x34')](_0x04b8('0x45'),auth[_0x04b8('0x8')](),controller['logout']);router['post']('/:id/pause',auth[_0x04b8('0x8')](),controller[_0x04b8('0x46')]);router[_0x04b8('0x34')]('/:id/unpause',auth[_0x04b8('0x8')](),controller[_0x04b8('0x47')]);router[_0x04b8('0x34')]('/:id/teams',auth[_0x04b8('0x8')](),controller[_0x04b8('0x48')]);router[_0x04b8('0x34')](_0x04b8('0x49'),auth[_0x04b8('0x8')](),controller['addChatInteractions']);router[_0x04b8('0x34')](_0x04b8('0x4a'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x4b')]);router[_0x04b8('0x34')](_0x04b8('0x4c'),auth[_0x04b8('0x8')](),controller['addFaxInteractions']);router[_0x04b8('0x34')](_0x04b8('0x4d'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x4e')]);router[_0x04b8('0x34')](_0x04b8('0x4f'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x50')]);router['post'](_0x04b8('0x51'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x52')]);router[_0x04b8('0x34')](_0x04b8('0x53'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x54')]);router['post']('/:id/mail_accounts',auth[_0x04b8('0x8')](),controller[_0x04b8('0x55')]);router['post'](_0x04b8('0x56'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x57')]);router['post'](_0x04b8('0x2b'),auth[_0x04b8('0x8')](),controller['addSmsAccounts']);router[_0x04b8('0x34')](_0x04b8('0x2d'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x58')]);router['post'](_0x04b8('0x59'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x5a')]);router['post']('/:id/square_projects',auth[_0x04b8('0x8')](),controller[_0x04b8('0x5b')]);router[_0x04b8('0x34')](_0x04b8('0x32'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x5c')]);router[_0x04b8('0x5d')](_0x04b8('0x5e'),auth[_0x04b8('0x8')](),controller['update']);router[_0x04b8('0x5d')](_0x04b8('0x5f'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x60')]);router[_0x04b8('0x61')](_0x04b8('0x15'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x62')]);router['delete'](_0x04b8('0x63'),auth[_0x04b8('0x8')](),controller['removeTeams']);router[_0x04b8('0x61')](_0x04b8('0x5e'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x64')]);router[_0x04b8('0x61')](_0x04b8('0x49'),auth[_0x04b8('0x8')](),controller['removeChatInteractions']);router['delete'](_0x04b8('0x4a'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x65')]);router['delete']('/:id/fax_interactions',auth[_0x04b8('0x8')](),controller[_0x04b8('0x66')]);router[_0x04b8('0x61')](_0x04b8('0x4d'),auth['isAuthenticated'](),controller[_0x04b8('0x67')]);router[_0x04b8('0x61')](_0x04b8('0x4f'),auth['isAuthenticated'](),controller[_0x04b8('0x68')]);router[_0x04b8('0x61')](_0x04b8('0x51'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x69')]);router[_0x04b8('0x61')](_0x04b8('0x53'),auth['isAuthenticated'](),controller[_0x04b8('0x6a')]);router[_0x04b8('0x61')](_0x04b8('0x29'),auth[_0x04b8('0x8')](),controller['removeMailAccounts']);router[_0x04b8('0x61')]('/:id/openchannel_accounts',auth[_0x04b8('0x8')](),controller['removeOpenchannelAccounts']);router['delete'](_0x04b8('0x2b'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x6b')]);router[_0x04b8('0x61')]('/:id/chat_websites',auth[_0x04b8('0x8')](),controller[_0x04b8('0x6c')]);router[_0x04b8('0x61')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router[_0x04b8('0x61')](_0x04b8('0x6d'),auth[_0x04b8('0x8')](),controller[_0x04b8('0x6e')]);router['delete'](_0x04b8('0x32'),auth[_0x04b8('0x8')](),controller['removeApiKey']);module['exports']=router; \ No newline at end of file +var _0xacd6=['describe','whoami','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getLists','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','addContacts','create','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','now','file','addAvatar','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addMailAccounts','/:id/sms_accounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','/:id/api_key','createApiKey','put','update','/:id/password','changePassword','delete','removeTeams','/:id','removeMailInteractions','/:id/fax_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','/:id/mail_accounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated'];(function(_0xb96c81,_0x531af2){var _0x199248=function(_0x41b3c1){while(--_0x41b3c1){_0xb96c81['push'](_0xb96c81['shift']());}};_0x199248(++_0x531af2);}(_0xacd6,0x150));var _0x6acd=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0xacd6[_0x47fd36];return _0x21a0fc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6acd('0x0'));var timeout=require(_0x6acd('0x1'));var express=require(_0x6acd('0x2'));var router=express[_0x6acd('0x3')]();var fs_extra=require(_0x6acd('0x4'));var auth=require(_0x6acd('0x5'));var interaction=require(_0x6acd('0x6'));var config=require(_0x6acd('0x7'));var controller=require('./user.controller');router[_0x6acd('0x8')]('/',auth['isAuthenticated'](),controller[_0x6acd('0x9')]);router[_0x6acd('0x8')](_0x6acd('0xa'),auth[_0x6acd('0xb')](),controller[_0x6acd('0xc')]);router['get']('/whoami',auth[_0x6acd('0xb')](),controller[_0x6acd('0xd')]);router[_0x6acd('0x8')]('/presence',auth[_0x6acd('0xb')](),controller[_0x6acd('0xe')]);router['get']('/:id',auth[_0x6acd('0xb')](),controller[_0x6acd('0xf')]);router[_0x6acd('0x8')](_0x6acd('0x10'),controller[_0x6acd('0x11')]);router['get'](_0x6acd('0x12'),auth[_0x6acd('0xb')](),controller['getOpenTabs']);router[_0x6acd('0x8')](_0x6acd('0x13'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x14')]);router[_0x6acd('0x8')]('/:id/queues',auth[_0x6acd('0xb')](),controller[_0x6acd('0x15')]);router['get'](_0x6acd('0x16'),auth[_0x6acd('0xb')](),controller['getVoiceQueuesRt']);router[_0x6acd('0x8')]('/:id/groups',auth[_0x6acd('0xb')](),controller[_0x6acd('0x17')]);router[_0x6acd('0x8')](_0x6acd('0x18'),auth['isAuthenticated'](),controller[_0x6acd('0x19')]);router['get'](_0x6acd('0x1a'),auth[_0x6acd('0xb')](),controller['getScreenRecordings']);router[_0x6acd('0x8')]('/:id/chat/interactions',auth[_0x6acd('0xb')](),controller[_0x6acd('0x1b')]);router[_0x6acd('0x8')](_0x6acd('0x1c'),auth[_0x6acd('0xb')](),controller['getOpenchannelInteractions']);router[_0x6acd('0x8')](_0x6acd('0x1d'),auth['isAuthenticated'](),controller[_0x6acd('0x1e')]);router[_0x6acd('0x8')]('/:id/sms/interactions',auth[_0x6acd('0xb')](),controller[_0x6acd('0x1f')]);router[_0x6acd('0x8')](_0x6acd('0x20'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x21')]);router[_0x6acd('0x8')](_0x6acd('0x22'),auth['isAuthenticated'](),controller[_0x6acd('0x23')]);router[_0x6acd('0x8')]('/:id/teams',auth[_0x6acd('0xb')](),controller['getTeams']);router[_0x6acd('0x8')]('/:id/lists',auth['isAuthenticated'](),controller[_0x6acd('0x24')]);router[_0x6acd('0x8')]('/:id/agents',auth[_0x6acd('0xb')](),controller[_0x6acd('0x25')]);router[_0x6acd('0x8')]('/:id/prefixes',auth[_0x6acd('0xb')](),controller[_0x6acd('0x26')]);router[_0x6acd('0x8')](_0x6acd('0x27'),auth['isAuthenticated'](),controller[_0x6acd('0x28')]);router[_0x6acd('0x8')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x6acd('0x29')]);router[_0x6acd('0x8')](_0x6acd('0x2a'),auth[_0x6acd('0xb')](),controller['getOpenchannelAccounts']);router[_0x6acd('0x8')]('/:id/sms_accounts',auth[_0x6acd('0xb')](),controller[_0x6acd('0x2b')]);router['get'](_0x6acd('0x2c'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x2d')]);router[_0x6acd('0x8')](_0x6acd('0x2e'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x2f')]);router[_0x6acd('0x8')](_0x6acd('0x30'),auth['isAuthenticated'](),controller[_0x6acd('0x31')]);router[_0x6acd('0x8')](_0x6acd('0x32'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x33')]);router[_0x6acd('0x8')]('/:id/api_key',auth[_0x6acd('0xb')](),controller[_0x6acd('0x34')]);router[_0x6acd('0x35')](_0x6acd('0x13'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x36')]);router[_0x6acd('0x35')]('/',auth[_0x6acd('0xb')](),controller[_0x6acd('0x37')]);router[_0x6acd('0x35')](_0x6acd('0x38'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x39')]);router[_0x6acd('0x35')](_0x6acd('0x3a'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x3b')]);var upload=multer({'storage':multer[_0x6acd('0x3c')]({'destination':function(_0x5db090,_0x192468,_0x4a4218){_0x4a4218(null,path[_0x6acd('0x3d')](config[_0x6acd('0x3e')],_0x6acd('0x3f')));},'filename':function(_0x2b9045,_0x10f652,_0x2e3c73){_0x2e3c73(null,util[_0x6acd('0x40')](_0x6acd('0x41'),Date[_0x6acd('0x42')](),_0x10f652['originalname']));}})});router[_0x6acd('0x35')](_0x6acd('0x10'),upload['single'](_0x6acd('0x43')),controller[_0x6acd('0x44')]);router['post']('/:id/login',auth['isAuthenticated'](),controller[_0x6acd('0x45')]);router[_0x6acd('0x35')](_0x6acd('0x46'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x47')]);router['post'](_0x6acd('0x48'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x49')]);router[_0x6acd('0x35')](_0x6acd('0x4a'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x4b')]);router[_0x6acd('0x35')](_0x6acd('0x4c'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x4d')]);router[_0x6acd('0x35')](_0x6acd('0x4e'),auth['isAuthenticated'](),controller[_0x6acd('0x4f')]);router['post'](_0x6acd('0x50'),auth['isAuthenticated'](),controller[_0x6acd('0x51')]);router[_0x6acd('0x35')]('/:id/fax_interactions',auth[_0x6acd('0xb')](),controller[_0x6acd('0x52')]);router[_0x6acd('0x35')](_0x6acd('0x53'),auth['isAuthenticated'](),controller[_0x6acd('0x54')]);router[_0x6acd('0x35')]('/:id/openchannel_interactions',auth[_0x6acd('0xb')](),controller[_0x6acd('0x55')]);router[_0x6acd('0x35')](_0x6acd('0x56'),auth[_0x6acd('0xb')](),controller['addWhatsappInteractions']);router[_0x6acd('0x35')](_0x6acd('0x27'),auth['isAuthenticated'](),controller[_0x6acd('0x57')]);router[_0x6acd('0x35')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x6acd('0x58')]);router[_0x6acd('0x35')]('/:id/openchannel_accounts',auth[_0x6acd('0xb')](),controller['addOpenchannelAccounts']);router[_0x6acd('0x35')](_0x6acd('0x59'),auth[_0x6acd('0xb')](),controller['addSmsAccounts']);router[_0x6acd('0x35')]('/:id/chat_websites',auth[_0x6acd('0xb')](),controller[_0x6acd('0x5a')]);router[_0x6acd('0x35')](_0x6acd('0x2e'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x5b')]);router[_0x6acd('0x35')](_0x6acd('0x30'),auth['isAuthenticated'](),controller[_0x6acd('0x5c')]);router[_0x6acd('0x35')](_0x6acd('0x5d'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x5e')]);router[_0x6acd('0x5f')]('/:id',auth[_0x6acd('0xb')](),controller[_0x6acd('0x60')]);router[_0x6acd('0x5f')](_0x6acd('0x61'),auth['isAuthenticated'](),controller[_0x6acd('0x62')]);router[_0x6acd('0x63')]('/:id/queues',auth[_0x6acd('0xb')](),controller['removeQueues']);router[_0x6acd('0x63')](_0x6acd('0x4c'),auth['isAuthenticated'](),controller[_0x6acd('0x64')]);router[_0x6acd('0x63')](_0x6acd('0x65'),auth['isAuthenticated'](),controller['destroy']);router[_0x6acd('0x63')]('/:id/chat_interactions',auth[_0x6acd('0xb')](),controller['removeChatInteractions']);router[_0x6acd('0x63')](_0x6acd('0x50'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x66')]);router[_0x6acd('0x63')](_0x6acd('0x67'),auth[_0x6acd('0xb')](),controller['removeFaxInteractions']);router['delete'](_0x6acd('0x53'),auth['isAuthenticated'](),controller[_0x6acd('0x68')]);router[_0x6acd('0x63')](_0x6acd('0x69'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x6a')]);router[_0x6acd('0x63')](_0x6acd('0x56'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x6b')]);router[_0x6acd('0x63')](_0x6acd('0x27'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x6c')]);router[_0x6acd('0x63')](_0x6acd('0x6d'),auth['isAuthenticated'](),controller[_0x6acd('0x6e')]);router['delete'](_0x6acd('0x2a'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0x6acd('0x63')]('/:id/sms_accounts',auth[_0x6acd('0xb')](),controller[_0x6acd('0x6f')]);router[_0x6acd('0x63')](_0x6acd('0x2c'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x70')]);router[_0x6acd('0x63')](_0x6acd('0x2e'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x71')]);router[_0x6acd('0x63')](_0x6acd('0x30'),auth[_0x6acd('0xb')](),controller['removeSquareProjects']);router[_0x6acd('0x63')](_0x6acd('0x5d'),auth[_0x6acd('0xb')](),controller[_0x6acd('0x72')]);module[_0x6acd('0x73')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 33e4a87..f7e8ca5 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 _0xd0c9=['DEFAULT\x20PAUSE','INTEGER','peer','friend','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','inband','nonat','update','yes','force_rport,comedia','nat','split','all','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<>','refuse','originate','uac','uas','fingerprint','certificate','active','actpass','update,nonat','TEXT','get','isArray','udp','wss','encryption','avpf','force_avp','dtlsverify','dtlssetup','dtlsprivatekey','icesupport','dtlsenable','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','blocked','blockedAt','loginAttempts','sequelize','moment','STRING','name','The\x20name\x20of\x20the\x20user','setDataValue','fullname','callerid','format','getDataValue','email','toLowerCase','ENUM','user','telephone','local','accountcode','\x22%s\x22\x20<%s>','DATE','BOOLEAN'];(function(_0x3186aa,_0x34c21e){var _0x2d8c36=function(_0x239e99){while(--_0x239e99){_0x3186aa['push'](_0x3186aa['shift']());}};_0x2d8c36(++_0x34c21e);}(_0xd0c9,0xe2));var _0x9d0c=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xd0c9[_0x35da42];return _0x370035;};'use strict';var Sequelize=require(_0x9d0c('0x0'));var moment=require(_0x9d0c('0x1'));var util=require('util');var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':![],'unique':_0x9d0c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x36524f){this['setDataValue'](_0x9d0c('0x3'),_0x36524f);this['setDataValue']('defaultuser',_0x36524f);},'comment':_0x9d0c('0x4')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3eec5f){this[_0x9d0c('0x5')](_0x9d0c('0x6'),_0x3eec5f);this[_0x9d0c('0x5')](_0x9d0c('0x7'),util[_0x9d0c('0x8')]('\x22%s\x22\x20<%s>',_0x3eec5f,this[_0x9d0c('0x9')]('internal')));}},'alias':{'type':Sequelize[_0x9d0c('0x2')]},'email':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':![],'unique':_0x9d0c('0xa'),'validate':{'isEmail':!![]},'set':function(_0x53f49a){if(_0x53f49a){this[_0x9d0c('0x5')](_0x9d0c('0xa'),_0x53f49a[_0x9d0c('0xb')]());}}},'role':{'type':Sequelize[_0x9d0c('0xc')]('admin',_0x9d0c('0xd'),'agent',_0x9d0c('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x9d0c('0x2')],'defaultValue':_0x9d0c('0xf')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x52ff64){this[_0x9d0c('0x5')]('internal',_0x52ff64);this[_0x9d0c('0x5')](_0x9d0c('0x10'),_0x52ff64);this[_0x9d0c('0x5')](_0x9d0c('0x7'),util[_0x9d0c('0x8')](_0x9d0c('0x11'),this[_0x9d0c('0x9')](_0x9d0c('0x6')),_0x52ff64));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x9d0c('0x2')]},'mobile':{'type':Sequelize[_0x9d0c('0x2')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x9d0c('0x2')]},'userpic':{'type':Sequelize[_0x9d0c('0x2')]},'city':{'type':Sequelize[_0x9d0c('0x2')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x9d0c('0x12')]},'voicePause':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x9d0c('0x14')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x9d0c('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x9d0c('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x9d0c('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9d0c('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x9d0c('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x9d0c('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x9d0c('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'port':{'type':Sequelize[_0x9d0c('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9d0c('0xc')]('friend',_0x9d0c('0xd'),_0x9d0c('0x16')),'allowNull':!![],'defaultValue':_0x9d0c('0x17')},'context':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0x9d0c('0x18'),_0x9d0c('0x19'),_0x9d0c('0x1a'),_0x9d0c('0x1b'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'permit':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'secret':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'transport':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![],'defaultValue':'udp','set':function(_0x2fcf87){this[_0x9d0c('0x5')](_0x9d0c('0x1c'),_0x2fcf87?_0x2fcf87[_0x9d0c('0x1d')](','):null);},'get':function(){return this[_0x9d0c('0x9')](_0x9d0c('0x1c'))?this['getDataValue']('transport')['split'](','):null;},'comment':_0x9d0c('0x1e')},'dtmfmode':{'type':Sequelize[_0x9d0c('0xc')]('rfc2833',_0x9d0c('0x1f'),'shortinfo',_0x9d0c('0x20'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x9d0c('0xc')]('yes','no',_0x9d0c('0x21'),_0x9d0c('0x22'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![],'defaultValue':_0x9d0c('0x24'),'set':function(_0x1c1de6){this[_0x9d0c('0x5')](_0x9d0c('0x25'),_0x1c1de6?_0x1c1de6[_0x9d0c('0x1d')](','):null);},'get':function(){return this[_0x9d0c('0x9')](_0x9d0c('0x25'))?this['getDataValue'](_0x9d0c('0x25'))[_0x9d0c('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x9d0c('0x2')]},'namedcallgroup':{'type':Sequelize[_0x9d0c('0x2')]},'pickupgroup':{'type':Sequelize[_0x9d0c('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x9d0c('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9d0c('0x2')]},'disallow':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':![],'defaultValue':_0x9d0c('0x27')},'allow':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x528517){this[_0x9d0c('0x5')](_0x9d0c('0x28'),_0x528517?_0x528517[_0x9d0c('0x1d')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x9d0c('0x9')](_0x9d0c('0x28'))?this[_0x9d0c('0x9')]('allow')['split'](';'):null;},'comment':_0x9d0c('0x29')},'autoframing':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![],'set':function(_0x15c93){this[_0x9d0c('0x5')](_0x9d0c('0x2a'),_0x15c93?_0x15c93[_0x9d0c('0x1d')](','):null);},'get':function(){return this[_0x9d0c('0x9')](_0x9d0c('0x2a'))?this[_0x9d0c('0x9')](_0x9d0c('0x2a'))[_0x9d0c('0x26')](','):null;},'comment':_0x9d0c('0x2b')},'trustrpid':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x9d0c('0x23'),'no',_0x9d0c('0x2c')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x9d0c('0x2d')},'amaflags':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x9d0c('0x23'),'no'),'allowNull':!![],'defaultValue':_0x9d0c('0x23')},'busylevel':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'template':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x9d0c('0xc')]('accept',_0x9d0c('0x2e'),_0x9d0c('0x2f')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x9d0c('0x30'),_0x9d0c('0x31')),'allowNull':!![],'defaultValue':_0x9d0c('0x31')},'t38pt_usertpsource':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![],'defaultValue':_0x9d0c('0x23')},'keepalive':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x9d0c('0x23'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9d0c('0xc')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x9d0c('0xc')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x9d0c('0xc')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no',_0x9d0c('0x32'),_0x9d0c('0x33')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x34'),'passive',_0x9d0c('0x35')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x9d0c('0x23'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x9d0c('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x9d0c('0xc')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x9d0c('0xc')](_0x9d0c('0x23'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x9d0c('0xc')]('yes','no',_0x9d0c('0x21'),'update',_0x9d0c('0x36')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x9d0c('0x2')]},'resetPasswordExpires':{'type':Sequelize[_0x9d0c('0x12')]},'passwordResetAt':{'type':Sequelize[_0x9d0c('0x12')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x9d0c('0x37')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x4fbce7){this[_0x9d0c('0x5')]('showWebBar',_0x4fbce7);var _0x1987b2=this[_0x9d0c('0x38')]({'plain':!![]});switch(_0x4fbce7){case 0x0:case 0x1:var _0x44a54b=_0x1987b2['transport']?_[_0x9d0c('0x39')](_0x1987b2[_0x9d0c('0x1c')])?_0x1987b2['transport'][_0x9d0c('0x1d')]():_0x1987b2[_0x9d0c('0x1c')]:_0x9d0c('0x3a');if(_0x44a54b===_0x9d0c('0x3b')){_0x44a54b='udp';}this[_0x9d0c('0x5')](_0x9d0c('0x1c'),_0x44a54b);this[_0x9d0c('0x5')](_0x9d0c('0x3c'),'no');this['setDataValue'](_0x9d0c('0x3d'),null);this[_0x9d0c('0x5')](_0x9d0c('0x3e'),null);this[_0x9d0c('0x5')]('icesupport',null);this[_0x9d0c('0x5')]('dtlsenable',null);this[_0x9d0c('0x5')](_0x9d0c('0x3f'),null);this[_0x9d0c('0x5')](_0x9d0c('0x40'),null);this[_0x9d0c('0x5')]('dtlscertfile',null);this[_0x9d0c('0x5')](_0x9d0c('0x41'),null);this[_0x9d0c('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x9d0c('0x1c'),_0x9d0c('0x3b'));this[_0x9d0c('0x5')](_0x9d0c('0x3c'),_0x9d0c('0x23'));this[_0x9d0c('0x5')](_0x9d0c('0x3d'),_0x9d0c('0x23'));this[_0x9d0c('0x5')](_0x9d0c('0x3e'),_0x9d0c('0x23'));this['setDataValue'](_0x9d0c('0x42'),_0x9d0c('0x23'));this[_0x9d0c('0x5')](_0x9d0c('0x43'),_0x9d0c('0x23'));this[_0x9d0c('0x5')](_0x9d0c('0x3f'),'no');this[_0x9d0c('0x5')](_0x9d0c('0x40'),_0x9d0c('0x35'));this[_0x9d0c('0x5')]('dtlscertfile',_0x1987b2[_0x9d0c('0x44')]||_0x9d0c('0x45'));this['setDataValue'](_0x9d0c('0x41'),_0x1987b2[_0x9d0c('0x41')]||_0x9d0c('0x46'));this[_0x9d0c('0x5')](_0x9d0c('0x47'),'yes');break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x35a767){this[_0x9d0c('0x5')]('permissions',_0x35a767?_0x35a767['join'](','):[]);},'get':function(){return this[_0x9d0c('0x9')](_0x9d0c('0x48'))?_[_0x9d0c('0x49')](this['getDataValue'](_0x9d0c('0x48'))[_0x9d0c('0x26')](','),function(_0x36d48b){return parseInt(_0x36d48b,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x9d0c('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x9d0c('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x9d0c('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x9d0c('0xc')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x9d0c('0x4a')],'get':function(){return this['getDataValue'](_0x9d0c('0x4b'))?this[_0x9d0c('0x9')](_0x9d0c('0x4b')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'interface':{'type':Sequelize[_0x9d0c('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x9d0c('0x2')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![],'set':function(_0x5fa2cb){if(typeof _0x5fa2cb===_0x9d0c('0x4c')){var _0x549dcf=_0x5fa2cb==='1'?!![]:_0x5fa2cb==='0'?![]:_0x5fa2cb===_0x9d0c('0x4d')?!![]:_0x5fa2cb===_0x9d0c('0x4e')?![]:![];this['setDataValue']('screenrecording',_0x549dcf);}else{this[_0x9d0c('0x5')]('screenrecording',_0x5fa2cb);}}},'blocked':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':![],'set':function(_0x4fc9fc){this['setDataValue'](_0x9d0c('0x4f'),_0x4fc9fc);if(_0x4fc9fc===!![]){this[_0x9d0c('0x5')](_0x9d0c('0x50'),moment());this['setDataValue'](_0x9d0c('0x51'),0x0);}else{this[_0x9d0c('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x9d0c('0x12')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9d0c('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x103f=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','nat','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','refuse','uac','uas','fingerprint','certificate','active','passive','update,nonat','TEXT','showWebBar','isArray','udp','wss','encryption','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','avpf','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','toLowerCase','ENUM','user','INTEGER','accountcode','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','transport','split'];(function(_0xc45998,_0x1b9673){var _0x352037=function(_0x4c8ab8){while(--_0x4c8ab8){_0xc45998['push'](_0xc45998['shift']());}};_0x352037(++_0x1b9673);}(_0x103f,0x13e));var _0xf103=function(_0x44521f,_0x2bb941){_0x44521f=_0x44521f-0x0;var _0x5e0012=_0x103f[_0x44521f];return _0x5e0012;};'use strict';var Sequelize=require(_0xf103('0x0'));var moment=require(_0xf103('0x1'));var util=require(_0xf103('0x2'));var _=require(_0xf103('0x3'));module[_0xf103('0x4')]={'name':{'type':Sequelize[_0xf103('0x5')],'allowNull':![],'unique':_0xf103('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x13898d){this[_0xf103('0x7')](_0xf103('0x6'),_0x13898d);this['setDataValue'](_0xf103('0x8'),_0x13898d);},'comment':_0xf103('0x9')},'fullname':{'type':Sequelize[_0xf103('0x5')],'allowNull':![],'set':function(_0x211dbc){this[_0xf103('0x7')](_0xf103('0xa'),_0x211dbc);this[_0xf103('0x7')](_0xf103('0xb'),util[_0xf103('0xc')](_0xf103('0xd'),_0x211dbc,this[_0xf103('0xe')](_0xf103('0xf'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf103('0x5')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x2aa8fd){if(_0x2aa8fd){this['setDataValue']('email',_0x2aa8fd[_0xf103('0x10')]());}}},'role':{'type':Sequelize[_0xf103('0x11')]('admin',_0xf103('0x12'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xf103('0x5')],'defaultValue':'local'},'internal':{'type':Sequelize[_0xf103('0x13')](0xb),'allowNull':![],'unique':_0xf103('0xf'),'set':function(_0x55ec64){this[_0xf103('0x7')](_0xf103('0xf'),_0x55ec64);this['setDataValue'](_0xf103('0x14'),_0x55ec64);this[_0xf103('0x7')]('callerid',util[_0xf103('0xc')]('\x22%s\x22\x20<%s>',this['getDataValue'](_0xf103('0xa')),_0x55ec64));}},'salt':{'type':Sequelize[_0xf103('0x5')]},'phone':{'type':Sequelize[_0xf103('0x5')]},'mobile':{'type':Sequelize[_0xf103('0x5')]},'address':{'type':Sequelize[_0xf103('0x5')]},'zipcode':{'type':Sequelize[_0xf103('0x5')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xf103('0x5')]},'country':{'type':Sequelize[_0xf103('0x5')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xf103('0x15')]},'voicePause':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xf103('0x5')],'defaultValue':_0xf103('0x17')},'lastPauseAt':{'type':Sequelize[_0xf103('0x15')]},'chatCapacity':{'type':Sequelize[_0xf103('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xf103('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xf103('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xf103('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xf103('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xf103('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xf103('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xf103('0x18')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xf103('0x13')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xf103('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0xf103('0x19'),_0xf103('0x12'),_0xf103('0x1a')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xf103('0x1b')},'callingpres':{'type':Sequelize[_0xf103('0x11')]('ALLOWED_NOT_SCREENED',_0xf103('0x1c'),_0xf103('0x1d'),_0xf103('0x1e'),_0xf103('0x1f'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'transport':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![],'defaultValue':'udp','set':function(_0x4bfcf1){this[_0xf103('0x7')](_0xf103('0x20'),_0x4bfcf1?_0x4bfcf1['join'](','):null);},'get':function(){return this[_0xf103('0xe')](_0xf103('0x20'))?this[_0xf103('0xe')](_0xf103('0x20'))[_0xf103('0x21')](','):null;},'comment':_0xf103('0x22')},'dtmfmode':{'type':Sequelize[_0xf103('0x11')](_0xf103('0x23'),_0xf103('0x24'),_0xf103('0x25'),_0xf103('0x26'),_0xf103('0x27')),'allowNull':!![],'defaultValue':_0xf103('0x23')},'directmedia':{'type':Sequelize[_0xf103('0x11')](_0xf103('0x28'),'no',_0xf103('0x29'),_0xf103('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf103('0x11')](_0xf103('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x4909eb){this[_0xf103('0x7')](_0xf103('0x2b'),_0x4909eb?_0x4909eb[_0xf103('0x2c')](','):null);},'get':function(){return this[_0xf103('0xe')](_0xf103('0x2b'))?this[_0xf103('0xe')](_0xf103('0x2b'))[_0xf103('0x21')](','):null;},'comment':_0xf103('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xf103('0x5')]},'pickupgroup':{'type':Sequelize[_0xf103('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xf103('0x5')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf103('0x5')]},'disallow':{'type':Sequelize[_0xf103('0x5')],'allowNull':![],'defaultValue':_0xf103('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf103('0x2f'),'set':function(_0x7ff67a){this[_0xf103('0x7')](_0xf103('0x30'),_0x7ff67a?_0x7ff67a[_0xf103('0x2c')](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0xf103('0x30'))?this[_0xf103('0xe')](_0xf103('0x30'))[_0xf103('0x21')](';'):null;},'comment':_0xf103('0x31')},'autoframing':{'type':Sequelize[_0xf103('0x11')](_0xf103('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![],'set':function(_0x40a424){this[_0xf103('0x7')](_0xf103('0x32'),_0x40a424?_0x40a424[_0xf103('0x2c')](','):null);},'get':function(){return this[_0xf103('0xe')](_0xf103('0x32'))?this[_0xf103('0xe')](_0xf103('0x32'))[_0xf103('0x21')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0xf103('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf103('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf103('0x11')](_0xf103('0x28'),'no',_0xf103('0x33')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xf103('0x11')](_0xf103('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xf103('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xf103('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![],'defaultValue':_0xf103('0x34')},'amaflags':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xf103('0x11')](_0xf103('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xf103('0x11')](_0xf103('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xf103('0x11')](_0xf103('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xf103('0x11')](_0xf103('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xf103('0x11')](_0xf103('0x28'),'no',_0xf103('0x35')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf103('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xf103('0x11')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xf103('0x11')]('accept',_0xf103('0x36'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xf103('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xf103('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xf103('0x11')](_0xf103('0x37'),_0xf103('0x38')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xf103('0x28')},'keepalive':{'type':Sequelize[_0xf103('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xf103('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xf103('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xf103('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xf103('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xf103('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xf103('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xf103('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf103('0x11')](_0xf103('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xf103('0x11')](_0xf103('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xf103('0x11')](_0xf103('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xf103('0x11')](_0xf103('0x28'),'no',_0xf103('0x39'),_0xf103('0x3a')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xf103('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xf103('0x11')](_0xf103('0x3b'),_0xf103('0x3c'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xf103('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xf103('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xf103('0x11')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xf103('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xf103('0x11')]('yes','no',_0xf103('0x29'),_0xf103('0x2a'),_0xf103('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xf103('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xf103('0x15')]},'passwordResetAt':{'type':Sequelize[_0xf103('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xf103('0x3e')]},'showWebBar':{'type':Sequelize[_0xf103('0x13')],'defaultValue':0x0,'set':function(_0xa53837){this[_0xf103('0x7')](_0xf103('0x3f'),_0xa53837);var _0xa35008=this['get']({'plain':!![]});switch(_0xa53837){case 0x0:case 0x1:var _0x53ee5b=_0xa35008[_0xf103('0x20')]?_[_0xf103('0x40')](_0xa35008['transport'])?_0xa35008[_0xf103('0x20')][_0xf103('0x2c')]():_0xa35008[_0xf103('0x20')]:_0xf103('0x41');if(_0x53ee5b===_0xf103('0x42')){_0x53ee5b=_0xf103('0x41');}this[_0xf103('0x7')](_0xf103('0x20'),_0x53ee5b);this[_0xf103('0x7')](_0xf103('0x43'),'no');this[_0xf103('0x7')]('avpf',null);this['setDataValue'](_0xf103('0x44'),null);this[_0xf103('0x7')](_0xf103('0x45'),null);this[_0xf103('0x7')](_0xf103('0x46'),null);this[_0xf103('0x7')](_0xf103('0x47'),null);this[_0xf103('0x7')](_0xf103('0x48'),null);this['setDataValue'](_0xf103('0x49'),null);this[_0xf103('0x7')]('dtlsprivatekey',null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this[_0xf103('0x7')]('transport',_0xf103('0x42'));this[_0xf103('0x7')](_0xf103('0x43'),_0xf103('0x28'));this[_0xf103('0x7')](_0xf103('0x4a'),_0xf103('0x28'));this[_0xf103('0x7')](_0xf103('0x44'),_0xf103('0x28'));this[_0xf103('0x7')]('icesupport',_0xf103('0x28'));this[_0xf103('0x7')](_0xf103('0x46'),'yes');this[_0xf103('0x7')](_0xf103('0x47'),'no');this[_0xf103('0x7')](_0xf103('0x48'),_0xf103('0x4b'));this['setDataValue']('dtlscertfile',_0xa35008[_0xf103('0x49')]||_0xf103('0x4c'));this['setDataValue'](_0xf103('0x4d'),_0xa35008[_0xf103('0x4d')]||'/etc/pki/tls/private/motion.key');this[_0xf103('0x7')](_0xf103('0x4e'),_0xf103('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0xf103('0x3e')],'set':function(_0x33a1fe){this[_0xf103('0x7')](_0xf103('0x4f'),_0x33a1fe?_0x33a1fe[_0xf103('0x2c')](','):[]);},'get':function(){return this[_0xf103('0xe')]('permissions')?_[_0xf103('0x50')](this[_0xf103('0xe')](_0xf103('0x4f'))['split'](','),function(_0x89a110){return parseInt(_0x89a110,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xf103('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xf103('0x5')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xf103('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xf103('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xf103('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xf103('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xf103('0x11')](_0xf103('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xf103('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xf103('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xf103('0x51')],'get':function(){return this[_0xf103('0xe')](_0xf103('0x52'))?this[_0xf103('0xe')](_0xf103('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0xf103('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xf103('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![],'set':function(_0x25025b){if(typeof _0x25025b==='string'){var _0x4ac4ab=_0x25025b==='1'?!![]:_0x25025b==='0'?![]:_0x25025b==='true'?!![]:_0x25025b==='false'?![]:![];this[_0xf103('0x7')](_0xf103('0x53'),_0x4ac4ab);}else{this[_0xf103('0x7')](_0xf103('0x53'),_0x25025b);}}},'blocked':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![],'set':function(_0x2ac53b){this[_0xf103('0x7')](_0xf103('0x54'),_0x2ac53b);if(_0x2ac53b===!![]){this['setDataValue'](_0xf103('0x55'),moment());this[_0xf103('0x7')](_0xf103('0x56'),0x0);}else{this[_0xf103('0x7')](_0xf103('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0xf103('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xf103('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xf103('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xf103('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0xf103('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xf103('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xf103('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 5a3c55f..3303bde 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 _0x5370=['107','109','111','114','115','user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','create','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','all','each','UserProfileSection','isEmpty','autoAssociation','compact','changePassword','oldPassword','Sequelize','ValidationError','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','findOne','enforcePasswordHistory','passwordHistoryLimit','newPassword','previousPasswords','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','add','capitalize','toLowerCase','Queues','penalty','spread','emit','Queue:save','voice','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','isArray','QueueId','Queue:remove','addAvatar','userpic','file','getAvatar','join','server/files/images/logos/default_profile.png','download','server/files/images/','root','getOpenTabs','ChatOpenTabs','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','keys','CmContact','rawAttributes','order','sort','where','pick','hasOwnProperty','List','Tags','color','tag','nolimit','Unknown\x20channel','Queue','Unknown\x20role','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','phone','mobile','format','intrf','user:forcelogout','headers','x-forwarded-for','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','bulkCreate','concat','isMiddleware','resolve','logout','QueuePause','pause','updateAttributes','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','set','%s%s','getTeams','Team','addTeams','omit','getChatQueues','setDataValue','getMailQueues','getSmsQueues','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','getOpenchannelQueues','Openchannel','flatten','transaction','addAgent','getDataValue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','Voice','Chat','Fax','removeAgent','getLists','CmList','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','$and','$or','$gte','$lt','$lte','$eq','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','$any','CmHopper','dialActive','VoiceQueue','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','iat','nonce','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','queues','teams','inbound','getAgents','lower','col','toString','desc','asc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','idle','unknown','unavailable','ringing','charAt','slice','SELECT','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','OpenTabs','bluebird','util','path','lodash','squel','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','localhost','client','http','request','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','end','json','limit','undefined','count','offset','status','Content-Range','update','get','role','admin','Agents','agent','Telephones','telephone','filter','ignore','map','value','includes','UserProfileResource','destroy','sendStatus','stack','name','send','index','User','fieldName','type','password','getOptions','includeAll','include','attributes','push','findAll','rows','openTabs','true','length','chat','dataValues','sms','mail','openchannel','whatsapp','show','params','model','salt','query','filters','intersection','fields','merge','options','find','fax','catch','body','describe','addContacts','ids','internal','Setting','findById','securePassword','validatePasswordPattern','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','103','110','104','105','106'];(function(_0x1644f6,_0x4b2532){var _0x27639a=function(_0x4e86a0){while(--_0x4e86a0){_0x1644f6['push'](_0x1644f6['shift']());}};_0x27639a(++_0x4b2532);}(_0x5370,0x11f));var _0x0537=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5370[_0x501510];return _0x1e6ee5;};'use strict';var moment=require('moment');var BPromise=require(_0x0537('0x0'));var util=require(_0x0537('0x1'));var path=require(_0x0537('0x2'));var fs=require('fs');var _=require(_0x0537('0x3'));var squel=require(_0x0537('0x4'));var jayson=require('jayson/promise');var Redis=require('ioredis');var authService=require(_0x0537('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x0537('0x6'))(_0x0537('0x7'));var utils=require(_0x0537('0x8'));var config=require('../../config/environment');var licenseUtil=require(_0x0537('0x9'));var db=require(_0x0537('0xa'))['db'];var socket=require(_0x0537('0xb'))(new Redis(config[_0x0537('0xc')]));require(_0x0537('0xd'))[_0x0537('0xe')](socket);config[_0x0537('0xc')]=_[_0x0537('0xf')](config[_0x0537('0xc')],{'host':_0x0537('0x10'),'port':0x18eb});var client=jayson[_0x0537('0x11')][_0x0537('0x12')]({'port':0x232a});var values;function respondWithRpcPromise(_0x43ed86,_0x584571,_0x455183,_0x5c0241){return new BPromise(function(_0x28a55a,_0x4decfa){var _0x5de4cd=_0x5c0241||client;return _0x5de4cd[_0x0537('0x13')](_0x43ed86,_0x455183)[_0x0537('0x14')](function(_0x5c1725){logger[_0x0537('0x15')](_0x0537('0x16'),_0x584571,_0x0537('0x17'));logger['debug'](_0x0537('0x18'),_0x584571,_0x0537('0x17'),JSON[_0x0537('0x19')](_0x5c1725));if(_0x5c1725['error']){if(_0x5c1725[_0x0537('0x1a')][_0x0537('0x1b')]===0x1f4){logger[_0x0537('0x1a')](_0x0537('0x16'),_0x584571,_0x5c1725[_0x0537('0x1a')][_0x0537('0x1c')]);return _0x4decfa(_0x5c1725[_0x0537('0x1a')][_0x0537('0x1c')]);}logger['error']('User,\x20%s,\x20%s',_0x584571,_0x5c1725['error'][_0x0537('0x1c')]);return _0x28a55a(_0x5c1725[_0x0537('0x1a')][_0x0537('0x1c')]);}else{logger[_0x0537('0x15')](_0x0537('0x16'),_0x584571,_0x0537('0x17'));_0x28a55a(_0x5c1725[_0x0537('0x1d')][_0x0537('0x1c')]);}})['catch'](function(_0x403f15){logger['error'](_0x0537('0x16'),_0x584571,_0x403f15);_0x4decfa(_0x403f15);});});}function respondWithStatusCode(_0x1f267b,_0x131f95){_0x131f95=_0x131f95||0xcc;return function(_0x4b12d5){if(_0x4b12d5){return _0x1f267b['sendStatus'](_0x131f95);}return _0x1f267b['status'](_0x131f95)[_0x0537('0x1e')]();};}function respondWithResult(_0x2f3c1d,_0x5c1441){_0x5c1441=_0x5c1441||0xc8;return function(_0x3a33f2){if(_0x3a33f2){return _0x2f3c1d['status'](_0x5c1441)[_0x0537('0x1f')](_0x3a33f2);}};}function respondWithFilteredResult(_0x18fa11,_0x104776){return function(_0x9920ac){if(_0x9920ac){var _0x301f94=typeof _0x104776['offset']==='undefined'&&typeof _0x104776[_0x0537('0x20')]===_0x0537('0x21');var _0x861cfa=_0x9920ac[_0x0537('0x22')];var _0x1af181=_0x301f94?0x0:_0x104776[_0x0537('0x23')];var _0x2997c7=_0x301f94?_0x9920ac[_0x0537('0x22')]:_0x104776['offset']+_0x104776[_0x0537('0x20')];var _0x2fceb0;if(_0x2997c7>=_0x861cfa){_0x2997c7=_0x861cfa;_0x2fceb0=0xc8;}else{_0x2fceb0=0xce;}_0x18fa11[_0x0537('0x24')](_0x2fceb0);return _0x18fa11['set'](_0x0537('0x25'),_0x1af181+'-'+_0x2997c7+'/'+_0x861cfa)['json'](_0x9920ac);}return null;};}function saveUpdates(_0x2a5787){return function(_0x4b2a3f){if(_0x4b2a3f){return _0x4b2a3f[_0x0537('0x26')](_0x2a5787)[_0x0537('0x14')](function(_0x9b3a32){return _0x9b3a32;});}return null;};}function removeEntity(_0xd2141e){return function(_0x77e9c0){if(_0x77e9c0){return _0x77e9c0['destroy']()[_0x0537('0x14')](function(){var _0x575024=_0x77e9c0[_0x0537('0x27')]({'plain':!![]});if(_0x575024[_0x0537('0x28')]===_0x0537('0x29'))return;var _0x5674bb=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x0537('0x2a'),'value':_0x0537('0x2b'),'ignore':![]},{'name':_0x0537('0x2c'),'value':_0x0537('0x2d'),'ignore':![]}];var _0x16ad0d=_(_0x5674bb)[_0x0537('0x2e')](_0x0537('0x2f'))[_0x0537('0x30')]('value')[_0x0537('0x31')]();if(_[_0x0537('0x32')](_0x16ad0d,_0x575024[_0x0537('0x28')])){return;}var _0x325fb3=_['find'](_0x5674bb,[_0x0537('0x31'),_0x575024[_0x0537('0x28')]])['name'];return db[_0x0537('0x33')][_0x0537('0x34')]({'where':{'type':_0x325fb3,'resourceId':_0x575024['id']}})[_0x0537('0x14')](function(){return _0x77e9c0;});})['then'](function(){_0xd2141e[_0x0537('0x24')](0xcc)[_0x0537('0x1e')]();});}};}function handleEntityNotFound(_0x11865a){return function(_0x48a411){if(!_0x48a411){_0x11865a[_0x0537('0x35')](0x194);}return _0x48a411;};}function handleError(_0x2f43de,_0x3d5641){_0x3d5641=_0x3d5641||0x1f4;return function(_0x1127ce){logger[_0x0537('0x1a')](_0x1127ce[_0x0537('0x36')]);if(_0x1127ce['name']){delete _0x1127ce[_0x0537('0x37')];}_0x2f43de[_0x0537('0x24')](_0x3d5641)[_0x0537('0x38')](_0x1127ce);};}exports[_0x0537('0x39')]=function(_0x2ef53c,_0x869b66){var _0x524a3b={},_0x2b0f6d={'count':0x0,'rows':[]};var _0x23cc7a=_(db[_0x0537('0x3a')]['rawAttributes'])[_0x0537('0x30')](function(_0x11bd91){return{'name':_0x11bd91[_0x0537('0x3b')],'type':_0x11bd91[_0x0537('0x3c')]['key']};})[_0x0537('0x2e')](function(_0x5019ad){return!_[_0x0537('0x32')]([_0x0537('0x3d'),'salt'],_0x5019ad[_0x0537('0x37')]);})[_0x0537('0x31')]();_0x524a3b=qs[_0x0537('0x3e')](_0x23cc7a,_0x2ef53c);var _0x5ebe3a={'where':_0x524a3b['where']};return db[_0x0537('0x3a')][_0x0537('0x22')](_0x5ebe3a)[_0x0537('0x14')](function(_0x314bab){_0x2b0f6d[_0x0537('0x22')]=_0x314bab;if(_0x2ef53c['query'][_0x0537('0x3f')]){_0x524a3b[_0x0537('0x40')]=[{'all':!![]}];}if(!_[_0x0537('0x32')](_0x524a3b[_0x0537('0x41')],'id')){_0x524a3b[_0x0537('0x41')][_0x0537('0x42')]('id');}return db[_0x0537('0x3a')][_0x0537('0x43')](_0x524a3b);})[_0x0537('0x14')](function(_0x592590){_0x2b0f6d[_0x0537('0x44')]=_0x592590;if(_0x2ef53c['query'][_0x0537('0x45')]===_0x0537('0x46')){var _0x37f956=[];for(var _0x456ddf=0x0;_0x456ddf<_0x2b0f6d[_0x0537('0x44')][_0x0537('0x47')];_0x456ddf++){_0x37f956['push'](get_open_tabs(_0x0537('0x48'),_0x2b0f6d[_0x0537('0x44')][_0x456ddf][_0x0537('0x49')]));_0x37f956[_0x0537('0x42')](get_open_tabs(_0x0537('0x4a'),_0x2b0f6d[_0x0537('0x44')][_0x456ddf][_0x0537('0x49')]));_0x37f956['push'](get_open_tabs('fax',_0x2b0f6d['rows'][_0x456ddf]['dataValues']));_0x37f956[_0x0537('0x42')](get_open_tabs(_0x0537('0x4b'),_0x2b0f6d[_0x0537('0x44')][_0x456ddf]['dataValues']));_0x37f956[_0x0537('0x42')](get_open_tabs(_0x0537('0x4c'),_0x2b0f6d['rows'][_0x456ddf][_0x0537('0x49')]));_0x37f956[_0x0537('0x42')](get_open_tabs(_0x0537('0x4d'),_0x2b0f6d[_0x0537('0x44')][_0x456ddf][_0x0537('0x49')]));}return BPromise['all'](_0x37f956)[_0x0537('0x14')](function(_0x2b5045){return _0x2b0f6d;});}else{return _0x2b0f6d;}})[_0x0537('0x14')](respondWithFilteredResult(_0x869b66,_0x524a3b))['catch'](handleError(_0x869b66,null));};exports[_0x0537('0x4e')]=function(_0x1e7374,_0x36d387){var _0x154505={'raw':![],'where':{'id':_0x1e7374[_0x0537('0x4f')]['id']}},_0x282fa3={};_0x282fa3[_0x0537('0x50')]=_['differenceBy'](_['keys'](db[_0x0537('0x3a')]['rawAttributes']),['password',_0x0537('0x51')]);_0x282fa3[_0x0537('0x52')]=_['keys'](_0x1e7374[_0x0537('0x52')]);_0x282fa3[_0x0537('0x53')]=_[_0x0537('0x54')](_0x282fa3['model'],_0x282fa3[_0x0537('0x52')]);_0x154505[_0x0537('0x41')]=_[_0x0537('0x54')](_0x282fa3[_0x0537('0x50')],qs[_0x0537('0x55')](_0x1e7374['query'][_0x0537('0x55')]));_0x154505['attributes']=_0x154505[_0x0537('0x41')]['length']?_0x154505[_0x0537('0x41')]:_0x282fa3['model'];if(_0x1e7374['query'][_0x0537('0x3f')]){_0x154505['include']=[{'all':!![]}];}_0x154505=_[_0x0537('0x56')]({},_0x154505,_0x1e7374[_0x0537('0x57')]);if(!_[_0x0537('0x32')](_0x154505['attributes'],'id')){_0x154505[_0x0537('0x41')][_0x0537('0x42')]('id');}return db[_0x0537('0x3a')][_0x0537('0x58')](_0x154505)[_0x0537('0x14')](handleEntityNotFound(_0x36d387,null))[_0x0537('0x14')](function(_0x5ef932){var _0x426101=[];values=_0x5ef932;if(_0x1e7374['query'][_0x0537('0x45')]===_0x0537('0x46')){_0x426101[_0x0537('0x42')](get_open_tabs(_0x0537('0x48'),_0x5ef932[_0x0537('0x49')]));_0x426101[_0x0537('0x42')](get_open_tabs(_0x0537('0x4a'),_0x5ef932[_0x0537('0x49')]));_0x426101[_0x0537('0x42')](get_open_tabs('openchannel',_0x5ef932[_0x0537('0x49')]));_0x426101[_0x0537('0x42')](get_open_tabs(_0x0537('0x4d'),_0x5ef932[_0x0537('0x49')]));_0x426101[_0x0537('0x42')](get_open_tabs(_0x0537('0x59'),_0x5ef932[_0x0537('0x49')]));_0x426101[_0x0537('0x42')](get_open_tabs(_0x0537('0x4b'),_0x5ef932[_0x0537('0x49')]));return BPromise['all'](_0x426101);}else{return values;}})[_0x0537('0x14')](function(_0x19821d){return values;})[_0x0537('0x14')](respondWithResult(_0x36d387,null))[_0x0537('0x5a')](handleError(_0x36d387,null));};exports[_0x0537('0x26')]=function(_0x28a425,_0x262062){if(_0x28a425[_0x0537('0x5b')]['id']){delete _0x28a425[_0x0537('0x5b')]['id'];}delete _0x28a425[_0x0537('0x5b')][_0x0537('0x28')];return db[_0x0537('0x3a')][_0x0537('0x58')]({'where':{'id':_0x28a425['params']['id']}})[_0x0537('0x14')](handleEntityNotFound(_0x262062,null))['then'](saveUpdates(_0x28a425[_0x0537('0x5b')],null))['then'](respondWithResult(_0x262062,null))[_0x0537('0x5a')](handleError(_0x262062,null));};exports[_0x0537('0x5c')]=function(_0x69965d,_0x290b39){return db['User'][_0x0537('0x5c')]()['then'](respondWithResult(_0x290b39,null))['catch'](handleError(_0x290b39,null));};exports['addContacts']=function(_0x1378c0,_0x5d005e){return db[_0x0537('0x3a')][_0x0537('0x58')]({'where':{'id':_0x1378c0[_0x0537('0x4f')]['id']}})[_0x0537('0x14')](handleEntityNotFound(_0x5d005e,null))[_0x0537('0x14')](function(_0x4e94ba){if(_0x4e94ba){return _0x4e94ba[_0x0537('0x5d')](_0x1378c0[_0x0537('0x5b')][_0x0537('0x5e')],_['omit'](_0x1378c0[_0x0537('0x5b')],[_0x0537('0x5e'),'id'])||{});}})[_0x0537('0x14')](respondWithResult(_0x5d005e,null))[_0x0537('0x5a')](handleError(_0x5d005e,null));};function validateUser(_0x297d81){return new BPromise(function(_0x5aadef,_0x4b2e8a){if(_0x297d81[_0x0537('0x5f')])return _0x5aadef(_0x297d81);return db[_0x0537('0x60')][_0x0537('0x61')](0x1)[_0x0537('0x14')](function(_0x7ae504){if(_0x7ae504[_0x0537('0x62')])authService[_0x0537('0x63')](_0x297d81[_0x0537('0x3d')]);db[_0x0537('0x3a')]['max']('internal')[_0x0537('0x14')](function(_0x3a2d73){if(_[_0x0537('0x64')](_0x3a2d73)){_0x297d81[_0x0537('0x5f')]=_0x7ae504['min_internal']||0x1;return;}if(_[_0x0537('0x64')](_0x7ae504[_0x0537('0x65')])||_0x7ae504['min_internal']===_0x3a2d73){_0x297d81['internal']=_0x3a2d73+0x1;return;}if(_0x7ae504[_0x0537('0x65')]>_0x3a2d73){_0x297d81[_0x0537('0x5f')]=_0x7ae504['min_internal'];return;}return db[_0x0537('0x66')][_0x0537('0x52')](_0x0537('0x67'),{'type':db[_0x0537('0x66')][_0x0537('0x68')]['SELECT']})[_0x0537('0x14')](function(_0x3ce99d){if(_0x3ce99d&&_0x3ce99d[_0x0537('0x47')]){for(var _0x5efe24=0x0,_0x125e9e=_0x3ce99d[_0x0537('0x47')];_0x5efe24<_0x125e9e&&_['isNil'](_0x297d81['internal']);_0x5efe24++){if(_0x7ae504[_0x0537('0x65')]<=_0x3ce99d[_0x5efe24][_0x0537('0x69')]){_0x297d81['internal']=_0x3ce99d[_0x5efe24][_0x0537('0x69')];}else if(_0x7ae504['min_internal']>_0x3ce99d[_0x5efe24][_0x0537('0x69')]&&_0x7ae504[_0x0537('0x65')]<=_0x3ce99d[_0x5efe24]['to']){_0x297d81[_0x0537('0x5f')]=_0x7ae504['min_internal'];}}}if(_[_0x0537('0x64')](_0x297d81[_0x0537('0x5f')])){_0x297d81[_0x0537('0x5f')]=_0x3a2d73+0x1;}return _0x5aadef(_0x297d81);});});})[_0x0537('0x5a')](function(_0x20c1b9){_0x4b2e8a(_0x20c1b9);});});}function updateUser(_0x5a3d68){return new BPromise(function(_0x111c43,_0x4566d8){try{if(_0x5a3d68[_0x0537('0x6a')]){_0x5a3d68[_0x0537('0x6b')]=_0x5a3d68[_0x0537('0x5f')];_0x5a3d68[_0x0537('0x6c')]={'mailbox':_0x5a3d68['internal'],'password':_0x5a3d68['password'],'fullname':_0x5a3d68[_0x0537('0x6d')],'email':_0x5a3d68[_0x0537('0x6e')]};}if(_0x5a3d68[_0x0537('0x28')]===_0x0537('0x2b')){if(!_0x5a3d68[_0x0537('0x6f')])_0x5a3d68[_0x0537('0x6f')]=[_0x0537('0x70'),'102',_0x0537('0x71'),'113',_0x0537('0x72'),_0x0537('0x73'),_0x0537('0x74'),_0x0537('0x75'),_0x0537('0x76'),'108',_0x0537('0x77'),'100',_0x0537('0x78'),_0x0537('0x79'),_0x0537('0x7a')];}_0x111c43(_0x5a3d68);}catch(_0x106012){_0x4566d8(_0x106012);}});}exports['create']=function(_0x278911,_0x47434d){if(_0x278911[_0x0537('0x7b')]['role']===_0x0537('0x2b'))throw new Error('Unauthorized');if(_0x278911[_0x0537('0x5b')][_0x0537('0x28')]===_0x0537('0x7b')&&_0x278911[_0x0537('0x7b')]['role']!==_0x0537('0x29')){throw new Error(_0x0537('0x7c'));}if(_0x278911[_0x0537('0x5b')][_0x0537('0x28')]===_0x0537('0x29')&&_0x278911[_0x0537('0x7b')][_0x0537('0x28')]!==_0x0537('0x29')){throw new Error(_0x0537('0x7d'));}return licenseUtil[_0x0537('0x7e')]([_0x278911['body']])['then'](function(){return validateUser(_0x278911['body']);})['then'](function(_0x294daa){return updateUser(_0x294daa)[_0x0537('0x14')](function(_0x12de21){if(_0x12de21[_0x0537('0x28')]===_0x0537('0x29')){_0x12de21['settingsEnabled']=_0x278911[_0x0537('0x7b')][_0x0537('0x7f')];delete _0x12de21[_0x0537('0x80')];}return _0x12de21;});})['then'](function(_0x25fdac){return db['User'][_0x0537('0x81')](_0x25fdac,{'include':[{'model':db['VoiceMail'],'as':_0x0537('0x6c')}]});})['then'](function(_0x48f4c9){if(_0x278911[_0x0537('0x5b')][_0x0537('0x28')]===_0x0537('0x7b'))return _0x48f4c9;if(_0x278911['user'][_0x0537('0x28')]!==_0x0537('0x7b'))return _0x48f4c9;return db['UserProfileSection']['find']({'where':{'name':_0x48f4c9[_0x0537('0x28')]==='agent'?_0x0537('0x2a'):_0x0537('0x2c'),'userProfileId':_0x278911[_0x0537('0x7b')][_0x0537('0x80')]},'raw':!![]})[_0x0537('0x14')](function(_0x37e5bc){if(!_0x37e5bc||_0x37e5bc['autoAssociation']!=0x0)return _0x48f4c9;return db[_0x0537('0x33')][_0x0537('0x81')]({'name':_0x48f4c9[_0x0537('0x37')],'resourceId':_0x48f4c9['id'],'type':_0x37e5bc[_0x0537('0x37')],'sectionId':_0x37e5bc['id']},{})[_0x0537('0x14')](function(){return _0x48f4c9;});})[_0x0537('0x5a')](function(_0x4edd41){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4edd41);throw _0x4edd41;});})['then'](respondWithResult(_0x47434d,0xc9))[_0x0537('0x5a')](handleError(_0x47434d,null));};exports['bulkCreate']=function(_0x1f97f6,_0x3a3616){var _0x368d0e=_0x1f97f6[_0x0537('0x5b')];var _0x228657=[];if(_0x1f97f6['user']['role']===_0x0537('0x2b'))throw new Error('Unauthorized');if(_[_0x0537('0x82')](_0x368d0e,['role',_0x0537('0x7b')])&&_0x1f97f6[_0x0537('0x7b')][_0x0537('0x28')]!=='admin'){throw new Error(_0x0537('0x7c'));}if(_['some'](_0x368d0e,[_0x0537('0x28'),'admin'])&&_0x1f97f6[_0x0537('0x7b')][_0x0537('0x28')]!==_0x0537('0x29')){throw new Error(_0x0537('0x83'));}return licenseUtil['checkUserLimits'](_0x368d0e)['then'](function(){return validateUser(_0x368d0e[0x0]);})['then'](function(){for(var _0x13e140=0x1;_0x13e140<_0x368d0e[_0x0537('0x47')];_0x13e140++){var _0x9f6e58=_0x368d0e[_0x13e140-0x1]['internal'];if(!_0x368d0e[_0x13e140][_0x0537('0x5f')])_0x368d0e[_0x13e140][_0x0537('0x5f')]=_0x9f6e58+0x1;_0x228657[_0x0537('0x42')](validateUser(_0x368d0e[_0x13e140]));}return BPromise['all'](_0x228657);})[_0x0537('0x14')](function(){_0x228657=[];for(var _0x563c2a=0x0;_0x563c2a<_0x368d0e[_0x0537('0x47')];_0x563c2a++){_0x228657[_0x0537('0x42')](updateUser(_0x368d0e[_0x563c2a]));}return BPromise[_0x0537('0x84')](_0x228657);})[_0x0537('0x14')](function(){return BPromise[_0x0537('0x85')](_0x368d0e,function(_0x1621e3){return db[_0x0537('0x3a')][_0x0537('0x81')](_0x1621e3,{'include':[{'model':db['VoiceMail'],'as':_0x0537('0x6c')}]})['then'](function(_0x10e383){_0x1621e3['id']=_0x10e383['id'];return _0x1621e3;});});})[_0x0537('0x14')](function(_0x42c4de){if(_0x1f97f6[_0x0537('0x5b')][_0x0537('0x28')]==='user')return _0x42c4de;if(_0x1f97f6[_0x0537('0x7b')]['role']!==_0x0537('0x7b'))return _0x42c4de;var _0xc67ba0=_['some'](_0x42c4de,function(_0x37ff90){return _0x37ff90[_0x0537('0x28')]===_0x0537('0x2b')||_0x37ff90[_0x0537('0x28')]===_0x0537('0x2d');});if(!_0xc67ba0)return _0x42c4de;return db[_0x0537('0x86')][_0x0537('0x43')]({'where':{'name':{'$or':[_0x0537('0x2a'),'Telephones']},'userProfileId':_0x1f97f6[_0x0537('0x7b')][_0x0537('0x80')]},'raw':!![]})[_0x0537('0x14')](function(_0xe47adc){if(_[_0x0537('0x87')](_0xe47adc)||!_[_0x0537('0x82')](_0xe47adc,[_0x0537('0x88'),0x0]))return _0x42c4de;_0x228657=[];var _0x533489=_(_0xe47adc)[_0x0537('0x30')](function(_0x2f91d8){if(_0x2f91d8['autoAssociation']===0x1)return;return _0x2f91d8['name']===_0x0537('0x2a')?_0x0537('0x2b'):_0x0537('0x2d');})[_0x0537('0x89')]()[_0x0537('0x31')]();for(var _0x3e34f8=0x0;_0x3e34f8<_0x42c4de[_0x0537('0x47')];_0x3e34f8++){if(!_[_0x0537('0x32')](_0x533489,_0x42c4de[_0x3e34f8][_0x0537('0x28')]))return;var _0x5ebdb7=_0x42c4de[_0x3e34f8][_0x0537('0x28')]===_0x0537('0x2b')?_0x0537('0x2a'):_0x0537('0x2c');_0x228657[_0x0537('0x42')](db[_0x0537('0x33')][_0x0537('0x81')]({'name':_0x42c4de[_0x3e34f8][_0x0537('0x37')],'resourceId':_0x42c4de[_0x3e34f8]['id'],'type':_0x5ebdb7,'sectionId':_['find'](_0xe47adc,['name',_0x5ebdb7])['id']},{}));}return BPromise['all'](_0x228657);});})[_0x0537('0x14')](respondWithResult(_0x3a3616,0xc9))[_0x0537('0x5a')](handleError(_0x3a3616,null));};exports[_0x0537('0x8a')]=function(_0x5b4d77,_0x554c5b){if(_0x5b4d77[_0x0537('0x5b')]['id']){delete _0x5b4d77[_0x0537('0x5b')]['id'];}return db[_0x0537('0x3a')]['find']({'where':{'id':_0x5b4d77[_0x0537('0x4f')]['id']}})[_0x0537('0x14')](function(_0x2df277){if(!_0x2df277)return null;if(_0x2df277['id']===_0x5b4d77[_0x0537('0x7b')]['id']){if(!_0x5b4d77[_0x0537('0x5b')][_0x0537('0x8b')]||!_0x5b4d77[_0x0537('0x5b')]['newPassword']){throw new db[(_0x0537('0x8c'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x2df277['authenticate'](_0x5b4d77['body'][_0x0537('0x8b')])){throw new db[(_0x0537('0x8c'))][(_0x0537('0x8d'))](_0x0537('0x8e'));}if(_0x5b4d77[_0x0537('0x5b')][_0x0537('0x8b')]===_0x5b4d77[_0x0537('0x5b')]['newPassword']){throw new db['Sequelize'][(_0x0537('0x8d'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x5b4d77['user'][_0x0537('0x28')]==='admin'){if(!_0x5b4d77['body']['newPassword']){throw new db[(_0x0537('0x8c'))]['ValidationError'](_0x0537('0x8f'));}}else if(_0x5b4d77[_0x0537('0x7b')][_0x0537('0x28')]===_0x0537('0x7b')){if(!_0x5b4d77[_0x0537('0x5b')]['newPassword']){throw new db[(_0x0537('0x8c'))]['ValidationError'](_0x0537('0x8f'));}if(_0x2df277[_0x0537('0x28')]!=='agent'){throw new db['Sequelize']['ValidationError'](_0x0537('0x90'));}}else{throw new db[(_0x0537('0x8c'))]['ValidationError'](_0x0537('0x90'));}return _0x2df277;})[_0x0537('0x14')](handleEntityNotFound(_0x554c5b,null))[_0x0537('0x14')](function(_0x28d8a6){return db['Setting'][_0x0537('0x91')]({'attributes':['id',_0x0537('0x62'),_0x0537('0x92'),_0x0537('0x93')]})[_0x0537('0x14')](function(_0xfd3d92){if(_0xfd3d92[_0x0537('0x62')])authService[_0x0537('0x63')](_0x5b4d77[_0x0537('0x5b')]['newPassword']);if(!_0xfd3d92['enforcePasswordHistory']||!_0x28d8a6['previousPasswords'])return _0x28d8a6;authService['validatePasswordHistory'](_0x5b4d77[_0x0537('0x5b')][_0x0537('0x94')],_0x28d8a6[_0x0537('0x95')],_0xfd3d92[_0x0537('0x93')]);return _0x28d8a6;})[_0x0537('0x14')](saveUpdates({'password':_0x5b4d77[_0x0537('0x5b')][_0x0537('0x94')],'passwordResetAt':_0x5b4d77['user']['id']==_0x5b4d77['params']['id']?moment():null,'previousPasswords':authService[_0x0537('0x96')](_0x5b4d77[_0x0537('0x5b')][_0x0537('0x94')],_0x28d8a6[_0x0537('0x95')])},null));})[_0x0537('0x14')](respondWithResult(_0x554c5b,null))[_0x0537('0x5a')](handleError(_0x554c5b,null));};exports[_0x0537('0x97')]=function(_0x182dd9,_0x4f5387){var _0x2a4225=_0x182dd9[_0x0537('0x5b')][_0x0537('0x98')];return db[_0x0537('0x3a')]['find']({'where':{'id':_0x182dd9['params']['id']},'attributes':['id','name','role',_0x0537('0x99'),_0x0537('0x9a'),_0x0537('0x9b'),_0x0537('0x9c')]})[_0x0537('0x14')](handleEntityNotFound(_0x4f5387,null))[_0x0537('0x14')](function(_0x4392ed){if(_0x4392ed){if(!utils['isValidChannel'](_0x2a4225)){throw new db[(_0x0537('0x8c'))][(_0x0537('0x8d'))]('Unknown\x20channel');}return _0x4392ed[_0x0537('0x9d')+_[_0x0537('0x9e')](_0x2a4225[_0x0537('0x9f')]())+_0x0537('0xa0')](_0x182dd9[_0x0537('0x5b')]['ids'],{'penalty':_0x182dd9[_0x0537('0x5b')][_0x0537('0xa1')]||0x0})[_0x0537('0xa2')](function(_0x1a343b){for(var _0x27367d=0x0;_0x27367d<_0x182dd9[_0x0537('0x5b')]['ids'][_0x0537('0x47')];_0x27367d+=0x1){var _0x1b1ff3={'UserId':Number(_0x182dd9[_0x0537('0x4f')]['id'])};_0x1b1ff3[_[_0x0537('0x9e')](_0x2a4225['toLowerCase']())+'QueueId']=Number(_0x182dd9[_0x0537('0x5b')]['ids'][_0x27367d]);socket[_0x0537('0xa3')](_0x0537('0x7b')+_['capitalize'](_0x2a4225[_0x0537('0x9f')]())+_0x0537('0xa4'),_0x1b1ff3);}return _0x1a343b;})[_0x0537('0x14')](function(){if(_0x2a4225===_0x0537('0xa5')){return db['VoiceQueue'][_0x0537('0x43')]({'where':{'id':_0x182dd9['body'][_0x0537('0x5e')]||[]},'raw':!![],'attributes':['id',_0x0537('0x37')]});}})[_0x0537('0x14')](function(_0x280131){var _0x1fd205=_0x4392ed[_0x0537('0x27')]({'plain':!![]});var _0x5ed91a=[];if(_0x2a4225===_0x0537('0xa5')&&_0x1fd205['role']===_0x0537('0x2b')&&_0x1fd205[_0x0537('0x99')]){for(var _0x2f7d31=0x0;_0x2f7d31<_0x280131['length'];_0x2f7d31+=0x1){_0x5ed91a[_0x0537('0x42')]({'membername':_0x1fd205[_0x0537('0x37')],'UserId':_0x1fd205['id'],'queue_name':_0x280131[_0x2f7d31][_0x0537('0x37')],'VoiceQueueId':_0x280131[_0x2f7d31]['id'],'interface':_[_0x0537('0x64')](_0x1fd205[_0x0537('0x9c')])?util['format'](_0x0537('0xa6'),_0x1fd205['name']):_0x1fd205[_0x0537('0x9c')],'paused':_0x1fd205[_0x0537('0x9b')]||![],'penalty':_0x182dd9['body'][_0x0537('0xa1')]||0x0});}return BPromise[_0x0537('0x85')](_0x5ed91a,function(_0x424000){return db[_0x0537('0xa7')][_0x0537('0xa8')](_0x424000);});}return _0x4392ed;});}})[_0x0537('0x14')](respondWithStatusCode(_0x4f5387,null))['catch'](handleError(_0x4f5387,null));};exports[_0x0537('0xa9')]=function(_0x47a3a2,_0x3906b){var _0x558640;return db['User'][_0x0537('0x58')]({'where':{'id':_0x47a3a2[_0x0537('0x4f')]['id']},'attributes':['id','name','role']})[_0x0537('0x14')](handleEntityNotFound(_0x3906b,null))[_0x0537('0x14')](function(_0x43f561){if(_0x43f561){_0x558640=_0x43f561;if(!_0x47a3a2[_0x0537('0x52')][_0x0537('0x98')]||!utils[_0x0537('0xaa')](_0x47a3a2[_0x0537('0x52')][_0x0537('0x98')])){throw new db[(_0x0537('0x8c'))][(_0x0537('0x8d'))]('Unknown\x20channel');}return _0x43f561['remove'+_['capitalize'](_0x47a3a2['query'][_0x0537('0x98')][_0x0537('0x9f')]())+'Queues'](_0x47a3a2[_0x0537('0x52')][_0x0537('0x5e')]);}})[_0x0537('0x14')](function(_0xed88ed){if(_[_0x0537('0xab')](_0x47a3a2['query'][_0x0537('0x5e')])){for(var _0x2e01d5=0x0;_0x2e01d5<_0x47a3a2[_0x0537('0x52')][_0x0537('0x5e')][_0x0537('0x47')];_0x2e01d5+=0x1){var _0x5d389e={'UserId':Number(_0x47a3a2[_0x0537('0x4f')]['id'])};_0x5d389e[_[_0x0537('0x9e')](_0x47a3a2[_0x0537('0x52')]['channel'][_0x0537('0x9f')]())+_0x0537('0xac')]=Number(_0x47a3a2[_0x0537('0x52')]['ids'][_0x2e01d5]);socket[_0x0537('0xa3')](_0x0537('0x7b')+_['capitalize'](_0x47a3a2[_0x0537('0x52')]['channel'][_0x0537('0x9f')]())+'Queue:remove',_0x5d389e);}}else{var _0x5d389e={'UserId':Number(_0x47a3a2[_0x0537('0x4f')]['id'])};_0x5d389e[_[_0x0537('0x9e')](_0x47a3a2['query'][_0x0537('0x98')]['toLowerCase']())+_0x0537('0xac')]=Number(_0x47a3a2[_0x0537('0x52')][_0x0537('0x5e')]);socket[_0x0537('0xa3')](_0x0537('0x7b')+_[_0x0537('0x9e')](_0x47a3a2[_0x0537('0x52')][_0x0537('0x98')][_0x0537('0x9f')]())+_0x0537('0xad'),_0x5d389e);}return _0xed88ed;})[_0x0537('0x14')](function(){if(_0x47a3a2[_0x0537('0x52')][_0x0537('0x98')]===_0x0537('0xa5')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x47a3a2[_0x0537('0x4f')]['id'],'VoiceQueueId':_0x47a3a2[_0x0537('0x52')][_0x0537('0x5e')]},'individualHooks':!![]})['then'](function(){return _0x558640;});}return _0x558640;})['then'](respondWithStatusCode(_0x3906b,null))['catch'](handleError(_0x3906b,null));};exports[_0x0537('0xae')]=function(_0x22cf90,_0x33d8d2){_0x22cf90[_0x0537('0x5b')][_0x0537('0xaf')]=_0x22cf90[_0x0537('0xb0')]['filename'];return db[_0x0537('0x3a')][_0x0537('0x58')]({'where':{'id':_0x22cf90['params']['id']}})[_0x0537('0x14')](handleEntityNotFound(_0x33d8d2,null))[_0x0537('0x14')](saveUpdates(_0x22cf90[_0x0537('0x5b')],null))[_0x0537('0x14')](respondWithResult(_0x33d8d2,null))['catch'](handleError(_0x33d8d2,null));};exports[_0x0537('0xb1')]=function(_0x3317de,_0x3752ff){var _0x10e556=path[_0x0537('0xb2')](config['root'],_0x0537('0xb3'));return db[_0x0537('0x3a')][_0x0537('0x58')]({'where':{'id':_0x3317de[_0x0537('0x4f')]['id']},'attributes':['id',_0x0537('0xaf')],'raw':!![]})[_0x0537('0x14')](handleEntityNotFound(_0x3752ff,null))[_0x0537('0x14')](function(_0x21aaaf){if(_0x21aaaf){if(_[_0x0537('0x64')](_0x21aaaf[_0x0537('0xaf')])){return _0x3752ff[_0x0537('0xb4')](_0x10e556);}else{if(!fs['existsSync'](path['join'](config['root'],_0x0537('0xb5'),_0x21aaaf['userpic']))){return _0x3752ff[_0x0537('0xb4')](_0x10e556);}return _0x3752ff['download'](path[_0x0537('0xb2')](config[_0x0537('0xb6')],'server/files/images/',_0x21aaaf['userpic']));}}})[_0x0537('0x5a')](handleError(_0x3752ff,null));};exports[_0x0537('0xb7')]=function(_0x2176ef,_0x4cc2fc){return db[_0x0537('0x3a')]['find']({'where':{'id':_0x2176ef[_0x0537('0x4f')]['id']},'attributes':['id']})[_0x0537('0x14')](handleEntityNotFound(_0x4cc2fc,null))[_0x0537('0x14')](function(_0x44b2f8){var _0x42b8f9=[];values=_0x44b2f8[_0x0537('0x49')];_0x42b8f9[_0x0537('0x42')](get_open_tabs(_0x0537('0x48'),_0x44b2f8[_0x0537('0x49')]));_0x42b8f9[_0x0537('0x42')](get_open_tabs('sms',_0x44b2f8[_0x0537('0x49')]));_0x42b8f9['push'](get_open_tabs(_0x0537('0x4c'),_0x44b2f8[_0x0537('0x49')]));_0x42b8f9[_0x0537('0x42')](get_open_tabs(_0x0537('0x4d'),_0x44b2f8['dataValues']));_0x42b8f9[_0x0537('0x42')](get_open_tabs(_0x0537('0x59'),_0x44b2f8[_0x0537('0x49')]));_0x42b8f9[_0x0537('0x42')](get_open_tabs('mail',_0x44b2f8[_0x0537('0x49')]));return BPromise[_0x0537('0x84')](_0x42b8f9);})[_0x0537('0x14')](function(_0x2c1d26){var _0x5677a6=[];if(_0x2c1d26){for(var _0x3c7bbd=0x0;_0x3c7bbd=_0x45cb7e){_0x76854e=_0x45cb7e;_0x18e558=0xc8;}else{_0x18e558=0xce;}_0x166f25[_0x4179('0x1c')](_0x18e558);return _0x166f25[_0x4179('0x22')]('Content-Range',_0x26312d+'-'+_0x76854e+'/'+_0x45cb7e)['json'](_0xeabf9c);}return null;};}function saveUpdates(_0x109820){return function(_0x1a89c1){if(_0x1a89c1){return _0x1a89c1['update'](_0x109820)[_0x4179('0x11')](function(_0x5e9b64){return _0x5e9b64;});}return null;};}function removeEntity(_0x5d034c){return function(_0x1d3fcc){if(_0x1d3fcc){return _0x1d3fcc[_0x4179('0x23')]()[_0x4179('0x11')](function(){var _0x36a924=_0x1d3fcc[_0x4179('0x24')]({'plain':!![]});if(_0x36a924['role']==='admin')return;var _0xc4190d=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x4179('0x25'),'value':_0x4179('0x26'),'ignore':![]},{'name':_0x4179('0x27'),'value':'telephone','ignore':![]}];var _0x40cbed=_(_0xc4190d)[_0x4179('0x28')]('ignore')[_0x4179('0x29')]('value')[_0x4179('0x2a')]();if(_[_0x4179('0x2b')](_0x40cbed,_0x36a924['role'])){return;}var _0x20da17=_[_0x4179('0x2c')](_0xc4190d,[_0x4179('0x2a'),_0x36a924[_0x4179('0x2d')]])[_0x4179('0x2e')];return db[_0x4179('0x2f')][_0x4179('0x23')]({'where':{'type':_0x20da17,'resourceId':_0x36a924['id']}})['then'](function(){return _0x1d3fcc;});})['then'](function(){_0x5d034c[_0x4179('0x1c')](0xcc)[_0x4179('0x1d')]();});}};}function handleEntityNotFound(_0x4d64b2){return function(_0xd32ba6){if(!_0xd32ba6){_0x4d64b2[_0x4179('0x1b')](0x194);}return _0xd32ba6;};}function handleError(_0x11a460,_0x42df82){_0x42df82=_0x42df82||0x1f4;return function(_0x27289c){logger['error'](_0x27289c[_0x4179('0x30')]);if(_0x27289c[_0x4179('0x2e')]){delete _0x27289c[_0x4179('0x2e')];}_0x11a460['status'](_0x42df82)['send'](_0x27289c);};}exports[_0x4179('0x31')]=function(_0x13dd2b,_0x303b49){var _0x394485={},_0x13f5cf={'count':0x0,'rows':[]};var _0x5110be=_(db['User'][_0x4179('0x32')])[_0x4179('0x29')](function(_0x37261c){return{'name':_0x37261c[_0x4179('0x33')],'type':_0x37261c['type'][_0x4179('0x34')]};})['filter'](function(_0x209ca0){return!_['includes'](['password','salt'],_0x209ca0[_0x4179('0x2e')]);})[_0x4179('0x2a')]();_0x394485=qs[_0x4179('0x35')](_0x5110be,_0x13dd2b);var _0x318c58={'where':_0x394485['where']};return db[_0x4179('0x36')][_0x4179('0x20')](_0x318c58)[_0x4179('0x11')](function(_0x769e88){_0x13f5cf[_0x4179('0x20')]=_0x769e88;if(_0x13dd2b['query'][_0x4179('0x37')]){_0x394485[_0x4179('0x38')]=[{'all':!![]}];}if(!_['includes'](_0x394485[_0x4179('0x39')],'id')){_0x394485[_0x4179('0x39')]['push']('id');}return db[_0x4179('0x36')][_0x4179('0x3a')](_0x394485);})['then'](function(_0x69621d){_0x13f5cf['rows']=_0x69621d;if(_0x13dd2b['query']['openTabs']===_0x4179('0x3b')){var _0x4b6741=[];for(var _0x5eba40=0x0;_0x5eba40<_0x13f5cf[_0x4179('0x3c')][_0x4179('0x3d')];_0x5eba40++){_0x4b6741[_0x4179('0x3e')](get_open_tabs('chat',_0x13f5cf['rows'][_0x5eba40]['dataValues']));_0x4b6741[_0x4179('0x3e')](get_open_tabs('sms',_0x13f5cf[_0x4179('0x3c')][_0x5eba40]['dataValues']));_0x4b6741[_0x4179('0x3e')](get_open_tabs(_0x4179('0x3f'),_0x13f5cf[_0x4179('0x3c')][_0x5eba40][_0x4179('0x40')]));_0x4b6741[_0x4179('0x3e')](get_open_tabs(_0x4179('0x41'),_0x13f5cf['rows'][_0x5eba40][_0x4179('0x40')]));_0x4b6741[_0x4179('0x3e')](get_open_tabs(_0x4179('0x42'),_0x13f5cf[_0x4179('0x3c')][_0x5eba40][_0x4179('0x40')]));_0x4b6741['push'](get_open_tabs('whatsapp',_0x13f5cf['rows'][_0x5eba40][_0x4179('0x40')]));}return BPromise[_0x4179('0x43')](_0x4b6741)[_0x4179('0x11')](function(_0x2cc1d0){return _0x13f5cf;});}else{return _0x13f5cf;}})[_0x4179('0x11')](respondWithFilteredResult(_0x303b49,_0x394485))[_0x4179('0x44')](handleError(_0x303b49,null));};exports[_0x4179('0x45')]=function(_0x5071d3,_0x32b5fb){var _0x4942cb={'raw':![],'where':{'id':_0x5071d3[_0x4179('0x46')]['id']}},_0x16d0e7={};_0x16d0e7[_0x4179('0x47')]=_['differenceBy'](_[_0x4179('0x48')](db['User'][_0x4179('0x32')]),[_0x4179('0x49'),'salt']);_0x16d0e7[_0x4179('0x4a')]=_[_0x4179('0x48')](_0x5071d3[_0x4179('0x4a')]);_0x16d0e7[_0x4179('0x4b')]=_[_0x4179('0x4c')](_0x16d0e7[_0x4179('0x47')],_0x16d0e7[_0x4179('0x4a')]);_0x4942cb[_0x4179('0x39')]=_[_0x4179('0x4c')](_0x16d0e7[_0x4179('0x47')],qs['fields'](_0x5071d3[_0x4179('0x4a')][_0x4179('0x4d')]));_0x4942cb[_0x4179('0x39')]=_0x4942cb[_0x4179('0x39')][_0x4179('0x3d')]?_0x4942cb[_0x4179('0x39')]:_0x16d0e7['model'];if(_0x5071d3[_0x4179('0x4a')][_0x4179('0x37')]){_0x4942cb[_0x4179('0x38')]=[{'all':!![]}];}_0x4942cb=_['merge']({},_0x4942cb,_0x5071d3['options']);if(!_['includes'](_0x4942cb[_0x4179('0x39')],'id')){_0x4942cb[_0x4179('0x39')][_0x4179('0x3e')]('id');}return db['User'][_0x4179('0x2c')](_0x4942cb)[_0x4179('0x11')](handleEntityNotFound(_0x32b5fb,null))[_0x4179('0x11')](function(_0x30fc58){var _0x3f3b7d=[];values=_0x30fc58;if(_0x5071d3['query']['openTabs']==='true'){_0x3f3b7d['push'](get_open_tabs(_0x4179('0x4e'),_0x30fc58[_0x4179('0x40')]));_0x3f3b7d[_0x4179('0x3e')](get_open_tabs(_0x4179('0x4f'),_0x30fc58['dataValues']));_0x3f3b7d[_0x4179('0x3e')](get_open_tabs(_0x4179('0x42'),_0x30fc58[_0x4179('0x40')]));_0x3f3b7d[_0x4179('0x3e')](get_open_tabs(_0x4179('0x50'),_0x30fc58[_0x4179('0x40')]));_0x3f3b7d['push'](get_open_tabs('fax',_0x30fc58[_0x4179('0x40')]));_0x3f3b7d[_0x4179('0x3e')](get_open_tabs(_0x4179('0x41'),_0x30fc58[_0x4179('0x40')]));return BPromise[_0x4179('0x43')](_0x3f3b7d);}else{return values;}})[_0x4179('0x11')](function(_0x32b80d){return values;})['then'](respondWithResult(_0x32b5fb,null))[_0x4179('0x44')](handleError(_0x32b5fb,null));};exports[_0x4179('0x51')]=function(_0x3902cd,_0x724589){if(_0x3902cd['body']['id']){delete _0x3902cd[_0x4179('0x52')]['id'];}delete _0x3902cd['body'][_0x4179('0x2d')];return db[_0x4179('0x36')][_0x4179('0x2c')]({'where':{'id':_0x3902cd[_0x4179('0x46')]['id']}})[_0x4179('0x11')](handleEntityNotFound(_0x724589,null))[_0x4179('0x11')](saveUpdates(_0x3902cd[_0x4179('0x52')],null))['then'](respondWithResult(_0x724589,null))[_0x4179('0x44')](handleError(_0x724589,null));};exports[_0x4179('0x53')]=function(_0x117999,_0x12774d){return db[_0x4179('0x36')]['describe']()[_0x4179('0x11')](respondWithResult(_0x12774d,null))[_0x4179('0x44')](handleError(_0x12774d,null));};exports[_0x4179('0x54')]=function(_0x26cf04,_0x18468a){return db[_0x4179('0x36')][_0x4179('0x2c')]({'where':{'id':_0x26cf04['params']['id']}})[_0x4179('0x11')](handleEntityNotFound(_0x18468a,null))[_0x4179('0x11')](function(_0x3baecf){if(_0x3baecf){return _0x3baecf[_0x4179('0x54')](_0x26cf04[_0x4179('0x52')][_0x4179('0x55')],_[_0x4179('0x56')](_0x26cf04[_0x4179('0x52')],['ids','id'])||{});}})[_0x4179('0x11')](respondWithResult(_0x18468a,null))['catch'](handleError(_0x18468a,null));};function validateUser(_0x3e7269){return new BPromise(function(_0x5d70d5,_0x1fc56d){if(_0x3e7269['internal'])return _0x5d70d5(_0x3e7269);return db[_0x4179('0x57')][_0x4179('0x58')](0x1)['then'](function(_0x1b7313){if(_0x1b7313[_0x4179('0x59')])authService[_0x4179('0x5a')](_0x3e7269[_0x4179('0x49')]);db['User']['max'](_0x4179('0x5b'))[_0x4179('0x11')](function(_0x1ab7ee){if(_[_0x4179('0x5c')](_0x1ab7ee)){_0x3e7269['internal']=_0x1b7313[_0x4179('0x5d')]||0x1;return;}if(_['isNil'](_0x1b7313[_0x4179('0x5d')])||_0x1b7313[_0x4179('0x5d')]===_0x1ab7ee){_0x3e7269[_0x4179('0x5b')]=_0x1ab7ee+0x1;return;}if(_0x1b7313[_0x4179('0x5d')]>_0x1ab7ee){_0x3e7269[_0x4179('0x5b')]=_0x1b7313['min_internal'];return;}return db[_0x4179('0x5e')][_0x4179('0x4a')](_0x4179('0x5f'),{'type':db[_0x4179('0x5e')][_0x4179('0x60')][_0x4179('0x61')]})[_0x4179('0x11')](function(_0x54b0e9){if(_0x54b0e9&&_0x54b0e9[_0x4179('0x3d')]){for(var _0x3a134f=0x0,_0x25a31e=_0x54b0e9[_0x4179('0x3d')];_0x3a134f<_0x25a31e&&_[_0x4179('0x5c')](_0x3e7269[_0x4179('0x5b')]);_0x3a134f++){if(_0x1b7313[_0x4179('0x5d')]<=_0x54b0e9[_0x3a134f][_0x4179('0x62')]){_0x3e7269[_0x4179('0x5b')]=_0x54b0e9[_0x3a134f][_0x4179('0x62')];}else if(_0x1b7313['min_internal']>_0x54b0e9[_0x3a134f][_0x4179('0x62')]&&_0x1b7313[_0x4179('0x5d')]<=_0x54b0e9[_0x3a134f]['to']){_0x3e7269[_0x4179('0x5b')]=_0x1b7313[_0x4179('0x5d')];}}}if(_[_0x4179('0x5c')](_0x3e7269[_0x4179('0x5b')])){_0x3e7269[_0x4179('0x5b')]=_0x1ab7ee+0x1;}return _0x5d70d5(_0x3e7269);});});})[_0x4179('0x44')](function(_0x2e5500){_0x1fc56d(_0x2e5500);});});}function updateUser(_0xe440b6){return new BPromise(function(_0x57118a,_0x1fae53){try{if(_0xe440b6[_0x4179('0x63')]){_0xe440b6['mailbox']=_0xe440b6[_0x4179('0x5b')];_0xe440b6['VoiceMail']={'mailbox':_0xe440b6[_0x4179('0x5b')],'password':_0xe440b6[_0x4179('0x49')],'fullname':_0xe440b6['fullname'],'email':_0xe440b6[_0x4179('0x64')]};}if(_0xe440b6['role']===_0x4179('0x26')){if(!_0xe440b6[_0x4179('0x65')])_0xe440b6[_0x4179('0x65')]=[_0x4179('0x66'),_0x4179('0x67'),_0x4179('0x68'),_0x4179('0x69'),_0x4179('0x6a'),_0x4179('0x6b'),_0x4179('0x6c'),_0x4179('0x6d'),_0x4179('0x6e'),_0x4179('0x6f'),_0x4179('0x70'),_0x4179('0x71'),_0x4179('0x72'),'114',_0x4179('0x73')];}_0x57118a(_0xe440b6);}catch(_0x1d5ef7){_0x1fae53(_0x1d5ef7);}});}exports[_0x4179('0x74')]=function(_0x1cb2ea,_0x4cb9ba){if(_0x1cb2ea['user']['role']===_0x4179('0x26'))throw new Error('Unauthorized');if(_0x1cb2ea[_0x4179('0x52')][_0x4179('0x2d')]===_0x4179('0x75')&&_0x1cb2ea[_0x4179('0x75')]['role']!=='admin'){throw new Error(_0x4179('0x76'));}if(_0x1cb2ea[_0x4179('0x52')][_0x4179('0x2d')]==='admin'&&_0x1cb2ea[_0x4179('0x75')][_0x4179('0x2d')]!==_0x4179('0x77')){throw new Error(_0x4179('0x78'));}return licenseUtil[_0x4179('0x79')]([_0x1cb2ea[_0x4179('0x52')]])[_0x4179('0x11')](function(){return validateUser(_0x1cb2ea['body']);})[_0x4179('0x11')](function(_0x5d73eb){return updateUser(_0x5d73eb)['then'](function(_0x5cbfef){if(_0x5cbfef[_0x4179('0x2d')]===_0x4179('0x77')){_0x5cbfef[_0x4179('0x7a')]=_0x1cb2ea[_0x4179('0x75')][_0x4179('0x7a')];delete _0x5cbfef['userProfileId'];}return _0x5cbfef;});})[_0x4179('0x11')](function(_0x103257){return db['User']['create'](_0x103257,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]});})[_0x4179('0x11')](function(_0x23a330){if(_0x1cb2ea[_0x4179('0x52')][_0x4179('0x2d')]===_0x4179('0x75'))return _0x23a330;if(_0x1cb2ea[_0x4179('0x75')][_0x4179('0x2d')]!=='user')return _0x23a330;return db['UserProfileSection']['find']({'where':{'name':_0x23a330['role']===_0x4179('0x26')?_0x4179('0x25'):_0x4179('0x27'),'userProfileId':_0x1cb2ea[_0x4179('0x75')][_0x4179('0x7b')]},'raw':!![]})[_0x4179('0x11')](function(_0x35295c){if(!_0x35295c||_0x35295c[_0x4179('0x7c')]!=0x0)return _0x23a330;return db[_0x4179('0x2f')]['create']({'name':_0x23a330['name'],'resourceId':_0x23a330['id'],'type':_0x35295c[_0x4179('0x2e')],'sectionId':_0x35295c['id']},{})[_0x4179('0x11')](function(){return _0x23a330;});})[_0x4179('0x44')](function(_0x2a0fac){logger['error'](_0x4179('0x7d'),_0x2a0fac);throw _0x2a0fac;});})[_0x4179('0x11')](respondWithResult(_0x4cb9ba,0xc9))[_0x4179('0x44')](handleError(_0x4cb9ba,null));};exports[_0x4179('0x7e')]=function(_0x2b4519,_0x3dc0ed){var _0x2300eb=_0x2b4519['body'];var _0x3f06ad=[];if(_0x2b4519[_0x4179('0x75')][_0x4179('0x2d')]===_0x4179('0x26'))throw new Error('Unauthorized');if(_[_0x4179('0x7f')](_0x2300eb,['role',_0x4179('0x75')])&&_0x2b4519[_0x4179('0x75')]['role']!==_0x4179('0x77')){throw new Error(_0x4179('0x76'));}if(_['some'](_0x2300eb,['role',_0x4179('0x77')])&&_0x2b4519['user'][_0x4179('0x2d')]!==_0x4179('0x77')){throw new Error(_0x4179('0x80'));}return licenseUtil['checkUserLimits'](_0x2300eb)['then'](function(){return validateUser(_0x2300eb[0x0]);})[_0x4179('0x11')](function(){for(var _0x892af9=0x1;_0x892af9<_0x2300eb[_0x4179('0x3d')];_0x892af9++){var _0xace84f=_0x2300eb[_0x892af9-0x1][_0x4179('0x5b')];if(!_0x2300eb[_0x892af9][_0x4179('0x5b')])_0x2300eb[_0x892af9]['internal']=_0xace84f+0x1;_0x3f06ad[_0x4179('0x3e')](validateUser(_0x2300eb[_0x892af9]));}return BPromise[_0x4179('0x43')](_0x3f06ad);})[_0x4179('0x11')](function(){_0x3f06ad=[];for(var _0xe45da0=0x0;_0xe45da0<_0x2300eb['length'];_0xe45da0++){_0x3f06ad['push'](updateUser(_0x2300eb[_0xe45da0]));}return BPromise['all'](_0x3f06ad);})[_0x4179('0x11')](function(){return BPromise['each'](_0x2300eb,function(_0x5041d2){return db[_0x4179('0x36')][_0x4179('0x74')](_0x5041d2,{'include':[{'model':db[_0x4179('0x81')],'as':_0x4179('0x81')}]})[_0x4179('0x11')](function(_0xa8cb2a){_0x5041d2['id']=_0xa8cb2a['id'];return _0x5041d2;});});})[_0x4179('0x11')](function(_0x31b1fa){if(_0x2b4519[_0x4179('0x52')]['role']==='user')return _0x31b1fa;if(_0x2b4519['user'][_0x4179('0x2d')]!==_0x4179('0x75'))return _0x31b1fa;var _0x29b2b6=_[_0x4179('0x7f')](_0x31b1fa,function(_0x5b5281){return _0x5b5281['role']===_0x4179('0x26')||_0x5b5281['role']==='telephone';});if(!_0x29b2b6)return _0x31b1fa;return db[_0x4179('0x82')][_0x4179('0x3a')]({'where':{'name':{'$or':[_0x4179('0x25'),_0x4179('0x27')]},'userProfileId':_0x2b4519[_0x4179('0x75')][_0x4179('0x7b')]},'raw':!![]})[_0x4179('0x11')](function(_0x54533f){if(_[_0x4179('0x83')](_0x54533f)||!_[_0x4179('0x7f')](_0x54533f,['autoAssociation',0x0]))return _0x31b1fa;_0x3f06ad=[];var _0x13135e=_(_0x54533f)[_0x4179('0x29')](function(_0x4850a8){if(_0x4850a8[_0x4179('0x7c')]===0x1)return;return _0x4850a8[_0x4179('0x2e')]===_0x4179('0x25')?'agent':_0x4179('0x84');})[_0x4179('0x85')]()['value']();for(var _0x26eae7=0x0;_0x26eae7<_0x31b1fa['length'];_0x26eae7++){if(!_[_0x4179('0x2b')](_0x13135e,_0x31b1fa[_0x26eae7]['role']))return;var _0xccb748=_0x31b1fa[_0x26eae7][_0x4179('0x2d')]===_0x4179('0x26')?_0x4179('0x25'):'Telephones';_0x3f06ad[_0x4179('0x3e')](db['UserProfileResource'][_0x4179('0x74')]({'name':_0x31b1fa[_0x26eae7][_0x4179('0x2e')],'resourceId':_0x31b1fa[_0x26eae7]['id'],'type':_0xccb748,'sectionId':_[_0x4179('0x2c')](_0x54533f,[_0x4179('0x2e'),_0xccb748])['id']},{}));}return BPromise[_0x4179('0x43')](_0x3f06ad);});})[_0x4179('0x11')](respondWithResult(_0x3dc0ed,0xc9))[_0x4179('0x44')](handleError(_0x3dc0ed,null));};exports[_0x4179('0x86')]=function(_0x2dde33,_0x134c6f){if(_0x2dde33['body']['id']){delete _0x2dde33['body']['id'];}return db[_0x4179('0x36')][_0x4179('0x2c')]({'where':{'id':_0x2dde33['params']['id']}})[_0x4179('0x11')](function(_0x313a35){if(!_0x313a35)return null;if(_0x313a35['id']===_0x2dde33['user']['id']){if(!_0x2dde33[_0x4179('0x52')][_0x4179('0x87')]||!_0x2dde33[_0x4179('0x52')]['newPassword']){throw new db[(_0x4179('0x88'))]['ValidationError'](_0x4179('0x89'));}if(!_0x313a35[_0x4179('0x8a')](_0x2dde33[_0x4179('0x52')][_0x4179('0x87')])){throw new db['Sequelize']['ValidationError'](_0x4179('0x8b'));}if(_0x2dde33[_0x4179('0x52')]['oldPassword']===_0x2dde33[_0x4179('0x52')]['newPassword']){throw new db[(_0x4179('0x88'))][(_0x4179('0x8c'))](_0x4179('0x8d'));}}else if(_0x2dde33['user']['role']===_0x4179('0x77')){if(!_0x2dde33[_0x4179('0x52')][_0x4179('0x8e')]){throw new db['Sequelize']['ValidationError'](_0x4179('0x8f'));}}else if(_0x2dde33[_0x4179('0x75')][_0x4179('0x2d')]==='user'){if(!_0x2dde33['body'][_0x4179('0x8e')]){throw new db[(_0x4179('0x88'))][(_0x4179('0x8c'))](_0x4179('0x8f'));}if(_0x313a35[_0x4179('0x2d')]!==_0x4179('0x26')){throw new db['Sequelize'][(_0x4179('0x8c'))](_0x4179('0x90'));}}else{throw new db[(_0x4179('0x88'))]['ValidationError']('Unauthorized');}return _0x313a35;})[_0x4179('0x11')](handleEntityNotFound(_0x134c6f,null))[_0x4179('0x11')](function(_0x5490c3){return db['Setting'][_0x4179('0x91')]({'attributes':['id','securePassword',_0x4179('0x92'),_0x4179('0x93')]})['then'](function(_0x23af55){if(_0x23af55[_0x4179('0x59')])authService[_0x4179('0x5a')](_0x2dde33[_0x4179('0x52')][_0x4179('0x8e')]);if(!_0x23af55['enforcePasswordHistory']||!_0x5490c3[_0x4179('0x94')])return _0x5490c3;authService[_0x4179('0x95')](_0x2dde33[_0x4179('0x52')][_0x4179('0x8e')],_0x5490c3[_0x4179('0x94')],_0x23af55['passwordHistoryLimit']);return _0x5490c3;})[_0x4179('0x11')](saveUpdates({'password':_0x2dde33[_0x4179('0x52')][_0x4179('0x8e')],'passwordResetAt':_0x2dde33[_0x4179('0x75')]['id']==_0x2dde33[_0x4179('0x46')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x2dde33[_0x4179('0x52')][_0x4179('0x8e')],_0x5490c3[_0x4179('0x94')])},null));})['then'](respondWithResult(_0x134c6f,null))[_0x4179('0x44')](handleError(_0x134c6f,null));};exports[_0x4179('0x96')]=function(_0x3bf481,_0x747a3f){var _0xd903e4=_0x3bf481[_0x4179('0x52')][_0x4179('0x97')];return db['User'][_0x4179('0x2c')]({'where':{'id':_0x3bf481['params']['id']},'attributes':['id',_0x4179('0x2e'),_0x4179('0x2d'),'online','loginInPause',_0x4179('0x98'),_0x4179('0x99')]})[_0x4179('0x11')](handleEntityNotFound(_0x747a3f,null))[_0x4179('0x11')](function(_0x2dbf52){if(_0x2dbf52){if(!utils[_0x4179('0x9a')](_0xd903e4)){throw new db[(_0x4179('0x88'))][(_0x4179('0x8c'))]('Unknown\x20channel');}return _0x2dbf52[_0x4179('0x9b')+_[_0x4179('0x9c')](_0xd903e4[_0x4179('0x9d')]())+_0x4179('0x9e')](_0x3bf481[_0x4179('0x52')]['ids'],{'penalty':_0x3bf481[_0x4179('0x52')][_0x4179('0x9f')]||0x0})[_0x4179('0xa0')](function(_0x46ef47){for(var _0x14fb37=0x0;_0x14fb37<_0x3bf481['body'][_0x4179('0x55')][_0x4179('0x3d')];_0x14fb37+=0x1){var _0x2017cb={'UserId':Number(_0x3bf481[_0x4179('0x46')]['id'])};_0x2017cb[_[_0x4179('0x9c')](_0xd903e4[_0x4179('0x9d')]())+'QueueId']=Number(_0x3bf481['body'][_0x4179('0x55')][_0x14fb37]);socket['emit'](_0x4179('0x75')+_[_0x4179('0x9c')](_0xd903e4[_0x4179('0x9d')]())+'Queue:save',_0x2017cb);}return _0x46ef47;})[_0x4179('0x11')](function(){if(_0xd903e4==='voice'){return db[_0x4179('0xa1')][_0x4179('0x3a')]({'where':{'id':_0x3bf481[_0x4179('0x52')][_0x4179('0x55')]||[]},'raw':!![],'attributes':['id',_0x4179('0x2e')]});}})[_0x4179('0x11')](function(_0x9d2fe0){var _0x230f68=_0x2dbf52['get']({'plain':!![]});var _0xebb2ba=[];if(_0xd903e4==='voice'&&_0x230f68[_0x4179('0x2d')]===_0x4179('0x26')&&_0x230f68['online']){for(var _0x20b6f0=0x0;_0x20b6f0<_0x9d2fe0[_0x4179('0x3d')];_0x20b6f0+=0x1){_0xebb2ba[_0x4179('0x3e')]({'membername':_0x230f68[_0x4179('0x2e')],'UserId':_0x230f68['id'],'queue_name':_0x9d2fe0[_0x20b6f0][_0x4179('0x2e')],'VoiceQueueId':_0x9d2fe0[_0x20b6f0]['id'],'interface':_[_0x4179('0x5c')](_0x230f68[_0x4179('0x99')])?util[_0x4179('0xa2')](_0x4179('0xa3'),_0x230f68[_0x4179('0x2e')]):_0x230f68[_0x4179('0x99')],'paused':_0x230f68[_0x4179('0x98')]||![],'penalty':_0x3bf481[_0x4179('0x52')][_0x4179('0x9f')]||0x0});}return BPromise[_0x4179('0xa4')](_0xebb2ba,function(_0x3bfd43){return db[_0x4179('0xa5')][_0x4179('0xa6')](_0x3bfd43);});}return _0x2dbf52;});}})[_0x4179('0x11')](respondWithStatusCode(_0x747a3f,null))[_0x4179('0x44')](handleError(_0x747a3f,null));};exports[_0x4179('0xa7')]=function(_0x2a4e28,_0x5eaef2){var _0x258728;return db[_0x4179('0x36')][_0x4179('0x2c')]({'where':{'id':_0x2a4e28[_0x4179('0x46')]['id']},'attributes':['id',_0x4179('0x2e'),_0x4179('0x2d')]})[_0x4179('0x11')](handleEntityNotFound(_0x5eaef2,null))[_0x4179('0x11')](function(_0xddbe29){if(_0xddbe29){_0x258728=_0xddbe29;if(!_0x2a4e28[_0x4179('0x4a')][_0x4179('0x97')]||!utils['isValidChannel'](_0x2a4e28[_0x4179('0x4a')][_0x4179('0x97')])){throw new db[(_0x4179('0x88'))][(_0x4179('0x8c'))]('Unknown\x20channel');}return _0xddbe29['remove'+_['capitalize'](_0x2a4e28['query'][_0x4179('0x97')]['toLowerCase']())+'Queues'](_0x2a4e28[_0x4179('0x4a')][_0x4179('0x55')]);}})[_0x4179('0x11')](function(_0x361f18){if(_[_0x4179('0xa8')](_0x2a4e28[_0x4179('0x4a')][_0x4179('0x55')])){for(var _0x2981e7=0x0;_0x2981e7<_0x2a4e28[_0x4179('0x4a')][_0x4179('0x55')][_0x4179('0x3d')];_0x2981e7+=0x1){var _0x4400d5={'UserId':Number(_0x2a4e28[_0x4179('0x46')]['id'])};_0x4400d5[_[_0x4179('0x9c')](_0x2a4e28[_0x4179('0x4a')][_0x4179('0x97')][_0x4179('0x9d')]())+_0x4179('0xa9')]=Number(_0x2a4e28[_0x4179('0x4a')][_0x4179('0x55')][_0x2981e7]);socket['emit']('user'+_[_0x4179('0x9c')](_0x2a4e28[_0x4179('0x4a')]['channel'][_0x4179('0x9d')]())+'Queue:remove',_0x4400d5);}}else{var _0x4400d5={'UserId':Number(_0x2a4e28[_0x4179('0x46')]['id'])};_0x4400d5[_['capitalize'](_0x2a4e28['query'][_0x4179('0x97')][_0x4179('0x9d')]())+_0x4179('0xa9')]=Number(_0x2a4e28[_0x4179('0x4a')]['ids']);socket[_0x4179('0xaa')](_0x4179('0x75')+_[_0x4179('0x9c')](_0x2a4e28[_0x4179('0x4a')][_0x4179('0x97')][_0x4179('0x9d')]())+_0x4179('0xab'),_0x4400d5);}return _0x361f18;})[_0x4179('0x11')](function(){if(_0x2a4e28[_0x4179('0x4a')][_0x4179('0x97')]===_0x4179('0xac')){return db['UserVoiceQueueRt'][_0x4179('0x23')]({'where':{'UserId':_0x2a4e28['params']['id'],'VoiceQueueId':_0x2a4e28['query'][_0x4179('0x55')]},'individualHooks':!![]})[_0x4179('0x11')](function(){return _0x258728;});}return _0x258728;})['then'](respondWithStatusCode(_0x5eaef2,null))[_0x4179('0x44')](handleError(_0x5eaef2,null));};exports[_0x4179('0xad')]=function(_0x4d5d62,_0x3436da){_0x4d5d62[_0x4179('0x52')][_0x4179('0xae')]=_0x4d5d62[_0x4179('0xaf')][_0x4179('0xb0')];return db[_0x4179('0x36')][_0x4179('0x2c')]({'where':{'id':_0x4d5d62['params']['id']}})[_0x4179('0x11')](handleEntityNotFound(_0x3436da,null))[_0x4179('0x11')](saveUpdates(_0x4d5d62['body'],null))[_0x4179('0x11')](respondWithResult(_0x3436da,null))[_0x4179('0x44')](handleError(_0x3436da,null));};exports[_0x4179('0xb1')]=function(_0x44f440,_0xd75464){var _0x2d8231=path[_0x4179('0xb2')](config[_0x4179('0xb3')],_0x4179('0xb4'));return db[_0x4179('0x36')][_0x4179('0x2c')]({'where':{'id':_0x44f440[_0x4179('0x46')]['id']},'attributes':['id',_0x4179('0xae')],'raw':!![]})['then'](handleEntityNotFound(_0xd75464,null))[_0x4179('0x11')](function(_0x3e1b51){if(_0x3e1b51){if(_['isNil'](_0x3e1b51[_0x4179('0xae')])){return _0xd75464[_0x4179('0xb5')](_0x2d8231);}else{if(!fs[_0x4179('0xb6')](path[_0x4179('0xb2')](config[_0x4179('0xb3')],'server/files/images/',_0x3e1b51[_0x4179('0xae')]))){return _0xd75464[_0x4179('0xb5')](_0x2d8231);}return _0xd75464[_0x4179('0xb5')](path[_0x4179('0xb2')](config['root'],'server/files/images/',_0x3e1b51[_0x4179('0xae')]));}}})[_0x4179('0x44')](handleError(_0xd75464,null));};exports[_0x4179('0xb7')]=function(_0x16dd53,_0x250d82){return db[_0x4179('0x36')][_0x4179('0x2c')]({'where':{'id':_0x16dd53['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x250d82,null))[_0x4179('0x11')](function(_0x1097fa){var _0x54eaf7=[];values=_0x1097fa[_0x4179('0x40')];_0x54eaf7['push'](get_open_tabs('chat',_0x1097fa[_0x4179('0x40')]));_0x54eaf7[_0x4179('0x3e')](get_open_tabs(_0x4179('0x4f'),_0x1097fa[_0x4179('0x40')]));_0x54eaf7[_0x4179('0x3e')](get_open_tabs(_0x4179('0x42'),_0x1097fa[_0x4179('0x40')]));_0x54eaf7[_0x4179('0x3e')](get_open_tabs(_0x4179('0x50'),_0x1097fa['dataValues']));_0x54eaf7[_0x4179('0x3e')](get_open_tabs('fax',_0x1097fa[_0x4179('0x40')]));_0x54eaf7[_0x4179('0x3e')](get_open_tabs('mail',_0x1097fa['dataValues']));return BPromise[_0x4179('0x43')](_0x54eaf7);})[_0x4179('0x11')](function(_0x38262a){var _0x1ed541=[];if(_0x38262a){for(var _0x37033e=0x0;_0x37033e=_0x3656b5[_0x8d67('0x50')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x8d67('0xf')](function(){if(_0x3ec2c8){return db[_0x8d67('0x47')]['destroy']({'where':{'membername':_0x3ec2c8['name']},'individualHooks':!![]});}})['then'](function(){if(_0x3ec2c8){return _0x3ec2c8[_0x8d67('0x51')]({'raw':!![]});}})['then'](function(_0x3315f9){if(_0x3ec2c8){if(_0x3315f9){var _0x3da177=[];_0x1bc053=_0x3315f9;if(_0x1bc053[_0x8d67('0x2f')]){for(var _0x4e2b52=0x0;_0x4e2b52<_0x1bc053[_0x8d67('0x2f')];_0x4e2b52++){_0x3da177[_0x8d67('0x4b')](db[_0x8d67('0x47')][_0x8d67('0x52')]({'membername':_0x3ec2c8[_0x8d67('0x2d')],'UserId':_0x3ec2c8['id'],'queue_name':_0x1bc053[_0x4e2b52]['name'],'VoiceQueueId':_0x1bc053[_0x4e2b52]['id'],'interface':_0x423120,'paused':_0x3ec2c8['loginInPause']||![],'penalty':_0x1bc053[_0x4e2b52]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x8d67('0x48')](_0x3da177);}}}})[_0x8d67('0xf')](function(){if(_0x3ec2c8){return db[_0x8d67('0x2c')][_0x8d67('0x1a')]({'where':{'membername':_0x3ec2c8[_0x8d67('0x2d')],'exitAt':null}});}})[_0x8d67('0xf')](function(_0x268068){if(_0x3ec2c8){if(_0x268068&&_0x268068[_0x8d67('0x2f')]){var _0x176c76=[];_0x268068['forEach'](function(_0x4085e6){_0x176c76[_0x8d67('0x4b')](_0x4085e6[_0x8d67('0x2b')]({'exitAt':moment()[_0x8d67('0x30')](_0x8d67('0x31'))}));});return BPromise[_0x8d67('0x48')](_0x176c76);}}})[_0x8d67('0xf')](function(_0x29399d){if(_0x3ec2c8){var _0x293941=[];var _0x149b78=[];var _0x253849=utils['getChannels']();var _0x28eb6b={'membername':_0x3ec2c8['name'],'interface':_0x423120,'enterAt':moment()[_0x8d67('0x30')](_0x8d67('0x31')),'role':_0x3ec2c8[_0x8d67('0x28')],'internal':_0x3ec2c8[_0x8d67('0x29')]};_0x253849[_0x8d67('0x32')](function(_0x55edcd){_0x293941[_0x8d67('0x4b')](_[_0x8d67('0x53')]({'channel':_0x55edcd,'type':_0x8d67('0x54'),'data1':_0x8d67('0x55'),'data2':_0x423120},_0x28eb6b));if(_0x3ec2c8[_0x8d67('0x4f')]){_0x149b78[_0x8d67('0x4b')](_[_0x8d67('0x53')]({'channel':_0x55edcd,'type':_0x8d67('0x2e'),'data1':_0x8d67('0x56')},_0x28eb6b));}});return db[_0x8d67('0x2c')][_0x8d67('0x38')](_0x293941[_0x8d67('0x57')](_0x149b78),{'individualHooks':!![]});}})[_0x8d67('0xf')](function(){if(_0x3ec2c8){return _0x3ec2c8[_0x8d67('0x2b')]({'online':!![],'lastLoginAt':moment()[_0x8d67('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x3ec2c8[_0x8d67('0x4f')]||![],'mailPause':_0x3ec2c8[_0x8d67('0x4f')]||![],'chatPause':_0x3ec2c8[_0x8d67('0x4f')]||![],'faxPause':_0x3ec2c8[_0x8d67('0x4f')]||![],'smsPause':_0x3ec2c8[_0x8d67('0x4f')]||![],'openchannelPause':_0x3ec2c8['loginInPause']||![],'pauseType':_0x3ec2c8[_0x8d67('0x4f')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x8d67('0x30')](_0x8d67('0x31')),'interface':_0x423120});}})[_0x8d67('0xf')](function(_0x419d51){_0x140b6c(_0x419d51);})[_0x8d67('0x18')](function(_0x2f48a1){_0x52ff28(_0x2ee55b[_0x8d67('0x14')](0x1f4,_0x2f48a1[_0x8d67('0x17')]));});});}; \ No newline at end of file +var _0x891e=['raw','PauseUser','name','role','internal','interface','update','MemberReport','findAll','PAUSE','length','format','getChannels','forEach','push','isNil','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','body','type','DEFAULT\x20PAUSE','bulkCreate','UnpauseUser','findOne','channel','isValidChannel','Unknown\x20channel','voice','UserVoiceQueueRt','system','chat','sms','set','%s%s','Pause','all','LogoutUser','mobile','phone','loginInPause','count','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','merge','LOGIN','callysquare','concat','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','localhost','./user.socket','register','request','then','info','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','User,\x20%s,\x20%s','result','catch','GetUser','User','options','where','limit','include','map','attributes','model','ShowUser','find'];(function(_0x1c1509,_0x2dfa81){var _0xf11b7=function(_0x17949e){while(--_0x17949e){_0x1c1509['push'](_0x1c1509['shift']());}};_0xf11b7(++_0x2dfa81);}(_0x891e,0x198));var _0xe891=function(_0x52121d,_0x1d1704){_0x52121d=_0x52121d-0x0;var _0x448627=_0x891e[_0x52121d];return _0x448627;};'use strict';var _=require(_0xe891('0x0'));var util=require('util');var moment=require(_0xe891('0x1'));var BPromise=require(_0xe891('0x2'));var rs=require(_0xe891('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe891('0x4'))['db'];var utils=require(_0xe891('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xe891('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe891('0x7')][_0xe891('0x8')]({'port':0x232a});config[_0xe891('0x9')]=_['defaults'](config['redis'],{'host':_0xe891('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe891('0x9')]));require(_0xe891('0xb'))[_0xe891('0xc')](socket);function respondWithRpcPromise(_0x25a221,_0xcae207,_0x5a2586){return new BPromise(function(_0x1deb29,_0x447cf0){return client[_0xe891('0xd')](_0x25a221,_0x5a2586)[_0xe891('0xe')](function(_0x45f5fe){logger[_0xe891('0xf')]('User,\x20%s,\x20%s',_0xcae207,_0xe891('0x10'));logger[_0xe891('0x11')](_0xe891('0x12'),_0xcae207,_0xe891('0x10'),JSON[_0xe891('0x13')](_0x45f5fe));if(_0x45f5fe[_0xe891('0x14')]){if(_0x45f5fe[_0xe891('0x14')][_0xe891('0x15')]===0x1f4){logger[_0xe891('0x14')]('User,\x20%s,\x20%s',_0xcae207,_0x45f5fe[_0xe891('0x14')][_0xe891('0x16')]);return _0x447cf0(_0x45f5fe[_0xe891('0x14')][_0xe891('0x16')]);}logger[_0xe891('0x14')](_0xe891('0x17'),_0xcae207,_0x45f5fe[_0xe891('0x14')][_0xe891('0x16')]);return _0x1deb29(_0x45f5fe['error']['message']);}else{logger[_0xe891('0xf')](_0xe891('0x17'),_0xcae207,'request\x20sent');_0x1deb29(_0x45f5fe[_0xe891('0x18')][_0xe891('0x16')]);}})[_0xe891('0x19')](function(_0x3edb7f){logger['error'](_0xe891('0x17'),_0xcae207,_0x3edb7f);_0x447cf0(_0x3edb7f);});});}exports[_0xe891('0x1a')]=function(_0xf057f6){var _0x4e2c8e=this;return new Promise(function(_0x4888cc,_0x35578a){return db[_0xe891('0x1b')]['findAll']({'raw':_0xf057f6['options']?_0xf057f6[_0xe891('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xf057f6[_0xe891('0x1c')]?_0xf057f6[_0xe891('0x1c')][_0xe891('0x1d')]||null:null,'attributes':_0xf057f6[_0xe891('0x1c')]?_0xf057f6[_0xe891('0x1c')]['attributes']||null:null,'limit':_0xf057f6[_0xe891('0x1c')]?_0xf057f6[_0xe891('0x1c')][_0xe891('0x1e')]||null:null,'include':_0xf057f6['options']?_0xf057f6[_0xe891('0x1c')][_0xe891('0x1f')]?_[_0xe891('0x20')](_0xf057f6[_0xe891('0x1c')][_0xe891('0x1f')],function(_0x42250f){return{'model':db[_0x42250f['model']],'as':_0x42250f['as'],'attributes':_0x42250f[_0xe891('0x21')],'include':_0x42250f[_0xe891('0x1f')]?_[_0xe891('0x20')](_0x42250f[_0xe891('0x1f')],function(_0x423675){return{'model':db[_0x423675['model']],'as':_0x423675['as'],'attributes':_0x423675[_0xe891('0x21')],'include':_0x423675[_0xe891('0x1f')]?_[_0xe891('0x20')](_0x423675[_0xe891('0x1f')],function(_0x2204fa){return{'model':db[_0x2204fa[_0xe891('0x22')]],'as':_0x2204fa['as'],'attributes':_0x2204fa['attributes']};}):[]};}):[]};}):[]:[]})[_0xe891('0xe')](function(_0x1433f6){logger[_0xe891('0xf')]('GetUser',_0xf057f6);logger[_0xe891('0x11')](_0xe891('0x1a'),_0xf057f6,JSON['stringify'](_0x1433f6));_0x4888cc(_0x1433f6);})['catch'](function(_0x1ecf21){logger[_0xe891('0x14')](_0xe891('0x1a'),_0x1ecf21[_0xe891('0x16')],_0xf057f6);_0x35578a(_0x4e2c8e['error'](0x1f4,_0x1ecf21[_0xe891('0x16')]));});});};exports[_0xe891('0x23')]=function(_0x4fb271){var _0x1f580c=this;return new Promise(function(_0x475e21,_0x295c80){return db[_0xe891('0x1b')][_0xe891('0x24')]({'raw':_0x4fb271['options']?_0x4fb271[_0xe891('0x1c')][_0xe891('0x25')]===undefined?!![]:![]:!![],'where':_0x4fb271[_0xe891('0x1c')]?_0x4fb271['options'][_0xe891('0x1d')]||null:null,'attributes':_0x4fb271[_0xe891('0x1c')]?_0x4fb271[_0xe891('0x1c')][_0xe891('0x21')]||null:null,'include':_0x4fb271['options']?_0x4fb271['options'][_0xe891('0x1f')]?_[_0xe891('0x20')](_0x4fb271[_0xe891('0x1c')][_0xe891('0x1f')],function(_0x451441){return{'model':db[_0x451441['model']],'as':_0x451441['as'],'attributes':_0x451441[_0xe891('0x21')],'include':_0x451441[_0xe891('0x1f')]?_[_0xe891('0x20')](_0x451441[_0xe891('0x1f')],function(_0x595b1c){return{'model':db[_0x595b1c['model']],'as':_0x595b1c['as'],'attributes':_0x595b1c[_0xe891('0x21')],'include':_0x595b1c[_0xe891('0x1f')]?_[_0xe891('0x20')](_0x595b1c['include'],function(_0x73dc41){return{'model':db[_0x73dc41[_0xe891('0x22')]],'as':_0x73dc41['as'],'attributes':_0x73dc41[_0xe891('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16c794){logger['info'](_0xe891('0x23'),_0x4fb271);logger[_0xe891('0x11')]('ShowUser',_0x4fb271,JSON[_0xe891('0x13')](_0x16c794));_0x475e21(_0x16c794);})[_0xe891('0x19')](function(_0x63fdf9){logger[_0xe891('0x14')](_0xe891('0x23'),_0x63fdf9[_0xe891('0x16')],_0x4fb271);_0x295c80(_0x1f580c['error'](0x1f4,_0x63fdf9[_0xe891('0x16')]));});});};exports[_0xe891('0x26')]=function(_0x1d5236){var _0x1826ee=this;return new Promise(function(_0x6a1f10,_0x5c27c0){var _0x468c9a;return db[_0xe891('0x1b')][_0xe891('0x24')]({'where':_0x1d5236[_0xe891('0x1c')][_0xe891('0x1d')]||{},'attributes':['id',_0xe891('0x27'),_0xe891('0x28'),_0xe891('0x29'),_0xe891('0x2a')]})[_0xe891('0xe')](function(_0x299605){if(_0x299605){_0x468c9a=_0x299605;return db['UserVoiceQueueRt'][_0xe891('0x2b')]({'paused':0x1},{'where':{'UserId':_0x468c9a['id']},'individualHooks':!![]});}})['then'](function(){if(_0x468c9a){return db[_0xe891('0x2c')][_0xe891('0x2d')]({'where':{'membername':_0x468c9a[_0xe891('0x27')],'type':_0xe891('0x2e'),'exitAt':null}});}})[_0xe891('0xe')](function(_0x4976a4){if(_0x468c9a){if(_0x4976a4&&_0x4976a4[_0xe891('0x2f')]){var _0x19a913=moment()[_0xe891('0x30')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0xd8e574=0x0,_0x1249e7=_0x4976a4[_0xe891('0x2f')];_0xd8e574<_0x1249e7;_0xd8e574++){_0x4976a4[_0xd8e574]['updateAttributes']({'exitAt':_0x19a913});}}}})[_0xe891('0xe')](function(){if(_0x468c9a){var _0x132b58=[];var _0x29bfdc=utils[_0xe891('0x31')]();_0x29bfdc[_0xe891('0x32')](function(_0x28ca72){_0x132b58[_0xe891('0x33')]({'channel':_0x28ca72,'membername':_0x468c9a[_0xe891('0x27')],'interface':_[_0xe891('0x34')](_0x468c9a[_0xe891('0x2a')])?util[_0xe891('0x30')](_0xe891('0x35'),_0x468c9a[_0xe891('0x27')]):_0x468c9a[_0xe891('0x2a')],'type':_0xe891('0x2e'),'enterAt':moment()[_0xe891('0x30')](_0xe891('0x36')),'data1':_0x1d5236[_0xe891('0x37')][_0xe891('0x38')]||_0xe891('0x39'),'role':_0x468c9a['role'],'internal':_0x468c9a[_0xe891('0x29')],'uniqueid':_0x1d5236[_0xe891('0x37')]['uniqueid']||null});});return db[_0xe891('0x2c')][_0xe891('0x3a')](_0x132b58,{'individualHooks':!![]});}})[_0xe891('0xe')](function(){if(_0x468c9a){return _0x468c9a['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x1d5236['body']['type']||_0xe891('0x39'),'lastPauseAt':moment()[_0xe891('0x30')](_0xe891('0x36'))});}})[_0xe891('0xe')](function(_0x5b6f22){_0x6a1f10(_0x5b6f22);})[_0xe891('0x19')](function(_0x3819e9){_0x5c27c0(_0x1826ee[_0xe891('0x14')](0x1f4,_0x3819e9[_0xe891('0x16')]));});});};exports[_0xe891('0x3b')]=function(_0x402484){var _0x4b5259=this;return new Promise(function(_0x522472,_0x2e4f3b){var _0x59e4e2;return db[_0xe891('0x1b')][_0xe891('0x3c')]({'where':_0x402484['options']['where']||{},'attributes':['id',_0xe891('0x27')]})[_0xe891('0xe')](function(_0x1a40c3){if(_0x1a40c3){_0x59e4e2=_0x1a40c3;if(_0x402484[_0xe891('0x37')][_0xe891('0x3d')]&&!utils[_0xe891('0x3e')](_0x402484[_0xe891('0x37')][_0xe891('0x3d')])){throw new Error(_0xe891('0x3f'));}switch(_0x402484['body']['channel']){case _0xe891('0x40'):return db[_0xe891('0x41')]['update']({'paused':0x0},{'where':{'UserId':_0x59e4e2['id']}})['then'](function(){return db[_0xe891('0x2c')][_0xe891('0x24')]({'where':{'channel':_0x402484['body'][_0xe891('0x3d')],'membername':_0x59e4e2['name'],'type':_0xe891('0x2e'),'exitAt':null}});})[_0xe891('0xe')](function(_0x258ab8){if(_0x258ab8){return _0x258ab8[_0xe891('0x2b')]({'exitAt':moment()[_0xe891('0x30')](_0xe891('0x36')),'data2':_0xe891('0x42')},{'individualHooks':!![]});}return null;})[_0xe891('0xe')](function(){return _0x59e4e2[_0xe891('0x2b')]({'voicePause':![]});});case'mail':case _0xe891('0x43'):case'fax':case _0xe891('0x44'):case'openchannel':case'whatsapp':return db[_0xe891('0x2c')][_0xe891('0x24')]({'where':{'channel':_0x402484[_0xe891('0x37')][_0xe891('0x3d')],'membername':_0x59e4e2[_0xe891('0x27')],'type':_0xe891('0x2e'),'exitAt':null}})['then'](function(_0x3b09b3){return _0x3b09b3['update']({'exitAt':moment()['format'](_0xe891('0x36')),'data2':_0xe891('0x42')},{'individualHooks':!![]});})['then'](function(){var _0x9bdb7b={};_[_0xe891('0x45')](_0x9bdb7b,util[_0xe891('0x30')](_0xe891('0x46'),_0x402484[_0xe891('0x37')][_0xe891('0x3d')],_0xe891('0x47')),![]);return _0x59e4e2[_0xe891('0x2b')](_0x9bdb7b);});default:return db['UserVoiceQueueRt'][_0xe891('0x2b')]({'paused':0x0},{'where':{'UserId':_0x59e4e2['id']}})['then'](function(){return db[_0xe891('0x2c')][_0xe891('0x2d')]({'where':{'membername':_0x59e4e2[_0xe891('0x27')],'type':_0xe891('0x2e'),'exitAt':null}});})[_0xe891('0xe')](function(_0x281792){var _0x454cbc=[];_0x281792[_0xe891('0x32')](function(_0x32bf6d){_0x454cbc[_0xe891('0x33')](_0x32bf6d['update']({'exitAt':moment()[_0xe891('0x30')](_0xe891('0x36')),'data2':'system'}));});return BPromise[_0xe891('0x48')](_0x454cbc);})[_0xe891('0xe')](function(){return _0x59e4e2[_0xe891('0x2b')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xe891('0xe')](function(_0x581ec2){_0x522472(_0x581ec2);})[_0xe891('0x19')](function(_0x55399e){_0x2e4f3b(_0x4b5259[_0xe891('0x14')](0x1f4,_0x55399e[_0xe891('0x16')]));});});};exports[_0xe891('0x49')]=function(_0x32f8ee){var _0x14f0e2=this;return new Promise(function(_0x454d76,_0x6b460f){var _0x38bb4b;return db['User'][_0xe891('0x3c')]({'where':_0x32f8ee[_0xe891('0x1c')]['where']||{},'attributes':['id',_0xe891('0x27')]})[_0xe891('0xe')](function(_0x2b6858){if(_0x2b6858){_0x38bb4b=_0x2b6858;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x38bb4b[_0xe891('0x27')]},'individualHooks':!![]});}})[_0xe891('0xe')](function(){if(_0x38bb4b){return db['MemberReport'][_0xe891('0x2d')]({'where':{'membername':_0x38bb4b[_0xe891('0x27')],'exitAt':null}});}})['then'](function(_0x1db737){if(_0x38bb4b){if(_0x1db737&&_0x1db737[_0xe891('0x2f')]){var _0x36c09b=[];_0x1db737['forEach'](function(_0x48744d){_0x36c09b[_0xe891('0x33')](_0x48744d[_0xe891('0x2b')]({'exitAt':moment()[_0xe891('0x30')](_0xe891('0x36'))}));});return BPromise[_0xe891('0x48')](_0x36c09b);}}})[_0xe891('0xe')](function(){if(_0x38bb4b){return _0x38bb4b[_0xe891('0x2b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xe891('0xe')](function(_0x234f52){_0x454d76(_0x234f52);})[_0xe891('0x19')](function(_0x333f95){_0x6b460f(_0x14f0e2['error'](0x1f4,_0x333f95[_0xe891('0x16')]));});});};exports['LoginUser']=function(_0x472bc5){var _0x2912b6=this;return new Promise(function(_0x56ae31,_0x1d7d79){var _0x200a24;var _0x36f1bb;var _0x585ce9;var _0x2979bc;return db[_0xe891('0x1b')][_0xe891('0x3c')]({'where':_0x472bc5[_0xe891('0x1c')]['where']||{},'attributes':['id',_0xe891('0x27'),_0xe891('0x28'),_0xe891('0x4a'),_0xe891('0x4b'),_0xe891('0x29'),_0xe891('0x4c'),_0xe891('0x2a')]})[_0xe891('0xe')](function(_0x3f42c0){if(_0x3f42c0){_0x200a24=_0x3f42c0;_0x2979bc=_0x472bc5[_0xe891('0x37')][_0xe891('0x2a')]?_0x472bc5['body'][_0xe891('0x2a')]:util[_0xe891('0x30')]('SIP/%s',_0x200a24[_0xe891('0x27')]);return db[_0xe891('0x1b')][_0xe891('0x4d')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x200a24['id']}}});}})[_0xe891('0xe')](function(_0x4748b9){if(_0x4748b9){_0x585ce9=_0x4748b9;return require(_0xe891('0x4e'))[_0xe891('0x4f')]();}})[_0xe891('0xe')](function(_0xe12a80){if(_0xe12a80&&_0xe12a80[_0xe891('0x50')]&&_0x585ce9>=_0xe12a80[_0xe891('0x50')]){throw new Error(_0xe891('0x51'));}})['then'](function(){if(_0x200a24){return db[_0xe891('0x41')][_0xe891('0x52')]({'where':{'membername':_0x200a24[_0xe891('0x27')]},'individualHooks':!![]});}})['then'](function(){if(_0x200a24){return _0x200a24[_0xe891('0x53')]({'raw':!![]});}})[_0xe891('0xe')](function(_0x2540b5){if(_0x200a24){if(_0x2540b5){var _0x161a50=[];_0x36f1bb=_0x2540b5;if(_0x36f1bb[_0xe891('0x2f')]){for(var _0x38860b=0x0;_0x38860b<_0x36f1bb[_0xe891('0x2f')];_0x38860b++){_0x161a50[_0xe891('0x33')](db[_0xe891('0x41')][_0xe891('0x54')]({'membername':_0x200a24['name'],'UserId':_0x200a24['id'],'queue_name':_0x36f1bb[_0x38860b][_0xe891('0x27')],'VoiceQueueId':_0x36f1bb[_0x38860b]['id'],'interface':_0x2979bc,'paused':_0x200a24[_0xe891('0x4c')]||![],'penalty':_0x36f1bb[_0x38860b]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x161a50);}}}})[_0xe891('0xe')](function(){if(_0x200a24){return db[_0xe891('0x2c')][_0xe891('0x2d')]({'where':{'membername':_0x200a24['name'],'exitAt':null}});}})[_0xe891('0xe')](function(_0x24d389){if(_0x200a24){if(_0x24d389&&_0x24d389[_0xe891('0x2f')]){var _0x2a9c77=[];_0x24d389[_0xe891('0x32')](function(_0x3b49e0){_0x2a9c77[_0xe891('0x33')](_0x3b49e0[_0xe891('0x2b')]({'exitAt':moment()[_0xe891('0x30')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xe891('0x48')](_0x2a9c77);}}})[_0xe891('0xe')](function(_0x4fc48c){if(_0x200a24){var _0x421927=[];var _0x28c6c6=[];var _0x14ad8b=utils[_0xe891('0x31')]();var _0x39523d={'membername':_0x200a24[_0xe891('0x27')],'interface':_0x2979bc,'enterAt':moment()[_0xe891('0x30')](_0xe891('0x36')),'role':_0x200a24[_0xe891('0x28')],'internal':_0x200a24[_0xe891('0x29')]};_0x14ad8b['forEach'](function(_0xfaff2f){_0x421927[_0xe891('0x33')](_[_0xe891('0x55')]({'channel':_0xfaff2f,'type':_0xe891('0x56'),'data1':_0xe891('0x57'),'data2':_0x2979bc},_0x39523d));if(_0x200a24[_0xe891('0x4c')]){_0x28c6c6[_0xe891('0x33')](_['merge']({'channel':_0xfaff2f,'type':_0xe891('0x2e'),'data1':'LOGININPAUSE'},_0x39523d));}});return db['MemberReport'][_0xe891('0x3a')](_0x421927[_0xe891('0x58')](_0x28c6c6),{'individualHooks':!![]});}})[_0xe891('0xe')](function(){if(_0x200a24){return _0x200a24[_0xe891('0x2b')]({'online':!![],'lastLoginAt':moment()[_0xe891('0x30')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x200a24[_0xe891('0x4c')]||![],'mailPause':_0x200a24['loginInPause']||![],'chatPause':_0x200a24[_0xe891('0x4c')]||![],'faxPause':_0x200a24[_0xe891('0x4c')]||![],'smsPause':_0x200a24[_0xe891('0x4c')]||![],'openchannelPause':_0x200a24[_0xe891('0x4c')]||![],'pauseType':_0x200a24[_0xe891('0x4c')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0xe891('0x30')](_0xe891('0x36')),'interface':_0x2979bc});}})[_0xe891('0xe')](function(_0x1cd9ff){_0x56ae31(_0x1cd9ff);})[_0xe891('0x19')](function(_0x1cec03){_0x1d7d79(_0x2912b6[_0xe891('0x14')](0x1f4,_0x1cec03[_0xe891('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 9ec5781..4737391 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 _0x0b3c=['update','removeListener','length','./user.events','remove'];(function(_0x2bcdb8,_0xd776f7){var _0x13c6af=function(_0x17c426){while(--_0x17c426){_0x2bcdb8['push'](_0x2bcdb8['shift']());}};_0x13c6af(++_0xd776f7);}(_0x0b3c,0x1c0));var _0xc0b3=function(_0x2778c6,_0x567ee9){_0x2778c6=_0x2778c6-0x0;var _0x30d7eb=_0x0b3c[_0x2778c6];return _0x30d7eb;};'use strict';var UserEvents=require(_0xc0b3('0x0'));var events=['save',_0xc0b3('0x1'),_0xc0b3('0x2')];function createListener(_0x34664b,_0x499406){return function(_0xea49c4){_0x499406['emit'](_0x34664b,_0xea49c4);};}function removeListener(_0x12e425,_0x29c568){return function(){UserEvents[_0xc0b3('0x3')](_0x12e425,_0x29c568);};}exports['register']=function(_0x50c578){for(var _0x3ba802=0x0,_0xd85cbf=events[_0xc0b3('0x4')];_0x3ba802<_0xd85cbf;_0x3ba802++){var _0x20e165=events[_0x3ba802];var _0x379376=createListener('user:'+_0x20e165,_0x50c578);UserEvents['on'](_0x20e165,_0x379376);}}; \ No newline at end of file +var _0x4b50=['update','emit','removeListener','register','./user.events','save','remove'];(function(_0x1f80a3,_0x19a085){var _0xfda83e=function(_0x4f9ee9){while(--_0x4f9ee9){_0x1f80a3['push'](_0x1f80a3['shift']());}};_0xfda83e(++_0x19a085);}(_0x4b50,0x1a1));var _0x04b5=function(_0x386b03,_0x5d0000){_0x386b03=_0x386b03-0x0;var _0xd3d524=_0x4b50[_0x386b03];return _0xd3d524;};'use strict';var UserEvents=require(_0x04b5('0x0'));var events=[_0x04b5('0x1'),_0x04b5('0x2'),_0x04b5('0x3')];function createListener(_0x743ad7,_0x3171d8){return function(_0x3a70fb){_0x3171d8[_0x04b5('0x4')](_0x743ad7,_0x3a70fb);};}function removeListener(_0x3e9462,_0x1c4afb){return function(){UserEvents[_0x04b5('0x5')](_0x3e9462,_0x1c4afb);};}exports[_0x04b5('0x6')]=function(_0x5add55){for(var _0x50f0c3=0x0,_0x22635d=events['length'];_0x50f0c3<_0x22635d;_0x50f0c3++){var _0x1f72d4=events[_0x50f0c3];var _0x4fd4bf=createListener('user:'+_0x1f72d4,_0x5add55);UserEvents['on'](_0x1f72d4,_0x4fd4bf);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index c35cbf5..92954a0 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(_0x4add40,_0xab109e){var _0x5a0f30=function(_0x5d2748){while(--_0x5d2748){_0x4add40['push'](_0x4add40['shift']());}};_0x5a0f30(++_0xab109e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x35fabd,_0x825452){_0x35fabd=_0x35fabd-0x0;var _0x61a8ee=_0xcb91[_0x35fabd];return _0x61a8ee;};'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(_0x33c00c,_0x535c81){var _0x25ae2c=function(_0x56fdd1){while(--_0x56fdd1){_0x33c00c['push'](_0x33c00c['shift']());}};_0x25ae2c(++_0x535c81);}(_0xe706,0xa3));var _0x6e70=function(_0x4bccd7,_0x213c94){_0x4bccd7=_0x4bccd7-0x0;var _0x196ceb=_0xe706[_0x4bccd7];return _0x196ceb;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index ce209e7..fca8a0e 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 _0x720e=['sequelize','exports','INTEGER'];(function(_0x329a33,_0x585897){var _0x2bef80=function(_0x213b94){while(--_0x213b94){_0x329a33['push'](_0x329a33['shift']());}};_0x2bef80(++_0x585897);}(_0x720e,0x1b3));var _0xe720=function(_0x1e6b59,_0x5eca5d){_0x1e6b59=_0x1e6b59-0x0;var _0x40d7c5=_0x720e[_0x1e6b59];return _0x40d7c5;};'use strict';var Sequelize=require(_0xe720('0x0'));module[_0xe720('0x1')]={'penalty':{'type':Sequelize[_0xe720('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3c5e=['INTEGER','sequelize','exports'];(function(_0x1f6be4,_0x49b8cf){var _0x15db38=function(_0x174112){while(--_0x174112){_0x1f6be4['push'](_0x1f6be4['shift']());}};_0x15db38(++_0x49b8cf);}(_0x3c5e,0x145));var _0xe3c5=function(_0x2ac420,_0x723e4c){_0x2ac420=_0x2ac420-0x0;var _0x468dd6=_0x3c5e[_0x2ac420];return _0x468dd6;};'use strict';var Sequelize=require(_0xe3c5('0x0'));module[_0xe3c5('0x1')]={'penalty':{'type':Sequelize[_0xe3c5('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 4456b4c..bec1b9e 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 _0xcb00=['define','UserChatQueue','user_has_chat_queues','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x38fa44,_0x500680){var _0x5514b6=function(_0x5ea397){while(--_0x5ea397){_0x38fa44['push'](_0x38fa44['shift']());}};_0x5514b6(++_0x500680);}(_0xcb00,0xb3));var _0x0cb0=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xcb00[_0x21549c];return _0x426cbd;};'use strict';var _=require('lodash');var util=require(_0x0cb0('0x0'));var logger=require(_0x0cb0('0x1'))(_0x0cb0('0x2'));var moment=require(_0x0cb0('0x3'));var BPromise=require(_0x0cb0('0x4'));var rp=require(_0x0cb0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0cb0('0x6'));var config=require(_0x0cb0('0x7'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x4b33fe,_0x31546e){return _0x4b33fe[_0x0cb0('0x8')](_0x0cb0('0x9'),attributes,{'tableName':_0x0cb0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedbf=['request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','api','moment','bluebird'];(function(_0xe51138,_0x3300dc){var _0x829660=function(_0x41279f){while(--_0x41279f){_0xe51138['push'](_0xe51138['shift']());}};_0x829660(++_0x3300dc);}(_0xedbf,0x18f));var _0xfedb=function(_0x552c10,_0x5ce987){_0x552c10=_0x552c10-0x0;var _0x3242d2=_0xedbf[_0x552c10];return _0x3242d2;};'use strict';var _=require(_0xfedb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfedb('0x1'));var moment=require(_0xfedb('0x2'));var BPromise=require(_0xfedb('0x3'));var rp=require(_0xfedb('0x4'));var fs=require('fs');var path=require(_0xfedb('0x5'));var rimraf=require(_0xfedb('0x6'));var config=require(_0xfedb('0x7'));var attributes=require(_0xfedb('0x8'));module[_0xfedb('0x9')]=function(_0x40d559,_0x3d52af){return _0x40d559[_0xfedb('0xa')](_0xfedb('0xb'),attributes,{'tableName':_0xfedb('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 a249172..f9aa644 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 _0xf505=['util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','error','code','message','catch'];(function(_0x26996c,_0x4169e2){var _0x44d95a=function(_0x215531){while(--_0x215531){_0x26996c['push'](_0x26996c['shift']());}};_0x44d95a(++_0x4169e2);}(_0xf505,0x1f4));var _0x5f50=function(_0x2c96f6,_0x877207){_0x2c96f6=_0x2c96f6-0x0;var _0x6d4808=_0xf505[_0x2c96f6];return _0x6d4808;};'use strict';var _=require('lodash');var util=require(_0x5f50('0x0'));var moment=require(_0x5f50('0x1'));var BPromise=require(_0x5f50('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f50('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f50('0x4'));var logger=require(_0x5f50('0x5'))(_0x5f50('0x6'));var config=require(_0x5f50('0x7'));var jayson=require(_0x5f50('0x8'));var client=jayson[_0x5f50('0x9')][_0x5f50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48e4a4,_0x1b8bd0,_0xc9ee5e){return new BPromise(function(_0x1caa96,_0x13a7ec){return client[_0x5f50('0xb')](_0x48e4a4,_0xc9ee5e)[_0x5f50('0xc')](function(_0x537c3c){logger[_0x5f50('0xd')](_0x5f50('0xe'),_0x1b8bd0,_0x5f50('0xf'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x1b8bd0,_0x5f50('0xf'),JSON['stringify'](_0x537c3c));if(_0x537c3c[_0x5f50('0x10')]){if(_0x537c3c['error'][_0x5f50('0x11')]===0x1f4){logger[_0x5f50('0x10')](_0x5f50('0xe'),_0x1b8bd0,_0x537c3c[_0x5f50('0x10')][_0x5f50('0x12')]);return _0x13a7ec(_0x537c3c[_0x5f50('0x10')][_0x5f50('0x12')]);}logger[_0x5f50('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x1b8bd0,_0x537c3c[_0x5f50('0x10')][_0x5f50('0x12')]);return _0x1caa96(_0x537c3c[_0x5f50('0x10')][_0x5f50('0x12')]);}else{logger[_0x5f50('0xd')](_0x5f50('0xe'),_0x1b8bd0,_0x5f50('0xf'));_0x1caa96(_0x537c3c['result']['message']);}})[_0x5f50('0x13')](function(_0x52bcfd){logger[_0x5f50('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x1b8bd0,_0x52bcfd);_0x13a7ec(_0x52bcfd);});});} \ No newline at end of file +var _0x8573=['jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','message','UserChatQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x4da462,_0x2aac46){var _0x2a001a=function(_0x5db008){while(--_0x5db008){_0x4da462['push'](_0x4da462['shift']());}};_0x2a001a(++_0x2aac46);}(_0x8573,0xf5));var _0x3857=function(_0x1a4085,_0x1b4f78){_0x1a4085=_0x1a4085-0x0;var _0xd1976a=_0x8573[_0x1a4085];return _0xd1976a;};'use strict';var _=require(_0x3857('0x0'));var util=require(_0x3857('0x1'));var moment=require(_0x3857('0x2'));var BPromise=require(_0x3857('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3857('0x4'))['db'];var utils=require(_0x3857('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3857('0x6'));var jayson=require(_0x3857('0x7'));var client=jayson[_0x3857('0x8')][_0x3857('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x157ca6,_0xcf62a4,_0x16858b){return new BPromise(function(_0x5e4e20,_0x54b0e7){return client['request'](_0x157ca6,_0x16858b)[_0x3857('0xa')](function(_0x14cdf4){logger[_0x3857('0xb')]('UserChatQueue,\x20%s,\x20%s',_0xcf62a4,_0x3857('0xc'));logger[_0x3857('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0xcf62a4,_0x3857('0xc'),JSON[_0x3857('0xe')](_0x14cdf4));if(_0x14cdf4[_0x3857('0xf')]){if(_0x14cdf4[_0x3857('0xf')][_0x3857('0x10')]===0x1f4){logger[_0x3857('0xf')]('UserChatQueue,\x20%s,\x20%s',_0xcf62a4,_0x14cdf4[_0x3857('0xf')][_0x3857('0x11')]);return _0x54b0e7(_0x14cdf4[_0x3857('0xf')][_0x3857('0x11')]);}logger[_0x3857('0xf')](_0x3857('0x12'),_0xcf62a4,_0x14cdf4[_0x3857('0xf')][_0x3857('0x11')]);return _0x5e4e20(_0x14cdf4[_0x3857('0xf')][_0x3857('0x11')]);}else{logger[_0x3857('0xb')](_0x3857('0x12'),_0xcf62a4,_0x3857('0xc'));_0x5e4e20(_0x14cdf4[_0x3857('0x13')][_0x3857('0x11')]);}})[_0x3857('0x14')](function(_0x53b848){logger[_0x3857('0xf')](_0x3857('0x12'),_0xcf62a4,_0x53b848);_0x54b0e7(_0x53b848);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 5e2b802..bdebb9c 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0xb984a7,_0x564ef9){var _0x247044=function(_0x4142c7){while(--_0x4142c7){_0xb984a7['push'](_0xb984a7['shift']());}};_0x247044(++_0x564ef9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x2966be,_0x517c4c){var _0x290a63=function(_0x186967){while(--_0x186967){_0x2966be['push'](_0x2966be['shift']());}};_0x290a63(++_0x517c4c);}(_0xedd9,0xfc));var _0x9edd=function(_0x29336e,_0x41c39f){_0x29336e=_0x29336e-0x0;var _0xa7b490=_0xedd9[_0x29336e];return _0xa7b490;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 745a9c4..59c6441 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 _0x54ec=['STRING','exports','INTEGER'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0x54ec,0x112));var _0xc54e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x54ec[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0xc54e('0x0')]={'penalty':{'type':Sequelize[_0xc54e('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xc54e('0x2')]}}; \ No newline at end of file +var _0xaa0c=['STRING','sequelize','exports'];(function(_0x2e78e9,_0x42957c){var _0x35aad4=function(_0x360fa1){while(--_0x360fa1){_0x2e78e9['push'](_0x2e78e9['shift']());}};_0x35aad4(++_0x42957c);}(_0xaa0c,0xa6));var _0xcaa0=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xaa0c[_0x1f36bb];return _0xaf97fa;};'use strict';var Sequelize=require(_0xcaa0('0x0'));module[_0xcaa0('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xcaa0('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 712740b..cd0a5da 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 _0x2b18=['user_has_fax_queues','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x2b18,0xc1));var _0x82b1=function(_0x48b470,_0x4874a1){_0x48b470=_0x48b470-0x0;var _0x57be46=_0x2b18[_0x48b470];return _0x57be46;};'use strict';var _=require(_0x82b1('0x0'));var util=require(_0x82b1('0x1'));var logger=require(_0x82b1('0x2'))(_0x82b1('0x3'));var moment=require(_0x82b1('0x4'));var BPromise=require('bluebird');var rp=require(_0x82b1('0x5'));var fs=require('fs');var path=require(_0x82b1('0x6'));var rimraf=require('rimraf');var config=require(_0x82b1('0x7'));var attributes=require(_0x82b1('0x8'));module[_0x82b1('0x9')]=function(_0xaecb9e,_0x4ddefc){return _0xaecb9e['define'](_0x82b1('0xa'),attributes,{'tableName':_0x82b1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd2f=['exports','define','user_has_fax_queues','lodash','util','bluebird','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0xbd2f,0x1c5));var _0xfbd2=function(_0x14dbf1,_0x129ac4){_0x14dbf1=_0x14dbf1-0x0;var _0x349e38=_0xbd2f[_0x14dbf1];return _0x349e38;};'use strict';var _=require(_0xfbd2('0x0'));var util=require(_0xfbd2('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfbd2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfbd2('0x3'));var rimraf=require(_0xfbd2('0x4'));var config=require(_0xfbd2('0x5'));var attributes=require(_0xfbd2('0x6'));module[_0xfbd2('0x7')]=function(_0x19284e,_0x24b069){return _0x19284e[_0xfbd2('0x8')]('UserFaxQueue',attributes,{'tableName':_0xfbd2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index c8f504f..84a5952 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 _0x2966=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','moment','randomstring','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2966,0x1db));var _0x6296=function(_0x40952f,_0x4ff827){_0x40952f=_0x40952f-0x0;var _0x770f4f=_0x2966[_0x40952f];return _0x770f4f;};'use strict';var _=require(_0x6296('0x0'));var util=require(_0x6296('0x1'));var moment=require(_0x6296('0x2'));var BPromise=require('bluebird');var rs=require(_0x6296('0x3'));var fs=require('fs');var Redis=require(_0x6296('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6296('0x5'));var logger=require(_0x6296('0x6'))('rpc');var config=require(_0x6296('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6296('0x8')][_0x6296('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2109dd,_0x7910f6,_0x27cc99){return new BPromise(function(_0x4246fc,_0x132567){return client[_0x6296('0xa')](_0x2109dd,_0x27cc99)[_0x6296('0xb')](function(_0xbe15aa){logger[_0x6296('0xc')](_0x6296('0xd'),_0x7910f6,_0x6296('0xe'));logger[_0x6296('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x7910f6,_0x6296('0xe'),JSON[_0x6296('0x10')](_0xbe15aa));if(_0xbe15aa[_0x6296('0x11')]){if(_0xbe15aa[_0x6296('0x11')]['code']===0x1f4){logger[_0x6296('0x11')](_0x6296('0xd'),_0x7910f6,_0xbe15aa['error'][_0x6296('0x12')]);return _0x132567(_0xbe15aa[_0x6296('0x11')][_0x6296('0x12')]);}logger[_0x6296('0x11')](_0x6296('0xd'),_0x7910f6,_0xbe15aa[_0x6296('0x11')]['message']);return _0x4246fc(_0xbe15aa[_0x6296('0x11')][_0x6296('0x12')]);}else{logger[_0x6296('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x7910f6,_0x6296('0xe'));_0x4246fc(_0xbe15aa[_0x6296('0x13')]['message']);}})['catch'](function(_0x31c0cc){logger[_0x6296('0x11')](_0x6296('0xd'),_0x7910f6,_0x31c0cc);_0x132567(_0x31c0cc);});});} \ No newline at end of file +var _0xbcb6=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','bluebird','ioredis'];(function(_0x1ae636,_0x212002){var _0x4385ec=function(_0x10105e){while(--_0x10105e){_0x1ae636['push'](_0x1ae636['shift']());}};_0x4385ec(++_0x212002);}(_0xbcb6,0xcf));var _0x6bcb=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xbcb6[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x6bcb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6bcb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6bcb('0x2'));var db=require(_0x6bcb('0x3'))['db'];var utils=require(_0x6bcb('0x4'));var logger=require(_0x6bcb('0x5'))(_0x6bcb('0x6'));var config=require(_0x6bcb('0x7'));var jayson=require(_0x6bcb('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dbcc1,_0x33b3d1,_0xb1d44f){return new BPromise(function(_0x2bae64,_0x3b0792){return client['request'](_0x3dbcc1,_0xb1d44f)[_0x6bcb('0x9')](function(_0x39a531){logger['info'](_0x6bcb('0xa'),_0x33b3d1,'request\x20sent');logger[_0x6bcb('0xb')](_0x6bcb('0xc'),_0x33b3d1,_0x6bcb('0xd'),JSON[_0x6bcb('0xe')](_0x39a531));if(_0x39a531['error']){if(_0x39a531[_0x6bcb('0xf')][_0x6bcb('0x10')]===0x1f4){logger['error'](_0x6bcb('0xa'),_0x33b3d1,_0x39a531['error']['message']);return _0x3b0792(_0x39a531[_0x6bcb('0xf')]['message']);}logger[_0x6bcb('0xf')](_0x6bcb('0xa'),_0x33b3d1,_0x39a531['error'][_0x6bcb('0x11')]);return _0x2bae64(_0x39a531[_0x6bcb('0xf')][_0x6bcb('0x11')]);}else{logger[_0x6bcb('0x12')](_0x6bcb('0xa'),_0x33b3d1,_0x6bcb('0xd'));_0x2bae64(_0x39a531[_0x6bcb('0x13')]['message']);}})[_0x6bcb('0x14')](function(_0x4c40df){logger['error'](_0x6bcb('0xa'),_0x33b3d1,_0x4c40df);_0x3b0792(_0x4c40df);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 85e32c5..4670e3a 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x56086d,_0x6f2de1){var _0x12b065=function(_0x5d347c){while(--_0x5d347c){_0x56086d['push'](_0x56086d['shift']());}};_0x12b065(++_0x6f2de1);}(_0x70e0,0x17b));var _0x070e=function(_0x1f65ee,_0x1792a0){_0x1f65ee=_0x1f65ee-0x0;var _0x381fd8=_0x70e0[_0x1f65ee];return _0x381fd8;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x238550,_0x519feb){var _0x48be7e=function(_0x597188){while(--_0x597188){_0x238550['push'](_0x238550['shift']());}};_0x48be7e(++_0x519feb);}(_0xe706,0xa3));var _0x6e70=function(_0x36e3ba,_0x1912e8){_0x36e3ba=_0x36e3ba-0x0;var _0x7972c7=_0xe706[_0x36e3ba];return _0x7972c7;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 80a4f25..63db16b 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 _0x9ee6=['exports','INTEGER','sequelize'];(function(_0xdda08e,_0x346e9f){var _0x769379=function(_0x57e049){while(--_0x57e049){_0xdda08e['push'](_0xdda08e['shift']());}};_0x769379(++_0x346e9f);}(_0x9ee6,0x125));var _0x69ee=function(_0x56e4e7,_0x1db098){_0x56e4e7=_0x56e4e7-0x0;var _0x383618=_0x9ee6[_0x56e4e7];return _0x383618;};'use strict';var Sequelize=require(_0x69ee('0x0'));module[_0x69ee('0x1')]={'penalty':{'type':Sequelize[_0x69ee('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3d1b=['sequelize','exports','INTEGER'];(function(_0x2f8530,_0x5cbd67){var _0x5e814e=function(_0x490b29){while(--_0x490b29){_0x2f8530['push'](_0x2f8530['shift']());}};_0x5e814e(++_0x5cbd67);}(_0x3d1b,0xb7));var _0xb3d1=function(_0x12a62c,_0xc9c41a){_0x12a62c=_0x12a62c-0x0;var _0x268a58=_0x3d1b[_0x12a62c];return _0x268a58;};'use strict';var Sequelize=require(_0xb3d1('0x0'));module[_0xb3d1('0x1')]={'penalty':{'type':Sequelize[_0xb3d1('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 6ba76a9..db7eead 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 _0xc99e=['user_has_mail_queues','util','api','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xc99e,0x1cf));var _0xec99=function(_0x2ea124,_0x3b6fd3){_0x2ea124=_0x2ea124-0x0;var _0x39a3aa=_0xc99e[_0x2ea124];return _0x39a3aa;};'use strict';var _=require('lodash');var util=require(_0xec99('0x0'));var logger=require('../../config/logger')(_0xec99('0x1'));var moment=require(_0xec99('0x2'));var BPromise=require('bluebird');var rp=require(_0xec99('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xec99('0x4'));var config=require(_0xec99('0x5'));var attributes=require(_0xec99('0x6'));module[_0xec99('0x7')]=function(_0x46cd08,_0x1b6f6b){return _0x46cd08[_0xec99('0x8')](_0xec99('0x9'),attributes,{'tableName':_0xec99('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6d79=['rimraf','../../config/environment','./userMailQueue.attributes','define','user_has_mail_queues','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x12c3ce,_0x54d4bc){var _0x497bee=function(_0x4b6dae){while(--_0x4b6dae){_0x12c3ce['push'](_0x12c3ce['shift']());}};_0x497bee(++_0x54d4bc);}(_0x6d79,0x13d));var _0x96d7=function(_0x30b0d0,_0x5055a0){_0x30b0d0=_0x30b0d0-0x0;var _0x21cadf=_0x6d79[_0x30b0d0];return _0x21cadf;};'use strict';var _=require(_0x96d7('0x0'));var util=require(_0x96d7('0x1'));var logger=require(_0x96d7('0x2'))(_0x96d7('0x3'));var moment=require(_0x96d7('0x4'));var BPromise=require('bluebird');var rp=require(_0x96d7('0x5'));var fs=require('fs');var path=require(_0x96d7('0x6'));var rimraf=require(_0x96d7('0x7'));var config=require(_0x96d7('0x8'));var attributes=require(_0x96d7('0x9'));module['exports']=function(_0x4f06d8,_0xcaf7ae){return _0x4f06d8[_0x96d7('0xa')]('UserMailQueue',attributes,{'tableName':_0x96d7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 9e28869..f75cfb3 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 _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x542123,_0x5b9f55){var _0x107e2c=function(_0x10dea1){while(--_0x10dea1){_0x542123['push'](_0x542123['shift']());}};_0x107e2c(++_0x5b9f55);}(_0x6aa7,0x178));var _0x76aa=function(_0x5371eb,_0xcda256){_0x5371eb=_0x5371eb-0x0;var _0x5be3cf=_0x6aa7[_0x5371eb];return _0x5be3cf;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file +var _0x4b84=['../../config/logger','rpc','http','then','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','UserMailQueue,\x20%s,\x20%s','message','lodash','util','randomstring','../../config/utils'];(function(_0x5de06f,_0x53f550){var _0x36bc1=function(_0x37f23c){while(--_0x37f23c){_0x5de06f['push'](_0x5de06f['shift']());}};_0x36bc1(++_0x53f550);}(_0x4b84,0x1cc));var _0x44b8=function(_0x27dba4,_0x419253){_0x27dba4=_0x27dba4-0x0;var _0x35ec9d=_0x4b84[_0x27dba4];return _0x35ec9d;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x44b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x44b8('0x3'));var logger=require(_0x44b8('0x4'))(_0x44b8('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x44b8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x54274b,_0x327f59,_0x5947f7){return new BPromise(function(_0x3e87c5,_0x5a2353){return client['request'](_0x54274b,_0x5947f7)[_0x44b8('0x7')](function(_0x42319d){logger[_0x44b8('0x8')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x44b8('0x9'));logger[_0x44b8('0xa')](_0x44b8('0xb'),_0x327f59,_0x44b8('0x9'),JSON[_0x44b8('0xc')](_0x42319d));if(_0x42319d[_0x44b8('0xd')]){if(_0x42319d[_0x44b8('0xd')]['code']===0x1f4){logger[_0x44b8('0xd')](_0x44b8('0xe'),_0x327f59,_0x42319d['error'][_0x44b8('0xf')]);return _0x5a2353(_0x42319d['error'][_0x44b8('0xf')]);}logger[_0x44b8('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x327f59,_0x42319d[_0x44b8('0xd')]['message']);return _0x3e87c5(_0x42319d['error'][_0x44b8('0xf')]);}else{logger[_0x44b8('0x8')](_0x44b8('0xe'),_0x327f59,_0x44b8('0x9'));_0x3e87c5(_0x42319d['result']['message']);}})['catch'](function(_0x3fe9fb){logger['error'](_0x44b8('0xe'),_0x327f59,_0x3fe9fb);_0x5a2353(_0x3fe9fb);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 206f627..7b0b9a6 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 _0xea90=['Router','fs-extra','../../components/auth/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','path','connect-timeout','express'];(function(_0x292f51,_0x45d132){var _0x28e857=function(_0x2465b5){while(--_0x2465b5){_0x292f51['push'](_0x292f51['shift']());}};_0x28e857(++_0x45d132);}(_0xea90,0xe4));var _0x0ea9=function(_0x243511,_0x22e384){_0x243511=_0x243511-0x0;var _0x5d11a9=_0xea90[_0x243511];return _0x5d11a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0ea9('0x0'));var timeout=require(_0x0ea9('0x1'));var express=require(_0x0ea9('0x2'));var router=express[_0x0ea9('0x3')]();var fs_extra=require(_0x0ea9('0x4'));var auth=require(_0x0ea9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0ea9('0x6'));var controller=require(_0x0ea9('0x7'));router[_0x0ea9('0x8')]('/',auth[_0x0ea9('0x9')](),controller[_0x0ea9('0xa')]);module['exports']=router; \ No newline at end of file +var _0x5e1d=['../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','connect-timeout','Router','fs-extra'];(function(_0x35e75a,_0x5ed225){var _0xb23c7f=function(_0x2fa40c){while(--_0x2fa40c){_0x35e75a['push'](_0x35e75a['shift']());}};_0xb23c7f(++_0x5ed225);}(_0x5e1d,0x13c));var _0xd5e1=function(_0x576c37,_0x4da4a4){_0x576c37=_0x576c37-0x0;var _0x47eea9=_0x5e1d[_0x576c37];return _0x47eea9;};'use strict';var multer=require(_0xd5e1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd5e1('0x1'));var express=require('express');var router=express[_0xd5e1('0x2')]();var fs_extra=require(_0xd5e1('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd5e1('0x4'));var controller=require(_0xd5e1('0x5'));router[_0xd5e1('0x6')]('/',auth[_0xd5e1('0x7')](),controller[_0xd5e1('0x8')]);module[_0xd5e1('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 0c86962..bffb420 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 _0x13d0=['TEXT','STRING','sequelize'];(function(_0x2de8b2,_0x2347b2){var _0x225509=function(_0x32ce04){while(--_0x32ce04){_0x2de8b2['push'](_0x2de8b2['shift']());}};_0x225509(++_0x2347b2);}(_0x13d0,0x197));var _0x013d=function(_0x5e7990,_0x20fcbe){_0x5e7990=_0x5e7990-0x0;var _0x5d5b2e=_0x13d0[_0x5e7990];return _0x5d5b2e;};'use strict';var Sequelize=require(_0x013d('0x0'));module['exports']={'body':{'type':Sequelize[_0x013d('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x013d('0x1')]},'recipientsDescription':{'type':Sequelize[_0x013d('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x3788=['TEXT','BOOLEAN','sequelize','STRING'];(function(_0x1ae2ec,_0x3cf75b){var _0x579050=function(_0x27e422){while(--_0x27e422){_0x1ae2ec['push'](_0x1ae2ec['shift']());}};_0x579050(++_0x3cf75b);}(_0x3788,0x102));var _0x8378=function(_0x487086,_0xae5192){_0x487086=_0x487086-0x0;var _0x3a0ebe=_0x3788[_0x487086];return _0x3a0ebe;};'use strict';var Sequelize=require(_0x8378('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x8378('0x1')]},'recipientsId':{'type':Sequelize[_0x8378('0x2')]},'recipientsDescription':{'type':Sequelize[_0x8378('0x1')]},'beep':{'type':Sequelize[_0x8378('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 83fb84a..47d6dcf 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 _0xc6c5=['findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','toLowerCase','User','union','replace','queue','Queue','ids','push','all','flatten','map','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','emit','userNotification:send','catch'];(function(_0x1e7030,_0x5c77b4){var _0x3250b4=function(_0x564c92){while(--_0x564c92){_0x1e7030['push'](_0x1e7030['shift']());}};_0x3250b4(++_0x5c77b4);}(_0xc6c5,0x148));var _0x5c6c=function(_0x4b0338,_0x300c7c){_0x4b0338=_0x4b0338-0x0;var _0x945c9b=_0xc6c5[_0x4b0338];return _0x945c9b;};'use strict';var emlformat=require(_0x5c6c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5c6c('0x1'));var rp=require(_0x5c6c('0x2'));var moment=require(_0x5c6c('0x3'));var BPromise=require(_0x5c6c('0x4'));var Mustache=require(_0x5c6c('0x5'));var util=require(_0x5c6c('0x6'));var path=require(_0x5c6c('0x7'));var sox=require(_0x5c6c('0x8'));var csv=require('to-csv');var ejs=require(_0x5c6c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5c6c('0xa'));var squel=require('squel');var crypto=require(_0x5c6c('0xb'));var jsforce=require(_0x5c6c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5c6c('0xd'));var querystring=require('querystring');var Papa=require(_0x5c6c('0xe'));var Redis=require(_0x5c6c('0xf'));var authService=require(_0x5c6c('0x10'));var qs=require(_0x5c6c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c6c('0x12'));var logger=require(_0x5c6c('0x13'))(_0x5c6c('0x14'));var utils=require(_0x5c6c('0x15'));var config=require(_0x5c6c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c6c('0x17'))['db'];config['redis']=_[_0x5c6c('0x18')](config[_0x5c6c('0x19')],{'host':_0x5c6c('0x1a'),'port':0x18eb});var socket=require(_0x5c6c('0x1b'))(new Redis(config[_0x5c6c('0x19')]));require(_0x5c6c('0x1c'))[_0x5c6c('0x1d')](socket);function respondWithStatusCode(_0x37b5b0,_0x2a40d8){_0x2a40d8=_0x2a40d8||0xcc;return function(_0x46ec62){if(_0x46ec62){return _0x37b5b0[_0x5c6c('0x1e')](_0x2a40d8);}return _0x37b5b0[_0x5c6c('0x1f')](_0x2a40d8)[_0x5c6c('0x20')]();};}function respondWithResult(_0x43871f,_0x1a5f02){_0x1a5f02=_0x1a5f02||0xc8;return function(_0x587179){if(_0x587179){return _0x43871f[_0x5c6c('0x1f')](_0x1a5f02)['json'](_0x587179);}};}function respondWithFilteredResult(_0x21c8dc,_0x4671ba){return function(_0x1e8ee8){if(_0x1e8ee8){var _0x4eb790=typeof _0x4671ba[_0x5c6c('0x21')]===_0x5c6c('0x22')&&typeof _0x4671ba[_0x5c6c('0x23')]===_0x5c6c('0x22');var _0x2d35bc=_0x1e8ee8[_0x5c6c('0x24')];var _0xb61e54=_0x4eb790?0x0:_0x4671ba[_0x5c6c('0x21')];var _0x35bc5a=_0x4eb790?_0x1e8ee8[_0x5c6c('0x24')]:_0x4671ba[_0x5c6c('0x21')]+_0x4671ba[_0x5c6c('0x23')];var _0x5c2aeb;if(_0x35bc5a>=_0x2d35bc){_0x35bc5a=_0x2d35bc;_0x5c2aeb=0xc8;}else{_0x5c2aeb=0xce;}_0x21c8dc[_0x5c6c('0x1f')](_0x5c2aeb);return _0x21c8dc[_0x5c6c('0x25')](_0x5c6c('0x26'),_0xb61e54+'-'+_0x35bc5a+'/'+_0x2d35bc)[_0x5c6c('0x27')](_0x1e8ee8);}return null;};}function patchUpdates(_0x40372d){return function(_0x4e7f8c){try{jsonpatch[_0x5c6c('0x28')](_0x4e7f8c,_0x40372d,!![]);}catch(_0x511a3d){return BPromise[_0x5c6c('0x29')](_0x511a3d);}return _0x4e7f8c['save']();};}function saveUpdates(_0x12e2e0,_0x3f1184){return function(_0x2e7da5){if(_0x2e7da5){return _0x2e7da5['update'](_0x12e2e0)[_0x5c6c('0x2a')](function(_0x5be9ad){return _0x5be9ad;});}return null;};}function removeEntity(_0x23343a,_0x14a2f4){return function(_0x5f5707){if(_0x5f5707){return _0x5f5707[_0x5c6c('0x2b')]()[_0x5c6c('0x2a')](function(){_0x23343a[_0x5c6c('0x1f')](0xcc)[_0x5c6c('0x20')]();});}};}function handleEntityNotFound(_0x5d05d6,_0x4f1e89){return function(_0x57d4f8){if(!_0x57d4f8){_0x5d05d6[_0x5c6c('0x1e')](0x194);}return _0x57d4f8;};}function handleError(_0x1e881b,_0x589ff4){_0x589ff4=_0x589ff4||0x1f4;return function(_0xf609d5){logger[_0x5c6c('0x2c')](_0xf609d5[_0x5c6c('0x2d')]);if(_0xf609d5[_0x5c6c('0x2e')]){delete _0xf609d5[_0x5c6c('0x2e')];}_0x1e881b[_0x5c6c('0x1f')](_0x589ff4)['send'](_0xf609d5);};}exports[_0x5c6c('0x2f')]=function(_0x27dca8,_0x21c7ab,_0x1c45fd){if(!_0x27dca8[_0x5c6c('0x30')][_0x5c6c('0x31')](_0x5c6c('0x32'))&&!_0x27dca8[_0x5c6c('0x30')]['hasOwnProperty'](_0x5c6c('0x33'))){throw new db[(_0x5c6c('0x34'))][(_0x5c6c('0x35'))](_0x5c6c('0x36'));}else{if(_0x27dca8['body'][_0x5c6c('0x31')](_0x5c6c('0x33'))&&!_0x27dca8['body'][_0x5c6c('0x31')](_0x5c6c('0x37'))){throw new db[(_0x5c6c('0x34'))][(_0x5c6c('0x35'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x27dca8[_0x5c6c('0x30')][_0x5c6c('0x31')]('recipients')){throw new db[(_0x5c6c('0x34'))]['ValidationError'](_0x5c6c('0x38'));}else{try{var _0xdf883c=JSON[_0x5c6c('0x39')](_0x27dca8[_0x5c6c('0x30')][_0x5c6c('0x3a')]);}catch(_0x464f6a){logger[_0x5c6c('0x2c')](_0x464f6a);throw new db[(_0x5c6c('0x34'))][(_0x5c6c('0x35'))](_0x5c6c('0x3b'));}var _0x3208ce=['chatqueue',_0x5c6c('0x3c'),_0x5c6c('0x3d'),_0x5c6c('0x3e'),_0x5c6c('0x3f'),_0x5c6c('0x40'),_0x5c6c('0x41'),_0x5c6c('0x42'),_0x5c6c('0x43')];if(_[_0x5c6c('0x44')](_0xdf883c,function(_0x2f8d7e){return!_[_0x5c6c('0x45')](_0x3208ce,_0x2f8d7e[_0x5c6c('0x46')]['toLowerCase']());})){throw new db[(_0x5c6c('0x34'))][(_0x5c6c('0x35'))](_0x5c6c('0x47'));}}}var _0x5ee3d0={};_0x5ee3d0[_0x5c6c('0x48')]=_0x27dca8[_0x5c6c('0x30')][_0x5c6c('0x31')]('senderName')?_0x27dca8['body'][_0x5c6c('0x48')]:_0x27dca8[_0x5c6c('0x43')][_0x5c6c('0x49')];_0x5ee3d0['recipientsDescription']=_['isEmpty'](_0x27dca8[_0x5c6c('0x30')][_0x5c6c('0x4a')])?null:_0x27dca8[_0x5c6c('0x30')][_0x5c6c('0x4a')];_0x5ee3d0[_0x5c6c('0x4b')]=_0x27dca8['body'][_0x5c6c('0x4b')]||![];_0x5ee3d0[_0x5c6c('0x4c')]=_0x27dca8[_0x5c6c('0x43')]['id'];return getContent(_0x27dca8[_0x5c6c('0x30')])[_0x5c6c('0x2a')](function(_0xcc7bb6){_0x5ee3d0[_0x5c6c('0x30')]=_0xcc7bb6;return getRecipients(_0xdf883c);})[_0x5c6c('0x2a')](function(_0x5bf06d){_0x5ee3d0[_0x5c6c('0x4d')]=_[_0x5c6c('0x4e')](_0x5bf06d)[_0x5c6c('0x4f')](',');return db[_0x5c6c('0x50')][_0x5c6c('0x51')](function(_0xbb6d1f){return db[_0x5c6c('0x52')][_0x5c6c('0x53')](_0x5ee3d0,{'raw':!![],'transaction':_0xbb6d1f})[_0x5c6c('0x2a')](function(_0x1af38d){var _0x2adfbc={'sender':_0x5ee3d0[_0x5c6c('0x48')],'description':_0x5ee3d0[_0x5c6c('0x4a')],'content':_0x5ee3d0[_0x5c6c('0x30')],'beep':_0x5ee3d0[_0x5c6c('0x4b')]};_0x5bf06d[_0x5c6c('0x54')](function(_0x469659){_0x2adfbc['recipient']=_0x469659;socket[_0x5c6c('0x55')](_0x5c6c('0x56'),_0x2adfbc);});return _0x1af38d;});});})[_0x5c6c('0x2a')](respondWithResult(_0x21c7ab,0xc9))[_0x5c6c('0x57')](handleError(_0x21c7ab,null));};function getContent(_0x1a152b){return new BPromise(function(_0x4ebe89,_0x2459ba){if(_0x1a152b[_0x5c6c('0x32')]){_0x4ebe89(_0x1a152b[_0x5c6c('0x32')]);return;}return db['Template'][_0x5c6c('0x58')]({'attributes':[_0x5c6c('0x59')],'where':{'id':_0x1a152b[_0x5c6c('0x33')]},'raw':!![]})[_0x5c6c('0x2a')](function(_0x5d7506){if(!_0x5d7506)throw new db[(_0x5c6c('0x34'))][(_0x5c6c('0x35'))](_0x5c6c('0x5a'));var _0x36c4e8=Mustache[_0x5c6c('0x5b')](_0x5d7506['html'],_0x1a152b['view']);_0x4ebe89(_0x36c4e8);})[_0x5c6c('0x57')](function(_0x215c2d){_0x2459ba(_0x215c2d);});});}function getRecipients(_0x2f8905){return new BPromise(function(_0x330096,_0x4e3c0e){var _0x2befe5=[];var _0x12c50e=[];_0x2f8905[_0x5c6c('0x54')](function(_0x131ffa){var _0x452b6f=_[_0x5c6c('0x5c')](_0x131ffa['model'][_0x5c6c('0x5d')]());if(_0x452b6f===_0x5c6c('0x5e')){_0x2befe5=_[_0x5c6c('0x5f')](_0x2befe5,_0x131ffa['ids']);}else{if(_['includes'](_0x452b6f,'queue'))_0x452b6f=_0x452b6f[_0x5c6c('0x60')](_0x5c6c('0x61'),_0x5c6c('0x62'));_0x131ffa[_0x5c6c('0x63')][_0x5c6c('0x54')](function(_0x51597b){_0x12c50e[_0x5c6c('0x64')](getAgents(_0x452b6f,_0x51597b));});}});return BPromise[_0x5c6c('0x65')](_0x12c50e)[_0x5c6c('0x2a')](function(_0x4d6d15){_0x2befe5=_['union'](_0x2befe5,_[_0x5c6c('0x66')](_0x4d6d15));_0x330096(_0x2befe5);})[_0x5c6c('0x57')](function(_0x3d259a){_0x4e3c0e(_0x3d259a);});});}function getAgents(_0x55486f,_0x10225a){return new BPromise(function(_0x300a05,_0x5abbed){return db[_0x55486f]['findOne']({'where':{'id':_0x10225a}})[_0x5c6c('0x2a')](function(_0x3d637d){return _0x3d637d['getAgents']({'attributes':['id'],'raw':!![]})[_0x5c6c('0x2a')](function(_0x157b0d){var _0x8d1502=_[_0x5c6c('0x67')](_0x157b0d,'id');_0x300a05(_0x8d1502);});})['catch'](function(_0x266800){_0x5abbed(_0x266800);});});} \ No newline at end of file +var _0xed19=['isEmpty','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','ids','includes','queue','Queue','push','all','union','flatten','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./userNotification.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','sendUserNotification','hasOwnProperty','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','parse','recipients','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xed19,0x81));var _0x9ed1=function(_0x2dba9a,_0x1177e1){_0x2dba9a=_0x2dba9a-0x0;var _0x4e6157=_0xed19[_0x2dba9a];return _0x4e6157;};'use strict';var emlformat=require(_0x9ed1('0x0'));var rimraf=require(_0x9ed1('0x1'));var zipdir=require(_0x9ed1('0x2'));var jsonpatch=require(_0x9ed1('0x3'));var rp=require(_0x9ed1('0x4'));var moment=require(_0x9ed1('0x5'));var BPromise=require(_0x9ed1('0x6'));var Mustache=require('mustache');var util=require(_0x9ed1('0x7'));var path=require(_0x9ed1('0x8'));var sox=require(_0x9ed1('0x9'));var csv=require(_0x9ed1('0xa'));var ejs=require(_0x9ed1('0xb'));var fs=require('fs');var fs_extra=require(_0x9ed1('0xc'));var _=require(_0x9ed1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9ed1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9ed1('0xf'));var Papa=require(_0x9ed1('0x10'));var Redis=require(_0x9ed1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9ed1('0x12'));var as=require(_0x9ed1('0x13'));var hardwareService=require(_0x9ed1('0x14'));var logger=require(_0x9ed1('0x15'))(_0x9ed1('0x16'));var utils=require(_0x9ed1('0x17'));var config=require(_0x9ed1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9ed1('0x19'))['db'];config['redis']=_[_0x9ed1('0x1a')](config[_0x9ed1('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x9ed1('0x1c'))(new Redis(config[_0x9ed1('0x1b')]));require(_0x9ed1('0x1d'))[_0x9ed1('0x1e')](socket);function respondWithStatusCode(_0x56762c,_0xf8d190){_0xf8d190=_0xf8d190||0xcc;return function(_0x316215){if(_0x316215){return _0x56762c[_0x9ed1('0x1f')](_0xf8d190);}return _0x56762c['status'](_0xf8d190)[_0x9ed1('0x20')]();};}function respondWithResult(_0x519892,_0x4555b1){_0x4555b1=_0x4555b1||0xc8;return function(_0x57847d){if(_0x57847d){return _0x519892[_0x9ed1('0x21')](_0x4555b1)['json'](_0x57847d);}};}function respondWithFilteredResult(_0x333519,_0x33d10c){return function(_0x4a8ae6){if(_0x4a8ae6){var _0x29c8a7=typeof _0x33d10c[_0x9ed1('0x22')]===_0x9ed1('0x23')&&typeof _0x33d10c[_0x9ed1('0x24')]==='undefined';var _0x1384f6=_0x4a8ae6[_0x9ed1('0x25')];var _0x7d1cfb=_0x29c8a7?0x0:_0x33d10c[_0x9ed1('0x22')];var _0xb1a235=_0x29c8a7?_0x4a8ae6[_0x9ed1('0x25')]:_0x33d10c[_0x9ed1('0x22')]+_0x33d10c['limit'];var _0x10145c;if(_0xb1a235>=_0x1384f6){_0xb1a235=_0x1384f6;_0x10145c=0xc8;}else{_0x10145c=0xce;}_0x333519[_0x9ed1('0x21')](_0x10145c);return _0x333519[_0x9ed1('0x26')](_0x9ed1('0x27'),_0x7d1cfb+'-'+_0xb1a235+'/'+_0x1384f6)[_0x9ed1('0x28')](_0x4a8ae6);}return null;};}function patchUpdates(_0x2a7cca){return function(_0x4eef34){try{jsonpatch[_0x9ed1('0x29')](_0x4eef34,_0x2a7cca,!![]);}catch(_0x4bc2ed){return BPromise[_0x9ed1('0x2a')](_0x4bc2ed);}return _0x4eef34[_0x9ed1('0x2b')]();};}function saveUpdates(_0x1eaa91,_0x4b220a){return function(_0x44df76){if(_0x44df76){return _0x44df76['update'](_0x1eaa91)[_0x9ed1('0x2c')](function(_0x48d023){return _0x48d023;});}return null;};}function removeEntity(_0x2468b5,_0x1f1538){return function(_0x4024ca){if(_0x4024ca){return _0x4024ca[_0x9ed1('0x2d')]()['then'](function(){_0x2468b5[_0x9ed1('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f2b87,_0x4365b4){return function(_0x5dfa56){if(!_0x5dfa56){_0x5f2b87[_0x9ed1('0x1f')](0x194);}return _0x5dfa56;};}function handleError(_0xeae9a9,_0x17d7e7){_0x17d7e7=_0x17d7e7||0x1f4;return function(_0x4c7be3){logger['error'](_0x4c7be3[_0x9ed1('0x2e')]);if(_0x4c7be3[_0x9ed1('0x2f')]){delete _0x4c7be3[_0x9ed1('0x2f')];}_0xeae9a9[_0x9ed1('0x21')](_0x17d7e7)[_0x9ed1('0x30')](_0x4c7be3);};}exports[_0x9ed1('0x31')]=function(_0x3c4d6f,_0x4115c3,_0x5d0e12){if(!_0x3c4d6f['body'][_0x9ed1('0x32')]('text')&&!_0x3c4d6f[_0x9ed1('0x33')][_0x9ed1('0x32')](_0x9ed1('0x34'))){throw new db[(_0x9ed1('0x35'))][(_0x9ed1('0x36'))](_0x9ed1('0x37'));}else{if(_0x3c4d6f[_0x9ed1('0x33')][_0x9ed1('0x32')](_0x9ed1('0x34'))&&!_0x3c4d6f[_0x9ed1('0x33')]['hasOwnProperty'](_0x9ed1('0x38'))){throw new db[(_0x9ed1('0x35'))][(_0x9ed1('0x36'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x3c4d6f[_0x9ed1('0x33')]['hasOwnProperty']('recipients')){throw new db['Sequelize'][(_0x9ed1('0x36'))]('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x37b077=JSON[_0x9ed1('0x39')](_0x3c4d6f['body'][_0x9ed1('0x3a')]);}catch(_0x3d28ce){logger[_0x9ed1('0x3b')](_0x3d28ce);throw new db[(_0x9ed1('0x35'))][(_0x9ed1('0x36'))](_0x9ed1('0x3c'));}var _0x4e8a84=[_0x9ed1('0x3d'),'faxqueue',_0x9ed1('0x3e'),_0x9ed1('0x3f'),_0x9ed1('0x40'),_0x9ed1('0x41'),_0x9ed1('0x42'),_0x9ed1('0x43'),'user'];if(_['some'](_0x37b077,function(_0x5197cf){return!_['includes'](_0x4e8a84,_0x5197cf[_0x9ed1('0x44')][_0x9ed1('0x45')]());})){throw new db[(_0x9ed1('0x35'))][(_0x9ed1('0x36'))](_0x9ed1('0x46'));}}}var _0x344bbc={};_0x344bbc[_0x9ed1('0x47')]=_0x3c4d6f[_0x9ed1('0x33')][_0x9ed1('0x32')](_0x9ed1('0x47'))?_0x3c4d6f[_0x9ed1('0x33')][_0x9ed1('0x47')]:_0x3c4d6f[_0x9ed1('0x48')][_0x9ed1('0x49')];_0x344bbc[_0x9ed1('0x4a')]=_[_0x9ed1('0x4b')](_0x3c4d6f['body'][_0x9ed1('0x4a')])?null:_0x3c4d6f[_0x9ed1('0x33')]['recipientsDescription'];_0x344bbc[_0x9ed1('0x4c')]=_0x3c4d6f[_0x9ed1('0x33')][_0x9ed1('0x4c')]||![];_0x344bbc[_0x9ed1('0x4d')]=_0x3c4d6f[_0x9ed1('0x48')]['id'];return getContent(_0x3c4d6f[_0x9ed1('0x33')])[_0x9ed1('0x2c')](function(_0x32f9c9){_0x344bbc[_0x9ed1('0x33')]=_0x32f9c9;return getRecipients(_0x37b077);})[_0x9ed1('0x2c')](function(_0xd0d0e7){_0x344bbc['recipientsId']=_[_0x9ed1('0x4e')](_0xd0d0e7)[_0x9ed1('0x4f')](',');return db[_0x9ed1('0x50')][_0x9ed1('0x51')](function(_0x1625c3){return db[_0x9ed1('0x52')][_0x9ed1('0x53')](_0x344bbc,{'raw':!![],'transaction':_0x1625c3})['then'](function(_0x199533){var _0x94042a={'sender':_0x344bbc['senderName'],'description':_0x344bbc[_0x9ed1('0x4a')],'content':_0x344bbc[_0x9ed1('0x33')],'beep':_0x344bbc[_0x9ed1('0x4c')]};_0xd0d0e7[_0x9ed1('0x54')](function(_0x4e9e13){_0x94042a[_0x9ed1('0x55')]=_0x4e9e13;socket['emit']('userNotification:send',_0x94042a);});return _0x199533;});});})[_0x9ed1('0x2c')](respondWithResult(_0x4115c3,0xc9))['catch'](handleError(_0x4115c3,null));};function getContent(_0x5ae35c){return new BPromise(function(_0x4e7045,_0x3eaa4d){if(_0x5ae35c[_0x9ed1('0x56')]){_0x4e7045(_0x5ae35c['text']);return;}return db[_0x9ed1('0x57')][_0x9ed1('0x58')]({'attributes':[_0x9ed1('0x59')],'where':{'id':_0x5ae35c[_0x9ed1('0x34')]},'raw':!![]})[_0x9ed1('0x2c')](function(_0x4ae14b){if(!_0x4ae14b)throw new db[(_0x9ed1('0x35'))][(_0x9ed1('0x36'))](_0x9ed1('0x5a'));var _0x378231=Mustache[_0x9ed1('0x5b')](_0x4ae14b[_0x9ed1('0x59')],_0x5ae35c[_0x9ed1('0x38')]);_0x4e7045(_0x378231);})[_0x9ed1('0x5c')](function(_0x3d281b){_0x3eaa4d(_0x3d281b);});});}function getRecipients(_0x1efeab){return new BPromise(function(_0x1564e5,_0x334225){var _0x2b3685=[];var _0x3f51a0=[];_0x1efeab[_0x9ed1('0x54')](function(_0x5e639f){var _0xffd39a=_[_0x9ed1('0x5d')](_0x5e639f[_0x9ed1('0x44')][_0x9ed1('0x45')]());if(_0xffd39a==='User'){_0x2b3685=_['union'](_0x2b3685,_0x5e639f[_0x9ed1('0x5e')]);}else{if(_[_0x9ed1('0x5f')](_0xffd39a,_0x9ed1('0x60')))_0xffd39a=_0xffd39a['replace'](_0x9ed1('0x60'),_0x9ed1('0x61'));_0x5e639f[_0x9ed1('0x5e')][_0x9ed1('0x54')](function(_0x2c9070){_0x3f51a0[_0x9ed1('0x62')](getAgents(_0xffd39a,_0x2c9070));});}});return BPromise[_0x9ed1('0x63')](_0x3f51a0)['then'](function(_0x5871f0){_0x2b3685=_[_0x9ed1('0x64')](_0x2b3685,_[_0x9ed1('0x65')](_0x5871f0));_0x1564e5(_0x2b3685);})[_0x9ed1('0x5c')](function(_0x3cf3e8){_0x334225(_0x3cf3e8);});});}function getAgents(_0x1657ff,_0x342355){return new BPromise(function(_0x247c97,_0x40ccda){return db[_0x1657ff][_0x9ed1('0x58')]({'where':{'id':_0x342355}})[_0x9ed1('0x2c')](function(_0x201f77){return _0x201f77['getAgents']({'attributes':['id'],'raw':!![]})[_0x9ed1('0x2c')](function(_0x411e13){var _0x51bcee=_['map'](_0x411e13,'id');_0x247c97(_0x51bcee);});})[_0x9ed1('0x5c')](function(_0x415b90){_0x40ccda(_0x415b90);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index f8bc917..99c5ccf 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 _0xa2a5=['UserNotification','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x810e4d,_0x909ef4){var _0x13f01c=function(_0x12fd89){while(--_0x12fd89){_0x810e4d['push'](_0x810e4d['shift']());}};_0x13f01c(++_0x909ef4);}(_0xa2a5,0x187));var _0x5a2a=function(_0x2e9471,_0x35fead){_0x2e9471=_0x2e9471-0x0;var _0x3dfe28=_0xa2a5[_0x2e9471];return _0x3dfe28;};'use strict';var EventEmitter=require(_0x5a2a('0x0'));var UserNotification=require('../../mysqldb')['db'][_0x5a2a('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x5a2a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5a2a('0x3')};function emitEvent(_0xff4dc8){return function(_0x5f24f9,_0x1d29b5,_0x5e69d6){UserNotificationEvents['emit'](_0xff4dc8+':'+_0x5f24f9['id'],_0x5f24f9);UserNotificationEvents[_0x5a2a('0x4')](_0xff4dc8,_0x5f24f9);_0x5e69d6(null);};}for(var e in events){if(events[_0x5a2a('0x5')](e)){var event=events[e];UserNotification[_0x5a2a('0x6')](e,emitEvent(event));}}module[_0x5a2a('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x057b=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x057b,0x1cd));var _0xb057=function(_0x5a1e15,_0x9ce5f6){_0x5a1e15=_0x5a1e15-0x0;var _0xb31d5f=_0x057b[_0x5a1e15];return _0xb31d5f;};'use strict';var EventEmitter=require(_0xb057('0x0'));var UserNotification=require(_0xb057('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xb057('0x2')](0x0);var events={'afterCreate':_0xb057('0x3'),'afterUpdate':_0xb057('0x4'),'afterDestroy':_0xb057('0x5')};function emitEvent(_0x6b616f){return function(_0xbfdb63,_0x597f3d,_0x5152e6){UserNotificationEvents['emit'](_0x6b616f+':'+_0xbfdb63['id'],_0xbfdb63);UserNotificationEvents[_0xb057('0x6')](_0x6b616f,_0xbfdb63);_0x5152e6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xb057('0x7')](e,emitEvent(event));}}module[_0xb057('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index aaca6aa..7ac7b19 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 _0xca07=['util','../../config/logger','api','moment','path','rimraf','./userNotification.attributes','exports','define','UserNotification'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xca07,0x17c));var _0x7ca0=function(_0xb54f15,_0x4e7d71){_0xb54f15=_0xb54f15-0x0;var _0x34f533=_0xca07[_0xb54f15];return _0x34f533;};'use strict';var _=require('lodash');var util=require(_0x7ca0('0x0'));var logger=require(_0x7ca0('0x1'))(_0x7ca0('0x2'));var moment=require(_0x7ca0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ca0('0x4'));var rimraf=require(_0x7ca0('0x5'));var config=require('../../config/environment');var attributes=require(_0x7ca0('0x6'));module[_0x7ca0('0x7')]=function(_0x1e6bb0,_0x2d148d){return _0x1e6bb0[_0x7ca0('0x8')](_0x7ca0('0x9'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0e81=['lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./userNotification.attributes','exports','UserNotification','userNotifications'];(function(_0x2534c6,_0x2e8473){var _0x985453=function(_0xdd9fe){while(--_0xdd9fe){_0x2534c6['push'](_0x2534c6['shift']());}};_0x985453(++_0x2e8473);}(_0x0e81,0x9c));var _0x10e8=function(_0x2945bf,_0x4b9ab4){_0x2945bf=_0x2945bf-0x0;var _0x1c78bb=_0x0e81[_0x2945bf];return _0x1c78bb;};'use strict';var _=require(_0x10e8('0x0'));var util=require(_0x10e8('0x1'));var logger=require(_0x10e8('0x2'))('api');var moment=require(_0x10e8('0x3'));var BPromise=require(_0x10e8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x10e8('0x5'));var rimraf=require(_0x10e8('0x6'));var config=require(_0x10e8('0x7'));var attributes=require(_0x10e8('0x8'));module[_0x10e8('0x9')]=function(_0x5315b2,_0x1eed2e){return _0x5315b2['define'](_0x10e8('0xa'),attributes,{'tableName':_0x10e8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 436ebe8..6759ce4 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 _0x43bf=['request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','socket.io-emitter','./userNotification.socket'];(function(_0x21f1d2,_0x3b71f4){var _0x1da9b3=function(_0x4304e0){while(--_0x4304e0){_0x21f1d2['push'](_0x21f1d2['shift']());}};_0x1da9b3(++_0x3b71f4);}(_0x43bf,0x15c));var _0xf43b=function(_0x378cc5,_0x540418){_0x378cc5=_0x378cc5-0x0;var _0xb76485=_0x43bf[_0x378cc5];return _0xb76485;};'use strict';var _=require(_0xf43b('0x0'));var util=require(_0xf43b('0x1'));var moment=require(_0xf43b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf43b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf43b('0x4'))(_0xf43b('0x5'));var config=require(_0xf43b('0x6'));var jayson=require(_0xf43b('0x7'));var client=jayson['client'][_0xf43b('0x8')]({'port':0x232a});config['redis']=_[_0xf43b('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf43b('0xa'))(new Redis(config['redis']));require(_0xf43b('0xb'))['register'](socket);function respondWithRpcPromise(_0x513000,_0x4cefa9,_0x2420b9){return new BPromise(function(_0x31163a,_0x581ad7){return client[_0xf43b('0xc')](_0x513000,_0x2420b9)[_0xf43b('0xd')](function(_0x1b48de){logger['info'](_0xf43b('0xe'),_0x4cefa9,_0xf43b('0xf'));logger[_0xf43b('0x10')](_0xf43b('0x11'),_0x4cefa9,_0xf43b('0xf'),JSON['stringify'](_0x1b48de));if(_0x1b48de[_0xf43b('0x12')]){if(_0x1b48de[_0xf43b('0x12')][_0xf43b('0x13')]===0x1f4){logger[_0xf43b('0x12')](_0xf43b('0xe'),_0x4cefa9,_0x1b48de[_0xf43b('0x12')][_0xf43b('0x14')]);return _0x581ad7(_0x1b48de[_0xf43b('0x12')][_0xf43b('0x14')]);}logger[_0xf43b('0x12')](_0xf43b('0xe'),_0x4cefa9,_0x1b48de[_0xf43b('0x12')][_0xf43b('0x14')]);return _0x31163a(_0x1b48de[_0xf43b('0x12')]['message']);}else{logger[_0xf43b('0x15')](_0xf43b('0xe'),_0x4cefa9,_0xf43b('0xf'));_0x31163a(_0x1b48de[_0xf43b('0x16')]['message']);}})[_0xf43b('0x17')](function(_0x58f1ba){logger[_0xf43b('0x12')]('UserNotification,\x20%s,\x20%s',_0x4cefa9,_0x58f1ba);_0x581ad7(_0x58f1ba);});});} \ No newline at end of file +var _0x8743=['message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x270876,_0x50516b){var _0x1bc190=function(_0x555995){while(--_0x555995){_0x270876['push'](_0x270876['shift']());}};_0x1bc190(++_0x50516b);}(_0x8743,0xb8));var _0x3874=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8743[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x3874('0x0'));var util=require('util');var moment=require(_0x3874('0x1'));var BPromise=require('bluebird');var rs=require(_0x3874('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3874('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3874('0x4'))(_0x3874('0x5'));var config=require('../../config/environment');var jayson=require(_0x3874('0x6'));var client=jayson[_0x3874('0x7')][_0x3874('0x8')]({'port':0x232a});config['redis']=_[_0x3874('0x9')](config[_0x3874('0xa')],{'host':_0x3874('0xb'),'port':0x18eb});var socket=require(_0x3874('0xc'))(new Redis(config[_0x3874('0xa')]));require(_0x3874('0xd'))[_0x3874('0xe')](socket);function respondWithRpcPromise(_0x409dff,_0x3212d9,_0x239638){return new BPromise(function(_0x53fc50,_0x5cc70b){return client['request'](_0x409dff,_0x239638)[_0x3874('0xf')](function(_0x33b7c1){logger[_0x3874('0x10')](_0x3874('0x11'),_0x3212d9,_0x3874('0x12'));logger[_0x3874('0x13')](_0x3874('0x14'),_0x3212d9,_0x3874('0x12'),JSON[_0x3874('0x15')](_0x33b7c1));if(_0x33b7c1[_0x3874('0x16')]){if(_0x33b7c1[_0x3874('0x16')][_0x3874('0x17')]===0x1f4){logger[_0x3874('0x16')]('UserNotification,\x20%s,\x20%s',_0x3212d9,_0x33b7c1['error'][_0x3874('0x18')]);return _0x5cc70b(_0x33b7c1['error'][_0x3874('0x18')]);}logger['error']('UserNotification,\x20%s,\x20%s',_0x3212d9,_0x33b7c1[_0x3874('0x16')][_0x3874('0x18')]);return _0x53fc50(_0x33b7c1[_0x3874('0x16')][_0x3874('0x18')]);}else{logger[_0x3874('0x10')]('UserNotification,\x20%s,\x20%s',_0x3212d9,'request\x20sent');_0x53fc50(_0x33b7c1['result'][_0x3874('0x18')]);}})[_0x3874('0x19')](function(_0x583d8f){logger[_0x3874('0x16')]('UserNotification,\x20%s,\x20%s',_0x3212d9,_0x583d8f);_0x5cc70b(_0x583d8f);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 675877b..e5a6eba 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 _0x0b2f=['emit','removeListener','length','userNotification:','save','update'];(function(_0x57ece0,_0x46f04b){var _0x33dabd=function(_0x5f45cc){while(--_0x5f45cc){_0x57ece0['push'](_0x57ece0['shift']());}};_0x33dabd(++_0x46f04b);}(_0x0b2f,0x14e));var _0xf0b2=function(_0x5f3df0,_0x314710){_0x5f3df0=_0x5f3df0-0x0;var _0xb8325c=_0x0b2f[_0x5f3df0];return _0xb8325c;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xf0b2('0x0'),'remove',_0xf0b2('0x1')];function createListener(_0x112bd8,_0x224359){return function(_0x5b90e7){_0x224359[_0xf0b2('0x2')](_0x112bd8,_0x5b90e7);};}function removeListener(_0x231e3a,_0x5125c1){return function(){UserNotificationEvents[_0xf0b2('0x3')](_0x231e3a,_0x5125c1);};}exports['register']=function(_0x223292){for(var _0xe14824=0x0,_0x5c521b=events[_0xf0b2('0x4')];_0xe14824<_0x5c521b;_0xe14824++){var _0x2e5473=events[_0xe14824];var _0x4ea0f3=createListener(_0xf0b2('0x5')+_0x2e5473,_0x223292);UserNotificationEvents['on'](_0x2e5473,_0x4ea0f3);}}; \ No newline at end of file +var _0x4737=['remove','update','removeListener','register','./userNotification.events','save'];(function(_0x42d7ae,_0x3ed939){var _0x360bcd=function(_0x2bce7e){while(--_0x2bce7e){_0x42d7ae['push'](_0x42d7ae['shift']());}};_0x360bcd(++_0x3ed939);}(_0x4737,0x196));var _0x7473=function(_0x37a70c,_0x1a5af5){_0x37a70c=_0x37a70c-0x0;var _0x1458ed=_0x4737[_0x37a70c];return _0x1458ed;};'use strict';var UserNotificationEvents=require(_0x7473('0x0'));var events=[_0x7473('0x1'),_0x7473('0x2'),_0x7473('0x3')];function createListener(_0x350882,_0x3a5055){return function(_0xf6f432){_0x3a5055['emit'](_0x350882,_0xf6f432);};}function removeListener(_0x4e8f5a,_0x28fc8f){return function(){UserNotificationEvents[_0x7473('0x4')](_0x4e8f5a,_0x28fc8f);};}exports[_0x7473('0x5')]=function(_0x3cff9e){for(var _0xfd76d2=0x0,_0x16f822=events['length'];_0xfd76d2<_0x16f822;_0xfd76d2++){var _0x4c8c7b=events[_0xfd76d2];var _0x131e18=createListener('userNotification:'+_0x4c8c7b,_0x3cff9e);UserNotificationEvents['on'](_0x4c8c7b,_0x131e18);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index bb6ffed..056e12f 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x12afa7,_0x5c379e){var _0x4e0e20=function(_0x116742){while(--_0x116742){_0x12afa7['push'](_0x12afa7['shift']());}};_0x4e0e20(++_0x5c379e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xcb91[_0x101e7b];return _0x4995c0;};'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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2ef3fb,_0x400c01){var _0x130249=function(_0x41fdb2){while(--_0x41fdb2){_0x2ef3fb['push'](_0x2ef3fb['shift']());}};_0x130249(++_0x400c01);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xcb91[_0x2aecb2];return _0x3ebb80;};'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 43840b8..33c7660 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 _0x1775=['INTEGER'];(function(_0x43241b,_0x3ef8bd){var _0x3fb920=function(_0x2a1ef7){while(--_0x2a1ef7){_0x43241b['push'](_0x43241b['shift']());}};_0x3fb920(++_0x3ef8bd);}(_0x1775,0x16d));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x5177('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0967=['sequelize'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x0967,0x173));var _0x7096=function(_0x1cd028,_0x1e4799){_0x1cd028=_0x1cd028-0x0;var _0x98c446=_0x0967[_0x1cd028];return _0x98c446;};'use strict';var Sequelize=require(_0x7096('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 8383349..a7ea4b3 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 _0xb0da=['./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','api','moment','rimraf'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xb0da,0xff));var _0xab0d=function(_0x3baaf7,_0xe76964){_0x3baaf7=_0x3baaf7-0x0;var _0x3a4b57=_0xb0da[_0x3baaf7];return _0x3a4b57;};'use strict';var _=require(_0xab0d('0x0'));var util=require(_0xab0d('0x1'));var logger=require('../../config/logger')(_0xab0d('0x2'));var moment=require(_0xab0d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xab0d('0x4'));var config=require('../../config/environment');var attributes=require(_0xab0d('0x5'));module[_0xab0d('0x6')]=function(_0xa1780,_0x278559){return _0xa1780[_0xab0d('0x7')](_0xab0d('0x8'),attributes,{'tableName':_0xab0d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x657a=['define','UserOpenchannelQueue','user_has_openchannel_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x657a,0xf1));var _0xa657=function(_0x3b27a2,_0x26be85){_0x3b27a2=_0x3b27a2-0x0;var _0x4d0878=_0x657a[_0x3b27a2];return _0x4d0878;};'use strict';var _=require('lodash');var util=require(_0xa657('0x0'));var logger=require(_0xa657('0x1'))(_0xa657('0x2'));var moment=require(_0xa657('0x3'));var BPromise=require(_0xa657('0x4'));var rp=require(_0xa657('0x5'));var fs=require('fs');var path=require(_0xa657('0x6'));var rimraf=require(_0xa657('0x7'));var config=require(_0xa657('0x8'));var attributes=require(_0xa657('0x9'));module[_0xa657('0xa')]=function(_0x44ade7,_0x555deb){return _0x44ade7[_0xa657('0xb')](_0xa657('0xc'),attributes,{'tableName':_0xa657('0xd'),'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 fe00d58..a0560ab 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 _0xcbb2=['UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','UserOpenchannelQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x47bcee,_0x5c0311){var _0x4b88a8=function(_0x170762){while(--_0x170762){_0x47bcee['push'](_0x47bcee['shift']());}};_0x4b88a8(++_0x5c0311);}(_0xcbb2,0x111));var _0x2cbb=function(_0xc94958,_0x4293ec){_0xc94958=_0xc94958-0x0;var _0x30ef65=_0xcbb2[_0xc94958];return _0x30ef65;};'use strict';var _=require(_0x2cbb('0x0'));var util=require(_0x2cbb('0x1'));var moment=require(_0x2cbb('0x2'));var BPromise=require(_0x2cbb('0x3'));var rs=require(_0x2cbb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2cbb('0x5'))['db'];var utils=require(_0x2cbb('0x6'));var logger=require(_0x2cbb('0x7'))('rpc');var config=require(_0x2cbb('0x8'));var jayson=require(_0x2cbb('0x9'));var client=jayson[_0x2cbb('0xa')][_0x2cbb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x510e8d,_0x2f760a,_0x4ae14d){return new BPromise(function(_0x168246,_0x575207){return client[_0x2cbb('0xc')](_0x510e8d,_0x4ae14d)['then'](function(_0x14bf98){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x2f760a,'request\x20sent');logger['debug'](_0x2cbb('0xd'),_0x2f760a,_0x2cbb('0xe'),JSON[_0x2cbb('0xf')](_0x14bf98));if(_0x14bf98[_0x2cbb('0x10')]){if(_0x14bf98[_0x2cbb('0x10')]['code']===0x1f4){logger[_0x2cbb('0x10')](_0x2cbb('0x11'),_0x2f760a,_0x14bf98[_0x2cbb('0x10')]['message']);return _0x575207(_0x14bf98[_0x2cbb('0x10')][_0x2cbb('0x12')]);}logger[_0x2cbb('0x10')](_0x2cbb('0x11'),_0x2f760a,_0x14bf98[_0x2cbb('0x10')][_0x2cbb('0x12')]);return _0x168246(_0x14bf98['error']['message']);}else{logger[_0x2cbb('0x13')](_0x2cbb('0x11'),_0x2f760a,_0x2cbb('0xe'));_0x168246(_0x14bf98[_0x2cbb('0x14')][_0x2cbb('0x12')]);}})[_0x2cbb('0x15')](function(_0x27b966){logger[_0x2cbb('0x10')](_0x2cbb('0x11'),_0x2f760a,_0x27b966);_0x575207(_0x27b966);});});} \ No newline at end of file +var _0x4f65=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x22bad9,_0x38fb92){var _0xb5effa=function(_0x4f185e){while(--_0x4f185e){_0x22bad9['push'](_0x22bad9['shift']());}};_0xb5effa(++_0x38fb92);}(_0x4f65,0x192));var _0x54f6=function(_0x346622,_0x6c77d3){_0x346622=_0x346622-0x0;var _0x2946df=_0x4f65[_0x346622];return _0x2946df;};'use strict';var _=require(_0x54f6('0x0'));var util=require(_0x54f6('0x1'));var moment=require('moment');var BPromise=require(_0x54f6('0x2'));var rs=require(_0x54f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54f6('0x4'))['db'];var utils=require(_0x54f6('0x5'));var logger=require(_0x54f6('0x6'))(_0x54f6('0x7'));var config=require(_0x54f6('0x8'));var jayson=require(_0x54f6('0x9'));var client=jayson['client'][_0x54f6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cbf10,_0x264a8b,_0x547186){return new BPromise(function(_0x43995f,_0x222b13){return client['request'](_0x4cbf10,_0x547186)[_0x54f6('0xb')](function(_0x2c5ae5){logger[_0x54f6('0xc')](_0x54f6('0xd'),_0x264a8b,_0x54f6('0xe'));logger[_0x54f6('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x264a8b,'request\x20sent',JSON[_0x54f6('0x10')](_0x2c5ae5));if(_0x2c5ae5[_0x54f6('0x11')]){if(_0x2c5ae5[_0x54f6('0x11')][_0x54f6('0x12')]===0x1f4){logger[_0x54f6('0x11')](_0x54f6('0xd'),_0x264a8b,_0x2c5ae5[_0x54f6('0x11')][_0x54f6('0x13')]);return _0x222b13(_0x2c5ae5[_0x54f6('0x11')][_0x54f6('0x13')]);}logger[_0x54f6('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x264a8b,_0x2c5ae5[_0x54f6('0x11')][_0x54f6('0x13')]);return _0x43995f(_0x2c5ae5[_0x54f6('0x11')][_0x54f6('0x13')]);}else{logger[_0x54f6('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x264a8b,_0x54f6('0xe'));_0x43995f(_0x2c5ae5[_0x54f6('0x14')]['message']);}})[_0x54f6('0x15')](function(_0x2f7ad7){logger['error'](_0x54f6('0xd'),_0x264a8b,_0x2f7ad7);_0x222b13(_0x2f7ad7);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 7994644..2f08615 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 _0x607b=['../../components/interaction/service','../../config/environment','isAuthenticated','/describe','get','/:id','show','/:id/sections','getSections','/:id/resources','post','create','/:id/clone','addSections','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x35ffaf,_0x213ac6){var _0x2d4003=function(_0x40358b){while(--_0x40358b){_0x35ffaf['push'](_0x35ffaf['shift']());}};_0x2d4003(++_0x213ac6);}(_0x607b,0x18f));var _0xb607=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x607b[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xb607('0x0'));var util=require('util');var path=require(_0xb607('0x1'));var timeout=require(_0xb607('0x2'));var express=require(_0xb607('0x3'));var router=express[_0xb607('0x4')]();var fs_extra=require(_0xb607('0x5'));var auth=require(_0xb607('0x6'));var interaction=require(_0xb607('0x7'));var config=require(_0xb607('0x8'));var controller=require('./userProfile.controller');router['get']('/',auth[_0xb607('0x9')](),controller['index']);router['get'](_0xb607('0xa'),auth[_0xb607('0x9')](),controller['describe']);router[_0xb607('0xb')](_0xb607('0xc'),auth[_0xb607('0x9')](),controller[_0xb607('0xd')]);router['get'](_0xb607('0xe'),auth[_0xb607('0x9')](),controller[_0xb607('0xf')]);router['get'](_0xb607('0x10'),auth[_0xb607('0x9')](),controller['getResources']);router[_0xb607('0x11')]('/',auth['isAuthenticated'](),controller[_0xb607('0x12')]);router['post'](_0xb607('0x13'),auth[_0xb607('0x9')](),controller['clone']);router[_0xb607('0x11')](_0xb607('0xe'),auth[_0xb607('0x9')](),controller[_0xb607('0x14')]);router[_0xb607('0x11')](_0xb607('0x10'),auth[_0xb607('0x9')](),controller[_0xb607('0x15')]);router[_0xb607('0x16')](_0xb607('0xc'),auth[_0xb607('0x9')](),controller[_0xb607('0x17')]);router[_0xb607('0x18')](_0xb607('0xc'),auth[_0xb607('0x9')](),controller[_0xb607('0x19')]);router[_0xb607('0x18')](_0xb607('0xe'),auth[_0xb607('0x9')](),controller[_0xb607('0x1a')]);router[_0xb607('0x18')]('/:id/resources',auth[_0xb607('0x9')](),controller[_0xb607('0x1b')]);module[_0xb607('0x1c')]=router; \ No newline at end of file +var _0x018c=['create','/:id/clone','addResources','put','/:id','update','destroy','delete','removeSections','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','isAuthenticated','index','get','/:id/sections','/:id/resources','getResources','post'];(function(_0x212569,_0x53f153){var _0x363bd9=function(_0x34ce1e){while(--_0x34ce1e){_0x212569['push'](_0x212569['shift']());}};_0x363bd9(++_0x53f153);}(_0x018c,0x9f));var _0xc018=function(_0xe22a0b,_0x11f4c8){_0xe22a0b=_0xe22a0b-0x0;var _0x143bc4=_0x018c[_0xe22a0b];return _0x143bc4;};'use strict';var multer=require(_0xc018('0x0'));var util=require('util');var path=require(_0xc018('0x1'));var timeout=require(_0xc018('0x2'));var express=require(_0xc018('0x3'));var router=express['Router']();var fs_extra=require(_0xc018('0x4'));var auth=require(_0xc018('0x5'));var interaction=require(_0xc018('0x6'));var config=require(_0xc018('0x7'));var controller=require(_0xc018('0x8'));router['get']('/',auth[_0xc018('0x9')](),controller[_0xc018('0xa')]);router['get']('/describe',auth[_0xc018('0x9')](),controller['describe']);router['get']('/:id',auth[_0xc018('0x9')](),controller['show']);router[_0xc018('0xb')](_0xc018('0xc'),auth['isAuthenticated'](),controller['getSections']);router[_0xc018('0xb')](_0xc018('0xd'),auth[_0xc018('0x9')](),controller[_0xc018('0xe')]);router[_0xc018('0xf')]('/',auth[_0xc018('0x9')](),controller[_0xc018('0x10')]);router[_0xc018('0xf')](_0xc018('0x11'),auth[_0xc018('0x9')](),controller['clone']);router['post'](_0xc018('0xc'),auth[_0xc018('0x9')](),controller['addSections']);router[_0xc018('0xf')]('/:id/resources',auth['isAuthenticated'](),controller[_0xc018('0x12')]);router[_0xc018('0x13')](_0xc018('0x14'),auth[_0xc018('0x9')](),controller[_0xc018('0x15')]);router['delete'](_0xc018('0x14'),auth[_0xc018('0x9')](),controller[_0xc018('0x16')]);router[_0xc018('0x17')](_0xc018('0xc'),auth[_0xc018('0x9')](),controller[_0xc018('0x18')]);router[_0xc018('0x17')](_0xc018('0xd'),auth[_0xc018('0x9')](),controller['removeResources']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 0e42e87..8eab813 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 _0xca80=['split','BOOLEAN','sequelize','exports','STRING','setDataValue','crudPermissions','join','getDataValue'];(function(_0x52566d,_0x495d0b){var _0x1f01c0=function(_0x512638){while(--_0x512638){_0x52566d['push'](_0x52566d['shift']());}};_0x1f01c0(++_0x495d0b);}(_0xca80,0x119));var _0x0ca8=function(_0x542c2f,_0x1234b3){_0x542c2f=_0x542c2f-0x0;var _0x5b0e61=_0xca80[_0x542c2f];return _0x5b0e61;};'use strict';var Sequelize=require(_0x0ca8('0x0'));module[_0x0ca8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x0ca8('0x2')],'set':function(_0x29cbf9){this[_0x0ca8('0x3')](_0x0ca8('0x4'),_0x29cbf9?_0x29cbf9[_0x0ca8('0x5')](''):[]);},'get':function(){return this[_0x0ca8('0x6')](_0x0ca8('0x4'))?this['getDataValue'](_0x0ca8('0x4'))[_0x0ca8('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x0ca8('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x0ca8('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x0ca8('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x0ca8('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0ca8('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x0ca8('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdbe4=['BOOLEAN','exports','STRING','name','setDataValue','crudPermissions','join','getDataValue','split'];(function(_0x4f91a4,_0x162e1f){var _0x3d823f=function(_0x569aaa){while(--_0x569aaa){_0x4f91a4['push'](_0x4f91a4['shift']());}};_0x3d823f(++_0x162e1f);}(_0xdbe4,0x1de));var _0x4dbe=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xdbe4[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module[_0x4dbe('0x0')]={'name':{'type':Sequelize[_0x4dbe('0x1')],'allowNull':![],'unique':_0x4dbe('0x2')},'crudPermissions':{'type':Sequelize[_0x4dbe('0x1')],'set':function(_0x2ebdae){this[_0x4dbe('0x3')](_0x4dbe('0x4'),_0x2ebdae?_0x2ebdae[_0x4dbe('0x5')](''):[]);},'get':function(){return this[_0x4dbe('0x6')](_0x4dbe('0x4'))?this[_0x4dbe('0x6')](_0x4dbe('0x4'))[_0x4dbe('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x4dbe('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x4dbe('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x4dbe('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x4dbe('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x4dbe('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x4dbe('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x4dbe('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x4dbe('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 3273317..698a11b 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 _0x1a85=['model','map','query','keys','filters','attributes','fields','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','intersection','length','find','create','clone','get','omit','crudPermissions','body','createdAt','sequelize','transaction','autoAssociation','UserProfileResource','updatedAt','sectionId','userProfileId','Resources','describe','addSections','UserProfileSection','push','ids','getSections','enabled','includes','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','section','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','sendStatus','error','stack','name','index','UserProfile','rawAttributes','type'];(function(_0xb1814b,_0xc565e2){var _0x340bb1=function(_0x243235){while(--_0x243235){_0xb1814b['push'](_0xb1814b['shift']());}};_0x340bb1(++_0xc565e2);}(_0x1a85,0x178));var _0x51a8=function(_0x11ee99,_0xa743ed){_0x11ee99=_0x11ee99-0x0;var _0x469072=_0x1a85[_0x11ee99];return _0x469072;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];config[_0x51a8('0x17')]=_[_0x51a8('0x18')](config[_0x51a8('0x17')],{'host':_0x51a8('0x19'),'port':0x18eb});var socket=require(_0x51a8('0x1a'))(new Redis(config['redis']));require(_0x51a8('0x1b'))[_0x51a8('0x1c')](socket);function respondWithStatusCode(_0xaec066,_0x50d992){_0x50d992=_0x50d992||0xcc;return function(_0xf4eb6e){if(_0xf4eb6e){return _0xaec066['sendStatus'](_0x50d992);}return _0xaec066[_0x51a8('0x1d')](_0x50d992)[_0x51a8('0x1e')]();};}function respondWithResult(_0x39cd45,_0x2b0521){_0x2b0521=_0x2b0521||0xc8;return function(_0x3fbd02){if(_0x3fbd02){return _0x39cd45[_0x51a8('0x1d')](_0x2b0521)[_0x51a8('0x1f')](_0x3fbd02);}};}function respondWithFilteredResult(_0x516abc,_0x1c2f25){return function(_0x45a433){if(_0x45a433){var _0xd52230=typeof _0x1c2f25[_0x51a8('0x20')]===_0x51a8('0x21')&&typeof _0x1c2f25[_0x51a8('0x22')]==='undefined';var _0x1df8c2=_0x45a433[_0x51a8('0x23')];var _0x2217ce=_0xd52230?0x0:_0x1c2f25[_0x51a8('0x20')];var _0x2a4c4c=_0xd52230?_0x45a433[_0x51a8('0x23')]:_0x1c2f25[_0x51a8('0x20')]+_0x1c2f25[_0x51a8('0x22')];var _0x5ac1c0;if(_0x2a4c4c>=_0x1df8c2){_0x2a4c4c=_0x1df8c2;_0x5ac1c0=0xc8;}else{_0x5ac1c0=0xce;}_0x516abc[_0x51a8('0x1d')](_0x5ac1c0);return _0x516abc['set'](_0x51a8('0x24'),_0x2217ce+'-'+_0x2a4c4c+'/'+_0x1df8c2)[_0x51a8('0x1f')](_0x45a433);}return null;};}function patchUpdates(_0x8bda40){return function(_0x3759d6){try{jsonpatch['apply'](_0x3759d6,_0x8bda40,!![]);}catch(_0xae3588){return BPromise['reject'](_0xae3588);}return _0x3759d6['save']();};}function saveUpdates(_0x23d26a,_0x52e503){return function(_0x384d25){if(_0x384d25){return _0x384d25[_0x51a8('0x25')](_0x23d26a)[_0x51a8('0x26')](function(_0x18e2f3){return _0x18e2f3;});}return null;};}function removeEntity(_0x157554,_0x2f2f05){return function(_0x291ed6){if(_0x291ed6){return _0x291ed6[_0x51a8('0x27')]()['then'](function(){_0x157554[_0x51a8('0x1d')](0xcc)[_0x51a8('0x1e')]();});}};}function handleEntityNotFound(_0xca5746,_0x3da187){return function(_0x1c150d){if(!_0x1c150d){_0xca5746[_0x51a8('0x28')](0x194);}return _0x1c150d;};}function handleError(_0x1a886f,_0x2742f5){_0x2742f5=_0x2742f5||0x1f4;return function(_0xec08ae){logger[_0x51a8('0x29')](_0xec08ae[_0x51a8('0x2a')]);if(_0xec08ae[_0x51a8('0x2b')]){delete _0xec08ae['name'];}_0x1a886f[_0x51a8('0x1d')](_0x2742f5)['send'](_0xec08ae);};}exports[_0x51a8('0x2c')]=function(_0x3bc19a,_0x143f46){var _0x41df56={},_0x2136b4={},_0x4ea271={'count':0x0,'rows':[]};var _0x10c19b=_['map'](db[_0x51a8('0x2d')][_0x51a8('0x2e')],function(_0x253a59){return{'name':_0x253a59['fieldName'],'type':_0x253a59[_0x51a8('0x2f')]['key']};});_0x2136b4[_0x51a8('0x30')]=_[_0x51a8('0x31')](_0x10c19b,_0x51a8('0x2b'));_0x2136b4[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x3bc19a['query']);_0x2136b4[_0x51a8('0x34')]=_['intersection'](_0x2136b4[_0x51a8('0x30')],_0x2136b4[_0x51a8('0x32')]);_0x41df56[_0x51a8('0x35')]=_['intersection'](_0x2136b4[_0x51a8('0x30')],qs[_0x51a8('0x36')](_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x36')]));_0x41df56[_0x51a8('0x35')]=_0x41df56['attributes']['length']?_0x41df56['attributes']:_0x2136b4[_0x51a8('0x30')];if(!_0x3bc19a[_0x51a8('0x32')]['hasOwnProperty'](_0x51a8('0x37'))){_0x41df56['limit']=qs[_0x51a8('0x22')](_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x22')]);_0x41df56[_0x51a8('0x20')]=qs[_0x51a8('0x20')](_0x3bc19a[_0x51a8('0x32')]['offset']);}_0x41df56['order']=qs[_0x51a8('0x38')](_0x3bc19a['query']['sort']);_0x41df56['where']=qs[_0x51a8('0x34')](_[_0x51a8('0x39')](_0x3bc19a[_0x51a8('0x32')],_0x2136b4['filters']),_0x10c19b);if(_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x3a')]){_0x41df56[_0x51a8('0x3b')]=_[_0x51a8('0x3c')](_0x41df56['where'],{'$or':_[_0x51a8('0x31')](_0x10c19b,function(_0xe6a86a){if(_0xe6a86a[_0x51a8('0x2f')]!=='VIRTUAL'){var _0xb96200={};_0xb96200[_0xe6a86a['name']]={'$like':'%'+_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x3a')]+'%'};return _0xb96200;}})});}_0x41df56=_[_0x51a8('0x3c')]({},_0x41df56,_0x3bc19a[_0x51a8('0x3d')]);var _0x5c44a9={'where':_0x41df56[_0x51a8('0x3b')]};return db[_0x51a8('0x2d')][_0x51a8('0x23')](_0x5c44a9)[_0x51a8('0x26')](function(_0xa33fc){_0x4ea271[_0x51a8('0x23')]=_0xa33fc;if(_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x3e')]){_0x41df56[_0x51a8('0x3f')]=[{'all':!![]}];}return db['UserProfile'][_0x51a8('0x40')](_0x41df56);})[_0x51a8('0x26')](function(_0x4c7c67){_0x4ea271['rows']=_0x4c7c67;return _0x4ea271;})[_0x51a8('0x26')](respondWithFilteredResult(_0x143f46,_0x41df56))[_0x51a8('0x41')](handleError(_0x143f46,null));};exports[_0x51a8('0x42')]=function(_0x27b8e5,_0x311574){var _0x157a51={'raw':![],'where':{'id':_0x27b8e5[_0x51a8('0x43')]['id']}},_0x28f5b3={};_0x28f5b3[_0x51a8('0x30')]=_[_0x51a8('0x33')](db['UserProfile'][_0x51a8('0x2e')]);_0x28f5b3[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x27b8e5[_0x51a8('0x32')]);_0x28f5b3[_0x51a8('0x34')]=_[_0x51a8('0x44')](_0x28f5b3['model'],_0x28f5b3[_0x51a8('0x32')]);_0x157a51['attributes']=_[_0x51a8('0x44')](_0x28f5b3[_0x51a8('0x30')],qs[_0x51a8('0x36')](_0x27b8e5[_0x51a8('0x32')][_0x51a8('0x36')]));_0x157a51['attributes']=_0x157a51['attributes'][_0x51a8('0x45')]?_0x157a51[_0x51a8('0x35')]:_0x28f5b3[_0x51a8('0x30')];if(_0x27b8e5[_0x51a8('0x32')][_0x51a8('0x3e')]){_0x157a51['include']=[{'all':!![]}];}_0x157a51=_['merge']({},_0x157a51,_0x27b8e5[_0x51a8('0x3d')]);return db[_0x51a8('0x2d')][_0x51a8('0x46')](_0x157a51)[_0x51a8('0x26')](handleEntityNotFound(_0x311574,null))[_0x51a8('0x26')](respondWithResult(_0x311574,null))[_0x51a8('0x41')](handleError(_0x311574,null));};exports[_0x51a8('0x47')]=function(_0x1103a3,_0x301578){return db['UserProfile']['create'](_0x1103a3['body'],{})[_0x51a8('0x26')](respondWithResult(_0x301578,0xc9))[_0x51a8('0x41')](handleError(_0x301578,null));};exports[_0x51a8('0x48')]=function(_0x5259f3,_0x3bd492){var _0x3d6cd7={'where':{'id':_0x5259f3[_0x51a8('0x43')]['id']}},_0x5ab31a={};_0x5ab31a['model']=_['keys'](db[_0x51a8('0x2d')][_0x51a8('0x2e')]);_0x3d6cd7[_0x51a8('0x35')]=_['intersection'](_0x5ab31a['model'],qs[_0x51a8('0x36')](_0x5259f3['query'][_0x51a8('0x36')]));_0x3d6cd7[_0x51a8('0x35')]=_0x3d6cd7[_0x51a8('0x35')][_0x51a8('0x45')]?_0x3d6cd7[_0x51a8('0x35')]:_0x5ab31a[_0x51a8('0x30')];if(_0x5259f3[_0x51a8('0x32')][_0x51a8('0x3e')]){_0x3d6cd7[_0x51a8('0x3f')]=[{'all':!![]}];}_0x3d6cd7=_['merge']({},_0x3d6cd7,_0x5259f3[_0x51a8('0x3d')]);return db[_0x51a8('0x2d')][_0x51a8('0x46')](_0x3d6cd7)[_0x51a8('0x26')](handleEntityNotFound(_0x3bd492,null))['then'](function(_0x13b7ba){if(_0x13b7ba){var _0x5208d8=_0x13b7ba[_0x51a8('0x49')]({'plain':!![]});_0x5208d8=qs[_0x51a8('0x4a')](_0x5208d8,['id','createdAt','updatedAt',_0x51a8('0x4b')]);_0x5259f3[_0x51a8('0x4c')]=_[_0x51a8('0x4a')](_0x5259f3[_0x51a8('0x4c')],['id',_0x51a8('0x4d'),'updatedAt']);return db[_0x51a8('0x4e')][_0x51a8('0x4f')](function(_0x7a9dc){return db[_0x51a8('0x2d')][_0x51a8('0x47')](_['merge'](_0x5208d8,_0x5259f3[_0x51a8('0x4c')]),{'include':_0x5259f3[_0x51a8('0x32')][_0x51a8('0x3e')]?[{'all':!![]}]:undefined,'transaction':_0x7a9dc})[_0x51a8('0x26')](function(_0x62966a){var _0x352af8=_0x62966a['get']({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x5259f3['params']['id']},'raw':!![]})[_0x51a8('0x26')](function(_0x1df9cc){if(_0x1df9cc){return BPromise['each'](_0x1df9cc,function(_0x7ac0ae){return new BPromise(function(_0x56d3d7,_0x41cc00){if(_0x7ac0ae['autoAssociation']===null||_0x7ac0ae[_0x51a8('0x50')]===0x1)_0x56d3d7(null);return db[_0x51a8('0x51')]['findAll']({'where':{'sectionId':_0x7ac0ae['id']},'raw':!![]})['then'](function(_0x5eb540){var _0x44d67a=_[_0x51a8('0x31')](_0x5eb540,function(_0x283c8f){return qs[_0x51a8('0x4a')](_0x283c8f,['id',_0x51a8('0x4d'),_0x51a8('0x52'),_0x51a8('0x53')]);});_0x56d3d7(_0x44d67a);})[_0x51a8('0x41')](function(_0x494e11){_0x41cc00(_0x494e11);});})[_0x51a8('0x26')](function(_0x31efcb){var _0x4a0489=qs[_0x51a8('0x4a')](_0x7ac0ae,['id',_0x51a8('0x4d'),_0x51a8('0x52')]);_0x4a0489[_0x51a8('0x54')]=_0x352af8['id'];if(_0x31efcb)_0x4a0489[_0x51a8('0x55')]=_0x31efcb;return _0x4a0489;})[_0x51a8('0x26')](function(_0x4f6d5f){return db['UserProfileSection'][_0x51a8('0x47')](_0x4f6d5f,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x7a9dc});});})['then'](function(){return _0x352af8;});}});});});}})['then'](respondWithResult(_0x3bd492,0xc9))['catch'](handleError(_0x3bd492,null));};exports[_0x51a8('0x25')]=function(_0x529b2f,_0x1477af){if(_0x529b2f[_0x51a8('0x4c')]['id']){delete _0x529b2f[_0x51a8('0x4c')]['id'];}return db[_0x51a8('0x2d')][_0x51a8('0x46')]({'where':{'id':_0x529b2f[_0x51a8('0x43')]['id']}})[_0x51a8('0x26')](handleEntityNotFound(_0x1477af,null))[_0x51a8('0x26')](saveUpdates(_0x529b2f[_0x51a8('0x4c')],null))[_0x51a8('0x26')](respondWithResult(_0x1477af,null))['catch'](handleError(_0x1477af,null));};exports[_0x51a8('0x27')]=function(_0x220886,_0x31ee59){return db['UserProfile']['find']({'where':{'id':_0x220886['params']['id']}})[_0x51a8('0x26')](handleEntityNotFound(_0x31ee59,null))[_0x51a8('0x26')](removeEntity(_0x31ee59,null))[_0x51a8('0x41')](handleError(_0x31ee59,null));};exports[_0x51a8('0x56')]=function(_0x2efb36,_0x1462b4){return db[_0x51a8('0x2d')][_0x51a8('0x56')]()[_0x51a8('0x26')](respondWithResult(_0x1462b4,null))[_0x51a8('0x41')](handleError(_0x1462b4,null));};exports[_0x51a8('0x57')]=function(_0x3ba418,_0x934ea9){var _0x531995=_0x3ba418[_0x51a8('0x4c')];return db[_0x51a8('0x2d')]['find']({'where':{'id':_0x3ba418[_0x51a8('0x43')]['id']}})['then'](handleEntityNotFound(_0x934ea9,null))['then'](function(_0x59c80f){if(_0x59c80f){return db[_0x51a8('0x4e')][_0x51a8('0x4f')](function(_0xb480ec){return db[_0x51a8('0x58')][_0x51a8('0x27')]({'where':{'userProfileId':_0x3ba418[_0x51a8('0x43')]['id'],'sectionId':_[_0x51a8('0x31')](_0x531995,function(_0x5a37c1){return _0x5a37c1['sectionId'];})},'transaction':_0xb480ec})['then'](function(){var _0x44e496=_[_0x51a8('0x31')](_0x531995,function(_0x238074){_0x238074[_0x51a8('0x54')]=_0x3ba418[_0x51a8('0x43')]['id'];return _0x238074;});var _0x4fe3d6=[];return BPromise['each'](_0x44e496,function(_0x254ab5){return db['UserProfileSection'][_0x51a8('0x47')](_0x254ab5,{'include':[{'model':db[_0x51a8('0x51')],'as':_0x51a8('0x55')}],'raw':!![],'transaction':_0xb480ec})[_0x51a8('0x26')](function(_0x149a40){_0x4fe3d6[_0x51a8('0x59')](_0x149a40[_0x51a8('0x49')]({'plain':!![]}));});})[_0x51a8('0x26')](function(){return _0x4fe3d6;});});});}})[_0x51a8('0x26')](function(_0x39fcef){return _0x39fcef;})[_0x51a8('0x26')](respondWithResult(_0x934ea9,null))['catch'](handleError(_0x934ea9,null));};exports['removeSections']=function(_0x21912f,_0xf0c644){var _0x156b0c;return db[_0x51a8('0x2d')]['find']({'where':{'id':_0x21912f[_0x51a8('0x43')]['id']},'attributes':['id','name']})[_0x51a8('0x26')](handleEntityNotFound(_0xf0c644,null))[_0x51a8('0x26')](function(_0xbee86f){if(_0xbee86f){_0x156b0c=_0xbee86f;return db[_0x51a8('0x58')][_0x51a8('0x27')]({'where':{'userProfileId':_0x21912f[_0x51a8('0x43')]['id'],'sectionId':_0x21912f[_0x51a8('0x32')][_0x51a8('0x5a')]}});}})[_0x51a8('0x26')](function(){return _0x156b0c;})['then'](respondWithStatusCode(_0xf0c644,null))[_0x51a8('0x41')](handleError(_0xf0c644,null));};exports[_0x51a8('0x5b')]=function(_0x3e80db,_0x353e90){var _0x4ef0af=[];var _0x529062=[];return db[_0x51a8('0x58')]['findAll']({'where':{'userProfileId':_0x3e80db['params']['id']},'raw':!![]})['then'](function(_0xeb5d67){_0x4ef0af=_['filter'](_0xeb5d67,function(_0x5c7aca){return _0x5c7aca[_0x51a8('0x5c')]===0x1||_[_0x51a8('0x5d')]([0x3eb,0x709],_0x5c7aca[_0x51a8('0x53')]);});if(!_['isEmpty'](_0x4ef0af)){return _[_0x51a8('0x31')](_0x4ef0af,function(_0x252e99){return _0x252e99[_0x51a8('0x53')];});}else{return;}})['then'](function(_0x3ac9c8){if(_0x3ac9c8)_0x529062=_0x3ac9c8;if(_[_0x51a8('0x5d')](_0x529062,0x64)){var _0x24838b=_[_0x51a8('0x46')](_0x4ef0af,{'sectionId':0x64});return hasDefaultDashboard(_0x24838b)[_0x51a8('0x26')](function(_0x30dd7b){return _[_0x51a8('0x31')](_0x4ef0af,function(_0x245f5b){if(_0x245f5b[_0x51a8('0x53')]===0x64){_0x245f5b['subsections']=_0x30dd7b;}return _0x245f5b;});});}else{return;}})[_0x51a8('0x26')](function(_0x3be132){if(_0x3be132)_0x4ef0af=_0x3be132;if(_['includes'](_0x529062,0x3eb)){var _0x26e220=_[_0x51a8('0x46')](_0x4ef0af,{'sectionId':0x3eb});return getCustomDashboards(_0x26e220)['then'](function(_0x44f4b3){return _[_0x51a8('0x31')](_0x4ef0af,function(_0x3fbdf1){if(_0x26e220[_0x51a8('0x5c')]){if(_0x3fbdf1[_0x51a8('0x53')]===0x3eb){_0x3fbdf1['subsections']=_0x44f4b3;}}else{if(_0x3fbdf1[_0x51a8('0x53')]===0x64){_0x3fbdf1[_0x51a8('0x5e')]=_0x44f4b3;}}return _0x3fbdf1;});});}else{return;}})[_0x51a8('0x26')](function(_0x1d587e){if(_0x1d587e)_0x4ef0af=_0x1d587e;if(_['includes'](_0x529062,0x709)){var _0x3db2b8=_[_0x51a8('0x46')](_0x4ef0af,{'sectionId':0x709});return getPlugins(_0x3db2b8)[_0x51a8('0x26')](function(_0x37f253){if(_0x3db2b8[_0x51a8('0x5c')]){return _[_0x51a8('0x31')](_0x4ef0af,function(_0xf718e){if(_0xf718e[_0x51a8('0x53')]===0x709){_0xf718e['subsections']=_0x37f253;}return _0xf718e;});}else{var _0x1d7794={'sectionId':0x76c,'enabled':0x1,'subsections':_0x37f253};var _0x2f6d5e=_['map'](_0x4ef0af);_0x2f6d5e[_0x51a8('0x59')](_0x1d7794);return _0x2f6d5e;}});}else{return;}})[_0x51a8('0x26')](function(_0x58475b){if(_0x58475b)_0x4ef0af=_0x58475b;return _[_0x51a8('0x3a')](_0x4ef0af,['enabled',0x1]);})['then'](respondWithResult(_0x353e90,null))[_0x51a8('0x41')](handleError(_0x353e90,null));};function hasDefaultDashboard(_0xf2325b){var _0x41e0b9=[0x65];return new BPromise(function(_0x4cc06e,_0x585d4e){try{if(_0xf2325b[_0x51a8('0x50')]){_0x4cc06e(_0x41e0b9);}else{return db['UserProfileResource'][_0x51a8('0x5f')]({'where':{'sectionId':_0xf2325b['id']},'raw':!![]})[_0x51a8('0x26')](function(_0x46a32c){_0x46a32c?_0x4cc06e(_0x41e0b9):_0x4cc06e();});}}catch(_0x3b737b){_0x585d4e(_0x3b737b);}});}function getCustomDashboards(_0x34a645){var _0x28acb8=[];return new BPromise(function(_0xa9e5d0,_0x3004a4){try{if(_0x34a645[_0x51a8('0x50')]){return db[_0x51a8('0x60')][_0x51a8('0x40')]({'raw':!![]})[_0x51a8('0x26')](function(_0x1b7381){_0x1b7381[_0x51a8('0x61')](function(_0x4547bd){_0x28acb8['push'](_0x4547bd['id']+0x1869f);});_0xa9e5d0(_0x28acb8);});}else{return db['UserProfileResource'][_0x51a8('0x40')]({'where':{'sectionId':_0x34a645['id']},'raw':!![]})['then'](function(_0x4ea753){_0x4ea753['forEach'](function(_0x3dd98c){_0x28acb8[_0x51a8('0x59')](_0x3dd98c[_0x51a8('0x62')]+0x1869f);});_0xa9e5d0(_0x28acb8);});}}catch(_0x125a28){_0x3004a4(_0x125a28);}});}function getPlugins(_0x4d5f37){var _0x975b8=[];return new BPromise(function(_0x343fec,_0x4fd9ed){try{if(_0x4d5f37[_0x51a8('0x50')]){return db[_0x51a8('0x63')]['findAll']({'raw':!![]})['then'](function(_0x11e388){_0x11e388[_0x51a8('0x61')](function(_0x8587b9){_0x975b8[_0x51a8('0x59')](_0x8587b9['id']+0x15b38);});_0x343fec(_0x975b8);});}else{return db[_0x51a8('0x51')][_0x51a8('0x40')]({'where':{'sectionId':_0x4d5f37['id']},'raw':!![]})['then'](function(_0x13dab3){_0x13dab3[_0x51a8('0x61')](function(_0x181f8b){_0x975b8['push'](_0x181f8b[_0x51a8('0x62')]+0x15b38);});_0x343fec(_0x975b8);});}}catch(_0x3f4649){_0x4fd9ed(_0x3f4649);}});}exports[_0x51a8('0x64')]=function(_0x58a83c,_0x149fa4){return db[_0x51a8('0x2d')]['find']({'where':{'id':_0x58a83c[_0x51a8('0x43')]['id']}})['then'](handleEntityNotFound(_0x149fa4,null))[_0x51a8('0x26')](function(_0x2d4c2b){if(_0x2d4c2b){return db[_0x51a8('0x4e')][_0x51a8('0x4f')](function(_0x41621c){return db[_0x51a8('0x58')][_0x51a8('0x40')]({'where':{'userProfileId':_0x58a83c[_0x51a8('0x43')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0xde80dc){if(_0xde80dc){return db[_0x51a8('0x58')][_0x51a8('0x27')]({'where':{'userProfileId':_0x58a83c[_0x51a8('0x43')]['id'],'id':_[_0x51a8('0x31')](_0xde80dc,function(_0x5d7a2c){return _0x5d7a2c['id'];})},'transaction':_0x41621c});}})['then'](function(_0xcc722a){var _0x1bf0c9=_[_0x51a8('0x31')](_0x58a83c[_0x51a8('0x4c')],function(_0x342ccf){_0x342ccf['userProfileId']=_0x58a83c[_0x51a8('0x43')]['id'];return _0x342ccf;});return db['UserProfileSection'][_0x51a8('0x65')](_0x1bf0c9,{'raw':!![],'transaction':_0x41621c});})[_0x51a8('0x26')](function(_0x4d03c7){var _0x522cf3=_['filter'](_[_0x51a8('0x31')](_0x4d03c7,function(_0x3cf33c){return _0x3cf33c[_0x51a8('0x49')]({'plain':!![]});}),{'includeAll':![]});if(_0x522cf3){return db[_0x51a8('0x58')][_0x51a8('0x40')]({'where':{'userProfileId':_0x58a83c['params']['id'],'sectionId':_[_0x51a8('0x31')](_0x522cf3,function(_0x123d72){return _0x123d72['sectionId'];})},'attributes':['id',_0x51a8('0x53')],'raw':!![]})[_0x51a8('0x26')](function(_0x54e006){var _0x49b0d2=_[_0x51a8('0x31')](_0x58a83c[_0x51a8('0x4c')],function(_0x268856){_0x268856['userProfileId']=_0x58a83c[_0x51a8('0x43')]['id'];return _0x268856;});return db[_0x51a8('0x51')][_0x51a8('0x65')](_0x49b0d2,{'raw':!![],'transaction':_0x41621c});});}})[_0x51a8('0x41')](handleError(_0x149fa4,null));});}})[_0x51a8('0x26')](function(_0x21f861){var _0x30bf44=_['map'](_0x21f861,function(_0x206fe1){return _0x206fe1[_0x51a8('0x49')]({'plain':!![]});});})[_0x51a8('0x26')](respondWithResult(_0x149fa4,null))[_0x51a8('0x41')](handleError(_0x149fa4,null));};exports['removeResources']=function(_0x49e83c,_0x3d0bd3,_0x21aa81){return db['UserProfile']['find']({'where':{'id':_0x49e83c['params']['id']}})[_0x51a8('0x26')](handleEntityNotFound(_0x3d0bd3,null))['then'](function(_0x47c025){if(_0x47c025){return _0x47c025['removeResources'](_0x49e83c[_0x51a8('0x32')]['ids']);}})[_0x51a8('0x26')](respondWithStatusCode(_0x3d0bd3,null))[_0x51a8('0x41')](handleError(_0x3d0bd3,null));};exports['getResources']=function(_0x5ab3c0,_0x1e2ef4){var _0x5ab6b2={};if(!_0x5ab3c0[_0x51a8('0x32')][_0x51a8('0x66')])throw new Error('Missing\x20section\x20parameter');if(!_0x5ab3c0[_0x51a8('0x32')][_0x51a8('0x67')]('nolimit')){_0x5ab6b2[_0x51a8('0x22')]=qs[_0x51a8('0x22')](_0x5ab3c0[_0x51a8('0x32')]['limit']);_0x5ab6b2[_0x51a8('0x20')]=qs[_0x51a8('0x20')](_0x5ab3c0[_0x51a8('0x32')]['offset']);}return db['UserProfile'][_0x51a8('0x46')]({'where':{'id':_0x5ab3c0[_0x51a8('0x43')]['id']}})[_0x51a8('0x26')](function(_0xabdbd0){if(!_0xabdbd0)throw new Error(_0x51a8('0x68')+_0x5ab3c0[_0x51a8('0x43')]['id']);return db[_0x51a8('0x2d')][_0x51a8('0x69')](_0x5ab3c0);})[_0x51a8('0x26')](respondWithFilteredResult(_0x1e2ef4,_0x5ab6b2))[_0x51a8('0x41')](handleError(_0x1e2ef4,null));}; \ No newline at end of file +var _0x07fa=['model','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','includeAll','include','then','params','rawAttributes','keys','intersection','find','catch','create','body','clone','get','omit','crudPermissions','createdAt','updatedAt','sequelize','transaction','each','autoAssociation','findAll','sectionId','Resources','describe','addSections','UserProfileResource','push','removeSections','UserProfileSection','ids','getSections','enabled','includes','isEmpty','subsections','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','userProfileId','removeResources','section','Missing\x20section\x20parameter','getResources','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','fs-extra','squel','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./userProfile.socket','sendStatus','end','status','undefined','count','offset','limit','json','apply','reject','save','update','destroy','error','name','send','map','UserProfile','fieldName','type'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0x07fa,0x177));var _0xa07f=function(_0x1a72f3,_0x217011){_0x1a72f3=_0x1a72f3-0x0;var _0x57ef47=_0x07fa[_0x1a72f3];return _0x57ef47;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa07f('0x0'));var zipdir=require(_0xa07f('0x1'));var jsonpatch=require(_0xa07f('0x2'));var rp=require(_0xa07f('0x3'));var moment=require(_0xa07f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa07f('0x5'));var util=require(_0xa07f('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa07f('0x7'));var fs=require('fs');var fs_extra=require(_0xa07f('0x8'));var _=require('lodash');var squel=require(_0xa07f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa07f('0xa'));var Papa=require(_0xa07f('0xb'));var Redis=require('ioredis');var authService=require(_0xa07f('0xc'));var qs=require(_0xa07f('0xd'));var as=require(_0xa07f('0xe'));var hardwareService=require(_0xa07f('0xf'));var logger=require(_0xa07f('0x10'))(_0xa07f('0x11'));var utils=require(_0xa07f('0x12'));var config=require(_0xa07f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa07f('0x14'))['db'];config[_0xa07f('0x15')]=_['defaults'](config[_0xa07f('0x15')],{'host':_0xa07f('0x16'),'port':0x18eb});var socket=require(_0xa07f('0x17'))(new Redis(config['redis']));require(_0xa07f('0x18'))['register'](socket);function respondWithStatusCode(_0x3f0c38,_0x20db62){_0x20db62=_0x20db62||0xcc;return function(_0x3dde9f){if(_0x3dde9f){return _0x3f0c38[_0xa07f('0x19')](_0x20db62);}return _0x3f0c38['status'](_0x20db62)[_0xa07f('0x1a')]();};}function respondWithResult(_0x319924,_0x8d269e){_0x8d269e=_0x8d269e||0xc8;return function(_0xfa96a){if(_0xfa96a){return _0x319924[_0xa07f('0x1b')](_0x8d269e)['json'](_0xfa96a);}};}function respondWithFilteredResult(_0xd77607,_0x5a883e){return function(_0x5450a9){if(_0x5450a9){var _0x59b465=typeof _0x5a883e['offset']==='undefined'&&typeof _0x5a883e['limit']===_0xa07f('0x1c');var _0x2cb01f=_0x5450a9[_0xa07f('0x1d')];var _0x3a5307=_0x59b465?0x0:_0x5a883e[_0xa07f('0x1e')];var _0x25ab0d=_0x59b465?_0x5450a9[_0xa07f('0x1d')]:_0x5a883e['offset']+_0x5a883e[_0xa07f('0x1f')];var _0x5155df;if(_0x25ab0d>=_0x2cb01f){_0x25ab0d=_0x2cb01f;_0x5155df=0xc8;}else{_0x5155df=0xce;}_0xd77607[_0xa07f('0x1b')](_0x5155df);return _0xd77607['set']('Content-Range',_0x3a5307+'-'+_0x25ab0d+'/'+_0x2cb01f)[_0xa07f('0x20')](_0x5450a9);}return null;};}function patchUpdates(_0x7d2f10){return function(_0x1463c1){try{jsonpatch[_0xa07f('0x21')](_0x1463c1,_0x7d2f10,!![]);}catch(_0x4d6b10){return BPromise[_0xa07f('0x22')](_0x4d6b10);}return _0x1463c1[_0xa07f('0x23')]();};}function saveUpdates(_0x460037,_0x1b08df){return function(_0x24c1e2){if(_0x24c1e2){return _0x24c1e2[_0xa07f('0x24')](_0x460037)['then'](function(_0xc2d9fe){return _0xc2d9fe;});}return null;};}function removeEntity(_0x9f68c4,_0x37093a){return function(_0x3bd2c7){if(_0x3bd2c7){return _0x3bd2c7[_0xa07f('0x25')]()['then'](function(){_0x9f68c4['status'](0xcc)[_0xa07f('0x1a')]();});}};}function handleEntityNotFound(_0x2cdd67,_0x5a41fb){return function(_0x331b49){if(!_0x331b49){_0x2cdd67[_0xa07f('0x19')](0x194);}return _0x331b49;};}function handleError(_0x1ff144,_0x5d8239){_0x5d8239=_0x5d8239||0x1f4;return function(_0x52a0bc){logger[_0xa07f('0x26')](_0x52a0bc['stack']);if(_0x52a0bc['name']){delete _0x52a0bc[_0xa07f('0x27')];}_0x1ff144[_0xa07f('0x1b')](_0x5d8239)[_0xa07f('0x28')](_0x52a0bc);};}exports['index']=function(_0x438569,_0x2d1431){var _0x4853b6={},_0x59aee4={},_0x8016d={'count':0x0,'rows':[]};var _0x57c19c=_[_0xa07f('0x29')](db[_0xa07f('0x2a')]['rawAttributes'],function(_0x3bd81a){return{'name':_0x3bd81a[_0xa07f('0x2b')],'type':_0x3bd81a[_0xa07f('0x2c')]['key']};});_0x59aee4[_0xa07f('0x2d')]=_[_0xa07f('0x29')](_0x57c19c,_0xa07f('0x27'));_0x59aee4[_0xa07f('0x2e')]=_['keys'](_0x438569[_0xa07f('0x2e')]);_0x59aee4['filters']=_['intersection'](_0x59aee4[_0xa07f('0x2d')],_0x59aee4[_0xa07f('0x2e')]);_0x4853b6[_0xa07f('0x2f')]=_['intersection'](_0x59aee4['model'],qs[_0xa07f('0x30')](_0x438569[_0xa07f('0x2e')][_0xa07f('0x30')]));_0x4853b6[_0xa07f('0x2f')]=_0x4853b6[_0xa07f('0x2f')][_0xa07f('0x31')]?_0x4853b6[_0xa07f('0x2f')]:_0x59aee4['model'];if(!_0x438569[_0xa07f('0x2e')][_0xa07f('0x32')](_0xa07f('0x33'))){_0x4853b6[_0xa07f('0x1f')]=qs['limit'](_0x438569['query'][_0xa07f('0x1f')]);_0x4853b6['offset']=qs['offset'](_0x438569[_0xa07f('0x2e')][_0xa07f('0x1e')]);}_0x4853b6['order']=qs[_0xa07f('0x34')](_0x438569['query'][_0xa07f('0x34')]);_0x4853b6[_0xa07f('0x35')]=qs[_0xa07f('0x36')](_[_0xa07f('0x37')](_0x438569[_0xa07f('0x2e')],_0x59aee4['filters']),_0x57c19c);if(_0x438569['query'][_0xa07f('0x38')]){_0x4853b6[_0xa07f('0x35')]=_[_0xa07f('0x39')](_0x4853b6[_0xa07f('0x35')],{'$or':_[_0xa07f('0x29')](_0x57c19c,function(_0x409578){if(_0x409578[_0xa07f('0x2c')]!=='VIRTUAL'){var _0x312004={};_0x312004[_0x409578[_0xa07f('0x27')]]={'$like':'%'+_0x438569['query'][_0xa07f('0x38')]+'%'};return _0x312004;}})});}_0x4853b6=_[_0xa07f('0x39')]({},_0x4853b6,_0x438569['options']);var _0xfa9caf={'where':_0x4853b6[_0xa07f('0x35')]};return db['UserProfile'][_0xa07f('0x1d')](_0xfa9caf)['then'](function(_0x3bd56c){_0x8016d[_0xa07f('0x1d')]=_0x3bd56c;if(_0x438569[_0xa07f('0x2e')][_0xa07f('0x3a')]){_0x4853b6[_0xa07f('0x3b')]=[{'all':!![]}];}return db[_0xa07f('0x2a')]['findAll'](_0x4853b6);})['then'](function(_0x3ef4fb){_0x8016d['rows']=_0x3ef4fb;return _0x8016d;})[_0xa07f('0x3c')](respondWithFilteredResult(_0x2d1431,_0x4853b6))['catch'](handleError(_0x2d1431,null));};exports['show']=function(_0x28e268,_0x53bf27){var _0x22f482={'raw':![],'where':{'id':_0x28e268[_0xa07f('0x3d')]['id']}},_0x244071={};_0x244071[_0xa07f('0x2d')]=_['keys'](db[_0xa07f('0x2a')][_0xa07f('0x3e')]);_0x244071[_0xa07f('0x2e')]=_[_0xa07f('0x3f')](_0x28e268[_0xa07f('0x2e')]);_0x244071['filters']=_['intersection'](_0x244071[_0xa07f('0x2d')],_0x244071[_0xa07f('0x2e')]);_0x22f482[_0xa07f('0x2f')]=_[_0xa07f('0x40')](_0x244071[_0xa07f('0x2d')],qs[_0xa07f('0x30')](_0x28e268['query'][_0xa07f('0x30')]));_0x22f482[_0xa07f('0x2f')]=_0x22f482[_0xa07f('0x2f')]['length']?_0x22f482[_0xa07f('0x2f')]:_0x244071[_0xa07f('0x2d')];if(_0x28e268[_0xa07f('0x2e')][_0xa07f('0x3a')]){_0x22f482[_0xa07f('0x3b')]=[{'all':!![]}];}_0x22f482=_['merge']({},_0x22f482,_0x28e268['options']);return db[_0xa07f('0x2a')][_0xa07f('0x41')](_0x22f482)[_0xa07f('0x3c')](handleEntityNotFound(_0x53bf27,null))[_0xa07f('0x3c')](respondWithResult(_0x53bf27,null))[_0xa07f('0x42')](handleError(_0x53bf27,null));};exports[_0xa07f('0x43')]=function(_0x33a1e7,_0x3651fc){return db[_0xa07f('0x2a')][_0xa07f('0x43')](_0x33a1e7[_0xa07f('0x44')],{})[_0xa07f('0x3c')](respondWithResult(_0x3651fc,0xc9))[_0xa07f('0x42')](handleError(_0x3651fc,null));};exports[_0xa07f('0x45')]=function(_0x731a46,_0x51e834){var _0x720e57={'where':{'id':_0x731a46[_0xa07f('0x3d')]['id']}},_0x25a4c8={};_0x25a4c8[_0xa07f('0x2d')]=_[_0xa07f('0x3f')](db['UserProfile'][_0xa07f('0x3e')]);_0x720e57['attributes']=_[_0xa07f('0x40')](_0x25a4c8[_0xa07f('0x2d')],qs[_0xa07f('0x30')](_0x731a46[_0xa07f('0x2e')][_0xa07f('0x30')]));_0x720e57['attributes']=_0x720e57[_0xa07f('0x2f')][_0xa07f('0x31')]?_0x720e57[_0xa07f('0x2f')]:_0x25a4c8[_0xa07f('0x2d')];if(_0x731a46[_0xa07f('0x2e')][_0xa07f('0x3a')]){_0x720e57[_0xa07f('0x3b')]=[{'all':!![]}];}_0x720e57=_[_0xa07f('0x39')]({},_0x720e57,_0x731a46['options']);return db[_0xa07f('0x2a')]['find'](_0x720e57)[_0xa07f('0x3c')](handleEntityNotFound(_0x51e834,null))[_0xa07f('0x3c')](function(_0x3b22cd){if(_0x3b22cd){var _0x5c6a30=_0x3b22cd[_0xa07f('0x46')]({'plain':!![]});_0x5c6a30=qs[_0xa07f('0x47')](_0x5c6a30,['id','createdAt','updatedAt',_0xa07f('0x48')]);_0x731a46[_0xa07f('0x44')]=_[_0xa07f('0x47')](_0x731a46[_0xa07f('0x44')],['id',_0xa07f('0x49'),_0xa07f('0x4a')]);return db[_0xa07f('0x4b')][_0xa07f('0x4c')](function(_0x529163){return db[_0xa07f('0x2a')][_0xa07f('0x43')](_[_0xa07f('0x39')](_0x5c6a30,_0x731a46[_0xa07f('0x44')]),{'include':_0x731a46[_0xa07f('0x2e')][_0xa07f('0x3a')]?[{'all':!![]}]:undefined,'transaction':_0x529163})['then'](function(_0xd03bd2){var _0x247c8e=_0xd03bd2['get']({'plain':!![]});return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x731a46['params']['id']},'raw':!![]})[_0xa07f('0x3c')](function(_0x96f454){if(_0x96f454){return BPromise[_0xa07f('0x4d')](_0x96f454,function(_0x283e8b){return new BPromise(function(_0x5a49e8,_0x5e7221){if(_0x283e8b[_0xa07f('0x4e')]===null||_0x283e8b['autoAssociation']===0x1)_0x5a49e8(null);return db['UserProfileResource'][_0xa07f('0x4f')]({'where':{'sectionId':_0x283e8b['id']},'raw':!![]})[_0xa07f('0x3c')](function(_0x37dee6){var _0x14e49a=_[_0xa07f('0x29')](_0x37dee6,function(_0x438d8d){return qs[_0xa07f('0x47')](_0x438d8d,['id',_0xa07f('0x49'),'updatedAt',_0xa07f('0x50')]);});_0x5a49e8(_0x14e49a);})['catch'](function(_0x21ffda){_0x5e7221(_0x21ffda);});})['then'](function(_0x4936d3){var _0x44d3eb=qs[_0xa07f('0x47')](_0x283e8b,['id',_0xa07f('0x49'),_0xa07f('0x4a')]);_0x44d3eb['userProfileId']=_0x247c8e['id'];if(_0x4936d3)_0x44d3eb['Resources']=_0x4936d3;return _0x44d3eb;})['then'](function(_0x52eaf7){return db['UserProfileSection'][_0xa07f('0x43')](_0x52eaf7,{'include':[{'model':db['UserProfileResource'],'as':_0xa07f('0x51')}],'raw':!![],'transaction':_0x529163});});})[_0xa07f('0x3c')](function(){return _0x247c8e;});}});});});}})['then'](respondWithResult(_0x51e834,0xc9))['catch'](handleError(_0x51e834,null));};exports['update']=function(_0x36d804,_0x18ff9a){if(_0x36d804[_0xa07f('0x44')]['id']){delete _0x36d804['body']['id'];}return db['UserProfile'][_0xa07f('0x41')]({'where':{'id':_0x36d804['params']['id']}})[_0xa07f('0x3c')](handleEntityNotFound(_0x18ff9a,null))[_0xa07f('0x3c')](saveUpdates(_0x36d804[_0xa07f('0x44')],null))[_0xa07f('0x3c')](respondWithResult(_0x18ff9a,null))[_0xa07f('0x42')](handleError(_0x18ff9a,null));};exports[_0xa07f('0x25')]=function(_0x43400b,_0x3a12d5){return db[_0xa07f('0x2a')][_0xa07f('0x41')]({'where':{'id':_0x43400b[_0xa07f('0x3d')]['id']}})[_0xa07f('0x3c')](handleEntityNotFound(_0x3a12d5,null))[_0xa07f('0x3c')](removeEntity(_0x3a12d5,null))[_0xa07f('0x42')](handleError(_0x3a12d5,null));};exports['describe']=function(_0x439638,_0x5029bc){return db[_0xa07f('0x2a')][_0xa07f('0x52')]()[_0xa07f('0x3c')](respondWithResult(_0x5029bc,null))['catch'](handleError(_0x5029bc,null));};exports[_0xa07f('0x53')]=function(_0x291ba0,_0x4abfe6){var _0x2bdf09=_0x291ba0[_0xa07f('0x44')];return db[_0xa07f('0x2a')][_0xa07f('0x41')]({'where':{'id':_0x291ba0['params']['id']}})['then'](handleEntityNotFound(_0x4abfe6,null))[_0xa07f('0x3c')](function(_0x466361){if(_0x466361){return db[_0xa07f('0x4b')][_0xa07f('0x4c')](function(_0x2dbedd){return db['UserProfileSection'][_0xa07f('0x25')]({'where':{'userProfileId':_0x291ba0['params']['id'],'sectionId':_[_0xa07f('0x29')](_0x2bdf09,function(_0x1f6630){return _0x1f6630[_0xa07f('0x50')];})},'transaction':_0x2dbedd})[_0xa07f('0x3c')](function(){var _0x27669b=_[_0xa07f('0x29')](_0x2bdf09,function(_0x57891f){_0x57891f['userProfileId']=_0x291ba0[_0xa07f('0x3d')]['id'];return _0x57891f;});var _0x2ebd28=[];return BPromise[_0xa07f('0x4d')](_0x27669b,function(_0x253a68){return db['UserProfileSection'][_0xa07f('0x43')](_0x253a68,{'include':[{'model':db[_0xa07f('0x54')],'as':_0xa07f('0x51')}],'raw':!![],'transaction':_0x2dbedd})[_0xa07f('0x3c')](function(_0x18d6ff){_0x2ebd28[_0xa07f('0x55')](_0x18d6ff['get']({'plain':!![]}));});})[_0xa07f('0x3c')](function(){return _0x2ebd28;});});});}})[_0xa07f('0x3c')](function(_0xd3cf29){return _0xd3cf29;})[_0xa07f('0x3c')](respondWithResult(_0x4abfe6,null))[_0xa07f('0x42')](handleError(_0x4abfe6,null));};exports[_0xa07f('0x56')]=function(_0x3ab14b,_0x397005){var _0x548b8a;return db[_0xa07f('0x2a')][_0xa07f('0x41')]({'where':{'id':_0x3ab14b['params']['id']},'attributes':['id',_0xa07f('0x27')]})[_0xa07f('0x3c')](handleEntityNotFound(_0x397005,null))[_0xa07f('0x3c')](function(_0x961471){if(_0x961471){_0x548b8a=_0x961471;return db[_0xa07f('0x57')][_0xa07f('0x25')]({'where':{'userProfileId':_0x3ab14b[_0xa07f('0x3d')]['id'],'sectionId':_0x3ab14b[_0xa07f('0x2e')][_0xa07f('0x58')]}});}})[_0xa07f('0x3c')](function(){return _0x548b8a;})[_0xa07f('0x3c')](respondWithStatusCode(_0x397005,null))[_0xa07f('0x42')](handleError(_0x397005,null));};exports[_0xa07f('0x59')]=function(_0x4a0f9b,_0x42a621){var _0x597d82=[];var _0x2aff28=[];return db['UserProfileSection'][_0xa07f('0x4f')]({'where':{'userProfileId':_0x4a0f9b[_0xa07f('0x3d')]['id']},'raw':!![]})[_0xa07f('0x3c')](function(_0x54828d){_0x597d82=_[_0xa07f('0x38')](_0x54828d,function(_0x2c52bd){return _0x2c52bd[_0xa07f('0x5a')]===0x1||_[_0xa07f('0x5b')]([0x3eb,0x709],_0x2c52bd[_0xa07f('0x50')]);});if(!_[_0xa07f('0x5c')](_0x597d82)){return _[_0xa07f('0x29')](_0x597d82,function(_0x3ea4f4){return _0x3ea4f4[_0xa07f('0x50')];});}else{return;}})['then'](function(_0x3a472c){if(_0x3a472c)_0x2aff28=_0x3a472c;if(_[_0xa07f('0x5b')](_0x2aff28,0x64)){var _0x13d959=_[_0xa07f('0x41')](_0x597d82,{'sectionId':0x64});return hasDefaultDashboard(_0x13d959)['then'](function(_0x544a96){return _[_0xa07f('0x29')](_0x597d82,function(_0x28c53c){if(_0x28c53c[_0xa07f('0x50')]===0x64){_0x28c53c['subsections']=_0x544a96;}return _0x28c53c;});});}else{return;}})[_0xa07f('0x3c')](function(_0x5ddc0d){if(_0x5ddc0d)_0x597d82=_0x5ddc0d;if(_['includes'](_0x2aff28,0x3eb)){var _0x1d832b=_[_0xa07f('0x41')](_0x597d82,{'sectionId':0x3eb});return getCustomDashboards(_0x1d832b)[_0xa07f('0x3c')](function(_0x3da45a){return _[_0xa07f('0x29')](_0x597d82,function(_0x440ca2){if(_0x1d832b[_0xa07f('0x5a')]){if(_0x440ca2[_0xa07f('0x50')]===0x3eb){_0x440ca2[_0xa07f('0x5d')]=_0x3da45a;}}else{if(_0x440ca2[_0xa07f('0x50')]===0x64){_0x440ca2[_0xa07f('0x5d')]=_0x3da45a;}}return _0x440ca2;});});}else{return;}})['then'](function(_0x235ad2){if(_0x235ad2)_0x597d82=_0x235ad2;if(_['includes'](_0x2aff28,0x709)){var _0xd52b5e=_[_0xa07f('0x41')](_0x597d82,{'sectionId':0x709});return getPlugins(_0xd52b5e)[_0xa07f('0x3c')](function(_0x603a53){if(_0xd52b5e[_0xa07f('0x5a')]){return _[_0xa07f('0x29')](_0x597d82,function(_0x169eac){if(_0x169eac[_0xa07f('0x50')]===0x709){_0x169eac[_0xa07f('0x5d')]=_0x603a53;}return _0x169eac;});}else{var _0x32c860={'sectionId':0x76c,'enabled':0x1,'subsections':_0x603a53};var _0x5417cd=_[_0xa07f('0x29')](_0x597d82);_0x5417cd[_0xa07f('0x55')](_0x32c860);return _0x5417cd;}});}else{return;}})[_0xa07f('0x3c')](function(_0x11173e){if(_0x11173e)_0x597d82=_0x11173e;return _[_0xa07f('0x38')](_0x597d82,[_0xa07f('0x5a'),0x1]);})['then'](respondWithResult(_0x42a621,null))['catch'](handleError(_0x42a621,null));};function hasDefaultDashboard(_0x370f14){var _0x2c3936=[0x65];return new BPromise(function(_0x1b4d81,_0x4464ba){try{if(_0x370f14[_0xa07f('0x4e')]){_0x1b4d81(_0x2c3936);}else{return db[_0xa07f('0x54')][_0xa07f('0x5e')]({'where':{'sectionId':_0x370f14['id']},'raw':!![]})[_0xa07f('0x3c')](function(_0x16c983){_0x16c983?_0x1b4d81(_0x2c3936):_0x1b4d81();});}}catch(_0x4186da){_0x4464ba(_0x4186da);}});}function getCustomDashboards(_0x383992){var _0x17229f=[];return new BPromise(function(_0x2737da,_0x46e1a9){try{if(_0x383992[_0xa07f('0x4e')]){return db['Dashboard'][_0xa07f('0x4f')]({'raw':!![]})[_0xa07f('0x3c')](function(_0x56a811){_0x56a811['forEach'](function(_0x3a2bc6){_0x17229f['push'](_0x3a2bc6['id']+0x1869f);});_0x2737da(_0x17229f);});}else{return db[_0xa07f('0x54')][_0xa07f('0x4f')]({'where':{'sectionId':_0x383992['id']},'raw':!![]})['then'](function(_0x283cad){_0x283cad[_0xa07f('0x5f')](function(_0x5420c3){_0x17229f['push'](_0x5420c3[_0xa07f('0x60')]+0x1869f);});_0x2737da(_0x17229f);});}}catch(_0x3ce182){_0x46e1a9(_0x3ce182);}});}function getPlugins(_0x76e39d){var _0x542f3d=[];return new BPromise(function(_0x1a60a4,_0x5eff2e){try{if(_0x76e39d[_0xa07f('0x4e')]){return db[_0xa07f('0x61')][_0xa07f('0x4f')]({'raw':!![]})[_0xa07f('0x3c')](function(_0x3769e8){_0x3769e8[_0xa07f('0x5f')](function(_0x51b020){_0x542f3d['push'](_0x51b020['id']+0x15b38);});_0x1a60a4(_0x542f3d);});}else{return db[_0xa07f('0x54')][_0xa07f('0x4f')]({'where':{'sectionId':_0x76e39d['id']},'raw':!![]})[_0xa07f('0x3c')](function(_0x282e4b){_0x282e4b[_0xa07f('0x5f')](function(_0x56a8cf){_0x542f3d[_0xa07f('0x55')](_0x56a8cf[_0xa07f('0x60')]+0x15b38);});_0x1a60a4(_0x542f3d);});}}catch(_0x5ae718){_0x5eff2e(_0x5ae718);}});}exports[_0xa07f('0x62')]=function(_0x25424b,_0x1f8dad){return db[_0xa07f('0x2a')][_0xa07f('0x41')]({'where':{'id':_0x25424b[_0xa07f('0x3d')]['id']}})[_0xa07f('0x3c')](handleEntityNotFound(_0x1f8dad,null))[_0xa07f('0x3c')](function(_0x226a48){if(_0x226a48){return db[_0xa07f('0x4b')][_0xa07f('0x4c')](function(_0x217862){return db[_0xa07f('0x57')][_0xa07f('0x4f')]({'where':{'userProfileId':_0x25424b['params']['id']},'attributes':['id'],'raw':!![]})[_0xa07f('0x3c')](function(_0x20d208){if(_0x20d208){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x25424b[_0xa07f('0x3d')]['id'],'id':_[_0xa07f('0x29')](_0x20d208,function(_0x3925db){return _0x3925db['id'];})},'transaction':_0x217862});}})['then'](function(_0x4819e2){var _0x1183d2=_[_0xa07f('0x29')](_0x25424b['body'],function(_0x43f2b9){_0x43f2b9['userProfileId']=_0x25424b[_0xa07f('0x3d')]['id'];return _0x43f2b9;});return db[_0xa07f('0x57')][_0xa07f('0x63')](_0x1183d2,{'raw':!![],'transaction':_0x217862});})[_0xa07f('0x3c')](function(_0xcc1fb9){var _0x773aef=_[_0xa07f('0x38')](_['map'](_0xcc1fb9,function(_0x221b8f){return _0x221b8f[_0xa07f('0x46')]({'plain':!![]});}),{'includeAll':![]});if(_0x773aef){return db[_0xa07f('0x57')][_0xa07f('0x4f')]({'where':{'userProfileId':_0x25424b['params']['id'],'sectionId':_['map'](_0x773aef,function(_0x5a0f9c){return _0x5a0f9c[_0xa07f('0x50')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xa07f('0x3c')](function(_0x5b45d1){var _0x2c8541=_[_0xa07f('0x29')](_0x25424b[_0xa07f('0x44')],function(_0x380699){_0x380699[_0xa07f('0x64')]=_0x25424b['params']['id'];return _0x380699;});return db['UserProfileResource'][_0xa07f('0x63')](_0x2c8541,{'raw':!![],'transaction':_0x217862});});}})[_0xa07f('0x42')](handleError(_0x1f8dad,null));});}})[_0xa07f('0x3c')](function(_0x11064f){var _0x2e8a10=_[_0xa07f('0x29')](_0x11064f,function(_0x4a6247){return _0x4a6247[_0xa07f('0x46')]({'plain':!![]});});})[_0xa07f('0x3c')](respondWithResult(_0x1f8dad,null))[_0xa07f('0x42')](handleError(_0x1f8dad,null));};exports[_0xa07f('0x65')]=function(_0x1a73dc,_0x3693bb,_0x2c8b6a){return db[_0xa07f('0x2a')]['find']({'where':{'id':_0x1a73dc[_0xa07f('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3693bb,null))['then'](function(_0x48eddc){if(_0x48eddc){return _0x48eddc[_0xa07f('0x65')](_0x1a73dc[_0xa07f('0x2e')]['ids']);}})['then'](respondWithStatusCode(_0x3693bb,null))[_0xa07f('0x42')](handleError(_0x3693bb,null));};exports['getResources']=function(_0x1f9d3f,_0x134187){var _0x16531e={};if(!_0x1f9d3f[_0xa07f('0x2e')][_0xa07f('0x66')])throw new Error(_0xa07f('0x67'));if(!_0x1f9d3f['query'][_0xa07f('0x32')](_0xa07f('0x33'))){_0x16531e['limit']=qs[_0xa07f('0x1f')](_0x1f9d3f[_0xa07f('0x2e')][_0xa07f('0x1f')]);_0x16531e[_0xa07f('0x1e')]=qs[_0xa07f('0x1e')](_0x1f9d3f[_0xa07f('0x2e')][_0xa07f('0x1e')]);}return db['UserProfile'][_0xa07f('0x41')]({'where':{'id':_0x1f9d3f[_0xa07f('0x3d')]['id']}})[_0xa07f('0x3c')](function(_0x5612b3){if(!_0x5612b3)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x1f9d3f[_0xa07f('0x3d')]['id']);return db['UserProfile'][_0xa07f('0x68')](_0x1f9d3f);})[_0xa07f('0x3c')](respondWithFilteredResult(_0x134187,_0x16531e))['catch'](handleError(_0x134187,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 5708b3c..57d04d5 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 _0xc61d=['exports','events','../../mysqldb','UserProfile','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x1e3ef6,_0x4e095b){var _0x15ddd6=function(_0x10e1eb){while(--_0x10e1eb){_0x1e3ef6['push'](_0x1e3ef6['shift']());}};_0x15ddd6(++_0x4e095b);}(_0xc61d,0xfb));var _0xdc61=function(_0x2ba146,_0x3dc146){_0x2ba146=_0x2ba146-0x0;var _0x1dfc89=_0xc61d[_0x2ba146];return _0x1dfc89;};'use strict';var EventEmitter=require(_0xdc61('0x0'));var UserProfile=require(_0xdc61('0x1'))['db'][_0xdc61('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xdc61('0x3')](0x0);var events={'afterCreate':_0xdc61('0x4'),'afterUpdate':_0xdc61('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2125a2){return function(_0x237baa,_0x4ebd75,_0x2b94dd){UserProfileEvents[_0xdc61('0x6')](_0x2125a2+':'+_0x237baa['id'],_0x237baa);UserProfileEvents[_0xdc61('0x6')](_0x2125a2,_0x237baa);_0x2b94dd(null);};}for(var e in events){if(events[_0xdc61('0x7')](e)){var event=events[e];UserProfile[_0xdc61('0x8')](e,emitEvent(event));}}module[_0xdc61('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x4e83=['setMaxListeners','save','update','remove','emit','hook','exports','events','UserProfile'];(function(_0x34c819,_0x2d4fd5){var _0x51912e=function(_0x5ab9b4){while(--_0x5ab9b4){_0x34c819['push'](_0x34c819['shift']());}};_0x51912e(++_0x2d4fd5);}(_0x4e83,0x1ae));var _0x34e8=function(_0x1c4831,_0x3ff74a){_0x1c4831=_0x1c4831-0x0;var _0x1e6a6d=_0x4e83[_0x1c4831];return _0x1e6a6d;};'use strict';var EventEmitter=require(_0x34e8('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x34e8('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x34e8('0x2')](0x0);var events={'afterCreate':_0x34e8('0x3'),'afterUpdate':_0x34e8('0x4'),'afterDestroy':_0x34e8('0x5')};function emitEvent(_0x58fe4b){return function(_0x5dc841,_0x506eb2,_0x51fc5b){UserProfileEvents[_0x34e8('0x6')](_0x58fe4b+':'+_0x5dc841['id'],_0x5dc841);UserProfileEvents[_0x34e8('0x6')](_0x58fe4b,_0x5dc841);_0x51fc5b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x34e8('0x7')](e,emitEvent(event));}}module[_0x34e8('0x8')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 4980dc8..7fd14ea 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 _0xf494=['SELECT','select','ui.','InteractionId','from','user_has_','_interactions','where','sequelize','query','OpenTabs','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','find','params','all','ignore','union','autoAssociation','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','pick','filters','key','foreignKey','merge','options','includeAll','forEach','reportType','default','reportId','DefaultReports','custom','CustomReports','count','include','Tag','Tags','color','tag','ThroughTags','rows','true','chat','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','../../components/parsers/qs','exports','models','filter','value','findAll','then','associatedResources','map','catch','model','name','UserProfileResource','field','AnalyticExtractedReport','resourceId','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','contacts','CmContact','Lists','ListId','lists','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','role','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','smsqueues','smsaccounts','SmsAccount','WhatsappQueue','teams','Team','queuecampaigns','users','agents','telephones','Users','admin','zendeskaccounts','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','scheduler','sounds','Sound','tags','templates','triggers','trunks','Trunk','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes'];(function(_0x563122,_0x4a4e0b){var _0x4002cb=function(_0x3f0216){while(--_0x3f0216){_0x563122['push'](_0x563122['shift']());}};_0x4002cb(++_0x4a4e0b);}(_0xf494,0x1c6));var _0x4f49=function(_0x63407c,_0x2a8a08){_0x63407c=_0x63407c-0x0;var _0x2339a6=_0xf494[_0x63407c];return _0x2339a6;};'use strict';var _=require(_0x4f49('0x0'));var attributes=require(_0x4f49('0x1'));var qs=require(_0x4f49('0x2'));var squel=require('squel');module[_0x4f49('0x3')]=function(_0x1d54cc){var _0x423b25=_0x1d54cc[_0x4f49('0x4')];function _0x20c0d7(_0x2a15fb,_0x3267c1){return new Promise(function(_0x790e8b,_0xc5e778){if(!_0x3267c1)return _0x790e8b(null);var _0x413530=_0x3267c1[_0x4f49('0x5')]?{[_0x3267c1['filter']['field']]:_0x3267c1[_0x4f49('0x5')][_0x4f49('0x6')]}:undefined;return _0x423b25[_0x2a15fb][_0x4f49('0x7')]({'where':_0x413530,'raw':!![]})[_0x4f49('0x8')](function(_0x185174){_0x3267c1[_0x4f49('0x9')]=_[_0x4f49('0xa')](_0x185174,'id');_0x790e8b(_0x3267c1);})[_0x4f49('0xb')](function(_0x53ee74){_0xc5e778(_0x53ee74);});});}function _0x3e464f(_0x411759,_0x5bcfe5){return new Promise(function(_0x15e7a1,_0x5bbc75){var _0x496293=_0x411759[_0x4f49('0x5')]?{[_0x411759[_0x4f49('0x5')]['field']]:_0x411759[_0x4f49('0x5')][_0x4f49('0x6')]}:undefined;return _0x423b25[_0x411759[_0x4f49('0xc')]][_0x4f49('0x7')]({'where':_0x496293,'raw':!![]})[_0x4f49('0x8')](function(_0x2f0131){_0x5bcfe5[_0x4f49('0x9')]=_['map'](_0x2f0131,function(_0x515ace){return _0x515ace[_0x4f49('0xd')];});_0x15e7a1(_0x5bcfe5);})[_0x4f49('0xb')](function(_0x5878f4){_0x5bbc75(_0x5878f4);});});}function _0x5bdfaf(_0x2f0a0d,_0x2ecaaa,_0x74886e){if(!_0x2ecaaa)return Promise['resolve'](null);return new Promise(function(_0x1dccfd,_0x399be7){return _0x423b25[_0x4f49('0xe')]['findAll']({'where':{'sectionId':_0x2ecaaa['id']},'raw':!![]})['then'](function(_0x560592){if(_0x2f0a0d['field']&&_0x2f0a0d[_0x4f49('0xf')]!=='id'){_0x2ecaaa[_0x4f49('0x9')]=_[_0x4f49('0xa')](_0x560592,function(_0x407042){return _0x407042[_0x2f0a0d['field']];});}else{if(_0x74886e===_0x4f49('0x10')){_0x2ecaaa[_0x4f49('0x9')]=_[_0x4f49('0xa')](_0x560592,function(_0xaab5e7){return{'id':_0xaab5e7[_0x4f49('0x11')],'type':_0xaab5e7['type']};});}else{_0x2ecaaa[_0x4f49('0x9')]=_[_0x4f49('0xa')](_0x560592,function(_0x3ae590){return _0x3ae590['resourceId'];});}}_0x1dccfd(_0x2ecaaa);})[_0x4f49('0xb')](function(_0x1d70a7){_0x399be7(_0x1d70a7);});});}function _0x32ca7b(_0x43c458,_0x9d30aa){var _0x36187b={'parentSections':[]};switch(_0x43c458['toLowerCase']()){case'squareprojects':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x13');break;case'odbc':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x14');break;case _0x4f49('0x15'):_0x36187b['childModel']=_0x4f49('0x16');_0x36187b[_0x4f49('0x17')]=[{'name':_0x4f49('0x18'),'field':_0x4f49('0xd'),'foreignKey':_0x4f49('0x19')}];break;case _0x4f49('0x1a'):_0x36187b['childModel']='JscriptyProject';break;case _0x4f49('0x1b'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x1c');_0x36187b['parentSections']=[{'name':_0x4f49('0x1d'),'field':'id','foreignKey':_0x4f49('0x1e')}];break;case _0x4f49('0x1f'):_0x36187b['childModel']='CmList';break;case _0x4f49('0x20'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x21');break;case'globalcustomfields':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x22');break;case _0x4f49('0x23'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x24');break;case _0x4f49('0x25'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x26');break;case _0x4f49('0x27'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x28');break;case _0x4f49('0x29'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x2a');break;case _0x4f49('0x2b'):case _0x4f49('0x2c'):case _0x4f49('0x2d'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x2e');break;case'contexts':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x2f');break;case _0x4f49('0x30'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x31');break;case _0x4f49('0x32'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x33');_0x36187b[_0x4f49('0x17')]=[{'name':_0x4f49('0x34'),'field':_0x4f49('0xd'),'foreignKey':_0x4f49('0x35'),'model':_0x4f49('0x36'),'filter':{'field':'role','value':[_0x4f49('0x37')]}},{'name':_0x4f49('0x38'),'field':_0x4f49('0xd'),'foreignKey':_0x4f49('0x35'),'model':_0x4f49('0x36'),'filter':{'field':_0x4f49('0x39'),'value':[_0x4f49('0x3a')]}},{'name':_0x4f49('0x3b'),'field':_0x4f49('0xd'),'foreignKey':_0x4f49('0x3c'),'model':_0x4f49('0x3d'),'filter':{'field':_0x4f49('0x3e'),'value':[_0x4f49('0x3f')]}},{'name':_0x4f49('0x40'),'field':'name','foreignKey':_0x4f49('0x3c'),'model':_0x4f49('0x3d'),'filter':{'field':'type','value':[_0x4f49('0x41')]}}];break;case _0x4f49('0x42'):_0x36187b['childModel']=_0x4f49('0x43');break;case _0x4f49('0x44'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x45');break;case _0x4f49('0x46'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x47');break;case'ivrcampaigns':_0x36187b['childModel']='Campaign';break;case _0x4f49('0x48'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x49');break;case _0x4f49('0x4a'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x4b');break;case _0x4f49('0x4c'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x4d');break;case'openchannelqueues':_0x36187b['childModel']=_0x4f49('0x4e');break;case _0x4f49('0x4f'):_0x36187b[_0x4f49('0x12')]='OpenchannelAccount';break;case _0x4f49('0x50'):_0x36187b['childModel']='SmsQueue';break;case _0x4f49('0x51'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x52');break;case'whatsappqueues':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x53');break;case'whatsappaccounts':_0x36187b[_0x4f49('0x12')]='WhatsappAccount';break;case _0x4f49('0x54'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x55');break;case'voicequeues':case _0x4f49('0x56'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x3d');if(_0x9d30aa){_0x36187b[_0x4f49('0x17')]=[{'name':_0x4f49('0x3b')},{'name':_0x4f49('0x40')}];}break;case _0x4f49('0x57'):case _0x4f49('0x58'):case _0x4f49('0x59'):_0x36187b[_0x4f49('0x12')]='User';if(_0x9d30aa){_0x36187b[_0x4f49('0x17')]=[{'name':_0x4f49('0x5a'),'filter':{'field':'role','value':[_0x4f49('0x5b'),'user']},'ignore':!![]},{'name':_0x4f49('0x34')},{'name':_0x4f49('0x38')}];}break;case _0x4f49('0x5c'):_0x36187b[_0x4f49('0x12')]='ZendeskAccount';break;case _0x4f49('0x5d'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x5e');break;case _0x4f49('0x5f'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x60');break;case _0x4f49('0x61'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x62');break;case _0x4f49('0x63'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x64');break;case _0x4f49('0x65'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x66');break;case _0x4f49('0x67'):_0x36187b['childModel']='User';break;case _0x4f49('0x68'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x69');break;case _0x4f49('0x6a'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x6b');break;case _0x4f49('0x6c'):_0x36187b['childModel']=_0x4f49('0x6d');break;case'intervals':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x6e');break;case _0x4f49('0x6f'):_0x36187b[_0x4f49('0x12')]='Pause';break;case _0x4f49('0x70'):_0x36187b['childModel']='Schedule';break;case _0x4f49('0x71'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x72');break;case _0x4f49('0x73'):_0x36187b['childModel']='Tag';break;case _0x4f49('0x74'):_0x36187b[_0x4f49('0x12')]='Template';break;case _0x4f49('0x75'):_0x36187b['childModel']='Trigger';break;case _0x4f49('0x76'):_0x36187b['childModel']=_0x4f49('0x77');break;case'variables':_0x36187b[_0x4f49('0x12')]=_0x4f49('0x78');break;case _0x4f49('0x79'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x7a');break;case _0x4f49('0x7b'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x10');_0x36187b['parentSections']=[{'name':_0x4f49('0x7c'),'field':'id','foreignKey':'reportId'}];break;case _0x4f49('0x7d'):_0x36187b[_0x4f49('0x12')]=_0x4f49('0x7e');break;}return _0x36187b;}function _0x467f12(_0x1981e0,_0xb7538c){var _0x553981=_0x1981e0[_0x4f49('0x7f')](0x0)[_0x4f49('0x80')]()+_0x1981e0['slice'](0x1);var _0x5d2b3c={'type':_0x423b25[_0x4f49('0x81')][_0x4f49('0x82')][_0x4f49('0x83')],'raw':!![]};return new Promise(function(_0x2409f1,_0x19a788){var _0x4af08d=squel[_0x4f49('0x84')]()['field'](_0x4f49('0x85')+_0x553981+_0x4f49('0x86'),'id')[_0x4f49('0xf')]('ui.createdAt')[_0x4f49('0x87')](_0x4f49('0x88')+_0x1981e0+_0x4f49('0x89'),'ui')[_0x4f49('0x8a')]('ui.UserId\x20=\x20?',_0xb7538c['id']);return _0x423b25[_0x4f49('0x8b')][_0x4f49('0x8c')](_0x4af08d['toString'](),_0x5d2b3c)[_0x4f49('0x8')](function(_0x17b15){_0xb7538c[_0x553981+_0x4f49('0x8d')]=_0x17b15;_0x2409f1(_0x17b15);})[_0x4f49('0xb')](function(_0x28ea73){_0x19a788(_0x28ea73);});});}return _0x1d54cc[_0x4f49('0x8e')](_0x4f49('0x8f'),attributes,{'tableName':_0x4f49('0x90'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x519721){var _0x468821={'raw':![],'where':{}};var _0x3566f2={};var _0x1e91a5={'count':0x0,'rows':[]};var _0x192b5a=_0x519721[_0x4f49('0x8c')][_0x4f49('0x91')];var _0x335875=_0x519721['query'][_0x4f49('0x92')]||![];var _0x50d1ad=_0x32ca7b(_0x192b5a,_0x335875);if(!_0x50d1ad[_0x4f49('0x12')])throw new Error(_0x4f49('0x93')+_0x192b5a+'\x27');var _0x4714c7=[{'name':_0x192b5a}];if(!_[_0x4f49('0x94')](_0x50d1ad[_0x4f49('0x17')]))_0x4714c7=_0x50d1ad[_0x4f49('0x17')];var _0x61a565=[];for(var _0x297698=0x0;_0x297698<_0x4714c7[_0x4f49('0x95')];_0x297698++){_0x61a565[_0x4f49('0x96')](_0x423b25['UserProfileSection'][_0x4f49('0x97')]({'where':{'userProfileId':_0x519721[_0x4f49('0x98')]['id'],'name':_0x4714c7[_0x297698][_0x4f49('0xd')]},'raw':!![]}));}return Promise[_0x4f49('0x99')](_0x61a565)['then'](function(_0x54c67b){var _0x28e8ae=_['filter'](_0x54c67b,function(_0x30defd){return _0x30defd?_0x30defd:undefined;});var _0x287705=_[_0x4f49('0x5')](_0x4714c7,[_0x4f49('0x9a'),!![]]);var _0x224c8d=_[_0x4f49('0x94')](_0x28e8ae)&&_[_0x4f49('0x94')](_0x287705)?null:_[_0x4f49('0x9b')](_0x287705,_0x28e8ae);if(!_0x224c8d)return null;var _0x3823f0=[];for(var _0x3e9b47=0x0;_0x3e9b47<_0x224c8d[_0x4f49('0x95')];_0x3e9b47++){var _0x1ba97e=_[_0x4f49('0x97')](_0x4714c7,function(_0xd53de8){return _0x224c8d[_0x3e9b47]?_0xd53de8[_0x4f49('0xd')]===_0x224c8d[_0x3e9b47][_0x4f49('0xd')]:null;});if(_0x1ba97e){if(_0x224c8d[_0x3e9b47][_0x4f49('0x9a')]){_0x3823f0[_0x4f49('0x96')](_0x20c0d7(_0x50d1ad[_0x4f49('0x12')],_0x224c8d[_0x3e9b47]));}else{if(!_0x224c8d[_0x3e9b47][_0x4f49('0x9c')]){_0x3823f0[_0x4f49('0x96')](_0x5bdfaf(_0x1ba97e,_0x224c8d[_0x3e9b47],_0x50d1ad[_0x4f49('0x12')]));}else{if(_0x1ba97e[_0x4f49('0xc')]){_0x3823f0[_0x4f49('0x96')](_0x3e464f(_0x1ba97e,_0x224c8d[_0x3e9b47]));}}}}}return Promise[_0x4f49('0x99')](_0x3823f0);})['then'](function(_0x3e9460){var _0x4ff0c1=_0x3e9460;var _0x31df7f=null;if(_0x4ff0c1){_0x31df7f=_0x4ff0c1[_0x4f49('0x95')]===0x1?_0x4ff0c1[0x0]:null;}if(!_0x31df7f&&!_0x4ff0c1)return _0x1e91a5;var _0x38fe50=_0x423b25[_0x50d1ad[_0x4f49('0x12')]][_0x4f49('0x9d')];_0x3566f2[_0x4f49('0xc')]=_[_0x4f49('0x9e')](_0x38fe50);_0x3566f2[_0x4f49('0x8c')]=_[_0x4f49('0x9e')](_0x519721['query']);_0x3566f2['filters']=_[_0x4f49('0x9f')](_0x3566f2['model'],_0x3566f2[_0x4f49('0x8c')]);_0x468821[_0x4f49('0xa0')]=_[_0x4f49('0x9f')](_0x3566f2[_0x4f49('0xc')],qs[_0x4f49('0xa1')](_0x519721['query']['fields']));_0x468821[_0x4f49('0xa0')]=_0x468821[_0x4f49('0xa0')]['length']?_0x468821[_0x4f49('0xa0')]:_0x3566f2[_0x4f49('0xc')];if(!_0x519721['query'][_0x4f49('0xa2')]('nolimit')){_0x468821[_0x4f49('0xa3')]=qs[_0x4f49('0xa3')](_0x519721['query'][_0x4f49('0xa3')]);_0x468821[_0x4f49('0xa4')]=qs[_0x4f49('0xa4')](_0x519721[_0x4f49('0x8c')][_0x4f49('0xa4')]);}_0x468821[_0x4f49('0xa5')]=qs['sort'](_0x519721[_0x4f49('0x8c')]['sort']);_0x468821[_0x4f49('0x8a')]=qs['filters'](_[_0x4f49('0xa6')](_0x519721['query'],_0x3566f2[_0x4f49('0xa7')]));if(_0x519721[_0x4f49('0x8c')][_0x4f49('0x5')]){_0x468821[_0x4f49('0x8a')]=_['merge'](_0x468821[_0x4f49('0x8a')],{'$or':_['map'](_0x38fe50,function(_0x5ddfe4){if(_0x5ddfe4['type'][_0x4f49('0xa8')]!=='VIRTUAL'){var _0x4938a6={};_0x4938a6[_0x5ddfe4[_0x4f49('0xf')]]={'$like':'%'+_0x519721[_0x4f49('0x8c')][_0x4f49('0x5')]+'%'};return _0x4938a6;}})});}var _0x4c0e7a=[];var _0x289810=null;var _0x431c15={};if(_0x31df7f){_0x289810=_['find'](_0x4714c7,['name',_0x31df7f['name']]);if(_0x289810[_0x4f49('0xf')]){_0x431c15={};if(_0x50d1ad[_0x4f49('0x12')]===_0x4f49('0x10')){_0x431c15[_0x289810[_0x4f49('0xa9')]]=_[_0x4f49('0xa')](_0x31df7f['associatedResources'],'id');}else{_0x431c15[_0x289810[_0x4f49('0xa9')]]=_0x31df7f[_0x4f49('0x9')];}_0x4c0e7a[_0x4f49('0x96')](_0x431c15);}else{_0x468821['where']['id']=_0x31df7f[_0x4f49('0x9')];}}else{for(var _0x34843a=0x0;_0x34843a<_0x4ff0c1[_0x4f49('0x95')];_0x34843a++){_0x289810=_[_0x4f49('0x97')](_0x4714c7,['name',_0x4ff0c1[_0x34843a][_0x4f49('0xd')]]);if(_0x289810[_0x4f49('0xf')]){_0x431c15={};_0x431c15[_0x289810[_0x4f49('0xa9')]]=_0x4ff0c1[_0x34843a][_0x4f49('0x9')];_0x4c0e7a[_0x4f49('0x96')](_0x431c15);}else{if(!_0x468821['where']['id'])_0x468821[_0x4f49('0x8a')]['id']=[];_0x4ff0c1[_0x34843a][_0x4f49('0x9')]['forEach'](function(_0x3eebc0){_0x468821['where']['id'][_0x4f49('0x96')](_0x3eebc0);});}}}if(!_['isEmpty'](_0x4c0e7a)){_0x468821[_0x4f49('0x8a')]=_[_0x4f49('0xaa')](_0x468821[_0x4f49('0x8a')],{'$and':{'$or':_0x4c0e7a}});}_0x468821=_[_0x4f49('0xaa')]({},_0x468821,_0x519721[_0x4f49('0xab')]);if(_0x31df7f&&!_0x31df7f['autoAssociation']&&_0x50d1ad[_0x4f49('0x12')]===_0x4f49('0x10')){if(_0x519721[_0x4f49('0x8c')][_0x4f49('0xac')]){_0x468821['include']=[{'all':!![]}];}return _0x423b25[_0x50d1ad[_0x4f49('0x12')]]['findAll'](_0x468821)[_0x4f49('0x8')](function(_0x59a5e9){var _0x3066ee=[];_0x59a5e9[_0x4f49('0xad')](function(_0x288f75){var _0x34fca3;switch(_0x288f75[_0x4f49('0xae')]){case _0x4f49('0xaf'):_0x34fca3=_[_0x4f49('0x97')](_0x31df7f[_0x4f49('0x9')],function(_0x3a26ff){return _0x3a26ff['id']===_0x288f75[_0x4f49('0xb0')]&&_0x3a26ff['type']===_0x4f49('0xb1');});break;case _0x4f49('0xb2'):_0x34fca3=_[_0x4f49('0x97')](_0x31df7f[_0x4f49('0x9')],function(_0x302861){return _0x302861['id']===_0x288f75[_0x4f49('0xb0')]&&_0x302861['type']===_0x4f49('0xb3');});break;}if(_0x34fca3)_0x3066ee[_0x4f49('0x96')](_0x288f75);});_0x1e91a5[_0x4f49('0xb4')]=_0x3066ee[_0x4f49('0x95')];_0x1e91a5['rows']=_0x3066ee;return _0x1e91a5;});}else{return _0x423b25[_0x50d1ad[_0x4f49('0x12')]]['count']({'where':_0x468821[_0x4f49('0x8a')]})[_0x4f49('0x8')](function(_0x5c5d2){_0x1e91a5[_0x4f49('0xb4')]=_0x5c5d2;if(_0x519721['query'][_0x4f49('0xac')]){if(_0x50d1ad[_0x4f49('0x12')]===_0x4f49('0x1c')){_0x468821[_0x4f49('0xb5')]=[{'model':_0x423b25[_0x4f49('0xb6')],'as':_0x4f49('0xb7'),'attributes':['id',_0x4f49('0xd'),_0x4f49('0xb8')],'required':_0x519721[_0x4f49('0x8c')][_0x4f49('0xb9')]?!![]:![]},{'model':_0x423b25[_0x4f49('0xb6')],'as':_0x4f49('0xba'),'attributes':['id',_0x4f49('0xd'),_0x4f49('0xb8')],'through':_0x519721[_0x4f49('0x8c')][_0x4f49('0xb9')]?{'attributes':[],'where':{'TagId':_0x519721[_0x4f49('0x8c')][_0x4f49('0xb9')]||undefined}}:{},'required':_0x519721['query'][_0x4f49('0xb9')]?!![]:![]}];}else{_0x468821[_0x4f49('0xb5')]=[{'all':!![]}];}}return _0x423b25[_0x50d1ad[_0x4f49('0x12')]][_0x4f49('0x7')](_0x468821);})['then'](function(_0x225e63){_0x1e91a5[_0x4f49('0xbb')]=_0x225e63;if(_0x192b5a==='Agents'&&_0x519721[_0x4f49('0x8c')]['openTabs']===_0x4f49('0xbc')){var _0x3bc245=[];for(var _0x1b6e82=0x0;_0x1b6e82<_0x1e91a5[_0x4f49('0xbb')][_0x4f49('0x95')];_0x1b6e82++){_0x3bc245[_0x4f49('0x96')](_0x467f12(_0x4f49('0xbd'),_0x1e91a5[_0x4f49('0xbb')][_0x1b6e82][_0x4f49('0xbe')]));_0x3bc245[_0x4f49('0x96')](_0x467f12('sms',_0x1e91a5['rows'][_0x1b6e82][_0x4f49('0xbe')]));_0x3bc245['push'](_0x467f12(_0x4f49('0xbf'),_0x1e91a5[_0x4f49('0xbb')][_0x1b6e82]['dataValues']));_0x3bc245['push'](_0x467f12(_0x4f49('0xc0'),_0x1e91a5['rows'][_0x1b6e82][_0x4f49('0xbe')]));_0x3bc245[_0x4f49('0x96')](_0x467f12(_0x4f49('0xc1'),_0x1e91a5['rows'][_0x1b6e82][_0x4f49('0xbe')]));_0x3bc245['push'](_0x467f12(_0x4f49('0xc2'),_0x1e91a5[_0x4f49('0xbb')][_0x1b6e82][_0x4f49('0xbe')]));}return Promise['all'](_0x3bc245)[_0x4f49('0x8')](function(){return _0x1e91a5;});}return _0x1e91a5;});}});}}});}; \ No newline at end of file +var _0x71ab=['whatsappaccounts','teams','Team','voicequeues','users','agents','telephones','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','dispositions','Disposition','customdashboards','intervals','Interval','pauses','scheduler','Sound','Tag','templates','Template','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','AnalyticExtractedReport','reportId','metrics','AnalyticMetric','toUpperCase','slice','Sequelize','QueryTypes','ui.','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','query','toString','OpenTabs','define','user_profiles','section','mergeResources','isEmpty','length','find','params','all','union','autoAssociation','push','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','merge','key','forEach','options','include','DefaultReports','CustomReports','count','rows','includeAll','color','ThroughTags','tag','openTabs','true','chat','dataValues','sms','mail','openchannel','whatsapp','./userProfile.attributes','squel','models','filter','field','value','findAll','then','associatedResources','catch','model','map','name','UserProfileResource','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceRecording','Agents','membername','User','agent','role','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','WhatsappQueue'];(function(_0x13baa8,_0x282499){var _0x2563f7=function(_0x4529ca){while(--_0x4529ca){_0x13baa8['push'](_0x13baa8['shift']());}};_0x2563f7(++_0x282499);}(_0x71ab,0x64));var _0xb71a=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x71ab[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var attributes=require(_0xb71a('0x0'));var qs=require('../../components/parsers/qs');var squel=require(_0xb71a('0x1'));module['exports']=function(_0x3e985a){var _0x3f0529=_0x3e985a[_0xb71a('0x2')];function _0x4094b2(_0x37ce74,_0x3c6438){return new Promise(function(_0x2192e8,_0x38d931){if(!_0x3c6438)return _0x2192e8(null);var _0x22c072=_0x3c6438[_0xb71a('0x3')]?{[_0x3c6438[_0xb71a('0x3')][_0xb71a('0x4')]]:_0x3c6438[_0xb71a('0x3')][_0xb71a('0x5')]}:undefined;return _0x3f0529[_0x37ce74][_0xb71a('0x6')]({'where':_0x22c072,'raw':!![]})[_0xb71a('0x7')](function(_0x378c96){_0x3c6438[_0xb71a('0x8')]=_['map'](_0x378c96,'id');_0x2192e8(_0x3c6438);})[_0xb71a('0x9')](function(_0x58956d){_0x38d931(_0x58956d);});});}function _0x3d7bd7(_0x343d2f,_0x24f5fd){return new Promise(function(_0x591311,_0x3909b4){var _0x4c167a=_0x343d2f[_0xb71a('0x3')]?{[_0x343d2f['filter']['field']]:_0x343d2f[_0xb71a('0x3')][_0xb71a('0x5')]}:undefined;return _0x3f0529[_0x343d2f[_0xb71a('0xa')]][_0xb71a('0x6')]({'where':_0x4c167a,'raw':!![]})['then'](function(_0x47ee48){_0x24f5fd['associatedResources']=_[_0xb71a('0xb')](_0x47ee48,function(_0xc189cd){return _0xc189cd[_0xb71a('0xc')];});_0x591311(_0x24f5fd);})[_0xb71a('0x9')](function(_0x3cd0f0){_0x3909b4(_0x3cd0f0);});});}function _0x1e9363(_0x31def2,_0x2ec64a,_0x7710a8){if(!_0x2ec64a)return Promise['resolve'](null);return new Promise(function(_0x1ca65e,_0x2d6369){return _0x3f0529[_0xb71a('0xd')][_0xb71a('0x6')]({'where':{'sectionId':_0x2ec64a['id']},'raw':!![]})[_0xb71a('0x7')](function(_0xf83e73){if(_0x31def2[_0xb71a('0x4')]&&_0x31def2[_0xb71a('0x4')]!=='id'){_0x2ec64a[_0xb71a('0x8')]=_[_0xb71a('0xb')](_0xf83e73,function(_0x16394a){return _0x16394a[_0x31def2['field']];});}else{if(_0x7710a8==='AnalyticExtractedReport'){_0x2ec64a[_0xb71a('0x8')]=_[_0xb71a('0xb')](_0xf83e73,function(_0x4a4f4e){return{'id':_0x4a4f4e['resourceId'],'type':_0x4a4f4e[_0xb71a('0xe')]};});}else{_0x2ec64a['associatedResources']=_[_0xb71a('0xb')](_0xf83e73,function(_0x4227c7){return _0x4227c7[_0xb71a('0xf')];});}}_0x1ca65e(_0x2ec64a);})[_0xb71a('0x9')](function(_0x38a728){_0x2d6369(_0x38a728);});});}function _0x14b2a1(_0x2f4fac,_0x14aac7){var _0x5f3f19={'parentSections':[]};switch(_0x2f4fac[_0xb71a('0x10')]()){case _0xb71a('0x11'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x13');break;case _0xb71a('0x14'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x15');break;case _0xb71a('0x16'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x17');_0x5f3f19[_0xb71a('0x18')]=[{'name':_0xb71a('0x19'),'field':_0xb71a('0xc'),'foreignKey':'projectName'}];break;case _0xb71a('0x1a'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x1b');break;case _0xb71a('0x1c'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x1d');_0x5f3f19[_0xb71a('0x18')]=[{'name':_0xb71a('0x1e'),'field':'id','foreignKey':_0xb71a('0x1f')}];break;case _0xb71a('0x20'):_0x5f3f19[_0xb71a('0x12')]='CmList';break;case'companies':_0x5f3f19[_0xb71a('0x12')]='CmCompany';break;case _0xb71a('0x21'):_0x5f3f19[_0xb71a('0x12')]='CmCustomField';break;case _0xb71a('0x22'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x23');break;case _0xb71a('0x24'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x25');break;case'faxqueues':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x26');break;case _0xb71a('0x27'):_0x5f3f19[_0xb71a('0x12')]='FaxAccount';break;case _0xb71a('0x28'):case _0xb71a('0x29'):case _0xb71a('0x2a'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x2b');break;case _0xb71a('0x2c'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x2d');break;case _0xb71a('0x2e'):_0x5f3f19[_0xb71a('0x12')]='VoiceMail';break;case'voicerecordings':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x2f');_0x5f3f19[_0xb71a('0x18')]=[{'name':_0xb71a('0x30'),'field':_0xb71a('0xc'),'foreignKey':_0xb71a('0x31'),'model':_0xb71a('0x32'),'filter':{'field':'role','value':[_0xb71a('0x33')]}},{'name':'Telephones','field':_0xb71a('0xc'),'foreignKey':_0xb71a('0x31'),'model':_0xb71a('0x32'),'filter':{'field':_0xb71a('0x34'),'value':['telephone']}},{'name':_0xb71a('0x35'),'field':_0xb71a('0xc'),'foreignKey':_0xb71a('0x36'),'model':_0xb71a('0x37'),'filter':{'field':_0xb71a('0xe'),'value':[_0xb71a('0x38')]}},{'name':_0xb71a('0x39'),'field':_0xb71a('0xc'),'foreignKey':_0xb71a('0x36'),'model':'VoiceQueue','filter':{'field':_0xb71a('0xe'),'value':['outbound']}}];break;case _0xb71a('0x3a'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x3b');break;case _0xb71a('0x3c'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x3d');break;case'voiceprefixes':_0x5f3f19['childModel']='VoicePrefix';break;case _0xb71a('0x3e'):_0x5f3f19['childModel']=_0xb71a('0x3f');break;case _0xb71a('0x40'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x41');break;case _0xb71a('0x42'):_0x5f3f19[_0xb71a('0x12')]='MailAccount';break;case _0xb71a('0x43'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x44');break;case _0xb71a('0x45'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x46');break;case'openchannelaccounts':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x47');break;case _0xb71a('0x48'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x49');break;case _0xb71a('0x4a'):_0x5f3f19[_0xb71a('0x12')]='SmsAccount';break;case'whatsappqueues':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x4b');break;case _0xb71a('0x4c'):_0x5f3f19[_0xb71a('0x12')]='WhatsappAccount';break;case _0xb71a('0x4d'):_0x5f3f19['childModel']=_0xb71a('0x4e');break;case _0xb71a('0x4f'):case'queuecampaigns':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x37');if(_0x14aac7){_0x5f3f19[_0xb71a('0x18')]=[{'name':_0xb71a('0x35')},{'name':'QueueCampaigns'}];}break;case _0xb71a('0x50'):case _0xb71a('0x51'):case _0xb71a('0x52'):_0x5f3f19['childModel']=_0xb71a('0x32');if(_0x14aac7){_0x5f3f19[_0xb71a('0x18')]=[{'name':_0xb71a('0x53'),'filter':{'field':'role','value':[_0xb71a('0x54'),_0xb71a('0x55')]},'ignore':!![]},{'name':_0xb71a('0x30')},{'name':_0xb71a('0x56')}];}break;case _0xb71a('0x57'):_0x5f3f19['childModel']=_0xb71a('0x58');break;case _0xb71a('0x59'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x5a');break;case'freshdeskaccounts':_0x5f3f19['childModel']=_0xb71a('0x5b');break;case _0xb71a('0x5c'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x5d');break;case _0xb71a('0x5e'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x5f');break;case _0xb71a('0x60'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x61');break;case'vtigeraccounts':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x32');break;case'cannedanswers':_0x5f3f19[_0xb71a('0x12')]='CannedAnswer';break;case _0xb71a('0x62'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x63');break;case _0xb71a('0x64'):_0x5f3f19[_0xb71a('0x12')]='Dashboard';break;case _0xb71a('0x65'):_0x5f3f19['childModel']=_0xb71a('0x66');break;case _0xb71a('0x67'):_0x5f3f19['childModel']='Pause';break;case _0xb71a('0x68'):_0x5f3f19[_0xb71a('0x12')]='Schedule';break;case'sounds':_0x5f3f19['childModel']=_0xb71a('0x69');break;case'tags':_0x5f3f19['childModel']=_0xb71a('0x6a');break;case _0xb71a('0x6b'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x6c');break;case'triggers':_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x6d');break;case _0xb71a('0x6e'):_0x5f3f19['childModel']=_0xb71a('0x6f');break;case _0xb71a('0x70'):_0x5f3f19['childModel']=_0xb71a('0x71');break;case _0xb71a('0x72'):_0x5f3f19[_0xb71a('0x12')]='Plugin';break;case _0xb71a('0x73'):_0x5f3f19['childModel']=_0xb71a('0x74');_0x5f3f19[_0xb71a('0x18')]=[{'name':'Reports','field':'id','foreignKey':_0xb71a('0x75')}];break;case _0xb71a('0x76'):_0x5f3f19[_0xb71a('0x12')]=_0xb71a('0x77');break;}return _0x5f3f19;}function _0x41a1fc(_0x3b6762,_0x3dfd97){var _0x535ab6=_0x3b6762['charAt'](0x0)[_0xb71a('0x78')]()+_0x3b6762[_0xb71a('0x79')](0x1);var _0x2cf6a3={'type':_0x3f0529[_0xb71a('0x7a')][_0xb71a('0x7b')]['SELECT'],'raw':!![]};return new Promise(function(_0x5a45df,_0x6ceada){var _0xc931ab=squel['select']()[_0xb71a('0x4')](_0xb71a('0x7c')+_0x535ab6+'InteractionId','id')[_0xb71a('0x4')](_0xb71a('0x7d'))[_0xb71a('0x7e')](_0xb71a('0x7f')+_0x3b6762+'_interactions','ui')[_0xb71a('0x80')](_0xb71a('0x81'),_0x3dfd97['id']);return _0x3f0529['sequelize'][_0xb71a('0x82')](_0xc931ab[_0xb71a('0x83')](),_0x2cf6a3)[_0xb71a('0x7')](function(_0x2881a3){_0x3dfd97[_0x535ab6+_0xb71a('0x84')]=_0x2881a3;_0x5a45df(_0x2881a3);})[_0xb71a('0x9')](function(_0x288862){_0x6ceada(_0x288862);});});}return _0x3e985a[_0xb71a('0x85')]('UserProfile',attributes,{'tableName':_0xb71a('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3a5431){var _0x526065={'raw':![],'where':{}};var _0x41fe0c={};var _0x2dbaa2={'count':0x0,'rows':[]};var _0x52fac6=_0x3a5431[_0xb71a('0x82')][_0xb71a('0x87')];var _0x10b715=_0x3a5431[_0xb71a('0x82')][_0xb71a('0x88')]||![];var _0x1c4160=_0x14b2a1(_0x52fac6,_0x10b715);if(!_0x1c4160['childModel'])throw new Error('Invalid\x20section\x20\x27'+_0x52fac6+'\x27');var _0x248c74=[{'name':_0x52fac6}];if(!_[_0xb71a('0x89')](_0x1c4160[_0xb71a('0x18')]))_0x248c74=_0x1c4160['parentSections'];var _0xe93fd=[];for(var _0x5e58f7=0x0;_0x5e58f7<_0x248c74[_0xb71a('0x8a')];_0x5e58f7++){_0xe93fd['push'](_0x3f0529['UserProfileSection'][_0xb71a('0x8b')]({'where':{'userProfileId':_0x3a5431[_0xb71a('0x8c')]['id'],'name':_0x248c74[_0x5e58f7][_0xb71a('0xc')]},'raw':!![]}));}return Promise[_0xb71a('0x8d')](_0xe93fd)[_0xb71a('0x7')](function(_0x4eca80){var _0x2b758b=_['filter'](_0x4eca80,function(_0x1adf18){return _0x1adf18?_0x1adf18:undefined;});var _0x312e46=_[_0xb71a('0x3')](_0x248c74,['ignore',!![]]);var _0x4d9dc8=_[_0xb71a('0x89')](_0x2b758b)&&_[_0xb71a('0x89')](_0x312e46)?null:_[_0xb71a('0x8e')](_0x312e46,_0x2b758b);if(!_0x4d9dc8)return null;var _0x3e2c72=[];for(var _0x9eff28=0x0;_0x9eff28<_0x4d9dc8['length'];_0x9eff28++){var _0x210fa0=_[_0xb71a('0x8b')](_0x248c74,function(_0x1063ab){return _0x4d9dc8[_0x9eff28]?_0x1063ab[_0xb71a('0xc')]===_0x4d9dc8[_0x9eff28][_0xb71a('0xc')]:null;});if(_0x210fa0){if(_0x4d9dc8[_0x9eff28]['ignore']){_0x3e2c72['push'](_0x4094b2(_0x1c4160[_0xb71a('0x12')],_0x4d9dc8[_0x9eff28]));}else{if(!_0x4d9dc8[_0x9eff28][_0xb71a('0x8f')]){_0x3e2c72[_0xb71a('0x90')](_0x1e9363(_0x210fa0,_0x4d9dc8[_0x9eff28],_0x1c4160[_0xb71a('0x12')]));}else{if(_0x210fa0[_0xb71a('0xa')]){_0x3e2c72[_0xb71a('0x90')](_0x3d7bd7(_0x210fa0,_0x4d9dc8[_0x9eff28]));}}}}}return Promise[_0xb71a('0x8d')](_0x3e2c72);})['then'](function(_0x45f4b2){var _0x27c15e=_0x45f4b2;var _0x55d263=null;if(_0x27c15e){_0x55d263=_0x27c15e[_0xb71a('0x8a')]===0x1?_0x27c15e[0x0]:null;}if(!_0x55d263&&!_0x27c15e)return _0x2dbaa2;var _0x20dc19=_0x3f0529[_0x1c4160[_0xb71a('0x12')]]['rawAttributes'];_0x41fe0c[_0xb71a('0xa')]=_[_0xb71a('0x91')](_0x20dc19);_0x41fe0c[_0xb71a('0x82')]=_['keys'](_0x3a5431[_0xb71a('0x82')]);_0x41fe0c[_0xb71a('0x92')]=_[_0xb71a('0x93')](_0x41fe0c[_0xb71a('0xa')],_0x41fe0c[_0xb71a('0x82')]);_0x526065[_0xb71a('0x94')]=_[_0xb71a('0x93')](_0x41fe0c[_0xb71a('0xa')],qs['fields'](_0x3a5431[_0xb71a('0x82')][_0xb71a('0x95')]));_0x526065[_0xb71a('0x94')]=_0x526065[_0xb71a('0x94')][_0xb71a('0x8a')]?_0x526065[_0xb71a('0x94')]:_0x41fe0c[_0xb71a('0xa')];if(!_0x3a5431['query'][_0xb71a('0x96')]('nolimit')){_0x526065[_0xb71a('0x97')]=qs[_0xb71a('0x97')](_0x3a5431['query'][_0xb71a('0x97')]);_0x526065['offset']=qs[_0xb71a('0x98')](_0x3a5431['query'][_0xb71a('0x98')]);}_0x526065[_0xb71a('0x99')]=qs[_0xb71a('0x9a')](_0x3a5431[_0xb71a('0x82')]['sort']);_0x526065[_0xb71a('0x80')]=qs[_0xb71a('0x92')](_['pick'](_0x3a5431[_0xb71a('0x82')],_0x41fe0c['filters']));if(_0x3a5431['query']['filter']){_0x526065['where']=_[_0xb71a('0x9b')](_0x526065[_0xb71a('0x80')],{'$or':_[_0xb71a('0xb')](_0x20dc19,function(_0x5554e8){if(_0x5554e8[_0xb71a('0xe')][_0xb71a('0x9c')]!=='VIRTUAL'){var _0x299349={};_0x299349[_0x5554e8[_0xb71a('0x4')]]={'$like':'%'+_0x3a5431[_0xb71a('0x82')][_0xb71a('0x3')]+'%'};return _0x299349;}})});}var _0x3209d3=[];var _0x16fbc1=null;var _0x537d00={};if(_0x55d263){_0x16fbc1=_[_0xb71a('0x8b')](_0x248c74,[_0xb71a('0xc'),_0x55d263[_0xb71a('0xc')]]);if(_0x16fbc1[_0xb71a('0x4')]){_0x537d00={};if(_0x1c4160[_0xb71a('0x12')]===_0xb71a('0x74')){_0x537d00[_0x16fbc1['foreignKey']]=_[_0xb71a('0xb')](_0x55d263[_0xb71a('0x8')],'id');}else{_0x537d00[_0x16fbc1['foreignKey']]=_0x55d263[_0xb71a('0x8')];}_0x3209d3[_0xb71a('0x90')](_0x537d00);}else{_0x526065[_0xb71a('0x80')]['id']=_0x55d263['associatedResources'];}}else{for(var _0x3ab7f5=0x0;_0x3ab7f5<_0x27c15e[_0xb71a('0x8a')];_0x3ab7f5++){_0x16fbc1=_[_0xb71a('0x8b')](_0x248c74,['name',_0x27c15e[_0x3ab7f5][_0xb71a('0xc')]]);if(_0x16fbc1[_0xb71a('0x4')]){_0x537d00={};_0x537d00[_0x16fbc1['foreignKey']]=_0x27c15e[_0x3ab7f5][_0xb71a('0x8')];_0x3209d3[_0xb71a('0x90')](_0x537d00);}else{if(!_0x526065[_0xb71a('0x80')]['id'])_0x526065[_0xb71a('0x80')]['id']=[];_0x27c15e[_0x3ab7f5]['associatedResources'][_0xb71a('0x9d')](function(_0x20cb10){_0x526065[_0xb71a('0x80')]['id'][_0xb71a('0x90')](_0x20cb10);});}}}if(!_['isEmpty'](_0x3209d3)){_0x526065[_0xb71a('0x80')]=_[_0xb71a('0x9b')](_0x526065['where'],{'$and':{'$or':_0x3209d3}});}_0x526065=_[_0xb71a('0x9b')]({},_0x526065,_0x3a5431[_0xb71a('0x9e')]);if(_0x55d263&&!_0x55d263['autoAssociation']&&_0x1c4160[_0xb71a('0x12')]===_0xb71a('0x74')){if(_0x3a5431[_0xb71a('0x82')]['includeAll']){_0x526065[_0xb71a('0x9f')]=[{'all':!![]}];}return _0x3f0529[_0x1c4160[_0xb71a('0x12')]][_0xb71a('0x6')](_0x526065)[_0xb71a('0x7')](function(_0x397e34){var _0xc552ac=[];_0x397e34[_0xb71a('0x9d')](function(_0x2e087e){var _0x19d364;switch(_0x2e087e['reportType']){case'default':_0x19d364=_[_0xb71a('0x8b')](_0x55d263[_0xb71a('0x8')],function(_0x4158ff){return _0x4158ff['id']===_0x2e087e[_0xb71a('0x75')]&&_0x4158ff[_0xb71a('0xe')]===_0xb71a('0xa0');});break;case'custom':_0x19d364=_[_0xb71a('0x8b')](_0x55d263['associatedResources'],function(_0x123323){return _0x123323['id']===_0x2e087e['reportId']&&_0x123323[_0xb71a('0xe')]===_0xb71a('0xa1');});break;}if(_0x19d364)_0xc552ac['push'](_0x2e087e);});_0x2dbaa2[_0xb71a('0xa2')]=_0xc552ac[_0xb71a('0x8a')];_0x2dbaa2[_0xb71a('0xa3')]=_0xc552ac;return _0x2dbaa2;});}else{return _0x3f0529[_0x1c4160[_0xb71a('0x12')]][_0xb71a('0xa2')]({'where':_0x526065['where']})[_0xb71a('0x7')](function(_0x3807e6){_0x2dbaa2['count']=_0x3807e6;if(_0x3a5431[_0xb71a('0x82')][_0xb71a('0xa4')]){if(_0x1c4160['childModel']===_0xb71a('0x1d')){_0x526065[_0xb71a('0x9f')]=[{'model':_0x3f0529[_0xb71a('0x6a')],'as':'Tags','attributes':['id',_0xb71a('0xc'),_0xb71a('0xa5')],'required':_0x3a5431[_0xb71a('0x82')]['tag']?!![]:![]},{'model':_0x3f0529[_0xb71a('0x6a')],'as':_0xb71a('0xa6'),'attributes':['id',_0xb71a('0xc'),_0xb71a('0xa5')],'through':_0x3a5431[_0xb71a('0x82')]['tag']?{'attributes':[],'where':{'TagId':_0x3a5431[_0xb71a('0x82')]['tag']||undefined}}:{},'required':_0x3a5431[_0xb71a('0x82')][_0xb71a('0xa7')]?!![]:![]}];}else{_0x526065[_0xb71a('0x9f')]=[{'all':!![]}];}}return _0x3f0529[_0x1c4160['childModel']]['findAll'](_0x526065);})[_0xb71a('0x7')](function(_0x13d2e0){_0x2dbaa2[_0xb71a('0xa3')]=_0x13d2e0;if(_0x52fac6===_0xb71a('0x30')&&_0x3a5431[_0xb71a('0x82')][_0xb71a('0xa8')]===_0xb71a('0xa9')){var _0x442ec0=[];for(var _0x24efc1=0x0;_0x24efc1<_0x2dbaa2[_0xb71a('0xa3')][_0xb71a('0x8a')];_0x24efc1++){_0x442ec0[_0xb71a('0x90')](_0x41a1fc(_0xb71a('0xaa'),_0x2dbaa2[_0xb71a('0xa3')][_0x24efc1][_0xb71a('0xab')]));_0x442ec0['push'](_0x41a1fc(_0xb71a('0xac'),_0x2dbaa2[_0xb71a('0xa3')][_0x24efc1][_0xb71a('0xab')]));_0x442ec0['push'](_0x41a1fc('fax',_0x2dbaa2['rows'][_0x24efc1][_0xb71a('0xab')]));_0x442ec0['push'](_0x41a1fc(_0xb71a('0xad'),_0x2dbaa2[_0xb71a('0xa3')][_0x24efc1]['dataValues']));_0x442ec0['push'](_0x41a1fc(_0xb71a('0xae'),_0x2dbaa2[_0xb71a('0xa3')][_0x24efc1][_0xb71a('0xab')]));_0x442ec0[_0xb71a('0x90')](_0x41a1fc(_0xb71a('0xaf'),_0x2dbaa2[_0xb71a('0xa3')][_0x24efc1][_0xb71a('0xab')]));}return Promise[_0xb71a('0x8d')](_0x442ec0)[_0xb71a('0x7')](function(){return _0x2dbaa2;});}return _0x2dbaa2;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 82cba3f..98f3c77 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 _0x61f1=['stringify','error','message','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0x61f1,0x18a));var _0x161f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x61f1[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x161f('0x0'));var moment=require('moment');var BPromise=require(_0x161f('0x1'));var rs=require(_0x161f('0x2'));var fs=require('fs');var Redis=require(_0x161f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x161f('0x4'))(_0x161f('0x5'));var config=require('../../config/environment');var jayson=require(_0x161f('0x6'));var client=jayson[_0x161f('0x7')][_0x161f('0x8')]({'port':0x232a});config[_0x161f('0x9')]=_[_0x161f('0xa')](config['redis'],{'host':_0x161f('0xb'),'port':0x18eb});var socket=require(_0x161f('0xc'))(new Redis(config[_0x161f('0x9')]));require(_0x161f('0xd'))[_0x161f('0xe')](socket);function respondWithRpcPromise(_0x224e14,_0xc5cce4,_0x374180){return new BPromise(function(_0x325f71,_0x27b914){return client[_0x161f('0xf')](_0x224e14,_0x374180)['then'](function(_0x43957b){logger[_0x161f('0x10')](_0x161f('0x11'),_0xc5cce4,_0x161f('0x12'));logger[_0x161f('0x13')]('UserProfile,\x20%s,\x20%s,\x20%s',_0xc5cce4,_0x161f('0x12'),JSON[_0x161f('0x14')](_0x43957b));if(_0x43957b[_0x161f('0x15')]){if(_0x43957b[_0x161f('0x15')]['code']===0x1f4){logger[_0x161f('0x15')](_0x161f('0x11'),_0xc5cce4,_0x43957b[_0x161f('0x15')][_0x161f('0x16')]);return _0x27b914(_0x43957b[_0x161f('0x15')][_0x161f('0x16')]);}logger['error']('UserProfile,\x20%s,\x20%s',_0xc5cce4,_0x43957b[_0x161f('0x15')][_0x161f('0x16')]);return _0x325f71(_0x43957b[_0x161f('0x15')]['message']);}else{logger[_0x161f('0x10')](_0x161f('0x11'),_0xc5cce4,_0x161f('0x12'));_0x325f71(_0x43957b['result'][_0x161f('0x16')]);}})['catch'](function(_0x1eb321){logger[_0x161f('0x15')](_0x161f('0x11'),_0xc5cce4,_0x1eb321);_0x27b914(_0x1eb321);});});} \ No newline at end of file +var _0x4991=['localhost','socket.io-emitter','./userProfile.socket','then','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','UserProfile,\x20%s,\x20%s','info','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x40576b,_0x280b79){var _0x39d545=function(_0x3d6c28){while(--_0x3d6c28){_0x40576b['push'](_0x40576b['shift']());}};_0x39d545(++_0x280b79);}(_0x4991,0xf7));var _0x1499=function(_0x427667,_0x242b92){_0x427667=_0x427667-0x0;var _0x4778bf=_0x4991[_0x427667];return _0x4778bf;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var moment=require(_0x1499('0x1'));var BPromise=require('bluebird');var rs=require(_0x1499('0x2'));var fs=require('fs');var Redis=require(_0x1499('0x3'));var db=require(_0x1499('0x4'))['db'];var utils=require(_0x1499('0x5'));var logger=require(_0x1499('0x6'))(_0x1499('0x7'));var config=require(_0x1499('0x8'));var jayson=require(_0x1499('0x9'));var client=jayson['client'][_0x1499('0xa')]({'port':0x232a});config[_0x1499('0xb')]=_[_0x1499('0xc')](config[_0x1499('0xb')],{'host':_0x1499('0xd'),'port':0x18eb});var socket=require(_0x1499('0xe'))(new Redis(config[_0x1499('0xb')]));require(_0x1499('0xf'))['register'](socket);function respondWithRpcPromise(_0x16e8ad,_0x36a053,_0x575251){return new BPromise(function(_0x2a4816,_0x352180){return client['request'](_0x16e8ad,_0x575251)[_0x1499('0x10')](function(_0x2867b1){logger['info']('UserProfile,\x20%s,\x20%s',_0x36a053,'request\x20sent');logger[_0x1499('0x11')](_0x1499('0x12'),_0x36a053,_0x1499('0x13'),JSON[_0x1499('0x14')](_0x2867b1));if(_0x2867b1[_0x1499('0x15')]){if(_0x2867b1['error']['code']===0x1f4){logger[_0x1499('0x15')]('UserProfile,\x20%s,\x20%s',_0x36a053,_0x2867b1[_0x1499('0x15')][_0x1499('0x16')]);return _0x352180(_0x2867b1[_0x1499('0x15')][_0x1499('0x16')]);}logger['error'](_0x1499('0x17'),_0x36a053,_0x2867b1[_0x1499('0x15')]['message']);return _0x2a4816(_0x2867b1[_0x1499('0x15')][_0x1499('0x16')]);}else{logger[_0x1499('0x18')](_0x1499('0x17'),_0x36a053,_0x1499('0x13'));_0x2a4816(_0x2867b1[_0x1499('0x19')]['message']);}})['catch'](function(_0x5bcb5f){logger[_0x1499('0x15')](_0x1499('0x17'),_0x36a053,_0x5bcb5f);_0x352180(_0x5bcb5f);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 5cae58c..10a428f 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 _0xb61e=['emit','register','userProfile:','./userProfile.events','save','update'];(function(_0x18ec44,_0x5a358f){var _0x150428=function(_0x2f0e90){while(--_0x2f0e90){_0x18ec44['push'](_0x18ec44['shift']());}};_0x150428(++_0x5a358f);}(_0xb61e,0x1e9));var _0xeb61=function(_0x146484,_0x27a7f0){_0x146484=_0x146484-0x0;var _0x4c7aa3=_0xb61e[_0x146484];return _0x4c7aa3;};'use strict';var UserProfileEvents=require(_0xeb61('0x0'));var events=[_0xeb61('0x1'),'remove',_0xeb61('0x2')];function createListener(_0x21e2c5,_0x1369a1){return function(_0x1f8f17){_0x1369a1[_0xeb61('0x3')](_0x21e2c5,_0x1f8f17);};}function removeListener(_0x29dab6,_0x2ff628){return function(){UserProfileEvents['removeListener'](_0x29dab6,_0x2ff628);};}exports[_0xeb61('0x4')]=function(_0x4ff1ab){for(var _0x11ecf1=0x0,_0xf3ab76=events['length'];_0x11ecf1<_0xf3ab76;_0x11ecf1++){var _0xb54e9b=events[_0x11ecf1];var _0x56c30f=createListener(_0xeb61('0x5')+_0xb54e9b,_0x4ff1ab);UserProfileEvents['on'](_0xb54e9b,_0x56c30f);}}; \ No newline at end of file +var _0x72ad=['emit','removeListener','register','length','userProfile:','remove','update'];(function(_0xe336e0,_0x18f796){var _0x19d2c6=function(_0x3778e1){while(--_0x3778e1){_0xe336e0['push'](_0xe336e0['shift']());}};_0x19d2c6(++_0x18f796);}(_0x72ad,0x17f));var _0xd72a=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x72ad[_0x2bf141];return _0x48277b;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save',_0xd72a('0x0'),_0xd72a('0x1')];function createListener(_0x27ead5,_0x3bc74a){return function(_0x14cb66){_0x3bc74a[_0xd72a('0x2')](_0x27ead5,_0x14cb66);};}function removeListener(_0x4f6f18,_0x3bb901){return function(){UserProfileEvents[_0xd72a('0x3')](_0x4f6f18,_0x3bb901);};}exports[_0xd72a('0x4')]=function(_0x3371db){for(var _0x51edf4=0x0,_0x37792d=events[_0xd72a('0x5')];_0x51edf4<_0x37792d;_0x51edf4++){var _0x492d3b=events[_0x51edf4];var _0xa8cf5c=createListener(_0xd72a('0x6')+_0x492d3b,_0x3371db);UserProfileEvents['on'](_0x492d3b,_0xa8cf5c);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 2577583..e8646e4 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 _0x69f4=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','exports','multer'];(function(_0x4d8536,_0x2acb73){var _0x496b14=function(_0x79d06f){while(--_0x79d06f){_0x4d8536['push'](_0x4d8536['shift']());}};_0x496b14(++_0x2acb73);}(_0x69f4,0xbd));var _0x469f=function(_0x3c8499,_0x1e052e){_0x3c8499=_0x3c8499-0x0;var _0x51d346=_0x69f4[_0x3c8499];return _0x51d346;};'use strict';var multer=require(_0x469f('0x0'));var util=require(_0x469f('0x1'));var path=require(_0x469f('0x2'));var timeout=require(_0x469f('0x3'));var express=require(_0x469f('0x4'));var router=express['Router']();var fs_extra=require(_0x469f('0x5'));var auth=require(_0x469f('0x6'));var interaction=require(_0x469f('0x7'));var config=require('../../config/environment');var controller=require(_0x469f('0x8'));router[_0x469f('0x9')]('/',auth[_0x469f('0xa')](),controller[_0x469f('0xb')]);router['get'](_0x469f('0xc'),auth[_0x469f('0xa')](),controller[_0x469f('0xd')]);router['get'](_0x469f('0xe'),auth[_0x469f('0xa')](),controller['show']);router[_0x469f('0xf')]('/',auth['isAuthenticated'](),controller[_0x469f('0x10')]);router[_0x469f('0x11')](_0x469f('0xe'),auth[_0x469f('0xa')](),controller['update']);router['delete'](_0x469f('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x469f('0x12')]=router; \ No newline at end of file +var _0xfe4e=['./userProfileResource.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3cc1f9,_0x40b20b){var _0x12c5ef=function(_0x4dfb76){while(--_0x4dfb76){_0x3cc1f9['push'](_0x3cc1f9['shift']());}};_0x12c5ef(++_0x40b20b);}(_0xfe4e,0x133));var _0xefe4=function(_0x6b2da4,_0x43f671){_0x6b2da4=_0x6b2da4-0x0;var _0x2d7955=_0xfe4e[_0x6b2da4];return _0x2d7955;};'use strict';var multer=require(_0xefe4('0x0'));var util=require('util');var path=require(_0xefe4('0x1'));var timeout=require(_0xefe4('0x2'));var express=require(_0xefe4('0x3'));var router=express['Router']();var fs_extra=require(_0xefe4('0x4'));var auth=require(_0xefe4('0x5'));var interaction=require(_0xefe4('0x6'));var config=require(_0xefe4('0x7'));var controller=require(_0xefe4('0x8'));router['get']('/',auth[_0xefe4('0x9')](),controller[_0xefe4('0xa')]);router[_0xefe4('0xb')](_0xefe4('0xc'),auth[_0xefe4('0x9')](),controller[_0xefe4('0xd')]);router['get'](_0xefe4('0xe'),auth[_0xefe4('0x9')](),controller['show']);router[_0xefe4('0xf')]('/',auth[_0xefe4('0x9')](),controller[_0xefe4('0x10')]);router[_0xefe4('0x11')](_0xefe4('0xe'),auth['isAuthenticated'](),controller[_0xefe4('0x12')]);router[_0xefe4('0x13')](_0xefe4('0xe'),auth[_0xefe4('0x9')](),controller['destroy']);module[_0xefe4('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 1bd79fb..3cd71d6 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 _0x038e=['STRING','INTEGER','sequelize','exports'];(function(_0x98d42a,_0x1face8){var _0x3d5b55=function(_0x14809c){while(--_0x14809c){_0x98d42a['push'](_0x98d42a['shift']());}};_0x3d5b55(++_0x1face8);}(_0x038e,0x102));var _0xe038=function(_0x14ba89,_0x3a7e5c){_0x14ba89=_0x14ba89-0x0;var _0x5ace4=_0x038e[_0x14ba89];return _0x5ace4;};'use strict';var Sequelize=require(_0xe038('0x0'));module[_0xe038('0x1')]={'name':{'type':Sequelize[_0xe038('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xe038('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xe038('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xe02e=['STRING','INTEGER','sequelize','exports'];(function(_0x2d1522,_0x19de47){var _0x8fec5d=function(_0x3ac70a){while(--_0x3ac70a){_0x2d1522['push'](_0x2d1522['shift']());}};_0x8fec5d(++_0x19de47);}(_0xe02e,0x112));var _0xee02=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xe02e[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0xee02('0x0'));module[_0xee02('0x1')]={'name':{'type':Sequelize[_0xee02('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xee02('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xee02('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 c510faa..7f017d8 100644 --- a/server/api/userProfileResource/userProfileResource.controller.js +++ b/server/api/userProfileResource/userProfileResource.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2542=['json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x2b2410,_0xb7b3){var _0x2598f7=function(_0x46e7bf){while(--_0x46e7bf){_0x2b2410['push'](_0x2b2410['shift']());}};_0x2598f7(++_0xb7b3);}(_0x2542,0x169));var _0x2254=function(_0x31732b,_0x4c6eab){_0x31732b=_0x31732b-0x0;var _0x1500e2=_0x2542[_0x31732b];return _0x1500e2;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];function respondWithStatusCode(_0x116b70,_0xdcb670){_0xdcb670=_0xdcb670||0xcc;return function(_0x3c326b){if(_0x3c326b){return _0x116b70[_0x2254('0x1a')](_0xdcb670);}return _0x116b70['status'](_0xdcb670)[_0x2254('0x1b')]();};}function respondWithResult(_0x7c7ab0,_0x504749){_0x504749=_0x504749||0xc8;return function(_0x2f4de){if(_0x2f4de){return _0x7c7ab0[_0x2254('0x1c')](_0x504749)[_0x2254('0x1d')](_0x2f4de);}};}function respondWithFilteredResult(_0x145272,_0x26285a){return function(_0xbc5548){if(_0xbc5548){var _0x50f137=typeof _0x26285a[_0x2254('0x1e')]==='undefined'&&typeof _0x26285a[_0x2254('0x1f')]===_0x2254('0x20');var _0x170ffa=_0xbc5548[_0x2254('0x21')];var _0x1ae11e=_0x50f137?0x0:_0x26285a[_0x2254('0x1e')];var _0x497724=_0x50f137?_0xbc5548['count']:_0x26285a['offset']+_0x26285a[_0x2254('0x1f')];var _0x3a79f8;if(_0x497724>=_0x170ffa){_0x497724=_0x170ffa;_0x3a79f8=0xc8;}else{_0x3a79f8=0xce;}_0x145272[_0x2254('0x1c')](_0x3a79f8);return _0x145272[_0x2254('0x22')](_0x2254('0x23'),_0x1ae11e+'-'+_0x497724+'/'+_0x170ffa)[_0x2254('0x1d')](_0xbc5548);}return null;};}function patchUpdates(_0x487f72){return function(_0x28381e){try{jsonpatch[_0x2254('0x24')](_0x28381e,_0x487f72,!![]);}catch(_0x906cde){return BPromise['reject'](_0x906cde);}return _0x28381e['save']();};}function saveUpdates(_0x5bd982,_0x1e8a98){return function(_0x559af4){if(_0x559af4){return _0x559af4[_0x2254('0x25')](_0x5bd982)['then'](function(_0x5713e4){return _0x5713e4;});}return null;};}function removeEntity(_0x4d8faf,_0x540020){return function(_0x5e5edb){if(_0x5e5edb){return _0x5e5edb['destroy']()[_0x2254('0x26')](function(){_0x4d8faf[_0x2254('0x1c')](0xcc)[_0x2254('0x1b')]();});}};}function handleEntityNotFound(_0x265467,_0x13522d){return function(_0x1349c9){if(!_0x1349c9){_0x265467['sendStatus'](0x194);}return _0x1349c9;};}function handleError(_0x4a8274,_0x1ada42){_0x1ada42=_0x1ada42||0x1f4;return function(_0x4f6877){logger[_0x2254('0x27')](_0x4f6877[_0x2254('0x28')]);if(_0x4f6877[_0x2254('0x29')]){delete _0x4f6877[_0x2254('0x29')];}_0x4a8274[_0x2254('0x1c')](_0x1ada42)['send'](_0x4f6877);};}exports[_0x2254('0x2a')]=function(_0x2a789b,_0x21285d){var _0x37af8b={},_0x13366a={},_0x377c41={'count':0x0,'rows':[]};var _0x3214a7=_[_0x2254('0x2b')](db[_0x2254('0x2c')][_0x2254('0x2d')],function(_0x21c641){return{'name':_0x21c641[_0x2254('0x2e')],'type':_0x21c641[_0x2254('0x2f')][_0x2254('0x30')]};});_0x13366a[_0x2254('0x31')]=_[_0x2254('0x2b')](_0x3214a7,_0x2254('0x29'));_0x13366a[_0x2254('0x32')]=_[_0x2254('0x33')](_0x2a789b['query']);_0x13366a[_0x2254('0x34')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],_0x13366a[_0x2254('0x32')]);_0x37af8b[_0x2254('0x36')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],qs[_0x2254('0x37')](_0x2a789b[_0x2254('0x32')]['fields']));_0x37af8b[_0x2254('0x36')]=_0x37af8b[_0x2254('0x36')]['length']?_0x37af8b[_0x2254('0x36')]:_0x13366a[_0x2254('0x31')];if(!_0x2a789b[_0x2254('0x32')][_0x2254('0x38')]('nolimit')){_0x37af8b['limit']=qs[_0x2254('0x1f')](_0x2a789b['query'][_0x2254('0x1f')]);_0x37af8b[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0x2a789b[_0x2254('0x32')][_0x2254('0x1e')]);}_0x37af8b[_0x2254('0x39')]=qs[_0x2254('0x3a')](_0x2a789b['query'][_0x2254('0x3a')]);_0x37af8b[_0x2254('0x3b')]=qs[_0x2254('0x34')](_[_0x2254('0x3c')](_0x2a789b[_0x2254('0x32')],_0x13366a[_0x2254('0x34')]),_0x3214a7);if(_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]){_0x37af8b[_0x2254('0x3b')]=_[_0x2254('0x3e')](_0x37af8b['where'],{'$or':_[_0x2254('0x2b')](_0x3214a7,function(_0xde3e4a){if(_0xde3e4a[_0x2254('0x2f')]!==_0x2254('0x3f')){var _0x4c7cc3={};_0x4c7cc3[_0xde3e4a[_0x2254('0x29')]]={'$like':'%'+_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]+'%'};return _0x4c7cc3;}})});}_0x37af8b=_[_0x2254('0x3e')]({},_0x37af8b,_0x2a789b[_0x2254('0x40')]);var _0x2602db={'where':_0x37af8b[_0x2254('0x3b')]};return db[_0x2254('0x2c')]['count'](_0x2602db)[_0x2254('0x26')](function(_0x5c15d7){_0x377c41[_0x2254('0x21')]=_0x5c15d7;if(_0x2a789b[_0x2254('0x32')][_0x2254('0x41')]){_0x37af8b[_0x2254('0x42')]=[{'all':!![]}];}return db[_0x2254('0x2c')][_0x2254('0x43')](_0x37af8b);})[_0x2254('0x26')](function(_0x568ec9){_0x377c41[_0x2254('0x44')]=_0x568ec9;return _0x377c41;})[_0x2254('0x26')](respondWithFilteredResult(_0x21285d,_0x37af8b))[_0x2254('0x45')](handleError(_0x21285d,null));};exports[_0x2254('0x46')]=function(_0x40d4da,_0x57cda2){var _0x22bb98={'raw':![],'where':{'id':_0x40d4da[_0x2254('0x47')]['id']}},_0x1dec43={};_0x1dec43[_0x2254('0x31')]=_[_0x2254('0x33')](db['UserProfileResource'][_0x2254('0x2d')]);_0x1dec43['query']=_[_0x2254('0x33')](_0x40d4da[_0x2254('0x32')]);_0x1dec43[_0x2254('0x34')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],_0x1dec43[_0x2254('0x32')]);_0x22bb98[_0x2254('0x36')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],qs[_0x2254('0x37')](_0x40d4da[_0x2254('0x32')][_0x2254('0x37')]));_0x22bb98[_0x2254('0x36')]=_0x22bb98['attributes'][_0x2254('0x48')]?_0x22bb98[_0x2254('0x36')]:_0x1dec43[_0x2254('0x31')];if(_0x40d4da['query'][_0x2254('0x41')]){_0x22bb98[_0x2254('0x42')]=[{'all':!![]}];}_0x22bb98=_[_0x2254('0x3e')]({},_0x22bb98,_0x40d4da[_0x2254('0x40')]);return db[_0x2254('0x2c')][_0x2254('0x49')](_0x22bb98)[_0x2254('0x26')](handleEntityNotFound(_0x57cda2,null))[_0x2254('0x26')](respondWithResult(_0x57cda2,null))[_0x2254('0x45')](handleError(_0x57cda2,null));};exports['create']=function(_0x239ba0,_0x405eb2){return db[_0x2254('0x2c')][_0x2254('0x4a')](_0x239ba0[_0x2254('0x4b')],{})[_0x2254('0x26')](respondWithResult(_0x405eb2,0xc9))[_0x2254('0x45')](handleError(_0x405eb2,null));};exports[_0x2254('0x25')]=function(_0x3ac691,_0xa103ea){if(_0x3ac691['body']['id']){delete _0x3ac691[_0x2254('0x4b')]['id'];}return db[_0x2254('0x2c')]['find']({'where':{'id':_0x3ac691[_0x2254('0x47')]['id']}})[_0x2254('0x26')](handleEntityNotFound(_0xa103ea,null))[_0x2254('0x26')](saveUpdates(_0x3ac691[_0x2254('0x4b')],null))['then'](respondWithResult(_0xa103ea,null))[_0x2254('0x45')](handleError(_0xa103ea,null));};exports[_0x2254('0x4c')]=function(_0x4d2c96,_0x26d01a){return db[_0x2254('0x2c')][_0x2254('0x49')]({'where':{'id':_0x4d2c96[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x26d01a,null))[_0x2254('0x26')](removeEntity(_0x26d01a,null))[_0x2254('0x45')](handleError(_0x26d01a,null));};exports[_0x2254('0x4d')]=function(_0x4ba6ef,_0x4cc18a){return db[_0x2254('0x2c')][_0x2254('0x4d')]()['then'](respondWithResult(_0x4cc18a,null))[_0x2254('0x45')](handleError(_0x4cc18a,null));}; \ No newline at end of file +var _0x6343=['VIRTUAL','options','UserProfileResource','then','rows','catch','show','params','keys','includeAll','include','create','body','find','describe','zip-dir','fast-json-patch','util','path','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','stack','send','map','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filter','merge'];(function(_0x144b30,_0x77072d){var _0x1bb7bc=function(_0x1082cc){while(--_0x1082cc){_0x144b30['push'](_0x144b30['shift']());}};_0x1bb7bc(++_0x77072d);}(_0x6343,0x168));var _0x3634=function(_0x45c5e3,_0x24c1ab){_0x45c5e3=_0x45c5e3-0x0;var _0x5eec77=_0x6343[_0x45c5e3];return _0x5eec77;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3634('0x0'));var jsonpatch=require(_0x3634('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3634('0x2'));var path=require(_0x3634('0x3'));var sox=require('sox');var csv=require(_0x3634('0x4'));var ejs=require(_0x3634('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3634('0x6'));var squel=require(_0x3634('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3634('0x8'));var toCsv=require(_0x3634('0x4'));var querystring=require(_0x3634('0x9'));var Papa=require(_0x3634('0xa'));var Redis=require(_0x3634('0xb'));var authService=require(_0x3634('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3634('0xd'));var logger=require(_0x3634('0xe'))('api');var utils=require(_0x3634('0xf'));var config=require(_0x3634('0x10'));var licenseUtil=require(_0x3634('0x11'));var db=require(_0x3634('0x12'))['db'];function respondWithStatusCode(_0x1e6a04,_0x151c8c){_0x151c8c=_0x151c8c||0xcc;return function(_0x35ae07){if(_0x35ae07){return _0x1e6a04[_0x3634('0x13')](_0x151c8c);}return _0x1e6a04[_0x3634('0x14')](_0x151c8c)[_0x3634('0x15')]();};}function respondWithResult(_0x299e53,_0x71d09b){_0x71d09b=_0x71d09b||0xc8;return function(_0x7e4801){if(_0x7e4801){return _0x299e53[_0x3634('0x14')](_0x71d09b)['json'](_0x7e4801);}};}function respondWithFilteredResult(_0x167247,_0x48787f){return function(_0x69609d){if(_0x69609d){var _0x18285c=typeof _0x48787f[_0x3634('0x16')]===_0x3634('0x17')&&typeof _0x48787f[_0x3634('0x18')]==='undefined';var _0x3121a3=_0x69609d['count'];var _0x50350d=_0x18285c?0x0:_0x48787f[_0x3634('0x16')];var _0x4b2115=_0x18285c?_0x69609d[_0x3634('0x19')]:_0x48787f[_0x3634('0x16')]+_0x48787f[_0x3634('0x18')];var _0x5603d2;if(_0x4b2115>=_0x3121a3){_0x4b2115=_0x3121a3;_0x5603d2=0xc8;}else{_0x5603d2=0xce;}_0x167247[_0x3634('0x14')](_0x5603d2);return _0x167247[_0x3634('0x1a')]('Content-Range',_0x50350d+'-'+_0x4b2115+'/'+_0x3121a3)[_0x3634('0x1b')](_0x69609d);}return null;};}function patchUpdates(_0x506281){return function(_0x742e56){try{jsonpatch[_0x3634('0x1c')](_0x742e56,_0x506281,!![]);}catch(_0x5b77a7){return BPromise[_0x3634('0x1d')](_0x5b77a7);}return _0x742e56[_0x3634('0x1e')]();};}function saveUpdates(_0x206c8e,_0x505026){return function(_0x22b7ef){if(_0x22b7ef){return _0x22b7ef[_0x3634('0x1f')](_0x206c8e)['then'](function(_0x3936ee){return _0x3936ee;});}return null;};}function removeEntity(_0x596acb,_0x5e9188){return function(_0x3a8c41){if(_0x3a8c41){return _0x3a8c41[_0x3634('0x20')]()['then'](function(){_0x596acb[_0x3634('0x14')](0xcc)[_0x3634('0x15')]();});}};}function handleEntityNotFound(_0x17db44,_0x225ddc){return function(_0x363ca2){if(!_0x363ca2){_0x17db44[_0x3634('0x13')](0x194);}return _0x363ca2;};}function handleError(_0x38e863,_0x4762b1){_0x4762b1=_0x4762b1||0x1f4;return function(_0x22f1f1){logger['error'](_0x22f1f1[_0x3634('0x21')]);if(_0x22f1f1['name']){delete _0x22f1f1['name'];}_0x38e863['status'](_0x4762b1)[_0x3634('0x22')](_0x22f1f1);};}exports['index']=function(_0x3bf28b,_0x12b80e){var _0x49804f={},_0x55a77f={},_0x282f73={'count':0x0,'rows':[]};var _0x5bd4e0=_[_0x3634('0x23')](db['UserProfileResource'][_0x3634('0x24')],function(_0x3d7322){return{'name':_0x3d7322[_0x3634('0x25')],'type':_0x3d7322[_0x3634('0x26')][_0x3634('0x27')]};});_0x55a77f[_0x3634('0x28')]=_[_0x3634('0x23')](_0x5bd4e0,_0x3634('0x29'));_0x55a77f['query']=_['keys'](_0x3bf28b['query']);_0x55a77f[_0x3634('0x2a')]=_['intersection'](_0x55a77f[_0x3634('0x28')],_0x55a77f[_0x3634('0x2b')]);_0x49804f[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x55a77f[_0x3634('0x28')],qs[_0x3634('0x2e')](_0x3bf28b['query'][_0x3634('0x2e')]));_0x49804f[_0x3634('0x2c')]=_0x49804f[_0x3634('0x2c')][_0x3634('0x2f')]?_0x49804f[_0x3634('0x2c')]:_0x55a77f[_0x3634('0x28')];if(!_0x3bf28b[_0x3634('0x2b')][_0x3634('0x30')](_0x3634('0x31'))){_0x49804f['limit']=qs[_0x3634('0x18')](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x18')]);_0x49804f[_0x3634('0x16')]=qs['offset'](_0x3bf28b[_0x3634('0x2b')][_0x3634('0x16')]);}_0x49804f[_0x3634('0x32')]=qs['sort'](_0x3bf28b['query']['sort']);_0x49804f[_0x3634('0x33')]=qs[_0x3634('0x2a')](_['pick'](_0x3bf28b[_0x3634('0x2b')],_0x55a77f[_0x3634('0x2a')]),_0x5bd4e0);if(_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]){_0x49804f[_0x3634('0x33')]=_[_0x3634('0x35')](_0x49804f[_0x3634('0x33')],{'$or':_['map'](_0x5bd4e0,function(_0x416987){if(_0x416987['type']!==_0x3634('0x36')){var _0x3ae966={};_0x3ae966[_0x416987[_0x3634('0x29')]]={'$like':'%'+_0x3bf28b[_0x3634('0x2b')][_0x3634('0x34')]+'%'};return _0x3ae966;}})});}_0x49804f=_['merge']({},_0x49804f,_0x3bf28b[_0x3634('0x37')]);var _0x33af29={'where':_0x49804f[_0x3634('0x33')]};return db[_0x3634('0x38')][_0x3634('0x19')](_0x33af29)[_0x3634('0x39')](function(_0x28c8d0){_0x282f73[_0x3634('0x19')]=_0x28c8d0;if(_0x3bf28b[_0x3634('0x2b')]['includeAll']){_0x49804f['include']=[{'all':!![]}];}return db[_0x3634('0x38')]['findAll'](_0x49804f);})['then'](function(_0x5948db){_0x282f73[_0x3634('0x3a')]=_0x5948db;return _0x282f73;})['then'](respondWithFilteredResult(_0x12b80e,_0x49804f))[_0x3634('0x3b')](handleError(_0x12b80e,null));};exports[_0x3634('0x3c')]=function(_0x53c1ea,_0x505be7){var _0x4896ab={'raw':![],'where':{'id':_0x53c1ea[_0x3634('0x3d')]['id']}},_0x324970={};_0x324970['model']=_[_0x3634('0x3e')](db[_0x3634('0x38')][_0x3634('0x24')]);_0x324970[_0x3634('0x2b')]=_[_0x3634('0x3e')](_0x53c1ea['query']);_0x324970['filters']=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],_0x324970[_0x3634('0x2b')]);_0x4896ab[_0x3634('0x2c')]=_[_0x3634('0x2d')](_0x324970[_0x3634('0x28')],qs['fields'](_0x53c1ea[_0x3634('0x2b')][_0x3634('0x2e')]));_0x4896ab[_0x3634('0x2c')]=_0x4896ab['attributes']['length']?_0x4896ab[_0x3634('0x2c')]:_0x324970[_0x3634('0x28')];if(_0x53c1ea[_0x3634('0x2b')][_0x3634('0x3f')]){_0x4896ab[_0x3634('0x40')]=[{'all':!![]}];}_0x4896ab=_[_0x3634('0x35')]({},_0x4896ab,_0x53c1ea[_0x3634('0x37')]);return db[_0x3634('0x38')]['find'](_0x4896ab)[_0x3634('0x39')](handleEntityNotFound(_0x505be7,null))[_0x3634('0x39')](respondWithResult(_0x505be7,null))[_0x3634('0x3b')](handleError(_0x505be7,null));};exports[_0x3634('0x41')]=function(_0x615276,_0x151654){return db[_0x3634('0x38')][_0x3634('0x41')](_0x615276[_0x3634('0x42')],{})['then'](respondWithResult(_0x151654,0xc9))[_0x3634('0x3b')](handleError(_0x151654,null));};exports[_0x3634('0x1f')]=function(_0x4a4a94,_0x3c356b){if(_0x4a4a94[_0x3634('0x42')]['id']){delete _0x4a4a94[_0x3634('0x42')]['id'];}return db[_0x3634('0x38')][_0x3634('0x43')]({'where':{'id':_0x4a4a94[_0x3634('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c356b,null))[_0x3634('0x39')](saveUpdates(_0x4a4a94[_0x3634('0x42')],null))[_0x3634('0x39')](respondWithResult(_0x3c356b,null))[_0x3634('0x3b')](handleError(_0x3c356b,null));};exports[_0x3634('0x20')]=function(_0x582475,_0x66f6a4){return db[_0x3634('0x38')]['find']({'where':{'id':_0x582475['params']['id']}})[_0x3634('0x39')](handleEntityNotFound(_0x66f6a4,null))['then'](removeEntity(_0x66f6a4,null))[_0x3634('0x3b')](handleError(_0x66f6a4,null));};exports[_0x3634('0x44')]=function(_0x1943a5,_0x1834a3){return db['UserProfileResource'][_0x3634('0x44')]()[_0x3634('0x39')](respondWithResult(_0x1834a3,null))[_0x3634('0x3b')](handleError(_0x1834a3,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index dc38c28..5e1071d 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 _0x7ce4=['request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','util','../../config/logger','bluebird'];(function(_0x4aea3a,_0x3839f9){var _0x5a349e=function(_0x4d77c6){while(--_0x4d77c6){_0x4aea3a['push'](_0x4aea3a['shift']());}};_0x5a349e(++_0x3839f9);}(_0x7ce4,0x131));var _0x47ce=function(_0xc43ada,_0x2225fa){_0xc43ada=_0xc43ada-0x0;var _0x442948=_0x7ce4[_0xc43ada];return _0x442948;};'use strict';var _=require('lodash');var util=require(_0x47ce('0x0'));var logger=require(_0x47ce('0x1'))('api');var moment=require('moment');var BPromise=require(_0x47ce('0x2'));var rp=require(_0x47ce('0x3'));var fs=require('fs');var path=require(_0x47ce('0x4'));var rimraf=require(_0x47ce('0x5'));var config=require(_0x47ce('0x6'));var attributes=require(_0x47ce('0x7'));module[_0x47ce('0x8')]=function(_0x53336b,_0x18f60a){return _0x53336b[_0x47ce('0x9')](_0x47ce('0xa'),attributes,{'tableName':_0x47ce('0xb'),'paranoid':![],'indexes':[{'name':_0x47ce('0xc'),'fields':['resourceId',_0x47ce('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ab9=['rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','resourceId','lodash','moment','bluebird','request-promise'];(function(_0x6d5827,_0x2585bf){var _0x2b8852=function(_0x84d387){while(--_0x84d387){_0x6d5827['push'](_0x6d5827['shift']());}};_0x2b8852(++_0x2585bf);}(_0x8ab9,0x74));var _0x98ab=function(_0x47ecd0,_0x5f315f){_0x47ecd0=_0x47ecd0-0x0;var _0x916089=_0x8ab9[_0x47ecd0];return _0x916089;};'use strict';var _=require(_0x98ab('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x98ab('0x1'));var BPromise=require(_0x98ab('0x2'));var rp=require(_0x98ab('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x98ab('0x4'));var config=require(_0x98ab('0x5'));var attributes=require(_0x98ab('0x6'));module[_0x98ab('0x7')]=function(_0x343147,_0x109214){return _0x343147[_0x98ab('0x8')](_0x98ab('0x9'),attributes,{'tableName':_0x98ab('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x98ab('0xb'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 36eb14a..0b985b6 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 _0x77aa=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x2b3b54,_0x4e1f61){var _0x2ace43=function(_0x1d423e){while(--_0x1d423e){_0x2b3b54['push'](_0x2b3b54['shift']());}};_0x2ace43(++_0x4e1f61);}(_0x77aa,0x1dd));var _0xa77a=function(_0x18090a,_0x36e65b){_0x18090a=_0x18090a-0x0;var _0x1e593f=_0x77aa[_0x18090a];return _0x1e593f;};'use strict';var _=require(_0xa77a('0x0'));var util=require(_0xa77a('0x1'));var moment=require(_0xa77a('0x2'));var BPromise=require(_0xa77a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa77a('0x4'));var db=require(_0xa77a('0x5'))['db'];var utils=require(_0xa77a('0x6'));var logger=require('../../config/logger')(_0xa77a('0x7'));var config=require(_0xa77a('0x8'));var jayson=require(_0xa77a('0x9'));var client=jayson[_0xa77a('0xa')][_0xa77a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x34e884,_0x54fe4a,_0x58ea91){return new BPromise(function(_0x3ff338,_0x3b7652){return client[_0xa77a('0xc')](_0x34e884,_0x58ea91)[_0xa77a('0xd')](function(_0x2fd576){logger[_0xa77a('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x54fe4a,_0xa77a('0xf'));logger[_0xa77a('0x10')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x54fe4a,'request\x20sent',JSON[_0xa77a('0x11')](_0x2fd576));if(_0x2fd576['error']){if(_0x2fd576[_0xa77a('0x12')][_0xa77a('0x13')]===0x1f4){logger[_0xa77a('0x12')](_0xa77a('0x14'),_0x54fe4a,_0x2fd576[_0xa77a('0x12')][_0xa77a('0x15')]);return _0x3b7652(_0x2fd576[_0xa77a('0x12')][_0xa77a('0x15')]);}logger[_0xa77a('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x54fe4a,_0x2fd576[_0xa77a('0x12')][_0xa77a('0x15')]);return _0x3ff338(_0x2fd576[_0xa77a('0x12')]['message']);}else{logger[_0xa77a('0xe')](_0xa77a('0x14'),_0x54fe4a,_0xa77a('0xf'));_0x3ff338(_0x2fd576[_0xa77a('0x16')]['message']);}})[_0xa77a('0x17')](function(_0x4bb4a6){logger['error'](_0xa77a('0x14'),_0x54fe4a,_0x4bb4a6);_0x3b7652(_0x4bb4a6);});});} \ No newline at end of file +var _0xdcec=['stringify','error','code','message','UserProfileResource,\x20%s,\x20%s','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','debug'];(function(_0x2577e0,_0xd1d5f5){var _0xcd4b3e=function(_0x344247){while(--_0x344247){_0x2577e0['push'](_0x2577e0['shift']());}};_0xcd4b3e(++_0xd1d5f5);}(_0xdcec,0x1c0));var _0xcdce=function(_0x41582d,_0x291b1c){_0x41582d=_0x41582d-0x0;var _0x59c504=_0xdcec[_0x41582d];return _0x59c504;};'use strict';var _=require(_0xcdce('0x0'));var util=require(_0xcdce('0x1'));var moment=require(_0xcdce('0x2'));var BPromise=require(_0xcdce('0x3'));var rs=require(_0xcdce('0x4'));var fs=require('fs');var Redis=require(_0xcdce('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xcdce('0x6'))(_0xcdce('0x7'));var config=require('../../config/environment');var jayson=require(_0xcdce('0x8'));var client=jayson[_0xcdce('0x9')][_0xcdce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x36d564,_0x5666b4,_0x121a7b){return new BPromise(function(_0x3abd86,_0xb2a427){return client[_0xcdce('0xb')](_0x36d564,_0x121a7b)[_0xcdce('0xc')](function(_0x224c9a){logger['info']('UserProfileResource,\x20%s,\x20%s',_0x5666b4,'request\x20sent');logger[_0xcdce('0xd')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x5666b4,'request\x20sent',JSON[_0xcdce('0xe')](_0x224c9a));if(_0x224c9a[_0xcdce('0xf')]){if(_0x224c9a[_0xcdce('0xf')][_0xcdce('0x10')]===0x1f4){logger[_0xcdce('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x5666b4,_0x224c9a[_0xcdce('0xf')][_0xcdce('0x11')]);return _0xb2a427(_0x224c9a[_0xcdce('0xf')][_0xcdce('0x11')]);}logger['error'](_0xcdce('0x12'),_0x5666b4,_0x224c9a[_0xcdce('0xf')][_0xcdce('0x11')]);return _0x3abd86(_0x224c9a[_0xcdce('0xf')][_0xcdce('0x11')]);}else{logger[_0xcdce('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x5666b4,'request\x20sent');_0x3abd86(_0x224c9a['result']['message']);}})[_0xcdce('0x14')](function(_0x12e549){logger[_0xcdce('0xf')](_0xcdce('0x12'),_0x5666b4,_0x12e549);_0xb2a427(_0x12e549);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index d593592..c6aac64 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 _0x35cb=['../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra'];(function(_0x2bf4c4,_0x262fcb){var _0x2ae0c1=function(_0x2286f5){while(--_0x2286f5){_0x2bf4c4['push'](_0x2bf4c4['shift']());}};_0x2ae0c1(++_0x262fcb);}(_0x35cb,0xf3));var _0xb35c=function(_0x531c7c,_0x2e02ad){_0x531c7c=_0x531c7c-0x0;var _0xe9125=_0x35cb[_0x531c7c];return _0xe9125;};'use strict';var multer=require(_0xb35c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb35c('0x1'));var express=require(_0xb35c('0x2'));var router=express['Router']();var fs_extra=require(_0xb35c('0x3'));var auth=require(_0xb35c('0x4'));var interaction=require(_0xb35c('0x5'));var config=require('../../config/environment');var controller=require(_0xb35c('0x6'));router[_0xb35c('0x7')]('/',auth[_0xb35c('0x8')](),controller[_0xb35c('0x9')]);router[_0xb35c('0x7')](_0xb35c('0xa'),auth[_0xb35c('0x8')](),controller['describe']);router[_0xb35c('0x7')](_0xb35c('0xb'),auth[_0xb35c('0x8')](),controller[_0xb35c('0xc')]);router['post']('/',auth[_0xb35c('0x8')](),controller[_0xb35c('0xd')]);router[_0xb35c('0xe')]('/:id',auth[_0xb35c('0x8')](),controller[_0xb35c('0xf')]);router[_0xb35c('0x10')]('/:id',auth[_0xb35c('0x8')](),controller[_0xb35c('0x11')]);module[_0xb35c('0x12')]=router; \ No newline at end of file +var _0xeb53=['update','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfileSection.controller','isAuthenticated','get','/describe','/:id','show','post','create','put'];(function(_0x1aab74,_0x38a57b){var _0x396af2=function(_0x1c2e0d){while(--_0x1c2e0d){_0x1aab74['push'](_0x1aab74['shift']());}};_0x396af2(++_0x38a57b);}(_0xeb53,0x1b2));var _0x3eb5=function(_0x5ec5fa,_0x44f9b5){_0x5ec5fa=_0x5ec5fa-0x0;var _0x32e79e=_0xeb53[_0x5ec5fa];return _0x32e79e;};'use strict';var multer=require(_0x3eb5('0x0'));var util=require('util');var path=require(_0x3eb5('0x1'));var timeout=require(_0x3eb5('0x2'));var express=require(_0x3eb5('0x3'));var router=express[_0x3eb5('0x4')]();var fs_extra=require(_0x3eb5('0x5'));var auth=require(_0x3eb5('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3eb5('0x7'));router['get']('/',auth[_0x3eb5('0x8')](),controller['index']);router[_0x3eb5('0x9')](_0x3eb5('0xa'),auth[_0x3eb5('0x8')](),controller['describe']);router[_0x3eb5('0x9')](_0x3eb5('0xb'),auth[_0x3eb5('0x8')](),controller[_0x3eb5('0xc')]);router[_0x3eb5('0xd')]('/',auth[_0x3eb5('0x8')](),controller[_0x3eb5('0xe')]);router[_0x3eb5('0xf')](_0x3eb5('0xb'),auth[_0x3eb5('0x8')](),controller[_0x3eb5('0x10')]);router['delete']('/:id',auth[_0x3eb5('0x8')](),controller[_0x3eb5('0x11')]);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 bfcc688..64c85f2 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 _0xe820=['sequelize','STRING','BOOLEAN','setDataValue','join','getDataValue','crudPermissions'];(function(_0x15ef6b,_0x1ca233){var _0x561e29=function(_0x3ca073){while(--_0x3ca073){_0x15ef6b['push'](_0x15ef6b['shift']());}};_0x561e29(++_0x1ca233);}(_0xe820,0xd2));var _0x0e82=function(_0x392e1a,_0x1a2d38){_0x392e1a=_0x392e1a-0x0;var _0x3d70cb=_0xe820[_0x392e1a];return _0x3d70cb;};'use strict';var Sequelize=require(_0x0e82('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e82('0x1')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x0e82('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0e82('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0e82('0x1')],'set':function(_0x59b28d){this[_0x0e82('0x3')]('crudPermissions',_0x59b28d?_0x59b28d[_0x0e82('0x4')](''):[]);},'get':function(){return this[_0x0e82('0x5')](_0x0e82('0x6'))?this[_0x0e82('0x5')](_0x0e82('0x6'))['split'](''):[];}}}; \ No newline at end of file +var _0xea28=['crudPermissions','join','getDataValue','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue'];(function(_0x4947d1,_0x35af46){var _0x3e067e=function(_0x2e5b4d){while(--_0x2e5b4d){_0x4947d1['push'](_0x4947d1['shift']());}};_0x3e067e(++_0x35af46);}(_0xea28,0x13a));var _0x8ea2=function(_0x53ce4f,_0x5a664e){_0x53ce4f=_0x53ce4f-0x0;var _0x58b5be=_0xea28[_0x53ce4f];return _0x58b5be;};'use strict';var Sequelize=require(_0x8ea2('0x0'));module[_0x8ea2('0x1')]={'name':{'type':Sequelize[_0x8ea2('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x8ea2('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x8ea2('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x8ea2('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x8ea2('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x8ea2('0x2')],'set':function(_0x4b7cda){this[_0x8ea2('0x5')](_0x8ea2('0x6'),_0x4b7cda?_0x4b7cda[_0x8ea2('0x7')](''):[]);},'get':function(){return this['getDataValue'](_0x8ea2('0x6'))?this[_0x8ea2('0x8')](_0x8ea2('0x6'))[_0x8ea2('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index ae6564c..be88e83 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 _0xb2b4=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','send','index','map','UserProfileSection','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','include','findAll','rows','catch','params','rawAttributes','merge','options','find','create','body','describe'];(function(_0x450bf9,_0x1895de){var _0x268350=function(_0xebafa7){while(--_0xebafa7){_0x450bf9['push'](_0x450bf9['shift']());}};_0x268350(++_0x1895de);}(_0xb2b4,0x92));var _0x4b2b=function(_0x30faec,_0x18940b){_0x30faec=_0x30faec-0x0;var _0x29484f=_0xb2b4[_0x30faec];return _0x29484f;};'use strict';var emlformat=require(_0x4b2b('0x0'));var rimraf=require(_0x4b2b('0x1'));var zipdir=require(_0x4b2b('0x2'));var jsonpatch=require(_0x4b2b('0x3'));var rp=require(_0x4b2b('0x4'));var moment=require(_0x4b2b('0x5'));var BPromise=require(_0x4b2b('0x6'));var Mustache=require(_0x4b2b('0x7'));var util=require(_0x4b2b('0x8'));var path=require(_0x4b2b('0x9'));var sox=require('sox');var csv=require(_0x4b2b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b2b('0xb'));var _=require(_0x4b2b('0xc'));var squel=require('squel');var crypto=require(_0x4b2b('0xd'));var jsforce=require(_0x4b2b('0xe'));var deskjs=require(_0x4b2b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4b2b('0x10'));var Papa=require('papaparse');var Redis=require(_0x4b2b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4b2b('0x12'));var as=require(_0x4b2b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b2b('0x14'))(_0x4b2b('0x15'));var utils=require('../../config/utils');var config=require(_0x4b2b('0x16'));var licenseUtil=require(_0x4b2b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57c711,_0x1b09c2){_0x1b09c2=_0x1b09c2||0xcc;return function(_0x34b561){if(_0x34b561){return _0x57c711[_0x4b2b('0x18')](_0x1b09c2);}return _0x57c711[_0x4b2b('0x19')](_0x1b09c2)[_0x4b2b('0x1a')]();};}function respondWithResult(_0x272379,_0x6d03a2){_0x6d03a2=_0x6d03a2||0xc8;return function(_0x2aa35b){if(_0x2aa35b){return _0x272379[_0x4b2b('0x19')](_0x6d03a2)[_0x4b2b('0x1b')](_0x2aa35b);}};}function respondWithFilteredResult(_0x8eb4a4,_0x581d5d){return function(_0x273711){if(_0x273711){var _0x18267d=typeof _0x581d5d[_0x4b2b('0x1c')]===_0x4b2b('0x1d')&&typeof _0x581d5d[_0x4b2b('0x1e')]===_0x4b2b('0x1d');var _0x1f5d6f=_0x273711[_0x4b2b('0x1f')];var _0x3965a8=_0x18267d?0x0:_0x581d5d[_0x4b2b('0x1c')];var _0x310d8c=_0x18267d?_0x273711[_0x4b2b('0x1f')]:_0x581d5d['offset']+_0x581d5d[_0x4b2b('0x1e')];var _0x4756ec;if(_0x310d8c>=_0x1f5d6f){_0x310d8c=_0x1f5d6f;_0x4756ec=0xc8;}else{_0x4756ec=0xce;}_0x8eb4a4['status'](_0x4756ec);return _0x8eb4a4[_0x4b2b('0x20')]('Content-Range',_0x3965a8+'-'+_0x310d8c+'/'+_0x1f5d6f)[_0x4b2b('0x1b')](_0x273711);}return null;};}function patchUpdates(_0x3e8e79){return function(_0x1943b6){try{jsonpatch[_0x4b2b('0x21')](_0x1943b6,_0x3e8e79,!![]);}catch(_0x144f2b){return BPromise['reject'](_0x144f2b);}return _0x1943b6[_0x4b2b('0x22')]();};}function saveUpdates(_0x10f420,_0x5cd149){return function(_0x301c55){if(_0x301c55){return _0x301c55[_0x4b2b('0x23')](_0x10f420)[_0x4b2b('0x24')](function(_0x3e4e1c){return _0x3e4e1c;});}return null;};}function removeEntity(_0x47fdac,_0x197a1d){return function(_0x29b2c4){if(_0x29b2c4){return _0x29b2c4[_0x4b2b('0x25')]()[_0x4b2b('0x24')](function(){_0x47fdac[_0x4b2b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x555b80,_0x11797d){return function(_0x2c3b20){if(!_0x2c3b20){_0x555b80[_0x4b2b('0x18')](0x194);}return _0x2c3b20;};}function handleError(_0x57ef85,_0x5717e1){_0x5717e1=_0x5717e1||0x1f4;return function(_0x108fc0){logger[_0x4b2b('0x26')](_0x108fc0[_0x4b2b('0x27')]);if(_0x108fc0['name']){delete _0x108fc0['name'];}_0x57ef85[_0x4b2b('0x19')](_0x5717e1)[_0x4b2b('0x28')](_0x108fc0);};}exports[_0x4b2b('0x29')]=function(_0x3490ad,_0x5ec2a2){var _0x512b43={},_0x37dba1={},_0x236da4={'count':0x0,'rows':[]};var _0x7b1e5b=_[_0x4b2b('0x2a')](db[_0x4b2b('0x2b')]['rawAttributes'],function(_0x363292){return{'name':_0x363292['fieldName'],'type':_0x363292[_0x4b2b('0x2c')][_0x4b2b('0x2d')]};});_0x37dba1[_0x4b2b('0x2e')]=_['map'](_0x7b1e5b,_0x4b2b('0x2f'));_0x37dba1[_0x4b2b('0x30')]=_[_0x4b2b('0x31')](_0x3490ad[_0x4b2b('0x30')]);_0x37dba1[_0x4b2b('0x32')]=_[_0x4b2b('0x33')](_0x37dba1[_0x4b2b('0x2e')],_0x37dba1['query']);_0x512b43[_0x4b2b('0x34')]=_[_0x4b2b('0x33')](_0x37dba1[_0x4b2b('0x2e')],qs[_0x4b2b('0x35')](_0x3490ad[_0x4b2b('0x30')][_0x4b2b('0x35')]));_0x512b43[_0x4b2b('0x34')]=_0x512b43[_0x4b2b('0x34')][_0x4b2b('0x36')]?_0x512b43['attributes']:_0x37dba1[_0x4b2b('0x2e')];if(!_0x3490ad[_0x4b2b('0x30')][_0x4b2b('0x37')]('nolimit')){_0x512b43[_0x4b2b('0x1e')]=qs[_0x4b2b('0x1e')](_0x3490ad[_0x4b2b('0x30')][_0x4b2b('0x1e')]);_0x512b43[_0x4b2b('0x1c')]=qs[_0x4b2b('0x1c')](_0x3490ad[_0x4b2b('0x30')][_0x4b2b('0x1c')]);}_0x512b43['order']=qs[_0x4b2b('0x38')](_0x3490ad[_0x4b2b('0x30')][_0x4b2b('0x38')]);_0x512b43[_0x4b2b('0x39')]=qs[_0x4b2b('0x32')](_[_0x4b2b('0x3a')](_0x3490ad[_0x4b2b('0x30')],_0x37dba1[_0x4b2b('0x32')]),_0x7b1e5b);if(_0x3490ad['query'][_0x4b2b('0x3b')]){_0x512b43[_0x4b2b('0x39')]=_['merge'](_0x512b43[_0x4b2b('0x39')],{'$or':_[_0x4b2b('0x2a')](_0x7b1e5b,function(_0x1a696a){if(_0x1a696a['type']!==_0x4b2b('0x3c')){var _0x408549={};_0x408549[_0x1a696a[_0x4b2b('0x2f')]]={'$like':'%'+_0x3490ad[_0x4b2b('0x30')][_0x4b2b('0x3b')]+'%'};return _0x408549;}})});}_0x512b43=_['merge']({},_0x512b43,_0x3490ad['options']);var _0x508ef9={'where':_0x512b43['where']};return db['UserProfileSection'][_0x4b2b('0x1f')](_0x508ef9)[_0x4b2b('0x24')](function(_0x40433f){_0x236da4[_0x4b2b('0x1f')]=_0x40433f;if(_0x3490ad[_0x4b2b('0x30')]['includeAll']){_0x512b43[_0x4b2b('0x3d')]=[{'all':!![]}];}return db[_0x4b2b('0x2b')][_0x4b2b('0x3e')](_0x512b43);})[_0x4b2b('0x24')](function(_0x261be2){_0x236da4[_0x4b2b('0x3f')]=_0x261be2;return _0x236da4;})[_0x4b2b('0x24')](respondWithFilteredResult(_0x5ec2a2,_0x512b43))[_0x4b2b('0x40')](handleError(_0x5ec2a2,null));};exports['show']=function(_0x585574,_0x413085){var _0x1b688c={'raw':![],'where':{'id':_0x585574[_0x4b2b('0x41')]['id']}},_0x4434b6={};_0x4434b6[_0x4b2b('0x2e')]=_[_0x4b2b('0x31')](db[_0x4b2b('0x2b')][_0x4b2b('0x42')]);_0x4434b6[_0x4b2b('0x30')]=_[_0x4b2b('0x31')](_0x585574[_0x4b2b('0x30')]);_0x4434b6[_0x4b2b('0x32')]=_['intersection'](_0x4434b6[_0x4b2b('0x2e')],_0x4434b6['query']);_0x1b688c[_0x4b2b('0x34')]=_[_0x4b2b('0x33')](_0x4434b6['model'],qs[_0x4b2b('0x35')](_0x585574[_0x4b2b('0x30')]['fields']));_0x1b688c[_0x4b2b('0x34')]=_0x1b688c[_0x4b2b('0x34')][_0x4b2b('0x36')]?_0x1b688c['attributes']:_0x4434b6[_0x4b2b('0x2e')];if(_0x585574[_0x4b2b('0x30')]['includeAll']){_0x1b688c['include']=[{'all':!![]}];}_0x1b688c=_[_0x4b2b('0x43')]({},_0x1b688c,_0x585574[_0x4b2b('0x44')]);return db[_0x4b2b('0x2b')][_0x4b2b('0x45')](_0x1b688c)[_0x4b2b('0x24')](handleEntityNotFound(_0x413085,null))[_0x4b2b('0x24')](respondWithResult(_0x413085,null))[_0x4b2b('0x40')](handleError(_0x413085,null));};exports[_0x4b2b('0x46')]=function(_0x1e9d1b,_0x22304d){return db[_0x4b2b('0x2b')]['create'](_0x1e9d1b[_0x4b2b('0x47')],{})[_0x4b2b('0x24')](respondWithResult(_0x22304d,0xc9))['catch'](handleError(_0x22304d,null));};exports[_0x4b2b('0x23')]=function(_0x4dfae3,_0x4dc669){if(_0x4dfae3['body']['id']){delete _0x4dfae3[_0x4b2b('0x47')]['id'];}return db[_0x4b2b('0x2b')][_0x4b2b('0x45')]({'where':{'id':_0x4dfae3[_0x4b2b('0x41')]['id']}})['then'](handleEntityNotFound(_0x4dc669,null))[_0x4b2b('0x24')](saveUpdates(_0x4dfae3[_0x4b2b('0x47')],null))[_0x4b2b('0x24')](respondWithResult(_0x4dc669,null))['catch'](handleError(_0x4dc669,null));};exports[_0x4b2b('0x25')]=function(_0x27d21a,_0x26e91a){return db['UserProfileSection']['find']({'where':{'id':_0x27d21a[_0x4b2b('0x41')]['id']}})[_0x4b2b('0x24')](handleEntityNotFound(_0x26e91a,null))[_0x4b2b('0x24')](removeEntity(_0x26e91a,null))[_0x4b2b('0x40')](handleError(_0x26e91a,null));};exports[_0x4b2b('0x48')]=function(_0x1e8803,_0x555614){return db['UserProfileSection'][_0x4b2b('0x48')]()[_0x4b2b('0x24')](respondWithResult(_0x555614,null))[_0x4b2b('0x40')](handleError(_0x555614,null));}; \ No newline at end of file +var _0x3a58=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','UserProfileSection','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x2db47e,_0x374941){var _0x4590b2=function(_0x5b0198){while(--_0x5b0198){_0x2db47e['push'](_0x2db47e['shift']());}};_0x4590b2(++_0x374941);}(_0x3a58,0x8d));var _0x83a5=function(_0x395145,_0x1e78b4){_0x395145=_0x395145-0x0;var _0x258d87=_0x3a58[_0x395145];return _0x258d87;};'use strict';var emlformat=require(_0x83a5('0x0'));var rimraf=require(_0x83a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x83a5('0x2'));var rp=require(_0x83a5('0x3'));var moment=require('moment');var BPromise=require(_0x83a5('0x4'));var Mustache=require(_0x83a5('0x5'));var util=require('util');var path=require(_0x83a5('0x6'));var sox=require(_0x83a5('0x7'));var csv=require(_0x83a5('0x8'));var ejs=require(_0x83a5('0x9'));var fs=require('fs');var fs_extra=require(_0x83a5('0xa'));var _=require(_0x83a5('0xb'));var squel=require(_0x83a5('0xc'));var crypto=require('crypto');var jsforce=require(_0x83a5('0xd'));var deskjs=require(_0x83a5('0xe'));var toCsv=require(_0x83a5('0x8'));var querystring=require(_0x83a5('0xf'));var Papa=require(_0x83a5('0x10'));var Redis=require(_0x83a5('0x11'));var authService=require(_0x83a5('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x83a5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x83a5('0x14'))(_0x83a5('0x15'));var utils=require(_0x83a5('0x16'));var config=require(_0x83a5('0x17'));var licenseUtil=require(_0x83a5('0x18'));var db=require(_0x83a5('0x19'))['db'];function respondWithStatusCode(_0x30a7dd,_0x1d69ff){_0x1d69ff=_0x1d69ff||0xcc;return function(_0x2612d4){if(_0x2612d4){return _0x30a7dd['sendStatus'](_0x1d69ff);}return _0x30a7dd[_0x83a5('0x1a')](_0x1d69ff)[_0x83a5('0x1b')]();};}function respondWithResult(_0x4ca81a,_0x27176c){_0x27176c=_0x27176c||0xc8;return function(_0x215447){if(_0x215447){return _0x4ca81a[_0x83a5('0x1a')](_0x27176c)[_0x83a5('0x1c')](_0x215447);}};}function respondWithFilteredResult(_0x480364,_0x503207){return function(_0x394969){if(_0x394969){var _0x2de1c7=typeof _0x503207[_0x83a5('0x1d')]===_0x83a5('0x1e')&&typeof _0x503207[_0x83a5('0x1f')]===_0x83a5('0x1e');var _0x3dfb57=_0x394969[_0x83a5('0x20')];var _0x2f413e=_0x2de1c7?0x0:_0x503207[_0x83a5('0x1d')];var _0x42a700=_0x2de1c7?_0x394969[_0x83a5('0x20')]:_0x503207[_0x83a5('0x1d')]+_0x503207[_0x83a5('0x1f')];var _0x3d07fc;if(_0x42a700>=_0x3dfb57){_0x42a700=_0x3dfb57;_0x3d07fc=0xc8;}else{_0x3d07fc=0xce;}_0x480364[_0x83a5('0x1a')](_0x3d07fc);return _0x480364['set'](_0x83a5('0x21'),_0x2f413e+'-'+_0x42a700+'/'+_0x3dfb57)['json'](_0x394969);}return null;};}function patchUpdates(_0x1752a0){return function(_0x3896b2){try{jsonpatch[_0x83a5('0x22')](_0x3896b2,_0x1752a0,!![]);}catch(_0x1024b7){return BPromise[_0x83a5('0x23')](_0x1024b7);}return _0x3896b2[_0x83a5('0x24')]();};}function saveUpdates(_0x34a866,_0x241409){return function(_0x1f4e80){if(_0x1f4e80){return _0x1f4e80[_0x83a5('0x25')](_0x34a866)[_0x83a5('0x26')](function(_0x1e6b67){return _0x1e6b67;});}return null;};}function removeEntity(_0x59037f,_0x31c530){return function(_0x43067e){if(_0x43067e){return _0x43067e[_0x83a5('0x27')]()['then'](function(){_0x59037f[_0x83a5('0x1a')](0xcc)[_0x83a5('0x1b')]();});}};}function handleEntityNotFound(_0x17f2aa,_0x586830){return function(_0x1d5a47){if(!_0x1d5a47){_0x17f2aa['sendStatus'](0x194);}return _0x1d5a47;};}function handleError(_0x3c0663,_0x51d1ba){_0x51d1ba=_0x51d1ba||0x1f4;return function(_0x4c7408){logger[_0x83a5('0x28')](_0x4c7408[_0x83a5('0x29')]);if(_0x4c7408[_0x83a5('0x2a')]){delete _0x4c7408[_0x83a5('0x2a')];}_0x3c0663[_0x83a5('0x1a')](_0x51d1ba)[_0x83a5('0x2b')](_0x4c7408);};}exports[_0x83a5('0x2c')]=function(_0x4d123e,_0x5309d1){var _0x404038={},_0x4428dc={},_0x359b8f={'count':0x0,'rows':[]};var _0x209169=_['map'](db[_0x83a5('0x2d')]['rawAttributes'],function(_0x2de3c4){return{'name':_0x2de3c4[_0x83a5('0x2e')],'type':_0x2de3c4['type'][_0x83a5('0x2f')]};});_0x4428dc[_0x83a5('0x30')]=_[_0x83a5('0x31')](_0x209169,_0x83a5('0x2a'));_0x4428dc[_0x83a5('0x32')]=_[_0x83a5('0x33')](_0x4d123e['query']);_0x4428dc[_0x83a5('0x34')]=_[_0x83a5('0x35')](_0x4428dc[_0x83a5('0x30')],_0x4428dc[_0x83a5('0x32')]);_0x404038[_0x83a5('0x36')]=_[_0x83a5('0x35')](_0x4428dc['model'],qs[_0x83a5('0x37')](_0x4d123e[_0x83a5('0x32')]['fields']));_0x404038[_0x83a5('0x36')]=_0x404038[_0x83a5('0x36')]['length']?_0x404038[_0x83a5('0x36')]:_0x4428dc[_0x83a5('0x30')];if(!_0x4d123e['query']['hasOwnProperty'](_0x83a5('0x38'))){_0x404038['limit']=qs[_0x83a5('0x1f')](_0x4d123e[_0x83a5('0x32')][_0x83a5('0x1f')]);_0x404038[_0x83a5('0x1d')]=qs[_0x83a5('0x1d')](_0x4d123e[_0x83a5('0x32')][_0x83a5('0x1d')]);}_0x404038[_0x83a5('0x39')]=qs[_0x83a5('0x3a')](_0x4d123e[_0x83a5('0x32')][_0x83a5('0x3a')]);_0x404038[_0x83a5('0x3b')]=qs[_0x83a5('0x34')](_['pick'](_0x4d123e[_0x83a5('0x32')],_0x4428dc[_0x83a5('0x34')]),_0x209169);if(_0x4d123e[_0x83a5('0x32')][_0x83a5('0x3c')]){_0x404038[_0x83a5('0x3b')]=_[_0x83a5('0x3d')](_0x404038[_0x83a5('0x3b')],{'$or':_[_0x83a5('0x31')](_0x209169,function(_0x5eee92){if(_0x5eee92[_0x83a5('0x3e')]!==_0x83a5('0x3f')){var _0x5601f3={};_0x5601f3[_0x5eee92[_0x83a5('0x2a')]]={'$like':'%'+_0x4d123e[_0x83a5('0x32')][_0x83a5('0x3c')]+'%'};return _0x5601f3;}})});}_0x404038=_[_0x83a5('0x3d')]({},_0x404038,_0x4d123e[_0x83a5('0x40')]);var _0x363146={'where':_0x404038[_0x83a5('0x3b')]};return db['UserProfileSection'][_0x83a5('0x20')](_0x363146)[_0x83a5('0x26')](function(_0x215558){_0x359b8f[_0x83a5('0x20')]=_0x215558;if(_0x4d123e['query'][_0x83a5('0x41')]){_0x404038[_0x83a5('0x42')]=[{'all':!![]}];}return db['UserProfileSection'][_0x83a5('0x43')](_0x404038);})[_0x83a5('0x26')](function(_0x318ed0){_0x359b8f[_0x83a5('0x44')]=_0x318ed0;return _0x359b8f;})[_0x83a5('0x26')](respondWithFilteredResult(_0x5309d1,_0x404038))[_0x83a5('0x45')](handleError(_0x5309d1,null));};exports[_0x83a5('0x46')]=function(_0x1a0fb4,_0x36d2ba){var _0x3998f6={'raw':![],'where':{'id':_0x1a0fb4[_0x83a5('0x47')]['id']}},_0x80ca1a={};_0x80ca1a[_0x83a5('0x30')]=_[_0x83a5('0x33')](db['UserProfileSection'][_0x83a5('0x48')]);_0x80ca1a[_0x83a5('0x32')]=_[_0x83a5('0x33')](_0x1a0fb4[_0x83a5('0x32')]);_0x80ca1a[_0x83a5('0x34')]=_['intersection'](_0x80ca1a[_0x83a5('0x30')],_0x80ca1a[_0x83a5('0x32')]);_0x3998f6[_0x83a5('0x36')]=_['intersection'](_0x80ca1a[_0x83a5('0x30')],qs[_0x83a5('0x37')](_0x1a0fb4['query'][_0x83a5('0x37')]));_0x3998f6['attributes']=_0x3998f6['attributes']['length']?_0x3998f6[_0x83a5('0x36')]:_0x80ca1a['model'];if(_0x1a0fb4[_0x83a5('0x32')][_0x83a5('0x41')]){_0x3998f6[_0x83a5('0x42')]=[{'all':!![]}];}_0x3998f6=_[_0x83a5('0x3d')]({},_0x3998f6,_0x1a0fb4[_0x83a5('0x40')]);return db[_0x83a5('0x2d')][_0x83a5('0x49')](_0x3998f6)[_0x83a5('0x26')](handleEntityNotFound(_0x36d2ba,null))['then'](respondWithResult(_0x36d2ba,null))[_0x83a5('0x45')](handleError(_0x36d2ba,null));};exports[_0x83a5('0x4a')]=function(_0x4fb7f6,_0x574d9c){return db[_0x83a5('0x2d')][_0x83a5('0x4a')](_0x4fb7f6['body'],{})[_0x83a5('0x26')](respondWithResult(_0x574d9c,0xc9))['catch'](handleError(_0x574d9c,null));};exports[_0x83a5('0x25')]=function(_0x1f2f01,_0x2af046){if(_0x1f2f01[_0x83a5('0x4b')]['id']){delete _0x1f2f01[_0x83a5('0x4b')]['id'];}return db[_0x83a5('0x2d')]['find']({'where':{'id':_0x1f2f01[_0x83a5('0x47')]['id']}})[_0x83a5('0x26')](handleEntityNotFound(_0x2af046,null))[_0x83a5('0x26')](saveUpdates(_0x1f2f01[_0x83a5('0x4b')],null))['then'](respondWithResult(_0x2af046,null))['catch'](handleError(_0x2af046,null));};exports['destroy']=function(_0xf499d5,_0x8d84d){return db['UserProfileSection'][_0x83a5('0x49')]({'where':{'id':_0xf499d5[_0x83a5('0x47')]['id']}})[_0x83a5('0x26')](handleEntityNotFound(_0x8d84d,null))[_0x83a5('0x26')](removeEntity(_0x8d84d,null))[_0x83a5('0x45')](handleError(_0x8d84d,null));};exports[_0x83a5('0x4c')]=function(_0x1272d2,_0x485117){return db['UserProfileSection']['describe']()[_0x83a5('0x26')](respondWithResult(_0x485117,null))[_0x83a5('0x45')](handleError(_0x485117,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index ef325df..e286df1 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 _0x20cc=['moment','bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','lodash','util','../../config/logger','api'];(function(_0x70800b,_0x18c90c){var _0x8db856=function(_0xc60d3d){while(--_0xc60d3d){_0x70800b['push'](_0x70800b['shift']());}};_0x8db856(++_0x18c90c);}(_0x20cc,0x1ac));var _0xc20c=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0x20cc[_0x32d457];return _0x338386;};'use strict';var _=require(_0xc20c('0x0'));var util=require(_0xc20c('0x1'));var logger=require(_0xc20c('0x2'))(_0xc20c('0x3'));var moment=require(_0xc20c('0x4'));var BPromise=require(_0xc20c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc20c('0x6'));var rimraf=require(_0xc20c('0x7'));var config=require(_0xc20c('0x8'));var attributes=require(_0xc20c('0x9'));module[_0xc20c('0xa')]=function(_0x3344e0,_0x60bd42){return _0x3344e0[_0xc20c('0xb')](_0xc20c('0xc'),attributes,{'tableName':_0xc20c('0xd'),'paranoid':![],'indexes':[{'name':_0xc20c('0xe'),'fields':['sectionId',_0xc20c('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7999=['lodash','util','api','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x7999,0x9a));var _0x9799=function(_0x4dd781,_0x2e6bf3){_0x4dd781=_0x4dd781-0x0;var _0x5d1ea4=_0x7999[_0x4dd781];return _0x5d1ea4;};'use strict';var _=require(_0x9799('0x0'));var util=require(_0x9799('0x1'));var logger=require('../../config/logger')(_0x9799('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9799('0x3'));var fs=require('fs');var path=require(_0x9799('0x4'));var rimraf=require(_0x9799('0x5'));var config=require(_0x9799('0x6'));var attributes=require(_0x9799('0x7'));module['exports']=function(_0x1beaa2,_0x4c788d){return _0x1beaa2[_0x9799('0x8')](_0x9799('0x9'),attributes,{'tableName':_0x9799('0xa'),'paranoid':![],'indexes':[{'name':_0x9799('0xb'),'fields':[_0x9799('0xc'),_0x9799('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index cf1fe70..8eaa490 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 _0xbb41=['request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','code','error','UserProfileSection,\x20%s,\x20%s','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x4a4225,_0x3d9bf8){var _0x1a6109=function(_0x27946e){while(--_0x27946e){_0x4a4225['push'](_0x4a4225['shift']());}};_0x1a6109(++_0x3d9bf8);}(_0xbb41,0xf9));var _0x1bb4=function(_0x490dca,_0x5c745e){_0x490dca=_0x490dca-0x0;var _0x31ee2=_0xbb41[_0x490dca];return _0x31ee2;};'use strict';var _=require(_0x1bb4('0x0'));var util=require(_0x1bb4('0x1'));var moment=require(_0x1bb4('0x2'));var BPromise=require(_0x1bb4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1bb4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1bb4('0x5'));var logger=require(_0x1bb4('0x6'))(_0x1bb4('0x7'));var config=require(_0x1bb4('0x8'));var jayson=require(_0x1bb4('0x9'));var client=jayson[_0x1bb4('0xa')][_0x1bb4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ab235,_0x5852ad,_0x2709c3){return new BPromise(function(_0x35a03c,_0x1350ae){return client[_0x1bb4('0xc')](_0x5ab235,_0x2709c3)[_0x1bb4('0xd')](function(_0x3f0468){logger[_0x1bb4('0xe')]('UserProfileSection,\x20%s,\x20%s',_0x5852ad,_0x1bb4('0xf'));logger['debug'](_0x1bb4('0x10'),_0x5852ad,_0x1bb4('0xf'),JSON[_0x1bb4('0x11')](_0x3f0468));if(_0x3f0468['error']){if(_0x3f0468['error'][_0x1bb4('0x12')]===0x1f4){logger[_0x1bb4('0x13')](_0x1bb4('0x14'),_0x5852ad,_0x3f0468[_0x1bb4('0x13')][_0x1bb4('0x15')]);return _0x1350ae(_0x3f0468[_0x1bb4('0x13')][_0x1bb4('0x15')]);}logger[_0x1bb4('0x13')](_0x1bb4('0x14'),_0x5852ad,_0x3f0468[_0x1bb4('0x13')][_0x1bb4('0x15')]);return _0x35a03c(_0x3f0468[_0x1bb4('0x13')]['message']);}else{logger[_0x1bb4('0xe')](_0x1bb4('0x14'),_0x5852ad,_0x1bb4('0xf'));_0x35a03c(_0x3f0468['result']['message']);}})['catch'](function(_0x25265e){logger[_0x1bb4('0x13')](_0x1bb4('0x14'),_0x5852ad,_0x25265e);_0x1350ae(_0x25265e);});});} \ No newline at end of file +var _0x594d=['client','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4b3d49,_0x53481c){var _0x296db7=function(_0xc6722c){while(--_0xc6722c){_0x4b3d49['push'](_0x4b3d49['shift']());}};_0x296db7(++_0x53481c);}(_0x594d,0x1e6));var _0xd594=function(_0x1f0e6e,_0x263b06){_0x1f0e6e=_0x1f0e6e-0x0;var _0x4e7d63=_0x594d[_0x1f0e6e];return _0x4e7d63;};'use strict';var _=require('lodash');var util=require(_0xd594('0x0'));var moment=require(_0xd594('0x1'));var BPromise=require(_0xd594('0x2'));var rs=require(_0xd594('0x3'));var fs=require('fs');var Redis=require(_0xd594('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd594('0x5'))('rpc');var config=require(_0xd594('0x6'));var jayson=require(_0xd594('0x7'));var client=jayson[_0xd594('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x335c67,_0x380fb8,_0x308e23){return new BPromise(function(_0x21373b,_0x2b7cfc){return client['request'](_0x335c67,_0x308e23)[_0xd594('0x9')](function(_0x17ebd6){logger[_0xd594('0xa')](_0xd594('0xb'),_0x380fb8,_0xd594('0xc'));logger[_0xd594('0xd')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x380fb8,_0xd594('0xc'),JSON[_0xd594('0xe')](_0x17ebd6));if(_0x17ebd6['error']){if(_0x17ebd6[_0xd594('0xf')][_0xd594('0x10')]===0x1f4){logger[_0xd594('0xf')](_0xd594('0xb'),_0x380fb8,_0x17ebd6[_0xd594('0xf')][_0xd594('0x11')]);return _0x2b7cfc(_0x17ebd6[_0xd594('0xf')][_0xd594('0x11')]);}logger[_0xd594('0xf')](_0xd594('0xb'),_0x380fb8,_0x17ebd6['error'][_0xd594('0x11')]);return _0x21373b(_0x17ebd6[_0xd594('0xf')][_0xd594('0x11')]);}else{logger[_0xd594('0xa')](_0xd594('0xb'),_0x380fb8,'request\x20sent');_0x21373b(_0x17ebd6['result']['message']);}})[_0xd594('0x12')](function(_0x225df){logger[_0xd594('0xf')](_0xd594('0xb'),_0x380fb8,_0x225df);_0x2b7cfc(_0x225df);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 3a8e016..efb7914 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2e5ce0,_0x135679){var _0x2e2a78=function(_0x30775c){while(--_0x30775c){_0x2e5ce0['push'](_0x2e5ce0['shift']());}};_0x2e2a78(++_0x135679);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4116c0,_0xc413cb){var _0x2164a5=function(_0x13805f){while(--_0x13805f){_0x4116c0['push'](_0x4116c0['shift']());}};_0x2164a5(++_0xc413cb);}(_0x70e0,0x17b));var _0x070e=function(_0x2d7cd2,_0x124cac){_0x2d7cd2=_0x2d7cd2-0x0;var _0x321cdc=_0x70e0[_0x2d7cd2];return _0x321cdc;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 155550c..08daec1 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 _0xcad2=['exports','INTEGER'];(function(_0x1a205e,_0x3a8f61){var _0x3be50c=function(_0x33862a){while(--_0x33862a){_0x1a205e['push'](_0x1a205e['shift']());}};_0x3be50c(++_0x3a8f61);}(_0xcad2,0x120));var _0x2cad=function(_0x211cd7,_0x10bed4){_0x211cd7=_0x211cd7-0x0;var _0xf525a3=_0xcad2[_0x211cd7];return _0xf525a3;};'use strict';var Sequelize=require('sequelize');module[_0x2cad('0x0')]={'penalty':{'type':Sequelize[_0x2cad('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8569=['INTEGER'];(function(_0x3ca4d3,_0x4b6cfe){var _0x31988f=function(_0x59e303){while(--_0x59e303){_0x3ca4d3['push'](_0x3ca4d3['shift']());}};_0x31988f(++_0x4b6cfe);}(_0x8569,0x14d));var _0x9856=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x8569[_0x462999];return _0x4b1366;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x9856('0x0')],'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 8622b49..e9a9a62 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 _0xf61e=['bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash','util','../../config/logger','api','moment'];(function(_0x39db27,_0xd5a898){var _0x45b4f7=function(_0x111b6b){while(--_0x111b6b){_0x39db27['push'](_0x39db27['shift']());}};_0x45b4f7(++_0xd5a898);}(_0xf61e,0x191));var _0xef61=function(_0x2e03e3,_0x20521c){_0x2e03e3=_0x2e03e3-0x0;var _0x29b58f=_0xf61e[_0x2e03e3];return _0x29b58f;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var logger=require(_0xef61('0x2'))(_0xef61('0x3'));var moment=require(_0xef61('0x4'));var BPromise=require(_0xef61('0x5'));var rp=require(_0xef61('0x6'));var fs=require('fs');var path=require(_0xef61('0x7'));var rimraf=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var attributes=require(_0xef61('0xa'));module[_0xef61('0xb')]=function(_0x5b00b2,_0x9e17f4){return _0x5b00b2[_0xef61('0xc')]('UserSmsQueue',attributes,{'tableName':_0xef61('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d58=['request-promise','rimraf','../../config/environment','exports','define','user_has_sms_queues','bluebird'];(function(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0x5d58,0x187));var _0x85d5=function(_0x2c9dc2,_0x202761){_0x2c9dc2=_0x2c9dc2-0x0;var _0x105020=_0x5d58[_0x2c9dc2];return _0x105020;};'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('./userSmsQueue.attributes');module[_0x85d5('0x4')]=function(_0x2d457a,_0x578fad){return _0x2d457a[_0x85d5('0x5')]('UserSmsQueue',attributes,{'tableName':_0x85d5('0x6'),'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 27d79ad..69671b6 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 _0xb0b2=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','lodash','util','bluebird'];(function(_0x5c9dde,_0x2b01a7){var _0x5cd179=function(_0x4eb02f){while(--_0x4eb02f){_0x5c9dde['push'](_0x5c9dde['shift']());}};_0x5cd179(++_0x2b01a7);}(_0xb0b2,0x153));var _0x2b0b=function(_0x2dbe0a,_0x764655){_0x2dbe0a=_0x2dbe0a-0x0;var _0x1f2c04=_0xb0b2[_0x2dbe0a];return _0x1f2c04;};'use strict';var _=require(_0x2b0b('0x0'));var util=require(_0x2b0b('0x1'));var moment=require('moment');var BPromise=require(_0x2b0b('0x2'));var rs=require(_0x2b0b('0x3'));var fs=require('fs');var Redis=require(_0x2b0b('0x4'));var db=require(_0x2b0b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2b0b('0x6'));var config=require(_0x2b0b('0x7'));var jayson=require(_0x2b0b('0x8'));var client=jayson['client'][_0x2b0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x396442,_0x14f7e5,_0x48131b){return new BPromise(function(_0x7cb8e4,_0x526517){return client['request'](_0x396442,_0x48131b)[_0x2b0b('0xa')](function(_0x30861a){logger['info'](_0x2b0b('0xb'),_0x14f7e5,_0x2b0b('0xc'));logger[_0x2b0b('0xd')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x14f7e5,_0x2b0b('0xc'),JSON['stringify'](_0x30861a));if(_0x30861a[_0x2b0b('0xe')]){if(_0x30861a[_0x2b0b('0xe')][_0x2b0b('0xf')]===0x1f4){logger[_0x2b0b('0xe')](_0x2b0b('0xb'),_0x14f7e5,_0x30861a[_0x2b0b('0xe')][_0x2b0b('0x10')]);return _0x526517(_0x30861a['error'][_0x2b0b('0x10')]);}logger[_0x2b0b('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x14f7e5,_0x30861a['error']['message']);return _0x7cb8e4(_0x30861a[_0x2b0b('0xe')][_0x2b0b('0x10')]);}else{logger[_0x2b0b('0x11')](_0x2b0b('0xb'),_0x14f7e5,_0x2b0b('0xc'));_0x7cb8e4(_0x30861a[_0x2b0b('0x12')]['message']);}})['catch'](function(_0xf2dfdf){logger[_0x2b0b('0xe')](_0x2b0b('0xb'),_0x14f7e5,_0xf2dfdf);_0x526517(_0xf2dfdf);});});} \ No newline at end of file +var _0xa787=['http','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa787,0x90));var _0x7a78=function(_0x1c13f8,_0x499d19){_0x1c13f8=_0x1c13f8-0x0;var _0x9caceb=_0xa787[_0x1c13f8];return _0x9caceb;};'use strict';var _=require(_0x7a78('0x0'));var util=require(_0x7a78('0x1'));var moment=require(_0x7a78('0x2'));var BPromise=require(_0x7a78('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a78('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7a78('0x5'))(_0x7a78('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7a78('0x7')][_0x7a78('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x386f7a,_0x44521d,_0x5a7666){return new BPromise(function(_0x188de0,_0x4a5567){return client['request'](_0x386f7a,_0x5a7666)[_0x7a78('0x9')](function(_0x19bc52){logger['info'](_0x7a78('0xa'),_0x44521d,_0x7a78('0xb'));logger[_0x7a78('0xc')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x44521d,_0x7a78('0xb'),JSON[_0x7a78('0xd')](_0x19bc52));if(_0x19bc52[_0x7a78('0xe')]){if(_0x19bc52[_0x7a78('0xe')][_0x7a78('0xf')]===0x1f4){logger[_0x7a78('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x44521d,_0x19bc52[_0x7a78('0xe')][_0x7a78('0x10')]);return _0x4a5567(_0x19bc52[_0x7a78('0xe')][_0x7a78('0x10')]);}logger[_0x7a78('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x44521d,_0x19bc52[_0x7a78('0xe')][_0x7a78('0x10')]);return _0x188de0(_0x19bc52[_0x7a78('0xe')][_0x7a78('0x10')]);}else{logger[_0x7a78('0x11')](_0x7a78('0xa'),_0x44521d,_0x7a78('0xb'));_0x188de0(_0x19bc52['result'][_0x7a78('0x10')]);}})[_0x7a78('0x12')](function(_0xe5bfe3){logger[_0x7a78('0xe')](_0x7a78('0xa'),_0x44521d,_0xe5bfe3);_0x4a5567(_0xe5bfe3);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 78fa8c0..14393b7 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 _0x98c5=['exports','INTEGER','sequelize'];(function(_0x5eff93,_0x53e6c7){var _0xfb2f7a=function(_0x2c09a6){while(--_0x2c09a6){_0x5eff93['push'](_0x5eff93['shift']());}};_0xfb2f7a(++_0x53e6c7);}(_0x98c5,0x161));var _0x598c=function(_0x4914ba,_0x3a22ca){_0x4914ba=_0x4914ba-0x0;var _0x339e50=_0x98c5[_0x4914ba];return _0x339e50;};'use strict';var Sequelize=require(_0x598c('0x0'));module[_0x598c('0x1')]={'UserId':{'type':Sequelize[_0x598c('0x2')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xfdb8=['INTEGER','exports'];(function(_0x3cdd2f,_0x1c829e){var _0x59892b=function(_0x5ef867){while(--_0x5ef867){_0x3cdd2f['push'](_0x3cdd2f['shift']());}};_0x59892b(++_0x1c829e);}(_0xfdb8,0x151));var _0x8fdb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdb8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x8fdb('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x8fdb('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 7a8b66b..46ab128 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(_0x1f76d6,_0x5efa0f){var _0x210d68=function(_0xdbe390){while(--_0xdbe390){_0x1f76d6['push'](_0x1f76d6['shift']());}};_0x210d68(++_0x5efa0f);}(_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':'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(_0x1be41c,_0x766919){var _0x711a32=function(_0x2fa13b){while(--_0x2fa13b){_0x1be41c['push'](_0x1be41c['shift']());}};_0x711a32(++_0x766919);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index a3a0e0e..4ec6ae5 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x43c6ba,_0x1fd999){var _0x16de5e=function(_0x5494c6){while(--_0x5494c6){_0x43c6ba['push'](_0x43c6ba['shift']());}};_0x16de5e(++_0x1fd999);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0xcb91[_0x67f95e];return _0x538f5a;};'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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x25d34e,_0xe34085){var _0x6dd7cb=function(_0x303aab){while(--_0x303aab){_0x25d34e['push'](_0x25d34e['shift']());}};_0x6dd7cb(++_0xe34085);}(_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 6fa552a..92f2c1b 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 _0x3f20=['INTEGER','sequelize'];(function(_0x429c08,_0x37c7af){var _0x1606c8=function(_0x24ef5b){while(--_0x24ef5b){_0x429c08['push'](_0x429c08['shift']());}};_0x1606c8(++_0x37c7af);}(_0x3f20,0x137));var _0x03f2=function(_0x2ce06f,_0x59556d){_0x2ce06f=_0x2ce06f-0x0;var _0x378432=_0x3f20[_0x2ce06f];return _0x378432;};'use strict';var Sequelize=require(_0x03f2('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x03f2('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb328=['sequelize','INTEGER'];(function(_0x16dd60,_0x495245){var _0x167e1a=function(_0x13ba49){while(--_0x13ba49){_0x16dd60['push'](_0x16dd60['shift']());}};_0x167e1a(++_0x495245);}(_0xb328,0x104));var _0x8b32=function(_0x57fd1b,_0x2e084e){_0x57fd1b=_0x57fd1b-0x0;var _0x1ea39c=_0xb328[_0x57fd1b];return _0x1ea39c;};'use strict';var Sequelize=require(_0x8b32('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8b32('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 8504dac..4cb4c1e 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 _0xaaf0=['path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x309d93,_0x157662){var _0x2dd61d=function(_0x25ff34){while(--_0x25ff34){_0x309d93['push'](_0x309d93['shift']());}};_0x2dd61d(++_0x157662);}(_0xaaf0,0x166));var _0x0aaf=function(_0x20b53c,_0x43450c){_0x20b53c=_0x20b53c-0x0;var _0x54ebcb=_0xaaf0[_0x20b53c];return _0x54ebcb;};'use strict';var _=require(_0x0aaf('0x0'));var util=require(_0x0aaf('0x1'));var logger=require(_0x0aaf('0x2'))(_0x0aaf('0x3'));var moment=require('moment');var BPromise=require(_0x0aaf('0x4'));var rp=require(_0x0aaf('0x5'));var fs=require('fs');var path=require(_0x0aaf('0x6'));var rimraf=require(_0x0aaf('0x7'));var config=require(_0x0aaf('0x8'));var attributes=require(_0x0aaf('0x9'));module[_0x0aaf('0xa')]=function(_0x1aa932,_0x33a803){return _0x1aa932['define'](_0x0aaf('0xb'),attributes,{'tableName':_0x0aaf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c8a=['exports','define','UserVoiceQueue','util','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x16aede,_0x39319d){var _0x38c8e2=function(_0x3490ef){while(--_0x3490ef){_0x16aede['push'](_0x16aede['shift']());}};_0x38c8e2(++_0x39319d);}(_0x3c8a,0x93));var _0xa3c8=function(_0x2407f7,_0x196839){_0x2407f7=_0x2407f7-0x0;var _0xc02d7c=_0x3c8a[_0x2407f7];return _0xc02d7c;};'use strict';var _=require('lodash');var util=require(_0xa3c8('0x0'));var logger=require('../../config/logger')(_0xa3c8('0x1'));var moment=require(_0xa3c8('0x2'));var BPromise=require('bluebird');var rp=require(_0xa3c8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa3c8('0x4'));var config=require(_0xa3c8('0x5'));var attributes=require('./userVoiceQueue.attributes');module[_0xa3c8('0x6')]=function(_0xbeacc4,_0x99d984){return _0xbeacc4[_0xa3c8('0x7')](_0xa3c8('0x8'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 6ef912e..6c636b2 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 _0xbb38=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','util'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xbb38,0xe3));var _0x8bb3=function(_0x3a8b7c,_0x3e5db2){_0x3a8b7c=_0x3a8b7c-0x0;var _0x40eb80=_0xbb38[_0x3a8b7c];return _0x40eb80;};'use strict';var _=require('lodash');var util=require(_0x8bb3('0x0'));var moment=require(_0x8bb3('0x1'));var BPromise=require(_0x8bb3('0x2'));var rs=require(_0x8bb3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bb3('0x4'))['db'];var utils=require(_0x8bb3('0x5'));var logger=require('../../config/logger')(_0x8bb3('0x6'));var config=require('../../config/environment');var jayson=require(_0x8bb3('0x7'));var client=jayson[_0x8bb3('0x8')][_0x8bb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d6b87,_0x4526bf,_0x202ddb){return new BPromise(function(_0x366e9d,_0x1ac797){return client[_0x8bb3('0xa')](_0x2d6b87,_0x202ddb)[_0x8bb3('0xb')](function(_0x161582){logger['info'](_0x8bb3('0xc'),_0x4526bf,'request\x20sent');logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4526bf,'request\x20sent',JSON[_0x8bb3('0xd')](_0x161582));if(_0x161582[_0x8bb3('0xe')]){if(_0x161582[_0x8bb3('0xe')]['code']===0x1f4){logger['error'](_0x8bb3('0xc'),_0x4526bf,_0x161582[_0x8bb3('0xe')][_0x8bb3('0xf')]);return _0x1ac797(_0x161582[_0x8bb3('0xe')][_0x8bb3('0xf')]);}logger['error'](_0x8bb3('0xc'),_0x4526bf,_0x161582[_0x8bb3('0xe')]['message']);return _0x366e9d(_0x161582['error']['message']);}else{logger[_0x8bb3('0x10')](_0x8bb3('0xc'),_0x4526bf,_0x8bb3('0x11'));_0x366e9d(_0x161582[_0x8bb3('0x12')][_0x8bb3('0xf')]);}})['catch'](function(_0x58be0a){logger[_0x8bb3('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x4526bf,_0x58be0a);_0x1ac797(_0x58be0a);});});} \ No newline at end of file +var _0x753d=['client','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x241c5d,_0x3ed23f){var _0x77650b=function(_0x4d212a){while(--_0x4d212a){_0x241c5d['push'](_0x241c5d['shift']());}};_0x77650b(++_0x3ed23f);}(_0x753d,0x1d5));var _0xd753=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x753d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd753('0x0'));var util=require(_0xd753('0x1'));var moment=require(_0xd753('0x2'));var BPromise=require(_0xd753('0x3'));var rs=require(_0xd753('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd753('0x5'))['db'];var utils=require(_0xd753('0x6'));var logger=require(_0xd753('0x7'))(_0xd753('0x8'));var config=require(_0xd753('0x9'));var jayson=require(_0xd753('0xa'));var client=jayson[_0xd753('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4eb632,_0x6d7bb1,_0x401ba6){return new BPromise(function(_0x4d296b,_0xa4d091){return client[_0xd753('0xc')](_0x4eb632,_0x401ba6)[_0xd753('0xd')](function(_0x1a9815){logger[_0xd753('0xe')](_0xd753('0xf'),_0x6d7bb1,_0xd753('0x10'));logger[_0xd753('0x11')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x6d7bb1,_0xd753('0x10'),JSON[_0xd753('0x12')](_0x1a9815));if(_0x1a9815[_0xd753('0x13')]){if(_0x1a9815[_0xd753('0x13')][_0xd753('0x14')]===0x1f4){logger[_0xd753('0x13')](_0xd753('0xf'),_0x6d7bb1,_0x1a9815[_0xd753('0x13')][_0xd753('0x15')]);return _0xa4d091(_0x1a9815[_0xd753('0x13')][_0xd753('0x15')]);}logger[_0xd753('0x13')](_0xd753('0xf'),_0x6d7bb1,_0x1a9815[_0xd753('0x13')]['message']);return _0x4d296b(_0x1a9815['error']['message']);}else{logger['info'](_0xd753('0xf'),_0x6d7bb1,'request\x20sent');_0x4d296b(_0x1a9815[_0xd753('0x16')][_0xd753('0x15')]);}})[_0xd753('0x17')](function(_0x5b1b2){logger[_0xd753('0x13')](_0xd753('0xf'),_0x6d7bb1,_0x5b1b2);_0xa4d091(_0x5b1b2);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 19d6255..db1250b 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3d91a1,_0x50fb94){var _0x2f781b=function(_0x432fec){while(--_0x432fec){_0x3d91a1['push'](_0x3d91a1['shift']());}};_0x2f781b(++_0x50fb94);}(_0xe706,0xa3));var _0x6e70=function(_0x13bcbb,_0x2eb915){_0x13bcbb=_0x13bcbb-0x0;var _0x457c81=_0xe706[_0x13bcbb];return _0x457c81;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1660a7,_0x4f4ad8){var _0x2f4345=function(_0x16346b){while(--_0x16346b){_0x1660a7['push'](_0x1660a7['shift']());}};_0x2f4345(++_0x4f4ad8);}(_0xe706,0xa3));var _0x6e70=function(_0x50cfc3,_0x526cc6){_0x50cfc3=_0x50cfc3-0x0;var _0x5c11ef=_0xe706[_0x50cfc3];return _0x5c11ef;};'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 c897206..292eb6d 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 _0x4701=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','exports'];(function(_0x45943a,_0x594756){var _0x96f728=function(_0x3de100){while(--_0x3de100){_0x45943a['push'](_0x45943a['shift']());}};_0x96f728(++_0x594756);}(_0x4701,0x1da));var _0x1470=function(_0x51ceae,_0x27bde8){_0x51ceae=_0x51ceae-0x0;var _0x28de08=_0x4701[_0x51ceae];return _0x28de08;};'use strict';var Sequelize=require('sequelize');module[_0x1470('0x0')]={'uniqueid':{'type':Sequelize[_0x1470('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x1470('0x2')},'membername':{'type':Sequelize[_0x1470('0x3')],'allowNull':![],'comment':_0x1470('0x2')},'UserId':{'type':Sequelize[_0x1470('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x1470('0x3')],'allowNull':![],'unique':_0x1470('0x4'),'comment':_0x1470('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x1470('0x3')],'allowNull':![],'unique':_0x1470('0x4'),'comment':_0x1470('0x2')},'penalty':{'type':Sequelize[_0x1470('0x1')](0xb),'defaultValue':0x0,'comment':_0x1470('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x1470('0x2')}}; \ No newline at end of file +var _0x45cb=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x3346fd,_0x4713a5){var _0x3955c0=function(_0x578e46){while(--_0x578e46){_0x3346fd['push'](_0x3346fd['shift']());}};_0x3955c0(++_0x4713a5);}(_0x45cb,0x126));var _0xb45c=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x45cb[_0x1deb03];return _0x189fe7;};'use strict';var Sequelize=require(_0xb45c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xb45c('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xb45c('0x2')},'UserId':{'type':Sequelize[_0xb45c('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xb45c('0x3')],'allowNull':![],'unique':_0xb45c('0x4'),'comment':_0xb45c('0x2')},'VoiceQueueId':{'type':Sequelize[_0xb45c('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0xb45c('0x3')],'allowNull':![],'unique':_0xb45c('0x4'),'comment':_0xb45c('0x2')},'penalty':{'type':Sequelize[_0xb45c('0x1')](0xb),'defaultValue':0x0,'comment':_0xb45c('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xb45c('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index b92dd61..7e44f6e 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 _0xa3b2=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa3b2,0x13b));var _0x2a3b=function(_0x47f7ec,_0x369f9d){_0x47f7ec=_0x47f7ec-0x0;var _0x415101=_0xa3b2[_0x47f7ec];return _0x415101;};'use strict';var EventEmitter=require(_0x2a3b('0x0'));var UserVoiceQueueRt=require(_0x2a3b('0x1'))['db'][_0x2a3b('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x2a3b('0x3')](0x0);var events={'afterCreate':_0x2a3b('0x4'),'afterUpdate':_0x2a3b('0x5'),'afterDestroy':_0x2a3b('0x6')};function emitEvent(_0x58a406){return function(_0x4690e1,_0x1fcb6b,_0x5347c0){UserVoiceQueueRtEvents[_0x2a3b('0x7')](_0x58a406+':'+_0x4690e1['id'],_0x4690e1);UserVoiceQueueRtEvents[_0x2a3b('0x7')](_0x58a406,_0x4690e1);_0x5347c0(null);};}for(var e in events){if(events[_0x2a3b('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x2a3b('0x9')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xb1d5=['UserVoiceQueueRt','save','remove','emit','hook','exports','../../mysqldb'];(function(_0x3c6c8a,_0xf981e2){var _0x40910b=function(_0x356d01){while(--_0x356d01){_0x3c6c8a['push'](_0x3c6c8a['shift']());}};_0x40910b(++_0xf981e2);}(_0xb1d5,0x68));var _0x5b1d=function(_0x5aa28f,_0x5c83fc){_0x5aa28f=_0x5aa28f-0x0;var _0x31d311=_0xb1d5[_0x5aa28f];return _0x31d311;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x5b1d('0x0'))['db'][_0x5b1d('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5b1d('0x2'),'afterUpdate':'update','afterDestroy':_0x5b1d('0x3')};function emitEvent(_0x27451e){return function(_0x1edb74,_0x2eec7a,_0x54b978){UserVoiceQueueRtEvents[_0x5b1d('0x4')](_0x27451e+':'+_0x1edb74['id'],_0x1edb74);UserVoiceQueueRtEvents['emit'](_0x27451e,_0x1edb74);_0x54b978(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x5b1d('0x5')](e,emitEvent(event));}}module[_0x5b1d('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 54e6af8..895550a 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 _0xff86=['rimraf','../../config/environment','exports','define','UserVoiceQueueRt','lodash','util','../../config/logger','moment','path'];(function(_0x2a4172,_0x5bd9f1){var _0x24e48d=function(_0x241747){while(--_0x241747){_0x2a4172['push'](_0x2a4172['shift']());}};_0x24e48d(++_0x5bd9f1);}(_0xff86,0x9b));var _0x6ff8=function(_0x5d5d33,_0x2a434b){_0x5d5d33=_0x5d5d33-0x0;var _0x25becf=_0xff86[_0x5d5d33];return _0x25becf;};'use strict';var _=require(_0x6ff8('0x0'));var util=require(_0x6ff8('0x1'));var logger=require(_0x6ff8('0x2'))('api');var moment=require(_0x6ff8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ff8('0x4'));var rimraf=require(_0x6ff8('0x5'));var config=require(_0x6ff8('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x6ff8('0x7')]=function(_0x324e41,_0x56a103){return _0x324e41[_0x6ff8('0x8')](_0x6ff8('0x9'),attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e18=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','util'];(function(_0x14c0fe,_0xea117c){var _0x69286f=function(_0x4ea1d3){while(--_0x4ea1d3){_0x14c0fe['push'](_0x14c0fe['shift']());}};_0x69286f(++_0xea117c);}(_0x6e18,0xc2));var _0x86e1=function(_0xde11ab,_0x31d360){_0xde11ab=_0xde11ab-0x0;var _0x2fa41a=_0x6e18[_0xde11ab];return _0x2fa41a;};'use strict';var _=require('lodash');var util=require(_0x86e1('0x0'));var logger=require(_0x86e1('0x1'))(_0x86e1('0x2'));var moment=require(_0x86e1('0x3'));var BPromise=require(_0x86e1('0x4'));var rp=require(_0x86e1('0x5'));var fs=require('fs');var path=require(_0x86e1('0x6'));var rimraf=require(_0x86e1('0x7'));var config=require(_0x86e1('0x8'));var attributes=require(_0x86e1('0x9'));module['exports']=function(_0x214ca4,_0x184b25){return _0x214ca4[_0x86e1('0xa')](_0x86e1('0xb'),attributes,{'tableName':_0x86e1('0xc'),'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 a44de47..8fc856d 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 _0x452f=['UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','util','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','register','then','info'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x452f,0xad));var _0xf452=function(_0xb65e77,_0x238c3d){_0xb65e77=_0xb65e77-0x0;var _0x38134b=_0x452f[_0xb65e77];return _0x38134b;};'use strict';var _=require('lodash');var util=require(_0xf452('0x0'));var moment=require('moment');var BPromise=require(_0xf452('0x1'));var rs=require(_0xf452('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf452('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xf452('0x4'));var jayson=require(_0xf452('0x5'));var client=jayson[_0xf452('0x6')][_0xf452('0x7')]({'port':0x232a});config[_0xf452('0x8')]=_['defaults'](config[_0xf452('0x8')],{'host':_0xf452('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf452('0x8')]));require('./userVoiceQueueRt.socket')[_0xf452('0xa')](socket);function respondWithRpcPromise(_0x4a4b54,_0x3539ca,_0x52de42){return new BPromise(function(_0x4a5405,_0x5c0fb6){return client['request'](_0x4a4b54,_0x52de42)[_0xf452('0xb')](function(_0xd0839f){logger[_0xf452('0xc')](_0xf452('0xd'),_0x3539ca,_0xf452('0xe'));logger[_0xf452('0xf')](_0xf452('0x10'),_0x3539ca,_0xf452('0xe'),JSON[_0xf452('0x11')](_0xd0839f));if(_0xd0839f['error']){if(_0xd0839f[_0xf452('0x12')][_0xf452('0x13')]===0x1f4){logger[_0xf452('0x12')](_0xf452('0xd'),_0x3539ca,_0xd0839f['error'][_0xf452('0x14')]);return _0x5c0fb6(_0xd0839f[_0xf452('0x12')][_0xf452('0x14')]);}logger[_0xf452('0x12')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x3539ca,_0xd0839f[_0xf452('0x12')][_0xf452('0x14')]);return _0x4a5405(_0xd0839f['error'][_0xf452('0x14')]);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x3539ca,'request\x20sent');_0x4a5405(_0xd0839f[_0xf452('0x15')]['message']);}})['catch'](function(_0x3a11fd){logger[_0xf452('0x12')](_0xf452('0xd'),_0x3539ca,_0x3a11fd);_0x5c0fb6(_0x3a11fd);});});}exports['GetVoiceQueueRtPauses']=function(_0x3758ba){var _0xd26f3c=this;return new Promise(function(_0x24f277,_0xd532e){return db[_0xf452('0x16')][_0xf452('0x17')]({'raw':_0x3758ba[_0xf452('0x18')]?_0x3758ba[_0xf452('0x18')][_0xf452('0x19')]===undefined?!![]:![]:!![],'where':_0x3758ba[_0xf452('0x18')]?_0x3758ba[_0xf452('0x18')][_0xf452('0x1a')]||null:null,'attributes':[[db[_0xf452('0x1b')]['fn'](_0xf452('0x1c'),db[_0xf452('0x1b')]['fn']('IF',db[_0xf452('0x1b')]['literal'](_0xf452('0x1d')))),_0xf452('0x1e')]]})['then'](function(_0x54ad87){logger[_0xf452('0xc')]('GetVoiceQueueRtPauses',_0x3758ba);logger[_0xf452('0xf')]('GetVoiceQueueRtPauses',_0x3758ba,JSON[_0xf452('0x11')](_0x54ad87));_0x24f277(_0x54ad87);})['catch'](function(_0x17149d){logger[_0xf452('0x12')]('GetVoiceQueueRtPauses',_0x17149d[_0xf452('0x14')],_0x3758ba);_0xd532e(_0xd26f3c[_0xf452('0x12')](0x1f4,_0x17149d[_0xf452('0x14')]));});});}; \ No newline at end of file +var _0x0beb=['client','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','UserVoiceQueueRt','findAll','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x54b45c,_0xbfb39b){var _0x101941=function(_0x54eea5){while(--_0x54eea5){_0x54b45c['push'](_0x54b45c['shift']());}};_0x101941(++_0xbfb39b);}(_0x0beb,0x92));var _0xb0be=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x0beb[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0xb0be('0x0'));var util=require('util');var moment=require(_0xb0be('0x1'));var BPromise=require('bluebird');var rs=require(_0xb0be('0x2'));var fs=require('fs');var Redis=require(_0xb0be('0x3'));var db=require(_0xb0be('0x4'))['db'];var utils=require(_0xb0be('0x5'));var logger=require(_0xb0be('0x6'))(_0xb0be('0x7'));var config=require(_0xb0be('0x8'));var jayson=require(_0xb0be('0x9'));var client=jayson[_0xb0be('0xa')]['http']({'port':0x232a});config[_0xb0be('0xb')]=_[_0xb0be('0xc')](config[_0xb0be('0xb')],{'host':_0xb0be('0xd'),'port':0x18eb});var socket=require(_0xb0be('0xe'))(new Redis(config[_0xb0be('0xb')]));require(_0xb0be('0xf'))['register'](socket);function respondWithRpcPromise(_0x2190e2,_0x55513c,_0x344352){return new BPromise(function(_0x225113,_0x58652a){return client[_0xb0be('0x10')](_0x2190e2,_0x344352)[_0xb0be('0x11')](function(_0x2800d0){logger['info'](_0xb0be('0x12'),_0x55513c,_0xb0be('0x13'));logger[_0xb0be('0x14')](_0xb0be('0x15'),_0x55513c,_0xb0be('0x13'),JSON[_0xb0be('0x16')](_0x2800d0));if(_0x2800d0[_0xb0be('0x17')]){if(_0x2800d0['error']['code']===0x1f4){logger[_0xb0be('0x17')](_0xb0be('0x12'),_0x55513c,_0x2800d0['error'][_0xb0be('0x18')]);return _0x58652a(_0x2800d0[_0xb0be('0x17')][_0xb0be('0x18')]);}logger['error'](_0xb0be('0x12'),_0x55513c,_0x2800d0[_0xb0be('0x17')][_0xb0be('0x18')]);return _0x225113(_0x2800d0[_0xb0be('0x17')][_0xb0be('0x18')]);}else{logger[_0xb0be('0x19')](_0xb0be('0x12'),_0x55513c,_0xb0be('0x13'));_0x225113(_0x2800d0[_0xb0be('0x1a')][_0xb0be('0x18')]);}})[_0xb0be('0x1b')](function(_0x4ad525){logger[_0xb0be('0x17')](_0xb0be('0x12'),_0x55513c,_0x4ad525);_0x58652a(_0x4ad525);});});}exports['GetVoiceQueueRtPauses']=function(_0x19f2e7){var _0x5a6fce=this;return new Promise(function(_0x540f48,_0x7e584d){return db[_0xb0be('0x1c')][_0xb0be('0x1d')]({'raw':_0x19f2e7['options']?_0x19f2e7[_0xb0be('0x1e')][_0xb0be('0x1f')]===undefined?!![]:![]:!![],'where':_0x19f2e7[_0xb0be('0x1e')]?_0x19f2e7['options'][_0xb0be('0x20')]||null:null,'attributes':[[db['sequelize']['fn'](_0xb0be('0x21'),db[_0xb0be('0x22')]['fn']('IF',db[_0xb0be('0x22')][_0xb0be('0x23')](_0xb0be('0x24')))),_0xb0be('0x25')]]})[_0xb0be('0x11')](function(_0x28d221){logger[_0xb0be('0x19')](_0xb0be('0x26'),_0x19f2e7);logger[_0xb0be('0x14')](_0xb0be('0x26'),_0x19f2e7,JSON[_0xb0be('0x16')](_0x28d221));_0x540f48(_0x28d221);})['catch'](function(_0x4c3b31){logger[_0xb0be('0x17')](_0xb0be('0x26'),_0x4c3b31[_0xb0be('0x18')],_0x19f2e7);_0x7e584d(_0x5a6fce[_0xb0be('0x17')](0x1f4,_0x4c3b31['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 35cabdd..8d6b374 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 _0x8ce1=['removeListener','register','./userVoiceQueueRt.events','save','remove','update'];(function(_0x1c580c,_0x1d673a){var _0x3108d9=function(_0x53a595){while(--_0x53a595){_0x1c580c['push'](_0x1c580c['shift']());}};_0x3108d9(++_0x1d673a);}(_0x8ce1,0x152));var _0x18ce=function(_0x40a5b6,_0x26186e){_0x40a5b6=_0x40a5b6-0x0;var _0x351a8e=_0x8ce1[_0x40a5b6];return _0x351a8e;};'use strict';var UserVoiceQueueRtEvents=require(_0x18ce('0x0'));var events=[_0x18ce('0x1'),_0x18ce('0x2'),_0x18ce('0x3')];function createListener(_0x2bb843,_0x2a3465){return function(_0x2617a2){_0x2a3465['emit'](_0x2bb843,_0x2617a2);};}function removeListener(_0x194532,_0xcffe1d){return function(){UserVoiceQueueRtEvents[_0x18ce('0x4')](_0x194532,_0xcffe1d);};}exports[_0x18ce('0x5')]=function(_0x532604){for(var _0x17d12a=0x0,_0x2008ca=events['length'];_0x17d12a<_0x2008ca;_0x17d12a++){var _0x3481fe=events[_0x17d12a];var _0x3e7646=createListener('userVoiceQueueRt:'+_0x3481fe,_0x532604);UserVoiceQueueRtEvents['on'](_0x3481fe,_0x3e7646);}}; \ No newline at end of file +var _0x0f9f=['save','remove','update','emit','removeListener','length','./userVoiceQueueRt.events'];(function(_0x5251b9,_0x3dbb60){var _0x515141=function(_0x5b7976){while(--_0x5b7976){_0x5251b9['push'](_0x5251b9['shift']());}};_0x515141(++_0x3dbb60);}(_0x0f9f,0xae));var _0xf0f9=function(_0x1f4f0b,_0xc6db05){_0x1f4f0b=_0x1f4f0b-0x0;var _0x1be5c2=_0x0f9f[_0x1f4f0b];return _0x1be5c2;};'use strict';var UserVoiceQueueRtEvents=require(_0xf0f9('0x0'));var events=[_0xf0f9('0x1'),_0xf0f9('0x2'),_0xf0f9('0x3')];function createListener(_0x450627,_0x1b5d42){return function(_0x34dfc2){_0x1b5d42[_0xf0f9('0x4')](_0x450627,_0x34dfc2);};}function removeListener(_0x1d7a76,_0x1b4d6c){return function(){UserVoiceQueueRtEvents[_0xf0f9('0x5')](_0x1d7a76,_0x1b4d6c);};}exports['register']=function(_0xcc39d6){for(var _0x4540a2=0x0,_0x53d1e7=events[_0xf0f9('0x6')];_0x4540a2<_0x53d1e7;_0x4540a2++){var _0x2d327a=events[_0x4540a2];var _0x2ce622=createListener('userVoiceQueueRt:'+_0x2d327a,_0xcc39d6);UserVoiceQueueRtEvents['on'](_0x2d327a,_0x2ce622);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 421b893..482ad5a 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x34ba5c,_0xda4615){var _0x1555f9=function(_0x3b7c7b){while(--_0x3b7c7b){_0x34ba5c['push'](_0x34ba5c['shift']());}};_0x1555f9(++_0xda4615);}(_0xe706,0xa3));var _0x6e70=function(_0x3c5d9b,_0x16f3f1){_0x3c5d9b=_0x3c5d9b-0x0;var _0x557a6e=_0xe706[_0x3c5d9b];return _0x557a6e;};'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(_0x14d896,_0x53578b){var _0x28679a=function(_0x14921f){while(--_0x14921f){_0x14d896['push'](_0x14d896['shift']());}};_0x28679a(++_0x53578b);}(_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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 3494c36..a8bfc8f 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 _0x7947=['sequelize','INTEGER'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x7947,0x192));var _0x7794=function(_0x2f7d3d,_0x1c9cde){_0x2f7d3d=_0x2f7d3d-0x0;var _0xf081c1=_0x7947[_0x2f7d3d];return _0xf081c1;};'use strict';var Sequelize=require(_0x7794('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7794('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb434=['exports','INTEGER','sequelize'];(function(_0x3bbde7,_0x344127){var _0x117992=function(_0x1d0170){while(--_0x1d0170){_0x3bbde7['push'](_0x3bbde7['shift']());}};_0x117992(++_0x344127);}(_0xb434,0xd4));var _0x4b43=function(_0x5468bf,_0x48c1ad){_0x5468bf=_0x5468bf-0x0;var _0x3c6c01=_0xb434[_0x5468bf];return _0x3c6c01;};'use strict';var Sequelize=require(_0x4b43('0x0'));module[_0x4b43('0x1')]={'penalty':{'type':Sequelize[_0x4b43('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 1a0b768..5fbb2ac 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 _0x7c8b=['rimraf','../../config/environment','exports','define','user_has_whatsapp_queues','util','api','moment','request-promise','path'];(function(_0x382ea1,_0x357c29){var _0x66a02c=function(_0xeaf41b){while(--_0xeaf41b){_0x382ea1['push'](_0x382ea1['shift']());}};_0x66a02c(++_0x357c29);}(_0x7c8b,0x18b));var _0xb7c8=function(_0x5c05ec,_0xdcc74e){_0x5c05ec=_0x5c05ec-0x0;var _0x255e40=_0x7c8b[_0x5c05ec];return _0x255e40;};'use strict';var _=require('lodash');var util=require(_0xb7c8('0x0'));var logger=require('../../config/logger')(_0xb7c8('0x1'));var moment=require(_0xb7c8('0x2'));var BPromise=require('bluebird');var rp=require(_0xb7c8('0x3'));var fs=require('fs');var path=require(_0xb7c8('0x4'));var rimraf=require(_0xb7c8('0x5'));var config=require(_0xb7c8('0x6'));var attributes=require('./userWhatsappQueue.attributes');module[_0xb7c8('0x7')]=function(_0x2f013b,_0x5430d3){return _0x2f013b[_0xb7c8('0x8')]('UserWhatsappQueue',attributes,{'tableName':_0xb7c8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88d5=['request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','api','moment','bluebird'];(function(_0x4e8d24,_0x80f7ad){var _0x52f58b=function(_0x51a5fa){while(--_0x51a5fa){_0x4e8d24['push'](_0x4e8d24['shift']());}};_0x52f58b(++_0x80f7ad);}(_0x88d5,0xf7));var _0x588d=function(_0x2bd861,_0x54cb3e){_0x2bd861=_0x2bd861-0x0;var _0x2a602e=_0x88d5[_0x2bd861];return _0x2a602e;};'use strict';var _=require(_0x588d('0x0'));var util=require(_0x588d('0x1'));var logger=require('../../config/logger')(_0x588d('0x2'));var moment=require(_0x588d('0x3'));var BPromise=require(_0x588d('0x4'));var rp=require(_0x588d('0x5'));var fs=require('fs');var path=require(_0x588d('0x6'));var rimraf=require(_0x588d('0x7'));var config=require(_0x588d('0x8'));var attributes=require(_0x588d('0x9'));module[_0x588d('0xa')]=function(_0x16e532,_0x48d6ba){return _0x16e532[_0x588d('0xb')](_0x588d('0xc'),attributes,{'tableName':_0x588d('0xd'),'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 217ce14..eef1174 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 _0x6ea1=['lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4dcc15,_0x4ed63){var _0x3952d3=function(_0x53c673){while(--_0x53c673){_0x4dcc15['push'](_0x4dcc15['shift']());}};_0x3952d3(++_0x4ed63);}(_0x6ea1,0x13b));var _0x16ea=function(_0x3dff3f,_0x35fb0e){_0x3dff3f=_0x3dff3f-0x0;var _0x5172e7=_0x6ea1[_0x3dff3f];return _0x5172e7;};'use strict';var _=require(_0x16ea('0x0'));var util=require(_0x16ea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x16ea('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16ea('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x16ea('0x4'))(_0x16ea('0x5'));var config=require('../../config/environment');var jayson=require(_0x16ea('0x6'));var client=jayson[_0x16ea('0x7')][_0x16ea('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x400735,_0x13c655,_0x4ad61c){return new BPromise(function(_0x172195,_0x2c2a2c){return client[_0x16ea('0x9')](_0x400735,_0x4ad61c)['then'](function(_0x21eb8c){logger[_0x16ea('0xa')](_0x16ea('0xb'),_0x13c655,_0x16ea('0xc'));logger[_0x16ea('0xd')](_0x16ea('0xe'),_0x13c655,'request\x20sent',JSON[_0x16ea('0xf')](_0x21eb8c));if(_0x21eb8c[_0x16ea('0x10')]){if(_0x21eb8c['error'][_0x16ea('0x11')]===0x1f4){logger[_0x16ea('0x10')](_0x16ea('0xb'),_0x13c655,_0x21eb8c[_0x16ea('0x10')]['message']);return _0x2c2a2c(_0x21eb8c[_0x16ea('0x10')][_0x16ea('0x12')]);}logger['error'](_0x16ea('0xb'),_0x13c655,_0x21eb8c['error']['message']);return _0x172195(_0x21eb8c[_0x16ea('0x10')][_0x16ea('0x12')]);}else{logger['info'](_0x16ea('0xb'),_0x13c655,_0x16ea('0xc'));_0x172195(_0x21eb8c[_0x16ea('0x13')]['message']);}})[_0x16ea('0x14')](function(_0x46da9f){logger['error'](_0x16ea('0xb'),_0x13c655,_0x46da9f);_0x2c2a2c(_0x46da9f);});});} \ No newline at end of file +var _0x4c22=['../../mysqldb','../../config/logger','../../config/environment','client','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x4c22,0xd9));var _0x24c2=function(_0x18722b,_0xa8255d){_0x18722b=_0x18722b-0x0;var _0x40b95a=_0x4c22[_0x18722b];return _0x40b95a;};'use strict';var _=require(_0x24c2('0x0'));var util=require(_0x24c2('0x1'));var moment=require('moment');var BPromise=require(_0x24c2('0x2'));var rs=require(_0x24c2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x24c2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x24c2('0x5'))('rpc');var config=require(_0x24c2('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x24c2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2692ec,_0x2cc4b2,_0x91fe20){return new BPromise(function(_0x5bd70b,_0x348b55){return client[_0x24c2('0x8')](_0x2692ec,_0x91fe20)['then'](function(_0x52e8f1){logger[_0x24c2('0x9')](_0x24c2('0xa'),_0x2cc4b2,_0x24c2('0xb'));logger['debug'](_0x24c2('0xc'),_0x2cc4b2,_0x24c2('0xb'),JSON['stringify'](_0x52e8f1));if(_0x52e8f1[_0x24c2('0xd')]){if(_0x52e8f1[_0x24c2('0xd')][_0x24c2('0xe')]===0x1f4){logger[_0x24c2('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x2cc4b2,_0x52e8f1['error'][_0x24c2('0xf')]);return _0x348b55(_0x52e8f1[_0x24c2('0xd')][_0x24c2('0xf')]);}logger['error'](_0x24c2('0xa'),_0x2cc4b2,_0x52e8f1[_0x24c2('0xd')][_0x24c2('0xf')]);return _0x5bd70b(_0x52e8f1[_0x24c2('0xd')]['message']);}else{logger[_0x24c2('0x9')](_0x24c2('0xa'),_0x2cc4b2,_0x24c2('0xb'));_0x5bd70b(_0x52e8f1['result'][_0x24c2('0xf')]);}})[_0x24c2('0x10')](function(_0x4878d5){logger[_0x24c2('0xd')](_0x24c2('0xa'),_0x2cc4b2,_0x4878d5);_0x348b55(_0x4878d5);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 350efde..2d5ce31 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 _0xf3be=['exports','multer','util','path','connect-timeout','Router','./variable.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete'];(function(_0x2b380d,_0x33fb20){var _0x51298f=function(_0x4dc87b){while(--_0x4dc87b){_0x2b380d['push'](_0x2b380d['shift']());}};_0x51298f(++_0x33fb20);}(_0xf3be,0x1e1));var _0xef3b=function(_0x45f6fa,_0x236037){_0x45f6fa=_0x45f6fa-0x0;var _0x194c54=_0xf3be[_0x45f6fa];return _0x194c54;};'use strict';var multer=require(_0xef3b('0x0'));var util=require(_0xef3b('0x1'));var path=require(_0xef3b('0x2'));var timeout=require(_0xef3b('0x3'));var express=require('express');var router=express[_0xef3b('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(_0xef3b('0x5'));router[_0xef3b('0x6')]('/',auth['isAuthenticated'](),controller[_0xef3b('0x7')]);router[_0xef3b('0x6')](_0xef3b('0x8'),auth[_0xef3b('0x9')](),controller[_0xef3b('0xa')]);router[_0xef3b('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xef3b('0xc')]('/:id',auth[_0xef3b('0x9')](),controller[_0xef3b('0xd')]);router[_0xef3b('0xe')]('/:id',auth[_0xef3b('0x9')](),controller['destroy']);module[_0xef3b('0xf')]=router; \ No newline at end of file +var _0x7bae=['index','/:id','show','post','create','update','delete','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated'];(function(_0x43b45c,_0x54016c){var _0x178a18=function(_0x1f6534){while(--_0x1f6534){_0x43b45c['push'](_0x43b45c['shift']());}};_0x178a18(++_0x54016c);}(_0x7bae,0x13b));var _0xe7ba=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x7bae[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe7ba('0x3'));var interaction=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var controller=require(_0xe7ba('0x6'));router[_0xe7ba('0x7')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x9')]);router[_0xe7ba('0x7')](_0xe7ba('0xa'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xb')]);router[_0xe7ba('0xc')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xd')]);router['put'](_0xe7ba('0xa'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xe')]);router[_0xe7ba('0xf')](_0xe7ba('0xa'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x10')]);module[_0xe7ba('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 903e9e7..ed474d1 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 _0x9787=['STRING','name','sequelize','exports'];(function(_0x32a656,_0x4a4490){var _0x4380c3=function(_0x51adc8){while(--_0x51adc8){_0x32a656['push'](_0x32a656['shift']());}};_0x4380c3(++_0x4a4490);}(_0x9787,0x122));var _0x7978=function(_0x36d203,_0x3653f3){_0x36d203=_0x36d203-0x0;var _0x2f9e62=_0x9787[_0x36d203];return _0x2f9e62;};'use strict';var Sequelize=require(_0x7978('0x0'));module[_0x7978('0x1')]={'name':{'type':Sequelize[_0x7978('0x2')],'unique':_0x7978('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5a78=['STRING','sequelize','exports'];(function(_0x2fd990,_0x52989d){var _0x22c397=function(_0x28b907){while(--_0x28b907){_0x2fd990['push'](_0x2fd990['shift']());}};_0x22c397(++_0x52989d);}(_0x5a78,0x14e));var _0x85a7=function(_0x54b42e,_0x41f4cd){_0x54b42e=_0x54b42e-0x0;var _0x23cfd7=_0x5a78[_0x54b42e];return _0x23cfd7;};'use strict';var Sequelize=require(_0x85a7('0x0'));module[_0x85a7('0x1')]={'name':{'type':Sequelize[_0x85a7('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x85a7('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 79b0ba5..48fa2f4 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 _0xb1cb=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','destroy','then','Variables','error','stack','name','send','index','map','Variable','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x303be1,_0x11dcfc){var _0x3e0191=function(_0x2a2b1a){while(--_0x2a2b1a){_0x303be1['push'](_0x303be1['shift']());}};_0x3e0191(++_0x11dcfc);}(_0xb1cb,0x1d2));var _0xbb1c=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0xb1cb[_0x334841];return _0x5beb4b;};'use strict';var emlformat=require(_0xbb1c('0x0'));var rimraf=require(_0xbb1c('0x1'));var zipdir=require(_0xbb1c('0x2'));var jsonpatch=require(_0xbb1c('0x3'));var rp=require('request-promise');var moment=require(_0xbb1c('0x4'));var BPromise=require(_0xbb1c('0x5'));var Mustache=require(_0xbb1c('0x6'));var util=require(_0xbb1c('0x7'));var path=require(_0xbb1c('0x8'));var sox=require(_0xbb1c('0x9'));var csv=require('to-csv');var ejs=require(_0xbb1c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb1c('0xb'));var squel=require('squel');var crypto=require(_0xbb1c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbb1c('0xd'));var toCsv=require(_0xbb1c('0xe'));var querystring=require(_0xbb1c('0xf'));var Papa=require(_0xbb1c('0x10'));var Redis=require(_0xbb1c('0x11'));var authService=require(_0xbb1c('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb1c('0x13'));var logger=require(_0xbb1c('0x14'))(_0xbb1c('0x15'));var utils=require(_0xbb1c('0x16'));var config=require(_0xbb1c('0x17'));var licenseUtil=require(_0xbb1c('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xaeced5,_0x494d0b){_0x494d0b=_0x494d0b||0xcc;return function(_0x48f6b4){if(_0x48f6b4){return _0xaeced5[_0xbb1c('0x19')](_0x494d0b);}return _0xaeced5[_0xbb1c('0x1a')](_0x494d0b)[_0xbb1c('0x1b')]();};}function respondWithResult(_0x4788e1,_0x132b25){_0x132b25=_0x132b25||0xc8;return function(_0xd52bba){if(_0xd52bba){return _0x4788e1[_0xbb1c('0x1a')](_0x132b25)['json'](_0xd52bba);}};}function respondWithFilteredResult(_0x57dd24,_0x5eed98){return function(_0x23a243){if(_0x23a243){var _0x550063=typeof _0x5eed98[_0xbb1c('0x1c')]==='undefined'&&typeof _0x5eed98[_0xbb1c('0x1d')]===_0xbb1c('0x1e');var _0x5ed5a2=_0x23a243['count'];var _0x5086c6=_0x550063?0x0:_0x5eed98[_0xbb1c('0x1c')];var _0x31db8e=_0x550063?_0x23a243[_0xbb1c('0x1f')]:_0x5eed98[_0xbb1c('0x1c')]+_0x5eed98[_0xbb1c('0x1d')];var _0x582089;if(_0x31db8e>=_0x5ed5a2){_0x31db8e=_0x5ed5a2;_0x582089=0xc8;}else{_0x582089=0xce;}_0x57dd24['status'](_0x582089);return _0x57dd24[_0xbb1c('0x20')](_0xbb1c('0x21'),_0x5086c6+'-'+_0x31db8e+'/'+_0x5ed5a2)[_0xbb1c('0x22')](_0x23a243);}return null;};}function patchUpdates(_0x52a639){return function(_0x2c20ff){try{jsonpatch[_0xbb1c('0x23')](_0x2c20ff,_0x52a639,!![]);}catch(_0x1133bb){return BPromise['reject'](_0x1133bb);}return _0x2c20ff[_0xbb1c('0x24')]();};}function saveUpdates(_0x508f18,_0x51dabb){return function(_0x2a5e95){if(_0x2a5e95){return _0x2a5e95['update'](_0x508f18)['then'](function(_0x501c16){return _0x501c16;});}return null;};}function removeEntity(_0x1d62dc,_0x4b58ed){return function(_0x122242){if(_0x122242){return _0x122242[_0xbb1c('0x25')]()[_0xbb1c('0x26')](function(){var _0x30157a=_0x122242['get']({'plain':!![]});var _0x25fa8d=_0xbb1c('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x25fa8d,'resourceId':_0x30157a['id']}})[_0xbb1c('0x26')](function(){return _0x122242;});})['then'](function(){_0x1d62dc[_0xbb1c('0x1a')](0xcc)[_0xbb1c('0x1b')]();});}};}function handleEntityNotFound(_0x288d97,_0xd19467){return function(_0x28a5e2){if(!_0x28a5e2){_0x288d97[_0xbb1c('0x19')](0x194);}return _0x28a5e2;};}function handleError(_0x501651,_0x2f66ae){_0x2f66ae=_0x2f66ae||0x1f4;return function(_0xa00ac){logger[_0xbb1c('0x28')](_0xa00ac[_0xbb1c('0x29')]);if(_0xa00ac[_0xbb1c('0x2a')]){delete _0xa00ac[_0xbb1c('0x2a')];}_0x501651[_0xbb1c('0x1a')](_0x2f66ae)[_0xbb1c('0x2b')](_0xa00ac);};}exports[_0xbb1c('0x2c')]=function(_0x30db49,_0x57086a){var _0x32888d={},_0xd39cc2={},_0x4e4849={'count':0x0,'rows':[]};var _0x4d3746=_[_0xbb1c('0x2d')](db[_0xbb1c('0x2e')][_0xbb1c('0x2f')],function(_0x3784ff){return{'name':_0x3784ff[_0xbb1c('0x30')],'type':_0x3784ff['type']['key']};});_0xd39cc2[_0xbb1c('0x31')]=_[_0xbb1c('0x2d')](_0x4d3746,_0xbb1c('0x2a'));_0xd39cc2[_0xbb1c('0x32')]=_[_0xbb1c('0x33')](_0x30db49[_0xbb1c('0x32')]);_0xd39cc2[_0xbb1c('0x34')]=_['intersection'](_0xd39cc2['model'],_0xd39cc2[_0xbb1c('0x32')]);_0x32888d[_0xbb1c('0x35')]=_[_0xbb1c('0x36')](_0xd39cc2[_0xbb1c('0x31')],qs[_0xbb1c('0x37')](_0x30db49['query'][_0xbb1c('0x37')]));_0x32888d['attributes']=_0x32888d[_0xbb1c('0x35')][_0xbb1c('0x38')]?_0x32888d[_0xbb1c('0x35')]:_0xd39cc2[_0xbb1c('0x31')];if(!_0x30db49[_0xbb1c('0x32')]['hasOwnProperty'](_0xbb1c('0x39'))){_0x32888d['limit']=qs[_0xbb1c('0x1d')](_0x30db49[_0xbb1c('0x32')]['limit']);_0x32888d[_0xbb1c('0x1c')]=qs[_0xbb1c('0x1c')](_0x30db49['query']['offset']);}_0x32888d[_0xbb1c('0x3a')]=qs[_0xbb1c('0x3b')](_0x30db49[_0xbb1c('0x32')]['sort']);_0x32888d['where']=qs['filters'](_[_0xbb1c('0x3c')](_0x30db49['query'],_0xd39cc2[_0xbb1c('0x34')]),_0x4d3746);if(_0x30db49['query'][_0xbb1c('0x3d')]){_0x32888d[_0xbb1c('0x3e')]=_['merge'](_0x32888d[_0xbb1c('0x3e')],{'$or':_['map'](_0x4d3746,function(_0x504bef){if(_0x504bef['type']!==_0xbb1c('0x3f')){var _0x1edfd2={};_0x1edfd2[_0x504bef[_0xbb1c('0x2a')]]={'$like':'%'+_0x30db49[_0xbb1c('0x32')][_0xbb1c('0x3d')]+'%'};return _0x1edfd2;}})});}_0x32888d=_[_0xbb1c('0x40')]({},_0x32888d,_0x30db49[_0xbb1c('0x41')]);var _0x35d53a={'where':_0x32888d[_0xbb1c('0x3e')]};return db[_0xbb1c('0x2e')][_0xbb1c('0x1f')](_0x35d53a)['then'](function(_0x16b096){_0x4e4849[_0xbb1c('0x1f')]=_0x16b096;if(_0x30db49[_0xbb1c('0x32')]['includeAll']){_0x32888d[_0xbb1c('0x42')]=[{'all':!![]}];}return db[_0xbb1c('0x2e')][_0xbb1c('0x43')](_0x32888d);})['then'](function(_0x255e92){_0x4e4849['rows']=_0x255e92;return _0x4e4849;})[_0xbb1c('0x26')](respondWithFilteredResult(_0x57086a,_0x32888d))[_0xbb1c('0x44')](handleError(_0x57086a,null));};exports[_0xbb1c('0x45')]=function(_0x19fb65,_0x1230fe){var _0x4246ac={'raw':!![],'where':{'id':_0x19fb65['params']['id']}},_0x5e439b={};_0x5e439b[_0xbb1c('0x31')]=_[_0xbb1c('0x33')](db[_0xbb1c('0x2e')][_0xbb1c('0x2f')]);_0x5e439b[_0xbb1c('0x32')]=_[_0xbb1c('0x33')](_0x19fb65[_0xbb1c('0x32')]);_0x5e439b[_0xbb1c('0x34')]=_[_0xbb1c('0x36')](_0x5e439b['model'],_0x5e439b[_0xbb1c('0x32')]);_0x4246ac[_0xbb1c('0x35')]=_[_0xbb1c('0x36')](_0x5e439b[_0xbb1c('0x31')],qs['fields'](_0x19fb65[_0xbb1c('0x32')][_0xbb1c('0x37')]));_0x4246ac[_0xbb1c('0x35')]=_0x4246ac['attributes'][_0xbb1c('0x38')]?_0x4246ac['attributes']:_0x5e439b[_0xbb1c('0x31')];if(_0x19fb65['query']['includeAll']){_0x4246ac['include']=[{'all':!![]}];}_0x4246ac=_[_0xbb1c('0x40')]({},_0x4246ac,_0x19fb65[_0xbb1c('0x41')]);return db[_0xbb1c('0x2e')][_0xbb1c('0x46')](_0x4246ac)[_0xbb1c('0x26')](handleEntityNotFound(_0x1230fe,null))[_0xbb1c('0x26')](respondWithResult(_0x1230fe,null))[_0xbb1c('0x44')](handleError(_0x1230fe,null));};exports[_0xbb1c('0x47')]=function(_0x84dfc4,_0x5f083c){return db['Variable'][_0xbb1c('0x47')](_0x84dfc4[_0xbb1c('0x48')],{})[_0xbb1c('0x26')](function(_0x5eda7e){var _0x3ef76c=_0x84dfc4[_0xbb1c('0x49')][_0xbb1c('0x4a')]({'plain':!![]});if(!_0x3ef76c)throw new Error(_0xbb1c('0x4b'));if(_0x3ef76c[_0xbb1c('0x4c')]===_0xbb1c('0x49')){var _0x3b5588=_0x5eda7e[_0xbb1c('0x4a')]({'plain':!![]});var _0x1a47bf=_0xbb1c('0x27');return db['UserProfileSection'][_0xbb1c('0x46')]({'where':{'name':_0x1a47bf,'userProfileId':_0x3ef76c[_0xbb1c('0x4d')]},'raw':!![]})[_0xbb1c('0x26')](function(_0x53447b){if(_0x53447b&&_0x53447b[_0xbb1c('0x4e')]===0x0){return db[_0xbb1c('0x4f')][_0xbb1c('0x47')]({'name':_0x3b5588[_0xbb1c('0x2a')],'resourceId':_0x3b5588['id'],'type':_0x53447b[_0xbb1c('0x2a')],'sectionId':_0x53447b['id']},{})[_0xbb1c('0x26')](function(){return _0x5eda7e;});}else{return _0x5eda7e;}})['catch'](function(_0x22ab5b){logger['error'](_0xbb1c('0x50'),_0x22ab5b);throw _0x22ab5b;});}return _0x5eda7e;})[_0xbb1c('0x26')](respondWithResult(_0x5f083c,0xc9))['catch'](handleError(_0x5f083c,null));};exports['update']=function(_0x38507c,_0x4b02ed){if(_0x38507c[_0xbb1c('0x48')]['id']){delete _0x38507c['body']['id'];}return db[_0xbb1c('0x2e')][_0xbb1c('0x46')]({'where':{'id':_0x38507c['params']['id']}})[_0xbb1c('0x26')](handleEntityNotFound(_0x4b02ed,null))[_0xbb1c('0x26')](saveUpdates(_0x38507c[_0xbb1c('0x48')],null))[_0xbb1c('0x26')](respondWithResult(_0x4b02ed,null))[_0xbb1c('0x44')](handleError(_0x4b02ed,null));};exports[_0xbb1c('0x25')]=function(_0x4579a4,_0x194edf){return db[_0xbb1c('0x2e')][_0xbb1c('0x46')]({'where':{'id':_0x4579a4['params']['id']}})['then'](handleEntityNotFound(_0x194edf,null))['then'](removeEntity(_0x194edf,null))[_0xbb1c('0x44')](handleError(_0x194edf,null));}; \ No newline at end of file +var _0xc085=['get','Variables','UserProfileResource','then','end','error','stack','name','send','map','Variable','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','include','findAll','rows','show','keys','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','destroy','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save'];(function(_0x29a7e1,_0xdf7b01){var _0x8a1733=function(_0x5d3e9f){while(--_0x5d3e9f){_0x29a7e1['push'](_0x29a7e1['shift']());}};_0x8a1733(++_0xdf7b01);}(_0xc085,0xc9));var _0x5c08=function(_0x4e0be4,_0x146ded){_0x4e0be4=_0x4e0be4-0x0;var _0x5d4770=_0xc085[_0x4e0be4];return _0x5d4770;};'use strict';var emlformat=require(_0x5c08('0x0'));var rimraf=require(_0x5c08('0x1'));var zipdir=require(_0x5c08('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c08('0x3'));var moment=require(_0x5c08('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5c08('0x5'));var util=require('util');var path=require(_0x5c08('0x6'));var sox=require('sox');var csv=require(_0x5c08('0x7'));var ejs=require(_0x5c08('0x8'));var fs=require('fs');var fs_extra=require(_0x5c08('0x9'));var _=require(_0x5c08('0xa'));var squel=require(_0x5c08('0xb'));var crypto=require('crypto');var jsforce=require(_0x5c08('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5c08('0x7'));var querystring=require('querystring');var Papa=require(_0x5c08('0xd'));var Redis=require('ioredis');var authService=require(_0x5c08('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x5c08('0xf'));var hardwareService=require(_0x5c08('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5c08('0x11'));var db=require(_0x5c08('0x12'))['db'];function respondWithStatusCode(_0x35e62e,_0x558232){_0x558232=_0x558232||0xcc;return function(_0xbe3833){if(_0xbe3833){return _0x35e62e[_0x5c08('0x13')](_0x558232);}return _0x35e62e[_0x5c08('0x14')](_0x558232)['end']();};}function respondWithResult(_0x101b70,_0x384de0){_0x384de0=_0x384de0||0xc8;return function(_0x10cb7c){if(_0x10cb7c){return _0x101b70[_0x5c08('0x14')](_0x384de0)[_0x5c08('0x15')](_0x10cb7c);}};}function respondWithFilteredResult(_0x35d8d5,_0x1c0453){return function(_0x4ddbb6){if(_0x4ddbb6){var _0x3f58b2=typeof _0x1c0453[_0x5c08('0x16')]===_0x5c08('0x17')&&typeof _0x1c0453['limit']==='undefined';var _0x5174ed=_0x4ddbb6[_0x5c08('0x18')];var _0x57425d=_0x3f58b2?0x0:_0x1c0453[_0x5c08('0x16')];var _0x5432cd=_0x3f58b2?_0x4ddbb6['count']:_0x1c0453[_0x5c08('0x16')]+_0x1c0453[_0x5c08('0x19')];var _0x175c63;if(_0x5432cd>=_0x5174ed){_0x5432cd=_0x5174ed;_0x175c63=0xc8;}else{_0x175c63=0xce;}_0x35d8d5[_0x5c08('0x14')](_0x175c63);return _0x35d8d5[_0x5c08('0x1a')](_0x5c08('0x1b'),_0x57425d+'-'+_0x5432cd+'/'+_0x5174ed)['json'](_0x4ddbb6);}return null;};}function patchUpdates(_0x1d865b){return function(_0xe499d4){try{jsonpatch['apply'](_0xe499d4,_0x1d865b,!![]);}catch(_0x57e859){return BPromise[_0x5c08('0x1c')](_0x57e859);}return _0xe499d4[_0x5c08('0x1d')]();};}function saveUpdates(_0x2c1189,_0x4f1d9b){return function(_0x22af0c){if(_0x22af0c){return _0x22af0c['update'](_0x2c1189)['then'](function(_0x4d86af){return _0x4d86af;});}return null;};}function removeEntity(_0x407e37,_0x4aa344){return function(_0x25b28d){if(_0x25b28d){return _0x25b28d['destroy']()['then'](function(){var _0x2f1a40=_0x25b28d[_0x5c08('0x1e')]({'plain':!![]});var _0x22f520=_0x5c08('0x1f');return db[_0x5c08('0x20')]['destroy']({'where':{'type':_0x22f520,'resourceId':_0x2f1a40['id']}})[_0x5c08('0x21')](function(){return _0x25b28d;});})['then'](function(){_0x407e37[_0x5c08('0x14')](0xcc)[_0x5c08('0x22')]();});}};}function handleEntityNotFound(_0x52f38a,_0x5e0b7c){return function(_0x59ad60){if(!_0x59ad60){_0x52f38a[_0x5c08('0x13')](0x194);}return _0x59ad60;};}function handleError(_0x58927a,_0x50afe7){_0x50afe7=_0x50afe7||0x1f4;return function(_0x461bd0){logger[_0x5c08('0x23')](_0x461bd0[_0x5c08('0x24')]);if(_0x461bd0[_0x5c08('0x25')]){delete _0x461bd0[_0x5c08('0x25')];}_0x58927a[_0x5c08('0x14')](_0x50afe7)[_0x5c08('0x26')](_0x461bd0);};}exports['index']=function(_0x2dd2bf,_0x32dac2){var _0x20aa68={},_0x5aedd3={},_0xbd5b7f={'count':0x0,'rows':[]};var _0x146caf=_[_0x5c08('0x27')](db[_0x5c08('0x28')][_0x5c08('0x29')],function(_0x5cb0d7){return{'name':_0x5cb0d7[_0x5c08('0x2a')],'type':_0x5cb0d7[_0x5c08('0x2b')][_0x5c08('0x2c')]};});_0x5aedd3[_0x5c08('0x2d')]=_[_0x5c08('0x27')](_0x146caf,_0x5c08('0x25'));_0x5aedd3[_0x5c08('0x2e')]=_['keys'](_0x2dd2bf[_0x5c08('0x2e')]);_0x5aedd3[_0x5c08('0x2f')]=_[_0x5c08('0x30')](_0x5aedd3['model'],_0x5aedd3[_0x5c08('0x2e')]);_0x20aa68[_0x5c08('0x31')]=_[_0x5c08('0x30')](_0x5aedd3['model'],qs['fields'](_0x2dd2bf[_0x5c08('0x2e')][_0x5c08('0x32')]));_0x20aa68[_0x5c08('0x31')]=_0x20aa68[_0x5c08('0x31')][_0x5c08('0x33')]?_0x20aa68['attributes']:_0x5aedd3[_0x5c08('0x2d')];if(!_0x2dd2bf['query'][_0x5c08('0x34')]('nolimit')){_0x20aa68['limit']=qs[_0x5c08('0x19')](_0x2dd2bf[_0x5c08('0x2e')][_0x5c08('0x19')]);_0x20aa68[_0x5c08('0x16')]=qs[_0x5c08('0x16')](_0x2dd2bf[_0x5c08('0x2e')][_0x5c08('0x16')]);}_0x20aa68[_0x5c08('0x35')]=qs[_0x5c08('0x36')](_0x2dd2bf[_0x5c08('0x2e')]['sort']);_0x20aa68[_0x5c08('0x37')]=qs[_0x5c08('0x2f')](_['pick'](_0x2dd2bf['query'],_0x5aedd3['filters']),_0x146caf);if(_0x2dd2bf[_0x5c08('0x2e')][_0x5c08('0x38')]){_0x20aa68['where']=_[_0x5c08('0x39')](_0x20aa68['where'],{'$or':_[_0x5c08('0x27')](_0x146caf,function(_0x4f03dd){if(_0x4f03dd[_0x5c08('0x2b')]!=='VIRTUAL'){var _0x4ab746={};_0x4ab746[_0x4f03dd[_0x5c08('0x25')]]={'$like':'%'+_0x2dd2bf[_0x5c08('0x2e')][_0x5c08('0x38')]+'%'};return _0x4ab746;}})});}_0x20aa68=_['merge']({},_0x20aa68,_0x2dd2bf[_0x5c08('0x3a')]);var _0x5e2d3f={'where':_0x20aa68[_0x5c08('0x37')]};return db[_0x5c08('0x28')][_0x5c08('0x18')](_0x5e2d3f)['then'](function(_0x31881c){_0xbd5b7f[_0x5c08('0x18')]=_0x31881c;if(_0x2dd2bf['query']['includeAll']){_0x20aa68[_0x5c08('0x3b')]=[{'all':!![]}];}return db['Variable'][_0x5c08('0x3c')](_0x20aa68);})[_0x5c08('0x21')](function(_0x32b394){_0xbd5b7f[_0x5c08('0x3d')]=_0x32b394;return _0xbd5b7f;})[_0x5c08('0x21')](respondWithFilteredResult(_0x32dac2,_0x20aa68))['catch'](handleError(_0x32dac2,null));};exports[_0x5c08('0x3e')]=function(_0x56497a,_0x11ce45){var _0x397694={'raw':!![],'where':{'id':_0x56497a['params']['id']}},_0x4b88f7={};_0x4b88f7[_0x5c08('0x2d')]=_[_0x5c08('0x3f')](db[_0x5c08('0x28')]['rawAttributes']);_0x4b88f7[_0x5c08('0x2e')]=_['keys'](_0x56497a[_0x5c08('0x2e')]);_0x4b88f7[_0x5c08('0x2f')]=_[_0x5c08('0x30')](_0x4b88f7[_0x5c08('0x2d')],_0x4b88f7[_0x5c08('0x2e')]);_0x397694[_0x5c08('0x31')]=_[_0x5c08('0x30')](_0x4b88f7[_0x5c08('0x2d')],qs[_0x5c08('0x32')](_0x56497a[_0x5c08('0x2e')]['fields']));_0x397694[_0x5c08('0x31')]=_0x397694[_0x5c08('0x31')][_0x5c08('0x33')]?_0x397694[_0x5c08('0x31')]:_0x4b88f7[_0x5c08('0x2d')];if(_0x56497a[_0x5c08('0x2e')][_0x5c08('0x40')]){_0x397694[_0x5c08('0x3b')]=[{'all':!![]}];}_0x397694=_[_0x5c08('0x39')]({},_0x397694,_0x56497a['options']);return db[_0x5c08('0x28')][_0x5c08('0x41')](_0x397694)[_0x5c08('0x21')](handleEntityNotFound(_0x11ce45,null))[_0x5c08('0x21')](respondWithResult(_0x11ce45,null))[_0x5c08('0x42')](handleError(_0x11ce45,null));};exports[_0x5c08('0x43')]=function(_0x424cc8,_0x3032eb){return db['Variable']['create'](_0x424cc8[_0x5c08('0x44')],{})[_0x5c08('0x21')](function(_0x30e641){var _0x2c95a0=_0x424cc8[_0x5c08('0x45')][_0x5c08('0x1e')]({'plain':!![]});if(!_0x2c95a0)throw new Error(_0x5c08('0x46'));if(_0x2c95a0[_0x5c08('0x47')]==='user'){var _0x236783=_0x30e641[_0x5c08('0x1e')]({'plain':!![]});var _0x44a779=_0x5c08('0x1f');return db['UserProfileSection'][_0x5c08('0x41')]({'where':{'name':_0x44a779,'userProfileId':_0x2c95a0[_0x5c08('0x48')]},'raw':!![]})['then'](function(_0x4c9dad){if(_0x4c9dad&&_0x4c9dad['autoAssociation']===0x0){return db[_0x5c08('0x20')][_0x5c08('0x43')]({'name':_0x236783['name'],'resourceId':_0x236783['id'],'type':_0x4c9dad[_0x5c08('0x25')],'sectionId':_0x4c9dad['id']},{})[_0x5c08('0x21')](function(){return _0x30e641;});}else{return _0x30e641;}})[_0x5c08('0x42')](function(_0x4ed42a){logger[_0x5c08('0x23')](_0x5c08('0x49'),_0x4ed42a);throw _0x4ed42a;});}return _0x30e641;})['then'](respondWithResult(_0x3032eb,0xc9))[_0x5c08('0x42')](handleError(_0x3032eb,null));};exports[_0x5c08('0x4a')]=function(_0x16a946,_0x141eef){if(_0x16a946['body']['id']){delete _0x16a946[_0x5c08('0x44')]['id'];}return db[_0x5c08('0x28')][_0x5c08('0x41')]({'where':{'id':_0x16a946[_0x5c08('0x4b')]['id']}})[_0x5c08('0x21')](handleEntityNotFound(_0x141eef,null))[_0x5c08('0x21')](saveUpdates(_0x16a946[_0x5c08('0x44')],null))[_0x5c08('0x21')](respondWithResult(_0x141eef,null))[_0x5c08('0x42')](handleError(_0x141eef,null));};exports[_0x5c08('0x4c')]=function(_0x207a21,_0x7791cf){return db[_0x5c08('0x28')]['find']({'where':{'id':_0x207a21[_0x5c08('0x4b')]['id']}})['then'](handleEntityNotFound(_0x7791cf,null))[_0x5c08('0x21')](removeEntity(_0x7791cf,null))[_0x5c08('0x42')](handleError(_0x7791cf,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 3e45d7b..03cfadb 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 _0x9d00=['api','moment','bluebird','../../config/environment','./variable.attributes','exports','Variable','tools_variables','lodash'];(function(_0x1f4da0,_0x33a12d){var _0x578a16=function(_0xe2c242){while(--_0xe2c242){_0x1f4da0['push'](_0x1f4da0['shift']());}};_0x578a16(++_0x33a12d);}(_0x9d00,0x1ca));var _0x09d0=function(_0x46bd50,_0x180902){_0x46bd50=_0x46bd50-0x0;var _0x3c28ea=_0x9d00[_0x46bd50];return _0x3c28ea;};'use strict';var _=require(_0x09d0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x09d0('0x1'));var moment=require(_0x09d0('0x2'));var BPromise=require(_0x09d0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x09d0('0x4'));var attributes=require(_0x09d0('0x5'));module[_0x09d0('0x6')]=function(_0x1e2c99,_0x56d260){return _0x1e2c99['define'](_0x09d0('0x7'),attributes,{'tableName':_0x09d0('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0ca=['api','moment','bluebird','path','../../config/environment','./variable.attributes','exports','Variable','tools_variables','lodash','util'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc0ca,0xfb));var _0xac0c=function(_0x4cf2ab,_0x16c2c2){_0x4cf2ab=_0x4cf2ab-0x0;var _0x145f22=_0xc0ca[_0x4cf2ab];return _0x145f22;};'use strict';var _=require(_0xac0c('0x0'));var util=require(_0xac0c('0x1'));var logger=require('../../config/logger')(_0xac0c('0x2'));var moment=require(_0xac0c('0x3'));var BPromise=require(_0xac0c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac0c('0x5'));var rimraf=require('rimraf');var config=require(_0xac0c('0x6'));var attributes=require(_0xac0c('0x7'));module[_0xac0c('0x8')]=function(_0x1f0834,_0x2a9461){return _0x1f0834['define'](_0xac0c('0x9'),attributes,{'tableName':_0xac0c('0xa'),'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 c781e2c..67b0e01 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 _0x326f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','Variable,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowVariable','Variable','raw','options','include','model','attributes','map','then','stringify','lodash'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x326f,0xd1));var _0xf326=function(_0x81bb80,_0x515709){_0x81bb80=_0x81bb80-0x0;var _0x2ac870=_0x326f[_0x81bb80];return _0x2ac870;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('Variable,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['find']({'raw':_0x453100['options']?_0x453100['options'][_0xf326('0x16')]===undefined?!![]:![]:!![],'where':_0x453100[_0xf326('0x17')]?_0x453100['options']['where']||null:null,'attributes':_0x453100[_0xf326('0x17')]?_0x453100['options']['attributes']||null:null,'include':_0x453100[_0xf326('0x17')]?_0x453100[_0xf326('0x17')]['include']?_['map'](_0x453100[_0xf326('0x17')][_0xf326('0x18')],function(_0x5f21a2){return{'model':db[_0x5f21a2[_0xf326('0x19')]],'as':_0x5f21a2['as'],'attributes':_0x5f21a2[_0xf326('0x1a')],'include':_0x5f21a2[_0xf326('0x18')]?_[_0xf326('0x1b')](_0x5f21a2[_0xf326('0x18')],function(_0x2049ec){return{'model':db[_0x2049ec['model']],'as':_0x2049ec['as'],'attributes':_0x2049ec['attributes'],'include':_0x2049ec['include']?_[_0xf326('0x1b')](_0x2049ec[_0xf326('0x18')],function(_0x2cd45a){return{'model':db[_0x2cd45a[_0xf326('0x19')]],'as':_0x2cd45a['as'],'attributes':_0x2cd45a[_0xf326('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf326('0x1c')](function(_0x5217d4){logger[_0xf326('0xb')](_0xf326('0x14'),_0x453100);logger[_0xf326('0xe')]('ShowVariable',_0x453100,JSON[_0xf326('0x1d')](_0x5217d4));_0x31ffb9(_0x5217d4);})['catch'](function(_0x4a9abf){logger[_0xf326('0xf')](_0xf326('0x14'),_0x4a9abf[_0xf326('0x11')],_0x453100);_0xcef2b5(_0x18bee3['error'](0x1f4,_0x4a9abf[_0xf326('0x11')]));});});}; \ 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(_0x4f0c2b,_0x2c9d14){var _0x526436=function(_0x2e13b6){while(--_0x2e13b6){_0x4f0c2b['push'](_0x4f0c2b['shift']());}};_0x526436(++_0x2c9d14);}(_0x55ca,0x126));var _0xa55c=function(_0x16b992,_0x43d74c){_0x16b992=_0x16b992-0x0;var _0x385c78=_0x55ca[_0x16b992];return _0x385c78;};'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 6f2ce56..7dd7682 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 _0x7a0a=['express','Router','../../components/auth/service','./version.controller','get','index','isAuthenticated','canUpdate','reset','/pull','pull','/restart','restart','/migrations','migrations','exports'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x7a0a,0x100));var _0xa7a0=function(_0x5df5b7,_0x4ff315){_0x5df5b7=_0x5df5b7-0x0;var _0x1adb5f=_0x7a0a[_0x5df5b7];return _0x1adb5f;};'use strict';var express=require(_0xa7a0('0x0'));var router=express[_0xa7a0('0x1')]();var auth=require(_0xa7a0('0x2'));var controller=require(_0xa7a0('0x3'));router[_0xa7a0('0x4')]('/',controller[_0xa7a0('0x5')]);router[_0xa7a0('0x4')]('/fetch',auth[_0xa7a0('0x6')](),auth[_0xa7a0('0x7')](),controller['fetch']);router[_0xa7a0('0x4')]('/reset',auth[_0xa7a0('0x6')](),auth[_0xa7a0('0x7')](),controller[_0xa7a0('0x8')]);router[_0xa7a0('0x4')](_0xa7a0('0x9'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xa7a0('0xa')]);router['get'](_0xa7a0('0xb'),auth[_0xa7a0('0x6')](),controller[_0xa7a0('0xc')]);router['get'](_0xa7a0('0xd'),controller[_0xa7a0('0xe')]);module[_0xa7a0('0xf')]=router; \ No newline at end of file +var _0x844a=['isAuthenticated','fetch','/pull','canUpdate','pull','/restart','restart','/migrations','migrations','exports','express','Router','./version.controller','get','index','/fetch'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x844a,0x1da));var _0xa844=function(_0x4074c9,_0x4e91a6){_0x4074c9=_0x4074c9-0x0;var _0x1f1cb4=_0x844a[_0x4074c9];return _0x1f1cb4;};'use strict';var express=require(_0xa844('0x0'));var router=express[_0xa844('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xa844('0x2'));router[_0xa844('0x3')]('/',controller[_0xa844('0x4')]);router['get'](_0xa844('0x5'),auth[_0xa844('0x6')](),auth['canUpdate'](),controller[_0xa844('0x7')]);router[_0xa844('0x3')]('/reset',auth[_0xa844('0x6')](),auth['canUpdate'](),controller['reset']);router[_0xa844('0x3')](_0xa844('0x8'),auth['isAuthenticated'](),auth[_0xa844('0x9')](),controller[_0xa844('0xa')]);router['get'](_0xa844('0xb'),auth['isAuthenticated'](),controller[_0xa844('0xc')]);router[_0xa844('0x3')](_0xa844('0xd'),controller[_0xa844('0xe')]);module[_0xa844('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 1cc16e6..7f07c16 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 _0xae49=['.js','push','sequelize','Migration','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','then','\x20to\x20','join','UniqueConstraintError','Database\x20already\x20up-to-date','version','child_process','../../mysqldb','simple-git','root','exports','query','latest','fetch','tags','2.0.0','status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','length','replace'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xae49,0x1a9));var _0x9ae4=function(_0x24bd67,_0x254d81){_0x24bd67=_0x24bd67-0x0;var _0x11db23=_0xae49[_0x24bd67];return _0x11db23;};'use strict';var Umzug=require('umzug');var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0x9ae4('0x0'));var compareVersions=require('compare-versions');var exec=require(_0x9ae4('0x1'))['exec'];var db=require(_0x9ae4('0x2'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require('../../config/logger')('update');var git=require(_0x9ae4('0x3'))(config[_0x9ae4('0x4')]);exports['index']=function(_0x5f2aee,_0x31cc9b){var _0x173fcf={'current':module[_0x9ae4('0x5')][_0x9ae4('0x0')],'phonebar':0x2};if(_0x5f2aee[_0x9ae4('0x6')]&&_0x5f2aee[_0x9ae4('0x6')][_0x9ae4('0x7')]){return git[_0x9ae4('0x8')]()[_0x9ae4('0x9')](function(_0x41faa1,_0x1fb5c7){_0x173fcf[_0x9ae4('0x7')]=(_0x41faa1?module[_0x9ae4('0x5')]['version']:_0x1fb5c7[_0x9ae4('0x7')])||_0x9ae4('0xa');return _0x31cc9b[_0x9ae4('0xb')](0xc8)['json'](_0x173fcf);});}else{return _0x31cc9b[_0x9ae4('0xb')](0xc8)[_0x9ae4('0xc')](_0x173fcf);}};exports[_0x9ae4('0x8')]=function(_0x2b23b9,_0xf5441e){return git[_0x9ae4('0x8')](['origin',_0x9ae4('0xd')],function(_0x221a62){if(_0x221a62){logger[_0x9ae4('0xe')](_0x221a62);return _0xf5441e[_0x9ae4('0xb')](0x1f4)[_0x9ae4('0xc')](_0x221a62);}logger[_0x9ae4('0xf')](_0x9ae4('0x10'));return _0xf5441e[_0x9ae4('0xb')](0xc8)[_0x9ae4('0xc')]({'output':_0x9ae4('0x11')});});};exports[_0x9ae4('0x12')]=function(_0x191fb7,_0x42fbb7){return git[_0x9ae4('0x12')]([_0x9ae4('0x13'),_0x9ae4('0x14')],function(_0x5bdada){if(_0x5bdada){logger[_0x9ae4('0xe')](_0x5bdada);return _0x42fbb7['status'](0x1f4)[_0x9ae4('0xc')](_0x5bdada);}logger[_0x9ae4('0xf')](_0x9ae4('0x15'));return _0x42fbb7['status'](0xc8)[_0x9ae4('0xc')]({'output':_0x9ae4('0x16')});});};exports[_0x9ae4('0x17')]=function(_0x18bc88,_0x594540){exec(_0x9ae4('0x18'),function(_0x9f1cf7,_0x18a1e5,_0x18b790){logger['info'](_0x18a1e5);logger[_0x9ae4('0xf')](_0x18b790);if(_0x9f1cf7){logger[_0x9ae4('0xe')](_0x9f1cf7);return _0x594540[_0x9ae4('0xb')](0x1f4)[_0x9ae4('0xc')](_0x9f1cf7);}return _0x594540['status'](0xc8)[_0x9ae4('0xc')]({'output':_0x18a1e5});});};exports[_0x9ae4('0x19')]=function(_0x23421a,_0x4f80cb){return pm2['restart'](_0x9ae4('0x1a'))['then'](function(_0x262b57){logger[_0x9ae4('0xf')](_0x9ae4('0x1b'),_0x262b57);return _0x4f80cb[_0x9ae4('0xb')](0xc8)['json']({'output':_0x9ae4('0x1c')});})[_0x9ae4('0x1d')](function(_0x458431){logger['error'](_0x458431);return _0x4f80cb['status'](0x1f4)['json'](_0x458431);});};exports[_0x9ae4('0x1e')]=function(_0x610c5a,_0x553210){var _0x16b646=fs[_0x9ae4('0x1f')](path['join'](config[_0x9ae4('0x4')],_0x9ae4('0x20'),'migrations'));var _0x2b1f25=[];for(var _0x50c5b0=0x0;_0x50c5b0<_0x16b646[_0x9ae4('0x21')];_0x50c5b0++){var _0x38806a=_0x16b646[_0x50c5b0][_0x9ae4('0x22')](_0x9ae4('0x23'),'');if(compareVersions(module[_0x9ae4('0x5')][_0x9ae4('0x0')],_0x38806a)===-0x1){_0x2b1f25[_0x9ae4('0x24')](_0x38806a);}}if(_0x2b1f25['length']){var _0xd66691=_0x2b1f25['sort'](compareVersions);var _0x1b4352=new Umzug({'storage':_0x9ae4('0x25'),'storageOptions':{'model':db[_0x9ae4('0x26')],'modelName':_0x9ae4('0x26'),'columnName':_0x9ae4('0x0')},'migrations':{'params':[db[_0x9ae4('0x25')]['getQueryInterface'](),db[_0x9ae4('0x25')]['constructor'],function(){throw new Error(_0x9ae4('0x27'));}],'path':path['join'](config[_0x9ae4('0x4')],_0x9ae4('0x20'),'migrations'),'pattern':/\.js$/}});_0x1b4352['up']({'migrations':_[_0x9ae4('0x28')](_0xd66691,function(_0x302538){return _0x302538+_0x9ae4('0x23');})})[_0x9ae4('0x29')](function(){return _0x553210[_0x9ae4('0xb')](0xc8)[_0x9ae4('0xc')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x9ae4('0x5')][_0x9ae4('0x0')]+_0x9ae4('0x2a')+_['last'](_0xd66691),'migrations':_[_0x9ae4('0x2b')](_0xd66691)});})[_0x9ae4('0x1d')](function(_0x1c984f){if(_0x1c984f instanceof db['sequelize'][_0x9ae4('0x2c')]){return _0x553210[_0x9ae4('0xb')](0xc8)[_0x9ae4('0xc')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x553210[_0x9ae4('0xb')](0x1f4)[_0x9ae4('0xc')](_0x1c984f);}});}else{return _0x553210[_0x9ae4('0xb')](0xc8)[_0x9ae4('0xc')]({'output':_0x9ae4('0x2d')});}}; \ No newline at end of file +var _0xad2b=['.js','push','sort','Migration','sequelize','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','pkginfo','child_process','../../config/environment','../../config/logger','update','root','exports','query','latest','tags','version','2.0.0','json','status','fetch','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','server','length'];(function(_0x39efbf,_0x118364){var _0xcbd510=function(_0x4e152f){while(--_0x4e152f){_0x39efbf['push'](_0x39efbf['shift']());}};_0xcbd510(++_0x118364);}(_0xad2b,0x9e));var _0xbad2=function(_0x82a6cc,_0x542de2){_0x82a6cc=_0x82a6cc-0x0;var _0x220ce8=_0xad2b[_0x82a6cc];return _0x220ce8;};'use strict';var Umzug=require('umzug');var path=require(_0xbad2('0x0'));var fs=require('fs');var _=require(_0xbad2('0x1'));var pkginfo=require(_0xbad2('0x2'))(module,'version');var compareVersions=require('compare-versions');var exec=require(_0xbad2('0x3'))['exec'];var db=require('../../mysqldb')['db'];var config=require(_0xbad2('0x4'));var pm2=require('../../config/pm2');var logger=require(_0xbad2('0x5'))(_0xbad2('0x6'));var git=require('simple-git')(config[_0xbad2('0x7')]);exports['index']=function(_0x259c0d,_0x205d32){var _0x10d257={'current':module[_0xbad2('0x8')]['version'],'phonebar':0x2};if(_0x259c0d['query']&&_0x259c0d[_0xbad2('0x9')][_0xbad2('0xa')]){return git['fetch']()[_0xbad2('0xb')](function(_0x402ffe,_0x56c305){_0x10d257[_0xbad2('0xa')]=(_0x402ffe?module[_0xbad2('0x8')][_0xbad2('0xc')]:_0x56c305[_0xbad2('0xa')])||_0xbad2('0xd');return _0x205d32['status'](0xc8)[_0xbad2('0xe')](_0x10d257);});}else{return _0x205d32[_0xbad2('0xf')](0xc8)[_0xbad2('0xe')](_0x10d257);}};exports[_0xbad2('0x10')]=function(_0x3d6865,_0x5a5c24){return git[_0xbad2('0x10')](['origin',_0xbad2('0x11')],function(_0x225426){if(_0x225426){logger[_0xbad2('0x12')](_0x225426);return _0x5a5c24[_0xbad2('0xf')](0x1f4)[_0xbad2('0xe')](_0x225426);}logger[_0xbad2('0x13')]('git\x20fetch');return _0x5a5c24[_0xbad2('0xf')](0xc8)[_0xbad2('0xe')]({'output':_0xbad2('0x14')});});};exports[_0xbad2('0x15')]=function(_0x3b0149,_0x5a0e29){return git[_0xbad2('0x15')]([_0xbad2('0x16'),'FETCH_HEAD'],function(_0x3c667a){if(_0x3c667a){logger[_0xbad2('0x12')](_0x3c667a);return _0x5a0e29[_0xbad2('0xf')](0x1f4)[_0xbad2('0xe')](_0x3c667a);}logger[_0xbad2('0x13')](_0xbad2('0x17'));return _0x5a0e29[_0xbad2('0xf')](0xc8)[_0xbad2('0xe')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x29ce50,_0x7b251c){exec(_0xbad2('0x18'),function(_0xbe6fac,_0x3da6da,_0x819008){logger[_0xbad2('0x13')](_0x3da6da);logger[_0xbad2('0x13')](_0x819008);if(_0xbe6fac){logger['error'](_0xbe6fac);return _0x7b251c[_0xbad2('0xf')](0x1f4)['json'](_0xbe6fac);}return _0x7b251c['status'](0xc8)[_0xbad2('0xe')]({'output':_0x3da6da});});};exports[_0xbad2('0x19')]=function(_0x560673,_0x235391){return pm2[_0xbad2('0x19')](_0xbad2('0x1a'))[_0xbad2('0x1b')](function(_0x13dc5b){logger[_0xbad2('0x13')]('pm2\x20restart\x20motion\x20%s',_0x13dc5b);return _0x235391['status'](0xc8)[_0xbad2('0xe')]({'output':_0xbad2('0x1c')});})['catch'](function(_0x4d9abf){logger[_0xbad2('0x12')](_0x4d9abf);return _0x235391[_0xbad2('0xf')](0x1f4)['json'](_0x4d9abf);});};exports[_0xbad2('0x1d')]=function(_0x45aef8,_0x4c83e0){var _0x8efec3=fs[_0xbad2('0x1e')](path[_0xbad2('0x1f')](config[_0xbad2('0x7')],_0xbad2('0x20'),_0xbad2('0x1d')));var _0xf5745a=[];for(var _0xe970fd=0x0;_0xe970fd<_0x8efec3[_0xbad2('0x21')];_0xe970fd++){var _0x28a990=_0x8efec3[_0xe970fd]['replace'](_0xbad2('0x22'),'');if(compareVersions(module['exports'][_0xbad2('0xc')],_0x28a990)===-0x1){_0xf5745a[_0xbad2('0x23')](_0x28a990);}}if(_0xf5745a[_0xbad2('0x21')]){var _0xdb2ec1=_0xf5745a[_0xbad2('0x24')](compareVersions);var _0xb8d0b=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xbad2('0x25')],'modelName':_0xbad2('0x25'),'columnName':_0xbad2('0xc')},'migrations':{'params':[db[_0xbad2('0x26')][_0xbad2('0x27')](),db[_0xbad2('0x26')][_0xbad2('0x28')],function(){throw new Error(_0xbad2('0x29'));}],'path':path[_0xbad2('0x1f')](config['root'],_0xbad2('0x20'),_0xbad2('0x1d')),'pattern':/\.js$/}});_0xb8d0b['up']({'migrations':_['map'](_0xdb2ec1,function(_0x38f2d6){return _0x38f2d6+_0xbad2('0x22');})})[_0xbad2('0x1b')](function(){return _0x4c83e0['status'](0xc8)[_0xbad2('0xe')]({'output':_0xbad2('0x2a')+module[_0xbad2('0x8')][_0xbad2('0xc')]+_0xbad2('0x2b')+_[_0xbad2('0x2c')](_0xdb2ec1),'migrations':_[_0xbad2('0x1f')](_0xdb2ec1)});})[_0xbad2('0x2d')](function(_0x1382c6){if(_0x1382c6 instanceof db['sequelize'][_0xbad2('0x2e')]){return _0x4c83e0['status'](0xc8)[_0xbad2('0xe')]({'output':_0xbad2('0x2f')});}else{return _0x4c83e0['status'](0x1f4)[_0xbad2('0xe')](_0x1382c6);}});}else{return _0x4c83e0[_0xbad2('0xf')](0xc8)['json']({'output':_0xbad2('0x2f')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 9c2af4a..93b013e 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 _0x35dd=['./voiceAgentReport.controller','get','isAuthenticated','/describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x5a1cc9,_0x28f54d){var _0x471761=function(_0xda51c0){while(--_0xda51c0){_0x5a1cc9['push'](_0x5a1cc9['shift']());}};_0x471761(++_0x28f54d);}(_0x35dd,0x8b));var _0xd35d=function(_0x488ce0,_0x33808d){_0x488ce0=_0x488ce0-0x0;var _0xa30a46=_0x35dd[_0x488ce0];return _0xa30a46;};'use strict';var multer=require(_0xd35d('0x0'));var util=require(_0xd35d('0x1'));var path=require(_0xd35d('0x2'));var timeout=require(_0xd35d('0x3'));var express=require('express');var router=express[_0xd35d('0x4')]();var fs_extra=require(_0xd35d('0x5'));var auth=require(_0xd35d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd35d('0x7'));var controller=require(_0xd35d('0x8'));router[_0xd35d('0x9')]('/',auth[_0xd35d('0xa')](),controller['index']);router[_0xd35d('0x9')](_0xd35d('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xd35d('0xa')](),controller[_0xd35d('0xc')]);router[_0xd35d('0xd')]('/',auth[_0xd35d('0xa')](),controller[_0xd35d('0xe')]);router[_0xd35d('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xd35d('0x10')]);router[_0xd35d('0x11')](_0xd35d('0x12'),auth[_0xd35d('0xa')](),controller[_0xd35d('0x13')]);module[_0xd35d('0x14')]=router; \ No newline at end of file +var _0x5c72=['destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','/:id','post','create','put','update','delete'];(function(_0x265fe8,_0x519708){var _0xb04d53=function(_0x5a7bc7){while(--_0x5a7bc7){_0x265fe8['push'](_0x265fe8['shift']());}};_0xb04d53(++_0x519708);}(_0x5c72,0x158));var _0x25c7=function(_0x38139e,_0x39b1f5){_0x38139e=_0x38139e-0x0;var _0x5d97a3=_0x5c72[_0x38139e];return _0x5d97a3;};'use strict';var multer=require('multer');var util=require(_0x25c7('0x0'));var path=require(_0x25c7('0x1'));var timeout=require(_0x25c7('0x2'));var express=require('express');var router=express[_0x25c7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x25c7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x25c7('0x5'));var controller=require(_0x25c7('0x6'));router[_0x25c7('0x7')]('/',auth[_0x25c7('0x8')](),controller['index']);router[_0x25c7('0x7')](_0x25c7('0x9'),auth[_0x25c7('0x8')](),controller['describe']);router[_0x25c7('0x7')](_0x25c7('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x25c7('0xb')]('/',auth['isAuthenticated'](),controller[_0x25c7('0xc')]);router[_0x25c7('0xd')]('/:id',auth[_0x25c7('0x8')](),controller[_0x25c7('0xe')]);router[_0x25c7('0xf')](_0x25c7('0xa'),auth[_0x25c7('0x8')](),controller[_0x25c7('0x10')]);module[_0x25c7('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 cf2d0cd..29061cc 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 _0x578c=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x5e2800,_0x99396a){var _0xb72b6c=function(_0x27d165){while(--_0x27d165){_0x5e2800['push'](_0x5e2800['shift']());}};_0xb72b6c(++_0x99396a);}(_0x578c,0x158));var _0xc578=function(_0x5c2f1a,_0x42fca0){_0x5c2f1a=_0x5c2f1a-0x0;var _0x1e277e=_0x578c[_0x5c2f1a];return _0x1e277e;};'use strict';var Sequelize=require(_0xc578('0x0'));module[_0xc578('0x1')]={'type':{'type':Sequelize[_0xc578('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc578('0x2')]},'calleridname':{'type':Sequelize[_0xc578('0x2')]},'queue':{'type':Sequelize[_0xc578('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc578('0x2')]},'agentcalledAt':{'type':Sequelize[_0xc578('0x3')]},'agentconnectAt':{'type':Sequelize[_0xc578('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xc578('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xc578('0x3')]},'agentdumpAt':{'type':Sequelize[_0xc578('0x3')]},'holdtime':{'type':Sequelize[_0xc578('0x4')]},'agentcomplete':{'type':Sequelize[_0xc578('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xc578('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xc578('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc578('0x4')]},'agentacw':{'type':Sequelize[_0xc578('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc578('0x4')]},'reason':{'type':Sequelize[_0xc578('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xc578('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xc578('0x2')]},'connectedlinename':{'type':Sequelize[_0xc578('0x2')]},'language':{'type':Sequelize[_0xc578('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc578('0x2')]},'exten':{'type':Sequelize[_0xc578('0x2')]},'priority':{'type':Sequelize[_0xc578('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc578('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xc578('0x2')]},'destcalleridnum':{'type':Sequelize[_0xc578('0x2')]},'destcalleridname':{'type':Sequelize[_0xc578('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc578('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xc578('0x2')]},'destaccountcode':{'type':Sequelize[_0xc578('0x2')]},'destcontext':{'type':Sequelize[_0xc578('0x2')]},'destexten':{'type':Sequelize[_0xc578('0x2')]},'destpriority':{'type':Sequelize[_0xc578('0x2')]},'destuniqueid':{'type':Sequelize[_0xc578('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xc578('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xc578('0x2')]},'transfer':{'type':Sequelize[_0xc578('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc578('0x2')],'comment':_0xc578('0x6')},'transferexten':{'type':Sequelize[_0xc578('0x2')]},'transferuniqueid':{'type':Sequelize[_0xc578('0x2')]},'agententerreason':{'type':Sequelize[_0xc578('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x26b2=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x31bab3,_0x44554f){var _0x4fd382=function(_0x42b336){while(--_0x42b336){_0x31bab3['push'](_0x31bab3['shift']());}};_0x4fd382(++_0x44554f);}(_0x26b2,0xc5));var _0x226b=function(_0x1b7bdb,_0x5c7d09){_0x1b7bdb=_0x1b7bdb-0x0;var _0x5d4dbd=_0x26b2[_0x1b7bdb];return _0x5d4dbd;};'use strict';var Sequelize=require(_0x226b('0x0'));module[_0x226b('0x1')]={'type':{'type':Sequelize[_0x226b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x226b('0x2')]},'calleridname':{'type':Sequelize[_0x226b('0x2')]},'queue':{'type':Sequelize[_0x226b('0x2')]},'interface':{'type':Sequelize[_0x226b('0x2')]},'membername':{'type':Sequelize[_0x226b('0x2')]},'agentcalledAt':{'type':Sequelize[_0x226b('0x3')]},'agentconnectAt':{'type':Sequelize[_0x226b('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x226b('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x226b('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x226b('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x226b('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x226b('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x226b('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x226b('0x2')]},'lastevent':{'type':Sequelize[_0x226b('0x2')]},'channel':{'type':Sequelize[_0x226b('0x2')]},'channelstate':{'type':Sequelize[_0x226b('0x4')]},'channelstatedesc':{'type':Sequelize[_0x226b('0x2')]},'connectedlinenum':{'type':Sequelize[_0x226b('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x226b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x226b('0x2')]},'exten':{'type':Sequelize[_0x226b('0x2')]},'priority':{'type':Sequelize[_0x226b('0x2')]},'destchannel':{'type':Sequelize[_0x226b('0x2')]},'destchannelstate':{'type':Sequelize[_0x226b('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x226b('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x226b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x226b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x226b('0x2')]},'destlanguage':{'type':Sequelize[_0x226b('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x226b('0x2')]},'destexten':{'type':Sequelize[_0x226b('0x2')]},'destpriority':{'type':Sequelize[_0x226b('0x2')]},'destuniqueid':{'type':Sequelize[_0x226b('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x226b('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x226b('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x226b('0x2')],'comment':_0x226b('0x6')},'transferexten':{'type':Sequelize[_0x226b('0x2')]},'transferuniqueid':{'type':Sequelize[_0x226b('0x2')]},'agententerreason':{'type':Sequelize[_0x226b('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 22cf22d..47b291f 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(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 673898f..006a9c2 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 _0x9a14=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceAgentReport','report_agent','destuniqueid'];(function(_0x21c2f9,_0x2f2bb6){var _0x149fac=function(_0xdb4bf5){while(--_0xdb4bf5){_0x21c2f9['push'](_0x21c2f9['shift']());}};_0x149fac(++_0x2f2bb6);}(_0x9a14,0xa8));var _0x49a1=function(_0x5ccc15,_0x328351){_0x5ccc15=_0x5ccc15-0x0;var _0x2ab60c=_0x9a14[_0x5ccc15];return _0x2ab60c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x49a1('0x0'))(_0x49a1('0x1'));var moment=require(_0x49a1('0x2'));var BPromise=require(_0x49a1('0x3'));var rp=require(_0x49a1('0x4'));var fs=require('fs');var path=require(_0x49a1('0x5'));var rimraf=require(_0x49a1('0x6'));var config=require(_0x49a1('0x7'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x479018,_0x5283aa){return _0x479018[_0x49a1('0x8')](_0x49a1('0x9'),attributes,{'tableName':_0x49a1('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x49a1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4fd7=['util','../../config/logger','api','request-promise','path','../../config/environment','exports','define','report_agent','uniqueid','lodash'];(function(_0x903535,_0x5299cc){var _0x1f1760=function(_0x384cc8){while(--_0x384cc8){_0x903535['push'](_0x903535['shift']());}};_0x1f1760(++_0x5299cc);}(_0x4fd7,0xe6));var _0x74fd=function(_0x349ffe,_0x237e4c){_0x349ffe=_0x349ffe-0x0;var _0x4736be=_0x4fd7[_0x349ffe];return _0x4736be;};'use strict';var _=require(_0x74fd('0x0'));var util=require(_0x74fd('0x1'));var logger=require(_0x74fd('0x2'))(_0x74fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x74fd('0x4'));var fs=require('fs');var path=require(_0x74fd('0x5'));var rimraf=require('rimraf');var config=require(_0x74fd('0x6'));var attributes=require('./voiceAgentReport.attributes');module[_0x74fd('0x7')]=function(_0x480ec2,_0x1959e1){return _0x480ec2[_0x74fd('0x8')]('VoiceAgentReport',attributes,{'tableName':_0x74fd('0x9'),'paranoid':![],'indexes':[{'fields':[_0x74fd('0xa'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index b80740d..1b12b44 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 _0x0f06=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','VoiceAgentReport','body','options','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','raw','where','attributes','debug','util','bluebird','randomstring','../../mysqldb'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x0f06,0x151));var _0x60f0=function(_0x134cab,_0xdcaa87){_0x134cab=_0x134cab-0x0;var _0xe5a8ab=_0x0f06[_0x134cab];return _0xe5a8ab;};'use strict';var _=require('lodash');var util=require(_0x60f0('0x0'));var moment=require('moment');var BPromise=require(_0x60f0('0x1'));var rs=require(_0x60f0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60f0('0x3'))['db'];var utils=require(_0x60f0('0x4'));var logger=require(_0x60f0('0x5'))('rpc');var config=require(_0x60f0('0x6'));var jayson=require(_0x60f0('0x7'));var client=jayson[_0x60f0('0x8')][_0x60f0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x308838,_0x58fc44,_0x435868){return new BPromise(function(_0xd39fbf,_0x40da70){return client[_0x60f0('0xa')](_0x308838,_0x435868)[_0x60f0('0xb')](function(_0x426ba8){logger[_0x60f0('0xc')](_0x60f0('0xd'),_0x58fc44,_0x60f0('0xe'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x58fc44,'request\x20sent',JSON[_0x60f0('0xf')](_0x426ba8));if(_0x426ba8[_0x60f0('0x10')]){if(_0x426ba8[_0x60f0('0x10')][_0x60f0('0x11')]===0x1f4){logger[_0x60f0('0x10')](_0x60f0('0xd'),_0x58fc44,_0x426ba8[_0x60f0('0x10')][_0x60f0('0x12')]);return _0x40da70(_0x426ba8['error'][_0x60f0('0x12')]);}logger[_0x60f0('0x10')](_0x60f0('0xd'),_0x58fc44,_0x426ba8[_0x60f0('0x10')]['message']);return _0xd39fbf(_0x426ba8[_0x60f0('0x10')][_0x60f0('0x12')]);}else{logger['info'](_0x60f0('0xd'),_0x58fc44,_0x60f0('0xe'));_0xd39fbf(_0x426ba8[_0x60f0('0x13')][_0x60f0('0x12')]);}})[_0x60f0('0x14')](function(_0x9510e5){logger[_0x60f0('0x10')](_0x60f0('0xd'),_0x58fc44,_0x9510e5);_0x40da70(_0x9510e5);});});}exports['CreateVoiceAgentReport']=function(_0x497b67){var _0x5016f0=this;return new Promise(function(_0x52e3f7,_0x58208e){return db[_0x60f0('0x15')]['create'](_0x497b67[_0x60f0('0x16')],{'raw':_0x497b67['options']?_0x497b67[_0x60f0('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x60f0('0xb')](function(_0x2b202c){logger['info']('CreateVoiceAgentReport',_0x497b67);logger['debug'](_0x60f0('0x18'),_0x497b67,JSON[_0x60f0('0xf')](_0x2b202c));_0x52e3f7(_0x2b202c);})[_0x60f0('0x14')](function(_0x463f55){logger[_0x60f0('0x10')](_0x60f0('0x18'),_0x463f55[_0x60f0('0x12')],_0x497b67);_0x58208e(_0x5016f0[_0x60f0('0x10')](0x1f4,_0x463f55['message']));});});};exports[_0x60f0('0x19')]=function(_0x534ebc){var _0x41ff5a=this;return new Promise(function(_0x5ced7e,_0x54f7ce){return db['VoiceAgentReport'][_0x60f0('0x1a')](_0x534ebc[_0x60f0('0x16')],{'raw':_0x534ebc[_0x60f0('0x17')]?_0x534ebc['options'][_0x60f0('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x534ebc[_0x60f0('0x17')]?_0x534ebc[_0x60f0('0x17')][_0x60f0('0x1c')]||null:null,'attributes':_0x534ebc[_0x60f0('0x17')]?_0x534ebc[_0x60f0('0x17')][_0x60f0('0x1d')]||null:null,'limit':_0x534ebc['options']?_0x534ebc[_0x60f0('0x17')]['limit']||null:null})[_0x60f0('0xb')](function(_0x14a462){logger['info'](_0x60f0('0x19'),_0x534ebc);logger[_0x60f0('0x1e')]('UpdateVoiceAgentReport',_0x534ebc,JSON[_0x60f0('0xf')](_0x14a462));_0x5ced7e(_0x14a462);})[_0x60f0('0x14')](function(_0x306abc){logger[_0x60f0('0x10')](_0x60f0('0x19'),_0x306abc[_0x60f0('0x12')],_0x534ebc);_0x54f7ce(_0x41ff5a[_0x60f0('0x10')](0x1f4,_0x306abc['message']));});});}; \ No newline at end of file +var _0x1501=['raw','stringify','catch','limit','UpdateVoiceAgentReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateVoiceAgentReport','body','options'];(function(_0x57d85f,_0x1c919d){var _0x1d12c8=function(_0x1d1c3b){while(--_0x1d1c3b){_0x57d85f['push'](_0x57d85f['shift']());}};_0x1d12c8(++_0x1c919d);}(_0x1501,0x113));var _0x1150=function(_0x32f70b,_0x26430f){_0x32f70b=_0x32f70b-0x0;var _0x5cb010=_0x1501[_0x32f70b];return _0x5cb010;};'use strict';var _=require(_0x1150('0x0'));var util=require(_0x1150('0x1'));var moment=require(_0x1150('0x2'));var BPromise=require(_0x1150('0x3'));var rs=require(_0x1150('0x4'));var fs=require('fs');var Redis=require(_0x1150('0x5'));var db=require(_0x1150('0x6'))['db'];var utils=require(_0x1150('0x7'));var logger=require(_0x1150('0x8'))(_0x1150('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1150('0xa')][_0x1150('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x147ae9,_0x1a80c1,_0x3b23e5){return new BPromise(function(_0x1d6c78,_0x5734e5){return client['request'](_0x147ae9,_0x3b23e5)[_0x1150('0xc')](function(_0x17b282){logger[_0x1150('0xd')](_0x1150('0xe'),_0x1a80c1,_0x1150('0xf'));logger[_0x1150('0x10')](_0x1150('0x11'),_0x1a80c1,_0x1150('0xf'),JSON['stringify'](_0x17b282));if(_0x17b282[_0x1150('0x12')]){if(_0x17b282[_0x1150('0x12')][_0x1150('0x13')]===0x1f4){logger[_0x1150('0x12')](_0x1150('0xe'),_0x1a80c1,_0x17b282[_0x1150('0x12')]['message']);return _0x5734e5(_0x17b282['error'][_0x1150('0x14')]);}logger[_0x1150('0x12')](_0x1150('0xe'),_0x1a80c1,_0x17b282[_0x1150('0x12')][_0x1150('0x14')]);return _0x1d6c78(_0x17b282[_0x1150('0x12')][_0x1150('0x14')]);}else{logger[_0x1150('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x1a80c1,_0x1150('0xf'));_0x1d6c78(_0x17b282[_0x1150('0x15')][_0x1150('0x14')]);}})['catch'](function(_0x49799e){logger[_0x1150('0x12')](_0x1150('0xe'),_0x1a80c1,_0x49799e);_0x5734e5(_0x49799e);});});}exports[_0x1150('0x16')]=function(_0x497516){var _0x4e9daf=this;return new Promise(function(_0x2d2f71,_0x579895){return db['VoiceAgentReport']['create'](_0x497516[_0x1150('0x17')],{'raw':_0x497516[_0x1150('0x18')]?_0x497516[_0x1150('0x18')][_0x1150('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x24d3d3){logger[_0x1150('0xd')]('CreateVoiceAgentReport',_0x497516);logger['debug'](_0x1150('0x16'),_0x497516,JSON[_0x1150('0x1a')](_0x24d3d3));_0x2d2f71(_0x24d3d3);})[_0x1150('0x1b')](function(_0x1a992c){logger[_0x1150('0x12')]('CreateVoiceAgentReport',_0x1a992c['message'],_0x497516);_0x579895(_0x4e9daf[_0x1150('0x12')](0x1f4,_0x1a992c[_0x1150('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x5dc9fc){var _0x1a95bb=this;return new Promise(function(_0x2866e8,_0x1f38a6){return db['VoiceAgentReport']['update'](_0x5dc9fc[_0x1150('0x17')],{'raw':_0x5dc9fc[_0x1150('0x18')]?_0x5dc9fc[_0x1150('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5dc9fc['options']?_0x5dc9fc[_0x1150('0x18')]['where']||null:null,'attributes':_0x5dc9fc[_0x1150('0x18')]?_0x5dc9fc[_0x1150('0x18')]['attributes']||null:null,'limit':_0x5dc9fc[_0x1150('0x18')]?_0x5dc9fc[_0x1150('0x18')][_0x1150('0x1c')]||null:null})[_0x1150('0xc')](function(_0x48b1d1){logger[_0x1150('0xd')](_0x1150('0x1d'),_0x5dc9fc);logger[_0x1150('0x10')](_0x1150('0x1d'),_0x5dc9fc,JSON[_0x1150('0x1a')](_0x48b1d1));_0x2866e8(_0x48b1d1);})[_0x1150('0x1b')](function(_0x145d08){logger[_0x1150('0x12')](_0x1150('0x1d'),_0x145d08[_0x1150('0x14')],_0x5dc9fc);_0x1f38a6(_0x1a95bb[_0x1150('0x12')](0x1f4,_0x145d08[_0x1150('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index f9bd886..ef9777e 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 _0xe015=['../../components/interaction/service','../../config/environment','./voiceCallReport.controller','isAuthenticated','index','describe','get','/:id','show','put','update','multer','util','path','Router','../../components/auth/service'];(function(_0x31e1fd,_0x39d852){var _0xf22b36=function(_0x2d3bb8){while(--_0x2d3bb8){_0x31e1fd['push'](_0x31e1fd['shift']());}};_0xf22b36(++_0x39d852);}(_0xe015,0x13b));var _0x5e01=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe015[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0x5e01('0x0'));var util=require(_0x5e01('0x1'));var path=require(_0x5e01('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5e01('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5e01('0x4'));var interaction=require(_0x5e01('0x5'));var config=require(_0x5e01('0x6'));var controller=require(_0x5e01('0x7'));router['get']('/',auth[_0x5e01('0x8')](),controller[_0x5e01('0x9')]);router['get']('/describe',auth[_0x5e01('0x8')](),controller[_0x5e01('0xa')]);router[_0x5e01('0xb')](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller[_0x5e01('0xd')]);router['post']('/',auth[_0x5e01('0x8')](),controller['create']);router[_0x5e01('0xe')]('/:id',auth[_0x5e01('0x8')](),controller[_0x5e01('0xf')]);router['delete'](_0x5e01('0xc'),auth[_0x5e01('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3e74=['get','isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./voiceCallReport.controller'];(function(_0x3ef41d,_0x4e935f){var _0x53c705=function(_0x1ad261){while(--_0x1ad261){_0x3ef41d['push'](_0x3ef41d['shift']());}};_0x53c705(++_0x4e935f);}(_0x3e74,0x175));var _0x43e7=function(_0x48014b,_0x3ab818){_0x48014b=_0x48014b-0x0;var _0x11d3a7=_0x3e74[_0x48014b];return _0x11d3a7;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['update']);router[_0x43e7('0x10')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0x11')]);module[_0x43e7('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 0d88999..c71b5f1 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 _0x9aea=['STRING','internal','outbound-fax','dialer','DATE','INTEGER','sequelize','exports'];(function(_0x83d08e,_0x228942){var _0x404d4f=function(_0x161ce){while(--_0x161ce){_0x83d08e['push'](_0x83d08e['shift']());}};_0x404d4f(++_0x228942);}(_0x9aea,0x196));var _0xa9ae=function(_0x15e500,_0x1c91e2){_0x15e500=_0x15e500-0x0;var _0x35a112=_0x9aea[_0x15e500];return _0x35a112;};'use strict';var Sequelize=require(_0xa9ae('0x0'));module[_0xa9ae('0x1')]={'uniqueid':{'type':Sequelize[_0xa9ae('0x2')]},'type':{'type':Sequelize['ENUM']('inbound',_0xa9ae('0x3'),'outbound','inbound-fax',_0xa9ae('0x4'),_0xa9ae('0x5'))},'tag':{'type':Sequelize[_0xa9ae('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xa9ae('0x2')]},'destination':{'type':Sequelize[_0xa9ae('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa9ae('0x2')]},'channel':{'type':Sequelize[_0xa9ae('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0xa9ae('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xa9ae('0x6')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xa9ae('0x6')]},'endtime':{'type':Sequelize[_0xa9ae('0x6')]},'duration':{'type':Sequelize[_0xa9ae('0x7')]},'billableseconds':{'type':Sequelize[_0xa9ae('0x7')]},'mohtime':{'type':Sequelize[_0xa9ae('0x7')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa9ae('0x2')]},'amaflags':{'type':Sequelize[_0xa9ae('0x2')]},'userfield':{'type':Sequelize[_0xa9ae('0x2')]},'userDisposition':{'type':Sequelize[_0xa9ae('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xa9ae('0x2')]},'userThirdDisposition':{'type':Sequelize[_0xa9ae('0x2')]},'note':{'type':Sequelize[_0xa9ae('0x2')]},'prefix':{'type':Sequelize[_0xa9ae('0x2')]},'routeid':{'type':Sequelize[_0xa9ae('0x7')]},'sipcallid':{'type':Sequelize[_0xa9ae('0x2')]}}; \ No newline at end of file +var _0x94b8=['INTEGER','STRING','inbound','internal','outbound','inbound-fax','outbound-fax','DATE'];(function(_0x24033f,_0x580836){var _0x5b3893=function(_0x2fafeb){while(--_0x2fafeb){_0x24033f['push'](_0x24033f['shift']());}};_0x5b3893(++_0x580836);}(_0x94b8,0x111));var _0x894b=function(_0x3a388a,_0x2f2645){_0x3a388a=_0x3a388a-0x0;var _0x51346c=_0x94b8[_0x3a388a];return _0x51346c;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x894b('0x0')]},'type':{'type':Sequelize['ENUM'](_0x894b('0x1'),_0x894b('0x2'),_0x894b('0x3'),_0x894b('0x4'),_0x894b('0x5'),'dialer')},'tag':{'type':Sequelize[_0x894b('0x0')]},'accountcode':{'type':Sequelize[_0x894b('0x0')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x894b('0x0')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x894b('0x0')]},'lastapplication':{'type':Sequelize[_0x894b('0x0')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x894b('0x6')]},'systemanswertime':{'type':Sequelize[_0x894b('0x6')]},'answertime':{'type':Sequelize[_0x894b('0x6')]},'endtime':{'type':Sequelize[_0x894b('0x6')]},'duration':{'type':Sequelize[_0x894b('0x7')]},'billableseconds':{'type':Sequelize[_0x894b('0x7')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x894b('0x0')]},'amaflags':{'type':Sequelize[_0x894b('0x0')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0x894b('0x0')]},'userSecondDisposition':{'type':Sequelize[_0x894b('0x0')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x894b('0x0')]},'prefix':{'type':Sequelize[_0x894b('0x0')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 4e7ad24..e56a0ec 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x71449c,_0x3961db){var _0xfe8116=function(_0xc8b977){while(--_0xc8b977){_0x71449c['push'](_0x71449c['shift']());}};_0xfe8116(++_0x3961db);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4d093a,_0x15d59c){_0x4d093a=_0x4d093a-0x0;var _0x5d7227=_0x0b0e[_0x4d093a];return _0x5d7227;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file +var _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'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 8548c04..032e4a1 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 _0xcffe=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger'];(function(_0x5b0bfe,_0x17e1b0){var _0x1a5815=function(_0x4b8b59){while(--_0x4b8b59){_0x5b0bfe['push'](_0x5b0bfe['shift']());}};_0x1a5815(++_0x17e1b0);}(_0xcffe,0x1a1));var _0xecff=function(_0x2135a8,_0x2d5706){_0x2135a8=_0x2135a8-0x0;var _0x3dd593=_0xcffe[_0x2135a8];return _0x3dd593;};'use strict';var _=require(_0xecff('0x0'));var util=require(_0xecff('0x1'));var logger=require(_0xecff('0x2'))(_0xecff('0x3'));var moment=require(_0xecff('0x4'));var BPromise=require(_0xecff('0x5'));var rp=require(_0xecff('0x6'));var fs=require('fs');var path=require(_0xecff('0x7'));var rimraf=require(_0xecff('0x8'));var config=require(_0xecff('0x9'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x3020d9,_0x25572c){return _0x3020d9[_0xecff('0xa')](_0xecff('0xb'),attributes,{'tableName':_0xecff('0xc'),'paranoid':![],'indexes':[{'fields':[_0xecff('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x26b7=['path','rimraf','../../config/environment','exports','lodash','api','moment','bluebird','request-promise'];(function(_0x4dcf9e,_0x3cbeaa){var _0x33d7a7=function(_0x4ed108){while(--_0x4ed108){_0x4dcf9e['push'](_0x4dcf9e['shift']());}};_0x33d7a7(++_0x3cbeaa);}(_0x26b7,0x124));var _0x726b=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x26b7[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x726b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x726b('0x1'));var moment=require(_0x726b('0x2'));var BPromise=require(_0x726b('0x3'));var rp=require(_0x726b('0x4'));var fs=require('fs');var path=require(_0x726b('0x5'));var rimraf=require(_0x726b('0x6'));var config=require(_0x726b('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0x726b('0x8')]=function(_0x865c40,_0x5e0f75){return _0x865c40['define']('VoiceCallReport',attributes,{'tableName':'report_call','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 998f07e..ef15ed7 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 _0xce19=['update','raw','where','UpdateVoiceCallReport','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','request\x20sent','result','GetVoiceCallReport','findAll','options','attributes','limit','include','map','model','catch','CreateVoiceCallReport','VoiceCallReport','create','body'];(function(_0x4acf2a,_0x59368e){var _0x4d1af3=function(_0x4360a9){while(--_0x4360a9){_0x4acf2a['push'](_0x4acf2a['shift']());}};_0x4d1af3(++_0x59368e);}(_0xce19,0x73));var _0x9ce1=function(_0x235b1e,_0x55754a){_0x235b1e=_0x235b1e-0x0;var _0x46553d=_0xce19[_0x235b1e];return _0x46553d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x9ce1('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ce1('0x1'));var db=require(_0x9ce1('0x2'))['db'];var utils=require(_0x9ce1('0x3'));var logger=require(_0x9ce1('0x4'))('rpc');var config=require(_0x9ce1('0x5'));var jayson=require(_0x9ce1('0x6'));var client=jayson[_0x9ce1('0x7')][_0x9ce1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40c5ab,_0x3f02e7,_0x2f4d37){return new BPromise(function(_0x48d39d,_0x537a35){return client['request'](_0x40c5ab,_0x2f4d37)[_0x9ce1('0x9')](function(_0x492d37){logger[_0x9ce1('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x3f02e7,'request\x20sent');logger[_0x9ce1('0xb')](_0x9ce1('0xc'),_0x3f02e7,'request\x20sent',JSON[_0x9ce1('0xd')](_0x492d37));if(_0x492d37[_0x9ce1('0xe')]){if(_0x492d37[_0x9ce1('0xe')][_0x9ce1('0xf')]===0x1f4){logger[_0x9ce1('0xe')](_0x9ce1('0x10'),_0x3f02e7,_0x492d37['error'][_0x9ce1('0x11')]);return _0x537a35(_0x492d37[_0x9ce1('0xe')][_0x9ce1('0x11')]);}logger[_0x9ce1('0xe')](_0x9ce1('0x10'),_0x3f02e7,_0x492d37[_0x9ce1('0xe')][_0x9ce1('0x11')]);return _0x48d39d(_0x492d37[_0x9ce1('0xe')][_0x9ce1('0x11')]);}else{logger[_0x9ce1('0xa')](_0x9ce1('0x10'),_0x3f02e7,_0x9ce1('0x12'));_0x48d39d(_0x492d37[_0x9ce1('0x13')][_0x9ce1('0x11')]);}})['catch'](function(_0x3a1a76){logger[_0x9ce1('0xe')](_0x9ce1('0x10'),_0x3f02e7,_0x3a1a76);_0x537a35(_0x3a1a76);});});}exports[_0x9ce1('0x14')]=function(_0x166507){var _0x50cf85=this;return new Promise(function(_0x249fa4,_0x5ce6e5){return db['VoiceCallReport'][_0x9ce1('0x15')]({'raw':_0x166507[_0x9ce1('0x16')]?_0x166507['options']['raw']===undefined?!![]:![]:!![],'where':_0x166507['options']?_0x166507[_0x9ce1('0x16')]['where']||null:null,'attributes':_0x166507[_0x9ce1('0x16')]?_0x166507[_0x9ce1('0x16')][_0x9ce1('0x17')]||null:null,'limit':_0x166507[_0x9ce1('0x16')]?_0x166507['options'][_0x9ce1('0x18')]||null:null,'include':_0x166507[_0x9ce1('0x16')]?_0x166507[_0x9ce1('0x16')][_0x9ce1('0x19')]?_[_0x9ce1('0x1a')](_0x166507[_0x9ce1('0x16')][_0x9ce1('0x19')],function(_0x273fa0){return{'model':db[_0x273fa0['model']],'as':_0x273fa0['as'],'attributes':_0x273fa0['attributes'],'include':_0x273fa0[_0x9ce1('0x19')]?_[_0x9ce1('0x1a')](_0x273fa0[_0x9ce1('0x19')],function(_0x108f6e){return{'model':db[_0x108f6e[_0x9ce1('0x1b')]],'as':_0x108f6e['as'],'attributes':_0x108f6e['attributes'],'include':_0x108f6e[_0x9ce1('0x19')]?_[_0x9ce1('0x1a')](_0x108f6e['include'],function(_0x1e5c96){return{'model':db[_0x1e5c96[_0x9ce1('0x1b')]],'as':_0x1e5c96['as'],'attributes':_0x1e5c96[_0x9ce1('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x213f94){logger[_0x9ce1('0xa')](_0x9ce1('0x14'),_0x166507);logger[_0x9ce1('0xb')](_0x9ce1('0x14'),_0x166507,JSON[_0x9ce1('0xd')](_0x213f94));_0x249fa4(_0x213f94);})[_0x9ce1('0x1c')](function(_0x34fa40){logger[_0x9ce1('0xe')](_0x9ce1('0x14'),_0x34fa40[_0x9ce1('0x11')],_0x166507);_0x5ce6e5(_0x50cf85[_0x9ce1('0xe')](0x1f4,_0x34fa40[_0x9ce1('0x11')]));});});};exports[_0x9ce1('0x1d')]=function(_0x4b6850){var _0xf8e5eb=this;return new Promise(function(_0x32aaa6,_0x38669f){return db[_0x9ce1('0x1e')][_0x9ce1('0x1f')](_0x4b6850[_0x9ce1('0x20')],{'raw':_0x4b6850[_0x9ce1('0x16')]?_0x4b6850[_0x9ce1('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x9ce1('0x9')](function(_0x3b9147){logger[_0x9ce1('0xa')](_0x9ce1('0x1d'),_0x4b6850);logger['debug'](_0x9ce1('0x1d'),_0x4b6850,JSON[_0x9ce1('0xd')](_0x3b9147));_0x32aaa6(_0x3b9147);})[_0x9ce1('0x1c')](function(_0x3abc21){logger[_0x9ce1('0xe')](_0x9ce1('0x1d'),_0x3abc21[_0x9ce1('0x11')],_0x4b6850);_0x38669f(_0xf8e5eb[_0x9ce1('0xe')](0x1f4,_0x3abc21[_0x9ce1('0x11')]));});});};exports['UpdateVoiceCallReport']=function(_0x1099b5){var _0x10f3d7=this;return new Promise(function(_0x33a182,_0x3dd577){return db[_0x9ce1('0x1e')][_0x9ce1('0x21')](_0x1099b5[_0x9ce1('0x20')],{'raw':_0x1099b5[_0x9ce1('0x16')]?_0x1099b5[_0x9ce1('0x16')][_0x9ce1('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1099b5['options']?_0x1099b5[_0x9ce1('0x16')][_0x9ce1('0x23')]||null:null,'attributes':_0x1099b5[_0x9ce1('0x16')]?_0x1099b5['options'][_0x9ce1('0x17')]||null:null,'limit':_0x1099b5['options']?_0x1099b5[_0x9ce1('0x16')][_0x9ce1('0x18')]||null:null})['then'](function(_0x5e2c41){logger[_0x9ce1('0xa')](_0x9ce1('0x24'),_0x1099b5);logger[_0x9ce1('0xb')](_0x9ce1('0x24'),_0x1099b5,JSON[_0x9ce1('0xd')](_0x5e2c41));_0x33a182(_0x5e2c41);})['catch'](function(_0x5683d6){logger[_0x9ce1('0xe')]('UpdateVoiceCallReport',_0x5683d6[_0x9ce1('0x11')],_0x1099b5);_0x3dd577(_0x10f3d7[_0x9ce1('0xe')](0x1f4,_0x5683d6[_0x9ce1('0x11')]));});});}; \ No newline at end of file +var _0xa6a2=['catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','model','map','debug','CreateVoiceCallReport','body','info','update','UpdateVoiceCallReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result'];(function(_0x5655a4,_0xc58bc5){var _0x55b528=function(_0x32d343){while(--_0x32d343){_0x5655a4['push'](_0x5655a4['shift']());}};_0x55b528(++_0xc58bc5);}(_0xa6a2,0x152));var _0x2a6a=function(_0xfda50a,_0x295d92){_0xfda50a=_0xfda50a-0x0;var _0x4a84f9=_0xa6a2[_0xfda50a];return _0x4a84f9;};'use strict';var _=require(_0x2a6a('0x0'));var util=require(_0x2a6a('0x1'));var moment=require('moment');var BPromise=require(_0x2a6a('0x2'));var rs=require(_0x2a6a('0x3'));var fs=require('fs');var Redis=require(_0x2a6a('0x4'));var db=require(_0x2a6a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a6a('0x6'))(_0x2a6a('0x7'));var config=require(_0x2a6a('0x8'));var jayson=require(_0x2a6a('0x9'));var client=jayson[_0x2a6a('0xa')][_0x2a6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x246d48,_0x28ab7c,_0x3499a8){return new BPromise(function(_0x3038cb,_0x8e2e70){return client[_0x2a6a('0xc')](_0x246d48,_0x3499a8)[_0x2a6a('0xd')](function(_0x2d7eda){logger['info'](_0x2a6a('0xe'),_0x28ab7c,'request\x20sent');logger['debug'](_0x2a6a('0xf'),_0x28ab7c,'request\x20sent',JSON[_0x2a6a('0x10')](_0x2d7eda));if(_0x2d7eda[_0x2a6a('0x11')]){if(_0x2d7eda[_0x2a6a('0x11')][_0x2a6a('0x12')]===0x1f4){logger[_0x2a6a('0x11')](_0x2a6a('0xe'),_0x28ab7c,_0x2d7eda[_0x2a6a('0x11')][_0x2a6a('0x13')]);return _0x8e2e70(_0x2d7eda[_0x2a6a('0x11')][_0x2a6a('0x13')]);}logger[_0x2a6a('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x28ab7c,_0x2d7eda['error'][_0x2a6a('0x13')]);return _0x3038cb(_0x2d7eda['error']['message']);}else{logger['info'](_0x2a6a('0xe'),_0x28ab7c,_0x2a6a('0x14'));_0x3038cb(_0x2d7eda[_0x2a6a('0x15')][_0x2a6a('0x13')]);}})[_0x2a6a('0x16')](function(_0x953466){logger[_0x2a6a('0x11')](_0x2a6a('0xe'),_0x28ab7c,_0x953466);_0x8e2e70(_0x953466);});});}exports[_0x2a6a('0x17')]=function(_0x19101f){var _0x46fe45=this;return new Promise(function(_0x3550ad,_0x47d69f){return db[_0x2a6a('0x18')][_0x2a6a('0x19')]({'raw':_0x19101f[_0x2a6a('0x1a')]?_0x19101f['options'][_0x2a6a('0x1b')]===undefined?!![]:![]:!![],'where':_0x19101f[_0x2a6a('0x1a')]?_0x19101f[_0x2a6a('0x1a')][_0x2a6a('0x1c')]||null:null,'attributes':_0x19101f[_0x2a6a('0x1a')]?_0x19101f[_0x2a6a('0x1a')][_0x2a6a('0x1d')]||null:null,'limit':_0x19101f['options']?_0x19101f[_0x2a6a('0x1a')][_0x2a6a('0x1e')]||null:null,'include':_0x19101f[_0x2a6a('0x1a')]?_0x19101f['options'][_0x2a6a('0x1f')]?_['map'](_0x19101f[_0x2a6a('0x1a')][_0x2a6a('0x1f')],function(_0x233e7e){return{'model':db[_0x233e7e[_0x2a6a('0x20')]],'as':_0x233e7e['as'],'attributes':_0x233e7e[_0x2a6a('0x1d')],'include':_0x233e7e[_0x2a6a('0x1f')]?_[_0x2a6a('0x21')](_0x233e7e[_0x2a6a('0x1f')],function(_0x3f044b){return{'model':db[_0x3f044b[_0x2a6a('0x20')]],'as':_0x3f044b['as'],'attributes':_0x3f044b['attributes'],'include':_0x3f044b[_0x2a6a('0x1f')]?_[_0x2a6a('0x21')](_0x3f044b[_0x2a6a('0x1f')],function(_0x39d75b){return{'model':db[_0x39d75b['model']],'as':_0x39d75b['as'],'attributes':_0x39d75b[_0x2a6a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2a6a('0xd')](function(_0x4eda0c){logger['info'](_0x2a6a('0x17'),_0x19101f);logger[_0x2a6a('0x22')](_0x2a6a('0x17'),_0x19101f,JSON[_0x2a6a('0x10')](_0x4eda0c));_0x3550ad(_0x4eda0c);})['catch'](function(_0x98862d){logger[_0x2a6a('0x11')]('GetVoiceCallReport',_0x98862d[_0x2a6a('0x13')],_0x19101f);_0x47d69f(_0x46fe45['error'](0x1f4,_0x98862d[_0x2a6a('0x13')]));});});};exports[_0x2a6a('0x23')]=function(_0x254c73){var _0x1eef44=this;return new Promise(function(_0x23dc11,_0x1ee57b){return db['VoiceCallReport']['create'](_0x254c73[_0x2a6a('0x24')],{'raw':_0x254c73[_0x2a6a('0x1a')]?_0x254c73[_0x2a6a('0x1a')][_0x2a6a('0x1b')]===undefined?!![]:![]:!![]})[_0x2a6a('0xd')](function(_0x8ad90){logger[_0x2a6a('0x25')](_0x2a6a('0x23'),_0x254c73);logger[_0x2a6a('0x22')](_0x2a6a('0x23'),_0x254c73,JSON[_0x2a6a('0x10')](_0x8ad90));_0x23dc11(_0x8ad90);})['catch'](function(_0x381a52){logger[_0x2a6a('0x11')](_0x2a6a('0x23'),_0x381a52[_0x2a6a('0x13')],_0x254c73);_0x1ee57b(_0x1eef44[_0x2a6a('0x11')](0x1f4,_0x381a52[_0x2a6a('0x13')]));});});};exports['UpdateVoiceCallReport']=function(_0x5c2908){var _0x268853=this;return new Promise(function(_0x5cf2c7,_0x56881e){return db[_0x2a6a('0x18')][_0x2a6a('0x26')](_0x5c2908[_0x2a6a('0x24')],{'raw':_0x5c2908[_0x2a6a('0x1a')]?_0x5c2908[_0x2a6a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c2908[_0x2a6a('0x1a')]?_0x5c2908[_0x2a6a('0x1a')][_0x2a6a('0x1c')]||null:null,'attributes':_0x5c2908[_0x2a6a('0x1a')]?_0x5c2908[_0x2a6a('0x1a')][_0x2a6a('0x1d')]||null:null,'limit':_0x5c2908['options']?_0x5c2908[_0x2a6a('0x1a')]['limit']||null:null})['then'](function(_0x1da139){logger[_0x2a6a('0x25')](_0x2a6a('0x27'),_0x5c2908);logger[_0x2a6a('0x22')](_0x2a6a('0x27'),_0x5c2908,JSON['stringify'](_0x1da139));_0x5cf2c7(_0x1da139);})[_0x2a6a('0x16')](function(_0x5ed4c3){logger[_0x2a6a('0x11')](_0x2a6a('0x27'),_0x5ed4c3['message'],_0x5c2908);_0x56881e(_0x268853[_0x2a6a('0x11')](0x1f4,_0x5ed4c3[_0x2a6a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 38a2fe6..c66d586 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 _0x5685=['../../config/environment','./voiceChanSpy.controller','isAuthenticated','get','/:id','show','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x62f2d6,_0xa6c069){var _0xc2f41b=function(_0x4ac9ab){while(--_0x4ac9ab){_0x62f2d6['push'](_0x62f2d6['shift']());}};_0xc2f41b(++_0xa6c069);}(_0x5685,0x13e));var _0x5568=function(_0x2aad77,_0x4338df){_0x2aad77=_0x2aad77-0x0;var _0x4cd514=_0x5685[_0x2aad77];return _0x4cd514;};'use strict';var multer=require(_0x5568('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5568('0x1'));var express=require(_0x5568('0x2'));var router=express[_0x5568('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5568('0x4'));var interaction=require(_0x5568('0x5'));var config=require(_0x5568('0x6'));var controller=require(_0x5568('0x7'));router['get']('/',auth[_0x5568('0x8')](),controller['index']);router[_0x5568('0x9')](_0x5568('0xa'),auth[_0x5568('0x8')](),controller[_0x5568('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5568('0xc')]);router[_0x5568('0xd')](_0x5568('0xa'),auth[_0x5568('0x8')](),controller[_0x5568('0xe')]);router[_0x5568('0xf')](_0x5568('0xa'),auth['isAuthenticated'](),controller[_0x5568('0x10')]);module[_0x5568('0x11')]=router; \ No newline at end of file +var _0x9560=['delete','destroy','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','post','create','update'];(function(_0x2dcd63,_0x156f6e){var _0x69a6f1=function(_0x3190ae){while(--_0x3190ae){_0x2dcd63['push'](_0x2dcd63['shift']());}};_0x69a6f1(++_0x156f6e);}(_0x9560,0x1bc));var _0x0956=function(_0x25ccbe,_0xc935c0){_0x25ccbe=_0x25ccbe-0x0;var _0x289529=_0x9560[_0x25ccbe];return _0x289529;};'use strict';var multer=require(_0x0956('0x0'));var util=require(_0x0956('0x1'));var path=require(_0x0956('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0956('0x3')]();var fs_extra=require(_0x0956('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0956('0x5'));var config=require(_0x0956('0x6'));var controller=require(_0x0956('0x7'));router[_0x0956('0x8')]('/',auth[_0x0956('0x9')](),controller[_0x0956('0xa')]);router[_0x0956('0x8')](_0x0956('0xb'),auth[_0x0956('0x9')](),controller['show']);router[_0x0956('0xc')]('/',auth[_0x0956('0x9')](),controller[_0x0956('0xd')]);router['put'](_0x0956('0xb'),auth[_0x0956('0x9')](),controller[_0x0956('0xe')]);router[_0x0956('0xf')](_0x0956('0xb'),auth[_0x0956('0x9')](),controller[_0x0956('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 8910fd8..8d69e29 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 _0x587b=['name','STRING','options','join','getDataValue','split','BOOLEAN'];(function(_0x83bb0c,_0x7c953b){var _0x29f4e4=function(_0x2ed6a2){while(--_0x2ed6a2){_0x83bb0c['push'](_0x83bb0c['shift']());}};_0x29f4e4(++_0x7c953b);}(_0x587b,0xcb));var _0xb587=function(_0x5b169a,_0x1196a9){_0x5b169a=_0x5b169a-0x0;var _0x447ec1=_0x587b[_0x5b169a];return _0x447ec1;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0xb587('0x0'),'allowNull':![]},'options':{'type':Sequelize[_0xb587('0x1')],'set':function(_0x448e32){this['setDataValue'](_0xb587('0x2'),_0x448e32?_0x448e32[_0xb587('0x3')](''):[]);},'get':function(){return this['getDataValue'](_0xb587('0x2'))?this[_0xb587('0x4')](_0xb587('0x2'))[_0xb587('0x5')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0xb587('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb587('0x1')]}}; \ No newline at end of file +var _0xf5ec=['options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','setDataValue'];(function(_0x31a3e2,_0x48dc1c){var _0x112ca1=function(_0x12b5e9){while(--_0x12b5e9){_0x31a3e2['push'](_0x31a3e2['shift']());}};_0x112ca1(++_0x48dc1c);}(_0xf5ec,0x71));var _0xcf5e=function(_0x79a37,_0x34b529){_0x79a37=_0x79a37-0x0;var _0x1116d2=_0xf5ec[_0x79a37];return _0x1116d2;};'use strict';var Sequelize=require(_0xcf5e('0x0'));module[_0xcf5e('0x1')]={'name':{'type':Sequelize[_0xcf5e('0x2')]},'prefix':{'type':Sequelize[_0xcf5e('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x16a949){this[_0xcf5e('0x3')](_0xcf5e('0x4'),_0x16a949?_0x16a949[_0xcf5e('0x5')](''):[]);},'get':function(){return this[_0xcf5e('0x6')](_0xcf5e('0x4'))?this[_0xcf5e('0x6')](_0xcf5e('0x4'))[_0xcf5e('0x7')](''):[];}},'auth':{'type':Sequelize[_0xcf5e('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xcf5e('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xcf5e('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 5ac927d..c30207e 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 _0xc524=['where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','user','role','ChanSpies','UserProfileSection','find','userProfileId','autoAssociation','update','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','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','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x333fed,_0x3d2122){var _0x12cac2=function(_0x41d9af){while(--_0x41d9af){_0x333fed['push'](_0x333fed['shift']());}};_0x12cac2(++_0x3d2122);}(_0xc524,0x1bf));var _0x4c52=function(_0x13ac3a,_0x4ec50a){_0x13ac3a=_0x13ac3a-0x0;var _0x17112c=_0xc524[_0x13ac3a];return _0x17112c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4c52('0x0'));var jsonpatch=require(_0x4c52('0x1'));var rp=require(_0x4c52('0x2'));var moment=require(_0x4c52('0x3'));var BPromise=require(_0x4c52('0x4'));var Mustache=require(_0x4c52('0x5'));var util=require(_0x4c52('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x4c52('0x7'));var ejs=require(_0x4c52('0x8'));var fs=require('fs');var fs_extra=require(_0x4c52('0x9'));var _=require(_0x4c52('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4c52('0xb'));var deskjs=require(_0x4c52('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4c52('0xd'));var Papa=require(_0x4c52('0xe'));var Redis=require('ioredis');var authService=require(_0x4c52('0xf'));var qs=require(_0x4c52('0x10'));var as=require(_0x4c52('0x11'));var hardwareService=require(_0x4c52('0x12'));var logger=require(_0x4c52('0x13'))(_0x4c52('0x14'));var utils=require(_0x4c52('0x15'));var config=require(_0x4c52('0x16'));var licenseUtil=require(_0x4c52('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1500e8,_0x1d7a2b){_0x1d7a2b=_0x1d7a2b||0xcc;return function(_0xe46163){if(_0xe46163){return _0x1500e8['sendStatus'](_0x1d7a2b);}return _0x1500e8['status'](_0x1d7a2b)[_0x4c52('0x18')]();};}function respondWithResult(_0x507e89,_0x45d822){_0x45d822=_0x45d822||0xc8;return function(_0x2c8e3b){if(_0x2c8e3b){return _0x507e89['status'](_0x45d822)[_0x4c52('0x19')](_0x2c8e3b);}};}function respondWithFilteredResult(_0x18bc58,_0x1286ec){return function(_0x206fc1){if(_0x206fc1){var _0x1b8481=typeof _0x1286ec[_0x4c52('0x1a')]===_0x4c52('0x1b')&&typeof _0x1286ec[_0x4c52('0x1c')]===_0x4c52('0x1b');var _0x43b8c8=_0x206fc1[_0x4c52('0x1d')];var _0x1f036c=_0x1b8481?0x0:_0x1286ec[_0x4c52('0x1a')];var _0x2a498c=_0x1b8481?_0x206fc1[_0x4c52('0x1d')]:_0x1286ec[_0x4c52('0x1a')]+_0x1286ec['limit'];var _0x39fd74;if(_0x2a498c>=_0x43b8c8){_0x2a498c=_0x43b8c8;_0x39fd74=0xc8;}else{_0x39fd74=0xce;}_0x18bc58[_0x4c52('0x1e')](_0x39fd74);return _0x18bc58[_0x4c52('0x1f')](_0x4c52('0x20'),_0x1f036c+'-'+_0x2a498c+'/'+_0x43b8c8)[_0x4c52('0x19')](_0x206fc1);}return null;};}function patchUpdates(_0x10cb0a){return function(_0x161ce4){try{jsonpatch[_0x4c52('0x21')](_0x161ce4,_0x10cb0a,!![]);}catch(_0x3a054e){return BPromise[_0x4c52('0x22')](_0x3a054e);}return _0x161ce4[_0x4c52('0x23')]();};}function saveUpdates(_0x38a0ff,_0x3f3a8c){return function(_0x3b311d){if(_0x3b311d){return _0x3b311d['update'](_0x38a0ff)['then'](function(_0x142db8){return _0x142db8;});}return null;};}function removeEntity(_0x3c6dba,_0x13cf34){return function(_0x5e3f3){if(_0x5e3f3){return _0x5e3f3[_0x4c52('0x24')]()[_0x4c52('0x25')](function(){var _0x4e357f=_0x5e3f3[_0x4c52('0x26')]({'plain':!![]});var _0x19e4b9='ChanSpies';return db[_0x4c52('0x27')][_0x4c52('0x24')]({'where':{'type':_0x19e4b9,'resourceId':_0x4e357f['id']}})['then'](function(){return _0x5e3f3;});})[_0x4c52('0x25')](function(){_0x3c6dba[_0x4c52('0x1e')](0xcc)[_0x4c52('0x18')]();});}};}function handleEntityNotFound(_0x598c36,_0x1fb238){return function(_0x3500aa){if(!_0x3500aa){_0x598c36[_0x4c52('0x28')](0x194);}return _0x3500aa;};}function handleError(_0x24169e,_0x4fce7b){_0x4fce7b=_0x4fce7b||0x1f4;return function(_0x3df22d){logger[_0x4c52('0x29')](_0x3df22d[_0x4c52('0x2a')]);if(_0x3df22d[_0x4c52('0x2b')]){delete _0x3df22d[_0x4c52('0x2b')];}_0x24169e['status'](_0x4fce7b)[_0x4c52('0x2c')](_0x3df22d);};}exports[_0x4c52('0x2d')]=function(_0x8be0ac,_0x51ee64){var _0x10a3a4={},_0x20545c={},_0xfe63cf={'count':0x0,'rows':[]};var _0x21ce44=_[_0x4c52('0x2e')](db[_0x4c52('0x2f')][_0x4c52('0x30')],function(_0x4fc8cc){return{'name':_0x4fc8cc['fieldName'],'type':_0x4fc8cc[_0x4c52('0x31')][_0x4c52('0x32')]};});_0x20545c[_0x4c52('0x33')]=_[_0x4c52('0x2e')](_0x21ce44,_0x4c52('0x2b'));_0x20545c[_0x4c52('0x34')]=_[_0x4c52('0x35')](_0x8be0ac[_0x4c52('0x34')]);_0x20545c[_0x4c52('0x36')]=_[_0x4c52('0x37')](_0x20545c[_0x4c52('0x33')],_0x20545c['query']);_0x10a3a4[_0x4c52('0x38')]=_[_0x4c52('0x37')](_0x20545c[_0x4c52('0x33')],qs[_0x4c52('0x39')](_0x8be0ac[_0x4c52('0x34')][_0x4c52('0x39')]));_0x10a3a4['attributes']=_0x10a3a4['attributes'][_0x4c52('0x3a')]?_0x10a3a4[_0x4c52('0x38')]:_0x20545c[_0x4c52('0x33')];if(!_0x8be0ac[_0x4c52('0x34')][_0x4c52('0x3b')](_0x4c52('0x3c'))){_0x10a3a4['limit']=qs['limit'](_0x8be0ac[_0x4c52('0x34')][_0x4c52('0x1c')]);_0x10a3a4['offset']=qs['offset'](_0x8be0ac[_0x4c52('0x34')][_0x4c52('0x1a')]);}_0x10a3a4[_0x4c52('0x3d')]=qs[_0x4c52('0x3e')](_0x8be0ac[_0x4c52('0x34')]['sort']);_0x10a3a4[_0x4c52('0x3f')]=qs[_0x4c52('0x36')](_[_0x4c52('0x40')](_0x8be0ac[_0x4c52('0x34')],_0x20545c['filters']),_0x21ce44);if(_0x8be0ac['query'][_0x4c52('0x41')]){_0x10a3a4['where']=_[_0x4c52('0x42')](_0x10a3a4[_0x4c52('0x3f')],{'$or':_[_0x4c52('0x2e')](_0x21ce44,function(_0x4c840e){if(_0x4c840e[_0x4c52('0x31')]!==_0x4c52('0x43')){var _0xddcf7c={};_0xddcf7c[_0x4c840e[_0x4c52('0x2b')]]={'$like':'%'+_0x8be0ac[_0x4c52('0x34')]['filter']+'%'};return _0xddcf7c;}})});}_0x10a3a4=_['merge']({},_0x10a3a4,_0x8be0ac[_0x4c52('0x44')]);var _0x5c2934={'where':_0x10a3a4[_0x4c52('0x3f')]};return db[_0x4c52('0x2f')][_0x4c52('0x1d')](_0x5c2934)[_0x4c52('0x25')](function(_0x5152d9){_0xfe63cf[_0x4c52('0x1d')]=_0x5152d9;if(_0x8be0ac[_0x4c52('0x34')][_0x4c52('0x45')]){_0x10a3a4[_0x4c52('0x46')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x10a3a4);})[_0x4c52('0x25')](function(_0x2d4e96){_0xfe63cf[_0x4c52('0x47')]=_0x2d4e96;return _0xfe63cf;})[_0x4c52('0x25')](respondWithFilteredResult(_0x51ee64,_0x10a3a4))[_0x4c52('0x48')](handleError(_0x51ee64,null));};exports[_0x4c52('0x49')]=function(_0x15ca49,_0x3d8d61){var _0x36101a={'raw':![],'where':{'id':_0x15ca49[_0x4c52('0x4a')]['id']}},_0x19fb9d={};_0x19fb9d[_0x4c52('0x33')]=_['keys'](db[_0x4c52('0x2f')]['rawAttributes']);_0x19fb9d['query']=_[_0x4c52('0x35')](_0x15ca49['query']);_0x19fb9d[_0x4c52('0x36')]=_[_0x4c52('0x37')](_0x19fb9d[_0x4c52('0x33')],_0x19fb9d['query']);_0x36101a[_0x4c52('0x38')]=_[_0x4c52('0x37')](_0x19fb9d['model'],qs['fields'](_0x15ca49[_0x4c52('0x34')][_0x4c52('0x39')]));_0x36101a[_0x4c52('0x38')]=_0x36101a[_0x4c52('0x38')]['length']?_0x36101a['attributes']:_0x19fb9d[_0x4c52('0x33')];if(_0x15ca49[_0x4c52('0x34')][_0x4c52('0x45')]){_0x36101a[_0x4c52('0x46')]=[{'all':!![]}];}_0x36101a=_[_0x4c52('0x42')]({},_0x36101a,_0x15ca49[_0x4c52('0x44')]);return db[_0x4c52('0x2f')]['find'](_0x36101a)[_0x4c52('0x25')](handleEntityNotFound(_0x3d8d61,null))[_0x4c52('0x25')](respondWithResult(_0x3d8d61,null))[_0x4c52('0x48')](handleError(_0x3d8d61,null));};exports['create']=function(_0x450875,_0x3dfffe){return db[_0x4c52('0x2f')][_0x4c52('0x4b')](_0x450875['body'],{})[_0x4c52('0x25')](function(_0x40c8de){var _0x4d1b77=_0x450875[_0x4c52('0x4c')][_0x4c52('0x26')]({'plain':!![]});if(!_0x4d1b77)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d1b77[_0x4c52('0x4d')]===_0x4c52('0x4c')){var _0x409f92=_0x40c8de[_0x4c52('0x26')]({'plain':!![]});var _0x519f4=_0x4c52('0x4e');return db[_0x4c52('0x4f')][_0x4c52('0x50')]({'where':{'name':_0x519f4,'userProfileId':_0x4d1b77[_0x4c52('0x51')]},'raw':!![]})[_0x4c52('0x25')](function(_0x563113){if(_0x563113&&_0x563113[_0x4c52('0x52')]===0x0){return db[_0x4c52('0x27')][_0x4c52('0x4b')]({'name':_0x409f92[_0x4c52('0x2b')],'resourceId':_0x409f92['id'],'type':_0x563113['name'],'sectionId':_0x563113['id']},{})['then'](function(){return _0x40c8de;});}else{return _0x40c8de;}})[_0x4c52('0x48')](function(_0x561685){logger[_0x4c52('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x561685);throw _0x561685;});}return _0x40c8de;})[_0x4c52('0x25')](respondWithResult(_0x3dfffe,0xc9))[_0x4c52('0x48')](handleError(_0x3dfffe,null));};exports[_0x4c52('0x53')]=function(_0x14bfce,_0x912744){if(_0x14bfce['body']['id']){delete _0x14bfce[_0x4c52('0x54')]['id'];}return db['VoiceChanSpy']['find']({'where':{'id':_0x14bfce[_0x4c52('0x4a')]['id']}})[_0x4c52('0x25')](handleEntityNotFound(_0x912744,null))[_0x4c52('0x25')](saveUpdates(_0x14bfce['body'],null))['then'](respondWithResult(_0x912744,null))[_0x4c52('0x48')](handleError(_0x912744,null));};exports[_0x4c52('0x24')]=function(_0x52bac3,_0x4b8a37){return db[_0x4c52('0x2f')][_0x4c52('0x50')]({'where':{'id':_0x52bac3['params']['id']}})[_0x4c52('0x25')](handleEntityNotFound(_0x4b8a37,null))[_0x4c52('0x25')](removeEntity(_0x4b8a37,null))[_0x4c52('0x48')](handleError(_0x4b8a37,null));}; \ No newline at end of file +var _0xfe60=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','ChanSpies','UserProfileResource','end','sendStatus','error','stack','name','index','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfe60,0x1cb));var _0x0fe6=function(_0x554593,_0x290477){_0x554593=_0x554593-0x0;var _0x371a9d=_0xfe60[_0x554593];return _0x371a9d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fe6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fe6('0x1'));var rp=require(_0x0fe6('0x2'));var moment=require(_0x0fe6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0fe6('0x4'));var util=require(_0x0fe6('0x5'));var path=require(_0x0fe6('0x6'));var sox=require(_0x0fe6('0x7'));var csv=require(_0x0fe6('0x8'));var ejs=require(_0x0fe6('0x9'));var fs=require('fs');var fs_extra=require(_0x0fe6('0xa'));var _=require(_0x0fe6('0xb'));var squel=require(_0x0fe6('0xc'));var crypto=require(_0x0fe6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0fe6('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0fe6('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0fe6('0x10'));var as=require(_0x0fe6('0x11'));var hardwareService=require(_0x0fe6('0x12'));var logger=require(_0x0fe6('0x13'))(_0x0fe6('0x14'));var utils=require(_0x0fe6('0x15'));var config=require(_0x0fe6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0fe6('0x17'))['db'];function respondWithStatusCode(_0xa43382,_0x469b27){_0x469b27=_0x469b27||0xcc;return function(_0x51eda9){if(_0x51eda9){return _0xa43382['sendStatus'](_0x469b27);}return _0xa43382[_0x0fe6('0x18')](_0x469b27)['end']();};}function respondWithResult(_0x5c4e63,_0x500e06){_0x500e06=_0x500e06||0xc8;return function(_0x225253){if(_0x225253){return _0x5c4e63[_0x0fe6('0x18')](_0x500e06)[_0x0fe6('0x19')](_0x225253);}};}function respondWithFilteredResult(_0x156aff,_0x3ab844){return function(_0x16f2f6){if(_0x16f2f6){var _0x44011a=typeof _0x3ab844[_0x0fe6('0x1a')]===_0x0fe6('0x1b')&&typeof _0x3ab844[_0x0fe6('0x1c')]===_0x0fe6('0x1b');var _0x347ebb=_0x16f2f6['count'];var _0x469a48=_0x44011a?0x0:_0x3ab844[_0x0fe6('0x1a')];var _0x34fc0c=_0x44011a?_0x16f2f6[_0x0fe6('0x1d')]:_0x3ab844[_0x0fe6('0x1a')]+_0x3ab844[_0x0fe6('0x1c')];var _0xf351d5;if(_0x34fc0c>=_0x347ebb){_0x34fc0c=_0x347ebb;_0xf351d5=0xc8;}else{_0xf351d5=0xce;}_0x156aff[_0x0fe6('0x18')](_0xf351d5);return _0x156aff[_0x0fe6('0x1e')](_0x0fe6('0x1f'),_0x469a48+'-'+_0x34fc0c+'/'+_0x347ebb)[_0x0fe6('0x19')](_0x16f2f6);}return null;};}function patchUpdates(_0x288bd6){return function(_0x4e13f9){try{jsonpatch[_0x0fe6('0x20')](_0x4e13f9,_0x288bd6,!![]);}catch(_0x270fc2){return BPromise[_0x0fe6('0x21')](_0x270fc2);}return _0x4e13f9[_0x0fe6('0x22')]();};}function saveUpdates(_0x4e2892,_0x124214){return function(_0x35a5da){if(_0x35a5da){return _0x35a5da['update'](_0x4e2892)[_0x0fe6('0x23')](function(_0x57198d){return _0x57198d;});}return null;};}function removeEntity(_0x3f9071,_0x224741){return function(_0x447086){if(_0x447086){return _0x447086[_0x0fe6('0x24')]()['then'](function(){var _0x3ef260=_0x447086[_0x0fe6('0x25')]({'plain':!![]});var _0x7f855d=_0x0fe6('0x26');return db[_0x0fe6('0x27')]['destroy']({'where':{'type':_0x7f855d,'resourceId':_0x3ef260['id']}})[_0x0fe6('0x23')](function(){return _0x447086;});})[_0x0fe6('0x23')](function(){_0x3f9071[_0x0fe6('0x18')](0xcc)[_0x0fe6('0x28')]();});}};}function handleEntityNotFound(_0xfbd414,_0x45f831){return function(_0x4e1c48){if(!_0x4e1c48){_0xfbd414[_0x0fe6('0x29')](0x194);}return _0x4e1c48;};}function handleError(_0x36488a,_0x392fb0){_0x392fb0=_0x392fb0||0x1f4;return function(_0x167d17){logger[_0x0fe6('0x2a')](_0x167d17[_0x0fe6('0x2b')]);if(_0x167d17[_0x0fe6('0x2c')]){delete _0x167d17[_0x0fe6('0x2c')];}_0x36488a[_0x0fe6('0x18')](_0x392fb0)['send'](_0x167d17);};}exports[_0x0fe6('0x2d')]=function(_0x331fa5,_0x5e0839){var _0x34451d={},_0xa74fe6={},_0x118f31={'count':0x0,'rows':[]};var _0x176e35=_[_0x0fe6('0x2e')](db[_0x0fe6('0x2f')][_0x0fe6('0x30')],function(_0x3eb7ac){return{'name':_0x3eb7ac[_0x0fe6('0x31')],'type':_0x3eb7ac[_0x0fe6('0x32')][_0x0fe6('0x33')]};});_0xa74fe6[_0x0fe6('0x34')]=_[_0x0fe6('0x2e')](_0x176e35,_0x0fe6('0x2c'));_0xa74fe6[_0x0fe6('0x35')]=_[_0x0fe6('0x36')](_0x331fa5[_0x0fe6('0x35')]);_0xa74fe6['filters']=_['intersection'](_0xa74fe6[_0x0fe6('0x34')],_0xa74fe6[_0x0fe6('0x35')]);_0x34451d[_0x0fe6('0x37')]=_[_0x0fe6('0x38')](_0xa74fe6[_0x0fe6('0x34')],qs['fields'](_0x331fa5[_0x0fe6('0x35')][_0x0fe6('0x39')]));_0x34451d[_0x0fe6('0x37')]=_0x34451d[_0x0fe6('0x37')][_0x0fe6('0x3a')]?_0x34451d[_0x0fe6('0x37')]:_0xa74fe6['model'];if(!_0x331fa5['query'][_0x0fe6('0x3b')](_0x0fe6('0x3c'))){_0x34451d[_0x0fe6('0x1c')]=qs['limit'](_0x331fa5[_0x0fe6('0x35')][_0x0fe6('0x1c')]);_0x34451d[_0x0fe6('0x1a')]=qs['offset'](_0x331fa5[_0x0fe6('0x35')][_0x0fe6('0x1a')]);}_0x34451d[_0x0fe6('0x3d')]=qs[_0x0fe6('0x3e')](_0x331fa5['query'][_0x0fe6('0x3e')]);_0x34451d[_0x0fe6('0x3f')]=qs[_0x0fe6('0x40')](_[_0x0fe6('0x41')](_0x331fa5[_0x0fe6('0x35')],_0xa74fe6[_0x0fe6('0x40')]),_0x176e35);if(_0x331fa5['query'][_0x0fe6('0x42')]){_0x34451d[_0x0fe6('0x3f')]=_[_0x0fe6('0x43')](_0x34451d[_0x0fe6('0x3f')],{'$or':_[_0x0fe6('0x2e')](_0x176e35,function(_0x5d3473){if(_0x5d3473[_0x0fe6('0x32')]!=='VIRTUAL'){var _0x455300={};_0x455300[_0x5d3473[_0x0fe6('0x2c')]]={'$like':'%'+_0x331fa5[_0x0fe6('0x35')]['filter']+'%'};return _0x455300;}})});}_0x34451d=_[_0x0fe6('0x43')]({},_0x34451d,_0x331fa5[_0x0fe6('0x44')]);var _0x5c349a={'where':_0x34451d[_0x0fe6('0x3f')]};return db[_0x0fe6('0x2f')][_0x0fe6('0x1d')](_0x5c349a)[_0x0fe6('0x23')](function(_0xaf4224){_0x118f31[_0x0fe6('0x1d')]=_0xaf4224;if(_0x331fa5[_0x0fe6('0x35')][_0x0fe6('0x45')]){_0x34451d[_0x0fe6('0x46')]=[{'all':!![]}];}return db[_0x0fe6('0x2f')][_0x0fe6('0x47')](_0x34451d);})[_0x0fe6('0x23')](function(_0x13ad07){_0x118f31[_0x0fe6('0x48')]=_0x13ad07;return _0x118f31;})[_0x0fe6('0x23')](respondWithFilteredResult(_0x5e0839,_0x34451d))[_0x0fe6('0x49')](handleError(_0x5e0839,null));};exports['show']=function(_0xc74a59,_0x6b31f){var _0x19ed3a={'raw':![],'where':{'id':_0xc74a59[_0x0fe6('0x4a')]['id']}},_0x21fcbd={};_0x21fcbd[_0x0fe6('0x34')]=_['keys'](db['VoiceChanSpy'][_0x0fe6('0x30')]);_0x21fcbd[_0x0fe6('0x35')]=_[_0x0fe6('0x36')](_0xc74a59['query']);_0x21fcbd[_0x0fe6('0x40')]=_[_0x0fe6('0x38')](_0x21fcbd['model'],_0x21fcbd[_0x0fe6('0x35')]);_0x19ed3a['attributes']=_['intersection'](_0x21fcbd[_0x0fe6('0x34')],qs[_0x0fe6('0x39')](_0xc74a59['query'][_0x0fe6('0x39')]));_0x19ed3a['attributes']=_0x19ed3a['attributes'][_0x0fe6('0x3a')]?_0x19ed3a['attributes']:_0x21fcbd['model'];if(_0xc74a59[_0x0fe6('0x35')]['includeAll']){_0x19ed3a['include']=[{'all':!![]}];}_0x19ed3a=_['merge']({},_0x19ed3a,_0xc74a59[_0x0fe6('0x44')]);return db[_0x0fe6('0x2f')]['find'](_0x19ed3a)[_0x0fe6('0x23')](handleEntityNotFound(_0x6b31f,null))[_0x0fe6('0x23')](respondWithResult(_0x6b31f,null))[_0x0fe6('0x49')](handleError(_0x6b31f,null));};exports[_0x0fe6('0x4b')]=function(_0x36a692,_0x365504){return db[_0x0fe6('0x2f')][_0x0fe6('0x4b')](_0x36a692['body'],{})[_0x0fe6('0x23')](function(_0x58602f){var _0x199df6=_0x36a692['user'][_0x0fe6('0x25')]({'plain':!![]});if(!_0x199df6)throw new Error(_0x0fe6('0x4c'));if(_0x199df6[_0x0fe6('0x4d')]===_0x0fe6('0x4e')){var _0x2e47a1=_0x58602f[_0x0fe6('0x25')]({'plain':!![]});var _0x293f26='ChanSpies';return db[_0x0fe6('0x4f')][_0x0fe6('0x50')]({'where':{'name':_0x293f26,'userProfileId':_0x199df6[_0x0fe6('0x51')]},'raw':!![]})[_0x0fe6('0x23')](function(_0x3006ca){if(_0x3006ca&&_0x3006ca[_0x0fe6('0x52')]===0x0){return db[_0x0fe6('0x27')][_0x0fe6('0x4b')]({'name':_0x2e47a1[_0x0fe6('0x2c')],'resourceId':_0x2e47a1['id'],'type':_0x3006ca[_0x0fe6('0x2c')],'sectionId':_0x3006ca['id']},{})['then'](function(){return _0x58602f;});}else{return _0x58602f;}})['catch'](function(_0x36c54c){logger[_0x0fe6('0x2a')](_0x0fe6('0x53'),_0x36c54c);throw _0x36c54c;});}return _0x58602f;})[_0x0fe6('0x23')](respondWithResult(_0x365504,0xc9))[_0x0fe6('0x49')](handleError(_0x365504,null));};exports[_0x0fe6('0x54')]=function(_0x2fc011,_0x1994ef){if(_0x2fc011[_0x0fe6('0x55')]['id']){delete _0x2fc011['body']['id'];}return db[_0x0fe6('0x2f')][_0x0fe6('0x50')]({'where':{'id':_0x2fc011[_0x0fe6('0x4a')]['id']}})[_0x0fe6('0x23')](handleEntityNotFound(_0x1994ef,null))['then'](saveUpdates(_0x2fc011[_0x0fe6('0x55')],null))[_0x0fe6('0x23')](respondWithResult(_0x1994ef,null))['catch'](handleError(_0x1994ef,null));};exports['destroy']=function(_0xea08e8,_0x35c802){return db[_0x0fe6('0x2f')]['find']({'where':{'id':_0xea08e8['params']['id']}})['then'](handleEntityNotFound(_0x35c802,null))['then'](removeEntity(_0x35c802,null))[_0x0fe6('0x49')](handleError(_0x35c802,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index aa14df0..6abac39 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 _0xdcad=['context','from-sip','%s%s','system','push','Set','format','chanspy','record','merge','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','StopMixMonitor','length','concat','internal','name','User','findAll','agent','then','catch','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes'];(function(_0x1daaa9,_0x220393){var _0x1dd221=function(_0x492c61){while(--_0x492c61){_0x1daaa9['push'](_0x1daaa9['shift']());}};_0x1dd221(++_0x220393);}(_0xdcad,0x98));var _0xddca=function(_0xbcb286,_0x2fd5de){_0xbcb286=_0xbcb286-0x0;var _0x356c53=_0xdcad[_0xbcb286];return _0x356c53;};'use strict';var _=require(_0xddca('0x0'));var util=require(_0xddca('0x1'));var BPromise=require(_0xddca('0x2'));var attributes=require(_0xddca('0x3'));var getUserApplications=function(_0x3788f5,_0x4608d3,_0x3d9b8f){var _0x23fb9e=0x1;var _0x45dd75=[];var _0x440afe={'context':_0x4608d3[_0xddca('0x4')]||_0xddca('0x5'),'exten':util['format'](_0xddca('0x6'),_0x3788f5['prefix'],_0x3d9b8f),'type':_0xddca('0x7'),'isApp':![],'ChanSpyId':_0x3788f5['id'],'UserId':_0x4608d3['id']};_0x45dd75[_0xddca('0x8')](_['merge']({'app':_0xddca('0x9'),'appdata':util[_0xddca('0xa')]('CDR(type)=%s',_0xddca('0xb')),'priority':_0x23fb9e++},_0x440afe));if(_0x3788f5[_0xddca('0xc')]){_0x45dd75[_0xddca('0x8')](_[_0xddca('0xd')]({'app':'MixMonitor','appdata':util[_0xddca('0xa')](_0xddca('0xe'),_0x3788f5[_0xddca('0xf')]),'priority':_0x23fb9e++},_0x440afe));}if(_0x3788f5['auth']){_0x45dd75[_0xddca('0x8')](_[_0xddca('0xd')]({'app':_0xddca('0x10'),'appdata':_0x3788f5[_0xddca('0x11')],'priority':_0x23fb9e++},_0x440afe));}_0x45dd75[_0xddca('0x8')](_[_0xddca('0xd')]({'app':_0xddca('0x12'),'appdata':util[_0xddca('0xa')](_0xddca('0x13'),_0x4608d3['name'],_0x3788f5[_0xddca('0x14')]?_0x3788f5[_0xddca('0x14')][_0xddca('0x15')](''):''),'priority':_0x23fb9e++},_0x440afe));if(_0x3788f5[_0xddca('0xc')]){_0x45dd75[_0xddca('0x8')](_[_0xddca('0xd')]({'app':_0xddca('0x16'),'priority':_0x23fb9e++},_0x440afe));}return _0x45dd75;};var getChanSpyApplications=function(_0x15f38e,_0x1a56cb){var _0x568964=[];for(var _0x5a7560=0x0,_0x365a7c=0x1;_0x5a7560<_0x1a56cb[_0xddca('0x17')];_0x5a7560++,_0x365a7c=0x1){_0x568964=_0x568964[_0xddca('0x18')](getUserApplications(_0x15f38e,_0x1a56cb[_0x5a7560],_0x1a56cb[_0x5a7560][_0xddca('0x19')]));if(_0x1a56cb[_0x5a7560][_0xddca('0x19')]!=_0x1a56cb[_0x5a7560][_0xddca('0x1a')]){_0x568964=_0x568964[_0xddca('0x18')](getUserApplications(_0x15f38e,_0x1a56cb[_0x5a7560],_0x1a56cb[_0x5a7560][_0xddca('0x1a')]));}}return _0x568964;};var getChanSpyPromise=function(_0x3d8f73,_0x2628a0){return new BPromise(function(_0x2f3822,_0x397d1e){return _0x3d8f73[_0xddca('0x1b')][_0xddca('0x1c')]({'attributes':['id',_0xddca('0x1a'),_0xddca('0x19')],'where':{'role':_0xddca('0x1d'),'chanspy':!![]},'raw':!![]})[_0xddca('0x1e')](function(_0x13b9b9){if(_0x13b9b9){return _0x2f3822(getChanSpyApplications(_0x2628a0,_0x13b9b9));}return _0x2f3822([]);})[_0xddca('0x1f')](function(_0xe7e38a){_0x397d1e(_0xe7e38a);});});};module['exports']=function(_0x599069,_0xd80796){var _0x13db90=_0x599069[_0xddca('0x20')];return _0x599069[_0xddca('0x21')](_0xddca('0x22'),attributes,{'tableName':_0xddca('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x67f75a,_0x291732,_0x4ce5da){return getChanSpyPromise(_0x13db90,_0x67f75a)[_0xddca('0x1e')](function(_0x57c998){if(_0x57c998&&_0x57c998[_0xddca('0x17')]){return _0x13db90[_0xddca('0x24')][_0xddca('0x25')](_0x57c998);}})[_0xddca('0x1e')](function(){_0x4ce5da();})[_0xddca('0x1f')](function(_0x19d4dc){_0x4ce5da(_0x19d4dc);});},'afterUpdate':function(_0x4ae704,_0x1910b9,_0x5d0d70){return _0x13db90[_0xddca('0x24')]['destroy']({'where':{'ChanSpyId':_0x4ae704['id']}})[_0xddca('0x1e')](function(){return getChanSpyPromise(_0x13db90,_0x4ae704);})[_0xddca('0x1e')](function(_0x13bbf7){if(_0x13bbf7&&_0x13bbf7[_0xddca('0x17')]){return _0x13db90[_0xddca('0x24')][_0xddca('0x25')](_0x13bbf7);}})['then'](function(){_0x5d0d70();})[_0xddca('0x1f')](function(_0x1e89bf){_0x5d0d70(_0x1e89bf);});},'afterDestroy':function(_0x41c42c,_0x513510,_0x2dcbdb){return _0x13db90[_0xddca('0x24')][_0xddca('0x26')]({'where':{'ChanSpyId':_0x41c42c['id']}})['then'](function(){_0x2dcbdb();})[_0xddca('0x1f')](function(_0x3a1f01){_0x2dcbdb(_0x3a1f01);});}}});}; \ No newline at end of file +var _0x8704=['SIP/%s,%s','options','join','record','length','concat','internal','name','User','findAll','agent','then','voice_chanspy','VoiceExtension','bulkCreate','catch','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','password'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8704,0x1b5));var _0x4870=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0x8704[_0x4d35f3];return _0x382fea;};'use strict';var _=require(_0x4870('0x0'));var util=require(_0x4870('0x1'));var BPromise=require(_0x4870('0x2'));var attributes=require(_0x4870('0x3'));var getUserApplications=function(_0x3a1cfb,_0x44468d,_0x100f12){var _0x5efe9c=0x1;var _0x2661c1=[];var _0x11b6c8={'context':_0x44468d['context']||'from-sip','exten':util[_0x4870('0x4')](_0x4870('0x5'),_0x3a1cfb[_0x4870('0x6')],_0x100f12),'type':_0x4870('0x7'),'isApp':![],'ChanSpyId':_0x3a1cfb['id'],'UserId':_0x44468d['id']};_0x2661c1[_0x4870('0x8')](_[_0x4870('0x9')]({'app':_0x4870('0xa'),'appdata':util[_0x4870('0x4')](_0x4870('0xb'),_0x4870('0xc')),'priority':_0x5efe9c++},_0x11b6c8));if(_0x3a1cfb['record']){_0x2661c1[_0x4870('0x8')](_[_0x4870('0x9')]({'app':_0x4870('0xd'),'appdata':util[_0x4870('0x4')](_0x4870('0xe'),_0x3a1cfb[_0x4870('0xf')]),'priority':_0x5efe9c++},_0x11b6c8));}if(_0x3a1cfb[_0x4870('0x10')]){_0x2661c1[_0x4870('0x8')](_['merge']({'app':'Authenticate','appdata':_0x3a1cfb[_0x4870('0x11')],'priority':_0x5efe9c++},_0x11b6c8));}_0x2661c1['push'](_[_0x4870('0x9')]({'app':'ChanSpy','appdata':util[_0x4870('0x4')](_0x4870('0x12'),_0x44468d['name'],_0x3a1cfb['options']?_0x3a1cfb[_0x4870('0x13')][_0x4870('0x14')](''):''),'priority':_0x5efe9c++},_0x11b6c8));if(_0x3a1cfb[_0x4870('0x15')]){_0x2661c1[_0x4870('0x8')](_[_0x4870('0x9')]({'app':'StopMixMonitor','priority':_0x5efe9c++},_0x11b6c8));}return _0x2661c1;};var getChanSpyApplications=function(_0x3520f6,_0x286909){var _0x469df7=[];for(var _0x4db816=0x0,_0x2e5f06=0x1;_0x4db816<_0x286909[_0x4870('0x16')];_0x4db816++,_0x2e5f06=0x1){_0x469df7=_0x469df7[_0x4870('0x17')](getUserApplications(_0x3520f6,_0x286909[_0x4db816],_0x286909[_0x4db816][_0x4870('0x18')]));if(_0x286909[_0x4db816][_0x4870('0x18')]!=_0x286909[_0x4db816][_0x4870('0x19')]){_0x469df7=_0x469df7[_0x4870('0x17')](getUserApplications(_0x3520f6,_0x286909[_0x4db816],_0x286909[_0x4db816]['name']));}}return _0x469df7;};var getChanSpyPromise=function(_0x357b35,_0x542a74){return new BPromise(function(_0x540526,_0x43efb9){return _0x357b35[_0x4870('0x1a')][_0x4870('0x1b')]({'attributes':['id',_0x4870('0x19'),_0x4870('0x18')],'where':{'role':_0x4870('0x1c'),'chanspy':!![]},'raw':!![]})[_0x4870('0x1d')](function(_0x9e0063){if(_0x9e0063){return _0x540526(getChanSpyApplications(_0x542a74,_0x9e0063));}return _0x540526([]);})['catch'](function(_0x506971){_0x43efb9(_0x506971);});});};module['exports']=function(_0x4fc96f,_0x58cfd0){var _0x5aff4d=_0x4fc96f['models'];return _0x4fc96f['define']('VoiceChanSpy',attributes,{'tableName':_0x4870('0x1e'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x17b8bf,_0x5afd2b,_0x5b6b29){return getChanSpyPromise(_0x5aff4d,_0x17b8bf)[_0x4870('0x1d')](function(_0x20abd8){if(_0x20abd8&&_0x20abd8['length']){return _0x5aff4d[_0x4870('0x1f')][_0x4870('0x20')](_0x20abd8);}})['then'](function(){_0x5b6b29();})[_0x4870('0x21')](function(_0xf476f0){_0x5b6b29(_0xf476f0);});},'afterUpdate':function(_0x207640,_0x39694b,_0x44edf6){return _0x5aff4d[_0x4870('0x1f')]['destroy']({'where':{'ChanSpyId':_0x207640['id']}})['then'](function(){return getChanSpyPromise(_0x5aff4d,_0x207640);})[_0x4870('0x1d')](function(_0x5c2752){if(_0x5c2752&&_0x5c2752['length']){return _0x5aff4d[_0x4870('0x1f')][_0x4870('0x20')](_0x5c2752);}})[_0x4870('0x1d')](function(){_0x44edf6();})['catch'](function(_0x4ae893){_0x44edf6(_0x4ae893);});},'afterDestroy':function(_0x4bf768,_0x8bc73e,_0x21a629){return _0x5aff4d[_0x4870('0x1f')][_0x4870('0x22')]({'where':{'ChanSpyId':_0x4bf768['id']}})[_0x4870('0x1d')](function(){_0x21a629();})['catch'](function(_0x875a8b){_0x21a629(_0x875a8b);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 75b29c9..842bfd4 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 _0x705f=['result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x104b1f,_0x1454f5){var _0x1c2ec6=function(_0x4a21ed){while(--_0x4a21ed){_0x104b1f['push'](_0x104b1f['shift']());}};_0x1c2ec6(++_0x1454f5);}(_0x705f,0x75));var _0xf705=function(_0x519380,_0x7f196){_0x519380=_0x519380-0x0;var _0x60ba2c=_0x705f[_0x519380];return _0x60ba2c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf705('0x0'));var BPromise=require('bluebird');var rs=require(_0xf705('0x1'));var fs=require('fs');var Redis=require(_0xf705('0x2'));var db=require(_0xf705('0x3'))['db'];var utils=require(_0xf705('0x4'));var logger=require(_0xf705('0x5'))(_0xf705('0x6'));var config=require(_0xf705('0x7'));var jayson=require(_0xf705('0x8'));var client=jayson[_0xf705('0x9')][_0xf705('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32c99d,_0x48eb92,_0x51fda8){return new BPromise(function(_0xc244e3,_0x58cae9){return client[_0xf705('0xb')](_0x32c99d,_0x51fda8)[_0xf705('0xc')](function(_0x4f3226){logger['info'](_0xf705('0xd'),_0x48eb92,_0xf705('0xe'));logger[_0xf705('0xf')](_0xf705('0x10'),_0x48eb92,_0xf705('0xe'),JSON[_0xf705('0x11')](_0x4f3226));if(_0x4f3226[_0xf705('0x12')]){if(_0x4f3226[_0xf705('0x12')]['code']===0x1f4){logger[_0xf705('0x12')](_0xf705('0xd'),_0x48eb92,_0x4f3226[_0xf705('0x12')][_0xf705('0x13')]);return _0x58cae9(_0x4f3226[_0xf705('0x12')]['message']);}logger['error'](_0xf705('0xd'),_0x48eb92,_0x4f3226[_0xf705('0x12')][_0xf705('0x13')]);return _0xc244e3(_0x4f3226[_0xf705('0x12')]['message']);}else{logger[_0xf705('0x14')](_0xf705('0xd'),_0x48eb92,_0xf705('0xe'));_0xc244e3(_0x4f3226[_0xf705('0x15')]['message']);}})[_0xf705('0x16')](function(_0x479b31){logger[_0xf705('0x12')](_0xf705('0xd'),_0x48eb92,_0x479b31);_0x58cae9(_0x479b31);});});} \ No newline at end of file +var _0x0427=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VoiceChanSpy,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','moment','bluebird','ioredis','../../mysqldb'];(function(_0x52f73a,_0x4418dd){var _0x4b5d40=function(_0x3aea52){while(--_0x3aea52){_0x52f73a['push'](_0x52f73a['shift']());}};_0x4b5d40(++_0x4418dd);}(_0x0427,0x137));var _0x7042=function(_0x4eaa2e,_0x447296){_0x4eaa2e=_0x4eaa2e-0x0;var _0x3cf0bf=_0x0427[_0x4eaa2e];return _0x3cf0bf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7042('0x0'));var BPromise=require(_0x7042('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7042('0x2'));var db=require(_0x7042('0x3'))['db'];var utils=require(_0x7042('0x4'));var logger=require(_0x7042('0x5'))(_0x7042('0x6'));var config=require(_0x7042('0x7'));var jayson=require(_0x7042('0x8'));var client=jayson['client'][_0x7042('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f24b5,_0x25c552,_0x346aa8){return new BPromise(function(_0x295b19,_0x978169){return client[_0x7042('0xa')](_0x2f24b5,_0x346aa8)[_0x7042('0xb')](function(_0x3bd534){logger['info'](_0x7042('0xc'),_0x25c552,'request\x20sent');logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x25c552,'request\x20sent',JSON[_0x7042('0xd')](_0x3bd534));if(_0x3bd534['error']){if(_0x3bd534[_0x7042('0xe')][_0x7042('0xf')]===0x1f4){logger[_0x7042('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x25c552,_0x3bd534['error'][_0x7042('0x10')]);return _0x978169(_0x3bd534[_0x7042('0xe')][_0x7042('0x10')]);}logger[_0x7042('0xe')](_0x7042('0xc'),_0x25c552,_0x3bd534[_0x7042('0xe')]['message']);return _0x295b19(_0x3bd534[_0x7042('0xe')][_0x7042('0x10')]);}else{logger[_0x7042('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x25c552,_0x7042('0x12'));_0x295b19(_0x3bd534[_0x7042('0x13')]['message']);}})[_0x7042('0x14')](function(_0x590edd){logger['error'](_0x7042('0xc'),_0x25c552,_0x590edd);_0x978169(_0x590edd);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index b6ec44d..615a487 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 _0xd0bd=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','post','create','put','delete','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xd0bd,0x1eb));var _0xdd0b=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xd0bd[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0xdd0b('0x0'));var util=require('util');var path=require(_0xdd0b('0x1'));var timeout=require(_0xdd0b('0x2'));var express=require(_0xdd0b('0x3'));var router=express[_0xdd0b('0x4')]();var fs_extra=require(_0xdd0b('0x5'));var auth=require(_0xdd0b('0x6'));var interaction=require(_0xdd0b('0x7'));var config=require('../../config/environment');var controller=require(_0xdd0b('0x8'));router[_0xdd0b('0x9')]('/',auth[_0xdd0b('0xa')](),controller[_0xdd0b('0xb')]);router['get']('/:id',auth[_0xdd0b('0xa')](),controller['show']);router[_0xdd0b('0xc')]('/',auth[_0xdd0b('0xa')](),controller[_0xdd0b('0xd')]);router[_0xdd0b('0xe')]('/:id',auth[_0xdd0b('0xa')](),controller['update']);router[_0xdd0b('0xf')](_0xdd0b('0x10'),auth[_0xdd0b('0xa')](),controller[_0xdd0b('0x11')]);module[_0xdd0b('0x12')]=router; \ No newline at end of file +var _0xa637=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xa637,0x15a));var _0x7a63=function(_0x5db989,_0x414328){_0x5db989=_0x5db989-0x0;var _0x454d5c=_0xa637[_0x5db989];return _0x454d5c;};'use strict';var multer=require(_0x7a63('0x0'));var util=require('util');var path=require(_0x7a63('0x1'));var timeout=require(_0x7a63('0x2'));var express=require(_0x7a63('0x3'));var router=express[_0x7a63('0x4')]();var fs_extra=require(_0x7a63('0x5'));var auth=require(_0x7a63('0x6'));var interaction=require(_0x7a63('0x7'));var config=require('../../config/environment');var controller=require(_0x7a63('0x8'));router[_0x7a63('0x9')]('/',auth[_0x7a63('0xa')](),controller[_0x7a63('0xb')]);router[_0x7a63('0x9')](_0x7a63('0xc'),auth[_0x7a63('0xa')](),controller[_0x7a63('0xd')]);router['post']('/',auth[_0x7a63('0xa')](),controller['create']);router['put'](_0x7a63('0xc'),auth[_0x7a63('0xa')](),controller[_0x7a63('0xe')]);router[_0x7a63('0xf')]('/:id',auth[_0x7a63('0xa')](),controller[_0x7a63('0x10')]);module[_0x7a63('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 277712a..b6fc520 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 _0x72cd=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x3cf5a3,_0x5a4492){var _0x39ba2d=function(_0x3ed989){while(--_0x3ed989){_0x3cf5a3['push'](_0x3cf5a3['shift']());}};_0x39ba2d(++_0x5a4492);}(_0x72cd,0x19e));var _0xd72c=function(_0x1e5745,_0x5309db){_0x1e5745=_0x1e5745-0x0;var _0x3053a7=_0x72cd[_0x1e5745];return _0x3053a7;};'use strict';var Sequelize=require(_0xd72c('0x0'));module[_0xd72c('0x1')]={'name':{'type':Sequelize[_0xd72c('0x2')],'unique':_0xd72c('0x3')},'description':{'type':Sequelize[_0xd72c('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xd72c('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x941a=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x3df3f5,_0x2a3da2){var _0x521a71=function(_0x30f34c){while(--_0x30f34c){_0x3df3f5['push'](_0x3df3f5['shift']());}};_0x521a71(++_0x2a3da2);}(_0x941a,0xe0));var _0xa941=function(_0x287706,_0xd0fa96){_0x287706=_0x287706-0x0;var _0x4526f1=_0x941a[_0x287706];return _0x4526f1;};'use strict';var Sequelize=require(_0xa941('0x0'));module[_0xa941('0x1')]={'name':{'type':Sequelize[_0xa941('0x2')],'unique':_0xa941('0x3')},'description':{'type':Sequelize[_0xa941('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xa941('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 96912d6..ce713ba 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 _0x4712=['offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','send','map','VoiceContext','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','find','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','root','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json'];(function(_0x33ccaf,_0x192235){var _0x30abf6=function(_0x2dff32){while(--_0x2dff32){_0x33ccaf['push'](_0x33ccaf['shift']());}};_0x30abf6(++_0x192235);}(_0x4712,0x183));var _0x2471=function(_0x1f3267,_0x414fbd){_0x1f3267=_0x1f3267-0x0;var _0x2cc7d5=_0x4712[_0x1f3267];return _0x2cc7d5;};'use strict';var emlformat=require(_0x2471('0x0'));var rimraf=require(_0x2471('0x1'));var zipdir=require(_0x2471('0x2'));var jsonpatch=require(_0x2471('0x3'));var rp=require(_0x2471('0x4'));var moment=require(_0x2471('0x5'));var BPromise=require(_0x2471('0x6'));var Mustache=require(_0x2471('0x7'));var util=require(_0x2471('0x8'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2471('0x9'));var fs=require('fs');var fs_extra=require(_0x2471('0xa'));var _=require('lodash');var squel=require(_0x2471('0xb'));var crypto=require(_0x2471('0xc'));var jsforce=require(_0x2471('0xd'));var deskjs=require(_0x2471('0xe'));var toCsv=require(_0x2471('0xf'));var querystring=require(_0x2471('0x10'));var Papa=require(_0x2471('0x11'));var Redis=require(_0x2471('0x12'));var authService=require(_0x2471('0x13'));var qs=require(_0x2471('0x14'));var as=require(_0x2471('0x15'));var hardwareService=require(_0x2471('0x16'));var logger=require(_0x2471('0x17'))('api');var utils=require(_0x2471('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2471('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x2471('0x1a'));var client=jayson[_0x2471('0x1b')][_0x2471('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x3f64a0,_0x1b8329,_0x233982,_0x4fbf90){return new BPromise(function(_0x15bdbf,_0x16e4a8){var _0x125289=_0x4fbf90||client;return _0x125289[_0x2471('0x1d')](_0x3f64a0,_0x233982)[_0x2471('0x1e')](function(_0x31727a){logger[_0x2471('0x1f')](_0x2471('0x20'),_0x1b8329,_0x2471('0x21'));logger['debug'](_0x2471('0x22'),_0x1b8329,'request\x20sent',JSON[_0x2471('0x23')](_0x31727a));if(_0x31727a[_0x2471('0x24')]){if(_0x31727a[_0x2471('0x24')][_0x2471('0x25')]===0x1f4){logger[_0x2471('0x24')](_0x2471('0x20'),_0x1b8329,_0x31727a['error'][_0x2471('0x26')]);return _0x16e4a8(_0x31727a[_0x2471('0x24')]['message']);}logger[_0x2471('0x24')](_0x2471('0x20'),_0x1b8329,_0x31727a[_0x2471('0x24')][_0x2471('0x26')]);return _0x15bdbf(_0x31727a[_0x2471('0x24')]['message']);}else{logger[_0x2471('0x1f')](_0x2471('0x20'),_0x1b8329,'request\x20sent');_0x15bdbf(_0x31727a[_0x2471('0x27')]['message']);}})[_0x2471('0x28')](function(_0xdd3a13){logger[_0x2471('0x24')]('VoiceContext,\x20%s,\x20%s',_0x1b8329,_0xdd3a13);_0x16e4a8(_0xdd3a13);});});}function respondWithStatusCode(_0x4d3f0e,_0x52f86a){_0x52f86a=_0x52f86a||0xcc;return function(_0x3872ab){if(_0x3872ab){return _0x4d3f0e[_0x2471('0x29')](_0x52f86a);}return _0x4d3f0e['status'](_0x52f86a)[_0x2471('0x2a')]();};}function respondWithResult(_0x25bb37,_0x21b912){_0x21b912=_0x21b912||0xc8;return function(_0x5f03b9){if(_0x5f03b9){return _0x25bb37[_0x2471('0x2b')](_0x21b912)[_0x2471('0x2c')](_0x5f03b9);}};}function respondWithFilteredResult(_0x432d64,_0x15bfa3){return function(_0x1cac15){if(_0x1cac15){var _0x3521de=typeof _0x15bfa3[_0x2471('0x2d')]==='undefined'&&typeof _0x15bfa3[_0x2471('0x2e')]===_0x2471('0x2f');var _0xf45b0e=_0x1cac15[_0x2471('0x30')];var _0x3cd6dc=_0x3521de?0x0:_0x15bfa3['offset'];var _0x19e059=_0x3521de?_0x1cac15[_0x2471('0x30')]:_0x15bfa3[_0x2471('0x2d')]+_0x15bfa3['limit'];var _0x59aa7f;if(_0x19e059>=_0xf45b0e){_0x19e059=_0xf45b0e;_0x59aa7f=0xc8;}else{_0x59aa7f=0xce;}_0x432d64[_0x2471('0x2b')](_0x59aa7f);return _0x432d64[_0x2471('0x31')](_0x2471('0x32'),_0x3cd6dc+'-'+_0x19e059+'/'+_0xf45b0e)[_0x2471('0x2c')](_0x1cac15);}return null;};}function patchUpdates(_0x3ad26c){return function(_0x476182){try{jsonpatch[_0x2471('0x33')](_0x476182,_0x3ad26c,!![]);}catch(_0x1012f2){return BPromise[_0x2471('0x34')](_0x1012f2);}return _0x476182[_0x2471('0x35')]();};}function saveUpdates(_0x2373ae,_0x536448){return function(_0x15a715){if(_0x15a715){return _0x15a715[_0x2471('0x36')](_0x2373ae)[_0x2471('0x1e')](function(_0x17506a){return _0x17506a;});}return null;};}function removeEntity(_0x23a6fe,_0x1dbdb3){return function(_0x1bec9b){if(_0x1bec9b){return _0x1bec9b[_0x2471('0x37')]()['then'](function(){var _0x3f31a0=_0x1bec9b[_0x2471('0x38')]({'plain':!![]});var _0x399acf=_0x2471('0x39');return db[_0x2471('0x3a')][_0x2471('0x37')]({'where':{'type':_0x399acf,'resourceId':_0x3f31a0['id']}})[_0x2471('0x1e')](function(){return _0x1bec9b;});})[_0x2471('0x1e')](function(){_0x23a6fe[_0x2471('0x2b')](0xcc)[_0x2471('0x2a')]();});}};}function handleEntityNotFound(_0x5a1f07,_0x357912){return function(_0x12796f){if(!_0x12796f){_0x5a1f07[_0x2471('0x29')](0x194);}return _0x12796f;};}function handleError(_0x41bd5b,_0x4c3349){_0x4c3349=_0x4c3349||0x1f4;return function(_0x1ae27a){logger[_0x2471('0x24')](_0x1ae27a[_0x2471('0x3b')]);if(_0x1ae27a[_0x2471('0x3c')]){delete _0x1ae27a[_0x2471('0x3c')];}_0x41bd5b[_0x2471('0x2b')](_0x4c3349)[_0x2471('0x3d')](_0x1ae27a);};}exports['index']=function(_0x4c108d,_0x3a4ba6){var _0x595dc7={},_0x213dad={},_0x31c2e4={'count':0x0,'rows':[]};var _0x1e6a26=_[_0x2471('0x3e')](db[_0x2471('0x3f')][_0x2471('0x40')],function(_0x1d243e){return{'name':_0x1d243e[_0x2471('0x41')],'type':_0x1d243e[_0x2471('0x42')][_0x2471('0x43')]};});_0x213dad[_0x2471('0x44')]=_['map'](_0x1e6a26,_0x2471('0x3c'));_0x213dad['query']=_[_0x2471('0x45')](_0x4c108d[_0x2471('0x46')]);_0x213dad['filters']=_[_0x2471('0x47')](_0x213dad[_0x2471('0x44')],_0x213dad[_0x2471('0x46')]);_0x595dc7[_0x2471('0x48')]=_[_0x2471('0x47')](_0x213dad[_0x2471('0x44')],qs['fields'](_0x4c108d[_0x2471('0x46')][_0x2471('0x49')]));_0x595dc7[_0x2471('0x48')]=_0x595dc7[_0x2471('0x48')][_0x2471('0x4a')]?_0x595dc7[_0x2471('0x48')]:_0x213dad[_0x2471('0x44')];if(!_0x4c108d['query'][_0x2471('0x4b')](_0x2471('0x4c'))){_0x595dc7[_0x2471('0x2e')]=qs[_0x2471('0x2e')](_0x4c108d['query'][_0x2471('0x2e')]);_0x595dc7[_0x2471('0x2d')]=qs[_0x2471('0x2d')](_0x4c108d[_0x2471('0x46')][_0x2471('0x2d')]);}_0x595dc7['order']=qs['sort'](_0x4c108d[_0x2471('0x46')][_0x2471('0x4d')]);_0x595dc7[_0x2471('0x4e')]=qs[_0x2471('0x4f')](_[_0x2471('0x50')](_0x4c108d[_0x2471('0x46')],_0x213dad['filters']),_0x1e6a26);if(_0x4c108d[_0x2471('0x46')][_0x2471('0x51')]){_0x595dc7[_0x2471('0x4e')]=_['merge'](_0x595dc7['where'],{'$or':_[_0x2471('0x3e')](_0x1e6a26,function(_0x545b8d){if(_0x545b8d[_0x2471('0x42')]!==_0x2471('0x52')){var _0x33890b={};_0x33890b[_0x545b8d[_0x2471('0x3c')]]={'$like':'%'+_0x4c108d[_0x2471('0x46')][_0x2471('0x51')]+'%'};return _0x33890b;}})});}_0x595dc7=_[_0x2471('0x53')]({},_0x595dc7,_0x4c108d[_0x2471('0x54')]);var _0x23d599={'where':_0x595dc7['where']};return db[_0x2471('0x3f')][_0x2471('0x30')](_0x23d599)[_0x2471('0x1e')](function(_0x16cb68){_0x31c2e4[_0x2471('0x30')]=_0x16cb68;if(_0x4c108d['query'][_0x2471('0x55')]){_0x595dc7[_0x2471('0x56')]=[{'all':!![]}];}return db[_0x2471('0x3f')][_0x2471('0x57')](_0x595dc7);})['then'](function(_0x457f43){_0x31c2e4[_0x2471('0x58')]=_0x457f43;return _0x31c2e4;})[_0x2471('0x1e')](respondWithFilteredResult(_0x3a4ba6,_0x595dc7))[_0x2471('0x28')](handleError(_0x3a4ba6,null));};exports['show']=function(_0x4e9c3d,_0x5b81ec){var _0x4b483f={'raw':![],'where':{'id':_0x4e9c3d[_0x2471('0x59')]['id']}},_0x34055d={};_0x34055d[_0x2471('0x44')]=_[_0x2471('0x45')](db[_0x2471('0x3f')]['rawAttributes']);_0x34055d[_0x2471('0x46')]=_[_0x2471('0x45')](_0x4e9c3d[_0x2471('0x46')]);_0x34055d['filters']=_[_0x2471('0x47')](_0x34055d[_0x2471('0x44')],_0x34055d['query']);_0x4b483f['attributes']=_[_0x2471('0x47')](_0x34055d[_0x2471('0x44')],qs[_0x2471('0x49')](_0x4e9c3d[_0x2471('0x46')]['fields']));_0x4b483f['attributes']=_0x4b483f['attributes']['length']?_0x4b483f['attributes']:_0x34055d[_0x2471('0x44')];if(_0x4e9c3d[_0x2471('0x46')][_0x2471('0x55')]){_0x4b483f[_0x2471('0x56')]=[{'all':!![]}];}_0x4b483f=_[_0x2471('0x53')]({},_0x4b483f,_0x4e9c3d[_0x2471('0x54')]);return db[_0x2471('0x3f')][_0x2471('0x5a')](_0x4b483f)[_0x2471('0x1e')](handleEntityNotFound(_0x5b81ec,null))[_0x2471('0x1e')](respondWithResult(_0x5b81ec,null))[_0x2471('0x28')](handleError(_0x5b81ec,null));};exports[_0x2471('0x5b')]=function(_0x31da08,_0x441cf9,_0x366ab1){var _0x429301;return db[_0x2471('0x3f')]['create'](_0x31da08[_0x2471('0x5c')],{'raw':!![]})[_0x2471('0x1e')](function(_0x2e4cbf){_0x429301=_0x2e4cbf;return db['VoiceContext'][_0x2471('0x57')]({'raw':!![]});})['then'](function(_0x48614c){var _0x5af882=fs[_0x2471('0x5d')](path[_0x2471('0x5e')](config['root'],_0x2471('0x5f')),_0x2471('0x60'));var _0x2124d8=ejs[_0x2471('0x61')](_0x5af882,{'contexts':_0x48614c||[]});fs[_0x2471('0x62')](_0x2471('0x63'),_0x2124d8);})[_0x2471('0x1e')](function(){return respondWithRpcPromise(_0x2471('0x64'),_0x2471('0x5b'),{'module':_0x2471('0x65')});})['then'](function(){var _0x392428=_0x31da08[_0x2471('0x66')][_0x2471('0x38')]({'plain':!![]});if(!_0x392428)throw new Error(_0x2471('0x67'));if(_0x392428['role']===_0x2471('0x66')){var _0x56252d=_0x429301[_0x2471('0x38')]({'plain':!![]});return db[_0x2471('0x68')][_0x2471('0x5a')]({'where':{'name':_0x2471('0x39'),'userProfileId':_0x392428[_0x2471('0x69')]},'raw':!![]})[_0x2471('0x1e')](function(_0x226e20){if(_0x226e20&&_0x226e20['autoAssociation']===0x0){return db[_0x2471('0x3a')][_0x2471('0x5b')]({'name':_0x56252d[_0x2471('0x3c')],'resourceId':_0x56252d['id'],'type':_0x226e20[_0x2471('0x3c')],'sectionId':_0x226e20['id']},{})['then'](function(){return _0x429301;});}else{return _0x429301;}})['catch'](function(_0x4b7c5c){logger['error'](_0x2471('0x6a'),_0x4b7c5c);throw _0x4b7c5c;});}return _0x429301;})['then'](respondWithResult(_0x441cf9,0xc9))[_0x2471('0x28')](handleError(_0x441cf9,null));};exports['update']=function(_0x4818aa,_0x520723,_0x281945){var _0x476147;return db[_0x2471('0x3f')][_0x2471('0x5a')]({'where':{'id':_0x4818aa[_0x2471('0x59')]['id']}})[_0x2471('0x1e')](handleEntityNotFound(_0x520723,null))[_0x2471('0x1e')](saveUpdates(_0x4818aa[_0x2471('0x5c')],null))[_0x2471('0x1e')](function(_0xbc133a){if(_0xbc133a){_0x476147=_0xbc133a;return db[_0x2471('0x3f')][_0x2471('0x57')]({'raw':!![]});}})[_0x2471('0x1e')](function(_0x5e698d){var _0x1fc787=fs[_0x2471('0x5d')](path[_0x2471('0x5e')](config[_0x2471('0x6b')],_0x2471('0x5f')),_0x2471('0x60'));var _0x347eb9=ejs[_0x2471('0x61')](_0x1fc787,{'contexts':_0x5e698d||[]});fs[_0x2471('0x62')](_0x2471('0x63'),_0x347eb9);})[_0x2471('0x1e')](function(){return respondWithRpcPromise(_0x2471('0x64'),_0x2471('0x36'),{'module':_0x2471('0x65')});})[_0x2471('0x1e')](function(){return _0x476147;})['then'](respondWithResult(_0x520723,null))[_0x2471('0x28')](handleError(_0x520723,null));};exports[_0x2471('0x37')]=function(_0x38e05d,_0xf28be4,_0x4ebccd){var _0x1463fb;return db[_0x2471('0x3f')][_0x2471('0x5a')]({'where':{'id':_0x38e05d['params']['id']}})['then'](handleEntityNotFound(_0xf28be4,null))[_0x2471('0x1e')](removeEntity(_0xf28be4,null))['then'](function(){return db[_0x2471('0x3f')][_0x2471('0x57')]({'raw':!![]});})[_0x2471('0x1e')](function(_0x455059){var _0x25b532=fs['readFileSync'](path[_0x2471('0x5e')](config[_0x2471('0x6b')],'server/files/templates/context.ejs'),_0x2471('0x60'));var _0x6be612=ejs['render'](_0x25b532,{'contexts':_0x455059});fs[_0x2471('0x62')](_0x2471('0x63'),_0x6be612);return respondWithRpcPromise(_0x2471('0x64'),_0x2471('0x37'),{'module':'chan_sip.so'});})[_0x2471('0x28')](handleError(_0xf28be4,null));}; \ No newline at end of file +var _0x2327=['type','key','model','keys','filters','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','rows','show','params','intersection','include','options','find','create','body','readFileSync','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','findAll','utf8','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','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','limit','count','set','reject','then','destroy','get','UserProfileResource','stack','name','send','map','VoiceContext','rawAttributes','fieldName'];(function(_0x4fe6f6,_0x3eaddb){var _0x27eebf=function(_0x59cf5e){while(--_0x59cf5e){_0x4fe6f6['push'](_0x4fe6f6['shift']());}};_0x27eebf(++_0x3eaddb);}(_0x2327,0x166));var _0x7232=function(_0x26e3cb,_0x3e38c3){_0x26e3cb=_0x26e3cb-0x0;var _0x15e990=_0x2327[_0x26e3cb];return _0x15e990;};'use strict';var emlformat=require(_0x7232('0x0'));var rimraf=require(_0x7232('0x1'));var zipdir=require(_0x7232('0x2'));var jsonpatch=require(_0x7232('0x3'));var rp=require(_0x7232('0x4'));var moment=require(_0x7232('0x5'));var BPromise=require(_0x7232('0x6'));var Mustache=require(_0x7232('0x7'));var util=require('util');var path=require(_0x7232('0x8'));var sox=require(_0x7232('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7232('0xa'));var _=require(_0x7232('0xb'));var squel=require(_0x7232('0xc'));var crypto=require('crypto');var jsforce=require(_0x7232('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7232('0xe'));var Redis=require('ioredis');var authService=require(_0x7232('0xf'));var qs=require(_0x7232('0x10'));var as=require(_0x7232('0x11'));var hardwareService=require(_0x7232('0x12'));var logger=require(_0x7232('0x13'))('api');var utils=require(_0x7232('0x14'));var config=require(_0x7232('0x15'));var licenseUtil=require(_0x7232('0x16'));var db=require(_0x7232('0x17'))['db'];var jayson=require(_0x7232('0x18'));var client=jayson[_0x7232('0x19')][_0x7232('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5cc745,_0x5604ee,_0x1ff7e5,_0x1c38d7){return new BPromise(function(_0xc04b0d,_0x332746){var _0x1a73af=_0x1c38d7||client;return _0x1a73af[_0x7232('0x1b')](_0x5cc745,_0x1ff7e5)['then'](function(_0x474269){logger[_0x7232('0x1c')](_0x7232('0x1d'),_0x5604ee,_0x7232('0x1e'));logger['debug'](_0x7232('0x1f'),_0x5604ee,_0x7232('0x1e'),JSON[_0x7232('0x20')](_0x474269));if(_0x474269['error']){if(_0x474269[_0x7232('0x21')][_0x7232('0x22')]===0x1f4){logger[_0x7232('0x21')](_0x7232('0x1d'),_0x5604ee,_0x474269['error'][_0x7232('0x23')]);return _0x332746(_0x474269[_0x7232('0x21')][_0x7232('0x23')]);}logger['error'](_0x7232('0x1d'),_0x5604ee,_0x474269['error'][_0x7232('0x23')]);return _0xc04b0d(_0x474269['error'][_0x7232('0x23')]);}else{logger[_0x7232('0x1c')](_0x7232('0x1d'),_0x5604ee,_0x7232('0x1e'));_0xc04b0d(_0x474269['result']['message']);}})[_0x7232('0x24')](function(_0x3abb36){logger['error'](_0x7232('0x1d'),_0x5604ee,_0x3abb36);_0x332746(_0x3abb36);});});}function respondWithStatusCode(_0xd3d35c,_0x32190d){_0x32190d=_0x32190d||0xcc;return function(_0x41fd84){if(_0x41fd84){return _0xd3d35c[_0x7232('0x25')](_0x32190d);}return _0xd3d35c[_0x7232('0x26')](_0x32190d)[_0x7232('0x27')]();};}function respondWithResult(_0x222639,_0x5d0787){_0x5d0787=_0x5d0787||0xc8;return function(_0x40f5a7){if(_0x40f5a7){return _0x222639[_0x7232('0x26')](_0x5d0787)[_0x7232('0x28')](_0x40f5a7);}};}function respondWithFilteredResult(_0x168193,_0x1d0f25){return function(_0x374699){if(_0x374699){var _0x5f4327=typeof _0x1d0f25[_0x7232('0x29')]===_0x7232('0x2a')&&typeof _0x1d0f25[_0x7232('0x2b')]===_0x7232('0x2a');var _0x59e3b3=_0x374699[_0x7232('0x2c')];var _0x3f67a8=_0x5f4327?0x0:_0x1d0f25[_0x7232('0x29')];var _0x3869f2=_0x5f4327?_0x374699['count']:_0x1d0f25[_0x7232('0x29')]+_0x1d0f25['limit'];var _0x552e13;if(_0x3869f2>=_0x59e3b3){_0x3869f2=_0x59e3b3;_0x552e13=0xc8;}else{_0x552e13=0xce;}_0x168193[_0x7232('0x26')](_0x552e13);return _0x168193[_0x7232('0x2d')]('Content-Range',_0x3f67a8+'-'+_0x3869f2+'/'+_0x59e3b3)[_0x7232('0x28')](_0x374699);}return null;};}function patchUpdates(_0x1c09a0){return function(_0x2dc03b){try{jsonpatch['apply'](_0x2dc03b,_0x1c09a0,!![]);}catch(_0x28d924){return BPromise[_0x7232('0x2e')](_0x28d924);}return _0x2dc03b['save']();};}function saveUpdates(_0x2e003e,_0xfc4849){return function(_0x3679e7){if(_0x3679e7){return _0x3679e7['update'](_0x2e003e)[_0x7232('0x2f')](function(_0x569991){return _0x569991;});}return null;};}function removeEntity(_0x22153e,_0x31e96d){return function(_0xbca39c){if(_0xbca39c){return _0xbca39c[_0x7232('0x30')]()[_0x7232('0x2f')](function(){var _0x26de0f=_0xbca39c[_0x7232('0x31')]({'plain':!![]});var _0x3ca61a='Contexts';return db[_0x7232('0x32')][_0x7232('0x30')]({'where':{'type':_0x3ca61a,'resourceId':_0x26de0f['id']}})['then'](function(){return _0xbca39c;});})[_0x7232('0x2f')](function(){_0x22153e[_0x7232('0x26')](0xcc)[_0x7232('0x27')]();});}};}function handleEntityNotFound(_0xdbd184,_0x464e20){return function(_0x856b32){if(!_0x856b32){_0xdbd184['sendStatus'](0x194);}return _0x856b32;};}function handleError(_0x607348,_0x69e2de){_0x69e2de=_0x69e2de||0x1f4;return function(_0xb39e9e){logger[_0x7232('0x21')](_0xb39e9e[_0x7232('0x33')]);if(_0xb39e9e['name']){delete _0xb39e9e[_0x7232('0x34')];}_0x607348[_0x7232('0x26')](_0x69e2de)[_0x7232('0x35')](_0xb39e9e);};}exports['index']=function(_0x428369,_0x13d6d5){var _0x3b9294={},_0x32127c={},_0x5239fa={'count':0x0,'rows':[]};var _0x212671=_[_0x7232('0x36')](db[_0x7232('0x37')][_0x7232('0x38')],function(_0x237264){return{'name':_0x237264[_0x7232('0x39')],'type':_0x237264[_0x7232('0x3a')][_0x7232('0x3b')]};});_0x32127c[_0x7232('0x3c')]=_[_0x7232('0x36')](_0x212671,'name');_0x32127c['query']=_[_0x7232('0x3d')](_0x428369['query']);_0x32127c[_0x7232('0x3e')]=_['intersection'](_0x32127c[_0x7232('0x3c')],_0x32127c[_0x7232('0x3f')]);_0x3b9294[_0x7232('0x40')]=_['intersection'](_0x32127c['model'],qs[_0x7232('0x41')](_0x428369[_0x7232('0x3f')][_0x7232('0x41')]));_0x3b9294['attributes']=_0x3b9294[_0x7232('0x40')][_0x7232('0x42')]?_0x3b9294[_0x7232('0x40')]:_0x32127c[_0x7232('0x3c')];if(!_0x428369[_0x7232('0x3f')][_0x7232('0x43')](_0x7232('0x44'))){_0x3b9294[_0x7232('0x2b')]=qs[_0x7232('0x2b')](_0x428369[_0x7232('0x3f')][_0x7232('0x2b')]);_0x3b9294['offset']=qs['offset'](_0x428369[_0x7232('0x3f')]['offset']);}_0x3b9294[_0x7232('0x45')]=qs['sort'](_0x428369['query'][_0x7232('0x46')]);_0x3b9294[_0x7232('0x47')]=qs['filters'](_[_0x7232('0x48')](_0x428369[_0x7232('0x3f')],_0x32127c[_0x7232('0x3e')]),_0x212671);if(_0x428369[_0x7232('0x3f')]['filter']){_0x3b9294['where']=_[_0x7232('0x49')](_0x3b9294[_0x7232('0x47')],{'$or':_[_0x7232('0x36')](_0x212671,function(_0x5390ed){if(_0x5390ed[_0x7232('0x3a')]!==_0x7232('0x4a')){var _0x53bd6e={};_0x53bd6e[_0x5390ed[_0x7232('0x34')]]={'$like':'%'+_0x428369[_0x7232('0x3f')][_0x7232('0x4b')]+'%'};return _0x53bd6e;}})});}_0x3b9294=_['merge']({},_0x3b9294,_0x428369['options']);var _0x42db6c={'where':_0x3b9294[_0x7232('0x47')]};return db[_0x7232('0x37')][_0x7232('0x2c')](_0x42db6c)[_0x7232('0x2f')](function(_0x544f07){_0x5239fa[_0x7232('0x2c')]=_0x544f07;if(_0x428369[_0x7232('0x3f')][_0x7232('0x4c')]){_0x3b9294['include']=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x3b9294);})[_0x7232('0x2f')](function(_0x2251d8){_0x5239fa[_0x7232('0x4d')]=_0x2251d8;return _0x5239fa;})[_0x7232('0x2f')](respondWithFilteredResult(_0x13d6d5,_0x3b9294))[_0x7232('0x24')](handleError(_0x13d6d5,null));};exports[_0x7232('0x4e')]=function(_0x95424c,_0x391e08){var _0x41413b={'raw':![],'where':{'id':_0x95424c[_0x7232('0x4f')]['id']}},_0x5b4660={};_0x5b4660[_0x7232('0x3c')]=_[_0x7232('0x3d')](db[_0x7232('0x37')][_0x7232('0x38')]);_0x5b4660[_0x7232('0x3f')]=_[_0x7232('0x3d')](_0x95424c['query']);_0x5b4660['filters']=_[_0x7232('0x50')](_0x5b4660[_0x7232('0x3c')],_0x5b4660['query']);_0x41413b[_0x7232('0x40')]=_[_0x7232('0x50')](_0x5b4660[_0x7232('0x3c')],qs[_0x7232('0x41')](_0x95424c[_0x7232('0x3f')][_0x7232('0x41')]));_0x41413b[_0x7232('0x40')]=_0x41413b[_0x7232('0x40')][_0x7232('0x42')]?_0x41413b[_0x7232('0x40')]:_0x5b4660[_0x7232('0x3c')];if(_0x95424c[_0x7232('0x3f')][_0x7232('0x4c')]){_0x41413b[_0x7232('0x51')]=[{'all':!![]}];}_0x41413b=_[_0x7232('0x49')]({},_0x41413b,_0x95424c[_0x7232('0x52')]);return db[_0x7232('0x37')][_0x7232('0x53')](_0x41413b)[_0x7232('0x2f')](handleEntityNotFound(_0x391e08,null))[_0x7232('0x2f')](respondWithResult(_0x391e08,null))['catch'](handleError(_0x391e08,null));};exports[_0x7232('0x54')]=function(_0x592f69,_0x396073,_0x4dbd28){var _0x34dee3;return db[_0x7232('0x37')][_0x7232('0x54')](_0x592f69[_0x7232('0x55')],{'raw':!![]})['then'](function(_0x414b35){_0x34dee3=_0x414b35;return db['VoiceContext']['findAll']({'raw':!![]});})[_0x7232('0x2f')](function(_0x5ee896){var _0x24ec40=fs[_0x7232('0x56')](path[_0x7232('0x57')](config[_0x7232('0x58')],'server/files/templates/context.ejs'),'utf8');var _0x2ff94d=ejs[_0x7232('0x59')](_0x24ec40,{'contexts':_0x5ee896||[]});fs[_0x7232('0x5a')](_0x7232('0x5b'),_0x2ff94d);})['then'](function(){return respondWithRpcPromise(_0x7232('0x5c'),'create',{'module':_0x7232('0x5d')});})[_0x7232('0x2f')](function(){var _0x4e79c9=_0x592f69['user'][_0x7232('0x31')]({'plain':!![]});if(!_0x4e79c9)throw new Error(_0x7232('0x5e'));if(_0x4e79c9[_0x7232('0x5f')]===_0x7232('0x60')){var _0x54de43=_0x34dee3[_0x7232('0x31')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x7232('0x61'),'userProfileId':_0x4e79c9[_0x7232('0x62')]},'raw':!![]})[_0x7232('0x2f')](function(_0xa70ac5){if(_0xa70ac5&&_0xa70ac5[_0x7232('0x63')]===0x0){return db[_0x7232('0x32')][_0x7232('0x54')]({'name':_0x54de43[_0x7232('0x34')],'resourceId':_0x54de43['id'],'type':_0xa70ac5['name'],'sectionId':_0xa70ac5['id']},{})[_0x7232('0x2f')](function(){return _0x34dee3;});}else{return _0x34dee3;}})['catch'](function(_0x135d14){logger[_0x7232('0x21')](_0x7232('0x64'),_0x135d14);throw _0x135d14;});}return _0x34dee3;})['then'](respondWithResult(_0x396073,0xc9))[_0x7232('0x24')](handleError(_0x396073,null));};exports[_0x7232('0x65')]=function(_0xa6e4a5,_0x2b605e,_0x454e00){var _0x270836;return db['VoiceContext'][_0x7232('0x53')]({'where':{'id':_0xa6e4a5['params']['id']}})[_0x7232('0x2f')](handleEntityNotFound(_0x2b605e,null))[_0x7232('0x2f')](saveUpdates(_0xa6e4a5[_0x7232('0x55')],null))[_0x7232('0x2f')](function(_0x45a020){if(_0x45a020){_0x270836=_0x45a020;return db[_0x7232('0x37')][_0x7232('0x66')]({'raw':!![]});}})['then'](function(_0x415003){var _0x1350e8=fs[_0x7232('0x56')](path['join'](config[_0x7232('0x58')],'server/files/templates/context.ejs'),_0x7232('0x67'));var _0x15154c=ejs[_0x7232('0x59')](_0x1350e8,{'contexts':_0x415003||[]});fs['writeFileSync'](_0x7232('0x5b'),_0x15154c);})[_0x7232('0x2f')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x7232('0x5d')});})[_0x7232('0x2f')](function(){return _0x270836;})[_0x7232('0x2f')](respondWithResult(_0x2b605e,null))[_0x7232('0x24')](handleError(_0x2b605e,null));};exports[_0x7232('0x30')]=function(_0x222344,_0x513eee,_0x4997c0){var _0x17f98e;return db['VoiceContext']['find']({'where':{'id':_0x222344['params']['id']}})[_0x7232('0x2f')](handleEntityNotFound(_0x513eee,null))['then'](removeEntity(_0x513eee,null))['then'](function(){return db[_0x7232('0x37')][_0x7232('0x66')]({'raw':!![]});})['then'](function(_0x5919e8){var _0x454131=fs['readFileSync'](path[_0x7232('0x57')](config[_0x7232('0x58')],'server/files/templates/context.ejs'),_0x7232('0x67'));var _0x57ec49=ejs[_0x7232('0x59')](_0x454131,{'contexts':_0x5919e8});fs['writeFileSync'](_0x7232('0x5b'),_0x57ec49);return respondWithRpcPromise(_0x7232('0x5c'),_0x7232('0x30'),{'module':_0x7232('0x5d')});})[_0x7232('0x24')](handleError(_0x513eee,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index fe82ace..b839bd9 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 _0xac85=['util','../../config/logger','api','moment','request-promise','path','rimraf','voice_contexts'];(function(_0x468be0,_0x50b945){var _0x3c71ec=function(_0x40ad7c){while(--_0x40ad7c){_0x468be0['push'](_0x468be0['shift']());}};_0x3c71ec(++_0x50b945);}(_0xac85,0x1e0));var _0x5ac8=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xac85[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x5ac8('0x0'));var logger=require(_0x5ac8('0x1'))(_0x5ac8('0x2'));var moment=require(_0x5ac8('0x3'));var BPromise=require('bluebird');var rp=require(_0x5ac8('0x4'));var fs=require('fs');var path=require(_0x5ac8('0x5'));var rimraf=require(_0x5ac8('0x6'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module['exports']=function(_0x3f2ff2,_0x304bc1){return _0x3f2ff2['define']('VoiceContext',attributes,{'tableName':_0x5ac8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c1a=['rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','bluebird','path'];(function(_0x2fe65f,_0x21d075){var _0x18247a=function(_0x35c994){while(--_0x35c994){_0x2fe65f['push'](_0x2fe65f['shift']());}};_0x18247a(++_0x21d075);}(_0x0c1a,0x127));var _0xa0c1=function(_0x2f8b45,_0x10425b){_0x2f8b45=_0x2f8b45-0x0;var _0xff9db=_0x0c1a[_0x2f8b45];return _0xff9db;};'use strict';var _=require(_0xa0c1('0x0'));var util=require(_0xa0c1('0x1'));var logger=require(_0xa0c1('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa0c1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa0c1('0x4'));var rimraf=require(_0xa0c1('0x5'));var config=require(_0xa0c1('0x6'));var attributes=require(_0xa0c1('0x7'));module[_0xa0c1('0x8')]=function(_0x44538a,_0x199950){return _0x44538a[_0xa0c1('0x9')](_0xa0c1('0xa'),attributes,{'tableName':_0xa0c1('0xb'),'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 259bb85..119487c 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 _0xae2b=['http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0xae2b,0xb3));var _0xbae2=function(_0x42714b,_0x3a5c87){_0x42714b=_0x42714b-0x0;var _0x56767e=_0xae2b[_0x42714b];return _0x56767e;};'use strict';var _=require(_0xbae2('0x0'));var util=require(_0xbae2('0x1'));var moment=require('moment');var BPromise=require(_0xbae2('0x2'));var rs=require(_0xbae2('0x3'));var fs=require('fs');var Redis=require(_0xbae2('0x4'));var db=require(_0xbae2('0x5'))['db'];var utils=require(_0xbae2('0x6'));var logger=require(_0xbae2('0x7'))('rpc');var config=require(_0xbae2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbae2('0x9')][_0xbae2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18bc03,_0x4c0180,_0x4788c4){return new BPromise(function(_0x57f2ca,_0x54d696){return client[_0xbae2('0xb')](_0x18bc03,_0x4788c4)[_0xbae2('0xc')](function(_0x15c84a){logger[_0xbae2('0xd')](_0xbae2('0xe'),_0x4c0180,_0xbae2('0xf'));logger[_0xbae2('0x10')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4c0180,'request\x20sent',JSON['stringify'](_0x15c84a));if(_0x15c84a[_0xbae2('0x11')]){if(_0x15c84a['error'][_0xbae2('0x12')]===0x1f4){logger[_0xbae2('0x11')](_0xbae2('0xe'),_0x4c0180,_0x15c84a['error'][_0xbae2('0x13')]);return _0x54d696(_0x15c84a[_0xbae2('0x11')]['message']);}logger[_0xbae2('0x11')](_0xbae2('0xe'),_0x4c0180,_0x15c84a[_0xbae2('0x11')][_0xbae2('0x13')]);return _0x57f2ca(_0x15c84a[_0xbae2('0x11')][_0xbae2('0x13')]);}else{logger[_0xbae2('0xd')]('VoiceContext,\x20%s,\x20%s',_0x4c0180,_0xbae2('0xf'));_0x57f2ca(_0x15c84a['result'][_0xbae2('0x13')]);}})[_0xbae2('0x14')](function(_0x4fdcb3){logger[_0xbae2('0x11')](_0xbae2('0xe'),_0x4c0180,_0x4fdcb3);_0x54d696(_0x4fdcb3);});});} \ No newline at end of file +var _0xe5b5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x737a1f,_0x235fef){_0x737a1f=_0x737a1f-0x0;var _0x16eba1=_0xe5b5[_0x737a1f];return _0x16eba1;};'use strict';var _=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var moment=require(_0x5e5b('0x2'));var BPromise=require(_0x5e5b('0x3'));var rs=require(_0x5e5b('0x4'));var fs=require('fs');var Redis=require(_0x5e5b('0x5'));var db=require(_0x5e5b('0x6'))['db'];var utils=require(_0x5e5b('0x7'));var logger=require(_0x5e5b('0x8'))(_0x5e5b('0x9'));var config=require(_0x5e5b('0xa'));var jayson=require(_0x5e5b('0xb'));var client=jayson[_0x5e5b('0xc')][_0x5e5b('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x545eb3,_0x29db2c,_0xe089b1){return new BPromise(function(_0xcbd478,_0x258414){return client[_0x5e5b('0xe')](_0x545eb3,_0xe089b1)[_0x5e5b('0xf')](function(_0x3a37db){logger[_0x5e5b('0x10')]('VoiceContext,\x20%s,\x20%s',_0x29db2c,_0x5e5b('0x11'));logger['debug'](_0x5e5b('0x12'),_0x29db2c,_0x5e5b('0x11'),JSON[_0x5e5b('0x13')](_0x3a37db));if(_0x3a37db[_0x5e5b('0x14')]){if(_0x3a37db['error']['code']===0x1f4){logger['error'](_0x5e5b('0x15'),_0x29db2c,_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);return _0x258414(_0x3a37db[_0x5e5b('0x14')][_0x5e5b('0x16')]);}logger[_0x5e5b('0x14')](_0x5e5b('0x15'),_0x29db2c,_0x3a37db['error'][_0x5e5b('0x16')]);return _0xcbd478(_0x3a37db[_0x5e5b('0x14')]['message']);}else{logger[_0x5e5b('0x10')]('VoiceContext,\x20%s,\x20%s',_0x29db2c,'request\x20sent');_0xcbd478(_0x3a37db[_0x5e5b('0x17')][_0x5e5b('0x16')]);}})[_0x5e5b('0x18')](function(_0x5c7148){logger[_0x5e5b('0x14')]('VoiceContext,\x20%s,\x20%s',_0x29db2c,_0x5c7148);_0x258414(_0x5c7148);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 91debeb..b552cec 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 _0xd235=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','describe','put','/:id','update','delete','destroy','exports','multer','util','path','Router'];(function(_0x5cc9ba,_0xfbf79e){var _0x430a5a=function(_0x5c7575){while(--_0x5c7575){_0x5cc9ba['push'](_0x5cc9ba['shift']());}};_0x430a5a(++_0xfbf79e);}(_0xd235,0x11c));var _0x5d23=function(_0x193d7a,_0x11ac1c){_0x193d7a=_0x193d7a-0x0;var _0x283da8=_0xd235[_0x193d7a];return _0x283da8;};'use strict';var multer=require(_0x5d23('0x0'));var util=require(_0x5d23('0x1'));var path=require(_0x5d23('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5d23('0x3')]();var fs_extra=require(_0x5d23('0x4'));var auth=require(_0x5d23('0x5'));var interaction=require(_0x5d23('0x6'));var config=require(_0x5d23('0x7'));var controller=require(_0x5d23('0x8'));router[_0x5d23('0x9')]('/',auth[_0x5d23('0xa')](),controller['index']);router['get']('/describe',auth[_0x5d23('0xa')](),controller[_0x5d23('0xb')]);router[_0x5d23('0x9')]('/:id',auth[_0x5d23('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5d23('0xc')](_0x5d23('0xd'),auth[_0x5d23('0xa')](),controller[_0x5d23('0xe')]);router[_0x5d23('0xf')](_0x5d23('0xd'),auth[_0x5d23('0xa')](),controller[_0x5d23('0x10')]);module[_0x5d23('0x11')]=router; \ No newline at end of file +var _0x867f=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','show','post','create','put','/:id','delete','destroy','exports','multer'];(function(_0x4c5013,_0x4198a1){var _0x2d1a74=function(_0x6dd2a){while(--_0x6dd2a){_0x4c5013['push'](_0x4c5013['shift']());}};_0x2d1a74(++_0x4198a1);}(_0x867f,0xe6));var _0xf867=function(_0x52eb16,_0x89c3d8){_0x52eb16=_0x52eb16-0x0;var _0x382d3f=_0x867f[_0x52eb16];return _0x382d3f;};'use strict';var multer=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var path=require(_0xf867('0x2'));var timeout=require(_0xf867('0x3'));var express=require(_0xf867('0x4'));var router=express[_0xf867('0x5')]();var fs_extra=require(_0xf867('0x6'));var auth=require(_0xf867('0x7'));var interaction=require(_0xf867('0x8'));var config=require('../../config/environment');var controller=require('./voiceDialReport.controller');router[_0xf867('0x9')]('/',auth[_0xf867('0xa')](),controller[_0xf867('0xb')]);router[_0xf867('0x9')](_0xf867('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xf867('0x9')]('/:id',auth[_0xf867('0xa')](),controller[_0xf867('0xd')]);router[_0xf867('0xe')]('/',auth[_0xf867('0xa')](),controller[_0xf867('0xf')]);router[_0xf867('0x10')](_0xf867('0x11'),auth[_0xf867('0xa')](),controller['update']);router[_0xf867('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xf867('0x13')]);module[_0xf867('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index f85ac41..74194fe 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(_0x2f9b61,_0x36a531){var _0x1e9c0a=function(_0xd5d459){while(--_0xd5d459){_0x2f9b61['push'](_0x2f9b61['shift']());}};_0x1e9c0a(++_0x36a531);}(_0x24ca,0x1bc));var _0xa24c=function(_0x51beba,_0x202d19){_0x51beba=_0x51beba-0x0;var _0x167ee0=_0x24ca[_0x51beba];return _0x167ee0;};'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 _0x008c=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x529db8,_0xc04926){var _0x4ba726=function(_0x211948){while(--_0x211948){_0x529db8['push'](_0x529db8['shift']());}};_0x4ba726(++_0xc04926);}(_0x008c,0x188));var _0xc008=function(_0xd1b4df,_0x118a9a){_0xd1b4df=_0xd1b4df-0x0;var _0x24b551=_0x008c[_0xd1b4df];return _0x24b551;};'use strict';var Sequelize=require(_0xc008('0x0'));module[_0xc008('0x1')]={'privilege':{'type':Sequelize[_0xc008('0x2')]},'channel':{'type':Sequelize[_0xc008('0x2')]},'channelstate':{'type':Sequelize[_0xc008('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc008('0x2')]},'calleridname':{'type':Sequelize[_0xc008('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'connectedlinename':{'type':Sequelize[_0xc008('0x2')]},'language':{'type':Sequelize[_0xc008('0x2')]},'accountcode':{'type':Sequelize[_0xc008('0x2')]},'context':{'type':Sequelize[_0xc008('0x2')]},'exten':{'type':Sequelize[_0xc008('0x2')]},'priority':{'type':Sequelize[_0xc008('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xc008('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc008('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc008('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xc008('0x2')]},'destexten':{'type':Sequelize[_0xc008('0x2')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0xc008('0x2')]},'destlinkedid':{'type':Sequelize[_0xc008('0x2')]},'dialstring':{'type':Sequelize[_0xc008('0x2')]},'dialstatus':{'type':Sequelize[_0xc008('0x2')]},'starttime':{'type':Sequelize[_0xc008('0x4')]},'answertime':{'type':Sequelize[_0xc008('0x4')]},'endtime':{'type':Sequelize[_0xc008('0x4')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xc008('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xc008('0x3')]},'billableseconds':{'type':Sequelize[_0xc008('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index d14702a..de68b04 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 _0xddee=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','VIRTUAL','VoiceDialReport','includeAll','include','catch','show','params','rawAttributes','find','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','fieldName','type','query','keys','filters','intersection','model'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xddee,0x139));var _0xedde=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0xddee[_0x1fdb40];return _0x281f93;};'use strict';var emlformat=require(_0xedde('0x0'));var rimraf=require(_0xedde('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xedde('0x2'));var rp=require(_0xedde('0x3'));var moment=require('moment');var BPromise=require(_0xedde('0x4'));var Mustache=require('mustache');var util=require(_0xedde('0x5'));var path=require(_0xedde('0x6'));var sox=require('sox');var csv=require(_0xedde('0x7'));var ejs=require(_0xedde('0x8'));var fs=require('fs');var fs_extra=require(_0xedde('0x9'));var _=require(_0xedde('0xa'));var squel=require(_0xedde('0xb'));var crypto=require(_0xedde('0xc'));var jsforce=require(_0xedde('0xd'));var deskjs=require(_0xedde('0xe'));var toCsv=require(_0xedde('0x7'));var querystring=require(_0xedde('0xf'));var Papa=require(_0xedde('0x10'));var Redis=require(_0xedde('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xedde('0x12'));var as=require(_0xedde('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xedde('0x14'))(_0xedde('0x15'));var utils=require(_0xedde('0x16'));var config=require(_0xedde('0x17'));var licenseUtil=require(_0xedde('0x18'));var db=require(_0xedde('0x19'))['db'];function respondWithStatusCode(_0x2f0e81,_0x2ff47c){_0x2ff47c=_0x2ff47c||0xcc;return function(_0xf0a1f){if(_0xf0a1f){return _0x2f0e81[_0xedde('0x1a')](_0x2ff47c);}return _0x2f0e81[_0xedde('0x1b')](_0x2ff47c)[_0xedde('0x1c')]();};}function respondWithResult(_0xd631f6,_0x3d7f12){_0x3d7f12=_0x3d7f12||0xc8;return function(_0x8649c0){if(_0x8649c0){return _0xd631f6[_0xedde('0x1b')](_0x3d7f12)[_0xedde('0x1d')](_0x8649c0);}};}function respondWithFilteredResult(_0x63fb62,_0x24d95c){return function(_0xf164ed){if(_0xf164ed){var _0x366348=typeof _0x24d95c['offset']===_0xedde('0x1e')&&typeof _0x24d95c[_0xedde('0x1f')]===_0xedde('0x1e');var _0x5f54c9=_0xf164ed[_0xedde('0x20')];var _0x2651a6=_0x366348?0x0:_0x24d95c[_0xedde('0x21')];var _0x2cc897=_0x366348?_0xf164ed[_0xedde('0x20')]:_0x24d95c[_0xedde('0x21')]+_0x24d95c['limit'];var _0x437d0c;if(_0x2cc897>=_0x5f54c9){_0x2cc897=_0x5f54c9;_0x437d0c=0xc8;}else{_0x437d0c=0xce;}_0x63fb62[_0xedde('0x1b')](_0x437d0c);return _0x63fb62[_0xedde('0x22')](_0xedde('0x23'),_0x2651a6+'-'+_0x2cc897+'/'+_0x5f54c9)[_0xedde('0x1d')](_0xf164ed);}return null;};}function patchUpdates(_0x5c2668){return function(_0x485bbd){try{jsonpatch[_0xedde('0x24')](_0x485bbd,_0x5c2668,!![]);}catch(_0x3ac45){return BPromise[_0xedde('0x25')](_0x3ac45);}return _0x485bbd['save']();};}function saveUpdates(_0x26c544,_0x26ec3e){return function(_0x2eed87){if(_0x2eed87){return _0x2eed87[_0xedde('0x26')](_0x26c544)[_0xedde('0x27')](function(_0x70699f){return _0x70699f;});}return null;};}function removeEntity(_0x25f105,_0x2bac46){return function(_0x19b5e3){if(_0x19b5e3){return _0x19b5e3[_0xedde('0x28')]()[_0xedde('0x27')](function(){_0x25f105[_0xedde('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14669f,_0x3e9afe){return function(_0x2f3c21){if(!_0x2f3c21){_0x14669f[_0xedde('0x1a')](0x194);}return _0x2f3c21;};}function handleError(_0x8b2da,_0x24d4e6){_0x24d4e6=_0x24d4e6||0x1f4;return function(_0x9f6d03){logger['error'](_0x9f6d03[_0xedde('0x29')]);if(_0x9f6d03['name']){delete _0x9f6d03[_0xedde('0x2a')];}_0x8b2da[_0xedde('0x1b')](_0x24d4e6)[_0xedde('0x2b')](_0x9f6d03);};}exports[_0xedde('0x2c')]=function(_0x30afeb,_0x348548){var _0x377b13={},_0x440257={},_0x3a63f6={'count':0x0,'rows':[]};var _0x47a366=_['map'](db['VoiceDialReport']['rawAttributes'],function(_0x1264dd){return{'name':_0x1264dd[_0xedde('0x2d')],'type':_0x1264dd[_0xedde('0x2e')]['key']};});_0x440257['model']=_['map'](_0x47a366,_0xedde('0x2a'));_0x440257[_0xedde('0x2f')]=_[_0xedde('0x30')](_0x30afeb['query']);_0x440257[_0xedde('0x31')]=_[_0xedde('0x32')](_0x440257[_0xedde('0x33')],_0x440257[_0xedde('0x2f')]);_0x377b13[_0xedde('0x34')]=_[_0xedde('0x32')](_0x440257[_0xedde('0x33')],qs[_0xedde('0x35')](_0x30afeb[_0xedde('0x2f')][_0xedde('0x35')]));_0x377b13[_0xedde('0x34')]=_0x377b13[_0xedde('0x34')][_0xedde('0x36')]?_0x377b13['attributes']:_0x440257[_0xedde('0x33')];if(!_0x30afeb['query'][_0xedde('0x37')](_0xedde('0x38'))){_0x377b13['limit']=qs[_0xedde('0x1f')](_0x30afeb[_0xedde('0x2f')]['limit']);_0x377b13[_0xedde('0x21')]=qs[_0xedde('0x21')](_0x30afeb[_0xedde('0x2f')]['offset']);}_0x377b13[_0xedde('0x39')]=qs[_0xedde('0x3a')](_0x30afeb[_0xedde('0x2f')][_0xedde('0x3a')]);_0x377b13[_0xedde('0x3b')]=qs[_0xedde('0x31')](_[_0xedde('0x3c')](_0x30afeb[_0xedde('0x2f')],_0x440257[_0xedde('0x31')]),_0x47a366);if(_0x30afeb[_0xedde('0x2f')]['filter']){_0x377b13['where']=_[_0xedde('0x3d')](_0x377b13[_0xedde('0x3b')],{'$or':_[_0xedde('0x3e')](_0x47a366,function(_0x1e5c4a){if(_0x1e5c4a[_0xedde('0x2e')]!==_0xedde('0x3f')){var _0x1b2b9e={};_0x1b2b9e[_0x1e5c4a['name']]={'$like':'%'+_0x30afeb[_0xedde('0x2f')]['filter']+'%'};return _0x1b2b9e;}})});}_0x377b13=_[_0xedde('0x3d')]({},_0x377b13,_0x30afeb['options']);var _0x1664f1={'where':_0x377b13[_0xedde('0x3b')]};return db[_0xedde('0x40')]['count'](_0x1664f1)[_0xedde('0x27')](function(_0x442cb5){_0x3a63f6[_0xedde('0x20')]=_0x442cb5;if(_0x30afeb[_0xedde('0x2f')][_0xedde('0x41')]){_0x377b13[_0xedde('0x42')]=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x377b13);})[_0xedde('0x27')](function(_0xdadaa9){_0x3a63f6['rows']=_0xdadaa9;return _0x3a63f6;})[_0xedde('0x27')](respondWithFilteredResult(_0x348548,_0x377b13))[_0xedde('0x43')](handleError(_0x348548,null));};exports[_0xedde('0x44')]=function(_0x2a63a0,_0x13d33d){var _0x433c48={'raw':!![],'where':{'id':_0x2a63a0[_0xedde('0x45')]['id']}},_0x334ea2={};_0x334ea2['model']=_[_0xedde('0x30')](db[_0xedde('0x40')][_0xedde('0x46')]);_0x334ea2['query']=_[_0xedde('0x30')](_0x2a63a0[_0xedde('0x2f')]);_0x334ea2['filters']=_[_0xedde('0x32')](_0x334ea2[_0xedde('0x33')],_0x334ea2[_0xedde('0x2f')]);_0x433c48[_0xedde('0x34')]=_['intersection'](_0x334ea2[_0xedde('0x33')],qs['fields'](_0x2a63a0[_0xedde('0x2f')][_0xedde('0x35')]));_0x433c48[_0xedde('0x34')]=_0x433c48[_0xedde('0x34')][_0xedde('0x36')]?_0x433c48[_0xedde('0x34')]:_0x334ea2['model'];if(_0x2a63a0[_0xedde('0x2f')][_0xedde('0x41')]){_0x433c48['include']=[{'all':!![]}];}_0x433c48=_['merge']({},_0x433c48,_0x2a63a0['options']);return db['VoiceDialReport'][_0xedde('0x47')](_0x433c48)[_0xedde('0x27')](handleEntityNotFound(_0x13d33d,null))['then'](respondWithResult(_0x13d33d,null))['catch'](handleError(_0x13d33d,null));};exports['create']=function(_0x3181d6,_0x366545){return db[_0xedde('0x40')]['create'](_0x3181d6['body'],{})['then'](respondWithResult(_0x366545,0xc9))[_0xedde('0x43')](handleError(_0x366545,null));};exports['update']=function(_0xfbb66a,_0x2bebe2){if(_0xfbb66a[_0xedde('0x48')]['id']){delete _0xfbb66a[_0xedde('0x48')]['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0xfbb66a[_0xedde('0x45')]['id']}})[_0xedde('0x27')](handleEntityNotFound(_0x2bebe2,null))[_0xedde('0x27')](saveUpdates(_0xfbb66a[_0xedde('0x48')],null))[_0xedde('0x27')](respondWithResult(_0x2bebe2,null))[_0xedde('0x43')](handleError(_0x2bebe2,null));};exports[_0xedde('0x28')]=function(_0x208f23,_0x51cccd){return db[_0xedde('0x40')]['find']({'where':{'id':_0x208f23[_0xedde('0x45')]['id']}})[_0xedde('0x27')](handleEntityNotFound(_0x51cccd,null))[_0xedde('0x27')](removeEntity(_0x51cccd,null))['catch'](handleError(_0x51cccd,null));};exports['describe']=function(_0x218240,_0xfb1a45){return db[_0xedde('0x40')]['describe']()['then'](respondWithResult(_0xfb1a45,null))[_0xedde('0x43')](handleError(_0xfb1a45,null));}; \ No newline at end of file +var _0xc63d=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','stack','name','send','index','map','VoiceDialReport','rawAttributes','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','filters','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring'];(function(_0x1b6674,_0x97ef86){var _0x23df18=function(_0x4d04a0){while(--_0x4d04a0){_0x1b6674['push'](_0x1b6674['shift']());}};_0x23df18(++_0x97ef86);}(_0xc63d,0xfb));var _0xdc63=function(_0x1658e2,_0x29cd35){_0x1658e2=_0x1658e2-0x0;var _0x38bf8a=_0xc63d[_0x1658e2];return _0x38bf8a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdc63('0x0'));var zipdir=require(_0xdc63('0x1'));var jsonpatch=require(_0xdc63('0x2'));var rp=require('request-promise');var moment=require(_0xdc63('0x3'));var BPromise=require(_0xdc63('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xdc63('0x5'));var csv=require(_0xdc63('0x6'));var ejs=require(_0xdc63('0x7'));var fs=require('fs');var fs_extra=require(_0xdc63('0x8'));var _=require('lodash');var squel=require(_0xdc63('0x9'));var crypto=require(_0xdc63('0xa'));var jsforce=require(_0xdc63('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdc63('0x6'));var querystring=require(_0xdc63('0xc'));var Papa=require('papaparse');var Redis=require(_0xdc63('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xdc63('0xe'));var as=require(_0xdc63('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdc63('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xdc63('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xdc63('0x12'))['db'];function respondWithStatusCode(_0x18c8b5,_0x159fd0){_0x159fd0=_0x159fd0||0xcc;return function(_0x83c373){if(_0x83c373){return _0x18c8b5[_0xdc63('0x13')](_0x159fd0);}return _0x18c8b5[_0xdc63('0x14')](_0x159fd0)[_0xdc63('0x15')]();};}function respondWithResult(_0x407aab,_0x3daec5){_0x3daec5=_0x3daec5||0xc8;return function(_0x523fd3){if(_0x523fd3){return _0x407aab[_0xdc63('0x14')](_0x3daec5)[_0xdc63('0x16')](_0x523fd3);}};}function respondWithFilteredResult(_0x679dcf,_0x2c0b46){return function(_0x41d145){if(_0x41d145){var _0x5d0da4=typeof _0x2c0b46[_0xdc63('0x17')]===_0xdc63('0x18')&&typeof _0x2c0b46[_0xdc63('0x19')]===_0xdc63('0x18');var _0x42c98d=_0x41d145[_0xdc63('0x1a')];var _0x1d950e=_0x5d0da4?0x0:_0x2c0b46[_0xdc63('0x17')];var _0x5da96a=_0x5d0da4?_0x41d145[_0xdc63('0x1a')]:_0x2c0b46[_0xdc63('0x17')]+_0x2c0b46[_0xdc63('0x19')];var _0x294106;if(_0x5da96a>=_0x42c98d){_0x5da96a=_0x42c98d;_0x294106=0xc8;}else{_0x294106=0xce;}_0x679dcf['status'](_0x294106);return _0x679dcf[_0xdc63('0x1b')](_0xdc63('0x1c'),_0x1d950e+'-'+_0x5da96a+'/'+_0x42c98d)[_0xdc63('0x16')](_0x41d145);}return null;};}function patchUpdates(_0x34463e){return function(_0x1e1a4c){try{jsonpatch[_0xdc63('0x1d')](_0x1e1a4c,_0x34463e,!![]);}catch(_0x357111){return BPromise['reject'](_0x357111);}return _0x1e1a4c[_0xdc63('0x1e')]();};}function saveUpdates(_0x2f4932,_0x27080d){return function(_0x139612){if(_0x139612){return _0x139612['update'](_0x2f4932)['then'](function(_0x319067){return _0x319067;});}return null;};}function removeEntity(_0xdeef40,_0x20e1b7){return function(_0x308dd2){if(_0x308dd2){return _0x308dd2[_0xdc63('0x1f')]()['then'](function(){_0xdeef40[_0xdc63('0x14')](0xcc)[_0xdc63('0x15')]();});}};}function handleEntityNotFound(_0x3a7296,_0x3d96c7){return function(_0x25f39b){if(!_0x25f39b){_0x3a7296[_0xdc63('0x13')](0x194);}return _0x25f39b;};}function handleError(_0xaddc48,_0x5b0441){_0x5b0441=_0x5b0441||0x1f4;return function(_0x34d901){logger['error'](_0x34d901[_0xdc63('0x20')]);if(_0x34d901['name']){delete _0x34d901[_0xdc63('0x21')];}_0xaddc48['status'](_0x5b0441)[_0xdc63('0x22')](_0x34d901);};}exports[_0xdc63('0x23')]=function(_0x29e124,_0x26a085){var _0x1acc13={},_0x151c47={},_0x423f03={'count':0x0,'rows':[]};var _0x32a225=_[_0xdc63('0x24')](db[_0xdc63('0x25')][_0xdc63('0x26')],function(_0xc52275){return{'name':_0xc52275['fieldName'],'type':_0xc52275['type'][_0xdc63('0x27')]};});_0x151c47['model']=_[_0xdc63('0x24')](_0x32a225,_0xdc63('0x21'));_0x151c47[_0xdc63('0x28')]=_[_0xdc63('0x29')](_0x29e124[_0xdc63('0x28')]);_0x151c47['filters']=_['intersection'](_0x151c47[_0xdc63('0x2a')],_0x151c47['query']);_0x1acc13[_0xdc63('0x2b')]=_[_0xdc63('0x2c')](_0x151c47[_0xdc63('0x2a')],qs[_0xdc63('0x2d')](_0x29e124[_0xdc63('0x28')][_0xdc63('0x2d')]));_0x1acc13[_0xdc63('0x2b')]=_0x1acc13['attributes'][_0xdc63('0x2e')]?_0x1acc13['attributes']:_0x151c47[_0xdc63('0x2a')];if(!_0x29e124[_0xdc63('0x28')][_0xdc63('0x2f')]('nolimit')){_0x1acc13[_0xdc63('0x19')]=qs['limit'](_0x29e124['query'][_0xdc63('0x19')]);_0x1acc13[_0xdc63('0x17')]=qs[_0xdc63('0x17')](_0x29e124[_0xdc63('0x28')][_0xdc63('0x17')]);}_0x1acc13['order']=qs['sort'](_0x29e124[_0xdc63('0x28')]['sort']);_0x1acc13['where']=qs[_0xdc63('0x30')](_[_0xdc63('0x31')](_0x29e124[_0xdc63('0x28')],_0x151c47[_0xdc63('0x30')]),_0x32a225);if(_0x29e124[_0xdc63('0x28')][_0xdc63('0x32')]){_0x1acc13[_0xdc63('0x33')]=_[_0xdc63('0x34')](_0x1acc13[_0xdc63('0x33')],{'$or':_[_0xdc63('0x24')](_0x32a225,function(_0x469757){if(_0x469757['type']!==_0xdc63('0x35')){var _0x4a7371={};_0x4a7371[_0x469757[_0xdc63('0x21')]]={'$like':'%'+_0x29e124[_0xdc63('0x28')][_0xdc63('0x32')]+'%'};return _0x4a7371;}})});}_0x1acc13=_[_0xdc63('0x34')]({},_0x1acc13,_0x29e124[_0xdc63('0x36')]);var _0x26efa7={'where':_0x1acc13[_0xdc63('0x33')]};return db[_0xdc63('0x25')][_0xdc63('0x1a')](_0x26efa7)[_0xdc63('0x37')](function(_0x63f92){_0x423f03[_0xdc63('0x1a')]=_0x63f92;if(_0x29e124[_0xdc63('0x28')][_0xdc63('0x38')]){_0x1acc13[_0xdc63('0x39')]=[{'all':!![]}];}return db[_0xdc63('0x25')][_0xdc63('0x3a')](_0x1acc13);})[_0xdc63('0x37')](function(_0x4a0910){_0x423f03[_0xdc63('0x3b')]=_0x4a0910;return _0x423f03;})[_0xdc63('0x37')](respondWithFilteredResult(_0x26a085,_0x1acc13))[_0xdc63('0x3c')](handleError(_0x26a085,null));};exports[_0xdc63('0x3d')]=function(_0x22ca75,_0x240f11){var _0x162d6c={'raw':!![],'where':{'id':_0x22ca75[_0xdc63('0x3e')]['id']}},_0x376e5c={};_0x376e5c['model']=_[_0xdc63('0x29')](db[_0xdc63('0x25')][_0xdc63('0x26')]);_0x376e5c[_0xdc63('0x28')]=_[_0xdc63('0x29')](_0x22ca75[_0xdc63('0x28')]);_0x376e5c[_0xdc63('0x30')]=_[_0xdc63('0x2c')](_0x376e5c[_0xdc63('0x2a')],_0x376e5c['query']);_0x162d6c[_0xdc63('0x2b')]=_['intersection'](_0x376e5c[_0xdc63('0x2a')],qs[_0xdc63('0x2d')](_0x22ca75[_0xdc63('0x28')][_0xdc63('0x2d')]));_0x162d6c[_0xdc63('0x2b')]=_0x162d6c[_0xdc63('0x2b')]['length']?_0x162d6c[_0xdc63('0x2b')]:_0x376e5c[_0xdc63('0x2a')];if(_0x22ca75[_0xdc63('0x28')]['includeAll']){_0x162d6c[_0xdc63('0x39')]=[{'all':!![]}];}_0x162d6c=_[_0xdc63('0x34')]({},_0x162d6c,_0x22ca75['options']);return db['VoiceDialReport'][_0xdc63('0x3f')](_0x162d6c)[_0xdc63('0x37')](handleEntityNotFound(_0x240f11,null))[_0xdc63('0x37')](respondWithResult(_0x240f11,null))[_0xdc63('0x3c')](handleError(_0x240f11,null));};exports['create']=function(_0x37575e,_0x4bd907){return db[_0xdc63('0x25')][_0xdc63('0x40')](_0x37575e[_0xdc63('0x41')],{})['then'](respondWithResult(_0x4bd907,0xc9))[_0xdc63('0x3c')](handleError(_0x4bd907,null));};exports['update']=function(_0x5d1199,_0xa25395){if(_0x5d1199[_0xdc63('0x41')]['id']){delete _0x5d1199[_0xdc63('0x41')]['id'];}return db[_0xdc63('0x25')]['find']({'where':{'id':_0x5d1199['params']['id']}})[_0xdc63('0x37')](handleEntityNotFound(_0xa25395,null))[_0xdc63('0x37')](saveUpdates(_0x5d1199[_0xdc63('0x41')],null))[_0xdc63('0x37')](respondWithResult(_0xa25395,null))[_0xdc63('0x3c')](handleError(_0xa25395,null));};exports[_0xdc63('0x1f')]=function(_0x31d105,_0x499a8d){return db[_0xdc63('0x25')][_0xdc63('0x3f')]({'where':{'id':_0x31d105[_0xdc63('0x3e')]['id']}})[_0xdc63('0x37')](handleEntityNotFound(_0x499a8d,null))[_0xdc63('0x37')](removeEntity(_0x499a8d,null))[_0xdc63('0x3c')](handleError(_0x499a8d,null));};exports['describe']=function(_0x442d3a,_0x16b4c1){return db[_0xdc63('0x25')]['describe']()['then'](respondWithResult(_0x16b4c1,null))['catch'](handleError(_0x16b4c1,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 45fa871..32b6a28 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 _0x9b75=['VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','define'];(function(_0x4b6830,_0x2bf6fb){var _0x239e4a=function(_0x364735){while(--_0x364735){_0x4b6830['push'](_0x4b6830['shift']());}};_0x239e4a(++_0x2bf6fb);}(_0x9b75,0x1b5));var _0x59b7=function(_0x55d4eb,_0x5bfeeb){_0x55d4eb=_0x55d4eb-0x0;var _0x1d68a7=_0x9b75[_0x55d4eb];return _0x1d68a7;};'use strict';var _=require(_0x59b7('0x0'));var util=require(_0x59b7('0x1'));var logger=require(_0x59b7('0x2'))(_0x59b7('0x3'));var moment=require(_0x59b7('0x4'));var BPromise=require('bluebird');var rp=require(_0x59b7('0x5'));var fs=require('fs');var path=require(_0x59b7('0x6'));var rimraf=require(_0x59b7('0x7'));var config=require(_0x59b7('0x8'));var attributes=require(_0x59b7('0x9'));module['exports']=function(_0xc0eef7,_0x3b14ca){return _0xc0eef7[_0x59b7('0xa')](_0x59b7('0xb'),attributes,{'tableName':_0x59b7('0xc'),'paranoid':![],'indexes':[{'fields':[_0x59b7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe20e=['moment','path','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','uniqueid','lodash','util','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe20e,0x195));var _0xee20=function(_0x1e2f72,_0x4ecd3d){_0x1e2f72=_0x1e2f72-0x0;var _0x2f00a8=_0xe20e[_0x1e2f72];return _0x2f00a8;};'use strict';var _=require(_0xee20('0x0'));var util=require(_0xee20('0x1'));var logger=require('../../config/logger')(_0xee20('0x2'));var moment=require(_0xee20('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xee20('0x4'));var rimraf=require('rimraf');var config=require(_0xee20('0x5'));var attributes=require(_0xee20('0x6'));module[_0xee20('0x7')]=function(_0x411721,_0x3ca08d){return _0x411721[_0xee20('0x8')](_0xee20('0x9'),attributes,{'tableName':_0xee20('0xa'),'paranoid':![],'indexes':[{'fields':[_0xee20('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 432d454..78f2621 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 _0xd7aa=['UpdateVoiceDialReport','update','attributes','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','VoiceDialReport','body','options','raw','CreateVoiceDialReport','debug'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xd7aa,0x108));var _0xad7a=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0xd7aa[_0x23be51];return _0x47a26d;};'use strict';var _=require(_0xad7a('0x0'));var util=require('util');var moment=require(_0xad7a('0x1'));var BPromise=require('bluebird');var rs=require(_0xad7a('0x2'));var fs=require('fs');var Redis=require(_0xad7a('0x3'));var db=require(_0xad7a('0x4'))['db'];var utils=require(_0xad7a('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xad7a('0x6'));var client=jayson[_0xad7a('0x7')][_0xad7a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52a4d9,_0x3d1d8d,_0xa487a0){return new BPromise(function(_0x2a8568,_0x4c8f44){return client[_0xad7a('0x9')](_0x52a4d9,_0xa487a0)[_0xad7a('0xa')](function(_0x2be6ee){logger[_0xad7a('0xb')](_0xad7a('0xc'),_0x3d1d8d,_0xad7a('0xd'));logger['debug'](_0xad7a('0xe'),_0x3d1d8d,'request\x20sent',JSON[_0xad7a('0xf')](_0x2be6ee));if(_0x2be6ee['error']){if(_0x2be6ee['error'][_0xad7a('0x10')]===0x1f4){logger[_0xad7a('0x11')](_0xad7a('0xc'),_0x3d1d8d,_0x2be6ee[_0xad7a('0x11')][_0xad7a('0x12')]);return _0x4c8f44(_0x2be6ee['error']['message']);}logger[_0xad7a('0x11')](_0xad7a('0xc'),_0x3d1d8d,_0x2be6ee[_0xad7a('0x11')][_0xad7a('0x12')]);return _0x2a8568(_0x2be6ee[_0xad7a('0x11')][_0xad7a('0x12')]);}else{logger[_0xad7a('0xb')](_0xad7a('0xc'),_0x3d1d8d,_0xad7a('0xd'));_0x2a8568(_0x2be6ee['result'][_0xad7a('0x12')]);}})[_0xad7a('0x13')](function(_0x1892d9){logger['error'](_0xad7a('0xc'),_0x3d1d8d,_0x1892d9);_0x4c8f44(_0x1892d9);});});}exports['CreateVoiceDialReport']=function(_0x4ee0f7){var _0x477fc6=this;return new Promise(function(_0x32efd8,_0x3e3944){return db[_0xad7a('0x14')]['create'](_0x4ee0f7[_0xad7a('0x15')],{'raw':_0x4ee0f7[_0xad7a('0x16')]?_0x4ee0f7['options'][_0xad7a('0x17')]===undefined?!![]:![]:!![]})[_0xad7a('0xa')](function(_0x468452){logger[_0xad7a('0xb')](_0xad7a('0x18'),_0x4ee0f7);logger[_0xad7a('0x19')](_0xad7a('0x18'),_0x4ee0f7,JSON[_0xad7a('0xf')](_0x468452));_0x32efd8(_0x468452);})[_0xad7a('0x13')](function(_0x1d04ff){logger['error'](_0xad7a('0x18'),_0x1d04ff[_0xad7a('0x12')],_0x4ee0f7);_0x3e3944(_0x477fc6[_0xad7a('0x11')](0x1f4,_0x1d04ff['message']));});});};exports[_0xad7a('0x1a')]=function(_0xbeda8c){var _0x41a9fd=this;return new Promise(function(_0x3a2c57,_0x1c8deb){return db[_0xad7a('0x14')][_0xad7a('0x1b')](_0xbeda8c[_0xad7a('0x15')],{'raw':_0xbeda8c[_0xad7a('0x16')]?_0xbeda8c['options'][_0xad7a('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbeda8c[_0xad7a('0x16')]?_0xbeda8c[_0xad7a('0x16')]['where']||null:null,'attributes':_0xbeda8c[_0xad7a('0x16')]?_0xbeda8c[_0xad7a('0x16')][_0xad7a('0x1c')]||null:null,'limit':_0xbeda8c['options']?_0xbeda8c[_0xad7a('0x16')]['limit']||null:null})['then'](function(_0x42834e){logger[_0xad7a('0xb')](_0xad7a('0x1a'),_0xbeda8c);logger[_0xad7a('0x19')](_0xad7a('0x1a'),_0xbeda8c,JSON[_0xad7a('0xf')](_0x42834e));_0x3a2c57(_0x42834e);})[_0xad7a('0x13')](function(_0x4d294c){logger[_0xad7a('0x11')]('UpdateVoiceDialReport',_0x4d294c[_0xad7a('0x12')],_0xbeda8c);_0x1c8deb(_0x41a9fd[_0xad7a('0x11')](0x1f4,_0x4d294c[_0xad7a('0x12')]));});});}; \ No newline at end of file +var _0xbd8c=['error','code','message','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','info','UpdateVoiceDialReport','update','where','attributes','limit','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3e4704,_0x371b8d){var _0x46f06c=function(_0x7d5e52){while(--_0x7d5e52){_0x3e4704['push'](_0x3e4704['shift']());}};_0x46f06c(++_0x371b8d);}(_0xbd8c,0xca));var _0xcbd8=function(_0x1b0279,_0x11102a){_0x1b0279=_0x1b0279-0x0;var _0x4d8f66=_0xbd8c[_0x1b0279];return _0x4d8f66;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xcbd8('0x0'));var rs=require(_0xcbd8('0x1'));var fs=require('fs');var Redis=require(_0xcbd8('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xcbd8('0x3'));var logger=require('../../config/logger')(_0xcbd8('0x4'));var config=require('../../config/environment');var jayson=require(_0xcbd8('0x5'));var client=jayson[_0xcbd8('0x6')][_0xcbd8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2540b9,_0x382ccc,_0x5d3dc3){return new BPromise(function(_0x2ce023,_0x512c35){return client[_0xcbd8('0x8')](_0x2540b9,_0x5d3dc3)[_0xcbd8('0x9')](function(_0x1d193d){logger['info'](_0xcbd8('0xa'),_0x382ccc,_0xcbd8('0xb'));logger[_0xcbd8('0xc')](_0xcbd8('0xd'),_0x382ccc,'request\x20sent',JSON[_0xcbd8('0xe')](_0x1d193d));if(_0x1d193d[_0xcbd8('0xf')]){if(_0x1d193d['error'][_0xcbd8('0x10')]===0x1f4){logger['error'](_0xcbd8('0xa'),_0x382ccc,_0x1d193d[_0xcbd8('0xf')]['message']);return _0x512c35(_0x1d193d['error'][_0xcbd8('0x11')]);}logger[_0xcbd8('0xf')](_0xcbd8('0xa'),_0x382ccc,_0x1d193d[_0xcbd8('0xf')]['message']);return _0x2ce023(_0x1d193d[_0xcbd8('0xf')][_0xcbd8('0x11')]);}else{logger['info'](_0xcbd8('0xa'),_0x382ccc,_0xcbd8('0xb'));_0x2ce023(_0x1d193d['result'][_0xcbd8('0x11')]);}})[_0xcbd8('0x12')](function(_0x15b13a){logger[_0xcbd8('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x382ccc,_0x15b13a);_0x512c35(_0x15b13a);});});}exports[_0xcbd8('0x13')]=function(_0x483adf){var _0x45b64d=this;return new Promise(function(_0x9a0f95,_0x52c47b){return db[_0xcbd8('0x14')][_0xcbd8('0x15')](_0x483adf[_0xcbd8('0x16')],{'raw':_0x483adf[_0xcbd8('0x17')]?_0x483adf[_0xcbd8('0x17')][_0xcbd8('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x3c88d9){logger[_0xcbd8('0x19')](_0xcbd8('0x13'),_0x483adf);logger['debug'](_0xcbd8('0x13'),_0x483adf,JSON[_0xcbd8('0xe')](_0x3c88d9));_0x9a0f95(_0x3c88d9);})[_0xcbd8('0x12')](function(_0x3b28c3){logger[_0xcbd8('0xf')](_0xcbd8('0x13'),_0x3b28c3[_0xcbd8('0x11')],_0x483adf);_0x52c47b(_0x45b64d['error'](0x1f4,_0x3b28c3[_0xcbd8('0x11')]));});});};exports[_0xcbd8('0x1a')]=function(_0x569bac){var _0xe6d25a=this;return new Promise(function(_0x3c65b7,_0xa9961f){return db[_0xcbd8('0x14')][_0xcbd8('0x1b')](_0x569bac[_0xcbd8('0x16')],{'raw':_0x569bac[_0xcbd8('0x17')]?_0x569bac['options'][_0xcbd8('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x569bac[_0xcbd8('0x17')]?_0x569bac['options'][_0xcbd8('0x1c')]||null:null,'attributes':_0x569bac[_0xcbd8('0x17')]?_0x569bac[_0xcbd8('0x17')][_0xcbd8('0x1d')]||null:null,'limit':_0x569bac['options']?_0x569bac['options'][_0xcbd8('0x1e')]||null:null})[_0xcbd8('0x9')](function(_0x56836c){logger['info'](_0xcbd8('0x1a'),_0x569bac);logger['debug'](_0xcbd8('0x1a'),_0x569bac,JSON[_0xcbd8('0xe')](_0x56836c));_0x3c65b7(_0x56836c);})[_0xcbd8('0x12')](function(_0x762083){logger[_0xcbd8('0xf')]('UpdateVoiceDialReport',_0x762083[_0xcbd8('0x11')],_0x569bac);_0xa9961f(_0xe6d25a[_0xcbd8('0xf')](0x1f4,_0x762083[_0xcbd8('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 27bdf86..35058e1 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 _0xd191=['get','/:id','post','create','/:id/applications','addApplications','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0xd191,0x185));var _0x1d19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd191[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x1d19('0x0'));var path=require('path');var timeout=require(_0x1d19('0x1'));var express=require(_0x1d19('0x2'));var router=express[_0x1d19('0x3')]();var fs_extra=require(_0x1d19('0x4'));var auth=require(_0x1d19('0x5'));var interaction=require(_0x1d19('0x6'));var config=require(_0x1d19('0x7'));var controller=require(_0x1d19('0x8'));router['get']('/',auth[_0x1d19('0x9')](),controller['index']);router[_0x1d19('0xa')](_0x1d19('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1d19('0xc')]('/',auth['isAuthenticated'](),controller[_0x1d19('0xd')]);router['post'](_0x1d19('0xe'),auth['isAuthenticated'](),controller[_0x1d19('0xf')]);router[_0x1d19('0x10')](_0x1d19('0xb'),auth[_0x1d19('0x9')](),controller[_0x1d19('0x11')]);router[_0x1d19('0x12')](_0x1d19('0xb'),auth['isAuthenticated'](),controller[_0x1d19('0x13')]);module[_0x1d19('0x14')]=router; \ No newline at end of file +var _0x9aa1=['../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x400f92,_0x3b91b1){var _0x48d705=function(_0x17c495){while(--_0x17c495){_0x400f92['push'](_0x400f92['shift']());}};_0x48d705(++_0x3b91b1);}(_0x9aa1,0xf4));var _0x19aa=function(_0x2ab1be,_0x8606ac){_0x2ab1be=_0x2ab1be-0x0;var _0x267edd=_0x9aa1[_0x2ab1be];return _0x267edd;};'use strict';var multer=require(_0x19aa('0x0'));var util=require(_0x19aa('0x1'));var path=require(_0x19aa('0x2'));var timeout=require('connect-timeout');var express=require(_0x19aa('0x3'));var router=express[_0x19aa('0x4')]();var fs_extra=require(_0x19aa('0x5'));var auth=require(_0x19aa('0x6'));var interaction=require(_0x19aa('0x7'));var config=require(_0x19aa('0x8'));var controller=require(_0x19aa('0x9'));router[_0x19aa('0xa')]('/',auth[_0x19aa('0xb')](),controller[_0x19aa('0xc')]);router[_0x19aa('0xa')]('/:id',auth[_0x19aa('0xb')](),controller[_0x19aa('0xd')]);router[_0x19aa('0xe')]('/',auth[_0x19aa('0xb')](),controller[_0x19aa('0xf')]);router[_0x19aa('0xe')]('/:id/applications',auth[_0x19aa('0xb')](),controller['addApplications']);router['put'](_0x19aa('0x10'),auth['isAuthenticated'](),controller[_0x19aa('0x11')]);router[_0x19aa('0x12')](_0x19aa('0x10'),auth[_0x19aa('0xb')](),controller[_0x19aa('0x13')]);module[_0x19aa('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 9946e95..b86fde5 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 _0xa4a6=['internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','STRING','compositeIndex','NoOp','inbound'];(function(_0x10291b,_0x518773){var _0x1d5fbe=function(_0x24df58){while(--_0x24df58){_0x10291b['push'](_0x10291b['shift']());}};_0x1d5fbe(++_0x518773);}(_0xa4a6,0x17b));var _0x6a4a=function(_0x468076,_0x2d7b4e){_0x468076=_0x468076-0x0;var _0x24d8d8=_0xa4a6[_0x468076];return _0x24d8d8;};'use strict';var Sequelize=require(_0x6a4a('0x0'));module['exports']={'context':{'type':Sequelize[_0x6a4a('0x1')],'allowNull':![],'unique':_0x6a4a('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x6a4a('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x6a4a('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6a4a('0x3')},'appdata':{'type':Sequelize[_0x6a4a('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x6a4a('0x4'),'outbound',_0x6a4a('0x5'),_0x6a4a('0x6'),_0x6a4a('0x7'),_0x6a4a('0x8'),_0x6a4a('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x6a4a('0x1')]},'interval':{'type':Sequelize[_0x6a4a('0x1')],'allowNull':![],'defaultValue':_0x6a4a('0xa')},'IntervalId':{'type':Sequelize[_0x6a4a('0xb')]},'isApp':{'type':Sequelize[_0x6a4a('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x6a4a('0x1')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x6a4a('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x6a4a('0xb')]},'recordingFormat':{'type':Sequelize[_0x6a4a('0x1')],'defaultValue':_0x6a4a('0xd')},'answer':{'type':Sequelize[_0x6a4a('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x6a4a('0xe')],'get':function(_0x56adee){return this[_0x6a4a('0xf')]('exten');}},'alias':{'type':Sequelize[_0x6a4a('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x19b9=['sequelize','exports','compositeIndex','STRING','NoOp','ENUM','internal','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0x19b9,0x88));var _0x919b=function(_0x4bda99,_0x5f39e0){_0x4bda99=_0x4bda99-0x0;var _0x29737b=_0x19b9[_0x4bda99];return _0x29737b;};'use strict';var Sequelize=require(_0x919b('0x0'));module[_0x919b('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x919b('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x919b('0x3')],'allowNull':![],'unique':_0x919b('0x2')},'priority':{'type':Sequelize[_0x919b('0x3')],'allowNull':![],'defaultValue':'1','unique':_0x919b('0x2')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x919b('0x3')],'allowNull':![],'defaultValue':_0x919b('0x4')},'appdata':{'type':Sequelize[_0x919b('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x919b('0x5')]('inbound','outbound',_0x919b('0x6'),'inbound-fax',_0x919b('0x7'),_0x919b('0x8'),_0x919b('0x9')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x919b('0x3')],'allowNull':![],'defaultValue':_0x919b('0xa')},'IntervalId':{'type':Sequelize[_0x919b('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x919b('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x919b('0xb')]},'recordingFormat':{'type':Sequelize[_0x919b('0x3')],'defaultValue':_0x919b('0xd')},'answer':{'type':Sequelize[_0x919b('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x919b('0xe')],'get':function(_0x663c21){return this[_0x919b('0xf')](_0x919b('0x10'));}},'alias':{'type':Sequelize[_0x919b('0x3')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index a37f31a..effb4c0 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 _0xb406=['createRouting','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','then','sendStatus','error','stack','send','index','VoiceExtension','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','VIRTUAL','includeAll','findAll','rows','show','params','rawAttributes','include','merge','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','mandatoryDisposition','context','addApplications','findOne','transaction','VoiceExtensionId','isApp','rewriteDial','toLowerCase','true'];(function(_0x18d2c,_0x376749){var _0x52c197=function(_0x23127c){while(--_0x23127c){_0x18d2c['push'](_0x18d2c['shift']());}};_0x52c197(++_0x376749);}(_0xb406,0x1c6));var _0x6b40=function(_0x4bbaf4,_0x41ffa9){_0x4bbaf4=_0x4bbaf4-0x0;var _0x19d486=_0xb406[_0x4bbaf4];return _0x19d486;};'use strict';var emlformat=require(_0x6b40('0x0'));var rimraf=require(_0x6b40('0x1'));var zipdir=require(_0x6b40('0x2'));var jsonpatch=require(_0x6b40('0x3'));var rp=require('request-promise');var moment=require(_0x6b40('0x4'));var BPromise=require(_0x6b40('0x5'));var Mustache=require(_0x6b40('0x6'));var util=require(_0x6b40('0x7'));var path=require('path');var sox=require(_0x6b40('0x8'));var csv=require(_0x6b40('0x9'));var ejs=require(_0x6b40('0xa'));var fs=require('fs');var fs_extra=require(_0x6b40('0xb'));var _=require(_0x6b40('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6b40('0xd'));var deskjs=require(_0x6b40('0xe'));var toCsv=require(_0x6b40('0x9'));var querystring=require(_0x6b40('0xf'));var Papa=require(_0x6b40('0x10'));var Redis=require(_0x6b40('0x11'));var authService=require(_0x6b40('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b40('0x13'));var logger=require(_0x6b40('0x14'))(_0x6b40('0x15'));var utils=require(_0x6b40('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6b40('0x17'));var db=require(_0x6b40('0x18'))['db'];config[_0x6b40('0x19')]=_[_0x6b40('0x1a')](config[_0x6b40('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x6b40('0x1b'))(new Redis(config[_0x6b40('0x19')]));require('./voiceExtension.socket')[_0x6b40('0x1c')](socket);function respondWithStatusCode(_0xa479af,_0x397a54){_0x397a54=_0x397a54||0xcc;return function(_0x7960f9){if(_0x7960f9){return _0xa479af['sendStatus'](_0x397a54);}return _0xa479af[_0x6b40('0x1d')](_0x397a54)[_0x6b40('0x1e')]();};}function respondWithResult(_0x3bc373,_0x1cc4f2){_0x1cc4f2=_0x1cc4f2||0xc8;return function(_0x2448f9){if(_0x2448f9){return _0x3bc373[_0x6b40('0x1d')](_0x1cc4f2)[_0x6b40('0x1f')](_0x2448f9);}};}function respondWithFilteredResult(_0x29c4bd,_0x142880){return function(_0x39dccf){if(_0x39dccf){var _0x2c26a4=typeof _0x142880[_0x6b40('0x20')]===_0x6b40('0x21')&&typeof _0x142880[_0x6b40('0x22')]===_0x6b40('0x21');var _0x334864=_0x39dccf['count'];var _0xd7054b=_0x2c26a4?0x0:_0x142880['offset'];var _0xc4d84=_0x2c26a4?_0x39dccf[_0x6b40('0x23')]:_0x142880[_0x6b40('0x20')]+_0x142880[_0x6b40('0x22')];var _0x373cd2;if(_0xc4d84>=_0x334864){_0xc4d84=_0x334864;_0x373cd2=0xc8;}else{_0x373cd2=0xce;}_0x29c4bd[_0x6b40('0x1d')](_0x373cd2);return _0x29c4bd[_0x6b40('0x24')](_0x6b40('0x25'),_0xd7054b+'-'+_0xc4d84+'/'+_0x334864)[_0x6b40('0x1f')](_0x39dccf);}return null;};}function patchUpdates(_0x1fd717){return function(_0x49cd48){try{jsonpatch[_0x6b40('0x26')](_0x49cd48,_0x1fd717,!![]);}catch(_0x3d9130){return BPromise['reject'](_0x3d9130);}return _0x49cd48[_0x6b40('0x27')]();};}function saveUpdates(_0x30de2b,_0x47d586){return function(_0x1b8c84){if(_0x1b8c84){return _0x1b8c84[_0x6b40('0x28')](_0x30de2b)['then'](function(_0x1e21cb){return _0x1e21cb;});}return null;};}function removeEntity(_0x4eced0,_0x23ced0){return function(_0x3d5f1a){if(_0x3d5f1a){return _0x3d5f1a['destroy']()['then'](function(){var _0x2ec08a=_0x3d5f1a[_0x6b40('0x29')]({'plain':!![]});var _0x32fd09=[{'name':_0x6b40('0x2a'),'value':_0x6b40('0x2b'),'ignore':![]},{'name':_0x6b40('0x2c'),'value':_0x6b40('0x2d'),'ignore':![]},{'name':_0x6b40('0x2e'),'value':_0x6b40('0x2f'),'ignore':![]}];var _0x2f1474=_(_0x32fd09)[_0x6b40('0x30')](_0x6b40('0x31'))[_0x6b40('0x32')]('value')[_0x6b40('0x33')]();if(_[_0x6b40('0x34')](_0x2f1474,_0x2ec08a[_0x6b40('0x35')])){return;}var _0x943ee9=_[_0x6b40('0x36')](_0x32fd09,[_0x6b40('0x33'),_0x2ec08a[_0x6b40('0x35')]])[_0x6b40('0x37')];return db[_0x6b40('0x38')][_0x6b40('0x39')]({'where':{'type':_0x943ee9,'resourceId':_0x2ec08a['id']}})['then'](function(){return _0x3d5f1a;});})[_0x6b40('0x3a')](function(){_0x4eced0[_0x6b40('0x1d')](0xcc)[_0x6b40('0x1e')]();});}};}function handleEntityNotFound(_0x5c9621,_0x5bb2f5){return function(_0x4fca98){if(!_0x4fca98){_0x5c9621[_0x6b40('0x3b')](0x194);}return _0x4fca98;};}function handleError(_0x3e22a3,_0x3d5aa5){_0x3d5aa5=_0x3d5aa5||0x1f4;return function(_0x4bb98c){logger[_0x6b40('0x3c')](_0x4bb98c[_0x6b40('0x3d')]);if(_0x4bb98c['name']){delete _0x4bb98c[_0x6b40('0x37')];}_0x3e22a3[_0x6b40('0x1d')](_0x3d5aa5)[_0x6b40('0x3e')](_0x4bb98c);};}exports[_0x6b40('0x3f')]=function(_0x5d38fd,_0x453e5c){var _0x3cf70a={},_0x396055={},_0xfb2727={'count':0x0,'rows':[]};var _0x56f7e=_['map'](db[_0x6b40('0x40')]['rawAttributes'],function(_0xdfb773){return{'name':_0xdfb773[_0x6b40('0x41')],'type':_0xdfb773['type'][_0x6b40('0x42')]};});_0x396055[_0x6b40('0x43')]=_[_0x6b40('0x32')](_0x56f7e,_0x6b40('0x37'));_0x396055['query']=_[_0x6b40('0x44')](_0x5d38fd[_0x6b40('0x45')]);_0x396055[_0x6b40('0x46')]=_[_0x6b40('0x47')](_0x396055['model'],_0x396055[_0x6b40('0x45')]);_0x3cf70a[_0x6b40('0x48')]=_[_0x6b40('0x47')](_0x396055[_0x6b40('0x43')],qs[_0x6b40('0x49')](_0x5d38fd[_0x6b40('0x45')][_0x6b40('0x49')]));_0x3cf70a['attributes']=_0x3cf70a[_0x6b40('0x48')][_0x6b40('0x4a')]?_0x3cf70a[_0x6b40('0x48')]:_0x396055[_0x6b40('0x43')];if(!_0x5d38fd[_0x6b40('0x45')]['hasOwnProperty']('nolimit')){_0x3cf70a['limit']=qs['limit'](_0x5d38fd[_0x6b40('0x45')][_0x6b40('0x22')]);_0x3cf70a[_0x6b40('0x20')]=qs[_0x6b40('0x20')](_0x5d38fd[_0x6b40('0x45')][_0x6b40('0x20')]);}_0x3cf70a[_0x6b40('0x4b')]=qs[_0x6b40('0x4c')](_0x5d38fd[_0x6b40('0x45')][_0x6b40('0x4c')]);_0x3cf70a[_0x6b40('0x4d')]=qs[_0x6b40('0x46')](_[_0x6b40('0x4e')](_0x5d38fd[_0x6b40('0x45')],_0x396055[_0x6b40('0x46')]),_0x56f7e);if(_0x5d38fd['query']['filter']){_0x3cf70a[_0x6b40('0x4d')]=_['merge'](_0x3cf70a[_0x6b40('0x4d')],{'$or':_[_0x6b40('0x32')](_0x56f7e,function(_0x478a48){if(_0x478a48[_0x6b40('0x35')]!==_0x6b40('0x4f')){var _0x1a6314={};_0x1a6314[_0x478a48[_0x6b40('0x37')]]={'$like':'%'+_0x5d38fd[_0x6b40('0x45')][_0x6b40('0x30')]+'%'};return _0x1a6314;}})});}_0x3cf70a=_['merge']({},_0x3cf70a,_0x5d38fd['options']);var _0x3ac8df={'where':_0x3cf70a[_0x6b40('0x4d')]};return db[_0x6b40('0x40')][_0x6b40('0x23')](_0x3ac8df)['then'](function(_0x3b9a43){_0xfb2727[_0x6b40('0x23')]=_0x3b9a43;if(_0x5d38fd['query'][_0x6b40('0x50')]){_0x3cf70a['include']=[{'all':!![]}];}return db[_0x6b40('0x40')][_0x6b40('0x51')](_0x3cf70a);})[_0x6b40('0x3a')](function(_0x5229c6){_0xfb2727[_0x6b40('0x52')]=_0x5229c6;return _0xfb2727;})[_0x6b40('0x3a')](respondWithFilteredResult(_0x453e5c,_0x3cf70a))['catch'](handleError(_0x453e5c,null));};exports[_0x6b40('0x53')]=function(_0x4b69f3,_0x42f366){var _0x1e838b={'raw':![],'where':{'id':_0x4b69f3[_0x6b40('0x54')]['id']}},_0x3390d6={};_0x3390d6[_0x6b40('0x43')]=_[_0x6b40('0x44')](db['VoiceExtension'][_0x6b40('0x55')]);_0x3390d6['query']=_[_0x6b40('0x44')](_0x4b69f3[_0x6b40('0x45')]);_0x3390d6[_0x6b40('0x46')]=_[_0x6b40('0x47')](_0x3390d6[_0x6b40('0x43')],_0x3390d6[_0x6b40('0x45')]);_0x1e838b[_0x6b40('0x48')]=_[_0x6b40('0x47')](_0x3390d6['model'],qs[_0x6b40('0x49')](_0x4b69f3['query']['fields']));_0x1e838b['attributes']=_0x1e838b[_0x6b40('0x48')][_0x6b40('0x4a')]?_0x1e838b[_0x6b40('0x48')]:_0x3390d6[_0x6b40('0x43')];if(_0x4b69f3[_0x6b40('0x45')][_0x6b40('0x50')]){_0x1e838b[_0x6b40('0x56')]=[{'all':!![]}];}_0x1e838b=_[_0x6b40('0x57')]({},_0x1e838b,_0x4b69f3['options']);return db['VoiceExtension']['find'](_0x1e838b)['then'](handleEntityNotFound(_0x42f366,null))[_0x6b40('0x3a')](respondWithResult(_0x42f366,null))['catch'](handleError(_0x42f366,null));};exports['destroy']=function(_0x4bc536,_0x458aa3){return db[_0x6b40('0x40')][_0x6b40('0x36')]({'where':{'id':_0x4bc536['params']['id']}})[_0x6b40('0x3a')](handleEntityNotFound(_0x458aa3,null))[_0x6b40('0x3a')](removeEntity(_0x458aa3,null))['catch'](handleError(_0x458aa3,null));};exports[_0x6b40('0x58')]=function(_0x277c89,_0x234df5){if(_0x277c89[_0x6b40('0x59')][_0x6b40('0x35')]==='outbound'&&!_[_0x6b40('0x5a')](_0x277c89[_0x6b40('0x59')][_0x6b40('0x5b')],'_')){_0x277c89[_0x6b40('0x59')][_0x6b40('0x5b')]='_'[_0x6b40('0x5c')](_0x277c89['body'][_0x6b40('0x5b')]);}return db[_0x6b40('0x40')][_0x6b40('0x58')](_0x277c89[_0x6b40('0x59')],{'raw':![]})[_0x6b40('0x3a')](function(_0x4d9afc){var _0x5ce4d8=_0x277c89['user'][_0x6b40('0x29')]({'plain':!![]});if(!_0x5ce4d8)throw new Error(_0x6b40('0x5d'));if(_0x5ce4d8['role']===_0x6b40('0x5e')){var _0x222633=_0x4d9afc[_0x6b40('0x29')]({'plain':!![]});var _0x39ec48=[{'name':_0x6b40('0x2a'),'value':_0x6b40('0x2b')},{'name':_0x6b40('0x2c'),'value':'outbound'},{'name':'InternalRoutes','value':'internal'}];var _0x3cce08=_[_0x6b40('0x36')](_0x39ec48,[_0x6b40('0x33'),_0x222633[_0x6b40('0x35')]])[_0x6b40('0x37')];return db[_0x6b40('0x5f')]['find']({'where':{'name':_0x3cce08,'userProfileId':_0x5ce4d8[_0x6b40('0x60')]},'raw':!![]})[_0x6b40('0x3a')](function(_0x1dc273){if(_0x1dc273&&_0x1dc273[_0x6b40('0x61')]===0x0){return db[_0x6b40('0x38')][_0x6b40('0x58')]({'name':_0x222633[_0x6b40('0x37')],'resourceId':_0x222633['id'],'type':_0x1dc273[_0x6b40('0x37')],'sectionId':_0x1dc273['id']},{})[_0x6b40('0x3a')](function(){return _0x4d9afc;});}else{return _0x4d9afc;}})[_0x6b40('0x62')](function(_0x3d4d58){logger['error'](_0x6b40('0x63'),_0x3d4d58);throw _0x3d4d58;});}return _0x4d9afc;})['then'](respondWithResult(_0x234df5,0xc9))[_0x6b40('0x62')](handleError(_0x234df5,null));};exports[_0x6b40('0x28')]=function(_0x2a7373,_0x1f7450){if(_0x2a7373[_0x6b40('0x59')]['id']){delete _0x2a7373['body']['id'];}return db[_0x6b40('0x40')][_0x6b40('0x36')]({'where':{'id':_0x2a7373[_0x6b40('0x54')]['id']}})[_0x6b40('0x3a')](handleEntityNotFound(_0x1f7450,null))['then'](function(_0x4f7a0d){if(_0x4f7a0d){return db[_0x6b40('0x40')][_0x6b40('0x28')](_[_0x6b40('0x4e')](_0x2a7373[_0x6b40('0x59')],[_0x6b40('0x5b'),'context',_0x6b40('0x64'),'recordingFormat','cutdigits',_0x6b40('0x65'),'alias']),{'where':{'context':_0x4f7a0d[_0x6b40('0x66')],'exten':_0x4f7a0d['exten']},'individualHooks':!![]})[_0x6b40('0x3a')](function(_0x355c2f){return _0x355c2f;});}return null;})['then'](respondWithStatusCode(_0x1f7450,null))[_0x6b40('0x62')](handleError(_0x1f7450,null));};exports[_0x6b40('0x67')]=function(_0x3c4402,_0x3441a6){return db[_0x6b40('0x40')][_0x6b40('0x68')]({'where':{'id':_0x3c4402[_0x6b40('0x54')]['id']}})[_0x6b40('0x3a')](function(_0x4b0905){if(_0x4b0905){return db['sequelize'][_0x6b40('0x69')](function(_0x43291f){return db['VoiceExtension'][_0x6b40('0x39')]({'where':{'VoiceExtensionId':_0x3c4402[_0x6b40('0x54')]['id']},'transaction':_0x43291f})[_0x6b40('0x3a')](function(){var _0x2493b4=_[_0x6b40('0x32')](_0x3c4402['body'],function(_0x34bcf6){_0x34bcf6[_0x6b40('0x6a')]=_0x3c4402[_0x6b40('0x54')]['id'];_0x34bcf6[_0x6b40('0x6b')]=!![];return _0x34bcf6;});var _0x1d810a=_0x3c4402[_0x6b40('0x45')]['rewriteDial']&&_0x3c4402[_0x6b40('0x45')][_0x6b40('0x6c')][_0x6b40('0x6d')]()===_0x6b40('0x6e')?!![]:![];return _0x4b0905[_0x6b40('0x6f')](_0x2493b4,_0x1d810a);})[_0x6b40('0x3a')](function(_0x12af7f){return db[_0x6b40('0x40')]['bulkCreate'](_0x12af7f,{'transaction':_0x43291f});});})[_0x6b40('0x3a')](function(){return db['VoiceExtension'][_0x6b40('0x70')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3c4402[_0x6b40('0x54')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x6b40('0x3a')](respondWithResult(_0x3441a6,null))[_0x6b40('0x62')](handleError(_0x3441a6,null));}; \ No newline at end of file +var _0xaab9=['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','defaults','redis','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','get','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','find','type','name','UserProfileResource','destroy','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','filters','intersection','query','attributes','fields','length','order','sort','where','pick','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','inbound','UserProfileSection','autoAssociation','description','recordingFormat','alias','addApplications','findOne','sequelize','transaction','VoiceExtensionId','isApp','toLowerCase','true','createRouting','bulkCreate','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs'];(function(_0x4a2fb3,_0x8df0d4){var _0x5be958=function(_0x48d3a4){while(--_0x48d3a4){_0x4a2fb3['push'](_0x4a2fb3['shift']());}};_0x5be958(++_0x8df0d4);}(_0xaab9,0xda));var _0x9aab=function(_0xad4738,_0x131e79){_0xad4738=_0xad4738-0x0;var _0x4e7c41=_0xaab9[_0xad4738];return _0x4e7c41;};'use strict';var emlformat=require(_0x9aab('0x0'));var rimraf=require(_0x9aab('0x1'));var zipdir=require(_0x9aab('0x2'));var jsonpatch=require(_0x9aab('0x3'));var rp=require(_0x9aab('0x4'));var moment=require(_0x9aab('0x5'));var BPromise=require(_0x9aab('0x6'));var Mustache=require(_0x9aab('0x7'));var util=require(_0x9aab('0x8'));var path=require('path');var sox=require(_0x9aab('0x9'));var csv=require(_0x9aab('0xa'));var ejs=require(_0x9aab('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9aab('0xc'));var squel=require(_0x9aab('0xd'));var crypto=require('crypto');var jsforce=require(_0x9aab('0xe'));var deskjs=require(_0x9aab('0xf'));var toCsv=require(_0x9aab('0xa'));var querystring=require(_0x9aab('0x10'));var Papa=require(_0x9aab('0x11'));var Redis=require(_0x9aab('0x12'));var authService=require(_0x9aab('0x13'));var qs=require(_0x9aab('0x14'));var as=require(_0x9aab('0x15'));var hardwareService=require(_0x9aab('0x16'));var logger=require(_0x9aab('0x17'))(_0x9aab('0x18'));var utils=require(_0x9aab('0x19'));var config=require(_0x9aab('0x1a'));var licenseUtil=require(_0x9aab('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9aab('0x1c')](config[_0x9aab('0x1d')],{'host':'localhost','port':0x18eb});var socket=require(_0x9aab('0x1e'))(new Redis(config[_0x9aab('0x1d')]));require(_0x9aab('0x1f'))[_0x9aab('0x20')](socket);function respondWithStatusCode(_0x337b01,_0x199117){_0x199117=_0x199117||0xcc;return function(_0x162ad9){if(_0x162ad9){return _0x337b01[_0x9aab('0x21')](_0x199117);}return _0x337b01[_0x9aab('0x22')](_0x199117)[_0x9aab('0x23')]();};}function respondWithResult(_0x5f9775,_0x18b9a7){_0x18b9a7=_0x18b9a7||0xc8;return function(_0x5bcab4){if(_0x5bcab4){return _0x5f9775[_0x9aab('0x22')](_0x18b9a7)[_0x9aab('0x24')](_0x5bcab4);}};}function respondWithFilteredResult(_0x599803,_0x97dcc8){return function(_0x4a1307){if(_0x4a1307){var _0xa4e3ec=typeof _0x97dcc8[_0x9aab('0x25')]==='undefined'&&typeof _0x97dcc8[_0x9aab('0x26')]===_0x9aab('0x27');var _0x4865bf=_0x4a1307[_0x9aab('0x28')];var _0x93f4bf=_0xa4e3ec?0x0:_0x97dcc8['offset'];var _0x5add5e=_0xa4e3ec?_0x4a1307['count']:_0x97dcc8[_0x9aab('0x25')]+_0x97dcc8[_0x9aab('0x26')];var _0x5df549;if(_0x5add5e>=_0x4865bf){_0x5add5e=_0x4865bf;_0x5df549=0xc8;}else{_0x5df549=0xce;}_0x599803[_0x9aab('0x22')](_0x5df549);return _0x599803['set'](_0x9aab('0x29'),_0x93f4bf+'-'+_0x5add5e+'/'+_0x4865bf)[_0x9aab('0x24')](_0x4a1307);}return null;};}function patchUpdates(_0x4c7b45){return function(_0x355fd5){try{jsonpatch['apply'](_0x355fd5,_0x4c7b45,!![]);}catch(_0x49cbeb){return BPromise[_0x9aab('0x2a')](_0x49cbeb);}return _0x355fd5[_0x9aab('0x2b')]();};}function saveUpdates(_0x5894c6,_0x515f10){return function(_0x518078){if(_0x518078){return _0x518078[_0x9aab('0x2c')](_0x5894c6)[_0x9aab('0x2d')](function(_0x1499fa){return _0x1499fa;});}return null;};}function removeEntity(_0x49947f,_0x1913b5){return function(_0x10842a){if(_0x10842a){return _0x10842a['destroy']()['then'](function(){var _0x3cdc10=_0x10842a[_0x9aab('0x2e')]({'plain':!![]});var _0x3c0622=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x9aab('0x2f'),'value':_0x9aab('0x30'),'ignore':![]},{'name':_0x9aab('0x31'),'value':_0x9aab('0x32'),'ignore':![]}];var _0x2ac828=_(_0x3c0622)[_0x9aab('0x33')](_0x9aab('0x34'))[_0x9aab('0x35')]('value')[_0x9aab('0x36')]();if(_[_0x9aab('0x37')](_0x2ac828,_0x3cdc10['type'])){return;}var _0x2a3f39=_[_0x9aab('0x38')](_0x3c0622,[_0x9aab('0x36'),_0x3cdc10[_0x9aab('0x39')]])[_0x9aab('0x3a')];return db[_0x9aab('0x3b')][_0x9aab('0x3c')]({'where':{'type':_0x2a3f39,'resourceId':_0x3cdc10['id']}})[_0x9aab('0x2d')](function(){return _0x10842a;});})[_0x9aab('0x2d')](function(){_0x49947f[_0x9aab('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c8fc3,_0x1bfe36){return function(_0x57223c){if(!_0x57223c){_0x2c8fc3[_0x9aab('0x21')](0x194);}return _0x57223c;};}function handleError(_0x4e9cea,_0x2dc26e){_0x2dc26e=_0x2dc26e||0x1f4;return function(_0x413352){logger[_0x9aab('0x3d')](_0x413352[_0x9aab('0x3e')]);if(_0x413352[_0x9aab('0x3a')]){delete _0x413352[_0x9aab('0x3a')];}_0x4e9cea[_0x9aab('0x22')](_0x2dc26e)[_0x9aab('0x3f')](_0x413352);};}exports[_0x9aab('0x40')]=function(_0x894465,_0x315060){var _0x529ae7={},_0x26f379={},_0x465bb3={'count':0x0,'rows':[]};var _0xc1131a=_[_0x9aab('0x35')](db[_0x9aab('0x41')][_0x9aab('0x42')],function(_0x2a3361){return{'name':_0x2a3361[_0x9aab('0x43')],'type':_0x2a3361['type'][_0x9aab('0x44')]};});_0x26f379[_0x9aab('0x45')]=_['map'](_0xc1131a,_0x9aab('0x3a'));_0x26f379['query']=_['keys'](_0x894465['query']);_0x26f379[_0x9aab('0x46')]=_[_0x9aab('0x47')](_0x26f379[_0x9aab('0x45')],_0x26f379[_0x9aab('0x48')]);_0x529ae7[_0x9aab('0x49')]=_[_0x9aab('0x47')](_0x26f379[_0x9aab('0x45')],qs[_0x9aab('0x4a')](_0x894465['query'][_0x9aab('0x4a')]));_0x529ae7['attributes']=_0x529ae7[_0x9aab('0x49')][_0x9aab('0x4b')]?_0x529ae7[_0x9aab('0x49')]:_0x26f379[_0x9aab('0x45')];if(!_0x894465[_0x9aab('0x48')]['hasOwnProperty']('nolimit')){_0x529ae7[_0x9aab('0x26')]=qs[_0x9aab('0x26')](_0x894465[_0x9aab('0x48')][_0x9aab('0x26')]);_0x529ae7[_0x9aab('0x25')]=qs[_0x9aab('0x25')](_0x894465[_0x9aab('0x48')]['offset']);}_0x529ae7[_0x9aab('0x4c')]=qs[_0x9aab('0x4d')](_0x894465[_0x9aab('0x48')][_0x9aab('0x4d')]);_0x529ae7[_0x9aab('0x4e')]=qs[_0x9aab('0x46')](_[_0x9aab('0x4f')](_0x894465[_0x9aab('0x48')],_0x26f379[_0x9aab('0x46')]),_0xc1131a);if(_0x894465[_0x9aab('0x48')][_0x9aab('0x33')]){_0x529ae7[_0x9aab('0x4e')]=_[_0x9aab('0x50')](_0x529ae7[_0x9aab('0x4e')],{'$or':_[_0x9aab('0x35')](_0xc1131a,function(_0x5b6980){if(_0x5b6980[_0x9aab('0x39')]!=='VIRTUAL'){var _0x2283b7={};_0x2283b7[_0x5b6980[_0x9aab('0x3a')]]={'$like':'%'+_0x894465['query'][_0x9aab('0x33')]+'%'};return _0x2283b7;}})});}_0x529ae7=_[_0x9aab('0x50')]({},_0x529ae7,_0x894465['options']);var _0x10b9f4={'where':_0x529ae7[_0x9aab('0x4e')]};return db[_0x9aab('0x41')][_0x9aab('0x28')](_0x10b9f4)[_0x9aab('0x2d')](function(_0x570098){_0x465bb3[_0x9aab('0x28')]=_0x570098;if(_0x894465[_0x9aab('0x48')][_0x9aab('0x51')]){_0x529ae7[_0x9aab('0x52')]=[{'all':!![]}];}return db[_0x9aab('0x41')][_0x9aab('0x53')](_0x529ae7);})[_0x9aab('0x2d')](function(_0x2cab29){_0x465bb3[_0x9aab('0x54')]=_0x2cab29;return _0x465bb3;})[_0x9aab('0x2d')](respondWithFilteredResult(_0x315060,_0x529ae7))[_0x9aab('0x55')](handleError(_0x315060,null));};exports[_0x9aab('0x56')]=function(_0xce71f2,_0x2de7b1){var _0x3378c8={'raw':![],'where':{'id':_0xce71f2[_0x9aab('0x57')]['id']}},_0x14e602={};_0x14e602[_0x9aab('0x45')]=_[_0x9aab('0x58')](db[_0x9aab('0x41')][_0x9aab('0x42')]);_0x14e602[_0x9aab('0x48')]=_[_0x9aab('0x58')](_0xce71f2['query']);_0x14e602[_0x9aab('0x46')]=_[_0x9aab('0x47')](_0x14e602[_0x9aab('0x45')],_0x14e602[_0x9aab('0x48')]);_0x3378c8[_0x9aab('0x49')]=_['intersection'](_0x14e602['model'],qs[_0x9aab('0x4a')](_0xce71f2[_0x9aab('0x48')][_0x9aab('0x4a')]));_0x3378c8[_0x9aab('0x49')]=_0x3378c8['attributes'][_0x9aab('0x4b')]?_0x3378c8[_0x9aab('0x49')]:_0x14e602[_0x9aab('0x45')];if(_0xce71f2[_0x9aab('0x48')][_0x9aab('0x51')]){_0x3378c8[_0x9aab('0x52')]=[{'all':!![]}];}_0x3378c8=_[_0x9aab('0x50')]({},_0x3378c8,_0xce71f2[_0x9aab('0x59')]);return db['VoiceExtension'][_0x9aab('0x38')](_0x3378c8)[_0x9aab('0x2d')](handleEntityNotFound(_0x2de7b1,null))[_0x9aab('0x2d')](respondWithResult(_0x2de7b1,null))[_0x9aab('0x55')](handleError(_0x2de7b1,null));};exports[_0x9aab('0x3c')]=function(_0x5ae40b,_0x514dbd){return db['VoiceExtension'][_0x9aab('0x38')]({'where':{'id':_0x5ae40b[_0x9aab('0x57')]['id']}})[_0x9aab('0x2d')](handleEntityNotFound(_0x514dbd,null))[_0x9aab('0x2d')](removeEntity(_0x514dbd,null))[_0x9aab('0x55')](handleError(_0x514dbd,null));};exports[_0x9aab('0x5a')]=function(_0x273d3a,_0x3fc9de){if(_0x273d3a[_0x9aab('0x5b')]['type']===_0x9aab('0x30')&&!_[_0x9aab('0x5c')](_0x273d3a[_0x9aab('0x5b')][_0x9aab('0x5d')],'_')){_0x273d3a[_0x9aab('0x5b')][_0x9aab('0x5d')]='_'[_0x9aab('0x5e')](_0x273d3a[_0x9aab('0x5b')][_0x9aab('0x5d')]);}return db[_0x9aab('0x41')]['create'](_0x273d3a[_0x9aab('0x5b')],{'raw':![]})[_0x9aab('0x2d')](function(_0x583dc1){var _0x3d304c=_0x273d3a['user']['get']({'plain':!![]});if(!_0x3d304c)throw new Error(_0x9aab('0x5f'));if(_0x3d304c[_0x9aab('0x60')]===_0x9aab('0x61')){var _0x25c1f8=_0x583dc1[_0x9aab('0x2e')]({'plain':!![]});var _0x247049=[{'name':'InboundRoutes','value':_0x9aab('0x62')},{'name':_0x9aab('0x2f'),'value':_0x9aab('0x30')},{'name':_0x9aab('0x31'),'value':_0x9aab('0x32')}];var _0x1411f2=_[_0x9aab('0x38')](_0x247049,['value',_0x25c1f8[_0x9aab('0x39')]])[_0x9aab('0x3a')];return db[_0x9aab('0x63')][_0x9aab('0x38')]({'where':{'name':_0x1411f2,'userProfileId':_0x3d304c['userProfileId']},'raw':!![]})[_0x9aab('0x2d')](function(_0x21c1f7){if(_0x21c1f7&&_0x21c1f7[_0x9aab('0x64')]===0x0){return db[_0x9aab('0x3b')][_0x9aab('0x5a')]({'name':_0x25c1f8[_0x9aab('0x3a')],'resourceId':_0x25c1f8['id'],'type':_0x21c1f7[_0x9aab('0x3a')],'sectionId':_0x21c1f7['id']},{})[_0x9aab('0x2d')](function(){return _0x583dc1;});}else{return _0x583dc1;}})[_0x9aab('0x55')](function(_0x5a2571){logger[_0x9aab('0x3d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a2571);throw _0x5a2571;});}return _0x583dc1;})[_0x9aab('0x2d')](respondWithResult(_0x3fc9de,0xc9))[_0x9aab('0x55')](handleError(_0x3fc9de,null));};exports[_0x9aab('0x2c')]=function(_0xa12a99,_0x52ca04){if(_0xa12a99[_0x9aab('0x5b')]['id']){delete _0xa12a99[_0x9aab('0x5b')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0xa12a99[_0x9aab('0x57')]['id']}})[_0x9aab('0x2d')](handleEntityNotFound(_0x52ca04,null))[_0x9aab('0x2d')](function(_0x4d2e89){if(_0x4d2e89){return db[_0x9aab('0x41')]['update'](_[_0x9aab('0x4f')](_0xa12a99[_0x9aab('0x5b')],[_0x9aab('0x5d'),'context',_0x9aab('0x65'),_0x9aab('0x66'),'cutdigits','mandatoryDisposition',_0x9aab('0x67')]),{'where':{'context':_0x4d2e89['context'],'exten':_0x4d2e89[_0x9aab('0x5d')]},'individualHooks':!![]})[_0x9aab('0x2d')](function(_0x232d93){return _0x232d93;});}return null;})[_0x9aab('0x2d')](respondWithStatusCode(_0x52ca04,null))['catch'](handleError(_0x52ca04,null));};exports[_0x9aab('0x68')]=function(_0x2be180,_0x5e79ca){return db[_0x9aab('0x41')][_0x9aab('0x69')]({'where':{'id':_0x2be180[_0x9aab('0x57')]['id']}})[_0x9aab('0x2d')](function(_0xc2d5c){if(_0xc2d5c){return db[_0x9aab('0x6a')][_0x9aab('0x6b')](function(_0x228a3f){return db['VoiceExtension'][_0x9aab('0x3c')]({'where':{'VoiceExtensionId':_0x2be180[_0x9aab('0x57')]['id']},'transaction':_0x228a3f})[_0x9aab('0x2d')](function(){var _0x2e1671=_[_0x9aab('0x35')](_0x2be180[_0x9aab('0x5b')],function(_0x578f7a){_0x578f7a[_0x9aab('0x6c')]=_0x2be180[_0x9aab('0x57')]['id'];_0x578f7a[_0x9aab('0x6d')]=!![];return _0x578f7a;});var _0x10aecc=_0x2be180[_0x9aab('0x48')]['rewriteDial']&&_0x2be180[_0x9aab('0x48')]['rewriteDial'][_0x9aab('0x6e')]()===_0x9aab('0x6f')?!![]:![];return _0xc2d5c[_0x9aab('0x70')](_0x2e1671,_0x10aecc);})[_0x9aab('0x2d')](function(_0x406ca8){return db[_0x9aab('0x41')][_0x9aab('0x71')](_0x406ca8,{'transaction':_0x228a3f});});})[_0x9aab('0x2d')](function(){return db[_0x9aab('0x41')][_0x9aab('0x72')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2be180[_0x9aab('0x57')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0x9aab('0x2d')](respondWithResult(_0x5e79ca,null))['catch'](handleError(_0x5e79ca,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index b17c722..add2d42 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 _0xf86a=['update','remove','emit','hasOwnProperty','../../mysqldb','setMaxListeners','save'];(function(_0x48d1fc,_0x2a465d){var _0x2bdfb8=function(_0x33781c){while(--_0x33781c){_0x48d1fc['push'](_0x48d1fc['shift']());}};_0x2bdfb8(++_0x2a465d);}(_0xf86a,0x1d9));var _0xaf86=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xf86a[_0x19e35c];return _0x3e1fe8;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0xaf86('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xaf86('0x1')](0x0);var events={'afterCreate':_0xaf86('0x2'),'afterUpdate':_0xaf86('0x3'),'afterDestroy':_0xaf86('0x4')};function emitEvent(_0x4fd46b){return function(_0x29768b,_0xaf7a9c,_0x44e5dd){VoiceExtensionEvents[_0xaf86('0x5')](_0x4fd46b+':'+_0x29768b['id'],_0x29768b);VoiceExtensionEvents[_0xaf86('0x5')](_0x4fd46b,_0x29768b);_0x44e5dd(null);};}for(var e in events){if(events[_0xaf86('0x6')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0xf5ac=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceExtension','save','update'];(function(_0x331b08,_0x2c5937){var _0x5034d9=function(_0x2c916a){while(--_0x2c916a){_0x331b08['push'](_0x331b08['shift']());}};_0x5034d9(++_0x2c5937);}(_0xf5ac,0xc1));var _0xcf5a=function(_0x1895eb,_0x1c336a){_0x1895eb=_0x1895eb-0x0;var _0x520bc5=_0xf5ac[_0x1895eb];return _0x520bc5;};'use strict';var EventEmitter=require(_0xcf5a('0x0'));var VoiceExtension=require(_0xcf5a('0x1'))['db'][_0xcf5a('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcf5a('0x3'),'afterUpdate':_0xcf5a('0x4'),'afterDestroy':_0xcf5a('0x5')};function emitEvent(_0x3ad253){return function(_0x291b60,_0x18e879,_0x86486f){VoiceExtensionEvents[_0xcf5a('0x6')](_0x3ad253+':'+_0x291b60['id'],_0x291b60);VoiceExtensionEvents[_0xcf5a('0x6')](_0x3ad253,_0x291b60);_0x86486f(null);};}for(var e in events){if(events[_0xcf5a('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xcf5a('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 9fa3b1c..856ba04 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 _0x2bd8=['map','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','answer','queue','playback','includes','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appType','outboundDial','appdata','priority','last','concat','VoiceExtension','voice_extensions','Hangup','util','models','Set','type','context','exten','alias','NoOp','CDR(routeAlias)=','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','outboundrouteid=','hasOwnProperty','recordingFormat','none','wav','trunk','timeout','options','url','length','name','param','phone','prefix','split','SIP','join','indexOf','U(xcally-mixmonitor-context)','Interval','findAll','interval','then','intervals','IntervalId'];(function(_0x255ac0,_0x3f6645){var _0x437bf1=function(_0x5baff0){while(--_0x5baff0){_0x255ac0['push'](_0x255ac0['shift']());}};_0x437bf1(++_0x3f6645);}(_0x2bd8,0xaa));var _0x82bd=function(_0x14c7cb,_0xa665e5){_0x14c7cb=_0x14c7cb-0x0;var _0x37157d=_0x2bd8[_0x14c7cb];return _0x37157d;};'use strict';var util=require(_0x82bd('0x0'));var _=require('lodash');var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x4eea99){var _0x1ad50f=_0x4eea99[_0x82bd('0x1')];function _0x2614f2(_0x3415ea){var _0x151c20=0x2;var _0x3b25d2=[{'type':_0x3415ea['type'],'app':_0x82bd('0x2'),'appdata':'CDR(type)='+_0x3415ea[_0x82bd('0x3')],'context':_0x3415ea[_0x82bd('0x4')],'exten':_0x3415ea[_0x82bd('0x5')],'priority':_0x151c20++,'VoiceExtensionId':_0x3415ea['id']},{'type':_0x3415ea[_0x82bd('0x3')],'app':_0x3415ea[_0x82bd('0x6')]?_0x82bd('0x2'):_0x82bd('0x7'),'appdata':_0x3415ea[_0x82bd('0x6')]?_0x82bd('0x8')+_0x3415ea[_0x82bd('0x6')]:'No\x20alias\x20set','context':_0x3415ea[_0x82bd('0x4')],'exten':_0x3415ea['exten'],'priority':_0x151c20++,'VoiceExtensionId':_0x3415ea['id']}];if(_0x3415ea[_0x82bd('0x3')]===_0x82bd('0x9')){_0x3b25d2[_0x82bd('0xa')]({'type':_0x82bd('0x9'),'app':_0x82bd('0x2'),'appdata':_0x82bd('0xb')+_0x3415ea['id'],'context':_0x3415ea[_0x82bd('0x4')],'exten':_0x3415ea[_0x82bd('0x5')],'priority':_0x151c20++,'VoiceExtensionId':_0x3415ea['id']});}_0x3b25d2[_0x82bd('0xa')]({'type':_0x3415ea[_0x82bd('0x3')],'app':'Set','appdata':_0x82bd('0xc'),'context':_0x3415ea[_0x82bd('0x4')],'exten':_0x3415ea[_0x82bd('0x5')],'priority':_0x151c20++,'VoiceExtensionId':_0x3415ea['id']},{'type':_0x3415ea[_0x82bd('0x3')],'app':_0x82bd('0x2'),'appdata':_0x82bd('0xd'),'context':_0x3415ea['context'],'exten':_0x3415ea[_0x82bd('0x5')],'priority':_0x151c20++,'VoiceExtensionId':_0x3415ea['id']},{'type':_0x3415ea[_0x82bd('0x3')],'app':'Set','appdata':_0x82bd('0xe'),'context':_0x3415ea[_0x82bd('0x4')],'exten':_0x3415ea[_0x82bd('0x5')],'priority':_0x151c20++,'VoiceExtensionId':_0x3415ea['id']});return _0x3b25d2;}function _0x4c93a6(_0x41c83c){var _0x21b31d=0x2;var _0x8584e7=[{'type':_0x82bd('0xf'),'app':_0x82bd('0x2'),'appdata':_0x82bd('0x10'),'context':_0x41c83c[_0x82bd('0x4')],'exten':_0x41c83c[_0x82bd('0x5')],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':_0x82bd('0xf'),'app':_0x41c83c[_0x82bd('0x6')]?_0x82bd('0x2'):'NoOp','appdata':_0x41c83c[_0x82bd('0x6')]?_0x82bd('0x8')+_0x41c83c['alias']:'No\x20alias\x20set','context':_0x41c83c['context'],'exten':_0x41c83c[_0x82bd('0x5')],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':_0x82bd('0xf'),'app':'Set','appdata':_0x82bd('0x11')+(_0x41c83c[_0x82bd('0x12')]?_0x82bd('0x13')+_0x41c83c[_0x82bd('0x12')]+'}':_0x82bd('0x14')),'context':_0x41c83c[_0x82bd('0x4')],'exten':_0x41c83c['exten'],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':'outbound','app':_0x82bd('0x2'),'appdata':_0x82bd('0xb')+_0x41c83c['id'],'context':_0x41c83c[_0x82bd('0x4')],'exten':_0x41c83c[_0x82bd('0x5')],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':_0x82bd('0xf'),'app':_0x82bd('0x15'),'appdata':_0x82bd('0x16')+(_0x21b31d+0x2)+_0x82bd('0x17')+(_0x21b31d+0x1)+')','context':_0x41c83c['context'],'exten':_0x41c83c[_0x82bd('0x5')],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':_0x82bd('0xf'),'app':'Set','appdata':_0x41c83c['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x41c83c[_0x82bd('0x12')]+'}':'CDR(prefix)=noprefix','context':_0x41c83c[_0x82bd('0x4')],'exten':_0x41c83c[_0x82bd('0x5')],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':'outbound','app':_0x82bd('0x2'),'appdata':_0x82bd('0xc'),'context':_0x41c83c[_0x82bd('0x4')],'exten':_0x41c83c[_0x82bd('0x5')],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':'outbound','app':_0x82bd('0x2'),'appdata':_0x82bd('0xd'),'context':_0x41c83c[_0x82bd('0x4')],'exten':_0x41c83c[_0x82bd('0x5')],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':_0x82bd('0xf'),'app':_0x82bd('0x2'),'appdata':_0x82bd('0xe'),'context':_0x41c83c[_0x82bd('0x4')],'exten':_0x41c83c['exten'],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':_0x82bd('0xf'),'app':_0x82bd('0x2'),'appdata':_0x82bd('0x18')+_0x41c83c['id'],'context':_0x41c83c['context'],'exten':_0x41c83c[_0x82bd('0x5')],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']}];if(_0x41c83c[_0x82bd('0x19')](_0x82bd('0x1a'))&&_0x41c83c[_0x82bd('0x1a')]!==_0x82bd('0x1b')){_0x8584e7['push']({'type':_0x82bd('0xf'),'app':_0x82bd('0x2'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x41c83c['context'],'exten':_0x41c83c['exten'],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']},{'type':_0x82bd('0xf'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x41c83c[_0x82bd('0x1a')]||_0x82bd('0x1c'),'context':_0x41c83c['context'],'exten':_0x41c83c[_0x82bd('0x5')],'priority':_0x21b31d++,'VoiceExtensionId':_0x41c83c['id']});}return _0x8584e7;}function _0x1b4a5d(_0x1fffbf){var _0x378752=[{'name':_0x82bd('0x1d'),'param':0x0},{'name':_0x82bd('0x1e'),'param':0x1},{'name':_0x82bd('0x1f'),'param':0x2},{'name':_0x82bd('0x20'),'param':0x3}];var _0x20419d={};var _0x4283e1=_0x1fffbf['split'](',');var _0x3eaabd=[];for(var _0x4c7bbc=0x0;_0x4c7bbc<_0x378752[_0x82bd('0x21')];_0x4c7bbc++){switch(_0x378752[_0x4c7bbc][_0x82bd('0x22')]){case'trunk':_0x20419d[_0x82bd('0x1d')]=_0x4283e1[_0x378752[_0x4c7bbc][_0x82bd('0x23')]]['split']('/')[0x1];_0x20419d[_0x82bd('0x24')]=_0x4283e1[_0x378752[_0x4c7bbc]['param']]['split']('/')[0x2];_0x20419d[_0x82bd('0x25')]=_0x20419d[_0x82bd('0x24')]?_0x20419d[_0x82bd('0x24')][_0x82bd('0x26')]('$')[0x0]:undefined;_0x20419d[_0x82bd('0x24')]=route[_0x82bd('0x12')]?(_0x20419d[_0x82bd('0x25')]||'')+'${EXTEN:'+route[_0x82bd('0x12')]+'}':(_0x20419d[_0x82bd('0x25')]||'')+_0x82bd('0x14');_0x3eaabd[_0x378752[_0x4c7bbc][_0x82bd('0x23')]]=[_0x82bd('0x27'),_0x20419d['trunk'],_0x20419d['phone']][_0x82bd('0x28')]('/');break;case _0x82bd('0x1f'):_0x20419d[_0x82bd('0x1f')]=_0x4283e1[_0x378752[_0x4c7bbc]['param']];if(route['recordingFormat']!==_0x82bd('0x1b')){if(_0x20419d[_0x82bd('0x1f')][_0x82bd('0x29')](_0x82bd('0x2a'))<0x0){_0x20419d[_0x82bd('0x1f')]+='U(xcally-mixmonitor-context)';}}else{_0x20419d[_0x82bd('0x1f')]=_0x20419d['options']['replace']('U(xcally-mixmonitor-context)','');}_0x3eaabd[_0x378752[_0x4c7bbc][_0x82bd('0x23')]]=_0x20419d[_0x82bd('0x1f')];break;default:_0x3eaabd[_0x378752[_0x4c7bbc][_0x82bd('0x23')]]=_0x4283e1[_0x378752[_0x4c7bbc][_0x82bd('0x23')]];}}return _0x3eaabd[_0x82bd('0x28')](',');}function _0x297c33(_0x58d0be,_0x5bed60,_0x64b279,_0x10af4c){return new Promise(function(_0x5bc3bc,_0x223f9e){var _0x1c13a9=[];if(_['isEmpty'](_0x5bed60))return _0x5bc3bc(_0x1c13a9);_0x1ad50f[_0x82bd('0x2b')][_0x82bd('0x2c')]({'attributes':['id',_0x82bd('0x2d'),'IntervalId'],'raw':!![]})[_0x82bd('0x2e')](function(_0x298f16){for(var _0x909262=0x0,_0x291b95=0x0;_0x909262<_0x5bed60[_0x82bd('0x21')];_0x909262++,_0x291b95=0x0){var _0x590de7=_0x5bed60[_0x909262];var _0x38f0d6=[];var _0x561cae=[];if(_0x590de7[_0x82bd('0x2d')]!=='*,*,*,*'){_0x590de7['intervals']=[_0x590de7['interval']];}else{_0x590de7[_0x82bd('0x2f')]=_0x590de7[_0x82bd('0x30')]?_[_0x82bd('0x31')](_['filter'](_0x298f16,{'IntervalId':_0x590de7[_0x82bd('0x30')]}),'interval'):[];}_0x590de7[_0x82bd('0x4')]=_0x58d0be[_0x82bd('0x4')];_0x590de7['exten']=_0x58d0be[_0x82bd('0x5')];if(_0x590de7[_0x82bd('0x3')])_0x590de7[_0x82bd('0x3')]=_0x590de7[_0x82bd('0x3')][_0x82bd('0x32')]();if(_0x58d0be[_0x82bd('0x3')]===_0x82bd('0xf')){if(_0x590de7[_0x82bd('0x19')](_0x82bd('0x33'))&&_0x590de7[_0x82bd('0x33')]&&_0x590de7[_0x82bd('0x33')]!=='--'){_0x38f0d6[_0x82bd('0xa')]({'type':_0x590de7['type'][_0x82bd('0x32')](),'app':'Set','appdata':'CDR(tag)='+_0x590de7[_0x82bd('0x33')],'context':_0x58d0be['context'],'exten':_0x58d0be[_0x82bd('0x5')],'priority':_0x590de7[_0x82bd('0x2f')][_0x82bd('0x21')]+_0x64b279+_0x291b95++,'VoiceExtensionId':_0x58d0be['id']});}_0x38f0d6['push']({'type':_0x590de7[_0x82bd('0x3')][_0x82bd('0x32')](),'app':_0x82bd('0x15'),'appdata':_0x82bd('0x34')+(_0x590de7[_0x82bd('0x35')]?'Set(CALLERID(all)='+_0x590de7[_0x82bd('0x35')]+')':'NoOp(No\x20number\x20available)'),'context':_0x58d0be[_0x82bd('0x4')],'exten':_0x58d0be[_0x82bd('0x5')],'priority':_0x590de7[_0x82bd('0x2f')][_0x82bd('0x21')]+_0x64b279+_0x291b95++,'VoiceExtensionId':_0x58d0be['id']});}else{if(_0x590de7['hasOwnProperty'](_0x82bd('0x36'))){if([_0x82bd('0x37'),_0x82bd('0x38')][_0x82bd('0x39')](_0x590de7['app'][_0x82bd('0x32')]())&&_0x590de7['appType']!==_0x82bd('0x3a')){if(_0x590de7[_0x82bd('0x36')]){_0x38f0d6[_0x82bd('0xa')]({'type':_0x590de7['type'][_0x82bd('0x32')](),'app':_0x82bd('0x15'),'appdata':_0x82bd('0x3b'),'context':_0x58d0be['context'],'exten':_0x58d0be[_0x82bd('0x5')],'priority':_0x590de7['intervals'][_0x82bd('0x21')]+_0x64b279+_0x291b95++,'VoiceExtensionId':_0x58d0be['id']});_0x38f0d6[_0x82bd('0xa')]({'type':_0x590de7['type'][_0x82bd('0x32')](),'app':_0x82bd('0x2'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x58d0be['context'],'exten':_0x58d0be[_0x82bd('0x5')],'priority':_0x590de7[_0x82bd('0x2f')]['length']+_0x64b279+_0x291b95++,'VoiceExtensionId':_0x58d0be['id']});}else{_0x38f0d6['push']({'type':_0x590de7['type'][_0x82bd('0x32')](),'app':_0x82bd('0x15'),'appdata':_0x82bd('0x3c'),'context':_0x58d0be[_0x82bd('0x4')],'exten':_0x58d0be[_0x82bd('0x5')],'priority':_0x590de7['intervals'][_0x82bd('0x21')]+_0x64b279+_0x291b95++,'VoiceExtensionId':_0x58d0be['id']});_0x38f0d6['push']({'type':_0x590de7[_0x82bd('0x3')][_0x82bd('0x32')](),'app':_0x82bd('0x2'),'appdata':_0x82bd('0x3d'),'context':_0x58d0be[_0x82bd('0x4')],'exten':_0x58d0be[_0x82bd('0x5')],'priority':_0x590de7[_0x82bd('0x2f')][_0x82bd('0x21')]+_0x64b279+_0x291b95++,'VoiceExtensionId':_0x58d0be['id']});}}}}for(var _0x512eb2=0x0;_0x512eb2<_0x590de7[_0x82bd('0x2f')][_0x82bd('0x21')];_0x512eb2++){var _0xdf917f=_0x64b279+_0x590de7[_0x82bd('0x2f')][_0x82bd('0x21')];var _0x244d03=_0x512eb2===_0x590de7[_0x82bd('0x2f')]['length']-0x1?_0x64b279+_0x38f0d6[_0x82bd('0x21')]+_0x561cae[_0x82bd('0x21')]+0x2:_0x64b279+_0x512eb2+0x1;_0x38f0d6[_0x82bd('0x3e')](_0x512eb2,0x0,{'type':_0x58d0be['type'],'app':'GotoIfTime','appdata':_0x590de7[_0x82bd('0x2f')][_0x512eb2]+'?'+_0x58d0be[_0x82bd('0x4')]+_0x82bd('0x3f')+_0xdf917f+':'+_0x58d0be['context']+_0x82bd('0x3f')+_0x244d03,'exten':_0x58d0be['exten'],'context':_0x58d0be[_0x82bd('0x4')],'priority':_0x64b279+_0x512eb2,'VoiceExtensionId':_0x58d0be['id']});}if(_0x10af4c&&_0x590de7[_0x82bd('0x40')]===_0x82bd('0x41'))_0x590de7[_0x82bd('0x42')]=_0x1b4a5d(_0x590de7[_0x82bd('0x42')]);_0x590de7[_0x82bd('0x43')]=_0x38f0d6[_0x82bd('0x21')]?_[_0x82bd('0x44')](_0x38f0d6)[_0x82bd('0x43')]+0x1:_0x64b279;_0x1c13a9=_[_0x82bd('0x45')](_0x1c13a9,_0x38f0d6,[_0x590de7],_0x561cae);_0x64b279=_[_0x82bd('0x44')](_0x1c13a9)[_0x82bd('0x43')]+0x1;}return _0x5bc3bc(_0x1c13a9);})['catch'](function(_0x129219){_0x223f9e(_0x129219);});});}return _0x4eea99['define'](_0x82bd('0x46'),attributes,{'tableName':_0x82bd('0x47'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x416229,_0x7ea2a8){var _0x4cc134=this;var _0x3686d6=_0x4cc134[_0x82bd('0x3')]===_0x82bd('0xf')?_0x4c93a6(_0x4cc134):_0x2614f2(_0x4cc134);return _0x297c33(_0x4cc134,_0x416229,_[_0x82bd('0x44')](_0x3686d6)[_0x82bd('0x43')]+0x1,_0x7ea2a8)['then'](function(_0x562c64){var _0x1dbdd5=_['concat'](_0x3686d6,_0x562c64);_0x1dbdd5[_0x82bd('0xa')]({'type':_0x4cc134[_0x82bd('0x3')],'app':_0x82bd('0x48'),'exten':_0x4cc134[_0x82bd('0x5')],'context':_0x4cc134['context'],'priority':_[_0x82bd('0x44')](_0x1dbdd5)[_0x82bd('0x43')]+0x1,'VoiceExtensionId':_0x4cc134['id']});return _0x1dbdd5;});}}});}; \ No newline at end of file +var _0xee42=['app','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','Hangup','util','lodash','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','No\x20alias\x20set','inbound','push','CDR(routeid)=','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','url','length','name','param','split','prefix','phone','${EXTEN:','SIP','join','options','U(xcally-mixmonitor-context)','replace','Interval','interval','IntervalId','then','intervals','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback'];(function(_0x174023,_0x4d40fa){var _0x436429=function(_0x4b98a4){while(--_0x4b98a4){_0x174023['push'](_0x174023['shift']());}};_0x436429(++_0x4d40fa);}(_0xee42,0x1a7));var _0x2ee4=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xee42[_0x1ccdf7];return _0x52a0ae;};'use strict';var util=require(_0x2ee4('0x0'));var _=require(_0x2ee4('0x1'));var attributes=require('./voiceExtension.attributes');module[_0x2ee4('0x2')]=function(_0x433f97){var _0x272f45=_0x433f97[_0x2ee4('0x3')];function _0x180227(_0x24ba1d){var _0x132106=0x2;var _0x18c1cf=[{'type':_0x24ba1d[_0x2ee4('0x4')],'app':_0x2ee4('0x5'),'appdata':_0x2ee4('0x6')+_0x24ba1d[_0x2ee4('0x4')],'context':_0x24ba1d[_0x2ee4('0x7')],'exten':_0x24ba1d[_0x2ee4('0x8')],'priority':_0x132106++,'VoiceExtensionId':_0x24ba1d['id']},{'type':_0x24ba1d[_0x2ee4('0x4')],'app':_0x24ba1d[_0x2ee4('0x9')]?_0x2ee4('0x5'):_0x2ee4('0xa'),'appdata':_0x24ba1d[_0x2ee4('0x9')]?'CDR(routeAlias)='+_0x24ba1d[_0x2ee4('0x9')]:_0x2ee4('0xb'),'context':_0x24ba1d[_0x2ee4('0x7')],'exten':_0x24ba1d[_0x2ee4('0x8')],'priority':_0x132106++,'VoiceExtensionId':_0x24ba1d['id']}];if(_0x24ba1d[_0x2ee4('0x4')]===_0x2ee4('0xc')){_0x18c1cf[_0x2ee4('0xd')]({'type':_0x2ee4('0xc'),'app':_0x2ee4('0x5'),'appdata':_0x2ee4('0xe')+_0x24ba1d['id'],'context':_0x24ba1d[_0x2ee4('0x7')],'exten':_0x24ba1d['exten'],'priority':_0x132106++,'VoiceExtensionId':_0x24ba1d['id']});}_0x18c1cf[_0x2ee4('0xd')]({'type':_0x24ba1d['type'],'app':_0x2ee4('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x24ba1d[_0x2ee4('0x7')],'exten':_0x24ba1d[_0x2ee4('0x8')],'priority':_0x132106++,'VoiceExtensionId':_0x24ba1d['id']},{'type':_0x24ba1d['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x24ba1d[_0x2ee4('0x7')],'exten':_0x24ba1d[_0x2ee4('0x8')],'priority':_0x132106++,'VoiceExtensionId':_0x24ba1d['id']},{'type':_0x24ba1d[_0x2ee4('0x4')],'app':_0x2ee4('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x24ba1d[_0x2ee4('0x7')],'exten':_0x24ba1d[_0x2ee4('0x8')],'priority':_0x132106++,'VoiceExtensionId':_0x24ba1d['id']});return _0x18c1cf;}function _0xc0c45a(_0x5bfbef){var _0x40efe2=0x2;var _0x611bf7=[{'type':_0x2ee4('0xf'),'app':_0x2ee4('0x5'),'appdata':_0x2ee4('0x10'),'context':_0x5bfbef[_0x2ee4('0x7')],'exten':_0x5bfbef['exten'],'priority':_0x40efe2++,'VoiceExtensionId':_0x5bfbef['id']},{'type':'outbound','app':_0x5bfbef[_0x2ee4('0x9')]?_0x2ee4('0x5'):_0x2ee4('0xa'),'appdata':_0x5bfbef[_0x2ee4('0x9')]?_0x2ee4('0x11')+_0x5bfbef['alias']:_0x2ee4('0xb'),'context':_0x5bfbef[_0x2ee4('0x7')],'exten':_0x5bfbef[_0x2ee4('0x8')],'priority':_0x40efe2++,'VoiceExtensionId':_0x5bfbef['id']},{'type':_0x2ee4('0xf'),'app':_0x2ee4('0x5'),'appdata':_0x2ee4('0x12')+(_0x5bfbef[_0x2ee4('0x13')]?'${EXTEN:'+_0x5bfbef[_0x2ee4('0x13')]+'}':_0x2ee4('0x14')),'context':_0x5bfbef[_0x2ee4('0x7')],'exten':_0x5bfbef['exten'],'priority':_0x40efe2++,'VoiceExtensionId':_0x5bfbef['id']},{'type':_0x2ee4('0xf'),'app':'Set','appdata':_0x2ee4('0xe')+_0x5bfbef['id'],'context':_0x5bfbef[_0x2ee4('0x7')],'exten':_0x5bfbef[_0x2ee4('0x8')],'priority':_0x40efe2++,'VoiceExtensionId':_0x5bfbef['id']},{'type':'outbound','app':'ExecIf','appdata':_0x2ee4('0x15')+(_0x40efe2+0x2)+_0x2ee4('0x16')+(_0x40efe2+0x1)+')','context':_0x5bfbef['context'],'exten':_0x5bfbef[_0x2ee4('0x8')],'priority':_0x40efe2++,'VoiceExtensionId':_0x5bfbef['id']},{'type':_0x2ee4('0xf'),'app':_0x2ee4('0x5'),'appdata':_0x5bfbef[_0x2ee4('0x13')]?_0x2ee4('0x17')+_0x5bfbef[_0x2ee4('0x13')]+'}':_0x2ee4('0x18'),'context':_0x5bfbef['context'],'exten':_0x5bfbef['exten'],'priority':_0x40efe2++,'VoiceExtensionId':_0x5bfbef['id']},{'type':_0x2ee4('0xf'),'app':_0x2ee4('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x5bfbef[_0x2ee4('0x7')],'exten':_0x5bfbef[_0x2ee4('0x8')],'priority':_0x40efe2++,'VoiceExtensionId':_0x5bfbef['id']},{'type':_0x2ee4('0xf'),'app':_0x2ee4('0x5'),'appdata':_0x2ee4('0x19'),'context':_0x5bfbef[_0x2ee4('0x7')],'exten':_0x5bfbef[_0x2ee4('0x8')],'priority':_0x40efe2++,'VoiceExtensionId':_0x5bfbef['id']},{'type':'outbound','app':'Set','appdata':_0x2ee4('0x1a'),'context':_0x5bfbef[_0x2ee4('0x7')],'exten':_0x5bfbef[_0x2ee4('0x8')],'priority':_0x40efe2++,'VoiceExtensionId':_0x5bfbef['id']},{'type':_0x2ee4('0xf'),'app':_0x2ee4('0x5'),'appdata':_0x2ee4('0x1b')+_0x5bfbef['id'],'context':_0x5bfbef[_0x2ee4('0x7')],'exten':_0x5bfbef[_0x2ee4('0x8')],'priority':_0x40efe2++,'VoiceExtensionId':_0x5bfbef['id']}];if(_0x5bfbef['hasOwnProperty']('recordingFormat')&&_0x5bfbef[_0x2ee4('0x1c')]!==_0x2ee4('0x1d')){_0x611bf7['push']({'type':_0x2ee4('0xf'),'app':_0x2ee4('0x5'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x5bfbef[_0x2ee4('0x7')],'exten':_0x5bfbef[_0x2ee4('0x8')],'priority':_0x40efe2++,'VoiceExtensionId':_0x5bfbef['id']},{'type':_0x2ee4('0xf'),'app':_0x2ee4('0x5'),'appdata':_0x2ee4('0x1e')+_0x5bfbef[_0x2ee4('0x1c')]||_0x2ee4('0x1f'),'context':_0x5bfbef['context'],'exten':_0x5bfbef[_0x2ee4('0x8')],'priority':_0x40efe2++,'VoiceExtensionId':_0x5bfbef['id']});}return _0x611bf7;}function _0x4c437a(_0x20e99f){var _0x17d869=[{'name':_0x2ee4('0x20'),'param':0x0},{'name':'timeout','param':0x1},{'name':'options','param':0x2},{'name':_0x2ee4('0x21'),'param':0x3}];var _0x1b95a9={};var _0x32fa25=_0x20e99f['split'](',');var _0xd27347=[];for(var _0x35f3a9=0x0;_0x35f3a9<_0x17d869[_0x2ee4('0x22')];_0x35f3a9++){switch(_0x17d869[_0x35f3a9][_0x2ee4('0x23')]){case _0x2ee4('0x20'):_0x1b95a9['trunk']=_0x32fa25[_0x17d869[_0x35f3a9][_0x2ee4('0x24')]][_0x2ee4('0x25')]('/')[0x1];_0x1b95a9['phone']=_0x32fa25[_0x17d869[_0x35f3a9][_0x2ee4('0x24')]][_0x2ee4('0x25')]('/')[0x2];_0x1b95a9[_0x2ee4('0x26')]=_0x1b95a9[_0x2ee4('0x27')]?_0x1b95a9[_0x2ee4('0x27')][_0x2ee4('0x25')]('$')[0x0]:undefined;_0x1b95a9[_0x2ee4('0x27')]=route[_0x2ee4('0x13')]?(_0x1b95a9[_0x2ee4('0x26')]||'')+_0x2ee4('0x28')+route[_0x2ee4('0x13')]+'}':(_0x1b95a9['prefix']||'')+_0x2ee4('0x14');_0xd27347[_0x17d869[_0x35f3a9][_0x2ee4('0x24')]]=[_0x2ee4('0x29'),_0x1b95a9[_0x2ee4('0x20')],_0x1b95a9[_0x2ee4('0x27')]][_0x2ee4('0x2a')]('/');break;case _0x2ee4('0x2b'):_0x1b95a9[_0x2ee4('0x2b')]=_0x32fa25[_0x17d869[_0x35f3a9][_0x2ee4('0x24')]];if(route[_0x2ee4('0x1c')]!==_0x2ee4('0x1d')){if(_0x1b95a9['options']['indexOf'](_0x2ee4('0x2c'))<0x0){_0x1b95a9[_0x2ee4('0x2b')]+=_0x2ee4('0x2c');}}else{_0x1b95a9['options']=_0x1b95a9[_0x2ee4('0x2b')][_0x2ee4('0x2d')](_0x2ee4('0x2c'),'');}_0xd27347[_0x17d869[_0x35f3a9][_0x2ee4('0x24')]]=_0x1b95a9['options'];break;default:_0xd27347[_0x17d869[_0x35f3a9][_0x2ee4('0x24')]]=_0x32fa25[_0x17d869[_0x35f3a9][_0x2ee4('0x24')]];}}return _0xd27347[_0x2ee4('0x2a')](',');}function _0x5453ef(_0x579ff1,_0x3b2b5a,_0x459424,_0x31699f){return new Promise(function(_0x38ba14,_0x71b87e){var _0x520995=[];if(_['isEmpty'](_0x3b2b5a))return _0x38ba14(_0x520995);_0x272f45[_0x2ee4('0x2e')]['findAll']({'attributes':['id',_0x2ee4('0x2f'),_0x2ee4('0x30')],'raw':!![]})[_0x2ee4('0x31')](function(_0x46cfe3){for(var _0x3b0712=0x0,_0x13cf31=0x0;_0x3b0712<_0x3b2b5a[_0x2ee4('0x22')];_0x3b0712++,_0x13cf31=0x0){var _0x153c95=_0x3b2b5a[_0x3b0712];var _0x286bc9=[];var _0x5d9a15=[];if(_0x153c95[_0x2ee4('0x2f')]!=='*,*,*,*'){_0x153c95['intervals']=[_0x153c95['interval']];}else{_0x153c95[_0x2ee4('0x32')]=_0x153c95['IntervalId']?_['map'](_[_0x2ee4('0x33')](_0x46cfe3,{'IntervalId':_0x153c95[_0x2ee4('0x30')]}),_0x2ee4('0x2f')):[];}_0x153c95['context']=_0x579ff1['context'];_0x153c95['exten']=_0x579ff1[_0x2ee4('0x8')];if(_0x153c95[_0x2ee4('0x4')])_0x153c95[_0x2ee4('0x4')]=_0x153c95['type'][_0x2ee4('0x34')]();if(_0x579ff1[_0x2ee4('0x4')]==='outbound'){if(_0x153c95[_0x2ee4('0x35')](_0x2ee4('0x36'))&&_0x153c95[_0x2ee4('0x36')]&&_0x153c95[_0x2ee4('0x36')]!=='--'){_0x286bc9[_0x2ee4('0xd')]({'type':_0x153c95[_0x2ee4('0x4')][_0x2ee4('0x34')](),'app':_0x2ee4('0x5'),'appdata':_0x2ee4('0x37')+_0x153c95[_0x2ee4('0x36')],'context':_0x579ff1[_0x2ee4('0x7')],'exten':_0x579ff1[_0x2ee4('0x8')],'priority':_0x153c95[_0x2ee4('0x32')][_0x2ee4('0x22')]+_0x459424+_0x13cf31++,'VoiceExtensionId':_0x579ff1['id']});}_0x286bc9[_0x2ee4('0xd')]({'type':_0x153c95['type'][_0x2ee4('0x34')](),'app':_0x2ee4('0x38'),'appdata':_0x2ee4('0x39')+(_0x153c95[_0x2ee4('0x3a')]?_0x2ee4('0x3b')+_0x153c95['callerID']+')':_0x2ee4('0x3c')),'context':_0x579ff1[_0x2ee4('0x7')],'exten':_0x579ff1[_0x2ee4('0x8')],'priority':_0x153c95['intervals'][_0x2ee4('0x22')]+_0x459424+_0x13cf31++,'VoiceExtensionId':_0x579ff1['id']});}else{if(_0x153c95[_0x2ee4('0x35')]('answer')){if([_0x2ee4('0x3d'),_0x2ee4('0x3e')]['includes'](_0x153c95[_0x2ee4('0x3f')]['toLowerCase']())&&_0x153c95[_0x2ee4('0x40')]!=='custom'){if(_0x153c95[_0x2ee4('0x41')]){_0x286bc9[_0x2ee4('0xd')]({'type':_0x153c95[_0x2ee4('0x4')]['toLowerCase'](),'app':_0x2ee4('0x38'),'appdata':_0x2ee4('0x42'),'context':_0x579ff1[_0x2ee4('0x7')],'exten':_0x579ff1[_0x2ee4('0x8')],'priority':_0x153c95[_0x2ee4('0x32')][_0x2ee4('0x22')]+_0x459424+_0x13cf31++,'VoiceExtensionId':_0x579ff1['id']});_0x286bc9['push']({'type':_0x153c95[_0x2ee4('0x4')][_0x2ee4('0x34')](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x579ff1[_0x2ee4('0x7')],'exten':_0x579ff1[_0x2ee4('0x8')],'priority':_0x153c95[_0x2ee4('0x32')][_0x2ee4('0x22')]+_0x459424+_0x13cf31++,'VoiceExtensionId':_0x579ff1['id']});}else{_0x286bc9[_0x2ee4('0xd')]({'type':_0x153c95[_0x2ee4('0x4')][_0x2ee4('0x34')](),'app':_0x2ee4('0x38'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x579ff1['context'],'exten':_0x579ff1[_0x2ee4('0x8')],'priority':_0x153c95['intervals']['length']+_0x459424+_0x13cf31++,'VoiceExtensionId':_0x579ff1['id']});_0x286bc9[_0x2ee4('0xd')]({'type':_0x153c95[_0x2ee4('0x4')]['toLowerCase'](),'app':'Set','appdata':_0x2ee4('0x43'),'context':_0x579ff1[_0x2ee4('0x7')],'exten':_0x579ff1[_0x2ee4('0x8')],'priority':_0x153c95[_0x2ee4('0x32')][_0x2ee4('0x22')]+_0x459424+_0x13cf31++,'VoiceExtensionId':_0x579ff1['id']});}}}}for(var _0xee1839=0x0;_0xee1839<_0x153c95[_0x2ee4('0x32')][_0x2ee4('0x22')];_0xee1839++){var _0x2ce71f=_0x459424+_0x153c95[_0x2ee4('0x32')][_0x2ee4('0x22')];var _0x2ee702=_0xee1839===_0x153c95[_0x2ee4('0x32')][_0x2ee4('0x22')]-0x1?_0x459424+_0x286bc9['length']+_0x5d9a15[_0x2ee4('0x22')]+0x2:_0x459424+_0xee1839+0x1;_0x286bc9[_0x2ee4('0x44')](_0xee1839,0x0,{'type':_0x579ff1[_0x2ee4('0x4')],'app':_0x2ee4('0x45'),'appdata':_0x153c95[_0x2ee4('0x32')][_0xee1839]+'?'+_0x579ff1[_0x2ee4('0x7')]+_0x2ee4('0x46')+_0x2ce71f+':'+_0x579ff1[_0x2ee4('0x7')]+_0x2ee4('0x46')+_0x2ee702,'exten':_0x579ff1[_0x2ee4('0x8')],'context':_0x579ff1['context'],'priority':_0x459424+_0xee1839,'VoiceExtensionId':_0x579ff1['id']});}if(_0x31699f&&_0x153c95[_0x2ee4('0x40')]===_0x2ee4('0x47'))_0x153c95[_0x2ee4('0x48')]=_0x4c437a(_0x153c95[_0x2ee4('0x48')]);_0x153c95[_0x2ee4('0x49')]=_0x286bc9[_0x2ee4('0x22')]?_[_0x2ee4('0x4a')](_0x286bc9)[_0x2ee4('0x49')]+0x1:_0x459424;_0x520995=_[_0x2ee4('0x4b')](_0x520995,_0x286bc9,[_0x153c95],_0x5d9a15);_0x459424=_[_0x2ee4('0x4a')](_0x520995)['priority']+0x1;}return _0x38ba14(_0x520995);})[_0x2ee4('0x4c')](function(_0x4c632b){_0x71b87e(_0x4c632b);});});}return _0x433f97[_0x2ee4('0x4d')](_0x2ee4('0x4e'),attributes,{'tableName':_0x2ee4('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x285cfb,_0x2a75cc){var _0x9beb9=this;var _0x29eb83=_0x9beb9[_0x2ee4('0x4')]===_0x2ee4('0xf')?_0xc0c45a(_0x9beb9):_0x180227(_0x9beb9);return _0x5453ef(_0x9beb9,_0x285cfb,_[_0x2ee4('0x4a')](_0x29eb83)[_0x2ee4('0x49')]+0x1,_0x2a75cc)[_0x2ee4('0x31')](function(_0x2d142c){var _0x4fc951=_[_0x2ee4('0x4b')](_0x29eb83,_0x2d142c);_0x4fc951[_0x2ee4('0xd')]({'type':_0x9beb9[_0x2ee4('0x4')],'app':_0x2ee4('0x50'),'exten':_0x9beb9[_0x2ee4('0x8')],'context':_0x9beb9[_0x2ee4('0x7')],'priority':_[_0x2ee4('0x4a')](_0x4fc951)[_0x2ee4('0x49')]+0x1,'VoiceExtensionId':_0x9beb9['id']});return _0x4fc951;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 0d68bdc..41db1df 100644 --- a/server/api/voiceExtension/voiceExtension.rpc.js +++ b/server/api/voiceExtension/voiceExtension.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe599=['info','request\x20sent','debug','stringify','error','VoiceExtension,\x20%s,\x20%s','message','catch','GetVoiceExtension','options','raw','where','limit','include','model','attributes','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','./voiceExtension.socket','register','request','then'];(function(_0x37e27b,_0x350b60){var _0x27ccb6=function(_0x50dbeb){while(--_0x50dbeb){_0x37e27b['push'](_0x37e27b['shift']());}};_0x27ccb6(++_0x350b60);}(_0xe599,0x1e5));var _0x9e59=function(_0x4f9087,_0x4a4184){_0x4f9087=_0x4f9087-0x0;var _0x4cbdcd=_0xe599[_0x4f9087];return _0x4cbdcd;};'use strict';var _=require(_0x9e59('0x0'));var util=require(_0x9e59('0x1'));var moment=require(_0x9e59('0x2'));var BPromise=require(_0x9e59('0x3'));var rs=require(_0x9e59('0x4'));var fs=require('fs');var Redis=require(_0x9e59('0x5'));var db=require(_0x9e59('0x6'))['db'];var utils=require(_0x9e59('0x7'));var logger=require(_0x9e59('0x8'))('rpc');var config=require(_0x9e59('0x9'));var jayson=require(_0x9e59('0xa'));var client=jayson['client'][_0x9e59('0xb')]({'port':0x232a});config['redis']=_[_0x9e59('0xc')](config[_0x9e59('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e59('0xe'))(new Redis(config[_0x9e59('0xd')]));require(_0x9e59('0xf'))[_0x9e59('0x10')](socket);function respondWithRpcPromise(_0x64d093,_0x14a5d7,_0x578fdc){return new BPromise(function(_0x312bc6,_0x5ba142){return client[_0x9e59('0x11')](_0x64d093,_0x578fdc)[_0x9e59('0x12')](function(_0x21c404){logger[_0x9e59('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x14a5d7,_0x9e59('0x14'));logger[_0x9e59('0x15')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x14a5d7,_0x9e59('0x14'),JSON[_0x9e59('0x16')](_0x21c404));if(_0x21c404[_0x9e59('0x17')]){if(_0x21c404[_0x9e59('0x17')]['code']===0x1f4){logger[_0x9e59('0x17')](_0x9e59('0x18'),_0x14a5d7,_0x21c404[_0x9e59('0x17')][_0x9e59('0x19')]);return _0x5ba142(_0x21c404[_0x9e59('0x17')][_0x9e59('0x19')]);}logger[_0x9e59('0x17')](_0x9e59('0x18'),_0x14a5d7,_0x21c404['error'][_0x9e59('0x19')]);return _0x312bc6(_0x21c404['error']['message']);}else{logger['info'](_0x9e59('0x18'),_0x14a5d7,_0x9e59('0x14'));_0x312bc6(_0x21c404['result'][_0x9e59('0x19')]);}})[_0x9e59('0x1a')](function(_0x40f315){logger[_0x9e59('0x17')](_0x9e59('0x18'),_0x14a5d7,_0x40f315);_0x5ba142(_0x40f315);});});}exports[_0x9e59('0x1b')]=function(_0x3162f9){var _0x48fa20=this;return new Promise(function(_0x1ba8f9,_0x52022d){return db['VoiceExtension']['findAll']({'raw':_0x3162f9[_0x9e59('0x1c')]?_0x3162f9[_0x9e59('0x1c')][_0x9e59('0x1d')]===undefined?!![]:![]:!![],'where':_0x3162f9['options']?_0x3162f9[_0x9e59('0x1c')][_0x9e59('0x1e')]||null:null,'attributes':_0x3162f9['options']?_0x3162f9['options']['attributes']||null:null,'limit':_0x3162f9[_0x9e59('0x1c')]?_0x3162f9[_0x9e59('0x1c')][_0x9e59('0x1f')]||null:null,'include':_0x3162f9[_0x9e59('0x1c')]?_0x3162f9[_0x9e59('0x1c')]['include']?_['map'](_0x3162f9['options'][_0x9e59('0x20')],function(_0x147b15){return{'model':db[_0x147b15[_0x9e59('0x21')]],'as':_0x147b15['as'],'attributes':_0x147b15[_0x9e59('0x22')],'include':_0x147b15[_0x9e59('0x20')]?_[_0x9e59('0x23')](_0x147b15['include'],function(_0x5d4be1){return{'model':db[_0x5d4be1[_0x9e59('0x21')]],'as':_0x5d4be1['as'],'attributes':_0x5d4be1[_0x9e59('0x22')],'include':_0x5d4be1[_0x9e59('0x20')]?_[_0x9e59('0x23')](_0x5d4be1[_0x9e59('0x20')],function(_0x17f4f5){return{'model':db[_0x17f4f5[_0x9e59('0x21')]],'as':_0x17f4f5['as'],'attributes':_0x17f4f5[_0x9e59('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9e59('0x12')](function(_0x3d002f){logger[_0x9e59('0x13')](_0x9e59('0x1b'),_0x3162f9);logger[_0x9e59('0x15')]('GetVoiceExtension',_0x3162f9,JSON[_0x9e59('0x16')](_0x3d002f));_0x1ba8f9(_0x3d002f);})[_0x9e59('0x1a')](function(_0xced2df){logger[_0x9e59('0x17')](_0x9e59('0x1b'),_0xced2df[_0x9e59('0x19')],_0x3162f9);_0x52022d(_0x48fa20[_0x9e59('0x17')](0x1f4,_0xced2df[_0x9e59('0x19')]));});});}; \ No newline at end of file +var _0x7e02=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','include','map','model','lodash'];(function(_0x365f73,_0x1d093a){var _0x580730=function(_0x3f6201){while(--_0x3f6201){_0x365f73['push'](_0x365f73['shift']());}};_0x580730(++_0x1d093a);}(_0x7e02,0x71));var _0x27e0=function(_0x4ed32c,_0x58bd5b){_0x4ed32c=_0x4ed32c-0x0;var _0x230703=_0x7e02[_0x4ed32c];return _0x230703;};'use strict';var _=require(_0x27e0('0x0'));var util=require(_0x27e0('0x1'));var moment=require(_0x27e0('0x2'));var BPromise=require(_0x27e0('0x3'));var rs=require(_0x27e0('0x4'));var fs=require('fs');var Redis=require(_0x27e0('0x5'));var db=require(_0x27e0('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x27e0('0x7'));var config=require('../../config/environment');var jayson=require(_0x27e0('0x8'));var client=jayson[_0x27e0('0x9')][_0x27e0('0xa')]({'port':0x232a});config[_0x27e0('0xb')]=_[_0x27e0('0xc')](config[_0x27e0('0xb')],{'host':_0x27e0('0xd'),'port':0x18eb});var socket=require(_0x27e0('0xe'))(new Redis(config['redis']));require(_0x27e0('0xf'))['register'](socket);function respondWithRpcPromise(_0xa5a2fd,_0x1d7413,_0x480486){return new BPromise(function(_0x17f18d,_0xbf3ce5){return client[_0x27e0('0x10')](_0xa5a2fd,_0x480486)[_0x27e0('0x11')](function(_0x12db7d){logger[_0x27e0('0x12')](_0x27e0('0x13'),_0x1d7413,_0x27e0('0x14'));logger[_0x27e0('0x15')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x1d7413,_0x27e0('0x14'),JSON[_0x27e0('0x16')](_0x12db7d));if(_0x12db7d[_0x27e0('0x17')]){if(_0x12db7d['error'][_0x27e0('0x18')]===0x1f4){logger[_0x27e0('0x17')](_0x27e0('0x13'),_0x1d7413,_0x12db7d['error'][_0x27e0('0x19')]);return _0xbf3ce5(_0x12db7d[_0x27e0('0x17')][_0x27e0('0x19')]);}logger[_0x27e0('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x1d7413,_0x12db7d['error'][_0x27e0('0x19')]);return _0x17f18d(_0x12db7d[_0x27e0('0x17')][_0x27e0('0x19')]);}else{logger[_0x27e0('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x1d7413,_0x27e0('0x14'));_0x17f18d(_0x12db7d[_0x27e0('0x1a')][_0x27e0('0x19')]);}})[_0x27e0('0x1b')](function(_0x608e4f){logger[_0x27e0('0x17')]('VoiceExtension,\x20%s,\x20%s',_0x1d7413,_0x608e4f);_0xbf3ce5(_0x608e4f);});});}exports[_0x27e0('0x1c')]=function(_0x445a53){var _0x58ede5=this;return new Promise(function(_0x1908d1,_0x23df66){return db[_0x27e0('0x1d')][_0x27e0('0x1e')]({'raw':_0x445a53[_0x27e0('0x1f')]?_0x445a53['options']['raw']===undefined?!![]:![]:!![],'where':_0x445a53['options']?_0x445a53[_0x27e0('0x1f')][_0x27e0('0x20')]||null:null,'attributes':_0x445a53['options']?_0x445a53[_0x27e0('0x1f')][_0x27e0('0x21')]||null:null,'limit':_0x445a53[_0x27e0('0x1f')]?_0x445a53[_0x27e0('0x1f')][_0x27e0('0x22')]||null:null,'include':_0x445a53[_0x27e0('0x1f')]?_0x445a53[_0x27e0('0x1f')][_0x27e0('0x23')]?_[_0x27e0('0x24')](_0x445a53[_0x27e0('0x1f')][_0x27e0('0x23')],function(_0x27dc43){return{'model':db[_0x27dc43[_0x27e0('0x25')]],'as':_0x27dc43['as'],'attributes':_0x27dc43[_0x27e0('0x21')],'include':_0x27dc43[_0x27e0('0x23')]?_['map'](_0x27dc43[_0x27e0('0x23')],function(_0x44b237){return{'model':db[_0x44b237[_0x27e0('0x25')]],'as':_0x44b237['as'],'attributes':_0x44b237[_0x27e0('0x21')],'include':_0x44b237[_0x27e0('0x23')]?_['map'](_0x44b237['include'],function(_0x29114d){return{'model':db[_0x29114d[_0x27e0('0x25')]],'as':_0x29114d['as'],'attributes':_0x29114d[_0x27e0('0x21')]};}):[]};}):[]};}):[]:[]})[_0x27e0('0x11')](function(_0x57bcc1){logger['info'](_0x27e0('0x1c'),_0x445a53);logger[_0x27e0('0x15')]('GetVoiceExtension',_0x445a53,JSON['stringify'](_0x57bcc1));_0x1908d1(_0x57bcc1);})['catch'](function(_0xdedb73){logger[_0x27e0('0x17')](_0x27e0('0x1c'),_0xdedb73[_0x27e0('0x19')],_0x445a53);_0x23df66(_0x58ede5['error'](0x1f4,_0xdedb73[_0x27e0('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index f2950b2..b8b2b8a 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 _0xabce=['voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x19431f,_0x5762fe){var _0x1a514c=function(_0x1cfab1){while(--_0x1cfab1){_0x19431f['push'](_0x19431f['shift']());}};_0x1a514c(++_0x5762fe);}(_0xabce,0x103));var _0xeabc=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xabce[_0x3de8a4];return _0x4635cf;};'use strict';var VoiceExtensionEvents=require(_0xeabc('0x0'));var events=[_0xeabc('0x1'),_0xeabc('0x2'),_0xeabc('0x3')];function createListener(_0x49dbcc,_0x5bd1a4){return function(_0x5ebc95){_0x5bd1a4[_0xeabc('0x4')](_0x49dbcc,_0x5ebc95);};}function removeListener(_0x1d9f37,_0x1a88a7){return function(){VoiceExtensionEvents['removeListener'](_0x1d9f37,_0x1a88a7);};}exports['register']=function(_0x1b07a8){for(var _0x52a4d7=0x0,_0x229ba4=events['length'];_0x52a4d7<_0x229ba4;_0x52a4d7++){var _0x3bdc29=events[_0x52a4d7];var _0x9417af=createListener(_0xeabc('0x5')+_0x3bdc29,_0x1b07a8);VoiceExtensionEvents['on'](_0x3bdc29,_0x9417af);}}; \ No newline at end of file +var _0x1cb9=['update','emit','removeListener','register','length','./voiceExtension.events','remove'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x1cb9,0x14e));var _0x91cb=function(_0xcc3785,_0x5c2c90){_0xcc3785=_0xcc3785-0x0;var _0x30f852=_0x1cb9[_0xcc3785];return _0x30f852;};'use strict';var VoiceExtensionEvents=require(_0x91cb('0x0'));var events=['save',_0x91cb('0x1'),_0x91cb('0x2')];function createListener(_0x2b1894,_0x351bdb){return function(_0x57ea48){_0x351bdb[_0x91cb('0x3')](_0x2b1894,_0x57ea48);};}function removeListener(_0x2b7314,_0x5652cd){return function(){VoiceExtensionEvents[_0x91cb('0x4')](_0x2b7314,_0x5652cd);};}exports[_0x91cb('0x5')]=function(_0x186dc3){for(var _0x28543e=0x0,_0x3b9d98=events[_0x91cb('0x6')];_0x28543e<_0x3b9d98;_0x28543e++){var _0x4c1f56=events[_0x28543e];var _0x15c517=createListener('voiceExtension:'+_0x4c1f56,_0x186dc3);VoiceExtensionEvents['on'](_0x4c1f56,_0x15c517);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index d6333ac..779bdda 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 _0x2d72=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','create','put','update','exports'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0x2d72,0xa8));var _0x22d7=function(_0x26c847,_0x4bd445){_0x26c847=_0x26c847-0x0;var _0x4ab9c2=_0x2d72[_0x26c847];return _0x4ab9c2;};'use strict';var multer=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var path=require(_0x22d7('0x2'));var timeout=require(_0x22d7('0x3'));var express=require(_0x22d7('0x4'));var router=express[_0x22d7('0x5')]();var fs_extra=require(_0x22d7('0x6'));var auth=require(_0x22d7('0x7'));var interaction=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var controller=require(_0x22d7('0xa'));router[_0x22d7('0xb')]('/',auth[_0x22d7('0xc')](),controller[_0x22d7('0xd')]);router['get'](_0x22d7('0xe'),auth[_0x22d7('0xc')](),controller['show']);router[_0x22d7('0xb')](_0x22d7('0xf'),auth[_0x22d7('0xc')](),controller[_0x22d7('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x22d7('0x11')]);router[_0x22d7('0x12')](_0x22d7('0xe'),auth[_0x22d7('0xc')](),controller[_0x22d7('0x13')]);router['delete']('/:id',auth[_0x22d7('0xc')](),controller['destroy']);module[_0x22d7('0x14')]=router; \ No newline at end of file +var _0xcaf2=['create','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','/:id','show','/:id/messages','getMessages','post'];(function(_0x1d24e9,_0x2e7d3c){var _0x4288f7=function(_0x31faab){while(--_0x31faab){_0x1d24e9['push'](_0x1d24e9['shift']());}};_0x4288f7(++_0x2e7d3c);}(_0xcaf2,0x8a));var _0x2caf=function(_0x2ac71a,_0x1d2a02){_0x2ac71a=_0x2ac71a-0x0;var _0x3ee904=_0xcaf2[_0x2ac71a];return _0x3ee904;};'use strict';var multer=require(_0x2caf('0x0'));var util=require('util');var path=require(_0x2caf('0x1'));var timeout=require(_0x2caf('0x2'));var express=require('express');var router=express[_0x2caf('0x3')]();var fs_extra=require(_0x2caf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2caf('0x5'));var config=require('../../config/environment');var controller=require(_0x2caf('0x6'));router[_0x2caf('0x7')]('/',auth[_0x2caf('0x8')](),controller['index']);router[_0x2caf('0x7')](_0x2caf('0x9'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xa')]);router['get'](_0x2caf('0xb'),auth[_0x2caf('0x8')](),controller[_0x2caf('0xc')]);router[_0x2caf('0xd')]('/',auth[_0x2caf('0x8')](),controller[_0x2caf('0xe')]);router[_0x2caf('0xf')](_0x2caf('0x9'),auth[_0x2caf('0x8')](),controller['update']);router[_0x2caf('0x10')](_0x2caf('0x9'),auth[_0x2caf('0x8')](),controller[_0x2caf('0x11')]);module[_0x2caf('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index f34d859..5804c8c 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 _0x0692=['trim','ENUM','yes','TINYINT(4)','TIMESTAMP','VIRTUAL','getDataValue','fullname','mailbox','sequelize','STRING','contest_mailbox','setDataValue','email','string'];(function(_0x1d8174,_0x3c39be){var _0x33fb92=function(_0xd174db){while(--_0xd174db){_0x1d8174['push'](_0x1d8174['shift']());}};_0x33fb92(++_0x3c39be);}(_0x0692,0x1da));var _0x2069=function(_0x1ddaf9,_0x67e0ba){_0x1ddaf9=_0x1ddaf9-0x0;var _0x202f68=_0x0692[_0x1ddaf9];return _0x202f68;};'use strict';var Sequelize=require(_0x2069('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0x2069('0x1')]},'context':{'type':Sequelize[_0x2069('0x1')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x2069('0x2')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x2069('0x1')]},'email':{'type':Sequelize[_0x2069('0x1')],'validate':{'isEmail':!![]},'set':function(_0x3e6106){this[_0x2069('0x3')](_0x2069('0x4'),typeof _0x3e6106===_0x2069('0x5')&&_0x3e6106[_0x2069('0x6')]()?_0x3e6106[_0x2069('0x6')]():null);}},'pager':{'type':Sequelize[_0x2069('0x1')]},'tz':{'type':Sequelize[_0x2069('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0x2069('0x7')](_0x2069('0x8'),'no'),'defaultValue':_0x2069('0x8'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x2069('0x8'),'no'),'defaultValue':_0x2069('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x2069('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x2069('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x2069('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x2069('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x2069('0x7')](_0x2069('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x2069('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x2069('0x7')](_0x2069('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x2069('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x2069('0x7')](_0x2069('0x8'),'no'),'defaultValue':_0x2069('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x2069('0x7')](_0x2069('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x2069('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x2069('0xa')},'emailsubject':{'type':Sequelize[_0x2069('0x1')]},'emailbody':{'type':Sequelize[_0x2069('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x2069('0xb')],'get':function(){return this[_0x2069('0xc')](_0x2069('0xd'))+'\x20-\x20'+this[_0x2069('0xc')](_0x2069('0xe'));}}}; \ No newline at end of file +var _0x53ec=['sequelize','exports','STRING','from-voicemail','contest_mailbox','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','getDataValue','fullname','\x20-\x20','mailbox'];(function(_0x7cdb45,_0x4fafdc){var _0x2b28fc=function(_0x2bc8ac){while(--_0x2bc8ac){_0x7cdb45['push'](_0x7cdb45['shift']());}};_0x2b28fc(++_0x4fafdc);}(_0x53ec,0xdd));var _0xc53e=function(_0x141352,_0x5aa338){_0x141352=_0x141352-0x0;var _0x3d8110=_0x53ec[_0x141352];return _0x3d8110;};'use strict';var Sequelize=require(_0xc53e('0x0'));module[_0xc53e('0x1')]={'customer_id':{'type':Sequelize[_0xc53e('0x2')]},'context':{'type':Sequelize[_0xc53e('0x2')],'defaultValue':_0xc53e('0x3'),'unique':_0xc53e('0x4')},'mailbox':{'type':Sequelize[_0xc53e('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xc53e('0x2')]},'fullname':{'type':Sequelize[_0xc53e('0x2')]},'email':{'type':Sequelize[_0xc53e('0x2')],'validate':{'isEmail':!![]},'set':function(_0x4240e1){this['setDataValue'](_0xc53e('0x5'),typeof _0x4240e1===_0xc53e('0x6')&&_0x4240e1[_0xc53e('0x7')]()?_0x4240e1[_0xc53e('0x7')]():null);}},'pager':{'type':Sequelize[_0xc53e('0x2')]},'tz':{'type':Sequelize[_0xc53e('0x2')],'defaultValue':_0xc53e('0x8')},'attach':{'type':Sequelize[_0xc53e('0x9')](_0xc53e('0xa'),'no'),'defaultValue':_0xc53e('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xc53e('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xc53e('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xc53e('0x9')](_0xc53e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xc53e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xc53e('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xc53e('0x9')](_0xc53e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xc53e('0x9')](_0xc53e('0xa'),'no'),'defaultValue':_0xc53e('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xc53e('0x9')](_0xc53e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xc53e('0x9')](_0xc53e('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xc53e('0xa'),'no'),'defaultValue':_0xc53e('0xa'),'allowNull':![]},'stamp':{'type':_0xc53e('0xc')},'emailsubject':{'type':Sequelize[_0xc53e('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xc53e('0xd')](_0xc53e('0xe'))+_0xc53e('0xf')+this[_0xc53e('0xd')](_0xc53e('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 78199f2..c7444dd 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 _0xd8b0=['find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','findOne','VoiceMailMessage','rawAttributes','nolimit','order','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','Voicemails','error','name','index','VoiceMail','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','params','options'];(function(_0x40a93b,_0x1fa962){var _0x514a07=function(_0x1ce1f2){while(--_0x1ce1f2){_0x40a93b['push'](_0x40a93b['shift']());}};_0x514a07(++_0x1fa962);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){var _0x27b695=_0x2c64e2['get']({'plain':!![]});var _0xe8bbee=_0x0d8b('0x26');return db['UserProfileResource'][_0x0d8b('0x25')]({'where':{'type':_0xe8bbee,'resourceId':_0x27b695['id']}})['then'](function(){return _0x2c64e2;});})[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)[_0x0d8b('0x1a')]();});}};}function handleEntityNotFound(_0x4fe6f9,_0x59a905){return function(_0x28f639){if(!_0x28f639){_0x4fe6f9[_0x0d8b('0x18')](0x194);}return _0x28f639;};}function handleError(_0x4c05ee,_0xcbc4ac){_0xcbc4ac=_0xcbc4ac||0x1f4;return function(_0x59aa83){logger[_0x0d8b('0x27')](_0x59aa83['stack']);if(_0x59aa83[_0x0d8b('0x28')]){delete _0x59aa83['name'];}_0x4c05ee[_0x0d8b('0x19')](_0xcbc4ac)['send'](_0x59aa83);};}exports[_0x0d8b('0x29')]=function(_0x544735,_0x3c8887){var _0x106e4c={},_0x2c058d={},_0x56120a={'count':0x0,'rows':[]};var _0x4c80a2=_['map'](db[_0x0d8b('0x2a')]['rawAttributes'],function(_0x3cdf3c){return{'name':_0x3cdf3c['fieldName'],'type':_0x3cdf3c['type'][_0x0d8b('0x2b')]};});_0x2c058d[_0x0d8b('0x2c')]=_[_0x0d8b('0x2d')](_0x4c80a2,_0x0d8b('0x28'));_0x2c058d[_0x0d8b('0x2e')]=_[_0x0d8b('0x2f')](_0x544735[_0x0d8b('0x2e')]);_0x2c058d[_0x0d8b('0x30')]=_['intersection'](_0x2c058d[_0x0d8b('0x2c')],_0x2c058d[_0x0d8b('0x2e')]);_0x106e4c['attributes']=_[_0x0d8b('0x31')](_0x2c058d[_0x0d8b('0x2c')],qs[_0x0d8b('0x32')](_0x544735['query'][_0x0d8b('0x32')]));_0x106e4c[_0x0d8b('0x33')]=_0x106e4c[_0x0d8b('0x33')][_0x0d8b('0x34')]?_0x106e4c[_0x0d8b('0x33')]:_0x2c058d['model'];if(!_0x544735[_0x0d8b('0x2e')][_0x0d8b('0x35')]('nolimit')){_0x106e4c[_0x0d8b('0x36')]=qs[_0x0d8b('0x36')](_0x544735[_0x0d8b('0x2e')][_0x0d8b('0x36')]);_0x106e4c[_0x0d8b('0x1c')]=qs['offset'](_0x544735['query'][_0x0d8b('0x1c')]);}_0x106e4c['order']=qs['sort'](_0x544735[_0x0d8b('0x2e')][_0x0d8b('0x37')]);_0x106e4c[_0x0d8b('0x38')]=qs[_0x0d8b('0x30')](_[_0x0d8b('0x39')](_0x544735[_0x0d8b('0x2e')],_0x2c058d['filters']),_0x4c80a2);if(_0x544735[_0x0d8b('0x2e')][_0x0d8b('0x3a')]){_0x106e4c[_0x0d8b('0x38')]=_[_0x0d8b('0x3b')](_0x106e4c[_0x0d8b('0x38')],{'$or':_[_0x0d8b('0x2d')](_0x4c80a2,function(_0xf1680e){if(_0xf1680e['type']!==_0x0d8b('0x3c')){var _0x34acb5={};_0x34acb5[_0xf1680e[_0x0d8b('0x28')]]={'$like':'%'+_0x544735[_0x0d8b('0x2e')]['filter']+'%'};return _0x34acb5;}})});}_0x106e4c=_[_0x0d8b('0x3b')]({},_0x106e4c,_0x544735['options']);var _0x37b26c={'where':_0x106e4c[_0x0d8b('0x38')]};return db[_0x0d8b('0x2a')][_0x0d8b('0x1e')](_0x37b26c)[_0x0d8b('0x24')](function(_0x3e632e){_0x56120a[_0x0d8b('0x1e')]=_0x3e632e;if(_0x544735[_0x0d8b('0x2e')][_0x0d8b('0x3d')]){_0x106e4c[_0x0d8b('0x3e')]=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x106e4c);})['then'](function(_0x4d0811){_0x56120a['rows']=_0x4d0811;return _0x56120a;})[_0x0d8b('0x24')](respondWithFilteredResult(_0x3c8887,_0x106e4c))[_0x0d8b('0x3f')](handleError(_0x3c8887,null));};exports[_0x0d8b('0x40')]=function(_0x5100cf,_0x4a76a3){var _0x1b216d={'raw':!![],'where':{'id':_0x5100cf[_0x0d8b('0x41')]['id']}},_0x192de1={};_0x192de1['model']=_[_0x0d8b('0x2f')](db[_0x0d8b('0x2a')]['rawAttributes']);_0x192de1['query']=_[_0x0d8b('0x2f')](_0x5100cf['query']);_0x192de1[_0x0d8b('0x30')]=_['intersection'](_0x192de1['model'],_0x192de1[_0x0d8b('0x2e')]);_0x1b216d[_0x0d8b('0x33')]=_['intersection'](_0x192de1['model'],qs['fields'](_0x5100cf['query'][_0x0d8b('0x32')]));_0x1b216d[_0x0d8b('0x33')]=_0x1b216d[_0x0d8b('0x33')]['length']?_0x1b216d[_0x0d8b('0x33')]:_0x192de1[_0x0d8b('0x2c')];if(_0x5100cf[_0x0d8b('0x2e')][_0x0d8b('0x3d')]){_0x1b216d[_0x0d8b('0x3e')]=[{'all':!![]}];}_0x1b216d=_[_0x0d8b('0x3b')]({},_0x1b216d,_0x5100cf[_0x0d8b('0x42')]);return db[_0x0d8b('0x2a')][_0x0d8b('0x43')](_0x1b216d)[_0x0d8b('0x24')](handleEntityNotFound(_0x4a76a3,null))[_0x0d8b('0x24')](respondWithResult(_0x4a76a3,null))[_0x0d8b('0x3f')](handleError(_0x4a76a3,null));};exports[_0x0d8b('0x44')]=function(_0x3e569b,_0x570af8){return db[_0x0d8b('0x2a')][_0x0d8b('0x44')](_0x3e569b[_0x0d8b('0x45')],{})[_0x0d8b('0x24')](function(_0x574b90){var _0x371fa0=_0x3e569b['user']['get']({'plain':!![]});if(!_0x371fa0)throw new Error(_0x0d8b('0x46'));if(_0x371fa0[_0x0d8b('0x47')]===_0x0d8b('0x48')){var _0x4396b5=_0x574b90['get']({'plain':!![]});var _0x131579=_0x0d8b('0x26');return db[_0x0d8b('0x49')][_0x0d8b('0x43')]({'where':{'name':_0x131579,'userProfileId':_0x371fa0[_0x0d8b('0x4a')]},'raw':!![]})['then'](function(_0x5c0824){if(_0x5c0824&&_0x5c0824['autoAssociation']===0x0){return db['UserProfileResource'][_0x0d8b('0x44')]({'name':_0x4396b5[_0x0d8b('0x28')],'resourceId':_0x4396b5['id'],'type':_0x5c0824['name'],'sectionId':_0x5c0824['id']},{})['then'](function(){return _0x574b90;});}else{return _0x574b90;}})[_0x0d8b('0x3f')](function(_0x3d3cb6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d3cb6);throw _0x3d3cb6;});}return _0x574b90;})[_0x0d8b('0x24')](respondWithResult(_0x570af8,0xc9))[_0x0d8b('0x3f')](handleError(_0x570af8,null));};exports[_0x0d8b('0x23')]=function(_0x346c0d,_0x2d5519){if(_0x346c0d['body']['id']){delete _0x346c0d[_0x0d8b('0x45')]['id'];}return db[_0x0d8b('0x2a')]['find']({'where':{'id':_0x346c0d['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x2d5519,null))[_0x0d8b('0x24')](saveUpdates(_0x346c0d['body'],null))['then'](respondWithResult(_0x2d5519,null))[_0x0d8b('0x3f')](handleError(_0x2d5519,null));};exports[_0x0d8b('0x25')]=function(_0x377027,_0xb58818){return db['VoiceMail'][_0x0d8b('0x43')]({'where':{'id':_0x377027['params']['id']}})['then'](handleEntityNotFound(_0xb58818,null))[_0x0d8b('0x24')](removeEntity(_0xb58818,null))[_0x0d8b('0x3f')](handleError(_0xb58818,null));};exports['getMessages']=function(_0x4a8f33,_0x44ed23,_0x3d7161){return db[_0x0d8b('0x2a')][_0x0d8b('0x4b')]({'where':{'id':_0x4a8f33[_0x0d8b('0x41')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x44ed23,null))[_0x0d8b('0x24')](function(_0x3bead7){var _0x5418d8;var _0x24a859={},_0x37dc9f={};_0x37dc9f[_0x0d8b('0x2c')]=_[_0x0d8b('0x2f')](db[_0x0d8b('0x4c')][_0x0d8b('0x4d')]);_0x37dc9f[_0x0d8b('0x2e')]=_[_0x0d8b('0x2f')](_0x4a8f33[_0x0d8b('0x2e')]);_0x37dc9f['filters']=_[_0x0d8b('0x31')](_0x37dc9f[_0x0d8b('0x2c')],_0x37dc9f[_0x0d8b('0x2e')]);_0x24a859[_0x0d8b('0x33')]=_[_0x0d8b('0x31')](_0x37dc9f['model'],qs[_0x0d8b('0x32')](_0x4a8f33[_0x0d8b('0x2e')][_0x0d8b('0x32')]));_0x24a859[_0x0d8b('0x33')]=_0x24a859[_0x0d8b('0x33')]['length']?_0x24a859['attributes']:_0x37dc9f[_0x0d8b('0x2c')];if(!_0x4a8f33[_0x0d8b('0x2e')][_0x0d8b('0x35')](_0x0d8b('0x4e'))){_0x24a859['limit']=qs[_0x0d8b('0x36')](_0x4a8f33[_0x0d8b('0x2e')][_0x0d8b('0x36')]);_0x24a859['offset']=qs[_0x0d8b('0x1c')](_0x4a8f33['query'][_0x0d8b('0x1c')]);}_0x24a859[_0x0d8b('0x4f')]=qs[_0x0d8b('0x37')](_0x4a8f33[_0x0d8b('0x2e')][_0x0d8b('0x37')]);_0x24a859[_0x0d8b('0x38')]=qs['filters'](_[_0x0d8b('0x39')](_0x4a8f33['query'],_0x37dc9f[_0x0d8b('0x30')]));if(_0x4a8f33[_0x0d8b('0x2e')][_0x0d8b('0x3a')]){_0x24a859[_0x0d8b('0x38')]=_['merge'](_0x24a859[_0x0d8b('0x38')],{'$or':_[_0x0d8b('0x2d')](_0x24a859[_0x0d8b('0x33')],function(_0x2332fc){var _0x2ccdae={};_0x2ccdae[_0x2332fc]={'$like':'%'+_0x4a8f33[_0x0d8b('0x2e')][_0x0d8b('0x3a')]+'%'};return _0x2ccdae;})});}_0x24a859[_0x0d8b('0x38')]=_[_0x0d8b('0x3b')](_0x24a859[_0x0d8b('0x38')],{'mailboxuser':_0x3bead7['mailbox']});_0x24a859=_['merge']({},_0x24a859,_0x4a8f33[_0x0d8b('0x42')]);return db[_0x0d8b('0x4c')]['findAndCountAll'](_0x24a859)[_0x0d8b('0x24')](respondWithFilteredResult(_0x44ed23,_0x24a859));})['catch'](handleError(_0x44ed23,null));}; \ No newline at end of file +var _0x3266=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','nolimit','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','set','Content-Range','save','update','then','destroy','get','error','stack','name','send','index','VoiceMail','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','length','find'];(function(_0x1132ac,_0x3e5150){var _0x291b6e=function(_0x50fc53){while(--_0x50fc53){_0x1132ac['push'](_0x1132ac['shift']());}};_0x291b6e(++_0x3e5150);}(_0x3266,0x6a));var _0x6326=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x3266[_0x1573ea];return _0x51c0e2;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];function respondWithStatusCode(_0x379358,_0x5c07e1){_0x5c07e1=_0x5c07e1||0xcc;return function(_0x5381d0){if(_0x5381d0){return _0x379358[_0x6326('0x1c')](_0x5c07e1);}return _0x379358[_0x6326('0x1d')](_0x5c07e1)['end']();};}function respondWithResult(_0x425878,_0x4caef3){_0x4caef3=_0x4caef3||0xc8;return function(_0x2d2d9b){if(_0x2d2d9b){return _0x425878[_0x6326('0x1d')](_0x4caef3)[_0x6326('0x1e')](_0x2d2d9b);}};}function respondWithFilteredResult(_0x41c352,_0x1ed3a3){return function(_0x2c1879){if(_0x2c1879){var _0x55923a=typeof _0x1ed3a3[_0x6326('0x1f')]==='undefined'&&typeof _0x1ed3a3['limit']==='undefined';var _0x51e7b9=_0x2c1879['count'];var _0x58e960=_0x55923a?0x0:_0x1ed3a3[_0x6326('0x1f')];var _0x1f4c11=_0x55923a?_0x2c1879[_0x6326('0x20')]:_0x1ed3a3['offset']+_0x1ed3a3['limit'];var _0x954ed5;if(_0x1f4c11>=_0x51e7b9){_0x1f4c11=_0x51e7b9;_0x954ed5=0xc8;}else{_0x954ed5=0xce;}_0x41c352[_0x6326('0x1d')](_0x954ed5);return _0x41c352[_0x6326('0x21')](_0x6326('0x22'),_0x58e960+'-'+_0x1f4c11+'/'+_0x51e7b9)[_0x6326('0x1e')](_0x2c1879);}return null;};}function patchUpdates(_0x25957a){return function(_0x21ee7d){try{jsonpatch['apply'](_0x21ee7d,_0x25957a,!![]);}catch(_0x22307f){return BPromise['reject'](_0x22307f);}return _0x21ee7d[_0x6326('0x23')]();};}function saveUpdates(_0x3c6cfa,_0x2482ef){return function(_0x24fb78){if(_0x24fb78){return _0x24fb78[_0x6326('0x24')](_0x3c6cfa)[_0x6326('0x25')](function(_0x225555){return _0x225555;});}return null;};}function removeEntity(_0x429bb0,_0x4781cc){return function(_0x2d0d00){if(_0x2d0d00){return _0x2d0d00[_0x6326('0x26')]()['then'](function(){var _0x72d020=_0x2d0d00[_0x6326('0x27')]({'plain':!![]});var _0x575701='Voicemails';return db['UserProfileResource'][_0x6326('0x26')]({'where':{'type':_0x575701,'resourceId':_0x72d020['id']}})['then'](function(){return _0x2d0d00;});})[_0x6326('0x25')](function(){_0x429bb0[_0x6326('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15e33d,_0x21ec69){return function(_0xb68fec){if(!_0xb68fec){_0x15e33d[_0x6326('0x1c')](0x194);}return _0xb68fec;};}function handleError(_0x2d2180,_0x45d037){_0x45d037=_0x45d037||0x1f4;return function(_0x40e036){logger[_0x6326('0x28')](_0x40e036[_0x6326('0x29')]);if(_0x40e036[_0x6326('0x2a')]){delete _0x40e036[_0x6326('0x2a')];}_0x2d2180[_0x6326('0x1d')](_0x45d037)[_0x6326('0x2b')](_0x40e036);};}exports[_0x6326('0x2c')]=function(_0x2e0445,_0x20c5ab){var _0x520e57={},_0x2bf5ef={},_0x47303c={'count':0x0,'rows':[]};var _0x1f8982=_['map'](db[_0x6326('0x2d')]['rawAttributes'],function(_0x4e703a){return{'name':_0x4e703a[_0x6326('0x2e')],'type':_0x4e703a[_0x6326('0x2f')][_0x6326('0x30')]};});_0x2bf5ef[_0x6326('0x31')]=_[_0x6326('0x32')](_0x1f8982,_0x6326('0x2a'));_0x2bf5ef[_0x6326('0x33')]=_[_0x6326('0x34')](_0x2e0445[_0x6326('0x33')]);_0x2bf5ef[_0x6326('0x35')]=_[_0x6326('0x36')](_0x2bf5ef[_0x6326('0x31')],_0x2bf5ef['query']);_0x520e57[_0x6326('0x37')]=_[_0x6326('0x36')](_0x2bf5ef['model'],qs[_0x6326('0x38')](_0x2e0445[_0x6326('0x33')][_0x6326('0x38')]));_0x520e57['attributes']=_0x520e57[_0x6326('0x37')]['length']?_0x520e57['attributes']:_0x2bf5ef[_0x6326('0x31')];if(!_0x2e0445[_0x6326('0x33')][_0x6326('0x39')]('nolimit')){_0x520e57[_0x6326('0x3a')]=qs['limit'](_0x2e0445[_0x6326('0x33')]['limit']);_0x520e57[_0x6326('0x1f')]=qs[_0x6326('0x1f')](_0x2e0445[_0x6326('0x33')][_0x6326('0x1f')]);}_0x520e57[_0x6326('0x3b')]=qs[_0x6326('0x3c')](_0x2e0445['query'][_0x6326('0x3c')]);_0x520e57[_0x6326('0x3d')]=qs['filters'](_[_0x6326('0x3e')](_0x2e0445['query'],_0x2bf5ef['filters']),_0x1f8982);if(_0x2e0445[_0x6326('0x33')][_0x6326('0x3f')]){_0x520e57[_0x6326('0x3d')]=_[_0x6326('0x40')](_0x520e57[_0x6326('0x3d')],{'$or':_[_0x6326('0x32')](_0x1f8982,function(_0x5de1c3){if(_0x5de1c3['type']!==_0x6326('0x41')){var _0x5b68af={};_0x5b68af[_0x5de1c3[_0x6326('0x2a')]]={'$like':'%'+_0x2e0445['query'][_0x6326('0x3f')]+'%'};return _0x5b68af;}})});}_0x520e57=_[_0x6326('0x40')]({},_0x520e57,_0x2e0445[_0x6326('0x42')]);var _0x1da798={'where':_0x520e57[_0x6326('0x3d')]};return db[_0x6326('0x2d')][_0x6326('0x20')](_0x1da798)[_0x6326('0x25')](function(_0x3b089b){_0x47303c[_0x6326('0x20')]=_0x3b089b;if(_0x2e0445[_0x6326('0x33')]['includeAll']){_0x520e57[_0x6326('0x43')]=[{'all':!![]}];}return db['VoiceMail'][_0x6326('0x44')](_0x520e57);})[_0x6326('0x25')](function(_0x16fc33){_0x47303c[_0x6326('0x45')]=_0x16fc33;return _0x47303c;})['then'](respondWithFilteredResult(_0x20c5ab,_0x520e57))[_0x6326('0x46')](handleError(_0x20c5ab,null));};exports[_0x6326('0x47')]=function(_0x562d5f,_0x12703d){var _0xe6a992={'raw':!![],'where':{'id':_0x562d5f[_0x6326('0x48')]['id']}},_0x7a5057={};_0x7a5057['model']=_[_0x6326('0x34')](db[_0x6326('0x2d')][_0x6326('0x49')]);_0x7a5057[_0x6326('0x33')]=_[_0x6326('0x34')](_0x562d5f[_0x6326('0x33')]);_0x7a5057[_0x6326('0x35')]=_['intersection'](_0x7a5057[_0x6326('0x31')],_0x7a5057[_0x6326('0x33')]);_0xe6a992[_0x6326('0x37')]=_[_0x6326('0x36')](_0x7a5057['model'],qs[_0x6326('0x38')](_0x562d5f['query'][_0x6326('0x38')]));_0xe6a992[_0x6326('0x37')]=_0xe6a992[_0x6326('0x37')][_0x6326('0x4a')]?_0xe6a992[_0x6326('0x37')]:_0x7a5057['model'];if(_0x562d5f[_0x6326('0x33')]['includeAll']){_0xe6a992['include']=[{'all':!![]}];}_0xe6a992=_[_0x6326('0x40')]({},_0xe6a992,_0x562d5f[_0x6326('0x42')]);return db['VoiceMail'][_0x6326('0x4b')](_0xe6a992)[_0x6326('0x25')](handleEntityNotFound(_0x12703d,null))[_0x6326('0x25')](respondWithResult(_0x12703d,null))[_0x6326('0x46')](handleError(_0x12703d,null));};exports[_0x6326('0x4c')]=function(_0x4f8dc0,_0x4af0ee){return db[_0x6326('0x2d')][_0x6326('0x4c')](_0x4f8dc0[_0x6326('0x4d')],{})[_0x6326('0x25')](function(_0x210a1b){var _0x318d19=_0x4f8dc0[_0x6326('0x4e')]['get']({'plain':!![]});if(!_0x318d19)throw new Error(_0x6326('0x4f'));if(_0x318d19[_0x6326('0x50')]===_0x6326('0x4e')){var _0x3e7674=_0x210a1b[_0x6326('0x27')]({'plain':!![]});var _0x4ff8e6=_0x6326('0x51');return db['UserProfileSection'][_0x6326('0x4b')]({'where':{'name':_0x4ff8e6,'userProfileId':_0x318d19[_0x6326('0x52')]},'raw':!![]})['then'](function(_0x37b045){if(_0x37b045&&_0x37b045['autoAssociation']===0x0){return db[_0x6326('0x53')][_0x6326('0x4c')]({'name':_0x3e7674[_0x6326('0x2a')],'resourceId':_0x3e7674['id'],'type':_0x37b045[_0x6326('0x2a')],'sectionId':_0x37b045['id']},{})['then'](function(){return _0x210a1b;});}else{return _0x210a1b;}})[_0x6326('0x46')](function(_0xbe6b3e){logger['error'](_0x6326('0x54'),_0xbe6b3e);throw _0xbe6b3e;});}return _0x210a1b;})[_0x6326('0x25')](respondWithResult(_0x4af0ee,0xc9))[_0x6326('0x46')](handleError(_0x4af0ee,null));};exports['update']=function(_0x2bece1,_0x2ac64b){if(_0x2bece1['body']['id']){delete _0x2bece1[_0x6326('0x4d')]['id'];}return db['VoiceMail'][_0x6326('0x4b')]({'where':{'id':_0x2bece1[_0x6326('0x48')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x2ac64b,null))[_0x6326('0x25')](saveUpdates(_0x2bece1[_0x6326('0x4d')],null))[_0x6326('0x25')](respondWithResult(_0x2ac64b,null))[_0x6326('0x46')](handleError(_0x2ac64b,null));};exports['destroy']=function(_0x51adce,_0x4d4de7){return db[_0x6326('0x2d')]['find']({'where':{'id':_0x51adce[_0x6326('0x48')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x4d4de7,null))[_0x6326('0x25')](removeEntity(_0x4d4de7,null))[_0x6326('0x46')](handleError(_0x4d4de7,null));};exports[_0x6326('0x55')]=function(_0x4b5bc6,_0x23bf64,_0x2e4244){return db['VoiceMail'][_0x6326('0x56')]({'where':{'id':_0x4b5bc6[_0x6326('0x48')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x23bf64,null))[_0x6326('0x25')](function(_0x45e3d5){var _0x36f2f5;var _0x320d43={},_0x2f624f={};_0x2f624f[_0x6326('0x31')]=_[_0x6326('0x34')](db['VoiceMailMessage'][_0x6326('0x49')]);_0x2f624f[_0x6326('0x33')]=_[_0x6326('0x34')](_0x4b5bc6[_0x6326('0x33')]);_0x2f624f['filters']=_['intersection'](_0x2f624f[_0x6326('0x31')],_0x2f624f[_0x6326('0x33')]);_0x320d43[_0x6326('0x37')]=_[_0x6326('0x36')](_0x2f624f[_0x6326('0x31')],qs['fields'](_0x4b5bc6['query'][_0x6326('0x38')]));_0x320d43[_0x6326('0x37')]=_0x320d43[_0x6326('0x37')][_0x6326('0x4a')]?_0x320d43['attributes']:_0x2f624f[_0x6326('0x31')];if(!_0x4b5bc6[_0x6326('0x33')][_0x6326('0x39')](_0x6326('0x57'))){_0x320d43[_0x6326('0x3a')]=qs[_0x6326('0x3a')](_0x4b5bc6['query'][_0x6326('0x3a')]);_0x320d43['offset']=qs[_0x6326('0x1f')](_0x4b5bc6[_0x6326('0x33')]['offset']);}_0x320d43[_0x6326('0x3b')]=qs[_0x6326('0x3c')](_0x4b5bc6[_0x6326('0x33')][_0x6326('0x3c')]);_0x320d43[_0x6326('0x3d')]=qs[_0x6326('0x35')](_[_0x6326('0x3e')](_0x4b5bc6[_0x6326('0x33')],_0x2f624f[_0x6326('0x35')]));if(_0x4b5bc6[_0x6326('0x33')]['filter']){_0x320d43[_0x6326('0x3d')]=_[_0x6326('0x40')](_0x320d43[_0x6326('0x3d')],{'$or':_[_0x6326('0x32')](_0x320d43[_0x6326('0x37')],function(_0x5599da){var _0x299795={};_0x299795[_0x5599da]={'$like':'%'+_0x4b5bc6[_0x6326('0x33')][_0x6326('0x3f')]+'%'};return _0x299795;})});}_0x320d43[_0x6326('0x3d')]=_[_0x6326('0x40')](_0x320d43['where'],{'mailboxuser':_0x45e3d5[_0x6326('0x58')]});_0x320d43=_['merge']({},_0x320d43,_0x4b5bc6['options']);return db[_0x6326('0x59')][_0x6326('0x5a')](_0x320d43)[_0x6326('0x25')](respondWithFilteredResult(_0x23bf64,_0x320d43));})[_0x6326('0x46')](handleError(_0x23bf64,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 88b7b84..83543c1 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 _0x66bf=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','mailbox_context','mailbox','context','lodash','util','../../config/logger'];(function(_0x49b7dc,_0x357f74){var _0x1ab8a5=function(_0x154613){while(--_0x154613){_0x49b7dc['push'](_0x49b7dc['shift']());}};_0x1ab8a5(++_0x357f74);}(_0x66bf,0xad));var _0xf66b=function(_0x1cb825,_0x909dc6){_0x1cb825=_0x1cb825-0x0;var _0x596088=_0x66bf[_0x1cb825];return _0x596088;};'use strict';var _=require(_0xf66b('0x0'));var util=require(_0xf66b('0x1'));var logger=require(_0xf66b('0x2'))(_0xf66b('0x3'));var moment=require(_0xf66b('0x4'));var BPromise=require(_0xf66b('0x5'));var rp=require(_0xf66b('0x6'));var fs=require('fs');var path=require(_0xf66b('0x7'));var rimraf=require(_0xf66b('0x8'));var config=require(_0xf66b('0x9'));var attributes=require(_0xf66b('0xa'));module[_0xf66b('0xb')]=function(_0x47ffac,_0x37bd4a){return _0x47ffac[_0xf66b('0xc')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xf66b('0xd'),'fields':[_0xf66b('0xe'),_0xf66b('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x731a=['mailbox','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x359d4e,_0x322ca9){var _0x109165=function(_0x5dbc54){while(--_0x5dbc54){_0x359d4e['push'](_0x359d4e['shift']());}};_0x109165(++_0x322ca9);}(_0x731a,0x12d));var _0xa731=function(_0x5d2ed9,_0x16c436){_0x5d2ed9=_0x5d2ed9-0x0;var _0x4262c5=_0x731a[_0x5d2ed9];return _0x4262c5;};'use strict';var _=require(_0xa731('0x0'));var util=require(_0xa731('0x1'));var logger=require('../../config/logger')(_0xa731('0x2'));var moment=require(_0xa731('0x3'));var BPromise=require(_0xa731('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa731('0x5'));var rimraf=require(_0xa731('0x6'));var config=require(_0xa731('0x7'));var attributes=require(_0xa731('0x8'));module[_0xa731('0x9')]=function(_0x1f1410,_0x1d48e5){return _0x1f1410[_0xa731('0xa')](_0xa731('0xb'),attributes,{'tableName':_0xa731('0xc'),'paranoid':![],'indexes':[{'name':_0xa731('0xd'),'fields':[_0xa731('0xe'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index f5dca52..298fed9 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 _0x5ede=['lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','code','error','VoiceMail,\x20%s,\x20%s','message','result'];(function(_0x100a35,_0x3d1535){var _0x461ff=function(_0x47f48d){while(--_0x47f48d){_0x100a35['push'](_0x100a35['shift']());}};_0x461ff(++_0x3d1535);}(_0x5ede,0x1f4));var _0xe5ed=function(_0x10d075,_0x3dcc11){_0x10d075=_0x10d075-0x0;var _0x3d02a8=_0x5ede[_0x10d075];return _0x3d02a8;};'use strict';var _=require(_0xe5ed('0x0'));var util=require(_0xe5ed('0x1'));var moment=require(_0xe5ed('0x2'));var BPromise=require(_0xe5ed('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5ed('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe5ed('0x5'));var logger=require('../../config/logger')(_0xe5ed('0x6'));var config=require('../../config/environment');var jayson=require(_0xe5ed('0x7'));var client=jayson[_0xe5ed('0x8')][_0xe5ed('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52080d,_0x5409a0,_0x4f66c8){return new BPromise(function(_0x3ed024,_0x5b88fd){return client[_0xe5ed('0xa')](_0x52080d,_0x4f66c8)[_0xe5ed('0xb')](function(_0xd02d3f){logger[_0xe5ed('0xc')]('VoiceMail,\x20%s,\x20%s',_0x5409a0,_0xe5ed('0xd'));logger[_0xe5ed('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x5409a0,_0xe5ed('0xd'),JSON['stringify'](_0xd02d3f));if(_0xd02d3f['error']){if(_0xd02d3f['error'][_0xe5ed('0xf')]===0x1f4){logger[_0xe5ed('0x10')](_0xe5ed('0x11'),_0x5409a0,_0xd02d3f[_0xe5ed('0x10')][_0xe5ed('0x12')]);return _0x5b88fd(_0xd02d3f[_0xe5ed('0x10')][_0xe5ed('0x12')]);}logger[_0xe5ed('0x10')]('VoiceMail,\x20%s,\x20%s',_0x5409a0,_0xd02d3f[_0xe5ed('0x10')][_0xe5ed('0x12')]);return _0x3ed024(_0xd02d3f[_0xe5ed('0x10')][_0xe5ed('0x12')]);}else{logger[_0xe5ed('0xc')]('VoiceMail,\x20%s,\x20%s',_0x5409a0,_0xe5ed('0xd'));_0x3ed024(_0xd02d3f[_0xe5ed('0x13')][_0xe5ed('0x12')]);}})['catch'](function(_0x5138fb){logger[_0xe5ed('0x10')]('VoiceMail,\x20%s,\x20%s',_0x5409a0,_0x5138fb);_0x5b88fd(_0x5138fb);});});} \ No newline at end of file +var _0x2a5d=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird'];(function(_0x3474da,_0x2895e9){var _0x3842c7=function(_0x23e1f5){while(--_0x23e1f5){_0x3474da['push'](_0x3474da['shift']());}};_0x3842c7(++_0x2895e9);}(_0x2a5d,0xa5));var _0xd2a5=function(_0x1bd323,_0x1c16ab){_0x1bd323=_0x1bd323-0x0;var _0x13097b=_0x2a5d[_0x1bd323];return _0x13097b;};'use strict';var _=require(_0xd2a5('0x0'));var util=require(_0xd2a5('0x1'));var moment=require('moment');var BPromise=require(_0xd2a5('0x2'));var rs=require(_0xd2a5('0x3'));var fs=require('fs');var Redis=require(_0xd2a5('0x4'));var db=require(_0xd2a5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd2a5('0x6'))(_0xd2a5('0x7'));var config=require(_0xd2a5('0x8'));var jayson=require(_0xd2a5('0x9'));var client=jayson[_0xd2a5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4763ea,_0x3fa047,_0x19f580){return new BPromise(function(_0x44b900,_0x4b9d20){return client['request'](_0x4763ea,_0x19f580)[_0xd2a5('0xb')](function(_0x2eaac7){logger[_0xd2a5('0xc')]('VoiceMail,\x20%s,\x20%s',_0x3fa047,_0xd2a5('0xd'));logger[_0xd2a5('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x3fa047,_0xd2a5('0xd'),JSON['stringify'](_0x2eaac7));if(_0x2eaac7[_0xd2a5('0xf')]){if(_0x2eaac7[_0xd2a5('0xf')][_0xd2a5('0x10')]===0x1f4){logger[_0xd2a5('0xf')](_0xd2a5('0x11'),_0x3fa047,_0x2eaac7['error'][_0xd2a5('0x12')]);return _0x4b9d20(_0x2eaac7['error']['message']);}logger[_0xd2a5('0xf')](_0xd2a5('0x11'),_0x3fa047,_0x2eaac7[_0xd2a5('0xf')][_0xd2a5('0x12')]);return _0x44b900(_0x2eaac7[_0xd2a5('0xf')][_0xd2a5('0x12')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x3fa047,'request\x20sent');_0x44b900(_0x2eaac7[_0xd2a5('0x13')]['message']);}})[_0xd2a5('0x14')](function(_0x6d5771){logger[_0xd2a5('0xf')](_0xd2a5('0x11'),_0x3fa047,_0x6d5771);_0x4b9d20(_0x6d5771);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 4dd3b2f..5e95303 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 _0x6902=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','put','delete','destroy'];(function(_0x1ebf9f,_0x25ffcb){var _0x117e9c=function(_0x36824c){while(--_0x36824c){_0x1ebf9f['push'](_0x1ebf9f['shift']());}};_0x117e9c(++_0x25ffcb);}(_0x6902,0xd3));var _0x2690=function(_0xe4bd87,_0xc7aeb3){_0xe4bd87=_0xe4bd87-0x0;var _0x4b6634=_0x6902[_0xe4bd87];return _0x4b6634;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2690('0x0'));var timeout=require(_0x2690('0x1'));var express=require(_0x2690('0x2'));var router=express[_0x2690('0x3')]();var fs_extra=require(_0x2690('0x4'));var auth=require(_0x2690('0x5'));var interaction=require(_0x2690('0x6'));var config=require(_0x2690('0x7'));var controller=require(_0x2690('0x8'));router[_0x2690('0x9')]('/',auth[_0x2690('0xa')](),controller[_0x2690('0xb')]);router[_0x2690('0x9')](_0x2690('0xc'),auth[_0x2690('0xa')](),controller[_0x2690('0xd')]);router[_0x2690('0x9')](_0x2690('0xe'),auth['isAuthenticated'](),controller[_0x2690('0xf')]);router[_0x2690('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2690('0x11')](_0x2690('0xc'),auth[_0x2690('0xa')](),controller['update']);router[_0x2690('0x12')](_0x2690('0xc'),auth[_0x2690('0xa')](),controller[_0x2690('0x13')]);module[_0x2690('0x14')]=router; \ No newline at end of file +var _0x8b03=['../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','get','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x2b633b,_0x31ecb4){var _0xf23aaa=function(_0x396353){while(--_0x396353){_0x2b633b['push'](_0x2b633b['shift']());}};_0xf23aaa(++_0x31ecb4);}(_0x8b03,0xf2));var _0x38b0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8b03[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x38b0('0x0'));var util=require(_0x38b0('0x1'));var path=require('path');var timeout=require(_0x38b0('0x2'));var express=require(_0x38b0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x38b0('0x4'));var interaction=require(_0x38b0('0x5'));var config=require(_0x38b0('0x6'));var controller=require(_0x38b0('0x7'));router['get']('/',auth[_0x38b0('0x8')](),controller['index']);router[_0x38b0('0x9')](_0x38b0('0xa'),auth['isAuthenticated'](),controller[_0x38b0('0xb')]);router['get'](_0x38b0('0xc'),auth[_0x38b0('0x8')](),controller[_0x38b0('0xd')]);router['post']('/',auth[_0x38b0('0x8')](),controller[_0x38b0('0xe')]);router[_0x38b0('0xf')]('/:id',auth[_0x38b0('0x8')](),controller[_0x38b0('0x10')]);router[_0x38b0('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x38b0('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 8fb659c..aaab182 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 _0x6543=['long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','exports','VIRTUAL','INTEGER','STRING','BLOB'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6543,0x67));var _0x3654=function(_0x216c1a,_0x143016){_0x216c1a=_0x216c1a-0x0;var _0x4fe434=_0x6543[_0x216c1a];return _0x4fe434;};'use strict';var Sequelize=require('sequelize');module[_0x3654('0x0')]={'name':{'type':Sequelize[_0x3654('0x1')],'get':function(_0x3c26ee){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x3654('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x3654('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x3654('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x3654('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x3654('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x3654('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x3654('0x4')](_0x3654('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x3654('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x3654('0x3')],'defaultValue':''},'stamp':{'type':_0x3654('0x6'),'defaultValue':Sequelize[_0x3654('0x7')](_0x3654('0x8'))}}; \ No newline at end of file +var _0x8a64=['INTEGER','STRING','BLOB','long','TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x946193,_0x5162c6){var _0x450ab7=function(_0x3fe723){while(--_0x3fe723){_0x946193['push'](_0x946193['shift']());}};_0x450ab7(++_0x5162c6);}(_0x8a64,0xb0));var _0x48a6=function(_0xe131f1,_0x3f3fee){_0xe131f1=_0xe131f1-0x0;var _0x1fb8f8=_0x8a64[_0xe131f1];return _0x1fb8f8;};'use strict';var Sequelize=require(_0x48a6('0x0'));module[_0x48a6('0x1')]={'name':{'type':Sequelize[_0x48a6('0x2')],'get':function(_0x85c364){return this[_0x48a6('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x48a6('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x48a6('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x48a6('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x48a6('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x48a6('0x5')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x48a6('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x48a6('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x48a6('0x6')](_0x48a6('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x48a6('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x48a6('0x5')],'defaultValue':''},'stamp':{'type':_0x48a6('0x8'),'defaultValue':Sequelize['literal']('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 f36da7e..868fd9e 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 _0x375a=['audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','rows','show','params','find','catch','create','body','destroy','download','msg_id','recording','ValidationError','VoiceMailMessage\x20not\x20found'];(function(_0x4e428f,_0x2f2bb6){var _0x42bf97=function(_0x133510){while(--_0x133510){_0x4e428f['push'](_0x4e428f['shift']());}};_0x42bf97(++_0x2f2bb6);}(_0x375a,0xfa));var _0xa375=function(_0x193609,_0x1a2a6f){_0x193609=_0x193609-0x0;var _0x33278c=_0x375a[_0x193609];return _0x33278c;};'use strict';var emlformat=require(_0xa375('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa375('0x1'));var jsonpatch=require(_0xa375('0x2'));var rp=require(_0xa375('0x3'));var moment=require(_0xa375('0x4'));var BPromise=require(_0xa375('0x5'));var Mustache=require(_0xa375('0x6'));var util=require(_0xa375('0x7'));var path=require('path');var sox=require(_0xa375('0x8'));var csv=require(_0xa375('0x9'));var ejs=require(_0xa375('0xa'));var fs=require('fs');var fs_extra=require(_0xa375('0xb'));var _=require('lodash');var squel=require(_0xa375('0xc'));var crypto=require(_0xa375('0xd'));var jsforce=require(_0xa375('0xe'));var deskjs=require(_0xa375('0xf'));var toCsv=require(_0xa375('0x9'));var querystring=require(_0xa375('0x10'));var Papa=require(_0xa375('0x11'));var Redis=require('ioredis');var authService=require(_0xa375('0x12'));var qs=require(_0xa375('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa375('0x14'))(_0xa375('0x15'));var utils=require(_0xa375('0x16'));var config=require(_0xa375('0x17'));var licenseUtil=require(_0xa375('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cb634,_0x1a2a78){_0x1a2a78=_0x1a2a78||0xcc;return function(_0x2e7f2b){if(_0x2e7f2b){return _0x1cb634[_0xa375('0x19')](_0x1a2a78);}return _0x1cb634[_0xa375('0x1a')](_0x1a2a78)[_0xa375('0x1b')]();};}function respondWithResult(_0x4484ce,_0x32b91e){_0x32b91e=_0x32b91e||0xc8;return function(_0x172c4b){if(_0x172c4b){return _0x4484ce[_0xa375('0x1a')](_0x32b91e)[_0xa375('0x1c')](_0x172c4b);}};}function respondWithFilteredResult(_0x15d3fc,_0x5b578c){return function(_0x4979e7){if(_0x4979e7){var _0x3f4521=typeof _0x5b578c[_0xa375('0x1d')]===_0xa375('0x1e')&&typeof _0x5b578c[_0xa375('0x1f')]==='undefined';var _0x343af9=_0x4979e7[_0xa375('0x20')];var _0x34de7f=_0x3f4521?0x0:_0x5b578c['offset'];var _0x2c59a7=_0x3f4521?_0x4979e7['count']:_0x5b578c['offset']+_0x5b578c['limit'];var _0x4169f6;if(_0x2c59a7>=_0x343af9){_0x2c59a7=_0x343af9;_0x4169f6=0xc8;}else{_0x4169f6=0xce;}_0x15d3fc[_0xa375('0x1a')](_0x4169f6);return _0x15d3fc[_0xa375('0x21')](_0xa375('0x22'),_0x34de7f+'-'+_0x2c59a7+'/'+_0x343af9)[_0xa375('0x1c')](_0x4979e7);}return null;};}function patchUpdates(_0x5e002d){return function(_0x41262d){try{jsonpatch[_0xa375('0x23')](_0x41262d,_0x5e002d,!![]);}catch(_0x2e9796){return BPromise[_0xa375('0x24')](_0x2e9796);}return _0x41262d[_0xa375('0x25')]();};}function saveUpdates(_0xe844b3,_0x59ae10){return function(_0x4fe578){if(_0x4fe578){return _0x4fe578[_0xa375('0x26')](_0xe844b3)[_0xa375('0x27')](function(_0x48ad42){return _0x48ad42;});}return null;};}function removeEntity(_0x5bb376,_0x3c9e6b){return function(_0x45470c){if(_0x45470c){return _0x45470c['destroy']()[_0xa375('0x27')](function(){_0x5bb376['status'](0xcc)[_0xa375('0x1b')]();});}};}function handleEntityNotFound(_0x4b2c16,_0x205abf){return function(_0x334439){if(!_0x334439){_0x4b2c16[_0xa375('0x19')](0x194);}return _0x334439;};}function handleError(_0x45c85e,_0x31d22e){_0x31d22e=_0x31d22e||0x1f4;return function(_0x3f1c4b){logger[_0xa375('0x28')](_0x3f1c4b[_0xa375('0x29')]);if(_0x3f1c4b[_0xa375('0x2a')]){delete _0x3f1c4b['name'];}_0x45c85e['status'](_0x31d22e)[_0xa375('0x2b')](_0x3f1c4b);};}exports[_0xa375('0x2c')]=function(_0x3cb1f4,_0x58c53d){var _0x39ee62={},_0x1697a7={},_0x3e74fb={'count':0x0,'rows':[]};var _0x333827=_[_0xa375('0x2d')](db[_0xa375('0x2e')][_0xa375('0x2f')],function(_0x2b7a62){return{'name':_0x2b7a62[_0xa375('0x30')],'type':_0x2b7a62['type']['key']};});_0x1697a7[_0xa375('0x31')]=_['differenceBy'](_['map'](_0x333827,'name'),['name']);_0x1697a7['query']=_[_0xa375('0x32')](_0x3cb1f4['query']);_0x1697a7[_0xa375('0x33')]=_['intersection'](_0x1697a7[_0xa375('0x31')],_0x1697a7[_0xa375('0x34')]);_0x39ee62[_0xa375('0x35')]=_[_0xa375('0x36')](_0x1697a7[_0xa375('0x31')],qs[_0xa375('0x37')](_0x3cb1f4[_0xa375('0x34')][_0xa375('0x37')]));_0x39ee62[_0xa375('0x35')]=_0x39ee62[_0xa375('0x35')][_0xa375('0x38')]?_0x39ee62[_0xa375('0x35')]:_0x1697a7[_0xa375('0x31')];if(!_0x3cb1f4[_0xa375('0x34')][_0xa375('0x39')]('nolimit')){_0x39ee62['limit']=qs[_0xa375('0x1f')](_0x3cb1f4[_0xa375('0x34')][_0xa375('0x1f')]);_0x39ee62[_0xa375('0x1d')]=qs[_0xa375('0x1d')](_0x3cb1f4[_0xa375('0x34')][_0xa375('0x1d')]);}_0x39ee62[_0xa375('0x3a')]=qs[_0xa375('0x3b')](_0x3cb1f4[_0xa375('0x34')]['sort']);_0x39ee62[_0xa375('0x3c')]=qs[_0xa375('0x33')](_[_0xa375('0x3d')](_0x3cb1f4[_0xa375('0x34')],_0x1697a7['filters']),_0x333827);if(_0x3cb1f4[_0xa375('0x34')][_0xa375('0x3e')]){_0x39ee62[_0xa375('0x3c')]=_[_0xa375('0x3f')](_0x39ee62[_0xa375('0x3c')],{'$or':_[_0xa375('0x2d')](_0x333827,function(_0x2b899d){if(_0x2b899d['type']!=='VIRTUAL'){var _0x5f251a={};_0x5f251a[_0x2b899d[_0xa375('0x2a')]]={'$like':'%'+_0x3cb1f4[_0xa375('0x34')]['filter']+'%'};return _0x5f251a;}})});}_0x39ee62=_[_0xa375('0x3f')]({},_0x39ee62,_0x3cb1f4['options']);var _0x1db146={'where':_0x39ee62['where']};return db[_0xa375('0x2e')][_0xa375('0x20')](_0x1db146)[_0xa375('0x27')](function(_0x4cea86){_0x3e74fb['count']=_0x4cea86;if(_0x3cb1f4['query'][_0xa375('0x40')]){_0x39ee62['include']=[{'all':!![]}];}return db[_0xa375('0x2e')]['findAll'](_0x39ee62);})[_0xa375('0x27')](function(_0x4c436d){_0x3e74fb[_0xa375('0x41')]=_0x4c436d;return _0x3e74fb;})[_0xa375('0x27')](respondWithFilteredResult(_0x58c53d,_0x39ee62))['catch'](handleError(_0x58c53d,null));};exports[_0xa375('0x42')]=function(_0x5f3e02,_0x2783a7){var _0x3e71c4={'raw':!![],'where':{'id':_0x5f3e02[_0xa375('0x43')]['id']}},_0x4132d5={};_0x4132d5['model']=_['keys'](db[_0xa375('0x2e')][_0xa375('0x2f')]);_0x4132d5[_0xa375('0x34')]=_[_0xa375('0x32')](_0x5f3e02['query']);_0x4132d5['filters']=_[_0xa375('0x36')](_0x4132d5['model'],_0x4132d5[_0xa375('0x34')]);_0x3e71c4['attributes']=_['intersection'](_0x4132d5[_0xa375('0x31')],qs[_0xa375('0x37')](_0x5f3e02[_0xa375('0x34')][_0xa375('0x37')]));_0x3e71c4[_0xa375('0x35')]=_0x3e71c4[_0xa375('0x35')]['length']?_0x3e71c4['attributes']:_0x4132d5[_0xa375('0x31')];if(_0x5f3e02[_0xa375('0x34')][_0xa375('0x40')]){_0x3e71c4['include']=[{'all':!![]}];}_0x3e71c4=_['merge']({},_0x3e71c4,_0x5f3e02['options']);return db[_0xa375('0x2e')][_0xa375('0x44')](_0x3e71c4)[_0xa375('0x27')](handleEntityNotFound(_0x2783a7,null))[_0xa375('0x27')](respondWithResult(_0x2783a7,null))[_0xa375('0x45')](handleError(_0x2783a7,null));};exports[_0xa375('0x46')]=function(_0x1d9fb3,_0x391102){return db['VoiceMailMessage'][_0xa375('0x46')](_0x1d9fb3[_0xa375('0x47')],{})[_0xa375('0x27')](respondWithResult(_0x391102,0xc9))[_0xa375('0x45')](handleError(_0x391102,null));};exports[_0xa375('0x26')]=function(_0x4026fe,_0x461e89){if(_0x4026fe[_0xa375('0x47')]['id']){delete _0x4026fe[_0xa375('0x47')]['id'];}return db['VoiceMailMessage'][_0xa375('0x44')]({'where':{'id':_0x4026fe[_0xa375('0x43')]['id']}})[_0xa375('0x27')](handleEntityNotFound(_0x461e89,null))[_0xa375('0x27')](saveUpdates(_0x4026fe[_0xa375('0x47')],null))[_0xa375('0x27')](respondWithResult(_0x461e89,null))['catch'](handleError(_0x461e89,null));};exports[_0xa375('0x48')]=function(_0x5f178d,_0x1ffb88){return db[_0xa375('0x2e')][_0xa375('0x44')]({'where':{'id':_0x5f178d[_0xa375('0x43')]['id']}})[_0xa375('0x27')](handleEntityNotFound(_0x1ffb88,null))['then'](removeEntity(_0x1ffb88,null))[_0xa375('0x45')](handleError(_0x1ffb88,null));};exports[_0xa375('0x49')]=function(_0x283b63,_0x30aa7c,_0x3a10e0){return db[_0xa375('0x2e')][_0xa375('0x44')]({'where':{'id':_0x283b63[_0xa375('0x43')]['id']},'attributes':['id','recording',_0xa375('0x4a')]})[_0xa375('0x27')](handleEntityNotFound(_0x30aa7c,null))[_0xa375('0x27')](function(_0x82ad9e){if(_0x82ad9e){if(!_0x82ad9e[_0xa375('0x4b')]){throw new db['Sequelize'][(_0xa375('0x4c'))](_0xa375('0x4d'));}var _0x3d94a6={'Content-Type':_0xa375('0x4e'),'Content-Disposition':_0xa375('0x4f')};if(_0x82ad9e[_0xa375('0x4a')]){_0x3d94a6['Content-Disposition']=_0xa375('0x50')+_0x82ad9e['msg_id']+_0xa375('0x51');}_0x30aa7c[_0xa375('0x21')](_0x3d94a6);return _0x30aa7c[_0xa375('0x2b')](new Buffer(_0x82ad9e['recording']));}})['catch'](handleError(_0x30aa7c,null));}; \ No newline at end of file +var _0x9bfe=['order','sort','pick','filter','where','VIRTUAL','options','includeAll','rows','catch','show','params','include','create','body','find','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','attachment;\x20filename=\x22','.wav\x22','eml-format','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','sendStatus','error','name','index','map','VoiceMailMessage','rawAttributes','fieldName','type','model','differenceBy','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x3a5e36,_0x498090){var _0x45f6db=function(_0x7eb6f3){while(--_0x7eb6f3){_0x3a5e36['push'](_0x3a5e36['shift']());}};_0x45f6db(++_0x498090);}(_0x9bfe,0x19a));var _0xe9bf=function(_0x4ba32a,_0x15d2a8){_0x4ba32a=_0x4ba32a-0x0;var _0x4b055e=_0x9bfe[_0x4ba32a];return _0x4b055e;};'use strict';var emlformat=require(_0xe9bf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe9bf('0x1'));var BPromise=require(_0xe9bf('0x2'));var Mustache=require(_0xe9bf('0x3'));var util=require(_0xe9bf('0x4'));var path=require(_0xe9bf('0x5'));var sox=require('sox');var csv=require(_0xe9bf('0x6'));var ejs=require(_0xe9bf('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9bf('0x8'));var squel=require(_0xe9bf('0x9'));var crypto=require('crypto');var jsforce=require(_0xe9bf('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe9bf('0xb'));var Papa=require('papaparse');var Redis=require(_0xe9bf('0xc'));var authService=require(_0xe9bf('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9bf('0xe'));var logger=require(_0xe9bf('0xf'))(_0xe9bf('0x10'));var utils=require(_0xe9bf('0x11'));var config=require(_0xe9bf('0x12'));var licenseUtil=require(_0xe9bf('0x13'));var db=require(_0xe9bf('0x14'))['db'];function respondWithStatusCode(_0x3ee827,_0x48ae11){_0x48ae11=_0x48ae11||0xcc;return function(_0x1b6643){if(_0x1b6643){return _0x3ee827['sendStatus'](_0x48ae11);}return _0x3ee827[_0xe9bf('0x15')](_0x48ae11)[_0xe9bf('0x16')]();};}function respondWithResult(_0x114dcb,_0x61d5ff){_0x61d5ff=_0x61d5ff||0xc8;return function(_0x35b2e4){if(_0x35b2e4){return _0x114dcb[_0xe9bf('0x15')](_0x61d5ff)[_0xe9bf('0x17')](_0x35b2e4);}};}function respondWithFilteredResult(_0x38f3d4,_0x1e9b7f){return function(_0x1421f0){if(_0x1421f0){var _0x5cc9a5=typeof _0x1e9b7f['offset']==='undefined'&&typeof _0x1e9b7f['limit']==='undefined';var _0x5267f7=_0x1421f0[_0xe9bf('0x18')];var _0x3f6f80=_0x5cc9a5?0x0:_0x1e9b7f[_0xe9bf('0x19')];var _0x38c7ec=_0x5cc9a5?_0x1421f0['count']:_0x1e9b7f['offset']+_0x1e9b7f[_0xe9bf('0x1a')];var _0x384b52;if(_0x38c7ec>=_0x5267f7){_0x38c7ec=_0x5267f7;_0x384b52=0xc8;}else{_0x384b52=0xce;}_0x38f3d4[_0xe9bf('0x15')](_0x384b52);return _0x38f3d4[_0xe9bf('0x1b')](_0xe9bf('0x1c'),_0x3f6f80+'-'+_0x38c7ec+'/'+_0x5267f7)[_0xe9bf('0x17')](_0x1421f0);}return null;};}function patchUpdates(_0x19c59a){return function(_0x34dc04){try{jsonpatch['apply'](_0x34dc04,_0x19c59a,!![]);}catch(_0x223e38){return BPromise[_0xe9bf('0x1d')](_0x223e38);}return _0x34dc04['save']();};}function saveUpdates(_0x147d75,_0x19157f){return function(_0x5879c5){if(_0x5879c5){return _0x5879c5[_0xe9bf('0x1e')](_0x147d75)[_0xe9bf('0x1f')](function(_0x35ebda){return _0x35ebda;});}return null;};}function removeEntity(_0xf64319,_0x97e18b){return function(_0x1e8cb8){if(_0x1e8cb8){return _0x1e8cb8[_0xe9bf('0x20')]()[_0xe9bf('0x1f')](function(){_0xf64319[_0xe9bf('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x512ef6,_0x441037){return function(_0xa9e057){if(!_0xa9e057){_0x512ef6[_0xe9bf('0x21')](0x194);}return _0xa9e057;};}function handleError(_0x555181,_0x5b1274){_0x5b1274=_0x5b1274||0x1f4;return function(_0x344b75){logger[_0xe9bf('0x22')](_0x344b75['stack']);if(_0x344b75[_0xe9bf('0x23')]){delete _0x344b75['name'];}_0x555181['status'](_0x5b1274)['send'](_0x344b75);};}exports[_0xe9bf('0x24')]=function(_0x5902fe,_0x33f5cf){var _0x397aa4={},_0x2033e0={},_0x351c8b={'count':0x0,'rows':[]};var _0x38677d=_[_0xe9bf('0x25')](db[_0xe9bf('0x26')][_0xe9bf('0x27')],function(_0x1e904e){return{'name':_0x1e904e[_0xe9bf('0x28')],'type':_0x1e904e[_0xe9bf('0x29')]['key']};});_0x2033e0[_0xe9bf('0x2a')]=_[_0xe9bf('0x2b')](_['map'](_0x38677d,_0xe9bf('0x23')),[_0xe9bf('0x23')]);_0x2033e0['query']=_[_0xe9bf('0x2c')](_0x5902fe[_0xe9bf('0x2d')]);_0x2033e0[_0xe9bf('0x2e')]=_['intersection'](_0x2033e0[_0xe9bf('0x2a')],_0x2033e0['query']);_0x397aa4[_0xe9bf('0x2f')]=_[_0xe9bf('0x30')](_0x2033e0['model'],qs['fields'](_0x5902fe[_0xe9bf('0x2d')][_0xe9bf('0x31')]));_0x397aa4[_0xe9bf('0x2f')]=_0x397aa4[_0xe9bf('0x2f')][_0xe9bf('0x32')]?_0x397aa4[_0xe9bf('0x2f')]:_0x2033e0[_0xe9bf('0x2a')];if(!_0x5902fe[_0xe9bf('0x2d')][_0xe9bf('0x33')]('nolimit')){_0x397aa4[_0xe9bf('0x1a')]=qs[_0xe9bf('0x1a')](_0x5902fe[_0xe9bf('0x2d')]['limit']);_0x397aa4[_0xe9bf('0x19')]=qs[_0xe9bf('0x19')](_0x5902fe['query'][_0xe9bf('0x19')]);}_0x397aa4[_0xe9bf('0x34')]=qs[_0xe9bf('0x35')](_0x5902fe['query']['sort']);_0x397aa4['where']=qs['filters'](_[_0xe9bf('0x36')](_0x5902fe[_0xe9bf('0x2d')],_0x2033e0[_0xe9bf('0x2e')]),_0x38677d);if(_0x5902fe[_0xe9bf('0x2d')][_0xe9bf('0x37')]){_0x397aa4[_0xe9bf('0x38')]=_['merge'](_0x397aa4[_0xe9bf('0x38')],{'$or':_[_0xe9bf('0x25')](_0x38677d,function(_0x70f19e){if(_0x70f19e[_0xe9bf('0x29')]!==_0xe9bf('0x39')){var _0x62f7b8={};_0x62f7b8[_0x70f19e[_0xe9bf('0x23')]]={'$like':'%'+_0x5902fe[_0xe9bf('0x2d')][_0xe9bf('0x37')]+'%'};return _0x62f7b8;}})});}_0x397aa4=_['merge']({},_0x397aa4,_0x5902fe[_0xe9bf('0x3a')]);var _0x34b7c1={'where':_0x397aa4[_0xe9bf('0x38')]};return db[_0xe9bf('0x26')][_0xe9bf('0x18')](_0x34b7c1)[_0xe9bf('0x1f')](function(_0x4faba2){_0x351c8b[_0xe9bf('0x18')]=_0x4faba2;if(_0x5902fe[_0xe9bf('0x2d')][_0xe9bf('0x3b')]){_0x397aa4['include']=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x397aa4);})['then'](function(_0x15453e){_0x351c8b[_0xe9bf('0x3c')]=_0x15453e;return _0x351c8b;})['then'](respondWithFilteredResult(_0x33f5cf,_0x397aa4))[_0xe9bf('0x3d')](handleError(_0x33f5cf,null));};exports[_0xe9bf('0x3e')]=function(_0x5c4e31,_0x243f23){var _0x477908={'raw':!![],'where':{'id':_0x5c4e31[_0xe9bf('0x3f')]['id']}},_0x32f771={};_0x32f771[_0xe9bf('0x2a')]=_[_0xe9bf('0x2c')](db[_0xe9bf('0x26')][_0xe9bf('0x27')]);_0x32f771[_0xe9bf('0x2d')]=_[_0xe9bf('0x2c')](_0x5c4e31[_0xe9bf('0x2d')]);_0x32f771['filters']=_['intersection'](_0x32f771['model'],_0x32f771[_0xe9bf('0x2d')]);_0x477908[_0xe9bf('0x2f')]=_[_0xe9bf('0x30')](_0x32f771['model'],qs[_0xe9bf('0x31')](_0x5c4e31[_0xe9bf('0x2d')]['fields']));_0x477908[_0xe9bf('0x2f')]=_0x477908[_0xe9bf('0x2f')][_0xe9bf('0x32')]?_0x477908[_0xe9bf('0x2f')]:_0x32f771[_0xe9bf('0x2a')];if(_0x5c4e31[_0xe9bf('0x2d')]['includeAll']){_0x477908[_0xe9bf('0x40')]=[{'all':!![]}];}_0x477908=_['merge']({},_0x477908,_0x5c4e31[_0xe9bf('0x3a')]);return db[_0xe9bf('0x26')]['find'](_0x477908)[_0xe9bf('0x1f')](handleEntityNotFound(_0x243f23,null))[_0xe9bf('0x1f')](respondWithResult(_0x243f23,null))[_0xe9bf('0x3d')](handleError(_0x243f23,null));};exports[_0xe9bf('0x41')]=function(_0x3a775f,_0x2ed92){return db['VoiceMailMessage'][_0xe9bf('0x41')](_0x3a775f['body'],{})[_0xe9bf('0x1f')](respondWithResult(_0x2ed92,0xc9))[_0xe9bf('0x3d')](handleError(_0x2ed92,null));};exports[_0xe9bf('0x1e')]=function(_0x5b2f0d,_0x4d2678){if(_0x5b2f0d[_0xe9bf('0x42')]['id']){delete _0x5b2f0d['body']['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x5b2f0d[_0xe9bf('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4d2678,null))[_0xe9bf('0x1f')](saveUpdates(_0x5b2f0d[_0xe9bf('0x42')],null))[_0xe9bf('0x1f')](respondWithResult(_0x4d2678,null))[_0xe9bf('0x3d')](handleError(_0x4d2678,null));};exports[_0xe9bf('0x20')]=function(_0x111deb,_0x19fbc0){return db[_0xe9bf('0x26')][_0xe9bf('0x43')]({'where':{'id':_0x111deb[_0xe9bf('0x3f')]['id']}})['then'](handleEntityNotFound(_0x19fbc0,null))[_0xe9bf('0x1f')](removeEntity(_0x19fbc0,null))[_0xe9bf('0x3d')](handleError(_0x19fbc0,null));};exports[_0xe9bf('0x44')]=function(_0x36bbb3,_0x47f491,_0x3d5e29){return db['VoiceMailMessage'][_0xe9bf('0x43')]({'where':{'id':_0x36bbb3[_0xe9bf('0x3f')]['id']},'attributes':['id',_0xe9bf('0x45'),_0xe9bf('0x46')]})[_0xe9bf('0x1f')](handleEntityNotFound(_0x47f491,null))[_0xe9bf('0x1f')](function(_0x42a4aa){if(_0x42a4aa){if(!_0x42a4aa[_0xe9bf('0x45')]){throw new db['Sequelize'][(_0xe9bf('0x47'))](_0xe9bf('0x48'));}var _0x4d6947={'Content-Type':_0xe9bf('0x49'),'Content-Disposition':_0xe9bf('0x4a')};if(_0x42a4aa['msg_id']){_0x4d6947['Content-Disposition']=_0xe9bf('0x4b')+_0x42a4aa['msg_id']+_0xe9bf('0x4c');}_0x47f491[_0xe9bf('0x1b')](_0x4d6947);return _0x47f491['send'](new Buffer(_0x42a4aa[_0xe9bf('0x45')]));}})['catch'](handleError(_0x47f491,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 65e481b..c52d62e 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 _0x5a9f=['../../config/logger','api','path','rimraf','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util'];(function(_0x301921,_0x10029f){var _0xd82511=function(_0x4f852b){while(--_0x4f852b){_0x301921['push'](_0x301921['shift']());}};_0xd82511(++_0x10029f);}(_0x5a9f,0x1d7));var _0xf5a9=function(_0x59b599,_0x31b773){_0x59b599=_0x59b599-0x0;var _0x45ee08=_0x5a9f[_0x59b599];return _0x45ee08;};'use strict';var _=require(_0xf5a9('0x0'));var util=require(_0xf5a9('0x1'));var logger=require(_0xf5a9('0x2'))(_0xf5a9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5a9('0x4'));var rimraf=require(_0xf5a9('0x5'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0xf5a9('0x6')]=function(_0x5eec7d,_0x2f3bc7){return _0x5eec7d[_0xf5a9('0x7')](_0xf5a9('0x8'),attributes,{'tableName':_0xf5a9('0x9'),'paranoid':![],'indexes':[{'name':_0xf5a9('0xa'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x0098=['exports','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./voiceMailMessage.attributes'];(function(_0x5ad655,_0x1742a7){var _0x27765a=function(_0x424cb7){while(--_0x424cb7){_0x5ad655['push'](_0x5ad655['shift']());}};_0x27765a(++_0x1742a7);}(_0x0098,0x88));var _0x8009=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x0098[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0x8009('0x0'));var util=require(_0x8009('0x1'));var logger=require(_0x8009('0x2'))('api');var moment=require(_0x8009('0x3'));var BPromise=require('bluebird');var rp=require(_0x8009('0x4'));var fs=require('fs');var path=require(_0x8009('0x5'));var rimraf=require('rimraf');var config=require(_0x8009('0x6'));var attributes=require(_0x8009('0x7'));module[_0x8009('0x8')]=function(_0x23af1b,_0x53cfcb){return _0x23af1b['define'](_0x8009('0x9'),attributes,{'tableName':_0x8009('0xa'),'paranoid':![],'indexes':[{'name':_0x8009('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 791a6e6..743ddad 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 _0x7f18=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7f18,0x7a));var _0x87f1=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x7f18[_0x158f01];return _0x5ef74e;};'use strict';var _=require(_0x87f1('0x0'));var util=require('util');var moment=require(_0x87f1('0x1'));var BPromise=require(_0x87f1('0x2'));var rs=require(_0x87f1('0x3'));var fs=require('fs');var Redis=require(_0x87f1('0x4'));var db=require(_0x87f1('0x5'))['db'];var utils=require(_0x87f1('0x6'));var logger=require(_0x87f1('0x7'))(_0x87f1('0x8'));var config=require(_0x87f1('0x9'));var jayson=require(_0x87f1('0xa'));var client=jayson[_0x87f1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41caf0,_0x227748,_0x54cb40){return new BPromise(function(_0x57cba6,_0x590c75){return client[_0x87f1('0xc')](_0x41caf0,_0x54cb40)[_0x87f1('0xd')](function(_0x30f3a7){logger[_0x87f1('0xe')](_0x87f1('0xf'),_0x227748,_0x87f1('0x10'));logger[_0x87f1('0x11')](_0x87f1('0x12'),_0x227748,_0x87f1('0x10'),JSON[_0x87f1('0x13')](_0x30f3a7));if(_0x30f3a7['error']){if(_0x30f3a7[_0x87f1('0x14')][_0x87f1('0x15')]===0x1f4){logger[_0x87f1('0x14')](_0x87f1('0xf'),_0x227748,_0x30f3a7[_0x87f1('0x14')]['message']);return _0x590c75(_0x30f3a7['error'][_0x87f1('0x16')]);}logger[_0x87f1('0x14')](_0x87f1('0xf'),_0x227748,_0x30f3a7[_0x87f1('0x14')][_0x87f1('0x16')]);return _0x57cba6(_0x30f3a7[_0x87f1('0x14')][_0x87f1('0x16')]);}else{logger[_0x87f1('0xe')](_0x87f1('0xf'),_0x227748,_0x87f1('0x10'));_0x57cba6(_0x30f3a7[_0x87f1('0x17')][_0x87f1('0x16')]);}})[_0x87f1('0x18')](function(_0x129deb){logger[_0x87f1('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x227748,_0x129deb);_0x590c75(_0x129deb);});});} \ No newline at end of file +var _0x95e3=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceMailMessage,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch'];(function(_0x5679cd,_0x545fe7){var _0xda32c4=function(_0x513287){while(--_0x513287){_0x5679cd['push'](_0x5679cd['shift']());}};_0xda32c4(++_0x545fe7);}(_0x95e3,0xbd));var _0x395e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x95e3[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x395e('0x0'));var moment=require(_0x395e('0x1'));var BPromise=require(_0x395e('0x2'));var rs=require(_0x395e('0x3'));var fs=require('fs');var Redis=require(_0x395e('0x4'));var db=require(_0x395e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x395e('0x6'))(_0x395e('0x7'));var config=require(_0x395e('0x8'));var jayson=require(_0x395e('0x9'));var client=jayson[_0x395e('0xa')][_0x395e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e5e43,_0x46e74c,_0x3208f4){return new BPromise(function(_0x46469c,_0x372b6d){return client[_0x395e('0xc')](_0x5e5e43,_0x3208f4)['then'](function(_0x472030){logger[_0x395e('0xd')](_0x395e('0xe'),_0x46e74c,'request\x20sent');logger[_0x395e('0xf')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x46e74c,_0x395e('0x10'),JSON['stringify'](_0x472030));if(_0x472030[_0x395e('0x11')]){if(_0x472030['error'][_0x395e('0x12')]===0x1f4){logger[_0x395e('0x11')](_0x395e('0xe'),_0x46e74c,_0x472030[_0x395e('0x11')]['message']);return _0x372b6d(_0x472030[_0x395e('0x11')][_0x395e('0x13')]);}logger[_0x395e('0x11')](_0x395e('0xe'),_0x46e74c,_0x472030[_0x395e('0x11')]['message']);return _0x46469c(_0x472030[_0x395e('0x11')][_0x395e('0x13')]);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x46e74c,_0x395e('0x10'));_0x46469c(_0x472030['result']['message']);}})[_0x395e('0x14')](function(_0x1b7dc5){logger[_0x395e('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x46e74c,_0x1b7dc5);_0x372b6d(_0x1b7dc5);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 5d02a92..f62dc03 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 _0x3a52=['index','show','/:id/sounds','isAuthenticated','getSounds','post','create','addSound','put','/:id','update','destroy','delete','/:id/sounds/:id2','removeSound','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get'];(function(_0x176ac3,_0x4734bb){var _0x249d65=function(_0x54123b){while(--_0x54123b){_0x176ac3['push'](_0x176ac3['shift']());}};_0x249d65(++_0x4734bb);}(_0x3a52,0x1b0));var _0x23a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3a52[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x23a5('0x0'));var util=require('util');var path=require(_0x23a5('0x1'));var timeout=require(_0x23a5('0x2'));var express=require(_0x23a5('0x3'));var router=express[_0x23a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x23a5('0x5'));var interaction=require(_0x23a5('0x6'));var config=require(_0x23a5('0x7'));var controller=require(_0x23a5('0x8'));router[_0x23a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x23a5('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x23a5('0xb')]);router[_0x23a5('0x9')](_0x23a5('0xc'),auth[_0x23a5('0xd')](),controller[_0x23a5('0xe')]);router[_0x23a5('0xf')]('/',auth[_0x23a5('0xd')](),controller[_0x23a5('0x10')]);router[_0x23a5('0xf')](_0x23a5('0xc'),auth[_0x23a5('0xd')](),controller[_0x23a5('0x11')]);router[_0x23a5('0x12')](_0x23a5('0x13'),auth['isAuthenticated'](),controller[_0x23a5('0x14')]);router['delete'](_0x23a5('0x13'),auth[_0x23a5('0xd')](),controller[_0x23a5('0x15')]);router[_0x23a5('0x16')](_0x23a5('0x17'),auth[_0x23a5('0xd')](),controller[_0x23a5('0x18')]);module[_0x23a5('0x19')]=router; \ No newline at end of file +var _0x6283=['/:id','destroy','removeSound','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id/sounds','getSounds','post','create','addSound','put'];(function(_0x2d3e99,_0x393d23){var _0x2ff451=function(_0x238221){while(--_0x238221){_0x2d3e99['push'](_0x2d3e99['shift']());}};_0x2ff451(++_0x393d23);}(_0x6283,0x11b));var _0x3628=function(_0x4e6d5f,_0x3b4507){_0x4e6d5f=_0x4e6d5f-0x0;var _0x2cea61=_0x6283[_0x4e6d5f];return _0x2cea61;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3628('0x0'));var express=require(_0x3628('0x1'));var router=express[_0x3628('0x2')]();var fs_extra=require(_0x3628('0x3'));var auth=require(_0x3628('0x4'));var interaction=require(_0x3628('0x5'));var config=require(_0x3628('0x6'));var controller=require(_0x3628('0x7'));router[_0x3628('0x8')]('/',auth[_0x3628('0x9')](),controller[_0x3628('0xa')]);router[_0x3628('0x8')]('/:id',auth[_0x3628('0x9')](),controller['show']);router[_0x3628('0x8')](_0x3628('0xb'),auth[_0x3628('0x9')](),controller[_0x3628('0xc')]);router[_0x3628('0xd')]('/',auth['isAuthenticated'](),controller[_0x3628('0xe')]);router['post'](_0x3628('0xb'),auth['isAuthenticated'](),controller[_0x3628('0xf')]);router[_0x3628('0x10')](_0x3628('0x11'),auth[_0x3628('0x9')](),controller['update']);router['delete'](_0x3628('0x11'),auth[_0x3628('0x9')](),controller[_0x3628('0x12')]);router['delete']('/:id/sounds/:id2',auth[_0x3628('0x9')](),controller[_0x3628('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 0318917..80fdb7f 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 _0x6ed2=['STRING','name','ENUM','mp3nb','quietmp3nb','mp3','files','alpha','TIMESTAMP','BOOLEAN','exports'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x6ed2,0xd0));var _0x26ed=function(_0x5b9860,_0x6decaf){_0x5b9860=_0x5b9860-0x0;var _0x7906d7=_0x6ed2[_0x5b9860];return _0x7906d7;};'use strict';var Sequelize=require('sequelize');module[_0x26ed('0x0')]={'name':{'type':Sequelize[_0x26ed('0x1')],'allowNull':![],'unique':_0x26ed('0x2')},'mode':{'type':Sequelize[_0x26ed('0x3')]('custom','files',_0x26ed('0x4'),_0x26ed('0x5'),'quietmp3',_0x26ed('0x6')),'allowNull':!![],'defaultValue':_0x26ed('0x7')},'directory':{'type':Sequelize[_0x26ed('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x26ed('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x26ed('0x1')],'allowNull':!![],'defaultValue':_0x26ed('0x8')},'format':{'type':Sequelize[_0x26ed('0x1')],'allowNull':!![]},'stamp':{'type':_0x26ed('0x9')},'defaultEntry':{'type':Sequelize[_0x26ed('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbe8d=['sequelize','exports','name','ENUM','custom','mp3nb','quietmp3','mp3','STRING','alpha','TIMESTAMP'];(function(_0x39f56d,_0x1fdfc1){var _0x3f6f62=function(_0x3ec689){while(--_0x3ec689){_0x39f56d['push'](_0x39f56d['shift']());}};_0x3f6f62(++_0x1fdfc1);}(_0xbe8d,0x8f));var _0xdbe8=function(_0x2781b0,_0x4ec0d2){_0x2781b0=_0x2781b0-0x0;var _0xb532ba=_0xbe8d[_0x2781b0];return _0xb532ba;};'use strict';var Sequelize=require(_0xdbe8('0x0'));module[_0xdbe8('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdbe8('0x2')},'mode':{'type':Sequelize[_0xdbe8('0x3')](_0xdbe8('0x4'),'files',_0xdbe8('0x5'),'quietmp3nb',_0xdbe8('0x6'),_0xdbe8('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xdbe8('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0xdbe8('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0xdbe8('0x8')],'allowNull':!![]},'sort':{'type':Sequelize[_0xdbe8('0x8')],'allowNull':!![],'defaultValue':_0xdbe8('0x9')},'format':{'type':Sequelize[_0xdbe8('0x8')],'allowNull':!![]},'stamp':{'type':_0xdbe8('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index f714583..574bc76 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 _0x4c8e=['files','join','create','mkdirSync','directory','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','message','addSound','Sound','findOne','save_name','converted_format','root','server/files/sounds/converted','format','%s.%s','basename','extname','server/files/moh','ValidationError','removeSound','sequelize','id2','createdAt','getSounds','order','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','get','MusicOnHolds','sendStatus','error','stack','name','send','index','map','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','VoiceMusicOnHold','includeAll','include','rows','catch','show','params','keys','rawAttributes','length','find','body','transaction','mode'];(function(_0x4a77f4,_0x5df985){var _0x181cdf=function(_0x1a0a80){while(--_0x1a0a80){_0x4a77f4['push'](_0x4a77f4['shift']());}};_0x181cdf(++_0x5df985);}(_0x4c8e,0x177));var _0xe4c8=function(_0x2cdd4d,_0x394c2f){_0x2cdd4d=_0x2cdd4d-0x0;var _0x55cbc8=_0x4c8e[_0x2cdd4d];return _0x55cbc8;};'use strict';var emlformat=require(_0xe4c8('0x0'));var rimraf=require(_0xe4c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe4c8('0x2'));var rp=require(_0xe4c8('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe4c8('0x4'));var util=require(_0xe4c8('0x5'));var path=require(_0xe4c8('0x6'));var sox=require(_0xe4c8('0x7'));var csv=require(_0xe4c8('0x8'));var ejs=require(_0xe4c8('0x9'));var fs=require('fs');var fs_extra=require(_0xe4c8('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe4c8('0xb'));var jsforce=require(_0xe4c8('0xc'));var deskjs=require(_0xe4c8('0xd'));var toCsv=require(_0xe4c8('0x8'));var querystring=require('querystring');var Papa=require(_0xe4c8('0xe'));var Redis=require('ioredis');var authService=require(_0xe4c8('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xe4c8('0x10'));var hardwareService=require(_0xe4c8('0x11'));var logger=require(_0xe4c8('0x12'))(_0xe4c8('0x13'));var utils=require(_0xe4c8('0x14'));var config=require(_0xe4c8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe4c8('0x16'))['db'];function respondWithStatusCode(_0x3863c6,_0x4e4d69){_0x4e4d69=_0x4e4d69||0xcc;return function(_0x5bb3df){if(_0x5bb3df){return _0x3863c6['sendStatus'](_0x4e4d69);}return _0x3863c6['status'](_0x4e4d69)[_0xe4c8('0x17')]();};}function respondWithResult(_0x20fb94,_0x2b71e6){_0x2b71e6=_0x2b71e6||0xc8;return function(_0x2dc84e){if(_0x2dc84e){return _0x20fb94[_0xe4c8('0x18')](_0x2b71e6)[_0xe4c8('0x19')](_0x2dc84e);}};}function respondWithFilteredResult(_0x12c538,_0x3ea0ec){return function(_0x46ca1c){if(_0x46ca1c){var _0x3841c0=typeof _0x3ea0ec[_0xe4c8('0x1a')]==='undefined'&&typeof _0x3ea0ec[_0xe4c8('0x1b')]===_0xe4c8('0x1c');var _0xac679c=_0x46ca1c[_0xe4c8('0x1d')];var _0x59ee73=_0x3841c0?0x0:_0x3ea0ec['offset'];var _0x1e34d4=_0x3841c0?_0x46ca1c[_0xe4c8('0x1d')]:_0x3ea0ec[_0xe4c8('0x1a')]+_0x3ea0ec[_0xe4c8('0x1b')];var _0x1c782b;if(_0x1e34d4>=_0xac679c){_0x1e34d4=_0xac679c;_0x1c782b=0xc8;}else{_0x1c782b=0xce;}_0x12c538[_0xe4c8('0x18')](_0x1c782b);return _0x12c538[_0xe4c8('0x1e')]('Content-Range',_0x59ee73+'-'+_0x1e34d4+'/'+_0xac679c)['json'](_0x46ca1c);}return null;};}function patchUpdates(_0x3dc881){return function(_0xffa5c){try{jsonpatch[_0xe4c8('0x1f')](_0xffa5c,_0x3dc881,!![]);}catch(_0x282416){return BPromise[_0xe4c8('0x20')](_0x282416);}return _0xffa5c[_0xe4c8('0x21')]();};}function saveUpdates(_0x2cf0c6,_0x3da8cf){return function(_0x5c2157){if(_0x5c2157){return _0x5c2157[_0xe4c8('0x22')](_0x2cf0c6)[_0xe4c8('0x23')](function(_0x517ad7){return _0x517ad7;});}return null;};}function removeEntity(_0x292004,_0x4be0a2){return function(_0x29e938){if(_0x29e938){return _0x29e938[_0xe4c8('0x24')]()['then'](function(){var _0x1383da=_0x29e938[_0xe4c8('0x25')]({'plain':!![]});var _0x389887=_0xe4c8('0x26');return db['UserProfileResource'][_0xe4c8('0x24')]({'where':{'type':_0x389887,'resourceId':_0x1383da['id']}})['then'](function(){return _0x29e938;});})['then'](function(){_0x292004['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe78349,_0x24e863){return function(_0x43f2a6){if(!_0x43f2a6){_0xe78349[_0xe4c8('0x27')](0x194);}return _0x43f2a6;};}function handleError(_0x5638a8,_0x32d898){_0x32d898=_0x32d898||0x1f4;return function(_0x4dc716){logger[_0xe4c8('0x28')](_0x4dc716[_0xe4c8('0x29')]);if(_0x4dc716[_0xe4c8('0x2a')]){delete _0x4dc716[_0xe4c8('0x2a')];}_0x5638a8[_0xe4c8('0x18')](_0x32d898)[_0xe4c8('0x2b')](_0x4dc716);};}exports[_0xe4c8('0x2c')]=function(_0x12e8c1,_0x5d8e8d){var _0x360b04={},_0x146e6c={},_0x4be22d={'count':0x0,'rows':[]};var _0x20c169=_[_0xe4c8('0x2d')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x345fac){return{'name':_0x345fac[_0xe4c8('0x2e')],'type':_0x345fac[_0xe4c8('0x2f')][_0xe4c8('0x30')]};});_0x146e6c['model']=_['map'](_0x20c169,_0xe4c8('0x2a'));_0x146e6c[_0xe4c8('0x31')]=_['keys'](_0x12e8c1[_0xe4c8('0x31')]);_0x146e6c[_0xe4c8('0x32')]=_[_0xe4c8('0x33')](_0x146e6c[_0xe4c8('0x34')],_0x146e6c[_0xe4c8('0x31')]);_0x360b04[_0xe4c8('0x35')]=_['intersection'](_0x146e6c[_0xe4c8('0x34')],qs[_0xe4c8('0x36')](_0x12e8c1[_0xe4c8('0x31')]['fields']));_0x360b04[_0xe4c8('0x35')]=_0x360b04[_0xe4c8('0x35')]['length']?_0x360b04[_0xe4c8('0x35')]:_0x146e6c[_0xe4c8('0x34')];if(!_0x12e8c1['query'][_0xe4c8('0x37')](_0xe4c8('0x38'))){_0x360b04[_0xe4c8('0x1b')]=qs['limit'](_0x12e8c1['query'][_0xe4c8('0x1b')]);_0x360b04[_0xe4c8('0x1a')]=qs[_0xe4c8('0x1a')](_0x12e8c1[_0xe4c8('0x31')][_0xe4c8('0x1a')]);}_0x360b04['order']=qs[_0xe4c8('0x39')](_0x12e8c1['query'][_0xe4c8('0x39')]);delete _0x12e8c1[_0xe4c8('0x31')]['sort'];_0x360b04[_0xe4c8('0x3a')]=qs[_0xe4c8('0x32')](_['pick'](_0x12e8c1['query'],_0x146e6c['filters']),_0x20c169);if(_0x12e8c1['query'][_0xe4c8('0x3b')]){_0x360b04[_0xe4c8('0x3a')]=_[_0xe4c8('0x3c')](_0x360b04[_0xe4c8('0x3a')],{'$or':_[_0xe4c8('0x2d')](_0x20c169,function(_0x29d525){if(_0x29d525[_0xe4c8('0x2f')]!==_0xe4c8('0x3d')){var _0x461751={};_0x461751[_0x29d525[_0xe4c8('0x2a')]]={'$like':'%'+_0x12e8c1[_0xe4c8('0x31')][_0xe4c8('0x3b')]+'%'};return _0x461751;}})});}_0x360b04=_[_0xe4c8('0x3c')]({},_0x360b04,_0x12e8c1[_0xe4c8('0x3e')]);var _0x2ec653={'where':_0x360b04[_0xe4c8('0x3a')]};return db[_0xe4c8('0x3f')][_0xe4c8('0x1d')](_0x2ec653)[_0xe4c8('0x23')](function(_0x37f1a2){_0x4be22d[_0xe4c8('0x1d')]=_0x37f1a2;if(_0x12e8c1['query'][_0xe4c8('0x40')]){_0x360b04[_0xe4c8('0x41')]=[{'all':!![]}];}return db[_0xe4c8('0x3f')]['findAll'](_0x360b04);})[_0xe4c8('0x23')](function(_0x49840c){_0x4be22d[_0xe4c8('0x42')]=_0x49840c;return _0x4be22d;})['then'](respondWithFilteredResult(_0x5d8e8d,_0x360b04))[_0xe4c8('0x43')](handleError(_0x5d8e8d,null));};exports[_0xe4c8('0x44')]=function(_0x744e8e,_0xb9415e){var _0x26905f={'raw':![],'where':{'id':_0x744e8e[_0xe4c8('0x45')]['id']}},_0x2a8669={};_0x2a8669[_0xe4c8('0x34')]=_[_0xe4c8('0x46')](db[_0xe4c8('0x3f')][_0xe4c8('0x47')]);_0x2a8669[_0xe4c8('0x31')]=_[_0xe4c8('0x46')](_0x744e8e[_0xe4c8('0x31')]);_0x2a8669['filters']=_[_0xe4c8('0x33')](_0x2a8669[_0xe4c8('0x34')],_0x2a8669[_0xe4c8('0x31')]);_0x26905f[_0xe4c8('0x35')]=_[_0xe4c8('0x33')](_0x2a8669['model'],qs[_0xe4c8('0x36')](_0x744e8e['query'][_0xe4c8('0x36')]));_0x26905f[_0xe4c8('0x35')]=_0x26905f['attributes'][_0xe4c8('0x48')]?_0x26905f[_0xe4c8('0x35')]:_0x2a8669['model'];if(_0x744e8e[_0xe4c8('0x31')][_0xe4c8('0x40')]){_0x26905f[_0xe4c8('0x41')]=[{'all':!![]}];}_0x26905f=_[_0xe4c8('0x3c')]({},_0x26905f,_0x744e8e[_0xe4c8('0x3e')]);return db[_0xe4c8('0x3f')][_0xe4c8('0x49')](_0x26905f)['then'](handleEntityNotFound(_0xb9415e,null))[_0xe4c8('0x23')](respondWithResult(_0xb9415e,null))[_0xe4c8('0x43')](handleError(_0xb9415e,null));};exports['update']=function(_0x216933,_0x42b80f){if(_0x216933[_0xe4c8('0x4a')]['id']){delete _0x216933[_0xe4c8('0x4a')]['id'];}return db[_0xe4c8('0x3f')][_0xe4c8('0x49')]({'where':{'id':_0x216933['params']['id']}})[_0xe4c8('0x23')](handleEntityNotFound(_0x42b80f,null))[_0xe4c8('0x23')](saveUpdates(_0x216933[_0xe4c8('0x4a')],null))[_0xe4c8('0x23')](respondWithResult(_0x42b80f,null))[_0xe4c8('0x43')](handleError(_0x42b80f,null));};exports['create']=function(_0x1d9ebf,_0x1931b9,_0x39b737){return db['sequelize'][_0xe4c8('0x4b')](function(_0x14d973){if(_0x1d9ebf[_0xe4c8('0x4a')][_0xe4c8('0x4c')]===_0xe4c8('0x4d')){_0x1d9ebf['body']['directory']=path[_0xe4c8('0x4e')](config['root'],'server/files/moh',_0x1d9ebf[_0xe4c8('0x4a')][_0xe4c8('0x2a')]);}return db[_0xe4c8('0x3f')][_0xe4c8('0x4f')](_0x1d9ebf[_0xe4c8('0x4a')],{'transaction':_0x14d973})['then'](function(_0x825ce6){if(_0x1d9ebf[_0xe4c8('0x4a')][_0xe4c8('0x4c')]===_0xe4c8('0x4d')){fs[_0xe4c8('0x50')](_0x825ce6[_0xe4c8('0x51')],parseInt('0777',0x8));}var _0xd40e70=_0x1d9ebf[_0xe4c8('0x52')][_0xe4c8('0x25')]({'plain':!![]});if(!_0xd40e70)throw new Error(_0xe4c8('0x53'));if(_0xd40e70[_0xe4c8('0x54')]===_0xe4c8('0x52')){var _0x363b86=_0x825ce6[_0xe4c8('0x25')]({'plain':!![]});return db[_0xe4c8('0x55')]['find']({'where':{'name':_0xe4c8('0x26'),'userProfileId':_0xd40e70['userProfileId']},'raw':!![]})[_0xe4c8('0x23')](function(_0x1a3d84){if(_0x1a3d84&&_0x1a3d84['autoAssociation']===0x0){return db[_0xe4c8('0x56')][_0xe4c8('0x4f')]({'name':_0x363b86[_0xe4c8('0x2a')],'resourceId':_0x363b86['id'],'type':_0x1a3d84['name'],'sectionId':_0x1a3d84['id']},{})['then'](function(){return _0x825ce6;});}else{return _0x825ce6;}})['catch'](function(_0x1a861a){logger[_0xe4c8('0x28')](_0xe4c8('0x57'),_0x1a861a);});}return _0x825ce6;});})[_0xe4c8('0x23')](respondWithResult(_0x1931b9,0xc9))[_0xe4c8('0x43')](handleError(_0x1931b9,null));};exports[_0xe4c8('0x24')]=function(_0x15c6c5,_0xcc8a00,_0x2eed9a){var _0x5f3cf4;return db[_0xe4c8('0x3f')][_0xe4c8('0x49')]({'where':{'id':_0x15c6c5[_0xe4c8('0x45')]['id']}})['then'](function(_0x160d3b){if(_0x160d3b){return db['sequelize']['transaction'](function(_0x19c782){return _0x160d3b[_0xe4c8('0x24')]({'transaction':_0x19c782,'raw':!![]})[_0xe4c8('0x23')](function(_0x57718a){if(_0x57718a[_0xe4c8('0x51')]){fs[_0xe4c8('0x58')](_0x57718a['directory'])[_0xe4c8('0x59')](function(_0x592735){fs[_0xe4c8('0x5a')](path[_0xe4c8('0x4e')](_0x57718a['directory'],_0x592735));});fs[_0xe4c8('0x5b')](_0x57718a[_0xe4c8('0x51')]);}return _0x57718a;});})[_0xe4c8('0x43')](function(_0x3e19ba){throw new db[(_0xe4c8('0x5c'))]['ValidationError'](_0x3e19ba[_0xe4c8('0x5d')]);});}})[_0xe4c8('0x23')](handleEntityNotFound(_0xcc8a00,null))['then'](removeEntity(_0xcc8a00,null))[_0xe4c8('0x43')](handleError(_0xcc8a00,null));};exports['addSound']=function(_0x208eae,_0x3e830a,_0xf135fd){return db['sequelize'][_0xe4c8('0x4b')](function(_0x1c0d50){var _0x5e7781;return db[_0xe4c8('0x3f')][_0xe4c8('0x49')]({'where':{'id':_0x208eae[_0xe4c8('0x45')]['id']}})[_0xe4c8('0x23')](function(_0x4b68b8){if(_0x4b68b8){_0x5e7781=_0x4b68b8;return _0x4b68b8[_0xe4c8('0x5e')](_0x208eae[_0xe4c8('0x4a')]['id'],{'transaction':_0x1c0d50});}})[_0xe4c8('0x23')](function(_0x2a509b){if(_0x2a509b){return db[_0xe4c8('0x5f')][_0xe4c8('0x60')]({'where':{'id':_0x208eae['body']['id']},'attributes':['id',_0xe4c8('0x2a'),_0xe4c8('0x61'),_0xe4c8('0x62'),'createdAt'],'raw':!![]});}})[_0xe4c8('0x23')](function(_0x577ef2){if(_0x577ef2){var _0x30591b=path['join'](config[_0xe4c8('0x63')],_0xe4c8('0x64'),util[_0xe4c8('0x65')](_0xe4c8('0x66'),path[_0xe4c8('0x67')](_0x577ef2[_0xe4c8('0x61')],path[_0xe4c8('0x68')](_0x577ef2[_0xe4c8('0x61')])),_0x577ef2[_0xe4c8('0x62')]));var _0x1a0e00=path['join'](config[_0xe4c8('0x63')],_0xe4c8('0x69'),_0x5e7781[_0xe4c8('0x2a')],util['format']('%s.%s',_0x577ef2[_0xe4c8('0x2a')],_0x577ef2['converted_format']));fs['symlinkSync'](_0x30591b,_0x1a0e00);return _0x577ef2;}})[_0xe4c8('0x43')](function(_0x758a76){throw new db[(_0xe4c8('0x5c'))][(_0xe4c8('0x6a'))](_0x758a76[_0xe4c8('0x5d')]);});})['then'](handleEntityNotFound(_0x3e830a,null))[_0xe4c8('0x23')](respondWithResult(_0x3e830a,0xc9))['catch'](handleError(_0x3e830a,null));};exports[_0xe4c8('0x6b')]=function(_0x489318,_0x33ed11,_0x374193){return db[_0xe4c8('0x6c')]['transaction'](function(_0x5d9937){var _0x20125;return db[_0xe4c8('0x3f')][_0xe4c8('0x60')]({'where':{'id':_0x489318['params']['id']}})['then'](handleEntityNotFound(_0x33ed11,null))[_0xe4c8('0x23')](function(_0x33b6dc){if(_0x33b6dc){_0x20125=_0x33b6dc;return _0x33b6dc[_0xe4c8('0x6b')](_0x489318[_0xe4c8('0x45')][_0xe4c8('0x6d')]);}})[_0xe4c8('0x23')](function(_0x1407f8){if(_0x1407f8){return db[_0xe4c8('0x5f')][_0xe4c8('0x60')]({'where':{'id':_0x489318[_0xe4c8('0x45')][_0xe4c8('0x6d')]},'attributes':['id',_0xe4c8('0x2a'),_0xe4c8('0x61'),_0xe4c8('0x62'),_0xe4c8('0x6e')],'raw':!![]});}})[_0xe4c8('0x23')](function(_0x344c41){if(_0x344c41){fs[_0xe4c8('0x5a')](path[_0xe4c8('0x4e')](_0x20125[_0xe4c8('0x51')],util['format'](_0xe4c8('0x66'),_0x344c41['name'],_0x344c41[_0xe4c8('0x62')])));return _0x344c41;}})[_0xe4c8('0x43')](function(_0x2d350b){throw new db[(_0xe4c8('0x5c'))][(_0xe4c8('0x6a'))](_0x2d350b[_0xe4c8('0x5d')]);});})[_0xe4c8('0x23')](handleEntityNotFound(_0x33ed11,null))['then'](respondWithStatusCode(_0x33ed11,0xcc))[_0xe4c8('0x43')](handleError(_0x33ed11,null));};exports[_0xe4c8('0x6f')]=function(_0x399b3e,_0x69f078,_0x3d2fc8){var _0xaa456b={};var _0x2b846b={};var _0x5c55e4;var _0x411005;return db[_0xe4c8('0x3f')][_0xe4c8('0x60')]({'where':{'id':_0x399b3e[_0xe4c8('0x45')]['id']}})[_0xe4c8('0x23')](handleEntityNotFound(_0x69f078,null))['then'](function(_0xba9c9e){if(_0xba9c9e){_0x5c55e4=_0xba9c9e;_0x2b846b[_0xe4c8('0x34')]=_[_0xe4c8('0x46')](db['Sound'][_0xe4c8('0x47')]);_0x2b846b[_0xe4c8('0x31')]=_['keys'](_0x399b3e[_0xe4c8('0x31')]);_0x2b846b[_0xe4c8('0x32')]=_[_0xe4c8('0x33')](_0x2b846b[_0xe4c8('0x34')],_0x2b846b[_0xe4c8('0x31')]);_0xaa456b[_0xe4c8('0x35')]=_[_0xe4c8('0x33')](_0x2b846b['model'],qs[_0xe4c8('0x36')](_0x399b3e['query'][_0xe4c8('0x36')]));_0xaa456b[_0xe4c8('0x35')]=_0xaa456b[_0xe4c8('0x35')][_0xe4c8('0x48')]?_0xaa456b[_0xe4c8('0x35')]:_0x2b846b[_0xe4c8('0x34')];_0xaa456b[_0xe4c8('0x70')]=qs['sort'](_0x399b3e[_0xe4c8('0x31')][_0xe4c8('0x39')]);_0xaa456b[_0xe4c8('0x3a')]=qs[_0xe4c8('0x32')](_['pick'](_0x399b3e[_0xe4c8('0x31')],_0x2b846b[_0xe4c8('0x32')]));if(_0x399b3e[_0xe4c8('0x31')][_0xe4c8('0x3b')]){_0xaa456b[_0xe4c8('0x3a')]=_[_0xe4c8('0x3c')](_0xaa456b[_0xe4c8('0x3a')],{'$or':_[_0xe4c8('0x2d')](_0xaa456b[_0xe4c8('0x35')],function(_0x44106d){var _0x1bdcc8={};_0x1bdcc8[_0x44106d]={'$like':'%'+_0x399b3e['query'][_0xe4c8('0x3b')]+'%'};return _0x1bdcc8;})});}_0xaa456b=_[_0xe4c8('0x3c')]({},_0xaa456b,_0x399b3e[_0xe4c8('0x3e')]);return _0x5c55e4[_0xe4c8('0x6f')](_0xaa456b);}})[_0xe4c8('0x23')](function(_0x67fa1f){if(_0x67fa1f){_0x411005=_0x67fa1f[_0xe4c8('0x48')];if(!_0x399b3e['query']['hasOwnProperty']('nolimit')){_0xaa456b[_0xe4c8('0x1b')]=qs[_0xe4c8('0x1b')](_0x399b3e[_0xe4c8('0x31')]['limit']);_0xaa456b[_0xe4c8('0x1a')]=qs[_0xe4c8('0x1a')](_0x399b3e[_0xe4c8('0x31')][_0xe4c8('0x1a')]);}return _0x5c55e4['getSounds'](_0xaa456b);}})[_0xe4c8('0x23')](function(_0x4e1bfc){if(_0x4e1bfc){return _0x4e1bfc?{'count':_0x411005,'rows':_0x4e1bfc}:null;}})['then'](respondWithResult(_0x69f078,null))[_0xe4c8('0x43')](handleError(_0x69f078,null));}; \ No newline at end of file +var _0xa462=['papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','offset','count','limit','Content-Range','json','apply','reject','save','update','then','get','MusicOnHolds','destroy','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','map','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','includeAll','include','rows','catch','show','keys','params','body','sequelize','transaction','mode','files','server/files/moh','create','mkdirSync','directory','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','join','rmdirSync','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','root','server/files/sounds/converted','%s.%s','extname','format','converted_format','symlinkSync','Sequelize','removeSound','id2','getSounds','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3cf7df,_0x43b053){var _0x52ca51=function(_0x3806c5){while(--_0x3806c5){_0x3cf7df['push'](_0x3cf7df['shift']());}};_0x52ca51(++_0x43b053);}(_0xa462,0x14c));var _0x2a46=function(_0x4e7dc2,_0x1f7c97){_0x4e7dc2=_0x4e7dc2-0x0;var _0x5713b2=_0xa462[_0x4e7dc2];return _0x5713b2;};'use strict';var emlformat=require(_0x2a46('0x0'));var rimraf=require(_0x2a46('0x1'));var zipdir=require(_0x2a46('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2a46('0x3'));var moment=require(_0x2a46('0x4'));var BPromise=require(_0x2a46('0x5'));var Mustache=require(_0x2a46('0x6'));var util=require('util');var path=require(_0x2a46('0x7'));var sox=require(_0x2a46('0x8'));var csv=require(_0x2a46('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a46('0xa'));var _=require('lodash');var squel=require(_0x2a46('0xb'));var crypto=require(_0x2a46('0xc'));var jsforce=require(_0x2a46('0xd'));var deskjs=require(_0x2a46('0xe'));var toCsv=require(_0x2a46('0x9'));var querystring=require(_0x2a46('0xf'));var Papa=require(_0x2a46('0x10'));var Redis=require(_0x2a46('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2a46('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2a46('0x13'))(_0x2a46('0x14'));var utils=require(_0x2a46('0x15'));var config=require(_0x2a46('0x16'));var licenseUtil=require(_0x2a46('0x17'));var db=require(_0x2a46('0x18'))['db'];function respondWithStatusCode(_0x47753d,_0x170e67){_0x170e67=_0x170e67||0xcc;return function(_0x210f78){if(_0x210f78){return _0x47753d[_0x2a46('0x19')](_0x170e67);}return _0x47753d['status'](_0x170e67)[_0x2a46('0x1a')]();};}function respondWithResult(_0x57f4e6,_0x458baa){_0x458baa=_0x458baa||0xc8;return function(_0x1dba97){if(_0x1dba97){return _0x57f4e6[_0x2a46('0x1b')](_0x458baa)['json'](_0x1dba97);}};}function respondWithFilteredResult(_0x3f48f5,_0x7788ac){return function(_0x211d04){if(_0x211d04){var _0x41ba4b=typeof _0x7788ac['offset']===_0x2a46('0x1c')&&typeof _0x7788ac['limit']===_0x2a46('0x1c');var _0xc0c756=_0x211d04['count'];var _0xfbce10=_0x41ba4b?0x0:_0x7788ac[_0x2a46('0x1d')];var _0x3dff13=_0x41ba4b?_0x211d04[_0x2a46('0x1e')]:_0x7788ac[_0x2a46('0x1d')]+_0x7788ac[_0x2a46('0x1f')];var _0x5c7be5;if(_0x3dff13>=_0xc0c756){_0x3dff13=_0xc0c756;_0x5c7be5=0xc8;}else{_0x5c7be5=0xce;}_0x3f48f5['status'](_0x5c7be5);return _0x3f48f5['set'](_0x2a46('0x20'),_0xfbce10+'-'+_0x3dff13+'/'+_0xc0c756)[_0x2a46('0x21')](_0x211d04);}return null;};}function patchUpdates(_0x10399e){return function(_0x1a0987){try{jsonpatch[_0x2a46('0x22')](_0x1a0987,_0x10399e,!![]);}catch(_0x3832c9){return BPromise[_0x2a46('0x23')](_0x3832c9);}return _0x1a0987[_0x2a46('0x24')]();};}function saveUpdates(_0x164b87,_0x18ca8d){return function(_0x1b59a7){if(_0x1b59a7){return _0x1b59a7[_0x2a46('0x25')](_0x164b87)[_0x2a46('0x26')](function(_0x1a04a6){return _0x1a04a6;});}return null;};}function removeEntity(_0x14a9a6,_0x43d107){return function(_0x3fe685){if(_0x3fe685){return _0x3fe685['destroy']()[_0x2a46('0x26')](function(){var _0x14c7d4=_0x3fe685[_0x2a46('0x27')]({'plain':!![]});var _0x5c7751=_0x2a46('0x28');return db['UserProfileResource'][_0x2a46('0x29')]({'where':{'type':_0x5c7751,'resourceId':_0x14c7d4['id']}})['then'](function(){return _0x3fe685;});})['then'](function(){_0x14a9a6[_0x2a46('0x1b')](0xcc)[_0x2a46('0x1a')]();});}};}function handleEntityNotFound(_0x296b3a,_0x2c1439){return function(_0x1b0953){if(!_0x1b0953){_0x296b3a[_0x2a46('0x19')](0x194);}return _0x1b0953;};}function handleError(_0x5613b8,_0x2a8b9a){_0x2a8b9a=_0x2a8b9a||0x1f4;return function(_0x1cd4cb){logger[_0x2a46('0x2a')](_0x1cd4cb[_0x2a46('0x2b')]);if(_0x1cd4cb['name']){delete _0x1cd4cb[_0x2a46('0x2c')];}_0x5613b8[_0x2a46('0x1b')](_0x2a8b9a)[_0x2a46('0x2d')](_0x1cd4cb);};}exports[_0x2a46('0x2e')]=function(_0x4855cf,_0x539406){var _0x48d19c={},_0x555b18={},_0x3ca965={'count':0x0,'rows':[]};var _0x9bd500=_['map'](db[_0x2a46('0x2f')][_0x2a46('0x30')],function(_0x500b34){return{'name':_0x500b34[_0x2a46('0x31')],'type':_0x500b34[_0x2a46('0x32')][_0x2a46('0x33')]};});_0x555b18['model']=_[_0x2a46('0x34')](_0x9bd500,_0x2a46('0x2c'));_0x555b18['query']=_['keys'](_0x4855cf[_0x2a46('0x35')]);_0x555b18['filters']=_[_0x2a46('0x36')](_0x555b18['model'],_0x555b18['query']);_0x48d19c[_0x2a46('0x37')]=_[_0x2a46('0x36')](_0x555b18[_0x2a46('0x38')],qs[_0x2a46('0x39')](_0x4855cf[_0x2a46('0x35')][_0x2a46('0x39')]));_0x48d19c[_0x2a46('0x37')]=_0x48d19c[_0x2a46('0x37')][_0x2a46('0x3a')]?_0x48d19c['attributes']:_0x555b18[_0x2a46('0x38')];if(!_0x4855cf[_0x2a46('0x35')][_0x2a46('0x3b')](_0x2a46('0x3c'))){_0x48d19c[_0x2a46('0x1f')]=qs[_0x2a46('0x1f')](_0x4855cf['query'][_0x2a46('0x1f')]);_0x48d19c[_0x2a46('0x1d')]=qs[_0x2a46('0x1d')](_0x4855cf['query'][_0x2a46('0x1d')]);}_0x48d19c[_0x2a46('0x3d')]=qs[_0x2a46('0x3e')](_0x4855cf[_0x2a46('0x35')][_0x2a46('0x3e')]);delete _0x4855cf[_0x2a46('0x35')]['sort'];_0x48d19c['where']=qs[_0x2a46('0x3f')](_[_0x2a46('0x40')](_0x4855cf[_0x2a46('0x35')],_0x555b18[_0x2a46('0x3f')]),_0x9bd500);if(_0x4855cf[_0x2a46('0x35')]['filter']){_0x48d19c[_0x2a46('0x41')]=_[_0x2a46('0x42')](_0x48d19c['where'],{'$or':_[_0x2a46('0x34')](_0x9bd500,function(_0x3e4eda){if(_0x3e4eda[_0x2a46('0x32')]!==_0x2a46('0x43')){var _0x1e32f1={};_0x1e32f1[_0x3e4eda['name']]={'$like':'%'+_0x4855cf[_0x2a46('0x35')][_0x2a46('0x44')]+'%'};return _0x1e32f1;}})});}_0x48d19c=_[_0x2a46('0x42')]({},_0x48d19c,_0x4855cf['options']);var _0x4f69de={'where':_0x48d19c[_0x2a46('0x41')]};return db[_0x2a46('0x2f')][_0x2a46('0x1e')](_0x4f69de)[_0x2a46('0x26')](function(_0x10e67a){_0x3ca965[_0x2a46('0x1e')]=_0x10e67a;if(_0x4855cf['query'][_0x2a46('0x45')]){_0x48d19c[_0x2a46('0x46')]=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x48d19c);})['then'](function(_0x25403f){_0x3ca965[_0x2a46('0x47')]=_0x25403f;return _0x3ca965;})['then'](respondWithFilteredResult(_0x539406,_0x48d19c))[_0x2a46('0x48')](handleError(_0x539406,null));};exports[_0x2a46('0x49')]=function(_0x4bcf83,_0x19ace4){var _0x4ac2fd={'raw':![],'where':{'id':_0x4bcf83['params']['id']}},_0x50268b={};_0x50268b[_0x2a46('0x38')]=_['keys'](db['VoiceMusicOnHold']['rawAttributes']);_0x50268b[_0x2a46('0x35')]=_[_0x2a46('0x4a')](_0x4bcf83[_0x2a46('0x35')]);_0x50268b[_0x2a46('0x3f')]=_['intersection'](_0x50268b[_0x2a46('0x38')],_0x50268b['query']);_0x4ac2fd[_0x2a46('0x37')]=_['intersection'](_0x50268b['model'],qs[_0x2a46('0x39')](_0x4bcf83[_0x2a46('0x35')][_0x2a46('0x39')]));_0x4ac2fd['attributes']=_0x4ac2fd['attributes']['length']?_0x4ac2fd[_0x2a46('0x37')]:_0x50268b[_0x2a46('0x38')];if(_0x4bcf83[_0x2a46('0x35')][_0x2a46('0x45')]){_0x4ac2fd[_0x2a46('0x46')]=[{'all':!![]}];}_0x4ac2fd=_[_0x2a46('0x42')]({},_0x4ac2fd,_0x4bcf83['options']);return db[_0x2a46('0x2f')]['find'](_0x4ac2fd)[_0x2a46('0x26')](handleEntityNotFound(_0x19ace4,null))[_0x2a46('0x26')](respondWithResult(_0x19ace4,null))[_0x2a46('0x48')](handleError(_0x19ace4,null));};exports[_0x2a46('0x25')]=function(_0x4633ba,_0x8d26ae){if(_0x4633ba['body']['id']){delete _0x4633ba['body']['id'];}return db[_0x2a46('0x2f')]['find']({'where':{'id':_0x4633ba[_0x2a46('0x4b')]['id']}})[_0x2a46('0x26')](handleEntityNotFound(_0x8d26ae,null))['then'](saveUpdates(_0x4633ba[_0x2a46('0x4c')],null))[_0x2a46('0x26')](respondWithResult(_0x8d26ae,null))[_0x2a46('0x48')](handleError(_0x8d26ae,null));};exports['create']=function(_0x38707b,_0x26bfd3,_0x260b78){return db[_0x2a46('0x4d')][_0x2a46('0x4e')](function(_0x2e9833){if(_0x38707b[_0x2a46('0x4c')][_0x2a46('0x4f')]===_0x2a46('0x50')){_0x38707b[_0x2a46('0x4c')]['directory']=path['join'](config['root'],_0x2a46('0x51'),_0x38707b[_0x2a46('0x4c')][_0x2a46('0x2c')]);}return db[_0x2a46('0x2f')][_0x2a46('0x52')](_0x38707b['body'],{'transaction':_0x2e9833})['then'](function(_0xda048c){if(_0x38707b[_0x2a46('0x4c')][_0x2a46('0x4f')]==='files'){fs[_0x2a46('0x53')](_0xda048c[_0x2a46('0x54')],parseInt(_0x2a46('0x55'),0x8));}var _0x4bcd47=_0x38707b[_0x2a46('0x56')]['get']({'plain':!![]});if(!_0x4bcd47)throw new Error(_0x2a46('0x57'));if(_0x4bcd47[_0x2a46('0x58')]==='user'){var _0x3fac22=_0xda048c[_0x2a46('0x27')]({'plain':!![]});return db['UserProfileSection'][_0x2a46('0x59')]({'where':{'name':'MusicOnHolds','userProfileId':_0x4bcd47[_0x2a46('0x5a')]},'raw':!![]})[_0x2a46('0x26')](function(_0x5b610f){if(_0x5b610f&&_0x5b610f[_0x2a46('0x5b')]===0x0){return db['UserProfileResource'][_0x2a46('0x52')]({'name':_0x3fac22['name'],'resourceId':_0x3fac22['id'],'type':_0x5b610f[_0x2a46('0x2c')],'sectionId':_0x5b610f['id']},{})[_0x2a46('0x26')](function(){return _0xda048c;});}else{return _0xda048c;}})[_0x2a46('0x48')](function(_0x239c58){logger[_0x2a46('0x2a')](_0x2a46('0x5c'),_0x239c58);});}return _0xda048c;});})['then'](respondWithResult(_0x26bfd3,0xc9))[_0x2a46('0x48')](handleError(_0x26bfd3,null));};exports[_0x2a46('0x29')]=function(_0x46c952,_0x32c0be,_0x565e0e){var _0x4b6535;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x46c952[_0x2a46('0x4b')]['id']}})[_0x2a46('0x26')](function(_0x150359){if(_0x150359){return db[_0x2a46('0x4d')][_0x2a46('0x4e')](function(_0x2d656a){return _0x150359[_0x2a46('0x29')]({'transaction':_0x2d656a,'raw':!![]})['then'](function(_0x5aeaaa){if(_0x5aeaaa['directory']){fs[_0x2a46('0x5d')](_0x5aeaaa[_0x2a46('0x54')])[_0x2a46('0x5e')](function(_0x3b46c4){fs[_0x2a46('0x5f')](path[_0x2a46('0x60')](_0x5aeaaa[_0x2a46('0x54')],_0x3b46c4));});fs[_0x2a46('0x61')](_0x5aeaaa[_0x2a46('0x54')]);}return _0x5aeaaa;});})[_0x2a46('0x48')](function(_0x1e0b95){throw new db['Sequelize'][(_0x2a46('0x62'))](_0x1e0b95[_0x2a46('0x63')]);});}})['then'](handleEntityNotFound(_0x32c0be,null))[_0x2a46('0x26')](removeEntity(_0x32c0be,null))[_0x2a46('0x48')](handleError(_0x32c0be,null));};exports[_0x2a46('0x64')]=function(_0x1aa379,_0x39bb09,_0x32c310){return db[_0x2a46('0x4d')][_0x2a46('0x4e')](function(_0x2ab690){var _0xcdd20e;return db[_0x2a46('0x2f')]['find']({'where':{'id':_0x1aa379[_0x2a46('0x4b')]['id']}})[_0x2a46('0x26')](function(_0x56d619){if(_0x56d619){_0xcdd20e=_0x56d619;return _0x56d619[_0x2a46('0x64')](_0x1aa379['body']['id'],{'transaction':_0x2ab690});}})['then'](function(_0x23edba){if(_0x23edba){return db[_0x2a46('0x65')][_0x2a46('0x66')]({'where':{'id':_0x1aa379[_0x2a46('0x4c')]['id']},'attributes':['id',_0x2a46('0x2c'),_0x2a46('0x67'),'converted_format',_0x2a46('0x68')],'raw':!![]});}})[_0x2a46('0x26')](function(_0x27f2a5){if(_0x27f2a5){var _0x48825d=path['join'](config[_0x2a46('0x69')],_0x2a46('0x6a'),util['format'](_0x2a46('0x6b'),path['basename'](_0x27f2a5[_0x2a46('0x67')],path[_0x2a46('0x6c')](_0x27f2a5[_0x2a46('0x67')])),_0x27f2a5['converted_format']));var _0x1ab676=path['join'](config['root'],_0x2a46('0x51'),_0xcdd20e[_0x2a46('0x2c')],util[_0x2a46('0x6d')](_0x2a46('0x6b'),_0x27f2a5[_0x2a46('0x2c')],_0x27f2a5[_0x2a46('0x6e')]));fs[_0x2a46('0x6f')](_0x48825d,_0x1ab676);return _0x27f2a5;}})['catch'](function(_0x3eb9d6){throw new db[(_0x2a46('0x70'))][(_0x2a46('0x62'))](_0x3eb9d6[_0x2a46('0x63')]);});})[_0x2a46('0x26')](handleEntityNotFound(_0x39bb09,null))[_0x2a46('0x26')](respondWithResult(_0x39bb09,0xc9))['catch'](handleError(_0x39bb09,null));};exports[_0x2a46('0x71')]=function(_0x3b842c,_0x4d2945,_0x339e3b){return db['sequelize']['transaction'](function(_0x5ed347){var _0x20c7f8;return db[_0x2a46('0x2f')][_0x2a46('0x66')]({'where':{'id':_0x3b842c['params']['id']}})[_0x2a46('0x26')](handleEntityNotFound(_0x4d2945,null))['then'](function(_0x32fe2c){if(_0x32fe2c){_0x20c7f8=_0x32fe2c;return _0x32fe2c['removeSound'](_0x3b842c[_0x2a46('0x4b')][_0x2a46('0x72')]);}})[_0x2a46('0x26')](function(_0x5a58a7){if(_0x5a58a7){return db[_0x2a46('0x65')][_0x2a46('0x66')]({'where':{'id':_0x3b842c[_0x2a46('0x4b')][_0x2a46('0x72')]},'attributes':['id',_0x2a46('0x2c'),_0x2a46('0x67'),_0x2a46('0x6e'),'createdAt'],'raw':!![]});}})[_0x2a46('0x26')](function(_0x53a603){if(_0x53a603){fs['unlinkSync'](path[_0x2a46('0x60')](_0x20c7f8[_0x2a46('0x54')],util['format'](_0x2a46('0x6b'),_0x53a603[_0x2a46('0x2c')],_0x53a603[_0x2a46('0x6e')])));return _0x53a603;}})[_0x2a46('0x48')](function(_0xc5a06a){throw new db['Sequelize']['ValidationError'](_0xc5a06a[_0x2a46('0x63')]);});})[_0x2a46('0x26')](handleEntityNotFound(_0x4d2945,null))['then'](respondWithStatusCode(_0x4d2945,0xcc))['catch'](handleError(_0x4d2945,null));};exports[_0x2a46('0x73')]=function(_0x1cacb8,_0x4b54ae,_0x466f3b){var _0x42f2a2={};var _0x44ba80={};var _0xde754;var _0x19e184;return db[_0x2a46('0x2f')]['findOne']({'where':{'id':_0x1cacb8[_0x2a46('0x4b')]['id']}})[_0x2a46('0x26')](handleEntityNotFound(_0x4b54ae,null))[_0x2a46('0x26')](function(_0xcc767c){if(_0xcc767c){_0xde754=_0xcc767c;_0x44ba80[_0x2a46('0x38')]=_[_0x2a46('0x4a')](db[_0x2a46('0x65')][_0x2a46('0x30')]);_0x44ba80['query']=_[_0x2a46('0x4a')](_0x1cacb8['query']);_0x44ba80[_0x2a46('0x3f')]=_[_0x2a46('0x36')](_0x44ba80['model'],_0x44ba80[_0x2a46('0x35')]);_0x42f2a2[_0x2a46('0x37')]=_[_0x2a46('0x36')](_0x44ba80[_0x2a46('0x38')],qs['fields'](_0x1cacb8[_0x2a46('0x35')][_0x2a46('0x39')]));_0x42f2a2['attributes']=_0x42f2a2[_0x2a46('0x37')][_0x2a46('0x3a')]?_0x42f2a2[_0x2a46('0x37')]:_0x44ba80['model'];_0x42f2a2[_0x2a46('0x3d')]=qs[_0x2a46('0x3e')](_0x1cacb8[_0x2a46('0x35')][_0x2a46('0x3e')]);_0x42f2a2[_0x2a46('0x41')]=qs[_0x2a46('0x3f')](_[_0x2a46('0x40')](_0x1cacb8['query'],_0x44ba80[_0x2a46('0x3f')]));if(_0x1cacb8['query'][_0x2a46('0x44')]){_0x42f2a2['where']=_[_0x2a46('0x42')](_0x42f2a2[_0x2a46('0x41')],{'$or':_[_0x2a46('0x34')](_0x42f2a2[_0x2a46('0x37')],function(_0x494716){var _0x14bd53={};_0x14bd53[_0x494716]={'$like':'%'+_0x1cacb8[_0x2a46('0x35')][_0x2a46('0x44')]+'%'};return _0x14bd53;})});}_0x42f2a2=_[_0x2a46('0x42')]({},_0x42f2a2,_0x1cacb8['options']);return _0xde754[_0x2a46('0x73')](_0x42f2a2);}})[_0x2a46('0x26')](function(_0x570edd){if(_0x570edd){_0x19e184=_0x570edd[_0x2a46('0x3a')];if(!_0x1cacb8['query'][_0x2a46('0x3b')](_0x2a46('0x3c'))){_0x42f2a2[_0x2a46('0x1f')]=qs[_0x2a46('0x1f')](_0x1cacb8['query'][_0x2a46('0x1f')]);_0x42f2a2[_0x2a46('0x1d')]=qs[_0x2a46('0x1d')](_0x1cacb8[_0x2a46('0x35')][_0x2a46('0x1d')]);}return _0xde754[_0x2a46('0x73')](_0x42f2a2);}})[_0x2a46('0x26')](function(_0x104ab6){if(_0x104ab6){return _0x104ab6?{'count':_0x19e184,'rows':_0x104ab6}:null;}})[_0x2a46('0x26')](respondWithResult(_0x4b54ae,null))[_0x2a46('0x48')](handleError(_0x4b54ae,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 2bba16f..6fa41e6 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 _0xe9d5=['VoiceMusicOnHold','voice_musiconhold','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define'];(function(_0x144de3,_0x766cd8){var _0x38017f=function(_0x45a620){while(--_0x45a620){_0x144de3['push'](_0x144de3['shift']());}};_0x38017f(++_0x766cd8);}(_0xe9d5,0x7a));var _0x5e9d=function(_0x5e9f06,_0x3dd75c){_0x5e9f06=_0x5e9f06-0x0;var _0x4c9dd5=_0xe9d5[_0x5e9f06];return _0x4c9dd5;};'use strict';var _=require('lodash');var util=require(_0x5e9d('0x0'));var logger=require(_0x5e9d('0x1'))(_0x5e9d('0x2'));var moment=require('moment');var BPromise=require(_0x5e9d('0x3'));var rp=require(_0x5e9d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5e9d('0x5'));var config=require(_0x5e9d('0x6'));var attributes=require(_0x5e9d('0x7'));module[_0x5e9d('0x8')]=function(_0xd03241,_0x2c25d9){return _0xd03241[_0x5e9d('0x9')](_0x5e9d('0xa'),attributes,{'tableName':_0x5e9d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c6b=['voice_musiconhold','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define'];(function(_0x11f94c,_0x1b3d03){var _0x17d4bd=function(_0x4666ab){while(--_0x4666ab){_0x11f94c['push'](_0x11f94c['shift']());}};_0x17d4bd(++_0x1b3d03);}(_0x6c6b,0x115));var _0xb6c6=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x6c6b[_0x3e44fa];return _0x2a0aba;};'use strict';var _=require(_0xb6c6('0x0'));var util=require('util');var logger=require(_0xb6c6('0x1'))(_0xb6c6('0x2'));var moment=require(_0xb6c6('0x3'));var BPromise=require('bluebird');var rp=require(_0xb6c6('0x4'));var fs=require('fs');var path=require(_0xb6c6('0x5'));var rimraf=require(_0xb6c6('0x6'));var config=require(_0xb6c6('0x7'));var attributes=require(_0xb6c6('0x8'));module[_0xb6c6('0x9')]=function(_0x50cb8e,_0x2b3129){return _0x50cb8e[_0xb6c6('0xa')]('VoiceMusicOnHold',attributes,{'tableName':_0xb6c6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 8ebdfe5..9feb104 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(_0x246b62,_0x248f05){var _0xa485b6=function(_0x3ca5a8){while(--_0x3ca5a8){_0x246b62['push'](_0x246b62['shift']());}};_0xa485b6(++_0x248f05);}(_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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x512b42,_0x2c3328){var _0x26ee87=function(_0x358e93){while(--_0x358e93){_0x512b42['push'](_0x512b42['shift']());}};_0x26ee87(++_0x2c3328);}(_0xedd9,0xfc));var _0x9edd=function(_0x2d50bb,_0x307cbe){_0x2d50bb=_0x2d50bb-0x0;var _0x174007=_0xedd9[_0x2d50bb];return _0x174007;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 0cfe48d..10ccb19 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 _0x0389=['fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','describe','/:id','show','getAgents','/:id/teams','getTeams','post','/:id/users','addAgents','addTeams','put','delete','destroy','removeAgents','removeTeams','exports','multer','path','connect-timeout','express','Router'];(function(_0x1344bc,_0x4e4f2a){var _0x13013a=function(_0x2b63a5){while(--_0x2b63a5){_0x1344bc['push'](_0x1344bc['shift']());}};_0x13013a(++_0x4e4f2a);}(_0x0389,0x175));var _0x9038=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0x0389[_0x1627ae];return _0x34b38f;};'use strict';var multer=require(_0x9038('0x0'));var util=require('util');var path=require(_0x9038('0x1'));var timeout=require(_0x9038('0x2'));var express=require(_0x9038('0x3'));var router=express[_0x9038('0x4')]();var fs_extra=require(_0x9038('0x5'));var auth=require(_0x9038('0x6'));var interaction=require(_0x9038('0x7'));var config=require('../../config/environment');var controller=require(_0x9038('0x8'));router[_0x9038('0x9')]('/',auth[_0x9038('0xa')](),controller['index']);router['get']('/describe',auth[_0x9038('0xa')](),controller[_0x9038('0xb')]);router[_0x9038('0x9')](_0x9038('0xc'),auth['isAuthenticated'](),controller[_0x9038('0xd')]);router['get']('/:id/users',auth[_0x9038('0xa')](),controller[_0x9038('0xe')]);router['get'](_0x9038('0xf'),auth['isAuthenticated'](),controller[_0x9038('0x10')]);router[_0x9038('0x11')]('/',auth[_0x9038('0xa')](),controller['create']);router[_0x9038('0x11')](_0x9038('0x12'),auth[_0x9038('0xa')](),controller[_0x9038('0x13')]);router['post'](_0x9038('0xf'),auth[_0x9038('0xa')](),controller[_0x9038('0x14')]);router[_0x9038('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x9038('0x16')](_0x9038('0xc'),auth[_0x9038('0xa')](),controller[_0x9038('0x17')]);router[_0x9038('0x16')](_0x9038('0x12'),auth[_0x9038('0xa')](),controller[_0x9038('0x18')]);router['delete'](_0x9038('0xf'),auth[_0x9038('0xa')](),controller[_0x9038('0x19')]);module[_0x9038('0x1a')]=router; \ No newline at end of file +var _0xaeaf=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/users','/:id/teams','post','create','addAgents','addTeams','put','update','delete','removeAgents','removeTeams','exports','multer','util'];(function(_0x54a3cc,_0x480b4b){var _0x18d0aa=function(_0xfc9cce){while(--_0xfc9cce){_0x54a3cc['push'](_0x54a3cc['shift']());}};_0x18d0aa(++_0x480b4b);}(_0xaeaf,0x14e));var _0xfaea=function(_0x1385dc,_0x2c7fd7){_0x1385dc=_0x1385dc-0x0;var _0x2f6469=_0xaeaf[_0x1385dc];return _0x2f6469;};'use strict';var multer=require(_0xfaea('0x0'));var util=require(_0xfaea('0x1'));var path=require(_0xfaea('0x2'));var timeout=require(_0xfaea('0x3'));var express=require(_0xfaea('0x4'));var router=express[_0xfaea('0x5')]();var fs_extra=require(_0xfaea('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xfaea('0x7'));var config=require(_0xfaea('0x8'));var controller=require(_0xfaea('0x9'));router[_0xfaea('0xa')]('/',auth['isAuthenticated'](),controller[_0xfaea('0xb')]);router[_0xfaea('0xa')](_0xfaea('0xc'),auth[_0xfaea('0xd')](),controller[_0xfaea('0xe')]);router['get'](_0xfaea('0xf'),auth[_0xfaea('0xd')](),controller['show']);router[_0xfaea('0xa')](_0xfaea('0x10'),auth[_0xfaea('0xd')](),controller['getAgents']);router[_0xfaea('0xa')](_0xfaea('0x11'),auth[_0xfaea('0xd')](),controller['getTeams']);router[_0xfaea('0x12')]('/',auth[_0xfaea('0xd')](),controller[_0xfaea('0x13')]);router[_0xfaea('0x12')](_0xfaea('0x10'),auth['isAuthenticated'](),controller[_0xfaea('0x14')]);router['post'](_0xfaea('0x11'),auth['isAuthenticated'](),controller[_0xfaea('0x15')]);router[_0xfaea('0x16')]('/:id',auth[_0xfaea('0xd')](),controller[_0xfaea('0x17')]);router[_0xfaea('0x18')](_0xfaea('0xf'),auth[_0xfaea('0xd')](),controller['destroy']);router['delete'](_0xfaea('0x10'),auth[_0xfaea('0xd')](),controller[_0xfaea('0x19')]);router[_0xfaea('0x18')](_0xfaea('0x11'),auth[_0xfaea('0xd')](),controller[_0xfaea('0x1a')]);module[_0xfaea('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index d703f1b..11fc79e 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 _0x5dc8=['STRING','name','VIRTUAL','system-','INTEGER','sequelize','exports'];(function(_0x527003,_0x52c3e2){var _0x483a2e=function(_0x29ec06){while(--_0x29ec06){_0x527003['push'](_0x527003['shift']());}};_0x483a2e(++_0x52c3e2);}(_0x5dc8,0x101));var _0x85dc=function(_0x1feb65,_0x59d59b){_0x1feb65=_0x1feb65-0x0;var _0xb2dbb3=_0x5dc8[_0x1feb65];return _0xb2dbb3;};'use strict';var Sequelize=require(_0x85dc('0x0'));module[_0x85dc('0x1')]={'name':{'type':Sequelize[_0x85dc('0x2')],'allowNull':![],'unique':_0x85dc('0x3')},'prefix':{'type':Sequelize[_0x85dc('0x4')],'get':function(_0x4f9892){return _0x85dc('0x5')+this['getDataValue'](_0x85dc('0x3'))+'-';}},'description':{'type':Sequelize[_0x85dc('0x2')]},'callerIdAll':{'type':Sequelize[_0x85dc('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x85dc('0x6')]}}; \ No newline at end of file +var _0x16d9=['name','INTEGER','sequelize','exports','STRING','system-','getDataValue'];(function(_0x23cc2d,_0xd02450){var _0x3dd47d=function(_0x26c771){while(--_0x26c771){_0x23cc2d['push'](_0x23cc2d['shift']());}};_0x3dd47d(++_0xd02450);}(_0x16d9,0xdb));var _0x916d=function(_0x16aaef,_0x410651){_0x16aaef=_0x16aaef-0x0;var _0x1c82ef=_0x16d9[_0x16aaef];return _0x1c82ef;};'use strict';var Sequelize=require(_0x916d('0x0'));module[_0x916d('0x1')]={'name':{'type':Sequelize[_0x916d('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x362c62){return _0x916d('0x3')+this[_0x916d('0x4')](_0x916d('0x5'))+'-';}},'description':{'type':Sequelize[_0x916d('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x916d('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 4d5760a..a042e1e 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 _0xdd4f=['lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','send','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','describe','create','transaction','body','VoiceExtension','find','VoiceExtensionId','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','charAt','update','system-','sequelize','findById','addAgents','spread','ids','emit','userVoicePrefix:save','removeAgents','isArray','getAgents','findOne','rawAttributes','order','getTeams','Team','nolimit','findAll','User','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','removeTeams','userVoicePrefix:remove','eml-format','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x15cb7c,_0x549287){var _0xa0674d=function(_0x4ac069){while(--_0x4ac069){_0x15cb7c['push'](_0x15cb7c['shift']());}};_0xa0674d(++_0x549287);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x52f1ad,_0x4451ed){_0x52f1ad=_0x52f1ad-0x0;var _0x2ebbe1=_0xdd4f[_0x52f1ad];return _0x2ebbe1;};'use strict';var emlformat=require(_0xfdd4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfdd4('0x1'));var moment=require(_0xfdd4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfdd4('0x3'));var util=require(_0xfdd4('0x4'));var path=require(_0xfdd4('0x5'));var sox=require('sox');var csv=require(_0xfdd4('0x6'));var ejs=require(_0xfdd4('0x7'));var fs=require('fs');var fs_extra=require(_0xfdd4('0x8'));var _=require(_0xfdd4('0x9'));var squel=require(_0xfdd4('0xa'));var crypto=require('crypto');var jsforce=require(_0xfdd4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfdd4('0x6'));var querystring=require(_0xfdd4('0xc'));var Papa=require(_0xfdd4('0xd'));var Redis=require('ioredis');var authService=require(_0xfdd4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfdd4('0xf'));var hardwareService=require(_0xfdd4('0x10'));var logger=require(_0xfdd4('0x11'))(_0xfdd4('0x12'));var utils=require(_0xfdd4('0x13'));var config=require(_0xfdd4('0x14'));var licenseUtil=require(_0xfdd4('0x15'));var db=require(_0xfdd4('0x16'))['db'];config[_0xfdd4('0x17')]=_[_0xfdd4('0x18')](config[_0xfdd4('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xfdd4('0x19'))(new Redis(config[_0xfdd4('0x17')]));require(_0xfdd4('0x1a'))['register'](socket);function respondWithStatusCode(_0x1b7da1,_0x4aaeee){_0x4aaeee=_0x4aaeee||0xcc;return function(_0x467824){if(_0x467824){return _0x1b7da1[_0xfdd4('0x1b')](_0x4aaeee);}return _0x1b7da1[_0xfdd4('0x1c')](_0x4aaeee)[_0xfdd4('0x1d')]();};}function respondWithResult(_0x37b05f,_0x52cf2c){_0x52cf2c=_0x52cf2c||0xc8;return function(_0x47ed1d){if(_0x47ed1d){return _0x37b05f['status'](_0x52cf2c)[_0xfdd4('0x1e')](_0x47ed1d);}};}function respondWithFilteredResult(_0x216c7e,_0x2eb174){return function(_0x2ccc88){if(_0x2ccc88){var _0x32b5f7=typeof _0x2eb174[_0xfdd4('0x1f')]===_0xfdd4('0x20')&&typeof _0x2eb174[_0xfdd4('0x21')]===_0xfdd4('0x20');var _0x52ce34=_0x2ccc88[_0xfdd4('0x22')];var _0x3e8eac=_0x32b5f7?0x0:_0x2eb174[_0xfdd4('0x1f')];var _0x36e611=_0x32b5f7?_0x2ccc88[_0xfdd4('0x22')]:_0x2eb174[_0xfdd4('0x1f')]+_0x2eb174[_0xfdd4('0x21')];var _0x34dfa8;if(_0x36e611>=_0x52ce34){_0x36e611=_0x52ce34;_0x34dfa8=0xc8;}else{_0x34dfa8=0xce;}_0x216c7e['status'](_0x34dfa8);return _0x216c7e[_0xfdd4('0x23')](_0xfdd4('0x24'),_0x3e8eac+'-'+_0x36e611+'/'+_0x52ce34)[_0xfdd4('0x1e')](_0x2ccc88);}return null;};}function patchUpdates(_0x16e81b){return function(_0xb7856d){try{jsonpatch[_0xfdd4('0x25')](_0xb7856d,_0x16e81b,!![]);}catch(_0x451767){return BPromise[_0xfdd4('0x26')](_0x451767);}return _0xb7856d['save']();};}function saveUpdates(_0x1e14da,_0x1112e8){return function(_0x4397a3){if(_0x4397a3){return _0x4397a3['update'](_0x1e14da)[_0xfdd4('0x27')](function(_0x39b712){return _0x39b712;});}return null;};}function removeEntity(_0xf9c346,_0x2f8268){return function(_0x1ade42){if(_0x1ade42){return _0x1ade42['destroy']()[_0xfdd4('0x27')](function(){var _0x2c88ad=_0x1ade42[_0xfdd4('0x28')]({'plain':!![]});var _0x31e053=_0xfdd4('0x29');return db[_0xfdd4('0x2a')][_0xfdd4('0x2b')]({'where':{'type':_0x31e053,'resourceId':_0x2c88ad['id']}})[_0xfdd4('0x27')](function(){return _0x1ade42;});})['then'](function(){_0xf9c346[_0xfdd4('0x1c')](0xcc)[_0xfdd4('0x1d')]();});}};}function handleEntityNotFound(_0x385a68,_0xef012e){return function(_0x2207ae){if(!_0x2207ae){_0x385a68['sendStatus'](0x194);}return _0x2207ae;};}function handleError(_0xd127b1,_0x3372d2){_0x3372d2=_0x3372d2||0x1f4;return function(_0xbf38b4){logger[_0xfdd4('0x2c')](_0xbf38b4[_0xfdd4('0x2d')]);if(_0xbf38b4['name']){delete _0xbf38b4[_0xfdd4('0x2e')];}_0xd127b1[_0xfdd4('0x1c')](_0x3372d2)[_0xfdd4('0x2f')](_0xbf38b4);};}exports['index']=function(_0x3fd07a,_0x502776){var _0x2a65c8={},_0x2b22f9={},_0x4aa4f2={'count':0x0,'rows':[]};var _0x50b748=_[_0xfdd4('0x30')](db[_0xfdd4('0x31')]['rawAttributes'],function(_0x557d7b){return{'name':_0x557d7b[_0xfdd4('0x32')],'type':_0x557d7b[_0xfdd4('0x33')][_0xfdd4('0x34')]};});_0x2b22f9[_0xfdd4('0x35')]=_[_0xfdd4('0x30')](_0x50b748,_0xfdd4('0x2e'));_0x2b22f9[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0x3fd07a[_0xfdd4('0x36')]);_0x2b22f9[_0xfdd4('0x38')]=_[_0xfdd4('0x39')](_0x2b22f9[_0xfdd4('0x35')],_0x2b22f9[_0xfdd4('0x36')]);_0x2a65c8[_0xfdd4('0x3a')]=_[_0xfdd4('0x39')](_0x2b22f9[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x3b')]));_0x2a65c8[_0xfdd4('0x3a')]=_0x2a65c8[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x2a65c8[_0xfdd4('0x3a')]:_0x2b22f9[_0xfdd4('0x35')];if(!_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x3d')]('nolimit')){_0x2a65c8[_0xfdd4('0x21')]=qs[_0xfdd4('0x21')](_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x21')]);_0x2a65c8[_0xfdd4('0x1f')]=qs[_0xfdd4('0x1f')](_0x3fd07a['query'][_0xfdd4('0x1f')]);}_0x2a65c8['order']=qs[_0xfdd4('0x3e')](_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x3e')]);_0x2a65c8[_0xfdd4('0x3f')]=qs['filters'](_[_0xfdd4('0x40')](_0x3fd07a[_0xfdd4('0x36')],_0x2b22f9[_0xfdd4('0x38')]),_0x50b748);if(_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x41')]){_0x2a65c8[_0xfdd4('0x3f')]=_[_0xfdd4('0x42')](_0x2a65c8[_0xfdd4('0x3f')],{'$or':_[_0xfdd4('0x30')](_0x50b748,function(_0x83673d){if(_0x83673d['type']!==_0xfdd4('0x43')){var _0x2196f={};_0x2196f[_0x83673d[_0xfdd4('0x2e')]]={'$like':'%'+_0x3fd07a[_0xfdd4('0x36')]['filter']+'%'};return _0x2196f;}})});}_0x2a65c8=_[_0xfdd4('0x42')]({},_0x2a65c8,_0x3fd07a[_0xfdd4('0x44')]);var _0x30524f={'where':_0x2a65c8[_0xfdd4('0x3f')]};return db[_0xfdd4('0x31')]['count'](_0x30524f)[_0xfdd4('0x27')](function(_0x23af2a){_0x4aa4f2[_0xfdd4('0x22')]=_0x23af2a;if(_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x45')]){_0x2a65c8[_0xfdd4('0x46')]=[{'all':!![]}];}return db[_0xfdd4('0x31')]['findAll'](_0x2a65c8);})[_0xfdd4('0x27')](function(_0x586713){_0x4aa4f2[_0xfdd4('0x47')]=_0x586713;return _0x4aa4f2;})[_0xfdd4('0x27')](respondWithFilteredResult(_0x502776,_0x2a65c8))[_0xfdd4('0x48')](handleError(_0x502776,null));};exports[_0xfdd4('0x49')]=function(_0x5367aa,_0x419578){var _0x11e90a={'raw':![],'where':{'id':_0x5367aa[_0xfdd4('0x4a')]['id']}},_0x4d1dfe={};_0x4d1dfe[_0xfdd4('0x35')]=_['keys'](db[_0xfdd4('0x31')]['rawAttributes']);_0x4d1dfe['query']=_['keys'](_0x5367aa[_0xfdd4('0x36')]);_0x4d1dfe[_0xfdd4('0x38')]=_[_0xfdd4('0x39')](_0x4d1dfe['model'],_0x4d1dfe[_0xfdd4('0x36')]);_0x11e90a[_0xfdd4('0x3a')]=_['intersection'](_0x4d1dfe[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x5367aa[_0xfdd4('0x36')][_0xfdd4('0x3b')]));_0x11e90a[_0xfdd4('0x3a')]=_0x11e90a[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x11e90a[_0xfdd4('0x3a')]:_0x4d1dfe[_0xfdd4('0x35')];if(_0x5367aa[_0xfdd4('0x36')][_0xfdd4('0x45')]){_0x11e90a[_0xfdd4('0x46')]=[{'all':!![]}];}_0x11e90a=_[_0xfdd4('0x42')]({},_0x11e90a,_0x5367aa[_0xfdd4('0x44')]);return db['VoicePrefix']['find'](_0x11e90a)[_0xfdd4('0x27')](handleEntityNotFound(_0x419578,null))[_0xfdd4('0x27')](respondWithResult(_0x419578,null))[_0xfdd4('0x48')](handleError(_0x419578,null));};exports[_0xfdd4('0x2b')]=function(_0x507bf5,_0x3c6828){return db[_0xfdd4('0x31')]['find']({'where':{'id':_0x507bf5['params']['id']}})['then'](handleEntityNotFound(_0x3c6828,null))['then'](removeEntity(_0x3c6828,null))['catch'](handleError(_0x3c6828,null));};exports[_0xfdd4('0x4b')]=function(_0x88e9ef,_0x3a4202){return db[_0xfdd4('0x31')][_0xfdd4('0x4b')]()[_0xfdd4('0x27')](respondWithResult(_0x3a4202,null))['catch'](handleError(_0x3a4202,null));};exports[_0xfdd4('0x4c')]=function(_0x1f521a,_0x1dd417){var _0x2355b5;return db['sequelize'][_0xfdd4('0x4d')](function(_0x8aa0ea){return db['VoicePrefix'][_0xfdd4('0x4c')](_0x1f521a[_0xfdd4('0x4e')],{'transaction':_0x8aa0ea})['then'](function(_0x5467d1){_0x2355b5=_0x5467d1[_0xfdd4('0x28')]({'plain':!![]});return db[_0xfdd4('0x4f')][_0xfdd4('0x50')]({'where':{'id':_0x2355b5[_0xfdd4('0x51')]},'raw':!![]})[_0xfdd4('0x27')](function(_0x1b9979){return createVoicePrefixExtensions(_0x2355b5,_0x1b9979,_0x8aa0ea);});});})[_0xfdd4('0x27')](function(){var _0x3de4fd=_0x1f521a['user'][_0xfdd4('0x28')]({'plain':!![]});if(!_0x3de4fd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3de4fd['role']===_0xfdd4('0x52')){var _0x1d9a8d=_0x2355b5;return db['UserProfileSection']['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x3de4fd[_0xfdd4('0x53')]},'raw':!![]})[_0xfdd4('0x27')](function(_0x4dc113){if(_0x4dc113&&_0x4dc113[_0xfdd4('0x54')]===0x0){return db[_0xfdd4('0x2a')][_0xfdd4('0x4c')]({'name':_0x1d9a8d[_0xfdd4('0x2e')],'resourceId':_0x1d9a8d['id'],'type':_0x4dc113[_0xfdd4('0x2e')],'sectionId':_0x4dc113['id']},{})['then'](function(){return _0x2355b5;});}else{return _0x2355b5;}})['catch'](function(_0x483942){logger['error'](_0xfdd4('0x55'),_0x483942);throw _0x483942;});}return _0x2355b5;})[_0xfdd4('0x27')](respondWithResult(_0x1dd417,null))['catch'](handleError(_0x1dd417,null));};function Extension(_0x1eee3d,_0x2abe50,_0x4d4304,_0x45dcc8){this[_0xfdd4('0x56')]='from-sip';this[_0xfdd4('0x57')]=_0x1eee3d;this[_0xfdd4('0x58')]=_0x4d4304;this[_0xfdd4('0x33')]='system';this[_0xfdd4('0x59')]=_0xfdd4('0x5a');this[_0xfdd4('0x5b')]=_0x2abe50;this[_0xfdd4('0x5c')]=_0x45dcc8;}function createVoicePrefixExtensions(_0x5c7be,_0x562417,_0x2cc3e2){return new BPromise(function(_0x2ee4b6,_0x3be4d5){var _0x202124=new Extension(formatPrefixName(_0x5c7be[_0xfdd4('0x5d')]),0x1,_0xfdd4('0x5e'),_0xfdd4('0x5f'));_0x202124[_0xfdd4('0x60')]=_0x5c7be['id'];return db[_0xfdd4('0x4f')]['create'](_0x202124,{'transaction':_0x2cc3e2})[_0xfdd4('0x27')](function(_0x2799b2){var _0x4483e1=_0x2799b2[_0xfdd4('0x28')]({'plain':!![]});var _0x3096fa=_['map'](addVoicePrefixExtensions(_0x5c7be,_0x562417),function(_0x46e7eb){_0x46e7eb[_0xfdd4('0x51')]=_0x4483e1['id'];_0x46e7eb[_0xfdd4('0x60')]=_0x5c7be['id'];return _0x46e7eb;});return db[_0xfdd4('0x4f')][_0xfdd4('0x61')](_0x3096fa,{'transaction':_0x2cc3e2})[_0xfdd4('0x27')](function(_0x180ad9){if(!_0x180ad9){return _0x3be4d5(_0xfdd4('0x62'));}else{return _0x2ee4b6(_0x180ad9);}})[_0xfdd4('0x48')](function(_0x2a0dd8){return _0x3be4d5(_0x2a0dd8);});});;});};function addVoicePrefixExtensions(_0x2fff30,_0x2792c4){var _0x1205b8=[];var _0x527068=formatPrefixName(_0x2fff30[_0xfdd4('0x5d')]);_0x1205b8['push'](new Extension(_0x527068,0x2,_0xfdd4('0x63'),_0xfdd4('0x64')+_0x2fff30[_0xfdd4('0x2e')]));if(_0x2fff30[_0xfdd4('0x65')]){_0x1205b8[_0xfdd4('0x66')](new Extension(_0x527068,0x3,_0xfdd4('0x63'),_0xfdd4('0x67')+_0x2fff30[_0xfdd4('0x65')]));}else{_0x1205b8[_0xfdd4('0x66')](new Extension(_0x527068,0x3,_0xfdd4('0x5e'),_0xfdd4('0x68')));}_0x1205b8[_0xfdd4('0x66')](new Extension(_0x527068,0x4,'goto',_0x2792c4['context']+','+'${EXTEN:'+(0x8+_0x2fff30[_0xfdd4('0x2e')][_0xfdd4('0x3c')])+'}'+','+0x1));return _0x1205b8;}function formatPrefixName(_0x4bb18b){var _0x3a367c='_';for(var _0x3f027b=0x0;_0x3f027b<_0x4bb18b[_0xfdd4('0x3c')];_0x3f027b++){if(_0x4bb18b[_0xfdd4('0x69')](_0x3f027b)=='-'){_0x3a367c+=_0x4bb18b[_0xfdd4('0x69')](_0x3f027b);}else{_0x3a367c+='['+_0x4bb18b['charAt'](_0x3f027b)+']';}}_0x3a367c+='.';return _0x3a367c;}exports[_0xfdd4('0x6a')]=function(_0x297432,_0x3958cd,_0x523085){var _0x366f1c=_0x297432['body'];_0x366f1c[_0xfdd4('0x5d')]=_0xfdd4('0x6b')+_0x366f1c[_0xfdd4('0x2e')]+'-';return db[_0xfdd4('0x6c')]['transaction'](function(_0x2351b6){return db[_0xfdd4('0x31')]['update'](_0x366f1c,{'where':{'id':_0x366f1c['id']},'transaction':_0x2351b6})[_0xfdd4('0x27')](function(){return db[_0xfdd4('0x4f')][_0xfdd4('0x2b')]({'where':{'VoicePrefixId':_0x366f1c['id']},'transaction':_0x2351b6})['then'](function(){return db[_0xfdd4('0x4f')][_0xfdd4('0x50')]({'where':{'id':_0x366f1c[_0xfdd4('0x51')]},'raw':!![]})['then'](function(_0x3f4337){return createVoicePrefixExtensions(_0x366f1c,_0x3f4337,_0x2351b6);});});});})[_0xfdd4('0x27')](function(){return db[_0xfdd4('0x31')][_0xfdd4('0x6d')](_0x366f1c['id']);})[_0xfdd4('0x27')](respondWithResult(_0x3958cd,null))[_0xfdd4('0x48')](handleError(_0x3958cd,null));};exports[_0xfdd4('0x6e')]=function(_0x539d3b,_0x147d54,_0x36b615){return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x539d3b[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x147d54,null))[_0xfdd4('0x27')](function(_0x4987d6){if(_0x4987d6){return _0x4987d6['addAgents'](_0x539d3b[_0xfdd4('0x4e')]['ids'],_['omit'](_0x539d3b[_0xfdd4('0x4e')],['ids','id'])||{})[_0xfdd4('0x6f')](function(_0x51711a){for(var _0x4576ce=0x0;_0x4576ce<_0x539d3b[_0xfdd4('0x4e')][_0xfdd4('0x70')][_0xfdd4('0x3c')];_0x4576ce+=0x1){socket[_0xfdd4('0x71')](_0xfdd4('0x72'),{'UserId':Number(_0x539d3b[_0xfdd4('0x4e')]['ids'][_0x4576ce]),'VoicePrefixId':Number(_0x539d3b['params']['id'])});}return _0x51711a;});}})[_0xfdd4('0x27')](respondWithResult(_0x147d54,null))['catch'](handleError(_0x147d54,null));};exports[_0xfdd4('0x73')]=function(_0x1a82ee,_0x3b205f,_0x1d57f8){return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x1a82ee[_0xfdd4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b205f,null))['then'](function(_0x37a342){if(_0x37a342){return _0x37a342[_0xfdd4('0x73')](_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')])[_0xfdd4('0x27')](function(){if(_[_0xfdd4('0x74')](_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')])){for(var _0xf78c69=0x0;_0xf78c69<_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')][_0xfdd4('0x3c')];_0xf78c69+=0x1){socket[_0xfdd4('0x71')]('userVoicePrefix:remove',{'UserId':Number(_0x1a82ee['query'][_0xfdd4('0x70')][_0xf78c69]),'VoicePrefixId':Number(_0x1a82ee[_0xfdd4('0x4a')]['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')]),'VoicePrefixId':Number(_0x1a82ee['params']['id'])});}});}})[_0xfdd4('0x27')](respondWithStatusCode(_0x3b205f,null))[_0xfdd4('0x48')](handleError(_0x3b205f,null));};exports[_0xfdd4('0x75')]=function(_0x11db43,_0x5ec62b,_0x25c078){var _0x5d356c={};var _0x3924c7={};var _0x2f65d7;var _0x4783b9;return db[_0xfdd4('0x31')][_0xfdd4('0x76')]({'where':{'id':_0x11db43[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x5ec62b,null))[_0xfdd4('0x27')](function(_0x575bc2){if(_0x575bc2){_0x2f65d7=_0x575bc2;_0x3924c7['model']=_[_0xfdd4('0x37')](db['User'][_0xfdd4('0x77')]);_0x3924c7[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0x11db43[_0xfdd4('0x36')]);_0x3924c7[_0xfdd4('0x38')]=_['intersection'](_0x3924c7['model'],_0x3924c7[_0xfdd4('0x36')]);_0x5d356c['attributes']=_[_0xfdd4('0x39')](_0x3924c7['model'],qs[_0xfdd4('0x3b')](_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x3b')]));_0x5d356c[_0xfdd4('0x3a')]=_0x5d356c[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x5d356c[_0xfdd4('0x3a')]:_0x3924c7[_0xfdd4('0x35')];_0x5d356c[_0xfdd4('0x78')]=qs[_0xfdd4('0x3e')](_0x11db43[_0xfdd4('0x36')]['sort']);_0x5d356c[_0xfdd4('0x3f')]=qs[_0xfdd4('0x38')](_[_0xfdd4('0x40')](_0x11db43[_0xfdd4('0x36')],_0x3924c7[_0xfdd4('0x38')]));if(_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x41')]){_0x5d356c[_0xfdd4('0x3f')]=_[_0xfdd4('0x42')](_0x5d356c['where'],{'$or':_['map'](_0x5d356c[_0xfdd4('0x3a')],function(_0x244d6d){var _0x30bd32={};_0x30bd32[_0x244d6d]={'$like':'%'+_0x11db43['query'][_0xfdd4('0x41')]+'%'};return _0x30bd32;})});}_0x5d356c=_[_0xfdd4('0x42')]({},_0x5d356c,_0x11db43[_0xfdd4('0x44')]);return _0x2f65d7[_0xfdd4('0x75')](_0x5d356c);}})['then'](function(_0x5868e6){if(_0x5868e6){_0x4783b9=_0x5868e6[_0xfdd4('0x3c')];if(!_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x3d')]('nolimit')){_0x5d356c[_0xfdd4('0x21')]=qs[_0xfdd4('0x21')](_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x21')]);_0x5d356c[_0xfdd4('0x1f')]=qs[_0xfdd4('0x1f')](_0x11db43['query']['offset']);}return _0x2f65d7[_0xfdd4('0x75')](_0x5d356c);}})[_0xfdd4('0x27')](function(_0x6a1410){if(_0x6a1410){return _0x6a1410?{'count':_0x4783b9,'rows':_0x6a1410}:null;}})[_0xfdd4('0x27')](respondWithResult(_0x5ec62b,null))[_0xfdd4('0x48')](handleError(_0x5ec62b,null));};exports[_0xfdd4('0x79')]=function(_0x46edc9,_0x2a4366,_0x5d1a3f){var _0x218d83={};var _0x547c4c={};var _0x464eb0;var _0x1871d6;return db['VoicePrefix'][_0xfdd4('0x76')]({'where':{'id':_0x46edc9[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x2a4366,null))[_0xfdd4('0x27')](function(_0x3cd7ae){if(_0x3cd7ae){_0x464eb0=_0x3cd7ae;_0x547c4c[_0xfdd4('0x35')]=_[_0xfdd4('0x37')](db[_0xfdd4('0x7a')][_0xfdd4('0x77')]);_0x547c4c['query']=_[_0xfdd4('0x37')](_0x46edc9['query']);_0x547c4c[_0xfdd4('0x38')]=_['intersection'](_0x547c4c['model'],_0x547c4c[_0xfdd4('0x36')]);_0x218d83[_0xfdd4('0x3a')]=_[_0xfdd4('0x39')](_0x547c4c[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x46edc9['query'][_0xfdd4('0x3b')]));_0x218d83[_0xfdd4('0x3a')]=_0x218d83[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x218d83[_0xfdd4('0x3a')]:_0x547c4c[_0xfdd4('0x35')];_0x218d83['order']=qs[_0xfdd4('0x3e')](_0x46edc9[_0xfdd4('0x36')]['sort']);_0x218d83['where']=qs[_0xfdd4('0x38')](_[_0xfdd4('0x40')](_0x46edc9[_0xfdd4('0x36')],_0x547c4c['filters']));if(_0x46edc9['query'][_0xfdd4('0x41')]){_0x218d83[_0xfdd4('0x3f')]=_[_0xfdd4('0x42')](_0x218d83['where'],{'$or':_['map'](_0x218d83[_0xfdd4('0x3a')],function(_0xd6eb47){var _0x1927ed={};_0x1927ed[_0xd6eb47]={'$like':'%'+_0x46edc9['query'][_0xfdd4('0x41')]+'%'};return _0x1927ed;})});}_0x218d83=_['merge']({},_0x218d83,_0x46edc9[_0xfdd4('0x44')]);return _0x464eb0[_0xfdd4('0x79')](_0x218d83);}})[_0xfdd4('0x27')](function(_0x4e1dbc){if(_0x4e1dbc){_0x1871d6=_0x4e1dbc[_0xfdd4('0x3c')];if(!_0x46edc9[_0xfdd4('0x36')][_0xfdd4('0x3d')](_0xfdd4('0x7b'))){_0x218d83[_0xfdd4('0x21')]=qs['limit'](_0x46edc9[_0xfdd4('0x36')][_0xfdd4('0x21')]);_0x218d83[_0xfdd4('0x1f')]=qs['offset'](_0x46edc9[_0xfdd4('0x36')][_0xfdd4('0x1f')]);}return _0x464eb0[_0xfdd4('0x79')](_0x218d83);}})[_0xfdd4('0x27')](function(_0x56e5d3){if(_0x56e5d3){return _0x56e5d3?{'count':_0x1871d6,'rows':_0x56e5d3}:null;}})[_0xfdd4('0x27')](respondWithResult(_0x2a4366,null))['catch'](handleError(_0x2a4366,null));};exports['addTeams']=function(_0x528004,_0x206a59,_0x545475){var _0x5e5362=_0x528004['body'][_0xfdd4('0x70')];var _0x728e25;return db[_0xfdd4('0x7a')][_0xfdd4('0x7c')]({'where':{'id':_0x5e5362},'attributes':['id'],'include':[{'model':db[_0xfdd4('0x7d')],'as':_0xfdd4('0x7e'),'attributes':['id',_0xfdd4('0x2e'),_0xfdd4('0x7f'),_0xfdd4('0x80'),_0xfdd4('0x81')],'raw':!![]}]})[_0xfdd4('0x27')](function(_0x2911ca){if(_0x2911ca){_0x728e25=_0x2911ca;var _0x31303f=_[_0xfdd4('0x82')](_0x2911ca,function(_0x46b927){var _0x450c67=_0x46b927[_0xfdd4('0x28')]({'plain':!![]});return _0x450c67[_0xfdd4('0x7e')];});return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x528004[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](function(_0x189baf){return db[_0xfdd4('0x6c')][_0xfdd4('0x4d')](function(_0x22f93b){return _0x189baf['addTeams'](_0x5e5362,{'transaction':_0x22f93b})[_0xfdd4('0x27')](function(){return BPromise[_0xfdd4('0x83')](_0x728e25,function(_0xaef5e2){return db[_0xfdd4('0x84')][_0xfdd4('0x85')]({'TeamId':_0xaef5e2['id'],'VoicePrefixId':_0x528004['params']['id']},{'transaction':_0x22f93b});});})[_0xfdd4('0x27')](function(){return BPromise[_0xfdd4('0x83')](_0x31303f,function(_0x19b679){return db[_0xfdd4('0x86')][_0xfdd4('0x87')]({'where':{'UserId':_0x19b679['id'],'VoicePrefixId':_0x528004[_0xfdd4('0x4a')]['id']},'transaction':_0x22f93b});});})['then'](function(){_0x31303f[_0xfdd4('0x88')](function(_0x1a9e62){socket[_0xfdd4('0x71')](_0xfdd4('0x72'),{'UserId':_0x1a9e62['id'],'VoicePrefixId':_0x189baf['id']});});});});});}})[_0xfdd4('0x27')](respondWithStatusCode(_0x206a59,null))[_0xfdd4('0x48')](handleError(_0x206a59,null));};exports['removeTeams']=function(_0x2a6a0d,_0x3d82d1,_0x17d272){return db['Team'][_0xfdd4('0x7c')]({'where':{'id':_0x2a6a0d[_0xfdd4('0x36')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfdd4('0x7e'),'attributes':['id'],'raw':!![]}]})[_0xfdd4('0x27')](handleEntityNotFound(_0x3d82d1,null))[_0xfdd4('0x27')](function(_0xd07645){var _0x5a3249=_[_0xfdd4('0x30')](_0xd07645,'id');var _0x5b22b1=[];var _0xc9955e=[];var _0x42204a=squel[_0xfdd4('0x89')]();_0x42204a[_0xfdd4('0x8a')](_0xfdd4('0x8b'))[_0xfdd4('0x8c')](_0xfdd4('0x8d'),'tq')[_0xfdd4('0x8e')](_0xfdd4('0x8f'),'ut',_0xfdd4('0x90'))[_0xfdd4('0x3f')]('VoicePrefixId\x20=\x20?',_0x2a6a0d[_0xfdd4('0x4a')]['id']);for(var _0x42a3dc=0x0;_0x42a3dc<_0xd07645[_0xfdd4('0x3c')];_0x42a3dc+=0x1){let _0x26316c=_0xd07645[_0x42a3dc];for(var _0x1e7bbb=0x0;_0x1e7bbb<_0x26316c[_0xfdd4('0x7e')]['length'];_0x1e7bbb+=0x1){let _0xfd0c1=_0x26316c[_0xfdd4('0x7e')][_0x1e7bbb];var _0x2ae92=_0x42204a[_0xfdd4('0x91')]();_0x2ae92['where'](_0xfdd4('0x92'),_0xfd0c1['id']);_0xc9955e[_0xfdd4('0x66')](db['sequelize'][_0xfdd4('0x36')](_0x2ae92[_0xfdd4('0x93')](),{'type':db[_0xfdd4('0x6c')][_0xfdd4('0x94')][_0xfdd4('0x95')]})[_0xfdd4('0x27')](function(_0x191ab6){if(_0x191ab6[_0xfdd4('0x3c')]===0x1){return _0xfd0c1['id'];}else{var _0x1d460f=_[_0xfdd4('0x96')](_[_0xfdd4('0x30')](_0x191ab6,_0xfdd4('0x97')),function(_0x25c508){return _[_0xfdd4('0x98')](_0x5a3249,_0x25c508);});if(_0x1d460f){return _0xfd0c1['id'];}}}));}}return BPromise['all'](_0xc9955e)[_0xfdd4('0x27')](function(_0x349fc6){_0x5b22b1=_(_0x5b22b1)[_0xfdd4('0x99')](_0x349fc6)[_0xfdd4('0x9a')]()['value']();return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x2a6a0d['params']['id']}})[_0xfdd4('0x27')](function(_0x401681){return db[_0xfdd4('0x6c')][_0xfdd4('0x4d')](function(_0x5a7c85){return _0x401681[_0xfdd4('0x9b')](_0x2a6a0d['query'][_0xfdd4('0x70')],{'transaction':_0x5a7c85})[_0xfdd4('0x27')](function(){if(!_['isEmpty'](_0x5b22b1)){return _0x401681[_0xfdd4('0x73')](_0x5b22b1,{'transaction':_0x5a7c85});}})['then'](function(){_0x5b22b1['forEach'](function(_0x10a396){socket[_0xfdd4('0x71')](_0xfdd4('0x9c'),{'UserId':_0x10a396,'VoicePrefixId':_0x401681['id']});});});});});});})[_0xfdd4('0x27')](respondWithStatusCode(_0x3d82d1,null))['catch'](handleError(_0x3d82d1,null));}; \ No newline at end of file +var _0xed3c=['apply','save','then','destroy','get','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','keys','find','params','describe','create','sequelize','transaction','body','VoiceExtensionId','role','user','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','UserProfileResource','from-sip','app','system','description','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','charAt','update','system-','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','getTeams','addTeams','findAll','Agents','interface','flatMap','each','upsert','UserVoicePrefix','forEach','Team','select','field','tq.TeamId','from','join','user_has_teams','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','union','compact','value','removeTeams','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x4180c1,_0x1499ee){var _0x2ffa6d=function(_0x39fdc7){while(--_0x39fdc7){_0x4180c1['push'](_0x4180c1['shift']());}};_0x2ffa6d(++_0x1499ee);}(_0xed3c,0x1a6));var _0xced3=function(_0x62b58e,_0x46fe1e){_0x62b58e=_0x62b58e-0x0;var _0x37fe84=_0xed3c[_0x62b58e];return _0x37fe84;};'use strict';var emlformat=require(_0xced3('0x0'));var rimraf=require(_0xced3('0x1'));var zipdir=require(_0xced3('0x2'));var jsonpatch=require(_0xced3('0x3'));var rp=require('request-promise');var moment=require(_0xced3('0x4'));var BPromise=require(_0xced3('0x5'));var Mustache=require(_0xced3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xced3('0x7'));var csv=require(_0xced3('0x8'));var ejs=require(_0xced3('0x9'));var fs=require('fs');var fs_extra=require(_0xced3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xced3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xc'));var Redis=require(_0xced3('0xd'));var authService=require(_0xced3('0xe'));var qs=require(_0xced3('0xf'));var as=require(_0xced3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced3('0x11'))(_0xced3('0x12'));var utils=require(_0xced3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xced3('0x14'));var db=require(_0xced3('0x15'))['db'];config[_0xced3('0x16')]=_[_0xced3('0x17')](config[_0xced3('0x16')],{'host':_0xced3('0x18'),'port':0x18eb});var socket=require(_0xced3('0x19'))(new Redis(config['redis']));require(_0xced3('0x1a'))['register'](socket);function respondWithStatusCode(_0xf2db6f,_0x435616){_0x435616=_0x435616||0xcc;return function(_0x20d099){if(_0x20d099){return _0xf2db6f[_0xced3('0x1b')](_0x435616);}return _0xf2db6f['status'](_0x435616)[_0xced3('0x1c')]();};}function respondWithResult(_0x322c2d,_0x4acae6){_0x4acae6=_0x4acae6||0xc8;return function(_0x3b5962){if(_0x3b5962){return _0x322c2d[_0xced3('0x1d')](_0x4acae6)[_0xced3('0x1e')](_0x3b5962);}};}function respondWithFilteredResult(_0x17f611,_0x55dbd5){return function(_0x4569af){if(_0x4569af){var _0x4a3afe=typeof _0x55dbd5[_0xced3('0x1f')]===_0xced3('0x20')&&typeof _0x55dbd5[_0xced3('0x21')]===_0xced3('0x20');var _0x44143f=_0x4569af[_0xced3('0x22')];var _0xe0cf2e=_0x4a3afe?0x0:_0x55dbd5[_0xced3('0x1f')];var _0x3f688c=_0x4a3afe?_0x4569af[_0xced3('0x22')]:_0x55dbd5[_0xced3('0x1f')]+_0x55dbd5['limit'];var _0x5b8b1f;if(_0x3f688c>=_0x44143f){_0x3f688c=_0x44143f;_0x5b8b1f=0xc8;}else{_0x5b8b1f=0xce;}_0x17f611['status'](_0x5b8b1f);return _0x17f611[_0xced3('0x23')](_0xced3('0x24'),_0xe0cf2e+'-'+_0x3f688c+'/'+_0x44143f)[_0xced3('0x1e')](_0x4569af);}return null;};}function patchUpdates(_0x4bf915){return function(_0x19d15c){try{jsonpatch[_0xced3('0x25')](_0x19d15c,_0x4bf915,!![]);}catch(_0x526854){return BPromise['reject'](_0x526854);}return _0x19d15c[_0xced3('0x26')]();};}function saveUpdates(_0x101708,_0x219fa8){return function(_0x15c6c5){if(_0x15c6c5){return _0x15c6c5['update'](_0x101708)[_0xced3('0x27')](function(_0x23f92b){return _0x23f92b;});}return null;};}function removeEntity(_0x4fc285,_0x3fb4f9){return function(_0x4da7ce){if(_0x4da7ce){return _0x4da7ce[_0xced3('0x28')]()[_0xced3('0x27')](function(){var _0x3b728d=_0x4da7ce[_0xced3('0x29')]({'plain':!![]});var _0x2ec2c4='VoicePrefixes';return db['UserProfileResource'][_0xced3('0x28')]({'where':{'type':_0x2ec2c4,'resourceId':_0x3b728d['id']}})['then'](function(){return _0x4da7ce;});})[_0xced3('0x27')](function(){_0x4fc285[_0xced3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3db664,_0x4024fa){return function(_0x196956){if(!_0x196956){_0x3db664[_0xced3('0x1b')](0x194);}return _0x196956;};}function handleError(_0x4389f8,_0x38f594){_0x38f594=_0x38f594||0x1f4;return function(_0x895a32){logger[_0xced3('0x2a')](_0x895a32[_0xced3('0x2b')]);if(_0x895a32['name']){delete _0x895a32[_0xced3('0x2c')];}_0x4389f8[_0xced3('0x1d')](_0x38f594)[_0xced3('0x2d')](_0x895a32);};}exports[_0xced3('0x2e')]=function(_0x111769,_0x21e4a2){var _0x41ce44={},_0x4f2439={},_0xc8e557={'count':0x0,'rows':[]};var _0x30cd7f=_[_0xced3('0x2f')](db[_0xced3('0x30')][_0xced3('0x31')],function(_0x407a24){return{'name':_0x407a24[_0xced3('0x32')],'type':_0x407a24[_0xced3('0x33')][_0xced3('0x34')]};});_0x4f2439[_0xced3('0x35')]=_[_0xced3('0x2f')](_0x30cd7f,_0xced3('0x2c'));_0x4f2439[_0xced3('0x36')]=_['keys'](_0x111769[_0xced3('0x36')]);_0x4f2439['filters']=_[_0xced3('0x37')](_0x4f2439[_0xced3('0x35')],_0x4f2439[_0xced3('0x36')]);_0x41ce44[_0xced3('0x38')]=_[_0xced3('0x37')](_0x4f2439[_0xced3('0x35')],qs[_0xced3('0x39')](_0x111769[_0xced3('0x36')][_0xced3('0x39')]));_0x41ce44[_0xced3('0x38')]=_0x41ce44['attributes'][_0xced3('0x3a')]?_0x41ce44[_0xced3('0x38')]:_0x4f2439['model'];if(!_0x111769[_0xced3('0x36')][_0xced3('0x3b')](_0xced3('0x3c'))){_0x41ce44['limit']=qs['limit'](_0x111769[_0xced3('0x36')]['limit']);_0x41ce44[_0xced3('0x1f')]=qs[_0xced3('0x1f')](_0x111769['query'][_0xced3('0x1f')]);}_0x41ce44[_0xced3('0x3d')]=qs[_0xced3('0x3e')](_0x111769['query'][_0xced3('0x3e')]);_0x41ce44['where']=qs['filters'](_[_0xced3('0x3f')](_0x111769[_0xced3('0x36')],_0x4f2439[_0xced3('0x40')]),_0x30cd7f);if(_0x111769['query'][_0xced3('0x41')]){_0x41ce44[_0xced3('0x42')]=_[_0xced3('0x43')](_0x41ce44[_0xced3('0x42')],{'$or':_[_0xced3('0x2f')](_0x30cd7f,function(_0x2a8e0e){if(_0x2a8e0e[_0xced3('0x33')]!==_0xced3('0x44')){var _0x9c8a07={};_0x9c8a07[_0x2a8e0e[_0xced3('0x2c')]]={'$like':'%'+_0x111769[_0xced3('0x36')][_0xced3('0x41')]+'%'};return _0x9c8a07;}})});}_0x41ce44=_[_0xced3('0x43')]({},_0x41ce44,_0x111769[_0xced3('0x45')]);var _0x1ced3a={'where':_0x41ce44['where']};return db[_0xced3('0x30')][_0xced3('0x22')](_0x1ced3a)[_0xced3('0x27')](function(_0x1a6c1f){_0xc8e557[_0xced3('0x22')]=_0x1a6c1f;if(_0x111769[_0xced3('0x36')][_0xced3('0x46')]){_0x41ce44[_0xced3('0x47')]=[{'all':!![]}];}return db[_0xced3('0x30')]['findAll'](_0x41ce44);})[_0xced3('0x27')](function(_0x47ab23){_0xc8e557[_0xced3('0x48')]=_0x47ab23;return _0xc8e557;})[_0xced3('0x27')](respondWithFilteredResult(_0x21e4a2,_0x41ce44))[_0xced3('0x49')](handleError(_0x21e4a2,null));};exports['show']=function(_0x11e733,_0x34f24a){var _0x3569f3={'raw':![],'where':{'id':_0x11e733['params']['id']}},_0x26b8ac={};_0x26b8ac[_0xced3('0x35')]=_[_0xced3('0x4a')](db[_0xced3('0x30')][_0xced3('0x31')]);_0x26b8ac[_0xced3('0x36')]=_['keys'](_0x11e733[_0xced3('0x36')]);_0x26b8ac[_0xced3('0x40')]=_[_0xced3('0x37')](_0x26b8ac[_0xced3('0x35')],_0x26b8ac[_0xced3('0x36')]);_0x3569f3[_0xced3('0x38')]=_[_0xced3('0x37')](_0x26b8ac['model'],qs[_0xced3('0x39')](_0x11e733[_0xced3('0x36')]['fields']));_0x3569f3['attributes']=_0x3569f3[_0xced3('0x38')]['length']?_0x3569f3[_0xced3('0x38')]:_0x26b8ac[_0xced3('0x35')];if(_0x11e733[_0xced3('0x36')][_0xced3('0x46')]){_0x3569f3[_0xced3('0x47')]=[{'all':!![]}];}_0x3569f3=_[_0xced3('0x43')]({},_0x3569f3,_0x11e733[_0xced3('0x45')]);return db[_0xced3('0x30')][_0xced3('0x4b')](_0x3569f3)['then'](handleEntityNotFound(_0x34f24a,null))[_0xced3('0x27')](respondWithResult(_0x34f24a,null))[_0xced3('0x49')](handleError(_0x34f24a,null));};exports[_0xced3('0x28')]=function(_0x469b6,_0x24ee62){return db[_0xced3('0x30')]['find']({'where':{'id':_0x469b6[_0xced3('0x4c')]['id']}})[_0xced3('0x27')](handleEntityNotFound(_0x24ee62,null))[_0xced3('0x27')](removeEntity(_0x24ee62,null))[_0xced3('0x49')](handleError(_0x24ee62,null));};exports[_0xced3('0x4d')]=function(_0x14dbfe,_0x1543b0){return db[_0xced3('0x30')][_0xced3('0x4d')]()[_0xced3('0x27')](respondWithResult(_0x1543b0,null))[_0xced3('0x49')](handleError(_0x1543b0,null));};exports[_0xced3('0x4e')]=function(_0x4a9111,_0x1c69df){var _0x4bd3cb;return db[_0xced3('0x4f')][_0xced3('0x50')](function(_0xc93e05){return db['VoicePrefix']['create'](_0x4a9111[_0xced3('0x51')],{'transaction':_0xc93e05})[_0xced3('0x27')](function(_0x53724a){_0x4bd3cb=_0x53724a[_0xced3('0x29')]({'plain':!![]});return db['VoiceExtension'][_0xced3('0x4b')]({'where':{'id':_0x4bd3cb[_0xced3('0x52')]},'raw':!![]})['then'](function(_0x1627f9){return createVoicePrefixExtensions(_0x4bd3cb,_0x1627f9,_0xc93e05);});});})[_0xced3('0x27')](function(){var _0xf4d7bf=_0x4a9111['user'][_0xced3('0x29')]({'plain':!![]});if(!_0xf4d7bf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf4d7bf[_0xced3('0x53')]===_0xced3('0x54')){var _0x4694b8=_0x4bd3cb;return db[_0xced3('0x55')][_0xced3('0x4b')]({'where':{'name':_0xced3('0x56'),'userProfileId':_0xf4d7bf[_0xced3('0x57')]},'raw':!![]})[_0xced3('0x27')](function(_0x1b2592){if(_0x1b2592&&_0x1b2592[_0xced3('0x58')]===0x0){return db[_0xced3('0x59')]['create']({'name':_0x4694b8[_0xced3('0x2c')],'resourceId':_0x4694b8['id'],'type':_0x1b2592[_0xced3('0x2c')],'sectionId':_0x1b2592['id']},{})[_0xced3('0x27')](function(){return _0x4bd3cb;});}else{return _0x4bd3cb;}})[_0xced3('0x49')](function(_0x21a22d){logger[_0xced3('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21a22d);throw _0x21a22d;});}return _0x4bd3cb;})[_0xced3('0x27')](respondWithResult(_0x1c69df,null))[_0xced3('0x49')](handleError(_0x1c69df,null));};function Extension(_0x21ea6a,_0x440a0f,_0x443469,_0x1537ca){this['context']=_0xced3('0x5a');this['exten']=_0x21ea6a;this[_0xced3('0x5b')]=_0x443469;this['type']=_0xced3('0x5c');this[_0xced3('0x5d')]='Voice\x20Prefix\x20Extension';this[_0xced3('0x5e')]=_0x440a0f;this[_0xced3('0x5f')]=_0x1537ca;}function createVoicePrefixExtensions(_0x76d1f6,_0x3bb7d5,_0x1ec94b){return new BPromise(function(_0x21eeec,_0x2318a0){var _0x206dd3=new Extension(formatPrefixName(_0x76d1f6[_0xced3('0x60')]),0x1,_0xced3('0x61'),_0xced3('0x62'));_0x206dd3[_0xced3('0x63')]=_0x76d1f6['id'];return db[_0xced3('0x64')]['create'](_0x206dd3,{'transaction':_0x1ec94b})[_0xced3('0x27')](function(_0xb2b5d7){var _0x2857c8=_0xb2b5d7[_0xced3('0x29')]({'plain':!![]});var _0x4f8a3f=_[_0xced3('0x2f')](addVoicePrefixExtensions(_0x76d1f6,_0x3bb7d5),function(_0x979b24){_0x979b24[_0xced3('0x52')]=_0x2857c8['id'];_0x979b24[_0xced3('0x63')]=_0x76d1f6['id'];return _0x979b24;});return db[_0xced3('0x64')][_0xced3('0x65')](_0x4f8a3f,{'transaction':_0x1ec94b})[_0xced3('0x27')](function(_0x4df923){if(!_0x4df923){return _0x2318a0(_0xced3('0x66'));}else{return _0x21eeec(_0x4df923);}})[_0xced3('0x49')](function(_0x5db4eb){return _0x2318a0(_0x5db4eb);});});;});};function addVoicePrefixExtensions(_0x1630d7,_0xde15b5){var _0x3a9dac=[];var _0x2ac060=formatPrefixName(_0x1630d7['prefix']);_0x3a9dac[_0xced3('0x67')](new Extension(_0x2ac060,0x2,_0xced3('0x68'),_0xced3('0x69')+_0x1630d7[_0xced3('0x2c')]));if(_0x1630d7[_0xced3('0x6a')]){_0x3a9dac[_0xced3('0x67')](new Extension(_0x2ac060,0x3,_0xced3('0x68'),_0xced3('0x6b')+_0x1630d7[_0xced3('0x6a')]));}else{_0x3a9dac[_0xced3('0x67')](new Extension(_0x2ac060,0x3,'NoOp',_0xced3('0x6c')));}_0x3a9dac[_0xced3('0x67')](new Extension(_0x2ac060,0x4,'goto',_0xde15b5['context']+','+_0xced3('0x6d')+(0x8+_0x1630d7['name'][_0xced3('0x3a')])+'}'+','+0x1));return _0x3a9dac;}function formatPrefixName(_0x256216){var _0x5e3d3d='_';for(var _0x2936b5=0x0;_0x2936b5<_0x256216[_0xced3('0x3a')];_0x2936b5++){if(_0x256216['charAt'](_0x2936b5)=='-'){_0x5e3d3d+=_0x256216[_0xced3('0x6e')](_0x2936b5);}else{_0x5e3d3d+='['+_0x256216['charAt'](_0x2936b5)+']';}}_0x5e3d3d+='.';return _0x5e3d3d;}exports[_0xced3('0x6f')]=function(_0x58b66b,_0xf8ccc6,_0x3c9de8){var _0x11f393=_0x58b66b['body'];_0x11f393[_0xced3('0x60')]=_0xced3('0x70')+_0x11f393[_0xced3('0x2c')]+'-';return db['sequelize'][_0xced3('0x50')](function(_0x1abe1a){return db[_0xced3('0x30')][_0xced3('0x6f')](_0x11f393,{'where':{'id':_0x11f393['id']},'transaction':_0x1abe1a})['then'](function(){return db['VoiceExtension'][_0xced3('0x28')]({'where':{'VoicePrefixId':_0x11f393['id']},'transaction':_0x1abe1a})[_0xced3('0x27')](function(){return db[_0xced3('0x64')][_0xced3('0x4b')]({'where':{'id':_0x11f393[_0xced3('0x52')]},'raw':!![]})[_0xced3('0x27')](function(_0x55da18){return createVoicePrefixExtensions(_0x11f393,_0x55da18,_0x1abe1a);});});});})[_0xced3('0x27')](function(){return db['VoicePrefix'][_0xced3('0x71')](_0x11f393['id']);})[_0xced3('0x27')](respondWithResult(_0xf8ccc6,null))[_0xced3('0x49')](handleError(_0xf8ccc6,null));};exports[_0xced3('0x72')]=function(_0x569055,_0x24d0ad,_0x22e74d){return db['VoicePrefix']['find']({'where':{'id':_0x569055[_0xced3('0x4c')]['id']}})[_0xced3('0x27')](handleEntityNotFound(_0x24d0ad,null))[_0xced3('0x27')](function(_0x138e25){if(_0x138e25){return _0x138e25[_0xced3('0x72')](_0x569055['body'][_0xced3('0x73')],_[_0xced3('0x74')](_0x569055[_0xced3('0x51')],[_0xced3('0x73'),'id'])||{})['spread'](function(_0x13020d){for(var _0x1777eb=0x0;_0x1777eb<_0x569055[_0xced3('0x51')][_0xced3('0x73')][_0xced3('0x3a')];_0x1777eb+=0x1){socket[_0xced3('0x75')](_0xced3('0x76'),{'UserId':Number(_0x569055[_0xced3('0x51')][_0xced3('0x73')][_0x1777eb]),'VoicePrefixId':Number(_0x569055[_0xced3('0x4c')]['id'])});}return _0x13020d;});}})['then'](respondWithResult(_0x24d0ad,null))[_0xced3('0x49')](handleError(_0x24d0ad,null));};exports[_0xced3('0x77')]=function(_0x498ea9,_0x284cf2,_0xeef6f4){return db[_0xced3('0x30')][_0xced3('0x4b')]({'where':{'id':_0x498ea9[_0xced3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x284cf2,null))[_0xced3('0x27')](function(_0x3e561e){if(_0x3e561e){return _0x3e561e['removeAgents'](_0x498ea9[_0xced3('0x36')][_0xced3('0x73')])[_0xced3('0x27')](function(){if(_[_0xced3('0x78')](_0x498ea9[_0xced3('0x36')][_0xced3('0x73')])){for(var _0x5c68e1=0x0;_0x5c68e1<_0x498ea9[_0xced3('0x36')][_0xced3('0x73')][_0xced3('0x3a')];_0x5c68e1+=0x1){socket[_0xced3('0x75')](_0xced3('0x79'),{'UserId':Number(_0x498ea9[_0xced3('0x36')]['ids'][_0x5c68e1]),'VoicePrefixId':Number(_0x498ea9['params']['id'])});}}else{socket[_0xced3('0x75')](_0xced3('0x79'),{'UserId':Number(_0x498ea9[_0xced3('0x36')][_0xced3('0x73')]),'VoicePrefixId':Number(_0x498ea9[_0xced3('0x4c')]['id'])});}});}})[_0xced3('0x27')](respondWithStatusCode(_0x284cf2,null))[_0xced3('0x49')](handleError(_0x284cf2,null));};exports['getAgents']=function(_0x3d64ec,_0x290ca3,_0x51979a){var _0x5de22d={};var _0x12de12={};var _0x29f8b5;var _0x3b07ac;return db[_0xced3('0x30')][_0xced3('0x7a')]({'where':{'id':_0x3d64ec['params']['id']}})[_0xced3('0x27')](handleEntityNotFound(_0x290ca3,null))['then'](function(_0x34edbf){if(_0x34edbf){_0x29f8b5=_0x34edbf;_0x12de12[_0xced3('0x35')]=_[_0xced3('0x4a')](db[_0xced3('0x7b')][_0xced3('0x31')]);_0x12de12['query']=_[_0xced3('0x4a')](_0x3d64ec[_0xced3('0x36')]);_0x12de12[_0xced3('0x40')]=_[_0xced3('0x37')](_0x12de12['model'],_0x12de12['query']);_0x5de22d[_0xced3('0x38')]=_[_0xced3('0x37')](_0x12de12[_0xced3('0x35')],qs[_0xced3('0x39')](_0x3d64ec[_0xced3('0x36')][_0xced3('0x39')]));_0x5de22d[_0xced3('0x38')]=_0x5de22d[_0xced3('0x38')]['length']?_0x5de22d['attributes']:_0x12de12[_0xced3('0x35')];_0x5de22d[_0xced3('0x3d')]=qs[_0xced3('0x3e')](_0x3d64ec[_0xced3('0x36')][_0xced3('0x3e')]);_0x5de22d[_0xced3('0x42')]=qs[_0xced3('0x40')](_[_0xced3('0x3f')](_0x3d64ec[_0xced3('0x36')],_0x12de12[_0xced3('0x40')]));if(_0x3d64ec[_0xced3('0x36')]['filter']){_0x5de22d[_0xced3('0x42')]=_['merge'](_0x5de22d[_0xced3('0x42')],{'$or':_[_0xced3('0x2f')](_0x5de22d[_0xced3('0x38')],function(_0x3ad616){var _0x1df2d1={};_0x1df2d1[_0x3ad616]={'$like':'%'+_0x3d64ec[_0xced3('0x36')][_0xced3('0x41')]+'%'};return _0x1df2d1;})});}_0x5de22d=_[_0xced3('0x43')]({},_0x5de22d,_0x3d64ec[_0xced3('0x45')]);return _0x29f8b5[_0xced3('0x7c')](_0x5de22d);}})[_0xced3('0x27')](function(_0x3869f3){if(_0x3869f3){_0x3b07ac=_0x3869f3[_0xced3('0x3a')];if(!_0x3d64ec[_0xced3('0x36')][_0xced3('0x3b')](_0xced3('0x3c'))){_0x5de22d[_0xced3('0x21')]=qs['limit'](_0x3d64ec['query']['limit']);_0x5de22d[_0xced3('0x1f')]=qs[_0xced3('0x1f')](_0x3d64ec[_0xced3('0x36')][_0xced3('0x1f')]);}return _0x29f8b5[_0xced3('0x7c')](_0x5de22d);}})[_0xced3('0x27')](function(_0x587891){if(_0x587891){return _0x587891?{'count':_0x3b07ac,'rows':_0x587891}:null;}})[_0xced3('0x27')](respondWithResult(_0x290ca3,null))[_0xced3('0x49')](handleError(_0x290ca3,null));};exports['getTeams']=function(_0x5e6a80,_0x451c1a,_0x3284da){var _0x34ebbd={};var _0x4412cc={};var _0x3e5f7f;var _0x3b3a5c;return db['VoicePrefix'][_0xced3('0x7a')]({'where':{'id':_0x5e6a80['params']['id']}})[_0xced3('0x27')](handleEntityNotFound(_0x451c1a,null))[_0xced3('0x27')](function(_0x44a80b){if(_0x44a80b){_0x3e5f7f=_0x44a80b;_0x4412cc['model']=_['keys'](db['Team'][_0xced3('0x31')]);_0x4412cc[_0xced3('0x36')]=_['keys'](_0x5e6a80[_0xced3('0x36')]);_0x4412cc[_0xced3('0x40')]=_['intersection'](_0x4412cc[_0xced3('0x35')],_0x4412cc[_0xced3('0x36')]);_0x34ebbd[_0xced3('0x38')]=_[_0xced3('0x37')](_0x4412cc[_0xced3('0x35')],qs[_0xced3('0x39')](_0x5e6a80[_0xced3('0x36')][_0xced3('0x39')]));_0x34ebbd['attributes']=_0x34ebbd[_0xced3('0x38')][_0xced3('0x3a')]?_0x34ebbd[_0xced3('0x38')]:_0x4412cc[_0xced3('0x35')];_0x34ebbd[_0xced3('0x3d')]=qs[_0xced3('0x3e')](_0x5e6a80[_0xced3('0x36')][_0xced3('0x3e')]);_0x34ebbd[_0xced3('0x42')]=qs[_0xced3('0x40')](_[_0xced3('0x3f')](_0x5e6a80[_0xced3('0x36')],_0x4412cc[_0xced3('0x40')]));if(_0x5e6a80[_0xced3('0x36')][_0xced3('0x41')]){_0x34ebbd['where']=_[_0xced3('0x43')](_0x34ebbd[_0xced3('0x42')],{'$or':_[_0xced3('0x2f')](_0x34ebbd[_0xced3('0x38')],function(_0x2c59f5){var _0x5874b5={};_0x5874b5[_0x2c59f5]={'$like':'%'+_0x5e6a80['query'][_0xced3('0x41')]+'%'};return _0x5874b5;})});}_0x34ebbd=_[_0xced3('0x43')]({},_0x34ebbd,_0x5e6a80[_0xced3('0x45')]);return _0x3e5f7f[_0xced3('0x7d')](_0x34ebbd);}})[_0xced3('0x27')](function(_0x26920d){if(_0x26920d){_0x3b3a5c=_0x26920d[_0xced3('0x3a')];if(!_0x5e6a80['query']['hasOwnProperty'](_0xced3('0x3c'))){_0x34ebbd['limit']=qs[_0xced3('0x21')](_0x5e6a80[_0xced3('0x36')][_0xced3('0x21')]);_0x34ebbd[_0xced3('0x1f')]=qs[_0xced3('0x1f')](_0x5e6a80[_0xced3('0x36')][_0xced3('0x1f')]);}return _0x3e5f7f[_0xced3('0x7d')](_0x34ebbd);}})[_0xced3('0x27')](function(_0x2b688c){if(_0x2b688c){return _0x2b688c?{'count':_0x3b3a5c,'rows':_0x2b688c}:null;}})[_0xced3('0x27')](respondWithResult(_0x451c1a,null))[_0xced3('0x49')](handleError(_0x451c1a,null));};exports[_0xced3('0x7e')]=function(_0xbd91ef,_0x561aca,_0x4b2f62){var _0x361c6f=_0xbd91ef['body'][_0xced3('0x73')];var _0x4f0fcb;return db['Team'][_0xced3('0x7f')]({'where':{'id':_0x361c6f},'attributes':['id'],'include':[{'model':db[_0xced3('0x7b')],'as':_0xced3('0x80'),'attributes':['id',_0xced3('0x2c'),'online','voicePause',_0xced3('0x81')],'raw':!![]}]})[_0xced3('0x27')](function(_0x2f2f77){if(_0x2f2f77){_0x4f0fcb=_0x2f2f77;var _0x5448d5=_[_0xced3('0x82')](_0x2f2f77,function(_0x50cc83){var _0x4b6afc=_0x50cc83[_0xced3('0x29')]({'plain':!![]});return _0x4b6afc[_0xced3('0x80')];});return db[_0xced3('0x30')][_0xced3('0x4b')]({'where':{'id':_0xbd91ef[_0xced3('0x4c')]['id']}})[_0xced3('0x27')](function(_0x420c12){return db[_0xced3('0x4f')]['transaction'](function(_0x566191){return _0x420c12[_0xced3('0x7e')](_0x361c6f,{'transaction':_0x566191})['then'](function(){return BPromise[_0xced3('0x83')](_0x4f0fcb,function(_0x239dda){return db['TeamVoicePrefix'][_0xced3('0x84')]({'TeamId':_0x239dda['id'],'VoicePrefixId':_0xbd91ef[_0xced3('0x4c')]['id']},{'transaction':_0x566191});});})[_0xced3('0x27')](function(){return BPromise[_0xced3('0x83')](_0x5448d5,function(_0x7fb3c7){return db[_0xced3('0x85')]['findOrCreate']({'where':{'UserId':_0x7fb3c7['id'],'VoicePrefixId':_0xbd91ef[_0xced3('0x4c')]['id']},'transaction':_0x566191});});})[_0xced3('0x27')](function(){_0x5448d5[_0xced3('0x86')](function(_0x3d88fc){socket[_0xced3('0x75')](_0xced3('0x76'),{'UserId':_0x3d88fc['id'],'VoicePrefixId':_0x420c12['id']});});});});});}})['then'](respondWithStatusCode(_0x561aca,null))['catch'](handleError(_0x561aca,null));};exports['removeTeams']=function(_0x4074b9,_0x2e2303,_0x26af34){return db[_0xced3('0x87')][_0xced3('0x7f')]({'where':{'id':_0x4074b9['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xced3('0x7b')],'as':_0xced3('0x80'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2e2303,null))['then'](function(_0xdec3b0){var _0x38a06b=_[_0xced3('0x2f')](_0xdec3b0,'id');var _0xbeffe6=[];var _0x2211ed=[];var _0x22ab59=squel[_0xced3('0x88')]();_0x22ab59[_0xced3('0x89')](_0xced3('0x8a'))[_0xced3('0x8b')]('team_has_voice_prefixes','tq')[_0xced3('0x8c')](_0xced3('0x8d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xced3('0x42')](_0xced3('0x8e'),_0x4074b9[_0xced3('0x4c')]['id']);for(var _0x268c72=0x0;_0x268c72<_0xdec3b0[_0xced3('0x3a')];_0x268c72+=0x1){let _0x26daab=_0xdec3b0[_0x268c72];for(var _0x1ab60d=0x0;_0x1ab60d<_0x26daab[_0xced3('0x80')]['length'];_0x1ab60d+=0x1){let _0x5dd10b=_0x26daab[_0xced3('0x80')][_0x1ab60d];var _0x173a37=_0x22ab59['clone']();_0x173a37[_0xced3('0x42')](_0xced3('0x8f'),_0x5dd10b['id']);_0x2211ed[_0xced3('0x67')](db[_0xced3('0x4f')][_0xced3('0x36')](_0x173a37[_0xced3('0x90')](),{'type':db['sequelize'][_0xced3('0x91')]['SELECT']})['then'](function(_0x2ed48f){if(_0x2ed48f[_0xced3('0x3a')]===0x1){return _0x5dd10b['id'];}else{var _0x21f013=_[_0xced3('0x92')](_['map'](_0x2ed48f,_0xced3('0x93')),function(_0x1082c0){return _['includes'](_0x38a06b,_0x1082c0);});if(_0x21f013){return _0x5dd10b['id'];}}}));}}return BPromise['all'](_0x2211ed)['then'](function(_0x3e8ed7){_0xbeffe6=_(_0xbeffe6)[_0xced3('0x94')](_0x3e8ed7)[_0xced3('0x95')]()[_0xced3('0x96')]();return db[_0xced3('0x30')][_0xced3('0x4b')]({'where':{'id':_0x4074b9[_0xced3('0x4c')]['id']}})[_0xced3('0x27')](function(_0x235faa){return db[_0xced3('0x4f')]['transaction'](function(_0x5e9fba){return _0x235faa[_0xced3('0x97')](_0x4074b9[_0xced3('0x36')]['ids'],{'transaction':_0x5e9fba})['then'](function(){if(!_[_0xced3('0x98')](_0xbeffe6)){return _0x235faa[_0xced3('0x77')](_0xbeffe6,{'transaction':_0x5e9fba});}})[_0xced3('0x27')](function(){_0xbeffe6['forEach'](function(_0x473c70){socket['emit'](_0xced3('0x79'),{'UserId':_0x473c70,'VoicePrefixId':_0x235faa['id']});});});});});});})['then'](respondWithStatusCode(_0x2e2303,null))[_0xced3('0x49')](handleError(_0x2e2303,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index a0629c8..bbf9c41 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 _0xfee3=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x2547d9,_0x549d18){var _0x467c83=function(_0x1ac313){while(--_0x1ac313){_0x2547d9['push'](_0x2547d9['shift']());}};_0x467c83(++_0x549d18);}(_0xfee3,0x157));var _0x3fee=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0xfee3[_0x382c73];return _0x1dd0bf;};'use strict';var EventEmitter=require(_0x3fee('0x0'));var VoicePrefix=require(_0x3fee('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x3fee('0x2')](0x0);var events={'afterCreate':_0x3fee('0x3'),'afterUpdate':_0x3fee('0x4'),'afterDestroy':_0x3fee('0x5')};function emitEvent(_0x357959){return function(_0x516c9c,_0x373270,_0x575043){VoicePrefixEvents[_0x3fee('0x6')](_0x357959+':'+_0x516c9c['id'],_0x516c9c);VoicePrefixEvents[_0x3fee('0x6')](_0x357959,_0x516c9c);_0x575043(null);};}for(var e in events){if(events[_0x3fee('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x3fee('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0xa8ad=['setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb','VoicePrefix'];(function(_0x5dae9f,_0x40328c){var _0x520c0e=function(_0x3dc654){while(--_0x3dc654){_0x5dae9f['push'](_0x5dae9f['shift']());}};_0x520c0e(++_0x40328c);}(_0xa8ad,0x15c));var _0xda8a=function(_0x4bc97a,_0xea193f){_0x4bc97a=_0x4bc97a-0x0;var _0x593c93=_0xa8ad[_0x4bc97a];return _0x593c93;};'use strict';var EventEmitter=require(_0xda8a('0x0'));var VoicePrefix=require(_0xda8a('0x1'))['db'][_0xda8a('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xda8a('0x3')](0x0);var events={'afterCreate':_0xda8a('0x4'),'afterUpdate':'update','afterDestroy':_0xda8a('0x5')};function emitEvent(_0x5e3735){return function(_0x5d961e,_0x1cf72f,_0x4544c5){VoicePrefixEvents[_0xda8a('0x6')](_0x5e3735+':'+_0x5d961e['id'],_0x5d961e);VoicePrefixEvents[_0xda8a('0x6')](_0x5e3735,_0x5d961e);_0x4544c5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0xda8a('0x7')](e,emitEvent(event));}}module[_0xda8a('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 6e0ff6f..0a5f644 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 _0x03bc=['lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./voicePrefix.attributes','exports','define','voice_prefixes'];(function(_0x394036,_0x16a1cc){var _0x338f5c=function(_0x44d6d1){while(--_0x44d6d1){_0x394036['push'](_0x394036['shift']());}};_0x338f5c(++_0x16a1cc);}(_0x03bc,0x108));var _0xc03b=function(_0x3aea7c,_0x507688){_0x3aea7c=_0x3aea7c-0x0;var _0x8b31cc=_0x03bc[_0x3aea7c];return _0x8b31cc;};'use strict';var _=require(_0xc03b('0x0'));var util=require(_0xc03b('0x1'));var logger=require(_0xc03b('0x2'))('api');var moment=require(_0xc03b('0x3'));var BPromise=require(_0xc03b('0x4'));var rp=require(_0xc03b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xc03b('0x6'));var attributes=require(_0xc03b('0x7'));module[_0xc03b('0x8')]=function(_0x126a3b,_0xb7f467){return _0x126a3b[_0xc03b('0x9')]('VoicePrefix',attributes,{'tableName':_0xc03b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa597=['./voicePrefix.attributes','exports','define','VoicePrefix','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1720a2,_0x5e3976){var _0x5b386=function(_0x291261){while(--_0x291261){_0x1720a2['push'](_0x1720a2['shift']());}};_0x5b386(++_0x5e3976);}(_0xa597,0x12f));var _0x7a59=function(_0x2f42d3,_0x362e7a){_0x2f42d3=_0x2f42d3-0x0;var _0x25a67e=_0xa597[_0x2f42d3];return _0x25a67e;};'use strict';var _=require(_0x7a59('0x0'));var util=require('util');var logger=require(_0x7a59('0x1'))(_0x7a59('0x2'));var moment=require(_0x7a59('0x3'));var BPromise=require(_0x7a59('0x4'));var rp=require(_0x7a59('0x5'));var fs=require('fs');var path=require(_0x7a59('0x6'));var rimraf=require(_0x7a59('0x7'));var config=require(_0x7a59('0x8'));var attributes=require(_0x7a59('0x9'));module[_0x7a59('0xa')]=function(_0x4f0c3f,_0xa55a1){return _0x4f0c3f[_0x7a59('0xb')](_0x7a59('0xc'),attributes,{'tableName':'voice_prefixes','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 bc6c516..90196c7 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 _0x4d49=['then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register'];(function(_0x5bd303,_0x387d15){var _0xe3b303=function(_0x3cd6f8){while(--_0x3cd6f8){_0x5bd303['push'](_0x5bd303['shift']());}};_0xe3b303(++_0x387d15);}(_0x4d49,0x141));var _0x94d4=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4d49[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x94d4('0x0'));var moment=require('moment');var BPromise=require(_0x94d4('0x1'));var rs=require(_0x94d4('0x2'));var fs=require('fs');var Redis=require(_0x94d4('0x3'));var db=require(_0x94d4('0x4'))['db'];var utils=require(_0x94d4('0x5'));var logger=require(_0x94d4('0x6'))(_0x94d4('0x7'));var config=require(_0x94d4('0x8'));var jayson=require(_0x94d4('0x9'));var client=jayson['client'][_0x94d4('0xa')]({'port':0x232a});config[_0x94d4('0xb')]=_[_0x94d4('0xc')](config[_0x94d4('0xb')],{'host':_0x94d4('0xd'),'port':0x18eb});var socket=require(_0x94d4('0xe'))(new Redis(config['redis']));require(_0x94d4('0xf'))[_0x94d4('0x10')](socket);function respondWithRpcPromise(_0x562265,_0x23ef86,_0x283f63){return new BPromise(function(_0xd7820d,_0x2720dd){return client['request'](_0x562265,_0x283f63)[_0x94d4('0x11')](function(_0xe7f878){logger[_0x94d4('0x12')](_0x94d4('0x13'),_0x23ef86,_0x94d4('0x14'));logger[_0x94d4('0x15')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x23ef86,'request\x20sent',JSON['stringify'](_0xe7f878));if(_0xe7f878[_0x94d4('0x16')]){if(_0xe7f878[_0x94d4('0x16')]['code']===0x1f4){logger[_0x94d4('0x16')](_0x94d4('0x13'),_0x23ef86,_0xe7f878['error'][_0x94d4('0x17')]);return _0x2720dd(_0xe7f878['error'][_0x94d4('0x17')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x23ef86,_0xe7f878['error'][_0x94d4('0x17')]);return _0xd7820d(_0xe7f878[_0x94d4('0x16')][_0x94d4('0x17')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x23ef86,'request\x20sent');_0xd7820d(_0xe7f878[_0x94d4('0x18')][_0x94d4('0x17')]);}})[_0x94d4('0x19')](function(_0x47b760){logger[_0x94d4('0x16')](_0x94d4('0x13'),_0x23ef86,_0x47b760);_0x2720dd(_0x47b760);});});} \ No newline at end of file +var _0x3d49=['request','then','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','socket.io-emitter','redis','./voicePrefix.socket','register'];(function(_0x5135e1,_0x28957a){var _0x541326=function(_0x21800a){while(--_0x21800a){_0x5135e1['push'](_0x5135e1['shift']());}};_0x541326(++_0x28957a);}(_0x3d49,0x151));var _0x93d4=function(_0x477c0c,_0x48b400){_0x477c0c=_0x477c0c-0x0;var _0x37d540=_0x3d49[_0x477c0c];return _0x37d540;};'use strict';var _=require('lodash');var util=require(_0x93d4('0x0'));var moment=require(_0x93d4('0x1'));var BPromise=require(_0x93d4('0x2'));var rs=require(_0x93d4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93d4('0x4'))['db'];var utils=require(_0x93d4('0x5'));var logger=require(_0x93d4('0x6'))(_0x93d4('0x7'));var config=require(_0x93d4('0x8'));var jayson=require(_0x93d4('0x9'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x93d4('0xa'))(new Redis(config[_0x93d4('0xb')]));require(_0x93d4('0xc'))[_0x93d4('0xd')](socket);function respondWithRpcPromise(_0x15f0c2,_0x174c6d,_0x1fcdd0){return new BPromise(function(_0x2db63a,_0x39d3a6){return client[_0x93d4('0xe')](_0x15f0c2,_0x1fcdd0)[_0x93d4('0xf')](function(_0xeabf99){logger['info'](_0x93d4('0x10'),_0x174c6d,'request\x20sent');logger[_0x93d4('0x11')](_0x93d4('0x12'),_0x174c6d,_0x93d4('0x13'),JSON[_0x93d4('0x14')](_0xeabf99));if(_0xeabf99['error']){if(_0xeabf99[_0x93d4('0x15')][_0x93d4('0x16')]===0x1f4){logger['error'](_0x93d4('0x10'),_0x174c6d,_0xeabf99[_0x93d4('0x15')][_0x93d4('0x17')]);return _0x39d3a6(_0xeabf99[_0x93d4('0x15')][_0x93d4('0x17')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x174c6d,_0xeabf99[_0x93d4('0x15')]['message']);return _0x2db63a(_0xeabf99[_0x93d4('0x15')][_0x93d4('0x17')]);}else{logger[_0x93d4('0x18')](_0x93d4('0x10'),_0x174c6d,_0x93d4('0x13'));_0x2db63a(_0xeabf99[_0x93d4('0x19')]['message']);}})[_0x93d4('0x1a')](function(_0x58410f){logger[_0x93d4('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x174c6d,_0x58410f);_0x39d3a6(_0x58410f);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 4e6adc4..85ba860 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 _0xb49a=['save','remove','update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events'];(function(_0x5fb7a4,_0x127dc7){var _0x1c468c=function(_0x1a61ee){while(--_0x1a61ee){_0x5fb7a4['push'](_0x5fb7a4['shift']());}};_0x1c468c(++_0x127dc7);}(_0xb49a,0xfb));var _0xab49=function(_0x406d39,_0xd3c8f1){_0x406d39=_0x406d39-0x0;var _0x2eb792=_0xb49a[_0x406d39];return _0x2eb792;};'use strict';var VoicePrefixEvents=require(_0xab49('0x0'));var events=[_0xab49('0x1'),_0xab49('0x2'),_0xab49('0x3')];function createListener(_0x8db649,_0x55d01b){return function(_0x4387a5){_0x55d01b[_0xab49('0x4')](_0x8db649,_0x4387a5);};}function removeListener(_0x5554fe,_0x543eb0){return function(){VoicePrefixEvents[_0xab49('0x5')](_0x5554fe,_0x543eb0);};}exports[_0xab49('0x6')]=function(_0x1cae1d){for(var _0x3703cb=0x0,_0x57ea72=events[_0xab49('0x7')];_0x3703cb<_0x57ea72;_0x3703cb++){var _0xd86a5=events[_0x3703cb];var _0x4d4d00=createListener(_0xab49('0x8')+_0xd86a5,_0x1cae1d);VoicePrefixEvents['on'](_0xd86a5,_0x4d4d00);}}; \ No newline at end of file +var _0xd624=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','update','emit'];(function(_0x213bbd,_0x5a610b){var _0x479862=function(_0x409563){while(--_0x409563){_0x213bbd['push'](_0x213bbd['shift']());}};_0x479862(++_0x5a610b);}(_0xd624,0x124));var _0x4d62=function(_0x3208e6,_0x4cb369){_0x3208e6=_0x3208e6-0x0;var _0x351877=_0xd624[_0x3208e6];return _0x351877;};'use strict';var VoicePrefixEvents=require(_0x4d62('0x0'));var events=[_0x4d62('0x1'),'remove',_0x4d62('0x2')];function createListener(_0x49d13e,_0x4e653d){return function(_0x5e3d4c){_0x4e653d[_0x4d62('0x3')](_0x49d13e,_0x5e3d4c);};}function removeListener(_0x30e07b,_0x231932){return function(){VoicePrefixEvents[_0x4d62('0x4')](_0x30e07b,_0x231932);};}exports[_0x4d62('0x5')]=function(_0x2582df){for(var _0x4f934c=0x0,_0x4ba7a1=events[_0x4d62('0x6')];_0x4f934c<_0x4ba7a1;_0x4f934c++){var _0x3d6f78=events[_0x4f934c];var _0x12bf3c=createListener(_0x4d62('0x7')+_0x3d6f78,_0x2582df);VoicePrefixEvents['on'](_0x3d6f78,_0x12bf3c);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index c622f79..21050bf 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 _0xce32=['getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addAgents','addLists','/:id/blacklists','addBlackLists','put','update','destroy','removeTeams','delete','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout','../../components/auth/service','get','isAuthenticated','index','/:id','show','/:id/hoppers'];(function(_0x3a8ce2,_0x552ad5){var _0x2e5a45=function(_0x5de5ed){while(--_0x5de5ed){_0x3a8ce2['push'](_0x3a8ce2['shift']());}};_0x2e5a45(++_0x552ad5);}(_0xce32,0x96));var _0x2ce3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce32[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2ce3('0x0'));var util=require('util');var path=require(_0x2ce3('0x1'));var timeout=require(_0x2ce3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2ce3('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceQueue.controller');router[_0x2ce3('0x4')]('/',auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x6')]);router['get'](_0x2ce3('0x7'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x8')]);router['get'](_0x2ce3('0x9'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0xa')]);router['get'](_0x2ce3('0xb'),auth[_0x2ce3('0x5')](),controller['getHopperHistories']);router['get']('/:id/hopper_finals',auth[_0x2ce3('0x5')](),controller[_0x2ce3('0xc')]);router[_0x2ce3('0x4')](_0x2ce3('0xd'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0xe')]);router[_0x2ce3('0x4')](_0x2ce3('0xf'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x10')]);router[_0x2ce3('0x4')](_0x2ce3('0x11'),auth['isAuthenticated'](),controller[_0x2ce3('0x12')]);router['get'](_0x2ce3('0x13'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x14')]);router[_0x2ce3('0x4')](_0x2ce3('0x15'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x16')]);router[_0x2ce3('0x4')]('/:id/blacklists',auth['isAuthenticated'](),controller['getBlackLists']);router[_0x2ce3('0x17')]('/',auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x18')]);router[_0x2ce3('0x17')](_0x2ce3('0x19'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x1a')]);router[_0x2ce3('0x17')]('/:id/teams',auth[_0x2ce3('0x5')](),controller['addTeams']);router[_0x2ce3('0x17')](_0x2ce3('0x11'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x1b')]);router[_0x2ce3('0x17')](_0x2ce3('0x15'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x1c')]);router[_0x2ce3('0x17')](_0x2ce3('0x1d'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x1e')]);router[_0x2ce3('0x1f')]('/:id',auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x20')]);router['delete'](_0x2ce3('0x7'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x21')]);router['delete'](_0x2ce3('0xf'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x22')]);router[_0x2ce3('0x23')](_0x2ce3('0x11'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x24')]);router[_0x2ce3('0x23')](_0x2ce3('0x15'),auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x25')]);router[_0x2ce3('0x23')]('/:id/blacklists',auth[_0x2ce3('0x5')](),controller[_0x2ce3('0x26')]);module[_0x2ce3('0x27')]=router; \ No newline at end of file +var _0x2f81=['getLists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','addLists','addBlackLists','put','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','getAgents','/:id/members','getMembers','/:id/lists'];(function(_0x2181fc,_0x7283aa){var _0x315da1=function(_0x1df7ca){while(--_0x1df7ca){_0x2181fc['push'](_0x2181fc['shift']());}};_0x315da1(++_0x7283aa);}(_0x2f81,0x145));var _0x12f8=function(_0x5d723a,_0x2c45eb){_0x5d723a=_0x5d723a-0x0;var _0x298403=_0x2f81[_0x5d723a];return _0x298403;};'use strict';var multer=require(_0x12f8('0x0'));var util=require(_0x12f8('0x1'));var path=require(_0x12f8('0x2'));var timeout=require('connect-timeout');var express=require(_0x12f8('0x3'));var router=express[_0x12f8('0x4')]();var fs_extra=require(_0x12f8('0x5'));var auth=require(_0x12f8('0x6'));var interaction=require(_0x12f8('0x7'));var config=require(_0x12f8('0x8'));var controller=require(_0x12f8('0x9'));router[_0x12f8('0xa')]('/',auth[_0x12f8('0xb')](),controller[_0x12f8('0xc')]);router['get'](_0x12f8('0xd'),auth[_0x12f8('0xb')](),controller[_0x12f8('0xe')]);router[_0x12f8('0xa')](_0x12f8('0xf'),auth[_0x12f8('0xb')](),controller[_0x12f8('0x10')]);router[_0x12f8('0xa')](_0x12f8('0x11'),auth[_0x12f8('0xb')](),controller['getHopperHistories']);router[_0x12f8('0xa')]('/:id/hopper_finals',auth[_0x12f8('0xb')](),controller[_0x12f8('0x12')]);router[_0x12f8('0xa')](_0x12f8('0x13'),auth[_0x12f8('0xb')](),controller[_0x12f8('0x14')]);router[_0x12f8('0xa')](_0x12f8('0x15'),auth[_0x12f8('0xb')](),controller[_0x12f8('0x16')]);router[_0x12f8('0xa')]('/:id/users',auth[_0x12f8('0xb')](),controller[_0x12f8('0x17')]);router[_0x12f8('0xa')](_0x12f8('0x18'),auth[_0x12f8('0xb')](),controller[_0x12f8('0x19')]);router['get'](_0x12f8('0x1a'),auth['isAuthenticated'](),controller[_0x12f8('0x1b')]);router[_0x12f8('0xa')](_0x12f8('0x1c'),auth[_0x12f8('0xb')](),controller[_0x12f8('0x1d')]);router['post']('/',auth[_0x12f8('0xb')](),controller['create']);router[_0x12f8('0x1e')](_0x12f8('0x1f'),auth[_0x12f8('0xb')](),controller[_0x12f8('0x20')]);router['post'](_0x12f8('0x15'),auth[_0x12f8('0xb')](),controller['addTeams']);router[_0x12f8('0x1e')]('/:id/users',auth[_0x12f8('0xb')](),controller['addAgents']);router[_0x12f8('0x1e')]('/:id/lists',auth['isAuthenticated'](),controller[_0x12f8('0x21')]);router[_0x12f8('0x1e')](_0x12f8('0x1c'),auth[_0x12f8('0xb')](),controller[_0x12f8('0x22')]);router[_0x12f8('0x23')](_0x12f8('0xd'),auth[_0x12f8('0xb')](),controller[_0x12f8('0x24')]);router[_0x12f8('0x25')]('/:id',auth['isAuthenticated'](),controller[_0x12f8('0x26')]);router[_0x12f8('0x25')](_0x12f8('0x15'),auth[_0x12f8('0xb')](),controller[_0x12f8('0x27')]);router[_0x12f8('0x25')]('/:id/users',auth[_0x12f8('0xb')](),controller[_0x12f8('0x28')]);router[_0x12f8('0x25')]('/:id/lists',auth['isAuthenticated'](),controller[_0x12f8('0x29')]);router[_0x12f8('0x25')]('/:id/blacklists',auth[_0x12f8('0xb')](),controller[_0x12f8('0x2a')]);module[_0x12f8('0x2b')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index a9fc6cc..cdff8c5 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 _0xf6da=['#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','strategy','getDataValue','type','dialMethod','booked','roundrobin','predictive','power','INTEGER','yes','once','TEXT','setDataValue','periodic_announce','split','join','joinempty','leavewhenempty','BOOLEAN','acw','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).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x350343,_0x256f69){var _0x9afc1c=function(_0x47ab32){while(--_0x47ab32){_0x350343['push'](_0x350343['shift']());}};_0x9afc1c(++_0x256f69);}(_0xf6da,0x19f));var _0xaf6d=function(_0x2847fa,_0x142aa1){_0x2847fa=_0x2847fa-0x0;var _0x2df459=_0xf6da[_0x2847fa];return _0x2df459;};'use strict';var Sequelize=require(_0xaf6d('0x0'));module[_0xaf6d('0x1')]={'name':{'type':Sequelize[_0xaf6d('0x2')],'allowNull':![],'unique':_0xaf6d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x5'),_0xaf6d('0x6')),'allowNull':![],'defaultValue':_0xaf6d('0x5')},'musiconhold':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':_0xaf6d('0x7')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xaf6d('0x4')]('rr',_0xaf6d('0x8'),_0xaf6d('0x9'),_0xaf6d('0xa'),_0xaf6d('0xb'),_0xaf6d('0xc'),_0xaf6d('0xd'),_0xaf6d('0xe'),'rrordered'),'allowNull':![],'defaultValue':_0xaf6d('0x8'),'set':function(_0x5b4926){this['setDataValue'](_0xaf6d('0xf'),_0x5b4926?_0x5b4926:_0xaf6d('0xc'));},'get':function(){var _0x40541c=this[_0xaf6d('0x10')](_0xaf6d('0x11'));var _0x35f73b=this['getDataValue'](_0xaf6d('0x12'));var _0x28e257=this[_0xaf6d('0x10')](_0xaf6d('0xf'));if(_0x40541c===_0xaf6d('0x5')){return _0x28e257;}if(_0x35f73b==='booked'&&_0x28e257===_0xaf6d('0xc')||_0x35f73b===_0xaf6d('0x13')&&_0x28e257===_0xaf6d('0x14')){return _0x28e257;}if(_0x35f73b==='progressive'||_0x35f73b===_0xaf6d('0x15')||_0x35f73b===_0xaf6d('0x16')){return _0x28e257;}return null;}},'servicelevel':{'type':Sequelize[_0xaf6d('0x17')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xaf6d('0x17')](0xb)},'timeout':{'type':Sequelize[_0xaf6d('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xaf6d('0x17')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xaf6d('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xaf6d('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x18'),'no'),'defaultValue':_0xaf6d('0x18')},'autopause':{'type':Sequelize['ENUM'](_0xaf6d('0x18'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xaf6d('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xaf6d('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xaf6d('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xaf6d('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x18'),'no'),'defaultValue':_0xaf6d('0x18')},'announce_holdtime':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x18'),'no',_0xaf6d('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xaf6d('0x4')]('yes','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[_0xaf6d('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xaf6d('0x2')]},'queue_youarenext':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xaf6d('0x2')]},'queue_quantity1':{'type':Sequelize[_0xaf6d('0x2')]},'queue_quantity2':{'type':Sequelize[_0xaf6d('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xaf6d('0x2')]},'queue_less_than':{'type':Sequelize[_0xaf6d('0x2')]},'periodic_announce':{'type':Sequelize[_0xaf6d('0x1a')],'set':function(_0x4af95b){this[_0xaf6d('0x1b')](_0xaf6d('0x1c'),_0x4af95b?_0x4af95b['join'](','):[]);},'get':function(){return this[_0xaf6d('0x10')](_0xaf6d('0x1c'))?this[_0xaf6d('0x10')](_0xaf6d('0x1c'))[_0xaf6d('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':_0xaf6d('0x18'),'set':function(_0x40368f){this[_0xaf6d('0x1b')]('joinempty',_0x40368f?_0x40368f[_0xaf6d('0x1e')](','):undefined);},'get':function(){return this[_0xaf6d('0x10')](_0xaf6d('0x1f'))?this[_0xaf6d('0x10')](_0xaf6d('0x1f'))[_0xaf6d('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':'no','set':function(_0x275e9b){this['setDataValue'](_0xaf6d('0x20'),_0x275e9b?_0x275e9b[_0xaf6d('0x1e')](','):undefined);},'get':function(){return this[_0xaf6d('0x10')](_0xaf6d('0x20'))?this[_0xaf6d('0x10')](_0xaf6d('0x20'))[_0xaf6d('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xaf6d('0x4')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xaf6d('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xaf6d('0x2')]},'description':{'type':Sequelize[_0xaf6d('0x2')]},'acw':{'type':Sequelize[_0xaf6d('0x21')],'defaultValue':0x0,'set':function(_0x38a15f){this[_0xaf6d('0x1b')](_0xaf6d('0x22'),_0x38a15f);if(_0x38a15f){if(this[_0xaf6d('0x10')](_0xaf6d('0x23'))<0x2){this[_0xaf6d('0x1b')](_0xaf6d('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xaf6d('0x17')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xaf6d('0x4')]('preview','progressive',_0xaf6d('0x16'),_0xaf6d('0x15'),_0xaf6d('0x13')),'defaultValue':_0xaf6d('0x24'),'comment':_0xaf6d('0x25')},'dialLimitChannel':{'type':Sequelize[_0xaf6d('0x17')](0x4)[_0xaf6d('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xaf6d('0x27')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xaf6d('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xaf6d('0x28')},'dialPowerLevel':{'type':Sequelize[_0xaf6d('0x29')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xaf6d('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x2b'),_0xaf6d('0x2c')),'defaultValue':_0xaf6d('0x2c'),'comment':_0xaf6d('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xaf6d('0x29')](0x2)[_0xaf6d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xaf6d('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xaf6d('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xaf6d('0x17')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':_0xaf6d('0x2f'),'comment':_0xaf6d('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xaf6d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf6d('0x31')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xaf6d('0x17')](0x3)[_0xaf6d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf6d('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xaf6d('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaf6d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf6d('0x33')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xaf6d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf6d('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xaf6d('0x17')](0x3)[_0xaf6d('0x26')],'defaultValue':0x3,'comment':_0xaf6d('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xaf6d('0x17')](0x5)[_0xaf6d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf6d('0x36')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaf6d('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xaf6d('0x37')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':_0xaf6d('0x38')},'dialPrefix':{'type':Sequelize[_0xaf6d('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xaf6d('0x4')](_0xaf6d('0x39'),_0xaf6d('0x3a'),_0xaf6d('0x3b')),'defaultValue':_0xaf6d('0x39')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xaf6d('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xaf6d('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0xaf6d('0x17')](0x9)[_0xaf6d('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xaf6d('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xaf6d('0x17')](0x9)[_0xaf6d('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xaf6d('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xaf6d('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaf6d('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0xaf6d('0x17')](0x9)[_0xaf6d('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xaf6d('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xaf6d('0x17')](0x9)[_0xaf6d('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xaf6d('0x17')](0x9)[_0xaf6d('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xaf6d('0x41')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xaf6d('0x17')](0x5)[_0xaf6d('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xaf6d('0x42')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xaf6d('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xaf6d('0x43')},'dialRecallMeTimeout':{'type':Sequelize[_0xaf6d('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xaf6d('0x44')},'dialRecallInQueue':{'type':Sequelize[_0xaf6d('0x21')],'defaultValue':0x0,'comment':_0xaf6d('0x45')},'dialOrderByScheduledAt':{'type':Sequelize[_0xaf6d('0x4')]('DESC','ASC'),'defaultValue':_0xaf6d('0x46')},'dialQueueProject2':{'type':Sequelize[_0xaf6d('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0xaf6d('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xaf6d('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xaf6d('0x17')](0x3)[_0xaf6d('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xaf6d('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xaf6d('0x17')](0x5)[_0xaf6d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf6d('0x48')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaf6d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xaf6d('0x17')](0x5)[_0xaf6d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf6d('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xaf6d('0x17')](0x3)[_0xaf6d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xaf6d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf6d('0x4a')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xaf6d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf6d('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0xaf6d('0x17')](0x5)[_0xaf6d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf6d('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xaf6d('0x17')](0x3)[_0xaf6d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xaf6d('0x4d')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xaf6d('0x17')](0x5)[_0xaf6d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xaf6d('0x4e')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xaf6d('0x17')],'allowNull':!![],'comment':_0xaf6d('0x4f')},'mandatoryDisposition':{'type':Sequelize[_0xaf6d('0x21')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xa1b96f){if(!_0xa1b96f)this[_0xaf6d('0x1b')](_0xaf6d('0x50'),null);this['setDataValue'](_0xaf6d('0x51'),_0xa1b96f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xaf6d('0x17')](0x3)[_0xaf6d('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xaf6d('0x17')](0x3)[_0xaf6d('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xe9b9=['joinempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','preview','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','Random\x20Last\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)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','ringall','random','linear','wrandom','setDataValue','strategy','getDataValue','type','booked','rrmemory','roundrobin','progressive','power','INTEGER','yes','all','once','TEXT','periodic_announce','join','split'];(function(_0x587d9a,_0x343bbc){var _0xb5422a=function(_0xca9b5){while(--_0xca9b5){_0x587d9a['push'](_0x587d9a['shift']());}};_0xb5422a(++_0x343bbc);}(_0xe9b9,0xd4));var _0x9e9b=function(_0x5773a7,_0x281e07){_0x5773a7=_0x5773a7-0x0;var _0x3f0cb4=_0xe9b9[_0x5773a7];return _0x3f0cb4;};'use strict';var Sequelize=require(_0x9e9b('0x0'));module[_0x9e9b('0x1')]={'name':{'type':Sequelize[_0x9e9b('0x2')],'allowNull':![],'unique':_0x9e9b('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9e9b('0x4')](_0x9e9b('0x5'),_0x9e9b('0x6')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x9e9b('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x9e9b('0x4')]('rr',_0x9e9b('0x7'),'leastrecent','fewestcalls',_0x9e9b('0x8'),'rrmemory',_0x9e9b('0x9'),_0x9e9b('0xa'),'rrordered'),'allowNull':![],'defaultValue':_0x9e9b('0x7'),'set':function(_0x19b9dc){this[_0x9e9b('0xb')](_0x9e9b('0xc'),_0x19b9dc?_0x19b9dc:'rrmemory');},'get':function(){var _0x54e13f=this[_0x9e9b('0xd')](_0x9e9b('0xe'));var _0x495394=this[_0x9e9b('0xd')]('dialMethod');var _0x357259=this['getDataValue']('strategy');if(_0x54e13f===_0x9e9b('0x5')){return _0x357259;}if(_0x495394===_0x9e9b('0xf')&&_0x357259===_0x9e9b('0x10')||_0x495394===_0x9e9b('0xf')&&_0x357259===_0x9e9b('0x11')){return _0x357259;}if(_0x495394===_0x9e9b('0x12')||_0x495394==='predictive'||_0x495394===_0x9e9b('0x13')){return _0x357259;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x9e9b('0x14')](0xb)},'timeout':{'type':Sequelize[_0x9e9b('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x9e9b('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x9e9b('0x2')]},'weight':{'type':Sequelize[_0x9e9b('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x9e9b('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x9e9b('0x4')](_0x9e9b('0x15'),'no'),'defaultValue':_0x9e9b('0x15')},'autopause':{'type':Sequelize[_0x9e9b('0x4')](_0x9e9b('0x15'),'no',_0x9e9b('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x9e9b('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x9e9b('0x4')](_0x9e9b('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x9e9b('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x9e9b('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x9e9b('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x9e9b('0x4')](_0x9e9b('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x9e9b('0x4')](_0x9e9b('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x9e9b('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x9e9b('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x9e9b('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x9e9b('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x9e9b('0x4')](_0x9e9b('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x9e9b('0x4')]('yes','no'),'defaultValue':_0x9e9b('0x15')},'announce_holdtime':{'type':Sequelize[_0x9e9b('0x4')]('yes','no',_0x9e9b('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x9e9b('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x9e9b('0x4')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x9e9b('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x9e9b('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x9e9b('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x9e9b('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x9e9b('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x9e9b('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x9e9b('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x9e9b('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x9e9b('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x9e9b('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0x9e9b('0x2')]},'periodic_announce':{'type':Sequelize[_0x9e9b('0x18')],'set':function(_0x22c377){this[_0x9e9b('0xb')](_0x9e9b('0x19'),_0x22c377?_0x22c377[_0x9e9b('0x1a')](','):[]);},'get':function(){return this[_0x9e9b('0xd')](_0x9e9b('0x19'))?this[_0x9e9b('0xd')]('periodic_announce')[_0x9e9b('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x9e9b('0x2')],'defaultValue':_0x9e9b('0x15'),'set':function(_0x264d72){this[_0x9e9b('0xb')](_0x9e9b('0x1c'),_0x264d72?_0x264d72['join'](','):undefined);},'get':function(){return this[_0x9e9b('0xd')](_0x9e9b('0x1c'))?this[_0x9e9b('0xd')]('joinempty')[_0x9e9b('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x9e9b('0x2')],'defaultValue':'no','set':function(_0x1c9d66){this['setDataValue']('leavewhenempty',_0x1c9d66?_0x1c9d66['join'](','):undefined);},'get':function(){return this[_0x9e9b('0xd')]('leavewhenempty')?this['getDataValue']('leavewhenempty')[_0x9e9b('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x9e9b('0x4')](_0x9e9b('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x9e9b('0x4')](_0x9e9b('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x9e9b('0x4')](_0x9e9b('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x9e9b('0x2')]},'description':{'type':Sequelize[_0x9e9b('0x2')]},'acw':{'type':Sequelize[_0x9e9b('0x1d')],'defaultValue':0x0,'set':function(_0x4f6b4c){this['setDataValue']('acw',_0x4f6b4c);if(_0x4f6b4c){if(this[_0x9e9b('0xd')]('wrapuptime')<0x2){this[_0x9e9b('0xb')](_0x9e9b('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x9e9b('0x1f')},'dialMethod':{'type':Sequelize['ENUM'](_0x9e9b('0x20'),_0x9e9b('0x12'),_0x9e9b('0x13'),_0x9e9b('0x21'),_0x9e9b('0xf')),'defaultValue':_0x9e9b('0x12'),'comment':_0x9e9b('0x22')},'dialLimitChannel':{'type':Sequelize[_0x9e9b('0x14')](0x4)[_0x9e9b('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9e9b('0x24')},'dialLimitQueue':{'type':Sequelize[_0x9e9b('0x14')](0x4)[_0x9e9b('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9e9b('0x25')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x9e9b('0x23')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x9e9b('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0x9e9b('0x4')](_0x9e9b('0x27'),_0x9e9b('0x28')),'defaultValue':_0x9e9b('0x28'),'comment':_0x9e9b('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x9e9b('0x2a')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x9e9b('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x9e9b('0x14')](0x3)[_0x9e9b('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x9e9b('0x14')](0x3)[_0x9e9b('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e9b('0x2c')},'dialQueueOptions':{'type':Sequelize[_0x9e9b('0x2')],'defaultValue':_0x9e9b('0x2d'),'comment':_0x9e9b('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x9e9b('0x14')](0x3)[_0x9e9b('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e9b('0x2f')},'dialQueueProject':{'type':Sequelize[_0x9e9b('0x2')],'comment':_0x9e9b('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9e9b('0x14')](0x3)[_0x9e9b('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9e9b('0x14')](0x5)[_0x9e9b('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e9b('0x31')},'dialBusyMaxRetry':{'type':Sequelize[_0x9e9b('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e9b('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9e9b('0x14')](0x5)[_0x9e9b('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9e9b('0x14')](0x3)[_0x9e9b('0x23')],'defaultValue':0x3,'comment':_0x9e9b('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9e9b('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e9b('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x9e9b('0x14')](0x3)[_0x9e9b('0x23')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9e9b('0x35')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9e9b('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x9e9b('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x9e9b('0x4')]('always',_0x9e9b('0x36'),_0x9e9b('0x37')),'defaultValue':_0x9e9b('0x38')},'dialAMDActive':{'type':Sequelize[_0x9e9b('0x1d')],'defaultValue':0x0,'comment':_0x9e9b('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x9e9b('0x14')](0x9)[_0x9e9b('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9e9b('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x9e9b('0x14')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9e9b('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9e9b('0x14')](0x9)[_0x9e9b('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9e9b('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9e9b('0x14')](0x9)[_0x9e9b('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9e9b('0x3d')},'dialAMDMinWordLength':{'type':Sequelize[_0x9e9b('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x9e9b('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9e9b('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9e9b('0x14')](0x9)[_0x9e9b('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9e9b('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9e9b('0x14')](0x5)[_0x9e9b('0x23')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9e9b('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9e9b('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9e9b('0x41')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x9e9b('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x9e9b('0x42')},'dialRecallInQueue':{'type':Sequelize[_0x9e9b('0x1d')],'defaultValue':0x0,'comment':_0x9e9b('0x43')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9e9b('0x4')]('DESC','ASC'),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x9e9b('0x2')],'comment':_0x9e9b('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x9e9b('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9e9b('0x14')](0x3)[_0x9e9b('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9e9b('0x44')},'dialCutDigit':{'type':Sequelize[_0x9e9b('0x14')](0x3)[_0x9e9b('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9e9b('0x14')](0x3)[_0x9e9b('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e9b('0x45')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9e9b('0x14')](0x5)[_0x9e9b('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e9b('0x46')},'dialDropMaxRetry':{'type':Sequelize[_0x9e9b('0x14')](0x3)[_0x9e9b('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e9b('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0x9e9b('0x14')](0x5)[_0x9e9b('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e9b('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9e9b('0x14')](0x3)[_0x9e9b('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e9b('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9e9b('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e9b('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0x9e9b('0x14')](0x3)[_0x9e9b('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e9b('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9e9b('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e9b('0x4c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9e9b('0x14')](0x3)[_0x9e9b('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9e9b('0x14')](0x5)[_0x9e9b('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9e9b('0x14')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9e9b('0x1d')],'defaultValue':![],'comment':_0x9e9b('0x4d'),'set':function(_0x2ebe09){if(!_0x2ebe09)this[_0x9e9b('0xb')](_0x9e9b('0x4e'),null);this[_0x9e9b('0xb')](_0x9e9b('0x4f'),_0x2ebe09);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x9e9b('0x14')](0x3)[_0x9e9b('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x9e9b('0x23')],'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 1de799b..5015e60 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 _0x542c=['forEach','spread','userVoiceQueue:save','format','isArray','userVoiceQueue:remove','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','fromQuery','phone','scheduledAt','select','ContactId','CmListId','ListId','NOW()','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','cm_contacts','phone\x20NOT\x20IN\x20(?)','cm_hopper','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','find','UserProfileResource','error','stack','name','send','index','VoiceQueue','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','merge','VIRTUAL','includeAll','rows','show','rawAttributes','include','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','CmHopper','pick','VoiceQueueId','findAll','getHopperHistories','CmHopperHistory','nolimit','getHopperFinals','CmHopperFinal','getHopperBlacks','findOne','CmHopperBlack','getTeams','Team','addTeams','teams','online','voicePause','interface','flatMap','Agents','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','UserVoiceQueueRt','isNil','SIP/%s','emit','removeTeams','ids','User','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','isEmpty','removeAgents'];(function(_0x5709ea,_0x5c0089){var _0x1998b4=function(_0x3bab6b){while(--_0x3bab6b){_0x5709ea['push'](_0x5709ea['shift']());}};_0x1998b4(++_0x5c0089);}(_0x542c,0x1a6));var _0xc542=function(_0x10a4ef,_0xffbe2d){_0x10a4ef=_0x10a4ef-0x0;var _0x39e5be=_0x542c[_0x10a4ef];return _0x39e5be;};'use strict';var emlformat=require(_0xc542('0x0'));var rimraf=require(_0xc542('0x1'));var zipdir=require(_0xc542('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc542('0x3'));var moment=require(_0xc542('0x4'));var BPromise=require(_0xc542('0x5'));var Mustache=require('mustache');var util=require(_0xc542('0x6'));var path=require('path');var sox=require(_0xc542('0x7'));var csv=require(_0xc542('0x8'));var ejs=require(_0xc542('0x9'));var fs=require('fs');var fs_extra=require(_0xc542('0xa'));var _=require(_0xc542('0xb'));var squel=require(_0xc542('0xc'));var crypto=require(_0xc542('0xd'));var jsforce=require(_0xc542('0xe'));var deskjs=require(_0xc542('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc542('0x10'));var Papa=require(_0xc542('0x11'));var Redis=require(_0xc542('0x12'));var authService=require(_0xc542('0x13'));var qs=require(_0xc542('0x14'));var as=require(_0xc542('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc542('0x16'))(_0xc542('0x17'));var utils=require('../../config/utils');var config=require(_0xc542('0x18'));var licenseUtil=require(_0xc542('0x19'));var db=require(_0xc542('0x1a'))['db'];config[_0xc542('0x1b')]=_[_0xc542('0x1c')](config['redis'],{'host':_0xc542('0x1d'),'port':0x18eb});var socket=require(_0xc542('0x1e'))(new Redis(config[_0xc542('0x1b')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x48d59e,_0xc4830c){_0xc4830c=_0xc4830c||0xcc;return function(_0x2c92ec){if(_0x2c92ec){return _0x48d59e[_0xc542('0x1f')](_0xc4830c);}return _0x48d59e[_0xc542('0x20')](_0xc4830c)[_0xc542('0x21')]();};}function respondWithResult(_0x4ee1b1,_0x4a31ec){_0x4a31ec=_0x4a31ec||0xc8;return function(_0x21572f){if(_0x21572f){return _0x4ee1b1['status'](_0x4a31ec)[_0xc542('0x22')](_0x21572f);}};}function respondWithFilteredResult(_0x4f4602,_0x50c117){return function(_0x21db5c){if(_0x21db5c){var _0x52af81=typeof _0x50c117[_0xc542('0x23')]==='undefined'&&typeof _0x50c117[_0xc542('0x24')]===_0xc542('0x25');var _0x45f1c4=_0x21db5c['count'];var _0x5ae2c5=_0x52af81?0x0:_0x50c117[_0xc542('0x23')];var _0x4831fa=_0x52af81?_0x21db5c[_0xc542('0x26')]:_0x50c117['offset']+_0x50c117[_0xc542('0x24')];var _0x2b99c4;if(_0x4831fa>=_0x45f1c4){_0x4831fa=_0x45f1c4;_0x2b99c4=0xc8;}else{_0x2b99c4=0xce;}_0x4f4602[_0xc542('0x20')](_0x2b99c4);return _0x4f4602[_0xc542('0x27')](_0xc542('0x28'),_0x5ae2c5+'-'+_0x4831fa+'/'+_0x45f1c4)[_0xc542('0x22')](_0x21db5c);}return null;};}function patchUpdates(_0x329e65){return function(_0x1c3e67){try{jsonpatch[_0xc542('0x29')](_0x1c3e67,_0x329e65,!![]);}catch(_0x5f1164){return BPromise[_0xc542('0x2a')](_0x5f1164);}return _0x1c3e67[_0xc542('0x2b')]();};}function saveUpdates(_0x46ee33,_0x1d669a){return function(_0x2acbd0){if(_0x2acbd0){return _0x2acbd0[_0xc542('0x2c')](_0x46ee33)[_0xc542('0x2d')](function(_0x5e402d){return _0x5e402d;});}return null;};}function removeEntity(_0x564150,_0xcfe7a8){return function(_0x1d0198){if(_0x1d0198){return _0x1d0198[_0xc542('0x2e')]()['then'](function(){var _0x103ad7=_0x1d0198[_0xc542('0x2f')]({'plain':!![]});var _0x45511b=[{'name':_0xc542('0x30'),'value':_0xc542('0x31'),'ignore':![]},{'name':_0xc542('0x32'),'value':_0xc542('0x33'),'ignore':![]}];var _0x38f3c9=_(_0x45511b)[_0xc542('0x34')](_0xc542('0x35'))[_0xc542('0x36')](_0xc542('0x37'))['value']();if(_[_0xc542('0x38')](_0x38f3c9,_0x103ad7[_0xc542('0x39')])){return;}var _0x4d984e=_[_0xc542('0x3a')](_0x45511b,[_0xc542('0x37'),_0x103ad7[_0xc542('0x39')]])['name'];return db[_0xc542('0x3b')]['destroy']({'where':{'type':_0x4d984e,'resourceId':_0x103ad7['id']}})['then'](function(){return _0x1d0198;});})[_0xc542('0x2d')](function(){_0x564150[_0xc542('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59cf44,_0x2923b0){return function(_0x20e43a){if(!_0x20e43a){_0x59cf44[_0xc542('0x1f')](0x194);}return _0x20e43a;};}function handleError(_0x47b792,_0x3ad62c){_0x3ad62c=_0x3ad62c||0x1f4;return function(_0x226d38){logger[_0xc542('0x3c')](_0x226d38[_0xc542('0x3d')]);if(_0x226d38[_0xc542('0x3e')]){delete _0x226d38[_0xc542('0x3e')];}_0x47b792[_0xc542('0x20')](_0x3ad62c)[_0xc542('0x3f')](_0x226d38);};}exports[_0xc542('0x40')]=function(_0x2a5b72,_0x474aca){var _0x2e5739={},_0x220ab6={},_0x3d4a57={'count':0x0,'rows':[]};var _0x58e797=_[_0xc542('0x36')](db[_0xc542('0x41')]['rawAttributes'],function(_0x2b512f){return{'name':_0x2b512f[_0xc542('0x42')],'type':_0x2b512f['type'][_0xc542('0x43')]};});_0x220ab6[_0xc542('0x44')]=_[_0xc542('0x36')](_0x58e797,_0xc542('0x3e'));_0x220ab6[_0xc542('0x45')]=_[_0xc542('0x46')](_0x2a5b72['query']);_0x220ab6['filters']=_[_0xc542('0x47')](_0x220ab6[_0xc542('0x44')],_0x220ab6[_0xc542('0x45')]);_0x2e5739[_0xc542('0x48')]=_[_0xc542('0x47')](_0x220ab6[_0xc542('0x44')],qs['fields'](_0x2a5b72[_0xc542('0x45')][_0xc542('0x49')]));_0x2e5739[_0xc542('0x48')]=_0x2e5739[_0xc542('0x48')][_0xc542('0x4a')]?_0x2e5739[_0xc542('0x48')]:_0x220ab6[_0xc542('0x44')];if(!_0x2a5b72[_0xc542('0x45')][_0xc542('0x4b')]('nolimit')){_0x2e5739['limit']=qs['limit'](_0x2a5b72[_0xc542('0x45')][_0xc542('0x24')]);_0x2e5739[_0xc542('0x23')]=qs[_0xc542('0x23')](_0x2a5b72[_0xc542('0x45')][_0xc542('0x23')]);}_0x2e5739[_0xc542('0x4c')]=qs[_0xc542('0x4d')](_0x2a5b72[_0xc542('0x45')][_0xc542('0x4d')]);_0x2e5739[_0xc542('0x4e')]=qs[_0xc542('0x4f')](_['pick'](_0x2a5b72[_0xc542('0x45')],_0x220ab6[_0xc542('0x4f')]),_0x58e797);if(_0x2a5b72['query'][_0xc542('0x34')]){_0x2e5739['where']=_[_0xc542('0x50')](_0x2e5739[_0xc542('0x4e')],{'$or':_['map'](_0x58e797,function(_0x523b90){if(_0x523b90['type']!==_0xc542('0x51')){var _0x1be4df={};_0x1be4df[_0x523b90[_0xc542('0x3e')]]={'$like':'%'+_0x2a5b72[_0xc542('0x45')][_0xc542('0x34')]+'%'};return _0x1be4df;}})});}_0x2e5739=_['merge']({},_0x2e5739,_0x2a5b72['options']);var _0x1c7824={'where':_0x2e5739[_0xc542('0x4e')]};return db[_0xc542('0x41')][_0xc542('0x26')](_0x1c7824)[_0xc542('0x2d')](function(_0x496462){_0x3d4a57[_0xc542('0x26')]=_0x496462;if(_0x2a5b72['query'][_0xc542('0x52')]){_0x2e5739['include']=[{'all':!![]}];}return db[_0xc542('0x41')]['findAll'](_0x2e5739);})[_0xc542('0x2d')](function(_0x4c2bfa){_0x3d4a57[_0xc542('0x53')]=_0x4c2bfa;return _0x3d4a57;})[_0xc542('0x2d')](respondWithFilteredResult(_0x474aca,_0x2e5739))['catch'](handleError(_0x474aca,null));};exports[_0xc542('0x54')]=function(_0x4ad1e,_0x5738c0){var _0x51fdfa={'raw':![],'where':{'id':_0x4ad1e['params']['id']}},_0x223486={};_0x223486[_0xc542('0x44')]=_[_0xc542('0x46')](db[_0xc542('0x41')][_0xc542('0x55')]);_0x223486[_0xc542('0x45')]=_[_0xc542('0x46')](_0x4ad1e['query']);_0x223486[_0xc542('0x4f')]=_[_0xc542('0x47')](_0x223486[_0xc542('0x44')],_0x223486['query']);_0x51fdfa['attributes']=_[_0xc542('0x47')](_0x223486[_0xc542('0x44')],qs[_0xc542('0x49')](_0x4ad1e[_0xc542('0x45')][_0xc542('0x49')]));_0x51fdfa[_0xc542('0x48')]=_0x51fdfa[_0xc542('0x48')][_0xc542('0x4a')]?_0x51fdfa['attributes']:_0x223486[_0xc542('0x44')];if(_0x4ad1e['query'][_0xc542('0x52')]){_0x51fdfa[_0xc542('0x56')]=[{'all':!![]}];}_0x51fdfa=_[_0xc542('0x50')]({},_0x51fdfa,_0x4ad1e[_0xc542('0x57')]);return db['VoiceQueue'][_0xc542('0x3a')](_0x51fdfa)['then'](handleEntityNotFound(_0x5738c0,null))[_0xc542('0x2d')](respondWithResult(_0x5738c0,null))[_0xc542('0x58')](handleError(_0x5738c0,null));};exports[_0xc542('0x59')]=function(_0x2e6ba6,_0x2a287f){return db[_0xc542('0x41')][_0xc542('0x59')](_0x2e6ba6[_0xc542('0x5a')],{})[_0xc542('0x2d')](function(_0x5f33bb){var _0x5350fb=_0x2e6ba6[_0xc542('0x5b')][_0xc542('0x2f')]({'plain':!![]});if(!_0x5350fb)throw new Error(_0xc542('0x5c'));if(_0x5350fb[_0xc542('0x5d')]===_0xc542('0x5b')){var _0x1d47f0=_0x5f33bb['get']({'plain':!![]});var _0x22703a=[{'name':_0xc542('0x30'),'value':_0xc542('0x31')},{'name':'QueueCampaigns','value':_0xc542('0x33')}];var _0x1b2b4b=_[_0xc542('0x3a')](_0x22703a,[_0xc542('0x37'),_0x1d47f0['type']])[_0xc542('0x3e')];return db[_0xc542('0x5e')]['find']({'where':{'name':_0x1b2b4b,'userProfileId':_0x5350fb[_0xc542('0x5f')]},'raw':!![]})['then'](function(_0x45219f){if(_0x45219f&&_0x45219f[_0xc542('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x1d47f0[_0xc542('0x3e')],'resourceId':_0x1d47f0['id'],'type':_0x45219f[_0xc542('0x3e')],'sectionId':_0x45219f['id']},{})[_0xc542('0x2d')](function(){return _0x5f33bb;});}else{return _0x5f33bb;}})[_0xc542('0x58')](function(_0x46aa7a){logger[_0xc542('0x3c')](_0xc542('0x61'),_0x46aa7a);throw _0x46aa7a;});}return _0x5f33bb;})[_0xc542('0x2d')](respondWithResult(_0x2a287f,0xc9))['catch'](handleError(_0x2a287f,null));};exports[_0xc542('0x62')]=function(_0x10ee8c,_0x1b35d7){var _0x4cd31b={'where':{'id':_0x10ee8c[_0xc542('0x63')]['id']}},_0x58b0ac={};_0x58b0ac[_0xc542('0x44')]=_[_0xc542('0x46')](db['VoiceQueue']['rawAttributes']);_0x4cd31b[_0xc542('0x48')]=_[_0xc542('0x47')](_0x58b0ac[_0xc542('0x44')],qs[_0xc542('0x49')](_0x10ee8c[_0xc542('0x45')][_0xc542('0x49')]));_0x4cd31b[_0xc542('0x48')]=_0x4cd31b[_0xc542('0x48')][_0xc542('0x4a')]?_0x4cd31b[_0xc542('0x48')]:_0x58b0ac[_0xc542('0x44')];if(_0x10ee8c[_0xc542('0x45')][_0xc542('0x52')]){_0x4cd31b[_0xc542('0x56')]=[{'all':!![]}];}_0x4cd31b=_[_0xc542('0x50')]({},_0x4cd31b,_0x10ee8c[_0xc542('0x57')]);return db[_0xc542('0x41')][_0xc542('0x3a')](_0x4cd31b)[_0xc542('0x2d')](handleEntityNotFound(_0x1b35d7,null))[_0xc542('0x2d')](function(_0x5a7dab){if(_0x5a7dab){var _0x3a2b4e=_0x5a7dab[_0xc542('0x2f')]({'plain':!![]});_0x3a2b4e=qs[_0xc542('0x64')](_0x3a2b4e,['id',_0xc542('0x65'),_0xc542('0x66')]);_0x10ee8c[_0xc542('0x5a')]=_['omit'](_0x10ee8c[_0xc542('0x5a')],['id',_0xc542('0x65'),_0xc542('0x66')]);return db['VoiceQueue']['create'](_[_0xc542('0x50')](_0x3a2b4e,_0x10ee8c['body']),{'include':_0x10ee8c[_0xc542('0x45')][_0xc542('0x52')]?[{'all':!![]}]:undefined})[_0xc542('0x2d')](function(_0x3568b0){var _0x3de765=_0x10ee8c[_0xc542('0x5b')][_0xc542('0x2f')]({'plain':!![]});if(!_0x3de765)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3de765[_0xc542('0x5d')]===_0xc542('0x5b')){var _0x1bd951=_0x3568b0[_0xc542('0x2f')]({'plain':!![]});var _0x467b43=[{'name':_0xc542('0x30'),'value':_0xc542('0x31')},{'name':_0xc542('0x32'),'value':_0xc542('0x33')}];var _0x5544c9=_[_0xc542('0x3a')](_0x467b43,[_0xc542('0x37'),_0x1bd951[_0xc542('0x39')]])['name'];return db[_0xc542('0x5e')][_0xc542('0x3a')]({'where':{'name':_0x5544c9,'userProfileId':_0x3de765['userProfileId']},'raw':!![]})['then'](function(_0x40d46b){if(_0x40d46b&&_0x40d46b[_0xc542('0x60')]===0x0){return db['UserProfileResource'][_0xc542('0x59')]({'name':_0x1bd951['name'],'resourceId':_0x1bd951['id'],'type':_0x40d46b[_0xc542('0x3e')],'sectionId':_0x40d46b['id']},{})['then'](function(){return _0x3568b0;});}else{return _0x3568b0;}})[_0xc542('0x58')](function(_0xb2eec2){logger['error'](_0xc542('0x61'),_0xb2eec2);throw _0xb2eec2;});}return _0x3568b0;});}})['then'](respondWithResult(_0x1b35d7,0xc9))['catch'](handleError(_0x1b35d7,null));};exports['update']=function(_0x372e6c,_0x2b1fc8){if(_0x372e6c[_0xc542('0x5a')]['id']){delete _0x372e6c[_0xc542('0x5a')]['id'];}return db[_0xc542('0x41')][_0xc542('0x3a')]({'where':{'id':_0x372e6c[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x2b1fc8,null))[_0xc542('0x2d')](saveUpdates(_0x372e6c[_0xc542('0x5a')],null))[_0xc542('0x2d')](respondWithResult(_0x2b1fc8,null))['catch'](handleError(_0x2b1fc8,null));};exports['destroy']=function(_0x48122b,_0x1521fe){return db[_0xc542('0x41')][_0xc542('0x3a')]({'where':{'id':_0x48122b[_0xc542('0x63')]['id']}})['then'](handleEntityNotFound(_0x1521fe,null))['then'](removeEntity(_0x1521fe,null))[_0xc542('0x58')](handleError(_0x1521fe,null));};exports['getHoppers']=function(_0x44395b,_0x2eb713,_0xaf150b){var _0x496905={'raw':![],'where':{}};var _0x470474={};var _0x1c0f03={'count':0x0,'rows':[]};return db[_0xc542('0x41')]['findOne']({'where':{'id':_0x44395b[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x2eb713,null))['then'](function(_0x3edf8a){if(_0x3edf8a){_0x470474[_0xc542('0x44')]=_[_0xc542('0x46')](db[_0xc542('0x67')][_0xc542('0x55')]);_0x470474['query']=_[_0xc542('0x46')](_0x44395b[_0xc542('0x45')]);_0x470474[_0xc542('0x4f')]=_[_0xc542('0x47')](_0x470474[_0xc542('0x44')],_0x470474['query']);_0x496905[_0xc542('0x48')]=_['intersection'](_0x470474['model'],qs[_0xc542('0x49')](_0x44395b[_0xc542('0x45')]['fields']));_0x496905[_0xc542('0x48')]=_0x496905['attributes']['length']?_0x496905['attributes']:_0x470474[_0xc542('0x44')];if(!_0x44395b[_0xc542('0x45')][_0xc542('0x4b')]('nolimit')){_0x496905[_0xc542('0x24')]=qs[_0xc542('0x24')](_0x44395b[_0xc542('0x45')][_0xc542('0x24')]);_0x496905[_0xc542('0x23')]=qs[_0xc542('0x23')](_0x44395b[_0xc542('0x45')][_0xc542('0x23')]);}_0x496905['order']=qs['sort'](_0x44395b[_0xc542('0x45')][_0xc542('0x4d')]);_0x496905[_0xc542('0x4e')]=qs['filters'](_[_0xc542('0x68')](_0x44395b[_0xc542('0x45')],_0x470474[_0xc542('0x4f')]));_0x496905[_0xc542('0x4e')][_0xc542('0x69')]=_0x3edf8a['id'];if(_0x44395b[_0xc542('0x45')][_0xc542('0x34')]){_0x496905[_0xc542('0x4e')]=_['merge'](_0x496905[_0xc542('0x4e')],{'$or':_[_0xc542('0x36')](_0x496905[_0xc542('0x48')],function(_0x29863d){var _0x4d543d={};_0x4d543d[_0x29863d]={'$like':'%'+_0x44395b[_0xc542('0x45')]['filter']+'%'};return _0x4d543d;})});}_0x496905=_[_0xc542('0x50')]({},_0x496905,_0x44395b['options']);return db['CmHopper'][_0xc542('0x26')]({'where':_0x496905[_0xc542('0x4e')]})[_0xc542('0x2d')](function(_0x4c8a48){_0x1c0f03['count']=_0x4c8a48;if(_0x44395b[_0xc542('0x45')][_0xc542('0x52')]){_0x496905[_0xc542('0x56')]=[{'all':!![]}];}return db[_0xc542('0x67')][_0xc542('0x6a')](_0x496905);})[_0xc542('0x2d')](function(_0x22b991){_0x1c0f03[_0xc542('0x53')]=_0x22b991;return _0x1c0f03;});}})[_0xc542('0x2d')](respondWithFilteredResult(_0x2eb713,_0x496905))[_0xc542('0x58')](handleError(_0x2eb713,null));};exports[_0xc542('0x6b')]=function(_0x467e40,_0x5526cd,_0x43640d){var _0x381232={'raw':!![],'where':{}};var _0xca6e93={};var _0xaa17ba={'count':0x0,'rows':[]};return db[_0xc542('0x41')]['findOne']({'where':{'id':_0x467e40['params']['id']}})['then'](handleEntityNotFound(_0x5526cd,null))['then'](function(_0x180997){if(_0x180997){_0xca6e93[_0xc542('0x44')]=_[_0xc542('0x46')](db[_0xc542('0x6c')][_0xc542('0x55')]);_0xca6e93[_0xc542('0x45')]=_[_0xc542('0x46')](_0x467e40[_0xc542('0x45')]);_0xca6e93[_0xc542('0x4f')]=_[_0xc542('0x47')](_0xca6e93[_0xc542('0x44')],_0xca6e93[_0xc542('0x45')]);_0x381232[_0xc542('0x48')]=_[_0xc542('0x47')](_0xca6e93['model'],qs[_0xc542('0x49')](_0x467e40[_0xc542('0x45')][_0xc542('0x49')]));_0x381232[_0xc542('0x48')]=_0x381232[_0xc542('0x48')][_0xc542('0x4a')]?_0x381232['attributes']:_0xca6e93[_0xc542('0x44')];if(!_0x467e40[_0xc542('0x45')]['hasOwnProperty'](_0xc542('0x6d'))){_0x381232[_0xc542('0x24')]=qs[_0xc542('0x24')](_0x467e40[_0xc542('0x45')]['limit']);_0x381232[_0xc542('0x23')]=qs[_0xc542('0x23')](_0x467e40[_0xc542('0x45')][_0xc542('0x23')]);}_0x381232[_0xc542('0x4c')]=qs[_0xc542('0x4d')](_0x467e40[_0xc542('0x45')][_0xc542('0x4d')]);_0x381232['where']=qs[_0xc542('0x4f')](_[_0xc542('0x68')](_0x467e40[_0xc542('0x45')],_0xca6e93[_0xc542('0x4f')]));_0x381232['where'][_0xc542('0x69')]=_0x180997['id'];if(_0x467e40[_0xc542('0x45')][_0xc542('0x34')]){_0x381232['where']=_[_0xc542('0x50')](_0x381232[_0xc542('0x4e')],{'$or':_['map'](_0x381232[_0xc542('0x48')],function(_0x172190){var _0xbaced8={};_0xbaced8[_0x172190]={'$like':'%'+_0x467e40[_0xc542('0x45')]['filter']+'%'};return _0xbaced8;})});}_0x381232=_[_0xc542('0x50')]({},_0x381232,_0x467e40[_0xc542('0x57')]);return db[_0xc542('0x6c')]['count']({'where':_0x381232[_0xc542('0x4e')]})[_0xc542('0x2d')](function(_0x41c146){_0xaa17ba[_0xc542('0x26')]=_0x41c146;if(_0x467e40['query']['includeAll']){_0x381232[_0xc542('0x56')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xc542('0x6a')](_0x381232);})['then'](function(_0x519e2a){_0xaa17ba[_0xc542('0x53')]=_0x519e2a;return _0xaa17ba;});}})['then'](respondWithFilteredResult(_0x5526cd,_0x381232))[_0xc542('0x58')](handleError(_0x5526cd,null));};exports[_0xc542('0x6e')]=function(_0xafd0cf,_0x350e13,_0x2a8e6c){var _0x3fe00f={'raw':!![],'where':{}};var _0x32267e={};var _0x333fcf={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xafd0cf['params']['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x350e13,null))[_0xc542('0x2d')](function(_0x16cf1a){if(_0x16cf1a){_0x32267e[_0xc542('0x44')]=_['keys'](db[_0xc542('0x6f')][_0xc542('0x55')]);_0x32267e[_0xc542('0x45')]=_[_0xc542('0x46')](_0xafd0cf[_0xc542('0x45')]);_0x32267e[_0xc542('0x4f')]=_['intersection'](_0x32267e[_0xc542('0x44')],_0x32267e[_0xc542('0x45')]);_0x3fe00f[_0xc542('0x48')]=_['intersection'](_0x32267e[_0xc542('0x44')],qs[_0xc542('0x49')](_0xafd0cf[_0xc542('0x45')][_0xc542('0x49')]));_0x3fe00f[_0xc542('0x48')]=_0x3fe00f['attributes']['length']?_0x3fe00f['attributes']:_0x32267e[_0xc542('0x44')];if(!_0xafd0cf[_0xc542('0x45')]['hasOwnProperty'](_0xc542('0x6d'))){_0x3fe00f[_0xc542('0x24')]=qs[_0xc542('0x24')](_0xafd0cf[_0xc542('0x45')]['limit']);_0x3fe00f[_0xc542('0x23')]=qs[_0xc542('0x23')](_0xafd0cf[_0xc542('0x45')][_0xc542('0x23')]);}_0x3fe00f[_0xc542('0x4c')]=qs[_0xc542('0x4d')](_0xafd0cf['query'][_0xc542('0x4d')]);_0x3fe00f[_0xc542('0x4e')]=qs[_0xc542('0x4f')](_[_0xc542('0x68')](_0xafd0cf['query'],_0x32267e['filters']));_0x3fe00f[_0xc542('0x4e')][_0xc542('0x69')]=_0x16cf1a['id'];if(_0xafd0cf[_0xc542('0x45')][_0xc542('0x34')]){_0x3fe00f[_0xc542('0x4e')]=_[_0xc542('0x50')](_0x3fe00f[_0xc542('0x4e')],{'$or':_[_0xc542('0x36')](_0x3fe00f['attributes'],function(_0x23d1da){var _0x3fe545={};_0x3fe545[_0x23d1da]={'$like':'%'+_0xafd0cf[_0xc542('0x45')][_0xc542('0x34')]+'%'};return _0x3fe545;})});}_0x3fe00f=_[_0xc542('0x50')]({},_0x3fe00f,_0xafd0cf[_0xc542('0x57')]);return db['CmHopperFinal'][_0xc542('0x26')]({'where':_0x3fe00f[_0xc542('0x4e')]})[_0xc542('0x2d')](function(_0x4748fa){_0x333fcf['count']=_0x4748fa;if(_0xafd0cf[_0xc542('0x45')][_0xc542('0x52')]){_0x3fe00f['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xc542('0x6a')](_0x3fe00f);})['then'](function(_0x2a4c7f){_0x333fcf['rows']=_0x2a4c7f;return _0x333fcf;});}})['then'](respondWithFilteredResult(_0x350e13,_0x3fe00f))[_0xc542('0x58')](handleError(_0x350e13,null));};exports[_0xc542('0x70')]=function(_0x59dc97,_0x5e66b2,_0x54d245){var _0x1e0cfe={'raw':!![],'where':{}};var _0x36423a={};var _0x1961e3={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xc542('0x71')]({'where':{'id':_0x59dc97['params']['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x5e66b2,null))[_0xc542('0x2d')](function(_0x5d62c9){if(_0x5d62c9){_0x36423a['model']=_[_0xc542('0x46')](db[_0xc542('0x72')]['rawAttributes']);_0x36423a[_0xc542('0x45')]=_[_0xc542('0x46')](_0x59dc97[_0xc542('0x45')]);_0x36423a[_0xc542('0x4f')]=_[_0xc542('0x47')](_0x36423a[_0xc542('0x44')],_0x36423a[_0xc542('0x45')]);_0x1e0cfe[_0xc542('0x48')]=_[_0xc542('0x47')](_0x36423a[_0xc542('0x44')],qs[_0xc542('0x49')](_0x59dc97[_0xc542('0x45')][_0xc542('0x49')]));_0x1e0cfe['attributes']=_0x1e0cfe[_0xc542('0x48')][_0xc542('0x4a')]?_0x1e0cfe['attributes']:_0x36423a[_0xc542('0x44')];if(!_0x59dc97[_0xc542('0x45')]['hasOwnProperty'](_0xc542('0x6d'))){_0x1e0cfe['limit']=qs['limit'](_0x59dc97[_0xc542('0x45')][_0xc542('0x24')]);_0x1e0cfe[_0xc542('0x23')]=qs[_0xc542('0x23')](_0x59dc97[_0xc542('0x45')]['offset']);}_0x1e0cfe[_0xc542('0x4c')]=qs[_0xc542('0x4d')](_0x59dc97[_0xc542('0x45')]['sort']);_0x1e0cfe[_0xc542('0x4e')]=qs[_0xc542('0x4f')](_['pick'](_0x59dc97[_0xc542('0x45')],_0x36423a[_0xc542('0x4f')]));_0x1e0cfe[_0xc542('0x4e')][_0xc542('0x69')]=_0x5d62c9['id'];if(_0x59dc97[_0xc542('0x45')]['filter']){_0x1e0cfe[_0xc542('0x4e')]=_[_0xc542('0x50')](_0x1e0cfe[_0xc542('0x4e')],{'$or':_['map'](_0x1e0cfe[_0xc542('0x48')],function(_0x1e1b06){var _0x178266={};_0x178266[_0x1e1b06]={'$like':'%'+_0x59dc97[_0xc542('0x45')][_0xc542('0x34')]+'%'};return _0x178266;})});}_0x1e0cfe=_[_0xc542('0x50')]({},_0x1e0cfe,_0x59dc97[_0xc542('0x57')]);return db[_0xc542('0x72')][_0xc542('0x26')]({'where':_0x1e0cfe[_0xc542('0x4e')]})[_0xc542('0x2d')](function(_0x1be124){_0x1961e3[_0xc542('0x26')]=_0x1be124;if(_0x59dc97[_0xc542('0x45')]['includeAll']){_0x1e0cfe[_0xc542('0x56')]=[{'all':!![]}];}return db[_0xc542('0x72')][_0xc542('0x6a')](_0x1e0cfe);})[_0xc542('0x2d')](function(_0x2ff5fd){_0x1961e3[_0xc542('0x53')]=_0x2ff5fd;return _0x1961e3;});}})['then'](respondWithFilteredResult(_0x5e66b2,_0x1e0cfe))[_0xc542('0x58')](handleError(_0x5e66b2,null));};exports[_0xc542('0x73')]=function(_0x47989b,_0x4a62c8,_0x315265){var _0xb9adf={};var _0x2efcb3={};var _0x38b7df;var _0x76dffe;return db[_0xc542('0x41')][_0xc542('0x71')]({'where':{'id':_0x47989b[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x4a62c8,null))[_0xc542('0x2d')](function(_0x5a7a27){if(_0x5a7a27){_0x38b7df=_0x5a7a27;_0x2efcb3[_0xc542('0x44')]=_[_0xc542('0x46')](db[_0xc542('0x74')][_0xc542('0x55')]);_0x2efcb3[_0xc542('0x45')]=_[_0xc542('0x46')](_0x47989b[_0xc542('0x45')]);_0x2efcb3[_0xc542('0x4f')]=_[_0xc542('0x47')](_0x2efcb3['model'],_0x2efcb3[_0xc542('0x45')]);_0xb9adf['attributes']=_[_0xc542('0x47')](_0x2efcb3[_0xc542('0x44')],qs[_0xc542('0x49')](_0x47989b[_0xc542('0x45')][_0xc542('0x49')]));_0xb9adf[_0xc542('0x48')]=_0xb9adf[_0xc542('0x48')][_0xc542('0x4a')]?_0xb9adf[_0xc542('0x48')]:_0x2efcb3['model'];_0xb9adf[_0xc542('0x4c')]=qs[_0xc542('0x4d')](_0x47989b[_0xc542('0x45')][_0xc542('0x4d')]);_0xb9adf[_0xc542('0x4e')]=qs[_0xc542('0x4f')](_[_0xc542('0x68')](_0x47989b['query'],_0x2efcb3[_0xc542('0x4f')]));if(_0x47989b[_0xc542('0x45')]['filter']){_0xb9adf[_0xc542('0x4e')]=_[_0xc542('0x50')](_0xb9adf['where'],{'$or':_[_0xc542('0x36')](_0xb9adf[_0xc542('0x48')],function(_0x144112){var _0x2b58a8={};_0x2b58a8[_0x144112]={'$like':'%'+_0x47989b[_0xc542('0x45')]['filter']+'%'};return _0x2b58a8;})});}_0xb9adf=_[_0xc542('0x50')]({},_0xb9adf,_0x47989b[_0xc542('0x57')]);return _0x38b7df[_0xc542('0x73')](_0xb9adf);}})[_0xc542('0x2d')](function(_0x3771cc){if(_0x3771cc){_0x76dffe=_0x3771cc[_0xc542('0x4a')];if(!_0x47989b[_0xc542('0x45')][_0xc542('0x4b')](_0xc542('0x6d'))){_0xb9adf[_0xc542('0x24')]=qs[_0xc542('0x24')](_0x47989b[_0xc542('0x45')]['limit']);_0xb9adf['offset']=qs[_0xc542('0x23')](_0x47989b['query']['offset']);}return _0x38b7df['getTeams'](_0xb9adf);}})[_0xc542('0x2d')](function(_0x35c8c0){if(_0x35c8c0){return _0x35c8c0?{'count':_0x76dffe,'rows':_0x35c8c0}:null;}})[_0xc542('0x2d')](respondWithResult(_0x4a62c8,null))['catch'](handleError(_0x4a62c8,null));};exports[_0xc542('0x75')]=function(_0x2eed0b,_0x527b38,_0x5365e5){var _0x5652ea=_0x2eed0b[_0xc542('0x5a')][_0xc542('0x76')];var _0x1741f0=_[_0xc542('0x36')](_0x5652ea,'id');return db[_0xc542('0x74')][_0xc542('0x6a')]({'where':{'id':_0x1741f0},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xc542('0x77'),_0xc542('0x78'),_0xc542('0x79')],'raw':!![]}]})[_0xc542('0x2d')](function(_0x2f39d8){if(_0x2f39d8){var _0x1a5cb9=_[_0xc542('0x7a')](_0x2f39d8,function(_0x1d4148){var _0x9ba5b7=_0x1d4148['get']({'plain':!![]});_0x9ba5b7[_0xc542('0x7b')]['forEach'](function(_0x4ae47a){_0x4ae47a[_0xc542('0x7c')]=_[_0xc542('0x3a')](_0x5652ea,{'id':_0x9ba5b7['id']})[_0xc542('0x7c')];});return _0x9ba5b7['Agents'];});return db[_0xc542('0x41')][_0xc542('0x3a')]({'where':{'id':_0x2eed0b[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](function(_0x1cf5aa){return db[_0xc542('0x7d')][_0xc542('0x7e')](function(_0x55cd6b){return _0x1cf5aa['addTeams'](_0x1741f0,{'transaction':_0x55cd6b})[_0xc542('0x2d')](function(){return BPromise[_0xc542('0x7f')](_0x5652ea,function(_0x7584dd){return db[_0xc542('0x80')][_0xc542('0x81')]({'TeamId':_0x7584dd['id'],'VoiceQueueId':_0x2eed0b[_0xc542('0x63')]['id'],'penalty':_0x7584dd[_0xc542('0x7c')]},{'transaction':_0x55cd6b});});})[_0xc542('0x2d')](function(){return BPromise[_0xc542('0x7f')](_0x1a5cb9,function(_0x15d605){return db[_0xc542('0x82')]['findOrCreate']({'where':{'UserId':_0x15d605['id'],'VoiceQueueId':_0x2eed0b[_0xc542('0x63')]['id']},'defaults':{'penalty':_0x15d605[_0xc542('0x7c')]},'transaction':_0x55cd6b});});})['then'](function(){return BPromise[_0xc542('0x7f')](_[_0xc542('0x34')](_0x1a5cb9,{'online':!![]}),function(_0x31528b){return db[_0xc542('0x83')][_0xc542('0x81')]({'membername':_0x31528b['name'],'UserId':_0x31528b['id'],'queue_name':_0x1cf5aa['name'],'VoiceQueueId':_0x1cf5aa['id'],'interface':_[_0xc542('0x84')](_0x31528b[_0xc542('0x79')])?util['format'](_0xc542('0x85'),_0x31528b['name']):_0x31528b[_0xc542('0x79')],'paused':_0x31528b[_0xc542('0x78')]||![],'penalty':_0x31528b['penalty']},{'transaction':_0x55cd6b});});})[_0xc542('0x2d')](function(){_0x1a5cb9['forEach'](function(_0x22189a){socket[_0xc542('0x86')]('userVoiceQueue:save',{'UserId':_0x22189a['id'],'VoiceQueueId':_0x1cf5aa['id']});});});});});}})[_0xc542('0x2d')](respondWithStatusCode(_0x527b38,null))[_0xc542('0x58')](handleError(_0x527b38,null));};exports[_0xc542('0x87')]=function(_0x209bce,_0x4499cf,_0x474ab9){return db[_0xc542('0x74')]['findAll']({'where':{'id':_0x209bce[_0xc542('0x45')][_0xc542('0x88')]},'attributes':['id'],'include':[{'model':db[_0xc542('0x89')],'as':_0xc542('0x7b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4499cf,null))[_0xc542('0x2d')](function(_0x8728ad){var _0x37d7fb=_[_0xc542('0x36')](_0x8728ad,'id');var _0x51a5e9=[];var _0x2eca59=[];var _0x2daefd=squel['select']();_0x2daefd[_0xc542('0x8a')]('tq.TeamId')[_0xc542('0x8b')]('team_has_voice_queues','tq')[_0xc542('0x8c')](_0xc542('0x8d'),'ut',_0xc542('0x8e'))[_0xc542('0x4e')](_0xc542('0x8f'),_0x209bce[_0xc542('0x63')]['id']);for(var _0x27dc95=0x0;_0x27dc95<_0x8728ad[_0xc542('0x4a')];_0x27dc95+=0x1){let _0x1c666c=_0x8728ad[_0x27dc95];for(var _0xa9dd60=0x0;_0xa9dd60<_0x1c666c['Agents'][_0xc542('0x4a')];_0xa9dd60+=0x1){let _0x4e1b33=_0x1c666c[_0xc542('0x7b')][_0xa9dd60];var _0x370359=_0x2daefd['clone']();_0x370359[_0xc542('0x4e')](_0xc542('0x90'),_0x4e1b33['id']);_0x2eca59[_0xc542('0x91')](db[_0xc542('0x7d')]['query'](_0x370359[_0xc542('0x92')](),{'type':db[_0xc542('0x7d')][_0xc542('0x93')][_0xc542('0x94')]})['then'](function(_0x2c558e){if(_0x2c558e[_0xc542('0x4a')]===0x1){return _0x4e1b33['id'];}else{var _0x150fd2=_[_0xc542('0x95')](_[_0xc542('0x36')](_0x2c558e,_0xc542('0x96')),function(_0xc664c8){return _[_0xc542('0x38')](_0x37d7fb,_0xc664c8);});if(_0x150fd2){return _0x4e1b33['id'];}}}));}}return BPromise[_0xc542('0x97')](_0x2eca59)[_0xc542('0x2d')](function(_0x3b4a81){_0x51a5e9=_(_0x51a5e9)['union'](_0x3b4a81)['compact']()[_0xc542('0x37')]();return db[_0xc542('0x41')][_0xc542('0x3a')]({'where':{'id':_0x209bce[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](function(_0x984dd7){return db[_0xc542('0x7d')][_0xc542('0x7e')](function(_0x59f393){return _0x984dd7[_0xc542('0x87')](_0x209bce[_0xc542('0x45')][_0xc542('0x88')],{'transaction':_0x59f393})[_0xc542('0x2d')](function(){if(!_[_0xc542('0x98')](_0x51a5e9)){return _0x984dd7[_0xc542('0x99')](_0x51a5e9,{'transaction':_0x59f393})['then'](function(){return db[_0xc542('0x83')][_0xc542('0x2e')]({'where':{'VoiceQueueId':_0x209bce[_0xc542('0x63')]['id'],'UserId':_0x51a5e9},'transaction':_0x59f393});});}})[_0xc542('0x2d')](function(){_0x51a5e9[_0xc542('0x9a')](function(_0x17a612){socket[_0xc542('0x86')]('userVoiceQueue:remove',{'UserId':_0x17a612,'VoiceQueueId':_0x984dd7['id']});});});});});});})['then'](respondWithStatusCode(_0x4499cf,null))['catch'](handleError(_0x4499cf,null));};exports['addAgents']=function(_0x46af0e,_0x9da845,_0x233db6){var _0x1fed3d,_0x440952;return db[_0xc542('0x41')]['find']({'where':{'id':_0x46af0e['params']['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x9da845,null))[_0xc542('0x2d')](function(_0x246087){if(_0x246087){_0x440952=_0x246087;return _0x246087['addAgents'](_0x46af0e[_0xc542('0x5a')][_0xc542('0x88')],_[_0xc542('0x64')](_0x46af0e[_0xc542('0x5a')],[_0xc542('0x88'),'id'])||{})[_0xc542('0x9b')](function(_0x1ce20e){for(var _0x1b51b6=0x0;_0x1b51b6<_0x46af0e['body'][_0xc542('0x88')][_0xc542('0x4a')];_0x1b51b6+=0x1){socket[_0xc542('0x86')](_0xc542('0x9c'),{'UserId':Number(_0x46af0e['body']['ids'][_0x1b51b6]),'VoiceQueueId':Number(_0x46af0e[_0xc542('0x63')]['id'])});}return _0x1ce20e;});}})['then'](function(_0x5d7c4d){_0x1fed3d=_0x5d7c4d||[];if(_0x440952){return db[_0xc542('0x89')]['findAll']({'where':{'id':_0x46af0e[_0xc542('0x5a')][_0xc542('0x88')]},'attributes':['id',_0xc542('0x3e'),'online',_0xc542('0x78'),_0xc542('0x79')],'raw':!![]});}})[_0xc542('0x2d')](function(_0x4b78c4){if(!_[_0xc542('0x98')](_0x4b78c4)){var _0x297dcd=[];for(var _0x2e9981=0x0;_0x2e9981<_0x4b78c4['length'];_0x2e9981++){if(_0x4b78c4[_0x2e9981][_0xc542('0x77')]){_0x297dcd[_0xc542('0x91')](db['UserVoiceQueueRt']['upsert']({'membername':_0x4b78c4[_0x2e9981][_0xc542('0x3e')],'UserId':_0x4b78c4[_0x2e9981]['id'],'queue_name':_0x440952[_0xc542('0x3e')],'VoiceQueueId':_0x440952['id'],'interface':_[_0xc542('0x84')](_0x4b78c4[_0x2e9981][_0xc542('0x79')])?util[_0xc542('0x9d')](_0xc542('0x85'),_0x4b78c4[_0x2e9981][_0xc542('0x3e')]):_0x4b78c4[_0x2e9981][_0xc542('0x79')],'paused':_0x4b78c4[_0x2e9981][_0xc542('0x78')]||![],'penalty':_0x46af0e['body'][_0xc542('0x7c')]||0x0}));}}return BPromise[_0xc542('0x97')](_0x297dcd);}})[_0xc542('0x2d')](function(){return _0x1fed3d;})[_0xc542('0x2d')](respondWithResult(_0x9da845,null))[_0xc542('0x58')](handleError(_0x9da845,null));};exports[_0xc542('0x99')]=function(_0x4593eb,_0x18e91e,_0x228159){return db[_0xc542('0x41')][_0xc542('0x3a')]({'where':{'id':_0x4593eb[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x18e91e,null))[_0xc542('0x2d')](function(_0x4cc636){if(_0x4cc636){return _0x4cc636[_0xc542('0x99')](_0x4593eb[_0xc542('0x45')][_0xc542('0x88')])[_0xc542('0x2d')](function(){if(_[_0xc542('0x9e')](_0x4593eb[_0xc542('0x45')][_0xc542('0x88')])){for(var _0x3a8b2b=0x0;_0x3a8b2b<_0x4593eb[_0xc542('0x45')][_0xc542('0x88')]['length'];_0x3a8b2b+=0x1){socket[_0xc542('0x86')](_0xc542('0x9f'),{'UserId':Number(_0x4593eb[_0xc542('0x45')][_0xc542('0x88')][_0x3a8b2b]),'VoiceQueueId':Number(_0x4593eb[_0xc542('0x63')]['id'])});}}else{socket[_0xc542('0x86')](_0xc542('0x9f'),{'UserId':Number(_0x4593eb[_0xc542('0x45')]['ids']),'VoiceQueueId':Number(_0x4593eb[_0xc542('0x63')]['id'])});}});}})[_0xc542('0x2d')](function(_0x2834f1){return db[_0xc542('0x83')][_0xc542('0x2e')]({'where':{'VoiceQueueId':_0x4593eb['params']['id'],'UserId':_0x4593eb['query'][_0xc542('0x88')]}})[_0xc542('0x2d')](function(){return _0x2834f1;});})['then'](respondWithStatusCode(_0x18e91e,null))[_0xc542('0x58')](handleError(_0x18e91e,null));};exports[_0xc542('0xa0')]=function(_0x2fd9d5,_0x3bf352,_0x11a082){var _0x294d08={};var _0x4e9ebc={};var _0x3086e0;var _0xaab869;return db[_0xc542('0x41')][_0xc542('0x71')]({'where':{'id':_0x2fd9d5[_0xc542('0x63')]['id']}})['then'](handleEntityNotFound(_0x3bf352,null))[_0xc542('0x2d')](function(_0x52bc98){if(_0x52bc98){_0x3086e0=_0x52bc98;_0x4e9ebc[_0xc542('0x44')]=_[_0xc542('0x46')](db['User'][_0xc542('0x55')]);_0x4e9ebc['query']=_[_0xc542('0x46')](_0x2fd9d5[_0xc542('0x45')]);_0x4e9ebc[_0xc542('0x4f')]=_['intersection'](_0x4e9ebc[_0xc542('0x44')],_0x4e9ebc[_0xc542('0x45')]);_0x294d08[_0xc542('0x48')]=_['intersection'](_0x4e9ebc[_0xc542('0x44')],qs[_0xc542('0x49')](_0x2fd9d5[_0xc542('0x45')]['fields']));_0x294d08[_0xc542('0x48')]=_0x294d08[_0xc542('0x48')][_0xc542('0x4a')]?_0x294d08['attributes']:_0x4e9ebc[_0xc542('0x44')];_0x294d08[_0xc542('0x4c')]=qs[_0xc542('0x4d')](_0x2fd9d5[_0xc542('0x45')][_0xc542('0x4d')]);_0x294d08[_0xc542('0x4e')]=qs[_0xc542('0x4f')](_[_0xc542('0x68')](_0x2fd9d5['query'],_0x4e9ebc[_0xc542('0x4f')]));if(_0x2fd9d5['query']['filter']){_0x294d08[_0xc542('0x4e')]=_[_0xc542('0x50')](_0x294d08[_0xc542('0x4e')],{'$or':_[_0xc542('0x36')](_0x294d08['attributes'],function(_0x109310){var _0x694e26={};_0x694e26[_0x109310]={'$like':'%'+_0x2fd9d5[_0xc542('0x45')]['filter']+'%'};return _0x694e26;})});}_0x294d08=_[_0xc542('0x50')]({},_0x294d08,_0x2fd9d5[_0xc542('0x57')]);return _0x3086e0[_0xc542('0xa0')](_0x294d08);}})[_0xc542('0x2d')](function(_0x122ba0){if(_0x122ba0){_0xaab869=_0x122ba0[_0xc542('0x4a')];if(!_0x2fd9d5['query'][_0xc542('0x4b')]('nolimit')){_0x294d08[_0xc542('0x24')]=qs[_0xc542('0x24')](_0x2fd9d5[_0xc542('0x45')][_0xc542('0x24')]);_0x294d08[_0xc542('0x23')]=qs[_0xc542('0x23')](_0x2fd9d5[_0xc542('0x45')][_0xc542('0x23')]);}return _0x3086e0[_0xc542('0xa0')](_0x294d08);}})['then'](function(_0x19b610){if(_0x19b610){return _0x19b610?{'count':_0xaab869,'rows':_0x19b610}:null;}})['then'](respondWithResult(_0x3bf352,null))[_0xc542('0x58')](handleError(_0x3bf352,null));};exports[_0xc542('0xa1')]=function(_0x24ece2,_0x3966bf,_0x595c6e){var _0x4e09c2={};var _0x426eb3={};var _0x11bc22;var _0x473e2c;return db[_0xc542('0x41')]['findOne']({'where':{'id':_0x24ece2[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x3966bf,null))['then'](function(_0x11c971){if(_0x11c971){_0x11bc22=_0x11c971;_0x426eb3[_0xc542('0x44')]=_['keys'](db[_0xc542('0x83')]['rawAttributes']);_0x426eb3[_0xc542('0x45')]=_['keys'](_0x24ece2[_0xc542('0x45')]);_0x426eb3[_0xc542('0x4f')]=_[_0xc542('0x47')](_0x426eb3[_0xc542('0x44')],_0x426eb3[_0xc542('0x45')]);_0x4e09c2[_0xc542('0x48')]=_[_0xc542('0x47')](_0x426eb3['model'],qs['fields'](_0x24ece2[_0xc542('0x45')][_0xc542('0x49')]));_0x4e09c2[_0xc542('0x48')]=_0x4e09c2[_0xc542('0x48')][_0xc542('0x4a')]?_0x4e09c2[_0xc542('0x48')]:_0x426eb3['model'];_0x4e09c2[_0xc542('0x4c')]=qs[_0xc542('0x4d')](_0x24ece2[_0xc542('0x45')][_0xc542('0x4d')]);_0x4e09c2['where']=qs[_0xc542('0x4f')](_[_0xc542('0x68')](_0x24ece2[_0xc542('0x45')],_0x426eb3['filters']));if(_0x24ece2['query']['filter']){_0x4e09c2[_0xc542('0x4e')]=_[_0xc542('0x50')](_0x4e09c2[_0xc542('0x4e')],{'$or':_[_0xc542('0x36')](_0x4e09c2[_0xc542('0x48')],function(_0x2492e1){var _0x4fee82={};_0x4fee82[_0x2492e1]={'$like':'%'+_0x24ece2[_0xc542('0x45')][_0xc542('0x34')]+'%'};return _0x4fee82;})});}_0x4e09c2=_[_0xc542('0x50')]({},_0x4e09c2,_0x24ece2[_0xc542('0x57')]);return _0x11bc22[_0xc542('0xa1')](_0x4e09c2);}})[_0xc542('0x2d')](function(_0x121899){if(_0x121899){_0x473e2c=_0x121899[_0xc542('0x4a')];if(!_0x24ece2[_0xc542('0x45')][_0xc542('0x4b')](_0xc542('0x6d'))){_0x4e09c2['limit']=qs['limit'](_0x24ece2[_0xc542('0x45')][_0xc542('0x24')]);_0x4e09c2['offset']=qs[_0xc542('0x23')](_0x24ece2[_0xc542('0x45')]['offset']);}return _0x11bc22[_0xc542('0xa1')](_0x4e09c2);}})[_0xc542('0x2d')](function(_0xf7cfca){return _0xf7cfca?{'count':_0x473e2c,'rows':_0xf7cfca}:null;})[_0xc542('0x2d')](respondWithResult(_0x3966bf,null))[_0xc542('0x58')](handleError(_0x3966bf,null));};exports['getLists']=function(_0x10b07c,_0x3faf06,_0xc850f1){var _0x17f04b={};var _0x180af7={};var _0x48fbe2;var _0x295025;return db[_0xc542('0x41')]['findOne']({'where':{'id':_0x10b07c[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x3faf06,null))[_0xc542('0x2d')](function(_0x5b3d7b){if(_0x5b3d7b){_0x48fbe2=_0x5b3d7b;_0x180af7[_0xc542('0x44')]=_[_0xc542('0x46')](db[_0xc542('0xa2')][_0xc542('0x55')]);_0x180af7[_0xc542('0x45')]=_[_0xc542('0x46')](_0x10b07c[_0xc542('0x45')]);_0x180af7[_0xc542('0x4f')]=_[_0xc542('0x47')](_0x180af7['model'],_0x180af7[_0xc542('0x45')]);_0x17f04b[_0xc542('0x48')]=_[_0xc542('0x47')](_0x180af7[_0xc542('0x44')],qs[_0xc542('0x49')](_0x10b07c[_0xc542('0x45')]['fields']));_0x17f04b[_0xc542('0x48')]=_0x17f04b[_0xc542('0x48')]['length']?_0x17f04b[_0xc542('0x48')]:_0x180af7[_0xc542('0x44')];_0x17f04b[_0xc542('0x4c')]=qs[_0xc542('0x4d')](_0x10b07c[_0xc542('0x45')][_0xc542('0x4d')]);_0x17f04b['where']=qs['filters'](_[_0xc542('0x68')](_0x10b07c[_0xc542('0x45')],_0x180af7[_0xc542('0x4f')]));if(_0x10b07c['query'][_0xc542('0x34')]){_0x17f04b[_0xc542('0x4e')]=_[_0xc542('0x50')](_0x17f04b[_0xc542('0x4e')],{'$or':_[_0xc542('0x36')](_0x17f04b[_0xc542('0x48')],function(_0x82e0b2){var _0x5ca1b2={};_0x5ca1b2[_0x82e0b2]={'$like':'%'+_0x10b07c[_0xc542('0x45')]['filter']+'%'};return _0x5ca1b2;})});}_0x17f04b=_[_0xc542('0x50')]({},_0x17f04b,_0x10b07c['options']);return _0x48fbe2[_0xc542('0xa3')](_0x17f04b);}})[_0xc542('0x2d')](function(_0x129d74){if(_0x129d74){_0x295025=_0x129d74[_0xc542('0x4a')];if(!_0x10b07c['query'][_0xc542('0x4b')](_0xc542('0x6d'))){_0x17f04b[_0xc542('0x24')]=qs[_0xc542('0x24')](_0x10b07c['query'][_0xc542('0x24')]);_0x17f04b[_0xc542('0x23')]=qs[_0xc542('0x23')](_0x10b07c[_0xc542('0x45')][_0xc542('0x23')]);}return _0x48fbe2[_0xc542('0xa3')](_0x17f04b);}})[_0xc542('0x2d')](function(_0xc04cad){if(_0xc04cad){return _0xc04cad?{'count':_0x295025,'rows':_0xc04cad}:null;}})[_0xc542('0x2d')](respondWithResult(_0x3faf06,null))[_0xc542('0x58')](handleError(_0x3faf06,null));};exports['addLists']=function(_0x541e1c,_0x13e478,_0x383122){var _0x337f1c,_0xbb9fe8;return db[_0xc542('0x41')]['find']({'where':{'id':_0x541e1c[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x13e478,null))[_0xc542('0x2d')](function(_0x4dc852){if(_0x4dc852){_0xbb9fe8=_0x4dc852;return _0x4dc852[_0xc542('0xa4')](_0x541e1c[_0xc542('0x5a')][_0xc542('0x88')],_[_0xc542('0x64')](_0x541e1c[_0xc542('0x5a')],[_0xc542('0x88'),'id'])||{});}return null;})[_0xc542('0x9b')](function(_0x2bae15){var _0xcc006c;_0x337f1c=_0x2bae15||[];var _0x436d54=[];if(_0x2bae15){for(var _0x2cf566=0x0;_0x2cf566<_0x2bae15['length'];_0x2cf566+=0x1){var _0x3f1e16=_0x2bae15[_0x2cf566][_0xc542('0x2f')]({'plain':!![]});_0xbb9fe8[_0xc542('0xa5')]=_0x541e1c[_0xc542('0x5a')][_0xc542('0xa5')]?_0x541e1c[_0xc542('0x5a')][_0xc542('0xa5')]:_0xbb9fe8[_0xc542('0xa5')];switch(_0xbb9fe8[_0xc542('0xa5')]){case _0xc542('0xa6'):_0xcc006c=squel['insert']()['into']('cm_hopper')[_0xc542('0xa7')]([_0xc542('0xa8'),_0xc542('0xa9'),'ContactId','ListId',_0xc542('0x69'),'createdAt',_0xc542('0x66')],squel[_0xc542('0xaa')]()[_0xc542('0x8a')](_0xc542('0xa8'),'phone')[_0xc542('0x8a')]('NOW()',_0xc542('0xa9'))[_0xc542('0x8a')]('id',_0xc542('0xab'))[_0xc542('0x8a')](_0x3f1e16[_0xc542('0xac')][_0xc542('0x92')](),_0xc542('0xad'))[_0xc542('0x8a')](_0x541e1c[_0xc542('0x63')]['id'][_0xc542('0x92')](),'VoiceQueueId')[_0xc542('0x8a')](_0xc542('0xae'),_0xc542('0x65'))[_0xc542('0x8a')](_0xc542('0xae'),_0xc542('0x66'))[_0xc542('0x8b')]('cm_contacts')[_0xc542('0x4e')](_0xc542('0xaf'))[_0xc542('0x4e')](_0xc542('0xb0'),_0x3f1e16[_0xc542('0xac')][_0xc542('0x92')]())[_0xc542('0x4e')]('phone\x20IS\x20NOT\x20NULL')[_0xc542('0x4e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc542('0xaa')]()[_0xc542('0x8a')](_0xc542('0xb1'))[_0xc542('0x8b')](_0xc542('0xb2'))[_0xc542('0x4e')](_0xc542('0x8f'),_0x541e1c['params']['id'][_0xc542('0x92')]()))[_0xc542('0x4e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc542('0xaa')]()[_0xc542('0x8a')](_0xc542('0xb3'))[_0xc542('0x8b')]('cm_hopper')[_0xc542('0x4e')](_0xc542('0x8f'),_0x541e1c['params']['id'][_0xc542('0x92')]())))[_0xc542('0x92')]();break;case _0xc542('0xb4'):_0xcc006c=squel[_0xc542('0xb5')]()[_0xc542('0xb6')]('cm_hopper')[_0xc542('0xa7')]([_0xc542('0xa8'),_0xc542('0xa9'),_0xc542('0xab'),_0xc542('0xad'),_0xc542('0x69'),'createdAt',_0xc542('0x66')],squel[_0xc542('0xaa')]()[_0xc542('0x8a')](_0xc542('0xa8'),_0xc542('0xa8'))['field'](_0xc542('0xae'),_0xc542('0xa9'))[_0xc542('0x8a')]('id','ContactId')[_0xc542('0x8a')](_0x3f1e16[_0xc542('0xac')][_0xc542('0x92')](),_0xc542('0xad'))[_0xc542('0x8a')](_0x541e1c['params']['id'][_0xc542('0x92')](),_0xc542('0x69'))[_0xc542('0x8a')]('NOW()',_0xc542('0x65'))[_0xc542('0x8a')]('NOW()',_0xc542('0x66'))[_0xc542('0x8b')](_0xc542('0xb7'))[_0xc542('0x4e')](_0xc542('0xaf'))[_0xc542('0x4e')](_0xc542('0xb0'),_0x3f1e16[_0xc542('0xac')][_0xc542('0x92')]())[_0xc542('0x4e')]('phone\x20IS\x20NOT\x20NULL')[_0xc542('0x4e')](_0xc542('0xb8'),squel[_0xc542('0xaa')]()[_0xc542('0x8a')](_0xc542('0xb3'))[_0xc542('0x8b')]('cm_hopper')['where'](_0xc542('0x8f'),_0x541e1c[_0xc542('0x63')]['id']['toString']())))[_0xc542('0x92')]();break;default:_0xcc006c=squel[_0xc542('0xb5')]()['into'](_0xc542('0xb9'))[_0xc542('0xa7')]([_0xc542('0xa8'),_0xc542('0xa9'),_0xc542('0xab'),_0xc542('0xad'),_0xc542('0x69'),_0xc542('0x65'),_0xc542('0x66')],squel['select']()[_0xc542('0x8a')](_0xc542('0xa8'),_0xc542('0xa8'))[_0xc542('0x8a')](_0xc542('0xae'),_0xc542('0xa9'))['field']('id',_0xc542('0xab'))[_0xc542('0x8a')](_0x3f1e16[_0xc542('0xac')][_0xc542('0x92')](),'ListId')[_0xc542('0x8a')](_0x541e1c[_0xc542('0x63')]['id'][_0xc542('0x92')](),_0xc542('0x69'))['field'](_0xc542('0xae'),_0xc542('0x65'))[_0xc542('0x8a')](_0xc542('0xae'),_0xc542('0x66'))[_0xc542('0x8b')](_0xc542('0xb7'))[_0xc542('0x4e')](_0xc542('0xaf'))['where'](_0xc542('0xb0'),_0x3f1e16[_0xc542('0xac')][_0xc542('0x92')]())[_0xc542('0x4e')](_0xc542('0xba')))[_0xc542('0x92')]();}_0x436d54[_0xc542('0x91')](db[_0xc542('0x7d')][_0xc542('0x45')](_0xcc006c));}return BPromise['all'](_0x436d54);}})[_0xc542('0x2d')](function(){return _0x337f1c;})[_0xc542('0x2d')](respondWithResult(_0x13e478,null))['catch'](handleError(_0x13e478,null));};exports[_0xc542('0xbb')]=function(_0x55269f,_0x45f1a1,_0x246fb6){return db[_0xc542('0x41')][_0xc542('0x3a')]({'where':{'id':_0x55269f[_0xc542('0x63')]['id']}})['then'](handleEntityNotFound(_0x45f1a1,null))[_0xc542('0x2d')](function(_0x52682d){if(_0x52682d){return _0x52682d[_0xc542('0xbb')](_0x55269f[_0xc542('0x45')][_0xc542('0x88')]);}})[_0xc542('0x2d')](function(_0xb5e734){if(_0xb5e734){return db[_0xc542('0x67')]['destroy']({'where':{'ListId':_0x55269f[_0xc542('0x45')][_0xc542('0x88')],'VoiceQueueId':_0x55269f['params']['id']}})[_0xc542('0x2d')](function(){return _0xb5e734;});}})[_0xc542('0x2d')](respondWithStatusCode(_0x45f1a1,null))[_0xc542('0x58')](handleError(_0x45f1a1,null));};exports[_0xc542('0xbc')]=function(_0x2ce094,_0x180c57,_0x3d75a0){var _0x579143={};var _0x13ffa3={};var _0x3e9176;var _0x3b0fd8;return db[_0xc542('0x41')][_0xc542('0x71')]({'where':{'id':_0x2ce094[_0xc542('0x63')]['id']}})['then'](handleEntityNotFound(_0x180c57,null))[_0xc542('0x2d')](function(_0x573e5c){if(_0x573e5c){_0x3e9176=_0x573e5c;_0x13ffa3['model']=_['keys'](db[_0xc542('0xa2')][_0xc542('0x55')]);_0x13ffa3[_0xc542('0x45')]=_[_0xc542('0x46')](_0x2ce094[_0xc542('0x45')]);_0x13ffa3[_0xc542('0x4f')]=_[_0xc542('0x47')](_0x13ffa3['model'],_0x13ffa3[_0xc542('0x45')]);_0x579143[_0xc542('0x48')]=_[_0xc542('0x47')](_0x13ffa3[_0xc542('0x44')],qs['fields'](_0x2ce094[_0xc542('0x45')][_0xc542('0x49')]));_0x579143[_0xc542('0x48')]=_0x579143[_0xc542('0x48')][_0xc542('0x4a')]?_0x579143[_0xc542('0x48')]:_0x13ffa3[_0xc542('0x44')];_0x579143[_0xc542('0x4c')]=qs['sort'](_0x2ce094['query']['sort']);_0x579143['where']=qs[_0xc542('0x4f')](_['pick'](_0x2ce094[_0xc542('0x45')],_0x13ffa3[_0xc542('0x4f')]));if(_0x2ce094[_0xc542('0x45')][_0xc542('0x34')]){_0x579143[_0xc542('0x4e')]=_[_0xc542('0x50')](_0x579143['where'],{'$or':_[_0xc542('0x36')](_0x579143[_0xc542('0x48')],function(_0x3f5fa9){var _0x1cecea={};_0x1cecea[_0x3f5fa9]={'$like':'%'+_0x2ce094['query'][_0xc542('0x34')]+'%'};return _0x1cecea;})});}_0x579143=_['merge']({},_0x579143,_0x2ce094[_0xc542('0x57')]);return _0x3e9176[_0xc542('0xbc')](_0x579143);}})[_0xc542('0x2d')](function(_0x3c38e4){if(_0x3c38e4){_0x3b0fd8=_0x3c38e4[_0xc542('0x4a')];if(!_0x2ce094['query']['hasOwnProperty']('nolimit')){_0x579143[_0xc542('0x24')]=qs[_0xc542('0x24')](_0x2ce094[_0xc542('0x45')][_0xc542('0x24')]);_0x579143[_0xc542('0x23')]=qs['offset'](_0x2ce094[_0xc542('0x45')][_0xc542('0x23')]);}return _0x3e9176[_0xc542('0xbc')](_0x579143);}})[_0xc542('0x2d')](function(_0xa92c3b){if(_0xa92c3b){return _0xa92c3b?{'count':_0x3b0fd8,'rows':_0xa92c3b}:null;}})[_0xc542('0x2d')](respondWithResult(_0x180c57,null))[_0xc542('0x58')](handleError(_0x180c57,null));};exports[_0xc542('0xbd')]=function(_0x2bc9e8,_0x31d82b,_0x4db1ee){var _0xede2d2,_0x1d1aa6;return db['VoiceQueue'][_0xc542('0x3a')]({'where':{'id':_0x2bc9e8[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x31d82b,null))[_0xc542('0x2d')](function(_0x366eb6){if(_0x366eb6){_0x1d1aa6=_0x366eb6;return _0x366eb6['addBlackLists'](_0x2bc9e8[_0xc542('0x5a')][_0xc542('0x88')],_[_0xc542('0x64')](_0x2bc9e8[_0xc542('0x5a')],[_0xc542('0x88'),'id'])||{});}return null;})[_0xc542('0x9b')](function(_0x2e1a81){var _0x46fb57;_0xede2d2=_0x2e1a81||[];var _0x551227=[];if(_0x2e1a81){for(var _0x27f9bd=0x0;_0x27f9bd<_0x2e1a81[_0xc542('0x4a')];_0x27f9bd+=0x1){var _0x30456f=_0x2e1a81[_0x27f9bd][_0xc542('0x2f')]({'plain':!![]});_0x46fb57=squel[_0xc542('0xb5')]()[_0xc542('0xb6')](_0xc542('0xbe'))['fromQuery']([_0xc542('0xa8'),'ContactId',_0xc542('0xad'),_0xc542('0x69'),_0xc542('0x65'),_0xc542('0x66')],squel[_0xc542('0xaa')]()[_0xc542('0x8a')]('phone',_0xc542('0xa8'))[_0xc542('0x8a')]('id',_0xc542('0xab'))['field'](_0x30456f['CmListId']['toString'](),_0xc542('0xad'))[_0xc542('0x8a')](_0x2bc9e8['params']['id']['toString'](),_0xc542('0x69'))[_0xc542('0x8a')](_0xc542('0xae'),_0xc542('0x65'))['field'](_0xc542('0xae'),_0xc542('0x66'))[_0xc542('0x8b')]('cm_contacts')[_0xc542('0x4e')](_0xc542('0xaf'))[_0xc542('0x4e')]('ListId\x20=\x20?',_0x30456f[_0xc542('0xac')][_0xc542('0x92')]())[_0xc542('0x4e')]('phone\x20IS\x20NOT\x20NULL'))[_0xc542('0x92')]();_0x551227['push'](db[_0xc542('0x7d')][_0xc542('0x45')](_0x46fb57));}return BPromise['all'](_0x551227);}})['then'](function(){return _0xede2d2;})[_0xc542('0x2d')](respondWithResult(_0x31d82b,null))['catch'](handleError(_0x31d82b,null));};exports[_0xc542('0xbf')]=function(_0xa66cad,_0x2f8438,_0x30ca2e){return db[_0xc542('0x41')]['find']({'where':{'id':_0xa66cad[_0xc542('0x63')]['id']}})[_0xc542('0x2d')](handleEntityNotFound(_0x2f8438,null))[_0xc542('0x2d')](function(_0x5e0ccf){if(_0x5e0ccf){return _0x5e0ccf[_0xc542('0xbf')](_0xa66cad[_0xc542('0x45')][_0xc542('0x88')]);}})[_0xc542('0x2d')](function(_0x200d9b){if(_0x200d9b){return db[_0xc542('0x72')][_0xc542('0x2e')]({'where':{'ListId':_0xa66cad['query'][_0xc542('0x88')],'VoiceQueueId':_0xa66cad[_0xc542('0x63')]['id']}})['then'](function(){return _0x200d9b;});}})[_0xc542('0x2d')](respondWithStatusCode(_0x2f8438,null))[_0xc542('0x58')](handleError(_0x2f8438,null));}; \ No newline at end of file +var _0x2109=['reject','update','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','ignore','map','type','find','name','UserProfileResource','end','error','stack','send','VoiceQueue','fieldName','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','inbound','value','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','body','omit','createdAt','userProfileId','findOne','CmHopper','order','VoiceQueueId','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','getHopperBlacks','CmHopperBlack','getTeams','Team','online','voicePause','flatMap','Agents','penalty','sequelize','transaction','addTeams','each','TeamVoiceQueue','upsert','findOrCreate','isNil','interface','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','User','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','isEmpty','UserVoiceQueueRt','forEach','userVoiceQueue:remove','addAgents','removeAgents','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','select','field','NOW()','ContactId','CmListId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','status','json','limit','undefined','count','offset'];(function(_0x3d69f7,_0x34bbc0){var _0x35ea27=function(_0x513bf2){while(--_0x513bf2){_0x3d69f7['push'](_0x3d69f7['shift']());}};_0x35ea27(++_0x34bbc0);}(_0x2109,0x149));var _0x9210=function(_0x4dde75,_0x1ae553){_0x4dde75=_0x4dde75-0x0;var _0x527c34=_0x2109[_0x4dde75];return _0x527c34;};'use strict';var emlformat=require(_0x9210('0x0'));var rimraf=require(_0x9210('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9210('0x2'));var rp=require(_0x9210('0x3'));var moment=require(_0x9210('0x4'));var BPromise=require(_0x9210('0x5'));var Mustache=require(_0x9210('0x6'));var util=require(_0x9210('0x7'));var path=require('path');var sox=require(_0x9210('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9210('0x9'));var _=require(_0x9210('0xa'));var squel=require(_0x9210('0xb'));var crypto=require(_0x9210('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9210('0xd'));var toCsv=require(_0x9210('0xe'));var querystring=require(_0x9210('0xf'));var Papa=require(_0x9210('0x10'));var Redis=require('ioredis');var authService=require(_0x9210('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9210('0x12'))(_0x9210('0x13'));var utils=require(_0x9210('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9210('0x15'));var db=require(_0x9210('0x16'))['db'];config[_0x9210('0x17')]=_['defaults'](config[_0x9210('0x17')],{'host':_0x9210('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueue.socket')[_0x9210('0x19')](socket);function respondWithStatusCode(_0xdc1c60,_0x87fa36){_0x87fa36=_0x87fa36||0xcc;return function(_0x182459){if(_0x182459){return _0xdc1c60[_0x9210('0x1a')](_0x87fa36);}return _0xdc1c60[_0x9210('0x1b')](_0x87fa36)['end']();};}function respondWithResult(_0x5c30a2,_0x19c8c0){_0x19c8c0=_0x19c8c0||0xc8;return function(_0x2ca4bd){if(_0x2ca4bd){return _0x5c30a2[_0x9210('0x1b')](_0x19c8c0)[_0x9210('0x1c')](_0x2ca4bd);}};}function respondWithFilteredResult(_0x48da79,_0x2425d9){return function(_0x9e8c52){if(_0x9e8c52){var _0x43b0ec=typeof _0x2425d9['offset']==='undefined'&&typeof _0x2425d9[_0x9210('0x1d')]===_0x9210('0x1e');var _0x255225=_0x9e8c52[_0x9210('0x1f')];var _0x497fa1=_0x43b0ec?0x0:_0x2425d9[_0x9210('0x20')];var _0x4678be=_0x43b0ec?_0x9e8c52[_0x9210('0x1f')]:_0x2425d9[_0x9210('0x20')]+_0x2425d9[_0x9210('0x1d')];var _0x384081;if(_0x4678be>=_0x255225){_0x4678be=_0x255225;_0x384081=0xc8;}else{_0x384081=0xce;}_0x48da79['status'](_0x384081);return _0x48da79['set']('Content-Range',_0x497fa1+'-'+_0x4678be+'/'+_0x255225)['json'](_0x9e8c52);}return null;};}function patchUpdates(_0x2585e3){return function(_0x1bb3d4){try{jsonpatch['apply'](_0x1bb3d4,_0x2585e3,!![]);}catch(_0x58a374){return BPromise[_0x9210('0x21')](_0x58a374);}return _0x1bb3d4['save']();};}function saveUpdates(_0x5c4e8c,_0x47279a){return function(_0xbe5c24){if(_0xbe5c24){return _0xbe5c24[_0x9210('0x22')](_0x5c4e8c)[_0x9210('0x23')](function(_0x16640b){return _0x16640b;});}return null;};}function removeEntity(_0x378904,_0x4f73ee){return function(_0x63250e){if(_0x63250e){return _0x63250e[_0x9210('0x24')]()[_0x9210('0x23')](function(){var _0x3e3ab2=_0x63250e[_0x9210('0x25')]({'plain':!![]});var _0xb2e483=[{'name':_0x9210('0x26'),'value':'inbound','ignore':![]},{'name':_0x9210('0x27'),'value':_0x9210('0x28'),'ignore':![]}];var _0xd777a6=_(_0xb2e483)['filter'](_0x9210('0x29'))[_0x9210('0x2a')]('value')['value']();if(_['includes'](_0xd777a6,_0x3e3ab2[_0x9210('0x2b')])){return;}var _0x53d89c=_[_0x9210('0x2c')](_0xb2e483,['value',_0x3e3ab2[_0x9210('0x2b')]])[_0x9210('0x2d')];return db[_0x9210('0x2e')][_0x9210('0x24')]({'where':{'type':_0x53d89c,'resourceId':_0x3e3ab2['id']}})[_0x9210('0x23')](function(){return _0x63250e;});})[_0x9210('0x23')](function(){_0x378904[_0x9210('0x1b')](0xcc)[_0x9210('0x2f')]();});}};}function handleEntityNotFound(_0x4f48fc,_0x5c329a){return function(_0xef020d){if(!_0xef020d){_0x4f48fc[_0x9210('0x1a')](0x194);}return _0xef020d;};}function handleError(_0x76bb9,_0x3a487b){_0x3a487b=_0x3a487b||0x1f4;return function(_0x1f04fb){logger[_0x9210('0x30')](_0x1f04fb[_0x9210('0x31')]);if(_0x1f04fb[_0x9210('0x2d')]){delete _0x1f04fb[_0x9210('0x2d')];}_0x76bb9[_0x9210('0x1b')](_0x3a487b)[_0x9210('0x32')](_0x1f04fb);};}exports['index']=function(_0x4bb3e3,_0x31fb8b){var _0x5f20e5={},_0x3ebb9c={},_0x1f8282={'count':0x0,'rows':[]};var _0x1c3eb1=_[_0x9210('0x2a')](db[_0x9210('0x33')]['rawAttributes'],function(_0x4475ca){return{'name':_0x4475ca[_0x9210('0x34')],'type':_0x4475ca[_0x9210('0x2b')]['key']};});_0x3ebb9c[_0x9210('0x35')]=_[_0x9210('0x2a')](_0x1c3eb1,_0x9210('0x2d'));_0x3ebb9c[_0x9210('0x36')]=_[_0x9210('0x37')](_0x4bb3e3[_0x9210('0x36')]);_0x3ebb9c[_0x9210('0x38')]=_['intersection'](_0x3ebb9c[_0x9210('0x35')],_0x3ebb9c['query']);_0x5f20e5[_0x9210('0x39')]=_[_0x9210('0x3a')](_0x3ebb9c[_0x9210('0x35')],qs['fields'](_0x4bb3e3[_0x9210('0x36')][_0x9210('0x3b')]));_0x5f20e5[_0x9210('0x39')]=_0x5f20e5[_0x9210('0x39')][_0x9210('0x3c')]?_0x5f20e5[_0x9210('0x39')]:_0x3ebb9c[_0x9210('0x35')];if(!_0x4bb3e3['query']['hasOwnProperty'](_0x9210('0x3d'))){_0x5f20e5[_0x9210('0x1d')]=qs[_0x9210('0x1d')](_0x4bb3e3['query']['limit']);_0x5f20e5['offset']=qs[_0x9210('0x20')](_0x4bb3e3['query'][_0x9210('0x20')]);}_0x5f20e5['order']=qs[_0x9210('0x3e')](_0x4bb3e3['query'][_0x9210('0x3e')]);_0x5f20e5[_0x9210('0x3f')]=qs[_0x9210('0x38')](_[_0x9210('0x40')](_0x4bb3e3[_0x9210('0x36')],_0x3ebb9c[_0x9210('0x38')]),_0x1c3eb1);if(_0x4bb3e3[_0x9210('0x36')]['filter']){_0x5f20e5['where']=_[_0x9210('0x41')](_0x5f20e5[_0x9210('0x3f')],{'$or':_[_0x9210('0x2a')](_0x1c3eb1,function(_0x3d4890){if(_0x3d4890[_0x9210('0x2b')]!==_0x9210('0x42')){var _0x2c611e={};_0x2c611e[_0x3d4890[_0x9210('0x2d')]]={'$like':'%'+_0x4bb3e3[_0x9210('0x36')][_0x9210('0x43')]+'%'};return _0x2c611e;}})});}_0x5f20e5=_[_0x9210('0x41')]({},_0x5f20e5,_0x4bb3e3[_0x9210('0x44')]);var _0x436fd4={'where':_0x5f20e5[_0x9210('0x3f')]};return db[_0x9210('0x33')][_0x9210('0x1f')](_0x436fd4)[_0x9210('0x23')](function(_0x18c1aa){_0x1f8282[_0x9210('0x1f')]=_0x18c1aa;if(_0x4bb3e3[_0x9210('0x36')][_0x9210('0x45')]){_0x5f20e5[_0x9210('0x46')]=[{'all':!![]}];}return db[_0x9210('0x33')][_0x9210('0x47')](_0x5f20e5);})[_0x9210('0x23')](function(_0x3e0f89){_0x1f8282[_0x9210('0x48')]=_0x3e0f89;return _0x1f8282;})[_0x9210('0x23')](respondWithFilteredResult(_0x31fb8b,_0x5f20e5))[_0x9210('0x49')](handleError(_0x31fb8b,null));};exports[_0x9210('0x4a')]=function(_0x33880c,_0x53ef4d){var _0x309336={'raw':![],'where':{'id':_0x33880c[_0x9210('0x4b')]['id']}},_0x234431={};_0x234431[_0x9210('0x35')]=_[_0x9210('0x37')](db[_0x9210('0x33')][_0x9210('0x4c')]);_0x234431['query']=_[_0x9210('0x37')](_0x33880c[_0x9210('0x36')]);_0x234431[_0x9210('0x38')]=_[_0x9210('0x3a')](_0x234431[_0x9210('0x35')],_0x234431[_0x9210('0x36')]);_0x309336[_0x9210('0x39')]=_[_0x9210('0x3a')](_0x234431['model'],qs['fields'](_0x33880c[_0x9210('0x36')]['fields']));_0x309336[_0x9210('0x39')]=_0x309336[_0x9210('0x39')][_0x9210('0x3c')]?_0x309336[_0x9210('0x39')]:_0x234431[_0x9210('0x35')];if(_0x33880c['query'][_0x9210('0x45')]){_0x309336[_0x9210('0x46')]=[{'all':!![]}];}_0x309336=_[_0x9210('0x41')]({},_0x309336,_0x33880c[_0x9210('0x44')]);return db[_0x9210('0x33')][_0x9210('0x2c')](_0x309336)[_0x9210('0x23')](handleEntityNotFound(_0x53ef4d,null))['then'](respondWithResult(_0x53ef4d,null))[_0x9210('0x49')](handleError(_0x53ef4d,null));};exports[_0x9210('0x4d')]=function(_0x517f74,_0x567369){return db['VoiceQueue']['create'](_0x517f74['body'],{})['then'](function(_0x3315f7){var _0x25b3ec=_0x517f74['user'][_0x9210('0x25')]({'plain':!![]});if(!_0x25b3ec)throw new Error(_0x9210('0x4e'));if(_0x25b3ec[_0x9210('0x4f')]===_0x9210('0x50')){var _0x50d33b=_0x3315f7['get']({'plain':!![]});var _0x38f51f=[{'name':'VoiceQueues','value':_0x9210('0x51')},{'name':'QueueCampaigns','value':_0x9210('0x28')}];var _0x59ca85=_[_0x9210('0x2c')](_0x38f51f,[_0x9210('0x52'),_0x50d33b['type']])[_0x9210('0x2d')];return db[_0x9210('0x53')][_0x9210('0x2c')]({'where':{'name':_0x59ca85,'userProfileId':_0x25b3ec['userProfileId']},'raw':!![]})[_0x9210('0x23')](function(_0x2cea6c){if(_0x2cea6c&&_0x2cea6c[_0x9210('0x54')]===0x0){return db[_0x9210('0x2e')][_0x9210('0x4d')]({'name':_0x50d33b[_0x9210('0x2d')],'resourceId':_0x50d33b['id'],'type':_0x2cea6c[_0x9210('0x2d')],'sectionId':_0x2cea6c['id']},{})[_0x9210('0x23')](function(){return _0x3315f7;});}else{return _0x3315f7;}})[_0x9210('0x49')](function(_0x2265a9){logger['error'](_0x9210('0x55'),_0x2265a9);throw _0x2265a9;});}return _0x3315f7;})[_0x9210('0x23')](respondWithResult(_0x567369,0xc9))[_0x9210('0x49')](handleError(_0x567369,null));};exports[_0x9210('0x56')]=function(_0x4b6a23,_0x44a0bb){var _0x5c28c6={'where':{'id':_0x4b6a23[_0x9210('0x4b')]['id']}},_0x5be3fb={};_0x5be3fb[_0x9210('0x35')]=_[_0x9210('0x37')](db[_0x9210('0x33')][_0x9210('0x4c')]);_0x5c28c6[_0x9210('0x39')]=_['intersection'](_0x5be3fb[_0x9210('0x35')],qs[_0x9210('0x3b')](_0x4b6a23['query'][_0x9210('0x3b')]));_0x5c28c6[_0x9210('0x39')]=_0x5c28c6[_0x9210('0x39')][_0x9210('0x3c')]?_0x5c28c6[_0x9210('0x39')]:_0x5be3fb['model'];if(_0x4b6a23[_0x9210('0x36')][_0x9210('0x45')]){_0x5c28c6[_0x9210('0x46')]=[{'all':!![]}];}_0x5c28c6=_['merge']({},_0x5c28c6,_0x4b6a23[_0x9210('0x44')]);return db['VoiceQueue'][_0x9210('0x2c')](_0x5c28c6)[_0x9210('0x23')](handleEntityNotFound(_0x44a0bb,null))['then'](function(_0x4c74ae){if(_0x4c74ae){var _0x4b5a66=_0x4c74ae[_0x9210('0x25')]({'plain':!![]});_0x4b5a66=qs['omit'](_0x4b5a66,['id','createdAt',_0x9210('0x57')]);_0x4b6a23[_0x9210('0x58')]=_[_0x9210('0x59')](_0x4b6a23['body'],['id',_0x9210('0x5a'),_0x9210('0x57')]);return db['VoiceQueue'][_0x9210('0x4d')](_[_0x9210('0x41')](_0x4b5a66,_0x4b6a23[_0x9210('0x58')]),{'include':_0x4b6a23[_0x9210('0x36')][_0x9210('0x45')]?[{'all':!![]}]:undefined})[_0x9210('0x23')](function(_0x37e18f){var _0x56386c=_0x4b6a23['user'][_0x9210('0x25')]({'plain':!![]});if(!_0x56386c)throw new Error(_0x9210('0x4e'));if(_0x56386c['role']===_0x9210('0x50')){var _0x576494=_0x37e18f[_0x9210('0x25')]({'plain':!![]});var _0x27e4d7=[{'name':_0x9210('0x26'),'value':_0x9210('0x51')},{'name':'QueueCampaigns','value':'outbound'}];var _0xb767c3=_[_0x9210('0x2c')](_0x27e4d7,[_0x9210('0x52'),_0x576494[_0x9210('0x2b')]])[_0x9210('0x2d')];return db[_0x9210('0x53')][_0x9210('0x2c')]({'where':{'name':_0xb767c3,'userProfileId':_0x56386c[_0x9210('0x5b')]},'raw':!![]})[_0x9210('0x23')](function(_0x5ccd25){if(_0x5ccd25&&_0x5ccd25[_0x9210('0x54')]===0x0){return db['UserProfileResource'][_0x9210('0x4d')]({'name':_0x576494[_0x9210('0x2d')],'resourceId':_0x576494['id'],'type':_0x5ccd25[_0x9210('0x2d')],'sectionId':_0x5ccd25['id']},{})[_0x9210('0x23')](function(){return _0x37e18f;});}else{return _0x37e18f;}})['catch'](function(_0x3a71e7){logger[_0x9210('0x30')](_0x9210('0x55'),_0x3a71e7);throw _0x3a71e7;});}return _0x37e18f;});}})[_0x9210('0x23')](respondWithResult(_0x44a0bb,0xc9))['catch'](handleError(_0x44a0bb,null));};exports[_0x9210('0x22')]=function(_0x3c61d7,_0x4ea838){if(_0x3c61d7[_0x9210('0x58')]['id']){delete _0x3c61d7[_0x9210('0x58')]['id'];}return db[_0x9210('0x33')][_0x9210('0x2c')]({'where':{'id':_0x3c61d7[_0x9210('0x4b')]['id']}})[_0x9210('0x23')](handleEntityNotFound(_0x4ea838,null))['then'](saveUpdates(_0x3c61d7[_0x9210('0x58')],null))[_0x9210('0x23')](respondWithResult(_0x4ea838,null))[_0x9210('0x49')](handleError(_0x4ea838,null));};exports['destroy']=function(_0x167775,_0x2ff0aa){return db[_0x9210('0x33')][_0x9210('0x2c')]({'where':{'id':_0x167775[_0x9210('0x4b')]['id']}})[_0x9210('0x23')](handleEntityNotFound(_0x2ff0aa,null))[_0x9210('0x23')](removeEntity(_0x2ff0aa,null))[_0x9210('0x49')](handleError(_0x2ff0aa,null));};exports['getHoppers']=function(_0x59661e,_0x2159e2,_0x3551e2){var _0x61efa8={'raw':![],'where':{}};var _0x1045f6={};var _0x38de6c={'count':0x0,'rows':[]};return db[_0x9210('0x33')][_0x9210('0x5c')]({'where':{'id':_0x59661e['params']['id']}})[_0x9210('0x23')](handleEntityNotFound(_0x2159e2,null))[_0x9210('0x23')](function(_0x17a0df){if(_0x17a0df){_0x1045f6[_0x9210('0x35')]=_[_0x9210('0x37')](db[_0x9210('0x5d')]['rawAttributes']);_0x1045f6['query']=_[_0x9210('0x37')](_0x59661e['query']);_0x1045f6['filters']=_[_0x9210('0x3a')](_0x1045f6['model'],_0x1045f6[_0x9210('0x36')]);_0x61efa8[_0x9210('0x39')]=_[_0x9210('0x3a')](_0x1045f6[_0x9210('0x35')],qs[_0x9210('0x3b')](_0x59661e[_0x9210('0x36')][_0x9210('0x3b')]));_0x61efa8[_0x9210('0x39')]=_0x61efa8[_0x9210('0x39')]['length']?_0x61efa8[_0x9210('0x39')]:_0x1045f6[_0x9210('0x35')];if(!_0x59661e[_0x9210('0x36')]['hasOwnProperty']('nolimit')){_0x61efa8[_0x9210('0x1d')]=qs['limit'](_0x59661e[_0x9210('0x36')][_0x9210('0x1d')]);_0x61efa8[_0x9210('0x20')]=qs['offset'](_0x59661e['query'][_0x9210('0x20')]);}_0x61efa8[_0x9210('0x5e')]=qs[_0x9210('0x3e')](_0x59661e[_0x9210('0x36')][_0x9210('0x3e')]);_0x61efa8[_0x9210('0x3f')]=qs[_0x9210('0x38')](_[_0x9210('0x40')](_0x59661e['query'],_0x1045f6[_0x9210('0x38')]));_0x61efa8[_0x9210('0x3f')][_0x9210('0x5f')]=_0x17a0df['id'];if(_0x59661e[_0x9210('0x36')][_0x9210('0x43')]){_0x61efa8['where']=_[_0x9210('0x41')](_0x61efa8['where'],{'$or':_[_0x9210('0x2a')](_0x61efa8['attributes'],function(_0x370713){var _0x32f944={};_0x32f944[_0x370713]={'$like':'%'+_0x59661e[_0x9210('0x36')][_0x9210('0x43')]+'%'};return _0x32f944;})});}_0x61efa8=_[_0x9210('0x41')]({},_0x61efa8,_0x59661e[_0x9210('0x44')]);return db[_0x9210('0x5d')][_0x9210('0x1f')]({'where':_0x61efa8[_0x9210('0x3f')]})[_0x9210('0x23')](function(_0x4a2175){_0x38de6c[_0x9210('0x1f')]=_0x4a2175;if(_0x59661e['query'][_0x9210('0x45')]){_0x61efa8[_0x9210('0x46')]=[{'all':!![]}];}return db['CmHopper'][_0x9210('0x47')](_0x61efa8);})[_0x9210('0x23')](function(_0x467639){_0x38de6c['rows']=_0x467639;return _0x38de6c;});}})['then'](respondWithFilteredResult(_0x2159e2,_0x61efa8))[_0x9210('0x49')](handleError(_0x2159e2,null));};exports[_0x9210('0x60')]=function(_0x9834d0,_0x336026,_0x37c9db){var _0x19d75a={'raw':!![],'where':{}};var _0x5c0fad={};var _0x1c0a51={'count':0x0,'rows':[]};return db[_0x9210('0x33')][_0x9210('0x5c')]({'where':{'id':_0x9834d0['params']['id']}})[_0x9210('0x23')](handleEntityNotFound(_0x336026,null))['then'](function(_0x791075){if(_0x791075){_0x5c0fad[_0x9210('0x35')]=_['keys'](db[_0x9210('0x61')][_0x9210('0x4c')]);_0x5c0fad['query']=_['keys'](_0x9834d0[_0x9210('0x36')]);_0x5c0fad[_0x9210('0x38')]=_['intersection'](_0x5c0fad[_0x9210('0x35')],_0x5c0fad[_0x9210('0x36')]);_0x19d75a[_0x9210('0x39')]=_[_0x9210('0x3a')](_0x5c0fad[_0x9210('0x35')],qs[_0x9210('0x3b')](_0x9834d0[_0x9210('0x36')][_0x9210('0x3b')]));_0x19d75a[_0x9210('0x39')]=_0x19d75a['attributes'][_0x9210('0x3c')]?_0x19d75a[_0x9210('0x39')]:_0x5c0fad[_0x9210('0x35')];if(!_0x9834d0[_0x9210('0x36')][_0x9210('0x62')](_0x9210('0x3d'))){_0x19d75a['limit']=qs['limit'](_0x9834d0[_0x9210('0x36')]['limit']);_0x19d75a[_0x9210('0x20')]=qs[_0x9210('0x20')](_0x9834d0[_0x9210('0x36')][_0x9210('0x20')]);}_0x19d75a[_0x9210('0x5e')]=qs[_0x9210('0x3e')](_0x9834d0[_0x9210('0x36')][_0x9210('0x3e')]);_0x19d75a[_0x9210('0x3f')]=qs['filters'](_[_0x9210('0x40')](_0x9834d0[_0x9210('0x36')],_0x5c0fad[_0x9210('0x38')]));_0x19d75a[_0x9210('0x3f')][_0x9210('0x5f')]=_0x791075['id'];if(_0x9834d0[_0x9210('0x36')][_0x9210('0x43')]){_0x19d75a[_0x9210('0x3f')]=_[_0x9210('0x41')](_0x19d75a[_0x9210('0x3f')],{'$or':_[_0x9210('0x2a')](_0x19d75a['attributes'],function(_0x3ea44a){var _0x16b059={};_0x16b059[_0x3ea44a]={'$like':'%'+_0x9834d0[_0x9210('0x36')][_0x9210('0x43')]+'%'};return _0x16b059;})});}_0x19d75a=_[_0x9210('0x41')]({},_0x19d75a,_0x9834d0[_0x9210('0x44')]);return db[_0x9210('0x61')][_0x9210('0x1f')]({'where':_0x19d75a[_0x9210('0x3f')]})['then'](function(_0x3751e7){_0x1c0a51[_0x9210('0x1f')]=_0x3751e7;if(_0x9834d0[_0x9210('0x36')][_0x9210('0x45')]){_0x19d75a[_0x9210('0x46')]=[{'all':!![]}];}return db[_0x9210('0x61')][_0x9210('0x47')](_0x19d75a);})[_0x9210('0x23')](function(_0x4efbb4){_0x1c0a51[_0x9210('0x48')]=_0x4efbb4;return _0x1c0a51;});}})[_0x9210('0x23')](respondWithFilteredResult(_0x336026,_0x19d75a))[_0x9210('0x49')](handleError(_0x336026,null));};exports[_0x9210('0x63')]=function(_0x49d147,_0x47e8a8,_0x2493f5){var _0x104214={'raw':!![],'where':{}};var _0x48cebc={};var _0x413679={'count':0x0,'rows':[]};return db[_0x9210('0x33')][_0x9210('0x5c')]({'where':{'id':_0x49d147[_0x9210('0x4b')]['id']}})[_0x9210('0x23')](handleEntityNotFound(_0x47e8a8,null))[_0x9210('0x23')](function(_0x59ac12){if(_0x59ac12){_0x48cebc['model']=_[_0x9210('0x37')](db['CmHopperFinal'][_0x9210('0x4c')]);_0x48cebc[_0x9210('0x36')]=_['keys'](_0x49d147[_0x9210('0x36')]);_0x48cebc[_0x9210('0x38')]=_['intersection'](_0x48cebc['model'],_0x48cebc[_0x9210('0x36')]);_0x104214[_0x9210('0x39')]=_[_0x9210('0x3a')](_0x48cebc[_0x9210('0x35')],qs[_0x9210('0x3b')](_0x49d147[_0x9210('0x36')][_0x9210('0x3b')]));_0x104214[_0x9210('0x39')]=_0x104214[_0x9210('0x39')][_0x9210('0x3c')]?_0x104214[_0x9210('0x39')]:_0x48cebc['model'];if(!_0x49d147[_0x9210('0x36')][_0x9210('0x62')]('nolimit')){_0x104214[_0x9210('0x1d')]=qs[_0x9210('0x1d')](_0x49d147[_0x9210('0x36')][_0x9210('0x1d')]);_0x104214[_0x9210('0x20')]=qs[_0x9210('0x20')](_0x49d147[_0x9210('0x36')][_0x9210('0x20')]);}_0x104214[_0x9210('0x5e')]=qs[_0x9210('0x3e')](_0x49d147[_0x9210('0x36')]['sort']);_0x104214[_0x9210('0x3f')]=qs[_0x9210('0x38')](_[_0x9210('0x40')](_0x49d147['query'],_0x48cebc['filters']));_0x104214[_0x9210('0x3f')][_0x9210('0x5f')]=_0x59ac12['id'];if(_0x49d147['query'][_0x9210('0x43')]){_0x104214[_0x9210('0x3f')]=_['merge'](_0x104214['where'],{'$or':_[_0x9210('0x2a')](_0x104214[_0x9210('0x39')],function(_0x3f72d4){var _0x16d6e9={};_0x16d6e9[_0x3f72d4]={'$like':'%'+_0x49d147['query']['filter']+'%'};return _0x16d6e9;})});}_0x104214=_[_0x9210('0x41')]({},_0x104214,_0x49d147[_0x9210('0x44')]);return db['CmHopperFinal'][_0x9210('0x1f')]({'where':_0x104214[_0x9210('0x3f')]})[_0x9210('0x23')](function(_0x5756dd){_0x413679['count']=_0x5756dd;if(_0x49d147[_0x9210('0x36')][_0x9210('0x45')]){_0x104214[_0x9210('0x46')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x104214);})['then'](function(_0x33cc0){_0x413679['rows']=_0x33cc0;return _0x413679;});}})[_0x9210('0x23')](respondWithFilteredResult(_0x47e8a8,_0x104214))['catch'](handleError(_0x47e8a8,null));};exports[_0x9210('0x64')]=function(_0x5aaab1,_0x496e8a,_0x350317){var _0x2c75fe={'raw':!![],'where':{}};var _0x46d040={};var _0x15c5e1={'count':0x0,'rows':[]};return db[_0x9210('0x33')][_0x9210('0x5c')]({'where':{'id':_0x5aaab1[_0x9210('0x4b')]['id']}})['then'](handleEntityNotFound(_0x496e8a,null))[_0x9210('0x23')](function(_0x2ce057){if(_0x2ce057){_0x46d040['model']=_['keys'](db['CmHopperBlack'][_0x9210('0x4c')]);_0x46d040[_0x9210('0x36')]=_['keys'](_0x5aaab1[_0x9210('0x36')]);_0x46d040[_0x9210('0x38')]=_[_0x9210('0x3a')](_0x46d040[_0x9210('0x35')],_0x46d040[_0x9210('0x36')]);_0x2c75fe['attributes']=_[_0x9210('0x3a')](_0x46d040[_0x9210('0x35')],qs['fields'](_0x5aaab1['query']['fields']));_0x2c75fe[_0x9210('0x39')]=_0x2c75fe[_0x9210('0x39')][_0x9210('0x3c')]?_0x2c75fe[_0x9210('0x39')]:_0x46d040[_0x9210('0x35')];if(!_0x5aaab1[_0x9210('0x36')]['hasOwnProperty'](_0x9210('0x3d'))){_0x2c75fe[_0x9210('0x1d')]=qs[_0x9210('0x1d')](_0x5aaab1[_0x9210('0x36')][_0x9210('0x1d')]);_0x2c75fe[_0x9210('0x20')]=qs[_0x9210('0x20')](_0x5aaab1[_0x9210('0x36')][_0x9210('0x20')]);}_0x2c75fe[_0x9210('0x5e')]=qs['sort'](_0x5aaab1[_0x9210('0x36')][_0x9210('0x3e')]);_0x2c75fe[_0x9210('0x3f')]=qs[_0x9210('0x38')](_[_0x9210('0x40')](_0x5aaab1[_0x9210('0x36')],_0x46d040['filters']));_0x2c75fe[_0x9210('0x3f')]['VoiceQueueId']=_0x2ce057['id'];if(_0x5aaab1[_0x9210('0x36')]['filter']){_0x2c75fe[_0x9210('0x3f')]=_[_0x9210('0x41')](_0x2c75fe[_0x9210('0x3f')],{'$or':_[_0x9210('0x2a')](_0x2c75fe[_0x9210('0x39')],function(_0x312d97){var _0x3ccfff={};_0x3ccfff[_0x312d97]={'$like':'%'+_0x5aaab1['query'][_0x9210('0x43')]+'%'};return _0x3ccfff;})});}_0x2c75fe=_[_0x9210('0x41')]({},_0x2c75fe,_0x5aaab1[_0x9210('0x44')]);return db['CmHopperBlack'][_0x9210('0x1f')]({'where':_0x2c75fe['where']})[_0x9210('0x23')](function(_0x39b92a){_0x15c5e1['count']=_0x39b92a;if(_0x5aaab1[_0x9210('0x36')][_0x9210('0x45')]){_0x2c75fe[_0x9210('0x46')]=[{'all':!![]}];}return db[_0x9210('0x65')][_0x9210('0x47')](_0x2c75fe);})['then'](function(_0x400b16){_0x15c5e1[_0x9210('0x48')]=_0x400b16;return _0x15c5e1;});}})[_0x9210('0x23')](respondWithFilteredResult(_0x496e8a,_0x2c75fe))[_0x9210('0x49')](handleError(_0x496e8a,null));};exports[_0x9210('0x66')]=function(_0x5779bc,_0x543c18,_0x37cd6e){var _0x140e2f={};var _0xefa060={};var _0x48f9b3;var _0x4e3045;return db['VoiceQueue']['findOne']({'where':{'id':_0x5779bc[_0x9210('0x4b')]['id']}})['then'](handleEntityNotFound(_0x543c18,null))[_0x9210('0x23')](function(_0x14cb2f){if(_0x14cb2f){_0x48f9b3=_0x14cb2f;_0xefa060[_0x9210('0x35')]=_[_0x9210('0x37')](db[_0x9210('0x67')][_0x9210('0x4c')]);_0xefa060[_0x9210('0x36')]=_[_0x9210('0x37')](_0x5779bc['query']);_0xefa060[_0x9210('0x38')]=_[_0x9210('0x3a')](_0xefa060['model'],_0xefa060[_0x9210('0x36')]);_0x140e2f['attributes']=_[_0x9210('0x3a')](_0xefa060['model'],qs['fields'](_0x5779bc[_0x9210('0x36')][_0x9210('0x3b')]));_0x140e2f[_0x9210('0x39')]=_0x140e2f[_0x9210('0x39')][_0x9210('0x3c')]?_0x140e2f[_0x9210('0x39')]:_0xefa060['model'];_0x140e2f[_0x9210('0x5e')]=qs[_0x9210('0x3e')](_0x5779bc[_0x9210('0x36')][_0x9210('0x3e')]);_0x140e2f[_0x9210('0x3f')]=qs[_0x9210('0x38')](_[_0x9210('0x40')](_0x5779bc[_0x9210('0x36')],_0xefa060['filters']));if(_0x5779bc[_0x9210('0x36')][_0x9210('0x43')]){_0x140e2f[_0x9210('0x3f')]=_[_0x9210('0x41')](_0x140e2f['where'],{'$or':_[_0x9210('0x2a')](_0x140e2f[_0x9210('0x39')],function(_0x9265f4){var _0x3af1a0={};_0x3af1a0[_0x9265f4]={'$like':'%'+_0x5779bc[_0x9210('0x36')]['filter']+'%'};return _0x3af1a0;})});}_0x140e2f=_[_0x9210('0x41')]({},_0x140e2f,_0x5779bc[_0x9210('0x44')]);return _0x48f9b3[_0x9210('0x66')](_0x140e2f);}})[_0x9210('0x23')](function(_0x5e5a6b){if(_0x5e5a6b){_0x4e3045=_0x5e5a6b[_0x9210('0x3c')];if(!_0x5779bc[_0x9210('0x36')][_0x9210('0x62')](_0x9210('0x3d'))){_0x140e2f[_0x9210('0x1d')]=qs['limit'](_0x5779bc[_0x9210('0x36')][_0x9210('0x1d')]);_0x140e2f[_0x9210('0x20')]=qs['offset'](_0x5779bc['query'][_0x9210('0x20')]);}return _0x48f9b3[_0x9210('0x66')](_0x140e2f);}})['then'](function(_0x199b7b){if(_0x199b7b){return _0x199b7b?{'count':_0x4e3045,'rows':_0x199b7b}:null;}})[_0x9210('0x23')](respondWithResult(_0x543c18,null))[_0x9210('0x49')](handleError(_0x543c18,null));};exports['addTeams']=function(_0xeacc3a,_0x9ffe21,_0x3af2d9){var _0x50be71=_0xeacc3a[_0x9210('0x58')]['teams'];var _0x4a121b=_[_0x9210('0x2a')](_0x50be71,'id');return db['Team'][_0x9210('0x47')]({'where':{'id':_0x4a121b},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x9210('0x2d'),_0x9210('0x68'),_0x9210('0x69'),'interface'],'raw':!![]}]})['then'](function(_0x31235a){if(_0x31235a){var _0x58198a=_[_0x9210('0x6a')](_0x31235a,function(_0x559876){var _0x1b09a4=_0x559876[_0x9210('0x25')]({'plain':!![]});_0x1b09a4[_0x9210('0x6b')]['forEach'](function(_0x418ef3){_0x418ef3[_0x9210('0x6c')]=_[_0x9210('0x2c')](_0x50be71,{'id':_0x1b09a4['id']})['penalty'];});return _0x1b09a4[_0x9210('0x6b')];});return db[_0x9210('0x33')][_0x9210('0x2c')]({'where':{'id':_0xeacc3a[_0x9210('0x4b')]['id']}})['then'](function(_0x1b98cf){return db[_0x9210('0x6d')][_0x9210('0x6e')](function(_0x5b003b){return _0x1b98cf[_0x9210('0x6f')](_0x4a121b,{'transaction':_0x5b003b})[_0x9210('0x23')](function(){return BPromise[_0x9210('0x70')](_0x50be71,function(_0x3aa7d7){return db[_0x9210('0x71')][_0x9210('0x72')]({'TeamId':_0x3aa7d7['id'],'VoiceQueueId':_0xeacc3a['params']['id'],'penalty':_0x3aa7d7[_0x9210('0x6c')]},{'transaction':_0x5b003b});});})[_0x9210('0x23')](function(){return BPromise[_0x9210('0x70')](_0x58198a,function(_0x1c16ab){return db['UserVoiceQueue'][_0x9210('0x73')]({'where':{'UserId':_0x1c16ab['id'],'VoiceQueueId':_0xeacc3a[_0x9210('0x4b')]['id']},'defaults':{'penalty':_0x1c16ab['penalty']},'transaction':_0x5b003b});});})[_0x9210('0x23')](function(){return BPromise[_0x9210('0x70')](_[_0x9210('0x43')](_0x58198a,{'online':!![]}),function(_0xb7e91e){return db['UserVoiceQueueRt']['upsert']({'membername':_0xb7e91e[_0x9210('0x2d')],'UserId':_0xb7e91e['id'],'queue_name':_0x1b98cf[_0x9210('0x2d')],'VoiceQueueId':_0x1b98cf['id'],'interface':_[_0x9210('0x74')](_0xb7e91e[_0x9210('0x75')])?util['format'](_0x9210('0x76'),_0xb7e91e['name']):_0xb7e91e[_0x9210('0x75')],'paused':_0xb7e91e[_0x9210('0x69')]||![],'penalty':_0xb7e91e[_0x9210('0x6c')]},{'transaction':_0x5b003b});});})[_0x9210('0x23')](function(){_0x58198a['forEach'](function(_0x4986e5){socket[_0x9210('0x77')](_0x9210('0x78'),{'UserId':_0x4986e5['id'],'VoiceQueueId':_0x1b98cf['id']});});});});});}})[_0x9210('0x23')](respondWithStatusCode(_0x9ffe21,null))[_0x9210('0x49')](handleError(_0x9ffe21,null));};exports[_0x9210('0x79')]=function(_0x4b7ec4,_0x305f02,_0x469c32){return db[_0x9210('0x67')][_0x9210('0x47')]({'where':{'id':_0x4b7ec4[_0x9210('0x36')][_0x9210('0x7a')]},'attributes':['id'],'include':[{'model':db[_0x9210('0x7b')],'as':_0x9210('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x305f02,null))[_0x9210('0x23')](function(_0x22b499){var _0x324475=_[_0x9210('0x2a')](_0x22b499,'id');var _0x29133d=[];var _0x583090=[];var _0x151cad=squel['select']();_0x151cad['field'](_0x9210('0x7c'))[_0x9210('0x7d')](_0x9210('0x7e'),'tq')[_0x9210('0x7f')](_0x9210('0x80'),'ut',_0x9210('0x81'))['where'](_0x9210('0x82'),_0x4b7ec4[_0x9210('0x4b')]['id']);for(var _0x36c148=0x0;_0x36c148<_0x22b499[_0x9210('0x3c')];_0x36c148+=0x1){let _0x32adbc=_0x22b499[_0x36c148];for(var _0xdca199=0x0;_0xdca199<_0x32adbc[_0x9210('0x6b')][_0x9210('0x3c')];_0xdca199+=0x1){let _0x5969c1=_0x32adbc[_0x9210('0x6b')][_0xdca199];var _0x2197ad=_0x151cad[_0x9210('0x56')]();_0x2197ad[_0x9210('0x3f')](_0x9210('0x83'),_0x5969c1['id']);_0x583090[_0x9210('0x84')](db['sequelize'][_0x9210('0x36')](_0x2197ad[_0x9210('0x85')](),{'type':db[_0x9210('0x6d')][_0x9210('0x86')][_0x9210('0x87')]})[_0x9210('0x23')](function(_0x506d98){if(_0x506d98['length']===0x1){return _0x5969c1['id'];}else{var _0x12523b=_['every'](_['map'](_0x506d98,_0x9210('0x88')),function(_0x5f2cd1){return _[_0x9210('0x89')](_0x324475,_0x5f2cd1);});if(_0x12523b){return _0x5969c1['id'];}}}));}}return BPromise[_0x9210('0x8a')](_0x583090)[_0x9210('0x23')](function(_0x7d9937){_0x29133d=_(_0x29133d)[_0x9210('0x8b')](_0x7d9937)[_0x9210('0x8c')]()[_0x9210('0x52')]();return db[_0x9210('0x33')][_0x9210('0x2c')]({'where':{'id':_0x4b7ec4[_0x9210('0x4b')]['id']}})['then'](function(_0x5738b2){return db[_0x9210('0x6d')][_0x9210('0x6e')](function(_0x59c9d7){return _0x5738b2[_0x9210('0x79')](_0x4b7ec4[_0x9210('0x36')][_0x9210('0x7a')],{'transaction':_0x59c9d7})[_0x9210('0x23')](function(){if(!_[_0x9210('0x8d')](_0x29133d)){return _0x5738b2['removeAgents'](_0x29133d,{'transaction':_0x59c9d7})[_0x9210('0x23')](function(){return db[_0x9210('0x8e')][_0x9210('0x24')]({'where':{'VoiceQueueId':_0x4b7ec4[_0x9210('0x4b')]['id'],'UserId':_0x29133d},'transaction':_0x59c9d7});});}})[_0x9210('0x23')](function(){_0x29133d[_0x9210('0x8f')](function(_0x4b682c){socket[_0x9210('0x77')](_0x9210('0x90'),{'UserId':_0x4b682c,'VoiceQueueId':_0x5738b2['id']});});});});});});})[_0x9210('0x23')](respondWithStatusCode(_0x305f02,null))['catch'](handleError(_0x305f02,null));};exports[_0x9210('0x91')]=function(_0x3b6851,_0xa7ca6b,_0x5ebfd8){var _0x154dcf,_0x4228e9;return db[_0x9210('0x33')][_0x9210('0x2c')]({'where':{'id':_0x3b6851['params']['id']}})[_0x9210('0x23')](handleEntityNotFound(_0xa7ca6b,null))['then'](function(_0x225394){if(_0x225394){_0x4228e9=_0x225394;return _0x225394['addAgents'](_0x3b6851[_0x9210('0x58')]['ids'],_[_0x9210('0x59')](_0x3b6851['body'],[_0x9210('0x7a'),'id'])||{})['spread'](function(_0x29f885){for(var _0x2ea47e=0x0;_0x2ea47e<_0x3b6851[_0x9210('0x58')]['ids'][_0x9210('0x3c')];_0x2ea47e+=0x1){socket['emit'](_0x9210('0x78'),{'UserId':Number(_0x3b6851[_0x9210('0x58')][_0x9210('0x7a')][_0x2ea47e]),'VoiceQueueId':Number(_0x3b6851[_0x9210('0x4b')]['id'])});}return _0x29f885;});}})[_0x9210('0x23')](function(_0x25d688){_0x154dcf=_0x25d688||[];if(_0x4228e9){return db[_0x9210('0x7b')][_0x9210('0x47')]({'where':{'id':_0x3b6851[_0x9210('0x58')][_0x9210('0x7a')]},'attributes':['id',_0x9210('0x2d'),_0x9210('0x68'),_0x9210('0x69'),_0x9210('0x75')],'raw':!![]});}})[_0x9210('0x23')](function(_0x42de08){if(!_[_0x9210('0x8d')](_0x42de08)){var _0x3a2649=[];for(var _0x40b598=0x0;_0x40b598<_0x42de08[_0x9210('0x3c')];_0x40b598++){if(_0x42de08[_0x40b598][_0x9210('0x68')]){_0x3a2649[_0x9210('0x84')](db['UserVoiceQueueRt']['upsert']({'membername':_0x42de08[_0x40b598][_0x9210('0x2d')],'UserId':_0x42de08[_0x40b598]['id'],'queue_name':_0x4228e9['name'],'VoiceQueueId':_0x4228e9['id'],'interface':_['isNil'](_0x42de08[_0x40b598][_0x9210('0x75')])?util['format'](_0x9210('0x76'),_0x42de08[_0x40b598][_0x9210('0x2d')]):_0x42de08[_0x40b598][_0x9210('0x75')],'paused':_0x42de08[_0x40b598]['voicePause']||![],'penalty':_0x3b6851[_0x9210('0x58')][_0x9210('0x6c')]||0x0}));}}return BPromise[_0x9210('0x8a')](_0x3a2649);}})[_0x9210('0x23')](function(){return _0x154dcf;})['then'](respondWithResult(_0xa7ca6b,null))[_0x9210('0x49')](handleError(_0xa7ca6b,null));};exports[_0x9210('0x92')]=function(_0xf50123,_0x145ed1,_0x1256da){return db['VoiceQueue']['find']({'where':{'id':_0xf50123['params']['id']}})['then'](handleEntityNotFound(_0x145ed1,null))[_0x9210('0x23')](function(_0x15dfaa){if(_0x15dfaa){return _0x15dfaa[_0x9210('0x92')](_0xf50123[_0x9210('0x36')][_0x9210('0x7a')])[_0x9210('0x23')](function(){if(_['isArray'](_0xf50123[_0x9210('0x36')][_0x9210('0x7a')])){for(var _0x25e733=0x0;_0x25e733<_0xf50123['query']['ids'][_0x9210('0x3c')];_0x25e733+=0x1){socket[_0x9210('0x77')](_0x9210('0x90'),{'UserId':Number(_0xf50123[_0x9210('0x36')][_0x9210('0x7a')][_0x25e733]),'VoiceQueueId':Number(_0xf50123[_0x9210('0x4b')]['id'])});}}else{socket[_0x9210('0x77')](_0x9210('0x90'),{'UserId':Number(_0xf50123[_0x9210('0x36')][_0x9210('0x7a')]),'VoiceQueueId':Number(_0xf50123['params']['id'])});}});}})['then'](function(_0x2c7a69){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0xf50123[_0x9210('0x4b')]['id'],'UserId':_0xf50123[_0x9210('0x36')][_0x9210('0x7a')]}})[_0x9210('0x23')](function(){return _0x2c7a69;});})[_0x9210('0x23')](respondWithStatusCode(_0x145ed1,null))['catch'](handleError(_0x145ed1,null));};exports[_0x9210('0x93')]=function(_0x198c8c,_0x2bc80c,_0x258a36){var _0x44216b={};var _0x51b760={};var _0xeef203;var _0x9f5cc9;return db[_0x9210('0x33')]['findOne']({'where':{'id':_0x198c8c[_0x9210('0x4b')]['id']}})[_0x9210('0x23')](handleEntityNotFound(_0x2bc80c,null))[_0x9210('0x23')](function(_0x28943f){if(_0x28943f){_0xeef203=_0x28943f;_0x51b760[_0x9210('0x35')]=_[_0x9210('0x37')](db[_0x9210('0x7b')]['rawAttributes']);_0x51b760[_0x9210('0x36')]=_[_0x9210('0x37')](_0x198c8c['query']);_0x51b760[_0x9210('0x38')]=_[_0x9210('0x3a')](_0x51b760[_0x9210('0x35')],_0x51b760['query']);_0x44216b[_0x9210('0x39')]=_['intersection'](_0x51b760[_0x9210('0x35')],qs[_0x9210('0x3b')](_0x198c8c[_0x9210('0x36')][_0x9210('0x3b')]));_0x44216b[_0x9210('0x39')]=_0x44216b['attributes']['length']?_0x44216b[_0x9210('0x39')]:_0x51b760[_0x9210('0x35')];_0x44216b[_0x9210('0x5e')]=qs['sort'](_0x198c8c['query']['sort']);_0x44216b[_0x9210('0x3f')]=qs[_0x9210('0x38')](_[_0x9210('0x40')](_0x198c8c[_0x9210('0x36')],_0x51b760[_0x9210('0x38')]));if(_0x198c8c[_0x9210('0x36')]['filter']){_0x44216b[_0x9210('0x3f')]=_[_0x9210('0x41')](_0x44216b[_0x9210('0x3f')],{'$or':_[_0x9210('0x2a')](_0x44216b['attributes'],function(_0x25f83d){var _0x2a1fc0={};_0x2a1fc0[_0x25f83d]={'$like':'%'+_0x198c8c[_0x9210('0x36')][_0x9210('0x43')]+'%'};return _0x2a1fc0;})});}_0x44216b=_[_0x9210('0x41')]({},_0x44216b,_0x198c8c[_0x9210('0x44')]);return _0xeef203[_0x9210('0x93')](_0x44216b);}})[_0x9210('0x23')](function(_0x2e630a){if(_0x2e630a){_0x9f5cc9=_0x2e630a[_0x9210('0x3c')];if(!_0x198c8c[_0x9210('0x36')][_0x9210('0x62')]('nolimit')){_0x44216b[_0x9210('0x1d')]=qs['limit'](_0x198c8c['query']['limit']);_0x44216b[_0x9210('0x20')]=qs['offset'](_0x198c8c[_0x9210('0x36')][_0x9210('0x20')]);}return _0xeef203[_0x9210('0x93')](_0x44216b);}})['then'](function(_0x5509cc){if(_0x5509cc){return _0x5509cc?{'count':_0x9f5cc9,'rows':_0x5509cc}:null;}})[_0x9210('0x23')](respondWithResult(_0x2bc80c,null))[_0x9210('0x49')](handleError(_0x2bc80c,null));};exports[_0x9210('0x94')]=function(_0x23d579,_0x461be2,_0x532954){var _0x5171cc={};var _0x14aaf7={};var _0x3ae156;var _0x5a7548;return db[_0x9210('0x33')][_0x9210('0x5c')]({'where':{'id':_0x23d579['params']['id']}})[_0x9210('0x23')](handleEntityNotFound(_0x461be2,null))[_0x9210('0x23')](function(_0x43f2d9){if(_0x43f2d9){_0x3ae156=_0x43f2d9;_0x14aaf7[_0x9210('0x35')]=_[_0x9210('0x37')](db[_0x9210('0x8e')][_0x9210('0x4c')]);_0x14aaf7[_0x9210('0x36')]=_['keys'](_0x23d579[_0x9210('0x36')]);_0x14aaf7[_0x9210('0x38')]=_['intersection'](_0x14aaf7['model'],_0x14aaf7[_0x9210('0x36')]);_0x5171cc[_0x9210('0x39')]=_[_0x9210('0x3a')](_0x14aaf7[_0x9210('0x35')],qs['fields'](_0x23d579['query'][_0x9210('0x3b')]));_0x5171cc['attributes']=_0x5171cc[_0x9210('0x39')][_0x9210('0x3c')]?_0x5171cc[_0x9210('0x39')]:_0x14aaf7[_0x9210('0x35')];_0x5171cc['order']=qs[_0x9210('0x3e')](_0x23d579['query'][_0x9210('0x3e')]);_0x5171cc[_0x9210('0x3f')]=qs[_0x9210('0x38')](_[_0x9210('0x40')](_0x23d579[_0x9210('0x36')],_0x14aaf7[_0x9210('0x38')]));if(_0x23d579[_0x9210('0x36')]['filter']){_0x5171cc[_0x9210('0x3f')]=_['merge'](_0x5171cc[_0x9210('0x3f')],{'$or':_[_0x9210('0x2a')](_0x5171cc[_0x9210('0x39')],function(_0x2e58c8){var _0x36a5a1={};_0x36a5a1[_0x2e58c8]={'$like':'%'+_0x23d579['query']['filter']+'%'};return _0x36a5a1;})});}_0x5171cc=_[_0x9210('0x41')]({},_0x5171cc,_0x23d579[_0x9210('0x44')]);return _0x3ae156[_0x9210('0x94')](_0x5171cc);}})[_0x9210('0x23')](function(_0x3db5b6){if(_0x3db5b6){_0x5a7548=_0x3db5b6[_0x9210('0x3c')];if(!_0x23d579[_0x9210('0x36')][_0x9210('0x62')](_0x9210('0x3d'))){_0x5171cc[_0x9210('0x1d')]=qs[_0x9210('0x1d')](_0x23d579[_0x9210('0x36')][_0x9210('0x1d')]);_0x5171cc['offset']=qs[_0x9210('0x20')](_0x23d579[_0x9210('0x36')][_0x9210('0x20')]);}return _0x3ae156[_0x9210('0x94')](_0x5171cc);}})['then'](function(_0x5ae913){return _0x5ae913?{'count':_0x5a7548,'rows':_0x5ae913}:null;})[_0x9210('0x23')](respondWithResult(_0x461be2,null))[_0x9210('0x49')](handleError(_0x461be2,null));};exports[_0x9210('0x95')]=function(_0xb1f302,_0x13eaf0,_0x40a694){var _0x49ef92={};var _0xedf2cd={};var _0xfb3349;var _0x1e45da;return db['VoiceQueue']['findOne']({'where':{'id':_0xb1f302[_0x9210('0x4b')]['id']}})['then'](handleEntityNotFound(_0x13eaf0,null))['then'](function(_0x385f5c){if(_0x385f5c){_0xfb3349=_0x385f5c;_0xedf2cd[_0x9210('0x35')]=_[_0x9210('0x37')](db[_0x9210('0x96')][_0x9210('0x4c')]);_0xedf2cd['query']=_[_0x9210('0x37')](_0xb1f302[_0x9210('0x36')]);_0xedf2cd[_0x9210('0x38')]=_[_0x9210('0x3a')](_0xedf2cd[_0x9210('0x35')],_0xedf2cd['query']);_0x49ef92[_0x9210('0x39')]=_[_0x9210('0x3a')](_0xedf2cd[_0x9210('0x35')],qs[_0x9210('0x3b')](_0xb1f302[_0x9210('0x36')][_0x9210('0x3b')]));_0x49ef92[_0x9210('0x39')]=_0x49ef92[_0x9210('0x39')]['length']?_0x49ef92[_0x9210('0x39')]:_0xedf2cd[_0x9210('0x35')];_0x49ef92[_0x9210('0x5e')]=qs[_0x9210('0x3e')](_0xb1f302['query']['sort']);_0x49ef92[_0x9210('0x3f')]=qs[_0x9210('0x38')](_[_0x9210('0x40')](_0xb1f302[_0x9210('0x36')],_0xedf2cd[_0x9210('0x38')]));if(_0xb1f302[_0x9210('0x36')][_0x9210('0x43')]){_0x49ef92[_0x9210('0x3f')]=_[_0x9210('0x41')](_0x49ef92[_0x9210('0x3f')],{'$or':_[_0x9210('0x2a')](_0x49ef92[_0x9210('0x39')],function(_0x44ab08){var _0x2d43d2={};_0x2d43d2[_0x44ab08]={'$like':'%'+_0xb1f302[_0x9210('0x36')][_0x9210('0x43')]+'%'};return _0x2d43d2;})});}_0x49ef92=_[_0x9210('0x41')]({},_0x49ef92,_0xb1f302[_0x9210('0x44')]);return _0xfb3349[_0x9210('0x95')](_0x49ef92);}})[_0x9210('0x23')](function(_0x3ef539){if(_0x3ef539){_0x1e45da=_0x3ef539['length'];if(!_0xb1f302[_0x9210('0x36')]['hasOwnProperty'](_0x9210('0x3d'))){_0x49ef92['limit']=qs[_0x9210('0x1d')](_0xb1f302['query'][_0x9210('0x1d')]);_0x49ef92[_0x9210('0x20')]=qs[_0x9210('0x20')](_0xb1f302[_0x9210('0x36')]['offset']);}return _0xfb3349[_0x9210('0x95')](_0x49ef92);}})[_0x9210('0x23')](function(_0x12fa49){if(_0x12fa49){return _0x12fa49?{'count':_0x1e45da,'rows':_0x12fa49}:null;}})[_0x9210('0x23')](respondWithResult(_0x13eaf0,null))[_0x9210('0x49')](handleError(_0x13eaf0,null));};exports['addLists']=function(_0x5be36d,_0x496a6c,_0x48132e){var _0x499fc9,_0xac7e5c;return db[_0x9210('0x33')][_0x9210('0x2c')]({'where':{'id':_0x5be36d[_0x9210('0x4b')]['id']}})['then'](handleEntityNotFound(_0x496a6c,null))[_0x9210('0x23')](function(_0x570cbb){if(_0x570cbb){_0xac7e5c=_0x570cbb;return _0x570cbb[_0x9210('0x97')](_0x5be36d[_0x9210('0x58')][_0x9210('0x7a')],_[_0x9210('0x59')](_0x5be36d['body'],[_0x9210('0x7a'),'id'])||{});}return null;})[_0x9210('0x98')](function(_0x236b0f){var _0x5ecce7;_0x499fc9=_0x236b0f||[];var _0x3a7f16=[];if(_0x236b0f){for(var _0xc3610e=0x0;_0xc3610e<_0x236b0f[_0x9210('0x3c')];_0xc3610e+=0x1){var _0x3787dc=_0x236b0f[_0xc3610e][_0x9210('0x25')]({'plain':!![]});_0xac7e5c[_0x9210('0x99')]=_0x5be36d[_0x9210('0x58')][_0x9210('0x99')]?_0x5be36d[_0x9210('0x58')][_0x9210('0x99')]:_0xac7e5c[_0x9210('0x99')];switch(_0xac7e5c['dialCheckDuplicateType']){case _0x9210('0x9a'):_0x5ecce7=squel[_0x9210('0x9b')]()[_0x9210('0x9c')](_0x9210('0x9d'))[_0x9210('0x9e')]([_0x9210('0x9f'),_0x9210('0xa0'),'ContactId','ListId','VoiceQueueId',_0x9210('0x5a'),_0x9210('0x57')],squel[_0x9210('0xa1')]()[_0x9210('0xa2')](_0x9210('0x9f'),'phone')[_0x9210('0xa2')](_0x9210('0xa3'),_0x9210('0xa0'))[_0x9210('0xa2')]('id',_0x9210('0xa4'))[_0x9210('0xa2')](_0x3787dc[_0x9210('0xa5')][_0x9210('0x85')](),_0x9210('0xa6'))[_0x9210('0xa2')](_0x5be36d[_0x9210('0x4b')]['id'][_0x9210('0x85')](),_0x9210('0x5f'))[_0x9210('0xa2')](_0x9210('0xa3'),_0x9210('0x5a'))[_0x9210('0xa2')](_0x9210('0xa3'),_0x9210('0x57'))['from'](_0x9210('0xa7'))[_0x9210('0x3f')](_0x9210('0xa8'))[_0x9210('0x3f')](_0x9210('0xa9'),_0x3787dc[_0x9210('0xa5')][_0x9210('0x85')]())[_0x9210('0x3f')](_0x9210('0xaa'))['where'](_0x9210('0xab'),squel['select']()[_0x9210('0xa2')](_0x9210('0xac'))[_0x9210('0x7d')](_0x9210('0xad'))[_0x9210('0x3f')](_0x9210('0x82'),_0x5be36d[_0x9210('0x4b')]['id'][_0x9210('0x85')]()))[_0x9210('0x3f')](_0x9210('0xab'),squel['select']()['field'](_0x9210('0xae'))[_0x9210('0x7d')]('cm_hopper')['where'](_0x9210('0x82'),_0x5be36d['params']['id'][_0x9210('0x85')]())))[_0x9210('0x85')]();break;case _0x9210('0xaf'):_0x5ecce7=squel[_0x9210('0x9b')]()[_0x9210('0x9c')](_0x9210('0x9d'))[_0x9210('0x9e')]([_0x9210('0x9f'),'scheduledAt',_0x9210('0xa4'),'ListId','VoiceQueueId','createdAt',_0x9210('0x57')],squel['select']()[_0x9210('0xa2')](_0x9210('0x9f'),_0x9210('0x9f'))[_0x9210('0xa2')](_0x9210('0xa3'),_0x9210('0xa0'))[_0x9210('0xa2')]('id',_0x9210('0xa4'))[_0x9210('0xa2')](_0x3787dc['CmListId'][_0x9210('0x85')](),_0x9210('0xa6'))[_0x9210('0xa2')](_0x5be36d['params']['id'][_0x9210('0x85')](),_0x9210('0x5f'))[_0x9210('0xa2')]('NOW()','createdAt')[_0x9210('0xa2')](_0x9210('0xa3'),'updatedAt')[_0x9210('0x7d')]('cm_contacts')[_0x9210('0x3f')](_0x9210('0xa8'))[_0x9210('0x3f')](_0x9210('0xa9'),_0x3787dc[_0x9210('0xa5')]['toString']())['where'](_0x9210('0xaa'))['where'](_0x9210('0xab'),squel[_0x9210('0xa1')]()[_0x9210('0xa2')]('COALESCE(phone,\x27\x27)')[_0x9210('0x7d')]('cm_hopper')['where'](_0x9210('0x82'),_0x5be36d[_0x9210('0x4b')]['id']['toString']())))[_0x9210('0x85')]();break;default:_0x5ecce7=squel[_0x9210('0x9b')]()[_0x9210('0x9c')](_0x9210('0x9d'))['fromQuery']([_0x9210('0x9f'),_0x9210('0xa0'),_0x9210('0xa4'),'ListId',_0x9210('0x5f'),_0x9210('0x5a'),_0x9210('0x57')],squel['select']()[_0x9210('0xa2')]('phone','phone')[_0x9210('0xa2')](_0x9210('0xa3'),_0x9210('0xa0'))['field']('id','ContactId')[_0x9210('0xa2')](_0x3787dc['CmListId'][_0x9210('0x85')](),_0x9210('0xa6'))[_0x9210('0xa2')](_0x5be36d[_0x9210('0x4b')]['id'][_0x9210('0x85')](),'VoiceQueueId')[_0x9210('0xa2')](_0x9210('0xa3'),_0x9210('0x5a'))[_0x9210('0xa2')]('NOW()','updatedAt')[_0x9210('0x7d')]('cm_contacts')[_0x9210('0x3f')](_0x9210('0xa8'))['where'](_0x9210('0xa9'),_0x3787dc[_0x9210('0xa5')][_0x9210('0x85')]())[_0x9210('0x3f')](_0x9210('0xaa')))[_0x9210('0x85')]();}_0x3a7f16[_0x9210('0x84')](db[_0x9210('0x6d')][_0x9210('0x36')](_0x5ecce7));}return BPromise[_0x9210('0x8a')](_0x3a7f16);}})[_0x9210('0x23')](function(){return _0x499fc9;})[_0x9210('0x23')](respondWithResult(_0x496a6c,null))[_0x9210('0x49')](handleError(_0x496a6c,null));};exports[_0x9210('0xb0')]=function(_0x449ff2,_0x50c434,_0x23bf97){return db[_0x9210('0x33')][_0x9210('0x2c')]({'where':{'id':_0x449ff2['params']['id']}})['then'](handleEntityNotFound(_0x50c434,null))[_0x9210('0x23')](function(_0x148530){if(_0x148530){return _0x148530[_0x9210('0xb0')](_0x449ff2[_0x9210('0x36')][_0x9210('0x7a')]);}})[_0x9210('0x23')](function(_0x4346e3){if(_0x4346e3){return db[_0x9210('0x5d')][_0x9210('0x24')]({'where':{'ListId':_0x449ff2[_0x9210('0x36')]['ids'],'VoiceQueueId':_0x449ff2[_0x9210('0x4b')]['id']}})['then'](function(){return _0x4346e3;});}})[_0x9210('0x23')](respondWithStatusCode(_0x50c434,null))[_0x9210('0x49')](handleError(_0x50c434,null));};exports['getBlackLists']=function(_0x38bdf6,_0x1cd990,_0x698b6f){var _0x36ac1a={};var _0x5b2c1a={};var _0x33905e;var _0x4e5df2;return db[_0x9210('0x33')][_0x9210('0x5c')]({'where':{'id':_0x38bdf6[_0x9210('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1cd990,null))[_0x9210('0x23')](function(_0x32b322){if(_0x32b322){_0x33905e=_0x32b322;_0x5b2c1a[_0x9210('0x35')]=_[_0x9210('0x37')](db[_0x9210('0x96')][_0x9210('0x4c')]);_0x5b2c1a[_0x9210('0x36')]=_['keys'](_0x38bdf6[_0x9210('0x36')]);_0x5b2c1a[_0x9210('0x38')]=_[_0x9210('0x3a')](_0x5b2c1a['model'],_0x5b2c1a[_0x9210('0x36')]);_0x36ac1a[_0x9210('0x39')]=_['intersection'](_0x5b2c1a[_0x9210('0x35')],qs['fields'](_0x38bdf6[_0x9210('0x36')][_0x9210('0x3b')]));_0x36ac1a[_0x9210('0x39')]=_0x36ac1a[_0x9210('0x39')][_0x9210('0x3c')]?_0x36ac1a[_0x9210('0x39')]:_0x5b2c1a[_0x9210('0x35')];_0x36ac1a[_0x9210('0x5e')]=qs[_0x9210('0x3e')](_0x38bdf6[_0x9210('0x36')][_0x9210('0x3e')]);_0x36ac1a[_0x9210('0x3f')]=qs[_0x9210('0x38')](_[_0x9210('0x40')](_0x38bdf6[_0x9210('0x36')],_0x5b2c1a[_0x9210('0x38')]));if(_0x38bdf6[_0x9210('0x36')][_0x9210('0x43')]){_0x36ac1a[_0x9210('0x3f')]=_[_0x9210('0x41')](_0x36ac1a[_0x9210('0x3f')],{'$or':_[_0x9210('0x2a')](_0x36ac1a['attributes'],function(_0x5d8c5c){var _0x2683a2={};_0x2683a2[_0x5d8c5c]={'$like':'%'+_0x38bdf6['query'][_0x9210('0x43')]+'%'};return _0x2683a2;})});}_0x36ac1a=_[_0x9210('0x41')]({},_0x36ac1a,_0x38bdf6[_0x9210('0x44')]);return _0x33905e[_0x9210('0xb1')](_0x36ac1a);}})['then'](function(_0x514977){if(_0x514977){_0x4e5df2=_0x514977[_0x9210('0x3c')];if(!_0x38bdf6[_0x9210('0x36')][_0x9210('0x62')](_0x9210('0x3d'))){_0x36ac1a[_0x9210('0x1d')]=qs[_0x9210('0x1d')](_0x38bdf6[_0x9210('0x36')][_0x9210('0x1d')]);_0x36ac1a[_0x9210('0x20')]=qs[_0x9210('0x20')](_0x38bdf6[_0x9210('0x36')][_0x9210('0x20')]);}return _0x33905e[_0x9210('0xb1')](_0x36ac1a);}})['then'](function(_0x3c5cc4){if(_0x3c5cc4){return _0x3c5cc4?{'count':_0x4e5df2,'rows':_0x3c5cc4}:null;}})[_0x9210('0x23')](respondWithResult(_0x1cd990,null))[_0x9210('0x49')](handleError(_0x1cd990,null));};exports[_0x9210('0xb2')]=function(_0x202841,_0x15961a,_0x1faa5d){var _0x58a81e,_0x275d43;return db[_0x9210('0x33')]['find']({'where':{'id':_0x202841[_0x9210('0x4b')]['id']}})[_0x9210('0x23')](handleEntityNotFound(_0x15961a,null))[_0x9210('0x23')](function(_0x2b8e2d){if(_0x2b8e2d){_0x275d43=_0x2b8e2d;return _0x2b8e2d['addBlackLists'](_0x202841['body']['ids'],_[_0x9210('0x59')](_0x202841[_0x9210('0x58')],[_0x9210('0x7a'),'id'])||{});}return null;})[_0x9210('0x98')](function(_0x58912a){var _0x356ba5;_0x58a81e=_0x58912a||[];var _0x319f2e=[];if(_0x58912a){for(var _0x33a12b=0x0;_0x33a12b<_0x58912a[_0x9210('0x3c')];_0x33a12b+=0x1){var _0x3c90e4=_0x58912a[_0x33a12b]['get']({'plain':!![]});_0x356ba5=squel[_0x9210('0x9b')]()[_0x9210('0x9c')](_0x9210('0xb3'))[_0x9210('0x9e')]([_0x9210('0x9f'),'ContactId',_0x9210('0xa6'),'VoiceQueueId',_0x9210('0x5a'),_0x9210('0x57')],squel['select']()[_0x9210('0xa2')](_0x9210('0x9f'),'phone')[_0x9210('0xa2')]('id',_0x9210('0xa4'))[_0x9210('0xa2')](_0x3c90e4[_0x9210('0xa5')][_0x9210('0x85')](),_0x9210('0xa6'))[_0x9210('0xa2')](_0x202841['params']['id'][_0x9210('0x85')](),_0x9210('0x5f'))[_0x9210('0xa2')](_0x9210('0xa3'),_0x9210('0x5a'))['field'](_0x9210('0xa3'),_0x9210('0x57'))[_0x9210('0x7d')](_0x9210('0xa7'))[_0x9210('0x3f')](_0x9210('0xa8'))['where']('ListId\x20=\x20?',_0x3c90e4[_0x9210('0xa5')][_0x9210('0x85')]())[_0x9210('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0x9210('0x85')]();_0x319f2e[_0x9210('0x84')](db['sequelize'][_0x9210('0x36')](_0x356ba5));}return BPromise[_0x9210('0x8a')](_0x319f2e);}})[_0x9210('0x23')](function(){return _0x58a81e;})['then'](respondWithResult(_0x15961a,null))[_0x9210('0x49')](handleError(_0x15961a,null));};exports[_0x9210('0xb4')]=function(_0x2a197c,_0x51da2e,_0x47ae75){return db[_0x9210('0x33')][_0x9210('0x2c')]({'where':{'id':_0x2a197c[_0x9210('0x4b')]['id']}})['then'](handleEntityNotFound(_0x51da2e,null))[_0x9210('0x23')](function(_0x3f79bc){if(_0x3f79bc){return _0x3f79bc[_0x9210('0xb4')](_0x2a197c['query'][_0x9210('0x7a')]);}})[_0x9210('0x23')](function(_0x48fb38){if(_0x48fb38){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x2a197c[_0x9210('0x36')][_0x9210('0x7a')],'VoiceQueueId':_0x2a197c[_0x9210('0x4b')]['id']}})['then'](function(){return _0x48fb38;});}})[_0x9210('0x23')](respondWithStatusCode(_0x51da2e,null))[_0x9210('0x49')](handleError(_0x51da2e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 5a4a7f7..c59996b 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 _0xd36a=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueue','update'];(function(_0x2afd92,_0x16fa67){var _0x5ac456=function(_0x2182ed){while(--_0x2182ed){_0x2afd92['push'](_0x2afd92['shift']());}};_0x5ac456(++_0x16fa67);}(_0xd36a,0x124));var _0xad36=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd36a[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xad36('0x0'));var VoiceQueue=require(_0xad36('0x1'))['db'][_0xad36('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xad36('0x3'),'afterDestroy':_0xad36('0x4')};function emitEvent(_0x207393){return function(_0x464d47,_0x41789a,_0x396560){VoiceQueueEvents[_0xad36('0x5')](_0x207393+':'+_0x464d47['id'],_0x464d47);VoiceQueueEvents[_0xad36('0x5')](_0x207393,_0x464d47);_0x396560(null);};}for(var e in events){if(events[_0xad36('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xad36('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0x6b21=['emit','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x1ca09d,_0x31f182){var _0x4ea667=function(_0x1fb3cd){while(--_0x1fb3cd){_0x1ca09d['push'](_0x1ca09d['shift']());}};_0x4ea667(++_0x31f182);}(_0x6b21,0xb7));var _0x16b2=function(_0x5cf40d,_0x2aeff2){_0x5cf40d=_0x5cf40d-0x0;var _0x170d6e=_0x6b21[_0x5cf40d];return _0x170d6e;};'use strict';var EventEmitter=require(_0x16b2('0x0'));var VoiceQueue=require(_0x16b2('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x16b2('0x2')](0x0);var events={'afterCreate':_0x16b2('0x3'),'afterUpdate':_0x16b2('0x4'),'afterDestroy':_0x16b2('0x5')};function emitEvent(_0x34064e){return function(_0x43e7f3,_0x447120,_0x7aca9a){VoiceQueueEvents[_0x16b2('0x6')](_0x34064e+':'+_0x43e7f3['id'],_0x43e7f3);VoiceQueueEvents[_0x16b2('0x6')](_0x34064e,_0x43e7f3);_0x7aca9a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x16b2('0x7')](e,emitEvent(event));}}module[_0x16b2('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 0d205a7..bbf953b 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 _0x55ca=['./voiceQueue.attributes','exports','define','voice_queues','lodash','util','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x21aec3,_0x5c97e9){var _0x288bbc=function(_0x2283fe){while(--_0x2283fe){_0x21aec3['push'](_0x21aec3['shift']());}};_0x288bbc(++_0x5c97e9);}(_0x55ca,0x126));var _0xa55c=function(_0x5a2db8,_0x409f2a){_0x5a2db8=_0x5a2db8-0x0;var _0x28b4f8=_0x55ca[_0x5a2db8];return _0x28b4f8;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('VoiceQueue',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x291065,_0x55ea8b){var _0x598dec=function(_0x54b428){while(--_0x54b428){_0x291065['push'](_0x291065['shift']());}};_0x598dec(++_0x55ea8b);}(_0x34e8,0x12c));var _0x834e=function(_0x524263,_0x190865){_0x524263=_0x524263-0x0;var _0x4edfef=_0x34e8[_0x524263];return _0x4edfef;};'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 424dc0c..3c4b747 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 _0xdddd=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','localhost','socket.io-emitter','redis','./voiceQueue.socket','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','limit','include','map','model','attributes','ShowVoiceQueue','then'];(function(_0xaf025d,_0x586d7a){var _0x1c77cb=function(_0x560b3a){while(--_0x560b3a){_0xaf025d['push'](_0xaf025d['shift']());}};_0x1c77cb(++_0x586d7a);}(_0xdddd,0x17a));var _0xdddd=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xdddd[_0x5416db];return _0x243e35;};'use strict';var _=require(_0xdddd('0x0'));var util=require(_0xdddd('0x1'));var moment=require(_0xdddd('0x2'));var BPromise=require(_0xdddd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdddd('0x4'));var db=require(_0xdddd('0x5'))['db'];var utils=require(_0xdddd('0x6'));var logger=require(_0xdddd('0x7'))(_0xdddd('0x8'));var config=require(_0xdddd('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdddd('0xa')][_0xdddd('0xb')]({'port':0x232a});config['redis']=_[_0xdddd('0xc')](config['redis'],{'host':_0xdddd('0xd'),'port':0x18eb});var socket=require(_0xdddd('0xe'))(new Redis(config[_0xdddd('0xf')]));require(_0xdddd('0x10'))['register'](socket);function respondWithRpcPromise(_0x29bacb,_0x17eaa6,_0x483466){return new BPromise(function(_0x17f5c4,_0x37e92f){return client[_0xdddd('0x11')](_0x29bacb,_0x483466)['then'](function(_0x41113d){logger[_0xdddd('0x12')](_0xdddd('0x13'),_0x17eaa6,_0xdddd('0x14'));logger[_0xdddd('0x15')](_0xdddd('0x16'),_0x17eaa6,_0xdddd('0x14'),JSON[_0xdddd('0x17')](_0x41113d));if(_0x41113d['error']){if(_0x41113d[_0xdddd('0x18')][_0xdddd('0x19')]===0x1f4){logger[_0xdddd('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x17eaa6,_0x41113d['error'][_0xdddd('0x1a')]);return _0x37e92f(_0x41113d['error'][_0xdddd('0x1a')]);}logger[_0xdddd('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x17eaa6,_0x41113d['error']['message']);return _0x17f5c4(_0x41113d[_0xdddd('0x18')][_0xdddd('0x1a')]);}else{logger[_0xdddd('0x12')]('VoiceQueue,\x20%s,\x20%s',_0x17eaa6,_0xdddd('0x14'));_0x17f5c4(_0x41113d[_0xdddd('0x1b')][_0xdddd('0x1a')]);}})[_0xdddd('0x1c')](function(_0x5023d5){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x17eaa6,_0x5023d5);_0x37e92f(_0x5023d5);});});}exports[_0xdddd('0x1d')]=function(_0x2e981c){var _0x31506e=this;return new Promise(function(_0x1445a8,_0x4b67f0){return db[_0xdddd('0x1e')][_0xdddd('0x1f')]({'raw':_0x2e981c[_0xdddd('0x20')]?_0x2e981c[_0xdddd('0x20')][_0xdddd('0x21')]===undefined?!![]:![]:!![],'where':_0x2e981c[_0xdddd('0x20')]?_0x2e981c[_0xdddd('0x20')][_0xdddd('0x22')]||null:null,'attributes':_0x2e981c[_0xdddd('0x20')]?_0x2e981c[_0xdddd('0x20')]['attributes']||null:null,'limit':_0x2e981c['options']?_0x2e981c[_0xdddd('0x20')][_0xdddd('0x23')]||null:null,'include':_0x2e981c['options']?_0x2e981c[_0xdddd('0x20')][_0xdddd('0x24')]?_[_0xdddd('0x25')](_0x2e981c['options'][_0xdddd('0x24')],function(_0x4d052f){return{'model':db[_0x4d052f[_0xdddd('0x26')]],'as':_0x4d052f['as'],'attributes':_0x4d052f[_0xdddd('0x27')],'include':_0x4d052f['include']?_[_0xdddd('0x25')](_0x4d052f[_0xdddd('0x24')],function(_0x1cf2f2){return{'model':db[_0x1cf2f2['model']],'as':_0x1cf2f2['as'],'attributes':_0x1cf2f2[_0xdddd('0x27')],'include':_0x1cf2f2['include']?_[_0xdddd('0x25')](_0x1cf2f2[_0xdddd('0x24')],function(_0x59cf74){return{'model':db[_0x59cf74[_0xdddd('0x26')]],'as':_0x59cf74['as'],'attributes':_0x59cf74[_0xdddd('0x27')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd9685f){logger[_0xdddd('0x12')](_0xdddd('0x1d'),_0x2e981c);logger[_0xdddd('0x15')](_0xdddd('0x1d'),_0x2e981c,JSON['stringify'](_0xd9685f));_0x1445a8(_0xd9685f);})[_0xdddd('0x1c')](function(_0x1d0904){logger[_0xdddd('0x18')](_0xdddd('0x1d'),_0x1d0904['message'],_0x2e981c);_0x4b67f0(_0x31506e[_0xdddd('0x18')](0x1f4,_0x1d0904[_0xdddd('0x1a')]));});});};exports[_0xdddd('0x28')]=function(_0x5388e8){var _0x47d056=this;return new Promise(function(_0x2b73f3,_0x3be253){return db[_0xdddd('0x1e')]['find']({'raw':_0x5388e8[_0xdddd('0x20')]?_0x5388e8['options'][_0xdddd('0x21')]===undefined?!![]:![]:!![],'where':_0x5388e8[_0xdddd('0x20')]?_0x5388e8['options'][_0xdddd('0x22')]||null:null,'attributes':_0x5388e8[_0xdddd('0x20')]?_0x5388e8['options']['attributes']||null:null,'include':_0x5388e8['options']?_0x5388e8[_0xdddd('0x20')]['include']?_['map'](_0x5388e8[_0xdddd('0x20')][_0xdddd('0x24')],function(_0x3d5a84){return{'model':db[_0x3d5a84[_0xdddd('0x26')]],'as':_0x3d5a84['as'],'attributes':_0x3d5a84[_0xdddd('0x27')],'include':_0x3d5a84[_0xdddd('0x24')]?_[_0xdddd('0x25')](_0x3d5a84['include'],function(_0x418958){return{'model':db[_0x418958['model']],'as':_0x418958['as'],'attributes':_0x418958[_0xdddd('0x27')],'include':_0x418958['include']?_[_0xdddd('0x25')](_0x418958[_0xdddd('0x24')],function(_0x491b93){return{'model':db[_0x491b93[_0xdddd('0x26')]],'as':_0x491b93['as'],'attributes':_0x491b93[_0xdddd('0x27')]};}):[]};}):[]};}):[]:[]})[_0xdddd('0x29')](function(_0x4b031f){logger[_0xdddd('0x12')](_0xdddd('0x28'),_0x5388e8);logger[_0xdddd('0x15')](_0xdddd('0x28'),_0x5388e8,JSON[_0xdddd('0x17')](_0x4b031f));_0x2b73f3(_0x4b031f);})[_0xdddd('0x1c')](function(_0x462c20){logger[_0xdddd('0x18')](_0xdddd('0x28'),_0x462c20[_0xdddd('0x1a')],_0x5388e8);_0x3be253(_0x47d056['error'](0x1f4,_0x462c20[_0xdddd('0x1a')]));});});}; \ No newline at end of file +var _0x2a23=['defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','where','attributes','include','map','model','catch','ShowVoiceQueue','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis'];(function(_0x418942,_0x1e1323){var _0x2a0f37=function(_0x98e2f6){while(--_0x98e2f6){_0x418942['push'](_0x418942['shift']());}};_0x2a0f37(++_0x1e1323);}(_0x2a23,0x1ad));var _0x32a2=function(_0xdb66e3,_0x4bac6f){_0xdb66e3=_0xdb66e3-0x0;var _0x3d0312=_0x2a23[_0xdb66e3];return _0x3d0312;};'use strict';var _=require(_0x32a2('0x0'));var util=require(_0x32a2('0x1'));var moment=require(_0x32a2('0x2'));var BPromise=require(_0x32a2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x32a2('0x4'));var db=require(_0x32a2('0x5'))['db'];var utils=require(_0x32a2('0x6'));var logger=require(_0x32a2('0x7'))('rpc');var config=require(_0x32a2('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x32a2('0x9')]({'port':0x232a});config[_0x32a2('0xa')]=_[_0x32a2('0xb')](config['redis'],{'host':_0x32a2('0xc'),'port':0x18eb});var socket=require(_0x32a2('0xd'))(new Redis(config[_0x32a2('0xa')]));require(_0x32a2('0xe'))['register'](socket);function respondWithRpcPromise(_0x5d21d1,_0x56724c,_0x588ce8){return new BPromise(function(_0x5b6495,_0x18d5c4){return client[_0x32a2('0xf')](_0x5d21d1,_0x588ce8)[_0x32a2('0x10')](function(_0x34e4e4){logger[_0x32a2('0x11')](_0x32a2('0x12'),_0x56724c,_0x32a2('0x13'));logger[_0x32a2('0x14')](_0x32a2('0x15'),_0x56724c,_0x32a2('0x13'),JSON[_0x32a2('0x16')](_0x34e4e4));if(_0x34e4e4[_0x32a2('0x17')]){if(_0x34e4e4[_0x32a2('0x17')][_0x32a2('0x18')]===0x1f4){logger['error'](_0x32a2('0x12'),_0x56724c,_0x34e4e4[_0x32a2('0x17')][_0x32a2('0x19')]);return _0x18d5c4(_0x34e4e4[_0x32a2('0x17')][_0x32a2('0x19')]);}logger[_0x32a2('0x17')](_0x32a2('0x12'),_0x56724c,_0x34e4e4[_0x32a2('0x17')][_0x32a2('0x19')]);return _0x5b6495(_0x34e4e4[_0x32a2('0x17')][_0x32a2('0x19')]);}else{logger[_0x32a2('0x11')](_0x32a2('0x12'),_0x56724c,_0x32a2('0x13'));_0x5b6495(_0x34e4e4[_0x32a2('0x1a')][_0x32a2('0x19')]);}})['catch'](function(_0x4c9352){logger['error'](_0x32a2('0x12'),_0x56724c,_0x4c9352);_0x18d5c4(_0x4c9352);});});}exports[_0x32a2('0x1b')]=function(_0x34625e){var _0x286d8c=this;return new Promise(function(_0x927037,_0x46bde8){return db[_0x32a2('0x1c')][_0x32a2('0x1d')]({'raw':_0x34625e[_0x32a2('0x1e')]?_0x34625e['options']['raw']===undefined?!![]:![]:!![],'where':_0x34625e[_0x32a2('0x1e')]?_0x34625e[_0x32a2('0x1e')][_0x32a2('0x1f')]||null:null,'attributes':_0x34625e[_0x32a2('0x1e')]?_0x34625e['options'][_0x32a2('0x20')]||null:null,'limit':_0x34625e[_0x32a2('0x1e')]?_0x34625e[_0x32a2('0x1e')]['limit']||null:null,'include':_0x34625e[_0x32a2('0x1e')]?_0x34625e[_0x32a2('0x1e')][_0x32a2('0x21')]?_[_0x32a2('0x22')](_0x34625e['options'][_0x32a2('0x21')],function(_0x36ff05){return{'model':db[_0x36ff05['model']],'as':_0x36ff05['as'],'attributes':_0x36ff05[_0x32a2('0x20')],'include':_0x36ff05[_0x32a2('0x21')]?_[_0x32a2('0x22')](_0x36ff05['include'],function(_0x5412cf){return{'model':db[_0x5412cf[_0x32a2('0x23')]],'as':_0x5412cf['as'],'attributes':_0x5412cf[_0x32a2('0x20')],'include':_0x5412cf[_0x32a2('0x21')]?_['map'](_0x5412cf[_0x32a2('0x21')],function(_0x1f48bc){return{'model':db[_0x1f48bc[_0x32a2('0x23')]],'as':_0x1f48bc['as'],'attributes':_0x1f48bc[_0x32a2('0x20')]};}):[]};}):[]};}):[]:[]})[_0x32a2('0x10')](function(_0xd829eb){logger['info']('GetVoiceQueue',_0x34625e);logger[_0x32a2('0x14')](_0x32a2('0x1b'),_0x34625e,JSON[_0x32a2('0x16')](_0xd829eb));_0x927037(_0xd829eb);})[_0x32a2('0x24')](function(_0x5229cf){logger[_0x32a2('0x17')](_0x32a2('0x1b'),_0x5229cf[_0x32a2('0x19')],_0x34625e);_0x46bde8(_0x286d8c[_0x32a2('0x17')](0x1f4,_0x5229cf[_0x32a2('0x19')]));});});};exports[_0x32a2('0x25')]=function(_0x153578){var _0x575c47=this;return new Promise(function(_0x2a0e42,_0x159aef){return db[_0x32a2('0x1c')][_0x32a2('0x26')]({'raw':_0x153578[_0x32a2('0x1e')]?_0x153578[_0x32a2('0x1e')][_0x32a2('0x27')]===undefined?!![]:![]:!![],'where':_0x153578[_0x32a2('0x1e')]?_0x153578[_0x32a2('0x1e')][_0x32a2('0x1f')]||null:null,'attributes':_0x153578['options']?_0x153578[_0x32a2('0x1e')][_0x32a2('0x20')]||null:null,'include':_0x153578[_0x32a2('0x1e')]?_0x153578['options'][_0x32a2('0x21')]?_[_0x32a2('0x22')](_0x153578[_0x32a2('0x1e')][_0x32a2('0x21')],function(_0x3b70e3){return{'model':db[_0x3b70e3[_0x32a2('0x23')]],'as':_0x3b70e3['as'],'attributes':_0x3b70e3[_0x32a2('0x20')],'include':_0x3b70e3['include']?_[_0x32a2('0x22')](_0x3b70e3[_0x32a2('0x21')],function(_0x5c3246){return{'model':db[_0x5c3246[_0x32a2('0x23')]],'as':_0x5c3246['as'],'attributes':_0x5c3246['attributes'],'include':_0x5c3246['include']?_[_0x32a2('0x22')](_0x5c3246[_0x32a2('0x21')],function(_0x2b225d){return{'model':db[_0x2b225d[_0x32a2('0x23')]],'as':_0x2b225d['as'],'attributes':_0x2b225d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a7607){logger[_0x32a2('0x11')](_0x32a2('0x25'),_0x153578);logger[_0x32a2('0x14')]('ShowVoiceQueue',_0x153578,JSON[_0x32a2('0x16')](_0x3a7607));_0x2a0e42(_0x3a7607);})['catch'](function(_0x2a8353){logger[_0x32a2('0x17')](_0x32a2('0x25'),_0x2a8353['message'],_0x153578);_0x159aef(_0x575c47[_0x32a2('0x17')](0x1f4,_0x2a8353['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 04897ea..3ca40f1 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 _0x29c8=['removeListener','register','length','voiceQueue:','./voiceQueue.events','save','update','emit'];(function(_0x7c8cb6,_0x2ea888){var _0xc86e95=function(_0x17d4ce){while(--_0x17d4ce){_0x7c8cb6['push'](_0x7c8cb6['shift']());}};_0xc86e95(++_0x2ea888);}(_0x29c8,0x84));var _0x829c=function(_0x2953b5,_0x304a99){_0x2953b5=_0x2953b5-0x0;var _0x3f622c=_0x29c8[_0x2953b5];return _0x3f622c;};'use strict';var VoiceQueueEvents=require(_0x829c('0x0'));var events=[_0x829c('0x1'),'remove',_0x829c('0x2')];function createListener(_0x61ce34,_0x5a804f){return function(_0x94988c){_0x5a804f[_0x829c('0x3')](_0x61ce34,_0x94988c);};}function removeListener(_0x19908f,_0x23c112){return function(){VoiceQueueEvents[_0x829c('0x4')](_0x19908f,_0x23c112);};}exports[_0x829c('0x5')]=function(_0x437d02){for(var _0x38c93d=0x0,_0x4c9455=events[_0x829c('0x6')];_0x38c93d<_0x4c9455;_0x38c93d++){var _0x2cebe1=events[_0x38c93d];var _0x5c2b73=createListener(_0x829c('0x7')+_0x2cebe1,_0x437d02);VoiceQueueEvents['on'](_0x2cebe1,_0x5c2b73);}}; \ No newline at end of file +var _0x33d8=['voiceQueue:','save','update','removeListener','register','length'];(function(_0x483f42,_0x3af164){var _0xe7deb0=function(_0x1ae433){while(--_0x1ae433){_0x483f42['push'](_0x483f42['shift']());}};_0xe7deb0(++_0x3af164);}(_0x33d8,0x16f));var _0x833d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x33d8[_0x4b369d];return _0x571a98;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x833d('0x0'),'remove',_0x833d('0x1')];function createListener(_0x49a1a8,_0x53d235){return function(_0xbd8063){_0x53d235['emit'](_0x49a1a8,_0xbd8063);};}function removeListener(_0x14ae95,_0x45a8b2){return function(){VoiceQueueEvents[_0x833d('0x2')](_0x14ae95,_0x45a8b2);};}exports[_0x833d('0x3')]=function(_0x7422d9){for(var _0xa6e2e6=0x0,_0x5c813c=events[_0x833d('0x4')];_0xa6e2e6<_0x5c813c;_0xa6e2e6++){var _0x159587=events[_0xa6e2e6];var _0x43ba65=createListener(_0x833d('0x5')+_0x159587,_0x7422d9);VoiceQueueEvents['on'](_0x159587,_0x43ba65);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 99fd8ec..59d7406 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 _0xa6d5=['/describe','describe','/index','getVoiceQueuesReport','post','create','update','/:id','destroy','exports','util','path','Router','fs-extra','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index'];(function(_0x19053c,_0x16cc1f){var _0x177c4c=function(_0xb9f21f){while(--_0xb9f21f){_0x19053c['push'](_0x19053c['shift']());}};_0x177c4c(++_0x16cc1f);}(_0xa6d5,0x1ac));var _0x5a6d=function(_0x5ed233,_0xb69f5e){_0x5ed233=_0x5ed233-0x0;var _0x486f78=_0xa6d5[_0x5ed233];return _0x486f78;};'use strict';var multer=require('multer');var util=require(_0x5a6d('0x0'));var path=require(_0x5a6d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5a6d('0x2')]();var fs_extra=require(_0x5a6d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5a6d('0x4'));var config=require('../../config/environment');var controller=require(_0x5a6d('0x5'));router[_0x5a6d('0x6')]('/',auth[_0x5a6d('0x7')](),controller[_0x5a6d('0x8')]);router[_0x5a6d('0x6')](_0x5a6d('0x9'),auth[_0x5a6d('0x7')](),controller[_0x5a6d('0xa')]);router['get'](_0x5a6d('0xb'),auth['isAuthenticated'](),controller[_0x5a6d('0xc')]);router['get']('/:id',auth[_0x5a6d('0x7')](),controller['show']);router[_0x5a6d('0xd')]('/',auth[_0x5a6d('0x7')](),controller[_0x5a6d('0xe')]);router['put']('/:id',auth[_0x5a6d('0x7')](),controller[_0x5a6d('0xf')]);router['delete'](_0x5a6d('0x10'),auth[_0x5a6d('0x7')](),controller[_0x5a6d('0x11')]);module[_0x5a6d('0x12')]=router; \ No newline at end of file +var _0x1201=['delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/index','getVoiceQueuesReport','/:id','show','post','put'];(function(_0x33d8d0,_0x4dd6e5){var _0x2462f9=function(_0x888d9){while(--_0x888d9){_0x33d8d0['push'](_0x33d8d0['shift']());}};_0x2462f9(++_0x4dd6e5);}(_0x1201,0x8e));var _0x1120=function(_0x107f10,_0x5529f2){_0x107f10=_0x107f10-0x0;var _0x811cab=_0x1201[_0x107f10];return _0x811cab;};'use strict';var multer=require(_0x1120('0x0'));var util=require('util');var path=require(_0x1120('0x1'));var timeout=require(_0x1120('0x2'));var express=require(_0x1120('0x3'));var router=express['Router']();var fs_extra=require(_0x1120('0x4'));var auth=require(_0x1120('0x5'));var interaction=require(_0x1120('0x6'));var config=require(_0x1120('0x7'));var controller=require('./voiceQueueReport.controller');router[_0x1120('0x8')]('/',auth[_0x1120('0x9')](),controller[_0x1120('0xa')]);router['get'](_0x1120('0xb'),auth[_0x1120('0x9')](),controller['describe']);router[_0x1120('0x8')](_0x1120('0xc'),auth[_0x1120('0x9')](),controller[_0x1120('0xd')]);router[_0x1120('0x8')](_0x1120('0xe'),auth['isAuthenticated'](),controller[_0x1120('0xf')]);router[_0x1120('0x10')]('/',auth[_0x1120('0x9')](),controller['create']);router[_0x1120('0x11')](_0x1120('0xe'),auth[_0x1120('0x9')](),controller['update']);router[_0x1120('0x12')](_0x1120('0xe'),auth['isAuthenticated'](),controller[_0x1120('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 253445b..1b52f30 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 _0x6733=['DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6733,0x176));var _0x3673=function(_0x321e41,_0x471c01){_0x321e41=_0x321e41-0x0;var _0x2f5c46=_0x6733[_0x321e41];return _0x2f5c46;};'use strict';var Sequelize=require(_0x3673('0x0'));var moment=require(_0x3673('0x1'));module[_0x3673('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3673('0x3')]},'calleridnum':{'type':Sequelize[_0x3673('0x3')]},'calleridname':{'type':Sequelize[_0x3673('0x3')]},'queue':{'type':Sequelize[_0x3673('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x3673('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x3673('0x4')],'set':function(_0xe0a46a){var _0x4f5705=moment(_0xe0a46a);var _0x11e9b8=moment(this[_0x3673('0x5')]('queuecallerjoinAt'))[_0x3673('0x6')](_0x3673('0x7'));var _0x3c10dc=_0x4f5705['diff'](_0x11e9b8,_0x3673('0x8'));this[_0x3673('0x9')](_0x3673('0xa'),_0xe0a46a);this['setDataValue']('holdtime',_0x3c10dc||null);}},'position':{'type':Sequelize[_0x3673('0xb')]},'count':{'type':Sequelize[_0x3673('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x3673('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize[_0x3673('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3673('0x4')]},'queuecallerexit':{'type':Sequelize[_0x3673('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3673('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x3673('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x3673('0xb')]},'channel':{'type':Sequelize[_0x3673('0x3')]},'connectedlinenum':{'type':Sequelize[_0x3673('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3673('0x3')]},'context':{'type':Sequelize[_0x3673('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3673('0x3')]},'holdtime':{'type':Sequelize[_0x3673('0xb')]},'mohtime':{'type':Sequelize[_0x3673('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x3673('0xd')},'transferexten':{'type':Sequelize[_0x3673('0x3')]},'transferuniqueid':{'type':Sequelize[_0x3673('0x3')]},'disposition':{'type':Sequelize[_0x3673('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x3673('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x3673('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3b7c=['YYYY-MM-DD\x20HH:mm:ss','diff','seconds','queuecallerleaveAt','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','getDataValue','queuecallerjoinAt','format'];(function(_0x38b107,_0x32c0b1){var _0x43b5a8=function(_0x45321e){while(--_0x45321e){_0x38b107['push'](_0x38b107['shift']());}};_0x43b5a8(++_0x32c0b1);}(_0x3b7c,0xbd));var _0xc3b7=function(_0xab2afb,_0x546bfb){_0xab2afb=_0xab2afb-0x0;var _0x25262b=_0x3b7c[_0xab2afb];return _0x25262b;};'use strict';var Sequelize=require(_0xc3b7('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc3b7('0x1')]},'calleridnum':{'type':Sequelize[_0xc3b7('0x1')]},'calleridname':{'type':Sequelize[_0xc3b7('0x1')]},'queue':{'type':Sequelize[_0xc3b7('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0xc3b7('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0xc3b7('0x2')],'set':function(_0x494682){var _0x5906cd=moment(_0x494682);var _0x1dc1af=moment(this[_0xc3b7('0x3')](_0xc3b7('0x4')))[_0xc3b7('0x5')](_0xc3b7('0x6'));var _0x3ff2a3=_0x5906cd[_0xc3b7('0x7')](_0x1dc1af,_0xc3b7('0x8'));this['setDataValue'](_0xc3b7('0x9'),_0x494682);this[_0xc3b7('0xa')](_0xc3b7('0xb'),_0x3ff2a3||null);}},'position':{'type':Sequelize[_0xc3b7('0xc')]},'count':{'type':Sequelize[_0xc3b7('0xc')]},'queuecallerabandon':{'type':Sequelize[_0xc3b7('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xc3b7('0x2')]},'queuecallercomplete':{'type':Sequelize[_0xc3b7('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xc3b7('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xc3b7('0x2')]},'queuecallerexitreason':{'type':Sequelize[_0xc3b7('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xc3b7('0xc')]},'channel':{'type':Sequelize[_0xc3b7('0x1')]},'connectedlinenum':{'type':Sequelize[_0xc3b7('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xc3b7('0x1')]},'context':{'type':Sequelize[_0xc3b7('0x1')]},'exten':{'type':Sequelize[_0xc3b7('0x1')]},'priority':{'type':Sequelize[_0xc3b7('0x1')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xc3b7('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc3b7('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xc3b7('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc3b7('0x1')],'comment':_0xc3b7('0xe')},'transferexten':{'type':Sequelize[_0xc3b7('0x1')]},'transferuniqueid':{'type':Sequelize[_0xc3b7('0x1')]},'disposition':{'type':Sequelize[_0xc3b7('0x1')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 3ea278c..6578394 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 _0x3000=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','name','filters','query','attributes','intersection','fields','length','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','describe','getVoiceQueuesReport','hasOwnProperty','nolimit','rimraf','zip-dir','request-promise'];(function(_0xbbf0e8,_0x325bb6){var _0x3287b5=function(_0x3b1c0c){while(--_0x3b1c0c){_0xbbf0e8['push'](_0xbbf0e8['shift']());}};_0x3287b5(++_0x325bb6);}(_0x3000,0xa1));var _0x0300=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3000[_0x2641f9];return _0x585741;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0300('0x0'));var zipdir=require(_0x0300('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0300('0x2'));var moment=require('moment');var BPromise=require(_0x0300('0x3'));var Mustache=require(_0x0300('0x4'));var util=require(_0x0300('0x5'));var path=require(_0x0300('0x6'));var sox=require(_0x0300('0x7'));var csv=require(_0x0300('0x8'));var ejs=require(_0x0300('0x9'));var fs=require('fs');var fs_extra=require(_0x0300('0xa'));var _=require(_0x0300('0xb'));var squel=require(_0x0300('0xc'));var crypto=require(_0x0300('0xd'));var jsforce=require(_0x0300('0xe'));var deskjs=require(_0x0300('0xf'));var toCsv=require(_0x0300('0x8'));var querystring=require(_0x0300('0x10'));var Papa=require(_0x0300('0x11'));var Redis=require(_0x0300('0x12'));var authService=require(_0x0300('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0300('0x14'));var hardwareService=require(_0x0300('0x15'));var logger=require(_0x0300('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x0300('0x17'));var licenseUtil=require(_0x0300('0x18'));var db=require(_0x0300('0x19'))['db'];config[_0x0300('0x1a')]=_[_0x0300('0x1b')](config[_0x0300('0x1a')],{'host':_0x0300('0x1c'),'port':0x18eb});var socket=require(_0x0300('0x1d'))(new Redis(config[_0x0300('0x1a')]));require(_0x0300('0x1e'))[_0x0300('0x1f')](socket);function respondWithStatusCode(_0x5a2a75,_0x23352a){_0x23352a=_0x23352a||0xcc;return function(_0x259db6){if(_0x259db6){return _0x5a2a75['sendStatus'](_0x23352a);}return _0x5a2a75[_0x0300('0x20')](_0x23352a)[_0x0300('0x21')]();};}function respondWithResult(_0x1f1d8f,_0x14714c){_0x14714c=_0x14714c||0xc8;return function(_0x3b69b4){if(_0x3b69b4){return _0x1f1d8f[_0x0300('0x20')](_0x14714c)[_0x0300('0x22')](_0x3b69b4);}};}function respondWithFilteredResult(_0x2cfc2e,_0x54b0e3){return function(_0x50545f){if(_0x50545f){var _0x8d5624=typeof _0x54b0e3[_0x0300('0x23')]===_0x0300('0x24')&&typeof _0x54b0e3[_0x0300('0x25')]==='undefined';var _0x20bc6b=_0x50545f[_0x0300('0x26')];var _0x4c9f0d=_0x8d5624?0x0:_0x54b0e3['offset'];var _0x483fb5=_0x8d5624?_0x50545f[_0x0300('0x26')]:_0x54b0e3[_0x0300('0x23')]+_0x54b0e3[_0x0300('0x25')];var _0x23771d;if(_0x483fb5>=_0x20bc6b){_0x483fb5=_0x20bc6b;_0x23771d=0xc8;}else{_0x23771d=0xce;}_0x2cfc2e[_0x0300('0x20')](_0x23771d);return _0x2cfc2e[_0x0300('0x27')]('Content-Range',_0x4c9f0d+'-'+_0x483fb5+'/'+_0x20bc6b)[_0x0300('0x22')](_0x50545f);}return null;};}function patchUpdates(_0x284fc3){return function(_0x44ce9c){try{jsonpatch[_0x0300('0x28')](_0x44ce9c,_0x284fc3,!![]);}catch(_0x58c401){return BPromise['reject'](_0x58c401);}return _0x44ce9c[_0x0300('0x29')]();};}function saveUpdates(_0x37e54d,_0x2bb8d3){return function(_0x3f446a){if(_0x3f446a){return _0x3f446a[_0x0300('0x2a')](_0x37e54d)[_0x0300('0x2b')](function(_0x1f85d0){return _0x1f85d0;});}return null;};}function removeEntity(_0x112d83,_0x3d5016){return function(_0x8fc214){if(_0x8fc214){return _0x8fc214[_0x0300('0x2c')]()[_0x0300('0x2b')](function(){_0x112d83[_0x0300('0x20')](0xcc)[_0x0300('0x21')]();});}};}function handleEntityNotFound(_0x4f5a06,_0x297000){return function(_0x54362c){if(!_0x54362c){_0x4f5a06['sendStatus'](0x194);}return _0x54362c;};}function handleError(_0x19ec81,_0x22ffca){_0x22ffca=_0x22ffca||0x1f4;return function(_0xd2bda2){logger['error'](_0xd2bda2[_0x0300('0x2d')]);if(_0xd2bda2['name']){delete _0xd2bda2['name'];}_0x19ec81[_0x0300('0x20')](_0x22ffca)[_0x0300('0x2e')](_0xd2bda2);};}exports[_0x0300('0x2f')]=function(_0x5254b2,_0x353050){var _0x5583e9={},_0x52e552={},_0x3f892d={'count':0x0,'rows':[]};var _0xe71026=_[_0x0300('0x30')](db[_0x0300('0x31')][_0x0300('0x32')],function(_0x4a27a7){return{'name':_0x4a27a7[_0x0300('0x33')],'type':_0x4a27a7[_0x0300('0x34')][_0x0300('0x35')]};});_0x52e552[_0x0300('0x36')]=_[_0x0300('0x30')](_0xe71026,_0x0300('0x37'));_0x52e552['query']=_['keys'](_0x5254b2['query']);_0x52e552[_0x0300('0x38')]=_['intersection'](_0x52e552['model'],_0x52e552[_0x0300('0x39')]);_0x5583e9[_0x0300('0x3a')]=_[_0x0300('0x3b')](_0x52e552[_0x0300('0x36')],qs[_0x0300('0x3c')](_0x5254b2['query'][_0x0300('0x3c')]));_0x5583e9[_0x0300('0x3a')]=_0x5583e9[_0x0300('0x3a')][_0x0300('0x3d')]?_0x5583e9[_0x0300('0x3a')]:_0x52e552[_0x0300('0x36')];if(!_0x5254b2[_0x0300('0x39')]['hasOwnProperty']('nolimit')){_0x5583e9['limit']=qs[_0x0300('0x25')](_0x5254b2[_0x0300('0x39')][_0x0300('0x25')]);_0x5583e9[_0x0300('0x23')]=qs[_0x0300('0x23')](_0x5254b2[_0x0300('0x39')]['offset']);}_0x5583e9[_0x0300('0x3e')]=qs[_0x0300('0x3f')](_0x5254b2['query'][_0x0300('0x3f')]);_0x5583e9[_0x0300('0x40')]=qs[_0x0300('0x38')](_['pick'](_0x5254b2['query'],_0x52e552[_0x0300('0x38')]),_0xe71026);if(_0x5254b2[_0x0300('0x39')][_0x0300('0x41')]){_0x5583e9['where']=_['merge'](_0x5583e9[_0x0300('0x40')],{'$or':_[_0x0300('0x30')](_0xe71026,function(_0x499245){if(_0x499245[_0x0300('0x34')]!=='VIRTUAL'){var _0x5dea31={};_0x5dea31[_0x499245[_0x0300('0x37')]]={'$like':'%'+_0x5254b2[_0x0300('0x39')]['filter']+'%'};return _0x5dea31;}})});}_0x5583e9=_[_0x0300('0x42')]({},_0x5583e9,_0x5254b2[_0x0300('0x43')]);var _0x33f083={'where':_0x5583e9[_0x0300('0x40')]};return db[_0x0300('0x31')]['count'](_0x33f083)[_0x0300('0x2b')](function(_0x132da6){_0x3f892d[_0x0300('0x26')]=_0x132da6;if(_0x5254b2[_0x0300('0x39')][_0x0300('0x44')]){_0x5583e9[_0x0300('0x45')]=[{'all':!![]}];}return db[_0x0300('0x31')][_0x0300('0x46')](_0x5583e9);})[_0x0300('0x2b')](function(_0x52535c){_0x3f892d[_0x0300('0x47')]=_0x52535c;return _0x3f892d;})[_0x0300('0x2b')](respondWithFilteredResult(_0x353050,_0x5583e9))[_0x0300('0x48')](handleError(_0x353050,null));};exports['show']=function(_0x1cea6e,_0x14c4ca){var _0x4394eb={'raw':![],'where':{'id':_0x1cea6e[_0x0300('0x49')]['id']}},_0x188f2c={};_0x188f2c[_0x0300('0x36')]=_[_0x0300('0x4a')](db['VoiceQueueReport'][_0x0300('0x32')]);_0x188f2c[_0x0300('0x39')]=_[_0x0300('0x4a')](_0x1cea6e['query']);_0x188f2c[_0x0300('0x38')]=_[_0x0300('0x3b')](_0x188f2c[_0x0300('0x36')],_0x188f2c[_0x0300('0x39')]);_0x4394eb['attributes']=_['intersection'](_0x188f2c['model'],qs[_0x0300('0x3c')](_0x1cea6e[_0x0300('0x39')]['fields']));_0x4394eb[_0x0300('0x3a')]=_0x4394eb['attributes']['length']?_0x4394eb[_0x0300('0x3a')]:_0x188f2c['model'];if(_0x1cea6e['query']['includeAll']){_0x4394eb['include']=[{'all':!![]}];}_0x4394eb=_[_0x0300('0x42')]({},_0x4394eb,_0x1cea6e['options']);return db['VoiceQueueReport'][_0x0300('0x4b')](_0x4394eb)[_0x0300('0x2b')](handleEntityNotFound(_0x14c4ca,null))['then'](respondWithResult(_0x14c4ca,null))[_0x0300('0x48')](handleError(_0x14c4ca,null));};exports[_0x0300('0x4c')]=function(_0x3d20a6,_0x13aaf3){return db[_0x0300('0x31')][_0x0300('0x4c')](_0x3d20a6[_0x0300('0x4d')],{})[_0x0300('0x2b')](respondWithResult(_0x13aaf3,0xc9))[_0x0300('0x48')](handleError(_0x13aaf3,null));};exports[_0x0300('0x2a')]=function(_0x462331,_0x1c261c){if(_0x462331[_0x0300('0x4d')]['id']){delete _0x462331[_0x0300('0x4d')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x462331[_0x0300('0x49')]['id']}})[_0x0300('0x2b')](handleEntityNotFound(_0x1c261c,null))[_0x0300('0x2b')](saveUpdates(_0x462331['body'],null))[_0x0300('0x2b')](respondWithResult(_0x1c261c,null))[_0x0300('0x48')](handleError(_0x1c261c,null));};exports['destroy']=function(_0x319c9e,_0x422a68){return db[_0x0300('0x31')][_0x0300('0x4b')]({'where':{'id':_0x319c9e[_0x0300('0x49')]['id']}})['then'](handleEntityNotFound(_0x422a68,null))[_0x0300('0x2b')](removeEntity(_0x422a68,null))['catch'](handleError(_0x422a68,null));};exports[_0x0300('0x4e')]=function(_0x434acf,_0x42f442){return db[_0x0300('0x31')][_0x0300('0x4e')]()['then'](respondWithResult(_0x42f442,null))[_0x0300('0x48')](handleError(_0x42f442,null));};exports[_0x0300('0x4f')]=function(_0x61e46d,_0x915a89){var _0x3ba652={},_0x4504dd={},_0x3c3391={'count':0x0,'rows':[]};_0x4504dd['model']=_[_0x0300('0x4a')](db[_0x0300('0x31')][_0x0300('0x32')]);_0x4504dd['query']=_[_0x0300('0x4a')](_0x61e46d[_0x0300('0x39')]);_0x4504dd[_0x0300('0x38')]=_[_0x0300('0x3b')](_0x4504dd['model'],_0x4504dd[_0x0300('0x39')]);_0x3ba652[_0x0300('0x3a')]=_[_0x0300('0x3b')](_0x4504dd[_0x0300('0x36')],qs[_0x0300('0x3c')](_0x61e46d[_0x0300('0x39')]['fields']));_0x3ba652['attributes']=_0x3ba652['attributes'][_0x0300('0x3d')]?_0x3ba652['attributes']:_0x4504dd['model'];if(!_0x61e46d['query'][_0x0300('0x50')](_0x0300('0x51'))){_0x3ba652[_0x0300('0x25')]=qs['limit'](_0x61e46d[_0x0300('0x39')]['limit']);_0x3ba652[_0x0300('0x23')]=qs[_0x0300('0x23')](_0x61e46d[_0x0300('0x39')][_0x0300('0x23')]);}_0x3ba652['order']=qs[_0x0300('0x3f')](_0x61e46d[_0x0300('0x39')]['sort']);_0x3ba652[_0x0300('0x40')]=qs[_0x0300('0x38')](_['pick'](_0x61e46d[_0x0300('0x39')],_0x4504dd[_0x0300('0x38')]));if(_0x61e46d[_0x0300('0x39')][_0x0300('0x41')]){_0x3ba652[_0x0300('0x40')]=_['merge'](_0x3ba652[_0x0300('0x40')],{'$or':_[_0x0300('0x30')](_0x3ba652[_0x0300('0x3a')],function(_0x1ead0c){var _0x4ab45f={};_0x4ab45f[_0x1ead0c]={'$like':'%'+_0x61e46d['query'][_0x0300('0x41')]+'%'};return _0x4ab45f;})});}_0x3ba652=_['merge']({},_0x3ba652,_0x61e46d[_0x0300('0x43')]);var _0x1fb9d2={'where':_0x3ba652[_0x0300('0x40')]};return db[_0x0300('0x31')][_0x0300('0x26')](_0x1fb9d2)[_0x0300('0x2b')](function(_0x1a3d23){_0x3c3391[_0x0300('0x26')]=_0x1a3d23;if(_0x61e46d['query']['includeAll']){_0x3ba652[_0x0300('0x45')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x0300('0x46')](_0x3ba652);})[_0x0300('0x2b')](function(_0xff3b76){_0x3c3391[_0x0300('0x47')]=_0xff3b76;return _0x3c3391;})['then'](respondWithFilteredResult(_0x915a89,_0x3ba652,_0x0300('0x4f')))[_0x0300('0x48')](handleError(_0x915a89,null,_0x0300('0x4f')));}; \ No newline at end of file +var _0x2b8b=['rows','catch','show','params','merge','find','create','body','describe','getVoiceQueuesReport','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','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/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','undefined','limit','offset','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','VoiceQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll'];(function(_0x438381,_0x3421cb){var _0x31a983=function(_0xb806cf){while(--_0xb806cf){_0x438381['push'](_0x438381['shift']());}};_0x31a983(++_0x3421cb);}(_0x2b8b,0x1a9));var _0xb2b8=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x2b8b[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb2b8('0x0'));var zipdir=require(_0xb2b8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb2b8('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb2b8('0x3'));var util=require(_0xb2b8('0x4'));var path=require(_0xb2b8('0x5'));var sox=require(_0xb2b8('0x6'));var csv=require(_0xb2b8('0x7'));var ejs=require(_0xb2b8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb2b8('0x9'));var squel=require(_0xb2b8('0xa'));var crypto=require(_0xb2b8('0xb'));var jsforce=require(_0xb2b8('0xc'));var deskjs=require(_0xb2b8('0xd'));var toCsv=require(_0xb2b8('0x7'));var querystring=require(_0xb2b8('0xe'));var Papa=require(_0xb2b8('0xf'));var Redis=require('ioredis');var authService=require(_0xb2b8('0x10'));var qs=require(_0xb2b8('0x11'));var as=require(_0xb2b8('0x12'));var hardwareService=require(_0xb2b8('0x13'));var logger=require(_0xb2b8('0x14'))(_0xb2b8('0x15'));var utils=require(_0xb2b8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb2b8('0x17'));var db=require(_0xb2b8('0x18'))['db'];config[_0xb2b8('0x19')]=_[_0xb2b8('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb2b8('0x1b'))(new Redis(config[_0xb2b8('0x19')]));require(_0xb2b8('0x1c'))[_0xb2b8('0x1d')](socket);function respondWithStatusCode(_0x378cf4,_0x26e94a){_0x26e94a=_0x26e94a||0xcc;return function(_0x4b26e8){if(_0x4b26e8){return _0x378cf4[_0xb2b8('0x1e')](_0x26e94a);}return _0x378cf4[_0xb2b8('0x1f')](_0x26e94a)[_0xb2b8('0x20')]();};}function respondWithResult(_0x3d8676,_0x4f3e79){_0x4f3e79=_0x4f3e79||0xc8;return function(_0xfe69d7){if(_0xfe69d7){return _0x3d8676[_0xb2b8('0x1f')](_0x4f3e79)['json'](_0xfe69d7);}};}function respondWithFilteredResult(_0x55ac5a,_0x2f463f){return function(_0xdefe67){if(_0xdefe67){var _0x5b5e1a=typeof _0x2f463f['offset']===_0xb2b8('0x21')&&typeof _0x2f463f[_0xb2b8('0x22')]===_0xb2b8('0x21');var _0x1988c8=_0xdefe67['count'];var _0x4508e7=_0x5b5e1a?0x0:_0x2f463f[_0xb2b8('0x23')];var _0x568b6a=_0x5b5e1a?_0xdefe67[_0xb2b8('0x24')]:_0x2f463f['offset']+_0x2f463f[_0xb2b8('0x22')];var _0x558a95;if(_0x568b6a>=_0x1988c8){_0x568b6a=_0x1988c8;_0x558a95=0xc8;}else{_0x558a95=0xce;}_0x55ac5a[_0xb2b8('0x1f')](_0x558a95);return _0x55ac5a['set'](_0xb2b8('0x25'),_0x4508e7+'-'+_0x568b6a+'/'+_0x1988c8)['json'](_0xdefe67);}return null;};}function patchUpdates(_0x4f308b){return function(_0x2145f5){try{jsonpatch[_0xb2b8('0x26')](_0x2145f5,_0x4f308b,!![]);}catch(_0x265d08){return BPromise[_0xb2b8('0x27')](_0x265d08);}return _0x2145f5[_0xb2b8('0x28')]();};}function saveUpdates(_0x3270e4,_0x15a029){return function(_0x640566){if(_0x640566){return _0x640566[_0xb2b8('0x29')](_0x3270e4)[_0xb2b8('0x2a')](function(_0x276a7f){return _0x276a7f;});}return null;};}function removeEntity(_0x117002,_0x588ce4){return function(_0x3ce54c){if(_0x3ce54c){return _0x3ce54c[_0xb2b8('0x2b')]()[_0xb2b8('0x2a')](function(){_0x117002['status'](0xcc)[_0xb2b8('0x20')]();});}};}function handleEntityNotFound(_0x43e63e,_0x207dff){return function(_0x57a4a3){if(!_0x57a4a3){_0x43e63e[_0xb2b8('0x1e')](0x194);}return _0x57a4a3;};}function handleError(_0x560b05,_0x3cfbde){_0x3cfbde=_0x3cfbde||0x1f4;return function(_0xa2f35c){logger[_0xb2b8('0x2c')](_0xa2f35c[_0xb2b8('0x2d')]);if(_0xa2f35c[_0xb2b8('0x2e')]){delete _0xa2f35c[_0xb2b8('0x2e')];}_0x560b05[_0xb2b8('0x1f')](_0x3cfbde)[_0xb2b8('0x2f')](_0xa2f35c);};}exports['index']=function(_0x593b47,_0x83ce31){var _0xb02602={},_0x169000={},_0x2df5d2={'count':0x0,'rows':[]};var _0x5df762=_[_0xb2b8('0x30')](db[_0xb2b8('0x31')][_0xb2b8('0x32')],function(_0x28c657){return{'name':_0x28c657[_0xb2b8('0x33')],'type':_0x28c657[_0xb2b8('0x34')]['key']};});_0x169000[_0xb2b8('0x35')]=_[_0xb2b8('0x30')](_0x5df762,_0xb2b8('0x2e'));_0x169000[_0xb2b8('0x36')]=_[_0xb2b8('0x37')](_0x593b47[_0xb2b8('0x36')]);_0x169000[_0xb2b8('0x38')]=_[_0xb2b8('0x39')](_0x169000['model'],_0x169000['query']);_0xb02602['attributes']=_[_0xb2b8('0x39')](_0x169000['model'],qs['fields'](_0x593b47[_0xb2b8('0x36')][_0xb2b8('0x3a')]));_0xb02602[_0xb2b8('0x3b')]=_0xb02602['attributes'][_0xb2b8('0x3c')]?_0xb02602[_0xb2b8('0x3b')]:_0x169000[_0xb2b8('0x35')];if(!_0x593b47[_0xb2b8('0x36')][_0xb2b8('0x3d')](_0xb2b8('0x3e'))){_0xb02602[_0xb2b8('0x22')]=qs[_0xb2b8('0x22')](_0x593b47[_0xb2b8('0x36')][_0xb2b8('0x22')]);_0xb02602[_0xb2b8('0x23')]=qs[_0xb2b8('0x23')](_0x593b47['query']['offset']);}_0xb02602[_0xb2b8('0x3f')]=qs[_0xb2b8('0x40')](_0x593b47[_0xb2b8('0x36')][_0xb2b8('0x40')]);_0xb02602['where']=qs['filters'](_[_0xb2b8('0x41')](_0x593b47['query'],_0x169000[_0xb2b8('0x38')]),_0x5df762);if(_0x593b47[_0xb2b8('0x36')][_0xb2b8('0x42')]){_0xb02602[_0xb2b8('0x43')]=_['merge'](_0xb02602[_0xb2b8('0x43')],{'$or':_[_0xb2b8('0x30')](_0x5df762,function(_0x5f507a){if(_0x5f507a[_0xb2b8('0x34')]!==_0xb2b8('0x44')){var _0x5d5017={};_0x5d5017[_0x5f507a[_0xb2b8('0x2e')]]={'$like':'%'+_0x593b47[_0xb2b8('0x36')][_0xb2b8('0x42')]+'%'};return _0x5d5017;}})});}_0xb02602=_['merge']({},_0xb02602,_0x593b47[_0xb2b8('0x45')]);var _0x3aa4e0={'where':_0xb02602[_0xb2b8('0x43')]};return db[_0xb2b8('0x31')][_0xb2b8('0x24')](_0x3aa4e0)[_0xb2b8('0x2a')](function(_0x43801e){_0x2df5d2[_0xb2b8('0x24')]=_0x43801e;if(_0x593b47[_0xb2b8('0x36')][_0xb2b8('0x46')]){_0xb02602[_0xb2b8('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xb2b8('0x48')](_0xb02602);})[_0xb2b8('0x2a')](function(_0xb137bd){_0x2df5d2[_0xb2b8('0x49')]=_0xb137bd;return _0x2df5d2;})[_0xb2b8('0x2a')](respondWithFilteredResult(_0x83ce31,_0xb02602))[_0xb2b8('0x4a')](handleError(_0x83ce31,null));};exports[_0xb2b8('0x4b')]=function(_0x58fed6,_0x5c9c9e){var _0x3e72f1={'raw':![],'where':{'id':_0x58fed6[_0xb2b8('0x4c')]['id']}},_0x488074={};_0x488074[_0xb2b8('0x35')]=_['keys'](db[_0xb2b8('0x31')]['rawAttributes']);_0x488074[_0xb2b8('0x36')]=_['keys'](_0x58fed6[_0xb2b8('0x36')]);_0x488074[_0xb2b8('0x38')]=_[_0xb2b8('0x39')](_0x488074[_0xb2b8('0x35')],_0x488074[_0xb2b8('0x36')]);_0x3e72f1[_0xb2b8('0x3b')]=_[_0xb2b8('0x39')](_0x488074[_0xb2b8('0x35')],qs[_0xb2b8('0x3a')](_0x58fed6[_0xb2b8('0x36')][_0xb2b8('0x3a')]));_0x3e72f1[_0xb2b8('0x3b')]=_0x3e72f1[_0xb2b8('0x3b')]['length']?_0x3e72f1[_0xb2b8('0x3b')]:_0x488074['model'];if(_0x58fed6[_0xb2b8('0x36')][_0xb2b8('0x46')]){_0x3e72f1[_0xb2b8('0x47')]=[{'all':!![]}];}_0x3e72f1=_[_0xb2b8('0x4d')]({},_0x3e72f1,_0x58fed6[_0xb2b8('0x45')]);return db[_0xb2b8('0x31')][_0xb2b8('0x4e')](_0x3e72f1)[_0xb2b8('0x2a')](handleEntityNotFound(_0x5c9c9e,null))['then'](respondWithResult(_0x5c9c9e,null))[_0xb2b8('0x4a')](handleError(_0x5c9c9e,null));};exports[_0xb2b8('0x4f')]=function(_0x6e0afd,_0x44fab1){return db[_0xb2b8('0x31')][_0xb2b8('0x4f')](_0x6e0afd[_0xb2b8('0x50')],{})[_0xb2b8('0x2a')](respondWithResult(_0x44fab1,0xc9))['catch'](handleError(_0x44fab1,null));};exports['update']=function(_0x297656,_0x1784aa){if(_0x297656[_0xb2b8('0x50')]['id']){delete _0x297656[_0xb2b8('0x50')]['id'];}return db['VoiceQueueReport'][_0xb2b8('0x4e')]({'where':{'id':_0x297656['params']['id']}})[_0xb2b8('0x2a')](handleEntityNotFound(_0x1784aa,null))[_0xb2b8('0x2a')](saveUpdates(_0x297656[_0xb2b8('0x50')],null))[_0xb2b8('0x2a')](respondWithResult(_0x1784aa,null))[_0xb2b8('0x4a')](handleError(_0x1784aa,null));};exports['destroy']=function(_0x3710a5,_0x3b10e0){return db[_0xb2b8('0x31')][_0xb2b8('0x4e')]({'where':{'id':_0x3710a5[_0xb2b8('0x4c')]['id']}})[_0xb2b8('0x2a')](handleEntityNotFound(_0x3b10e0,null))[_0xb2b8('0x2a')](removeEntity(_0x3b10e0,null))[_0xb2b8('0x4a')](handleError(_0x3b10e0,null));};exports['describe']=function(_0x16d020,_0x35890d){return db[_0xb2b8('0x31')][_0xb2b8('0x51')]()['then'](respondWithResult(_0x35890d,null))[_0xb2b8('0x4a')](handleError(_0x35890d,null));};exports[_0xb2b8('0x52')]=function(_0x203bf7,_0x30286f){var _0x39ad18={},_0x3e86c6={},_0x47d5bd={'count':0x0,'rows':[]};_0x3e86c6[_0xb2b8('0x35')]=_[_0xb2b8('0x37')](db[_0xb2b8('0x31')][_0xb2b8('0x32')]);_0x3e86c6[_0xb2b8('0x36')]=_[_0xb2b8('0x37')](_0x203bf7['query']);_0x3e86c6[_0xb2b8('0x38')]=_[_0xb2b8('0x39')](_0x3e86c6[_0xb2b8('0x35')],_0x3e86c6['query']);_0x39ad18['attributes']=_[_0xb2b8('0x39')](_0x3e86c6[_0xb2b8('0x35')],qs[_0xb2b8('0x3a')](_0x203bf7['query'][_0xb2b8('0x3a')]));_0x39ad18['attributes']=_0x39ad18['attributes'][_0xb2b8('0x3c')]?_0x39ad18[_0xb2b8('0x3b')]:_0x3e86c6[_0xb2b8('0x35')];if(!_0x203bf7[_0xb2b8('0x36')][_0xb2b8('0x3d')]('nolimit')){_0x39ad18[_0xb2b8('0x22')]=qs[_0xb2b8('0x22')](_0x203bf7[_0xb2b8('0x36')][_0xb2b8('0x22')]);_0x39ad18[_0xb2b8('0x23')]=qs[_0xb2b8('0x23')](_0x203bf7['query'][_0xb2b8('0x23')]);}_0x39ad18[_0xb2b8('0x3f')]=qs[_0xb2b8('0x40')](_0x203bf7['query']['sort']);_0x39ad18[_0xb2b8('0x43')]=qs['filters'](_[_0xb2b8('0x41')](_0x203bf7[_0xb2b8('0x36')],_0x3e86c6[_0xb2b8('0x38')]));if(_0x203bf7[_0xb2b8('0x36')][_0xb2b8('0x42')]){_0x39ad18[_0xb2b8('0x43')]=_['merge'](_0x39ad18[_0xb2b8('0x43')],{'$or':_[_0xb2b8('0x30')](_0x39ad18[_0xb2b8('0x3b')],function(_0x39cf90){var _0x274013={};_0x274013[_0x39cf90]={'$like':'%'+_0x203bf7[_0xb2b8('0x36')][_0xb2b8('0x42')]+'%'};return _0x274013;})});}_0x39ad18=_[_0xb2b8('0x4d')]({},_0x39ad18,_0x203bf7[_0xb2b8('0x45')]);var _0x4e8333={'where':_0x39ad18['where']};return db[_0xb2b8('0x31')][_0xb2b8('0x24')](_0x4e8333)[_0xb2b8('0x2a')](function(_0x5e7da1){_0x47d5bd[_0xb2b8('0x24')]=_0x5e7da1;if(_0x203bf7[_0xb2b8('0x36')][_0xb2b8('0x46')]){_0x39ad18[_0xb2b8('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xb2b8('0x48')](_0x39ad18);})[_0xb2b8('0x2a')](function(_0x40b2cc){_0x47d5bd[_0xb2b8('0x49')]=_0x40b2cc;return _0x47d5bd;})[_0xb2b8('0x2a')](respondWithFilteredResult(_0x30286f,_0x39ad18,_0xb2b8('0x52')))[_0xb2b8('0x4a')](handleError(_0x30286f,null,_0xb2b8('0x52')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index fa07270..51b6771 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 _0x73f6=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x1c3af2,_0x4578de){var _0xec93e=function(_0x37991a){while(--_0x37991a){_0x1c3af2['push'](_0x1c3af2['shift']());}};_0xec93e(++_0x4578de);}(_0x73f6,0x96));var _0x673f=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x73f6[_0x2064e5];return _0x21a233;};'use strict';var EventEmitter=require(_0x673f('0x0'));var VoiceQueueReport=require(_0x673f('0x1'))['db'][_0x673f('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x673f('0x3')](0x0);var events={'afterCreate':_0x673f('0x4'),'afterUpdate':_0x673f('0x5'),'afterDestroy':_0x673f('0x6')};function emitEvent(_0x2ced7d){return function(_0x4961ed,_0x2f768f,_0x34647f){VoiceQueueReportEvents[_0x673f('0x7')](_0x2ced7d+':'+_0x4961ed['id'],_0x4961ed);VoiceQueueReportEvents[_0x673f('0x7')](_0x2ced7d,_0x4961ed);_0x34647f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x673f('0x8')](e,emitEvent(event));}}module[_0x673f('0x9')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x1ff1=['VoiceQueueReport','setMaxListeners','save','remove','emit','hook','exports','events'];(function(_0x412e35,_0x5af5dc){var _0x2e2a61=function(_0xa14b52){while(--_0xa14b52){_0x412e35['push'](_0x412e35['shift']());}};_0x2e2a61(++_0x5af5dc);}(_0x1ff1,0x1bf));var _0x11ff=function(_0xa0bd69,_0x5cca53){_0xa0bd69=_0xa0bd69-0x0;var _0x7f5ce2=_0x1ff1[_0xa0bd69];return _0x7f5ce2;};'use strict';var EventEmitter=require(_0x11ff('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0x11ff('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x11ff('0x2')](0x0);var events={'afterCreate':_0x11ff('0x3'),'afterUpdate':'update','afterDestroy':_0x11ff('0x4')};function emitEvent(_0x583f30){return function(_0x1928db,_0x43018b,_0x405d14){VoiceQueueReportEvents[_0x11ff('0x5')](_0x583f30+':'+_0x1928db['id'],_0x1928db);VoiceQueueReportEvents[_0x11ff('0x5')](_0x583f30,_0x1928db);_0x405d14(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x11ff('0x6')](e,emitEvent(event));}}module[_0x11ff('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 2728729..0375cdd 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 _0x2046=['path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','moment','bluebird','request-promise'];(function(_0x30d87a,_0xf3a07f){var _0x48f64b=function(_0x2078b7){while(--_0x2078b7){_0x30d87a['push'](_0x30d87a['shift']());}};_0x48f64b(++_0xf3a07f);}(_0x2046,0x1c4));var _0x6204=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2046[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6204('0x0'));var BPromise=require(_0x6204('0x1'));var rp=require(_0x6204('0x2'));var fs=require('fs');var path=require(_0x6204('0x3'));var rimraf=require(_0x6204('0x4'));var config=require(_0x6204('0x5'));var attributes=require(_0x6204('0x6'));module[_0x6204('0x7')]=function(_0x363766,_0x1c32a0){return _0x363766[_0x6204('0x8')](_0x6204('0x9'),attributes,{'tableName':_0x6204('0xa'),'paranoid':![],'indexes':[{'fields':[_0x6204('0xb')]},{'fields':[_0x6204('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xee12=['exports','VoiceQueueReport','uniqueid','calleridnum','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueueReport.attributes'];(function(_0x1b488b,_0x4a32ba){var _0x527cb7=function(_0xfddcf4){while(--_0xfddcf4){_0x1b488b['push'](_0x1b488b['shift']());}};_0x527cb7(++_0x4a32ba);}(_0xee12,0x86));var _0x2ee1=function(_0x3a9219,_0x38382b){_0x3a9219=_0x3a9219-0x0;var _0x235d75=_0xee12[_0x3a9219];return _0x235d75;};'use strict';var _=require(_0x2ee1('0x0'));var util=require('util');var logger=require(_0x2ee1('0x1'))(_0x2ee1('0x2'));var moment=require(_0x2ee1('0x3'));var BPromise=require(_0x2ee1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ee1('0x5'));var rimraf=require(_0x2ee1('0x6'));var config=require(_0x2ee1('0x7'));var attributes=require(_0x2ee1('0x8'));module[_0x2ee1('0x9')]=function(_0x3f88d0,_0x50b500){return _0x3f88d0['define'](_0x2ee1('0xa'),attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x2ee1('0xb')]},{'fields':[_0x2ee1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index edab2a0..0101947 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 _0x924f=['GetVoiceQueueReport','VoiceQueueReport','findAll','options','limit','include','map','model','attributes','then','info','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request\x20sent','debug','stringify','error','message','VoiceQueueReport,\x20%s,\x20%s','result','catch'];(function(_0x4f83ca,_0x46f67a){var _0x1fbac3=function(_0x19e401){while(--_0x19e401){_0x4f83ca['push'](_0x4f83ca['shift']());}};_0x1fbac3(++_0x46f67a);}(_0x924f,0xba));var _0xf924=function(_0x508c10,_0x5a15f0){_0x508c10=_0x508c10-0x0;var _0x3108b5=_0x924f[_0x508c10];return _0x3108b5;};'use strict';var _=require(_0xf924('0x0'));var util=require(_0xf924('0x1'));var moment=require(_0xf924('0x2'));var BPromise=require(_0xf924('0x3'));var rs=require(_0xf924('0x4'));var fs=require('fs');var Redis=require(_0xf924('0x5'));var db=require(_0xf924('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf924('0x7'));var config=require(_0xf924('0x8'));var jayson=require(_0xf924('0x9'));var client=jayson['client'][_0xf924('0xa')]({'port':0x232a});config[_0xf924('0xb')]=_[_0xf924('0xc')](config[_0xf924('0xb')],{'host':_0xf924('0xd'),'port':0x18eb});var socket=require(_0xf924('0xe'))(new Redis(config[_0xf924('0xb')]));require('./voiceQueueReport.socket')[_0xf924('0xf')](socket);function respondWithRpcPromise(_0x3db9f1,_0x54a358,_0x58c9a4){return new BPromise(function(_0x1c0fef,_0x25af13){return client['request'](_0x3db9f1,_0x58c9a4)['then'](function(_0x3c2e63){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x54a358,_0xf924('0x10'));logger[_0xf924('0x11')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x54a358,_0xf924('0x10'),JSON[_0xf924('0x12')](_0x3c2e63));if(_0x3c2e63['error']){if(_0x3c2e63[_0xf924('0x13')]['code']===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x54a358,_0x3c2e63[_0xf924('0x13')]['message']);return _0x25af13(_0x3c2e63[_0xf924('0x13')][_0xf924('0x14')]);}logger[_0xf924('0x13')](_0xf924('0x15'),_0x54a358,_0x3c2e63['error'][_0xf924('0x14')]);return _0x1c0fef(_0x3c2e63[_0xf924('0x13')][_0xf924('0x14')]);}else{logger['info'](_0xf924('0x15'),_0x54a358,_0xf924('0x10'));_0x1c0fef(_0x3c2e63[_0xf924('0x16')][_0xf924('0x14')]);}})[_0xf924('0x17')](function(_0x3b0261){logger['error'](_0xf924('0x15'),_0x54a358,_0x3b0261);_0x25af13(_0x3b0261);});});}exports[_0xf924('0x18')]=function(_0x381b55){var _0x918282=this;return new Promise(function(_0x38f46c,_0x16e0cb){return db[_0xf924('0x19')][_0xf924('0x1a')]({'raw':_0x381b55[_0xf924('0x1b')]?_0x381b55[_0xf924('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x381b55[_0xf924('0x1b')]?_0x381b55[_0xf924('0x1b')]['where']||null:null,'attributes':_0x381b55[_0xf924('0x1b')]?_0x381b55[_0xf924('0x1b')]['attributes']||null:null,'limit':_0x381b55[_0xf924('0x1b')]?_0x381b55[_0xf924('0x1b')][_0xf924('0x1c')]||null:null,'include':_0x381b55[_0xf924('0x1b')]?_0x381b55[_0xf924('0x1b')][_0xf924('0x1d')]?_[_0xf924('0x1e')](_0x381b55['options'][_0xf924('0x1d')],function(_0x4171aa){return{'model':db[_0x4171aa[_0xf924('0x1f')]],'as':_0x4171aa['as'],'attributes':_0x4171aa[_0xf924('0x20')],'include':_0x4171aa[_0xf924('0x1d')]?_['map'](_0x4171aa[_0xf924('0x1d')],function(_0x172396){return{'model':db[_0x172396['model']],'as':_0x172396['as'],'attributes':_0x172396[_0xf924('0x20')],'include':_0x172396[_0xf924('0x1d')]?_[_0xf924('0x1e')](_0x172396[_0xf924('0x1d')],function(_0x5203af){return{'model':db[_0x5203af['model']],'as':_0x5203af['as'],'attributes':_0x5203af[_0xf924('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf924('0x21')](function(_0x59a04f){logger[_0xf924('0x22')]('GetVoiceQueueReport',_0x381b55);logger['debug'](_0xf924('0x18'),_0x381b55,JSON[_0xf924('0x12')](_0x59a04f));_0x38f46c(_0x59a04f);})[_0xf924('0x17')](function(_0x195f31){logger[_0xf924('0x13')]('GetVoiceQueueReport',_0x195f31[_0xf924('0x14')],_0x381b55);_0x16e0cb(_0x918282[_0xf924('0x13')](0x1f4,_0x195f31['message']));});});};exports[_0xf924('0x23')]=function(_0x69132){var _0x15e557=this;return new Promise(function(_0x2f6c86,_0x365314){return db[_0xf924('0x19')][_0xf924('0x24')](_0x69132[_0xf924('0x25')],{'raw':_0x69132[_0xf924('0x1b')]?_0x69132['options']['raw']===undefined?!![]:![]:!![]})[_0xf924('0x21')](function(_0xa5d93){logger[_0xf924('0x22')](_0xf924('0x23'),_0x69132);logger['debug']('CreateVoiceQueueReport',_0x69132,JSON[_0xf924('0x12')](_0xa5d93));_0x2f6c86(_0xa5d93);})[_0xf924('0x17')](function(_0x33a3f9){logger[_0xf924('0x13')]('CreateVoiceQueueReport',_0x33a3f9[_0xf924('0x14')],_0x69132);_0x365314(_0x15e557['error'](0x1f4,_0x33a3f9[_0xf924('0x14')]));});});};exports[_0xf924('0x26')]=function(_0x3c1928){var _0x31b948=this;return new Promise(function(_0x123ac8,_0x3c223d){return db[_0xf924('0x19')][_0xf924('0x27')](_0x3c1928['body'],{'raw':_0x3c1928['options']?_0x3c1928[_0xf924('0x1b')][_0xf924('0x28')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c1928['options']?_0x3c1928[_0xf924('0x1b')][_0xf924('0x29')]||null:null,'attributes':_0x3c1928[_0xf924('0x1b')]?_0x3c1928[_0xf924('0x1b')][_0xf924('0x20')]||null:null,'limit':_0x3c1928[_0xf924('0x1b')]?_0x3c1928[_0xf924('0x1b')][_0xf924('0x1c')]||null:null})[_0xf924('0x21')](function(_0x2b985b){logger[_0xf924('0x22')](_0xf924('0x26'),_0x3c1928);logger['debug'](_0xf924('0x26'),_0x3c1928,JSON[_0xf924('0x12')](_0x2b985b));_0x123ac8(_0x2b985b);})['catch'](function(_0x5f3f8e){logger[_0xf924('0x13')](_0xf924('0x26'),_0x5f3f8e['message'],_0x3c1928);_0x3c223d(_0x31b948[_0xf924('0x13')](0x1f4,_0x5f3f8e['message']));});});}; \ No newline at end of file +var _0xb74f=['options','raw','where','attributes','limit','include','map','model','then','GetVoiceQueueReport','debug','catch','CreateVoiceQueueReport','VoiceQueueReport','create','update','UpdateVoiceQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','./voiceQueueReport.socket','register','info','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','findAll'];(function(_0x4b12c9,_0x55d709){var _0x39a065=function(_0x1c379b){while(--_0x1c379b){_0x4b12c9['push'](_0x4b12c9['shift']());}};_0x39a065(++_0x55d709);}(_0xb74f,0x65));var _0xfb74=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb74f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xfb74('0x0'));var util=require('util');var moment=require(_0xfb74('0x1'));var BPromise=require(_0xfb74('0x2'));var rs=require(_0xfb74('0x3'));var fs=require('fs');var Redis=require(_0xfb74('0x4'));var db=require(_0xfb74('0x5'))['db'];var utils=require(_0xfb74('0x6'));var logger=require(_0xfb74('0x7'))(_0xfb74('0x8'));var config=require('../../config/environment');var jayson=require(_0xfb74('0x9'));var client=jayson[_0xfb74('0xa')]['http']({'port':0x232a});config['redis']=_[_0xfb74('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb74('0xc')]));require(_0xfb74('0xd'))[_0xfb74('0xe')](socket);function respondWithRpcPromise(_0x3c8dcb,_0x44f5a9,_0x835bdb){return new BPromise(function(_0x6f28c2,_0x2a8d61){return client['request'](_0x3c8dcb,_0x835bdb)['then'](function(_0x34838c){logger[_0xfb74('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x44f5a9,'request\x20sent');logger['debug'](_0xfb74('0x10'),_0x44f5a9,_0xfb74('0x11'),JSON[_0xfb74('0x12')](_0x34838c));if(_0x34838c[_0xfb74('0x13')]){if(_0x34838c[_0xfb74('0x13')][_0xfb74('0x14')]===0x1f4){logger[_0xfb74('0x13')](_0xfb74('0x15'),_0x44f5a9,_0x34838c[_0xfb74('0x13')][_0xfb74('0x16')]);return _0x2a8d61(_0x34838c[_0xfb74('0x13')][_0xfb74('0x16')]);}logger[_0xfb74('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x44f5a9,_0x34838c['error']['message']);return _0x6f28c2(_0x34838c[_0xfb74('0x13')][_0xfb74('0x16')]);}else{logger[_0xfb74('0xf')](_0xfb74('0x15'),_0x44f5a9,_0xfb74('0x11'));_0x6f28c2(_0x34838c[_0xfb74('0x17')][_0xfb74('0x16')]);}})['catch'](function(_0xe1d29d){logger['error'](_0xfb74('0x15'),_0x44f5a9,_0xe1d29d);_0x2a8d61(_0xe1d29d);});});}exports['GetVoiceQueueReport']=function(_0xfe449d){var _0x5ab70a=this;return new Promise(function(_0x394d75,_0x9778a0){return db['VoiceQueueReport'][_0xfb74('0x18')]({'raw':_0xfe449d[_0xfb74('0x19')]?_0xfe449d[_0xfb74('0x19')][_0xfb74('0x1a')]===undefined?!![]:![]:!![],'where':_0xfe449d[_0xfb74('0x19')]?_0xfe449d[_0xfb74('0x19')][_0xfb74('0x1b')]||null:null,'attributes':_0xfe449d[_0xfb74('0x19')]?_0xfe449d['options'][_0xfb74('0x1c')]||null:null,'limit':_0xfe449d[_0xfb74('0x19')]?_0xfe449d[_0xfb74('0x19')][_0xfb74('0x1d')]||null:null,'include':_0xfe449d[_0xfb74('0x19')]?_0xfe449d[_0xfb74('0x19')][_0xfb74('0x1e')]?_[_0xfb74('0x1f')](_0xfe449d['options'][_0xfb74('0x1e')],function(_0x3ba3b5){return{'model':db[_0x3ba3b5[_0xfb74('0x20')]],'as':_0x3ba3b5['as'],'attributes':_0x3ba3b5[_0xfb74('0x1c')],'include':_0x3ba3b5[_0xfb74('0x1e')]?_['map'](_0x3ba3b5['include'],function(_0x5c1383){return{'model':db[_0x5c1383[_0xfb74('0x20')]],'as':_0x5c1383['as'],'attributes':_0x5c1383[_0xfb74('0x1c')],'include':_0x5c1383['include']?_[_0xfb74('0x1f')](_0x5c1383[_0xfb74('0x1e')],function(_0x498ecf){return{'model':db[_0x498ecf[_0xfb74('0x20')]],'as':_0x498ecf['as'],'attributes':_0x498ecf[_0xfb74('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfb74('0x21')](function(_0x5bc1da){logger[_0xfb74('0xf')](_0xfb74('0x22'),_0xfe449d);logger[_0xfb74('0x23')](_0xfb74('0x22'),_0xfe449d,JSON[_0xfb74('0x12')](_0x5bc1da));_0x394d75(_0x5bc1da);})[_0xfb74('0x24')](function(_0xaa53f3){logger[_0xfb74('0x13')]('GetVoiceQueueReport',_0xaa53f3[_0xfb74('0x16')],_0xfe449d);_0x9778a0(_0x5ab70a[_0xfb74('0x13')](0x1f4,_0xaa53f3[_0xfb74('0x16')]));});});};exports[_0xfb74('0x25')]=function(_0x24207c){var _0x11298b=this;return new Promise(function(_0x143550,_0xc428e0){return db[_0xfb74('0x26')][_0xfb74('0x27')](_0x24207c['body'],{'raw':_0x24207c['options']?_0x24207c[_0xfb74('0x19')][_0xfb74('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x423a91){logger[_0xfb74('0xf')](_0xfb74('0x25'),_0x24207c);logger[_0xfb74('0x23')](_0xfb74('0x25'),_0x24207c,JSON[_0xfb74('0x12')](_0x423a91));_0x143550(_0x423a91);})[_0xfb74('0x24')](function(_0x2102a0){logger[_0xfb74('0x13')]('CreateVoiceQueueReport',_0x2102a0[_0xfb74('0x16')],_0x24207c);_0xc428e0(_0x11298b[_0xfb74('0x13')](0x1f4,_0x2102a0[_0xfb74('0x16')]));});});};exports['UpdateVoiceQueueReport']=function(_0x42214d){var _0x57d6dd=this;return new Promise(function(_0x3c9c12,_0x5666b8){return db[_0xfb74('0x26')][_0xfb74('0x28')](_0x42214d['body'],{'raw':_0x42214d[_0xfb74('0x19')]?_0x42214d[_0xfb74('0x19')][_0xfb74('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42214d['options']?_0x42214d[_0xfb74('0x19')][_0xfb74('0x1b')]||null:null,'attributes':_0x42214d['options']?_0x42214d[_0xfb74('0x19')]['attributes']||null:null,'limit':_0x42214d[_0xfb74('0x19')]?_0x42214d[_0xfb74('0x19')][_0xfb74('0x1d')]||null:null})['then'](function(_0x2d2fbd){logger['info']('UpdateVoiceQueueReport',_0x42214d);logger[_0xfb74('0x23')](_0xfb74('0x29'),_0x42214d,JSON['stringify'](_0x2d2fbd));_0x3c9c12(_0x2d2fbd);})['catch'](function(_0x20e605){logger[_0xfb74('0x13')](_0xfb74('0x29'),_0x20e605[_0xfb74('0x16')],_0x42214d);_0x5666b8(_0x57d6dd['error'](0x1f4,_0x20e605['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 7fc3660..eebf9e1 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 _0xc534=['removeListener','register','length','save','remove'];(function(_0x29ceb8,_0x29d7dc){var _0x3aef62=function(_0x4aed26){while(--_0x4aed26){_0x29ceb8['push'](_0x29ceb8['shift']());}};_0x3aef62(++_0x29d7dc);}(_0xc534,0x1ca));var _0x4c53=function(_0xddfe05,_0x57b987){_0xddfe05=_0xddfe05-0x0;var _0x42b95e=_0xc534[_0xddfe05];return _0x42b95e;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x4c53('0x0'),_0x4c53('0x1'),'update'];function createListener(_0x3426ed,_0x1fb9d7){return function(_0x1bb0cb){_0x1fb9d7['emit'](_0x3426ed,_0x1bb0cb);};}function removeListener(_0xd2f9d9,_0x50f2d0){return function(){VoiceQueueReportEvents[_0x4c53('0x2')](_0xd2f9d9,_0x50f2d0);};}exports[_0x4c53('0x3')]=function(_0x424af0){for(var _0x4432cd=0x0,_0x32d211=events[_0x4c53('0x4')];_0x4432cd<_0x32d211;_0x4432cd++){var _0x1ebbbf=events[_0x4432cd];var _0x46eccd=createListener('voiceQueueReport:'+_0x1ebbbf,_0x424af0);VoiceQueueReportEvents['on'](_0x1ebbbf,_0x46eccd);}}; \ No newline at end of file +var _0xd6bb=['update','removeListener','length','voiceQueueReport:','./voiceQueueReport.events','remove'];(function(_0x2ab365,_0xa3812e){var _0x49fef3=function(_0x29b883){while(--_0x29b883){_0x2ab365['push'](_0x2ab365['shift']());}};_0x49fef3(++_0xa3812e);}(_0xd6bb,0x1cc));var _0xbd6b=function(_0xaf29da,_0x117f5a){_0xaf29da=_0xaf29da-0x0;var _0x295c51=_0xd6bb[_0xaf29da];return _0x295c51;};'use strict';var VoiceQueueReportEvents=require(_0xbd6b('0x0'));var events=['save',_0xbd6b('0x1'),_0xbd6b('0x2')];function createListener(_0x3c0eb7,_0x29f456){return function(_0x426b33){_0x29f456['emit'](_0x3c0eb7,_0x426b33);};}function removeListener(_0x43b80d,_0x1785c7){return function(){VoiceQueueReportEvents[_0xbd6b('0x3')](_0x43b80d,_0x1785c7);};}exports['register']=function(_0x256a94){for(var _0x15d0eb=0x0,_0xc309ad=events[_0xbd6b('0x4')];_0x15d0eb<_0xc309ad;_0x15d0eb++){var _0x31cae6=events[_0x15d0eb];var _0x315761=createListener(_0xbd6b('0x5')+_0x31cae6,_0x256a94);VoiceQueueReportEvents['on'](_0x31cae6,_0x315761);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index e7d1b4b..5a283be 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 _0x3e22=['get','/:id','isAuthenticated','post','create','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller'];(function(_0x5e9eb9,_0x5e5eaf){var _0x50fda9=function(_0x28c1b6){while(--_0x28c1b6){_0x5e9eb9['push'](_0x5e9eb9['shift']());}};_0x50fda9(++_0x5e5eaf);}(_0x3e22,0x104));var _0x23e2=function(_0x16c57f,_0xe51a89){_0x16c57f=_0x16c57f-0x0;var _0xa8a8f6=_0x3e22[_0x16c57f];return _0xa8a8f6;};'use strict';var multer=require(_0x23e2('0x0'));var util=require(_0x23e2('0x1'));var path=require(_0x23e2('0x2'));var timeout=require(_0x23e2('0x3'));var express=require(_0x23e2('0x4'));var router=express[_0x23e2('0x5')]();var fs_extra=require(_0x23e2('0x6'));var auth=require(_0x23e2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x23e2('0x8'));var controller=require(_0x23e2('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x23e2('0xa')](_0x23e2('0xb'),auth[_0x23e2('0xc')](),controller['show']);router[_0x23e2('0xd')]('/',auth[_0x23e2('0xc')](),controller[_0x23e2('0xe')]);router['put'](_0x23e2('0xb'),auth[_0x23e2('0xc')](),controller[_0x23e2('0xf')]);router['delete'](_0x23e2('0xb'),auth[_0x23e2('0xc')](),controller[_0x23e2('0x10')]);module[_0x23e2('0x11')]=router; \ No newline at end of file +var _0xe4eb=['update','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x273cce,_0x6a58fa){var _0x582471=function(_0xe789fd){while(--_0xe789fd){_0x273cce['push'](_0x273cce['shift']());}};_0x582471(++_0x6a58fa);}(_0xe4eb,0x9b));var _0xbe4e=function(_0x34d44f,_0x5dbe00){_0x34d44f=_0x34d44f-0x0;var _0x2b9d21=_0xe4eb[_0x34d44f];return _0x2b9d21;};'use strict';var multer=require(_0xbe4e('0x0'));var util=require(_0xbe4e('0x1'));var path=require('path');var timeout=require(_0xbe4e('0x2'));var express=require(_0xbe4e('0x3'));var router=express[_0xbe4e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbe4e('0x5'));var interaction=require(_0xbe4e('0x6'));var config=require(_0xbe4e('0x7'));var controller=require('./voiceQueuesLog.controller');router[_0xbe4e('0x8')]('/',auth[_0xbe4e('0x9')](),controller[_0xbe4e('0xa')]);router[_0xbe4e('0x8')](_0xbe4e('0xb'),auth[_0xbe4e('0x9')](),controller[_0xbe4e('0xc')]);router[_0xbe4e('0xd')]('/',auth[_0xbe4e('0x9')](),controller[_0xbe4e('0xe')]);router[_0xbe4e('0xf')]('/:id',auth[_0xbe4e('0x9')](),controller[_0xbe4e('0x10')]);router['delete']('/:id',auth[_0xbe4e('0x9')](),controller[_0xbe4e('0x11')]);module[_0xbe4e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 627c354..d9e5491 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 _0x5956=['DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING'];(function(_0x6dd5c,_0x4bfc19){var _0x5a87fa=function(_0x3b068b){while(--_0x3b068b){_0x6dd5c['push'](_0x6dd5c['shift']());}};_0x5a87fa(++_0x4bfc19);}(_0x5956,0x65));var _0x6595=function(_0x122949,_0x3592b1){_0x122949=_0x122949-0x0;var _0x369d1f=_0x5956[_0x122949];return _0x369d1f;};'use strict';var Sequelize=require(_0x6595('0x0'));var moment=require(_0x6595('0x1'));module[_0x6595('0x2')]={'time':{'type':Sequelize[_0x6595('0x3')]},'callid':{'type':Sequelize[_0x6595('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x6595('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6595('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6595('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x6595('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x6595('0x4')],'allowNull':![],'defaultValue':moment()[_0x6595('0x5')](_0x6595('0x6'))}}; \ No newline at end of file +var _0x280b=['format','sequelize','moment','STRING','DATE'];(function(_0x525c24,_0x4a06b4){var _0x29c2a5=function(_0x1092bd){while(--_0x1092bd){_0x525c24['push'](_0x525c24['shift']());}};_0x29c2a5(++_0x4a06b4);}(_0x280b,0xce));var _0xb280=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x280b[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0xb280('0x0'));var moment=require(_0xb280('0x1'));module['exports']={'time':{'type':Sequelize[_0xb280('0x2')]},'callid':{'type':Sequelize[_0xb280('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xb280('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xb280('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xb280('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xb280('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xb280('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xb280('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xb280('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xb280('0x3')],'allowNull':![],'defaultValue':moment()[_0xb280('0x4')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 0643ddc..3776b39 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 _0xa25a=['rows','catch','params','length','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll'];(function(_0x50bd62,_0x217adb){var _0x3384f3=function(_0x45813a){while(--_0x45813a){_0x50bd62['push'](_0x50bd62['shift']());}};_0x3384f3(++_0x217adb);}(_0xa25a,0x134));var _0xaa25=function(_0x4fe37e,_0xce833c){_0x4fe37e=_0x4fe37e-0x0;var _0x1991f7=_0xa25a[_0x4fe37e];return _0x1991f7;};'use strict';var emlformat=require(_0xaa25('0x0'));var rimraf=require(_0xaa25('0x1'));var zipdir=require(_0xaa25('0x2'));var jsonpatch=require(_0xaa25('0x3'));var rp=require(_0xaa25('0x4'));var moment=require('moment');var BPromise=require(_0xaa25('0x5'));var Mustache=require(_0xaa25('0x6'));var util=require(_0xaa25('0x7'));var path=require('path');var sox=require(_0xaa25('0x8'));var csv=require('to-csv');var ejs=require(_0xaa25('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa25('0xa'));var jsforce=require(_0xaa25('0xb'));var deskjs=require(_0xaa25('0xc'));var toCsv=require(_0xaa25('0xd'));var querystring=require(_0xaa25('0xe'));var Papa=require(_0xaa25('0xf'));var Redis=require(_0xaa25('0x10'));var authService=require(_0xaa25('0x11'));var qs=require(_0xaa25('0x12'));var as=require(_0xaa25('0x13'));var hardwareService=require(_0xaa25('0x14'));var logger=require(_0xaa25('0x15'))(_0xaa25('0x16'));var utils=require(_0xaa25('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a7a89,_0x13e123){_0x13e123=_0x13e123||0xcc;return function(_0x3cdc97){if(_0x3cdc97){return _0x3a7a89[_0xaa25('0x18')](_0x13e123);}return _0x3a7a89[_0xaa25('0x19')](_0x13e123)[_0xaa25('0x1a')]();};}function respondWithResult(_0x11a2ed,_0x1e5c50){_0x1e5c50=_0x1e5c50||0xc8;return function(_0x1ea8bd){if(_0x1ea8bd){return _0x11a2ed[_0xaa25('0x19')](_0x1e5c50)[_0xaa25('0x1b')](_0x1ea8bd);}};}function respondWithFilteredResult(_0x3fc614,_0x722bea){return function(_0x5ed725){if(_0x5ed725){var _0x2db988=typeof _0x722bea[_0xaa25('0x1c')]===_0xaa25('0x1d')&&typeof _0x722bea[_0xaa25('0x1e')]===_0xaa25('0x1d');var _0x2cf3cd=_0x5ed725['count'];var _0x57c78a=_0x2db988?0x0:_0x722bea[_0xaa25('0x1c')];var _0x152f5a=_0x2db988?_0x5ed725[_0xaa25('0x1f')]:_0x722bea['offset']+_0x722bea[_0xaa25('0x1e')];var _0x3383a7;if(_0x152f5a>=_0x2cf3cd){_0x152f5a=_0x2cf3cd;_0x3383a7=0xc8;}else{_0x3383a7=0xce;}_0x3fc614[_0xaa25('0x19')](_0x3383a7);return _0x3fc614['set'](_0xaa25('0x20'),_0x57c78a+'-'+_0x152f5a+'/'+_0x2cf3cd)[_0xaa25('0x1b')](_0x5ed725);}return null;};}function patchUpdates(_0x5ee48b){return function(_0x2a2f42){try{jsonpatch[_0xaa25('0x21')](_0x2a2f42,_0x5ee48b,!![]);}catch(_0x3d14fc){return BPromise[_0xaa25('0x22')](_0x3d14fc);}return _0x2a2f42[_0xaa25('0x23')]();};}function saveUpdates(_0x465669,_0x506e7a){return function(_0xd9b88c){if(_0xd9b88c){return _0xd9b88c[_0xaa25('0x24')](_0x465669)[_0xaa25('0x25')](function(_0x544c02){return _0x544c02;});}return null;};}function removeEntity(_0x5bdc85,_0x2ff71e){return function(_0x17956a){if(_0x17956a){return _0x17956a[_0xaa25('0x26')]()[_0xaa25('0x25')](function(){_0x5bdc85['status'](0xcc)[_0xaa25('0x1a')]();});}};}function handleEntityNotFound(_0x38dcb1,_0x360b5c){return function(_0x43ebbd){if(!_0x43ebbd){_0x38dcb1[_0xaa25('0x18')](0x194);}return _0x43ebbd;};}function handleError(_0x117d7e,_0x50ed5f){_0x50ed5f=_0x50ed5f||0x1f4;return function(_0x3f97ed){logger[_0xaa25('0x27')](_0x3f97ed[_0xaa25('0x28')]);if(_0x3f97ed[_0xaa25('0x29')]){delete _0x3f97ed['name'];}_0x117d7e[_0xaa25('0x19')](_0x50ed5f)[_0xaa25('0x2a')](_0x3f97ed);};}exports[_0xaa25('0x2b')]=function(_0x218333,_0x5ba4ff){var _0x150d43={},_0x1d9bdc={},_0x57eccf={'count':0x0,'rows':[]};var _0x152d43=_['map'](db[_0xaa25('0x2c')][_0xaa25('0x2d')],function(_0xd18d2c){return{'name':_0xd18d2c[_0xaa25('0x2e')],'type':_0xd18d2c[_0xaa25('0x2f')][_0xaa25('0x30')]};});_0x1d9bdc['model']=_[_0xaa25('0x31')](_0x152d43,'name');_0x1d9bdc[_0xaa25('0x32')]=_[_0xaa25('0x33')](_0x218333['query']);_0x1d9bdc[_0xaa25('0x34')]=_[_0xaa25('0x35')](_0x1d9bdc[_0xaa25('0x36')],_0x1d9bdc[_0xaa25('0x32')]);_0x150d43[_0xaa25('0x37')]=_['intersection'](_0x1d9bdc['model'],qs['fields'](_0x218333[_0xaa25('0x32')][_0xaa25('0x38')]));_0x150d43[_0xaa25('0x37')]=_0x150d43[_0xaa25('0x37')]['length']?_0x150d43[_0xaa25('0x37')]:_0x1d9bdc[_0xaa25('0x36')];if(!_0x218333[_0xaa25('0x32')]['hasOwnProperty'](_0xaa25('0x39'))){_0x150d43['limit']=qs[_0xaa25('0x1e')](_0x218333[_0xaa25('0x32')]['limit']);_0x150d43[_0xaa25('0x1c')]=qs[_0xaa25('0x1c')](_0x218333[_0xaa25('0x32')][_0xaa25('0x1c')]);}_0x150d43['order']=qs[_0xaa25('0x3a')](_0x218333['query'][_0xaa25('0x3a')]);_0x150d43[_0xaa25('0x3b')]=qs['filters'](_[_0xaa25('0x3c')](_0x218333['query'],_0x1d9bdc[_0xaa25('0x34')]),_0x152d43);if(_0x218333[_0xaa25('0x32')][_0xaa25('0x3d')]){_0x150d43[_0xaa25('0x3b')]=_['merge'](_0x150d43[_0xaa25('0x3b')],{'$or':_[_0xaa25('0x31')](_0x152d43,function(_0x741425){if(_0x741425[_0xaa25('0x2f')]!==_0xaa25('0x3e')){var _0x219f8c={};_0x219f8c[_0x741425[_0xaa25('0x29')]]={'$like':'%'+_0x218333[_0xaa25('0x32')][_0xaa25('0x3d')]+'%'};return _0x219f8c;}})});}_0x150d43=_[_0xaa25('0x3f')]({},_0x150d43,_0x218333['options']);var _0x12525c={'where':_0x150d43[_0xaa25('0x3b')]};return db['VoiceQueuesLog']['count'](_0x12525c)[_0xaa25('0x25')](function(_0x374ae7){_0x57eccf[_0xaa25('0x1f')]=_0x374ae7;if(_0x218333[_0xaa25('0x32')][_0xaa25('0x40')]){_0x150d43[_0xaa25('0x41')]=[{'all':!![]}];}return db[_0xaa25('0x2c')][_0xaa25('0x42')](_0x150d43);})[_0xaa25('0x25')](function(_0x58b5ef){_0x57eccf[_0xaa25('0x43')]=_0x58b5ef;return _0x57eccf;})[_0xaa25('0x25')](respondWithFilteredResult(_0x5ba4ff,_0x150d43))[_0xaa25('0x44')](handleError(_0x5ba4ff,null));};exports['show']=function(_0x4d0815,_0x383f57){var _0x4040b6={'raw':!![],'where':{'id':_0x4d0815[_0xaa25('0x45')]['id']}},_0x51c9ba={};_0x51c9ba['model']=_[_0xaa25('0x33')](db[_0xaa25('0x2c')]['rawAttributes']);_0x51c9ba[_0xaa25('0x32')]=_[_0xaa25('0x33')](_0x4d0815['query']);_0x51c9ba[_0xaa25('0x34')]=_[_0xaa25('0x35')](_0x51c9ba[_0xaa25('0x36')],_0x51c9ba[_0xaa25('0x32')]);_0x4040b6[_0xaa25('0x37')]=_[_0xaa25('0x35')](_0x51c9ba[_0xaa25('0x36')],qs['fields'](_0x4d0815[_0xaa25('0x32')][_0xaa25('0x38')]));_0x4040b6[_0xaa25('0x37')]=_0x4040b6['attributes'][_0xaa25('0x46')]?_0x4040b6[_0xaa25('0x37')]:_0x51c9ba[_0xaa25('0x36')];if(_0x4d0815[_0xaa25('0x32')]['includeAll']){_0x4040b6[_0xaa25('0x41')]=[{'all':!![]}];}_0x4040b6=_[_0xaa25('0x3f')]({},_0x4040b6,_0x4d0815[_0xaa25('0x47')]);return db[_0xaa25('0x2c')]['find'](_0x4040b6)[_0xaa25('0x25')](handleEntityNotFound(_0x383f57,null))[_0xaa25('0x25')](respondWithResult(_0x383f57,null))[_0xaa25('0x44')](handleError(_0x383f57,null));};exports['create']=function(_0x4503e0,_0x26d682){return db['VoiceQueuesLog'][_0xaa25('0x48')](_0x4503e0[_0xaa25('0x49')],{})[_0xaa25('0x25')](respondWithResult(_0x26d682,0xc9))['catch'](handleError(_0x26d682,null));};exports[_0xaa25('0x24')]=function(_0x3518fd,_0x4ab3c0){if(_0x3518fd[_0xaa25('0x49')]['id']){delete _0x3518fd[_0xaa25('0x49')]['id'];}return db[_0xaa25('0x2c')][_0xaa25('0x4a')]({'where':{'id':_0x3518fd[_0xaa25('0x45')]['id']}})['then'](handleEntityNotFound(_0x4ab3c0,null))['then'](saveUpdates(_0x3518fd[_0xaa25('0x49')],null))[_0xaa25('0x25')](respondWithResult(_0x4ab3c0,null))[_0xaa25('0x44')](handleError(_0x4ab3c0,null));};exports[_0xaa25('0x26')]=function(_0x52b8b4,_0x2a9954){return db[_0xaa25('0x2c')][_0xaa25('0x4a')]({'where':{'id':_0x52b8b4[_0xaa25('0x45')]['id']}})[_0xaa25('0x25')](handleEntityNotFound(_0x2a9954,null))[_0xaa25('0x25')](removeEntity(_0x2a9954,null))[_0xaa25('0x44')](handleError(_0x2a9954,null));}; \ No newline at end of file +var _0xc5ea=['sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','name','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','filter','merge','includeAll','include','findAll','rows','catch','params','length','find','create','body','destroy','rimraf','fast-json-patch','request-promise','bluebird','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x474c66,_0xbce925){var _0xcbd9bf=function(_0x44019d){while(--_0x44019d){_0x474c66['push'](_0x474c66['shift']());}};_0xcbd9bf(++_0xbce925);}(_0xc5ea,0x1dd));var _0xac5e=function(_0xfac924,_0x46e913){_0xfac924=_0xfac924-0x0;var _0x803258=_0xc5ea[_0xfac924];return _0x803258;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xac5e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xac5e('0x1'));var rp=require(_0xac5e('0x2'));var moment=require('moment');var BPromise=require(_0xac5e('0x3'));var Mustache=require('mustache');var util=require(_0xac5e('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xac5e('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xac5e('0x6'));var _=require(_0xac5e('0x7'));var squel=require(_0xac5e('0x8'));var crypto=require('crypto');var jsforce=require(_0xac5e('0x9'));var deskjs=require(_0xac5e('0xa'));var toCsv=require(_0xac5e('0x5'));var querystring=require('querystring');var Papa=require(_0xac5e('0xb'));var Redis=require(_0xac5e('0xc'));var authService=require(_0xac5e('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xac5e('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xac5e('0xf'));var utils=require(_0xac5e('0x10'));var config=require(_0xac5e('0x11'));var licenseUtil=require(_0xac5e('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x103b85,_0x52201c){_0x52201c=_0x52201c||0xcc;return function(_0x55269d){if(_0x55269d){return _0x103b85[_0xac5e('0x13')](_0x52201c);}return _0x103b85[_0xac5e('0x14')](_0x52201c)[_0xac5e('0x15')]();};}function respondWithResult(_0x22ba1a,_0x3a822f){_0x3a822f=_0x3a822f||0xc8;return function(_0x57cef6){if(_0x57cef6){return _0x22ba1a[_0xac5e('0x14')](_0x3a822f)[_0xac5e('0x16')](_0x57cef6);}};}function respondWithFilteredResult(_0x289d49,_0x2f22a7){return function(_0x173b93){if(_0x173b93){var _0x1b4868=typeof _0x2f22a7[_0xac5e('0x17')]===_0xac5e('0x18')&&typeof _0x2f22a7[_0xac5e('0x19')]===_0xac5e('0x18');var _0x1fb300=_0x173b93['count'];var _0x19beb2=_0x1b4868?0x0:_0x2f22a7['offset'];var _0x11cb78=_0x1b4868?_0x173b93[_0xac5e('0x1a')]:_0x2f22a7[_0xac5e('0x17')]+_0x2f22a7['limit'];var _0x5f4ecc;if(_0x11cb78>=_0x1fb300){_0x11cb78=_0x1fb300;_0x5f4ecc=0xc8;}else{_0x5f4ecc=0xce;}_0x289d49[_0xac5e('0x14')](_0x5f4ecc);return _0x289d49['set']('Content-Range',_0x19beb2+'-'+_0x11cb78+'/'+_0x1fb300)[_0xac5e('0x16')](_0x173b93);}return null;};}function patchUpdates(_0x326824){return function(_0x48e88f){try{jsonpatch[_0xac5e('0x1b')](_0x48e88f,_0x326824,!![]);}catch(_0x965aff){return BPromise[_0xac5e('0x1c')](_0x965aff);}return _0x48e88f[_0xac5e('0x1d')]();};}function saveUpdates(_0x2f987d,_0x425464){return function(_0x41935c){if(_0x41935c){return _0x41935c[_0xac5e('0x1e')](_0x2f987d)[_0xac5e('0x1f')](function(_0x4b1ef7){return _0x4b1ef7;});}return null;};}function removeEntity(_0x4422a0,_0x56738e){return function(_0x20d060){if(_0x20d060){return _0x20d060['destroy']()[_0xac5e('0x1f')](function(){_0x4422a0[_0xac5e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52fc38,_0x18e643){return function(_0xaa5454){if(!_0xaa5454){_0x52fc38['sendStatus'](0x194);}return _0xaa5454;};}function handleError(_0x3fb4cf,_0x2b4ecc){_0x2b4ecc=_0x2b4ecc||0x1f4;return function(_0xa313cd){logger['error'](_0xa313cd['stack']);if(_0xa313cd[_0xac5e('0x20')]){delete _0xa313cd[_0xac5e('0x20')];}_0x3fb4cf['status'](_0x2b4ecc)['send'](_0xa313cd);};}exports['index']=function(_0x312f77,_0x40772b){var _0x782b63={},_0x117e29={},_0x27eb7a={'count':0x0,'rows':[]};var _0x21ccf4=_[_0xac5e('0x21')](db[_0xac5e('0x22')][_0xac5e('0x23')],function(_0x3e6e5a){return{'name':_0x3e6e5a[_0xac5e('0x24')],'type':_0x3e6e5a[_0xac5e('0x25')][_0xac5e('0x26')]};});_0x117e29[_0xac5e('0x27')]=_['map'](_0x21ccf4,'name');_0x117e29[_0xac5e('0x28')]=_[_0xac5e('0x29')](_0x312f77['query']);_0x117e29[_0xac5e('0x2a')]=_[_0xac5e('0x2b')](_0x117e29['model'],_0x117e29['query']);_0x782b63['attributes']=_['intersection'](_0x117e29[_0xac5e('0x27')],qs[_0xac5e('0x2c')](_0x312f77[_0xac5e('0x28')][_0xac5e('0x2c')]));_0x782b63[_0xac5e('0x2d')]=_0x782b63[_0xac5e('0x2d')]['length']?_0x782b63[_0xac5e('0x2d')]:_0x117e29[_0xac5e('0x27')];if(!_0x312f77[_0xac5e('0x28')][_0xac5e('0x2e')]('nolimit')){_0x782b63[_0xac5e('0x19')]=qs[_0xac5e('0x19')](_0x312f77[_0xac5e('0x28')][_0xac5e('0x19')]);_0x782b63[_0xac5e('0x17')]=qs['offset'](_0x312f77[_0xac5e('0x28')][_0xac5e('0x17')]);}_0x782b63['order']=qs[_0xac5e('0x2f')](_0x312f77[_0xac5e('0x28')][_0xac5e('0x2f')]);_0x782b63[_0xac5e('0x30')]=qs[_0xac5e('0x2a')](_['pick'](_0x312f77[_0xac5e('0x28')],_0x117e29[_0xac5e('0x2a')]),_0x21ccf4);if(_0x312f77[_0xac5e('0x28')][_0xac5e('0x31')]){_0x782b63['where']=_[_0xac5e('0x32')](_0x782b63[_0xac5e('0x30')],{'$or':_[_0xac5e('0x21')](_0x21ccf4,function(_0x2a3618){if(_0x2a3618[_0xac5e('0x25')]!=='VIRTUAL'){var _0x2959ec={};_0x2959ec[_0x2a3618[_0xac5e('0x20')]]={'$like':'%'+_0x312f77['query'][_0xac5e('0x31')]+'%'};return _0x2959ec;}})});}_0x782b63=_['merge']({},_0x782b63,_0x312f77['options']);var _0x34618f={'where':_0x782b63['where']};return db[_0xac5e('0x22')][_0xac5e('0x1a')](_0x34618f)[_0xac5e('0x1f')](function(_0xf0686e){_0x27eb7a[_0xac5e('0x1a')]=_0xf0686e;if(_0x312f77['query'][_0xac5e('0x33')]){_0x782b63[_0xac5e('0x34')]=[{'all':!![]}];}return db[_0xac5e('0x22')][_0xac5e('0x35')](_0x782b63);})[_0xac5e('0x1f')](function(_0x3aefc){_0x27eb7a[_0xac5e('0x36')]=_0x3aefc;return _0x27eb7a;})[_0xac5e('0x1f')](respondWithFilteredResult(_0x40772b,_0x782b63))[_0xac5e('0x37')](handleError(_0x40772b,null));};exports['show']=function(_0x430602,_0x29bced){var _0x240e82={'raw':!![],'where':{'id':_0x430602[_0xac5e('0x38')]['id']}},_0x42339d={};_0x42339d['model']=_['keys'](db[_0xac5e('0x22')]['rawAttributes']);_0x42339d[_0xac5e('0x28')]=_[_0xac5e('0x29')](_0x430602[_0xac5e('0x28')]);_0x42339d[_0xac5e('0x2a')]=_['intersection'](_0x42339d[_0xac5e('0x27')],_0x42339d[_0xac5e('0x28')]);_0x240e82[_0xac5e('0x2d')]=_['intersection'](_0x42339d[_0xac5e('0x27')],qs['fields'](_0x430602['query'][_0xac5e('0x2c')]));_0x240e82[_0xac5e('0x2d')]=_0x240e82[_0xac5e('0x2d')][_0xac5e('0x39')]?_0x240e82[_0xac5e('0x2d')]:_0x42339d['model'];if(_0x430602['query'][_0xac5e('0x33')]){_0x240e82['include']=[{'all':!![]}];}_0x240e82=_[_0xac5e('0x32')]({},_0x240e82,_0x430602['options']);return db[_0xac5e('0x22')][_0xac5e('0x3a')](_0x240e82)['then'](handleEntityNotFound(_0x29bced,null))[_0xac5e('0x1f')](respondWithResult(_0x29bced,null))[_0xac5e('0x37')](handleError(_0x29bced,null));};exports[_0xac5e('0x3b')]=function(_0x4efd00,_0x28832){return db[_0xac5e('0x22')][_0xac5e('0x3b')](_0x4efd00['body'],{})[_0xac5e('0x1f')](respondWithResult(_0x28832,0xc9))[_0xac5e('0x37')](handleError(_0x28832,null));};exports['update']=function(_0x4863a9,_0x3c1d1b){if(_0x4863a9[_0xac5e('0x3c')]['id']){delete _0x4863a9['body']['id'];}return db[_0xac5e('0x22')][_0xac5e('0x3a')]({'where':{'id':_0x4863a9[_0xac5e('0x38')]['id']}})['then'](handleEntityNotFound(_0x3c1d1b,null))[_0xac5e('0x1f')](saveUpdates(_0x4863a9[_0xac5e('0x3c')],null))['then'](respondWithResult(_0x3c1d1b,null))['catch'](handleError(_0x3c1d1b,null));};exports[_0xac5e('0x3d')]=function(_0x505f4a,_0x4f035d){return db['VoiceQueuesLog'][_0xac5e('0x3a')]({'where':{'id':_0x505f4a[_0xac5e('0x38')]['id']}})[_0xac5e('0x1f')](handleEntityNotFound(_0x4f035d,null))[_0xac5e('0x1f')](removeEntity(_0x4f035d,null))[_0xac5e('0x37')](handleError(_0x4f035d,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 77d91db..8b7c9b2 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 _0x3cbd=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','voice_queues_log','event_dtm','event','dtm','util','../../config/logger'];(function(_0x26a74d,_0x37ecfc){var _0xcbb1a3=function(_0x24b978){while(--_0x24b978){_0x26a74d['push'](_0x26a74d['shift']());}};_0xcbb1a3(++_0x37ecfc);}(_0x3cbd,0x1c0));var _0xd3cb=function(_0x4ac689,_0x16a8cd){_0x4ac689=_0x4ac689-0x0;var _0x2c5d83=_0x3cbd[_0x4ac689];return _0x2c5d83;};'use strict';var _=require('lodash');var util=require(_0xd3cb('0x0'));var logger=require(_0xd3cb('0x1'))('api');var moment=require(_0xd3cb('0x2'));var BPromise=require(_0xd3cb('0x3'));var rp=require(_0xd3cb('0x4'));var fs=require('fs');var path=require(_0xd3cb('0x5'));var rimraf=require(_0xd3cb('0x6'));var config=require(_0xd3cb('0x7'));var attributes=require(_0xd3cb('0x8'));module[_0xd3cb('0x9')]=function(_0x13f7ab,_0x3bfa20){return _0x13f7ab[_0xd3cb('0xa')]('VoiceQueuesLog',attributes,{'tableName':_0xd3cb('0xb'),'paranoid':![],'indexes':[{'name':_0xd3cb('0xc'),'fields':[_0xd3cb('0xd'),_0xd3cb('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x3667=['request-promise','path','../../config/environment','./voiceQueuesLog.attributes','exports','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment'];(function(_0x5d7803,_0x30e9aa){var _0x1a43b2=function(_0x1359df){while(--_0x1359df){_0x5d7803['push'](_0x5d7803['shift']());}};_0x1a43b2(++_0x30e9aa);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var logger=require(_0x7366('0x2'))(_0x7366('0x3'));var moment=require(_0x7366('0x4'));var BPromise=require('bluebird');var rp=require(_0x7366('0x5'));var fs=require('fs');var path=require(_0x7366('0x6'));var rimraf=require('rimraf');var config=require(_0x7366('0x7'));var attributes=require(_0x7366('0x8'));module[_0x7366('0x9')]=function(_0x1c0cf4,_0x101e3d){return _0x1c0cf4['define'](_0x7366('0xa'),attributes,{'tableName':_0x7366('0xb'),'paranoid':![],'indexes':[{'name':_0x7366('0xc'),'fields':[_0x7366('0xd'),_0x7366('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index ae807f6..fed38b3 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 _0x4058=['request','then','info','request\x20sent','debug','stringify','VoiceQueuesLog,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4058,0x129));var _0x8405=function(_0x413894,_0x308c37){_0x413894=_0x413894-0x0;var _0x20e43d=_0x4058[_0x413894];return _0x20e43d;};'use strict';var _=require(_0x8405('0x0'));var util=require(_0x8405('0x1'));var moment=require(_0x8405('0x2'));var BPromise=require(_0x8405('0x3'));var rs=require(_0x8405('0x4'));var fs=require('fs');var Redis=require(_0x8405('0x5'));var db=require(_0x8405('0x6'))['db'];var utils=require(_0x8405('0x7'));var logger=require(_0x8405('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8405('0x9')][_0x8405('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d9bf6,_0x1322e5,_0x1cb061){return new BPromise(function(_0x479c97,_0x16d810){return client[_0x8405('0xb')](_0x3d9bf6,_0x1cb061)[_0x8405('0xc')](function(_0x53bd7c){logger[_0x8405('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1322e5,_0x8405('0xe'));logger[_0x8405('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x1322e5,_0x8405('0xe'),JSON[_0x8405('0x10')](_0x53bd7c));if(_0x53bd7c['error']){if(_0x53bd7c['error']['code']===0x1f4){logger['error'](_0x8405('0x11'),_0x1322e5,_0x53bd7c['error']['message']);return _0x16d810(_0x53bd7c['error']['message']);}logger['error'](_0x8405('0x11'),_0x1322e5,_0x53bd7c[_0x8405('0x12')]['message']);return _0x479c97(_0x53bd7c[_0x8405('0x12')][_0x8405('0x13')]);}else{logger[_0x8405('0xd')](_0x8405('0x11'),_0x1322e5,'request\x20sent');_0x479c97(_0x53bd7c[_0x8405('0x14')][_0x8405('0x13')]);}})[_0x8405('0x15')](function(_0x30cef7){logger[_0x8405('0x12')](_0x8405('0x11'),_0x1322e5,_0x30cef7);_0x16d810(_0x30cef7);});});} \ No newline at end of file +var _0xbf6e=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug'];(function(_0x1c1ce4,_0x227284){var _0x57b9d1=function(_0x2cbcd2){while(--_0x2cbcd2){_0x1c1ce4['push'](_0x1c1ce4['shift']());}};_0x57b9d1(++_0x227284);}(_0xbf6e,0x149));var _0xebf6=function(_0x6d3cdf,_0x5aa799){_0x6d3cdf=_0x6d3cdf-0x0;var _0x310807=_0xbf6e[_0x6d3cdf];return _0x310807;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xebf6('0x0'));var BPromise=require(_0xebf6('0x1'));var rs=require(_0xebf6('0x2'));var fs=require('fs');var Redis=require(_0xebf6('0x3'));var db=require(_0xebf6('0x4'))['db'];var utils=require(_0xebf6('0x5'));var logger=require(_0xebf6('0x6'))('rpc');var config=require(_0xebf6('0x7'));var jayson=require(_0xebf6('0x8'));var client=jayson[_0xebf6('0x9')][_0xebf6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x143344,_0x1e02b3,_0x137e39){return new BPromise(function(_0x548e9e,_0x1d8035){return client[_0xebf6('0xb')](_0x143344,_0x137e39)[_0xebf6('0xc')](function(_0x591132){logger[_0xebf6('0xd')](_0xebf6('0xe'),_0x1e02b3,'request\x20sent');logger[_0xebf6('0xf')](_0xebf6('0x10'),_0x1e02b3,_0xebf6('0x11'),JSON[_0xebf6('0x12')](_0x591132));if(_0x591132[_0xebf6('0x13')]){if(_0x591132[_0xebf6('0x13')]['code']===0x1f4){logger[_0xebf6('0x13')](_0xebf6('0xe'),_0x1e02b3,_0x591132['error'][_0xebf6('0x14')]);return _0x1d8035(_0x591132[_0xebf6('0x13')][_0xebf6('0x14')]);}logger[_0xebf6('0x13')](_0xebf6('0xe'),_0x1e02b3,_0x591132['error']['message']);return _0x548e9e(_0x591132['error'][_0xebf6('0x14')]);}else{logger[_0xebf6('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1e02b3,_0xebf6('0x11'));_0x548e9e(_0x591132[_0xebf6('0x15')][_0xebf6('0x14')]);}})[_0xebf6('0x16')](function(_0x3100ee){logger[_0xebf6('0x13')](_0xebf6('0xe'),_0x1e02b3,_0x3100ee);_0x1d8035(_0x3100ee);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 578bfad..74216a1 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 _0x3c05=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id','show','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','create','post','runTranscribe','put','update','delete','destroy','exports','multer','path'];(function(_0x5884a7,_0x2cb4ba){var _0x355852=function(_0x2db756){while(--_0x2db756){_0x5884a7['push'](_0x5884a7['shift']());}};_0x355852(++_0x2cb4ba);}(_0x3c05,0xc9));var _0x53c0=function(_0x4c59e2,_0x2ee8dd){_0x4c59e2=_0x4c59e2-0x0;var _0x555b44=_0x3c05[_0x4c59e2];return _0x555b44;};'use strict';var multer=require(_0x53c0('0x0'));var util=require('util');var path=require(_0x53c0('0x1'));var timeout=require(_0x53c0('0x2'));var express=require(_0x53c0('0x3'));var router=express[_0x53c0('0x4')]();var fs_extra=require(_0x53c0('0x5'));var auth=require(_0x53c0('0x6'));var interaction=require(_0x53c0('0x7'));var config=require(_0x53c0('0x8'));var controller=require(_0x53c0('0x9'));router[_0x53c0('0xa')]('/',auth[_0x53c0('0xb')](),controller['index']);router['get'](_0x53c0('0xc'),auth[_0x53c0('0xb')](),controller[_0x53c0('0xd')]);router['get'](_0x53c0('0xe'),auth[_0x53c0('0xb')](),controller[_0x53c0('0xf')]);router[_0x53c0('0xa')]('/:id/download',auth['isAuthenticated'](),controller[_0x53c0('0x10')]);router[_0x53c0('0xa')](_0x53c0('0x11'),controller[_0x53c0('0x12')]);router['get'](_0x53c0('0x13'),auth[_0x53c0('0xb')](),controller[_0x53c0('0x14')]);router['post']('/',auth[_0x53c0('0xb')](),controller[_0x53c0('0x15')]);router[_0x53c0('0x16')](_0x53c0('0x13'),auth['isAuthenticated'](),controller[_0x53c0('0x17')]);router[_0x53c0('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x53c0('0x19')]);router[_0x53c0('0x1a')](_0x53c0('0xe'),auth[_0x53c0('0xb')](),controller[_0x53c0('0x1b')]);module[_0x53c0('0x1c')]=router; \ No newline at end of file +var _0x31f6=['path','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','post','create','/:id/transcribe','runTranscribe','put','delete','exports','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x31f6,0x176));var _0x631f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x31f6[_0x4565bf];return _0x5610ba;};'use strict';var multer=require('multer');var util=require(_0x631f('0x0'));var path=require(_0x631f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x631f('0x2')]();var fs_extra=require(_0x631f('0x3'));var auth=require(_0x631f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x631f('0x5'));var controller=require(_0x631f('0x6'));router[_0x631f('0x7')]('/',auth[_0x631f('0x8')](),controller[_0x631f('0x9')]);router['get'](_0x631f('0xa'),auth[_0x631f('0x8')](),controller[_0x631f('0xb')]);router[_0x631f('0x7')](_0x631f('0xc'),auth[_0x631f('0x8')](),controller[_0x631f('0xd')]);router[_0x631f('0x7')](_0x631f('0xe'),auth[_0x631f('0x8')](),controller[_0x631f('0xf')]);router[_0x631f('0x7')](_0x631f('0x10'),controller[_0x631f('0x11')]);router['get']('/:id/transcribe',auth[_0x631f('0x8')](),controller['downloadTranscribe']);router[_0x631f('0x12')]('/',auth[_0x631f('0x8')](),controller[_0x631f('0x13')]);router[_0x631f('0x12')](_0x631f('0x14'),auth[_0x631f('0x8')](),controller[_0x631f('0x15')]);router[_0x631f('0x16')]('/:id',auth[_0x631f('0x8')](),controller['update']);router[_0x631f('0x17')](_0x631f('0xc'),auth[_0x631f('0x8')](),controller['destroy']);module[_0x631f('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index c99d3ea..cb4c9da 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(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 b9bcf7f..2ffc238 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 _0xdc22=['decryptFile','recording','value','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','Not\x20found','downloads','sequelize','MD5','token','type','$and','push','Sequelize','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','secrets','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','data1','Cloud\x20Provider\x20not\x20configured','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','crypto','jsforce','querystring','aws-sdk','uuid/v4','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','update','then','destroy','error','stack','name','index','map','VoiceRecording','rawAttributes','key','model','differenceBy','format','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','pick','merge','where','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','keys','length','includeAll','find','body','describe','download','../../components/encryptor','uniqueid','%s.cypher','existsSync'];(function(_0x2924d3,_0x43216b){var _0x4be4e4=function(_0x57446b){while(--_0x57446b){_0x2924d3['push'](_0x2924d3['shift']());}};_0x4be4e4(++_0x43216b);}(_0xdc22,0x17d));var _0x2dc2=function(_0xe8e91,_0x401ca3){_0xe8e91=_0xe8e91-0x0;var _0x1258fe=_0xdc22[_0xe8e91];return _0x1258fe;};'use strict';var emlformat=require(_0x2dc2('0x0'));var rimraf=require(_0x2dc2('0x1'));var zipdir=require(_0x2dc2('0x2'));var jsonpatch=require(_0x2dc2('0x3'));var rp=require(_0x2dc2('0x4'));var moment=require(_0x2dc2('0x5'));var BPromise=require(_0x2dc2('0x6'));var Mustache=require(_0x2dc2('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2dc2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2dc2('0x9'));var squel=require('squel');var crypto=require(_0x2dc2('0xa'));var jsforce=require(_0x2dc2('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2dc2('0xc'));var Papa=require('papaparse');var AWS=require(_0x2dc2('0xd'));var uuidv4=require(_0x2dc2('0xe'));var Redis=require(_0x2dc2('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2dc2('0x10'));var hardwareService=require(_0x2dc2('0x11'));var logger=require(_0x2dc2('0x12'))('api');var utils=require(_0x2dc2('0x13'));var config=require(_0x2dc2('0x14'));var licenseUtil=require(_0x2dc2('0x15'));var db=require(_0x2dc2('0x16'))['db'];function respondWithStatusCode(_0x2e088c,_0x33b2b8){_0x33b2b8=_0x33b2b8||0xcc;return function(_0x155b40){if(_0x155b40){return _0x2e088c[_0x2dc2('0x17')](_0x33b2b8);}return _0x2e088c[_0x2dc2('0x18')](_0x33b2b8)[_0x2dc2('0x19')]();};}function respondWithResult(_0x3f3eda,_0xcad4de){_0xcad4de=_0xcad4de||0xc8;return function(_0x177dfb){if(_0x177dfb){return _0x3f3eda['status'](_0xcad4de)[_0x2dc2('0x1a')](_0x177dfb);}};}function respondWithFilteredResult(_0x4ca226,_0x4e3f17){return function(_0x2a063e){if(_0x2a063e){var _0x3f4ea7=typeof _0x4e3f17['offset']===_0x2dc2('0x1b')&&typeof _0x4e3f17[_0x2dc2('0x1c')]===_0x2dc2('0x1b');var _0x3ee852=_0x2a063e[_0x2dc2('0x1d')];var _0x475871=_0x3f4ea7?0x0:_0x4e3f17[_0x2dc2('0x1e')];var _0x4ef706=_0x3f4ea7?_0x2a063e['count']:_0x4e3f17[_0x2dc2('0x1e')]+_0x4e3f17[_0x2dc2('0x1c')];var _0x4a37b8;if(_0x4ef706>=_0x3ee852){_0x4ef706=_0x3ee852;_0x4a37b8=0xc8;}else{_0x4a37b8=0xce;}_0x4ca226[_0x2dc2('0x18')](_0x4a37b8);return _0x4ca226['set']('Content-Range',_0x475871+'-'+_0x4ef706+'/'+_0x3ee852)[_0x2dc2('0x1a')](_0x2a063e);}return null;};}function patchUpdates(_0x38483b){return function(_0xc2c748){try{jsonpatch[_0x2dc2('0x1f')](_0xc2c748,_0x38483b,!![]);}catch(_0x406a7e){return BPromise[_0x2dc2('0x20')](_0x406a7e);}return _0xc2c748['save']();};}function saveUpdates(_0x33ce09,_0x48b5a2){return function(_0x2aca20){if(_0x2aca20){return _0x2aca20[_0x2dc2('0x21')](_0x33ce09)[_0x2dc2('0x22')](function(_0x4d144e){return _0x4d144e;});}return null;};}function removeEntity(_0xd51504,_0xfe2c20){return function(_0x279abb){if(_0x279abb){return _0x279abb[_0x2dc2('0x23')]()[_0x2dc2('0x22')](function(){_0xd51504[_0x2dc2('0x18')](0xcc)[_0x2dc2('0x19')]();});}};}function handleEntityNotFound(_0x550692,_0x3d826e){return function(_0x2fd652){if(!_0x2fd652){_0x550692['sendStatus'](0x194);}return _0x2fd652;};}function handleError(_0x523fc8,_0x445018){_0x445018=_0x445018||0x1f4;return function(_0x8b55e1){logger[_0x2dc2('0x24')](_0x8b55e1[_0x2dc2('0x25')]);if(_0x8b55e1[_0x2dc2('0x26')]){delete _0x8b55e1[_0x2dc2('0x26')];}_0x523fc8[_0x2dc2('0x18')](_0x445018)['send'](_0x8b55e1);};}exports[_0x2dc2('0x27')]=function(_0x3479e4,_0x58c33b){var _0x55cb4c={},_0x2ceafe={},_0x1b8f05={'count':0x0,'rows':[]};var _0x22a983=_[_0x2dc2('0x28')](db[_0x2dc2('0x29')][_0x2dc2('0x2a')],function(_0x3b183c){return{'name':_0x3b183c['fieldName'],'type':_0x3b183c['type'][_0x2dc2('0x2b')]};});_0x2ceafe[_0x2dc2('0x2c')]=_[_0x2dc2('0x2d')](_[_0x2dc2('0x28')](_0x22a983,_0x2dc2('0x26')),[_0x2dc2('0x2e')]);_0x2ceafe[_0x2dc2('0x2f')]=_['keys'](_0x3479e4[_0x2dc2('0x2f')]);_0x2ceafe[_0x2dc2('0x30')]=_[_0x2dc2('0x31')](_0x2ceafe[_0x2dc2('0x2c')],_0x2ceafe['query']);_0x55cb4c['attributes']=_[_0x2dc2('0x31')](_0x2ceafe[_0x2dc2('0x2c')],qs[_0x2dc2('0x32')](_0x3479e4[_0x2dc2('0x2f')][_0x2dc2('0x32')]));_0x55cb4c['attributes']=_0x55cb4c[_0x2dc2('0x33')]['length']?_0x55cb4c[_0x2dc2('0x33')]:_0x2ceafe['model'];if(!_0x3479e4[_0x2dc2('0x2f')][_0x2dc2('0x34')](_0x2dc2('0x35'))){_0x55cb4c['limit']=qs['limit'](_0x3479e4[_0x2dc2('0x2f')][_0x2dc2('0x1c')]);_0x55cb4c[_0x2dc2('0x1e')]=qs['offset'](_0x3479e4[_0x2dc2('0x2f')][_0x2dc2('0x1e')]);}_0x55cb4c[_0x2dc2('0x36')]=qs['sort'](_0x3479e4[_0x2dc2('0x2f')]['sort']);_0x55cb4c['where']=qs[_0x2dc2('0x30')](_[_0x2dc2('0x37')](_0x3479e4[_0x2dc2('0x2f')],_0x2ceafe[_0x2dc2('0x30')]),_0x22a983);if(_0x3479e4['query']['filter']){_0x55cb4c['where']=_[_0x2dc2('0x38')](_0x55cb4c[_0x2dc2('0x39')],{'$or':_['map'](_0x22a983,function(_0x20342c){if(_0x20342c['type']!==_0x2dc2('0x3a')){var _0x4233e5={};_0x4233e5[_0x20342c[_0x2dc2('0x26')]]={'$like':'%'+_0x3479e4[_0x2dc2('0x2f')][_0x2dc2('0x3b')]+'%'};return _0x4233e5;}})});}_0x55cb4c=_['merge']({},_0x55cb4c,_0x3479e4[_0x2dc2('0x3c')]);var _0x55c0f2={'where':_0x55cb4c[_0x2dc2('0x39')]};return db[_0x2dc2('0x29')]['count'](_0x55c0f2)[_0x2dc2('0x22')](function(_0x44fd24){_0x1b8f05[_0x2dc2('0x1d')]=_0x44fd24;if(_0x3479e4['query']['includeAll']){_0x55cb4c[_0x2dc2('0x3d')]=[{'all':!![]}];}return db['VoiceRecording'][_0x2dc2('0x3e')](_0x55cb4c);})[_0x2dc2('0x22')](function(_0x466434){_0x1b8f05[_0x2dc2('0x3f')]=_0x466434;return _0x1b8f05;})[_0x2dc2('0x22')](respondWithFilteredResult(_0x58c33b,_0x55cb4c))[_0x2dc2('0x40')](handleError(_0x58c33b,null));};exports[_0x2dc2('0x41')]=function(_0x8d68b3,_0x2fbb09){var _0x558b24={'raw':![],'where':{'id':_0x8d68b3[_0x2dc2('0x42')]['id']}},_0x485d0d={};_0x485d0d['model']=_[_0x2dc2('0x43')](db[_0x2dc2('0x29')][_0x2dc2('0x2a')]);_0x485d0d[_0x2dc2('0x2f')]=_[_0x2dc2('0x43')](_0x8d68b3[_0x2dc2('0x2f')]);_0x485d0d[_0x2dc2('0x30')]=_[_0x2dc2('0x31')](_0x485d0d['model'],_0x485d0d['query']);_0x558b24['attributes']=_[_0x2dc2('0x31')](_0x485d0d[_0x2dc2('0x2c')],qs['fields'](_0x8d68b3['query'][_0x2dc2('0x32')]));_0x558b24['attributes']=_0x558b24['attributes'][_0x2dc2('0x44')]?_0x558b24['attributes']:_0x485d0d['model'];if(_0x8d68b3[_0x2dc2('0x2f')][_0x2dc2('0x45')]){_0x558b24[_0x2dc2('0x3d')]=[{'all':!![]}];}_0x558b24=_[_0x2dc2('0x38')]({},_0x558b24,_0x8d68b3['options']);return db[_0x2dc2('0x29')][_0x2dc2('0x46')](_0x558b24)[_0x2dc2('0x22')](handleEntityNotFound(_0x2fbb09,null))[_0x2dc2('0x22')](respondWithResult(_0x2fbb09,null))[_0x2dc2('0x40')](handleError(_0x2fbb09,null));};exports['create']=function(_0x282a85,_0x45aa65){return db[_0x2dc2('0x29')]['create'](_0x282a85[_0x2dc2('0x47')],{})[_0x2dc2('0x22')](respondWithResult(_0x45aa65,0xc9))[_0x2dc2('0x40')](handleError(_0x45aa65,null));};exports[_0x2dc2('0x21')]=function(_0x28c3a6,_0x26d28b){if(_0x28c3a6[_0x2dc2('0x47')]['id']){delete _0x28c3a6[_0x2dc2('0x47')]['id'];}return db[_0x2dc2('0x29')][_0x2dc2('0x46')]({'where':{'id':_0x28c3a6[_0x2dc2('0x42')]['id']}})[_0x2dc2('0x22')](handleEntityNotFound(_0x26d28b,null))[_0x2dc2('0x22')](saveUpdates(_0x28c3a6[_0x2dc2('0x47')],null))[_0x2dc2('0x22')](respondWithResult(_0x26d28b,null))['catch'](handleError(_0x26d28b,null));};exports[_0x2dc2('0x48')]=function(_0x5ce71d,_0x44412f){return db[_0x2dc2('0x29')][_0x2dc2('0x48')]()[_0x2dc2('0x22')](respondWithResult(_0x44412f,null))[_0x2dc2('0x40')](handleError(_0x44412f,null));};exports[_0x2dc2('0x49')]=function(_0x2a2653,_0x17cf98,_0x47e60c){var _0x40b770=require(_0x2dc2('0x4a'));var _0x5069f2=![];var _0x4d12f0={};if(_0x2a2653[_0x2dc2('0x2f')]['type']&&_0x2a2653[_0x2dc2('0x2f')]['type']===_0x2dc2('0x4b')){_0x4d12f0['uniqueid']=_0x2a2653['params']['id'];}else{_0x4d12f0['id']=_0x2a2653[_0x2dc2('0x42')]['id'];}return db[_0x2dc2('0x29')][_0x2dc2('0x46')]({'where':_0x4d12f0,'attributes':['id','value'],'raw':!![]})[_0x2dc2('0x22')](handleEntityNotFound(_0x17cf98,null))['then'](function(_0x304770){if(_0x304770){var _0x1c1755=_0x304770['value'];var _0xb14797=util['format'](_0x2dc2('0x4c'),_0x1c1755);if(fs[_0x2dc2('0x4d')](_0xb14797)){_0x5069f2=!![];return _0x40b770[_0x2dc2('0x4e')](_0xb14797,_0x1c1755,config['secrets'][_0x2dc2('0x4f')])[_0x2dc2('0x22')](function(){return _0x304770;});}return _0x304770;}})['then'](function(_0x2fa0ff){if(_0x2fa0ff){var _0x3634f7=_0x2fa0ff[_0x2dc2('0x50')];if(!fs[_0x2dc2('0x4d')](_0x3634f7)){throw new db['Sequelize'][(_0x2dc2('0x51'))](_0x2dc2('0x52'));}if(_0x2fa0ff[_0x2dc2('0x53')]){return _0x17cf98[_0x2dc2('0x49')](_0x3634f7,_0x2fa0ff[_0x2dc2('0x53')]+path[_0x2dc2('0x54')](_0x3634f7),function(){if(_0x5069f2){fs[_0x2dc2('0x55')](_0x3634f7);}});}else{return _0x17cf98[_0x2dc2('0x49')](_0x3634f7,function(_0x3a99c7){if(_0x5069f2){fs[_0x2dc2('0x55')](_0x3634f7);}});}}})[_0x2dc2('0x40')](function(_0x4f42e2){if(_0x4f42e2[_0x2dc2('0x56')]===_0x2dc2('0x52')){_0x17cf98[_0x2dc2('0x18')](0x194)[_0x2dc2('0x57')](_0x2dc2('0x58'));}else{return handleError(_0x17cf98,null);}});};exports[_0x2dc2('0x59')]=function(_0x346ec9,_0x1021ca,_0x3a6ab6){var _0x87d6d3=require(_0x2dc2('0x4a'));var _0x49f1e0=![];var _0x4edc93={'$and':[db[_0x2dc2('0x5a')][_0x2dc2('0x39')](db[_0x2dc2('0x5a')]['fn'](_0x2dc2('0x5b'),db['sequelize']['col'](_0x2dc2('0x4b'))),_0x346ec9[_0x2dc2('0x2f')][_0x2dc2('0x5c')])]};if(_0x346ec9[_0x2dc2('0x2f')][_0x2dc2('0x5d')]&&_0x346ec9[_0x2dc2('0x2f')][_0x2dc2('0x5d')]==='uniqueid'){_0x4edc93[_0x2dc2('0x5e')][_0x2dc2('0x5f')]({'uniqueid':_0x346ec9['params']['id']});}else{_0x4edc93['$and'][_0x2dc2('0x5f')]({'id':_0x346ec9[_0x2dc2('0x42')]['id']});}return db[_0x2dc2('0x29')]['find']({'where':_0x4edc93,'attributes':['id','value'],'raw':!![]})[_0x2dc2('0x22')](handleEntityNotFound(_0x1021ca,null))[_0x2dc2('0x22')](function(_0x2430f3){if(_0x2430f3){var _0x451dc6=util[_0x2dc2('0x2e')](_0x2dc2('0x4c'),_0x2430f3[_0x2dc2('0x50')]);if(fs[_0x2dc2('0x4d')](_0x451dc6)){_0x49f1e0=!![];return _0x87d6d3[_0x2dc2('0x4e')](_0x451dc6,_0x2430f3[_0x2dc2('0x50')],config['secrets']['recording'])[_0x2dc2('0x22')](function(){return _0x2430f3;});}return _0x2430f3;}})['then'](function(_0x1a4139){if(_0x1a4139){if(!fs[_0x2dc2('0x4d')](_0x1a4139[_0x2dc2('0x50')])){throw new db[(_0x2dc2('0x60'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x1a4139[_0x2dc2('0x53')]){return _0x1021ca[_0x2dc2('0x49')](_0x1a4139[_0x2dc2('0x50')],_0x1a4139[_0x2dc2('0x53')]+path['extname'](_0x1a4139[_0x2dc2('0x50')]),function(){if(_0x49f1e0){fs[_0x2dc2('0x55')](_0x1a4139[_0x2dc2('0x50')]);}});}else{return _0x1021ca[_0x2dc2('0x49')](_0x1a4139[_0x2dc2('0x50')],function(_0x5010d7){if(_0x49f1e0){fs['unlink'](_0x1a4139['value']);}});}}})[_0x2dc2('0x40')](handleError(_0x1021ca,null));};exports[_0x2dc2('0x23')]=function(_0x519b63,_0x70fbf8){return db[_0x2dc2('0x29')][_0x2dc2('0x46')]({'where':{'id':_0x519b63[_0x2dc2('0x42')]['id']}})[_0x2dc2('0x22')](function(_0x5bb27f){if(_[_0x2dc2('0x61')](_0x5bb27f)){throw new ReferenceError(_0x2dc2('0x62'));}return _0x5bb27f;})[_0x2dc2('0x22')](function(_0x25844e){var _0x165462=_0x25844e[_0x2dc2('0x50')];logger[_0x2dc2('0x63')](_0x2dc2('0x64'),_0x165462);if(!_[_0x2dc2('0x61')](_0x25844e[_0x2dc2('0x50')])&&fs[_0x2dc2('0x4d')](_0x165462)){logger[_0x2dc2('0x63')](_0x2dc2('0x65')+_0x165462+_0x2dc2('0x66'));fs[_0x2dc2('0x67')](_0x165462);}_0x165462=_0x165462+'.cypher';if(!_['isNil'](_0x25844e[_0x2dc2('0x50')])&&fs['existsSync'](_0x165462)){logger['info'](_0x2dc2('0x65')+_0x165462+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x2dc2('0x67')](_0x165462);}return _0x25844e;})['then'](function(_0x427ce8){if(!_0x427ce8)throw new InternalError();return _0x427ce8[_0x2dc2('0x23')]();})['then'](function(){_0x70fbf8[_0x2dc2('0x18')](0xcc)['end']();})[_0x2dc2('0x40')](handleError(_0x70fbf8,null));};function getBucketslist(_0xee8570,_0x4132b8,_0x116741){return new Promise(function(_0x5d1eeb,_0x4947ed){var _0x2fc11a=new AWS['S3']({'accessKeyId':_0x4132b8,'secretAccessKey':_0xee8570,'region':_0x116741});_0x2fc11a[_0x2dc2('0x68')]({},function(_0xf98be,_0x3d8796){if(_0xf98be){return _0x4947ed(_0xf98be);}else{return _0x5d1eeb(_0x3d8796);}});});}function createBucket(_0x1169a9,_0x426aeb,_0x2be341,_0x573fcf){return new Promise(function(_0x352661,_0x2c5383){var _0x191c29=new AWS['S3']({'accessKeyId':_0x426aeb,'secretAccessKey':_0x1169a9,'region':_0x2be341});_0x191c29[_0x2dc2('0x69')]({'Bucket':_0x573fcf},function(_0x108fff,_0x58e701){if(_0x108fff){return _0x2c5383(_0x108fff);}else{return _0x352661(_0x58e701);}});});}function uploadFile(_0x5aa654,_0x4f7647,_0x25aac1,_0x4e0dd6,_0x213cf4,_0x2b9dfa){return new Promise(function(_0x64fd59,_0x5984c0){var _0x5481ab=new AWS['S3']({'accessKeyId':_0x4f7647,'secretAccessKey':_0x5aa654,'region':_0x25aac1});_0x5481ab['upload']({'Bucket':_0x4e0dd6,'Key':_0x213cf4,'Body':_0x2b9dfa},function(_0x174732,_0x55d60f){if(_0x174732){return _0x5984c0(_0x174732);}else{return _0x64fd59(_0x55d60f);}});});}function startTranscribe(_0x4468d6,_0x1e8710,_0x506b0c,_0x90d29c,_0x59c125,_0x3403da){return new Promise(function(_0x17148c,_0x4b9091){var _0xb2e825=new AWS[(_0x2dc2('0x6a'))]({'accessKeyId':_0x1e8710,'secretAccessKey':_0x4468d6,'region':_0x506b0c});_0xb2e825[_0x2dc2('0x6b')]({'TranscriptionJobName':_0x90d29c,'LanguageCode':_0x59c125,'Media':{'MediaFileUri':_0x3403da}},function(_0x7666e1,_0xe3313f){if(_0x7666e1){return _0x4b9091(_0x7666e1);}else{return _0x17148c(_0xe3313f);}});});}function transcribe(_0x34aec0,_0x1e0ce6,_0x1d83a7,_0x513430,_0x25cb31,_0x19d9a4,_0x56a8da){return new Promise(function(_0x4fdc7a,_0x45f44a){var _0xdd414={};logger[_0x2dc2('0x63')](util[_0x2dc2('0x2e')](_0x2dc2('0x6c'),_0x34aec0,_0x25cb31));return uploadFile(_0x1e0ce6,_0x1d83a7,_0x513430,_0x25cb31,path[_0x2dc2('0x6d')](_0x19d9a4),fs[_0x2dc2('0x6e')](_0x19d9a4))[_0x2dc2('0x22')](function(_0x259d79){logger[_0x2dc2('0x63')](util[_0x2dc2('0x2e')](_0x2dc2('0x6f'),_0x34aec0,_0x25cb31,_0x259d79['Location']));_0xdd414[_0x2dc2('0x70')]=_0x259d79[_0x2dc2('0x71')];_0xdd414[_0x2dc2('0x72')]=_0x259d79[_0x2dc2('0x73')];logger[_0x2dc2('0x63')](util[_0x2dc2('0x2e')](_0x2dc2('0x74'),_0x34aec0));return startTranscribe(_0x1e0ce6,_0x1d83a7,_0x513430,uuidv4(),_0x56a8da,_0x259d79[_0x2dc2('0x73')]);})['then'](function(_0x5e214f){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x34aec0,_0x5e214f[_0x2dc2('0x75')][_0x2dc2('0x76')]));_0xdd414[_0x2dc2('0x77')]=_0x5e214f[_0x2dc2('0x75')][_0x2dc2('0x76')];_0xdd414[_0x2dc2('0x78')]=_0x5e214f['TranscriptionJob'][_0x2dc2('0x79')];return _0x4fdc7a(_0xdd414);})[_0x2dc2('0x40')](function(_0x15cfd3){return _0x45f44a(_0x15cfd3);});});}exports[_0x2dc2('0x7a')]=function(_0x38785e,_0x2d9d38,_0x1242c8){var _0x33561e;var _0x127ab0;var _0x1df31b;var _0x29074f=require('../../components/encryptor');return db[_0x2dc2('0x29')][_0x2dc2('0x7b')]({'where':{'id':_0x38785e[_0x2dc2('0x42')]['id']}})['then'](function(_0x11d2a6){if(_0x11d2a6){var _0x964784=util[_0x2dc2('0x2e')]('%s.cypher',_0x11d2a6[_0x2dc2('0x50')]);if(fs[_0x2dc2('0x4d')](_0x964784)){cypher=!![];return _0x29074f[_0x2dc2('0x4e')](_0x964784,_0x11d2a6[_0x2dc2('0x50')],config[_0x2dc2('0x7c')][_0x2dc2('0x4f')])['then'](function(){return _0x11d2a6;});}return _0x11d2a6;}})[_0x2dc2('0x22')](function(_0x23f1c5){if(!_0x23f1c5){throw new db[(_0x2dc2('0x60'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x127ab0=_0x23f1c5;return db['Setting'][_0x2dc2('0x7b')]({'where':{'id':0x1}});})[_0x2dc2('0x22')](handleEntityNotFound(_0x2d9d38,null))['then'](function(_0x315dcc){if(_0x315dcc){_0x33561e=_0x315dcc;if(!_0x33561e[_0x2dc2('0x7d')]||!_0x33561e[_0x2dc2('0x7e')]||!_0x33561e['transcribeRegion']||!_0x33561e[_0x2dc2('0x7f')]||!_0x33561e[_0x2dc2('0x70')]){throw new db[(_0x2dc2('0x60'))][(_0x2dc2('0x51'))](_0x2dc2('0x80'));}if(_0x38785e[_0x2dc2('0x47')][_0x2dc2('0x81')]&&(!_0x33561e[_0x2dc2('0x82')]||!_0x33561e[_0x2dc2('0x83')]||!_0x33561e[_0x2dc2('0x84')]||!_0x33561e[_0x2dc2('0x7f')]||!_0x33561e[_0x2dc2('0x70')])){throw new db[(_0x2dc2('0x60'))][(_0x2dc2('0x51'))](_0x2dc2('0x85'));}return db['CloudProvider'][_0x2dc2('0x7b')]({'where':{'id':_0x33561e[_0x2dc2('0x7e')]}});}})[_0x2dc2('0x22')](function(_0x1e91b4){if(!_0x1e91b4){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x1e91b4[_0x2dc2('0x86')]||!_0x1e91b4['data2']){throw new db[(_0x2dc2('0x60'))][(_0x2dc2('0x51'))](_0x2dc2('0x87'));}_0x1df31b=_0x1e91b4;return getBucketslist(_0x1df31b[_0x2dc2('0x86')],_0x1df31b[_0x2dc2('0x88')],_0x33561e['transcribeRegion']);})['then'](function(_0x1b4377){if(_0x1b4377&&_0x1b4377[_0x2dc2('0x89')]){var _0xde2a6e=_['find'](_0x1b4377['Buckets'],function(_0x525341){return _0x525341[_0x2dc2('0x8a')]===_0x33561e[_0x2dc2('0x70')];});if(!_0xde2a6e){logger[_0x2dc2('0x63')](util[_0x2dc2('0x2e')](_0x2dc2('0x8b'),_0x38785e[_0x2dc2('0x42')]['id'],_0x33561e[_0x2dc2('0x70')]));return createBucket(_0x1df31b[_0x2dc2('0x86')],_0x1df31b[_0x2dc2('0x88')],_0x33561e[_0x2dc2('0x8c')],_0x33561e[_0x2dc2('0x70')]);}logger['info'](util[_0x2dc2('0x2e')](_0x2dc2('0x8d'),_0x38785e[_0x2dc2('0x42')]['id'],_0x33561e['bucket']));return;}})['then'](function(_0x3d5618){if(_0x127ab0[_0x2dc2('0x78')]===_0x2dc2('0x8e')){return transcribe(_0x38785e['params']['id'],_0x1df31b['data1'],_0x1df31b[_0x2dc2('0x88')],_0x33561e[_0x2dc2('0x8c')],_0x33561e[_0x2dc2('0x70')],_0x127ab0[_0x2dc2('0x50')],_0x33561e[_0x2dc2('0x7f')]);}else{logger[_0x2dc2('0x63')](util[_0x2dc2('0x2e')](_0x2dc2('0x8f'),_0x38785e[_0x2dc2('0x42')]['id']));return{'transcribeStatus':_0x2dc2('0x90')};}})['then'](function(_0x30f7a0){if(_0x30f7a0){_0x30f7a0[_0x2dc2('0x91')]=_0x38785e[_0x2dc2('0x47')][_0x2dc2('0x81')];return _0x127ab0[_0x2dc2('0x92')](_0x30f7a0);}})[_0x2dc2('0x22')](respondWithResult(_0x2d9d38,null))[_0x2dc2('0x40')](handleError(_0x2d9d38,null));};function writeFile(_0x814d3c,_0x123a5e){return new Promise(function(_0x5055fe,_0x4a92bf){fs[_0x2dc2('0x93')](_0x123a5e,_0x814d3c,function(_0x309881,_0x14a6ea){if(_0x309881){return _0x4a92bf(_0x309881);}else{return _0x5055fe(_0x14a6ea);}});});}exports[_0x2dc2('0x94')]=function(_0x28b3c6,_0x178922,_0x21d01b){return db[_0x2dc2('0x29')][_0x2dc2('0x7b')]({'where':{'id':_0x28b3c6[_0x2dc2('0x42')]['id']}})[_0x2dc2('0x22')](handleEntityNotFound(_0x178922))[_0x2dc2('0x22')](function(_0x2e4170){if(_0x2e4170&&_0x2e4170[_0x2dc2('0x95')]){var _0x2934b8=_0x2e4170[_0x2dc2('0x95')];var _0x265292=config['root']+_0x2dc2('0x96')+_0x2e4170['id']+_0x2dc2('0x97');if(fs[_0x2dc2('0x4d')](_0x265292)){return _0x265292;}return writeFile(_0x2934b8,_0x265292)[_0x2dc2('0x22')](function(){return _0x265292;});}else{throw new db[(_0x2dc2('0x60'))][(_0x2dc2('0x51'))](_0x2dc2('0x98'));}})[_0x2dc2('0x22')](function(_0x2baa69){return _0x178922['download'](_0x2baa69);})[_0x2dc2('0x40')](handleError(_0x178922));}; \ No newline at end of file +var _0x6fda=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','reject','update','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','differenceBy','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','include','findAll','rows','catch','params','includeAll','find','create','body','describe','../../components/encryptor','uniqueid','value','decryptFile','secrets','recording','existsSync','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','sequelize','MD5','col','token','$and','push','format','%s.cypher','ValidationError','download','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','isNil','unlinkSync','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','runSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','aws-sdk','uuid/v4','../../components/parsers/qs'];(function(_0x282ccc,_0x5d66a1){var _0x27c2dd=function(_0x58431a){while(--_0x58431a){_0x282ccc['push'](_0x282ccc['shift']());}};_0x27c2dd(++_0x5d66a1);}(_0x6fda,0x1c4));var _0xa6fd=function(_0x6e9d83,_0x36225b){_0x6e9d83=_0x6e9d83-0x0;var _0xca3bbe=_0x6fda[_0x6e9d83];return _0xca3bbe;};'use strict';var emlformat=require(_0xa6fd('0x0'));var rimraf=require(_0xa6fd('0x1'));var zipdir=require(_0xa6fd('0x2'));var jsonpatch=require(_0xa6fd('0x3'));var rp=require(_0xa6fd('0x4'));var moment=require(_0xa6fd('0x5'));var BPromise=require(_0xa6fd('0x6'));var Mustache=require('mustache');var util=require(_0xa6fd('0x7'));var path=require(_0xa6fd('0x8'));var sox=require(_0xa6fd('0x9'));var csv=require(_0xa6fd('0xa'));var ejs=require(_0xa6fd('0xb'));var fs=require('fs');var fs_extra=require(_0xa6fd('0xc'));var _=require(_0xa6fd('0xd'));var squel=require(_0xa6fd('0xe'));var crypto=require(_0xa6fd('0xf'));var jsforce=require(_0xa6fd('0x10'));var deskjs=require(_0xa6fd('0x11'));var toCsv=require('to-csv');var querystring=require(_0xa6fd('0x12'));var Papa=require('papaparse');var AWS=require(_0xa6fd('0x13'));var uuidv4=require(_0xa6fd('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa6fd('0x15'));var as=require(_0xa6fd('0x16'));var hardwareService=require(_0xa6fd('0x17'));var logger=require(_0xa6fd('0x18'))(_0xa6fd('0x19'));var utils=require(_0xa6fd('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xa6fd('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39bda1,_0x186e52){_0x186e52=_0x186e52||0xcc;return function(_0x33d80f){if(_0x33d80f){return _0x39bda1[_0xa6fd('0x1c')](_0x186e52);}return _0x39bda1[_0xa6fd('0x1d')](_0x186e52)[_0xa6fd('0x1e')]();};}function respondWithResult(_0x22e80b,_0x5f212e){_0x5f212e=_0x5f212e||0xc8;return function(_0xe89003){if(_0xe89003){return _0x22e80b[_0xa6fd('0x1d')](_0x5f212e)['json'](_0xe89003);}};}function respondWithFilteredResult(_0x57b2a2,_0x10ea77){return function(_0x303173){if(_0x303173){var _0x287c3a=typeof _0x10ea77['offset']===_0xa6fd('0x1f')&&typeof _0x10ea77[_0xa6fd('0x20')]===_0xa6fd('0x1f');var _0x2b2347=_0x303173[_0xa6fd('0x21')];var _0x306285=_0x287c3a?0x0:_0x10ea77['offset'];var _0x2f55a7=_0x287c3a?_0x303173[_0xa6fd('0x21')]:_0x10ea77[_0xa6fd('0x22')]+_0x10ea77[_0xa6fd('0x20')];var _0x5e2c2b;if(_0x2f55a7>=_0x2b2347){_0x2f55a7=_0x2b2347;_0x5e2c2b=0xc8;}else{_0x5e2c2b=0xce;}_0x57b2a2['status'](_0x5e2c2b);return _0x57b2a2[_0xa6fd('0x23')](_0xa6fd('0x24'),_0x306285+'-'+_0x2f55a7+'/'+_0x2b2347)[_0xa6fd('0x25')](_0x303173);}return null;};}function patchUpdates(_0x1df2a3){return function(_0xec7a2c){try{jsonpatch['apply'](_0xec7a2c,_0x1df2a3,!![]);}catch(_0x30bef1){return BPromise[_0xa6fd('0x26')](_0x30bef1);}return _0xec7a2c['save']();};}function saveUpdates(_0x303350,_0x26b45f){return function(_0x10a66e){if(_0x10a66e){return _0x10a66e[_0xa6fd('0x27')](_0x303350)['then'](function(_0x559c9e){return _0x559c9e;});}return null;};}function removeEntity(_0x10e847,_0x36f902){return function(_0x3905b2){if(_0x3905b2){return _0x3905b2[_0xa6fd('0x28')]()['then'](function(){_0x10e847[_0xa6fd('0x1d')](0xcc)[_0xa6fd('0x1e')]();});}};}function handleEntityNotFound(_0x3e5f45,_0xe043cf){return function(_0x40f935){if(!_0x40f935){_0x3e5f45['sendStatus'](0x194);}return _0x40f935;};}function handleError(_0x382a45,_0x36d818){_0x36d818=_0x36d818||0x1f4;return function(_0x92bdc8){logger[_0xa6fd('0x29')](_0x92bdc8[_0xa6fd('0x2a')]);if(_0x92bdc8['name']){delete _0x92bdc8[_0xa6fd('0x2b')];}_0x382a45[_0xa6fd('0x1d')](_0x36d818)[_0xa6fd('0x2c')](_0x92bdc8);};}exports[_0xa6fd('0x2d')]=function(_0x5cfdd2,_0x21d10f){var _0x596aa0={},_0x23bbd8={},_0xefe42b={'count':0x0,'rows':[]};var _0x5655dc=_[_0xa6fd('0x2e')](db[_0xa6fd('0x2f')][_0xa6fd('0x30')],function(_0x3ee6ce){return{'name':_0x3ee6ce[_0xa6fd('0x31')],'type':_0x3ee6ce[_0xa6fd('0x32')]['key']};});_0x23bbd8['model']=_[_0xa6fd('0x33')](_[_0xa6fd('0x2e')](_0x5655dc,_0xa6fd('0x2b')),['format']);_0x23bbd8[_0xa6fd('0x34')]=_[_0xa6fd('0x35')](_0x5cfdd2['query']);_0x23bbd8[_0xa6fd('0x36')]=_[_0xa6fd('0x37')](_0x23bbd8[_0xa6fd('0x38')],_0x23bbd8[_0xa6fd('0x34')]);_0x596aa0[_0xa6fd('0x39')]=_[_0xa6fd('0x37')](_0x23bbd8['model'],qs[_0xa6fd('0x3a')](_0x5cfdd2[_0xa6fd('0x34')][_0xa6fd('0x3a')]));_0x596aa0[_0xa6fd('0x39')]=_0x596aa0['attributes']['length']?_0x596aa0[_0xa6fd('0x39')]:_0x23bbd8['model'];if(!_0x5cfdd2['query'][_0xa6fd('0x3b')](_0xa6fd('0x3c'))){_0x596aa0[_0xa6fd('0x20')]=qs['limit'](_0x5cfdd2[_0xa6fd('0x34')]['limit']);_0x596aa0[_0xa6fd('0x22')]=qs['offset'](_0x5cfdd2[_0xa6fd('0x34')][_0xa6fd('0x22')]);}_0x596aa0[_0xa6fd('0x3d')]=qs[_0xa6fd('0x3e')](_0x5cfdd2['query'][_0xa6fd('0x3e')]);_0x596aa0[_0xa6fd('0x3f')]=qs[_0xa6fd('0x36')](_[_0xa6fd('0x40')](_0x5cfdd2[_0xa6fd('0x34')],_0x23bbd8[_0xa6fd('0x36')]),_0x5655dc);if(_0x5cfdd2[_0xa6fd('0x34')][_0xa6fd('0x41')]){_0x596aa0[_0xa6fd('0x3f')]=_[_0xa6fd('0x42')](_0x596aa0[_0xa6fd('0x3f')],{'$or':_[_0xa6fd('0x2e')](_0x5655dc,function(_0x17f14f){if(_0x17f14f['type']!==_0xa6fd('0x43')){var _0x1c7d67={};_0x1c7d67[_0x17f14f[_0xa6fd('0x2b')]]={'$like':'%'+_0x5cfdd2[_0xa6fd('0x34')][_0xa6fd('0x41')]+'%'};return _0x1c7d67;}})});}_0x596aa0=_[_0xa6fd('0x42')]({},_0x596aa0,_0x5cfdd2[_0xa6fd('0x44')]);var _0xd54bab={'where':_0x596aa0['where']};return db[_0xa6fd('0x2f')]['count'](_0xd54bab)[_0xa6fd('0x45')](function(_0x3d4ced){_0xefe42b[_0xa6fd('0x21')]=_0x3d4ced;if(_0x5cfdd2['query']['includeAll']){_0x596aa0[_0xa6fd('0x46')]=[{'all':!![]}];}return db[_0xa6fd('0x2f')][_0xa6fd('0x47')](_0x596aa0);})[_0xa6fd('0x45')](function(_0x4c8c9e){_0xefe42b[_0xa6fd('0x48')]=_0x4c8c9e;return _0xefe42b;})[_0xa6fd('0x45')](respondWithFilteredResult(_0x21d10f,_0x596aa0))[_0xa6fd('0x49')](handleError(_0x21d10f,null));};exports['show']=function(_0x116f3e,_0xcb751c){var _0x13f874={'raw':![],'where':{'id':_0x116f3e[_0xa6fd('0x4a')]['id']}},_0x7f520={};_0x7f520['model']=_[_0xa6fd('0x35')](db[_0xa6fd('0x2f')][_0xa6fd('0x30')]);_0x7f520[_0xa6fd('0x34')]=_[_0xa6fd('0x35')](_0x116f3e['query']);_0x7f520[_0xa6fd('0x36')]=_[_0xa6fd('0x37')](_0x7f520[_0xa6fd('0x38')],_0x7f520['query']);_0x13f874[_0xa6fd('0x39')]=_['intersection'](_0x7f520[_0xa6fd('0x38')],qs['fields'](_0x116f3e['query'][_0xa6fd('0x3a')]));_0x13f874[_0xa6fd('0x39')]=_0x13f874[_0xa6fd('0x39')]['length']?_0x13f874[_0xa6fd('0x39')]:_0x7f520[_0xa6fd('0x38')];if(_0x116f3e[_0xa6fd('0x34')][_0xa6fd('0x4b')]){_0x13f874[_0xa6fd('0x46')]=[{'all':!![]}];}_0x13f874=_['merge']({},_0x13f874,_0x116f3e[_0xa6fd('0x44')]);return db[_0xa6fd('0x2f')][_0xa6fd('0x4c')](_0x13f874)[_0xa6fd('0x45')](handleEntityNotFound(_0xcb751c,null))[_0xa6fd('0x45')](respondWithResult(_0xcb751c,null))[_0xa6fd('0x49')](handleError(_0xcb751c,null));};exports['create']=function(_0x1d451f,_0x2e0903){return db[_0xa6fd('0x2f')][_0xa6fd('0x4d')](_0x1d451f[_0xa6fd('0x4e')],{})[_0xa6fd('0x45')](respondWithResult(_0x2e0903,0xc9))[_0xa6fd('0x49')](handleError(_0x2e0903,null));};exports[_0xa6fd('0x27')]=function(_0x123b41,_0x466eb9){if(_0x123b41[_0xa6fd('0x4e')]['id']){delete _0x123b41[_0xa6fd('0x4e')]['id'];}return db[_0xa6fd('0x2f')][_0xa6fd('0x4c')]({'where':{'id':_0x123b41[_0xa6fd('0x4a')]['id']}})[_0xa6fd('0x45')](handleEntityNotFound(_0x466eb9,null))[_0xa6fd('0x45')](saveUpdates(_0x123b41[_0xa6fd('0x4e')],null))['then'](respondWithResult(_0x466eb9,null))[_0xa6fd('0x49')](handleError(_0x466eb9,null));};exports[_0xa6fd('0x4f')]=function(_0x27f393,_0x1c81a0){return db['VoiceRecording'][_0xa6fd('0x4f')]()['then'](respondWithResult(_0x1c81a0,null))[_0xa6fd('0x49')](handleError(_0x1c81a0,null));};exports['download']=function(_0x16f2bc,_0x4577f8,_0x2e2ec5){var _0x35eca6=require(_0xa6fd('0x50'));var _0x35e248=![];var _0x168e96={};if(_0x16f2bc['query']['type']&&_0x16f2bc['query'][_0xa6fd('0x32')]===_0xa6fd('0x51')){_0x168e96['uniqueid']=_0x16f2bc[_0xa6fd('0x4a')]['id'];}else{_0x168e96['id']=_0x16f2bc[_0xa6fd('0x4a')]['id'];}return db[_0xa6fd('0x2f')][_0xa6fd('0x4c')]({'where':_0x168e96,'attributes':['id',_0xa6fd('0x52')],'raw':!![]})[_0xa6fd('0x45')](handleEntityNotFound(_0x4577f8,null))[_0xa6fd('0x45')](function(_0x57f60e){if(_0x57f60e){var _0x2e19e0=_0x57f60e[_0xa6fd('0x52')];var _0x5458d7=util['format']('%s.cypher',_0x2e19e0);if(fs['existsSync'](_0x5458d7)){_0x35e248=!![];return _0x35eca6[_0xa6fd('0x53')](_0x5458d7,_0x2e19e0,config[_0xa6fd('0x54')][_0xa6fd('0x55')])[_0xa6fd('0x45')](function(){return _0x57f60e;});}return _0x57f60e;}})[_0xa6fd('0x45')](function(_0x3399c0){if(_0x3399c0){var _0x5276e4=_0x3399c0[_0xa6fd('0x52')];if(!fs[_0xa6fd('0x56')](_0x5276e4)){throw new db[(_0xa6fd('0x57'))]['ValidationError'](_0xa6fd('0x58'));}if(_0x3399c0[_0xa6fd('0x59')]){return _0x4577f8['download'](_0x5276e4,_0x3399c0[_0xa6fd('0x59')]+path[_0xa6fd('0x5a')](_0x5276e4),function(){if(_0x35e248){fs[_0xa6fd('0x5b')](_0x5276e4);}});}else{return _0x4577f8['download'](_0x5276e4,function(_0x451328){if(_0x35e248){fs[_0xa6fd('0x5b')](_0x5276e4);}});}}})[_0xa6fd('0x49')](function(_0x5a089c){if(_0x5a089c[_0xa6fd('0x5c')]==='VoiceRecording\x20not\x20found'){_0x4577f8['status'](0x194)['send'](_0xa6fd('0x5d'));}else{return handleError(_0x4577f8,null);}});};exports['downloads']=function(_0x8f69da,_0x51fc4c,_0x1872f5){var _0x53e670=require(_0xa6fd('0x50'));var _0x3b600c=![];var _0x1852df={'$and':[db['sequelize'][_0xa6fd('0x3f')](db[_0xa6fd('0x5e')]['fn'](_0xa6fd('0x5f'),db[_0xa6fd('0x5e')][_0xa6fd('0x60')](_0xa6fd('0x51'))),_0x8f69da['query'][_0xa6fd('0x61')])]};if(_0x8f69da[_0xa6fd('0x34')][_0xa6fd('0x32')]&&_0x8f69da[_0xa6fd('0x34')]['type']===_0xa6fd('0x51')){_0x1852df[_0xa6fd('0x62')][_0xa6fd('0x63')]({'uniqueid':_0x8f69da[_0xa6fd('0x4a')]['id']});}else{_0x1852df[_0xa6fd('0x62')][_0xa6fd('0x63')]({'id':_0x8f69da[_0xa6fd('0x4a')]['id']});}return db[_0xa6fd('0x2f')][_0xa6fd('0x4c')]({'where':_0x1852df,'attributes':['id',_0xa6fd('0x52')],'raw':!![]})[_0xa6fd('0x45')](handleEntityNotFound(_0x51fc4c,null))[_0xa6fd('0x45')](function(_0x2bcf1e){if(_0x2bcf1e){var _0x467729=util[_0xa6fd('0x64')](_0xa6fd('0x65'),_0x2bcf1e[_0xa6fd('0x52')]);if(fs[_0xa6fd('0x56')](_0x467729)){_0x3b600c=!![];return _0x53e670[_0xa6fd('0x53')](_0x467729,_0x2bcf1e[_0xa6fd('0x52')],config[_0xa6fd('0x54')][_0xa6fd('0x55')])[_0xa6fd('0x45')](function(){return _0x2bcf1e;});}return _0x2bcf1e;}})['then'](function(_0x5d5227){if(_0x5d5227){if(!fs['existsSync'](_0x5d5227[_0xa6fd('0x52')])){throw new db['Sequelize'][(_0xa6fd('0x66'))](_0xa6fd('0x58'));}if(_0x5d5227[_0xa6fd('0x59')]){return _0x51fc4c[_0xa6fd('0x67')](_0x5d5227[_0xa6fd('0x52')],_0x5d5227[_0xa6fd('0x59')]+path[_0xa6fd('0x5a')](_0x5d5227['value']),function(){if(_0x3b600c){fs['unlink'](_0x5d5227[_0xa6fd('0x52')]);}});}else{return _0x51fc4c['download'](_0x5d5227[_0xa6fd('0x52')],function(_0x2483df){if(_0x3b600c){fs[_0xa6fd('0x5b')](_0x5d5227['value']);}});}}})[_0xa6fd('0x49')](handleError(_0x51fc4c,null));};exports[_0xa6fd('0x28')]=function(_0x298501,_0x4a7db5){return db[_0xa6fd('0x2f')][_0xa6fd('0x4c')]({'where':{'id':_0x298501[_0xa6fd('0x4a')]['id']}})[_0xa6fd('0x45')](function(_0x3a42b5){if(_['isNil'](_0x3a42b5)){throw new ReferenceError(_0xa6fd('0x68'));}return _0x3a42b5;})['then'](function(_0x2b9717){var _0x32d7ce=_0x2b9717['value'];logger[_0xa6fd('0x69')]('cancellazione\x20fisica\x20documento\x20%s',_0x32d7ce);if(!_['isNil'](_0x2b9717['value'])&&fs[_0xa6fd('0x56')](_0x32d7ce)){logger[_0xa6fd('0x69')](_0xa6fd('0x6a')+_0x32d7ce+_0xa6fd('0x6b'));fs['unlinkSync'](_0x32d7ce);}_0x32d7ce=_0x32d7ce+_0xa6fd('0x6c');if(!_[_0xa6fd('0x6d')](_0x2b9717[_0xa6fd('0x52')])&&fs[_0xa6fd('0x56')](_0x32d7ce)){logger['info'](_0xa6fd('0x6a')+_0x32d7ce+_0xa6fd('0x6b'));fs[_0xa6fd('0x6e')](_0x32d7ce);}return _0x2b9717;})[_0xa6fd('0x45')](function(_0x132207){if(!_0x132207)throw new InternalError();return _0x132207[_0xa6fd('0x28')]();})[_0xa6fd('0x45')](function(){_0x4a7db5[_0xa6fd('0x1d')](0xcc)[_0xa6fd('0x1e')]();})['catch'](handleError(_0x4a7db5,null));};function getBucketslist(_0x357f33,_0x57a1dd,_0x2f3c1){return new Promise(function(_0x4ffa4b,_0x41da9a){var _0x260d5c=new AWS['S3']({'accessKeyId':_0x57a1dd,'secretAccessKey':_0x357f33,'region':_0x2f3c1});_0x260d5c[_0xa6fd('0x6f')]({},function(_0x26cca1,_0x4c949d){if(_0x26cca1){return _0x41da9a(_0x26cca1);}else{return _0x4ffa4b(_0x4c949d);}});});}function createBucket(_0x1cbe04,_0xdcf888,_0x4ee1e0,_0xcdf8ff){return new Promise(function(_0x3bc660,_0x1d13fb){var _0x523b06=new AWS['S3']({'accessKeyId':_0xdcf888,'secretAccessKey':_0x1cbe04,'region':_0x4ee1e0});_0x523b06['createBucket']({'Bucket':_0xcdf8ff},function(_0x261173,_0x5bb7cf){if(_0x261173){return _0x1d13fb(_0x261173);}else{return _0x3bc660(_0x5bb7cf);}});});}function uploadFile(_0x271a49,_0x3d46d4,_0x546d03,_0x5e296b,_0x300911,_0x527d9c){return new Promise(function(_0x470928,_0x591596){var _0xe2ff3d=new AWS['S3']({'accessKeyId':_0x3d46d4,'secretAccessKey':_0x271a49,'region':_0x546d03});_0xe2ff3d[_0xa6fd('0x70')]({'Bucket':_0x5e296b,'Key':_0x300911,'Body':_0x527d9c},function(_0x3fcf1f,_0x58f6a3){if(_0x3fcf1f){return _0x591596(_0x3fcf1f);}else{return _0x470928(_0x58f6a3);}});});}function startTranscribe(_0xe9053b,_0x324758,_0x46d67a,_0x4e429c,_0x5147de,_0x282cae){return new Promise(function(_0x5236f9,_0x1ba3f5){var _0x477317=new AWS[(_0xa6fd('0x71'))]({'accessKeyId':_0x324758,'secretAccessKey':_0xe9053b,'region':_0x46d67a});_0x477317[_0xa6fd('0x72')]({'TranscriptionJobName':_0x4e429c,'LanguageCode':_0x5147de,'Media':{'MediaFileUri':_0x282cae}},function(_0x54ce22,_0xe98c33){if(_0x54ce22){return _0x1ba3f5(_0x54ce22);}else{return _0x5236f9(_0xe98c33);}});});}function transcribe(_0x20bda7,_0x422238,_0x2502e1,_0x38ceb7,_0x1415cf,_0x32c831,_0x374daa){return new Promise(function(_0x1773dc,_0x4152c7){var _0x29c5e7={};logger[_0xa6fd('0x69')](util['format'](_0xa6fd('0x73'),_0x20bda7,_0x1415cf));return uploadFile(_0x422238,_0x2502e1,_0x38ceb7,_0x1415cf,path[_0xa6fd('0x74')](_0x32c831),fs[_0xa6fd('0x75')](_0x32c831))['then'](function(_0x295daf){logger[_0xa6fd('0x69')](util[_0xa6fd('0x64')](_0xa6fd('0x76'),_0x20bda7,_0x1415cf,_0x295daf[_0xa6fd('0x77')]));_0x29c5e7[_0xa6fd('0x78')]=_0x295daf[_0xa6fd('0x79')];_0x29c5e7[_0xa6fd('0x7a')]=_0x295daf['Location'];logger[_0xa6fd('0x69')](util[_0xa6fd('0x64')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x20bda7));return startTranscribe(_0x422238,_0x2502e1,_0x38ceb7,uuidv4(),_0x374daa,_0x295daf[_0xa6fd('0x77')]);})[_0xa6fd('0x45')](function(_0x8d39b0){logger[_0xa6fd('0x69')](util[_0xa6fd('0x64')](_0xa6fd('0x7b'),_0x20bda7,_0x8d39b0[_0xa6fd('0x7c')][_0xa6fd('0x7d')]));_0x29c5e7['transcribeName']=_0x8d39b0[_0xa6fd('0x7c')]['TranscriptionJobName'];_0x29c5e7[_0xa6fd('0x7e')]=_0x8d39b0[_0xa6fd('0x7c')][_0xa6fd('0x7f')];return _0x1773dc(_0x29c5e7);})[_0xa6fd('0x49')](function(_0x34955b){return _0x4152c7(_0x34955b);});});}exports['runTranscribe']=function(_0x113007,_0x5e421f,_0x23174d){var _0x23d705;var _0x268f11;var _0x42d918;var _0x334499=require('../../components/encryptor');return db['VoiceRecording'][_0xa6fd('0x80')]({'where':{'id':_0x113007[_0xa6fd('0x4a')]['id']}})[_0xa6fd('0x45')](function(_0xa478a5){if(_0xa478a5){var _0x3da696=util[_0xa6fd('0x64')](_0xa6fd('0x65'),_0xa478a5[_0xa6fd('0x52')]);if(fs['existsSync'](_0x3da696)){cypher=!![];return _0x334499[_0xa6fd('0x53')](_0x3da696,_0xa478a5[_0xa6fd('0x52')],config['secrets'][_0xa6fd('0x55')])[_0xa6fd('0x45')](function(){return _0xa478a5;});}return _0xa478a5;}})[_0xa6fd('0x45')](function(_0x4c2ac8){if(!_0x4c2ac8){throw new db['Sequelize'][(_0xa6fd('0x66'))](_0xa6fd('0x81'));}_0x268f11=_0x4c2ac8;return db[_0xa6fd('0x82')]['findOne']({'where':{'id':0x1}});})[_0xa6fd('0x45')](handleEntityNotFound(_0x5e421f,null))['then'](function(_0x388e92){if(_0x388e92){_0x23d705=_0x388e92;if(!_0x23d705['transcribe']||!_0x23d705[_0xa6fd('0x83')]||!_0x23d705['transcribeRegion']||!_0x23d705[_0xa6fd('0x84')]||!_0x23d705[_0xa6fd('0x78')]){throw new db[(_0xa6fd('0x57'))]['ValidationError'](_0xa6fd('0x85'));}if(_0x113007[_0xa6fd('0x4e')]['runSentiment']&&(!_0x23d705[_0xa6fd('0x86')]||!_0x23d705[_0xa6fd('0x87')]||!_0x23d705[_0xa6fd('0x88')]||!_0x23d705[_0xa6fd('0x84')]||!_0x23d705[_0xa6fd('0x78')])){throw new db[(_0xa6fd('0x57'))][(_0xa6fd('0x66'))](_0xa6fd('0x89'));}return db[_0xa6fd('0x8a')][_0xa6fd('0x80')]({'where':{'id':_0x23d705['transcribeAccountId']}});}})[_0xa6fd('0x45')](function(_0x5180f0){if(!_0x5180f0){throw new db[(_0xa6fd('0x57'))][(_0xa6fd('0x66'))](_0xa6fd('0x8b'));}if(!_0x5180f0[_0xa6fd('0x8c')]||!_0x5180f0[_0xa6fd('0x8d')]){throw new db[(_0xa6fd('0x57'))]['ValidationError'](_0xa6fd('0x8e'));}_0x42d918=_0x5180f0;return getBucketslist(_0x42d918['data1'],_0x42d918[_0xa6fd('0x8d')],_0x23d705[_0xa6fd('0x8f')]);})[_0xa6fd('0x45')](function(_0x4cf11a){if(_0x4cf11a&&_0x4cf11a[_0xa6fd('0x90')]){var _0x426c6c=_[_0xa6fd('0x4c')](_0x4cf11a['Buckets'],function(_0x492a3d){return _0x492a3d[_0xa6fd('0x91')]===_0x23d705[_0xa6fd('0x78')];});if(!_0x426c6c){logger[_0xa6fd('0x69')](util[_0xa6fd('0x64')](_0xa6fd('0x92'),_0x113007['params']['id'],_0x23d705['bucket']));return createBucket(_0x42d918['data1'],_0x42d918[_0xa6fd('0x8d')],_0x23d705[_0xa6fd('0x8f')],_0x23d705[_0xa6fd('0x78')]);}logger[_0xa6fd('0x69')](util[_0xa6fd('0x64')](_0xa6fd('0x93'),_0x113007[_0xa6fd('0x4a')]['id'],_0x23d705[_0xa6fd('0x78')]));return;}})['then'](function(_0x431953){if(_0x268f11['transcribeStatus']===_0xa6fd('0x94')){return transcribe(_0x113007[_0xa6fd('0x4a')]['id'],_0x42d918[_0xa6fd('0x8c')],_0x42d918[_0xa6fd('0x8d')],_0x23d705[_0xa6fd('0x8f')],_0x23d705['bucket'],_0x268f11[_0xa6fd('0x52')],_0x23d705[_0xa6fd('0x84')]);}else{logger[_0xa6fd('0x69')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x113007[_0xa6fd('0x4a')]['id']));return{'transcribeStatus':_0xa6fd('0x95')};}})[_0xa6fd('0x45')](function(_0x1cc716){if(_0x1cc716){_0x1cc716['tempSentiment']=_0x113007[_0xa6fd('0x4e')][_0xa6fd('0x96')];return _0x268f11['updateAttributes'](_0x1cc716);}})['then'](respondWithResult(_0x5e421f,null))[_0xa6fd('0x49')](handleError(_0x5e421f,null));};function writeFile(_0x193b8c,_0x2b76f8){return new Promise(function(_0x2c5266,_0x124957){fs[_0xa6fd('0x97')](_0x2b76f8,_0x193b8c,function(_0x9ebfe,_0x412d80){if(_0x9ebfe){return _0x124957(_0x9ebfe);}else{return _0x2c5266(_0x412d80);}});});}exports[_0xa6fd('0x98')]=function(_0x5ed707,_0x9ece5f,_0x20f2b1){return db[_0xa6fd('0x2f')][_0xa6fd('0x80')]({'where':{'id':_0x5ed707[_0xa6fd('0x4a')]['id']}})[_0xa6fd('0x45')](handleEntityNotFound(_0x9ece5f))[_0xa6fd('0x45')](function(_0x589ee4){if(_0x589ee4&&_0x589ee4[_0xa6fd('0x99')]){var _0x4dc46d=_0x589ee4[_0xa6fd('0x99')];var _0x1c6fe4=config[_0xa6fd('0x9a')]+_0xa6fd('0x9b')+_0x589ee4['id']+_0xa6fd('0x9c');if(fs[_0xa6fd('0x56')](_0x1c6fe4)){return _0x1c6fe4;}return writeFile(_0x4dc46d,_0x1c6fe4)[_0xa6fd('0x45')](function(){return _0x1c6fe4;});}else{throw new db[(_0xa6fd('0x57'))]['ValidationError'](_0xa6fd('0x9d'));}})[_0xa6fd('0x45')](function(_0x244307){return _0x9ece5f[_0xa6fd('0x67')](_0x244307);})[_0xa6fd('0x49')](handleError(_0x9ece5f));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index b794682..5555506 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 _0xfb05=['bluebird','request-promise','./voiceRecording.attributes','define','VoiceRecording','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x592cd4,_0x333a29){var _0x10377b=function(_0x45a3a1){while(--_0x45a3a1){_0x592cd4['push'](_0x592cd4['shift']());}};_0x10377b(++_0x333a29);}(_0xfb05,0x1b3));var _0x5fb0=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xfb05[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x5fb0('0x0'));var util=require(_0x5fb0('0x1'));var logger=require(_0x5fb0('0x2'))(_0x5fb0('0x3'));var moment=require(_0x5fb0('0x4'));var BPromise=require(_0x5fb0('0x5'));var rp=require(_0x5fb0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5fb0('0x7'));module['exports']=function(_0x51282a,_0x2dc7b6){return _0x51282a[_0x5fb0('0x8')](_0x5fb0('0x9'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x5fb0('0xa'),'fields':[_0x5fb0('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb9c=['../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2797c6,_0x37421b){var _0x54809f=function(_0x2d100c){while(--_0x2d100c){_0x2797c6['push'](_0x2797c6['shift']());}};_0x54809f(++_0x37421b);}(_0xcb9c,0x110));var _0xccb9=function(_0x8ffac8,_0x57081e){_0x8ffac8=_0x8ffac8-0x0;var _0x1d390c=_0xcb9c[_0x8ffac8];return _0x1d390c;};'use strict';var _=require(_0xccb9('0x0'));var util=require(_0xccb9('0x1'));var logger=require(_0xccb9('0x2'))(_0xccb9('0x3'));var moment=require(_0xccb9('0x4'));var BPromise=require(_0xccb9('0x5'));var rp=require(_0xccb9('0x6'));var fs=require('fs');var path=require(_0xccb9('0x7'));var rimraf=require('rimraf');var config=require(_0xccb9('0x8'));var attributes=require(_0xccb9('0x9'));module[_0xccb9('0xa')]=function(_0x5bb0e5,_0x34a3da){return _0x5bb0e5[_0xccb9('0xb')](_0xccb9('0xc'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xccb9('0xd'),'fields':[_0xccb9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 5955884..4c935dc 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 _0xa6b0=['create','value','%s.cypher','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','body','options','raw','where','limit','then','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','callRecordingEncryption','VoiceRecording'];(function(_0x341a71,_0x361e5e){var _0x20ea70=function(_0xd0da0f){while(--_0xd0da0f){_0x341a71['push'](_0x341a71['shift']());}};_0x20ea70(++_0x361e5e);}(_0xa6b0,0xaf));var _0x0a6b=function(_0x327cef,_0x47597c){_0x327cef=_0x327cef-0x0;var _0x4916ac=_0xa6b0[_0x327cef];return _0x4916ac;};'use strict';var _=require(_0x0a6b('0x0'));var util=require(_0x0a6b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a6b('0x2'));var fs=require('fs');var Redis=require(_0x0a6b('0x3'));var db=require(_0x0a6b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a6b('0x5'))(_0x0a6b('0x6'));var config=require(_0x0a6b('0x7'));var jayson=require(_0x0a6b('0x8'));var client=jayson[_0x0a6b('0x9')][_0x0a6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b5fb5,_0xa908dd,_0x26f761){return new BPromise(function(_0x340a33,_0x8e89f){return client[_0x0a6b('0xb')](_0x1b5fb5,_0x26f761)['then'](function(_0x493948){logger[_0x0a6b('0xc')](_0x0a6b('0xd'),_0xa908dd,_0x0a6b('0xe'));logger[_0x0a6b('0xf')](_0x0a6b('0x10'),_0xa908dd,_0x0a6b('0xe'),JSON[_0x0a6b('0x11')](_0x493948));if(_0x493948[_0x0a6b('0x12')]){if(_0x493948[_0x0a6b('0x12')][_0x0a6b('0x13')]===0x1f4){logger[_0x0a6b('0x12')](_0x0a6b('0xd'),_0xa908dd,_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);return _0x8e89f(_0x493948['error']['message']);}logger[_0x0a6b('0x12')](_0x0a6b('0xd'),_0xa908dd,_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);return _0x340a33(_0x493948[_0x0a6b('0x12')][_0x0a6b('0x14')]);}else{logger[_0x0a6b('0xc')](_0x0a6b('0xd'),_0xa908dd,_0x0a6b('0xe'));_0x340a33(_0x493948[_0x0a6b('0x15')]['message']);}})[_0x0a6b('0x16')](function(_0x1538f4){logger['error'](_0x0a6b('0xd'),_0xa908dd,_0x1538f4);_0x8e89f(_0x1538f4);});});}exports['UpdateVoiceRecording']=function(_0xcb412){var _0x31f347=this;return new Promise(function(_0x2cb10b,_0x1ad45d){return db['VoiceRecording'][_0x0a6b('0x17')](_0xcb412[_0x0a6b('0x18')],{'raw':_0xcb412['options']?_0xcb412[_0x0a6b('0x19')][_0x0a6b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcb412[_0x0a6b('0x19')]?_0xcb412['options'][_0x0a6b('0x1b')]||null:null,'attributes':_0xcb412[_0x0a6b('0x19')]?_0xcb412[_0x0a6b('0x19')]['attributes']||null:null,'limit':_0xcb412[_0x0a6b('0x19')]?_0xcb412[_0x0a6b('0x19')][_0x0a6b('0x1c')]||null:null})[_0x0a6b('0x1d')](function(_0x122c19){logger['info'](_0x0a6b('0x1e'),_0xcb412);logger[_0x0a6b('0xf')](_0x0a6b('0x1e'),_0xcb412,JSON['stringify'](_0x122c19));_0x2cb10b(_0x122c19);})[_0x0a6b('0x16')](function(_0x2e58fd){logger[_0x0a6b('0x12')](_0x0a6b('0x1e'),_0x2e58fd[_0x0a6b('0x14')],_0xcb412);_0x1ad45d(_0x31f347['error'](0x1f4,_0x2e58fd[_0x0a6b('0x14')]));});});};exports[_0x0a6b('0x1f')]=function(_0x19a653){var _0x4ce9d4=this;return new Promise(function(_0x3a9092,_0x51e760){var _0xecbf0c=require(_0x0a6b('0x20'));var _0x45ae97;return db['Setting']['findOne']({'attributes':['id',_0x0a6b('0x21')],'where':{'id':0x1},'raw':!![]})[_0x0a6b('0x1d')](function(_0x1aecc7){_0x45ae97=_0x1aecc7;return db[_0x0a6b('0x22')][_0x0a6b('0x23')](_0x19a653[_0x0a6b('0x18')]);})['then'](function(_0xa7ab7c){if(_0x45ae97[_0x0a6b('0x21')]&&fs['existsSync'](_0xa7ab7c[_0x0a6b('0x24')])){var _0x554145=util['format'](_0x0a6b('0x25'),_0xa7ab7c[_0x0a6b('0x24')]);return _0xecbf0c[_0x0a6b('0x26')](_0xa7ab7c[_0x0a6b('0x24')],_0x554145,config[_0x0a6b('0x27')]['recording'])['then'](function(){fs[_0x0a6b('0x28')](_0xa7ab7c[_0x0a6b('0x24')]);logger[_0x0a6b('0xc')](_0x0a6b('0x29'));return _0xa7ab7c;});}return _0xa7ab7c;})['then'](function(_0xe2b82b){logger[_0x0a6b('0xc')]('CreateVoiceRecording',_0x19a653);logger['debug'](_0x0a6b('0x1f'),_0x19a653,JSON[_0x0a6b('0x11')](_0xe2b82b));_0x3a9092(_0xe2b82b);})['catch'](function(_0x3c3c23){logger[_0x0a6b('0x12')](_0x0a6b('0x1f'),_0x3c3c23[_0x0a6b('0x14')],_0x19a653);_0x51e760(_0x4ce9d4[_0x0a6b('0x12')](0x1f4,_0x3c3c23[_0x0a6b('0x14')]));});});}; \ No newline at end of file +var _0xacf4=['limit','debug','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes'];(function(_0x9f27a3,_0x3716d9){var _0x1e712e=function(_0x5cb75a){while(--_0x5cb75a){_0x9f27a3['push'](_0x9f27a3['shift']());}};_0x1e712e(++_0x3716d9);}(_0xacf4,0xe7));var _0x4acf=function(_0x6751fa,_0x410198){_0x6751fa=_0x6751fa-0x0;var _0x3f24c1=_0xacf4[_0x6751fa];return _0x3f24c1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4acf('0x0'));var BPromise=require(_0x4acf('0x1'));var rs=require(_0x4acf('0x2'));var fs=require('fs');var Redis=require(_0x4acf('0x3'));var db=require(_0x4acf('0x4'))['db'];var utils=require(_0x4acf('0x5'));var logger=require(_0x4acf('0x6'))('rpc');var config=require(_0x4acf('0x7'));var jayson=require(_0x4acf('0x8'));var client=jayson['client'][_0x4acf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ba08a,_0x649ad2,_0x45a5a4){return new BPromise(function(_0x25d345,_0x50f5f4){return client['request'](_0x2ba08a,_0x45a5a4)[_0x4acf('0xa')](function(_0x59f559){logger[_0x4acf('0xb')](_0x4acf('0xc'),_0x649ad2,_0x4acf('0xd'));logger['debug'](_0x4acf('0xe'),_0x649ad2,_0x4acf('0xd'),JSON['stringify'](_0x59f559));if(_0x59f559['error']){if(_0x59f559[_0x4acf('0xf')]['code']===0x1f4){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x50f5f4(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}logger[_0x4acf('0xf')](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x25d345(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}else{logger['info'](_0x4acf('0xc'),_0x649ad2,'request\x20sent');_0x25d345(_0x59f559[_0x4acf('0x11')][_0x4acf('0x10')]);}})[_0x4acf('0x12')](function(_0x5d934a){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x5d934a);_0x50f5f4(_0x5d934a);});});}exports[_0x4acf('0x13')]=function(_0x240c00){var _0x4b1d93=this;return new Promise(function(_0x2a678b,_0x137302){return db[_0x4acf('0x14')][_0x4acf('0x15')](_0x240c00[_0x4acf('0x16')],{'raw':_0x240c00[_0x4acf('0x17')]?_0x240c00[_0x4acf('0x17')][_0x4acf('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x240c00[_0x4acf('0x17')]?_0x240c00[_0x4acf('0x17')][_0x4acf('0x19')]||null:null,'attributes':_0x240c00['options']?_0x240c00[_0x4acf('0x17')][_0x4acf('0x1a')]||null:null,'limit':_0x240c00['options']?_0x240c00[_0x4acf('0x17')][_0x4acf('0x1b')]||null:null})['then'](function(_0x3b26ac){logger[_0x4acf('0xb')](_0x4acf('0x13'),_0x240c00);logger[_0x4acf('0x1c')]('UpdateVoiceRecording',_0x240c00,JSON[_0x4acf('0x1d')](_0x3b26ac));_0x2a678b(_0x3b26ac);})[_0x4acf('0x12')](function(_0x57e595){logger[_0x4acf('0xf')](_0x4acf('0x13'),_0x57e595['message'],_0x240c00);_0x137302(_0x4b1d93[_0x4acf('0xf')](0x1f4,_0x57e595[_0x4acf('0x10')]));});});};exports[_0x4acf('0x1e')]=function(_0x16458f){var _0x571a30=this;return new Promise(function(_0x50236d,_0x17a756){var _0x3f548a=require(_0x4acf('0x1f'));var _0x42c90c;return db[_0x4acf('0x20')][_0x4acf('0x21')]({'attributes':['id',_0x4acf('0x22')],'where':{'id':0x1},'raw':!![]})[_0x4acf('0xa')](function(_0x382c41){_0x42c90c=_0x382c41;return db[_0x4acf('0x14')]['create'](_0x16458f[_0x4acf('0x16')]);})[_0x4acf('0xa')](function(_0xd027c7){if(_0x42c90c[_0x4acf('0x22')]&&fs[_0x4acf('0x23')](_0xd027c7[_0x4acf('0x24')])){var _0x27384c=util['format'](_0x4acf('0x25'),_0xd027c7[_0x4acf('0x24')]);return _0x3f548a[_0x4acf('0x26')](_0xd027c7['value'],_0x27384c,config[_0x4acf('0x27')][_0x4acf('0x28')])[_0x4acf('0xa')](function(){fs[_0x4acf('0x29')](_0xd027c7['value']);logger[_0x4acf('0xb')](_0x4acf('0x2a'));return _0xd027c7;});}return _0xd027c7;})[_0x4acf('0xa')](function(_0x5e2332){logger[_0x4acf('0xb')](_0x4acf('0x1e'),_0x16458f);logger[_0x4acf('0x1c')](_0x4acf('0x1e'),_0x16458f,JSON[_0x4acf('0x1d')](_0x5e2332));_0x50236d(_0x5e2332);})[_0x4acf('0x12')](function(_0x490880){logger[_0x4acf('0xf')](_0x4acf('0x1e'),_0x490880['message'],_0x16458f);_0x17a756(_0x571a30[_0x4acf('0xf')](0x1f4,_0x490880['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index b20469a..7970c66 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 _0x01b3=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x12644f,_0x230331){var _0x2f5651=function(_0x34995c){while(--_0x34995c){_0x12644f['push'](_0x12644f['shift']());}};_0x2f5651(++_0x230331);}(_0x01b3,0x17f));var _0x301b=function(_0x4b1e23,_0xcc0800){_0x4b1e23=_0x4b1e23-0x0;var _0x58b685=_0x01b3[_0x4b1e23];return _0x58b685;};'use strict';var multer=require(_0x301b('0x0'));var util=require(_0x301b('0x1'));var path=require(_0x301b('0x2'));var timeout=require(_0x301b('0x3'));var express=require(_0x301b('0x4'));var router=express[_0x301b('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x301b('0x6'));var config=require(_0x301b('0x7'));var controller=require(_0x301b('0x8'));router[_0x301b('0x9')]('/',auth[_0x301b('0xa')](),controller['index']);router[_0x301b('0x9')](_0x301b('0xb'),auth[_0x301b('0xa')](),controller[_0x301b('0xc')]);router[_0x301b('0x9')](_0x301b('0xd'),auth['isAuthenticated'](),controller[_0x301b('0xe')]);router[_0x301b('0xf')]('/',auth[_0x301b('0xa')](),controller[_0x301b('0x10')]);router[_0x301b('0x11')](_0x301b('0xd'),auth[_0x301b('0xa')](),controller[_0x301b('0x12')]);router[_0x301b('0x13')](_0x301b('0xd'),auth[_0x301b('0xa')](),controller[_0x301b('0x14')]);module[_0x301b('0x15')]=router; \ No newline at end of file +var _0xf96c=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','get','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x4cdfec,_0x3baeb5){var _0x2e6eaf=function(_0xd01795){while(--_0xd01795){_0x4cdfec['push'](_0x4cdfec['shift']());}};_0x2e6eaf(++_0x3baeb5);}(_0xf96c,0x1db));var _0xcf96=function(_0x2beb6b,_0x1b7bc0){_0x2beb6b=_0x2beb6b-0x0;var _0x195e6b=_0xf96c[_0x2beb6b];return _0x195e6b;};'use strict';var multer=require(_0xcf96('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcf96('0x1'));var router=express[_0xcf96('0x2')]();var fs_extra=require(_0xcf96('0x3'));var auth=require(_0xcf96('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcf96('0x5'));var controller=require(_0xcf96('0x6'));router['get']('/',auth[_0xcf96('0x7')](),controller['index']);router[_0xcf96('0x8')]('/describe',auth[_0xcf96('0x7')](),controller['describe']);router[_0xcf96('0x8')](_0xcf96('0x9'),auth[_0xcf96('0x7')](),controller['show']);router[_0xcf96('0xa')]('/',auth[_0xcf96('0x7')](),controller[_0xcf96('0xb')]);router[_0xcf96('0xc')](_0xcf96('0x9'),auth[_0xcf96('0x7')](),controller[_0xcf96('0xd')]);router[_0xcf96('0xe')]('/:id',auth[_0xcf96('0x7')](),controller[_0xcf96('0xf')]);module[_0xcf96('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 cb37414..f0ddd70 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 _0x5a5b=['exports','ENUM','blind','attended','STRING','moment'];(function(_0x235cb0,_0x248eb8){var _0x2b0b30=function(_0x1f8990){while(--_0x1f8990){_0x235cb0['push'](_0x235cb0['shift']());}};_0x2b0b30(++_0x248eb8);}(_0x5a5b,0x137));var _0xb5a5=function(_0x40e12c,_0x5e53e3){_0x40e12c=_0x40e12c-0x0;var _0x221ddc=_0x5a5b[_0x40e12c];return _0x221ddc;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xb5a5('0x0'));module[_0xb5a5('0x1')]={'type':{'type':Sequelize[_0xb5a5('0x2')](_0xb5a5('0x3'),_0xb5a5('0x4'))},'result':{'type':Sequelize[_0xb5a5('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xb5a5('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xb5a5('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xb5a5('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xb5a5('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xb5a5('0x5')]},'transfererlinkedid':{'type':Sequelize[_0xb5a5('0x5')]},'transfereechannel':{'type':Sequelize[_0xb5a5('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xb5a5('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xb5a5('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xb5a5('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xb5a5('0x5')]},'transfereeexten':{'type':Sequelize[_0xb5a5('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xb5a5('0x5')]},'isexternal':{'type':Sequelize[_0xb5a5('0x2')]('Yes','No')},'context':{'type':Sequelize[_0xb5a5('0x5')]},'extension':{'type':Sequelize[_0xb5a5('0x5')]}}; \ No newline at end of file +var _0x942e=['moment','exports','ENUM','blind','STRING','Yes','sequelize'];(function(_0x4bbb8c,_0x1eab24){var _0x480f6c=function(_0x4036dd){while(--_0x4036dd){_0x4bbb8c['push'](_0x4bbb8c['shift']());}};_0x480f6c(++_0x1eab24);}(_0x942e,0xd1));var _0xe942=function(_0x3472b6,_0x356115){_0x3472b6=_0x3472b6-0x0;var _0x3c9c5b=_0x942e[_0x3472b6];return _0x3c9c5b;};'use strict';var Sequelize=require(_0xe942('0x0'));var moment=require(_0xe942('0x1'));module[_0xe942('0x2')]={'type':{'type':Sequelize[_0xe942('0x3')](_0xe942('0x4'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xe942('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xe942('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xe942('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xe942('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xe942('0x5')]},'transferercontext':{'type':Sequelize[_0xe942('0x5')]},'transfererexten':{'type':Sequelize[_0xe942('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xe942('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xe942('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xe942('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xe942('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xe942('0x5')]},'transfereecontext':{'type':Sequelize[_0xe942('0x5')]},'transfereeexten':{'type':Sequelize[_0xe942('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0xe942('0x6'),'No')},'context':{'type':Sequelize[_0xe942('0x5')]},'extension':{'type':Sequelize[_0xe942('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 816346b..3efeaee 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 _0x40d0=['name','send','map','VoiceTransferReport','fieldName','type','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','options','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','json','undefined','limit','count','offset','set','apply','reject','update','then','status','end','stack'];(function(_0x4d7530,_0xdee31){var _0x1afc9e=function(_0x2a0c56){while(--_0x2a0c56){_0x4d7530['push'](_0x4d7530['shift']());}};_0x1afc9e(++_0xdee31);}(_0x40d0,0x6c));var _0x040d=function(_0x28a8e4,_0x91294a){_0x28a8e4=_0x28a8e4-0x0;var _0x127409=_0x40d0[_0x28a8e4];return _0x127409;};'use strict';var emlformat=require(_0x040d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x040d('0x1'));var jsonpatch=require(_0x040d('0x2'));var rp=require('request-promise');var moment=require(_0x040d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x040d('0x4'));var util=require(_0x040d('0x5'));var path=require(_0x040d('0x6'));var sox=require('sox');var csv=require(_0x040d('0x7'));var ejs=require(_0x040d('0x8'));var fs=require('fs');var fs_extra=require(_0x040d('0x9'));var _=require(_0x040d('0xa'));var squel=require(_0x040d('0xb'));var crypto=require(_0x040d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x040d('0xd'));var toCsv=require(_0x040d('0x7'));var querystring=require(_0x040d('0xe'));var Papa=require(_0x040d('0xf'));var Redis=require(_0x040d('0x10'));var authService=require(_0x040d('0x11'));var qs=require(_0x040d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x040d('0x13'));var logger=require(_0x040d('0x14'))(_0x040d('0x15'));var utils=require(_0x040d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x040d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd8659e,_0x5028cd){_0x5028cd=_0x5028cd||0xcc;return function(_0x2af850){if(_0x2af850){return _0xd8659e[_0x040d('0x18')](_0x5028cd);}return _0xd8659e['status'](_0x5028cd)['end']();};}function respondWithResult(_0xb27637,_0x267cc7){_0x267cc7=_0x267cc7||0xc8;return function(_0x2b009d){if(_0x2b009d){return _0xb27637['status'](_0x267cc7)[_0x040d('0x19')](_0x2b009d);}};}function respondWithFilteredResult(_0x3916f1,_0x564b07){return function(_0x23d3a5){if(_0x23d3a5){var _0x56ab89=typeof _0x564b07['offset']===_0x040d('0x1a')&&typeof _0x564b07[_0x040d('0x1b')]===_0x040d('0x1a');var _0x512891=_0x23d3a5[_0x040d('0x1c')];var _0x1daa68=_0x56ab89?0x0:_0x564b07[_0x040d('0x1d')];var _0x164442=_0x56ab89?_0x23d3a5[_0x040d('0x1c')]:_0x564b07[_0x040d('0x1d')]+_0x564b07[_0x040d('0x1b')];var _0x4e5d29;if(_0x164442>=_0x512891){_0x164442=_0x512891;_0x4e5d29=0xc8;}else{_0x4e5d29=0xce;}_0x3916f1['status'](_0x4e5d29);return _0x3916f1[_0x040d('0x1e')]('Content-Range',_0x1daa68+'-'+_0x164442+'/'+_0x512891)[_0x040d('0x19')](_0x23d3a5);}return null;};}function patchUpdates(_0x274c4a){return function(_0x5531ea){try{jsonpatch[_0x040d('0x1f')](_0x5531ea,_0x274c4a,!![]);}catch(_0x306ad2){return BPromise[_0x040d('0x20')](_0x306ad2);}return _0x5531ea['save']();};}function saveUpdates(_0x225428,_0x486551){return function(_0x73eb50){if(_0x73eb50){return _0x73eb50[_0x040d('0x21')](_0x225428)[_0x040d('0x22')](function(_0x4c4115){return _0x4c4115;});}return null;};}function removeEntity(_0x2b6d80,_0x4dd627){return function(_0x13565f){if(_0x13565f){return _0x13565f['destroy']()[_0x040d('0x22')](function(){_0x2b6d80[_0x040d('0x23')](0xcc)[_0x040d('0x24')]();});}};}function handleEntityNotFound(_0x1effd8,_0x55fbf9){return function(_0x570435){if(!_0x570435){_0x1effd8[_0x040d('0x18')](0x194);}return _0x570435;};}function handleError(_0x336f1f,_0x62bf30){_0x62bf30=_0x62bf30||0x1f4;return function(_0x4d4dc0){logger['error'](_0x4d4dc0[_0x040d('0x25')]);if(_0x4d4dc0[_0x040d('0x26')]){delete _0x4d4dc0[_0x040d('0x26')];}_0x336f1f[_0x040d('0x23')](_0x62bf30)[_0x040d('0x27')](_0x4d4dc0);};}exports['index']=function(_0x5a4056,_0x2aa95e){var _0x425180={},_0x2c8284={},_0x15c8fc={'count':0x0,'rows':[]};var _0x26c45b=_[_0x040d('0x28')](db[_0x040d('0x29')]['rawAttributes'],function(_0x59c15a){return{'name':_0x59c15a[_0x040d('0x2a')],'type':_0x59c15a[_0x040d('0x2b')][_0x040d('0x2c')]};});_0x2c8284['model']=_[_0x040d('0x28')](_0x26c45b,_0x040d('0x26'));_0x2c8284[_0x040d('0x2d')]=_[_0x040d('0x2e')](_0x5a4056[_0x040d('0x2d')]);_0x2c8284['filters']=_['intersection'](_0x2c8284[_0x040d('0x2f')],_0x2c8284[_0x040d('0x2d')]);_0x425180[_0x040d('0x30')]=_[_0x040d('0x31')](_0x2c8284['model'],qs[_0x040d('0x32')](_0x5a4056['query'][_0x040d('0x32')]));_0x425180['attributes']=_0x425180['attributes']['length']?_0x425180[_0x040d('0x30')]:_0x2c8284[_0x040d('0x2f')];if(!_0x5a4056[_0x040d('0x2d')][_0x040d('0x33')](_0x040d('0x34'))){_0x425180[_0x040d('0x1b')]=qs['limit'](_0x5a4056[_0x040d('0x2d')][_0x040d('0x1b')]);_0x425180[_0x040d('0x1d')]=qs[_0x040d('0x1d')](_0x5a4056['query']['offset']);}_0x425180[_0x040d('0x35')]=qs['sort'](_0x5a4056[_0x040d('0x2d')]['sort']);_0x425180[_0x040d('0x36')]=qs[_0x040d('0x37')](_[_0x040d('0x38')](_0x5a4056['query'],_0x2c8284[_0x040d('0x37')]),_0x26c45b);if(_0x5a4056['query'][_0x040d('0x39')]){_0x425180['where']=_[_0x040d('0x3a')](_0x425180[_0x040d('0x36')],{'$or':_[_0x040d('0x28')](_0x26c45b,function(_0x322d94){if(_0x322d94[_0x040d('0x2b')]!==_0x040d('0x3b')){var _0x2e5946={};_0x2e5946[_0x322d94[_0x040d('0x26')]]={'$like':'%'+_0x5a4056[_0x040d('0x2d')][_0x040d('0x39')]+'%'};return _0x2e5946;}})});}_0x425180=_[_0x040d('0x3a')]({},_0x425180,_0x5a4056['options']);var _0xa70528={'where':_0x425180['where']};return db[_0x040d('0x29')][_0x040d('0x1c')](_0xa70528)[_0x040d('0x22')](function(_0x113ac9){_0x15c8fc['count']=_0x113ac9;if(_0x5a4056['query'][_0x040d('0x3c')]){_0x425180[_0x040d('0x3d')]=[{'all':!![]}];}return db[_0x040d('0x29')][_0x040d('0x3e')](_0x425180);})[_0x040d('0x22')](function(_0x51c00d){_0x15c8fc['rows']=_0x51c00d;return _0x15c8fc;})['then'](respondWithFilteredResult(_0x2aa95e,_0x425180))[_0x040d('0x3f')](handleError(_0x2aa95e,null));};exports[_0x040d('0x40')]=function(_0x4ed3ac,_0x8cf79d){var _0x2e531a={'raw':!![],'where':{'id':_0x4ed3ac[_0x040d('0x41')]['id']}},_0x228e24={};_0x228e24[_0x040d('0x2f')]=_[_0x040d('0x2e')](db[_0x040d('0x29')][_0x040d('0x42')]);_0x228e24[_0x040d('0x2d')]=_['keys'](_0x4ed3ac[_0x040d('0x2d')]);_0x228e24['filters']=_[_0x040d('0x31')](_0x228e24[_0x040d('0x2f')],_0x228e24[_0x040d('0x2d')]);_0x2e531a[_0x040d('0x30')]=_[_0x040d('0x31')](_0x228e24['model'],qs[_0x040d('0x32')](_0x4ed3ac[_0x040d('0x2d')]['fields']));_0x2e531a[_0x040d('0x30')]=_0x2e531a['attributes']['length']?_0x2e531a[_0x040d('0x30')]:_0x228e24['model'];if(_0x4ed3ac[_0x040d('0x2d')][_0x040d('0x3c')]){_0x2e531a[_0x040d('0x3d')]=[{'all':!![]}];}_0x2e531a=_[_0x040d('0x3a')]({},_0x2e531a,_0x4ed3ac[_0x040d('0x43')]);return db[_0x040d('0x29')][_0x040d('0x44')](_0x2e531a)[_0x040d('0x22')](handleEntityNotFound(_0x8cf79d,null))['then'](respondWithResult(_0x8cf79d,null))['catch'](handleError(_0x8cf79d,null));};exports[_0x040d('0x45')]=function(_0x7b794,_0x5e539d){return db[_0x040d('0x29')][_0x040d('0x45')](_0x7b794[_0x040d('0x46')],{})['then'](respondWithResult(_0x5e539d,0xc9))[_0x040d('0x3f')](handleError(_0x5e539d,null));};exports[_0x040d('0x21')]=function(_0x441d97,_0x2f9f2e){if(_0x441d97[_0x040d('0x46')]['id']){delete _0x441d97['body']['id'];}return db[_0x040d('0x29')]['find']({'where':{'id':_0x441d97[_0x040d('0x41')]['id']}})[_0x040d('0x22')](handleEntityNotFound(_0x2f9f2e,null))[_0x040d('0x22')](saveUpdates(_0x441d97[_0x040d('0x46')],null))[_0x040d('0x22')](respondWithResult(_0x2f9f2e,null))[_0x040d('0x3f')](handleError(_0x2f9f2e,null));};exports[_0x040d('0x47')]=function(_0x511b14,_0x4067b9){return db[_0x040d('0x29')][_0x040d('0x44')]({'where':{'id':_0x511b14['params']['id']}})[_0x040d('0x22')](handleEntityNotFound(_0x4067b9,null))['then'](removeEntity(_0x4067b9,null))[_0x040d('0x3f')](handleError(_0x4067b9,null));};exports[_0x040d('0x48')]=function(_0x3bf48e,_0x17ebcd){return db['VoiceTransferReport'][_0x040d('0x48')]()[_0x040d('0x22')](respondWithResult(_0x17ebcd,null))[_0x040d('0x3f')](handleError(_0x17ebcd,null));}; \ No newline at end of file +var _0xa759=['desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','count','limit','set','Content-Range','update','then','destroy','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','length','find','catch','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x3ce38c,_0x5759ae){var _0x3e3704=function(_0x3fed9c){while(--_0x3fed9c){_0x3ce38c['push'](_0x3ce38c['shift']());}};_0x3e3704(++_0x5759ae);}(_0xa759,0xc5));var _0x9a75=function(_0x2077c2,_0x275ab5){_0x2077c2=_0x2077c2-0x0;var _0x312f9f=_0xa759[_0x2077c2];return _0x312f9f;};'use strict';var emlformat=require(_0x9a75('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9a75('0x1'));var jsonpatch=require(_0x9a75('0x2'));var rp=require(_0x9a75('0x3'));var moment=require('moment');var BPromise=require(_0x9a75('0x4'));var Mustache=require('mustache');var util=require(_0x9a75('0x5'));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('squel');var crypto=require(_0x9a75('0xb'));var jsforce=require(_0x9a75('0xc'));var deskjs=require(_0x9a75('0xd'));var toCsv=require(_0x9a75('0x7'));var querystring=require('querystring');var Papa=require(_0x9a75('0xe'));var Redis=require('ioredis');var authService=require(_0x9a75('0xf'));var qs=require(_0x9a75('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a75('0x11'))(_0x9a75('0x12'));var utils=require('../../config/utils');var config=require(_0x9a75('0x13'));var licenseUtil=require(_0x9a75('0x14'));var db=require(_0x9a75('0x15'))['db'];function respondWithStatusCode(_0x5c373a,_0x3a8090){_0x3a8090=_0x3a8090||0xcc;return function(_0x1472f8){if(_0x1472f8){return _0x5c373a['sendStatus'](_0x3a8090);}return _0x5c373a[_0x9a75('0x16')](_0x3a8090)[_0x9a75('0x17')]();};}function respondWithResult(_0x23b6e8,_0x576956){_0x576956=_0x576956||0xc8;return function(_0x1df5e1){if(_0x1df5e1){return _0x23b6e8['status'](_0x576956)[_0x9a75('0x18')](_0x1df5e1);}};}function respondWithFilteredResult(_0x41187d,_0x22f67a){return function(_0x42ed3f){if(_0x42ed3f){var _0x2c3a9f=typeof _0x22f67a[_0x9a75('0x19')]==='undefined'&&typeof _0x22f67a['limit']==='undefined';var _0x108854=_0x42ed3f['count'];var _0x1dfe0b=_0x2c3a9f?0x0:_0x22f67a[_0x9a75('0x19')];var _0x320ba7=_0x2c3a9f?_0x42ed3f[_0x9a75('0x1a')]:_0x22f67a[_0x9a75('0x19')]+_0x22f67a[_0x9a75('0x1b')];var _0x1d1e1c;if(_0x320ba7>=_0x108854){_0x320ba7=_0x108854;_0x1d1e1c=0xc8;}else{_0x1d1e1c=0xce;}_0x41187d[_0x9a75('0x16')](_0x1d1e1c);return _0x41187d[_0x9a75('0x1c')](_0x9a75('0x1d'),_0x1dfe0b+'-'+_0x320ba7+'/'+_0x108854)[_0x9a75('0x18')](_0x42ed3f);}return null;};}function patchUpdates(_0x285cd2){return function(_0x5d2e0d){try{jsonpatch['apply'](_0x5d2e0d,_0x285cd2,!![]);}catch(_0x59792b){return BPromise['reject'](_0x59792b);}return _0x5d2e0d['save']();};}function saveUpdates(_0x1d3e23,_0x491114){return function(_0x920a26){if(_0x920a26){return _0x920a26[_0x9a75('0x1e')](_0x1d3e23)[_0x9a75('0x1f')](function(_0x2a4f88){return _0x2a4f88;});}return null;};}function removeEntity(_0x34d545,_0x5192b4){return function(_0x34ac0b){if(_0x34ac0b){return _0x34ac0b[_0x9a75('0x20')]()[_0x9a75('0x1f')](function(){_0x34d545['status'](0xcc)[_0x9a75('0x17')]();});}};}function handleEntityNotFound(_0x64dbe4,_0x58d8b5){return function(_0x28681a){if(!_0x28681a){_0x64dbe4['sendStatus'](0x194);}return _0x28681a;};}function handleError(_0x5e3dd0,_0x26af8d){_0x26af8d=_0x26af8d||0x1f4;return function(_0x31ae34){logger[_0x9a75('0x21')](_0x31ae34[_0x9a75('0x22')]);if(_0x31ae34[_0x9a75('0x23')]){delete _0x31ae34[_0x9a75('0x23')];}_0x5e3dd0[_0x9a75('0x16')](_0x26af8d)['send'](_0x31ae34);};}exports[_0x9a75('0x24')]=function(_0x3c734a,_0x4c5169){var _0x3ceab4={},_0x1cac20={},_0x12a3e3={'count':0x0,'rows':[]};var _0x164486=_[_0x9a75('0x25')](db[_0x9a75('0x26')][_0x9a75('0x27')],function(_0x29d7fc){return{'name':_0x29d7fc[_0x9a75('0x28')],'type':_0x29d7fc[_0x9a75('0x29')][_0x9a75('0x2a')]};});_0x1cac20['model']=_[_0x9a75('0x25')](_0x164486,_0x9a75('0x23'));_0x1cac20[_0x9a75('0x2b')]=_[_0x9a75('0x2c')](_0x3c734a['query']);_0x1cac20[_0x9a75('0x2d')]=_[_0x9a75('0x2e')](_0x1cac20[_0x9a75('0x2f')],_0x1cac20[_0x9a75('0x2b')]);_0x3ceab4[_0x9a75('0x30')]=_['intersection'](_0x1cac20[_0x9a75('0x2f')],qs[_0x9a75('0x31')](_0x3c734a[_0x9a75('0x2b')][_0x9a75('0x31')]));_0x3ceab4[_0x9a75('0x30')]=_0x3ceab4[_0x9a75('0x30')]['length']?_0x3ceab4[_0x9a75('0x30')]:_0x1cac20[_0x9a75('0x2f')];if(!_0x3c734a['query']['hasOwnProperty'](_0x9a75('0x32'))){_0x3ceab4[_0x9a75('0x1b')]=qs[_0x9a75('0x1b')](_0x3c734a[_0x9a75('0x2b')][_0x9a75('0x1b')]);_0x3ceab4[_0x9a75('0x19')]=qs[_0x9a75('0x19')](_0x3c734a[_0x9a75('0x2b')]['offset']);}_0x3ceab4[_0x9a75('0x33')]=qs[_0x9a75('0x34')](_0x3c734a[_0x9a75('0x2b')][_0x9a75('0x34')]);_0x3ceab4[_0x9a75('0x35')]=qs[_0x9a75('0x2d')](_[_0x9a75('0x36')](_0x3c734a['query'],_0x1cac20[_0x9a75('0x2d')]),_0x164486);if(_0x3c734a['query'][_0x9a75('0x37')]){_0x3ceab4['where']=_[_0x9a75('0x38')](_0x3ceab4[_0x9a75('0x35')],{'$or':_[_0x9a75('0x25')](_0x164486,function(_0x53bc6b){if(_0x53bc6b[_0x9a75('0x29')]!==_0x9a75('0x39')){var _0x37e77b={};_0x37e77b[_0x53bc6b[_0x9a75('0x23')]]={'$like':'%'+_0x3c734a[_0x9a75('0x2b')]['filter']+'%'};return _0x37e77b;}})});}_0x3ceab4=_[_0x9a75('0x38')]({},_0x3ceab4,_0x3c734a[_0x9a75('0x3a')]);var _0x48226d={'where':_0x3ceab4['where']};return db[_0x9a75('0x26')][_0x9a75('0x1a')](_0x48226d)[_0x9a75('0x1f')](function(_0x2c446d){_0x12a3e3[_0x9a75('0x1a')]=_0x2c446d;if(_0x3c734a['query'][_0x9a75('0x3b')]){_0x3ceab4[_0x9a75('0x3c')]=[{'all':!![]}];}return db[_0x9a75('0x26')]['findAll'](_0x3ceab4);})[_0x9a75('0x1f')](function(_0x1246cd){_0x12a3e3[_0x9a75('0x3d')]=_0x1246cd;return _0x12a3e3;})[_0x9a75('0x1f')](respondWithFilteredResult(_0x4c5169,_0x3ceab4))['catch'](handleError(_0x4c5169,null));};exports[_0x9a75('0x3e')]=function(_0x3bf8fd,_0x312a87){var _0x5a582f={'raw':!![],'where':{'id':_0x3bf8fd['params']['id']}},_0x1976ed={};_0x1976ed[_0x9a75('0x2f')]=_[_0x9a75('0x2c')](db[_0x9a75('0x26')][_0x9a75('0x27')]);_0x1976ed[_0x9a75('0x2b')]=_[_0x9a75('0x2c')](_0x3bf8fd[_0x9a75('0x2b')]);_0x1976ed['filters']=_[_0x9a75('0x2e')](_0x1976ed['model'],_0x1976ed[_0x9a75('0x2b')]);_0x5a582f[_0x9a75('0x30')]=_[_0x9a75('0x2e')](_0x1976ed[_0x9a75('0x2f')],qs['fields'](_0x3bf8fd['query'][_0x9a75('0x31')]));_0x5a582f[_0x9a75('0x30')]=_0x5a582f[_0x9a75('0x30')][_0x9a75('0x3f')]?_0x5a582f[_0x9a75('0x30')]:_0x1976ed[_0x9a75('0x2f')];if(_0x3bf8fd[_0x9a75('0x2b')][_0x9a75('0x3b')]){_0x5a582f[_0x9a75('0x3c')]=[{'all':!![]}];}_0x5a582f=_[_0x9a75('0x38')]({},_0x5a582f,_0x3bf8fd[_0x9a75('0x3a')]);return db[_0x9a75('0x26')][_0x9a75('0x40')](_0x5a582f)['then'](handleEntityNotFound(_0x312a87,null))[_0x9a75('0x1f')](respondWithResult(_0x312a87,null))[_0x9a75('0x41')](handleError(_0x312a87,null));};exports['create']=function(_0x506a42,_0x254539){return db[_0x9a75('0x26')][_0x9a75('0x42')](_0x506a42[_0x9a75('0x43')],{})[_0x9a75('0x1f')](respondWithResult(_0x254539,0xc9))['catch'](handleError(_0x254539,null));};exports[_0x9a75('0x1e')]=function(_0x187496,_0x277b96){if(_0x187496['body']['id']){delete _0x187496[_0x9a75('0x43')]['id'];}return db[_0x9a75('0x26')]['find']({'where':{'id':_0x187496[_0x9a75('0x44')]['id']}})['then'](handleEntityNotFound(_0x277b96,null))[_0x9a75('0x1f')](saveUpdates(_0x187496[_0x9a75('0x43')],null))['then'](respondWithResult(_0x277b96,null))['catch'](handleError(_0x277b96,null));};exports[_0x9a75('0x20')]=function(_0x11c29f,_0x26e44b){return db[_0x9a75('0x26')][_0x9a75('0x40')]({'where':{'id':_0x11c29f[_0x9a75('0x44')]['id']}})[_0x9a75('0x1f')](handleEntityNotFound(_0x26e44b,null))[_0x9a75('0x1f')](removeEntity(_0x26e44b,null))[_0x9a75('0x41')](handleError(_0x26e44b,null));};exports[_0x9a75('0x45')]=function(_0x552159,_0x57b41e){return db[_0x9a75('0x26')][_0x9a75('0x45')]()[_0x9a75('0x1f')](respondWithResult(_0x57b41e,null))['catch'](handleError(_0x57b41e,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index f6220a6..25a9950 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 _0x165d=['api','moment','request-promise','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','../../config/logger'];(function(_0x4d6280,_0x511e97){var _0xe26e4b=function(_0x1848b7){while(--_0x1848b7){_0x4d6280['push'](_0x4d6280['shift']());}};_0xe26e4b(++_0x511e97);}(_0x165d,0xc7));var _0xd165=function(_0x2857f3,_0x5f17c2){_0x2857f3=_0x2857f3-0x0;var _0x52a2a7=_0x165d[_0x2857f3];return _0x52a2a7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd165('0x0'))(_0xd165('0x1'));var moment=require(_0xd165('0x2'));var BPromise=require('bluebird');var rp=require(_0xd165('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd165('0x4'));var attributes=require(_0xd165('0x5'));module[_0xd165('0x6')]=function(_0x2bb258,_0x5103ae){return _0x2bb258[_0xd165('0x7')](_0xd165('0x8'),attributes,{'tableName':_0xd165('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4d62=['util','../../config/logger','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','report_call_transfer','lodash'];(function(_0x2e63e8,_0xed68f5){var _0x3fe904=function(_0x10e876){while(--_0x10e876){_0x2e63e8['push'](_0x2e63e8['shift']());}};_0x3fe904(++_0xed68f5);}(_0x4d62,0x86));var _0x24d6=function(_0x3aaf94,_0x3a753d){_0x3aaf94=_0x3aaf94-0x0;var _0x442c56=_0x4d62[_0x3aaf94];return _0x442c56;};'use strict';var _=require(_0x24d6('0x0'));var util=require(_0x24d6('0x1'));var logger=require(_0x24d6('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x24d6('0x3'));var fs=require('fs');var path=require(_0x24d6('0x4'));var rimraf=require('rimraf');var config=require(_0x24d6('0x5'));var attributes=require(_0x24d6('0x6'));module[_0x24d6('0x7')]=function(_0x15a81b,_0x29d7e2){return _0x15a81b['define']('VoiceTransferReport',attributes,{'tableName':_0x24d6('0x8'),'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 a58ae3f..dc24184 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 _0x50c3=['CreateVoiceTransferReport','VoiceTransferReport','create','body','raw','debug','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x3a6b78,_0x2d62be){var _0x4943d4=function(_0x33ab64){while(--_0x33ab64){_0x3a6b78['push'](_0x3a6b78['shift']());}};_0x4943d4(++_0x2d62be);}(_0x50c3,0x19d));var _0x350c=function(_0x1668b4,_0x4055ec){_0x1668b4=_0x1668b4-0x0;var _0x3e2277=_0x50c3[_0x1668b4];return _0x3e2277;};'use strict';var _=require(_0x350c('0x0'));var util=require('util');var moment=require(_0x350c('0x1'));var BPromise=require(_0x350c('0x2'));var rs=require(_0x350c('0x3'));var fs=require('fs');var Redis=require(_0x350c('0x4'));var db=require(_0x350c('0x5'))['db'];var utils=require(_0x350c('0x6'));var logger=require(_0x350c('0x7'))('rpc');var config=require(_0x350c('0x8'));var jayson=require(_0x350c('0x9'));var client=jayson['client'][_0x350c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbe514e,_0x4dbadb,_0x41c3ee){return new BPromise(function(_0x4fd1eb,_0x7a5d58){return client[_0x350c('0xb')](_0xbe514e,_0x41c3ee)[_0x350c('0xc')](function(_0x446c66){logger[_0x350c('0xd')](_0x350c('0xe'),_0x4dbadb,_0x350c('0xf'));logger['debug'](_0x350c('0x10'),_0x4dbadb,_0x350c('0xf'),JSON[_0x350c('0x11')](_0x446c66));if(_0x446c66[_0x350c('0x12')]){if(_0x446c66[_0x350c('0x12')][_0x350c('0x13')]===0x1f4){logger[_0x350c('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x4dbadb,_0x446c66['error'][_0x350c('0x14')]);return _0x7a5d58(_0x446c66['error']['message']);}logger[_0x350c('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x4dbadb,_0x446c66[_0x350c('0x12')]['message']);return _0x4fd1eb(_0x446c66['error']['message']);}else{logger[_0x350c('0xd')](_0x350c('0xe'),_0x4dbadb,'request\x20sent');_0x4fd1eb(_0x446c66[_0x350c('0x15')][_0x350c('0x14')]);}})['catch'](function(_0x36103d){logger[_0x350c('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x4dbadb,_0x36103d);_0x7a5d58(_0x36103d);});});}exports[_0x350c('0x16')]=function(_0x1d7c9f){var _0x2fe860=this;return new Promise(function(_0xefa9ba,_0x234843){return db[_0x350c('0x17')][_0x350c('0x18')](_0x1d7c9f[_0x350c('0x19')],{'raw':_0x1d7c9f['options']?_0x1d7c9f['options'][_0x350c('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x252dbc){logger[_0x350c('0xd')]('CreateVoiceTransferReport',_0x1d7c9f);logger[_0x350c('0x1b')]('CreateVoiceTransferReport',_0x1d7c9f,JSON[_0x350c('0x11')](_0x252dbc));_0xefa9ba(_0x252dbc);})[_0x350c('0x1c')](function(_0x2f05ac){logger['error']('CreateVoiceTransferReport',_0x2f05ac[_0x350c('0x14')],_0x1d7c9f);_0x234843(_0x2fe860[_0x350c('0x12')](0x1f4,_0x2f05ac[_0x350c('0x14')]));});});}; \ No newline at end of file +var _0xfe49=['http','request','info','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x38a056,_0x215292){var _0x2232cb=function(_0x2c4fed){while(--_0x2c4fed){_0x38a056['push'](_0x38a056['shift']());}};_0x2232cb(++_0x215292);}(_0xfe49,0x1b6));var _0x9fe4=function(_0xbcd110,_0xf3242a){_0xbcd110=_0xbcd110-0x0;var _0xcbcc58=_0xfe49[_0xbcd110];return _0xcbcc58;};'use strict';var _=require(_0x9fe4('0x0'));var util=require(_0x9fe4('0x1'));var moment=require(_0x9fe4('0x2'));var BPromise=require(_0x9fe4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9fe4('0x4'));var db=require(_0x9fe4('0x5'))['db'];var utils=require(_0x9fe4('0x6'));var logger=require('../../config/logger')(_0x9fe4('0x7'));var config=require('../../config/environment');var jayson=require(_0x9fe4('0x8'));var client=jayson[_0x9fe4('0x9')][_0x9fe4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x347c12,_0x311928,_0x5c389e){return new BPromise(function(_0x334000,_0x195cc4){return client[_0x9fe4('0xb')](_0x347c12,_0x5c389e)['then'](function(_0x399572){logger[_0x9fe4('0xc')](_0x9fe4('0xd'),_0x311928,'request\x20sent');logger[_0x9fe4('0xe')](_0x9fe4('0xf'),_0x311928,'request\x20sent',JSON[_0x9fe4('0x10')](_0x399572));if(_0x399572['error']){if(_0x399572[_0x9fe4('0x11')][_0x9fe4('0x12')]===0x1f4){logger['error'](_0x9fe4('0xd'),_0x311928,_0x399572[_0x9fe4('0x11')][_0x9fe4('0x13')]);return _0x195cc4(_0x399572['error'][_0x9fe4('0x13')]);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x311928,_0x399572[_0x9fe4('0x11')]['message']);return _0x334000(_0x399572[_0x9fe4('0x11')]['message']);}else{logger[_0x9fe4('0xc')](_0x9fe4('0xd'),_0x311928,'request\x20sent');_0x334000(_0x399572[_0x9fe4('0x14')][_0x9fe4('0x13')]);}})['catch'](function(_0x198dfc){logger['error'](_0x9fe4('0xd'),_0x311928,_0x198dfc);_0x195cc4(_0x198dfc);});});}exports[_0x9fe4('0x15')]=function(_0x489dd8){var _0x1a6ae7=this;return new Promise(function(_0x2453e0,_0x229e4a){return db[_0x9fe4('0x16')][_0x9fe4('0x17')](_0x489dd8[_0x9fe4('0x18')],{'raw':_0x489dd8[_0x9fe4('0x19')]?_0x489dd8[_0x9fe4('0x19')][_0x9fe4('0x1a')]===undefined?!![]:![]:!![]})[_0x9fe4('0x1b')](function(_0x4475a4){logger['info']('CreateVoiceTransferReport',_0x489dd8);logger[_0x9fe4('0xe')](_0x9fe4('0x15'),_0x489dd8,JSON[_0x9fe4('0x10')](_0x4475a4));_0x2453e0(_0x4475a4);})['catch'](function(_0x81ac82){logger[_0x9fe4('0x11')]('CreateVoiceTransferReport',_0x81ac82[_0x9fe4('0x13')],_0x489dd8);_0x229e4a(_0x1a6ae7[_0x9fe4('0x11')](0x1f4,_0x81ac82[_0x9fe4('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index b4e20ec..d63c53c 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 _0x8864=['/hangup','hangup','/answer','isAuthenticated','answer','/hold','hold','/unhold','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','canUpdate','originate'];(function(_0x31ced5,_0x5d5415){var _0x10d9e5=function(_0x2e51a5){while(--_0x2e51a5){_0x31ced5['push'](_0x31ced5['shift']());}};_0x10d9e5(++_0x5d5415);}(_0x8864,0x172));var _0x4886=function(_0x58ae8a,_0x3c619e){_0x58ae8a=_0x58ae8a-0x0;var _0x2f0b6b=_0x8864[_0x58ae8a];return _0x2f0b6b;};'use strict';var express=require(_0x4886('0x0'));var router=express[_0x4886('0x1')]();var auth=require(_0x4886('0x2'));var controller=require(_0x4886('0x3'));router[_0x4886('0x4')](_0x4886('0x5'),auth['isAuthenticated'](),auth[_0x4886('0x6')](),controller[_0x4886('0x7')]);router[_0x4886('0x4')](_0x4886('0x8'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x4886('0x9')]);router[_0x4886('0x4')](_0x4886('0xa'),auth[_0x4886('0xb')](),auth['canUpdate'](),controller[_0x4886('0xc')]);router['post'](_0x4886('0xd'),auth[_0x4886('0xb')](),auth['canUpdate'](),controller[_0x4886('0xe')]);router['post'](_0x4886('0xf'),auth['isAuthenticated'](),auth[_0x4886('0x6')](),controller['unhold']);router[_0x4886('0x4')]('/calls',auth[_0x4886('0xb')](),auth[_0x4886('0x6')](),controller['calls']);router['post']('/transfer',auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x4886('0x10')]);module[_0x4886('0x11')]=router; \ No newline at end of file +var _0x0557=['hold','/unhold','unhold','transfer','exports','Router','post','/originate','isAuthenticated','canUpdate','answer'];(function(_0x501171,_0x10db1b){var _0x2caa3f=function(_0x50f004){while(--_0x50f004){_0x501171['push'](_0x501171['shift']());}};_0x2caa3f(++_0x10db1b);}(_0x0557,0x1f4));var _0x7055=function(_0x102315,_0xfacbeb){_0x102315=_0x102315-0x0;var _0x222d8b=_0x0557[_0x102315];return _0x222d8b;};'use strict';var express=require('express');var router=express[_0x7055('0x0')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0x7055('0x1')](_0x7055('0x2'),auth[_0x7055('0x3')](),auth['canUpdate'](),controller['originate']);router['post']('/hangup',auth['isAuthenticated'](),auth['canUpdate'](),controller['hangup']);router[_0x7055('0x1')]('/answer',auth['isAuthenticated'](),auth[_0x7055('0x4')](),controller[_0x7055('0x5')]);router[_0x7055('0x1')]('/hold',auth[_0x7055('0x3')](),auth[_0x7055('0x4')](),controller[_0x7055('0x6')]);router[_0x7055('0x1')](_0x7055('0x7'),auth['isAuthenticated'](),auth[_0x7055('0x4')](),controller[_0x7055('0x8')]);router[_0x7055('0x1')]('/calls',auth['isAuthenticated'](),auth[_0x7055('0x4')](),controller['calls']);router['post']('/transfer',auth[_0x7055('0x3')](),auth[_0x7055('0x4')](),controller[_0x7055('0x9')]);module[_0x7055('0xa')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index a1e7932..25b73d4 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 _0x3eec=['webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','length','sessionId\x20','\x20not\x20found!','info','originate\x20fired:','body','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','sessionId','webbar:hangup','hangup\x20executed!','webbar:answer','answer\x20executed!','hold'];(function(_0x8ce9f0,_0x1deb4b){var _0x553b09=function(_0x1a372b){while(--_0x1a372b){_0x8ce9f0['push'](_0x8ce9f0['shift']());}};_0x553b09(++_0x1deb4b);}(_0x3eec,0x1e9));var _0xc3ee=function(_0x280a91,_0x581225){_0x280a91=_0x280a91-0x0;var _0x4e2193=_0x3eec[_0x280a91];return _0x4e2193;};'use strict';var path=require(_0xc3ee('0x0'));var fs=require('fs');var _=require(_0xc3ee('0x1'));var db=require(_0xc3ee('0x2'))['db'];var config=require(_0xc3ee('0x3'));var util=require('util');var BPromise=require(_0xc3ee('0x4'));var jayson=require(_0xc3ee('0x5'));var amiClient=jayson[_0xc3ee('0x6')][_0xc3ee('0x7')]({'port':0x232a});var logger=require(_0xc3ee('0x8'))(_0xc3ee('0x9'));var Redis=require('ioredis');config[_0xc3ee('0xa')]=_[_0xc3ee('0xb')](config[_0xc3ee('0xa')],{'host':_0xc3ee('0xc'),'port':0x18eb});var io=require(_0xc3ee('0xd'))(new Redis(config[_0xc3ee('0xa')]));var Schema=require(_0xc3ee('0xe'));var originateValidation=new Schema({'userId':{'type':_0xc3ee('0xf'),'required':[!![],_0xc3ee('0x10')]},'callNumber':{'type':_0xc3ee('0x11'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0xc3ee('0x11')}});var hangupValidation=new Schema({'userId':{'type':_0xc3ee('0xf'),'required':[!![],_0xc3ee('0x10')]},'sessionId':{'type':_0xc3ee('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc3ee('0x10')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xc3ee('0xf'),'required':[!![],_0xc3ee('0x10')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xc3ee('0x11'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xc3ee('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xc3ee('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc3ee('0x10')]},'sessionId':{'type':_0xc3ee('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xc3ee('0xf'),'required':[!![],_0xc3ee('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0xc3ee('0xf'),'required':[!![],_0xc3ee('0x10')]}});function emit(_0x277e11,_0x4e1c51,_0xbd384b){logger['info'](_0x277e11,_0x4e1c51,JSON[_0xc3ee('0x12')](_0xbd384b));io['to'](_0x277e11)[_0xc3ee('0x13')](_0x4e1c51,_0xbd384b);}function handleError(_0x3fa981){return function(_0x219db0){console[_0xc3ee('0x14')](_0xc3ee('0x15'),_0x219db0,_0x219db0 instanceof RangeError);logger[_0xc3ee('0x16')](_0x219db0[_0xc3ee('0x17')]);if(_0x219db0 instanceof RangeError){if(_0x219db0[_0xc3ee('0x18')]){delete _0x219db0[_0xc3ee('0x18')];}_0x3fa981[_0xc3ee('0x19')](0x194)[_0xc3ee('0x1a')](_0x219db0);}else{if(_0x219db0[_0xc3ee('0x18')]){delete _0x219db0[_0xc3ee('0x18')];}_0x3fa981[_0xc3ee('0x19')](0x1f4)[_0xc3ee('0x1a')](_0x219db0);}};}function checkError(){return function(_0xcd8c18){if(!_0xcd8c18){throw new RangeError(_0xc3ee('0x1b'));}return _0xcd8c18;};}function respondWithRpcPromise(_0x327c45,_0x1c33a7){return new BPromise(function(_0x11778f,_0x493fea){var _0x4d672e=amiClient;return _0x4d672e[_0xc3ee('0x1c')](_0x327c45,_0x1c33a7)[_0xc3ee('0x1d')](function(_0x3b8f75){if(_0x3b8f75[_0xc3ee('0x16')]){if(_0x3b8f75[_0xc3ee('0x16')][_0xc3ee('0x1e')]===0x1f4){return _0x493fea(_0x3b8f75['error'][_0xc3ee('0x1f')]);}return _0x11778f(_0x3b8f75[_0xc3ee('0x16')][_0xc3ee('0x1f')]);}else{_0x11778f(_0x3b8f75[_0xc3ee('0x20')]);}})[_0xc3ee('0x21')](function(_0x525ae5){_0x493fea(_0x525ae5);});});}function getAgent(_0x4c53a5){return db[_0xc3ee('0x22')][_0xc3ee('0x23')]({'where':{'id':_0x4c53a5,'role':_0xc3ee('0x24')}})[_0xc3ee('0x1d')](checkError());}function getAgentCheckSession(_0x836fac,_0x4ecfec){return new BPromise(function(_0x56201a,_0x4e0bc0){var _0x1be005=respondWithRpcPromise(_0xc3ee('0x25'));var _0x44678b=getAgent(_0x836fac);Promise[_0xc3ee('0x26')]([_0x1be005,_0x44678b])[_0xc3ee('0x1d')](function(_0x50ffaa){var _0x13f30d=_0x50ffaa[0x0];var _0xfa3111=_0x50ffaa[0x1];var _0x243b6a=_[_0xc3ee('0x27')](_0x13f30d[_0xc3ee('0x28')],function(_0x8bbe1e){return _0x8bbe1e[_0xc3ee('0x29')]==_0xfa3111['id']&&_0x8bbe1e['sessionId']==_0x4ecfec;});if(_0x243b6a[_0xc3ee('0x2a')]==0x1){_0x56201a(_0xfa3111);}else{_0x4e0bc0(new RangeError(_0xc3ee('0x2b')+_0x4ecfec+_0xc3ee('0x2c')));}});});}exports['originate']=function(_0x69d43e,_0x240a16){logger[_0xc3ee('0x2d')](_0xc3ee('0x2e'),_0x69d43e[_0xc3ee('0x2f')]);var _0x46a8bd=originateValidation[_0xc3ee('0xe')](_0x69d43e['body']);if(_0x46a8bd[_0xc3ee('0x2a')]>0x0){return _0x240a16['status'](0x190)[_0xc3ee('0x30')](_0x46a8bd);}var _0x16a32f=_0x69d43e[_0xc3ee('0x2f')][_0xc3ee('0x31')];var _0x16d14b=_0x69d43e[_0xc3ee('0x2f')]['callNumber'];var _0x198653=_0x69d43e[_0xc3ee('0x2f')][_0xc3ee('0x32')];var _0x363ad0=_0x69d43e[_0xc3ee('0x2f')][_0xc3ee('0x33')];return getAgent(_0x16a32f)[_0xc3ee('0x1d')](function(_0x17d5df){logger[_0xc3ee('0x2d')](_0xc3ee('0x34'),_0x17d5df[_0xc3ee('0x18')]);emit(util[_0xc3ee('0x35')](_0xc3ee('0x36'),_0x17d5df[_0xc3ee('0x18')]),_0xc3ee('0x37'),{'callNumber':_0x16d14b,'callerId':_0x198653,'callbackUrl':_0x363ad0});return _0x240a16[_0xc3ee('0x19')](0xc8)[_0xc3ee('0x30')]({'error':![],'message':_0xc3ee('0x38')});})[_0xc3ee('0x21')](handleError(_0x240a16));};exports[_0xc3ee('0x39')]=function(_0x24f1c8,_0x5756a4){logger[_0xc3ee('0x2d')]('hangup\x20fired:',_0x24f1c8[_0xc3ee('0x2f')]);var _0x29419f=hangupValidation[_0xc3ee('0xe')](_0x24f1c8[_0xc3ee('0x2f')]);if(_0x29419f[_0xc3ee('0x2a')]>0x0){return _0x5756a4[_0xc3ee('0x19')](0x190)['json'](_0x29419f);}var _0x2a80aa=_0x24f1c8[_0xc3ee('0x2f')][_0xc3ee('0x31')];var _0x59224a=_0x24f1c8[_0xc3ee('0x2f')][_0xc3ee('0x3a')];return getAgent(_0x2a80aa)[_0xc3ee('0x1d')](function(_0x1fe17f){logger[_0xc3ee('0x2d')](_0xc3ee('0x34'),_0x1fe17f[_0xc3ee('0x18')]);emit(util[_0xc3ee('0x35')](_0xc3ee('0x36'),_0x1fe17f[_0xc3ee('0x18')]),_0xc3ee('0x3b'),{'sessionId':_0x59224a});return _0x5756a4['status'](0xc8)[_0xc3ee('0x30')]({'error':![],'message':_0xc3ee('0x3c')});})['catch'](handleError(_0x5756a4));};exports['answer']=function(_0x60ae59,_0x45cef7){logger[_0xc3ee('0x2d')]('answer\x20fired:',_0x60ae59[_0xc3ee('0x2f')]);var _0x92a306=answerValidation[_0xc3ee('0xe')](_0x60ae59[_0xc3ee('0x2f')]);if(_0x92a306[_0xc3ee('0x2a')]>0x0){return _0x45cef7[_0xc3ee('0x19')](0x190)[_0xc3ee('0x30')](_0x92a306);}var _0x724c4e=_0x60ae59[_0xc3ee('0x2f')][_0xc3ee('0x31')];var _0xf833d9=_0x60ae59[_0xc3ee('0x2f')][_0xc3ee('0x3a')];return getAgent(_0x724c4e)[_0xc3ee('0x1d')](function(_0x5b7675){logger[_0xc3ee('0x2d')]('entityFound:',_0x5b7675['name']);emit(util[_0xc3ee('0x35')](_0xc3ee('0x36'),_0x5b7675['name']),_0xc3ee('0x3d'),{'sessionId':_0xf833d9});return _0x45cef7[_0xc3ee('0x19')](0xc8)['json']({'error':![],'message':_0xc3ee('0x3e')});})['catch'](handleError(_0x45cef7));};exports[_0xc3ee('0x3f')]=function(_0x4be302,_0x28212e){logger[_0xc3ee('0x2d')]('hold\x20fired:',_0x4be302['body']);var _0x5e54ec=holdValidation[_0xc3ee('0xe')](_0x4be302[_0xc3ee('0x2f')]);if(_0x5e54ec[_0xc3ee('0x2a')]>0x0){return _0x28212e[_0xc3ee('0x19')](0x190)[_0xc3ee('0x30')](_0x5e54ec);}var _0x5b5f5c=_0x4be302['body'][_0xc3ee('0x31')];var _0x27e4fc=_0x4be302['body'][_0xc3ee('0x3a')];return getAgent(_0x5b5f5c)['then'](function(_0x60e36a){logger['info'](_0xc3ee('0x34'),_0x60e36a[_0xc3ee('0x18')]);emit(util[_0xc3ee('0x35')](_0xc3ee('0x36'),_0x60e36a[_0xc3ee('0x18')]),_0xc3ee('0x40'),{'sessionId':_0x27e4fc});return _0x28212e[_0xc3ee('0x19')](0xc8)['json']({'error':![],'message':_0xc3ee('0x41')});})[_0xc3ee('0x21')](handleError(_0x28212e));};exports[_0xc3ee('0x42')]=function(_0x237aa8,_0x47d12c){logger[_0xc3ee('0x2d')](_0xc3ee('0x43'),_0x237aa8[_0xc3ee('0x2f')]);var _0x3264c5=unholdValidation[_0xc3ee('0xe')](_0x237aa8[_0xc3ee('0x2f')]);if(_0x3264c5[_0xc3ee('0x2a')]>0x0){return _0x47d12c['status'](0x190)['json'](_0x3264c5);}var _0x5a0493=_0x237aa8['body'][_0xc3ee('0x31')];var _0x2f3e48=_0x237aa8[_0xc3ee('0x2f')][_0xc3ee('0x3a')];return getAgent(_0x5a0493)[_0xc3ee('0x1d')](function(_0x4d66cc){logger['info'](_0xc3ee('0x34'),_0x4d66cc['name']);emit(util[_0xc3ee('0x35')](_0xc3ee('0x36'),_0x4d66cc[_0xc3ee('0x18')]),'webbar:unhold',{'sessionId':_0x2f3e48});return _0x47d12c[_0xc3ee('0x19')](0xc8)[_0xc3ee('0x30')]({'error':![],'message':_0xc3ee('0x44')});})[_0xc3ee('0x21')](handleError(_0x47d12c));};exports[_0xc3ee('0x45')]=function(_0x343018,_0x44e8fe){logger[_0xc3ee('0x2d')](_0xc3ee('0x46'),_0x44e8fe['body']);var _0x3fdc8f=callsValidation[_0xc3ee('0xe')](_0x343018[_0xc3ee('0x2f')]);if(_0x3fdc8f[_0xc3ee('0x2a')]>0x0){return _0x44e8fe[_0xc3ee('0x19')](0x190)[_0xc3ee('0x30')](_0x3fdc8f);}var _0x33efe6=_0x343018[_0xc3ee('0x2f')][_0xc3ee('0x31')];var _0x18db2e=respondWithRpcPromise(_0xc3ee('0x25'));var _0x314db7=getAgent(_0x33efe6);return Promise[_0xc3ee('0x26')]([_0x18db2e,_0x314db7])['then'](function(_0x2109db){var _0x1f82f2=_0x2109db[0x0];var _0x4595ea=_0x2109db[0x1];var _0x2d417d=_[_0xc3ee('0x27')](_0x1f82f2[_0xc3ee('0x28')],function(_0x4e556e){return _0x4e556e[_0xc3ee('0x29')]==_0x4595ea['id'];});return _0x44e8fe[_0xc3ee('0x19')](0xc8)[_0xc3ee('0x30')]({'count':_0x2d417d[_0xc3ee('0x2a')],'rows':_0x2d417d});})[_0xc3ee('0x21')](handleError(_0x44e8fe));};exports[_0xc3ee('0x47')]=function(_0x199e7f,_0x28af11){logger[_0xc3ee('0x2d')](_0xc3ee('0x48'),_0x199e7f[_0xc3ee('0x2f')]);var _0x29e9f7=conferenceValidation[_0xc3ee('0xe')](_0x199e7f['body']);if(_0x29e9f7['length']>0x0){return _0x28af11['status'](0x190)[_0xc3ee('0x30')](_0x29e9f7);}var _0x5a17fb=_0x199e7f[_0xc3ee('0x2f')][_0xc3ee('0x31')];return getAgent(_0x5a17fb)[_0xc3ee('0x1d')](function(_0x5ca478){logger[_0xc3ee('0x2d')]('entityFound:',_0x5ca478['name']);emit(util[_0xc3ee('0x35')](_0xc3ee('0x36'),_0x5ca478[_0xc3ee('0x18')]),_0xc3ee('0x49'));return _0x28af11[_0xc3ee('0x19')](0xc8)[_0xc3ee('0x30')]({'error':![],'message':_0xc3ee('0x4a')});})[_0xc3ee('0x21')](handleError(_0x28af11));};exports['transfer']=function(_0x3cc785,_0x2e390){logger['info'](_0xc3ee('0x4b'),_0x3cc785[_0xc3ee('0x2f')]);var _0x473a46=transferValidation[_0xc3ee('0xe')](_0x3cc785[_0xc3ee('0x2f')]);if(_0x473a46[_0xc3ee('0x2a')]>0x0){return _0x2e390['status'](0x190)[_0xc3ee('0x30')](_0x473a46);}var _0x1ebab0=_0x3cc785[_0xc3ee('0x2f')][_0xc3ee('0x31')];var _0x1f1816=_0x3cc785[_0xc3ee('0x2f')]['sessionId'];var _0x1082b7=_0x3cc785['body'][_0xc3ee('0x4c')];return getAgent(_0x1ebab0)['then'](function(_0x3d8d2e){logger[_0xc3ee('0x2d')]('entityFound:',_0x3d8d2e['name']);emit(util[_0xc3ee('0x35')](_0xc3ee('0x36'),_0x3d8d2e['name']),_0xc3ee('0x4d'),{'sessionId':_0x1f1816,'transferNumber':_0x1082b7});return _0x2e390[_0xc3ee('0x19')](0xc8)[_0xc3ee('0x30')]({'error':![],'message':_0xc3ee('0x4e')});})[_0xc3ee('0x21')](handleError(_0x2e390));}; \ No newline at end of file +var _0x6282=['sessionId','sessionId\x20','\x20not\x20found!','originate','info','originate\x20fired:','body','length','json','userId','callNumber','callerId','format','user:%s','originate\x20executed!','catch','hangup','hangup\x20fired:','entityFound:','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','all','filter','conference','conference\x20fired:','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','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','stringify','handleError:','error','name','status','send','NotFound','request','then','message','result','User','findOne','agent','VoiceChannels','rows','UserId'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x6282,0x76));var _0x2628=function(_0x4d5e62,_0x26311d){_0x4d5e62=_0x4d5e62-0x0;var _0x3c7ba6=_0x6282[_0x4d5e62];return _0x3c7ba6;};'use strict';var path=require(_0x2628('0x0'));var fs=require('fs');var _=require(_0x2628('0x1'));var db=require(_0x2628('0x2'))['db'];var config=require(_0x2628('0x3'));var util=require('util');var BPromise=require('bluebird');var jayson=require(_0x2628('0x4'));var amiClient=jayson[_0x2628('0x5')]['http']({'port':0x232a});var logger=require(_0x2628('0x6'))(_0x2628('0x7'));var Redis=require(_0x2628('0x8'));config[_0x2628('0x9')]=_[_0x2628('0xa')](config['redis'],{'host':_0x2628('0xb'),'port':0x18eb});var io=require(_0x2628('0xc'))(new Redis(config[_0x2628('0x9')]));var Schema=require(_0x2628('0xd'));var originateValidation=new Schema({'userId':{'type':_0x2628('0xe'),'required':[!![],_0x2628('0xf')]},'callNumber':{'type':_0x2628('0x10'),'required':[!![],_0x2628('0x11')]},'callerId':{'type':_0x2628('0x10')},'callbackUrl':{'type':_0x2628('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0x2628('0xe'),'required':[!![],_0x2628('0xf')]},'sessionId':{'type':_0x2628('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x2628('0xe'),'required':[!![],_0x2628('0xf')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x2628('0xf')]},'sessionId':{'type':_0x2628('0x10'),'required':[!![],_0x2628('0x12')]},'transferNumber':{'type':_0x2628('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x2628('0xf')]},'sessionId':{'type':_0x2628('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x2628('0xe'),'required':[!![],_0x2628('0xf')]},'sessionId':{'type':_0x2628('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x2628('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0x2628('0xe'),'required':[!![],_0x2628('0xf')]}});function emit(_0x4f418d,_0x13a728,_0x1551e4){logger['info'](_0x4f418d,_0x13a728,JSON[_0x2628('0x13')](_0x1551e4));io['to'](_0x4f418d)['emit'](_0x13a728,_0x1551e4);}function handleError(_0x441002){return function(_0x374501){console['log'](_0x2628('0x14'),_0x374501,_0x374501 instanceof RangeError);logger[_0x2628('0x15')](_0x374501['stack']);if(_0x374501 instanceof RangeError){if(_0x374501[_0x2628('0x16')]){delete _0x374501['name'];}_0x441002[_0x2628('0x17')](0x194)['send'](_0x374501);}else{if(_0x374501['name']){delete _0x374501[_0x2628('0x16')];}_0x441002[_0x2628('0x17')](0x1f4)[_0x2628('0x18')](_0x374501);}};}function checkError(){return function(_0x42519a){if(!_0x42519a){throw new RangeError(_0x2628('0x19'));}return _0x42519a;};}function respondWithRpcPromise(_0x1911a2,_0x374887){return new BPromise(function(_0x41c2ba,_0x1746fe){var _0x57a799=amiClient;return _0x57a799[_0x2628('0x1a')](_0x1911a2,_0x374887)[_0x2628('0x1b')](function(_0x91e79c){if(_0x91e79c[_0x2628('0x15')]){if(_0x91e79c[_0x2628('0x15')]['code']===0x1f4){return _0x1746fe(_0x91e79c[_0x2628('0x15')][_0x2628('0x1c')]);}return _0x41c2ba(_0x91e79c[_0x2628('0x15')][_0x2628('0x1c')]);}else{_0x41c2ba(_0x91e79c[_0x2628('0x1d')]);}})['catch'](function(_0x4a8768){_0x1746fe(_0x4a8768);});});}function getAgent(_0x459681){return db[_0x2628('0x1e')][_0x2628('0x1f')]({'where':{'id':_0x459681,'role':_0x2628('0x20')}})[_0x2628('0x1b')](checkError());}function getAgentCheckSession(_0x571711,_0x433265){return new BPromise(function(_0x6146b0,_0xaa308b){var _0x1df2d8=respondWithRpcPromise(_0x2628('0x21'));var _0x118e75=getAgent(_0x571711);Promise['all']([_0x1df2d8,_0x118e75])['then'](function(_0x21c0ca){var _0x29ffee=_0x21c0ca[0x0];var _0x3d98a7=_0x21c0ca[0x1];var _0x59a28e=_['filter'](_0x29ffee[_0x2628('0x22')],function(_0x292e24){return _0x292e24[_0x2628('0x23')]==_0x3d98a7['id']&&_0x292e24[_0x2628('0x24')]==_0x433265;});if(_0x59a28e['length']==0x1){_0x6146b0(_0x3d98a7);}else{_0xaa308b(new RangeError(_0x2628('0x25')+_0x433265+_0x2628('0x26')));}});});}exports[_0x2628('0x27')]=function(_0x19530e,_0x515f29){logger[_0x2628('0x28')](_0x2628('0x29'),_0x19530e[_0x2628('0x2a')]);var _0x4443c5=originateValidation[_0x2628('0xd')](_0x19530e[_0x2628('0x2a')]);if(_0x4443c5[_0x2628('0x2b')]>0x0){return _0x515f29[_0x2628('0x17')](0x190)[_0x2628('0x2c')](_0x4443c5);}var _0x5a7157=_0x19530e[_0x2628('0x2a')][_0x2628('0x2d')];var _0x3b2b89=_0x19530e[_0x2628('0x2a')][_0x2628('0x2e')];var _0x5607b0=_0x19530e['body'][_0x2628('0x2f')];var _0x42930c=_0x19530e[_0x2628('0x2a')]['callbackUrl'];return getAgent(_0x5a7157)[_0x2628('0x1b')](function(_0x187327){logger[_0x2628('0x28')]('entityFound:',_0x187327[_0x2628('0x16')]);emit(util[_0x2628('0x30')](_0x2628('0x31'),_0x187327['name']),'webbar:originate',{'callNumber':_0x3b2b89,'callerId':_0x5607b0,'callbackUrl':_0x42930c});return _0x515f29['status'](0xc8)['json']({'error':![],'message':_0x2628('0x32')});})[_0x2628('0x33')](handleError(_0x515f29));};exports[_0x2628('0x34')]=function(_0x48acb8,_0x3d2725){logger[_0x2628('0x28')](_0x2628('0x35'),_0x48acb8['body']);var _0x9164d9=hangupValidation[_0x2628('0xd')](_0x48acb8[_0x2628('0x2a')]);if(_0x9164d9[_0x2628('0x2b')]>0x0){return _0x3d2725[_0x2628('0x17')](0x190)[_0x2628('0x2c')](_0x9164d9);}var _0x1ab162=_0x48acb8['body'][_0x2628('0x2d')];var _0x3adf06=_0x48acb8[_0x2628('0x2a')][_0x2628('0x24')];return getAgent(_0x1ab162)[_0x2628('0x1b')](function(_0x2bc23f){logger['info'](_0x2628('0x36'),_0x2bc23f['name']);emit(util[_0x2628('0x30')](_0x2628('0x31'),_0x2bc23f[_0x2628('0x16')]),_0x2628('0x37'),{'sessionId':_0x3adf06});return _0x3d2725[_0x2628('0x17')](0xc8)['json']({'error':![],'message':_0x2628('0x38')});})['catch'](handleError(_0x3d2725));};exports['answer']=function(_0x105f60,_0x445ecd){logger[_0x2628('0x28')](_0x2628('0x39'),_0x105f60[_0x2628('0x2a')]);var _0x55e9ff=answerValidation[_0x2628('0xd')](_0x105f60[_0x2628('0x2a')]);if(_0x55e9ff[_0x2628('0x2b')]>0x0){return _0x445ecd[_0x2628('0x17')](0x190)[_0x2628('0x2c')](_0x55e9ff);}var _0x549701=_0x105f60[_0x2628('0x2a')]['userId'];var _0x39b67d=_0x105f60[_0x2628('0x2a')][_0x2628('0x24')];return getAgent(_0x549701)[_0x2628('0x1b')](function(_0x532ee0){logger['info'](_0x2628('0x36'),_0x532ee0[_0x2628('0x16')]);emit(util['format'](_0x2628('0x31'),_0x532ee0[_0x2628('0x16')]),_0x2628('0x3a'),{'sessionId':_0x39b67d});return _0x445ecd[_0x2628('0x17')](0xc8)['json']({'error':![],'message':_0x2628('0x3b')});})[_0x2628('0x33')](handleError(_0x445ecd));};exports[_0x2628('0x3c')]=function(_0x29847f,_0x166b92){logger[_0x2628('0x28')](_0x2628('0x3d'),_0x29847f[_0x2628('0x2a')]);var _0x5263e4=holdValidation[_0x2628('0xd')](_0x29847f['body']);if(_0x5263e4[_0x2628('0x2b')]>0x0){return _0x166b92['status'](0x190)[_0x2628('0x2c')](_0x5263e4);}var _0x166340=_0x29847f[_0x2628('0x2a')][_0x2628('0x2d')];var _0xd7c5a9=_0x29847f['body'][_0x2628('0x24')];return getAgent(_0x166340)['then'](function(_0x2cb756){logger[_0x2628('0x28')](_0x2628('0x36'),_0x2cb756['name']);emit(util[_0x2628('0x30')](_0x2628('0x31'),_0x2cb756['name']),_0x2628('0x3e'),{'sessionId':_0xd7c5a9});return _0x166b92[_0x2628('0x17')](0xc8)[_0x2628('0x2c')]({'error':![],'message':_0x2628('0x3f')});})[_0x2628('0x33')](handleError(_0x166b92));};exports['unhold']=function(_0x405e07,_0x4b366c){logger[_0x2628('0x28')](_0x2628('0x40'),_0x405e07[_0x2628('0x2a')]);var _0x9ac767=unholdValidation[_0x2628('0xd')](_0x405e07[_0x2628('0x2a')]);if(_0x9ac767[_0x2628('0x2b')]>0x0){return _0x4b366c['status'](0x190)[_0x2628('0x2c')](_0x9ac767);}var _0x11a733=_0x405e07[_0x2628('0x2a')][_0x2628('0x2d')];var _0x1838c7=_0x405e07[_0x2628('0x2a')][_0x2628('0x24')];return getAgent(_0x11a733)[_0x2628('0x1b')](function(_0x300095){logger['info']('entityFound:',_0x300095[_0x2628('0x16')]);emit(util[_0x2628('0x30')](_0x2628('0x31'),_0x300095[_0x2628('0x16')]),_0x2628('0x41'),{'sessionId':_0x1838c7});return _0x4b366c['status'](0xc8)['json']({'error':![],'message':_0x2628('0x42')});})['catch'](handleError(_0x4b366c));};exports[_0x2628('0x43')]=function(_0x1feec8,_0x45227a){logger[_0x2628('0x28')](_0x2628('0x44'),_0x45227a[_0x2628('0x2a')]);var _0x158831=callsValidation[_0x2628('0xd')](_0x1feec8[_0x2628('0x2a')]);if(_0x158831[_0x2628('0x2b')]>0x0){return _0x45227a[_0x2628('0x17')](0x190)[_0x2628('0x2c')](_0x158831);}var _0x8d450=_0x1feec8[_0x2628('0x2a')][_0x2628('0x2d')];var _0x1d85b1=respondWithRpcPromise(_0x2628('0x21'));var _0x43a4cd=getAgent(_0x8d450);return Promise[_0x2628('0x45')]([_0x1d85b1,_0x43a4cd])[_0x2628('0x1b')](function(_0x2fc85f){var _0x2184a2=_0x2fc85f[0x0];var _0x4af3ec=_0x2fc85f[0x1];var _0x36c920=_[_0x2628('0x46')](_0x2184a2['rows'],function(_0x416e7c){return _0x416e7c[_0x2628('0x23')]==_0x4af3ec['id'];});return _0x45227a[_0x2628('0x17')](0xc8)[_0x2628('0x2c')]({'count':_0x36c920[_0x2628('0x2b')],'rows':_0x36c920});})[_0x2628('0x33')](handleError(_0x45227a));};exports[_0x2628('0x47')]=function(_0x167cd1,_0x592d52){logger[_0x2628('0x28')](_0x2628('0x48'),_0x167cd1[_0x2628('0x2a')]);var _0x553128=conferenceValidation[_0x2628('0xd')](_0x167cd1[_0x2628('0x2a')]);if(_0x553128[_0x2628('0x2b')]>0x0){return _0x592d52[_0x2628('0x17')](0x190)[_0x2628('0x2c')](_0x553128);}var _0x4b574f=_0x167cd1[_0x2628('0x2a')]['userId'];return getAgent(_0x4b574f)['then'](function(_0x49d412){logger[_0x2628('0x28')](_0x2628('0x36'),_0x49d412['name']);emit(util[_0x2628('0x30')](_0x2628('0x31'),_0x49d412[_0x2628('0x16')]),'webbar:conference');return _0x592d52['status'](0xc8)['json']({'error':![],'message':'conference\x20executed!'});})[_0x2628('0x33')](handleError(_0x592d52));};exports[_0x2628('0x49')]=function(_0x160484,_0x2e388b){logger[_0x2628('0x28')]('transfer\x20fired:',_0x160484['body']);var _0x4c77a2=transferValidation[_0x2628('0xd')](_0x160484[_0x2628('0x2a')]);if(_0x4c77a2['length']>0x0){return _0x2e388b['status'](0x190)[_0x2628('0x2c')](_0x4c77a2);}var _0x128766=_0x160484['body'][_0x2628('0x2d')];var _0x3a3a66=_0x160484[_0x2628('0x2a')]['sessionId'];var _0x5e987a=_0x160484[_0x2628('0x2a')][_0x2628('0x4a')];return getAgent(_0x128766)['then'](function(_0x321e4d){logger[_0x2628('0x28')](_0x2628('0x36'),_0x321e4d['name']);emit(util[_0x2628('0x30')](_0x2628('0x31'),_0x321e4d['name']),_0x2628('0x4b'),{'sessionId':_0x3a3a66,'transferNumber':_0x5e987a});return _0x2e388b[_0x2628('0x17')](0xc8)[_0x2628('0x2c')]({'error':![],'message':_0x2628('0x4c')});})['catch'](handleError(_0x2e388b));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index ead5ad8..280b805 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 _0x5c3c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x5eb788,_0x329361){var _0x3b8161=function(_0x5d0622){while(--_0x5d0622){_0x5eb788['push'](_0x5eb788['shift']());}};_0x3b8161(++_0x329361);}(_0x5c3c,0x132));var _0xc5c3=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x5c3c[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var path=require(_0xc5c3('0x2'));var timeout=require(_0xc5c3('0x3'));var express=require('express');var router=express[_0xc5c3('0x4')]();var fs_extra=require(_0xc5c3('0x5'));var auth=require(_0xc5c3('0x6'));var interaction=require(_0xc5c3('0x7'));var config=require(_0xc5c3('0x8'));var controller=require(_0xc5c3('0x9'));router[_0xc5c3('0xa')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xc')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc5c3('0xd')]);router[_0xc5c3('0xa')]('/:id',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0xe')]);router['get'](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller['getDispositions']);router[_0xc5c3('0xa')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['getAnswers']);router[_0xc5c3('0xa')](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x12')]);router[_0xc5c3('0xa')](_0xc5c3('0x13'),auth['isAuthenticated'](),controller[_0xc5c3('0x14')]);router[_0xc5c3('0x15')]('/',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x16')]);router[_0xc5c3('0x15')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc5c3('0x17')]);router[_0xc5c3('0x15')](_0xc5c3('0x10'),auth[_0xc5c3('0xb')](),controller['addAnswer']);router['post'](_0xc5c3('0x11'),auth['isAuthenticated'](),controller[_0xc5c3('0x18')]);router[_0xc5c3('0x15')](_0xc5c3('0x13'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x19')]);router['post'](_0xc5c3('0x1a'),controller[_0xc5c3('0x1b')]);router[_0xc5c3('0x15')](_0xc5c3('0x1c'),auth['isAuthenticated'](),controller[_0xc5c3('0x1d')]);router[_0xc5c3('0x1e')](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x20')]);router['delete'](_0xc5c3('0x1f'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x21')]);router[_0xc5c3('0x22')](_0xc5c3('0xf'),auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x23')]);router['delete']('/:id/canned_answers',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x24')]);router['delete']('/:id/users',auth[_0xc5c3('0xb')](),controller[_0xc5c3('0x25')]);module[_0xc5c3('0x26')]=router; \ No newline at end of file +var _0x1a37=['get','index','/describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAgents','/:id/applications','getApplications','post','create','addDisposition','addAnswer','/:id/users','addAgents','addApplications','notify','/:id/send','send','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a37,0xb4));var _0x71a3=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x1a37[_0x5416db];return _0x243e35;};'use strict';var multer=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var path=require(_0x71a3('0x2'));var timeout=require(_0x71a3('0x3'));var express=require(_0x71a3('0x4'));var router=express[_0x71a3('0x5')]();var fs_extra=require(_0x71a3('0x6'));var auth=require(_0x71a3('0x7'));var interaction=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var controller=require('./whatsappAccount.controller');router[_0x71a3('0xa')]('/',auth['isAuthenticated'](),controller[_0x71a3('0xb')]);router[_0x71a3('0xa')](_0x71a3('0xc'),auth[_0x71a3('0xd')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x71a3('0xe')]);router[_0x71a3('0xa')](_0x71a3('0xf'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x10')]);router[_0x71a3('0xa')](_0x71a3('0x11'),auth[_0x71a3('0xd')](),controller['getAnswers']);router['get']('/:id/users',auth[_0x71a3('0xd')](),controller[_0x71a3('0x12')]);router[_0x71a3('0xa')](_0x71a3('0x13'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x14')]);router[_0x71a3('0x15')]('/',auth[_0x71a3('0xd')](),controller[_0x71a3('0x16')]);router[_0x71a3('0x15')](_0x71a3('0xf'),auth['isAuthenticated'](),controller[_0x71a3('0x17')]);router[_0x71a3('0x15')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x71a3('0x18')]);router[_0x71a3('0x15')](_0x71a3('0x19'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x1a')]);router[_0x71a3('0x15')]('/:id/applications',auth[_0x71a3('0xd')](),controller[_0x71a3('0x1b')]);router['post']('/:id/notify',controller[_0x71a3('0x1c')]);router[_0x71a3('0x15')](_0x71a3('0x1d'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x1e')]);router['put'](_0x71a3('0x1f'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x20')]);router[_0x71a3('0x21')](_0x71a3('0x1f'),auth['isAuthenticated'](),controller[_0x71a3('0x22')]);router['delete'](_0x71a3('0xf'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x23')]);router[_0x71a3('0x21')](_0x71a3('0x11'),auth[_0x71a3('0xd')](),controller['removeAnswers']);router[_0x71a3('0x21')](_0x71a3('0x19'),auth[_0x71a3('0xd')](),controller[_0x71a3('0x24')]);module[_0x71a3('0x25')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index bd60453..27c91c3 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 _0xf109=['STRING','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports'];(function(_0xb85a55,_0x728046){var _0xeb24dd=function(_0x5efa0c){while(--_0x5efa0c){_0xb85a55['push'](_0xb85a55['shift']());}};_0xeb24dd(++_0x728046);}(_0xf109,0x143));var _0x9f10=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xf109[_0x4ff09b];return _0x3f5c2e;};'use strict';var Sequelize=require(_0x9f10('0x0'));var rs=require('randomstring');module[_0x9f10('0x1')]={'name':{'type':Sequelize[_0x9f10('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x9f10('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x9f10('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x9f10('0x2')],'defaultValue':function(){return rs[_0x9f10('0x3')]();}},'phone':{'type':Sequelize[_0x9f10('0x2')]},'type':{'type':Sequelize[_0x9f10('0x4')](_0x9f10('0x5'))},'accountSid':{'type':Sequelize[_0x9f10('0x2')]},'authToken':{'type':Sequelize[_0x9f10('0x2')]},'notificationTemplate':{'type':Sequelize[_0x9f10('0x6')],'defaultValue':function(){return _0x9f10('0x7');}},'notificationSound':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9f10('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9f10('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9f10('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9f10('0x9')],'comment':_0x9f10('0xa')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9f10('0xb'),'set':function(_0x7a6668){if(!_0x7a6668){this['setDataValue']('mandatoryDispositionPauseId',null);}this[_0x9f10('0xc')]('mandatoryDisposition',_0x7a6668);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6c7d=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','ENUM','twilio','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x6c7d,0x73));var _0xd6c7=function(_0x9e959a,_0x130553){_0x9e959a=_0x9e959a-0x0;var _0x4dba29=_0x6c7d[_0x9e959a];return _0x4dba29;};'use strict';var Sequelize=require(_0xd6c7('0x0'));var rs=require(_0xd6c7('0x1'));module['exports']={'name':{'type':Sequelize[_0xd6c7('0x2')],'unique':_0xd6c7('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xd6c7('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xd6c7('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xd6c7('0x2')]},'type':{'type':Sequelize[_0xd6c7('0x4')](_0xd6c7('0x5'))},'accountSid':{'type':Sequelize[_0xd6c7('0x2')]},'authToken':{'type':Sequelize[_0xd6c7('0x2')]},'notificationTemplate':{'type':Sequelize[_0xd6c7('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xd6c7('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xd6c7('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd6c7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd6c7('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd6c7('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xd6c7('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xd6c7('0x7')],'defaultValue':![],'comment':_0xd6c7('0xa'),'set':function(_0x3cee2b){if(!_0x3cee2b){this[_0xd6c7('0xb')](_0xd6c7('0xc'),null);}this['setDataValue'](_0xd6c7('0xd'),_0x3cee2b);}},'description':{'type':Sequelize[_0xd6c7('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 2d5ab42..baa345d 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 _0x4cd8=['findOne','pick','filter','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','WhatsappApplication','getApplications','notify','whatsapp','applications','Applications','priority','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','twilio','from','replace','messageId','MessageSid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','omit','contact','WhatsappInteraction','interaction','created','autoclose','close','*,*,*,*','WhatsappMessage','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','List','updatedAt','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','client','http','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','then','get','WhatsappAccounts','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','merge','type','options','includeAll','include','WhatsappAccount','rows','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','update','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions'];(function(_0x40dc7e,_0x322488){var _0x31f6d4=function(_0x2db5e2){while(--_0x2db5e2){_0x40dc7e['push'](_0x40dc7e['shift']());}};_0x31f6d4(++_0x322488);}(_0x4cd8,0x1c5));var _0x84cd=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0x4cd8[_0x2ce6d5];return _0x32d272;};'use strict';var emlformat=require(_0x84cd('0x0'));var rimraf=require(_0x84cd('0x1'));var zipdir=require(_0x84cd('0x2'));var jsonpatch=require(_0x84cd('0x3'));var rp=require(_0x84cd('0x4'));var moment=require(_0x84cd('0x5'));var BPromise=require(_0x84cd('0x6'));var Mustache=require('mustache');var util=require(_0x84cd('0x7'));var path=require(_0x84cd('0x8'));var sox=require(_0x84cd('0x9'));var csv=require(_0x84cd('0xa'));var ejs=require(_0x84cd('0xb'));var fs=require('fs');var fs_extra=require(_0x84cd('0xc'));var _=require('lodash');var squel=require(_0x84cd('0xd'));var crypto=require(_0x84cd('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x84cd('0xf'));var toCsv=require(_0x84cd('0xa'));var querystring=require(_0x84cd('0x10'));var Papa=require('papaparse');var Redis=require(_0x84cd('0x11'));var authService=require(_0x84cd('0x12'));var qs=require(_0x84cd('0x13'));var as=require(_0x84cd('0x14'));var hardwareService=require(_0x84cd('0x15'));var logger=require(_0x84cd('0x16'))(_0x84cd('0x17'));var utils=require('../../config/utils');var config=require(_0x84cd('0x18'));var licenseUtil=require(_0x84cd('0x19'));var db=require('../../mysqldb')['db'];config[_0x84cd('0x1a')]=_[_0x84cd('0x1b')](config[_0x84cd('0x1a')],{'host':_0x84cd('0x1c'),'port':0x18eb});var socket=require(_0x84cd('0x1d'))(new Redis(config[_0x84cd('0x1a')]));require(_0x84cd('0x1e'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x84cd('0x1f')][_0x84cd('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x17abb4,_0x426b30,_0x295291,_0x54f706){return new BPromise(function(_0x588f5f,_0x3d4f0a){var _0x4a7457=_0x54f706||client;return _0x4a7457[_0x84cd('0x21')](_0x17abb4,_0x295291)['then'](function(_0x33ad22){logger['info'](_0x84cd('0x22'),_0x426b30,_0x84cd('0x23'));logger['debug'](_0x84cd('0x24'),_0x426b30,_0x84cd('0x23'),JSON['stringify'](_0x33ad22));if(_0x33ad22[_0x84cd('0x25')]){if(_0x33ad22[_0x84cd('0x25')][_0x84cd('0x26')]===0x1f4){logger[_0x84cd('0x25')](_0x84cd('0x22'),_0x426b30,_0x33ad22[_0x84cd('0x25')][_0x84cd('0x27')]);return _0x3d4f0a(_0x33ad22['error']['message']);}logger['error'](_0x84cd('0x22'),_0x426b30,_0x33ad22[_0x84cd('0x25')][_0x84cd('0x27')]);return _0x588f5f(_0x33ad22[_0x84cd('0x25')][_0x84cd('0x27')]);}else{logger[_0x84cd('0x28')](_0x84cd('0x22'),_0x426b30,_0x84cd('0x23'));_0x588f5f(_0x33ad22[_0x84cd('0x29')][_0x84cd('0x27')]);}})[_0x84cd('0x2a')](function(_0x15bb40){logger[_0x84cd('0x25')](_0x84cd('0x22'),_0x426b30,_0x15bb40);_0x3d4f0a(_0x15bb40);});});}function respondWithStatusCode(_0x466c38,_0x100350){_0x100350=_0x100350||0xcc;return function(_0x39427e){if(_0x39427e){return _0x466c38[_0x84cd('0x2b')](_0x100350);}return _0x466c38['status'](_0x100350)['end']();};}function respondWithResult(_0xc31b1e,_0x2a6dac){_0x2a6dac=_0x2a6dac||0xc8;return function(_0x97c23e){if(_0x97c23e){return _0xc31b1e[_0x84cd('0x2c')](_0x2a6dac)[_0x84cd('0x2d')](_0x97c23e);}};}function respondWithFilteredResult(_0x6b2abe,_0x404bde){return function(_0x278a59){if(_0x278a59){var _0x49427e=typeof _0x404bde[_0x84cd('0x2e')]===_0x84cd('0x2f')&&typeof _0x404bde[_0x84cd('0x30')]===_0x84cd('0x2f');var _0x484de2=_0x278a59[_0x84cd('0x31')];var _0x264f58=_0x49427e?0x0:_0x404bde['offset'];var _0x364e47=_0x49427e?_0x278a59[_0x84cd('0x31')]:_0x404bde[_0x84cd('0x2e')]+_0x404bde[_0x84cd('0x30')];var _0x53c8db;if(_0x364e47>=_0x484de2){_0x364e47=_0x484de2;_0x53c8db=0xc8;}else{_0x53c8db=0xce;}_0x6b2abe['status'](_0x53c8db);return _0x6b2abe[_0x84cd('0x32')](_0x84cd('0x33'),_0x264f58+'-'+_0x364e47+'/'+_0x484de2)[_0x84cd('0x2d')](_0x278a59);}return null;};}function patchUpdates(_0x5d390f){return function(_0x3b1274){try{jsonpatch[_0x84cd('0x34')](_0x3b1274,_0x5d390f,!![]);}catch(_0x5f48e0){return BPromise['reject'](_0x5f48e0);}return _0x3b1274['save']();};}function saveUpdates(_0x78e5f8,_0x3a5abd){return function(_0x14b34b){if(_0x14b34b){return _0x14b34b['update'](_0x78e5f8)['then'](function(_0x598619){return _0x598619;});}return null;};}function removeEntity(_0x53ab14,_0x24ad9b){return function(_0x295a38){if(_0x295a38){return _0x295a38[_0x84cd('0x35')]()[_0x84cd('0x36')](function(){var _0x253fa8=_0x295a38[_0x84cd('0x37')]({'plain':!![]});var _0x52d261=_0x84cd('0x38');return db[_0x84cd('0x39')]['destroy']({'where':{'type':_0x52d261,'resourceId':_0x253fa8['id']}})['then'](function(){return _0x295a38;});})[_0x84cd('0x36')](function(){_0x53ab14[_0x84cd('0x2c')](0xcc)[_0x84cd('0x3a')]();});}};}function handleEntityNotFound(_0x2df764,_0x11dba3){return function(_0x234a71){if(!_0x234a71){_0x2df764[_0x84cd('0x2b')](0x194);}return _0x234a71;};}function handleError(_0x497176,_0x3bcb9b){_0x3bcb9b=_0x3bcb9b||0x1f4;return function(_0x4f69ed){logger[_0x84cd('0x25')](_0x4f69ed[_0x84cd('0x3b')]);if(_0x4f69ed['name']){delete _0x4f69ed[_0x84cd('0x3c')];}_0x497176[_0x84cd('0x2c')](_0x3bcb9b)[_0x84cd('0x3d')](_0x4f69ed);};}exports[_0x84cd('0x3e')]=function(_0x36be8c,_0xdd276b){var _0x35d978={'include':[{'model':db[_0x84cd('0x3f')],'as':_0x84cd('0x40')}]},_0x1ee44f={},_0x29e965={'count':0x0,'rows':[]};var _0x4ed9c8=_[_0x84cd('0x41')](db['WhatsappAccount'][_0x84cd('0x42')],function(_0x463ade){return{'name':_0x463ade[_0x84cd('0x43')],'type':_0x463ade['type'][_0x84cd('0x44')]};});_0x1ee44f[_0x84cd('0x45')]=_[_0x84cd('0x41')](_0x4ed9c8,_0x84cd('0x3c'));_0x1ee44f[_0x84cd('0x46')]=_[_0x84cd('0x47')](_0x36be8c[_0x84cd('0x46')]);_0x1ee44f['filters']=_['intersection'](_0x1ee44f[_0x84cd('0x45')],_0x1ee44f['query']);_0x35d978[_0x84cd('0x48')]=_[_0x84cd('0x49')](_0x1ee44f[_0x84cd('0x45')],qs[_0x84cd('0x4a')](_0x36be8c[_0x84cd('0x46')]['fields']));_0x35d978[_0x84cd('0x48')]=_0x35d978[_0x84cd('0x48')][_0x84cd('0x4b')]?_0x35d978[_0x84cd('0x48')]:_0x1ee44f[_0x84cd('0x45')];if(!_0x36be8c[_0x84cd('0x46')][_0x84cd('0x4c')]('nolimit')){_0x35d978[_0x84cd('0x30')]=qs[_0x84cd('0x30')](_0x36be8c['query'][_0x84cd('0x30')]);_0x35d978[_0x84cd('0x2e')]=qs[_0x84cd('0x2e')](_0x36be8c['query'][_0x84cd('0x2e')]);}_0x35d978[_0x84cd('0x4d')]=qs['sort'](_0x36be8c[_0x84cd('0x46')][_0x84cd('0x4e')]);_0x35d978[_0x84cd('0x4f')]=qs[_0x84cd('0x50')](_['pick'](_0x36be8c[_0x84cd('0x46')],_0x1ee44f[_0x84cd('0x50')]),_0x4ed9c8);if(_0x36be8c[_0x84cd('0x46')]['filter']){_0x35d978['where']=_[_0x84cd('0x51')](_0x35d978[_0x84cd('0x4f')],{'$or':_[_0x84cd('0x41')](_0x4ed9c8,function(_0x51c58e){if(_0x51c58e[_0x84cd('0x52')]!=='VIRTUAL'){var _0x3f740b={};_0x3f740b[_0x51c58e['name']]={'$like':'%'+_0x36be8c['query']['filter']+'%'};return _0x3f740b;}})});}_0x35d978=_[_0x84cd('0x51')]({},_0x35d978,_0x36be8c[_0x84cd('0x53')]);var _0x10d058={'where':_0x35d978[_0x84cd('0x4f')]};return db['WhatsappAccount']['count'](_0x10d058)[_0x84cd('0x36')](function(_0x239a6f){_0x29e965[_0x84cd('0x31')]=_0x239a6f;if(_0x36be8c[_0x84cd('0x46')][_0x84cd('0x54')]){_0x35d978[_0x84cd('0x55')]=[{'all':!![]}];}return db[_0x84cd('0x56')]['findAll'](_0x35d978);})[_0x84cd('0x36')](function(_0x3d6a61){_0x29e965[_0x84cd('0x57')]=_0x3d6a61;return _0x29e965;})[_0x84cd('0x36')](respondWithFilteredResult(_0xdd276b,_0x35d978))[_0x84cd('0x2a')](handleError(_0xdd276b,null));};exports['show']=function(_0x447540,_0x41b7d7){var _0x4f335d={'raw':![],'where':{'id':_0x447540[_0x84cd('0x58')]['id']},'include':[{'model':db[_0x84cd('0x3f')],'as':_0x84cd('0x40')}]},_0x56c0b0={};_0x56c0b0['model']=_[_0x84cd('0x47')](db[_0x84cd('0x56')][_0x84cd('0x42')]);_0x56c0b0[_0x84cd('0x46')]=_[_0x84cd('0x47')](_0x447540[_0x84cd('0x46')]);_0x56c0b0[_0x84cd('0x50')]=_[_0x84cd('0x49')](_0x56c0b0[_0x84cd('0x45')],_0x56c0b0[_0x84cd('0x46')]);_0x4f335d[_0x84cd('0x48')]=_[_0x84cd('0x49')](_0x56c0b0[_0x84cd('0x45')],qs[_0x84cd('0x4a')](_0x447540['query'][_0x84cd('0x4a')]));_0x4f335d[_0x84cd('0x48')]=_0x4f335d[_0x84cd('0x48')]['length']?_0x4f335d['attributes']:_0x56c0b0['model'];if(_0x447540[_0x84cd('0x46')][_0x84cd('0x54')]){_0x4f335d['include']=[{'all':!![]}];}_0x4f335d=_[_0x84cd('0x51')]({},_0x4f335d,_0x447540[_0x84cd('0x53')]);return db[_0x84cd('0x56')][_0x84cd('0x59')](_0x4f335d)['then'](handleEntityNotFound(_0x41b7d7,null))['then'](respondWithResult(_0x41b7d7,null))[_0x84cd('0x2a')](handleError(_0x41b7d7,null));};exports[_0x84cd('0x5a')]=function(_0x4ef4a0,_0x541338){return db['WhatsappAccount'][_0x84cd('0x5a')](_0x4ef4a0[_0x84cd('0x5b')],{})[_0x84cd('0x36')](function(_0x47edc7){var _0x3eab90=_0x4ef4a0[_0x84cd('0x5c')]['get']({'plain':!![]});if(!_0x3eab90)throw new Error(_0x84cd('0x5d'));if(_0x3eab90[_0x84cd('0x5e')]===_0x84cd('0x5c')){var _0x50bcff=_0x47edc7[_0x84cd('0x37')]({'plain':!![]});var _0xbb7fa3='WhatsappAccounts';return db[_0x84cd('0x5f')][_0x84cd('0x59')]({'where':{'name':_0xbb7fa3,'userProfileId':_0x3eab90[_0x84cd('0x60')]},'raw':!![]})['then'](function(_0x531f18){if(_0x531f18&&_0x531f18[_0x84cd('0x61')]===0x0){return db[_0x84cd('0x39')][_0x84cd('0x5a')]({'name':_0x50bcff[_0x84cd('0x3c')],'resourceId':_0x50bcff['id'],'type':_0x531f18[_0x84cd('0x3c')],'sectionId':_0x531f18['id']},{})[_0x84cd('0x36')](function(){return _0x47edc7;});}else{return _0x47edc7;}})[_0x84cd('0x2a')](function(_0x57a762){logger[_0x84cd('0x25')](_0x84cd('0x62'),_0x57a762);throw _0x57a762;});}return _0x47edc7;})[_0x84cd('0x36')](respondWithResult(_0x541338,0xc9))['catch'](handleError(_0x541338,null));};exports[_0x84cd('0x63')]=function(_0x48ef6e,_0x37d425){if(_0x48ef6e[_0x84cd('0x5b')]['id']){delete _0x48ef6e[_0x84cd('0x5b')]['id'];}return db[_0x84cd('0x56')]['find']({'where':{'id':_0x48ef6e[_0x84cd('0x58')]['id']},'include':[{'model':db[_0x84cd('0x3f')],'as':_0x84cd('0x40')}]})[_0x84cd('0x36')](handleEntityNotFound(_0x37d425,null))[_0x84cd('0x36')](saveUpdates(_0x48ef6e[_0x84cd('0x5b')],null))[_0x84cd('0x36')](respondWithResult(_0x37d425,null))['catch'](handleError(_0x37d425,null));};exports[_0x84cd('0x35')]=function(_0x48abc7,_0x43aed0){return db[_0x84cd('0x56')][_0x84cd('0x59')]({'where':{'id':_0x48abc7[_0x84cd('0x58')]['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x43aed0,null))[_0x84cd('0x36')](removeEntity(_0x43aed0,null))[_0x84cd('0x2a')](handleError(_0x43aed0,null));};exports[_0x84cd('0x64')]=function(_0x55d625,_0x3ee06e){return db[_0x84cd('0x56')][_0x84cd('0x64')]()[_0x84cd('0x36')](respondWithResult(_0x3ee06e,null))[_0x84cd('0x2a')](handleError(_0x3ee06e,null));};exports[_0x84cd('0x65')]=function(_0x52e4e3,_0x1616f8,_0x17f4d9){if(_0x52e4e3[_0x84cd('0x5b')]['id']){delete _0x52e4e3[_0x84cd('0x5b')]['id'];}return db[_0x84cd('0x56')][_0x84cd('0x59')]({'where':{'id':_0x52e4e3[_0x84cd('0x58')]['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x1616f8,null))[_0x84cd('0x36')](function(_0xb7e586){if(_0xb7e586){_0x52e4e3[_0x84cd('0x5b')][_0x84cd('0x66')]=_0xb7e586['id'];return db[_0x84cd('0x67')]['create'](_0x52e4e3[_0x84cd('0x5b')]);}})[_0x84cd('0x36')](respondWithResult(_0x1616f8,null))[_0x84cd('0x2a')](handleError(_0x1616f8,null));};exports[_0x84cd('0x68')]=function(_0x13dd9d,_0x54a16b,_0x53aaa7){var _0x1303bf={'raw':![],'where':{}};var _0x25dc0c={};var _0x2468ce={'count':0x0,'rows':[]};return db[_0x84cd('0x56')][_0x84cd('0x69')]({'where':{'id':_0x13dd9d[_0x84cd('0x58')]['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x54a16b,null))['then'](function(_0x4e0eef){if(_0x4e0eef){_0x25dc0c[_0x84cd('0x45')]=_[_0x84cd('0x47')](db['Disposition'][_0x84cd('0x42')]);_0x25dc0c['query']=_[_0x84cd('0x47')](_0x13dd9d['query']);_0x25dc0c['filters']=_['intersection'](_0x25dc0c[_0x84cd('0x45')],_0x25dc0c['query']);_0x1303bf['attributes']=_[_0x84cd('0x49')](_0x25dc0c[_0x84cd('0x45')],qs['fields'](_0x13dd9d['query'][_0x84cd('0x4a')]));_0x1303bf[_0x84cd('0x48')]=_0x1303bf[_0x84cd('0x48')][_0x84cd('0x4b')]?_0x1303bf[_0x84cd('0x48')]:_0x25dc0c[_0x84cd('0x45')];if(!_0x13dd9d[_0x84cd('0x46')][_0x84cd('0x4c')]('nolimit')){_0x1303bf['limit']=qs['limit'](_0x13dd9d['query']['limit']);_0x1303bf['offset']=qs[_0x84cd('0x2e')](_0x13dd9d[_0x84cd('0x46')][_0x84cd('0x2e')]);}_0x1303bf[_0x84cd('0x4d')]=qs[_0x84cd('0x4e')](_0x13dd9d['query']['sort']);_0x1303bf[_0x84cd('0x4f')]=qs[_0x84cd('0x50')](_[_0x84cd('0x6a')](_0x13dd9d[_0x84cd('0x46')],_0x25dc0c['filters']));_0x1303bf[_0x84cd('0x4f')][_0x84cd('0x66')]=_0x4e0eef['id'];if(_0x13dd9d[_0x84cd('0x46')][_0x84cd('0x6b')]){_0x1303bf['where']=_[_0x84cd('0x51')](_0x1303bf[_0x84cd('0x4f')],{'$or':_[_0x84cd('0x41')](_0x1303bf[_0x84cd('0x48')],function(_0x34ed9d){var _0x41628f={};_0x41628f[_0x34ed9d]={'$like':'%'+_0x13dd9d[_0x84cd('0x46')][_0x84cd('0x6b')]+'%'};return _0x41628f;})});}_0x1303bf=_[_0x84cd('0x51')]({},_0x1303bf,_0x13dd9d[_0x84cd('0x53')]);return db[_0x84cd('0x67')][_0x84cd('0x31')]({'where':_0x1303bf[_0x84cd('0x4f')]})[_0x84cd('0x36')](function(_0x4b745e){_0x2468ce['count']=_0x4b745e;if(_0x13dd9d['query'][_0x84cd('0x54')]){_0x1303bf[_0x84cd('0x55')]=[{'all':!![]}];}return db[_0x84cd('0x67')][_0x84cd('0x6c')](_0x1303bf);})[_0x84cd('0x36')](function(_0x2a237e){_0x2468ce['rows']=_0x2a237e;return _0x2468ce;});}})[_0x84cd('0x36')](respondWithFilteredResult(_0x54a16b,_0x1303bf))[_0x84cd('0x2a')](handleError(_0x54a16b,null));};exports[_0x84cd('0x6d')]=function(_0x3198bb,_0x20f669,_0x50e206){return db[_0x84cd('0x56')][_0x84cd('0x59')]({'where':{'id':_0x3198bb[_0x84cd('0x58')]['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x20f669,null))[_0x84cd('0x36')](function(_0x2ab77e){if(_0x2ab77e){return _0x2ab77e[_0x84cd('0x6d')](_0x3198bb[_0x84cd('0x46')][_0x84cd('0x6e')]);}})['then'](respondWithStatusCode(_0x20f669,null))['catch'](handleError(_0x20f669,null));};exports[_0x84cd('0x6f')]=function(_0x382b9e,_0x40b0d5,_0x30ed87){if(_0x382b9e[_0x84cd('0x5b')]['id']){delete _0x382b9e[_0x84cd('0x5b')]['id'];}return db[_0x84cd('0x56')][_0x84cd('0x59')]({'where':{'id':_0x382b9e[_0x84cd('0x58')]['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x40b0d5,null))[_0x84cd('0x36')](function(_0xc0afa9){if(_0xc0afa9){_0x382b9e[_0x84cd('0x5b')]['WhatsappAccountId']=_0xc0afa9['id'];return db[_0x84cd('0x70')][_0x84cd('0x5a')](_0x382b9e['body']);}})[_0x84cd('0x36')](respondWithResult(_0x40b0d5,null))[_0x84cd('0x2a')](handleError(_0x40b0d5,null));};exports[_0x84cd('0x71')]=function(_0x5bea05,_0x148b61,_0x104deb){var _0x7ad6c0={'raw':![],'where':{}};var _0x325af0={};var _0x2c8d19={'count':0x0,'rows':[]};return db[_0x84cd('0x56')][_0x84cd('0x69')]({'where':{'id':_0x5bea05[_0x84cd('0x58')]['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x148b61,null))[_0x84cd('0x36')](function(_0x37a692){if(_0x37a692){_0x325af0['model']=_[_0x84cd('0x47')](db[_0x84cd('0x70')][_0x84cd('0x42')]);_0x325af0['query']=_[_0x84cd('0x47')](_0x5bea05[_0x84cd('0x46')]);_0x325af0[_0x84cd('0x50')]=_[_0x84cd('0x49')](_0x325af0[_0x84cd('0x45')],_0x325af0[_0x84cd('0x46')]);_0x7ad6c0['attributes']=_[_0x84cd('0x49')](_0x325af0[_0x84cd('0x45')],qs['fields'](_0x5bea05[_0x84cd('0x46')]['fields']));_0x7ad6c0['attributes']=_0x7ad6c0['attributes'][_0x84cd('0x4b')]?_0x7ad6c0[_0x84cd('0x48')]:_0x325af0[_0x84cd('0x45')];if(!_0x5bea05[_0x84cd('0x46')][_0x84cd('0x4c')](_0x84cd('0x72'))){_0x7ad6c0[_0x84cd('0x30')]=qs['limit'](_0x5bea05[_0x84cd('0x46')][_0x84cd('0x30')]);_0x7ad6c0['offset']=qs['offset'](_0x5bea05[_0x84cd('0x46')][_0x84cd('0x2e')]);}_0x7ad6c0[_0x84cd('0x4d')]=qs[_0x84cd('0x4e')](_0x5bea05[_0x84cd('0x46')][_0x84cd('0x4e')]);_0x7ad6c0['where']=qs[_0x84cd('0x50')](_[_0x84cd('0x6a')](_0x5bea05[_0x84cd('0x46')],_0x325af0[_0x84cd('0x50')]));_0x7ad6c0[_0x84cd('0x4f')][_0x84cd('0x66')]=_0x37a692['id'];if(_0x5bea05['query'][_0x84cd('0x6b')]){_0x7ad6c0[_0x84cd('0x4f')]=_[_0x84cd('0x51')](_0x7ad6c0[_0x84cd('0x4f')],{'$or':_[_0x84cd('0x41')](_0x7ad6c0[_0x84cd('0x48')],function(_0x1990f8){var _0x3d8cae={};_0x3d8cae[_0x1990f8]={'$like':'%'+_0x5bea05['query'][_0x84cd('0x6b')]+'%'};return _0x3d8cae;})});}_0x7ad6c0=_[_0x84cd('0x51')]({},_0x7ad6c0,_0x5bea05['options']);return db[_0x84cd('0x70')][_0x84cd('0x31')]({'where':_0x7ad6c0[_0x84cd('0x4f')]})[_0x84cd('0x36')](function(_0x545677){_0x2c8d19[_0x84cd('0x31')]=_0x545677;if(_0x5bea05[_0x84cd('0x46')][_0x84cd('0x54')]){_0x7ad6c0[_0x84cd('0x55')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x7ad6c0);})[_0x84cd('0x36')](function(_0x3d8e4d){_0x2c8d19[_0x84cd('0x57')]=_0x3d8e4d;return _0x2c8d19;});}})[_0x84cd('0x36')](respondWithFilteredResult(_0x148b61,_0x7ad6c0))[_0x84cd('0x2a')](handleError(_0x148b61,null));};exports['removeAnswers']=function(_0xccc3b0,_0x2d2009,_0x4355ad){return db[_0x84cd('0x56')][_0x84cd('0x59')]({'where':{'id':_0xccc3b0[_0x84cd('0x58')]['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x2d2009,null))[_0x84cd('0x36')](function(_0x2bba91){if(_0x2bba91){return _0x2bba91[_0x84cd('0x73')](_0xccc3b0['query'][_0x84cd('0x6e')]);}})[_0x84cd('0x36')](respondWithStatusCode(_0x2d2009,null))[_0x84cd('0x2a')](handleError(_0x2d2009,null));};exports['addAgents']=function(_0x5e8894,_0x3ae72a,_0x2eed39){return db[_0x84cd('0x56')][_0x84cd('0x59')]({'where':{'id':_0x5e8894[_0x84cd('0x58')]['id']}})['then'](handleEntityNotFound(_0x3ae72a,null))[_0x84cd('0x36')](function(_0x5a57e7){if(_0x5a57e7){return _0x5a57e7['addAgents'](_0x5e8894[_0x84cd('0x5b')]['ids'],_['omit'](_0x5e8894[_0x84cd('0x5b')],[_0x84cd('0x6e'),'id'])||{})[_0x84cd('0x74')](function(_0xcf7d9d){for(var _0x35e88e=0x0;_0x35e88e<_0x5e8894[_0x84cd('0x5b')][_0x84cd('0x6e')]['length'];_0x35e88e+=0x1){socket[_0x84cd('0x75')](_0x84cd('0x76'),{'UserId':Number(_0x5e8894[_0x84cd('0x5b')][_0x84cd('0x6e')][_0x35e88e]),'WhatsappAccountId':Number(_0x5e8894[_0x84cd('0x58')]['id'])});}return _0xcf7d9d;});}})[_0x84cd('0x36')](respondWithResult(_0x3ae72a,null))[_0x84cd('0x2a')](handleError(_0x3ae72a,null));};exports[_0x84cd('0x77')]=function(_0x1ba009,_0x2f5030,_0x4606ef){return db[_0x84cd('0x56')][_0x84cd('0x59')]({'where':{'id':_0x1ba009[_0x84cd('0x58')]['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x2f5030,null))[_0x84cd('0x36')](function(_0x39c701){if(_0x39c701){return _0x39c701['removeAgents'](_0x1ba009[_0x84cd('0x46')][_0x84cd('0x6e')])[_0x84cd('0x36')](function(){if(_[_0x84cd('0x78')](_0x1ba009[_0x84cd('0x46')][_0x84cd('0x6e')])){for(var _0x37dde6=0x0;_0x37dde6<_0x1ba009[_0x84cd('0x46')]['ids'][_0x84cd('0x4b')];_0x37dde6+=0x1){socket['emit'](_0x84cd('0x79'),{'UserId':Number(_0x1ba009[_0x84cd('0x46')][_0x84cd('0x6e')][_0x37dde6]),'WhatsappAccountId':Number(_0x1ba009[_0x84cd('0x58')]['id'])});}}else{socket[_0x84cd('0x75')](_0x84cd('0x79'),{'UserId':Number(_0x1ba009['query'][_0x84cd('0x6e')]),'WhatsappAccountId':Number(_0x1ba009[_0x84cd('0x58')]['id'])});}});}})[_0x84cd('0x36')](respondWithStatusCode(_0x2f5030,null))[_0x84cd('0x2a')](handleError(_0x2f5030,null));};exports[_0x84cd('0x7a')]=function(_0x32c952,_0x4c17de,_0x2ab93){var _0x4005ce={};var _0x3f5097={};var _0x775693;var _0x160b9a;return db[_0x84cd('0x56')][_0x84cd('0x69')]({'where':{'id':_0x32c952['params']['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x4c17de,null))[_0x84cd('0x36')](function(_0xaa59b){if(_0xaa59b){_0x775693=_0xaa59b;_0x3f5097[_0x84cd('0x45')]=_[_0x84cd('0x47')](db['User'][_0x84cd('0x42')]);_0x3f5097[_0x84cd('0x46')]=_[_0x84cd('0x47')](_0x32c952[_0x84cd('0x46')]);_0x3f5097[_0x84cd('0x50')]=_[_0x84cd('0x49')](_0x3f5097['model'],_0x3f5097[_0x84cd('0x46')]);_0x4005ce['attributes']=_[_0x84cd('0x49')](_0x3f5097[_0x84cd('0x45')],qs[_0x84cd('0x4a')](_0x32c952[_0x84cd('0x46')][_0x84cd('0x4a')]));_0x4005ce['attributes']=_0x4005ce[_0x84cd('0x48')][_0x84cd('0x4b')]?_0x4005ce[_0x84cd('0x48')]:_0x3f5097['model'];_0x4005ce[_0x84cd('0x4d')]=qs['sort'](_0x32c952['query'][_0x84cd('0x4e')]);_0x4005ce[_0x84cd('0x4f')]=qs[_0x84cd('0x50')](_['pick'](_0x32c952[_0x84cd('0x46')],_0x3f5097[_0x84cd('0x50')]));if(_0x32c952['query'][_0x84cd('0x6b')]){_0x4005ce['where']=_[_0x84cd('0x51')](_0x4005ce['where'],{'$or':_[_0x84cd('0x41')](_0x4005ce[_0x84cd('0x48')],function(_0x34776c){var _0x3f7f43={};_0x3f7f43[_0x34776c]={'$like':'%'+_0x32c952[_0x84cd('0x46')][_0x84cd('0x6b')]+'%'};return _0x3f7f43;})});}_0x4005ce=_[_0x84cd('0x51')]({},_0x4005ce,_0x32c952[_0x84cd('0x53')]);return _0x775693['getAgents'](_0x4005ce);}})['then'](function(_0x1cbd22){if(_0x1cbd22){_0x160b9a=_0x1cbd22['length'];if(!_0x32c952['query'][_0x84cd('0x4c')]('nolimit')){_0x4005ce['limit']=qs[_0x84cd('0x30')](_0x32c952[_0x84cd('0x46')][_0x84cd('0x30')]);_0x4005ce[_0x84cd('0x2e')]=qs[_0x84cd('0x2e')](_0x32c952[_0x84cd('0x46')][_0x84cd('0x2e')]);}return _0x775693[_0x84cd('0x7a')](_0x4005ce);}})[_0x84cd('0x36')](function(_0x329ba4){if(_0x329ba4){return _0x329ba4?{'count':_0x160b9a,'rows':_0x329ba4}:null;}})['then'](respondWithResult(_0x4c17de,null))[_0x84cd('0x2a')](handleError(_0x4c17de,null));};exports[_0x84cd('0x7b')]=function(_0x25187f,_0x1ac230,_0x11c81e){return db[_0x84cd('0x56')][_0x84cd('0x69')]({'where':{'id':_0x25187f['params']['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x1ac230,null))[_0x84cd('0x36')](function(_0x3950f6){if(_0x3950f6){return db[_0x84cd('0x7c')][_0x84cd('0x7d')](function(_0x556f37){return db[_0x84cd('0x7e')][_0x84cd('0x35')]({'where':{'WhatsappAccountId':_0x25187f['params']['id']},'transaction':_0x556f37})[_0x84cd('0x36')](function(_0x23433c){var _0x2060f5=_[_0x84cd('0x41')](_0x25187f[_0x84cd('0x5b')],function(_0x305137){_0x305137['WhatsappAccountId']=_0x25187f[_0x84cd('0x58')]['id'];return _0x305137;});return db[_0x84cd('0x7e')]['bulkCreate'](_0x2060f5,{'transaction':_0x556f37});});})['then'](function(){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x25187f['params']['id']},'order':'priority'});});}})['then'](respondWithResult(_0x1ac230,null))[_0x84cd('0x2a')](handleError(_0x1ac230,null));};exports[_0x84cd('0x7f')]=function(_0x563c3c,_0x42a8e8,_0x4a9fd0){var _0x129490={};var _0x4c5e0a={};var _0x4903a6;var _0x208b93;return db[_0x84cd('0x56')][_0x84cd('0x69')]({'where':{'id':_0x563c3c['params']['id']}})[_0x84cd('0x36')](handleEntityNotFound(_0x42a8e8,null))[_0x84cd('0x36')](function(_0x4366c5){if(_0x4366c5){_0x4903a6=_0x4366c5;_0x4c5e0a[_0x84cd('0x45')]=_['keys'](db[_0x84cd('0x7e')]['rawAttributes']);_0x4c5e0a[_0x84cd('0x46')]=_[_0x84cd('0x47')](_0x563c3c['query']);_0x4c5e0a[_0x84cd('0x50')]=_[_0x84cd('0x49')](_0x4c5e0a['model'],_0x4c5e0a['query']);_0x129490[_0x84cd('0x48')]=_[_0x84cd('0x49')](_0x4c5e0a[_0x84cd('0x45')],qs[_0x84cd('0x4a')](_0x563c3c['query'][_0x84cd('0x4a')]));_0x129490[_0x84cd('0x48')]=_0x129490[_0x84cd('0x48')][_0x84cd('0x4b')]?_0x129490[_0x84cd('0x48')]:_0x4c5e0a[_0x84cd('0x45')];_0x129490[_0x84cd('0x4d')]=qs[_0x84cd('0x4e')](_0x563c3c[_0x84cd('0x46')][_0x84cd('0x4e')]);_0x129490[_0x84cd('0x4f')]=qs[_0x84cd('0x50')](_[_0x84cd('0x6a')](_0x563c3c[_0x84cd('0x46')],_0x4c5e0a[_0x84cd('0x50')]));if(_0x563c3c[_0x84cd('0x46')][_0x84cd('0x6b')]){_0x129490[_0x84cd('0x4f')]=_[_0x84cd('0x51')](_0x129490[_0x84cd('0x4f')],{'$or':_[_0x84cd('0x41')](_0x129490['attributes'],function(_0x4a22b3){var _0x1547ba={};_0x1547ba[_0x4a22b3]={'$like':'%'+_0x563c3c[_0x84cd('0x46')]['filter']+'%'};return _0x1547ba;})});}_0x129490=_['merge']({},_0x129490,_0x563c3c[_0x84cd('0x53')]);return _0x4903a6[_0x84cd('0x7f')](_0x129490);}})['then'](function(_0x21b419){if(_0x21b419){_0x208b93=_0x21b419[_0x84cd('0x4b')];if(!_0x563c3c[_0x84cd('0x46')]['hasOwnProperty'](_0x84cd('0x72'))){_0x129490['limit']=qs['limit'](_0x563c3c[_0x84cd('0x46')][_0x84cd('0x30')]);_0x129490['offset']=qs[_0x84cd('0x2e')](_0x563c3c[_0x84cd('0x46')][_0x84cd('0x2e')]);}return _0x4903a6[_0x84cd('0x7f')](_0x129490);}})[_0x84cd('0x36')](function(_0x1f49e8){if(_0x1f49e8){return _0x1f49e8?{'count':_0x208b93,'rows':_0x1f49e8}:null;}})[_0x84cd('0x36')](respondWithResult(_0x42a8e8,null))['catch'](handleError(_0x42a8e8,null));};exports[_0x84cd('0x80')]=function(_0x290fa5,_0x370501,_0x5290b8){var _0x4f519e={'channel':_0x84cd('0x81')};var _0x429225=[];var _0x145a12=[];var _0x3e4ce0={};return db['WhatsappAccount'][_0x84cd('0x59')]({'where':{'id':_0x290fa5[_0x84cd('0x58')]['id']},'include':[{'model':db[_0x84cd('0x7e')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x370501,null))['then'](function(_0x45f606){_0x4f519e['account']=_0x45f606;_0x4f519e[_0x84cd('0x82')]=_['orderBy'](_0x45f606[_0x84cd('0x83')],[_0x84cd('0x84')],['asc']);if(_0x4f519e[_0x84cd('0x85')][_0x84cd('0x83')]){delete _0x4f519e[_0x84cd('0x85')][_0x84cd('0x83')];}return db[_0x84cd('0x86')]['describe']();})['then'](function(_0x3edcc7){if(!_0x3edcc7){throw new db[(_0x84cd('0x87'))][(_0x84cd('0x88'))](_0x84cd('0x89'));}_0x429225=_[_0x84cd('0x8a')](_[_0x84cd('0x47')](_0x3edcc7),[_0x84cd('0x8b'),'updatedAt']);_0x145a12=_[_0x84cd('0x8a')](_[_0x84cd('0x47')](_0x3edcc7),['createdAt','updatedAt',_0x84cd('0x8c'),_0x84cd('0x8d')]);_0x4f519e['body']={'mapKey':'mobile'};if(_0x4f519e[_0x84cd('0x85')][_0x84cd('0x52')]&&_0x4f519e[_0x84cd('0x85')][_0x84cd('0x52')]===_0x84cd('0x8e')){_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x8f')]=_0x290fa5[_0x84cd('0x5b')]['From'][_0x84cd('0x90')]('whatsapp:','');_0x4f519e['body'][_0x84cd('0x5b')]=_0x290fa5[_0x84cd('0x5b')]['Body'];_0x4f519e['body'][_0x84cd('0x91')]=_0x290fa5['body'][_0x84cd('0x92')];}if(_0x4f519e[_0x84cd('0x5b')]['id']){delete _0x4f519e[_0x84cd('0x5b')]['id'];}if(_[_0x84cd('0x93')](_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x8f')])){throw new db[(_0x84cd('0x87'))][(_0x84cd('0x88'))](_0x84cd('0x94'));}if(_['isNil'](_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x5b')])||_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x5b')]===''){throw new db[(_0x84cd('0x87'))]['ValidationError'](_0x84cd('0x95'));}if(_[_0x84cd('0x93')](_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x96')])){throw new db[(_0x84cd('0x87'))][(_0x84cd('0x88'))](_0x84cd('0x97')+_0x145a12);}if(!_[_0x84cd('0x98')](_0x145a12,_0x4f519e['body'][_0x84cd('0x96')])){throw new db[(_0x84cd('0x87'))][(_0x84cd('0x88'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x145a12);}_0x3e4ce0[_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x96')]]=_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x8f')];return db[_0x84cd('0x99')][_0x84cd('0x59')]({'where':{'id':_0x4f519e[_0x84cd('0x85')][_0x84cd('0x8d')]},'include':[{'model':db['CmContact'],'as':_0x84cd('0x9a'),'where':_0x3e4ce0,'limit':0x1,'order':[['updatedAt',_0x84cd('0x9b')]]}]});})['then'](handleEntityNotFound(_0x370501,null))[_0x84cd('0x36')](function(_0x19bba5){if(_0x19bba5){_0x4f519e[_0x84cd('0x9c')]=_[_0x84cd('0x9d')](_0x19bba5,[_0x84cd('0x9a')]);if(_0x19bba5[_0x84cd('0x9a')][_0x84cd('0x4b')]){return _0x19bba5['Contacts'][0x0];}var _0x370a5e=_['defaults'](_0x4f519e[_0x84cd('0x5b')],{'firstName':_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x8f')],'ListId':_0x19bba5['id']});_0x370a5e[_0x4f519e['body'][_0x84cd('0x96')]]=_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x8f')];return db['CmContact']['create'](_0x370a5e,{'fields':_0x429225,'raw':!![]});}})['then'](handleEntityNotFound(_0x370501,null))[_0x84cd('0x36')](function(_0x2b87c3){if(_0x2b87c3){_0x4f519e[_0x84cd('0x9e')]=_0x2b87c3;var _0x39be48={'ContactId':_0x2b87c3['id'],'phone':_0x4f519e['body'][_0x84cd('0x8f')],'WhatsappAccountId':_0x290fa5[_0x84cd('0x58')]['id']};var _0x46ae1b={'ContactId':_0x2b87c3['id'],'WhatsappAccountId':_0x290fa5[_0x84cd('0x58')]['id'],'closed':![]};return db[_0x84cd('0x9f')][_0x84cd('0x59')]({'where':_0x46ae1b})[_0x84cd('0x36')](function(_0x55e7c8){if(_0x55e7c8){return[_0x55e7c8,![]];}return db[_0x84cd('0x9f')][_0x84cd('0x5a')](_0x39be48)[_0x84cd('0x36')](function(_0x57638b){return[_0x57638b,!![]];});});}})['spread'](function(_0x4353b9,_0x4cee29){_0x4f519e['interaction']=_0x4353b9[_0x84cd('0x37')]({'plain':!![]});_0x4f519e[_0x84cd('0xa0')][_0x84cd('0xa1')]=![];if(_0x4cee29){if(_0x4f519e[_0x84cd('0x85')][_0x84cd('0xa2')]){_0x4f519e[_0x84cd('0x82')]['push']({'id':0x0,'priority':_0x4f519e[_0x84cd('0x82')][_0x84cd('0x4b')]+0x1,'app':_0x84cd('0xa3'),'appdata':'unmanaged','interval':_0x84cd('0xa4')});}_0x4f519e[_0x84cd('0xa0')][_0x84cd('0xa1')]=!![];}return db[_0x84cd('0xa5')][_0x84cd('0x5a')]({'phone':_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x8f')],'messageId':_0x4f519e[_0x84cd('0x5b')][_0x84cd('0x91')],'body':_0x4f519e[_0x84cd('0x5b')]['body'],'WhatsappAccountId':_0x290fa5[_0x84cd('0x58')]['id'],'WhatsappInteractionId':_0x4353b9['id'],'direction':'in','ContactId':_0x4353b9['ContactId'],'AttachmentId':_0x4f519e[_0x84cd('0x5b')]['AttachmentId']});})[_0x84cd('0x36')](function(_0x33abbf){_0x4f519e[_0x84cd('0x27')]=_0x33abbf;if(_0x4f519e['interaction'][_0x84cd('0xa6')]){return db['User']['find']({'attributes':['id',_0x84cd('0x3c')],'where':{'id':_0x4f519e[_0x84cd('0xa0')][_0x84cd('0xa6')]}})[_0x84cd('0x36')](function(_0x16e2ab){if(_0x16e2ab){_0x4f519e[_0x84cd('0x82')][_0x84cd('0xa7')]({'id':0x0,'priority':0x0,'app':_0x84cd('0xa8'),'appdata':_0x16e2ab[_0x84cd('0x3c')]+','+(_0x4f519e[_0x84cd('0x85')][_0x84cd('0xa9')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x84cd('0xaa'),_0x84cd('0xab'),_0x4f519e);});}return respondWithRpcPromise(_0x84cd('0xaa'),_0x84cd('0xab'),_0x4f519e);})['then'](function(_0x6ec1a){if(_0x6ec1a){var _0x3b215a=0xc8;var _0x4842f5=_0x84cd('0xac');logger[_0x84cd('0x28')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4842f5,_0x3b215a,_0x84cd('0xad'));logger[_0x84cd('0xae')](_0x84cd('0xaf'),_0x4842f5,_0x3b215a,_0x84cd('0xad'),JSON[_0x84cd('0xb0')](_0x6ec1a));if(_0x4f519e[_0x84cd('0x85')][_0x84cd('0x52')]===_0x84cd('0x8e')){return _0x370501[_0x84cd('0x2c')](_0x3b215a)[_0x84cd('0x32')](_0x84cd('0xb1'),_0x84cd('0xb2'))[_0x84cd('0x3d')](_0x84cd('0xb3'));}else{return _0x370501[_0x84cd('0x2c')](_0x3b215a)[_0x84cd('0x2d')](_0x6ec1a);}}})[_0x84cd('0x2a')](handleError(_0x370501,null));};exports[_0x84cd('0x3d')]=function(_0x7e3779,_0xec0ca3,_0x4b7676){var _0x308033,_0xbdb518,_0x163b6a;if(_['isNil'](_0x7e3779[_0x84cd('0x5b')][_0x84cd('0x5b')])||_0x7e3779[_0x84cd('0x5b')]['body']===''){throw new db['Sequelize'][(_0x84cd('0x88'))](_0x84cd('0x95'));}if(_[_0x84cd('0x93')](_0x7e3779['body']['to'])){throw new db[(_0x84cd('0x87'))]['ValidationError'](_0x84cd('0xb4'));}_0x308033=_0x7e3779[_0x84cd('0x5b')]['to'];return db[_0x84cd('0x56')][_0x84cd('0x59')]({'where':{'id':_0x7e3779[_0x84cd('0x58')]['id']},'include':[{'model':db[_0x84cd('0x99')],'as':_0x84cd('0xb5'),'include':[{'model':db[_0x84cd('0x86')],'as':'Contacts','where':{'mobile':_0x308033},'limit':0x1,'order':[[_0x84cd('0xb6'),'DESC']]}]}]})['then'](handleEntityNotFound(_0xec0ca3,null))['then'](function(_0x3e1e69){if(_0x3e1e69&&_0x3e1e69[_0x84cd('0xb5')]){_0xbdb518=_0x3e1e69['get']({'plain':!![]});if(_0xbdb518[_0x84cd('0xb5')]&&_0xbdb518[_0x84cd('0xb5')][_0x84cd('0x9a')][_0x84cd('0x4b')]){return _0xbdb518[_0x84cd('0xb5')]['Contacts'][0x0];}return db['CmContact']['create'](_['defaults'](_0x7e3779[_0x84cd('0x5b')],{'firstName':_0x308033,'mobile':_0x308033,'phone':_0x308033,'ListId':_0xbdb518[_0x84cd('0x8d')]}));}})[_0x84cd('0x36')](handleEntityNotFound(_0xec0ca3,null))[_0x84cd('0x36')](function(_0x16b7d2){if(_0x16b7d2){_0x163b6a=_0x16b7d2;return db[_0x84cd('0x9f')][_0x84cd('0x59')]({'where':{'ContactId':_0x163b6a['id'],'closed':![],'WhatsappAccountId':_0xbdb518['id']}})[_0x84cd('0x36')](function(_0x50c458){if(_0x50c458){return[_0x50c458,![]];}return db['WhatsappInteraction'][_0x84cd('0x5a')]({'UserId':_0x7e3779[_0x84cd('0x5c')]['id'],'ContactId':_0x163b6a['id'],'WhatsappAccountId':_0xbdb518['id'],'phone':_0x308033,'firstMsgDirection':_0x84cd('0xb7'),'Messages':[_['merge'](_0x7e3779['body'],{'read':![],'body':_0x7e3779[_0x84cd('0x5b')][_0x84cd('0x5b')],'phone':_0x308033,'WhatsappAccountId':_0xbdb518['id'],'UserId':_0x7e3779[_0x84cd('0x5c')]['id'],'ContactId':_0x163b6a['id']})]},{'include':[{'model':db[_0x84cd('0xa5')],'as':_0x84cd('0xb8')}]})[_0x84cd('0x36')](function(_0xb8aac2){return[_0xb8aac2,!![]];});});}})[_0x84cd('0x74')](function(_0x119763,_0x5e17bd){if(_0x5e17bd){return _0x119763;}return db['WhatsappMessage'][_0x84cd('0x5a')](_[_0x84cd('0x51')](_0x7e3779['body'],{'read':![],'body':_0x7e3779[_0x84cd('0x5b')][_0x84cd('0x5b')],'phone':_0x308033,'WhatsappAccountId':_0xbdb518['id'],'WhatsappInteractionId':_0x119763['id'],'UserId':_0x7e3779['user']['id'],'ContactId':_0x163b6a['id']}))[_0x84cd('0x36')](function(_0x1dd38e){_0x119763[_0x84cd('0xb9')]['Messages']=[];_0x119763['dataValues'][_0x84cd('0xb8')]['push'](_0x1dd38e[_0x84cd('0xb9')]);return _0x119763;});})['then'](respondWithResult(_0xec0ca3,null))[_0x84cd('0x2a')](handleError(_0xec0ca3,null));}; \ No newline at end of file +var _0x9330=['update','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','order','sort','filter','merge','where','options','includeAll','show','params','keys','include','find','create','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','getDispositions','findOne','Disposition','hasOwnProperty','nolimit','pick','WhatsappAccountId','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','emit','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','addApplications','WhatsappApplication','bulkCreate','priority','getApplications','notify','whatsapp','Applications','applications','asc','account','CmContact','Sequelize','ValidationError','difference','createdAt','CompanyId','ListId','mobile','twilio','whatsapp:','Body','messageId','from','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','updatedAt','DESC','list','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','set','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','List','out','Messages','spread','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save'];(function(_0x272638,_0x42b993){var _0x19d027=function(_0x27ac44){while(--_0x27ac44){_0x272638['push'](_0x272638['shift']());}};_0x19d027(++_0x42b993);}(_0x9330,0x133));var _0x0933=function(_0x54c12f,_0x5c3933){_0x54c12f=_0x54c12f-0x0;var _0xcfe0c7=_0x9330[_0x54c12f];return _0xcfe0c7;};'use strict';var emlformat=require(_0x0933('0x0'));var rimraf=require(_0x0933('0x1'));var zipdir=require(_0x0933('0x2'));var jsonpatch=require(_0x0933('0x3'));var rp=require('request-promise');var moment=require(_0x0933('0x4'));var BPromise=require(_0x0933('0x5'));var Mustache=require(_0x0933('0x6'));var util=require(_0x0933('0x7'));var path=require(_0x0933('0x8'));var sox=require(_0x0933('0x9'));var csv=require(_0x0933('0xa'));var ejs=require(_0x0933('0xb'));var fs=require('fs');var fs_extra=require(_0x0933('0xc'));var _=require('lodash');var squel=require(_0x0933('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0933('0xa'));var querystring=require(_0x0933('0xe'));var Papa=require(_0x0933('0xf'));var Redis=require(_0x0933('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0933('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0933('0x12'))('api');var utils=require(_0x0933('0x13'));var config=require(_0x0933('0x14'));var licenseUtil=require(_0x0933('0x15'));var db=require(_0x0933('0x16'))['db'];config[_0x0933('0x17')]=_[_0x0933('0x18')](config[_0x0933('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x0933('0x19'))(new Redis(config[_0x0933('0x17')]));require(_0x0933('0x1a'))[_0x0933('0x1b')](socket);var jayson=require(_0x0933('0x1c'));var client=jayson['client'][_0x0933('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x32b395,_0x44f7c8,_0x5c0c1b,_0x3dc483){return new BPromise(function(_0x124fdb,_0x5cc839){var _0x3e19a8=_0x3dc483||client;return _0x3e19a8[_0x0933('0x1e')](_0x32b395,_0x5c0c1b)[_0x0933('0x1f')](function(_0x5a34f1){logger[_0x0933('0x20')](_0x0933('0x21'),_0x44f7c8,'request\x20sent');logger[_0x0933('0x22')](_0x0933('0x23'),_0x44f7c8,'request\x20sent',JSON[_0x0933('0x24')](_0x5a34f1));if(_0x5a34f1['error']){if(_0x5a34f1['error'][_0x0933('0x25')]===0x1f4){logger[_0x0933('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x44f7c8,_0x5a34f1[_0x0933('0x26')][_0x0933('0x27')]);return _0x5cc839(_0x5a34f1[_0x0933('0x26')]['message']);}logger[_0x0933('0x26')](_0x0933('0x21'),_0x44f7c8,_0x5a34f1[_0x0933('0x26')][_0x0933('0x27')]);return _0x124fdb(_0x5a34f1[_0x0933('0x26')][_0x0933('0x27')]);}else{logger[_0x0933('0x20')](_0x0933('0x21'),_0x44f7c8,_0x0933('0x28'));_0x124fdb(_0x5a34f1['result'][_0x0933('0x27')]);}})[_0x0933('0x29')](function(_0x3591c4){logger['error'](_0x0933('0x21'),_0x44f7c8,_0x3591c4);_0x5cc839(_0x3591c4);});});}function respondWithStatusCode(_0x54166f,_0x170167){_0x170167=_0x170167||0xcc;return function(_0x333d10){if(_0x333d10){return _0x54166f['sendStatus'](_0x170167);}return _0x54166f[_0x0933('0x2a')](_0x170167)[_0x0933('0x2b')]();};}function respondWithResult(_0x3aedca,_0x19297a){_0x19297a=_0x19297a||0xc8;return function(_0x247075){if(_0x247075){return _0x3aedca['status'](_0x19297a)[_0x0933('0x2c')](_0x247075);}};}function respondWithFilteredResult(_0x1aee6e,_0xa3cfcd){return function(_0x553e2e){if(_0x553e2e){var _0x118024=typeof _0xa3cfcd[_0x0933('0x2d')]===_0x0933('0x2e')&&typeof _0xa3cfcd[_0x0933('0x2f')]===_0x0933('0x2e');var _0x2c0ff1=_0x553e2e['count'];var _0x5cf2d4=_0x118024?0x0:_0xa3cfcd[_0x0933('0x2d')];var _0x196bd9=_0x118024?_0x553e2e[_0x0933('0x30')]:_0xa3cfcd[_0x0933('0x2d')]+_0xa3cfcd[_0x0933('0x2f')];var _0x5029d2;if(_0x196bd9>=_0x2c0ff1){_0x196bd9=_0x2c0ff1;_0x5029d2=0xc8;}else{_0x5029d2=0xce;}_0x1aee6e[_0x0933('0x2a')](_0x5029d2);return _0x1aee6e['set'](_0x0933('0x31'),_0x5cf2d4+'-'+_0x196bd9+'/'+_0x2c0ff1)['json'](_0x553e2e);}return null;};}function patchUpdates(_0x315e37){return function(_0x38ab8e){try{jsonpatch[_0x0933('0x32')](_0x38ab8e,_0x315e37,!![]);}catch(_0x5ee76e){return BPromise[_0x0933('0x33')](_0x5ee76e);}return _0x38ab8e[_0x0933('0x34')]();};}function saveUpdates(_0x997d6,_0x4fb865){return function(_0x33bde1){if(_0x33bde1){return _0x33bde1[_0x0933('0x35')](_0x997d6)[_0x0933('0x1f')](function(_0x1e7727){return _0x1e7727;});}return null;};}function removeEntity(_0x1ef3af,_0xa76fda){return function(_0x20ba42){if(_0x20ba42){return _0x20ba42[_0x0933('0x36')]()[_0x0933('0x1f')](function(){var _0x57a570=_0x20ba42[_0x0933('0x37')]({'plain':!![]});var _0x50d74f=_0x0933('0x38');return db[_0x0933('0x39')][_0x0933('0x36')]({'where':{'type':_0x50d74f,'resourceId':_0x57a570['id']}})[_0x0933('0x1f')](function(){return _0x20ba42;});})[_0x0933('0x1f')](function(){_0x1ef3af['status'](0xcc)[_0x0933('0x2b')]();});}};}function handleEntityNotFound(_0x1e029f,_0x4d402d){return function(_0x3e3587){if(!_0x3e3587){_0x1e029f[_0x0933('0x3a')](0x194);}return _0x3e3587;};}function handleError(_0x30bcca,_0x375c28){_0x375c28=_0x375c28||0x1f4;return function(_0x4a512c){logger[_0x0933('0x26')](_0x4a512c[_0x0933('0x3b')]);if(_0x4a512c[_0x0933('0x3c')]){delete _0x4a512c[_0x0933('0x3c')];}_0x30bcca[_0x0933('0x2a')](_0x375c28)[_0x0933('0x3d')](_0x4a512c);};}exports[_0x0933('0x3e')]=function(_0x141fa8,_0x53553a){var _0x3b6729={'include':[{'model':db[_0x0933('0x3f')],'as':_0x0933('0x40')}]},_0x3620fa={},_0x16cb5b={'count':0x0,'rows':[]};var _0xc9e7a3=_[_0x0933('0x41')](db[_0x0933('0x42')][_0x0933('0x43')],function(_0x528646){return{'name':_0x528646['fieldName'],'type':_0x528646[_0x0933('0x44')]['key']};});_0x3620fa[_0x0933('0x45')]=_[_0x0933('0x41')](_0xc9e7a3,'name');_0x3620fa[_0x0933('0x46')]=_['keys'](_0x141fa8['query']);_0x3620fa[_0x0933('0x47')]=_[_0x0933('0x48')](_0x3620fa[_0x0933('0x45')],_0x3620fa[_0x0933('0x46')]);_0x3b6729['attributes']=_[_0x0933('0x48')](_0x3620fa[_0x0933('0x45')],qs[_0x0933('0x49')](_0x141fa8[_0x0933('0x46')][_0x0933('0x49')]));_0x3b6729['attributes']=_0x3b6729[_0x0933('0x4a')][_0x0933('0x4b')]?_0x3b6729['attributes']:_0x3620fa[_0x0933('0x45')];if(!_0x141fa8['query']['hasOwnProperty']('nolimit')){_0x3b6729[_0x0933('0x2f')]=qs[_0x0933('0x2f')](_0x141fa8[_0x0933('0x46')][_0x0933('0x2f')]);_0x3b6729[_0x0933('0x2d')]=qs[_0x0933('0x2d')](_0x141fa8[_0x0933('0x46')][_0x0933('0x2d')]);}_0x3b6729[_0x0933('0x4c')]=qs['sort'](_0x141fa8['query'][_0x0933('0x4d')]);_0x3b6729['where']=qs['filters'](_['pick'](_0x141fa8['query'],_0x3620fa[_0x0933('0x47')]),_0xc9e7a3);if(_0x141fa8[_0x0933('0x46')][_0x0933('0x4e')]){_0x3b6729['where']=_[_0x0933('0x4f')](_0x3b6729[_0x0933('0x50')],{'$or':_[_0x0933('0x41')](_0xc9e7a3,function(_0x3e764f){if(_0x3e764f[_0x0933('0x44')]!=='VIRTUAL'){var _0x5ee537={};_0x5ee537[_0x3e764f[_0x0933('0x3c')]]={'$like':'%'+_0x141fa8['query'][_0x0933('0x4e')]+'%'};return _0x5ee537;}})});}_0x3b6729=_[_0x0933('0x4f')]({},_0x3b6729,_0x141fa8[_0x0933('0x51')]);var _0x53a89b={'where':_0x3b6729['where']};return db['WhatsappAccount'][_0x0933('0x30')](_0x53a89b)[_0x0933('0x1f')](function(_0x287df8){_0x16cb5b[_0x0933('0x30')]=_0x287df8;if(_0x141fa8[_0x0933('0x46')][_0x0933('0x52')]){_0x3b6729['include']=[{'all':!![]}];}return db[_0x0933('0x42')]['findAll'](_0x3b6729);})['then'](function(_0x11a9b6){_0x16cb5b['rows']=_0x11a9b6;return _0x16cb5b;})['then'](respondWithFilteredResult(_0x53553a,_0x3b6729))[_0x0933('0x29')](handleError(_0x53553a,null));};exports[_0x0933('0x53')]=function(_0x3fb881,_0x46733f){var _0x3e8bcb={'raw':![],'where':{'id':_0x3fb881[_0x0933('0x54')]['id']},'include':[{'model':db[_0x0933('0x3f')],'as':_0x0933('0x40')}]},_0x13c6f1={};_0x13c6f1[_0x0933('0x45')]=_['keys'](db['WhatsappAccount']['rawAttributes']);_0x13c6f1['query']=_[_0x0933('0x55')](_0x3fb881[_0x0933('0x46')]);_0x13c6f1['filters']=_[_0x0933('0x48')](_0x13c6f1[_0x0933('0x45')],_0x13c6f1[_0x0933('0x46')]);_0x3e8bcb['attributes']=_[_0x0933('0x48')](_0x13c6f1[_0x0933('0x45')],qs[_0x0933('0x49')](_0x3fb881[_0x0933('0x46')][_0x0933('0x49')]));_0x3e8bcb['attributes']=_0x3e8bcb[_0x0933('0x4a')][_0x0933('0x4b')]?_0x3e8bcb[_0x0933('0x4a')]:_0x13c6f1[_0x0933('0x45')];if(_0x3fb881[_0x0933('0x46')][_0x0933('0x52')]){_0x3e8bcb[_0x0933('0x56')]=[{'all':!![]}];}_0x3e8bcb=_[_0x0933('0x4f')]({},_0x3e8bcb,_0x3fb881[_0x0933('0x51')]);return db['WhatsappAccount'][_0x0933('0x57')](_0x3e8bcb)[_0x0933('0x1f')](handleEntityNotFound(_0x46733f,null))['then'](respondWithResult(_0x46733f,null))['catch'](handleError(_0x46733f,null));};exports[_0x0933('0x58')]=function(_0x182435,_0x3da5c7){return db['WhatsappAccount'][_0x0933('0x58')](_0x182435['body'],{})[_0x0933('0x1f')](function(_0x31dac9){var _0x515975=_0x182435[_0x0933('0x59')][_0x0933('0x37')]({'plain':!![]});if(!_0x515975)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x515975[_0x0933('0x5a')]===_0x0933('0x59')){var _0x3b2dc3=_0x31dac9[_0x0933('0x37')]({'plain':!![]});var _0x1a885d=_0x0933('0x38');return db['UserProfileSection']['find']({'where':{'name':_0x1a885d,'userProfileId':_0x515975['userProfileId']},'raw':!![]})[_0x0933('0x1f')](function(_0x42db03){if(_0x42db03&&_0x42db03[_0x0933('0x5b')]===0x0){return db[_0x0933('0x39')][_0x0933('0x58')]({'name':_0x3b2dc3['name'],'resourceId':_0x3b2dc3['id'],'type':_0x42db03[_0x0933('0x3c')],'sectionId':_0x42db03['id']},{})[_0x0933('0x1f')](function(){return _0x31dac9;});}else{return _0x31dac9;}})[_0x0933('0x29')](function(_0x2b9683){logger[_0x0933('0x26')](_0x0933('0x5c'),_0x2b9683);throw _0x2b9683;});}return _0x31dac9;})[_0x0933('0x1f')](respondWithResult(_0x3da5c7,0xc9))[_0x0933('0x29')](handleError(_0x3da5c7,null));};exports[_0x0933('0x35')]=function(_0x5601eb,_0x114736){if(_0x5601eb[_0x0933('0x5d')]['id']){delete _0x5601eb[_0x0933('0x5d')]['id'];}return db[_0x0933('0x42')][_0x0933('0x57')]({'where':{'id':_0x5601eb[_0x0933('0x54')]['id']},'include':[{'model':db[_0x0933('0x3f')],'as':_0x0933('0x40')}]})[_0x0933('0x1f')](handleEntityNotFound(_0x114736,null))[_0x0933('0x1f')](saveUpdates(_0x5601eb[_0x0933('0x5d')],null))[_0x0933('0x1f')](respondWithResult(_0x114736,null))[_0x0933('0x29')](handleError(_0x114736,null));};exports[_0x0933('0x36')]=function(_0x223a54,_0x240ac6){return db[_0x0933('0x42')][_0x0933('0x57')]({'where':{'id':_0x223a54[_0x0933('0x54')]['id']}})[_0x0933('0x1f')](handleEntityNotFound(_0x240ac6,null))[_0x0933('0x1f')](removeEntity(_0x240ac6,null))[_0x0933('0x29')](handleError(_0x240ac6,null));};exports[_0x0933('0x5e')]=function(_0x31e808,_0xfd1a30){return db['WhatsappAccount']['describe']()[_0x0933('0x1f')](respondWithResult(_0xfd1a30,null))[_0x0933('0x29')](handleError(_0xfd1a30,null));};exports[_0x0933('0x5f')]=function(_0x1ce097,_0x2c64e3,_0x5467fb){if(_0x1ce097['body']['id']){delete _0x1ce097[_0x0933('0x5d')]['id'];}return db[_0x0933('0x42')][_0x0933('0x57')]({'where':{'id':_0x1ce097[_0x0933('0x54')]['id']}})[_0x0933('0x1f')](handleEntityNotFound(_0x2c64e3,null))[_0x0933('0x1f')](function(_0x5e2950){if(_0x5e2950){_0x1ce097[_0x0933('0x5d')]['WhatsappAccountId']=_0x5e2950['id'];return db['Disposition'][_0x0933('0x58')](_0x1ce097[_0x0933('0x5d')]);}})[_0x0933('0x1f')](respondWithResult(_0x2c64e3,null))[_0x0933('0x29')](handleError(_0x2c64e3,null));};exports[_0x0933('0x60')]=function(_0x7bf412,_0x3862ac,_0x3c9276){var _0x2ab8b8={'raw':![],'where':{}};var _0x27bdf7={};var _0x1a647a={'count':0x0,'rows':[]};return db[_0x0933('0x42')][_0x0933('0x61')]({'where':{'id':_0x7bf412[_0x0933('0x54')]['id']}})[_0x0933('0x1f')](handleEntityNotFound(_0x3862ac,null))[_0x0933('0x1f')](function(_0x363f15){if(_0x363f15){_0x27bdf7[_0x0933('0x45')]=_[_0x0933('0x55')](db[_0x0933('0x62')][_0x0933('0x43')]);_0x27bdf7[_0x0933('0x46')]=_[_0x0933('0x55')](_0x7bf412[_0x0933('0x46')]);_0x27bdf7[_0x0933('0x47')]=_[_0x0933('0x48')](_0x27bdf7['model'],_0x27bdf7[_0x0933('0x46')]);_0x2ab8b8[_0x0933('0x4a')]=_[_0x0933('0x48')](_0x27bdf7['model'],qs[_0x0933('0x49')](_0x7bf412[_0x0933('0x46')][_0x0933('0x49')]));_0x2ab8b8[_0x0933('0x4a')]=_0x2ab8b8[_0x0933('0x4a')][_0x0933('0x4b')]?_0x2ab8b8[_0x0933('0x4a')]:_0x27bdf7[_0x0933('0x45')];if(!_0x7bf412[_0x0933('0x46')][_0x0933('0x63')](_0x0933('0x64'))){_0x2ab8b8[_0x0933('0x2f')]=qs[_0x0933('0x2f')](_0x7bf412['query']['limit']);_0x2ab8b8[_0x0933('0x2d')]=qs[_0x0933('0x2d')](_0x7bf412[_0x0933('0x46')][_0x0933('0x2d')]);}_0x2ab8b8[_0x0933('0x4c')]=qs[_0x0933('0x4d')](_0x7bf412[_0x0933('0x46')][_0x0933('0x4d')]);_0x2ab8b8[_0x0933('0x50')]=qs[_0x0933('0x47')](_[_0x0933('0x65')](_0x7bf412['query'],_0x27bdf7[_0x0933('0x47')]));_0x2ab8b8[_0x0933('0x50')][_0x0933('0x66')]=_0x363f15['id'];if(_0x7bf412['query'][_0x0933('0x4e')]){_0x2ab8b8['where']=_[_0x0933('0x4f')](_0x2ab8b8[_0x0933('0x50')],{'$or':_[_0x0933('0x41')](_0x2ab8b8[_0x0933('0x4a')],function(_0x303f51){var _0x5d308b={};_0x5d308b[_0x303f51]={'$like':'%'+_0x7bf412[_0x0933('0x46')][_0x0933('0x4e')]+'%'};return _0x5d308b;})});}_0x2ab8b8=_[_0x0933('0x4f')]({},_0x2ab8b8,_0x7bf412[_0x0933('0x51')]);return db['Disposition'][_0x0933('0x30')]({'where':_0x2ab8b8[_0x0933('0x50')]})['then'](function(_0x131063){_0x1a647a[_0x0933('0x30')]=_0x131063;if(_0x7bf412[_0x0933('0x46')][_0x0933('0x52')]){_0x2ab8b8[_0x0933('0x56')]=[{'all':!![]}];}return db[_0x0933('0x62')][_0x0933('0x67')](_0x2ab8b8);})[_0x0933('0x1f')](function(_0x5399cf){_0x1a647a[_0x0933('0x68')]=_0x5399cf;return _0x1a647a;});}})[_0x0933('0x1f')](respondWithFilteredResult(_0x3862ac,_0x2ab8b8))[_0x0933('0x29')](handleError(_0x3862ac,null));};exports[_0x0933('0x69')]=function(_0x2e5a57,_0x206973,_0x9e6c95){return db['WhatsappAccount'][_0x0933('0x57')]({'where':{'id':_0x2e5a57['params']['id']}})[_0x0933('0x1f')](handleEntityNotFound(_0x206973,null))['then'](function(_0x1ef7de){if(_0x1ef7de){return _0x1ef7de[_0x0933('0x69')](_0x2e5a57['query'][_0x0933('0x6a')]);}})[_0x0933('0x1f')](respondWithStatusCode(_0x206973,null))[_0x0933('0x29')](handleError(_0x206973,null));};exports[_0x0933('0x6b')]=function(_0x228e9c,_0x160556,_0x4dc95e){if(_0x228e9c[_0x0933('0x5d')]['id']){delete _0x228e9c[_0x0933('0x5d')]['id'];}return db[_0x0933('0x42')]['find']({'where':{'id':_0x228e9c['params']['id']}})[_0x0933('0x1f')](handleEntityNotFound(_0x160556,null))['then'](function(_0x2bef19){if(_0x2bef19){_0x228e9c[_0x0933('0x5d')][_0x0933('0x66')]=_0x2bef19['id'];return db[_0x0933('0x6c')][_0x0933('0x58')](_0x228e9c['body']);}})[_0x0933('0x1f')](respondWithResult(_0x160556,null))[_0x0933('0x29')](handleError(_0x160556,null));};exports[_0x0933('0x6d')]=function(_0x288127,_0x3a3d00,_0x240da5){var _0x43b96e={'raw':![],'where':{}};var _0x5056c9={};var _0x56a3ab={'count':0x0,'rows':[]};return db[_0x0933('0x42')][_0x0933('0x61')]({'where':{'id':_0x288127[_0x0933('0x54')]['id']}})[_0x0933('0x1f')](handleEntityNotFound(_0x3a3d00,null))[_0x0933('0x1f')](function(_0x49e361){if(_0x49e361){_0x5056c9[_0x0933('0x45')]=_[_0x0933('0x55')](db[_0x0933('0x6c')][_0x0933('0x43')]);_0x5056c9[_0x0933('0x46')]=_[_0x0933('0x55')](_0x288127[_0x0933('0x46')]);_0x5056c9[_0x0933('0x47')]=_['intersection'](_0x5056c9[_0x0933('0x45')],_0x5056c9['query']);_0x43b96e[_0x0933('0x4a')]=_['intersection'](_0x5056c9[_0x0933('0x45')],qs[_0x0933('0x49')](_0x288127[_0x0933('0x46')][_0x0933('0x49')]));_0x43b96e[_0x0933('0x4a')]=_0x43b96e[_0x0933('0x4a')][_0x0933('0x4b')]?_0x43b96e[_0x0933('0x4a')]:_0x5056c9[_0x0933('0x45')];if(!_0x288127[_0x0933('0x46')]['hasOwnProperty'](_0x0933('0x64'))){_0x43b96e[_0x0933('0x2f')]=qs[_0x0933('0x2f')](_0x288127[_0x0933('0x46')]['limit']);_0x43b96e[_0x0933('0x2d')]=qs[_0x0933('0x2d')](_0x288127[_0x0933('0x46')]['offset']);}_0x43b96e[_0x0933('0x4c')]=qs[_0x0933('0x4d')](_0x288127['query'][_0x0933('0x4d')]);_0x43b96e[_0x0933('0x50')]=qs[_0x0933('0x47')](_[_0x0933('0x65')](_0x288127[_0x0933('0x46')],_0x5056c9['filters']));_0x43b96e[_0x0933('0x50')]['WhatsappAccountId']=_0x49e361['id'];if(_0x288127[_0x0933('0x46')][_0x0933('0x4e')]){_0x43b96e[_0x0933('0x50')]=_[_0x0933('0x4f')](_0x43b96e['where'],{'$or':_[_0x0933('0x41')](_0x43b96e[_0x0933('0x4a')],function(_0x579cf6){var _0x227c49={};_0x227c49[_0x579cf6]={'$like':'%'+_0x288127['query'][_0x0933('0x4e')]+'%'};return _0x227c49;})});}_0x43b96e=_[_0x0933('0x4f')]({},_0x43b96e,_0x288127['options']);return db['CannedAnswer'][_0x0933('0x30')]({'where':_0x43b96e[_0x0933('0x50')]})[_0x0933('0x1f')](function(_0x297bd0){_0x56a3ab[_0x0933('0x30')]=_0x297bd0;if(_0x288127[_0x0933('0x46')][_0x0933('0x52')]){_0x43b96e[_0x0933('0x56')]=[{'all':!![]}];}return db[_0x0933('0x6c')]['findAll'](_0x43b96e);})[_0x0933('0x1f')](function(_0x2ebded){_0x56a3ab['rows']=_0x2ebded;return _0x56a3ab;});}})[_0x0933('0x1f')](respondWithFilteredResult(_0x3a3d00,_0x43b96e))[_0x0933('0x29')](handleError(_0x3a3d00,null));};exports[_0x0933('0x6e')]=function(_0x41fdab,_0xba33c8,_0x2f0fb6){return db[_0x0933('0x42')][_0x0933('0x57')]({'where':{'id':_0x41fdab[_0x0933('0x54')]['id']}})[_0x0933('0x1f')](handleEntityNotFound(_0xba33c8,null))['then'](function(_0x3cd2ba){if(_0x3cd2ba){return _0x3cd2ba[_0x0933('0x6e')](_0x41fdab[_0x0933('0x46')][_0x0933('0x6a')]);}})[_0x0933('0x1f')](respondWithStatusCode(_0xba33c8,null))[_0x0933('0x29')](handleError(_0xba33c8,null));};exports['addAgents']=function(_0x20e3b7,_0x50fe47,_0x245e5e){return db[_0x0933('0x42')][_0x0933('0x57')]({'where':{'id':_0x20e3b7['params']['id']}})[_0x0933('0x1f')](handleEntityNotFound(_0x50fe47,null))[_0x0933('0x1f')](function(_0x32d2f0){if(_0x32d2f0){return _0x32d2f0[_0x0933('0x6f')](_0x20e3b7[_0x0933('0x5d')][_0x0933('0x6a')],_[_0x0933('0x70')](_0x20e3b7[_0x0933('0x5d')],[_0x0933('0x6a'),'id'])||{})['spread'](function(_0x331027){for(var _0x4e5af3=0x0;_0x4e5af3<_0x20e3b7[_0x0933('0x5d')][_0x0933('0x6a')][_0x0933('0x4b')];_0x4e5af3+=0x1){socket[_0x0933('0x71')]('userWhatsappAccount:save',{'UserId':Number(_0x20e3b7[_0x0933('0x5d')][_0x0933('0x6a')][_0x4e5af3]),'WhatsappAccountId':Number(_0x20e3b7[_0x0933('0x54')]['id'])});}return _0x331027;});}})[_0x0933('0x1f')](respondWithResult(_0x50fe47,null))[_0x0933('0x29')](handleError(_0x50fe47,null));};exports['removeAgents']=function(_0x2b3226,_0x3ca07b,_0x50d12a){return db[_0x0933('0x42')][_0x0933('0x57')]({'where':{'id':_0x2b3226[_0x0933('0x54')]['id']}})['then'](handleEntityNotFound(_0x3ca07b,null))[_0x0933('0x1f')](function(_0x5c02ec){if(_0x5c02ec){return _0x5c02ec[_0x0933('0x72')](_0x2b3226[_0x0933('0x46')]['ids'])[_0x0933('0x1f')](function(){if(_[_0x0933('0x73')](_0x2b3226[_0x0933('0x46')]['ids'])){for(var _0x4482df=0x0;_0x4482df<_0x2b3226[_0x0933('0x46')][_0x0933('0x6a')][_0x0933('0x4b')];_0x4482df+=0x1){socket[_0x0933('0x71')](_0x0933('0x74'),{'UserId':Number(_0x2b3226['query'][_0x0933('0x6a')][_0x4482df]),'WhatsappAccountId':Number(_0x2b3226['params']['id'])});}}else{socket[_0x0933('0x71')](_0x0933('0x74'),{'UserId':Number(_0x2b3226[_0x0933('0x46')][_0x0933('0x6a')]),'WhatsappAccountId':Number(_0x2b3226[_0x0933('0x54')]['id'])});}});}})['then'](respondWithStatusCode(_0x3ca07b,null))[_0x0933('0x29')](handleError(_0x3ca07b,null));};exports['getAgents']=function(_0x42a623,_0x2b721d,_0x1cf5bb){var _0x55e89b={};var _0x12400b={};var _0x227779;var _0x178de1;return db[_0x0933('0x42')][_0x0933('0x61')]({'where':{'id':_0x42a623[_0x0933('0x54')]['id']}})[_0x0933('0x1f')](handleEntityNotFound(_0x2b721d,null))[_0x0933('0x1f')](function(_0x21ecf8){if(_0x21ecf8){_0x227779=_0x21ecf8;_0x12400b[_0x0933('0x45')]=_[_0x0933('0x55')](db[_0x0933('0x75')][_0x0933('0x43')]);_0x12400b[_0x0933('0x46')]=_['keys'](_0x42a623['query']);_0x12400b[_0x0933('0x47')]=_[_0x0933('0x48')](_0x12400b[_0x0933('0x45')],_0x12400b[_0x0933('0x46')]);_0x55e89b[_0x0933('0x4a')]=_[_0x0933('0x48')](_0x12400b[_0x0933('0x45')],qs['fields'](_0x42a623[_0x0933('0x46')][_0x0933('0x49')]));_0x55e89b[_0x0933('0x4a')]=_0x55e89b[_0x0933('0x4a')][_0x0933('0x4b')]?_0x55e89b[_0x0933('0x4a')]:_0x12400b[_0x0933('0x45')];_0x55e89b['order']=qs[_0x0933('0x4d')](_0x42a623[_0x0933('0x46')]['sort']);_0x55e89b[_0x0933('0x50')]=qs['filters'](_[_0x0933('0x65')](_0x42a623[_0x0933('0x46')],_0x12400b['filters']));if(_0x42a623[_0x0933('0x46')][_0x0933('0x4e')]){_0x55e89b[_0x0933('0x50')]=_[_0x0933('0x4f')](_0x55e89b[_0x0933('0x50')],{'$or':_['map'](_0x55e89b[_0x0933('0x4a')],function(_0x41b60d){var _0x44590a={};_0x44590a[_0x41b60d]={'$like':'%'+_0x42a623[_0x0933('0x46')][_0x0933('0x4e')]+'%'};return _0x44590a;})});}_0x55e89b=_[_0x0933('0x4f')]({},_0x55e89b,_0x42a623['options']);return _0x227779[_0x0933('0x76')](_0x55e89b);}})[_0x0933('0x1f')](function(_0x368f09){if(_0x368f09){_0x178de1=_0x368f09[_0x0933('0x4b')];if(!_0x42a623[_0x0933('0x46')][_0x0933('0x63')](_0x0933('0x64'))){_0x55e89b[_0x0933('0x2f')]=qs[_0x0933('0x2f')](_0x42a623[_0x0933('0x46')][_0x0933('0x2f')]);_0x55e89b[_0x0933('0x2d')]=qs[_0x0933('0x2d')](_0x42a623['query']['offset']);}return _0x227779[_0x0933('0x76')](_0x55e89b);}})[_0x0933('0x1f')](function(_0x1e34eb){if(_0x1e34eb){return _0x1e34eb?{'count':_0x178de1,'rows':_0x1e34eb}:null;}})[_0x0933('0x1f')](respondWithResult(_0x2b721d,null))[_0x0933('0x29')](handleError(_0x2b721d,null));};exports[_0x0933('0x77')]=function(_0x1e8fbb,_0x13f8a4,_0x36c4f8){return db[_0x0933('0x42')][_0x0933('0x61')]({'where':{'id':_0x1e8fbb[_0x0933('0x54')]['id']}})[_0x0933('0x1f')](handleEntityNotFound(_0x13f8a4,null))['then'](function(_0xd69678){if(_0xd69678){return db['sequelize']['transaction'](function(_0x2ae8d0){return db[_0x0933('0x78')][_0x0933('0x36')]({'where':{'WhatsappAccountId':_0x1e8fbb['params']['id']},'transaction':_0x2ae8d0})['then'](function(_0x3b97d5){var _0x519a5d=_['map'](_0x1e8fbb[_0x0933('0x5d')],function(_0x250df4){_0x250df4[_0x0933('0x66')]=_0x1e8fbb['params']['id'];return _0x250df4;});return db[_0x0933('0x78')][_0x0933('0x79')](_0x519a5d,{'transaction':_0x2ae8d0});});})[_0x0933('0x1f')](function(){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x1e8fbb[_0x0933('0x54')]['id']},'order':_0x0933('0x7a')});});}})[_0x0933('0x1f')](respondWithResult(_0x13f8a4,null))[_0x0933('0x29')](handleError(_0x13f8a4,null));};exports[_0x0933('0x7b')]=function(_0x449743,_0x21acde,_0x3042d4){var _0xf72a99={};var _0x285f66={};var _0x1bdec3;var _0x3e4b38;return db[_0x0933('0x42')][_0x0933('0x61')]({'where':{'id':_0x449743['params']['id']}})[_0x0933('0x1f')](handleEntityNotFound(_0x21acde,null))[_0x0933('0x1f')](function(_0x5ace77){if(_0x5ace77){_0x1bdec3=_0x5ace77;_0x285f66[_0x0933('0x45')]=_[_0x0933('0x55')](db['WhatsappApplication'][_0x0933('0x43')]);_0x285f66['query']=_[_0x0933('0x55')](_0x449743[_0x0933('0x46')]);_0x285f66[_0x0933('0x47')]=_[_0x0933('0x48')](_0x285f66[_0x0933('0x45')],_0x285f66[_0x0933('0x46')]);_0xf72a99[_0x0933('0x4a')]=_['intersection'](_0x285f66[_0x0933('0x45')],qs[_0x0933('0x49')](_0x449743[_0x0933('0x46')][_0x0933('0x49')]));_0xf72a99[_0x0933('0x4a')]=_0xf72a99['attributes']['length']?_0xf72a99[_0x0933('0x4a')]:_0x285f66[_0x0933('0x45')];_0xf72a99[_0x0933('0x4c')]=qs[_0x0933('0x4d')](_0x449743[_0x0933('0x46')][_0x0933('0x4d')]);_0xf72a99[_0x0933('0x50')]=qs[_0x0933('0x47')](_[_0x0933('0x65')](_0x449743['query'],_0x285f66['filters']));if(_0x449743['query']['filter']){_0xf72a99['where']=_['merge'](_0xf72a99[_0x0933('0x50')],{'$or':_[_0x0933('0x41')](_0xf72a99[_0x0933('0x4a')],function(_0x797b93){var _0x4a0f28={};_0x4a0f28[_0x797b93]={'$like':'%'+_0x449743[_0x0933('0x46')][_0x0933('0x4e')]+'%'};return _0x4a0f28;})});}_0xf72a99=_[_0x0933('0x4f')]({},_0xf72a99,_0x449743[_0x0933('0x51')]);return _0x1bdec3[_0x0933('0x7b')](_0xf72a99);}})[_0x0933('0x1f')](function(_0x47802d){if(_0x47802d){_0x3e4b38=_0x47802d['length'];if(!_0x449743['query'][_0x0933('0x63')]('nolimit')){_0xf72a99['limit']=qs[_0x0933('0x2f')](_0x449743[_0x0933('0x46')][_0x0933('0x2f')]);_0xf72a99[_0x0933('0x2d')]=qs[_0x0933('0x2d')](_0x449743[_0x0933('0x46')][_0x0933('0x2d')]);}return _0x1bdec3[_0x0933('0x7b')](_0xf72a99);}})['then'](function(_0x87e554){if(_0x87e554){return _0x87e554?{'count':_0x3e4b38,'rows':_0x87e554}:null;}})[_0x0933('0x1f')](respondWithResult(_0x21acde,null))['catch'](handleError(_0x21acde,null));};exports[_0x0933('0x7c')]=function(_0x1c1016,_0x1d8708,_0x7b92dc){var _0x39165f={'channel':_0x0933('0x7d')};var _0x2cba01=[];var _0x7646e6=[];var _0x9d923d={};return db[_0x0933('0x42')][_0x0933('0x57')]({'where':{'id':_0x1c1016[_0x0933('0x54')]['id']},'include':[{'model':db[_0x0933('0x78')],'as':_0x0933('0x7e')}]})[_0x0933('0x1f')](handleEntityNotFound(_0x1d8708,null))[_0x0933('0x1f')](function(_0xb8b3d3){_0x39165f['account']=_0xb8b3d3;_0x39165f[_0x0933('0x7f')]=_['orderBy'](_0xb8b3d3['Applications'],[_0x0933('0x7a')],[_0x0933('0x80')]);if(_0x39165f[_0x0933('0x81')][_0x0933('0x7e')]){delete _0x39165f[_0x0933('0x81')][_0x0933('0x7e')];}return db[_0x0933('0x82')][_0x0933('0x5e')]();})['then'](function(_0x1a3f72){if(!_0x1a3f72){throw new db[(_0x0933('0x83'))][(_0x0933('0x84'))]('no\x20available\x20attributes');}_0x2cba01=_[_0x0933('0x85')](_['keys'](_0x1a3f72),[_0x0933('0x86'),'updatedAt']);_0x7646e6=_[_0x0933('0x85')](_['keys'](_0x1a3f72),[_0x0933('0x86'),'updatedAt',_0x0933('0x87'),_0x0933('0x88')]);_0x39165f[_0x0933('0x5d')]={'mapKey':_0x0933('0x89')};if(_0x39165f[_0x0933('0x81')][_0x0933('0x44')]&&_0x39165f[_0x0933('0x81')][_0x0933('0x44')]===_0x0933('0x8a')){_0x39165f[_0x0933('0x5d')]['from']=_0x1c1016[_0x0933('0x5d')]['From']['replace'](_0x0933('0x8b'),'');_0x39165f['body'][_0x0933('0x5d')]=_0x1c1016[_0x0933('0x5d')][_0x0933('0x8c')];_0x39165f[_0x0933('0x5d')][_0x0933('0x8d')]=_0x1c1016[_0x0933('0x5d')]['MessageSid'];}if(_0x39165f[_0x0933('0x5d')]['id']){delete _0x39165f[_0x0933('0x5d')]['id'];}if(_['isNil'](_0x39165f['body'][_0x0933('0x8e')])){throw new db[(_0x0933('0x83'))]['ValidationError'](_0x0933('0x8f'));}if(_[_0x0933('0x90')](_0x39165f['body'][_0x0933('0x5d')])||_0x39165f[_0x0933('0x5d')][_0x0933('0x5d')]===''){throw new db[(_0x0933('0x83'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x0933('0x90')](_0x39165f[_0x0933('0x5d')][_0x0933('0x91')])){throw new db[(_0x0933('0x83'))]['ValidationError'](_0x0933('0x92')+_0x7646e6);}if(!_['includes'](_0x7646e6,_0x39165f[_0x0933('0x5d')]['mapKey'])){throw new db[(_0x0933('0x83'))][(_0x0933('0x84'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x7646e6);}_0x9d923d[_0x39165f[_0x0933('0x5d')][_0x0933('0x91')]]=_0x39165f[_0x0933('0x5d')]['from'];return db[_0x0933('0x93')][_0x0933('0x57')]({'where':{'id':_0x39165f[_0x0933('0x81')][_0x0933('0x88')]},'include':[{'model':db[_0x0933('0x82')],'as':_0x0933('0x94'),'where':_0x9d923d,'limit':0x1,'order':[[_0x0933('0x95'),_0x0933('0x96')]]}]});})['then'](handleEntityNotFound(_0x1d8708,null))[_0x0933('0x1f')](function(_0x5638ab){if(_0x5638ab){_0x39165f[_0x0933('0x97')]=_[_0x0933('0x70')](_0x5638ab,[_0x0933('0x94')]);if(_0x5638ab[_0x0933('0x94')][_0x0933('0x4b')]){return _0x5638ab['Contacts'][0x0];}var _0x4ade7d=_[_0x0933('0x18')](_0x39165f[_0x0933('0x5d')],{'firstName':_0x39165f['body'][_0x0933('0x8e')],'ListId':_0x5638ab['id']});_0x4ade7d[_0x39165f['body'][_0x0933('0x91')]]=_0x39165f['body'][_0x0933('0x8e')];return db[_0x0933('0x82')]['create'](_0x4ade7d,{'fields':_0x2cba01,'raw':!![]});}})[_0x0933('0x1f')](handleEntityNotFound(_0x1d8708,null))[_0x0933('0x1f')](function(_0x42f4eb){if(_0x42f4eb){_0x39165f[_0x0933('0x98')]=_0x42f4eb;var _0x4504ca={'ContactId':_0x42f4eb['id'],'phone':_0x39165f[_0x0933('0x5d')][_0x0933('0x8e')],'WhatsappAccountId':_0x1c1016[_0x0933('0x54')]['id']};var _0x4191c6={'ContactId':_0x42f4eb['id'],'WhatsappAccountId':_0x1c1016[_0x0933('0x54')]['id'],'closed':![]};return db[_0x0933('0x99')][_0x0933('0x57')]({'where':_0x4191c6})[_0x0933('0x1f')](function(_0x3621e6){if(_0x3621e6){return[_0x3621e6,![]];}return db[_0x0933('0x99')][_0x0933('0x58')](_0x4504ca)[_0x0933('0x1f')](function(_0xa7dfa3){return[_0xa7dfa3,!![]];});});}})['spread'](function(_0x268ffb,_0x44bd55){_0x39165f['interaction']=_0x268ffb[_0x0933('0x37')]({'plain':!![]});_0x39165f[_0x0933('0x9a')]['created']=![];if(_0x44bd55){if(_0x39165f[_0x0933('0x81')][_0x0933('0x9b')]){_0x39165f[_0x0933('0x7f')][_0x0933('0x9c')]({'id':0x0,'priority':_0x39165f['applications'][_0x0933('0x4b')]+0x1,'app':_0x0933('0x9d'),'appdata':_0x0933('0x9e'),'interval':_0x0933('0x9f')});}_0x39165f[_0x0933('0x9a')]['created']=!![];}return db[_0x0933('0xa0')][_0x0933('0x58')]({'phone':_0x39165f[_0x0933('0x5d')][_0x0933('0x8e')],'messageId':_0x39165f['body'][_0x0933('0x8d')],'body':_0x39165f[_0x0933('0x5d')][_0x0933('0x5d')],'WhatsappAccountId':_0x1c1016[_0x0933('0x54')]['id'],'WhatsappInteractionId':_0x268ffb['id'],'direction':'in','ContactId':_0x268ffb[_0x0933('0xa1')],'AttachmentId':_0x39165f[_0x0933('0x5d')][_0x0933('0xa2')]});})[_0x0933('0x1f')](function(_0x1084d4){_0x39165f[_0x0933('0x27')]=_0x1084d4;if(_0x39165f[_0x0933('0x9a')]['UserId']){return db[_0x0933('0x75')][_0x0933('0x57')]({'attributes':['id','name'],'where':{'id':_0x39165f[_0x0933('0x9a')][_0x0933('0xa3')]}})['then'](function(_0x74bdab){if(_0x74bdab){_0x39165f[_0x0933('0x7f')][_0x0933('0xa4')]({'id':0x0,'priority':0x0,'app':_0x0933('0xa5'),'appdata':_0x74bdab[_0x0933('0x3c')]+','+(_0x39165f[_0x0933('0x81')][_0x0933('0xa6')]||0xa),'interval':_0x0933('0x9f')});}return respondWithRpcPromise(_0x0933('0xa7'),_0x0933('0xa8'),_0x39165f);});}return respondWithRpcPromise(_0x0933('0xa7'),'startRouting',_0x39165f);})[_0x0933('0x1f')](function(_0x932758){if(_0x932758){var _0x1b349d=0xc8;var _0x13a73a='receiveMessage';logger['info'](_0x0933('0x23'),_0x13a73a,_0x1b349d,_0x0933('0xa9'));logger[_0x0933('0x22')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x13a73a,_0x1b349d,_0x0933('0xa9'),JSON[_0x0933('0x24')](_0x932758));if(_0x39165f[_0x0933('0x81')]['type']==='twilio'){return _0x1d8708['status'](_0x1b349d)[_0x0933('0xaa')](_0x0933('0xab'),_0x0933('0xac'))[_0x0933('0x3d')](_0x0933('0xad'));}else{return _0x1d8708[_0x0933('0x2a')](_0x1b349d)['json'](_0x932758);}}})[_0x0933('0x29')](handleError(_0x1d8708,null));};exports[_0x0933('0x3d')]=function(_0x443733,_0xbbe9f9,_0x528a31){var _0x3d1bf6,_0x2a4a94,_0x426d75;if(_[_0x0933('0x90')](_0x443733['body']['body'])||_0x443733['body'][_0x0933('0x5d')]===''){throw new db[(_0x0933('0x83'))]['ValidationError'](_0x0933('0xae'));}if(_['isNil'](_0x443733[_0x0933('0x5d')]['to'])){throw new db[(_0x0933('0x83'))][(_0x0933('0x84'))]('to\x20is\x20mandatory');}_0x3d1bf6=_0x443733['body']['to'];return db[_0x0933('0x42')]['find']({'where':{'id':_0x443733[_0x0933('0x54')]['id']},'include':[{'model':db[_0x0933('0x93')],'as':_0x0933('0xaf'),'include':[{'model':db[_0x0933('0x82')],'as':_0x0933('0x94'),'where':{'mobile':_0x3d1bf6},'limit':0x1,'order':[[_0x0933('0x95'),_0x0933('0x96')]]}]}]})[_0x0933('0x1f')](handleEntityNotFound(_0xbbe9f9,null))['then'](function(_0x3f6863){if(_0x3f6863&&_0x3f6863[_0x0933('0xaf')]){_0x2a4a94=_0x3f6863[_0x0933('0x37')]({'plain':!![]});if(_0x2a4a94[_0x0933('0xaf')]&&_0x2a4a94[_0x0933('0xaf')]['Contacts']['length']){return _0x2a4a94[_0x0933('0xaf')][_0x0933('0x94')][0x0];}return db['CmContact'][_0x0933('0x58')](_[_0x0933('0x18')](_0x443733[_0x0933('0x5d')],{'firstName':_0x3d1bf6,'mobile':_0x3d1bf6,'phone':_0x3d1bf6,'ListId':_0x2a4a94[_0x0933('0x88')]}));}})['then'](handleEntityNotFound(_0xbbe9f9,null))['then'](function(_0x5134d7){if(_0x5134d7){_0x426d75=_0x5134d7;return db[_0x0933('0x99')][_0x0933('0x57')]({'where':{'ContactId':_0x426d75['id'],'closed':![],'WhatsappAccountId':_0x2a4a94['id']}})[_0x0933('0x1f')](function(_0x1de6fe){if(_0x1de6fe){return[_0x1de6fe,![]];}return db[_0x0933('0x99')][_0x0933('0x58')]({'UserId':_0x443733['user']['id'],'ContactId':_0x426d75['id'],'WhatsappAccountId':_0x2a4a94['id'],'phone':_0x3d1bf6,'firstMsgDirection':_0x0933('0xb0'),'Messages':[_['merge'](_0x443733['body'],{'read':![],'body':_0x443733[_0x0933('0x5d')][_0x0933('0x5d')],'phone':_0x3d1bf6,'WhatsappAccountId':_0x2a4a94['id'],'UserId':_0x443733[_0x0933('0x59')]['id'],'ContactId':_0x426d75['id']})]},{'include':[{'model':db[_0x0933('0xa0')],'as':_0x0933('0xb1')}]})[_0x0933('0x1f')](function(_0x423059){return[_0x423059,!![]];});});}})[_0x0933('0xb2')](function(_0x360043,_0xb6325){if(_0xb6325){return _0x360043;}return db[_0x0933('0xa0')][_0x0933('0x58')](_[_0x0933('0x4f')](_0x443733['body'],{'read':![],'body':_0x443733[_0x0933('0x5d')][_0x0933('0x5d')],'phone':_0x3d1bf6,'WhatsappAccountId':_0x2a4a94['id'],'WhatsappInteractionId':_0x360043['id'],'UserId':_0x443733['user']['id'],'ContactId':_0x426d75['id']}))[_0x0933('0x1f')](function(_0x3179e6){_0x360043[_0x0933('0xb3')][_0x0933('0xb1')]=[];_0x360043[_0x0933('0xb3')][_0x0933('0xb1')][_0x0933('0x9c')](_0x3179e6[_0x0933('0xb3')]);return _0x360043;});})[_0x0933('0x1f')](respondWithResult(_0xbbe9f9,null))[_0x0933('0x29')](handleError(_0xbbe9f9,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 0ab587e..49b0881 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 _0xfe63=['exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x1bd3ab,_0x352c42){var _0x37e394=function(_0x2f581d){while(--_0x2f581d){_0x1bd3ab['push'](_0x1bd3ab['shift']());}};_0x37e394(++_0x352c42);}(_0xfe63,0x181));var _0x3fe6=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xfe63[_0x7e2eb0];return _0xd92de4;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x3fe6('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x3fe6('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3fe6('0x2'),'afterDestroy':_0x3fe6('0x3')};function emitEvent(_0x388bfd){return function(_0xfc4ef5,_0x17dfa2,_0x134b09){WhatsappAccountEvents[_0x3fe6('0x4')](_0x388bfd+':'+_0xfc4ef5['id'],_0xfc4ef5);WhatsappAccountEvents['emit'](_0x388bfd,_0xfc4ef5);_0x134b09(null);};}for(var e in events){if(events[_0x3fe6('0x5')](e)){var event=events[e];WhatsappAccount[_0x3fe6('0x6')](e,emitEvent(event));}}module[_0x3fe6('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x79e2=['remove','emit','exports','events','../../mysqldb','WhatsappAccount','save','update'];(function(_0x2a0807,_0x379dc0){var _0x40a4d0=function(_0x1f3499){while(--_0x1f3499){_0x2a0807['push'](_0x2a0807['shift']());}};_0x40a4d0(++_0x379dc0);}(_0x79e2,0xbb));var _0x279e=function(_0x2f9737,_0x1a254b){_0x2f9737=_0x2f9737-0x0;var _0x3af777=_0x79e2[_0x2f9737];return _0x3af777;};'use strict';var EventEmitter=require(_0x279e('0x0'));var WhatsappAccount=require(_0x279e('0x1'))['db'][_0x279e('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x279e('0x3'),'afterUpdate':_0x279e('0x4'),'afterDestroy':_0x279e('0x5')};function emitEvent(_0x1b8cd7){return function(_0x5f49ff,_0xa7782b,_0x42ecad){WhatsappAccountEvents['emit'](_0x1b8cd7+':'+_0x5f49ff['id'],_0x5f49ff);WhatsappAccountEvents[_0x279e('0x6')](_0x1b8cd7,_0x5f49ff);_0x42ecad(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x279e('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index fa8badb..ca19c9f 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 _0x7bdf=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0x7bdf,0xa6));var _0xf7bd=function(_0x160ffb,_0x253293){_0x160ffb=_0x160ffb-0x0;var _0x15b530=_0x7bdf[_0x160ffb];return _0x15b530;};'use strict';var _=require(_0xf7bd('0x0'));var util=require(_0xf7bd('0x1'));var logger=require(_0xf7bd('0x2'))(_0xf7bd('0x3'));var moment=require(_0xf7bd('0x4'));var BPromise=require(_0xf7bd('0x5'));var rp=require(_0xf7bd('0x6'));var fs=require('fs');var path=require(_0xf7bd('0x7'));var rimraf=require(_0xf7bd('0x8'));var config=require(_0xf7bd('0x9'));var attributes=require(_0xf7bd('0xa'));module[_0xf7bd('0xb')]=function(_0x144306,_0x5f47a5){return _0x144306['define']('WhatsappAccount',attributes,{'tableName':_0xf7bd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6da=['rimraf','./whatsappAccount.attributes','exports','WhatsappAccount','lodash','util','api','request-promise'];(function(_0x53057f,_0x3970d5){var _0x2a40c5=function(_0x2ddce8){while(--_0x2ddce8){_0x53057f['push'](_0x53057f['shift']());}};_0x2a40c5(++_0x3970d5);}(_0xd6da,0xe4));var _0xad6d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd6da[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xad6d('0x0'));var util=require(_0xad6d('0x1'));var logger=require('../../config/logger')(_0xad6d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xad6d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad6d('0x4'));var config=require('../../config/environment');var attributes=require(_0xad6d('0x5'));module[_0xad6d('0x6')]=function(_0xcba170,_0x13c755){return _0xcba170['define'](_0xad6d('0x7'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 891983d..bd1ca99 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 _0x30ca=['catch','util','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','error','message','result','ShowWhatsappAccount','WhatsappAccount','options','where','attributes','include','map','model','info','debug','stringify'];(function(_0xb347b9,_0x3c4105){var _0x40091b=function(_0x48b57e){while(--_0x48b57e){_0xb347b9['push'](_0xb347b9['shift']());}};_0x40091b(++_0x3c4105);}(_0x30ca,0xda));var _0xa30c=function(_0x4eb00a,_0x264758){_0x4eb00a=_0x4eb00a-0x0;var _0x5570b3=_0x30ca[_0x4eb00a];return _0x5570b3;};'use strict';var _=require('lodash');var util=require(_0xa30c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa30c('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0xa30c('0x2'))(_0xa30c('0x3'));var config=require(_0xa30c('0x4'));var jayson=require(_0xa30c('0x5'));var client=jayson[_0xa30c('0x6')]['http']({'port':0x232a});config['redis']=_[_0xa30c('0x7')](config[_0xa30c('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xa30c('0x9'))(new Redis(config[_0xa30c('0x8')]));require(_0xa30c('0xa'))[_0xa30c('0xb')](socket);function respondWithRpcPromise(_0x4d1ffd,_0x2279ca,_0x224348){return new BPromise(function(_0x57e65e,_0x360964){return client[_0xa30c('0xc')](_0x4d1ffd,_0x224348)[_0xa30c('0xd')](function(_0x47b0fa){logger['info'](_0xa30c('0xe'),_0x2279ca,_0xa30c('0xf'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2279ca,_0xa30c('0xf'),JSON['stringify'](_0x47b0fa));if(_0x47b0fa[_0xa30c('0x10')]){if(_0x47b0fa[_0xa30c('0x10')]['code']===0x1f4){logger[_0xa30c('0x10')](_0xa30c('0xe'),_0x2279ca,_0x47b0fa[_0xa30c('0x10')]['message']);return _0x360964(_0x47b0fa[_0xa30c('0x10')]['message']);}logger[_0xa30c('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x2279ca,_0x47b0fa[_0xa30c('0x10')]['message']);return _0x57e65e(_0x47b0fa['error'][_0xa30c('0x11')]);}else{logger['info'](_0xa30c('0xe'),_0x2279ca,_0xa30c('0xf'));_0x57e65e(_0x47b0fa[_0xa30c('0x12')][_0xa30c('0x11')]);}})['catch'](function(_0x4defff){logger[_0xa30c('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x2279ca,_0x4defff);_0x360964(_0x4defff);});});}exports[_0xa30c('0x13')]=function(_0x5aa885){var _0x1bd910=this;return new Promise(function(_0x25ef47,_0x11becc){return db[_0xa30c('0x14')]['find']({'raw':_0x5aa885[_0xa30c('0x15')]?_0x5aa885['options']['raw']===undefined?!![]:![]:!![],'where':_0x5aa885[_0xa30c('0x15')]?_0x5aa885[_0xa30c('0x15')][_0xa30c('0x16')]||null:null,'attributes':_0x5aa885['options']?_0x5aa885[_0xa30c('0x15')][_0xa30c('0x17')]||null:null,'include':_0x5aa885['options']?_0x5aa885['options'][_0xa30c('0x18')]?_[_0xa30c('0x19')](_0x5aa885[_0xa30c('0x15')]['include'],function(_0x3603a4){return{'model':db[_0x3603a4[_0xa30c('0x1a')]],'as':_0x3603a4['as'],'attributes':_0x3603a4['attributes'],'include':_0x3603a4[_0xa30c('0x18')]?_[_0xa30c('0x19')](_0x3603a4[_0xa30c('0x18')],function(_0xa428ed){return{'model':db[_0xa428ed[_0xa30c('0x1a')]],'as':_0xa428ed['as'],'attributes':_0xa428ed[_0xa30c('0x17')],'include':_0xa428ed[_0xa30c('0x18')]?_['map'](_0xa428ed[_0xa30c('0x18')],function(_0x1c4bdd){return{'model':db[_0x1c4bdd[_0xa30c('0x1a')]],'as':_0x1c4bdd['as'],'attributes':_0x1c4bdd['attributes']};}):[]};}):[]};}):[]:[]})[_0xa30c('0xd')](function(_0xd4c7b4){logger[_0xa30c('0x1b')](_0xa30c('0x13'),_0x5aa885);logger[_0xa30c('0x1c')](_0xa30c('0x13'),_0x5aa885,JSON[_0xa30c('0x1d')](_0xd4c7b4));_0x25ef47(_0xd4c7b4);})[_0xa30c('0x1e')](function(_0x2cbe9c){logger[_0xa30c('0x10')]('ShowWhatsappAccount',_0x2cbe9c[_0xa30c('0x11')],_0x5aa885);_0x11becc(_0x1bd910[_0xa30c('0x10')](0x1f4,_0x2cbe9c[_0xa30c('0x11')]));});});}; \ No newline at end of file +var _0xf6f7=['client','http','redis','localhost','socket.io-emitter','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4bf3f4,_0x389534){var _0x5aa7de=function(_0x2f5bb8){while(--_0x2f5bb8){_0x4bf3f4['push'](_0x4bf3f4['shift']());}};_0x5aa7de(++_0x389534);}(_0xf6f7,0xae));var _0x7f6f=function(_0x1c3370,_0xf617e8){_0x1c3370=_0x1c3370-0x0;var _0xa9b358=_0xf6f7[_0x1c3370];return _0xa9b358;};'use strict';var _=require(_0x7f6f('0x0'));var util=require(_0x7f6f('0x1'));var moment=require(_0x7f6f('0x2'));var BPromise=require(_0x7f6f('0x3'));var rs=require(_0x7f6f('0x4'));var fs=require('fs');var Redis=require(_0x7f6f('0x5'));var db=require(_0x7f6f('0x6'))['db'];var utils=require(_0x7f6f('0x7'));var logger=require(_0x7f6f('0x8'))('rpc');var config=require(_0x7f6f('0x9'));var jayson=require(_0x7f6f('0xa'));var client=jayson[_0x7f6f('0xb')][_0x7f6f('0xc')]({'port':0x232a});config[_0x7f6f('0xd')]=_['defaults'](config[_0x7f6f('0xd')],{'host':_0x7f6f('0xe'),'port':0x18eb});var socket=require(_0x7f6f('0xf'))(new Redis(config[_0x7f6f('0xd')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x368f9b,_0x555a17,_0x1738e3){return new BPromise(function(_0x4550d3,_0x553d2f){return client['request'](_0x368f9b,_0x1738e3)[_0x7f6f('0x10')](function(_0x30a458){logger[_0x7f6f('0x11')](_0x7f6f('0x12'),_0x555a17,_0x7f6f('0x13'));logger[_0x7f6f('0x14')](_0x7f6f('0x15'),_0x555a17,'request\x20sent',JSON[_0x7f6f('0x16')](_0x30a458));if(_0x30a458[_0x7f6f('0x17')]){if(_0x30a458[_0x7f6f('0x17')][_0x7f6f('0x18')]===0x1f4){logger[_0x7f6f('0x17')](_0x7f6f('0x12'),_0x555a17,_0x30a458['error'][_0x7f6f('0x19')]);return _0x553d2f(_0x30a458[_0x7f6f('0x17')][_0x7f6f('0x19')]);}logger['error'](_0x7f6f('0x12'),_0x555a17,_0x30a458[_0x7f6f('0x17')][_0x7f6f('0x19')]);return _0x4550d3(_0x30a458[_0x7f6f('0x17')][_0x7f6f('0x19')]);}else{logger[_0x7f6f('0x11')](_0x7f6f('0x12'),_0x555a17,_0x7f6f('0x13'));_0x4550d3(_0x30a458['result']['message']);}})[_0x7f6f('0x1a')](function(_0x869c64){logger[_0x7f6f('0x17')](_0x7f6f('0x12'),_0x555a17,_0x869c64);_0x553d2f(_0x869c64);});});}exports[_0x7f6f('0x1b')]=function(_0x5ed0eb){var _0x57b1b8=this;return new Promise(function(_0x54f085,_0x308019){return db[_0x7f6f('0x1c')][_0x7f6f('0x1d')]({'raw':_0x5ed0eb[_0x7f6f('0x1e')]?_0x5ed0eb[_0x7f6f('0x1e')][_0x7f6f('0x1f')]===undefined?!![]:![]:!![],'where':_0x5ed0eb[_0x7f6f('0x1e')]?_0x5ed0eb[_0x7f6f('0x1e')][_0x7f6f('0x20')]||null:null,'attributes':_0x5ed0eb[_0x7f6f('0x1e')]?_0x5ed0eb[_0x7f6f('0x1e')][_0x7f6f('0x21')]||null:null,'include':_0x5ed0eb[_0x7f6f('0x1e')]?_0x5ed0eb['options'][_0x7f6f('0x22')]?_[_0x7f6f('0x23')](_0x5ed0eb['options']['include'],function(_0x472eba){return{'model':db[_0x472eba[_0x7f6f('0x24')]],'as':_0x472eba['as'],'attributes':_0x472eba[_0x7f6f('0x21')],'include':_0x472eba[_0x7f6f('0x22')]?_['map'](_0x472eba[_0x7f6f('0x22')],function(_0x486b7b){return{'model':db[_0x486b7b['model']],'as':_0x486b7b['as'],'attributes':_0x486b7b[_0x7f6f('0x21')],'include':_0x486b7b[_0x7f6f('0x22')]?_[_0x7f6f('0x23')](_0x486b7b[_0x7f6f('0x22')],function(_0x45fa04){return{'model':db[_0x45fa04[_0x7f6f('0x24')]],'as':_0x45fa04['as'],'attributes':_0x45fa04['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d2b12){logger['info'](_0x7f6f('0x1b'),_0x5ed0eb);logger['debug'](_0x7f6f('0x1b'),_0x5ed0eb,JSON[_0x7f6f('0x16')](_0x2d2b12));_0x54f085(_0x2d2b12);})[_0x7f6f('0x1a')](function(_0x436f54){logger[_0x7f6f('0x17')](_0x7f6f('0x1b'),_0x436f54[_0x7f6f('0x19')],_0x5ed0eb);_0x308019(_0x57b1b8[_0x7f6f('0x17')](0x1f4,_0x436f54[_0x7f6f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 34f0af6..341f7b0 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 _0xd685=['emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','update'];(function(_0x3234fa,_0x328a0b){var _0x42da30=function(_0x223679){while(--_0x223679){_0x3234fa['push'](_0x3234fa['shift']());}};_0x42da30(++_0x328a0b);}(_0xd685,0x8a));var _0x5d68=function(_0x9901c4,_0x1e8dd9){_0x9901c4=_0x9901c4-0x0;var _0x49842c=_0xd685[_0x9901c4];return _0x49842c;};'use strict';var WhatsappAccountEvents=require(_0x5d68('0x0'));var events=['save','remove',_0x5d68('0x1')];function createListener(_0xe62bf,_0x33b411){return function(_0x5a9769){_0x33b411[_0x5d68('0x2')](_0xe62bf,_0x5a9769);};}function removeListener(_0x44ba09,_0x3f56c4){return function(){WhatsappAccountEvents[_0x5d68('0x3')](_0x44ba09,_0x3f56c4);};}exports[_0x5d68('0x4')]=function(_0xfa5321){for(var _0x38bcb6=0x0,_0x198bf2=events[_0x5d68('0x5')];_0x38bcb6<_0x198bf2;_0x38bcb6++){var _0x449bb4=events[_0x38bcb6];var _0x239b6b=createListener(_0x5d68('0x6')+_0x449bb4,_0xfa5321);WhatsappAccountEvents['on'](_0x449bb4,_0x239b6b);}}; \ No newline at end of file +var _0xb510=['remove','emit','register','length','whatsappAccount:'];(function(_0x4e04e2,_0x35c8c2){var _0x474ba4=function(_0x354a84){while(--_0x354a84){_0x4e04e2['push'](_0x4e04e2['shift']());}};_0x474ba4(++_0x35c8c2);}(_0xb510,0x91));var _0x0b51=function(_0x2373d5,_0x2ed0e1){_0x2373d5=_0x2373d5-0x0;var _0x2ed413=_0xb510[_0x2373d5];return _0x2ed413;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=['save',_0x0b51('0x0'),'update'];function createListener(_0x516893,_0x445d94){return function(_0x19deeb){_0x445d94[_0x0b51('0x1')](_0x516893,_0x19deeb);};}function removeListener(_0x29c1a9,_0x5b3acc){return function(){WhatsappAccountEvents['removeListener'](_0x29c1a9,_0x5b3acc);};}exports[_0x0b51('0x2')]=function(_0x5133fd){for(var _0x563621=0x0,_0x49aaa6=events[_0x0b51('0x3')];_0x563621<_0x49aaa6;_0x563621++){var _0x5f426d=events[_0x563621];var _0xc66655=createListener(_0x0b51('0x4')+_0x5f426d,_0x5133fd);WhatsappAccountEvents['on'](_0x5f426d,_0xc66655);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index ea112c8..64dfedc 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 _0x933e=['create','put','/:id','update','delete','destroy','exports','multer','util','path','express','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','index','isAuthenticated','show'];(function(_0x24754d,_0x190517){var _0xe9fbd1=function(_0x21de33){while(--_0x21de33){_0x24754d['push'](_0x24754d['shift']());}};_0xe9fbd1(++_0x190517);}(_0x933e,0xdf));var _0xe933=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x933e[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xe933('0x0'));var util=require(_0xe933('0x1'));var path=require(_0xe933('0x2'));var timeout=require('connect-timeout');var express=require(_0xe933('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe933('0x4'));var config=require(_0xe933('0x5'));var controller=require(_0xe933('0x6'));router[_0xe933('0x7')]('/',auth['isAuthenticated'](),controller[_0xe933('0x8')]);router[_0xe933('0x7')]('/:id',auth[_0xe933('0x9')](),controller[_0xe933('0xa')]);router['post']('/',auth[_0xe933('0x9')](),controller[_0xe933('0xb')]);router[_0xe933('0xc')](_0xe933('0xd'),auth[_0xe933('0x9')](),controller[_0xe933('0xe')]);router[_0xe933('0xf')](_0xe933('0xd'),auth[_0xe933('0x9')](),controller[_0xe933('0x10')]);module[_0xe933('0x11')]=router; \ No newline at end of file +var _0x0b64=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0b64,0x1f4));var _0x40b6=function(_0x3316b2,_0x22c9ba){_0x3316b2=_0x3316b2-0x0;var _0x593c32=_0x0b64[_0x3316b2];return _0x593c32;};'use strict';var multer=require(_0x40b6('0x0'));var util=require(_0x40b6('0x1'));var path=require(_0x40b6('0x2'));var timeout=require('connect-timeout');var express=require(_0x40b6('0x3'));var router=express[_0x40b6('0x4')]();var fs_extra=require(_0x40b6('0x5'));var auth=require(_0x40b6('0x6'));var interaction=require(_0x40b6('0x7'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x40b6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x40b6('0x8')](_0x40b6('0x9'),auth[_0x40b6('0xa')](),controller[_0x40b6('0xb')]);router[_0x40b6('0xc')]('/',auth[_0x40b6('0xa')](),controller['create']);router[_0x40b6('0xd')]('/:id',auth[_0x40b6('0xa')](),controller[_0x40b6('0xe')]);router[_0x40b6('0xf')](_0x40b6('0x9'),auth['isAuthenticated'](),controller[_0x40b6('0x10')]);module[_0x40b6('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index ec504c4..31c9469 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 _0x1ba2=['INTEGER','STRING','noop','sequelize','exports'];(function(_0x50c492,_0x5c1e67){var _0x3505a8=function(_0x2f7937){while(--_0x2f7937){_0x50c492['push'](_0x50c492['shift']());}};_0x3505a8(++_0x5c1e67);}(_0x1ba2,0x10c));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x21ba('0x0'));module[_0x21ba('0x1')]={'priority':{'type':Sequelize[_0x21ba('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x21ba('0x3')],'allowNull':![],'defaultValue':_0x21ba('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x21ba('0x3')]},'interval':{'type':Sequelize[_0x21ba('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x6a47=['exports','INTEGER','STRING','noop','sequelize'];(function(_0x18b97e,_0x52b0ee){var _0x55e750=function(_0x38aa2e){while(--_0x38aa2e){_0x18b97e['push'](_0x18b97e['shift']());}};_0x55e750(++_0x52b0ee);}(_0x6a47,0x112));var _0x76a4=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6a47[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x76a4('0x0'));module[_0x76a4('0x1')]={'priority':{'type':Sequelize[_0x76a4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x76a4('0x3')],'allowNull':![],'defaultValue':_0x76a4('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x76a4('0x3')]},'interval':{'type':Sequelize[_0x76a4('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 646050b..b98da84 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 _0x4f81=['offset','undefined','limit','count','set','save','destroy','then','error','stack','name','send','map','WhatsappApplication','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','type','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','update','body','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x5f1997,_0x3a2035){var _0x797fca=function(_0x3554f1){while(--_0x3554f1){_0x5f1997['push'](_0x5f1997['shift']());}};_0x797fca(++_0x3a2035);}(_0x4f81,0x1e3));var _0x14f8=function(_0x442a03,_0x4b8b1c){_0x442a03=_0x442a03-0x0;var _0x3cc0d6=_0x4f81[_0x442a03];return _0x3cc0d6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x14f8('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x14f8('0x1'));var moment=require(_0x14f8('0x2'));var BPromise=require(_0x14f8('0x3'));var Mustache=require(_0x14f8('0x4'));var util=require(_0x14f8('0x5'));var path=require(_0x14f8('0x6'));var sox=require(_0x14f8('0x7'));var csv=require('to-csv');var ejs=require(_0x14f8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14f8('0x9'));var squel=require(_0x14f8('0xa'));var crypto=require('crypto');var jsforce=require(_0x14f8('0xb'));var deskjs=require(_0x14f8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x14f8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x14f8('0xe'));var qs=require(_0x14f8('0xf'));var as=require(_0x14f8('0x10'));var hardwareService=require(_0x14f8('0x11'));var logger=require(_0x14f8('0x12'))(_0x14f8('0x13'));var utils=require(_0x14f8('0x14'));var config=require(_0x14f8('0x15'));var licenseUtil=require(_0x14f8('0x16'));var db=require(_0x14f8('0x17'))['db'];function respondWithStatusCode(_0x228505,_0x29d50a){_0x29d50a=_0x29d50a||0xcc;return function(_0x5f2843){if(_0x5f2843){return _0x228505[_0x14f8('0x18')](_0x29d50a);}return _0x228505[_0x14f8('0x19')](_0x29d50a)[_0x14f8('0x1a')]();};}function respondWithResult(_0x422cb7,_0x1eae95){_0x1eae95=_0x1eae95||0xc8;return function(_0x4b3c32){if(_0x4b3c32){return _0x422cb7[_0x14f8('0x19')](_0x1eae95)[_0x14f8('0x1b')](_0x4b3c32);}};}function respondWithFilteredResult(_0x4022a3,_0x1216e8){return function(_0x57e917){if(_0x57e917){var _0x3481a1=typeof _0x1216e8[_0x14f8('0x1c')]===_0x14f8('0x1d')&&typeof _0x1216e8[_0x14f8('0x1e')]===_0x14f8('0x1d');var _0x1dfcc2=_0x57e917[_0x14f8('0x1f')];var _0x4a1a90=_0x3481a1?0x0:_0x1216e8[_0x14f8('0x1c')];var _0x4495de=_0x3481a1?_0x57e917['count']:_0x1216e8['offset']+_0x1216e8['limit'];var _0x3e62a1;if(_0x4495de>=_0x1dfcc2){_0x4495de=_0x1dfcc2;_0x3e62a1=0xc8;}else{_0x3e62a1=0xce;}_0x4022a3[_0x14f8('0x19')](_0x3e62a1);return _0x4022a3[_0x14f8('0x20')]('Content-Range',_0x4a1a90+'-'+_0x4495de+'/'+_0x1dfcc2)[_0x14f8('0x1b')](_0x57e917);}return null;};}function patchUpdates(_0x30c2cd){return function(_0x13b283){try{jsonpatch['apply'](_0x13b283,_0x30c2cd,!![]);}catch(_0x3526e5){return BPromise['reject'](_0x3526e5);}return _0x13b283[_0x14f8('0x21')]();};}function saveUpdates(_0x14fa31,_0x4bfacd){return function(_0x575a23){if(_0x575a23){return _0x575a23['update'](_0x14fa31)['then'](function(_0x32ebe5){return _0x32ebe5;});}return null;};}function removeEntity(_0x12f47f,_0x15995a){return function(_0x12443d){if(_0x12443d){return _0x12443d[_0x14f8('0x22')]()[_0x14f8('0x23')](function(){_0x12f47f['status'](0xcc)[_0x14f8('0x1a')]();});}};}function handleEntityNotFound(_0x504ac4,_0x16360d){return function(_0x26e370){if(!_0x26e370){_0x504ac4[_0x14f8('0x18')](0x194);}return _0x26e370;};}function handleError(_0x52fe4d,_0x45f4e9){_0x45f4e9=_0x45f4e9||0x1f4;return function(_0x5540ac){logger[_0x14f8('0x24')](_0x5540ac[_0x14f8('0x25')]);if(_0x5540ac['name']){delete _0x5540ac[_0x14f8('0x26')];}_0x52fe4d[_0x14f8('0x19')](_0x45f4e9)[_0x14f8('0x27')](_0x5540ac);};}exports['index']=function(_0x408d99,_0x43bb3d){var _0x23aa31={},_0x58ba3b={},_0x3e1d02={'count':0x0,'rows':[]};var _0x2ae3ed=_[_0x14f8('0x28')](db[_0x14f8('0x29')][_0x14f8('0x2a')],function(_0x366292){return{'name':_0x366292[_0x14f8('0x2b')],'type':_0x366292['type'][_0x14f8('0x2c')]};});_0x58ba3b['model']=_['map'](_0x2ae3ed,_0x14f8('0x26'));_0x58ba3b['query']=_[_0x14f8('0x2d')](_0x408d99[_0x14f8('0x2e')]);_0x58ba3b[_0x14f8('0x2f')]=_[_0x14f8('0x30')](_0x58ba3b[_0x14f8('0x31')],_0x58ba3b['query']);_0x23aa31[_0x14f8('0x32')]=_[_0x14f8('0x30')](_0x58ba3b['model'],qs['fields'](_0x408d99[_0x14f8('0x2e')][_0x14f8('0x33')]));_0x23aa31['attributes']=_0x23aa31[_0x14f8('0x32')]['length']?_0x23aa31['attributes']:_0x58ba3b['model'];if(!_0x408d99[_0x14f8('0x2e')][_0x14f8('0x34')](_0x14f8('0x35'))){_0x23aa31['limit']=qs[_0x14f8('0x1e')](_0x408d99['query'][_0x14f8('0x1e')]);_0x23aa31[_0x14f8('0x1c')]=qs['offset'](_0x408d99[_0x14f8('0x2e')][_0x14f8('0x1c')]);}_0x23aa31['order']=qs[_0x14f8('0x36')](_0x408d99[_0x14f8('0x2e')][_0x14f8('0x36')]);_0x23aa31[_0x14f8('0x37')]=qs[_0x14f8('0x2f')](_[_0x14f8('0x38')](_0x408d99['query'],_0x58ba3b[_0x14f8('0x2f')]),_0x2ae3ed);if(_0x408d99['query']['filter']){_0x23aa31[_0x14f8('0x37')]=_['merge'](_0x23aa31['where'],{'$or':_[_0x14f8('0x28')](_0x2ae3ed,function(_0x107497){if(_0x107497[_0x14f8('0x39')]!=='VIRTUAL'){var _0x536da9={};_0x536da9[_0x107497['name']]={'$like':'%'+_0x408d99[_0x14f8('0x2e')][_0x14f8('0x3a')]+'%'};return _0x536da9;}})});}_0x23aa31=_[_0x14f8('0x3b')]({},_0x23aa31,_0x408d99[_0x14f8('0x3c')]);var _0xc941a9={'where':_0x23aa31[_0x14f8('0x37')]};return db[_0x14f8('0x29')][_0x14f8('0x1f')](_0xc941a9)[_0x14f8('0x23')](function(_0x5121d3){_0x3e1d02['count']=_0x5121d3;if(_0x408d99[_0x14f8('0x2e')][_0x14f8('0x3d')]){_0x23aa31[_0x14f8('0x3e')]=[{'all':!![]}];}return db[_0x14f8('0x29')][_0x14f8('0x3f')](_0x23aa31);})['then'](function(_0x101adc){_0x3e1d02[_0x14f8('0x40')]=_0x101adc;return _0x3e1d02;})[_0x14f8('0x23')](respondWithFilteredResult(_0x43bb3d,_0x23aa31))[_0x14f8('0x41')](handleError(_0x43bb3d,null));};exports[_0x14f8('0x42')]=function(_0x4b7a9e,_0x289c2e){var _0x96b1e8={'raw':!![],'where':{'id':_0x4b7a9e[_0x14f8('0x43')]['id']}},_0x59e472={};_0x59e472[_0x14f8('0x31')]=_['keys'](db[_0x14f8('0x29')][_0x14f8('0x2a')]);_0x59e472[_0x14f8('0x2e')]=_[_0x14f8('0x2d')](_0x4b7a9e['query']);_0x59e472[_0x14f8('0x2f')]=_['intersection'](_0x59e472[_0x14f8('0x31')],_0x59e472[_0x14f8('0x2e')]);_0x96b1e8[_0x14f8('0x32')]=_[_0x14f8('0x30')](_0x59e472[_0x14f8('0x31')],qs['fields'](_0x4b7a9e[_0x14f8('0x2e')][_0x14f8('0x33')]));_0x96b1e8[_0x14f8('0x32')]=_0x96b1e8[_0x14f8('0x32')][_0x14f8('0x44')]?_0x96b1e8[_0x14f8('0x32')]:_0x59e472[_0x14f8('0x31')];if(_0x4b7a9e[_0x14f8('0x2e')][_0x14f8('0x3d')]){_0x96b1e8[_0x14f8('0x3e')]=[{'all':!![]}];}_0x96b1e8=_[_0x14f8('0x3b')]({},_0x96b1e8,_0x4b7a9e[_0x14f8('0x3c')]);return db['WhatsappApplication'][_0x14f8('0x45')](_0x96b1e8)['then'](handleEntityNotFound(_0x289c2e,null))[_0x14f8('0x23')](respondWithResult(_0x289c2e,null))[_0x14f8('0x41')](handleError(_0x289c2e,null));};exports['create']=function(_0x232cad,_0x1d1fe7){return db[_0x14f8('0x29')][_0x14f8('0x46')](_0x232cad['body'],{})[_0x14f8('0x23')](respondWithResult(_0x1d1fe7,0xc9))['catch'](handleError(_0x1d1fe7,null));};exports[_0x14f8('0x47')]=function(_0x163ffd,_0x572da7){if(_0x163ffd['body']['id']){delete _0x163ffd[_0x14f8('0x48')]['id'];}return db[_0x14f8('0x29')][_0x14f8('0x45')]({'where':{'id':_0x163ffd[_0x14f8('0x43')]['id']}})[_0x14f8('0x23')](handleEntityNotFound(_0x572da7,null))[_0x14f8('0x23')](saveUpdates(_0x163ffd['body'],null))[_0x14f8('0x23')](respondWithResult(_0x572da7,null))[_0x14f8('0x41')](handleError(_0x572da7,null));};exports[_0x14f8('0x22')]=function(_0x54e6f2,_0x4963bb){return db[_0x14f8('0x29')][_0x14f8('0x45')]({'where':{'id':_0x54e6f2[_0x14f8('0x43')]['id']}})[_0x14f8('0x23')](handleEntityNotFound(_0x4963bb,null))[_0x14f8('0x23')](removeEntity(_0x4963bb,null))['catch'](handleError(_0x4963bb,null));}; \ No newline at end of file +var _0x8277=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','rawAttributes','key','keys','query','filters','model','attributes','intersection','fields','length','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','rows','catch','show','find','create','body','params','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3b8cf0,_0x47e4b9){var _0x258259=function(_0x4dd575){while(--_0x4dd575){_0x3b8cf0['push'](_0x3b8cf0['shift']());}};_0x258259(++_0x47e4b9);}(_0x8277,0xcf));var _0x7827=function(_0x560448,_0x2c1082){_0x560448=_0x560448-0x0;var _0x550276=_0x8277[_0x560448];return _0x550276;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7827('0x0'));var zipdir=require(_0x7827('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7827('0x2'));var moment=require(_0x7827('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7827('0x4'));var util=require(_0x7827('0x5'));var path=require('path');var sox=require(_0x7827('0x6'));var csv=require(_0x7827('0x7'));var ejs=require(_0x7827('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7827('0x9'));var squel=require(_0x7827('0xa'));var crypto=require(_0x7827('0xb'));var jsforce=require(_0x7827('0xc'));var deskjs=require(_0x7827('0xd'));var toCsv=require(_0x7827('0x7'));var querystring=require(_0x7827('0xe'));var Papa=require(_0x7827('0xf'));var Redis=require(_0x7827('0x10'));var authService=require(_0x7827('0x11'));var qs=require(_0x7827('0x12'));var as=require(_0x7827('0x13'));var hardwareService=require(_0x7827('0x14'));var logger=require(_0x7827('0x15'))('api');var utils=require(_0x7827('0x16'));var config=require(_0x7827('0x17'));var licenseUtil=require(_0x7827('0x18'));var db=require(_0x7827('0x19'))['db'];function respondWithStatusCode(_0x5e3061,_0x3a5a48){_0x3a5a48=_0x3a5a48||0xcc;return function(_0xb8c1a9){if(_0xb8c1a9){return _0x5e3061[_0x7827('0x1a')](_0x3a5a48);}return _0x5e3061[_0x7827('0x1b')](_0x3a5a48)[_0x7827('0x1c')]();};}function respondWithResult(_0x41dcb9,_0x35c668){_0x35c668=_0x35c668||0xc8;return function(_0x453f04){if(_0x453f04){return _0x41dcb9[_0x7827('0x1b')](_0x35c668)[_0x7827('0x1d')](_0x453f04);}};}function respondWithFilteredResult(_0x2eae42,_0x33bded){return function(_0x2fe484){if(_0x2fe484){var _0x85c389=typeof _0x33bded[_0x7827('0x1e')]==='undefined'&&typeof _0x33bded[_0x7827('0x1f')]===_0x7827('0x20');var _0x19be26=_0x2fe484[_0x7827('0x21')];var _0x34a6b2=_0x85c389?0x0:_0x33bded[_0x7827('0x1e')];var _0x18ca8f=_0x85c389?_0x2fe484[_0x7827('0x21')]:_0x33bded['offset']+_0x33bded[_0x7827('0x1f')];var _0x13f66f;if(_0x18ca8f>=_0x19be26){_0x18ca8f=_0x19be26;_0x13f66f=0xc8;}else{_0x13f66f=0xce;}_0x2eae42[_0x7827('0x1b')](_0x13f66f);return _0x2eae42[_0x7827('0x22')](_0x7827('0x23'),_0x34a6b2+'-'+_0x18ca8f+'/'+_0x19be26)[_0x7827('0x1d')](_0x2fe484);}return null;};}function patchUpdates(_0x216bf6){return function(_0x523edf){try{jsonpatch[_0x7827('0x24')](_0x523edf,_0x216bf6,!![]);}catch(_0x4a1dd1){return BPromise[_0x7827('0x25')](_0x4a1dd1);}return _0x523edf[_0x7827('0x26')]();};}function saveUpdates(_0x4697aa,_0x3465de){return function(_0x589d37){if(_0x589d37){return _0x589d37[_0x7827('0x27')](_0x4697aa)[_0x7827('0x28')](function(_0x14070d){return _0x14070d;});}return null;};}function removeEntity(_0x5ecc81,_0x18dbc3){return function(_0x55a4d4){if(_0x55a4d4){return _0x55a4d4[_0x7827('0x29')]()['then'](function(){_0x5ecc81[_0x7827('0x1b')](0xcc)[_0x7827('0x1c')]();});}};}function handleEntityNotFound(_0x2745e4,_0x3271c9){return function(_0x4d1c18){if(!_0x4d1c18){_0x2745e4[_0x7827('0x1a')](0x194);}return _0x4d1c18;};}function handleError(_0x4b2a0d,_0x3ec12e){_0x3ec12e=_0x3ec12e||0x1f4;return function(_0x2e12d6){logger[_0x7827('0x2a')](_0x2e12d6[_0x7827('0x2b')]);if(_0x2e12d6[_0x7827('0x2c')]){delete _0x2e12d6[_0x7827('0x2c')];}_0x4b2a0d[_0x7827('0x1b')](_0x3ec12e)[_0x7827('0x2d')](_0x2e12d6);};}exports[_0x7827('0x2e')]=function(_0x4b25ba,_0x21b502){var _0x301b31={},_0x25415b={},_0x25bcbe={'count':0x0,'rows':[]};var _0x52c029=_[_0x7827('0x2f')](db[_0x7827('0x30')][_0x7827('0x31')],function(_0x26a004){return{'name':_0x26a004['fieldName'],'type':_0x26a004['type'][_0x7827('0x32')]};});_0x25415b['model']=_[_0x7827('0x2f')](_0x52c029,_0x7827('0x2c'));_0x25415b['query']=_[_0x7827('0x33')](_0x4b25ba[_0x7827('0x34')]);_0x25415b[_0x7827('0x35')]=_['intersection'](_0x25415b[_0x7827('0x36')],_0x25415b['query']);_0x301b31[_0x7827('0x37')]=_[_0x7827('0x38')](_0x25415b['model'],qs[_0x7827('0x39')](_0x4b25ba['query'][_0x7827('0x39')]));_0x301b31['attributes']=_0x301b31[_0x7827('0x37')][_0x7827('0x3a')]?_0x301b31[_0x7827('0x37')]:_0x25415b[_0x7827('0x36')];if(!_0x4b25ba[_0x7827('0x34')]['hasOwnProperty']('nolimit')){_0x301b31[_0x7827('0x1f')]=qs['limit'](_0x4b25ba[_0x7827('0x34')]['limit']);_0x301b31[_0x7827('0x1e')]=qs[_0x7827('0x1e')](_0x4b25ba['query'][_0x7827('0x1e')]);}_0x301b31[_0x7827('0x3b')]=qs[_0x7827('0x3c')](_0x4b25ba['query'][_0x7827('0x3c')]);_0x301b31[_0x7827('0x3d')]=qs[_0x7827('0x35')](_[_0x7827('0x3e')](_0x4b25ba[_0x7827('0x34')],_0x25415b['filters']),_0x52c029);if(_0x4b25ba[_0x7827('0x34')]['filter']){_0x301b31[_0x7827('0x3d')]=_[_0x7827('0x3f')](_0x301b31[_0x7827('0x3d')],{'$or':_['map'](_0x52c029,function(_0x30bb81){if(_0x30bb81[_0x7827('0x40')]!==_0x7827('0x41')){var _0x4624af={};_0x4624af[_0x30bb81['name']]={'$like':'%'+_0x4b25ba[_0x7827('0x34')][_0x7827('0x42')]+'%'};return _0x4624af;}})});}_0x301b31=_[_0x7827('0x3f')]({},_0x301b31,_0x4b25ba['options']);var _0x4bfaa0={'where':_0x301b31[_0x7827('0x3d')]};return db[_0x7827('0x30')]['count'](_0x4bfaa0)[_0x7827('0x28')](function(_0x5243a5){_0x25bcbe['count']=_0x5243a5;if(_0x4b25ba[_0x7827('0x34')][_0x7827('0x43')]){_0x301b31[_0x7827('0x44')]=[{'all':!![]}];}return db[_0x7827('0x30')]['findAll'](_0x301b31);})[_0x7827('0x28')](function(_0x453ec0){_0x25bcbe[_0x7827('0x45')]=_0x453ec0;return _0x25bcbe;})[_0x7827('0x28')](respondWithFilteredResult(_0x21b502,_0x301b31))[_0x7827('0x46')](handleError(_0x21b502,null));};exports[_0x7827('0x47')]=function(_0x2f8a8c,_0x37dd2b){var _0x58fbcf={'raw':!![],'where':{'id':_0x2f8a8c['params']['id']}},_0xe79716={};_0xe79716[_0x7827('0x36')]=_[_0x7827('0x33')](db[_0x7827('0x30')][_0x7827('0x31')]);_0xe79716[_0x7827('0x34')]=_[_0x7827('0x33')](_0x2f8a8c[_0x7827('0x34')]);_0xe79716[_0x7827('0x35')]=_[_0x7827('0x38')](_0xe79716[_0x7827('0x36')],_0xe79716[_0x7827('0x34')]);_0x58fbcf[_0x7827('0x37')]=_[_0x7827('0x38')](_0xe79716[_0x7827('0x36')],qs[_0x7827('0x39')](_0x2f8a8c[_0x7827('0x34')][_0x7827('0x39')]));_0x58fbcf[_0x7827('0x37')]=_0x58fbcf[_0x7827('0x37')]['length']?_0x58fbcf['attributes']:_0xe79716[_0x7827('0x36')];if(_0x2f8a8c['query'][_0x7827('0x43')]){_0x58fbcf[_0x7827('0x44')]=[{'all':!![]}];}_0x58fbcf=_[_0x7827('0x3f')]({},_0x58fbcf,_0x2f8a8c['options']);return db[_0x7827('0x30')][_0x7827('0x48')](_0x58fbcf)[_0x7827('0x28')](handleEntityNotFound(_0x37dd2b,null))[_0x7827('0x28')](respondWithResult(_0x37dd2b,null))[_0x7827('0x46')](handleError(_0x37dd2b,null));};exports[_0x7827('0x49')]=function(_0x180d4b,_0x2340d6){return db[_0x7827('0x30')]['create'](_0x180d4b[_0x7827('0x4a')],{})[_0x7827('0x28')](respondWithResult(_0x2340d6,0xc9))[_0x7827('0x46')](handleError(_0x2340d6,null));};exports[_0x7827('0x27')]=function(_0x2ee0d8,_0x458aa4){if(_0x2ee0d8[_0x7827('0x4a')]['id']){delete _0x2ee0d8['body']['id'];}return db[_0x7827('0x30')][_0x7827('0x48')]({'where':{'id':_0x2ee0d8[_0x7827('0x4b')]['id']}})[_0x7827('0x28')](handleEntityNotFound(_0x458aa4,null))[_0x7827('0x28')](saveUpdates(_0x2ee0d8[_0x7827('0x4a')],null))[_0x7827('0x28')](respondWithResult(_0x458aa4,null))['catch'](handleError(_0x458aa4,null));};exports['destroy']=function(_0x59b38d,_0x224a9a){return db[_0x7827('0x30')]['find']({'where':{'id':_0x59b38d[_0x7827('0x4b')]['id']}})['then'](handleEntityNotFound(_0x224a9a,null))['then'](removeEntity(_0x224a9a,null))[_0x7827('0x46')](handleError(_0x224a9a,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 5281908..c11128d 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 _0xfcbd=['./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0xfcbd,0x160));var _0xdfcb=function(_0x40e617,_0x4674eb){_0x40e617=_0x40e617-0x0;var _0x4e39f2=_0xfcbd[_0x40e617];return _0x4e39f2;};'use strict';var _=require(_0xdfcb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdfcb('0x1'));var moment=require(_0xdfcb('0x2'));var BPromise=require(_0xdfcb('0x3'));var rp=require(_0xdfcb('0x4'));var fs=require('fs');var path=require(_0xdfcb('0x5'));var rimraf=require(_0xdfcb('0x6'));var config=require(_0xdfcb('0x7'));var attributes=require(_0xdfcb('0x8'));module[_0xdfcb('0x9')]=function(_0x4bdf76,_0x5615a6){return _0x4bdf76[_0xdfcb('0xa')](_0xdfcb('0xb'),attributes,{'tableName':_0xdfcb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdfcb('0xd'),'collate':_0xdfcb('0xe')});}; \ No newline at end of file +var _0x98a8=['../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x1cceee,_0x26aae1){var _0x32a03e=function(_0xb9291a){while(--_0xb9291a){_0x1cceee['push'](_0x1cceee['shift']());}};_0x32a03e(++_0x26aae1);}(_0x98a8,0x12c));var _0x898a=function(_0x2a2438,_0x461478){_0x2a2438=_0x2a2438-0x0;var _0x4a3e8d=_0x98a8[_0x2a2438];return _0x4a3e8d;};'use strict';var _=require(_0x898a('0x0'));var util=require(_0x898a('0x1'));var logger=require(_0x898a('0x2'))(_0x898a('0x3'));var moment=require(_0x898a('0x4'));var BPromise=require(_0x898a('0x5'));var rp=require(_0x898a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x898a('0x7'));var config=require(_0x898a('0x8'));var attributes=require(_0x898a('0x9'));module[_0x898a('0xa')]=function(_0x3e7ddd,_0x5d7e59){return _0x3e7ddd[_0x898a('0xb')]('WhatsappApplication',attributes,{'tableName':_0x898a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x898a('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 7195fcc..90d1ba2 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 _0xd6d6=['WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1b06c6,_0x4c7075){var _0xa83a4b=function(_0x44b844){while(--_0x44b844){_0x1b06c6['push'](_0x1b06c6['shift']());}};_0xa83a4b(++_0x4c7075);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x287436,_0x2147e7){_0x287436=_0x287436-0x0;var _0xc75f5b=_0xd6d6[_0x287436];return _0xc75f5b;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bf731,_0x44f83d,_0x18f824){return new BPromise(function(_0xd49f57,_0x408f88){return client[_0x6d6d('0xc')](_0x1bf731,_0x18f824)['then'](function(_0x51dd38){logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,_0x6d6d('0xf'));logger[_0x6d6d('0x10')](_0x6d6d('0x11'),_0x44f83d,'request\x20sent',JSON[_0x6d6d('0x12')](_0x51dd38));if(_0x51dd38[_0x6d6d('0x13')]){if(_0x51dd38['error']['code']===0x1f4){logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);return _0x408f88(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38['error'][_0x6d6d('0x14')]);return _0xd49f57(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}else{logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,'request\x20sent');_0xd49f57(_0x51dd38[_0x6d6d('0x15')]['message']);}})[_0x6d6d('0x16')](function(_0x2cbc86){logger[_0x6d6d('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x44f83d,_0x2cbc86);_0x408f88(_0x2cbc86);});});} \ No newline at end of file +var _0xd6d6=['WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x805741,_0x3d3514){var _0x110eee=function(_0x2cee3e){while(--_0x2cee3e){_0x805741['push'](_0x805741['shift']());}};_0x110eee(++_0x3d3514);}(_0xd6d6,0xbe));var _0x6d6d=function(_0xaeb2d4,_0x734b96){_0xaeb2d4=_0xaeb2d4-0x0;var _0x3b9036=_0xd6d6[_0xaeb2d4];return _0x3b9036;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var moment=require(_0x6d6d('0x2'));var BPromise=require(_0x6d6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6d('0x4'));var db=require(_0x6d6d('0x5'))['db'];var utils=require(_0x6d6d('0x6'));var logger=require(_0x6d6d('0x7'))(_0x6d6d('0x8'));var config=require(_0x6d6d('0x9'));var jayson=require(_0x6d6d('0xa'));var client=jayson['client'][_0x6d6d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bf731,_0x44f83d,_0x18f824){return new BPromise(function(_0xd49f57,_0x408f88){return client[_0x6d6d('0xc')](_0x1bf731,_0x18f824)['then'](function(_0x51dd38){logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,_0x6d6d('0xf'));logger[_0x6d6d('0x10')](_0x6d6d('0x11'),_0x44f83d,'request\x20sent',JSON[_0x6d6d('0x12')](_0x51dd38));if(_0x51dd38[_0x6d6d('0x13')]){if(_0x51dd38['error']['code']===0x1f4){logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);return _0x408f88(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}logger[_0x6d6d('0x13')](_0x6d6d('0xe'),_0x44f83d,_0x51dd38['error'][_0x6d6d('0x14')]);return _0xd49f57(_0x51dd38[_0x6d6d('0x13')][_0x6d6d('0x14')]);}else{logger[_0x6d6d('0xd')](_0x6d6d('0xe'),_0x44f83d,'request\x20sent');_0xd49f57(_0x51dd38[_0x6d6d('0x15')]['message']);}})[_0x6d6d('0x16')](function(_0x2cbc86){logger[_0x6d6d('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x44f83d,_0x2cbc86);_0x408f88(_0x2cbc86);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index d91a5ea..1addbae 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 _0xfc46=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','whatsappinteraction:addtags','addTags','put','/:id','tracked','whatsapp','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3e064d,_0x28af4e){var _0x15da2b=function(_0x547d29){while(--_0x547d29){_0x3e064d['push'](_0x3e064d['shift']());}};_0x15da2b(++_0x28af4e);}(_0xfc46,0x9a));var _0x6fc4=function(_0x2e3dfc,_0x454d6c){_0x2e3dfc=_0x2e3dfc-0x0;var _0x4b1245=_0xfc46[_0x2e3dfc];return _0x4b1245;};'use strict';var multer=require(_0x6fc4('0x0'));var util=require('util');var path=require(_0x6fc4('0x1'));var timeout=require(_0x6fc4('0x2'));var express=require(_0x6fc4('0x3'));var router=express['Router']();var fs_extra=require(_0x6fc4('0x4'));var auth=require(_0x6fc4('0x5'));var interaction=require(_0x6fc4('0x6'));var config=require(_0x6fc4('0x7'));var controller=require('./whatsappInteraction.controller');router[_0x6fc4('0x8')]('/',auth[_0x6fc4('0x9')](),controller[_0x6fc4('0xa')]);router[_0x6fc4('0x8')](_0x6fc4('0xb'),auth[_0x6fc4('0x9')](),controller['describe']);router[_0x6fc4('0x8')]('/:id',auth[_0x6fc4('0x9')](),controller[_0x6fc4('0xc')]);router['get'](_0x6fc4('0xd'),auth[_0x6fc4('0x9')](),controller[_0x6fc4('0xe')]);router[_0x6fc4('0x8')](_0x6fc4('0xf'),auth[_0x6fc4('0x9')](),controller[_0x6fc4('0x10')]);router[_0x6fc4('0x11')]('/',auth[_0x6fc4('0x9')](),controller[_0x6fc4('0x12')]);router[_0x6fc4('0x11')](_0x6fc4('0xd'),auth[_0x6fc4('0x9')](),controller[_0x6fc4('0x13')]);router[_0x6fc4('0x11')](_0x6fc4('0x14'),auth[_0x6fc4('0x9')](),interaction['tracked']('whatsapp',_0x6fc4('0x15')),controller[_0x6fc4('0x16')]);router[_0x6fc4('0x17')](_0x6fc4('0x18'),auth[_0x6fc4('0x9')](),interaction[_0x6fc4('0x19')](_0x6fc4('0x1a'),_0x6fc4('0x1b')),controller[_0x6fc4('0x1c')]);router['delete'](_0x6fc4('0x18'),auth[_0x6fc4('0x9')](),interaction['tracked']('whatsapp',_0x6fc4('0x1d')),controller[_0x6fc4('0x1e')]);router['delete'](_0x6fc4('0x14'),auth[_0x6fc4('0x9')](),controller[_0x6fc4('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x8cad=['whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x8cad,0xfe));var _0xd8ca=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x8cad[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0xd8ca('0x0'));var util=require(_0xd8ca('0x1'));var path=require(_0xd8ca('0x2'));var timeout=require(_0xd8ca('0x3'));var express=require(_0xd8ca('0x4'));var router=express[_0xd8ca('0x5')]();var fs_extra=require(_0xd8ca('0x6'));var auth=require(_0xd8ca('0x7'));var interaction=require(_0xd8ca('0x8'));var config=require(_0xd8ca('0x9'));var controller=require(_0xd8ca('0xa'));router[_0xd8ca('0xb')]('/',auth[_0xd8ca('0xc')](),controller[_0xd8ca('0xd')]);router['get'](_0xd8ca('0xe'),auth[_0xd8ca('0xc')](),controller[_0xd8ca('0xf')]);router[_0xd8ca('0xb')](_0xd8ca('0x10'),auth['isAuthenticated'](),controller[_0xd8ca('0x11')]);router['get'](_0xd8ca('0x12'),auth[_0xd8ca('0xc')](),controller[_0xd8ca('0x13')]);router[_0xd8ca('0xb')](_0xd8ca('0x14'),auth[_0xd8ca('0xc')](),controller['download']);router[_0xd8ca('0x15')]('/',auth[_0xd8ca('0xc')](),controller[_0xd8ca('0x16')]);router[_0xd8ca('0x15')](_0xd8ca('0x12'),auth[_0xd8ca('0xc')](),controller[_0xd8ca('0x17')]);router[_0xd8ca('0x15')](_0xd8ca('0x18'),auth['isAuthenticated'](),interaction[_0xd8ca('0x19')](_0xd8ca('0x1a'),_0xd8ca('0x1b')),controller[_0xd8ca('0x1c')]);router[_0xd8ca('0x1d')](_0xd8ca('0x10'),auth[_0xd8ca('0xc')](),interaction[_0xd8ca('0x19')](_0xd8ca('0x1a'),_0xd8ca('0x1e')),controller['update']);router[_0xd8ca('0x1f')](_0xd8ca('0x10'),auth[_0xd8ca('0xc')](),interaction[_0xd8ca('0x19')]('whatsapp','whatsappinteraction:destroy'),controller[_0xd8ca('0x20')]);router['delete'](_0xd8ca('0x18'),auth[_0xd8ca('0xc')](),controller[_0xd8ca('0x21')]);module[_0xd8ca('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 1e8e922..c5a8924 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 _0xed1f=['STRING','ENUM','out','BOOLEAN','sequelize','moment','DATE'];(function(_0x4e8401,_0x51b328){var _0x17269f=function(_0x35ac65){while(--_0x35ac65){_0x4e8401['push'](_0x4e8401['shift']());}};_0x17269f(++_0x51b328);}(_0xed1f,0x170));var _0xfed1=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0xed1f[_0x3fba9f];return _0x192cf1;};'use strict';var Sequelize=require(_0xfed1('0x0'));var moment=require(_0xfed1('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfed1('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xfed1('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xfed1('0x3')]},'phone':{'type':Sequelize[_0xfed1('0x3')]},'read1stAt':{'type':Sequelize[_0xfed1('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xfed1('0x4')]('in',_0xfed1('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfed1('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xfed1('0x4')]('in',_0xfed1('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfed1('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0x891b=['DATE','ENUM','exports','BOOLEAN','STRING'];(function(_0x330740,_0x58c0c0){var _0x1cb5f2=function(_0xa5c99a){while(--_0xa5c99a){_0x330740['push'](_0x330740['shift']());}};_0x1cb5f2(++_0x58c0c0);}(_0x891b,0xc5));var _0xb891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x891b[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0xb891('0x0')]={'closed':{'type':Sequelize[_0xb891('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb891('0x2')]},'secondDisposition':{'type':Sequelize[_0xb891('0x2')]},'thirdDisposition':{'type':Sequelize[_0xb891('0x2')]},'note':{'type':Sequelize[_0xb891('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xb891('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb891('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb891('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('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 621e182..315cb20 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 _0x9009=['eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','offset','limit','count','Content-Range','json','apply','reject','save','destroy','error','stack','send','Users','fullname','TagIds','Tags','split','forEach','push','then','catch','index','WhatsappInteraction','rawAttributes','fieldName','type','key','map','name','query','keys','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.WhatsappAccountId','me.WhatsappInteractionId\x20=\x20i.id','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','unreadMessages','value','`\x20=\x200','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','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','body','some','isEmpty','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','contactName','DESC','t.id\x20IN\x20?','resolve','WhatsappAccountId','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','agent','getWhatsappAccounts','user','role','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','rows','show','params','includeAll','include','merge','options','create','describe','addMessage','WhatsappMessage','ids','findOne','hasOwnProperty','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','omit','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','User','CmContact','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Account','Whatsapp','Owner','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log'];(function(_0x1127d5,_0xb2967){var _0x2269b5=function(_0x4304a2){while(--_0x4304a2){_0x1127d5['push'](_0x1127d5['shift']());}};_0x2269b5(++_0xb2967);}(_0x9009,0x1d4));var _0x9900=function(_0x54effc,_0x58f6e4){_0x54effc=_0x54effc-0x0;var _0xf045b2=_0x9009[_0x54effc];return _0xf045b2;};'use strict';var emlformat=require(_0x9900('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9900('0x1'));var jsonpatch=require(_0x9900('0x2'));var rp=require('request-promise');var moment=require(_0x9900('0x3'));var BPromise=require(_0x9900('0x4'));var Mustache=require(_0x9900('0x5'));var util=require(_0x9900('0x6'));var path=require('path');var sox=require(_0x9900('0x7'));var csv=require(_0x9900('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9900('0x9'));var squel=require(_0x9900('0xa'));var crypto=require('crypto');var jsforce=require(_0x9900('0xb'));var deskjs=require(_0x9900('0xc'));var toCsv=require(_0x9900('0x8'));var querystring=require(_0x9900('0xd'));var Papa=require('papaparse');var Redis=require(_0x9900('0xe'));var authService=require(_0x9900('0xf'));var qs=require(_0x9900('0x10'));var as=require(_0x9900('0x11'));var pdf=require(_0x9900('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9900('0x13'));var utils=require(_0x9900('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9900('0x15'))['db'];config['redis']=_[_0x9900('0x16')](config[_0x9900('0x17')],{'host':_0x9900('0x18'),'port':0x18eb});var socket=require(_0x9900('0x19'))(new Redis(config[_0x9900('0x17')]));require(_0x9900('0x1a'))[_0x9900('0x1b')](socket);function respondWithStatusCode(_0x7cab33,_0x126c36){_0x126c36=_0x126c36||0xcc;return function(_0x209b4d){if(_0x209b4d){return _0x7cab33[_0x9900('0x1c')](_0x126c36);}return _0x7cab33[_0x9900('0x1d')](_0x126c36)[_0x9900('0x1e')]();};}function respondWithResult(_0x3517b0,_0x356284){_0x356284=_0x356284||0xc8;return function(_0x1bacf3){if(_0x1bacf3){return _0x3517b0[_0x9900('0x1d')](_0x356284)['json'](_0x1bacf3);}};}function respondWithFilteredResult(_0x51839f,_0x1017a5){return function(_0x22352b){if(_0x22352b){var _0x1bd7a3=typeof _0x1017a5[_0x9900('0x1f')]==='undefined'&&typeof _0x1017a5[_0x9900('0x20')]==='undefined';var _0x5496ca=_0x22352b[_0x9900('0x21')];var _0x4e1b84=_0x1bd7a3?0x0:_0x1017a5[_0x9900('0x1f')];var _0x596eff=_0x1bd7a3?_0x22352b['count']:_0x1017a5[_0x9900('0x1f')]+_0x1017a5[_0x9900('0x20')];var _0x380b07;if(_0x596eff>=_0x5496ca){_0x596eff=_0x5496ca;_0x380b07=0xc8;}else{_0x380b07=0xce;}_0x51839f[_0x9900('0x1d')](_0x380b07);return _0x51839f['set'](_0x9900('0x22'),_0x4e1b84+'-'+_0x596eff+'/'+_0x5496ca)[_0x9900('0x23')](_0x22352b);}return null;};}function patchUpdates(_0x23e9f1){return function(_0x888599){try{jsonpatch[_0x9900('0x24')](_0x888599,_0x23e9f1,!![]);}catch(_0x5368bf){return BPromise[_0x9900('0x25')](_0x5368bf);}return _0x888599[_0x9900('0x26')]();};}function saveUpdates(_0x49131a,_0x3bfb16){return function(_0x337b6a){if(_0x337b6a){return _0x337b6a['update'](_0x49131a)['then'](function(_0x43ed24){return _0x43ed24;});}return null;};}function removeEntity(_0x2ac147,_0x5dbcce){return function(_0x285d51){if(_0x285d51){return _0x285d51[_0x9900('0x27')]()['then'](function(){_0x2ac147[_0x9900('0x1d')](0xcc)[_0x9900('0x1e')]();});}};}function handleEntityNotFound(_0x23b696,_0x13bad6){return function(_0xaa7daa){if(!_0xaa7daa){_0x23b696['sendStatus'](0x194);}return _0xaa7daa;};}function handleError(_0x40fa92,_0x44d775){_0x44d775=_0x44d775||0x1f4;return function(_0x10fbae){logger[_0x9900('0x28')](_0x10fbae[_0x9900('0x29')]);if(_0x10fbae['name']){delete _0x10fbae['name'];}_0x40fa92['status'](_0x44d775)[_0x9900('0x2a')](_0x10fbae);};}function getInteractionUsers(_0x3e9a9a,_0x4ef405){return new BPromise(function(_0x392593,_0x6fb5ab){try{if(_0x4ef405[_0x3e9a9a['id']]){_0x3e9a9a[_0x9900('0x2b')]=_['map'](_0x4ef405[_0x3e9a9a['id']],function(_0x4aa0f8){return{'id':_0x4aa0f8['id'],'fullname':_0x4aa0f8[_0x9900('0x2c')]};});}}catch(_0x354303){_0x6fb5ab(_0x354303);}_0x392593(_0x3e9a9a);});}function getInteractionTags(_0xd2ae52,_0x3d7b26){return new BPromise(function(_0x4a4a02,_0x4dc0e9){try{if(_0xd2ae52[_0x9900('0x2d')]){_0xd2ae52[_0x9900('0x2e')]=[];_0xd2ae52[_0x9900('0x2d')][_0x9900('0x2f')](',')[_0x9900('0x30')](function(_0x135fb5){_0xd2ae52[_0x9900('0x2e')][_0x9900('0x31')](_0x3d7b26[_0x135fb5]);});}delete _0xd2ae52[_0x9900('0x2d')];}catch(_0x3b93d0){_0x4dc0e9(_0x3b93d0);}_0x4a4a02(_0xd2ae52);});}function updateWhatsappInteraction(_0x3ff7e5,_0x29130c,_0x412e21){return new BPromise(function(_0x505877,_0x512cdd){return getInteractionUsers(_0x3ff7e5,_0x412e21)[_0x9900('0x32')](function(_0x570a4a){return getInteractionTags(_0x570a4a,_0x29130c);})[_0x9900('0x32')](function(_0x528bcc){_0x505877(_0x528bcc);})[_0x9900('0x33')](function(_0x13adbd){_0x512cdd(_0x13adbd);});});}exports[_0x9900('0x34')]=function(_0x13bb59,_0x3e6e21){var _0x3ed846={},_0x2ab542={},_0x581e0b={'count':0x0,'rows':[]};var _0x5bfb20=_['map'](db[_0x9900('0x35')][_0x9900('0x36')],function(_0x506ebe){return{'name':_0x506ebe[_0x9900('0x37')],'type':_0x506ebe[_0x9900('0x38')][_0x9900('0x39')]};});_0x2ab542['model']=_[_0x9900('0x3a')](_0x5bfb20,_0x9900('0x3b'));_0x2ab542[_0x9900('0x3c')]=_[_0x9900('0x3d')](_0x13bb59[_0x9900('0x3c')]);_0x2ab542[_0x9900('0x3e')]=_['intersection'](_0x2ab542[_0x9900('0x3f')],_0x2ab542[_0x9900('0x3c')]);_0x3ed846['attributes']=_[_0x9900('0x40')](_0x2ab542['model'],qs[_0x9900('0x41')](_0x13bb59[_0x9900('0x3c')]['fields']));_0x3ed846[_0x9900('0x42')]=_0x3ed846[_0x9900('0x42')][_0x9900('0x43')]?_0x3ed846[_0x9900('0x42')]:_0x2ab542[_0x9900('0x3f')];if(!_0x13bb59['query']['hasOwnProperty'](_0x9900('0x44'))){_0x3ed846['limit']=qs['limit'](_0x13bb59['query']['limit']);_0x3ed846['offset']=qs[_0x9900('0x1f')](_0x13bb59[_0x9900('0x3c')][_0x9900('0x1f')]);}_0x3ed846[_0x9900('0x45')]=qs[_0x9900('0x46')](_0x13bb59[_0x9900('0x3c')][_0x9900('0x46')]);_0x3ed846[_0x9900('0x47')]=qs['filters'](_[_0x9900('0x48')](_0x13bb59[_0x9900('0x3c')],_0x2ab542['filters']),_0x5bfb20);var _0x5d593c=[];var _0x1a5940=squel[_0x9900('0x49')]()[_0x9900('0x4a')]('id')[_0x9900('0x4a')](_0x9900('0x3b'))[_0x9900('0x4a')](_0x9900('0x4b'))[_0x9900('0x4c')]('tools_tags');var _0x322dce=squel[_0x9900('0x49')]()['field'](_0x9900('0x4d'))[_0x9900('0x4a')](_0x9900('0x4e'))[_0x9900('0x4a')]('ui.WhatsappInteractionId')[_0x9900('0x4c')](_0x9900('0x4f'),'ui')['left_join'](_0x9900('0x50'),'u',_0x9900('0x51'));var _0x120b92=squel['select']()[_0x9900('0x4c')]('whatsapp_interactions','i')[_0x9900('0x52')]('cm_contacts','c',_0x9900('0x53'))[_0x9900('0x52')](_0x9900('0x50'),'o','o.id\x20=\x20i.UserId')[_0x9900('0x52')]('whatsapp_accounts','a',_0x9900('0x54'))[_0x9900('0x52')]('whatsapp_messages','me',_0x9900('0x55'))[_0x9900('0x52')]('whatsapp_interaction_has_tags','it',_0x9900('0x56'))[_0x9900('0x52')](_0x9900('0x57'),'t',_0x9900('0x58'));var _0x3d26e3=squel['expr']();var _0x5d8460=[];var _0x1d7332=squel[_0x9900('0x59')]();var _0x2aa081;if(_0x13bb59[_0x9900('0x3c')][_0x9900('0x5a')]){_0x2aa081=as['parseSearch'](_0x13bb59[_0x9900('0x3c')][_0x9900('0x5a')]);var _0x4296ea=_0x2aa081[_0x9900('0x5b')];for(var _0x2f7f74=0x0;_0x2f7f74<_0x2aa081[_0x9900('0x5c')][_0x9900('0x43')];_0x2f7f74++){var _0x50d064=_0x2aa081[_0x9900('0x5c')][_0x2f7f74];var _0x5f056c='i';var _0x5b1b13=_['find'](_0x5bfb20,[_0x9900('0x3b'),_0x50d064['field']]);if(!_0x5b1b13){switch(_0x50d064[_0x9900('0x4a')]){case _0x9900('0x5d'):if(_0x50d064[_0x9900('0x5e')]==0x1){_0x120b92['having']('`'+_0x50d064['field']+_0x9900('0x5f'));}else{_0x120b92[_0x9900('0x60')]('`'+_0x50d064[_0x9900('0x4a')]+_0x9900('0x61'));}break;case _0x9900('0x62'):if(_0x50d064[_0x9900('0x63')]===_0x9900('0x64')){if(_0x50d064[_0x9900('0x5e')][_0x9900('0x2f')]('\x20')[_0x9900('0x43')]>0x1){_0x3d26e3[_0x4296ea](_0x9900('0x65'),qs[_0x9900('0x66')](_0x50d064[_0x9900('0x5e')]),null);}else{var _0x5a97fe='%'+_0x50d064[_0x9900('0x5e')]+'%';_0x3d26e3[_0x4296ea]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5a97fe,_0x5a97fe,_0x5a97fe);}}else{_0x5b1b13=_[_0x9900('0x67')](_0x5bfb20,[_0x9900('0x3b'),_0x9900('0x68')]);_0x50d064['field']=_0x9900('0x68');_0x5300ff=as[_0x9900('0x69')](_0x5f056c,_0x5b1b13[_0x9900('0x38')],_0x50d064);_0x3d26e3[_0x4296ea](_0x5300ff[_0x9900('0x6a')],_0x5300ff[_0x9900('0x5e')][_0x9900('0x6b')],_0x5300ff[_0x9900('0x5e')][_0x9900('0x1e')]);}break;case _0x9900('0x6c'):var _0x286a65=_0x50d064['value'][_0x9900('0x2f')](',')['map'](function(_0x2238d3){return Number(_0x2238d3);});_0x286a65[_0x9900('0x30')](function(_0x41b96c){_0x1d7332['or'](_0x9900('0x6d'),'%,'+_0x41b96c+',%');});_0x5d8460=_[_0x9900('0x6e')](_0x5d8460,_0x286a65);break;case'User':if(_0x50d064[_0x9900('0x63')]==='$substring'){_0x3d26e3[_0x4296ea](_0x9900('0x6f'),'%'+_0x50d064[_0x9900('0x5e')]+'%',null);}else{_0x5b1b13=_[_0x9900('0x67')](_0x5bfb20,[_0x9900('0x3b'),_0x9900('0x70')]);_0x50d064['field']=_0x9900('0x70');_0x5300ff=as[_0x9900('0x69')](_0x5f056c,_0x5b1b13[_0x9900('0x38')],_0x50d064);_0x3d26e3[_0x4296ea](_0x5300ff['text'],_0x5300ff[_0x9900('0x5e')][_0x9900('0x6b')],_0x5300ff[_0x9900('0x5e')][_0x9900('0x1e')]);}break;case _0x9900('0x71'):_0x5300ff=as[_0x9900('0x69')]('me',null,_0x50d064);_0x3d26e3[_0x4296ea](_0x5300ff[_0x9900('0x6a')],_0x5300ff[_0x9900('0x5e')][_0x9900('0x6b')],_0x5300ff['value'][_0x9900('0x1e')]);break;}}else{var _0x5300ff=as[_0x9900('0x69')](_0x5f056c,_0x5b1b13[_0x9900('0x38')],_0x50d064);_0x3d26e3[_0x4296ea](_0x5300ff[_0x9900('0x6a')],_0x5300ff[_0x9900('0x5e')]['start'],_0x5300ff['value'][_0x9900('0x1e')]);}}}else{var _0x570ec9=_(_0x13bb59[_0x9900('0x3c')])['keys']()[_0x9900('0x3a')](function(_0x89f14a){return _[_0x9900('0x72')](_0x5bfb20,[_0x9900('0x3b'),_0x89f14a])?_0x89f14a:undefined;})['compact']()[_0x9900('0x5e')]();if(!_[_0x9900('0x73')](_0x570ec9)){_0x570ec9['forEach'](function(_0x44353a){if(_0x44353a==='WhatsappAccountId'){_0x120b92[_0x9900('0x47')]('i.WhatsappAccountId\x20IN\x20?',[][_0x9900('0x74')](_0x13bb59['query'][_0x44353a]));}else if(_0x44353a===_0x9900('0x75')){var _0x1014bf=JSON[_0x9900('0x76')](_0x13bb59['query'][_0x44353a])[_0x9900('0x77')];var _0x269cfa=JSON[_0x9900('0x76')](_0x13bb59[_0x9900('0x3c')][_0x44353a])[_0x9900('0x78')];_0x120b92[_0x9900('0x47')](_0x9900('0x79'),_0x1014bf,_0x269cfa);}else{if(_0x13bb59[_0x9900('0x3c')][_0x44353a]===_0x9900('0x7a')){_0x120b92[_0x9900('0x47')]('i.'+_0x44353a+_0x9900('0x7b'));}else{_0x120b92[_0x9900('0x47')]('i.'+_0x44353a+'\x20=\x20?',_0x13bb59[_0x9900('0x3c')][_0x44353a]);}}});}if(_0x13bb59[_0x9900('0x3c')][_0x9900('0x7c')]){if(_0x13bb59[_0x9900('0x3c')][_0x9900('0x7c')]==0x1){_0x120b92[_0x9900('0x60')](_0x9900('0x7d'));}else{_0x120b92['having'](_0x9900('0x7e'));}}if(_0x13bb59['query'][_0x9900('0x7f')]){_0x5d8460=_[_0x9900('0x80')](_0x13bb59[_0x9900('0x3c')]['tag'])?_0x13bb59[_0x9900('0x3c')][_0x9900('0x7f')]:new Array(_0x13bb59[_0x9900('0x3c')][_0x9900('0x7f')]);_0x5d8460[_0x9900('0x30')](function(_0x19839a){_0x1d7332['or'](_0x9900('0x6d'),'%,'+_0x19839a+',%');});}if(_0x13bb59[_0x9900('0x3c')][_0x9900('0x81')]){var _0x34c14a=_0x13bb59[_0x9900('0x3c')][_0x9900('0x81')][_0x9900('0x82')]('\x5c','\x5c\x5c')[_0x9900('0x82')](/'/g,'\x27\x27');if(qs[_0x9900('0x83')](_0x34c14a)){_0x3d26e3['or'](_0x9900('0x84'),_0x34c14a+'%')['or'](_0x9900('0x85'),_0x34c14a+'%');}else{_0x3d26e3['or'](_0x9900('0x86'),qs[_0x9900('0x66')](_0x34c14a))['or'](_0x9900('0x87'),_0x34c14a+'%');}}}_0x120b92['where'](_0x3d26e3);_0x120b92['group'](_0x9900('0x88'));var _0xb3994c={'type':db[_0x9900('0x89')][_0x9900('0x8a')]['SELECT'],'raw':!![]};var _0x184550=_0x120b92['clone']();_0x184550['field'](_0x9900('0x88'));_0x184550['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x9900('0x5d'));if(_0x3ed846['order']){_0x3ed846[_0x9900('0x45')]['forEach'](function(_0x11350a){var _0x12d25c=_0x11350a[0x0]===_0x9900('0x8b')?_0x11350a[0x0]:'i.'+_0x11350a[0x0];_0x120b92[_0x9900('0x45')](_0x12d25c,_0x11350a[0x1]===_0x9900('0x8c')?![]:!![]);});}if(!_['isEmpty'](_0x5d8460)){_0x120b92[_0x9900('0x60')](_0x1d7332);_0x184550[_0x9900('0x47')](_0x9900('0x8d'),_0x5d8460);}BPromise[_0x9900('0x8e')]()[_0x9900('0x32')](function(){if(!_0x2aa081){if(_0x13bb59['query'][_0x9900('0x8f')])return;_0x184550[_0x9900('0x47')](_0x9900('0x90'));_0x120b92[_0x9900('0x47')](_0x9900('0x90'));return;}if(_0x13bb59['user']['role']!==_0x9900('0x91'))return;return _0x13bb59['user'][_0x9900('0x92')]({'attributes':['id'],'raw':!![]})['then'](function(_0x10d44e){if(_['isEmpty'](_0x10d44e)){_0x184550[_0x9900('0x47')]('i.WhatsappAccountId\x20IS\x20NULL');_0x120b92[_0x9900('0x47')]('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x184550[_0x9900('0x47')]('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x10d44e,'id'));_0x120b92['where']('i.WhatsappAccountId\x20IN\x20?',_[_0x9900('0x3a')](_0x10d44e,'id'));}});})['then'](function(){if(_0x13bb59[_0x9900('0x93')][_0x9900('0x94')]===_0x9900('0x91')&&!_0x2aa081&&!_0x13bb59[_0x9900('0x3c')][_0x9900('0x8f')])return[];return db[_0x9900('0x95')][_0x9900('0x3c')](_0x184550[_0x9900('0x96')](),_0xb3994c);})[_0x9900('0x32')](function(_0x313088){_0x581e0b[_0x9900('0x21')]=_0x313088[_0x9900('0x43')];if(_0x581e0b['count']===0x0)return[];return db[_0x9900('0x95')][_0x9900('0x3c')](_0x1a5940[_0x9900('0x96')](),_0xb3994c)[_0x9900('0x32')](function(_0x45e423){_0x5d593c=_[_0x9900('0x97')](_0x45e423,'id');_0xb3994c=_['merge'](_0xb3994c,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x13bb59[_0x9900('0x3c')][_0x9900('0x41')]){_0x3ed846[_0x9900('0x42')][_0x9900('0x30')](function(_0x585609){_0x120b92[_0x9900('0x4a')]('i.'+_0x585609);});}else{_0x120b92[_0x9900('0x4a')](_0x9900('0x98'),_0x9900('0x5d'));_0x120b92[_0x9900('0x4a')]('a.key',_0x9900('0x99'));_0x120b92[_0x9900('0x4a')](_0x9900('0x9a'),_0x9900('0x9b'));_0x120b92[_0x9900('0x4a')](_0x9900('0x9c'),_0x9900('0x8b'));_0x120b92[_0x9900('0x4a')](_0x9900('0x9d'));_0x120b92[_0x9900('0x4a')](_0x9900('0x9e'),_0x9900('0x9f'));_0x120b92[_0x9900('0x4a')](_0x9900('0xa0'),'Contact.lastName');_0x120b92[_0x9900('0x4a')](_0x9900('0xa1'),_0x9900('0xa2'));_0x120b92[_0x9900('0x4a')](_0x9900('0xa3'),'Contact.phone');_0x120b92[_0x9900('0x4a')]('c.mobile',_0x9900('0xa4'));_0x120b92['field'](_0x9900('0xa5'),_0x9900('0xa6'));_0x120b92[_0x9900('0x4a')](_0x9900('0xa7'),'Owner.fullname');_0x120b92['field'](_0x9900('0xa8'),_0x9900('0xa9'));_0x120b92[_0x9900('0x4a')](_0x9900('0xaa'),_0x9900('0x2d'));}if(_0x3ed846[_0x9900('0x20')])_0x120b92[_0x9900('0x20')](_0x3ed846[_0x9900('0x20')]);if(_0x3ed846[_0x9900('0x1f')])_0x120b92[_0x9900('0x1f')](_0x3ed846['offset']);return db['sequelize'][_0x9900('0x3c')](_0x120b92[_0x9900('0x96')](),_0xb3994c);})['then'](function(_0x1282d3){if(_0x1282d3[_0x9900('0x43')]>0x0)_0x322dce[_0x9900('0x47')](_0x9900('0xab'),_[_0x9900('0x3a')](_0x1282d3,'id'));return db['sequelize'][_0x9900('0x3c')](_0x322dce['toString'](),_0xb3994c)[_0x9900('0x32')](function(_0x2d0793){var _0x42c042=_[_0x9900('0xac')](_0x2d0793,_0x9900('0xad'));var _0x3e4ea4=[];_0x1282d3[_0x9900('0x30')](function(_0x4a236a){_0x3e4ea4[_0x9900('0x31')](updateWhatsappInteraction(_0x4a236a,_0x5d593c,_0x42c042));});return BPromise['all'](_0x3e4ea4);});});})[_0x9900('0x32')](function(_0x20734a){_0x581e0b[_0x9900('0xae')]=_0x20734a;return _0x581e0b;})[_0x9900('0x32')](respondWithFilteredResult(_0x3e6e21,_0x3ed846))[_0x9900('0x33')](handleError(_0x3e6e21,null));};exports[_0x9900('0xaf')]=function(_0x1d7f66,_0x48008c){var _0x92c33d={'raw':![],'where':{'id':_0x1d7f66[_0x9900('0xb0')]['id']}},_0x24910b={};_0x24910b[_0x9900('0x3f')]=_[_0x9900('0x3d')](db[_0x9900('0x35')]['rawAttributes']);_0x24910b[_0x9900('0x3c')]=_['keys'](_0x1d7f66['query']);_0x24910b[_0x9900('0x3e')]=_[_0x9900('0x40')](_0x24910b[_0x9900('0x3f')],_0x24910b[_0x9900('0x3c')]);_0x92c33d['attributes']=_[_0x9900('0x40')](_0x24910b[_0x9900('0x3f')],qs[_0x9900('0x41')](_0x1d7f66[_0x9900('0x3c')][_0x9900('0x41')]));_0x92c33d[_0x9900('0x42')]=_0x92c33d[_0x9900('0x42')][_0x9900('0x43')]?_0x92c33d[_0x9900('0x42')]:_0x24910b['model'];if(_0x1d7f66[_0x9900('0x3c')][_0x9900('0xb1')]){_0x92c33d[_0x9900('0xb2')]=[{'all':!![]}];}_0x92c33d=_[_0x9900('0xb3')]({},_0x92c33d,_0x1d7f66[_0x9900('0xb4')]);return db[_0x9900('0x35')][_0x9900('0x67')](_0x92c33d)[_0x9900('0x32')](handleEntityNotFound(_0x48008c,null))[_0x9900('0x32')](respondWithResult(_0x48008c,null))[_0x9900('0x33')](handleError(_0x48008c,null));};exports[_0x9900('0xb5')]=function(_0x43044f,_0x8b9c5e){return db[_0x9900('0x35')][_0x9900('0xb5')](_0x43044f[_0x9900('0x71')],{})[_0x9900('0x32')](respondWithResult(_0x8b9c5e,0xc9))[_0x9900('0x33')](handleError(_0x8b9c5e,null));};exports['update']=function(_0x492b76,_0x36614b){if(_0x492b76[_0x9900('0x71')]['id']){delete _0x492b76[_0x9900('0x71')]['id'];}return db[_0x9900('0x35')][_0x9900('0x67')]({'where':{'id':_0x492b76[_0x9900('0xb0')]['id']}})[_0x9900('0x32')](handleEntityNotFound(_0x36614b,null))[_0x9900('0x32')](saveUpdates(_0x492b76[_0x9900('0x71')],null))[_0x9900('0x32')](respondWithResult(_0x36614b,null))[_0x9900('0x33')](handleError(_0x36614b,null));};exports[_0x9900('0x27')]=function(_0x4f6b70,_0x3db63f){return db[_0x9900('0x35')][_0x9900('0x67')]({'where':{'id':_0x4f6b70[_0x9900('0xb0')]['id']}})[_0x9900('0x32')](handleEntityNotFound(_0x3db63f,null))[_0x9900('0x32')](removeEntity(_0x3db63f,null))[_0x9900('0x33')](handleError(_0x3db63f,null));};exports[_0x9900('0xb6')]=function(_0x3fab78,_0x414b56){return db['WhatsappInteraction']['describe']()['then'](respondWithResult(_0x414b56,null))[_0x9900('0x33')](handleError(_0x414b56,null));};exports[_0x9900('0xb7')]=function(_0x381158,_0x5e3f55,_0x338b5d){return db[_0x9900('0xb8')][_0x9900('0x67')]({'where':{'id':_0x381158[_0x9900('0xb0')]['id']}})['then'](handleEntityNotFound(_0x5e3f55,null))[_0x9900('0x32')](function(_0x25daa0){if(_0x25daa0){return _0x25daa0[_0x9900('0xb7')](_0x381158[_0x9900('0x71')][_0x9900('0xb9')],_['omit'](_0x381158[_0x9900('0x71')],[_0x9900('0xb9'),'id'])||{});}})[_0x9900('0x32')](respondWithResult(_0x5e3f55,null))['catch'](handleError(_0x5e3f55,null));};exports['getMessages']=function(_0x2b0c38,_0x482556,_0x3bf43c){var _0x29a925={'raw':![],'where':{}};var _0x18c77d={};var _0x40ca36={'count':0x0,'rows':[]};return db[_0x9900('0x35')][_0x9900('0xba')]({'where':{'id':_0x2b0c38['params']['id']}})[_0x9900('0x32')](handleEntityNotFound(_0x482556,null))['then'](function(_0x3c11be){if(_0x3c11be){_0x18c77d[_0x9900('0x3f')]=_[_0x9900('0x3d')](db[_0x9900('0xb8')][_0x9900('0x36')]);_0x18c77d[_0x9900('0x3c')]=_[_0x9900('0x3d')](_0x2b0c38[_0x9900('0x3c')]);_0x18c77d[_0x9900('0x3e')]=_[_0x9900('0x40')](_0x18c77d[_0x9900('0x3f')],_0x18c77d[_0x9900('0x3c')]);_0x29a925[_0x9900('0x42')]=_[_0x9900('0x40')](_0x18c77d[_0x9900('0x3f')],qs[_0x9900('0x41')](_0x2b0c38[_0x9900('0x3c')][_0x9900('0x41')]));_0x29a925[_0x9900('0x42')]=_0x29a925[_0x9900('0x42')][_0x9900('0x43')]?_0x29a925['attributes']:_0x18c77d[_0x9900('0x3f')];if(!_0x2b0c38[_0x9900('0x3c')][_0x9900('0xbb')](_0x9900('0x44'))){_0x29a925[_0x9900('0x20')]=qs[_0x9900('0x20')](_0x2b0c38['query'][_0x9900('0x20')]);_0x29a925[_0x9900('0x1f')]=qs[_0x9900('0x1f')](_0x2b0c38[_0x9900('0x3c')]['offset']);}_0x29a925[_0x9900('0x45')]=qs['sort'](_0x2b0c38[_0x9900('0x3c')][_0x9900('0x46')]);_0x29a925[_0x9900('0x47')]=qs[_0x9900('0x3e')](_[_0x9900('0x48')](_0x2b0c38['query'],_0x18c77d[_0x9900('0x3e')]));_0x29a925[_0x9900('0x47')][_0x9900('0xad')]=_0x3c11be['id'];if(_0x2b0c38[_0x9900('0x3c')][_0x9900('0x81')]){_0x29a925[_0x9900('0x47')]=_['merge'](_0x29a925[_0x9900('0x47')],{'$or':_[_0x9900('0x3a')](_0x29a925[_0x9900('0x42')],function(_0x5c7449){var _0x12e6b3={};_0x12e6b3[_0x5c7449]={'$like':'%'+_0x2b0c38[_0x9900('0x3c')][_0x9900('0x81')]+'%'};return _0x12e6b3;})});}if(_0x2b0c38[_0x9900('0x3c')]['$gte']){var _0xc77ced=_0x2b0c38['query'][_0x9900('0x77')][_0x9900('0x2f')](',');var _0x21a7af={};_0x21a7af[_0xc77ced[0x0]]={'$gte':moment(_0xc77ced[0x1])[_0x9900('0xbc')](_0x9900('0xbd'))};_0x29a925[_0x9900('0x47')]=_['merge'](_0x29a925['where'],_0x21a7af);}_0x29a925=_[_0x9900('0xb3')]({},_0x29a925,_0x2b0c38[_0x9900('0xb4')]);return db['WhatsappMessage'][_0x9900('0x21')]({'where':_0x29a925['where']})['then'](function(_0x3b833b){_0x40ca36[_0x9900('0x21')]=_0x3b833b;if(_0x2b0c38[_0x9900('0x3c')][_0x9900('0xb1')]){_0x29a925[_0x9900('0xb2')]=[{'all':!![]}];}return db[_0x9900('0xb8')][_0x9900('0xbe')](_0x29a925);})[_0x9900('0x32')](function(_0xd35726){_0x40ca36[_0x9900('0xae')]=_0xd35726;return _0x40ca36;});}})[_0x9900('0x32')](respondWithFilteredResult(_0x482556,_0x29a925))[_0x9900('0x33')](handleError(_0x482556,null));};exports[_0x9900('0xbf')]=function(_0x55879b,_0x26b721,_0x262bdb){return db['WhatsappInteraction']['find']({'where':{'id':_0x55879b[_0x9900('0xb0')]['id']}})[_0x9900('0x32')](handleEntityNotFound(_0x26b721,null))[_0x9900('0x32')](function(_0xf2ccf6){if(_0xf2ccf6){return _0xf2ccf6['setTags'](_0x55879b[_0x9900('0x71')][_0x9900('0xb9')],_[_0x9900('0xc0')](_0x55879b[_0x9900('0x71')],[_0x9900('0xb9'),'id'])||{})[_0x9900('0xc1')](function(){return db['Tag'][_0x9900('0xbe')]({'attributes':['id','name',_0x9900('0x4b')],'where':{'id':_0x55879b[_0x9900('0x71')][_0x9900('0xb9')]}});})[_0x9900('0x32')](function(_0x3a6d51){socket[_0x9900('0xc2')](_0x9900('0xc3'),{'id':Number(_0x55879b[_0x9900('0xb0')]['id']),'tags':_0x3a6d51||[]});return{'id':Number(_0x55879b[_0x9900('0xb0')]['id']),'tags':_0x3a6d51||[]};});}})['then'](respondWithResult(_0x26b721,null))[_0x9900('0x33')](handleError(_0x26b721,null));};exports[_0x9900('0xc4')]=function(_0x34136e,_0xcec90a,_0x19124d){return db['WhatsappInteraction'][_0x9900('0x67')]({'where':{'id':_0x34136e[_0x9900('0xb0')]['id']}})[_0x9900('0x32')](handleEntityNotFound(_0xcec90a,null))['then'](function(_0x2be593){if(_0x2be593){return _0x2be593[_0x9900('0xc4')](_0x34136e['query'][_0x9900('0xb9')]);}})['then'](respondWithStatusCode(_0xcec90a,null))['catch'](handleError(_0xcec90a,null));};exports[_0x9900('0xc5')]=function(_0x25354b,_0x551e13){var _0x4c9086=moment()[_0x9900('0xc6')]()['toString']();var _0x359571=path[_0x9900('0xc7')](config[_0x9900('0xc8')],_0x9900('0xc9'),_0x9900('0xca'),_0x9900('0xcb'));var _0x19848f=path[_0x9900('0xc7')](config['root'],_0x9900('0xc9'),_0x9900('0xca'),_0x9900('0xcc'));var _0x86768c=path[_0x9900('0xc7')](_0x359571,_0x4c9086);var _0x3bdbfe=util[_0x9900('0xbc')](_0x9900('0xcd'),_0x25354b[_0x9900('0xb0')]['id'],_0x4c9086);var _0x54a3fa=path[_0x9900('0xc7')](_0x359571,_0x3bdbfe);var _0x1a9c1c=[];_0x1a9c1c[_0x9900('0x31')]({'model':db[_0x9900('0xce')],'as':_0x9900('0xce'),'attributes':['id',_0x9900('0x2c')],'raw':!![]});_0x1a9c1c[_0x9900('0x31')]({'model':db[_0x9900('0xcf')],'as':_0x9900('0x62'),'attributes':['id',_0x9900('0xd0'),_0x9900('0xd1')],'raw':!![]});if(_0x25354b['query']['attachments']){_0x1a9c1c['push']({'model':db['Attachment'],'as':_0x9900('0xd2'),'raw':!![]});}var _0x1c7bbd=[{'model':db['WhatsappMessage'],'as':_0x9900('0xd3'),'attributes':['id',_0x9900('0x71'),_0x9900('0x75'),_0x9900('0xd4'),_0x9900('0xd5'),_0x9900('0x7c')],'include':_0x1a9c1c}];_0x1c7bbd[_0x9900('0x31')]({'model':db[_0x9900('0xd6')],'as':_0x9900('0xd7'),'attributes':['id',_0x9900('0x3b')]});_0x1c7bbd[_0x9900('0x31')]({'model':db['User'],'as':'Owner','attributes':['id',_0x9900('0x2c')]});return db[_0x9900('0x35')][_0x9900('0x67')]({'where':{'id':_0x25354b[_0x9900('0xb0')]['id']},'include':_0x1c7bbd})[_0x9900('0x32')](handleEntityNotFound(_0x551e13,null))['then'](function(_0x23751a){if(_0x23751a){var _0x230e47=_0x23751a['get']({'plain':!![]});fs['mkdirSync'](_0x86768c);var _0x4aad78={'channel':_0x9900('0xd8'),'account':_0x230e47[_0x9900('0xd7')][_0x9900('0x3b')],'agent':_0x230e47[_0x9900('0xd9')]?_0x230e47[_0x9900('0xd9')]['fullname']:'N.A.','createdAt':moment(_0x230e47[_0x9900('0x75')])[_0x9900('0xbc')](_0x9900('0xbd'))[_0x9900('0x96')](),'closedAt':_0x230e47[_0x9900('0xda')]?moment(_0x230e47[_0x9900('0xdb')])[_0x9900('0xbc')](_0x9900('0xbd'))[_0x9900('0x96')]():'','disposition':_0x230e47[_0x9900('0xdc')],'messages':_(_0x230e47[_0x9900('0xd3')])['filter']({'secret':![]})[_0x9900('0x3a')](function(_0x879eb9){if(_0x879eb9[_0x9900('0xd2')]){var _0x5a992b=path[_0x9900('0xc7')](_0x19848f,_0x879eb9[_0x9900('0xd2')][_0x9900('0xdd')]);if(fs[_0x9900('0xde')](_0x5a992b)){fs[_0x9900('0xdf')](_0x5a992b)[_0x9900('0xe0')](fs[_0x9900('0xe1')](path[_0x9900('0xc7')](_0x86768c,_0x879eb9[_0x9900('0xd2')]['basename'])));}}return{'date':moment(_0x879eb9['createdAt'])['format'](_0x9900('0xbd'))['toString'](),'sender':_0x879eb9[_0x9900('0xd4')]===_0x9900('0xe2')?_0x879eb9[_0x9900('0xce')]?_0x879eb9['User'][_0x9900('0x2c')]:_0x9900('0xe3'):_0x879eb9['Contact'][_0x9900('0xd0')]+(_0x879eb9[_0x9900('0x62')][_0x9900('0xd1')]?'\x20'+_0x879eb9[_0x9900('0x62')][_0x9900('0xd1')]:''),'body':_0x879eb9[_0x9900('0xd2')]?_0x879eb9[_0x9900('0xd2')]['basename']:_0x879eb9[_0x9900('0x71')],'direction':_0x879eb9['direction']==='out'?'A':'C','secret':_0x879eb9[_0x9900('0xd5')],'read':_0x879eb9['read'],'attachment':_0x879eb9[_0x9900('0xd2')]};})[_0x9900('0x5e')]()};return ejs['renderFile'](path[_0x9900('0xc7')](config[_0x9900('0xc8')],'server',_0x9900('0xe4'),_0x9900('0xe5')),{'interaction':_0x4aad78})[_0x9900('0x32')](function(_0x348b18){var _0x45ca6a=path[_0x9900('0xc7')](_0x86768c,_0x9900('0xe6')+_0x230e47['id']+'-'+_0x4c9086+_0x9900('0xe7'));var _0x44372a={'path':_0x45ca6a,'channel':_0x9900('0xd8'),'interactionId':_0x230e47['id']};return pdf[_0x9900('0xe8')](_0x348b18,_0x44372a);})['then'](function(){return new BPromise(function(_0x3ed36c,_0x37ade9){zipdir(_0x86768c,{'saveTo':_0x54a3fa},function(_0x1ab4ab,_0xc6b589){if(_0x1ab4ab)return _0x37ade9(_0x1ab4ab);return _0x3ed36c(_0xc6b589);});})[_0x9900('0x32')](function(){return new BPromise(function(_0x48bd56,_0x17bc7d){rimraf(_0x86768c,function(_0x184c25){if(_0x184c25)_0x17bc7d(_0x184c25);return _0x48bd56();});});})['then'](function(){return _0x551e13[_0x9900('0xc5')](_0x54a3fa,_0x3bdbfe,function(_0x5ac4dd){if(_0x5ac4dd){console[_0x9900('0xe9')]('err',_0x5ac4dd);}else{fs['unlinkSync'](_0x54a3fa);}});});});}else{return _0x551e13[_0x9900('0x1c')](0xc8);}})[_0x9900('0x33')](handleError(_0x551e13,null));}; \ No newline at end of file +var _0x4534=['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','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','all','show','params','rawAttributes','intersection','includeAll','include','options','create','describe','ids','getMessages','findOne','WhatsappMessage','hasOwnProperty','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','omit','spread','whatsappInteractionTags:save','download','unix','join','server','tmp','root','files','attachments','format','User','lastName','Attachment','secret','WhatsappAccount','Owner','get','mkdirSync','Account','N.A.','closedAt','disposition','Messages','existsSync','pipe','createWriteStream','basename','direction','out','firstName','views','transcript-','.pdf','Whatsapp','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','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','../../mysqldb','localhost','socket.io-emitter','redis','./whatsappInteraction.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','Users','fullname','TagIds','Tags','split','push','catch','index','map','WhatsappInteraction','fieldName','type','key','model','query','filters','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','from','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','compact','isEmpty','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','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','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','WhatsappAccountId'];(function(_0x1dd5d9,_0x1ef658){var _0x2e8fc1=function(_0x563266){while(--_0x563266){_0x1dd5d9['push'](_0x1dd5d9['shift']());}};_0x2e8fc1(++_0x1ef658);}(_0x4534,0x141));var _0x4453=function(_0xea7026,_0x18039a){_0xea7026=_0xea7026-0x0;var _0x48e057=_0x4534[_0xea7026];return _0x48e057;};'use strict';var emlformat=require(_0x4453('0x0'));var rimraf=require(_0x4453('0x1'));var zipdir=require(_0x4453('0x2'));var jsonpatch=require(_0x4453('0x3'));var rp=require('request-promise');var moment=require(_0x4453('0x4'));var BPromise=require(_0x4453('0x5'));var Mustache=require(_0x4453('0x6'));var util=require(_0x4453('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4453('0x8'));var ejs=require(_0x4453('0x9'));var fs=require('fs');var fs_extra=require(_0x4453('0xa'));var _=require(_0x4453('0xb'));var squel=require(_0x4453('0xc'));var crypto=require(_0x4453('0xd'));var jsforce=require(_0x4453('0xe'));var deskjs=require(_0x4453('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4453('0x10'));var Papa=require(_0x4453('0x11'));var Redis=require(_0x4453('0x12'));var authService=require(_0x4453('0x13'));var qs=require(_0x4453('0x14'));var as=require(_0x4453('0x15'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4453('0x16'))('api');var utils=require(_0x4453('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4453('0x18'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x4453('0x19'),'port':0x18eb});var socket=require(_0x4453('0x1a'))(new Redis(config[_0x4453('0x1b')]));require(_0x4453('0x1c'))[_0x4453('0x1d')](socket);function respondWithStatusCode(_0x3f2884,_0x13f372){_0x13f372=_0x13f372||0xcc;return function(_0x40c574){if(_0x40c574){return _0x3f2884[_0x4453('0x1e')](_0x13f372);}return _0x3f2884['status'](_0x13f372)[_0x4453('0x1f')]();};}function respondWithResult(_0x23eb36,_0x2c7b20){_0x2c7b20=_0x2c7b20||0xc8;return function(_0x581f45){if(_0x581f45){return _0x23eb36[_0x4453('0x20')](_0x2c7b20)['json'](_0x581f45);}};}function respondWithFilteredResult(_0x785584,_0x47691d){return function(_0x589293){if(_0x589293){var _0x1c197e=typeof _0x47691d[_0x4453('0x21')]===_0x4453('0x22')&&typeof _0x47691d[_0x4453('0x23')]===_0x4453('0x22');var _0x280f94=_0x589293['count'];var _0x29d145=_0x1c197e?0x0:_0x47691d[_0x4453('0x21')];var _0x3a20d8=_0x1c197e?_0x589293[_0x4453('0x24')]:_0x47691d['offset']+_0x47691d['limit'];var _0x4a8a4f;if(_0x3a20d8>=_0x280f94){_0x3a20d8=_0x280f94;_0x4a8a4f=0xc8;}else{_0x4a8a4f=0xce;}_0x785584[_0x4453('0x20')](_0x4a8a4f);return _0x785584[_0x4453('0x25')](_0x4453('0x26'),_0x29d145+'-'+_0x3a20d8+'/'+_0x280f94)[_0x4453('0x27')](_0x589293);}return null;};}function patchUpdates(_0x8e8ce){return function(_0x53c676){try{jsonpatch[_0x4453('0x28')](_0x53c676,_0x8e8ce,!![]);}catch(_0x3a5ac5){return BPromise[_0x4453('0x29')](_0x3a5ac5);}return _0x53c676[_0x4453('0x2a')]();};}function saveUpdates(_0x5505b9,_0x20cd18){return function(_0x574399){if(_0x574399){return _0x574399[_0x4453('0x2b')](_0x5505b9)[_0x4453('0x2c')](function(_0x120b89){return _0x120b89;});}return null;};}function removeEntity(_0x1d0041,_0x1ce497){return function(_0x3bf527){if(_0x3bf527){return _0x3bf527[_0x4453('0x2d')]()['then'](function(){_0x1d0041['status'](0xcc)[_0x4453('0x1f')]();});}};}function handleEntityNotFound(_0x5332a0,_0x430ca6){return function(_0x17fbe2){if(!_0x17fbe2){_0x5332a0[_0x4453('0x1e')](0x194);}return _0x17fbe2;};}function handleError(_0xf52693,_0x163c18){_0x163c18=_0x163c18||0x1f4;return function(_0x3468e8){logger[_0x4453('0x2e')](_0x3468e8[_0x4453('0x2f')]);if(_0x3468e8[_0x4453('0x30')]){delete _0x3468e8[_0x4453('0x30')];}_0xf52693[_0x4453('0x20')](_0x163c18)[_0x4453('0x31')](_0x3468e8);};}function getInteractionUsers(_0x1e9414,_0xd70da2){return new BPromise(function(_0xa7e6eb,_0x17222d){try{if(_0xd70da2[_0x1e9414['id']]){_0x1e9414[_0x4453('0x32')]=_['map'](_0xd70da2[_0x1e9414['id']],function(_0x450907){return{'id':_0x450907['id'],'fullname':_0x450907[_0x4453('0x33')]};});}}catch(_0x2206eb){_0x17222d(_0x2206eb);}_0xa7e6eb(_0x1e9414);});}function getInteractionTags(_0x39f8ac,_0x3f8dc7){return new BPromise(function(_0x362fce,_0x3d85dc){try{if(_0x39f8ac[_0x4453('0x34')]){_0x39f8ac[_0x4453('0x35')]=[];_0x39f8ac[_0x4453('0x34')][_0x4453('0x36')](',')['forEach'](function(_0x234e88){_0x39f8ac[_0x4453('0x35')][_0x4453('0x37')](_0x3f8dc7[_0x234e88]);});}delete _0x39f8ac[_0x4453('0x34')];}catch(_0x878db0){_0x3d85dc(_0x878db0);}_0x362fce(_0x39f8ac);});}function updateWhatsappInteraction(_0x6ffc66,_0x1d49af,_0x103e9a){return new BPromise(function(_0x10b745,_0x45f961){return getInteractionUsers(_0x6ffc66,_0x103e9a)[_0x4453('0x2c')](function(_0x3f0736){return getInteractionTags(_0x3f0736,_0x1d49af);})[_0x4453('0x2c')](function(_0x189066){_0x10b745(_0x189066);})[_0x4453('0x38')](function(_0x30c755){_0x45f961(_0x30c755);});});}exports[_0x4453('0x39')]=function(_0x3eab03,_0xba3617){var _0x1a7076={},_0xab086={},_0x221fce={'count':0x0,'rows':[]};var _0x1f5980=_[_0x4453('0x3a')](db[_0x4453('0x3b')]['rawAttributes'],function(_0x256ae1){return{'name':_0x256ae1[_0x4453('0x3c')],'type':_0x256ae1[_0x4453('0x3d')][_0x4453('0x3e')]};});_0xab086[_0x4453('0x3f')]=_['map'](_0x1f5980,_0x4453('0x30'));_0xab086[_0x4453('0x40')]=_['keys'](_0x3eab03[_0x4453('0x40')]);_0xab086[_0x4453('0x41')]=_['intersection'](_0xab086[_0x4453('0x3f')],_0xab086[_0x4453('0x40')]);_0x1a7076[_0x4453('0x42')]=_['intersection'](_0xab086[_0x4453('0x3f')],qs[_0x4453('0x43')](_0x3eab03[_0x4453('0x40')][_0x4453('0x43')]));_0x1a7076[_0x4453('0x42')]=_0x1a7076[_0x4453('0x42')][_0x4453('0x44')]?_0x1a7076[_0x4453('0x42')]:_0xab086[_0x4453('0x3f')];if(!_0x3eab03[_0x4453('0x40')]['hasOwnProperty'](_0x4453('0x45'))){_0x1a7076[_0x4453('0x23')]=qs[_0x4453('0x23')](_0x3eab03[_0x4453('0x40')][_0x4453('0x23')]);_0x1a7076[_0x4453('0x21')]=qs['offset'](_0x3eab03[_0x4453('0x40')]['offset']);}_0x1a7076[_0x4453('0x46')]=qs[_0x4453('0x47')](_0x3eab03[_0x4453('0x40')]['sort']);_0x1a7076[_0x4453('0x48')]=qs[_0x4453('0x41')](_[_0x4453('0x49')](_0x3eab03['query'],_0xab086['filters']),_0x1f5980);var _0x10999e=[];var _0x5940c9=squel[_0x4453('0x4a')]()[_0x4453('0x4b')]('id')['field'](_0x4453('0x30'))[_0x4453('0x4b')](_0x4453('0x4c'))[_0x4453('0x4d')]('tools_tags');var _0x4e6a1f=squel[_0x4453('0x4a')]()[_0x4453('0x4b')](_0x4453('0x4e'))['field'](_0x4453('0x4f'))[_0x4453('0x4b')](_0x4453('0x50'))['from'](_0x4453('0x51'),'ui')['left_join'](_0x4453('0x52'),'u',_0x4453('0x53'));var _0x44155f=squel[_0x4453('0x4a')]()[_0x4453('0x4d')](_0x4453('0x54'),'i')[_0x4453('0x55')](_0x4453('0x56'),'c',_0x4453('0x57'))[_0x4453('0x55')](_0x4453('0x52'),'o','o.id\x20=\x20i.UserId')['left_join'](_0x4453('0x58'),'a','a.id\x20=\x20i.WhatsappAccountId')[_0x4453('0x55')]('whatsapp_messages','me','me.WhatsappInteractionId\x20=\x20i.id')[_0x4453('0x55')](_0x4453('0x59'),'it',_0x4453('0x5a'))['left_join'](_0x4453('0x5b'),'t','t.id\x20=\x20it.TagId');var _0x43f400=squel['expr']();var _0x14a97a=[];var _0x19548a=squel[_0x4453('0x5c')]();var _0x2e2fc0;if(_0x3eab03[_0x4453('0x40')][_0x4453('0x5d')]){_0x2e2fc0=as[_0x4453('0x5e')](_0x3eab03[_0x4453('0x40')][_0x4453('0x5d')]);var _0x3fd0ae=_0x2e2fc0[_0x4453('0x5f')];for(var _0xf30136=0x0;_0xf30136<_0x2e2fc0[_0x4453('0x60')][_0x4453('0x44')];_0xf30136++){var _0x55fc4a=_0x2e2fc0[_0x4453('0x60')][_0xf30136];var _0x42a732='i';var _0x448871=_[_0x4453('0x61')](_0x1f5980,[_0x4453('0x30'),_0x55fc4a[_0x4453('0x4b')]]);if(!_0x448871){switch(_0x55fc4a[_0x4453('0x4b')]){case _0x4453('0x62'):if(_0x55fc4a[_0x4453('0x63')]==0x1){_0x44155f[_0x4453('0x64')]('`'+_0x55fc4a['field']+_0x4453('0x65'));}else{_0x44155f[_0x4453('0x64')]('`'+_0x55fc4a[_0x4453('0x4b')]+_0x4453('0x66'));}break;case _0x4453('0x67'):if(_0x55fc4a[_0x4453('0x68')]===_0x4453('0x69')){if(_0x55fc4a[_0x4453('0x63')][_0x4453('0x36')]('\x20')[_0x4453('0x44')]>0x1){_0x43f400[_0x3fd0ae](_0x4453('0x6a'),qs[_0x4453('0x6b')](_0x55fc4a[_0x4453('0x63')]),null);}else{var _0x1a9a6b='%'+_0x55fc4a['value']+'%';_0x43f400[_0x3fd0ae]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x1a9a6b,_0x1a9a6b,_0x1a9a6b);}}else{_0x448871=_[_0x4453('0x61')](_0x1f5980,[_0x4453('0x30'),_0x4453('0x6c')]);_0x55fc4a[_0x4453('0x4b')]='ContactId';_0x3cf6ef=as[_0x4453('0x6d')](_0x42a732,_0x448871[_0x4453('0x3d')],_0x55fc4a);_0x43f400[_0x3fd0ae](_0x3cf6ef[_0x4453('0x6e')],_0x3cf6ef[_0x4453('0x63')][_0x4453('0x6f')],_0x3cf6ef[_0x4453('0x63')]['end']);}break;case _0x4453('0x70'):var _0x7ca6ed=_0x55fc4a[_0x4453('0x63')][_0x4453('0x36')](',')['map'](function(_0x24770a){return Number(_0x24770a);});_0x7ca6ed[_0x4453('0x71')](function(_0x79ee73){_0x19548a['or'](_0x4453('0x72'),'%,'+_0x79ee73+',%');});_0x14a97a=_[_0x4453('0x73')](_0x14a97a,_0x7ca6ed);break;case'User':if(_0x55fc4a['operator']==='$substring'){_0x43f400[_0x3fd0ae](_0x4453('0x74'),'%'+_0x55fc4a['value']+'%',null);}else{_0x448871=_[_0x4453('0x61')](_0x1f5980,[_0x4453('0x30'),_0x4453('0x75')]);_0x55fc4a[_0x4453('0x4b')]=_0x4453('0x75');_0x3cf6ef=as['buildExpression'](_0x42a732,_0x448871[_0x4453('0x3d')],_0x55fc4a);_0x43f400[_0x3fd0ae](_0x3cf6ef[_0x4453('0x6e')],_0x3cf6ef[_0x4453('0x63')]['start'],_0x3cf6ef[_0x4453('0x63')][_0x4453('0x1f')]);}break;case _0x4453('0x76'):_0x3cf6ef=as[_0x4453('0x6d')]('me',null,_0x55fc4a);_0x43f400[_0x3fd0ae](_0x3cf6ef[_0x4453('0x6e')],_0x3cf6ef[_0x4453('0x63')][_0x4453('0x6f')],_0x3cf6ef[_0x4453('0x63')]['end']);break;}}else{var _0x3cf6ef=as['buildExpression'](_0x42a732,_0x448871[_0x4453('0x3d')],_0x55fc4a);_0x43f400[_0x3fd0ae](_0x3cf6ef[_0x4453('0x6e')],_0x3cf6ef['value'][_0x4453('0x6f')],_0x3cf6ef[_0x4453('0x63')][_0x4453('0x1f')]);}}}else{var _0x15eece=_(_0x3eab03['query'])[_0x4453('0x77')]()[_0x4453('0x3a')](function(_0x413034){return _[_0x4453('0x78')](_0x1f5980,[_0x4453('0x30'),_0x413034])?_0x413034:undefined;})[_0x4453('0x79')]()[_0x4453('0x63')]();if(!_[_0x4453('0x7a')](_0x15eece)){_0x15eece['forEach'](function(_0x602b52){if(_0x602b52==='WhatsappAccountId'){_0x44155f[_0x4453('0x48')]('i.WhatsappAccountId\x20IN\x20?',[][_0x4453('0x7b')](_0x3eab03['query'][_0x602b52]));}else if(_0x602b52===_0x4453('0x7c')){var _0x38f246=JSON[_0x4453('0x7d')](_0x3eab03['query'][_0x602b52])['$gte'];var _0x59a35d=JSON['parse'](_0x3eab03[_0x4453('0x40')][_0x602b52])[_0x4453('0x7e')];_0x44155f[_0x4453('0x48')](_0x4453('0x7f'),_0x38f246,_0x59a35d);}else{if(_0x3eab03[_0x4453('0x40')][_0x602b52]==='null'){_0x44155f['where']('i.'+_0x602b52+'\x20IS\x20NULL');}else{_0x44155f['where']('i.'+_0x602b52+_0x4453('0x80'),_0x3eab03['query'][_0x602b52]);}}});}if(_0x3eab03['query'][_0x4453('0x81')]){if(_0x3eab03[_0x4453('0x40')][_0x4453('0x81')]==0x1){_0x44155f['having'](_0x4453('0x82'));}else{_0x44155f[_0x4453('0x64')](_0x4453('0x83'));}}if(_0x3eab03['query'][_0x4453('0x84')]){_0x14a97a=_['isArray'](_0x3eab03['query']['tag'])?_0x3eab03[_0x4453('0x40')][_0x4453('0x84')]:new Array(_0x3eab03['query']['tag']);_0x14a97a[_0x4453('0x71')](function(_0x38ba04){_0x19548a['or'](_0x4453('0x72'),'%,'+_0x38ba04+',%');});}if(_0x3eab03[_0x4453('0x40')][_0x4453('0x85')]){var _0x131489=_0x3eab03[_0x4453('0x40')][_0x4453('0x85')][_0x4453('0x86')]('\x5c','\x5c\x5c')[_0x4453('0x86')](/'/g,'\x27\x27');if(qs[_0x4453('0x87')](_0x131489)){_0x43f400['or']('i.id\x20LIKE\x20?',_0x131489+'%')['or'](_0x4453('0x88'),_0x131489+'%');}else{_0x43f400['or'](_0x4453('0x89'),qs['getFullTextValue'](_0x131489))['or'](_0x4453('0x8a'),_0x131489+'%');}}}_0x44155f['where'](_0x43f400);_0x44155f[_0x4453('0x8b')](_0x4453('0x8c'));var _0x352661={'type':db[_0x4453('0x8d')][_0x4453('0x8e')][_0x4453('0x8f')],'raw':!![]};var _0x47723b=_0x44155f['clone']();_0x47723b[_0x4453('0x4b')](_0x4453('0x8c'));_0x47723b[_0x4453('0x4b')](_0x4453('0x90'),_0x4453('0x62'));if(_0x1a7076['order']){_0x1a7076[_0x4453('0x46')][_0x4453('0x71')](function(_0x2d2b08){var _0x520f53=_0x2d2b08[0x0]===_0x4453('0x91')?_0x2d2b08[0x0]:'i.'+_0x2d2b08[0x0];_0x44155f[_0x4453('0x46')](_0x520f53,_0x2d2b08[0x1]===_0x4453('0x92')?![]:!![]);});}if(!_[_0x4453('0x7a')](_0x14a97a)){_0x44155f[_0x4453('0x64')](_0x19548a);_0x47723b['where'](_0x4453('0x93'),_0x14a97a);}BPromise[_0x4453('0x94')]()[_0x4453('0x2c')](function(){if(!_0x2e2fc0){if(_0x3eab03[_0x4453('0x40')]['WhatsappAccountId'])return;_0x47723b[_0x4453('0x48')](_0x4453('0x95'));_0x44155f[_0x4453('0x48')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3eab03[_0x4453('0x96')][_0x4453('0x97')]!==_0x4453('0x98'))return;return _0x3eab03[_0x4453('0x96')][_0x4453('0x99')]({'attributes':['id'],'raw':!![]})[_0x4453('0x2c')](function(_0x3e2a40){if(_[_0x4453('0x7a')](_0x3e2a40)){_0x47723b['where'](_0x4453('0x9a'));_0x44155f[_0x4453('0x48')](_0x4453('0x9a'));}else{_0x47723b[_0x4453('0x48')]('i.WhatsappAccountId\x20IN\x20?',_[_0x4453('0x3a')](_0x3e2a40,'id'));_0x44155f['where'](_0x4453('0x9b'),_[_0x4453('0x3a')](_0x3e2a40,'id'));}});})[_0x4453('0x2c')](function(){if(_0x3eab03[_0x4453('0x96')][_0x4453('0x97')]===_0x4453('0x98')&&!_0x2e2fc0&&!_0x3eab03[_0x4453('0x40')][_0x4453('0x9c')])return[];return db[_0x4453('0x9d')][_0x4453('0x40')](_0x47723b[_0x4453('0x9e')](),_0x352661);})[_0x4453('0x2c')](function(_0x251a61){_0x221fce[_0x4453('0x24')]=_0x251a61[_0x4453('0x44')];if(_0x221fce[_0x4453('0x24')]===0x0)return[];return db[_0x4453('0x9d')][_0x4453('0x40')](_0x5940c9[_0x4453('0x9e')](),_0x352661)['then'](function(_0x25f5b8){_0x10999e=_[_0x4453('0x9f')](_0x25f5b8,'id');_0x352661=_[_0x4453('0xa0')](_0x352661,{'model':db[_0x4453('0x3b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3eab03[_0x4453('0x40')][_0x4453('0x43')]){_0x1a7076['attributes'][_0x4453('0x71')](function(_0x399def){_0x44155f['field']('i.'+_0x399def);});}else{_0x44155f['field'](_0x4453('0x90'),'unreadMessages');_0x44155f['field'](_0x4453('0xa1'),_0x4453('0xa2'));_0x44155f[_0x4453('0x4b')](_0x4453('0xa3'),_0x4453('0xa4'));_0x44155f[_0x4453('0x4b')](_0x4453('0xa5'),_0x4453('0x91'));_0x44155f[_0x4453('0x4b')]('i.*');_0x44155f['field']('c.firstName','Contact.firstName');_0x44155f[_0x4453('0x4b')](_0x4453('0xa6'),_0x4453('0xa7'));_0x44155f[_0x4453('0x4b')](_0x4453('0xa8'),_0x4453('0xa9'));_0x44155f[_0x4453('0x4b')](_0x4453('0xaa'),_0x4453('0xab'));_0x44155f['field'](_0x4453('0xac'),_0x4453('0xad'));_0x44155f[_0x4453('0x4b')](_0x4453('0xae'),_0x4453('0xaf'));_0x44155f['field'](_0x4453('0xb0'),'Owner.fullname');_0x44155f[_0x4453('0x4b')](_0x4453('0xb1'),_0x4453('0xb2'));_0x44155f[_0x4453('0x4b')](_0x4453('0xb3'),_0x4453('0x34'));}if(_0x1a7076[_0x4453('0x23')])_0x44155f['limit'](_0x1a7076[_0x4453('0x23')]);if(_0x1a7076[_0x4453('0x21')])_0x44155f[_0x4453('0x21')](_0x1a7076['offset']);return db['sequelize'][_0x4453('0x40')](_0x44155f[_0x4453('0x9e')](),_0x352661);})['then'](function(_0x54f2a2){if(_0x54f2a2[_0x4453('0x44')]>0x0)_0x4e6a1f[_0x4453('0x48')](_0x4453('0xb4'),_['map'](_0x54f2a2,'id'));return db['sequelize']['query'](_0x4e6a1f[_0x4453('0x9e')](),_0x352661)[_0x4453('0x2c')](function(_0x5b4d55){var _0x4d22ca=_['groupBy'](_0x5b4d55,'WhatsappInteractionId');var _0x501bfa=[];_0x54f2a2['forEach'](function(_0x493924){_0x501bfa[_0x4453('0x37')](updateWhatsappInteraction(_0x493924,_0x10999e,_0x4d22ca));});return BPromise[_0x4453('0xb5')](_0x501bfa);});});})[_0x4453('0x2c')](function(_0x5d70f3){_0x221fce['rows']=_0x5d70f3;return _0x221fce;})[_0x4453('0x2c')](respondWithFilteredResult(_0xba3617,_0x1a7076))[_0x4453('0x38')](handleError(_0xba3617,null));};exports[_0x4453('0xb6')]=function(_0x47eccc,_0xc0646e){var _0x17a2bd={'raw':![],'where':{'id':_0x47eccc[_0x4453('0xb7')]['id']}},_0x584cfd={};_0x584cfd['model']=_[_0x4453('0x77')](db['WhatsappInteraction'][_0x4453('0xb8')]);_0x584cfd[_0x4453('0x40')]=_['keys'](_0x47eccc[_0x4453('0x40')]);_0x584cfd[_0x4453('0x41')]=_[_0x4453('0xb9')](_0x584cfd['model'],_0x584cfd['query']);_0x17a2bd[_0x4453('0x42')]=_['intersection'](_0x584cfd[_0x4453('0x3f')],qs[_0x4453('0x43')](_0x47eccc[_0x4453('0x40')]['fields']));_0x17a2bd['attributes']=_0x17a2bd[_0x4453('0x42')][_0x4453('0x44')]?_0x17a2bd[_0x4453('0x42')]:_0x584cfd[_0x4453('0x3f')];if(_0x47eccc[_0x4453('0x40')][_0x4453('0xba')]){_0x17a2bd[_0x4453('0xbb')]=[{'all':!![]}];}_0x17a2bd=_[_0x4453('0xa0')]({},_0x17a2bd,_0x47eccc[_0x4453('0xbc')]);return db[_0x4453('0x3b')][_0x4453('0x61')](_0x17a2bd)[_0x4453('0x2c')](handleEntityNotFound(_0xc0646e,null))['then'](respondWithResult(_0xc0646e,null))[_0x4453('0x38')](handleError(_0xc0646e,null));};exports[_0x4453('0xbd')]=function(_0x1251f1,_0x640f63){return db[_0x4453('0x3b')]['create'](_0x1251f1[_0x4453('0x76')],{})[_0x4453('0x2c')](respondWithResult(_0x640f63,0xc9))[_0x4453('0x38')](handleError(_0x640f63,null));};exports[_0x4453('0x2b')]=function(_0x4be67e,_0x46078d){if(_0x4be67e['body']['id']){delete _0x4be67e['body']['id'];}return db[_0x4453('0x3b')][_0x4453('0x61')]({'where':{'id':_0x4be67e[_0x4453('0xb7')]['id']}})[_0x4453('0x2c')](handleEntityNotFound(_0x46078d,null))[_0x4453('0x2c')](saveUpdates(_0x4be67e[_0x4453('0x76')],null))[_0x4453('0x2c')](respondWithResult(_0x46078d,null))[_0x4453('0x38')](handleError(_0x46078d,null));};exports[_0x4453('0x2d')]=function(_0x4d6b47,_0x4da3c7){return db[_0x4453('0x3b')][_0x4453('0x61')]({'where':{'id':_0x4d6b47['params']['id']}})['then'](handleEntityNotFound(_0x4da3c7,null))[_0x4453('0x2c')](removeEntity(_0x4da3c7,null))[_0x4453('0x38')](handleError(_0x4da3c7,null));};exports['describe']=function(_0x440939,_0x5b2dfe){return db['WhatsappInteraction'][_0x4453('0xbe')]()['then'](respondWithResult(_0x5b2dfe,null))[_0x4453('0x38')](handleError(_0x5b2dfe,null));};exports['addMessage']=function(_0x1c2353,_0x4c7031,_0x3c3000){return db['WhatsappMessage'][_0x4453('0x61')]({'where':{'id':_0x1c2353[_0x4453('0xb7')]['id']}})[_0x4453('0x2c')](handleEntityNotFound(_0x4c7031,null))['then'](function(_0x3c9ff5){if(_0x3c9ff5){return _0x3c9ff5['addMessage'](_0x1c2353['body']['ids'],_['omit'](_0x1c2353[_0x4453('0x76')],[_0x4453('0xbf'),'id'])||{});}})[_0x4453('0x2c')](respondWithResult(_0x4c7031,null))[_0x4453('0x38')](handleError(_0x4c7031,null));};exports[_0x4453('0xc0')]=function(_0x286c91,_0x57afc0,_0x499481){var _0x12f9cb={'raw':![],'where':{}};var _0x72120d={};var _0x11d7dd={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x4453('0xc1')]({'where':{'id':_0x286c91[_0x4453('0xb7')]['id']}})[_0x4453('0x2c')](handleEntityNotFound(_0x57afc0,null))[_0x4453('0x2c')](function(_0x56da33){if(_0x56da33){_0x72120d[_0x4453('0x3f')]=_[_0x4453('0x77')](db[_0x4453('0xc2')][_0x4453('0xb8')]);_0x72120d[_0x4453('0x40')]=_[_0x4453('0x77')](_0x286c91[_0x4453('0x40')]);_0x72120d[_0x4453('0x41')]=_[_0x4453('0xb9')](_0x72120d[_0x4453('0x3f')],_0x72120d[_0x4453('0x40')]);_0x12f9cb[_0x4453('0x42')]=_[_0x4453('0xb9')](_0x72120d[_0x4453('0x3f')],qs[_0x4453('0x43')](_0x286c91[_0x4453('0x40')][_0x4453('0x43')]));_0x12f9cb['attributes']=_0x12f9cb[_0x4453('0x42')][_0x4453('0x44')]?_0x12f9cb[_0x4453('0x42')]:_0x72120d['model'];if(!_0x286c91[_0x4453('0x40')][_0x4453('0xc3')](_0x4453('0x45'))){_0x12f9cb[_0x4453('0x23')]=qs[_0x4453('0x23')](_0x286c91['query']['limit']);_0x12f9cb[_0x4453('0x21')]=qs[_0x4453('0x21')](_0x286c91[_0x4453('0x40')]['offset']);}_0x12f9cb[_0x4453('0x46')]=qs[_0x4453('0x47')](_0x286c91['query']['sort']);_0x12f9cb[_0x4453('0x48')]=qs[_0x4453('0x41')](_['pick'](_0x286c91[_0x4453('0x40')],_0x72120d[_0x4453('0x41')]));_0x12f9cb['where']['WhatsappInteractionId']=_0x56da33['id'];if(_0x286c91[_0x4453('0x40')]['filter']){_0x12f9cb[_0x4453('0x48')]=_[_0x4453('0xa0')](_0x12f9cb['where'],{'$or':_[_0x4453('0x3a')](_0x12f9cb['attributes'],function(_0x4dc49e){var _0x2b5726={};_0x2b5726[_0x4dc49e]={'$like':'%'+_0x286c91['query'][_0x4453('0x85')]+'%'};return _0x2b5726;})});}if(_0x286c91[_0x4453('0x40')][_0x4453('0xc4')]){var _0x3a12f3=_0x286c91[_0x4453('0x40')]['$gte'][_0x4453('0x36')](',');var _0x18009e={};_0x18009e[_0x3a12f3[0x0]]={'$gte':moment(_0x3a12f3[0x1])['format'](_0x4453('0xc5'))};_0x12f9cb[_0x4453('0x48')]=_[_0x4453('0xa0')](_0x12f9cb[_0x4453('0x48')],_0x18009e);}_0x12f9cb=_[_0x4453('0xa0')]({},_0x12f9cb,_0x286c91[_0x4453('0xbc')]);return db[_0x4453('0xc2')][_0x4453('0x24')]({'where':_0x12f9cb[_0x4453('0x48')]})[_0x4453('0x2c')](function(_0x2e9215){_0x11d7dd[_0x4453('0x24')]=_0x2e9215;if(_0x286c91['query'][_0x4453('0xba')]){_0x12f9cb[_0x4453('0xbb')]=[{'all':!![]}];}return db[_0x4453('0xc2')][_0x4453('0xc6')](_0x12f9cb);})[_0x4453('0x2c')](function(_0x55870a){_0x11d7dd[_0x4453('0xc7')]=_0x55870a;return _0x11d7dd;});}})[_0x4453('0x2c')](respondWithFilteredResult(_0x57afc0,_0x12f9cb))[_0x4453('0x38')](handleError(_0x57afc0,null));};exports[_0x4453('0xc8')]=function(_0x12f1d1,_0x6b39e7,_0x5e87ad){return db[_0x4453('0x3b')][_0x4453('0x61')]({'where':{'id':_0x12f1d1['params']['id']}})['then'](handleEntityNotFound(_0x6b39e7,null))[_0x4453('0x2c')](function(_0x1ed8d2){if(_0x1ed8d2){return _0x1ed8d2[_0x4453('0xc9')](_0x12f1d1[_0x4453('0x76')][_0x4453('0xbf')],_[_0x4453('0xca')](_0x12f1d1[_0x4453('0x76')],[_0x4453('0xbf'),'id'])||{})[_0x4453('0xcb')](function(){return db['Tag'][_0x4453('0xc6')]({'attributes':['id',_0x4453('0x30'),_0x4453('0x4c')],'where':{'id':_0x12f1d1[_0x4453('0x76')][_0x4453('0xbf')]}});})[_0x4453('0x2c')](function(_0x53e3bf){socket['emit'](_0x4453('0xcc'),{'id':Number(_0x12f1d1['params']['id']),'tags':_0x53e3bf||[]});return{'id':Number(_0x12f1d1[_0x4453('0xb7')]['id']),'tags':_0x53e3bf||[]};});}})[_0x4453('0x2c')](respondWithResult(_0x6b39e7,null))[_0x4453('0x38')](handleError(_0x6b39e7,null));};exports['removeTags']=function(_0x49a0d1,_0x185a56,_0x55b079){return db['WhatsappInteraction']['find']({'where':{'id':_0x49a0d1['params']['id']}})['then'](handleEntityNotFound(_0x185a56,null))[_0x4453('0x2c')](function(_0x39462d){if(_0x39462d){return _0x39462d['removeTags'](_0x49a0d1[_0x4453('0x40')][_0x4453('0xbf')]);}})[_0x4453('0x2c')](respondWithStatusCode(_0x185a56,null))[_0x4453('0x38')](handleError(_0x185a56,null));};exports[_0x4453('0xcd')]=function(_0x20c2b5,_0x1d54d3){var _0x450cd9=moment()[_0x4453('0xce')]()[_0x4453('0x9e')]();var _0x333d9c=path[_0x4453('0xcf')](config['root'],_0x4453('0xd0'),'files',_0x4453('0xd1'));var _0x2724dd=path[_0x4453('0xcf')](config[_0x4453('0xd2')],_0x4453('0xd0'),_0x4453('0xd3'),_0x4453('0xd4'));var _0x18ff44=path['join'](_0x333d9c,_0x450cd9);var _0x4f4899=util[_0x4453('0xd5')]('transcript-%d-%s.zip',_0x20c2b5[_0x4453('0xb7')]['id'],_0x450cd9);var _0x44ef6d=path['join'](_0x333d9c,_0x4f4899);var _0x27dae5=[];_0x27dae5[_0x4453('0x37')]({'model':db[_0x4453('0xd6')],'as':_0x4453('0xd6'),'attributes':['id','fullname'],'raw':!![]});_0x27dae5[_0x4453('0x37')]({'model':db['CmContact'],'as':_0x4453('0x67'),'attributes':['id','firstName',_0x4453('0xd7')],'raw':!![]});if(_0x20c2b5[_0x4453('0x40')][_0x4453('0xd4')]){_0x27dae5[_0x4453('0x37')]({'model':db[_0x4453('0xd8')],'as':_0x4453('0xd8'),'raw':!![]});}var _0x3512ba=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0x4453('0x76'),_0x4453('0x7c'),'direction',_0x4453('0xd9'),_0x4453('0x81')],'include':_0x27dae5}];_0x3512ba['push']({'model':db[_0x4453('0xda')],'as':'Account','attributes':['id',_0x4453('0x30')]});_0x3512ba[_0x4453('0x37')]({'model':db[_0x4453('0xd6')],'as':_0x4453('0xdb'),'attributes':['id',_0x4453('0x33')]});return db['WhatsappInteraction'][_0x4453('0x61')]({'where':{'id':_0x20c2b5[_0x4453('0xb7')]['id']},'include':_0x3512ba})[_0x4453('0x2c')](handleEntityNotFound(_0x1d54d3,null))[_0x4453('0x2c')](function(_0x1d1098){if(_0x1d1098){var _0x27d8cf=_0x1d1098[_0x4453('0xdc')]({'plain':!![]});fs[_0x4453('0xdd')](_0x18ff44);var _0x536ec9={'channel':'Whatsapp','account':_0x27d8cf[_0x4453('0xde')]['name'],'agent':_0x27d8cf[_0x4453('0xdb')]?_0x27d8cf[_0x4453('0xdb')][_0x4453('0x33')]:_0x4453('0xdf'),'createdAt':moment(_0x27d8cf[_0x4453('0x7c')])[_0x4453('0xd5')](_0x4453('0xc5'))[_0x4453('0x9e')](),'closedAt':_0x27d8cf['closed']?moment(_0x27d8cf[_0x4453('0xe0')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x4453('0x9e')]():'','disposition':_0x27d8cf[_0x4453('0xe1')],'messages':_(_0x27d8cf[_0x4453('0xe2')])[_0x4453('0x85')]({'secret':![]})[_0x4453('0x3a')](function(_0x5c52fa){if(_0x5c52fa[_0x4453('0xd8')]){var _0x26627b=path['join'](_0x2724dd,_0x5c52fa[_0x4453('0xd8')]['basename']);if(fs[_0x4453('0xe3')](_0x26627b)){fs['createReadStream'](_0x26627b)[_0x4453('0xe4')](fs[_0x4453('0xe5')](path[_0x4453('0xcf')](_0x18ff44,_0x5c52fa[_0x4453('0xd8')][_0x4453('0xe6')])));}}return{'date':moment(_0x5c52fa[_0x4453('0x7c')])[_0x4453('0xd5')](_0x4453('0xc5'))[_0x4453('0x9e')](),'sender':_0x5c52fa[_0x4453('0xe7')]===_0x4453('0xe8')?_0x5c52fa[_0x4453('0xd6')]?_0x5c52fa[_0x4453('0xd6')][_0x4453('0x33')]:'System':_0x5c52fa[_0x4453('0x67')][_0x4453('0xe9')]+(_0x5c52fa[_0x4453('0x67')]['lastName']?'\x20'+_0x5c52fa['Contact'][_0x4453('0xd7')]:''),'body':_0x5c52fa[_0x4453('0xd8')]?_0x5c52fa[_0x4453('0xd8')][_0x4453('0xe6')]:_0x5c52fa[_0x4453('0x76')],'direction':_0x5c52fa[_0x4453('0xe7')]===_0x4453('0xe8')?'A':'C','secret':_0x5c52fa[_0x4453('0xd9')],'read':_0x5c52fa[_0x4453('0x81')],'attachment':_0x5c52fa['Attachment']};})[_0x4453('0x63')]()};return ejs['renderFile'](path[_0x4453('0xcf')](config[_0x4453('0xd2')],_0x4453('0xd0'),_0x4453('0xea'),'downloadInteraction.ejs'),{'interaction':_0x536ec9})['then'](function(_0x20822b){var _0x496fed=path[_0x4453('0xcf')](_0x18ff44,_0x4453('0xeb')+_0x27d8cf['id']+'-'+_0x450cd9+_0x4453('0xec'));var _0x4b97d0={'path':_0x496fed,'channel':_0x4453('0xed'),'interactionId':_0x27d8cf['id']};return pdf['createPdfFromHTML'](_0x20822b,_0x4b97d0);})['then'](function(){return new BPromise(function(_0x184f67,_0x53c605){zipdir(_0x18ff44,{'saveTo':_0x44ef6d},function(_0x1dbaf8,_0xcc1b07){if(_0x1dbaf8)return _0x53c605(_0x1dbaf8);return _0x184f67(_0xcc1b07);});})[_0x4453('0x2c')](function(){return new BPromise(function(_0x103b71,_0x9ad439){rimraf(_0x18ff44,function(_0x463909){if(_0x463909)_0x9ad439(_0x463909);return _0x103b71();});});})[_0x4453('0x2c')](function(){return _0x1d54d3['download'](_0x44ef6d,_0x4f4899,function(_0x1c5357){if(_0x1c5357){console['log']('err',_0x1c5357);}else{fs[_0x4453('0xee')](_0x44ef6d);}});});});}else{return _0x1d54d3[_0x4453('0x1e')](0xc8);}})[_0x4453('0x38')](handleError(_0x1d54d3,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index ef8bfcc..d2baf26 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 _0x50a8=['catch','hasOwnProperty','events','WhatsappMessage','save','update','remove','getUsers','then','Users','map','findAll','length','emit'];(function(_0x46707f,_0x15e65d){var _0x332441=function(_0x1a75a4){while(--_0x1a75a4){_0x46707f['push'](_0x46707f['shift']());}};_0x332441(++_0x15e65d);}(_0x50a8,0x198));var _0x850a=function(_0x4a05e7,_0x22f0df){_0x4a05e7=_0x4a05e7-0x0;var _0x126423=_0x50a8[_0x4a05e7];return _0x126423;};'use strict';var EventEmitter=require(_0x850a('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0x850a('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x850a('0x2'),'afterUpdate':_0x850a('0x3'),'afterDestroy':_0x850a('0x4')};function emitEvent(_0x3df4c3){return function(_0x30ed80,_0x1dbed8,_0xb85c1a){_0x30ed80[_0x850a('0x5')]({'attributes':['id'],'raw':!![]})[_0x850a('0x6')](function(_0x543ef0){_0x30ed80['setDataValue'](_0x850a('0x7'),_0x543ef0[_0x850a('0x8')](function(_0xc357fe){return{'id':_0xc357fe['id']};}));return WhatsappMessage[_0x850a('0x9')]({'where':{'WhatsappInteractionId':_0x30ed80['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3c6738){_0x30ed80['setDataValue']('unreadMessages',_0x3c6738[_0x850a('0xa')]);WhatsappInteractionEvents[_0x850a('0xb')](_0x3df4c3+':'+_0x30ed80['id'],_0x30ed80);WhatsappInteractionEvents[_0x850a('0xb')](_0x3df4c3,_0x30ed80);_0xb85c1a(null);})[_0x850a('0xc')](_0xb85c1a(null));};}for(var e in events){if(events[_0x850a('0xd')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x2cae=['remove','getUsers','Users','map','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','update'];(function(_0x1ae31c,_0x8dcd2d){var _0x19519d=function(_0x22b8cd){while(--_0x22b8cd){_0x1ae31c['push'](_0x1ae31c['shift']());}};_0x19519d(++_0x8dcd2d);}(_0x2cae,0x16b));var _0xe2ca=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0x2cae[_0x3e25c1];return _0x52e7f2;};'use strict';var EventEmitter=require(_0xe2ca('0x0'));var WhatsappInteraction=require(_0xe2ca('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0xe2ca('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xe2ca('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe2ca('0x4'),'afterDestroy':_0xe2ca('0x5')};function emitEvent(_0x2e883c){return function(_0x1d3499,_0x4dc701,_0x2b4c70){_0x1d3499[_0xe2ca('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x26779c){_0x1d3499['setDataValue'](_0xe2ca('0x7'),_0x26779c[_0xe2ca('0x8')](function(_0x305db7){return{'id':_0x305db7['id']};}));return WhatsappMessage[_0xe2ca('0x9')]({'where':{'WhatsappInteractionId':_0x1d3499['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x50b617){_0x1d3499['setDataValue']('unreadMessages',_0x50b617[_0xe2ca('0xa')]);WhatsappInteractionEvents[_0xe2ca('0xb')](_0x2e883c+':'+_0x1d3499['id'],_0x1d3499);WhatsappInteractionEvents[_0xe2ca('0xb')](_0x2e883c,_0x1d3499);_0x2b4c70(null);})[_0xe2ca('0xc')](_0x2b4c70(null));};}for(var e in events){if(events[_0xe2ca('0xd')](e)){var event=events[e];WhatsappInteraction[_0xe2ca('0xe')](e,emitEvent(event));}}module[_0xe2ca('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 34d8689..dbc7997 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 _0x54ce=['rimraf','../../config/environment','./whatsappInteraction.attributes','exports','WhatsappInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x321df4,_0x3efec5){var _0x50d06c=function(_0x3ac0f4){while(--_0x3ac0f4){_0x321df4['push'](_0x321df4['shift']());}};_0x50d06c(++_0x3efec5);}(_0x54ce,0x19e));var _0xe54c=function(_0x371843,_0x4eed0a){_0x371843=_0x371843-0x0;var _0x638885=_0x54ce[_0x371843];return _0x638885;};'use strict';var _=require(_0xe54c('0x0'));var util=require(_0xe54c('0x1'));var logger=require(_0xe54c('0x2'))('api');var moment=require(_0xe54c('0x3'));var BPromise=require('bluebird');var rp=require(_0xe54c('0x4'));var fs=require('fs');var path=require(_0xe54c('0x5'));var rimraf=require(_0xe54c('0x6'));var config=require(_0xe54c('0x7'));var attributes=require(_0xe54c('0x8'));module[_0xe54c('0x9')]=function(_0x3df063,_0xd81b81){return _0x3df063['define'](_0xe54c('0xa'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57b99b,_0x266a0a,_0x27600f){if(_0x57b99b[_0xe54c('0xb')]('closed')){_0x57b99b[_0xe54c('0xc')]=moment()[_0xe54c('0xd')](_0xe54c('0xe'));}_0x27600f(null,_0x57b99b);}}});}; \ No newline at end of file +var _0x4c71=['bluebird','rimraf','../../config/environment','define','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x4c71,0x1d1));var _0x14c7=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x4c71[_0x36884e];return _0x1cc367;};'use strict';var _=require(_0x14c7('0x0'));var util=require(_0x14c7('0x1'));var logger=require(_0x14c7('0x2'))('api');var moment=require('moment');var BPromise=require(_0x14c7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x14c7('0x4'));var config=require(_0x14c7('0x5'));var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x2d422e,_0x39505d){return _0x2d422e[_0x14c7('0x6')]('WhatsappInteraction',attributes,{'tableName':_0x14c7('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x147e26,_0x50129b,_0x5ce04f){if(_0x147e26[_0x14c7('0x8')](_0x14c7('0x9'))){_0x147e26[_0x14c7('0xa')]=moment()[_0x14c7('0xb')](_0x14c7('0xc'));}_0x5ce04f(null,_0x147e26);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 26a7924..5439cb5 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 _0x37a7=['update','body','raw','options','where','attributes','limit','catch','AddTagsToWhatsappInteraction','find','addTags','ids','omit','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateWhatsappInteraction','WhatsappInteraction'];(function(_0x5a229c,_0x53feff){var _0x31bdd7=function(_0x235fa4){while(--_0x235fa4){_0x5a229c['push'](_0x5a229c['shift']());}};_0x31bdd7(++_0x53feff);}(_0x37a7,0xf4));var _0x737a=function(_0x1dd184,_0x1b5dfa){_0x1dd184=_0x1dd184-0x0;var _0x18f4eb=_0x37a7[_0x1dd184];return _0x18f4eb;};'use strict';var _=require('lodash');var util=require(_0x737a('0x0'));var moment=require(_0x737a('0x1'));var BPromise=require(_0x737a('0x2'));var rs=require(_0x737a('0x3'));var fs=require('fs');var Redis=require(_0x737a('0x4'));var db=require(_0x737a('0x5'))['db'];var utils=require(_0x737a('0x6'));var logger=require(_0x737a('0x7'))(_0x737a('0x8'));var config=require(_0x737a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x737a('0xa')][_0x737a('0xb')]({'port':0x232a});config[_0x737a('0xc')]=_[_0x737a('0xd')](config[_0x737a('0xc')],{'host':_0x737a('0xe'),'port':0x18eb});var socket=require(_0x737a('0xf'))(new Redis(config[_0x737a('0xc')]));require(_0x737a('0x10'))[_0x737a('0x11')](socket);function respondWithRpcPromise(_0x4d429d,_0x4567d3,_0x29f9f1){return new BPromise(function(_0x3fc683,_0x37ddff){return client[_0x737a('0x12')](_0x4d429d,_0x29f9f1)[_0x737a('0x13')](function(_0x232df5){logger[_0x737a('0x14')](_0x737a('0x15'),_0x4567d3,_0x737a('0x16'));logger[_0x737a('0x17')](_0x737a('0x18'),_0x4567d3,_0x737a('0x16'),JSON[_0x737a('0x19')](_0x232df5));if(_0x232df5[_0x737a('0x1a')]){if(_0x232df5[_0x737a('0x1a')][_0x737a('0x1b')]===0x1f4){logger[_0x737a('0x1a')](_0x737a('0x15'),_0x4567d3,_0x232df5[_0x737a('0x1a')][_0x737a('0x1c')]);return _0x37ddff(_0x232df5['error'][_0x737a('0x1c')]);}logger[_0x737a('0x1a')](_0x737a('0x15'),_0x4567d3,_0x232df5[_0x737a('0x1a')]['message']);return _0x3fc683(_0x232df5[_0x737a('0x1a')][_0x737a('0x1c')]);}else{logger[_0x737a('0x14')](_0x737a('0x15'),_0x4567d3,_0x737a('0x16'));_0x3fc683(_0x232df5[_0x737a('0x1d')][_0x737a('0x1c')]);}})['catch'](function(_0x709f45){logger[_0x737a('0x1a')](_0x737a('0x15'),_0x4567d3,_0x709f45);_0x37ddff(_0x709f45);});});}exports[_0x737a('0x1e')]=function(_0x3257c1){var _0x42632f=this;return new Promise(function(_0x19760e,_0x4eb81b){return db[_0x737a('0x1f')][_0x737a('0x20')](_0x3257c1[_0x737a('0x21')],{'raw':_0x3257c1['options']?_0x3257c1['options'][_0x737a('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3257c1['options']?_0x3257c1[_0x737a('0x23')][_0x737a('0x24')]||null:null,'attributes':_0x3257c1[_0x737a('0x23')]?_0x3257c1[_0x737a('0x23')][_0x737a('0x25')]||null:null,'limit':_0x3257c1[_0x737a('0x23')]?_0x3257c1[_0x737a('0x23')][_0x737a('0x26')]||null:null})[_0x737a('0x13')](function(_0x2a6a5){logger[_0x737a('0x14')]('UpdateWhatsappInteraction',_0x3257c1);logger[_0x737a('0x17')](_0x737a('0x1e'),_0x3257c1,JSON['stringify'](_0x2a6a5));_0x19760e(_0x2a6a5);})[_0x737a('0x27')](function(_0x122e44){logger[_0x737a('0x1a')](_0x737a('0x1e'),_0x122e44[_0x737a('0x1c')],_0x3257c1);_0x4eb81b(_0x42632f[_0x737a('0x1a')](0x1f4,_0x122e44[_0x737a('0x1c')]));});});};exports[_0x737a('0x28')]=function(_0x11b7f1){return new Promise(function(_0x17e274,_0x2207ca){return db[_0x737a('0x1f')][_0x737a('0x29')]({'where':_0x11b7f1[_0x737a('0x23')]?_0x11b7f1['options'][_0x737a('0x24')]||null:null})[_0x737a('0x13')](function(_0x30e133){if(_0x30e133){return _0x30e133[_0x737a('0x2a')](_0x11b7f1[_0x737a('0x21')][_0x737a('0x2b')],_[_0x737a('0x2c')](_0x11b7f1[_0x737a('0x21')],[_0x737a('0x2b'),'id'])||{});}})['spread'](function(_0x3b393b){logger[_0x737a('0x14')](_0x737a('0x2d'),_0x11b7f1);logger[_0x737a('0x17')](_0x737a('0x2d'),_0x11b7f1,JSON[_0x737a('0x19')](_0x3b393b));_0x17e274(_0x3b393b);})[_0x737a('0x27')](function(_0x7da47c){logger[_0x737a('0x1a')](_0x737a('0x2d'),_0x7da47c['message'],_0x11b7f1);_0x2207ca(_this[_0x737a('0x1a')](0x1f4,_0x7da47c['message']));});});}; \ No newline at end of file +var _0x664b=['WhatsappInteraction','update','body','options','raw','where','attributes','limit','then','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateWhatsappInteraction'];(function(_0x5679f4,_0x5ace54){var _0x2f9e94=function(_0x5d5ccb){while(--_0x5d5ccb){_0x5679f4['push'](_0x5679f4['shift']());}};_0x2f9e94(++_0x5ace54);}(_0x664b,0x1c6));var _0xb664=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x664b[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xb664('0x0'));var util=require(_0xb664('0x1'));var moment=require(_0xb664('0x2'));var BPromise=require('bluebird');var rs=require(_0xb664('0x3'));var fs=require('fs');var Redis=require(_0xb664('0x4'));var db=require(_0xb664('0x5'))['db'];var utils=require(_0xb664('0x6'));var logger=require(_0xb664('0x7'))(_0xb664('0x8'));var config=require('../../config/environment');var jayson=require(_0xb664('0x9'));var client=jayson[_0xb664('0xa')][_0xb664('0xb')]({'port':0x232a});config[_0xb664('0xc')]=_[_0xb664('0xd')](config['redis'],{'host':_0xb664('0xe'),'port':0x18eb});var socket=require(_0xb664('0xf'))(new Redis(config[_0xb664('0xc')]));require('./whatsappInteraction.socket')[_0xb664('0x10')](socket);function respondWithRpcPromise(_0x5105ba,_0x166168,_0x37c7a0){return new BPromise(function(_0x2f570f,_0x426bf5){return client[_0xb664('0x11')](_0x5105ba,_0x37c7a0)['then'](function(_0x119f12){logger[_0xb664('0x12')](_0xb664('0x13'),_0x166168,_0xb664('0x14'));logger[_0xb664('0x15')](_0xb664('0x16'),_0x166168,'request\x20sent',JSON[_0xb664('0x17')](_0x119f12));if(_0x119f12['error']){if(_0x119f12[_0xb664('0x18')][_0xb664('0x19')]===0x1f4){logger['error'](_0xb664('0x13'),_0x166168,_0x119f12['error'][_0xb664('0x1a')]);return _0x426bf5(_0x119f12[_0xb664('0x18')][_0xb664('0x1a')]);}logger[_0xb664('0x18')](_0xb664('0x13'),_0x166168,_0x119f12[_0xb664('0x18')]['message']);return _0x2f570f(_0x119f12[_0xb664('0x18')][_0xb664('0x1a')]);}else{logger[_0xb664('0x12')](_0xb664('0x13'),_0x166168,_0xb664('0x14'));_0x2f570f(_0x119f12[_0xb664('0x1b')][_0xb664('0x1a')]);}})[_0xb664('0x1c')](function(_0x365e80){logger[_0xb664('0x18')](_0xb664('0x13'),_0x166168,_0x365e80);_0x426bf5(_0x365e80);});});}exports[_0xb664('0x1d')]=function(_0x2bed69){var _0x223004=this;return new Promise(function(_0x1bfdbf,_0x30ff81){return db[_0xb664('0x1e')][_0xb664('0x1f')](_0x2bed69[_0xb664('0x20')],{'raw':_0x2bed69[_0xb664('0x21')]?_0x2bed69[_0xb664('0x21')][_0xb664('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bed69['options']?_0x2bed69[_0xb664('0x21')][_0xb664('0x23')]||null:null,'attributes':_0x2bed69[_0xb664('0x21')]?_0x2bed69[_0xb664('0x21')][_0xb664('0x24')]||null:null,'limit':_0x2bed69['options']?_0x2bed69[_0xb664('0x21')][_0xb664('0x25')]||null:null})[_0xb664('0x26')](function(_0x3133a3){logger[_0xb664('0x12')](_0xb664('0x1d'),_0x2bed69);logger[_0xb664('0x15')](_0xb664('0x1d'),_0x2bed69,JSON[_0xb664('0x17')](_0x3133a3));_0x1bfdbf(_0x3133a3);})['catch'](function(_0x2a58d5){logger[_0xb664('0x18')]('UpdateWhatsappInteraction',_0x2a58d5[_0xb664('0x1a')],_0x2bed69);_0x30ff81(_0x223004[_0xb664('0x18')](0x1f4,_0x2a58d5['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x2d70ca){return new Promise(function(_0x4e4cb6,_0x5c31bd){return db['WhatsappInteraction']['find']({'where':_0x2d70ca[_0xb664('0x21')]?_0x2d70ca[_0xb664('0x21')][_0xb664('0x23')]||null:null})[_0xb664('0x26')](function(_0x3331dc){if(_0x3331dc){return _0x3331dc[_0xb664('0x27')](_0x2d70ca[_0xb664('0x20')][_0xb664('0x28')],_[_0xb664('0x29')](_0x2d70ca[_0xb664('0x20')],[_0xb664('0x28'),'id'])||{});}})[_0xb664('0x2a')](function(_0x44614a){logger['info']('AddTags',_0x2d70ca);logger[_0xb664('0x15')](_0xb664('0x2b'),_0x2d70ca,JSON[_0xb664('0x17')](_0x44614a));_0x4e4cb6(_0x44614a);})[_0xb664('0x1c')](function(_0x16bcd6){logger['error']('AddTags',_0x16bcd6[_0xb664('0x1a')],_0x2d70ca);_0x5c31bd(_this[_0xb664('0x18')](0x1f4,_0x16bcd6[_0xb664('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 4a30ea1..56ab665 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 _0x7063=['emit','removeListener','length','whatsappInteraction:','./whatsappInteraction.events','remove','update'];(function(_0x21b135,_0x2817c4){var _0x36aef1=function(_0xa5ecb4){while(--_0xa5ecb4){_0x21b135['push'](_0x21b135['shift']());}};_0x36aef1(++_0x2817c4);}(_0x7063,0x82));var _0x3706=function(_0x5622f6,_0x663ed0){_0x5622f6=_0x5622f6-0x0;var _0x2c3552=_0x7063[_0x5622f6];return _0x2c3552;};'use strict';var WhatsappInteractionEvents=require(_0x3706('0x0'));var events=['save',_0x3706('0x1'),_0x3706('0x2')];function createListener(_0x73124c,_0x435548){return function(_0x42815f){_0x435548[_0x3706('0x3')](_0x73124c,_0x42815f);};}function removeListener(_0x1f0202,_0x226ab2){return function(){WhatsappInteractionEvents[_0x3706('0x4')](_0x1f0202,_0x226ab2);};}exports['register']=function(_0x239d21){for(var _0x2e661e=0x0,_0x2a6065=events[_0x3706('0x5')];_0x2e661e<_0x2a6065;_0x2e661e++){var _0x27b765=events[_0x2e661e];var _0x2003ac=createListener(_0x3706('0x6')+_0x27b765,_0x239d21);WhatsappInteractionEvents['on'](_0x27b765,_0x2003ac);}}; \ No newline at end of file +var _0x136b=['save','remove','update','register','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x136b,0x1b1));var _0xb136=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x136b[_0xb0f7c3];return _0x28ea68;};'use strict';var WhatsappInteractionEvents=require(_0xb136('0x0'));var events=[_0xb136('0x1'),_0xb136('0x2'),_0xb136('0x3')];function createListener(_0x3b6625,_0x114f3d){return function(_0x3a293b){_0x114f3d['emit'](_0x3b6625,_0x3a293b);};}function removeListener(_0x589f25,_0x56ed97){return function(){WhatsappInteractionEvents['removeListener'](_0x589f25,_0x56ed97);};}exports[_0xb136('0x4')]=function(_0x102d07){for(var _0x1ae995=0x0,_0xaacc86=events[_0xb136('0x5')];_0x1ae995<_0xaacc86;_0x1ae995++){var _0x18daf6=events[_0x1ae995];var _0x4741b3=createListener(_0xb136('0x6')+_0x18daf6,_0x102d07);WhatsappInteractionEvents['on'](_0x18daf6,_0x4741b3);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 28ad5f2..76940c6 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 _0xea07=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','tracked','whatsapp','whatsappmessage:create','status','put','update','/:id/accept','accept','reject','delete','exports','util','path','connect-timeout'];(function(_0x221500,_0x12e9dc){var _0x3743f4=function(_0x34053c){while(--_0x34053c){_0x221500['push'](_0x221500['shift']());}};_0x3743f4(++_0x12e9dc);}(_0xea07,0x7f));var _0x7ea0=function(_0x4d34b1,_0x1eeeae){_0x4d34b1=_0x4d34b1-0x0;var _0x29ac29=_0xea07[_0x4d34b1];return _0x29ac29;};'use strict';var multer=require('multer');var util=require(_0x7ea0('0x0'));var path=require(_0x7ea0('0x1'));var timeout=require(_0x7ea0('0x2'));var express=require(_0x7ea0('0x3'));var router=express[_0x7ea0('0x4')]();var fs_extra=require(_0x7ea0('0x5'));var auth=require(_0x7ea0('0x6'));var interaction=require(_0x7ea0('0x7'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0x7ea0('0x8')]('/',auth['isAuthenticated'](),controller[_0x7ea0('0x9')]);router[_0x7ea0('0x8')](_0x7ea0('0xa'),auth[_0x7ea0('0xb')](),controller[_0x7ea0('0xc')]);router[_0x7ea0('0x8')](_0x7ea0('0xd'),auth[_0x7ea0('0xb')](),controller[_0x7ea0('0xe')]);router['post']('/',auth[_0x7ea0('0xb')](),interaction[_0x7ea0('0xf')](_0x7ea0('0x10'),_0x7ea0('0x11')),controller['create']);router['post']('/:id/status',controller[_0x7ea0('0x12')]);router[_0x7ea0('0x13')](_0x7ea0('0xd'),auth[_0x7ea0('0xb')](),controller[_0x7ea0('0x14')]);router[_0x7ea0('0x13')](_0x7ea0('0x15'),auth['isAuthenticated'](),controller[_0x7ea0('0x16')]);router[_0x7ea0('0x13')]('/:id/reject',auth['isAuthenticated'](),controller[_0x7ea0('0x17')]);router[_0x7ea0('0x18')](_0x7ea0('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x7ea0('0x19')]=router; \ No newline at end of file +var _0x6464=['../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x3046d8,_0x19af5e){var _0x56ecb6=function(_0x4d50f9){while(--_0x4d50f9){_0x3046d8['push'](_0x3046d8['shift']());}};_0x56ecb6(++_0x19af5e);}(_0x6464,0x1e8));var _0x4646=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x6464[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x4646('0x0'));var util=require('util');var path=require(_0x4646('0x1'));var timeout=require(_0x4646('0x2'));var express=require(_0x4646('0x3'));var router=express['Router']();var fs_extra=require(_0x4646('0x4'));var auth=require(_0x4646('0x5'));var interaction=require(_0x4646('0x6'));var config=require(_0x4646('0x7'));var controller=require(_0x4646('0x8'));router[_0x4646('0x9')]('/',auth[_0x4646('0xa')](),controller['index']);router[_0x4646('0x9')](_0x4646('0xb'),auth[_0x4646('0xa')](),controller[_0x4646('0xc')]);router[_0x4646('0x9')](_0x4646('0xd'),auth[_0x4646('0xa')](),controller[_0x4646('0xe')]);router[_0x4646('0xf')]('/',auth[_0x4646('0xa')](),interaction[_0x4646('0x10')](_0x4646('0x11'),_0x4646('0x12')),controller[_0x4646('0x13')]);router[_0x4646('0xf')](_0x4646('0x14'),controller[_0x4646('0x15')]);router['put'](_0x4646('0xd'),auth[_0x4646('0xa')](),controller[_0x4646('0x16')]);router['put'](_0x4646('0x17'),auth[_0x4646('0xa')](),controller[_0x4646('0x18')]);router['put'](_0x4646('0x19'),auth[_0x4646('0xa')](),controller['reject']);router[_0x4646('0x1a')](_0x4646('0xd'),auth[_0x4646('0xa')](),controller[_0x4646('0x1b')]);module[_0x4646('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 696c5bb..425c755 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 _0xa0c9=['BOOLEAN','ENUM','out','DATE','STRING','TEXT','sequelize','exports','medium'];(function(_0x3e0b8f,_0x1cddeb){var _0x22f742=function(_0xacb1bc){while(--_0xacb1bc){_0x3e0b8f['push'](_0x3e0b8f['shift']());}};_0x22f742(++_0x1cddeb);}(_0xa0c9,0xf0));var _0x9a0c=function(_0x5be09a,_0x525dc7){_0x5be09a=_0x5be09a-0x0;var _0x143708=_0xa0c9[_0x5be09a];return _0x143708;};'use strict';var Sequelize=require(_0x9a0c('0x0'));module[_0x9a0c('0x1')]={'body':{'type':Sequelize['TEXT'](_0x9a0c('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9a0c('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9a0c('0x4')]('in',_0x9a0c('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x9a0c('0x6')]},'secret':{'type':Sequelize[_0x9a0c('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x9a0c('0x7')]},'providerResponse':{'type':Sequelize[_0x9a0c('0x8')]}}; \ No newline at end of file +var _0x240e=['TEXT','ENUM','out','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x2924aa,_0x171f34){var _0x124cc3=function(_0x57ba15){while(--_0x57ba15){_0x2924aa['push'](_0x2924aa['shift']());}};_0x124cc3(++_0x171f34);}(_0x240e,0x176));var _0xe240=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0x240e[_0x34bc30];return _0x5706de;};'use strict';var Sequelize=require(_0xe240('0x0'));module[_0xe240('0x1')]={'body':{'type':Sequelize[_0xe240('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe240('0x3')]('in','out'),'defaultValue':_0xe240('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe240('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0xe240('0x6')]},'secret':{'type':Sequelize[_0xe240('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe240('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 32b537f..1ccb295 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 _0x0384=['WhatsappInteractionId','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','agent','fullname','email','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','Sequelize','contact','User','internal','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','MessageSid','messageId','MessageStatus','twilio','inspect','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./whatsappMessage.socket','jayson/promise','client','http','request','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','stack','name','index','map','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','WhatsappMessage','findAll','rows','show','rawAttributes','options','create','body','find','params','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','WhatsappInteraction'];(function(_0x5d0f7c,_0x10d1ed){var _0x23feb5=function(_0x141101){while(--_0x141101){_0x5d0f7c['push'](_0x5d0f7c['shift']());}};_0x23feb5(++_0x10d1ed);}(_0x0384,0xb2));var _0x4038=function(_0x3d01cf,_0x3e24aa){_0x3d01cf=_0x3d01cf-0x0;var _0x2a192e=_0x0384[_0x3d01cf];return _0x2a192e;};'use strict';var emlformat=require(_0x4038('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4038('0x1'));var rp=require(_0x4038('0x2'));var moment=require(_0x4038('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4038('0x4'));var path=require(_0x4038('0x5'));var sox=require(_0x4038('0x6'));var csv=require(_0x4038('0x7'));var ejs=require(_0x4038('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4038('0x9'));var squel=require(_0x4038('0xa'));var crypto=require('crypto');var jsforce=require(_0x4038('0xb'));var deskjs=require(_0x4038('0xc'));var toCsv=require(_0x4038('0x7'));var querystring=require(_0x4038('0xd'));var Papa=require(_0x4038('0xe'));var Redis=require(_0x4038('0xf'));var authService=require(_0x4038('0x10'));var qs=require(_0x4038('0x11'));var as=require(_0x4038('0x12'));var hardwareService=require(_0x4038('0x13'));var logger=require(_0x4038('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4038('0x15'));var licenseUtil=require(_0x4038('0x16'));var db=require(_0x4038('0x17'))['db'];config['redis']=_[_0x4038('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4038('0x19'))(new Redis(config[_0x4038('0x1a')]));require(_0x4038('0x1b'))['register'](socket);var jayson=require(_0x4038('0x1c'));var client=jayson[_0x4038('0x1d')][_0x4038('0x1e')]({'port':0x232c});var client9002=jayson[_0x4038('0x1d')][_0x4038('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4360cf,_0x11f9c2,_0x472117,_0x1ab68b){return new BPromise(function(_0xd17f5a,_0x29cf21){var _0x4b5a2b=_0x1ab68b||client;return _0x4b5a2b[_0x4038('0x1f')](_0x4360cf,_0x472117)['then'](function(_0x5a2f01){logger[_0x4038('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0x11f9c2,_0x4038('0x21'));logger[_0x4038('0x22')](_0x4038('0x23'),_0x11f9c2,'request\x20sent',JSON[_0x4038('0x24')](_0x5a2f01));if(_0x5a2f01[_0x4038('0x25')]){if(_0x5a2f01[_0x4038('0x25')]['code']===0x1f4){logger[_0x4038('0x25')](_0x4038('0x26'),_0x11f9c2,_0x5a2f01['error']['message']);return _0x29cf21(_0x5a2f01[_0x4038('0x25')]['message']);}logger[_0x4038('0x25')](_0x4038('0x26'),_0x11f9c2,_0x5a2f01[_0x4038('0x25')][_0x4038('0x27')]);return _0xd17f5a(_0x5a2f01[_0x4038('0x25')][_0x4038('0x27')]);}else{logger[_0x4038('0x20')]('WhatsappMessage,\x20%s,\x20%s',_0x11f9c2,_0x4038('0x21'));_0xd17f5a(_0x5a2f01['result'][_0x4038('0x27')]);}})[_0x4038('0x28')](function(_0x1391d6){logger['error'](_0x4038('0x26'),_0x11f9c2,_0x1391d6);_0x29cf21(_0x1391d6);});});}function respondWithStatusCode(_0x248201,_0x12de77){_0x12de77=_0x12de77||0xcc;return function(_0x1308a6){if(_0x1308a6){return _0x248201[_0x4038('0x29')](_0x12de77);}return _0x248201['status'](_0x12de77)[_0x4038('0x2a')]();};}function respondWithResult(_0x459800,_0x22b70d){_0x22b70d=_0x22b70d||0xc8;return function(_0x13fa23){if(_0x13fa23){return _0x459800['status'](_0x22b70d)[_0x4038('0x2b')](_0x13fa23);}};}function respondWithFilteredResult(_0xbc00f4,_0x5e9c2a){return function(_0x13fa96){if(_0x13fa96){var _0x235876=typeof _0x5e9c2a[_0x4038('0x2c')]===_0x4038('0x2d')&&typeof _0x5e9c2a[_0x4038('0x2e')]===_0x4038('0x2d');var _0x2954e0=_0x13fa96[_0x4038('0x2f')];var _0x220f0f=_0x235876?0x0:_0x5e9c2a[_0x4038('0x2c')];var _0x59d07c=_0x235876?_0x13fa96[_0x4038('0x2f')]:_0x5e9c2a[_0x4038('0x2c')]+_0x5e9c2a[_0x4038('0x2e')];var _0x550f9f;if(_0x59d07c>=_0x2954e0){_0x59d07c=_0x2954e0;_0x550f9f=0xc8;}else{_0x550f9f=0xce;}_0xbc00f4[_0x4038('0x30')](_0x550f9f);return _0xbc00f4[_0x4038('0x31')](_0x4038('0x32'),_0x220f0f+'-'+_0x59d07c+'/'+_0x2954e0)[_0x4038('0x2b')](_0x13fa96);}return null;};}function patchUpdates(_0x2ea4cf){return function(_0x1a3bdb){try{jsonpatch['apply'](_0x1a3bdb,_0x2ea4cf,!![]);}catch(_0x38ff49){return BPromise[_0x4038('0x33')](_0x38ff49);}return _0x1a3bdb[_0x4038('0x34')]();};}function saveUpdates(_0x37f1e8,_0x4e4f22){return function(_0x388a73){if(_0x388a73){return _0x388a73[_0x4038('0x35')](_0x37f1e8)[_0x4038('0x36')](function(_0x571ec3){return _0x571ec3;});}return null;};}function removeEntity(_0x26e1bf,_0x2c9c30){return function(_0x37eb7e){if(_0x37eb7e){return _0x37eb7e[_0x4038('0x37')]()[_0x4038('0x36')](function(){_0x26e1bf[_0x4038('0x30')](0xcc)[_0x4038('0x2a')]();});}};}function handleEntityNotFound(_0x34d73e,_0x536457){return function(_0x1f2f3e){if(!_0x1f2f3e){_0x34d73e['sendStatus'](0x194);}return _0x1f2f3e;};}function handleError(_0x4ea470,_0x25b868){_0x25b868=_0x25b868||0x1f4;return function(_0x3af177){logger[_0x4038('0x25')](_0x3af177[_0x4038('0x38')]);if(_0x3af177[_0x4038('0x39')]){delete _0x3af177[_0x4038('0x39')];}_0x4ea470['status'](_0x25b868)['send'](_0x3af177);};}exports[_0x4038('0x3a')]=function(_0x3ccafa,_0x156db7){var _0x10b508={},_0x302095={},_0x12529a={'count':0x0,'rows':[]};var _0x334332=_[_0x4038('0x3b')](db['WhatsappMessage']['rawAttributes'],function(_0x18e8de){return{'name':_0x18e8de[_0x4038('0x3c')],'type':_0x18e8de[_0x4038('0x3d')][_0x4038('0x3e')]};});_0x302095[_0x4038('0x3f')]=_[_0x4038('0x3b')](_0x334332,'name');_0x302095[_0x4038('0x40')]=_[_0x4038('0x41')](_0x3ccafa[_0x4038('0x40')]);_0x302095['filters']=_['intersection'](_0x302095['model'],_0x302095['query']);_0x10b508[_0x4038('0x42')]=_[_0x4038('0x43')](_0x302095[_0x4038('0x3f')],qs[_0x4038('0x44')](_0x3ccafa[_0x4038('0x40')][_0x4038('0x44')]));_0x10b508[_0x4038('0x42')]=_0x10b508['attributes'][_0x4038('0x45')]?_0x10b508[_0x4038('0x42')]:_0x302095[_0x4038('0x3f')];if(!_0x3ccafa[_0x4038('0x40')][_0x4038('0x46')]('nolimit')){_0x10b508[_0x4038('0x2e')]=qs[_0x4038('0x2e')](_0x3ccafa[_0x4038('0x40')][_0x4038('0x2e')]);_0x10b508[_0x4038('0x2c')]=qs[_0x4038('0x2c')](_0x3ccafa[_0x4038('0x40')][_0x4038('0x2c')]);}_0x10b508[_0x4038('0x47')]=qs[_0x4038('0x48')](_0x3ccafa[_0x4038('0x40')][_0x4038('0x48')]);_0x10b508[_0x4038('0x49')]=qs[_0x4038('0x4a')](_[_0x4038('0x4b')](_0x3ccafa[_0x4038('0x40')],_0x302095['filters']),_0x334332);if(_0x3ccafa[_0x4038('0x40')][_0x4038('0x4c')]){_0x10b508[_0x4038('0x49')]=_[_0x4038('0x4d')](_0x10b508['where'],{'$or':_[_0x4038('0x3b')](_0x334332,function(_0x14c804){if(_0x14c804['type']!==_0x4038('0x4e')){var _0x115a84={};_0x115a84[_0x14c804[_0x4038('0x39')]]={'$like':'%'+_0x3ccafa[_0x4038('0x40')]['filter']+'%'};return _0x115a84;}})});}_0x10b508=_[_0x4038('0x4d')]({},_0x10b508,_0x3ccafa['options']);var _0xb6b50d={'where':_0x10b508[_0x4038('0x49')]};return db['WhatsappMessage'][_0x4038('0x2f')](_0xb6b50d)[_0x4038('0x36')](function(_0x45e947){_0x12529a['count']=_0x45e947;if(_0x3ccafa[_0x4038('0x40')][_0x4038('0x4f')]){_0x10b508[_0x4038('0x50')]=[{'all':!![]}];}return db[_0x4038('0x51')][_0x4038('0x52')](_0x10b508);})[_0x4038('0x36')](function(_0x4dc0f7){_0x12529a[_0x4038('0x53')]=_0x4dc0f7;return _0x12529a;})[_0x4038('0x36')](respondWithFilteredResult(_0x156db7,_0x10b508))['catch'](handleError(_0x156db7,null));};exports[_0x4038('0x54')]=function(_0xedf737,_0x14737b){var _0x47bfd7={'raw':!![],'where':{'id':_0xedf737['params']['id']}},_0x5dfa35={};_0x5dfa35[_0x4038('0x3f')]=_[_0x4038('0x41')](db[_0x4038('0x51')][_0x4038('0x55')]);_0x5dfa35[_0x4038('0x40')]=_[_0x4038('0x41')](_0xedf737['query']);_0x5dfa35['filters']=_['intersection'](_0x5dfa35[_0x4038('0x3f')],_0x5dfa35['query']);_0x47bfd7['attributes']=_[_0x4038('0x43')](_0x5dfa35[_0x4038('0x3f')],qs[_0x4038('0x44')](_0xedf737[_0x4038('0x40')][_0x4038('0x44')]));_0x47bfd7['attributes']=_0x47bfd7[_0x4038('0x42')][_0x4038('0x45')]?_0x47bfd7[_0x4038('0x42')]:_0x5dfa35['model'];if(_0xedf737[_0x4038('0x40')][_0x4038('0x4f')]){_0x47bfd7[_0x4038('0x50')]=[{'all':!![]}];}_0x47bfd7=_['merge']({},_0x47bfd7,_0xedf737[_0x4038('0x56')]);return db[_0x4038('0x51')]['find'](_0x47bfd7)['then'](handleEntityNotFound(_0x14737b,null))[_0x4038('0x36')](respondWithResult(_0x14737b,null))[_0x4038('0x28')](handleError(_0x14737b,null));};exports[_0x4038('0x57')]=function(_0x861ae0,_0x265cad){return db[_0x4038('0x51')][_0x4038('0x57')](_0x861ae0[_0x4038('0x58')],{})[_0x4038('0x36')](respondWithResult(_0x265cad,0xc9))['catch'](handleError(_0x265cad,null));};exports[_0x4038('0x35')]=function(_0xad143d,_0x52c99e){if(_0xad143d[_0x4038('0x58')]['id']){delete _0xad143d[_0x4038('0x58')]['id'];}return db[_0x4038('0x51')][_0x4038('0x59')]({'where':{'id':_0xad143d[_0x4038('0x5a')]['id']}})[_0x4038('0x36')](handleEntityNotFound(_0x52c99e,null))[_0x4038('0x36')](saveUpdates(_0xad143d[_0x4038('0x58')],null))[_0x4038('0x36')](respondWithResult(_0x52c99e,null))[_0x4038('0x28')](handleError(_0x52c99e,null));};exports[_0x4038('0x37')]=function(_0xfa1676,_0x4365ad){return db[_0x4038('0x51')]['find']({'where':{'id':_0xfa1676[_0x4038('0x5a')]['id']}})[_0x4038('0x36')](handleEntityNotFound(_0x4365ad,null))[_0x4038('0x36')](removeEntity(_0x4365ad,null))[_0x4038('0x28')](handleError(_0x4365ad,null));};exports['describe']=function(_0x31966e,_0x3512a2){return db[_0x4038('0x51')]['describe']()[_0x4038('0x36')](respondWithResult(_0x3512a2,null))[_0x4038('0x28')](handleError(_0x3512a2,null));};var interaction_log=require(_0x4038('0x14'))('whatsapp-interactions');exports[_0x4038('0x5b')]=function(_0x27e528,_0x1e4ddf,_0x4e2e3){var _0x35fa2d={'agent':{},'channel':_0x4038('0x5c')};if(_0x27e528[_0x4038('0x58')]['id']){delete _0x27e528['body']['id'];}_0x27e528['body'][_0x4038('0x5d')]=!![];_0x27e528[_0x4038('0x58')][_0x4038('0x5e')]=moment()[_0x4038('0x5f')](_0x4038('0x60'));_0x27e528[_0x4038('0x58')]['UserId']=_0x27e528[_0x4038('0x58')][_0x4038('0x61')]||_0x27e528['user']['id'];_0x35fa2d['agent']['id']=_0x27e528[_0x4038('0x58')][_0x4038('0x61')];return db[_0x4038('0x51')][_0x4038('0x59')]({'where':{'id':_0x27e528[_0x4038('0x5a')]['id'],'UserId':null}})[_0x4038('0x36')](handleEntityNotFound(_0x1e4ddf,null))[_0x4038('0x36')](saveUpdates(_0x27e528[_0x4038('0x58')],null))[_0x4038('0x36')](function(_0x301ccf){if(_0x301ccf){_0x35fa2d[_0x4038('0x27')]=_0x301ccf[_0x4038('0x62')]({'plain':!![]});return db[_0x4038('0x63')]['find']({'where':{'id':_0x301ccf[_0x4038('0x64')]}});}return null;})[_0x4038('0x36')](handleEntityNotFound(_0x1e4ddf,null))['then'](function(_0x5f506c){if(_0x5f506c){return _0x5f506c[_0x4038('0x35')]({'UserId':_0x27e528[_0x4038('0x58')][_0x4038('0x61')],'read1stAt':_[_0x4038('0x65')](_0x5f506c[_0x4038('0x66')])?moment()[_0x4038('0x5f')](_0x4038('0x60')):undefined});}return null;})[_0x4038('0x36')](function(_0x496132){if(_0x496132){_0x35fa2d['interaction']=_0x496132[_0x4038('0x62')]({'plain':!![]});interaction_log[_0x4038('0x20')](_0x4038('0x67'),_0x27e528[_0x4038('0x68')]['id'],_0x27e528['user']['name'],_0x27e528[_0x4038('0x68')][_0x4038('0x69')],_0x35fa2d[_0x4038('0x6a')]['id'],_0x27e528['body']?JSON[_0x4038('0x24')](_0x27e528[_0x4038('0x58')]):_0x4038('0x6b'));return respondWithRpcPromise(_0x4038('0x6c'),_0x4038('0x6d'),_0x35fa2d);}return null;})[_0x4038('0x36')](function(_0xe5f7e9){var _0x540d5e=_0x4038('0x6e')+_0xe5f7e9['message'][_0x4038('0x6f')];return db[_0x4038('0x70')][_0x4038('0x40')](_0x540d5e,{'type':db['Sequelize'][_0x4038('0x71')][_0x4038('0x72')],'raw':!![]})[_0x4038('0x36')](function(_0xd98ee6){return _0xd98ee6;});})[_0x4038('0x36')](function(_0x900194){if(_0x900194){_0x35fa2d[_0x4038('0x27')]['contact']=_0x900194[0x0];if(!_0x27e528['body'][_0x4038('0x61')])return;return db['User'][_0x4038('0x59')]({'where':{'id':_0x27e528[_0x4038('0x58')][_0x4038('0x61')],'role':_0x4038('0x73')},'attributes':['id',_0x4038('0x39'),_0x4038('0x74'),_0x4038('0x75'),'internal'],'raw':!![]});}return null;})[_0x4038('0x36')](function(_0x59792d){if(!_0x59792d)return null;_0x35fa2d[_0x4038('0x27')][_0x4038('0x73')]=_0x59792d;return _0x35fa2d;})[_0x4038('0x36')](function(_0x3f7fe8){if(_0x3f7fe8){if(_0x27e528[_0x4038('0x58')]['manual']){_0x35fa2d[_0x4038('0x27')][_0x4038('0x76')]=util[_0x4038('0x5f')](_0x4038('0x77'),_0x27e528['user'][_0x4038('0x39')]);_0x35fa2d[_0x4038('0x27')][_0x4038('0x78')]=_0x35fa2d[_0x4038('0x78')];_0x35fa2d[_0x4038('0x27')][_0x4038('0x79')]=_0x35fa2d[_0x4038('0x78')];_0x35fa2d['message'][_0x4038('0x7a')]=_0x4038('0x5b');return respondWithRpcPromise('EventManager',_0x4038('0x7b'),{'event':_0x4038('0x7c'),'message':_0x35fa2d[_0x4038('0x27')]},client9002)[_0x4038('0x36')](function(){return _0x35fa2d;});}return _0x35fa2d;}return null;})[_0x4038('0x36')](respondWithResult(_0x1e4ddf,null))[_0x4038('0x28')](handleError(_0x1e4ddf,null));};var interaction_log=require(_0x4038('0x14'))('whatsapp-interactions');exports['reject']=function(_0x118a91,_0x2e3bc3,_0x4be990){var _0x57f5e8={'agent':{},'channel':_0x4038('0x5c')};if(_0x118a91[_0x4038('0x58')]['id']){delete _0x118a91[_0x4038('0x58')]['id'];}_0x118a91[_0x4038('0x58')][_0x4038('0x61')]=_0x118a91[_0x4038('0x58')][_0x4038('0x61')]||_0x118a91[_0x4038('0x68')]['id'];_0x57f5e8[_0x4038('0x73')]['id']=_0x118a91[_0x4038('0x58')][_0x4038('0x61')];return db[_0x4038('0x51')][_0x4038('0x59')]({'where':{'id':_0x118a91[_0x4038('0x5a')]['id'],'UserId':null}})[_0x4038('0x36')](handleEntityNotFound(_0x2e3bc3,null))[_0x4038('0x36')](function(_0xd9fb85){if(_0xd9fb85){_0x57f5e8[_0x4038('0x27')]=_0xd9fb85[_0x4038('0x62')]({'plain':!![]});return db[_0x4038('0x63')][_0x4038('0x59')]({'where':{'id':_0xd9fb85[_0x4038('0x64')]}});}return null;})[_0x4038('0x36')](handleEntityNotFound(_0x2e3bc3,null))[_0x4038('0x36')](function(_0xbbb267){if(_0xbbb267){_0x57f5e8[_0x4038('0x6a')]=_0xbbb267[_0x4038('0x62')]({'plain':!![]});interaction_log[_0x4038('0x20')](_0x4038('0x7d'),_0x118a91[_0x4038('0x68')]['id'],_0x118a91[_0x4038('0x68')][_0x4038('0x39')],_0x118a91['user'][_0x4038('0x69')],_0x57f5e8[_0x4038('0x6a')]['id'],_0x118a91[_0x4038('0x58')]?JSON[_0x4038('0x24')](_0x118a91[_0x4038('0x58')]):_0x4038('0x6b'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x57f5e8);}return null;})[_0x4038('0x36')](function(_0x50b8f7){var _0x14942=_0x4038('0x6e')+_0x50b8f7['message'][_0x4038('0x6f')];return db[_0x4038('0x70')][_0x4038('0x40')](_0x14942,{'type':db[_0x4038('0x7e')]['QueryTypes']['SELECT'],'raw':!![]})[_0x4038('0x36')](function(_0x3bd3d9){return _0x3bd3d9;});})[_0x4038('0x36')](function(_0x220372){if(_0x220372){_0x57f5e8['message'][_0x4038('0x7f')]=_0x220372[0x0];if(!_0x118a91[_0x4038('0x58')]['UserId'])return;return db[_0x4038('0x80')]['find']({'where':{'id':_0x118a91[_0x4038('0x58')]['UserId'],'role':'agent'},'attributes':['id','name',_0x4038('0x74'),_0x4038('0x75'),_0x4038('0x81')],'raw':!![]});}return null;})[_0x4038('0x36')](function(_0x37fd3e){if(!_0x37fd3e)return null;_0x57f5e8[_0x4038('0x27')][_0x4038('0x73')]=_0x37fd3e;return _0x57f5e8;})[_0x4038('0x36')](function(_0x4cf4df){if(_0x4cf4df){_0x4cf4df['message'][_0x4038('0x76')]=util['format'](_0x4038('0x77'),_0x118a91[_0x4038('0x68')][_0x4038('0x39')]);_0x4cf4df['message'][_0x4038('0x78')]=_0x57f5e8[_0x4038('0x78')];_0x4cf4df['message'][_0x4038('0x79')]=_0x57f5e8[_0x4038('0x78')];_0x4cf4df[_0x4038('0x27')][_0x4038('0x7a')]=_0x4038('0x33');respondWithRpcPromise('EventManager',_0x4038('0x7b'),{'event':'rejectmessage','message':_0x4cf4df[_0x4038('0x27')]},client9002);return _0x57f5e8;}return null;})[_0x4038('0x36')](respondWithResult(_0x2e3bc3,null))[_0x4038('0x28')](handleError(_0x2e3bc3,null));};exports[_0x4038('0x30')]=function(_0x1fb581,_0x568df3,_0x4d63d7){if(_0x1fb581[_0x4038('0x58')]['id']){delete _0x1fb581[_0x4038('0x58')]['id'];}var _0x2aa655;return db[_0x4038('0x51')]['find']({'where':{'id':_0x1fb581[_0x4038('0x5a')]['id']}})[_0x4038('0x36')](handleEntityNotFound(_0x568df3,null))[_0x4038('0x36')](function(_0x46a2ce){if(_0x46a2ce){_0x2aa655=_0x46a2ce;return db[_0x4038('0x82')][_0x4038('0x59')]({'where':{'id':_0x46a2ce[_0x4038('0x83')]}});}})[_0x4038('0x36')](handleEntityNotFound(_0x568df3,null))[_0x4038('0x36')](function(_0x26d699){if(_0x26d699){logger[_0x4038('0x22')](_0x4038('0x84'),_0x4038('0x30'),_0x4038('0x85'),_0x26d699[_0x4038('0x3d')],util['inspect'](_0x1fb581['body'],{'showHidden':![],'depth':null}));switch(_0x26d699[_0x4038('0x3d')]){case'twilio':if(_0x1fb581['body'][_0x4038('0x86')]&&_0x1fb581[_0x4038('0x58')][_0x4038('0x86')]===_0x2aa655[_0x4038('0x87')]&&_0x1fb581[_0x4038('0x58')][_0x4038('0x88')]&&_0x1fb581['body']['MessageStatus']===_0x4038('0x5d')){return _0x2aa655[_0x4038('0x35')]({'read':!![]});}else{logger[_0x4038('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4038('0x30'),_0x4038('0x89'),util[_0x4038('0x8a')](_0x1fb581[_0x4038('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x2aa655;}})['then'](respondWithResult(_0x568df3,null))[_0x4038('0x28')](handleError(_0x568df3,null));}; \ No newline at end of file +var _0xfe4e=['event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','http','request','then','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','info','request\x20sent','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','WhatsappMessage','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','type','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','format','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','contact','User','fullname','email','internal','SIP/%s','channel','motionChannel'];(function(_0x3451fc,_0x18f8fc){var _0x59c3ad=function(_0x169d6d){while(--_0x169d6d){_0x3451fc['push'](_0x3451fc['shift']());}};_0x59c3ad(++_0x18f8fc);}(_0xfe4e,0x133));var _0xefe4=function(_0x1c143e,_0x53f10c){_0x1c143e=_0x1c143e-0x0;var _0x5599de=_0xfe4e[_0x1c143e];return _0x5599de;};'use strict';var emlformat=require(_0xefe4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefe4('0x1'));var jsonpatch=require(_0xefe4('0x2'));var rp=require(_0xefe4('0x3'));var moment=require('moment');var BPromise=require(_0xefe4('0x4'));var Mustache=require(_0xefe4('0x5'));var util=require(_0xefe4('0x6'));var path=require(_0xefe4('0x7'));var sox=require(_0xefe4('0x8'));var csv=require('to-csv');var ejs=require(_0xefe4('0x9'));var fs=require('fs');var fs_extra=require(_0xefe4('0xa'));var _=require(_0xefe4('0xb'));var squel=require(_0xefe4('0xc'));var crypto=require(_0xefe4('0xd'));var jsforce=require(_0xefe4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xefe4('0xf'));var querystring=require(_0xefe4('0x10'));var Papa=require('papaparse');var Redis=require(_0xefe4('0x11'));var authService=require(_0xefe4('0x12'));var qs=require(_0xefe4('0x13'));var as=require(_0xefe4('0x14'));var hardwareService=require(_0xefe4('0x15'));var logger=require('../../config/logger')(_0xefe4('0x16'));var utils=require(_0xefe4('0x17'));var config=require(_0xefe4('0x18'));var licenseUtil=require(_0xefe4('0x19'));var db=require('../../mysqldb')['db'];config[_0xefe4('0x1a')]=_['defaults'](config['redis'],{'host':_0xefe4('0x1b'),'port':0x18eb});var socket=require(_0xefe4('0x1c'))(new Redis(config['redis']));require(_0xefe4('0x1d'))[_0xefe4('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xefe4('0x1f')][_0xefe4('0x20')]({'port':0x232c});var client9002=jayson[_0xefe4('0x1f')][_0xefe4('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x20e463,_0x161cd2,_0x798877,_0x486116){return new BPromise(function(_0x5c3120,_0xef9238){var _0x3b6f27=_0x486116||client;return _0x3b6f27[_0xefe4('0x21')](_0x20e463,_0x798877)[_0xefe4('0x22')](function(_0x561ac5){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x161cd2,'request\x20sent');logger[_0xefe4('0x23')](_0xefe4('0x24'),_0x161cd2,'request\x20sent',JSON[_0xefe4('0x25')](_0x561ac5));if(_0x561ac5[_0xefe4('0x26')]){if(_0x561ac5['error'][_0xefe4('0x27')]===0x1f4){logger[_0xefe4('0x26')](_0xefe4('0x28'),_0x161cd2,_0x561ac5[_0xefe4('0x26')]['message']);return _0xef9238(_0x561ac5[_0xefe4('0x26')][_0xefe4('0x29')]);}logger[_0xefe4('0x26')](_0xefe4('0x28'),_0x161cd2,_0x561ac5[_0xefe4('0x26')][_0xefe4('0x29')]);return _0x5c3120(_0x561ac5[_0xefe4('0x26')][_0xefe4('0x29')]);}else{logger[_0xefe4('0x2a')](_0xefe4('0x28'),_0x161cd2,_0xefe4('0x2b'));_0x5c3120(_0x561ac5['result'][_0xefe4('0x29')]);}})[_0xefe4('0x2c')](function(_0x4a512e){logger[_0xefe4('0x26')](_0xefe4('0x28'),_0x161cd2,_0x4a512e);_0xef9238(_0x4a512e);});});}function respondWithStatusCode(_0x1c6a0a,_0x44530c){_0x44530c=_0x44530c||0xcc;return function(_0x391666){if(_0x391666){return _0x1c6a0a[_0xefe4('0x2d')](_0x44530c);}return _0x1c6a0a[_0xefe4('0x2e')](_0x44530c)[_0xefe4('0x2f')]();};}function respondWithResult(_0x1187f8,_0xa4e9c7){_0xa4e9c7=_0xa4e9c7||0xc8;return function(_0x3ef7d0){if(_0x3ef7d0){return _0x1187f8[_0xefe4('0x2e')](_0xa4e9c7)[_0xefe4('0x30')](_0x3ef7d0);}};}function respondWithFilteredResult(_0x22d301,_0x2dd79d){return function(_0x13820a){if(_0x13820a){var _0x3d3640=typeof _0x2dd79d[_0xefe4('0x31')]===_0xefe4('0x32')&&typeof _0x2dd79d[_0xefe4('0x33')]==='undefined';var _0x529152=_0x13820a[_0xefe4('0x34')];var _0x1494ee=_0x3d3640?0x0:_0x2dd79d[_0xefe4('0x31')];var _0x3b2005=_0x3d3640?_0x13820a['count']:_0x2dd79d[_0xefe4('0x31')]+_0x2dd79d[_0xefe4('0x33')];var _0x432a65;if(_0x3b2005>=_0x529152){_0x3b2005=_0x529152;_0x432a65=0xc8;}else{_0x432a65=0xce;}_0x22d301['status'](_0x432a65);return _0x22d301[_0xefe4('0x35')](_0xefe4('0x36'),_0x1494ee+'-'+_0x3b2005+'/'+_0x529152)[_0xefe4('0x30')](_0x13820a);}return null;};}function patchUpdates(_0x57c8c3){return function(_0x4acd14){try{jsonpatch[_0xefe4('0x37')](_0x4acd14,_0x57c8c3,!![]);}catch(_0x4f7436){return BPromise[_0xefe4('0x38')](_0x4f7436);}return _0x4acd14[_0xefe4('0x39')]();};}function saveUpdates(_0x4ae056,_0x4548db){return function(_0x29d0c9){if(_0x29d0c9){return _0x29d0c9[_0xefe4('0x3a')](_0x4ae056)[_0xefe4('0x22')](function(_0x20d321){return _0x20d321;});}return null;};}function removeEntity(_0x1b51e6,_0xaf2997){return function(_0x2da17a){if(_0x2da17a){return _0x2da17a[_0xefe4('0x3b')]()[_0xefe4('0x22')](function(){_0x1b51e6[_0xefe4('0x2e')](0xcc)[_0xefe4('0x2f')]();});}};}function handleEntityNotFound(_0x271a6c,_0x4467c8){return function(_0x4a8351){if(!_0x4a8351){_0x271a6c['sendStatus'](0x194);}return _0x4a8351;};}function handleError(_0x4a3e91,_0x4cc336){_0x4cc336=_0x4cc336||0x1f4;return function(_0x115291){logger[_0xefe4('0x26')](_0x115291[_0xefe4('0x3c')]);if(_0x115291['name']){delete _0x115291[_0xefe4('0x3d')];}_0x4a3e91[_0xefe4('0x2e')](_0x4cc336)[_0xefe4('0x3e')](_0x115291);};}exports[_0xefe4('0x3f')]=function(_0x2c2d44,_0x38452a){var _0x3be5c2={},_0x1b0957={},_0x35178a={'count':0x0,'rows':[]};var _0x1a5e65=_['map'](db[_0xefe4('0x40')]['rawAttributes'],function(_0x55f2c0){return{'name':_0x55f2c0[_0xefe4('0x41')],'type':_0x55f2c0['type'][_0xefe4('0x42')]};});_0x1b0957[_0xefe4('0x43')]=_['map'](_0x1a5e65,_0xefe4('0x3d'));_0x1b0957['query']=_[_0xefe4('0x44')](_0x2c2d44[_0xefe4('0x45')]);_0x1b0957[_0xefe4('0x46')]=_[_0xefe4('0x47')](_0x1b0957[_0xefe4('0x43')],_0x1b0957['query']);_0x3be5c2[_0xefe4('0x48')]=_[_0xefe4('0x47')](_0x1b0957[_0xefe4('0x43')],qs[_0xefe4('0x49')](_0x2c2d44[_0xefe4('0x45')][_0xefe4('0x49')]));_0x3be5c2[_0xefe4('0x48')]=_0x3be5c2[_0xefe4('0x48')][_0xefe4('0x4a')]?_0x3be5c2[_0xefe4('0x48')]:_0x1b0957[_0xefe4('0x43')];if(!_0x2c2d44[_0xefe4('0x45')][_0xefe4('0x4b')](_0xefe4('0x4c'))){_0x3be5c2[_0xefe4('0x33')]=qs['limit'](_0x2c2d44[_0xefe4('0x45')]['limit']);_0x3be5c2[_0xefe4('0x31')]=qs[_0xefe4('0x31')](_0x2c2d44[_0xefe4('0x45')]['offset']);}_0x3be5c2['order']=qs[_0xefe4('0x4d')](_0x2c2d44[_0xefe4('0x45')][_0xefe4('0x4d')]);_0x3be5c2['where']=qs['filters'](_[_0xefe4('0x4e')](_0x2c2d44[_0xefe4('0x45')],_0x1b0957[_0xefe4('0x46')]),_0x1a5e65);if(_0x2c2d44[_0xefe4('0x45')][_0xefe4('0x4f')]){_0x3be5c2[_0xefe4('0x50')]=_[_0xefe4('0x51')](_0x3be5c2[_0xefe4('0x50')],{'$or':_[_0xefe4('0x52')](_0x1a5e65,function(_0x227e84){if(_0x227e84[_0xefe4('0x53')]!==_0xefe4('0x54')){var _0x18b91f={};_0x18b91f[_0x227e84[_0xefe4('0x3d')]]={'$like':'%'+_0x2c2d44['query'][_0xefe4('0x4f')]+'%'};return _0x18b91f;}})});}_0x3be5c2=_[_0xefe4('0x51')]({},_0x3be5c2,_0x2c2d44['options']);var _0x1ddd30={'where':_0x3be5c2[_0xefe4('0x50')]};return db[_0xefe4('0x40')][_0xefe4('0x34')](_0x1ddd30)[_0xefe4('0x22')](function(_0x2379aa){_0x35178a[_0xefe4('0x34')]=_0x2379aa;if(_0x2c2d44[_0xefe4('0x45')][_0xefe4('0x55')]){_0x3be5c2[_0xefe4('0x56')]=[{'all':!![]}];}return db[_0xefe4('0x40')][_0xefe4('0x57')](_0x3be5c2);})[_0xefe4('0x22')](function(_0x8d135a){_0x35178a[_0xefe4('0x58')]=_0x8d135a;return _0x35178a;})[_0xefe4('0x22')](respondWithFilteredResult(_0x38452a,_0x3be5c2))['catch'](handleError(_0x38452a,null));};exports[_0xefe4('0x59')]=function(_0x1af008,_0x305a8b){var _0x298725={'raw':!![],'where':{'id':_0x1af008[_0xefe4('0x5a')]['id']}},_0x2e7e03={};_0x2e7e03[_0xefe4('0x43')]=_[_0xefe4('0x44')](db['WhatsappMessage'][_0xefe4('0x5b')]);_0x2e7e03[_0xefe4('0x45')]=_[_0xefe4('0x44')](_0x1af008[_0xefe4('0x45')]);_0x2e7e03[_0xefe4('0x46')]=_[_0xefe4('0x47')](_0x2e7e03['model'],_0x2e7e03[_0xefe4('0x45')]);_0x298725[_0xefe4('0x48')]=_['intersection'](_0x2e7e03['model'],qs[_0xefe4('0x49')](_0x1af008[_0xefe4('0x45')]['fields']));_0x298725['attributes']=_0x298725[_0xefe4('0x48')]['length']?_0x298725['attributes']:_0x2e7e03[_0xefe4('0x43')];if(_0x1af008[_0xefe4('0x45')][_0xefe4('0x55')]){_0x298725['include']=[{'all':!![]}];}_0x298725=_['merge']({},_0x298725,_0x1af008[_0xefe4('0x5c')]);return db[_0xefe4('0x40')][_0xefe4('0x5d')](_0x298725)[_0xefe4('0x22')](handleEntityNotFound(_0x305a8b,null))[_0xefe4('0x22')](respondWithResult(_0x305a8b,null))[_0xefe4('0x2c')](handleError(_0x305a8b,null));};exports[_0xefe4('0x5e')]=function(_0x2c13dd,_0xc46e2e){return db['WhatsappMessage']['create'](_0x2c13dd[_0xefe4('0x5f')],{})[_0xefe4('0x22')](respondWithResult(_0xc46e2e,0xc9))['catch'](handleError(_0xc46e2e,null));};exports[_0xefe4('0x3a')]=function(_0x406b2e,_0x5d7e9a){if(_0x406b2e['body']['id']){delete _0x406b2e[_0xefe4('0x5f')]['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x406b2e[_0xefe4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5d7e9a,null))['then'](saveUpdates(_0x406b2e[_0xefe4('0x5f')],null))[_0xefe4('0x22')](respondWithResult(_0x5d7e9a,null))[_0xefe4('0x2c')](handleError(_0x5d7e9a,null));};exports[_0xefe4('0x3b')]=function(_0x215d9a,_0x1ffbba){return db['WhatsappMessage'][_0xefe4('0x5d')]({'where':{'id':_0x215d9a[_0xefe4('0x5a')]['id']}})[_0xefe4('0x22')](handleEntityNotFound(_0x1ffbba,null))[_0xefe4('0x22')](removeEntity(_0x1ffbba,null))['catch'](handleError(_0x1ffbba,null));};exports[_0xefe4('0x60')]=function(_0x4c0dda,_0x48ca37){return db[_0xefe4('0x40')][_0xefe4('0x60')]()['then'](respondWithResult(_0x48ca37,null))[_0xefe4('0x2c')](handleError(_0x48ca37,null));};var interaction_log=require(_0xefe4('0x61'))(_0xefe4('0x62'));exports[_0xefe4('0x63')]=function(_0x5e7f8f,_0x46ae1,_0x34df98){var _0x260915={'agent':{},'channel':_0xefe4('0x64')};if(_0x5e7f8f[_0xefe4('0x5f')]['id']){delete _0x5e7f8f[_0xefe4('0x5f')]['id'];}_0x5e7f8f[_0xefe4('0x5f')]['read']=!![];_0x5e7f8f['body']['readAt']=moment()[_0xefe4('0x65')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e7f8f[_0xefe4('0x5f')]['UserId']=_0x5e7f8f[_0xefe4('0x5f')][_0xefe4('0x66')]||_0x5e7f8f['user']['id'];_0x260915[_0xefe4('0x67')]['id']=_0x5e7f8f['body'][_0xefe4('0x66')];return db[_0xefe4('0x40')][_0xefe4('0x5d')]({'where':{'id':_0x5e7f8f[_0xefe4('0x5a')]['id'],'UserId':null}})[_0xefe4('0x22')](handleEntityNotFound(_0x46ae1,null))[_0xefe4('0x22')](saveUpdates(_0x5e7f8f[_0xefe4('0x5f')],null))[_0xefe4('0x22')](function(_0x509948){if(_0x509948){_0x260915[_0xefe4('0x29')]=_0x509948[_0xefe4('0x68')]({'plain':!![]});return db[_0xefe4('0x69')][_0xefe4('0x5d')]({'where':{'id':_0x509948[_0xefe4('0x6a')]}});}return null;})[_0xefe4('0x22')](handleEntityNotFound(_0x46ae1,null))[_0xefe4('0x22')](function(_0x192a07){if(_0x192a07){return _0x192a07[_0xefe4('0x3a')]({'UserId':_0x5e7f8f[_0xefe4('0x5f')][_0xefe4('0x66')],'read1stAt':_[_0xefe4('0x6b')](_0x192a07['read1stAt'])?moment()[_0xefe4('0x65')](_0xefe4('0x6c')):undefined});}return null;})['then'](function(_0x1dd665){if(_0x1dd665){_0x260915[_0xefe4('0x6d')]=_0x1dd665[_0xefe4('0x68')]({'plain':!![]});interaction_log['info'](_0xefe4('0x6e'),_0x5e7f8f['user']['id'],_0x5e7f8f[_0xefe4('0x6f')][_0xefe4('0x3d')],_0x5e7f8f['user'][_0xefe4('0x70')],_0x260915[_0xefe4('0x6d')]['id'],_0x5e7f8f[_0xefe4('0x5f')]?JSON['stringify'](_0x5e7f8f[_0xefe4('0x5f')]):_0xefe4('0x71'));return respondWithRpcPromise(_0xefe4('0x72'),_0xefe4('0x73'),_0x260915);}return null;})[_0xefe4('0x22')](function(_0x463811){var _0x3679d2=_0xefe4('0x74')+_0x463811['message'][_0xefe4('0x75')];return db[_0xefe4('0x76')]['query'](_0x3679d2,{'type':db[_0xefe4('0x77')]['QueryTypes']['SELECT'],'raw':!![]})[_0xefe4('0x22')](function(_0x5a79f4){return _0x5a79f4;});})[_0xefe4('0x22')](function(_0x1715f9){if(_0x1715f9){_0x260915['message'][_0xefe4('0x78')]=_0x1715f9[0x0];if(!_0x5e7f8f[_0xefe4('0x5f')]['UserId'])return;return db[_0xefe4('0x79')][_0xefe4('0x5d')]({'where':{'id':_0x5e7f8f[_0xefe4('0x5f')][_0xefe4('0x66')],'role':_0xefe4('0x67')},'attributes':['id',_0xefe4('0x3d'),_0xefe4('0x7a'),_0xefe4('0x7b'),_0xefe4('0x7c')],'raw':!![]});}return null;})['then'](function(_0x5907ef){if(!_0x5907ef)return null;_0x260915[_0xefe4('0x29')][_0xefe4('0x67')]=_0x5907ef;return _0x260915;})[_0xefe4('0x22')](function(_0x134995){if(_0x134995){if(_0x5e7f8f['body']['manual']){_0x260915[_0xefe4('0x29')]['interface']=util['format'](_0xefe4('0x7d'),_0x5e7f8f[_0xefe4('0x6f')][_0xefe4('0x3d')]);_0x260915[_0xefe4('0x29')][_0xefe4('0x7e')]=_0x260915['channel'];_0x260915['message'][_0xefe4('0x7f')]=_0x260915[_0xefe4('0x7e')];_0x260915[_0xefe4('0x29')][_0xefe4('0x80')]='accept';return respondWithRpcPromise(_0xefe4('0x81'),'EventManager',{'event':_0xefe4('0x82'),'message':_0x260915[_0xefe4('0x29')]},client9002)[_0xefe4('0x22')](function(){return _0x260915;});}return _0x260915;}return null;})[_0xefe4('0x22')](respondWithResult(_0x46ae1,null))[_0xefe4('0x2c')](handleError(_0x46ae1,null));};var interaction_log=require(_0xefe4('0x61'))(_0xefe4('0x62'));exports['reject']=function(_0x1e8c30,_0x364e5,_0x4affbf){var _0x51a042={'agent':{},'channel':_0xefe4('0x64')};if(_0x1e8c30[_0xefe4('0x5f')]['id']){delete _0x1e8c30[_0xefe4('0x5f')]['id'];}_0x1e8c30[_0xefe4('0x5f')][_0xefe4('0x66')]=_0x1e8c30[_0xefe4('0x5f')][_0xefe4('0x66')]||_0x1e8c30[_0xefe4('0x6f')]['id'];_0x51a042['agent']['id']=_0x1e8c30[_0xefe4('0x5f')]['UserId'];return db['WhatsappMessage'][_0xefe4('0x5d')]({'where':{'id':_0x1e8c30[_0xefe4('0x5a')]['id'],'UserId':null}})[_0xefe4('0x22')](handleEntityNotFound(_0x364e5,null))[_0xefe4('0x22')](function(_0x13bd76){if(_0x13bd76){_0x51a042['message']=_0x13bd76[_0xefe4('0x68')]({'plain':!![]});return db[_0xefe4('0x69')][_0xefe4('0x5d')]({'where':{'id':_0x13bd76[_0xefe4('0x6a')]}});}return null;})[_0xefe4('0x22')](handleEntityNotFound(_0x364e5,null))[_0xefe4('0x22')](function(_0x5b47d0){if(_0x5b47d0){_0x51a042[_0xefe4('0x6d')]=_0x5b47d0[_0xefe4('0x68')]({'plain':!![]});interaction_log[_0xefe4('0x2a')](_0xefe4('0x83'),_0x1e8c30[_0xefe4('0x6f')]['id'],_0x1e8c30[_0xefe4('0x6f')]['name'],_0x1e8c30['user'][_0xefe4('0x70')],_0x51a042['interaction']['id'],_0x1e8c30['body']?JSON[_0xefe4('0x25')](_0x1e8c30[_0xefe4('0x5f')]):_0xefe4('0x71'));return respondWithRpcPromise(_0xefe4('0x84'),_0xefe4('0x85'),_0x51a042);}return null;})[_0xefe4('0x22')](function(_0x10499f){var _0xe72e8=_0xefe4('0x74')+_0x10499f['message'][_0xefe4('0x75')];return db['sequelize'][_0xefe4('0x45')](_0xe72e8,{'type':db[_0xefe4('0x77')]['QueryTypes'][_0xefe4('0x86')],'raw':!![]})[_0xefe4('0x22')](function(_0x58f964){return _0x58f964;});})[_0xefe4('0x22')](function(_0x5d8a35){if(_0x5d8a35){_0x51a042['message'][_0xefe4('0x78')]=_0x5d8a35[0x0];if(!_0x1e8c30['body'][_0xefe4('0x66')])return;return db['User'][_0xefe4('0x5d')]({'where':{'id':_0x1e8c30['body'][_0xefe4('0x66')],'role':'agent'},'attributes':['id','name','fullname','email',_0xefe4('0x7c')],'raw':!![]});}return null;})[_0xefe4('0x22')](function(_0x46d79b){if(!_0x46d79b)return null;_0x51a042[_0xefe4('0x29')]['agent']=_0x46d79b;return _0x51a042;})[_0xefe4('0x22')](function(_0x49b5be){if(_0x49b5be){_0x49b5be['message']['interface']=util[_0xefe4('0x65')]('SIP/%s',_0x1e8c30[_0xefe4('0x6f')][_0xefe4('0x3d')]);_0x49b5be[_0xefe4('0x29')]['channel']=_0x51a042[_0xefe4('0x7e')];_0x49b5be[_0xefe4('0x29')][_0xefe4('0x7f')]=_0x51a042[_0xefe4('0x7e')];_0x49b5be[_0xefe4('0x29')][_0xefe4('0x80')]=_0xefe4('0x38');respondWithRpcPromise(_0xefe4('0x81'),_0xefe4('0x81'),{'event':_0xefe4('0x87'),'message':_0x49b5be[_0xefe4('0x29')]},client9002);return _0x51a042;}return null;})[_0xefe4('0x22')](respondWithResult(_0x364e5,null))[_0xefe4('0x2c')](handleError(_0x364e5,null));};exports[_0xefe4('0x2e')]=function(_0x41dc68,_0x300cd1,_0xe0484c){if(_0x41dc68[_0xefe4('0x5f')]['id']){delete _0x41dc68[_0xefe4('0x5f')]['id'];}var _0x1ede67;return db['WhatsappMessage'][_0xefe4('0x5d')]({'where':{'id':_0x41dc68[_0xefe4('0x5a')]['id']}})['then'](handleEntityNotFound(_0x300cd1,null))[_0xefe4('0x22')](function(_0xb2c6a8){if(_0xb2c6a8){_0x1ede67=_0xb2c6a8;return db[_0xefe4('0x88')][_0xefe4('0x5d')]({'where':{'id':_0xb2c6a8['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x300cd1,null))['then'](function(_0x346aff){if(_0x346aff){logger['debug'](_0xefe4('0x89'),_0xefe4('0x2e'),'received\x20delivery\x20report\x20from',_0x346aff[_0xefe4('0x53')],util[_0xefe4('0x8a')](_0x41dc68[_0xefe4('0x5f')],{'showHidden':![],'depth':null}));switch(_0x346aff[_0xefe4('0x53')]){case'twilio':if(_0x41dc68['body'][_0xefe4('0x8b')]&&_0x41dc68[_0xefe4('0x5f')][_0xefe4('0x8b')]===_0x1ede67[_0xefe4('0x8c')]&&_0x41dc68['body']['MessageStatus']&&_0x41dc68['body'][_0xefe4('0x8d')]===_0xefe4('0x8e')){return _0x1ede67['update']({'read':!![]});}else{logger[_0xefe4('0x26')](_0xefe4('0x8f'),_0xefe4('0x2e'),_0xefe4('0x90'),util[_0xefe4('0x8a')](_0x41dc68['body'],{'showHidden':![],'depth':null}));}break;}return _0x1ede67;}})[_0xefe4('0x22')](respondWithResult(_0x300cd1,null))[_0xefe4('0x2c')](handleError(_0x300cd1,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index d6d6417..d66ce6a 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 _0x96cc=['remove','emit','hook','exports','events','WhatsappMessage','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96cc,0x16c));var _0xc96c=function(_0x3911a0,_0x399077){_0x3911a0=_0x3911a0-0x0;var _0xf3dd14=_0x96cc[_0x3911a0];return _0xf3dd14;};'use strict';var EventEmitter=require(_0xc96c('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xc96c('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc96c('0x2'),'afterUpdate':_0xc96c('0x3'),'afterDestroy':_0xc96c('0x4')};function emitEvent(_0x421701){return function(_0x71140d,_0x29b6f1,_0x377e6c){WhatsappMessageEvents[_0xc96c('0x5')](_0x421701+':'+_0x71140d['id'],_0x71140d);WhatsappMessageEvents[_0xc96c('0x5')](_0x421701,_0x71140d);_0x377e6c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0xc96c('0x6')](e,emitEvent(event));}}module[_0xc96c('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0x6cb4=['update','remove','emit','hook','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x492666,_0x521f93){var _0x34bf6b=function(_0x1aedf7){while(--_0x1aedf7){_0x492666['push'](_0x492666['shift']());}};_0x34bf6b(++_0x521f93);}(_0x6cb4,0xff));var _0x46cb=function(_0x320f63,_0x1fc6ea){_0x320f63=_0x320f63-0x0;var _0x74fcde=_0x6cb4[_0x320f63];return _0x74fcde;};'use strict';var EventEmitter=require(_0x46cb('0x0'));var WhatsappMessage=require(_0x46cb('0x1'))['db'][_0x46cb('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x46cb('0x3')](0x0);var events={'afterCreate':_0x46cb('0x4'),'afterUpdate':_0x46cb('0x5'),'afterDestroy':_0x46cb('0x6')};function emitEvent(_0x786ab7){return function(_0x2efd19,_0x5032a4,_0x1a3fe4){WhatsappMessageEvents['emit'](_0x786ab7+':'+_0x2efd19['id'],_0x2efd19);WhatsappMessageEvents[_0x46cb('0x7')](_0x786ab7,_0x2efd19);_0x1a3fe4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x46cb('0x8')](e,emitEvent(event));}}module[_0x46cb('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 5c75d4e..72782ea 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 _0xd5dd=['catch','error','WhatsappAccount','WhatsappAccountId','twilio','accountSid','authToken','messages','create','whatsapp:','phone','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','lodash','util','../../config/logger','api','path','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt'];(function(_0x320b9e,_0x1f892f){var _0x5e4416=function(_0x160fcc){while(--_0x160fcc){_0x320b9e['push'](_0x320b9e['shift']());}};_0x5e4416(++_0x1f892f);}(_0xd5dd,0xd4));var _0xdd5d=function(_0x207816,_0x40b96b){_0x207816=_0x207816-0x0;var _0x158fa7=_0xd5dd[_0x207816];return _0x158fa7;};'use strict';var _=require(_0xdd5d('0x0'));var util=require(_0xdd5d('0x1'));var logger=require(_0xdd5d('0x2'))(_0xdd5d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd5d('0x4'));var rimraf=require('rimraf');var config=require(_0xdd5d('0x5'));var attributes=require(_0xdd5d('0x6'));module[_0xdd5d('0x7')]=function(_0xdc772,_0x1eb977){return _0xdc772['define'](_0xdd5d('0x8'),attributes,{'tableName':_0xdd5d('0x9'),'paranoid':![],'indexes':[{'name':_0xdd5d('0xa'),'fields':['messageId']},{'name':_0xdd5d('0xb'),'fields':[_0xdd5d('0xc')],'type':_0xdd5d('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57ddd2,_0x26bc27,_0xdb1709){var _0x26cb72=_0xdc772[_0xdd5d('0xe')];var _0x4c3af0=_0x57ddd2[_0xdd5d('0xf')]({'plain':!![]});if(_0x4c3af0[_0xdd5d('0x10')][_0xdd5d('0x11')]()==='in'||_0x4c3af0['direction'][_0xdd5d('0x11')]()===_0xdd5d('0x12')&&!_0x4c3af0[_0xdd5d('0x13')]&&!_[_0xdd5d('0x14')](_0x4c3af0[_0xdd5d('0x15')])){_0x26cb72[_0xdd5d('0x16')][_0xdd5d('0x17')]({'where':{'id':_0x4c3af0[_0xdd5d('0x18')]}})[_0xdd5d('0x19')](function(_0x5af584){if(_0x5af584){_0x5af584[_0xdd5d('0x1a')]({'lastMsgAt':_0x4c3af0[_0xdd5d('0x1b')],'lastMsgDirection':_0x4c3af0[_0xdd5d('0x10')]['toLowerCase']()});}})[_0xdd5d('0x1c')](function(_0x14e896){console[_0xdd5d('0x1d')](_0x14e896);});}if(_0x4c3af0[_0xdd5d('0x10')]===_0xdd5d('0x12')&&!_0x4c3af0[_0xdd5d('0x13')]){var _0x1a6be9;_0x26cb72[_0xdd5d('0x1e')]['find']({'where':{'id':_0x4c3af0[_0xdd5d('0x1f')]},'raw':!![]})[_0xdd5d('0x19')](function(_0x217916){_0x1a6be9=_0x217916;if(_0x1a6be9&&_0x1a6be9['type']){switch(_0x1a6be9['type']){case _0xdd5d('0x20'):var _0x57f94b=require(_0xdd5d('0x20'));if(_0x1a6be9[_0xdd5d('0x21')]&&_0x1a6be9[_0xdd5d('0x22')]&&_0x1a6be9['phone']){var _0x4caf9a=new _0x57f94b(_0x1a6be9[_0xdd5d('0x21')],_0x1a6be9[_0xdd5d('0x22')]);_0x4caf9a[_0xdd5d('0x23')][_0xdd5d('0x24')]({'body':_0x4c3af0[_0xdd5d('0xc')],'to':_0xdd5d('0x25')+_0x4c3af0['phone'],'from':_0xdd5d('0x25')+_0x1a6be9[_0xdd5d('0x26')],'statusCallback':_0x1a6be9[_0xdd5d('0x27')]+'/api/whatsapp/messages/'+_0x4c3af0['id']+_0xdd5d('0x28')+_0x1a6be9[_0xdd5d('0x29')]})['then'](function(_0x5f5594){if(_0x5f5594[_0xdd5d('0x2a')]){return _0x57ddd2[_0xdd5d('0x1a')]({'messageId':_0x5f5594[_0xdd5d('0x2a')]});}})['catch'](function(_0x16911f){logger[_0xdd5d('0x1d')](_0xdd5d('0x2b'),_0xdd5d('0x2c'),_0xdd5d('0x20'),util['inspect'](_0x16911f,{'showHidden':![],'depth':null}));});}else{logger[_0xdd5d('0x1d')](_0xdd5d('0x2b'),'afterCreate',_0xdd5d('0x20'),_0xdd5d('0x2d'));}break;}}})[_0xdd5d('0x2e')](function(){_0xdb1709();});}else{_0xdb1709();}}},'charset':_0xdd5d('0x2f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbb95=['utf8mb4_unicode_ci','lodash','util','moment','bluebird','path','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','toLowerCase','direction','out','secret','isNil','UserId','WhatsappInteractionId','then','createdAt','catch','error','find','type','twilio','accountSid','authToken','phone','create','whatsapp:','remote','/status?token=','update','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken'];(function(_0x44159d,_0x490831){var _0x4e1d55=function(_0x34ddc4){while(--_0x34ddc4){_0x44159d['push'](_0x44159d['shift']());}};_0x4e1d55(++_0x490831);}(_0xbb95,0x7f));var _0x5bb9=function(_0x5c0493,_0x4c482){_0x5c0493=_0x5c0493-0x0;var _0x103748=_0xbb95[_0x5c0493];return _0x103748;};'use strict';var _=require(_0x5bb9('0x0'));var util=require(_0x5bb9('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5bb9('0x2'));var BPromise=require(_0x5bb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5bb9('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappMessage.attributes');module[_0x5bb9('0x5')]=function(_0x2b72aa,_0x49b590){return _0x2b72aa[_0x5bb9('0x6')](_0x5bb9('0x7'),attributes,{'tableName':_0x5bb9('0x8'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x5bb9('0x9')]},{'name':_0x5bb9('0xa'),'fields':[_0x5bb9('0xb')],'type':_0x5bb9('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a3d2,_0x7ee825,_0x132c5b){var _0x11ee83=_0x2b72aa[_0x5bb9('0xd')];var _0x1e00b4=_0x2a3d2['get']({'plain':!![]});if(_0x1e00b4['direction'][_0x5bb9('0xe')]()==='in'||_0x1e00b4[_0x5bb9('0xf')][_0x5bb9('0xe')]()===_0x5bb9('0x10')&&!_0x1e00b4[_0x5bb9('0x11')]&&!_[_0x5bb9('0x12')](_0x1e00b4[_0x5bb9('0x13')])){_0x11ee83['WhatsappInteraction']['findOne']({'where':{'id':_0x1e00b4[_0x5bb9('0x14')]}})[_0x5bb9('0x15')](function(_0x1ebea3){if(_0x1ebea3){_0x1ebea3['update']({'lastMsgAt':_0x1e00b4[_0x5bb9('0x16')],'lastMsgDirection':_0x1e00b4[_0x5bb9('0xf')]['toLowerCase']()});}})[_0x5bb9('0x17')](function(_0x29b45c){console[_0x5bb9('0x18')](_0x29b45c);});}if(_0x1e00b4[_0x5bb9('0xf')]===_0x5bb9('0x10')&&!_0x1e00b4[_0x5bb9('0x11')]){var _0x3b9f3c;_0x11ee83['WhatsappAccount'][_0x5bb9('0x19')]({'where':{'id':_0x1e00b4['WhatsappAccountId']},'raw':!![]})[_0x5bb9('0x15')](function(_0x54dcd4){_0x3b9f3c=_0x54dcd4;if(_0x3b9f3c&&_0x3b9f3c[_0x5bb9('0x1a')]){switch(_0x3b9f3c['type']){case _0x5bb9('0x1b'):var _0x1c9b29=require(_0x5bb9('0x1b'));if(_0x3b9f3c[_0x5bb9('0x1c')]&&_0x3b9f3c[_0x5bb9('0x1d')]&&_0x3b9f3c[_0x5bb9('0x1e')]){var _0x419f27=new _0x1c9b29(_0x3b9f3c[_0x5bb9('0x1c')],_0x3b9f3c[_0x5bb9('0x1d')]);_0x419f27['messages'][_0x5bb9('0x1f')]({'body':_0x1e00b4['body'],'to':_0x5bb9('0x20')+_0x1e00b4[_0x5bb9('0x1e')],'from':'whatsapp:'+_0x3b9f3c[_0x5bb9('0x1e')],'statusCallback':_0x3b9f3c[_0x5bb9('0x21')]+'/api/whatsapp/messages/'+_0x1e00b4['id']+_0x5bb9('0x22')+_0x3b9f3c['token']})[_0x5bb9('0x15')](function(_0x4db9ae){if(_0x4db9ae['sid']){return _0x2a3d2[_0x5bb9('0x23')]({'messageId':_0x4db9ae[_0x5bb9('0x24')]});}})[_0x5bb9('0x17')](function(_0x318c7){logger[_0x5bb9('0x18')](_0x5bb9('0x25'),_0x5bb9('0x26'),'twilio',util[_0x5bb9('0x27')](_0x318c7,{'showHidden':![],'depth':null}));});}else{logger[_0x5bb9('0x18')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5bb9('0x26'),_0x5bb9('0x1b'),_0x5bb9('0x28'));}break;}}})['finally'](function(){_0x132c5b();});}else{_0x132c5b();}}},'charset':'utf8mb4','collate':_0x5bb9('0x29')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 0f56e5d..dea46ee 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 _0xdc2b=['create','body','options','raw','then','stringify','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage'];(function(_0x10508d,_0x196fe8){var _0xee9d47=function(_0x4ac499){while(--_0x4ac499){_0x10508d['push'](_0x10508d['shift']());}};_0xee9d47(++_0x196fe8);}(_0xdc2b,0x1e6));var _0xbdc2=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xdc2b[_0x1beef3];return _0x5af964;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbdc2('0x0'));var BPromise=require('bluebird');var rs=require(_0xbdc2('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbdc2('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdc2('0x3'))(_0xbdc2('0x4'));var config=require(_0xbdc2('0x5'));var jayson=require(_0xbdc2('0x6'));var client=jayson[_0xbdc2('0x7')][_0xbdc2('0x8')]({'port':0x232a});config['redis']=_[_0xbdc2('0x9')](config['redis'],{'host':_0xbdc2('0xa'),'port':0x18eb});var socket=require(_0xbdc2('0xb'))(new Redis(config['redis']));require(_0xbdc2('0xc'))[_0xbdc2('0xd')](socket);function respondWithRpcPromise(_0x15c84a,_0x3d2a0d,_0x2efeb0){return new BPromise(function(_0x410913,_0x3410ea){return client['request'](_0x15c84a,_0x2efeb0)['then'](function(_0x41fe6f){logger[_0xbdc2('0xe')](_0xbdc2('0xf'),_0x3d2a0d,_0xbdc2('0x10'));logger[_0xbdc2('0x11')](_0xbdc2('0x12'),_0x3d2a0d,_0xbdc2('0x10'),JSON['stringify'](_0x41fe6f));if(_0x41fe6f['error']){if(_0x41fe6f[_0xbdc2('0x13')][_0xbdc2('0x14')]===0x1f4){logger['error'](_0xbdc2('0xf'),_0x3d2a0d,_0x41fe6f['error']['message']);return _0x3410ea(_0x41fe6f['error'][_0xbdc2('0x15')]);}logger[_0xbdc2('0x13')](_0xbdc2('0xf'),_0x3d2a0d,_0x41fe6f[_0xbdc2('0x13')][_0xbdc2('0x15')]);return _0x410913(_0x41fe6f[_0xbdc2('0x13')][_0xbdc2('0x15')]);}else{logger[_0xbdc2('0xe')](_0xbdc2('0xf'),_0x3d2a0d,_0xbdc2('0x10'));_0x410913(_0x41fe6f[_0xbdc2('0x16')][_0xbdc2('0x15')]);}})[_0xbdc2('0x17')](function(_0xaf93e9){logger[_0xbdc2('0x13')](_0xbdc2('0xf'),_0x3d2a0d,_0xaf93e9);_0x3410ea(_0xaf93e9);});});}exports[_0xbdc2('0x18')]=function(_0xb14796){var _0x3aff26=this;return new Promise(function(_0x59e28b,_0x6eaadb){return db[_0xbdc2('0x19')][_0xbdc2('0x1a')](_0xb14796[_0xbdc2('0x1b')],{'raw':_0xb14796[_0xbdc2('0x1c')]?_0xb14796[_0xbdc2('0x1c')][_0xbdc2('0x1d')]===undefined?!![]:![]:!![]})[_0xbdc2('0x1e')](function(_0x3bfd05){logger[_0xbdc2('0xe')]('CreateWhatsappMessage',_0xb14796);logger[_0xbdc2('0x11')](_0xbdc2('0x18'),_0xb14796,JSON[_0xbdc2('0x1f')](_0x3bfd05));_0x59e28b(_0x3bfd05);})[_0xbdc2('0x17')](function(_0x21a0bf){logger[_0xbdc2('0x13')](_0xbdc2('0x18'),_0x21a0bf['message'],_0xb14796);_0x6eaadb(_0x3aff26[_0xbdc2('0x13')](0x1f4,_0x21a0bf['message']));});});}; \ No newline at end of file +var _0xd9ad=['randomstring','../../mysqldb','../../config/logger','../../config/environment','client','redis','defaults','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','util','moment'];(function(_0x15ce9a,_0x2b77fd){var _0x47fd1b=function(_0x59e151){while(--_0x59e151){_0x15ce9a['push'](_0x15ce9a['shift']());}};_0x47fd1b(++_0x2b77fd);}(_0xd9ad,0x99));var _0xdd9a=function(_0x273e05,_0x34d9ea){_0x273e05=_0x273e05-0x0;var _0x2545ee=_0xd9ad[_0x273e05];return _0x2545ee;};'use strict';var _=require('lodash');var util=require(_0xdd9a('0x0'));var moment=require(_0xdd9a('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd9a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdd9a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd9a('0x4'))('rpc');var config=require(_0xdd9a('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdd9a('0x6')]['http']({'port':0x232a});config[_0xdd9a('0x7')]=_[_0xdd9a('0x8')](config[_0xdd9a('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xdd9a('0x9'))(new Redis(config[_0xdd9a('0x7')]));require(_0xdd9a('0xa'))[_0xdd9a('0xb')](socket);function respondWithRpcPromise(_0x3f7b4b,_0x444d67,_0x1e5d2b){return new BPromise(function(_0x2336f7,_0x268b19){return client[_0xdd9a('0xc')](_0x3f7b4b,_0x1e5d2b)[_0xdd9a('0xd')](function(_0x58f10e){logger[_0xdd9a('0xe')]('WhatsappMessage,\x20%s,\x20%s',_0x444d67,_0xdd9a('0xf'));logger[_0xdd9a('0x10')](_0xdd9a('0x11'),_0x444d67,'request\x20sent',JSON[_0xdd9a('0x12')](_0x58f10e));if(_0x58f10e[_0xdd9a('0x13')]){if(_0x58f10e[_0xdd9a('0x13')][_0xdd9a('0x14')]===0x1f4){logger[_0xdd9a('0x13')](_0xdd9a('0x15'),_0x444d67,_0x58f10e[_0xdd9a('0x13')][_0xdd9a('0x16')]);return _0x268b19(_0x58f10e[_0xdd9a('0x13')][_0xdd9a('0x16')]);}logger[_0xdd9a('0x13')](_0xdd9a('0x15'),_0x444d67,_0x58f10e[_0xdd9a('0x13')]['message']);return _0x2336f7(_0x58f10e[_0xdd9a('0x13')][_0xdd9a('0x16')]);}else{logger['info'](_0xdd9a('0x15'),_0x444d67,'request\x20sent');_0x2336f7(_0x58f10e[_0xdd9a('0x17')][_0xdd9a('0x16')]);}})[_0xdd9a('0x18')](function(_0x3fd713){logger['error'](_0xdd9a('0x15'),_0x444d67,_0x3fd713);_0x268b19(_0x3fd713);});});}exports[_0xdd9a('0x19')]=function(_0x1793d3){var _0x3fa9b4=this;return new Promise(function(_0x2e8fe9,_0x263399){return db[_0xdd9a('0x1a')][_0xdd9a('0x1b')](_0x1793d3[_0xdd9a('0x1c')],{'raw':_0x1793d3[_0xdd9a('0x1d')]?_0x1793d3[_0xdd9a('0x1d')][_0xdd9a('0x1e')]===undefined?!![]:![]:!![]})[_0xdd9a('0xd')](function(_0x2da4d3){logger[_0xdd9a('0xe')](_0xdd9a('0x19'),_0x1793d3);logger['debug'](_0xdd9a('0x19'),_0x1793d3,JSON[_0xdd9a('0x12')](_0x2da4d3));_0x2e8fe9(_0x2da4d3);})[_0xdd9a('0x18')](function(_0xa9844e){logger[_0xdd9a('0x13')](_0xdd9a('0x19'),_0xa9844e[_0xdd9a('0x16')],_0x1793d3);_0x263399(_0x3fa9b4[_0xdd9a('0x13')](0x1f4,_0xa9844e[_0xdd9a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 4674b9e..5472e11 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 _0x965f=['whatsappMessage:','./whatsappMessage.events','save','remove','removeListener','register','length'];(function(_0x4e2198,_0x399d54){var _0x22fdd7=function(_0x2fc7d0){while(--_0x2fc7d0){_0x4e2198['push'](_0x4e2198['shift']());}};_0x22fdd7(++_0x399d54);}(_0x965f,0x127));var _0xf965=function(_0x84f6d5,_0x368751){_0x84f6d5=_0x84f6d5-0x0;var _0x22351b=_0x965f[_0x84f6d5];return _0x22351b;};'use strict';var WhatsappMessageEvents=require(_0xf965('0x0'));var events=[_0xf965('0x1'),_0xf965('0x2'),'update'];function createListener(_0x1af378,_0x24c3a9){return function(_0x593080){_0x24c3a9['emit'](_0x1af378,_0x593080);};}function removeListener(_0x31b1b9,_0x2d4dc2){return function(){WhatsappMessageEvents[_0xf965('0x3')](_0x31b1b9,_0x2d4dc2);};}exports[_0xf965('0x4')]=function(_0x3503d7){for(var _0x7ffcf3=0x0,_0x244508=events[_0xf965('0x5')];_0x7ffcf3<_0x244508;_0x7ffcf3++){var _0x75174=events[_0x7ffcf3];var _0x490550=createListener(_0xf965('0x6')+_0x75174,_0x3503d7);WhatsappMessageEvents['on'](_0x75174,_0x490550);}}; \ No newline at end of file +var _0x513b=['save','remove','removeListener','length','whatsappMessage:','./whatsappMessage.events'];(function(_0x3d27ba,_0x2671a3){var _0xf01885=function(_0x311f5c){while(--_0x311f5c){_0x3d27ba['push'](_0x3d27ba['shift']());}};_0xf01885(++_0x2671a3);}(_0x513b,0x1cd));var _0xb513=function(_0x21c4d2,_0x41f090){_0x21c4d2=_0x21c4d2-0x0;var _0x10353d=_0x513b[_0x21c4d2];return _0x10353d;};'use strict';var WhatsappMessageEvents=require(_0xb513('0x0'));var events=[_0xb513('0x1'),_0xb513('0x2'),'update'];function createListener(_0x2aeb4a,_0x41940f){return function(_0x12f519){_0x41940f['emit'](_0x2aeb4a,_0x12f519);};}function removeListener(_0x2782f7,_0x1611d9){return function(){WhatsappMessageEvents[_0xb513('0x3')](_0x2782f7,_0x1611d9);};}exports['register']=function(_0x14db74){for(var _0x277725=0x0,_0x40ac28=events[_0xb513('0x4')];_0x277725<_0x40ac28;_0x277725++){var _0x46fa84=events[_0x277725];var _0x471644=createListener(_0xb513('0x5')+_0x46fa84,_0x14db74);WhatsappMessageEvents['on'](_0x46fa84,_0x471644);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 2488961..7ad741f 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 _0x8ee8=['../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addAgents','put','/:id','update','delete','destroy','removeTeams','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xadcc96,_0x2f0c6a){var _0x1273de=function(_0x7c19b9){while(--_0x7c19b9){_0xadcc96['push'](_0xadcc96['shift']());}};_0x1273de(++_0x2f0c6a);}(_0x8ee8,0x8b));var _0x88ee=function(_0x1c3c59,_0x5f251a){_0x1c3c59=_0x1c3c59-0x0;var _0x1100b7=_0x8ee8[_0x1c3c59];return _0x1100b7;};'use strict';var multer=require(_0x88ee('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x88ee('0x1'));var express=require(_0x88ee('0x2'));var router=express[_0x88ee('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x88ee('0x4'));var interaction=require(_0x88ee('0x5'));var config=require(_0x88ee('0x6'));var controller=require(_0x88ee('0x7'));router[_0x88ee('0x8')]('/',auth[_0x88ee('0x9')](),controller[_0x88ee('0xa')]);router['get']('/describe',auth[_0x88ee('0x9')](),controller[_0x88ee('0xb')]);router[_0x88ee('0x8')]('/:id',auth[_0x88ee('0x9')](),controller[_0x88ee('0xc')]);router[_0x88ee('0x8')](_0x88ee('0xd'),auth[_0x88ee('0x9')](),controller[_0x88ee('0xe')]);router[_0x88ee('0x8')]('/:id/teams',auth[_0x88ee('0x9')](),controller[_0x88ee('0xf')]);router[_0x88ee('0x8')](_0x88ee('0x10'),auth[_0x88ee('0x9')](),controller[_0x88ee('0x11')]);router[_0x88ee('0x12')]('/',auth[_0x88ee('0x9')](),controller[_0x88ee('0x13')]);router[_0x88ee('0x12')](_0x88ee('0x14'),auth[_0x88ee('0x9')](),controller['addTeams']);router[_0x88ee('0x12')]('/:id/users',auth[_0x88ee('0x9')](),controller[_0x88ee('0x15')]);router[_0x88ee('0x16')](_0x88ee('0x17'),auth['isAuthenticated'](),controller[_0x88ee('0x18')]);router[_0x88ee('0x19')](_0x88ee('0x17'),auth[_0x88ee('0x9')](),controller[_0x88ee('0x1a')]);router[_0x88ee('0x19')](_0x88ee('0x14'),auth['isAuthenticated'](),controller[_0x88ee('0x1b')]);router[_0x88ee('0x19')](_0x88ee('0x10'),auth[_0x88ee('0x9')](),controller['removeAgents']);module[_0x88ee('0x1c')]=router; \ No newline at end of file +var _0xfed0=['post','create','addTeams','addAgents','put','update','delete','/:id/teams','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id','show','getMembers','getTeams','/:id/users','getAgents'];(function(_0x53bcc3,_0x364374){var _0x47c959=function(_0x40ef7d){while(--_0x40ef7d){_0x53bcc3['push'](_0x53bcc3['shift']());}};_0x47c959(++_0x364374);}(_0xfed0,0xeb));var _0x0fed=function(_0x36f764,_0xdfcd11){_0x36f764=_0x36f764-0x0;var _0x51596a=_0xfed0[_0x36f764];return _0x51596a;};'use strict';var multer=require(_0x0fed('0x0'));var util=require(_0x0fed('0x1'));var path=require('path');var timeout=require(_0x0fed('0x2'));var express=require(_0x0fed('0x3'));var router=express[_0x0fed('0x4')]();var fs_extra=require(_0x0fed('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0fed('0x6'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router['get']('/',auth[_0x0fed('0x7')](),controller['index']);router[_0x0fed('0x8')](_0x0fed('0x9'),auth['isAuthenticated'](),controller[_0x0fed('0xa')]);router[_0x0fed('0x8')](_0x0fed('0xb'),auth['isAuthenticated'](),controller[_0x0fed('0xc')]);router[_0x0fed('0x8')]('/:id/members',auth[_0x0fed('0x7')](),controller[_0x0fed('0xd')]);router[_0x0fed('0x8')]('/:id/teams',auth[_0x0fed('0x7')](),controller[_0x0fed('0xe')]);router['get'](_0x0fed('0xf'),auth[_0x0fed('0x7')](),controller[_0x0fed('0x10')]);router[_0x0fed('0x11')]('/',auth[_0x0fed('0x7')](),controller[_0x0fed('0x12')]);router[_0x0fed('0x11')]('/:id/teams',auth[_0x0fed('0x7')](),controller[_0x0fed('0x13')]);router[_0x0fed('0x11')]('/:id/users',auth[_0x0fed('0x7')](),controller[_0x0fed('0x14')]);router[_0x0fed('0x15')](_0x0fed('0xb'),auth[_0x0fed('0x7')](),controller[_0x0fed('0x16')]);router[_0x0fed('0x17')](_0x0fed('0xb'),auth[_0x0fed('0x7')](),controller['destroy']);router[_0x0fed('0x17')](_0x0fed('0x18'),auth[_0x0fed('0x7')](),controller[_0x0fed('0x19')]);router[_0x0fed('0x17')](_0x0fed('0xf'),auth[_0x0fed('0x7')](),controller[_0x0fed('0x1a')]);module[_0x0fed('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 8ec8642..f0b99e1 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 _0xb903=['name','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb903,0x185));var _0x3b90=function(_0x1593c5,_0x32308){_0x1593c5=_0x1593c5-0x0;var _0x36e3b1=_0xb903[_0x1593c5];return _0x36e3b1;};'use strict';var Sequelize=require(_0x3b90('0x0'));module[_0x3b90('0x1')]={'name':{'type':Sequelize[_0x3b90('0x2')],'unique':_0x3b90('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3b90('0x4')](_0x3b90('0x5'),_0x3b90('0x6'),_0x3b90('0x7'))},'description':{'type':Sequelize[_0x3b90('0x2')]}}; \ No newline at end of file +var _0xe186=['name','INTEGER','ENUM','rrmemory','beepall','STRING','sequelize','exports'];(function(_0x44e4fc,_0x40e19f){var _0x4b375b=function(_0x31241e){while(--_0x31241e){_0x44e4fc['push'](_0x44e4fc['shift']());}};_0x4b375b(++_0x40e19f);}(_0xe186,0x146));var _0x6e18=function(_0x200e43,_0x5eeaab){_0x200e43=_0x200e43-0x0;var _0x593a88=_0xe186[_0x200e43];return _0x593a88;};'use strict';var Sequelize=require(_0x6e18('0x0'));module[_0x6e18('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6e18('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6e18('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6e18('0x4')](_0x6e18('0x5'),_0x6e18('0x6'),'roundrobin')},'description':{'type':Sequelize[_0x6e18('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 95adea7..67d5725 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 _0x814d=['to-csv','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','destroy','then','get','WhatsappQueues','UserProfileResource','end','stack','name','send','index','WhatsappQueue','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserWhatsappQueue','findAndCountAll','agent','whatsappPause','format','%s/%s','createdAt','getTeams','findOne','order','addTeams','ids','Team','User','online','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','value','transaction','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path'];(function(_0x1c8c28,_0x3ee093){var _0x1f59b4=function(_0x29bcc0){while(--_0x29bcc0){_0x1c8c28['push'](_0x1c8c28['shift']());}};_0x1f59b4(++_0x3ee093);}(_0x814d,0x115));var _0xd814=function(_0x461b0d,_0x5c3285){_0x461b0d=_0x461b0d-0x0;var _0x92a577=_0x814d[_0x461b0d];return _0x92a577;};'use strict';var emlformat=require(_0xd814('0x0'));var rimraf=require(_0xd814('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd814('0x2'));var rp=require(_0xd814('0x3'));var moment=require(_0xd814('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd814('0x5'));var util=require('util');var path=require(_0xd814('0x6'));var sox=require('sox');var csv=require(_0xd814('0x7'));var ejs=require(_0xd814('0x8'));var fs=require('fs');var fs_extra=require(_0xd814('0x9'));var _=require(_0xd814('0xa'));var squel=require(_0xd814('0xb'));var crypto=require(_0xd814('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd814('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd814('0xd'));var authService=require(_0xd814('0xe'));var qs=require(_0xd814('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd814('0x10'));var logger=require(_0xd814('0x11'))(_0xd814('0x12'));var utils=require('../../config/utils');var config=require(_0xd814('0x13'));var licenseUtil=require(_0xd814('0x14'));var db=require('../../mysqldb')['db'];config[_0xd814('0x15')]=_[_0xd814('0x16')](config[_0xd814('0x15')],{'host':_0xd814('0x17'),'port':0x18eb});var socket=require(_0xd814('0x18'))(new Redis(config[_0xd814('0x15')]));require(_0xd814('0x19'))[_0xd814('0x1a')](socket);function respondWithStatusCode(_0x132ba2,_0x4f0112){_0x4f0112=_0x4f0112||0xcc;return function(_0xf19547){if(_0xf19547){return _0x132ba2[_0xd814('0x1b')](_0x4f0112);}return _0x132ba2[_0xd814('0x1c')](_0x4f0112)['end']();};}function respondWithResult(_0x1ac29f,_0xc9865f){_0xc9865f=_0xc9865f||0xc8;return function(_0xaba6d4){if(_0xaba6d4){return _0x1ac29f['status'](_0xc9865f)[_0xd814('0x1d')](_0xaba6d4);}};}function respondWithFilteredResult(_0x55746e,_0x3fd7f5){return function(_0x2e6fca){if(_0x2e6fca){var _0x55945e=typeof _0x3fd7f5['offset']===_0xd814('0x1e')&&typeof _0x3fd7f5[_0xd814('0x1f')]==='undefined';var _0x55ea17=_0x2e6fca[_0xd814('0x20')];var _0x5b23b0=_0x55945e?0x0:_0x3fd7f5[_0xd814('0x21')];var _0x51550b=_0x55945e?_0x2e6fca['count']:_0x3fd7f5['offset']+_0x3fd7f5[_0xd814('0x1f')];var _0x263894;if(_0x51550b>=_0x55ea17){_0x51550b=_0x55ea17;_0x263894=0xc8;}else{_0x263894=0xce;}_0x55746e[_0xd814('0x1c')](_0x263894);return _0x55746e[_0xd814('0x22')]('Content-Range',_0x5b23b0+'-'+_0x51550b+'/'+_0x55ea17)[_0xd814('0x1d')](_0x2e6fca);}return null;};}function patchUpdates(_0x4b6009){return function(_0x277313){try{jsonpatch[_0xd814('0x23')](_0x277313,_0x4b6009,!![]);}catch(_0x22695f){return BPromise[_0xd814('0x24')](_0x22695f);}return _0x277313[_0xd814('0x25')]();};}function saveUpdates(_0x50f09b,_0x37e9fc){return function(_0xc0ba26){if(_0xc0ba26){return _0xc0ba26['update'](_0x50f09b)['then'](function(_0x38bf41){return _0x38bf41;});}return null;};}function removeEntity(_0x2656bb,_0x287317){return function(_0x3acc2e){if(_0x3acc2e){return _0x3acc2e[_0xd814('0x26')]()[_0xd814('0x27')](function(){var _0x3818a9=_0x3acc2e[_0xd814('0x28')]({'plain':!![]});var _0x37a665=_0xd814('0x29');return db[_0xd814('0x2a')][_0xd814('0x26')]({'where':{'type':_0x37a665,'resourceId':_0x3818a9['id']}})[_0xd814('0x27')](function(){return _0x3acc2e;});})[_0xd814('0x27')](function(){_0x2656bb['status'](0xcc)[_0xd814('0x2b')]();});}};}function handleEntityNotFound(_0x5e91ff,_0x977fe4){return function(_0xc5c2c7){if(!_0xc5c2c7){_0x5e91ff[_0xd814('0x1b')](0x194);}return _0xc5c2c7;};}function handleError(_0xfa3e95,_0x1d7256){_0x1d7256=_0x1d7256||0x1f4;return function(_0x2b0051){logger['error'](_0x2b0051[_0xd814('0x2c')]);if(_0x2b0051[_0xd814('0x2d')]){delete _0x2b0051[_0xd814('0x2d')];}_0xfa3e95[_0xd814('0x1c')](_0x1d7256)[_0xd814('0x2e')](_0x2b0051);};}exports[_0xd814('0x2f')]=function(_0xd7fd30,_0x1a6ff2){var _0x1d8aee={},_0x3bc63b={},_0x2a9132={'count':0x0,'rows':[]};var _0x4f1369=_['map'](db[_0xd814('0x30')][_0xd814('0x31')],function(_0x148c11){return{'name':_0x148c11[_0xd814('0x32')],'type':_0x148c11[_0xd814('0x33')]['key']};});_0x3bc63b['model']=_[_0xd814('0x34')](_0x4f1369,'name');_0x3bc63b[_0xd814('0x35')]=_[_0xd814('0x36')](_0xd7fd30[_0xd814('0x35')]);_0x3bc63b[_0xd814('0x37')]=_[_0xd814('0x38')](_0x3bc63b[_0xd814('0x39')],_0x3bc63b[_0xd814('0x35')]);_0x1d8aee[_0xd814('0x3a')]=_[_0xd814('0x38')](_0x3bc63b[_0xd814('0x39')],qs[_0xd814('0x3b')](_0xd7fd30[_0xd814('0x35')][_0xd814('0x3b')]));_0x1d8aee[_0xd814('0x3a')]=_0x1d8aee[_0xd814('0x3a')][_0xd814('0x3c')]?_0x1d8aee['attributes']:_0x3bc63b['model'];if(!_0xd7fd30['query'][_0xd814('0x3d')](_0xd814('0x3e'))){_0x1d8aee[_0xd814('0x1f')]=qs[_0xd814('0x1f')](_0xd7fd30[_0xd814('0x35')][_0xd814('0x1f')]);_0x1d8aee[_0xd814('0x21')]=qs[_0xd814('0x21')](_0xd7fd30['query'][_0xd814('0x21')]);}_0x1d8aee['order']=qs[_0xd814('0x3f')](_0xd7fd30[_0xd814('0x35')][_0xd814('0x3f')]);_0x1d8aee[_0xd814('0x40')]=qs['filters'](_[_0xd814('0x41')](_0xd7fd30['query'],_0x3bc63b[_0xd814('0x37')]),_0x4f1369);if(_0xd7fd30[_0xd814('0x35')][_0xd814('0x42')]){_0x1d8aee[_0xd814('0x40')]=_[_0xd814('0x43')](_0x1d8aee['where'],{'$or':_[_0xd814('0x34')](_0x4f1369,function(_0x1e3351){if(_0x1e3351[_0xd814('0x33')]!==_0xd814('0x44')){var _0x5f2aa5={};_0x5f2aa5[_0x1e3351[_0xd814('0x2d')]]={'$like':'%'+_0xd7fd30[_0xd814('0x35')][_0xd814('0x42')]+'%'};return _0x5f2aa5;}})});}_0x1d8aee=_[_0xd814('0x43')]({},_0x1d8aee,_0xd7fd30[_0xd814('0x45')]);var _0x34c7bc={'where':_0x1d8aee['where']};return db[_0xd814('0x30')][_0xd814('0x20')](_0x34c7bc)[_0xd814('0x27')](function(_0x366b1a){_0x2a9132[_0xd814('0x20')]=_0x366b1a;if(_0xd7fd30['query'][_0xd814('0x46')]){_0x1d8aee['include']=[{'all':!![]}];}return db[_0xd814('0x30')][_0xd814('0x47')](_0x1d8aee);})[_0xd814('0x27')](function(_0x338a0f){_0x2a9132[_0xd814('0x48')]=_0x338a0f;return _0x2a9132;})[_0xd814('0x27')](respondWithFilteredResult(_0x1a6ff2,_0x1d8aee))[_0xd814('0x49')](handleError(_0x1a6ff2,null));};exports[_0xd814('0x4a')]=function(_0x57061e,_0x160122){var _0x5cb2f0={'raw':!![],'where':{'id':_0x57061e[_0xd814('0x4b')]['id']}},_0x3c7077={};_0x3c7077['model']=_[_0xd814('0x36')](db['WhatsappQueue'][_0xd814('0x31')]);_0x3c7077[_0xd814('0x35')]=_['keys'](_0x57061e[_0xd814('0x35')]);_0x3c7077[_0xd814('0x37')]=_['intersection'](_0x3c7077[_0xd814('0x39')],_0x3c7077[_0xd814('0x35')]);_0x5cb2f0[_0xd814('0x3a')]=_[_0xd814('0x38')](_0x3c7077['model'],qs['fields'](_0x57061e[_0xd814('0x35')][_0xd814('0x3b')]));_0x5cb2f0['attributes']=_0x5cb2f0[_0xd814('0x3a')][_0xd814('0x3c')]?_0x5cb2f0[_0xd814('0x3a')]:_0x3c7077[_0xd814('0x39')];if(_0x57061e[_0xd814('0x35')][_0xd814('0x46')]){_0x5cb2f0[_0xd814('0x4c')]=[{'all':!![]}];}_0x5cb2f0=_[_0xd814('0x43')]({},_0x5cb2f0,_0x57061e['options']);return db[_0xd814('0x30')][_0xd814('0x4d')](_0x5cb2f0)['then'](handleEntityNotFound(_0x160122,null))[_0xd814('0x27')](respondWithResult(_0x160122,null))[_0xd814('0x49')](handleError(_0x160122,null));};exports['create']=function(_0x6b7ae5,_0x54aef0){return db[_0xd814('0x30')][_0xd814('0x4e')](_0x6b7ae5[_0xd814('0x4f')],{})[_0xd814('0x27')](function(_0x4eba91){var _0x2d6726=_0x6b7ae5[_0xd814('0x50')]['get']({'plain':!![]});if(!_0x2d6726)throw new Error(_0xd814('0x51'));if(_0x2d6726[_0xd814('0x52')]===_0xd814('0x50')){var _0x2664bd=_0x4eba91[_0xd814('0x28')]({'plain':!![]});var _0x56113b=_0xd814('0x29');return db[_0xd814('0x53')]['find']({'where':{'name':_0x56113b,'userProfileId':_0x2d6726[_0xd814('0x54')]},'raw':!![]})[_0xd814('0x27')](function(_0x3b104f){if(_0x3b104f&&_0x3b104f[_0xd814('0x55')]===0x0){return db[_0xd814('0x2a')][_0xd814('0x4e')]({'name':_0x2664bd[_0xd814('0x2d')],'resourceId':_0x2664bd['id'],'type':_0x3b104f[_0xd814('0x2d')],'sectionId':_0x3b104f['id']},{})[_0xd814('0x27')](function(){return _0x4eba91;});}else{return _0x4eba91;}})[_0xd814('0x49')](function(_0x1318f9){logger[_0xd814('0x56')](_0xd814('0x57'),_0x1318f9);throw _0x1318f9;});}return _0x4eba91;})['then'](respondWithResult(_0x54aef0,0xc9))[_0xd814('0x49')](handleError(_0x54aef0,null));};exports[_0xd814('0x58')]=function(_0x513810,_0x545a08){if(_0x513810[_0xd814('0x4f')]['id']){delete _0x513810[_0xd814('0x4f')]['id'];}return db[_0xd814('0x30')]['find']({'where':{'id':_0x513810[_0xd814('0x4b')]['id']}})[_0xd814('0x27')](handleEntityNotFound(_0x545a08,null))['then'](saveUpdates(_0x513810[_0xd814('0x4f')],null))[_0xd814('0x27')](respondWithResult(_0x545a08,null))[_0xd814('0x49')](handleError(_0x545a08,null));};exports[_0xd814('0x26')]=function(_0x336cff,_0x3eca84){return db[_0xd814('0x30')][_0xd814('0x4d')]({'where':{'id':_0x336cff[_0xd814('0x4b')]['id']}})[_0xd814('0x27')](handleEntityNotFound(_0x3eca84,null))[_0xd814('0x27')](removeEntity(_0x3eca84,null))['catch'](handleError(_0x3eca84,null));};exports['describe']=function(_0x431b1b,_0x1f6428){return db[_0xd814('0x30')][_0xd814('0x59')]()[_0xd814('0x27')](respondWithResult(_0x1f6428,null))[_0xd814('0x49')](handleError(_0x1f6428,null));};exports[_0xd814('0x5a')]=function(_0x2a0ea2,_0x4ffee3,_0x30acc5){var _0x3c6062={'raw':!![],'where':{}},_0x15a1e1={},_0x1776cb;return db[_0xd814('0x30')]['findOne']({'where':{'id':_0x2a0ea2[_0xd814('0x4b')]['id']}})[_0xd814('0x27')](handleEntityNotFound(_0x4ffee3,null))[_0xd814('0x27')](function(_0x204c79){if(_0x204c79){_0x1776cb=_0x204c79[_0xd814('0x28')]({'plain':!![]});_0x15a1e1[_0xd814('0x39')]=_[_0xd814('0x36')](db[_0xd814('0x5b')]['rawAttributes']);_0x15a1e1[_0xd814('0x35')]=_[_0xd814('0x36')](_0x2a0ea2[_0xd814('0x35')]);_0x15a1e1[_0xd814('0x37')]=_['intersection'](_0x15a1e1['model'],_0x15a1e1['query']);_0x3c6062[_0xd814('0x3a')]=_[_0xd814('0x38')](_0x15a1e1[_0xd814('0x39')],qs[_0xd814('0x3b')](_0x2a0ea2[_0xd814('0x35')]['fields']));_0x3c6062['attributes']=_0x3c6062[_0xd814('0x3a')]['length']?_0x3c6062[_0xd814('0x3a')]:_0x15a1e1[_0xd814('0x39')];if(!_0x2a0ea2[_0xd814('0x35')][_0xd814('0x3d')](_0xd814('0x3e'))){_0x3c6062[_0xd814('0x1f')]=qs[_0xd814('0x1f')](_0x2a0ea2[_0xd814('0x35')][_0xd814('0x1f')]);_0x3c6062[_0xd814('0x21')]=qs[_0xd814('0x21')](_0x2a0ea2[_0xd814('0x35')]['offset']);}_0x3c6062['order']=qs[_0xd814('0x3f')](_0x2a0ea2['query']['sort']);_0x3c6062[_0xd814('0x40')]=qs['filters'](_[_0xd814('0x41')](_0x2a0ea2[_0xd814('0x35')],_0x15a1e1['filters']));_0x3c6062[_0xd814('0x40')]['WhatsappQueueId']=_0x204c79['id'];if(_0x2a0ea2[_0xd814('0x35')][_0xd814('0x42')]){_0x3c6062[_0xd814('0x40')]=_[_0xd814('0x43')](_0x3c6062[_0xd814('0x40')],{'$or':_[_0xd814('0x34')](_0x3c6062[_0xd814('0x3a')],function(_0x2e0934){var _0x4b50a={};_0x4b50a[_0x2e0934]={'$like':'%'+_0x2a0ea2[_0xd814('0x35')]['filter']+'%'};return _0x4b50a;})});}_0x3c6062=_[_0xd814('0x43')]({},_0x3c6062,_0x2a0ea2['options']);return db[_0xd814('0x5b')][_0xd814('0x47')](_0x3c6062);}})['then'](function(_0x1c0ba5){if(_0x1c0ba5){return db['User'][_0xd814('0x5c')]({'where':{'id':_[_0xd814('0x34')](_0x1c0ba5,'UserId'),'role':_0xd814('0x5d')},'attributes':['id','name',_0xd814('0x5e'),'updatedAt','createdAt']});}})[_0xd814('0x27')](function(_0x1508a1){if(_0x1508a1){return{'count':_0x1508a1[_0xd814('0x20')],'rows':_[_0xd814('0x34')](_0x1508a1[_0xd814('0x48')],function(_0x554edc){return{'membername':_0x554edc['name'],'UserId':_0x554edc['id'],'queue_name':_0x1776cb[_0xd814('0x2d')],'WhatsappQueueId':_0x1776cb['id'],'interface':util[_0xd814('0x5f')](_0xd814('0x60'),'SIP',_0x554edc[_0xd814('0x2d')]),'penalty':0x0,'paused':_0x554edc[_0xd814('0x5e')],'createdAt':_0x554edc[_0xd814('0x61')],'updatedAt':_0x554edc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd814('0x27')](respondWithFilteredResult(_0x4ffee3,_0x3c6062))[_0xd814('0x49')](handleError(_0x4ffee3,null));};exports[_0xd814('0x62')]=function(_0x392045,_0x5f0df6,_0x1e1e44){var _0x4e350d={};var _0x364397={};var _0x4eb741;var _0xf13e0f;return db['WhatsappQueue'][_0xd814('0x63')]({'where':{'id':_0x392045[_0xd814('0x4b')]['id']}})[_0xd814('0x27')](handleEntityNotFound(_0x5f0df6,null))[_0xd814('0x27')](function(_0x1534f7){if(_0x1534f7){_0x4eb741=_0x1534f7;_0x364397[_0xd814('0x39')]=_[_0xd814('0x36')](db['Team'][_0xd814('0x31')]);_0x364397[_0xd814('0x35')]=_['keys'](_0x392045[_0xd814('0x35')]);_0x364397[_0xd814('0x37')]=_[_0xd814('0x38')](_0x364397[_0xd814('0x39')],_0x364397[_0xd814('0x35')]);_0x4e350d[_0xd814('0x3a')]=_[_0xd814('0x38')](_0x364397[_0xd814('0x39')],qs[_0xd814('0x3b')](_0x392045['query'][_0xd814('0x3b')]));_0x4e350d[_0xd814('0x3a')]=_0x4e350d[_0xd814('0x3a')][_0xd814('0x3c')]?_0x4e350d['attributes']:_0x364397[_0xd814('0x39')];_0x4e350d[_0xd814('0x64')]=qs[_0xd814('0x3f')](_0x392045['query'][_0xd814('0x3f')]);_0x4e350d[_0xd814('0x40')]=qs['filters'](_[_0xd814('0x41')](_0x392045[_0xd814('0x35')],_0x364397[_0xd814('0x37')]));if(_0x392045[_0xd814('0x35')][_0xd814('0x42')]){_0x4e350d[_0xd814('0x40')]=_[_0xd814('0x43')](_0x4e350d[_0xd814('0x40')],{'$or':_[_0xd814('0x34')](_0x4e350d[_0xd814('0x3a')],function(_0x5b8db8){var _0x5aed20={};_0x5aed20[_0x5b8db8]={'$like':'%'+_0x392045['query']['filter']+'%'};return _0x5aed20;})});}_0x4e350d=_[_0xd814('0x43')]({},_0x4e350d,_0x392045['options']);return _0x4eb741['getTeams'](_0x4e350d);}})['then'](function(_0x102a1e){if(_0x102a1e){_0xf13e0f=_0x102a1e[_0xd814('0x3c')];if(!_0x392045[_0xd814('0x35')][_0xd814('0x3d')](_0xd814('0x3e'))){_0x4e350d[_0xd814('0x1f')]=qs[_0xd814('0x1f')](_0x392045[_0xd814('0x35')]['limit']);_0x4e350d['offset']=qs['offset'](_0x392045[_0xd814('0x35')]['offset']);}return _0x4eb741[_0xd814('0x62')](_0x4e350d);}})['then'](function(_0x31fc86){if(_0x31fc86){return _0x31fc86?{'count':_0xf13e0f,'rows':_0x31fc86}:null;}})['then'](respondWithResult(_0x5f0df6,null))[_0xd814('0x49')](handleError(_0x5f0df6,null));};exports[_0xd814('0x65')]=function(_0x295188,_0xb65d3e,_0x571b48){var _0x494b75=_0x295188[_0xd814('0x4f')][_0xd814('0x66')];return db[_0xd814('0x67')][_0xd814('0x47')]({'where':{'id':_0x494b75},'attributes':['id'],'include':[{'model':db[_0xd814('0x68')],'as':'Agents','attributes':['id','name',_0xd814('0x69'),_0xd814('0x6a'),_0xd814('0x6b')],'raw':!![]}]})['then'](function(_0x491946){if(_0x491946){var _0x453dbb=_[_0xd814('0x6c')](_0x491946,function(_0x3a5d28){var _0x17d534=_0x3a5d28[_0xd814('0x28')]({'plain':!![]});return _0x17d534[_0xd814('0x6d')];});return db[_0xd814('0x30')][_0xd814('0x4d')]({'where':{'id':_0x295188[_0xd814('0x4b')]['id']}})['then'](function(_0x3dfa87){return db[_0xd814('0x6e')]['transaction'](function(_0x49f9da){return _0x3dfa87[_0xd814('0x65')](_0x494b75,{'transaction':_0x49f9da})['then'](function(){return BPromise[_0xd814('0x6f')](_0x453dbb,function(_0x1a55f0){return db['UserWhatsappQueue'][_0xd814('0x70')]({'where':{'UserId':_0x1a55f0['id'],'WhatsappQueueId':_0x295188[_0xd814('0x4b')]['id']},'transaction':_0x49f9da});});})[_0xd814('0x27')](function(){_0x453dbb[_0xd814('0x71')](function(_0x1e07c5){socket[_0xd814('0x72')](_0xd814('0x73'),{'UserId':_0x1e07c5['id'],'WhatsappQueueId':_0x3dfa87['id']});});});});});}})[_0xd814('0x27')](respondWithStatusCode(_0xb65d3e,null))[_0xd814('0x49')](handleError(_0xb65d3e,null));};exports[_0xd814('0x74')]=function(_0x1f4423,_0x26930a,_0x19cb14){return db[_0xd814('0x67')][_0xd814('0x47')]({'where':{'id':_0x1f4423[_0xd814('0x35')][_0xd814('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd814('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xd814('0x27')](handleEntityNotFound(_0x26930a,null))[_0xd814('0x27')](function(_0x420fbd){var _0x39e658=_['map'](_0x420fbd,'id');var _0x229f66=[];var _0x555a36=[];var _0x40abde=squel['select']();_0x40abde['field'](_0xd814('0x75'))[_0xd814('0x76')]('team_has_whatsapp_queues','tq')[_0xd814('0x77')]('user_has_teams','ut',_0xd814('0x78'))['where'](_0xd814('0x79'),_0x1f4423[_0xd814('0x4b')]['id']);for(var _0x3df560=0x0;_0x3df560<_0x420fbd[_0xd814('0x3c')];_0x3df560+=0x1){let _0x558cf3=_0x420fbd[_0x3df560];for(var _0x229f6b=0x0;_0x229f6b<_0x558cf3[_0xd814('0x6d')][_0xd814('0x3c')];_0x229f6b+=0x1){let _0x359c2c=_0x558cf3[_0xd814('0x6d')][_0x229f6b];var _0x579477=_0x40abde[_0xd814('0x7a')]();_0x579477[_0xd814('0x40')](_0xd814('0x7b'),_0x359c2c['id']);_0x555a36[_0xd814('0x7c')](db['sequelize'][_0xd814('0x35')](_0x579477[_0xd814('0x7d')](),{'type':db[_0xd814('0x6e')][_0xd814('0x7e')]['SELECT']})[_0xd814('0x27')](function(_0x55d893){if(_0x55d893[_0xd814('0x3c')]===0x1){return _0x359c2c['id'];}else{var _0x1b6ed9=_[_0xd814('0x7f')](_[_0xd814('0x34')](_0x55d893,_0xd814('0x80')),function(_0x1ab8cc){return _[_0xd814('0x81')](_0x39e658,_0x1ab8cc);});if(_0x1b6ed9){return _0x359c2c['id'];}}}));}}return BPromise[_0xd814('0x82')](_0x555a36)['then'](function(_0x4c0ef1){_0x229f66=_(_0x229f66)[_0xd814('0x83')](_0x4c0ef1)['compact']()[_0xd814('0x84')]();return db[_0xd814('0x30')][_0xd814('0x4d')]({'where':{'id':_0x1f4423[_0xd814('0x4b')]['id']}})[_0xd814('0x27')](function(_0x54266e){return db[_0xd814('0x6e')][_0xd814('0x85')](function(_0x576af0){return _0x54266e[_0xd814('0x74')](_0x1f4423[_0xd814('0x35')][_0xd814('0x66')],{'transaction':_0x576af0})[_0xd814('0x27')](function(){if(!_[_0xd814('0x86')](_0x229f66)){return _0x54266e[_0xd814('0x87')](_0x229f66,{'transaction':_0x576af0});}})[_0xd814('0x27')](function(){_0x229f66[_0xd814('0x71')](function(_0x454f38){socket[_0xd814('0x72')](_0xd814('0x88'),{'UserId':_0x454f38,'WhatsappQueueId':_0x54266e['id']});});});});});});})[_0xd814('0x27')](respondWithStatusCode(_0x26930a,null))[_0xd814('0x49')](handleError(_0x26930a,null));};exports[_0xd814('0x89')]=function(_0xb2deda,_0xe2cb3a,_0x14cf12){return db[_0xd814('0x30')][_0xd814('0x4d')]({'where':{'id':_0xb2deda[_0xd814('0x4b')]['id']}})[_0xd814('0x27')](handleEntityNotFound(_0xe2cb3a,null))[_0xd814('0x27')](function(_0x587431){if(_0x587431){return _0x587431[_0xd814('0x89')](_0xb2deda['body'][_0xd814('0x66')],_[_0xd814('0x8a')](_0xb2deda[_0xd814('0x4f')],['ids','id'])||{})[_0xd814('0x8b')](function(_0x4dedb8){for(var _0x34ccb2=0x0;_0x34ccb2<_0xb2deda[_0xd814('0x4f')][_0xd814('0x66')][_0xd814('0x3c')];_0x34ccb2+=0x1){socket[_0xd814('0x72')](_0xd814('0x73'),{'UserId':Number(_0xb2deda[_0xd814('0x4f')]['ids'][_0x34ccb2]),'WhatsappQueueId':Number(_0xb2deda['params']['id'])});}return _0x4dedb8;});}})[_0xd814('0x27')](respondWithResult(_0xe2cb3a,null))[_0xd814('0x49')](handleError(_0xe2cb3a,null));};exports[_0xd814('0x87')]=function(_0x1290fc,_0x112415,_0x497e51){return db[_0xd814('0x30')]['find']({'where':{'id':_0x1290fc[_0xd814('0x4b')]['id']}})[_0xd814('0x27')](handleEntityNotFound(_0x112415,null))[_0xd814('0x27')](function(_0x363b2b){if(_0x363b2b){return _0x363b2b['removeAgents'](_0x1290fc[_0xd814('0x35')][_0xd814('0x66')])[_0xd814('0x27')](function(){if(_[_0xd814('0x8c')](_0x1290fc[_0xd814('0x35')][_0xd814('0x66')])){for(var _0x14c19f=0x0;_0x14c19f<_0x1290fc['query'][_0xd814('0x66')]['length'];_0x14c19f+=0x1){socket[_0xd814('0x72')]('userWhatsappQueue:remove',{'UserId':Number(_0x1290fc['query']['ids'][_0x14c19f]),'WhatsappQueueId':Number(_0x1290fc['params']['id'])});}}else{socket['emit'](_0xd814('0x88'),{'UserId':Number(_0x1290fc[_0xd814('0x35')][_0xd814('0x66')]),'WhatsappQueueId':Number(_0x1290fc[_0xd814('0x4b')]['id'])});}});}})[_0xd814('0x27')](respondWithStatusCode(_0x112415,null))['catch'](handleError(_0x112415,null));};exports[_0xd814('0x8d')]=function(_0xaf5dee,_0x3e4b4a,_0x42c8ae){var _0x157cbb={};var _0x1887d9={};var _0x221095;var _0x1411ca;return db['WhatsappQueue']['findOne']({'where':{'id':_0xaf5dee['params']['id']}})['then'](handleEntityNotFound(_0x3e4b4a,null))[_0xd814('0x27')](function(_0x5582ac){if(_0x5582ac){_0x221095=_0x5582ac;_0x1887d9[_0xd814('0x39')]=_[_0xd814('0x36')](db[_0xd814('0x68')][_0xd814('0x31')]);_0x1887d9['query']=_[_0xd814('0x36')](_0xaf5dee[_0xd814('0x35')]);_0x1887d9[_0xd814('0x37')]=_[_0xd814('0x38')](_0x1887d9[_0xd814('0x39')],_0x1887d9[_0xd814('0x35')]);_0x157cbb[_0xd814('0x3a')]=_[_0xd814('0x38')](_0x1887d9[_0xd814('0x39')],qs[_0xd814('0x3b')](_0xaf5dee['query'][_0xd814('0x3b')]));_0x157cbb[_0xd814('0x3a')]=_0x157cbb['attributes'][_0xd814('0x3c')]?_0x157cbb[_0xd814('0x3a')]:_0x1887d9[_0xd814('0x39')];_0x157cbb[_0xd814('0x64')]=qs[_0xd814('0x3f')](_0xaf5dee['query']['sort']);_0x157cbb[_0xd814('0x40')]=qs[_0xd814('0x37')](_[_0xd814('0x41')](_0xaf5dee[_0xd814('0x35')],_0x1887d9[_0xd814('0x37')]));if(_0xaf5dee['query'][_0xd814('0x42')]){_0x157cbb[_0xd814('0x40')]=_[_0xd814('0x43')](_0x157cbb[_0xd814('0x40')],{'$or':_[_0xd814('0x34')](_0x157cbb[_0xd814('0x3a')],function(_0x5ec8c2){var _0x4907fc={};_0x4907fc[_0x5ec8c2]={'$like':'%'+_0xaf5dee[_0xd814('0x35')]['filter']+'%'};return _0x4907fc;})});}_0x157cbb=_['merge']({},_0x157cbb,_0xaf5dee[_0xd814('0x45')]);return _0x221095[_0xd814('0x8d')](_0x157cbb);}})[_0xd814('0x27')](function(_0x46ce8c){if(_0x46ce8c){_0x1411ca=_0x46ce8c[_0xd814('0x3c')];if(!_0xaf5dee[_0xd814('0x35')][_0xd814('0x3d')](_0xd814('0x3e'))){_0x157cbb[_0xd814('0x1f')]=qs['limit'](_0xaf5dee[_0xd814('0x35')]['limit']);_0x157cbb[_0xd814('0x21')]=qs['offset'](_0xaf5dee[_0xd814('0x35')]['offset']);}return _0x221095[_0xd814('0x8d')](_0x157cbb);}})['then'](function(_0x22b2ab){if(_0x22b2ab){return _0x22b2ab?{'count':_0x1411ca,'rows':_0x22b2ab}:null;}})[_0xd814('0x27')](respondWithResult(_0x3e4b4a,null))[_0xd814('0x49')](handleError(_0x3e4b4a,null));}; \ No newline at end of file +var _0x89c1=['toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userWhatsappQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappQueue.socket','register','status','json','limit','offset','count','set','Content-Range','apply','reject','save','update','then','WhatsappQueues','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','type','VIRTUAL','merge','options','include','findAll','rows','catch','params','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getMembers','findOne','UserWhatsappQueue','nolimit','WhatsappQueueId','filter','createdAt','format','%s/%s','whatsappPause','getTeams','addTeams','ids','Team','User','online','interface','flatMap','Agents','sequelize','transaction','emit','userWhatsappQueue:save','removeTeams','select','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?'];(function(_0x3b7996,_0x3f79f5){var _0x14167d=function(_0x2294f8){while(--_0x2294f8){_0x3b7996['push'](_0x3b7996['shift']());}};_0x14167d(++_0x3f79f5);}(_0x89c1,0x1ac));var _0x189c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x89c1[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x189c('0x0'));var rimraf=require(_0x189c('0x1'));var zipdir=require(_0x189c('0x2'));var jsonpatch=require(_0x189c('0x3'));var rp=require(_0x189c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x189c('0x5'));var util=require(_0x189c('0x6'));var path=require(_0x189c('0x7'));var sox=require('sox');var csv=require(_0x189c('0x8'));var ejs=require(_0x189c('0x9'));var fs=require('fs');var fs_extra=require(_0x189c('0xa'));var _=require(_0x189c('0xb'));var squel=require(_0x189c('0xc'));var crypto=require(_0x189c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x189c('0xe'));var toCsv=require(_0x189c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x189c('0xf'));var authService=require(_0x189c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x189c('0x11'));var hardwareService=require(_0x189c('0x12'));var logger=require(_0x189c('0x13'))('api');var utils=require(_0x189c('0x14'));var config=require(_0x189c('0x15'));var licenseUtil=require(_0x189c('0x16'));var db=require(_0x189c('0x17'))['db'];config['redis']=_[_0x189c('0x18')](config[_0x189c('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x189c('0x1a'))(new Redis(config['redis']));require(_0x189c('0x1b'))[_0x189c('0x1c')](socket);function respondWithStatusCode(_0x390b04,_0x28cb3f){_0x28cb3f=_0x28cb3f||0xcc;return function(_0x1dbdf0){if(_0x1dbdf0){return _0x390b04['sendStatus'](_0x28cb3f);}return _0x390b04[_0x189c('0x1d')](_0x28cb3f)['end']();};}function respondWithResult(_0x38baec,_0x2993a8){_0x2993a8=_0x2993a8||0xc8;return function(_0x34ccf9){if(_0x34ccf9){return _0x38baec[_0x189c('0x1d')](_0x2993a8)[_0x189c('0x1e')](_0x34ccf9);}};}function respondWithFilteredResult(_0x47d3dd,_0x35673e){return function(_0x76f1db){if(_0x76f1db){var _0x20ee41=typeof _0x35673e['offset']==='undefined'&&typeof _0x35673e[_0x189c('0x1f')]==='undefined';var _0xce510f=_0x76f1db['count'];var _0x3b273e=_0x20ee41?0x0:_0x35673e[_0x189c('0x20')];var _0x3f736d=_0x20ee41?_0x76f1db[_0x189c('0x21')]:_0x35673e[_0x189c('0x20')]+_0x35673e[_0x189c('0x1f')];var _0x20e235;if(_0x3f736d>=_0xce510f){_0x3f736d=_0xce510f;_0x20e235=0xc8;}else{_0x20e235=0xce;}_0x47d3dd[_0x189c('0x1d')](_0x20e235);return _0x47d3dd[_0x189c('0x22')](_0x189c('0x23'),_0x3b273e+'-'+_0x3f736d+'/'+_0xce510f)[_0x189c('0x1e')](_0x76f1db);}return null;};}function patchUpdates(_0x3ee021){return function(_0x3cf2ec){try{jsonpatch[_0x189c('0x24')](_0x3cf2ec,_0x3ee021,!![]);}catch(_0x164ba6){return BPromise[_0x189c('0x25')](_0x164ba6);}return _0x3cf2ec[_0x189c('0x26')]();};}function saveUpdates(_0x2276eb,_0x3ce4ca){return function(_0x1d38a4){if(_0x1d38a4){return _0x1d38a4[_0x189c('0x27')](_0x2276eb)[_0x189c('0x28')](function(_0x281cce){return _0x281cce;});}return null;};}function removeEntity(_0x4f0ed2,_0x559ab4){return function(_0x190fc6){if(_0x190fc6){return _0x190fc6['destroy']()['then'](function(){var _0x5c0fff=_0x190fc6['get']({'plain':!![]});var _0x2cca9d=_0x189c('0x29');return db[_0x189c('0x2a')]['destroy']({'where':{'type':_0x2cca9d,'resourceId':_0x5c0fff['id']}})[_0x189c('0x28')](function(){return _0x190fc6;});})['then'](function(){_0x4f0ed2[_0x189c('0x1d')](0xcc)[_0x189c('0x2b')]();});}};}function handleEntityNotFound(_0x108c96,_0x502267){return function(_0x584c94){if(!_0x584c94){_0x108c96[_0x189c('0x2c')](0x194);}return _0x584c94;};}function handleError(_0x46ca96,_0x5e49cf){_0x5e49cf=_0x5e49cf||0x1f4;return function(_0x4502c1){logger[_0x189c('0x2d')](_0x4502c1[_0x189c('0x2e')]);if(_0x4502c1[_0x189c('0x2f')]){delete _0x4502c1[_0x189c('0x2f')];}_0x46ca96[_0x189c('0x1d')](_0x5e49cf)[_0x189c('0x30')](_0x4502c1);};}exports[_0x189c('0x31')]=function(_0x368b46,_0x336c9e){var _0x4e41c2={},_0x38e12e={},_0x5923b5={'count':0x0,'rows':[]};var _0x438f17=_[_0x189c('0x32')](db[_0x189c('0x33')][_0x189c('0x34')],function(_0x5e0238){return{'name':_0x5e0238['fieldName'],'type':_0x5e0238['type'][_0x189c('0x35')]};});_0x38e12e[_0x189c('0x36')]=_[_0x189c('0x32')](_0x438f17,'name');_0x38e12e['query']=_[_0x189c('0x37')](_0x368b46['query']);_0x38e12e[_0x189c('0x38')]=_[_0x189c('0x39')](_0x38e12e[_0x189c('0x36')],_0x38e12e[_0x189c('0x3a')]);_0x4e41c2[_0x189c('0x3b')]=_[_0x189c('0x39')](_0x38e12e['model'],qs['fields'](_0x368b46[_0x189c('0x3a')][_0x189c('0x3c')]));_0x4e41c2[_0x189c('0x3b')]=_0x4e41c2[_0x189c('0x3b')][_0x189c('0x3d')]?_0x4e41c2[_0x189c('0x3b')]:_0x38e12e[_0x189c('0x36')];if(!_0x368b46['query'][_0x189c('0x3e')]('nolimit')){_0x4e41c2[_0x189c('0x1f')]=qs[_0x189c('0x1f')](_0x368b46[_0x189c('0x3a')][_0x189c('0x1f')]);_0x4e41c2['offset']=qs[_0x189c('0x20')](_0x368b46[_0x189c('0x3a')]['offset']);}_0x4e41c2[_0x189c('0x3f')]=qs['sort'](_0x368b46['query'][_0x189c('0x40')]);_0x4e41c2[_0x189c('0x41')]=qs[_0x189c('0x38')](_[_0x189c('0x42')](_0x368b46[_0x189c('0x3a')],_0x38e12e[_0x189c('0x38')]),_0x438f17);if(_0x368b46[_0x189c('0x3a')]['filter']){_0x4e41c2[_0x189c('0x41')]=_['merge'](_0x4e41c2['where'],{'$or':_[_0x189c('0x32')](_0x438f17,function(_0x365b8c){if(_0x365b8c[_0x189c('0x43')]!==_0x189c('0x44')){var _0x239107={};_0x239107[_0x365b8c[_0x189c('0x2f')]]={'$like':'%'+_0x368b46['query']['filter']+'%'};return _0x239107;}})});}_0x4e41c2=_[_0x189c('0x45')]({},_0x4e41c2,_0x368b46[_0x189c('0x46')]);var _0x59dd5b={'where':_0x4e41c2[_0x189c('0x41')]};return db[_0x189c('0x33')][_0x189c('0x21')](_0x59dd5b)[_0x189c('0x28')](function(_0x56c306){_0x5923b5['count']=_0x56c306;if(_0x368b46[_0x189c('0x3a')]['includeAll']){_0x4e41c2[_0x189c('0x47')]=[{'all':!![]}];}return db[_0x189c('0x33')][_0x189c('0x48')](_0x4e41c2);})[_0x189c('0x28')](function(_0x457991){_0x5923b5[_0x189c('0x49')]=_0x457991;return _0x5923b5;})[_0x189c('0x28')](respondWithFilteredResult(_0x336c9e,_0x4e41c2))[_0x189c('0x4a')](handleError(_0x336c9e,null));};exports['show']=function(_0x367a63,_0x33e909){var _0x3abab0={'raw':!![],'where':{'id':_0x367a63[_0x189c('0x4b')]['id']}},_0x37c02d={};_0x37c02d['model']=_[_0x189c('0x37')](db[_0x189c('0x33')][_0x189c('0x34')]);_0x37c02d[_0x189c('0x3a')]=_['keys'](_0x367a63['query']);_0x37c02d[_0x189c('0x38')]=_['intersection'](_0x37c02d[_0x189c('0x36')],_0x37c02d[_0x189c('0x3a')]);_0x3abab0['attributes']=_[_0x189c('0x39')](_0x37c02d[_0x189c('0x36')],qs[_0x189c('0x3c')](_0x367a63['query'][_0x189c('0x3c')]));_0x3abab0['attributes']=_0x3abab0[_0x189c('0x3b')][_0x189c('0x3d')]?_0x3abab0[_0x189c('0x3b')]:_0x37c02d[_0x189c('0x36')];if(_0x367a63[_0x189c('0x3a')]['includeAll']){_0x3abab0['include']=[{'all':!![]}];}_0x3abab0=_[_0x189c('0x45')]({},_0x3abab0,_0x367a63[_0x189c('0x46')]);return db[_0x189c('0x33')]['find'](_0x3abab0)['then'](handleEntityNotFound(_0x33e909,null))[_0x189c('0x28')](respondWithResult(_0x33e909,null))['catch'](handleError(_0x33e909,null));};exports['create']=function(_0x3aeb5b,_0x4ac51d){return db[_0x189c('0x33')]['create'](_0x3aeb5b[_0x189c('0x4c')],{})[_0x189c('0x28')](function(_0x521c6f){var _0x16fdac=_0x3aeb5b['user'][_0x189c('0x4d')]({'plain':!![]});if(!_0x16fdac)throw new Error(_0x189c('0x4e'));if(_0x16fdac[_0x189c('0x4f')]===_0x189c('0x50')){var _0x26391f=_0x521c6f[_0x189c('0x4d')]({'plain':!![]});var _0x2222a7=_0x189c('0x29');return db[_0x189c('0x51')][_0x189c('0x52')]({'where':{'name':_0x2222a7,'userProfileId':_0x16fdac[_0x189c('0x53')]},'raw':!![]})[_0x189c('0x28')](function(_0x3da808){if(_0x3da808&&_0x3da808['autoAssociation']===0x0){return db[_0x189c('0x2a')][_0x189c('0x54')]({'name':_0x26391f[_0x189c('0x2f')],'resourceId':_0x26391f['id'],'type':_0x3da808['name'],'sectionId':_0x3da808['id']},{})[_0x189c('0x28')](function(){return _0x521c6f;});}else{return _0x521c6f;}})[_0x189c('0x4a')](function(_0x525b29){logger[_0x189c('0x2d')](_0x189c('0x55'),_0x525b29);throw _0x525b29;});}return _0x521c6f;})[_0x189c('0x28')](respondWithResult(_0x4ac51d,0xc9))['catch'](handleError(_0x4ac51d,null));};exports[_0x189c('0x27')]=function(_0x1673b9,_0x339b58){if(_0x1673b9[_0x189c('0x4c')]['id']){delete _0x1673b9[_0x189c('0x4c')]['id'];}return db[_0x189c('0x33')][_0x189c('0x52')]({'where':{'id':_0x1673b9[_0x189c('0x4b')]['id']}})[_0x189c('0x28')](handleEntityNotFound(_0x339b58,null))[_0x189c('0x28')](saveUpdates(_0x1673b9[_0x189c('0x4c')],null))[_0x189c('0x28')](respondWithResult(_0x339b58,null))['catch'](handleError(_0x339b58,null));};exports[_0x189c('0x56')]=function(_0x21b7d5,_0x48c5ab){return db['WhatsappQueue'][_0x189c('0x52')]({'where':{'id':_0x21b7d5[_0x189c('0x4b')]['id']}})[_0x189c('0x28')](handleEntityNotFound(_0x48c5ab,null))['then'](removeEntity(_0x48c5ab,null))['catch'](handleError(_0x48c5ab,null));};exports['describe']=function(_0x18c9e3,_0x18443c){return db[_0x189c('0x33')]['describe']()['then'](respondWithResult(_0x18443c,null))['catch'](handleError(_0x18443c,null));};exports[_0x189c('0x57')]=function(_0x269dd5,_0x152bd7,_0x3832fe){var _0x14c815={'raw':!![],'where':{}},_0x3bfedc={},_0x2a9a11;return db[_0x189c('0x33')][_0x189c('0x58')]({'where':{'id':_0x269dd5[_0x189c('0x4b')]['id']}})[_0x189c('0x28')](handleEntityNotFound(_0x152bd7,null))['then'](function(_0x5e54ca){if(_0x5e54ca){_0x2a9a11=_0x5e54ca[_0x189c('0x4d')]({'plain':!![]});_0x3bfedc[_0x189c('0x36')]=_[_0x189c('0x37')](db[_0x189c('0x59')]['rawAttributes']);_0x3bfedc[_0x189c('0x3a')]=_[_0x189c('0x37')](_0x269dd5[_0x189c('0x3a')]);_0x3bfedc[_0x189c('0x38')]=_['intersection'](_0x3bfedc['model'],_0x3bfedc['query']);_0x14c815[_0x189c('0x3b')]=_['intersection'](_0x3bfedc['model'],qs[_0x189c('0x3c')](_0x269dd5[_0x189c('0x3a')]['fields']));_0x14c815[_0x189c('0x3b')]=_0x14c815[_0x189c('0x3b')][_0x189c('0x3d')]?_0x14c815[_0x189c('0x3b')]:_0x3bfedc[_0x189c('0x36')];if(!_0x269dd5[_0x189c('0x3a')]['hasOwnProperty'](_0x189c('0x5a'))){_0x14c815[_0x189c('0x1f')]=qs[_0x189c('0x1f')](_0x269dd5[_0x189c('0x3a')]['limit']);_0x14c815[_0x189c('0x20')]=qs[_0x189c('0x20')](_0x269dd5[_0x189c('0x3a')][_0x189c('0x20')]);}_0x14c815[_0x189c('0x3f')]=qs['sort'](_0x269dd5[_0x189c('0x3a')]['sort']);_0x14c815[_0x189c('0x41')]=qs[_0x189c('0x38')](_['pick'](_0x269dd5[_0x189c('0x3a')],_0x3bfedc[_0x189c('0x38')]));_0x14c815['where'][_0x189c('0x5b')]=_0x5e54ca['id'];if(_0x269dd5[_0x189c('0x3a')][_0x189c('0x5c')]){_0x14c815[_0x189c('0x41')]=_[_0x189c('0x45')](_0x14c815[_0x189c('0x41')],{'$or':_[_0x189c('0x32')](_0x14c815[_0x189c('0x3b')],function(_0x58c801){var _0x3de97d={};_0x3de97d[_0x58c801]={'$like':'%'+_0x269dd5['query'][_0x189c('0x5c')]+'%'};return _0x3de97d;})});}_0x14c815=_[_0x189c('0x45')]({},_0x14c815,_0x269dd5[_0x189c('0x46')]);return db[_0x189c('0x59')][_0x189c('0x48')](_0x14c815);}})[_0x189c('0x28')](function(_0xbb8539){if(_0xbb8539){return db['User']['findAndCountAll']({'where':{'id':_[_0x189c('0x32')](_0xbb8539,'UserId'),'role':'agent'},'attributes':['id',_0x189c('0x2f'),'whatsappPause','updatedAt',_0x189c('0x5d')]});}})[_0x189c('0x28')](function(_0x246e94){if(_0x246e94){return{'count':_0x246e94['count'],'rows':_['map'](_0x246e94['rows'],function(_0x46e5bc){return{'membername':_0x46e5bc[_0x189c('0x2f')],'UserId':_0x46e5bc['id'],'queue_name':_0x2a9a11['name'],'WhatsappQueueId':_0x2a9a11['id'],'interface':util[_0x189c('0x5e')](_0x189c('0x5f'),'SIP',_0x46e5bc[_0x189c('0x2f')]),'penalty':0x0,'paused':_0x46e5bc[_0x189c('0x60')],'createdAt':_0x46e5bc[_0x189c('0x5d')],'updatedAt':_0x46e5bc['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x189c('0x28')](respondWithFilteredResult(_0x152bd7,_0x14c815))[_0x189c('0x4a')](handleError(_0x152bd7,null));};exports['getTeams']=function(_0x5decbe,_0x5ef8af,_0x30cc25){var _0x25c37c={};var _0x4b1a09={};var _0x908ad0;var _0x344c49;return db[_0x189c('0x33')][_0x189c('0x58')]({'where':{'id':_0x5decbe['params']['id']}})[_0x189c('0x28')](handleEntityNotFound(_0x5ef8af,null))[_0x189c('0x28')](function(_0x5addea){if(_0x5addea){_0x908ad0=_0x5addea;_0x4b1a09[_0x189c('0x36')]=_['keys'](db['Team'][_0x189c('0x34')]);_0x4b1a09['query']=_[_0x189c('0x37')](_0x5decbe['query']);_0x4b1a09[_0x189c('0x38')]=_[_0x189c('0x39')](_0x4b1a09[_0x189c('0x36')],_0x4b1a09['query']);_0x25c37c[_0x189c('0x3b')]=_[_0x189c('0x39')](_0x4b1a09[_0x189c('0x36')],qs['fields'](_0x5decbe[_0x189c('0x3a')][_0x189c('0x3c')]));_0x25c37c['attributes']=_0x25c37c['attributes'][_0x189c('0x3d')]?_0x25c37c[_0x189c('0x3b')]:_0x4b1a09[_0x189c('0x36')];_0x25c37c[_0x189c('0x3f')]=qs[_0x189c('0x40')](_0x5decbe[_0x189c('0x3a')][_0x189c('0x40')]);_0x25c37c[_0x189c('0x41')]=qs['filters'](_['pick'](_0x5decbe['query'],_0x4b1a09[_0x189c('0x38')]));if(_0x5decbe['query'][_0x189c('0x5c')]){_0x25c37c['where']=_[_0x189c('0x45')](_0x25c37c['where'],{'$or':_[_0x189c('0x32')](_0x25c37c[_0x189c('0x3b')],function(_0x24f66c){var _0x578869={};_0x578869[_0x24f66c]={'$like':'%'+_0x5decbe['query'][_0x189c('0x5c')]+'%'};return _0x578869;})});}_0x25c37c=_[_0x189c('0x45')]({},_0x25c37c,_0x5decbe[_0x189c('0x46')]);return _0x908ad0[_0x189c('0x61')](_0x25c37c);}})[_0x189c('0x28')](function(_0x377007){if(_0x377007){_0x344c49=_0x377007[_0x189c('0x3d')];if(!_0x5decbe[_0x189c('0x3a')][_0x189c('0x3e')](_0x189c('0x5a'))){_0x25c37c[_0x189c('0x1f')]=qs[_0x189c('0x1f')](_0x5decbe['query'][_0x189c('0x1f')]);_0x25c37c[_0x189c('0x20')]=qs['offset'](_0x5decbe[_0x189c('0x3a')][_0x189c('0x20')]);}return _0x908ad0[_0x189c('0x61')](_0x25c37c);}})[_0x189c('0x28')](function(_0x9725b2){if(_0x9725b2){return _0x9725b2?{'count':_0x344c49,'rows':_0x9725b2}:null;}})['then'](respondWithResult(_0x5ef8af,null))[_0x189c('0x4a')](handleError(_0x5ef8af,null));};exports[_0x189c('0x62')]=function(_0x267d7e,_0x298460,_0x472e87){var _0x318324=_0x267d7e[_0x189c('0x4c')][_0x189c('0x63')];return db[_0x189c('0x64')][_0x189c('0x48')]({'where':{'id':_0x318324},'attributes':['id'],'include':[{'model':db[_0x189c('0x65')],'as':'Agents','attributes':['id','name',_0x189c('0x66'),'voicePause',_0x189c('0x67')],'raw':!![]}]})['then'](function(_0x599a43){if(_0x599a43){var _0x105e8b=_[_0x189c('0x68')](_0x599a43,function(_0x1a3924){var _0xbb38da=_0x1a3924[_0x189c('0x4d')]({'plain':!![]});return _0xbb38da[_0x189c('0x69')];});return db['WhatsappQueue'][_0x189c('0x52')]({'where':{'id':_0x267d7e[_0x189c('0x4b')]['id']}})[_0x189c('0x28')](function(_0x458a81){return db[_0x189c('0x6a')][_0x189c('0x6b')](function(_0x46d76d){return _0x458a81[_0x189c('0x62')](_0x318324,{'transaction':_0x46d76d})['then'](function(){return BPromise['each'](_0x105e8b,function(_0x231b35){return db[_0x189c('0x59')]['findOrCreate']({'where':{'UserId':_0x231b35['id'],'WhatsappQueueId':_0x267d7e['params']['id']},'transaction':_0x46d76d});});})['then'](function(){_0x105e8b['forEach'](function(_0x50bea7){socket[_0x189c('0x6c')](_0x189c('0x6d'),{'UserId':_0x50bea7['id'],'WhatsappQueueId':_0x458a81['id']});});});});});}})[_0x189c('0x28')](respondWithStatusCode(_0x298460,null))[_0x189c('0x4a')](handleError(_0x298460,null));};exports[_0x189c('0x6e')]=function(_0x2a384d,_0x2dff57,_0x4b7dd8){return db[_0x189c('0x64')][_0x189c('0x48')]({'where':{'id':_0x2a384d['query'][_0x189c('0x63')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x189c('0x69'),'attributes':['id'],'raw':!![]}]})[_0x189c('0x28')](handleEntityNotFound(_0x2dff57,null))[_0x189c('0x28')](function(_0x2e6c6a){var _0x12e664=_[_0x189c('0x32')](_0x2e6c6a,'id');var _0x4ae27e=[];var _0x5645e7=[];var _0x27f565=squel[_0x189c('0x6f')]();_0x27f565['field']('tq.TeamId')[_0x189c('0x70')](_0x189c('0x71'),'tq')[_0x189c('0x72')](_0x189c('0x73'),'ut',_0x189c('0x74'))[_0x189c('0x41')](_0x189c('0x75'),_0x2a384d[_0x189c('0x4b')]['id']);for(var _0x5e95a0=0x0;_0x5e95a0<_0x2e6c6a[_0x189c('0x3d')];_0x5e95a0+=0x1){let _0x2f1b22=_0x2e6c6a[_0x5e95a0];for(var _0x1876c1=0x0;_0x1876c1<_0x2f1b22[_0x189c('0x69')][_0x189c('0x3d')];_0x1876c1+=0x1){let _0x46b7a7=_0x2f1b22[_0x189c('0x69')][_0x1876c1];var _0x5c5988=_0x27f565[_0x189c('0x76')]();_0x5c5988[_0x189c('0x41')](_0x189c('0x77'),_0x46b7a7['id']);_0x5645e7['push'](db['sequelize']['query'](_0x5c5988[_0x189c('0x78')](),{'type':db[_0x189c('0x6a')][_0x189c('0x79')][_0x189c('0x7a')]})[_0x189c('0x28')](function(_0x4b6ddc){if(_0x4b6ddc[_0x189c('0x3d')]===0x1){return _0x46b7a7['id'];}else{var _0x2bd7da=_[_0x189c('0x7b')](_[_0x189c('0x32')](_0x4b6ddc,'TeamId'),function(_0x42f5e2){return _[_0x189c('0x7c')](_0x12e664,_0x42f5e2);});if(_0x2bd7da){return _0x46b7a7['id'];}}}));}}return BPromise[_0x189c('0x7d')](_0x5645e7)[_0x189c('0x28')](function(_0xaa7783){_0x4ae27e=_(_0x4ae27e)[_0x189c('0x7e')](_0xaa7783)[_0x189c('0x7f')]()[_0x189c('0x80')]();return db['WhatsappQueue'][_0x189c('0x52')]({'where':{'id':_0x2a384d[_0x189c('0x4b')]['id']}})['then'](function(_0x47fd68){return db[_0x189c('0x6a')]['transaction'](function(_0xb200bd){return _0x47fd68['removeTeams'](_0x2a384d['query'][_0x189c('0x63')],{'transaction':_0xb200bd})[_0x189c('0x28')](function(){if(!_[_0x189c('0x81')](_0x4ae27e)){return _0x47fd68[_0x189c('0x82')](_0x4ae27e,{'transaction':_0xb200bd});}})[_0x189c('0x28')](function(){_0x4ae27e[_0x189c('0x83')](function(_0x430910){socket[_0x189c('0x6c')]('userWhatsappQueue:remove',{'UserId':_0x430910,'WhatsappQueueId':_0x47fd68['id']});});});});});});})['then'](respondWithStatusCode(_0x2dff57,null))[_0x189c('0x4a')](handleError(_0x2dff57,null));};exports[_0x189c('0x84')]=function(_0x13f48d,_0x425d2e,_0x1dd4a6){return db[_0x189c('0x33')][_0x189c('0x52')]({'where':{'id':_0x13f48d[_0x189c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x425d2e,null))[_0x189c('0x28')](function(_0xf54ff2){if(_0xf54ff2){return _0xf54ff2[_0x189c('0x84')](_0x13f48d['body'][_0x189c('0x63')],_[_0x189c('0x85')](_0x13f48d[_0x189c('0x4c')],[_0x189c('0x63'),'id'])||{})[_0x189c('0x86')](function(_0x54457c){for(var _0x10c7af=0x0;_0x10c7af<_0x13f48d['body']['ids'][_0x189c('0x3d')];_0x10c7af+=0x1){socket[_0x189c('0x6c')](_0x189c('0x6d'),{'UserId':Number(_0x13f48d[_0x189c('0x4c')]['ids'][_0x10c7af]),'WhatsappQueueId':Number(_0x13f48d[_0x189c('0x4b')]['id'])});}return _0x54457c;});}})[_0x189c('0x28')](respondWithResult(_0x425d2e,null))[_0x189c('0x4a')](handleError(_0x425d2e,null));};exports['removeAgents']=function(_0x1ca748,_0x3c562b,_0x29e667){return db[_0x189c('0x33')][_0x189c('0x52')]({'where':{'id':_0x1ca748[_0x189c('0x4b')]['id']}})[_0x189c('0x28')](handleEntityNotFound(_0x3c562b,null))[_0x189c('0x28')](function(_0x213b5b){if(_0x213b5b){return _0x213b5b['removeAgents'](_0x1ca748[_0x189c('0x3a')]['ids'])[_0x189c('0x28')](function(){if(_['isArray'](_0x1ca748[_0x189c('0x3a')][_0x189c('0x63')])){for(var _0x3c3363=0x0;_0x3c3363<_0x1ca748['query'][_0x189c('0x63')][_0x189c('0x3d')];_0x3c3363+=0x1){socket['emit'](_0x189c('0x87'),{'UserId':Number(_0x1ca748['query'][_0x189c('0x63')][_0x3c3363]),'WhatsappQueueId':Number(_0x1ca748[_0x189c('0x4b')]['id'])});}}else{socket[_0x189c('0x6c')](_0x189c('0x87'),{'UserId':Number(_0x1ca748[_0x189c('0x3a')][_0x189c('0x63')]),'WhatsappQueueId':Number(_0x1ca748['params']['id'])});}});}})[_0x189c('0x28')](respondWithStatusCode(_0x3c562b,null))[_0x189c('0x4a')](handleError(_0x3c562b,null));};exports[_0x189c('0x88')]=function(_0x29c130,_0x79114f,_0x16f1ae){var _0x2136a9={};var _0x4f155c={};var _0x5d8e5b;var _0x4967f5;return db[_0x189c('0x33')][_0x189c('0x58')]({'where':{'id':_0x29c130['params']['id']}})['then'](handleEntityNotFound(_0x79114f,null))[_0x189c('0x28')](function(_0x3c5ad0){if(_0x3c5ad0){_0x5d8e5b=_0x3c5ad0;_0x4f155c[_0x189c('0x36')]=_[_0x189c('0x37')](db[_0x189c('0x65')][_0x189c('0x34')]);_0x4f155c['query']=_[_0x189c('0x37')](_0x29c130['query']);_0x4f155c[_0x189c('0x38')]=_[_0x189c('0x39')](_0x4f155c['model'],_0x4f155c['query']);_0x2136a9[_0x189c('0x3b')]=_['intersection'](_0x4f155c[_0x189c('0x36')],qs[_0x189c('0x3c')](_0x29c130['query'][_0x189c('0x3c')]));_0x2136a9['attributes']=_0x2136a9[_0x189c('0x3b')]['length']?_0x2136a9[_0x189c('0x3b')]:_0x4f155c[_0x189c('0x36')];_0x2136a9[_0x189c('0x3f')]=qs[_0x189c('0x40')](_0x29c130['query']['sort']);_0x2136a9[_0x189c('0x41')]=qs[_0x189c('0x38')](_[_0x189c('0x42')](_0x29c130['query'],_0x4f155c[_0x189c('0x38')]));if(_0x29c130['query']['filter']){_0x2136a9[_0x189c('0x41')]=_['merge'](_0x2136a9[_0x189c('0x41')],{'$or':_[_0x189c('0x32')](_0x2136a9[_0x189c('0x3b')],function(_0x2bd903){var _0x1bc61c={};_0x1bc61c[_0x2bd903]={'$like':'%'+_0x29c130[_0x189c('0x3a')][_0x189c('0x5c')]+'%'};return _0x1bc61c;})});}_0x2136a9=_['merge']({},_0x2136a9,_0x29c130[_0x189c('0x46')]);return _0x5d8e5b[_0x189c('0x88')](_0x2136a9);}})[_0x189c('0x28')](function(_0x2511c6){if(_0x2511c6){_0x4967f5=_0x2511c6[_0x189c('0x3d')];if(!_0x29c130[_0x189c('0x3a')][_0x189c('0x3e')](_0x189c('0x5a'))){_0x2136a9[_0x189c('0x1f')]=qs[_0x189c('0x1f')](_0x29c130[_0x189c('0x3a')][_0x189c('0x1f')]);_0x2136a9[_0x189c('0x20')]=qs[_0x189c('0x20')](_0x29c130[_0x189c('0x3a')][_0x189c('0x20')]);}return _0x5d8e5b[_0x189c('0x88')](_0x2136a9);}})[_0x189c('0x28')](function(_0x21bd8d){if(_0x21bd8d){return _0x21bd8d?{'count':_0x4967f5,'rows':_0x21bd8d}:null;}})[_0x189c('0x28')](respondWithResult(_0x79114f,null))[_0x189c('0x4a')](handleError(_0x79114f,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index a4bc4e9..e65441e 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 _0xb439=['hook','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x2539ba,_0x2a256d){var _0x1d8b0c=function(_0x45f378){while(--_0x45f378){_0x2539ba['push'](_0x2539ba['shift']());}};_0x1d8b0c(++_0x2a256d);}(_0xb439,0x1a9));var _0x9b43=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xb439[_0x16b9ed];return _0x66b1f8;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x9b43('0x0'))['db'][_0x9b43('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9b43('0x2')](0x0);var events={'afterCreate':_0x9b43('0x3'),'afterUpdate':_0x9b43('0x4'),'afterDestroy':'remove'};function emitEvent(_0x256e8d){return function(_0x2bdacf,_0x42fb1f,_0x1e8944){WhatsappQueueEvents[_0x9b43('0x5')](_0x256e8d+':'+_0x2bdacf['id'],_0x2bdacf);WhatsappQueueEvents[_0x9b43('0x5')](_0x256e8d,_0x2bdacf);_0x1e8944(null);};}for(var e in events){if(events[_0x9b43('0x6')](e)){var event=events[e];WhatsappQueue[_0x9b43('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0xd7bb=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','save','update'];(function(_0x29ff49,_0x2c89aa){var _0x2fc937=function(_0x3ddefa){while(--_0x3ddefa){_0x29ff49['push'](_0x29ff49['shift']());}};_0x2fc937(++_0x2c89aa);}(_0xd7bb,0x69));var _0xbd7b=function(_0x971645,_0x15ac54){_0x971645=_0x971645-0x0;var _0x5c08fd=_0xd7bb[_0x971645];return _0x5c08fd;};'use strict';var EventEmitter=require(_0xbd7b('0x0'));var WhatsappQueue=require(_0xbd7b('0x1'))['db'][_0xbd7b('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbd7b('0x3'),'afterUpdate':_0xbd7b('0x4'),'afterDestroy':_0xbd7b('0x5')};function emitEvent(_0x1bd8db){return function(_0x581fee,_0x362236,_0x815f25){WhatsappQueueEvents[_0xbd7b('0x6')](_0x1bd8db+':'+_0x581fee['id'],_0x581fee);WhatsappQueueEvents[_0xbd7b('0x6')](_0x1bd8db,_0x581fee);_0x815f25(null);};}for(var e in events){if(events[_0xbd7b('0x7')](e)){var event=events[e];WhatsappQueue[_0xbd7b('0x8')](e,emitEvent(event));}}module[_0xbd7b('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 6f58041..c17b940 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 _0x1bf1=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x366f31,_0x4b79d5){var _0x1d5e19=function(_0x4ebbec){while(--_0x4ebbec){_0x366f31['push'](_0x366f31['shift']());}};_0x1d5e19(++_0x4b79d5);}(_0x1bf1,0x122));var _0x11bf=function(_0x2304ce,_0x5e2bb0){_0x2304ce=_0x2304ce-0x0;var _0x503964=_0x1bf1[_0x2304ce];return _0x503964;};'use strict';var _=require(_0x11bf('0x0'));var util=require(_0x11bf('0x1'));var logger=require(_0x11bf('0x2'))(_0x11bf('0x3'));var moment=require(_0x11bf('0x4'));var BPromise=require(_0x11bf('0x5'));var rp=require(_0x11bf('0x6'));var fs=require('fs');var path=require(_0x11bf('0x7'));var rimraf=require(_0x11bf('0x8'));var config=require(_0x11bf('0x9'));var attributes=require(_0x11bf('0xa'));module['exports']=function(_0xa2a468,_0x13da23){return _0xa2a468[_0x11bf('0xb')](_0x11bf('0xc'),attributes,{'tableName':_0x11bf('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a07=['define','whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./whatsappQueue.attributes','exports'];(function(_0x59bd7c,_0x24bc40){var _0x628246=function(_0x392251){while(--_0x392251){_0x59bd7c['push'](_0x59bd7c['shift']());}};_0x628246(++_0x24bc40);}(_0x9a07,0x136));var _0x79a0=function(_0x4715ef,_0x40a7b7){_0x4715ef=_0x4715ef-0x0;var _0x1162cc=_0x9a07[_0x4715ef];return _0x1162cc;};'use strict';var _=require(_0x79a0('0x0'));var util=require(_0x79a0('0x1'));var logger=require(_0x79a0('0x2'))('api');var moment=require(_0x79a0('0x3'));var BPromise=require(_0x79a0('0x4'));var rp=require(_0x79a0('0x5'));var fs=require('fs');var path=require(_0x79a0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x79a0('0x7'));module[_0x79a0('0x8')]=function(_0x29e7d3,_0x354c9f){return _0x29e7d3[_0x79a0('0x9')]('WhatsappQueue',attributes,{'tableName':_0x79a0('0xa'),'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 1f914af..9838ee0 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 _0xd30b=['ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','localhost','redis','./whatsappQueue.socket','register','then','info','debug','request\x20sent','stringify','error','code','message','WhatsappQueue,\x20%s,\x20%s','catch','GetWhatsappQueue','findAll','options','raw','attributes','map','include','model','where'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xd30b,0xdf));var _0xbd30=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0xd30b[_0x381589];return _0x2a075d;};'use strict';var _=require(_0xbd30('0x0'));var util=require(_0xbd30('0x1'));var moment=require(_0xbd30('0x2'));var BPromise=require(_0xbd30('0x3'));var rs=require(_0xbd30('0x4'));var fs=require('fs');var Redis=require(_0xbd30('0x5'));var db=require(_0xbd30('0x6'))['db'];var utils=require(_0xbd30('0x7'));var logger=require('../../config/logger')(_0xbd30('0x8'));var config=require(_0xbd30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbd30('0xa')][_0xbd30('0xb')]({'port':0x232a});config['redis']=_[_0xbd30('0xc')](config['redis'],{'host':_0xbd30('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd30('0xe')]));require(_0xbd30('0xf'))[_0xbd30('0x10')](socket);function respondWithRpcPromise(_0x1099a4,_0xbb2ae9,_0x120def){return new BPromise(function(_0x2f9f68,_0x579299){return client['request'](_0x1099a4,_0x120def)[_0xbd30('0x11')](function(_0x557495){logger[_0xbd30('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0xbb2ae9,'request\x20sent');logger[_0xbd30('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0xbb2ae9,_0xbd30('0x14'),JSON[_0xbd30('0x15')](_0x557495));if(_0x557495[_0xbd30('0x16')]){if(_0x557495['error'][_0xbd30('0x17')]===0x1f4){logger[_0xbd30('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0xbb2ae9,_0x557495[_0xbd30('0x16')][_0xbd30('0x18')]);return _0x579299(_0x557495[_0xbd30('0x16')][_0xbd30('0x18')]);}logger[_0xbd30('0x16')](_0xbd30('0x19'),_0xbb2ae9,_0x557495['error'][_0xbd30('0x18')]);return _0x2f9f68(_0x557495[_0xbd30('0x16')][_0xbd30('0x18')]);}else{logger[_0xbd30('0x12')](_0xbd30('0x19'),_0xbb2ae9,'request\x20sent');_0x2f9f68(_0x557495['result'][_0xbd30('0x18')]);}})[_0xbd30('0x1a')](function(_0x272e3a){logger['error'](_0xbd30('0x19'),_0xbb2ae9,_0x272e3a);_0x579299(_0x272e3a);});});}exports[_0xbd30('0x1b')]=function(_0x325d89){var _0x8cc2ab=this;return new Promise(function(_0xc8b663,_0x398677){return db['WhatsappQueue'][_0xbd30('0x1c')]({'raw':_0x325d89[_0xbd30('0x1d')]?_0x325d89[_0xbd30('0x1d')][_0xbd30('0x1e')]===undefined?!![]:![]:!![],'where':_0x325d89[_0xbd30('0x1d')]?_0x325d89[_0xbd30('0x1d')]['where']||null:null,'attributes':_0x325d89[_0xbd30('0x1d')]?_0x325d89[_0xbd30('0x1d')][_0xbd30('0x1f')]||null:null,'limit':_0x325d89[_0xbd30('0x1d')]?_0x325d89[_0xbd30('0x1d')]['limit']||null:null,'include':_0x325d89[_0xbd30('0x1d')]?_0x325d89['options']['include']?_[_0xbd30('0x20')](_0x325d89[_0xbd30('0x1d')][_0xbd30('0x21')],function(_0x1e7790){return{'model':db[_0x1e7790[_0xbd30('0x22')]],'as':_0x1e7790['as'],'attributes':_0x1e7790[_0xbd30('0x1f')],'include':_0x1e7790[_0xbd30('0x21')]?_[_0xbd30('0x20')](_0x1e7790[_0xbd30('0x21')],function(_0x8091b6){return{'model':db[_0x8091b6[_0xbd30('0x22')]],'as':_0x8091b6['as'],'attributes':_0x8091b6[_0xbd30('0x1f')],'include':_0x8091b6[_0xbd30('0x21')]?_[_0xbd30('0x20')](_0x8091b6[_0xbd30('0x21')],function(_0x35637d){return{'model':db[_0x35637d[_0xbd30('0x22')]],'as':_0x35637d['as'],'attributes':_0x35637d[_0xbd30('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32fcdb){logger['info'](_0xbd30('0x1b'),_0x325d89);logger[_0xbd30('0x13')](_0xbd30('0x1b'),_0x325d89,JSON[_0xbd30('0x15')](_0x32fcdb));_0xc8b663(_0x32fcdb);})[_0xbd30('0x1a')](function(_0x49c1cc){logger['error'](_0xbd30('0x1b'),_0x49c1cc[_0xbd30('0x18')],_0x325d89);_0x398677(_0x8cc2ab[_0xbd30('0x16')](0x1f4,_0x49c1cc['message']));});});};exports['ShowWhatsappQueue']=function(_0x23d90c){var _0x3b03a8=this;return new Promise(function(_0x5acbda,_0x399166){return db['WhatsappQueue']['find']({'raw':_0x23d90c[_0xbd30('0x1d')]?_0x23d90c[_0xbd30('0x1d')][_0xbd30('0x1e')]===undefined?!![]:![]:!![],'where':_0x23d90c['options']?_0x23d90c['options'][_0xbd30('0x23')]||null:null,'attributes':_0x23d90c[_0xbd30('0x1d')]?_0x23d90c[_0xbd30('0x1d')]['attributes']||null:null,'include':_0x23d90c['options']?_0x23d90c['options']['include']?_['map'](_0x23d90c[_0xbd30('0x1d')][_0xbd30('0x21')],function(_0x3ed9ed){return{'model':db[_0x3ed9ed[_0xbd30('0x22')]],'as':_0x3ed9ed['as'],'attributes':_0x3ed9ed[_0xbd30('0x1f')],'include':_0x3ed9ed[_0xbd30('0x21')]?_['map'](_0x3ed9ed[_0xbd30('0x21')],function(_0x51566f){return{'model':db[_0x51566f['model']],'as':_0x51566f['as'],'attributes':_0x51566f[_0xbd30('0x1f')],'include':_0x51566f['include']?_[_0xbd30('0x20')](_0x51566f[_0xbd30('0x21')],function(_0x56ff54){return{'model':db[_0x56ff54[_0xbd30('0x22')]],'as':_0x56ff54['as'],'attributes':_0x56ff54[_0xbd30('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41d847){logger[_0xbd30('0x12')](_0xbd30('0x24'),_0x23d90c);logger[_0xbd30('0x13')]('ShowWhatsappQueue',_0x23d90c,JSON[_0xbd30('0x15')](_0x41d847));_0x5acbda(_0x41d847);})[_0xbd30('0x1a')](function(_0x463b26){logger[_0xbd30('0x16')]('ShowWhatsappQueue',_0x463b26[_0xbd30('0x18')],_0x23d90c);_0x399166(_0x3b03a8[_0xbd30('0x16')](0x1f4,_0x463b26['message']));});});}; \ No newline at end of file +var _0xc832=['debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','map','include','model','find','ShowWhatsappQueue','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x1c2f29,_0x5a2668){var _0x258465=function(_0x30332f){while(--_0x30332f){_0x1c2f29['push'](_0x1c2f29['shift']());}};_0x258465(++_0x5a2668);}(_0xc832,0x1f4));var _0x2c83=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xc832[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x2c83('0x0'));var util=require('util');var moment=require(_0x2c83('0x1'));var BPromise=require(_0x2c83('0x2'));var rs=require(_0x2c83('0x3'));var fs=require('fs');var Redis=require(_0x2c83('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2c83('0x5'));var logger=require('../../config/logger')(_0x2c83('0x6'));var config=require(_0x2c83('0x7'));var jayson=require(_0x2c83('0x8'));var client=jayson[_0x2c83('0x9')][_0x2c83('0xa')]({'port':0x232a});config[_0x2c83('0xb')]=_[_0x2c83('0xc')](config[_0x2c83('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x2c83('0xd'))(new Redis(config[_0x2c83('0xb')]));require(_0x2c83('0xe'))['register'](socket);function respondWithRpcPromise(_0x163592,_0x3d324f,_0x5a374c){return new BPromise(function(_0x47a8d2,_0x4e8a97){return client[_0x2c83('0xf')](_0x163592,_0x5a374c)[_0x2c83('0x10')](function(_0x562e23){logger[_0x2c83('0x11')](_0x2c83('0x12'),_0x3d324f,_0x2c83('0x13'));logger[_0x2c83('0x14')](_0x2c83('0x15'),_0x3d324f,_0x2c83('0x13'),JSON[_0x2c83('0x16')](_0x562e23));if(_0x562e23[_0x2c83('0x17')]){if(_0x562e23['error'][_0x2c83('0x18')]===0x1f4){logger[_0x2c83('0x17')](_0x2c83('0x12'),_0x3d324f,_0x562e23[_0x2c83('0x17')][_0x2c83('0x19')]);return _0x4e8a97(_0x562e23['error'][_0x2c83('0x19')]);}logger[_0x2c83('0x17')](_0x2c83('0x12'),_0x3d324f,_0x562e23['error'][_0x2c83('0x19')]);return _0x47a8d2(_0x562e23['error'][_0x2c83('0x19')]);}else{logger[_0x2c83('0x11')](_0x2c83('0x12'),_0x3d324f,_0x2c83('0x13'));_0x47a8d2(_0x562e23[_0x2c83('0x1a')][_0x2c83('0x19')]);}})['catch'](function(_0x485284){logger[_0x2c83('0x17')](_0x2c83('0x12'),_0x3d324f,_0x485284);_0x4e8a97(_0x485284);});});}exports[_0x2c83('0x1b')]=function(_0xf26070){var _0xc638c9=this;return new Promise(function(_0x41b23d,_0x166fe4){return db[_0x2c83('0x1c')][_0x2c83('0x1d')]({'raw':_0xf26070[_0x2c83('0x1e')]?_0xf26070[_0x2c83('0x1e')][_0x2c83('0x1f')]===undefined?!![]:![]:!![],'where':_0xf26070['options']?_0xf26070[_0x2c83('0x1e')][_0x2c83('0x20')]||null:null,'attributes':_0xf26070[_0x2c83('0x1e')]?_0xf26070[_0x2c83('0x1e')][_0x2c83('0x21')]||null:null,'limit':_0xf26070['options']?_0xf26070[_0x2c83('0x1e')]['limit']||null:null,'include':_0xf26070['options']?_0xf26070[_0x2c83('0x1e')]['include']?_[_0x2c83('0x22')](_0xf26070['options'][_0x2c83('0x23')],function(_0x43c23d){return{'model':db[_0x43c23d['model']],'as':_0x43c23d['as'],'attributes':_0x43c23d[_0x2c83('0x21')],'include':_0x43c23d['include']?_['map'](_0x43c23d[_0x2c83('0x23')],function(_0x414860){return{'model':db[_0x414860[_0x2c83('0x24')]],'as':_0x414860['as'],'attributes':_0x414860[_0x2c83('0x21')],'include':_0x414860['include']?_[_0x2c83('0x22')](_0x414860[_0x2c83('0x23')],function(_0x4f0324){return{'model':db[_0x4f0324[_0x2c83('0x24')]],'as':_0x4f0324['as'],'attributes':_0x4f0324['attributes']};}):[]};}):[]};}):[]:[]})[_0x2c83('0x10')](function(_0x5b8240){logger[_0x2c83('0x11')]('GetWhatsappQueue',_0xf26070);logger[_0x2c83('0x14')](_0x2c83('0x1b'),_0xf26070,JSON[_0x2c83('0x16')](_0x5b8240));_0x41b23d(_0x5b8240);})['catch'](function(_0x36aa80){logger[_0x2c83('0x17')](_0x2c83('0x1b'),_0x36aa80[_0x2c83('0x19')],_0xf26070);_0x166fe4(_0xc638c9[_0x2c83('0x17')](0x1f4,_0x36aa80[_0x2c83('0x19')]));});});};exports['ShowWhatsappQueue']=function(_0x1b5ea6){var _0xe4dedf=this;return new Promise(function(_0xe61b6d,_0x51d00d){return db[_0x2c83('0x1c')][_0x2c83('0x25')]({'raw':_0x1b5ea6['options']?_0x1b5ea6['options'][_0x2c83('0x1f')]===undefined?!![]:![]:!![],'where':_0x1b5ea6[_0x2c83('0x1e')]?_0x1b5ea6[_0x2c83('0x1e')]['where']||null:null,'attributes':_0x1b5ea6[_0x2c83('0x1e')]?_0x1b5ea6[_0x2c83('0x1e')][_0x2c83('0x21')]||null:null,'include':_0x1b5ea6['options']?_0x1b5ea6[_0x2c83('0x1e')]['include']?_[_0x2c83('0x22')](_0x1b5ea6[_0x2c83('0x1e')][_0x2c83('0x23')],function(_0x1a812b){return{'model':db[_0x1a812b[_0x2c83('0x24')]],'as':_0x1a812b['as'],'attributes':_0x1a812b[_0x2c83('0x21')],'include':_0x1a812b[_0x2c83('0x23')]?_[_0x2c83('0x22')](_0x1a812b['include'],function(_0x5a31a1){return{'model':db[_0x5a31a1[_0x2c83('0x24')]],'as':_0x5a31a1['as'],'attributes':_0x5a31a1[_0x2c83('0x21')],'include':_0x5a31a1[_0x2c83('0x23')]?_[_0x2c83('0x22')](_0x5a31a1[_0x2c83('0x23')],function(_0x58a9e3){return{'model':db[_0x58a9e3[_0x2c83('0x24')]],'as':_0x58a9e3['as'],'attributes':_0x58a9e3['attributes']};}):[]};}):[]};}):[]:[]})[_0x2c83('0x10')](function(_0x3dd04c){logger['info'](_0x2c83('0x26'),_0x1b5ea6);logger[_0x2c83('0x14')]('ShowWhatsappQueue',_0x1b5ea6,JSON[_0x2c83('0x16')](_0x3dd04c));_0xe61b6d(_0x3dd04c);})[_0x2c83('0x27')](function(_0x38b9c4){logger[_0x2c83('0x17')](_0x2c83('0x26'),_0x38b9c4[_0x2c83('0x19')],_0x1b5ea6);_0x51d00d(_0xe4dedf['error'](0x1f4,_0x38b9c4['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 6a0819e..eb6fbf8 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 _0xa361=['removeListener','./whatsappQueue.events','save','remove','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa361,0x187));var _0x1a36=function(_0x18ca32,_0x136bd4){_0x18ca32=_0x18ca32-0x0;var _0x23761a=_0xa361[_0x18ca32];return _0x23761a;};'use strict';var WhatsappQueueEvents=require(_0x1a36('0x0'));var events=[_0x1a36('0x1'),_0x1a36('0x2'),_0x1a36('0x3')];function createListener(_0xe6dc9,_0x57df1d){return function(_0x22a3ca){_0x57df1d[_0x1a36('0x4')](_0xe6dc9,_0x22a3ca);};}function removeListener(_0x5b9c0c,_0x5dbffc){return function(){WhatsappQueueEvents[_0x1a36('0x5')](_0x5b9c0c,_0x5dbffc);};}exports['register']=function(_0x171f6b){for(var _0x3992e9=0x0,_0x453a19=events['length'];_0x3992e9<_0x453a19;_0x3992e9++){var _0x92694a=events[_0x3992e9];var _0x5b80ab=createListener('whatsappQueue:'+_0x92694a,_0x171f6b);WhatsappQueueEvents['on'](_0x92694a,_0x5b80ab);}}; \ No newline at end of file +var _0x72cd=['emit','register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update'];(function(_0x35ccee,_0x482dec){var _0x2907cf=function(_0x11df84){while(--_0x11df84){_0x35ccee['push'](_0x35ccee['shift']());}};_0x2907cf(++_0x482dec);}(_0x72cd,0x15c));var _0xd72c=function(_0x393d16,_0xe1375e){_0x393d16=_0x393d16-0x0;var _0xa84bf6=_0x72cd[_0x393d16];return _0xa84bf6;};'use strict';var WhatsappQueueEvents=require(_0xd72c('0x0'));var events=[_0xd72c('0x1'),_0xd72c('0x2'),_0xd72c('0x3')];function createListener(_0x133153,_0xc84b8){return function(_0xd8aaf3){_0xc84b8[_0xd72c('0x4')](_0x133153,_0xd8aaf3);};}function removeListener(_0x47282e,_0x19d4b6){return function(){WhatsappQueueEvents['removeListener'](_0x47282e,_0x19d4b6);};}exports[_0xd72c('0x5')]=function(_0x278bf1){for(var _0x3c9d32=0x0,_0x5a7ef1=events[_0xd72c('0x6')];_0x3c9d32<_0x5a7ef1;_0x3c9d32++){var _0x5e0a75=events[_0x3c9d32];var _0x2a5249=createListener(_0xd72c('0x7')+_0x5e0a75,_0x278bf1);WhatsappQueueEvents['on'](_0x5e0a75,_0x2a5249);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 8bc9f0c..76a2510 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 _0x62d0=['fs-extra','../../components/auth/service','isAuthenticated','index','get','describe','/:id','post','create','put','delete','destroy','exports','util','path','connect-timeout','Router'];(function(_0x4ea955,_0x1eda76){var _0x558561=function(_0x5b20f4){while(--_0x5b20f4){_0x4ea955['push'](_0x4ea955['shift']());}};_0x558561(++_0x1eda76);}(_0x62d0,0x95));var _0x062d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x62d0[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0x062d('0x0'));var path=require(_0x062d('0x1'));var timeout=require(_0x062d('0x2'));var express=require('express');var router=express[_0x062d('0x3')]();var fs_extra=require(_0x062d('0x4'));var auth=require(_0x062d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x062d('0x6')](),controller[_0x062d('0x7')]);router[_0x062d('0x8')]('/describe',auth[_0x062d('0x6')](),controller[_0x062d('0x9')]);router[_0x062d('0x8')](_0x062d('0xa'),auth[_0x062d('0x6')](),controller['show']);router[_0x062d('0xb')]('/',auth['isAuthenticated'](),controller[_0x062d('0xc')]);router[_0x062d('0xd')](_0x062d('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x062d('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x062d('0xf')]);module[_0x062d('0x10')]=router; \ No newline at end of file +var _0xdacf=['post','create','put','/:id','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','isAuthenticated','show'];(function(_0x3463fd,_0x430c1d){var _0x256d6e=function(_0x4aed00){while(--_0x4aed00){_0x3463fd['push'](_0x3463fd['shift']());}};_0x256d6e(++_0x430c1d);}(_0xdacf,0x16d));var _0xfdac=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xdacf[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0xfdac('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdac('0x1'));var router=express[_0xfdac('0x2')]();var fs_extra=require(_0xfdac('0x3'));var auth=require(_0xfdac('0x4'));var interaction=require(_0xfdac('0x5'));var config=require(_0xfdac('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0xfdac('0x7')]('/',auth['isAuthenticated'](),controller[_0xfdac('0x8')]);router[_0xfdac('0x7')](_0xfdac('0x9'),auth['isAuthenticated'](),controller[_0xfdac('0xa')]);router[_0xfdac('0x7')]('/:id',auth[_0xfdac('0xb')](),controller[_0xfdac('0xc')]);router[_0xfdac('0xd')]('/',auth['isAuthenticated'](),controller[_0xfdac('0xe')]);router[_0xfdac('0xf')](_0xfdac('0x10'),auth[_0xfdac('0xb')](),controller[_0xfdac('0x11')]);router[_0xfdac('0x12')](_0xfdac('0x10'),auth[_0xfdac('0xb')](),controller[_0xfdac('0x13')]);module[_0xfdac('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index c04b50d..29e958e 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x334d6d,_0x567864){var _0xb532a6=function(_0x199490){while(--_0x199490){_0x334d6d['push'](_0x334d6d['shift']());}};_0xb532a6(++_0x567864);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x388929,_0x14a26c){var _0x21b62d=function(_0x4a90b3){while(--_0x4a90b3){_0x388929['push'](_0x388929['shift']());}};_0x21b62d(++_0x14a26c);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 89985e2..eaf3ed9 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 _0x0565=['length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','WhatsappQueueReport','includeAll','findAll','rows','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes'];(function(_0xf6c510,_0x38658f){var _0x18fa72=function(_0x22bb6b){while(--_0x22bb6b){_0xf6c510['push'](_0xf6c510['shift']());}};_0x18fa72(++_0x38658f);}(_0x0565,0xf2));var _0x5056=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x0565[_0x47aa64];return _0x549c7a;};'use strict';var emlformat=require(_0x5056('0x0'));var rimraf=require(_0x5056('0x1'));var zipdir=require(_0x5056('0x2'));var jsonpatch=require(_0x5056('0x3'));var rp=require(_0x5056('0x4'));var moment=require(_0x5056('0x5'));var BPromise=require(_0x5056('0x6'));var Mustache=require(_0x5056('0x7'));var util=require(_0x5056('0x8'));var path=require(_0x5056('0x9'));var sox=require('sox');var csv=require(_0x5056('0xa'));var ejs=require(_0x5056('0xb'));var fs=require('fs');var fs_extra=require(_0x5056('0xc'));var _=require(_0x5056('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5056('0xe'));var deskjs=require(_0x5056('0xf'));var toCsv=require(_0x5056('0xa'));var querystring=require(_0x5056('0x10'));var Papa=require(_0x5056('0x11'));var Redis=require(_0x5056('0x12'));var authService=require(_0x5056('0x13'));var qs=require(_0x5056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5056('0x15'));var logger=require(_0x5056('0x16'))(_0x5056('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5056('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x548bcf,_0x53e98a){_0x53e98a=_0x53e98a||0xcc;return function(_0x2d44fb){if(_0x2d44fb){return _0x548bcf['sendStatus'](_0x53e98a);}return _0x548bcf[_0x5056('0x19')](_0x53e98a)[_0x5056('0x1a')]();};}function respondWithResult(_0x7af76b,_0x543cee){_0x543cee=_0x543cee||0xc8;return function(_0x1e8b64){if(_0x1e8b64){return _0x7af76b[_0x5056('0x19')](_0x543cee)[_0x5056('0x1b')](_0x1e8b64);}};}function respondWithFilteredResult(_0x56c3ef,_0x21561d){return function(_0x6a044a){if(_0x6a044a){var _0x4ac332=typeof _0x21561d[_0x5056('0x1c')]==='undefined'&&typeof _0x21561d[_0x5056('0x1d')]===_0x5056('0x1e');var _0x1c0ee9=_0x6a044a[_0x5056('0x1f')];var _0x4056ce=_0x4ac332?0x0:_0x21561d['offset'];var _0x9ea88=_0x4ac332?_0x6a044a[_0x5056('0x1f')]:_0x21561d['offset']+_0x21561d['limit'];var _0x20776c;if(_0x9ea88>=_0x1c0ee9){_0x9ea88=_0x1c0ee9;_0x20776c=0xc8;}else{_0x20776c=0xce;}_0x56c3ef[_0x5056('0x19')](_0x20776c);return _0x56c3ef[_0x5056('0x20')](_0x5056('0x21'),_0x4056ce+'-'+_0x9ea88+'/'+_0x1c0ee9)[_0x5056('0x1b')](_0x6a044a);}return null;};}function patchUpdates(_0xf04e08){return function(_0x33035c){try{jsonpatch['apply'](_0x33035c,_0xf04e08,!![]);}catch(_0x13b363){return BPromise[_0x5056('0x22')](_0x13b363);}return _0x33035c['save']();};}function saveUpdates(_0x271efc,_0x1bccef){return function(_0x2564d0){if(_0x2564d0){return _0x2564d0['update'](_0x271efc)[_0x5056('0x23')](function(_0x26a3c2){return _0x26a3c2;});}return null;};}function removeEntity(_0x5afbfe,_0x4a64be){return function(_0x29e166){if(_0x29e166){return _0x29e166[_0x5056('0x24')]()[_0x5056('0x23')](function(){_0x5afbfe[_0x5056('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x267048,_0x25409f){return function(_0x5d1656){if(!_0x5d1656){_0x267048[_0x5056('0x25')](0x194);}return _0x5d1656;};}function handleError(_0x505ccf,_0x15f03f){_0x15f03f=_0x15f03f||0x1f4;return function(_0x39d539){logger[_0x5056('0x26')](_0x39d539[_0x5056('0x27')]);if(_0x39d539[_0x5056('0x28')]){delete _0x39d539['name'];}_0x505ccf[_0x5056('0x19')](_0x15f03f)[_0x5056('0x29')](_0x39d539);};}exports[_0x5056('0x2a')]=function(_0x2ac79a,_0x53e6db){var _0x24d33e={},_0x5b0270={},_0x70246c={'count':0x0,'rows':[]};var _0x49fe67=_['map'](db['WhatsappQueueReport'][_0x5056('0x2b')],function(_0x252f75){return{'name':_0x252f75['fieldName'],'type':_0x252f75[_0x5056('0x2c')][_0x5056('0x2d')]};});_0x5b0270[_0x5056('0x2e')]=_[_0x5056('0x2f')](_0x49fe67,_0x5056('0x28'));_0x5b0270[_0x5056('0x30')]=_[_0x5056('0x31')](_0x2ac79a[_0x5056('0x30')]);_0x5b0270[_0x5056('0x32')]=_[_0x5056('0x33')](_0x5b0270[_0x5056('0x2e')],_0x5b0270['query']);_0x24d33e['attributes']=_[_0x5056('0x33')](_0x5b0270[_0x5056('0x2e')],qs['fields'](_0x2ac79a[_0x5056('0x30')][_0x5056('0x34')]));_0x24d33e['attributes']=_0x24d33e[_0x5056('0x35')][_0x5056('0x36')]?_0x24d33e[_0x5056('0x35')]:_0x5b0270[_0x5056('0x2e')];if(!_0x2ac79a[_0x5056('0x30')][_0x5056('0x37')](_0x5056('0x38'))){_0x24d33e[_0x5056('0x1d')]=qs[_0x5056('0x1d')](_0x2ac79a[_0x5056('0x30')][_0x5056('0x1d')]);_0x24d33e[_0x5056('0x1c')]=qs[_0x5056('0x1c')](_0x2ac79a[_0x5056('0x30')][_0x5056('0x1c')]);}_0x24d33e['order']=qs[_0x5056('0x39')](_0x2ac79a['query'][_0x5056('0x39')]);_0x24d33e[_0x5056('0x3a')]=qs[_0x5056('0x32')](_[_0x5056('0x3b')](_0x2ac79a['query'],_0x5b0270[_0x5056('0x32')]),_0x49fe67);if(_0x2ac79a[_0x5056('0x30')]['filter']){_0x24d33e[_0x5056('0x3a')]=_['merge'](_0x24d33e[_0x5056('0x3a')],{'$or':_[_0x5056('0x2f')](_0x49fe67,function(_0x3d56cf){if(_0x3d56cf['type']!==_0x5056('0x3c')){var _0x16a940={};_0x16a940[_0x3d56cf[_0x5056('0x28')]]={'$like':'%'+_0x2ac79a[_0x5056('0x30')][_0x5056('0x3d')]+'%'};return _0x16a940;}})});}_0x24d33e=_[_0x5056('0x3e')]({},_0x24d33e,_0x2ac79a[_0x5056('0x3f')]);var _0x21aa75={'where':_0x24d33e[_0x5056('0x3a')]};return db[_0x5056('0x40')][_0x5056('0x1f')](_0x21aa75)[_0x5056('0x23')](function(_0xc1024a){_0x70246c[_0x5056('0x1f')]=_0xc1024a;if(_0x2ac79a[_0x5056('0x30')][_0x5056('0x41')]){_0x24d33e['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x5056('0x42')](_0x24d33e);})[_0x5056('0x23')](function(_0x6946b4){_0x70246c[_0x5056('0x43')]=_0x6946b4;return _0x70246c;})[_0x5056('0x23')](respondWithFilteredResult(_0x53e6db,_0x24d33e))[_0x5056('0x44')](handleError(_0x53e6db,null));};exports[_0x5056('0x45')]=function(_0x2bf472,_0x48ab5e){var _0x58f12f={'raw':!![],'where':{'id':_0x2bf472[_0x5056('0x46')]['id']}},_0x68a385={};_0x68a385[_0x5056('0x2e')]=_['keys'](db[_0x5056('0x40')]['rawAttributes']);_0x68a385[_0x5056('0x30')]=_[_0x5056('0x31')](_0x2bf472[_0x5056('0x30')]);_0x68a385[_0x5056('0x32')]=_[_0x5056('0x33')](_0x68a385[_0x5056('0x2e')],_0x68a385['query']);_0x58f12f[_0x5056('0x35')]=_[_0x5056('0x33')](_0x68a385[_0x5056('0x2e')],qs['fields'](_0x2bf472['query']['fields']));_0x58f12f['attributes']=_0x58f12f[_0x5056('0x35')][_0x5056('0x36')]?_0x58f12f[_0x5056('0x35')]:_0x68a385[_0x5056('0x2e')];if(_0x2bf472[_0x5056('0x30')]['includeAll']){_0x58f12f['include']=[{'all':!![]}];}_0x58f12f=_[_0x5056('0x3e')]({},_0x58f12f,_0x2bf472[_0x5056('0x3f')]);return db[_0x5056('0x40')][_0x5056('0x47')](_0x58f12f)[_0x5056('0x23')](handleEntityNotFound(_0x48ab5e,null))[_0x5056('0x23')](respondWithResult(_0x48ab5e,null))[_0x5056('0x44')](handleError(_0x48ab5e,null));};exports['create']=function(_0x52d6ea,_0x14e3f5){return db[_0x5056('0x40')]['create'](_0x52d6ea[_0x5056('0x48')],{})[_0x5056('0x23')](respondWithResult(_0x14e3f5,0xc9))['catch'](handleError(_0x14e3f5,null));};exports['update']=function(_0x83d8e4,_0x1ab1a9){if(_0x83d8e4['body']['id']){delete _0x83d8e4['body']['id'];}return db[_0x5056('0x40')][_0x5056('0x47')]({'where':{'id':_0x83d8e4['params']['id']}})['then'](handleEntityNotFound(_0x1ab1a9,null))[_0x5056('0x23')](saveUpdates(_0x83d8e4[_0x5056('0x48')],null))[_0x5056('0x23')](respondWithResult(_0x1ab1a9,null))[_0x5056('0x44')](handleError(_0x1ab1a9,null));};exports[_0x5056('0x24')]=function(_0xdf427c,_0x97f7d8){return db[_0x5056('0x40')][_0x5056('0x47')]({'where':{'id':_0xdf427c[_0x5056('0x46')]['id']}})[_0x5056('0x23')](handleEntityNotFound(_0x97f7d8,null))[_0x5056('0x23')](removeEntity(_0x97f7d8,null))[_0x5056('0x44')](handleError(_0x97f7d8,null));};exports[_0x5056('0x49')]=function(_0x34e86e,_0x4bf758){return db['WhatsappQueueReport'][_0x5056('0x49')]()[_0x5056('0x23')](respondWithResult(_0x4bf758,null))[_0x5056('0x44')](handleError(_0x4bf758,null));}; \ No newline at end of file +var _0x4b17=['save','update','then','destroy','end','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','findAll','rows','show','params','rawAttributes','options','find','catch','create','body','describe','eml-format','zip-dir','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply'];(function(_0x3e75b0,_0x3450d4){var _0x16fdef=function(_0x518c6b){while(--_0x518c6b){_0x3e75b0['push'](_0x3e75b0['shift']());}};_0x16fdef(++_0x3450d4);}(_0x4b17,0x10f));var _0x74b1=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0x4b17[_0xf26d40];return _0x50b68c;};'use strict';var emlformat=require(_0x74b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x74b1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x74b1('0x2'));var moment=require(_0x74b1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x74b1('0x4'));var util=require('util');var path=require('path');var sox=require(_0x74b1('0x5'));var csv=require(_0x74b1('0x6'));var ejs=require(_0x74b1('0x7'));var fs=require('fs');var fs_extra=require(_0x74b1('0x8'));var _=require(_0x74b1('0x9'));var squel=require(_0x74b1('0xa'));var crypto=require(_0x74b1('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x74b1('0xc'));var toCsv=require(_0x74b1('0x6'));var querystring=require(_0x74b1('0xd'));var Papa=require(_0x74b1('0xe'));var Redis=require(_0x74b1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x74b1('0x10'));var as=require(_0x74b1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74b1('0x12'))(_0x74b1('0x13'));var utils=require(_0x74b1('0x14'));var config=require(_0x74b1('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x74b1('0x16'))['db'];function respondWithStatusCode(_0x5cfe85,_0x5f2865){_0x5f2865=_0x5f2865||0xcc;return function(_0x239d04){if(_0x239d04){return _0x5cfe85[_0x74b1('0x17')](_0x5f2865);}return _0x5cfe85['status'](_0x5f2865)['end']();};}function respondWithResult(_0x500ce2,_0x86390){_0x86390=_0x86390||0xc8;return function(_0x5c12eb){if(_0x5c12eb){return _0x500ce2['status'](_0x86390)[_0x74b1('0x18')](_0x5c12eb);}};}function respondWithFilteredResult(_0x12a2c0,_0x3779c5){return function(_0x420662){if(_0x420662){var _0x16b147=typeof _0x3779c5[_0x74b1('0x19')]==='undefined'&&typeof _0x3779c5[_0x74b1('0x1a')]===_0x74b1('0x1b');var _0x1a0851=_0x420662[_0x74b1('0x1c')];var _0xde2736=_0x16b147?0x0:_0x3779c5[_0x74b1('0x19')];var _0x1ab838=_0x16b147?_0x420662['count']:_0x3779c5[_0x74b1('0x19')]+_0x3779c5[_0x74b1('0x1a')];var _0x524ece;if(_0x1ab838>=_0x1a0851){_0x1ab838=_0x1a0851;_0x524ece=0xc8;}else{_0x524ece=0xce;}_0x12a2c0[_0x74b1('0x1d')](_0x524ece);return _0x12a2c0[_0x74b1('0x1e')](_0x74b1('0x1f'),_0xde2736+'-'+_0x1ab838+'/'+_0x1a0851)[_0x74b1('0x18')](_0x420662);}return null;};}function patchUpdates(_0x13bb44){return function(_0x33fee9){try{jsonpatch[_0x74b1('0x20')](_0x33fee9,_0x13bb44,!![]);}catch(_0xaac5f7){return BPromise['reject'](_0xaac5f7);}return _0x33fee9[_0x74b1('0x21')]();};}function saveUpdates(_0x4f1ec9,_0x5da0f7){return function(_0x481bf2){if(_0x481bf2){return _0x481bf2[_0x74b1('0x22')](_0x4f1ec9)[_0x74b1('0x23')](function(_0x405a22){return _0x405a22;});}return null;};}function removeEntity(_0x44bf7e,_0x563781){return function(_0x4ee88b){if(_0x4ee88b){return _0x4ee88b[_0x74b1('0x24')]()['then'](function(){_0x44bf7e[_0x74b1('0x1d')](0xcc)[_0x74b1('0x25')]();});}};}function handleEntityNotFound(_0xb5af0,_0x14a651){return function(_0x3239d8){if(!_0x3239d8){_0xb5af0[_0x74b1('0x17')](0x194);}return _0x3239d8;};}function handleError(_0x115918,_0x33fa8e){_0x33fa8e=_0x33fa8e||0x1f4;return function(_0x4c7f05){logger[_0x74b1('0x26')](_0x4c7f05[_0x74b1('0x27')]);if(_0x4c7f05[_0x74b1('0x28')]){delete _0x4c7f05['name'];}_0x115918[_0x74b1('0x1d')](_0x33fa8e)[_0x74b1('0x29')](_0x4c7f05);};}exports[_0x74b1('0x2a')]=function(_0x1b011a,_0x26d9f1){var _0x273ff1={},_0x436eda={},_0x3ce043={'count':0x0,'rows':[]};var _0x4fbe3d=_[_0x74b1('0x2b')](db[_0x74b1('0x2c')]['rawAttributes'],function(_0x543b5){return{'name':_0x543b5[_0x74b1('0x2d')],'type':_0x543b5[_0x74b1('0x2e')]['key']};});_0x436eda[_0x74b1('0x2f')]=_[_0x74b1('0x2b')](_0x4fbe3d,'name');_0x436eda[_0x74b1('0x30')]=_[_0x74b1('0x31')](_0x1b011a[_0x74b1('0x30')]);_0x436eda[_0x74b1('0x32')]=_[_0x74b1('0x33')](_0x436eda[_0x74b1('0x2f')],_0x436eda[_0x74b1('0x30')]);_0x273ff1[_0x74b1('0x34')]=_['intersection'](_0x436eda[_0x74b1('0x2f')],qs['fields'](_0x1b011a['query'][_0x74b1('0x35')]));_0x273ff1['attributes']=_0x273ff1['attributes'][_0x74b1('0x36')]?_0x273ff1[_0x74b1('0x34')]:_0x436eda[_0x74b1('0x2f')];if(!_0x1b011a[_0x74b1('0x30')][_0x74b1('0x37')](_0x74b1('0x38'))){_0x273ff1[_0x74b1('0x1a')]=qs[_0x74b1('0x1a')](_0x1b011a['query']['limit']);_0x273ff1['offset']=qs[_0x74b1('0x19')](_0x1b011a['query']['offset']);}_0x273ff1[_0x74b1('0x39')]=qs[_0x74b1('0x3a')](_0x1b011a[_0x74b1('0x30')]['sort']);_0x273ff1[_0x74b1('0x3b')]=qs['filters'](_[_0x74b1('0x3c')](_0x1b011a[_0x74b1('0x30')],_0x436eda['filters']),_0x4fbe3d);if(_0x1b011a['query'][_0x74b1('0x3d')]){_0x273ff1[_0x74b1('0x3b')]=_['merge'](_0x273ff1['where'],{'$or':_[_0x74b1('0x2b')](_0x4fbe3d,function(_0x5298f6){if(_0x5298f6[_0x74b1('0x2e')]!==_0x74b1('0x3e')){var _0x15e695={};_0x15e695[_0x5298f6[_0x74b1('0x28')]]={'$like':'%'+_0x1b011a[_0x74b1('0x30')]['filter']+'%'};return _0x15e695;}})});}_0x273ff1=_[_0x74b1('0x3f')]({},_0x273ff1,_0x1b011a['options']);var _0x41a78b={'where':_0x273ff1['where']};return db[_0x74b1('0x2c')]['count'](_0x41a78b)['then'](function(_0xcdb873){_0x3ce043[_0x74b1('0x1c')]=_0xcdb873;if(_0x1b011a[_0x74b1('0x30')]['includeAll']){_0x273ff1[_0x74b1('0x40')]=[{'all':!![]}];}return db[_0x74b1('0x2c')][_0x74b1('0x41')](_0x273ff1);})['then'](function(_0xfecdc){_0x3ce043[_0x74b1('0x42')]=_0xfecdc;return _0x3ce043;})['then'](respondWithFilteredResult(_0x26d9f1,_0x273ff1))['catch'](handleError(_0x26d9f1,null));};exports[_0x74b1('0x43')]=function(_0x2dcaf6,_0x416c8d){var _0x444870={'raw':!![],'where':{'id':_0x2dcaf6[_0x74b1('0x44')]['id']}},_0x1d9f5b={};_0x1d9f5b[_0x74b1('0x2f')]=_['keys'](db[_0x74b1('0x2c')][_0x74b1('0x45')]);_0x1d9f5b[_0x74b1('0x30')]=_[_0x74b1('0x31')](_0x2dcaf6[_0x74b1('0x30')]);_0x1d9f5b['filters']=_[_0x74b1('0x33')](_0x1d9f5b[_0x74b1('0x2f')],_0x1d9f5b['query']);_0x444870['attributes']=_[_0x74b1('0x33')](_0x1d9f5b[_0x74b1('0x2f')],qs['fields'](_0x2dcaf6[_0x74b1('0x30')][_0x74b1('0x35')]));_0x444870[_0x74b1('0x34')]=_0x444870[_0x74b1('0x34')][_0x74b1('0x36')]?_0x444870[_0x74b1('0x34')]:_0x1d9f5b[_0x74b1('0x2f')];if(_0x2dcaf6['query']['includeAll']){_0x444870['include']=[{'all':!![]}];}_0x444870=_[_0x74b1('0x3f')]({},_0x444870,_0x2dcaf6[_0x74b1('0x46')]);return db[_0x74b1('0x2c')][_0x74b1('0x47')](_0x444870)[_0x74b1('0x23')](handleEntityNotFound(_0x416c8d,null))['then'](respondWithResult(_0x416c8d,null))[_0x74b1('0x48')](handleError(_0x416c8d,null));};exports[_0x74b1('0x49')]=function(_0x18687c,_0x33c215){return db[_0x74b1('0x2c')][_0x74b1('0x49')](_0x18687c[_0x74b1('0x4a')],{})[_0x74b1('0x23')](respondWithResult(_0x33c215,0xc9))[_0x74b1('0x48')](handleError(_0x33c215,null));};exports[_0x74b1('0x22')]=function(_0x186516,_0x3038f9){if(_0x186516['body']['id']){delete _0x186516[_0x74b1('0x4a')]['id'];}return db[_0x74b1('0x2c')]['find']({'where':{'id':_0x186516[_0x74b1('0x44')]['id']}})['then'](handleEntityNotFound(_0x3038f9,null))[_0x74b1('0x23')](saveUpdates(_0x186516[_0x74b1('0x4a')],null))['then'](respondWithResult(_0x3038f9,null))[_0x74b1('0x48')](handleError(_0x3038f9,null));};exports[_0x74b1('0x24')]=function(_0x326b98,_0x549f03){return db[_0x74b1('0x2c')][_0x74b1('0x47')]({'where':{'id':_0x326b98[_0x74b1('0x44')]['id']}})[_0x74b1('0x23')](handleEntityNotFound(_0x549f03,null))[_0x74b1('0x23')](removeEntity(_0x549f03,null))['catch'](handleError(_0x549f03,null));};exports[_0x74b1('0x4b')]=function(_0x594411,_0x11bfca){return db[_0x74b1('0x2c')]['describe']()[_0x74b1('0x23')](respondWithResult(_0x11bfca,null))[_0x74b1('0x48')](handleError(_0x11bfca,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index a4fa048..44170ae 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 _0xc8b4=['bluebird','request-promise','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util','../../config/logger','api'];(function(_0xa32d84,_0x3197da){var _0x41b869=function(_0x719fca){while(--_0x719fca){_0xa32d84['push'](_0xa32d84['shift']());}};_0x41b869(++_0x3197da);}(_0xc8b4,0x1c5));var _0x4c8b=function(_0x553e7b,_0x1f917b){_0x553e7b=_0x553e7b-0x0;var _0x1ce843=_0xc8b4[_0x553e7b];return _0x1ce843;};'use strict';var _=require('lodash');var util=require(_0x4c8b('0x0'));var logger=require(_0x4c8b('0x1'))(_0x4c8b('0x2'));var moment=require('moment');var BPromise=require(_0x4c8b('0x3'));var rp=require(_0x4c8b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c8b('0x5'));var config=require(_0x4c8b('0x6'));var attributes=require(_0x4c8b('0x7'));module[_0x4c8b('0x8')]=function(_0x458d65,_0xebafc8){return _0x458d65['define'](_0x4c8b('0x9'),attributes,{'tableName':_0x4c8b('0xa'),'paranoid':![],'indexes':[{'name':_0x4c8b('0xb'),'fields':[_0x4c8b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d0c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid'];(function(_0x33bb07,_0x5b1849){var _0x481c81=function(_0x1709f0){while(--_0x1709f0){_0x33bb07['push'](_0x33bb07['shift']());}};_0x481c81(++_0x5b1849);}(_0x6d0c,0x152));var _0xc6d0=function(_0x1e98a8,_0xdc9fa){_0x1e98a8=_0x1e98a8-0x0;var _0x5551c9=_0x6d0c[_0x1e98a8];return _0x5551c9;};'use strict';var _=require(_0xc6d0('0x0'));var util=require(_0xc6d0('0x1'));var logger=require(_0xc6d0('0x2'))(_0xc6d0('0x3'));var moment=require(_0xc6d0('0x4'));var BPromise=require(_0xc6d0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6d0('0x6'));var rimraf=require(_0xc6d0('0x7'));var config=require('../../config/environment');var attributes=require(_0xc6d0('0x8'));module[_0xc6d0('0x9')]=function(_0x4aae28,_0x37c2bf){return _0x4aae28[_0xc6d0('0xa')](_0xc6d0('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xc6d0('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index adb5e9c..08b9b7a 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 _0x4153=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','UpdateWhatsappQueueReport','update','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4153,0x8a));var _0x3415=function(_0x1acdbf,_0x15d050){_0x1acdbf=_0x1acdbf-0x0;var _0x4f92c0=_0x4153[_0x1acdbf];return _0x4f92c0;};'use strict';var _=require(_0x3415('0x0'));var util=require(_0x3415('0x1'));var moment=require(_0x3415('0x2'));var BPromise=require(_0x3415('0x3'));var rs=require(_0x3415('0x4'));var fs=require('fs');var Redis=require(_0x3415('0x5'));var db=require(_0x3415('0x6'))['db'];var utils=require(_0x3415('0x7'));var logger=require(_0x3415('0x8'))(_0x3415('0x9'));var config=require(_0x3415('0xa'));var jayson=require(_0x3415('0xb'));var client=jayson[_0x3415('0xc')][_0x3415('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x25b4c0,_0x5bd446,_0x3875c4){return new BPromise(function(_0x35339c,_0x3cadac){return client[_0x3415('0xe')](_0x25b4c0,_0x3875c4)[_0x3415('0xf')](function(_0x341bb8){logger[_0x3415('0x10')](_0x3415('0x11'),_0x5bd446,_0x3415('0x12'));logger[_0x3415('0x13')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x5bd446,_0x3415('0x12'),JSON[_0x3415('0x14')](_0x341bb8));if(_0x341bb8[_0x3415('0x15')]){if(_0x341bb8['error'][_0x3415('0x16')]===0x1f4){logger[_0x3415('0x15')](_0x3415('0x11'),_0x5bd446,_0x341bb8[_0x3415('0x15')][_0x3415('0x17')]);return _0x3cadac(_0x341bb8[_0x3415('0x15')]['message']);}logger[_0x3415('0x15')](_0x3415('0x11'),_0x5bd446,_0x341bb8[_0x3415('0x15')]['message']);return _0x35339c(_0x341bb8[_0x3415('0x15')][_0x3415('0x17')]);}else{logger[_0x3415('0x10')](_0x3415('0x11'),_0x5bd446,_0x3415('0x12'));_0x35339c(_0x341bb8[_0x3415('0x18')][_0x3415('0x17')]);}})[_0x3415('0x19')](function(_0x3d075e){logger[_0x3415('0x15')](_0x3415('0x11'),_0x5bd446,_0x3d075e);_0x3cadac(_0x3d075e);});});}exports[_0x3415('0x1a')]=function(_0x32efb6){var _0xca2a55=this;return new Promise(function(_0x3cf2c9,_0xbcde64){return db[_0x3415('0x1b')]['create'](_0x32efb6[_0x3415('0x1c')],{'raw':_0x32efb6[_0x3415('0x1d')]?_0x32efb6[_0x3415('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x3415('0xf')](function(_0x3b2424){logger[_0x3415('0x10')](_0x3415('0x1a'),_0x32efb6);logger[_0x3415('0x13')](_0x3415('0x1a'),_0x32efb6,JSON[_0x3415('0x14')](_0x3b2424));_0x3cf2c9(_0x3b2424);})[_0x3415('0x19')](function(_0x251963){logger[_0x3415('0x15')]('CreateWhatsappQueueReport',_0x251963[_0x3415('0x17')],_0x32efb6);_0xbcde64(_0xca2a55[_0x3415('0x15')](0x1f4,_0x251963['message']));});});};exports[_0x3415('0x1e')]=function(_0x541536){var _0x435420=this;return new Promise(function(_0x32aebf,_0xe70016){return db['WhatsappQueueReport'][_0x3415('0x1f')](_0x541536[_0x3415('0x1c')],{'raw':_0x541536[_0x3415('0x1d')]?_0x541536[_0x3415('0x1d')][_0x3415('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x541536[_0x3415('0x1d')]?_0x541536[_0x3415('0x1d')][_0x3415('0x21')]||null:null,'attributes':_0x541536['options']?_0x541536[_0x3415('0x1d')][_0x3415('0x22')]||null:null,'limit':_0x541536[_0x3415('0x1d')]?_0x541536[_0x3415('0x1d')][_0x3415('0x23')]||null:null})[_0x3415('0xf')](function(_0x3de128){logger[_0x3415('0x10')]('UpdateWhatsappQueueReport',_0x541536);logger[_0x3415('0x13')](_0x3415('0x1e'),_0x541536,JSON['stringify'](_0x3de128));_0x32aebf(_0x3de128);})[_0x3415('0x19')](function(_0x257a54){logger[_0x3415('0x15')](_0x3415('0x1e'),_0x257a54['message'],_0x541536);_0xe70016(_0x435420[_0x3415('0x15')](0x1f4,_0x257a54['message']));});});}; \ No newline at end of file +var _0x5b0c=['UpdateWhatsappQueueReport','update','limit','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','then','catch'];(function(_0x37c6c3,_0x95ace){var _0xf87ee2=function(_0x16d7f9){while(--_0x16d7f9){_0x37c6c3['push'](_0x37c6c3['shift']());}};_0xf87ee2(++_0x95ace);}(_0x5b0c,0xec));var _0xc5b0=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0x5b0c[_0x28a5ad];return _0x176b8a;};'use strict';var _=require(_0xc5b0('0x0'));var util=require('util');var moment=require(_0xc5b0('0x1'));var BPromise=require(_0xc5b0('0x2'));var rs=require(_0xc5b0('0x3'));var fs=require('fs');var Redis=require(_0xc5b0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc5b0('0x5'));var logger=require(_0xc5b0('0x6'))(_0xc5b0('0x7'));var config=require(_0xc5b0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc5b0('0x9')][_0xc5b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x364c94,_0x136122,_0x385fa3){return new BPromise(function(_0x585593,_0x298ab8){return client[_0xc5b0('0xb')](_0x364c94,_0x385fa3)['then'](function(_0x17227e){logger[_0xc5b0('0xc')](_0xc5b0('0xd'),_0x136122,_0xc5b0('0xe'));logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x136122,'request\x20sent',JSON[_0xc5b0('0xf')](_0x17227e));if(_0x17227e[_0xc5b0('0x10')]){if(_0x17227e['error']['code']===0x1f4){logger[_0xc5b0('0x10')](_0xc5b0('0xd'),_0x136122,_0x17227e[_0xc5b0('0x10')][_0xc5b0('0x11')]);return _0x298ab8(_0x17227e[_0xc5b0('0x10')]['message']);}logger[_0xc5b0('0x10')](_0xc5b0('0xd'),_0x136122,_0x17227e[_0xc5b0('0x10')]['message']);return _0x585593(_0x17227e['error'][_0xc5b0('0x11')]);}else{logger['info'](_0xc5b0('0xd'),_0x136122,_0xc5b0('0xe'));_0x585593(_0x17227e['result'][_0xc5b0('0x11')]);}})['catch'](function(_0x294924){logger[_0xc5b0('0x10')](_0xc5b0('0xd'),_0x136122,_0x294924);_0x298ab8(_0x294924);});});}exports[_0xc5b0('0x12')]=function(_0x2f5071){var _0x3584e3=this;return new Promise(function(_0x8a7d74,_0xc75c2c){return db[_0xc5b0('0x13')][_0xc5b0('0x14')](_0x2f5071[_0xc5b0('0x15')],{'raw':_0x2f5071['options']?_0x2f5071[_0xc5b0('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xc5b0('0x17')](function(_0x27729e){logger[_0xc5b0('0xc')](_0xc5b0('0x12'),_0x2f5071);logger['debug'](_0xc5b0('0x12'),_0x2f5071,JSON[_0xc5b0('0xf')](_0x27729e));_0x8a7d74(_0x27729e);})[_0xc5b0('0x18')](function(_0x23b273){logger['error'](_0xc5b0('0x12'),_0x23b273[_0xc5b0('0x11')],_0x2f5071);_0xc75c2c(_0x3584e3['error'](0x1f4,_0x23b273[_0xc5b0('0x11')]));});});};exports[_0xc5b0('0x19')]=function(_0xcd6d07){var _0x532a5a=this;return new Promise(function(_0x5e31bf,_0x52ea25){return db['WhatsappQueueReport'][_0xc5b0('0x1a')](_0xcd6d07['body'],{'raw':_0xcd6d07[_0xc5b0('0x16')]?_0xcd6d07[_0xc5b0('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcd6d07[_0xc5b0('0x16')]?_0xcd6d07[_0xc5b0('0x16')]['where']||null:null,'attributes':_0xcd6d07[_0xc5b0('0x16')]?_0xcd6d07[_0xc5b0('0x16')]['attributes']||null:null,'limit':_0xcd6d07[_0xc5b0('0x16')]?_0xcd6d07['options'][_0xc5b0('0x1b')]||null:null})['then'](function(_0x16586d){logger[_0xc5b0('0xc')](_0xc5b0('0x19'),_0xcd6d07);logger[_0xc5b0('0x1c')](_0xc5b0('0x19'),_0xcd6d07,JSON[_0xc5b0('0xf')](_0x16586d));_0x5e31bf(_0x16586d);})[_0xc5b0('0x18')](function(_0x5b41f0){logger[_0xc5b0('0x10')](_0xc5b0('0x19'),_0x5b41f0[_0xc5b0('0x11')],_0xcd6d07);_0x52ea25(_0x532a5a[_0xc5b0('0x10')](0x1f4,_0x5b41f0[_0xc5b0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 072672a..3ca1640 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 _0x3c0a=['update','delete','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create'];(function(_0x238601,_0x166a6f){var _0x468b3d=function(_0x437760){while(--_0x437760){_0x238601['push'](_0x238601['shift']());}};_0x468b3d(++_0x166a6f);}(_0x3c0a,0x80));var _0xa3c0=function(_0x17c739,_0x4dab9d){_0x17c739=_0x17c739-0x0;var _0x4a0856=_0x3c0a[_0x17c739];return _0x4a0856;};'use strict';var multer=require('multer');var util=require(_0xa3c0('0x0'));var path=require('path');var timeout=require(_0xa3c0('0x1'));var express=require(_0xa3c0('0x2'));var router=express['Router']();var fs_extra=require(_0xa3c0('0x3'));var auth=require(_0xa3c0('0x4'));var interaction=require(_0xa3c0('0x5'));var config=require(_0xa3c0('0x6'));var controller=require(_0xa3c0('0x7'));router[_0xa3c0('0x8')]('/',auth[_0xa3c0('0x9')](),controller[_0xa3c0('0xa')]);router['get']('/describe',auth[_0xa3c0('0x9')](),controller[_0xa3c0('0xb')]);router[_0xa3c0('0x8')](_0xa3c0('0xc'),auth[_0xa3c0('0x9')](),controller[_0xa3c0('0xd')]);router[_0xa3c0('0xe')]('/',auth['isAuthenticated'](),controller[_0xa3c0('0xf')]);router['put'](_0xa3c0('0xc'),auth[_0xa3c0('0x9')](),controller[_0xa3c0('0x10')]);router[_0xa3c0('0x11')](_0xa3c0('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x115f=['fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create','destroy','util','path','connect-timeout','Router'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x115f,0x13c));var _0xf115=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x115f[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require('multer');var util=require(_0xf115('0x0'));var path=require(_0xf115('0x1'));var timeout=require(_0xf115('0x2'));var express=require('express');var router=express[_0xf115('0x3')]();var fs_extra=require(_0xf115('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf115('0x5'));var config=require(_0xf115('0x6'));var controller=require(_0xf115('0x7'));router[_0xf115('0x8')]('/',auth[_0xf115('0x9')](),controller['index']);router['get'](_0xf115('0xa'),auth[_0xf115('0x9')](),controller[_0xf115('0xb')]);router[_0xf115('0x8')](_0xf115('0xc'),auth[_0xf115('0x9')](),controller[_0xf115('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf115('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xf115('0xc'),auth[_0xf115('0x9')](),controller[_0xf115('0xf')]);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 2947d3f..3663df0 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 _0xb9e7=['STRING','ENUM','account','agent','queue','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x4c2dfc,_0x4814c0){_0x4c2dfc=_0x4c2dfc-0x0;var _0xfd728d=_0xb9e7[_0x4c2dfc];return _0xfd728d;};'use strict';var Sequelize=require('sequelize');module[_0x7b9e('0x0')]={'uniqueid':{'type':Sequelize[_0x7b9e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x7b9e('0x2')](_0x7b9e('0x3'),_0x7b9e('0x4'),_0x7b9e('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x01d3=['sequelize','exports','STRING','ENUM','agent','queue'];(function(_0x5ab372,_0x4cd206){var _0x2f4514=function(_0x462478){while(--_0x462478){_0x5ab372['push'](_0x5ab372['shift']());}};_0x2f4514(++_0x4cd206);}(_0x01d3,0xa2));var _0x301d=function(_0x2fc744,_0x4c10e2){_0x2fc744=_0x2fc744-0x0;var _0x53c1ac=_0x01d3[_0x2fc744];return _0x53c1ac;};'use strict';var Sequelize=require(_0x301d('0x0'));module[_0x301d('0x1')]={'uniqueid':{'type':Sequelize[_0x301d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x301d('0x3')]('account',_0x301d('0x4'),_0x301d('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 1857450..3816efb 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 _0xb09a=['rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','type','key','map','query','model','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filters','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','keys','options','create','body','find','params','describe','eml-format'];(function(_0x50e001,_0x45aa55){var _0x3fe4a2=function(_0x42dd11){while(--_0x42dd11){_0x50e001['push'](_0x50e001['shift']());}};_0x3fe4a2(++_0x45aa55);}(_0xb09a,0xe6));var _0xab09=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xb09a[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0xab09('0x0'));var rimraf=require(_0xab09('0x1'));var zipdir=require(_0xab09('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xab09('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xab09('0x4'));var util=require(_0xab09('0x5'));var path=require(_0xab09('0x6'));var sox=require(_0xab09('0x7'));var csv=require(_0xab09('0x8'));var ejs=require(_0xab09('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab09('0xa'));var squel=require(_0xab09('0xb'));var crypto=require(_0xab09('0xc'));var jsforce=require(_0xab09('0xd'));var deskjs=require(_0xab09('0xe'));var toCsv=require(_0xab09('0x8'));var querystring=require(_0xab09('0xf'));var Papa=require('papaparse');var Redis=require(_0xab09('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xab09('0x11'));var hardwareService=require(_0xab09('0x12'));var logger=require(_0xab09('0x13'))(_0xab09('0x14'));var utils=require(_0xab09('0x15'));var config=require(_0xab09('0x16'));var licenseUtil=require(_0xab09('0x17'));var db=require(_0xab09('0x18'))['db'];function respondWithStatusCode(_0x57a6a2,_0x14a71b){_0x14a71b=_0x14a71b||0xcc;return function(_0x300d4e){if(_0x300d4e){return _0x57a6a2['sendStatus'](_0x14a71b);}return _0x57a6a2[_0xab09('0x19')](_0x14a71b)[_0xab09('0x1a')]();};}function respondWithResult(_0x33dcbb,_0x9e1fc2){_0x9e1fc2=_0x9e1fc2||0xc8;return function(_0x19d400){if(_0x19d400){return _0x33dcbb[_0xab09('0x19')](_0x9e1fc2)[_0xab09('0x1b')](_0x19d400);}};}function respondWithFilteredResult(_0x5820dc,_0x55e27e){return function(_0x4eb632){if(_0x4eb632){var _0x4d2b61=typeof _0x55e27e[_0xab09('0x1c')]==='undefined'&&typeof _0x55e27e['limit']===_0xab09('0x1d');var _0x2b3c87=_0x4eb632[_0xab09('0x1e')];var _0x40f4a6=_0x4d2b61?0x0:_0x55e27e[_0xab09('0x1c')];var _0x536783=_0x4d2b61?_0x4eb632[_0xab09('0x1e')]:_0x55e27e[_0xab09('0x1c')]+_0x55e27e['limit'];var _0xcf9854;if(_0x536783>=_0x2b3c87){_0x536783=_0x2b3c87;_0xcf9854=0xc8;}else{_0xcf9854=0xce;}_0x5820dc[_0xab09('0x19')](_0xcf9854);return _0x5820dc['set'](_0xab09('0x1f'),_0x40f4a6+'-'+_0x536783+'/'+_0x2b3c87)[_0xab09('0x1b')](_0x4eb632);}return null;};}function patchUpdates(_0x3948e7){return function(_0x34824a){try{jsonpatch[_0xab09('0x20')](_0x34824a,_0x3948e7,!![]);}catch(_0x3ff2ca){return BPromise[_0xab09('0x21')](_0x3ff2ca);}return _0x34824a[_0xab09('0x22')]();};}function saveUpdates(_0x1aa550,_0xb4ebf2){return function(_0x67fdad){if(_0x67fdad){return _0x67fdad[_0xab09('0x23')](_0x1aa550)[_0xab09('0x24')](function(_0x42fcfb){return _0x42fcfb;});}return null;};}function removeEntity(_0x2dd785,_0x301560){return function(_0x5b5aec){if(_0x5b5aec){return _0x5b5aec[_0xab09('0x25')]()[_0xab09('0x24')](function(){_0x2dd785['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55937d,_0x114060){return function(_0xb674d0){if(!_0xb674d0){_0x55937d[_0xab09('0x26')](0x194);}return _0xb674d0;};}function handleError(_0x1743c3,_0xebb0cf){_0xebb0cf=_0xebb0cf||0x1f4;return function(_0x3bbd4a){logger[_0xab09('0x27')](_0x3bbd4a[_0xab09('0x28')]);if(_0x3bbd4a[_0xab09('0x29')]){delete _0x3bbd4a['name'];}_0x1743c3[_0xab09('0x19')](_0xebb0cf)[_0xab09('0x2a')](_0x3bbd4a);};}exports[_0xab09('0x2b')]=function(_0x1010ce,_0x1fe627){var _0x7829e0={},_0x21c371={},_0x262949={'count':0x0,'rows':[]};var _0x45da9c=_['map'](db[_0xab09('0x2c')][_0xab09('0x2d')],function(_0x419a6f){return{'name':_0x419a6f[_0xab09('0x2e')],'type':_0x419a6f[_0xab09('0x2f')][_0xab09('0x30')]};});_0x21c371['model']=_[_0xab09('0x31')](_0x45da9c,_0xab09('0x29'));_0x21c371[_0xab09('0x32')]=_['keys'](_0x1010ce[_0xab09('0x32')]);_0x21c371['filters']=_['intersection'](_0x21c371[_0xab09('0x33')],_0x21c371[_0xab09('0x32')]);_0x7829e0['attributes']=_[_0xab09('0x34')](_0x21c371['model'],qs[_0xab09('0x35')](_0x1010ce[_0xab09('0x32')][_0xab09('0x35')]));_0x7829e0[_0xab09('0x36')]=_0x7829e0[_0xab09('0x36')][_0xab09('0x37')]?_0x7829e0[_0xab09('0x36')]:_0x21c371['model'];if(!_0x1010ce[_0xab09('0x32')][_0xab09('0x38')]('nolimit')){_0x7829e0[_0xab09('0x39')]=qs['limit'](_0x1010ce[_0xab09('0x32')][_0xab09('0x39')]);_0x7829e0[_0xab09('0x1c')]=qs[_0xab09('0x1c')](_0x1010ce[_0xab09('0x32')][_0xab09('0x1c')]);}_0x7829e0['order']=qs[_0xab09('0x3a')](_0x1010ce[_0xab09('0x32')]['sort']);_0x7829e0[_0xab09('0x3b')]=qs['filters'](_[_0xab09('0x3c')](_0x1010ce[_0xab09('0x32')],_0x21c371[_0xab09('0x3d')]),_0x45da9c);if(_0x1010ce['query']['filter']){_0x7829e0[_0xab09('0x3b')]=_[_0xab09('0x3e')](_0x7829e0[_0xab09('0x3b')],{'$or':_[_0xab09('0x31')](_0x45da9c,function(_0x369f69){if(_0x369f69[_0xab09('0x2f')]!==_0xab09('0x3f')){var _0x506f96={};_0x506f96[_0x369f69['name']]={'$like':'%'+_0x1010ce[_0xab09('0x32')]['filter']+'%'};return _0x506f96;}})});}_0x7829e0=_['merge']({},_0x7829e0,_0x1010ce['options']);var _0x1856e2={'where':_0x7829e0[_0xab09('0x3b')]};return db[_0xab09('0x2c')][_0xab09('0x1e')](_0x1856e2)[_0xab09('0x24')](function(_0x2f8406){_0x262949[_0xab09('0x1e')]=_0x2f8406;if(_0x1010ce[_0xab09('0x32')][_0xab09('0x40')]){_0x7829e0[_0xab09('0x41')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0xab09('0x42')](_0x7829e0);})['then'](function(_0x54a260){_0x262949[_0xab09('0x43')]=_0x54a260;return _0x262949;})[_0xab09('0x24')](respondWithFilteredResult(_0x1fe627,_0x7829e0))[_0xab09('0x44')](handleError(_0x1fe627,null));};exports[_0xab09('0x45')]=function(_0x159347,_0x4f7542){var _0x1790ec={'raw':!![],'where':{'id':_0x159347['params']['id']}},_0x59cce7={};_0x59cce7[_0xab09('0x33')]=_['keys'](db[_0xab09('0x2c')][_0xab09('0x2d')]);_0x59cce7[_0xab09('0x32')]=_[_0xab09('0x46')](_0x159347['query']);_0x59cce7[_0xab09('0x3d')]=_[_0xab09('0x34')](_0x59cce7['model'],_0x59cce7[_0xab09('0x32')]);_0x1790ec[_0xab09('0x36')]=_[_0xab09('0x34')](_0x59cce7[_0xab09('0x33')],qs[_0xab09('0x35')](_0x159347[_0xab09('0x32')][_0xab09('0x35')]));_0x1790ec[_0xab09('0x36')]=_0x1790ec[_0xab09('0x36')]['length']?_0x1790ec['attributes']:_0x59cce7['model'];if(_0x159347[_0xab09('0x32')][_0xab09('0x40')]){_0x1790ec[_0xab09('0x41')]=[{'all':!![]}];}_0x1790ec=_[_0xab09('0x3e')]({},_0x1790ec,_0x159347[_0xab09('0x47')]);return db[_0xab09('0x2c')]['find'](_0x1790ec)[_0xab09('0x24')](handleEntityNotFound(_0x4f7542,null))[_0xab09('0x24')](respondWithResult(_0x4f7542,null))['catch'](handleError(_0x4f7542,null));};exports[_0xab09('0x48')]=function(_0x30a014,_0xf69e4a){return db[_0xab09('0x2c')][_0xab09('0x48')](_0x30a014[_0xab09('0x49')],{})['then'](respondWithResult(_0xf69e4a,0xc9))[_0xab09('0x44')](handleError(_0xf69e4a,null));};exports['update']=function(_0x239238,_0x48aa39){if(_0x239238['body']['id']){delete _0x239238[_0xab09('0x49')]['id'];}return db['WhatsappTransferReport'][_0xab09('0x4a')]({'where':{'id':_0x239238[_0xab09('0x4b')]['id']}})[_0xab09('0x24')](handleEntityNotFound(_0x48aa39,null))['then'](saveUpdates(_0x239238['body'],null))[_0xab09('0x24')](respondWithResult(_0x48aa39,null))[_0xab09('0x44')](handleError(_0x48aa39,null));};exports[_0xab09('0x25')]=function(_0x4954a2,_0x34c3d6){return db[_0xab09('0x2c')][_0xab09('0x4a')]({'where':{'id':_0x4954a2[_0xab09('0x4b')]['id']}})['then'](handleEntityNotFound(_0x34c3d6,null))[_0xab09('0x24')](removeEntity(_0x34c3d6,null))[_0xab09('0x44')](handleError(_0x34c3d6,null));};exports[_0xab09('0x4c')]=function(_0x2d0b0b,_0x410f2e){return db['WhatsappTransferReport']['describe']()['then'](respondWithResult(_0x410f2e,null))[_0xab09('0x44')](handleError(_0x410f2e,null));}; \ No newline at end of file +var _0x6dd3=['zip-dir','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','WhatsappTransferReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf'];(function(_0x9968b3,_0x4b10d4){var _0x18da4c=function(_0x436bbe){while(--_0x436bbe){_0x9968b3['push'](_0x9968b3['shift']());}};_0x18da4c(++_0x4b10d4);}(_0x6dd3,0x16b));var _0x36dd=function(_0x49c049,_0x4bcc9c){_0x49c049=_0x49c049-0x0;var _0x38d57c=_0x6dd3[_0x49c049];return _0x38d57c;};'use strict';var emlformat=require(_0x36dd('0x0'));var rimraf=require(_0x36dd('0x1'));var zipdir=require(_0x36dd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x36dd('0x3'));var BPromise=require(_0x36dd('0x4'));var Mustache=require(_0x36dd('0x5'));var util=require(_0x36dd('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x36dd('0x7'));var ejs=require(_0x36dd('0x8'));var fs=require('fs');var fs_extra=require(_0x36dd('0x9'));var _=require('lodash');var squel=require(_0x36dd('0xa'));var crypto=require(_0x36dd('0xb'));var jsforce=require(_0x36dd('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x36dd('0x7'));var querystring=require(_0x36dd('0xd'));var Papa=require('papaparse');var Redis=require(_0x36dd('0xe'));var authService=require(_0x36dd('0xf'));var qs=require(_0x36dd('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x36dd('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x36dd('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x36dd('0x13'));var db=require(_0x36dd('0x14'))['db'];function respondWithStatusCode(_0x4c62ce,_0x268da0){_0x268da0=_0x268da0||0xcc;return function(_0x19c6d6){if(_0x19c6d6){return _0x4c62ce[_0x36dd('0x15')](_0x268da0);}return _0x4c62ce[_0x36dd('0x16')](_0x268da0)[_0x36dd('0x17')]();};}function respondWithResult(_0x5f1460,_0x32230e){_0x32230e=_0x32230e||0xc8;return function(_0x472611){if(_0x472611){return _0x5f1460[_0x36dd('0x16')](_0x32230e)[_0x36dd('0x18')](_0x472611);}};}function respondWithFilteredResult(_0x18703,_0x346c99){return function(_0x231552){if(_0x231552){var _0x2d67c5=typeof _0x346c99[_0x36dd('0x19')]===_0x36dd('0x1a')&&typeof _0x346c99[_0x36dd('0x1b')]==='undefined';var _0x31bd5c=_0x231552[_0x36dd('0x1c')];var _0x52b6e3=_0x2d67c5?0x0:_0x346c99[_0x36dd('0x19')];var _0x3ec9a3=_0x2d67c5?_0x231552[_0x36dd('0x1c')]:_0x346c99['offset']+_0x346c99[_0x36dd('0x1b')];var _0x2b4e7d;if(_0x3ec9a3>=_0x31bd5c){_0x3ec9a3=_0x31bd5c;_0x2b4e7d=0xc8;}else{_0x2b4e7d=0xce;}_0x18703[_0x36dd('0x16')](_0x2b4e7d);return _0x18703['set'](_0x36dd('0x1d'),_0x52b6e3+'-'+_0x3ec9a3+'/'+_0x31bd5c)[_0x36dd('0x18')](_0x231552);}return null;};}function patchUpdates(_0x2b3fa9){return function(_0x26e95e){try{jsonpatch[_0x36dd('0x1e')](_0x26e95e,_0x2b3fa9,!![]);}catch(_0x30265f){return BPromise[_0x36dd('0x1f')](_0x30265f);}return _0x26e95e[_0x36dd('0x20')]();};}function saveUpdates(_0x1a2cb1,_0x1684d9){return function(_0x801d1){if(_0x801d1){return _0x801d1['update'](_0x1a2cb1)[_0x36dd('0x21')](function(_0x21c589){return _0x21c589;});}return null;};}function removeEntity(_0x28715f,_0x4ba74c){return function(_0x13526d){if(_0x13526d){return _0x13526d['destroy']()[_0x36dd('0x21')](function(){_0x28715f['status'](0xcc)[_0x36dd('0x17')]();});}};}function handleEntityNotFound(_0x536712,_0x72bfef){return function(_0x1a5726){if(!_0x1a5726){_0x536712[_0x36dd('0x15')](0x194);}return _0x1a5726;};}function handleError(_0x21faa2,_0x4f5a89){_0x4f5a89=_0x4f5a89||0x1f4;return function(_0x20b33f){logger[_0x36dd('0x22')](_0x20b33f[_0x36dd('0x23')]);if(_0x20b33f[_0x36dd('0x24')]){delete _0x20b33f[_0x36dd('0x24')];}_0x21faa2[_0x36dd('0x16')](_0x4f5a89)['send'](_0x20b33f);};}exports[_0x36dd('0x25')]=function(_0x5bfcc4,_0x2cc70a){var _0x50a962={},_0x2ef3fc={},_0xfd82b8={'count':0x0,'rows':[]};var _0x333b51=_[_0x36dd('0x26')](db['WhatsappTransferReport'][_0x36dd('0x27')],function(_0x416f8e){return{'name':_0x416f8e['fieldName'],'type':_0x416f8e[_0x36dd('0x28')][_0x36dd('0x29')]};});_0x2ef3fc[_0x36dd('0x2a')]=_[_0x36dd('0x26')](_0x333b51,'name');_0x2ef3fc[_0x36dd('0x2b')]=_[_0x36dd('0x2c')](_0x5bfcc4[_0x36dd('0x2b')]);_0x2ef3fc['filters']=_[_0x36dd('0x2d')](_0x2ef3fc[_0x36dd('0x2a')],_0x2ef3fc['query']);_0x50a962[_0x36dd('0x2e')]=_['intersection'](_0x2ef3fc[_0x36dd('0x2a')],qs[_0x36dd('0x2f')](_0x5bfcc4[_0x36dd('0x2b')][_0x36dd('0x2f')]));_0x50a962[_0x36dd('0x2e')]=_0x50a962[_0x36dd('0x2e')][_0x36dd('0x30')]?_0x50a962[_0x36dd('0x2e')]:_0x2ef3fc['model'];if(!_0x5bfcc4[_0x36dd('0x2b')][_0x36dd('0x31')](_0x36dd('0x32'))){_0x50a962[_0x36dd('0x1b')]=qs[_0x36dd('0x1b')](_0x5bfcc4[_0x36dd('0x2b')][_0x36dd('0x1b')]);_0x50a962['offset']=qs[_0x36dd('0x19')](_0x5bfcc4[_0x36dd('0x2b')][_0x36dd('0x19')]);}_0x50a962[_0x36dd('0x33')]=qs[_0x36dd('0x34')](_0x5bfcc4[_0x36dd('0x2b')]['sort']);_0x50a962[_0x36dd('0x35')]=qs[_0x36dd('0x36')](_[_0x36dd('0x37')](_0x5bfcc4['query'],_0x2ef3fc[_0x36dd('0x36')]),_0x333b51);if(_0x5bfcc4['query'][_0x36dd('0x38')]){_0x50a962[_0x36dd('0x35')]=_[_0x36dd('0x39')](_0x50a962[_0x36dd('0x35')],{'$or':_[_0x36dd('0x26')](_0x333b51,function(_0x3b4fa1){if(_0x3b4fa1[_0x36dd('0x28')]!==_0x36dd('0x3a')){var _0x444510={};_0x444510[_0x3b4fa1[_0x36dd('0x24')]]={'$like':'%'+_0x5bfcc4['query'][_0x36dd('0x38')]+'%'};return _0x444510;}})});}_0x50a962=_[_0x36dd('0x39')]({},_0x50a962,_0x5bfcc4[_0x36dd('0x3b')]);var _0x38d496={'where':_0x50a962['where']};return db[_0x36dd('0x3c')]['count'](_0x38d496)[_0x36dd('0x21')](function(_0x1dd0dc){_0xfd82b8['count']=_0x1dd0dc;if(_0x5bfcc4['query'][_0x36dd('0x3d')]){_0x50a962[_0x36dd('0x3e')]=[{'all':!![]}];}return db[_0x36dd('0x3c')][_0x36dd('0x3f')](_0x50a962);})[_0x36dd('0x21')](function(_0x29ac64){_0xfd82b8[_0x36dd('0x40')]=_0x29ac64;return _0xfd82b8;})['then'](respondWithFilteredResult(_0x2cc70a,_0x50a962))[_0x36dd('0x41')](handleError(_0x2cc70a,null));};exports[_0x36dd('0x42')]=function(_0x4ba2f9,_0x4c360b){var _0x5083d3={'raw':!![],'where':{'id':_0x4ba2f9[_0x36dd('0x43')]['id']}},_0x2d92fb={};_0x2d92fb[_0x36dd('0x2a')]=_[_0x36dd('0x2c')](db[_0x36dd('0x3c')][_0x36dd('0x27')]);_0x2d92fb[_0x36dd('0x2b')]=_[_0x36dd('0x2c')](_0x4ba2f9[_0x36dd('0x2b')]);_0x2d92fb[_0x36dd('0x36')]=_[_0x36dd('0x2d')](_0x2d92fb[_0x36dd('0x2a')],_0x2d92fb[_0x36dd('0x2b')]);_0x5083d3['attributes']=_[_0x36dd('0x2d')](_0x2d92fb[_0x36dd('0x2a')],qs[_0x36dd('0x2f')](_0x4ba2f9['query'][_0x36dd('0x2f')]));_0x5083d3[_0x36dd('0x2e')]=_0x5083d3[_0x36dd('0x2e')][_0x36dd('0x30')]?_0x5083d3[_0x36dd('0x2e')]:_0x2d92fb[_0x36dd('0x2a')];if(_0x4ba2f9[_0x36dd('0x2b')][_0x36dd('0x3d')]){_0x5083d3[_0x36dd('0x3e')]=[{'all':!![]}];}_0x5083d3=_['merge']({},_0x5083d3,_0x4ba2f9[_0x36dd('0x3b')]);return db['WhatsappTransferReport'][_0x36dd('0x44')](_0x5083d3)[_0x36dd('0x21')](handleEntityNotFound(_0x4c360b,null))['then'](respondWithResult(_0x4c360b,null))[_0x36dd('0x41')](handleError(_0x4c360b,null));};exports[_0x36dd('0x45')]=function(_0x49a392,_0x1bec7d){return db[_0x36dd('0x3c')][_0x36dd('0x45')](_0x49a392[_0x36dd('0x46')],{})[_0x36dd('0x21')](respondWithResult(_0x1bec7d,0xc9))['catch'](handleError(_0x1bec7d,null));};exports['update']=function(_0x5741e7,_0x434c60){if(_0x5741e7[_0x36dd('0x46')]['id']){delete _0x5741e7[_0x36dd('0x46')]['id'];}return db[_0x36dd('0x3c')][_0x36dd('0x44')]({'where':{'id':_0x5741e7[_0x36dd('0x43')]['id']}})[_0x36dd('0x21')](handleEntityNotFound(_0x434c60,null))[_0x36dd('0x21')](saveUpdates(_0x5741e7[_0x36dd('0x46')],null))['then'](respondWithResult(_0x434c60,null))['catch'](handleError(_0x434c60,null));};exports[_0x36dd('0x47')]=function(_0x1f7de3,_0x547819){return db[_0x36dd('0x3c')]['find']({'where':{'id':_0x1f7de3['params']['id']}})[_0x36dd('0x21')](handleEntityNotFound(_0x547819,null))['then'](removeEntity(_0x547819,null))[_0x36dd('0x41')](handleError(_0x547819,null));};exports[_0x36dd('0x48')]=function(_0x4c0540,_0x4ee992){return db[_0x36dd('0x3c')][_0x36dd('0x48')]()[_0x36dd('0x21')](respondWithResult(_0x4ee992,null))['catch'](handleError(_0x4ee992,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 2eda6a1..949e011 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 _0xed9e=['lodash','../../config/logger','bluebird','path','../../config/environment','./whatsappTransferReport.attributes','exports','report_whatsapp_transfer','uniqueid'];(function(_0x178a27,_0x61d989){var _0x455a43=function(_0x41df54){while(--_0x41df54){_0x178a27['push'](_0x178a27['shift']());}};_0x455a43(++_0x61d989);}(_0xed9e,0xab));var _0xeed9=function(_0x2a24b3,_0x3f4ef2){_0x2a24b3=_0x2a24b3-0x0;var _0x2d9039=_0xed9e[_0x2a24b3];return _0x2d9039;};'use strict';var _=require(_0xeed9('0x0'));var util=require('util');var logger=require(_0xeed9('0x1'))('api');var moment=require('moment');var BPromise=require(_0xeed9('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeed9('0x3'));var rimraf=require('rimraf');var config=require(_0xeed9('0x4'));var attributes=require(_0xeed9('0x5'));module[_0xeed9('0x6')]=function(_0x154640,_0x3b1659){return _0x154640['define']('WhatsappTransferReport',attributes,{'tableName':_0xeed9('0x7'),'paranoid':![],'indexes':[{'name':_0xeed9('0x8'),'fields':[_0xeed9('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf7e8=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf7e8,0x112));var _0x8f7e=function(_0x4aab8c,_0x3206c0){_0x4aab8c=_0x4aab8c-0x0;var _0x279758=_0xf7e8[_0x4aab8c];return _0x279758;};'use strict';var _=require(_0x8f7e('0x0'));var util=require(_0x8f7e('0x1'));var logger=require(_0x8f7e('0x2'))(_0x8f7e('0x3'));var moment=require('moment');var BPromise=require(_0x8f7e('0x4'));var rp=require(_0x8f7e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f7e('0x6'));var config=require(_0x8f7e('0x7'));var attributes=require(_0x8f7e('0x8'));module[_0x8f7e('0x9')]=function(_0x1c46f4,_0x47ca97){return _0x1c46f4[_0x8f7e('0xa')]('WhatsappTransferReport',attributes,{'tableName':_0x8f7e('0xb'),'paranoid':![],'indexes':[{'name':_0x8f7e('0xc'),'fields':[_0x8f7e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index a776481..f394535 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 _0x8948=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x8948,0x13d));var _0x8894=function(_0x109832,_0x347896){_0x109832=_0x109832-0x0;var _0x15e8f4=_0x8948[_0x109832];return _0x15e8f4;};'use strict';var _=require(_0x8894('0x0'));var util=require('util');var moment=require(_0x8894('0x1'));var BPromise=require(_0x8894('0x2'));var rs=require(_0x8894('0x3'));var fs=require('fs');var Redis=require(_0x8894('0x4'));var db=require(_0x8894('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8894('0x6'));var config=require(_0x8894('0x7'));var jayson=require(_0x8894('0x8'));var client=jayson[_0x8894('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x272e99,_0x26ccc2,_0x5a7918){return new BPromise(function(_0x5beb5d,_0x2cda8f){return client['request'](_0x272e99,_0x5a7918)[_0x8894('0xa')](function(_0x486e19){logger['info'](_0x8894('0xb'),_0x26ccc2,_0x8894('0xc'));logger[_0x8894('0xd')](_0x8894('0xe'),_0x26ccc2,_0x8894('0xc'),JSON[_0x8894('0xf')](_0x486e19));if(_0x486e19['error']){if(_0x486e19['error']['code']===0x1f4){logger[_0x8894('0x10')](_0x8894('0xb'),_0x26ccc2,_0x486e19[_0x8894('0x10')][_0x8894('0x11')]);return _0x2cda8f(_0x486e19[_0x8894('0x10')][_0x8894('0x11')]);}logger[_0x8894('0x10')](_0x8894('0xb'),_0x26ccc2,_0x486e19[_0x8894('0x10')][_0x8894('0x11')]);return _0x5beb5d(_0x486e19[_0x8894('0x10')][_0x8894('0x11')]);}else{logger['info'](_0x8894('0xb'),_0x26ccc2,_0x8894('0xc'));_0x5beb5d(_0x486e19[_0x8894('0x12')][_0x8894('0x11')]);}})[_0x8894('0x13')](function(_0x57d1f8){logger[_0x8894('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x26ccc2,_0x57d1f8);_0x2cda8f(_0x57d1f8);});});} \ No newline at end of file +var _0xe895=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x3aaf0a,_0x450970){var _0x33e6bc=function(_0x1db54d){while(--_0x1db54d){_0x3aaf0a['push'](_0x3aaf0a['shift']());}};_0x33e6bc(++_0x450970);}(_0xe895,0xdc));var _0x5e89=function(_0x45d809,_0x379b71){_0x45d809=_0x45d809-0x0;var _0x1fdd72=_0xe895[_0x45d809];return _0x1fdd72;};'use strict';var _=require(_0x5e89('0x0'));var util=require(_0x5e89('0x1'));var moment=require('moment');var BPromise=require(_0x5e89('0x2'));var rs=require(_0x5e89('0x3'));var fs=require('fs');var Redis=require(_0x5e89('0x4'));var db=require(_0x5e89('0x5'))['db'];var utils=require(_0x5e89('0x6'));var logger=require(_0x5e89('0x7'))(_0x5e89('0x8'));var config=require(_0x5e89('0x9'));var jayson=require(_0x5e89('0xa'));var client=jayson['client'][_0x5e89('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e1386,_0x3c7317,_0x4e0f11){return new BPromise(function(_0x41c1d1,_0x158c52){return client[_0x5e89('0xc')](_0x2e1386,_0x4e0f11)['then'](function(_0x5c71c8){logger['info'](_0x5e89('0xd'),_0x3c7317,_0x5e89('0xe'));logger[_0x5e89('0xf')](_0x5e89('0x10'),_0x3c7317,_0x5e89('0xe'),JSON[_0x5e89('0x11')](_0x5c71c8));if(_0x5c71c8[_0x5e89('0x12')]){if(_0x5c71c8[_0x5e89('0x12')][_0x5e89('0x13')]===0x1f4){logger[_0x5e89('0x12')](_0x5e89('0xd'),_0x3c7317,_0x5c71c8[_0x5e89('0x12')][_0x5e89('0x14')]);return _0x158c52(_0x5c71c8[_0x5e89('0x12')][_0x5e89('0x14')]);}logger[_0x5e89('0x12')](_0x5e89('0xd'),_0x3c7317,_0x5c71c8[_0x5e89('0x12')][_0x5e89('0x14')]);return _0x41c1d1(_0x5c71c8[_0x5e89('0x12')][_0x5e89('0x14')]);}else{logger['info'](_0x5e89('0xd'),_0x3c7317,'request\x20sent');_0x41c1d1(_0x5c71c8['result'][_0x5e89('0x14')]);}})[_0x5e89('0x15')](function(_0x3d07a6){logger[_0x5e89('0x12')](_0x5e89('0xd'),_0x3c7317,_0x3d07a6);_0x158c52(_0x3d07a6);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index a89d1c4..49b636b 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfa63=['default','./config/license','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','listen','then','start','info','map','filter','online','name','join','Offline\x20apps:','status','None','seedDB'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xfa63,0xcf));var _0x3fa6=function(_0x38525f,_0x405f77){_0x38525f=_0x38525f-0x0;var _0x5e4cf6=_0xfa63[_0x38525f];return _0x5e4cf6;};'use strict';var _=require(_0x3fa6('0x0'));var mysqldb=require(_0x3fa6('0x1'));var rpc=require(_0x3fa6('0x2'));var config=require(_0x3fa6('0x3'));var logger=require(_0x3fa6('0x4'))('app');var pm2=require(_0x3fa6('0x5'));var pm2Config=require(_0x3fa6('0x6'));var schedule=require(_0x3fa6('0x7'));var chat=require(_0x3fa6('0x8'));var whatsapp=require(_0x3fa6('0x9'));var transcribe=require(_0x3fa6('0xa'));function main(){return mysqldb['db']['sequelize'][_0x3fa6('0xb')]()['then'](function(){return rpc[_0x3fa6('0xc')]();})[_0x3fa6('0xd')](function(_0x418098){logger['info'](_0x418098);return chat['start']();})[_0x3fa6('0xd')](function(){return whatsapp[_0x3fa6('0xe')]();})[_0x3fa6('0xd')](function(){return schedule['start']();})[_0x3fa6('0xd')](function(){return transcribe[_0x3fa6('0xe')]();})[_0x3fa6('0xd')](function(_0x5a2176){logger['info'](_0x5a2176);return pm2['start'](pm2Config);})[_0x3fa6('0xd')](function(_0x21e535){logger[_0x3fa6('0xf')]('Online\x20apps:',_[_0x3fa6('0x10')](_[_0x3fa6('0x11')](_0x21e535,{'status':_0x3fa6('0x12')}),_0x3fa6('0x13'))[_0x3fa6('0x14')]());logger['info'](_0x3fa6('0x15'),_[_0x3fa6('0x10')](_[_0x3fa6('0x11')](_0x21e535,function(_0x3af9f9){return _0x3af9f9[_0x3fa6('0x16')]!==_0x3fa6('0x12');}),_0x3fa6('0x13'))[_0x3fa6('0x14')]()||_0x3fa6('0x17'));config[_0x3fa6('0x18')]&&require('./config/seedDB')[_0x3fa6('0x19')]();require(_0x3fa6('0x1a'))[_0x3fa6('0x19')]();})['catch'](function(_0x2e32a3){logger[_0x3fa6('0x1b')](_0x3fa6('0x1c'),_0x2e32a3);process['exit'](0x1);});}main(); \ No newline at end of file +var _0xb39a=['exit','lodash','./mysqldb','./rpc','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','sequelize','sync','then','info','start','map','filter','online','Offline\x20apps:','name','join','seedDB','default','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s'];(function(_0x46d041,_0x4b80db){var _0x294f8a=function(_0x3ba9f4){while(--_0x3ba9f4){_0x46d041['push'](_0x46d041['shift']());}};_0x294f8a(++_0x4b80db);}(_0xb39a,0x88));var _0xab39=function(_0x4421a0,_0x1525bc){_0x4421a0=_0x4421a0-0x0;var _0x5626d0=_0xb39a[_0x4421a0];return _0x5626d0;};'use strict';var _=require(_0xab39('0x0'));var mysqldb=require(_0xab39('0x1'));var rpc=require(_0xab39('0x2'));var config=require('./config/environment');var logger=require(_0xab39('0x3'))(_0xab39('0x4'));var pm2=require(_0xab39('0x5'));var pm2Config=require(_0xab39('0x6'));var schedule=require(_0xab39('0x7'));var chat=require(_0xab39('0x8'));var whatsapp=require(_0xab39('0x9'));var transcribe=require('./config/schedule/transcribe');function main(){return mysqldb['db'][_0xab39('0xa')][_0xab39('0xb')]()[_0xab39('0xc')](function(){return rpc['listen']();})[_0xab39('0xc')](function(_0x598fee){logger[_0xab39('0xd')](_0x598fee);return chat[_0xab39('0xe')]();})[_0xab39('0xc')](function(){return whatsapp['start']();})['then'](function(){return schedule['start']();})[_0xab39('0xc')](function(){return transcribe['start']();})['then'](function(_0xce7a82){logger[_0xab39('0xd')](_0xce7a82);return pm2[_0xab39('0xe')](pm2Config);})[_0xab39('0xc')](function(_0x3065f8){logger['info']('Online\x20apps:',_[_0xab39('0xf')](_[_0xab39('0x10')](_0x3065f8,{'status':_0xab39('0x11')}),'name')['join']());logger['info'](_0xab39('0x12'),_[_0xab39('0xf')](_[_0xab39('0x10')](_0x3065f8,function(_0x56e51d){return _0x56e51d['status']!==_0xab39('0x11');}),_0xab39('0x13'))[_0xab39('0x14')]()||'None');config[_0xab39('0x15')]&&require('./config/seedDB')[_0xab39('0x16')]();require('./config/license')['default']();})[_0xab39('0x17')](function(_0x507274){logger[_0xab39('0x18')](_0xab39('0x19'),_0x507274);process[_0xab39('0x1a')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index d88d46d..c07e17c 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 _0xbcd5=['fullname','name','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','Forbidden.','catch','headers','authorization','Basic','find','pass','json','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','sub','Setting','allowedLoginAttempts','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blockDuration','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','validatePasswordPattern','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','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','splice','unshift','encryptString','join','promisify','sign','secret','payload','options','verify','randomBytes','now','toString','HS512','../../mysqldb','../../config/environment','../../config/license/util','lodash','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','util','moment','secrets','session','role'];(function(_0x4ee634,_0x328075){var _0x3b8710=function(_0x3e303e){while(--_0x3e303e){_0x4ee634['push'](_0x4ee634['shift']());}};_0x3b8710(++_0x328075);}(_0xbcd5,0x15d));var _0x5bcd=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xbcd5[_0x1d24eb];return _0x1dc576;};'use strict';var db=require(_0x5bcd('0x0'))['db'];var config=require(_0x5bcd('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x5bcd('0x2'));var encryptor=require('../encryptor');var _=require(_0x5bcd('0x3'));var jwt=require(_0x5bcd('0x4'));var expressJwt=require(_0x5bcd('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0x5bcd('0x6'));var crypto=require(_0x5bcd('0x7'));var BPromise=require(_0x5bcd('0x8'));var util=require(_0x5bcd('0x9'));var moment=require(_0x5bcd('0xa'));var validateJwt=expressJwt({'secret':config[_0x5bcd('0xb')][_0x5bcd('0xc')]});var userAttributes=['id',_0x5bcd('0xd'),_0x5bcd('0xe'),_0x5bcd('0xf'),'internal',_0x5bcd('0x10'),'userpic',_0x5bcd('0x11'),_0x5bcd('0x12'),_0x5bcd('0x13'),_0x5bcd('0x14'),_0x5bcd('0x15'),_0x5bcd('0x16'),_0x5bcd('0x17'),_0x5bcd('0x18'),'pauseType',_0x5bcd('0x19'),_0x5bcd('0x1a'),_0x5bcd('0x1b'),_0x5bcd('0x1c'),'allowmessenger',_0x5bcd('0x1d'),_0x5bcd('0x1e'),_0x5bcd('0x1f'),_0x5bcd('0x20'),'phoneBarDnd','phoneBarEnableRecording',_0x5bcd('0x21'),_0x5bcd('0x22'),_0x5bcd('0x23'),_0x5bcd('0x24'),_0x5bcd('0x25'),'phoneBarRemoteControlPort',_0x5bcd('0x26'),_0x5bcd('0x27'),'userProfileId',_0x5bcd('0x28'),_0x5bcd('0x29'),_0x5bcd('0x2a'),'downloadVoiceRecordings','downloadOmnichannelInteractions',_0x5bcd('0x2b')];exports[_0x5bcd('0x2c')]=function(){return this[_0x5bcd('0x2d')](!![])[_0x5bcd('0x2e')](function(_0x3085dc,_0x7bfea9,_0x13e838){if(_0x3085dc[_0x5bcd('0x2f')]){_0x13e838();}else{return db[_0x5bcd('0x30')]['findOne']({'where':{'id':_0x3085dc[_0x5bcd('0x31')]['id']},'attributes':['id',_0x5bcd('0x32'),_0x5bcd('0x33')],'raw':!![]})[_0x5bcd('0x34')](function(_0x4d6975){if(_0x4d6975&&_0x4d6975[_0x5bcd('0x32')]){return _0x7bfea9[_0x5bcd('0x35')](_0x4d6975['disposition']===_0x5bcd('0x36')?0x195:0x193)['json']({'message':_0x4d6975['disposition']===_0x5bcd('0x36')?'Unmanaged.':_0x5bcd('0x37')});}else{_0x13e838();}})[_0x5bcd('0x38')](function(_0x2fdb59){_0x13e838(_0x2fdb59);});}});};exports[_0x5bcd('0x2d')]=function isAuthenticated(_0x102d4a){return compose()['use'](function(_0x3fa9ef,_0x7a19c8,_0xec3cc5){var _0x4ed4f8;if(_0x3fa9ef[_0x5bcd('0x39')]['authorization']){if(_['startsWith'](_0x3fa9ef['headers'][_0x5bcd('0x3a')],_0x5bcd('0x3b'))){var _0x57b83a=basicAuth(_0x3fa9ef);db['User'][_0x5bcd('0x3c')]({'where':{'name':_0x57b83a[_0x5bcd('0xf')]}})['then'](function(_0x295448){if(!_0x295448||!_0x295448['authenticate'](_0x57b83a[_0x5bcd('0x3d')])){return _0x7a19c8[_0x5bcd('0x35')](0x191)[_0x5bcd('0x3e')]({'message':_0x5bcd('0x3f')});}_0x3fa9ef['user']={'id':_0x295448['id']};_0xec3cc5();})['catch'](function(_0x71e172){_0xec3cc5(_0x71e172);});}else if(_['startsWith'](_0x3fa9ef[_0x5bcd('0x39')][_0x5bcd('0x3a')],_0x5bcd('0x40'))){validateJwt(_0x3fa9ef,_0x7a19c8,_0xec3cc5);}else{if(_0x102d4a){_0xec3cc5();}else{return _0x7a19c8[_0x5bcd('0x35')](0x193)[_0x5bcd('0x3e')]({'message':_0x5bcd('0x41')});}}}else if(_0x3fa9ef[_0x5bcd('0x42')][_0x5bcd('0x43')]){try{var _0x4722d4={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x5bcd('0x44')]()};verifyJwt(_0x3fa9ef['query'][_0x5bcd('0x43')],_0x4722d4)['then'](function(_0x526b4d){return db[_0x5bcd('0x45')][_0x5bcd('0x3c')]({'where':{'id':_0x526b4d[_0x5bcd('0x46')]}})['then'](function(_0x1035a5){_0x4ed4f8=_0x1035a5;return db[_0x5bcd('0x47')]['findOne']({'where':{'id':0x1},'attributes':[_0x5bcd('0x48'),'blockDuration'],'raw':!![]});})[_0x5bcd('0x34')](function(_0x2af464){if(!_0x4ed4f8||!_[_0x5bcd('0x49')](_0x4ed4f8[_0x5bcd('0x4a')],_0x526b4d['nonce'])){return _0x7a19c8['status'](0x191)[_0x5bcd('0x3e')]({'message':_0x5bcd('0x4b')});}if(_0x4ed4f8['disabled']){return _0x7a19c8[_0x5bcd('0x35')](0x191)[_0x5bcd('0x3e')]({'message':_0x5bcd('0x4c')});}if(_0x4ed4f8['blocked']){if(_0x2af464[_0x5bcd('0x4d')]>0x0){if(moment(_0x4ed4f8['blockedAt'])['add'](_0x2af464[_0x5bcd('0x4d')],_0x5bcd('0x4e'))>moment()){return _0x7a19c8[_0x5bcd('0x35')](0x191)[_0x5bcd('0x3e')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x7a19c8[_0x5bcd('0x35')](0x191)[_0x5bcd('0x3e')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x3fa9ef[_0x5bcd('0x2f')]={'id':_0x4ed4f8['id']};_0xec3cc5();});})[_0x5bcd('0x38')](function(){return _0x7a19c8[_0x5bcd('0x35')](0x191)[_0x5bcd('0x3e')]({'message':_0x5bcd('0x4c')});});}catch(_0x13ed80){_0xec3cc5(_0x13ed80);}}else if(_0x102d4a){_0xec3cc5();}else{return _0x7a19c8[_0x5bcd('0x35')](0x193)[_0x5bcd('0x3e')]({'message':_0x5bcd('0x41')});}})[_0x5bcd('0x2e')](function(_0x260755,_0x2cc5ed,_0x171d68){if(_0x260755['user']){db['User'][_0x5bcd('0x3c')]({'where':{'id':_0x260755[_0x5bcd('0x2f')]['id']},'attributes':userAttributes})[_0x5bcd('0x34')](function(_0x34d9b3){if(!_0x34d9b3){return _0x2cc5ed[_0x5bcd('0x35')](0x194)['json']({'message':_0x5bcd('0x4f')});}_0x260755['user']=_0x34d9b3;_0x171d68();})[_0x5bcd('0x38')](function(_0xc4dc7a){_0x171d68(_0xc4dc7a);});}else if(_0x102d4a){_0x171d68();}else{return _0x2cc5ed[_0x5bcd('0x35')](0x194)[_0x5bcd('0x3e')]({'message':_0x5bcd('0x50')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x24c55e,_0x551afd,_0x17355f){return licenseUtil[_0x5bcd('0x51')]()[_0x5bcd('0x34')](function(_0x3f3838){if(_0x3f3838[_0x5bcd('0x52')]){_0x17355f();}else{return _0x551afd['status'](0x193)[_0x5bcd('0x3e')]({'message':_0x5bcd('0x53')});}})[_0x5bcd('0x38')](function(_0x4cbbe3){_0x17355f(_0x4cbbe3);});});};exports['isMiddleware']=function(_0x1c0f6e,_0x52df6c,_0x3793ce){_0x1c0f6e[_0x5bcd('0x54')]=!![];return _0x3793ce();};exports[_0x5bcd('0x55')]=function signToken(_0x41ff98){return signJwt(_0x41ff98);};exports[_0x5bcd('0x56')]=function(_0x43f0bf,_0x2dd372){if(!_0x43f0bf[_0x5bcd('0x2f')]){return _0x2dd372[_0x5bcd('0x35')](0x194)[_0x5bcd('0x3e')]({'message':_0x5bcd('0x57')});}var _0x4628ac={'payload':{'id':_0x43f0bf[_0x5bcd('0x2f')]['id'],'role':_0x43f0bf['user'][_0x5bcd('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4628ac)['then'](function(_0x276c77){_0x2dd372['cookie'](_0x5bcd('0x58'),_0x276c77);_0x2dd372[_0x5bcd('0x59')](_0x5bcd('0x5a'));})[_0x5bcd('0x38')](function(_0x579b72){return _0x2dd372['status'](0x1f4)[_0x5bcd('0x5b')](_0x579b72);});};exports[_0x5bcd('0x5c')]=function(_0x8cd8a5){if(_[_0x5bcd('0x5d')](_0x8cd8a5[_0x5bcd('0x4a')])||_[_0x5bcd('0x5d')](_0x8cd8a5['apiKeyIat'])){return null;}else{return createJwt(_0x8cd8a5);}};exports[_0x5bcd('0x5e')]=function(_0x1eed5a){_0x1eed5a[_0x5bcd('0x4a')]=generateNonce();_0x1eed5a[_0x5bcd('0x5f')]=generateIssuedAt();return createJwt(_0x1eed5a);};exports[_0x5bcd('0x60')]=function(_0x250570,_0x26eac4){var _0x29c02a=_0x250570[_0x5bcd('0x42')][_0x5bcd('0x43')];if(_0x29c02a){var _0x2e037a={'nonce':_0x26eac4[_0x5bcd('0x4a')],'iat':_0x26eac4['apiKeyIat'],'audience':hardwareConf[_0x5bcd('0x44')](),'issuer':hardwareConf[_0x5bcd('0x44')]()};return verifyJwt(_0x29c02a,_0x2e037a)[_0x5bcd('0x34')](function(){return generateApiKey(_0x26eac4);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x5bcd('0x61')]=function(_0x2befa8){var _0x53c844=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x53c844['test'](_0x2befa8))throw new db['Sequelize'][(_0x5bcd('0x62'))](_0x5bcd('0x63'));return;};exports[_0x5bcd('0x64')]=function(_0x3d43bc,_0x129eeb,_0xa4e821){var _0x263de2=encryptor['decryptString'](_0x129eeb)[_0x5bcd('0x65')](',');for(var _0x22ea37=0x0;_0x22ea37<_0xa4e821;_0x22ea37++){if(!_0x263de2[_0x22ea37])break;if(_0x3d43bc['toLowerCase']()===_0x263de2[_0x22ea37][_0x5bcd('0x66')]()){var _0x1fd239=util[_0x5bcd('0x67')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0xa4e821);if(_0xa4e821===0x1){_0x1fd239=_0x5bcd('0x68');}throw new db['Sequelize'][(_0x5bcd('0x62'))](_0x1fd239);}}return;};exports[_0x5bcd('0x69')]=function(_0x170842,_0x4d6077){var _0x4c0615=_0x4d6077?encryptor[_0x5bcd('0x6a')](_0x4d6077)[_0x5bcd('0x65')](','):[];if(_0x4c0615['length']===0x5){_0x4c0615[_0x5bcd('0x6b')](-0x1,0x1);}_0x4c0615[_0x5bcd('0x6c')](_0x170842);return encryptor[_0x5bcd('0x6d')](_0x4c0615[_0x5bcd('0x6e')](','));};function signJwt(_0x122f15){var _0x26b0d8=BPromise[_0x5bcd('0x6f')](jwt[_0x5bcd('0x70')],{'context':jwt});var _0x3072a4=_0x122f15[_0x5bcd('0x71')]||config['secrets'][_0x5bcd('0xc')];return new BPromise(function(_0x40d650,_0x1d3a4f){_0x26b0d8(_0x122f15[_0x5bcd('0x72')],_0x3072a4,_0x122f15[_0x5bcd('0x73')])[_0x5bcd('0x34')](function(_0xeab63f){_0x40d650(_0xeab63f);})['catch'](function(_0xb2c932){_0x1d3a4f(_0xb2c932);});});}function verifyJwt(_0xf9ef1d,_0x427d82,_0x42bdaa){var _0x218ba4=BPromise[_0x5bcd('0x6f')](jwt[_0x5bcd('0x74')],{'context':jwt});var _0xc40fef=_0x42bdaa||config[_0x5bcd('0xb')][_0x5bcd('0xc')];return new BPromise(function(_0x13672e,_0x2f814d){_0x218ba4(_0xf9ef1d,_0xc40fef,_0x427d82)[_0x5bcd('0x34')](function(_0x49ec30){_0x13672e(_0x49ec30);})[_0x5bcd('0x38')](function(_0xf3c968){_0x2f814d(_0xf3c968);});});}function generateNonce(){return crypto[_0x5bcd('0x75')](0x10)['toString']('hex');}function generateIssuedAt(){return Math['floor'](Date[_0x5bcd('0x76')]()/0x3e8)[_0x5bcd('0x77')]();}function createJwt(_0x29777a){var _0x23a080={'payload':{'iat':_0x29777a[_0x5bcd('0x5f')],'nonce':_0x29777a[_0x5bcd('0x4a')]},'options':{'algorithm':_0x5bcd('0x78'),'subject':_0x29777a['id'][_0x5bcd('0x77')](),'issuer':hardwareConf[_0x5bcd('0x44')](),'audience':hardwareConf[_0x5bcd('0x44')]()}};return signJwt(_0x23a080)[_0x5bcd('0x34')](function(_0x318139){return{'iat':_0x29777a[_0x5bcd('0x5f')],'nonce':_0x29777a[_0x5bcd('0x4a')],'token':_0x318139};});} \ No newline at end of file +var _0x0bf2=['send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','length','splice','unshift','promisify','sign','session','payload','options','toString','hex','floor','HS512','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','util','moment','secrets','fullname','name','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControl','hotdesk','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','isAuthenticated','headers','startsWith','authorization','Basic','authenticate','status','Wrong\x20credentials.','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','allowedLoginAttempts','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','User','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','/dashboards/general'];(function(_0x5b9e2b,_0x42cc74){var _0x4a9235=function(_0x1c4eb4){while(--_0x1c4eb4){_0x5b9e2b['push'](_0x5b9e2b['shift']());}};_0x4a9235(++_0x42cc74);}(_0x0bf2,0x10b));var _0x20bf=function(_0x1d120d,_0x44b022){_0x1d120d=_0x1d120d-0x0;var _0x508685=_0x0bf2[_0x1d120d];return _0x508685;};'use strict';var db=require(_0x20bf('0x0'))['db'];var config=require(_0x20bf('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x20bf('0x2'));var encryptor=require(_0x20bf('0x3'));var _=require('lodash');var jwt=require(_0x20bf('0x4'));var expressJwt=require(_0x20bf('0x5'));var compose=require('composable-middleware');var basicAuth=require(_0x20bf('0x6'));var crypto=require(_0x20bf('0x7'));var BPromise=require(_0x20bf('0x8'));var util=require(_0x20bf('0x9'));var moment=require(_0x20bf('0xa'));var validateJwt=expressJwt({'secret':config[_0x20bf('0xb')]['session']});var userAttributes=['id','role',_0x20bf('0xc'),_0x20bf('0xd'),'internal',_0x20bf('0xe'),_0x20bf('0xf'),_0x20bf('0x10'),_0x20bf('0x11'),_0x20bf('0x12'),_0x20bf('0x13'),_0x20bf('0x14'),_0x20bf('0x15'),_0x20bf('0x16'),_0x20bf('0x17'),_0x20bf('0x18'),_0x20bf('0x19'),_0x20bf('0x1a'),'lastPauseAt','crudPermissions',_0x20bf('0x1b'),'passwordResetAt',_0x20bf('0x1c'),_0x20bf('0x1d'),_0x20bf('0x1e'),'phoneBarDnd',_0x20bf('0x1f'),_0x20bf('0x20'),'phoneBarEnableSettings',_0x20bf('0x21'),'phoneBarPrefixRequired',_0x20bf('0x22'),'phoneBarRemoteControlPort',_0x20bf('0x23'),'interface',_0x20bf('0x24'),_0x20bf('0x25'),_0x20bf('0x26'),'wssPort',_0x20bf('0x27'),_0x20bf('0x28'),_0x20bf('0x29')];exports['isChatInteractionAuthorized']=function(){return this['isAuthenticated'](!![])[_0x20bf('0x2a')](function(_0x556394,_0x13ac56,_0x49abec){if(_0x556394[_0x20bf('0x2b')]){_0x49abec();}else{return db[_0x20bf('0x2c')][_0x20bf('0x2d')]({'where':{'id':_0x556394['params']['id']},'attributes':['id',_0x20bf('0x2e'),_0x20bf('0x2f')],'raw':!![]})[_0x20bf('0x30')](function(_0x4fbee3){if(_0x4fbee3&&_0x4fbee3['closed']){return _0x13ac56['status'](_0x4fbee3[_0x20bf('0x2f')]===_0x20bf('0x31')?0x195:0x193)[_0x20bf('0x32')]({'message':_0x4fbee3[_0x20bf('0x2f')]===_0x20bf('0x31')?_0x20bf('0x33'):_0x20bf('0x34')});}else{_0x49abec();}})['catch'](function(_0x2a20f3){_0x49abec(_0x2a20f3);});}});};exports[_0x20bf('0x35')]=function isAuthenticated(_0xa22ca7){return compose()['use'](function(_0x3d418c,_0x38c75f,_0x3e4265){var _0x53c551;if(_0x3d418c[_0x20bf('0x36')]['authorization']){if(_[_0x20bf('0x37')](_0x3d418c[_0x20bf('0x36')][_0x20bf('0x38')],_0x20bf('0x39'))){var _0x7cc66a=basicAuth(_0x3d418c);db['User']['find']({'where':{'name':_0x7cc66a[_0x20bf('0xd')]}})['then'](function(_0x734afa){if(!_0x734afa||!_0x734afa[_0x20bf('0x3a')](_0x7cc66a['pass'])){return _0x38c75f[_0x20bf('0x3b')](0x191)[_0x20bf('0x32')]({'message':_0x20bf('0x3c')});}_0x3d418c['user']={'id':_0x734afa['id']};_0x3e4265();})[_0x20bf('0x3d')](function(_0xf27b81){_0x3e4265(_0xf27b81);});}else if(_['startsWith'](_0x3d418c[_0x20bf('0x36')][_0x20bf('0x38')],_0x20bf('0x3e'))){validateJwt(_0x3d418c,_0x38c75f,_0x3e4265);}else{if(_0xa22ca7){_0x3e4265();}else{return _0x38c75f[_0x20bf('0x3b')](0x193)[_0x20bf('0x32')]({'message':_0x20bf('0x3f')});}}}else if(_0x3d418c[_0x20bf('0x40')][_0x20bf('0x41')]){try{var _0x52d3b8={'audience':hardwareConf[_0x20bf('0x42')](),'issuer':hardwareConf[_0x20bf('0x42')]()};verifyJwt(_0x3d418c['query']['apikey'],_0x52d3b8)['then'](function(_0x1f2d72){return db['User']['find']({'where':{'id':_0x1f2d72[_0x20bf('0x43')]}})[_0x20bf('0x30')](function(_0x471104){_0x53c551=_0x471104;return db['Setting'][_0x20bf('0x2d')]({'where':{'id':0x1},'attributes':[_0x20bf('0x44'),'blockDuration'],'raw':!![]});})[_0x20bf('0x30')](function(_0x364df1){if(!_0x53c551||!_['isEqual'](_0x53c551[_0x20bf('0x45')],_0x1f2d72[_0x20bf('0x46')])){return _0x38c75f[_0x20bf('0x3b')](0x191)[_0x20bf('0x32')]({'message':_0x20bf('0x47')});}if(_0x53c551[_0x20bf('0x48')]){return _0x38c75f[_0x20bf('0x3b')](0x191)['json']({'message':_0x20bf('0x49')});}if(_0x53c551[_0x20bf('0x4a')]){if(_0x364df1['blockDuration']>0x0){if(moment(_0x53c551[_0x20bf('0x4b')])[_0x20bf('0x4c')](_0x364df1['blockDuration'],'minutes')>moment()){return _0x38c75f['status'](0x191)['json']({'message':_0x20bf('0x49')});}}else{return _0x38c75f[_0x20bf('0x3b')](0x191)['json']({'message':_0x20bf('0x49')});}}_0x3d418c[_0x20bf('0x2b')]={'id':_0x53c551['id']};_0x3e4265();});})[_0x20bf('0x3d')](function(){return _0x38c75f['status'](0x191)[_0x20bf('0x32')]({'message':_0x20bf('0x49')});});}catch(_0x2681c4){_0x3e4265(_0x2681c4);}}else if(_0xa22ca7){_0x3e4265();}else{return _0x38c75f['status'](0x193)[_0x20bf('0x32')]({'message':_0x20bf('0x3f')});}})['use'](function(_0x12292e,_0x27d7a1,_0x30e343){if(_0x12292e[_0x20bf('0x2b')]){db[_0x20bf('0x4d')]['find']({'where':{'id':_0x12292e['user']['id']},'attributes':userAttributes})[_0x20bf('0x30')](function(_0x35735d){if(!_0x35735d){return _0x27d7a1[_0x20bf('0x3b')](0x194)[_0x20bf('0x32')]({'message':_0x20bf('0x4e')});}_0x12292e['user']=_0x35735d;_0x30e343();})['catch'](function(_0x5917b6){_0x30e343(_0x5917b6);});}else if(_0xa22ca7){_0x30e343();}else{return _0x27d7a1[_0x20bf('0x3b')](0x194)[_0x20bf('0x32')]({'message':_0x20bf('0x4f')});}});};exports[_0x20bf('0x50')]=function canUpdate(){return compose()[_0x20bf('0x2a')](function(_0x5c9bf2,_0x426f2e,_0x2e125e){return licenseUtil[_0x20bf('0x51')]()[_0x20bf('0x30')](function(_0x1ee2a9){if(_0x1ee2a9['update']){_0x2e125e();}else{return _0x426f2e[_0x20bf('0x3b')](0x193)[_0x20bf('0x32')]({'message':_0x20bf('0x52')});}})[_0x20bf('0x3d')](function(_0x42c4e){_0x2e125e(_0x42c4e);});});};exports[_0x20bf('0x53')]=function(_0x15346b,_0x39c997,_0x22b563){_0x15346b[_0x20bf('0x53')]=!![];return _0x22b563();};exports[_0x20bf('0x54')]=function signToken(_0x8959ef){return signJwt(_0x8959ef);};exports[_0x20bf('0x55')]=function(_0x36cfd9,_0x38cda7){if(!_0x36cfd9[_0x20bf('0x2b')]){return _0x38cda7[_0x20bf('0x3b')](0x194)[_0x20bf('0x32')]({'message':_0x20bf('0x56')});}var _0x3d6d48={'payload':{'id':_0x36cfd9['user']['id'],'role':_0x36cfd9['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3d6d48)[_0x20bf('0x30')](function(_0x1afba8){_0x38cda7[_0x20bf('0x57')](_0x20bf('0x58'),_0x1afba8);_0x38cda7['redirect'](_0x20bf('0x59'));})[_0x20bf('0x3d')](function(_0x34340f){return _0x38cda7[_0x20bf('0x3b')](0x1f4)[_0x20bf('0x5a')](_0x34340f);});};exports[_0x20bf('0x5b')]=function(_0x5b95fb){if(_[_0x20bf('0x5c')](_0x5b95fb['apiKeyNonce'])||_[_0x20bf('0x5c')](_0x5b95fb[_0x20bf('0x5d')])){return null;}else{return createJwt(_0x5b95fb);}};exports['generateApiKey']=function(_0x4d9470){_0x4d9470[_0x20bf('0x45')]=generateNonce();_0x4d9470[_0x20bf('0x5d')]=generateIssuedAt();return createJwt(_0x4d9470);};exports[_0x20bf('0x5e')]=function(_0x9da0e5,_0x1e792b){var _0xb29eda=_0x9da0e5['query']['apikey'];if(_0xb29eda){var _0x186fd1={'nonce':_0x1e792b[_0x20bf('0x45')],'iat':_0x1e792b[_0x20bf('0x5d')],'audience':hardwareConf[_0x20bf('0x42')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0xb29eda,_0x186fd1)[_0x20bf('0x30')](function(){return generateApiKey(_0x1e792b);});}else{throw{'message':_0x20bf('0x5f')};}};exports[_0x20bf('0x60')]=function(_0x1dd160){var _0x2d33ed=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2d33ed[_0x20bf('0x61')](_0x1dd160))throw new db['Sequelize'][(_0x20bf('0x62'))](_0x20bf('0x63'));return;};exports[_0x20bf('0x64')]=function(_0x3ab8bc,_0xf95785,_0x33810f){var _0x32fde9=encryptor[_0x20bf('0x65')](_0xf95785)[_0x20bf('0x66')](',');for(var _0x5ef0a3=0x0;_0x5ef0a3<_0x33810f;_0x5ef0a3++){if(!_0x32fde9[_0x5ef0a3])break;if(_0x3ab8bc[_0x20bf('0x67')]()===_0x32fde9[_0x5ef0a3][_0x20bf('0x67')]()){var _0x8bdc7f=util['format'](_0x20bf('0x68'),_0x33810f);if(_0x33810f===0x1){_0x8bdc7f=_0x20bf('0x69');}throw new db[(_0x20bf('0x6a'))][(_0x20bf('0x62'))](_0x8bdc7f);}}return;};exports['updatePasswordsHistory']=function(_0x149c03,_0x35c942){var _0x25c4dd=_0x35c942?encryptor[_0x20bf('0x65')](_0x35c942)[_0x20bf('0x66')](','):[];if(_0x25c4dd[_0x20bf('0x6b')]===0x5){_0x25c4dd[_0x20bf('0x6c')](-0x1,0x1);}_0x25c4dd[_0x20bf('0x6d')](_0x149c03);return encryptor['encryptString'](_0x25c4dd['join'](','));};function signJwt(_0x47bce6){var _0x21845a=BPromise[_0x20bf('0x6e')](jwt[_0x20bf('0x6f')],{'context':jwt});var _0x2bafac=_0x47bce6['secret']||config[_0x20bf('0xb')][_0x20bf('0x70')];return new BPromise(function(_0x575f85,_0x37d167){_0x21845a(_0x47bce6[_0x20bf('0x71')],_0x2bafac,_0x47bce6[_0x20bf('0x72')])[_0x20bf('0x30')](function(_0x435f1b){_0x575f85(_0x435f1b);})[_0x20bf('0x3d')](function(_0x35b01d){_0x37d167(_0x35b01d);});});}function verifyJwt(_0x5282d7,_0x569645,_0x3abfa5){var _0x502664=BPromise[_0x20bf('0x6e')](jwt['verify'],{'context':jwt});var _0x372338=_0x3abfa5||config[_0x20bf('0xb')][_0x20bf('0x70')];return new BPromise(function(_0x443d21,_0x507aeb){_0x502664(_0x5282d7,_0x372338,_0x569645)['then'](function(_0x51d7c6){_0x443d21(_0x51d7c6);})[_0x20bf('0x3d')](function(_0x295546){_0x507aeb(_0x295546);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x20bf('0x73')](_0x20bf('0x74'));}function generateIssuedAt(){return Math[_0x20bf('0x75')](Date['now']()/0x3e8)[_0x20bf('0x73')]();}function createJwt(_0x127d03){var _0x5d9201={'payload':{'iat':_0x127d03[_0x20bf('0x5d')],'nonce':_0x127d03[_0x20bf('0x45')]},'options':{'algorithm':_0x20bf('0x76'),'subject':_0x127d03['id']['toString'](),'issuer':hardwareConf[_0x20bf('0x42')](),'audience':hardwareConf[_0x20bf('0x42')]()}};return signJwt(_0x5d9201)['then'](function(_0x267217){return{'iat':_0x127d03[_0x20bf('0x5d')],'nonce':_0x127d03[_0x20bf('0x45')],'token':_0x267217};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index cbd7d54..eb2ae1c 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 _0x5ee6=['end','final','binary','close','unlink','decryptFile','createDecipher','utf8','base64','decryptString','secret','crypto','lodash','../../config/environment','../../config/logger','app','secrets','session','aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','write'];(function(_0x3547d7,_0x31561a){var _0x32fb3c=function(_0x2b0a39){while(--_0x2b0a39){_0x3547d7['push'](_0x3547d7['shift']());}};_0x32fb3c(++_0x31561a);}(_0x5ee6,0x181));var _0x65ee=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5ee6[_0x2641f9];return _0x585741;};'use strict';var crypto=require(_0x65ee('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x65ee('0x1'));var config=require(_0x65ee('0x2'));var logger=require(_0x65ee('0x3'))(_0x65ee('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x65ee('0x5')][_0x65ee('0x6')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x65ee('0x7')};if(config[_0x65ee('0x8')]&&config['encrypt'][_0x65ee('0x9')]){var isSupported=isAlgorithmSupported(config[_0x65ee('0x8')][_0x65ee('0x9')]);if(isSupported){fileOptions[_0x65ee('0x9')]=config[_0x65ee('0x8')][_0x65ee('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0x65ee('0x8')]['algorithm'],_0x65ee('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0xe881b2){return AES_SUPPORTED_RX[_0x65ee('0xb')](_0xe881b2);}function getSupportedCiphers(){return crypto[_0x65ee('0xc')]()[_0x65ee('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x1bae01){return getSupportedCiphers()[_0x65ee('0xe')](_0x1bae01)>-0x1;}function combineOptions(_0x294b37){var _0x26a9b3={};for(var _0x3c2708 in fileOptions){if(fileOptions[_0x65ee('0xf')](_0x3c2708)){_0x26a9b3[_0x3c2708]=fileOptions[_0x3c2708];}}if(_0x294b37){for(var _0x5c8ec6 in _0x294b37){if(_0x294b37['hasOwnProperty'](_0x5c8ec6)){_0x26a9b3[_0x5c8ec6]=_0x294b37[_0x5c8ec6];}}}return _0x26a9b3;}exports[_0x65ee('0x10')]=function(_0x179da5,_0x117710,_0x2d675f,_0x1e891e){return new BPromise(function(_0x3b6e67,_0x1011f7){_0x1e891e=combineOptions(_0x1e891e);var _0x3ea7d4=new Buffer(_0x2d675f);var _0x118342=fs[_0x65ee('0x11')](_0x179da5);var _0xa6300d=fs[_0x65ee('0x12')](_0x117710);var _0x4b4cbe=crypto[_0x65ee('0x13')](_0x1e891e[_0x65ee('0x9')],_0x3ea7d4);_0x118342['on'](_0x65ee('0x14'),function(_0x4b6c60){var _0x3cc437=new Buffer(_0x4b4cbe[_0x65ee('0x15')](_0x4b6c60),'binary');_0xa6300d[_0x65ee('0x16')](_0x3cc437);});_0x118342['on'](_0x65ee('0x17'),function(){try{var _0x4ef668=new Buffer(_0x4b4cbe[_0x65ee('0x18')]('binary'),_0x65ee('0x19'));_0xa6300d[_0x65ee('0x16')](_0x4ef668);_0xa6300d['end']();_0xa6300d['on'](_0x65ee('0x1a'),function(){return _0x3b6e67(_0x117710);});}catch(_0x29ba7e){fs[_0x65ee('0x1b')](_0x117710);return _0x1011f7(_0x29ba7e);}});});};exports[_0x65ee('0x1c')]=function(_0x33a575,_0x3a4262,_0x5ebb79,_0x1a85bb){return new BPromise(function(_0x9c4974,_0x4b6725){_0x1a85bb=combineOptions(_0x1a85bb);var _0x2e3026=new Buffer(_0x5ebb79);var _0x5c4cce=fs[_0x65ee('0x11')](_0x33a575);var _0x357c4c=fs['createWriteStream'](_0x3a4262);var _0x51347e=crypto[_0x65ee('0x1d')](_0x1a85bb[_0x65ee('0x9')],_0x2e3026);_0x5c4cce['on'](_0x65ee('0x14'),function(_0x5182ce){var _0xbbd00f=new Buffer(_0x51347e[_0x65ee('0x15')](_0x5182ce),_0x65ee('0x19'));_0x357c4c[_0x65ee('0x16')](_0xbbd00f);});_0x5c4cce['on'](_0x65ee('0x17'),function(){try{var _0x3c3dc4=new Buffer(_0x51347e[_0x65ee('0x18')](_0x65ee('0x19')),_0x65ee('0x19'));_0x357c4c['write'](_0x3c3dc4);_0x357c4c[_0x65ee('0x17')]();_0x357c4c['on']('close',function(){return _0x9c4974(_0x3a4262);});}catch(_0x35ac8b){fs[_0x65ee('0x1b')](_0x3a4262);return _0x4b6725(_0x35ac8b);}});});};exports['encryptString']=function(_0x24000a,_0x192fa3,_0x4e3efb){var _0xc9a604=_0x4e3efb||stringOptions[_0x65ee('0x9')];var _0xc2aa21=_0x192fa3||stringOptions['secret'];var _0x3243cd=crypto[_0x65ee('0x13')](_0xc9a604,_0xc2aa21);var _0x302647=_0x3243cd[_0x65ee('0x15')](_0x24000a,_0x65ee('0x1e'),_0x65ee('0x1f'));_0x302647+=_0x3243cd[_0x65ee('0x18')]('base64');return _0x302647;};exports[_0x65ee('0x20')]=function(_0x465ced,_0x352a74,_0x3ebef2){var _0xf44793=_0x3ebef2||stringOptions[_0x65ee('0x9')];var _0x1939f4=_0x352a74||stringOptions[_0x65ee('0x21')];var _0x3f2b90=crypto[_0x65ee('0x1d')](_0xf44793,_0x1939f4);var _0x2aa310=_0x3f2b90['update'](_0x465ced,_0x65ee('0x1f'),_0x65ee('0x1e'));_0x2aa310+=_0x3f2b90[_0x65ee('0x18')](_0x65ee('0x1e'));return _0x2aa310;}; \ No newline at end of file +var _0xa4e5=['close','unlink','createDecipher','encryptString','secret','utf8','base64','crypto','bluebird','../../config/logger','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','update','binary','write','end','final'];(function(_0x59d0cc,_0xa7c52b){var _0x2ae79f=function(_0x33042e){while(--_0x33042e){_0x59d0cc['push'](_0x59d0cc['shift']());}};_0x2ae79f(++_0xa7c52b);}(_0xa4e5,0xff));var _0x5a4e=function(_0x56cc28,_0x4a921e){_0x56cc28=_0x56cc28-0x0;var _0x1f5798=_0xa4e5[_0x56cc28];return _0x1f5798;};'use strict';var crypto=require(_0x5a4e('0x0'));var fs=require('fs');var BPromise=require(_0x5a4e('0x1'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0x5a4e('0x2'))(_0x5a4e('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x5a4e('0x4')][_0x5a4e('0x5')],'algorithm':_0x5a4e('0x6')};const fileOptions={'algorithm':_0x5a4e('0x7')};if(config[_0x5a4e('0x8')]&&config[_0x5a4e('0x8')][_0x5a4e('0x9')]){var isSupported=isAlgorithmSupported(config[_0x5a4e('0x8')][_0x5a4e('0x9')]);if(isSupported){fileOptions[_0x5a4e('0x9')]=config['encrypt'][_0x5a4e('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x5a4e('0xa')](config[_0x5a4e('0x8')]['algorithm'],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x45f0bb){return AES_SUPPORTED_RX['test'](_0x45f0bb);}function getSupportedCiphers(){return crypto[_0x5a4e('0xb')]()[_0x5a4e('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x2a3986){return getSupportedCiphers()[_0x5a4e('0xd')](_0x2a3986)>-0x1;}function combineOptions(_0x1cd9e4){var _0x43f8a7={};for(var _0xc978b in fileOptions){if(fileOptions[_0x5a4e('0xe')](_0xc978b)){_0x43f8a7[_0xc978b]=fileOptions[_0xc978b];}}if(_0x1cd9e4){for(var _0x4814ce in _0x1cd9e4){if(_0x1cd9e4[_0x5a4e('0xe')](_0x4814ce)){_0x43f8a7[_0x4814ce]=_0x1cd9e4[_0x4814ce];}}}return _0x43f8a7;}exports[_0x5a4e('0xf')]=function(_0x11778e,_0xf0fe6c,_0x4d7da6,_0x3f75be){return new BPromise(function(_0x558023,_0x1778d2){_0x3f75be=combineOptions(_0x3f75be);var _0x24cc67=new Buffer(_0x4d7da6);var _0x2fdab8=fs[_0x5a4e('0x10')](_0x11778e);var _0x2b92e5=fs[_0x5a4e('0x11')](_0xf0fe6c);var _0x46448e=crypto['createCipher'](_0x3f75be[_0x5a4e('0x9')],_0x24cc67);_0x2fdab8['on'](_0x5a4e('0x12'),function(_0x328aa5){var _0x1f56b3=new Buffer(_0x46448e[_0x5a4e('0x13')](_0x328aa5),_0x5a4e('0x14'));_0x2b92e5[_0x5a4e('0x15')](_0x1f56b3);});_0x2fdab8['on'](_0x5a4e('0x16'),function(){try{var _0x50911d=new Buffer(_0x46448e[_0x5a4e('0x17')](_0x5a4e('0x14')),_0x5a4e('0x14'));_0x2b92e5['write'](_0x50911d);_0x2b92e5[_0x5a4e('0x16')]();_0x2b92e5['on'](_0x5a4e('0x18'),function(){return _0x558023(_0xf0fe6c);});}catch(_0x4e854d){fs[_0x5a4e('0x19')](_0xf0fe6c);return _0x1778d2(_0x4e854d);}});});};exports['decryptFile']=function(_0x507e7a,_0x1f398d,_0x3cdf24,_0x4b49a8){return new BPromise(function(_0x2180d6,_0x571220){_0x4b49a8=combineOptions(_0x4b49a8);var _0x2bad3f=new Buffer(_0x3cdf24);var _0x3348ff=fs[_0x5a4e('0x10')](_0x507e7a);var _0xc353ca=fs['createWriteStream'](_0x1f398d);var _0xb8784c=crypto[_0x5a4e('0x1a')](_0x4b49a8[_0x5a4e('0x9')],_0x2bad3f);_0x3348ff['on'](_0x5a4e('0x12'),function(_0x33cd29){var _0x552e2b=new Buffer(_0xb8784c['update'](_0x33cd29),'binary');_0xc353ca['write'](_0x552e2b);});_0x3348ff['on'](_0x5a4e('0x16'),function(){try{var _0x39ef07=new Buffer(_0xb8784c['final'](_0x5a4e('0x14')),'binary');_0xc353ca['write'](_0x39ef07);_0xc353ca[_0x5a4e('0x16')]();_0xc353ca['on'](_0x5a4e('0x18'),function(){return _0x2180d6(_0x1f398d);});}catch(_0x567d8c){fs['unlink'](_0x1f398d);return _0x571220(_0x567d8c);}});});};exports[_0x5a4e('0x1b')]=function(_0x7c2ad,_0x582eae,_0x57b277){var _0x2018eb=_0x57b277||stringOptions[_0x5a4e('0x9')];var _0xdd9e67=_0x582eae||stringOptions[_0x5a4e('0x1c')];var _0xc85b72=crypto['createCipher'](_0x2018eb,_0xdd9e67);var _0x4bfe48=_0xc85b72['update'](_0x7c2ad,_0x5a4e('0x1d'),_0x5a4e('0x1e'));_0x4bfe48+=_0xc85b72['final'](_0x5a4e('0x1e'));return _0x4bfe48;};exports['decryptString']=function(_0x2f6b6f,_0x17b8e1,_0x3e8c82){var _0x3d4628=_0x3e8c82||stringOptions[_0x5a4e('0x9')];var _0x5dca57=_0x17b8e1||stringOptions[_0x5a4e('0x1c')];var _0x58ec35=crypto[_0x5a4e('0x1a')](_0x3d4628,_0x5dca57);var _0x54e853=_0x58ec35[_0x5a4e('0x13')](_0x2f6b6f,_0x5a4e('0x1e'),_0x5a4e('0x1d'));_0x54e853+=_0x58ec35[_0x5a4e('0x17')]('utf8');return _0x54e853;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 3302bfd..4f8b5a6 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 _0x21f8=['query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','range','%s\x20limit\x20%d\x20OFFSET\x20%d','push','length','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x21f8,0x71));var _0x821f=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0x21f8[_0x46428c];return _0x16a677;};'use strict';var util=require(_0x821f('0x0'));var path=require(_0x821f('0x1'));var _=require(_0x821f('0x2'));var csv=require(_0x821f('0x3'));var fs=require('fs');var BPromise=require(_0x821f('0x4'));var zipdir=require(_0x821f('0x5'));var rimraf=require(_0x821f('0x6'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x821f('0x7'))(_0x821f('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x821f('0x9')][0x2]);var QUERY=process[_0x821f('0x9')][0x3];var PATH=process[_0x821f('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3a42fe,_0x1b9945){var _0xfcb0a={'status':_0x3a42fe};var _0x4e260d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1b9945){_0xfcb0a['savename']=_0x1b9945;}return db[_0x821f('0xa')][_0x821f('0xb')](_0xfcb0a,_0x4e260d);}function main(){var _0x81e2f4=0x1388;var _0x53ce42;logger[_0x821f('0xc')](util[_0x821f('0xd')](_0x821f('0xe'),EXTRACTED_REPORT_ID,_0x821f('0xf')));return db[_0x821f('0x10')][_0x821f('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x821f('0x12'),_0x821f('0x13')]})[_0x821f('0x14')](function(_0x2aeb4e){if(_0x2aeb4e){_0x53ce42=_0x2aeb4e;_0x81e2f4=_0x53ce42['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x821f('0x15')][_0x821f('0x16')](util[_0x821f('0xd')](_0x821f('0x17'),QUERY),{'type':dbH[_0x821f('0x15')][_0x821f('0x18')][_0x821f('0x19')]});})[_0x821f('0x14')](function(_0x1aeda5){if(!_0x1aeda5[0x0][_0x821f('0x1a')]){return analyticExtractedReport('Empty');}var _0x3419ab=[];var _0x594165=0x0;if(_0x53ce42[_0x821f('0x12')]){if(_0x1aeda5&&_0x1aeda5['length']){var _0x46acae=_[_0x821f('0x1b')](_0x1aeda5[0x0][_0x821f('0x1a')]/_0x81e2f4);var _0x27c41c=Number['isInteger'](_0x1aeda5[0x0][_0x821f('0x1a')]/_0x81e2f4)?_0x1aeda5[0x0][_0x821f('0x1a')]%_0x81e2f4:0x0;_0x46acae['forEach'](function(_0x193b41){if(_0x193b41>0x0){_0x594165+=_0x81e2f4;}_0x3419ab['push'](dbH[_0x821f('0x15')]['query'](util[_0x821f('0xd')](_0x821f('0x1c'),QUERY,_0x81e2f4,_0x594165),{'type':dbH['sequelize']['QueryTypes'][_0x821f('0x19')]}));});if(_0x27c41c>0x0){_0x594165+=_0x81e2f4;_0x3419ab[_0x821f('0x1d')](dbH[_0x821f('0x15')]['query'](util[_0x821f('0xd')](_0x821f('0x1c'),QUERY,_0x27c41c,_0x594165),{'type':dbH[_0x821f('0x15')]['QueryTypes'][_0x821f('0x19')]}));}}}else{_0x3419ab[_0x821f('0x1d')](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0x821f('0x19')]}));}var _0x4af347=path['dirname'](PATH);var _0x21c1d9=path['basename'](PATH,'.csv');var _0x3d7994=_0x53ce42[_0x821f('0x12')]&&_0x3419ab[_0x821f('0x1e')]>0x1;var _0x368a74=[];if(!fs['existsSync'](path[_0x821f('0x1f')](_0x4af347,_0x21c1d9))&&_0x3d7994){fs[_0x821f('0x20')](path[_0x821f('0x1f')](_0x4af347,_0x21c1d9));}return BPromise[_0x821f('0x21')](_0x3419ab,function(_0x47f0b6){_0x368a74[_0x821f('0x1d')](_0x47f0b6);})[_0x821f('0x14')](function(){for(var _0x130649=0x0;_0x130649<_0x368a74[_0x821f('0x1e')];_0x130649+=0x1){var _0x53d87e;var _0xceb073=_0x368a74[_0x130649];if(_0x3d7994){_0x53d87e=path['join'](_0x4af347,_0x21c1d9,util['format'](_0x821f('0x22'),_0x21c1d9,_0x130649,_0x821f('0x23')));}else{_0x53d87e=path[_0x821f('0x1f')](_0x4af347,util[_0x821f('0xd')](_0x821f('0x24'),_0x21c1d9,'csv'));}fs[_0x821f('0x25')](_0x53d87e,csv(_0xceb073));}})[_0x821f('0x14')](function(){if(_0x3d7994){return new Promise(function(_0x17db9d){zipdir(path[_0x821f('0x1f')](_0x4af347,_0x21c1d9),{'saveTo':path['join'](_0x4af347,util[_0x821f('0xd')](_0x821f('0x24'),_0x21c1d9,_0x821f('0x26')))},function(_0x15891b,_0x1d2660){rimraf(path[_0x821f('0x1f')](_0x4af347,_0x21c1d9),function(){});_0x17db9d('zip\x20finished');});});}})[_0x821f('0x14')](function(){logger['info'](util[_0x821f('0xd')](_0x821f('0x27'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x3d7994?util[_0x821f('0xd')](_0x821f('0x24'),_0x21c1d9,_0x3d7994?_0x821f('0x26'):_0x821f('0x23')):null);});})[_0x821f('0x28')](function(_0x5e09d9){logger['info'](util[_0x821f('0xd')](_0x821f('0x29'),EXTRACTED_REPORT_ID,_0x821f('0xf')),util['inspect'](_0x5e09d9,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x821f('0x2a'));})[_0x821f('0x2b')](function(){process[_0x821f('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0ab9=['update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','split','range','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.csv','length','existsSync','join','mkdirSync','%s%d.%s','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','csv','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport'];(function(_0x2826d9,_0x28f60f){var _0x96122b=function(_0x59c6e0){while(--_0x59c6e0){_0x2826d9['push'](_0x2826d9['shift']());}};_0x96122b(++_0x28f60f);}(_0x0ab9,0x160));var _0x90ab=function(_0x4276d1,_0x3cb974){_0x4276d1=_0x4276d1-0x0;var _0x2ee534=_0x0ab9[_0x4276d1];return _0x2ee534;};'use strict';var util=require('util');var path=require(_0x90ab('0x0'));var _=require(_0x90ab('0x1'));var csv=require(_0x90ab('0x2'));var fs=require('fs');var BPromise=require(_0x90ab('0x3'));var zipdir=require(_0x90ab('0x4'));var rimraf=require(_0x90ab('0x5'));var db=require(_0x90ab('0x6'))['db'];var dbH=require(_0x90ab('0x6'))[_0x90ab('0x7')];var logger=require(_0x90ab('0x8'))(_0x90ab('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x90ab('0xa')][0x2]);var QUERY=process[_0x90ab('0xa')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x46aa05,_0x33c469){var _0x1d5adb={'status':_0x46aa05};var _0x4361e9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x33c469){_0x1d5adb['savename']=_0x33c469;}return db[_0x90ab('0xb')][_0x90ab('0xc')](_0x1d5adb,_0x4361e9);}function main(){var _0x20f4b6=0x1388;var _0x5e71a4;logger[_0x90ab('0xd')](util[_0x90ab('0xe')](_0x90ab('0xf'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x90ab('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x90ab('0x11')]})[_0x90ab('0x12')](function(_0x5d1456){if(_0x5d1456){_0x5e71a4=_0x5d1456;_0x20f4b6=_0x5e71a4['splitSizeCsv']||0x1388;}})['then'](function(){return dbH[_0x90ab('0x13')][_0x90ab('0x14')](util[_0x90ab('0xe')](_0x90ab('0x15'),QUERY),{'type':dbH[_0x90ab('0x13')][_0x90ab('0x16')][_0x90ab('0x17')]});})[_0x90ab('0x12')](function(_0x5d0565){if(!_0x5d0565[0x0][_0x90ab('0x18')]){return analyticExtractedReport('Empty');}var _0xbd48f=[];var _0x1b429a=0x0;if(_0x5e71a4[_0x90ab('0x19')]){if(_0x5d0565&&_0x5d0565['length']){var _0x395224=_[_0x90ab('0x1a')](_0x5d0565[0x0][_0x90ab('0x18')]/_0x20f4b6);var _0xb8f4db=Number[_0x90ab('0x1b')](_0x5d0565[0x0][_0x90ab('0x18')]/_0x20f4b6)?_0x5d0565[0x0]['num']%_0x20f4b6:0x0;_0x395224[_0x90ab('0x1c')](function(_0x454b77){if(_0x454b77>0x0){_0x1b429a+=_0x20f4b6;}_0xbd48f['push'](dbH['sequelize']['query'](util[_0x90ab('0xe')](_0x90ab('0x1d'),QUERY,_0x20f4b6,_0x1b429a),{'type':dbH[_0x90ab('0x13')][_0x90ab('0x16')]['SELECT']}));});if(_0xb8f4db>0x0){_0x1b429a+=_0x20f4b6;_0xbd48f['push'](dbH['sequelize'][_0x90ab('0x14')](util['format'](_0x90ab('0x1d'),QUERY,_0xb8f4db,_0x1b429a),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0xbd48f[_0x90ab('0x1e')](dbH[_0x90ab('0x13')][_0x90ab('0x14')](QUERY,{'type':dbH['sequelize'][_0x90ab('0x16')][_0x90ab('0x17')]}));}var _0x457f4d=path[_0x90ab('0x1f')](PATH);var _0x26fc7d=path[_0x90ab('0x20')](PATH,_0x90ab('0x21'));var _0x205213=_0x5e71a4[_0x90ab('0x19')]&&_0xbd48f[_0x90ab('0x22')]>0x1;var _0x59bf12=[];if(!fs[_0x90ab('0x23')](path[_0x90ab('0x24')](_0x457f4d,_0x26fc7d))&&_0x205213){fs[_0x90ab('0x25')](path[_0x90ab('0x24')](_0x457f4d,_0x26fc7d));}return BPromise['each'](_0xbd48f,function(_0x5b36b6){_0x59bf12['push'](_0x5b36b6);})[_0x90ab('0x12')](function(){for(var _0x3e130d=0x0;_0x3e130d<_0x59bf12[_0x90ab('0x22')];_0x3e130d+=0x1){var _0x319a68;var _0x18cb4e=_0x59bf12[_0x3e130d];if(_0x205213){_0x319a68=path[_0x90ab('0x24')](_0x457f4d,_0x26fc7d,util['format'](_0x90ab('0x26'),_0x26fc7d,_0x3e130d,'csv'));}else{_0x319a68=path[_0x90ab('0x24')](_0x457f4d,util[_0x90ab('0xe')](_0x90ab('0x27'),_0x26fc7d,'csv'));}fs[_0x90ab('0x28')](_0x319a68,csv(_0x18cb4e));}})[_0x90ab('0x12')](function(){if(_0x205213){return new Promise(function(_0x4abf28){zipdir(path[_0x90ab('0x24')](_0x457f4d,_0x26fc7d),{'saveTo':path[_0x90ab('0x24')](_0x457f4d,util[_0x90ab('0xe')](_0x90ab('0x27'),_0x26fc7d,_0x90ab('0x29')))},function(_0x2c9752,_0x38e78a){rimraf(path['join'](_0x457f4d,_0x26fc7d),function(){});_0x4abf28(_0x90ab('0x2a'));});});}})['then'](function(){logger[_0x90ab('0xd')](util[_0x90ab('0xe')](_0x90ab('0x2b'),EXTRACTED_REPORT_ID,_0x90ab('0x2c')));return analyticExtractedReport('Completed',_0x205213?util[_0x90ab('0xe')](_0x90ab('0x27'),_0x26fc7d,_0x205213?_0x90ab('0x29'):_0x90ab('0x2d')):null);});})[_0x90ab('0x2e')](function(_0x3acf2b){logger[_0x90ab('0xd')](util[_0x90ab('0xe')](_0x90ab('0x2f'),EXTRACTED_REPORT_ID,'CSV'),util[_0x90ab('0x30')](_0x3acf2b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x90ab('0x31'));})[_0x90ab('0x32')](function(){process[_0x90ab('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 834801c..0d4784b 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 _0x00a4=['footer','Arial','right','num','Setting','find','splitSizePdf','then','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','query','SELECT','dirname','basename','split','mkdirSync','join','each','createPdfKitDocument','%s%d.%s','%s.%s','all','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','pdf','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','header','pipe','createWriteStream','finish','error','createPdfFromHTML','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','map','pick','fill','length','auto','concat','forEach','push','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','format','endDate','before','margin','landscape','toString','\x20/\x20'];(function(_0x5a53f6,_0x41dcfb){var _0x2962f3=function(_0x4ebcb4){while(--_0x4ebcb4){_0x5a53f6['push'](_0x5a53f6['shift']());}};_0x2962f3(++_0x41dcfb);}(_0x00a4,0xdb));var _0x400a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x00a4[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x400a('0x0'));var fs=require('fs');var util=require(_0x400a('0x1'));var path=require(_0x400a('0x2'));var moment=require(_0x400a('0x3'));var htmlToPdfmake=require(_0x400a('0x4'));var PdfPrinter=require(_0x400a('0x5'));var zipdir=require(_0x400a('0x6'));var rimraf=require('rimraf');var JSDOM=require('jsdom')[_0x400a('0x7')];var window=new JSDOM('')['window'];var BPromise=require(_0x400a('0x8'));var db=require('../../mysqldb')['db'];var dbH=require(_0x400a('0x9'))[_0x400a('0xa')];var logger=require(_0x400a('0xb'))(_0x400a('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x400a('0xd')][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x400a('0xd')][0x5];var FORMAT=_0x400a('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x8e507d,_0x3f56d4){var _0x52d7cf={'status':_0x8e507d};var _0x2b0577={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3f56d4){_0x52d7cf['savename']=_0x3f56d4;}return db[_0x400a('0xf')]['update'](_0x52d7cf,_0x2b0577);}function getHeaders(_0x4963df){return _['map'](_0x4963df,function(_0x229221){return{'text':_0x229221,'style':'tableHeader'};});}function getRows(_0x3d3e62,_0x18692c){return _[_0x400a('0x10')](_0x18692c,function(_0x30bf3d){return _(_0x30bf3d)[_0x400a('0x11')](_0x3d3e62)['map'](function(_0x319d63){return _0x319d63?_['toString'](_0x319d63):'';})['value']();});}function createTable(_0x25922f,_0x568f26){var _0x1a39c6={'widths':_[_0x400a('0x12')](Array(_0x25922f[_0x400a('0x13')]),0x91),'heights':function(_0x23b8fd){return _0x23b8fd===0x0?_0x400a('0x14'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1829f9=getHeaders(_0x25922f);_0x1a39c6['body']['push'](_0x1829f9);var _0x61788f=getRows(_0x25922f,_0x568f26);_0x1a39c6['body']=_0x1a39c6['body'][_0x400a('0x15')](_0x61788f);return _0x1a39c6;}function createTables(_0xa99b10){var _0x439597=[];var _0x1efec2=_['chunk'](Object['keys'](_0xa99b10[0x0]),0x5);_0x1efec2[_0x400a('0x16')](function(_0x5a4fc4){_0x439597[_0x400a('0x17')](createTable(_0x5a4fc4,_0xa99b10));});return _0x439597;}function getPDFDocDefinition(_0x5824a4){var _0x285c7a=util['format'](_0x400a('0x18'),NAME,EXTRACTED_REPORT[_0x400a('0x19')],moment(EXTRACTED_REPORT['startDate'])[_0x400a('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x400a('0x1b')])[_0x400a('0x1a')](FORMAT));var _0x346a18=[];for(var _0x3cc852=0x0;_0x3cc852<_0x5824a4['length'];_0x3cc852++){var _0x519db6=[];if(_0x3cc852===0x0){_0x519db6['push']({'text':_0x285c7a,'style':'header'});}var _0x457c59={'table':_0x5824a4[_0x3cc852]};if(_0x3cc852>0x0){_0x457c59['pageBreak']=_0x400a('0x1c');_0x457c59[_0x400a('0x1d')]=[0x0,0x46,0x0,0x0];}_0x519db6[_0x400a('0x17')](_0x457c59);_0x346a18['push'](_0x519db6);}return{'pageSize':'A4','pageOrientation':_0x400a('0x1e'),'content':_0x346a18,'footer':function(_0x265af2,_0x345b08){return{'text':_0x265af2[_0x400a('0x1f')]()+_0x400a('0x20')+_0x345b08,'style':_0x400a('0x21')};},'defaultStyle':{'font':_0x400a('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x400a('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x22f7a5){var _0xc6045c=0x1388;var _0x4374cb;if(!_0x22f7a5[0x0][_0x400a('0x24')]){return analyticExtractedReport('Empty');}return db[_0x400a('0x25')][_0x400a('0x26')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x400a('0x27')]})[_0x400a('0x28')](function(_0x2769e6){if(_0x2769e6){_0x4374cb=_0x2769e6;_0xc6045c=_0x4374cb['splitSizePdf']||0x3e8;}})['then'](function(){var _0x5b31ea=[];var _0x55e566=0x0;if(_0x4374cb['split']){if(_0x22f7a5&&_0x22f7a5[_0x400a('0x13')]){var _0x54b661=_['range'](_0x22f7a5[0x0][_0x400a('0x24')]/_0xc6045c);var _0x35afd8=Number[_0x400a('0x29')](_0x22f7a5[0x0][_0x400a('0x24')]/_0xc6045c)?_0x22f7a5[0x0]['num']%_0xc6045c:0x0;_0x54b661[_0x400a('0x16')](function(_0x2367dc){if(_0x2367dc>0x0){_0x55e566+=_0xc6045c;}_0x5b31ea[_0x400a('0x17')](dbH[_0x400a('0x2a')]['query'](util['format'](_0x400a('0x2b'),QUERY,_0xc6045c,_0x55e566),{'type':dbH[_0x400a('0x2a')][_0x400a('0x2c')]['SELECT']}));});if(_0x35afd8>0x0){_0x55e566+=_0xc6045c;_0x5b31ea[_0x400a('0x17')](dbH['sequelize'][_0x400a('0x2d')](util[_0x400a('0x1a')](_0x400a('0x2b'),QUERY,_0x35afd8,_0x55e566),{'type':dbH[_0x400a('0x2a')][_0x400a('0x2c')][_0x400a('0x2e')]}));}}}else{_0x5b31ea[_0x400a('0x17')](dbH[_0x400a('0x2a')]['query'](QUERY,{'type':dbH['sequelize'][_0x400a('0x2c')][_0x400a('0x2e')]}));}var _0x248d41=path[_0x400a('0x2f')](PATH);var _0x2b7b68=path[_0x400a('0x30')](PATH,'.pdf');var _0x208943=_0x4374cb[_0x400a('0x31')]&&_0x5b31ea[_0x400a('0x13')]>0x1;var _0x59c26e=[];if(!fs['existsSync'](path['join'](_0x248d41,_0x2b7b68))&&_0x208943){fs[_0x400a('0x32')](path[_0x400a('0x33')](_0x248d41,_0x2b7b68));}return BPromise[_0x400a('0x34')](_0x5b31ea,function(_0x26c130){_0x59c26e[_0x400a('0x17')](_0x26c130);})['then'](function(){var _0x5ac127=[];for(var _0x59c627=0x0;_0x59c627<_0x59c26e['length'];_0x59c627+=0x1){var _0x400d03=_0x59c26e[_0x59c627];var _0x12b8b5=createTables(_['flatten'](_0x400d03));var _0x5a0187;var _0xf8f69c=getPDFDocDefinition(_0x12b8b5);var _0x1b2892=getPDFPrinter();var _0x592f6a=_0x1b2892[_0x400a('0x35')](_0xf8f69c);if(_0x208943){_0x5a0187=path['join'](_0x248d41,_0x2b7b68,util[_0x400a('0x1a')](_0x400a('0x36'),_0x2b7b68,_0x59c627,'pdf'));}else{_0x5a0187=path[_0x400a('0x33')](_0x248d41,util['format'](_0x400a('0x37'),_0x2b7b68,'pdf'));}_0x5ac127['push'](writePDFDocument(_0x592f6a,_0x5a0187));}return Promise[_0x400a('0x38')](_0x5ac127);})[_0x400a('0x28')](function(){if(_0x208943){return new Promise(function(_0x4e4bf5){zipdir(path[_0x400a('0x33')](_0x248d41,_0x2b7b68),{'saveTo':path[_0x400a('0x33')](_0x248d41,util[_0x400a('0x1a')](_0x400a('0x37'),_0x2b7b68,_0x400a('0x39')))},function(){rimraf(path[_0x400a('0x33')](_0x248d41,_0x2b7b68),function(){});_0x4e4bf5(_0x400a('0x3a'));});});}})[_0x400a('0x28')](function(){if(!_0x208943)return;rimraf(path[_0x400a('0x33')](_0x248d41,_0x2b7b68),function(){});})[_0x400a('0x28')](function(){logger['info'](util[_0x400a('0x1a')](_0x400a('0x3b'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport('Completed',_0x208943?util[_0x400a('0x1a')](_0x400a('0x37'),_0x2b7b68,_0x208943?'zip':_0x400a('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x400a('0x3d')](util[_0x400a('0x1a')](_0x400a('0x3e'),EXTRACTED_REPORT_ID,_0x400a('0x3f')));return db['AnalyticExtractedReport'][_0x400a('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x400a('0x28')](function(_0x350c69){EXTRACTED_REPORT=_0x350c69;return dbH[_0x400a('0x2a')][_0x400a('0x2d')](util[_0x400a('0x1a')](_0x400a('0x41'),QUERY),{'type':dbH[_0x400a('0x2a')][_0x400a('0x2c')][_0x400a('0x2e')]});})[_0x400a('0x28')](extractReport)[_0x400a('0x42')](function(_0x2b8560){logger[_0x400a('0x3d')](util[_0x400a('0x1a')](_0x400a('0x43'),EXTRACTED_REPORT_ID,_0x400a('0x3f')),util[_0x400a('0x44')](_0x2b8560,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x400a('0x45'));})[_0x400a('0x46')](function(){process[_0x400a('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x120b1b=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x400a('0x48'),'bolditalics':__dirname+_0x400a('0x49')}});return _0x120b1b;}function getPDFDocDefinitionFromHTML(_0xbfd267,_0x47503b){var _0x1853a0=util[_0x400a('0x1a')]('%s\x20#%d',_0x47503b[_0x400a('0x4a')],_0x47503b[_0x400a('0x4b')]);var _0x47f633=moment()[_0x400a('0x1a')](_0x400a('0x4c'))['toString']();var _0x3dbaad=htmlToPdfmake(_0xbfd267,{'window':window,'tableAutoSize':!![]});return{'content':[_0x3dbaad],'defaultStyle':{'font':_0x400a('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x400a('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x400a('0x4d'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x400a('0x4d')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':_0x400a('0x4e')}];},'footer':function(_0x543d53,_0x33706c){return[{'text':util[_0x400a('0x1a')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x1853a0,_0x543d53,_0x33706c,_0x47f633),'style':_0x400a('0x21')}];}};}function writePDFDocument(_0x39b2f4,_0x10a9ef){return new Promise(function(_0x15c740,_0x3b8618){var _0x1802a1=_0x39b2f4[_0x400a('0x4f')](fs[_0x400a('0x50')](_0x10a9ef));_0x1802a1['on']('finish',function(){_0x15c740(_0x400a('0x51'));});_0x1802a1['on'](_0x400a('0x52'),function(_0x49300c){_0x3b8618(_0x49300c);});_0x39b2f4['end']();});}exports[_0x400a('0x53')]=function(_0x5c7cec,_0x59b304){var _0x58745c=getPDFPrinter();var _0x42be4b=getPDFDocDefinitionFromHTML(_0x5c7cec,_0x59b304);var _0x4a6ff2=_0x58745c[_0x400a('0x35')](_0x42be4b);return writePDFDocument(_0x4a6ff2,_0x59b304[_0x400a('0x2')])[_0x400a('0x42')](function(_0x24cffe){throw _0x24cffe;});}; \ No newline at end of file +var _0x714b=['then','split','range','isInteger','forEach','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','QueryTypes','dirname','.pdf','existsSync','join','mkdirSync','each','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','createPdfKitDocument','lodash','path','moment','pdfmake/src/printer','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','map','pick','toString','value','auto','body','chunk','keys','format','startDate','length','push','pageBreak','before','margin','\x20/\x20','footer','Arial','right','num','Empty','Setting','find','splitSizePdf'];(function(_0x44ed3e,_0x3bd8cc){var _0x389573=function(_0x81b619){while(--_0x81b619){_0x44ed3e['push'](_0x44ed3e['shift']());}};_0x389573(++_0x3bd8cc);}(_0x714b,0x1dd));var _0xb714=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x714b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb714('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xb714('0x1'));var moment=require(_0xb714('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xb714('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xb714('0x4'));var JSDOM=require(_0xb714('0x5'))[_0xb714('0x6')];var window=new JSDOM('')['window'];var BPromise=require(_0xb714('0x7'));var db=require('../../mysqldb')['db'];var dbH=require(_0xb714('0x8'))[_0xb714('0x9')];var logger=require(_0xb714('0xa'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xb714('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xb714('0xb')][0x4];var NAME=process[_0xb714('0xb')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x58cd1d,_0xf90db1){var _0x2f5ca7={'status':_0x58cd1d};var _0x2c5e39={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xf90db1){_0x2f5ca7[_0xb714('0xc')]=_0xf90db1;}return db[_0xb714('0xd')][_0xb714('0xe')](_0x2f5ca7,_0x2c5e39);}function getHeaders(_0x2b0e0e){return _[_0xb714('0xf')](_0x2b0e0e,function(_0x5ed569){return{'text':_0x5ed569,'style':'tableHeader'};});}function getRows(_0x2fb994,_0x41d4d7){return _[_0xb714('0xf')](_0x41d4d7,function(_0x115c03){return _(_0x115c03)[_0xb714('0x10')](_0x2fb994)[_0xb714('0xf')](function(_0x5138b5){return _0x5138b5?_[_0xb714('0x11')](_0x5138b5):'';})[_0xb714('0x12')]();});}function createTable(_0x375760,_0x295405){var _0x45c64a={'widths':_['fill'](Array(_0x375760['length']),0x91),'heights':function(_0x46b1e9){return _0x46b1e9===0x0?_0xb714('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3f4621=getHeaders(_0x375760);_0x45c64a[_0xb714('0x14')]['push'](_0x3f4621);var _0x57372e=getRows(_0x375760,_0x295405);_0x45c64a['body']=_0x45c64a[_0xb714('0x14')]['concat'](_0x57372e);return _0x45c64a;}function createTables(_0x286a88){var _0x4f876d=[];var _0x551c6b=_[_0xb714('0x15')](Object[_0xb714('0x16')](_0x286a88[0x0]),0x5);_0x551c6b['forEach'](function(_0xd38bf3){_0x4f876d['push'](createTable(_0xd38bf3,_0x286a88));});return _0x4f876d;}function getPDFDocDefinition(_0x19957c){var _0x406f30=util[_0xb714('0x17')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xb714('0x18')])[_0xb714('0x17')](FORMAT),moment(EXTRACTED_REPORT['endDate'])['format'](FORMAT));var _0x1220ce=[];for(var _0x286a06=0x0;_0x286a06<_0x19957c[_0xb714('0x19')];_0x286a06++){var _0x44dacd=[];if(_0x286a06===0x0){_0x44dacd[_0xb714('0x1a')]({'text':_0x406f30,'style':'header'});}var _0x4abea2={'table':_0x19957c[_0x286a06]};if(_0x286a06>0x0){_0x4abea2[_0xb714('0x1b')]=_0xb714('0x1c');_0x4abea2[_0xb714('0x1d')]=[0x0,0x46,0x0,0x0];}_0x44dacd[_0xb714('0x1a')](_0x4abea2);_0x1220ce['push'](_0x44dacd);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x1220ce,'footer':function(_0x417f1c,_0x1b578f){return{'text':_0x417f1c['toString']()+_0xb714('0x1e')+_0x1b578f,'style':_0xb714('0x1f')};},'defaultStyle':{'font':_0xb714('0x20')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xb714('0x21'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4a1556){var _0x388a74=0x1388;var _0x1d4ec9;if(!_0x4a1556[0x0][_0xb714('0x22')]){return analyticExtractedReport(_0xb714('0x23'));}return db[_0xb714('0x24')][_0xb714('0x25')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xb714('0x26')]})[_0xb714('0x27')](function(_0x1c613b){if(_0x1c613b){_0x1d4ec9=_0x1c613b;_0x388a74=_0x1d4ec9[_0xb714('0x26')]||0x3e8;}})[_0xb714('0x27')](function(){var _0x1cfe94=[];var _0x3f0667=0x0;if(_0x1d4ec9[_0xb714('0x28')]){if(_0x4a1556&&_0x4a1556[_0xb714('0x19')]){var _0x28d8b2=_[_0xb714('0x29')](_0x4a1556[0x0]['num']/_0x388a74);var _0x50b28e=Number[_0xb714('0x2a')](_0x4a1556[0x0][_0xb714('0x22')]/_0x388a74)?_0x4a1556[0x0][_0xb714('0x22')]%_0x388a74:0x0;_0x28d8b2[_0xb714('0x2b')](function(_0x18393b){if(_0x18393b>0x0){_0x3f0667+=_0x388a74;}_0x1cfe94[_0xb714('0x1a')](dbH[_0xb714('0x2c')][_0xb714('0x2d')](util['format'](_0xb714('0x2e'),QUERY,_0x388a74,_0x3f0667),{'type':dbH[_0xb714('0x2c')]['QueryTypes'][_0xb714('0x2f')]}));});if(_0x50b28e>0x0){_0x3f0667+=_0x388a74;_0x1cfe94[_0xb714('0x1a')](dbH[_0xb714('0x2c')]['query'](util['format'](_0xb714('0x2e'),QUERY,_0x50b28e,_0x3f0667),{'type':dbH[_0xb714('0x2c')][_0xb714('0x30')][_0xb714('0x2f')]}));}}}else{_0x1cfe94[_0xb714('0x1a')](dbH[_0xb714('0x2c')][_0xb714('0x2d')](QUERY,{'type':dbH[_0xb714('0x2c')][_0xb714('0x30')]['SELECT']}));}var _0x44da57=path[_0xb714('0x31')](PATH);var _0x4c907b=path['basename'](PATH,_0xb714('0x32'));var _0x440d8f=_0x1d4ec9[_0xb714('0x28')]&&_0x1cfe94[_0xb714('0x19')]>0x1;var _0x4588c0=[];if(!fs[_0xb714('0x33')](path[_0xb714('0x34')](_0x44da57,_0x4c907b))&&_0x440d8f){fs[_0xb714('0x35')](path['join'](_0x44da57,_0x4c907b));}return BPromise[_0xb714('0x36')](_0x1cfe94,function(_0x2834f1){_0x4588c0[_0xb714('0x1a')](_0x2834f1);})[_0xb714('0x27')](function(){var _0x17c83a=[];for(var _0x2cc38c=0x0;_0x2cc38c<_0x4588c0[_0xb714('0x19')];_0x2cc38c+=0x1){var _0x4c0208=_0x4588c0[_0x2cc38c];var _0x17e128=createTables(_['flatten'](_0x4c0208));var _0x418e20;var _0x2df526=getPDFDocDefinition(_0x17e128);var _0x40e842=getPDFPrinter();var _0x3cf574=_0x40e842['createPdfKitDocument'](_0x2df526);if(_0x440d8f){_0x418e20=path[_0xb714('0x34')](_0x44da57,_0x4c907b,util['format'](_0xb714('0x37'),_0x4c907b,_0x2cc38c,_0xb714('0x38')));}else{_0x418e20=path[_0xb714('0x34')](_0x44da57,util[_0xb714('0x17')](_0xb714('0x39'),_0x4c907b,_0xb714('0x38')));}_0x17c83a[_0xb714('0x1a')](writePDFDocument(_0x3cf574,_0x418e20));}return Promise['all'](_0x17c83a);})[_0xb714('0x27')](function(){if(_0x440d8f){return new Promise(function(_0x362290){zipdir(path[_0xb714('0x34')](_0x44da57,_0x4c907b),{'saveTo':path[_0xb714('0x34')](_0x44da57,util[_0xb714('0x17')]('%s.%s',_0x4c907b,_0xb714('0x3a')))},function(){rimraf(path['join'](_0x44da57,_0x4c907b),function(){});_0x362290(_0xb714('0x3b'));});});}})[_0xb714('0x27')](function(){if(!_0x440d8f)return;rimraf(path['join'](_0x44da57,_0x4c907b),function(){});})[_0xb714('0x27')](function(){logger['info'](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xb714('0x3c'),_0x440d8f?util[_0xb714('0x17')](_0xb714('0x39'),_0x4c907b,_0x440d8f?_0xb714('0x3a'):_0xb714('0x38')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xb714('0x17')](_0xb714('0x3d'),EXTRACTED_REPORT_ID,_0xb714('0x3e')));return db[_0xb714('0xd')][_0xb714('0x3f')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xb714('0x27')](function(_0x3676e0){EXTRACTED_REPORT=_0x3676e0;return dbH[_0xb714('0x2c')][_0xb714('0x2d')](util[_0xb714('0x17')](_0xb714('0x40'),QUERY),{'type':dbH[_0xb714('0x2c')][_0xb714('0x30')][_0xb714('0x2f')]});})[_0xb714('0x27')](extractReport)[_0xb714('0x41')](function(_0x13f166){logger[_0xb714('0x42')](util['format'](_0xb714('0x43'),EXTRACTED_REPORT_ID,_0xb714('0x3e')),util[_0xb714('0x44')](_0x13f166,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xb714('0x45'));})[_0xb714('0x46')](function(){process[_0xb714('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x33b3a2=new PdfPrinter({'Arial':{'normal':__dirname+_0xb714('0x48'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xb714('0x49'),'bolditalics':__dirname+_0xb714('0x4a')}});return _0x33b3a2;}function getPDFDocDefinitionFromHTML(_0x5cd543,_0x4d03d3){var _0x2faa02=util[_0xb714('0x17')]('%s\x20#%d',_0x4d03d3[_0xb714('0x4b')],_0x4d03d3[_0xb714('0x4c')]);var _0x41f8de=moment()[_0xb714('0x17')](_0xb714('0x4d'))[_0xb714('0x11')]();var _0x1122a7=htmlToPdfmake(_0x5cd543,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1122a7],'defaultStyle':{'font':_0xb714('0x20')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xb714('0x4e'),'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':_0xb714('0x4e')}},'header':function(){return[{'text':_0xb714('0x4f'),'style':_0xb714('0x50')}];},'footer':function(_0x5d64ae,_0x365b89){return[{'text':util[_0xb714('0x17')](_0xb714('0x51'),_0x2faa02,_0x5d64ae,_0x365b89,_0x41f8de),'style':_0xb714('0x1f')}];}};}function writePDFDocument(_0x3dfc96,_0x510c0e){return new Promise(function(_0x58ded8,_0x28adbe){var _0x1aac66=_0x3dfc96['pipe'](fs[_0xb714('0x52')](_0x510c0e));_0x1aac66['on'](_0xb714('0x53'),function(){_0x58ded8(_0xb714('0x53'));});_0x1aac66['on'](_0xb714('0x54'),function(_0x390f91){_0x28adbe(_0x390f91);});_0x3dfc96['end']();});}exports['createPdfFromHTML']=function(_0x2ec0ef,_0x3e6c12){var _0x4f05b5=getPDFPrinter();var _0x2e0964=getPDFDocDefinitionFromHTML(_0x2ec0ef,_0x3e6c12);var _0x1733a1=_0x4f05b5[_0xb714('0x55')](_0x2e0964);return writePDFDocument(_0x1733a1,_0x3e6c12[_0xb714('0x1')])[_0xb714('0x41')](function(_0x31f3e4){throw _0x31f3e4;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 577ddf3..97f1352 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 _0x2567=['rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','lodash','json2xls','bluebird','zip-dir'];(function(_0x59bd49,_0x412540){var _0x2315c8=function(_0x38e44d){while(--_0x38e44d){_0x59bd49['push'](_0x59bd49['shift']());}};_0x2315c8(++_0x412540);}(_0x2567,0x14a));var _0x7256=function(_0x527221,_0x3ad559){_0x527221=_0x527221-0x0;var _0xdd8990=_0x2567[_0x527221];return _0xdd8990;};'use strict';var util=require(_0x7256('0x0'));var path=require(_0x7256('0x1'));var _=require(_0x7256('0x2'));var fs=require('fs');var json2xls=require(_0x7256('0x3'));var BPromise=require(_0x7256('0x4'));var zipdir=require(_0x7256('0x5'));var rimraf=require(_0x7256('0x6'));var db=require(_0x7256('0x7'))['db'];var dbH=require(_0x7256('0x7'))[_0x7256('0x8')];var logger=require(_0x7256('0x9'))(_0x7256('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x7256('0xb')][0x2]);var QUERY=process[_0x7256('0xb')][0x3];var PATH=process[_0x7256('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x55aba0,_0x18d39f){var _0x41ea59={'status':_0x55aba0};var _0x55723d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x18d39f){_0x41ea59[_0x7256('0xc')]=_0x18d39f;}return db[_0x7256('0xd')][_0x7256('0xe')](_0x41ea59,_0x55723d);}function main(){var _0x3912ca=0x1388;var _0x398271;logger[_0x7256('0xf')](util[_0x7256('0x10')](_0x7256('0x11'),EXTRACTED_REPORT_ID,_0x7256('0x12')));return db[_0x7256('0x13')][_0x7256('0x14')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7256('0x15'),_0x7256('0x16')]})[_0x7256('0x17')](function(_0x4959b9){if(_0x4959b9){_0x398271=_0x4959b9;_0x3912ca=_0x398271['splitSizeXlsx']||0x1388;}})[_0x7256('0x17')](function(){return dbH[_0x7256('0x18')][_0x7256('0x19')](util[_0x7256('0x10')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x7256('0x18')][_0x7256('0x1a')]['SELECT']});})[_0x7256('0x17')](function(_0x64cfb4){if(!_0x64cfb4[0x0][_0x7256('0x1b')]){return analyticExtractedReport(_0x7256('0x1c'));}var _0x3bb254=[];var _0x5c6081=0x0;if(_0x398271[_0x7256('0x15')]){if(_0x64cfb4&&_0x64cfb4[_0x7256('0x1d')]){var _0x15f702=_[_0x7256('0x1e')](_0x64cfb4[0x0][_0x7256('0x1b')]/_0x3912ca);var _0xa08eaa=Number[_0x7256('0x1f')](_0x64cfb4[0x0][_0x7256('0x1b')]/_0x3912ca)?_0x64cfb4[0x0][_0x7256('0x1b')]%_0x3912ca:0x0;_0x15f702[_0x7256('0x20')](function(_0x2f1410){if(_0x2f1410>0x0){_0x5c6081+=_0x3912ca;}_0x3bb254[_0x7256('0x21')](dbH[_0x7256('0x18')]['query'](util[_0x7256('0x10')](_0x7256('0x22'),QUERY,_0x3912ca,_0x5c6081),{'type':dbH[_0x7256('0x18')][_0x7256('0x1a')][_0x7256('0x23')]}));});if(_0xa08eaa>0x0){_0x5c6081+=_0x3912ca;_0x3bb254[_0x7256('0x21')](dbH[_0x7256('0x18')][_0x7256('0x19')](util[_0x7256('0x10')](_0x7256('0x22'),QUERY,_0xa08eaa,_0x5c6081),{'type':dbH[_0x7256('0x18')][_0x7256('0x1a')][_0x7256('0x23')]}));}}}else{_0x3bb254[_0x7256('0x21')](dbH[_0x7256('0x18')][_0x7256('0x19')](QUERY,{'type':dbH[_0x7256('0x18')]['QueryTypes'][_0x7256('0x23')]}));}var _0x43bb29=path[_0x7256('0x24')](PATH);var _0xf68163=path[_0x7256('0x25')](PATH,_0x7256('0x26'));var _0x32033c=_0x398271['split']&&_0x3bb254['length']>0x1;var _0x924b10=[];if(!fs[_0x7256('0x27')](path[_0x7256('0x28')](_0x43bb29,_0xf68163))&&_0x32033c){fs[_0x7256('0x29')](path['join'](_0x43bb29,_0xf68163));}return BPromise[_0x7256('0x2a')](_0x3bb254,function(_0x4dd110){_0x924b10[_0x7256('0x21')](_0x4dd110);})[_0x7256('0x17')](function(){for(var _0x5a6659=0x0;_0x5a6659<_0x924b10[_0x7256('0x1d')];_0x5a6659+=0x1){var _0x16e75a;var _0x3357fa=_0x924b10[_0x5a6659];if(_0x32033c){_0x16e75a=path[_0x7256('0x28')](_0x43bb29,_0xf68163,util[_0x7256('0x10')](_0x7256('0x2b'),_0xf68163,_0x5a6659,_0x7256('0x2c')));}else{_0x16e75a=path[_0x7256('0x28')](_0x43bb29,util[_0x7256('0x10')](_0x7256('0x2d'),_0xf68163,'xlsx'));}fs[_0x7256('0x2e')](_0x16e75a,json2xls(_0x3357fa),_0x7256('0x2f'));}})[_0x7256('0x17')](function(){if(_0x32033c){return new Promise(function(_0x3eb620){zipdir(path['join'](_0x43bb29,_0xf68163),{'saveTo':path[_0x7256('0x28')](_0x43bb29,util[_0x7256('0x10')](_0x7256('0x2d'),_0xf68163,'zip'))},function(_0x3ef608,_0x37d398){rimraf(path[_0x7256('0x28')](_0x43bb29,_0xf68163),function(){});_0x3eb620(_0x7256('0x30'));});});}})[_0x7256('0x17')](function(){logger[_0x7256('0xf')](util['format'](_0x7256('0x31'),EXTRACTED_REPORT_ID,_0x7256('0x12')));return analyticExtractedReport(_0x7256('0x32'),_0x32033c?util[_0x7256('0x10')](_0x7256('0x2d'),_0xf68163,_0x32033c?_0x7256('0x33'):_0x7256('0x2c')):null);});})['catch'](function(_0x59df4e){logger[_0x7256('0xf')](util[_0x7256('0x10')](_0x7256('0x34'),EXTRACTED_REPORT_ID,_0x7256('0x12')),util[_0x7256('0x35')](_0x59df4e,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7256('0x36'));})[_0x7256('0x37')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xb70c=['json2xls','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','length','range','num','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','basename','.xlsx','existsSync','join','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','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash'];(function(_0x1f2c89,_0x3a81b3){var _0x4c6637=function(_0x893fac){while(--_0x893fac){_0x1f2c89['push'](_0x1f2c89['shift']());}};_0x4c6637(++_0x3a81b3);}(_0xb70c,0x10b));var _0xcb70=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0xb70c[_0x309d93];return _0x2dd61d;};'use strict';var util=require(_0xcb70('0x0'));var path=require(_0xcb70('0x1'));var _=require(_0xcb70('0x2'));var fs=require('fs');var json2xls=require(_0xcb70('0x3'));var BPromise=require(_0xcb70('0x4'));var zipdir=require(_0xcb70('0x5'));var rimraf=require(_0xcb70('0x6'));var db=require(_0xcb70('0x7'))['db'];var dbH=require(_0xcb70('0x7'))['dbH'];var logger=require(_0xcb70('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xcb70('0x9')][0x2]);var QUERY=process[_0xcb70('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x479b75,_0x468f77){var _0x49ee24={'status':_0x479b75};var _0x201965={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x468f77){_0x49ee24['savename']=_0x468f77;}return db[_0xcb70('0xa')][_0xcb70('0xb')](_0x49ee24,_0x201965);}function main(){var _0x5f0b8c=0x1388;var _0x3e541c;logger[_0xcb70('0xc')](util[_0xcb70('0xd')](_0xcb70('0xe'),EXTRACTED_REPORT_ID,_0xcb70('0xf')));return db[_0xcb70('0x10')][_0xcb70('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xcb70('0x12'),_0xcb70('0x13')]})[_0xcb70('0x14')](function(_0x42d7b2){if(_0x42d7b2){_0x3e541c=_0x42d7b2;_0x5f0b8c=_0x3e541c[_0xcb70('0x13')]||0x1388;}})[_0xcb70('0x14')](function(){return dbH[_0xcb70('0x15')][_0xcb70('0x16')](util[_0xcb70('0xd')](_0xcb70('0x17'),QUERY),{'type':dbH[_0xcb70('0x15')][_0xcb70('0x18')]['SELECT']});})[_0xcb70('0x14')](function(_0x79af3a){if(!_0x79af3a[0x0]['num']){return analyticExtractedReport(_0xcb70('0x19'));}var _0x4d71ab=[];var _0x5561ac=0x0;if(_0x3e541c[_0xcb70('0x12')]){if(_0x79af3a&&_0x79af3a[_0xcb70('0x1a')]){var _0x48cace=_[_0xcb70('0x1b')](_0x79af3a[0x0][_0xcb70('0x1c')]/_0x5f0b8c);var _0x380e1d=Number[_0xcb70('0x1d')](_0x79af3a[0x0][_0xcb70('0x1c')]/_0x5f0b8c)?_0x79af3a[0x0][_0xcb70('0x1c')]%_0x5f0b8c:0x0;_0x48cace[_0xcb70('0x1e')](function(_0x506773){if(_0x506773>0x0){_0x5561ac+=_0x5f0b8c;}_0x4d71ab['push'](dbH[_0xcb70('0x15')][_0xcb70('0x16')](util[_0xcb70('0xd')](_0xcb70('0x1f'),QUERY,_0x5f0b8c,_0x5561ac),{'type':dbH[_0xcb70('0x15')][_0xcb70('0x18')][_0xcb70('0x20')]}));});if(_0x380e1d>0x0){_0x5561ac+=_0x5f0b8c;_0x4d71ab[_0xcb70('0x21')](dbH[_0xcb70('0x15')][_0xcb70('0x16')](util[_0xcb70('0xd')](_0xcb70('0x1f'),QUERY,_0x380e1d,_0x5561ac),{'type':dbH[_0xcb70('0x15')][_0xcb70('0x18')][_0xcb70('0x20')]}));}}}else{_0x4d71ab['push'](dbH['sequelize'][_0xcb70('0x16')](QUERY,{'type':dbH[_0xcb70('0x15')][_0xcb70('0x18')][_0xcb70('0x20')]}));}var _0x61864f=path['dirname'](PATH);var _0x4aaa86=path[_0xcb70('0x22')](PATH,_0xcb70('0x23'));var _0x50bbb3=_0x3e541c[_0xcb70('0x12')]&&_0x4d71ab[_0xcb70('0x1a')]>0x1;var _0x5707e5=[];if(!fs[_0xcb70('0x24')](path[_0xcb70('0x25')](_0x61864f,_0x4aaa86))&&_0x50bbb3){fs['mkdirSync'](path['join'](_0x61864f,_0x4aaa86));}return BPromise[_0xcb70('0x26')](_0x4d71ab,function(_0x61cefc){_0x5707e5[_0xcb70('0x21')](_0x61cefc);})['then'](function(){for(var _0x1e3c10=0x0;_0x1e3c10<_0x5707e5[_0xcb70('0x1a')];_0x1e3c10+=0x1){var _0x1834bb;var _0x5a41a1=_0x5707e5[_0x1e3c10];if(_0x50bbb3){_0x1834bb=path[_0xcb70('0x25')](_0x61864f,_0x4aaa86,util[_0xcb70('0xd')](_0xcb70('0x27'),_0x4aaa86,_0x1e3c10,'xlsx'));}else{_0x1834bb=path[_0xcb70('0x25')](_0x61864f,util[_0xcb70('0xd')](_0xcb70('0x28'),_0x4aaa86,_0xcb70('0x29')));}fs[_0xcb70('0x2a')](_0x1834bb,json2xls(_0x5a41a1),_0xcb70('0x2b'));}})[_0xcb70('0x14')](function(){if(_0x50bbb3){return new Promise(function(_0xd75525){zipdir(path[_0xcb70('0x25')](_0x61864f,_0x4aaa86),{'saveTo':path['join'](_0x61864f,util[_0xcb70('0xd')]('%s.%s',_0x4aaa86,_0xcb70('0x2c')))},function(_0x55f7ce,_0x2e9481){rimraf(path[_0xcb70('0x25')](_0x61864f,_0x4aaa86),function(){});_0xd75525(_0xcb70('0x2d'));});});}})[_0xcb70('0x14')](function(){logger[_0xcb70('0xc')](util[_0xcb70('0xd')](_0xcb70('0x2e'),EXTRACTED_REPORT_ID,_0xcb70('0xf')));return analyticExtractedReport(_0xcb70('0x2f'),_0x50bbb3?util[_0xcb70('0xd')](_0xcb70('0x28'),_0x4aaa86,_0x50bbb3?_0xcb70('0x2c'):_0xcb70('0x29')):null);});})[_0xcb70('0x30')](function(_0x677990){logger[_0xcb70('0xc')](util[_0xcb70('0xd')](_0xcb70('0x31'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xcb70('0x32')](_0x677990,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xcb70('0x33'));})[_0xcb70('0x34')](function(){process[_0xcb70('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 1d5d69a..347c7b3 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 _0xe771=['CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','catch','error','rewrite','lodash','util','Interval','findAll','then','intervals','models','VoiceExtension','IntervalId','map','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','priority','extensions','find','exten','type','Set','CDR(type)=%s','context','inbound','CDR(routeid)=','VoiceExtensionId','outbound','extension','push','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','interval','*,*,*,*','tag'];(function(_0x4a479f,_0x9b870){var _0x30c771=function(_0x5f5a01){while(--_0x5f5a01){_0x4a479f['push'](_0x4a479f['shift']());}};_0x30c771(++_0x9b870);}(_0xe771,0x179));var _0x1e77=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xe771[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x1e77('0x0'));var util=require(_0x1e77('0x1'));function rewrite(_0x52953e,_0x39296b){var _0x5c91a8=this;return _0x52953e['models'][_0x1e77('0x2')][_0x1e77('0x3')]({'raw':!![]})[_0x1e77('0x4')](function(_0x3d161b){_0x5c91a8[_0x1e77('0x5')]=_0x3d161b;return _0x52953e[_0x1e77('0x6')][_0x1e77('0x7')][_0x1e77('0x3')]({'where':{'IntervalId':_0x39296b[_0x1e77('0x8')]},'raw':!![]});})['then'](function(_0x566ada){return _0x52953e['models'][_0x1e77('0x7')][_0x1e77('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0x1e77('0x9')](_0x566ada,'exten'))}},'order':[{'raw':_0x1e77('0xa')}],'raw':!![]});})[_0x1e77('0x4')](function(_0x253e3b){var _0x18a6fd=_[_0x1e77('0xb')](_0x253e3b,{'priority':'1'});var _0x5eb105=_[_0x1e77('0xb')](_0x253e3b,{'isApp':0x1});var _0x1f3329=_[_0x1e77('0xc')](_0x5eb105,'exten');var _0x2fae2c=[_0x1e77('0xd'),'playback'];var _0x50030e=[];var _0x3bae30=[];for(var _0x3dbc22 in _0x1f3329){if(_0x1f3329[_0x1e77('0xe')](_0x3dbc22)){_0x5c91a8[_0x1e77('0xf')]=0x2;_0x5c91a8[_0x1e77('0x10')]=[];_0x5c91a8['extension']=_[_0x1e77('0x11')](_0x18a6fd,{'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')]});_0x5c91a8[_0x1e77('0x10')]['push']({'type':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':util['format'](_0x1e77('0x15'),_0x1f3329[_0x3dbc22][0x0]['type']),'context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0]['VoiceExtensionId']});if(_0x1f3329[_0x3dbc22][0x0]['type']===_0x1e77('0x17')){_0x5c91a8[_0x1e77('0x10')]['push']({'type':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')],'app':'Set','appdata':_0x1e77('0x18')+_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')],'context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});}else if(_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')]===_0x1e77('0x1a')){if(_0x5c91a8[_0x1e77('0x1b')]){_0x5c91a8['extensions'][_0x1e77('0x1c')]({'type':_0x1f3329[_0x3dbc22][0x0]['type'],'app':'Set','appdata':_0x1e77('0x1d')+(_0x5c91a8[_0x1e77('0x1b')]['cutdigits']?_0x1e77('0x1e')+_0x5c91a8[_0x1e77('0x1b')][_0x1e77('0x1f')]+'}':_0x1e77('0x20')),'context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});}_0x5c91a8[_0x1e77('0x10')][_0x1e77('0x1c')]({'type':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':_0x1e77('0x18')+_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')],'context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});var _0x364fc9=_0x5c91a8[_0x1e77('0xf')]++;_0x5c91a8[_0x1e77('0x10')]['push']({'type':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')],'app':_0x1e77('0x21'),'appdata':_0x1e77('0x22')+(_0x364fc9+0x2)+_0x1e77('0x23')+(_0x364fc9+0x1)+')','context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x364fc9,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});if(_0x5c91a8[_0x1e77('0x1b')]){_0x5c91a8[_0x1e77('0x10')][_0x1e77('0x1c')]({'type':_0x1f3329[_0x3dbc22][0x0]['type'],'app':_0x1e77('0x14'),'appdata':_0x5c91a8[_0x1e77('0x1b')][_0x1e77('0x1f')]?_0x1e77('0x24')+_0x5c91a8['extension'][_0x1e77('0x1f')]+'}':'CDR(prefix)=noprefix','context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});}_0x5c91a8['extensions'][_0x1e77('0x1c')]({'type':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':'outboundrouteid='+_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')],'context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0]['exten'],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});if(_0x5c91a8['extension']&&_0x5c91a8[_0x1e77('0x1b')][_0x1e77('0xe')](_0x1e77('0x25'))&&_0x5c91a8[_0x1e77('0x1b')]['recordingFormat']!==_0x1e77('0x26')){_0x5c91a8[_0x1e77('0x10')][_0x1e77('0x1c')]({'type':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':_0x1e77('0x27'),'context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0]['exten'],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0]['VoiceExtensionId']});_0x5c91a8[_0x1e77('0x10')][_0x1e77('0x1c')]({'type':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':_0x1e77('0x28')+_0x5c91a8[_0x1e77('0x1b')][_0x1e77('0x25')]||'wav','context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});}}_0x5c91a8['extensions']['push']({'type':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':_0x1e77('0x29'),'context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});_0x5c91a8[_0x1e77('0x10')][_0x1e77('0x1c')]({'type':_0x1f3329[_0x3dbc22][0x0]['type'],'app':_0x1e77('0x14'),'appdata':_0x1e77('0x2a'),'context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});_0x5c91a8[_0x1e77('0x10')][_0x1e77('0x1c')]({'type':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'priority':_0x5c91a8[_0x1e77('0xf')]++,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});for(var _0x4a108d=0x0,_0x2f47b0=0x0;_0x4a108d<_0x1f3329[_0x3dbc22][_0x1e77('0x2b')];_0x4a108d+=0x1,_0x2f47b0=0x0){var _0x3242ca=_0x1f3329[_0x3dbc22][_0x4a108d];if(_0x3242ca['type']){_0x3242ca['type']=_0x3242ca[_0x1e77('0x13')][_0x1e77('0x2c')]();}var _0x506932=[];var _0x166d97=[];delete _0x3242ca['id'];delete _0x3242ca[_0x1e77('0x2d')];delete _0x3242ca['updatedAt'];var _0x1c40f1=_0x3242ca[_0x1e77('0x2e')]!==_0x1e77('0x2f')?[_0x3242ca[_0x1e77('0x2e')]]:_0x3242ca[_0x1e77('0x8')]?_[_0x1e77('0x9')](_[_0x1e77('0xb')](_0x5c91a8['intervals'],{'IntervalId':_0x3242ca['IntervalId']}),'interval'):[];if(_0x3242ca['hasOwnProperty'](_0x1e77('0x30'))){if(_0x3242ca[_0x1e77('0x30')]&&_0x3242ca[_0x1e77('0x30')]!=='--'){_0x506932[_0x1e77('0x1c')]({'type':_0x3242ca[_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':_0x1e77('0x31')+_0x3242ca[_0x1e77('0x30')],'context':_0x3242ca[_0x1e77('0x16')],'exten':_0x3242ca[_0x1e77('0x12')],'priority':_0x1c40f1['length']+_0x5c91a8['priority']+_0x2f47b0++,'VoiceExtensionId':_0x3242ca[_0x1e77('0x19')]});}}if(_0x3242ca[_0x1e77('0x13')]===_0x1e77('0x1a')&&_0x3242ca['hasOwnProperty'](_0x1e77('0x32'))){if(_0x3242ca[_0x1e77('0x32')]){_0x506932[_0x1e77('0x1c')]({'type':_0x3242ca[_0x1e77('0x13')],'app':_0x1e77('0x21'),'appdata':_0x1e77('0x33')+_0x3242ca[_0x1e77('0x32')]+')','context':_0x3242ca[_0x1e77('0x16')],'exten':_0x3242ca['exten'],'priority':_0x1c40f1[_0x1e77('0x2b')]+_0x5c91a8[_0x1e77('0xf')]+_0x2f47b0++,'VoiceExtensionId':_0x3242ca[_0x1e77('0x19')]});}else{_0x506932[_0x1e77('0x1c')]({'type':_0x3242ca[_0x1e77('0x13')],'app':_0x1e77('0x21'),'appdata':_0x1e77('0x34'),'context':_0x3242ca['context'],'exten':_0x3242ca[_0x1e77('0x12')],'priority':_0x1c40f1[_0x1e77('0x2b')]+_0x5c91a8['priority']+_0x2f47b0++,'VoiceExtensionId':_0x3242ca[_0x1e77('0x19')]});}}if(_0x3242ca['hasOwnProperty'](_0x1e77('0x35'))){if(_0x2fae2c[_0x1e77('0x36')](_0x3242ca['app'][_0x1e77('0x2c')]())>=0x0&&_0x3242ca[_0x1e77('0x37')]!==_0x1e77('0x38')){if(_0x3242ca[_0x1e77('0x35')]){_0x506932[_0x1e77('0x1c')]({'type':_0x3242ca[_0x1e77('0x13')],'app':'ExecIf','appdata':_0x1e77('0x39'),'context':_0x3242ca[_0x1e77('0x16')],'exten':_0x3242ca[_0x1e77('0x12')],'priority':_0x1c40f1['length']+_0x5c91a8[_0x1e77('0xf')]+_0x2f47b0++,'VoiceExtensionId':_0x3242ca['VoiceExtensionId']});_0x506932[_0x1e77('0x1c')]({'type':_0x3242ca[_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3242ca[_0x1e77('0x16')],'exten':_0x3242ca[_0x1e77('0x12')],'priority':_0x1c40f1['length']+_0x5c91a8[_0x1e77('0xf')]+_0x2f47b0++,'VoiceExtensionId':_0x3242ca[_0x1e77('0x19')]});}else{_0x506932['push']({'type':_0x3242ca[_0x1e77('0x13')],'app':_0x1e77('0x21'),'appdata':_0x1e77('0x3a'),'context':_0x3242ca[_0x1e77('0x16')],'exten':_0x3242ca['exten'],'priority':_0x1c40f1[_0x1e77('0x2b')]+_0x5c91a8['priority']+_0x2f47b0++,'VoiceExtensionId':_0x3242ca['VoiceExtensionId']});_0x506932[_0x1e77('0x1c')]({'type':_0x3242ca[_0x1e77('0x13')],'app':_0x1e77('0x14'),'appdata':_0x1e77('0x3b'),'context':_0x3242ca['context'],'exten':_0x3242ca[_0x1e77('0x12')],'priority':_0x1c40f1['length']+_0x5c91a8[_0x1e77('0xf')]+_0x2f47b0++,'VoiceExtensionId':_0x3242ca[_0x1e77('0x19')]});}}}for(var _0x3e8b00=0x0;_0x3e8b00<_0x1c40f1['length'];_0x3e8b00+=0x1){var _0x4859ef=_0x5c91a8[_0x1e77('0xf')]+_0x1c40f1[_0x1e77('0x2b')];var _0x157e49=_0x3e8b00===_0x1c40f1[_0x1e77('0x2b')]-0x1?_0x5c91a8['priority']+_0x506932[_0x1e77('0x2b')]+_0x166d97[_0x1e77('0x2b')]+0x2:_0x5c91a8[_0x1e77('0xf')]+_0x3e8b00+0x1;_0x506932[_0x1e77('0x3c')](_0x3e8b00,0x0,{'type':_0x3242ca['type'],'app':'GotoIfTime','appdata':_0x1c40f1[_0x3e8b00]+'?'+_0x3242ca[_0x1e77('0x16')]+_0x1e77('0x3d')+_0x4859ef+':'+_0x3242ca[_0x1e77('0x16')]+_0x1e77('0x3d')+_0x157e49,'exten':_0x3242ca['exten'],'context':_0x3242ca[_0x1e77('0x16')],'priority':_0x5c91a8[_0x1e77('0xf')]+_0x3e8b00,'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});}_0x3242ca['priority']=_0x506932['length']?_[_0x1e77('0x3e')](_0x506932)[_0x1e77('0xf')]+0x1:_0x5c91a8['priority'];_0x5c91a8[_0x1e77('0xf')]=(_0x166d97[_0x1e77('0x2b')]?_[_0x1e77('0x3e')](_0x166d97)[_0x1e77('0xf')]:_0x3242ca[_0x1e77('0xf')])+0x1;_0x5c91a8[_0x1e77('0x10')]=_['concat'](_0x5c91a8['extensions'],_0x506932,[_0x3242ca],_0x166d97);}_0x5c91a8[_0x1e77('0x10')][_0x1e77('0x1c')]({'type':_0x1f3329[_0x3dbc22][0x0]['type'],'app':_0x1e77('0x3f'),'exten':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x12')],'context':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x16')],'priority':_0x5c91a8[_0x1e77('0xf')],'VoiceExtensionId':_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]});_0x50030e[_0x1e77('0x1c')](_0x1f3329[_0x3dbc22][0x0][_0x1e77('0x19')]);_0x3bae30=_[_0x1e77('0x40')](_0x3bae30,_0x5c91a8[_0x1e77('0x10')]);}}return _0x52953e[_0x1e77('0x41')](function(_0x5bb495){return _0x52953e['models'][_0x1e77('0x7')][_0x1e77('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x50030e}},'transaction':_0x5bb495})['then'](function(_0x387ad5){return _0x52953e[_0x1e77('0x6')][_0x1e77('0x7')][_0x1e77('0x43')](_['sortBy'](_0x3bae30,'priority'),{'transaction':_0x5bb495});});});})[_0x1e77('0x44')](function(_0x413af3){console[_0x1e77('0x45')](_0x413af3);});}exports[_0x1e77('0x46')]=rewrite; \ No newline at end of file +var _0xa888=['rewrite','lodash','models','Interval','findAll','then','intervals','VoiceExtension','uniq','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extensions','find','exten','push','type','Set','format','context','priority','VoiceExtensionId','inbound','extension','CDR(destination)=','cutdigits','${EXTEN:','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','updatedAt','*,*,*,*','interval','IntervalId','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','toLowerCase','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','bulkCreate','sortBy','error'];(function(_0x12cd34,_0x193584){var _0x4d8172=function(_0x2eec99){while(--_0x2eec99){_0x12cd34['push'](_0x12cd34['shift']());}};_0x4d8172(++_0x193584);}(_0xa888,0x1d6));var _0x8a88=function(_0x2ef88d,_0x47dba9){_0x2ef88d=_0x2ef88d-0x0;var _0x3f4b7f=_0xa888[_0x2ef88d];return _0x3f4b7f;};'use strict';var _=require(_0x8a88('0x0'));var util=require('util');function rewrite(_0x222ee5,_0x42f1c1){var _0x17dc9a=this;return _0x222ee5[_0x8a88('0x1')][_0x8a88('0x2')][_0x8a88('0x3')]({'raw':!![]})[_0x8a88('0x4')](function(_0x553468){_0x17dc9a[_0x8a88('0x5')]=_0x553468;return _0x222ee5[_0x8a88('0x1')][_0x8a88('0x6')]['findAll']({'where':{'IntervalId':_0x42f1c1['IntervalId']},'raw':!![]});})[_0x8a88('0x4')](function(_0x40284c){return _0x222ee5[_0x8a88('0x1')][_0x8a88('0x6')][_0x8a88('0x3')]({'where':{'exten':{'$in':_[_0x8a88('0x7')](_['map'](_0x40284c,'exten'))}},'order':[{'raw':_0x8a88('0x8')}],'raw':!![]});})[_0x8a88('0x4')](function(_0x35b7b5){var _0x3119e6=_[_0x8a88('0x9')](_0x35b7b5,{'priority':'1'});var _0x13e1ab=_['filter'](_0x35b7b5,{'isApp':0x1});var _0x35d414=_[_0x8a88('0xa')](_0x13e1ab,'exten');var _0x1a3ace=[_0x8a88('0xb'),_0x8a88('0xc')];var _0x217371=[];var _0x22473e=[];for(var _0x1d96a1 in _0x35d414){if(_0x35d414[_0x8a88('0xd')](_0x1d96a1)){_0x17dc9a['priority']=0x2;_0x17dc9a[_0x8a88('0xe')]=[];_0x17dc9a['extension']=_[_0x8a88('0xf')](_0x3119e6,{'exten':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x10')]});_0x17dc9a[_0x8a88('0xe')][_0x8a88('0x11')]({'type':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x12')],'app':_0x8a88('0x13'),'appdata':util[_0x8a88('0x14')]('CDR(type)=%s',_0x35d414[_0x1d96a1][0x0][_0x8a88('0x12')]),'context':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x15')],'exten':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x10')],'priority':_0x17dc9a[_0x8a88('0x16')]++,'VoiceExtensionId':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x17')]});if(_0x35d414[_0x1d96a1][0x0][_0x8a88('0x12')]===_0x8a88('0x18')){_0x17dc9a[_0x8a88('0xe')][_0x8a88('0x11')]({'type':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x12')],'app':'Set','appdata':'CDR(routeid)='+_0x35d414[_0x1d96a1][0x0]['VoiceExtensionId'],'context':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x15')],'exten':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x10')],'priority':_0x17dc9a[_0x8a88('0x16')]++,'VoiceExtensionId':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x17')]});}else if(_0x35d414[_0x1d96a1][0x0]['type']==='outbound'){if(_0x17dc9a[_0x8a88('0x19')]){_0x17dc9a[_0x8a88('0xe')]['push']({'type':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x12')],'app':_0x8a88('0x13'),'appdata':_0x8a88('0x1a')+(_0x17dc9a[_0x8a88('0x19')][_0x8a88('0x1b')]?_0x8a88('0x1c')+_0x17dc9a[_0x8a88('0x19')][_0x8a88('0x1b')]+'}':'${EXTEN}'),'context':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x15')],'exten':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x10')],'priority':_0x17dc9a[_0x8a88('0x16')]++,'VoiceExtensionId':_0x35d414[_0x1d96a1][0x0]['VoiceExtensionId']});}_0x17dc9a['extensions']['push']({'type':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x12')],'app':'Set','appdata':_0x8a88('0x1d')+_0x35d414[_0x1d96a1][0x0][_0x8a88('0x17')],'context':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x15')],'exten':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x10')],'priority':_0x17dc9a[_0x8a88('0x16')]++,'VoiceExtensionId':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x17')]});var _0x355171=_0x17dc9a[_0x8a88('0x16')]++;_0x17dc9a['extensions'][_0x8a88('0x11')]({'type':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x12')],'app':_0x8a88('0x1e'),'appdata':_0x8a88('0x1f')+(_0x355171+0x2)+_0x8a88('0x20')+(_0x355171+0x1)+')','context':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x15')],'exten':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x10')],'priority':_0x355171,'VoiceExtensionId':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x17')]});if(_0x17dc9a[_0x8a88('0x19')]){_0x17dc9a[_0x8a88('0xe')]['push']({'type':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x12')],'app':_0x8a88('0x13'),'appdata':_0x17dc9a[_0x8a88('0x19')][_0x8a88('0x1b')]?_0x8a88('0x21')+_0x17dc9a[_0x8a88('0x19')][_0x8a88('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x15')],'exten':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x10')],'priority':_0x17dc9a[_0x8a88('0x16')]++,'VoiceExtensionId':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x17')]});}_0x17dc9a['extensions']['push']({'type':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x12')],'app':'Set','appdata':_0x8a88('0x22')+_0x35d414[_0x1d96a1][0x0][_0x8a88('0x17')],'context':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x15')],'exten':_0x35d414[_0x1d96a1][0x0]['exten'],'priority':_0x17dc9a[_0x8a88('0x16')]++,'VoiceExtensionId':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x17')]});if(_0x17dc9a[_0x8a88('0x19')]&&_0x17dc9a[_0x8a88('0x19')][_0x8a88('0xd')](_0x8a88('0x23'))&&_0x17dc9a[_0x8a88('0x19')][_0x8a88('0x23')]!==_0x8a88('0x24')){_0x17dc9a['extensions'][_0x8a88('0x11')]({'type':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x12')],'app':_0x8a88('0x13'),'appdata':_0x8a88('0x25'),'context':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x15')],'exten':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x10')],'priority':_0x17dc9a[_0x8a88('0x16')]++,'VoiceExtensionId':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x17')]});_0x17dc9a[_0x8a88('0xe')][_0x8a88('0x11')]({'type':_0x35d414[_0x1d96a1][0x0]['type'],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x17dc9a[_0x8a88('0x19')]['recordingFormat']||'wav','context':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x15')],'exten':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x10')],'priority':_0x17dc9a[_0x8a88('0x16')]++,'VoiceExtensionId':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x17')]});}}_0x17dc9a[_0x8a88('0xe')][_0x8a88('0x11')]({'type':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x12')],'app':_0x8a88('0x13'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x15')],'exten':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x10')],'priority':_0x17dc9a['priority']++,'VoiceExtensionId':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x17')]});_0x17dc9a['extensions']['push']({'type':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x12')],'app':'Set','appdata':_0x8a88('0x26'),'context':_0x35d414[_0x1d96a1][0x0]['context'],'exten':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x10')],'priority':_0x17dc9a[_0x8a88('0x16')]++,'VoiceExtensionId':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x17')]});_0x17dc9a[_0x8a88('0xe')][_0x8a88('0x11')]({'type':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x12')],'app':'Set','appdata':_0x8a88('0x27'),'context':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x15')],'exten':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x10')],'priority':_0x17dc9a[_0x8a88('0x16')]++,'VoiceExtensionId':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x17')]});for(var _0xf80404=0x0,_0x2d4961=0x0;_0xf80404<_0x35d414[_0x1d96a1][_0x8a88('0x28')];_0xf80404+=0x1,_0x2d4961=0x0){var _0x165b2b=_0x35d414[_0x1d96a1][_0xf80404];if(_0x165b2b[_0x8a88('0x12')]){_0x165b2b['type']=_0x165b2b[_0x8a88('0x12')]['toLowerCase']();}var _0x363137=[];var _0x2381e0=[];delete _0x165b2b['id'];delete _0x165b2b['createdAt'];delete _0x165b2b[_0x8a88('0x29')];var _0x5b60c0=_0x165b2b['interval']!==_0x8a88('0x2a')?[_0x165b2b[_0x8a88('0x2b')]]:_0x165b2b[_0x8a88('0x2c')]?_['map'](_[_0x8a88('0x9')](_0x17dc9a[_0x8a88('0x5')],{'IntervalId':_0x165b2b[_0x8a88('0x2c')]}),_0x8a88('0x2b')):[];if(_0x165b2b[_0x8a88('0xd')](_0x8a88('0x2d'))){if(_0x165b2b[_0x8a88('0x2d')]&&_0x165b2b[_0x8a88('0x2d')]!=='--'){_0x363137[_0x8a88('0x11')]({'type':_0x165b2b[_0x8a88('0x12')],'app':_0x8a88('0x13'),'appdata':_0x8a88('0x2e')+_0x165b2b[_0x8a88('0x2d')],'context':_0x165b2b[_0x8a88('0x15')],'exten':_0x165b2b[_0x8a88('0x10')],'priority':_0x5b60c0[_0x8a88('0x28')]+_0x17dc9a[_0x8a88('0x16')]+_0x2d4961++,'VoiceExtensionId':_0x165b2b['VoiceExtensionId']});}}if(_0x165b2b[_0x8a88('0x12')]===_0x8a88('0x2f')&&_0x165b2b[_0x8a88('0xd')](_0x8a88('0x30'))){if(_0x165b2b[_0x8a88('0x30')]){_0x363137[_0x8a88('0x11')]({'type':_0x165b2b[_0x8a88('0x12')],'app':_0x8a88('0x1e'),'appdata':_0x8a88('0x31')+_0x165b2b['callerID']+')','context':_0x165b2b[_0x8a88('0x15')],'exten':_0x165b2b[_0x8a88('0x10')],'priority':_0x5b60c0[_0x8a88('0x28')]+_0x17dc9a['priority']+_0x2d4961++,'VoiceExtensionId':_0x165b2b[_0x8a88('0x17')]});}else{_0x363137['push']({'type':_0x165b2b[_0x8a88('0x12')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x165b2b[_0x8a88('0x15')],'exten':_0x165b2b[_0x8a88('0x10')],'priority':_0x5b60c0[_0x8a88('0x28')]+_0x17dc9a[_0x8a88('0x16')]+_0x2d4961++,'VoiceExtensionId':_0x165b2b[_0x8a88('0x17')]});}}if(_0x165b2b[_0x8a88('0xd')](_0x8a88('0x32'))){if(_0x1a3ace[_0x8a88('0x33')](_0x165b2b[_0x8a88('0x34')][_0x8a88('0x35')]())>=0x0&&_0x165b2b['appType']!==_0x8a88('0x36')){if(_0x165b2b['answer']){_0x363137[_0x8a88('0x11')]({'type':_0x165b2b['type'],'app':'ExecIf','appdata':_0x8a88('0x37'),'context':_0x165b2b[_0x8a88('0x15')],'exten':_0x165b2b['exten'],'priority':_0x5b60c0[_0x8a88('0x28')]+_0x17dc9a[_0x8a88('0x16')]+_0x2d4961++,'VoiceExtensionId':_0x165b2b[_0x8a88('0x17')]});_0x363137['push']({'type':_0x165b2b['type'],'app':_0x8a88('0x13'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x165b2b[_0x8a88('0x15')],'exten':_0x165b2b[_0x8a88('0x10')],'priority':_0x5b60c0[_0x8a88('0x28')]+_0x17dc9a[_0x8a88('0x16')]+_0x2d4961++,'VoiceExtensionId':_0x165b2b[_0x8a88('0x17')]});}else{_0x363137[_0x8a88('0x11')]({'type':_0x165b2b[_0x8a88('0x12')],'app':_0x8a88('0x1e'),'appdata':_0x8a88('0x38'),'context':_0x165b2b[_0x8a88('0x15')],'exten':_0x165b2b[_0x8a88('0x10')],'priority':_0x5b60c0[_0x8a88('0x28')]+_0x17dc9a[_0x8a88('0x16')]+_0x2d4961++,'VoiceExtensionId':_0x165b2b['VoiceExtensionId']});_0x363137['push']({'type':_0x165b2b[_0x8a88('0x12')],'app':_0x8a88('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x165b2b['context'],'exten':_0x165b2b[_0x8a88('0x10')],'priority':_0x5b60c0[_0x8a88('0x28')]+_0x17dc9a[_0x8a88('0x16')]+_0x2d4961++,'VoiceExtensionId':_0x165b2b[_0x8a88('0x17')]});}}}for(var _0x17f4fd=0x0;_0x17f4fd<_0x5b60c0[_0x8a88('0x28')];_0x17f4fd+=0x1){var _0x2ef8ac=_0x17dc9a['priority']+_0x5b60c0[_0x8a88('0x28')];var _0x446aa0=_0x17f4fd===_0x5b60c0['length']-0x1?_0x17dc9a[_0x8a88('0x16')]+_0x363137[_0x8a88('0x28')]+_0x2381e0[_0x8a88('0x28')]+0x2:_0x17dc9a[_0x8a88('0x16')]+_0x17f4fd+0x1;_0x363137[_0x8a88('0x39')](_0x17f4fd,0x0,{'type':_0x165b2b['type'],'app':_0x8a88('0x3a'),'appdata':_0x5b60c0[_0x17f4fd]+'?'+_0x165b2b['context']+_0x8a88('0x3b')+_0x2ef8ac+':'+_0x165b2b['context']+_0x8a88('0x3b')+_0x446aa0,'exten':_0x165b2b[_0x8a88('0x10')],'context':_0x165b2b[_0x8a88('0x15')],'priority':_0x17dc9a[_0x8a88('0x16')]+_0x17f4fd,'VoiceExtensionId':_0x35d414[_0x1d96a1][0x0]['VoiceExtensionId']});}_0x165b2b['priority']=_0x363137[_0x8a88('0x28')]?_[_0x8a88('0x3c')](_0x363137)[_0x8a88('0x16')]+0x1:_0x17dc9a[_0x8a88('0x16')];_0x17dc9a[_0x8a88('0x16')]=(_0x2381e0[_0x8a88('0x28')]?_[_0x8a88('0x3c')](_0x2381e0)[_0x8a88('0x16')]:_0x165b2b[_0x8a88('0x16')])+0x1;_0x17dc9a[_0x8a88('0xe')]=_[_0x8a88('0x3d')](_0x17dc9a['extensions'],_0x363137,[_0x165b2b],_0x2381e0);}_0x17dc9a[_0x8a88('0xe')][_0x8a88('0x11')]({'type':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x12')],'app':_0x8a88('0x3e'),'exten':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x10')],'context':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x15')],'priority':_0x17dc9a['priority'],'VoiceExtensionId':_0x35d414[_0x1d96a1][0x0][_0x8a88('0x17')]});_0x217371[_0x8a88('0x11')](_0x35d414[_0x1d96a1][0x0][_0x8a88('0x17')]);_0x22473e=_['concat'](_0x22473e,_0x17dc9a['extensions']);}}return _0x222ee5['transaction'](function(_0x46dc44){return _0x222ee5[_0x8a88('0x1')]['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':{'$in':_0x217371}},'transaction':_0x46dc44})[_0x8a88('0x4')](function(_0x358fb2){return _0x222ee5['models'][_0x8a88('0x6')][_0x8a88('0x3f')](_[_0x8a88('0x40')](_0x22473e,_0x8a88('0x16')),{'transaction':_0x46dc44});});});})['catch'](function(_0x25821d){console[_0x8a88('0x41')](_0x25821d);});}exports[_0x8a88('0x42')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index d754735..6c74887 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 _0x5b4c=['outbound','CmList','Lists','get','always','sequelize','query','VoiceQueueId','push','all','BlackLists','dialCheckDuplicateType','CampaignId','onlyIfOpen','Campaign','cmContact,\x20%s,\x20%s','generalCheckHopper','finally','emit','resolve','unlinkSync','exit','info','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','ioredis','../../../config/environment','../../../config/logger','defaults','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','CmContact','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','inspect','insert','into','fromQuery','phone','scheduledAt','createdAt','updatedAt','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','select','cm_hopper','ContactId','cm_contacts','id\x20IN\x20?','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','str','VoiceQueue','findAll'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5b4c,0x157));var _0xc5b4=function(_0x225b77,_0x137869){_0x225b77=_0x225b77-0x0;var _0x3698e1=_0x5b4c[_0x225b77];return _0x3698e1;};'use strict';var BPromise=require(_0xc5b4('0x0'));var util=require(_0xc5b4('0x1'));var _=require(_0xc5b4('0x2'));var fs=require('fs');var squel=require(_0xc5b4('0x3'));var Papa=require('papaparse');var Redis=require(_0xc5b4('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xc5b4('0x5'));var logger=require(_0xc5b4('0x6'))('api');config['redis']=_[_0xc5b4('0x7')](config[_0xc5b4('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xc5b4('0x9'))(new Redis(config['redis']));require(_0xc5b4('0xa'))[_0xc5b4('0xb')](socket);try{if(!process['argv'][0x2]||process[_0xc5b4('0xc')][0x2]===_0xc5b4('0xd')||process[_0xc5b4('0xc')][0x2]===_0xc5b4('0xe')){throw new Error(_0xc5b4('0xf'));}var FILEPATH=process[_0xc5b4('0xc')][0x2];if(!process[_0xc5b4('0xc')][0x3]||process[_0xc5b4('0xc')][0x3]===_0xc5b4('0xd')||process['argv'][0x3]===_0xc5b4('0xe')||!process[_0xc5b4('0xc')][0x4]||process[_0xc5b4('0xc')][0x4]===_0xc5b4('0xd')||process[_0xc5b4('0xc')][0x4]===_0xc5b4('0xe')){throw new Error(_0xc5b4('0x10'));}var FIELDS=_['zipObject'](process[_0xc5b4('0xc')][0x3]['split'](','),process[_0xc5b4('0xc')][0x4][_0xc5b4('0x11')](','));if(!process['argv'][0x5]||process[_0xc5b4('0xc')][0x5]===_0xc5b4('0xd')||process['argv'][0x5]===_0xc5b4('0xe')){throw new Error(_0xc5b4('0x12'));}var LISTID=process[_0xc5b4('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0xc5b4('0xc')][0x6]!==_0xc5b4('0xe')?process[_0xc5b4('0xc')][0x6]:null;var DUPLICATES=process[_0xc5b4('0xc')][0x7]&&process[_0xc5b4('0xc')][0x7]!=='undefined'&&process[_0xc5b4('0xc')][0x7]!==_0xc5b4('0xe')?process[_0xc5b4('0xc')][0x7]:null;if(!process[_0xc5b4('0xc')][0x8]||process[_0xc5b4('0xc')][0x8]===_0xc5b4('0xd')||process[_0xc5b4('0xc')][0x8]===_0xc5b4('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x4c641e){logger[_0xc5b4('0x13')](_0x4c641e);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(_0x355d23,_0x26235a,_0x38c617,_0x1ad0aa){var _0x3eeff0={'message':_0x26235a};_0x3eeff0[_0x355d23]=!![];if(_0x38c617){_0x3eeff0[_0xc5b4('0x14')]=_0x38c617;}if(_0x1ad0aa){_0x3eeff0['index']=_0x1ad0aa;}return _0x3eeff0;}function isEmail(_0x57494f){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))*$/[_0xc5b4('0x15')](_0x57494f);}function checkRow(_0x93d69a,_0x383ab0,_0x145b72){return new BPromise(function(_0x3f89c,_0x279ee9){if(_[_0xc5b4('0x16')](_0x93d69a)){return _0x279ee9(handleCheckRowError(_0xc5b4('0x13'),_0xc5b4('0x17'),null,_0x145b72));}if(_0x93d69a[_0xc5b4('0x18')]&&_0x93d69a[_0xc5b4('0x18')]['length']){var _0x217539=_[_0xc5b4('0x19')](_0x93d69a[_0xc5b4('0x18')],_0xc5b4('0x1a'))['join'](';');return _0x279ee9(handleCheckRowError(_0xc5b4('0x13'),_0x217539,null,_0x145b72));}var _0x8bfa51={};for(var _0x24b50a in FIELDS){if(FIELDS['hasOwnProperty'](_0x24b50a)&&FIELDS[_0x24b50a]){_0x8bfa51[_0x24b50a]=_0x93d69a[_0xc5b4('0x1b')][0x0][FIELDS[_0x24b50a]]||_0x93d69a[_0xc5b4('0x1b')][0x0]['\ufeff'+FIELDS[_0x24b50a]];}}if(!_0x8bfa51[_0xc5b4('0x1c')]){return _0x279ee9(handleCheckRowError(_0xc5b4('0x13'),_0xc5b4('0x1d'),null,_0x145b72));}if(!_0x8bfa51['phone']){return _0x279ee9(handleCheckRowError(_0xc5b4('0x13'),_0xc5b4('0x1e'),null,_0x145b72));}if(_0x8bfa51['birthDate']){var _0x38f64f=moment(_0x8bfa51[_0xc5b4('0x1f')],'YYYY-MM-DD');if(!_0x38f64f[_0xc5b4('0x20')]()){return _0x279ee9(handleCheckRowError(_0xc5b4('0x13'),_0xc5b4('0x21'),null,_0x145b72));}}if(_0x8bfa51['email']){if(!isEmail(_0x8bfa51[_0xc5b4('0x22')])){return _0x279ee9(handleCheckRowError(_0xc5b4('0x13'),_0xc5b4('0x23'),null,_0x145b72));}}_0x8bfa51[_0xc5b4('0x24')]=LISTID;_0x8bfa51[_0xc5b4('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xc5b4('0x26')]&&_0x383ab0){var _0xcbc131={};for(var _0x19cc9c=0x0,_0x7d3a94=DUPLICATES[_0xc5b4('0x26')];_0x19cc9c<_0x7d3a94;_0x19cc9c+=0x1){_0xcbc131[DUPLICATES[_0x19cc9c]]=_0x8bfa51[DUPLICATES[_0x19cc9c]];}var _0x1b9304=_[_0xc5b4('0x27')](_0x383ab0,_0xcbc131);if(_0x1b9304){return _0x279ee9(handleCheckRowError(_0xc5b4('0x28'),'Duplicate\x20Contact',_0x1b9304,_0x145b72));}}return db[_0xc5b4('0x29')]['create'](_0x8bfa51,{'raw':!![],'hooks':![],'fields':_[_0xc5b4('0x2a')](_0x8bfa51)})[_0xc5b4('0x2b')](function(_0x2892f4){if(DUPLICATES&&DUPLICATES[_0xc5b4('0x26')]&&_0x383ab0){_0x383ab0['push'](_[_0xc5b4('0x2c')](_0x8bfa51,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2892f4['id'];return _0x3f89c();})[_0xc5b4('0x2d')](function(_0x3d0118){return _0x279ee9(handleCheckRowError(_0xc5b4('0x13'),_0xc5b4('0x2e')+(_0x3d0118[_0xc5b4('0x1a')]||JSON[_0xc5b4('0x2f')](_0x3d0118)),null,_0x145b72));});});}function checkHopper(){function _0x1ae44d(){return function(_0x2e8cce){logger['error']('cmContact','checkHopper',util[_0xc5b4('0x30')](_0x2e8cce,{'showHidden':![],'depth':null}));};}var _0x20836f=function(_0xe5e59,_0x2a9344){var _0x4f4056=squel[_0xc5b4('0x31')]()[_0xc5b4('0x32')]('cm_hopper')[_0xc5b4('0x33')]([_0xc5b4('0x34'),_0xc5b4('0x35'),'ContactId',_0xc5b4('0x24'),_0x2a9344,_0xc5b4('0x36'),_0xc5b4('0x37')],squel['select']()[_0xc5b4('0x38')](_0xc5b4('0x34'),_0xc5b4('0x34'))[_0xc5b4('0x38')](_0xc5b4('0x39'),_0xc5b4('0x35'))[_0xc5b4('0x38')]('id','ContactId')['field'](LISTID[_0xc5b4('0x3a')](),_0xc5b4('0x24'))[_0xc5b4('0x38')](_0xe5e59['id'][_0xc5b4('0x3a')](),_0x2a9344)[_0xc5b4('0x38')](_0xc5b4('0x39'),_0xc5b4('0x36'))[_0xc5b4('0x38')]('NOW()',_0xc5b4('0x37'))[_0xc5b4('0x3b')]('cm_contacts')[_0xc5b4('0x3c')](_0xc5b4('0x3d'))[_0xc5b4('0x3c')](_0xc5b4('0x3e'),LISTID[_0xc5b4('0x3a')]())[_0xc5b4('0x3c')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xc5b4('0x3f'),squel[_0xc5b4('0x40')]()[_0xc5b4('0x38')]('phone')[_0xc5b4('0x3b')](_0xc5b4('0x41'))[_0xc5b4('0x3c')](_0x2a9344+'\x20=\x20?',_0xe5e59['id']['toString']())))[_0xc5b4('0x3a')]();return _0x4f4056;};var _0x56fad1=function(_0x492415,_0x1a7d22){var _0x112c87=squel[_0xc5b4('0x31')]()[_0xc5b4('0x32')]('cm_hopper')[_0xc5b4('0x33')]([_0xc5b4('0x34'),_0xc5b4('0x35'),_0xc5b4('0x42'),_0xc5b4('0x24'),_0x1a7d22,_0xc5b4('0x36'),'updatedAt'],squel[_0xc5b4('0x40')]()[_0xc5b4('0x38')]('phone','phone')[_0xc5b4('0x38')](_0xc5b4('0x39'),_0xc5b4('0x35'))['field']('id',_0xc5b4('0x42'))[_0xc5b4('0x38')](LISTID['toString'](),'ListId')[_0xc5b4('0x38')](_0x492415['id'][_0xc5b4('0x3a')](),_0x1a7d22)['field'](_0xc5b4('0x39'),_0xc5b4('0x36'))[_0xc5b4('0x38')](_0xc5b4('0x39'),_0xc5b4('0x37'))[_0xc5b4('0x3b')](_0xc5b4('0x43'))[_0xc5b4('0x3c')]('deletedAt\x20IS\x20NULL')['where'](_0xc5b4('0x3e'),LISTID[_0xc5b4('0x3a')]())['where'](_0xc5b4('0x44'),squel['str'](hopperContacts))[_0xc5b4('0x3c')](_0xc5b4('0x45'))['where'](_0xc5b4('0x3f'),squel[_0xc5b4('0x40')]()[_0xc5b4('0x38')](_0xc5b4('0x46'))[_0xc5b4('0x3b')](_0xc5b4('0x47'))[_0xc5b4('0x3c')](_0x1a7d22+_0xc5b4('0x48'),_0x492415['id'][_0xc5b4('0x3a')]()))[_0xc5b4('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0xc5b4('0x40')]()[_0xc5b4('0x38')]('phone')[_0xc5b4('0x3b')](_0xc5b4('0x41'))[_0xc5b4('0x3c')](_0x1a7d22+_0xc5b4('0x48'),_0x492415['id']['toString']())))[_0xc5b4('0x3a')]();return _0x112c87;};function _0x4fca65(_0x6d0cef,_0x4ccaa0){var _0x149623=squel[_0xc5b4('0x31')]()['into'](_0xc5b4('0x41'))[_0xc5b4('0x33')]([_0xc5b4('0x34'),_0xc5b4('0x35'),_0xc5b4('0x42'),_0xc5b4('0x24'),_0x4ccaa0,_0xc5b4('0x36'),_0xc5b4('0x37')],squel['select']()[_0xc5b4('0x38')](_0xc5b4('0x34'),_0xc5b4('0x34'))[_0xc5b4('0x38')]('NOW()',_0xc5b4('0x35'))[_0xc5b4('0x38')]('id',_0xc5b4('0x42'))[_0xc5b4('0x38')](LISTID[_0xc5b4('0x3a')](),_0xc5b4('0x24'))[_0xc5b4('0x38')](_0x6d0cef['id'][_0xc5b4('0x3a')](),_0x4ccaa0)[_0xc5b4('0x38')](_0xc5b4('0x39'),_0xc5b4('0x36'))[_0xc5b4('0x38')](_0xc5b4('0x39'),'updatedAt')['from']('cm_contacts')['where'](_0xc5b4('0x3d'))[_0xc5b4('0x3c')]('ListId\x20=\x20?',LISTID[_0xc5b4('0x3a')]())[_0xc5b4('0x3c')](_0xc5b4('0x44'),squel['str'](hopperContacts))[_0xc5b4('0x3c')](_0xc5b4('0x45')))[_0xc5b4('0x3a')]();return _0x149623;}function _0x82f72c(_0x274e81,_0x1d5bba){var _0x191b35=squel[_0xc5b4('0x31')]()['into'](_0xc5b4('0x49'))[_0xc5b4('0x33')](['phone',_0xc5b4('0x42'),'ListId',_0x1d5bba,_0xc5b4('0x36'),_0xc5b4('0x37')],squel[_0xc5b4('0x40')]()[_0xc5b4('0x38')](_0xc5b4('0x34'),_0xc5b4('0x34'))['field']('id',_0xc5b4('0x42'))[_0xc5b4('0x38')](LISTID[_0xc5b4('0x3a')](),_0xc5b4('0x24'))['field'](_0x274e81['id']['toString'](),_0x1d5bba)[_0xc5b4('0x38')]('NOW()',_0xc5b4('0x36'))[_0xc5b4('0x38')](_0xc5b4('0x39'),_0xc5b4('0x37'))[_0xc5b4('0x3b')](_0xc5b4('0x43'))['where']('deletedAt\x20IS\x20NULL')[_0xc5b4('0x3c')](_0xc5b4('0x3e'),LISTID[_0xc5b4('0x3a')]())[_0xc5b4('0x3c')]('id\x20IN\x20?',squel[_0xc5b4('0x4a')](hopperContacts))[_0xc5b4('0x3c')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x191b35;}return db[_0xc5b4('0x4b')][_0xc5b4('0x4c')]({'where':{'type':_0xc5b4('0x4d')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xc5b4('0x4e')],'as':_0xc5b4('0x4f'),'where':{'id':LISTID}}]})[_0xc5b4('0x2b')](function(_0x46ad9f){var _0x5d2818=[];if(_0x46ad9f){var _0x470103;for(var _0x553f4e=0x0,_0x520457;_0x553f4e<_0x46ad9f['length'];_0x553f4e+=0x1){_0x520457=_0x46ad9f[_0x553f4e][_0xc5b4('0x50')]({'plain':!![]});switch(_0x520457['dialCheckDuplicateType']){case _0xc5b4('0x51'):_0x5d2818['push'](db[_0xc5b4('0x52')][_0xc5b4('0x53')](_0x56fad1(_0x520457,_0xc5b4('0x54')))[_0xc5b4('0x2b')](function(){})['catch'](_0x1ae44d()));break;case'onlyIfOpen':_0x5d2818[_0xc5b4('0x55')](db[_0xc5b4('0x52')][_0xc5b4('0x53')](_0x20836f(_0x520457,_0xc5b4('0x54')))[_0xc5b4('0x2b')](function(){})[_0xc5b4('0x2d')](_0x1ae44d()));break;default:_0x5d2818[_0xc5b4('0x55')](db[_0xc5b4('0x52')][_0xc5b4('0x53')](_0x4fca65(_0x520457,_0xc5b4('0x54')))[_0xc5b4('0x2b')](function(){})[_0xc5b4('0x2d')](_0x1ae44d()));}}}return _0x5d2818;})[_0xc5b4('0x56')]()[_0xc5b4('0x2b')](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xc5b4('0x4e')],'as':_0xc5b4('0x57'),'where':{'id':LISTID}}]})[_0xc5b4('0x2b')](function(_0x176ab0){var _0x396140=[];if(_0x176ab0){var _0x579b3f;for(var _0x42a07f=0x0,_0x57c1b0;_0x42a07f<_0x176ab0[_0xc5b4('0x26')];_0x42a07f+=0x1){_0x57c1b0=_0x176ab0[_0x42a07f][_0xc5b4('0x50')]({'plain':!![]});_0x396140['push'](db[_0xc5b4('0x52')][_0xc5b4('0x53')](_0x82f72c(_0x57c1b0,_0xc5b4('0x54')))['then'](function(){})['catch'](_0x1ae44d()));}}return _0x396140;})['all']();})[_0xc5b4('0x2b')](function(){return db['Campaign']['findAll']({'attributes':['id',_0xc5b4('0x58')],'include':[{'model':db[_0xc5b4('0x4e')],'as':'Lists','where':{'id':LISTID}}]})[_0xc5b4('0x2b')](function(_0x88ee3a){var _0x46c17c=[];if(_0x88ee3a){for(var _0x36aa35=0x0,_0x53aac2;_0x36aa35<_0x88ee3a[_0xc5b4('0x26')];_0x36aa35+=0x1){_0x53aac2=_0x88ee3a[_0x36aa35][_0xc5b4('0x50')]({'plain':!![]});switch(_0x53aac2['dialCheckDuplicateType']){case'always':_0x46c17c[_0xc5b4('0x55')](db[_0xc5b4('0x52')][_0xc5b4('0x53')](_0x56fad1(_0x53aac2,_0xc5b4('0x59')))[_0xc5b4('0x2b')](function(){})[_0xc5b4('0x2d')](_0x1ae44d()));break;case _0xc5b4('0x5a'):_0x46c17c['push'](db[_0xc5b4('0x52')]['query'](_0x20836f(_0x53aac2,_0xc5b4('0x59')))[_0xc5b4('0x2b')](function(){})[_0xc5b4('0x2d')](_0x1ae44d()));break;default:_0x46c17c['push'](db['sequelize'][_0xc5b4('0x53')](_0x4fca65(_0x53aac2,_0xc5b4('0x59')))['then'](function(){})[_0xc5b4('0x2d')](_0x1ae44d()));}}}return _0x46c17c;})[_0xc5b4('0x56')]();})[_0xc5b4('0x2b')](function(){return db[_0xc5b4('0x5b')][_0xc5b4('0x4c')]({'attributes':['id'],'include':[{'model':db[_0xc5b4('0x4e')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xc5b4('0x2b')](function(_0x2a9bfd){var _0x485cf1=[];if(_0x2a9bfd){for(var _0x24887c=0x0,_0xb89b99;_0x24887c<_0x2a9bfd['length'];_0x24887c+=0x1){_0xb89b99=_0x2a9bfd[_0x24887c][_0xc5b4('0x50')]({'plain':!![]});_0x485cf1[_0xc5b4('0x55')](db[_0xc5b4('0x52')][_0xc5b4('0x53')](_0x82f72c(_0xb89b99,_0xc5b4('0x59')))[_0xc5b4('0x2b')](function(){})[_0xc5b4('0x2d')](_0x1ae44d()));}}return _0x485cf1;})[_0xc5b4('0x56')]();})[_0xc5b4('0x2d')](function(_0x2a3943){logger['error'](_0xc5b4('0x5c'),_0xc5b4('0x5d'),_0x2a3943[_0xc5b4('0x1a')]);});}var processPromises=function(_0x27e1d4){return BPromise[_0xc5b4('0x56')](promises)[_0xc5b4('0x2b')](function(_0x58fdc8){})[_0xc5b4('0x2d')](function(_0x4a1a5d){logger[_0xc5b4('0x13')]('Error\x20processing\x20rows\x20block:',JSON[_0xc5b4('0x2f')](_0x4a1a5d));})[_0xc5b4('0x5e')](function(){socket[_0xc5b4('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x27e1d4){return _0x27e1d4['resume']();}});};var endCsv=function(){return BPromise[_0xc5b4('0x60')]()[_0xc5b4('0x2b')](function(){if(hopperContacts){return checkHopper();}})[_0xc5b4('0x2b')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xc5b4('0x61')](FILEPATH);}catch(_0x11970d){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xc5b4('0x2f')](_0x11970d));}finally{process[_0xc5b4('0x62')](0x0);}});};process['on']('SIGINT',function(){logger[_0xc5b4('0x63')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0xc5b4('0x2b')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xc5b4('0x11')](',');return db[_0xc5b4('0x29')][_0xc5b4('0x4c')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xc5b4('0x2b')](function(_0x4a119a){var _0x5b4761=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xc5b4('0x64')](_0x5b4761,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4caa5c,_0x17ab6e){total+=0x1;var _0x2dd4c7=total;promises[_0xc5b4('0x55')](checkRow(_0x4caa5c,_0x4a119a,_0x2dd4c7)[_0xc5b4('0x2b')](function(){success+=0x1;})[_0xc5b4('0x2d')](function(_0x14c817){if(_0x14c817[_0xc5b4('0x13')]){errors+=0x1;delete _0x14c817['error'];}else if(_0x14c817[_0xc5b4('0x28')]){duplicates+=0x1;delete _0x14c817['duplicate'];}rows[_0xc5b4('0x55')](_0x14c817);}));if(total%0xc8===0x0){_0x17ab6e[_0xc5b4('0x65')]();return processPromises(_0x17ab6e);}},'complete':function(){return processPromises()[_0xc5b4('0x2b')](function(){logger['info'](_0xc5b4('0x66'));endCsv();});},'error':function(_0x45974f,_0xa40bb){logger[_0xc5b4('0x63')](_0xc5b4('0x67'),JSON[_0xc5b4('0x2f')](_0x45974f));endCsv();}});})[_0xc5b4('0x2d')](function(_0x99044a){logger[_0xc5b4('0x13')](_0xc5b4('0x68'),JSON[_0xc5b4('0x2f')](_0x99044a));});}main(); \ No newline at end of file +var _0x7169=['Error\x20executing\x20contact\x20csv\x20import:','util','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','undefined','argv','null','Missing\x20binding\x20parameters!','zipObject','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','keys','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','then','get','always','sequelize','query','onlyIfOpen','all','VoiceQueueId','Campaign','Lists','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x7169,0x72));var _0x9716=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x7169[_0x40bffc];return _0x3007e9;};'use strict';var BPromise=require('bluebird');var util=require(_0x9716('0x0'));var _=require('lodash');var fs=require('fs');var squel=require(_0x9716('0x1'));var Papa=require(_0x9716('0x2'));var Redis=require(_0x9716('0x3'));var db=require(_0x9716('0x4'))['db'];var config=require(_0x9716('0x5'));var logger=require(_0x9716('0x6'))(_0x9716('0x7'));config['redis']=_[_0x9716('0x8')](config[_0x9716('0x9')],{'host':_0x9716('0xa'),'port':0x18eb});var socket=require(_0x9716('0xb'))(new Redis(config[_0x9716('0x9')]));require(_0x9716('0xc'))[_0x9716('0xd')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0x9716('0xe')||process[_0x9716('0xf')][0x2]===_0x9716('0x10')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x9716('0xf')][0x2];if(!process['argv'][0x3]||process[_0x9716('0xf')][0x3]==='undefined'||process[_0x9716('0xf')][0x3]===_0x9716('0x10')||!process[_0x9716('0xf')][0x4]||process[_0x9716('0xf')][0x4]===_0x9716('0xe')||process[_0x9716('0xf')][0x4]==='null'){throw new Error(_0x9716('0x11'));}var FIELDS=_[_0x9716('0x12')](process[_0x9716('0xf')][0x3]['split'](','),process[_0x9716('0xf')][0x4]['split'](','));if(!process[_0x9716('0xf')][0x5]||process[_0x9716('0xf')][0x5]===_0x9716('0xe')||process[_0x9716('0xf')][0x5]===_0x9716('0x10')){throw new Error(_0x9716('0x13'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x9716('0xf')][0x6]&&process['argv'][0x6]!==_0x9716('0xe')&&process['argv'][0x6]!==_0x9716('0x10')?process['argv'][0x6]:null;var DUPLICATES=process[_0x9716('0xf')][0x7]&&process[_0x9716('0xf')][0x7]!==_0x9716('0xe')&&process[_0x9716('0xf')][0x7]!==_0x9716('0x10')?process[_0x9716('0xf')][0x7]:null;if(!process[_0x9716('0xf')][0x8]||process[_0x9716('0xf')][0x8]===_0x9716('0xe')||process[_0x9716('0xf')][0x8]===_0x9716('0x10')){throw new Error(_0x9716('0x14'));}var SOCKET_TIMESTAMP=process[_0x9716('0xf')][0x8];}catch(_0x54e316){logger[_0x9716('0x15')](_0x54e316);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(_0x3fa26a,_0x35b045,_0x3456e3,_0x5e5416){var _0x1e6a22={'message':_0x35b045};_0x1e6a22[_0x3fa26a]=!![];if(_0x3456e3){_0x1e6a22[_0x9716('0x16')]=_0x3456e3;}if(_0x5e5416){_0x1e6a22[_0x9716('0x17')]=_0x5e5416;}return _0x1e6a22;}function isEmail(_0x3bf935){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))*$/[_0x9716('0x18')](_0x3bf935);}function checkRow(_0x56fd3c,_0x3f322d,_0x43766f){return new BPromise(function(_0x5737fa,_0x58eaf4){if(_['isNil'](_0x56fd3c)){return _0x58eaf4(handleCheckRowError(_0x9716('0x15'),_0x9716('0x19'),null,_0x43766f));}if(_0x56fd3c[_0x9716('0x1a')]&&_0x56fd3c[_0x9716('0x1a')][_0x9716('0x1b')]){var _0x210755=_[_0x9716('0x1c')](_0x56fd3c[_0x9716('0x1a')],_0x9716('0x1d'))[_0x9716('0x1e')](';');return _0x58eaf4(handleCheckRowError(_0x9716('0x15'),_0x210755,null,_0x43766f));}var _0x29fda={};for(var _0x315860 in FIELDS){if(FIELDS[_0x9716('0x1f')](_0x315860)&&FIELDS[_0x315860]){_0x29fda[_0x315860]=_0x56fd3c['data'][0x0][FIELDS[_0x315860]]||_0x56fd3c['data'][0x0]['\ufeff'+FIELDS[_0x315860]];}}if(!_0x29fda[_0x9716('0x20')]){return _0x58eaf4(handleCheckRowError(_0x9716('0x15'),_0x9716('0x21'),null,_0x43766f));}if(!_0x29fda[_0x9716('0x22')]){return _0x58eaf4(handleCheckRowError(_0x9716('0x15'),_0x9716('0x23'),null,_0x43766f));}if(_0x29fda[_0x9716('0x24')]){var _0x5671f4=moment(_0x29fda[_0x9716('0x24')],_0x9716('0x25'));if(!_0x5671f4[_0x9716('0x26')]()){return _0x58eaf4(handleCheckRowError('error',_0x9716('0x27'),null,_0x43766f));}}if(_0x29fda[_0x9716('0x28')]){if(!isEmail(_0x29fda[_0x9716('0x28')])){return _0x58eaf4(handleCheckRowError(_0x9716('0x15'),'email\x20format\x20is\x20not\x20valid!',null,_0x43766f));}}_0x29fda[_0x9716('0x29')]=LISTID;_0x29fda[_0x9716('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x9716('0x1b')]&&_0x3f322d){var _0x4d33be={};for(var _0x56f251=0x0,_0x3e42c8=DUPLICATES[_0x9716('0x1b')];_0x56f251<_0x3e42c8;_0x56f251+=0x1){_0x4d33be[DUPLICATES[_0x56f251]]=_0x29fda[DUPLICATES[_0x56f251]];}var _0x68bf5f=_[_0x9716('0x2b')](_0x3f322d,_0x4d33be);if(_0x68bf5f){return _0x58eaf4(handleCheckRowError(_0x9716('0x2c'),_0x9716('0x2d'),_0x68bf5f,_0x43766f));}}return db[_0x9716('0x2e')][_0x9716('0x2f')](_0x29fda,{'raw':!![],'hooks':![],'fields':_[_0x9716('0x30')](_0x29fda)})['then'](function(_0xbc7d0a){if(DUPLICATES&&DUPLICATES[_0x9716('0x1b')]&&_0x3f322d){_0x3f322d[_0x9716('0x31')](_[_0x9716('0x32')](_0x29fda,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xbc7d0a['id'];return _0x5737fa();})[_0x9716('0x33')](function(_0x1fc41d){return _0x58eaf4(handleCheckRowError(_0x9716('0x15'),_0x9716('0x34')+(_0x1fc41d[_0x9716('0x1d')]||JSON[_0x9716('0x35')](_0x1fc41d)),null,_0x43766f));});});}function checkHopper(){function _0x59215d(){return function(_0x21499e){logger[_0x9716('0x15')](_0x9716('0x36'),'checkHopper',util[_0x9716('0x37')](_0x21499e,{'showHidden':![],'depth':null}));};}var _0x4ffc11=function(_0x17c42c,_0x3ee4e5){var _0x22096f=squel[_0x9716('0x38')]()[_0x9716('0x39')](_0x9716('0x3a'))[_0x9716('0x3b')](['phone',_0x9716('0x3c'),_0x9716('0x3d'),_0x9716('0x29'),_0x3ee4e5,_0x9716('0x3e'),_0x9716('0x3f')],squel[_0x9716('0x40')]()[_0x9716('0x41')]('phone',_0x9716('0x22'))[_0x9716('0x41')](_0x9716('0x42'),_0x9716('0x3c'))[_0x9716('0x41')]('id',_0x9716('0x3d'))[_0x9716('0x41')](LISTID[_0x9716('0x43')](),_0x9716('0x29'))[_0x9716('0x41')](_0x17c42c['id']['toString'](),_0x3ee4e5)[_0x9716('0x41')](_0x9716('0x42'),_0x9716('0x3e'))[_0x9716('0x41')](_0x9716('0x42'),'updatedAt')[_0x9716('0x44')](_0x9716('0x45'))[_0x9716('0x46')](_0x9716('0x47'))[_0x9716('0x46')](_0x9716('0x48'),LISTID['toString']())[_0x9716('0x46')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x9716('0x49'),squel['select']()[_0x9716('0x41')](_0x9716('0x22'))[_0x9716('0x44')](_0x9716('0x3a'))['where'](_0x3ee4e5+_0x9716('0x4a'),_0x17c42c['id'][_0x9716('0x43')]())))[_0x9716('0x43')]();return _0x22096f;};var _0x3100db=function(_0x2f8790,_0x42587c){var _0x474c8c=squel[_0x9716('0x38')]()['into']('cm_hopper')[_0x9716('0x3b')]([_0x9716('0x22'),_0x9716('0x3c'),_0x9716('0x3d'),_0x9716('0x29'),_0x42587c,'createdAt','updatedAt'],squel[_0x9716('0x40')]()[_0x9716('0x41')](_0x9716('0x22'),_0x9716('0x22'))['field'](_0x9716('0x42'),'scheduledAt')[_0x9716('0x41')]('id',_0x9716('0x3d'))[_0x9716('0x41')](LISTID[_0x9716('0x43')](),'ListId')['field'](_0x2f8790['id'][_0x9716('0x43')](),_0x42587c)[_0x9716('0x41')](_0x9716('0x42'),_0x9716('0x3e'))['field']('NOW()',_0x9716('0x3f'))['from']('cm_contacts')[_0x9716('0x46')](_0x9716('0x47'))['where']('ListId\x20=\x20?',LISTID[_0x9716('0x43')]())[_0x9716('0x46')](_0x9716('0x4b'),squel[_0x9716('0x4c')](hopperContacts))[_0x9716('0x46')](_0x9716('0x4d'))[_0x9716('0x46')](_0x9716('0x49'),squel[_0x9716('0x40')]()['field'](_0x9716('0x4e'))[_0x9716('0x44')](_0x9716('0x4f'))[_0x9716('0x46')](_0x42587c+_0x9716('0x4a'),_0x2f8790['id']['toString']()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x9716('0x40')]()[_0x9716('0x41')]('phone')[_0x9716('0x44')]('cm_hopper')[_0x9716('0x46')](_0x42587c+_0x9716('0x4a'),_0x2f8790['id'][_0x9716('0x43')]())))[_0x9716('0x43')]();return _0x474c8c;};function _0x355893(_0x3b971e,_0x250150){var _0x587f78=squel['insert']()[_0x9716('0x39')](_0x9716('0x3a'))[_0x9716('0x3b')]([_0x9716('0x22'),_0x9716('0x3c'),_0x9716('0x3d'),'ListId',_0x250150,_0x9716('0x3e'),'updatedAt'],squel[_0x9716('0x40')]()['field'](_0x9716('0x22'),'phone')[_0x9716('0x41')](_0x9716('0x42'),_0x9716('0x3c'))['field']('id','ContactId')[_0x9716('0x41')](LISTID[_0x9716('0x43')](),_0x9716('0x29'))[_0x9716('0x41')](_0x3b971e['id']['toString'](),_0x250150)[_0x9716('0x41')]('NOW()',_0x9716('0x3e'))[_0x9716('0x41')]('NOW()',_0x9716('0x3f'))[_0x9716('0x44')](_0x9716('0x45'))[_0x9716('0x46')](_0x9716('0x47'))[_0x9716('0x46')](_0x9716('0x48'),LISTID[_0x9716('0x43')]())[_0x9716('0x46')](_0x9716('0x4b'),squel[_0x9716('0x4c')](hopperContacts))[_0x9716('0x46')](_0x9716('0x4d')))[_0x9716('0x43')]();return _0x587f78;}function _0xf9fd04(_0x4769d7,_0x13898b){var _0x53d22c=squel[_0x9716('0x38')]()[_0x9716('0x39')](_0x9716('0x50'))[_0x9716('0x3b')](['phone',_0x9716('0x3d'),'ListId',_0x13898b,_0x9716('0x3e'),_0x9716('0x3f')],squel[_0x9716('0x40')]()[_0x9716('0x41')](_0x9716('0x22'),_0x9716('0x22'))['field']('id','ContactId')[_0x9716('0x41')](LISTID[_0x9716('0x43')](),_0x9716('0x29'))[_0x9716('0x41')](_0x4769d7['id'][_0x9716('0x43')](),_0x13898b)[_0x9716('0x41')](_0x9716('0x42'),_0x9716('0x3e'))[_0x9716('0x41')](_0x9716('0x42'),_0x9716('0x3f'))[_0x9716('0x44')](_0x9716('0x45'))[_0x9716('0x46')]('deletedAt\x20IS\x20NULL')[_0x9716('0x46')](_0x9716('0x48'),LISTID[_0x9716('0x43')]())[_0x9716('0x46')]('id\x20IN\x20?',squel[_0x9716('0x4c')](hopperContacts))[_0x9716('0x46')](_0x9716('0x4d')))[_0x9716('0x43')]();return _0x53d22c;}return db[_0x9716('0x51')][_0x9716('0x52')]({'where':{'type':_0x9716('0x53')},'attributes':['id',_0x9716('0x54')],'include':[{'model':db[_0x9716('0x55')],'as':'Lists','where':{'id':LISTID}}]})[_0x9716('0x56')](function(_0x3aa664){var _0xe3c7ef=[];if(_0x3aa664){var _0x20fa4b;for(var _0x39f656=0x0,_0x41332c;_0x39f656<_0x3aa664[_0x9716('0x1b')];_0x39f656+=0x1){_0x41332c=_0x3aa664[_0x39f656][_0x9716('0x57')]({'plain':!![]});switch(_0x41332c[_0x9716('0x54')]){case _0x9716('0x58'):_0xe3c7ef[_0x9716('0x31')](db[_0x9716('0x59')][_0x9716('0x5a')](_0x3100db(_0x41332c,'VoiceQueueId'))[_0x9716('0x56')](function(){})[_0x9716('0x33')](_0x59215d()));break;case _0x9716('0x5b'):_0xe3c7ef['push'](db[_0x9716('0x59')][_0x9716('0x5a')](_0x4ffc11(_0x41332c,'VoiceQueueId'))['then'](function(){})[_0x9716('0x33')](_0x59215d()));break;default:_0xe3c7ef[_0x9716('0x31')](db[_0x9716('0x59')][_0x9716('0x5a')](_0x355893(_0x41332c,'VoiceQueueId'))['then'](function(){})[_0x9716('0x33')](_0x59215d()));}}}return _0xe3c7ef;})[_0x9716('0x5c')]()[_0x9716('0x56')](function(){return db[_0x9716('0x51')][_0x9716('0x52')]({'where':{'type':_0x9716('0x53')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x9716('0x56')](function(_0x1215f9){var _0x383f16=[];if(_0x1215f9){var _0x23aea5;for(var _0x532b3e=0x0,_0x415f75;_0x532b3e<_0x1215f9[_0x9716('0x1b')];_0x532b3e+=0x1){_0x415f75=_0x1215f9[_0x532b3e]['get']({'plain':!![]});_0x383f16[_0x9716('0x31')](db['sequelize'][_0x9716('0x5a')](_0xf9fd04(_0x415f75,_0x9716('0x5d')))[_0x9716('0x56')](function(){})[_0x9716('0x33')](_0x59215d()));}}return _0x383f16;})[_0x9716('0x5c')]();})['then'](function(){return db[_0x9716('0x5e')][_0x9716('0x52')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0x9716('0x5f'),'where':{'id':LISTID}}]})[_0x9716('0x56')](function(_0x29c948){var _0x3f2c90=[];if(_0x29c948){for(var _0x53f7b5=0x0,_0x2f5ea7;_0x53f7b5<_0x29c948[_0x9716('0x1b')];_0x53f7b5+=0x1){_0x2f5ea7=_0x29c948[_0x53f7b5][_0x9716('0x57')]({'plain':!![]});switch(_0x2f5ea7[_0x9716('0x54')]){case'always':_0x3f2c90['push'](db[_0x9716('0x59')][_0x9716('0x5a')](_0x3100db(_0x2f5ea7,'CampaignId'))[_0x9716('0x56')](function(){})['catch'](_0x59215d()));break;case'onlyIfOpen':_0x3f2c90[_0x9716('0x31')](db[_0x9716('0x59')]['query'](_0x4ffc11(_0x2f5ea7,_0x9716('0x60')))[_0x9716('0x56')](function(){})[_0x9716('0x33')](_0x59215d()));break;default:_0x3f2c90[_0x9716('0x31')](db[_0x9716('0x59')][_0x9716('0x5a')](_0x355893(_0x2f5ea7,'CampaignId'))['then'](function(){})[_0x9716('0x33')](_0x59215d()));}}}return _0x3f2c90;})[_0x9716('0x5c')]();})[_0x9716('0x56')](function(){return db['Campaign'][_0x9716('0x52')]({'attributes':['id'],'include':[{'model':db[_0x9716('0x55')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x9716('0x56')](function(_0x7aad4a){var _0xb8a088=[];if(_0x7aad4a){for(var _0x10ae3e=0x0,_0x30d154;_0x10ae3e<_0x7aad4a[_0x9716('0x1b')];_0x10ae3e+=0x1){_0x30d154=_0x7aad4a[_0x10ae3e][_0x9716('0x57')]({'plain':!![]});_0xb8a088[_0x9716('0x31')](db[_0x9716('0x59')][_0x9716('0x5a')](_0xf9fd04(_0x30d154,'CampaignId'))[_0x9716('0x56')](function(){})[_0x9716('0x33')](_0x59215d()));}}return _0xb8a088;})['all']();})[_0x9716('0x33')](function(_0x5de155){logger[_0x9716('0x15')]('cmContact,\x20%s,\x20%s',_0x9716('0x61'),_0x5de155['message']);});}var processPromises=function(_0x44fadc){return BPromise[_0x9716('0x5c')](promises)['then'](function(_0x51d653){})[_0x9716('0x33')](function(_0x55c201){logger[_0x9716('0x15')](_0x9716('0x62'),JSON['stringify'](_0x55c201));})[_0x9716('0x63')](function(){socket[_0x9716('0x64')](_0x9716('0x65')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x44fadc){return _0x44fadc[_0x9716('0x66')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x9716('0x56')](function(){if(hopperContacts){return checkHopper();}})[_0x9716('0x56')](function(){socket['emit'](_0x9716('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x9716('0x67')](FILEPATH);}catch(_0x2713f9){logger[_0x9716('0x15')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x9716('0x35')](_0x2713f9));}finally{process[_0x9716('0x68')](0x0);}});};process['on'](_0x9716('0x69'),function(){logger[_0x9716('0x6a')](_0x9716('0x6b'));endCsv();});function main(){return BPromise[_0x9716('0x6c')]()[_0x9716('0x56')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact'][_0x9716('0x52')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x9716('0x56')](function(_0x4df4c1){var _0x3fe932=fs[_0x9716('0x6d')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x3fe932,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3e0587,_0x510909){total+=0x1;var _0x5545cd=total;promises['push'](checkRow(_0x3e0587,_0x4df4c1,_0x5545cd)[_0x9716('0x56')](function(){success+=0x1;})[_0x9716('0x33')](function(_0x46318d){if(_0x46318d[_0x9716('0x15')]){errors+=0x1;delete _0x46318d[_0x9716('0x15')];}else if(_0x46318d['duplicate']){duplicates+=0x1;delete _0x46318d['duplicate'];}rows[_0x9716('0x31')](_0x46318d);}));if(total%0xc8===0x0){_0x510909['pause']();return processPromises(_0x510909);}},'complete':function(){return processPromises()[_0x9716('0x56')](function(){logger[_0x9716('0x6a')](_0x9716('0x6e'));endCsv();});},'error':function(_0xbd634,_0x4d6ad7){logger[_0x9716('0x6a')](_0x9716('0x6f'),JSON['stringify'](_0xbd634));endCsv();}});})[_0x9716('0x33')](function(_0x485a19){logger[_0x9716('0x15')](_0x9716('0x70'),JSON['stringify'](_0x485a19));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 70dbd28..3b365fb 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 _0xa5b6=['cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','recallme','cm_contacts.ListId\x20=\x20','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','into','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','field','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','push','code','sequelize','spread','main','start','socket_timestamp','server/files/tmp','.csv','writeFileSync','createReadStream','data','length','rows','errors','hasOwnProperty','trim','replace','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','appendFileSync','emit','contact:import:','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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','each','then','finish','affectedRows','unlink','catch','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','../../../mysqldb','../../../config/environment','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt'];(function(_0x499b91,_0x13f90e){var _0xd9a4e8=function(_0x589c73){while(--_0x589c73){_0x499b91['push'](_0x499b91['shift']());}};_0xd9a4e8(++_0x13f90e);}(_0xa5b6,0x6b));var _0x6a5b=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0xa5b6[_0xb66df];return _0x42a702;};'use strict';var fs=require('fs');var path=require(_0x6a5b('0x0'));var _=require(_0x6a5b('0x1'));var Papa=require(_0x6a5b('0x2'));var util=require(_0x6a5b('0x3'));var BPromise=require(_0x6a5b('0x4'));var moment=require(_0x6a5b('0x5'));var squel=require(_0x6a5b('0x6'));var Redis=require('ioredis');var db=require(_0x6a5b('0x7'))['db'];var config=require(_0x6a5b('0x8'));var logger=require('../../../config/logger')(_0x6a5b('0x9'));config['redis']=_[_0x6a5b('0xa')](config[_0x6a5b('0xb')],{'host':_0x6a5b('0xc'),'port':0x18eb});var socket=require(_0x6a5b('0xd'))(new Redis(config[_0x6a5b('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x6a5b('0xe')](_0x6a5b('0xf'));function isEmail(_0x23bc09){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))*$/[_0x6a5b('0x10')](_0x23bc09);}function selectNotIn(_0x29b3c3,_0x3ceb2a,_0x460bf9,_0x51787e,_0x11f1f6){return squel[_0x6a5b('0x11')]()['field'](_0x6a5b('0x12'))[_0x6a5b('0x13')](_0x51787e)[_0x6a5b('0x14')](_0x3ceb2a,null,_0x3ceb2a+_0x6a5b('0x15')+_0x51787e+'.'+_0x460bf9)[_0x6a5b('0x16')](_0x51787e+'.'+_0x460bf9+_0x6a5b('0x17')+_0x29b3c3+'.'+_0x460bf9)['where'](_0x3ceb2a+_0x6a5b('0x18')+_0x11f1f6['join']()+')');}function insertCmHopper(_0x5d2922,_0x215042,_0x3f04fc,_0x12467f,_0x5cf43a){var _0x8a883e=[_0x6a5b('0x19'),_0x6a5b('0x1a'),_0x6a5b('0x1b'),_0x6a5b('0x1c'),_0x215042+'.'+_0x12467f,_0x6a5b('0x1d'),_0x6a5b('0x1e'),_0x6a5b('0x1f'),_0x6a5b('0x20'),'\x22'+_0x5cf43a+'\x22'];return squel[_0x6a5b('0x21')]()['into'](_0x6a5b('0x22'))[_0x6a5b('0x23')]([_0x6a5b('0x12'),_0x6a5b('0x24'),_0x6a5b('0x25'),_0x6a5b('0x26'),_0x12467f,_0x6a5b('0x27'),_0x6a5b('0x28'),'priority',_0x6a5b('0x29'),_0x6a5b('0x2a')],squel['select']()['fields'](_0x8a883e)['from'](_0x215042)['join']('cm_contacts',null,_0x6a5b('0x2b')+_0x215042+'.CmListId')[_0x6a5b('0x14')](_0x3f04fc,null,_0x3f04fc+_0x6a5b('0x15')+_0x215042+'.'+_0x12467f)[_0x6a5b('0x16')](_0x215042+'.CmListId\x20=\x20?',_0x5d2922)[_0x6a5b('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x6a5b('0x2c'),selectNotIn(_0x215042,_0x3f04fc,_0x12467f,_0x6a5b('0x22'),[_0x6a5b('0x2d'),'\x22onlyIfOpen\x22']))[_0x6a5b('0x16')](_0x6a5b('0x2c'),selectNotIn(_0x215042,_0x3f04fc,_0x12467f,_0x6a5b('0x22'),['\x22always\x22'])))[_0x6a5b('0x2e')]();}function insertCmHopperBlack(_0x22b21f,_0x189848,_0x3bcfe8,_0x5883f7){var _0x5584ab=['cm_contacts.phone',_0x6a5b('0x1b'),_0x6a5b('0x1c'),_0x189848+'.'+_0x5883f7,_0x6a5b('0x1d'),_0x6a5b('0x1e')];return squel[_0x6a5b('0x21')]()[_0x6a5b('0x2f')]('cm_hopper_black')['fromQuery']([_0x6a5b('0x12'),_0x6a5b('0x25'),_0x6a5b('0x26'),_0x5883f7,_0x6a5b('0x27'),_0x6a5b('0x28')],squel[_0x6a5b('0x11')]()[_0x6a5b('0x30')](_0x5584ab)[_0x6a5b('0x13')](_0x189848)[_0x6a5b('0x14')](_0x6a5b('0x31'),null,_0x6a5b('0x2b')+_0x189848+_0x6a5b('0x32'))['join'](_0x3bcfe8,null,_0x3bcfe8+_0x6a5b('0x15')+_0x189848+'.'+_0x5883f7)['where'](_0x189848+_0x6a5b('0x33'),_0x22b21f)['where'](_0x6a5b('0x34'),NOW)[_0x6a5b('0x16')](_0x6a5b('0x2c'),squel[_0x6a5b('0x11')]()[_0x6a5b('0x35')](_0x6a5b('0x12'))[_0x6a5b('0x13')]('cm_hopper_black')[_0x6a5b('0x16')](_0x6a5b('0x36'),_0x22b21f)[_0x6a5b('0x16')](_0x5883f7+_0x6a5b('0x37'),_0x189848+'.'+_0x5883f7)))['toString']();}function insertCmContact(_0xa7fed9,_0x57fe4d,_0x471ba9,_0x3e5e35){var _0x1362fa=_[_0x6a5b('0x38')](_[_0x6a5b('0x39')](_0x3e5e35),[_0x6a5b('0x26'),_0x6a5b('0x3a'),_0x6a5b('0x27'),'updatedAt']);return squel[_0x6a5b('0x21')]()['into'](_0x6a5b('0x31'))['fromQuery'](_0x1362fa,squel[_0x6a5b('0x11')]()[_0x6a5b('0x30')](_0x1362fa)[_0x6a5b('0x13')](_0x57fe4d)[_0x6a5b('0x16')]('('+_0x471ba9[_0x6a5b('0x14')](',')+')\x20NOT\x20IN\x20?',squel[_0x6a5b('0x11')]()[_0x6a5b('0x30')](_0x471ba9)[_0x6a5b('0x13')](_0x6a5b('0x31'))[_0x6a5b('0x16')]('ListId\x20=\x20?',_0xa7fed9)[_0x6a5b('0x16')]('deletedAt\x20IS\x20NULL'))[_0x6a5b('0x16')](_0x6a5b('0x3b'),squel['select']()['field'](_0x6a5b('0x3c'),_0x6a5b('0x3d'))[_0x6a5b('0x13')](_0x57fe4d)[_0x6a5b('0x3e')](_0x471ba9[_0x6a5b('0x14')](','))))[_0x6a5b('0x2e')]();}function handleStop(){logger[_0x6a5b('0x3f')](_0x6a5b('0x40'));stopped=!![];}function handleUncaughtException(_0x41157a){logger[_0x6a5b('0x41')](_0x41157a[_0x6a5b('0x42')]);process[_0x6a5b('0x43')](0x1);}function handleError(_0x266fd0,_0x3ef129){stats['errors'][_0x6a5b('0x44')]({'name':_0x3ef129[_0x6a5b('0x45')],'message':_0x3ef129[_0x6a5b('0x42')],'row':_0x266fd0});}function handleQuery(_0x817244){logger['info'](_0x817244);return db[_0x6a5b('0x46')]['query'](_0x817244)[_0x6a5b('0x47')](function(_0x3fc152){results[_0x6a5b('0x44')](_0x3fc152);})['catch'](function(_0x53de3f){logger['error'](_0x53de3f[_0x6a5b('0x42')]);});}function main(_0x5ce4fb,_0x1ce550,_0x18408a,_0xa097b5){logger[_0x6a5b('0x3f')](_0x6a5b('0x48'),_0x5ce4fb,JSON['stringify'](_0x1ce550));process['send'](_0x6a5b('0x49'));var _0x1780c0=_0x1ce550['binding'];var _0x2fb34a=_0x1ce550[_0x6a5b('0x4a')];var _0x5c21d5=path['join'](config['root'],_0x6a5b('0x4b'),_0x2fb34a+_0x6a5b('0x4c'));var _0x37052d=_[_0x6a5b('0x39')](_0x1780c0)[_0x6a5b('0x14')]();logger[_0x6a5b('0x3f')]('header',_0x37052d);fs[_0x6a5b('0x4d')](_0x5c21d5,_0x37052d+'\x0a');Papa['parse'](fs[_0x6a5b('0x4e')](_0x5ce4fb),{'header':!![],'skipEmptyLines':!![],'step':function(_0xf524d7,_0x199a01){try{for(var _0xd7342a=0x0,_0x2dc056=[];_0xd7342a<_0xf524d7[_0x6a5b('0x4f')][_0x6a5b('0x50')];_0xd7342a++){stats[_0x6a5b('0x51')]+=0x1;if(_0xf524d7[_0x6a5b('0x52')][_0xd7342a]){handleError(_0xf524d7['data'][_0xd7342a],_0xf524d7['errors'][_0xd7342a]);}else{var _0x43a91a=[];for(var _0x4d65de in _0x1780c0){if(_0x1780c0[_0x6a5b('0x53')](_0x4d65de)){if(_0xf524d7[_0x6a5b('0x4f')][_0xd7342a][_0x1780c0[_0x4d65de]]){var _0x124ead=_[_0x6a5b('0x54')](_0xf524d7[_0x6a5b('0x4f')][_0xd7342a][_0x1780c0[_0x4d65de]][_0x6a5b('0x55')](/"/g,'\x27'));switch(_0x4d65de){case _0x6a5b('0x24'):var _0x4f2135=moment(_0x124ead,_0x6a5b('0xf'),!![]);if(_0x4f2135['isValid']()){_0x2dc056['push']('\x22'+_0x124ead+'\x22');}else{_0x43a91a[_0x6a5b('0x44')](_0x6a5b('0x56'));}break;case _0x6a5b('0x57'):var _0x45077c=parseInt(_0x124ead);_0x124ead=_[_0x6a5b('0x58')](_0x45077c)||_0x45077c<0x0||_0x45077c>0x4?_0xa097b5?0x3:0x2:_0x45077c;_0x2dc056[_0x6a5b('0x44')]('\x22'+_0x124ead+'\x22');break;case'UserId':var _0x2c63e0=parseInt(_0x124ead);if(_['isNumber'](_0x2c63e0)&&_[_0x6a5b('0x59')](_0x18408a,_0x2c63e0)){_0x2dc056[_0x6a5b('0x44')]('\x22'+_0x2c63e0+'\x22');}else{_0x43a91a[_0x6a5b('0x44')](_0x6a5b('0x5a'));}break;case _0x6a5b('0x5b'):if(isEmail(_0x124ead)){_0x2dc056['push']('\x22'+_0x124ead+'\x22');}else{_0x43a91a[_0x6a5b('0x44')](_0x6a5b('0x5c'));}break;case'dateOfBirth':var _0x2a818d=moment(_0x124ead,'YYYY-MM-DD',!![]);if(_0x2a818d[_0x6a5b('0x5d')]()){_0x2dc056[_0x6a5b('0x44')]('\x22'+_0x124ead+'\x22');}else{_0x43a91a['push'](_0x6a5b('0x5e'));}break;default:_0x2dc056[_0x6a5b('0x44')]('\x22'+_0x124ead+'\x22');}}else{switch(_0x4d65de){case'firstName':case _0x6a5b('0x12'):_0x43a91a[_0x6a5b('0x44')](_0x4d65de+_0x6a5b('0x5f'));break;default:_0x2dc056['push']('\x22\x22');}}}}if(_0x43a91a['length']){handleError(_0xf524d7[_0x6a5b('0x4f')][_0xd7342a],{'code':'SystemRow','message':_0x43a91a['join']()});}else{fs[_0x6a5b('0x60')](_0x5c21d5,_0x2dc056[_0x6a5b('0x14')]()+'\x0a');}_0x2dc056=[];}if(!(stats['rows']%0xc8)){socket[_0x6a5b('0x61')](_0x6a5b('0x62')+_0x2fb34a,stats);stats[_0x6a5b('0x52')]=[];}}if(stopped){logger[_0x6a5b('0x3f')]('Abort\x20parser');_0x199a01['abort']();}}catch(_0x19200f){handleError(_0xf524d7[_0x6a5b('0x4f')][_0xd7342a],{'code':_0x6a5b('0x63'),'message':_0x19200f[_0x6a5b('0x42')]});logger[_0x6a5b('0x41')](_0x6a5b('0x64'),_0x19200f[_0x6a5b('0x42')]);}},'complete':function(){try{var _0x5aa016=[];var _0x50b627=_0x6a5b('0x31');if(_0x1ce550[_0x6a5b('0x65')]&&_0x1ce550[_0x6a5b('0x65')]['length']){_0x50b627='cm_contacts_'+_0x2fb34a;_0x5aa016[_0x6a5b('0x44')](_0x6a5b('0x66')+_0x50b627+_0x6a5b('0x67'));}var _0x3a35c7=util[_0x6a5b('0xe')]('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',_0x5c21d5,_0x50b627,_0x37052d,_0x1ce550[_0x6a5b('0x26')],_0x1ce550[_0x6a5b('0x3a')]||null,NOW,NOW);if(_[_0x6a5b('0x68')](_0x1780c0[_0x6a5b('0x24')])){_0x3a35c7+=_0x6a5b('0x69');}_0x5aa016[_0x6a5b('0x44')](_0x3a35c7);if(_0x1ce550[_0x6a5b('0x65')]&&_0x1ce550['duplicates'][_0x6a5b('0x50')]){_0x5aa016[_0x6a5b('0x44')](insertCmContact(_0x1ce550[_0x6a5b('0x26')],_0x50b627,_0x1ce550['duplicates'],_0x1780c0));_0x5aa016[_0x6a5b('0x44')](_0x6a5b('0x6a')+_0x50b627+';');}_0x5aa016[_0x6a5b('0x44')](insertCmHopper(_0x1ce550[_0x6a5b('0x26')],_0x6a5b('0x6b'),_0x6a5b('0x6c'),_0x6a5b('0x6d'),_0xa097b5));_0x5aa016[_0x6a5b('0x44')](insertCmHopperBlack(_0x1ce550['ListId'],_0x6a5b('0x6e'),_0x6a5b('0x6c'),'VoiceQueueId'));_0x5aa016[_0x6a5b('0x44')](insertCmHopper(_0x1ce550['ListId'],_0x6a5b('0x6f'),_0x6a5b('0x70'),_0x6a5b('0x71'),_0xa097b5));_0x5aa016[_0x6a5b('0x44')](insertCmHopperBlack(_0x1ce550['ListId'],_0x6a5b('0x72'),_0x6a5b('0x70'),'CampaignId'));BPromise[_0x6a5b('0x73')](_0x5aa016,handleQuery)[_0x6a5b('0x74')](function(_0x5e1448){stats[_0x6a5b('0x75')]=!![];stats[_0x6a5b('0x76')]=_0x1ce550[_0x6a5b('0x65')]&&_0x1ce550[_0x6a5b('0x65')]['length']?results[0x2]['affectedRows']:results[0x0][_0x6a5b('0x76')];socket['emit'](_0x6a5b('0x62')+_0x2fb34a,stats);fs[_0x6a5b('0x77')](_0x5ce4fb);fs['unlink'](_0x5c21d5);process[_0x6a5b('0x43')](0x0);})[_0x6a5b('0x78')](function(_0x4b8fce){logger['error'](_0x4b8fce[_0x6a5b('0x42')]);process[_0x6a5b('0x43')](0x1);});}catch(_0x2efab4){logger[_0x6a5b('0x41')](_0x6a5b('0x79'),_0x2efab4[_0x6a5b('0x42')]);process[_0x6a5b('0x43')](0x1);}},'error':function(_0x2fc5ac,_0x4bd478,_0x4ab658,_0x498848){throw new Error(_0x498848);}});}function validate(){if(process['argv']&&process[_0x6a5b('0x7a')]['length']<0x4){throw new Error(_0x6a5b('0x7b'));}var _0x31e164=path['join'](config['root'],_0x6a5b('0x4b'),process[_0x6a5b('0x7a')][0x2]);if(!fs[_0x6a5b('0x7c')](_0x31e164)){throw new Error(_0x6a5b('0x7d'));}var _0xf8f284={};try{_0xf8f284=JSON[_0x6a5b('0x7e')](process[_0x6a5b('0x7a')][0x3]);if(!_0xf8f284[_0x6a5b('0x7f')]){throw new Error(_0x6a5b('0x80'));}if(!_0xf8f284[_0x6a5b('0x7f')][_0x6a5b('0x12')]){throw new Error(_0x6a5b('0x81'));}if(!_0xf8f284[_0x6a5b('0x7f')][_0x6a5b('0x82')]){throw new Error(_0x6a5b('0x83'));}var _0x27c6fd=0x0;if(_0xf8f284[_0x6a5b('0x7f')][_0x6a5b('0x29')]){_0x27c6fd=0x1;}if(!_0xf8f284[_0x6a5b('0x26')]){throw new Error(_0x6a5b('0x84'));}}catch(_0x4b6f33){throw new Error('body\x20id\x20mandatory');}var _0x5704c0=[];try{_0x5704c0=_[_0x6a5b('0x85')](JSON['parse'](process[_0x6a5b('0x7a')][0x4]),'id');}catch(_0x218489){logger[_0x6a5b('0x3f')](_0x6a5b('0x86'));}main(_0x31e164,_0xf8f284,_0x5704c0,_0x27c6fd);}validate();process['on'](_0x6a5b('0x87'),handleStop);process['on'](_0x6a5b('0x88'),handleUncaughtException); \ No newline at end of file +var _0x9057=['CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','voice_queues_has_cm_lists','voice_queues_has_cm_blacklists','voice_queues','VoiceQueueId','campaigns_has_cm_lists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','exit','argv','root','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','socket.io-emitter','format','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ListId','createdAt','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','ContactId','cm_contacts.createdAt\x20=\x20?','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','errors','push','code','sequelize','spread','catch','main','stringify','send','start','server/files/tmp','.csv','writeFileSync','parse','data','length','rows','hasOwnProperty','trim','YYYY-MM-DD\x20HH:mm:ss','isNaN','UserId','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','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'];(function(_0x2d45aa,_0x1eb0f1){var _0x3d1a3d=function(_0x59aed6){while(--_0x59aed6){_0x2d45aa['push'](_0x2d45aa['shift']());}};_0x3d1a3d(++_0x1eb0f1);}(_0x9057,0x99));var _0x7905=function(_0x2338fa,_0x80579a){_0x2338fa=_0x2338fa-0x0;var _0x42df9b=_0x9057[_0x2338fa];return _0x42df9b;};'use strict';var fs=require('fs');var path=require(_0x7905('0x0'));var _=require(_0x7905('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x7905('0x2'));var moment=require('moment');var squel=require(_0x7905('0x3'));var Redis=require(_0x7905('0x4'));var db=require(_0x7905('0x5'))['db'];var config=require(_0x7905('0x6'));var logger=require(_0x7905('0x7'))(_0x7905('0x8'));config['redis']=_[_0x7905('0x9')](config[_0x7905('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7905('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x7905('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x4af6e0){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))*$/[_0x7905('0xd')](_0x4af6e0);}function selectNotIn(_0x3fb11c,_0x45f475,_0x420353,_0x2fc44b,_0x263c2e){return squel[_0x7905('0xe')]()[_0x7905('0xf')](_0x7905('0x10'))[_0x7905('0x11')](_0x2fc44b)[_0x7905('0x12')](_0x45f475,null,_0x45f475+_0x7905('0x13')+_0x2fc44b+'.'+_0x420353)['where'](_0x2fc44b+'.'+_0x420353+_0x7905('0x14')+_0x3fb11c+'.'+_0x420353)['where'](_0x45f475+_0x7905('0x15')+_0x263c2e['join']()+')');}function insertCmHopper(_0x43e5f5,_0xc276f5,_0x2eeab2,_0x4f72a0,_0xb2c794){var _0x4efffb=[_0x7905('0x16'),_0x7905('0x17'),_0x7905('0x18'),_0x7905('0x19'),_0xc276f5+'.'+_0x4f72a0,_0x7905('0x1a'),_0x7905('0x1b'),_0x7905('0x1c'),_0x7905('0x1d'),'\x22'+_0xb2c794+'\x22'];return squel[_0x7905('0x1e')]()[_0x7905('0x1f')](_0x7905('0x20'))[_0x7905('0x21')]([_0x7905('0x10'),_0x7905('0x22'),'ContactId',_0x7905('0x23'),_0x4f72a0,_0x7905('0x24'),_0x7905('0x25'),_0x7905('0x26'),'UserId',_0x7905('0x27')],squel[_0x7905('0xe')]()[_0x7905('0x28')](_0x4efffb)[_0x7905('0x11')](_0xc276f5)[_0x7905('0x12')](_0x7905('0x29'),null,_0x7905('0x2a')+_0xc276f5+_0x7905('0x2b'))[_0x7905('0x12')](_0x2eeab2,null,_0x2eeab2+_0x7905('0x13')+_0xc276f5+'.'+_0x4f72a0)[_0x7905('0x2c')](_0xc276f5+_0x7905('0x2d'),_0x43e5f5)[_0x7905('0x2c')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x7905('0x2c')](_0x7905('0x2e'),selectNotIn(_0xc276f5,_0x2eeab2,_0x4f72a0,_0x7905('0x20'),[_0x7905('0x2f'),_0x7905('0x30')]))[_0x7905('0x2c')](_0x7905('0x2e'),selectNotIn(_0xc276f5,_0x2eeab2,_0x4f72a0,_0x7905('0x20'),['\x22always\x22'])))[_0x7905('0x31')]();}function insertCmHopperBlack(_0x491fc6,_0x102bc1,_0x11049f,_0x44a1f7){var _0x2498a3=[_0x7905('0x16'),_0x7905('0x18'),_0x7905('0x19'),_0x102bc1+'.'+_0x44a1f7,'cm_contacts.createdAt',_0x7905('0x1b')];return squel[_0x7905('0x1e')]()[_0x7905('0x1f')]('cm_hopper_black')[_0x7905('0x21')]([_0x7905('0x10'),_0x7905('0x32'),_0x7905('0x23'),_0x44a1f7,_0x7905('0x24'),'updatedAt'],squel['select']()[_0x7905('0x28')](_0x2498a3)[_0x7905('0x11')](_0x102bc1)[_0x7905('0x12')]('cm_contacts',null,_0x7905('0x2a')+_0x102bc1+'.CmListId')['join'](_0x11049f,null,_0x11049f+'.id\x20=\x20'+_0x102bc1+'.'+_0x44a1f7)[_0x7905('0x2c')](_0x102bc1+'.CmListId\x20=\x20?',_0x491fc6)[_0x7905('0x2c')](_0x7905('0x33'),NOW)[_0x7905('0x2c')](_0x7905('0x2e'),squel[_0x7905('0xe')]()[_0x7905('0xf')](_0x7905('0x10'))['from'](_0x7905('0x34'))[_0x7905('0x2c')](_0x7905('0x35'),_0x491fc6)[_0x7905('0x2c')](_0x44a1f7+_0x7905('0x36'),_0x102bc1+'.'+_0x44a1f7)))['toString']();}function insertCmContact(_0x2655bb,_0x7e51d,_0x146b97,_0x25d6a1){var _0x35d5af=_[_0x7905('0x37')](_[_0x7905('0x38')](_0x25d6a1),[_0x7905('0x23'),'CompanyId',_0x7905('0x24'),_0x7905('0x25')]);return squel[_0x7905('0x1e')]()[_0x7905('0x1f')]('cm_contacts')[_0x7905('0x21')](_0x35d5af,squel['select']()[_0x7905('0x28')](_0x35d5af)['from'](_0x7e51d)[_0x7905('0x2c')]('('+_0x146b97[_0x7905('0x12')](',')+_0x7905('0x39'),squel['select']()[_0x7905('0x28')](_0x146b97)[_0x7905('0x11')](_0x7905('0x29'))['where'](_0x7905('0x35'),_0x2655bb)[_0x7905('0x2c')]('deletedAt\x20IS\x20NULL'))[_0x7905('0x2c')](_0x7905('0x3a'),squel['select']()['field'](_0x7905('0x3b'),_0x7905('0x3c'))['from'](_0x7e51d)[_0x7905('0x3d')](_0x146b97[_0x7905('0x12')](','))))[_0x7905('0x31')]();}function handleStop(){logger[_0x7905('0x3e')](_0x7905('0x3f'));stopped=!![];}function handleUncaughtException(_0x371692){logger[_0x7905('0x40')](_0x371692[_0x7905('0x41')]);process['exit'](0x1);}function handleError(_0x32a2a9,_0x3c355b){stats[_0x7905('0x42')][_0x7905('0x43')]({'name':_0x3c355b[_0x7905('0x44')],'message':_0x3c355b['message'],'row':_0x32a2a9});}function handleQuery(_0x4b154a){logger['info'](_0x4b154a);return db[_0x7905('0x45')]['query'](_0x4b154a)[_0x7905('0x46')](function(_0x5318bf){results[_0x7905('0x43')](_0x5318bf);})[_0x7905('0x47')](function(_0x28f09a){logger[_0x7905('0x40')](_0x28f09a[_0x7905('0x41')]);});}function main(_0x167aa2,_0x317c07,_0x1fe00d,_0xbe2f2){logger[_0x7905('0x3e')](_0x7905('0x48'),_0x167aa2,JSON[_0x7905('0x49')](_0x317c07));process[_0x7905('0x4a')](_0x7905('0x4b'));var _0x48a3b0=_0x317c07['binding'];var _0x304445=_0x317c07['socket_timestamp'];var _0x39b5ef=path[_0x7905('0x12')](config['root'],_0x7905('0x4c'),_0x304445+_0x7905('0x4d'));var _0x463e08=_[_0x7905('0x38')](_0x48a3b0)[_0x7905('0x12')]();logger[_0x7905('0x3e')]('header',_0x463e08);fs[_0x7905('0x4e')](_0x39b5ef,_0x463e08+'\x0a');Papa[_0x7905('0x4f')](fs['createReadStream'](_0x167aa2),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3547d4,_0x1a83d4){try{for(var _0x384ee5=0x0,_0x206778=[];_0x384ee5<_0x3547d4[_0x7905('0x50')][_0x7905('0x51')];_0x384ee5++){stats[_0x7905('0x52')]+=0x1;if(_0x3547d4[_0x7905('0x42')][_0x384ee5]){handleError(_0x3547d4[_0x7905('0x50')][_0x384ee5],_0x3547d4[_0x7905('0x42')][_0x384ee5]);}else{var _0x6679ca=[];for(var _0x91ba2d in _0x48a3b0){if(_0x48a3b0[_0x7905('0x53')](_0x91ba2d)){if(_0x3547d4['data'][_0x384ee5][_0x48a3b0[_0x91ba2d]]){var _0x2cb412=_[_0x7905('0x54')](_0x3547d4['data'][_0x384ee5][_0x48a3b0[_0x91ba2d]]['replace'](/"/g,'\x27'));switch(_0x91ba2d){case _0x7905('0x22'):var _0x4d9dbb=moment(_0x2cb412,_0x7905('0x55'),!![]);if(_0x4d9dbb['isValid']()){_0x206778[_0x7905('0x43')]('\x22'+_0x2cb412+'\x22');}else{_0x6679ca[_0x7905('0x43')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x7905('0x26'):var _0x1120d5=parseInt(_0x2cb412);_0x2cb412=_[_0x7905('0x56')](_0x1120d5)||_0x1120d5<0x0||_0x1120d5>0x4?_0xbe2f2?0x3:0x2:_0x1120d5;_0x206778[_0x7905('0x43')]('\x22'+_0x2cb412+'\x22');break;case _0x7905('0x57'):var _0x463d84=parseInt(_0x2cb412);if(_['isNumber'](_0x463d84)&&_[_0x7905('0x58')](_0x1fe00d,_0x463d84)){_0x206778[_0x7905('0x43')]('\x22'+_0x463d84+'\x22');}else{_0x6679ca[_0x7905('0x43')](_0x7905('0x59'));}break;case'email':if(isEmail(_0x2cb412)){_0x206778[_0x7905('0x43')]('\x22'+_0x2cb412+'\x22');}else{_0x6679ca[_0x7905('0x43')](_0x7905('0x5a'));}break;case _0x7905('0x5b'):var _0x1b9edf=moment(_0x2cb412,_0x7905('0x5c'),!![]);if(_0x1b9edf[_0x7905('0x5d')]()){_0x206778[_0x7905('0x43')]('\x22'+_0x2cb412+'\x22');}else{_0x6679ca['push'](_0x7905('0x5e'));}break;default:_0x206778[_0x7905('0x43')]('\x22'+_0x2cb412+'\x22');}}else{switch(_0x91ba2d){case _0x7905('0x5f'):case _0x7905('0x10'):_0x6679ca[_0x7905('0x43')](_0x91ba2d+_0x7905('0x60'));break;default:_0x206778[_0x7905('0x43')]('\x22\x22');}}}}if(_0x6679ca[_0x7905('0x51')]){handleError(_0x3547d4[_0x7905('0x50')][_0x384ee5],{'code':_0x7905('0x61'),'message':_0x6679ca[_0x7905('0x12')]()});}else{fs[_0x7905('0x62')](_0x39b5ef,_0x206778[_0x7905('0x12')]()+'\x0a');}_0x206778=[];}if(!(stats[_0x7905('0x52')]%0xc8)){socket[_0x7905('0x63')]('contact:import:'+_0x304445,stats);stats['errors']=[];}}if(stopped){logger['info']('Abort\x20parser');_0x1a83d4['abort']();}}catch(_0x491ae9){handleError(_0x3547d4[_0x7905('0x50')][_0x384ee5],{'code':'SystemError','message':_0x491ae9['message']});logger[_0x7905('0x40')]('step',_0x491ae9[_0x7905('0x41')]);}},'complete':function(){try{var _0x5df8a8=[];var _0x54c7dc=_0x7905('0x29');if(_0x317c07[_0x7905('0x64')]&&_0x317c07[_0x7905('0x64')]['length']){_0x54c7dc=_0x7905('0x65')+_0x304445;_0x5df8a8[_0x7905('0x43')](_0x7905('0x66')+_0x54c7dc+_0x7905('0x67'));}var _0x10a567=util[_0x7905('0xc')](_0x7905('0x68'),_0x39b5ef,_0x54c7dc,_0x463e08,_0x317c07[_0x7905('0x23')],_0x317c07[_0x7905('0x69')]||null,NOW,NOW);if(_['isNil'](_0x48a3b0[_0x7905('0x22')])){_0x10a567+=_0x7905('0x6a');}_0x5df8a8['push'](_0x10a567);if(_0x317c07[_0x7905('0x64')]&&_0x317c07[_0x7905('0x64')][_0x7905('0x51')]){_0x5df8a8[_0x7905('0x43')](insertCmContact(_0x317c07[_0x7905('0x23')],_0x54c7dc,_0x317c07['duplicates'],_0x48a3b0));_0x5df8a8['push'](_0x7905('0x6b')+_0x54c7dc+';');}_0x5df8a8['push'](insertCmHopper(_0x317c07[_0x7905('0x23')],_0x7905('0x6c'),'voice_queues','VoiceQueueId',_0xbe2f2));_0x5df8a8[_0x7905('0x43')](insertCmHopperBlack(_0x317c07[_0x7905('0x23')],_0x7905('0x6d'),_0x7905('0x6e'),_0x7905('0x6f')));_0x5df8a8[_0x7905('0x43')](insertCmHopper(_0x317c07[_0x7905('0x23')],_0x7905('0x70'),'campaigns',_0x7905('0x71'),_0xbe2f2));_0x5df8a8[_0x7905('0x43')](insertCmHopperBlack(_0x317c07[_0x7905('0x23')],_0x7905('0x72'),'campaigns',_0x7905('0x71')));BPromise['each'](_0x5df8a8,handleQuery)['then'](function(_0x19fc29){stats[_0x7905('0x73')]=!![];stats[_0x7905('0x74')]=_0x317c07['duplicates']&&_0x317c07['duplicates'][_0x7905('0x51')]?results[0x2][_0x7905('0x74')]:results[0x0][_0x7905('0x74')];socket[_0x7905('0x63')]('contact:import:'+_0x304445,stats);fs[_0x7905('0x75')](_0x167aa2);fs[_0x7905('0x75')](_0x39b5ef);process['exit'](0x0);})[_0x7905('0x47')](function(_0x224830){logger['error'](_0x224830['message']);process['exit'](0x1);});}catch(_0x12324a){logger[_0x7905('0x40')]('complete',_0x12324a[_0x7905('0x41')]);process[_0x7905('0x76')](0x1);}},'error':function(_0x1f3969,_0x20af52,_0x1fc3fa,_0x231fef){throw new Error(_0x231fef);}});}function validate(){if(process['argv']&&process[_0x7905('0x77')][_0x7905('0x51')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x42afc9=path['join'](config[_0x7905('0x78')],_0x7905('0x4c'),process[_0x7905('0x77')][0x2]);if(!fs[_0x7905('0x79')](_0x42afc9)){throw new Error(_0x7905('0x7a'));}var _0x5d3c74={};try{_0x5d3c74=JSON[_0x7905('0x4f')](process[_0x7905('0x77')][0x3]);if(!_0x5d3c74[_0x7905('0x7b')]){throw new Error(_0x7905('0x7c'));}if(!_0x5d3c74[_0x7905('0x7b')]['phone']){throw new Error('phone\x20is\x20mandatory');}if(!_0x5d3c74[_0x7905('0x7b')][_0x7905('0x5f')]){throw new Error(_0x7905('0x7d'));}var _0x566c44=0x0;if(_0x5d3c74[_0x7905('0x7b')][_0x7905('0x57')]){_0x566c44=0x1;}if(!_0x5d3c74[_0x7905('0x23')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x54a8ce){throw new Error(_0x7905('0x7e'));}var _0x58d295=[];try{_0x58d295=_[_0x7905('0x7f')](JSON[_0x7905('0x4f')](process[_0x7905('0x77')][0x4]),'id');}catch(_0x32a81e){logger[_0x7905('0x3e')]('No\x20agent\x20available');}main(_0x42afc9,_0x5d3c74,_0x58d295,_0x566c44);}validate();process['on'](_0x7905('0x80'),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 2ada281..bebdf4c 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 _0x4f4d=['agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Member\x20Name','membername','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','queue','variable','calleridnum','outbound','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','Call\x20To','UniqueId','uniqueid','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','destcalleridnum','Agent\x20Ring','Agent\x20Complete'];(function(_0x2d9357,_0x2b2efd){var _0x334c81=function(_0x15f0fd){while(--_0x15f0fd){_0x2d9357['push'](_0x2d9357['shift']());}};_0x334c81(++_0x2b2efd);}(_0x4f4d,0x195));var _0xd4f4=function(_0x52b7b9,_0x43ed4b){_0x52b7b9=_0x52b7b9-0x0;var _0x5b5d30=_0x4f4d[_0x52b7b9];return _0x5b5d30;};'use strict';exports[_0xd4f4('0x0')]=function(_0x41aa9a,_0x560297){var _0xf0692b=[{'type':_0xd4f4('0x1'),'content':_0xd4f4('0x2'),'variableName':null}];switch(_0x41aa9a[_0xd4f4('0x3')]()){case'voice':switch(_0x560297['toLowerCase']()){case _0xd4f4('0x4'):_0xf0692b[_0xd4f4('0x5')]({'type':'variable','content':'','variableName':_0xd4f4('0x6')});_0xf0692b[_0xd4f4('0x5')]({'type':_0xd4f4('0x7'),'content':'','variableName':_0xd4f4('0x8')});break;case _0xd4f4('0x9'):_0xf0692b[_0xd4f4('0x5')]({'type':_0xd4f4('0x1'),'content':'Outbound\x20Call','variableName':null});_0xf0692b[_0xd4f4('0x5')]({'type':_0xd4f4('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0xf0692b;};exports[_0xd4f4('0xa')]=function(_0x24b244,_0x3c7929){var _0x25e6e2=[];switch(_0x24b244[_0xd4f4('0x3')]()){case'voice':switch(_0x3c7929[_0xd4f4('0x3')]()){case _0xd4f4('0x4'):_0x25e6e2=[{'type':_0xd4f4('0x1'),'content':_0xd4f4('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0xd4f4('0xc'),'content':'','key':'Caller\x20Number','keyType':_0xd4f4('0x7'),'variableName':'calleridnum'},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0xd'),'keyType':_0xd4f4('0x7'),'variableName':'calleridname'},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0xe'),'keyType':_0xd4f4('0x7'),'variableName':'destexten'},{'type':_0xd4f4('0xc'),'content':'','key':'Queue','keyType':'variable','variableName':'queue'},{'type':'keyValue','content':'','key':_0xd4f4('0xf'),'keyType':_0xd4f4('0x7'),'variableName':_0xd4f4('0x10')},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0x11'),'keyType':_0xd4f4('0x7'),'variableName':'agentcalledAt'},{'type':'string','content':_0xd4f4('0x12'),'key':null,'keyType':null,'variableName':null},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0x13'),'keyType':'variable','variableName':_0xd4f4('0x14')},{'type':_0xd4f4('0xc'),'content':'','key':'Agent\x20Number','keyType':_0xd4f4('0x7'),'variableName':_0xd4f4('0x15')},{'type':_0xd4f4('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0x16'),'keyType':_0xd4f4('0x7'),'variableName':'agentcalledAt'},{'type':'keyValue','content':'','key':'Agent\x20Connect','keyType':_0xd4f4('0x7'),'variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':_0xd4f4('0x17'),'keyType':_0xd4f4('0x7'),'variableName':_0xd4f4('0x18')},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0x19'),'keyType':_0xd4f4('0x7'),'variableName':_0xd4f4('0x1a')},{'type':'keyValue','content':'','key':_0xd4f4('0x1b'),'keyType':_0xd4f4('0x7'),'variableName':_0xd4f4('0x1c')}];break;case _0xd4f4('0x9'):_0x25e6e2=[{'type':_0xd4f4('0x1'),'content':_0xd4f4('0xb'),'variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':_0xd4f4('0x7'),'keyContent':'','variableName':_0xd4f4('0x15')},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0x1d'),'keyType':_0xd4f4('0x7'),'keyContent':'','variableName':_0xd4f4('0x1e')},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0xf'),'keyType':_0xd4f4('0x7'),'keyContent':'','variableName':_0xd4f4('0x10')},{'type':_0xd4f4('0xc'),'content':'','key':'Date','keyType':_0xd4f4('0x7'),'keyContent':'','variableName':_0xd4f4('0x1f')},{'type':_0xd4f4('0x1'),'content':_0xd4f4('0x20')},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0x21'),'keyType':_0xd4f4('0x7'),'keyContent':'','variableName':'answertime'},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0x22'),'keyType':'variable','keyContent':'','variableName':_0xd4f4('0x23')},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0x24'),'keyType':'variable','keyContent':'','variableName':_0xd4f4('0x25')},{'type':_0xd4f4('0xc'),'content':'','key':_0xd4f4('0x26'),'keyType':_0xd4f4('0x7'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x25e6e2;}; \ No newline at end of file +var _0x83d7=['Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','variable','queue','push','calleridnum','Outbound\x20Call','getDescriptions','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','Agent\x20Ring','agentconnectAt','Hold\x20Time','holdtime','Talk\x20Time','outbound','Called\x20Number','***\x20Time\x20Info\x20***'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x83d7,0x1d4));var _0x783d=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x83d7[_0x49ca18];return _0x145d54;};'use strict';exports[_0x783d('0x0')]=function(_0x1fb40c,_0x586eb3){var _0x28f792=[{'type':_0x783d('0x1'),'content':_0x783d('0x2'),'variableName':null}];switch(_0x1fb40c['toLowerCase']()){case _0x783d('0x3'):switch(_0x586eb3[_0x783d('0x4')]()){case _0x783d('0x5'):_0x28f792['push']({'type':_0x783d('0x6'),'content':'','variableName':_0x783d('0x7')});_0x28f792[_0x783d('0x8')]({'type':_0x783d('0x6'),'content':'','variableName':_0x783d('0x9')});break;case'outbound':_0x28f792['push']({'type':_0x783d('0x1'),'content':_0x783d('0xa'),'variableName':null});_0x28f792[_0x783d('0x8')]({'type':_0x783d('0x6'),'content':'','variableName':'destcalleridnum'});break;}}return _0x28f792;};exports[_0x783d('0xb')]=function(_0x4e3936,_0x446401){var _0x5f05aa=[];switch(_0x4e3936['toLowerCase']()){case _0x783d('0x3'):switch(_0x446401[_0x783d('0x4')]()){case _0x783d('0x5'):_0x5f05aa=[{'type':_0x783d('0x1'),'content':_0x783d('0xc'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x783d('0xd'),'keyType':_0x783d('0x6'),'variableName':_0x783d('0x9')},{'type':_0x783d('0xe'),'content':'','key':_0x783d('0xf'),'keyType':'variable','variableName':'calleridname'},{'type':'keyValue','content':'','key':_0x783d('0x10'),'keyType':_0x783d('0x6'),'variableName':_0x783d('0x11')},{'type':'keyValue','content':'','key':_0x783d('0x12'),'keyType':'variable','variableName':'queue'},{'type':'keyValue','content':'','key':_0x783d('0x13'),'keyType':_0x783d('0x6'),'variableName':_0x783d('0x14')},{'type':_0x783d('0xe'),'content':'','key':_0x783d('0x15'),'keyType':_0x783d('0x6'),'variableName':_0x783d('0x16')},{'type':_0x783d('0x1'),'content':_0x783d('0x17'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x783d('0x18'),'keyType':_0x783d('0x6'),'variableName':_0x783d('0x19')},{'type':_0x783d('0xe'),'content':'','key':_0x783d('0x1a'),'keyType':'variable','variableName':_0x783d('0x1b')},{'type':_0x783d('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x783d('0xe'),'content':'','key':_0x783d('0x1c'),'keyType':_0x783d('0x6'),'variableName':'agentcalledAt'},{'type':_0x783d('0xe'),'content':'','key':'Agent\x20Connect','keyType':_0x783d('0x6'),'variableName':_0x783d('0x1d')},{'type':'keyValue','content':'','key':'Agent\x20Complete','keyType':'variable','variableName':'agentcompleteAt'},{'type':'keyValue','content':'','key':_0x783d('0x1e'),'keyType':_0x783d('0x6'),'variableName':_0x783d('0x1f')},{'type':_0x783d('0xe'),'content':'','key':_0x783d('0x20'),'keyType':'variable','variableName':'talktime'}];break;case _0x783d('0x21'):_0x5f05aa=[{'type':_0x783d('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x783d('0xe'),'content':'','key':_0x783d('0x22'),'keyType':'variable','keyContent':'','variableName':_0x783d('0x1b')},{'type':_0x783d('0xe'),'content':'','key':'Member\x20Name','keyType':'variable','keyContent':'','variableName':'membername'},{'type':_0x783d('0xe'),'content':'','key':_0x783d('0x13'),'keyType':_0x783d('0x6'),'keyContent':'','variableName':_0x783d('0x14')},{'type':_0x783d('0xe'),'content':'','key':_0x783d('0x15'),'keyType':'variable','keyContent':'','variableName':'starttime'},{'type':_0x783d('0x1'),'content':_0x783d('0x23')},{'type':'keyValue','content':'','key':_0x783d('0x24'),'keyType':_0x783d('0x6'),'keyContent':'','variableName':_0x783d('0x25')},{'type':_0x783d('0xe'),'content':'','key':_0x783d('0x26'),'keyType':_0x783d('0x6'),'keyContent':'','variableName':_0x783d('0x27')},{'type':_0x783d('0xe'),'content':'','key':_0x783d('0x28'),'keyType':_0x783d('0x6'),'keyContent':'','variableName':'duration'},{'type':_0x783d('0xe'),'content':'','key':'Billable\x20Time','keyType':_0x783d('0x6'),'keyContent':'','variableName':_0x783d('0x29')}];break;}}return _0x5f05aa;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 875bbed..ab7237f 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 _0xe657=['clone','body','omit','html','fax','mobile','../../config/logger','mail-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','role','null','Interaction','then','catch','error','tracked','user','query'];(function(_0x1d37fc,_0x4db492){var _0x652aa6=function(_0x34f767){while(--_0x34f767){_0x1d37fc['push'](_0x1d37fc['shift']());}};_0x652aa6(++_0x4db492);}(_0xe657,0x1ce));var _0x7e65=function(_0x1a7a16,_0x682c85){_0x1a7a16=_0x1a7a16-0x0;var _0xf0d62e=_0xe657[_0x1a7a16];return _0xf0d62e;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x7e65('0x0'))('openchannel-interactions'),'mail':require(_0x7e65('0x0'))(_0x7e65('0x1')),'fax':require(_0x7e65('0x0'))('fax-interactions'),'sms':require(_0x7e65('0x0'))(_0x7e65('0x2')),'chat':require(_0x7e65('0x0'))('chat-interactions'),'whatsapp':require('../../config/logger')(_0x7e65('0x3'))};function getInteractionId(_0x3092d3,_0x42d1ba,_0x336ba5){if(_0x3092d3&&_0x3092d3[_[_0x7e65('0x4')](_0x336ba5)+_0x7e65('0x5')]){return _0x3092d3[_[_0x7e65('0x4')](_0x336ba5)+_0x7e65('0x5')];}else if(_0x3092d3&&_0x3092d3['id']){return _0x3092d3['id'];}else if(_0x42d1ba&&_0x42d1ba['id']){return _0x42d1ba['id'];}else{return _0x7e65('0x6');}}function log(_0x52cd9d,_0x59e62c,_0x3bdcd7,_0x1b1cca,_0x41c827,_0x40c152){loggers[_0x41c827[_0x7e65('0x7')]()][_0x52cd9d]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x40c152[_0x7e65('0x8')](),_0x59e62c?_0x59e62c['id']:null,_0x59e62c?_0x59e62c['name']:null,_0x59e62c?_0x59e62c[_0x7e65('0x9')]:null,getInteractionId(_0x3bdcd7,_0x1b1cca,_0x41c827),_0x3bdcd7?JSON['stringify'](_0x3bdcd7):_0x7e65('0xa'));}function updateUser(_0x537170,_0x2c398b,_0x537315,_0xdf307b,_0x1c205e){db[_['upperFirst'](_0xdf307b)+_0x7e65('0xb')]['findOne']({'where':{'id':getInteractionId(_0x2c398b,_0x537315,_0xdf307b)}})['then'](function(_0x15ed0d){if(_0x15ed0d){return _0x15ed0d['update']({'UserId':_0x537170?_0x537170['id']:null});}})[_0x7e65('0xc')](function(_0x269bd9){if(_0x269bd9){log('info',_0x537170,_0x2c398b,_0x537315,_0xdf307b,_0x1c205e);}})[_0x7e65('0xd')](function(){log(_0x7e65('0xe'),_0x537170,_0x2c398b,_0x537315,_0xdf307b,_0x1c205e);});}exports[_0x7e65('0xf')]=function(_0x18afc7,_0x2f5b71){return function(_0x4b6ec7,_0x46273b,_0x5b7e4e){var _0x5c2d8d=_0x4b6ec7[_0x7e65('0x10')];var _0x168141={};var _0x355d98=_0x4b6ec7[_0x7e65('0x11')];if(_0x168141){_0x168141=_[_0x7e65('0x12')](_0x4b6ec7[_0x7e65('0x13')]);_0x168141=_[_0x7e65('0x14')](_0x168141,[_0x7e65('0x13'),_0x7e65('0x15'),'phone',_0x7e65('0x16'),_0x7e65('0x17')]);}updateUser(_0x5c2d8d,_0x168141,_0x355d98,_0x18afc7,_0x2f5b71);_0x5b7e4e(null);};}; \ No newline at end of file +var _0x26a1=['Interaction','findOne','then','update','info','catch','error','tracked','user','query','clone','body','omit','phone','fax','mobile','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown','toLowerCase','toUpperCase','role','stringify'];(function(_0x5b8310,_0x77ea6f){var _0xd3ebc1=function(_0x9dfb29){while(--_0x9dfb29){_0x5b8310['push'](_0x5b8310['shift']());}};_0xd3ebc1(++_0x77ea6f);}(_0x26a1,0xca));var _0x126a=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x26a1[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x126a('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x126a('0x1'))(_0x126a('0x2')),'mail':require(_0x126a('0x1'))(_0x126a('0x3')),'fax':require(_0x126a('0x1'))(_0x126a('0x4')),'sms':require(_0x126a('0x1'))(_0x126a('0x5')),'chat':require(_0x126a('0x1'))(_0x126a('0x6')),'whatsapp':require(_0x126a('0x1'))(_0x126a('0x7'))};function getInteractionId(_0x5698ad,_0x4149f5,_0x1e0882){if(_0x5698ad&&_0x5698ad[_['upperFirst'](_0x1e0882)+_0x126a('0x8')]){return _0x5698ad[_[_0x126a('0x9')](_0x1e0882)+_0x126a('0x8')];}else if(_0x5698ad&&_0x5698ad['id']){return _0x5698ad['id'];}else if(_0x4149f5&&_0x4149f5['id']){return _0x4149f5['id'];}else{return _0x126a('0xa');}}function log(_0x4ffecf,_0x3698ae,_0x2160c5,_0x24f21c,_0x5746c3,_0x3f47e2){loggers[_0x5746c3[_0x126a('0xb')]()][_0x4ffecf]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3f47e2[_0x126a('0xc')](),_0x3698ae?_0x3698ae['id']:null,_0x3698ae?_0x3698ae['name']:null,_0x3698ae?_0x3698ae[_0x126a('0xd')]:null,getInteractionId(_0x2160c5,_0x24f21c,_0x5746c3),_0x2160c5?JSON[_0x126a('0xe')](_0x2160c5):'null');}function updateUser(_0x524623,_0x5aa7d7,_0x27f778,_0xf117dc,_0x35cd1a){db[_[_0x126a('0x9')](_0xf117dc)+_0x126a('0xf')][_0x126a('0x10')]({'where':{'id':getInteractionId(_0x5aa7d7,_0x27f778,_0xf117dc)}})[_0x126a('0x11')](function(_0x51ea2c){if(_0x51ea2c){return _0x51ea2c[_0x126a('0x12')]({'UserId':_0x524623?_0x524623['id']:null});}})[_0x126a('0x11')](function(_0x2dd3c9){if(_0x2dd3c9){log(_0x126a('0x13'),_0x524623,_0x5aa7d7,_0x27f778,_0xf117dc,_0x35cd1a);}})[_0x126a('0x14')](function(){log(_0x126a('0x15'),_0x524623,_0x5aa7d7,_0x27f778,_0xf117dc,_0x35cd1a);});}exports[_0x126a('0x16')]=function(_0x512f9a,_0x5c8549){return function(_0x4d6c63,_0x51f6fe,_0x45a3cc){var _0x490dde=_0x4d6c63[_0x126a('0x17')];var _0x2a2cc8={};var _0x384bd8=_0x4d6c63[_0x126a('0x18')];if(_0x2a2cc8){_0x2a2cc8=_[_0x126a('0x19')](_0x4d6c63[_0x126a('0x1a')]);_0x2a2cc8=_[_0x126a('0x1b')](_0x2a2cc8,[_0x126a('0x1a'),'html',_0x126a('0x1c'),_0x126a('0x1d'),_0x126a('0x1e')]);}updateUser(_0x490dde,_0x2a2cc8,_0x384bd8,_0x512f9a,_0x5c8549);_0x45a3cc(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 9772ad2..19c00ea 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 _0xcac9=['parse','hasOwnProperty','use','License','findOne','then','status','json','users','User','user','isUserLimit','crypto','util','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','final'];(function(_0x23579b,_0x31c388){var _0x2f23fe=function(_0x2c80a3){while(--_0x2c80a3){_0x23579b['push'](_0x23579b['shift']());}};_0x2f23fe(++_0x31c388);}(_0xcac9,0x1a4));var _0x9cac=function(_0x174a72,_0x46034c){_0x174a72=_0x174a72-0x0;var _0x32cecd=_0xcac9[_0x174a72];return _0x32cecd;};'use strict';var crypto=require(_0x9cac('0x0'));var util=require(_0x9cac('0x1'));var compose=require('composable-middleware');var db=require(_0x9cac('0x2'))['db'];var config=require(_0x9cac('0x3'));function getValueFromLicense(_0x500080,_0x4b9fe1){if(_0x500080&&_0x4b9fe1){if(_0x4b9fe1[_0x9cac('0x4')]&&_0x4b9fe1[_0x9cac('0x5')]){var _0x3fc46b=_0x4b9fe1['data1'];var _0x25aee5=_0x4b9fe1['license'];var _0x51097e=_0x3fc46b[_0x9cac('0x6')]('-')[0x4];var _0x18cc02=_0x3fc46b[_0x9cac('0x6')]('-')[0x0];var _0x5d34a9=crypto[_0x9cac('0x7')](_0x9cac('0x8'),util[_0x9cac('0x9')](_0x9cac('0xa'),_0x51097e,_0x3fc46b,_0x18cc02));var _0xcd283e=_0x5d34a9['update'](_0x25aee5,'base64','utf8');_0xcd283e+=_0x5d34a9[_0x9cac('0xb')]('utf8');var _0x3b4f82=JSON[_0x9cac('0xc')](_0xcd283e);return _0x3b4f82[_0x9cac('0xd')](_0x500080)?_0x3b4f82[_0x500080]:null;}}return null;}function isLimit(_0x280821,_0x5ad5cc,_0x44bcc0,_0x19f572){var _0x546604=_0x5ad5cc;return compose()[_0x9cac('0xe')](function(_0x208a5d,_0x217b1a,_0x2039f7){return db[_0x9cac('0xf')][_0x9cac('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x9cac('0x11')](function(_0x19806a){var _0xacb6ee=getValueFromLicense(_0x280821,_0x19806a);return _0xacb6ee?_0xacb6ee:_0x546604;})[_0x9cac('0x11')](function(_0x23990c){_0x546604=_0x23990c;return _0x44bcc0['count'](_0x19f572);})[_0x9cac('0x11')](function(_0x3dfc90){if(_0x3dfc90>=_0x546604){return _0x217b1a[_0x9cac('0x12')](0x193)[_0x9cac('0x13')]({'message':util[_0x9cac('0x9')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x280821)});}_0x2039f7();})['catch'](function(_0x4037d9){_0x2039f7(_0x4037d9);});});}function isUserLimit(){return isLimit(_0x9cac('0x14'),0x1,db[_0x9cac('0x15')],{'where':{'$or':[{'role':'admin'},{'role':_0x9cac('0x16')}]}});}exports[_0x9cac('0x17')]=isUserLimit; \ No newline at end of file +var _0x17a7=['then','count','status','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','../../mysqldb','../../config/environment','license','data1','split','createDecipher','format','update','base64','utf8','parse','hasOwnProperty','License'];(function(_0x4d8958,_0x565027){var _0x4a4283=function(_0x4204bf){while(--_0x4204bf){_0x4d8958['push'](_0x4d8958['shift']());}};_0x4a4283(++_0x565027);}(_0x17a7,0xc2));var _0x717a=function(_0x74a413,_0x29a1f0){_0x74a413=_0x74a413-0x0;var _0x2533d3=_0x17a7[_0x74a413];return _0x2533d3;};'use strict';var crypto=require('crypto');var util=require('util');var compose=require('composable-middleware');var db=require(_0x717a('0x0'))['db'];var config=require(_0x717a('0x1'));function getValueFromLicense(_0x34cb3f,_0x4094b5){if(_0x34cb3f&&_0x4094b5){if(_0x4094b5['data1']&&_0x4094b5[_0x717a('0x2')]){var _0x49a603=_0x4094b5[_0x717a('0x3')];var _0x4420aa=_0x4094b5['license'];var _0x232539=_0x49a603[_0x717a('0x4')]('-')[0x4];var _0xd7d2ce=_0x49a603[_0x717a('0x4')]('-')[0x0];var _0x536824=crypto[_0x717a('0x5')]('aes-256-ctr',util[_0x717a('0x6')]('%s:%s:%s',_0x232539,_0x49a603,_0xd7d2ce));var _0x21a2b1=_0x536824[_0x717a('0x7')](_0x4420aa,_0x717a('0x8'),'utf8');_0x21a2b1+=_0x536824['final'](_0x717a('0x9'));var _0x273bb0=JSON[_0x717a('0xa')](_0x21a2b1);return _0x273bb0[_0x717a('0xb')](_0x34cb3f)?_0x273bb0[_0x34cb3f]:null;}}return null;}function isLimit(_0x3e7f56,_0x493077,_0x45eb68,_0x588baf){var _0x2e2e95=_0x493077;return compose()['use'](function(_0x53ed00,_0x50ff81,_0x4a11bb){return db[_0x717a('0xc')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x717a('0xd')](function(_0x4ea5fd){var _0x1eca09=getValueFromLicense(_0x3e7f56,_0x4ea5fd);return _0x1eca09?_0x1eca09:_0x2e2e95;})['then'](function(_0xb85066){_0x2e2e95=_0xb85066;return _0x45eb68[_0x717a('0xe')](_0x588baf);})[_0x717a('0xd')](function(_0x5c396d){if(_0x5c396d>=_0x2e2e95){return _0x50ff81[_0x717a('0xf')](0x193)['json']({'message':util[_0x717a('0x6')](_0x717a('0x10'),_0x3e7f56)});}_0x4a11bb();})[_0x717a('0x11')](function(_0x8b295){_0x4a11bb(_0x8b295);});});}function isUserLimit(){return isLimit(_0x717a('0x12'),0x1,db[_0x717a('0x13')],{'where':{'$or':[{'role':_0x717a('0x14')},{'role':_0x717a('0x15')}]}});}exports[_0x717a('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 85b252b..0e6bf67 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 _0x4faf=['$lte','add','days','format','castTo','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','utcOffset','hours','seconds','moment','parseSearch','sqlOperator','startsWith','[$or]','replace','[$and]','length','slice','split','match','forEach','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt'];(function(_0x2f87cd,_0xcaf299){var _0x5d7eda=function(_0x37ffb0){while(--_0x37ffb0){_0x2f87cd['push'](_0x2f87cd['shift']());}};_0x5d7eda(++_0xcaf299);}(_0x4faf,0x8c));var _0xf4fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4faf[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var moment=require(_0xf4fa('0x0'));exports[_0xf4fa('0x1')]=function(_0x3c59a3){var _0x251be3={'conditions':[]};_0x251be3[_0xf4fa('0x2')]=_[_0xf4fa('0x3')](_0x3c59a3,_0xf4fa('0x4'))?'or':'and';var _0x48ebe8=_0x3c59a3[_0xf4fa('0x5')](_0xf4fa('0x6'),'')['replace']('[$or]','')['split']('||');for(var _0x4a2f3e=0x0;_0x4a2f3e<_0x48ebe8[_0xf4fa('0x7')];_0x4a2f3e++){var _0x87443c=_0x48ebe8[_0x4a2f3e]['split'](':=');var _0x4f550c=_0x87443c[0x0];var _0x3e7671=_0x87443c[_0xf4fa('0x8')](0x1);_0x3e7671['forEach'](function(_0x384ba8){var _0x5a4b31=_0x384ba8[_0xf4fa('0x9')]('[')['shift']();var _0x44b0e2=_0x384ba8[_0xf4fa('0xa')](/\[(.*?)\]/g);_0x44b0e2[_0xf4fa('0xb')](function(_0x2de23c){var _0x4a0d6d=_0x2de23c[_0xf4fa('0x9')]('[')[_0xf4fa('0xc')](function(_0x58844e){return _0x58844e[_0xf4fa('0xd')](']')>-0x1;})[_0xf4fa('0xe')](function(_0xa2cc5b){return _0xa2cc5b[_0xf4fa('0x9')](']')[0x0];})[0x0];_0x251be3[_0xf4fa('0xf')][_0xf4fa('0x10')]({'field':_0x4f550c,'operator':_0x5a4b31,'value':_0x4a0d6d});});});}return _0x251be3;};exports[_0xf4fa('0x11')]=function(_0x363026,_0x15ad09,_0x4a4f3f){var _0x22d51d={};if(_0x15ad09===_0xf4fa('0x12')){if(_0x4a4f3f[_0xf4fa('0x13')]===_0xf4fa('0x14')){_0x4a4f3f[_0xf4fa('0x13')]=_0xf4fa('0x15');_0x4a4f3f[_0xf4fa('0x16')]+=','+_0x4a4f3f['value'];}else if(_[_0xf4fa('0x17')]([_0xf4fa('0x18'),_0xf4fa('0x19')],_0x4a4f3f[_0xf4fa('0x13')])){_0x4a4f3f[_0xf4fa('0x16')]=moment(_0x4a4f3f[_0xf4fa('0x16')])[_0xf4fa('0x1a')](0x1,_0xf4fa('0x1b'))[_0xf4fa('0x1c')]('YYYY-MM-DD');}}if(_0x4a4f3f['castTo']){_0x15ad09=_0x4a4f3f[_0xf4fa('0x1d')];_0x22d51d[_0xf4fa('0x1e')]=_0xf4fa('0x1f')+_0x363026+'.'+_0x4a4f3f[_0xf4fa('0x20')]+_0xf4fa('0x21')+_0x4a4f3f[_0xf4fa('0x1d')]+')\x20'+parseOperator(_0x4a4f3f['operator']);}else{_0x22d51d[_0xf4fa('0x1e')]=_0x363026+'.'+_0x4a4f3f[_0xf4fa('0x20')]+'\x20'+parseOperator(_0x4a4f3f[_0xf4fa('0x13')]);}if(_[_0xf4fa('0x17')]([_0xf4fa('0x22'),_0xf4fa('0x23')],_0x4a4f3f[_0xf4fa('0x13')]))_0x22d51d['text']='('+_0x22d51d['text']+_0xf4fa('0x24')+_0x363026+'.'+_0x4a4f3f[_0xf4fa('0x20')]+_0xf4fa('0x25');_0x22d51d[_0xf4fa('0x16')]=parseValue(_0x15ad09,_0x4a4f3f[_0xf4fa('0x13')],_0x4a4f3f[_0xf4fa('0x16')]);return _0x22d51d;};function parseOperator(_0x28b799){var _0x49411c;switch(_0x28b799){case _0xf4fa('0x26'):_0x49411c=_0xf4fa('0x27');break;case _0xf4fa('0x23'):_0x49411c=_0xf4fa('0x28');break;case _0xf4fa('0x14'):_0x49411c=_0xf4fa('0x29');break;case _0xf4fa('0x22'):_0x49411c='<>\x20?';break;case _0xf4fa('0x2a'):case _0xf4fa('0x2b'):case _0xf4fa('0x2c'):_0x49411c=_0xf4fa('0x2d');break;case _0xf4fa('0x2e'):_0x49411c=_0xf4fa('0x2f');break;case'$gt':_0x49411c=_0xf4fa('0x30');break;case _0xf4fa('0x19'):_0x49411c='<=\x20?';break;case'$gte':_0x49411c='>=\x20?';break;case'$between':_0x49411c=_0xf4fa('0x31');break;}return _0x49411c;}function parseValue(_0x29c976,_0x1e0da5,_0xfe224e){var _0x423b6b={'start':undefined,'end':undefined};switch(_0x1e0da5){case'$in':case _0xf4fa('0x23'):_0x423b6b[_0xf4fa('0x32')]=_0xfe224e[_0xf4fa('0x9')](',');break;case _0xf4fa('0x2a'):_0x423b6b[_0xf4fa('0x32')]='%'+_0xfe224e+'%';break;case _0xf4fa('0x2b'):_0x423b6b[_0xf4fa('0x32')]=_0xfe224e+'%';break;case'$endsWith':_0x423b6b[_0xf4fa('0x32')]='%'+_0xfe224e;break;case'$between':var _0x4e7488=_0xfe224e['split'](',');var _0xfe224e=_0x4e7488[_0xf4fa('0x33')]();var _0x49e8ce=_0x4e7488['pop']();if(_0x29c976===_0xf4fa('0x12')){_0xfe224e=moment(_0xfe224e)[_0xf4fa('0x34')](0x0,!![])[_0xf4fa('0x1c')]();_0x49e8ce=moment(_0x49e8ce)[_0xf4fa('0x34')](0x0,!![])['add'](0x17,_0xf4fa('0x35'))[_0xf4fa('0x1a')](0x3b,'minutes')[_0xf4fa('0x1a')](0x3b,_0xf4fa('0x36'))[_0xf4fa('0x1c')]();}_0x423b6b={'start':_0xfe224e,'end':_0x49e8ce};break;default:_0x423b6b[_0xf4fa('0x32')]=_0xfe224e;break;}return _0x423b6b;} \ No newline at end of file +var _0x22b0=['$lt','<\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$notIn','start','$startsWith','shift','pop','utcOffset','hours','minutes','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','match','forEach','map','push','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','days','format','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$endsWith','LIKE\x20?'];(function(_0x3b7879,_0x268973){var _0x4edb07=function(_0x475c40){while(--_0x475c40){_0x3b7879['push'](_0x3b7879['shift']());}};_0x4edb07(++_0x268973);}(_0x22b0,0x1be));var _0x022b=function(_0x10385f,_0x1f7083){_0x10385f=_0x10385f-0x0;var _0xa48457=_0x22b0[_0x10385f];return _0xa48457;};'use strict';var _=require('lodash');var moment=require('moment');exports['parseSearch']=function(_0x289c6b){var _0x529a0d={'conditions':[]};_0x529a0d[_0x022b('0x0')]=_[_0x022b('0x1')](_0x289c6b,_0x022b('0x2'))?'or':_0x022b('0x3');var _0x2f83ec=_0x289c6b[_0x022b('0x4')](_0x022b('0x5'),'')[_0x022b('0x4')](_0x022b('0x2'),'')[_0x022b('0x6')]('||');for(var _0x1f6c85=0x0;_0x1f6c85<_0x2f83ec[_0x022b('0x7')];_0x1f6c85++){var _0x1f5325=_0x2f83ec[_0x1f6c85][_0x022b('0x6')](':=');var _0x219fd3=_0x1f5325[0x0];var _0x5737cd=_0x1f5325[_0x022b('0x8')](0x1);_0x5737cd['forEach'](function(_0x4b6add){var _0x3f7167=_0x4b6add[_0x022b('0x6')]('[')['shift']();var _0x17de2e=_0x4b6add[_0x022b('0x9')](/\[(.*?)\]/g);_0x17de2e[_0x022b('0xa')](function(_0x477d22){var _0x34bc8a=_0x477d22['split']('[')['filter'](function(_0x413185){return _0x413185['indexOf'](']')>-0x1;})[_0x022b('0xb')](function(_0x540ce0){return _0x540ce0['split'](']')[0x0];})[0x0];_0x529a0d['conditions'][_0x022b('0xc')]({'field':_0x219fd3,'operator':_0x3f7167,'value':_0x34bc8a});});});}return _0x529a0d;};exports['buildExpression']=function(_0xd2cf56,_0x2fcd60,_0x55ba36){var _0x43e36c={};if(_0x2fcd60===_0x022b('0xd')){if(_0x55ba36[_0x022b('0xe')]===_0x022b('0xf')){_0x55ba36[_0x022b('0xe')]=_0x022b('0x10');_0x55ba36[_0x022b('0x11')]+=','+_0x55ba36['value'];}else if(_[_0x022b('0x12')]([_0x022b('0x13'),_0x022b('0x14')],_0x55ba36[_0x022b('0xe')])){_0x55ba36[_0x022b('0x11')]=moment(_0x55ba36[_0x022b('0x11')])[_0x022b('0x15')](0x1,_0x022b('0x16'))[_0x022b('0x17')]('YYYY-MM-DD');}}if(_0x55ba36[_0x022b('0x18')]){_0x2fcd60=_0x55ba36[_0x022b('0x18')];_0x43e36c[_0x022b('0x19')]=_0x022b('0x1a')+_0xd2cf56+'.'+_0x55ba36[_0x022b('0x1b')]+_0x022b('0x1c')+_0x55ba36[_0x022b('0x18')]+')\x20'+parseOperator(_0x55ba36[_0x022b('0xe')]);}else{_0x43e36c[_0x022b('0x19')]=_0xd2cf56+'.'+_0x55ba36['field']+'\x20'+parseOperator(_0x55ba36[_0x022b('0xe')]);}if(_[_0x022b('0x12')]([_0x022b('0x1d'),'$notIn'],_0x55ba36[_0x022b('0xe')]))_0x43e36c['text']='('+_0x43e36c[_0x022b('0x19')]+_0x022b('0x1e')+_0xd2cf56+'.'+_0x55ba36['field']+_0x022b('0x1f');_0x43e36c['value']=parseValue(_0x2fcd60,_0x55ba36[_0x022b('0xe')],_0x55ba36[_0x022b('0x11')]);return _0x43e36c;};function parseOperator(_0x3d4ac4){var _0x2607c2;switch(_0x3d4ac4){case _0x022b('0x20'):_0x2607c2=_0x022b('0x21');break;case'$notIn':_0x2607c2=_0x022b('0x22');break;case _0x022b('0xf'):_0x2607c2=_0x022b('0x23');break;case'$ne':_0x2607c2=_0x022b('0x24');break;case _0x022b('0x25'):case'$startsWith':case _0x022b('0x26'):_0x2607c2=_0x022b('0x27');break;case _0x022b('0x28'):_0x2607c2=_0x022b('0x29');break;case _0x022b('0x13'):_0x2607c2='>\x20?';break;case'$lte':_0x2607c2=_0x022b('0x2a');break;case _0x022b('0x2b'):_0x2607c2=_0x022b('0x2c');break;case'$between':_0x2607c2=_0x022b('0x2d');break;}return _0x2607c2;}function parseValue(_0x273c85,_0x54ac95,_0x5d4a90){var _0x4a091e={'start':undefined,'end':undefined};switch(_0x54ac95){case'$in':case _0x022b('0x2e'):_0x4a091e[_0x022b('0x2f')]=_0x5d4a90[_0x022b('0x6')](',');break;case _0x022b('0x25'):_0x4a091e[_0x022b('0x2f')]='%'+_0x5d4a90+'%';break;case _0x022b('0x30'):_0x4a091e[_0x022b('0x2f')]=_0x5d4a90+'%';break;case _0x022b('0x26'):_0x4a091e[_0x022b('0x2f')]='%'+_0x5d4a90;break;case'$between':var _0x25fa59=_0x5d4a90[_0x022b('0x6')](',');var _0x5d4a90=_0x25fa59[_0x022b('0x31')]();var _0x32150a=_0x25fa59[_0x022b('0x32')]();if(_0x273c85==='DATE'){_0x5d4a90=moment(_0x5d4a90)[_0x022b('0x33')](0x0,!![])[_0x022b('0x17')]();_0x32150a=moment(_0x32150a)[_0x022b('0x33')](0x0,!![])[_0x022b('0x15')](0x17,_0x022b('0x34'))[_0x022b('0x15')](0x3b,_0x022b('0x35'))[_0x022b('0x15')](0x3b,'seconds')['format']();}_0x4a091e={'start':_0x5d4a90,'end':_0x32150a};break;default:_0x4a091e[_0x022b('0x2f')]=_0x5d4a90;break;}return _0x4a091e;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index ef160ce..3726504 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 _0x395c=['$lte','name','uniqueid','isArray','limit','sort','map','indexOf','priority','cast','unsigned','substr','col','omit','isObject','isString','length','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','replace','push','join','$id','query','model','attributes','intersection','nolimit','offset','pick','filter','where','merge','VIRTUAL','lower','options','lodash','sequelize','moment','parse','keys','includes','fields','split','filters','isEmpty','forOwn','find','type','DATE','$gte','format','YYYY-MM-DD','utc'];(function(_0x5d5fc5,_0x1462d0){var _0x303350=function(_0x18a88a){while(--_0x18a88a){_0x5d5fc5['push'](_0x5d5fc5['shift']());}};_0x303350(++_0x1462d0);}(_0x395c,0x14a));var _0xc395=function(_0x54d1be,_0x5c6d93){_0x54d1be=_0x54d1be-0x0;var _0xf9b537=_0x395c[_0x54d1be];return _0xf9b537;};'use strict';var _=require(_0xc395('0x0'));var sequelize=require(_0xc395('0x1'));var moment=require(_0xc395('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4be7fe){var _0x565230=['ne'];try{var _0x3035e0=JSON[_0xc395('0x3')](_0x4be7fe);var _0x50b1a1=Object[_0xc395('0x4')](_0x3035e0)[0x0];return _0x565230[_0xc395('0x5')](_0x50b1a1);}catch(_0x37fba4){return![];}}function getOperatorValue(_0x1cdb44){var _0xe81b63=JSON['parse'](_0x1cdb44);var _0x3c0502=Object[_0xc395('0x4')](_0xe81b63)[0x0];var _0x446d7c=_0xe81b63[_0x3c0502];return{['$'+_0x3c0502]:_0x446d7c};}exports[_0xc395('0x6')]=function(_0x1978c6){var _0x53fe07=null;if(_0x1978c6){_0x53fe07=_0x1978c6[_0xc395('0x7')](',');}return _0x53fe07;};exports[_0xc395('0x8')]=function(_0x272f82,_0x106317){var _0x215abb={};if(!_[_0xc395('0x9')](_0x272f82)){_[_0xc395('0xa')](_0x272f82,function(_0x55e126,_0x1b2ef0){try{if(_0x106317){var _0x13cfe1=_[_0xc395('0xb')](_0x106317,{'name':_0x1b2ef0})||{};if(hasSequelizeOperator(_0x55e126)){_0x215abb[_0x1b2ef0]=getOperatorValue(_0x55e126);}else if(_0x13cfe1[_0xc395('0xc')]===_0xc395('0xd')&&_['isPlainObject'](_0x55e126)){var _0x4d6129=JSON[_0xc395('0x3')](_0x55e126);var _0x5c6690={'$gte':moment(moment(_0x4d6129[_0xc395('0xe')])[_0xc395('0xf')](_0xc395('0x10')))[_0xc395('0x11')]()[_0xc395('0xf')](),'$lte':moment(moment(_0x4d6129[_0xc395('0x12')])[_0xc395('0xf')](_0xc395('0x10')))[_0xc395('0x11')]()['subtract'](0x1,'s')[_0xc395('0xf')]()};_0x215abb[_0x1b2ef0]=_0x5c6690;}else if(_0x13cfe1[_0xc395('0x13')]===_0xc395('0x14')){_0x215abb[_0x1b2ef0]=_0x55e126;}else{_0x215abb[_0x1b2ef0]=_[_0xc395('0x15')](_0x55e126)?_0x55e126:JSON[_0xc395('0x3')](_0x55e126);}}else{_0x215abb[_0x1b2ef0]=_['isArray'](_0x55e126)?_0x55e126:JSON[_0xc395('0x3')](_0x55e126);}}catch(_0x4c3221){_0x215abb[_0x1b2ef0]=_0x55e126[_0xc395('0x7')](',');}});}return _0x215abb;};exports[_0xc395('0x16')]=function(_0x5e9d20){_0x5e9d20=parseInt(_0x5e9d20,0xa);if(!_0x5e9d20||_0x5e9d20<0x0){_0x5e9d20=LIMIT_VALUE;}return _0x5e9d20;};exports['offset']=function(_0x6fc515){_0x6fc515=parseInt(_0x6fc515,0xa);if(!_0x6fc515||_0x6fc515<0x0){_0x6fc515=0x0;}return _0x6fc515;};exports[_0xc395('0x17')]=function(_0x4ee493){var _0x2303c0,_0x22e32f=null;if(_0x4ee493){_0x2303c0=_0x4ee493[_0xc395('0x7')](',');_0x22e32f=_[_0xc395('0x18')](_0x2303c0,function(_0x38282b){if(_0x38282b[_0xc395('0x19')]('-')===0x0){return[_0x38282b===_0xc395('0x1a')?sequelize[_0xc395('0x1b')](sequelize['col'](_0xc395('0x1a')),_0xc395('0x1c')):_0x38282b[_0xc395('0x1d')](0x1),'DESC'];}else{return[_0x38282b===_0xc395('0x1a')?sequelize[_0xc395('0x1b')](sequelize[_0xc395('0x1e')]('priority'),'unsigned'):_0x38282b,'ASC'];}});}return _0x22e32f;};exports[_0xc395('0x1f')]=function(_0x315e4c,_0x55c58c){if(_[_0xc395('0x9')](_0x315e4c)){return _0x315e4c;}if(_[_0xc395('0x15')](_0x315e4c)){for(var _0x3a0949=0x0;_0x3a0949<_0x315e4c['length'];_0x3a0949+=0x1){_0x315e4c[_0x3a0949]=this[_0xc395('0x1f')](_0x315e4c[_0x3a0949],_0x55c58c);}return _0x315e4c;}if(!_[_0xc395('0x20')](_0x315e4c)){return _0x315e4c;}if(_[_0xc395('0x21')](_0x55c58c)){_0x55c58c=[_0x55c58c];}if(!_['isArray'](_0x55c58c)){return _0x315e4c;}for(var _0x51d47e=0x0;_0x51d47e<_0x55c58c[_0xc395('0x22')];_0x51d47e+=0x1){_[_0xc395('0x23')](_0x315e4c,_0x55c58c[_0x51d47e]);}for(var _0x339ef6 in _0x315e4c){if(_0x315e4c[_0xc395('0x24')](_0x339ef6)){_0x315e4c[_0x339ef6]=this[_0xc395('0x1f')](_0x315e4c[_0x339ef6],_0x55c58c);}}return _0x315e4c;};exports[_0xc395('0x25')]=function(_0x1ced88){return _0x1ced88[_0xc395('0x26')](RegExp(_0xc395('0x27')))?!![]:![];};exports['isEmail']=function(_0x204eeb){return _0x204eeb['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xc395('0x28')]=function(_0x397036){var _0x30ac58=[];_0x397036['split'](/[ ,]+/)['forEach'](function(_0x8fe042){_0x8fe042=_0x8fe042[_0xc395('0x29')](/([^:]")"+/g,'$1');_0x8fe042='+'+_0x8fe042+'*';if(_0x8fe042['includes']('@'))_0x8fe042='\x22'+_0x8fe042+'\x22';_0x30ac58[_0xc395('0x2a')](_0x8fe042);});return _0x30ac58[_0xc395('0x2b')]('\x20');};exports['getOptions']=function(_0x55eee9,_0x95a2d4,_0x1f4ec9){var _0x506e83={},_0xac992b={};if(_0x95a2d4['query'][_0xc395('0x2c')]){_0x95a2d4[_0xc395('0x2d')]['id']=_0x95a2d4[_0xc395('0x2d')][_0xc395('0x2c')];delete _0x95a2d4[_0xc395('0x2d')][_0xc395('0x2c')];}_0x506e83[_0xc395('0x2e')]=_[_0xc395('0x18')](_0x55eee9,_0xc395('0x13'));_0x506e83[_0xc395('0x2d')]=_[_0xc395('0x4')](_0x95a2d4[_0xc395('0x2d')]);_0x506e83[_0xc395('0x8')]=_['intersection'](_0x506e83[_0xc395('0x2e')],_0x506e83[_0xc395('0x2d')]);_0xac992b[_0xc395('0x2f')]=_[_0xc395('0x30')](_0x506e83['model'],this[_0xc395('0x6')](_0x95a2d4['query'][_0xc395('0x6')]));_0xac992b[_0xc395('0x2f')]=_0xac992b[_0xc395('0x2f')]['length']?_0xac992b[_0xc395('0x2f')]:_0x506e83[_0xc395('0x2e')];if(!_0x95a2d4['query'][_0xc395('0x24')](_0xc395('0x31'))){_0xac992b['limit']=this[_0xc395('0x16')](_0x95a2d4['query'][_0xc395('0x16')]);_0xac992b[_0xc395('0x32')]=this[_0xc395('0x32')](_0x95a2d4['query'][_0xc395('0x32')]);}_0xac992b['order']=this[_0xc395('0x17')](_0x95a2d4[_0xc395('0x2d')][_0xc395('0x17')]);_0xac992b['where']=this[_0xc395('0x8')](_[_0xc395('0x33')](_0x95a2d4[_0xc395('0x2d')],_0x506e83[_0xc395('0x8')]),_0x55eee9);if(_0x95a2d4[_0xc395('0x2d')][_0xc395('0x34')]){_0xac992b[_0xc395('0x35')]=_[_0xc395('0x36')](_0xac992b[_0xc395('0x35')],{'$or':_['map'](_0x55eee9,function(_0x1b8330){if(_0x1b8330[_0xc395('0xc')]!==_0xc395('0x37')){if(_0x1f4ec9){return sequelize[_0xc395('0x35')](sequelize['fn'](_0xc395('0x38'),sequelize[_0xc395('0x1e')](_0x1b8330['name'])),{'$like':sequelize['fn'](_0xc395('0x38'),'%'+_0x95a2d4[_0xc395('0x2d')]['filter']+'%')});}else{var _0xb82f31={};_0xb82f31[_0x1b8330[_0xc395('0x13')]]={'$like':'%'+_0x95a2d4[_0xc395('0x2d')][_0xc395('0x34')]+'%'};return _0xb82f31;}}})});}_0xac992b=_['merge']({},_0xac992b,_0x95a2d4[_0xc395('0x39')]);return _0xac992b;}; \ No newline at end of file +var _0x0019=['format','YYYY-MM-DD','utc','$lte','isArray','limit','offset','map','indexOf','priority','col','unsigned','substr','DESC','ASC','omit','length','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','forEach','replace','push','getOptions','query','$id','model','intersection','fields','attributes','sort','pick','filter','where','merge','type','VIRTUAL','lower','name','options','sequelize','parse','keys','includes','split','filters','isEmpty','forOwn','find','DATE','isPlainObject','$gte'];(function(_0x1f7046,_0x1d8271){var _0x2b2c3e=function(_0x49aa64){while(--_0x49aa64){_0x1f7046['push'](_0x1f7046['shift']());}};_0x2b2c3e(++_0x1d8271);}(_0x0019,0xd4));var _0x9001=function(_0x462999,_0x24d200){_0x462999=_0x462999-0x0;var _0x4b1366=_0x0019[_0x462999];return _0x4b1366;};'use strict';var _=require('lodash');var sequelize=require(_0x9001('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x52c88d){var _0xe3628f=['ne'];try{var _0x10890b=JSON[_0x9001('0x1')](_0x52c88d);var _0x429278=Object[_0x9001('0x2')](_0x10890b)[0x0];return _0xe3628f[_0x9001('0x3')](_0x429278);}catch(_0x24160b){return![];}}function getOperatorValue(_0x217697){var _0x2d0621=JSON[_0x9001('0x1')](_0x217697);var _0x364860=Object[_0x9001('0x2')](_0x2d0621)[0x0];var _0x38fb76=_0x2d0621[_0x364860];return{['$'+_0x364860]:_0x38fb76};}exports['fields']=function(_0x45f6e8){var _0x2722e1=null;if(_0x45f6e8){_0x2722e1=_0x45f6e8[_0x9001('0x4')](',');}return _0x2722e1;};exports[_0x9001('0x5')]=function(_0x5c8d08,_0x2ab5d4){var _0x5a11ed={};if(!_[_0x9001('0x6')](_0x5c8d08)){_[_0x9001('0x7')](_0x5c8d08,function(_0x3973ef,_0xf71812){try{if(_0x2ab5d4){var _0x4cfa7f=_[_0x9001('0x8')](_0x2ab5d4,{'name':_0xf71812})||{};if(hasSequelizeOperator(_0x3973ef)){_0x5a11ed[_0xf71812]=getOperatorValue(_0x3973ef);}else if(_0x4cfa7f['type']===_0x9001('0x9')&&_[_0x9001('0xa')](_0x3973ef)){var _0x5edb91=JSON[_0x9001('0x1')](_0x3973ef);var _0x17d810={'$gte':moment(moment(_0x5edb91[_0x9001('0xb')])[_0x9001('0xc')](_0x9001('0xd')))[_0x9001('0xe')]()[_0x9001('0xc')](),'$lte':moment(moment(_0x5edb91[_0x9001('0xf')])[_0x9001('0xc')]('YYYY-MM-DD'))[_0x9001('0xe')]()['subtract'](0x1,'s')[_0x9001('0xc')]()};_0x5a11ed[_0xf71812]=_0x17d810;}else if(_0x4cfa7f['name']==='uniqueid'){_0x5a11ed[_0xf71812]=_0x3973ef;}else{_0x5a11ed[_0xf71812]=_[_0x9001('0x10')](_0x3973ef)?_0x3973ef:JSON[_0x9001('0x1')](_0x3973ef);}}else{_0x5a11ed[_0xf71812]=_[_0x9001('0x10')](_0x3973ef)?_0x3973ef:JSON[_0x9001('0x1')](_0x3973ef);}}catch(_0x594df4){_0x5a11ed[_0xf71812]=_0x3973ef['split'](',');}});}return _0x5a11ed;};exports[_0x9001('0x11')]=function(_0x1087f9){_0x1087f9=parseInt(_0x1087f9,0xa);if(!_0x1087f9||_0x1087f9<0x0){_0x1087f9=LIMIT_VALUE;}return _0x1087f9;};exports[_0x9001('0x12')]=function(_0x1a47c3){_0x1a47c3=parseInt(_0x1a47c3,0xa);if(!_0x1a47c3||_0x1a47c3<0x0){_0x1a47c3=0x0;}return _0x1a47c3;};exports['sort']=function(_0x37073b){var _0x40b5c9,_0x4d1fdb=null;if(_0x37073b){_0x40b5c9=_0x37073b['split'](',');_0x4d1fdb=_[_0x9001('0x13')](_0x40b5c9,function(_0x4bb5d1){if(_0x4bb5d1[_0x9001('0x14')]('-')===0x0){return[_0x4bb5d1===_0x9001('0x15')?sequelize['cast'](sequelize[_0x9001('0x16')]('priority'),_0x9001('0x17')):_0x4bb5d1[_0x9001('0x18')](0x1),_0x9001('0x19')];}else{return[_0x4bb5d1===_0x9001('0x15')?sequelize['cast'](sequelize['col'](_0x9001('0x15')),'unsigned'):_0x4bb5d1,_0x9001('0x1a')];}});}return _0x4d1fdb;};exports[_0x9001('0x1b')]=function(_0x446ef8,_0x2398af){if(_[_0x9001('0x6')](_0x446ef8)){return _0x446ef8;}if(_[_0x9001('0x10')](_0x446ef8)){for(var _0x4bb233=0x0;_0x4bb233<_0x446ef8[_0x9001('0x1c')];_0x4bb233+=0x1){_0x446ef8[_0x4bb233]=this[_0x9001('0x1b')](_0x446ef8[_0x4bb233],_0x2398af);}return _0x446ef8;}if(!_[_0x9001('0x1d')](_0x446ef8)){return _0x446ef8;}if(_[_0x9001('0x1e')](_0x2398af)){_0x2398af=[_0x2398af];}if(!_[_0x9001('0x10')](_0x2398af)){return _0x446ef8;}for(var _0xcd60b4=0x0;_0xcd60b4<_0x2398af[_0x9001('0x1c')];_0xcd60b4+=0x1){_['unset'](_0x446ef8,_0x2398af[_0xcd60b4]);}for(var _0x2b096b in _0x446ef8){if(_0x446ef8[_0x9001('0x1f')](_0x2b096b)){_0x446ef8[_0x2b096b]=this[_0x9001('0x1b')](_0x446ef8[_0x2b096b],_0x2398af);}}return _0x446ef8;};exports[_0x9001('0x20')]=function(_0x5c14ee){return _0x5c14ee[_0x9001('0x21')](RegExp(_0x9001('0x22')))?!![]:![];};exports[_0x9001('0x23')]=function(_0x46736b){return _0x46736b[_0x9001('0x21')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x321ed8){var _0x28f9b9=[];_0x321ed8[_0x9001('0x4')](/[ ,]+/)[_0x9001('0x24')](function(_0x564f49){_0x564f49=_0x564f49[_0x9001('0x25')](/([^:]")"+/g,'$1');_0x564f49='+'+_0x564f49+'*';if(_0x564f49['includes']('@'))_0x564f49='\x22'+_0x564f49+'\x22';_0x28f9b9[_0x9001('0x26')](_0x564f49);});return _0x28f9b9['join']('\x20');};exports[_0x9001('0x27')]=function(_0x2f4a30,_0x222d8f,_0x562cfb){var _0x12d243={},_0x25437d={};if(_0x222d8f[_0x9001('0x28')][_0x9001('0x29')]){_0x222d8f[_0x9001('0x28')]['id']=_0x222d8f[_0x9001('0x28')][_0x9001('0x29')];delete _0x222d8f[_0x9001('0x28')]['$id'];}_0x12d243[_0x9001('0x2a')]=_[_0x9001('0x13')](_0x2f4a30,'name');_0x12d243[_0x9001('0x28')]=_[_0x9001('0x2')](_0x222d8f['query']);_0x12d243[_0x9001('0x5')]=_[_0x9001('0x2b')](_0x12d243[_0x9001('0x2a')],_0x12d243[_0x9001('0x28')]);_0x25437d['attributes']=_['intersection'](_0x12d243['model'],this[_0x9001('0x2c')](_0x222d8f['query'][_0x9001('0x2c')]));_0x25437d[_0x9001('0x2d')]=_0x25437d['attributes']['length']?_0x25437d['attributes']:_0x12d243['model'];if(!_0x222d8f['query'][_0x9001('0x1f')]('nolimit')){_0x25437d['limit']=this['limit'](_0x222d8f['query'][_0x9001('0x11')]);_0x25437d[_0x9001('0x12')]=this['offset'](_0x222d8f[_0x9001('0x28')][_0x9001('0x12')]);}_0x25437d['order']=this[_0x9001('0x2e')](_0x222d8f['query'][_0x9001('0x2e')]);_0x25437d['where']=this[_0x9001('0x5')](_[_0x9001('0x2f')](_0x222d8f[_0x9001('0x28')],_0x12d243['filters']),_0x2f4a30);if(_0x222d8f[_0x9001('0x28')][_0x9001('0x30')]){_0x25437d[_0x9001('0x31')]=_[_0x9001('0x32')](_0x25437d[_0x9001('0x31')],{'$or':_['map'](_0x2f4a30,function(_0x3c2412){if(_0x3c2412[_0x9001('0x33')]!==_0x9001('0x34')){if(_0x562cfb){return sequelize[_0x9001('0x31')](sequelize['fn'](_0x9001('0x35'),sequelize[_0x9001('0x16')](_0x3c2412[_0x9001('0x36')])),{'$like':sequelize['fn'](_0x9001('0x35'),'%'+_0x222d8f[_0x9001('0x28')][_0x9001('0x30')]+'%')});}else{var _0x4b5024={};_0x4b5024[_0x3c2412[_0x9001('0x36')]]={'$like':'%'+_0x222d8f[_0x9001('0x28')][_0x9001('0x30')]+'%'};return _0x4b5024;}}})});}_0x25437d=_[_0x9001('0x32')]({},_0x25437d,_0x222d8f[_0x9001('0x37')]);return _0x25437d;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 2debcb9..15e2a0f 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe17b=['cors','./environment','../mysqldb','default','get','production','appPath','root','public','development','test','set','join','client','use','json\x20replacer','split','static','views','/server/views','engine','ejs','renderFile','view\x20engine','urlencoded','50mb','json','initialize','express','serve-favicon','body-parser','method-override','cookie-parser','passport'];(function(_0x2a7b50,_0x545d55){var _0x4224c9=function(_0x2b96f6){while(--_0x2b96f6){_0x2a7b50['push'](_0x2a7b50['shift']());}};_0x4224c9(++_0x545d55);}(_0xe17b,0x12c));var _0xbe17=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe17b[_0x167cc1];return _0x10bc4b;};'use strict';var express=require(_0xbe17('0x0'));var favicon=require(_0xbe17('0x1'));var bodyParser=require(_0xbe17('0x2'));var methodOverride=require(_0xbe17('0x3'));var cookieParser=require(_0xbe17('0x4'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0xbe17('0x5'));var cors=require(_0xbe17('0x6'));var moment=require('moment');var config=require(_0xbe17('0x7'));var db=require(_0xbe17('0x8'))['db'];exports[_0xbe17('0x9')]=function(_0x3f4eb7){var _0x3569b7=_0x3f4eb7[_0xbe17('0xa')]('env');if(_0x3569b7===_0xbe17('0xb')){_0x3f4eb7['set'](_0xbe17('0xc'),path['join'](config[_0xbe17('0xd')],_0xbe17('0xe')));}if(_0x3569b7===_0xbe17('0xf')||_0x3569b7===_0xbe17('0x10')){_0x3f4eb7[_0xbe17('0x11')]('appPath',path[_0xbe17('0x12')](config[_0xbe17('0xd')],_0xbe17('0x13')));_0x3f4eb7[_0xbe17('0x14')](errorHandler());}_0x3f4eb7['set'](_0xbe17('0x15'),function(_0xabaa82,_0x49e75d){if(this[_0xabaa82]instanceof Date){_0x49e75d=this[_0xabaa82]['toISOString']()[_0xbe17('0x16')]('.')[0x0]+'Z';}return _0x49e75d;});_0x3f4eb7['use'](express[_0xbe17('0x17')](_0x3f4eb7['get']('appPath')));_0x3f4eb7[_0xbe17('0x11')](_0xbe17('0x18'),config[_0xbe17('0xd')]+_0xbe17('0x19'));_0x3f4eb7[_0xbe17('0x1a')]('html',require(_0xbe17('0x1b'))[_0xbe17('0x1c')]);_0x3f4eb7[_0xbe17('0x11')](_0xbe17('0x1d'),'html');_0x3f4eb7[_0xbe17('0x14')](bodyParser[_0xbe17('0x1e')]({'limit':_0xbe17('0x1f'),'extended':!![]}));_0x3f4eb7['use'](bodyParser[_0xbe17('0x20')]({'limit':'50mb'}));_0x3f4eb7[_0xbe17('0x14')](cors());_0x3f4eb7['use'](methodOverride());_0x3f4eb7[_0xbe17('0x14')](cookieParser());_0x3f4eb7['use'](passport[_0xbe17('0x21')]());}; \ No newline at end of file +var _0x71d8=['urlencoded','50mb','json','initialize','express','body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','moment','../mysqldb','default','get','env','production','set','appPath','join','public','development','test','root','client','split','use','static','views','/server/views','engine','html','ejs','view\x20engine'];(function(_0x28d427,_0x3d2187){var _0x12f7e5=function(_0x32f366){while(--_0x32f366){_0x28d427['push'](_0x28d427['shift']());}};_0x12f7e5(++_0x3d2187);}(_0x71d8,0xd6));var _0x871d=function(_0x46e88b,_0x1c29c0){_0x46e88b=_0x46e88b-0x0;var _0x5a9ea4=_0x71d8[_0x46e88b];return _0x5a9ea4;};'use strict';var express=require(_0x871d('0x0'));var favicon=require('serve-favicon');var bodyParser=require(_0x871d('0x1'));var methodOverride=require(_0x871d('0x2'));var cookieParser=require(_0x871d('0x3'));var errorHandler=require(_0x871d('0x4'));var path=require(_0x871d('0x5'));var passport=require(_0x871d('0x6'));var cors=require(_0x871d('0x7'));var moment=require(_0x871d('0x8'));var config=require('./environment');var db=require(_0x871d('0x9'))['db'];exports[_0x871d('0xa')]=function(_0x585527){var _0xe0ee04=_0x585527[_0x871d('0xb')](_0x871d('0xc'));if(_0xe0ee04===_0x871d('0xd')){_0x585527[_0x871d('0xe')](_0x871d('0xf'),path[_0x871d('0x10')](config['root'],_0x871d('0x11')));}if(_0xe0ee04===_0x871d('0x12')||_0xe0ee04===_0x871d('0x13')){_0x585527['set'](_0x871d('0xf'),path[_0x871d('0x10')](config[_0x871d('0x14')],_0x871d('0x15')));_0x585527['use'](errorHandler());}_0x585527[_0x871d('0xe')]('json\x20replacer',function(_0xbec97d,_0x416f63){if(this[_0xbec97d]instanceof Date){_0x416f63=this[_0xbec97d]['toISOString']()[_0x871d('0x16')]('.')[0x0]+'Z';}return _0x416f63;});_0x585527[_0x871d('0x17')](express[_0x871d('0x18')](_0x585527['get'](_0x871d('0xf'))));_0x585527['set'](_0x871d('0x19'),config[_0x871d('0x14')]+_0x871d('0x1a'));_0x585527[_0x871d('0x1b')](_0x871d('0x1c'),require(_0x871d('0x1d'))['renderFile']);_0x585527[_0x871d('0xe')](_0x871d('0x1e'),_0x871d('0x1c'));_0x585527[_0x871d('0x17')](bodyParser[_0x871d('0x1f')]({'limit':_0x871d('0x20'),'extended':!![]}));_0x585527['use'](bodyParser[_0x871d('0x21')]({'limit':'50mb'}));_0x585527[_0x871d('0x17')](cors());_0x585527[_0x871d('0x17')](methodOverride());_0x585527['use'](cookieParser());_0x585527[_0x871d('0x17')](passport[_0x871d('0x22')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index a6d2588..1ee61b1 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 _0x8448=['address','127.0.0.1','map','join','createHash','update','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','md5','digest','substring','lodash','child_process','execSync','../environment','networkInterfaces','orderBy','length','family','IPv4','concat','head','mac'];(function(_0x388381,_0x498e4f){var _0x2da42e=function(_0x169149){while(--_0x169149){_0x388381['push'](_0x388381['shift']());}};_0x2da42e(++_0x498e4f);}(_0x8448,0xa8));var _0x8844=function(_0x2468b5,_0x506b9e){_0x2468b5=_0x2468b5-0x0;var _0x1056e4=_0x8448[_0x2468b5];return _0x1056e4;};'use strict';var _=require(_0x8844('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0x8844('0x1'))[_0x8844('0x2')];var config=require(_0x8844('0x3'));function getInterfaces(){var _0x227e81=[];var _0x28a92b=os[_0x8844('0x4')]();var _0x40cd71=_[_0x8844('0x5')](_['keys'](_0x28a92b));for(var _0x1d9a55=0x0;_0x1d9a55<_0x40cd71[_0x8844('0x6')];_0x1d9a55++){var _0x27360a=_0x28a92b[_0x40cd71[_0x1d9a55]]['filter'](function(_0x3e55cf){return _0x3e55cf[_0x8844('0x7')]===_0x8844('0x8')&&_0x3e55cf['internal']===![];});_0x227e81=_0x227e81[_0x8844('0x9')](_0x27360a);}return _0x227e81;}function getFirstInterface(){var _0x4b5e66=_[_0x8844('0xa')](getInterfaces());return{'macAddress':_0x4b5e66&&_0x4b5e66['mac']?_0x4b5e66[_0x8844('0xb')]:'00:00:00:00:00:00','ipAddress':_0x4b5e66&&_0x4b5e66[_0x8844('0xc')]?_0x4b5e66[_0x8844('0xc')]:_0x8844('0xd')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0xf1184a=_[_0x8844('0x5')](os['cpus']()[_0x8844('0xe')](function(_0x39f97f){return _0x39f97f['model'];}))[_0x8844('0xf')](':');return crypto[_0x8844('0x10')]('md5')[_0x8844('0x11')](_0xf1184a)['digest']('hex');}exports[_0x8844('0x12')]=function(){var _0x28c4d0=os[_0x8844('0x13')]();var _0x19792f=/[0-9a-f-]{36}/;if(config[_0x8844('0x14')]&&_0x19792f[_0x8844('0x15')](config[_0x8844('0x14')])){return config[_0x8844('0x14')];}else if(_0x28c4d0===_0x8844('0x16')){return exec(_0x8844('0x17'),{'encoding':_0x8844('0x18')})['replace']('\x0d\x0a','');}else{var _0x1731e0=getFirstInterface();var _0x4e8bdc=getCPUhash();var _0x306d3a=_0x4e8bdc+'|'+os[_0x8844('0x19')]()+'|'+_0x1731e0[_0x8844('0x1a')]+'|'+_0x1731e0['ipAddress'];var _0x1df35b=crypto[_0x8844('0x10')](_0x8844('0x1b'))[_0x8844('0x11')](_0x306d3a)[_0x8844('0x1c')]('hex');return _0x1df35b[_0x8844('0x1d')](0x0,0x8)+'-'+_0x1df35b[_0x8844('0x1d')](0x8,0xc)+'-'+_0x1df35b[_0x8844('0x1d')](0xc,0x10)+'-'+_0x1df35b[_0x8844('0x1d')](0x10,0x14)+'-'+_0x1df35b['substring'](0x14);}}; \ No newline at end of file +var _0x3c96=['getUuid','licenseToken','win32','dmidecode\x20--string\x20system-uuid','replace','ipAddress','update','hex','substring','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','family','IPv4','internal','head','mac','address','127.0.0.1','getFirstInterface','cpus','map','model','md5','digest'];(function(_0x23b798,_0x5b33af){var _0x33f0e4=function(_0x2897ae){while(--_0x2897ae){_0x23b798['push'](_0x23b798['shift']());}};_0x33f0e4(++_0x5b33af);}(_0x3c96,0x66));var _0x63c9=function(_0x51071a,_0x28e1bd){_0x51071a=_0x51071a-0x0;var _0x331ad7=_0x3c96[_0x51071a];return _0x331ad7;};'use strict';var _=require('lodash');var os=require('os');var crypto=require(_0x63c9('0x0'));var machine=require(_0x63c9('0x1'));var exec=require(_0x63c9('0x2'))[_0x63c9('0x3')];var config=require(_0x63c9('0x4'));function getInterfaces(){var _0x57eee4=[];var _0x5bc9b3=os[_0x63c9('0x5')]();var _0x58e838=_[_0x63c9('0x6')](_[_0x63c9('0x7')](_0x5bc9b3));for(var _0x1dc942=0x0;_0x1dc942<_0x58e838[_0x63c9('0x8')];_0x1dc942++){var _0x353838=_0x5bc9b3[_0x58e838[_0x1dc942]]['filter'](function(_0x105ec0){return _0x105ec0[_0x63c9('0x9')]===_0x63c9('0xa')&&_0x105ec0[_0x63c9('0xb')]===![];});_0x57eee4=_0x57eee4['concat'](_0x353838);}return _0x57eee4;}function getFirstInterface(){var _0x136d8e=_[_0x63c9('0xc')](getInterfaces());return{'macAddress':_0x136d8e&&_0x136d8e[_0x63c9('0xd')]?_0x136d8e[_0x63c9('0xd')]:'00:00:00:00:00:00','ipAddress':_0x136d8e&&_0x136d8e[_0x63c9('0xe')]?_0x136d8e['address']:_0x63c9('0xf')};}exports[_0x63c9('0x10')]=getFirstInterface;function getCPUhash(){var _0x5a0186=_[_0x63c9('0x6')](os[_0x63c9('0x11')]()[_0x63c9('0x12')](function(_0x32c3d9){return _0x32c3d9[_0x63c9('0x13')];}))['join'](':');return crypto['createHash'](_0x63c9('0x14'))['update'](_0x5a0186)[_0x63c9('0x15')]('hex');}exports[_0x63c9('0x16')]=function(){var _0x59f0ae=os['platform']();var _0x4b1da8=/[0-9a-f-]{36}/;if(config[_0x63c9('0x17')]&&_0x4b1da8['test'](config['licenseToken'])){return config[_0x63c9('0x17')];}else if(_0x59f0ae===_0x63c9('0x18')){return exec(_0x63c9('0x19'),{'encoding':'utf8'})[_0x63c9('0x1a')]('\x0d\x0a','');}else{var _0x29563c=getFirstInterface();var _0xa9d017=getCPUhash();var _0x238df4=_0xa9d017+'|'+os['hostname']()+'|'+_0x29563c['macAddress']+'|'+_0x29563c[_0x63c9('0x1b')];var _0x2cc648=crypto['createHash'](_0x63c9('0x14'))[_0x63c9('0x1c')](_0x238df4)[_0x63c9('0x15')](_0x63c9('0x1d'));return _0x2cc648['substring'](0x0,0x8)+'-'+_0x2cc648[_0x63c9('0x1e')](0x8,0xc)+'-'+_0x2cc648[_0x63c9('0x1e')](0xc,0x10)+'-'+_0x2cc648[_0x63c9('0x1e')](0x10,0x14)+'-'+_0x2cc648[_0x63c9('0x1e')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 249472f..aed71af 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 _0xec76=['request-promise','pkginfo','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','get','data1','data2','then','active','info','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','error','message','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment'];(function(_0x1ad20c,_0x2483e3){var _0x5603f0=function(_0x3048b0){while(--_0x3048b0){_0x1ad20c['push'](_0x1ad20c['shift']());}};_0x5603f0(++_0x2483e3);}(_0xec76,0x96));var _0x6ec7=function(_0x7cce00,_0xcd20a6){_0x7cce00=_0x7cce00-0x0;var _0x30f6b0=_0xec76[_0x7cce00];return _0x30f6b0;};'use strict';var util=require(_0x6ec7('0x0'));var moment=require(_0x6ec7('0x1'));var rp=require(_0x6ec7('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x6ec7('0x3'))(module,'version');var db=require(_0x6ec7('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x6ec7('0x5'));var logger=require(_0x6ec7('0x6'))(_0x6ec7('0x7'));var HOST=_0x6ec7('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x41372f){return new BPromise(function(_0x49c466,_0x24dcce){var _0x470d20=util[_0x6ec7('0x9')]('%s/api/servers/%s/check?version=%s',HOST,_0x41372f,module[_0x6ec7('0xa')][_0x6ec7('0xb')]);if(oldToken){_0x470d20=util[_0x6ec7('0x9')](_0x6ec7('0xc'),HOST,_0x41372f,module['exports']['version'],oldToken);}var _0xf267aa={'uri':_0x470d20,'method':_0x6ec7('0xd'),'timeout':0xea60,'json':!![]};return rp(_0xf267aa)['then'](function(_0x21438f){_0x49c466(_0x21438f);})[_0x6ec7('0xe')](function(_0x45046a){_0x24dcce(_0x45046a);});});}function manageLicense(_0x1ee863,_0x4944d3){var _0x13085b=_0x4944d3[_0x6ec7('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x13085b[_0x6ec7('0x10')]!==_0x1ee863&&!_0x13085b[_0x6ec7('0x11')]){oldToken=_0x13085b[_0x6ec7('0x10')];}httpRequest(_0x1ee863)[_0x6ec7('0x12')](function(_0x2f7424){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2f7424[_0x6ec7('0x13')]){isOldTokenSent=![];if(!_0x13085b[_0x6ec7('0x7')]&&_0x13085b['license']!=_0x2f7424[_0x6ec7('0x7')]||_0x13085b[_0x6ec7('0x7')]&&_0x13085b['data2']){logger[_0x6ec7('0x14')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x13085b[_0x6ec7('0x7')]&&!_0x13085b[_0x6ec7('0x11')]&&_0x13085b['license']!=_0x2f7424[_0x6ec7('0x7')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x13085b[_0x6ec7('0x7')]&&!_0x13085b[_0x6ec7('0x11')]&&_0x13085b[_0x6ec7('0x7')]==_0x2f7424['license']){return _0x4944d3;}return _0x4944d3[_0x6ec7('0x15')]({'data1':_0x1ee863,'data2':null,'license':_0x2f7424[_0x6ec7('0x7')]});}else{if(_0x2f7424[_0x6ec7('0x7')]||_0x13085b[_0x6ec7('0x7')]){if(!_0x13085b[_0x6ec7('0x11')]){if(_0x13085b[_0x6ec7('0x10')]==_0x1ee863){GRAY_PERIOD_REASON=_0x6ec7('0x16');logger[_0x6ec7('0x14')](_0x6ec7('0x17'));}else{GRAY_PERIOD_REASON=_0x6ec7('0x18');logger[_0x6ec7('0x14')](_0x6ec7('0x19'),_0x13085b['data1'],_0x1ee863);}logger[_0x6ec7('0x14')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0x6ec7('0x9')](_0x6ec7('0x1a')));return _0x4944d3[_0x6ec7('0x15')]({'data2':encryptor[_0x6ec7('0x1b')](moment()[_0x6ec7('0x9')](_0x6ec7('0x1a')))});}else{if(moment()[_0x6ec7('0x1c')](encryptor[_0x6ec7('0x1d')](_0x13085b[_0x6ec7('0x11')]),'days')>DAYS){logger[_0x6ec7('0x14')]('DEMO\x20START\x20AT\x20%s',moment()[_0x6ec7('0x9')](_0x6ec7('0x1a')));isOldTokenSent=![];return _0x4944d3[_0x6ec7('0x15')]({'data1':_0x1ee863,'data2':null,'license':null});}}}else{if(_0x13085b[_0x6ec7('0x10')]!=_0x1ee863){logger['info'](_0x6ec7('0x19'),_0x13085b[_0x6ec7('0x10')],_0x1ee863);return _0x4944d3[_0x6ec7('0x15')]({'data1':_0x1ee863,'data2':null,'license':null});}}}return _0x4944d3;})[_0x6ec7('0x12')](function(_0x20f349){_0x4944d3=_0x20f349;})[_0x6ec7('0xe')](function(_0x4a7e6f){logger[_0x6ec7('0x1e')](_0x4a7e6f[_0x6ec7('0x1f')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x6ec7('0x20')](),_0x4944d3);},TIME);});}function defaultLicense(){var _0x196d7a=hardware[_0x6ec7('0x20')]();if(_0x196d7a){return db[_0x6ec7('0x21')][_0x6ec7('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x196d7a}})[_0x6ec7('0x23')](function(_0x5f4b79,_0x1d4c53){logger[_0x6ec7('0x14')](_0x6ec7('0x24'),_0x196d7a);manageLicense(_0x196d7a,_0x5f4b79);})['catch'](function(_0x194e16){logger[_0x6ec7('0x1e')](_0x194e16[_0x6ec7('0x1f')]);});}}exports[_0x6ec7('0x25')]=defaultLicense; \ No newline at end of file +var _0x155e=['update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','encryptString','format','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','license','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','exports','GET','catch','data1','data2','then','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED'];(function(_0x2986fb,_0x9482a0){var _0xb3c156=function(_0x3fbe75){while(--_0x3fbe75){_0x2986fb['push'](_0x2986fb['shift']());}};_0xb3c156(++_0x9482a0);}(_0x155e,0x174));var _0xe155=function(_0x20b966,_0x1cf3ad){_0x20b966=_0x20b966-0x0;var _0x14b006=_0x155e[_0x20b966];return _0x14b006;};'use strict';var util=require('util');var moment=require('moment');var rp=require(_0xe155('0x0'));var BPromise=require(_0xe155('0x1'));var pkginfo=require(_0xe155('0x2'))(module,_0xe155('0x3'));var db=require(_0xe155('0x4'))['db'];var encryptor=require(_0xe155('0x5'));var hardware=require('./hardware');var logger=require(_0xe155('0x6'))(_0xe155('0x7'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x53f72d){return new BPromise(function(_0xa4b331,_0x2925bd){var _0x2b296b=util['format'](_0xe155('0x8'),HOST,_0x53f72d,module['exports'][_0xe155('0x3')]);if(oldToken){_0x2b296b=util['format'](_0xe155('0x9'),HOST,_0x53f72d,module[_0xe155('0xa')][_0xe155('0x3')],oldToken);}var _0x15b402={'uri':_0x2b296b,'method':_0xe155('0xb'),'timeout':0xea60,'json':!![]};return rp(_0x15b402)['then'](function(_0x598e84){_0xa4b331(_0x598e84);})[_0xe155('0xc')](function(_0x894d13){_0x2925bd(_0x894d13);});});}function manageLicense(_0x4423c7,_0x4117b9){var _0x2158cd=_0x4117b9['get']({'plain':!![]});if(!isOldTokenSent&&_0x2158cd[_0xe155('0xd')]!==_0x4423c7&&!_0x2158cd[_0xe155('0xe')]){oldToken=_0x2158cd['data1'];}httpRequest(_0x4423c7)[_0xe155('0xf')](function(_0x212456){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x212456['active']){isOldTokenSent=![];if(!_0x2158cd[_0xe155('0x7')]&&_0x2158cd[_0xe155('0x7')]!=_0x212456[_0xe155('0x7')]||_0x2158cd[_0xe155('0x7')]&&_0x2158cd[_0xe155('0xe')]){logger[_0xe155('0x10')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x2158cd[_0xe155('0x7')]&&!_0x2158cd[_0xe155('0xe')]&&_0x2158cd[_0xe155('0x7')]!=_0x212456[_0xe155('0x7')]){logger[_0xe155('0x10')](_0xe155('0x11'));}if(_0x2158cd[_0xe155('0x7')]&&!_0x2158cd[_0xe155('0xe')]&&_0x2158cd[_0xe155('0x7')]==_0x212456[_0xe155('0x7')]){return _0x4117b9;}return _0x4117b9[_0xe155('0x12')]({'data1':_0x4423c7,'data2':null,'license':_0x212456[_0xe155('0x7')]});}else{if(_0x212456[_0xe155('0x7')]||_0x2158cd[_0xe155('0x7')]){if(!_0x2158cd[_0xe155('0xe')]){if(_0x2158cd[_0xe155('0xd')]==_0x4423c7){GRAY_PERIOD_REASON=_0xe155('0x13');logger['info'](_0xe155('0x14'));}else{GRAY_PERIOD_REASON=_0xe155('0x15');logger['info'](_0xe155('0x16'),_0x2158cd[_0xe155('0xd')],_0x4423c7);}logger[_0xe155('0x10')](_0xe155('0x17'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x4117b9[_0xe155('0x12')]({'data2':encryptor[_0xe155('0x18')](moment()[_0xe155('0x19')](_0xe155('0x1a')))});}else{if(moment()[_0xe155('0x1b')](encryptor['decryptString'](_0x2158cd[_0xe155('0xe')]),_0xe155('0x1c'))>DAYS){logger[_0xe155('0x10')](_0xe155('0x1d'),moment()[_0xe155('0x19')](_0xe155('0x1a')));isOldTokenSent=![];return _0x4117b9[_0xe155('0x12')]({'data1':_0x4423c7,'data2':null,'license':null});}}}else{if(_0x2158cd[_0xe155('0xd')]!=_0x4423c7){logger[_0xe155('0x10')](_0xe155('0x16'),_0x2158cd['data1'],_0x4423c7);return _0x4117b9['update']({'data1':_0x4423c7,'data2':null,'license':null});}}}return _0x4117b9;})['then'](function(_0x35a85a){_0x4117b9=_0x35a85a;})[_0xe155('0xc')](function(_0x40f4b0){logger[_0xe155('0x1e')](_0x40f4b0[_0xe155('0x1f')]);})[_0xe155('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0xe155('0x21')](),_0x4117b9);},TIME);});}function defaultLicense(){var _0x2d961a=hardware[_0xe155('0x21')]();if(_0x2d961a){return db[_0xe155('0x22')][_0xe155('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x2d961a}})[_0xe155('0x24')](function(_0x32a655,_0x2c4329){logger[_0xe155('0x10')](_0xe155('0x25'),_0x2d961a);manageLicense(_0x2d961a,_0x32a655);})['catch'](function(_0x3b8f4e){logger[_0xe155('0x1e')](_0x3b8f4e[_0xe155('0x1f')]);});}}exports[_0xe155('0x26')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 376c8c6..db3f2a8 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 _0x1926=['./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','License','find','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','grayReason','disabled','message','User','findAll','role','sequelize','COUNT','col','count','admin','telephone','telephones','pick','countBy','user','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','catch','exports','util','lodash','moment','bluebird'];(function(_0x5d132d,_0x32ef8c){var _0x46f999=function(_0x16bcd6){while(--_0x16bcd6){_0x5d132d['push'](_0x5d132d['shift']());}};_0x46f999(++_0x32ef8c);}(_0x1926,0x14c));var _0x6192=function(_0x29c10e,_0x4155af){_0x29c10e=_0x29c10e-0x0;var _0x3017d7=_0x1926[_0x29c10e];return _0x3017d7;};'use strict';var util=require(_0x6192('0x0'));var _=require(_0x6192('0x1'));var moment=require(_0x6192('0x2'));var BPromise=require(_0x6192('0x3'));var hardware=require(_0x6192('0x4'));var encryptor=require(_0x6192('0x5'));var db=require(_0x6192('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6192('0x7'),'machineUuid':hardware[_0x6192('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6192('0x9'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x6192('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x7040b0){return new BPromise(function(_0x215563,_0x55fc58){return db[_0x6192('0xa')][_0x6192('0xb')](_['defaults'](_0x7040b0,{'raw':!![],'where':{'id':0x1}}))[_0x6192('0xc')](function(_0x2a81db){return checkLicense(_0x2a81db,null);})[_0x6192('0xc')](function(_0x558f52){_0x215563(_0x558f52);return;})['catch'](function(_0x172f48){_0x55fc58(_0x172f48);});});}function checkLicense(_0xbdb7d1,_0x5c5bad){if(!_0xbdb7d1){demoLicense[_0x6192('0xd')]=_0xbdb7d1[_0x6192('0xe')];return demoLicense;}try{var _0x1a6484=_0x5c5bad||_0xbdb7d1[_0x6192('0xf')];if(_[_0x6192('0x10')](_0x1a6484)){throw new Error(_0x6192('0x11'));}var _0x5ad38b=_0xbdb7d1[_0x6192('0xe')];var _0x220e4e=_0xbdb7d1[_0x6192('0x12')];var _0x5d9b6d=_0x5ad38b[_0x6192('0x13')]('-')[0x4];var _0x5cbed0=_0x5ad38b['split']('-')[0x0];var _0x542938=encryptor['decryptString'](_0x1a6484,util['format'](_0x6192('0x14'),_0x5d9b6d,_0x5ad38b,_0x5cbed0));var _0x3b203e=JSON[_0x6192('0x15')](_0x542938);_0x3b203e[_0x6192('0x16')]=![];_0x3b203e[_0x6192('0xd')]=_0x5ad38b;_0x3b203e[_0x6192('0x17')]=hardware[_0x6192('0x8')]();if(_0x220e4e){var _0x3f9529=encryptor['decryptString'](_0x220e4e);_0x3b203e[_0x6192('0x18')]=_0x3f9529;_0x3b203e[_0x6192('0x19')]=moment(_0x3f9529)[_0x6192('0x1a')](0x7,_0x6192('0x1b'))['format']();_0x3b203e[_0x6192('0x1c')]=_0x3b203e[_0x6192('0xd')]!=_0x3b203e[_0x6192('0x17')]?'changed':_0x6192('0x1d');}return _0x3b203e;}catch(_0x5b8116){breakingLicense[_0x6192('0xd')]=_0xbdb7d1[_0x6192('0xe')];breakingLicense[_0x6192('0x1e')]=_0x5b8116['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1e1ef5,_0x4cee1e){getLicense()[_0x6192('0xc')](function(_0x2748cc){return db[_0x6192('0x1f')][_0x6192('0x20')]({'attributes':[_0x6192('0x21'),[db[_0x6192('0x22')]['fn'](_0x6192('0x23'),db[_0x6192('0x22')][_0x6192('0x24')]('role')),_0x6192('0x25')]],'group':'role','where':{'role':{'$or':[_0x6192('0x26'),'user',_0x6192('0x27')]}},'raw':!![]})[_0x6192('0xc')](function(_0x3a41d3){var _0x294324={'user':_0x2748cc['users']||0x0,'telephone':_0x2748cc[_0x6192('0x28')]||0x0};_0x3a41d3['forEach'](function(_0x430b8e){var _0x52bd2e=_0x430b8e['role']==='admin'?'user':_0x430b8e[_0x6192('0x21')];_0x294324[_0x52bd2e]-=_0x430b8e[_0x6192('0x25')];if(_0x294324[_0x52bd2e]<0x0)_0x294324[_0x52bd2e]=0x0;});_0x1e1ef5(_0x294324);return;});})['catch'](function(_0x5281bc){_0x4cee1e(_0x5281bc);});});}function checkUserLimits(_0x419273){return new BPromise(function(_0x72a726,_0x38d9ba){getLimits()[_0x6192('0xc')](function(_0xd2cdec){var _0x5f1e03=_[_0x6192('0x29')](_[_0x6192('0x2a')](_0x419273,'role'),[_0x6192('0x26'),_0x6192('0x2b'),_0x6192('0x27')]);var _0x29b7ed=(_0x5f1e03[_0x6192('0x26')]||0x0)+(_0x5f1e03[_0x6192('0x2b')]||0x0);var _0x1b5283=_0x5f1e03[_0x6192('0x27')]||0x0;if(_0x29b7ed>_0xd2cdec[_0x6192('0x2b')])return _0x38d9ba(_0x6192('0x2c'));if(_0x1b5283>_0xd2cdec[_0x6192('0x27')])return _0x38d9ba(_0x6192('0x2d'));return _0x72a726();})[_0x6192('0x2e')](function(_0x739591){_0x38d9ba(_0x739591);});});}module[_0x6192('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xb1ed=['User','findAll','role','COUNT','col','count','admin','user','telephone','users','telephones','forEach','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','../../components/encryptor','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','then','catch','uuid','data1','data2','split','decryptString','format','parse','machineUuid','deadline','add','days','grayReason','changed','disabled','message'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xb1ed,0x136));var _0xdb1e=function(_0x10b434,_0x521745){_0x10b434=_0x10b434-0x0;var _0x31050b=_0xb1ed[_0x10b434];return _0x31050b;};'use strict';var util=require('util');var _=require(_0xdb1e('0x0'));var moment=require(_0xdb1e('0x1'));var BPromise=require(_0xdb1e('0x2'));var hardware=require('./hardware');var encryptor=require(_0xdb1e('0x3'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xdb1e('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xdb1e('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xdb1e('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xdb1e('0x6'),'machineUuid':hardware[_0xdb1e('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x2695fd){return new BPromise(function(_0x483341,_0x316844){return db[_0xdb1e('0x7')][_0xdb1e('0x8')](_['defaults'](_0x2695fd,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x4aece6){return checkLicense(_0x4aece6,null);})[_0xdb1e('0x9')](function(_0x4fd579){_0x483341(_0x4fd579);return;})[_0xdb1e('0xa')](function(_0x312df5){_0x316844(_0x312df5);});});}function checkLicense(_0x3d9305,_0x356189){if(!_0x3d9305){demoLicense[_0xdb1e('0xb')]=_0x3d9305[_0xdb1e('0xc')];return demoLicense;}try{var _0x449d0c=_0x356189||_0x3d9305['license'];if(_['isEmpty'](_0x449d0c)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x362ff2=_0x3d9305[_0xdb1e('0xc')];var _0x21eef3=_0x3d9305[_0xdb1e('0xd')];var _0x106268=_0x362ff2[_0xdb1e('0xe')]('-')[0x4];var _0x2c2e89=_0x362ff2[_0xdb1e('0xe')]('-')[0x0];var _0x18ccd1=encryptor[_0xdb1e('0xf')](_0x449d0c,util[_0xdb1e('0x10')]('%s:%s:%s',_0x106268,_0x362ff2,_0x2c2e89));var _0x50e6a0=JSON[_0xdb1e('0x11')](_0x18ccd1);_0x50e6a0['demo']=![];_0x50e6a0[_0xdb1e('0xb')]=_0x362ff2;_0x50e6a0[_0xdb1e('0x12')]=hardware[_0xdb1e('0x5')]();if(_0x21eef3){var _0x2d09ed=encryptor[_0xdb1e('0xf')](_0x21eef3);_0x50e6a0['gray']=_0x2d09ed;_0x50e6a0[_0xdb1e('0x13')]=moment(_0x2d09ed)[_0xdb1e('0x14')](0x7,_0xdb1e('0x15'))[_0xdb1e('0x10')]();_0x50e6a0[_0xdb1e('0x16')]=_0x50e6a0[_0xdb1e('0xb')]!=_0x50e6a0[_0xdb1e('0x12')]?_0xdb1e('0x17'):_0xdb1e('0x18');}return _0x50e6a0;}catch(_0x3ac3d0){breakingLicense[_0xdb1e('0xb')]=_0x3d9305[_0xdb1e('0xc')];breakingLicense[_0xdb1e('0x19')]=_0x3ac3d0[_0xdb1e('0x19')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5857f2,_0x3bae4c){getLicense()[_0xdb1e('0x9')](function(_0x1d8192){return db[_0xdb1e('0x1a')][_0xdb1e('0x1b')]({'attributes':[_0xdb1e('0x1c'),[db['sequelize']['fn'](_0xdb1e('0x1d'),db['sequelize'][_0xdb1e('0x1e')](_0xdb1e('0x1c'))),_0xdb1e('0x1f')]],'group':_0xdb1e('0x1c'),'where':{'role':{'$or':[_0xdb1e('0x20'),_0xdb1e('0x21'),_0xdb1e('0x22')]}},'raw':!![]})[_0xdb1e('0x9')](function(_0x5a36a6){var _0x4412d2={'user':_0x1d8192[_0xdb1e('0x23')]||0x0,'telephone':_0x1d8192[_0xdb1e('0x24')]||0x0};_0x5a36a6[_0xdb1e('0x25')](function(_0x29662b){var _0x406964=_0x29662b[_0xdb1e('0x1c')]===_0xdb1e('0x20')?_0xdb1e('0x21'):_0x29662b['role'];_0x4412d2[_0x406964]-=_0x29662b['count'];if(_0x4412d2[_0x406964]<0x0)_0x4412d2[_0x406964]=0x0;});_0x5857f2(_0x4412d2);return;});})[_0xdb1e('0xa')](function(_0x2d598a){_0x3bae4c(_0x2d598a);});});}function checkUserLimits(_0x37a867){return new BPromise(function(_0x1a1c70,_0x597a1d){getLimits()[_0xdb1e('0x9')](function(_0x98eedb){var _0x260a35=_[_0xdb1e('0x26')](_['countBy'](_0x37a867,_0xdb1e('0x1c')),[_0xdb1e('0x20'),_0xdb1e('0x21'),'telephone']);var _0x77da32=(_0x260a35[_0xdb1e('0x20')]||0x0)+(_0x260a35[_0xdb1e('0x21')]||0x0);var _0x1692b3=_0x260a35[_0xdb1e('0x22')]||0x0;if(_0x77da32>_0x98eedb[_0xdb1e('0x21')])return _0x597a1d(_0xdb1e('0x27'));if(_0x1692b3>_0x98eedb['telephone'])return _0x597a1d(_0xdb1e('0x28'));return _0x1a1c70();})['catch'](function(_0x3fd279){_0x597a1d(_0x3fd279);});});}module[_0xdb1e('0x29')]={'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 66bb220..1b012d0 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 _0x583c=['http://localhost:9000','myappanuglar-secret','app-id','exports'];(function(_0x662847,_0x1feaef){var _0x246d58=function(_0x4a51da){while(--_0x4a51da){_0x662847['push'](_0x662847['shift']());}};_0x246d58(++_0x1feaef);}(_0x583c,0x12b));var _0xc583=function(_0x45518f,_0x475a6b){_0x45518f=_0x45518f-0x0;var _0x198175=_0x583c[_0x45518f];return _0x198175;};'use strict';module[_0xc583('0x0')]={'DOMAIN':_0xc583('0x1'),'SESSION_SECRET':_0xc583('0x2'),'GOOGLE_ID':_0xc583('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0xed3c=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0xed3c,0x1a6));var _0xced3=function(_0x54c977,_0x382295){_0x54c977=_0x54c977-0x0;var _0x53a048=_0xed3c[_0x54c977];return _0x53a048;};'use strict';module[_0xced3('0x0')]={'DOMAIN':_0xced3('0x1'),'SESSION_SECRET':_0xced3('0x2'),'GOOGLE_ID':_0xced3('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 3dfc962..f61f59b 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ec4=['replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','exports','Logger','transports','File','%s-%s','error','info','Console','env','debugLevel','moment','winston','util','INFO','join','log','xcally','format','message'];(function(_0x5fc146,_0x3d64a9){var _0x479e5b=function(_0x1d3852){while(--_0x1d3852){_0x5fc146['push'](_0x5fc146['shift']());}};_0x479e5b(++_0x3d64a9);}(_0x2ec4,0x1b9));var _0x42ec=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2ec4[_0x1facfa];return _0x9ec701;};'use strict';var moment=require(_0x42ec('0x0'));var winston=require(_0x42ec('0x1'));var util=require(_0x42ec('0x2'));var path=require('path');var debugLevel=_0x42ec('0x3');function filename(_0x38c850,_0x5c6f52){return path[_0x42ec('0x4')]('/var',_0x42ec('0x5'),_0x42ec('0x6'),util[_0x42ec('0x7')]('%s-%s.log',_0x38c850,_0x5c6f52));}function formatter(_0x3880f8,_0x4b566e){_0x4b566e[_0x42ec('0x8')]=_0x4b566e['message'][_0x42ec('0x9')](/@@{/g,_0x42ec('0xa'))['replace'](/}@@/g,_0x42ec('0xb'))[_0x42ec('0x9')](/@{/g,'{{')[_0x42ec('0x9')](/}@/g,'}}');return util['format'](_0x42ec('0xc'),moment()[_0x42ec('0x7')](_0x42ec('0xd')),_0x4b566e['level'][_0x42ec('0xe')](),_0x3880f8,_0x4b566e['message']);}module[_0x42ec('0xf')]=function(_0x23448e){return new winston[(_0x42ec('0x10'))]({'transports':[new winston[(_0x42ec('0x11'))][(_0x42ec('0x12'))]({'name':util[_0x42ec('0x7')](_0x42ec('0x13'),_0x23448e,_0x42ec('0x14')),'filename':filename(_0x23448e,'error'),'level':_0x42ec('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2f1246){return formatter(_0x23448e,_0x2f1246);}}),new winston[(_0x42ec('0x11'))]['File']({'name':util['format']('%s-%s',_0x23448e,_0x42ec('0x15')),'filename':filename(_0x23448e,_0x42ec('0x15')),'level':_0x42ec('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x15678b){return formatter(_0x23448e,_0x15678b);}}),new winston['transports'][(_0x42ec('0x16'))]({'level':process[_0x42ec('0x17')][_0x42ec('0x18')]||debugLevel,'json':![],'formatter':function(_0x2e6882){return formatter(_0x23448e,_0x2e6882);}})]});}; \ No newline at end of file +var _0x1775=['/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','error','transports','File','%s-%s','info','Console','env','debugLevel','moment','winston','path','INFO','join'];(function(_0x4ed706,_0xd3334c){var _0x329adc=function(_0x52191a){while(--_0x52191a){_0x4ed706['push'](_0x4ed706['shift']());}};_0x329adc(++_0xd3334c);}(_0x1775,0xb8));var _0x5177=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x1775[_0x502c7d];return _0x30b7ed;};'use strict';var moment=require(_0x5177('0x0'));var winston=require(_0x5177('0x1'));var util=require('util');var path=require(_0x5177('0x2'));var debugLevel=_0x5177('0x3');function filename(_0x3ba732,_0x31cd29){return path[_0x5177('0x4')](_0x5177('0x5'),_0x5177('0x6'),_0x5177('0x7'),util[_0x5177('0x8')](_0x5177('0x9'),_0x3ba732,_0x31cd29));}function formatter(_0x3910dc,_0x3a30be){_0x3a30be['message']=_0x3a30be[_0x5177('0xa')][_0x5177('0xb')](/@@{/g,_0x5177('0xc'))[_0x5177('0xb')](/}@@/g,'}}}')[_0x5177('0xb')](/@{/g,'{{')[_0x5177('0xb')](/}@/g,'}}');return util['format'](_0x5177('0xd'),moment()['format'](_0x5177('0xe')),_0x3a30be[_0x5177('0xf')][_0x5177('0x10')](),_0x3910dc,_0x3a30be[_0x5177('0xa')]);}module[_0x5177('0x11')]=function(_0x201c19){return new winston[(_0x5177('0x12'))]({'transports':[new winston['transports']['File']({'name':util[_0x5177('0x8')]('%s-%s',_0x201c19,_0x5177('0x13')),'filename':filename(_0x201c19,'error'),'level':_0x5177('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5b3858){return formatter(_0x201c19,_0x5b3858);}}),new winston[(_0x5177('0x14'))][(_0x5177('0x15'))]({'name':util[_0x5177('0x8')](_0x5177('0x16'),_0x201c19,_0x5177('0x17')),'filename':filename(_0x201c19,_0x5177('0x17')),'level':_0x5177('0x17'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5f4762){return formatter(_0x201c19,_0x5f4762);}}),new winston[(_0x5177('0x14'))][(_0x5177('0x18'))]({'level':process[_0x5177('0x19')][_0x5177('0x1a')]||debugLevel,'json':![],'formatter':function(_0xbc4f23){return formatter(_0x201c19,_0xbc4f23);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index e4f14fc..b8c4835 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 _0x5a85=['email','../../services/email/index.js','../../services/routing/index.js','xdr','exports','path','express','join','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js'];(function(_0x599151,_0x60c9dc){var _0x3994ce=function(_0xaa3859){while(--_0xaa3859){_0x599151['push'](_0x599151['shift']());}};_0x3994ce(++_0x60c9dc);}(_0x5a85,0x1bf));var _0x55a8=function(_0x20588f,_0x3a0c65){_0x20588f=_0x20588f-0x0;var _0x1af455=_0x5a85[_0x20588f];return _0x1af455;};'use strict';var path=require(_0x55a8('0x0'));var os=require('os');var config={'apps':[{'name':_0x55a8('0x1'),'script':path[_0x55a8('0x2')](__dirname,_0x55a8('0x3'))},{'name':_0x55a8('0x4'),'script':path[_0x55a8('0x2')](__dirname,_0x55a8('0x5'))},{'name':_0x55a8('0x6'),'script':path[_0x55a8('0x2')](__dirname,_0x55a8('0x7'))},{'name':_0x55a8('0x8'),'script':path[_0x55a8('0x2')](__dirname,_0x55a8('0x9'))},{'name':'routing','script':path[_0x55a8('0x2')](__dirname,_0x55a8('0xa'))},{'name':_0x55a8('0xb'),'script':path['join'](__dirname,'../../services/xdr/index.js')}]};module[_0x55a8('0xc')]=config; \ No newline at end of file +var _0xc5e9=['join','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','path'];(function(_0x1dab02,_0x48b84e){var _0x36612f=function(_0x48072d){while(--_0x48072d){_0x1dab02['push'](_0x1dab02['shift']());}};_0x36612f(++_0x48b84e);}(_0xc5e9,0xb3));var _0x9c5e=function(_0xf1b107,_0x142abb){_0xf1b107=_0xf1b107-0x0;var _0x1281d6=_0xc5e9[_0xf1b107];return _0x1281d6;};'use strict';var path=require(_0x9c5e('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x9c5e('0x1')](__dirname,'../../services/express/index.js')},{'name':_0x9c5e('0x2'),'script':path['join'](__dirname,_0x9c5e('0x3'))},{'name':_0x9c5e('0x4'),'script':path[_0x9c5e('0x1')](__dirname,_0x9c5e('0x5'))},{'name':_0x9c5e('0x6'),'script':path['join'](__dirname,_0x9c5e('0x7'))},{'name':_0x9c5e('0x8'),'script':path[_0x9c5e('0x1')](__dirname,_0x9c5e('0x9'))},{'name':_0x9c5e('0xa'),'script':path[_0x9c5e('0x1')](__dirname,_0x9c5e('0xb'))}]};module['exports']=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 411c61b..35430ce 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 _0x96fe=['start','disconnect','restart','list','describe','delete','dump','pm2','bluebird','./config','connect','connected','then'];(function(_0x17cd69,_0x3ac40b){var _0x16b47c=function(_0x3d9830){while(--_0x3d9830){_0x17cd69['push'](_0x17cd69['shift']());}};_0x16b47c(++_0x3ac40b);}(_0x96fe,0x1db));var _0xe96f=function(_0x432792,_0x16618c){_0x432792=_0x432792-0x0;var _0x5db705=_0x96fe[_0x432792];return _0x5db705;};'use strict';var pm2=require(_0xe96f('0x0'));var BPromise=require(_0xe96f('0x1'));var config=require(_0xe96f('0x2'));function connect(){return new BPromise(function(_0x1e6ae6,_0xf95092){return pm2[_0xe96f('0x3')](function(_0x157083){if(_0x157083){return _0xf95092(_0x157083);}return _0x1e6ae6(_0xe96f('0x4'));});});};exports['start']=function(_0x590ca6){return connect()[_0xe96f('0x5')](function(){return new BPromise(function(_0x11d6f7,_0x13a8de){return pm2[_0xe96f('0x6')](_0x590ca6,function(_0x2c8ac9,_0x46c9f1){if(_0x2c8ac9){return _0x13a8de(_0x2c8ac9);}pm2[_0xe96f('0x7')]();return _0x11d6f7(_0x46c9f1);});});});};exports['stop']=function(_0x4ae159){return connect()['then'](function(){return new BPromise(function(_0x499af9,_0x599240){return pm2['stop'](_0x4ae159,function(_0x25569c,_0x5357ff){if(_0x25569c){return _0x599240(_0x25569c);}pm2[_0xe96f('0x7')]();return _0x499af9(_0x5357ff);});});});};exports[_0xe96f('0x8')]=function(_0x49baa3){return connect()[_0xe96f('0x5')](function(){return new BPromise(function(_0x25fb72,_0x579a67){return pm2[_0xe96f('0x8')](_0x49baa3,function(_0x389cca,_0x4af5d4){if(_0x389cca){return _0x579a67(_0x389cca);}pm2[_0xe96f('0x7')]();return _0x25fb72(_0x4af5d4);});});});};exports[_0xe96f('0x9')]=function(){return connect()[_0xe96f('0x5')](function(){return new BPromise(function(_0x3aa079,_0xe72420){return pm2['list'](function(_0x4361a1,_0x4565df){if(_0x4361a1){return _0xe72420(_0x4361a1);}pm2['disconnect']();return _0x3aa079(_0x4565df);});});});};exports[_0xe96f('0xa')]=function(_0x2c7041){return connect()[_0xe96f('0x5')](function(){return new BPromise(function(_0x500056,_0x2adb61){return pm2[_0xe96f('0xa')](_0x2c7041,function(_0x118642,_0x380110){if(_0x118642){return _0x2adb61(_0x118642);}pm2[_0xe96f('0x7')]();return _0x500056(_0x380110);});});});};exports['delete']=function(_0x2e80bb){return connect()[_0xe96f('0x5')](function(){return new BPromise(function(_0x509935,_0x3f8e62){return pm2[_0xe96f('0xb')](_0x2e80bb,function(_0x254e83,_0x35a11){if(_0x254e83){return _0x3f8e62(_0x254e83);}pm2[_0xe96f('0x7')]();return _0x509935(_0x35a11);});});});};exports[_0xe96f('0xc')]=function(){return connect()[_0xe96f('0x5')](function(){return new BPromise(function(_0x2dcde8,_0x9d0ae7){return pm2['dump'](function(_0x1d1668){if(_0x1d1668){return _0x9d0ae7(_0x1d1668);}return _0x2dcde8('saved');});});});}; \ No newline at end of file +var _0x1766=['describe','delete','dump','saved','bluebird','./config','connected','start','disconnect','stop','then','restart','list'];(function(_0x5b1f35,_0x508d2f){var _0x7d4c55=function(_0x514bd5){while(--_0x514bd5){_0x5b1f35['push'](_0x5b1f35['shift']());}};_0x7d4c55(++_0x508d2f);}(_0x1766,0xa0));var _0x6176=function(_0x11462c,_0x492df0){_0x11462c=_0x11462c-0x0;var _0x46ee9b=_0x1766[_0x11462c];return _0x46ee9b;};'use strict';var pm2=require('pm2');var BPromise=require(_0x6176('0x0'));var config=require(_0x6176('0x1'));function connect(){return new BPromise(function(_0x3fd573,_0x952ffe){return pm2['connect'](function(_0xdf20ab){if(_0xdf20ab){return _0x952ffe(_0xdf20ab);}return _0x3fd573(_0x6176('0x2'));});});};exports[_0x6176('0x3')]=function(_0x20eba2){return connect()['then'](function(){return new BPromise(function(_0x1cab55,_0x2e550f){return pm2[_0x6176('0x3')](_0x20eba2,function(_0x5204d8,_0x2d11e5){if(_0x5204d8){return _0x2e550f(_0x5204d8);}pm2[_0x6176('0x4')]();return _0x1cab55(_0x2d11e5);});});});};exports[_0x6176('0x5')]=function(_0x6877f0){return connect()[_0x6176('0x6')](function(){return new BPromise(function(_0xca4bf0,_0xfe0e10){return pm2[_0x6176('0x5')](_0x6877f0,function(_0xd89be9,_0x195173){if(_0xd89be9){return _0xfe0e10(_0xd89be9);}pm2[_0x6176('0x4')]();return _0xca4bf0(_0x195173);});});});};exports[_0x6176('0x7')]=function(_0x272686){return connect()['then'](function(){return new BPromise(function(_0x2709f3,_0x5ac9e2){return pm2[_0x6176('0x7')](_0x272686,function(_0x2b0e61,_0x83f75){if(_0x2b0e61){return _0x5ac9e2(_0x2b0e61);}pm2[_0x6176('0x4')]();return _0x2709f3(_0x83f75);});});});};exports[_0x6176('0x8')]=function(){return connect()[_0x6176('0x6')](function(){return new BPromise(function(_0x2ac70b,_0x45e738){return pm2[_0x6176('0x8')](function(_0x47d336,_0x396a84){if(_0x47d336){return _0x45e738(_0x47d336);}pm2[_0x6176('0x4')]();return _0x2ac70b(_0x396a84);});});});};exports['describe']=function(_0x25729c){return connect()[_0x6176('0x6')](function(){return new BPromise(function(_0x30ce69,_0x121e8a){return pm2[_0x6176('0x9')](_0x25729c,function(_0x38491d,_0x4f94c9){if(_0x38491d){return _0x121e8a(_0x38491d);}pm2[_0x6176('0x4')]();return _0x30ce69(_0x4f94c9);});});});};exports[_0x6176('0xa')]=function(_0x51bdf8){return connect()[_0x6176('0x6')](function(){return new BPromise(function(_0x4781e1,_0x1b52de){return pm2[_0x6176('0xa')](_0x51bdf8,function(_0x176514,_0x30ccec){if(_0x176514){return _0x1b52de(_0x176514);}pm2['disconnect']();return _0x4781e1(_0x30ccec);});});});};exports[_0x6176('0xb')]=function(){return connect()[_0x6176('0x6')](function(){return new BPromise(function(_0x25c1f7,_0x45f05f){return pm2[_0x6176('0xb')](function(_0x48def0){if(_0x48def0){return _0x45f05f(_0x48def0);}return _0x25c1f7(_0x6176('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index e778092..82dd9c1 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 _0xf835=['findAll','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','timeout','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction'];(function(_0x1f5104,_0xb4978d){var _0x3d0642=function(_0x54e28c){while(--_0x54e28c){_0x1f5104['push'](_0x1f5104['shift']());}};_0x3d0642(++_0xb4978d);}(_0xf835,0x100));var _0x5f83=function(_0x4a081b,_0x178562){_0x4a081b=_0x4a081b-0x0;var _0x51f811=_0xf835[_0x4a081b];return _0x51f811;};'use strict';var _=require(_0x5f83('0x0'));var moment=require(_0x5f83('0x1'));var Redis=require(_0x5f83('0x2'));var util=require(_0x5f83('0x3'));var config=require('../../config/environment');var db=require(_0x5f83('0x4'))['db'];var logger=require(_0x5f83('0x5'))(_0x5f83('0x6'));config[_0x5f83('0x7')]=_[_0x5f83('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5f83('0x9'))(new Redis(config[_0x5f83('0x7')]));function closeInteractions(){var _0x46eff5=0x0;var _0x2b4baa=[];return db[_0x5f83('0xa')]['find']({'raw':!![],'attributes':['id',_0x5f83('0xb')],'where':{'id':0x1}})[_0x5f83('0xc')](function(_0x2e5952){_0x46eff5=_0x2e5952[_0x5f83('0xb')];if(_0x46eff5){return db[_0x5f83('0xd')][_0x5f83('0xe')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5f83('0xf')](_0x2e5952[_0x5f83('0xb')],_0x5f83('0x10'))}}});}else{return[];}})['then'](function(_0x16a2e7){if(_0x16a2e7&&_0x16a2e7[_0x5f83('0x11')]){_0x2b4baa=_[_0x5f83('0x12')](_0x16a2e7||[],'id');logger[_0x5f83('0x13')](_0x5f83('0x14'),_0x2b4baa[_0x5f83('0x15')]());return db['ChatInteraction']['update']({'closeReason':'system','disposition':_0x5f83('0x16'),'closed':!![],'closedAt':moment()['format'](_0x5f83('0x17'))},{'where':{'id':_0x2b4baa}});}})['then'](function(){if(_0x2b4baa&&_0x2b4baa[_0x5f83('0x11')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x2b4baa['join']());for(var _0x55f3c2=0x0;_0x55f3c2<_0x2b4baa[_0x5f83('0x11')];_0x55f3c2++){io[_0x5f83('0x18')](_0x5f83('0x19'),{'id':_0x2b4baa[_0x55f3c2],'closed':!![]});}}})[_0x5f83('0x1a')](function(_0x2500f3){logger[_0x5f83('0x1b')](_0x5f83('0x1c'),_0x2500f3?util['inspect'](_0x2500f3,{'showHidden':![],'depth':null}):'');});}exports[_0x5f83('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xe5ca=['chatTimeout','findAll','lastMsgAt','subtract','minutes','then','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','emit','chatInteraction:update','catch','error','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','localhost','Setting'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe5ca,0x1d7));var _0xae5c=function(_0x350182,_0x2a9feb){_0x350182=_0x350182-0x0;var _0x4a0892=_0xe5ca[_0x350182];return _0x4a0892;};'use strict';var _=require('lodash');var moment=require(_0xae5c('0x0'));var Redis=require(_0xae5c('0x1'));var util=require(_0xae5c('0x2'));var config=require(_0xae5c('0x3'));var db=require(_0xae5c('0x4'))['db'];var logger=require(_0xae5c('0x5'))('schedule');config[_0xae5c('0x6')]=_['defaults'](config[_0xae5c('0x6')],{'host':_0xae5c('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xae5c('0x6')]));function closeInteractions(){var _0x4190be=0x0;var _0x29d522=[];return db[_0xae5c('0x8')]['find']({'raw':!![],'attributes':['id',_0xae5c('0x9')],'where':{'id':0x1}})['then'](function(_0xe84bf4){_0x4190be=_0xe84bf4[_0xae5c('0x9')];if(_0x4190be){return db['ChatInteraction'][_0xae5c('0xa')]({'raw':!![],'attributes':['id',_0xae5c('0xb')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xae5c('0xc')](_0xe84bf4[_0xae5c('0x9')],_0xae5c('0xd'))}}});}else{return[];}})[_0xae5c('0xe')](function(_0xa8ec03){if(_0xa8ec03&&_0xa8ec03[_0xae5c('0xf')]){_0x29d522=_[_0xae5c('0x10')](_0xa8ec03||[],'id');logger[_0xae5c('0x11')](_0xae5c('0x12'),_0x29d522[_0xae5c('0x13')]());return db[_0xae5c('0x14')][_0xae5c('0x15')]({'closeReason':_0xae5c('0x16'),'disposition':_0xae5c('0x17'),'closed':!![],'closedAt':moment()['format'](_0xae5c('0x18'))},{'where':{'id':_0x29d522}});}})[_0xae5c('0xe')](function(){if(_0x29d522&&_0x29d522[_0xae5c('0xf')]){logger[_0xae5c('0x11')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x29d522[_0xae5c('0x13')]());for(var _0x1cd65b=0x0;_0x1cd65b<_0x29d522[_0xae5c('0xf')];_0x1cd65b++){io[_0xae5c('0x19')](_0xae5c('0x1a'),{'id':_0x29d522[_0x1cd65b],'closed':!![]});}}})[_0xae5c('0x1b')](function(_0x2c8e80){logger[_0xae5c('0x1c')]('[CHAT]\x20Error\x20closing\x20interactions',_0x2c8e80?util['inspect'](_0x2c8e80,{'showHidden':![],'depth':null}):'');});}exports[_0xae5c('0x1d')]=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 f525e2b..e801c9d 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 _0xe4ee=['resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','exists','stop\x20cron','update','run','util','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','Smtp','service','MailAccount','host','port','secure','authentication','auth','user','format','\x22%s\x22\x20<%s>','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractUnit','join','../../files/reports','savename','%s.%s','extname','zip','status','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','existsSync','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','then','error','email\x20sent','catch','error\x20mail','isNil','subtractNumber','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','no\x20report\x20id','findAll','keys','map','toString','keyBy','difference','length','stop','deleteJob','index'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xe4ee,0x1b1));var _0xee4e=function(_0x514da9,_0x5f012a){_0x514da9=_0x514da9-0x0;var _0x291ff1=_0xe4ee[_0x514da9];return _0x291ff1;};'use strict';var fs=require('fs');var util=require(_0xee4e('0x0'));var path=require('path');var _=require('lodash');var moment=require(_0xee4e('0x1'));var CronJobManager=require(_0xee4e('0x2'));var jayson=require(_0xee4e('0x3'));var BPromise=require(_0xee4e('0x4'));var logger=require('../logger')(_0xee4e('0x5'));var db=require(_0xee4e('0x6'))['db'];var analyticCustomReportController=require(_0xee4e('0x7'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0xee4e('0x8')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5a5ca3,_0x5e3476){return function(){logger[_0xee4e('0x9')](_0xee4e('0xa'),_0x5a5ca3['email']);var _0x3a99da=!![];var _0x48fb42={'tls':{'rejectUnauthorized':![]}};if(_0x5a5ca3['MailAccount'][_0xee4e('0xb')]['service']){_0x48fb42[_0xee4e('0xc')]=_0x5a5ca3[_0xee4e('0xd')][_0xee4e('0xb')]['service'];}else{_0x48fb42['host']=_0x5a5ca3['MailAccount'][_0xee4e('0xb')][_0xee4e('0xe')];_0x48fb42[_0xee4e('0xf')]=_0x5a5ca3[_0xee4e('0xd')]['Smtp'][_0xee4e('0xf')];_0x48fb42[_0xee4e('0x10')]=_0x5a5ca3[_0xee4e('0xd')]['Smtp'][_0xee4e('0x10')];}if(_0x5a5ca3['MailAccount'][_0xee4e('0xb')][_0xee4e('0x11')]){_0x48fb42[_0xee4e('0x12')]={'user':_0x5a5ca3[_0xee4e('0xd')][_0xee4e('0xb')][_0xee4e('0x13')],'pass':_0x5a5ca3[_0xee4e('0xd')]['Smtp']['pass']};}var _0x18e046={'account':_0x48fb42,'message':{'from':util[_0xee4e('0x14')](_0xee4e('0x15'),_0x5a5ca3[_0xee4e('0xd')][_0xee4e('0x16')],_0x5a5ca3['MailAccount'][_0xee4e('0x17')]||_0x5a5ca3[_0xee4e('0xd')][_0xee4e('0xb')][_0xee4e('0x13')]),'to':_0x5a5ca3[_0xee4e('0x17')],'cc':_0x5a5ca3['cc'],'bcc':_0x5a5ca3[_0xee4e('0x18')],'subject':util[_0xee4e('0x14')](_0xee4e('0x19'),_0x5e3476['name'],_0x5a5ca3['subtractNumber'],_0x5a5ca3[_0xee4e('0x1a')])}};var _0x3da591=path[_0xee4e('0x1b')](__dirname,_0xee4e('0x1c'));var _0x23820c=_0x5e3476[_0xee4e('0x1d')];var _0x29cd72=util[_0xee4e('0x14')](_0xee4e('0x1e'),path['basename'](_0x5e3476['savename'],path[_0xee4e('0x1f')](_0x5e3476[_0xee4e('0x1d')])),_0xee4e('0x20'));var _0x3e2218=path['join'](_0x3da591,_0x23820c);var _0x3b547d=path[_0xee4e('0x1b')](_0x3da591,_0x29cd72);if(fs['existsSync'](_0x3e2218)){_0x5e3476[_0xee4e('0x21')]='Sent';_0x18e046['message']['attachments']=[{'filename':_0x23820c,'path':_0x3e2218}];_0x18e046[_0xee4e('0x22')][_0xee4e('0x23')]=util[_0xee4e('0x14')](_0xee4e('0x24'),JSON[_0xee4e('0x25')](_0x5e3476,null,0x2));}else if(fs[_0xee4e('0x26')](_0x3b547d)){_0x5e3476[_0xee4e('0x21')]=_0xee4e('0x27');_0x18e046[_0xee4e('0x22')]['attachments']=[{'filename':_0x29cd72,'path':_0x3b547d}];}else{_0x18e046[_0xee4e('0x22')][_0xee4e('0x23')]=_0xee4e('0x28');if(!_0x5a5ca3[_0xee4e('0x29')]){_0x3a99da=![];logger[_0xee4e('0x9')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x3a99da){return client[_0xee4e('0x2a')]('SendMail',_0x18e046)[_0xee4e('0x2b')](function(_0x2dc2e9){if(_0x2dc2e9[_0xee4e('0x2c')]){return logger[_0xee4e('0x2c')]('error\x20mail',JSON['stringify'](_0x2dc2e9));}return logger[_0xee4e('0x9')](_0xee4e('0x2d'));})[_0xee4e('0x2e')](function(_0x79f7ec){return logger['error'](_0xee4e('0x2f'),JSON['stringify'](_0x79f7ec));});}};}function handleError(){return function(_0xe4fcc8){return logger[_0xee4e('0x2c')](JSON[_0xee4e('0x25')](_0xe4fcc8));};}function handleResult(_0x1afcfa){return function(_0x10fc35){logger[_0xee4e('0x9')]('data',JSON[_0xee4e('0x25')](_0x10fc35));if(_0x1afcfa['MailAccount']&&_0x1afcfa[_0xee4e('0xd')][_0xee4e('0xb')]&&!_[_0xee4e('0x30')](_0x1afcfa[_0xee4e('0x17')])){setTimeout(handleSendEmail(_0x1afcfa,_0x10fc35),0x3c*0x3e8);}};}function handleJob(_0x5f4787){return function(){try{if(_[_0xee4e('0x30')](_0x5f4787[_0xee4e('0x31')])){return logger['info'](_0xee4e('0x32'));}if(_['isNil'](_0x5f4787[_0xee4e('0x1a')])){return logger[_0xee4e('0x9')](_0xee4e('0x33'));}var _0x3d671f={'startDate':moment()[_0xee4e('0x34')](_0x5f4787['subtractNumber'],_0x5f4787['subtractUnit'])[_0xee4e('0x14')](_0xee4e('0x35')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xee4e('0x36'),'output':_0x5f4787[_0xee4e('0x37')],'name':_0x5f4787[_0xee4e('0x16')]};if(!_['isNil'](_0x5f4787[_0xee4e('0x38')])){logger[_0xee4e('0x9')](_0xee4e('0x39'),_0x5f4787[_0xee4e('0x38')]);return analyticDefaultReportController[_0xee4e('0x3a')]({'id':_0x5f4787[_0xee4e('0x38')]},_0x3d671f)['then'](handleResult(_0x5f4787))[_0xee4e('0x2e')](handleError());}if(!_[_0xee4e('0x30')](_0x5f4787[_0xee4e('0x3b')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x5f4787[_0xee4e('0x3b')]);return analyticCustomReportController[_0xee4e('0x3a')]({'id':_0x5f4787['CustomReportId']},_0x3d671f)[_0xee4e('0x2b')](handleResult(_0x5f4787))['catch'](handleError());}}catch(_0x3a4296){logger[_0xee4e('0x2c')](JSON[_0xee4e('0x25')](_0x3a4296));}return logger[_0xee4e('0x9')](_0xee4e('0x3c'));};}function getJobs(_0x241a12){var _0x27edeb={};if(_0x241a12){_0x27edeb['id']=_0x241a12;}return db['Schedule'][_0xee4e('0x3d')]({'where':_0x27edeb,'include':[{'model':db[_0xee4e('0xd')],'attributes':['id',_0xee4e('0x16'),_0xee4e('0x17')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]}]})[_0xee4e('0x2b')](function(_0x4fca5b){var _0x2ce4b5=_[_0xee4e('0x3e')](manager['jobs']);var _0x4a7227=_[_0xee4e('0x3f')](_0x4fca5b,function(_0x5302ef){return _0x5302ef['id'][_0xee4e('0x40')]();});var _0x540aa8=_[_0xee4e('0x41')](_0x4fca5b,function(_0x266768){return _0x266768['id'][_0xee4e('0x40')]();});var _0x4f17be=_0x241a12?_0x4a7227:_[_0xee4e('0x42')](_0x4a7227,_0x2ce4b5);var _0x385827=_['intersection'](_0x4a7227,_0x2ce4b5);var _0x1a36c7=_[_0xee4e('0x42')](_0x2ce4b5,_0x4a7227);var _0x2ba028;var _0x2f841b;for(_0x2ba028=0x0;_0x2ba028<_0x1a36c7[_0xee4e('0x43')]&&!_0x241a12;_0x2ba028+=0x1){_0x2f841b=_0x1a36c7[_0x2ba028][_0xee4e('0x40')]();if(manager['exists'](_0x2f841b)){manager[_0xee4e('0x44')](_0x2f841b);manager[_0xee4e('0x45')](_0x2f841b);logger[_0xee4e('0x9')]('delete\x20cron',_0x2f841b);}}logger['info']('toRun',JSON[_0xee4e('0x25')](_0x4f17be));for(_0x2ba028=0x0;_0x2ba028<_0x4f17be['length'];_0x2ba028+=0x1){_0x2f841b=_0x4f17be[_0x2ba028]['toString']();logger[_0xee4e('0x9')](_0xee4e('0x46'),_0x2f841b);if(_0x241a12){logger[_0xee4e('0x9')]('my\x20id',_0x241a12);logger[_0xee4e('0x9')](JSON[_0xee4e('0x25')](_0x540aa8[_0x2f841b]));BPromise[_0xee4e('0x47')]()[_0xee4e('0x2b')](handleJob(_0x540aa8[_0x2f841b]));logger[_0xee4e('0x9')](_0xee4e('0x48'),_0x540aa8[_0x2f841b][_0xee4e('0x16')],_0x540aa8[_0x2f841b][_0xee4e('0x49')]);}else if(_0x540aa8[_0x2f841b]['cron']&&_0x540aa8[_0x2f841b][_0xee4e('0x4a')]&&moment()[_0xee4e('0x4b')](_0x540aa8[_0x2f841b][_0xee4e('0x4c')],_0x540aa8[_0x2f841b][_0xee4e('0x4d')])){manager[_0xee4e('0x4e')](_0x2f841b,_0x540aa8[_0x2f841b][_0xee4e('0x49')],handleJob(_0x540aa8[_0x2f841b]));manager[_0xee4e('0x4f')](_0x2f841b);logger['info']('add\x20cron',_0x540aa8[_0x2f841b]['name'],_0x540aa8[_0x2f841b][_0xee4e('0x49')]);}else if(manager[_0xee4e('0x50')](_0x2f841b)){manager['stop'](_0x2f841b);manager[_0xee4e('0x45')](_0x2f841b);logger[_0xee4e('0x9')](_0xee4e('0x51'),_0x540aa8[_0x2f841b][_0xee4e('0x16')],_0x540aa8[_0x2f841b]['cron']);}}for(_0x2ba028=0x0,_0x2f841b;_0x2ba028<_0x385827[_0xee4e('0x43')]&&!_0x241a12;_0x2ba028+=0x1){_0x2f841b=_0x385827[_0x2ba028]['toString']();if(manager[_0xee4e('0x50')](_0x2f841b)){if(_0x540aa8[_0x2f841b][_0xee4e('0x49')]&&_0x540aa8[_0x2f841b][_0xee4e('0x4a')]&&moment()[_0xee4e('0x4b')](_0x540aa8[_0x2f841b][_0xee4e('0x4c')],_0x540aa8[_0x2f841b][_0xee4e('0x4d')])){manager[_0xee4e('0x52')](_0x2f841b,_0x540aa8[_0x2f841b][_0xee4e('0x49')],handleJob(_0x540aa8[_0x2f841b]));logger[_0xee4e('0x9')]('update\x20cron',_0x540aa8[_0x2f841b][_0xee4e('0x16')],_0x540aa8[_0x2f841b][_0xee4e('0x49')]);}else{manager['stop'](_0x2f841b);manager[_0xee4e('0x45')](_0x2f841b);logger[_0xee4e('0x9')]('stop\x20cron',_0x540aa8[_0x2f841b][_0xee4e('0x16')],_0x540aa8[_0x2f841b][_0xee4e('0x49')]);}}}})[_0xee4e('0x2e')](function(_0x3a912d){logger[_0xee4e('0x2c')](JSON[_0xee4e('0x25')](_0x3a912d));});}exports[_0xee4e('0x53')]=function(_0x2f30ab){return getJobs(_0x2f30ab);};exports[_0xee4e('0x4f')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x0cd0=['update\x20cron','run','util','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','Smtp','service','MailAccount','host','port','secure','auth','format','\x22%s\x22\x20<%s>','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','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','status','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','request','SendMail','then','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','Schedule','findAll','MailServerOut','keys','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','index','my\x20id','resolve','run\x20job','cron','active','startAt','add','start','add\x20cron','stop\x20cron','isBetween'];(function(_0x297c1e,_0x3322a4){var _0x233470=function(_0x5bc63f){while(--_0x5bc63f){_0x297c1e['push'](_0x297c1e['shift']());}};_0x233470(++_0x3322a4);}(_0x0cd0,0xb8));var _0x00cd=function(_0x2a46e0,_0x521eff){_0x2a46e0=_0x2a46e0-0x0;var _0x5f27dd=_0x0cd0[_0x2a46e0];return _0x5f27dd;};'use strict';var fs=require('fs');var util=require(_0x00cd('0x0'));var path=require('path');var _=require(_0x00cd('0x1'));var moment=require(_0x00cd('0x2'));var CronJobManager=require(_0x00cd('0x3'));var jayson=require(_0x00cd('0x4'));var BPromise=require(_0x00cd('0x5'));var logger=require(_0x00cd('0x6'))(_0x00cd('0x7'));var db=require(_0x00cd('0x8'))['db'];var analyticCustomReportController=require(_0x00cd('0x9'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0x00cd('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2f3477,_0x2a708e){return function(){logger[_0x00cd('0xb')](_0x00cd('0xc'),_0x2f3477[_0x00cd('0xd')]);var _0x2566a7=!![];var _0x5bdbdf={'tls':{'rejectUnauthorized':![]}};if(_0x2f3477['MailAccount'][_0x00cd('0xe')][_0x00cd('0xf')]){_0x5bdbdf['service']=_0x2f3477[_0x00cd('0x10')][_0x00cd('0xe')][_0x00cd('0xf')];}else{_0x5bdbdf['host']=_0x2f3477['MailAccount']['Smtp'][_0x00cd('0x11')];_0x5bdbdf[_0x00cd('0x12')]=_0x2f3477[_0x00cd('0x10')][_0x00cd('0xe')]['port'];_0x5bdbdf[_0x00cd('0x13')]=_0x2f3477[_0x00cd('0x10')][_0x00cd('0xe')][_0x00cd('0x13')];}if(_0x2f3477[_0x00cd('0x10')][_0x00cd('0xe')]['authentication']){_0x5bdbdf[_0x00cd('0x14')]={'user':_0x2f3477[_0x00cd('0x10')]['Smtp']['user'],'pass':_0x2f3477[_0x00cd('0x10')][_0x00cd('0xe')]['pass']};}var _0x516ef2={'account':_0x5bdbdf,'message':{'from':util[_0x00cd('0x15')](_0x00cd('0x16'),_0x2f3477[_0x00cd('0x10')]['name'],_0x2f3477[_0x00cd('0x10')][_0x00cd('0xd')]||_0x2f3477[_0x00cd('0x10')][_0x00cd('0xe')][_0x00cd('0x17')]),'to':_0x2f3477[_0x00cd('0xd')],'cc':_0x2f3477['cc'],'bcc':_0x2f3477[_0x00cd('0x18')],'subject':util['format'](_0x00cd('0x19'),_0x2a708e[_0x00cd('0x1a')],_0x2f3477[_0x00cd('0x1b')],_0x2f3477[_0x00cd('0x1c')])}};var _0x1bfa46=path[_0x00cd('0x1d')](__dirname,_0x00cd('0x1e'));var _0x1961d6=_0x2a708e[_0x00cd('0x1f')];var _0x23014f=util[_0x00cd('0x15')](_0x00cd('0x20'),path[_0x00cd('0x21')](_0x2a708e[_0x00cd('0x1f')],path[_0x00cd('0x22')](_0x2a708e[_0x00cd('0x1f')])),_0x00cd('0x23'));var _0x22d3fe=path[_0x00cd('0x1d')](_0x1bfa46,_0x1961d6);var _0x2ce32d=path[_0x00cd('0x1d')](_0x1bfa46,_0x23014f);if(fs[_0x00cd('0x24')](_0x22d3fe)){_0x2a708e['status']='Sent';_0x516ef2[_0x00cd('0x25')]['attachments']=[{'filename':_0x1961d6,'path':_0x22d3fe}];_0x516ef2[_0x00cd('0x25')][_0x00cd('0x26')]=util[_0x00cd('0x15')](_0x00cd('0x27'),JSON[_0x00cd('0x28')](_0x2a708e,null,0x2));}else if(fs[_0x00cd('0x24')](_0x2ce32d)){_0x2a708e[_0x00cd('0x29')]='Sent';_0x516ef2['message'][_0x00cd('0x2a')]=[{'filename':_0x23014f,'path':_0x2ce32d}];}else{_0x516ef2['message'][_0x00cd('0x26')]=_0x00cd('0x2b');if(!_0x2f3477[_0x00cd('0x2c')]){_0x2566a7=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x2566a7){return client[_0x00cd('0x2d')](_0x00cd('0x2e'),_0x516ef2)[_0x00cd('0x2f')](function(_0x4cea3f){if(_0x4cea3f[_0x00cd('0x30')]){return logger[_0x00cd('0x30')](_0x00cd('0x31'),JSON[_0x00cd('0x28')](_0x4cea3f));}return logger['info'](_0x00cd('0x32'));})[_0x00cd('0x33')](function(_0x10ac0a){return logger[_0x00cd('0x30')](_0x00cd('0x31'),JSON[_0x00cd('0x28')](_0x10ac0a));});}};}function handleError(){return function(_0x59233e){return logger[_0x00cd('0x30')](JSON['stringify'](_0x59233e));};}function handleResult(_0x4127f2){return function(_0x16fd65){logger[_0x00cd('0xb')]('data',JSON['stringify'](_0x16fd65));if(_0x4127f2[_0x00cd('0x10')]&&_0x4127f2[_0x00cd('0x10')][_0x00cd('0xe')]&&!_[_0x00cd('0x34')](_0x4127f2[_0x00cd('0xd')])){setTimeout(handleSendEmail(_0x4127f2,_0x16fd65),0x3c*0x3e8);}};}function handleJob(_0x1c7587){return function(){try{if(_['isNil'](_0x1c7587[_0x00cd('0x1b')])){return logger[_0x00cd('0xb')](_0x00cd('0x35'));}if(_[_0x00cd('0x34')](_0x1c7587[_0x00cd('0x1c')])){return logger['info'](_0x00cd('0x36'));}var _0x2907f1={'startDate':moment()[_0x00cd('0x37')](_0x1c7587['subtractNumber'],_0x1c7587['subtractUnit'])[_0x00cd('0x15')](_0x00cd('0x38')),'endDate':moment()['format'](_0x00cd('0x38')),'type':'scheduled','output':_0x1c7587[_0x00cd('0x39')],'name':_0x1c7587[_0x00cd('0x1a')]};if(!_['isNil'](_0x1c7587[_0x00cd('0x3a')])){logger[_0x00cd('0xb')](_0x00cd('0x3b'),_0x1c7587[_0x00cd('0x3a')]);return analyticDefaultReportController[_0x00cd('0x3c')]({'id':_0x1c7587[_0x00cd('0x3a')]},_0x2907f1)[_0x00cd('0x2f')](handleResult(_0x1c7587))[_0x00cd('0x33')](handleError());}if(!_[_0x00cd('0x34')](_0x1c7587[_0x00cd('0x3d')])){logger[_0x00cd('0xb')](_0x00cd('0x3e'),_0x1c7587[_0x00cd('0x3d')]);return analyticCustomReportController[_0x00cd('0x3c')]({'id':_0x1c7587[_0x00cd('0x3d')]},_0x2907f1)['then'](handleResult(_0x1c7587))['catch'](handleError());}}catch(_0x396c5a){logger[_0x00cd('0x30')](JSON[_0x00cd('0x28')](_0x396c5a));}return logger[_0x00cd('0xb')]('no\x20report\x20id');};}function getJobs(_0x44644f){var _0x2af4e6={};if(_0x44644f){_0x2af4e6['id']=_0x44644f;}return db[_0x00cd('0x3f')][_0x00cd('0x40')]({'where':_0x2af4e6,'include':[{'model':db[_0x00cd('0x10')],'attributes':['id',_0x00cd('0x1a'),'email'],'include':[{'model':db[_0x00cd('0x41')],'as':_0x00cd('0xe')}]}]})[_0x00cd('0x2f')](function(_0x842cb2){var _0x31e370=_[_0x00cd('0x42')](manager['jobs']);var _0x3f8485=_[_0x00cd('0x43')](_0x842cb2,function(_0x359108){return _0x359108['id'][_0x00cd('0x44')]();});var _0x4fdce6=_[_0x00cd('0x45')](_0x842cb2,function(_0x21f06f){return _0x21f06f['id'][_0x00cd('0x44')]();});var _0xa878f1=_0x44644f?_0x3f8485:_[_0x00cd('0x46')](_0x3f8485,_0x31e370);var _0x5eff91=_[_0x00cd('0x47')](_0x3f8485,_0x31e370);var _0x32af43=_[_0x00cd('0x46')](_0x31e370,_0x3f8485);var _0x1dee8c;var _0x41be82;for(_0x1dee8c=0x0;_0x1dee8c<_0x32af43[_0x00cd('0x48')]&&!_0x44644f;_0x1dee8c+=0x1){_0x41be82=_0x32af43[_0x1dee8c]['toString']();if(manager[_0x00cd('0x49')](_0x41be82)){manager[_0x00cd('0x4a')](_0x41be82);manager[_0x00cd('0x4b')](_0x41be82);logger[_0x00cd('0xb')](_0x00cd('0x4c'),_0x41be82);}}logger['info']('toRun',JSON[_0x00cd('0x28')](_0xa878f1));for(_0x1dee8c=0x0;_0x1dee8c<_0xa878f1['length'];_0x1dee8c+=0x1){_0x41be82=_0xa878f1[_0x1dee8c][_0x00cd('0x44')]();logger['info'](_0x00cd('0x4d'),_0x41be82);if(_0x44644f){logger['info'](_0x00cd('0x4e'),_0x44644f);logger['info'](JSON['stringify'](_0x4fdce6[_0x41be82]));BPromise[_0x00cd('0x4f')]()[_0x00cd('0x2f')](handleJob(_0x4fdce6[_0x41be82]));logger[_0x00cd('0xb')](_0x00cd('0x50'),_0x4fdce6[_0x41be82][_0x00cd('0x1a')],_0x4fdce6[_0x41be82][_0x00cd('0x51')]);}else if(_0x4fdce6[_0x41be82][_0x00cd('0x51')]&&_0x4fdce6[_0x41be82][_0x00cd('0x52')]&&moment()['isBetween'](_0x4fdce6[_0x41be82][_0x00cd('0x53')],_0x4fdce6[_0x41be82]['endAt'])){manager[_0x00cd('0x54')](_0x41be82,_0x4fdce6[_0x41be82]['cron'],handleJob(_0x4fdce6[_0x41be82]));manager[_0x00cd('0x55')](_0x41be82);logger[_0x00cd('0xb')](_0x00cd('0x56'),_0x4fdce6[_0x41be82][_0x00cd('0x1a')],_0x4fdce6[_0x41be82][_0x00cd('0x51')]);}else if(manager[_0x00cd('0x49')](_0x41be82)){manager[_0x00cd('0x4a')](_0x41be82);manager[_0x00cd('0x4b')](_0x41be82);logger[_0x00cd('0xb')](_0x00cd('0x57'),_0x4fdce6[_0x41be82][_0x00cd('0x1a')],_0x4fdce6[_0x41be82][_0x00cd('0x51')]);}}for(_0x1dee8c=0x0,_0x41be82;_0x1dee8c<_0x5eff91[_0x00cd('0x48')]&&!_0x44644f;_0x1dee8c+=0x1){_0x41be82=_0x5eff91[_0x1dee8c][_0x00cd('0x44')]();if(manager[_0x00cd('0x49')](_0x41be82)){if(_0x4fdce6[_0x41be82][_0x00cd('0x51')]&&_0x4fdce6[_0x41be82][_0x00cd('0x52')]&&moment()[_0x00cd('0x58')](_0x4fdce6[_0x41be82][_0x00cd('0x53')],_0x4fdce6[_0x41be82]['endAt'])){manager['update'](_0x41be82,_0x4fdce6[_0x41be82][_0x00cd('0x51')],handleJob(_0x4fdce6[_0x41be82]));logger[_0x00cd('0xb')](_0x00cd('0x59'),_0x4fdce6[_0x41be82]['name'],_0x4fdce6[_0x41be82][_0x00cd('0x51')]);}else{manager[_0x00cd('0x4a')](_0x41be82);manager[_0x00cd('0x4b')](_0x41be82);logger[_0x00cd('0xb')](_0x00cd('0x57'),_0x4fdce6[_0x41be82][_0x00cd('0x1a')],_0x4fdce6[_0x41be82][_0x00cd('0x51')]);}}}})[_0x00cd('0x33')](function(_0x51be61){logger['error'](JSON['stringify'](_0x51be61));});}exports[_0x00cd('0x5a')]=function(_0x17e7c6){return getJobs(_0x17e7c6);};exports[_0x00cd('0x55')]=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 393221c..8cf6232 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 _0x06ef=['TranscriptFileUri','results','transcripts','length','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','push','all','start','request-promise','transcribe','Comprehend','detectSentiment','substring','info','data1','data2','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','transcribeName','TranscriptionJob','fileText','TranscriptionJobStatus','COMPLETED','[RECORDING:%d]\x20Get\x20transcript','Transcript'];(function(_0x3e90f1,_0x1f5e33){var _0x477616=function(_0x236d57){while(--_0x236d57){_0x3e90f1['push'](_0x3e90f1['shift']());}};_0x477616(++_0x1f5e33);}(_0x06ef,0x185));var _0xf06e=function(_0x46c38d,_0x4c23b7){_0x46c38d=_0x46c38d-0x0;var _0x1e04b8=_0x06ef[_0x46c38d];return _0x1e04b8;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0xf06e('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')(_0xf06e('0x1'));function getTranscriptionJob(_0x1281ca,_0x16d4da,_0x569390,_0x1ddeff){return new Promise(function(_0x71a36,_0x4be428){var _0x59b74b=new AWS['TranscribeService']({'accessKeyId':_0x16d4da,'secretAccessKey':_0x1281ca,'region':_0x569390});_0x59b74b['getTranscriptionJob']({'TranscriptionJobName':_0x1ddeff},function(_0x4ccbee,_0x25b56e){if(_0x4ccbee){return _0x4be428(_0x4ccbee);}else{return _0x71a36(_0x25b56e);}});});}function sentiment(_0x3ee37d,_0x1e1ec5,_0x2bb08c,_0xbb0e3c,_0x5e594e){return new Promise(function(_0x1fe49b,_0x3a33c1){var _0x4e3591=new AWS[(_0xf06e('0x2'))]({'accessKeyId':_0x1e1ec5,'secretAccessKey':_0x3ee37d,'region':_0x2bb08c});_0x4e3591[_0xf06e('0x3')]({'Text':_0xbb0e3c,'LanguageCode':_0x5e594e[_0xf06e('0x4')](0x0,0x2)},function(_0x400af5,_0x39979a){if(_0x400af5){return _0x3a33c1(_0x400af5);}else{return _0x1fe49b(_0x39979a);}});});}function checkTranscribeJob(_0x7b4c4,_0x49fe5d,_0x3daa50){var _0x2578e4;return new BPromise(function(_0x5c36b3,_0x1510a0){logger[_0xf06e('0x5')](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x7b4c4['id'],_0x7b4c4['transcribeName']));return getTranscriptionJob(_0x3daa50[_0xf06e('0x6')],_0x3daa50[_0xf06e('0x7')],_0x49fe5d[_0xf06e('0x8')],_0x7b4c4['transcribeName'])[_0xf06e('0x9')](function(_0x375f90){logger[_0xf06e('0x5')](util[_0xf06e('0xa')](_0xf06e('0xb'),_0x7b4c4['id'],_0x7b4c4[_0xf06e('0xc')],_0x375f90[_0xf06e('0xd')]['TranscriptionJobStatus']));if(!_0x7b4c4[_0xf06e('0xe')]){switch(_0x375f90[_0xf06e('0xd')][_0xf06e('0xf')]){case _0xf06e('0x10'):var _0x5c1a80={'transcribeStatus':_0x375f90['TranscriptionJob'][_0xf06e('0xf')],'fileUri':_0x375f90[_0xf06e('0xd')]['Transcript']['TranscriptFileUri']};logger[_0xf06e('0x5')](util[_0xf06e('0xa')](_0xf06e('0x11'),_0x7b4c4['id']));return rp({'uri':_0x375f90['TranscriptionJob'][_0xf06e('0x12')][_0xf06e('0x13')],'json':!![]})['then'](function(_0x3c3796){logger[_0xf06e('0x5')](util[_0xf06e('0xa')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x7b4c4['id']));if(_0x3c3796&&_0x3c3796[_0xf06e('0x14')]&&_0x3c3796[_0xf06e('0x14')][_0xf06e('0x15')]&&_0x3c3796[_0xf06e('0x14')][_0xf06e('0x15')]['length']){_0x5c1a80[_0xf06e('0xe')]='';for(var _0x4923d3=0x0;_0x4923d3<_0x3c3796[_0xf06e('0x14')][_0xf06e('0x15')][_0xf06e('0x16')];_0x4923d3++){_0x5c1a80[_0xf06e('0xe')]+=_0x3c3796[_0xf06e('0x14')][_0xf06e('0x15')][_0x4923d3]['transcript']+'';}}return _0x7b4c4[_0xf06e('0x17')](_0x5c1a80);})[_0xf06e('0x9')](function(){logger[_0xf06e('0x5')](util[_0xf06e('0xa')](_0xf06e('0x18'),_0x7b4c4['id']));if(!_0x7b4c4['tempSentiment']){throw new db[(_0xf06e('0x19'))][(_0xf06e('0x1a'))](_0xf06e('0x1b'));}if(!_0x49fe5d[_0xf06e('0x1c')]||!_0x49fe5d[_0xf06e('0x1d')]||!_0x49fe5d[_0xf06e('0x1e')]||!_0x49fe5d['language']||!_0x49fe5d[_0xf06e('0x1f')]){throw new db[(_0xf06e('0x19'))][(_0xf06e('0x1a'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x5c1a80[_0xf06e('0xe')]){throw new Error(_0xf06e('0x20'));}if(_0x49fe5d[_0xf06e('0x1d')]===_0x3daa50['id']){return _0x3daa50;}else{return db[_0xf06e('0x21')][_0xf06e('0x22')]({'where':{'id':_settings[_0xf06e('0x1d')]}});}})[_0xf06e('0x9')](function(_0x2c19a5){if(!_0x2c19a5){throw new db[(_0xf06e('0x19'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x2c19a5[_0xf06e('0x6')]||!_0x2c19a5[_0xf06e('0x7')]){throw new db['Sequelize'][(_0xf06e('0x1a'))](_0xf06e('0x23'));}_0x2578e4=_0x2c19a5;logger[_0xf06e('0x5')](util[_0xf06e('0xa')](_0xf06e('0x24'),_0x7b4c4['id']));return sentiment(_0x2578e4[_0xf06e('0x6')],_0x2578e4['data2'],_0x49fe5d[_0xf06e('0x1e')],_0x5c1a80[_0xf06e('0xe')],_0x49fe5d[_0xf06e('0x25')]);})['then'](function(_0x109218){logger[_0xf06e('0x5')](util[_0xf06e('0xa')](_0xf06e('0x26'),_0x7b4c4['id']));return _0x7b4c4[_0xf06e('0x17')]({'sentiment':_0x109218[_0xf06e('0x27')],'sPositive':_0x109218[_0xf06e('0x28')]['Positive'],'sNegative':_0x109218['SentimentScore'][_0xf06e('0x29')],'sMixed':_0x109218['SentimentScore'][_0xf06e('0x2a')],'sNeutral':_0x109218['SentimentScore'][_0xf06e('0x2b')]});})['then'](function(){logger[_0xf06e('0x5')](util[_0xf06e('0xa')](_0xf06e('0x18'),_0x7b4c4['id']));_0x5c36b3();});case _0xf06e('0x2c'):return _0x7b4c4[_0xf06e('0x17')]({'transcribeStatus':_0xf06e('0x2c'),'failureReason':_0x375f90['TranscriptionJob'][_0xf06e('0x2d')]})[_0xf06e('0x9')](function(){logger[_0xf06e('0x5')](util[_0xf06e('0xa')](_0xf06e('0x18'),_0x7b4c4['id']));_0x5c36b3();});default:logger[_0xf06e('0x5')](util[_0xf06e('0xa')](_0xf06e('0x2e'),_0x7b4c4['id']));break;}}else{return BPromise[_0xf06e('0x2f')]()[_0xf06e('0x9')](function(){if(!_0x7b4c4[_0xf06e('0x30')]){throw new db['Sequelize'][(_0xf06e('0x1a'))](_0xf06e('0x1b'));}if(!_0x49fe5d[_0xf06e('0x1c')]||!_0x49fe5d[_0xf06e('0x1d')]||!_0x49fe5d[_0xf06e('0x1e')]||!_0x49fe5d[_0xf06e('0x25')]||!_0x49fe5d[_0xf06e('0x1f')]){throw new db['Sequelize'][(_0xf06e('0x1a'))](_0xf06e('0x31'));}if(!_0x7b4c4['fileText']){throw new Error('Transcript\x20not\x20available');}if(_0x49fe5d[_0xf06e('0x1d')]===_0x3daa50['id']){return _0x3daa50;}else{return db[_0xf06e('0x21')][_0xf06e('0x22')]({'where':{'id':_settings[_0xf06e('0x1d')]}});}})[_0xf06e('0x9')](function(_0x410772){if(!_0x410772){throw new db['Sequelize']['ValidationError'](_0xf06e('0x32'));}if(!_0x410772['data1']||!_0x410772['data2']){throw new db['Sequelize'][(_0xf06e('0x1a'))](_0xf06e('0x23'));}_0x2578e4=_0x410772;logger['info'](util['format'](_0xf06e('0x24'),_0x7b4c4['id']));return sentiment(_0x2578e4[_0xf06e('0x6')],_0x2578e4['data2'],_0x49fe5d[_0xf06e('0x1e')],_0x7b4c4['fileText'],_0x49fe5d[_0xf06e('0x25')]);})[_0xf06e('0x9')](function(_0x41da27){logger[_0xf06e('0x5')](util['format'](_0xf06e('0x26'),_0x7b4c4['id']));return _0x7b4c4[_0xf06e('0x17')]({'sentiment':_0x41da27['Sentiment'],'sPositive':_0x41da27[_0xf06e('0x28')][_0xf06e('0x33')],'sNegative':_0x41da27[_0xf06e('0x28')][_0xf06e('0x29')],'sMixed':_0x41da27[_0xf06e('0x28')][_0xf06e('0x2a')],'sNeutral':_0x41da27[_0xf06e('0x28')][_0xf06e('0x2b')],'transcribeStatus':_0xf06e('0x10')});})[_0xf06e('0x9')](function(){logger[_0xf06e('0x5')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x7b4c4['id']));_0x5c36b3();});}})[_0xf06e('0x34')](function(_0x542b79){if(_0x542b79){if(!_0x542b79['name']||_0x542b79[_0xf06e('0x35')]!==_0xf06e('0x36')){logger[_0xf06e('0x37')](util[_0xf06e('0xa')](_0xf06e('0x38'),_0x7b4c4['id']),util[_0xf06e('0x39')](_0x542b79,{'showHidden':![],'depth':null}));}}_0x5c36b3();});});}function checkTranscribe(){var _0x195524;var _0x252629;var _0x4f7ce2;return db[_0xf06e('0x3a')][_0xf06e('0x3b')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xf06e('0x9')](function(_0x92394a){if(!_0x92394a||!_0x92394a[_0xf06e('0x16')]){throw new db['Sequelize']['ValidationError'](_0xf06e('0x3c'));}_0x195524=_0x92394a;return db[_0xf06e('0x3d')][_0xf06e('0x22')]({'where':{'id':0x1}});})['then'](function(_0x9ec791){if(!_0x9ec791){throw new db[(_0xf06e('0x19'))][(_0xf06e('0x1a'))](_0xf06e('0x3e'));}_0x252629=_0x9ec791;if(!_0x252629['transcribe']||!_0x252629['transcribeAccountId']||!_0x252629[_0xf06e('0x8')]||!_0x252629['language']||!_0x252629['bucket']){throw new db[(_0xf06e('0x19'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0xf06e('0x21')][_0xf06e('0x22')]({'where':{'id':_0x252629[_0xf06e('0x3f')]}});})[_0xf06e('0x9')](function(_0x4aca1){if(!_0x4aca1){throw new db[(_0xf06e('0x19'))][(_0xf06e('0x1a'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4aca1[_0xf06e('0x6')]||!_0x4aca1['data2']){throw new db[(_0xf06e('0x19'))]['ValidationError'](_0xf06e('0x23'));}_0x4f7ce2=_0x4aca1;var _0x1fe197=[];_0x195524[_0xf06e('0x40')](function(_0x2ca097){_0x1fe197[_0xf06e('0x41')](checkTranscribeJob(_0x2ca097,_0x252629,_0x4f7ce2));});return BPromise[_0xf06e('0x42')](_0x1fe197);})['catch'](function(_0x18b037){if(_0x18b037){if(!_0x18b037[_0xf06e('0x35')]||_0x18b037['name']!=='SequelizeValidationError'){logger['error'](util['inspect'](_0x18b037,{'showHidden':![],'depth':null}));}}});}exports[_0xf06e('0x43')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x0b25=['results','transcripts','length','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Mixed','Neutral','name','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','SequelizeValidationError','error','inspect','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','Comprehend','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','transcribeName','TranscriptionJobStatus','fileText','COMPLETED','TranscriptionJob','Transcript','TranscriptFileUri'];(function(_0x22ca98,_0x5e080a){var _0x2831e3=function(_0x42170a){while(--_0x42170a){_0x22ca98['push'](_0x22ca98['shift']());}};_0x2831e3(++_0x5e080a);}(_0x0b25,0x155));var _0x50b2=function(_0x2c0ded,_0x3de22c){_0x2c0ded=_0x2c0ded-0x0;var _0x4473e5=_0x0b25[_0x2c0ded];return _0x4473e5;};var _=require(_0x50b2('0x0'));var AWS=require(_0x50b2('0x1'));var rp=require(_0x50b2('0x2'));var util=require(_0x50b2('0x3'));var BPromise=require(_0x50b2('0x4'));var db=require(_0x50b2('0x5'))['db'];var logger=require(_0x50b2('0x6'))('transcribe');function getTranscriptionJob(_0x4bf98b,_0x2e34c1,_0x4b2838,_0x1df99a){return new Promise(function(_0x1b77e0,_0x3cbc65){var _0x29278f=new AWS[(_0x50b2('0x7'))]({'accessKeyId':_0x2e34c1,'secretAccessKey':_0x4bf98b,'region':_0x4b2838});_0x29278f['getTranscriptionJob']({'TranscriptionJobName':_0x1df99a},function(_0x2aeeb0,_0x2b7400){if(_0x2aeeb0){return _0x3cbc65(_0x2aeeb0);}else{return _0x1b77e0(_0x2b7400);}});});}function sentiment(_0x319f6f,_0x3c1e31,_0x54d618,_0x37811b,_0x593825){return new Promise(function(_0xfc6fa5,_0x3ace08){var _0x4f9d1b=new AWS[(_0x50b2('0x8'))]({'accessKeyId':_0x3c1e31,'secretAccessKey':_0x319f6f,'region':_0x54d618});_0x4f9d1b['detectSentiment']({'Text':_0x37811b,'LanguageCode':_0x593825['substring'](0x0,0x2)},function(_0x609232,_0xb79fde){if(_0x609232){return _0x3ace08(_0x609232);}else{return _0xfc6fa5(_0xb79fde);}});});}function checkTranscribeJob(_0x13ffd8,_0x453d53,_0x3eda73){var _0x3ab9e6;return new BPromise(function(_0x36067a,_0xd5b422){logger[_0x50b2('0x9')](util[_0x50b2('0xa')](_0x50b2('0xb'),_0x13ffd8['id'],_0x13ffd8['transcribeName']));return getTranscriptionJob(_0x3eda73[_0x50b2('0xc')],_0x3eda73[_0x50b2('0xd')],_0x453d53[_0x50b2('0xe')],_0x13ffd8['transcribeName'])[_0x50b2('0xf')](function(_0x112d57){logger[_0x50b2('0x9')](util[_0x50b2('0xa')](_0x50b2('0x10'),_0x13ffd8['id'],_0x13ffd8[_0x50b2('0x11')],_0x112d57['TranscriptionJob'][_0x50b2('0x12')]));if(!_0x13ffd8[_0x50b2('0x13')]){switch(_0x112d57['TranscriptionJob'][_0x50b2('0x12')]){case _0x50b2('0x14'):var _0x4959ef={'transcribeStatus':_0x112d57[_0x50b2('0x15')][_0x50b2('0x12')],'fileUri':_0x112d57['TranscriptionJob'][_0x50b2('0x16')][_0x50b2('0x17')]};logger[_0x50b2('0x9')](util[_0x50b2('0xa')]('[RECORDING:%d]\x20Get\x20transcript',_0x13ffd8['id']));return rp({'uri':_0x112d57[_0x50b2('0x15')][_0x50b2('0x16')][_0x50b2('0x17')],'json':!![]})[_0x50b2('0xf')](function(_0x20d71e){logger[_0x50b2('0x9')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x13ffd8['id']));if(_0x20d71e&&_0x20d71e['results']&&_0x20d71e[_0x50b2('0x18')][_0x50b2('0x19')]&&_0x20d71e[_0x50b2('0x18')][_0x50b2('0x19')][_0x50b2('0x1a')]){_0x4959ef['fileText']='';for(var _0x31b4d1=0x0;_0x31b4d1<_0x20d71e[_0x50b2('0x18')][_0x50b2('0x19')][_0x50b2('0x1a')];_0x31b4d1++){_0x4959ef[_0x50b2('0x13')]+=_0x20d71e[_0x50b2('0x18')][_0x50b2('0x19')][_0x31b4d1][_0x50b2('0x1b')]+'';}}return _0x13ffd8[_0x50b2('0x1c')](_0x4959ef);})[_0x50b2('0xf')](function(){logger[_0x50b2('0x9')](util[_0x50b2('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x13ffd8['id']));if(!_0x13ffd8[_0x50b2('0x1d')]){throw new db[(_0x50b2('0x1e'))][(_0x50b2('0x1f'))](_0x50b2('0x20'));}if(!_0x453d53[_0x50b2('0x21')]||!_0x453d53['sentimentAccountId']||!_0x453d53[_0x50b2('0x22')]||!_0x453d53[_0x50b2('0x23')]||!_0x453d53[_0x50b2('0x24')]){throw new db[(_0x50b2('0x1e'))]['ValidationError'](_0x50b2('0x25'));}if(!_0x4959ef[_0x50b2('0x13')]){throw new Error(_0x50b2('0x26'));}if(_0x453d53[_0x50b2('0x27')]===_0x3eda73['id']){return _0x3eda73;}else{return db[_0x50b2('0x28')][_0x50b2('0x29')]({'where':{'id':_settings[_0x50b2('0x27')]}});}})[_0x50b2('0xf')](function(_0x952d18){if(!_0x952d18){throw new db[(_0x50b2('0x1e'))][(_0x50b2('0x1f'))](_0x50b2('0x2a'));}if(!_0x952d18['data1']||!_0x952d18['data2']){throw new db[(_0x50b2('0x1e'))][(_0x50b2('0x1f'))](_0x50b2('0x2b'));}_0x3ab9e6=_0x952d18;logger[_0x50b2('0x9')](util['format'](_0x50b2('0x2c'),_0x13ffd8['id']));return sentiment(_0x3ab9e6['data1'],_0x3ab9e6[_0x50b2('0xd')],_0x453d53[_0x50b2('0x22')],_0x4959ef[_0x50b2('0x13')],_0x453d53['language']);})[_0x50b2('0xf')](function(_0x51ad88){logger[_0x50b2('0x9')](util[_0x50b2('0xa')](_0x50b2('0x2d'),_0x13ffd8['id']));return _0x13ffd8[_0x50b2('0x1c')]({'sentiment':_0x51ad88[_0x50b2('0x2e')],'sPositive':_0x51ad88['SentimentScore'][_0x50b2('0x2f')],'sNegative':_0x51ad88[_0x50b2('0x30')][_0x50b2('0x31')],'sMixed':_0x51ad88['SentimentScore']['Mixed'],'sNeutral':_0x51ad88[_0x50b2('0x30')]['Neutral']});})[_0x50b2('0xf')](function(){logger[_0x50b2('0x9')](util['format'](_0x50b2('0x32'),_0x13ffd8['id']));_0x36067a();});case'FAILED':return _0x13ffd8[_0x50b2('0x1c')]({'transcribeStatus':_0x50b2('0x33'),'failureReason':_0x112d57[_0x50b2('0x15')][_0x50b2('0x34')]})[_0x50b2('0xf')](function(){logger['info'](util[_0x50b2('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x13ffd8['id']));_0x36067a();});default:logger['info'](util['format'](_0x50b2('0x35'),_0x13ffd8['id']));break;}}else{return BPromise[_0x50b2('0x36')]()[_0x50b2('0xf')](function(){if(!_0x13ffd8['tempSentiment']){throw new db[(_0x50b2('0x1e'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x453d53['sentiment']||!_0x453d53[_0x50b2('0x27')]||!_0x453d53[_0x50b2('0x22')]||!_0x453d53['language']||!_0x453d53[_0x50b2('0x24')]){throw new db[(_0x50b2('0x1e'))][(_0x50b2('0x1f'))](_0x50b2('0x25'));}if(!_0x13ffd8['fileText']){throw new Error(_0x50b2('0x26'));}if(_0x453d53['sentimentAccountId']===_0x3eda73['id']){return _0x3eda73;}else{return db[_0x50b2('0x28')][_0x50b2('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x50b2('0xf')](function(_0x2e4781){if(!_0x2e4781){throw new db[(_0x50b2('0x1e'))]['ValidationError'](_0x50b2('0x2a'));}if(!_0x2e4781[_0x50b2('0xc')]||!_0x2e4781[_0x50b2('0xd')]){throw new db[(_0x50b2('0x1e'))][(_0x50b2('0x1f'))](_0x50b2('0x2b'));}_0x3ab9e6=_0x2e4781;logger['info'](util[_0x50b2('0xa')](_0x50b2('0x2c'),_0x13ffd8['id']));return sentiment(_0x3ab9e6['data1'],_0x3ab9e6[_0x50b2('0xd')],_0x453d53[_0x50b2('0x22')],_0x13ffd8[_0x50b2('0x13')],_0x453d53[_0x50b2('0x23')]);})['then'](function(_0x19509a){logger[_0x50b2('0x9')](util[_0x50b2('0xa')](_0x50b2('0x2d'),_0x13ffd8['id']));return _0x13ffd8[_0x50b2('0x1c')]({'sentiment':_0x19509a['Sentiment'],'sPositive':_0x19509a[_0x50b2('0x30')][_0x50b2('0x2f')],'sNegative':_0x19509a[_0x50b2('0x30')][_0x50b2('0x31')],'sMixed':_0x19509a[_0x50b2('0x30')][_0x50b2('0x37')],'sNeutral':_0x19509a[_0x50b2('0x30')][_0x50b2('0x38')],'transcribeStatus':_0x50b2('0x14')});})[_0x50b2('0xf')](function(){logger[_0x50b2('0x9')](util[_0x50b2('0xa')](_0x50b2('0x32'),_0x13ffd8['id']));_0x36067a();});}})['catch'](function(_0x467c2e){if(_0x467c2e){if(!_0x467c2e['name']||_0x467c2e[_0x50b2('0x39')]!=='SequelizeValidationError'){logger['error'](util[_0x50b2('0xa')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x13ffd8['id']),util['inspect'](_0x467c2e,{'showHidden':![],'depth':null}));}}_0x36067a();});});}function checkTranscribe(){var _0x52fea3;var _0x5f10b9;var _0x50919b;return db['VoiceRecording'][_0x50b2('0x3a')]({'where':{'transcribeStatus':_0x50b2('0x3b')}})[_0x50b2('0xf')](function(_0x5d5d86){if(!_0x5d5d86||!_0x5d5d86[_0x50b2('0x1a')]){throw new db['Sequelize'][(_0x50b2('0x1f'))](_0x50b2('0x3c'));}_0x52fea3=_0x5d5d86;return db[_0x50b2('0x3d')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x547117){if(!_0x547117){throw new db['Sequelize'][(_0x50b2('0x1f'))](_0x50b2('0x3e'));}_0x5f10b9=_0x547117;if(!_0x5f10b9[_0x50b2('0x3f')]||!_0x5f10b9['transcribeAccountId']||!_0x5f10b9[_0x50b2('0xe')]||!_0x5f10b9['language']||!_0x5f10b9['bucket']){throw new db[(_0x50b2('0x1e'))][(_0x50b2('0x1f'))](_0x50b2('0x40'));}return db[_0x50b2('0x28')][_0x50b2('0x29')]({'where':{'id':_0x5f10b9[_0x50b2('0x41')]}});})[_0x50b2('0xf')](function(_0x1f68fc){if(!_0x1f68fc){throw new db[(_0x50b2('0x1e'))][(_0x50b2('0x1f'))](_0x50b2('0x2a'));}if(!_0x1f68fc['data1']||!_0x1f68fc['data2']){throw new db[(_0x50b2('0x1e'))][(_0x50b2('0x1f'))](_0x50b2('0x2b'));}_0x50919b=_0x1f68fc;var _0x5e53f0=[];_0x52fea3[_0x50b2('0x42')](function(_0x125be7){_0x5e53f0[_0x50b2('0x43')](checkTranscribeJob(_0x125be7,_0x5f10b9,_0x50919b));});return BPromise[_0x50b2('0x44')](_0x5e53f0);})['catch'](function(_0x5b9b0f){if(_0x5b9b0f){if(!_0x5b9b0f[_0x50b2('0x39')]||_0x5b9b0f[_0x50b2('0x39')]!==_0x50b2('0x45')){logger[_0x50b2('0x46')](util[_0x50b2('0x47')](_0x5b9b0f,{'showHidden':![],'depth':null}));}}});}exports[_0x50b2('0x48')]=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 a3a1e38..effca35 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 _0xff8d=['YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger','redis','localhost','WhatsappInteraction','subtract','hours','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout'];(function(_0x5cfafb,_0x13f1bb){var _0x1e5480=function(_0x3910ac){while(--_0x3910ac){_0x5cfafb['push'](_0x5cfafb['shift']());}};_0x1e5480(++_0x13f1bb);}(_0xff8d,0xdf));var _0xdff8=function(_0x26e3a9,_0x5be104){_0x26e3a9=_0x26e3a9-0x0;var _0x4fa0ca=_0xff8d[_0x26e3a9];return _0x4fa0ca;};'use strict';var _=require(_0xdff8('0x0'));var moment=require('moment');var Redis=require(_0xdff8('0x1'));var util=require(_0xdff8('0x2'));var config=require(_0xdff8('0x3'));var db=require(_0xdff8('0x4'))['db'];var logger=require(_0xdff8('0x5'))('schedule');config[_0xdff8('0x6')]=_['defaults'](config['redis'],{'host':_0xdff8('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdff8('0x6')]));function closeInteractions(){var _0x48351a=[];return db[_0xdff8('0x8')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xdff8('0x9')](0x18,_0xdff8('0xa'))}}})[_0xdff8('0xb')](function(_0x3f724a){if(_0x3f724a&&_0x3f724a[_0xdff8('0xc')]){_0x48351a=_[_0xdff8('0xd')](_0x3f724a||[],'id');logger[_0xdff8('0xe')](_0xdff8('0xf'),_0x48351a[_0xdff8('0x10')]());return db['WhatsappInteraction'][_0xdff8('0x11')]({'closeReason':_0xdff8('0x12'),'disposition':_0xdff8('0x13'),'closed':!![],'closedAt':moment()['format'](_0xdff8('0x14'))},{'where':{'id':_0x48351a}});}})[_0xdff8('0xb')](function(){if(_0x48351a&&_0x48351a['length']){logger[_0xdff8('0xe')](_0xdff8('0x15'),_0x48351a[_0xdff8('0x10')]());for(var _0x5245aa=0x0;_0x5245aa<_0x48351a[_0xdff8('0xc')];_0x5245aa++){io[_0xdff8('0x16')](_0xdff8('0x17'),{'id':_0x48351a[_0x5245aa],'closed':!![]});}}})['catch'](function(_0xf10871){logger[_0xdff8('0x18')](_0xdff8('0x19'),_0xf10871?util[_0xdff8('0x1a')](_0xf10871,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x7c16=['defaults','localhost','socket.io-emitter','findAll','subtract','then','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','util','../../config/environment','../logger','redis'];(function(_0x50737e,_0x23d63c){var _0x3ac07c=function(_0x48464a){while(--_0x48464a){_0x50737e['push'](_0x50737e['shift']());}};_0x3ac07c(++_0x23d63c);}(_0x7c16,0x1c6));var _0x67c1=function(_0x1c0f8d,_0x1adacb){_0x1c0f8d=_0x1c0f8d-0x0;var _0x108dd2=_0x7c16[_0x1c0f8d];return _0x108dd2;};'use strict';var _=require('lodash');var moment=require(_0x67c1('0x0'));var Redis=require('ioredis');var util=require(_0x67c1('0x1'));var config=require(_0x67c1('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x67c1('0x3'))('schedule');config[_0x67c1('0x4')]=_[_0x67c1('0x5')](config[_0x67c1('0x4')],{'host':_0x67c1('0x6'),'port':0x18eb});var io=require(_0x67c1('0x7'))(new Redis(config[_0x67c1('0x4')]));function closeInteractions(){var _0xdeaf8f=[];return db['WhatsappInteraction'][_0x67c1('0x8')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x67c1('0x9')](0x18,'hours')}}})[_0x67c1('0xa')](function(_0x5f1d32){if(_0x5f1d32&&_0x5f1d32['length']){_0xdeaf8f=_['map'](_0x5f1d32||[],'id');logger[_0x67c1('0xb')](_0x67c1('0xc'),_0xdeaf8f[_0x67c1('0xd')]());return db[_0x67c1('0xe')][_0x67c1('0xf')]({'closeReason':_0x67c1('0x10'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x67c1('0x11'))},{'where':{'id':_0xdeaf8f}});}})[_0x67c1('0xa')](function(){if(_0xdeaf8f&&_0xdeaf8f[_0x67c1('0x12')]){logger['info'](_0x67c1('0x13'),_0xdeaf8f[_0x67c1('0xd')]());for(var _0x34bfc2=0x0;_0x34bfc2<_0xdeaf8f['length'];_0x34bfc2++){io[_0x67c1('0x14')](_0x67c1('0x15'),{'id':_0xdeaf8f[_0x34bfc2],'closed':!![]});}}})[_0x67c1('0x16')](function(_0x34ccd6){logger[_0x67c1('0x17')](_0x67c1('0x18'),_0x34ccd6?util[_0x67c1('0x19')](_0x34ccd6,{'showHidden':![],'depth':null}):'');});}exports[_0x67c1('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 4133f08..1a2a951 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3de6=['Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','destroy','CmContact','then','log','contacts1','CmHopper','bulkCreate','finished\x20populating','contacts2','hopper2','catch','util','../mysqldb','push'];(function(_0x4a405c,_0x23f82a){var _0x5daa12=function(_0x2bdf11){while(--_0x2bdf11){_0x4a405c['push'](_0x4a405c['shift']());}};_0x5daa12(++_0x23f82a);}(_0x3de6,0xbb));var _0x63de=function(_0x5ce759,_0x481b16){_0x5ce759=_0x5ce759-0x0;var _0x5b672c=_0x3de6[_0x5ce759];return _0x5b672c;};'use strict';var util=require(_0x63de('0x0'));var db=require(_0x63de('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x63de('0x2')]({'id':i,'firstName':_0x63de('0x3')+i,'lastName':_0x63de('0x4')+i,'phone':0xf879fb460+i,'email':_0x63de('0x5')+i+_0x63de('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x63de('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x63de('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x63de('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x63de('0x4')+i,'phone':0xf879fb460+i,'email':_0x63de('0x5')+i+_0x63de('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x63de('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x63de('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x63de('0x7')](),'updatedAt':Date['now']()});}db['CmContact'][_0x63de('0x8')]({'where':{}})['then'](function(){return db[_0x63de('0x9')]['bulkCreate'](contacts);})[_0x63de('0xa')](function(){console[_0x63de('0xb')]('finished\x20populating',_0x63de('0xc'));return db['CmHopper']['destroy']({'where':{}});})['then'](function(){return db[_0x63de('0xd')][_0x63de('0xe')](hopper);})[_0x63de('0xa')](function(){console[_0x63de('0xb')](_0x63de('0xf'),'hopper1');return db[_0x63de('0x9')][_0x63de('0xe')](contacts2);})['then'](function(){console[_0x63de('0xb')]('finished\x20populating',_0x63de('0x10'));return db[_0x63de('0xd')]['bulkCreate'](hopper2);})['then'](function(){console[_0x63de('0xb')](_0x63de('0xf'),_0x63de('0x11'));})[_0x63de('0x12')](function(_0x423f32){console[_0x63de('0xb')](_0x423f32);}); \ No newline at end of file +var _0xf100=['finished\x20populating','CmHopper','hopper1','CmContact','hopper2','catch','util','Biondo','innocenzo.biondo','@xcally.com','push','now','Innocenzo','destroy','then','bulkCreate','log'];(function(_0x2b21d2,_0x13f7bb){var _0x1fe4e7=function(_0x261952){while(--_0x261952){_0x2b21d2['push'](_0x2b21d2['shift']());}};_0x1fe4e7(++_0x13f7bb);}(_0xf100,0xe3));var _0x0f10=function(_0x15d41e,_0x4ccbff){_0x15d41e=_0x15d41e-0x0;var _0x8d9c1e=_0xf100[_0x15d41e];return _0x8d9c1e;};'use strict';var util=require(_0x0f10('0x0'));var db=require('../mysqldb')['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':_0x0f10('0x1')+i,'phone':0xf879fb460+i,'email':_0x0f10('0x2')+i+_0x0f10('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x0f10('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x0f10('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0f10('0x5')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0x0f10('0x6')+i,'lastName':_0x0f10('0x1')+i,'phone':0xf879fb460+i,'email':_0x0f10('0x2')+i+_0x0f10('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x0f10('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x0f10('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0f10('0x5')](),'updatedAt':Date[_0x0f10('0x5')]()});}db['CmContact'][_0x0f10('0x7')]({'where':{}})[_0x0f10('0x8')](function(){return db['CmContact'][_0x0f10('0x9')](contacts);})[_0x0f10('0x8')](function(){console[_0x0f10('0xa')](_0x0f10('0xb'),'contacts1');return db['CmHopper'][_0x0f10('0x7')]({'where':{}});})[_0x0f10('0x8')](function(){return db[_0x0f10('0xc')][_0x0f10('0x9')](hopper);})[_0x0f10('0x8')](function(){console[_0x0f10('0xa')]('finished\x20populating',_0x0f10('0xd'));return db[_0x0f10('0xe')]['bulkCreate'](contacts2);})[_0x0f10('0x8')](function(){console[_0x0f10('0xa')]('finished\x20populating','contacts2');return db[_0x0f10('0xc')][_0x0f10('0x9')](hopper2);})[_0x0f10('0x8')](function(){console[_0x0f10('0xa')](_0x0f10('0xb'),_0x0f10('0xf'));})[_0x0f10('0x10')](function(_0x4297f9){console[_0x0f10('0xa')](_0x4297f9);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index a642ce4..61a7b17 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadab=['%s%s','agent','password','friend','udp','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','then','add\x20user','catch','log','util','format'];(function(_0x31e0a2,_0x1b51ab){var _0x19d493=function(_0x55d390){while(--_0x55d390){_0x31e0a2['push'](_0x31e0a2['shift']());}};_0x19d493(++_0x1b51ab);}(_0xadab,0x64));var _0xbada=function(_0x4b90b3,_0x164fb2){_0x4b90b3=_0x4b90b3-0x0;var _0x45472e=_0xadab[_0x4b90b3];return _0x45472e;};'use strict';var util=require(_0xbada('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xbada('0x1')](_0xbada('0x2'),_0xbada('0x3'),i),'fullname':util['format'](_0xbada('0x2'),'agent',i),'email':util[_0xbada('0x1')]('%s%s@xcally.com',_0xbada('0x3'),i),'role':_0xbada('0x3'),'password':_0xbada('0x4'),'internal':0xfa0+i,'type':_0xbada('0x5'),'transport':[_0xbada('0x6'),'ws','wss'],'disallow':['all'],'allow':[_0xbada('0x7')],'defaultuser':util[_0xbada('0x1')](_0xbada('0x2'),_0xbada('0x3'),i),'encryption':_0xbada('0x8'),'avpf':_0xbada('0x8'),'force_avp':_0xbada('0x8'),'icesupport':_0xbada('0x8'),'dtlsenable':_0xbada('0x8'),'dtlsverify':'no','dtlscertfile':_0xbada('0x9'),'dtlsprivatekey':_0xbada('0xa'),'dtlssetup':'actpass','callerid':util[_0xbada('0x1')](_0xbada('0xb'),util[_0xbada('0x1')](_0xbada('0x2'),'agent',i),0xfa0+i)});}db[_0xbada('0xc')]['bulkCreate'](users)[_0xbada('0xd')](function(){console['log'](_0xbada('0xe'));})[_0xbada('0xf')](function(_0x55651e){console[_0xbada('0x10')](_0x55651e);}); \ No newline at end of file +var _0xff03=['%s%s@xcally.com','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','bulkCreate','then','log','catch','util','../mysqldb','push','format','agent','%s%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff03,0x1c6));var _0x3ff0=function(_0x3d35a5,_0x3490c4){_0x3d35a5=_0x3d35a5-0x0;var _0x197389=_0xff03[_0x3d35a5];return _0x197389;};'use strict';var util=require(_0x3ff0('0x0'));var db=require(_0x3ff0('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x3ff0('0x2')]({'name':util[_0x3ff0('0x3')]('%s%s',_0x3ff0('0x4'),i),'fullname':util[_0x3ff0('0x3')](_0x3ff0('0x5'),_0x3ff0('0x4'),i),'email':util[_0x3ff0('0x3')](_0x3ff0('0x6'),_0x3ff0('0x4'),i),'role':_0x3ff0('0x4'),'password':_0x3ff0('0x7'),'internal':0xfa0+i,'type':_0x3ff0('0x8'),'transport':[_0x3ff0('0x9'),'ws',_0x3ff0('0xa')],'disallow':['all'],'allow':[_0x3ff0('0xb')],'defaultuser':util[_0x3ff0('0x3')](_0x3ff0('0x5'),_0x3ff0('0x4'),i),'encryption':_0x3ff0('0xc'),'avpf':_0x3ff0('0xc'),'force_avp':_0x3ff0('0xc'),'icesupport':_0x3ff0('0xc'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x3ff0('0xd'),'dtlsprivatekey':_0x3ff0('0xe'),'dtlssetup':'actpass','callerid':util[_0x3ff0('0x3')](_0x3ff0('0xf'),util[_0x3ff0('0x3')](_0x3ff0('0x5'),_0x3ff0('0x4'),i),0xfa0+i)});}db['User'][_0x3ff0('0x10')](users)[_0x3ff0('0x11')](function(){console[_0x3ff0('0x12')]('add\x20user');})[_0x3ff0('0x13')](function(_0x2a575d){console[_0x3ff0('0x12')](_0x2a575d);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 2039862..adc162a 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21ab=['FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','userProfileId','SmsQueue','OpenchannelQueues','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','fax','sms','whatsapp','trunk:%s','campaign:%s:%s','type','leave','emit','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remoteAddress','connectedAt','nsp','disconnect','CONNECTED','util','../mysqldb','./environment','name','User','role','agent','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','Telephones','Trunks','findAll','resourceId','map','where','format','%s:queue:%s','Agents','length','user:%s','query','find','handshake','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x21ab,0x16c));var _0xb21a=function(_0x2f1908,_0x5d837d){_0x2f1908=_0x2f1908-0x0;var _0x357795=_0x21ab[_0x2f1908];return _0x357795;};'use strict';var _=require('lodash');var util=require(_0xb21a('0x0'));var BPromise=require('bluebird');var db=require(_0xb21a('0x1'))['db'];var config=require(_0xb21a('0x2'));var queryQueues={'attributes':['id',_0xb21a('0x3')],'include':[{'as':'Agents','model':db[_0xb21a('0x4')],'attributes':['id',_0xb21a('0x3'),_0xb21a('0x5')],'raw':!![],'where':{'role':_0xb21a('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0xb21a('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb21a('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb21a('0x3'),'type'],'where':{'type':_0xb21a('0x8')}};function getAssociatedResources(_0x223581,_0x52a426,_0xaf968b){return db[_0xb21a('0x9')][_0xb21a('0xa')]({'where':{'name':_0x223581,'userProfileId':_0x52a426},'raw':!![]})[_0xb21a('0xb')](function(_0x3df19a){if(_0x3df19a){if(_0x3df19a[_0xb21a('0xc')]){switch(_0x223581){case _0xb21a('0xd'):case _0xb21a('0xe'):case _0xb21a('0xf'):case _0xb21a('0x10'):case _0xb21a('0x11'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0xaf968b]['findAll'](queryQueues);case _0xb21a('0x12'):return db[_0xaf968b]['findAll'](queryTelephones);case _0xb21a('0x13'):return db[_0xaf968b]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0xaf968b][_0xb21a('0x14')](queryCampaigns);}}else{return db['UserProfileResource'][_0xb21a('0x14')]({'attributes':[_0xb21a('0x15')],'where':{'sectionId':_0x3df19a['id']},'raw':!![]})[_0xb21a('0xb')](function(_0xd1d9c2){if(_0xd1d9c2){var _0x156acc={'where':{'id':_[_0xb21a('0x16')](_0xd1d9c2,'resourceId')},'raw':!![]};switch(_0xaf968b){case _0xb21a('0x4'):_0x156acc[_0xb21a('0x17')]['role']=_0xb21a('0x7');break;case'Campaign':_0x156acc[_0xb21a('0x17')]['type']='ivr';break;}return db[_0xaf968b][_0xb21a('0x14')](_0x156acc);}else{return[];}});}}else{return[];}})[_0xb21a('0xb')](function(_0x341a24){return _0x341a24;});}function joinOrLeaveQueues(_0x194963,_0x1d162d,_0x3b30be,_0x4a17e5){_0x194963[_0x1d162d](util[_0xb21a('0x18')](_0xb21a('0x19'),_0x3b30be,_0x4a17e5[_0xb21a('0x3')]));if(_0x4a17e5[_0xb21a('0x1a')]){for(var _0x5eb05d=0x0;_0x5eb05d<_0x4a17e5['Agents'][_0xb21a('0x1b')];_0x5eb05d+=0x1){_0x194963[_0x1d162d](util[_0xb21a('0x18')](_0xb21a('0x1c'),_0x4a17e5[_0xb21a('0x1a')][_0x5eb05d][_0xb21a('0x3')]));}}}function joinOrLeave(_0x554892,_0x5e3279,_0x1952b6){var _0x368b70;if(_0x554892['handshake'][_0xb21a('0x1d')]['id']){db[_0xb21a('0x4')][_0xb21a('0x1e')]({'attributes':['id',_0xb21a('0x3'),_0xb21a('0x5'),'userProfileId'],'where':{'id':_0x554892[_0xb21a('0x1f')][_0xb21a('0x1d')]['id']},'include':[{'model':db[_0xb21a('0x20')],'as':_0xb21a('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xb21a('0x22')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb21a('0x23')],'as':_0xb21a('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xb21a('0x25')],'as':_0xb21a('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xb21a('0x27')],'as':_0xb21a('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xb21a('0x29')],'as':_0xb21a('0x2a'),'attributes':['id'],'raw':!![]}]})[_0xb21a('0xb')](function(_0x4e7e8c){if(_0x4e7e8c){_0x368b70=_0x4e7e8c;_0x554892[_0x5e3279](util[_0xb21a('0x18')]('user:%s',_0x4e7e8c[_0xb21a('0x3')]));var _0x5c72eb=[];switch(_0x4e7e8c[_0xb21a('0x5')]){case'admin':_0x554892[_0x5e3279](_0xb21a('0x2b'));_0x554892[_0x5e3279](_0xb21a('0x2c'));if(queryQueues[_0xb21a('0x2d')](_0xb21a('0x2e'))){delete queryQueues['include'];}_0x5c72eb[_0xb21a('0x2f')](db[_0xb21a('0x30')][_0xb21a('0x14')](queryQueues));_0x5c72eb[_0xb21a('0x2f')](db[_0xb21a('0x31')][_0xb21a('0x14')](queryQueues));_0x5c72eb['push'](db[_0xb21a('0x32')][_0xb21a('0x14')](queryQueues));_0x5c72eb['push'](db['SmsQueue'][_0xb21a('0x14')](queryQueues));_0x5c72eb[_0xb21a('0x2f')](db[_0xb21a('0x33')][_0xb21a('0x14')](queryQueues));_0x5c72eb[_0xb21a('0x2f')](db[_0xb21a('0x34')]['findAll'](queryQueues));_0x5c72eb[_0xb21a('0x2f')](db[_0xb21a('0x35')]['findAll'](queryQueues));_0x5c72eb[_0xb21a('0x2f')](db['User']['findAll'](queryTelephones));_0x5c72eb[_0xb21a('0x2f')](db[_0xb21a('0x36')][_0xb21a('0x14')](queryTrunks));_0x5c72eb[_0xb21a('0x2f')](db[_0xb21a('0x37')][_0xb21a('0x14')](queryCampaigns));_0x5c72eb['push'](db[_0xb21a('0x4')]['findAll'](queryAgents));break;case _0xb21a('0x38'):_0x554892[_0x5e3279](_0xb21a('0x2b'));_0x554892[_0x5e3279](_0xb21a('0x2c'));_0x5c72eb[_0xb21a('0x2f')](getAssociatedResources(_0xb21a('0xd'),_0x4e7e8c[_0xb21a('0x39')],_0xb21a('0x30')));_0x5c72eb[_0xb21a('0x2f')](getAssociatedResources('ChatQueues',_0x4e7e8c[_0xb21a('0x39')],_0xb21a('0x31')));_0x5c72eb['push'](getAssociatedResources(_0xb21a('0xf'),_0x4e7e8c[_0xb21a('0x39')],'FaxQueue'));_0x5c72eb[_0xb21a('0x2f')](getAssociatedResources(_0xb21a('0x10'),_0x4e7e8c[_0xb21a('0x39')],_0xb21a('0x3a')));_0x5c72eb[_0xb21a('0x2f')](getAssociatedResources(_0xb21a('0x11'),_0x4e7e8c[_0xb21a('0x39')],'MailQueue'));_0x5c72eb[_0xb21a('0x2f')](getAssociatedResources(_0xb21a('0x3b'),_0x4e7e8c[_0xb21a('0x39')],_0xb21a('0x34')));_0x5c72eb['push'](getAssociatedResources('WhatsappQueues',_0x4e7e8c[_0xb21a('0x39')],_0xb21a('0x35')));_0x5c72eb[_0xb21a('0x2f')](getAssociatedResources('Telephones',_0x4e7e8c['userProfileId'],_0xb21a('0x4')));_0x5c72eb[_0xb21a('0x2f')](getAssociatedResources('Trunks',_0x4e7e8c[_0xb21a('0x39')],_0xb21a('0x36')));_0x5c72eb[_0xb21a('0x2f')](getAssociatedResources(_0xb21a('0x3c'),_0x4e7e8c[_0xb21a('0x39')],_0xb21a('0x37')));_0x5c72eb[_0xb21a('0x2f')](db[_0xb21a('0x4')]['findAll'](queryAgents));break;case _0xb21a('0x6'):_0x554892[_0x5e3279](_0xb21a('0x2b'));_0x554892[_0x5e3279](_0xb21a('0x2c'));_0x5c72eb[_0xb21a('0x2f')](_0x4e7e8c[_0xb21a('0x3d')]({'attributes':['id',_0xb21a('0x3')]}));_0x5c72eb[_0xb21a('0x2f')](_0x4e7e8c[_0xb21a('0x3e')]({'attributes':['id',_0xb21a('0x3')]}));_0x5c72eb[_0xb21a('0x2f')](_0x4e7e8c[_0xb21a('0x3f')]({'attributes':['id',_0xb21a('0x3')]}));_0x5c72eb[_0xb21a('0x2f')](_0x4e7e8c[_0xb21a('0x40')]({'attributes':['id',_0xb21a('0x3')]}));_0x5c72eb['push'](_0x4e7e8c[_0xb21a('0x41')]({'attributes':['id',_0xb21a('0x3')]}));_0x5c72eb[_0xb21a('0x2f')](_0x4e7e8c[_0xb21a('0x42')]({'attributes':['id',_0xb21a('0x3')]}));_0x5c72eb[_0xb21a('0x2f')](_0x4e7e8c[_0xb21a('0x43')]({'attributes':['id',_0xb21a('0x3')]}));break;}return BPromise['all'](_0x5c72eb);}})['then'](function(_0x5b8036){if(_0x5b8036&&_0x5b8036[_0xb21a('0x1b')]){for(var _0x2d0829=0x0;_0x2d0829<_0x5b8036['length'];_0x2d0829+=0x1){for(var _0x28be41=0x0;_0x28be41<_0x5b8036[_0x2d0829][_0xb21a('0x1b')];_0x28be41+=0x1){switch(_0x2d0829){case 0x0:joinOrLeaveQueues(_0x554892,_0x5e3279,_0xb21a('0x44'),_0x5b8036[_0x2d0829][_0x28be41]);break;case 0x1:joinOrLeaveQueues(_0x554892,_0x5e3279,_0xb21a('0x45'),_0x5b8036[_0x2d0829][_0x28be41]);break;case 0x2:joinOrLeaveQueues(_0x554892,_0x5e3279,_0xb21a('0x46'),_0x5b8036[_0x2d0829][_0x28be41]);break;case 0x3:joinOrLeaveQueues(_0x554892,_0x5e3279,_0xb21a('0x47'),_0x5b8036[_0x2d0829][_0x28be41]);break;case 0x4:joinOrLeaveQueues(_0x554892,_0x5e3279,'mail',_0x5b8036[_0x2d0829][_0x28be41]);break;case 0x5:joinOrLeaveQueues(_0x554892,_0x5e3279,'openchannel',_0x5b8036[_0x2d0829][_0x28be41]);break;case 0x6:joinOrLeaveQueues(_0x554892,_0x5e3279,_0xb21a('0x48'),_0x5b8036[_0x2d0829][_0x28be41]);break;case 0x7:if(_0x368b70[_0xb21a('0x5')]!=='agent')_0x554892[_0x5e3279](util[_0xb21a('0x18')]('telephone:%s',_0x5b8036[_0x2d0829][_0x28be41][_0xb21a('0x3')]));break;case 0x8:if(_0x368b70[_0xb21a('0x5')]!==_0xb21a('0x6'))_0x554892[_0x5e3279](util[_0xb21a('0x18')](_0xb21a('0x49'),_0x5b8036[_0x2d0829][_0x28be41][_0xb21a('0x3')]));break;case 0x9:if(_0x368b70[_0xb21a('0x5')]!==_0xb21a('0x6'))_0x554892[_0x5e3279](util[_0xb21a('0x18')](_0xb21a('0x4a'),_0x5b8036[_0x2d0829][_0x28be41][_0xb21a('0x4b')],_0x5b8036[_0x2d0829][_0x28be41][_0xb21a('0x3')]));break;case 0xa:_0x554892[_0x5e3279](util[_0xb21a('0x18')](_0xb21a('0x1c'),_0x5b8036[_0x2d0829][_0x28be41]['name']));break;}}}}})[_0xb21a('0xb')](function(){if(_0x5e3279===_0xb21a('0x4c')){var _0x16b203=_['map'](_0x368b70[_0xb21a('0x21')],'id');return _0x368b70['removeChatInteractions'](_0x16b203)[_0xb21a('0xb')](function(){for(var _0x4952ee=0x0;_0x4952ee<_0x16b203[_0xb21a('0x1b')];_0x4952ee+=0x1){_0x1952b6[_0xb21a('0x4d')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x16b203[_0x4952ee]),'UserId':Number(_0x368b70['id'])});}});}})[_0xb21a('0xb')](function(){if(_0x5e3279===_0xb21a('0x4c')){var _0x2cdddf=_[_0xb21a('0x16')](_0x368b70[_0xb21a('0x4e')],'id');return _0x368b70[_0xb21a('0x4f')](_0x2cdddf)[_0xb21a('0xb')](function(){for(var _0x3e09e1=0x0;_0x3e09e1<_0x2cdddf[_0xb21a('0x1b')];_0x3e09e1+=0x1){_0x1952b6[_0xb21a('0x4d')](_0xb21a('0x50'),{'MailInteractionId':Number(_0x2cdddf[_0x3e09e1]),'UserId':Number(_0x368b70['id'])});}});}})['then'](function(){if(_0x5e3279===_0xb21a('0x4c')){var _0x15da15=_[_0xb21a('0x16')](_0x368b70['FaxInteractions'],'id');return _0x368b70[_0xb21a('0x51')](_0x15da15)['then'](function(){for(var _0x264bf1=0x0;_0x264bf1<_0x15da15[_0xb21a('0x1b')];_0x264bf1+=0x1){_0x1952b6[_0xb21a('0x4d')](_0xb21a('0x52'),{'FaxInteractionId':Number(_0x15da15[_0x264bf1]),'UserId':Number(_0x368b70['id'])});}});}})['then'](function(){if(_0x5e3279===_0xb21a('0x4c')){var _0x378989=_[_0xb21a('0x16')](_0x368b70[_0xb21a('0x26')],'id');return _0x368b70[_0xb21a('0x53')](_0x378989)[_0xb21a('0xb')](function(){for(var _0x390262=0x0;_0x390262<_0x378989[_0xb21a('0x1b')];_0x390262+=0x1){_0x1952b6[_0xb21a('0x4d')](_0xb21a('0x54'),{'SmsInteractionId':Number(_0x378989[_0x390262]),'UserId':Number(_0x368b70['id'])});}});}})[_0xb21a('0xb')](function(){if(_0x5e3279===_0xb21a('0x4c')){var _0x246c5d=_['map'](_0x368b70[_0xb21a('0x28')],'id');return _0x368b70[_0xb21a('0x55')](_0x246c5d)[_0xb21a('0xb')](function(){for(var _0x16e84d=0x0;_0x16e84d<_0x246c5d['length'];_0x16e84d+=0x1){_0x1952b6['emit'](_0xb21a('0x56'),{'OpenchannelInteractionId':Number(_0x246c5d[_0x16e84d]),'UserId':Number(_0x368b70['id'])});}});}})['then'](function(){if(_0x5e3279===_0xb21a('0x4c')){var _0x2b9a2d=_[_0xb21a('0x16')](_0x368b70[_0xb21a('0x2a')],'id');return _0x368b70['removeWhatsappInteractions'](_0x2b9a2d)[_0xb21a('0xb')](function(){for(var _0x39d7a6=0x0;_0x39d7a6<_0x2b9a2d[_0xb21a('0x1b')];_0x39d7a6+=0x1){_0x1952b6['emit'](_0xb21a('0x57'),{'WhatsappInteractionId':Number(_0x2b9a2d[_0x39d7a6]),'UserId':Number(_0x368b70['id'])});}});}})[_0xb21a('0x58')](function(_0x5f9923){_0x554892[_0xb21a('0x59')](_0x5f9923);});}}function onDisconnect(_0x143634,_0x30ff63){joinOrLeave(_0x143634,_0xb21a('0x4c'),_0x30ff63);}function onConnect(_0x3a6553){joinOrLeave(_0x3a6553,_0xb21a('0x5a'));}exports[_0xb21a('0x5b')]=function(_0x142a19){_0x142a19['on'](_0xb21a('0x5c'),function(_0x1c8667){_0x1c8667['setMaxListeners'](0x0);_0x1c8667[_0xb21a('0x5d')]=_0x1c8667[_0xb21a('0x5e')][_0xb21a('0x5c')][_0xb21a('0x5f')]+':'+_0x1c8667[_0xb21a('0x5e')]['connection']['remotePort'];_0x1c8667[_0xb21a('0x60')]=new Date();_0x1c8667[_0xb21a('0x59')]=function(_0x40adaf){console[_0xb21a('0x59')]('SocketIO\x20'+_0x1c8667[_0xb21a('0x61')][_0xb21a('0x3')]+'['+_0x1c8667[_0xb21a('0x5d')]+']',_0x40adaf);};_0x1c8667['on'](_0xb21a('0x62'),function(){onDisconnect(_0x1c8667,_0x142a19);_0x1c8667[_0xb21a('0x59')]('DISCONNECTED');});onConnect(_0x1c8667);_0x1c8667[_0xb21a('0x59')](_0xb21a('0x63'));});}; \ No newline at end of file +var _0x5430=['User','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','MailQueue','OpenchannelQueue','Trunk','ChatQueue','WhatsappQueue','getVoiceQueues','getChatQueues','getMailQueues','getWhatsappQueues','all','voice','chat','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remotePort','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','telephone','agent','type','ivr','UserProfileSection','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','map','resourceId','where','role','Campaign','%s:queue:%s','Agents','length','format','user:%s','handshake','query'];(function(_0x342bb9,_0x21fb90){var _0x39d7ef=function(_0x52b0e2){while(--_0x52b0e2){_0x342bb9['push'](_0x342bb9['shift']());}};_0x39d7ef(++_0x21fb90);}(_0x5430,0x10c));var _0x0543=function(_0x2aa8f2,_0x2ba779){_0x2aa8f2=_0x2aa8f2-0x0;var _0x69baf1=_0x5430[_0x2aa8f2];return _0x69baf1;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var BPromise=require(_0x0543('0x2'));var db=require(_0x0543('0x3'))['db'];var config=require(_0x0543('0x4'));var queryQueues={'attributes':['id',_0x0543('0x5')],'include':[{'as':'Agents','model':db['User'],'attributes':['id',_0x0543('0x5'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x0543('0x5')],'where':{'role':_0x0543('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0x0543('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x0543('0x5')],'where':{'role':_0x0543('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x0543('0x8')],'where':{'type':_0x0543('0x9')}};function getAssociatedResources(_0x2955ea,_0x200eb6,_0x2fb723){return db[_0x0543('0xa')]['findOne']({'where':{'name':_0x2955ea,'userProfileId':_0x200eb6},'raw':!![]})[_0x0543('0xb')](function(_0x1ac048){if(_0x1ac048){if(_0x1ac048['autoAssociation']){switch(_0x2955ea){case _0x0543('0xc'):case _0x0543('0xd'):case _0x0543('0xe'):case _0x0543('0xf'):case _0x0543('0x10'):case _0x0543('0x11'):case _0x0543('0x12'):return db[_0x2fb723][_0x0543('0x13')](queryQueues);case _0x0543('0x14'):return db[_0x2fb723][_0x0543('0x13')](queryTelephones);case _0x0543('0x15'):return db[_0x2fb723][_0x0543('0x13')](queryTrunks);case'IvrCampaigns':return db[_0x2fb723][_0x0543('0x13')](queryCampaigns);}}else{return db[_0x0543('0x16')]['findAll']({'attributes':['resourceId'],'where':{'sectionId':_0x1ac048['id']},'raw':!![]})[_0x0543('0xb')](function(_0x40fb03){if(_0x40fb03){var _0x1dff7d={'where':{'id':_[_0x0543('0x17')](_0x40fb03,_0x0543('0x18'))},'raw':!![]};switch(_0x2fb723){case'User':_0x1dff7d[_0x0543('0x19')][_0x0543('0x1a')]=_0x0543('0x6');break;case _0x0543('0x1b'):_0x1dff7d[_0x0543('0x19')][_0x0543('0x8')]=_0x0543('0x9');break;}return db[_0x2fb723]['findAll'](_0x1dff7d);}else{return[];}});}}else{return[];}})[_0x0543('0xb')](function(_0x5362cb){return _0x5362cb;});}function joinOrLeaveQueues(_0x50ea84,_0xbb8816,_0x419913,_0x1aece5){_0x50ea84[_0xbb8816](util['format'](_0x0543('0x1c'),_0x419913,_0x1aece5['name']));if(_0x1aece5[_0x0543('0x1d')]){for(var _0x411ec2=0x0;_0x411ec2<_0x1aece5['Agents'][_0x0543('0x1e')];_0x411ec2+=0x1){_0x50ea84[_0xbb8816](util[_0x0543('0x1f')](_0x0543('0x20'),_0x1aece5[_0x0543('0x1d')][_0x411ec2][_0x0543('0x5')]));}}}function joinOrLeave(_0xe14f94,_0x4adba7,_0x5979d2){var _0x59f1b2;if(_0xe14f94[_0x0543('0x21')][_0x0543('0x22')]['id']){db[_0x0543('0x23')][_0x0543('0x24')]({'attributes':['id',_0x0543('0x5'),_0x0543('0x1a'),_0x0543('0x25')],'where':{'id':_0xe14f94[_0x0543('0x21')][_0x0543('0x22')]['id']},'include':[{'model':db[_0x0543('0x26')],'as':_0x0543('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x0543('0x28')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0543('0x29')],'as':_0x0543('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x0543('0x2b')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0543('0x2c')],'as':_0x0543('0x2d'),'attributes':['id'],'raw':!![]},{'model':db[_0x0543('0x2e')],'as':_0x0543('0x2f'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x1732be){if(_0x1732be){_0x59f1b2=_0x1732be;_0xe14f94[_0x4adba7](util[_0x0543('0x1f')]('user:%s',_0x1732be['name']));var _0x3b71f0=[];switch(_0x1732be[_0x0543('0x1a')]){case'admin':_0xe14f94[_0x4adba7](_0x0543('0x30'));_0xe14f94[_0x4adba7](_0x0543('0x31'));if(queryQueues[_0x0543('0x32')](_0x0543('0x33'))){delete queryQueues[_0x0543('0x33')];}_0x3b71f0[_0x0543('0x34')](db[_0x0543('0x35')]['findAll'](queryQueues));_0x3b71f0[_0x0543('0x34')](db['ChatQueue'][_0x0543('0x13')](queryQueues));_0x3b71f0[_0x0543('0x34')](db[_0x0543('0x36')][_0x0543('0x13')](queryQueues));_0x3b71f0[_0x0543('0x34')](db['SmsQueue'][_0x0543('0x13')](queryQueues));_0x3b71f0['push'](db[_0x0543('0x37')][_0x0543('0x13')](queryQueues));_0x3b71f0[_0x0543('0x34')](db[_0x0543('0x38')]['findAll'](queryQueues));_0x3b71f0[_0x0543('0x34')](db['WhatsappQueue'][_0x0543('0x13')](queryQueues));_0x3b71f0[_0x0543('0x34')](db[_0x0543('0x23')][_0x0543('0x13')](queryTelephones));_0x3b71f0[_0x0543('0x34')](db[_0x0543('0x39')][_0x0543('0x13')](queryTrunks));_0x3b71f0[_0x0543('0x34')](db[_0x0543('0x1b')][_0x0543('0x13')](queryCampaigns));_0x3b71f0['push'](db[_0x0543('0x23')][_0x0543('0x13')](queryAgents));break;case'user':_0xe14f94[_0x4adba7](_0x0543('0x30'));_0xe14f94[_0x4adba7]('voice:outbound');_0x3b71f0[_0x0543('0x34')](getAssociatedResources(_0x0543('0xc'),_0x1732be['userProfileId'],'VoiceQueue'));_0x3b71f0[_0x0543('0x34')](getAssociatedResources(_0x0543('0xd'),_0x1732be['userProfileId'],_0x0543('0x3a')));_0x3b71f0[_0x0543('0x34')](getAssociatedResources('FaxQueues',_0x1732be[_0x0543('0x25')],_0x0543('0x36')));_0x3b71f0[_0x0543('0x34')](getAssociatedResources(_0x0543('0xf'),_0x1732be[_0x0543('0x25')],'SmsQueue'));_0x3b71f0['push'](getAssociatedResources('MailQueues',_0x1732be[_0x0543('0x25')],_0x0543('0x37')));_0x3b71f0[_0x0543('0x34')](getAssociatedResources(_0x0543('0x11'),_0x1732be['userProfileId'],_0x0543('0x38')));_0x3b71f0[_0x0543('0x34')](getAssociatedResources(_0x0543('0x12'),_0x1732be[_0x0543('0x25')],_0x0543('0x3b')));_0x3b71f0[_0x0543('0x34')](getAssociatedResources(_0x0543('0x14'),_0x1732be['userProfileId'],_0x0543('0x23')));_0x3b71f0[_0x0543('0x34')](getAssociatedResources(_0x0543('0x15'),_0x1732be[_0x0543('0x25')],_0x0543('0x39')));_0x3b71f0[_0x0543('0x34')](getAssociatedResources('IvrCampaigns',_0x1732be['userProfileId'],_0x0543('0x1b')));_0x3b71f0[_0x0543('0x34')](db[_0x0543('0x23')][_0x0543('0x13')](queryAgents));break;case _0x0543('0x7'):_0xe14f94[_0x4adba7](_0x0543('0x30'));_0xe14f94[_0x4adba7](_0x0543('0x31'));_0x3b71f0[_0x0543('0x34')](_0x1732be[_0x0543('0x3c')]({'attributes':['id','name']}));_0x3b71f0['push'](_0x1732be[_0x0543('0x3d')]({'attributes':['id',_0x0543('0x5')]}));_0x3b71f0['push'](_0x1732be['getFaxQueues']({'attributes':['id',_0x0543('0x5')]}));_0x3b71f0[_0x0543('0x34')](_0x1732be['getSmsQueues']({'attributes':['id',_0x0543('0x5')]}));_0x3b71f0['push'](_0x1732be[_0x0543('0x3e')]({'attributes':['id',_0x0543('0x5')]}));_0x3b71f0['push'](_0x1732be['getOpenchannelQueues']({'attributes':['id',_0x0543('0x5')]}));_0x3b71f0['push'](_0x1732be[_0x0543('0x3f')]({'attributes':['id',_0x0543('0x5')]}));break;}return BPromise[_0x0543('0x40')](_0x3b71f0);}})[_0x0543('0xb')](function(_0x158536){if(_0x158536&&_0x158536[_0x0543('0x1e')]){for(var _0x5a28a3=0x0;_0x5a28a3<_0x158536[_0x0543('0x1e')];_0x5a28a3+=0x1){for(var _0x21268c=0x0;_0x21268c<_0x158536[_0x5a28a3][_0x0543('0x1e')];_0x21268c+=0x1){switch(_0x5a28a3){case 0x0:joinOrLeaveQueues(_0xe14f94,_0x4adba7,_0x0543('0x41'),_0x158536[_0x5a28a3][_0x21268c]);break;case 0x1:joinOrLeaveQueues(_0xe14f94,_0x4adba7,_0x0543('0x42'),_0x158536[_0x5a28a3][_0x21268c]);break;case 0x2:joinOrLeaveQueues(_0xe14f94,_0x4adba7,'fax',_0x158536[_0x5a28a3][_0x21268c]);break;case 0x3:joinOrLeaveQueues(_0xe14f94,_0x4adba7,_0x0543('0x43'),_0x158536[_0x5a28a3][_0x21268c]);break;case 0x4:joinOrLeaveQueues(_0xe14f94,_0x4adba7,'mail',_0x158536[_0x5a28a3][_0x21268c]);break;case 0x5:joinOrLeaveQueues(_0xe14f94,_0x4adba7,_0x0543('0x44'),_0x158536[_0x5a28a3][_0x21268c]);break;case 0x6:joinOrLeaveQueues(_0xe14f94,_0x4adba7,_0x0543('0x45'),_0x158536[_0x5a28a3][_0x21268c]);break;case 0x7:if(_0x59f1b2[_0x0543('0x1a')]!==_0x0543('0x7'))_0xe14f94[_0x4adba7](util[_0x0543('0x1f')](_0x0543('0x46'),_0x158536[_0x5a28a3][_0x21268c]['name']));break;case 0x8:if(_0x59f1b2['role']!=='agent')_0xe14f94[_0x4adba7](util[_0x0543('0x1f')](_0x0543('0x47'),_0x158536[_0x5a28a3][_0x21268c]['name']));break;case 0x9:if(_0x59f1b2[_0x0543('0x1a')]!==_0x0543('0x7'))_0xe14f94[_0x4adba7](util[_0x0543('0x1f')](_0x0543('0x48'),_0x158536[_0x5a28a3][_0x21268c][_0x0543('0x8')],_0x158536[_0x5a28a3][_0x21268c][_0x0543('0x5')]));break;case 0xa:_0xe14f94[_0x4adba7](util['format'](_0x0543('0x20'),_0x158536[_0x5a28a3][_0x21268c][_0x0543('0x5')]));break;}}}}})[_0x0543('0xb')](function(){if(_0x4adba7===_0x0543('0x49')){var _0x2d36bf=_[_0x0543('0x17')](_0x59f1b2[_0x0543('0x27')],'id');return _0x59f1b2[_0x0543('0x4a')](_0x2d36bf)[_0x0543('0xb')](function(){for(var _0x1000ed=0x0;_0x1000ed<_0x2d36bf[_0x0543('0x1e')];_0x1000ed+=0x1){_0x5979d2[_0x0543('0x4b')](_0x0543('0x4c'),{'ChatInteractionId':Number(_0x2d36bf[_0x1000ed]),'UserId':Number(_0x59f1b2['id'])});}});}})[_0x0543('0xb')](function(){if(_0x4adba7==='leave'){var _0x14358d=_[_0x0543('0x17')](_0x59f1b2[_0x0543('0x4d')],'id');return _0x59f1b2[_0x0543('0x4e')](_0x14358d)[_0x0543('0xb')](function(){for(var _0x2980ad=0x0;_0x2980ad<_0x14358d[_0x0543('0x1e')];_0x2980ad+=0x1){_0x5979d2[_0x0543('0x4b')](_0x0543('0x4f'),{'MailInteractionId':Number(_0x14358d[_0x2980ad]),'UserId':Number(_0x59f1b2['id'])});}});}})[_0x0543('0xb')](function(){if(_0x4adba7===_0x0543('0x49')){var _0x100300=_[_0x0543('0x17')](_0x59f1b2[_0x0543('0x2a')],'id');return _0x59f1b2[_0x0543('0x50')](_0x100300)['then'](function(){for(var _0x402196=0x0;_0x402196<_0x100300[_0x0543('0x1e')];_0x402196+=0x1){_0x5979d2['emit'](_0x0543('0x51'),{'FaxInteractionId':Number(_0x100300[_0x402196]),'UserId':Number(_0x59f1b2['id'])});}});}})[_0x0543('0xb')](function(){if(_0x4adba7===_0x0543('0x49')){var _0x51df8d=_[_0x0543('0x17')](_0x59f1b2['SmsInteractions'],'id');return _0x59f1b2[_0x0543('0x52')](_0x51df8d)['then'](function(){for(var _0x31aea7=0x0;_0x31aea7<_0x51df8d['length'];_0x31aea7+=0x1){_0x5979d2[_0x0543('0x4b')](_0x0543('0x53'),{'SmsInteractionId':Number(_0x51df8d[_0x31aea7]),'UserId':Number(_0x59f1b2['id'])});}});}})[_0x0543('0xb')](function(){if(_0x4adba7==='leave'){var _0x117466=_[_0x0543('0x17')](_0x59f1b2[_0x0543('0x2d')],'id');return _0x59f1b2[_0x0543('0x54')](_0x117466)[_0x0543('0xb')](function(){for(var _0x42dbbf=0x0;_0x42dbbf<_0x117466[_0x0543('0x1e')];_0x42dbbf+=0x1){_0x5979d2[_0x0543('0x4b')](_0x0543('0x55'),{'OpenchannelInteractionId':Number(_0x117466[_0x42dbbf]),'UserId':Number(_0x59f1b2['id'])});}});}})[_0x0543('0xb')](function(){if(_0x4adba7===_0x0543('0x49')){var _0x2ff23a=_[_0x0543('0x17')](_0x59f1b2[_0x0543('0x2f')],'id');return _0x59f1b2[_0x0543('0x56')](_0x2ff23a)['then'](function(){for(var _0x5292c2=0x0;_0x5292c2<_0x2ff23a[_0x0543('0x1e')];_0x5292c2+=0x1){_0x5979d2[_0x0543('0x4b')](_0x0543('0x57'),{'WhatsappInteractionId':Number(_0x2ff23a[_0x5292c2]),'UserId':Number(_0x59f1b2['id'])});}});}})[_0x0543('0x58')](function(_0x97129){_0xe14f94[_0x0543('0x59')](_0x97129);});}}function onDisconnect(_0x4c4e49,_0x31213d){joinOrLeave(_0x4c4e49,_0x0543('0x49'),_0x31213d);}function onConnect(_0x51e4e2){joinOrLeave(_0x51e4e2,_0x0543('0x5a'));}exports[_0x0543('0x5b')]=function(_0x42f644){_0x42f644['on'](_0x0543('0x5c'),function(_0x5d7b59){_0x5d7b59[_0x0543('0x5d')](0x0);_0x5d7b59[_0x0543('0x5e')]=_0x5d7b59[_0x0543('0x5f')]['connection']['remoteAddress']+':'+_0x5d7b59[_0x0543('0x5f')][_0x0543('0x5c')][_0x0543('0x60')];_0x5d7b59['connectedAt']=new Date();_0x5d7b59[_0x0543('0x59')]=function(_0x1dfdd7){console[_0x0543('0x59')]('SocketIO\x20'+_0x5d7b59[_0x0543('0x61')][_0x0543('0x5')]+'['+_0x5d7b59[_0x0543('0x5e')]+']',_0x1dfdd7);};_0x5d7b59['on'](_0x0543('0x62'),function(){onDisconnect(_0x5d7b59,_0x42f644);_0x5d7b59[_0x0543('0x59')](_0x0543('0x63'));});onConnect(_0x5d7b59);_0x5d7b59[_0x0543('0x59')](_0x0543('0x64'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index d1c08df..6e47099 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 _0xdadd=['ContactId','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','User','find','name','email','interface','format','SIP/%s','channel','incomingmessage','outgoingmessage','get','motionChannel','closed','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','fullname','agent','changed','internal','default','hasOwnProperty','model','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','lodash','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxMessage','Mail','MailInteraction','substatus','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','catch','event','direction'];(function(_0x28baf2,_0x7a4bea){var _0x433d66=function(_0x11285f){while(--_0x11285f){_0x28baf2['push'](_0x28baf2['shift']());}};_0x433d66(++_0x7a4bea);}(_0xdadd,0x174));var _0xddad=function(_0xd3da2a,_0x22241c){_0xd3da2a=_0xd3da2a-0x0;var _0x10ab61=_0xdadd[_0xd3da2a];return _0x10ab61;};'use strict';var util=require(_0xddad('0x0'));var db=require(_0xddad('0x1'))['db'];var jayson=require(_0xddad('0x2'));var logger=require(_0xddad('0x3'))('triggers');var _=require(_0xddad('0x4'));var client=jayson['client'][_0xddad('0x5')]({'port':0x232a});var triggers=[{'channel':_0xddad('0x6'),'model':_0xddad('0x7'),'event':_0xddad('0x8'),'condition':_0xddad('0x9'),'callback':afterCreate},{'channel':_0xddad('0x6'),'model':_0xddad('0x7'),'event':_0xddad('0xa'),'condition':_0xddad('0xb'),'callback':afterUpdate},{'channel':_0xddad('0x6'),'model':_0xddad('0xc'),'event':_0xddad('0x8'),'condition':_0xddad('0xd'),'callback':afterCreateMessage},{'channel':_0xddad('0xe'),'model':_0xddad('0xf'),'event':_0xddad('0x8'),'condition':_0xddad('0x9'),'callback':afterCreate},{'channel':_0xddad('0xe'),'model':_0xddad('0xf'),'event':_0xddad('0xa'),'condition':_0xddad('0xb'),'callback':afterUpdate},{'channel':_0xddad('0xe'),'model':'SmsMessage','event':_0xddad('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xddad('0x10'),'model':'WhatsappInteraction','event':'afterCreate','condition':_0xddad('0x9'),'callback':afterCreate},{'channel':'Whatsapp','model':_0xddad('0x11'),'event':_0xddad('0xa'),'condition':_0xddad('0xb'),'callback':afterUpdate},{'channel':_0xddad('0x10'),'model':_0xddad('0x12'),'event':_0xddad('0x8'),'condition':_0xddad('0xd'),'callback':afterCreateMessage},{'channel':'Fax','model':'FaxInteraction','event':_0xddad('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xddad('0x13'),'model':'FaxInteraction','event':_0xddad('0xa'),'condition':_0xddad('0xb'),'callback':afterUpdate},{'channel':_0xddad('0x13'),'model':_0xddad('0x14'),'event':_0xddad('0x8'),'condition':_0xddad('0xd'),'callback':afterCreateMessage},{'channel':_0xddad('0x15'),'model':_0xddad('0x16'),'event':_0xddad('0x8'),'condition':_0xddad('0x9'),'callback':afterCreate},{'channel':_0xddad('0x15'),'model':'MailInteraction','event':_0xddad('0xa'),'condition':_0xddad('0xb'),'callback':afterUpdate},{'channel':_0xddad('0x15'),'model':_0xddad('0x16'),'event':_0xddad('0x17'),'condition':_0xddad('0x17'),'callback':afterUpdate},{'channel':'Mail','model':'MailMessage','event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xddad('0x18'),'model':'OpenchannelInteraction','event':_0xddad('0x8'),'condition':_0xddad('0x9'),'callback':afterCreate},{'channel':_0xddad('0x18'),'model':_0xddad('0x19'),'event':_0xddad('0xa'),'condition':_0xddad('0xb'),'callback':afterUpdate},{'channel':_0xddad('0x18'),'model':_0xddad('0x1a'),'event':_0xddad('0x8'),'condition':_0xddad('0xd'),'callback':afterCreateMessage}];function request(_0x597da1){return client[_0xddad('0x1b')](_0xddad('0x1c'),_0x597da1)[_0xddad('0x1d')](function(_0x51d690){logger[_0xddad('0x1e')](_0xddad('0x1f'),_0xddad('0x1c'),_0x51d690);if(_0x51d690[_0xddad('0x20')]){if(_0x51d690[_0xddad('0x20')]['code']===0x1f4){logger[_0xddad('0x20')](_0xddad('0x1f'),_0xddad('0x1c'),_0x51d690[_0xddad('0x20')]);}}})[_0xddad('0x21')](function(_0x3e485a){logger[_0xddad('0x20')](_0xddad('0x1f'),'EventManager',_0x3e485a);});}function afterCreateMessage(_0x1ea8a6,_0x4a42a9){return function(_0x2c6ef5,_0x42a526){_0x2c6ef5=_0x2c6ef5['get']({'plain':!![]});_0x2c6ef5['channel']=_0x1ea8a6;_0x2c6ef5['motionChannel']=_0x1ea8a6;_0x2c6ef5[_0xddad('0x22')]=_0x2c6ef5[_0xddad('0x23')];var _0x4eaf28='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2c6ef5[_0xddad('0x24')];return db[_0xddad('0x25')][_0xddad('0x26')](_0x4eaf28,{'type':db[_0xddad('0x27')][_0xddad('0x28')][_0xddad('0x29')],'raw':!![]})[_0xddad('0x1d')](function(_0x382cff){return _0x382cff;})[_0xddad('0x1d')](function(_0x4faf42){if(_0x4faf42){_0x2c6ef5[_0xddad('0x2a')]=_0x4faf42[0x0];}if(_0x2c6ef5[_0xddad('0x2b')]){return db[_0xddad('0x2c')][_0xddad('0x2d')]({'where':{'id':_0x2c6ef5[_0xddad('0x2b')]},'attributes':['id',_0xddad('0x2e'),'fullname',_0xddad('0x2f'),'internal'],'raw':!![]})[_0xddad('0x1d')](function(_0x4bb0d8){_0x2c6ef5[_0xddad('0x30')]=util[_0xddad('0x31')](_0xddad('0x32'),_0x4bb0d8[_0xddad('0x2e')]);_0x2c6ef5[_0xddad('0x33')]=_0x1ea8a6;_0x2c6ef5['agent']=_0x4bb0d8;return request({'event':_0xddad('0x34'),'message':_0x2c6ef5});})[_0xddad('0x21')](function(_0x3c3678){console['error'](_0x3c3678);});}else{return request({'event':_0xddad('0x35'),'message':_0x2c6ef5});}});};}function afterCreate(_0x2e8cf8,_0x13580a){return function(_0x22f0cf,_0x14d2ad){_0x22f0cf=_0x22f0cf[_0xddad('0x36')]({'plain':!![]});_0x22f0cf['channel']=_0x2e8cf8;_0x22f0cf[_0xddad('0x37')]=_0x2e8cf8;_0x22f0cf[_0xddad('0x22')]='opened';var _0x1cdfa6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x22f0cf[_0xddad('0x24')];return db[_0xddad('0x25')][_0xddad('0x26')](_0x1cdfa6,{'type':db[_0xddad('0x27')][_0xddad('0x28')][_0xddad('0x29')],'raw':!![]})['then'](function(_0x2751ca){return _0x2751ca;})[_0xddad('0x1d')](function(_0x427e51){if(_0x427e51){_0x22f0cf[_0xddad('0x2a')]=_0x427e51[0x0];}return request({'event':_0x13580a,'message':_0x22f0cf});});};}function afterUpdate(_0x216bbd,_0x119f34){return function(_0x57209d,_0x576146){if(_0x57209d['changed'](_0xddad('0x38'))&&_0x57209d[_0xddad('0x38')]){_0x57209d=_0x57209d[_0xddad('0x36')]({'plain':!![]});_0x57209d[_0xddad('0x33')]=_0x216bbd;_0x57209d[_0xddad('0x37')]=_0x216bbd;_0x57209d[_0xddad('0x22')]='closed';var _0x123040=_0xddad('0x39')+_0x57209d[_0xddad('0x24')];return db[_0xddad('0x25')][_0xddad('0x26')](_0x123040,{'type':db['Sequelize']['QueryTypes'][_0xddad('0x29')],'raw':!![]})['then'](function(_0x3ae15d){return _0x3ae15d;})[_0xddad('0x1d')](function(_0x69ae62){if(_0x69ae62){_0x57209d['contact']=_0x69ae62[0x0];}if(_0x57209d[_0xddad('0x2b')]){return db[_0xddad('0x2c')]['find']({'where':{'id':_0x57209d[_0xddad('0x2b')]},'attributes':['id',_0xddad('0x2e'),_0xddad('0x3a'),_0xddad('0x2f'),'internal'],'raw':!![]})['then'](function(_0x33ad5d){_0x57209d[_0xddad('0x30')]=util[_0xddad('0x31')]('SIP/%s',_0x33ad5d['name']);_0x57209d[_0xddad('0x3b')]=_0x33ad5d;return request({'event':_0x119f34,'message':_0x57209d});})['catch'](function(_0x368239){console['error'](_0x368239);});}else{return request({'event':_0x119f34,'message':_0x57209d});}});}else if(_0x57209d[_0xddad('0x3c')]('substatus')){_0x57209d=_0x57209d[_0xddad('0x36')]({'plain':!![]});_0x57209d[_0xddad('0x33')]=_0x216bbd;_0x57209d[_0xddad('0x22')]=_0xddad('0x17');var _0x123040=_0xddad('0x39')+_0x57209d[_0xddad('0x24')];return db[_0xddad('0x25')][_0xddad('0x26')](_0x123040,{'type':db[_0xddad('0x27')][_0xddad('0x28')]['SELECT'],'raw':!![]})[_0xddad('0x1d')](function(_0x4bdaf0){return _0x4bdaf0;})[_0xddad('0x1d')](function(_0x21c878){if(_0x21c878){_0x57209d[_0xddad('0x2a')]=_0x21c878[0x0];}if(_0x57209d[_0xddad('0x2b')]){return db[_0xddad('0x2c')][_0xddad('0x2d')]({'where':{'id':_0x57209d['UserId']},'attributes':['id','name',_0xddad('0x3a'),_0xddad('0x2f'),_0xddad('0x3d')],'raw':!![]})[_0xddad('0x1d')](function(_0x39ef03){_0x57209d[_0xddad('0x30')]=util[_0xddad('0x31')]('SIP/%s',_0x39ef03['name']);_0x57209d[_0xddad('0x3b')]=_0x39ef03;return request({'event':_0x119f34,'message':_0x57209d});})['catch'](function(_0x55b263){console[_0xddad('0x20')](_0x55b263);});}else{return request({'event':_0x119f34,'message':_0x57209d});}});}};}exports[_0xddad('0x3e')]=function(){for(var _0x2aaca6=0x0;_0x2aaca6=_0x513d3c[_0xc48e('0x15')]){throw Error(_0xc48e('0x16'));}_0x3f0e8e(_0x2625d9);})[_0xc48e('0x17')](function(_0x36dd82){_0x27ded3(_0x36dd82);});});}; \ No newline at end of file +var _0x090e=['chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel','includes','isUndefined','blockedAt','updateAttributes','agent','User','count','getLicense','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','./license/util','voice'];(function(_0x52a61d,_0x16d3a5){var _0xfee081=function(_0x43e865){while(--_0x43e865){_0x52a61d['push'](_0x52a61d['shift']());}};_0xfee081(++_0x16d3a5);}(_0x090e,0x15d));var _0xe090=function(_0x56e32e,_0x9eb2f6){_0x56e32e=_0x56e32e-0x0;var _0x2a757b=_0x090e[_0x56e32e];return _0x2a757b;};'use strict';var _=require(_0xe090('0x0'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require(_0xe090('0x1'));var channels=[_0xe090('0x2'),'mail',_0xe090('0x3'),_0xe090('0x4'),_0xe090('0x5'),_0xe090('0x6'),_0xe090('0x7')];exports[_0xe090('0x8')]=function(){return channels;};exports[_0xe090('0x9')]=function(_0x1fac66){_0x1fac66=_0x1fac66['toLowerCase']();return _[_0xe090('0xa')](channels,_0x1fac66);};exports['clearBlockUser']=function(_0x53b087,_0x409c63,_0x333c9b,_0x475794){var _0x1edf53={'loginAttempts':_0x409c63,'blocked':_0x333c9b};if(!_[_0xe090('0xb')](_0x475794)){_0x1edf53[_0xe090('0xc')]=_0x475794;}return _0x53b087[_0xe090('0xd')](_0x1edf53);};exports['getLicense']=function(_0x29db52){return new BPromise(function(_0x2c01ff,_0xd3a2e7){var _0x1cde66=0x0;if(_0x29db52['role']!==_0xe090('0xe')){_0x2c01ff(_0x29db52);}db[_0xe090('0xf')][_0xe090('0x10')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x29db52['id']}}})['then'](function(_0x48d8a9){_0x1cde66=_0x48d8a9;return util[_0xe090('0x11')]();})[_0xe090('0x12')](function(_0x50510c){if(_0x50510c&&_0x50510c['agents']&&_0x1cde66>=_0x50510c[_0xe090('0x13')]){throw Error(_0xe090('0x14'));}_0x2c01ff(_0x29db52);})[_0xe090('0x15')](function(_0x46cec3){_0xd3a2e7(_0x46cec3);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index a237cd8..6865b57 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa988=['status','render','send','exports','404'];(function(_0x2867d8,_0xef3ee0){var _0x3b8176=function(_0x2b9eb8){while(--_0x2b9eb8){_0x2867d8['push'](_0x2867d8['shift']());}};_0x3b8176(++_0xef3ee0);}(_0xa988,0x1a7));var _0x8a98=function(_0x38abfa,_0x27933f){_0x38abfa=_0x38abfa-0x0;var _0x30ca18=_0xa988[_0x38abfa];return _0x30ca18;};'use strict';module[_0x8a98('0x0')][0x194]=function pageNotFound(_0x3d6ea0,_0x3441ea){var _0x281c23=_0x8a98('0x1');var _0x59970e=0x194;var _0x14901a={'status':_0x59970e};_0x3441ea[_0x8a98('0x2')](_0x14901a[_0x8a98('0x2')]);_0x3441ea[_0x8a98('0x3')](_0x281c23,{},function(_0x3b1af2,_0x28a583){if(_0x3b1af2){return _0x3441ea[_0x8a98('0x2')](_0x14901a[_0x8a98('0x2')])['json'](_0x14901a);}_0x3441ea[_0x8a98('0x4')](_0x28a583);});}; \ No newline at end of file +var _0x1c2d=['render','json','exports','404','status'];(function(_0x12dd11,_0x4c7881){var _0x4d0d3b=function(_0x54e2b2){while(--_0x54e2b2){_0x12dd11['push'](_0x12dd11['shift']());}};_0x4d0d3b(++_0x4c7881);}(_0x1c2d,0x142));var _0xd1c2=function(_0x4b66ae,_0x367707){_0x4b66ae=_0x4b66ae-0x0;var _0x3bb455=_0x1c2d[_0x4b66ae];return _0x3bb455;};'use strict';module[_0xd1c2('0x0')][0x194]=function pageNotFound(_0x1d45b5,_0xb50d5d){var _0x170bbe=_0xd1c2('0x1');var _0xa2224c=0x194;var _0x1dfd0d={'status':_0xa2224c};_0xb50d5d[_0xd1c2('0x2')](_0x1dfd0d[_0xd1c2('0x2')]);_0xb50d5d[_0xd1c2('0x3')](_0x170bbe,{},function(_0x4f99b1,_0x45bf1b){if(_0x4f99b1){return _0xb50d5d[_0xd1c2('0x2')](_0x1dfd0d[_0xd1c2('0x2')])[_0xd1c2('0x4')](_0x1dfd0d);}_0xb50d5d['send'](_0x45bf1b);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 0e80863..d0a174e 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaf2c=['../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','cascade','hasMany','VoiceQueuesRt','UserId','Extensions','CmHopperHistory','HopperHistory','ReportAgentPreview','OpenchannelInteractions','SmsInteraction','FaxInteractions','MailInteractions','WhatsappInteraction','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','ChatGroup','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','CmList','cm_user_has_lists','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteractions','user_has_whatsapp_interactions','VoicePrefixes','MailQueue','MailQueues','ChatQueue','ChatQueues','FaxQueues','SmsQueue','WhatsappQueue','WhatsappQueues','ChatWebsites','FaxAccounts','user_has_fax_accounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProject','user_has_square_projects','ChanSpyId','VoiceContext','Applications','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperFinals','HopperHistories','HopperBlacks','Trunk','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','ContactId','MailServerIn','MailAccount','MailAccountId','hasOne','Imap','Smtp','Disposition','Dispositions','CannedAnswer','Answers','MailApplication','List','TemplateId','team_has_mail_queues','MailInteractionId','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','ChatOfflineMessage','ChatOfflineMessageId','restrict','TagId','ListId','Dashboard','Items','FaxAccountId','Interactions','Exntensions','fax_interaction_has_tags','FaxInteractionId','FaxMessage','AttachmentId','Account','team_has_fax_queues','SmsAccountId','mandatoryDispositionPause','SmsInteractionId','sms_interaction_has_tags','Interaction','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatInteraction','user_has_chat_websites','Agent','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Website','CmCompany','CompanyId','Company','cm_contact_has_tags','Queue','CampaignId','OwnerId','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','Trigger','TriggerAnyId','Fields','AnalyticMetric','MetricId','AccountId','SalesforceField','SubjectId','DescriptionId','FieldId','Subject','Description','VariableId','SugarcrmConfiguration','Configurations','Subjects','Descriptions','SugarcrmField','Field','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskConfiguration','Dynamics365Field','FreshsalesField','ChatQueueReport','FromId','SessionId','SmsQueueReport','ProjectId','user_has_teams','SmsQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','Lists','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToQueue','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','Queues','UserProfileSection','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','jstz','sequelize','defaultsDeep','motion2','xcall','xC@LL1234','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','127.0.0.1','mysql','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','../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','MemberReport','../api/memberReport/memberReport.model','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','../api/cmHopperHistory/cmHopperHistory.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport'];(function(_0x533528,_0x409d05){var _0x3189f1=function(_0x5e63d2){while(--_0x5e63d2){_0x533528['push'](_0x533528['shift']());}};_0x3189f1(++_0x409d05);}(_0xaf2c,0x10c));var _0xcaf2=function(_0x10b623,_0x3a0272){_0x10b623=_0x10b623-0x0;var _0x3959f0=_0xaf2c[_0x10b623];return _0x3959f0;};'use strict';var config=require(_0xcaf2('0x0'));var Sequelize=require('sequelize');var _=require('lodash');var jstz=require(_0xcaf2('0x1'));var timezone=jstz['determine']();config[_0xcaf2('0x2')]=_[_0xcaf2('0x3')](config[_0xcaf2('0x2')],{'database':_0xcaf2('0x4'),'username':_0xcaf2('0x5'),'password':_0xcaf2('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xcaf2('0x7')},'logging':![],'timezone':timezone[_0xcaf2('0x8')](),'define':{'charset':_0xcaf2('0x9'),'collate':_0xcaf2('0xa')}}});config[_0xcaf2('0xb')]=_[_0xcaf2('0x3')](config[_0xcaf2('0xb')],{'database':_0xcaf2('0x4'),'username':_0xcaf2('0x5'),'password':_0xcaf2('0x6'),'options':{'host':_0xcaf2('0xc'),'port':0xcea,'dialect':_0xcaf2('0xd'),'dialectOptions':{'charset':_0xcaf2('0x7')},'logging':![],'timezone':timezone[_0xcaf2('0x8')](),'define':{'charset':_0xcaf2('0x9'),'collate':_0xcaf2('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xcaf2('0x2')][_0xcaf2('0xe')],config[_0xcaf2('0x2')][_0xcaf2('0xf')],config['sequelize'][_0xcaf2('0x10')],config[_0xcaf2('0x2')][_0xcaf2('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xcaf2('0xb')][_0xcaf2('0xe')],config[_0xcaf2('0xb')][_0xcaf2('0xf')],config['sequelizeHistory'][_0xcaf2('0x10')],config[_0xcaf2('0xb')]['options'])};db[_0xcaf2('0x12')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x14'));db[_0xcaf2('0x15')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x16'));db['VoiceContext']=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x17'));db[_0xcaf2('0x18')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x19'));db[_0xcaf2('0x1a')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x1b'));db[_0xcaf2('0x1c')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/voiceQueue/voiceQueue.model');db[_0xcaf2('0x1d')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x1e'));db[_0xcaf2('0x1f')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x20'));db[_0xcaf2('0x21')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x22'));db[_0xcaf2('0x23')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x24'));db[_0xcaf2('0x25')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x26'));db['VoiceDialReport']=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x27'));db[_0xcaf2('0x28')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x29'));db['VoiceQueueReport']=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0xcaf2('0x2a')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x2b'));db['Trunk']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x2c'));db[_0xcaf2('0x2d')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x2e'));db[_0xcaf2('0x2f')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x30'));db[_0xcaf2('0x31')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x32'));db[_0xcaf2('0x33')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0xcaf2('0x34')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x35'));db[_0xcaf2('0x36')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x37'));db[_0xcaf2('0x38')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x39'));db[_0xcaf2('0x3a')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xcaf2('0x3b')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x3c'));db[_0xcaf2('0x3d')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/mailServerOut/mailServerOut.model');db['MailAccount']=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x3e'));db['MailQueue']=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x3f'));db[_0xcaf2('0x40')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x41'));db[_0xcaf2('0x42')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x43'));db[_0xcaf2('0x44')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x45'));db['MailApplication']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x46'));db[_0xcaf2('0x47')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x48'));db['Dashboard']=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x49'));db[_0xcaf2('0x4a')]=db['sequelize']['import'](_0xcaf2('0x4b'));db[_0xcaf2('0x4c')]=db[_0xcaf2('0x2')]['import']('../api/faxAccount/faxAccount.model');db[_0xcaf2('0x4d')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x4e'));db[_0xcaf2('0x4f')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x50'));db['FaxMessage']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x51'));db[_0xcaf2('0x52')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x53'));db[_0xcaf2('0x54')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/faxQueueReport/faxQueueReport.model');db[_0xcaf2('0x55')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x56'));db[_0xcaf2('0x57')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x58'));db['SmsInteraction']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x59'));db[_0xcaf2('0x5a')]=db[_0xcaf2('0x2')]['import']('../api/smsMessage/smsMessage.model');db['SmsQueue']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x5b'));db[_0xcaf2('0x5c')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x5d'));db['OpenchannelApplication']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x5e'));db[_0xcaf2('0x5f')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x60'));db[_0xcaf2('0x61')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x62'));db[_0xcaf2('0x63')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x64'));db[_0xcaf2('0x65')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x66'));db[_0xcaf2('0x67')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x68'));db[_0xcaf2('0x69')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x6a'));db['ChatInteraction']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x6b'));db[_0xcaf2('0x6c')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x6d'));db['ChatOfflineMessage']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x6e'));db['ChatQueue']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x6f'));db['ChatGroup']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x70'));db[_0xcaf2('0x71')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x72'));db['CmCompany']=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x73'));db[_0xcaf2('0x74')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x75'));db[_0xcaf2('0x76')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x77'));db[_0xcaf2('0x78')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x79'));db[_0xcaf2('0x7a')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x7b'));db['CmHopperHistory']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x7c'));db['ReportAgentPreview']=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xcaf2('0x7d')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x7e'));db[_0xcaf2('0x7f')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x80'));db[_0xcaf2('0x81')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x82'));db['CannedAnswer']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x83'));db['Disposition']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x84'));db[_0xcaf2('0x85')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x86'));db[_0xcaf2('0x87')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/interval/interval.model');db[_0xcaf2('0x88')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x89'));db[_0xcaf2('0x8a')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x8b'));db['VoiceQueuesLog']=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x8c'));db[_0xcaf2('0x8d')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x8e'));db[_0xcaf2('0x8f')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/sound/sound.model');db[_0xcaf2('0x90')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x91'));db[_0xcaf2('0x92')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x93'));db['Trigger']=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x94'));db[_0xcaf2('0x95')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/variable/variable.model');db[_0xcaf2('0x96')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x97'));db[_0xcaf2('0x98')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x99'));db[_0xcaf2('0x9a')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x9b'));db[_0xcaf2('0x9c')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x9d'));db[_0xcaf2('0x9e')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db['AnalyticMetric']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x9f'));db[_0xcaf2('0xa0')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xa1'));db[_0xcaf2('0xa2')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xa3'));db[_0xcaf2('0xa4')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xa5'));db[_0xcaf2('0xa6')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0xa7'));db['SalesforceField']=db['sequelize'][_0xcaf2('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0xcaf2('0xa8')]=db['sequelize']['import'](_0xcaf2('0xa9'));db['SugarcrmConfiguration']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xaa'));db['SugarcrmField']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xab'));db['DeskAccount']=db['sequelize']['import'](_0xcaf2('0xac'));db[_0xcaf2('0xad')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xae'));db[_0xcaf2('0xaf')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xb0'));db[_0xcaf2('0xb1')]=db[_0xcaf2('0x2')]['import']('../api/intZohoAccount/intZohoAccount.model');db[_0xcaf2('0xb2')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xcaf2('0xb3')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xb4'));db[_0xcaf2('0xb5')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xb6'));db['ZendeskConfiguration']=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xb7'));db[_0xcaf2('0xb8')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0xb9'));db[_0xcaf2('0xba')]=db['sequelize'][_0xcaf2('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xbb'));db[_0xcaf2('0xbc')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xbd'));db[_0xcaf2('0xbe')]=db[_0xcaf2('0x2')]['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0xcaf2('0xbf')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xc0'));db[_0xcaf2('0xc1')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xc2'));db[_0xcaf2('0xc3')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xcaf2('0xc4')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xc5'));db[_0xcaf2('0xc6')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/intServicenowField/intServicenowField.model');db[_0xcaf2('0xc7')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xc8'));db[_0xcaf2('0xc9')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xca'));db['Dynamics365Field']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xcb'));db[_0xcaf2('0xcc')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xcd'));db[_0xcaf2('0xce')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0xcf'));db['FreshsalesField']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xd0'));db[_0xcaf2('0x96')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x97'));db[_0xcaf2('0xd1')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0xd2'));db['ChatQueueReport']=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xd3'));db[_0xcaf2('0xd4')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xcaf2('0xd5')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xd6'));db[_0xcaf2('0xd7')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xd8'));db[_0xcaf2('0xd9')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xda'));db['SmsQueueReport']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xdb'));db[_0xcaf2('0xdc')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xdd'));db[_0xcaf2('0xde')]=db['sequelize']['import'](_0xcaf2('0xdf'));db[_0xcaf2('0xe0')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xe1'));db['Setting']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xe2'));db[_0xcaf2('0xe3')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xe4'));db['SquareProject']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xe5'));db[_0xcaf2('0xe6')]=db['sequelize'][_0xcaf2('0x13')]('../api/squareRecording/squareRecording.model');db[_0xcaf2('0xe7')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xe8'));db[_0xcaf2('0xe9')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xea'));db[_0xcaf2('0xeb')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/license/license.model');db[_0xcaf2('0xec')]=db['sequelize']['import'](_0xcaf2('0xed'));db[_0xcaf2('0xee')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0xef'));db[_0xcaf2('0xf0')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xf1'));db[_0xcaf2('0xf2')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xf3'));db[_0xcaf2('0xf4')]=db['sequelize'][_0xcaf2('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0xcaf2('0xf5')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0xf6'));db[_0xcaf2('0xf7')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xf8'));db['OpenchannelTransferReport']=db['sequelize']['import'](_0xcaf2('0xf9'));db[_0xcaf2('0xfa')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xfb'));db[_0xcaf2('0xfc')]=db['sequelize']['import'](_0xcaf2('0xfd'));db[_0xcaf2('0xfe')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0xff'));db['UserProfileSection']=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x100'));db[_0xcaf2('0x101')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x102'));db[_0xcaf2('0x103')]=db['sequelize'][_0xcaf2('0x13')]('../api/userNotification/userNotification.model');db[_0xcaf2('0x104')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x105'));db[_0xcaf2('0x106')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x107'));db['WhatsappInteraction']=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x108'));db['WhatsappMessage']=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x109'));db[_0xcaf2('0x10a')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x10b'));db[_0xcaf2('0x10c')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x10d'));db['WhatsappQueue']=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x10e'));db[_0xcaf2('0x10f')]=db[_0xcaf2('0x2')][_0xcaf2('0x13')](_0xcaf2('0x110'));db[_0xcaf2('0x111')]=db['sequelize'][_0xcaf2('0x13')](_0xcaf2('0x112'));db[_0xcaf2('0x113')]=db['sequelize']['import']('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0xcaf2('0x114')]=db[_0xcaf2('0x2')]['import'](_0xcaf2('0x115'));db[_0xcaf2('0x12')]['hasOne'](db['VoiceMail'],{'as':'VoiceMail','onDelete':_0xcaf2('0x116'),'foreignKey':'UserId'});db[_0xcaf2('0x12')]['hasMany'](db[_0xcaf2('0x1d')],{'as':'Recordings','foreignKey':'UserId'});db[_0xcaf2('0x12')][_0xcaf2('0x117')](db[_0xcaf2('0x2f')],{'as':_0xcaf2('0x118'),'foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x12')]['hasMany'](db[_0xcaf2('0x18')],{'as':_0xcaf2('0x11a'),'onDelete':_0xcaf2('0x116'),'hooks':!![]});db[_0xcaf2('0x12')][_0xcaf2('0x117')](db[_0xcaf2('0x7a')],{'as':'HopperFinals','foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x12')]['hasMany'](db[_0xcaf2('0x11b')],{'as':_0xcaf2('0x11c'),'foreignKey':'UserId'});db[_0xcaf2('0x12')][_0xcaf2('0x117')](db[_0xcaf2('0x11d')],{'as':'ReportAgentPreview','foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x12')][_0xcaf2('0x117')](db['OpenchannelInteraction'],{'as':_0xcaf2('0x11e'),'foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x12')][_0xcaf2('0x117')](db['ChatInteraction'],{'as':'ChatInteractions','foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x12')][_0xcaf2('0x117')](db[_0xcaf2('0x11f')],{'as':'SmsInteractions','foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x12')]['hasMany'](db[_0xcaf2('0x4f')],{'as':_0xcaf2('0x120'),'foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x12')][_0xcaf2('0x117')](db[_0xcaf2('0x42')],{'as':_0xcaf2('0x121'),'foreignKey':_0xcaf2('0x119')});db['User'][_0xcaf2('0x117')](db[_0xcaf2('0x122')],{'as':'WhatsappInteractions','foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x12')][_0xcaf2('0x117')](db['UserNotification'],{'as':_0xcaf2('0x123'),'foreignKey':_0xcaf2('0x124')});db['User'][_0xcaf2('0x125')](db[_0xcaf2('0xfe')],{'as':'UserProfile','foreignKey':_0xcaf2('0x126')});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x128')],{'as':_0xcaf2('0x129'),'through':_0xcaf2('0x12a')});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x12b'),'through':_0xcaf2('0x12c')});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x12d')],{'as':'Lists','through':_0xcaf2('0x12e')});db[_0xcaf2('0x12')]['belongsToMany'](db['Team'],{'through':'user_has_teams'});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db['MailInteraction'],{'as':_0xcaf2('0x121'),'through':'user_has_mail_interactions'});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db['ChatInteraction'],{'as':_0xcaf2('0x12f'),'through':_0xcaf2('0x130')});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x4f')],{'as':_0xcaf2('0x120'),'through':_0xcaf2('0x131')});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x11f')],{'as':_0xcaf2('0x132'),'through':_0xcaf2('0x133')});db[_0xcaf2('0x12')]['belongsToMany'](db[_0xcaf2('0x5f')],{'as':_0xcaf2('0x11e'),'through':_0xcaf2('0x134')});db[_0xcaf2('0x12')]['belongsToMany'](db[_0xcaf2('0x122')],{'as':_0xcaf2('0x135'),'through':_0xcaf2('0x136')});db[_0xcaf2('0x12')]['belongsToMany'](db[_0xcaf2('0x1c')],{'as':'VoiceQueues','through':_0xcaf2('0x31'),'required':![]});db['User'][_0xcaf2('0x127')](db[_0xcaf2('0xfc')],{'as':_0xcaf2('0x137'),'through':_0xcaf2('0x114'),'required':![]});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x138')],{'as':_0xcaf2('0x139'),'through':_0xcaf2('0x34'),'required':![]});db['User'][_0xcaf2('0x127')](db[_0xcaf2('0x13a')],{'as':_0xcaf2('0x13b'),'through':_0xcaf2('0x33'),'required':![],'hooks':!![]});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x52')],{'as':_0xcaf2('0x13c'),'through':_0xcaf2('0x36'),'required':![]});db[_0xcaf2('0x12')]['belongsToMany'](db[_0xcaf2('0x13d')],{'as':'SmsQueues','through':'UserSmsQueue','required':![]});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':'UserOpenchannelQueue','required':![]});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x13e')],{'as':_0xcaf2('0x13f'),'through':_0xcaf2('0x3b'),'required':![]});db['User'][_0xcaf2('0x127')](db[_0xcaf2('0x12d')],{'through':'cm_user_has_lists'});db[_0xcaf2('0x12')]['belongsToMany'](db[_0xcaf2('0x65')],{'as':_0xcaf2('0x140'),'through':'user_has_chat_websites'});db['User'][_0xcaf2('0x127')](db[_0xcaf2('0x4c')],{'as':_0xcaf2('0x141'),'through':_0xcaf2('0x142')});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db['MailAccount'],{'as':'MailAccounts','through':_0xcaf2('0x143')});db['User'][_0xcaf2('0x127')](db[_0xcaf2('0x5c')],{'as':'OpenchannelAccounts','through':_0xcaf2('0x144')});db['User'][_0xcaf2('0x127')](db['SmsAccount'],{'as':_0xcaf2('0x145'),'through':_0xcaf2('0x146')});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x104')],{'as':_0xcaf2('0x147'),'through':_0xcaf2('0x148')});db[_0xcaf2('0x12')][_0xcaf2('0x127')](db[_0xcaf2('0x149')],{'as':'SquareProjects','through':_0xcaf2('0x14a')});db['VoiceChanSpy']['hasMany'](db[_0xcaf2('0x18')],{'as':'SpiedAgents','onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x14b')});db[_0xcaf2('0x14c')][_0xcaf2('0x117')](db[_0xcaf2('0x18')],{'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x18')][_0xcaf2('0x117')](db[_0xcaf2('0x18')],{'as':_0xcaf2('0x14d'),'onDelete':'cascade'});db[_0xcaf2('0x1a')]['belongsToMany'](db[_0xcaf2('0x8f')],{'as':'Sounds','through':_0xcaf2('0x14e')});db[_0xcaf2('0x1c')][_0xcaf2('0x117')](db['UserVoiceQueueRt'],{'as':_0xcaf2('0x14f'),'foreignKey':_0xcaf2('0x150')});db[_0xcaf2('0x1c')][_0xcaf2('0x117')](db[_0xcaf2('0x76')],{'as':_0xcaf2('0x151'),'foreignKey':_0xcaf2('0x150')});db[_0xcaf2('0x1c')][_0xcaf2('0x117')](db[_0xcaf2('0x7a')],{'as':_0xcaf2('0x152'),'foreignKey':'VoiceQueueId'});db[_0xcaf2('0x1c')][_0xcaf2('0x117')](db[_0xcaf2('0x11b')],{'as':_0xcaf2('0x153'),'foreignKey':_0xcaf2('0x150')});db['VoiceQueue'][_0xcaf2('0x117')](db[_0xcaf2('0x11d')],{'as':_0xcaf2('0x11d'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xcaf2('0x117')](db[_0xcaf2('0x78')],{'as':_0xcaf2('0x154'),'foreignKey':_0xcaf2('0x150')});db[_0xcaf2('0x1c')][_0xcaf2('0x117')](db[_0xcaf2('0xd9')],{'as':'JscriptySessions','foreignKey':'VoiceQueueId'});db[_0xcaf2('0x1c')]['belongsTo'](db[_0xcaf2('0x155')],{'as':_0xcaf2('0x155'),'foreignKey':_0xcaf2('0x156')});db[_0xcaf2('0x1c')]['belongsTo'](db['Trunk'],{'as':_0xcaf2('0x157'),'foreignKey':_0xcaf2('0x158')});db[_0xcaf2('0x1c')][_0xcaf2('0x125')](db['Interval'],{'as':_0xcaf2('0x87'),'foreignKey':_0xcaf2('0x159')});db[_0xcaf2('0x1c')][_0xcaf2('0x125')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xcaf2('0x15a')});db[_0xcaf2('0x1c')]['belongsToMany'](db[_0xcaf2('0x12d')],{'as':'Lists','through':_0xcaf2('0x15b')});db['VoiceQueue']['belongsToMany'](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':_0xcaf2('0x31')});db[_0xcaf2('0x1c')][_0xcaf2('0x127')](db[_0xcaf2('0xe9')],{'as':_0xcaf2('0x15d'),'through':_0xcaf2('0x111')});db[_0xcaf2('0x1c')][_0xcaf2('0x127')](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x15e'),'through':_0xcaf2('0x15f')});db[_0xcaf2('0x1d')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':'User','foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x1f')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x12'),'foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x21')]['hasMany'](db[_0xcaf2('0x23')],{'as':_0xcaf2('0x160'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x161'),'sourceKey':_0xcaf2('0x162')});db[_0xcaf2('0x23')]['belongsTo'](db[_0xcaf2('0x21')],{'foreignKey':_0xcaf2('0x161'),'targetKey':_0xcaf2('0x162')});db[_0xcaf2('0x25')][_0xcaf2('0x117')](db['VoiceQueueReport'],{'as':_0xcaf2('0x163'),'foreignKey':_0xcaf2('0x164'),'constraints':![]});db[_0xcaf2('0x25')][_0xcaf2('0x117')](db[_0xcaf2('0x28')],{'as':_0xcaf2('0x165'),'foreignKey':_0xcaf2('0x164'),'constraints':![]});db['VoiceCallReport']['belongsTo'](db['User'],{'as':_0xcaf2('0x12'),'foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x25')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':'Contact','foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x167')][_0xcaf2('0x125')](db[_0xcaf2('0x168')],{'as':_0xcaf2('0x168'),'foreignKey':_0xcaf2('0x169')});db[_0xcaf2('0x3d')][_0xcaf2('0x125')](db[_0xcaf2('0x168')],{'as':_0xcaf2('0x168'),'foreignKey':'MailAccountId'});db[_0xcaf2('0x168')][_0xcaf2('0x16a')](db['MailServerIn'],{'as':_0xcaf2('0x16b'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x168')]['hasOne'](db[_0xcaf2('0x3d')],{'as':_0xcaf2('0x16c'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x168')]['hasMany'](db[_0xcaf2('0x16d')],{'as':_0xcaf2('0x16e'),'foreignKey':_0xcaf2('0x169'),'onDelete':'cascade'});db[_0xcaf2('0x168')][_0xcaf2('0x117')](db[_0xcaf2('0x16f')],{'as':_0xcaf2('0x170'),'foreignKey':_0xcaf2('0x169')});db[_0xcaf2('0x168')][_0xcaf2('0x117')](db[_0xcaf2('0x44')],{'as':_0xcaf2('0x160'),'foreignKey':_0xcaf2('0x169')});db['MailAccount'][_0xcaf2('0x117')](db[_0xcaf2('0x42')],{'as':'Interactions'});db[_0xcaf2('0x168')]['hasMany'](db[_0xcaf2('0x171')],{'as':_0xcaf2('0x14d')});db[_0xcaf2('0x168')][_0xcaf2('0x125')](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x172'),'foreignKey':'ListId'});db[_0xcaf2('0x168')]['belongsTo'](db[_0xcaf2('0x92')],{'as':_0xcaf2('0x92'),'foreignKey':_0xcaf2('0x173')});db[_0xcaf2('0x168')]['belongsTo'](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':_0xcaf2('0x143')});db[_0xcaf2('0x138')][_0xcaf2('0x127')](db['User'],{'as':_0xcaf2('0x15c'),'through':_0xcaf2('0x34')});db['MailQueue'][_0xcaf2('0x127')](db[_0xcaf2('0xe9')],{'through':_0xcaf2('0x174'),'as':'Teams'});db['MailInteraction'][_0xcaf2('0x117')](db['MailMessage'],{'as':_0xcaf2('0x160'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x175')});db['MailInteraction'][_0xcaf2('0x125')](db['MailAccount'],{'as':'Account','foreignKey':_0xcaf2('0x169')});db[_0xcaf2('0x42')]['belongsTo'](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x42')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x177'),'foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x42')][_0xcaf2('0x127')](db[_0xcaf2('0x90')],{'through':_0xcaf2('0x178'),'as':_0xcaf2('0x179')});db['MailInteraction'][_0xcaf2('0x127')](db[_0xcaf2('0x90')],{'through':_0xcaf2('0x178'),'as':_0xcaf2('0x17a')});db[_0xcaf2('0x42')]['belongsToMany'](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x17b'),'through':_0xcaf2('0x17c'),'foreignKey':'MailInteractionId'});db[_0xcaf2('0x44')][_0xcaf2('0x117')](db[_0xcaf2('0xf0')],{'as':_0xcaf2('0x17d'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x44')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x12')});db['MailMessage']['belongsTo'](db['CmContact'],{'onDelete':_0xcaf2('0x116'),'as':_0xcaf2('0x176')});db[_0xcaf2('0x44')]['belongsTo'](db[_0xcaf2('0x42')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0xcaf2('0x44')][_0xcaf2('0x125')](db[_0xcaf2('0x168')],{'as':'Account','foreignKey':_0xcaf2('0x169')});db[_0xcaf2('0x44')][_0xcaf2('0x125')](db['ChatWebsite'],{'as':_0xcaf2('0x65'),'foreignKey':'ChatWebsiteId'});db[_0xcaf2('0x44')][_0xcaf2('0x125')](db[_0xcaf2('0x17e')],{'as':_0xcaf2('0x17e'),'foreignKey':_0xcaf2('0x17f')});db[_0xcaf2('0x171')][_0xcaf2('0x125')](db['User'],{'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x171')][_0xcaf2('0x125')](db[_0xcaf2('0x138')],{'onDelete':_0xcaf2('0x180')});db['MailApplication']['belongsTo'](db[_0xcaf2('0x168')],{'onDelete':_0xcaf2('0x180')});db['MailApplication'][_0xcaf2('0x125')](db['Interval'],{'onDelete':_0xcaf2('0x180'),'foreignKey':'IntervalId'});db[_0xcaf2('0x171')][_0xcaf2('0x125')](db[_0xcaf2('0x90')],{'onDelete':_0xcaf2('0x180'),'foreignKey':_0xcaf2('0x181')});db['MailQueueReport'][_0xcaf2('0x125')](db['MailAccount'],{});db[_0xcaf2('0x47')][_0xcaf2('0x125')](db[_0xcaf2('0x12d')],{'as':'List','foreignKey':_0xcaf2('0x182')});db['MailQueueReport'][_0xcaf2('0x125')](db['CmContact'],{'as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166')});db['MailQueueReport']['belongsTo'](db['MailInteraction'],{});db['MailQueueReport'][_0xcaf2('0x125')](db[_0xcaf2('0x44')],{});db[_0xcaf2('0x47')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{});db[_0xcaf2('0x47')][_0xcaf2('0x125')](db[_0xcaf2('0x138')],{});db[_0xcaf2('0x183')][_0xcaf2('0x117')](db[_0xcaf2('0x4a')],{'as':_0xcaf2('0x184'),'onDelete':'cascade'});db[_0xcaf2('0x4c')][_0xcaf2('0x117')](db[_0xcaf2('0x16d')],{'as':_0xcaf2('0x16e'),'foreignKey':_0xcaf2('0x185'),'onDelete':_0xcaf2('0x116')});db['FaxAccount'][_0xcaf2('0x117')](db[_0xcaf2('0x16f')],{'as':_0xcaf2('0x170'),'foreignKey':'FaxAccountId'});db[_0xcaf2('0x4c')]['hasMany'](db[_0xcaf2('0x4f')],{'as':_0xcaf2('0x186')});db['FaxAccount'][_0xcaf2('0x117')](db['FaxApplication'],{'as':_0xcaf2('0x14d')});db[_0xcaf2('0x4c')][_0xcaf2('0x117')](db['VoiceExtension'],{'as':_0xcaf2('0x187'),'onDelete':'cascade'});db[_0xcaf2('0x4c')]['hasMany'](db['FaxMessage'],{'as':_0xcaf2('0x160')});db[_0xcaf2('0x4c')][_0xcaf2('0x125')](db[_0xcaf2('0x155')],{'as':_0xcaf2('0x155')});db[_0xcaf2('0x4c')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x4c')][_0xcaf2('0x125')](db[_0xcaf2('0x88')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xcaf2('0x4c')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':_0xcaf2('0x142')});db[_0xcaf2('0x4d')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'onDelete':'restrict'});db['FaxApplication']['belongsTo'](db['FaxQueue'],{'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x4d')][_0xcaf2('0x125')](db[_0xcaf2('0x4c')],{'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x4d')][_0xcaf2('0x125')](db[_0xcaf2('0x90')],{'onDelete':_0xcaf2('0x180'),'foreignKey':_0xcaf2('0x181')});db[_0xcaf2('0x4f')][_0xcaf2('0x117')](db['FaxMessage'],{'as':'Messages','onDelete':_0xcaf2('0x116'),'foreignKey':'FaxInteractionId'});db[_0xcaf2('0x4f')][_0xcaf2('0x125')](db[_0xcaf2('0x4c')],{'as':'Account','foreignKey':_0xcaf2('0x185')});db[_0xcaf2('0x4f')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x4f')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x177'),'foreignKey':_0xcaf2('0x119')});db['FaxInteraction'][_0xcaf2('0x127')](db[_0xcaf2('0x90')],{'through':_0xcaf2('0x188'),'as':_0xcaf2('0x179')});db[_0xcaf2('0x4f')][_0xcaf2('0x127')](db[_0xcaf2('0x90')],{'through':_0xcaf2('0x188'),'as':'ThroughTags'});db[_0xcaf2('0x4f')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x17b'),'through':_0xcaf2('0x131'),'foreignKey':_0xcaf2('0x189')});db[_0xcaf2('0x18a')]['belongsTo'](db['User'],{'onDelete':'cascade','as':'User'});db['FaxMessage'][_0xcaf2('0x125')](db[_0xcaf2('0x4f')],{'as':'Interaction','foreignKey':'FaxInteractionId'});db[_0xcaf2('0x18a')]['belongsTo'](db[_0xcaf2('0x74')],{'onDelete':_0xcaf2('0x116'),'as':_0xcaf2('0x176')});db['FaxMessage']['belongsTo'](db[_0xcaf2('0xf0')],{'as':'Attachment','foreignKey':_0xcaf2('0x18b')});db[_0xcaf2('0x18a')]['belongsTo'](db['FaxAccount'],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x185')});db[_0xcaf2('0x52')]['belongsToMany'](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':_0xcaf2('0x36')});db[_0xcaf2('0x52')][_0xcaf2('0x127')](db['Team'],{'through':_0xcaf2('0x18d'),'as':_0xcaf2('0x15d')});db[_0xcaf2('0x54')]['belongsTo'](db[_0xcaf2('0x4c')],{});db[_0xcaf2('0x54')][_0xcaf2('0x125')](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x172'),'foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x54')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x54')]['belongsTo'](db[_0xcaf2('0x4f')],{});db['FaxQueueReport'][_0xcaf2('0x125')](db[_0xcaf2('0x18a')],{});db[_0xcaf2('0x54')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{});db['FaxQueueReport'][_0xcaf2('0x125')](db['FaxQueue'],{});db[_0xcaf2('0x55')][_0xcaf2('0x117')](db['Disposition'],{'as':_0xcaf2('0x16e'),'foreignKey':_0xcaf2('0x18e'),'onDelete':_0xcaf2('0x116')});db['SmsAccount'][_0xcaf2('0x117')](db['CannedAnswer'],{'as':_0xcaf2('0x170'),'foreignKey':_0xcaf2('0x18e')});db['SmsAccount'][_0xcaf2('0x117')](db[_0xcaf2('0x5a')],{'as':_0xcaf2('0x160'),'foreignKey':_0xcaf2('0x18e')});db[_0xcaf2('0x55')][_0xcaf2('0x117')](db[_0xcaf2('0x11f')],{'as':_0xcaf2('0x186')});db[_0xcaf2('0x55')]['hasMany'](db[_0xcaf2('0x57')],{'as':_0xcaf2('0x14d')});db[_0xcaf2('0x55')][_0xcaf2('0x125')](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x172'),'foreignKey':_0xcaf2('0x182')});db['SmsAccount'][_0xcaf2('0x125')](db[_0xcaf2('0x88')],{'as':_0xcaf2('0x18f'),'foreignKey':_0xcaf2('0x15a')});db[_0xcaf2('0x55')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':'user_has_sms_accounts'});db['SmsApplication'][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'onDelete':_0xcaf2('0x180')});db['SmsApplication']['belongsTo'](db[_0xcaf2('0x13d')],{'onDelete':_0xcaf2('0x180')});db['SmsApplication'][_0xcaf2('0x125')](db['SmsAccount'],{'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x57')][_0xcaf2('0x125')](db[_0xcaf2('0x87')],{'onDelete':'restrict','foreignKey':_0xcaf2('0x159')});db[_0xcaf2('0x57')][_0xcaf2('0x125')](db[_0xcaf2('0x90')],{'onDelete':_0xcaf2('0x180'),'foreignKey':_0xcaf2('0x181')});db[_0xcaf2('0x11f')][_0xcaf2('0x117')](db['SmsMessage'],{'as':_0xcaf2('0x160'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x190')});db['SmsInteraction'][_0xcaf2('0x125')](db['SmsAccount'],{'as':_0xcaf2('0x18c'),'foreignKey':'SmsAccountId'});db['SmsInteraction']['belongsTo'](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166')});db['SmsInteraction'][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x177'),'foreignKey':'UserId'});db[_0xcaf2('0x11f')]['belongsToMany'](db[_0xcaf2('0x90')],{'through':_0xcaf2('0x191'),'as':_0xcaf2('0x179')});db[_0xcaf2('0x11f')][_0xcaf2('0x127')](db['Tag'],{'through':_0xcaf2('0x191'),'as':_0xcaf2('0x17a')});db[_0xcaf2('0x11f')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x17b'),'through':_0xcaf2('0x133'),'foreignKey':_0xcaf2('0x190')});db['SmsMessage']['belongsTo'](db['User'],{'as':_0xcaf2('0x12')});db[_0xcaf2('0x5a')]['belongsTo'](db[_0xcaf2('0x74')],{'onDelete':'cascade','as':_0xcaf2('0x176')});db['SmsMessage'][_0xcaf2('0x125')](db[_0xcaf2('0x11f')],{'onDelete':_0xcaf2('0x116'),'as':_0xcaf2('0x192'),'foreignKey':_0xcaf2('0x190')});db[_0xcaf2('0x5a')][_0xcaf2('0x125')](db['SmsAccount'],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x18e')});db[_0xcaf2('0x13d')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':_0xcaf2('0x38'),'foreignKey':_0xcaf2('0x193')});db[_0xcaf2('0x13d')][_0xcaf2('0x127')](db[_0xcaf2('0xe9')],{'through':_0xcaf2('0x194'),'as':_0xcaf2('0x15d')});db[_0xcaf2('0x5c')][_0xcaf2('0x117')](db[_0xcaf2('0x16d')],{'as':_0xcaf2('0x16e'),'foreignKey':_0xcaf2('0x195'),'onDelete':'cascade'});db[_0xcaf2('0x5c')][_0xcaf2('0x117')](db[_0xcaf2('0x16f')],{'as':_0xcaf2('0x170'),'foreignKey':_0xcaf2('0x195')});db[_0xcaf2('0x5c')][_0xcaf2('0x117')](db['OpenchannelInteraction'],{'as':'Interactions','foreignKey':'OpenchannelAccountId'});db[_0xcaf2('0x5c')][_0xcaf2('0x117')](db[_0xcaf2('0x61')],{'as':'Messages','foreignKey':_0xcaf2('0x195')});db[_0xcaf2('0x5c')][_0xcaf2('0x117')](db[_0xcaf2('0x196')],{'as':_0xcaf2('0x14d'),'foreignKey':_0xcaf2('0x195')});db[_0xcaf2('0x5c')]['belongsTo'](db[_0xcaf2('0x12d')],{'as':'List','foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x5c')][_0xcaf2('0x125')](db['Pause'],{'as':_0xcaf2('0x18f'),'foreignKey':_0xcaf2('0x15a')});db[_0xcaf2('0x5c')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':'user_has_openchannel_accounts'});db[_0xcaf2('0x196')][_0xcaf2('0x125')](db['User'],{'onDelete':'restrict'});db['OpenchannelApplication'][_0xcaf2('0x125')](db[_0xcaf2('0x63')],{'onDelete':_0xcaf2('0x180'),'foreignKey':_0xcaf2('0x197')});db[_0xcaf2('0x196')][_0xcaf2('0x125')](db[_0xcaf2('0x5c')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0xcaf2('0x196')]['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0xcaf2('0x159')});db[_0xcaf2('0x196')][_0xcaf2('0x125')](db[_0xcaf2('0x90')],{'onDelete':_0xcaf2('0x180'),'foreignKey':'TagId'});db[_0xcaf2('0x5f')][_0xcaf2('0x117')](db['OpenchannelMessage'],{'as':_0xcaf2('0x160'),'onDelete':'cascade','foreignKey':_0xcaf2('0x198')});db[_0xcaf2('0x5f')][_0xcaf2('0x125')](db[_0xcaf2('0x5c')],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x195')});db['OpenchannelInteraction'][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':'Contact','foreignKey':_0xcaf2('0x166')});db['OpenchannelInteraction'][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x177'),'foreignKey':'UserId'});db[_0xcaf2('0x5f')][_0xcaf2('0x127')](db['Tag'],{'through':_0xcaf2('0x199'),'as':_0xcaf2('0x179')});db[_0xcaf2('0x5f')][_0xcaf2('0x127')](db['Tag'],{'through':_0xcaf2('0x199'),'as':_0xcaf2('0x17a')});db[_0xcaf2('0x5f')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x17b'),'through':_0xcaf2('0x134'),'foreignKey':_0xcaf2('0x198')});db[_0xcaf2('0x61')]['belongsTo'](db[_0xcaf2('0x12')],{'onDelete':_0xcaf2('0x116'),'as':'User'});db[_0xcaf2('0x61')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'onDelete':_0xcaf2('0x116'),'as':'Contact'});db[_0xcaf2('0x61')][_0xcaf2('0x125')](db[_0xcaf2('0x5f')],{'onDelete':_0xcaf2('0x116'),'as':_0xcaf2('0x192'),'foreignKey':_0xcaf2('0x198')});db[_0xcaf2('0x61')][_0xcaf2('0x125')](db[_0xcaf2('0xf0')],{'as':_0xcaf2('0xf0'),'foreignKey':_0xcaf2('0x18b')});db[_0xcaf2('0x61')][_0xcaf2('0x125')](db[_0xcaf2('0x5c')],{'as':_0xcaf2('0x18c'),'foreignKey':'OpenchannelAccountId'});db[_0xcaf2('0x63')][_0xcaf2('0x127')](db['User'],{'as':'Agents','through':'UserOpenchannelQueue','foreignKey':_0xcaf2('0x197')});db[_0xcaf2('0x63')][_0xcaf2('0x127')](db[_0xcaf2('0xe9')],{'through':_0xcaf2('0x19a'),'as':_0xcaf2('0x15d')});db[_0xcaf2('0x65')][_0xcaf2('0x117')](db[_0xcaf2('0x16d')],{'as':_0xcaf2('0x16e'),'foreignKey':_0xcaf2('0x19b'),'onDelete':'cascade'});db[_0xcaf2('0x65')][_0xcaf2('0x117')](db['CannedAnswer'],{'as':'Answers','foreignKey':_0xcaf2('0x19b')});db[_0xcaf2('0x65')][_0xcaf2('0x117')](db[_0xcaf2('0x71')],{'as':_0xcaf2('0x19c')});db['ChatWebsite']['hasMany'](db[_0xcaf2('0x19d')],{'as':'Interactions'});db[_0xcaf2('0x65')][_0xcaf2('0x117')](db[_0xcaf2('0x69')],{'as':_0xcaf2('0x14d')});db[_0xcaf2('0x65')]['hasMany'](db['ChatMessage'],{'as':'Messages'});db[_0xcaf2('0x65')][_0xcaf2('0x125')](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x172'),'foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x65')][_0xcaf2('0x125')](db['Interval'],{'as':_0xcaf2('0x87'),'foreignKey':'IntervalId'});db[_0xcaf2('0x65')]['belongsTo'](db[_0xcaf2('0x168')],{'as':_0xcaf2('0x168'),'foreignKey':'MailAccountId'});db[_0xcaf2('0x65')][_0xcaf2('0x125')](db['Pause'],{'as':_0xcaf2('0x18f'),'foreignKey':_0xcaf2('0x15a')});db[_0xcaf2('0x65')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xcaf2('0x19e')});db[_0xcaf2('0x67')][_0xcaf2('0x125')](db[_0xcaf2('0x5c')],{});db['OpenchannelQueueReport'][_0xcaf2('0x125')](db['CmList'],{'as':_0xcaf2('0x172'),'foreignKey':'ListId'});db['OpenchannelQueueReport'][_0xcaf2('0x125')](db['CmContact'],{'as':'Contact','foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x67')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0xcaf2('0x67')]['belongsTo'](db['OpenchannelMessage'],{});db[_0xcaf2('0x67')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{});db[_0xcaf2('0x67')][_0xcaf2('0x125')](db[_0xcaf2('0x63')],{});db[_0xcaf2('0x69')]['belongsTo'](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x19f'),'foreignKey':_0xcaf2('0x119'),'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x69')][_0xcaf2('0x125')](db[_0xcaf2('0x13a')],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0xcaf2('0x180')});db['ChatApplication'][_0xcaf2('0x125')](db['ChatWebsite'],{'as':'Website','foreignKey':_0xcaf2('0x19b'),'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x69')][_0xcaf2('0x125')](db[_0xcaf2('0x90')],{'onDelete':_0xcaf2('0x180'),'foreignKey':'TagId'});db[_0xcaf2('0x19d')][_0xcaf2('0x117')](db['ChatMessage'],{'as':_0xcaf2('0x160'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1a0')});db[_0xcaf2('0x19d')][_0xcaf2('0x125')](db[_0xcaf2('0x65')],{'as':_0xcaf2('0x18c'),'foreignKey':'ChatWebsiteId'});db[_0xcaf2('0x19d')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':'Contact','foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x19d')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x177'),'foreignKey':_0xcaf2('0x119')});db[_0xcaf2('0x19d')][_0xcaf2('0x127')](db[_0xcaf2('0x90')],{'through':_0xcaf2('0x1a1'),'as':_0xcaf2('0x179')});db[_0xcaf2('0x19d')][_0xcaf2('0x127')](db['Tag'],{'through':_0xcaf2('0x1a1'),'as':_0xcaf2('0x17a')});db[_0xcaf2('0x19d')][_0xcaf2('0x127')](db['User'],{'as':_0xcaf2('0x17b'),'through':_0xcaf2('0x130'),'foreignKey':'ChatInteractionId'});db['ChatMessage']['belongsTo'](db[_0xcaf2('0x12')],{'onDelete':_0xcaf2('0x116'),'as':_0xcaf2('0x12')});db[_0xcaf2('0x6c')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'onDelete':'cascade','as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166')});db['ChatMessage'][_0xcaf2('0x125')](db[_0xcaf2('0x19d')],{'onDelete':_0xcaf2('0x116'),'as':_0xcaf2('0x192'),'foreignKey':'ChatInteractionId'});db[_0xcaf2('0x6c')][_0xcaf2('0x125')](db[_0xcaf2('0xf0')],{'as':_0xcaf2('0xf0'),'foreignKey':_0xcaf2('0x18b')});db[_0xcaf2('0x6c')][_0xcaf2('0x125')](db[_0xcaf2('0x65')],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x19b')});db[_0xcaf2('0x17e')][_0xcaf2('0x117')](db['Attachment'],{'as':'Attachments','foreignKey':_0xcaf2('0x17f'),'onDelete':_0xcaf2('0x116'),'hooks':!![]});db[_0xcaf2('0x17e')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'onDelete':'cascade','as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x17e')][_0xcaf2('0x125')](db[_0xcaf2('0x65')],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x19b')});db[_0xcaf2('0x13a')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':'Agents','through':_0xcaf2('0x33'),'hooks':!![]});db[_0xcaf2('0x13a')]['belongsToMany'](db[_0xcaf2('0xe9')],{'through':_0xcaf2('0x1a2'),'as':_0xcaf2('0x15d')});db[_0xcaf2('0x128')][_0xcaf2('0x117')](db[_0xcaf2('0xd4')],{'as':_0xcaf2('0x160'),'foreignKey':_0xcaf2('0x1a3'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x128')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':'Members','through':_0xcaf2('0x12a')});db[_0xcaf2('0x71')][_0xcaf2('0x125')](db[_0xcaf2('0x65')],{'as':_0xcaf2('0x1a4'),'foreignKey':_0xcaf2('0x19b')});db[_0xcaf2('0x1a5')][_0xcaf2('0x117')](db[_0xcaf2('0x74')],{'as':'Contacts','foreignKey':_0xcaf2('0x1a6')});db['CmContact'][_0xcaf2('0x117')](db[_0xcaf2('0x76')],{'as':_0xcaf2('0x151'),'foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x74')][_0xcaf2('0x117')](db[_0xcaf2('0x7a')],{'as':_0xcaf2('0x152'),'foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x74')]['hasMany'](db['CmHopperHistory'],{'as':_0xcaf2('0x153'),'foreignKey':'ContactId'});db['CmContact'][_0xcaf2('0x117')](db[_0xcaf2('0x11d')],{'as':_0xcaf2('0x11d'),'foreignKey':'ContactId'});db[_0xcaf2('0x74')][_0xcaf2('0x117')](db[_0xcaf2('0xd9')],{'as':'JscriptySessions','foreignKey':_0xcaf2('0x166')});db['CmContact'][_0xcaf2('0x117')](db[_0xcaf2('0x5f')],{'as':_0xcaf2('0x11e'),'foreignKey':_0xcaf2('0x166'),'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x74')][_0xcaf2('0x117')](db[_0xcaf2('0x19d')],{'as':'ChatInteractions','foreignKey':_0xcaf2('0x166'),'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x74')]['hasMany'](db['SmsInteraction'],{'as':_0xcaf2('0x132'),'foreignKey':'ContactId','onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x74')][_0xcaf2('0x117')](db[_0xcaf2('0x4f')],{'as':_0xcaf2('0x120'),'foreignKey':_0xcaf2('0x166'),'onDelete':_0xcaf2('0x180')});db['CmContact'][_0xcaf2('0x117')](db[_0xcaf2('0x42')],{'as':_0xcaf2('0x121'),'foreignKey':_0xcaf2('0x166'),'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x74')]['belongsTo'](db[_0xcaf2('0x1a5')],{'as':_0xcaf2('0x1a7'),'foreignKey':_0xcaf2('0x1a6')});db[_0xcaf2('0x74')][_0xcaf2('0x125')](db[_0xcaf2('0x12d')],{'as':'List','foreignKey':_0xcaf2('0x182'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x74')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':'Users','through':_0xcaf2('0x12c')});db[_0xcaf2('0x74')][_0xcaf2('0x127')](db[_0xcaf2('0x90')],{'as':_0xcaf2('0x179'),'through':_0xcaf2('0x1a8')});db[_0xcaf2('0x74')][_0xcaf2('0x127')](db[_0xcaf2('0x90')],{'through':_0xcaf2('0x1a8'),'as':'ThroughTags'});db[_0xcaf2('0x76')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166'),'onDelete':'cascade'});db[_0xcaf2('0x76')]['belongsTo'](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x172'),'foreignKey':_0xcaf2('0x182'),'onDelete':'cascade'});db[_0xcaf2('0x76')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x19f'),'foreignKey':'UserId'});db[_0xcaf2('0x76')][_0xcaf2('0x125')](db['VoiceQueue'],{'as':_0xcaf2('0x1a9'),'foreignKey':_0xcaf2('0x150'),'onDelete':_0xcaf2('0x116')});db['CmHopper']['belongsTo'](db[_0xcaf2('0xec')],{'as':_0xcaf2('0xec'),'foreignKey':_0xcaf2('0x1aa'),'onDelete':_0xcaf2('0x116')});db['CmHopper'][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x177'),'foreignKey':_0xcaf2('0x1ab')});db[_0xcaf2('0x78')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x176'),'foreignKey':'ContactId','onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x78')][_0xcaf2('0x125')](db['CmList'],{'as':_0xcaf2('0x172'),'foreignKey':'ListId','onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x78')]['belongsTo'](db[_0xcaf2('0x1c')],{'as':_0xcaf2('0x1a9'),'foreignKey':_0xcaf2('0x150'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x78')][_0xcaf2('0x125')](db[_0xcaf2('0xec')],{'as':_0xcaf2('0xec'),'foreignKey':'CampaignId','onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x81')][_0xcaf2('0x117')](db[_0xcaf2('0x85')],{'as':{'plural':'All','singular':_0xcaf2('0x1ac')},'foreignKey':_0xcaf2('0x1ad'),'onDelete':_0xcaf2('0x116'),'hooks':!![]});db[_0xcaf2('0x81')][_0xcaf2('0x117')](db[_0xcaf2('0x85')],{'as':{'plural':_0xcaf2('0x1ae'),'singular':_0xcaf2('0x1af')},'foreignKey':_0xcaf2('0x1b0'),'onDelete':'cascade','hooks':!![]});db[_0xcaf2('0x81')][_0xcaf2('0x117')](db[_0xcaf2('0x7f')],{'as':_0xcaf2('0x1b1'),'foreignKey':_0xcaf2('0x1b2'),'onDelete':_0xcaf2('0x116'),'hooks':!![]});db[_0xcaf2('0x16d')]['hasMany'](db[_0xcaf2('0x16d')],{'as':'Dispositions','foreignKey':_0xcaf2('0x1b3'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x87')]['hasMany'](db[_0xcaf2('0x87')],{'as':_0xcaf2('0x1b4'),'foreignKey':_0xcaf2('0x159'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xcaf2('0x87')][_0xcaf2('0x117')](db[_0xcaf2('0x18')],{'as':_0xcaf2('0x11a'),'foreignKey':_0xcaf2('0x159'),'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x87')][_0xcaf2('0x117')](db[_0xcaf2('0x171')],{'as':_0xcaf2('0x1b5'),'foreignKey':_0xcaf2('0x159')});db[_0xcaf2('0x87')][_0xcaf2('0x117')](db[_0xcaf2('0x69')],{'as':'ChatApplications','foreignKey':'IntervalId'});db[_0xcaf2('0x87')][_0xcaf2('0x117')](db[_0xcaf2('0x4d')],{'as':'FaxApplications','foreignKey':'IntervalId'});db[_0xcaf2('0x87')][_0xcaf2('0x117')](db[_0xcaf2('0x57')],{'as':_0xcaf2('0x1b6'),'foreignKey':_0xcaf2('0x159')});db[_0xcaf2('0x8d')][_0xcaf2('0x125')](db['MailAccount'],{});db[_0xcaf2('0x8d')][_0xcaf2('0x125')](db[_0xcaf2('0x9c')],{'foreignKey':_0xcaf2('0x1b7')});db[_0xcaf2('0x8d')][_0xcaf2('0x125')](db['AnalyticCustomReport'],{'foreignKey':_0xcaf2('0x1b8')});db[_0xcaf2('0x8f')]['belongsToMany'](db[_0xcaf2('0x1a')],{'as':_0xcaf2('0x1b9'),'through':_0xcaf2('0x14e'),'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x90')]['belongsToMany'](db[_0xcaf2('0x74')],{'through':_0xcaf2('0x1a8')});db[_0xcaf2('0x90')][_0xcaf2('0x127')](db['ChatInteraction'],{'through':_0xcaf2('0x1a1')});db[_0xcaf2('0x90')][_0xcaf2('0x127')](db[_0xcaf2('0x42')],{'through':_0xcaf2('0x178')});db['Tag']['belongsToMany'](db[_0xcaf2('0x11f')],{'through':_0xcaf2('0x191')});db[_0xcaf2('0x90')][_0xcaf2('0x127')](db[_0xcaf2('0x4f')],{'through':_0xcaf2('0x188')});db[_0xcaf2('0x90')]['belongsToMany'](db[_0xcaf2('0x5f')],{'through':_0xcaf2('0x199')});db[_0xcaf2('0x90')][_0xcaf2('0x127')](db['WhatsappInteraction'],{'through':_0xcaf2('0x1ba')});db['Trigger'][_0xcaf2('0x117')](db[_0xcaf2('0x85')],{'as':{'plural':_0xcaf2('0x1bb'),'singular':_0xcaf2('0x1bc')},'foreignKey':_0xcaf2('0x1bd'),'onDelete':_0xcaf2('0x116'),'hooks':!![]});db[_0xcaf2('0x1be')]['hasMany'](db[_0xcaf2('0x85')],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0xcaf2('0x1bf'),'onDelete':'cascade','hooks':!![]});db['Trigger'][_0xcaf2('0x117')](db['Action'],{'as':_0xcaf2('0x1b1'),'foreignKey':'TriggerId','onDelete':_0xcaf2('0x116'),'hooks':!![]});db[_0xcaf2('0x9a')]['hasMany'](db['AnalyticFieldReport'],{'as':_0xcaf2('0x1c0'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1b8'),'hooks':!![]});db[_0xcaf2('0x9c')][_0xcaf2('0x117')](db[_0xcaf2('0xa0')],{'as':_0xcaf2('0x1c0'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1b7')});db[_0xcaf2('0x1c1')][_0xcaf2('0x117')](db['AnalyticFieldReport'],{'as':_0xcaf2('0x1c0'),'onDelete':'cascade','foreignKey':_0xcaf2('0x1c2')});db['AnalyticFieldReport'][_0xcaf2('0x125')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db['SalesforceAccount']['hasMany'](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0xa6')][_0xcaf2('0x117')](db[_0xcaf2('0x1c4')],{'as':'Subjects','onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0xa6')][_0xcaf2('0x117')](db['SalesforceField'],{'as':'Descriptions','onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0xa6')][_0xcaf2('0x117')](db[_0xcaf2('0x1c4')],{'as':_0xcaf2('0x1c0'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0xa6')]['belongsTo'](db[_0xcaf2('0xa4')],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0x1c4')]['hasMany'](db[_0xcaf2('0x1c4')],{'as':_0xcaf2('0x1c8'),'foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0x1c4')][_0xcaf2('0x117')](db[_0xcaf2('0x1c4')],{'as':_0xcaf2('0x1c9'),'foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0x1c4')]['hasMany'](db['SalesforceField'],{'as':'Field','foreignKey':'FieldId'});db[_0xcaf2('0x1c4')][_0xcaf2('0x125')](db[_0xcaf2('0x95')],{'as':_0xcaf2('0x95'),'foreignKey':_0xcaf2('0x1ca')});db[_0xcaf2('0xa8')]['hasMany'](db[_0xcaf2('0x1cb')],{'as':_0xcaf2('0x1cc'),'onDelete':_0xcaf2('0x116'),'foreignKey':'AccountId'});db[_0xcaf2('0x1cb')][_0xcaf2('0x117')](db['SugarcrmField'],{'as':_0xcaf2('0x1cd'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0x1cb')][_0xcaf2('0x117')](db['SugarcrmField'],{'as':_0xcaf2('0x1ce'),'onDelete':_0xcaf2('0x116'),'foreignKey':'DescriptionId'});db[_0xcaf2('0x1cb')]['hasMany'](db['SugarcrmField'],{'as':_0xcaf2('0x1c0'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0x1cb')][_0xcaf2('0x125')](db[_0xcaf2('0xa8')],{'as':'Account','foreignKey':_0xcaf2('0x1c3')});db['SugarcrmField'][_0xcaf2('0x117')](db[_0xcaf2('0x1cf')],{'as':'Subject','foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0x1cf')]['hasMany'](db[_0xcaf2('0x1cf')],{'as':_0xcaf2('0x1c9'),'foreignKey':'DescriptionId'});db[_0xcaf2('0x1cf')][_0xcaf2('0x117')](db[_0xcaf2('0x1cf')],{'as':_0xcaf2('0x1d0'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0x1cf')]['belongsTo'](db[_0xcaf2('0x95')],{'as':_0xcaf2('0x95'),'foreignKey':_0xcaf2('0x1ca')});db[_0xcaf2('0x1d1')][_0xcaf2('0x117')](db[_0xcaf2('0xad')],{'as':_0xcaf2('0x1cc'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0xad')][_0xcaf2('0x117')](db[_0xcaf2('0xaf')],{'as':_0xcaf2('0x1cd'),'onDelete':'cascade','foreignKey':'SubjectId'});db['DeskConfiguration']['hasMany'](db[_0xcaf2('0xaf')],{'as':_0xcaf2('0x1ce'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xcaf2('0xad')][_0xcaf2('0x117')](db[_0xcaf2('0xaf')],{'as':_0xcaf2('0x1c0'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0xad')][_0xcaf2('0x125')](db['DeskAccount'],{'as':'Account','foreignKey':'AccountId'});db['DeskConfiguration'][_0xcaf2('0x127')](db['Tag'],{'through':'int_desk_configuration_has_tags'});db[_0xcaf2('0xaf')][_0xcaf2('0x117')](db[_0xcaf2('0xaf')],{'as':_0xcaf2('0x1c8'),'foreignKey':'SubjectId'});db[_0xcaf2('0xaf')][_0xcaf2('0x117')](db['DeskField'],{'as':_0xcaf2('0x1c9'),'foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0xaf')]['hasMany'](db[_0xcaf2('0xaf')],{'as':_0xcaf2('0x1d0'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0xaf')][_0xcaf2('0x125')](db[_0xcaf2('0x95')],{'as':_0xcaf2('0x95'),'foreignKey':_0xcaf2('0x1ca')});db[_0xcaf2('0xb1')]['hasMany'](db['ZohoConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0xb2')][_0xcaf2('0x117')](db[_0xcaf2('0xb3')],{'as':'Subjects','onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c5')});db['ZohoConfiguration'][_0xcaf2('0x117')](db[_0xcaf2('0xb3')],{'as':_0xcaf2('0x1ce'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0xb2')]['hasMany'](db['ZohoField'],{'as':_0xcaf2('0x1c0'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0xb2')][_0xcaf2('0x125')](db[_0xcaf2('0xb1')],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0xb3')][_0xcaf2('0x117')](db[_0xcaf2('0xb3')],{'as':'Subject','foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0xb3')][_0xcaf2('0x117')](db[_0xcaf2('0xb3')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xcaf2('0xb3')][_0xcaf2('0x117')](db[_0xcaf2('0xb3')],{'as':_0xcaf2('0x1d0'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0xb3')]['belongsTo'](db['Variable'],{'as':_0xcaf2('0x95'),'foreignKey':_0xcaf2('0x1ca')});db[_0xcaf2('0xb5')]['hasMany'](db[_0xcaf2('0x1d2')],{'as':_0xcaf2('0x1cc'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c3')});db['ZendeskConfiguration']['hasMany'](db[_0xcaf2('0xb8')],{'as':_0xcaf2('0x1cd'),'foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0x1d2')]['hasMany'](db[_0xcaf2('0xb8')],{'as':_0xcaf2('0x1ce'),'foreignKey':'DescriptionId'});db[_0xcaf2('0x1d2')][_0xcaf2('0x117')](db[_0xcaf2('0xb8')],{'as':'Fields','foreignKey':'FieldId'});db[_0xcaf2('0x1d2')][_0xcaf2('0x125')](db[_0xcaf2('0xb5')],{'as':_0xcaf2('0x18c'),'foreignKey':'AccountId'});db[_0xcaf2('0x1d2')][_0xcaf2('0x127')](db['Tag'],{'through':_0xcaf2('0x1d3')});db[_0xcaf2('0xb8')]['hasMany'](db['ZendeskField'],{'as':'Subject','foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0xb8')]['hasMany'](db['ZendeskField'],{'as':'Description','foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0xb8')][_0xcaf2('0x117')](db[_0xcaf2('0xb8')],{'as':_0xcaf2('0x1d0'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0xb8')]['belongsTo'](db[_0xcaf2('0x95')],{'as':_0xcaf2('0x95'),'foreignKey':_0xcaf2('0x1ca')});db[_0xcaf2('0xba')][_0xcaf2('0x117')](db[_0xcaf2('0x1d4')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0x1d4')][_0xcaf2('0x117')](db[_0xcaf2('0xbc')],{'as':_0xcaf2('0x1cd'),'onDelete':'cascade','foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0x1d4')]['hasMany'](db[_0xcaf2('0xbc')],{'as':_0xcaf2('0x1ce'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0x1d4')]['hasMany'](db['FreshdeskField'],{'as':_0xcaf2('0x1c0'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0x1d4')][_0xcaf2('0x125')](db[_0xcaf2('0xba')],{'as':'Account','foreignKey':'AccountId'});db['FreshdeskConfiguration']['belongsToMany'](db[_0xcaf2('0x90')],{'through':'int_freshdesk_configuration_has_tags'});db['FreshdeskField'][_0xcaf2('0x117')](db[_0xcaf2('0xbc')],{'as':_0xcaf2('0x1c8'),'foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0xbc')][_0xcaf2('0x117')](db[_0xcaf2('0xbc')],{'as':_0xcaf2('0x1c9'),'foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0xbc')][_0xcaf2('0x117')](db[_0xcaf2('0xbc')],{'as':'Field','foreignKey':'FieldId'});db['FreshdeskField']['belongsTo'](db['Variable'],{'as':_0xcaf2('0x95'),'foreignKey':_0xcaf2('0x1ca')});db[_0xcaf2('0xbe')]['hasMany'](db['VtigerConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0xbf')][_0xcaf2('0x117')](db['VtigerField'],{'as':_0xcaf2('0x1cd'),'foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0xbf')][_0xcaf2('0x117')](db[_0xcaf2('0xc1')],{'as':_0xcaf2('0x1ce'),'foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0xbf')]['hasMany'](db['VtigerField'],{'as':'Fields','foreignKey':'FieldId'});db[_0xcaf2('0xbf')][_0xcaf2('0x125')](db[_0xcaf2('0xbe')],{'as':_0xcaf2('0x18c'),'foreignKey':'AccountId'});db[_0xcaf2('0xc1')][_0xcaf2('0x117')](db[_0xcaf2('0xc1')],{'as':_0xcaf2('0x1c8'),'foreignKey':'SubjectId'});db['VtigerField']['hasMany'](db[_0xcaf2('0xc1')],{'as':_0xcaf2('0x1c9'),'foreignKey':_0xcaf2('0x1c6')});db['VtigerField'][_0xcaf2('0x117')](db[_0xcaf2('0xc1')],{'as':'Field','foreignKey':'FieldId'});db[_0xcaf2('0xc1')]['belongsTo'](db[_0xcaf2('0x95')],{'as':'Variable','foreignKey':_0xcaf2('0x1ca')});db[_0xcaf2('0xc3')][_0xcaf2('0x117')](db['ServicenowConfiguration'],{'as':_0xcaf2('0x1cc'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xcaf2('0xc4')][_0xcaf2('0x117')](db[_0xcaf2('0xc6')],{'as':_0xcaf2('0x1cd'),'foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0xc4')]['hasMany'](db[_0xcaf2('0xc6')],{'as':_0xcaf2('0x1ce'),'foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0xc4')]['hasMany'](db[_0xcaf2('0xc6')],{'as':_0xcaf2('0x1c0'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0xc4')][_0xcaf2('0x125')](db['ServicenowAccount'],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0xc6')]['hasMany'](db['ServicenowField'],{'as':_0xcaf2('0x1c8'),'foreignKey':_0xcaf2('0x1c5')});db['ServicenowField'][_0xcaf2('0x117')](db[_0xcaf2('0xc6')],{'as':_0xcaf2('0x1c9'),'foreignKey':_0xcaf2('0x1c6')});db['ServicenowField'][_0xcaf2('0x117')](db['ServicenowField'],{'as':_0xcaf2('0x1d0'),'foreignKey':'FieldId'});db['ServicenowField'][_0xcaf2('0x125')](db[_0xcaf2('0x95')],{'as':_0xcaf2('0x95'),'foreignKey':'VariableId'});db[_0xcaf2('0xc7')]['hasMany'](db['Dynamics365Configuration'],{'as':_0xcaf2('0x1cc'),'onDelete':_0xcaf2('0x116'),'foreignKey':'AccountId'});db[_0xcaf2('0xc9')][_0xcaf2('0x117')](db[_0xcaf2('0x1d5')],{'as':_0xcaf2('0x1cd'),'onDelete':_0xcaf2('0x116'),'foreignKey':'SubjectId'});db['Dynamics365Configuration']['hasMany'](db[_0xcaf2('0x1d5')],{'as':_0xcaf2('0x1ce'),'onDelete':'cascade','foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0xc9')][_0xcaf2('0x117')](db[_0xcaf2('0x1d5')],{'as':_0xcaf2('0x1c0'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0xc9')][_0xcaf2('0x125')](db[_0xcaf2('0xc7')],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0x1d5')][_0xcaf2('0x117')](db[_0xcaf2('0x1d5')],{'as':_0xcaf2('0x1c8'),'foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0x1d5')][_0xcaf2('0x117')](db[_0xcaf2('0x1d5')],{'as':'Description','foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0x1d5')][_0xcaf2('0x117')](db[_0xcaf2('0x1d5')],{'as':_0xcaf2('0x1d0'),'foreignKey':_0xcaf2('0x1c7')});db[_0xcaf2('0x1d5')][_0xcaf2('0x125')](db[_0xcaf2('0x95')],{'as':_0xcaf2('0x95'),'foreignKey':'VariableId'});db['FreshsalesAccount'][_0xcaf2('0x117')](db[_0xcaf2('0xce')],{'as':_0xcaf2('0x1cc'),'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1c3')});db['FreshsalesConfiguration'][_0xcaf2('0x117')](db[_0xcaf2('0x1d6')],{'as':_0xcaf2('0x1cd'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0xce')][_0xcaf2('0x117')](db[_0xcaf2('0x1d6')],{'as':_0xcaf2('0x1c0'),'foreignKey':_0xcaf2('0x1c7')});db['FreshsalesConfiguration'][_0xcaf2('0x125')](db[_0xcaf2('0xcc')],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x1c3')});db[_0xcaf2('0x1d6')][_0xcaf2('0x117')](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xcaf2('0x1c5')});db[_0xcaf2('0x1d6')][_0xcaf2('0x117')](db[_0xcaf2('0x1d6')],{'as':_0xcaf2('0x1c9'),'foreignKey':_0xcaf2('0x1c6')});db[_0xcaf2('0x1d6')][_0xcaf2('0x117')](db['FreshsalesField'],{'as':_0xcaf2('0x1d0'),'foreignKey':'FieldId'});db['FreshsalesField'][_0xcaf2('0x125')](db[_0xcaf2('0x95')],{'as':'Variable','foreignKey':'VariableId'});db[_0xcaf2('0x1d7')][_0xcaf2('0x125')](db[_0xcaf2('0x65')],{});db['ChatQueueReport']['belongsTo'](db[_0xcaf2('0x12d')],{'as':'List','foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x1d7')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x176'),'foreignKey':'ContactId'});db['ChatQueueReport'][_0xcaf2('0x125')](db[_0xcaf2('0x19d')],{});db[_0xcaf2('0x1d7')][_0xcaf2('0x125')](db[_0xcaf2('0x6c')],{});db[_0xcaf2('0x1d7')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{});db[_0xcaf2('0x1d7')][_0xcaf2('0x125')](db[_0xcaf2('0x13a')],{});db['ChatInternalMessage'][_0xcaf2('0x125')](db['User'],{'onDelete':_0xcaf2('0x116'),'foreignKey':_0xcaf2('0x1d8')});db[_0xcaf2('0xd4')]['belongsTo'](db[_0xcaf2('0x12')],{'onDelete':_0xcaf2('0x116'),'foreignKey':'ToId'});db[_0xcaf2('0xd9')][_0xcaf2('0x117')](db[_0xcaf2('0xd7')],{'foreignKey':_0xcaf2('0x1d9'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0xd9')][_0xcaf2('0x117')](db['JscriptyAnswerReport'],{'foreignKey':_0xcaf2('0x1d9'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x1da')][_0xcaf2('0x125')](db['SmsAccount'],{});db['SmsQueueReport'][_0xcaf2('0x125')](db[_0xcaf2('0x12d')],{'as':'List','foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x1da')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x1da')][_0xcaf2('0x125')](db['SmsInteraction'],{});db[_0xcaf2('0x1da')][_0xcaf2('0x125')](db[_0xcaf2('0x5a')],{});db['SmsQueueReport'][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{});db[_0xcaf2('0x1da')]['belongsTo'](db['SmsQueue'],{});db['JscriptyProject'][_0xcaf2('0x117')](db[_0xcaf2('0xd9')],{'foreignKey':_0xcaf2('0x1db')});db[_0xcaf2('0xe0')][_0xcaf2('0x117')](db[_0xcaf2('0xd7')],{'foreignKey':'ProjectId'});db[_0xcaf2('0xe0')][_0xcaf2('0x117')](db[_0xcaf2('0xd5')],{'foreignKey':_0xcaf2('0x1db')});db[_0xcaf2('0x149')]['belongsToMany'](db['User'],{'as':_0xcaf2('0x17b'),'through':_0xcaf2('0x14a')});db[_0xcaf2('0xe9')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':_0xcaf2('0x1dc')});db['Team']['belongsToMany'](db[_0xcaf2('0x1c')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db['Team']['belongsToMany'](db['MailQueue'],{'through':_0xcaf2('0x174'),'as':_0xcaf2('0x139')});db['Team']['belongsToMany'](db[_0xcaf2('0x13a')],{'through':_0xcaf2('0x1a2'),'as':_0xcaf2('0x13b')});db[_0xcaf2('0xe9')][_0xcaf2('0x127')](db[_0xcaf2('0x52')],{'through':_0xcaf2('0x18d'),'as':_0xcaf2('0x13c')});db[_0xcaf2('0xe9')][_0xcaf2('0x127')](db[_0xcaf2('0x13d')],{'through':_0xcaf2('0x194'),'as':_0xcaf2('0x1dd')});db[_0xcaf2('0xe9')][_0xcaf2('0x127')](db[_0xcaf2('0x63')],{'through':_0xcaf2('0x19a'),'as':_0xcaf2('0x1de')});db[_0xcaf2('0xe9')][_0xcaf2('0x127')](db[_0xcaf2('0x13e')],{'through':_0xcaf2('0x1df'),'as':_0xcaf2('0x13f')});db['Team'][_0xcaf2('0x127')](db[_0xcaf2('0xfc')],{'through':_0xcaf2('0x113'),'as':_0xcaf2('0x137')});db[_0xcaf2('0xec')][_0xcaf2('0x117')](db[_0xcaf2('0x76')],{'as':_0xcaf2('0x151'),'foreignKey':'CampaignId'});db[_0xcaf2('0xec')]['hasMany'](db[_0xcaf2('0x7a')],{'as':'HopperFinals','foreignKey':_0xcaf2('0x1aa')});db[_0xcaf2('0xec')][_0xcaf2('0x117')](db[_0xcaf2('0x11b')],{'as':'HopperHistories','foreignKey':_0xcaf2('0x1aa')});db['Campaign']['hasMany'](db[_0xcaf2('0x78')],{'as':_0xcaf2('0x154'),'foreignKey':_0xcaf2('0x1aa')});db[_0xcaf2('0xec')][_0xcaf2('0x125')](db[_0xcaf2('0x155')],{'as':_0xcaf2('0x155'),'foreignKey':_0xcaf2('0x156')});db[_0xcaf2('0xec')]['belongsTo'](db[_0xcaf2('0x155')],{'as':_0xcaf2('0x157'),'foreignKey':_0xcaf2('0x158')});db[_0xcaf2('0xec')]['belongsTo'](db[_0xcaf2('0x87')],{'as':_0xcaf2('0x87'),'foreignKey':_0xcaf2('0x159')});db['Campaign'][_0xcaf2('0x125')](db[_0xcaf2('0x149')],{'as':_0xcaf2('0x149'),'foreignKey':_0xcaf2('0x1e0')});db[_0xcaf2('0xec')]['belongsToMany'](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x1e1'),'through':_0xcaf2('0x1e2')});db[_0xcaf2('0xec')][_0xcaf2('0x127')](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x15e'),'through':_0xcaf2('0x1e3')});db[_0xcaf2('0xf0')][_0xcaf2('0x125')](db[_0xcaf2('0x17e')],{'as':'ChatOfflineMessage','foreignKey':_0xcaf2('0x17f')});db[_0xcaf2('0xf4')][_0xcaf2('0x125')](db[_0xcaf2('0x44')],{});db['MailTransferReport']['belongsTo'](db[_0xcaf2('0x42')],{});db[_0xcaf2('0xf4')][_0xcaf2('0x125')](db[_0xcaf2('0x168')],{'foreignKey':_0xcaf2('0x1e4'),'as':_0xcaf2('0x1e5')});db[_0xcaf2('0xf4')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'foreignKey':'FromUserId','as':_0xcaf2('0x1e6')});db[_0xcaf2('0xf4')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'foreignKey':_0xcaf2('0x1e7'),'as':_0xcaf2('0x1e8')});db[_0xcaf2('0xf4')][_0xcaf2('0x125')](db[_0xcaf2('0x138')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db['MailTransferReport'][_0xcaf2('0x125')](db[_0xcaf2('0x168')],{'foreignKey':_0xcaf2('0x1e9'),'as':_0xcaf2('0x1ea')});db['ChatTransferReport'][_0xcaf2('0x125')](db[_0xcaf2('0x6c')],{});db[_0xcaf2('0xf5')][_0xcaf2('0x125')](db[_0xcaf2('0x19d')],{});db[_0xcaf2('0xf5')]['belongsTo'](db[_0xcaf2('0x65')],{'foreignKey':_0xcaf2('0x1eb'),'as':'FromAccount'});db[_0xcaf2('0xf5')][_0xcaf2('0x125')](db['User'],{'foreignKey':_0xcaf2('0x1ec'),'as':'FromAgent'});db[_0xcaf2('0xf5')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'foreignKey':'ToUserId','as':_0xcaf2('0x1e8')});db[_0xcaf2('0xf5')]['belongsTo'](db['ChatQueue'],{'foreignKey':_0xcaf2('0x1ed'),'as':_0xcaf2('0x1ee')});db['ChatTransferReport'][_0xcaf2('0x125')](db[_0xcaf2('0x65')],{'foreignKey':_0xcaf2('0x1ef'),'as':'ToAccount'});db[_0xcaf2('0xf7')]['belongsTo'](db['FaxMessage'],{});db['FaxTransferReport']['belongsTo'](db['FaxInteraction'],{});db[_0xcaf2('0xf7')][_0xcaf2('0x125')](db[_0xcaf2('0x4c')],{'foreignKey':_0xcaf2('0x1f0'),'as':_0xcaf2('0x1e5')});db['FaxTransferReport'][_0xcaf2('0x125')](db['User'],{'foreignKey':_0xcaf2('0x1ec'),'as':_0xcaf2('0x1e6')});db[_0xcaf2('0xf7')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'foreignKey':_0xcaf2('0x1e7'),'as':_0xcaf2('0x1e8')});db['FaxTransferReport'][_0xcaf2('0x125')](db['FaxQueue'],{'foreignKey':_0xcaf2('0x1f1'),'as':'ToQueue'});db[_0xcaf2('0xf7')]['belongsTo'](db[_0xcaf2('0x4c')],{'foreignKey':_0xcaf2('0x1f2'),'as':_0xcaf2('0x1ea')});db[_0xcaf2('0x1f3')][_0xcaf2('0x125')](db[_0xcaf2('0x61')],{});db[_0xcaf2('0x1f3')][_0xcaf2('0x125')](db[_0xcaf2('0x5f')],{});db[_0xcaf2('0x1f3')][_0xcaf2('0x125')](db[_0xcaf2('0x5c')],{'foreignKey':_0xcaf2('0x1f4'),'as':'FromAccount'});db[_0xcaf2('0x1f3')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'foreignKey':_0xcaf2('0x1ec'),'as':_0xcaf2('0x1e6')});db['OpenchannelTransferReport'][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'foreignKey':_0xcaf2('0x1e7'),'as':'ToAgent'});db[_0xcaf2('0x1f3')][_0xcaf2('0x125')](db[_0xcaf2('0x63')],{'foreignKey':_0xcaf2('0x1f5'),'as':'ToQueue'});db[_0xcaf2('0x1f3')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0xcaf2('0x1f6'),'as':_0xcaf2('0x1ea')});db[_0xcaf2('0xfa')][_0xcaf2('0x125')](db[_0xcaf2('0x5a')],{});db[_0xcaf2('0xfa')][_0xcaf2('0x125')](db[_0xcaf2('0x11f')],{});db[_0xcaf2('0xfa')][_0xcaf2('0x125')](db[_0xcaf2('0x55')],{'foreignKey':_0xcaf2('0x1f7'),'as':_0xcaf2('0x1e5')});db[_0xcaf2('0xfa')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'foreignKey':_0xcaf2('0x1ec'),'as':_0xcaf2('0x1e6')});db[_0xcaf2('0xfa')][_0xcaf2('0x125')](db['User'],{'foreignKey':_0xcaf2('0x1e7'),'as':_0xcaf2('0x1e8')});db['SmsTransferReport'][_0xcaf2('0x125')](db[_0xcaf2('0x13d')],{'foreignKey':'ToSmsQueueId','as':_0xcaf2('0x1ee')});db[_0xcaf2('0xfa')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0xcaf2('0x1f8'),'as':_0xcaf2('0x1ea')});db[_0xcaf2('0x12d')][_0xcaf2('0x117')](db['Disposition'],{'as':_0xcaf2('0x16e'),'foreignKey':'ListId','onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x12d')][_0xcaf2('0x117')](db[_0xcaf2('0x7d')],{'as':_0xcaf2('0x1f9'),'foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x12d')][_0xcaf2('0x117')](db[_0xcaf2('0x74')],{'as':'Contacts','onDelete':'cascade','foreignKey':'ListId'});db[_0xcaf2('0x12d')][_0xcaf2('0x117')](db[_0xcaf2('0x7a')],{'as':'HopperFinals','foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x12d')][_0xcaf2('0x117')](db[_0xcaf2('0x11b')],{'as':_0xcaf2('0x11c'),'foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x12d')][_0xcaf2('0x117')](db[_0xcaf2('0x11d')],{'as':'ReportAgentPreview','foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x12d')]['belongsToMany'](db['VoiceQueue'],{'as':_0xcaf2('0x1fa'),'through':'voice_queues_has_cm_lists'});db['CmList']['belongsToMany'](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':'cm_user_has_lists'});db[_0xcaf2('0xfc')][_0xcaf2('0x117')](db[_0xcaf2('0x18')],{'as':_0xcaf2('0x11a'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0xfc')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':'UserVoicePrefix'});db['VoicePrefix'][_0xcaf2('0x127')](db[_0xcaf2('0xe9')],{'through':_0xcaf2('0x113'),'as':_0xcaf2('0x15d')});db[_0xcaf2('0xfe')][_0xcaf2('0x117')](db['User'],{'as':_0xcaf2('0x17b'),'foreignKey':_0xcaf2('0x126')});db['UserProfile'][_0xcaf2('0x117')](db[_0xcaf2('0x1fb')],{'as':_0xcaf2('0x1fc'),'foreignKey':_0xcaf2('0x126'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x1fb')]['hasMany'](db[_0xcaf2('0x101')],{'as':_0xcaf2('0x1fd'),'foreignKey':_0xcaf2('0x1fe'),'onDelete':_0xcaf2('0x116')});db['WhatsappAccount']['hasMany'](db['Disposition'],{'as':_0xcaf2('0x16e'),'foreignKey':_0xcaf2('0x1ff'),'onDelete':_0xcaf2('0x116')});db[_0xcaf2('0x104')][_0xcaf2('0x117')](db[_0xcaf2('0x16f')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db[_0xcaf2('0x104')][_0xcaf2('0x117')](db[_0xcaf2('0x200')],{'as':'Messages','foreignKey':_0xcaf2('0x1ff')});db[_0xcaf2('0x104')][_0xcaf2('0x117')](db[_0xcaf2('0x122')],{'as':'Interactions'});db['WhatsappAccount'][_0xcaf2('0x117')](db[_0xcaf2('0x106')],{'as':'Applications'});db['WhatsappAccount'][_0xcaf2('0x125')](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x172'),'foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x104')]['belongsTo'](db[_0xcaf2('0x88')],{'as':_0xcaf2('0x18f'),'foreignKey':_0xcaf2('0x15a')});db[_0xcaf2('0x104')]['belongsToMany'](db[_0xcaf2('0x12')],{'as':'Agents','through':'user_has_whatsapp_accounts'});db[_0xcaf2('0x106')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x106')][_0xcaf2('0x125')](db[_0xcaf2('0x13e')],{'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x106')][_0xcaf2('0x125')](db[_0xcaf2('0x104')],{'onDelete':_0xcaf2('0x180')});db[_0xcaf2('0x106')][_0xcaf2('0x125')](db[_0xcaf2('0x87')],{'onDelete':_0xcaf2('0x180'),'foreignKey':_0xcaf2('0x159')});db[_0xcaf2('0x106')]['belongsTo'](db[_0xcaf2('0x90')],{'onDelete':'restrict','foreignKey':_0xcaf2('0x181')});db[_0xcaf2('0x122')][_0xcaf2('0x117')](db[_0xcaf2('0x200')],{'as':_0xcaf2('0x160'),'onDelete':_0xcaf2('0x116'),'foreignKey':'WhatsappInteractionId'});db[_0xcaf2('0x122')][_0xcaf2('0x125')](db[_0xcaf2('0x104')],{'as':_0xcaf2('0x18c'),'foreignKey':'WhatsappAccountId'});db[_0xcaf2('0x122')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':_0xcaf2('0x176'),'foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x122')][_0xcaf2('0x125')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0xcaf2('0x122')][_0xcaf2('0x127')](db['Tag'],{'through':_0xcaf2('0x1ba'),'as':_0xcaf2('0x179')});db[_0xcaf2('0x122')][_0xcaf2('0x127')](db[_0xcaf2('0x90')],{'through':_0xcaf2('0x1ba'),'as':'ThroughTags'});db['WhatsappInteraction']['belongsToMany'](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x17b'),'through':_0xcaf2('0x136'),'foreignKey':_0xcaf2('0x201')});db['WhatsappMessage']['belongsTo'](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x12')});db[_0xcaf2('0x200')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'onDelete':_0xcaf2('0x116'),'as':_0xcaf2('0x176')});db[_0xcaf2('0x200')][_0xcaf2('0x125')](db[_0xcaf2('0x122')],{'onDelete':_0xcaf2('0x116'),'as':_0xcaf2('0x192'),'foreignKey':'WhatsappInteractionId'});db[_0xcaf2('0x200')][_0xcaf2('0x125')](db[_0xcaf2('0x104')],{'as':_0xcaf2('0x18c'),'foreignKey':_0xcaf2('0x1ff')});db[_0xcaf2('0x10a')][_0xcaf2('0x125')](db[_0xcaf2('0x104')],{});db[_0xcaf2('0x10a')][_0xcaf2('0x125')](db[_0xcaf2('0x12d')],{'as':_0xcaf2('0x172'),'foreignKey':_0xcaf2('0x182')});db[_0xcaf2('0x10a')][_0xcaf2('0x125')](db[_0xcaf2('0x74')],{'as':'Contact','foreignKey':_0xcaf2('0x166')});db[_0xcaf2('0x10a')]['belongsTo'](db[_0xcaf2('0x122')],{});db['WhatsappQueueReport'][_0xcaf2('0x125')](db[_0xcaf2('0x13e')],{});db['WhatsappQueueReport']['belongsTo'](db[_0xcaf2('0x200')],{});db[_0xcaf2('0x10a')]['belongsTo'](db[_0xcaf2('0x12')],{});db[_0xcaf2('0x10c')][_0xcaf2('0x125')](db[_0xcaf2('0x200')],{});db[_0xcaf2('0x10c')][_0xcaf2('0x125')](db['WhatsappInteraction'],{});db['WhatsappTransferReport']['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0xcaf2('0x202'),'as':_0xcaf2('0x1e5')});db[_0xcaf2('0x10c')][_0xcaf2('0x125')](db[_0xcaf2('0x104')],{'foreignKey':_0xcaf2('0x203'),'as':_0xcaf2('0x1ea')});db[_0xcaf2('0x10c')][_0xcaf2('0x125')](db['WhatsappQueue'],{'foreignKey':_0xcaf2('0x204'),'as':_0xcaf2('0x1ee')});db['WhatsappTransferReport']['belongsTo'](db[_0xcaf2('0x12')],{'foreignKey':_0xcaf2('0x1ec'),'as':_0xcaf2('0x1e6')});db[_0xcaf2('0x10c')][_0xcaf2('0x125')](db[_0xcaf2('0x12')],{'foreignKey':_0xcaf2('0x1e7'),'as':_0xcaf2('0x1e8')});db[_0xcaf2('0x13e')][_0xcaf2('0x127')](db[_0xcaf2('0x12')],{'as':_0xcaf2('0x15c'),'through':_0xcaf2('0x3b'),'foreignKey':_0xcaf2('0x205')});db['WhatsappQueue'][_0xcaf2('0x127')](db[_0xcaf2('0xe9')],{'through':_0xcaf2('0x1df'),'as':_0xcaf2('0x15d')});module[_0xcaf2('0x206')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x802c=['Answers','Interactions','ListId','TemplateId','MailQueue','team_has_mail_queues','Owner','mail_interaction_has_tags','ThroughTags','Users','MailInteractionId','Attachment','Account','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','restrict','List','Items','FaxAccountId','Exntensions','TagId','FaxInteractionId','fax_interaction_has_tags','Tags','Interaction','AttachmentId','team_has_fax_queues','FaxQueueReport','SmsAccountId','SmsMessage','SmsInteractionId','sms_interaction_has_tags','OpenchannelAccountId','OpenchannelQueueId','OpenchannelMessage','openchannel_interaction_has_tags','user_has_openchannel_interactions','team_has_openchannel_queues','ProactiveActions','user_has_chat_websites','Agent','ChatQueue','Queue','ChatMessage','chat_interaction_has_tags','ChatInteractionId','Attachments','team_has_chat_queues','ChatGroupId','Website','Contacts','CmHopper','HopperHistories','JscriptySessions','Company','CompanyId','cm_contact_has_tags','CampaignId','OwnerId','Condition','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','Intervals','Extensions','ChatApplications','SmsApplications','AnalyticCustomReport','moh_has_sounds','WhatsappInteraction','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','Actions','Fields','DefaultReportId','MetricId','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','Field','VariableId','Configurations','DescriptionId','int_desk_configuration_has_tags','int_zendesk_configuration_has_tags','FreshdeskField','FreshdeskAccount','VtigerAccount','ServicenowAccount','ServicenowField','Dynamics365Configuration','FreshsalesAccount','FromId','ToId','SessionId','SmsQueueReport','ProjectId','FaxQueues','team_has_sms_queues','SmsQueues','TrunkId','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','userProfileId','UserProfileSections','UserProfileResource','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','exports','../config/environment','lodash','jstz','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','sequelize','database','username','options','password','User','../api/user/user.model','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.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','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsMessage/smsMessage.model','SmsQueue','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/template/template.model','Trigger','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','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','JscriptySessionReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareRecording/squareRecording.model','SquareMessage','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','hasOne','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','HopperHistory','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','belongsToMany','Groups','chat_group_has_users','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','UserVoicePrefix','MailQueues','ChatQueues','UserChatQueue','UserFaxQueue','OpenchannelQueues','UserOpenchannelQueue','WhatsappQueues','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','VoiceChanSpy','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','Members','VoiceQueueId','Hoppers','HopperFinals','HopperBlacks','TrunkBackup','TrunkBackupId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Agents','Teams','voice_queues_has_cm_blacklists','Messages','mailboxuser','QueueCalls','uniqueid','Contact','ContactId','MailServerIn','MailAccountId','MailServerOut','Imap','Smtp','Dispositions'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x802c,0x95));var _0xc802=function(_0x16f295,_0x6f189b){_0x16f295=_0x16f295-0x0;var _0x505d8b=_0x802c[_0x16f295];return _0x505d8b;};'use strict';var config=require(_0xc802('0x0'));var Sequelize=require('sequelize');var _=require(_0xc802('0x1'));var jstz=require(_0xc802('0x2'));var timezone=jstz[_0xc802('0x3')]();config['sequelize']=_['defaultsDeep'](config['sequelize'],{'database':_0xc802('0x4'),'username':_0xc802('0x5'),'password':_0xc802('0x6'),'options':{'host':_0xc802('0x7'),'port':0xcea,'dialect':_0xc802('0x8'),'dialectOptions':{'charset':_0xc802('0x9')},'logging':![],'timezone':timezone[_0xc802('0xa')](),'define':{'charset':_0xc802('0xb'),'collate':_0xc802('0xc')}}});config[_0xc802('0xd')]=_[_0xc802('0xe')](config[_0xc802('0xd')],{'database':_0xc802('0x4'),'username':_0xc802('0x5'),'password':_0xc802('0x6'),'options':{'host':_0xc802('0x7'),'port':0xcea,'dialect':_0xc802('0x8'),'dialectOptions':{'charset':_0xc802('0x9')},'logging':![],'timezone':timezone[_0xc802('0xa')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc802('0xf')][_0xc802('0x10')],config[_0xc802('0xf')][_0xc802('0x11')],config['sequelize']['password'],config[_0xc802('0xf')][_0xc802('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xc802('0xd')][_0xc802('0x10')],config[_0xc802('0xd')]['username'],config['sequelizeHistory'][_0xc802('0x13')],config[_0xc802('0xd')][_0xc802('0x12')])};db[_0xc802('0x14')]=db[_0xc802('0xf')]['import'](_0xc802('0x15'));db['VoiceChanSpy']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x17'));db[_0xc802('0x18')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x19'));db[_0xc802('0x1a')]=db[_0xc802('0xf')]['import'](_0xc802('0x1b'));db['VoiceMusicOnHold']=db['sequelize'][_0xc802('0x16')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xc802('0x1c')]=db[_0xc802('0xf')]['import'](_0xc802('0x1d'));db[_0xc802('0x1e')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x1f'));db[_0xc802('0x20')]=db[_0xc802('0xf')][_0xc802('0x16')]('../api/screenRecording/screenRecording.model');db[_0xc802('0x21')]=db[_0xc802('0xf')][_0xc802('0x16')]('../api/voiceMail/voiceMail.model');db[_0xc802('0x22')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x23'));db[_0xc802('0x24')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x25'));db[_0xc802('0x26')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x27'));db[_0xc802('0x28')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x29'));db[_0xc802('0x2a')]=db[_0xc802('0xf')]['import'](_0xc802('0x2b'));db[_0xc802('0x2c')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x2d'));db[_0xc802('0x2e')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x2f'));db[_0xc802('0x30')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x31'));db[_0xc802('0x32')]=db['sequelize']['import'](_0xc802('0x33'));db['UserVoiceQueue']=db[_0xc802('0xf')]['import'](_0xc802('0x34'));db['UserChatQueue']=db[_0xc802('0xf')][_0xc802('0x16')]('../api/userChatQueue/userChatQueue.model');db[_0xc802('0x35')]=db['sequelize'][_0xc802('0x16')](_0xc802('0x36'));db['UserFaxQueue']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x37'));db[_0xc802('0x38')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x39'));db['UserOpenchannelQueue']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x3a'));db[_0xc802('0x3b')]=db['sequelize'][_0xc802('0x16')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db[_0xc802('0xf')][_0xc802('0x16')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0xc802('0xf')][_0xc802('0x16')]('../api/mailServerOut/mailServerOut.model');db[_0xc802('0x3c')]=db['sequelize'][_0xc802('0x16')](_0xc802('0x3d'));db['MailQueue']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x3e'));db[_0xc802('0x3f')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x40'));db[_0xc802('0x41')]=db[_0xc802('0xf')][_0xc802('0x16')]('../api/mailInteraction/mailInteraction.model');db[_0xc802('0x42')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x43'));db[_0xc802('0x44')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x45'));db[_0xc802('0x46')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x47'));db['Dashboard']=db[_0xc802('0xf')][_0xc802('0x16')]('../api/dashboard/dashboard.model');db[_0xc802('0x48')]=db[_0xc802('0xf')][_0xc802('0x16')]('../api/dashboardItem/dashboardItem.model');db[_0xc802('0x49')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x4a'));db[_0xc802('0x4b')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x4c'));db[_0xc802('0x4d')]=db['sequelize']['import'](_0xc802('0x4e'));db[_0xc802('0x4f')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x50'));db[_0xc802('0x51')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x52'));db['FaxQueueReport']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x53'));db[_0xc802('0x54')]=db[_0xc802('0xf')][_0xc802('0x16')]('../api/smsAccount/smsAccount.model');db[_0xc802('0x55')]=db['sequelize']['import'](_0xc802('0x56'));db[_0xc802('0x57')]=db[_0xc802('0xf')]['import']('../api/smsInteraction/smsInteraction.model');db['SmsMessage']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x58'));db[_0xc802('0x59')]=db['sequelize'][_0xc802('0x16')]('../api/smsQueue/smsQueue.model');db[_0xc802('0x5a')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x5b'));db[_0xc802('0x5c')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x5d'));db[_0xc802('0x5e')]=db[_0xc802('0xf')]['import']('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db[_0xc802('0xf')][_0xc802('0x16')]('../api/openchannelMessage/openchannelMessage.model');db[_0xc802('0x5f')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x60'));db[_0xc802('0x61')]=db['sequelize'][_0xc802('0x16')](_0xc802('0x62'));db[_0xc802('0x63')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x64'));db[_0xc802('0x65')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x66'));db['ChatInteraction']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x67'));db['ChatMessage']=db['sequelize'][_0xc802('0x16')](_0xc802('0x68'));db['ChatOfflineMessage']=db[_0xc802('0xf')][_0xc802('0x16')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db[_0xc802('0xf')]['import']('../api/chatQueue/chatQueue.model');db[_0xc802('0x69')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x6a'));db[_0xc802('0x6b')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x6c'));db[_0xc802('0x6d')]=db[_0xc802('0xf')]['import'](_0xc802('0x6e'));db[_0xc802('0x6f')]=db[_0xc802('0xf')]['import'](_0xc802('0x70'));db['CmHopper']=db['sequelize'][_0xc802('0x16')](_0xc802('0x71'));db[_0xc802('0x72')]=db['sequelize'][_0xc802('0x16')](_0xc802('0x73'));db[_0xc802('0x74')]=db[_0xc802('0xf')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0xc802('0x75')]=db[_0xc802('0xf')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0xc802('0x76')]=db[_0xc802('0xf')]['import'](_0xc802('0x77'));db['CmCustomField']=db[_0xc802('0xf')]['import'](_0xc802('0x78'));db[_0xc802('0x79')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x7a'));db[_0xc802('0x7b')]=db['sequelize'][_0xc802('0x16')](_0xc802('0x7c'));db[_0xc802('0x7d')]=db['sequelize'][_0xc802('0x16')](_0xc802('0x7e'));db[_0xc802('0x7f')]=db['sequelize']['import'](_0xc802('0x80'));db['Condition']=db['sequelize'][_0xc802('0x16')](_0xc802('0x81'));db['Interval']=db[_0xc802('0xf')]['import'](_0xc802('0x82'));db[_0xc802('0x83')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x84'));db['Cdr']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x85'));db[_0xc802('0x86')]=db['sequelize']['import'](_0xc802('0x87'));db[_0xc802('0x88')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x89'));db[_0xc802('0x8a')]=db[_0xc802('0xf')]['import'](_0xc802('0x8b'));db[_0xc802('0x8c')]=db[_0xc802('0xf')]['import']('../api/tag/tag.model');db['Template']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x8d'));db[_0xc802('0x8e')]=db[_0xc802('0xf')][_0xc802('0x16')]('../api/trigger/trigger.model');db[_0xc802('0x8f')]=db[_0xc802('0xf')][_0xc802('0x16')]('../api/variable/variable.model');db[_0xc802('0x90')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x91'));db[_0xc802('0x92')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x93'));db['AnalyticCustomReport']=db[_0xc802('0xf')][_0xc802('0x16')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0xc802('0x94')]=db[_0xc802('0xf')][_0xc802('0x16')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xc802('0x95')]=db['sequelize'][_0xc802('0x16')](_0xc802('0x96'));db[_0xc802('0x97')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x98'));db[_0xc802('0x99')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x9a'));db['AnalyticTreeReport']=db['sequelize'][_0xc802('0x16')](_0xc802('0x9b'));db[_0xc802('0x9c')]=db[_0xc802('0xf')]['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xc802('0x9d')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x9e'));db['SalesforceField']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x9f'));db[_0xc802('0xa0')]=db['sequelize'][_0xc802('0x16')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xc802('0xa1')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xa2'));db[_0xc802('0xa3')]=db[_0xc802('0xf')]['import'](_0xc802('0xa4'));db[_0xc802('0xa5')]=db['sequelize'][_0xc802('0x16')](_0xc802('0xa6'));db[_0xc802('0xa7')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xa8'));db[_0xc802('0xa9')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xaa'));db[_0xc802('0xab')]=db[_0xc802('0xf')][_0xc802('0x16')]('../api/intZohoAccount/intZohoAccount.model');db[_0xc802('0xac')]=db[_0xc802('0xf')][_0xc802('0x16')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0xc802('0xad')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xae'));db[_0xc802('0xaf')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xb0'));db[_0xc802('0xb1')]=db['sequelize']['import'](_0xc802('0xb2'));db[_0xc802('0xb3')]=db[_0xc802('0xf')]['import'](_0xc802('0xb4'));db['FreshdeskAccount']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xb5'));db[_0xc802('0xb6')]=db['sequelize'][_0xc802('0x16')](_0xc802('0xb7'));db['FreshdeskField']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xb8'));db['VtigerAccount']=db['sequelize']['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0xc802('0xb9')]=db[_0xc802('0xf')]['import'](_0xc802('0xba'));db[_0xc802('0xbb')]=db['sequelize'][_0xc802('0x16')](_0xc802('0xbc'));db['ServicenowAccount']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xbd'));db[_0xc802('0xbe')]=db[_0xc802('0xf')]['import'](_0xc802('0xbf'));db['ServicenowField']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xc0'));db[_0xc802('0xc1')]=db[_0xc802('0xf')]['import'](_0xc802('0xc2'));db['Dynamics365Configuration']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xc3'));db[_0xc802('0xc4')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xc5'));db['FreshsalesAccount']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xc6'));db[_0xc802('0xc7')]=db[_0xc802('0xf')][_0xc802('0x16')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xc802('0xc8')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xc9'));db[_0xc802('0x90')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x91'));db['Network']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xca'));db[_0xc802('0xcb')]=db[_0xc802('0xf')]['import'](_0xc802('0xcc'));db[_0xc802('0xcd')]=db['sequelize'][_0xc802('0x16')](_0xc802('0xce'));db[_0xc802('0xcf')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xd0'));db[_0xc802('0xd1')]=db[_0xc802('0xf')][_0xc802('0x16')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xc802('0xd2')]=db[_0xc802('0xf')][_0xc802('0x16')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xd3'));db[_0xc802('0xd4')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xd5'));db['SquareDetailsReport']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xd6'));db[_0xc802('0xd7')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xd8'));db['Setting']=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xd9'));db[_0xc802('0xda')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xdb'));db[_0xc802('0xdc')]=db[_0xc802('0xf')][_0xc802('0x16')]('../api/squareProject/squareProject.model');db['SquareRecording']=db['sequelize']['import'](_0xc802('0xdd'));db[_0xc802('0xde')]=db[_0xc802('0xf')]['import']('../api/squareMessage/squareMessage.model');db['Team']=db[_0xc802('0xf')][_0xc802('0x16')]('../api/team/team.model');db['License']=db[_0xc802('0xf')][_0xc802('0x16')]('../api/license/license.model');db[_0xc802('0xdf')]=db[_0xc802('0xf')]['import'](_0xc802('0xe0'));db[_0xc802('0xe1')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xe2'));db['Attachment']=db['sequelize'][_0xc802('0x16')](_0xc802('0xe3'));db[_0xc802('0xe4')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xe5'));db[_0xc802('0xe6')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xe7'));db[_0xc802('0xe8')]=db['sequelize'][_0xc802('0x16')]('../api/chatTransferReport/chatTransferReport.model');db[_0xc802('0xe9')]=db['sequelize']['import']('../api/faxTransferReport/faxTransferReport.model');db[_0xc802('0xea')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xeb'));db[_0xc802('0xec')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xed'));db[_0xc802('0xee')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xef'));db[_0xc802('0xf0')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xf1'));db[_0xc802('0xf2')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xf3'));db[_0xc802('0xf4')]=db[_0xc802('0xf')]['import'](_0xc802('0xf5'));db['UserProfileResource']=db['sequelize'][_0xc802('0x16')](_0xc802('0xf6'));db[_0xc802('0xf7')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0xf8'));db[_0xc802('0xf9')]=db[_0xc802('0xf')][_0xc802('0x16')]('../api/whatsappAccount/whatsappAccount.model');db['WhatsappApplication']=db[_0xc802('0xf')]['import'](_0xc802('0xfa'));db['WhatsappInteraction']=db[_0xc802('0xf')]['import'](_0xc802('0xfb'));db[_0xc802('0xfc')]=db['sequelize'][_0xc802('0x16')](_0xc802('0xfd'));db[_0xc802('0xfe')]=db[_0xc802('0xf')]['import'](_0xc802('0xff'));db[_0xc802('0x100')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x101'));db[_0xc802('0x102')]=db['sequelize'][_0xc802('0x16')](_0xc802('0x103'));db[_0xc802('0x104')]=db[_0xc802('0xf')][_0xc802('0x16')](_0xc802('0x105'));db[_0xc802('0x106')]=db['sequelize']['import'](_0xc802('0x107'));db[_0xc802('0x108')]=db[_0xc802('0xf')][_0xc802('0x16')]('../api/teamVoicePrefix/teamVoicePrefix.model');db['UserVoicePrefix']=db['sequelize'][_0xc802('0x16')]('../api/userVoicePrefix/userVoicePrefix.model');db['User'][_0xc802('0x109')](db['VoiceMail'],{'as':'VoiceMail','onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x10b')});db[_0xc802('0x14')][_0xc802('0x10c')](db[_0xc802('0x1e')],{'as':_0xc802('0x10d'),'foreignKey':'UserId'});db[_0xc802('0x14')][_0xc802('0x10c')](db[_0xc802('0x32')],{'as':_0xc802('0x10e'),'foreignKey':_0xc802('0x10b')});db[_0xc802('0x14')]['hasMany'](db['VoiceExtension'],{'as':'Extensions','onDelete':_0xc802('0x10a'),'hooks':!![]});db[_0xc802('0x14')][_0xc802('0x10c')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xc802('0x10b')});db[_0xc802('0x14')][_0xc802('0x10c')](db[_0xc802('0x75')],{'as':_0xc802('0x10f'),'foreignKey':_0xc802('0x10b')});db[_0xc802('0x14')][_0xc802('0x10c')](db['ReportAgentPreview'],{'as':_0xc802('0x76'),'foreignKey':_0xc802('0x10b')});db[_0xc802('0x14')][_0xc802('0x10c')](db[_0xc802('0x5e')],{'as':_0xc802('0x110'),'foreignKey':_0xc802('0x10b')});db[_0xc802('0x14')][_0xc802('0x10c')](db[_0xc802('0x111')],{'as':_0xc802('0x112'),'foreignKey':_0xc802('0x10b')});db[_0xc802('0x14')][_0xc802('0x10c')](db[_0xc802('0x57')],{'as':_0xc802('0x113'),'foreignKey':_0xc802('0x10b')});db['User']['hasMany'](db[_0xc802('0x4d')],{'as':'FaxInteractions','foreignKey':_0xc802('0x10b')});db[_0xc802('0x14')][_0xc802('0x10c')](db['MailInteraction'],{'as':_0xc802('0x114'),'foreignKey':_0xc802('0x10b')});db[_0xc802('0x14')]['hasMany'](db['WhatsappInteraction'],{'as':_0xc802('0x115'),'foreignKey':_0xc802('0x10b')});db[_0xc802('0x14')]['hasMany'](db['UserNotification'],{'as':_0xc802('0x116'),'foreignKey':_0xc802('0x117')});db['User'][_0xc802('0x118')](db[_0xc802('0xf2')],{'as':_0xc802('0xf2'),'foreignKey':'userProfileId'});db['User'][_0xc802('0x119')](db[_0xc802('0x69')],{'as':_0xc802('0x11a'),'through':_0xc802('0x11b')});db[_0xc802('0x14')]['belongsToMany'](db[_0xc802('0x6f')],{'as':'Contacts','through':_0xc802('0x11c')});db[_0xc802('0x14')][_0xc802('0x119')](db[_0xc802('0xee')],{'as':_0xc802('0x11d'),'through':_0xc802('0x11e')});db[_0xc802('0x14')][_0xc802('0x119')](db[_0xc802('0x11f')],{'through':_0xc802('0x120')});db[_0xc802('0x14')][_0xc802('0x119')](db['MailInteraction'],{'as':_0xc802('0x114'),'through':_0xc802('0x121')});db[_0xc802('0x14')][_0xc802('0x119')](db[_0xc802('0x111')],{'as':_0xc802('0x112'),'through':'user_has_chat_interactions'});db[_0xc802('0x14')]['belongsToMany'](db['FaxInteraction'],{'as':_0xc802('0x122'),'through':_0xc802('0x123')});db[_0xc802('0x14')][_0xc802('0x119')](db[_0xc802('0x57')],{'as':'SmsInteractions','through':_0xc802('0x124')});db['User'][_0xc802('0x119')](db['OpenchannelInteraction'],{'as':_0xc802('0x110'),'through':'user_has_openchannel_interactions'});db['User'][_0xc802('0x119')](db['WhatsappInteraction'],{'as':_0xc802('0x115'),'through':_0xc802('0x125')});db[_0xc802('0x14')][_0xc802('0x119')](db['VoiceQueue'],{'as':_0xc802('0x126'),'through':_0xc802('0x127'),'required':![]});db[_0xc802('0x14')]['belongsToMany'](db[_0xc802('0xf0')],{'as':_0xc802('0x128'),'through':_0xc802('0x129'),'required':![]});db['User'][_0xc802('0x119')](db['MailQueue'],{'as':_0xc802('0x12a'),'through':_0xc802('0x35'),'required':![]});db[_0xc802('0x14')][_0xc802('0x119')](db['ChatQueue'],{'as':_0xc802('0x12b'),'through':_0xc802('0x12c'),'required':![],'hooks':!![]});db['User'][_0xc802('0x119')](db[_0xc802('0x51')],{'as':'FaxQueues','through':_0xc802('0x12d'),'required':![]});db[_0xc802('0x14')][_0xc802('0x119')](db[_0xc802('0x59')],{'as':'SmsQueues','through':_0xc802('0x38'),'required':![]});db[_0xc802('0x14')][_0xc802('0x119')](db['OpenchannelQueue'],{'as':_0xc802('0x12e'),'through':_0xc802('0x12f'),'required':![]});db[_0xc802('0x14')][_0xc802('0x119')](db[_0xc802('0x102')],{'as':_0xc802('0x130'),'through':_0xc802('0x3b'),'required':![]});db[_0xc802('0x14')][_0xc802('0x119')](db['CmList'],{'through':'cm_user_has_lists'});db[_0xc802('0x14')][_0xc802('0x119')](db[_0xc802('0x61')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db[_0xc802('0x14')][_0xc802('0x119')](db[_0xc802('0x49')],{'as':_0xc802('0x131'),'through':_0xc802('0x132')});db[_0xc802('0x14')][_0xc802('0x119')](db[_0xc802('0x3c')],{'as':_0xc802('0x133'),'through':_0xc802('0x134')});db[_0xc802('0x14')][_0xc802('0x119')](db[_0xc802('0x5a')],{'as':_0xc802('0x135'),'through':_0xc802('0x136')});db['User'][_0xc802('0x119')](db[_0xc802('0x54')],{'as':'SmsAccounts','through':_0xc802('0x137')});db[_0xc802('0x14')][_0xc802('0x119')](db[_0xc802('0xf9')],{'as':_0xc802('0x138'),'through':_0xc802('0x139')});db[_0xc802('0x14')][_0xc802('0x119')](db[_0xc802('0xdc')],{'as':_0xc802('0x13a'),'through':_0xc802('0x13b')});db[_0xc802('0x13c')][_0xc802('0x10c')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x13d')});db[_0xc802('0x18')][_0xc802('0x10c')](db[_0xc802('0x1a')],{'onDelete':_0xc802('0x10a')});db[_0xc802('0x1a')][_0xc802('0x10c')](db[_0xc802('0x1a')],{'as':_0xc802('0x13e'),'onDelete':_0xc802('0x10a')});db[_0xc802('0x13f')][_0xc802('0x119')](db[_0xc802('0x8a')],{'as':_0xc802('0x140'),'through':'moh_has_sounds'});db[_0xc802('0x1c')][_0xc802('0x10c')](db[_0xc802('0x32')],{'as':_0xc802('0x141'),'foreignKey':_0xc802('0x142')});db['VoiceQueue'][_0xc802('0x10c')](db['CmHopper'],{'as':_0xc802('0x143'),'foreignKey':'VoiceQueueId'});db[_0xc802('0x1c')][_0xc802('0x10c')](db[_0xc802('0x74')],{'as':_0xc802('0x144'),'foreignKey':_0xc802('0x142')});db['VoiceQueue'][_0xc802('0x10c')](db[_0xc802('0x75')],{'as':'HopperHistories','foreignKey':_0xc802('0x142')});db[_0xc802('0x1c')][_0xc802('0x10c')](db['ReportAgentPreview'],{'as':_0xc802('0x76'),'foreignKey':_0xc802('0x142')});db['VoiceQueue'][_0xc802('0x10c')](db[_0xc802('0x72')],{'as':_0xc802('0x145'),'foreignKey':_0xc802('0x142')});db['VoiceQueue']['hasMany'](db[_0xc802('0xd2')],{'as':'JscriptySessions','foreignKey':_0xc802('0x142')});db['VoiceQueue'][_0xc802('0x118')](db[_0xc802('0x2e')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0xc802('0x1c')][_0xc802('0x118')](db[_0xc802('0x2e')],{'as':_0xc802('0x146'),'foreignKey':_0xc802('0x147')});db['VoiceQueue'][_0xc802('0x118')](db[_0xc802('0x148')],{'as':_0xc802('0x148'),'foreignKey':_0xc802('0x149')});db[_0xc802('0x1c')][_0xc802('0x118')](db[_0xc802('0x83')],{'as':_0xc802('0x14a'),'foreignKey':_0xc802('0x14b')});db[_0xc802('0x1c')]['belongsToMany'](db['CmList'],{'as':'Lists','through':'voice_queues_has_cm_lists'});db['VoiceQueue']['belongsToMany'](db[_0xc802('0x14')],{'as':_0xc802('0x14c'),'through':_0xc802('0x127')});db['VoiceQueue'][_0xc802('0x119')](db[_0xc802('0x11f')],{'as':_0xc802('0x14d'),'through':_0xc802('0x106')});db[_0xc802('0x1c')][_0xc802('0x119')](db[_0xc802('0xee')],{'as':'BlackLists','through':_0xc802('0x14e')});db[_0xc802('0x1e')][_0xc802('0x118')](db['User'],{'as':_0xc802('0x14'),'foreignKey':_0xc802('0x10b')});db[_0xc802('0x20')][_0xc802('0x118')](db['User'],{'as':_0xc802('0x14'),'foreignKey':_0xc802('0x10b')});db[_0xc802('0x21')]['hasMany'](db[_0xc802('0x22')],{'as':_0xc802('0x14f'),'onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x150'),'sourceKey':'mailbox'});db['VoiceMailMessage']['belongsTo'](db[_0xc802('0x21')],{'foreignKey':_0xc802('0x150'),'targetKey':'mailbox'});db['VoiceCallReport']['hasMany'](db['VoiceQueueReport'],{'as':_0xc802('0x151'),'foreignKey':_0xc802('0x152'),'constraints':![]});db[_0xc802('0x24')][_0xc802('0x10c')](db[_0xc802('0x28')],{'as':'AgentReports','foreignKey':_0xc802('0x152'),'constraints':![]});db[_0xc802('0x24')][_0xc802('0x118')](db[_0xc802('0x14')],{'as':_0xc802('0x14'),'foreignKey':_0xc802('0x10b')});db[_0xc802('0x24')][_0xc802('0x118')](db[_0xc802('0x6f')],{'as':_0xc802('0x153'),'foreignKey':_0xc802('0x154')});db[_0xc802('0x155')][_0xc802('0x118')](db[_0xc802('0x3c')],{'as':_0xc802('0x3c'),'foreignKey':_0xc802('0x156')});db[_0xc802('0x157')][_0xc802('0x118')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xc802('0x156')});db[_0xc802('0x3c')][_0xc802('0x109')](db[_0xc802('0x155')],{'as':_0xc802('0x158'),'onDelete':_0xc802('0x10a')});db[_0xc802('0x3c')][_0xc802('0x109')](db[_0xc802('0x157')],{'as':_0xc802('0x159'),'onDelete':'cascade'});db['MailAccount'][_0xc802('0x10c')](db['Disposition'],{'as':_0xc802('0x15a'),'foreignKey':_0xc802('0x156'),'onDelete':_0xc802('0x10a')});db[_0xc802('0x3c')][_0xc802('0x10c')](db['CannedAnswer'],{'as':_0xc802('0x15b'),'foreignKey':_0xc802('0x156')});db[_0xc802('0x3c')][_0xc802('0x10c')](db[_0xc802('0x42')],{'as':_0xc802('0x14f'),'foreignKey':_0xc802('0x156')});db[_0xc802('0x3c')]['hasMany'](db[_0xc802('0x41')],{'as':_0xc802('0x15c')});db[_0xc802('0x3c')][_0xc802('0x10c')](db[_0xc802('0x44')],{'as':_0xc802('0x13e')});db[_0xc802('0x3c')][_0xc802('0x118')](db['CmList'],{'as':'List','foreignKey':_0xc802('0x15d')});db[_0xc802('0x3c')][_0xc802('0x118')](db['Template'],{'as':'Template','foreignKey':_0xc802('0x15e')});db[_0xc802('0x3c')]['belongsTo'](db[_0xc802('0x83')],{'as':_0xc802('0x14a'),'foreignKey':_0xc802('0x14b')});db[_0xc802('0x3c')][_0xc802('0x119')](db[_0xc802('0x14')],{'as':_0xc802('0x14c'),'through':_0xc802('0x134')});db[_0xc802('0x15f')][_0xc802('0x119')](db['User'],{'as':_0xc802('0x14c'),'through':'UserMailQueue'});db[_0xc802('0x15f')][_0xc802('0x119')](db[_0xc802('0x11f')],{'through':_0xc802('0x160'),'as':_0xc802('0x14d')});db['MailInteraction']['hasMany'](db[_0xc802('0x42')],{'as':_0xc802('0x14f'),'onDelete':_0xc802('0x10a'),'foreignKey':'MailInteractionId'});db[_0xc802('0x41')][_0xc802('0x118')](db[_0xc802('0x3c')],{'as':'Account','foreignKey':_0xc802('0x156')});db[_0xc802('0x41')][_0xc802('0x118')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xc802('0x41')][_0xc802('0x118')](db['User'],{'as':_0xc802('0x161'),'foreignKey':_0xc802('0x10b')});db[_0xc802('0x41')]['belongsToMany'](db[_0xc802('0x8c')],{'through':'mail_interaction_has_tags','as':'Tags'});db['MailInteraction'][_0xc802('0x119')](db[_0xc802('0x8c')],{'through':_0xc802('0x162'),'as':_0xc802('0x163')});db[_0xc802('0x41')][_0xc802('0x119')](db['User'],{'as':_0xc802('0x164'),'through':_0xc802('0x121'),'foreignKey':_0xc802('0x165')});db[_0xc802('0x42')][_0xc802('0x10c')](db[_0xc802('0x166')],{'as':'Attachments','onDelete':_0xc802('0x10a')});db[_0xc802('0x42')][_0xc802('0x118')](db[_0xc802('0x14')],{'as':_0xc802('0x14')});db['MailMessage'][_0xc802('0x118')](db[_0xc802('0x6f')],{'onDelete':'cascade','as':_0xc802('0x153')});db['MailMessage'][_0xc802('0x118')](db[_0xc802('0x41')],{'as':'Interaction','foreignKey':'MailInteractionId'});db[_0xc802('0x42')][_0xc802('0x118')](db[_0xc802('0x3c')],{'as':_0xc802('0x167'),'foreignKey':'MailAccountId'});db[_0xc802('0x42')]['belongsTo'](db[_0xc802('0x61')],{'as':'ChatWebsite','foreignKey':_0xc802('0x168')});db['MailMessage'][_0xc802('0x118')](db[_0xc802('0x169')],{'as':_0xc802('0x169'),'foreignKey':_0xc802('0x16a')});db['MailApplication'][_0xc802('0x118')](db['User'],{'onDelete':_0xc802('0x16b')});db['MailApplication'][_0xc802('0x118')](db[_0xc802('0x15f')],{'onDelete':'restrict'});db[_0xc802('0x44')][_0xc802('0x118')](db['MailAccount'],{'onDelete':_0xc802('0x16b')});db[_0xc802('0x44')][_0xc802('0x118')](db[_0xc802('0x148')],{'onDelete':_0xc802('0x16b'),'foreignKey':_0xc802('0x149')});db[_0xc802('0x44')][_0xc802('0x118')](db[_0xc802('0x8c')],{'onDelete':_0xc802('0x16b'),'foreignKey':'TagId'});db['MailQueueReport'][_0xc802('0x118')](db[_0xc802('0x3c')],{});db[_0xc802('0x46')]['belongsTo'](db[_0xc802('0xee')],{'as':_0xc802('0x16c'),'foreignKey':_0xc802('0x15d')});db[_0xc802('0x46')][_0xc802('0x118')](db[_0xc802('0x6f')],{'as':_0xc802('0x153'),'foreignKey':_0xc802('0x154')});db[_0xc802('0x46')]['belongsTo'](db[_0xc802('0x41')],{});db[_0xc802('0x46')][_0xc802('0x118')](db['MailMessage'],{});db[_0xc802('0x46')]['belongsTo'](db[_0xc802('0x14')],{});db[_0xc802('0x46')][_0xc802('0x118')](db['MailQueue'],{});db['Dashboard']['hasMany'](db['DashboardItem'],{'as':_0xc802('0x16d'),'onDelete':'cascade'});db[_0xc802('0x49')][_0xc802('0x10c')](db[_0xc802('0x7f')],{'as':_0xc802('0x15a'),'foreignKey':_0xc802('0x16e'),'onDelete':_0xc802('0x10a')});db[_0xc802('0x49')][_0xc802('0x10c')](db[_0xc802('0x7d')],{'as':_0xc802('0x15b'),'foreignKey':_0xc802('0x16e')});db[_0xc802('0x49')]['hasMany'](db['FaxInteraction'],{'as':_0xc802('0x15c')});db[_0xc802('0x49')][_0xc802('0x10c')](db['FaxApplication'],{'as':'Applications'});db[_0xc802('0x49')]['hasMany'](db['VoiceExtension'],{'as':_0xc802('0x16f'),'onDelete':_0xc802('0x10a')});db[_0xc802('0x49')][_0xc802('0x10c')](db['FaxMessage'],{'as':_0xc802('0x14f')});db['FaxAccount'][_0xc802('0x118')](db[_0xc802('0x2e')],{'as':_0xc802('0x2e')});db[_0xc802('0x49')][_0xc802('0x118')](db['CmList'],{'as':_0xc802('0x16c'),'foreignKey':_0xc802('0x15d')});db[_0xc802('0x49')]['belongsTo'](db[_0xc802('0x83')],{'as':_0xc802('0x14a'),'foreignKey':_0xc802('0x14b')});db[_0xc802('0x49')][_0xc802('0x119')](db[_0xc802('0x14')],{'as':_0xc802('0x14c'),'through':_0xc802('0x132')});db[_0xc802('0x4b')][_0xc802('0x118')](db['User'],{'onDelete':'restrict'});db[_0xc802('0x4b')][_0xc802('0x118')](db[_0xc802('0x51')],{'onDelete':_0xc802('0x16b')});db[_0xc802('0x4b')][_0xc802('0x118')](db[_0xc802('0x49')],{'onDelete':'restrict'});db[_0xc802('0x4b')][_0xc802('0x118')](db['Tag'],{'onDelete':_0xc802('0x16b'),'foreignKey':_0xc802('0x170')});db['FaxInteraction'][_0xc802('0x10c')](db[_0xc802('0x4f')],{'as':_0xc802('0x14f'),'onDelete':'cascade','foreignKey':_0xc802('0x171')});db[_0xc802('0x4d')][_0xc802('0x118')](db[_0xc802('0x49')],{'as':_0xc802('0x167'),'foreignKey':_0xc802('0x16e')});db['FaxInteraction'][_0xc802('0x118')](db[_0xc802('0x6f')],{'as':_0xc802('0x153'),'foreignKey':_0xc802('0x154')});db[_0xc802('0x4d')]['belongsTo'](db[_0xc802('0x14')],{'as':_0xc802('0x161'),'foreignKey':'UserId'});db['FaxInteraction']['belongsToMany'](db['Tag'],{'through':_0xc802('0x172'),'as':_0xc802('0x173')});db[_0xc802('0x4d')][_0xc802('0x119')](db['Tag'],{'through':_0xc802('0x172'),'as':_0xc802('0x163')});db[_0xc802('0x4d')]['belongsToMany'](db['User'],{'as':'Users','through':'user_has_fax_interactions','foreignKey':_0xc802('0x171')});db['FaxMessage'][_0xc802('0x118')](db[_0xc802('0x14')],{'onDelete':_0xc802('0x10a'),'as':_0xc802('0x14')});db[_0xc802('0x4f')][_0xc802('0x118')](db[_0xc802('0x4d')],{'as':_0xc802('0x174'),'foreignKey':_0xc802('0x171')});db[_0xc802('0x4f')]['belongsTo'](db[_0xc802('0x6f')],{'onDelete':_0xc802('0x10a'),'as':_0xc802('0x153')});db[_0xc802('0x4f')]['belongsTo'](db['Attachment'],{'as':_0xc802('0x166'),'foreignKey':_0xc802('0x175')});db[_0xc802('0x4f')][_0xc802('0x118')](db['FaxAccount'],{'as':_0xc802('0x167'),'foreignKey':_0xc802('0x16e')});db[_0xc802('0x51')][_0xc802('0x119')](db[_0xc802('0x14')],{'as':_0xc802('0x14c'),'through':_0xc802('0x12d')});db[_0xc802('0x51')][_0xc802('0x119')](db[_0xc802('0x11f')],{'through':_0xc802('0x176'),'as':_0xc802('0x14d')});db[_0xc802('0x177')]['belongsTo'](db[_0xc802('0x49')],{});db['FaxQueueReport'][_0xc802('0x118')](db['CmList'],{'as':_0xc802('0x16c'),'foreignKey':'ListId'});db[_0xc802('0x177')][_0xc802('0x118')](db[_0xc802('0x6f')],{'as':_0xc802('0x153'),'foreignKey':'ContactId'});db[_0xc802('0x177')][_0xc802('0x118')](db[_0xc802('0x4d')],{});db[_0xc802('0x177')][_0xc802('0x118')](db[_0xc802('0x4f')],{});db[_0xc802('0x177')][_0xc802('0x118')](db[_0xc802('0x14')],{});db[_0xc802('0x177')]['belongsTo'](db[_0xc802('0x51')],{});db[_0xc802('0x54')][_0xc802('0x10c')](db[_0xc802('0x7f')],{'as':_0xc802('0x15a'),'foreignKey':_0xc802('0x178'),'onDelete':'cascade'});db[_0xc802('0x54')][_0xc802('0x10c')](db[_0xc802('0x7d')],{'as':'Answers','foreignKey':_0xc802('0x178')});db['SmsAccount'][_0xc802('0x10c')](db['SmsMessage'],{'as':_0xc802('0x14f'),'foreignKey':_0xc802('0x178')});db[_0xc802('0x54')]['hasMany'](db['SmsInteraction'],{'as':_0xc802('0x15c')});db[_0xc802('0x54')]['hasMany'](db[_0xc802('0x55')],{'as':'Applications'});db[_0xc802('0x54')][_0xc802('0x118')](db['CmList'],{'as':'List','foreignKey':_0xc802('0x15d')});db[_0xc802('0x54')]['belongsTo'](db[_0xc802('0x83')],{'as':'mandatoryDispositionPause','foreignKey':_0xc802('0x14b')});db[_0xc802('0x54')][_0xc802('0x119')](db[_0xc802('0x14')],{'as':_0xc802('0x14c'),'through':_0xc802('0x137')});db['SmsApplication']['belongsTo'](db[_0xc802('0x14')],{'onDelete':_0xc802('0x16b')});db[_0xc802('0x55')][_0xc802('0x118')](db[_0xc802('0x59')],{'onDelete':_0xc802('0x16b')});db['SmsApplication'][_0xc802('0x118')](db[_0xc802('0x54')],{'onDelete':'restrict'});db['SmsApplication'][_0xc802('0x118')](db[_0xc802('0x148')],{'onDelete':_0xc802('0x16b'),'foreignKey':_0xc802('0x149')});db['SmsApplication'][_0xc802('0x118')](db['Tag'],{'onDelete':_0xc802('0x16b'),'foreignKey':_0xc802('0x170')});db['SmsInteraction'][_0xc802('0x10c')](db[_0xc802('0x179')],{'as':'Messages','onDelete':'cascade','foreignKey':_0xc802('0x17a')});db[_0xc802('0x57')][_0xc802('0x118')](db[_0xc802('0x54')],{'as':'Account','foreignKey':_0xc802('0x178')});db[_0xc802('0x57')][_0xc802('0x118')](db['CmContact'],{'as':_0xc802('0x153'),'foreignKey':'ContactId'});db[_0xc802('0x57')][_0xc802('0x118')](db['User'],{'as':_0xc802('0x161'),'foreignKey':'UserId'});db[_0xc802('0x57')][_0xc802('0x119')](db[_0xc802('0x8c')],{'through':_0xc802('0x17b'),'as':_0xc802('0x173')});db[_0xc802('0x57')]['belongsToMany'](db[_0xc802('0x8c')],{'through':'sms_interaction_has_tags','as':_0xc802('0x163')});db[_0xc802('0x57')][_0xc802('0x119')](db[_0xc802('0x14')],{'as':_0xc802('0x164'),'through':_0xc802('0x124'),'foreignKey':_0xc802('0x17a')});db[_0xc802('0x179')][_0xc802('0x118')](db[_0xc802('0x14')],{'as':'User'});db[_0xc802('0x179')][_0xc802('0x118')](db[_0xc802('0x6f')],{'onDelete':_0xc802('0x10a'),'as':'Contact'});db[_0xc802('0x179')][_0xc802('0x118')](db[_0xc802('0x57')],{'onDelete':_0xc802('0x10a'),'as':'Interaction','foreignKey':_0xc802('0x17a')});db[_0xc802('0x179')][_0xc802('0x118')](db['SmsAccount'],{'as':_0xc802('0x167'),'foreignKey':'SmsAccountId'});db[_0xc802('0x59')][_0xc802('0x119')](db[_0xc802('0x14')],{'as':_0xc802('0x14c'),'through':'UserSmsQueue','foreignKey':'SmsQueueId'});db[_0xc802('0x59')][_0xc802('0x119')](db[_0xc802('0x11f')],{'through':'team_has_sms_queues','as':_0xc802('0x14d')});db[_0xc802('0x5a')]['hasMany'](db[_0xc802('0x7f')],{'as':'Dispositions','foreignKey':_0xc802('0x17c'),'onDelete':_0xc802('0x10a')});db['OpenchannelAccount']['hasMany'](db[_0xc802('0x7d')],{'as':_0xc802('0x15b'),'foreignKey':_0xc802('0x17c')});db[_0xc802('0x5a')][_0xc802('0x10c')](db[_0xc802('0x5e')],{'as':_0xc802('0x15c'),'foreignKey':_0xc802('0x17c')});db[_0xc802('0x5a')][_0xc802('0x10c')](db['OpenchannelMessage'],{'as':_0xc802('0x14f'),'foreignKey':_0xc802('0x17c')});db['OpenchannelAccount'][_0xc802('0x10c')](db[_0xc802('0x5c')],{'as':_0xc802('0x13e'),'foreignKey':'OpenchannelAccountId'});db[_0xc802('0x5a')]['belongsTo'](db['CmList'],{'as':_0xc802('0x16c'),'foreignKey':'ListId'});db[_0xc802('0x5a')][_0xc802('0x118')](db[_0xc802('0x83')],{'as':_0xc802('0x14a'),'foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0xc802('0x119')](db[_0xc802('0x14')],{'as':_0xc802('0x14c'),'through':_0xc802('0x136')});db[_0xc802('0x5c')][_0xc802('0x118')](db[_0xc802('0x14')],{'onDelete':_0xc802('0x16b')});db[_0xc802('0x5c')]['belongsTo'](db[_0xc802('0x5f')],{'onDelete':'restrict','foreignKey':_0xc802('0x17d')});db[_0xc802('0x5c')][_0xc802('0x118')](db[_0xc802('0x5a')],{'onDelete':_0xc802('0x16b'),'foreignKey':_0xc802('0x17c')});db['OpenchannelApplication'][_0xc802('0x118')](db['Interval'],{'onDelete':_0xc802('0x16b'),'foreignKey':_0xc802('0x149')});db['OpenchannelApplication'][_0xc802('0x118')](db[_0xc802('0x8c')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xc802('0x5e')][_0xc802('0x10c')](db[_0xc802('0x17e')],{'as':_0xc802('0x14f'),'onDelete':_0xc802('0x10a'),'foreignKey':'OpenchannelInteractionId'});db[_0xc802('0x5e')][_0xc802('0x118')](db[_0xc802('0x5a')],{'as':'Account','foreignKey':_0xc802('0x17c')});db[_0xc802('0x5e')][_0xc802('0x118')](db['CmContact'],{'as':_0xc802('0x153'),'foreignKey':'ContactId'});db['OpenchannelInteraction']['belongsTo'](db[_0xc802('0x14')],{'as':'Owner','foreignKey':_0xc802('0x10b')});db['OpenchannelInteraction'][_0xc802('0x119')](db[_0xc802('0x8c')],{'through':'openchannel_interaction_has_tags','as':_0xc802('0x173')});db[_0xc802('0x5e')]['belongsToMany'](db[_0xc802('0x8c')],{'through':_0xc802('0x17f'),'as':_0xc802('0x163')});db[_0xc802('0x5e')][_0xc802('0x119')](db[_0xc802('0x14')],{'as':_0xc802('0x164'),'through':_0xc802('0x180'),'foreignKey':'OpenchannelInteractionId'});db[_0xc802('0x17e')][_0xc802('0x118')](db['User'],{'onDelete':_0xc802('0x10a'),'as':_0xc802('0x14')});db[_0xc802('0x17e')][_0xc802('0x118')](db[_0xc802('0x6f')],{'onDelete':_0xc802('0x10a'),'as':_0xc802('0x153')});db[_0xc802('0x17e')]['belongsTo'](db[_0xc802('0x5e')],{'onDelete':'cascade','as':_0xc802('0x174'),'foreignKey':'OpenchannelInteractionId'});db[_0xc802('0x17e')][_0xc802('0x118')](db[_0xc802('0x166')],{'as':'Attachment','foreignKey':_0xc802('0x175')});db[_0xc802('0x17e')]['belongsTo'](db[_0xc802('0x5a')],{'as':_0xc802('0x167'),'foreignKey':_0xc802('0x17c')});db[_0xc802('0x5f')][_0xc802('0x119')](db[_0xc802('0x14')],{'as':'Agents','through':_0xc802('0x12f'),'foreignKey':'OpenchannelQueueId'});db['OpenchannelQueue'][_0xc802('0x119')](db['Team'],{'through':_0xc802('0x181'),'as':_0xc802('0x14d')});db[_0xc802('0x61')][_0xc802('0x10c')](db[_0xc802('0x7f')],{'as':_0xc802('0x15a'),'foreignKey':_0xc802('0x168'),'onDelete':_0xc802('0x10a')});db['ChatWebsite'][_0xc802('0x10c')](db[_0xc802('0x7d')],{'as':'Answers','foreignKey':_0xc802('0x168')});db[_0xc802('0x61')][_0xc802('0x10c')](db[_0xc802('0x6b')],{'as':_0xc802('0x182')});db[_0xc802('0x61')][_0xc802('0x10c')](db[_0xc802('0x111')],{'as':'Interactions'});db[_0xc802('0x61')][_0xc802('0x10c')](db[_0xc802('0x65')],{'as':_0xc802('0x13e')});db[_0xc802('0x61')][_0xc802('0x10c')](db['ChatMessage'],{'as':_0xc802('0x14f')});db[_0xc802('0x61')]['belongsTo'](db['CmList'],{'as':_0xc802('0x16c'),'foreignKey':_0xc802('0x15d')});db[_0xc802('0x61')]['belongsTo'](db['Interval'],{'as':_0xc802('0x148'),'foreignKey':_0xc802('0x149')});db[_0xc802('0x61')][_0xc802('0x118')](db[_0xc802('0x3c')],{'as':'MailAccount','foreignKey':_0xc802('0x156')});db[_0xc802('0x61')][_0xc802('0x118')](db[_0xc802('0x83')],{'as':_0xc802('0x14a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xc802('0x61')][_0xc802('0x119')](db[_0xc802('0x14')],{'as':'Agents','through':_0xc802('0x183')});db[_0xc802('0x63')][_0xc802('0x118')](db['OpenchannelAccount'],{});db[_0xc802('0x63')][_0xc802('0x118')](db[_0xc802('0xee')],{'as':'List','foreignKey':_0xc802('0x15d')});db['OpenchannelQueueReport'][_0xc802('0x118')](db[_0xc802('0x6f')],{'as':_0xc802('0x153'),'foreignKey':_0xc802('0x154')});db[_0xc802('0x63')][_0xc802('0x118')](db[_0xc802('0x5e')],{});db[_0xc802('0x63')][_0xc802('0x118')](db[_0xc802('0x17e')],{});db[_0xc802('0x63')][_0xc802('0x118')](db['User'],{});db[_0xc802('0x63')][_0xc802('0x118')](db[_0xc802('0x5f')],{});db[_0xc802('0x65')]['belongsTo'](db[_0xc802('0x14')],{'as':_0xc802('0x184'),'foreignKey':'UserId','onDelete':_0xc802('0x16b')});db['ChatApplication'][_0xc802('0x118')](db[_0xc802('0x185')],{'as':_0xc802('0x186'),'foreignKey':'ChatQueueId','onDelete':'restrict'});db[_0xc802('0x65')][_0xc802('0x118')](db[_0xc802('0x61')],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':_0xc802('0x16b')});db[_0xc802('0x65')][_0xc802('0x118')](db[_0xc802('0x8c')],{'onDelete':'restrict','foreignKey':_0xc802('0x170')});db['ChatInteraction'][_0xc802('0x10c')](db[_0xc802('0x187')],{'as':_0xc802('0x14f'),'onDelete':_0xc802('0x10a'),'foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0xc802('0x118')](db[_0xc802('0x61')],{'as':_0xc802('0x167'),'foreignKey':_0xc802('0x168')});db[_0xc802('0x111')][_0xc802('0x118')](db[_0xc802('0x6f')],{'as':_0xc802('0x153'),'foreignKey':_0xc802('0x154')});db['ChatInteraction']['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0xc802('0x10b')});db[_0xc802('0x111')][_0xc802('0x119')](db[_0xc802('0x8c')],{'through':_0xc802('0x188'),'as':_0xc802('0x173')});db[_0xc802('0x111')][_0xc802('0x119')](db[_0xc802('0x8c')],{'through':_0xc802('0x188'),'as':_0xc802('0x163')});db[_0xc802('0x111')][_0xc802('0x119')](db[_0xc802('0x14')],{'as':_0xc802('0x164'),'through':'user_has_chat_interactions','foreignKey':_0xc802('0x189')});db[_0xc802('0x187')][_0xc802('0x118')](db[_0xc802('0x14')],{'onDelete':'cascade','as':_0xc802('0x14')});db[_0xc802('0x187')][_0xc802('0x118')](db[_0xc802('0x6f')],{'onDelete':_0xc802('0x10a'),'as':_0xc802('0x153'),'foreignKey':_0xc802('0x154')});db[_0xc802('0x187')]['belongsTo'](db['ChatInteraction'],{'onDelete':'cascade','as':_0xc802('0x174'),'foreignKey':_0xc802('0x189')});db[_0xc802('0x187')][_0xc802('0x118')](db['Attachment'],{'as':_0xc802('0x166'),'foreignKey':_0xc802('0x175')});db[_0xc802('0x187')]['belongsTo'](db[_0xc802('0x61')],{'as':_0xc802('0x167'),'foreignKey':_0xc802('0x168')});db[_0xc802('0x169')]['hasMany'](db[_0xc802('0x166')],{'as':_0xc802('0x18a'),'foreignKey':_0xc802('0x16a'),'onDelete':_0xc802('0x10a'),'hooks':!![]});db[_0xc802('0x169')][_0xc802('0x118')](db[_0xc802('0x6f')],{'onDelete':_0xc802('0x10a'),'as':_0xc802('0x153'),'foreignKey':'ContactId'});db['ChatOfflineMessage'][_0xc802('0x118')](db[_0xc802('0x61')],{'as':_0xc802('0x167'),'foreignKey':_0xc802('0x168')});db[_0xc802('0x185')][_0xc802('0x119')](db[_0xc802('0x14')],{'as':'Agents','through':_0xc802('0x12c'),'hooks':!![]});db[_0xc802('0x185')][_0xc802('0x119')](db[_0xc802('0x11f')],{'through':_0xc802('0x18b'),'as':'Teams'});db[_0xc802('0x69')][_0xc802('0x10c')](db['ChatInternalMessage'],{'as':'Messages','foreignKey':_0xc802('0x18c'),'onDelete':_0xc802('0x10a')});db[_0xc802('0x69')][_0xc802('0x119')](db[_0xc802('0x14')],{'as':_0xc802('0x141'),'through':_0xc802('0x11b')});db[_0xc802('0x6b')][_0xc802('0x118')](db[_0xc802('0x61')],{'as':_0xc802('0x18d'),'foreignKey':'ChatWebsiteId'});db['CmCompany']['hasMany'](db[_0xc802('0x6f')],{'as':_0xc802('0x18e'),'foreignKey':'CompanyId'});db[_0xc802('0x6f')][_0xc802('0x10c')](db[_0xc802('0x18f')],{'as':_0xc802('0x143'),'foreignKey':_0xc802('0x154')});db[_0xc802('0x6f')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':'ContactId'});db[_0xc802('0x6f')][_0xc802('0x10c')](db[_0xc802('0x75')],{'as':_0xc802('0x190'),'foreignKey':'ContactId'});db['CmContact'][_0xc802('0x10c')](db[_0xc802('0x76')],{'as':_0xc802('0x76'),'foreignKey':_0xc802('0x154')});db[_0xc802('0x6f')][_0xc802('0x10c')](db[_0xc802('0xd2')],{'as':_0xc802('0x191'),'foreignKey':_0xc802('0x154')});db['CmContact'][_0xc802('0x10c')](db[_0xc802('0x5e')],{'as':_0xc802('0x110'),'foreignKey':_0xc802('0x154'),'onDelete':_0xc802('0x16b')});db[_0xc802('0x6f')][_0xc802('0x10c')](db[_0xc802('0x111')],{'as':_0xc802('0x112'),'foreignKey':_0xc802('0x154'),'onDelete':_0xc802('0x16b')});db[_0xc802('0x6f')]['hasMany'](db[_0xc802('0x57')],{'as':_0xc802('0x113'),'foreignKey':_0xc802('0x154'),'onDelete':_0xc802('0x16b')});db[_0xc802('0x6f')]['hasMany'](db['FaxInteraction'],{'as':_0xc802('0x122'),'foreignKey':_0xc802('0x154'),'onDelete':_0xc802('0x16b')});db[_0xc802('0x6f')][_0xc802('0x10c')](db[_0xc802('0x41')],{'as':'MailInteractions','foreignKey':_0xc802('0x154'),'onDelete':_0xc802('0x16b')});db[_0xc802('0x6f')][_0xc802('0x118')](db[_0xc802('0x6d')],{'as':_0xc802('0x192'),'foreignKey':_0xc802('0x193')});db[_0xc802('0x6f')][_0xc802('0x118')](db['CmList'],{'as':'List','foreignKey':_0xc802('0x15d'),'onDelete':_0xc802('0x10a')});db[_0xc802('0x6f')][_0xc802('0x119')](db[_0xc802('0x14')],{'as':'Users','through':_0xc802('0x11c')});db['CmContact'][_0xc802('0x119')](db[_0xc802('0x8c')],{'as':_0xc802('0x173'),'through':_0xc802('0x194')});db['CmContact'][_0xc802('0x119')](db[_0xc802('0x8c')],{'through':_0xc802('0x194'),'as':_0xc802('0x163')});db[_0xc802('0x18f')]['belongsTo'](db[_0xc802('0x6f')],{'as':_0xc802('0x153'),'foreignKey':_0xc802('0x154'),'onDelete':'cascade'});db[_0xc802('0x18f')][_0xc802('0x118')](db[_0xc802('0xee')],{'as':'List','foreignKey':_0xc802('0x15d'),'onDelete':_0xc802('0x10a')});db[_0xc802('0x18f')][_0xc802('0x118')](db[_0xc802('0x14')],{'as':_0xc802('0x184'),'foreignKey':_0xc802('0x10b')});db[_0xc802('0x18f')][_0xc802('0x118')](db[_0xc802('0x1c')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0xc802('0x10a')});db['CmHopper']['belongsTo'](db['Campaign'],{'as':'Campaign','foreignKey':_0xc802('0x195'),'onDelete':_0xc802('0x10a')});db[_0xc802('0x18f')][_0xc802('0x118')](db[_0xc802('0x14')],{'as':_0xc802('0x161'),'foreignKey':_0xc802('0x196')});db['CmHopperBlack'][_0xc802('0x118')](db['CmContact'],{'as':_0xc802('0x153'),'foreignKey':_0xc802('0x154'),'onDelete':_0xc802('0x10a')});db[_0xc802('0x72')][_0xc802('0x118')](db[_0xc802('0xee')],{'as':_0xc802('0x16c'),'foreignKey':_0xc802('0x15d'),'onDelete':_0xc802('0x10a')});db[_0xc802('0x72')]['belongsTo'](db[_0xc802('0x1c')],{'as':_0xc802('0x186'),'foreignKey':_0xc802('0x142'),'onDelete':_0xc802('0x10a')});db['CmHopperBlack'][_0xc802('0x118')](db[_0xc802('0xdf')],{'as':_0xc802('0xdf'),'foreignKey':_0xc802('0x195'),'onDelete':'cascade'});db[_0xc802('0x7b')][_0xc802('0x10c')](db[_0xc802('0x197')],{'as':{'plural':'All','singular':_0xc802('0x198')},'foreignKey':_0xc802('0x199'),'onDelete':'cascade','hooks':!![]});db[_0xc802('0x7b')][_0xc802('0x10c')](db[_0xc802('0x197')],{'as':{'plural':_0xc802('0x19a'),'singular':_0xc802('0x19b')},'foreignKey':_0xc802('0x19c'),'onDelete':_0xc802('0x10a'),'hooks':!![]});db[_0xc802('0x7b')][_0xc802('0x10c')](db[_0xc802('0x79')],{'as':'Actions','foreignKey':_0xc802('0x19d'),'onDelete':_0xc802('0x10a'),'hooks':!![]});db['Disposition'][_0xc802('0x10c')](db[_0xc802('0x7f')],{'as':_0xc802('0x15a'),'foreignKey':'ParentId','onDelete':_0xc802('0x10a')});db['Interval'][_0xc802('0x10c')](db[_0xc802('0x148')],{'as':_0xc802('0x19e'),'foreignKey':_0xc802('0x149'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xc802('0x148')][_0xc802('0x10c')](db[_0xc802('0x1a')],{'as':_0xc802('0x19f'),'foreignKey':_0xc802('0x149'),'onDelete':_0xc802('0x16b')});db[_0xc802('0x148')][_0xc802('0x10c')](db[_0xc802('0x44')],{'as':'MailApplications','foreignKey':_0xc802('0x149')});db[_0xc802('0x148')][_0xc802('0x10c')](db[_0xc802('0x65')],{'as':_0xc802('0x1a0'),'foreignKey':_0xc802('0x149')});db[_0xc802('0x148')][_0xc802('0x10c')](db['FaxApplication'],{'as':'FaxApplications','foreignKey':_0xc802('0x149')});db[_0xc802('0x148')][_0xc802('0x10c')](db[_0xc802('0x55')],{'as':_0xc802('0x1a1'),'foreignKey':_0xc802('0x149')});db[_0xc802('0x88')][_0xc802('0x118')](db[_0xc802('0x3c')],{});db[_0xc802('0x88')]['belongsTo'](db[_0xc802('0x94')],{'foreignKey':'DefaultReportId'});db[_0xc802('0x88')][_0xc802('0x118')](db[_0xc802('0x1a2')],{'foreignKey':'CustomReportId'});db[_0xc802('0x8a')][_0xc802('0x119')](db[_0xc802('0x13f')],{'as':'Mohs','through':_0xc802('0x1a3'),'onDelete':_0xc802('0x16b')});db[_0xc802('0x8c')]['belongsToMany'](db[_0xc802('0x6f')],{'through':_0xc802('0x194')});db[_0xc802('0x8c')]['belongsToMany'](db[_0xc802('0x111')],{'through':_0xc802('0x188')});db[_0xc802('0x8c')][_0xc802('0x119')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db[_0xc802('0x8c')][_0xc802('0x119')](db[_0xc802('0x57')],{'through':_0xc802('0x17b')});db[_0xc802('0x8c')][_0xc802('0x119')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0xc802('0x8c')][_0xc802('0x119')](db['OpenchannelInteraction'],{'through':_0xc802('0x17f')});db['Tag'][_0xc802('0x119')](db[_0xc802('0x1a4')],{'through':_0xc802('0x1a5')});db['Trigger']['hasMany'](db[_0xc802('0x197')],{'as':{'plural':_0xc802('0x1a6'),'singular':_0xc802('0x1a7')},'foreignKey':_0xc802('0x1a8'),'onDelete':'cascade','hooks':!![]});db['Trigger']['hasMany'](db[_0xc802('0x197')],{'as':{'plural':_0xc802('0x1a9'),'singular':_0xc802('0x1aa')},'foreignKey':'TriggerAnyId','onDelete':_0xc802('0x10a'),'hooks':!![]});db[_0xc802('0x8e')][_0xc802('0x10c')](db[_0xc802('0x79')],{'as':_0xc802('0x1ab'),'foreignKey':'TriggerId','onDelete':_0xc802('0x10a'),'hooks':!![]});db['AnalyticCustomReport'][_0xc802('0x10c')](db[_0xc802('0x99')],{'as':_0xc802('0x1ac'),'onDelete':_0xc802('0x10a'),'foreignKey':'CustomReportId','hooks':!![]});db[_0xc802('0x94')][_0xc802('0x10c')](db[_0xc802('0x99')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xc802('0x1ad')});db[_0xc802('0x97')][_0xc802('0x10c')](db[_0xc802('0x99')],{'as':_0xc802('0x1ac'),'onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x1ae')});db[_0xc802('0x99')][_0xc802('0x118')](db[_0xc802('0x97')],{'foreignKey':_0xc802('0x1ae')});db['SalesforceAccount']['hasMany'](db['SalesforceConfiguration'],{'as':'Configurations','onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x1af')});db['SalesforceConfiguration'][_0xc802('0x10c')](db[_0xc802('0x1b0')],{'as':_0xc802('0x1b1'),'onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x1b2')});db[_0xc802('0x9d')][_0xc802('0x10c')](db[_0xc802('0x1b0')],{'as':_0xc802('0x1b3'),'onDelete':_0xc802('0x10a'),'foreignKey':'DescriptionId'});db[_0xc802('0x9d')][_0xc802('0x10c')](db[_0xc802('0x1b0')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xc802('0x1b4')});db[_0xc802('0x9d')][_0xc802('0x118')](db['SalesforceAccount'],{'as':'Account','foreignKey':_0xc802('0x1af')});db[_0xc802('0x1b0')]['hasMany'](db[_0xc802('0x1b0')],{'as':_0xc802('0x1b5'),'foreignKey':_0xc802('0x1b2')});db[_0xc802('0x1b0')][_0xc802('0x10c')](db[_0xc802('0x1b0')],{'as':_0xc802('0x1b6'),'foreignKey':'DescriptionId'});db[_0xc802('0x1b0')]['hasMany'](db['SalesforceField'],{'as':_0xc802('0x1b7'),'foreignKey':'FieldId'});db[_0xc802('0x1b0')][_0xc802('0x118')](db[_0xc802('0x8f')],{'as':_0xc802('0x8f'),'foreignKey':_0xc802('0x1b8')});db[_0xc802('0xa0')][_0xc802('0x10c')](db[_0xc802('0xa1')],{'as':_0xc802('0x1b9'),'onDelete':'cascade','foreignKey':_0xc802('0x1af')});db['SugarcrmConfiguration'][_0xc802('0x10c')](db[_0xc802('0xa3')],{'as':_0xc802('0x1b1'),'onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x1b2')});db[_0xc802('0xa1')][_0xc802('0x10c')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0xc802('0x10a'),'foreignKey':'DescriptionId'});db[_0xc802('0xa1')][_0xc802('0x10c')](db[_0xc802('0xa3')],{'as':'Fields','onDelete':_0xc802('0x10a'),'foreignKey':'FieldId'});db['SugarcrmConfiguration'][_0xc802('0x118')](db[_0xc802('0xa0')],{'as':_0xc802('0x167'),'foreignKey':_0xc802('0x1af')});db[_0xc802('0xa3')][_0xc802('0x10c')](db[_0xc802('0xa3')],{'as':_0xc802('0x1b5'),'foreignKey':_0xc802('0x1b2')});db[_0xc802('0xa3')]['hasMany'](db['SugarcrmField'],{'as':_0xc802('0x1b6'),'foreignKey':_0xc802('0x1ba')});db[_0xc802('0xa3')]['hasMany'](db['SugarcrmField'],{'as':_0xc802('0x1b7'),'foreignKey':'FieldId'});db[_0xc802('0xa3')]['belongsTo'](db[_0xc802('0x8f')],{'as':_0xc802('0x8f'),'foreignKey':_0xc802('0x1b8')});db[_0xc802('0xa5')][_0xc802('0x10c')](db[_0xc802('0xa7')],{'as':_0xc802('0x1b9'),'onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x1af')});db['DeskConfiguration']['hasMany'](db[_0xc802('0xa9')],{'as':'Subjects','onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x1b2')});db[_0xc802('0xa7')][_0xc802('0x10c')](db[_0xc802('0xa9')],{'as':_0xc802('0x1b3'),'onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x1ba')});db[_0xc802('0xa7')][_0xc802('0x10c')](db[_0xc802('0xa9')],{'as':'Fields','onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x1b4')});db[_0xc802('0xa7')]['belongsTo'](db['DeskAccount'],{'as':_0xc802('0x167'),'foreignKey':_0xc802('0x1af')});db['DeskConfiguration'][_0xc802('0x119')](db[_0xc802('0x8c')],{'through':_0xc802('0x1bb')});db[_0xc802('0xa9')]['hasMany'](db['DeskField'],{'as':_0xc802('0x1b5'),'foreignKey':_0xc802('0x1b2')});db[_0xc802('0xa9')][_0xc802('0x10c')](db[_0xc802('0xa9')],{'as':_0xc802('0x1b6'),'foreignKey':'DescriptionId'});db['DeskField'][_0xc802('0x10c')](db['DeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0xc802('0xa9')]['belongsTo'](db[_0xc802('0x8f')],{'as':_0xc802('0x8f'),'foreignKey':_0xc802('0x1b8')});db[_0xc802('0xab')][_0xc802('0x10c')](db['ZohoConfiguration'],{'as':'Configurations','onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x1af')});db[_0xc802('0xac')][_0xc802('0x10c')](db[_0xc802('0xad')],{'as':_0xc802('0x1b1'),'onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x1b2')});db[_0xc802('0xac')][_0xc802('0x10c')](db[_0xc802('0xad')],{'as':_0xc802('0x1b3'),'onDelete':'cascade','foreignKey':_0xc802('0x1ba')});db[_0xc802('0xac')]['hasMany'](db[_0xc802('0xad')],{'as':_0xc802('0x1ac'),'onDelete':_0xc802('0x10a'),'foreignKey':'FieldId'});db['ZohoConfiguration'][_0xc802('0x118')](db[_0xc802('0xab')],{'as':'Account','foreignKey':_0xc802('0x1af')});db[_0xc802('0xad')][_0xc802('0x10c')](db[_0xc802('0xad')],{'as':_0xc802('0x1b5'),'foreignKey':_0xc802('0x1b2')});db['ZohoField'][_0xc802('0x10c')](db[_0xc802('0xad')],{'as':'Description','foreignKey':_0xc802('0x1ba')});db[_0xc802('0xad')][_0xc802('0x10c')](db['ZohoField'],{'as':_0xc802('0x1b7'),'foreignKey':_0xc802('0x1b4')});db['ZohoField']['belongsTo'](db[_0xc802('0x8f')],{'as':_0xc802('0x8f'),'foreignKey':_0xc802('0x1b8')});db[_0xc802('0xaf')][_0xc802('0x10c')](db[_0xc802('0xb1')],{'as':'Configurations','onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x1af')});db[_0xc802('0xb1')][_0xc802('0x10c')](db['ZendeskField'],{'as':_0xc802('0x1b1'),'foreignKey':_0xc802('0x1b2')});db[_0xc802('0xb1')][_0xc802('0x10c')](db[_0xc802('0xb3')],{'as':'Descriptions','foreignKey':_0xc802('0x1ba')});db[_0xc802('0xb1')][_0xc802('0x10c')](db['ZendeskField'],{'as':'Fields','foreignKey':_0xc802('0x1b4')});db[_0xc802('0xb1')][_0xc802('0x118')](db['ZendeskAccount'],{'as':_0xc802('0x167'),'foreignKey':'AccountId'});db[_0xc802('0xb1')][_0xc802('0x119')](db['Tag'],{'through':_0xc802('0x1bc')});db['ZendeskField'][_0xc802('0x10c')](db[_0xc802('0xb3')],{'as':_0xc802('0x1b5'),'foreignKey':_0xc802('0x1b2')});db[_0xc802('0xb3')][_0xc802('0x10c')](db['ZendeskField'],{'as':'Description','foreignKey':_0xc802('0x1ba')});db[_0xc802('0xb3')][_0xc802('0x10c')](db[_0xc802('0xb3')],{'as':_0xc802('0x1b7'),'foreignKey':_0xc802('0x1b4')});db[_0xc802('0xb3')][_0xc802('0x118')](db[_0xc802('0x8f')],{'as':'Variable','foreignKey':_0xc802('0x1b8')});db['FreshdeskAccount'][_0xc802('0x10c')](db['FreshdeskConfiguration'],{'as':_0xc802('0x1b9'),'onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x1af')});db['FreshdeskConfiguration'][_0xc802('0x10c')](db[_0xc802('0x1bd')],{'as':_0xc802('0x1b1'),'onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x1b2')});db[_0xc802('0xb6')][_0xc802('0x10c')](db['FreshdeskField'],{'as':_0xc802('0x1b3'),'onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x1ba')});db[_0xc802('0xb6')][_0xc802('0x10c')](db[_0xc802('0x1bd')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xc802('0x1b4')});db[_0xc802('0xb6')][_0xc802('0x118')](db[_0xc802('0x1be')],{'as':_0xc802('0x167'),'foreignKey':_0xc802('0x1af')});db['FreshdeskConfiguration']['belongsToMany'](db[_0xc802('0x8c')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xc802('0x1bd')][_0xc802('0x10c')](db[_0xc802('0x1bd')],{'as':_0xc802('0x1b5'),'foreignKey':'SubjectId'});db['FreshdeskField'][_0xc802('0x10c')](db[_0xc802('0x1bd')],{'as':_0xc802('0x1b6'),'foreignKey':_0xc802('0x1ba')});db[_0xc802('0x1bd')][_0xc802('0x10c')](db[_0xc802('0x1bd')],{'as':_0xc802('0x1b7'),'foreignKey':_0xc802('0x1b4')});db[_0xc802('0x1bd')][_0xc802('0x118')](db[_0xc802('0x8f')],{'as':_0xc802('0x8f'),'foreignKey':_0xc802('0x1b8')});db['VtigerAccount'][_0xc802('0x10c')](db[_0xc802('0xb9')],{'as':_0xc802('0x1b9'),'onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x1af')});db[_0xc802('0xb9')][_0xc802('0x10c')](db[_0xc802('0xbb')],{'as':_0xc802('0x1b1'),'foreignKey':_0xc802('0x1b2')});db['VtigerConfiguration'][_0xc802('0x10c')](db['VtigerField'],{'as':_0xc802('0x1b3'),'foreignKey':_0xc802('0x1ba')});db[_0xc802('0xb9')][_0xc802('0x10c')](db['VtigerField'],{'as':_0xc802('0x1ac'),'foreignKey':_0xc802('0x1b4')});db[_0xc802('0xb9')]['belongsTo'](db[_0xc802('0x1bf')],{'as':'Account','foreignKey':'AccountId'});db[_0xc802('0xbb')][_0xc802('0x10c')](db[_0xc802('0xbb')],{'as':_0xc802('0x1b5'),'foreignKey':'SubjectId'});db[_0xc802('0xbb')][_0xc802('0x10c')](db[_0xc802('0xbb')],{'as':_0xc802('0x1b6'),'foreignKey':_0xc802('0x1ba')});db['VtigerField'][_0xc802('0x10c')](db[_0xc802('0xbb')],{'as':'Field','foreignKey':_0xc802('0x1b4')});db[_0xc802('0xbb')]['belongsTo'](db[_0xc802('0x8f')],{'as':_0xc802('0x8f'),'foreignKey':_0xc802('0x1b8')});db[_0xc802('0x1c0')][_0xc802('0x10c')](db['ServicenowConfiguration'],{'as':_0xc802('0x1b9'),'onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x1af')});db[_0xc802('0xbe')][_0xc802('0x10c')](db[_0xc802('0x1c1')],{'as':'Subjects','foreignKey':_0xc802('0x1b2')});db[_0xc802('0xbe')]['hasMany'](db[_0xc802('0x1c1')],{'as':_0xc802('0x1b3'),'foreignKey':_0xc802('0x1ba')});db['ServicenowConfiguration'][_0xc802('0x10c')](db['ServicenowField'],{'as':_0xc802('0x1ac'),'foreignKey':_0xc802('0x1b4')});db['ServicenowConfiguration']['belongsTo'](db[_0xc802('0x1c0')],{'as':'Account','foreignKey':_0xc802('0x1af')});db[_0xc802('0x1c1')][_0xc802('0x10c')](db[_0xc802('0x1c1')],{'as':_0xc802('0x1b5'),'foreignKey':'SubjectId'});db[_0xc802('0x1c1')]['hasMany'](db[_0xc802('0x1c1')],{'as':_0xc802('0x1b6'),'foreignKey':_0xc802('0x1ba')});db[_0xc802('0x1c1')][_0xc802('0x10c')](db[_0xc802('0x1c1')],{'as':_0xc802('0x1b7'),'foreignKey':_0xc802('0x1b4')});db[_0xc802('0x1c1')]['belongsTo'](db[_0xc802('0x8f')],{'as':_0xc802('0x8f'),'foreignKey':_0xc802('0x1b8')});db[_0xc802('0xc1')]['hasMany'](db[_0xc802('0x1c2')],{'as':_0xc802('0x1b9'),'onDelete':'cascade','foreignKey':_0xc802('0x1af')});db[_0xc802('0x1c2')][_0xc802('0x10c')](db['Dynamics365Field'],{'as':_0xc802('0x1b1'),'onDelete':_0xc802('0x10a'),'foreignKey':'SubjectId'});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':_0xc802('0x1b3'),'onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x1ba')});db['Dynamics365Configuration'][_0xc802('0x10c')](db[_0xc802('0xc4')],{'as':_0xc802('0x1ac'),'onDelete':_0xc802('0x10a'),'foreignKey':'FieldId'});db['Dynamics365Configuration']['belongsTo'](db[_0xc802('0xc1')],{'as':_0xc802('0x167'),'foreignKey':_0xc802('0x1af')});db[_0xc802('0xc4')][_0xc802('0x10c')](db[_0xc802('0xc4')],{'as':_0xc802('0x1b5'),'foreignKey':_0xc802('0x1b2')});db[_0xc802('0xc4')][_0xc802('0x10c')](db['Dynamics365Field'],{'as':_0xc802('0x1b6'),'foreignKey':_0xc802('0x1ba')});db[_0xc802('0xc4')]['hasMany'](db['Dynamics365Field'],{'as':_0xc802('0x1b7'),'foreignKey':'FieldId'});db['Dynamics365Field']['belongsTo'](db['Variable'],{'as':_0xc802('0x8f'),'foreignKey':_0xc802('0x1b8')});db[_0xc802('0x1c3')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0xc802('0x1b9'),'onDelete':_0xc802('0x10a'),'foreignKey':'AccountId'});db['FreshsalesConfiguration'][_0xc802('0x10c')](db[_0xc802('0xc8')],{'as':'Subjects','foreignKey':_0xc802('0x1b2')});db[_0xc802('0xc7')]['hasMany'](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0xc802('0x1ba')});db[_0xc802('0xc7')][_0xc802('0x10c')](db['FreshsalesField'],{'as':_0xc802('0x1ac'),'foreignKey':_0xc802('0x1b4')});db['FreshsalesConfiguration']['belongsTo'](db['FreshsalesAccount'],{'as':'Account','foreignKey':'AccountId'});db['FreshsalesField'][_0xc802('0x10c')](db[_0xc802('0xc8')],{'as':_0xc802('0x1b5'),'foreignKey':'SubjectId'});db['FreshsalesField'][_0xc802('0x10c')](db['FreshsalesField'],{'as':'Description','foreignKey':_0xc802('0x1ba')});db[_0xc802('0xc8')][_0xc802('0x10c')](db[_0xc802('0xc8')],{'as':_0xc802('0x1b7'),'foreignKey':'FieldId'});db[_0xc802('0xc8')][_0xc802('0x118')](db[_0xc802('0x8f')],{'as':_0xc802('0x8f'),'foreignKey':_0xc802('0x1b8')});db[_0xc802('0xcb')][_0xc802('0x118')](db[_0xc802('0x61')],{});db['ChatQueueReport'][_0xc802('0x118')](db['CmList'],{'as':_0xc802('0x16c'),'foreignKey':_0xc802('0x15d')});db[_0xc802('0xcb')][_0xc802('0x118')](db[_0xc802('0x6f')],{'as':'Contact','foreignKey':_0xc802('0x154')});db[_0xc802('0xcb')][_0xc802('0x118')](db[_0xc802('0x111')],{});db[_0xc802('0xcb')]['belongsTo'](db[_0xc802('0x187')],{});db[_0xc802('0xcb')]['belongsTo'](db[_0xc802('0x14')],{});db[_0xc802('0xcb')]['belongsTo'](db[_0xc802('0x185')],{});db[_0xc802('0xcd')][_0xc802('0x118')](db[_0xc802('0x14')],{'onDelete':'cascade','foreignKey':_0xc802('0x1c4')});db[_0xc802('0xcd')][_0xc802('0x118')](db[_0xc802('0x14')],{'onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x1c5')});db[_0xc802('0xd2')]['hasMany'](db[_0xc802('0xd1')],{'foreignKey':_0xc802('0x1c6'),'onDelete':_0xc802('0x10a')});db[_0xc802('0xd2')][_0xc802('0x10c')](db[_0xc802('0xcf')],{'foreignKey':'SessionId','onDelete':_0xc802('0x10a')});db[_0xc802('0x1c7')]['belongsTo'](db[_0xc802('0x54')],{});db[_0xc802('0x1c7')][_0xc802('0x118')](db[_0xc802('0xee')],{'as':'List','foreignKey':'ListId'});db[_0xc802('0x1c7')][_0xc802('0x118')](db[_0xc802('0x6f')],{'as':'Contact','foreignKey':_0xc802('0x154')});db['SmsQueueReport'][_0xc802('0x118')](db[_0xc802('0x57')],{});db[_0xc802('0x1c7')][_0xc802('0x118')](db[_0xc802('0x179')],{});db[_0xc802('0x1c7')]['belongsTo'](db[_0xc802('0x14')],{});db[_0xc802('0x1c7')][_0xc802('0x118')](db[_0xc802('0x59')],{});db[_0xc802('0xd7')]['hasMany'](db[_0xc802('0xd2')],{'foreignKey':_0xc802('0x1c8')});db[_0xc802('0xd7')][_0xc802('0x10c')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0xc802('0xd7')]['hasMany'](db[_0xc802('0xcf')],{'foreignKey':_0xc802('0x1c8')});db[_0xc802('0xdc')][_0xc802('0x119')](db[_0xc802('0x14')],{'as':'Users','through':_0xc802('0x13b')});db[_0xc802('0x11f')][_0xc802('0x119')](db[_0xc802('0x14')],{'as':_0xc802('0x14c'),'through':_0xc802('0x120')});db['Team']['belongsToMany'](db[_0xc802('0x1c')],{'through':_0xc802('0x106'),'as':'VoiceQueues'});db[_0xc802('0x11f')]['belongsToMany'](db[_0xc802('0x15f')],{'through':_0xc802('0x160'),'as':_0xc802('0x12a')});db[_0xc802('0x11f')][_0xc802('0x119')](db[_0xc802('0x185')],{'through':_0xc802('0x18b'),'as':_0xc802('0x12b')});db['Team'][_0xc802('0x119')](db[_0xc802('0x51')],{'through':_0xc802('0x176'),'as':_0xc802('0x1c9')});db[_0xc802('0x11f')][_0xc802('0x119')](db[_0xc802('0x59')],{'through':_0xc802('0x1ca'),'as':_0xc802('0x1cb')});db[_0xc802('0x11f')][_0xc802('0x119')](db['OpenchannelQueue'],{'through':_0xc802('0x181'),'as':'OpenchannelQueues'});db['Team'][_0xc802('0x119')](db['WhatsappQueue'],{'through':'team_has_whatsapp_queues','as':_0xc802('0x130')});db[_0xc802('0x11f')][_0xc802('0x119')](db[_0xc802('0xf0')],{'through':_0xc802('0x108'),'as':'VoicePrefixes'});db[_0xc802('0xdf')][_0xc802('0x10c')](db[_0xc802('0x18f')],{'as':_0xc802('0x143'),'foreignKey':_0xc802('0x195')});db[_0xc802('0xdf')][_0xc802('0x10c')](db[_0xc802('0x74')],{'as':_0xc802('0x144'),'foreignKey':_0xc802('0x195')});db[_0xc802('0xdf')][_0xc802('0x10c')](db[_0xc802('0x75')],{'as':_0xc802('0x190'),'foreignKey':_0xc802('0x195')});db[_0xc802('0xdf')][_0xc802('0x10c')](db[_0xc802('0x72')],{'as':'HopperBlacks','foreignKey':_0xc802('0x195')});db[_0xc802('0xdf')]['belongsTo'](db['Trunk'],{'as':_0xc802('0x2e'),'foreignKey':_0xc802('0x1cc')});db[_0xc802('0xdf')][_0xc802('0x118')](db[_0xc802('0x2e')],{'as':'TrunkBackup','foreignKey':_0xc802('0x147')});db[_0xc802('0xdf')][_0xc802('0x118')](db[_0xc802('0x148')],{'as':_0xc802('0x148'),'foreignKey':_0xc802('0x149')});db[_0xc802('0xdf')][_0xc802('0x118')](db['SquareProject'],{'as':_0xc802('0xdc'),'foreignKey':_0xc802('0x1cd')});db[_0xc802('0xdf')][_0xc802('0x119')](db['CmList'],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0xc802('0xdf')][_0xc802('0x119')](db[_0xc802('0xee')],{'as':'BlackLists','through':_0xc802('0x1ce')});db[_0xc802('0x166')][_0xc802('0x118')](db[_0xc802('0x169')],{'as':_0xc802('0x169'),'foreignKey':_0xc802('0x16a')});db[_0xc802('0xe6')][_0xc802('0x118')](db['MailMessage'],{});db['MailTransferReport'][_0xc802('0x118')](db[_0xc802('0x41')],{});db[_0xc802('0xe6')][_0xc802('0x118')](db[_0xc802('0x3c')],{'foreignKey':_0xc802('0x1cf'),'as':_0xc802('0x1d0')});db[_0xc802('0xe6')][_0xc802('0x118')](db[_0xc802('0x14')],{'foreignKey':'FromUserId','as':_0xc802('0x1d1')});db[_0xc802('0xe6')][_0xc802('0x118')](db['User'],{'foreignKey':_0xc802('0x1d2'),'as':_0xc802('0x1d3')});db[_0xc802('0xe6')][_0xc802('0x118')](db['MailQueue'],{'foreignKey':_0xc802('0x1d4'),'as':_0xc802('0x1d5')});db[_0xc802('0xe6')][_0xc802('0x118')](db[_0xc802('0x3c')],{'foreignKey':'ToMailAccountId','as':_0xc802('0x1d6')});db[_0xc802('0xe8')][_0xc802('0x118')](db[_0xc802('0x187')],{});db['ChatTransferReport'][_0xc802('0x118')](db['ChatInteraction'],{});db[_0xc802('0xe8')][_0xc802('0x118')](db['ChatWebsite'],{'foreignKey':_0xc802('0x1d7'),'as':_0xc802('0x1d0')});db[_0xc802('0xe8')][_0xc802('0x118')](db[_0xc802('0x14')],{'foreignKey':_0xc802('0x1d8'),'as':_0xc802('0x1d1')});db['ChatTransferReport'][_0xc802('0x118')](db[_0xc802('0x14')],{'foreignKey':'ToUserId','as':_0xc802('0x1d3')});db[_0xc802('0xe8')][_0xc802('0x118')](db['ChatQueue'],{'foreignKey':_0xc802('0x1d9'),'as':_0xc802('0x1d5')});db[_0xc802('0xe8')][_0xc802('0x118')](db[_0xc802('0x61')],{'foreignKey':_0xc802('0x1da'),'as':'ToAccount'});db[_0xc802('0xe9')]['belongsTo'](db['FaxMessage'],{});db['FaxTransferReport'][_0xc802('0x118')](db[_0xc802('0x4d')],{});db['FaxTransferReport'][_0xc802('0x118')](db[_0xc802('0x49')],{'foreignKey':'FromFaxAccountId','as':_0xc802('0x1d0')});db[_0xc802('0xe9')][_0xc802('0x118')](db[_0xc802('0x14')],{'foreignKey':_0xc802('0x1d8'),'as':'FromAgent'});db[_0xc802('0xe9')][_0xc802('0x118')](db[_0xc802('0x14')],{'foreignKey':'ToUserId','as':_0xc802('0x1d3')});db[_0xc802('0xe9')][_0xc802('0x118')](db['FaxQueue'],{'foreignKey':_0xc802('0x1db'),'as':_0xc802('0x1d5')});db[_0xc802('0xe9')]['belongsTo'](db['FaxAccount'],{'foreignKey':_0xc802('0x1dc'),'as':'ToAccount'});db[_0xc802('0xea')][_0xc802('0x118')](db[_0xc802('0x17e')],{});db[_0xc802('0xea')][_0xc802('0x118')](db[_0xc802('0x5e')],{});db[_0xc802('0xea')][_0xc802('0x118')](db[_0xc802('0x5a')],{'foreignKey':_0xc802('0x1dd'),'as':_0xc802('0x1d0')});db[_0xc802('0xea')][_0xc802('0x118')](db[_0xc802('0x14')],{'foreignKey':'FromUserId','as':_0xc802('0x1d1')});db[_0xc802('0xea')]['belongsTo'](db[_0xc802('0x14')],{'foreignKey':_0xc802('0x1d2'),'as':_0xc802('0x1d3')});db['OpenchannelTransferReport'][_0xc802('0x118')](db['OpenchannelQueue'],{'foreignKey':_0xc802('0x1de'),'as':_0xc802('0x1d5')});db['OpenchannelTransferReport'][_0xc802('0x118')](db[_0xc802('0x5a')],{'foreignKey':_0xc802('0x1df'),'as':_0xc802('0x1d6')});db[_0xc802('0xec')][_0xc802('0x118')](db['SmsMessage'],{});db['SmsTransferReport'][_0xc802('0x118')](db[_0xc802('0x57')],{});db['SmsTransferReport'][_0xc802('0x118')](db['SmsAccount'],{'foreignKey':_0xc802('0x1e0'),'as':'FromAccount'});db[_0xc802('0xec')][_0xc802('0x118')](db[_0xc802('0x14')],{'foreignKey':'FromUserId','as':_0xc802('0x1d1')});db[_0xc802('0xec')]['belongsTo'](db[_0xc802('0x14')],{'foreignKey':_0xc802('0x1d2'),'as':_0xc802('0x1d3')});db[_0xc802('0xec')][_0xc802('0x118')](db[_0xc802('0x59')],{'foreignKey':_0xc802('0x1e1'),'as':_0xc802('0x1d5')});db[_0xc802('0xec')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0xc802('0x1e2'),'as':_0xc802('0x1d6')});db[_0xc802('0xee')][_0xc802('0x10c')](db[_0xc802('0x7f')],{'as':_0xc802('0x15a'),'foreignKey':_0xc802('0x15d'),'onDelete':'cascade'});db[_0xc802('0xee')][_0xc802('0x10c')](db['CmCustomField'],{'as':_0xc802('0x1e3'),'foreignKey':'ListId'});db[_0xc802('0xee')]['hasMany'](db['CmContact'],{'as':'Contacts','onDelete':_0xc802('0x10a'),'foreignKey':'ListId'});db[_0xc802('0xee')]['hasMany'](db[_0xc802('0x74')],{'as':_0xc802('0x144'),'foreignKey':_0xc802('0x15d')});db[_0xc802('0xee')][_0xc802('0x10c')](db['CmHopperHistory'],{'as':_0xc802('0x10f'),'foreignKey':'ListId'});db['CmList']['hasMany'](db['ReportAgentPreview'],{'as':_0xc802('0x76'),'foreignKey':_0xc802('0x15d')});db[_0xc802('0xee')][_0xc802('0x119')](db[_0xc802('0x1c')],{'as':_0xc802('0x1e4'),'through':'voice_queues_has_cm_lists'});db['CmList'][_0xc802('0x119')](db[_0xc802('0x14')],{'as':'Agents','through':_0xc802('0x11e')});db[_0xc802('0xf0')][_0xc802('0x10c')](db[_0xc802('0x1a')],{'as':_0xc802('0x19f'),'onDelete':'cascade'});db['VoicePrefix']['belongsToMany'](db[_0xc802('0x14')],{'as':_0xc802('0x14c'),'through':'UserVoicePrefix'});db['VoicePrefix'][_0xc802('0x119')](db[_0xc802('0x11f')],{'through':_0xc802('0x108'),'as':'Teams'});db['UserProfile'][_0xc802('0x10c')](db['User'],{'as':_0xc802('0x164'),'foreignKey':_0xc802('0x1e5')});db['UserProfile'][_0xc802('0x10c')](db[_0xc802('0xf4')],{'as':_0xc802('0x1e6'),'foreignKey':'userProfileId','onDelete':_0xc802('0x10a')});db['UserProfileSection']['hasMany'](db[_0xc802('0x1e7')],{'as':'Resources','foreignKey':_0xc802('0x1e8'),'onDelete':_0xc802('0x10a')});db['WhatsappAccount']['hasMany'](db[_0xc802('0x7f')],{'as':_0xc802('0x15a'),'foreignKey':'WhatsappAccountId','onDelete':_0xc802('0x10a')});db[_0xc802('0xf9')][_0xc802('0x10c')](db[_0xc802('0x7d')],{'as':_0xc802('0x15b'),'foreignKey':_0xc802('0x1e9')});db[_0xc802('0xf9')]['hasMany'](db[_0xc802('0xfc')],{'as':_0xc802('0x14f'),'foreignKey':_0xc802('0x1e9')});db[_0xc802('0xf9')][_0xc802('0x10c')](db[_0xc802('0x1a4')],{'as':_0xc802('0x15c')});db[_0xc802('0xf9')]['hasMany'](db[_0xc802('0x1ea')],{'as':_0xc802('0x13e')});db[_0xc802('0xf9')][_0xc802('0x118')](db[_0xc802('0xee')],{'as':'List','foreignKey':_0xc802('0x15d')});db[_0xc802('0xf9')][_0xc802('0x118')](db['Pause'],{'as':_0xc802('0x14a'),'foreignKey':_0xc802('0x14b')});db[_0xc802('0xf9')][_0xc802('0x119')](db[_0xc802('0x14')],{'as':_0xc802('0x14c'),'through':_0xc802('0x139')});db[_0xc802('0x1ea')][_0xc802('0x118')](db[_0xc802('0x14')],{'onDelete':'restrict'});db[_0xc802('0x1ea')][_0xc802('0x118')](db['WhatsappQueue'],{'onDelete':_0xc802('0x16b')});db['WhatsappApplication'][_0xc802('0x118')](db['WhatsappAccount'],{'onDelete':_0xc802('0x16b')});db[_0xc802('0x1ea')][_0xc802('0x118')](db[_0xc802('0x148')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0xc802('0x1ea')][_0xc802('0x118')](db['Tag'],{'onDelete':_0xc802('0x16b'),'foreignKey':_0xc802('0x170')});db[_0xc802('0x1a4')][_0xc802('0x10c')](db[_0xc802('0xfc')],{'as':_0xc802('0x14f'),'onDelete':_0xc802('0x10a'),'foreignKey':_0xc802('0x1eb')});db[_0xc802('0x1a4')][_0xc802('0x118')](db[_0xc802('0xf9')],{'as':_0xc802('0x167'),'foreignKey':_0xc802('0x1e9')});db[_0xc802('0x1a4')][_0xc802('0x118')](db['CmContact'],{'as':'Contact','foreignKey':_0xc802('0x154')});db['WhatsappInteraction'][_0xc802('0x118')](db[_0xc802('0x14')],{'as':_0xc802('0x161'),'foreignKey':_0xc802('0x10b')});db[_0xc802('0x1a4')][_0xc802('0x119')](db[_0xc802('0x8c')],{'through':_0xc802('0x1a5'),'as':_0xc802('0x173')});db[_0xc802('0x1a4')]['belongsToMany'](db['Tag'],{'through':_0xc802('0x1a5'),'as':_0xc802('0x163')});db[_0xc802('0x1a4')]['belongsToMany'](db['User'],{'as':_0xc802('0x164'),'through':_0xc802('0x125'),'foreignKey':_0xc802('0x1eb')});db['WhatsappMessage'][_0xc802('0x118')](db[_0xc802('0x14')],{'as':_0xc802('0x14')});db[_0xc802('0xfc')][_0xc802('0x118')](db[_0xc802('0x6f')],{'onDelete':'cascade','as':_0xc802('0x153')});db[_0xc802('0xfc')][_0xc802('0x118')](db[_0xc802('0x1a4')],{'onDelete':'cascade','as':_0xc802('0x174'),'foreignKey':_0xc802('0x1eb')});db[_0xc802('0xfc')]['belongsTo'](db[_0xc802('0xf9')],{'as':_0xc802('0x167'),'foreignKey':_0xc802('0x1e9')});db[_0xc802('0xfe')]['belongsTo'](db[_0xc802('0xf9')],{});db[_0xc802('0xfe')][_0xc802('0x118')](db[_0xc802('0xee')],{'as':_0xc802('0x16c'),'foreignKey':'ListId'});db[_0xc802('0xfe')][_0xc802('0x118')](db[_0xc802('0x6f')],{'as':_0xc802('0x153'),'foreignKey':'ContactId'});db[_0xc802('0xfe')]['belongsTo'](db['WhatsappInteraction'],{});db[_0xc802('0xfe')][_0xc802('0x118')](db[_0xc802('0x102')],{});db[_0xc802('0xfe')][_0xc802('0x118')](db[_0xc802('0xfc')],{});db[_0xc802('0xfe')][_0xc802('0x118')](db[_0xc802('0x14')],{});db[_0xc802('0x100')]['belongsTo'](db[_0xc802('0xfc')],{});db['WhatsappTransferReport'][_0xc802('0x118')](db[_0xc802('0x1a4')],{});db[_0xc802('0x100')][_0xc802('0x118')](db[_0xc802('0xf9')],{'foreignKey':_0xc802('0x1ec'),'as':_0xc802('0x1d0')});db[_0xc802('0x100')]['belongsTo'](db[_0xc802('0xf9')],{'foreignKey':'ToWhatsappAccountId','as':_0xc802('0x1d6')});db[_0xc802('0x100')][_0xc802('0x118')](db['WhatsappQueue'],{'foreignKey':_0xc802('0x1ed'),'as':_0xc802('0x1d5')});db[_0xc802('0x100')][_0xc802('0x118')](db[_0xc802('0x14')],{'foreignKey':_0xc802('0x1d8'),'as':'FromAgent'});db[_0xc802('0x100')][_0xc802('0x118')](db[_0xc802('0x14')],{'foreignKey':_0xc802('0x1d2'),'as':_0xc802('0x1d3')});db['WhatsappQueue'][_0xc802('0x119')](db[_0xc802('0x14')],{'as':_0xc802('0x14c'),'through':_0xc802('0x3b'),'foreignKey':_0xc802('0x1ee')});db[_0xc802('0x102')]['belongsToMany'](db['Team'],{'through':'team_has_whatsapp_queues','as':'Teams'});module[_0xc802('0x1ef')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index b539fa6..a9a2502 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x555b=['/demo','snippet','3.0.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','username','password','newPassword','firstName','lastName','street','phone','mobile','fax','clientId','securityToken','token','accessToken','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','key','pass','accountSid','localstationid','dsn','secret','oldPassword','isArray','isPlainObject','isString','replace','@@{','}@@','includes','lodash','path','express','util','./errors','./config/environment','api','./config/logger','auth','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','user','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_id','agent_name','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelQueue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','/api/cdr','./api/cdr','/api/schedules','/api/sounds','./api/sound','./api/template','/api/triggers','./api/trigger','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./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/intZohoConfiguration','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/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/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userNotifications','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/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/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/apidoc','static','/www','join','root'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x555b,0x174));var _0xb555=function(_0x4bc2f8,_0x1eff7d){_0x4bc2f8=_0x4bc2f8-0x0;var _0xdc2b97=_0x555b[_0x4bc2f8];return _0xdc2b97;};'use strict';var _=require(_0xb555('0x0'));var path=require(_0xb555('0x1'));var express=require(_0xb555('0x2'));var ewinston=require('express-winston');var util=require(_0xb555('0x3'));var errors=require(_0xb555('0x4'));var config=require(_0xb555('0x5'));var logger=require('./config/logger')(_0xb555('0x6'));var authLogger=require(_0xb555('0x7'))(_0xb555('0x8'));exports['default']=function(_0xcd6a1d){_0xcd6a1d['use'](ewinston[_0xb555('0x9')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x5aec7c,_0x459208){var _0x37bd00=_0xb555('0xa');if(!_[_0xb555('0xb')](_0x5aec7c[_0xb555('0xc')])){_0x37bd00+=_0xb555('0xd');var _0x2a486c=_0x5aec7c[_0xb555('0xc')];maskSensitiveData(_0x2a486c);}return util[_0xb555('0xe')](_0x37bd00,_0x5aec7c[_0xb555('0xf')],_0x5aec7c[_0xb555('0x10')][_0xb555('0x11')]?_0x5aec7c[_0xb555('0x10')][_0xb555('0x11')]:_0x5aec7c[_0xb555('0x12')]['remoteAddress']||_0x5aec7c['ip'],_0x5aec7c[_0xb555('0x13')],_0x459208[_0xb555('0x14')],_0x459208[_0xb555('0x15')],_0x5aec7c[_0xb555('0x16')]?_0x5aec7c[_0xb555('0x16')]['id']:null,_0x5aec7c[_0xb555('0x16')]?_0x5aec7c['user']['name']:null,_0x5aec7c[_0xb555('0x16')]?_0x5aec7c[_0xb555('0x16')]['role']:null,_0x2a486c?util[_0xb555('0x17')](_0x2a486c,![],null):'');}}));_0xcd6a1d[_0xb555('0x18')](ewinston[_0xb555('0x9')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x1dc76c,_0x549f25){var _0x53649e=_0xb555('0x19');if(_0x1dc76c[_0xb555('0xc')]&&_0x1dc76c[_0xb555('0xc')]['device']&&_0x1dc76c[_0xb555('0xc')]['agent_id']){_0x53649e=_0xb555('0x1a');}return util[_0xb555('0xe')](_0x53649e,_0x1dc76c[_0xb555('0xf')],_0x1dc76c[_0xb555('0x10')][_0xb555('0x11')]?_0x1dc76c[_0xb555('0x10')][_0xb555('0x11')]:_0x1dc76c['connection']['remoteAddress']||_0x1dc76c['ip'],_0x1dc76c[_0xb555('0x13')],_0x549f25[_0xb555('0x14')],_0x549f25[_0xb555('0x15')],_0x1dc76c[_0xb555('0x16')]?_0x1dc76c[_0xb555('0x16')]['id']:null,_0x1dc76c[_0xb555('0x16')]?_0x1dc76c[_0xb555('0x16')]['name']:null,_0x1dc76c[_0xb555('0x16')]?_0x1dc76c[_0xb555('0x16')]['role']:null,_0x1dc76c[_0xb555('0xc')]&&_0x1dc76c[_0xb555('0xc')]['device']?_0x1dc76c[_0xb555('0xc')]['device']:_0xb555('0x1b'),_0x1dc76c[_0xb555('0xc')]&&_0x1dc76c[_0xb555('0xc')]['agent_id']?_0x1dc76c[_0xb555('0xc')][_0xb555('0x1c')]:'',_0x1dc76c['body']&&_0x1dc76c['body'][_0xb555('0x1d')]?_0x1dc76c['body'][_0xb555('0x1d')]:'');},'ignoreRoute':function(_0x249900){var _0xa014f9=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xa014f9['test'](_0x249900[_0xb555('0x13')]);}}));_0xcd6a1d['use'](_0xb555('0x1e'),require(_0xb555('0x1f')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x20'),require('./api/voiceChanSpy'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x21'),require(_0xb555('0x22')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x23'),require(_0xb555('0x24')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x25'),require(_0xb555('0x26')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x27'),require(_0xb555('0x28')));_0xcd6a1d['use']('/api/voice/recordings',require(_0xb555('0x29')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x2a'),require(_0xb555('0x2b')));_0xcd6a1d[_0xb555('0x18')]('/api/voice/mails',require(_0xb555('0x2c')));_0xcd6a1d[_0xb555('0x18')]('/api/voice/mails/messages',require(_0xb555('0x2d')));_0xcd6a1d[_0xb555('0x18')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x2e'),require(_0xb555('0x2f')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x30'),require(_0xb555('0x31')));_0xcd6a1d['use'](_0xb555('0x32'),require(_0xb555('0x33')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x34'),require(_0xb555('0x35')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x36'),require(_0xb555('0x37')));_0xcd6a1d[_0xb555('0x18')]('/api/voice/transfers/reports',require(_0xb555('0x38')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x39'),require(_0xb555('0x3a')));_0xcd6a1d['use'](_0xb555('0x3b'),require('./api/mailAccount'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x3c'),require(_0xb555('0x3d')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x3e'),require(_0xb555('0x3f')));_0xcd6a1d['use']('/api/mail/interactions',require(_0xb555('0x40')));_0xcd6a1d[_0xb555('0x18')]('/api/mail/messages',require(_0xb555('0x41')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x42'),require('./api/mailApplication'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x43'),require(_0xb555('0x44')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x45'),require('./api/dashboard'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x46'),require('./api/dashboardItem'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x47'),require(_0xb555('0x48')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x49'),require('./api/faxApplication'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x4a'),require(_0xb555('0x4b')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x4c'),require(_0xb555('0x4d')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x4e'),require(_0xb555('0x4f')));_0xcd6a1d['use']('/api/fax/reports/queue',require(_0xb555('0x50')));_0xcd6a1d['use'](_0xb555('0x51'),require(_0xb555('0x52')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x53'),require(_0xb555('0x54')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x55'),require(_0xb555('0x56')));_0xcd6a1d['use'](_0xb555('0x57'),require('./api/smsMessage'));_0xcd6a1d['use'](_0xb555('0x58'),require(_0xb555('0x59')));_0xcd6a1d['use'](_0xb555('0x5a'),require(_0xb555('0x5b')));_0xcd6a1d[_0xb555('0x18')]('/api/openchannel/applications',require(_0xb555('0x5c')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x5d'),require(_0xb555('0x5e')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x5f'),require('./api/openchannelMessage'));_0xcd6a1d[_0xb555('0x18')]('/api/openchannel/queues',require(_0xb555('0x60')));_0xcd6a1d[_0xb555('0x18')]('/api/chat/websites',require('./api/chatWebsite'));_0xcd6a1d[_0xb555('0x18')]('/api/openchannel/reports/queue',require(_0xb555('0x61')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x62'),require(_0xb555('0x63')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x64'),require(_0xb555('0x65')));_0xcd6a1d[_0xb555('0x18')]('/api/chat/messages',require(_0xb555('0x66')));_0xcd6a1d['use']('/api/chat/offline_messages',require(_0xb555('0x67')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x68'),require(_0xb555('0x69')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x6a'),require(_0xb555('0x6b')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x6c'),require(_0xb555('0x6d')));_0xcd6a1d[_0xb555('0x18')]('/api/cm/companies',require(_0xb555('0x6e')));_0xcd6a1d['use']('/api/cm/contacts',require(_0xb555('0x6f')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x70'),require(_0xb555('0x71')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x72'),require(_0xb555('0x73')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x74'),require(_0xb555('0x75')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x76'),require('./api/cmHopperHistory'));_0xcd6a1d['use'](_0xb555('0x77'),require(_0xb555('0x78')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x79'),require(_0xb555('0x7a')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x7b'),require(_0xb555('0x7c')));_0xcd6a1d['use'](_0xb555('0x7d'),require('./api/cannedAnswer'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x7e'),require(_0xb555('0x7f')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x80'),require(_0xb555('0x81')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x82'),require('./api/interval'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x83'),require('./api/pause'));_0xcd6a1d['use'](_0xb555('0x84'),require(_0xb555('0x85')));_0xcd6a1d['use']('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x86'),require('./api/schedule'));_0xcd6a1d['use'](_0xb555('0x87'),require(_0xb555('0x88')));_0xcd6a1d[_0xb555('0x18')]('/api/tags',require('./api/tag'));_0xcd6a1d[_0xb555('0x18')]('/api/templates',require(_0xb555('0x89')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x8a'),require(_0xb555('0x8b')));_0xcd6a1d['use']('/api/variables',require('./api/variable'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x8c'),require(_0xb555('0x8d')));_0xcd6a1d['use'](_0xb555('0x8e'),require(_0xb555('0x8f')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x90'),require(_0xb555('0x91')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x92'),require(_0xb555('0x93')));_0xcd6a1d[_0xb555('0x18')]('/api/analytics/extracted_reports',require(_0xb555('0x94')));_0xcd6a1d['use']('/api/analytics/metrics',require(_0xb555('0x95')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x96'),require(_0xb555('0x97')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x98'),require(_0xb555('0x99')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x9a'),require('./api/intSalesforceAccount'));_0xcd6a1d[_0xb555('0x18')]('/api/integrations/salesforce/configurations',require(_0xb555('0x9b')));_0xcd6a1d['use'](_0xb555('0x9c'),require(_0xb555('0x9d')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x9e'),require(_0xb555('0x9f')));_0xcd6a1d['use'](_0xb555('0xa0'),require(_0xb555('0xa1')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xa2'),require('./api/intSugarcrmField'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xa3'),require(_0xb555('0xa4')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xa5'),require(_0xb555('0xa6')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xa7'),require('./api/intDeskField'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xa8'),require(_0xb555('0xa9')));_0xcd6a1d[_0xb555('0x18')]('/api/integrations/zoho/configurations',require(_0xb555('0xaa')));_0xcd6a1d['use']('/api/integrations/zoho/fields',require('./api/intZohoField'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xab'),require('./api/intZendeskAccount'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xac'),require('./api/intZendeskConfiguration'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xad'),require(_0xb555('0xae')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xaf'),require(_0xb555('0xb0')));_0xcd6a1d['use'](_0xb555('0xb1'),require('./api/intFreshdeskConfiguration'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xb2'),require(_0xb555('0xb3')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xb4'),require(_0xb555('0xb5')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xb6'),require('./api/intVtigerConfiguration'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xb7'),require(_0xb555('0xb8')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xb9'),require('./api/intServicenowAccount'));_0xcd6a1d['use'](_0xb555('0xba'),require('./api/intServicenowConfiguration'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xbb'),require(_0xb555('0xbc')));_0xcd6a1d['use']('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xbd'),require(_0xb555('0xbe')));_0xcd6a1d[_0xb555('0x18')]('/api/integrations/dynamics365/fields',require(_0xb555('0xbf')));_0xcd6a1d['use'](_0xb555('0xc0'),require(_0xb555('0xc1')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xc2'),require(_0xb555('0xc3')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xc4'),require(_0xb555('0xc5')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xc6'),require(_0xb555('0xc7')));_0xcd6a1d['use'](_0xb555('0xc8'),require(_0xb555('0xc9')));_0xcd6a1d[_0xb555('0x18')]('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xca'),require('./api/jscriptyAnswerReport'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xcb'),require(_0xb555('0xcc')));_0xcd6a1d['use'](_0xb555('0xcd'),require(_0xb555('0xce')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xcf'),require(_0xb555('0xd0')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xd1'),require(_0xb555('0xd2')));_0xcd6a1d[_0xb555('0x18')]('/api/square/details/reports',require(_0xb555('0xd3')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xd4'),require('./api/jscriptyProject'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xd5'),require(_0xb555('0xd6')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xd7'),require(_0xb555('0xd8')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xd9'),require(_0xb555('0xda')));_0xcd6a1d[_0xb555('0x18')]('/api/square/recordings',require(_0xb555('0xdb')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xdc'),require(_0xb555('0xdd')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xde'),require(_0xb555('0xdf')));_0xcd6a1d[_0xb555('0x18')]('/api/license',require('./api/license'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xe0'),require(_0xb555('0xe1')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xe2'),require(_0xb555('0xe3')));_0xcd6a1d['use'](_0xb555('0xe4'),require('./api/attachment'));_0xcd6a1d[_0xb555('0x18')]('/api/plugins',require(_0xb555('0xe5')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xe6'),require(_0xb555('0xe7')));_0xcd6a1d['use']('/api/chat/reports/transfer',require(_0xb555('0xe8')));_0xcd6a1d['use'](_0xb555('0xe9'),require('./api/faxTransferReport'));_0xcd6a1d['use']('/api/openchannel/reports/transfer',require(_0xb555('0xea')));_0xcd6a1d[_0xb555('0x18')]('/api/sms/reports/transfer',require(_0xb555('0xeb')));_0xcd6a1d['use'](_0xb555('0xec'),require('./api/cmList'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xed'),require(_0xb555('0xee')));_0xcd6a1d['use'](_0xb555('0xef'),require(_0xb555('0xf0')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xf1'),require(_0xb555('0xf2')));_0xcd6a1d['use']('/api/userProfile/resources',require('./api/userProfileResource'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xf3'),require('./api/userNotification'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xf4'),require('./api/whatsappAccount'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xf5'),require(_0xb555('0xf6')));_0xcd6a1d[_0xb555('0x18')]('/api/whatsapp/interactions',require(_0xb555('0xf7')));_0xcd6a1d['use'](_0xb555('0xf8'),require(_0xb555('0xf9')));_0xcd6a1d[_0xb555('0x18')]('/api/whatsapp/reports/queue',require(_0xb555('0xfa')));_0xcd6a1d['use'](_0xb555('0xfb'),require(_0xb555('0xfc')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xfd'),require(_0xb555('0xfe')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0xff'),require('./api/cloudProvider'));_0xcd6a1d['use'](_0xb555('0x100'),require(_0xb555('0x101')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x102'),require(_0xb555('0x103')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x104'),require('./api/authGoogle'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x105'),require(_0xb555('0x106')));_0xcd6a1d['use'](_0xb555('0x107'),require(_0xb555('0x108')));_0xcd6a1d[_0xb555('0x18')]('/api/version',require(_0xb555('0x109')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x10a'),require(_0xb555('0x10b')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x10c'),require('./api/pm2'));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x10d'),require(_0xb555('0x10e')));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x10f'),express[_0xb555('0x110')](path['join'](config['root'],_0xb555('0x10f'))));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x111'),express[_0xb555('0x110')](path[_0xb555('0x112')](config[_0xb555('0x113')],_0xb555('0x111'))));_0xcd6a1d[_0xb555('0x18')](_0xb555('0x114'),express['static'](path[_0xb555('0x112')](config[_0xb555('0x113')],_0xb555('0x114'))));_0xcd6a1d[_0xb555('0x18')]('/snippet',express[_0xb555('0x110')](path['join'](config[_0xb555('0x113')],_0xb555('0x115'),_0xb555('0x116'))));_0xcd6a1d[_0xb555('0x18')]('/plugins',express[_0xb555('0x110')](path[_0xb555('0x112')](config[_0xb555('0x113')],_0xb555('0x117'))));_0xcd6a1d[_0xb555('0x118')](_0xb555('0x119'))[_0xb555('0x11a')](errors[0x194]);_0xcd6a1d[_0xb555('0x118')]('/*')[_0xb555('0x11a')](function(_0x422b88,_0x6b98d2){_0x6b98d2['sendFile'](path[_0xb555('0x11b')](_0xcd6a1d['get'](_0xb555('0x11c'))+_0xb555('0x11d')));});};var sensitiveFields=[_0xb555('0x11e'),_0xb555('0x11f'),_0xb555('0x120'),'apiKey',_0xb555('0x121'),_0xb555('0x122'),_0xb555('0x123'),_0xb555('0x124'),_0xb555('0x125'),_0xb555('0x126'),'email',_0xb555('0x127'),'clientSecret',_0xb555('0x128'),'code','accessKey','tenantId',_0xb555('0x129'),'channelSecret',_0xb555('0x12a'),'accessTokenSecret',_0xb555('0x12b'),_0xb555('0x12c'),_0xb555('0x12d'),_0xb555('0x12e'),_0xb555('0x12f'),_0xb555('0x130'),_0xb555('0x131'),_0xb555('0x132'),_0xb555('0x133'),_0xb555('0x134'),_0xb555('0x135'),'secretaccesskey',_0xb555('0x136'),_0xb555('0x16'),_0xb555('0x137'),_0xb555('0x138'),_0xb555('0x139'),_0xb555('0x13a'),_0xb555('0x13b'),'registry',_0xb555('0x13c')];function maskSensitiveData(_0x1cb173){var _0x34429b=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x1cb173))return;for(var _0x2c82d5 in _0x1cb173){if(_[_0xb555('0x13d')](_0x1cb173[_0x2c82d5])){for(var _0x305db5=0x0;_0x305db5<_0x1cb173[_0x2c82d5]['length'];_0x305db5++){maskSensitiveData(_0x1cb173[_0x2c82d5][_0x305db5]);}}else if(_[_0xb555('0x13e')](_0x1cb173[_0x2c82d5])){maskSensitiveData(_0x1cb173[_0x2c82d5]);}else if(_[_0xb555('0x13f')](_0x1cb173[_0x2c82d5])){_0x1cb173[_0x2c82d5]=_0x1cb173[_0x2c82d5][_0xb555('0x140')](/{{{/g,_0xb555('0x141'))['replace'](/}}}/g,_0xb555('0x142'))[_0xb555('0x140')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0xb555('0x143')](sensitiveFields,_0x2c82d5)){_0x1cb173[_0x2c82d5]=_0x1cb173[_0x2c82d5][_0xb555('0x140')](_0x34429b,'*');}}}} \ No newline at end of file +var _0xa7ec=['./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','./api/cloudProvider','/api/auth/local','./api/authLocal','/api/jira','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/apidoc','static','join','/www','/demo','root','/snippet','snippet','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','password','newPassword','apiKey','lastName','street','phone','mobile','fax','email','clientId','securityToken','code','accessKey','tenantId','token','channelSecret','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridnum','exten','vidaooApiKey','secretaccesskey','key','accountSid','localstationid','dsn','secret','isPlainObject','length','isString','replace','includes','path','express','./errors','./config/environment','api','./config/logger','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','method','headers','connection','remoteAddress','url','statusCode','responseTime','user','name','role','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','format','x-forwarded-for','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/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/networks','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/plugins','./api/plugin','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists'];(function(_0x4d2c8b,_0x30fbd3){var _0x5ab893=function(_0x204dd7){while(--_0x204dd7){_0x4d2c8b['push'](_0x4d2c8b['shift']());}};_0x5ab893(++_0x30fbd3);}(_0xa7ec,0x195));var _0xca7e=function(_0x38dfb8,_0x573910){_0x38dfb8=_0x38dfb8-0x0;var _0x38d457=_0xa7ec[_0x38dfb8];return _0x38d457;};'use strict';var _=require('lodash');var path=require(_0xca7e('0x0'));var express=require(_0xca7e('0x1'));var ewinston=require('express-winston');var util=require('util');var errors=require(_0xca7e('0x2'));var config=require(_0xca7e('0x3'));var logger=require('./config/logger')(_0xca7e('0x4'));var authLogger=require(_0xca7e('0x5'))('auth');exports[_0xca7e('0x6')]=function(_0x235446){_0x235446[_0xca7e('0x7')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x3bf0c6,_0x406afe){var _0x3ba7ed=_0xca7e('0x8');if(!_[_0xca7e('0x9')](_0x3bf0c6[_0xca7e('0xa')])){_0x3ba7ed+='\x20body=%s';var _0x3bcf24=_0x3bf0c6[_0xca7e('0xa')];maskSensitiveData(_0x3bcf24);}return util['format'](_0x3ba7ed,_0x3bf0c6[_0xca7e('0xb')],_0x3bf0c6[_0xca7e('0xc')]['x-forwarded-for']?_0x3bf0c6['headers']['x-forwarded-for']:_0x3bf0c6[_0xca7e('0xd')][_0xca7e('0xe')]||_0x3bf0c6['ip'],_0x3bf0c6[_0xca7e('0xf')],_0x406afe[_0xca7e('0x10')],_0x406afe[_0xca7e('0x11')],_0x3bf0c6['user']?_0x3bf0c6[_0xca7e('0x12')]['id']:null,_0x3bf0c6[_0xca7e('0x12')]?_0x3bf0c6['user'][_0xca7e('0x13')]:null,_0x3bf0c6['user']?_0x3bf0c6[_0xca7e('0x12')][_0xca7e('0x14')]:null,_0x3bcf24?util['inspect'](_0x3bcf24,![],null):'');}}));_0x235446[_0xca7e('0x7')](ewinston[_0xca7e('0x15')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x151a6b,_0x4ec5d6){var _0x57c7f9=_0xca7e('0x16');if(_0x151a6b[_0xca7e('0xa')]&&_0x151a6b[_0xca7e('0xa')][_0xca7e('0x17')]&&_0x151a6b[_0xca7e('0xa')][_0xca7e('0x18')]){_0x57c7f9='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xca7e('0x19')](_0x57c7f9,_0x151a6b[_0xca7e('0xb')],_0x151a6b[_0xca7e('0xc')][_0xca7e('0x1a')]?_0x151a6b[_0xca7e('0xc')]['x-forwarded-for']:_0x151a6b['connection'][_0xca7e('0xe')]||_0x151a6b['ip'],_0x151a6b[_0xca7e('0xf')],_0x4ec5d6[_0xca7e('0x10')],_0x4ec5d6[_0xca7e('0x11')],_0x151a6b[_0xca7e('0x12')]?_0x151a6b[_0xca7e('0x12')]['id']:null,_0x151a6b[_0xca7e('0x12')]?_0x151a6b['user'][_0xca7e('0x13')]:null,_0x151a6b[_0xca7e('0x12')]?_0x151a6b[_0xca7e('0x12')][_0xca7e('0x14')]:null,_0x151a6b['body']&&_0x151a6b[_0xca7e('0xa')][_0xca7e('0x17')]?_0x151a6b[_0xca7e('0xa')][_0xca7e('0x17')]:_0xca7e('0x1b'),_0x151a6b['body']&&_0x151a6b[_0xca7e('0xa')][_0xca7e('0x18')]?_0x151a6b['body'][_0xca7e('0x18')]:'',_0x151a6b['body']&&_0x151a6b[_0xca7e('0xa')][_0xca7e('0x1c')]?_0x151a6b[_0xca7e('0xa')][_0xca7e('0x1c')]:'');},'ignoreRoute':function(_0x4838a6){var _0x5d428b=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5d428b[_0xca7e('0x1d')](_0x4838a6[_0xca7e('0xf')]);}}));_0x235446['use'](_0xca7e('0x1e'),require(_0xca7e('0x1f')));_0x235446[_0xca7e('0x7')](_0xca7e('0x20'),require('./api/voiceChanSpy'));_0x235446['use']('/api/voice/contexts',require('./api/voiceContext'));_0x235446['use']('/api/voice/extensions',require(_0xca7e('0x21')));_0x235446[_0xca7e('0x7')](_0xca7e('0x22'),require(_0xca7e('0x23')));_0x235446[_0xca7e('0x7')](_0xca7e('0x24'),require(_0xca7e('0x25')));_0x235446[_0xca7e('0x7')](_0xca7e('0x26'),require('./api/voiceRecording'));_0x235446['use'](_0xca7e('0x27'),require(_0xca7e('0x28')));_0x235446[_0xca7e('0x7')](_0xca7e('0x29'),require(_0xca7e('0x2a')));_0x235446[_0xca7e('0x7')](_0xca7e('0x2b'),require('./api/voiceMailMessage'));_0x235446[_0xca7e('0x7')](_0xca7e('0x2c'),require(_0xca7e('0x2d')));_0x235446[_0xca7e('0x7')](_0xca7e('0x2e'),require(_0xca7e('0x2f')));_0x235446[_0xca7e('0x7')](_0xca7e('0x30'),require('./api/voiceAgentReport'));_0x235446[_0xca7e('0x7')](_0xca7e('0x31'),require(_0xca7e('0x32')));_0x235446[_0xca7e('0x7')](_0xca7e('0x33'),require(_0xca7e('0x34')));_0x235446[_0xca7e('0x7')]('/api/trunks',require(_0xca7e('0x35')));_0x235446['use'](_0xca7e('0x36'),require(_0xca7e('0x37')));_0x235446[_0xca7e('0x7')](_0xca7e('0x38'),require(_0xca7e('0x39')));_0x235446['use']('/api/mail/accounts',require('./api/mailAccount'));_0x235446[_0xca7e('0x7')](_0xca7e('0x3a'),require(_0xca7e('0x3b')));_0x235446['use'](_0xca7e('0x3c'),require(_0xca7e('0x3d')));_0x235446['use'](_0xca7e('0x3e'),require(_0xca7e('0x3f')));_0x235446[_0xca7e('0x7')]('/api/mail/messages',require(_0xca7e('0x40')));_0x235446['use']('/api/mail/applications',require(_0xca7e('0x41')));_0x235446[_0xca7e('0x7')](_0xca7e('0x42'),require(_0xca7e('0x43')));_0x235446['use'](_0xca7e('0x44'),require(_0xca7e('0x45')));_0x235446[_0xca7e('0x7')](_0xca7e('0x46'),require(_0xca7e('0x47')));_0x235446[_0xca7e('0x7')]('/api/fax/accounts',require(_0xca7e('0x48')));_0x235446[_0xca7e('0x7')](_0xca7e('0x49'),require(_0xca7e('0x4a')));_0x235446[_0xca7e('0x7')](_0xca7e('0x4b'),require('./api/faxInteraction'));_0x235446['use'](_0xca7e('0x4c'),require(_0xca7e('0x4d')));_0x235446[_0xca7e('0x7')](_0xca7e('0x4e'),require(_0xca7e('0x4f')));_0x235446[_0xca7e('0x7')](_0xca7e('0x50'),require(_0xca7e('0x51')));_0x235446[_0xca7e('0x7')](_0xca7e('0x52'),require(_0xca7e('0x53')));_0x235446['use'](_0xca7e('0x54'),require('./api/smsApplication'));_0x235446[_0xca7e('0x7')](_0xca7e('0x55'),require(_0xca7e('0x56')));_0x235446[_0xca7e('0x7')](_0xca7e('0x57'),require(_0xca7e('0x58')));_0x235446[_0xca7e('0x7')](_0xca7e('0x59'),require(_0xca7e('0x5a')));_0x235446[_0xca7e('0x7')](_0xca7e('0x5b'),require('./api/openchannelAccount'));_0x235446[_0xca7e('0x7')](_0xca7e('0x5c'),require(_0xca7e('0x5d')));_0x235446[_0xca7e('0x7')](_0xca7e('0x5e'),require(_0xca7e('0x5f')));_0x235446['use'](_0xca7e('0x60'),require(_0xca7e('0x61')));_0x235446[_0xca7e('0x7')](_0xca7e('0x62'),require(_0xca7e('0x63')));_0x235446['use'](_0xca7e('0x64'),require(_0xca7e('0x65')));_0x235446['use'](_0xca7e('0x66'),require(_0xca7e('0x67')));_0x235446['use']('/api/chat/applications',require(_0xca7e('0x68')));_0x235446[_0xca7e('0x7')]('/api/chat/interactions',require(_0xca7e('0x69')));_0x235446[_0xca7e('0x7')](_0xca7e('0x6a'),require(_0xca7e('0x6b')));_0x235446[_0xca7e('0x7')](_0xca7e('0x6c'),require(_0xca7e('0x6d')));_0x235446[_0xca7e('0x7')](_0xca7e('0x6e'),require(_0xca7e('0x6f')));_0x235446['use'](_0xca7e('0x70'),require(_0xca7e('0x71')));_0x235446['use']('/api/chat/proactive_actions',require(_0xca7e('0x72')));_0x235446['use']('/api/cm/companies',require('./api/cmCompany'));_0x235446[_0xca7e('0x7')]('/api/cm/contacts',require(_0xca7e('0x73')));_0x235446['use'](_0xca7e('0x74'),require(_0xca7e('0x75')));_0x235446[_0xca7e('0x7')](_0xca7e('0x76'),require(_0xca7e('0x77')));_0x235446[_0xca7e('0x7')](_0xca7e('0x78'),require('./api/cmHopperFinal'));_0x235446[_0xca7e('0x7')](_0xca7e('0x79'),require(_0xca7e('0x7a')));_0x235446[_0xca7e('0x7')](_0xca7e('0x7b'),require(_0xca7e('0x7c')));_0x235446[_0xca7e('0x7')](_0xca7e('0x7d'),require('./api/action'));_0x235446['use']('/api/automations',require(_0xca7e('0x7e')));_0x235446[_0xca7e('0x7')](_0xca7e('0x7f'),require(_0xca7e('0x80')));_0x235446[_0xca7e('0x7')](_0xca7e('0x81'),require('./api/disposition'));_0x235446[_0xca7e('0x7')](_0xca7e('0x82'),require(_0xca7e('0x83')));_0x235446['use'](_0xca7e('0x84'),require(_0xca7e('0x85')));_0x235446[_0xca7e('0x7')](_0xca7e('0x86'),require(_0xca7e('0x87')));_0x235446[_0xca7e('0x7')](_0xca7e('0x88'),require(_0xca7e('0x89')));_0x235446[_0xca7e('0x7')](_0xca7e('0x8a'),require(_0xca7e('0x8b')));_0x235446['use'](_0xca7e('0x8c'),require(_0xca7e('0x8d')));_0x235446[_0xca7e('0x7')](_0xca7e('0x8e'),require(_0xca7e('0x8f')));_0x235446[_0xca7e('0x7')](_0xca7e('0x90'),require(_0xca7e('0x91')));_0x235446[_0xca7e('0x7')](_0xca7e('0x92'),require(_0xca7e('0x93')));_0x235446[_0xca7e('0x7')](_0xca7e('0x94'),require(_0xca7e('0x95')));_0x235446[_0xca7e('0x7')](_0xca7e('0x96'),require(_0xca7e('0x97')));_0x235446[_0xca7e('0x7')]('/api/integrations',require(_0xca7e('0x98')));_0x235446[_0xca7e('0x7')]('/api/integrations/reports',require(_0xca7e('0x99')));_0x235446['use'](_0xca7e('0x9a'),require(_0xca7e('0x9b')));_0x235446[_0xca7e('0x7')](_0xca7e('0x9c'),require(_0xca7e('0x9d')));_0x235446[_0xca7e('0x7')](_0xca7e('0x9e'),require('./api/analyticExtractedReport'));_0x235446[_0xca7e('0x7')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x235446[_0xca7e('0x7')]('/api/analytics/field_reports',require(_0xca7e('0x9f')));_0x235446[_0xca7e('0x7')](_0xca7e('0xa0'),require(_0xca7e('0xa1')));_0x235446['use']('/api/integrations/salesforce/accounts',require(_0xca7e('0xa2')));_0x235446[_0xca7e('0x7')]('/api/integrations/salesforce/configurations',require(_0xca7e('0xa3')));_0x235446[_0xca7e('0x7')](_0xca7e('0xa4'),require(_0xca7e('0xa5')));_0x235446[_0xca7e('0x7')](_0xca7e('0xa6'),require(_0xca7e('0xa7')));_0x235446['use'](_0xca7e('0xa8'),require('./api/intSugarcrmConfiguration'));_0x235446[_0xca7e('0x7')](_0xca7e('0xa9'),require(_0xca7e('0xaa')));_0x235446['use']('/api/integrations/desk/accounts',require(_0xca7e('0xab')));_0x235446[_0xca7e('0x7')]('/api/integrations/desk/configurations',require(_0xca7e('0xac')));_0x235446[_0xca7e('0x7')]('/api/integrations/desk/fields',require(_0xca7e('0xad')));_0x235446[_0xca7e('0x7')]('/api/integrations/zoho/accounts',require(_0xca7e('0xae')));_0x235446['use'](_0xca7e('0xaf'),require(_0xca7e('0xb0')));_0x235446[_0xca7e('0x7')](_0xca7e('0xb1'),require(_0xca7e('0xb2')));_0x235446['use'](_0xca7e('0xb3'),require('./api/intZendeskAccount'));_0x235446['use'](_0xca7e('0xb4'),require('./api/intZendeskConfiguration'));_0x235446[_0xca7e('0x7')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x235446[_0xca7e('0x7')](_0xca7e('0xb5'),require(_0xca7e('0xb6')));_0x235446[_0xca7e('0x7')]('/api/integrations/freshdesk/configurations',require(_0xca7e('0xb7')));_0x235446['use'](_0xca7e('0xb8'),require('./api/intFreshdeskField'));_0x235446[_0xca7e('0x7')](_0xca7e('0xb9'),require(_0xca7e('0xba')));_0x235446[_0xca7e('0x7')](_0xca7e('0xbb'),require('./api/intVtigerConfiguration'));_0x235446[_0xca7e('0x7')](_0xca7e('0xbc'),require(_0xca7e('0xbd')));_0x235446[_0xca7e('0x7')](_0xca7e('0xbe'),require('./api/intServicenowAccount'));_0x235446[_0xca7e('0x7')](_0xca7e('0xbf'),require('./api/intServicenowConfiguration'));_0x235446[_0xca7e('0x7')]('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0x235446[_0xca7e('0x7')]('/api/integrations/dynamics365/accounts',require('./api/intDynamics365Account'));_0x235446[_0xca7e('0x7')]('/api/integrations/dynamics365/configurations',require(_0xca7e('0xc0')));_0x235446[_0xca7e('0x7')](_0xca7e('0xc1'),require(_0xca7e('0xc2')));_0x235446[_0xca7e('0x7')](_0xca7e('0xc3'),require(_0xca7e('0xc4')));_0x235446[_0xca7e('0x7')](_0xca7e('0xc5'),require(_0xca7e('0xc6')));_0x235446[_0xca7e('0x7')](_0xca7e('0xc7'),require(_0xca7e('0xc8')));_0x235446['use'](_0xca7e('0xc9'),require('./api/network'));_0x235446[_0xca7e('0x7')]('/api/chat/reports/queue',require(_0xca7e('0xca')));_0x235446[_0xca7e('0x7')]('/api/chat/internal/messages',require(_0xca7e('0xcb')));_0x235446['use']('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x235446[_0xca7e('0x7')](_0xca7e('0xcc'),require(_0xca7e('0xcd')));_0x235446[_0xca7e('0x7')]('/api/jscripty/sessions/reports',require(_0xca7e('0xce')));_0x235446[_0xca7e('0x7')](_0xca7e('0xcf'),require(_0xca7e('0xd0')));_0x235446[_0xca7e('0x7')](_0xca7e('0xd1'),require('./api/squareReport'));_0x235446[_0xca7e('0x7')](_0xca7e('0xd2'),require(_0xca7e('0xd3')));_0x235446[_0xca7e('0x7')]('/api/jscripty/projects',require(_0xca7e('0xd4')));_0x235446[_0xca7e('0x7')](_0xca7e('0xd5'),require(_0xca7e('0xd6')));_0x235446[_0xca7e('0x7')]('/api/square/odbc',require(_0xca7e('0xd7')));_0x235446[_0xca7e('0x7')](_0xca7e('0xd8'),require(_0xca7e('0xd9')));_0x235446[_0xca7e('0x7')](_0xca7e('0xda'),require(_0xca7e('0xdb')));_0x235446[_0xca7e('0x7')](_0xca7e('0xdc'),require('./api/squareMessage'));_0x235446[_0xca7e('0x7')](_0xca7e('0xdd'),require(_0xca7e('0xde')));_0x235446['use']('/api/license',require(_0xca7e('0xdf')));_0x235446[_0xca7e('0x7')](_0xca7e('0xe0'),require(_0xca7e('0xe1')));_0x235446[_0xca7e('0x7')](_0xca7e('0xe2'),require(_0xca7e('0xe3')));_0x235446[_0xca7e('0x7')]('/api/attachments',require('./api/attachment'));_0x235446['use'](_0xca7e('0xe4'),require(_0xca7e('0xe5')));_0x235446[_0xca7e('0x7')](_0xca7e('0xe6'),require('./api/mailTransferReport'));_0x235446[_0xca7e('0x7')](_0xca7e('0xe7'),require(_0xca7e('0xe8')));_0x235446[_0xca7e('0x7')](_0xca7e('0xe9'),require(_0xca7e('0xea')));_0x235446['use']('/api/openchannel/reports/transfer',require(_0xca7e('0xeb')));_0x235446[_0xca7e('0x7')](_0xca7e('0xec'),require(_0xca7e('0xed')));_0x235446[_0xca7e('0x7')](_0xca7e('0xee'),require(_0xca7e('0xef')));_0x235446[_0xca7e('0x7')](_0xca7e('0xf0'),require(_0xca7e('0xf1')));_0x235446[_0xca7e('0x7')](_0xca7e('0xf2'),require('./api/userProfile'));_0x235446[_0xca7e('0x7')]('/api/userProfile/sections',require(_0xca7e('0xf3')));_0x235446[_0xca7e('0x7')](_0xca7e('0xf4'),require(_0xca7e('0xf5')));_0x235446[_0xca7e('0x7')](_0xca7e('0xf6'),require(_0xca7e('0xf7')));_0x235446[_0xca7e('0x7')]('/api/whatsapp/accounts',require(_0xca7e('0xf8')));_0x235446[_0xca7e('0x7')](_0xca7e('0xf9'),require(_0xca7e('0xfa')));_0x235446[_0xca7e('0x7')]('/api/whatsapp/interactions',require(_0xca7e('0xfb')));_0x235446[_0xca7e('0x7')](_0xca7e('0xfc'),require(_0xca7e('0xfd')));_0x235446['use']('/api/whatsapp/reports/queue',require(_0xca7e('0xfe')));_0x235446[_0xca7e('0x7')](_0xca7e('0xff'),require(_0xca7e('0x100')));_0x235446['use'](_0xca7e('0x101'),require(_0xca7e('0x102')));_0x235446['use']('/api/cloudProviders',require(_0xca7e('0x103')));_0x235446[_0xca7e('0x7')]('/api/realtime',require('./api/realtime'));_0x235446['use'](_0xca7e('0x104'),require(_0xca7e('0x105')));_0x235446[_0xca7e('0x7')]('/api/auth/google',require('./api/authGoogle'));_0x235446[_0xca7e('0x7')](_0xca7e('0x106'),require(_0xca7e('0x107')));_0x235446[_0xca7e('0x7')](_0xca7e('0x108'),require(_0xca7e('0x109')));_0x235446[_0xca7e('0x7')]('/api/version',require(_0xca7e('0x10a')));_0x235446[_0xca7e('0x7')](_0xca7e('0x10b'),require(_0xca7e('0x10c')));_0x235446[_0xca7e('0x7')](_0xca7e('0x10d'),require(_0xca7e('0x10e')));_0x235446['use'](_0xca7e('0x10f'),require('./api/webbar'));_0x235446[_0xca7e('0x7')](_0xca7e('0x110'),express[_0xca7e('0x111')](path[_0xca7e('0x112')](config['root'],'/apidoc')));_0x235446[_0xca7e('0x7')](_0xca7e('0x113'),express[_0xca7e('0x111')](path[_0xca7e('0x112')](config['root'],_0xca7e('0x113'))));_0x235446[_0xca7e('0x7')](_0xca7e('0x114'),express['static'](path[_0xca7e('0x112')](config[_0xca7e('0x115')],_0xca7e('0x114'))));_0x235446[_0xca7e('0x7')](_0xca7e('0x116'),express['static'](path[_0xca7e('0x112')](config['root'],_0xca7e('0x117'),'3.0.0')));_0x235446[_0xca7e('0x7')]('/plugins',express[_0xca7e('0x111')](path['join'](config[_0xca7e('0x115')],_0xca7e('0x118'))));_0x235446[_0xca7e('0x119')](_0xca7e('0x11a'))[_0xca7e('0x11b')](errors[0x194]);_0x235446[_0xca7e('0x119')]('/*')[_0xca7e('0x11b')](function(_0x3d0946,_0x5d183b){_0x5d183b['sendFile'](path[_0xca7e('0x11c')](_0x235446[_0xca7e('0x11b')](_0xca7e('0x11d'))+_0xca7e('0x11e')));});};var sensitiveFields=['username',_0xca7e('0x11f'),_0xca7e('0x120'),_0xca7e('0x121'),'firstName',_0xca7e('0x122'),_0xca7e('0x123'),_0xca7e('0x124'),_0xca7e('0x125'),_0xca7e('0x126'),_0xca7e('0x127'),_0xca7e('0x128'),'clientSecret',_0xca7e('0x129'),_0xca7e('0x12a'),_0xca7e('0x12b'),_0xca7e('0x12c'),_0xca7e('0x12d'),_0xca7e('0x12e'),'accessToken',_0xca7e('0x12f'),_0xca7e('0x130'),_0xca7e('0x131'),_0xca7e('0x132'),_0xca7e('0x133'),'calleridname',_0xca7e('0x134'),_0xca7e('0x135'),_0xca7e('0x136'),'clientEmail','privateKey','accesskeyid',_0xca7e('0x137'),_0xca7e('0x138'),_0xca7e('0x12'),'pass',_0xca7e('0x139'),_0xca7e('0x13a'),_0xca7e('0x13b'),_0xca7e('0x13c'),'registry','oldPassword'];function maskSensitiveData(_0x28116e){var _0x301a35=/(?!^)[\s\S](?!$)/g;if(!_[_0xca7e('0x13d')](_0x28116e))return;for(var _0x30297d in _0x28116e){if(_['isArray'](_0x28116e[_0x30297d])){for(var _0x43d3bc=0x0;_0x43d3bc<_0x28116e[_0x30297d][_0xca7e('0x13e')];_0x43d3bc++){maskSensitiveData(_0x28116e[_0x30297d][_0x43d3bc]);}}else if(_['isPlainObject'](_0x28116e[_0x30297d])){maskSensitiveData(_0x28116e[_0x30297d]);}else if(_[_0xca7e('0x13f')](_0x28116e[_0x30297d])){_0x28116e[_0x30297d]=_0x28116e[_0x30297d][_0xca7e('0x140')](/{{{/g,'@@{')[_0xca7e('0x140')](/}}}/g,'}@@')[_0xca7e('0x140')](/{{/g,'@{')[_0xca7e('0x140')](/}}/g,'}@');if(_[_0xca7e('0x141')](sensitiveFields,_0x30297d)){_0x28116e[_0x30297d]=_0x28116e[_0x30297d][_0xca7e('0x140')](_0x301a35,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index a478559..955936f 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8ff8=['../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','error','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc'];(function(_0x3c01d1,_0x3ab46b){var _0x52822e=function(_0x1e013f){while(--_0x1e013f){_0x3c01d1['push'](_0x3c01d1['shift']());}};_0x52822e(++_0x3ab46b);}(_0x8ff8,0x113));var _0x88ff=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8ff8[_0x321bb2];return _0x9c12ed;};'use strict';var jayson=require(_0x88ff('0x0'));var BPromise=require('bluebird');var _=require(_0x88ff('0x1'));var config=require(_0x88ff('0x2'));exports[_0x88ff('0x3')]=function(){return new BPromise(function(_0x37b88d,_0x18bc3f){var _0x3e6b3d={};_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x5')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x6')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x7')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x8')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x9')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0xa')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0xb')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0xc')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0xd')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0xe')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0xf')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x10')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x11')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/mailAccount/mailAccount.rpc'));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x12')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x13')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x14')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x15')));_0x3e6b3d=_['merge'](_0x3e6b3d,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x16')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/faxApplication/faxApplication.rpc'));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x17')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x18')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x19')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x1a')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x1b')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x1c')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x1d')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x1e')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x1f')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x20')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x21')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x22')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x23')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x24')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x25')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/cmHopper/cmHopper.rpc'));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x26')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x27')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x28')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x29')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x2a')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x2b')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x2c')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/template/template.rpc'));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x2d')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/variable/variable.rpc'));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x2e')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x2f')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x30')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x31')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x32')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x33')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x34')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x35')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x36')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x37')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/squareReport/squareReport.rpc'));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x38')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x39')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x3a')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/squareProject/squareProject.rpc'));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x3b')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x3c')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x3d')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x3e')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require('../api/plugin/plugin.rpc'));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x3f')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x40')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x41')));_0x3e6b3d=_['merge'](_0x3e6b3d,require(_0x88ff('0x42')));_0x3e6b3d=_[_0x88ff('0x4')](_0x3e6b3d,require(_0x88ff('0x43')));var _0x592b58=jayson[_0x88ff('0x44')](_0x3e6b3d)['http']();var _0xa97411=config[_0x88ff('0x45')][_0x88ff('0x46')]||config[_0x88ff('0x46')]+0x1;var _0x3a4a46=config[_0x88ff('0x45')]['ip']||'localhost';_0x592b58['on'](_0x88ff('0x47'),function(_0x1fc2dd){return _0x18bc3f(_0x1fc2dd);});_0x592b58['listen'](_0xa97411,_0x3a4a46,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x3a4a46,_0xa97411);require('../config/triggers')['default']();return _0x37b88d(_0x88ff('0x48')+_0x3a4a46+':'+_0xa97411);});});}; \ No newline at end of file +var _0xa673=['../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','listen','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/template/template.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc'];(function(_0x2eb280,_0x72b2d){var _0x396b70=function(_0x269575){while(--_0x269575){_0x2eb280['push'](_0x2eb280['shift']());}};_0x396b70(++_0x72b2d);}(_0xa673,0x16c));var _0x3a67=function(_0x271984,_0x4fb647){_0x271984=_0x271984-0x0;var _0x49feed=_0xa673[_0x271984];return _0x49feed;};'use strict';var jayson=require(_0x3a67('0x0'));var BPromise=require(_0x3a67('0x1'));var _=require('lodash');var config=require(_0x3a67('0x2'));exports['listen']=function(){return new BPromise(function(_0x55eff8,_0x46e927){var _0x5a73bb={};_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require('../api/user/user.rpc'));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x4')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x5')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x6')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x7')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x8')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x9')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0xa')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0xb')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0xc')));_0x5a73bb=_['merge'](_0x5a73bb,require(_0x3a67('0xd')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0xe')));_0x5a73bb=_['merge'](_0x5a73bb,require(_0x3a67('0xf')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x10')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x11')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require('../api/mailInteraction/mailInteraction.rpc'));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x12')));_0x5a73bb=_['merge'](_0x5a73bb,require('../api/mailApplication/mailApplication.rpc'));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x13')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x14')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x15')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x16')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x17')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x18')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x19')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x1a')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x1b')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require('../api/smsMessage/smsMessage.rpc'));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x1c')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x1d')));_0x5a73bb=_['merge'](_0x5a73bb,require(_0x3a67('0x1e')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x1f')));_0x5a73bb=_['merge'](_0x5a73bb,require(_0x3a67('0x20')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x21')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x22')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x23')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require('../api/cmHopper/cmHopper.rpc'));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x24')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x5a73bb=_['merge'](_0x5a73bb,require(_0x3a67('0x25')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x26')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require('../api/sound/sound.rpc'));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x27')));_0x5a73bb=_['merge'](_0x5a73bb,require('../api/trigger/trigger.rpc'));_0x5a73bb=_['merge'](_0x5a73bb,require('../api/variable/variable.rpc'));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x28')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x29')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x5a73bb=_['merge'](_0x5a73bb,require(_0x3a67('0x2a')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x2b')));_0x5a73bb=_['merge'](_0x5a73bb,require(_0x3a67('0x2c')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x2d')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x2e')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x2f')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x30')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x31')));_0x5a73bb=_['merge'](_0x5a73bb,require(_0x3a67('0x32')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x33')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x34')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x35')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x36')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x37')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x38')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x39')));_0x5a73bb=_[_0x3a67('0x3')](_0x5a73bb,require(_0x3a67('0x3a')));var _0x1cbae5=jayson[_0x3a67('0x3b')](_0x5a73bb)[_0x3a67('0x3c')]();var _0x4ee2de=config[_0x3a67('0x3d')]['port']||config[_0x3a67('0x3e')]+0x1;var _0x3e668c=config['rpc']['ip']||_0x3a67('0x3f');_0x1cbae5['on'](_0x3a67('0x40'),function(_0x1b8e12){return _0x46e927(_0x1b8e12);});_0x1cbae5[_0x3a67('0x41')](_0x4ee2de,_0x3e668c,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x3e668c,_0x4ee2de);require(_0x3a67('0x42'))['default']();return _0x55eff8(_0x3a67('0x43')+_0x3e668c+':'+_0x4ee2de);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index e0983c2..2b9f080 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 _0xd101=['GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','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','continueAt','extension','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','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','result=','substr','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','ANSWER','getData','beep','format'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xd101,0xc1));var _0x1d10=function(_0xb4002c,_0x210353){_0xb4002c=_0xb4002c-0x0;var _0x4395d3=_0xd101[_0xb4002c];return _0x4395d3;};'use strict';var util=require(_0x1d10('0x0'));var _=require('lodash');var EventEmitter=require(_0x1d10('0x1'))[_0x1d10('0x2')];var AGIReply=require(_0x1d10('0x3'));var AGIError=require(_0x1d10('0x4'));function AGIChannel(_0xaa1d24){var _0x25b425=this,_0x12c320=new AGIReply(),_0x1e83e0=![],_0x5c5c42={};EventEmitter[_0x1d10('0x5')](_0x25b425);_0xaa1d24[_0x1d10('0x6')](_0x1d10('0x7'));_0xaa1d24[_0x1d10('0x8')](0x8*0x3c*0x3c*0x3e8);_0x12c320[_0x1d10('0x6')](_0x1d10('0x7'));_0x12c320['on'](_0x1d10('0x9'),function(_0x43df2c){for(var _0x3a15c8 in _0x43df2c){_0x25b425[_0x3a15c8]=_0x43df2c[_0x3a15c8];}_0x25b425[_0x1d10('0xa')](_0x1d10('0xb'));});_0x12c320['on'](_0x1d10('0xc'),function(_0x1610b4){if(_0x1610b4[_0x1d10('0xd')]()==_0x1d10('0xe')){_0x25b425[_0x1d10('0xa')](_0x1d10('0xe'));return;}if(_0x1610b4['substring'](0x0,0xb)==_0x1d10('0xf')){_0x1e83e0=!![];}if(_0x1e83e0){_0x5c5c42['rx']+=_0x1610b4+'\x0a';if(_0x1610b4[_0x1d10('0x10')](_0x1d10('0x11'))!=-0x1){_0x1e83e0=![];}}else{_0x5c5c42['rx']=_0x1610b4;}if(_0x1e83e0){return;}if(typeof _0x5c5c42['cb']==_0x1d10('0x12')){var _0x268506=_0x5c5c42['rx'][_0x1d10('0x13')](0x0,0x3),_0x5b71d8=null,_0x3f6bd8=null;_0x268506=parseInt(_0x268506);if(isNaN(_0x268506)){_0x5c5c42['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x1d10('0x14')});return;}if(_0x268506!=0xc8){_0x5c5c42['cb'](null,{'code':_0x268506,'result':-0x1,'extra':'KO'});return;}_0x5b71d8=_0x5c5c42['rx'][_0x1d10('0x13')](0x4)[_0x1d10('0x15')](_0x1d10('0x16'),'');if(_0x5b71d8['indexOf']('\x20')!=-0x1){_0x5b71d8=_0x5b71d8[_0x1d10('0x17')](0x0,_0x5b71d8[_0x1d10('0x18')]('\x20'));}if(_[_0x1d10('0x19')](_0x5b71d8,'-1')){_0x5b71d8=parseInt(_0x5b71d8);}_0x3f6bd8=_0x5c5c42['rx'][_0x1d10('0x1a')]('\x20');if(_0x3f6bd8['length']==0x3){_0x3f6bd8=_0x3f6bd8[0x2][_0x1d10('0x13')](0x1,_0x3f6bd8[0x2][_0x1d10('0x1b')]-0x1);}else if(_0x3f6bd8[_0x1d10('0x1b')]>0x3){var _0x3f2f2b=/\((.+)\)/;var _0x1b2051=_0x5c5c42['rx'][_0x1d10('0x1c')](_0x3f2f2b);if(_0x1b2051){_0x3f6bd8=_0x1b2051[0x1];}else{_0x3f6bd8=null;}}else{_0x3f6bd8=null;}_0x5c5c42['cb'](null,{'code':_0x268506,'result':_0x5b71d8,'extra':_0x3f6bd8});}});_0xaa1d24['on'](_0x1d10('0x1d'),function(_0x4f3e2a){_0x25b425[_0x1d10('0xa')](_0x1d10('0x1d'),new AGIError(_0x1d10('0x1e'),_0x4f3e2a[_0x1d10('0x1f')]));});_0xaa1d24['on'](_0x1d10('0x20'),function(){_0x25b425['emit']('close',new AGIError(_0x1d10('0x21')));});_0xaa1d24['on']('timeout',function(){_0x25b425['emit']('timeout',new AGIError(_0x1d10('0x22')));_0xaa1d24[_0x1d10('0x23')]();});_0xaa1d24[_0x1d10('0x24')](_0x12c320);this[_0x1d10('0x25')]=function(_0x4ce84a,_0x5e5315){var _0x4ce84a=_0x4ce84a||'',_0x5e5315=typeof _0x5e5315==_0x1d10('0x12')?_0x5e5315:new Function();_0x5c5c42={'tx':_0x4ce84a,'rx':'','cb':_0x5e5315};_0xaa1d24[_0x1d10('0x26')](_0x4ce84a+'\x0a');},this[_0x1d10('0x20')]=function(){_0xaa1d24[_0x1d10('0x23')]();};}util[_0x1d10('0x27')](AGIChannel,EventEmitter);AGIChannel[_0x1d10('0x28')][_0x1d10('0x29')]=function(_0x3af06d){return this[_0x1d10('0x25')][_0x1d10('0x2a')](this,_0x3af06d);};AGIChannel[_0x1d10('0x28')]['answer']=function(){return this[_0x1d10('0x29')](_0x1d10('0x2b'));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x2c')]=function(_0x18e7d9,_0x3bffbe,_0x38f583){_0x18e7d9=_0x18e7d9===undefined?_0x1d10('0x2d'):_0x18e7d9;_0x3bffbe=_0x3bffbe===undefined?'5':_0x3bffbe;_0x38f583=_0x38f583===undefined?'1':_0x38f583;return this['sendRequest'](util[_0x1d10('0x2e')](_0x1d10('0x2f'),_0x18e7d9,_0x3bffbe*0x3e8,_0x38f583));};AGIChannel['prototype'][_0x1d10('0x30')]=function(_0x52d514){_0x52d514=_0x52d514||'NO\x20MESSAGE';return this[_0x1d10('0x29')](util['format'](_0x1d10('0x31'),_0x52d514));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x32')]=function(_0x15fdac,_0x1a43fd){if(_[_0x1d10('0x33')](_0x1a43fd)){return this['sendRequest'](util['format'](_0x1d10('0x34'),_0x15fdac,_0x1a43fd[_0x1d10('0x35')](',')));}return this[_0x1d10('0x29')](util[_0x1d10('0x2e')](_0x1d10('0x34'),_0x15fdac,_0x1a43fd));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x36')]=function(_0x1c6cad){return this[_0x1d10('0x29')](util[_0x1d10('0x2e')]('SET\x20CONTEXT\x20%s',_0x1c6cad));};AGIChannel[_0x1d10('0x28')]['setExtension']=function(_0x1b0f8f){return this[_0x1d10('0x29')](util['format'](_0x1d10('0x37'),_0x1b0f8f));};AGIChannel['prototype'][_0x1d10('0x38')]=function(_0x2d4121){return this[_0x1d10('0x29')](util[_0x1d10('0x2e')](_0x1d10('0x39'),_0x2d4121));};AGIChannel['prototype']['hangup']=function(){return this[_0x1d10('0x29')](_0x1d10('0x3a'));};AGIChannel[_0x1d10('0x28')]['setVariable']=function(_0x4a9cde,_0x5e0423){var _0x135d14=_['isBoolean'](_0x5e0423)||_[_0x1d10('0x3b')](_0x5e0423)?_0x5e0423[_0x1d10('0x3c')]():_0x5e0423;return this[_0x1d10('0x29')](util[_0x1d10('0x2e')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x4a9cde,_0x135d14?_0x135d14['toString']()[_0x1d10('0x15')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x3d')]=function(_0x230c19,_0x549e83){return this[_0x1d10('0x29')](util['format'](_0x1d10('0x3e'),_0x230c19,_0x549e83));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x3f')]=function(_0x8d8405,_0x38addd){return this[_0x1d10('0x29')](util[_0x1d10('0x2e')](_0x1d10('0x40'),_0x8d8405,_0x38addd));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x41')]=function(_0x1cae38,_0x347f9d){return this[_0x1d10('0x29')](util['format']('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x1cae38,_0x347f9d));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x42')]=function(_0x3be3b0,_0xb15892,_0x1368ef){_0xb15892=_0xb15892||this[_0x1d10('0x43')];_0x1368ef=_0x1368ef||0x1;this[_0x1d10('0x36')](_0x3be3b0);this['setExtension'](_0xb15892);this[_0x1d10('0x38')](_0x1368ef);return this[_0x1d10('0x30')](util[_0x1d10('0x2e')]('GOTO\x20%s\x20%s\x20%s',_0x3be3b0,_0xb15892,_0x1368ef));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x44')]=function(_0x2ee987){return this['sendRequest'](util['format'](_0x1d10('0x45'),_0x2ee987));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x46')]=function(_0x2db4f7,_0x23fde4,_0x2c4933,_0xd34935,_0x50f8e7,_0xf71ad5){_0x23fde4=_0x23fde4||_0x1d10('0x47');_0x2c4933=_0x2c4933||'';_0xd34935=_0xd34935===undefined?-0x1:_0xd34935==='-1'?-0x1:_0xd34935*0x3e8;_0x50f8e7=_0x50f8e7===undefined?'':'s='+_0x50f8e7;_0xf71ad5=_0xf71ad5?'BEEP':'';return this[_0x1d10('0x29')](util['format'](_0x1d10('0x48'),_0x2db4f7,_0x23fde4,_0x2c4933,_0xd34935,_0xf71ad5,_0x50f8e7));};AGIChannel['prototype']['streamFile']=function(_0x11f446,_0x3183b4){_0x3183b4=_0x3183b4||'';return this[_0x1d10('0x29')](util[_0x1d10('0x2e')](_0x1d10('0x49'),_0x11f446,_0x3183b4));};AGIChannel[_0x1d10('0x28')][_0x1d10('0x4a')]=function(_0x198930){return this[_0x1d10('0x32')]('AGI',_0x198930);};AGIChannel['prototype'][_0x1d10('0x4b')]=function(_0x38bcba){return this[_0x1d10('0x32')](_0x1d10('0x4c'),_0x38bcba);};AGIChannel[_0x1d10('0x28')][_0x1d10('0x1d')]=function(_0x5c3572,_0x2db27f){this[_0x1d10('0x30')](util[_0x1d10('0x2e')](_0x1d10('0x4d'),_0x5c3572['id'],_0x5c3572[_0x1d10('0x4e')],_0x2db27f));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x1d10('0x4f')]=AGIChannel; \ No newline at end of file +var _0x4c50=['SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','./reply','./error','call','setEncoding','setTimeout','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','inherits','sendRequest','command','sync','prototype','answer','ANSWER','getData','beep','format','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority'];(function(_0x5ec8db,_0x11396b){var _0x41e7e0=function(_0x517012){while(--_0x517012){_0x5ec8db['push'](_0x5ec8db['shift']());}};_0x41e7e0(++_0x11396b);}(_0x4c50,0x1f2));var _0x04c5=function(_0x29dcf8,_0x146951){_0x29dcf8=_0x29dcf8-0x0;var _0x5ab61c=_0x4c50[_0x29dcf8];return _0x5ab61c;};'use strict';var util=require(_0x04c5('0x0'));var _=require('lodash');var EventEmitter=require(_0x04c5('0x1'))['EventEmitter'];var AGIReply=require(_0x04c5('0x2'));var AGIError=require(_0x04c5('0x3'));function AGIChannel(_0x2a99ac){var _0x38453a=this,_0x42b75b=new AGIReply(),_0x1d2a1d=![],_0x8df41a={};EventEmitter[_0x04c5('0x4')](_0x38453a);_0x2a99ac[_0x04c5('0x5')]('utf8');_0x2a99ac[_0x04c5('0x6')](0x8*0x3c*0x3c*0x3e8);_0x42b75b[_0x04c5('0x5')](_0x04c5('0x7'));_0x42b75b['on'](_0x04c5('0x8'),function(_0xed1e5b){for(var _0x5871ea in _0xed1e5b){_0x38453a[_0x5871ea]=_0xed1e5b[_0x5871ea];}_0x38453a[_0x04c5('0x9')](_0x04c5('0xa'));});_0x42b75b['on'](_0x04c5('0xb'),function(_0x20ffe3){if(_0x20ffe3[_0x04c5('0xc')]()=='hangup'){_0x38453a[_0x04c5('0x9')](_0x04c5('0xd'));return;}if(_0x20ffe3[_0x04c5('0xe')](0x0,0xb)==_0x04c5('0xf')){_0x1d2a1d=!![];}if(_0x1d2a1d){_0x8df41a['rx']+=_0x20ffe3+'\x0a';if(_0x20ffe3[_0x04c5('0x10')]('520\x20End\x20of\x20proper')!=-0x1){_0x1d2a1d=![];}}else{_0x8df41a['rx']=_0x20ffe3;}if(_0x1d2a1d){return;}if(typeof _0x8df41a['cb']==_0x04c5('0x11')){var _0x498e0a=_0x8df41a['rx'][_0x04c5('0xe')](0x0,0x3),_0xa89389=null,_0x5bc321=null;_0x498e0a=parseInt(_0x498e0a);if(isNaN(_0x498e0a)){_0x8df41a['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x04c5('0x12')});return;}if(_0x498e0a!=0xc8){_0x8df41a['cb'](null,{'code':_0x498e0a,'result':-0x1,'extra':'KO'});return;}_0xa89389=_0x8df41a['rx']['substring'](0x4)[_0x04c5('0x13')](_0x04c5('0x14'),'');if(_0xa89389[_0x04c5('0x15')]('\x20')!=-0x1){_0xa89389=_0xa89389[_0x04c5('0x16')](0x0,_0xa89389[_0x04c5('0x15')]('\x20'));}if(_[_0x04c5('0x17')](_0xa89389,'-1')){_0xa89389=parseInt(_0xa89389);}_0x5bc321=_0x8df41a['rx'][_0x04c5('0x18')]('\x20');if(_0x5bc321[_0x04c5('0x19')]==0x3){_0x5bc321=_0x5bc321[0x2][_0x04c5('0xe')](0x1,_0x5bc321[0x2][_0x04c5('0x19')]-0x1);}else if(_0x5bc321[_0x04c5('0x19')]>0x3){var _0x2dfeaa=/\((.+)\)/;var _0x3bb59c=_0x8df41a['rx'][_0x04c5('0x1a')](_0x2dfeaa);if(_0x3bb59c){_0x5bc321=_0x3bb59c[0x1];}else{_0x5bc321=null;}}else{_0x5bc321=null;}_0x8df41a['cb'](null,{'code':_0x498e0a,'result':_0xa89389,'extra':_0x5bc321});}});_0x2a99ac['on'](_0x04c5('0x1b'),function(_0x4d8ae6){_0x38453a[_0x04c5('0x9')](_0x04c5('0x1b'),new AGIError(_0x04c5('0x1c'),_0x4d8ae6[_0x04c5('0x1d')]));});_0x2a99ac['on'](_0x04c5('0x1e'),function(){_0x38453a[_0x04c5('0x9')](_0x04c5('0x1e'),new AGIError(_0x04c5('0x1f')));});_0x2a99ac['on']('timeout',function(){_0x38453a[_0x04c5('0x9')]('timeout',new AGIError(_0x04c5('0x20')));_0x2a99ac[_0x04c5('0x21')]();});_0x2a99ac[_0x04c5('0x22')](_0x42b75b);this['command']=function(_0x383d7e,_0x6b0273){var _0x383d7e=_0x383d7e||'',_0x6b0273=typeof _0x6b0273==_0x04c5('0x11')?_0x6b0273:new Function();_0x8df41a={'tx':_0x383d7e,'rx':'','cb':_0x6b0273};_0x2a99ac['write'](_0x383d7e+'\x0a');},this[_0x04c5('0x1e')]=function(){_0x2a99ac['destroy']();};}util[_0x04c5('0x23')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0x04c5('0x24')]=function(_0x2e08e5){return this[_0x04c5('0x25')][_0x04c5('0x26')](this,_0x2e08e5);};AGIChannel[_0x04c5('0x27')][_0x04c5('0x28')]=function(){return this[_0x04c5('0x24')](_0x04c5('0x29'));};AGIChannel['prototype'][_0x04c5('0x2a')]=function(_0x275aa5,_0x3449cc,_0x2185f2){_0x275aa5=_0x275aa5===undefined?_0x04c5('0x2b'):_0x275aa5;_0x3449cc=_0x3449cc===undefined?'5':_0x3449cc;_0x2185f2=_0x2185f2===undefined?'1':_0x2185f2;return this[_0x04c5('0x24')](util[_0x04c5('0x2c')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x275aa5,_0x3449cc*0x3e8,_0x2185f2));};AGIChannel[_0x04c5('0x27')]['noop']=function(_0x4536c1){_0x4536c1=_0x4536c1||_0x04c5('0x2d');return this[_0x04c5('0x24')](util[_0x04c5('0x2c')](_0x04c5('0x2e'),_0x4536c1));};AGIChannel[_0x04c5('0x27')][_0x04c5('0x2f')]=function(_0xbcacd6,_0x122d0c){if(_['isArray'](_0x122d0c)){return this[_0x04c5('0x24')](util[_0x04c5('0x2c')](_0x04c5('0x30'),_0xbcacd6,_0x122d0c[_0x04c5('0x31')](',')));}return this[_0x04c5('0x24')](util[_0x04c5('0x2c')]('EXEC\x20%s\x20%s',_0xbcacd6,_0x122d0c));};AGIChannel['prototype'][_0x04c5('0x32')]=function(_0x5c1e39){return this[_0x04c5('0x24')](util['format'](_0x04c5('0x33'),_0x5c1e39));};AGIChannel[_0x04c5('0x27')][_0x04c5('0x34')]=function(_0x12eb29){return this[_0x04c5('0x24')](util['format'](_0x04c5('0x35'),_0x12eb29));};AGIChannel['prototype'][_0x04c5('0x36')]=function(_0x492867){return this[_0x04c5('0x24')](util['format'](_0x04c5('0x37'),_0x492867));};AGIChannel[_0x04c5('0x27')]['hangup']=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0x04c5('0x27')][_0x04c5('0x38')]=function(_0x21fd4b,_0x3b5d29){var _0x252bff=_[_0x04c5('0x39')](_0x3b5d29)||_[_0x04c5('0x3a')](_0x3b5d29)?_0x3b5d29[_0x04c5('0x3b')]():_0x3b5d29;return this['sendRequest'](util['format'](_0x04c5('0x3c'),_0x21fd4b,_0x252bff?_0x252bff[_0x04c5('0x3b')]()[_0x04c5('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x04c5('0x3d')]=function(_0x34aaec,_0x4cc0b4){return this[_0x04c5('0x24')](util['format'](_0x04c5('0x3e'),_0x34aaec,_0x4cc0b4));};AGIChannel[_0x04c5('0x27')][_0x04c5('0x3f')]=function(_0x1c6ef6,_0x5c8236){return this[_0x04c5('0x24')](util[_0x04c5('0x2c')](_0x04c5('0x40'),_0x1c6ef6,_0x5c8236));};AGIChannel['prototype']['sayPhonetic']=function(_0x51ef0b,_0xdaa824){return this[_0x04c5('0x24')](util[_0x04c5('0x2c')](_0x04c5('0x41'),_0x51ef0b,_0xdaa824));};AGIChannel['prototype']['continueAt']=function(_0x5a6603,_0x1a8951,_0xb44a09){_0x1a8951=_0x1a8951||this['extension'];_0xb44a09=_0xb44a09||0x1;this[_0x04c5('0x32')](_0x5a6603);this[_0x04c5('0x34')](_0x1a8951);this[_0x04c5('0x36')](_0xb44a09);return this[_0x04c5('0x42')](util[_0x04c5('0x2c')](_0x04c5('0x43'),_0x5a6603,_0x1a8951,_0xb44a09));};AGIChannel['prototype'][_0x04c5('0x44')]=function(_0x3140e4){return this[_0x04c5('0x24')](util[_0x04c5('0x2c')](_0x04c5('0x45'),_0x3140e4));};AGIChannel['prototype']['recordFile']=function(_0x5873c5,_0x2795f2,_0x5aabc0,_0xa8c791,_0x387fc6,_0x86b9b4){_0x2795f2=_0x2795f2||_0x04c5('0x46');_0x5aabc0=_0x5aabc0||'';_0xa8c791=_0xa8c791===undefined?-0x1:_0xa8c791==='-1'?-0x1:_0xa8c791*0x3e8;_0x387fc6=_0x387fc6===undefined?'':'s='+_0x387fc6;_0x86b9b4=_0x86b9b4?'BEEP':'';return this[_0x04c5('0x24')](util['format'](_0x04c5('0x47'),_0x5873c5,_0x2795f2,_0x5aabc0,_0xa8c791,_0x86b9b4,_0x387fc6));};AGIChannel[_0x04c5('0x27')][_0x04c5('0x48')]=function(_0x5ba17c,_0x940325){_0x940325=_0x940325||'';return this['sendRequest'](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x5ba17c,_0x940325));};AGIChannel[_0x04c5('0x27')][_0x04c5('0x49')]=function(_0x511c75){return this[_0x04c5('0x2f')]('AGI',_0x511c75);};AGIChannel[_0x04c5('0x27')][_0x04c5('0x4a')]=function(_0x4e54e6){return this[_0x04c5('0x2f')](_0x04c5('0x4b'),_0x4e54e6);};AGIChannel['prototype'][_0x04c5('0x1b')]=function(_0x2f44eb,_0x2e93d2){this['noop'](util['format'](_0x04c5('0x4c'),_0x2f44eb['id'],_0x2f44eb[_0x04c5('0x4d')],_0x2e93d2));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x04c5('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index fb96792..c53b926 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 _0x6bfa=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','exports','util','Undefined\x20error.'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x6bfa,0x140));var _0xa6bf=function(_0x2442a8,_0x3e0d90){_0x2442a8=_0x2442a8-0x0;var _0x105340=_0x6bfa[_0x2442a8];return _0x105340;};'use strict';var util=require(_0xa6bf('0x0'));var error={'E_AGI_UNDEFINED':_0xa6bf('0x1'),'E_AGI_ARGUMENT_PORT':_0xa6bf('0x2'),'E_AGI_SERVER_ERROR':_0xa6bf('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0xa6bf('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xa6bf('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xa6bf('0x6'),'E_AGI_COMMAND_EMPTY':_0xa6bf('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xa6bf('0x8')};function AGIError(_0x43e34b){var _0x43e34b=_0x43e34b||null,_0xeac108=_0xeac108||[],_0x38a87c=0x1,_0x26d04e='';if(!error[_0x43e34b]){_0x43e34b='E_AGI_UNDEFINED';}_0xeac108[_0xa6bf('0x9')](error[_0x43e34b]);while(arguments[_0x38a87c]){_0xeac108[_0xa6bf('0x9')](arguments[_0x38a87c]);_0x38a87c++;}_0x26d04e=util[_0xa6bf('0xa')][_0xa6bf('0xb')](util,_0xeac108);this[_0xa6bf('0xc')]=_0x26d04e;this['name']=_0x43e34b;}module[_0xa6bf('0xd')]=AGIError; \ No newline at end of file +var _0xe7a7=['message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply'];(function(_0x6e4b10,_0xe5809e){var _0x30df08=function(_0x4618ca){while(--_0x4618ca){_0x6e4b10['push'](_0x6e4b10['shift']());}};_0x30df08(++_0xe5809e);}(_0xe7a7,0x18a));var _0x7e7a=function(_0x5e7590,_0x53f834){_0x5e7590=_0x5e7590-0x0;var _0x57f66f=_0xe7a7[_0x5e7590];return _0x57f66f;};'use strict';var util=require(_0x7e7a('0x0'));var error={'E_AGI_UNDEFINED':_0x7e7a('0x1'),'E_AGI_ARGUMENT_PORT':_0x7e7a('0x2'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x7e7a('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x7e7a('0x4'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x7e7a('0x5'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x7e7a('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x7e7a('0x7')};function AGIError(_0x2cc347){var _0x2cc347=_0x2cc347||null,_0x5d2639=_0x5d2639||[],_0x35a19d=0x1,_0x9f077c='';if(!error[_0x2cc347]){_0x2cc347=_0x7e7a('0x8');}_0x5d2639[_0x7e7a('0x9')](error[_0x2cc347]);while(arguments[_0x35a19d]){_0x5d2639[_0x7e7a('0x9')](arguments[_0x35a19d]);_0x35a19d++;}_0x9f077c=util[_0x7e7a('0xa')][_0x7e7a('0xb')](util,_0x5d2639);this[_0x7e7a('0xc')]=_0x9f077c;this[_0x7e7a('0xd')]=_0x2cc347;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 409c4c5..1b3af28 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 _0x8d94=['addEdge','push','size','relations','getVertex','traverseBFS','info','stop\x20traverse','no\x20edge/s\x20available','length','condition','split','vswitch','target','default','agicommand','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','exports','../../../config/logger','agi','menu','edges','numberOfEdges','prototype','addVertex','vertices'];(function(_0x4264bf,_0x39db0f){var _0x515e5f=function(_0x130168){while(--_0x130168){_0x4264bf['push'](_0x4264bf['shift']());}};_0x515e5f(++_0x39db0f);}(_0x8d94,0x1e5));var _0x48d9=function(_0x58b2bd,_0x51c10f){_0x58b2bd=_0x58b2bd-0x0;var _0xdefa8b=_0x8d94[_0x58b2bd];return _0xdefa8b;};'use strict';var _=require('lodash');var logger=require(_0x48d9('0x0'))(_0x48d9('0x1'));var verticesWithRetry=[_0x48d9('0x2'),'getdigits','getsecretdigits'];var Graph=function(){this['vertices']={};this[_0x48d9('0x3')]={};this[_0x48d9('0x4')]=0x0;};Graph[_0x48d9('0x5')][_0x48d9('0x6')]=function(_0x55ce07){this[_0x48d9('0x7')][_0x55ce07['id']]=_0x55ce07;this['edges'][_0x55ce07['id']]=[];};Graph[_0x48d9('0x5')][_0x48d9('0x8')]=function(_0x1edebe,_0x1b617e,_0x1d1a89){this['edges'][_0x1edebe][_0x48d9('0x9')]({'target':_0x1b617e,'condition':_0x1d1a89});this[_0x48d9('0x4')]+=0x1;};Graph[_0x48d9('0x5')]['size']=function(){return _[_0x48d9('0xa')](this[_0x48d9('0x7')]);};Graph['prototype'][_0x48d9('0xb')]=function(){return this[_0x48d9('0x4')];};Graph[_0x48d9('0x5')][_0x48d9('0xc')]=function(_0x4a771e){return this[_0x48d9('0x7')][_0x4a771e];};Graph[_0x48d9('0x5')][_0x48d9('0xd')]=function(_0x2dc4e8,_0x1075d7){if(!this[_0x48d9('0x7')][_0x2dc4e8]){return logger['info']('no\x20vertex\x20found');}var _0x479399=_0x1075d7(this[_0x48d9('0x7')][_0x2dc4e8]);if(!_0x479399){return logger[_0x48d9('0xe')](_0x48d9('0xf'));}if(this[_0x48d9('0x3')][_0x2dc4e8]['length']===0x0){return logger[_0x48d9('0xe')](_0x48d9('0x10'));}for(var _0x3be01d=0x0,_0x2c6f6b=[],_0x799f17=![];_0x3be01d\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','mxGraphModel','agicommand','maxRetry','retry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','addEdge','target','value','getSquareProject','then','catch','createSquareReport','indexOf','agi_','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','evtHangup','hangup','sync','production','start','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','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','result','response','isUndefined','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','vertex','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s'];(function(_0x5950f1,_0x1a5c72){var _0x2ea241=function(_0x1c357d){while(--_0x1c357d){_0x5950f1['push'](_0x5950f1['shift']());}};_0x2ea241(++_0x1a5c72);}(_0x0680,0x1e5));var _0x0068=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0680[_0x3dd15e];return _0x231fd0;};'use strict';var parser=require(_0x0068('0x0'));var _=require(_0x0068('0x1'));var syncho=require(_0x0068('0x2'));var util=require(_0x0068('0x3'));var moment=require(_0x0068('0x4'));var config=require(_0x0068('0x5'));var logger=require(_0x0068('0x6'))(_0x0068('0x7'));var utilLicense=require(_0x0068('0x8'));var rpc=require(_0x0068('0x9'));var mailRpc=require(_0x0068('0xa'));var Graph=require(_0x0068('0xb'));var Vertices=require(_0x0068('0xc'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x0068('0x7')]=_[_0x0068('0xd')](config[_0x0068('0x7')],{'ip':_0x0068('0xe'),'port':0x11dd});function connectionHandler(_0x3f8388){process[_0x0068('0xf')](function(){syncho(function(){try{setChannelVariables(_0x3f8388);agiHandler(_0x3f8388);}catch(_0x548913){logger['error'](_0x548913[_0x0068('0x10')]);}});});}function listeningHandler(){console[_0x0068('0x11')](_0x0068('0x12'),config[_0x0068('0x7')][_0x0068('0x13')]);logger[_0x0068('0x14')](util[_0x0068('0x15')](_0x0068('0x16'),config[_0x0068('0x7')]['ip'],config[_0x0068('0x7')][_0x0068('0x13')]));}function errorHandler(_0x196b43){if(_0x196b43&&_0x196b43[_0x0068('0x17')]&&_0x196b43[_0x0068('0x18')]){logger[_0x0068('0x19')](util[_0x0068('0x15')](_0x0068('0x1a'),_0x196b43[_0x0068('0x17')],_0x196b43['message']));}else{logger[_0x0068('0x19')](util[_0x0068('0x15')](_0x0068('0x1b'),_0x196b43['stack']));}}function closeHandler(){logger['info'](util['format'](_0x0068('0x1c'),this['arg_1'],this[_0x0068('0x1d')],this[_0x0068('0x1e')],this[_0x0068('0x1f')],this['uniqueid']));try{createSquareReport(this);}catch(_0x885c0c){logger['error'](_0x885c0c[_0x0068('0x10')]);}}function timeoutHandler(){logger[_0x0068('0x14')](util[_0x0068('0x15')](_0x0068('0x20'),this[_0x0068('0x21')],this[_0x0068('0x1d')],this['callerid'],this[_0x0068('0x1f')],this[_0x0068('0x22')]));}function hangupHandler(){logger[_0x0068('0x14')](util[_0x0068('0x15')](_0x0068('0x23'),this[_0x0068('0x21')],this[_0x0068('0x1d')],this[_0x0068('0x1e')],this[_0x0068('0x1f')],this[_0x0068('0x22')]));this['evtHangup']=!![];}function getRoot(_0x5cafe0){return parser['toJson'](_0x5cafe0,{'object':!![]})[_0x0068('0x24')]['root'];}function addVertex(_0x5be626,_0x149bac,_0x2cc2d5){_0x149bac[_0x0068('0x25')]=_0x2cc2d5;if(_0x149bac['hasOwnProperty']('retry')){_0x149bac[_0x0068('0x26')]=parseInt(_0x149bac[_0x0068('0x27')],0xa);}_0x5be626[_0x0068('0x28')](_[_0x0068('0x29')](_0x149bac,_0x0068('0x2a')));}function initGraph(_0x3b5f87,_0x43b58d){var _0x4162c2=new Graph();for(var _0x185921 in _0x3b5f87){if(_0x3b5f87[_0x0068('0x2b')](_0x185921)){if(_[_0x0068('0x2c')](_0x3b5f87[_0x185921])){for(var _0x409953=0x0;_0x409953<_0x3b5f87[_0x185921][_0x0068('0x2d')];_0x409953+=0x1){addVertex(_0x4162c2,_0x3b5f87[_0x185921][_0x409953],_0x185921);}}else{addVertex(_0x4162c2,_0x3b5f87[_0x185921],_0x185921);}}}for(var _0x55d39b=0x0;_0x55d39b<_0x43b58d[_0x0068('0x2d')];_0x55d39b+=0x1){if(_0x43b58d[_0x55d39b][_0x0068('0x2e')]&&_0x43b58d[_0x55d39b]['target']){_0x4162c2[_0x0068('0x2f')](_0x43b58d[_0x55d39b]['source'],_0x43b58d[_0x55d39b][_0x0068('0x30')],_0x43b58d[_0x55d39b][_0x0068('0x31')]);}}return _0x4162c2;}function getSquareProject(_0x83afb9,_0x28c05e){rpc[_0x0068('0x32')](_0x83afb9)[_0x0068('0x33')](function(_0x38b759){_0x28c05e(null,_0x38b759);})[_0x0068('0x34')](function(_0x3d0c43){_0x28c05e(null,_0x3d0c43);});}function createSquareReport(_0x498147,_0x467385){rpc[_0x0068('0x35')](_0x498147)['then'](function(_0x45d441){if(_0x467385){_0x467385(null,_0x45d441);}})[_0x0068('0x34')](function(_0x44b540){if(_0x467385){_0x467385(null,_0x44b540);}});}function setChannelVariables(_0x3e8fab){for(var _0x15a285 in _0x3e8fab){if(_0x3e8fab[_0x0068('0x2b')](_0x15a285)){if(_0x15a285[_0x0068('0x36')](_0x0068('0x37'))===0x0){_0x3e8fab[_0x15a285['substring'](0x4)]=_0x3e8fab[_0x15a285];delete _0x3e8fab[_0x15a285];}}}}function getLogFromObject(_0x228c65){return util['inspect'](_0x228c65,{'showHidden':![],'depth':null});}function agiHandler(_0x3239f7){var _0x3aaa5b,_0x312a27,_0x318047,_0x4a8c00,_0x46e3a3;logger[_0x0068('0x38')](_0x0068('0x39'),JSON[_0x0068('0x3a')](_0x3239f7,null,0x2));logger[_0x0068('0x14')](util['format'](_0x0068('0x3b'),_0x3239f7[_0x0068('0x21')],_0x3239f7[_0x0068('0x1d')],_0x3239f7[_0x0068('0x1e')],_0x3239f7['dnid'],_0x3239f7[_0x0068('0x22')]));_0x3239f7['on'](_0x0068('0x19'),errorHandler);_0x3239f7['on'](_0x0068('0x3c'),closeHandler);_0x3239f7['on'](_0x0068('0x3d'),timeoutHandler);_0x3239f7[_0x0068('0x3e')]=![];_0x3239f7['on'](_0x0068('0x3f'),hangupHandler);var _0x159eee=getSquareProject[_0x0068('0x40')](null,_0x3239f7['arg_1']);if(_0x159eee){if(_0x159eee[_0x0068('0x41')]){_0x3aaa5b=getRoot(_0x159eee['production']);if(_0x3aaa5b&&_0x3aaa5b[_0x0068('0x42')]){logger[_0x0068('0x38')]('root',JSON[_0x0068('0x3a')](_0x3aaa5b,null,0x2));_0x3239f7['joinAt']=moment()[_0x0068('0x15')](_0x0068('0x43'));_0x312a27=initGraph(_[_0x0068('0x29')](_0x3aaa5b,_0x0068('0x2a')),_0x3aaa5b[_0x0068('0x2a')]);_0x318047=new Vertices(_0x3239f7,rpc,mailRpc);logger[_0x0068('0x14')](util[_0x0068('0x15')](_0x0068('0x44'),_0x3239f7[_0x0068('0x21')],_0x3239f7[_0x0068('0x1d')],_0x3239f7[_0x0068('0x1e')],_0x3239f7[_0x0068('0x1f')],_0x3239f7[_0x0068('0x22')]));_0x312a27['traverseBFS'](_0x3aaa5b[_0x0068('0x42')]['id'],function(_0x1807b0){try{_0x1807b0=_0x318047[_0x0068('0x45')](_0x1807b0);logger[_0x0068('0x38')]('vertex',JSON[_0x0068('0x3a')](_0x1807b0,null,0x2));if(_0x1807b0[_0x0068('0x25')]==='gotoc'){logger[_0x0068('0x14')](_0x0068('0x46'));_0x3239f7['context']=_0x1807b0[_0x0068('0x47')]||_0x3239f7[_0x0068('0x47')];_0x3239f7[_0x0068('0x48')]=_0x1807b0[_0x0068('0x48')];_0x3239f7[_0x0068('0x49')]=_0x1807b0[_0x0068('0x49')]?_0x1807b0[_0x0068('0x49')]-0x1:0x1;return null;}else if(_0x1807b0&&_0x318047[_0x1807b0[_0x0068('0x25')]]){_0x46e3a3=_0x318047[_0x1807b0[_0x0068('0x25')]](_0x1807b0);logger[_0x0068('0x14')]('response',JSON[_0x0068('0x3a')](_0x46e3a3,null,0x2));if(_0x46e3a3&&_0x46e3a3['code']===AGI_CODE_SUCCESS&&_0x46e3a3[_0x0068('0x4a')]!==AGI_RESULT_ERROR&&!_0x3239f7[_0x0068('0x3e')]){logger[_0x0068('0x38')](_0x0068('0x4b'),getLogFromObject(_0x46e3a3));return _[_0x0068('0x4c')](_0x46e3a3[_0x0068('0x4a')])?null:_0x46e3a3[_0x0068('0x4a')][_0x0068('0x4d')]();}else{logger[_0x0068('0x19')](_0x0068('0x4b'),getLogFromObject(_0x46e3a3));return null;}}else{logger[_0x0068('0x19')]('agicommand\x20not\x20found');return null;}}catch(_0x52455e){logger['error'](_0x52455e[_0x0068('0x10')]);return null;}});if(_0x3aaa5b[_0x0068('0x4e')]){logger[_0x0068('0x14')](util[_0x0068('0x15')](_0x0068('0x4f'),_0x3239f7[_0x0068('0x21')],_0x3239f7[_0x0068('0x1d')],_0x3239f7['callerid'],_0x3239f7[_0x0068('0x1f')],_0x3239f7['uniqueid']));_0x312a27[_0x0068('0x50')](_0x3aaa5b['finally']['id'],function(_0x2cdc65){try{_0x2cdc65=_0x318047[_0x0068('0x45')](_0x2cdc65);logger[_0x0068('0x38')](_0x0068('0x51'),JSON[_0x0068('0x3a')](_0x2cdc65,null,0x2));if(_0x2cdc65&&_0x318047[_0x2cdc65[_0x0068('0x25')]]){_0x46e3a3=_0x318047[_0x2cdc65[_0x0068('0x25')]](_0x2cdc65);if(_0x46e3a3){logger[_0x0068('0x38')]('response',getLogFromObject(_0x46e3a3));return _['isUndefined'](_0x46e3a3[_0x0068('0x4a')])?null:_0x46e3a3[_0x0068('0x4a')][_0x0068('0x4d')]();}else{logger['error'](_0x0068('0x4b'),getLogFromObject(_0x46e3a3));return null;}}else{logger[_0x0068('0x19')](_0x0068('0x52'));return null;}}catch(_0xce805b){logger[_0x0068('0x19')](_0xce805b['stack']);return null;}});}logger[_0x0068('0x14')](util[_0x0068('0x15')](_0x0068('0x53'),_0x3239f7[_0x0068('0x21')],_0x3239f7[_0x0068('0x1d')],_0x3239f7['callerid'],_0x3239f7[_0x0068('0x1f')],_0x3239f7[_0x0068('0x22')]));logger['info'](util[_0x0068('0x15')](_0x0068('0x54'),_0x3239f7['context'],_0x3239f7[_0x0068('0x48')],parseInt(_0x3239f7[_0x0068('0x49')],0xa)+0x1));_0x3239f7[_0x0068('0x55')](_0x3239f7[_0x0068('0x47')],_0x3239f7['extension'],parseInt(_0x3239f7[_0x0068('0x49')],0xa)+0x1);_0x3239f7[_0x0068('0x3c')]();}}else{logger['error'](util[_0x0068('0x15')](_0x0068('0x56'),_0x3239f7['arg_1']));_0x3239f7[_0x0068('0x55')](_0x3239f7[_0x0068('0x47')],_0x3239f7[_0x0068('0x48')],parseInt(_0x3239f7[_0x0068('0x49')],0xa)+0x1);_0x3239f7[_0x0068('0x3c')]();}}else{logger[_0x0068('0x19')](util[_0x0068('0x15')]('Project\x20%s\x20not\x20found',_0x3239f7[_0x0068('0x21')]));_0x3239f7[_0x0068('0x55')](_0x3239f7[_0x0068('0x47')],_0x3239f7[_0x0068('0x48')],parseInt(_0x3239f7[_0x0068('0x49')],0xa)+0x1);_0x3239f7[_0x0068('0x3c')]();}}function main(){var _0x29a347;return utilLicense['getLicense']()['then'](function(_0x1a7280){if(_0x1a7280){if(_0x1a7280[_0x0068('0x57')]){if(_0x1a7280[_0x0068('0x58')]&&_0x1a7280['callysquare']>0x0){logger[_0x0068('0x14')](util[_0x0068('0x15')](_0x0068('0x59'),_0x1a7280[_0x0068('0x58')]));_0x29a347=_0x1a7280['callysquare'];}else{logger[_0x0068('0x14')](_0x0068('0x5a'));}}else{logger['info'](_0x0068('0x5b'));_0x29a347=-0x1;}}})[_0x0068('0x34')](function(_0x1206a1){logger[_0x0068('0x19')](_0x0068('0x5c'),_0x1206a1['stack']);})[_0x0068('0x4e')](function(){var _0x87c453=require(_0x0068('0x5d'))(config[_0x0068('0x7')][_0x0068('0x13')],config[_0x0068('0x7')]['ip'],_0x29a347);_0x87c453['on'](_0x0068('0x19'),errorHandler);_0x87c453['on'](_0x0068('0x5e'),listeningHandler);_0x87c453['on']('connection',connectionHandler);_0x87c453['on'](_0x0068('0x3c'),closeHandler);});}main(); \ No newline at end of file +var _0xbbf5=['getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','./server','listening','../../config/environment','../../config/logger','../../config/license/util','./mailRpc','./graph','./vertices','agi','error','stack','log','port','info','format','name','[%s]\x20%s','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','root','retry','maxRetry','addVertex','length','source','addEdge','target','getSquareProject','then','catch','createSquareReport','hasOwnProperty','indexOf','agi_','substring','inspect','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','production','start','omit','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','agicommand','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','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','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published'];(function(_0x1204ac,_0x21305d){var _0x1c8b00=function(_0xd1c6be){while(--_0xd1c6be){_0x1204ac['push'](_0x1204ac['shift']());}};_0x1c8b00(++_0x21305d);}(_0xbbf5,0x157));var _0x5bbf=function(_0x12d0f0,_0x3c10c0){_0x12d0f0=_0x12d0f0-0x0;var _0x52813e=_0xbbf5[_0x12d0f0];return _0x52813e;};'use strict';var parser=require('xml2json');var _=require('lodash');var syncho=require('syncho');var util=require('util');var moment=require('moment');var config=require(_0x5bbf('0x0'));var logger=require(_0x5bbf('0x1'))('agi');var utilLicense=require(_0x5bbf('0x2'));var rpc=require('./rpc');var mailRpc=require(_0x5bbf('0x3'));var Graph=require(_0x5bbf('0x4'));var Vertices=require(_0x5bbf('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x5bbf('0x6')]=_['defaults'](config[_0x5bbf('0x6')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x2ba30f){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x2ba30f);agiHandler(_0x2ba30f);}catch(_0x5e5cef){logger[_0x5bbf('0x7')](_0x5e5cef[_0x5bbf('0x8')]);}});});}function listeningHandler(){console[_0x5bbf('0x9')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0x5bbf('0xa')]);logger[_0x5bbf('0xb')](util[_0x5bbf('0xc')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x5bbf('0x6')]['ip'],config[_0x5bbf('0x6')][_0x5bbf('0xa')]));}function errorHandler(_0x29e6da){if(_0x29e6da&&_0x29e6da[_0x5bbf('0xd')]&&_0x29e6da['message']){logger[_0x5bbf('0x7')](util[_0x5bbf('0xc')](_0x5bbf('0xe'),_0x29e6da['name'],_0x29e6da[_0x5bbf('0xf')]));}else{logger[_0x5bbf('0x7')](util['format'](_0x5bbf('0x10'),_0x29e6da[_0x5bbf('0x8')]));}}function closeHandler(){logger[_0x5bbf('0xb')](util['format'](_0x5bbf('0x11'),this[_0x5bbf('0x12')],this[_0x5bbf('0x13')],this[_0x5bbf('0x14')],this['dnid'],this[_0x5bbf('0x15')]));try{createSquareReport(this);}catch(_0x5683bb){logger[_0x5bbf('0x7')](_0x5683bb[_0x5bbf('0x8')]);}}function timeoutHandler(){logger[_0x5bbf('0xb')](util['format'](_0x5bbf('0x16'),this['arg_1'],this['calleridname'],this['callerid'],this[_0x5bbf('0x17')],this[_0x5bbf('0x15')]));}function hangupHandler(){logger[_0x5bbf('0xb')](util[_0x5bbf('0xc')](_0x5bbf('0x18'),this[_0x5bbf('0x12')],this[_0x5bbf('0x13')],this['callerid'],this[_0x5bbf('0x17')],this['uniqueid']));this[_0x5bbf('0x19')]=!![];}function getRoot(_0x1f1817){return parser[_0x5bbf('0x1a')](_0x1f1817,{'object':!![]})[_0x5bbf('0x1b')][_0x5bbf('0x1c')];}function addVertex(_0x51c40f,_0x84ae8a,_0xfa463a){_0x84ae8a['agicommand']=_0xfa463a;if(_0x84ae8a['hasOwnProperty'](_0x5bbf('0x1d'))){_0x84ae8a[_0x5bbf('0x1e')]=parseInt(_0x84ae8a[_0x5bbf('0x1d')],0xa);}_0x51c40f[_0x5bbf('0x1f')](_['omit'](_0x84ae8a,'mxCell'));}function initGraph(_0xf08753,_0xf08c9){var _0x3586b2=new Graph();for(var _0x11357e in _0xf08753){if(_0xf08753['hasOwnProperty'](_0x11357e)){if(_['isArray'](_0xf08753[_0x11357e])){for(var _0x5b9991=0x0;_0x5b9991<_0xf08753[_0x11357e]['length'];_0x5b9991+=0x1){addVertex(_0x3586b2,_0xf08753[_0x11357e][_0x5b9991],_0x11357e);}}else{addVertex(_0x3586b2,_0xf08753[_0x11357e],_0x11357e);}}}for(var _0x503d4f=0x0;_0x503d4f<_0xf08c9[_0x5bbf('0x20')];_0x503d4f+=0x1){if(_0xf08c9[_0x503d4f][_0x5bbf('0x21')]&&_0xf08c9[_0x503d4f]['target']){_0x3586b2[_0x5bbf('0x22')](_0xf08c9[_0x503d4f][_0x5bbf('0x21')],_0xf08c9[_0x503d4f][_0x5bbf('0x23')],_0xf08c9[_0x503d4f]['value']);}}return _0x3586b2;}function getSquareProject(_0x4b337f,_0xe173ca){rpc[_0x5bbf('0x24')](_0x4b337f)[_0x5bbf('0x25')](function(_0x381a92){_0xe173ca(null,_0x381a92);})[_0x5bbf('0x26')](function(_0x47ba7c){_0xe173ca(null,_0x47ba7c);});}function createSquareReport(_0x195314,_0x2d36ad){rpc[_0x5bbf('0x27')](_0x195314)[_0x5bbf('0x25')](function(_0x5a3745){if(_0x2d36ad){_0x2d36ad(null,_0x5a3745);}})[_0x5bbf('0x26')](function(_0x87273d){if(_0x2d36ad){_0x2d36ad(null,_0x87273d);}});}function setChannelVariables(_0x1dd402){for(var _0x454203 in _0x1dd402){if(_0x1dd402[_0x5bbf('0x28')](_0x454203)){if(_0x454203[_0x5bbf('0x29')](_0x5bbf('0x2a'))===0x0){_0x1dd402[_0x454203[_0x5bbf('0x2b')](0x4)]=_0x1dd402[_0x454203];delete _0x1dd402[_0x454203];}}}}function getLogFromObject(_0xa1c7f8){return util[_0x5bbf('0x2c')](_0xa1c7f8,{'showHidden':![],'depth':null});}function agiHandler(_0x57c884){var _0x589d8f,_0x42e562,_0x59cb17,_0xff02c7,_0x6c7acc;logger[_0x5bbf('0x2d')](_0x5bbf('0x2e'),JSON[_0x5bbf('0x2f')](_0x57c884,null,0x2));logger[_0x5bbf('0xb')](util[_0x5bbf('0xc')](_0x5bbf('0x30'),_0x57c884[_0x5bbf('0x12')],_0x57c884[_0x5bbf('0x13')],_0x57c884[_0x5bbf('0x14')],_0x57c884[_0x5bbf('0x17')],_0x57c884['uniqueid']));_0x57c884['on'](_0x5bbf('0x7'),errorHandler);_0x57c884['on'](_0x5bbf('0x31'),closeHandler);_0x57c884['on'](_0x5bbf('0x32'),timeoutHandler);_0x57c884[_0x5bbf('0x19')]=![];_0x57c884['on'](_0x5bbf('0x33'),hangupHandler);var _0x2538af=getSquareProject['sync'](null,_0x57c884[_0x5bbf('0x12')]);if(_0x2538af){if(_0x2538af[_0x5bbf('0x34')]){_0x589d8f=getRoot(_0x2538af['production']);if(_0x589d8f&&_0x589d8f[_0x5bbf('0x35')]){logger[_0x5bbf('0x2d')](_0x5bbf('0x1c'),JSON[_0x5bbf('0x2f')](_0x589d8f,null,0x2));_0x57c884['joinAt']=moment()[_0x5bbf('0xc')]('YYYY-MM-DD\x20HH:mm:ss');_0x42e562=initGraph(_[_0x5bbf('0x36')](_0x589d8f,'mxCell'),_0x589d8f[_0x5bbf('0x37')]);_0x59cb17=new Vertices(_0x57c884,rpc,mailRpc);logger[_0x5bbf('0xb')](util['format'](_0x5bbf('0x38'),_0x57c884['arg_1'],_0x57c884[_0x5bbf('0x13')],_0x57c884[_0x5bbf('0x14')],_0x57c884[_0x5bbf('0x17')],_0x57c884[_0x5bbf('0x15')]));_0x42e562[_0x5bbf('0x39')](_0x589d8f['start']['id'],function(_0x49e3a1){try{_0x49e3a1=_0x59cb17[_0x5bbf('0x3a')](_0x49e3a1);logger[_0x5bbf('0x2d')](_0x5bbf('0x3b'),JSON['stringify'](_0x49e3a1,null,0x2));if(_0x49e3a1[_0x5bbf('0x3c')]===_0x5bbf('0x3d')){logger[_0x5bbf('0xb')](_0x5bbf('0x3e'));_0x57c884['context']=_0x49e3a1['context']||_0x57c884[_0x5bbf('0x3f')];_0x57c884[_0x5bbf('0x40')]=_0x49e3a1[_0x5bbf('0x40')];_0x57c884[_0x5bbf('0x41')]=_0x49e3a1['priority']?_0x49e3a1[_0x5bbf('0x41')]-0x1:0x1;return null;}else if(_0x49e3a1&&_0x59cb17[_0x49e3a1[_0x5bbf('0x3c')]]){_0x6c7acc=_0x59cb17[_0x49e3a1[_0x5bbf('0x3c')]](_0x49e3a1);logger[_0x5bbf('0xb')](_0x5bbf('0x42'),JSON[_0x5bbf('0x2f')](_0x6c7acc,null,0x2));if(_0x6c7acc&&_0x6c7acc['code']===AGI_CODE_SUCCESS&&_0x6c7acc[_0x5bbf('0x43')]!==AGI_RESULT_ERROR&&!_0x57c884[_0x5bbf('0x19')]){logger[_0x5bbf('0x2d')](_0x5bbf('0x42'),getLogFromObject(_0x6c7acc));return _['isUndefined'](_0x6c7acc[_0x5bbf('0x43')])?null:_0x6c7acc[_0x5bbf('0x43')][_0x5bbf('0x44')]();}else{logger[_0x5bbf('0x7')]('response',getLogFromObject(_0x6c7acc));return null;}}else{logger[_0x5bbf('0x7')](_0x5bbf('0x45'));return null;}}catch(_0x3c395b){logger[_0x5bbf('0x7')](_0x3c395b[_0x5bbf('0x8')]);return null;}});if(_0x589d8f[_0x5bbf('0x46')]){logger[_0x5bbf('0xb')](util['format'](_0x5bbf('0x47'),_0x57c884['arg_1'],_0x57c884['calleridname'],_0x57c884[_0x5bbf('0x14')],_0x57c884[_0x5bbf('0x17')],_0x57c884[_0x5bbf('0x15')]));_0x42e562[_0x5bbf('0x39')](_0x589d8f[_0x5bbf('0x46')]['id'],function(_0x3431c5){try{_0x3431c5=_0x59cb17[_0x5bbf('0x3a')](_0x3431c5);logger[_0x5bbf('0x2d')](_0x5bbf('0x3b'),JSON[_0x5bbf('0x2f')](_0x3431c5,null,0x2));if(_0x3431c5&&_0x59cb17[_0x3431c5['agicommand']]){_0x6c7acc=_0x59cb17[_0x3431c5['agicommand']](_0x3431c5);if(_0x6c7acc){logger[_0x5bbf('0x2d')](_0x5bbf('0x42'),getLogFromObject(_0x6c7acc));return _[_0x5bbf('0x48')](_0x6c7acc[_0x5bbf('0x43')])?null:_0x6c7acc['result'][_0x5bbf('0x44')]();}else{logger[_0x5bbf('0x7')](_0x5bbf('0x42'),getLogFromObject(_0x6c7acc));return null;}}else{logger[_0x5bbf('0x7')](_0x5bbf('0x45'));return null;}}catch(_0x4f33d6){logger[_0x5bbf('0x7')](_0x4f33d6[_0x5bbf('0x8')]);return null;}});}logger[_0x5bbf('0xb')](util[_0x5bbf('0xc')](_0x5bbf('0x49'),_0x57c884[_0x5bbf('0x12')],_0x57c884['calleridname'],_0x57c884[_0x5bbf('0x14')],_0x57c884['dnid'],_0x57c884[_0x5bbf('0x15')]));logger['info'](util['format'](_0x5bbf('0x4a'),_0x57c884[_0x5bbf('0x3f')],_0x57c884[_0x5bbf('0x40')],parseInt(_0x57c884['priority'],0xa)+0x1));_0x57c884[_0x5bbf('0x4b')](_0x57c884[_0x5bbf('0x3f')],_0x57c884[_0x5bbf('0x40')],parseInt(_0x57c884['priority'],0xa)+0x1);_0x57c884[_0x5bbf('0x31')]();}}else{logger[_0x5bbf('0x7')](util[_0x5bbf('0xc')](_0x5bbf('0x4c'),_0x57c884[_0x5bbf('0x12')]));_0x57c884['continueAt'](_0x57c884['context'],_0x57c884[_0x5bbf('0x40')],parseInt(_0x57c884['priority'],0xa)+0x1);_0x57c884[_0x5bbf('0x31')]();}}else{logger['error'](util[_0x5bbf('0xc')]('Project\x20%s\x20not\x20found',_0x57c884[_0x5bbf('0x12')]));_0x57c884[_0x5bbf('0x4b')](_0x57c884['context'],_0x57c884[_0x5bbf('0x40')],parseInt(_0x57c884[_0x5bbf('0x41')],0xa)+0x1);_0x57c884['close']();}}function main(){var _0x309ac4;return utilLicense[_0x5bbf('0x4d')]()[_0x5bbf('0x25')](function(_0x529a02){if(_0x529a02){if(_0x529a02[_0x5bbf('0x4e')]){if(_0x529a02[_0x5bbf('0x4f')]&&_0x529a02[_0x5bbf('0x4f')]>0x0){logger['info'](util[_0x5bbf('0xc')](_0x5bbf('0x50'),_0x529a02[_0x5bbf('0x4f')]));_0x309ac4=_0x529a02[_0x5bbf('0x4f')];}else{logger[_0x5bbf('0xb')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x5bbf('0xb')](_0x5bbf('0x51'));_0x309ac4=-0x1;}}})[_0x5bbf('0x26')](function(_0x2d49ce){logger[_0x5bbf('0x7')]('[LICENSE]',_0x2d49ce[_0x5bbf('0x8')]);})[_0x5bbf('0x46')](function(){var _0x33e3e5=require(_0x5bbf('0x52'))(config['agi'][_0x5bbf('0xa')],config[_0x5bbf('0x6')]['ip'],_0x309ac4);_0x33e3e5['on'](_0x5bbf('0x7'),errorHandler);_0x33e3e5['on'](_0x5bbf('0x53'),listeningHandler);_0x33e3e5['on']('connection',connectionHandler);_0x33e3e5['on'](_0x5bbf('0x31'),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 c1c6950..f8f53d9 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 _0xa409=['error','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','request','then'];(function(_0x7261e6,_0x3e3bf7){var _0x20d5ed=function(_0x522641){while(--_0x522641){_0x7261e6['push'](_0x7261e6['shift']());}};_0x20d5ed(++_0x3e3bf7);}(_0xa409,0xb9));var _0x9a40=function(_0x2b44ce,_0x14ada8){_0x2b44ce=_0x2b44ce-0x0;var _0x44ad14=_0xa409[_0x2b44ce];return _0x44ad14;};'use strict';var BPromise=require(_0x9a40('0x0'));var jayson=require(_0x9a40('0x1'));var client=jayson[_0x9a40('0x2')]['http']({'port':0x232b});function request(_0x45581f,_0x182460){return new BPromise(function(_0x103d37,_0x5a16ee){return client[_0x9a40('0x3')](_0x45581f,_0x182460)[_0x9a40('0x4')](function(_0x4e7f2d){if(_0x4e7f2d[_0x9a40('0x5')]){return _0x5a16ee(_0x4e7f2d[_0x9a40('0x5')][_0x9a40('0x6')]);}else{return _0x103d37(_0x4e7f2d['result']);}})[_0x9a40('0x7')](function(_0x2af459){return _0x5a16ee(_0x2af459);});});}exports[_0x9a40('0x8')]=function(_0x385f6f,_0x597e81){return request(_0x9a40('0x9'),{'account':_0x385f6f,'message':_0x597e81});}; \ No newline at end of file +var _0xb66a=['jayson/promise','request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird'];(function(_0x598a0b,_0x134386){var _0x2174f7=function(_0x3858db){while(--_0x3858db){_0x598a0b['push'](_0x598a0b['shift']());}};_0x2174f7(++_0x134386);}(_0xb66a,0x1d5));var _0xab66=function(_0x22b445,_0x169b4c){_0x22b445=_0x22b445-0x0;var _0x41ce45=_0xb66a[_0x22b445];return _0x41ce45;};'use strict';var BPromise=require(_0xab66('0x0'));var jayson=require(_0xab66('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x54b7f2,_0x2c2010){return new BPromise(function(_0x175cca,_0x58969e){return client[_0xab66('0x2')](_0x54b7f2,_0x2c2010)[_0xab66('0x3')](function(_0x235f36){if(_0x235f36[_0xab66('0x4')]){return _0x58969e(_0x235f36[_0xab66('0x4')][_0xab66('0x5')]);}else{return _0x175cca(_0x235f36[_0xab66('0x6')]);}})[_0xab66('0x7')](function(_0x3979aa){return _0x58969e(_0x3979aa);});});}exports[_0xab66('0x8')]=function(_0x499f03,_0x5020e7){return request(_0xab66('0x9'),{'account':_0x499f03,'message':_0x5020e7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 1e84be7..e4414aa 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 _0x84a0=['split','slice','trim','emit','headers','exports','util','stream','Transform','_localBuffer','_inBody','_transform','\x0d\x0a\x0d\x0a','indexOf','substring','length'];(function(_0x3fce35,_0x44a2a4){var _0x337b34=function(_0x475d0a){while(--_0x475d0a){_0x3fce35['push'](_0x3fce35['shift']());}};_0x337b34(++_0x44a2a4);}(_0x84a0,0x66));var _0x084a=function(_0x1df5cd,_0x3dc641){_0x1df5cd=_0x1df5cd-0x0;var _0xf6df9b=_0x84a0[_0x1df5cd];return _0xf6df9b;};'use strict';var util=require(_0x084a('0x0'));var Transform=require(_0x084a('0x1'))[_0x084a('0x2')];function AGIReply(_0x1fff7f){Transform['call'](this,_0x1fff7f);this[_0x084a('0x3')]='';this[_0x084a('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x084a('0x5')]=function(_0x1c0292,_0x5617b5,_0x16f8a7){var _0x4325ce='\x0a',_0x2e6810=['\x0a\x0a',_0x084a('0x6')],_0x373d2=-0x1,_0x2b30bc=-0x1,_0x58d419='',_0x1051a9=0x0,_0x13415d='',_0x8198ad='';this[_0x084a('0x3')]+=_0x1c0292['toString']();_0x13415d=this['_localBuffer'];if(!this[_0x084a('0x4')]){_0x1051a9=0x0;while(_0x2e6810[_0x1051a9]){while((_0x2b30bc=_0x13415d[_0x084a('0x7')](_0x2e6810[_0x1051a9]))!=-0x1){_0x58d419=_0x2e6810[_0x1051a9];_0x8198ad=_0x13415d[_0x084a('0x8')](0x0,_0x2b30bc);_0x13415d=_0x13415d[_0x084a('0x8')](_0x2b30bc+_0x58d419[_0x084a('0x9')]);var _0x57c405=_0x8198ad[_0x084a('0xa')](_0x4325ce),_0x4ef41f=0x0,_0xc451b1={},_0x3ca72f='',_0xec90a5='',_0x9245b1=-0x1;while(_0x57c405[_0x4ef41f]){_0x9245b1=_0x57c405[_0x4ef41f][_0x084a('0x7')](':');if(_0x9245b1!=-0x1){_0x3ca72f=_0x57c405[_0x4ef41f][_0x084a('0xb')](0x0,_0x9245b1)[_0x084a('0xc')]();_0xec90a5=_0x57c405[_0x4ef41f]['slice'](_0x9245b1+0x1)[_0x084a('0xc')]();if(_0x3ca72f['length']>0x0){_0xc451b1[_0x3ca72f]=_0xec90a5;}}else{}_0x4ef41f++;}this[_0x084a('0xd')](_0x084a('0xe'),_0xc451b1);this[_0x084a('0x4')]=!![];}_0x1051a9++;}this[_0x084a('0x3')]=_0x13415d;}else{while((_0x373d2=_0x13415d[_0x084a('0x7')](_0x4325ce))!=-0x1){_0x8198ad=_0x13415d['substring'](0x0,_0x373d2);this[_0x084a('0xd')]('line',_0x8198ad);_0x13415d=_0x13415d[_0x084a('0x8')](_0x373d2+_0x4325ce[_0x084a('0x9')]);}this['_localBuffer']=_0x13415d;}_0x16f8a7();};module[_0x084a('0xf')]=AGIReply; \ No newline at end of file +var _0x2064=['indexOf','slice','trim','length','emit','headers','exports','util','stream','Transform','call','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','toString','substring','split'];(function(_0x34e3cd,_0x290d0d){var _0x543bc9=function(_0xe733fd){while(--_0xe733fd){_0x34e3cd['push'](_0x34e3cd['shift']());}};_0x543bc9(++_0x290d0d);}(_0x2064,0x79));var _0x4206=function(_0x1f2be7,_0x55f91b){_0x1f2be7=_0x1f2be7-0x0;var _0x221ec6=_0x2064[_0x1f2be7];return _0x221ec6;};'use strict';var util=require(_0x4206('0x0'));var Transform=require(_0x4206('0x1'))[_0x4206('0x2')];function AGIReply(_0xbf4a33){Transform[_0x4206('0x3')](this,_0xbf4a33);this['_localBuffer']='';this[_0x4206('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x4206('0x5')][_0x4206('0x6')]=function(_0x33d27a,_0x2181de,_0x51d902){var _0x46a219='\x0a',_0x476220=['\x0a\x0a',_0x4206('0x7')],_0x4589bf=-0x1,_0x48af9a=-0x1,_0x2c2ca3='',_0x599891=0x0,_0x2fae96='',_0x49594d='';this[_0x4206('0x8')]+=_0x33d27a[_0x4206('0x9')]();_0x2fae96=this[_0x4206('0x8')];if(!this['_inBody']){_0x599891=0x0;while(_0x476220[_0x599891]){while((_0x48af9a=_0x2fae96['indexOf'](_0x476220[_0x599891]))!=-0x1){_0x2c2ca3=_0x476220[_0x599891];_0x49594d=_0x2fae96['substring'](0x0,_0x48af9a);_0x2fae96=_0x2fae96[_0x4206('0xa')](_0x48af9a+_0x2c2ca3['length']);var _0x83ff73=_0x49594d[_0x4206('0xb')](_0x46a219),_0x467261=0x0,_0x18a168={},_0x2be0e4='',_0x7d9f87='',_0x1b8e5e=-0x1;while(_0x83ff73[_0x467261]){_0x1b8e5e=_0x83ff73[_0x467261][_0x4206('0xc')](':');if(_0x1b8e5e!=-0x1){_0x2be0e4=_0x83ff73[_0x467261][_0x4206('0xd')](0x0,_0x1b8e5e)[_0x4206('0xe')]();_0x7d9f87=_0x83ff73[_0x467261][_0x4206('0xd')](_0x1b8e5e+0x1)[_0x4206('0xe')]();if(_0x2be0e4[_0x4206('0xf')]>0x0){_0x18a168[_0x2be0e4]=_0x7d9f87;}}else{}_0x467261++;}this[_0x4206('0x10')](_0x4206('0x11'),_0x18a168);this[_0x4206('0x4')]=!![];}_0x599891++;}this['_localBuffer']=_0x2fae96;}else{while((_0x4589bf=_0x2fae96[_0x4206('0xc')](_0x46a219))!=-0x1){_0x49594d=_0x2fae96[_0x4206('0xa')](0x0,_0x4589bf);this[_0x4206('0x10')]('line',_0x49594d);_0x2fae96=_0x2fae96[_0x4206('0xa')](_0x4589bf+_0x46a219[_0x4206('0xf')]);}this[_0x4206('0x8')]=_0x2fae96;}_0x51d902();};module[_0x4206('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 5865a55..1da2e2a 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 _0xc822=['ShowSquareOdbc','dsn','getUserById','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','bluebird','moment','lodash','util','jayson/promise','http','error','message','catch','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','getSquareProjectById','ShowVoiceQueue','ShowVariable','getSquareOdbcById'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xc822,0xd7));var _0x2c82=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0xc822[_0x29e3b6];return _0x55d4b0;};'use strict';var BPromise=require(_0x2c82('0x0'));var moment=require(_0x2c82('0x1'));var _=require(_0x2c82('0x2'));var util=require(_0x2c82('0x3'));var jayson=require(_0x2c82('0x4'));var client=jayson['client'][_0x2c82('0x5')]({'port':0x2329});function request(_0x57b817,_0x326bdd){return new BPromise(function(_0x1c6031,_0x56275b){return client['request'](_0x57b817,_0x326bdd)['then'](function(_0x32b493){if(_0x32b493[_0x2c82('0x6')]){return _0x56275b(_0x32b493[_0x2c82('0x6')][_0x2c82('0x7')]);}else{return _0x1c6031(_0x32b493['result']);}})[_0x2c82('0x8')](function(_0x484f32){return _0x56275b(_0x484f32);});});}exports[_0x2c82('0x9')]=function(_0x5f46f6){return request(_0x2c82('0xa'),{'options':{'raw':![],'where':{'name':_0x5f46f6},'attributes':['production']}});};exports[_0x2c82('0xb')]=function(_0x4fbe37){return request(_0x2c82('0xc'),{'options':{'raw':![],'where':{'id':_0x4fbe37},'include':[{'model':_0x2c82('0xd'),'as':_0x2c82('0xe')}],'attributes':['id',_0x2c82('0xf'),_0x2c82('0x10')]}});};exports[_0x2c82('0x11')]=function(_0x1f520b){return request('ShowSquareProject',{'options':{'where':{'id':_0x1f520b},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0x3f52b8){return request(_0x2c82('0x12'),{'options':{'where':{'id':_0x3f52b8},'attributes':[_0x2c82('0xf')]}});};exports['getVariableById']=function(_0x3ca778){return request(_0x2c82('0x13'),{'options':{'where':{'id':_0x3ca778},'attributes':[_0x2c82('0xf')]}});};exports[_0x2c82('0x14')]=function(_0x3117da){return request(_0x2c82('0x15'),{'options':{'where':{'id':_0x3117da},'attributes':[_0x2c82('0x16')]}});};exports[_0x2c82('0x17')]=function(_0x5b4092){return request('ShowUser',{'options':{'where':{'id':_0x5b4092},'attributes':[_0x2c82('0xf')]}});};exports[_0x2c82('0x18')]=function(_0x277c97){return request(_0x2c82('0x19'),{'options':{'where':{'id':_0x277c97},'attributes':[_0x2c82('0xf')]}});};exports[_0x2c82('0x1a')]=function(_0x421991){return request(_0x2c82('0x1b'),{'options':{'where':{'id':_0x421991},'attributes':[_0x2c82('0x1c')]}});};exports[_0x2c82('0x1d')]=function(_0x3af980){return request(_0x2c82('0x1e'),{'options':{'raw':![],'where':{'id':_0x3af980},'include':[{'model':'Interval','as':_0x2c82('0x1f')}]}});};exports[_0x2c82('0x20')]=function(_0x456bbb){return request(_0x2c82('0x21'),{'options':{'where':{'id':_0x456bbb},'attributes':['id',_0x2c82('0xf')]}});};exports[_0x2c82('0x22')]=function(_0x1c78de){return request(_0x2c82('0x23'),{'body':_0x1c78de});};exports[_0x2c82('0x24')]=function(_0x626a92){return request(_0x2c82('0x25'),{'body':_0x626a92});};exports[_0x2c82('0x26')]=function(_0x175d2d){return request(_0x2c82('0x27'),{'body':_[_0x2c82('0x28')](_0x175d2d,{'project_name':_0x175d2d[_0x2c82('0x29')],'prev_project_name':_0x175d2d['arg_2']||'','is_subproject':_0x175d2d[_0x2c82('0x2a')]?!![]:![],'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x2c82('0x2b')]=function(_0x3327ba){return request(_0x2c82('0x2c'),{'body':_0x3327ba});};exports[_0x2c82('0x2d')]=function(_0x386faa){return request(_0x2c82('0x2e'),{'body':_0x386faa});};exports[_0x2c82('0x2f')]=function(_0xa39f39){return request(_0x2c82('0x30'),{'options':{'raw':![],'where':{'phone':_0xa39f39[_0x2c82('0x31')],'ListId':_0xa39f39[_0x2c82('0x32')]}}})['then'](function(_0x3bd594){if(_0x3bd594){return _0x3bd594;}return request(_0x2c82('0x33'),{'body':_0xa39f39});});};exports['getPauseById']=function(_0x170919){return request(_0x2c82('0x34'),{'options':{'where':{'id':_0x170919},'attributes':[_0x2c82('0xf')]}});};exports[_0x2c82('0x35')]=function(_0x2f1163,_0x4cb6f6){return request(_0x2c82('0x36'),{'body':{'interface':_0x4cb6f6},'options':{'where':_0x2f1163}});};exports[_0x2c82('0x37')]=function(_0x2621a1,_0x1f6d78,_0x4b53e8){return request(_0x2c82('0x38'),{'body':{'type':_0x1f6d78,'uniqueid':_0x4b53e8},'options':{'where':_0x2621a1}});};exports[_0x2c82('0x39')]=function(_0x5b7832){return request(_0x2c82('0x3a'),{'body':{},'options':{'where':_0x5b7832}});};exports['agentLogout']=function(_0x42af08){return request('LogoutUser',{'body':{},'options':{'where':_0x42af08}});}; \ No newline at end of file +var _0x3355=['createCmContact','ShowCmHopper','phone','ListId','then','getPauseById','ShowPause','agentLogin','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','lodash','util','jayson/promise','client','http','request','error','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage'];(function(_0x3a7f15,_0x48ac0d){var _0x3b7ec9=function(_0x356ad3){while(--_0x356ad3){_0x3a7f15['push'](_0x3a7f15['shift']());}};_0x3b7ec9(++_0x48ac0d);}(_0x3355,0xb5));var _0x5335=function(_0x39af21,_0x3e4cad){_0x39af21=_0x39af21-0x0;var _0x3a6003=_0x3355[_0x39af21];return _0x3a6003;};'use strict';var BPromise=require('bluebird');var moment=require(_0x5335('0x0'));var _=require(_0x5335('0x1'));var util=require(_0x5335('0x2'));var jayson=require(_0x5335('0x3'));var client=jayson[_0x5335('0x4')][_0x5335('0x5')]({'port':0x2329});function request(_0x5b3b98,_0x13855c){return new BPromise(function(_0x101df5,_0x2af88f){return client[_0x5335('0x6')](_0x5b3b98,_0x13855c)['then'](function(_0x21da09){if(_0x21da09[_0x5335('0x7')]){return _0x2af88f(_0x21da09[_0x5335('0x7')]['message']);}else{return _0x101df5(_0x21da09['result']);}})[_0x5335('0x8')](function(_0x6bd61c){return _0x2af88f(_0x6bd61c);});});}exports[_0x5335('0x9')]=function(_0x858fd3){return request(_0x5335('0xa'),{'options':{'raw':![],'where':{'name':_0x858fd3},'attributes':[_0x5335('0xb')]}});};exports[_0x5335('0xc')]=function(_0x25b765){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x25b765},'include':[{'model':_0x5335('0xd'),'as':_0x5335('0xe')}],'attributes':['id',_0x5335('0xf'),_0x5335('0x10')]}});};exports[_0x5335('0x11')]=function(_0x40dec9){return request('ShowSquareProject',{'options':{'where':{'id':_0x40dec9},'attributes':[_0x5335('0xf')]}});};exports[_0x5335('0x12')]=function(_0x316feb){return request(_0x5335('0x13'),{'options':{'where':{'id':_0x316feb},'attributes':['name']}});};exports['getVariableById']=function(_0x17077b){return request(_0x5335('0x14'),{'options':{'where':{'id':_0x17077b},'attributes':[_0x5335('0xf')]}});};exports[_0x5335('0x15')]=function(_0x4b71e0){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x4b71e0},'attributes':[_0x5335('0x16')]}});};exports[_0x5335('0x17')]=function(_0x35d76c){return request(_0x5335('0x18'),{'options':{'where':{'id':_0x35d76c},'attributes':[_0x5335('0xf')]}});};exports[_0x5335('0x19')]=function(_0x4e2f6a){return request(_0x5335('0x1a'),{'options':{'where':{'id':_0x4e2f6a},'attributes':[_0x5335('0xf')]}});};exports[_0x5335('0x1b')]=function(_0x23e8b5){return request('ShowSound',{'options':{'where':{'id':_0x23e8b5},'attributes':['save_name']}});};exports[_0x5335('0x1c')]=function(_0x5e1fa9){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x5e1fa9},'include':[{'model':_0x5335('0x1d'),'as':_0x5335('0x1e')}]}});};exports[_0x5335('0x1f')]=function(_0x269a0b){return request(_0x5335('0x20'),{'options':{'where':{'id':_0x269a0b},'attributes':['id',_0x5335('0xf')]}});};exports['createSmsMessage']=function(_0x20257b){return request('CreateSmsMessage',{'body':_0x20257b});};exports['createSquareDetailsReport']=function(_0x428b4f){return request(_0x5335('0x21'),{'body':_0x428b4f});};exports['createSquareReport']=function(_0x105070){return request(_0x5335('0x22'),{'body':_[_0x5335('0x23')](_0x105070,{'project_name':_0x105070[_0x5335('0x24')],'prev_project_name':_0x105070[_0x5335('0x25')]||'','is_subproject':_0x105070[_0x5335('0x25')]?!![]:![],'leaveAt':moment()[_0x5335('0x26')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x5335('0x27')]=function(_0x3a8e4d){return request(_0x5335('0x28'),{'body':_0x3a8e4d});};exports[_0x5335('0x29')]=function(_0x3af1f1){return request(_0x5335('0x2a'),{'body':_0x3af1f1});};exports[_0x5335('0x2b')]=function(_0x387ab5){return request(_0x5335('0x2c'),{'options':{'raw':![],'where':{'phone':_0x387ab5[_0x5335('0x2d')],'ListId':_0x387ab5[_0x5335('0x2e')]}}})[_0x5335('0x2f')](function(_0x7cbbd1){if(_0x7cbbd1){return _0x7cbbd1;}return request('CreateCmContact',{'body':_0x387ab5});});};exports[_0x5335('0x30')]=function(_0x17120c){return request(_0x5335('0x31'),{'options':{'where':{'id':_0x17120c},'attributes':['name']}});};exports[_0x5335('0x32')]=function(_0x2c4cbd,_0x4bddad){return request('LoginUser',{'body':{'interface':_0x4bddad},'options':{'where':_0x2c4cbd}});};exports[_0x5335('0x33')]=function(_0x26f346,_0x556535,_0x3958fd){return request('PauseUser',{'body':{'type':_0x556535,'uniqueid':_0x3958fd},'options':{'where':_0x26f346}});};exports[_0x5335('0x34')]=function(_0x238f0a){return request(_0x5335('0x35'),{'body':{},'options':{'where':_0x238f0a}});};exports[_0x5335('0x36')]=function(_0x155690){return request(_0x5335('0x37'),{'body':{},'options':{'where':_0x155690}});}; \ 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 ef91893..019d19d 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 _0x3981=['./polly','exports'];(function(_0x3bd1bc,_0x4f1169){var _0x410fa1=function(_0x40c5e4){while(--_0x40c5e4){_0x3bd1bc['push'](_0x3bd1bc['shift']());}};_0x410fa1(++_0x4f1169);}(_0x3981,0x144));var _0x1398=function(_0x4eb7b4,_0x1a0743){_0x4eb7b4=_0x4eb7b4-0x0;var _0x24393c=_0x3981[_0x4eb7b4];return _0x24393c;};var polly=require(_0x1398('0x0'));var lex=require('./lex');module[_0x1398('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x10dc=['./lex','./polly'];(function(_0x9665c7,_0x875a04){var _0x1b3509=function(_0x5b653b){while(--_0x5b653b){_0x9665c7['push'](_0x9665c7['shift']());}};_0x1b3509(++_0x875a04);}(_0x10dc,0x107));var _0xc10d=function(_0x459baf,_0x332707){_0x459baf=_0x459baf-0x0;var _0x4a5970=_0x10dc[_0x459baf];return _0x4a5970;};var polly=require(_0xc10d('0x0'));var lex=require(_0xc10d('0x1'));module['exports']={'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 bea396e..92cf404 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 _0x0bb5=['./lib/api','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x0bb5,0x148));var _0x50bb=function(_0x26380b,_0x112ff8){_0x26380b=_0x26380b-0x0;var _0x43f180=_0x0bb5[_0x26380b];return _0x43f180;};'use strict';var lex=require(_0x50bb('0x0'));module[_0x50bb('0x1')]=function(_0x5e61cf,_0x5a12b6,_0x348380,_0x1aaa37,_0x6b7575,_0x117e36){return lex(_0x5e61cf,_0x5a12b6,_0x348380,_0x1aaa37,_0x6b7575,_0x117e36);}; \ No newline at end of file +var _0x9bde=['exports'];(function(_0x1b0a46,_0x285281){var _0x6d9311=function(_0x28aa4f){while(--_0x28aa4f){_0x1b0a46['push'](_0x1b0a46['shift']());}};_0x6d9311(++_0x285281);}(_0x9bde,0xe1));var _0xe9bd=function(_0x559fd2,_0x1d1f37){_0x559fd2=_0x559fd2-0x0;var _0xea977=_0x9bde[_0x559fd2];return _0xea977;};'use strict';var lex=require('./lib/api');module[_0xe9bd('0x0')]=function(_0x4defda,_0xc79e0b,_0x4c63ca,_0x51786f,_0x3005aa,_0x131f6a){return lex(_0x4defda,_0xc79e0b,_0x4c63ca,_0x51786f,_0x3005aa,_0x131f6a);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 06516e4..0c18f85 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(_0x2d7972,_0x57f968){var _0x296318=function(_0x126bc9){while(--_0x126bc9){_0x2d7972['push'](_0x2d7972['shift']());}};_0x296318(++_0x57f968);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x9d2783,_0x199a01){var _0x26400c=function(_0x360753){while(--_0x360753){_0x9d2783['push'](_0x9d2783['shift']());}};_0x26400c(++_0x199a01);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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 da2c958..96151b2 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 _0x443f=['./lib/api','exports'];(function(_0x385603,_0x1cf762){var _0x2e10ca=function(_0x1824c0){while(--_0x1824c0){_0x385603['push'](_0x385603['shift']());}};_0x2e10ca(++_0x1cf762);}(_0x443f,0x72));var _0xf443=function(_0x15add1,_0x410d97){_0x15add1=_0x15add1-0x0;var _0x5d7f3f=_0x443f[_0x15add1];return _0x5d7f3f;};'use strict';var polly=require(_0xf443('0x0'));module[_0xf443('0x1')]=function(_0x4f9e39,_0x8caa9f,_0x1fb117,_0x32639e,_0x2cb709,_0x3535fc,_0x4b72ea){return polly(_0x4f9e39,_0x8caa9f,_0x1fb117,_0x32639e,_0x2cb709,_0x3535fc,_0x4b72ea);}; \ No newline at end of file +var _0xf7ea=['exports','./lib/api'];(function(_0x2f8530,_0x5cbd67){var _0x5e814e=function(_0x490b29){while(--_0x490b29){_0x2f8530['push'](_0x2f8530['shift']());}};_0x5e814e(++_0x5cbd67);}(_0xf7ea,0x11b));var _0xaf7e=function(_0x3d72fd,_0x10d167){_0x3d72fd=_0x3d72fd-0x0;var _0x381c7c=_0xf7ea[_0x3d72fd];return _0x381c7c;};'use strict';var polly=require(_0xaf7e('0x0'));module[_0xaf7e('0x1')]=function(_0x3e5a61,_0x13df95,_0x200171,_0x4966bf,_0x5a4cfc,_0x29416f,_0x496d09){return polly(_0x3e5a61,_0x13df95,_0x200171,_0x4966bf,_0x5a4cfc,_0x29416f,_0x496d09);}; \ 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 b6bcce6..b2f7b11 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 _0x1236=['bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','path'];(function(_0x1e87af,_0x5695dd){var _0x51ce67=function(_0x3c815a){while(--_0x3c815a){_0x1e87af['push'](_0x1e87af['shift']());}};_0x51ce67(++_0x5695dd);}(_0x1236,0x11f));var _0x6123=function(_0x1d06de,_0x48c7bd){_0x1d06de=_0x1d06de-0x0;var _0x1b6f44=_0x1236[_0x1d06de];return _0x1b6f44;};'use strict';var fs=require('fs');var path=require(_0x6123('0x0'));var BPromise=require(_0x6123('0x1'));var rs=require(_0x6123('0x2'));var AWS=require(_0x6123('0x3'));function pollyResult(_0x225914,_0x3f5795,_0x17ca2d){return new BPromise(function(_0x115bfd,_0x35f5b9){_0x225914[_0x6123('0x4')](_0x3f5795,function(_0x1a261e,_0x4584b1){if(_0x1a261e){_0x35f5b9(_0x1a261e);}else if(_0x4584b1){if(_0x4584b1[_0x6123('0x5')]instanceof Buffer){fs[_0x6123('0x6')](_0x17ca2d,_0x4584b1[_0x6123('0x5')],function(_0x1c93ac){if(_0x1c93ac){_0x35f5b9(_0x1c93ac);}else{_0x115bfd();}});}else{_0x35f5b9(new Error(_0x6123('0x7')));}}else{_0x35f5b9(new Error(_0x6123('0x8')));}});});}module[_0x6123('0x9')]=function(_0x1308bc,_0x6c292e,_0x36eaa3,_0x232da3,_0x535050,_0x40fc67,_0x2dc55a){var _0x758ec=new AWS[(_0x6123('0xa'))]({'accessKeyId':_0x1308bc,'secretAccessKey':_0x6c292e,'region':_0x36eaa3});var _0x1606ea={'Text':_0x535050,'TextType':_0x40fc67||_0x6123('0xb'),'OutputFormat':'mp3','VoiceId':_0x232da3};return pollyResult(_0x758ec,_0x1606ea,_0x2dc55a);}; \ No newline at end of file +var _0x88f7=['aws-sdk','synthesizeSpeech','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','text','mp3','path'];(function(_0x30349f,_0x3725cb){var _0x388471=function(_0x14f781){while(--_0x14f781){_0x30349f['push'](_0x30349f['shift']());}};_0x388471(++_0x3725cb);}(_0x88f7,0x117));var _0x788f=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x88f7[_0x21549c];return _0x426cbd;};'use strict';var fs=require('fs');var path=require(_0x788f('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var AWS=require(_0x788f('0x1'));function pollyResult(_0xe62d37,_0x5082d8,_0x123e9f){return new BPromise(function(_0x33c8c5,_0x158a34){_0xe62d37[_0x788f('0x2')](_0x5082d8,function(_0x2bc5ef,_0x5eabae){if(_0x2bc5ef){_0x158a34(_0x2bc5ef);}else if(_0x5eabae){if(_0x5eabae['AudioStream']instanceof Buffer){fs[_0x788f('0x3')](_0x123e9f,_0x5eabae['AudioStream'],function(_0x4ef21f){if(_0x4ef21f){_0x158a34(_0x4ef21f);}else{_0x33c8c5();}});}else{_0x158a34(new Error(_0x788f('0x4')));}}else{_0x158a34(new Error(_0x788f('0x5')));}});});}module['exports']=function(_0x14c825,_0x453dd9,_0x147eb8,_0x51394c,_0x5b5393,_0x6b7f45,_0x3b2255){var _0x214c72=new AWS['Polly']({'accessKeyId':_0x14c825,'secretAccessKey':_0x453dd9,'region':_0x147eb8});var _0x17a238={'Text':_0x5b5393,'TextType':_0x6b7f45||_0x788f('0x6'),'OutputFormat':_0x788f('0x7'),'VoiceId':_0x51394c};return pollyResult(_0x214c72,_0x17a238,_0x3b2255);}; \ 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 78c3208..a9d2539 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 _0x5a1d=['exports','./lib/api'];(function(_0x5e8b7e,_0x258072){var _0x19d445=function(_0xf028e8){while(--_0xf028e8){_0x5e8b7e['push'](_0x5e8b7e['shift']());}};_0x19d445(++_0x258072);}(_0x5a1d,0x1b1));var _0xd5a1=function(_0x51c250,_0x3e7528){_0x51c250=_0x51c250-0x0;var _0xc5ba72=_0x5a1d[_0x51c250];return _0xc5ba72;};'use strict';var asr=require(_0xd5a1('0x0'));module[_0xd5a1('0x1')]=function(_0x3bd67d,_0xdff785,_0x1770d0,_0x8390ce){return asr(_0x3bd67d,_0xdff785,_0x1770d0);}; \ No newline at end of file +'use strict';var asr=require('./lib/api');module['exports']=function(_0x60c58b,_0x229915,_0x304815,_0x5d1c78){return asr(_0x60c58b,_0x229915,_0x304815);}; \ 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 790ea9c..ea09889 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 _0xe13a=['exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','8000','bluebird','https://speech.googleapis.com'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0xe13a,0x178));var _0xae13=function(_0x1ada70,_0x11c0a1){_0x1ada70=_0x1ada70-0x0;var _0x4ae274=_0xe13a[_0x1ada70];return _0x4ae274;};'use strict';var url=require('url');var BPromise=require(_0xae13('0x0'));var fs=require('fs');var host=_0xae13('0x1');module[_0xae13('0x2')]=function(_0x6066c0,_0x4cf961,_0x3aaf90){return new BPromise(function(_0x6840ca,_0x3ebbfe){var _0x10abd7;if(typeof _0x6066c0!==_0xae13('0x3')||_0x6066c0[_0xae13('0x4')]===0x0){return _0x3ebbfe(_0xae13('0x5'));}if(typeof _0x4cf961!==_0xae13('0x3')||_0x4cf961[_0xae13('0x4')]===0x0){return _0x3ebbfe('key\x20should\x20be\x20a\x20string');}if(typeof _0x3aaf90!==_0xae13('0x6')&&(typeof _0x3aaf90!==_0xae13('0x3')||_0x3aaf90[_0xae13('0x4')]===0x0)){return _0x3ebbfe(_0xae13('0x7'));}try{_0x10abd7=fs[_0xae13('0x8')](_0x6066c0)[_0xae13('0x9')](_0xae13('0xa'));}catch(_0x2d1149){return _0x3ebbfe(_0x2d1149);}return _0x6840ca({'method':_0xae13('0xb'),'uri':host+'/v1/speech:recognize?key='+_0x4cf961,'body':{'config':{'encoding':_0xae13('0xc'),'sampleRateHertz':_0xae13('0xd'),'languageCode':_0x3aaf90},'audio':{'content':_0x10abd7}},'json':!![]});});}; \ No newline at end of file +var _0x9aea=['toString','base64','POST','/v1/speech:recognize?key=','8000','url','https://speech.googleapis.com','string','length','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x9aea,0xdd));var _0xa9ae=function(_0x5ac8cf,_0x260b3a){_0x5ac8cf=_0x5ac8cf-0x0;var _0x59ea1e=_0x9aea[_0x5ac8cf];return _0x59ea1e;};'use strict';var url=require(_0xa9ae('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host=_0xa9ae('0x1');module['exports']=function(_0x2b5e0c,_0x13679e,_0x563a24){return new BPromise(function(_0x414638,_0x115593){var _0x41fb71;if(typeof _0x2b5e0c!==_0xa9ae('0x2')||_0x2b5e0c[_0xa9ae('0x3')]===0x0){return _0x115593('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x13679e!==_0xa9ae('0x2')||_0x13679e[_0xa9ae('0x3')]===0x0){return _0x115593(_0xa9ae('0x4'));}if(typeof _0x563a24!=='undefined'&&(typeof _0x563a24!==_0xa9ae('0x2')||_0x563a24[_0xa9ae('0x3')]===0x0)){return _0x115593(_0xa9ae('0x5'));}try{_0x41fb71=fs[_0xa9ae('0x6')](_0x2b5e0c)[_0xa9ae('0x7')](_0xa9ae('0x8'));}catch(_0x1816c2){return _0x115593(_0x1816c2);}return _0x414638({'method':_0xa9ae('0x9'),'uri':host+_0xa9ae('0xa')+_0x13679e,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xa9ae('0xb'),'languageCode':_0x563a24},'audio':{'content':_0x41fb71}},'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 64eeee7..d1de2c1 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 _0x840a=['exports','./asr'];(function(_0x48e209,_0x226218){var _0xf94d86=function(_0x44ef6b){while(--_0x44ef6b){_0x48e209['push'](_0x48e209['shift']());}};_0xf94d86(++_0x226218);}(_0x840a,0x17f));var _0xa840=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x840a[_0x321bb2];return _0x9c12ed;};var asr=require(_0xa840('0x0'));module[_0xa840('0x1')]={'asr':asr}; \ No newline at end of file +var _0xe1cd=['exports','./asr'];(function(_0x5046eb,_0x3d985e){var _0x75bdd4=function(_0x3b3aab){while(--_0x3b3aab){_0x5046eb['push'](_0x5046eb['shift']());}};_0x75bdd4(++_0x3d985e);}(_0xe1cd,0x6d));var _0xde1c=function(_0x4bd869,_0x1515bd){_0x4bd869=_0x4bd869-0x0;var _0x40c561=_0xe1cd[_0x4bd869];return _0x40c561;};var asr=require(_0xde1c('0x0'));module[_0xde1c('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 e758a63..2c19b59 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 _0x0900=['CustomActionData','AudioFromTts','Data','dirName','dialogflow','http','https','md5','querystring','request-promise','sox','google-tts-api','url','parse','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','path','WHAT_EVER','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','error','unlink','download\x20error','end','transcode','wav','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','777','split','readFileSync','googleCloudTTS','?key=','input','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','jQ1olc','null','generic','slice','data','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','message','textRequest','result','source','resolvedQuery','fulfillment','status','endConversation','metadata','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','name','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction'];(function(_0x1a485a,_0x1d1114){var _0x3f74b5=function(_0xd21a59){while(--_0xd21a59){_0x1a485a['push'](_0x1a485a['shift']());}};_0x3f74b5(++_0x1d1114);}(_0x0900,0x11e));var _0x0090=function(_0x1d1162,_0x5b2464){_0x1d1162=_0x1d1162-0x0;var _0x2da1f0=_0x0900[_0x1d1162];return _0x2da1f0;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0x0090('0x0'));var fs=require('fs');var http=require(_0x0090('0x1'));var https=require(_0x0090('0x2'));var md5=require(_0x0090('0x3'));var path=require('path');var querystring=require(_0x0090('0x4'));var rp=require(_0x0090('0x5'));var rs=require('randomstring');var sox=require(_0x0090('0x6'));var tts=require(_0x0090('0x7'));var urlParse=require(_0x0090('0x8'))[_0x0090('0x9')];var util=require('util');var aws=require(_0x0090('0xa'));var google=require(_0x0090('0xb'));var sestek=require(_0x0090('0xc'));var tilde=require(_0x0090('0xd'));var logger=require(_0x0090('0xe'))(_0x0090('0xf'));var ISPEECH_API=_0x0090('0x10');function downloadFile(_0x36209c,_0x3339f3){return new BPromise(function(_0x1e8a51,_0x56890b){var _0x3f4e30=urlParse(_0x36209c);var _0x40a9cb=_0x3f4e30[_0x0090('0x11')]===_0x0090('0x12')?https:http;var _0x334be3={'host':_0x3f4e30[_0x0090('0x13')],'path':_0x3f4e30[_0x0090('0x14')],'headers':{'user-agent':_0x0090('0x15')}};_0x40a9cb[_0x0090('0x16')](_0x334be3,function(_0x3820a7){if(_0x3820a7['statusCode']!==0xc8){logger['error'](_0x0090('0x17')+_0x36209c+_0x0090('0x18')+_0x3820a7[_0x0090('0x19')]+'\x20('+_0x3820a7[_0x0090('0x1a')]+')');_0x56890b(new Error(_0x0090('0x17')+_0x36209c+'\x20failed,\x20status\x20code\x20=\x20'+_0x3820a7[_0x0090('0x19')]+'\x20('+_0x3820a7[_0x0090('0x1a')]+')'));return;}var _0x2267ed=fs[_0x0090('0x1b')](_0x3339f3);_0x2267ed['on'](_0x0090('0x1c'),function(){logger[_0x0090('0x1d')](_0x0090('0x1e'));_0x2267ed[_0x0090('0x1f')](_0x1e8a51);});_0x2267ed['on'](_0x0090('0x20'),function(_0x4f0d1e){fs[_0x0090('0x21')](_0x3339f3);logger[_0x0090('0x20')](_0x0090('0x22'),_0x4f0d1e);_0x56890b(_0x4f0d1e);});_0x3820a7['pipe'](_0x2267ed);})['on'](_0x0090('0x20'),function(_0x577b3a){logger[_0x0090('0x20')](_0x577b3a);_0x56890b(_0x577b3a);})[_0x0090('0x23')]();});}function uploadFile(_0x59ab2b){return new BPromise(function(_0x3a9eff,_0x5f202f){var _0x47db71=urlParse(_0x59ab2b);var _0x1ca7c4=_0x47db71[_0x0090('0x11')]===_0x0090('0x12')?https:http;var _0x1adbf8={'host':_0x47db71['host'],'path':_0x47db71['path'],'headers':{'user-agent':_0x0090('0x15')}};_0x1ca7c4[_0x0090('0x16')](_0x1adbf8,function(_0x192a7e){if(_0x192a7e[_0x0090('0x19')]!==0xc8){_0x5f202f(new Error(_0x0090('0x17')+_0x59ab2b+_0x0090('0x18')+_0x192a7e['statusCode']+'\x20('+_0x192a7e[_0x0090('0x1a')]+')'));return;}var _0x1a69ca='';_0x192a7e['on']('data',function(_0x49b2ff){_0x1a69ca+=_0x49b2ff;});_0x192a7e['on'](_0x0090('0x23'),function(){_0x3a9eff(_0x1a69ca);});})['on'](_0x0090('0x20'),function(_0x541e06){_0x5f202f(_0x541e06);})[_0x0090('0x23')]();});}function convertFile(_0x2a3e94,_0x5de5a8){return new BPromise(function(_0x3a6b6a,_0x260ba7){var _0x50f552=sox[_0x0090('0x24')](_0x2a3e94,_0x5de5a8,{'sampleRate':0x1f40,'format':_0x0090('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x50f552['on'](_0x0090('0x20'),function(_0xf35e40){logger[_0x0090('0x20')]('error\x20convert',_0xf35e40);_0x260ba7(_0xf35e40);});_0x50f552['on']('end',function(){logger[_0x0090('0x1d')](_0x0090('0x26'));_0x3a6b6a();});_0x50f552[_0x0090('0x27')]();});}function base64Decode(_0x5d19ec,_0x2f68c0){var _0x1af607=path[_0x0090('0x28')](__dirname,_0x0090('0x29'),rs[_0x0090('0x2a')](0x4)+_0x0090('0x2b'));fs[_0x0090('0x2c')](_0x1af607,_0x5d19ec,_0x0090('0x2d'));return convertFile(_0x1af607,_0x2f68c0)[_0x0090('0x2e')](function(){try{fs[_0x0090('0x21')](_0x1af607);fs['chmodSync'](_0x2f68c0,_0x0090('0x2f'));}catch(_0x561ad8){logger[_0x0090('0x20')](_0x561ad8);}return _0x2f68c0[_0x0090('0x30')]('.')[0x0];});}function base64Encode(_0x401d4f){var _0x27666e=fs[_0x0090('0x31')](_0x401d4f);return new Buffer(_0x27666e)['toString']('base64');}exports[_0x0090('0x32')]=function(_0x4f59cb,_0x5bd70a,_0x4eb6d8,_0x304880,_0x5039db,_0x2a7545){var _0x58aa75,_0x29222b;var _0x3644e0='https://texttospeech.googleapis.com/v1/';var _0xe128d4=_0x0090('0x33')+_0x4f59cb;var _0x3637c4={};if(_0x5bd70a==='ssml'){_0x3637c4[_0x0090('0x34')]={'ssml':_0x4eb6d8};}else{_0x3637c4['input']={'text':_0x4eb6d8};};_0x3637c4['voice']={'languageCode':_0x304880,'ssmlGender':_0x5039db};_0x3637c4[_0x0090('0x35')]={'audioEncoding':_0x0090('0x36'),'sampleRateHertz':0x1f40};var _0x273d75={'url':_0x3644e0+_0x0090('0x37')+_0xe128d4,'method':_0x0090('0x38'),'json':!![],'body':_0x3637c4};return rp(_0x273d75)[_0x0090('0x2e')](function(_0x3ef7d2){return new BPromise(function(_0x340296,_0x1cd8a9){_0x58aa75=path['resolve'](__dirname,_0x0090('0x29'),rs[_0x0090('0x2a')](0x4)+_0x0090('0x39'));var _0x47c04f=Buffer[_0x0090('0x3a')](_0x3ef7d2[_0x0090('0x3b')],_0x0090('0x2d'));return fs[_0x0090('0x3c')](_0x58aa75,_0x47c04f,function(_0x25f54a){_0x1cd8a9(_0x25f54a);},function(_0x2010df){fs[_0x0090('0x3d')](_0x58aa75,_0x0090('0x2f'));_0x340296(_0x2010df);});});})['then'](function(_0x20f18c){_0x29222b=path[_0x0090('0x28')](__dirname,_0x0090('0x29'),rs[_0x0090('0x2a')](0x4)+'.wav');return convertFile(_0x58aa75,_0x29222b);})[_0x0090('0x2e')](function(){try{fs['unlink'](_0x58aa75);fs[_0x0090('0x3d')](_0x29222b,'777');}catch(_0x1a3e7e){logger[_0x0090('0x20')](_0x1a3e7e);}logger['info'](_0x0090('0x3e'),_0x29222b[_0x0090('0x30')]('.')[0x0]);return _0x29222b['split']('.')[0x0];});};exports['googleTTS']=function(_0x1f3888,_0x546955){var _0x579aac=_0x0090('0x3f');var _0x59d6d4,_0x1972fb;var _0x2f5c23;var _0xdf566d={'encoding':_0x0090('0x40'),'method':_0x0090('0x38'),'timeout':0x2710,'url':_0x579aac,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x0090('0x41')+encodeURIComponent(JSON[_0x0090('0x42')]([[[_0x0090('0x43'),JSON['stringify']([_0x1f3888,_0x546955||'en',![],_0x0090('0x44')]),null,_0x0090('0x45')]]]))};return rp(_0xdf566d)['then'](function(_0x1d800b){try{_0x2f5c23=eval(_0x1d800b[_0x0090('0x46')](0x5))[0x0][0x2];}catch(_0x7e0d67){throw new Error('parse\x20response\x20failed:\x0a'+_0x1d800b[_0x0090('0x47')]);}if(!_0x2f5c23){if(_0x1f3888[_0x0090('0x48')]>0xc8){throw new Error(_0x0090('0x49'));}else{throw new Error(_0x0090('0x4a')+_0x546955+_0x0090('0x4b'));}}try{_0x2f5c23=eval(_0x2f5c23)[0x0];}catch(_0x3c67b0){throw new Error(_0x0090('0x4c')+res['data']);}const _0x15f5f1=_0x2f5c23;_0x59d6d4=path['resolve'](__dirname,_0x0090('0x29'),rs[_0x0090('0x2a')](0x4)+'.mp3');fs[_0x0090('0x2c')](_0x59d6d4,_0x2f5c23,{'encoding':_0x0090('0x2d')});_0x1972fb=path['resolve'](__dirname,_0x0090('0x29'),rs['generate'](0x4)+_0x0090('0x2b'));return convertFile(_0x59d6d4,_0x1972fb);})[_0x0090('0x2e')](function(){try{fs['unlink'](_0x59d6d4);fs[_0x0090('0x3d')](_0x1972fb,_0x0090('0x2f'));}catch(_0xa99ae5){logger[_0x0090('0x20')](_0xa99ae5);}logger[_0x0090('0x1d')](_0x0090('0x4d'),_0x1972fb[_0x0090('0x30')]('.')[0x0]);return _0x1972fb[_0x0090('0x30')]('.')[0x0];});};exports[_0x0090('0x4e')]=function(_0x4ded98,_0x53b8bc,_0x1be844){return google['asr'](_0x4ded98,_0x53b8bc,_0x1be844)[_0x0090('0x2e')](function(_0x3a259f){logger[_0x0090('0x1d')](_0x3a259f[_0x0090('0x4f')]);return rp(_0x3a259f);})[_0x0090('0x2e')](function(_0x4063aa){var _0x486fc6='';var _0x263e40=0x0;try{fs[_0x0090('0x21')](_0x4ded98);}catch(_0x2e3065){logger[_0x0090('0x20')](_0x2e3065);}if(_0x4063aa&&_0x4063aa[_0x0090('0x50')]){_0x486fc6=_0x4063aa[_0x0090('0x50')][_0x0090('0x51')](function(_0x18c90b){return _0x18c90b&&_0x18c90b[_0x0090('0x52')][0x0]&&_0x18c90b[_0x0090('0x52')][0x0][_0x0090('0x53')]?_0x18c90b[_0x0090('0x52')][0x0][_0x0090('0x53')]:'';})[_0x0090('0x54')]('\x0a');_0x263e40=_0x4063aa[_0x0090('0x50')][_0x0090('0x51')](function(_0xab74e5){return _0xab74e5&&_0xab74e5[_0x0090('0x52')][0x0]&&_0xab74e5['alternatives'][0x0][_0x0090('0x55')]?_0xab74e5[_0x0090('0x52')][0x0]['confidence']:0x0;})['join']('\x0a');}logger[_0x0090('0x1d')](_0x0090('0x56'),_0x486fc6);logger['info'](_0x0090('0x57'),_0x263e40);return{'transcript':_0x486fc6,'confidence':_0x263e40};})[_0x0090('0x58')](function(_0x468864){logger[_0x0090('0x20')]('[%s]\x20%s:%s',_0x468864[_0x0090('0x19')],_0x468864['name'],_0x468864[_0x0090('0x59')]);});};exports['googleDialogflow']=function(_0x4529ce,_0x55e529,_0x459ee2,_0x410e02){var _0x56b79f=apiai(_0x55e529,{'language':_0x410e02||'en'});return _0x56b79f[_0x0090('0x5a')](_0x459ee2,{'sessionId':md5(_0x4529ce)})[_0x0090('0x2e')](function(_0x488ab5){logger[_0x0090('0x1d')](JSON[_0x0090('0x42')](_0x488ab5));return{'source':_0x488ab5[_0x0090('0x5b')][_0x0090('0x5c')],'resolvedQuery':_0x488ab5['result'][_0x0090('0x5d')],'action':_0x488ab5[_0x0090('0x5b')]['action'],'actionIncomplete':_0x488ab5[_0x0090('0x5b')]['actionIncomplete'],'speech':_0x488ab5[_0x0090('0x5b')][_0x0090('0x5e')]['speech'],'score':_0x488ab5[_0x0090('0x5b')]['score'],'statusCode':_0x488ab5[_0x0090('0x5f')]['code'],'endConversation':_0x488ab5[_0x0090('0x5b')]['metadata'][_0x0090('0x60')]||![],'isFallbackIntent':_0x488ab5[_0x0090('0x5b')][_0x0090('0x61')]['isFallbackIntent']};});};exports[_0x0090('0x62')]=function(_0x266879,_0x2bb212,_0x5c0b80,_0x2f0fba,_0x3dccc2,_0xff9fc5){var _0x15e0c8=_0x2f0fba[_0x0090('0x63')](/\\n/g,'\x0a');var _0x5bec44={'credentials':{'private_key':_0x15e0c8,'client_email':_0x5c0b80}};var _0x4ca0a6=new dialogflow[(_0x0090('0x64'))](_0x5bec44);var _0x33b9fa=_0x4ca0a6[_0x0090('0x65')](_0x2bb212,md5(_0x266879));var _0x41e99e={'session':_0x33b9fa,'queryInput':{'text':{'text':_0x3dccc2,'languageCode':_0xff9fc5}}};return _0x4ca0a6[_0x0090('0x66')](_0x41e99e)[_0x0090('0x2e')](function(_0x4f1579){if(_0x4f1579&&_0x4f1579[_0x0090('0x48')]){logger[_0x0090('0x1d')](_0x0090('0x67'),JSON['stringify'](_0x4f1579));var _0x3a6a60=_0x4f1579[0x0];if(_0x3a6a60){var _0x2c1812={'action':_0x3a6a60[_0x0090('0x68')]['action'],'allRequiredParamsPresent':_0x3a6a60['queryResult'][_0x0090('0x69')],'endConversation':_0x3a6a60[_0x0090('0x68')][_0x0090('0x6a')]&&_0x3a6a60[_0x0090('0x68')]['diagnosticInfo']['fields']?_0x3a6a60[_0x0090('0x68')][_0x0090('0x6a')][_0x0090('0x6b')]['end_conversation'][_0x0090('0x6c')]:![],'fulfillmentText':_0x3a6a60[_0x0090('0x68')][_0x0090('0x6d')],'intentName':_0x3a6a60[_0x0090('0x68')][_0x0090('0x6e')][_0x0090('0x6f')],'intentDisplayName':_0x3a6a60[_0x0090('0x68')][_0x0090('0x6e')][_0x0090('0x70')],'isFallbackIntent':_0x3a6a60[_0x0090('0x68')]['intent']['isFallback'],'languageCode':_0x3a6a60[_0x0090('0x68')][_0x0090('0x71')],'queryText':_0x3a6a60[_0x0090('0x68')][_0x0090('0x72')],'responseId':_0x3a6a60[_0x0090('0x73')],'score':_0x3a6a60['queryResult'][_0x0090('0x74')],'speech':_0x3a6a60[_0x0090('0x68')][_0x0090('0x6d')],'providerResponse':JSON[_0x0090('0x42')](_0x4f1579)};return _0x2c1812;}}});};exports[_0x0090('0x75')]=function(_0x182511,_0x40edda,_0x49adfe,_0x1650a6){return tilde[_0x0090('0x76')](_0x182511,_0x40edda,_0x49adfe,_0x1650a6)['then'](function(_0x3b6045){try{fs['unlink'](_0x182511);}catch(_0x437466){logger[_0x0090('0x20')](_0x437466);}logger[_0x0090('0x1d')](_0x0090('0x77'),_0x3b6045['transcript']);logger[_0x0090('0x1d')](_0x0090('0x78'),_0x3b6045['confidence']);return _0x3b6045;});};exports[_0x0090('0x79')]=function(_0x53d1c7,_0x5b6314,_0x53fef1,_0x1c5c5d,_0x60a257,_0x49dfd2){var _0x278e84=path[_0x0090('0x28')](__dirname,_0x0090('0x29'),rs[_0x0090('0x2a')](0x4)+_0x0090('0x39'));var _0x5f3a01;return aws[_0x0090('0x7a')](_0x53d1c7,_0x5b6314,_0x53fef1,_0x1c5c5d,_0x60a257,_0x49dfd2,_0x278e84)[_0x0090('0x2e')](function(){_0x5f3a01=path[_0x0090('0x28')](__dirname,_0x0090('0x29'),rs[_0x0090('0x2a')](0x4)+'.wav');return convertFile(_0x278e84,_0x5f3a01);})[_0x0090('0x2e')](function(){try{fs[_0x0090('0x21')](_0x278e84);fs[_0x0090('0x3d')](_0x5f3a01,_0x0090('0x2f'));}catch(_0x448ddd){logger[_0x0090('0x20')](_0x448ddd);}return _0x5f3a01[_0x0090('0x30')]('.')[0x0];});};exports[_0x0090('0x7b')]=function(_0x51a78e,_0x48c507,_0x133532,_0x3c7e6c,_0x4d355b,_0x4be850){return aws[_0x0090('0x7c')](_0x51a78e,_0x48c507,_0x133532,_0x3c7e6c,_0x4d355b,_0x4be850)['then'](function(_0x41ca43){logger[_0x0090('0x1d')](JSON[_0x0090('0x42')](_0x41ca43));return _0x41ca43;});};exports[_0x0090('0x7d')]=function(_0x145b55,_0x5ba8dd,_0x3bfd1b,_0x225533){var _0x405abf=util[_0x0090('0x7e')](_0x0090('0x7f'),ISPEECH_API,_0x145b55,encodeURIComponent(_0x5ba8dd),_0x3bfd1b,_0x225533);var _0x4693a5=path[_0x0090('0x28')](__dirname,_0x0090('0x29'),rs[_0x0090('0x2a')](0x4)+_0x0090('0x39'));var _0x3d2123;return downloadFile(_0x405abf,_0x4693a5)[_0x0090('0x2e')](function(){_0x3d2123=path['resolve'](__dirname,_0x0090('0x29'),rs['generate'](0x4)+'.wav');return convertFile(_0x4693a5,_0x3d2123);})[_0x0090('0x2e')](function(){try{fs[_0x0090('0x21')](_0x4693a5);fs[_0x0090('0x3d')](_0x3d2123,'777');}catch(_0x503878){logger[_0x0090('0x20')](_0x503878);}return _0x3d2123['split']('.')[0x0];});};exports[_0x0090('0x80')]=function(_0x154c0a,_0x4f1c06,_0x18d826,_0x2851ff){var _0xf7c705=util[_0x0090('0x7e')](_0x0090('0x81'),ISPEECH_API,_0x4f1c06,_0x18d826,base64Encode(_0x154c0a),_0x2851ff?util['format'](_0x0090('0x82'),encodeURIComponent(_0x2851ff)):_0x0090('0x83'));return uploadFile(_0xf7c705)[_0x0090('0x2e')](function(_0x1e8286){return querystring[_0x0090('0x9')](_0x1e8286);});};exports[_0x0090('0x84')]=function(_0x1d558d,_0x541967){return sestek[_0x0090('0x85')](_0x1d558d,_0x541967)[_0x0090('0x2e')](function(_0x3c9d7a){logger['info'](JSON[_0x0090('0x42')](_0x3c9d7a));var _0x344078={'speech':_0x3c9d7a[_0x0090('0x86')],'action':_0x3c9d7a[_0x0090('0x87')]?_0x3c9d7a[_0x0090('0x87')][_0x0090('0x88')]:undefined,'actiondata':_0x3c9d7a[_0x0090('0x87')]?_0x3c9d7a[_0x0090('0x87')][_0x0090('0x89')]:undefined};if(_0x3c9d7a[_0x0090('0x87')]&&_0x3c9d7a['channelData'][_0x0090('0x8a')]){return base64Decode(_0x3c9d7a[_0x0090('0x87')]['AudioFromTts'][_0x0090('0x8b')],path[_0x0090('0x28')](__dirname,'tmp',rs[_0x0090('0x2a')](0x4)+_0x0090('0x2b')))[_0x0090('0x2e')](function(_0x5af2ad){_0x344078['audiofile']=_0x5af2ad;return _0x344078;});}return _0x344078;});};exports[_0x0090('0x8c')]=function(){return __dirname;}; \ No newline at end of file +var _0x193b=['bluebird','http','md5','path','querystring','request-promise','randomstring','google-tts-api','util','./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','WHAT_EVER','statusCode','statusMessage','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','finish\x20download\x20file','close','unlink','download\x20error','pipe','error','https:','host','get','data','end','transcode','wav','error\x20convert','start','resolve','.wav','writeFileSync','chmodSync','split','readFileSync','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','voice','audioConfig','MP3','POST','then','tmp','generate','.mp3','from','777','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','info','goggleTTS\x20path','googleASR','asr','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','freeform=3','parse','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName'];(function(_0x5848f0,_0x702c4f){var _0x1e7428=function(_0x524f42){while(--_0x524f42){_0x5848f0['push'](_0x5848f0['shift']());}};_0x1e7428(++_0x702c4f);}(_0x193b,0x85));var _0xb193=function(_0xcbb8db,_0x1f0a12){_0xcbb8db=_0xcbb8db-0x0;var _0x2fdcac=_0x193b[_0xcbb8db];return _0x2fdcac;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xb193('0x0'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0xb193('0x1'));var https=require('https');var md5=require(_0xb193('0x2'));var path=require(_0xb193('0x3'));var querystring=require(_0xb193('0x4'));var rp=require(_0xb193('0x5'));var rs=require(_0xb193('0x6'));var sox=require('sox');var tts=require(_0xb193('0x7'));var urlParse=require('url')['parse'];var util=require(_0xb193('0x8'));var aws=require(_0xb193('0x9'));var google=require(_0xb193('0xa'));var sestek=require(_0xb193('0xb'));var tilde=require(_0xb193('0xc'));var logger=require(_0xb193('0xd'))('agi');var ISPEECH_API=_0xb193('0xe');function downloadFile(_0x5a4e7a,_0x351d76){return new BPromise(function(_0x479884,_0x125292){var _0x6347e0=urlParse(_0x5a4e7a);var _0x3c3833=_0x6347e0[_0xb193('0xf')]==='https:'?https:http;var _0x5486f6={'host':_0x6347e0['host'],'path':_0x6347e0[_0xb193('0x3')],'headers':{'user-agent':_0xb193('0x10')}};_0x3c3833['get'](_0x5486f6,function(_0x285206){if(_0x285206[_0xb193('0x11')]!==0xc8){logger['error']('request\x20to\x20'+_0x5a4e7a+'\x20failed,\x20status\x20code\x20=\x20'+_0x285206[_0xb193('0x11')]+'\x20('+_0x285206[_0xb193('0x12')]+')');_0x125292(new Error(_0xb193('0x13')+_0x5a4e7a+_0xb193('0x14')+_0x285206['statusCode']+'\x20('+_0x285206[_0xb193('0x12')]+')'));return;}var _0x1e4ef1=fs[_0xb193('0x15')](_0x351d76);_0x1e4ef1['on'](_0xb193('0x16'),function(){logger['info'](_0xb193('0x17'));_0x1e4ef1[_0xb193('0x18')](_0x479884);});_0x1e4ef1['on']('error',function(_0x2d3773){fs[_0xb193('0x19')](_0x351d76);logger['error'](_0xb193('0x1a'),_0x2d3773);_0x125292(_0x2d3773);});_0x285206[_0xb193('0x1b')](_0x1e4ef1);})['on'](_0xb193('0x1c'),function(_0x53475b){logger[_0xb193('0x1c')](_0x53475b);_0x125292(_0x53475b);})['end']();});}function uploadFile(_0xe7d2df){return new BPromise(function(_0x1fa2ac,_0x3ff389){var _0x3aa978=urlParse(_0xe7d2df);var _0x2df234=_0x3aa978[_0xb193('0xf')]===_0xb193('0x1d')?https:http;var _0x414316={'host':_0x3aa978[_0xb193('0x1e')],'path':_0x3aa978[_0xb193('0x3')],'headers':{'user-agent':_0xb193('0x10')}};_0x2df234[_0xb193('0x1f')](_0x414316,function(_0x42f640){if(_0x42f640[_0xb193('0x11')]!==0xc8){_0x3ff389(new Error(_0xb193('0x13')+_0xe7d2df+_0xb193('0x14')+_0x42f640[_0xb193('0x11')]+'\x20('+_0x42f640['statusMessage']+')'));return;}var _0x3465db='';_0x42f640['on'](_0xb193('0x20'),function(_0x3cd16c){_0x3465db+=_0x3cd16c;});_0x42f640['on'](_0xb193('0x21'),function(){_0x1fa2ac(_0x3465db);});})['on'](_0xb193('0x1c'),function(_0xc03c17){_0x3ff389(_0xc03c17);})['end']();});}function convertFile(_0x388b7b,_0x12ae18){return new BPromise(function(_0x1aef77,_0x359099){var _0x2bed56=sox[_0xb193('0x22')](_0x388b7b,_0x12ae18,{'sampleRate':0x1f40,'format':_0xb193('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2bed56['on']('error',function(_0x3df9a8){logger['error'](_0xb193('0x24'),_0x3df9a8);_0x359099(_0x3df9a8);});_0x2bed56['on'](_0xb193('0x21'),function(){logger['info']('finish\x20to\x20convert');_0x1aef77();});_0x2bed56[_0xb193('0x25')]();});}function base64Decode(_0x2e9ccc,_0xfb0d5){var _0x33b499=path[_0xb193('0x26')](__dirname,'tmp',rs['generate'](0x4)+_0xb193('0x27'));fs[_0xb193('0x28')](_0x33b499,_0x2e9ccc,'base64');return convertFile(_0x33b499,_0xfb0d5)['then'](function(){try{fs['unlink'](_0x33b499);fs[_0xb193('0x29')](_0xfb0d5,'777');}catch(_0x4178bd){logger[_0xb193('0x1c')](_0x4178bd);}return _0xfb0d5[_0xb193('0x2a')]('.')[0x0];});}function base64Encode(_0x44bd86){var _0xfa1c02=fs[_0xb193('0x2b')](_0x44bd86);return new Buffer(_0xfa1c02)['toString'](_0xb193('0x2c'));}exports[_0xb193('0x2d')]=function(_0x468c02,_0x3db738,_0x3503af,_0x34ecc9,_0x52f2df,_0x2b20cc){var _0x77c6fb,_0x163711;var _0x193e24=_0xb193('0x2e');var _0x12d1d2=_0xb193('0x2f')+_0x468c02;var _0x10e782={};if(_0x3db738===_0xb193('0x30')){_0x10e782['input']={'ssml':_0x3503af};}else{_0x10e782['input']={'text':_0x3503af};};_0x10e782[_0xb193('0x31')]={'languageCode':_0x34ecc9,'ssmlGender':_0x52f2df};_0x10e782[_0xb193('0x32')]={'audioEncoding':_0xb193('0x33'),'sampleRateHertz':0x1f40};var _0x2d24d0={'url':_0x193e24+'text:synthesize'+_0x12d1d2,'method':_0xb193('0x34'),'json':!![],'body':_0x10e782};return rp(_0x2d24d0)[_0xb193('0x35')](function(_0x488930){return new BPromise(function(_0x2421a8,_0x11ac98){_0x77c6fb=path[_0xb193('0x26')](__dirname,_0xb193('0x36'),rs[_0xb193('0x37')](0x4)+_0xb193('0x38'));var _0x3f7a89=Buffer[_0xb193('0x39')](_0x488930['audioContent'],_0xb193('0x2c'));return fs['writeFile'](_0x77c6fb,_0x3f7a89,function(_0x53a198){_0x11ac98(_0x53a198);},function(_0x5be006){fs[_0xb193('0x29')](_0x77c6fb,_0xb193('0x3a'));_0x2421a8(_0x5be006);});});})[_0xb193('0x35')](function(_0x5b6910){_0x163711=path[_0xb193('0x26')](__dirname,_0xb193('0x36'),rs[_0xb193('0x37')](0x4)+_0xb193('0x27'));return convertFile(_0x77c6fb,_0x163711);})[_0xb193('0x35')](function(){try{fs['unlink'](_0x77c6fb);fs['chmodSync'](_0x163711,'777');}catch(_0xf88700){logger[_0xb193('0x1c')](_0xf88700);}logger['info'](_0xb193('0x3b'),_0x163711[_0xb193('0x2a')]('.')[0x0]);return _0x163711['split']('.')[0x0];});};exports[_0xb193('0x3c')]=function(_0x3134da,_0x3688e2){var _0x549e1e=_0xb193('0x3d');var _0x324c8a,_0xb7f769;var _0x1729bf;var _0x10d3ad={'encoding':_0xb193('0x3e'),'method':_0xb193('0x34'),'timeout':0x2710,'url':_0x549e1e,'headers':{'Content-Type':_0xb193('0x3f')},'body':_0xb193('0x40')+encodeURIComponent(JSON[_0xb193('0x41')]([[['jQ1olc',JSON['stringify']([_0x3134da,_0x3688e2||'en',![],_0xb193('0x42')]),null,_0xb193('0x43')]]]))};return rp(_0x10d3ad)[_0xb193('0x35')](function(_0x34bbcc){try{_0x1729bf=eval(_0x34bbcc['slice'](0x5))[0x0][0x2];}catch(_0x261ffa){throw new Error(_0xb193('0x44')+_0x34bbcc['data']);}if(!_0x1729bf){if(_0x3134da[_0xb193('0x45')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xb193('0x46')+_0x3688e2+_0xb193('0x47'));}}try{_0x1729bf=eval(_0x1729bf)[0x0];}catch(_0xa45a31){throw new Error(_0xb193('0x44')+res[_0xb193('0x20')]);}const _0x1a05f7=_0x1729bf;_0x324c8a=path[_0xb193('0x26')](__dirname,_0xb193('0x36'),rs[_0xb193('0x37')](0x4)+'.mp3');fs[_0xb193('0x28')](_0x324c8a,_0x1729bf,{'encoding':_0xb193('0x2c')});_0xb7f769=path[_0xb193('0x26')](__dirname,_0xb193('0x36'),rs[_0xb193('0x37')](0x4)+'.wav');return convertFile(_0x324c8a,_0xb7f769);})[_0xb193('0x35')](function(){try{fs[_0xb193('0x19')](_0x324c8a);fs[_0xb193('0x29')](_0xb7f769,'777');}catch(_0x1ee805){logger[_0xb193('0x1c')](_0x1ee805);}logger[_0xb193('0x48')](_0xb193('0x49'),_0xb7f769['split']('.')[0x0]);return _0xb7f769[_0xb193('0x2a')]('.')[0x0];});};exports[_0xb193('0x4a')]=function(_0x205096,_0xaac5a,_0x188c99){return google[_0xb193('0x4b')](_0x205096,_0xaac5a,_0x188c99)[_0xb193('0x35')](function(_0x254f70){logger['info'](_0x254f70['uri']);return rp(_0x254f70);})[_0xb193('0x35')](function(_0x260228){var _0xb17d49='';var _0x9b5b45=0x0;try{fs[_0xb193('0x19')](_0x205096);}catch(_0x335bb8){logger['error'](_0x335bb8);}if(_0x260228&&_0x260228[_0xb193('0x4c')]){_0xb17d49=_0x260228[_0xb193('0x4c')]['map'](function(_0x2a0d4f){return _0x2a0d4f&&_0x2a0d4f[_0xb193('0x4d')][0x0]&&_0x2a0d4f[_0xb193('0x4d')][0x0]['transcript']?_0x2a0d4f['alternatives'][0x0][_0xb193('0x4e')]:'';})[_0xb193('0x4f')]('\x0a');_0x9b5b45=_0x260228['results'][_0xb193('0x50')](function(_0x51b613){return _0x51b613&&_0x51b613[_0xb193('0x4d')][0x0]&&_0x51b613['alternatives'][0x0]['confidence']?_0x51b613['alternatives'][0x0][_0xb193('0x51')]:0x0;})[_0xb193('0x4f')]('\x0a');}logger[_0xb193('0x48')](_0xb193('0x52'),_0xb17d49);logger[_0xb193('0x48')]('googleASR\x20confidence',_0x9b5b45);return{'transcript':_0xb17d49,'confidence':_0x9b5b45};})[_0xb193('0x53')](function(_0x16dad9){logger[_0xb193('0x1c')](_0xb193('0x54'),_0x16dad9[_0xb193('0x11')],_0x16dad9[_0xb193('0x55')],_0x16dad9[_0xb193('0x56')]);});};exports[_0xb193('0x57')]=function(_0x34c348,_0x4e9b9f,_0x3cf014,_0x191cb6){var _0x32aeb2=apiai(_0x4e9b9f,{'language':_0x191cb6||'en'});return _0x32aeb2['textRequest'](_0x3cf014,{'sessionId':md5(_0x34c348)})[_0xb193('0x35')](function(_0x19f432){logger[_0xb193('0x48')](JSON['stringify'](_0x19f432));return{'source':_0x19f432[_0xb193('0x58')][_0xb193('0x59')],'resolvedQuery':_0x19f432[_0xb193('0x58')][_0xb193('0x5a')],'action':_0x19f432[_0xb193('0x58')][_0xb193('0x5b')],'actionIncomplete':_0x19f432[_0xb193('0x58')][_0xb193('0x5c')],'speech':_0x19f432[_0xb193('0x58')][_0xb193('0x5d')][_0xb193('0x5e')],'score':_0x19f432[_0xb193('0x58')][_0xb193('0x5f')],'statusCode':_0x19f432[_0xb193('0x60')]['code'],'endConversation':_0x19f432[_0xb193('0x58')][_0xb193('0x61')][_0xb193('0x62')]||![],'isFallbackIntent':_0x19f432[_0xb193('0x58')][_0xb193('0x61')][_0xb193('0x63')]};});};exports[_0xb193('0x64')]=function(_0x27c67a,_0x16a2ee,_0x4fbba7,_0x55192c,_0x2dbdb4,_0x5ae3ab){var _0x2a4931=_0x55192c[_0xb193('0x65')](/\\n/g,'\x0a');var _0xf9fbf1={'credentials':{'private_key':_0x2a4931,'client_email':_0x4fbba7}};var _0x316bb0=new dialogflow['SessionsClient'](_0xf9fbf1);var _0x1d38ae=_0x316bb0['sessionPath'](_0x16a2ee,md5(_0x27c67a));var _0x442cc4={'session':_0x1d38ae,'queryInput':{'text':{'text':_0x2dbdb4,'languageCode':_0x5ae3ab}}};return _0x316bb0['detectIntent'](_0x442cc4)[_0xb193('0x35')](function(_0x27d267){if(_0x27d267&&_0x27d267[_0xb193('0x45')]){logger[_0xb193('0x48')](_0xb193('0x66'),JSON[_0xb193('0x41')](_0x27d267));var _0x2c8d6b=_0x27d267[0x0];if(_0x2c8d6b){var _0x22d5da={'action':_0x2c8d6b[_0xb193('0x67')][_0xb193('0x5b')],'allRequiredParamsPresent':_0x2c8d6b[_0xb193('0x67')][_0xb193('0x68')],'endConversation':_0x2c8d6b[_0xb193('0x67')][_0xb193('0x69')]&&_0x2c8d6b['queryResult']['diagnosticInfo'][_0xb193('0x6a')]?_0x2c8d6b[_0xb193('0x67')]['diagnosticInfo'][_0xb193('0x6a')][_0xb193('0x6b')][_0xb193('0x6c')]:![],'fulfillmentText':_0x2c8d6b['queryResult'][_0xb193('0x6d')],'intentName':_0x2c8d6b[_0xb193('0x67')][_0xb193('0x6e')][_0xb193('0x55')],'intentDisplayName':_0x2c8d6b[_0xb193('0x67')][_0xb193('0x6e')]['displayName'],'isFallbackIntent':_0x2c8d6b[_0xb193('0x67')][_0xb193('0x6e')][_0xb193('0x6f')],'languageCode':_0x2c8d6b[_0xb193('0x67')][_0xb193('0x70')],'queryText':_0x2c8d6b['queryResult'][_0xb193('0x71')],'responseId':_0x2c8d6b['responseId'],'score':_0x2c8d6b['queryResult']['intentDetectionConfidence'],'speech':_0x2c8d6b[_0xb193('0x67')][_0xb193('0x6d')],'providerResponse':JSON['stringify'](_0x27d267)};return _0x22d5da;}}});};exports['tildeASR']=function(_0x37c48b,_0x2b8327,_0x2aebe7,_0xe4c70f){return tilde[_0xb193('0x4b')](_0x37c48b,_0x2b8327,_0x2aebe7,_0xe4c70f)[_0xb193('0x35')](function(_0x102e16){try{fs[_0xb193('0x19')](_0x37c48b);}catch(_0x3aea7f){logger[_0xb193('0x1c')](_0x3aea7f);}logger[_0xb193('0x48')]('Tilde\x20ASR\x20transcription',_0x102e16[_0xb193('0x4e')]);logger[_0xb193('0x48')](_0xb193('0x72'),_0x102e16[_0xb193('0x51')]);return _0x102e16;});};exports[_0xb193('0x73')]=function(_0x3b4873,_0x2b126d,_0x5679c8,_0x2310ec,_0x5917d4,_0x18cd50){var _0x472735=path['resolve'](__dirname,_0xb193('0x36'),rs[_0xb193('0x37')](0x4)+_0xb193('0x38'));var _0x4a98d7;return aws['polly'](_0x3b4873,_0x2b126d,_0x5679c8,_0x2310ec,_0x5917d4,_0x18cd50,_0x472735)['then'](function(){_0x4a98d7=path[_0xb193('0x26')](__dirname,_0xb193('0x36'),rs[_0xb193('0x37')](0x4)+_0xb193('0x27'));return convertFile(_0x472735,_0x4a98d7);})[_0xb193('0x35')](function(){try{fs[_0xb193('0x19')](_0x472735);fs['chmodSync'](_0x4a98d7,'777');}catch(_0x1a639f){logger['error'](_0x1a639f);}return _0x4a98d7[_0xb193('0x2a')]('.')[0x0];});};exports[_0xb193('0x74')]=function(_0x34d483,_0x376e68,_0xbe4b57,_0x155363,_0x4e3f5b,_0x3ac078){return aws[_0xb193('0x75')](_0x34d483,_0x376e68,_0xbe4b57,_0x155363,_0x4e3f5b,_0x3ac078)[_0xb193('0x35')](function(_0x18fe8a){logger[_0xb193('0x48')](JSON[_0xb193('0x41')](_0x18fe8a));return _0x18fe8a;});};exports[_0xb193('0x76')]=function(_0x7d2e74,_0x26ef77,_0x35b20f,_0x391b8e){var _0x3e57f3=util[_0xb193('0x77')](_0xb193('0x78'),ISPEECH_API,_0x7d2e74,encodeURIComponent(_0x26ef77),_0x35b20f,_0x391b8e);var _0x593f57=path[_0xb193('0x26')](__dirname,'tmp',rs[_0xb193('0x37')](0x4)+_0xb193('0x38'));var _0x50028e;return downloadFile(_0x3e57f3,_0x593f57)[_0xb193('0x35')](function(){_0x50028e=path['resolve'](__dirname,_0xb193('0x36'),rs['generate'](0x4)+'.wav');return convertFile(_0x593f57,_0x50028e);})[_0xb193('0x35')](function(){try{fs[_0xb193('0x19')](_0x593f57);fs[_0xb193('0x29')](_0x50028e,_0xb193('0x3a'));}catch(_0xa5d3eb){logger[_0xb193('0x1c')](_0xa5d3eb);}return _0x50028e[_0xb193('0x2a')]('.')[0x0];});};exports['ispeechASR']=function(_0x429ed8,_0x1f5538,_0x4b83f4,_0x7b7292){var _0x3c30bc=util[_0xb193('0x77')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1f5538,_0x4b83f4,base64Encode(_0x429ed8),_0x7b7292?util[_0xb193('0x77')](_0xb193('0x79'),encodeURIComponent(_0x7b7292)):_0xb193('0x7a'));return uploadFile(_0x3c30bc)['then'](function(_0x4c435f){return querystring[_0xb193('0x7b')](_0x4c435f);});};exports[_0xb193('0x7c')]=function(_0xdb3182,_0x1ca88a){return sestek[_0xb193('0x7d')](_0xdb3182,_0x1ca88a)[_0xb193('0x35')](function(_0x2d20da){logger['info'](JSON['stringify'](_0x2d20da));var _0x415c45={'speech':_0x2d20da[_0xb193('0x7e')],'action':_0x2d20da[_0xb193('0x7f')]?_0x2d20da['channelData'][_0xb193('0x80')]:undefined,'actiondata':_0x2d20da['channelData']?_0x2d20da[_0xb193('0x7f')]['CustomActionData']:undefined};if(_0x2d20da['channelData']&&_0x2d20da[_0xb193('0x7f')]['AudioFromTts']){return base64Decode(_0x2d20da[_0xb193('0x7f')][_0xb193('0x81')][_0xb193('0x82')],path[_0xb193('0x26')](__dirname,'tmp',rs[_0xb193('0x37')](0x4)+'.wav'))[_0xb193('0x35')](function(_0x1c16db){_0x415c45[_0xb193('0x83')]=_0x1c16db;return _0x415c45;});}return _0x415c45;});};exports[_0xb193('0x84')]=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 35ec9cc..eb3a7e1 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 _0x686a=['exports'];(function(_0x22f07d,_0x1c816f){var _0x443806=function(_0x5afaf6){while(--_0x5afaf6){_0x22f07d['push'](_0x22f07d['shift']());}};_0x443806(++_0x1c816f);}(_0x686a,0xe8));var _0xa686=function(_0x28f1de,_0x355054){_0x28f1de=_0x28f1de-0x0;var _0x5b5dad=_0x686a[_0x28f1de];return _0x5b5dad;};var nda=require('./nda');module[_0xa686('0x0')]={'nda':nda}; \ No newline at end of file +var _0x82b9=['./nda'];(function(_0x1332b5,_0x5a326a){var _0x3a045a=function(_0x14e9c8){while(--_0x14e9c8){_0x1332b5['push'](_0x1332b5['shift']());}};_0x3a045a(++_0x5a326a);}(_0x82b9,0x82));var _0x982b=function(_0x282750,_0x4a0cd4){_0x282750=_0x282750-0x0;var _0x549f8b=_0x82b9[_0x282750];return _0x549f8b;};var nda=require(_0x982b('0x0'));module['exports']={'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 06f1e5f..e960f5e 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 _0x6ce9=['../../../../../config/logger','POST','resolve','ndauth_url','password','username','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','request-promise','url'];(function(_0x4ba2d2,_0x9f2ef){var _0x179cc9=function(_0x89e18f){while(--_0x89e18f){_0x4ba2d2['push'](_0x4ba2d2['shift']());}};_0x179cc9(++_0x9f2ef);}(_0x6ce9,0x76));var _0x96ce=function(_0x396474,_0x4d3a6a){_0x396474=_0x396474-0x0;var _0x525676=_0x6ce9[_0x396474];return _0x525676;};'use strict';var rp=require(_0x96ce('0x0'));var url=require(_0x96ce('0x1'));var logger=require(_0x96ce('0x2'))('agi');module['exports']=function(_0x18bbb2,_0x5bf6d5){var _0x28a6a3={'method':_0x96ce('0x3'),'uri':url[_0x96ce('0x4')](_0x5bf6d5[_0x96ce('0x5')],'/token'),'form':{'grant_type':_0x96ce('0x6'),'username':_0x5bf6d5[_0x96ce('0x7')],'password':_0x5bf6d5[_0x96ce('0x6')]},'json':!![]};return rp(_0x28a6a3)['then'](function(_0x1abd8c){var _0x16a140={'method':_0x96ce('0x3'),'uri':url['resolve'](_0x5bf6d5['ndassistant_url'],_0x96ce('0x8')),'body':{'type':_0x5bf6d5[_0x96ce('0x9')]||_0x96ce('0xa'),'channelId':_0x96ce('0xb'),'conversation':{'id':_0x18bbb2[_0x96ce('0xc')]},'from':{'id':_0x18bbb2[_0x96ce('0xd')],'name':_0x18bbb2[_0x96ce('0xe')]},'recipient':{'id':_0x18bbb2[_0x96ce('0xf')],'name':_0x18bbb2[_0x96ce('0x10')]},'text':_0x5bf6d5[_0x96ce('0x11')],'channelData':{}},'headers':{'Authorization':_0x96ce('0x12')+_0x1abd8c['access_token']},'json':!![]};if(_0x5bf6d5[_0x96ce('0x13')]){_0x16a140[_0x96ce('0x14')][_0x96ce('0x15')]['ProjectName']=_0x5bf6d5[_0x96ce('0x13')];}if(_0x5bf6d5[_0x96ce('0x16')]=='1'){_0x16a140[_0x96ce('0x14')][_0x96ce('0x15')][_0x96ce('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x96ce('0x18')};}if(_0x5bf6d5[_0x96ce('0x19')]){_0x16a140[_0x96ce('0x14')][_0x96ce('0x15')][_0x96ce('0x1a')]=_0x5bf6d5[_0x96ce('0x19')];if(_0x5bf6d5[_0x96ce('0x1b')]){_0x16a140[_0x96ce('0x14')][_0x96ce('0x15')][_0x96ce('0x1c')]=_0x5bf6d5['custom_action_data'];}}logger['info'](JSON[_0x96ce('0x1d')](_0x16a140));return rp(_0x16a140);});}; \ No newline at end of file +var _0x0487=['custom_action','CustomAction','custom_action_data','CustomActionData','stringify','request-promise','url','../../../../../config/logger','agi','exports','resolve','ndauth_url','/token','password','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','extension','text','access_token','project','channelData','ProjectName','ndagenerate_audio','body','AudioOutputSettings'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x0487,0x14f));var _0x7048=function(_0x4521e3,_0x10a8a4){_0x4521e3=_0x4521e3-0x0;var _0x46a272=_0x0487[_0x4521e3];return _0x46a272;};'use strict';var rp=require(_0x7048('0x0'));var url=require(_0x7048('0x1'));var logger=require(_0x7048('0x2'))(_0x7048('0x3'));module[_0x7048('0x4')]=function(_0xa0ecc,_0x4e824e){var _0x2adc11={'method':'POST','uri':url[_0x7048('0x5')](_0x4e824e[_0x7048('0x6')],_0x7048('0x7')),'form':{'grant_type':_0x7048('0x8'),'username':_0x4e824e['username'],'password':_0x4e824e[_0x7048('0x8')]},'json':!![]};return rp(_0x2adc11)[_0x7048('0x9')](function(_0xf90179){var _0x5683ce={'method':_0x7048('0xa'),'uri':url['resolve'](_0x4e824e[_0x7048('0xb')],_0x7048('0xc')),'body':{'type':_0x4e824e[_0x7048('0xd')]||_0x7048('0xe'),'channelId':_0x7048('0xf'),'conversation':{'id':_0xa0ecc[_0x7048('0x10')]},'from':{'id':_0xa0ecc[_0x7048('0x11')],'name':_0xa0ecc['calleridname']},'recipient':{'id':_0xa0ecc[_0x7048('0x12')],'name':_0xa0ecc[_0x7048('0x13')]},'text':_0x4e824e[_0x7048('0x14')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0xf90179[_0x7048('0x15')]},'json':!![]};if(_0x4e824e[_0x7048('0x16')]){_0x5683ce['body'][_0x7048('0x17')][_0x7048('0x18')]=_0x4e824e[_0x7048('0x16')];}if(_0x4e824e[_0x7048('0x19')]=='1'){_0x5683ce[_0x7048('0x1a')]['channelData'][_0x7048('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x4e824e[_0x7048('0x1c')]){_0x5683ce[_0x7048('0x1a')][_0x7048('0x17')][_0x7048('0x1d')]=_0x4e824e['custom_action'];if(_0x4e824e[_0x7048('0x1e')]){_0x5683ce['body'][_0x7048('0x17')][_0x7048('0x1f')]=_0x4e824e['custom_action_data'];}}logger['info'](JSON[_0x7048('0x20')](_0x5683ce));return rp(_0x5683ce);});}; \ 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 b882d4e..70f5b73 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 _0xe3a3=['exports'];(function(_0x5645ad,_0x580ea3){var _0x17d292=function(_0xe66902){while(--_0xe66902){_0x5645ad['push'](_0x5645ad['shift']());}};_0x17d292(++_0x580ea3);}(_0xe3a3,0x1d7));var _0x3e3a=function(_0x525a65,_0x3c77d7){_0x525a65=_0x525a65-0x0;var _0x280efa=_0xe3a3[_0x525a65];return _0x280efa;};'use strict';var asr=require('./lib/api');module[_0x3e3a('0x0')]=function(_0x56ad0f,_0x3c5b3b,_0x446edc,_0x4f360a){return asr(_0x56ad0f,_0x3c5b3b,_0x446edc,_0x4f360a);}; \ No newline at end of file +var _0xc748=['./lib/api','exports'];(function(_0x2594e9,_0x13a25c){var _0xf47c0f=function(_0x1a3d3d){while(--_0x1a3d3d){_0x2594e9['push'](_0x2594e9['shift']());}};_0xf47c0f(++_0x13a25c);}(_0xc748,0x164));var _0x8c74=function(_0x22f164,_0xaa4f80){_0x22f164=_0x22f164-0x0;var _0x51ab95=_0xc748[_0x22f164];return _0x51ab95;};'use strict';var asr=require(_0x8c74('0x0'));module[_0x8c74('0x1')]=function(_0xd0e48,_0xa77df4,_0x1808a3,_0x502467){return asr(_0xd0e48,_0xa77df4,_0x1808a3,_0x502467);}; \ 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 27baa46..7bb5a7f 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 _0x6b62=['close','EOS','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','open','message','lodash','moment','../../../../../../config/logger','agi','info','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','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data'];(function(_0x1e07e7,_0x247af2){var _0x42d587=function(_0x1a8ba1){while(--_0x1a8ba1){_0x1e07e7['push'](_0x1e07e7['shift']());}};_0x42d587(++_0x247af2);}(_0x6b62,0xce));var _0x26b6=function(_0x3f5872,_0xbd9e7b){_0x3f5872=_0x3f5872-0x0;var _0x5970e2=_0x6b62[_0x3f5872];return _0x5970e2;};'use strict';var BPromise=require('bluebird');var _=require(_0x26b6('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x26b6('0x1'));var crypto=require('crypto');var logger=require(_0x26b6('0x2'))(_0x26b6('0x3'));module['exports']=function(_0x1a0f11,_0x2a5292,_0x3b3d12,_0x10897d){return new BPromise(function(_0x3fb9c7,_0x11b714){logger[_0x26b6('0x4')]('Tilde\x20URI',_0x10897d||_0x26b6('0x5'));var _0x56949b=new WebSocket(_0x10897d||_0x26b6('0x5'),{'perMessageDeflate':![]});var _0x44f16b='';var _0x2773cd='0';var _0x3268eb='1';var _0x35de1f=_0x26b6('0x6');function _0x45cacc(_0x162213){var _0x6f6853=crypto[_0x26b6('0x7')](_0x26b6('0x8'));_0x6f6853[_0x26b6('0x9')](_0x162213);return _0x6f6853['digest'](_0x26b6('0xa'));}function _0x50f6d2(){try{logger['info'](_0x26b6('0xb'));var _0x4df97c=moment()['unix']();var _0x3c09ad=_0x45cacc(_0x4df97c+_0x2a5292+_0x3b3d12);_0x56949b[_0x26b6('0xc')](JSON[_0x26b6('0xd')]({'appID':_0x2a5292,'timestamp':_0x4df97c,'appKey':_0x3c09ad}));var _0xec3a8d=fs[_0x26b6('0xe')](_0x1a0f11);_0xec3a8d['on'](_0x26b6('0xf'),function(_0x4d7e1b){_0x56949b['send'](_0x4d7e1b);});_0xec3a8d['on'](_0x26b6('0x10'),function(){_0x56949b['send'](_0x26b6('0x11'));});}catch(_0x20db17){logger[_0x26b6('0x12')]('Tilde\x20ASR\x20send\x20error',JSON[_0x26b6('0xd')](_0x20db17));_0x56949b[_0x26b6('0x13')]();}}function _0x53638a(_0x5c337b){try{if(_0x5c337b){var _0xd3e476=JSON[_0x26b6('0x14')](_0x5c337b);switch(_0xd3e476[_0x26b6('0x15')]){case 0x0:if(_0xd3e476[_0x26b6('0x16')]){if(_0xd3e476[_0x26b6('0x16')][_0x26b6('0x17')]){logger['info'](_0x26b6('0x18'),JSON[_0x26b6('0xd')](_0xd3e476[_0x26b6('0x16')][_0x26b6('0x19')]));_0x44f16b=_0xd3e476[_0x26b6('0x16')][_0x26b6('0x19')][0x0]['transcript'];_0x2773cd=_0xd3e476['result']['hypotheses'][0x0][_0x26b6('0x1a')];_0x3268eb='0';_0x35de1f=_0x26b6('0x1b');_0x56949b[_0x26b6('0x13')]();}}break;case 0x1:logger[_0x26b6('0x4')](_0x26b6('0x6'));_0x3268eb='1';_0x35de1f=_0x26b6('0x6');break;case 0x2:logger[_0x26b6('0x4')](_0x26b6('0x1c'));_0x3268eb='2';_0x35de1f='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x26b6('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3268eb='9';_0x35de1f=_0x26b6('0x1d');break;case 0xa:logger[_0x26b6('0x4')](_0x26b6('0x1e'));_0x3268eb='10';_0x35de1f='Authentication\x20failed.';break;case 0xb:logger[_0x26b6('0x4')](_0x26b6('0x1f'));_0x3268eb='11';_0x35de1f='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x2d70e2){logger[_0x26b6('0x12')](_0x26b6('0x20'),JSON[_0x26b6('0xd')](_0x2d70e2));_0x56949b[_0x26b6('0x13')]();}}function _0x65ef36(){logger[_0x26b6('0x4')](_0x26b6('0x21'));_0x3fb9c7({'transcript':_0x44f16b,'confidence':_0x2773cd,'status':_0x3268eb,'status_message':_0x35de1f});}function _0x2c2d18(_0x354c3e){logger[_0x26b6('0x12')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0x26b6('0x22')](_0x354c3e)){logger['error'](_['isObject'](_0x354c3e)?JSON[_0x26b6('0xd')](_0x354c3e):_0x354c3e);}}_0x56949b['on'](_0x26b6('0x23'),_0x50f6d2);_0x56949b['on'](_0x26b6('0x24'),_0x53638a);_0x56949b['on'](_0x26b6('0x10'),_0x65ef36);_0x56949b['on'](_0x26b6('0x12'),_0x2c2d18);});}; \ No newline at end of file +var _0xfb07=['stringify','terminate','status','result','final','hypotheses','transcript','likelihood','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','message','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','data','EOS','error','Tilde\x20ASR\x20send\x20error'];(function(_0x1427c8,_0x516bc3){var _0x5eed8c=function(_0x493064){while(--_0x493064){_0x1427c8['push'](_0x1427c8['shift']());}};_0x5eed8c(++_0x516bc3);}(_0xfb07,0x177));var _0x7fb0=function(_0x35eccb,_0x35f257){_0x35eccb=_0x35eccb-0x0;var _0x3f2897=_0xfb07[_0x35eccb];return _0x3f2897;};'use strict';var BPromise=require(_0x7fb0('0x0'));var _=require(_0x7fb0('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x7fb0('0x2'));var crypto=require(_0x7fb0('0x3'));var logger=require(_0x7fb0('0x4'))(_0x7fb0('0x5'));module['exports']=function(_0x140033,_0x567ab3,_0x4fb1f0,_0x667a13){return new BPromise(function(_0x51ab7f,_0x502460){logger[_0x7fb0('0x6')](_0x7fb0('0x7'),_0x667a13||_0x7fb0('0x8'));var _0x3c827a=new WebSocket(_0x667a13||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x3a690f='';var _0xa556c5='0';var _0x31e39b='1';var _0x3a415b='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x580d64(_0x280aa9){var _0x44fa29=crypto[_0x7fb0('0x9')](_0x7fb0('0xa'));_0x44fa29[_0x7fb0('0xb')](_0x280aa9);return _0x44fa29[_0x7fb0('0xc')](_0x7fb0('0xd'));}function _0x29a9da(){try{logger['info'](_0x7fb0('0xe'));var _0x339885=moment()[_0x7fb0('0xf')]();var _0x1a7a0d=_0x580d64(_0x339885+_0x567ab3+_0x4fb1f0);_0x3c827a[_0x7fb0('0x10')](JSON['stringify']({'appID':_0x567ab3,'timestamp':_0x339885,'appKey':_0x1a7a0d}));var _0x514576=fs['createReadStream'](_0x140033);_0x514576['on'](_0x7fb0('0x11'),function(_0x2cc7ee){_0x3c827a[_0x7fb0('0x10')](_0x2cc7ee);});_0x514576['on']('close',function(){_0x3c827a[_0x7fb0('0x10')](_0x7fb0('0x12'));});}catch(_0x1476e9){logger[_0x7fb0('0x13')](_0x7fb0('0x14'),JSON[_0x7fb0('0x15')](_0x1476e9));_0x3c827a[_0x7fb0('0x16')]();}}function _0x5e4d8e(_0x4d0a84){try{if(_0x4d0a84){var _0x39aefa=JSON['parse'](_0x4d0a84);switch(_0x39aefa[_0x7fb0('0x17')]){case 0x0:if(_0x39aefa[_0x7fb0('0x18')]){if(_0x39aefa[_0x7fb0('0x18')][_0x7fb0('0x19')]){logger[_0x7fb0('0x6')]('Tilde\x20ASR\x20hypoteses',JSON[_0x7fb0('0x15')](_0x39aefa['result'][_0x7fb0('0x1a')]));_0x3a690f=_0x39aefa['result'][_0x7fb0('0x1a')][0x0][_0x7fb0('0x1b')];_0xa556c5=_0x39aefa['result'][_0x7fb0('0x1a')][0x0][_0x7fb0('0x1c')];_0x31e39b='0';_0x3a415b='Success.';_0x3c827a['terminate']();}}break;case 0x1:logger[_0x7fb0('0x6')](_0x7fb0('0x1d'));_0x31e39b='1';_0x3a415b=_0x7fb0('0x1d');break;case 0x2:logger[_0x7fb0('0x6')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x31e39b='2';_0x3a415b='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info'](_0x7fb0('0x1e'));_0x31e39b='9';_0x3a415b=_0x7fb0('0x1e');break;case 0xa:logger[_0x7fb0('0x6')](_0x7fb0('0x1f'));_0x31e39b='10';_0x3a415b=_0x7fb0('0x1f');break;case 0xb:logger[_0x7fb0('0x6')](_0x7fb0('0x20'));_0x31e39b='11';_0x3a415b=_0x7fb0('0x20');}}}catch(_0x399f47){logger[_0x7fb0('0x13')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x7fb0('0x15')](_0x399f47));_0x3c827a[_0x7fb0('0x16')]();}}function _0x4d733f(){logger[_0x7fb0('0x6')](_0x7fb0('0x21'));_0x51ab7f({'transcript':_0x3a690f,'confidence':_0xa556c5,'status':_0x31e39b,'status_message':_0x3a415b});}function _0xe80d8d(_0x82fca8){logger['error']('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x82fca8)){logger['error'](_['isObject'](_0x82fca8)?JSON[_0x7fb0('0x15')](_0x82fca8):_0x82fca8);}}_0x3c827a['on']('open',_0x29a9da);_0x3c827a['on'](_0x7fb0('0x22'),_0x5e4d8e);_0x3c827a['on'](_0x7fb0('0x23'),_0x4d733f);_0x3c827a['on'](_0x7fb0('0x13'),_0xe80d8d);});}; \ 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 28cc26c..75d9025 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 _0x35f4=['./asr'];(function(_0x9028ee,_0x489bca){var _0x27a0db=function(_0x54a982){while(--_0x54a982){_0x9028ee['push'](_0x9028ee['shift']());}};_0x27a0db(++_0x489bca);}(_0x35f4,0x183));var _0x435f=function(_0x888385,_0x9cdc66){_0x888385=_0x888385-0x0;var _0x22d5c2=_0x35f4[_0x888385];return _0x22d5c2;};var asr=require(_0x435f('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x378f=['exports','./asr'];(function(_0x2bf2ab,_0x4c1739){var _0x1d27fa=function(_0x1da6d7){while(--_0x1da6d7){_0x2bf2ab['push'](_0x2bf2ab['shift']());}};_0x1d27fa(++_0x4c1739);}(_0x378f,0xed));var _0xf378=function(_0x1abda2,_0x5c6fb2){_0x1abda2=_0x1abda2-0x0;var _0x430586=_0x378f[_0x1abda2];return _0x430586;};var asr=require(_0xf378('0x0'));module[_0xf378('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 8e10cf9..ef156f3 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 _0x46a8=['E_AGI_SERVER_MAXCONNECTION','code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','./channel','127.0.0.1','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x383a9d,_0x298fd3){var _0x150332=function(_0x41fe69){while(--_0x41fe69){_0x383a9d['push'](_0x383a9d['shift']());}};_0x150332(++_0x298fd3);}(_0x46a8,0x151));var _0x846a=function(_0x59358f,_0x2cc171){_0x59358f=_0x59358f-0x0;var _0x4ffe87=_0x46a8[_0x59358f];return _0x4ffe87;};'use strict';var util=require(_0x846a('0x0'));var net=require(_0x846a('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x846a('0x2'));var AGIServer=function(_0xe33325,_0x2c8791,_0x3c5718){var _0x59fa2a=this,_0xe33325=_0xe33325||0x11dd,_0x2c8791=_0x2c8791||_0x846a('0x3'),_0x1fdf37=null,_0x3b6cbb=0x0;EventEmitter['call'](_0x59fa2a);function _0x680aed(){if(!_0xe33325){_0x59fa2a[_0x846a('0x4')](_0x846a('0x5'),new AGIError(_0x846a('0x6')));return![];}_0x1fdf37=net[_0x846a('0x7')]();_0x1fdf37[_0x846a('0x8')](_0xe33325,_0x2c8791);_0x1fdf37['on']('listening',function(){_0x59fa2a['emit'](_0x846a('0x9'));});_0x1fdf37['on'](_0x846a('0xa'),function(_0x13394c){_0x1fdf37[_0x846a('0xb')](function(_0x41b621,_0x147bb4){if(_0x41b621){_0x59fa2a[_0x846a('0x4')]('error',new AGIError(_0x846a('0xc'),_0x41b621));}else if(_0x3c5718&&_0x3c5718<0x0){_0x59fa2a[_0x846a('0x4')]('error',new AGIError(_0x846a('0xd')));_0x13394c[_0x846a('0xe')]();}else if(_0x3c5718&&_0x3c5718>0x0&&_0x3c5718<_0x147bb4){_0x3b6cbb+=0x1;_0x59fa2a[_0x846a('0x4')](_0x846a('0x5'),new AGIError(_0x846a('0xf'),_0x3b6cbb));_0x13394c['destroy']();}else{var _0x3d7957=new AGIChannel(_0x13394c);_0x3d7957['on']('ready',function(){_0x59fa2a['emit'](_0x846a('0xa'),_0x3d7957);});}});});_0x1fdf37['on']('error',function(_0x39a5f7){_0x59fa2a['emit'](_0x846a('0x5'),new AGIError(_0x846a('0xc'),_0x39a5f7[_0x846a('0x10')]));});_0x1fdf37['on']('close',function(){_0x59fa2a['emit'](_0x846a('0x11'),new AGIError(_0x846a('0x12')));});}process[_0x846a('0x13')](function(){_0x680aed();});};util[_0x846a('0x14')](AGIServer,EventEmitter);module[_0x846a('0x15')]=function(_0xb49454,_0x555354,_0x20eef2){return new AGIServer(_0xb49454,_0x555354,_0x20eef2);}; \ No newline at end of file +var _0x872a=['destroy','ready','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','EventEmitter','./channel','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','E_AGI_SERVER_ERROR','E_AGI_SERVER_MAXCONNECTION'];(function(_0x503c94,_0x373d15){var _0x5037bf=function(_0xcbd54f){while(--_0xcbd54f){_0x503c94['push'](_0x503c94['shift']());}};_0x5037bf(++_0x373d15);}(_0x872a,0xcf));var _0xa872=function(_0x341c6b,_0x497477){_0x341c6b=_0x341c6b-0x0;var _0x50a7d4=_0x872a[_0x341c6b];return _0x50a7d4;};'use strict';var util=require(_0xa872('0x0'));var net=require('net');var EventEmitter=require('events')[_0xa872('0x1')];var AGIError=require('./error');var AGIChannel=require(_0xa872('0x2'));var AGIServer=function(_0x3993c3,_0x18e5d9,_0x4826fe){var _0x343d45=this,_0x3993c3=_0x3993c3||0x11dd,_0x18e5d9=_0x18e5d9||'127.0.0.1',_0x30cfe2=null,_0x4795f4=0x0;EventEmitter[_0xa872('0x3')](_0x343d45);function _0x52cf15(){if(!_0x3993c3){_0x343d45[_0xa872('0x4')](_0xa872('0x5'),new AGIError(_0xa872('0x6')));return![];}_0x30cfe2=net[_0xa872('0x7')]();_0x30cfe2[_0xa872('0x8')](_0x3993c3,_0x18e5d9);_0x30cfe2['on']('listening',function(){_0x343d45['emit'](_0xa872('0x9'));});_0x30cfe2['on'](_0xa872('0xa'),function(_0x5004af){_0x30cfe2['getConnections'](function(_0x19e997,_0x43a6cc){if(_0x19e997){_0x343d45[_0xa872('0x4')](_0xa872('0x5'),new AGIError(_0xa872('0xb'),_0x19e997));}else if(_0x4826fe&&_0x4826fe<0x0){_0x343d45[_0xa872('0x4')](_0xa872('0x5'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x5004af['destroy']();}else if(_0x4826fe&&_0x4826fe>0x0&&_0x4826fe<_0x43a6cc){_0x4795f4+=0x1;_0x343d45[_0xa872('0x4')](_0xa872('0x5'),new AGIError(_0xa872('0xc'),_0x4795f4));_0x5004af[_0xa872('0xd')]();}else{var _0x15f857=new AGIChannel(_0x5004af);_0x15f857['on'](_0xa872('0xe'),function(){_0x343d45[_0xa872('0x4')](_0xa872('0xa'),_0x15f857);});}});});_0x30cfe2['on'](_0xa872('0x5'),function(_0x29dcb5){_0x343d45['emit']('error',new AGIError(_0xa872('0xb'),_0x29dcb5['code']));});_0x30cfe2['on']('close',function(){_0x343d45[_0xa872('0x4')](_0xa872('0xf'),new AGIError(_0xa872('0x10')));});}process[_0xa872('0x11')](function(){_0x52cf15();});};util[_0xa872('0x12')](AGIServer,EventEmitter);module[_0xa872('0x13')]=function(_0x454797,_0x3eb8ff,_0x28dc74){return new AGIServer(_0x454797,_0x3eb8ff,_0x28dc74);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index fb3810d..a5693a3 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 _0x6100=['variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','getSquareProject','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','path','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','sendMailMessage','IntervalId','interval','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSquareDetailsReport','channel','uniqueid','agicommand','arg_1','callerid','calleridname','extension','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','phone','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','internal','format','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','replace','googleCloudTTS','apiKey','text','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','timeout','includes','PUT','toUpperCase','body','parse','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','key','speed','ispeechASR','ispeech_asr_language','model','aws_access_key_id','aws_secret_access_key','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','googleASR','tildeASR','appid','appsecret','uri','clear','clone','isString','replaceObjectAllVariables','recursiveNodeIndex','hasOwnProperty','isArray','length','replaceAllVariables','isPlainObject','saveRestApiResult','%s.%s','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','setVariable','isConfigured','maxRetry','sync','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','scheduledAt','add','delay','custom_app','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','query:\x20%s','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','googleDialogflow','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','dialogflowV2','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','Trying\x20DialogflowV2:\x20%s','out','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','opts','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','getData','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awsPolly','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','true','false','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','findBy','no\x20find\x20by\x20configured','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','no\x20variable\x20selected\x20for\x20the\x20result','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20found','indexOf','toLowerCase','macro','position','QUEUE','recordingFormat','%s_%s','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','200','%s_STATUS_MESSAGE','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','escape_digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','no\x20mail\x20account\x20configured','account_id','no\x20mail\x20account\x20found','email','Smtp','user','service','host','port','secure','authentication','auth','template_id','Trying\x20SendMail\x20with\x20account\x20%s','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sendSMS\x20message','createSmsMessage','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected'];(function(_0xae01dd,_0xbd8a3c){var _0x8c26df=function(_0x359827){while(--_0x359827){_0xae01dd['push'](_0xae01dd['shift']());}};_0x8c26df(++_0xbd8a3c);}(_0x6100,0x1e1));var _0x0610=function(_0x7237f6,_0x17ac54){_0x7237f6=_0x7237f6-0x0;var _0x347747=_0x6100[_0x7237f6];return _0x347747;};'use strict';var fs=require('fs');var path=require(_0x0610('0x0'));var util=require(_0x0610('0x1'));var _=require(_0x0610('0x2'));var sh=require(_0x0610('0x3'));var odbc=require(_0x0610('0x4'))();var rs=require('randomstring');var moment=require(_0x0610('0x5'));var Mustache=require(_0x0610('0x6'));var rp=require(_0x0610('0x7'));var logger=require(_0x0610('0x8'))(_0x0610('0x9'));var config=require(_0x0610('0xa'));var scripts=require(_0x0610('0xb'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x0610('0xc'),'rawBody'];var verticesWithRetry=[_0x0610('0xd'),_0x0610('0xe'),_0x0610('0xf')];var AGIVertices=function(_0x27c33d,_0x515139,_0x8cf044){this['channel']=_0x27c33d;this[_0x0610('0x10')]=_0x515139;this[_0x0610('0x11')]=_0x8cf044;};AGIVertices[_0x0610('0x12')][_0x0610('0x13')]=function(_0xfd6311,_0x44b794){this[_0x0610('0x10')][_0x0610('0x14')](_0xfd6311)[_0x0610('0x15')](function(_0x4dc5ae){_0x44b794(null,_0x4dc5ae?_0x4dc5ae[_0x0610('0x16')]:![]);})[_0x0610('0x17')](function(_0x57fccb){_0x44b794(_0x57fccb);});};AGIVertices[_0x0610('0x12')][_0x0610('0x18')]=function(_0x1f118b,_0x29c7db){this[_0x0610('0x10')][_0x0610('0x19')](_0x1f118b)[_0x0610('0x15')](function(_0x4bb9e5){_0x29c7db(null,_0x4bb9e5?_0x4bb9e5['name']:![]);})['catch'](function(_0x53f79a){_0x29c7db(_0x53f79a);});};AGIVertices[_0x0610('0x12')]['getSquareProject']=function(_0x3ae9cc,_0x397186){this[_0x0610('0x10')][_0x0610('0x1a')](_0x3ae9cc)[_0x0610('0x15')](function(_0x9fd7a3){_0x397186(null,_0x9fd7a3?_0x9fd7a3[_0x0610('0x16')]:![]);})[_0x0610('0x17')](function(_0xab69e0){_0x397186(_0xab69e0);});};AGIVertices[_0x0610('0x12')][_0x0610('0x1b')]=function(_0x398c0d,_0x5974cb){this[_0x0610('0x10')][_0x0610('0x1c')](_0x398c0d)[_0x0610('0x15')](function(_0x119da5){_0x5974cb(null,_0x119da5?_0x119da5['dsn']:![]);})[_0x0610('0x17')](function(_0x19367f){_0x5974cb(_0x19367f);});};AGIVertices['prototype'][_0x0610('0x1d')]=function(_0x4c9121,_0x597cbf){this[_0x0610('0x10')][_0x0610('0x1e')](_0x4c9121)['then'](function(_0x2cd125){_0x597cbf(null,_0x2cd125?_0x2cd125[_0x0610('0x16')]:![]);})[_0x0610('0x17')](function(_0x1838e4){_0x597cbf(_0x1838e4);});};AGIVertices[_0x0610('0x12')][_0x0610('0x1f')]=function(_0x5588cf,_0x318a33){this['rpc'][_0x0610('0x20')](_0x5588cf)[_0x0610('0x15')](function(_0x179e1e){_0x318a33(null,_0x179e1e?_0x179e1e[_0x0610('0x16')]:![]);})[_0x0610('0x17')](function(_0x17dba4){_0x318a33(_0x17dba4);});};AGIVertices[_0x0610('0x12')][_0x0610('0x21')]=function(_0x3cb858,_0x550bb9){var _0x266b51=this;this[_0x0610('0x10')][_0x0610('0x22')](_0x3cb858)[_0x0610('0x15')](function(_0x517a93){_0x550bb9(null,_0x517a93?_0x266b51[_0x0610('0x23')](_0x517a93[_0x0610('0x24')]):![]);})['catch'](function(_0x2a3058){_0x550bb9(_0x2a3058);});};AGIVertices['prototype'][_0x0610('0x25')]=function(_0xaad5c1,_0xd834d2){this[_0x0610('0x10')]['getMailAccountById'](_0xaad5c1)[_0x0610('0x15')](function(_0x2603c0){_0xd834d2(null,_0x2603c0?_0x2603c0:![]);})[_0x0610('0x17')](function(_0x3a8bd3){_0xd834d2(_0x3a8bd3);});};AGIVertices[_0x0610('0x12')][_0x0610('0x26')]=function(_0x1eb82a,_0x16d54b,_0x5ad88a){this[_0x0610('0x11')]['sendMailMessage'](_0x1eb82a,_0x16d54b)[_0x0610('0x15')](function(){_0x5ad88a(null);})[_0x0610('0x17')](function(_0xee1ba9){_0x5ad88a(_0xee1ba9);});};AGIVertices['prototype']['getIntervals']=function(_0x10bf13,_0x2af1b5){this[_0x0610('0x10')]['getIntervalById'](_0x10bf13)[_0x0610('0x15')](function(_0x56b304){if(_0x56b304){if(_0x56b304[_0x0610('0x27')]){_0x2af1b5(null,[_0x56b304[_0x0610('0x28')]]);}else{_0x2af1b5(null,_['map'](_0x56b304['Intervals'],_0x0610('0x28')));}}else{_0x2af1b5(null,![]);}})['catch'](function(_0x442b5a){_0x2af1b5(_0x442b5a);});};AGIVertices['prototype']['getSoundPath']=function(_0x5d55ce){return util['format'](_0x0610('0x29'),FILES_PATH,_0x5d55ce);};AGIVertices[_0x0610('0x12')][_0x0610('0x2a')]=function(_0x5be235,_0x2582d8,_0x5375b0){odbc[_0x0610('0x2b')](_0x5be235,function(_0x2d65d9){if(_0x2d65d9){logger['error'](_0x0610('0x2c'),_0x2d65d9);_0x5375b0(_0x2d65d9);}else{logger[_0x0610('0x2d')](_0x0610('0x2e'));odbc[_0x0610('0x2f')](_0x2582d8,function(_0x49ec8a,_0x477682){if(_0x49ec8a){logger['info'](_0x0610('0x30'),_0x2582d8);_0x5375b0(_0x49ec8a);}else{logger[_0x0610('0x2d')](_0x0610('0x31'),_0x2582d8);odbc[_0x0610('0x32')](function(_0x1ef27e){if(_0x1ef27e){logger[_0x0610('0x33')](_0x0610('0x34'),_0x1ef27e);}_0x5375b0(null,_0x477682);});}});}});};AGIVertices[_0x0610('0x12')][_0x0610('0x35')]=function(_0x37578e,_0x54d817){this[_0x0610('0x10')]['getSmsAccountById'](_0x37578e)['then'](function(_0x2b4e2e){_0x54d817(null,_0x2b4e2e?_0x2b4e2e:![]);})[_0x0610('0x17')](function(_0x361139){_0x54d817(_0x361139);});};AGIVertices[_0x0610('0x12')]['createSmsMessage']=function(_0x1df81d,_0x48d16d){this[_0x0610('0x10')]['createSmsMessage'](_0x1df81d)[_0x0610('0x15')](function(_0x22b820){_0x48d16d(null,_0x22b820);})[_0x0610('0x17')](function(_0x3f48b6){_0x48d16d(_0x3f48b6);});};AGIVertices[_0x0610('0x12')][_0x0610('0x36')]=function(_0x13b752,_0x346d66,_0x93a8fd){this[_0x0610('0x10')]['createSquareDetailsReport']({'uniqueid':this[_0x0610('0x37')][_0x0610('0x38')],'node':_0x13b752['label'],'application':_0x13b752[_0x0610('0x39')],'data':_0x346d66||null,'project_name':this['channel'][_0x0610('0x3a')],'callerid':this['channel']['callerid']})[_0x0610('0x15')](function(_0x4e40d1){if(_0x93a8fd){_0x93a8fd(null,_0x4e40d1);}})[_0x0610('0x17')](function(_0xe04536){if(_0x93a8fd){_0x93a8fd(_0xe04536);}});};AGIVertices['prototype']['createSquareRecording']=function(_0x267549,_0x47edb8,_0x5c7ffc,_0x1dab2f){this[_0x0610('0x10')]['createSquareRecording']({'uniqueid':this['channel'][_0x0610('0x38')],'callerid':this[_0x0610('0x37')][_0x0610('0x3b')],'calleridname':this['channel'][_0x0610('0x3c')],'context':this['channel']['context'],'extension':this[_0x0610('0x37')][_0x0610('0x3d')],'priority':this['channel'][_0x0610('0x3e')],'accountcode':this[_0x0610('0x37')][_0x0610('0x3f')],'dnid':this[_0x0610('0x37')]['dnid'],'projectName':this[_0x0610('0x37')]['arg_1'],'saveName':_0x47edb8,'filename':_0x267549[_0x0610('0x40')]||_0x47edb8,'savePath':_0x5c7ffc})['then'](function(_0x527377){_0x1dab2f(null,_0x527377);})[_0x0610('0x17')](function(_0x54a99a){_0x1dab2f(_0x54a99a);});};AGIVertices[_0x0610('0x12')][_0x0610('0x41')]=function(_0xa803bd,_0x394e8b,_0x5e9803,_0x11ac1a,_0x495847){this[_0x0610('0x10')][_0x0610('0x41')]({'uniqueid':this['channel']['uniqueid'],'body':_0xa803bd,'direction':_0x394e8b,'providerName':_0x5e9803,'providerResponse':_0x11ac1a})[_0x0610('0x15')](function(_0x3ff60d){if(_0x495847){_0x495847(null,_0x3ff60d);}})[_0x0610('0x17')](function(_0x2b5ec2){if(_0x495847){_0x495847(_0x2b5ec2);}});};AGIVertices[_0x0610('0x12')][_0x0610('0x42')]=function(_0x38f0e4,_0x28759e){this[_0x0610('0x10')][_0x0610('0x42')]({'firstName':_[_0x0610('0x43')](_0x38f0e4['name'])||_[_0x0610('0x44')](_0x38f0e4['name'])?'callback_'+Math['random']():_0x38f0e4[_0x0610('0x16')],'lastName':_['isEmpty'](_0x38f0e4[_0x0610('0x45')])||_[_0x0610('0x44')](_0x38f0e4[_0x0610('0x45')])?null:_0x38f0e4[_0x0610('0x45')],'phone':_0x38f0e4[_0x0610('0x46')],'ListId':_0x38f0e4['list_id'],'scheduledat':_0x38f0e4['scheduledAt'],'callbackUniqueid':this[_0x0610('0x37')][_0x0610('0x38')],'tags':_0x0610('0x47'),'description':_0x0610('0x48')+_0x38f0e4['scheduledAt'][_0x0610('0x49')](),'priority':_0x38f0e4[_0x0610('0x4a')]})[_0x0610('0x15')](function(_0x2fe55b){_0x28759e(null,_0x2fe55b);})[_0x0610('0x17')](function(_0x101557){_0x28759e(_0x101557);});};AGIVertices[_0x0610('0x12')][_0x0610('0x4b')]=function(_0x229fdb,_0x774626){this[_0x0610('0x10')]['getPauseById'](_0x229fdb)['then'](function(_0x3fb17a){_0x774626(null,_0x3fb17a?_0x3fb17a[_0x0610('0x16')]:![]);})[_0x0610('0x17')](function(_0x4ee845){_0x774626(_0x4ee845);});};AGIVertices[_0x0610('0x12')][_0x0610('0x4c')]=function(_0x570bfa,_0x528a56,_0x54028d){var _0x3157d8={'role':_0x0610('0x4d')};_0x3157d8[_0x570bfa]=this[_0x0610('0x37')][_0x0610('0x3b')];this[_0x0610('0x10')][_0x0610('0x4c')](_0x3157d8,_0x528a56,this[_0x0610('0x37')][_0x0610('0x38')])[_0x0610('0x15')](function(_0x198297){_0x54028d(null,_[_0x0610('0x44')](_0x198297)?![]:!![]);})[_0x0610('0x17')](function(_0x418bf1){logger[_0x0610('0x33')](_0x418bf1);_0x54028d(null,![]);});};AGIVertices[_0x0610('0x12')][_0x0610('0x4e')]=function(_0x4080ce,_0x464993){var _0x3deb8e={'role':_0x0610('0x4d')};_0x3deb8e[_0x4080ce]=this[_0x0610('0x37')][_0x0610('0x3b')];this[_0x0610('0x10')]['agentUnpause'](_0x3deb8e)[_0x0610('0x15')](function(_0x338437){_0x464993(null,_[_0x0610('0x44')](_0x338437)?![]:!![]);})[_0x0610('0x17')](function(_0x50a8e4){logger[_0x0610('0x33')](_0x50a8e4);_0x464993(null,![]);});};AGIVertices['prototype']['agentLogout']=function(_0x2a3c47,_0x428d2c){var _0x70ed18={'role':'agent'};_0x70ed18[_0x2a3c47]=this['channel'][_0x0610('0x3b')];this[_0x0610('0x10')][_0x0610('0x4f')](_0x70ed18)[_0x0610('0x15')](function(_0x40bed0){_0x428d2c(null,_['isNil'](_0x40bed0)?![]:!![]);})['catch'](function(_0xcb05ed){logger[_0x0610('0x33')](_0xcb05ed);_0x428d2c(null,![]);});};AGIVertices[_0x0610('0x12')]['agentLogin']=function(_0x4dbfa5,_0x27dd26){var _0x589c76={'role':_0x0610('0x4d')};_0x589c76[_0x4dbfa5]=this['channel'][_0x0610('0x3b')];var _0x2e8150=_0x4dbfa5!=_0x0610('0x50')?util[_0x0610('0x51')](_0x0610('0x52'),_0x0610('0x53'),this[_0x0610('0x37')][_0x0610('0x3b')]):undefined;this[_0x0610('0x10')][_0x0610('0x54')](_0x589c76,_0x2e8150)[_0x0610('0x15')](function(_0x497827){_0x27dd26(null,_[_0x0610('0x44')](_0x497827)?![]:!![]);})[_0x0610('0x17')](function(_0x20cdbb){logger['error'](_0x20cdbb);_0x27dd26(null,![]);});};AGIVertices[_0x0610('0x12')][_0x0610('0x55')]=function(_0x429d60,_0x2b400c){sh[_0x0610('0x56')](_['trim'](_0x429d60),function(_0x4777fd,_0xadd953){var _0x5ebd5d=_0xadd953[_0x0610('0x57')](/(\r\n|\n|\r)/gm,'');_0x2b400c(null,_0x5ebd5d);});};AGIVertices[_0x0610('0x12')]['googleCloudTTS']=function(_0x2da7af,_0x1734b6){scripts[_0x0610('0x58')](_0x2da7af[_0x0610('0x59')],_0x2da7af['google_cloud_tts_text_type']||_0x0610('0x5a'),_0x2da7af['text'],_0x2da7af['languageCode']||_0x0610('0x5b'),_0x2da7af[_0x0610('0x5c')]||_0x0610('0x5d'),_0x2da7af['audioEncoding']||_0x0610('0x5e'))[_0x0610('0x15')](function(_0x57d632){_0x1734b6(null,_0x57d632);})[_0x0610('0x17')](function(_0x9d7082){_0x1734b6(_0x9d7082);});};AGIVertices[_0x0610('0x12')]['googleTTS']=function(_0x1ccd6d,_0x2883b8){scripts[_0x0610('0x5f')](_0x1ccd6d[_0x0610('0x5a')],_0x1ccd6d[_0x0610('0x60')]||'en',0x1)[_0x0610('0x15')](function(_0x3e42e0){_0x2883b8(null,_0x3e42e0);})[_0x0610('0x17')](function(_0x2bba8a){_0x2883b8(_0x2bba8a);});};AGIVertices[_0x0610('0x12')][_0x0610('0x61')]=function(_0x3fd556,_0x4c22bf){var _0x2c8645={'uri':_0x3fd556[_0x0610('0x62')],'method':_0x3fd556['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3fd556[_0x0610('0x63')])==='number'&&parseInt(_0x3fd556[_0x0610('0x63')])>=0x1?parseInt(_0x3fd556[_0x0610('0x63')])*0x3e8:0x5*0x3e8};if(_[_0x0610('0x64')](['POST',_0x0610('0x65')],_0x2c8645['method'][_0x0610('0x66')]())){try{_0x2c8645[_0x0610('0x67')]=_0x3fd556['rawBody']?JSON[_0x0610('0x68')](_0x3fd556[_0x0610('0x69')]):{};}catch(_0x38477f){logger['error'](_0x0610('0x6a'),_0x38477f);}}try{_0x2c8645[_0x0610('0x6b')]=_0x3fd556[_0x0610('0xc')]?JSON[_0x0610('0x68')](_0x3fd556[_0x0610('0xc')]):{};}catch(_0x177d16){logger['error'](_0x0610('0x6c'),_0x177d16);}if(_0x3fd556['computedVariables']){try{var _0x472d4b=require(_0x3fd556['computedVariables'])['sync'](this,_0x2c8645);_0x2c8645['uri']=Mustache[_0x0610('0x6d')](_0x3fd556[_0x0610('0x62')],_0x472d4b,{},['$$','$$']);if(_0x2c8645[_0x0610('0x6b')]){_0x2c8645[_0x0610('0x6b')]=JSON[_0x0610('0x68')](Mustache[_0x0610('0x6d')](JSON['stringify'](_0x2c8645[_0x0610('0x6b')]),_0x472d4b,{},['$$','$$']));}if(_0x2c8645[_0x0610('0x67')]){_0x2c8645['body']=JSON[_0x0610('0x68')](Mustache['render'](JSON[_0x0610('0x6e')](_0x2c8645['body']),_0x472d4b,{},['$$','$$']));}}catch(_0x4c7289){logger[_0x0610('0x33')](_0x0610('0x6f'),_0x4c7289);}}rp(_0x2c8645)[_0x0610('0x15')](function(_0x53d8c4){var _0xce8116={'statusCode':_0x53d8c4[_0x0610('0x70')]||0xc8,'statusMessage':_0x53d8c4[_0x0610('0x71')]||'OK','headers':_0x53d8c4['headers']||{},'body':_0x53d8c4[_0x0610('0x67')]||{}};_0x4c22bf(null,_0xce8116);})[_0x0610('0x17')](function(_0x37ab2e){var _0x3c1a49={'statusCode':_0x37ab2e[_0x0610('0x70')]||0x1f4,'statusMessage':_0x37ab2e[_0x0610('0x72')]||_0x0610('0x73'),'headers':_0x37ab2e[_0x0610('0x74')]['headers']||{},'body':_0x37ab2e['options'][_0x0610('0x67')]||{}};_0x4c22bf(null,_0x3c1a49);});};AGIVertices[_0x0610('0x12')]['googleDialogflow']=function(_0x4e423b,_0xc55eda){scripts['googleDialogflow'](this[_0x0610('0x37')][_0x0610('0x38')],_0x4e423b['key'],_0x4e423b['text'],_0x4e423b['dialogflow_language']||'en')[_0x0610('0x15')](function(_0x1eb400){_0xc55eda(null,_0x1eb400);})[_0x0610('0x17')](function(_0x3b1ecd){_0xc55eda(_0x3b1ecd);});};AGIVertices[_0x0610('0x12')][_0x0610('0x75')]=function(_0x1b858f,_0x4b32eb){scripts[_0x0610('0x75')](this['channel'][_0x0610('0x38')],_0x1b858f['dialogflowV2_project_id'],_0x1b858f[_0x0610('0x76')],_0x1b858f['private_key'],_0x1b858f[_0x0610('0x5a')],_0x1b858f[_0x0610('0x77')]||'en')['then'](function(_0x5209b0){_0x4b32eb(null,_0x5209b0);})['catch'](function(_0x3ccf64){_0x4b32eb(_0x3ccf64);});};AGIVertices[_0x0610('0x12')][_0x0610('0x78')]=function(_0x3da357,_0x345ab5){scripts['sestekNDA'](this['channel'],_0x3da357)[_0x0610('0x15')](function(_0xd1c1fc){_0x345ab5(null,_0xd1c1fc);})[_0x0610('0x17')](function(_0x413ca4){_0x345ab5(_0x413ca4);});};AGIVertices[_0x0610('0x12')][_0x0610('0x79')]=function(_0x229da8,_0x577217){scripts[_0x0610('0x79')](_0x229da8[_0x0610('0x7a')],_0x229da8[_0x0610('0x5a')],_0x229da8['ispeech_tts_language']||_0x0610('0x5b'),_0x229da8[_0x0610('0x7b')])[_0x0610('0x15')](function(_0x5e0436){_0x577217(null,_0x5e0436);})[_0x0610('0x17')](function(_0x41420a){_0x577217(_0x41420a);});};AGIVertices[_0x0610('0x12')][_0x0610('0x7c')]=function(_0x582a26,_0x252323,_0x2fb621){scripts[_0x0610('0x7c')](_0x252323,_0x582a26[_0x0610('0x7a')],_0x582a26[_0x0610('0x7d')]||_0x0610('0x5b'),this['isConfigured'](_0x582a26['model'])?_0x582a26[_0x0610('0x7e')]:undefined)[_0x0610('0x15')](function(_0x1b9c35){_0x2fb621(null,_0x1b9c35);})[_0x0610('0x17')](function(_0xa49edd){_0x2fb621(_0xa49edd);});};AGIVertices[_0x0610('0x12')]['awsPolly']=function(_0x4a4a17,_0x1445c4){scripts['awsPolly'](_0x4a4a17[_0x0610('0x7f')],_0x4a4a17[_0x0610('0x80')],_0x4a4a17['aws_polly_region'],_0x4a4a17[_0x0610('0x81')]||'Amy',_0x4a4a17['text'],_0x4a4a17[_0x0610('0x82')]||_0x0610('0x5a'))[_0x0610('0x15')](function(_0x1066c5){_0x1445c4(null,_0x1066c5);})[_0x0610('0x17')](function(_0x1a3a6b){_0x1445c4(_0x1a3a6b);});};AGIVertices[_0x0610('0x12')][_0x0610('0x83')]=function(_0x3f8909,_0x128129){scripts[_0x0610('0x83')](this[_0x0610('0x37')]['uniqueid'],_0x3f8909[_0x0610('0x7f')],_0x3f8909[_0x0610('0x80')],_0x3f8909[_0x0610('0x84')],_0x3f8909['text'],_0x3f8909['aws_bot_name'])[_0x0610('0x15')](function(_0x51579a){_0x128129(null,_0x51579a);})[_0x0610('0x17')](function(_0x379ecb){_0x128129(_0x379ecb);});};AGIVertices[_0x0610('0x12')][_0x0610('0x85')]=function(_0x4c818b,_0x46457b,_0x2eaab3){scripts[_0x0610('0x85')](_0x46457b,_0x4c818b['key'],_0x4c818b['google_asr_language']||'en-US')[_0x0610('0x15')](function(_0x3f5ce1){_0x2eaab3(null,_0x3f5ce1);})[_0x0610('0x17')](function(_0x4d2d6e){_0x2eaab3(_0x4d2d6e);});};AGIVertices[_0x0610('0x12')]['tildeASR']=function(_0x133044,_0x5f117f,_0x1f01ec){scripts[_0x0610('0x86')](_0x5f117f,_0x133044[_0x0610('0x87')],_0x133044[_0x0610('0x88')],_0x133044[_0x0610('0x89')])['then'](function(_0x12cb6d){_0x1f01ec(null,_0x12cb6d);})['catch'](function(_0x2b5923){_0x1f01ec(_0x2b5923);});};AGIVertices[_0x0610('0x12')][_0x0610('0x8a')]=function(_0xd1edf){var _0x52f55b=_[_0x0610('0x64')](verticesWithRetry,_0xd1edf[_0x0610('0x39')])?_0xd1edf:_[_0x0610('0x8b')](_0xd1edf);for(var _0x5e7cbc in _0x52f55b){if(_0x52f55b['hasOwnProperty'](_0x5e7cbc)){if(_0x52f55b[_0x5e7cbc]&&_[_0x0610('0x8c')](_0x52f55b[_0x5e7cbc])){if(_[_0x0610('0x64')](recursiveMapAttributes,_0x5e7cbc)){_0x52f55b[_0x5e7cbc]=this[_0x0610('0x8d')](_0x52f55b[_0x5e7cbc]);}else{_0x52f55b[_0x5e7cbc]=this['replaceAllVariables'](_0x52f55b[_0x5e7cbc]);}}}}return _0x52f55b;};AGIVertices[_0x0610('0x12')][_0x0610('0x8e')]=function(_0x2bc148){for(var _0x1273d4 in _0x2bc148){if(_0x2bc148[_0x0610('0x8f')](_0x1273d4)){if(_['isPlainObject'](_0x2bc148[_0x1273d4])){this[_0x0610('0x8e')](_0x2bc148[_0x1273d4]);}else if(_[_0x0610('0x90')](_0x2bc148[_0x1273d4])){for(var _0x2768b5=0x0;_0x2768b5<_0x2bc148[_0x1273d4][_0x0610('0x91')];_0x2768b5++){this[_0x0610('0x8e')](_0x2bc148[_0x1273d4][_0x2768b5]);}}else if(_['isString'](_0x2bc148[_0x1273d4])){_0x2bc148[_0x1273d4]=this[_0x0610('0x92')](_0x2bc148[_0x1273d4]);}}}};AGIVertices[_0x0610('0x12')]['saveRestApiResult']=function(_0x4ad2b3,_0x5cf0dd){for(var _0x304966 in _0x4ad2b3){if(_0x4ad2b3['hasOwnProperty'](_0x304966)){if(_[_0x0610('0x93')](_0x4ad2b3[_0x304966])){if(!_[_0x0610('0x43')](_0x4ad2b3[_0x304966])){this[_0x0610('0x94')](_0x4ad2b3[_0x304966],util[_0x0610('0x51')](_0x0610('0x95'),_0x5cf0dd,_0x304966));}}else if(_[_0x0610('0x90')](_0x4ad2b3[_0x304966])){for(var _0x146e7d=0x0;_0x146e7d<_0x4ad2b3[_0x304966][_0x0610('0x91')];_0x146e7d++){this[_0x0610('0x94')](_0x4ad2b3[_0x304966][_0x146e7d],util[_0x0610('0x51')](_0x0610('0x95'),_0x5cf0dd,_0x304966+'['+_0x146e7d+']'));}}else{if(!_['isNil'](_0x4ad2b3[_0x304966])){this[_0x0610('0x37')]['setVariable'](util['format']('%s.%s',_0x5cf0dd,_0x304966),_0x4ad2b3[_0x304966]);}}}}};AGIVertices[_0x0610('0x12')][_0x0610('0x8d')]=function(_0x414972){try{var _0x225131=JSON[_0x0610('0x68')](_0x414972);this[_0x0610('0x8e')](_0x225131);return JSON[_0x0610('0x6e')](_0x225131);}catch(_0x37455e){return this[_0x0610('0x92')](_0x414972);}};AGIVertices['prototype'][_0x0610('0x92')]=function(_0x3f8d24){var _0x4483c5=_0x3f8d24['split']('{');for(var _0x577d09=0x1;_0x577d09<_0x4483c5[_0x0610('0x91')];_0x577d09+=0x1){var _0x5d4d00=_0x4483c5[_0x577d09][_0x0610('0x96')]('}');if(_0x5d4d00[_0x0610('0x91')]>0x1){_0x3f8d24=_0x3f8d24[_0x0610('0x97')]('{'+_0x5d4d00[0x0]+'}',this[_0x0610('0x37')]['getVariable'](_0x5d4d00[0x0])['extra']||_0x5d4d00[0x0]);}}if(_0x4483c5[_0x0610('0x91')]===0x1){return _0x3f8d24['toString']();}return this[_0x0610('0x92')](_0x3f8d24);};AGIVertices[_0x0610('0x12')][_0x0610('0x98')]=function(_0x18e8d2,_0x354faf){var _0x1d41c5=this[_0x0610('0x37')]['getVariable'](_0x18e8d2);if(_0x1d41c5[_0x0610('0x99')]===-0x1){return _0x1d41c5;}logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x9a'),_0x354faf,_0x1d41c5[_0x0610('0x9b')]));return this[_0x0610('0x37')][_0x0610('0x9c')](_0x354faf,_0x1d41c5[_0x0610('0x9b')]);};AGIVertices[_0x0610('0x12')][_0x0610('0x9d')]=function(_0x4076c9){return _0x4076c9&&_0x4076c9!=='0'&&_0x4076c9!=='-1'&&_0x4076c9!=='';};AGIVertices['prototype'][_0x0610('0x9e')]=function(_0x11a5c7){this['createSquareDetailsReport'][_0x0610('0x9f')](this,_0x11a5c7,'-');_0x11a5c7['retry']=_0x11a5c7[_0x0610('0x9e')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x0610('0xa0')]=function(_0x2d61fd){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0xa1'),_0x2d61fd[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x2d61fd[_0x0610('0x5a')])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0xa4'));}var _0x278fb9='\x22'+_0x2d61fd[_0x0610('0x5a')]+'\x22';if(this[_0x0610('0x9d')](_0x2d61fd['options'])){_0x278fb9+=','+_0x2d61fd[_0x0610('0x74')];}var _0x44e204=this[_0x0610('0x37')][_0x0610('0x56')](_0x0610('0xa5'),_0x278fb9);if(_0x44e204[_0x0610('0x99')]===-0x1){return _0x44e204;}return this[_0x0610('0x37')][_0x0610('0xa3')](util['format'](_0x0610('0xa6'),_0x278fb9));};AGIVertices[_0x0610('0x12')][_0x0610('0xa7')]=function(_0x2b80bc){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0xa8'),_0x2b80bc[_0x0610('0xa2')]));if(!this['isConfigured'](_0x2b80bc[_0x0610('0xa9')])){return this['channel'][_0x0610('0xa3')](_0x0610('0xaa'));}var _0x5258e1=_0x2b80bc[_0x0610('0xa9')];if(this[_0x0610('0x9d')](_0x2b80bc[_0x0610('0x74')])){_0x5258e1+=','+_0x2b80bc[_0x0610('0x74')];}var _0x431635=this[_0x0610('0x37')]['exec'](_0x0610('0xab'),_0x5258e1);if(_0x431635[_0x0610('0x99')]===-0x1){return _0x431635;}var _0x3c2723=this[_0x0610('0x98')](_0x0610('0xac'),_0x0610('0xad'));if(_0x3c2723[_0x0610('0x99')]===-0x1){return _0x3c2723;}var _0x5d48c6=this[_0x0610('0x98')](_0x0610('0xae'),_0x0610('0xaf'));if(_0x5d48c6['result']===-0x1){return _0x5d48c6;}var _0x254d12=this['getAndSetVariable'](_0x0610('0xb0'),_0x0610('0xb1'));if(_0x254d12[_0x0610('0x99')]===-0x1){return _0x254d12;}return this[_0x0610('0x37')]['noop'](util['format'](_0x0610('0xb2'),_0x5258e1));};AGIVertices['prototype'][_0x0610('0x9')]=function(_0x2a8527){logger[_0x0610('0x2d')](util[_0x0610('0x51')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x2a8527[_0x0610('0xa2')]));return this[_0x0610('0x37')]['agi']([_0x2a8527[_0x0610('0xb3')],_0x2a8527[_0x0610('0xb4')]]);};AGIVertices['prototype'][_0x0610('0xb5')]=function(_0x19b1db){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0xb6'),_0x19b1db[_0x0610('0xa2')]));if(this[_0x0610('0x9d')](_0x19b1db[_0x0610('0x63')])){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0xb7'),_0x19b1db['timeout']));var _0x1649af=this[_0x0610('0x37')][_0x0610('0xb8')](_0x19b1db['timeout']);if(_0x1649af[_0x0610('0x99')]===-0x1){return _0x1649af;}}return this[_0x0610('0x37')][_0x0610('0xb5')]();};AGIVertices['prototype']['callback']=function(_0x43de64){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0xb9'),_0x43de64[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x43de64[_0x0610('0xba')])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x43de64,_0x0610('0xbb'));}_0x43de64[_0x0610('0xbc')]=moment();if(this['isConfigured'](_0x43de64['delay'])){_0x43de64[_0x0610('0xbc')]=moment()[_0x0610('0xbd')](_0x43de64[_0x0610('0xbe')],'minutes');}if(!this[_0x0610('0x9d')](_0x43de64[_0x0610('0x4a')])){_0x43de64[_0x0610('0x4a')]=0x2;}this[_0x0610('0x42')][_0x0610('0x9f')](this,_0x43de64);return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x43de64['phone'],_0x43de64[_0x0610('0xba')],_0x43de64['scheduledAt']));};AGIVertices[_0x0610('0x12')][_0x0610('0xbf')]=function(_0x2e9496){logger[_0x0610('0x2d')](util[_0x0610('0x51')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x2e9496[_0x0610('0xa2')]));var _0x598a0b=this['channel'][_0x0610('0x56')](_0x2e9496['application'],_0x2e9496[_0x0610('0x74')]);if(_0x598a0b[_0x0610('0x99')]===-0x1){return _0x598a0b;}return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xc0'),_0x2e9496[_0x0610('0xc1')],_0x2e9496['options']));};AGIVertices['prototype'][_0x0610('0xc2')]=function(_0x307fca){logger[_0x0610('0x2d')](util['format'](_0x0610('0xc3'),_0x307fca[_0x0610('0xa2')]));if(!this['isConfigured'](_0x307fca['text'])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0xa4'));}var _0x50710b='\x22'+_0x307fca['text']+'\x22';if(this['isConfigured'](_0x307fca['options'])){_0x50710b+=','+_0x307fca['options'];}var _0x5000d2=this['channel'][_0x0610('0x56')]('MRCPSynth',_0x50710b);if(_0x5000d2[_0x0610('0x99')]===-0x1){return _0x5000d2;}return this[_0x0610('0x37')]['noop'](util[_0x0610('0x51')](_0x0610('0xa6'),_0x50710b));};AGIVertices['prototype'][_0x0610('0xc4')]=function(_0x5eba74){logger['info'](util[_0x0610('0x51')](_0x0610('0xc5'),_0x5eba74[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x5eba74[_0x0610('0x5a')])){return this[_0x0610('0x37')]['noop'](_0x0610('0xa4'));}var _0x533e8d='\x22'+_0x5eba74[_0x0610('0x5a')]+'\x22';if(this[_0x0610('0x9d')](_0x5eba74[_0x0610('0x74')])){_0x533e8d+=','+_0x5eba74[_0x0610('0x74')];}var _0x4589c9=this['channel'][_0x0610('0x56')](_0x0610('0xa5'),_0x533e8d);if(_0x4589c9['result']===-0x1){return _0x4589c9;}return this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xa6'),_0x533e8d));};AGIVertices['prototype'][_0x0610('0xc6')]=function(_0xa7093e){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0xc7'),_0xa7093e['label']));if(!this['isConfigured'](_0xa7093e[_0x0610('0xa9')])){return this['channel']['noop'](_0x0610('0xaa'));}var _0x5b910c=_0xa7093e['grammar'];if(this[_0x0610('0x9d')](_0xa7093e[_0x0610('0x74')])){_0x5b910c+=','+_0xa7093e[_0x0610('0x74')];}var _0x25262f=this['channel'][_0x0610('0x56')](_0x0610('0xab'),_0x5b910c);if(_0x25262f[_0x0610('0x99')]===-0x1){return _0x25262f;}var _0x57ced7=this[_0x0610('0x98')]('RECOG_CONFIDENCE()',_0x0610('0xc8'));if(_0x57ced7[_0x0610('0x99')]===-0x1){return _0x57ced7;}var _0x5f82db=this[_0x0610('0x98')](_0x0610('0xae'),_0x0610('0xc9'));if(_0x5f82db[_0x0610('0x99')]===-0x1){return _0x5f82db;}var _0x4bccc6=this[_0x0610('0x98')](_0x0610('0xb0'),_0x0610('0xca'));if(_0x4bccc6['result']===-0x1){return _0x4bccc6;}return this[_0x0610('0x37')]['noop'](util[_0x0610('0x51')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5b910c));};AGIVertices['prototype'][_0x0610('0xcb')]=function(_0x2ef5fe){logger['info'](util['format'](_0x0610('0xcc'),_0x2ef5fe['label']));if(!this['isConfigured'](_0x2ef5fe['grammar'])){return this[_0x0610('0x37')]['noop'](_0x0610('0xaa'));}var _0x5e27f5=_0x2ef5fe['grammar'];if(this['isConfigured'](_0x2ef5fe['options'])){_0x5e27f5+=','+_0x2ef5fe[_0x0610('0x74')];}var _0x2a7bc3=this[_0x0610('0x37')][_0x0610('0x56')](_0x0610('0xab'),_0x5e27f5);if(_0x2a7bc3[_0x0610('0x99')]===-0x1){return _0x2a7bc3;}var _0x7c8579=this[_0x0610('0x98')](_0x0610('0xac'),'SESTEK_ASR_CONFIDENCE');if(_0x7c8579['result']===-0x1){return _0x7c8579;}var _0x2787cf=this[_0x0610('0x98')](_0x0610('0xae'),_0x0610('0xcd'));if(_0x2787cf[_0x0610('0x99')]===-0x1){return _0x2787cf;}var _0x3d0cad=this[_0x0610('0x98')](_0x0610('0xb0'),_0x0610('0xce'));if(_0x3d0cad[_0x0610('0x99')]===-0x1){return _0x3d0cad;}return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xb2'),_0x5e27f5));};AGIVertices[_0x0610('0x12')]['database']=function(_0x457eee){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0xcf'),_0x457eee[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x457eee[_0x0610('0xd0')])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x457eee,_0x0610('0xd1'));}var _0x147454=this['getSquareOdbc'][_0x0610('0x9f')](this,_0x457eee[_0x0610('0xd0')]);if(!_0x147454){return this['channel'][_0x0610('0x33')](_0x457eee,'no\x20odbc\x20database\x20found');}if(!this[_0x0610('0x9d')](_0x457eee[_0x0610('0x2f')])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x457eee,'no\x20query\x20configured');}var _0x2dd2f5=_0x457eee[_0x0610('0x2f')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xd2'),_0x2dd2f5));var _0x52ea0b=this['getQueryOdbc'][_0x0610('0x9f')](this,_0x147454,_0x2dd2f5);this['createSquareDetailsReport'][_0x0610('0x9f')](this,_0x457eee,_0x2dd2f5);if(!this[_0x0610('0x9d')](_0x457eee[_0x0610('0xd3')])){return this[_0x0610('0x37')][_0x0610('0xa3')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0xda77f1=this['getVariable'][_0x0610('0x9f')](this,_0x457eee[_0x0610('0xd3')]);if(!_0xda77f1){return this[_0x0610('0x37')][_0x0610('0x33')](_0x457eee,_0x0610('0xd4'));}var _0x8045fc=this;_0x52ea0b[_0x0610('0xd5')](function(_0x4547ac,_0x16d103){Object[_0x0610('0xd6')](_0x4547ac)[_0x0610('0xd5')](function(_0xb72ce6){_0x8045fc['channel'][_0x0610('0x9c')](util['format'](_0x0610('0xd7'),_0xda77f1,_0x16d103,_0xb72ce6),_0x4547ac[_0xb72ce6]);});});this['channel'][_0x0610('0x9c')](util[_0x0610('0x51')]('%s_ROWS_COUNT',_0xda77f1),_0x52ea0b[_0x0610('0x91')]);return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')]('variable\x20%s\x20set',_0xda77f1));};AGIVertices[_0x0610('0x12')][_0x0610('0xd8')]=function(_0x3e6e99){logger[_0x0610('0xd9')](util['format'](_0x0610('0xda'),_0x3e6e99[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x3e6e99[_0x0610('0xdb')])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x3e6e99,'no\x20user\x20selected');}var _0x4a517a=this[_0x0610('0x1d')][_0x0610('0x9f')](this,_0x3e6e99[_0x0610('0xdb')]);if(!_0x4a517a){return this[_0x0610('0x37')][_0x0610('0x33')](_0x3e6e99,_0x0610('0xdc'));}var _0x4ed992=this[_0x0610('0x37')][_0x0610('0x56')](_0x0610('0xdd'),[util[_0x0610('0x51')](_0x0610('0xde'),_0x4a517a),_0x3e6e99[_0x0610('0x63')],_0x3e6e99['opts'],_0x3e6e99['url']]);if(_0x4ed992[_0x0610('0x99')]===-0x1){return _0x4ed992;}return this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xdf'),_0x0610('0xdd')));};AGIVertices[_0x0610('0x12')][_0x0610('0xe0')]=function(_0x3aef25){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0xe1'),_0x3aef25[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x3aef25[_0x0610('0x7a')])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0xe2'));}if(!this[_0x0610('0x9d')](_0x3aef25[_0x0610('0x5a')])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0xa4'));}this[_0x0610('0x37')][_0x0610('0xe3')]=!![];this[_0x0610('0x36')](_0x3aef25);this['createSquareMessage'](_0x3aef25[_0x0610('0x5a')],'in','','');this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xe4'),_0x3aef25[_0x0610('0x5a')]));var _0x59ac8f=this[_0x0610('0xe5')][_0x0610('0x9f')](this,_0x3aef25);if(_0x59ac8f){for(var _0x4554d0 in _0x59ac8f){if(_0x59ac8f[_0x0610('0x8f')](_0x4554d0)){this[_0x0610('0x37')]['setVariable'](util['format'](_0x0610('0xe6'),_0x4554d0['toUpperCase']()),_0x59ac8f[_0x4554d0]);}}this['createSquareMessage'](_0x59ac8f[_0x0610('0xe7')],'out',_0x0610('0xe0'),'');return this[_0x0610('0x37')]['noop'](util[_0x0610('0x51')](_0x0610('0xe8'),_0x59ac8f['speech']));}return this['channel'][_0x0610('0x33')](_0x3aef25,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x0610('0x12')][_0x0610('0xe9')]=function(_0x216441){logger[_0x0610('0x2d')](util[_0x0610('0x51')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x216441[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x216441[_0x0610('0xea')])){return this[_0x0610('0x37')]['noop'](_0x0610('0xeb'));}if(!this[_0x0610('0x9d')](_0x216441[_0x0610('0x76')])){return this['channel'][_0x0610('0xa3')](_0x0610('0xec'));}if(!this[_0x0610('0x9d')](_0x216441[_0x0610('0xed')])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0xee'));}if(!this[_0x0610('0x9d')](_0x216441[_0x0610('0x77')])){return this[_0x0610('0x37')][_0x0610('0xa3')]('no\x20anguage\x20configured');}if(!this['isConfigured'](_0x216441[_0x0610('0x5a')])){return this['channel'][_0x0610('0xa3')](_0x0610('0xa4'));}this[_0x0610('0x37')][_0x0610('0xe3')]=!![];this[_0x0610('0x36')](_0x216441);this['createSquareMessage'](_0x216441[_0x0610('0x5a')],'in','','');this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xef'),_0x216441[_0x0610('0x5a')]));var _0x590d0d=this[_0x0610('0x75')][_0x0610('0x9f')](this,_0x216441);if(_0x590d0d){for(var _0x20e347 in _0x590d0d){if(_0x590d0d['hasOwnProperty'](_0x20e347)){if(_0x20e347!=='providerResponse'){this[_0x0610('0x37')][_0x0610('0x9c')](util[_0x0610('0x51')](_0x0610('0xe6'),_0x20e347[_0x0610('0x66')]()),_0x590d0d[_0x20e347]);}}}this['createSquareMessage'](_0x590d0d['speech'],_0x0610('0xf0'),_0x0610('0xe9'),_0x590d0d[_0x0610('0xf1')]);return this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xf2'),_0x590d0d[_0x0610('0xe7')]));}return this[_0x0610('0x37')]['error'](_0x216441,_0x0610('0xf3'));};AGIVertices[_0x0610('0x12')][_0x0610('0xf4')]=function(_0x462161){logger[_0x0610('0x2d')](util['format']('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x462161['label']));if(!this[_0x0610('0x9d')](_0x462161[_0x0610('0xf5')])){return this[_0x0610('0x37')]['noop'](_0x0610('0xf6'));}if(!this[_0x0610('0x9d')](_0x462161[_0x0610('0xf7')])){return this[_0x0610('0x37')]['noop'](_0x0610('0xf8'));}if(!this[_0x0610('0x9d')](_0x462161[_0x0610('0xf9')])){return this[_0x0610('0x37')]['noop'](_0x0610('0xfa'));}if(!this[_0x0610('0x9d')](_0x462161['ndassistant_url'])){return this['channel'][_0x0610('0xa3')](_0x0610('0xa4'));}this['channel'][_0x0610('0xe3')]=!![];this[_0x0610('0x36')](_0x462161);this[_0x0610('0x41')](_0x462161['text'],'in','','');this['channel']['noop'](util[_0x0610('0x51')]('Trying\x20SestekNDA:\x20%s',_0x462161[_0x0610('0x5a')]));var _0x384dc3=this[_0x0610('0x78')][_0x0610('0x9f')](this,_0x462161);if(_0x384dc3){for(var _0x461a8a in _0x384dc3){if(_0x384dc3[_0x0610('0x8f')](_0x461a8a)){this[_0x0610('0x37')][_0x0610('0x9c')](util[_0x0610('0x51')](_0x0610('0xfb'),_0x461a8a[_0x0610('0x66')]()),_0x384dc3[_0x461a8a]);}}this[_0x0610('0x41')](_0x384dc3[_0x0610('0xe7')],_0x0610('0xf0'),_0x0610('0xf4'),'');if(_0x384dc3[_0x0610('0xfc')]){this['channel'][_0x0610('0xa3')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x384dc3[_0x0610('0xfc')]));var _0x34c006=this['channel'][_0x0610('0xfd')](_0x384dc3[_0x0610('0xfc')]);try{fs[_0x0610('0xfe')](_0x384dc3[_0x0610('0xfc')]+_0x0610('0xff'));}catch(_0xa1f99f){logger[_0x0610('0x33')](_0xa1f99f);}return _0x34c006;}else{return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x100'),_0x384dc3['speech']));}}return this[_0x0610('0x37')][_0x0610('0x33')](_0x462161,_0x0610('0x101'));};AGIVertices['prototype'][_0x0610('0x102')]=function(_0xdd50fa){logger['info'](util[_0x0610('0x51')](_0x0610('0x103'),_0xdd50fa[_0x0610('0xa2')]));return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0x102'));};AGIVertices['prototype'][_0x0610('0x104')]=function(_0x3cd372){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x105'),_0x3cd372['label']));var _0x3091d4='';if(_0x3cd372[_0x0610('0x106')]){if(!this[_0x0610('0x9d')](_0x3cd372[_0x0610('0x106')])){return this['channel'][_0x0610('0x33')](_0x3cd372,'no\x20trunk\x20selected');}else{var _0x3ef559=parseInt(_0x3cd372['trunk_id'],0xa);if(isNaN(_0x3ef559)){_0x3091d4=_0x3cd372[_0x0610('0x106')];}else{_0x3091d4=this[_0x0610('0x1f')][_0x0610('0x9f')](this,_0x3cd372['trunk_id']);if(!_0x3091d4){return this[_0x0610('0x37')][_0x0610('0x33')](_0x3cd372,'no\x20trunk\x20found');}}}}else if(_0x3cd372[_0x0610('0x107')]){_0x3091d4=_0x3cd372[_0x0610('0x107')];}else{return this['channel'][_0x0610('0x33')](_0x3cd372,_0x0610('0x108'));}var _0x365b7a=this[_0x0610('0x37')][_0x0610('0x56')](_0x0610('0xdd'),[util['format'](_0x0610('0x109'),_0x3091d4,_0x3cd372[_0x0610('0x46')]),_0x3cd372['timeout'],_0x3cd372[_0x0610('0x10a')],_0x3cd372[_0x0610('0x62')]]);if(_0x365b7a[_0x0610('0x99')]===-0x1){return _0x365b7a;}return this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xdf'),_0x0610('0xdd')));};AGIVertices['prototype']['finally']=function(_0x37f5e7){logger[_0x0610('0x2d')](util['format'](_0x0610('0x10b'),_0x37f5e7[_0x0610('0xa2')]));return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0x10c'));};AGIVertices[_0x0610('0x12')][_0x0610('0xe')]=function(_0x7f59be){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x10d'),_0x7f59be[_0x0610('0xa2')]));if(_0x7f59be[_0x0610('0x10e')]===0x0){return this[_0x0610('0x9e')](_0x7f59be);}_0x7f59be[_0x0610('0x10e')]-=0x1;if(!this[_0x0610('0x9d')](_0x7f59be[_0x0610('0x10f')])){return this[_0x0610('0x37')]['error'](_0x7f59be,'no\x20file\x20audio\x20selected');}var _0x3a5dc7=this['getSound']['sync'](this,_0x7f59be[_0x0610('0x10f')]);if(!_0x3a5dc7){return this[_0x0610('0x37')][_0x0610('0x33')](_0x7f59be,'no\x20file\x20audio\x20found');}if(!this[_0x0610('0x9d')](_0x7f59be[_0x0610('0xd3')])){return this[_0x0610('0x37')][_0x0610('0x33')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5602a6=this[_0x0610('0x37')][_0x0610('0x110')](_0x3a5dc7,_0x7f59be[_0x0610('0x111')],_0x7f59be[_0x0610('0x112')]);var _0x36077d=_0x5602a6[_0x0610('0x99')]?_0x5602a6[_0x0610('0x99')][_0x0610('0x49')]():'';logger['info'](_0x0610('0x113'),JSON[_0x0610('0x6e')](_0x5602a6));if(_0x5602a6[_0x0610('0x99')]===-0x1){this[_0x0610('0x36')][_0x0610('0x9f')](this,_0x7f59be,_0x36077d);return _0x5602a6;}else if(_0x5602a6['extra']===_0x0610('0x63')){_0x5602a6[_0x0610('0x99')]=_0x36077d['length']>=parseInt(_0x7f59be[_0x0610('0x114')])?'x':'i';}else{_0x5602a6[_0x0610('0x99')]=_0x36077d[_0x0610('0x91')]>=parseInt(_0x7f59be[_0x0610('0x114')])&&_0x36077d[_0x0610('0x91')]<=parseInt(_0x7f59be['maxdigit'])?'x':'i';}var _0xa8d63d=this[_0x0610('0x13')][_0x0610('0x9f')](this,_0x7f59be[_0x0610('0xd3')]);if(!_0xa8d63d){return this[_0x0610('0x37')][_0x0610('0x33')](_0x7f59be,'no\x20variable\x20found');}this['channel'][_0x0610('0x9c')](_0xa8d63d,_0x36077d);if(this['isConfigured'](_0x7f59be[_0x0610('0x115')])){var _0x48b940=parseInt(_0x7f59be['hiddendigitsnum'],0xa);var _0x3a4d6c=rs['generate']({'charset':'*','length':_0x48b940});var _0x159bf3=_0x36077d[_0x0610('0x91')];if(_0x159bf3>0x0){if(_0x159bf3>_0x48b940){this[_0x0610('0x36')]['sync'](this,_0x7f59be,_0x7f59be[_0x0610('0x116')]===_0x0610('0x117')?_0x3a4d6c+_0x36077d[_0x0610('0x118')](_0x48b940):_0x36077d[_0x0610('0x118')](0x0,_0x159bf3-_0x48b940)+_0x3a4d6c);}else{this[_0x0610('0x36')][_0x0610('0x9f')](this,_0x7f59be,rs[_0x0610('0x119')]({'charset':'*','length':_0x159bf3}));}}else{this[_0x0610('0x36')][_0x0610('0x9f')](this,_0x7f59be,'');}}else{this[_0x0610('0x36')][_0x0610('0x9f')](this,_0x7f59be,_0x36077d);}return _0x5602a6;};AGIVertices[_0x0610('0x12')][_0x0610('0xf')]=function(_0xfa556d){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x11a'),_0xfa556d[_0x0610('0xa2')]));return this['getdigits'](_0xfa556d);};AGIVertices[_0x0610('0x12')]['goal']=function(_0x113abf){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x11b'),_0x113abf[_0x0610('0xa2')]));this[_0x0610('0x36')]['sync'](this,_0x113abf,_0x113abf['goalname']);return this[_0x0610('0x37')]['noop'](util['format'](_0x0610('0x11c'),_0x113abf['goalname']));};AGIVertices[_0x0610('0x12')][_0x0610('0x11d')]=function(_0x58ccbc){logger[_0x0610('0x2d')](util[_0x0610('0x51')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x58ccbc[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x58ccbc[_0x0610('0x7f')])||!this[_0x0610('0x9d')](_0x58ccbc['aws_secret_access_key'])){return this['channel'][_0x0610('0xa3')](_0x0610('0x11e'));}if(!this[_0x0610('0x9d')](_0x58ccbc['text'])){return this[_0x0610('0x37')][_0x0610('0xa3')]('no\x20text\x20configured');}this['channel']['noop'](util[_0x0610('0x51')](_0x0610('0x11f'),_0x58ccbc[_0x0610('0x5a')]));var _0x1d652f=this[_0x0610('0x120')][_0x0610('0x9f')](this,_0x58ccbc);if(_0x1d652f){this[_0x0610('0x37')][_0x0610('0xa3')](util['format'](_0x0610('0x121'),_0x1d652f));var _0x5c4e28=this['channel'][_0x0610('0xfd')](_0x1d652f);try{fs[_0x0610('0xfe')](_0x1d652f+_0x0610('0xff'));}catch(_0xc3bdde){logger[_0x0610('0x33')](_0xc3bdde);}return _0x5c4e28;}return this['channel']['error'](_0x58ccbc,_0x0610('0x122'));};AGIVertices[_0x0610('0x12')]['awslex']=function(_0x28d836){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x123'),_0x28d836['label']));if(!this[_0x0610('0x9d')](_0x28d836[_0x0610('0x7f')])||!this['isConfigured'](_0x28d836[_0x0610('0x80')])){return this[_0x0610('0x37')]['noop'](_0x0610('0x11e'));}if(!this[_0x0610('0x9d')](_0x28d836[_0x0610('0x124')])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0x125'));}if(!this[_0x0610('0x9d')](_0x28d836[_0x0610('0x5a')])){return this[_0x0610('0x37')][_0x0610('0xa3')]('no\x20text\x20configured');}this['channel'][_0x0610('0xe3')]=!![];this[_0x0610('0x36')](_0x28d836);this[_0x0610('0x41')](_0x28d836[_0x0610('0x5a')],'in','','');this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x126'),_0x28d836[_0x0610('0x5a')]));var _0x58d803=this['awsLex'][_0x0610('0x9f')](this,_0x28d836);if(_0x58d803){for(var _0xb045eb in _0x58d803){if(_0x58d803[_0x0610('0x8f')](_0xb045eb)&&_['isString'](_0x58d803[_0xb045eb])){this[_0x0610('0x37')][_0x0610('0x9c')](util['format'](_0x0610('0x127'),_0xb045eb[_0x0610('0x66')]()),_0x58d803[_0xb045eb]);}}if(_[_0x0610('0x44')](_0x58d803[_0x0610('0x72')])){return this[_0x0610('0x37')][_0x0610('0xa3')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x0610('0x41')](_0x58d803[_0x0610('0x72')],_0x0610('0xf0'),_0x0610('0x128'),'');return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x129'),_0x58d803[_0x0610('0x72')]));}}return this['channel'][_0x0610('0x33')](_0x28d836,_0x0610('0x12a'));};AGIVertices['prototype'][_0x0610('0x12b')]=function(_0x28c064){logger[_0x0610('0x2d')](util['format'](_0x0610('0x12c'),_0x28c064[_0x0610('0xa2')],_0x28c064['timeout']));if(!this[_0x0610('0x9d')](_0x28c064[_0x0610('0x7a')])){return this['channel']['noop']('no\x20key\x20configured');}var _0x5a04c3=_0x0610('0x12d');var _0x320cb1=util[_0x0610('0x51')](_0x0610('0x12e'),FILES_PATH,rs['generate'](0x4));var _0x1084a0=util[_0x0610('0x51')]('%s.%s',_0x320cb1,_0x5a04c3);var _0x539354=!![];if(_0x28c064['beep']===_0x0610('0x12f')){_0x539354=![];}var _0x3a17cd=this[_0x0610('0x37')][_0x0610('0x130')](_0x320cb1,_0x5a04c3,_0x28c064[_0x0610('0x131')],_0x28c064['timeout'],undefined,_0x539354);if(_0x3a17cd['result']!==-0x1){this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x132'),_0x1084a0));var _0x1531cd=this[_0x0610('0x85')]['sync'](this,_0x28c064,_0x1084a0);if(_0x1531cd){for(var _0x1f92ea in _0x1531cd){if(_0x1531cd[_0x0610('0x8f')](_0x1f92ea)){this[_0x0610('0x37')]['setVariable'](util['format'](_0x0610('0x133'),_0x1f92ea['toUpperCase']()),_0x1531cd[_0x1f92ea]);}}return this['channel']['noop'](util[_0x0610('0x51')]('GoogleASR\x20Result\x20%s',JSON[_0x0610('0x6e')](_0x1531cd)));}}return _0x3a17cd;};AGIVertices[_0x0610('0x12')][_0x0610('0x134')]=function(_0x2c035c){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x135'),_0x2c035c[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x2c035c[_0x0610('0x87')])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0x136'));}if(!this[_0x0610('0x9d')](_0x2c035c[_0x0610('0x88')])){return this['channel'][_0x0610('0xa3')](_0x0610('0x137'));}var _0x9a5698=_0x0610('0x12d');var _0x662d2c=util[_0x0610('0x51')](_0x0610('0x12e'),FILES_PATH,rs[_0x0610('0x119')](0x4));var _0x5c0ec7=util[_0x0610('0x51')](_0x0610('0x95'),_0x662d2c,_0x9a5698);var _0x1d2306=!![];if(_0x2c035c['beep']===_0x0610('0x12f')){_0x1d2306=![];}var _0x389191=this[_0x0610('0x37')]['recordFile'](_0x662d2c,_0x9a5698,_0x2c035c[_0x0610('0x131')],_0x2c035c[_0x0610('0x63')],undefined,_0x1d2306);if(_0x389191['result']!==-0x1){this['channel']['noop'](util[_0x0610('0x51')](_0x0610('0x138'),_0x5c0ec7));var _0x4feb18=this[_0x0610('0x86')][_0x0610('0x9f')](this,_0x2c035c,_0x5c0ec7);if(_0x4feb18){for(var _0x566350 in _0x4feb18){if(_0x4feb18['hasOwnProperty'](_0x566350)){this[_0x0610('0x37')][_0x0610('0x9c')](util['format'](_0x0610('0x139'),_0x566350[_0x0610('0x66')]()),_0x4feb18[_0x566350]);}}return this[_0x0610('0x37')]['noop'](util[_0x0610('0x51')]('TildeASR\x20Result\x20%s',JSON['stringify'](_0x4feb18)));}}return _0x389191;};AGIVertices[_0x0610('0x12')]['gotoc']=function(_0x2cef0b){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x13a'),_0x2cef0b[_0x0610('0xa2')]));return this[_0x0610('0x37')][_0x0610('0x13b')](_0x2cef0b['context'],_0x2cef0b['extension'],_0x2cef0b[_0x0610('0x3e')]);};AGIVertices[_0x0610('0x12')][_0x0610('0x13c')]=function(_0xa777e3){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x13d'),_0xa777e3[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0xa777e3[_0x0610('0x13e')])){return this[_0x0610('0x37')][_0x0610('0x33')](_0xa777e3,_0x0610('0x13f'));}try{var _0x55701b=eval(_0xa777e3['condition'])?'true':'false';this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x140'),_0xa777e3[_0x0610('0x13e')],_0x55701b));return{'code':0xc8,'result':_0x55701b};}catch(_0x4d9617){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x0610('0x12')][_0x0610('0x141')]=function(_0x14c81c){logger[_0x0610('0x2d')](util['format'](_0x0610('0x142'),_0x14c81c[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x14c81c[_0x0610('0x143')])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x14c81c,_0x0610('0x144'));}var _0x32dafe=this[_0x0610('0x145')][_0x0610('0x9f')](this,_0x14c81c[_0x0610('0x143')]);if(!_0x32dafe){return this[_0x0610('0x37')][_0x0610('0x33')](_0x14c81c,_0x0610('0x146'));}for(var _0x2b6d1e=0x0;_0x2b6d1e<_0x32dafe[_0x0610('0x91')];_0x2b6d1e+=0x1){var _0x445450=this['channel'][_0x0610('0x13')](util['format'](_0x0610('0x147'),_0x32dafe[_0x2b6d1e]));if(_0x445450[_0x0610('0x99')]===-0x1){return _0x445450;}logger['info'](util['format'](_0x0610('0x148'),_0x32dafe[_0x2b6d1e],_0x445450['extra']));if(_0x445450[_0x0610('0x9b')]==='true'){logger['info'](util[_0x0610('0x51')]('IFTIME\x20%s\x20%s',_0x32dafe[_0x2b6d1e],_0x0610('0x149')));this[_0x0610('0x37')][_0x0610('0xa3')](util['format']('IFTIME\x20%s\x20%s',_0x32dafe[_0x2b6d1e],_0x0610('0x149')));return{'code':0xc8,'result':'true'};}else{logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x148'),_0x32dafe[_0x2b6d1e],_0x0610('0x14a')));this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')]('IFTIME\x20%s\x20%s',_0x32dafe[_0x2b6d1e],_0x0610('0x14a')));}}return{'code':0xc8,'result':_0x0610('0x14a')};};AGIVertices['prototype'][_0x0610('0x14b')]=function(_0x22d381){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x14c'),_0x22d381[_0x0610('0xa2')]));return this[_0x0610('0x37')][_0x0610('0x14b')]();};AGIVertices[_0x0610('0x12')][_0x0610('0x14d')]=function(_0x1dd0ad){logger['info'](util['format'](_0x0610('0x14e'),_0x1dd0ad[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x1dd0ad[_0x0610('0x7a')])){return this[_0x0610('0x37')]['noop']('no\x20key\x20configured');}var _0x57c6ae=_0x0610('0x12d');var _0x256014=util['format'](_0x0610('0x12e'),FILES_PATH,rs[_0x0610('0x119')](0x4));var _0xc9f209=util['format'](_0x0610('0x95'),_0x256014,_0x57c6ae);var _0x480eb4=!![];if(_0x1dd0ad['beep']==='NOBEEP'){_0x480eb4=![];}var _0x2a93b4=this['channel'][_0x0610('0x130')](_0x256014,_0x57c6ae,_0x1dd0ad[_0x0610('0x131')],_0x1dd0ad['timeout'],undefined,_0x480eb4);if(_0x2a93b4['result']!==-0x1){this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x14f'),_0xc9f209));var _0x50a5d8=this['ispeechASR'][_0x0610('0x9f')](this,_0x1dd0ad,_0xc9f209);if(_0x50a5d8){for(var _0x9cfa4e in _0x50a5d8){if(_0x50a5d8[_0x0610('0x8f')](_0x9cfa4e)){this[_0x0610('0x37')][_0x0610('0x9c')](util['format'](_0x0610('0x150'),_0x9cfa4e[_0x0610('0x66')]()),_0x50a5d8[_0x9cfa4e]);}}return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x151'),JSON[_0x0610('0x6e')](_0x50a5d8)));}}return _0x2a93b4;};AGIVertices[_0x0610('0x12')][_0x0610('0x152')]=function(_0x23de5c){logger[_0x0610('0x2d')](util['format'](_0x0610('0x153'),_0x23de5c[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x23de5c[_0x0610('0x7a')])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0xe2'));}if(!this['isConfigured'](_0x23de5c['text'])){return this['channel'][_0x0610('0xa3')](_0x0610('0xa4'));}this['channel'][_0x0610('0xa3')](util['format'](_0x0610('0x154'),_0x23de5c[_0x0610('0x5a')]));var _0x1d9bde=this[_0x0610('0x79')][_0x0610('0x9f')](this,_0x23de5c);if(_0x1d9bde){this[_0x0610('0x37')][_0x0610('0xa3')](util['format'](_0x0610('0x14f'),_0x1d9bde));var _0x560084=this[_0x0610('0x37')][_0x0610('0xfd')](_0x1d9bde,_0x23de5c[_0x0610('0x131')]);try{fs[_0x0610('0xfe')](_0x1d9bde+_0x0610('0xff'));}catch(_0x48882a){logger['error'](_0x48882a);}return _0x560084;}return this[_0x0610('0x37')]['error'](_0x23de5c,_0x0610('0x155'));};AGIVertices[_0x0610('0x12')]['login']=function(_0xb8a2ba){logger[_0x0610('0x2d')](util[_0x0610('0x51')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0xb8a2ba[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0xb8a2ba[_0x0610('0x156')])){return this[_0x0610('0x37')]['error'](_0xb8a2ba,_0x0610('0x157'));}logger[_0x0610('0x2d')](util[_0x0610('0x51')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0xb8a2ba['findBy']));var _0xe9ec86=this[_0x0610('0x54')][_0x0610('0x9f')](this,_0xb8a2ba[_0x0610('0x156')]);if(_0xe9ec86){logger[_0x0610('0x2d')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0xb8a2ba[_0x0610('0x156')]));this[_0x0610('0x37')]['noop'](util[_0x0610('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0610('0x37')]['callerid'],_0xb8a2ba[_0x0610('0x156')]));return{'code':0xc8,'result':_0x0610('0x158')};}else{logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x159'),this[_0x0610('0x37')][_0x0610('0x3b')],_0xb8a2ba[_0x0610('0x156')]));this[_0x0610('0x37')][_0x0610('0xa3')](util['format'](_0x0610('0x159'),this['channel'][_0x0610('0x3b')],_0xb8a2ba[_0x0610('0x156')]));return{'code':0xc8,'result':_0x0610('0x15a')};}};AGIVertices['prototype'][_0x0610('0x15b')]=function(_0x12dd35){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x15c'),_0x12dd35[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x12dd35['findBy'])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x12dd35,'no\x20find\x20by\x20configured');}logger[_0x0610('0x2d')](util['format'](_0x0610('0x15d'),this[_0x0610('0x37')]['callerid'],_0x12dd35[_0x0610('0x156')]));var _0x6ff26d=this['agentLogout'][_0x0610('0x9f')](this,_0x12dd35['findBy']);if(_0x6ff26d){logger[_0x0610('0x2d')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x0610('0x37')][_0x0610('0x3b')],_0x12dd35[_0x0610('0x156')]));this['channel']['noop'](util[_0x0610('0x51')](_0x0610('0x15e'),this[_0x0610('0x37')][_0x0610('0x3b')],_0x12dd35['findBy']));return{'code':0xc8,'result':_0x0610('0x158')};}else{logger[_0x0610('0x2d')](util[_0x0610('0x51')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x0610('0x3b')],_0x12dd35[_0x0610('0x156')]));this[_0x0610('0x37')]['noop'](util[_0x0610('0x51')](_0x0610('0x159'),this[_0x0610('0x37')]['callerid'],_0x12dd35['findBy']));return{'code':0xc8,'result':_0x0610('0x15a')};}};AGIVertices[_0x0610('0x12')][_0x0610('0x15f')]=function(_0x4dbd8e){logger[_0x0610('0x2d')](util['format'](_0x0610('0x160'),_0x4dbd8e[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x4dbd8e[_0x0610('0x161')])){return this['channel'][_0x0610('0x33')](_0x4dbd8e,_0x0610('0x162'));}this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')]('math\x20%s',_0x4dbd8e[_0x0610('0x161')]));var _0x2e4dcc=eval(_0x4dbd8e[_0x0610('0x161')]);if(!this[_0x0610('0x9d')](_0x4dbd8e[_0x0610('0xd3')])){return this[_0x0610('0x37')]['noop'](_0x0610('0x163'));}var _0x4bd109=this[_0x0610('0x13')][_0x0610('0x9f')](this,_0x4dbd8e[_0x0610('0xd3')]);if(!_0x4bd109){return this[_0x0610('0x37')][_0x0610('0x33')](_0x4dbd8e,'no\x20variable\x20found');}if(_[_0x0610('0x90')](_0x2e4dcc)){var _0x5800ab=this;_0x2e4dcc['forEach'](function(_0x31bfd4,_0x2ea4c2){_0x5800ab[_0x0610('0x37')][_0x0610('0x9c')](util[_0x0610('0x51')](_0x0610('0x164'),_0x4bd109,_0x2ea4c2),_0x31bfd4);});return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')]('variable\x20%s[key]\x20set',_0x4bd109));}else{return this[_0x0610('0x37')][_0x0610('0x9c')](_0x4bd109,_0x2e4dcc);}};AGIVertices['prototype']['menu']=function(_0x142a3f){logger[_0x0610('0x2d')](util['format'](_0x0610('0x165'),_0x142a3f['label']));if(_0x142a3f['retry']===0x0){return this[_0x0610('0x9e')](_0x142a3f);}_0x142a3f[_0x0610('0x10e')]-=0x1;if(!this[_0x0610('0x9d')](_0x142a3f['file_id'])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x142a3f,_0x0610('0x166'));}var _0x1263fa=this[_0x0610('0x21')][_0x0610('0x9f')](this,_0x142a3f[_0x0610('0x10f')]);if(!_0x1263fa){return this['channel'][_0x0610('0x33')](_0x142a3f,_0x0610('0x167'));}var _0x3f5eaf=this['channel'][_0x0610('0x110')](_0x1263fa,_0x142a3f[_0x0610('0x111')],_0x142a3f[_0x0610('0x168')]);var _0xc213b3=_0x3f5eaf[_0x0610('0x99')];if(_0x3f5eaf[_0x0610('0x99')]===-0x1){this[_0x0610('0x36')][_0x0610('0x9f')](this,_0x142a3f,'-1');return _0x3f5eaf;}else if(_0x3f5eaf[_0x0610('0x9b')]===_0x0610('0x63')){_0x3f5eaf[_0x0610('0x99')]=_0x3f5eaf['result'][_0x0610('0x91')]>0x0?_0x3f5eaf['result']:'t';}else if(_[_0x0610('0x43')](_0x3f5eaf[_0x0610('0x99')])){_0x3f5eaf['result']='#';_0xc213b3='#';}if(!this[_0x0610('0x9d')](_0x142a3f['variable_id'])){this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0x163'));}else{var _0x12142f=this['getVariable'][_0x0610('0x9f')](this,_0x142a3f['variable_id']);if(!_0x12142f){return this['channel'][_0x0610('0x33')](_0x142a3f,_0x0610('0xd4'));}this[_0x0610('0x37')][_0x0610('0x9c')](_0x12142f,_0xc213b3);}this['createSquareDetailsReport'][_0x0610('0x9f')](this,_0x142a3f,_0xc213b3);return _0x3f5eaf;};AGIVertices[_0x0610('0x12')]['noop']=function(_0x2eaa3d){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x169'),_0x2eaa3d[_0x0610('0xa2')]));return this[_0x0610('0x37')]['noop'](_0x2eaa3d[_0x0610('0x16a')]||_0x2eaa3d[_0x0610('0xa2')]);};AGIVertices['prototype']['pause']=function(_0x50217a){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x16b'),_0x50217a[_0x0610('0xa2')]));if(!this['isConfigured'](_0x50217a[_0x0610('0x156')])){return this['channel'][_0x0610('0x33')](_0x50217a,_0x0610('0x157'));}logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x15d'),this[_0x0610('0x37')][_0x0610('0x3b')],_0x50217a['findBy']));var _0x9f9577=this[_0x0610('0x4b')][_0x0610('0x9f')](this,_0x50217a[_0x0610('0x16c')]);var _0x9b0df7=this[_0x0610('0x4c')][_0x0610('0x9f')](this,_0x50217a[_0x0610('0x156')],_0x9f9577);if(_0x9b0df7){logger['info'](util[_0x0610('0x51')](_0x0610('0x15e'),this[_0x0610('0x37')]['callerid'],_0x50217a[_0x0610('0x156')]));this[_0x0610('0x37')][_0x0610('0xa3')](util['format'](_0x0610('0x15e'),this[_0x0610('0x37')][_0x0610('0x3b')],_0x50217a['findBy']));return{'code':0xc8,'result':_0x0610('0x158')};}else{logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x159'),this[_0x0610('0x37')][_0x0610('0x3b')],_0x50217a[_0x0610('0x156')]));this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x15e'),this[_0x0610('0x37')][_0x0610('0x3b')],_0x50217a[_0x0610('0x156')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x0610('0x12')][_0x0610('0x16d')]=function(_0x525530){logger['info'](util[_0x0610('0x51')](_0x0610('0x16e'),_0x525530[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x525530[_0x0610('0x10f')])){return this['channel']['error'](_0x525530,'no\x20file\x20audio\x20selected');}var _0x2467b4=this[_0x0610('0x21')]['sync'](this,_0x525530[_0x0610('0x10f')]);if(!_0x2467b4){return this['channel']['error'](_0x525530,_0x0610('0x167'));}var _0x3610a2=this[_0x0610('0x37')][_0x0610('0x56')](_0x0610('0x16f'),[_0x2467b4,_0x525530[_0x0610('0x10a')]]);if(_0x3610a2[_0x0610('0x99')]===-0x1){return _0x3610a2;}return this['channel'][_0x0610('0xa3')](util['format'](_0x0610('0xc0'),_0x0610('0x16f'),_0x2467b4));};AGIVertices['prototype'][_0x0610('0x170')]=function(_0x46a775){logger[_0x0610('0x2d')](util[_0x0610('0x51')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x46a775[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x46a775[_0x0610('0x171')])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x46a775,'no\x20queue\x20selected');}var _0x3da237='';var _0x13a988=parseInt(_0x46a775['queue_id'],0xa);if(isNaN(_0x13a988)){_0x3da237=_0x46a775[_0x0610('0x171')];}else{_0x3da237=this[_0x0610('0x18')]['sync'](this,_0x46a775['queue_id']);if(!_0x3da237){return this['channel'][_0x0610('0x33')](_0x46a775,_0x0610('0x172'));}}var _0x48ee49='';if(this[_0x0610('0x9d')](_0x46a775['file_id'])){var _0x453a96=this[_0x0610('0x21')][_0x0610('0x9f')](this,_0x46a775[_0x0610('0x10f')]);if(_0x453a96){_0x48ee49=_0x453a96;}}this[_0x0610('0x36')]['sync'](this,_0x46a775,_0x3da237);if(_0x46a775[_0x0610('0x10a')]['indexOf']('x')<0x0){_0x46a775[_0x0610('0x10a')]+='x';}if(_0x46a775[_0x0610('0x10a')][_0x0610('0x173')]('X')<0x0){_0x46a775[_0x0610('0x10a')]+='X';}this[_0x0610('0x37')]['setVariable']('XMCS-QUEUE',_0x3da237?_0x3da237[_0x0610('0x174')]():'');var _0x2df9db=this[_0x0610('0x37')][_0x0610('0x56')]('QUEUE',[_0x3da237,_0x46a775[_0x0610('0x10a')],_0x46a775['url'],_0x48ee49,_0x46a775[_0x0610('0x63')],_0x46a775[_0x0610('0x9')],_0x46a775[_0x0610('0x175')],_0x46a775['gosub'],'',_0x46a775[_0x0610('0x176')]]);if(_0x2df9db['result']===-0x1){return _0x2df9db;}return this[_0x0610('0x37')]['noop'](util[_0x0610('0x51')](_0x0610('0xc0'),_0x0610('0x177'),_0x3da237));};AGIVertices[_0x0610('0x12')]['record']=function(_0x566264){logger[_0x0610('0x2d')](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x566264[_0x0610('0xa2')]));var _0x5a63ef=_0x566264[_0x0610('0x178')]||'wav';var _0x527cd7=util['format'](_0x0610('0x179'),this['channel'][_0x0610('0x38')],rs[_0x0610('0x119')](0x5));var _0x3df0bf=util[_0x0610('0x51')]('%s/recordings/%s.%s',FILES_PATH,_0x527cd7,_0x5a63ef);var _0x444de7=util[_0x0610('0x51')](_0x0610('0x12e'),FILES_PATH,_0x527cd7);this['createSquareRecording'][_0x0610('0x9f')](this,_0x566264,_0x527cd7,_0x3df0bf);this[_0x0610('0x37')][_0x0610('0x9c')]('RECORDING_SAVENAME',_0x527cd7);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x444de7,_0x5a63ef,_0x566264['escape_digits'],_0x566264[_0x0610('0x63')]);return this[_0x0610('0x37')][_0x0610('0x130')](_0x444de7,_0x5a63ef,_0x566264['escape_digits'],_0x566264[_0x0610('0x63')],undefined,!![]);};AGIVertices[_0x0610('0x12')][_0x0610('0x17a')]=function(_0x3a2707){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x17b'),_0x3a2707[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x3a2707[_0x0610('0x62')])){return this['channel'][_0x0610('0xa3')](_0x0610('0x17c'));}var _0x56b1d9=this[_0x0610('0x61')][_0x0610('0x9f')](this,_0x3a2707);logger['info'](util['format'](_0x0610('0x17d'),util['inspect'](_0x56b1d9,{'showHidden':![],'depth':null})));if(!this[_0x0610('0x9d')](_0x3a2707[_0x0610('0xd3')])){return this[_0x0610('0x37')][_0x0610('0xa3')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x2a735a=this[_0x0610('0x13')][_0x0610('0x9f')](this,_0x3a2707[_0x0610('0xd3')]);if(!_0x2a735a){return this[_0x0610('0x37')][_0x0610('0x33')](_0x3a2707,_0x0610('0xd4'));}this[_0x0610('0x37')][_0x0610('0x9c')](util['format']('%s_STATUS_CODE',_0x2a735a),_0x56b1d9['statusCode']?_0x56b1d9[_0x0610('0x70')]:_0x0610('0x17e'));this[_0x0610('0x37')][_0x0610('0x9c')](util['format'](_0x0610('0x17f'),_0x2a735a),_0x56b1d9[_0x0610('0x71')]?_0x56b1d9['statusMessage']:'OK');if(_0x56b1d9['body']){try{this[_0x0610('0x94')](_0x56b1d9[_0x0610('0x67')],_0x2a735a);}catch(_0x4d4f84){logger['error'](util[_0x0610('0x51')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x2a735a));}}return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x180'),_0x2a735a));};AGIVertices[_0x0610('0x12')][_0x0610('0x181')]=function(_0x23e5a5){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x182'),_0x23e5a5['label']));return this[_0x0610('0x37')][_0x0610('0x183')](_0x23e5a5[_0x0610('0x184')][_0x0610('0x57')](/\s+/g,''),_0x23e5a5[_0x0610('0x185')]);};AGIVertices[_0x0610('0x12')][_0x0610('0x186')]=function(_0x4fa000){logger['info'](util['format'](_0x0610('0x187'),_0x4fa000['label']));return this[_0x0610('0x37')]['sayNumber'](_0x4fa000[_0x0610('0x188')][_0x0610('0x57')](/\s+/g,''),_0x4fa000[_0x0610('0x185')]);};AGIVertices['prototype'][_0x0610('0x189')]=function(_0x3d93a7){logger[_0x0610('0x2d')](util['format'](_0x0610('0x18a'),_0x3d93a7['label']));return this[_0x0610('0x37')][_0x0610('0x18b')](_0x3d93a7[_0x0610('0x5a')],_0x3d93a7['escape_digits']);};AGIVertices[_0x0610('0x12')]['sendMail']=function(_0x4c9a11){logger[_0x0610('0x2d')](util['format']('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x4c9a11[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x4c9a11['account_id'])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0x18c'));}var _0x11110a=this[_0x0610('0x25')][_0x0610('0x9f')](this,_0x4c9a11[_0x0610('0x18d')]);if(!_0x11110a||!_0x11110a['Smtp']){return this[_0x0610('0x37')][_0x0610('0x33')](_0x4c9a11,_0x0610('0x18e'));}var _0x2ca888={'from':util[_0x0610('0x51')]('\x22%s\x22\x20<%s>',_0x11110a[_0x0610('0x16')],_0x11110a[_0x0610('0x18f')]||_0x11110a[_0x0610('0x190')][_0x0610('0x191')]),'to':_0x4c9a11['to']||'','cc':_0x4c9a11['cc']||'','bcc':_0x4c9a11['bcc']||'','subject':_0x4c9a11['subject'],'html':_0x4c9a11[_0x0610('0x5a')],'text':_0x4c9a11[_0x0610('0x5a')]};var _0x359e3d={'tls':{'rejectUnauthorized':![]}};if(_0x11110a['Smtp']['service']){_0x359e3d[_0x0610('0x192')]=_0x11110a['Smtp'][_0x0610('0x192')];}else{_0x359e3d[_0x0610('0x193')]=_0x11110a[_0x0610('0x190')][_0x0610('0x193')];_0x359e3d[_0x0610('0x194')]=_0x11110a[_0x0610('0x190')][_0x0610('0x194')];_0x359e3d['secure']=_0x11110a[_0x0610('0x190')][_0x0610('0x195')];}if(_0x11110a['Smtp'][_0x0610('0x196')]){_0x359e3d[_0x0610('0x197')]={'user':_0x11110a['Smtp'][_0x0610('0x191')],'pass':_0x11110a[_0x0610('0x190')]['pass']};}if(this[_0x0610('0x9d')](_0x4c9a11[_0x0610('0x198')])){}logger[_0x0610('0xd9')]('sendMail\x20message',JSON[_0x0610('0x6e')](_0x2ca888));this['createSquareDetailsReport']['sync'](this,_0x4c9a11,_0x4c9a11[_0x0610('0x18d')]);this[_0x0610('0x37')]['noop'](util[_0x0610('0x51')](_0x0610('0x199'),_0x11110a[_0x0610('0x16')]));this[_0x0610('0x26')][_0x0610('0x9f')](this,_0x359e3d,_0x2ca888);return this[_0x0610('0x37')][_0x0610('0xa3')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x0610('0x12')][_0x0610('0x19a')]=function(_0x146a5c){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x19b'),_0x146a5c[_0x0610('0xa2')]));return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0x19c'));};AGIVertices[_0x0610('0x12')]['sendSMS']=function(_0x59201d){logger['info'](util[_0x0610('0x51')](_0x0610('0x19d'),_0x59201d[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x59201d['sms_account_id'])){return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0x19e'));}var _0x4e1e9c=this[_0x0610('0x35')]['sync'](this,_0x59201d[_0x0610('0x19f')]);if(!_0x4e1e9c){return this['channel'][_0x0610('0x33')](_0x59201d,_0x0610('0x1a0'));}var _0x22f94f={'body':_0x59201d['sms_text'],'phone':_0x59201d['to']||'','SmsAccountId':_0x4e1e9c['id']};logger['debug'](_0x0610('0x1a1'),JSON[_0x0610('0x6e')](_0x22f94f));this['createSquareDetailsReport'][_0x0610('0x9f')](this,_0x59201d,_0x59201d[_0x0610('0x19f')]);this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x4e1e9c[_0x0610('0x16')]));this[_0x0610('0x1a2')][_0x0610('0x9f')](this,_0x22f94f);return this[_0x0610('0x37')][_0x0610('0xa3')](_0x0610('0x1a3'));};AGIVertices[_0x0610('0x12')][_0x0610('0x1a4')]=function(_0x2f412d){logger['info'](util['format'](_0x0610('0x1a5'),_0x2f412d[_0x0610('0xa2')]));if(!this['isConfigured'](_0x2f412d['variable_id'])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x2f412d,_0x0610('0x1a6'));}var _0x23d0b4=this['getVariable'][_0x0610('0x9f')](this,_0x2f412d[_0x0610('0xd3')]);if(!_0x23d0b4){return this[_0x0610('0x37')][_0x0610('0x33')](_0x2f412d,_0x0610('0xd4'));}return this['channel'][_0x0610('0x9c')](_0x23d0b4,_0x2f412d[_0x0610('0x1a7')]);};AGIVertices[_0x0610('0x12')][_0x0610('0x1a8')]=function(_0xf03411){logger['info'](util[_0x0610('0x51')](_0x0610('0x1a9'),_0xf03411[_0x0610('0xa2')]));this[_0x0610('0x37')][_0x0610('0xa3')]('START\x20CALLY\x20SQUARE');if(_0xf03411[_0x0610('0xb5')]===_0x0610('0x1aa')){this['channel'][_0x0610('0xa3')]('Answer');return this[_0x0610('0x37')][_0x0610('0xb5')]();}return this[_0x0610('0x37')][_0x0610('0xa3')]('Skipped\x20Answer');};AGIVertices[_0x0610('0x12')][_0x0610('0x1ab')]=function(_0x54e0fe){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x1ac'),_0x54e0fe[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x54e0fe[_0x0610('0x1ad')])){return this['channel'][_0x0610('0x33')](_0x54e0fe,'no\x20subproject\x20selected');}var _0x3deec2=this[_0x0610('0x1ae')][_0x0610('0x9f')](this,_0x54e0fe[_0x0610('0x1ad')]);if(!this[_0x0610('0x9d')](_0x3deec2)){return this[_0x0610('0x37')][_0x0610('0x33')](_0x54e0fe,util[_0x0610('0x51')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x54e0fe[_0x0610('0x1ad')]));}if(_0x3deec2===this[_0x0610('0x37')][_0x0610('0x3a')]){return this[_0x0610('0x37')][_0x0610('0x33')](_0x54e0fe,_0x0610('0x1af'));}this[_0x0610('0x36')]['sync'](this,_0x54e0fe,_0x3deec2);var _0x143a3d=this[_0x0610('0x37')][_0x0610('0x56')](_0x0610('0x1b0'),util['format']('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x0610('0x9')][_0x0610('0x193')]||_0x0610('0x1b1'),_0x3deec2,this[_0x0610('0x37')][_0x0610('0x3a')]));if(_0x143a3d['result']===-0x1){return _0x143a3d;}return this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xc0'),_0x0610('0x1b0'),_0x3deec2));};AGIVertices['prototype'][_0x0610('0x1b2')]=function(_0x3f85fc){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x1b3'),_0x3f85fc[_0x0610('0xa2')]));var _0x58c59a=this[_0x0610('0x55')][_0x0610('0x9f')](this,_0x3f85fc[_0x0610('0xb3')]);this[_0x0610('0x36')][_0x0610('0x9f')](this,_0x3f85fc,_0x3f85fc[_0x0610('0xb3')]);if(this[_0x0610('0x9d')](_0x3f85fc['variable_id'])){var _0x110366=this[_0x0610('0x13')][_0x0610('0x9f')](this,_0x3f85fc[_0x0610('0xd3')]);if(_0x110366){this['channel'][_0x0610('0x9c')](_0x110366,_0x58c59a);return this[_0x0610('0x37')]['noop'](util[_0x0610('0x51')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x3f85fc[_0x0610('0xb3')],_0x110366));}}return this[_0x0610('0x37')][_0x0610('0xa3')](util['format'](_0x0610('0x1b4'),_0x3f85fc['command']));};AGIVertices['prototype'][_0x0610('0x1b5')]=function(_0xbb328b){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x1b6'),_0xbb328b[_0x0610('0xa2')]));_0xbb328b[_0x0610('0x5a')]=_0xbb328b['text'][_0x0610('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0xbb328b[_0x0610('0x59')])){return this['channel'][_0x0610('0xa3')](_0x0610('0x1b7'));}if(!this[_0x0610('0x9d')](_0xbb328b[_0x0610('0x5a')])){return this['channel']['noop'](_0x0610('0xa4'));}this[_0x0610('0x37')][_0x0610('0xa3')](util['format'](_0x0610('0x1b8'),_0xbb328b['text']));var _0x3f78c1=this[_0x0610('0x58')]['sync'](this,_0xbb328b);if(_0x3f78c1){this['channel']['noop'](util['format'](_0x0610('0x1b9'),_0x3f78c1));var _0x4d0e2b=this[_0x0610('0x37')]['streamFile'](_0x3f78c1);try{fs[_0x0610('0xfe')](_0x3f78c1+_0x0610('0xff'));}catch(_0x451b7b){logger['error'](_0x451b7b);}return _0x4d0e2b;}return this[_0x0610('0x37')]['error'](_0xbb328b,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x0610('0x12')][_0x0610('0x1ba')]=function(_0x402606){logger[_0x0610('0x2d')](util[_0x0610('0x51')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x402606[_0x0610('0xa2')]));_0x402606['text']=_0x402606[_0x0610('0x5a')][_0x0610('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0610('0x9d')](_0x402606[_0x0610('0x5a')])){return this[_0x0610('0x37')][_0x0610('0xa3')]('no\x20text\x20configured');}this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x1bb'),_0x402606[_0x0610('0x5a')]));var _0x32273f=this['googleTTS'][_0x0610('0x9f')](this,_0x402606);if(_0x32273f){this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x1bc'),_0x32273f));var _0x1da2d6=this[_0x0610('0x37')]['streamFile'](_0x32273f);try{fs[_0x0610('0xfe')](_0x32273f+_0x0610('0xff'));}catch(_0x1f7db1){logger['error'](_0x1f7db1);}return _0x1da2d6;}return this[_0x0610('0x37')]['error'](_0x402606,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x0610('0x12')]['unpause']=function(_0x1880a4){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x1bd'),_0x1880a4['label']));if(!this[_0x0610('0x9d')](_0x1880a4[_0x0610('0x156')])){return this['channel'][_0x0610('0x33')](_0x1880a4,'no\x20find\x20by\x20configured');}logger[_0x0610('0x2d')](util[_0x0610('0x51')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x0610('0x37')][_0x0610('0x3b')],_0x1880a4[_0x0610('0x156')]));var _0x1a80b3=this[_0x0610('0x4e')][_0x0610('0x9f')](this,_0x1880a4[_0x0610('0x156')]);if(_0x1a80b3){logger[_0x0610('0x2d')](util[_0x0610('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x1880a4[_0x0610('0x156')]));this['channel'][_0x0610('0xa3')](util[_0x0610('0x51')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0610('0x37')][_0x0610('0x3b')],_0x1880a4[_0x0610('0x156')]));return{'code':0xc8,'result':_0x0610('0x158')};}else{logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x159'),this[_0x0610('0x37')][_0x0610('0x3b')],_0x1880a4[_0x0610('0x156')]));this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0x159'),this[_0x0610('0x37')]['callerid'],_0x1880a4[_0x0610('0x156')]));return{'code':0xc8,'result':_0x0610('0x15a')};}};AGIVertices['prototype'][_0x0610('0x1be')]=function(_0x1785c6){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x1bf'),_0x1785c6[_0x0610('0xa2')]));var _0x4e4ad9=this[_0x0610('0x37')]['exec'](_0x0610('0x1c0'),[_0x1785c6[_0x0610('0x1c1')],_0x1785c6[_0x0610('0x74')]]);if(_0x4e4ad9[_0x0610('0x99')]===-0x1){return _0x4e4ad9;}return this[_0x0610('0x37')][_0x0610('0xa3')](util[_0x0610('0x51')](_0x0610('0xc0'),'VOICEMAIL',_0x1785c6[_0x0610('0x1c1')]));};AGIVertices[_0x0610('0x12')]['vswitch']=function(_0x47ebd6){logger[_0x0610('0x2d')](util[_0x0610('0x51')](_0x0610('0x1c2'),_0x47ebd6[_0x0610('0xa2')]));if(!this[_0x0610('0x9d')](_0x47ebd6[_0x0610('0xd3')])){return this[_0x0610('0x37')][_0x0610('0x33')](_0x47ebd6,'no\x20variable\x20selected');}var _0x38e42c=this[_0x0610('0x13')][_0x0610('0x9f')](this,_0x47ebd6[_0x0610('0xd3')]);if(!_0x38e42c){return this[_0x0610('0x37')][_0x0610('0x33')](_0x47ebd6,_0x0610('0xd4'));}var _0x19701d=this['channel'][_0x0610('0x13')](_0x38e42c);return{'code':0xc8,'result':_0x19701d[_0x0610('0x9b')]?_0x19701d[_0x0610('0x9b')]:'-'};};String['prototype'][_0x0610('0x97')]=function(_0x414961,_0x573bca){return this[_0x0610('0x96')](_0x414961)['join'](_0x573bca);};module[_0x0610('0x1c3')]=AGIVertices; \ No newline at end of file +var _0x0630=['GoogleASR\x20Result\x20%s','no\x20appsecret\x20configured','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','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(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getData','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','subject','service','host','port','secure','authentication','pass','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','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','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','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','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','exports','path','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','getVariable','getVariableById','then','catch','prototype','getVoiceQueueById','getSquareProject','getSquareProjectById','name','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervalById','interval','format','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','dnid','file','createCmContact','isNil','callback_','isEmpty','lastName','scheduledAt','callback','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','internal','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','headers','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','odbc_id','no\x20odbc\x20database\x20found','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','toUpperCase','out','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','createSquareMessage','Trying\x20DialogflowV2:\x20%s','providerResponse','DIALOGFLOW_%s','speech','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','bot','SESTEK_NDA_%s','sesteknda','streamFile','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','first','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','NOBEEP','recordFile','google\x20%s\x20file\x20created','GOOGLE_ASR_%s'];(function(_0x693e61,_0x4d7901){var _0x2d7399=function(_0x5da049){while(--_0x5da049){_0x693e61['push'](_0x693e61['shift']());}};_0x2d7399(++_0x4d7901);}(_0x0630,0x9d));var _0x0063=function(_0x4cbe2c,_0x45d7f9){_0x4cbe2c=_0x4cbe2c-0x0;var _0x2b1b2f=_0x0630[_0x4cbe2c];return _0x2b1b2f;};'use strict';var fs=require('fs');var path=require(_0x0063('0x0'));var util=require(_0x0063('0x1'));var _=require(_0x0063('0x2'));var sh=require(_0x0063('0x3'));var odbc=require(_0x0063('0x4'))();var rs=require(_0x0063('0x5'));var moment=require(_0x0063('0x6'));var Mustache=require(_0x0063('0x7'));var rp=require(_0x0063('0x8'));var logger=require('../../config/logger')(_0x0063('0x9'));var config=require(_0x0063('0xa'));var scripts=require(_0x0063('0xb'));var FILES_PATH=_0x0063('0xc');var recursiveMapAttributes=[_0x0063('0xd'),'rawBody'];var verticesWithRetry=[_0x0063('0xe'),_0x0063('0xf'),_0x0063('0x10')];var AGIVertices=function(_0x5e8b11,_0xb31427,_0x18b37e){this[_0x0063('0x11')]=_0x5e8b11;this[_0x0063('0x12')]=_0xb31427;this['mailRpc']=_0x18b37e;};AGIVertices['prototype'][_0x0063('0x13')]=function(_0x34ee4a,_0x34dc70){this['rpc'][_0x0063('0x14')](_0x34ee4a)[_0x0063('0x15')](function(_0x102c17){_0x34dc70(null,_0x102c17?_0x102c17['name']:![]);})[_0x0063('0x16')](function(_0x1e89e0){_0x34dc70(_0x1e89e0);});};AGIVertices[_0x0063('0x17')]['getVoiceQueue']=function(_0xbb7440,_0x5acc1b){this[_0x0063('0x12')][_0x0063('0x18')](_0xbb7440)['then'](function(_0x2856ad){_0x5acc1b(null,_0x2856ad?_0x2856ad['name']:![]);})['catch'](function(_0x59d1b3){_0x5acc1b(_0x59d1b3);});};AGIVertices['prototype'][_0x0063('0x19')]=function(_0x135cc4,_0x2b0ccc){this[_0x0063('0x12')][_0x0063('0x1a')](_0x135cc4)['then'](function(_0x72239b){_0x2b0ccc(null,_0x72239b?_0x72239b[_0x0063('0x1b')]:![]);})['catch'](function(_0xb0704c){_0x2b0ccc(_0xb0704c);});};AGIVertices[_0x0063('0x17')][_0x0063('0x1c')]=function(_0x91a790,_0x3b7ce3){this[_0x0063('0x12')][_0x0063('0x1d')](_0x91a790)[_0x0063('0x15')](function(_0x45caea){_0x3b7ce3(null,_0x45caea?_0x45caea[_0x0063('0x1e')]:![]);})['catch'](function(_0x18c028){_0x3b7ce3(_0x18c028);});};AGIVertices[_0x0063('0x17')][_0x0063('0x1f')]=function(_0x420c0f,_0x564952){this['rpc'][_0x0063('0x20')](_0x420c0f)[_0x0063('0x15')](function(_0x1615f4){_0x564952(null,_0x1615f4?_0x1615f4[_0x0063('0x1b')]:![]);})[_0x0063('0x16')](function(_0x517f9a){_0x564952(_0x517f9a);});};AGIVertices[_0x0063('0x17')][_0x0063('0x21')]=function(_0x32cca1,_0x89af7e){this[_0x0063('0x12')]['getTrunkById'](_0x32cca1)['then'](function(_0x474c16){_0x89af7e(null,_0x474c16?_0x474c16[_0x0063('0x1b')]:![]);})[_0x0063('0x16')](function(_0x20efdb){_0x89af7e(_0x20efdb);});};AGIVertices['prototype']['getSound']=function(_0x3fdebb,_0x1a2d51){var _0x3a6e69=this;this[_0x0063('0x12')][_0x0063('0x22')](_0x3fdebb)[_0x0063('0x15')](function(_0x32c92a){_0x1a2d51(null,_0x32c92a?_0x3a6e69[_0x0063('0x23')](_0x32c92a[_0x0063('0x24')]):![]);})[_0x0063('0x16')](function(_0x6a03c2){_0x1a2d51(_0x6a03c2);});};AGIVertices[_0x0063('0x17')][_0x0063('0x25')]=function(_0x55ca2e,_0x53375c){this[_0x0063('0x12')][_0x0063('0x26')](_0x55ca2e)['then'](function(_0x2f9d28){_0x53375c(null,_0x2f9d28?_0x2f9d28:![]);})[_0x0063('0x16')](function(_0x5a988d){_0x53375c(_0x5a988d);});};AGIVertices[_0x0063('0x17')][_0x0063('0x27')]=function(_0x4d90fd,_0x310181,_0x29c1e0){this[_0x0063('0x28')][_0x0063('0x27')](_0x4d90fd,_0x310181)[_0x0063('0x15')](function(){_0x29c1e0(null);})[_0x0063('0x16')](function(_0x1836ae){_0x29c1e0(_0x1836ae);});};AGIVertices[_0x0063('0x17')]['getIntervals']=function(_0x4b795b,_0x2791ad){this[_0x0063('0x12')][_0x0063('0x29')](_0x4b795b)[_0x0063('0x15')](function(_0x2e5712){if(_0x2e5712){if(_0x2e5712['IntervalId']){_0x2791ad(null,[_0x2e5712[_0x0063('0x2a')]]);}else{_0x2791ad(null,_['map'](_0x2e5712['Intervals'],_0x0063('0x2a')));}}else{_0x2791ad(null,![]);}})['catch'](function(_0x1ae70b){_0x2791ad(_0x1ae70b);});};AGIVertices[_0x0063('0x17')][_0x0063('0x23')]=function(_0x499c1a){return util[_0x0063('0x2b')]('%s/sounds/converted/%s',FILES_PATH,_0x499c1a);};AGIVertices[_0x0063('0x17')][_0x0063('0x2c')]=function(_0x1f208b,_0xaa99bc,_0x5818d0){odbc[_0x0063('0x2d')](_0x1f208b,function(_0x1f2145){if(_0x1f2145){logger['error'](_0x0063('0x2e'),_0x1f2145);_0x5818d0(_0x1f2145);}else{logger[_0x0063('0x2f')](_0x0063('0x30'));odbc[_0x0063('0x31')](_0xaa99bc,function(_0x15cadb,_0x27d980){if(_0x15cadb){logger[_0x0063('0x2f')]('Error\x20executing\x20query\x20%s',_0xaa99bc);_0x5818d0(_0x15cadb);}else{logger['info'](_0x0063('0x32'),_0xaa99bc);odbc['close'](function(_0x2e38cd){if(_0x2e38cd){logger[_0x0063('0x33')](_0x0063('0x34'),_0x2e38cd);}_0x5818d0(null,_0x27d980);});}});}});};AGIVertices[_0x0063('0x17')][_0x0063('0x35')]=function(_0x49fb71,_0x14c9be){this['rpc'][_0x0063('0x36')](_0x49fb71)[_0x0063('0x15')](function(_0x46b6f3){_0x14c9be(null,_0x46b6f3?_0x46b6f3:![]);})['catch'](function(_0x35a728){_0x14c9be(_0x35a728);});};AGIVertices[_0x0063('0x17')][_0x0063('0x37')]=function(_0x4426d9,_0xb2935c){this[_0x0063('0x12')][_0x0063('0x37')](_0x4426d9)[_0x0063('0x15')](function(_0x556430){_0xb2935c(null,_0x556430);})[_0x0063('0x16')](function(_0x435b1f){_0xb2935c(_0x435b1f);});};AGIVertices['prototype'][_0x0063('0x38')]=function(_0x2afecd,_0x240aba,_0x126acf){this['rpc'][_0x0063('0x38')]({'uniqueid':this['channel'][_0x0063('0x39')],'node':_0x2afecd['label'],'application':_0x2afecd[_0x0063('0x3a')],'data':_0x240aba||null,'project_name':this['channel'][_0x0063('0x3b')],'callerid':this['channel'][_0x0063('0x3c')]})[_0x0063('0x15')](function(_0x32e866){if(_0x126acf){_0x126acf(null,_0x32e866);}})['catch'](function(_0x2e9b82){if(_0x126acf){_0x126acf(_0x2e9b82);}});};AGIVertices['prototype'][_0x0063('0x3d')]=function(_0x22e5bf,_0x5e49a6,_0x2b2174,_0x83b3ed){this[_0x0063('0x12')]['createSquareRecording']({'uniqueid':this[_0x0063('0x11')][_0x0063('0x39')],'callerid':this['channel']['callerid'],'calleridname':this['channel'][_0x0063('0x3e')],'context':this['channel'][_0x0063('0x3f')],'extension':this[_0x0063('0x11')][_0x0063('0x40')],'priority':this[_0x0063('0x11')]['priority'],'accountcode':this[_0x0063('0x11')]['accountcode'],'dnid':this['channel'][_0x0063('0x41')],'projectName':this[_0x0063('0x11')][_0x0063('0x3b')],'saveName':_0x5e49a6,'filename':_0x22e5bf[_0x0063('0x42')]||_0x5e49a6,'savePath':_0x2b2174})[_0x0063('0x15')](function(_0x50b512){_0x83b3ed(null,_0x50b512);})[_0x0063('0x16')](function(_0x1f2419){_0x83b3ed(_0x1f2419);});};AGIVertices[_0x0063('0x17')]['createSquareMessage']=function(_0x26f59c,_0x2868a6,_0x31fc82,_0xa91287,_0x509064){this['rpc']['createSquareMessage']({'uniqueid':this['channel'][_0x0063('0x39')],'body':_0x26f59c,'direction':_0x2868a6,'providerName':_0x31fc82,'providerResponse':_0xa91287})[_0x0063('0x15')](function(_0x17acda){if(_0x509064){_0x509064(null,_0x17acda);}})[_0x0063('0x16')](function(_0x41d673){if(_0x509064){_0x509064(_0x41d673);}});};AGIVertices[_0x0063('0x17')][_0x0063('0x43')]=function(_0x15cee3,_0x3f04bc){this[_0x0063('0x12')]['createCmContact']({'firstName':_['isEmpty'](_0x15cee3['name'])||_[_0x0063('0x44')](_0x15cee3['name'])?_0x0063('0x45')+Math['random']():_0x15cee3[_0x0063('0x1b')],'lastName':_[_0x0063('0x46')](_0x15cee3[_0x0063('0x47')])||_[_0x0063('0x44')](_0x15cee3[_0x0063('0x47')])?null:_0x15cee3[_0x0063('0x47')],'phone':_0x15cee3['phone'],'ListId':_0x15cee3['list_id'],'scheduledat':_0x15cee3[_0x0063('0x48')],'callbackUniqueid':this[_0x0063('0x11')][_0x0063('0x39')],'tags':_0x0063('0x49'),'description':'Callback\x20scheduled\x20at\x20'+_0x15cee3[_0x0063('0x48')]['toString'](),'priority':_0x15cee3[_0x0063('0x4a')]})['then'](function(_0xe44539){_0x3f04bc(null,_0xe44539);})['catch'](function(_0x29827d){_0x3f04bc(_0x29827d);});};AGIVertices[_0x0063('0x17')][_0x0063('0x4b')]=function(_0x4f823c,_0x3b7aa7){this['rpc'][_0x0063('0x4c')](_0x4f823c)['then'](function(_0x29e1ff){_0x3b7aa7(null,_0x29e1ff?_0x29e1ff['name']:![]);})['catch'](function(_0x1dfbe1){_0x3b7aa7(_0x1dfbe1);});};AGIVertices[_0x0063('0x17')][_0x0063('0x4d')]=function(_0x177963,_0x3f3bcd,_0x227a20){var _0x2db0bc={'role':_0x0063('0x4e')};_0x2db0bc[_0x177963]=this[_0x0063('0x11')][_0x0063('0x3c')];this[_0x0063('0x12')][_0x0063('0x4d')](_0x2db0bc,_0x3f3bcd,this[_0x0063('0x11')][_0x0063('0x39')])[_0x0063('0x15')](function(_0x4dccee){_0x227a20(null,_[_0x0063('0x44')](_0x4dccee)?![]:!![]);})[_0x0063('0x16')](function(_0x193625){logger[_0x0063('0x33')](_0x193625);_0x227a20(null,![]);});};AGIVertices[_0x0063('0x17')][_0x0063('0x4f')]=function(_0x131de1,_0x544e5a){var _0x47e636={'role':_0x0063('0x4e')};_0x47e636[_0x131de1]=this[_0x0063('0x11')]['callerid'];this[_0x0063('0x12')][_0x0063('0x4f')](_0x47e636)['then'](function(_0x329fd9){_0x544e5a(null,_[_0x0063('0x44')](_0x329fd9)?![]:!![]);})['catch'](function(_0xd42780){logger[_0x0063('0x33')](_0xd42780);_0x544e5a(null,![]);});};AGIVertices[_0x0063('0x17')][_0x0063('0x50')]=function(_0x270b12,_0x507cb6){var _0xcba387={'role':_0x0063('0x4e')};_0xcba387[_0x270b12]=this[_0x0063('0x11')][_0x0063('0x3c')];this[_0x0063('0x12')][_0x0063('0x50')](_0xcba387)['then'](function(_0x2cb0e8){_0x507cb6(null,_[_0x0063('0x44')](_0x2cb0e8)?![]:!![]);})[_0x0063('0x16')](function(_0x1e0639){logger[_0x0063('0x33')](_0x1e0639);_0x507cb6(null,![]);});};AGIVertices['prototype']['agentLogin']=function(_0x330b2b,_0x4aed11){var _0x112c3c={'role':_0x0063('0x4e')};_0x112c3c[_0x330b2b]=this[_0x0063('0x11')][_0x0063('0x3c')];var _0x354215=_0x330b2b!=_0x0063('0x51')?util[_0x0063('0x2b')](_0x0063('0x52'),_0x0063('0x53'),this[_0x0063('0x11')]['callerid']):undefined;this[_0x0063('0x12')][_0x0063('0x54')](_0x112c3c,_0x354215)[_0x0063('0x15')](function(_0x4c0804){_0x4aed11(null,_['isNil'](_0x4c0804)?![]:!![]);})[_0x0063('0x16')](function(_0x137d60){logger[_0x0063('0x33')](_0x137d60);_0x4aed11(null,![]);});};AGIVertices['prototype'][_0x0063('0x55')]=function(_0x38b542,_0x3a9210){sh[_0x0063('0x56')](_[_0x0063('0x57')](_0x38b542),function(_0x37ea86,_0x128744){var _0x4d371c=_0x128744[_0x0063('0x58')](/(\r\n|\n|\r)/gm,'');_0x3a9210(null,_0x4d371c);});};AGIVertices['prototype'][_0x0063('0x59')]=function(_0x27b2f0,_0x18d827){scripts[_0x0063('0x59')](_0x27b2f0[_0x0063('0x5a')],_0x27b2f0[_0x0063('0x5b')]||_0x0063('0x5c'),_0x27b2f0[_0x0063('0x5c')],_0x27b2f0[_0x0063('0x5d')]||'en-US',_0x27b2f0[_0x0063('0x5e')]||_0x0063('0x5f'),_0x27b2f0[_0x0063('0x60')]||_0x0063('0x61'))[_0x0063('0x15')](function(_0x5d07d3){_0x18d827(null,_0x5d07d3);})[_0x0063('0x16')](function(_0x10d938){_0x18d827(_0x10d938);});};AGIVertices[_0x0063('0x17')]['googleTTS']=function(_0x3bffca,_0x3d759b){scripts[_0x0063('0x62')](_0x3bffca['text'],_0x3bffca[_0x0063('0x63')]||'en',0x1)[_0x0063('0x15')](function(_0x5729bf){_0x3d759b(null,_0x5729bf);})[_0x0063('0x16')](function(_0x328357){_0x3d759b(_0x328357);});};AGIVertices[_0x0063('0x17')][_0x0063('0x64')]=function(_0x20105e,_0x250650){var _0x224f4b={'uri':_0x20105e[_0x0063('0x65')],'method':_0x20105e[_0x0063('0x66')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x20105e[_0x0063('0x67')])===_0x0063('0x68')&&parseInt(_0x20105e[_0x0063('0x67')])>=0x1?parseInt(_0x20105e['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x0063('0x69')]([_0x0063('0x6a'),_0x0063('0x6b')],_0x224f4b['method']['toUpperCase']())){try{_0x224f4b['body']=_0x20105e[_0x0063('0x6c')]?JSON['parse'](_0x20105e[_0x0063('0x6c')]):{};}catch(_0x294b05){logger['error'](_0x0063('0x6d'),_0x294b05);}}try{_0x224f4b['headers']=_0x20105e[_0x0063('0xd')]?JSON[_0x0063('0x6e')](_0x20105e[_0x0063('0xd')]):{};}catch(_0x3b6d7a){logger[_0x0063('0x33')](_0x0063('0x6f'),_0x3b6d7a);}if(_0x20105e[_0x0063('0x70')]){try{var _0x544bf7=require(_0x20105e[_0x0063('0x70')])[_0x0063('0x71')](this,_0x224f4b);_0x224f4b[_0x0063('0x72')]=Mustache[_0x0063('0x73')](_0x20105e[_0x0063('0x65')],_0x544bf7,{},['$$','$$']);if(_0x224f4b[_0x0063('0x74')]){_0x224f4b['headers']=JSON[_0x0063('0x6e')](Mustache[_0x0063('0x73')](JSON[_0x0063('0x75')](_0x224f4b[_0x0063('0x74')]),_0x544bf7,{},['$$','$$']));}if(_0x224f4b[_0x0063('0x76')]){_0x224f4b[_0x0063('0x76')]=JSON[_0x0063('0x6e')](Mustache['render'](JSON[_0x0063('0x75')](_0x224f4b[_0x0063('0x76')]),_0x544bf7,{},['$$','$$']));}}catch(_0x1c37fd){logger['error'](_0x0063('0x77'),_0x1c37fd);}}rp(_0x224f4b)['then'](function(_0x3ea86c){var _0x3e3013={'statusCode':_0x3ea86c['statusCode']||0xc8,'statusMessage':_0x3ea86c['statusMessage']||'OK','headers':_0x3ea86c[_0x0063('0x74')]||{},'body':_0x3ea86c['body']||{}};_0x250650(null,_0x3e3013);})[_0x0063('0x16')](function(_0x33cd47){var _0x10eec8={'statusCode':_0x33cd47[_0x0063('0x78')]||0x1f4,'statusMessage':_0x33cd47[_0x0063('0x79')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x33cd47[_0x0063('0x7a')][_0x0063('0x74')]||{},'body':_0x33cd47[_0x0063('0x7a')]['body']||{}};_0x250650(null,_0x10eec8);});};AGIVertices[_0x0063('0x17')][_0x0063('0x7b')]=function(_0xaeb564,_0x293a42){scripts['googleDialogflow'](this[_0x0063('0x11')][_0x0063('0x39')],_0xaeb564[_0x0063('0x7c')],_0xaeb564[_0x0063('0x5c')],_0xaeb564[_0x0063('0x7d')]||'en')['then'](function(_0x153288){_0x293a42(null,_0x153288);})[_0x0063('0x16')](function(_0xdde1b6){_0x293a42(_0xdde1b6);});};AGIVertices[_0x0063('0x17')]['googleDialogflowV2']=function(_0x40aaac,_0x24a57a){scripts[_0x0063('0x7e')](this[_0x0063('0x11')]['uniqueid'],_0x40aaac[_0x0063('0x7f')],_0x40aaac[_0x0063('0x80')],_0x40aaac[_0x0063('0x81')],_0x40aaac[_0x0063('0x5c')],_0x40aaac[_0x0063('0x82')]||'en')[_0x0063('0x15')](function(_0x2ee614){_0x24a57a(null,_0x2ee614);})[_0x0063('0x16')](function(_0x371dd5){_0x24a57a(_0x371dd5);});};AGIVertices[_0x0063('0x17')][_0x0063('0x83')]=function(_0x1bce4b,_0x1cd07f){scripts['sestekNDA'](this[_0x0063('0x11')],_0x1bce4b)[_0x0063('0x15')](function(_0x2708bb){_0x1cd07f(null,_0x2708bb);})['catch'](function(_0x4051df){_0x1cd07f(_0x4051df);});};AGIVertices[_0x0063('0x17')][_0x0063('0x84')]=function(_0xf3c366,_0x30d829){scripts['ispeechTTS'](_0xf3c366[_0x0063('0x7c')],_0xf3c366[_0x0063('0x5c')],_0xf3c366[_0x0063('0x85')]||_0x0063('0x86'),_0xf3c366[_0x0063('0x87')])[_0x0063('0x15')](function(_0x4cc8fa){_0x30d829(null,_0x4cc8fa);})[_0x0063('0x16')](function(_0x45dfa4){_0x30d829(_0x45dfa4);});};AGIVertices[_0x0063('0x17')][_0x0063('0x88')]=function(_0x4c660f,_0x33ec86,_0x2a673d){scripts[_0x0063('0x88')](_0x33ec86,_0x4c660f['key'],_0x4c660f[_0x0063('0x89')]||_0x0063('0x86'),this[_0x0063('0x8a')](_0x4c660f['model'])?_0x4c660f[_0x0063('0x8b')]:undefined)[_0x0063('0x15')](function(_0x44c8c0){_0x2a673d(null,_0x44c8c0);})[_0x0063('0x16')](function(_0x29b884){_0x2a673d(_0x29b884);});};AGIVertices['prototype']['awsPolly']=function(_0x1da7d9,_0xc5656b){scripts[_0x0063('0x8c')](_0x1da7d9['aws_access_key_id'],_0x1da7d9[_0x0063('0x8d')],_0x1da7d9[_0x0063('0x8e')],_0x1da7d9[_0x0063('0x8f')]||_0x0063('0x90'),_0x1da7d9[_0x0063('0x5c')],_0x1da7d9[_0x0063('0x91')]||'text')['then'](function(_0x73085d){_0xc5656b(null,_0x73085d);})[_0x0063('0x16')](function(_0x343185){_0xc5656b(_0x343185);});};AGIVertices['prototype'][_0x0063('0x92')]=function(_0x300a33,_0x46016b){scripts[_0x0063('0x92')](this[_0x0063('0x11')][_0x0063('0x39')],_0x300a33[_0x0063('0x93')],_0x300a33['aws_secret_access_key'],_0x300a33['aws_lex_region'],_0x300a33[_0x0063('0x5c')],_0x300a33[_0x0063('0x94')])[_0x0063('0x15')](function(_0x214d21){_0x46016b(null,_0x214d21);})[_0x0063('0x16')](function(_0x25bd5c){_0x46016b(_0x25bd5c);});};AGIVertices[_0x0063('0x17')][_0x0063('0x95')]=function(_0x2275fc,_0x5d130a,_0x5172f9){scripts[_0x0063('0x95')](_0x5d130a,_0x2275fc[_0x0063('0x7c')],_0x2275fc[_0x0063('0x96')]||_0x0063('0x86'))['then'](function(_0x192731){_0x5172f9(null,_0x192731);})[_0x0063('0x16')](function(_0x37dbf1){_0x5172f9(_0x37dbf1);});};AGIVertices[_0x0063('0x17')][_0x0063('0x97')]=function(_0x14f7ce,_0x1602ff,_0x28b7c0){scripts['tildeASR'](_0x1602ff,_0x14f7ce[_0x0063('0x98')],_0x14f7ce[_0x0063('0x99')],_0x14f7ce['uri'])['then'](function(_0x4dfb23){_0x28b7c0(null,_0x4dfb23);})[_0x0063('0x16')](function(_0x3a07e7){_0x28b7c0(_0x3a07e7);});};AGIVertices[_0x0063('0x17')][_0x0063('0x9a')]=function(_0x3df839){var _0x1ea10b=_[_0x0063('0x69')](verticesWithRetry,_0x3df839[_0x0063('0x3a')])?_0x3df839:_[_0x0063('0x9b')](_0x3df839);for(var _0x2a325e in _0x1ea10b){if(_0x1ea10b[_0x0063('0x9c')](_0x2a325e)){if(_0x1ea10b[_0x2a325e]&&_['isString'](_0x1ea10b[_0x2a325e])){if(_[_0x0063('0x69')](recursiveMapAttributes,_0x2a325e)){_0x1ea10b[_0x2a325e]=this[_0x0063('0x9d')](_0x1ea10b[_0x2a325e]);}else{_0x1ea10b[_0x2a325e]=this[_0x0063('0x9e')](_0x1ea10b[_0x2a325e]);}}}}return _0x1ea10b;};AGIVertices['prototype'][_0x0063('0x9f')]=function(_0x54f255){for(var _0x47c755 in _0x54f255){if(_0x54f255[_0x0063('0x9c')](_0x47c755)){if(_[_0x0063('0xa0')](_0x54f255[_0x47c755])){this[_0x0063('0x9f')](_0x54f255[_0x47c755]);}else if(_[_0x0063('0xa1')](_0x54f255[_0x47c755])){for(var _0x3c4d42=0x0;_0x3c4d42<_0x54f255[_0x47c755][_0x0063('0xa2')];_0x3c4d42++){this['recursiveNodeIndex'](_0x54f255[_0x47c755][_0x3c4d42]);}}else if(_[_0x0063('0xa3')](_0x54f255[_0x47c755])){_0x54f255[_0x47c755]=this[_0x0063('0x9e')](_0x54f255[_0x47c755]);}}}};AGIVertices[_0x0063('0x17')][_0x0063('0xa4')]=function(_0x1cbdbd,_0x4f39b4){for(var _0x501818 in _0x1cbdbd){if(_0x1cbdbd['hasOwnProperty'](_0x501818)){if(_[_0x0063('0xa0')](_0x1cbdbd[_0x501818])){if(!_[_0x0063('0x46')](_0x1cbdbd[_0x501818])){this[_0x0063('0xa4')](_0x1cbdbd[_0x501818],util['format'](_0x0063('0xa5'),_0x4f39b4,_0x501818));}}else if(_['isArray'](_0x1cbdbd[_0x501818])){for(var _0x1e06e7=0x0;_0x1e06e7<_0x1cbdbd[_0x501818]['length'];_0x1e06e7++){this[_0x0063('0xa4')](_0x1cbdbd[_0x501818][_0x1e06e7],util[_0x0063('0x2b')](_0x0063('0xa5'),_0x4f39b4,_0x501818+'['+_0x1e06e7+']'));}}else{if(!_[_0x0063('0x44')](_0x1cbdbd[_0x501818])){this['channel'][_0x0063('0xa6')](util[_0x0063('0x2b')](_0x0063('0xa5'),_0x4f39b4,_0x501818),_0x1cbdbd[_0x501818]);}}}}};AGIVertices[_0x0063('0x17')][_0x0063('0x9d')]=function(_0x3e827e){try{var _0x2361da=JSON[_0x0063('0x6e')](_0x3e827e);this[_0x0063('0x9f')](_0x2361da);return JSON[_0x0063('0x75')](_0x2361da);}catch(_0x4a9b87){return this[_0x0063('0x9e')](_0x3e827e);}};AGIVertices[_0x0063('0x17')][_0x0063('0x9e')]=function(_0x51a6c0){var _0x4f0f82=_0x51a6c0['split']('{');for(var _0x6f1142=0x1;_0x6f1142<_0x4f0f82[_0x0063('0xa2')];_0x6f1142+=0x1){var _0x1dab2f=_0x4f0f82[_0x6f1142][_0x0063('0xa7')]('}');if(_0x1dab2f['length']>0x1){_0x51a6c0=_0x51a6c0[_0x0063('0xa8')]('{'+_0x1dab2f[0x0]+'}',this[_0x0063('0x11')][_0x0063('0x13')](_0x1dab2f[0x0])[_0x0063('0xa9')]||_0x1dab2f[0x0]);}}if(_0x4f0f82['length']===0x1){return _0x51a6c0[_0x0063('0xaa')]();}return this[_0x0063('0x9e')](_0x51a6c0);};AGIVertices['prototype'][_0x0063('0xab')]=function(_0x53f11f,_0x188361){var _0x1c37a7=this['channel'][_0x0063('0x13')](_0x53f11f);if(_0x1c37a7[_0x0063('0xac')]===-0x1){return _0x1c37a7;}logger[_0x0063('0x2f')](util['format'](_0x0063('0xad'),_0x188361,_0x1c37a7[_0x0063('0xa9')]));return this[_0x0063('0x11')][_0x0063('0xa6')](_0x188361,_0x1c37a7[_0x0063('0xa9')]);};AGIVertices['prototype'][_0x0063('0x8a')]=function(_0x54b893){return _0x54b893&&_0x54b893!=='0'&&_0x54b893!=='-1'&&_0x54b893!=='';};AGIVertices[_0x0063('0x17')][_0x0063('0xae')]=function(_0x3cd4bc){this[_0x0063('0x38')][_0x0063('0x71')](this,_0x3cd4bc,'-');_0x3cd4bc[_0x0063('0xaf')]=_0x3cd4bc[_0x0063('0xae')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x0063('0xb0')]=function(_0x423119){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0xb1'),_0x423119[_0x0063('0xb2')]));if(!this[_0x0063('0x8a')](_0x423119[_0x0063('0x5c')])){return this['channel'][_0x0063('0xb3')](_0x0063('0xb4'));}var _0x63054e='\x22'+_0x423119[_0x0063('0x5c')]+'\x22';if(this[_0x0063('0x8a')](_0x423119[_0x0063('0x7a')])){_0x63054e+=','+_0x423119[_0x0063('0x7a')];}var _0x4b7535=this['channel'][_0x0063('0x56')](_0x0063('0xb5'),_0x63054e);if(_0x4b7535[_0x0063('0xac')]===-0x1){return _0x4b7535;}return this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0xb6'),_0x63054e));};AGIVertices[_0x0063('0x17')]['mrcprecog']=function(_0x2de134){logger[_0x0063('0x2f')](util['format'](_0x0063('0xb7'),_0x2de134['label']));if(!this[_0x0063('0x8a')](_0x2de134[_0x0063('0xb8')])){return this['channel'][_0x0063('0xb3')]('no\x20grammar\x20configured');}var _0x4d44b1=_0x2de134[_0x0063('0xb8')];if(this[_0x0063('0x8a')](_0x2de134[_0x0063('0x7a')])){_0x4d44b1+=','+_0x2de134[_0x0063('0x7a')];}var _0xacc9e9=this[_0x0063('0x11')][_0x0063('0x56')](_0x0063('0xb9'),_0x4d44b1);if(_0xacc9e9[_0x0063('0xac')]===-0x1){return _0xacc9e9;}var _0x41440a=this[_0x0063('0xab')](_0x0063('0xba'),'MRCP_RECOG_CONFIDENCE');if(_0x41440a['result']===-0x1){return _0x41440a;}var _0x1c5f9e=this[_0x0063('0xab')](_0x0063('0xbb'),_0x0063('0xbc'));if(_0x1c5f9e[_0x0063('0xac')]===-0x1){return _0x1c5f9e;}var _0x3827a2=this['getAndSetVariable'](_0x0063('0xbd'),_0x0063('0xbe'));if(_0x3827a2[_0x0063('0xac')]===-0x1){return _0x3827a2;}return this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0xbf'),_0x4d44b1));};AGIVertices[_0x0063('0x17')][_0x0063('0x9')]=function(_0x2dc54f){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0xc0'),_0x2dc54f['label']));return this[_0x0063('0x11')]['agi']([_0x2dc54f[_0x0063('0xc1')],_0x2dc54f[_0x0063('0xc2')]]);};AGIVertices[_0x0063('0x17')][_0x0063('0xc3')]=function(_0x22b697){logger[_0x0063('0x2f')](util[_0x0063('0x2b')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x22b697[_0x0063('0xb2')]));if(this[_0x0063('0x8a')](_0x22b697[_0x0063('0x67')])){logger['info'](util[_0x0063('0x2b')](_0x0063('0xc4'),_0x22b697[_0x0063('0x67')]));var _0x2c984b=this[_0x0063('0x11')][_0x0063('0xc5')](_0x22b697[_0x0063('0x67')]);if(_0x2c984b[_0x0063('0xac')]===-0x1){return _0x2c984b;}}return this[_0x0063('0x11')][_0x0063('0xc3')]();};AGIVertices[_0x0063('0x17')]['callback']=function(_0x45dc36){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0xc6'),_0x45dc36['label']));if(!this['isConfigured'](_0x45dc36[_0x0063('0xc7')])){return this[_0x0063('0x11')]['error'](_0x45dc36,_0x0063('0xc8'));}_0x45dc36[_0x0063('0x48')]=moment();if(this[_0x0063('0x8a')](_0x45dc36['delay'])){_0x45dc36['scheduledAt']=moment()[_0x0063('0xc9')](_0x45dc36[_0x0063('0xca')],_0x0063('0xcb'));}if(!this[_0x0063('0x8a')](_0x45dc36['callback_priority'])){_0x45dc36['callback_priority']=0x2;}this[_0x0063('0x43')]['sync'](this,_0x45dc36);return this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0xcc'),_0x45dc36[_0x0063('0xcd')],_0x45dc36[_0x0063('0xc7')],_0x45dc36[_0x0063('0x48')]));};AGIVertices['prototype'][_0x0063('0xce')]=function(_0x315056){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0xcf'),_0x315056[_0x0063('0xb2')]));var _0x2d5f75=this[_0x0063('0x11')][_0x0063('0x56')](_0x315056[_0x0063('0xd0')],_0x315056[_0x0063('0x7a')]);if(_0x2d5f75[_0x0063('0xac')]===-0x1){return _0x2d5f75;}return this[_0x0063('0x11')]['noop'](util[_0x0063('0x2b')]('Executed\x20command\x20%s\x20%s',_0x315056[_0x0063('0xd0')],_0x315056[_0x0063('0x7a')]));};AGIVertices[_0x0063('0x17')][_0x0063('0xd1')]=function(_0x31481e){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0xd2'),_0x31481e['label']));if(!this[_0x0063('0x8a')](_0x31481e['text'])){return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0xb4'));}var _0x4b9038='\x22'+_0x31481e[_0x0063('0x5c')]+'\x22';if(this[_0x0063('0x8a')](_0x31481e['options'])){_0x4b9038+=','+_0x31481e[_0x0063('0x7a')];}var _0x4e08d0=this[_0x0063('0x11')][_0x0063('0x56')]('MRCPSynth',_0x4b9038);if(_0x4e08d0[_0x0063('0xac')]===-0x1){return _0x4e08d0;}return this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4b9038));};AGIVertices[_0x0063('0x17')][_0x0063('0xd3')]=function(_0x3085e1){logger[_0x0063('0x2f')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x3085e1[_0x0063('0xb2')]));if(!this[_0x0063('0x8a')](_0x3085e1[_0x0063('0x5c')])){return this[_0x0063('0x11')][_0x0063('0xb3')]('no\x20text\x20configured');}var _0x1b7822='\x22'+_0x3085e1[_0x0063('0x5c')]+'\x22';if(this['isConfigured'](_0x3085e1['options'])){_0x1b7822+=','+_0x3085e1[_0x0063('0x7a')];}var _0x286776=this[_0x0063('0x11')][_0x0063('0x56')](_0x0063('0xb5'),_0x1b7822);if(_0x286776['result']===-0x1){return _0x286776;}return this[_0x0063('0x11')][_0x0063('0xb3')](util['format'](_0x0063('0xb6'),_0x1b7822));};AGIVertices['prototype']['lumenvoxasr']=function(_0x30e1f6){logger[_0x0063('0x2f')](util['format'](_0x0063('0xd4'),_0x30e1f6[_0x0063('0xb2')]));if(!this[_0x0063('0x8a')](_0x30e1f6[_0x0063('0xb8')])){return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0xd5'));}var _0x5e30ab=_0x30e1f6['grammar'];if(this[_0x0063('0x8a')](_0x30e1f6['options'])){_0x5e30ab+=','+_0x30e1f6[_0x0063('0x7a')];}var _0x854e6f=this[_0x0063('0x11')][_0x0063('0x56')](_0x0063('0xb9'),_0x5e30ab);if(_0x854e6f[_0x0063('0xac')]===-0x1){return _0x854e6f;}var _0x2ac52f=this[_0x0063('0xab')](_0x0063('0xba'),'LUMENVOX_ASR_CONFIDENCE');if(_0x2ac52f[_0x0063('0xac')]===-0x1){return _0x2ac52f;}var _0x9872de=this[_0x0063('0xab')]('RECOG_INPUT()',_0x0063('0xd6'));if(_0x9872de[_0x0063('0xac')]===-0x1){return _0x9872de;}var _0x1904b1=this[_0x0063('0xab')](_0x0063('0xbd'),_0x0063('0xd7'));if(_0x1904b1[_0x0063('0xac')]===-0x1){return _0x1904b1;}return this['channel'][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0xbf'),_0x5e30ab));};AGIVertices[_0x0063('0x17')][_0x0063('0xd8')]=function(_0x298f69){logger['info'](util['format'](_0x0063('0xd9'),_0x298f69[_0x0063('0xb2')]));if(!this[_0x0063('0x8a')](_0x298f69[_0x0063('0xb8')])){return this['channel'][_0x0063('0xb3')](_0x0063('0xd5'));}var _0x2fd3c1=_0x298f69[_0x0063('0xb8')];if(this[_0x0063('0x8a')](_0x298f69['options'])){_0x2fd3c1+=','+_0x298f69['options'];}var _0x2dd6e7=this[_0x0063('0x11')][_0x0063('0x56')](_0x0063('0xb9'),_0x2fd3c1);if(_0x2dd6e7['result']===-0x1){return _0x2dd6e7;}var _0x4772ed=this[_0x0063('0xab')]('RECOG_CONFIDENCE()',_0x0063('0xda'));if(_0x4772ed['result']===-0x1){return _0x4772ed;}var _0x32fcb0=this[_0x0063('0xab')]('RECOG_INPUT()',_0x0063('0xdb'));if(_0x32fcb0[_0x0063('0xac')]===-0x1){return _0x32fcb0;}var _0x428acb=this['getAndSetVariable'](_0x0063('0xbd'),_0x0063('0xdc'));if(_0x428acb['result']===-0x1){return _0x428acb;}return this['channel'][_0x0063('0xb3')](util['format'](_0x0063('0xbf'),_0x2fd3c1));};AGIVertices[_0x0063('0x17')][_0x0063('0xdd')]=function(_0x5760e1){logger[_0x0063('0x2f')](util[_0x0063('0x2b')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x5760e1[_0x0063('0xb2')]));if(!this['isConfigured'](_0x5760e1['odbc_id'])){return this[_0x0063('0x11')][_0x0063('0x33')](_0x5760e1,'no\x20database\x20selected');}var _0x19004b=this[_0x0063('0x1c')][_0x0063('0x71')](this,_0x5760e1[_0x0063('0xde')]);if(!_0x19004b){return this[_0x0063('0x11')]['error'](_0x5760e1,_0x0063('0xdf'));}if(!this[_0x0063('0x8a')](_0x5760e1[_0x0063('0x31')])){return this[_0x0063('0x11')][_0x0063('0x33')](_0x5760e1,'no\x20query\x20configured');}var _0x4801d0=_0x5760e1[_0x0063('0x31')][_0x0063('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0x0063('0x11')][_0x0063('0xb3')](util['format'](_0x0063('0xe0'),_0x4801d0));var _0x40e45d=this['getQueryOdbc'][_0x0063('0x71')](this,_0x19004b,_0x4801d0);this[_0x0063('0x38')][_0x0063('0x71')](this,_0x5760e1,_0x4801d0);if(!this['isConfigured'](_0x5760e1[_0x0063('0xe1')])){return this['channel'][_0x0063('0xb3')](_0x0063('0xe2'));}var _0x6832f6=this['getVariable'][_0x0063('0x71')](this,_0x5760e1[_0x0063('0xe1')]);if(!_0x6832f6){return this[_0x0063('0x11')][_0x0063('0x33')](_0x5760e1,'no\x20variable\x20found');}var _0x4e103e=this;_0x40e45d[_0x0063('0xe3')](function(_0x533e31,_0x250ee3){Object[_0x0063('0xe4')](_0x533e31)[_0x0063('0xe3')](function(_0x68ce90){_0x4e103e[_0x0063('0x11')][_0x0063('0xa6')](util[_0x0063('0x2b')](_0x0063('0xe5'),_0x6832f6,_0x250ee3,_0x68ce90),_0x533e31[_0x68ce90]);});});this[_0x0063('0x11')][_0x0063('0xa6')](util[_0x0063('0x2b')](_0x0063('0xe6'),_0x6832f6),_0x40e45d['length']);return this['channel'][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0xe7'),_0x6832f6));};AGIVertices[_0x0063('0x17')][_0x0063('0xe8')]=function(_0x2d5b98){logger[_0x0063('0xe9')](util[_0x0063('0x2b')](_0x0063('0xea'),_0x2d5b98[_0x0063('0xb2')]));if(!this[_0x0063('0x8a')](_0x2d5b98[_0x0063('0xeb')])){return this[_0x0063('0x11')][_0x0063('0x33')](_0x2d5b98,'no\x20user\x20selected');}var _0x1db168=this[_0x0063('0x1f')][_0x0063('0x71')](this,_0x2d5b98[_0x0063('0xeb')]);if(!_0x1db168){return this[_0x0063('0x11')][_0x0063('0x33')](_0x2d5b98,'no\x20user\x20found');}var _0x32ff49=this[_0x0063('0x11')][_0x0063('0x56')](_0x0063('0xec'),[util[_0x0063('0x2b')](_0x0063('0xed'),_0x1db168),_0x2d5b98[_0x0063('0x67')],_0x2d5b98[_0x0063('0xee')],_0x2d5b98[_0x0063('0x65')]]);if(_0x32ff49['result']===-0x1){return _0x32ff49;}return this[_0x0063('0x11')]['noop'](util[_0x0063('0x2b')](_0x0063('0xef'),_0x0063('0xec')));};AGIVertices['prototype'][_0x0063('0xf0')]=function(_0x1057bc){logger[_0x0063('0x2f')](util[_0x0063('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x1057bc[_0x0063('0xb2')]));if(!this[_0x0063('0x8a')](_0x1057bc[_0x0063('0x7c')])){return this[_0x0063('0x11')]['noop'](_0x0063('0xf1'));}if(!this[_0x0063('0x8a')](_0x1057bc['text'])){return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0xb4'));}this[_0x0063('0x11')]['bot']=!![];this[_0x0063('0x38')](_0x1057bc);this['createSquareMessage'](_0x1057bc[_0x0063('0x5c')],'in','','');this[_0x0063('0x11')]['noop'](util[_0x0063('0x2b')](_0x0063('0xf2'),_0x1057bc[_0x0063('0x5c')]));var _0x2d8dd2=this[_0x0063('0x7b')]['sync'](this,_0x1057bc);if(_0x2d8dd2){for(var _0x22c32e in _0x2d8dd2){if(_0x2d8dd2[_0x0063('0x9c')](_0x22c32e)){this[_0x0063('0x11')][_0x0063('0xa6')](util[_0x0063('0x2b')]('DIALOGFLOW_%s',_0x22c32e[_0x0063('0xf3')]()),_0x2d8dd2[_0x22c32e]);}}this['createSquareMessage'](_0x2d8dd2['speech'],_0x0063('0xf4'),_0x0063('0xf0'),'');return this[_0x0063('0x11')]['noop'](util[_0x0063('0x2b')]('Dialogflow\x20Result\x20%s',_0x2d8dd2['speech']));}return this[_0x0063('0x11')][_0x0063('0x33')](_0x1057bc,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x0063('0x17')][_0x0063('0xf5')]=function(_0x41d704){logger[_0x0063('0x2f')](util[_0x0063('0x2b')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x41d704[_0x0063('0xb2')]));if(!this['isConfigured'](_0x41d704[_0x0063('0x7f')])){return this[_0x0063('0x11')]['noop'](_0x0063('0xf6'));}if(!this[_0x0063('0x8a')](_0x41d704[_0x0063('0x80')])){return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0xf7'));}if(!this[_0x0063('0x8a')](_0x41d704['private_key'])){return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0xf8'));}if(!this[_0x0063('0x8a')](_0x41d704[_0x0063('0x82')])){return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0xf9'));}if(!this[_0x0063('0x8a')](_0x41d704[_0x0063('0x5c')])){return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0xb4'));}this[_0x0063('0x11')]['bot']=!![];this[_0x0063('0x38')](_0x41d704);this[_0x0063('0xfa')](_0x41d704[_0x0063('0x5c')],'in','','');this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0xfb'),_0x41d704['text']));var _0x5c1f0b=this['googleDialogflowV2']['sync'](this,_0x41d704);if(_0x5c1f0b){for(var _0x316a76 in _0x5c1f0b){if(_0x5c1f0b['hasOwnProperty'](_0x316a76)){if(_0x316a76!==_0x0063('0xfc')){this[_0x0063('0x11')][_0x0063('0xa6')](util[_0x0063('0x2b')](_0x0063('0xfd'),_0x316a76[_0x0063('0xf3')]()),_0x5c1f0b[_0x316a76]);}}}this[_0x0063('0xfa')](_0x5c1f0b[_0x0063('0xfe')],_0x0063('0xf4'),_0x0063('0xf5'),_0x5c1f0b[_0x0063('0xfc')]);return this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0xff'),_0x5c1f0b['speech']));}return this[_0x0063('0x11')]['error'](_0x41d704,_0x0063('0x100'));};AGIVertices[_0x0063('0x17')]['sesteknda']=function(_0x208c46){logger[_0x0063('0x2f')](util['format'](_0x0063('0x101'),_0x208c46[_0x0063('0xb2')]));if(!this[_0x0063('0x8a')](_0x208c46[_0x0063('0x102')])){return this[_0x0063('0x11')]['noop']('no\x20ndauth\x20url\x20configured');}if(!this['isConfigured'](_0x208c46[_0x0063('0x103')])){return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0x104'));}if(!this[_0x0063('0x8a')](_0x208c46[_0x0063('0x105')])){return this[_0x0063('0x11')]['noop'](_0x0063('0x106'));}if(!this[_0x0063('0x8a')](_0x208c46['ndassistant_url'])){return this[_0x0063('0x11')]['noop'](_0x0063('0xb4'));}this['channel'][_0x0063('0x107')]=!![];this[_0x0063('0x38')](_0x208c46);this[_0x0063('0xfa')](_0x208c46['text'],'in','','');this[_0x0063('0x11')]['noop'](util['format']('Trying\x20SestekNDA:\x20%s',_0x208c46['text']));var _0x24651d=this[_0x0063('0x83')][_0x0063('0x71')](this,_0x208c46);if(_0x24651d){for(var _0x30640c in _0x24651d){if(_0x24651d['hasOwnProperty'](_0x30640c)){this[_0x0063('0x11')]['setVariable'](util[_0x0063('0x2b')](_0x0063('0x108'),_0x30640c[_0x0063('0xf3')]()),_0x24651d[_0x30640c]);}}this['createSquareMessage'](_0x24651d['speech'],_0x0063('0xf4'),_0x0063('0x109'),'');if(_0x24651d['audiofile']){this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x24651d['audiofile']));var _0xe45c86=this['channel'][_0x0063('0x10a')](_0x24651d[_0x0063('0x10b')]);try{fs[_0x0063('0x10c')](_0x24651d[_0x0063('0x10b')]+_0x0063('0x10d'));}catch(_0x239bc8){logger[_0x0063('0x33')](_0x239bc8);}return _0xe45c86;}else{return this['channel']['noop'](util[_0x0063('0x2b')](_0x0063('0x10e'),_0x24651d[_0x0063('0xfe')]));}}return this[_0x0063('0x11')][_0x0063('0x33')](_0x208c46,_0x0063('0x10f'));};AGIVertices[_0x0063('0x17')][_0x0063('0x110')]=function(_0x4b8b88){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x111'),_0x4b8b88[_0x0063('0xb2')]));return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0x110'));};AGIVertices[_0x0063('0x17')]['ext_dial']=function(_0x11f4e4){logger[_0x0063('0x2f')](util['format'](_0x0063('0x112'),_0x11f4e4[_0x0063('0xb2')]));var _0x52c83b='';if(_0x11f4e4[_0x0063('0x113')]){if(!this[_0x0063('0x8a')](_0x11f4e4['trunk_id'])){return this[_0x0063('0x11')][_0x0063('0x33')](_0x11f4e4,_0x0063('0x114'));}else{var _0x1a2a66=parseInt(_0x11f4e4[_0x0063('0x113')],0xa);if(isNaN(_0x1a2a66)){_0x52c83b=_0x11f4e4[_0x0063('0x113')];}else{_0x52c83b=this['getTrunk'][_0x0063('0x71')](this,_0x11f4e4['trunk_id']);if(!_0x52c83b){return this[_0x0063('0x11')][_0x0063('0x33')](_0x11f4e4,'no\x20trunk\x20found');}}}}else if(_0x11f4e4[_0x0063('0x115')]){_0x52c83b=_0x11f4e4[_0x0063('0x115')];}else{return this[_0x0063('0x11')][_0x0063('0x33')](_0x11f4e4,'no\x20trunk\x20selected');}var _0x11f19c=this['channel'][_0x0063('0x56')](_0x0063('0xec'),[util[_0x0063('0x2b')]('SIP/%s/%s',_0x52c83b,_0x11f4e4[_0x0063('0xcd')]),_0x11f4e4[_0x0063('0x67')],_0x11f4e4['opts'],_0x11f4e4['url']]);if(_0x11f19c[_0x0063('0xac')]===-0x1){return _0x11f19c;}return this[_0x0063('0x11')]['noop'](util[_0x0063('0x2b')](_0x0063('0xef'),_0x0063('0xec')));};AGIVertices['prototype']['finally']=function(_0x2f7407){logger['info'](util[_0x0063('0x2b')](_0x0063('0x116'),_0x2f7407[_0x0063('0xb2')]));return this['channel'][_0x0063('0xb3')](_0x0063('0x117'));};AGIVertices[_0x0063('0x17')][_0x0063('0xf')]=function(_0x119572){logger[_0x0063('0x2f')](util['format'](_0x0063('0x118'),_0x119572[_0x0063('0xb2')]));if(_0x119572[_0x0063('0xaf')]===0x0){return this[_0x0063('0xae')](_0x119572);}_0x119572[_0x0063('0xaf')]-=0x1;if(!this[_0x0063('0x8a')](_0x119572[_0x0063('0x119')])){return this[_0x0063('0x11')][_0x0063('0x33')](_0x119572,_0x0063('0x11a'));}var _0x2d4153=this[_0x0063('0x11b')][_0x0063('0x71')](this,_0x119572[_0x0063('0x119')]);if(!_0x2d4153){return this[_0x0063('0x11')]['error'](_0x119572,_0x0063('0x11c'));}if(!this['isConfigured'](_0x119572['variable_id'])){return this[_0x0063('0x11')][_0x0063('0x33')](_0x0063('0xe2'));}var _0x15c49a=this[_0x0063('0x11')]['getData'](_0x2d4153,_0x119572['response'],_0x119572[_0x0063('0x11d')]);var _0x29d713=_0x15c49a[_0x0063('0xac')]?_0x15c49a[_0x0063('0xac')][_0x0063('0xaa')]():'';logger[_0x0063('0x2f')](_0x0063('0x11e'),JSON['stringify'](_0x15c49a));if(_0x15c49a[_0x0063('0xac')]===-0x1){this[_0x0063('0x38')][_0x0063('0x71')](this,_0x119572,_0x29d713);return _0x15c49a;}else if(_0x15c49a[_0x0063('0xa9')]===_0x0063('0x67')){_0x15c49a[_0x0063('0xac')]=_0x29d713['length']>=parseInt(_0x119572[_0x0063('0x11f')])?'x':'i';}else{_0x15c49a[_0x0063('0xac')]=_0x29d713[_0x0063('0xa2')]>=parseInt(_0x119572['mindigit'])&&_0x29d713[_0x0063('0xa2')]<=parseInt(_0x119572[_0x0063('0x11d')])?'x':'i';}var _0x35819b=this[_0x0063('0x13')][_0x0063('0x71')](this,_0x119572[_0x0063('0xe1')]);if(!_0x35819b){return this[_0x0063('0x11')][_0x0063('0x33')](_0x119572,_0x0063('0x120'));}this['channel']['setVariable'](_0x35819b,_0x29d713);if(this[_0x0063('0x8a')](_0x119572[_0x0063('0x121')])){var _0x2bc6b0=parseInt(_0x119572[_0x0063('0x121')],0xa);var _0x88679d=rs[_0x0063('0x122')]({'charset':'*','length':_0x2bc6b0});var _0x3b1f10=_0x29d713['length'];if(_0x3b1f10>0x0){if(_0x3b1f10>_0x2bc6b0){this[_0x0063('0x38')][_0x0063('0x71')](this,_0x119572,_0x119572['hiddendigitspos']===_0x0063('0x123')?_0x88679d+_0x29d713['substr'](_0x2bc6b0):_0x29d713['substr'](0x0,_0x3b1f10-_0x2bc6b0)+_0x88679d);}else{this[_0x0063('0x38')][_0x0063('0x71')](this,_0x119572,rs[_0x0063('0x122')]({'charset':'*','length':_0x3b1f10}));}}else{this['createSquareDetailsReport'][_0x0063('0x71')](this,_0x119572,'');}}else{this[_0x0063('0x38')][_0x0063('0x71')](this,_0x119572,_0x29d713);}return _0x15c49a;};AGIVertices[_0x0063('0x17')][_0x0063('0x10')]=function(_0x2386a8){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x124'),_0x2386a8['label']));return this['getdigits'](_0x2386a8);};AGIVertices[_0x0063('0x17')][_0x0063('0x125')]=function(_0x3484f7){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x126'),_0x3484f7[_0x0063('0xb2')]));this[_0x0063('0x38')][_0x0063('0x71')](this,_0x3484f7,_0x3484f7[_0x0063('0x127')]);return this[_0x0063('0x11')][_0x0063('0xb3')](util['format'](_0x0063('0x128'),_0x3484f7['goalname']));};AGIVertices[_0x0063('0x17')][_0x0063('0x129')]=function(_0x183e83){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x12a'),_0x183e83[_0x0063('0xb2')]));if(!this['isConfigured'](_0x183e83['aws_access_key_id'])||!this[_0x0063('0x8a')](_0x183e83[_0x0063('0x8d')])){return this[_0x0063('0x11')]['noop'](_0x0063('0x12b'));}if(!this[_0x0063('0x8a')](_0x183e83[_0x0063('0x5c')])){return this['channel'][_0x0063('0xb3')]('no\x20text\x20configured');}this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0x12c'),_0x183e83[_0x0063('0x5c')]));var _0x18a021=this[_0x0063('0x8c')][_0x0063('0x71')](this,_0x183e83);if(_0x18a021){this[_0x0063('0x11')]['noop'](util[_0x0063('0x2b')](_0x0063('0x12d'),_0x18a021));var _0x4f9941=this['channel'][_0x0063('0x10a')](_0x18a021);try{fs['unlink'](_0x18a021+_0x0063('0x10d'));}catch(_0x447ff0){logger['error'](_0x447ff0);}return _0x4f9941;}return this[_0x0063('0x11')]['error'](_0x183e83,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype']['awslex']=function(_0x295b52){logger[_0x0063('0x2f')](util['format'](_0x0063('0x12e'),_0x295b52['label']));if(!this[_0x0063('0x8a')](_0x295b52[_0x0063('0x93')])||!this[_0x0063('0x8a')](_0x295b52[_0x0063('0x8d')])){return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0x12b'));}if(!this[_0x0063('0x8a')](_0x295b52[_0x0063('0x94')])){return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0x12f'));}if(!this[_0x0063('0x8a')](_0x295b52[_0x0063('0x5c')])){return this[_0x0063('0x11')]['noop'](_0x0063('0xb4'));}this[_0x0063('0x11')][_0x0063('0x107')]=!![];this[_0x0063('0x38')](_0x295b52);this[_0x0063('0xfa')](_0x295b52['text'],'in','','');this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')]('Trying\x20Amazon\x20Lex:\x20%s',_0x295b52[_0x0063('0x5c')]));var _0x368f33=this[_0x0063('0x92')]['sync'](this,_0x295b52);if(_0x368f33){for(var _0x414dd4 in _0x368f33){if(_0x368f33[_0x0063('0x9c')](_0x414dd4)&&_[_0x0063('0xa3')](_0x368f33[_0x414dd4])){this[_0x0063('0x11')]['setVariable'](util[_0x0063('0x2b')](_0x0063('0x130'),_0x414dd4['toUpperCase']()),_0x368f33[_0x414dd4]);}}if(_[_0x0063('0x44')](_0x368f33[_0x0063('0x79')])){return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0x131'));}else{this[_0x0063('0xfa')](_0x368f33['message'],_0x0063('0xf4'),_0x0063('0x132'),'');return this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0x133'),_0x368f33['message']));}}return this[_0x0063('0x11')]['error'](_0x295b52,_0x0063('0x134'));};AGIVertices['prototype'][_0x0063('0x135')]=function(_0x2dbaf9){logger[_0x0063('0x2f')](util[_0x0063('0x2b')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x2dbaf9[_0x0063('0xb2')],_0x2dbaf9[_0x0063('0x67')]));if(!this[_0x0063('0x8a')](_0x2dbaf9[_0x0063('0x7c')])){return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0xf1'));}var _0x23afeb=_0x0063('0x136');var _0x22c40b=util[_0x0063('0x2b')](_0x0063('0x137'),FILES_PATH,rs[_0x0063('0x122')](0x4));var _0x4845c5=util['format'](_0x0063('0xa5'),_0x22c40b,_0x23afeb);var _0x309126=!![];if(_0x2dbaf9[_0x0063('0x138')]===_0x0063('0x139')){_0x309126=![];}var _0x10edd5=this['channel'][_0x0063('0x13a')](_0x22c40b,_0x23afeb,_0x2dbaf9['intKey'],_0x2dbaf9['timeout'],undefined,_0x309126);if(_0x10edd5[_0x0063('0xac')]!==-0x1){this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0x13b'),_0x4845c5));var _0x253253=this[_0x0063('0x95')]['sync'](this,_0x2dbaf9,_0x4845c5);if(_0x253253){for(var _0x5c0b8c in _0x253253){if(_0x253253[_0x0063('0x9c')](_0x5c0b8c)){this['channel'][_0x0063('0xa6')](util['format'](_0x0063('0x13c'),_0x5c0b8c[_0x0063('0xf3')]()),_0x253253[_0x5c0b8c]);}}return this['channel'][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0x13d'),JSON[_0x0063('0x75')](_0x253253)));}}return _0x10edd5;};AGIVertices['prototype']['tildeasr']=function(_0x1946a1){logger[_0x0063('0x2f')](util[_0x0063('0x2b')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x1946a1[_0x0063('0xb2')]));if(!this[_0x0063('0x8a')](_0x1946a1[_0x0063('0x98')])){return this[_0x0063('0x11')][_0x0063('0xb3')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x1946a1['appsecret'])){return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0x13e'));}var _0x52a4f7='wav';var _0x939f06=util['format'](_0x0063('0x137'),FILES_PATH,rs[_0x0063('0x122')](0x4));var _0x1ee60d=util['format']('%s.%s',_0x939f06,_0x52a4f7);var _0x3fc834=!![];if(_0x1946a1[_0x0063('0x138')]===_0x0063('0x139')){_0x3fc834=![];}var _0x701411=this[_0x0063('0x11')][_0x0063('0x13a')](_0x939f06,_0x52a4f7,_0x1946a1[_0x0063('0x13f')],_0x1946a1[_0x0063('0x67')],undefined,_0x3fc834);if(_0x701411['result']!==-0x1){this[_0x0063('0x11')]['noop'](util[_0x0063('0x2b')](_0x0063('0x140'),_0x1ee60d));var _0x47912d=this[_0x0063('0x97')]['sync'](this,_0x1946a1,_0x1ee60d);if(_0x47912d){for(var _0x44d53c in _0x47912d){if(_0x47912d[_0x0063('0x9c')](_0x44d53c)){this[_0x0063('0x11')]['setVariable'](util[_0x0063('0x2b')](_0x0063('0x141'),_0x44d53c['toUpperCase']()),_0x47912d[_0x44d53c]);}}return this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0x142'),JSON[_0x0063('0x75')](_0x47912d)));}}return _0x701411;};AGIVertices[_0x0063('0x17')][_0x0063('0x143')]=function(_0x44aa4a){logger[_0x0063('0x2f')](util[_0x0063('0x2b')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x44aa4a['label']));return this[_0x0063('0x11')][_0x0063('0x144')](_0x44aa4a[_0x0063('0x3f')],_0x44aa4a[_0x0063('0x40')],_0x44aa4a[_0x0063('0x145')]);};AGIVertices['prototype'][_0x0063('0x146')]=function(_0x450a17){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x147'),_0x450a17[_0x0063('0xb2')]));if(!this[_0x0063('0x8a')](_0x450a17[_0x0063('0x148')])){return this[_0x0063('0x11')]['error'](_0x450a17,'no\x20condition\x20configured');}try{var _0x257e00=eval(_0x450a17['condition'])?_0x0063('0x149'):_0x0063('0x14a');this[_0x0063('0x11')]['noop'](util['format'](_0x0063('0x14b'),_0x450a17[_0x0063('0x148')],_0x257e00));return{'code':0xc8,'result':_0x257e00};}catch(_0x5395d0){return{'code':0xc8,'result':_0x0063('0x14a')};}};AGIVertices[_0x0063('0x17')][_0x0063('0x14c')]=function(_0x5b83fa){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x14d'),_0x5b83fa['label']));if(!this[_0x0063('0x8a')](_0x5b83fa[_0x0063('0x14e')])){return this[_0x0063('0x11')][_0x0063('0x33')](_0x5b83fa,_0x0063('0x14f'));}var _0xf4ff7=this[_0x0063('0x150')][_0x0063('0x71')](this,_0x5b83fa[_0x0063('0x14e')]);if(!_0xf4ff7){return this['channel'][_0x0063('0x33')](_0x5b83fa,_0x0063('0x151'));}for(var _0x4f4163=0x0;_0x4f4163<_0xf4ff7[_0x0063('0xa2')];_0x4f4163+=0x1){var _0x1dfaae=this[_0x0063('0x11')][_0x0063('0x13')](util['format'](_0x0063('0x152'),_0xf4ff7[_0x4f4163]));if(_0x1dfaae[_0x0063('0xac')]===-0x1){return _0x1dfaae;}logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x153'),_0xf4ff7[_0x4f4163],_0x1dfaae[_0x0063('0xa9')]));if(_0x1dfaae[_0x0063('0xa9')]===_0x0063('0x149')){logger[_0x0063('0x2f')](util[_0x0063('0x2b')]('IFTIME\x20%s\x20%s',_0xf4ff7[_0x4f4163],'true'));this['channel'][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0x153'),_0xf4ff7[_0x4f4163],_0x0063('0x149')));return{'code':0xc8,'result':_0x0063('0x149')};}else{logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x153'),_0xf4ff7[_0x4f4163],_0x0063('0x14a')));this[_0x0063('0x11')]['noop'](util['format'](_0x0063('0x153'),_0xf4ff7[_0x4f4163],_0x0063('0x14a')));}}return{'code':0xc8,'result':_0x0063('0x14a')};};AGIVertices[_0x0063('0x17')][_0x0063('0x154')]=function(_0x59098b){logger[_0x0063('0x2f')](util['format'](_0x0063('0x155'),_0x59098b[_0x0063('0xb2')]));return this[_0x0063('0x11')][_0x0063('0x154')]();};AGIVertices[_0x0063('0x17')][_0x0063('0x156')]=function(_0x267d1f){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x157'),_0x267d1f[_0x0063('0xb2')]));if(!this[_0x0063('0x8a')](_0x267d1f['key'])){return this[_0x0063('0x11')]['noop']('no\x20key\x20configured');}var _0x1f727f=_0x0063('0x136');var _0x55143c=util['format'](_0x0063('0x137'),FILES_PATH,rs[_0x0063('0x122')](0x4));var _0x22b399=util[_0x0063('0x2b')]('%s.%s',_0x55143c,_0x1f727f);var _0x13b957=!![];if(_0x267d1f['beep']===_0x0063('0x139')){_0x13b957=![];}var _0x1a1cac=this[_0x0063('0x11')][_0x0063('0x13a')](_0x55143c,_0x1f727f,_0x267d1f[_0x0063('0x13f')],_0x267d1f[_0x0063('0x67')],undefined,_0x13b957);if(_0x1a1cac['result']!==-0x1){this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')]('ispeech\x20%s\x20file\x20created',_0x22b399));var _0xc6fc31=this['ispeechASR'][_0x0063('0x71')](this,_0x267d1f,_0x22b399);if(_0xc6fc31){for(var _0x310419 in _0xc6fc31){if(_0xc6fc31['hasOwnProperty'](_0x310419)){this[_0x0063('0x11')][_0x0063('0xa6')](util[_0x0063('0x2b')](_0x0063('0x158'),_0x310419[_0x0063('0xf3')]()),_0xc6fc31[_0x310419]);}}return this[_0x0063('0x11')]['noop'](util['format'](_0x0063('0x159'),JSON[_0x0063('0x75')](_0xc6fc31)));}}return _0x1a1cac;};AGIVertices[_0x0063('0x17')][_0x0063('0x15a')]=function(_0x343c99){logger[_0x0063('0x2f')](util['format'](_0x0063('0x15b'),_0x343c99['label']));if(!this['isConfigured'](_0x343c99[_0x0063('0x7c')])){return this['channel'][_0x0063('0xb3')](_0x0063('0xf1'));}if(!this[_0x0063('0x8a')](_0x343c99[_0x0063('0x5c')])){return this[_0x0063('0x11')]['noop']('no\x20text\x20configured');}this['channel'][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0x15c'),_0x343c99[_0x0063('0x5c')]));var _0x2a4da4=this[_0x0063('0x84')][_0x0063('0x71')](this,_0x343c99);if(_0x2a4da4){this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0x15d'),_0x2a4da4));var _0xe870bc=this[_0x0063('0x11')][_0x0063('0x10a')](_0x2a4da4,_0x343c99[_0x0063('0x13f')]);try{fs[_0x0063('0x10c')](_0x2a4da4+'.wav');}catch(_0x2b081d){logger[_0x0063('0x33')](_0x2b081d);}return _0xe870bc;}return this[_0x0063('0x11')]['error'](_0x343c99,_0x0063('0x15e'));};AGIVertices['prototype'][_0x0063('0x15f')]=function(_0x148e40){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x160'),_0x148e40[_0x0063('0xb2')]));if(!this[_0x0063('0x8a')](_0x148e40[_0x0063('0x161')])){return this['channel'][_0x0063('0x33')](_0x148e40,'no\x20find\x20by\x20configured');}logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x162'),this[_0x0063('0x11')][_0x0063('0x3c')],_0x148e40['findBy']));var _0xbb87d7=this[_0x0063('0x54')][_0x0063('0x71')](this,_0x148e40[_0x0063('0x161')]);if(_0xbb87d7){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x163'),this[_0x0063('0x11')]['callerid'],_0x148e40[_0x0063('0x161')]));this[_0x0063('0x11')]['noop'](util[_0x0063('0x2b')](_0x0063('0x163'),this['channel']['callerid'],_0x148e40[_0x0063('0x161')]));return{'code':0xc8,'result':_0x0063('0x164')};}else{logger[_0x0063('0x2f')](util['format'](_0x0063('0x165'),this[_0x0063('0x11')]['callerid'],_0x148e40['findBy']));this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x0063('0x3c')],_0x148e40[_0x0063('0x161')]));return{'code':0xc8,'result':_0x0063('0x166')};}};AGIVertices[_0x0063('0x17')][_0x0063('0x167')]=function(_0x2efab1){logger[_0x0063('0x2f')](util['format'](_0x0063('0x168'),_0x2efab1[_0x0063('0xb2')]));if(!this['isConfigured'](_0x2efab1['findBy'])){return this[_0x0063('0x11')][_0x0063('0x33')](_0x2efab1,'no\x20find\x20by\x20configured');}logger[_0x0063('0x2f')](util['format'](_0x0063('0x162'),this['channel'][_0x0063('0x3c')],_0x2efab1['findBy']));var _0xc036d4=this[_0x0063('0x50')][_0x0063('0x71')](this,_0x2efab1[_0x0063('0x161')]);if(_0xc036d4){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x163'),this['channel']['callerid'],_0x2efab1[_0x0063('0x161')]));this['channel'][_0x0063('0xb3')](util['format'](_0x0063('0x163'),this[_0x0063('0x11')][_0x0063('0x3c')],_0x2efab1['findBy']));return{'code':0xc8,'result':_0x0063('0x164')};}else{logger[_0x0063('0x2f')](util[_0x0063('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x0063('0x11')][_0x0063('0x3c')],_0x2efab1['findBy']));this[_0x0063('0x11')]['noop'](util[_0x0063('0x2b')](_0x0063('0x165'),this[_0x0063('0x11')][_0x0063('0x3c')],_0x2efab1['findBy']));return{'code':0xc8,'result':_0x0063('0x166')};}};AGIVertices[_0x0063('0x17')][_0x0063('0x169')]=function(_0x524846){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x16a'),_0x524846['label']));if(!this[_0x0063('0x8a')](_0x524846[_0x0063('0x16b')])){return this[_0x0063('0x11')][_0x0063('0x33')](_0x524846,_0x0063('0x16c'));}this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0x16d'),_0x524846[_0x0063('0x16b')]));var _0x204ca4=eval(_0x524846[_0x0063('0x16b')]);if(!this[_0x0063('0x8a')](_0x524846[_0x0063('0xe1')])){return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0xe2'));}var _0x2d54fd=this[_0x0063('0x13')][_0x0063('0x71')](this,_0x524846['variable_id']);if(!_0x2d54fd){return this[_0x0063('0x11')][_0x0063('0x33')](_0x524846,'no\x20variable\x20found');}if(_[_0x0063('0xa1')](_0x204ca4)){var _0x3cb820=this;_0x204ca4[_0x0063('0xe3')](function(_0x37750e,_0x392fae){_0x3cb820['channel'][_0x0063('0xa6')](util[_0x0063('0x2b')]('%s[%s]',_0x2d54fd,_0x392fae),_0x37750e);});return this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0x16e'),_0x2d54fd));}else{return this[_0x0063('0x11')][_0x0063('0xa6')](_0x2d54fd,_0x204ca4);}};AGIVertices[_0x0063('0x17')][_0x0063('0xe')]=function(_0x1fc808){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x16f'),_0x1fc808[_0x0063('0xb2')]));if(_0x1fc808[_0x0063('0xaf')]===0x0){return this[_0x0063('0xae')](_0x1fc808);}_0x1fc808[_0x0063('0xaf')]-=0x1;if(!this['isConfigured'](_0x1fc808[_0x0063('0x119')])){return this[_0x0063('0x11')][_0x0063('0x33')](_0x1fc808,'no\x20file\x20audio\x20selected');}var _0x1b60c5=this['getSound']['sync'](this,_0x1fc808[_0x0063('0x119')]);if(!_0x1b60c5){return this[_0x0063('0x11')][_0x0063('0x33')](_0x1fc808,_0x0063('0x11c'));}var _0x247b20=this['channel'][_0x0063('0x170')](_0x1b60c5,_0x1fc808[_0x0063('0x171')],_0x1fc808[_0x0063('0x172')]);var _0x1d2100=_0x247b20[_0x0063('0xac')];if(_0x247b20[_0x0063('0xac')]===-0x1){this[_0x0063('0x38')][_0x0063('0x71')](this,_0x1fc808,'-1');return _0x247b20;}else if(_0x247b20[_0x0063('0xa9')]===_0x0063('0x67')){_0x247b20[_0x0063('0xac')]=_0x247b20[_0x0063('0xac')][_0x0063('0xa2')]>0x0?_0x247b20[_0x0063('0xac')]:'t';}else if(_[_0x0063('0x46')](_0x247b20['result'])){_0x247b20[_0x0063('0xac')]='#';_0x1d2100='#';}if(!this[_0x0063('0x8a')](_0x1fc808[_0x0063('0xe1')])){this[_0x0063('0x11')][_0x0063('0xb3')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x157bc8=this['getVariable']['sync'](this,_0x1fc808[_0x0063('0xe1')]);if(!_0x157bc8){return this[_0x0063('0x11')][_0x0063('0x33')](_0x1fc808,_0x0063('0x120'));}this[_0x0063('0x11')][_0x0063('0xa6')](_0x157bc8,_0x1d2100);}this[_0x0063('0x38')][_0x0063('0x71')](this,_0x1fc808,_0x1d2100);return _0x247b20;};AGIVertices[_0x0063('0x17')][_0x0063('0xb3')]=function(_0x28424f){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x173'),_0x28424f[_0x0063('0xb2')]));return this[_0x0063('0x11')]['noop'](_0x28424f['output']||_0x28424f['label']);};AGIVertices[_0x0063('0x17')][_0x0063('0x174')]=function(_0x37e349){logger[_0x0063('0x2f')](util[_0x0063('0x2b')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x37e349['label']));if(!this[_0x0063('0x8a')](_0x37e349[_0x0063('0x161')])){return this[_0x0063('0x11')]['error'](_0x37e349,'no\x20find\x20by\x20configured');}logger[_0x0063('0x2f')](util['format'](_0x0063('0x162'),this[_0x0063('0x11')][_0x0063('0x3c')],_0x37e349[_0x0063('0x161')]));var _0x4d0da1=this[_0x0063('0x4b')][_0x0063('0x71')](this,_0x37e349[_0x0063('0x175')]);var _0x1852ed=this['agentPause']['sync'](this,_0x37e349[_0x0063('0x161')],_0x4d0da1);if(_0x1852ed){logger[_0x0063('0x2f')](util[_0x0063('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x0063('0x11')][_0x0063('0x3c')],_0x37e349[_0x0063('0x161')]));this[_0x0063('0x11')]['noop'](util[_0x0063('0x2b')](_0x0063('0x163'),this[_0x0063('0x11')]['callerid'],_0x37e349[_0x0063('0x161')]));return{'code':0xc8,'result':_0x0063('0x164')};}else{logger['info'](util[_0x0063('0x2b')](_0x0063('0x165'),this[_0x0063('0x11')][_0x0063('0x3c')],_0x37e349['findBy']));this['channel'][_0x0063('0xb3')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x0063('0x3c')],_0x37e349[_0x0063('0x161')]));return{'code':0xc8,'result':_0x0063('0x166')};}};AGIVertices['prototype'][_0x0063('0x176')]=function(_0x1ef89f){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x177'),_0x1ef89f['label']));if(!this[_0x0063('0x8a')](_0x1ef89f[_0x0063('0x119')])){return this[_0x0063('0x11')][_0x0063('0x33')](_0x1ef89f,_0x0063('0x11a'));}var _0x514df3=this[_0x0063('0x11b')][_0x0063('0x71')](this,_0x1ef89f[_0x0063('0x119')]);if(!_0x514df3){return this[_0x0063('0x11')]['error'](_0x1ef89f,'no\x20file\x20audio\x20found');}var _0x4a6844=this['channel'][_0x0063('0x56')](_0x0063('0x178'),[_0x514df3,_0x1ef89f[_0x0063('0xee')]]);if(_0x4a6844[_0x0063('0xac')]===-0x1){return _0x4a6844;}return this[_0x0063('0x11')][_0x0063('0xb3')](util['format'](_0x0063('0x179'),_0x0063('0x178'),_0x514df3));};AGIVertices[_0x0063('0x17')][_0x0063('0x17a')]=function(_0x48e869){logger[_0x0063('0x2f')](util['format'](_0x0063('0x17b'),_0x48e869[_0x0063('0xb2')]));if(!this[_0x0063('0x8a')](_0x48e869[_0x0063('0x17c')])){return this[_0x0063('0x11')][_0x0063('0x33')](_0x48e869,_0x0063('0x17d'));}var _0x431211='';var _0x1b1792=parseInt(_0x48e869[_0x0063('0x17c')],0xa);if(isNaN(_0x1b1792)){_0x431211=_0x48e869[_0x0063('0x17c')];}else{_0x431211=this['getVoiceQueue'][_0x0063('0x71')](this,_0x48e869['queue_id']);if(!_0x431211){return this[_0x0063('0x11')]['error'](_0x48e869,_0x0063('0x17e'));}}var _0x36567a='';if(this['isConfigured'](_0x48e869['file_id'])){var _0x1db351=this['getSound'][_0x0063('0x71')](this,_0x48e869[_0x0063('0x119')]);if(_0x1db351){_0x36567a=_0x1db351;}}this[_0x0063('0x38')][_0x0063('0x71')](this,_0x48e869,_0x431211);if(_0x48e869['opts'][_0x0063('0x17f')]('x')<0x0){_0x48e869['opts']+='x';}if(_0x48e869['opts']['indexOf']('X')<0x0){_0x48e869['opts']+='X';}this[_0x0063('0x11')][_0x0063('0xa6')](_0x0063('0x180'),_0x431211?_0x431211[_0x0063('0x181')]():'');var _0x4f89fc=this[_0x0063('0x11')][_0x0063('0x56')](_0x0063('0x182'),[_0x431211,_0x48e869[_0x0063('0xee')],_0x48e869[_0x0063('0x65')],_0x36567a,_0x48e869[_0x0063('0x67')],_0x48e869[_0x0063('0x9')],_0x48e869[_0x0063('0x183')],_0x48e869['gosub'],'',_0x48e869['position']]);if(_0x4f89fc[_0x0063('0xac')]===-0x1){return _0x4f89fc;}return this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0x179'),'QUEUE',_0x431211));};AGIVertices[_0x0063('0x17')][_0x0063('0x184')]=function(_0x12822a){logger['info'](util[_0x0063('0x2b')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x12822a[_0x0063('0xb2')]));var _0x57ee7a=_0x12822a[_0x0063('0x185')]||_0x0063('0x136');var _0x443281=util[_0x0063('0x2b')](_0x0063('0x186'),this[_0x0063('0x11')][_0x0063('0x39')],rs['generate'](0x5));var _0xa24609=util[_0x0063('0x2b')](_0x0063('0x187'),FILES_PATH,_0x443281,_0x57ee7a);var _0x2a3aeb=util['format'](_0x0063('0x137'),FILES_PATH,_0x443281);this[_0x0063('0x3d')][_0x0063('0x71')](this,_0x12822a,_0x443281,_0xa24609);this[_0x0063('0x11')][_0x0063('0xa6')](_0x0063('0x188'),_0x443281);logger[_0x0063('0x2f')](_0x0063('0x189'),_0x2a3aeb,_0x57ee7a,_0x12822a['escape_digits'],_0x12822a['timeout']);return this['channel'][_0x0063('0x13a')](_0x2a3aeb,_0x57ee7a,_0x12822a[_0x0063('0x18a')],_0x12822a[_0x0063('0x67')],undefined,!![]);};AGIVertices['prototype'][_0x0063('0x18b')]=function(_0xc89aef){logger['info'](util[_0x0063('0x2b')](_0x0063('0x18c'),_0xc89aef['label']));if(!this['isConfigured'](_0xc89aef['url'])){return this['channel'][_0x0063('0xb3')](_0x0063('0x18d'));}var _0x1e3bb6=this[_0x0063('0x64')][_0x0063('0x71')](this,_0xc89aef);logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x18e'),util[_0x0063('0x18f')](_0x1e3bb6,{'showHidden':![],'depth':null})));if(!this[_0x0063('0x8a')](_0xc89aef['variable_id'])){return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0x190'));}var _0x488f59=this[_0x0063('0x13')]['sync'](this,_0xc89aef[_0x0063('0xe1')]);if(!_0x488f59){return this['channel']['error'](_0xc89aef,'no\x20variable\x20found');}this[_0x0063('0x11')][_0x0063('0xa6')](util[_0x0063('0x2b')]('%s_STATUS_CODE',_0x488f59),_0x1e3bb6['statusCode']?_0x1e3bb6[_0x0063('0x78')]:_0x0063('0x191'));this[_0x0063('0x11')][_0x0063('0xa6')](util[_0x0063('0x2b')](_0x0063('0x192'),_0x488f59),_0x1e3bb6['statusMessage']?_0x1e3bb6['statusMessage']:'OK');if(_0x1e3bb6[_0x0063('0x76')]){try{this[_0x0063('0xa4')](_0x1e3bb6[_0x0063('0x76')],_0x488f59);}catch(_0x1b0974){logger[_0x0063('0x33')](util['format'](_0x0063('0x193'),_0x488f59));}}return this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')]('variable\x20%s\x20set',_0x488f59));};AGIVertices[_0x0063('0x17')][_0x0063('0x194')]=function(_0x56001e){logger['info'](util[_0x0063('0x2b')](_0x0063('0x195'),_0x56001e[_0x0063('0xb2')]));return this[_0x0063('0x11')]['sayDigits'](_0x56001e['digits'][_0x0063('0x58')](/\s+/g,''),_0x56001e['escape_digits']);};AGIVertices[_0x0063('0x17')]['saynumber']=function(_0x4d5e11){logger[_0x0063('0x2f')](util['format']('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x4d5e11['label']));return this['channel'][_0x0063('0x196')](_0x4d5e11['number']['replace'](/\s+/g,''),_0x4d5e11[_0x0063('0x18a')]);};AGIVertices[_0x0063('0x17')]['sayphonetic']=function(_0x5399e1){logger[_0x0063('0x2f')](util['format'](_0x0063('0x197'),_0x5399e1['label']));return this[_0x0063('0x11')][_0x0063('0x198')](_0x5399e1[_0x0063('0x5c')],_0x5399e1[_0x0063('0x18a')]);};AGIVertices['prototype'][_0x0063('0x199')]=function(_0x560f06){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x19a'),_0x560f06[_0x0063('0xb2')]));if(!this[_0x0063('0x8a')](_0x560f06[_0x0063('0x19b')])){return this[_0x0063('0x11')][_0x0063('0xb3')]('no\x20mail\x20account\x20configured');}var _0x332199=this[_0x0063('0x25')]['sync'](this,_0x560f06['account_id']);if(!_0x332199||!_0x332199[_0x0063('0x19c')]){return this[_0x0063('0x11')][_0x0063('0x33')](_0x560f06,_0x0063('0x19d'));}var _0x16b85b={'from':util[_0x0063('0x2b')](_0x0063('0x19e'),_0x332199[_0x0063('0x1b')],_0x332199['email']||_0x332199[_0x0063('0x19c')]['user']),'to':_0x560f06['to']||'','cc':_0x560f06['cc']||'','bcc':_0x560f06['bcc']||'','subject':_0x560f06[_0x0063('0x19f')],'html':_0x560f06['text'],'text':_0x560f06[_0x0063('0x5c')]};var _0x260f35={'tls':{'rejectUnauthorized':![]}};if(_0x332199['Smtp'][_0x0063('0x1a0')]){_0x260f35[_0x0063('0x1a0')]=_0x332199[_0x0063('0x19c')][_0x0063('0x1a0')];}else{_0x260f35[_0x0063('0x1a1')]=_0x332199[_0x0063('0x19c')][_0x0063('0x1a1')];_0x260f35[_0x0063('0x1a2')]=_0x332199['Smtp'][_0x0063('0x1a2')];_0x260f35[_0x0063('0x1a3')]=_0x332199[_0x0063('0x19c')]['secure'];}if(_0x332199[_0x0063('0x19c')][_0x0063('0x1a4')]){_0x260f35['auth']={'user':_0x332199[_0x0063('0x19c')]['user'],'pass':_0x332199[_0x0063('0x19c')][_0x0063('0x1a5')]};}if(this['isConfigured'](_0x560f06['template_id'])){}logger[_0x0063('0xe9')](_0x0063('0x1a6'),JSON[_0x0063('0x75')](_0x16b85b));this[_0x0063('0x38')]['sync'](this,_0x560f06,_0x560f06[_0x0063('0x19b')]);this[_0x0063('0x11')][_0x0063('0xb3')](util['format'](_0x0063('0x1a7'),_0x332199['name']));this[_0x0063('0x27')][_0x0063('0x71')](this,_0x260f35,_0x16b85b);return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0x1a8'));};AGIVertices['prototype'][_0x0063('0x1a9')]=function(_0x3172a5){logger[_0x0063('0x2f')](util[_0x0063('0x2b')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x3172a5[_0x0063('0xb2')]));return this['channel']['noop'](_0x0063('0x1aa'));};AGIVertices[_0x0063('0x17')]['sendSMS']=function(_0x33b053){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x1ab'),_0x33b053[_0x0063('0xb2')]));if(!this[_0x0063('0x8a')](_0x33b053[_0x0063('0x1ac')])){return this[_0x0063('0x11')]['noop'](_0x0063('0x1ad'));}var _0x181925=this[_0x0063('0x35')][_0x0063('0x71')](this,_0x33b053[_0x0063('0x1ac')]);if(!_0x181925){return this[_0x0063('0x11')][_0x0063('0x33')](_0x33b053,'no\x20sms\x20account\x20found');}var _0x1a26b8={'body':_0x33b053[_0x0063('0x1ae')],'phone':_0x33b053['to']||'','SmsAccountId':_0x181925['id']};logger[_0x0063('0xe9')](_0x0063('0x1af'),JSON['stringify'](_0x1a26b8));this[_0x0063('0x38')][_0x0063('0x71')](this,_0x33b053,_0x33b053['sms_account_id']);this[_0x0063('0x11')][_0x0063('0xb3')](util['format'](_0x0063('0x1b0'),_0x181925[_0x0063('0x1b')]));this[_0x0063('0x37')][_0x0063('0x71')](this,_0x1a26b8);return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0x1b1'));};AGIVertices[_0x0063('0x17')][_0x0063('0x1b2')]=function(_0x138797){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x1b3'),_0x138797[_0x0063('0xb2')]));if(!this[_0x0063('0x8a')](_0x138797[_0x0063('0xe1')])){return this[_0x0063('0x11')][_0x0063('0x33')](_0x138797,'no\x20variable\x20selected');}var _0x1e4787=this['getVariable']['sync'](this,_0x138797[_0x0063('0xe1')]);if(!_0x1e4787){return this[_0x0063('0x11')][_0x0063('0x33')](_0x138797,_0x0063('0x120'));}return this['channel'][_0x0063('0xa6')](_0x1e4787,_0x138797[_0x0063('0x1b4')]);};AGIVertices[_0x0063('0x17')][_0x0063('0x1b5')]=function(_0x114065){logger[_0x0063('0x2f')](util[_0x0063('0x2b')]('Enter\x20in\x20START\x20(%s)\x20block',_0x114065['label']));this['channel'][_0x0063('0xb3')](_0x0063('0x1b6'));if(_0x114065[_0x0063('0xc3')]===_0x0063('0x1b7')){this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0x1b8'));return this[_0x0063('0x11')]['answer']();}return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0x1b9'));};AGIVertices['prototype'][_0x0063('0x1ba')]=function(_0x385141){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x1bb'),_0x385141[_0x0063('0xb2')]));if(!this['isConfigured'](_0x385141['project_id'])){return this['channel'][_0x0063('0x33')](_0x385141,_0x0063('0x1bc'));}var _0x424e42=this[_0x0063('0x19')][_0x0063('0x71')](this,_0x385141[_0x0063('0x1bd')]);if(!this['isConfigured'](_0x424e42)){return this['channel']['error'](_0x385141,util[_0x0063('0x2b')](_0x0063('0x1be'),_0x385141[_0x0063('0x1bd')]));}if(_0x424e42===this[_0x0063('0x11')][_0x0063('0x3b')]){return this[_0x0063('0x11')][_0x0063('0x33')](_0x385141,_0x0063('0x1bf'));}this[_0x0063('0x38')][_0x0063('0x71')](this,_0x385141,_0x424e42);var _0x5f44ab=this[_0x0063('0x11')][_0x0063('0x56')](_0x0063('0x1c0'),util[_0x0063('0x2b')](_0x0063('0x1c1'),config[_0x0063('0x9')][_0x0063('0x1a1')]||_0x0063('0x1c2'),_0x424e42,this[_0x0063('0x11')][_0x0063('0x3b')]));if(_0x5f44ab[_0x0063('0xac')]===-0x1){return _0x5f44ab;}return this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0x179'),_0x0063('0x1c0'),_0x424e42));};AGIVertices[_0x0063('0x17')][_0x0063('0x1c3')]=function(_0x46b00e){logger['info'](util[_0x0063('0x2b')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x46b00e[_0x0063('0xb2')]));var _0x3d3d5e=this['shellCommand'][_0x0063('0x71')](this,_0x46b00e[_0x0063('0xc1')]);this[_0x0063('0x38')][_0x0063('0x71')](this,_0x46b00e,_0x46b00e[_0x0063('0xc1')]);if(this[_0x0063('0x8a')](_0x46b00e[_0x0063('0xe1')])){var _0x5867e0=this[_0x0063('0x13')][_0x0063('0x71')](this,_0x46b00e[_0x0063('0xe1')]);if(_0x5867e0){this['channel'][_0x0063('0xa6')](_0x5867e0,_0x3d3d5e);return this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0x1c4'),_0x46b00e[_0x0063('0xc1')],_0x5867e0));}}return this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0x1c5'),_0x46b00e[_0x0063('0xc1')]));};AGIVertices['prototype'][_0x0063('0x1c6')]=function(_0xf3fa60){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x1c7'),_0xf3fa60[_0x0063('0xb2')]));_0xf3fa60[_0x0063('0x5c')]=_0xf3fa60[_0x0063('0x5c')][_0x0063('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0063('0x8a')](_0xf3fa60['apiKey'])){return this[_0x0063('0x11')]['noop'](_0x0063('0x1c8'));}if(!this[_0x0063('0x8a')](_0xf3fa60[_0x0063('0x5c')])){return this[_0x0063('0x11')][_0x0063('0xb3')](_0x0063('0xb4'));}this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0x1c9'),_0xf3fa60['text']));var _0x412e62=this[_0x0063('0x59')][_0x0063('0x71')](this,_0xf3fa60);if(_0x412e62){this[_0x0063('0x11')]['noop'](util[_0x0063('0x2b')](_0x0063('0x1ca'),_0x412e62));var _0x370801=this[_0x0063('0x11')][_0x0063('0x10a')](_0x412e62);try{fs[_0x0063('0x10c')](_0x412e62+_0x0063('0x10d'));}catch(_0x40695f){logger['error'](_0x40695f);}return _0x370801;}return this[_0x0063('0x11')]['error'](_0xf3fa60,_0x0063('0x1cb'));};AGIVertices[_0x0063('0x17')][_0x0063('0x1cc')]=function(_0x39f01c){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x1cd'),_0x39f01c[_0x0063('0xb2')]));_0x39f01c[_0x0063('0x5c')]=_0x39f01c[_0x0063('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x0063('0x8a')](_0x39f01c['text'])){return this['channel']['noop'](_0x0063('0xb4'));}this[_0x0063('0x11')][_0x0063('0xb3')](util['format'](_0x0063('0x1ce'),_0x39f01c[_0x0063('0x5c')]));var _0x2acdc7=this[_0x0063('0x62')][_0x0063('0x71')](this,_0x39f01c);if(_0x2acdc7){this['channel']['noop'](util[_0x0063('0x2b')](_0x0063('0x1cf'),_0x2acdc7));var _0x212c09=this['channel'][_0x0063('0x10a')](_0x2acdc7);try{fs['unlink'](_0x2acdc7+_0x0063('0x10d'));}catch(_0x47adf3){logger['error'](_0x47adf3);}return _0x212c09;}return this[_0x0063('0x11')][_0x0063('0x33')](_0x39f01c,_0x0063('0x1d0'));};AGIVertices[_0x0063('0x17')][_0x0063('0x1d1')]=function(_0x45c2b8){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x1d2'),_0x45c2b8[_0x0063('0xb2')]));if(!this[_0x0063('0x8a')](_0x45c2b8[_0x0063('0x161')])){return this[_0x0063('0x11')][_0x0063('0x33')](_0x45c2b8,_0x0063('0x1d3'));}logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x162'),this[_0x0063('0x11')][_0x0063('0x3c')],_0x45c2b8['findBy']));var _0x5292b5=this['agentUnpause'][_0x0063('0x71')](this,_0x45c2b8[_0x0063('0x161')]);if(_0x5292b5){logger[_0x0063('0x2f')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x0063('0x11')][_0x0063('0x3c')],_0x45c2b8[_0x0063('0x161')]));this['channel'][_0x0063('0xb3')](util['format'](_0x0063('0x163'),this[_0x0063('0x11')]['callerid'],_0x45c2b8['findBy']));return{'code':0xc8,'result':_0x0063('0x164')};}else{logger[_0x0063('0x2f')](util['format'](_0x0063('0x165'),this[_0x0063('0x11')][_0x0063('0x3c')],_0x45c2b8['findBy']));this[_0x0063('0x11')][_0x0063('0xb3')](util[_0x0063('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x45c2b8[_0x0063('0x161')]));return{'code':0xc8,'result':_0x0063('0x166')};}};AGIVertices[_0x0063('0x17')]['voicemail']=function(_0x202496){logger[_0x0063('0x2f')](util['format'](_0x0063('0x1d4'),_0x202496[_0x0063('0xb2')]));var _0x5375a9=this['channel']['exec']('VOICEMAIL',[_0x202496[_0x0063('0x1d5')],_0x202496['options']]);if(_0x5375a9[_0x0063('0xac')]===-0x1){return _0x5375a9;}return this['channel'][_0x0063('0xb3')](util[_0x0063('0x2b')](_0x0063('0x179'),'VOICEMAIL',_0x202496[_0x0063('0x1d5')]));};AGIVertices['prototype'][_0x0063('0x1d6')]=function(_0x819d11){logger[_0x0063('0x2f')](util[_0x0063('0x2b')](_0x0063('0x1d7'),_0x819d11[_0x0063('0xb2')]));if(!this[_0x0063('0x8a')](_0x819d11['variable_id'])){return this['channel'][_0x0063('0x33')](_0x819d11,_0x0063('0x1d8'));}var _0x56101=this['getVariable'][_0x0063('0x71')](this,_0x819d11[_0x0063('0xe1')]);if(!_0x56101){return this[_0x0063('0x11')]['error'](_0x819d11,_0x0063('0x120'));}var _0x56a8ab=this['channel'][_0x0063('0x13')](_0x56101);return{'code':0xc8,'result':_0x56a8ab[_0x0063('0xa9')]?_0x56a8ab[_0x0063('0xa9')]:'-'};};String[_0x0063('0x17')][_0x0063('0xa8')]=function(_0x31cb5b,_0x23f747){return this[_0x0063('0xa7')](_0x31cb5b)['join'](_0x23f747);};module[_0x0063('0x1d9')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index e1beb82..3014497 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 _0x3e5d=['syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','saveUnpause','update','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','message','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer'];(function(_0x866893,_0x5d1eaf){var _0x12f9a7=function(_0x47fb12){while(--_0x47fb12){_0x866893['push'](_0x866893['shift']());}};_0x12f9a7(++_0x5d1eaf);}(_0x3e5d,0x15b));var _0xd3e5=function(_0x1cf1e1,_0x2f49f6){_0x1cf1e1=_0x1cf1e1-0x0;var _0x358c4c=_0x3e5d[_0x1cf1e1];return _0x358c4c;};'use strict';var util=require(_0xd3e5('0x0'));var _=require(_0xd3e5('0x1'));var moment=require(_0xd3e5('0x2'));var ami=require(_0xd3e5('0x3'));var logger=require(_0xd3e5('0x4'))(_0xd3e5('0x5'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xd3e5('0x6'));function Acw(_0x192841){this[_0xd3e5('0x7')]=_0x192841[_0xd3e5('0x7')];this[_0xd3e5('0x8')]=_0x192841[_0xd3e5('0x8')];this[_0xd3e5('0x9')]=_0x192841['timers'];this[_0xd3e5('0xa')]={};ami['on'](_0xd3e5('0xb'),this[_0xd3e5('0xc')][_0xd3e5('0xd')](this));ami['on'](_0xd3e5('0xe'),this[_0xd3e5('0xf')][_0xd3e5('0xd')](this));ami['on']('hangup',this[_0xd3e5('0x10')][_0xd3e5('0xd')](this));ami['on'](_0xd3e5('0x11'),this[_0xd3e5('0x12')][_0xd3e5('0xd')](this));ami['on'](_0xd3e5('0x13'),this['syncAttendedTransfer'][_0xd3e5('0xd')](this));ami['on'](_0xd3e5('0x14'),this[_0xd3e5('0x15')]['bind'](this));ami['on'](_0xd3e5('0x16'),this[_0xd3e5('0x17')]['bind'](this));}function getDiff(_0x24a502){var _0x4e7983=moment()[_0xd3e5('0x18')](0x0);var _0x154afb=moment(_0x24a502)[_0xd3e5('0x18')](0x0);return _0x4e7983[_0xd3e5('0x19')](_0x154afb,_0xd3e5('0x1a'));}Acw[_0xd3e5('0x1b')][_0xd3e5('0x1c')]=function(_0x17c817){try{var _0x31b94f=this;var _0x3107c1=this[_0xd3e5('0xa')][_0x17c817]['interface'];var _0x144a64=this[_0xd3e5('0xa')][_0x17c817][_0xd3e5('0x1d')];var _0x3d5fcb=this[_0xd3e5('0x7')][_0x144a64];var _0x5a67b2=![];var _0x2959ce=_0xd3e5('0x1e');if(_0x3d5fcb[_0xd3e5('0x1f')]){if(_0x3d5fcb[_0xd3e5('0x20')][_0xd3e5('0x21')]){_0x5a67b2=!![];_0x2959ce=_0x3d5fcb[_0xd3e5('0x20')][_0xd3e5('0x21')];}}ami[_0xd3e5('0x22')]({'action':_0xd3e5('0x23'),'interface':_0x3107c1,'paused':!![],'reason':_0x2959ce})[_0xd3e5('0x24')](function(_0x539d89){if(_0x31b94f[_0xd3e5('0x8')][_0x3107c1]){return RpcUser[_0xd3e5('0x25')](_0x31b94f[_0xd3e5('0x8')][_0x3107c1]['id'])[_0xd3e5('0x24')](function(_0x118b5f){if(_0x118b5f&&!_0x118b5f[_0xd3e5('0x26')]){logger['info'](_0xd3e5('0x27'),_0x17c817,_0x3107c1,_0x144a64);var _0x25ab31=_0x31b94f[_0xd3e5('0xa')][_0x17c817]['attended']&&_0x31b94f['channels'][_0x17c817][_0xd3e5('0x28')]?_0x31b94f[_0xd3e5('0xa')][_0x17c817][_0xd3e5('0x28')]:_0x17c817;return RpcUser[_0xd3e5('0x29')](_0x31b94f[_0xd3e5('0x8')][_0x3107c1],_0x2959ce,_0x25ab31)['then'](function(_0x500022){if(!_0x5a67b2){_0x31b94f[_0xd3e5('0x9')][_0x3107c1]={};logger[_0xd3e5('0x2a')](_0xd3e5('0x2b'),_0x17c817,_0x31b94f['voiceQueues'][_0x144a64][_0xd3e5('0x2c')],_0x3107c1,_0x144a64);_0x31b94f['timers'][_0x3107c1][_0xd3e5('0x2d')]=setTimeout(_0x31b94f[_0xd3e5('0x2e')]['bind'](_0x31b94f,_0x3107c1),_0x31b94f[_0xd3e5('0x7')][_0x144a64][_0xd3e5('0x2c')]*0x3e8);_0x31b94f[_0xd3e5('0x9')][_0x3107c1][_0xd3e5('0x2f')]=moment()[_0xd3e5('0x30')](_0xd3e5('0x31'));_0x31b94f[_0xd3e5('0x9')][_0x3107c1][_0xd3e5('0x32')]=_0x17c817;_0x31b94f[_0xd3e5('0x9')][_0x3107c1][_0xd3e5('0x1d')]=_0x144a64;_0x31b94f[_0xd3e5('0x9')][_0x3107c1][_0xd3e5('0x33')]=function(){var _0x5b43bf=getDiff(_0x31b94f[_0xd3e5('0x9')][_0x3107c1]['lastPauseAt']);clearTimeout(_0x31b94f[_0xd3e5('0x9')][_0x3107c1][_0xd3e5('0x2d')]);_0x31b94f[_0xd3e5('0x9')][_0x3107c1][_0xd3e5('0x2d')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x5b43bf},_0x31b94f[_0xd3e5('0x9')][_0x3107c1][_0xd3e5('0x32')],_0x3107c1)['then'](function(_0x37959a){logger[_0xd3e5('0x2a')]('[%s][UPDATE][ACWTIME:%s]',_0x17c817,_0x5b43bf,_0x37959a);})[_0xd3e5('0x34')](function(_0x38b69a){logger['error'](_0xd3e5('0x35'),_0x17c817,_0x38b69a);});delete _0x31b94f['timers'][_0x3107c1];};}});}else{logger[_0xd3e5('0x2a')](_0xd3e5('0x36'),_0x17c817,_0x3107c1,_0x144a64);}});}})[_0xd3e5('0x34')](function(_0x198759){logger[_0xd3e5('0x37')](_0xd3e5('0x2b'),_0x17c817,_0x31b94f[_0xd3e5('0x7')][_0x144a64][_0xd3e5('0x2c')],_0x3107c1,_0x144a64);})[_0xd3e5('0x38')](function(){delete _0x31b94f['channels'][_0x17c817];});}catch(_0x298dd6){logger[_0xd3e5('0x37')](_0xd3e5('0x39'),_0x298dd6['message']);}};Acw['prototype'][_0xd3e5('0x2e')]=function(_0x54133c){try{var _0x1a7501=this;if(_0x1a7501[_0xd3e5('0x9')][_0x54133c]){_0x1a7501['timers'][_0x54133c]['timer']=![];var _0x46c1b7=_0x1a7501[_0xd3e5('0x9')][_0x54133c][_0xd3e5('0x32')];var _0x1d77de=_0x1a7501['timers'][_0x54133c][_0xd3e5('0x1d')];var _0x3f37f7=_0x1a7501[_0xd3e5('0x7')][_0x1d77de][_0xd3e5('0x2c')];logger[_0xd3e5('0x2a')]('[%s][TIMER][STOP][AGENT:%s]',_0x46c1b7,_0x54133c);RpcUser[_0xd3e5('0x3a')](this[_0xd3e5('0x8')][_0x54133c]);RpcVoiceAgentReport[_0xd3e5('0x3b')]({'acwtime':_0x3f37f7,'agentacw':!![]},_0x46c1b7,_0x54133c)[_0xd3e5('0x24')](function(_0x45b216){logger[_0xd3e5('0x2a')](_0xd3e5('0x3c'),_0x46c1b7,_0x3f37f7,_0x45b216);})['catch'](function(_0x483932){logger[_0xd3e5('0x37')]('[%s][UPDATE][ERRORS:%s]',_0x46c1b7,_0x483932);});}else{logger[_0xd3e5('0x37')](_0xd3e5('0x3d'),_0x54133c);if(_0x1a7501[_0xd3e5('0x9')]){logger[_0xd3e5('0x2a')]('[ACW][TIMERS]',JSON[_0xd3e5('0x3e')](_0x1a7501[_0xd3e5('0x9')]));}}}catch(_0x4504c6){logger[_0xd3e5('0x37')](_0xd3e5('0x3f'),_0x4504c6[_0xd3e5('0x40')]);}};Acw[_0xd3e5('0x1b')][_0xd3e5('0xc')]=function(_0x3ffb00){try{if(this[_0xd3e5('0x7')][_0x3ffb00[_0xd3e5('0x1d')]]&&(this[_0xd3e5('0x7')][_0x3ffb00[_0xd3e5('0x1d')]][_0xd3e5('0x5')]||this['voiceQueues'][_0x3ffb00[_0xd3e5('0x1d')]][_0xd3e5('0x1f')])){if(this[_0xd3e5('0x8')][_0x3ffb00[_0xd3e5('0x41')]]){this[_0xd3e5('0xa')][_0x3ffb00[_0xd3e5('0x32')]]={'queue':_0x3ffb00[_0xd3e5('0x1d')],'interface':_0x3ffb00[_0xd3e5('0x41')],'destlinkedid':_0x3ffb00[_0xd3e5('0x28')]};}}}catch(_0x248e8d){logger[_0xd3e5('0x37')](_0xd3e5('0x42'),_0x248e8d[_0xd3e5('0x40')]);}};Acw[_0xd3e5('0x1b')]['syncAgentConnectPreview']=function(_0x37d096){try{if(this[_0xd3e5('0x7')][_0x37d096[_0xd3e5('0x1d')]]&&(this[_0xd3e5('0x7')][_0x37d096[_0xd3e5('0x1d')]]['acw']||this['voiceQueues'][_0x37d096['queue']][_0xd3e5('0x1f')])){if(this[_0xd3e5('0x8')][_0x37d096[_0xd3e5('0x41')]]){this[_0xd3e5('0xa')][_0x37d096[_0xd3e5('0x32')]]={'queue':_0x37d096[_0xd3e5('0x1d')],'interface':_0x37d096[_0xd3e5('0x41')]};}}}catch(_0x27cece){logger[_0xd3e5('0x37')](_0xd3e5('0x43'),_0x27cece[_0xd3e5('0x40')]);}};Acw[_0xd3e5('0x1b')]['syncHangupRequest']=function(_0x598f62){try{if(this[_0xd3e5('0xa')][_0x598f62[_0xd3e5('0x32')]]&&_[_0xd3e5('0x44')](this['channels'][_0x598f62[_0xd3e5('0x32')]][_0xd3e5('0x45')])){logger[_0xd3e5('0x2a')](_0xd3e5('0x46'),_0x598f62[_0xd3e5('0x32')]);this['startAcw'](_0x598f62['uniqueid']);}else if(this[_0xd3e5('0xa')][_0x598f62[_0xd3e5('0x47')]]&&_[_0xd3e5('0x44')](this[_0xd3e5('0xa')][_0x598f62[_0xd3e5('0x47')]]['attended'])){logger[_0xd3e5('0x2a')](_0xd3e5('0x48'),_0x598f62[_0xd3e5('0x47')]);this[_0xd3e5('0x1c')](_0x598f62[_0xd3e5('0x47')]);}}catch(_0x3e7d31){logger[_0xd3e5('0x37')](_0xd3e5('0x49'),_0x3e7d31[_0xd3e5('0x40')]);}};Acw[_0xd3e5('0x1b')][_0xd3e5('0x10')]=function(_0x48c32d){try{if(this['channels'][_0x48c32d[_0xd3e5('0x32')]]&&this[_0xd3e5('0xa')][_0x48c32d[_0xd3e5('0x32')]][_0xd3e5('0x45')]){logger['info'](_0xd3e5('0x4a'),_0x48c32d[_0xd3e5('0x32')]);this[_0xd3e5('0x1c')](_0x48c32d[_0xd3e5('0x32')]);}else if(this['channels'][_0x48c32d[_0xd3e5('0x47')]]&&this['channels'][_0x48c32d[_0xd3e5('0x47')]][_0xd3e5('0x45')]){logger[_0xd3e5('0x2a')](_0xd3e5('0x4b'),_0x48c32d[_0xd3e5('0x47')]);this[_0xd3e5('0x1c')](_0x48c32d[_0xd3e5('0x47')]);}}catch(_0x1ef780){logger[_0xd3e5('0x37')](_0xd3e5('0x4c'),_0x1ef780[_0xd3e5('0x40')]);}};Acw[_0xd3e5('0x1b')]['syncAttendedTransfer']=function(_0x3b4c5c){try{if(!_[_0xd3e5('0x4d')](this[_0xd3e5('0xa')][_0x3b4c5c['transfereeuniqueid']])){this[_0xd3e5('0x1c')](_0x3b4c5c[_0xd3e5('0x4e')]);if(this[_0xd3e5('0xa')][_0x3b4c5c['secondtransfereruniqueid']]){this[_0xd3e5('0xa')][_0x3b4c5c[_0xd3e5('0x4f')]][_0xd3e5('0x45')]=!![];this[_0xd3e5('0xa')][_0x3b4c5c[_0xd3e5('0x50')]]=this[_0xd3e5('0xa')][_0x3b4c5c[_0xd3e5('0x4f')]];delete this['channels'][_0x3b4c5c['secondtransfereruniqueid']];}}else if(!_[_0xd3e5('0x4d')](this['channels'][_0x3b4c5c[_0xd3e5('0x50')]])){this[_0xd3e5('0x1c')](_0x3b4c5c['transfertargetuniqueid']);if(this[_0xd3e5('0xa')][_0x3b4c5c['origtransfereruniqueid']]){this[_0xd3e5('0xa')][_0x3b4c5c['origtransfereruniqueid']][_0xd3e5('0x45')]=!![];this[_0xd3e5('0xa')][_0x3b4c5c[_0xd3e5('0x4e')]]=this[_0xd3e5('0xa')][_0x3b4c5c[_0xd3e5('0x51')]];delete this[_0xd3e5('0xa')][_0x3b4c5c[_0xd3e5('0x51')]];}}}catch(_0x4ecf80){logger['error'](_0xd3e5('0x52'),_0x4ecf80[_0xd3e5('0x40')]);}};Acw['prototype']['syncBlindTransfer']=function(_0x4e3ea3){try{if(this[_0xd3e5('0xa')][_0x4e3ea3[_0xd3e5('0x53')]]){logger[_0xd3e5('0x2a')](_0xd3e5('0x54'),JSON[_0xd3e5('0x3e')](_0x4e3ea3[_0xd3e5('0x53')]));this[_0xd3e5('0x1c')](_0x4e3ea3[_0xd3e5('0x53')]);}else if(this[_0xd3e5('0xa')][_0x4e3ea3[_0xd3e5('0x55')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xd3e5('0x3e')](_0x4e3ea3[_0xd3e5('0x55')]));this['startAcw'](_0x4e3ea3[_0xd3e5('0x55')]);}}catch(_0x1b4fbd){logger[_0xd3e5('0x37')](_0xd3e5('0x56'),_0x1b4fbd[_0xd3e5('0x40')]);}};Acw[_0xd3e5('0x1b')]['syncAgentRingNoAnswer']=function(_0x382ff8){try{if(this[_0xd3e5('0x7')][_0x382ff8[_0xd3e5('0x1d')]]&&this['voiceQueues'][_0x382ff8[_0xd3e5('0x1d')]][_0xd3e5('0x57')]==='all'){if(this['agents'][_0x382ff8[_0xd3e5('0x41')]]){logger[_0xd3e5('0x2a')](_0xd3e5('0x58'),_0x382ff8[_0xd3e5('0x32')],_0x382ff8[_0xd3e5('0x41')],_0x382ff8[_0xd3e5('0x1d')]);return RpcUser[_0xd3e5('0x29')](this[_0xd3e5('0x8')][_0x382ff8['interface']],_0xd3e5('0x59'),_0x382ff8[_0xd3e5('0x32')]);}}}catch(_0x383002){logger[_0xd3e5('0x37')](_0xd3e5('0x5a'),_0x383002['message']);}};module[_0xd3e5('0x5b')]=Acw; \ No newline at end of file +var _0x18fb=['moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','interface','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','getAgent','then','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]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','mandatoryDisposition','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','all','Auto-Pause','exports','util','lodash'];(function(_0x2adcbb,_0x411aab){var _0x4dcb63=function(_0x100cf1){while(--_0x100cf1){_0x2adcbb['push'](_0x2adcbb['shift']());}};_0x4dcb63(++_0x411aab);}(_0x18fb,0x19d));var _0xb18f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x18fb[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0xb18f('0x0'));var _=require(_0xb18f('0x1'));var moment=require(_0xb18f('0x2'));var ami=require(_0xb18f('0x3'));var logger=require(_0xb18f('0x4'))(_0xb18f('0x5'));var RpcUser=require(_0xb18f('0x6'));var RpcVoiceAgentReport=require(_0xb18f('0x7'));function Acw(_0x1fe0c7){this[_0xb18f('0x8')]=_0x1fe0c7[_0xb18f('0x8')];this[_0xb18f('0x9')]=_0x1fe0c7['agents'];this[_0xb18f('0xa')]=_0x1fe0c7[_0xb18f('0xa')];this[_0xb18f('0xb')]={};ami['on'](_0xb18f('0xc'),this[_0xb18f('0xd')][_0xb18f('0xe')](this));ami['on']('hanguprequest',this[_0xb18f('0xf')]['bind'](this));ami['on'](_0xb18f('0x10'),this[_0xb18f('0x11')][_0xb18f('0xe')](this));ami['on'](_0xb18f('0x12'),this[_0xb18f('0x13')]['bind'](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xb18f('0xe')](this));ami['on'](_0xb18f('0x14'),this[_0xb18f('0x15')]['bind'](this));ami['on'](_0xb18f('0x16'),this[_0xb18f('0x17')][_0xb18f('0xe')](this));}function getDiff(_0x45c55a){var _0x92f333=moment()[_0xb18f('0x18')](0x0);var _0x289ce9=moment(_0x45c55a)[_0xb18f('0x18')](0x0);return _0x92f333[_0xb18f('0x19')](_0x289ce9,_0xb18f('0x1a'));}Acw[_0xb18f('0x1b')]['startAcw']=function(_0xbeba4){try{var _0x92dccf=this;var _0x5ce2b0=this['channels'][_0xbeba4][_0xb18f('0x1c')];var _0x4561e2=this['channels'][_0xbeba4][_0xb18f('0x1d')];var _0x326fb9=this['voiceQueues'][_0x4561e2];var _0x52bc20=![];var _0x56c6c7=_0xb18f('0x1e');if(_0x326fb9['mandatoryDisposition']){if(_0x326fb9[_0xb18f('0x1f')][_0xb18f('0x20')]){_0x52bc20=!![];_0x56c6c7=_0x326fb9[_0xb18f('0x1f')]['name'];}}ami[_0xb18f('0x21')]({'action':_0xb18f('0x22'),'interface':_0x5ce2b0,'paused':!![],'reason':_0x56c6c7})['then'](function(_0x11e1b2){if(_0x92dccf['agents'][_0x5ce2b0]){return RpcUser[_0xb18f('0x23')](_0x92dccf[_0xb18f('0x9')][_0x5ce2b0]['id'])[_0xb18f('0x24')](function(_0x109b1c){if(_0x109b1c&&!_0x109b1c[_0xb18f('0x25')]){logger[_0xb18f('0x26')](_0xb18f('0x27'),_0xbeba4,_0x5ce2b0,_0x4561e2);var _0x333c7e=_0x92dccf[_0xb18f('0xb')][_0xbeba4][_0xb18f('0x28')]&&_0x92dccf[_0xb18f('0xb')][_0xbeba4]['destlinkedid']?_0x92dccf['channels'][_0xbeba4][_0xb18f('0x29')]:_0xbeba4;return RpcUser[_0xb18f('0x2a')](_0x92dccf['agents'][_0x5ce2b0],_0x56c6c7,_0x333c7e)['then'](function(_0x3c2416){if(!_0x52bc20){_0x92dccf[_0xb18f('0xa')][_0x5ce2b0]={};logger[_0xb18f('0x26')](_0xb18f('0x2b'),_0xbeba4,_0x92dccf['voiceQueues'][_0x4561e2][_0xb18f('0x2c')],_0x5ce2b0,_0x4561e2);_0x92dccf[_0xb18f('0xa')][_0x5ce2b0][_0xb18f('0x2d')]=setTimeout(_0x92dccf[_0xb18f('0x2e')][_0xb18f('0xe')](_0x92dccf,_0x5ce2b0),_0x92dccf['voiceQueues'][_0x4561e2][_0xb18f('0x2c')]*0x3e8);_0x92dccf[_0xb18f('0xa')][_0x5ce2b0]['lastPauseAt']=moment()[_0xb18f('0x2f')](_0xb18f('0x30'));_0x92dccf[_0xb18f('0xa')][_0x5ce2b0][_0xb18f('0x31')]=_0xbeba4;_0x92dccf[_0xb18f('0xa')][_0x5ce2b0]['queue']=_0x4561e2;_0x92dccf['timers'][_0x5ce2b0][_0xb18f('0x32')]=function(){var _0x575a82=getDiff(_0x92dccf[_0xb18f('0xa')][_0x5ce2b0]['lastPauseAt']);clearTimeout(_0x92dccf[_0xb18f('0xa')][_0x5ce2b0]['timer']);_0x92dccf['timers'][_0x5ce2b0][_0xb18f('0x2d')]=![];RpcVoiceAgentReport[_0xb18f('0x33')]({'acwtime':_0x575a82},_0x92dccf[_0xb18f('0xa')][_0x5ce2b0][_0xb18f('0x31')],_0x5ce2b0)[_0xb18f('0x24')](function(_0x5db55b){logger[_0xb18f('0x26')](_0xb18f('0x34'),_0xbeba4,_0x575a82,_0x5db55b);})[_0xb18f('0x35')](function(_0x185bef){logger['error'](_0xb18f('0x36'),_0xbeba4,_0x185bef);});delete _0x92dccf[_0xb18f('0xa')][_0x5ce2b0];};}});}else{logger['info'](_0xb18f('0x37'),_0xbeba4,_0x5ce2b0,_0x4561e2);}});}})[_0xb18f('0x35')](function(_0x580ea4){logger[_0xb18f('0x38')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0xbeba4,_0x92dccf[_0xb18f('0x8')][_0x4561e2][_0xb18f('0x2c')],_0x5ce2b0,_0x4561e2);})[_0xb18f('0x39')](function(){delete _0x92dccf['channels'][_0xbeba4];});}catch(_0x21db70){logger['error'](_0xb18f('0x3a'),_0x21db70[_0xb18f('0x3b')]);}};Acw[_0xb18f('0x1b')]['stopAcw']=function(_0x3d45ed){try{var _0x2143d4=this;if(_0x2143d4['timers'][_0x3d45ed]){_0x2143d4[_0xb18f('0xa')][_0x3d45ed][_0xb18f('0x2d')]=![];var _0x17b1fe=_0x2143d4[_0xb18f('0xa')][_0x3d45ed][_0xb18f('0x31')];var _0x3dcc78=_0x2143d4[_0xb18f('0xa')][_0x3d45ed][_0xb18f('0x1d')];var _0x2227ad=_0x2143d4[_0xb18f('0x8')][_0x3dcc78]['acwTimeout'];logger[_0xb18f('0x26')]('[%s][TIMER][STOP][AGENT:%s]',_0x17b1fe,_0x3d45ed);RpcUser['saveUnpause'](this[_0xb18f('0x9')][_0x3d45ed]);RpcVoiceAgentReport['update']({'acwtime':_0x2227ad,'agentacw':!![]},_0x17b1fe,_0x3d45ed)[_0xb18f('0x24')](function(_0x53c781){logger[_0xb18f('0x26')](_0xb18f('0x34'),_0x17b1fe,_0x2227ad,_0x53c781);})[_0xb18f('0x35')](function(_0x25afca){logger[_0xb18f('0x38')](_0xb18f('0x36'),_0x17b1fe,_0x25afca);});}else{logger[_0xb18f('0x38')](_0xb18f('0x3c'),_0x3d45ed);if(_0x2143d4[_0xb18f('0xa')]){logger[_0xb18f('0x26')](_0xb18f('0x3d'),JSON[_0xb18f('0x3e')](_0x2143d4[_0xb18f('0xa')]));}}}catch(_0x60b284){logger['error']('[ACW][STOP]\x20%s',_0x60b284[_0xb18f('0x3b')]);}};Acw['prototype']['syncAgentConnect']=function(_0x5063c2){try{if(this[_0xb18f('0x8')][_0x5063c2[_0xb18f('0x1d')]]&&(this[_0xb18f('0x8')][_0x5063c2[_0xb18f('0x1d')]][_0xb18f('0x5')]||this[_0xb18f('0x8')][_0x5063c2[_0xb18f('0x1d')]][_0xb18f('0x3f')])){if(this['agents'][_0x5063c2[_0xb18f('0x1c')]]){this[_0xb18f('0xb')][_0x5063c2[_0xb18f('0x31')]]={'queue':_0x5063c2[_0xb18f('0x1d')],'interface':_0x5063c2[_0xb18f('0x1c')],'destlinkedid':_0x5063c2['destlinkedid']};}}}catch(_0xd9f710){logger['error']('[ACW][syncAgentConnect]\x20%s',_0xd9f710[_0xb18f('0x3b')]);}};Acw[_0xb18f('0x1b')][_0xb18f('0x17')]=function(_0x497ccf){try{if(this[_0xb18f('0x8')][_0x497ccf[_0xb18f('0x1d')]]&&(this['voiceQueues'][_0x497ccf[_0xb18f('0x1d')]][_0xb18f('0x5')]||this[_0xb18f('0x8')][_0x497ccf['queue']][_0xb18f('0x3f')])){if(this[_0xb18f('0x9')][_0x497ccf['interface']]){this['channels'][_0x497ccf[_0xb18f('0x31')]]={'queue':_0x497ccf[_0xb18f('0x1d')],'interface':_0x497ccf[_0xb18f('0x1c')]};}}}catch(_0x3b17ab){logger['error'](_0xb18f('0x40'),_0x3b17ab['message']);}};Acw[_0xb18f('0x1b')][_0xb18f('0xf')]=function(_0x318160){try{if(this['channels'][_0x318160[_0xb18f('0x31')]]&&_[_0xb18f('0x41')](this[_0xb18f('0xb')][_0x318160[_0xb18f('0x31')]][_0xb18f('0x28')])){logger[_0xb18f('0x26')](_0xb18f('0x42'),_0x318160['uniqueid']);this[_0xb18f('0x43')](_0x318160[_0xb18f('0x31')]);}else if(this[_0xb18f('0xb')][_0x318160[_0xb18f('0x44')]]&&_[_0xb18f('0x41')](this[_0xb18f('0xb')][_0x318160[_0xb18f('0x44')]]['attended'])){logger[_0xb18f('0x26')](_0xb18f('0x45'),_0x318160[_0xb18f('0x44')]);this[_0xb18f('0x43')](_0x318160[_0xb18f('0x44')]);}}catch(_0x12a5b0){logger['error'](_0xb18f('0x46'),_0x12a5b0['message']);}};Acw[_0xb18f('0x1b')][_0xb18f('0x11')]=function(_0xa34b3f){try{if(this[_0xb18f('0xb')][_0xa34b3f['uniqueid']]&&this[_0xb18f('0xb')][_0xa34b3f[_0xb18f('0x31')]][_0xb18f('0x28')]){logger[_0xb18f('0x26')](_0xb18f('0x47'),_0xa34b3f['uniqueid']);this['startAcw'](_0xa34b3f[_0xb18f('0x31')]);}else if(this[_0xb18f('0xb')][_0xa34b3f[_0xb18f('0x44')]]&&this['channels'][_0xa34b3f[_0xb18f('0x44')]][_0xb18f('0x28')]){logger[_0xb18f('0x26')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0xa34b3f[_0xb18f('0x44')]);this[_0xb18f('0x43')](_0xa34b3f['linkedid']);}}catch(_0x5efc25){logger[_0xb18f('0x38')]('[ACW][syncHangup]\x20%s',_0x5efc25[_0xb18f('0x3b')]);}};Acw[_0xb18f('0x1b')]['syncAttendedTransfer']=function(_0x3d5319){try{if(!_[_0xb18f('0x48')](this['channels'][_0x3d5319[_0xb18f('0x49')]])){this[_0xb18f('0x43')](_0x3d5319[_0xb18f('0x49')]);if(this['channels'][_0x3d5319[_0xb18f('0x4a')]]){this[_0xb18f('0xb')][_0x3d5319[_0xb18f('0x4a')]][_0xb18f('0x28')]=!![];this[_0xb18f('0xb')][_0x3d5319[_0xb18f('0x4b')]]=this[_0xb18f('0xb')][_0x3d5319['secondtransfereruniqueid']];delete this[_0xb18f('0xb')][_0x3d5319[_0xb18f('0x4a')]];}}else if(!_['isNil'](this[_0xb18f('0xb')][_0x3d5319['transfertargetuniqueid']])){this[_0xb18f('0x43')](_0x3d5319['transfertargetuniqueid']);if(this[_0xb18f('0xb')][_0x3d5319[_0xb18f('0x4c')]]){this['channels'][_0x3d5319[_0xb18f('0x4c')]]['attended']=!![];this['channels'][_0x3d5319[_0xb18f('0x49')]]=this[_0xb18f('0xb')][_0x3d5319['origtransfereruniqueid']];delete this[_0xb18f('0xb')][_0x3d5319[_0xb18f('0x4c')]];}}}catch(_0x346d05){logger[_0xb18f('0x38')](_0xb18f('0x4d'),_0x346d05[_0xb18f('0x3b')]);}};Acw[_0xb18f('0x1b')]['syncBlindTransfer']=function(_0x583e1a){try{if(this[_0xb18f('0xb')][_0x583e1a['transfereruniqueid']]){logger[_0xb18f('0x26')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xb18f('0x3e')](_0x583e1a[_0xb18f('0x4e')]));this[_0xb18f('0x43')](_0x583e1a[_0xb18f('0x4e')]);}else if(this[_0xb18f('0xb')][_0x583e1a[_0xb18f('0x4f')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xb18f('0x3e')](_0x583e1a['transfererlinkedid']));this[_0xb18f('0x43')](_0x583e1a[_0xb18f('0x4f')]);}}catch(_0x338b30){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x338b30[_0xb18f('0x3b')]);}};Acw[_0xb18f('0x1b')][_0xb18f('0x13')]=function(_0x36fc47){try{if(this[_0xb18f('0x8')][_0x36fc47['queue']]&&this['voiceQueues'][_0x36fc47[_0xb18f('0x1d')]]['autopause']===_0xb18f('0x50')){if(this[_0xb18f('0x9')][_0x36fc47[_0xb18f('0x1c')]]){logger[_0xb18f('0x26')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x36fc47[_0xb18f('0x31')],_0x36fc47[_0xb18f('0x1c')],_0x36fc47['queue']);return RpcUser[_0xb18f('0x2a')](this['agents'][_0x36fc47['interface']],_0xb18f('0x51'),_0x36fc47[_0xb18f('0x31')]);}}}catch(_0x5c2108){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x5c2108[_0xb18f('0x3b')]);}};module[_0xb18f('0x52')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index ce1d897..46c66be 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 _0x3b38=['promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','actionCoreShowChannels','catch','exports','bluebird','moment','util','lodash','../../config/logger','asterisk','port','username','password','keepConnected','Action'];(function(_0x3bb40e,_0x4ec80f){var _0x4eeed8=function(_0x5bfe3f){while(--_0x5bfe3f){_0x3bb40e['push'](_0x3bb40e['shift']());}};_0x4eeed8(++_0x4ec80f);}(_0x3b38,0x67));var _0x83b3=function(_0x4406e7,_0x33dba4){_0x4406e7=_0x4406e7-0x0;var _0x40ec5c=_0x3b38[_0x4406e7];return _0x40ec5c;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x83b3('0x0'));var moment=require(_0x83b3('0x1'));var util=require(_0x83b3('0x2'));var _=require(_0x83b3('0x3'));var logger=require(_0x83b3('0x4'))('ami');var config=require('../../config/environment');var ami=new Manager(config[_0x83b3('0x5')][_0x83b3('0x6')],config[_0x83b3('0x5')]['ip'],config['asterisk'][_0x83b3('0x7')],config[_0x83b3('0x5')][_0x83b3('0x8')],!![]);ami[_0x83b3('0x9')]();ami[_0x83b3('0xa')]=BPromise[_0x83b3('0xb')](ami[_0x83b3('0xc')]);function error(_0x44dfa2){logger['error'](util[_0x83b3('0xd')](_0x83b3('0xe'),config[_0x83b3('0x5')][_0x83b3('0x7')],config[_0x83b3('0x5')]['ip'],config['asterisk'][_0x83b3('0x6')],util['inspect'](_0x44dfa2,![],null)));}function close(){logger[_0x83b3('0xf')](util[_0x83b3('0xd')](_0x83b3('0x10'),config[_0x83b3('0x5')][_0x83b3('0x7')],config['asterisk']['ip'],config[_0x83b3('0x5')]['port']));}ami[_0x83b3('0x11')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x83b3('0xa')]({'action':_0x83b3('0x12')});};};ami[_0x83b3('0x13')]=function(){return function(){return ami[_0x83b3('0xa')]({'action':_0x83b3('0x14')});};};ami[_0x83b3('0x15')]=function(){return function(){return ami[_0x83b3('0xa')]({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami['Action']({'action':_0x83b3('0x16')});};};function connect(_0x449be3){logger[_0x83b3('0x17')](util[_0x83b3('0xd')](_0x83b3('0x18'),config[_0x83b3('0x5')][_0x83b3('0x7')],config['asterisk']['ip'],config[_0x83b3('0x5')]['port']));ami[_0x83b3('0x19')](_0x83b3('0xf'),error);ami[_0x83b3('0x19')](_0x83b3('0x1a'),close);}ami['on'](_0x83b3('0x1b'),connect);ami['on'](_0x83b3('0x1c'),function(_0x3ed249){logger[_0x83b3('0x17')](util[_0x83b3('0xd')](_0x83b3('0x1d'),config[_0x83b3('0x5')]['username'],config['asterisk']['ip'],config[_0x83b3('0x5')][_0x83b3('0x6')],util['inspect'](_0x3ed249,![],null)));});ami['on'](_0x83b3('0x1e'),function(_0xb485b6){logger['info'](util[_0x83b3('0xd')](_0x83b3('0x1f'),config[_0x83b3('0x5')][_0x83b3('0x7')],config[_0x83b3('0x5')]['ip'],config[_0x83b3('0x5')][_0x83b3('0x6')]));return BPromise[_0x83b3('0x20')]()[_0x83b3('0x21')](ami[_0x83b3('0x11')]())[_0x83b3('0x21')](ami[_0x83b3('0x22')]())['then'](ami[_0x83b3('0x13')]())['then'](ami[_0x83b3('0x15')]())[_0x83b3('0x21')](ami[_0x83b3('0x23')]())[_0x83b3('0x24')](function(_0x552a5e){console['log'](_0x552a5e);});});ami[_0x83b3('0x19')](_0x83b3('0xf'),error);ami['once']('close',close);module[_0x83b3('0x25')]=ami; \ No newline at end of file +var _0x0743=['then','actionSipPeerStatus','log','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','promisify','action','error','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','Action','sipshowregistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','actionSipShowRegistry'];(function(_0x179ad9,_0x1e3a81){var _0x3573ea=function(_0x164ec5){while(--_0x164ec5){_0x179ad9['push'](_0x179ad9['shift']());}};_0x3573ea(++_0x1e3a81);}(_0x0743,0x133));var _0x3074=function(_0x26db46,_0x26f6c0){_0x26db46=_0x26db46-0x0;var _0x13c636=_0x0743[_0x26db46];return _0x13c636;};'use strict';var Manager=require(_0x3074('0x0'));var BPromise=require(_0x3074('0x1'));var moment=require('moment');var util=require(_0x3074('0x2'));var _=require('lodash');var logger=require(_0x3074('0x3'))(_0x3074('0x4'));var config=require(_0x3074('0x5'));var ami=new Manager(config[_0x3074('0x6')][_0x3074('0x7')],config[_0x3074('0x6')]['ip'],config['asterisk'][_0x3074('0x8')],config[_0x3074('0x6')][_0x3074('0x9')],!![]);ami[_0x3074('0xa')]();ami['Action']=BPromise[_0x3074('0xb')](ami[_0x3074('0xc')]);function error(_0x1d95d2){logger[_0x3074('0xd')](util['format'](_0x3074('0xe'),config[_0x3074('0x6')][_0x3074('0x8')],config[_0x3074('0x6')]['ip'],config['asterisk']['port'],util['inspect'](_0x1d95d2,![],null)));}function close(){logger[_0x3074('0xd')](util[_0x3074('0xf')](_0x3074('0x10'),config[_0x3074('0x6')][_0x3074('0x8')],config[_0x3074('0x6')]['ip'],config['asterisk'][_0x3074('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0x3074('0x11')]({'action':_0x3074('0x12')});};};ami[_0x3074('0x13')]=function(){return function(){return ami[_0x3074('0x11')]({'action':_0x3074('0x14')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x3074('0x11')]({'action':_0x3074('0x15')});};};ami[_0x3074('0x16')]=function(){return function(){return ami[_0x3074('0x11')]({'action':_0x3074('0x17')});};};ami[_0x3074('0x18')]=function(){return function(){return ami[_0x3074('0x11')]({'action':_0x3074('0x19')});};};function connect(_0x1526c5){logger[_0x3074('0x1a')](util[_0x3074('0xf')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk'][_0x3074('0x8')],config['asterisk']['ip'],config[_0x3074('0x6')][_0x3074('0x7')]));ami[_0x3074('0x1b')](_0x3074('0xd'),error);ami['once'](_0x3074('0x1c'),close);}ami['on'](_0x3074('0x1d'),connect);ami['on'](_0x3074('0x1e'),function(_0x465279){logger['info'](util[_0x3074('0xf')](_0x3074('0x1f'),config[_0x3074('0x6')]['username'],config[_0x3074('0x6')]['ip'],config['asterisk'][_0x3074('0x7')],util[_0x3074('0x20')](_0x465279,![],null)));});ami['on'](_0x3074('0x21'),function(_0x2ac5ae){logger[_0x3074('0x1a')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x3074('0x6')]['username'],config[_0x3074('0x6')]['ip'],config[_0x3074('0x6')]['port']));return BPromise['resolve']()['then'](ami[_0x3074('0x22')]())[_0x3074('0x23')](ami[_0x3074('0x13')]())[_0x3074('0x23')](ami[_0x3074('0x24')]())[_0x3074('0x23')](ami[_0x3074('0x16')]())[_0x3074('0x23')](ami['actionCoreShowChannels']())['catch'](function(_0x4e5655){console[_0x3074('0x25')](_0x4e5655);});});ami[_0x3074('0x1b')](_0x3074('0xd'),error);ami[_0x3074('0x1b')](_0x3074('0x1c'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 505f521..ca13bc6 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 _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x4884a7,_0x18e38a){var _0x56b60e=function(_0x2ba8a3){while(--_0x2ba8a3){_0x4884a7['push'](_0x4884a7['shift']());}};_0x56b60e(++_0x18e38a);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2837c8,_0x5df47c){_0x2837c8=_0x2837c8-0x0;var _0x30590a=_0x9bde[_0x2837c8];return _0x30590a;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file +var _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x582d0b,_0x28f609){_0x582d0b=_0x582d0b-0x0;var _0x2e93e1=_0xcb91[_0x582d0b];return _0x2e93e1;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index fdc756d..8da659d 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 _0x5985=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','name','number','substring','exports','util','lodash','moment','isNil','voiceQueue','uniqueid','Contact','phone','lastName','queue','active','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x5644d8,_0x5bff4f){var _0x3d742a=function(_0x519fc9){while(--_0x519fc9){_0x5644d8['push'](_0x5644d8['shift']());}};_0x3d742a(++_0x5bff4f);}(_0x5985,0x16a));var _0x5598=function(_0x3b02c8,_0x28fa16){_0x3b02c8=_0x3b02c8-0x0;var _0x381dfa=_0x5985[_0x3b02c8];return _0x381dfa;};'use strict';var util=require(_0x5598('0x0'));var _=require(_0x5598('0x1'));var moment=require(_0x5598('0x2'));function checkNameSurname(_0x5b0b84,_0x1327ad,_0x5ce251){var _0x4657ad='';if(!_[_0x5598('0x3')](_0x1327ad)&&'string'===typeof _0x1327ad){_0x4657ad+=_0x1327ad;}if(!_[_0x5598('0x3')](_0x5ce251)&&'string'===typeof _0x5ce251){_0x4657ad+='\x20'+_0x5ce251;}if(_0x4657ad!==''){return _0x4657ad;}return _0x5b0b84;}function Action(_0x3c314f,_0x23ed77,_0x2d218a){this[_0x5598('0x4')]=_0x3c314f;this[_0x5598('0x5')]=_0x2d218a||undefined;this['name']=checkNameSurname(_0x23ed77[_0x5598('0x6')][_0x5598('0x7')],_0x23ed77[_0x5598('0x6')]['firstName'],_0x23ed77[_0x5598('0x6')][_0x5598('0x8')]);this['number']=_0x23ed77[_0x5598('0x6')][_0x5598('0x7')];this[_0x5598('0x9')]=_0x3c314f['name'];this[_0x5598('0xa')]=_0x23ed77[_0x5598('0xa')]||![];this['type']=_0x3c314f['type'];this[_0x5598('0xb')]=_0x3c314f['dialQueueTimeout']||0x3;this[_0x5598('0xc')]=_0x23ed77['scheduledat'];this[_0x5598('0xd')]=_0x23ed77['countbusyretry'];this[_0x5598('0xe')]=_0x23ed77['countcongestionretry'];this[_0x5598('0xf')]=_0x23ed77[_0x5598('0xf')];this[_0x5598('0x10')]=_0x23ed77[_0x5598('0x10')];this['countdropretry']=_0x23ed77[_0x5598('0x11')];this['countabandonedretry']=_0x23ed77[_0x5598('0x12')];this[_0x5598('0x13')]=_0x23ed77['countmachineretry'];this[_0x5598('0x14')]=_0x23ed77[_0x5598('0x14')];this['ContactId']=_0x23ed77['ContactId'];this[_0x5598('0x15')]=_0x23ed77[_0x5598('0x15')];this[_0x5598('0x16')]=_0x23ed77['UserId'];this[_0x5598('0x17')]=_0x23ed77[_0x5598('0x17')];this['CampaignId']=_0x23ed77[_0x5598('0x18')];this[_0x5598('0x19')]=_0x23ed77['id'];this[_0x5598('0x1a')]=_0x23ed77[_0x5598('0x6')]['firstName']||'';this[_0x5598('0x1b')]=moment()[_0x5598('0x1c')](_0x5598('0x1d'));this[_0x5598('0x1e')]=_0x23ed77['callback'];this['callbackuniqueid']=_0x23ed77['callbackuniqueid'];this[_0x5598('0x1f')]=_0x23ed77[_0x5598('0x1f')];this['recallme']=_0x23ed77[_0x5598('0x20')];this[_0x5598('0x21')]='';this[_0x5598('0x22')]='';}Action[_0x5598('0x23')][_0x5598('0x24')]=function(){return util[_0x5598('0x1c')](_0x5598('0x25'),this[_0x5598('0x26')],this['voiceQueue']['dialCutDigit']>0x0?this[_0x5598('0x27')][_0x5598('0x28')](this['voiceQueue']['dialCutDigit']):this[_0x5598('0x27')]);};Action[_0x5598('0x23')]['getQueue']=function(){return this[_0x5598('0x9')];};module[_0x5598('0x29')]=Action; \ No newline at end of file +var _0x78e4=['number','queue','active','type','dialQueueTimeout','scheduledat','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','starttime','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridnum','originatecalleridname','prototype','format','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone'];(function(_0x4de5bc,_0x50fa9f){var _0x1d498c=function(_0x2dff1b){while(--_0x2dff1b){_0x4de5bc['push'](_0x4de5bc['shift']());}};_0x1d498c(++_0x50fa9f);}(_0x78e4,0xf9));var _0x478e=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x78e4[_0x36c5b0];return _0xf19333;};'use strict';var util=require('util');var _=require(_0x478e('0x0'));var moment=require(_0x478e('0x1'));function checkNameSurname(_0x1c663a,_0x115209,_0x38bb03){var _0x335ffe='';if(!_[_0x478e('0x2')](_0x115209)&&'string'===typeof _0x115209){_0x335ffe+=_0x115209;}if(!_['isNil'](_0x38bb03)&&_0x478e('0x3')===typeof _0x38bb03){_0x335ffe+='\x20'+_0x38bb03;}if(_0x335ffe!==''){return _0x335ffe;}return _0x1c663a;}function Action(_0x2e6bc1,_0x9085c7,_0x1234f7){this[_0x478e('0x4')]=_0x2e6bc1;this[_0x478e('0x5')]=_0x1234f7||undefined;this[_0x478e('0x6')]=checkNameSurname(_0x9085c7[_0x478e('0x7')][_0x478e('0x8')],_0x9085c7[_0x478e('0x7')]['firstName'],_0x9085c7[_0x478e('0x7')]['lastName']);this[_0x478e('0x9')]=_0x9085c7['Contact'][_0x478e('0x8')];this[_0x478e('0xa')]=_0x2e6bc1[_0x478e('0x6')];this[_0x478e('0xb')]=_0x9085c7['active']||![];this[_0x478e('0xc')]=_0x2e6bc1[_0x478e('0xc')];this[_0x478e('0xd')]=_0x2e6bc1[_0x478e('0xd')]||0x3;this[_0x478e('0xe')]=_0x9085c7[_0x478e('0xe')];this['countbusyretry']=_0x9085c7['countbusyretry'];this[_0x478e('0xf')]=_0x9085c7[_0x478e('0xf')];this['countnoanswerretry']=_0x9085c7[_0x478e('0x10')];this['countnosuchnumberretry']=_0x9085c7['countnosuchnumberretry'];this[_0x478e('0x11')]=_0x9085c7[_0x478e('0x11')];this[_0x478e('0x12')]=_0x9085c7[_0x478e('0x12')];this[_0x478e('0x13')]=_0x9085c7[_0x478e('0x13')];this[_0x478e('0x14')]=_0x9085c7[_0x478e('0x14')];this[_0x478e('0x15')]=_0x9085c7[_0x478e('0x15')];this[_0x478e('0x16')]=_0x9085c7['ListId'];this[_0x478e('0x17')]=_0x9085c7[_0x478e('0x17')];this[_0x478e('0x18')]=_0x9085c7['VoiceQueueId'];this[_0x478e('0x19')]=_0x9085c7[_0x478e('0x19')];this[_0x478e('0x1a')]=_0x9085c7['id'];this[_0x478e('0x1b')]=_0x9085c7[_0x478e('0x7')][_0x478e('0x1c')]||'';this[_0x478e('0x1d')]=moment()['format'](_0x478e('0x1e'));this[_0x478e('0x1f')]=_0x9085c7[_0x478e('0x1f')];this[_0x478e('0x20')]=_0x9085c7['callbackuniqueid'];this[_0x478e('0x21')]=_0x9085c7[_0x478e('0x21')];this['recallme']=_0x9085c7['recallme'];this[_0x478e('0x22')]='';this[_0x478e('0x23')]='';}Action[_0x478e('0x24')]['getCaller']=function(){return util[_0x478e('0x25')](_0x478e('0x26'),this[_0x478e('0x6')],this[_0x478e('0x4')][_0x478e('0x27')]>0x0?this[_0x478e('0x9')][_0x478e('0x28')](this['voiceQueue'][_0x478e('0x27')]):this[_0x478e('0x9')]);};Action[_0x478e('0x24')][_0x478e('0x29')]=function(){return this[_0x478e('0xa')];};module[_0x478e('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 82ffcc1..83bf594 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 _0xca6d=['countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca6d,0x75));var _0xdca6=function(_0x126252,_0x2e41d4){_0x126252=_0x126252-0x0;var _0x589e99=_0xca6d[_0x126252];return _0x589e99;};'use strict';var util=require('util');var _=require(_0xdca6('0x0'));var moment=require(_0xdca6('0x1'));function getSeconds(_0x3bc794,_0x152b11){var _0x115e25=moment(_0x3bc794)[_0xdca6('0x2')](0x0);var _0x11f599=moment(_0x152b11)['milliseconds'](0x0);return _0x115e25[_0xdca6('0x3')](_0x11f599,_0xdca6('0x4'));}function AgentComplete(_0x358d0f,_0x1da642){this['state']=0x4;this['statedesc']='Answer';this[_0xdca6('0x5')]=_0x358d0f[_0xdca6('0x5')];this['type']=_0x358d0f[_0xdca6('0x6')];this[_0xdca6('0x7')]=_0x358d0f[_0xdca6('0x6')]===_0xdca6('0x8')?_0xdca6('0x9'):_0x358d0f[_0xdca6('0x6')];this['countbusyretry']=_0x358d0f[_0xdca6('0xa')];this['countcongestionretry']=_0x358d0f[_0xdca6('0xb')];this[_0xdca6('0xc')]=_0x358d0f['countnoanswerretry'];this[_0xdca6('0xd')]=_0x358d0f['countbusyretry']+_0x358d0f[_0xdca6('0xb')]+_0x358d0f[_0xdca6('0xc')]+_0x358d0f['countnosuchnumberretry']+_0x358d0f[_0xdca6('0xe')]+_0x358d0f[_0xdca6('0xf')]+_0x358d0f[_0xdca6('0x10')]+_0x358d0f[_0xdca6('0x11')];this['countnosuchnumberretry']=_0x358d0f[_0xdca6('0x12')];this[_0xdca6('0xe')]=_0x358d0f[_0xdca6('0xe')];this['countabandonedretry']=_0x358d0f[_0xdca6('0xf')];this[_0xdca6('0x10')]=_0x358d0f[_0xdca6('0x10')];this[_0xdca6('0x11')]=_0x358d0f[_0xdca6('0x11')];this[_0xdca6('0x13')]=_0x1da642['uniqueid'];this['calleridname']=_0x358d0f[_0xdca6('0x14')];this[_0xdca6('0x15')]=_0x358d0f[_0xdca6('0x16')];this[_0xdca6('0x17')]=_0x358d0f[_0xdca6('0x17')];this[_0xdca6('0x18')]=_0x358d0f[_0xdca6('0x18')];this[_0xdca6('0x19')]=_0x358d0f[_0xdca6('0x19')];this[_0xdca6('0x1a')]=moment()['format'](_0xdca6('0x1b'));this[_0xdca6('0x1c')]=getSeconds(_0x358d0f[_0xdca6('0x18')],_0x358d0f[_0xdca6('0x17')]);this[_0xdca6('0x1d')]=getSeconds(_0x358d0f[_0xdca6('0x19')],_0x358d0f[_0xdca6('0x18')]);this[_0xdca6('0x1e')]=getSeconds(this[_0xdca6('0x1a')],_0x358d0f[_0xdca6('0x19')]);this['queue']=_0x1da642['queue'];this[_0xdca6('0x1f')]=_0x1da642['membername'];this['reason']=_0x1da642[_0xdca6('0x20')];this[_0xdca6('0x21')]=_0x358d0f[_0xdca6('0x21')];this[_0xdca6('0x22')]=_0x358d0f[_0xdca6('0x22')];this[_0xdca6('0x23')]=_0x358d0f[_0xdca6('0x23')];this[_0xdca6('0x24')]=_0x358d0f['recallme'];this[_0xdca6('0x25')]=_0x358d0f[_0xdca6('0x25')];this[_0xdca6('0x26')]=_0x358d0f['ListId'];this[_0xdca6('0x27')]=_0x358d0f[_0xdca6('0x27')];this[_0xdca6('0x28')]=_0x358d0f[_0xdca6('0x28')];this[_0xdca6('0x29')]=_0x358d0f[_0xdca6('0x29')];this['originatecalleridnum']=_0x358d0f[_0xdca6('0x2a')]||'';this['originatecalleridname']=_0x358d0f['originatecalleridname']||'';}module[_0xdca6('0x2b')]=AgentComplete; \ No newline at end of file +var _0x5b1d=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x577aca,_0x37efa3){var _0x90e598=function(_0xb13ec8){while(--_0xb13ec8){_0x577aca['push'](_0x577aca['shift']());}};_0x90e598(++_0x37efa3);}(_0x5b1d,0x92));var _0xd5b1=function(_0x551e21,_0x5e07c9){_0x551e21=_0x551e21-0x0;var _0x314dd1=_0x5b1d[_0x551e21];return _0x314dd1;};'use strict';var util=require(_0xd5b1('0x0'));var _=require(_0xd5b1('0x1'));var moment=require(_0xd5b1('0x2'));function getSeconds(_0x399c0a,_0x38d12d){var _0x10a175=moment(_0x399c0a)[_0xd5b1('0x3')](0x0);var _0x9d142b=moment(_0x38d12d)[_0xd5b1('0x3')](0x0);return _0x10a175[_0xd5b1('0x4')](_0x9d142b,_0xd5b1('0x5'));}function AgentComplete(_0x174a57,_0x3456ca){this[_0xd5b1('0x6')]=0x4;this[_0xd5b1('0x7')]=_0xd5b1('0x8');this['scheduledat']=_0x174a57['scheduledat'];this['type']=_0x174a57[_0xd5b1('0x9')];this['campaigntype']=_0x174a57[_0xd5b1('0x9')]===_0xd5b1('0xa')?_0xd5b1('0xb'):_0x174a57[_0xd5b1('0x9')];this['countbusyretry']=_0x174a57[_0xd5b1('0xc')];this[_0xd5b1('0xd')]=_0x174a57['countcongestionretry'];this['countnoanswerretry']=_0x174a57[_0xd5b1('0xe')];this[_0xd5b1('0xf')]=_0x174a57['countbusyretry']+_0x174a57[_0xd5b1('0xd')]+_0x174a57[_0xd5b1('0xe')]+_0x174a57[_0xd5b1('0x10')]+_0x174a57['countdropretry']+_0x174a57[_0xd5b1('0x11')]+_0x174a57[_0xd5b1('0x12')]+_0x174a57[_0xd5b1('0x13')];this[_0xd5b1('0x10')]=_0x174a57[_0xd5b1('0x10')];this[_0xd5b1('0x14')]=_0x174a57[_0xd5b1('0x14')];this[_0xd5b1('0x11')]=_0x174a57[_0xd5b1('0x11')];this['countmachineretry']=_0x174a57[_0xd5b1('0x12')];this[_0xd5b1('0x13')]=_0x174a57[_0xd5b1('0x13')];this[_0xd5b1('0x15')]=_0x3456ca[_0xd5b1('0x15')];this[_0xd5b1('0x16')]=_0x174a57[_0xd5b1('0x17')];this[_0xd5b1('0x18')]=_0x174a57[_0xd5b1('0x19')];this[_0xd5b1('0x1a')]=_0x174a57[_0xd5b1('0x1a')];this[_0xd5b1('0x1b')]=_0x174a57['responsetime'];this[_0xd5b1('0x1c')]=_0x174a57[_0xd5b1('0x1c')];this[_0xd5b1('0x1d')]=moment()[_0xd5b1('0x1e')](_0xd5b1('0x1f'));this[_0xd5b1('0x20')]=getSeconds(_0x174a57[_0xd5b1('0x1b')],_0x174a57[_0xd5b1('0x1a')]);this['holdtime']=getSeconds(_0x174a57['answertime'],_0x174a57[_0xd5b1('0x1b')]);this[_0xd5b1('0x21')]=getSeconds(this[_0xd5b1('0x1d')],_0x174a57[_0xd5b1('0x1c')]);this['queue']=_0x3456ca[_0xd5b1('0xb')];this[_0xd5b1('0x22')]=_0x3456ca[_0xd5b1('0x22')];this[_0xd5b1('0x23')]=_0x3456ca[_0xd5b1('0x23')];this['callback']=_0x174a57['callback'];this['callbackuniqueid']=_0x174a57[_0xd5b1('0x24')];this[_0xd5b1('0x25')]=_0x174a57[_0xd5b1('0x25')];this[_0xd5b1('0x26')]=_0x174a57[_0xd5b1('0x26')];this[_0xd5b1('0x27')]=_0x174a57[_0xd5b1('0x27')];this['ListId']=_0x174a57[_0xd5b1('0x28')];this['UserId']=_0x174a57[_0xd5b1('0x29')];this[_0xd5b1('0x2a')]=_0x174a57['VoiceQueueId'];this[_0xd5b1('0x2b')]=_0x174a57[_0xd5b1('0x2b')];this[_0xd5b1('0x2c')]=_0x174a57[_0xd5b1('0x2c')]||'';this[_0xd5b1('0x2d')]=_0x174a57[_0xd5b1('0x2d')]||'';}module[_0xd5b1('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 7c4c015..f5c0b41 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 _0x4944=['CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','ListId','UserId','VoiceQueueId'];(function(_0x4771de,_0x102b59){var _0x2c63ed=function(_0x3d7e60){while(--_0x3d7e60){_0x4771de['push'](_0x4771de['shift']());}};_0x2c63ed(++_0x102b59);}(_0x4944,0x6d));var _0x4494=function(_0x171695,_0x43d437){_0x171695=_0x171695-0x0;var _0x1dc26f=_0x4944[_0x171695];return _0x1dc26f;};'use strict';var util=require(_0x4494('0x0'));var _=require('lodash');var moment=require(_0x4494('0x1'));function getSeconds(_0x39932f,_0x2578d3){var _0x138f00=moment(_0x39932f)[_0x4494('0x2')](0x0);var _0x5074d9=moment(_0x2578d3)[_0x4494('0x2')](0x0);return _0x138f00['diff'](_0x5074d9,_0x4494('0x3'));}function Final(_0x1c2a03){this[_0x4494('0x4')]=_0x1c2a03[_0x4494('0x4')];this[_0x4494('0x5')]=_0x1c2a03[_0x4494('0x5')];this[_0x4494('0x6')]=_0x1c2a03[_0x4494('0x6')];this[_0x4494('0x7')]=_0x1c2a03['type']===_0x4494('0x8')?_0x4494('0x9'):_0x1c2a03[_0x4494('0x6')];this[_0x4494('0xa')]=_0x1c2a03['countbusyretry'];this['countcongestionretry']=_0x1c2a03[_0x4494('0xb')];this[_0x4494('0xc')]=_0x1c2a03[_0x4494('0xc')];this['countglobal']=_0x1c2a03['countbusyretry']+_0x1c2a03[_0x4494('0xb')]+_0x1c2a03[_0x4494('0xc')]+_0x1c2a03[_0x4494('0xd')]+_0x1c2a03[_0x4494('0xe')]+_0x1c2a03[_0x4494('0xf')]+_0x1c2a03[_0x4494('0x10')]+_0x1c2a03['countagentrejectretry'];this[_0x4494('0xd')]=_0x1c2a03[_0x4494('0xd')];this[_0x4494('0xe')]=_0x1c2a03[_0x4494('0xe')];this[_0x4494('0xf')]=_0x1c2a03[_0x4494('0xf')];this[_0x4494('0x10')]=_0x1c2a03['countmachineretry'];this[_0x4494('0x11')]=_0x1c2a03['countagentrejectretry'];this['queue']=_0x1c2a03[_0x4494('0x9')];this[_0x4494('0x12')]=_0x1c2a03['calleridname'];this['calleridnum']=_0x1c2a03[_0x4494('0x13')];this['starttime']=_0x1c2a03[_0x4494('0x14')];this[_0x4494('0x15')]=_0x1c2a03['responsetime'];this[_0x4494('0x16')]=_0x1c2a03['responsetime'];this[_0x4494('0x17')]=_0x1c2a03[_0x4494('0x17')]||0x0;this['holdtime']=_0x1c2a03['holdtime']||0x0;this[_0x4494('0x18')]=_0x1c2a03[_0x4494('0x18')]||0x0;this[_0x4494('0x19')]=_0x1c2a03[_0x4494('0x19')];this[_0x4494('0x1a')]=_0x1c2a03[_0x4494('0x1a')];this[_0x4494('0x1b')]=_0x1c2a03[_0x4494('0x1b')];this['recallme']=_0x1c2a03['recallme'];this['ContactId']=_0x1c2a03['ContactId'];this[_0x4494('0x1c')]=_0x1c2a03[_0x4494('0x1c')];this[_0x4494('0x1d')]=_0x1c2a03[_0x4494('0x1d')];this['VoiceQueueId']=_0x1c2a03[_0x4494('0x1e')];this[_0x4494('0x1f')]=_0x1c2a03['CampaignId'];this[_0x4494('0x20')]=_0x1c2a03[_0x4494('0x20')]||'';this[_0x4494('0x21')]=_0x1c2a03['originatecalleridname']||'';}module[_0x4494('0x22')]=Final; \ No newline at end of file +var _0xe0ae=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry'];(function(_0x40b89a,_0x3aeb95){var _0x451d8d=function(_0x3faa72){while(--_0x3faa72){_0x40b89a['push'](_0x40b89a['shift']());}};_0x451d8d(++_0x3aeb95);}(_0xe0ae,0xa1));var _0xee0a=function(_0x33dcf7,_0x3d5390){_0x33dcf7=_0x33dcf7-0x0;var _0x542d4e=_0xe0ae[_0x33dcf7];return _0x542d4e;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xee0a('0x0'));function getSeconds(_0x401526,_0x49a5e2){var _0x42f3f6=moment(_0x401526)['milliseconds'](0x0);var _0x32cc3e=moment(_0x49a5e2)[_0xee0a('0x1')](0x0);return _0x42f3f6['diff'](_0x32cc3e,_0xee0a('0x2'));}function Final(_0x4d393b){this['uniqueid']=_0x4d393b[_0xee0a('0x3')];this[_0xee0a('0x4')]=_0x4d393b[_0xee0a('0x4')];this[_0xee0a('0x5')]=_0x4d393b['type'];this[_0xee0a('0x6')]=_0x4d393b['type']==='outbound'?_0xee0a('0x7'):_0x4d393b[_0xee0a('0x5')];this[_0xee0a('0x8')]=_0x4d393b['countbusyretry'];this[_0xee0a('0x9')]=_0x4d393b[_0xee0a('0x9')];this['countnoanswerretry']=_0x4d393b[_0xee0a('0xa')];this['countglobal']=_0x4d393b[_0xee0a('0x8')]+_0x4d393b[_0xee0a('0x9')]+_0x4d393b['countnoanswerretry']+_0x4d393b[_0xee0a('0xb')]+_0x4d393b['countdropretry']+_0x4d393b[_0xee0a('0xc')]+_0x4d393b[_0xee0a('0xd')]+_0x4d393b['countagentrejectretry'];this['countnosuchnumberretry']=_0x4d393b[_0xee0a('0xb')];this[_0xee0a('0xe')]=_0x4d393b[_0xee0a('0xe')];this[_0xee0a('0xc')]=_0x4d393b[_0xee0a('0xc')];this['countmachineretry']=_0x4d393b[_0xee0a('0xd')];this[_0xee0a('0xf')]=_0x4d393b['countagentrejectretry'];this[_0xee0a('0x7')]=_0x4d393b[_0xee0a('0x7')];this[_0xee0a('0x10')]=_0x4d393b[_0xee0a('0x10')];this['calleridnum']=_0x4d393b[_0xee0a('0x11')];this[_0xee0a('0x12')]=_0x4d393b[_0xee0a('0x12')];this['responsetime']=_0x4d393b[_0xee0a('0x13')];this[_0xee0a('0x14')]=_0x4d393b[_0xee0a('0x13')];this[_0xee0a('0x15')]=_0x4d393b['ringtime']||0x0;this[_0xee0a('0x16')]=_0x4d393b[_0xee0a('0x16')]||0x0;this[_0xee0a('0x17')]=_0x4d393b[_0xee0a('0x17')]||0x0;this['callback']=_0x4d393b[_0xee0a('0x18')];this[_0xee0a('0x19')]=_0x4d393b[_0xee0a('0x19')];this[_0xee0a('0x1a')]=_0x4d393b[_0xee0a('0x1a')];this[_0xee0a('0x1b')]=_0x4d393b[_0xee0a('0x1b')];this['ContactId']=_0x4d393b[_0xee0a('0x1c')];this[_0xee0a('0x1d')]=_0x4d393b[_0xee0a('0x1d')];this[_0xee0a('0x1e')]=_0x4d393b['UserId'];this[_0xee0a('0x1f')]=_0x4d393b[_0xee0a('0x1f')];this[_0xee0a('0x20')]=_0x4d393b[_0xee0a('0x20')];this['originatecalleridnum']=_0x4d393b['originatecalleridnum']||'';this['originatecalleridname']=_0x4d393b[_0xee0a('0x21')]||'';}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 064ba9d..f1cc70e 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 _0x7223=['countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','format','ringtime','holdtime','membername','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','util','moment','milliseconds','diff','seconds','state','statedesc','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x476107,_0x5a96cf){var _0x26c057=function(_0x52419a){while(--_0x52419a){_0x476107['push'](_0x476107['shift']());}};_0x26c057(++_0x5a96cf);}(_0x7223,0x116));var _0x3722=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x7223[_0x50007c];return _0x5c1ec7;};'use strict';var util=require(_0x3722('0x0'));var _=require('lodash');var moment=require(_0x3722('0x1'));function getSeconds(_0x819841,_0x4ecc7f){var _0x83a45d=moment(_0x819841)[_0x3722('0x2')](0x0);var _0x1bb8c2=moment(_0x4ecc7f)[_0x3722('0x2')](0x0);return _0x83a45d[_0x3722('0x3')](_0x1bb8c2,_0x3722('0x4'));}function Hangup(_0x4cdb6d,_0x10fbff){this[_0x3722('0x5')]=0x4;this[_0x3722('0x6')]='Answer';this[_0x3722('0x7')]=_0x4cdb6d[_0x3722('0x7')];this[_0x3722('0x8')]=_0x4cdb6d[_0x3722('0x8')];this['campaigntype']=_0x4cdb6d[_0x3722('0x8')]===_0x3722('0x9')?'queue':_0x4cdb6d['type'];this[_0x3722('0xa')]=_0x4cdb6d[_0x3722('0xa')];this[_0x3722('0xb')]=_0x4cdb6d[_0x3722('0xb')];this[_0x3722('0xc')]=_0x4cdb6d['countnoanswerretry'];this[_0x3722('0xd')]=_0x4cdb6d['countbusyretry']+_0x4cdb6d[_0x3722('0xb')]+_0x4cdb6d['countnoanswerretry']+_0x4cdb6d[_0x3722('0xe')]+_0x4cdb6d[_0x3722('0xf')]+_0x4cdb6d[_0x3722('0x10')]+_0x4cdb6d[_0x3722('0x11')]+_0x4cdb6d[_0x3722('0x12')];this[_0x3722('0xe')]=_0x4cdb6d['countnosuchnumberretry'];this[_0x3722('0xf')]=_0x4cdb6d[_0x3722('0xf')];this[_0x3722('0x10')]=_0x4cdb6d[_0x3722('0x10')];this[_0x3722('0x11')]=_0x4cdb6d['countmachineretry'];this[_0x3722('0x12')]=_0x4cdb6d['countagentrejectretry'];this['uniqueid']=_0x10fbff[_0x3722('0x13')];this[_0x3722('0x14')]=_0x4cdb6d[_0x3722('0x15')];this[_0x3722('0x16')]=_0x4cdb6d[_0x3722('0x17')];this[_0x3722('0x18')]=_0x4cdb6d[_0x3722('0x18')];this['responsetime']=_0x4cdb6d[_0x3722('0x19')];this[_0x3722('0x1a')]=moment()[_0x3722('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x3722('0x1c')]=getSeconds(_0x4cdb6d[_0x3722('0x19')],_0x4cdb6d['starttime']);this[_0x3722('0x1d')]=0x0;this['talktime']=getSeconds(this[_0x3722('0x1a')],_0x4cdb6d[_0x3722('0x19')]);this['queue']=_0x4cdb6d['queue'];this[_0x3722('0x1e')]=_0x3722('0x1f');this['reason']=_0x10fbff[_0x3722('0x20')];this[_0x3722('0x21')]=_0x4cdb6d[_0x3722('0x21')];this[_0x3722('0x22')]=_0x4cdb6d[_0x3722('0x22')];this[_0x3722('0x23')]=_0x4cdb6d[_0x3722('0x23')];this['recallme']=_0x4cdb6d[_0x3722('0x24')];this[_0x3722('0x25')]=_0x4cdb6d['ContactId'];this[_0x3722('0x26')]=_0x4cdb6d[_0x3722('0x26')];this[_0x3722('0x27')]=_0x4cdb6d[_0x3722('0x27')];this[_0x3722('0x28')]=_0x4cdb6d[_0x3722('0x28')];this[_0x3722('0x29')]=_0x4cdb6d['CampaignId'];}module['exports']=Hangup; \ No newline at end of file +var _0x8975=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','util','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','queue','membername','IVR','reason','cause-txt','callbackuniqueid'];(function(_0x28472a,_0x41120c){var _0x3025ea=function(_0x3373a7){while(--_0x3373a7){_0x28472a['push'](_0x28472a['shift']());}};_0x3025ea(++_0x41120c);}(_0x8975,0x8a));var _0x5897=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x8975[_0x1cc8fe];return _0x230054;};'use strict';var util=require(_0x5897('0x0'));var _=require('lodash');var moment=require(_0x5897('0x1'));function getSeconds(_0x1ad392,_0x64e5f){var _0x175da6=moment(_0x1ad392)[_0x5897('0x2')](0x0);var _0x54d4e0=moment(_0x64e5f)[_0x5897('0x2')](0x0);return _0x175da6[_0x5897('0x3')](_0x54d4e0,_0x5897('0x4'));}function Hangup(_0x395559,_0x42c2ed){this['state']=0x4;this[_0x5897('0x5')]=_0x5897('0x6');this[_0x5897('0x7')]=_0x395559['scheduledat'];this[_0x5897('0x8')]=_0x395559['type'];this[_0x5897('0x9')]=_0x395559[_0x5897('0x8')]===_0x5897('0xa')?'queue':_0x395559['type'];this[_0x5897('0xb')]=_0x395559[_0x5897('0xb')];this[_0x5897('0xc')]=_0x395559[_0x5897('0xc')];this[_0x5897('0xd')]=_0x395559[_0x5897('0xd')];this[_0x5897('0xe')]=_0x395559[_0x5897('0xb')]+_0x395559[_0x5897('0xc')]+_0x395559[_0x5897('0xd')]+_0x395559['countnosuchnumberretry']+_0x395559[_0x5897('0xf')]+_0x395559[_0x5897('0x10')]+_0x395559[_0x5897('0x11')]+_0x395559['countagentrejectretry'];this[_0x5897('0x12')]=_0x395559[_0x5897('0x12')];this[_0x5897('0xf')]=_0x395559[_0x5897('0xf')];this[_0x5897('0x10')]=_0x395559[_0x5897('0x10')];this[_0x5897('0x11')]=_0x395559[_0x5897('0x11')];this[_0x5897('0x13')]=_0x395559[_0x5897('0x13')];this[_0x5897('0x14')]=_0x42c2ed[_0x5897('0x14')];this[_0x5897('0x15')]=_0x395559[_0x5897('0x16')];this['calleridnum']=_0x395559[_0x5897('0x17')];this[_0x5897('0x18')]=_0x395559[_0x5897('0x18')];this[_0x5897('0x19')]=_0x395559[_0x5897('0x19')];this[_0x5897('0x1a')]=moment()[_0x5897('0x1b')](_0x5897('0x1c'));this[_0x5897('0x1d')]=getSeconds(_0x395559['responsetime'],_0x395559[_0x5897('0x18')]);this[_0x5897('0x1e')]=0x0;this[_0x5897('0x1f')]=getSeconds(this[_0x5897('0x1a')],_0x395559[_0x5897('0x19')]);this[_0x5897('0x20')]=_0x395559[_0x5897('0x20')];this[_0x5897('0x21')]=_0x5897('0x22');this[_0x5897('0x23')]=_0x42c2ed[_0x5897('0x24')];this['callback']=_0x395559['callback'];this[_0x5897('0x25')]=_0x395559[_0x5897('0x25')];this['callbackat']=_0x395559[_0x5897('0x26')];this['recallme']=_0x395559[_0x5897('0x27')];this[_0x5897('0x28')]=_0x395559[_0x5897('0x28')];this[_0x5897('0x29')]=_0x395559[_0x5897('0x29')];this[_0x5897('0x2a')]=_0x395559['UserId'];this[_0x5897('0x2b')]=_0x395559[_0x5897('0x2b')];this['CampaignId']=_0x395559['CampaignId'];}module['exports']=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index cebeb75..cd25d39 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 _0x46de=['exports','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x2718d7,_0x460200){var _0x29faf0=function(_0x97b4a8){while(--_0x97b4a8){_0x2718d7['push'](_0x2718d7['shift']());}};_0x29faf0(++_0x460200);}(_0x46de,0x160));var _0xe46d=function(_0x50efff,_0x16022a){_0x50efff=_0x50efff-0x0;var _0x337538=_0x46de[_0x50efff];return _0x337538;};'use strict';var util=require('util');var _=require(_0xe46d('0x0'));var moment=require(_0xe46d('0x1'));function getSeconds(_0x4f6fe7,_0x28fcb2){var _0x414edd=moment(_0x4f6fe7)[_0xe46d('0x2')](0x0);var _0x5dae8e=moment(_0x28fcb2)[_0xe46d('0x2')](0x0);return _0x414edd[_0xe46d('0x3')](_0x5dae8e,_0xe46d('0x4'));}function History(_0x104508){this[_0xe46d('0x5')]=_0x104508[_0xe46d('0x5')];this[_0xe46d('0x6')]=_0x104508[_0xe46d('0x6')]||undefined;this[_0xe46d('0x7')]=_0x104508['type'];this[_0xe46d('0x8')]=_0x104508['type']===_0xe46d('0x9')?_0xe46d('0xa'):_0x104508[_0xe46d('0x7')];this[_0xe46d('0xb')]=_0x104508[_0xe46d('0xb')];this[_0xe46d('0xc')]=_0x104508[_0xe46d('0xc')];this[_0xe46d('0xd')]=_0x104508[_0xe46d('0xd')];this[_0xe46d('0xe')]=_0x104508[_0xe46d('0xb')]+_0x104508[_0xe46d('0xc')]+_0x104508[_0xe46d('0xd')]+_0x104508['countnosuchnumberretry']+_0x104508[_0xe46d('0xf')]+_0x104508['countabandonedretry']+_0x104508[_0xe46d('0x10')]+_0x104508[_0xe46d('0x11')];this[_0xe46d('0x12')]=_0x104508[_0xe46d('0x12')];this[_0xe46d('0xf')]=_0x104508[_0xe46d('0xf')];this[_0xe46d('0x13')]=_0x104508['countabandonedretry'];this[_0xe46d('0x10')]=_0x104508[_0xe46d('0x10')];this[_0xe46d('0x11')]=_0x104508[_0xe46d('0x11')];this[_0xe46d('0xa')]=_0x104508['queue'];this[_0xe46d('0x14')]=_0x104508[_0xe46d('0x15')];this[_0xe46d('0x16')]=_0x104508[_0xe46d('0x17')];this[_0xe46d('0x18')]=_0x104508['starttime'];this[_0xe46d('0x19')]=_0x104508['responsetime'];this['endtime']=_0x104508[_0xe46d('0x19')];this[_0xe46d('0x1a')]=getSeconds(_0x104508[_0xe46d('0x19')],_0x104508[_0xe46d('0x18')]);this['holdtime']=0x0;this['talktime']=0x0;this['callback']=_0x104508[_0xe46d('0x1b')];this['callbackuniqueid']=_0x104508[_0xe46d('0x1c')];this[_0xe46d('0x1d')]=_0x104508[_0xe46d('0x1d')];this[_0xe46d('0x1e')]=_0x104508[_0xe46d('0x1e')];this[_0xe46d('0x1f')]=_0x104508[_0xe46d('0x1f')];this[_0xe46d('0x20')]=_0x104508[_0xe46d('0x20')];this['UserId']=_0x104508[_0xe46d('0x21')];this['VoiceQueueId']=_0x104508[_0xe46d('0x22')];this[_0xe46d('0x23')]=_0x104508[_0xe46d('0x23')];this[_0xe46d('0x24')]=_0x104508[_0xe46d('0x24')]||'';this['originatecalleridname']=_0x104508[_0xe46d('0x25')]||'';}module[_0xe46d('0x26')]=History; \ No newline at end of file +var _0x8934=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','number','starttime','responsetime','ringtime','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type'];(function(_0x2515db,_0x2715c){var _0x4d69dc=function(_0x346630){while(--_0x346630){_0x2515db['push'](_0x2515db['shift']());}};_0x4d69dc(++_0x2715c);}(_0x8934,0x1e2));var _0x4893=function(_0xaa9aa3,_0x32a590){_0xaa9aa3=_0xaa9aa3-0x0;var _0x378552=_0x8934[_0xaa9aa3];return _0x378552;};'use strict';var util=require(_0x4893('0x0'));var _=require(_0x4893('0x1'));var moment=require(_0x4893('0x2'));function getSeconds(_0x3b0302,_0x1dd5f6){var _0x23da05=moment(_0x3b0302)[_0x4893('0x3')](0x0);var _0x4f956d=moment(_0x1dd5f6)[_0x4893('0x3')](0x0);return _0x23da05[_0x4893('0x4')](_0x4f956d,_0x4893('0x5'));}function History(_0x21cfba){this['uniqueid']=_0x21cfba['uniqueid'];this[_0x4893('0x6')]=_0x21cfba[_0x4893('0x6')]||undefined;this[_0x4893('0x7')]=_0x21cfba['type'];this['campaigntype']=_0x21cfba[_0x4893('0x7')]===_0x4893('0x8')?_0x4893('0x9'):_0x21cfba[_0x4893('0x7')];this['countbusyretry']=_0x21cfba[_0x4893('0xa')];this[_0x4893('0xb')]=_0x21cfba['countcongestionretry'];this[_0x4893('0xc')]=_0x21cfba[_0x4893('0xc')];this['countglobal']=_0x21cfba[_0x4893('0xa')]+_0x21cfba[_0x4893('0xb')]+_0x21cfba['countnoanswerretry']+_0x21cfba[_0x4893('0xd')]+_0x21cfba[_0x4893('0xe')]+_0x21cfba[_0x4893('0xf')]+_0x21cfba[_0x4893('0x10')]+_0x21cfba[_0x4893('0x11')];this[_0x4893('0xd')]=_0x21cfba[_0x4893('0xd')];this[_0x4893('0xe')]=_0x21cfba[_0x4893('0xe')];this[_0x4893('0xf')]=_0x21cfba['countabandonedretry'];this['countmachineretry']=_0x21cfba[_0x4893('0x10')];this[_0x4893('0x11')]=_0x21cfba[_0x4893('0x11')];this[_0x4893('0x9')]=_0x21cfba['queue'];this[_0x4893('0x12')]=_0x21cfba[_0x4893('0x13')];this['calleridnum']=_0x21cfba[_0x4893('0x14')];this[_0x4893('0x15')]=_0x21cfba['starttime'];this['responsetime']=_0x21cfba[_0x4893('0x16')];this['endtime']=_0x21cfba[_0x4893('0x16')];this[_0x4893('0x17')]=getSeconds(_0x21cfba[_0x4893('0x16')],_0x21cfba[_0x4893('0x15')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0x4893('0x18')]=_0x21cfba[_0x4893('0x18')];this['callbackuniqueid']=_0x21cfba[_0x4893('0x19')];this['callbackat']=_0x21cfba[_0x4893('0x1a')];this['recallme']=_0x21cfba['recallme'];this[_0x4893('0x1b')]=_0x21cfba[_0x4893('0x1b')];this[_0x4893('0x1c')]=_0x21cfba['ListId'];this['UserId']=_0x21cfba[_0x4893('0x1d')];this['VoiceQueueId']=_0x21cfba[_0x4893('0x1e')];this[_0x4893('0x1f')]=_0x21cfba[_0x4893('0x1f')];this[_0x4893('0x20')]=_0x21cfba['originatecalleridnum']||'';this[_0x4893('0x21')]=_0x21cfba[_0x4893('0x21')]||'';}module[_0x4893('0x22')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index b3e4f7b..92de66e 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 _0x803f=['Congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','[syncAgentComplete][createHistory][?]','Global','Success','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Agent','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','handleIvr','limitCalls','getContactDialerIvr','dialOrderByScheduledAt','AVAILABLE_CONTACTS_FINISHED','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','ACTIVE','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','bluebird','uuid','md5','ioredis','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictiveCalls','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','hangup','syncHangup','syncNewExten','varset','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Interval','Intervals','isEmpty','Error','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','sumDuration','sumHoldTime','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCallToSecond','erlangAbandonmentRate','Trunk','active','callerid','stringify','format','voice_queue:save','campaign:ivr:%s','campaign:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','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','erlangCalls','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','clearing\x20variable\x20handle\x20predictive','ivr','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','sendMessageOneNotActive','talking','pTalking','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','actions','[actions]','Action','status','channel','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','resolve','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','then','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','pick','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','reachable','SIP/%s','unmonitored','saveInDb','syncVarSet','uniqueid','isNil','variable','amdstatus','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerCallsDay','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','reason\x2019\x20machine....','YYYY-MM-DD\x20HH:mm:ss','ContactId','[rescheduleContact][Machine]','value','HangupInAMD','membername','[syncHangupInAMDIvr][createHistory]','countglobal','stateGlobal','createStateFinal','add','dialMachineRetryFrequency','minutes','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','cause-txt','Unknow','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','dialDropRetryFrequency','Drop','calleridname','calleridnum','Abandoned','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','syncQueueMember','actionid','locked','paused','stateinterface','push','idHopper','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','queueStatusComplete','preview','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','power','handlePower','dialPowerLevel','predictive','method\x20not\x20recognized','launchHandleIvr','loggedIn','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','NONE','\x22agi://%s/square,%s\x22','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','XMD-','isTrunkReachable','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','countnosuchnumberretry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy'];(function(_0x1aeda2,_0x1217eb){var _0x32dc6d=function(_0x34a460){while(--_0x34a460){_0x1aeda2['push'](_0x1aeda2['shift']());}};_0x32dc6d(++_0x1217eb);}(_0x803f,0x64));var _0xf803=function(_0x55656f,_0x71d94e){_0x55656f=_0x55656f-0x0;var _0x1a0f73=_0x803f[_0x55656f];return _0x1a0f73;};'use strict';var util=require(_0xf803('0x0'));var _=require('lodash');var BPromise=require(_0xf803('0x1'));var uuid=require(_0xf803('0x2'));var moment=require('moment');var rr=require('rr');var md5=require(_0xf803('0x3'));var Redis=require(_0xf803('0x4'));var ut=require(_0xf803('0x5'));var config=require(_0xf803('0x6'));var logger=require(_0xf803('0x7'))('dialer');var loggerBooked=require(_0xf803('0x7'))(_0xf803('0x8'));var loggerPredictive=require(_0xf803('0x7'))('predictive');var loggerPredictiveCalls=require(_0xf803('0x7'))(_0xf803('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xf803('0xa'));var ami=require(_0xf803('0xb'));config[_0xf803('0xc')]=_['defaults'](config[_0xf803('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0xf803('0xd'))(new Redis(config[_0xf803('0xc')]));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xf803('0xe'));var cmHopperBlack=require(_0xf803('0xf'));var voiceQueueRt=require(_0xf803('0x10'));var Action=require(_0xf803('0x11'));var History=require(_0xf803('0x12'));var Final=require('./final');var AgentComplete=require('./agentComplete');var QueueCallerAbandon=require(_0xf803('0x13'));var Hangup=require(_0xf803('0x14'));var ipAgi=process['env'][_0xf803('0x15')]||'127.0.0.1';var strategy={'rrmemory':_0xf803('0x16'),'roundrobin':_0xf803('0x17')};var Sequence=function(){};Sequence[_0xf803('0x18')][_0xf803('0x19')]=function(_0x58a80b){this[_0xf803('0x1a')]=this[_0xf803('0x1a')]?this[_0xf803('0x1a')][_0xf803('0x1b')](_0x58a80b):_0x58a80b();};function Dialer(_0x2aaef6,_0xd170bc){this[_0xf803('0x1c')]=new Sequence();this['preview']=_0xd170bc;this['voiceQueues']=_0x2aaef6[_0xf803('0x1d')];this[_0xf803('0x1e')]=_0x2aaef6[_0xf803('0x1e')];this[_0xf803('0x1f')]=_0x2aaef6[_0xf803('0x1f')];this[_0xf803('0x20')]=_0x2aaef6[_0xf803('0x20')];this[_0xf803('0x21')]=config[_0xf803('0x21')]||0x2;this[_0xf803('0x22')]={};this['actions']={};this[_0xf803('0x23')]={};this[_0xf803('0x24')]={};this[_0xf803('0x25')]={};this[_0xf803('0x26')]={};this[_0xf803('0x27')]={};this['ivrOriginated']={};this[_0xf803('0x28')]={};this[_0xf803('0x29')]={};ami['on']('agentconnect',this[_0xf803('0x2a')][_0xf803('0x2b')](this));ami['on'](_0xf803('0x2c'),this[_0xf803('0x2d')][_0xf803('0x2b')](this));ami['on'](_0xf803('0x2e'),this[_0xf803('0x2f')][_0xf803('0x2b')](this));ami['on'](_0xf803('0x30'),this[_0xf803('0x31')][_0xf803('0x2b')](this));ami['on']('custom:queuesummary',this[_0xf803('0xa')][_0xf803('0x2b')](this));ami['on'](_0xf803('0x32'),this[_0xf803('0x33')]['bind'](this));ami['on']('newexten',this[_0xf803('0x34')][_0xf803('0x2b')](this));ami['on'](_0xf803('0x35'),this['syncVarSet'][_0xf803('0x2b')](this));ami['on'](_0xf803('0x36'),this['syncQueueMember']['bind'](this));ami['on'](_0xf803('0x37'),this[_0xf803('0x38')]['bind'](this));this[_0xf803('0x39')]();this[_0xf803('0x3a')]();}function isNotNull(_0x3711a1){return _0x3711a1!==null&&!_['isUndefined'](_0x3711a1);}function checkIsLoggedIn(_0x73852c,_0x27c32f){return function(){if(_0x27c32f<=0x0){_0x73852c[_0xf803('0x3b')]=_0xf803('0x3c');throw _0x73852c[_0xf803('0x3d')]+_0xf803('0x3e');}};}function isActive(_0x34b5fa){return _0x34b5fa;}function checkIsActive(_0x2ebd22,_0x3cadd8){return function(){if(!isActive(_0x3cadd8)){_0x2ebd22[_0xf803('0x3b')]='NOT_ACTIVE';throw _0x2ebd22[_0xf803('0x3d')]+'\x20NOT\x20Active';}};}function checkInterval(_0x42e145){return function(){if(!isNotNull(_0x42e145['Interval'])){_0x42e145[_0xf803('0x3b')]=_0xf803('0x3f');throw _0x42e145[_0xf803('0x3d')]+_0xf803('0x40');}if(!isNotNull(_0x42e145[_0xf803('0x41')][_0xf803('0x42')])){_0x42e145[_0xf803('0x3b')]='INTERVAL_IS_NULL';throw _0x42e145[_0xf803('0x3d')]+_0xf803('0x40');}if(!isNotNull(_[_0xf803('0x43')](_0x42e145[_0xf803('0x41')][_0xf803('0x42')]))){_0x42e145[_0xf803('0x3b')]=_0xf803('0x3f');throw _0x42e145[_0xf803('0x3d')]+_0xf803('0x40');}};}function msgResponse(_0x3879d7,_0x55dccd,_0x55d42c){return{'action':_0x3879d7,'response':_0x55dccd,'message':_0x55d42c,'stack':_0x55d42c};}function myreject(_0x3e8399){return function(_0x5b2f05){return _0x3e8399(msgResponse('[ifTime][Action]',_0xf803('0x44'),JSON['stringify'](_0x5b2f05)));};}function getSeconds(_0x188a82,_0x27b064){var _0x2cae0c=moment(_0x188a82)[_0xf803('0x45')](0x0);var _0x2a2193=moment(_0x27b064)[_0xf803('0x45')](0x0);return _0x2cae0c[_0xf803('0x46')](_0x2a2193,_0xf803('0x47'));}function emit(_0x450be6,_0xc6a3c7,_0x479289){io['to'](_0x450be6)[_0xf803('0x48')](_0xc6a3c7,_0x479289);}function emitVoiceQueueSummary(_0x300db7){if(_0x300db7[_0xf803('0x49')]===_0xf803('0x4a')){var _0x43cc68={'id':_0x300db7['id'],'name':_0x300db7['name'],'strategy':_0x300db7[_0xf803('0x4b')],'answered':_0x300db7[_0xf803('0x4c')],'available':_0x300db7[_0xf803('0x4d')],'loggedIn':_0x300db7['loggedIn'],'pTalking':_0x300db7['pTalking'],'sumBillable':_0x300db7['sumBillable'],'sumDuration':_0x300db7[_0xf803('0x4e')],'sumHoldTime':_0x300db7[_0xf803('0x4f')]||0x0,'talking':_0x300db7['talking'],'total':_0x300db7[_0xf803('0x50')],'type':_0x300db7['type'],'unmanaged':_0x300db7[_0xf803('0x51')],'abandoned':_0x300db7[_0xf803('0x52')],'waiting':_0x300db7[_0xf803('0x53')],'loggedInDb':_0x300db7[_0xf803('0x54')],'dialActive':_0x300db7[_0xf803('0x55')],'dialMethod':_0x300db7[_0xf803('0x56')],'dialOriginateCallerIdName':_0x300db7[_0xf803('0x57')],'dialOriginateCallerIdNumber':_0x300db7[_0xf803('0x58')],'dialOriginateTimeout':_0x300db7[_0xf803('0x59')],'dialPrefix':_0x300db7['dialPrefix'],'outboundAnswerAgiCallsDay':_0x300db7[_0xf803('0x5a')],'outboundAnswerCallsDay':_0x300db7['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x300db7[_0xf803('0x5b')],'outboundBusyCallsDay':_0x300db7[_0xf803('0x5c')],'outboundCongestionCallsDay':_0x300db7[_0xf803('0x5d')],'outboundDropCallsDayACS':_0x300db7['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x300db7[_0xf803('0x5e')],'outboundDropCallsDayTimeout':_0x300db7['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x300db7[_0xf803('0x5f')],'outboundNoSuchCallsDay':_0x300db7['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x300db7[_0xf803('0x60')],'outboundReCallsDay':_0x300db7[_0xf803('0x61')],'outboundRejectCallsDay':_0x300db7['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x300db7[_0xf803('0x62')],'predictiveIntervalAnsweredCalls':_0x300db7[_0xf803('0x63')],'predictiveIntervalAvgHoldtime':_0x300db7[_0xf803('0x64')],'predictiveIntervalAvgTalktime':_0x300db7[_0xf803('0x65')],'predictiveIntervalDroppedCallsCallersExit':_0x300db7[_0xf803('0x66')],'predictiveIntervalDroppedCallsTimeout':_0x300db7[_0xf803('0x67')],'predictiveIntervalErlangCalls':_0x300db7[_0xf803('0x68')],'predictiveIntervalErlangCallsDroppedCalls':_0x300db7[_0xf803('0x69')],'predictiveIntervalHitRate':_0x300db7[_0xf803('0x6a')],'predictiveIntervalMultiplicativeFactor':_0x300db7[_0xf803('0x6b')],'predictiveIntervalPauses':_0x300db7[_0xf803('0x6c')],'predictiveIntervalAvailable':_0x300db7[_0xf803('0x6d')],'predictiveIntervalTotalCalls':_0x300db7[_0xf803('0x6e')],'message':_0x300db7['message'],'originated':_0x300db7[_0xf803('0x6f')],'erlangCalls':_0x300db7['erlangCalls'],'erlangCallToSecond':_0x300db7[_0xf803('0x70')],'erlangAbandonmentRate':_0x300db7[_0xf803('0x71')],'erlangBusyFactor':_0x300db7['erlangBusyFactor'],'startPredictive':_0x300db7[_0xf803('0x26')],'startProgressive':_0x300db7['startProgressive']};if(_0x300db7[_0xf803('0x72')]){_0x43cc68[_0xf803('0x72')]={'id':_0x300db7['Trunk']['id'],'name':_0x300db7[_0xf803('0x72')][_0xf803('0x3d')],'active':_0x300db7[_0xf803('0x72')][_0xf803('0x73')],'callerid':_0x300db7[_0xf803('0x72')][_0xf803('0x74')]};}if(_0x300db7[_0xf803('0x41')]){_0x43cc68[_0xf803('0x41')]={'id':_0x300db7['Interval']['id'],'name':_0x300db7[_0xf803('0x41')]['name']};}var _0x1756b3=md5(JSON[_0xf803('0x75')](_0x43cc68));if(_0x300db7['md5']!==_0x1756b3){_0x300db7['md5']=_0x1756b3;emit(util[_0xf803('0x76')]('voice:queue:%s',_0x43cc68[_0xf803('0x3d')]),_0xf803('0x77'),_0x43cc68);}}}function emitCampaignSummary(_0x3b96a2){if(_0x3b96a2[_0xf803('0x49')]==='ivr'){emit(util[_0xf803('0x76')](_0xf803('0x78'),_0x3b96a2[_0xf803('0x3d')]),_0xf803('0x79'),_0x3b96a2);}}function checkGetDataPredictive(_0x77edc1){if(isNotNull(_0x77edc1)&&!_[_0xf803('0x43')](_0x77edc1)){loggerPredictive[_0xf803('0x7a')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive['info'](_0xf803('0x7b'),_0x77edc1[_0xf803('0x6e')]);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x77edc1[_0xf803('0x63')]);loggerPredictive[_0xf803('0x7a')](_0xf803('0x7c'),_0x77edc1['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0xf803('0x7d'),_0x77edc1[_0xf803('0x66')]);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x77edc1[_0xf803('0x64')]);loggerPredictive['info'](_0xf803('0x7e'),_0x77edc1['predictiveIntervalAvgTalktime']);loggerPredictive[_0xf803('0x7a')](_0xf803('0x7f'));if(_0x77edc1[_0xf803('0x6e')]>0x0){if(!_[_0xf803('0x80')](_0x77edc1[_0xf803('0x65')])&&_0x77edc1[_0xf803('0x65')]>0x0){return!![];}loggerPredictive['info'](_0xf803('0x81'));if(!_[_0xf803('0x80')](_0x77edc1[_0xf803('0x64')])&&_0x77edc1['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive['info'](_0xf803('0x82'));}else{loggerPredictive[_0xf803('0x7a')](_0xf803('0x83'));}}else{loggerPredictive[_0xf803('0x7a')](_0xf803('0x84'));}return![];}function mergeDataErlangB(_0x2e7514){return function(_0x76de86){loggerPredictive['info'](_0xf803('0x85'));loggerPredictive[_0xf803('0x7a')](_0xf803('0x86'),_0x76de86[_0xf803('0x87')]);loggerPredictive[_0xf803('0x7a')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x76de86[_0xf803('0x70')]);loggerPredictive[_0xf803('0x7a')](_0xf803('0x88'),_0x76de86[_0xf803('0x71')]);loggerPredictive[_0xf803('0x7a')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x76de86[_0xf803('0x89')]);loggerPredictive[_0xf803('0x7a')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x76de86[_0xf803('0x71')]);loggerPredictive[_0xf803('0x7a')](_0xf803('0x7f'));_[_0xf803('0x8a')](_0x2e7514,_0x76de86);};}function getDiff(_0x49e7d1){var _0x123c2f=moment()[_0xf803('0x45')](0x0);var _0x12d0da=moment(_0x49e7d1)[_0xf803('0x45')](0x0);return _0x123c2f[_0xf803('0x46')](_0x12d0da,_0xf803('0x47'));}function ifInterval(_0x135976,_0x2a30ad){if(_[_0xf803('0x80')](_0x2a30ad)){return![];}return getDiff(_0x2a30ad)<_0x135976*0x3c;}function freeVariablesPredictive(_0x5e7446){if(isNotNull(_0x5e7446)){if(!_[_0xf803('0x80')](_0x5e7446['startProgressive'])){_0x5e7446[_0xf803('0x27')]=undefined;loggerPredictive[_0xf803('0x7a')](_0x5e7446[_0xf803('0x3d')],_0xf803('0x8b'));}if(!_['isUndefined'](_0x5e7446['startPredictive'])){_0x5e7446[_0xf803('0x26')]=undefined;loggerPredictive[_0xf803('0x7a')](_0x5e7446[_0xf803('0x3d')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0xf803('0x80')](_0x5e7446['handlePredictive'])){clearInterval(_0x5e7446[_0xf803('0x8c')]);_0x5e7446[_0xf803('0x8c')]=undefined;loggerPredictive[_0xf803('0x7a')](_0x5e7446[_0xf803('0x3d')],_0xf803('0x8d'));}}}function erlangb(_0x28080d,_0x3197ef){if(_0x3197ef===0x0){return 0x0;}var _0x3c6a55=0x1;for(var _0x507b8b=0x1;_0x507b8b<=_0x3197ef;_0x507b8b+=0x1){_0x3c6a55=0x1+_0x3c6a55*_0x507b8b/_0x28080d;}return 0x1/_0x3c6a55;}function isVoiceQueueOutbound(_0x253261){return _0x253261==='outbound';}function isNotPreview(_0x4bad89){return _0x4bad89!=='preview';}function isCampaignIvr(_0x56db6a){return _0x56db6a===_0xf803('0x8e');}function getCallerId(_0x5036a3,_0x2a603e,_0x36c54e){if(!_[_0xf803('0x80')](_0x36c54e)&&typeof _0x36c54e===_0xf803('0x8f')&&!_['isEmpty'](_0x36c54e)){if(!_[_0xf803('0x80')](_0x2a603e)&&typeof _0x2a603e==='string'&&!_[_0xf803('0x43')](_0x2a603e)){return util[_0xf803('0x76')](_0xf803('0x90'),_0x2a603e,_0x36c54e);}return util[_0xf803('0x76')](_0xf803('0x90'),_0x36c54e,_0x36c54e);}if(!_[_0xf803('0x80')](_0x5036a3)&&typeof _0x5036a3==='string'&&!_[_0xf803('0x43')](_0x5036a3)){return _0x5036a3;}return _0xf803('0x91');}function loggerCatchQueueSummary(_0x547aa4,_0x805577){return function(_0x23ce84){freeVariablesPredictive(_0x805577);emitVoiceQueueSummary(_0x805577);emitCampaignSummary(_0x805577);loggerSyncQueueSummary[_0xf803('0x92')](_0x547aa4,util[_0xf803('0x93')](_0x23ce84,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x21b09f,_0x1280c2){return function(_0x264e57){loggerPredictive[_0xf803('0x92')](_0x1280c2[_0xf803('0x3d')],_0x21b09f);loggerPredictive[_0xf803('0x92')](_0x264e57[_0xf803('0x94')]);freeVariablesPredictive(_0x1280c2);};}function loggerCatch(_0x228691){return function(_0x4e57fe){logger[_0xf803('0x92')](_0x228691,util[_0xf803('0x93')](_0x4e57fe,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x4a2805){return _0x4a2805&&!_[_0xf803('0x80')](_0x4a2805)&&_0x4a2805[_0xf803('0x95')]>0x0;}function decremetOriginate(_0x2b5d66){if(!_[_0xf803('0x80')](_0x2b5d66)&&_0x2b5d66!==null){if(typeof _0x2b5d66['originated']!==_0xf803('0x96')){if(_0x2b5d66[_0xf803('0x6f')]>0x0){_0x2b5d66[_0xf803('0x6f')]-=0x1;}else{logger[_0xf803('0x92')](_0xf803('0x97'));}}}else{logger[_0xf803('0x92')](_0xf803('0x98'));}}function checkContactLowerLimitOriginate(_0x423473,_0x55cd95,_0x1f207b){if(_0x55cd95>_0x1f207b){for(var _0x5467bf=0x0;_0x5467bf<_0x55cd95-_0x1f207b;_0x5467bf+=0x1){decremetOriginate(_0x423473);}}}function loggerGetContactDialer(_0x5b3016,_0x3863ec,_0x402021){return function(_0x44c935){checkContactLowerLimitOriginate(_0x3863ec,_0x402021,0x0);logger[_0xf803('0x92')](_0x5b3016,util[_0xf803('0x93')](_0x44c935,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x402ed6){return function(_0x3cf463){if(isNotNull(_0x3cf463)&&isNotNull(_0x3cf463[0x0])){if(_0x3cf463[0x0][_0xf803('0x99')]>0x0){_0x402ed6[_0xf803('0x3b')]=_0xf803('0x9a');logger[_0xf803('0x7a')](_0xf803('0x9b')+_0x402ed6[_0xf803('0x3d')],_0x3cf463[0x0][_0xf803('0x99')],_0xf803('0x9c'));}else{_0x402ed6['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xf803('0x7a')]('[getContactDialer2][Empty]'+_0x402ed6[_0xf803('0x3d')]);}}};}function notSendMessagesQueue(_0x5f2f74){if(_0x5f2f74[_0xf803('0x9d')]){freeVariablesPredictive(_0x5f2f74);if(_0x5f2f74[_0xf803('0x6f')]===0x0&&_0x5f2f74[_0xf803('0x9e')]===0x0&&_0x5f2f74[_0xf803('0x53')]===0x0&&(_0x5f2f74[_0xf803('0x9f')]||0x0)===0x0){_0x5f2f74['sendMessageOneNotActive']=![];_0x5f2f74['available']=0x0;_0x5f2f74[_0xf803('0x3b')]=_0xf803('0xa0');loggerSyncQueueSummary[_0xf803('0x92')](_0xf803('0xa1'),_0x5f2f74[_0xf803('0x3d')],_0xf803('0xa2'));}else{_0x5f2f74[_0xf803('0x3b')]=_0xf803('0xa3');loggerSyncQueueSummary[_0xf803('0x92')](_0xf803('0xa1'),_0x5f2f74[_0xf803('0x3d')],_0xf803('0xa4'));}emitVoiceQueueSummary(_0x5f2f74);}}function notSendMessagesCampaign(_0x316c39){if(_0x316c39[_0xf803('0x9d')]){if(_0x316c39[_0xf803('0x6f')]===0x0){_0x316c39[_0xf803('0x9d')]=![];_0x316c39['message']=_0xf803('0xa0');loggerSyncQueueSummary['error'](_0xf803('0xa5'),_0x316c39[_0xf803('0x3d')],_0xf803('0xa2'));}else{_0x316c39[_0xf803('0x3b')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xf803('0x92')](_0xf803('0xa5'),_0x316c39[_0xf803('0x3d')],_0xf803('0xa4'));}emitCampaignSummary(_0x316c39);}}function createObjHistory(_0x3a0816,_0x650f91,_0x1b11cc,_0xa2b37,_0x2074e3){_0x3a0816['message']=_0x1b11cc;var _0x3f7a63=new Action(_0x3a0816,_0x650f91);var _0x411db1=new History(_0x3f7a63);_0x411db1[_0xf803('0xa6')]=_0xa2b37;_0x411db1[_0xf803('0xa7')]=_0x2074e3;_0x411db1[_0xf803('0xa8')]=_0x3f7a63[_0xf803('0xa9')];return _0x411db1;}Dialer['prototype'][_0xf803('0x3a')]=function(){var _0x1cc113=this;setInterval(function(){_0x1cc113[_0xf803('0xaa')](_0x1cc113['uniqueId'],_0xf803('0xab'));_0x1cc113['clearZombieChannels'](_0x1cc113[_0xf803('0xac')],_0xf803('0xad'));},0x32c8);};Dialer[_0xf803('0x18')][_0xf803('0xaa')]=function(_0x2933fd,_0x8753e){var _0x26ce6e=this;for(var _0x5f0450 in _0x2933fd){if(typeof _0x2933fd[_0x5f0450]!==_0xf803('0x96')){this[_0xf803('0x1c')][_0xf803('0x19')](function(){if(!_['isNil'](_0x2933fd[_0x5f0450])){return ami[_0xf803('0xae')]({'action':_0xf803('0xaf'),'channel':_0x2933fd[_0x5f0450][_0xf803('0xb0')]})[_0xf803('0xb1')](function(_0xc6742){if(_0xc6742['message']===_0xf803('0xb2')){setTimeout(function(){if(_0x2933fd[_0x5f0450]&&_0x2933fd[_0x5f0450][_0xf803('0x49')]!=='ivr'){_0x26ce6e['updateOriginated'](_0x26ce6e[_0xf803('0x1d')][_0x2933fd[_0x5f0450][_0xf803('0xb3')]]);logger[_0xf803('0x92')](_0xf803('0xb4'),_0x8753e,_0x5f0450,_0x2933fd[_0x5f0450][_0xf803('0xb3')]);delete _0x2933fd[_0x5f0450];}if(_0x2933fd[_0x5f0450]&&_0x2933fd[_0x5f0450][_0xf803('0x49')]===_0xf803('0x8e')){_0x26ce6e[_0xf803('0xb5')](_0x26ce6e['campaigns'][_0x2933fd[_0x5f0450][_0xf803('0xb3')]]);logger[_0xf803('0x92')](_0xf803('0xb6'),_0x8753e,_0x5f0450,_0x2933fd[_0x5f0450]['queue']);delete _0x2933fd[_0x5f0450];}},0x2328);}});}});}}};Dialer[_0xf803('0x18')][_0xf803('0xb7')]=function(_0x338bc7){return BPromise[_0xf803('0xb8')]()['then'](cmHopper[_0xf803('0xb7')](_0x338bc7))[_0xf803('0xb1')](loggerCatch(_0xf803('0xb9')));};Dialer[_0xf803('0x18')][_0xf803('0xba')]=function(_0x4d4cfd){return BPromise[_0xf803('0xb8')]()['then'](cmHopperBlack['checkIsBlackList'](_0x4d4cfd))[_0xf803('0xb1')](loggerCatch(_0xf803('0xbb')));};Dialer['prototype'][_0xf803('0xbc')]=function(_0x5dbb66){return BPromise[_0xf803('0xb8')]()[_0xf803('0xbd')](cmHopperBlack[_0xf803('0xbc')](_0x5dbb66))[_0xf803('0xb1')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xf803('0x18')][_0xf803('0xbe')]=function(_0x47404b){return BPromise[_0xf803('0xb8')]()[_0xf803('0xbd')](cmHopperHistory[_0xf803('0xbf')](_0x47404b))[_0xf803('0xb1')](loggerCatch(_0xf803('0xc0')));};Dialer[_0xf803('0x18')][_0xf803('0xc1')]=function(_0xb882fc){return BPromise[_0xf803('0xb8')]()['then'](cmHopper[_0xf803('0xc1')](_0xb882fc))[_0xf803('0xb1')](loggerCatch(_0xf803('0xc2')));};Dialer[_0xf803('0x18')][_0xf803('0xc3')]=function(_0x11d690,_0x48092e,_0xb4689c){return BPromise[_0xf803('0xb8')]()['then'](cmHopper[_0xf803('0xc3')](_0x11d690,_0x48092e,_0xb4689c))[_0xf803('0xb1')](loggerCatch(_0xf803('0xc4')));};Dialer[_0xf803('0x18')][_0xf803('0xc5')]=function(_0x38d67a,_0x6b5d1c,_0x3d2aa5,_0x2409dd,_0x44e891){return BPromise[_0xf803('0xb8')]()[_0xf803('0xbd')](cmHopper[_0xf803('0xc5')](_0x38d67a,_0x6b5d1c,_0x3d2aa5,_0x2409dd))['catch'](function(_0x3af23b){_0x44e891['temp']-=_0x3d2aa5;_0x44e891['temp']=_0x44e891[_0xf803('0xc6')]>0x0?_0x44e891[_0xf803('0xc6')]:0x0;loggerCatch(_0xf803('0xc7'))(_0x3af23b);});};Dialer[_0xf803('0x18')]['getContactDialerIvr']=function(_0x3f3c4f,_0x19ccd3,_0x20bf58,_0x1b5bf0){return BPromise[_0xf803('0xb8')]()[_0xf803('0xbd')](cmHopper['getContactDialerIvr'](_0x3f3c4f,_0x19ccd3,_0x20bf58))[_0xf803('0xb1')](function(_0x4c30d5){_0x1b5bf0['temp']-=_0x19ccd3;_0x1b5bf0[_0xf803('0xc6')]=_0x1b5bf0[_0xf803('0xc6')]>0x0?_0x1b5bf0[_0xf803('0xc6')]:0x0;loggerCatch(_0xf803('0xc8'))(_0x4c30d5);});};Dialer[_0xf803('0x18')]['getVoiceQueueRtPauses']=function(_0x11bad3){return BPromise[_0xf803('0xb8')]()[_0xf803('0xbd')](voiceQueueRt[_0xf803('0xc9')](_0x11bad3))['catch'](loggerCatch(_0xf803('0xca')));};Dialer['prototype'][_0xf803('0xcb')]=function(_0xe991a0){return BPromise[_0xf803('0xb8')]()[_0xf803('0xbd')](cmHopper[_0xf803('0xcb')](_0xe991a0))[_0xf803('0xb1')](loggerCatch(_0xf803('0xcc')));};Dialer[_0xf803('0x18')][_0xf803('0xcd')]=function(_0x4187cb){return BPromise['resolve']()[_0xf803('0xbd')](cmHopperHistory['createHistory'](_0x4187cb))[_0xf803('0xb1')](loggerCatch(_0xf803('0xce')));};Dialer['prototype'][_0xf803('0xb5')]=function(_0x1a8ee0){if(!_['isUndefined'](_0x1a8ee0)&&_0x1a8ee0!==null){if(typeof _0x1a8ee0[_0xf803('0x6f')]!=='undefined'){if(_0x1a8ee0[_0xf803('0x6f')]>0x0){_0x1a8ee0[_0xf803('0x6f')]-=0x1;}else{logger[_0xf803('0x92')](_0xf803('0xcf'));}}}else{logger[_0xf803('0x92')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xf803('0x18')][_0xf803('0xd0')]=function(_0x4e7598,_0x1f0aa6){var _0x488db8=this;return function(_0x521b75){_0x488db8[_0xf803('0xb5')](_0x1f0aa6);logger[_0xf803('0x92')](_0x4e7598,util[_0xf803('0x93')](_0x521b75,{'showHidden':![],'depth':null}));};};Dialer[_0xf803('0x18')][_0xf803('0xd1')]=function(_0x4be98c,_0x5537c7,_0x49bf25){var _0x114df7={'state':0x19,'statedesc':_0xf803('0xd2')};this['updateOriginated'](_0x5537c7);this['saveInDb'](_[_0xf803('0x8a')](_0x114df7,_[_0xf803('0xd3')](_0x49bf25,['ContactId',_0xf803('0xd4'),_0xf803('0xd5'),_0xf803('0xd6'),_0xf803('0xd7')])),_0xf803('0xd8'),_0xf803('0xd9'));logger[_0xf803('0x92')](_0x4be98c);};Dialer['prototype'][_0xf803('0xda')]=function(_0x59e8be){return _0x59e8be==='Success';};Dialer[_0xf803('0x18')]['isTrunkReachable']=function(_0x3375db){return!_['isUndefined'](_0x3375db)&&_0x3375db&&!_[_0xf803('0x80')](_0x3375db[_0xf803('0x3d')])&&!_[_0xf803('0x80')](_0x3375db[_0xf803('0x73')])&&_0x3375db[_0xf803('0x73')]&&(this[_0xf803('0x20')][util['format']('SIP/%s',_0x3375db[_0xf803('0x3d')])][_0xf803('0xaf')]===_0xf803('0xdb')||this[_0xf803('0x20')][util[_0xf803('0x76')](_0xf803('0xdc'),_0x3375db[_0xf803('0x3d')])][_0xf803('0xaf')]===_0xf803('0xdd'));};Dialer[_0xf803('0x18')][_0xf803('0xde')]=function(_0x3fc71b,_0x19f05d,_0x31e030){this[_0xf803('0xcd')](_0x3fc71b)[_0xf803('0xb1')](loggerCatch(_0x19f05d));this[_0xf803('0xcb')](_0x3fc71b)[_0xf803('0xb1')](loggerCatch(_0x31e030));};Dialer[_0xf803('0x18')][_0xf803('0xdf')]=function(_0x231b63){var _0x12e988=this[_0xf803('0x24')][_0x231b63[_0xf803('0xe0')]];var _0x5550c6;if(!_[_0xf803('0xe1')](_0x231b63)&&!_[_0xf803('0xe1')](_0x231b63['variable'])&&!_[_0xf803('0xe1')](_0x231b63[_0xf803('0xe2')][_0xf803('0xe3')])&&_0x231b63['exten']===_0xf803('0xe4')&&_0x12e988){if(_0x12e988['type']!==_0xf803('0x8e')&&this[_0xf803('0x1d')][_0x12e988[_0xf803('0xb3')]][_0xf803('0xe5')]&&_0x231b63['value']===_0xf803('0xe6')){delete this['uniqueId'][_0x231b63[_0xf803('0xe0')]];this['updateOriginated'](this[_0xf803('0x1d')][_0x12e988[_0xf803('0xb3')]]);this['voiceQueues'][_0x12e988['queue']][_0xf803('0xe7')]+=0x1;this[_0xf803('0x1d')][_0x12e988['queue']][_0xf803('0x5a')]+=0x1;_0x5550c6=new Hangup(_0x12e988,_0x231b63);_0x5550c6['state']=0x12;_0x5550c6[_0xf803('0xa7')]='HangupInAMD';_0x5550c6['membername']=_0xf803('0xe8');ami[_0xf803('0x48')](_0xf803('0xe9'),ut[_0xf803('0xea')](_0x5550c6,_0xf803('0xeb')));this[_0xf803('0xde')](_0x5550c6,_0xf803('0xec'),_0xf803('0xed'));}if(_0x12e988[_0xf803('0x49')]!==_0xf803('0x8e')&&this[_0xf803('0x1d')][_0x12e988[_0xf803('0xb3')]]['dialAMDActive']&&_0x231b63['value']===_0xf803('0xee')){var _0x28db4c=this;return new BPromise(function(_0x46b966,_0x13be28){delete _0x28db4c[_0xf803('0x24')][_0x231b63['uniqueid']];_0x28db4c[_0xf803('0xb5')](_0x28db4c[_0xf803('0x1d')][_0x12e988[_0xf803('0xb3')]]);_0x28db4c['voiceQueues'][_0x12e988[_0xf803('0xb3')]]['outboundAnswerCallsDay']+=0x1;_0x28db4c[_0xf803('0x1d')][_0x12e988[_0xf803('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4a2948=_0x28db4c['voiceQueues'][_0x12e988[_0xf803('0xb3')]];var _0x1ee5c9=new Hangup(_0x12e988,_0x231b63);_0x1ee5c9[_0xf803('0xa6')]=0x13;_0x1ee5c9['statedesc']=_0xf803('0xef');_0x1ee5c9['membername']=_0xf803('0xe8');_0x1ee5c9['countmachineretry']+=0x1;_0x1ee5c9['countglobal']+=0x1;_0x1ee5c9[_0xf803('0xeb')]=!![];ami['emit'](_0xf803('0xe9'),ut[_0xf803('0xea')](_0x1ee5c9,_0xf803('0xeb')));_0x28db4c['createHistory'](_0x1ee5c9)[_0xf803('0xb1')](loggerCatch(_0xf803('0xf0')));if(_0x1ee5c9[_0xf803('0xf1')]+_0x1ee5c9[_0xf803('0xf2')]+_0x1ee5c9[_0xf803('0xf3')]+_0x1ee5c9['countnosuchnumberretry']+_0x1ee5c9[_0xf803('0xf4')]+_0x1ee5c9[_0xf803('0xf5')]+_0x1ee5c9[_0xf803('0xf6')]+_0x1ee5c9[_0xf803('0xf7')]>=_0x4a2948[_0xf803('0xf8')]){_0x28db4c['stateGlobal'](_0x1ee5c9,_0x46b966,_0x13be28,'reason19\x20machine....');}else{if(_0x1ee5c9[_0xf803('0xf6')]>=_0x4a2948['dialMachineMaxRetry']){_0x28db4c['createStateFinal'](_0x1ee5c9,_0x46b966,_0x13be28,_0xf803('0xf9'));}else{_0x28db4c[_0xf803('0xc1')]({'active':![],'countmachineretry':_0x1ee5c9[_0xf803('0xf6')],'scheduledat':moment()['add'](_0x4a2948['dialMachineRetryFrequency'],'minutes')[_0xf803('0x76')](_0xf803('0xfa')),'ContactId':_0x1ee5c9[_0xf803('0xfb')],'ListId':_0x1ee5c9[_0xf803('0xd4')],'VoiceQueueId':_0x1ee5c9[_0xf803('0xd6')]||undefined,'CampaignId':_0x1ee5c9['CampaignId']||undefined})['catch'](loggerCatch(_0xf803('0xfc')));_0x46b966({'reschedule':0x1});}}});}if(_0x12e988['type']===_0xf803('0x8e')&&this[_0xf803('0x1e')][_0x12e988[_0xf803('0xb3')]][_0xf803('0xe5')]&&_0x231b63[_0xf803('0xfd')]===_0xf803('0xe6')){delete this[_0xf803('0x24')][_0x231b63['uniqueid']];this['updateOriginated'](this[_0xf803('0x1e')][_0x12e988[_0xf803('0xb3')]]);_0x5550c6=new Hangup(_0x12e988,_0x231b63);_0x5550c6[_0xf803('0xa6')]=0x12;_0x5550c6[_0xf803('0xa7')]=_0xf803('0xfe');_0x5550c6[_0xf803('0xff')]=_0xf803('0xe8');ami['emit'](_0xf803('0xe9'),ut['buildObj'](_0x5550c6,_0xf803('0xeb')));this[_0xf803('0xde')](_0x5550c6,_0xf803('0x100'),'[syncHangupInAMDIvr]');}if(_0x12e988['type']===_0xf803('0x8e')&&this[_0xf803('0x1e')][_0x12e988[_0xf803('0xb3')]][_0xf803('0xe5')]&&_0x231b63[_0xf803('0xfd')]===_0xf803('0xee')){var _0x28db4c=this;return new BPromise(function(_0x347d5b,_0xdafc48){delete _0x28db4c[_0xf803('0x24')][_0x231b63['uniqueid']];_0x28db4c[_0xf803('0xb5')](_0x28db4c['campaigns'][_0x12e988['queue']]);_0x28db4c[_0xf803('0x1e')][_0x12e988[_0xf803('0xb3')]][_0xf803('0xe7')]+=0x1;_0x28db4c['campaigns'][_0x12e988[_0xf803('0xb3')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x4ac635=_0x28db4c[_0xf803('0x1e')][_0x12e988[_0xf803('0xb3')]];var _0x55985d=new Hangup(_0x12e988,_0x231b63);_0x55985d[_0xf803('0xa6')]=0x13;_0x55985d[_0xf803('0xa7')]=_0xf803('0xef');_0x55985d[_0xf803('0xff')]=_0xf803('0xe8');_0x55985d['countmachineretry']+=0x1;_0x55985d[_0xf803('0x101')]+=0x1;_0x55985d[_0xf803('0xeb')]=!![];ami['emit'](_0xf803('0xe9'),ut['buildObj'](_0x55985d,_0xf803('0xeb')));_0x28db4c['createHistory'](_0x55985d)[_0xf803('0xb1')](loggerCatch(_0xf803('0xf0')));if(_0x55985d[_0xf803('0xf1')]+_0x55985d[_0xf803('0xf2')]+_0x55985d[_0xf803('0xf3')]+_0x55985d['countnosuchnumberretry']+_0x55985d['countdropretry']+_0x55985d[_0xf803('0xf5')]+_0x55985d[_0xf803('0xf6')]+_0x55985d['countagentrejectretry']>=_0x4ac635['dialGlobalMaxRetry']){_0x28db4c[_0xf803('0x102')](_0x55985d,_0x347d5b,_0xdafc48,'reason19\x20machine....');}else{if(_0x55985d['countmachineretry']>=_0x4ac635['dialMachineMaxRetry']){_0x28db4c[_0xf803('0x103')](_0x55985d,_0x347d5b,_0xdafc48,_0xf803('0xf9'));}else{_0x28db4c[_0xf803('0xc1')]({'active':![],'countmachineretry':_0x55985d[_0xf803('0xf6')],'scheduledat':moment()[_0xf803('0x104')](_0x4ac635[_0xf803('0x105')],_0xf803('0x106'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x55985d[_0xf803('0xfb')],'ListId':_0x55985d[_0xf803('0xd4')],'VoiceQueueId':_0x55985d[_0xf803('0xd6')]||undefined,'CampaignId':_0x55985d[_0xf803('0xd7')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x347d5b({'reschedule':0x1});}}});}}};Dialer['prototype']['syncHangup']=function(_0x3eddc1){var _0x2104c1=this['uniqueId'][_0x3eddc1[_0xf803('0xe0')]];var _0x44b1ed=this;var _0x11c4b9;if(_0x2104c1&&_0x2104c1[_0xf803('0x49')]===_0xf803('0x8e')){delete this['uniqueId'][_0x3eddc1[_0xf803('0xe0')]];this[_0xf803('0xb5')](this[_0xf803('0x1e')][_0x2104c1[_0xf803('0xb3')]]);this[_0xf803('0x1e')][_0x2104c1[_0xf803('0xb3')]][_0xf803('0x107')]+=0x1;_0x11c4b9=new Hangup(_0x2104c1,_0x3eddc1);this[_0xf803('0xcd')](_0x11c4b9)[_0xf803('0xb1')](loggerCatch(_0xf803('0x108')));this[_0xf803('0xcb')](_0x11c4b9)['catch'](loggerCatch(_0xf803('0x109')));}if(_0x2104c1&&_0x2104c1[_0xf803('0x49')]!=='ivr'&&isNotNull(this[_0xf803('0x1d')][_0x2104c1[_0xf803('0xb3')]][_0xf803('0x10a')])){delete this[_0xf803('0x24')][_0x3eddc1[_0xf803('0xe0')]];this[_0xf803('0xb5')](this[_0xf803('0x1d')][_0x2104c1[_0xf803('0xb3')]]);this[_0xf803('0x1d')][_0x2104c1['queue']][_0xf803('0xe7')]+=0x1;this[_0xf803('0x1d')][_0x2104c1[_0xf803('0xb3')]][_0xf803('0x5a')]+=0x1;_0x11c4b9=new Hangup(_0x2104c1,_0x3eddc1);_0x11c4b9[_0xf803('0xa6')]=0x10;_0x11c4b9[_0xf803('0xa7')]=_0xf803('0x10b');_0x11c4b9[_0xf803('0xff')]='AGI';this[_0xf803('0xcd')](_0x11c4b9)[_0xf803('0xb1')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xf803('0xcb')](_0x11c4b9)[_0xf803('0xb1')](loggerCatch(_0xf803('0x109')));}if(_0x2104c1&&_0x2104c1[_0xf803('0x49')]!==_0xf803('0x8e')&&!isNotNull(this['voiceQueues'][_0x2104c1[_0xf803('0xb3')]][_0xf803('0x10a')])){delete this[_0xf803('0x24')][_0x3eddc1[_0xf803('0xe0')]];this[_0xf803('0xb5')](this[_0xf803('0x1d')][_0x2104c1['queue']]);this[_0xf803('0x1d')][_0x2104c1[_0xf803('0xb3')]][_0xf803('0x62')]+=0x1;_0x11c4b9=new Hangup(_0x2104c1,_0x3eddc1);_0x11c4b9[_0xf803('0xa6')]=0xc;_0x11c4b9['statedesc']=_0x3eddc1[_0xf803('0x10c')];_0x11c4b9[_0xf803('0xff')]=_0xf803('0x10d');this[_0xf803('0xcd')](_0x11c4b9)[_0xf803('0xb1')](loggerCatch(_0xf803('0x108')));this[_0xf803('0xcb')](_0x11c4b9)[_0xf803('0xb1')](loggerCatch(_0xf803('0x109')));}};Dialer[_0xf803('0x18')][_0xf803('0x31')]=function(_0x596868){var _0x1a1111=this[_0xf803('0x24')][_0x596868[_0xf803('0xe0')]];var _0x84e2f2=this;if(this[_0xf803('0x1d')][_0x596868['queue']]){if(_0x1a1111&&_0x1a1111['type']!==_0xf803('0x8e')){delete this[_0xf803('0x24')][_0x596868[_0xf803('0xe0')]];this[_0xf803('0x1d')][_0x596868['queue']][_0xf803('0xe7')]+=0x1;var _0x176adb=new AgentComplete(_0x1a1111,_0x596868);if(_0x596868['reason']==='agent'){_0x176adb['agiafterat']=this[_0xf803('0x1d')][_0x596868[_0xf803('0xb3')]][_0xf803('0x10e')]&&this[_0xf803('0x1d')][_0x596868[_0xf803('0xb3')]][_0xf803('0x10f')]?moment()[_0xf803('0x76')](_0xf803('0xfa')):undefined;}this[_0xf803('0xcd')](_0x176adb)[_0xf803('0xb1')](loggerCatch(_0xf803('0x110')));this[_0xf803('0xcb')](_0x176adb)['catch'](loggerCatch(_0xf803('0x111')));}}};Dialer[_0xf803('0x18')][_0xf803('0x2a')]=function(_0x1ccbcc){if(this[_0xf803('0x1d')][_0x1ccbcc[_0xf803('0xb3')]]){if(this['uniqueId'][_0x1ccbcc[_0xf803('0xe0')]]&&this[_0xf803('0x24')][_0x1ccbcc[_0xf803('0xe0')]]['type']!==_0xf803('0x8e')){this[_0xf803('0xb5')](this[_0xf803('0x1d')][_0x1ccbcc[_0xf803('0xb3')]]);this['uniqueId'][_0x1ccbcc[_0xf803('0xe0')]][_0xf803('0x112')]=moment()['format'](_0xf803('0xfa'));}}};Dialer[_0xf803('0x18')][_0xf803('0x113')]=function(_0x34f597){this[_0xf803('0xcd')](_0x34f597)[_0xf803('0xb1')](loggerCatch(_0xf803('0x110')));this['moveContactManagedDialer'](_0x34f597)[_0xf803('0xb1')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0xf803('0x18')][_0xf803('0x2d')]=function(_0x4e02e7){var _0xc6413=this[_0xf803('0x24')][_0x4e02e7['uniqueid']];var _0x12504b=this;if(this[_0xf803('0x1d')][_0x4e02e7[_0xf803('0xb3')]]){if(_0xc6413&&_0xc6413['type']!==_0xf803('0x8e')){delete this[_0xf803('0x24')][_0x4e02e7['uniqueid']];this[_0xf803('0xb5')](this['voiceQueues'][_0x4e02e7[_0xf803('0xb3')]]);_0xc6413[_0xf803('0x114')]=moment()[_0xf803('0x76')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1c2f3e=new QueueCallerAbandon(_0xc6413,_0x4e02e7);if(getSeconds(_0xc6413[_0xf803('0x114')],_0xc6413[_0xf803('0x115')])>=_0xc6413[_0xf803('0x116')]){this[_0xf803('0x1d')][_0x4e02e7[_0xf803('0xb3')]][_0xf803('0x67')]+=0x1;this['voiceQueues'][_0x4e02e7[_0xf803('0xb3')]][_0xf803('0x117')]+=0x1;this[_0xf803('0x1d')][_0x4e02e7[_0xf803('0xb3')]][_0xf803('0x69')]+=0x1;_0x1c2f3e['state']=0xa;_0x1c2f3e['statedesc']='Drop';_0x1c2f3e[_0xf803('0x118')]=_0xf803('0x119');_0x1c2f3e[_0xf803('0x11a')]=this[_0xf803('0x1d')][_0x4e02e7[_0xf803('0xb3')]][_0xf803('0x10e')]?moment()['format'](_0xf803('0xfa')):undefined;_0x1c2f3e[_0xf803('0xf4')]+=0x1;_0x1c2f3e['countglobal']+=0x1;if(_0x1c2f3e[_0xf803('0xf4')]>=this[_0xf803('0x1d')][_0x4e02e7[_0xf803('0xb3')]][_0xf803('0x11b')]){this[_0xf803('0x113')](_0x1c2f3e);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x1c2f3e[_0xf803('0xf4')],'scheduledat':moment()[_0xf803('0x104')](this[_0xf803('0x1d')][_0x4e02e7[_0xf803('0xb3')]][_0xf803('0x11c')],_0xf803('0x106'))[_0xf803('0x76')](_0xf803('0xfa')),'ContactId':_0xc6413[_0xf803('0xfb')],'ListId':_0xc6413[_0xf803('0xd4')],'VoiceQueueId':_0xc6413[_0xf803('0xd6')]||undefined,'CampaignId':_0xc6413[_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch('[rescheduleContact][Drop]'));var _0x39141a=new History(_0x1c2f3e);_0x39141a[_0xf803('0xa6')]=0xa;_0x39141a[_0xf803('0xa7')]=_0xf803('0x11d');_0x39141a[_0xf803('0xa9')]=moment()[_0xf803('0x76')]('YYYY-MM-DD\x20HH:mm:ss');_0x39141a[_0xf803('0xa8')]=_0x39141a[_0xf803('0xa9')];_0x39141a['calleridname']=_0x1c2f3e[_0xf803('0x11e')];_0x39141a['calleridnum']=_0x1c2f3e[_0xf803('0x11f')];this[_0xf803('0xcd')](_0x39141a)[_0xf803('0xb1')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xf803('0x1d')][_0x4e02e7[_0xf803('0xb3')]][_0xf803('0x66')]+=0x1;this['voiceQueues'][_0x4e02e7[_0xf803('0xb3')]][_0xf803('0x5e')]+=0x1;_0x1c2f3e[_0xf803('0xa6')]=0xb;_0x1c2f3e[_0xf803('0xa7')]=_0xf803('0x120');_0x1c2f3e['dropreason']='CALLEREXIT';_0x1c2f3e['countabandonedretry']+=0x1;_0x1c2f3e[_0xf803('0x101')]+=0x1;if(_0x1c2f3e[_0xf803('0xf5')]>=this[_0xf803('0x1d')][_0x4e02e7['queue']]['dialAbandonedMaxRetry']){this[_0xf803('0x113')](_0x1c2f3e);}else{this[_0xf803('0xc1')]({'active':![],'countabandonedretry':_0x1c2f3e[_0xf803('0xf5')],'scheduledat':moment()[_0xf803('0x104')](this['voiceQueues'][_0x4e02e7[_0xf803('0xb3')]][_0xf803('0x121')],'minutes')[_0xf803('0x76')](_0xf803('0xfa')),'ContactId':_0xc6413[_0xf803('0xfb')],'ListId':_0xc6413[_0xf803('0xd4')],'VoiceQueueId':_0xc6413[_0xf803('0xd6')]||undefined,'CampaignId':_0xc6413['CampaignId']||undefined})['catch'](loggerCatch(_0xf803('0x122')));var _0x39141a=new History(_0x1c2f3e);_0x39141a[_0xf803('0xa6')]=0xb;_0x39141a[_0xf803('0xa7')]=_0xf803('0x120');_0x39141a[_0xf803('0xa9')]=moment()[_0xf803('0x76')]('YYYY-MM-DD\x20HH:mm:ss');_0x39141a[_0xf803('0xa8')]=_0x39141a[_0xf803('0xa9')];_0x39141a[_0xf803('0x11e')]=_0x1c2f3e[_0xf803('0x11e')];_0x39141a[_0xf803('0x11f')]=_0x1c2f3e[_0xf803('0x11f')];this[_0xf803('0xcd')](_0x39141a)[_0xf803('0xb1')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer['prototype'][_0xf803('0x34')]=function(_0x422e0e){if(this['actions'][_0x422e0e[_0xf803('0xe0')]]){this[_0xf803('0xac')][_0x422e0e[_0xf803('0xe0')]]['channel']=_0x422e0e['channel'];}if(this[_0xf803('0x24')][_0x422e0e[_0xf803('0xe0')]]){this[_0xf803('0x24')][_0x422e0e['uniqueid']][_0xf803('0xb0')]=_0x422e0e[_0xf803('0xb0')];}};Dialer[_0xf803('0x18')][_0xf803('0x123')]=function(_0x54e5db){if(strategy[this[_0xf803('0x1d')][this[_0xf803('0xac')][_0x54e5db[_0xf803('0x124')]]['queue']][_0xf803('0x4b')]]==='roundrobin'){if(this[_0xf803('0xac')][_0x54e5db[_0xf803('0x124')]]&&_['isNil'](this[_0xf803('0xac')][_0x54e5db[_0xf803('0x124')]][_0xf803('0x125')])&&_0x54e5db[_0xf803('0xaf')]==='1'&&_0x54e5db[_0xf803('0x126')]==='0'){if(this[_0xf803('0x1f')][_0x54e5db[_0xf803('0x127')]]){if(!this[_0xf803('0x1f')][_0x54e5db[_0xf803('0x127')]][_0xf803('0x125')]){this[_0xf803('0x1f')][_0x54e5db[_0xf803('0x127')]][_0xf803('0x125')]=!![];this[_0xf803('0xac')][_0x54e5db[_0xf803('0x124')]][_0xf803('0x125')]=!![];this[_0xf803('0xac')][_0x54e5db['actionid']][_0xf803('0x127')]=_0x54e5db[_0xf803('0x127')];}}}}else if((strategy[this[_0xf803('0x1d')][this[_0xf803('0xac')][_0x54e5db[_0xf803('0x124')]][_0xf803('0xb3')]][_0xf803('0x4b')]]||_0xf803('0x16'))===_0xf803('0x16')){if(this[_0xf803('0xac')][_0x54e5db[_0xf803('0x124')]]){if(this[_0xf803('0x1f')][_0x54e5db['stateinterface']]){this[_0xf803('0xac')][_0x54e5db['actionid']][_0xf803('0x127')]=_0x54e5db[_0xf803('0x127')];if(_['isNil'](this['queueBooked'][this['actions'][_0x54e5db[_0xf803('0x124')]][_0xf803('0xb3')]])){this[_0xf803('0x28')][this[_0xf803('0xac')][_0x54e5db[_0xf803('0x124')]][_0xf803('0xb3')]]=[];}this[_0xf803('0x28')][this['actions'][_0x54e5db[_0xf803('0x124')]][_0xf803('0xb3')]][_0xf803('0x128')](_[_0xf803('0x8a')](_[_0xf803('0xd3')](this[_0xf803('0xac')][_0x54e5db[_0xf803('0x124')]],[_0xf803('0x129'),_0xf803('0x127')]),{'status':_0x54e5db[_0xf803('0xaf')],'paused':_0x54e5db['paused']}));}}}};function unlockQueueStatus(_0xb5782a,_0x26ec4b){setTimeout(function(){if(_[_0xf803('0x80')](_0xb5782a['queueStatusComplete'])){loggerBooked['error'](_0xf803('0x12a'),_0x26ec4b);}_0xb5782a['queueStatusComplete']=!![];loggerBooked[_0xf803('0x7a')](_0xf803('0x12b'),_0x26ec4b,JSON[_0xf803('0x75')](_[_0xf803('0xd3')](_0xb5782a,['name',_0xf803('0x12c')])));},0x1f3);}Dialer[_0xf803('0x18')]['syncQueueStatusComplete']=function(_0x4525d9){var _0x71887e=this;var _0x11a3cf=_0x71887e[_0xf803('0x1d')][_0x71887e['actions'][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]];if(strategy[this[_0xf803('0x1d')][this['actions'][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]][_0xf803('0x4b')]]===_0xf803('0x17')){if(this['actions'][_0x4525d9[_0xf803('0x124')]]&&this['actions'][_0x4525d9[_0xf803('0x124')]]['stateinterface']){this[_0xf803('0x12d')][_0xf803('0x12e')](this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0x129')],this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]]['stateinterface'])[_0xf803('0xb1')](function(_0x3e5b17){logger['error'](_0xf803('0x12f'),util[_0xf803('0x93')](_0x3e5b17,{'showHidden':![],'depth':null}));})[_0xf803('0x1b')](function(){_0x71887e[_0xf803('0xb5')](_0x71887e[_0xf803('0x1d')][_0x71887e[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]]);_0x71887e[_0xf803('0x1f')][_0x71887e['actions'][_0x4525d9[_0xf803('0x124')]][_0xf803('0x127')]][_0xf803('0x125')]=![];delete _0x71887e[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]];unlockQueueStatus(_0x11a3cf);});}else{this['updateOriginated'](this['voiceQueues'][this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]]);this[_0xf803('0xc1')]({'active':![],'ContactId':this['actions'][_0x4525d9[_0xf803('0x124')]][_0xf803('0xfb')],'ListId':this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xd4')],'VoiceQueueId':this[_0xf803('0xac')][_0x4525d9['actionid']][_0xf803('0xd6')]||undefined,'CampaignId':this['actions'][_0x4525d9['actionid']][_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xf803('0xac')][_0x4525d9['actionid']];unlockQueueStatus(_0x11a3cf);}}else if((strategy[this[_0xf803('0x1d')][this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]][_0xf803('0x4b')]]||'rrmemory')==='rrmemory'){var _0x4ff0d5;if(this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]]&&!_[_0xf803('0x43')](this['queueBooked'][this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]])){if(this[_0xf803('0x29')][_0x71887e[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]]['queue']]){this[_0xf803('0x29')][_0x71887e[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]]=this[_0xf803('0x29')][this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]]?this[_0xf803('0x29')][this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]]:this[_0xf803('0x28')][this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]]?this['queueBooked'][this[_0xf803('0xac')][_0x4525d9['actionid']][_0xf803('0xb3')]][_0xf803('0x130')]||0x0:0x0;}this[_0xf803('0x28')][this[_0xf803('0xac')][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]][_0xf803('0x130')]=this['queueBookedRR'][this['actions'][_0x4525d9[_0xf803('0x124')]][_0xf803('0xb3')]];for(var _0x2f60ec=0x0;_0x2f60ec=0x0;})['catch'](myreject(_0x48d7b6)));}}else{_0x5b233c['push'](ami[_0xf803('0xae')]({'action':_0xf803('0x147'),'command':util[_0xf803('0x76')]('iftime\x20%s,%s',_0x292282,!_[_0xf803('0x80')](config[_0xf803('0x144')][_0x1e8ad0])?_0x1e8ad0:'')})['then'](function(_0x1d4fe0){return _0x1d4fe0['content'][_0xf803('0x14b')](_0xf803('0x14c'))>=0x0;})[_0xf803('0xb1')](myreject(_0x48d7b6)));}BPromise[_0xf803('0x14d')](_0x5b233c)['then'](function(_0x50812d){var _0x489d04=_[_0xf803('0x14e')](_0x50812d);if(_0x489d04){return _0x42da46(_0x489d04);}else{_0x2ff2e8['message']=_0xdd018?_0xf803('0x14f'):'INTERVAL_IS_OVERTIME';return _0x48d7b6(msgResponse(_0xf803('0x150'),_0xf803('0x141'),_0xf803('0x151')+_0xdd018+'\x20'+_0xdffd73+_0xf803('0x152')+util[_0xf803('0x93')](_0x292282,{'showHidden':![],'depth':null})+_0xf803('0x153')+_0x1e8ad0));}})[_0xf803('0xb1')](function(_0x4af308){return _0x48d7b6(msgResponse(_0xf803('0x13f'),_0xf803('0x141'),JSON[_0xf803('0x75')](_0x4af308)));});});};Dialer['prototype']['checkDialMethod']=function(_0x307d94){var _0x3fb717=this;return function(){switch(_0x307d94[_0xf803('0x56')]){case _0xf803('0x154'):freeVariablesPredictive(_0x307d94);_0x3fb717['handlePower'](_0x307d94,0x1);break;case _0xf803('0x155'):freeVariablesPredictive(_0x307d94);_0x3fb717[_0xf803('0x156')](_0x307d94,_0x307d94[_0xf803('0x157')]);break;case'predictive':_0x3fb717[_0xf803('0x158')](_0x307d94);break;case _0xf803('0x8'):freeVariablesPredictive(_0x307d94);_0x3fb717[_0xf803('0x156')](_0x307d94,0x1);break;default:freeVariablesPredictive(_0x307d94);logger['error']('Queue',_0x307d94[_0xf803('0x3d')],_0xf803('0x159'));}};};Dialer[_0xf803('0x18')][_0xf803('0x15a')]=function(_0x1f705a){var _0x2e8ca7=this;return function(){_0x2e8ca7['handleIvr'](_0x1f705a);};};Dialer[_0xf803('0x18')][_0xf803('0xa')]=function(_0x58d377){var _0x204d6e=this;if(isNotPreview(_0x58d377[_0xf803('0x56')])){if(isVoiceQueueOutbound(_0x58d377['type'])&&isActive(_0x58d377[_0xf803('0x55')])){_0x58d377[_0xf803('0x9d')]=!![];BPromise[_0xf803('0xb8')]()[_0xf803('0xbd')](checkIsLoggedIn(_0x58d377,_0x58d377[_0xf803('0x15b')]))['then'](checkIsActive(_0x58d377,_0x58d377[_0xf803('0x55')]))[_0xf803('0xbd')](checkInterval(_0x58d377))[_0xf803('0xbd')](_0x204d6e[_0xf803('0x13c')](_0x58d377))[_0xf803('0xbd')](_0x204d6e['checkIfTime'](_0x58d377[_0xf803('0x15c')],_0x58d377['dialTimezone'],_0x58d377[_0xf803('0x3d')],_0x58d377))[_0xf803('0xbd')](_0x204d6e['checkIfTimeIntervals'](_0x58d377[_0xf803('0x41')],_0x58d377[_0xf803('0x15d')],_0x58d377['name'],_0x58d377))[_0xf803('0xbd')](_0x204d6e['checkDialMethod'](_0x58d377))[_0xf803('0xb1')](loggerCatchQueueSummary(_0xf803('0x15e'),_0x58d377));}else{notSendMessagesQueue(_0x58d377);}}else{freeVariablesPredictive(_0x58d377);}};Dialer[_0xf803('0x18')]['syncCampaigns']=function(){var _0x1b9c2c=this;var _0x14264d;for(var _0x3bc296 in this[_0xf803('0x1e')]){if(typeof this[_0xf803('0x1e')][_0x3bc296]!==_0xf803('0x96')){_0x14264d=this['campaigns'][_0x3bc296];if(isCampaignIvr(_0x14264d['type'])&&isActive(_0x14264d['active'])){_0x14264d['sendMessageOneNotActive']=!![];BPromise[_0xf803('0xb8')]()['then'](checkIsActive(_0x14264d,_0x14264d['active']))[_0xf803('0xbd')](checkInterval(_0x14264d))[_0xf803('0xbd')](_0x1b9c2c[_0xf803('0x13c')](_0x14264d))[_0xf803('0xbd')](_0x1b9c2c[_0xf803('0x13e')](_0x14264d[_0xf803('0x15c')],_0x14264d[_0xf803('0x15d')],_0x14264d[_0xf803('0x3d')],_0x14264d))[_0xf803('0xbd')](_0x1b9c2c['checkIfTimeIntervals'](_0x14264d[_0xf803('0x41')],_0x14264d[_0xf803('0x15d')],_0x14264d['name'],_0x14264d))['then'](_0x1b9c2c['launchHandleIvr'](_0x14264d))[_0xf803('0xb1')](loggerCatchQueueSummary(_0xf803('0x15f'),_0x14264d));}else{notSendMessagesCampaign(_0x14264d);}}}};function getCallerIdRandom(_0x4ca526,_0x2655c2){var _0x4878d9;var _0x3673f2;var _0xcbeddd;if(_0x2655c2<=0x0){_0x2655c2=0x1;}_0x4878d9=new RegExp('\x5cw{0,'+_0x2655c2+'}$');_0x3673f2=Math['pow'](0xa,_0x2655c2-0x1);_0xcbeddd=Math[_0xf803('0x160')](0xa,_0x2655c2)-0x1;return util['format']('%s',_[_0xf803('0x161')](_0x4ca526,_0x4878d9,_[_0xf803('0x162')](_0x3673f2,_0xcbeddd)));}function extractCalleridName(_0x388123){var _0x3abd6d=_0x388123[_0xf803('0x163')](/"(.*?)"/);return _0x3abd6d?_0x3abd6d[0x1]:_0x388123;}function extractCalleridNumber(_0x4111fa){var _0x54c1b7=_0x4111fa[_0xf803('0x163')](/<(.*?)>/);return _0x54c1b7?_0x54c1b7[0x1]:_0x4111fa;}Dialer[_0xf803('0x18')][_0xf803('0x164')]=function(_0x2c15aa,_0x269c5){var _0x1102ea=this;var _0x188d74=uuid['v4']();this[_0xf803('0xac')][_0x188d74]=new Action(_0x2c15aa,_0x269c5,_0x188d74);return new BPromise(function(_0x48c4a0,_0xfb6eff){if(_[_0xf803('0x80')](_0x2c15aa)&&typeof _0x2c15aa!==_0xf803('0x165')){return _0xfb6eff(msgResponse(_0xf803('0x166'),_0xf803('0x141'),_0xf803('0x167')));}if(_[_0xf803('0x80')](_0x269c5[_0xf803('0x168')][_0xf803('0x169')])||_0x269c5[_0xf803('0x168')][_0xf803('0x169')]===null){return _0xfb6eff(msgResponse(_0xf803('0x166'),_0xf803('0x141'),'contact\x20is\x20undefine'));}var _0x4f9e0c={'XMD-CALLERID':_0x1102ea['actions'][_0x188d74][_0xf803('0x16a')](),'XMD-AGI':_0x2c15aa[_0xf803('0x10a')]?util[_0xf803('0x76')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2c15aa[_0xf803('0x10a')]):_0xf803('0x16b'),'XMD-AGIAFTER':_0x2c15aa['dialQueueProject2']?util['format'](_0xf803('0x16c'),ipAgi,_0x2c15aa['dialQueueProject2']):_0xf803('0x16b'),'XMD-QUEUE':_0x2c15aa[_0xf803('0x49')]===_0xf803('0x4a')?util['format']('\x22%s,%s%s,,,%s\x22',_0x2c15aa[_0xf803('0x3d')],_0x2c15aa['dialQueueOptions']||'',_0x2c15aa['dialAgiAfterHangupAgent']?'c':'',_0x2c15aa[_0xf803('0x116')]||0x3):'NONE','XMD-CONTACTID':_0x269c5[_0xf803('0xfb')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1102ea[_0xf803('0xac')][_0x188d74]['getCaller'](),'XMD-AMD':_0x2c15aa[_0xf803('0xe5')]?'ACTIVE':_0xf803('0x16b'),'XMD-DESTINATION':_0xf803('0xe4')};if(_0x2c15aa[_0xf803('0xe5')]){_0x4f9e0c[_0xf803('0x16d')]=_0x2c15aa[_0xf803('0x16e')]||0x9c4;_0x4f9e0c[_0xf803('0x16f')]=_0x2c15aa[_0xf803('0x170')]||0x5dc;_0x4f9e0c[_0xf803('0x171')]=_0x2c15aa[_0xf803('0x172')]||0x320;_0x4f9e0c[_0xf803('0x173')]=_0x2c15aa[_0xf803('0x174')]||0x1388;_0x4f9e0c[_0xf803('0x175')]=_0x2c15aa[_0xf803('0x176')]||0x64;_0x4f9e0c[_0xf803('0x177')]=_0x2c15aa['dialAMDBetweenWordsSilence']||0x32;_0x4f9e0c[_0xf803('0x178')]=_0x2c15aa[_0xf803('0x179')]||0x3;_0x4f9e0c[_0xf803('0x17a')]=_0x2c15aa['dialAMDSilenceThreshold']||0x100;_0x4f9e0c[_0xf803('0x17b')]=_0x2c15aa[_0xf803('0x17c')]||0x1388;}if(_0x2c15aa[_0xf803('0x49')]===_0xf803('0x4a')){_0x4f9e0c[_0xf803('0x17d')]=_0x269c5['VoiceQueueId'];}else{_0x4f9e0c[_0xf803('0x17e')]=_0x269c5[_0xf803('0xd7')];}for(var _0x3aeb32 in _0x269c5['Contact']){if(typeof _0x269c5[_0xf803('0x168')][_0x3aeb32]!==_0xf803('0x96')){if(isNotNull(_0x269c5[_0xf803('0x168')][_0x3aeb32])&&_0x3aeb32!=='id'&&_0x3aeb32!==_0xf803('0x17f')&&_0x3aeb32!==_0xf803('0x180')&&_0x3aeb32!=='updatedAt'){_0x4f9e0c[util[_0xf803('0x76')](_0xf803('0x181'),_0xf803('0x182'),_['toUpper'](_0x3aeb32))]=_0x269c5[_0xf803('0x168')][_0x3aeb32];}}}var _0x5dbe99=_0x1102ea[_0xf803('0x183')](_0x2c15aa[_0xf803('0x72')])?getCallerId(_0x2c15aa['Trunk'][_0xf803('0x74')],_0x2c15aa[_0xf803('0x57')],_0x2c15aa['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x2c15aa['dialOriginateCallerIdNumber'],_0x2c15aa[_0xf803('0x184')]):_0x2c15aa[_0xf803('0x58')]):getCallerId(_[_0xf803('0xe1')](_0x2c15aa[_0xf803('0x185')])?_0x2c15aa[_0xf803('0x72')][_0xf803('0x74')]:_0x2c15aa['TrunkBackup'][_0xf803('0x74')],_0x2c15aa['dialOriginateCallerIdName'],_0x2c15aa['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x2c15aa[_0xf803('0x58')],_0x2c15aa['dialRandomLastDigitCallerIdNumber']):_0x2c15aa['dialOriginateCallerIdNumber']);if(_0x5dbe99){_0x4f9e0c[_0xf803('0x186')]=_0x1102ea[_0xf803('0xac')][_0x188d74]['originatecalleridname']=extractCalleridName(_0x5dbe99);_0x4f9e0c[_0xf803('0x187')]=_0x1102ea[_0xf803('0xac')][_0x188d74]['originatecalleridnum']=extractCalleridNumber(_0x5dbe99);}return ami['Action']({'actionid':_0x188d74,'action':_0xf803('0x166'),'channel':_0x1102ea[_0xf803('0x183')](_0x2c15aa[_0xf803('0x72')])?util[_0xf803('0x76')](_0xf803('0x188'),_0x2c15aa[_0xf803('0x72')][_0xf803('0x3d')],isNotNull(_0x2c15aa[_0xf803('0x189')])?_0x2c15aa[_0xf803('0x189')][_0xf803('0x18a')]()||'':'',_0x2c15aa[_0xf803('0x18b')]>0x0?_0x269c5['Contact'][_0xf803('0x169')][_0xf803('0x18c')](_0x2c15aa[_0xf803('0x18b')]):_0x269c5[_0xf803('0x168')][_0xf803('0x169')]):util[_0xf803('0x76')](_0xf803('0x188'),_[_0xf803('0xe1')](_0x2c15aa[_0xf803('0x185')])?_0x2c15aa[_0xf803('0x72')][_0xf803('0x3d')]:_0x2c15aa[_0xf803('0x185')][_0xf803('0x3d')],isNotNull(_0x2c15aa[_0xf803('0x189')])?_0x2c15aa[_0xf803('0x189')]['trim']()||'':'',_0x2c15aa['dialCutDigit']>0x0?_0x269c5[_0xf803('0x168')][_0xf803('0x169')][_0xf803('0x18c')](_0x2c15aa['dialCutDigit']):_0x269c5[_0xf803('0x168')][_0xf803('0x169')]),'callerid':_0x5dbe99,'Exten':_0xf803('0xe4'),'Context':'from-sip','Priority':'1','variable':_0x4f9e0c,'timeout':(_0x2c15aa[_0xf803('0x59')]||0x1e)*0x3e8,'async':!![],'channelid':_0x188d74})['then'](function(_0x11c38b){return _0x48c4a0(_0x11c38b);})[_0xf803('0xb1')](function(_0x528216){_0x2c15aa[_0xf803('0x60')]+=0x1;var _0x21aa7a=new History(_0x1102ea[_0xf803('0xac')][_0x188d74]);logger[_0xf803('0x92')](util[_0xf803('0x76')](_0xf803('0x18d'),JSON[_0xf803('0x75')](_0x528216)));_0x21aa7a[_0xf803('0xa6')]=0xe;_0x21aa7a['statedesc']=_0xf803('0x18e');_0x21aa7a[_0xf803('0xa9')]=moment()['format'](_0xf803('0xfa'));_0x21aa7a['endtime']=_0x21aa7a[_0xf803('0xa9')];_0x1102ea['createHistory'](_0x21aa7a)[_0xf803('0xb1')](loggerCatch(_0xf803('0x18f')));_0x1102ea[_0xf803('0xcb')](_0x21aa7a)[_0xf803('0xb1')](loggerCatch(_0xf803('0x18f')))['finally'](function(){delete _0x1102ea[_0xf803('0xac')][_0x188d74];return _0xfb6eff(msgResponse(_0xf803('0x166'),_0xf803('0x44'),_0xf803('0x190')));});});});};Dialer[_0xf803('0x18')]['syncOriginateResponse']=function(_0x5cfd02){var _0x1c9945=this[_0xf803('0xac')][_0x5cfd02[_0xf803('0x124')]];if(_0x1c9945){delete this[_0xf803('0xac')][_0x5cfd02[_0xf803('0x124')]];_0x1c9945[_0xf803('0x115')]=moment()[_0xf803('0x76')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5938c3=_0x1c9945[_0xf803('0x49')]===_0xf803('0x8e')?this[_0xf803('0x1e')][_0x1c9945[_0xf803('0xb3')]]:this['voiceQueues'][_0x1c9945['getQueue']()];if(!this[_0xf803('0xda')](_0x5cfd02['response'])){this[_0xf803('0xb5')](_0x5938c3);return this[_0xf803('0x191')](_0x1c9945,_0x5938c3,_0x5cfd02)['catch'](loggerCatch(_0xf803('0x192')));}this[_0xf803('0x24')][_0x5cfd02[_0xf803('0xe0')]]=_0x1c9945;}};Dialer['prototype'][_0xf803('0x193')]=function(_0x389800,_0x4a9c70,_0x58c149){var _0x5be877=new History(_0x4a9c70);if(_0x5be877[_0xf803('0xf1')]+_0x5be877['countcongestionretry']+_0x5be877[_0xf803('0xf3')]+_0x5be877['countnosuchnumberretry']+_0x5be877['countdropretry']+_0x5be877[_0xf803('0xf5')]+_0x5be877['countmachineretry']+_0x5be877['countagentrejectretry']>=_0x58c149[_0xf803('0xf8')]-0x1){return!![];}switch(_0x389800){case 0x3:if(_0x5be877[_0xf803('0xf3')]>=_0x58c149['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x5be877['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xf803('0x104')](_0x58c149[_0xf803('0x194')],'minutes')[_0xf803('0x76')](_0xf803('0xfa')),'ContactId':_0x5be877[_0xf803('0xfb')],'ListId':_0x5be877[_0xf803('0xd4')],'VoiceQueueId':_0x5be877[_0xf803('0xd6')]||undefined,'CampaignId':_0x5be877[_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch(_0xf803('0x195')));break;case 0x5:if(_0x5be877[_0xf803('0xf1')]>=_0x58c149[_0xf803('0x196')]-0x1){return!![];}this[_0xf803('0xc1')]({'active':![],'countbusyretry':_0x5be877[_0xf803('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x58c149[_0xf803('0x197')],_0xf803('0x106'))[_0xf803('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5be877[_0xf803('0xfb')],'ListId':_0x5be877[_0xf803('0xd4')],'VoiceQueueId':_0x5be877[_0xf803('0xd6')]||undefined,'CampaignId':_0x5be877[_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch(_0xf803('0x198')));break;case 0x8:if(_0x5be877[_0xf803('0xf2')]>=_0x58c149['dialCongestionMaxRetry']-0x1){return!![];}this[_0xf803('0xc1')]({'active':![],'countcongestionretry':_0x5be877[_0xf803('0xf2')]+=0x1,'scheduledat':moment()[_0xf803('0x104')](_0x58c149[_0xf803('0x199')],_0xf803('0x106'))[_0xf803('0x76')](_0xf803('0xfa')),'ContactId':_0x5be877['ContactId'],'ListId':_0x5be877[_0xf803('0xd4')],'VoiceQueueId':_0x5be877[_0xf803('0xd6')]||undefined,'CampaignId':_0x5be877[_0xf803('0xd7')]||undefined})['catch'](loggerCatch(_0xf803('0x19a')));break;case 0x0:if(_0x5be877['countnosuchnumberretry']>=_0x58c149[_0xf803('0x19b')]-0x1){return!![];}else{this[_0xf803('0xc1')]({'active':![],'countnosuchnumberretry':_0x5be877[_0xf803('0x19c')]+=0x1,'scheduledat':moment()['add'](_0x58c149[_0xf803('0x19d')],_0xf803('0x106'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5be877['ContactId'],'ListId':_0x5be877['ListId'],'VoiceQueueId':_0x5be877['VoiceQueueId']||undefined,'CampaignId':_0x5be877[_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch(_0xf803('0x19e')));}break;case 0xa:if(_0x5be877['countdropretry']>=_0x58c149[_0xf803('0x11b')]-0x1){return!![];}this[_0xf803('0xc1')]({'active':![],'countdropretry':_0x5be877[_0xf803('0xf4')]+=0x1,'scheduledat':moment()[_0xf803('0x104')](_0x58c149[_0xf803('0x11c')],_0xf803('0x106'))[_0xf803('0x76')](_0xf803('0xfa')),'ContactId':_0x5be877['ContactId'],'ListId':_0x5be877[_0xf803('0xd4')],'VoiceQueueId':_0x5be877[_0xf803('0xd6')]||undefined,'CampaignId':_0x5be877[_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x5be877['countabandonedretry']>=_0x58c149[_0xf803('0x19f')]-0x1){return!![];}this[_0xf803('0xc1')]({'active':![],'countabandonedretry':_0x5be877[_0xf803('0xf5')]+=0x1,'scheduledat':moment()['add'](_0x58c149[_0xf803('0x121')],_0xf803('0x106'))[_0xf803('0x76')](_0xf803('0xfa')),'ContactId':_0x5be877[_0xf803('0xfb')],'ListId':_0x5be877['ListId'],'VoiceQueueId':_0x5be877[_0xf803('0xd6')]||undefined,'CampaignId':_0x5be877[_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x5be877[_0xf803('0xf6')]>=_0x58c149[_0xf803('0x1a0')]-0x1){return!![];}this[_0xf803('0xc1')]({'active':![],'countmachineretry':_0x5be877[_0xf803('0xf6')]+=0x1,'scheduledat':moment()[_0xf803('0x104')](_0x58c149[_0xf803('0x105')],_0xf803('0x106'))[_0xf803('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5be877[_0xf803('0xfb')],'ListId':_0x5be877[_0xf803('0xd4')],'VoiceQueueId':_0x5be877[_0xf803('0xd6')]||undefined,'CampaignId':_0x5be877[_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch(_0xf803('0xfc')));break;case 0x14:if(_0x5be877[_0xf803('0xf7')]>=_0x58c149[_0xf803('0x1a1')]-0x1){return!![];}this[_0xf803('0xc1')]({'active':![],'countagentrejectretry':_0x5be877[_0xf803('0xf7')]+=0x1,'scheduledat':moment()['add'](_0x58c149[_0xf803('0x1a2')],_0xf803('0x106'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5be877[_0xf803('0xfb')],'ListId':_0x5be877['ListId'],'VoiceQueueId':_0x5be877[_0xf803('0xd6')]||undefined,'CampaignId':_0x5be877[_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xf803('0x18')]['callProgressDetecting']=function(_0x5bbd77,_0x25e895,_0x277888){var _0x53c658=this;var _0x5e76bc=new History(_0x5bbd77);return new BPromise(function(_0x5d0210,_0x28875d){if(_[_0xf803('0x80')](_0x25e895)&&typeof _0x25e895!==_0xf803('0x165')){return _0x28875d(msgResponse(_0xf803('0x1a3'),_0xf803('0x141'),_0xf803('0x1a4')));}if(_[_0xf803('0x80')](_0x277888)&&typeof _0x277888!==_0xf803('0x165')){return _0x28875d(msgResponse(_0xf803('0x1a3'),_0xf803('0x141'),_0xf803('0x1a5')));}switch(_0x277888[_0xf803('0x1a6')]){case'0':_0x25e895['outboundNoSuchCallsDay']+=0x1;_0x5e76bc[_0xf803('0xa6')]=0x0;_0x5e76bc[_0xf803('0xa7')]='NoSuchNumber';_0x5e76bc[_0xf803('0x19c')]+=0x1;_0x5e76bc['countglobal']+=0x1;ami[_0xf803('0x48')]('custom:agentnosuchnumber',ut[_0xf803('0xea')](_0x5bbd77,_0xf803('0x1a7')));_0x53c658['createHistory'](_0x5e76bc)[_0xf803('0xb1')](loggerCatch(_0xf803('0xf0')));if(_0x53c658[_0xf803('0x193')](0x0,_0x5bbd77,_0x25e895)){if(_0x5e76bc[_0xf803('0x19c')]>=_0x25e895[_0xf803('0x19b')]){_0x53c658[_0xf803('0x103')](_0x5e76bc,_0x5d0210,_0x28875d,_0xf803('0x1a8'));}else{_0x53c658[_0xf803('0x102')](_0x5e76bc,_0x5d0210,_0x28875d,_0xf803('0x1a8'));}}break;case'3':_0x25e895[_0xf803('0x5f')]+=0x1;_0x5e76bc[_0xf803('0xa6')]=0x3;_0x5e76bc['statedesc']=_0xf803('0x1a9');_0x5e76bc['countnoanswerretry']+=0x1;_0x5e76bc['countglobal']+=0x1;ami[_0xf803('0x48')](_0xf803('0x1aa'),ut[_0xf803('0xea')](_0x5bbd77,_0xf803('0x1ab')));_0x53c658['createHistory'](_0x5e76bc)[_0xf803('0xb1')](loggerCatch(_0xf803('0x1ac')));if(_0x53c658[_0xf803('0x193')](0x3,_0x5bbd77,_0x25e895)){if(_0x5e76bc[_0xf803('0xf3')]>=_0x25e895[_0xf803('0x1ad')]){_0x53c658['createStateFinal'](_0x5e76bc,_0x5d0210,_0x28875d,_0xf803('0x1ae'));}else{_0x53c658[_0xf803('0x102')](_0x5e76bc,_0x5d0210,_0x28875d,_0xf803('0x1ae'));}}break;case'5':_0x25e895['outboundBusyCallsDay']+=0x1;_0x5e76bc['state']=0x5;_0x5e76bc[_0xf803('0xa7')]=_0xf803('0x1af');_0x5e76bc[_0xf803('0xf1')]+=0x1;_0x5e76bc['countglobal']+=0x1;ami[_0xf803('0x48')](_0xf803('0x1b0'),ut[_0xf803('0xea')](_0x5bbd77,'busy'));_0x53c658['createHistory'](_0x5e76bc)[_0xf803('0xb1')](loggerCatch(_0xf803('0x1b1')));if(_0x53c658[_0xf803('0x193')](0x5,_0x5bbd77,_0x25e895)){if(_0x5e76bc[_0xf803('0xf1')]>=_0x25e895[_0xf803('0x196')]){_0x53c658[_0xf803('0x103')](_0x5e76bc,_0x5d0210,_0x28875d,_0xf803('0x1b2'));}else{_0x53c658[_0xf803('0x102')](_0x5e76bc,_0x5d0210,_0x28875d,_0xf803('0x1b2'));}}break;case'8':_0x25e895[_0xf803('0x5d')]+=0x1;_0x5e76bc['state']=0x8;_0x5e76bc[_0xf803('0xa7')]=_0xf803('0x1b3');_0x5e76bc[_0xf803('0xf2')]+=0x1;_0x5e76bc[_0xf803('0x101')]+=0x1;ami[_0xf803('0x48')]('custom:agentcongestion',ut[_0xf803('0xea')](_0x5bbd77,'congestion'));_0x53c658[_0xf803('0xcd')](_0x5e76bc)['catch'](loggerCatch(_0xf803('0x1b4')));if(_0x53c658[_0xf803('0x193')](0x8,_0x5bbd77,_0x25e895)){if(_0x5e76bc[_0xf803('0xf2')]>=_0x25e895[_0xf803('0x1b5')]){_0x53c658['createStateFinal'](_0x5e76bc,_0x5d0210,_0x28875d,'reason\x208\x20congestion');}else{_0x53c658[_0xf803('0x102')](_0x5e76bc,_0x5d0210,_0x28875d,_0xf803('0x1b6'));}}break;case'11':_0x25e895[_0xf803('0x1b7')]+=0x1;_0x5e76bc[_0xf803('0xa6')]=0xb;_0x5e76bc[_0xf803('0xa7')]=_0xf803('0x120');_0x5e76bc[_0xf803('0xf5')]+=0x1;_0x5e76bc['countglobal']+=0x1;_0x53c658['createHistory'](_0x5e76bc)[_0xf803('0xb1')](loggerCatch(_0xf803('0x1b8')));if(_0x53c658['checkRetriveMax'](0xb,_0x5bbd77,_0x25e895)){if(_0x5e76bc[_0xf803('0xf5')]>=_0x25e895[_0xf803('0x19f')]){_0x53c658[_0xf803('0x103')](_0x5e76bc,_0x5d0210,_0x28875d,_0xf803('0x1b9'));}else{_0x53c658[_0xf803('0x102')](_0x5e76bc,_0x5d0210,_0x28875d,_0xf803('0x1b9'));}}break;case'20':_0x25e895[_0xf803('0x1ba')]+=0x1;_0x5e76bc[_0xf803('0xa6')]=0x14;_0x5e76bc['statedesc']='AgentReject';_0x5e76bc[_0xf803('0xf7')]+=0x1;_0x5e76bc['countglobal']+=0x1;ami[_0xf803('0x48')](_0xf803('0x1bb'),ut['buildObj'](_0x5bbd77,_0xf803('0x1bc')));_0x53c658['createHistory'](_0x5e76bc)[_0xf803('0xb1')](loggerCatch(_0xf803('0x1bd')));if(_0x53c658['checkRetriveMax'](0x14,_0x5bbd77,_0x25e895)){if(_0x5e76bc['countagentrejectretry']>=_0x25e895['dialAgentRejectMaxRetry']){_0x53c658[_0xf803('0x103')](_0x5e76bc,_0x5d0210,_0x28875d,'reason\x2020\x20agentreject');}else{_0x53c658[_0xf803('0x102')](_0x5e76bc,_0x5d0210,_0x28875d,'reason\x2020\x20agentreject');}}break;default:_0x25e895[_0xf803('0x62')]+=0x1;_0x5e76bc[_0xf803('0xa6')]=0xc;_0x5e76bc['statedesc']=_0x277888[_0xf803('0x1a6')];_0x53c658[_0xf803('0xcd')](_0x5e76bc)[_0xf803('0xb1')](loggerCatch(_0xf803('0x1be')));if(_0x53c658['checkRetriveMax'](_0x277888[_0xf803('0x1a6')],_0x5bbd77,_0x25e895)){if(_0x5e76bc[_0xf803('0xf1')]+_0x5e76bc[_0xf803('0xf2')]+_0x5e76bc[_0xf803('0xf3')]+_0x5e76bc[_0xf803('0x19c')]+_0x5e76bc[_0xf803('0xf4')]+_0x5e76bc[_0xf803('0xf5')]+_0x5e76bc[_0xf803('0xf6')]+_0x5e76bc[_0xf803('0xf7')]>=_0x25e895[_0xf803('0xf8')]){_0x53c658[_0xf803('0x102')](_0x5e76bc,_0x5d0210,_0x28875d,_0x277888[_0xf803('0x1a6')]);}else{_0x53c658['createStateFinal'](_0x5e76bc,_0x5d0210,_0x28875d,_0x277888[_0xf803('0x1a6')]);}}}});};Dialer[_0xf803('0x18')][_0xf803('0x102')]=function(_0x69b172,_0x392677,_0x3f873d,_0x19187b){var _0x5c51ad=new Final(_0x69b172);_0x5c51ad[_0xf803('0xa6')]=0xf;_0x5c51ad['statedesc']=_0xf803('0x1bf');this[_0xf803('0x103')](_0x5c51ad,_0x392677,_0x3f873d,_0x19187b);};Dialer['prototype']['createStateFinal']=function(_0x66ffdf,_0x2ae791,_0x1512e0,_0x48f4f7){this[_0xf803('0xcb')](_0x66ffdf)[_0xf803('0xbd')](function(){return _0x2ae791(msgResponse(_0xf803('0x1a3'),_0xf803('0x1c0'),_0x48f4f7));})[_0xf803('0xb1')](function(){return _0x1512e0(msgResponse('[moveContactManagedDialer][0]',_0xf803('0x141'),_0xf803('0x1c1')));});};Dialer[_0xf803('0x18')]['predictive']=function(_0x31a3fd){var _0x53be0d=_0x31a3fd[_0xf803('0x1c2')]/0x64;var _0x147d3a=_0x31a3fd[_0xf803('0x117')]/(_0x31a3fd[_0xf803('0x117')]+_0x31a3fd[_0xf803('0xe7')]);var _0x5b7a29=Math['round'](_0x31a3fd[_0xf803('0x6d')]*(_0x31a3fd[_0xf803('0x1c3')]/0x64));var _0xaef74f=Math[_0xf803('0x1c4')](_0x31a3fd[_0xf803('0x6d')]*(_0x31a3fd[_0xf803('0x1c5')]/0x64));var _0x1b9dd1=_0x31a3fd[_0xf803('0x4d')]+_0x31a3fd[_0xf803('0x9e')];var _0x5b38c5=Math[_0xf803('0x1c6')](_0x31a3fd['erlangCalls']*_0x31a3fd['erlangAbandonmentRate']*_0x31a3fd['predictiveIntervalHitRate']*_0x31a3fd[_0xf803('0x6b')]);if(_[_0xf803('0x80')](_0x31a3fd[_0xf803('0x27')])){if(!_[_0xf803('0x80')](_0x31a3fd['startPredictive'])){_0x31a3fd[_0xf803('0x26')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xf803('0x80')](_0x31a3fd[_0xf803('0x8c')])){loggerPredictive[_0xf803('0x92')](_0xf803('0x1c7'),_0xf803('0x1c8'));clearInterval(_0x31a3fd['handlePredictive']);_0x31a3fd[_0xf803('0x8c')]=undefined;}_0x31a3fd['startProgressive']=moment()[_0xf803('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xf803('0x7a')](_0x31a3fd[_0xf803('0x3d')],_0xf803('0x1c9'),_0x31a3fd['startProgressive']);this[_0xf803('0x156')](_0x31a3fd,0x1);}else if(ifInterval(_0x31a3fd['dialPredictiveInterval'],_0x31a3fd[_0xf803('0x27')])){this['handlePower'](_0x31a3fd,0x1);loggerPredictiveCalls[_0xf803('0x7a')]('[startMethodPredictive][StartProgressive][Loop]',_0x31a3fd['startProgressive'],_0x31a3fd['name']);_0x31a3fd[_0xf803('0x87')]=0x0;_0x31a3fd[_0xf803('0x69')]=0x0;}else if(_0x53be0d<_0x147d3a&&_0x31a3fd['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x31a3fd);loggerPredictive[_0xf803('0x7a')](_0xf803('0x1ca'),_0xf803('0x1cb'),_0x147d3a,'startProgressive',_0x31a3fd[_0xf803('0x3d')]);}else if(_0x5b38c5<_0x31a3fd[_0xf803('0x69')]&&_0x31a3fd[_0xf803('0x1cc')]===_0xf803('0x1cd')){freeVariablesPredictive(_0x31a3fd);loggerPredictive['info'](_0xf803('0x1ce'),'Max\x20Drop\x20',_0x5b38c5,_0xf803('0x1cf'),_0x31a3fd[_0xf803('0x69')],_0xf803('0x27'),_0x31a3fd[_0xf803('0x3d')]);}else if(!ifInterval(_0x31a3fd[_0xf803('0x1d0')],_0x31a3fd[_0xf803('0x27')])&&_[_0xf803('0x80')](_0x31a3fd[_0xf803('0x26')])&&!_[_0xf803('0x80')](_0x31a3fd[_0xf803('0x27')])){_0x31a3fd['startPredictive']=moment()['format'](_0xf803('0xfa'));loggerPredictive[_0xf803('0x7a')](_0x31a3fd[_0xf803('0x3d')],_0xf803('0x1d1'),_0x31a3fd[_0xf803('0x26')]);this[_0xf803('0xbe')](_0x31a3fd[_0xf803('0x1d0')])['then'](this[_0xf803('0x1d2')](_0x31a3fd))['then'](mergeDataErlangB(_0x31a3fd))[_0xf803('0xbd')](this['startMethodPredictive'](_0x31a3fd))[_0xf803('0xb1')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x31a3fd));}else if(!ifInterval(_0x31a3fd['dialPredictiveInterval'],_0x31a3fd[_0xf803('0x26')])){_0x31a3fd[_0xf803('0x69')]=0x0;_0x31a3fd[_0xf803('0x26')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xf803('0x7a')](_0x31a3fd[_0xf803('0x3d')],_0xf803('0x1d3'),_0x31a3fd[_0xf803('0x26')]);clearInterval(_0x31a3fd[_0xf803('0x8c')]);_0x31a3fd[_0xf803('0x8c')]=undefined;this['averageHandleTime'](_0x31a3fd[_0xf803('0x1d0')])[_0xf803('0xbd')](this[_0xf803('0x1d2')](_0x31a3fd))[_0xf803('0xbd')](mergeDataErlangB(_0x31a3fd))[_0xf803('0xbd')](this['startMethodPredictive'](_0x31a3fd))[_0xf803('0xb1')](loggerCatchPredictive(_0xf803('0x1d4'),_0x31a3fd));}else if(_0x31a3fd[_0xf803('0x6d')]&&_0x1b9dd1<_0x31a3fd[_0xf803('0x6d')]-_0xaef74f){freeVariablesPredictive(_0x31a3fd);loggerPredictive['info'](_0x31a3fd['name'],_0xf803('0x1d5'),_0x1b9dd1,_0xf803('0x1d6'),_0x31a3fd[_0xf803('0x6d')],'-',_0xaef74f,'=',_0x31a3fd[_0xf803('0x6d')]-_0xaef74f,')');}else if(_0x31a3fd['predictiveIntervalAvailable']&&_0x1b9dd1>_0x31a3fd['predictiveIntervalAvailable']+_0x5b7a29){freeVariablesPredictive(_0x31a3fd);loggerPredictive[_0xf803('0x7a')](_0x31a3fd[_0xf803('0x3d')],_0xf803('0x1d5'),_0x1b9dd1,_0xf803('0x1d7'),_0x31a3fd[_0xf803('0x6d')],'+',_0x5b7a29,'=',_0x31a3fd[_0xf803('0x6d')]+_0x5b7a29,')');}};Dialer[_0xf803('0x18')][_0xf803('0x1d2')]=function(_0x62ed15){var _0x5e9a52=this;return function(_0x5afef0){return new BPromise(function(_0x53f780,_0x409cbd){_[_0xf803('0x8a')](_0x62ed15,_0x5afef0[0x0]);if(checkGetDataPredictive(_0x5afef0[0x0])){var _0x185da1=_0x62ed15[_0xf803('0x6d')]=_0x62ed15['talking']+_0x62ed15[_0xf803('0x4d')];var _0x5ab5de=_0x62ed15['dialPredictiveInterval']*0x3c;var _0x13a377=_0x5afef0[0x0]['predictiveIntervalAvgTalktime']+_0x5afef0[0x0][_0xf803('0x64')];var _0x326506=(_0x5afef0[0x0][_0xf803('0x63')]+_0x5afef0[0x0][_0xf803('0x67')]+_0x5afef0[0x0][_0xf803('0x66')])/_0x5afef0[0x0]['predictiveIntervalTotalCalls'];_0x62ed15[_0xf803('0x6a')]=_0x326506>0x0?_0x326506:0x1;switch(_0x62ed15[_0xf803('0x1cc')]){case _0xf803('0x1cd'):var _0x167f86=_0x62ed15[_0xf803('0x1c2')]/0x64;return _0x5e9a52[_0xf803('0x1d8')](_0x185da1,_0x5ab5de,_0x13a377,_0x326506,_0x167f86)['then'](function(_0x3d3bde){return _0x53f780(_0x3d3bde);});case _0xf803('0x1d9'):var _0x1f354a=_0x62ed15['dialPredictiveOptimizationPercentage']/0x64;return _0x5e9a52[_0xf803('0x1da')](_0x185da1,_0x5ab5de,_0x13a377,_0x326506,_0x1f354a)[_0xf803('0xbd')](function(_0x326ee2){return _0x53f780(_0x326ee2);});default:return _0x409cbd(msgResponse(_0xf803('0x1db'),_0xf803('0x141'),_0xf803('0x1dc')));}}else{return _0x409cbd(msgResponse(_0xf803('0x1db'),_0xf803('0x141'),_0xf803('0x1dd')));}});};};Dialer[_0xf803('0x18')][_0xf803('0x1de')]=function(_0x330a35){var _0x5e77f0=this;return function(_0x4173d3){return new BPromise(function(_0x3e4462,_0x471cf2){_[_0xf803('0x8a')](_0x330a35,_0x4173d3[0x0]);if(checkGetDataPredictive(_0x4173d3[0x0])){loggerPredictive[_0xf803('0x7a')](JSON[_0xf803('0x75')](_0x4173d3[0x0]));if(_0x330a35[_0xf803('0x1cc')]===_0xf803('0x1cd')){return _0x5e77f0[_0xf803('0xc9')](_0x330a35['id'])[_0xf803('0xbd')](function(_0x4fc0fb){var _0x4d504f=_0x330a35['loggedIn']-_0x4fc0fb[0x0][_0xf803('0x1df')];var _0x25b832=_0x330a35[_0xf803('0x1d0')]*0x3c;var _0x40b544=_0x4173d3[0x0][_0xf803('0x65')]+_0x4173d3[0x0][_0xf803('0x64')];var _0x51481f=(_0x4173d3[0x0]['predictiveIntervalAnsweredCalls']+_0x4173d3[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x4173d3[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4173d3[0x0][_0xf803('0x6e')];var _0x2a612c=_0x330a35[_0xf803('0x1c2')]/0x64;_0x330a35[_0xf803('0x6c')]=_0x4fc0fb[0x0][_0xf803('0x1df')]||0x0;_0x330a35[_0xf803('0x6a')]=_0x51481f>0x0?_0x51481f:0x1;return _0x5e77f0[_0xf803('0x1d8')](_0x4d504f,_0x25b832,_0x40b544,_0x51481f,_0x2a612c);})[_0xf803('0xbd')](function(_0x416571){return _0x3e4462(_0x416571);})['catch'](function(_0x476b3b){return _0x471cf2(msgResponse('[CatchErlangB]',_0xf803('0x141'),JSON[_0xf803('0x75')](_0x476b3b)));});}if(_0x330a35['dialPredictiveOptimization']===_0xf803('0x1d9')){return _0x5e77f0['getVoiceQueueRtPauses'](_0x330a35['id'])[_0xf803('0xbd')](function(_0x685f28){var _0x80a7f=_0x330a35['loggedIn']-_0x685f28[0x0][_0xf803('0x1df')];var _0x186a50=_0x330a35[_0xf803('0x1d0')]*0x3c;var _0x134743=_0x4173d3[0x0][_0xf803('0x65')]+_0x4173d3[0x0]['predictiveIntervalAvgHoldtime'];var _0x13276d=(_0x4173d3[0x0][_0xf803('0x63')]+_0x4173d3[0x0][_0xf803('0x67')]+_0x4173d3[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4173d3[0x0][_0xf803('0x6e')];var _0x3edf00=_0x330a35[_0xf803('0x1c2')]/0x64;_0x330a35[_0xf803('0x6c')]=_0x685f28[0x0][_0xf803('0x1df')]||0x0;_0x330a35[_0xf803('0x6a')]=_0x13276d>0x0?_0x13276d:0x1;return _0x5e77f0[_0xf803('0x1da')](_0x80a7f,_0x186a50,_0x134743,_0x13276d,_0x3edf00);})[_0xf803('0xbd')](function(_0x388859){return _0x3e4462(_0x388859);})[_0xf803('0xb1')](function(_0x58da9f){return _0x471cf2(msgResponse('[CatchErlangB]',_0xf803('0x141'),JSON[_0xf803('0x75')](_0x58da9f)));});}}else{return _0x471cf2(msgResponse(_0xf803('0x1db'),'Failure',_0xf803('0x1dd')));}});};};Dialer[_0xf803('0x18')]['startMethodPredictive']=function(_0x4b241b){var _0x128e2d=this;return function(){var _0x10eeac=0x0;var _0x45d961=Math[_0xf803('0x1c6')](_0x4b241b[_0xf803('0x70')]*0x3e8);if(_0x45d961>0x0){_0x45d961=_0x45d961<0x64?0x64:_0x45d961;loggerPredictive[_0xf803('0x7a')](_0x4b241b['name'],_0xf803('0x1e0'),_0x45d961,_0xf803('0x45'));_0x4b241b[_0xf803('0x8c')]=setInterval(function(){_0x128e2d[_0xf803('0x8c')](_0x4b241b);loggerPredictiveCalls[_0xf803('0x7a')](_0xf803('0x1e1'),_0x10eeac+=0x1);},_0x45d961);}else{loggerPredictive[_0xf803('0x7a')](_0x4b241b[_0xf803('0x3d')],_0xf803('0x1e2'));}};};Dialer[_0xf803('0x18')][_0xf803('0x1e3')]=function(_0xd0c34,_0x2d183a){var _0x14fb18=this;return function(_0x550457){if(_[_0xf803('0x43')](_0x550457)){if(_[_0xf803('0xe1')](_0x2d183a[_0xf803('0xd5')])||!_0x2d183a[_0xf803('0x1e4')]){if(_0xd0c34['dialMethod']===_0xf803('0x8')){_0xd0c34[_0xf803('0x12c')]=_[_0xf803('0x80')](_0xd0c34[_0xf803('0x12c')])?!![]:_0xd0c34[_0xf803('0x12c')];var _0x8ff1e=uuid['v4']();_0x14fb18['actions'][_0x8ff1e]=new Action(_0xd0c34,_0x2d183a,_0x8ff1e);loggerBooked[_0xf803('0x7a')](_0xf803('0x1e5'),_0x8ff1e,_0xf803('0x1e6'),JSON[_0xf803('0x75')](_0xd0c34['queueStatusComplete']),_0xf803('0x1e7'),_0xd0c34[_0xf803('0x3d')]);if(_0xd0c34['queueStatusComplete']){_0xd0c34['queueStatusComplete']=![];_0x14fb18['queueBooked'][_0x14fb18['actions'][_0x8ff1e][_0xf803('0xb3')]]=[];ami['Action']({'actionid':_0x8ff1e,'action':_0xf803('0x1e8'),'queue':_0xd0c34['name']})[_0xf803('0xb1')](function(){_0x14fb18[_0xf803('0xb5')](_0xd0c34);_0x14fb18[_0xf803('0xc1')]({'active':![],'ContactId':_0x14fb18[_0xf803('0xac')][_0x8ff1e][_0xf803('0xfb')],'ListId':_0x14fb18[_0xf803('0xac')][_0x8ff1e][_0xf803('0xd4')],'VoiceQueueId':_0x14fb18['actions'][_0x8ff1e][_0xf803('0xd6')]||undefined,'CampaignId':_0x14fb18[_0xf803('0xac')][_0x8ff1e][_0xf803('0xd7')]||undefined})['catch'](loggerCatch(_0xf803('0x1e9')));delete _0x14fb18[_0xf803('0xac')][_0x8ff1e];});}else{loggerBooked[_0xf803('0x7a')](_0xf803('0x1ea'),JSON['stringify'](_0xd0c34['queueStatusComplete']),'Queue:\x20',_0xd0c34[_0xf803('0x3d')]);_0x14fb18[_0xf803('0xb5')](_0xd0c34);_0x14fb18[_0xf803('0xc1')]({'active':![],'ContactId':_0x14fb18[_0xf803('0xac')][_0x8ff1e]['ContactId'],'ListId':_0x14fb18[_0xf803('0xac')][_0x8ff1e]['ListId'],'VoiceQueueId':_0x14fb18[_0xf803('0xac')][_0x8ff1e][_0xf803('0xd6')]||undefined,'CampaignId':_0x14fb18['actions'][_0x8ff1e][_0xf803('0xd7')]||undefined})[_0xf803('0xb1')](loggerCatch(_0xf803('0x1e9')));delete _0x14fb18[_0xf803('0xac')][_0x8ff1e];}}else{return _0x14fb18[_0xf803('0x164')](_0xd0c34,_0x2d183a);}}else{if(getDiff(_0x2d183a['scheduledat'])<_0xd0c34['dialRecallMeTimeout']*0x3c){if(_0x2d183a[_0xf803('0x1eb')]&&!_0x2d183a[_0xf803('0x1eb')]['voicePause']){_0x14fb18['preview']['run'](_0x2d183a['id'])['finally'](function(){_0x14fb18['updateOriginated'](_0xd0c34);});}else{_0x14fb18[_0xf803('0xc3')]({'active':![]},_0x2d183a['id'],0x1)[_0xf803('0x1b')](function(){_0x14fb18[_0xf803('0xb5')](_0xd0c34);});}}else{_0xd0c34['outboundReCallsDay']+=0x1;_0x14fb18[_0xf803('0xb5')](_0xd0c34);if(_0xd0c34['dialRecallInQueue']){_0x14fb18['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2d183a['ContactId'],'ListId':_0x2d183a[_0xf803('0xd4')],'VoiceQueueId':_0x2d183a[_0xf803('0xd6')]||undefined,'CampaignId':_0x2d183a['CampaignId']||undefined})[_0xf803('0xb1')](loggerCatch(_0xf803('0x1ec')));_0x14fb18['createHistory'](createObjHistory(_0xd0c34,_0x2d183a,_0xf803('0x1ed'),0x17,_0xf803('0x1ee')))[_0xf803('0xb1')](loggerCatch(_0xf803('0x1ef')));}else{_0x14fb18[_0xf803('0xde')](createObjHistory(_0xd0c34,_0x2d183a,'RECALLFAILEDTIMEOUT',0x16,'RecallFailedTimeout'),'[Originate][HistoryRecallClose][historyCatch]',_0xf803('0x1f0'));}}}}else{_0xd0c34[_0xf803('0x5b')]+=0x1;_0x14fb18[_0xf803('0xde')](createObjHistory(_0xd0c34,_0x2d183a,_0xf803('0x1f1'),0xd,_0xf803('0x1f2')),_0xf803('0x1f3'),_0xf803('0x1f4'));throw'inBlackList';}};};Dialer[_0xf803('0x18')][_0xf803('0x1f5')]=function(_0x27b4a1){var _0x55ed0d=this;var _0x3c201b=_0x27b4a1[_0xf803('0x1f6')]-_0x27b4a1[_0xf803('0x6f')]-_0x27b4a1[_0xf803('0xc6')];emitCampaignSummary(_0x27b4a1);if(_0x3c201b>0x0){if(_0x3c201b>this[_0xf803('0x21')]){_0x3c201b=this[_0xf803('0x21')];}_0x27b4a1[_0xf803('0xc6')]+=_0x3c201b;this[_0xf803('0x1f7')](_0x27b4a1['id'],_0x3c201b,_0x27b4a1[_0xf803('0x1f8')],_0x27b4a1)[_0xf803('0xbd')](function(_0x14fae7){_0x27b4a1[_0xf803('0xc6')]-=_0x3c201b;_0x27b4a1['temp']=_0x27b4a1['temp']>0x0?_0x27b4a1[_0xf803('0xc6')]:0x0;if(!checkContactEmpty(_0x14fae7)){_0x27b4a1['message']=_0xf803('0x1f9');logger[_0xf803('0x7a')](_0xf803('0x1fa')+_0x27b4a1['name']);}else{_0x27b4a1[_0xf803('0x6f')]+=_0x14fae7['length'];_0x27b4a1[_0xf803('0x3b')]=_0xf803('0x1fb');for(var _0x400f12=0x0;_0x400f12<_0x14fae7[_0xf803('0x95')];_0x400f12+=0x1){_0x27b4a1['ivrTotalCallsDays']+=0x1;if(_['isNil'](_0x14fae7[_0x400f12])||_[_0xf803('0xe1')](_0x14fae7[_0x400f12][_0xf803('0x168')])||_[_0xf803('0xe1')](_0x14fae7[_0x400f12][_0xf803('0x168')][_0xf803('0x169')])){_0x55ed0d[_0xf803('0xd1')](_0xf803('0x1fc'),_0x27b4a1,_0x14fae7[_0x400f12]);}else{_0x55ed0d[_0xf803('0xbc')](_[_0xf803('0xd3')](_0x14fae7[_0x400f12],[_0xf803('0xd7'),_0xf803('0x1fd')]))[_0xf803('0xbd')](_0x55ed0d[_0xf803('0x1e3')](_0x27b4a1,_0x14fae7[_0x400f12]))[_0xf803('0xb1')](_0x55ed0d[_0xf803('0xd0')](_0xf803('0x1fe'),_0x27b4a1));}}}})['catch'](loggerGetContactDialer(_0xf803('0x1ff'),_0x27b4a1,_0x3c201b));}};Dialer[_0xf803('0x18')][_0xf803('0x156')]=function(_0x3d36d3,_0x353af9){var _0x33bf16=this;var _0x3c4ebe=[];var _0x252be6=_0x353af9>=0x1?_0x353af9:0x1;if(_0x3d36d3[_0xf803('0x56')]===_0xf803('0x8')){_0x252be6=0x1;}var _0x1c87ff=Math[_0xf803('0x1c6')](_0x3d36d3[_0xf803('0x4d')]*_0x252be6)-_0x3d36d3['originated']-_0x3d36d3[_0xf803('0xc6')];emitVoiceQueueSummary(_0x3d36d3);if(_0x3d36d3[_0xf803('0x200')]>0x0){var _0x1c58bb=_0x3d36d3['dialLimitQueue']-_0x3d36d3[_0xf803('0x6f')]-_0x3d36d3['talking']-_0x3d36d3[_0xf803('0xc6')]-_0x3d36d3[_0xf803('0x9f')];if(_0x1c87ff>_0x1c58bb){_0x1c87ff=_0x1c58bb;}}if(_0x1c87ff>0x0){if(_0x3d36d3[_0xf803('0x56')]==='booked'){_0x1c87ff=0x1;}if(_0x1c87ff>this[_0xf803('0x21')]){_0x1c87ff=this['maxNumberOriginate'];}_0x3d36d3[_0xf803('0xc6')]+=_0x1c87ff;for(var _0x373274 in this[_0xf803('0x1f')]){if(typeof this[_0xf803('0x1f')][_0x373274]!==_0xf803('0x96')){if(this['agents'][_0x373274]['state']===_0xf803('0x201')&&this[_0xf803('0x1f')][_0x373274][_0xf803('0xaf')]==='reachable'){_0x3c4ebe['push'](this['agents'][_0x373274]['id']);}}}this[_0xf803('0xc5')](_0x3d36d3['id'],_0x3c4ebe,_0x1c87ff,_0x3d36d3['dialOrderByScheduledAt'],_0x3d36d3)['then'](function(_0x583760){_0x3d36d3[_0xf803('0xc6')]-=_0x1c87ff;_0x3d36d3[_0xf803('0xc6')]=_0x3d36d3[_0xf803('0xc6')]>0x0?_0x3d36d3[_0xf803('0xc6')]:0x0;if(!checkContactEmpty(_0x583760)){_0x33bf16['countReScheduled'](_0x3d36d3)[_0xf803('0xbd')](sendMessageReschedule(_0x3d36d3))[_0xf803('0xb1')](loggerCatch(_0xf803('0xb9')));}else{_0x3d36d3[_0xf803('0x6f')]+=_0x583760[_0xf803('0x95')];_0x3d36d3[_0xf803('0x3b')]=_0x3d36d3['dialMethod']===_0xf803('0x8')?_0xf803('0x202'):_0xf803('0x1fb');for(var _0x15e6e4=0x0;_0x15e6e4<_0x583760[_0xf803('0x95')];_0x15e6e4+=0x1){if(_[_0xf803('0xe1')](_0x583760[_0x15e6e4])||_[_0xf803('0xe1')](_0x583760[_0x15e6e4][_0xf803('0x168')])||_['isNil'](_0x583760[_0x15e6e4][_0xf803('0x168')][_0xf803('0x169')])){_0x33bf16['emptyContact'](_0xf803('0x1fc'),_0x3d36d3,_0x583760[_0x15e6e4]);}else{_0x33bf16[_0xf803('0xba')](_[_0xf803('0xd3')](_0x583760[_0x15e6e4],[_0xf803('0xd6'),'Contact.phone']))[_0xf803('0xbd')](_0x33bf16['checkContactBlack'](_0x3d36d3,_0x583760[_0x15e6e4]))[_0xf803('0xb1')](_0x33bf16[_0xf803('0xd0')](_0xf803('0x1fc'),_0x3d36d3));}}}})[_0xf803('0xb1')](loggerGetContactDialer(_0xf803('0x203'),_0x3d36d3,_0x1c87ff));}};Dialer[_0xf803('0x18')]['handlePredictive']=function(_0x786656){if(_0x786656[_0xf803('0x200')]>0x0){var _0x1fd267=_0x786656[_0xf803('0x200')]-_0x786656[_0xf803('0x6f')]-_0x786656[_0xf803('0x9e')];if(_0x1fd267>0x0){this[_0xf803('0x204')](_0x786656);}else{loggerPredictiveCalls[_0xf803('0x7a')](_0xf803('0x205'));}}else{this[_0xf803('0x204')](_0x786656);}};Dialer[_0xf803('0x18')]['tryOriginatePredictive']=function(_0x2ae9c5){var _0x4ce668=this;var _0x16536a=[];_0x2ae9c5[_0xf803('0x6f')]+=0x1;for(var _0x3af85b in this[_0xf803('0x1f')]){if(typeof this[_0xf803('0x1f')][_0x3af85b]!=='undefined'){if(this[_0xf803('0x1f')][_0x3af85b][_0xf803('0xa6')]==='not_inuse'&&this[_0xf803('0x1f')][_0x3af85b][_0xf803('0xaf')]===_0xf803('0xdb')){_0x16536a[_0xf803('0x128')](this[_0xf803('0x1f')][_0x3af85b]['id']);}}}this[_0xf803('0xc5')](_0x2ae9c5['id'],_0x16536a,0x1,_0x2ae9c5['dialOrderByScheduledAt'],_0x2ae9c5)[_0xf803('0xbd')](function(_0x387936){if(!checkContactEmpty(_0x387936)){checkContactLowerLimitOriginate(_0x2ae9c5,0x1,0x0);_0x4ce668[_0xf803('0xb7')](_0x2ae9c5)[_0xf803('0xbd')](sendMessageReschedule(_0x2ae9c5))[_0xf803('0xb1')](loggerCatch(_0xf803('0xb9')));}else{_0x2ae9c5['message']=_0xf803('0x1fb');if(_[_0xf803('0xe1')](_0x387936[0x0])||_[_0xf803('0xe1')](_0x387936[0x0][_0xf803('0x168')])||_[_0xf803('0xe1')](_0x387936[0x0][_0xf803('0x168')]['phone'])){_0x4ce668['emptyContact'](_0xf803('0x1fc'),_0x2ae9c5,_0x387936[0x0]);}else{_0x4ce668[_0xf803('0xba')](_[_0xf803('0xd3')](_0x387936[0x0],[_0xf803('0xd6'),'Contact.phone']))[_0xf803('0xbd')](_0x4ce668[_0xf803('0x1e3')](_0x2ae9c5,_0x387936[0x0]))[_0xf803('0xb1')](_0x4ce668['loggerHandler']('[actionOriginatePredictive]\x20',_0x2ae9c5));}}})[_0xf803('0xb1')](loggerGetContactDialer('[getContactDialerPredictive]',_0x2ae9c5,0x1));emitVoiceQueueSummary(_0x2ae9c5);};Dialer[_0xf803('0x18')][_0xf803('0x1d8')]=function(_0x3ee485,_0x58708b,_0x400ed2,_0xb6b6d1,_0x2e21a5,_0x5219a7){loggerPredictive['info'](_0xf803('0x206'));loggerPredictive[_0xf803('0x7a')](_0xf803('0x207'),_0x3ee485);loggerPredictive[_0xf803('0x7a')](_0xf803('0x208'),_0x58708b);loggerPredictive[_0xf803('0x7a')](_0xf803('0x209'),_0x400ed2);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xb6b6d1);loggerPredictive[_0xf803('0x7a')](_0xf803('0x20a'),_0x2e21a5);loggerPredictive['info'](_0xf803('0x7f'));return new BPromise(function(_0x5e71a2,_0x376263){if(_0x3ee485<=0x0||isNaN(_0x3ee485)){return _0x376263(msgResponse(_0xf803('0x20b'),'Error',_0xf803('0x20c')+_0x3ee485));}if(_0x400ed2<=0x0||isNaN(_0x400ed2)){return _0x376263(msgResponse('[abandonmentRate]',_0xf803('0x44'),_0xf803('0x20d')+_0x400ed2));}if(_0xb6b6d1<=0x0||isNaN(_0xb6b6d1)){return _0x376263(msgResponse(_0xf803('0x20b'),_0xf803('0x44'),_0xf803('0x20e')+_0xb6b6d1));}if(_0x58708b<=0x0||isNaN(_0x58708b)){return _0x376263(msgResponse(_0xf803('0x20b'),_0xf803('0x44'),_0xf803('0x20f')+_0x58708b));}if(_0x2e21a5<=0x0||isNaN(_0x2e21a5)){return _0x376263(msgResponse(_0xf803('0x20b'),_0xf803('0x44'),_0xf803('0x210')+_0x2e21a5));}_0x5219a7=_0x5219a7||0x0;var _0x170bba=0x1/_0x400ed2;var _0x34a7d5=0x0;var _0xab9e13=0x0;var _0x48c1cc=0x0;var _0x1b2fe2=0x0;for(var _0x2316eb=0x0;_0x48c1cc<_0x2e21a5;_0x2316eb+=0x1){_0xab9e13=_0x2316eb/_0x58708b;_0x34a7d5=(_0xb6b6d1*_0xab9e13+_0x5219a7)/_0x170bba;_0x48c1cc=erlangb(_0x34a7d5,_0x3ee485);_0x1b2fe2=_0x34a7d5/_0x3ee485*(0x1-erlangb(_0x34a7d5,_0x3ee485));}return _0x5e71a2({'erlangCalls':_0x2316eb,'erlangCallToSecond':_0x58708b/_0x2316eb,'erlangAbandonmentRate':_0x48c1cc,'erlangBusyFactor':_0x1b2fe2});});};Dialer[_0xf803('0x18')][_0xf803('0x1da')]=function(_0x3ef1cb,_0x464e99,_0x2ad4ee,_0x36790a,_0x151373,_0x2ca3dc){loggerPredictive[_0xf803('0x7a')](_0xf803('0x211'));loggerPredictive['info'](_0xf803('0x207'),_0x3ef1cb);loggerPredictive[_0xf803('0x7a')](_0xf803('0x208'),_0x464e99);loggerPredictive[_0xf803('0x7a')]('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',_0x2ad4ee);loggerPredictive[_0xf803('0x7a')](_0xf803('0x212'),_0x36790a);loggerPredictive[_0xf803('0x7a')](_0xf803('0x213'),_0x151373);loggerPredictive[_0xf803('0x7a')](_0xf803('0x7f'));return new BPromise(function(_0x146d00,_0x494e74){if(_0x3ef1cb<=0x0||isNaN(_0x3ef1cb)){return _0x494e74(msgResponse(_0xf803('0x214'),_0xf803('0x44'),'m\x20=\x20'+_0x3ef1cb));}if(_0x2ad4ee<=0x0||isNaN(_0x2ad4ee)){return _0x494e74(msgResponse(_0xf803('0x214'),_0xf803('0x44'),_0xf803('0x20d')+_0x2ad4ee));}if(_0x36790a<=0x0||isNaN(_0x36790a)){return _0x494e74(msgResponse(_0xf803('0x214'),_0xf803('0x44'),_0xf803('0x20e')+_0x36790a));}if(_0x464e99<=0x0||isNaN(_0x464e99)){return _0x494e74(msgResponse(_0xf803('0x214'),_0xf803('0x44'),_0xf803('0x20f')+_0x464e99));}if(_0x151373<=0x0||isNaN(_0x151373)){return _0x494e74(msgResponse(_0xf803('0x214'),_0xf803('0x44'),_0xf803('0x215')+_0x151373));}_0x2ca3dc=_0x2ca3dc||0x0;var _0x287005=0x1/_0x2ad4ee;var _0x2aa1e9=0x0;var _0x1a79e3=0x0;var _0x357e16=0x0;var _0x3719d7=0x0;for(var _0x3108f4=0x0;_0x3719d7<_0x151373;_0x3108f4+=0x1){_0x1a79e3=_0x3108f4/_0x464e99;_0x2aa1e9=(_0x36790a*_0x1a79e3+_0x2ca3dc)/_0x287005;_0x357e16=erlangb(_0x2aa1e9,_0x3ef1cb);_0x3719d7=_0x2aa1e9/_0x3ef1cb*(0x1-erlangb(_0x2aa1e9,_0x3ef1cb));}return _0x146d00({'erlangCalls':_0x3108f4,'erlangCallToSecond':_0x464e99/_0x3108f4,'erlangAbandonmentRate':_0x357e16,'erlangBusyFactor':_0x3719d7});});};module[_0xf803('0x216')]=Dialer; \ No newline at end of file +var _0x3750=['checkDialMethod','checkIsTrunkReachable','dialGlobalInterval','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','object','originate','phone','Contact','contact\x20is\x20undefine','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','createStateFinal','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','congestion','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','predictiveIntervalErlangCallsDroppedCalls','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimization','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','floor','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','unlockContact','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','dialOrderByScheduledAt','[getContactCampaign2][Empty]','RUNNING','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','reachable','ACTIVE','[getContactDialer2]','tryOriginatePredictive','not_inuse','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','m\x20=\x20','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','ioredis','../preview/util/util','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','env','127.0.0.1','roundrobin','enqueue','tail','finally','sequence','campaigns','agents','trunks','maxNumberOriginate','channels','optionPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','custom:queuesummary','newexten','syncNewExten','varset','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','name','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','Intervals','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','outbound','strategy','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','isUndefined','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','handlePredictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','length','originated','undefined','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','sendMessageOneNotActive','talking','available','[syncQueueSummary]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','state','starttime','prototype','clearZombieChannels','uniqueId','[uniqueid]','actions','[actions]','Action','status','catch','No\x20such\x20channel','updateOriginated','voiceQueues','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','saveInDb','pick','ListId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','SIP/%s','unmonitored','syncVarSet','uniqueid','isNil','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','HangupInAMD','membername','emit','custom:amd','buildObj','amd','[syncHangupInAMD]','MACHINE','statedesc','Machine','AMD','countmachineretry','countglobal','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','VoiceQueueId','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','stateGlobal','reason19\x20machine....','syncHangup','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','cause-txt','Unknow','[syncHangupIvr]','syncAgentComplete','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','[syncAgentComplete]','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','Drop','dropreason','TIMEOUT','dialDropMaxRetry','dialDropRetryFrequency','[rescheduleContact][Drop]','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','countabandonedretry','add','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','channel','actionid','paused','stateinterface','locked','rrmemory','push','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','run','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','isTrunkReachable','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','interval','indexOf','true','iftime\x20%s,%s','timezones','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','dialTimezone'];(function(_0x3b027c,_0x282a03){var _0x1963a3=function(_0x1c7f40){while(--_0x1c7f40){_0x3b027c['push'](_0x3b027c['shift']());}};_0x1963a3(++_0x282a03);}(_0x3750,0xbb));var _0x0375=function(_0x3972dd,_0x298e3f){_0x3972dd=_0x3972dd-0x0;var _0x3a29c8=_0x3750[_0x3972dd];return _0x3a29c8;};'use strict';var util=require(_0x0375('0x0'));var _=require(_0x0375('0x1'));var BPromise=require(_0x0375('0x2'));var uuid=require(_0x0375('0x3'));var moment=require(_0x0375('0x4'));var rr=require('rr');var md5=require('md5');var Redis=require(_0x0375('0x5'));var ut=require(_0x0375('0x6'));var config=require('../../../config/environment/');var logger=require(_0x0375('0x7'))(_0x0375('0x8'));var loggerBooked=require(_0x0375('0x7'))(_0x0375('0x9'));var loggerPredictive=require(_0x0375('0x7'))(_0x0375('0xa'));var loggerPredictiveCalls=require('../../../config/logger')(_0x0375('0xb'));var loggerSyncQueueSummary=require(_0x0375('0x7'))(_0x0375('0xc'));var ami=require(_0x0375('0xd'));config[_0x0375('0xe')]=_[_0x0375('0xf')](config['redis'],{'host':_0x0375('0x10'),'port':0x18eb});var io=require(_0x0375('0x11'))(new Redis(config[_0x0375('0xe')]));var cmHopper=require(_0x0375('0x12'));var cmHopperHistory=require(_0x0375('0x13'));var cmHopperBlack=require(_0x0375('0x14'));var voiceQueueRt=require(_0x0375('0x15'));var Action=require(_0x0375('0x16'));var History=require(_0x0375('0x17'));var Final=require(_0x0375('0x18'));var AgentComplete=require(_0x0375('0x19'));var QueueCallerAbandon=require(_0x0375('0x1a'));var Hangup=require('./hangup');var ipAgi=process[_0x0375('0x1b')]['XCALLY_IP_AGI']||_0x0375('0x1c');var strategy={'rrmemory':'rrmemory','roundrobin':_0x0375('0x1d')};var Sequence=function(){};Sequence['prototype'][_0x0375('0x1e')]=function(_0x3126f6){this[_0x0375('0x1f')]=this[_0x0375('0x1f')]?this[_0x0375('0x1f')][_0x0375('0x20')](_0x3126f6):_0x3126f6();};function Dialer(_0x3585a0,_0x94acd1){this[_0x0375('0x21')]=new Sequence();this['preview']=_0x94acd1;this['voiceQueues']=_0x3585a0['voiceQueues'];this[_0x0375('0x22')]=_0x3585a0['campaigns'];this['agents']=_0x3585a0[_0x0375('0x23')];this[_0x0375('0x24')]=_0x3585a0[_0x0375('0x24')];this['maxNumberOriginate']=config[_0x0375('0x25')]||0x2;this[_0x0375('0x26')]={};this['actions']={};this['contactsId']={};this['uniqueId']={};this[_0x0375('0x27')]={};this['startPredictive']={};this[_0x0375('0x28')]={};this[_0x0375('0x29')]={};this[_0x0375('0x2a')]={};this[_0x0375('0x2b')]={};ami['on'](_0x0375('0x2c'),this['syncAgentConnect'][_0x0375('0x2d')](this));ami['on'](_0x0375('0x2e'),this[_0x0375('0x2f')]['bind'](this));ami['on'](_0x0375('0x30'),this[_0x0375('0x31')][_0x0375('0x2d')](this));ami['on'](_0x0375('0x32'),this['syncAgentComplete'][_0x0375('0x2d')](this));ami['on'](_0x0375('0x33'),this['syncQueueSummary']['bind'](this));ami['on']('hangup',this['syncHangup'][_0x0375('0x2d')](this));ami['on'](_0x0375('0x34'),this[_0x0375('0x35')]['bind'](this));ami['on'](_0x0375('0x36'),this['syncVarSet'][_0x0375('0x2d')](this));ami['on'](_0x0375('0x37'),this[_0x0375('0x38')][_0x0375('0x2d')](this));ami['on'](_0x0375('0x39'),this[_0x0375('0x3a')][_0x0375('0x2d')](this));this['loopCampaigns']();this[_0x0375('0x3b')]();}function isNotNull(_0x3162d2){return _0x3162d2!==null&&!_['isUndefined'](_0x3162d2);}function checkIsLoggedIn(_0x17a4eb,_0x550de3){return function(){if(_0x550de3<=0x0){_0x17a4eb[_0x0375('0x3c')]=_0x0375('0x3d');throw _0x17a4eb['name']+_0x0375('0x3e');}};}function isActive(_0x226c7c){return _0x226c7c;}function checkIsActive(_0x5891c5,_0x502762){return function(){if(!isActive(_0x502762)){_0x5891c5[_0x0375('0x3c')]=_0x0375('0x3f');throw _0x5891c5[_0x0375('0x40')]+'\x20NOT\x20Active';}};}function checkInterval(_0x4d24be){return function(){if(!isNotNull(_0x4d24be[_0x0375('0x41')])){_0x4d24be[_0x0375('0x3c')]=_0x0375('0x42');throw _0x4d24be[_0x0375('0x40')]+_0x0375('0x43');}if(!isNotNull(_0x4d24be['Interval']['Intervals'])){_0x4d24be['message']='INTERVAL_IS_NULL';throw _0x4d24be['name']+_0x0375('0x43');}if(!isNotNull(_[_0x0375('0x44')](_0x4d24be[_0x0375('0x41')][_0x0375('0x45')]))){_0x4d24be[_0x0375('0x3c')]='INTERVAL_IS_NULL';throw _0x4d24be[_0x0375('0x40')]+_0x0375('0x43');}};}function msgResponse(_0x506832,_0x1e8473,_0x3c82c1){return{'action':_0x506832,'response':_0x1e8473,'message':_0x3c82c1,'stack':_0x3c82c1};}function myreject(_0x714dc9){return function(_0xc2c399){return _0x714dc9(msgResponse(_0x0375('0x46'),_0x0375('0x47'),JSON[_0x0375('0x48')](_0xc2c399)));};}function getSeconds(_0x1d552e,_0x4e0150){var _0x3adc51=moment(_0x1d552e)[_0x0375('0x49')](0x0);var _0x13f893=moment(_0x4e0150)[_0x0375('0x49')](0x0);return _0x3adc51[_0x0375('0x4a')](_0x13f893,_0x0375('0x4b'));}function emit(_0x586e11,_0x2536a0,_0x523097){io['to'](_0x586e11)['emit'](_0x2536a0,_0x523097);}function emitVoiceQueueSummary(_0x62ce0b){if(_0x62ce0b['type']===_0x0375('0x4c')){var _0x480cbb={'id':_0x62ce0b['id'],'name':_0x62ce0b[_0x0375('0x40')],'strategy':_0x62ce0b[_0x0375('0x4d')],'answered':_0x62ce0b['answered'],'available':_0x62ce0b['available'],'loggedIn':_0x62ce0b[_0x0375('0x4e')],'pTalking':_0x62ce0b[_0x0375('0x4f')],'sumBillable':_0x62ce0b[_0x0375('0x50')],'sumDuration':_0x62ce0b[_0x0375('0x51')],'sumHoldTime':_0x62ce0b[_0x0375('0x52')]||0x0,'talking':_0x62ce0b['talking'],'total':_0x62ce0b[_0x0375('0x53')],'type':_0x62ce0b[_0x0375('0x54')],'unmanaged':_0x62ce0b[_0x0375('0x55')],'abandoned':_0x62ce0b[_0x0375('0x56')],'waiting':_0x62ce0b[_0x0375('0x57')],'loggedInDb':_0x62ce0b[_0x0375('0x58')],'dialActive':_0x62ce0b[_0x0375('0x59')],'dialMethod':_0x62ce0b['dialMethod'],'dialOriginateCallerIdName':_0x62ce0b[_0x0375('0x5a')],'dialOriginateCallerIdNumber':_0x62ce0b[_0x0375('0x5b')],'dialOriginateTimeout':_0x62ce0b[_0x0375('0x5c')],'dialPrefix':_0x62ce0b['dialPrefix'],'outboundAnswerAgiCallsDay':_0x62ce0b[_0x0375('0x5d')],'outboundAnswerCallsDay':_0x62ce0b['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x62ce0b[_0x0375('0x5e')],'outboundBusyCallsDay':_0x62ce0b[_0x0375('0x5f')],'outboundCongestionCallsDay':_0x62ce0b[_0x0375('0x60')],'outboundDropCallsDayACS':_0x62ce0b['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x62ce0b[_0x0375('0x61')],'outboundDropCallsDayTimeout':_0x62ce0b[_0x0375('0x62')],'outboundNoAnswerCallsDay':_0x62ce0b[_0x0375('0x63')],'outboundNoSuchCallsDay':_0x62ce0b['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x62ce0b[_0x0375('0x64')],'outboundReCallsDay':_0x62ce0b[_0x0375('0x65')],'outboundRejectCallsDay':_0x62ce0b[_0x0375('0x66')],'outboundUnknownCallsDay':_0x62ce0b['outboundUnknownCallsDay'],'predictiveIntervalAnsweredCalls':_0x62ce0b[_0x0375('0x67')],'predictiveIntervalAvgHoldtime':_0x62ce0b['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x62ce0b[_0x0375('0x68')],'predictiveIntervalDroppedCallsCallersExit':_0x62ce0b[_0x0375('0x69')],'predictiveIntervalDroppedCallsTimeout':_0x62ce0b['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x62ce0b['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x62ce0b['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x62ce0b[_0x0375('0x6a')],'predictiveIntervalMultiplicativeFactor':_0x62ce0b[_0x0375('0x6b')],'predictiveIntervalPauses':_0x62ce0b[_0x0375('0x6c')],'predictiveIntervalAvailable':_0x62ce0b['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x62ce0b[_0x0375('0x6d')],'message':_0x62ce0b['message'],'originated':_0x62ce0b['originated'],'erlangCalls':_0x62ce0b[_0x0375('0x6e')],'erlangCallToSecond':_0x62ce0b['erlangCallToSecond'],'erlangAbandonmentRate':_0x62ce0b[_0x0375('0x6f')],'erlangBusyFactor':_0x62ce0b[_0x0375('0x70')],'startPredictive':_0x62ce0b[_0x0375('0x71')],'startProgressive':_0x62ce0b[_0x0375('0x28')]};if(_0x62ce0b[_0x0375('0x72')]){_0x480cbb['Trunk']={'id':_0x62ce0b[_0x0375('0x72')]['id'],'name':_0x62ce0b[_0x0375('0x72')][_0x0375('0x40')],'active':_0x62ce0b['Trunk'][_0x0375('0x73')],'callerid':_0x62ce0b[_0x0375('0x72')][_0x0375('0x74')]};}if(_0x62ce0b['Interval']){_0x480cbb['Interval']={'id':_0x62ce0b[_0x0375('0x41')]['id'],'name':_0x62ce0b[_0x0375('0x41')][_0x0375('0x40')]};}var _0x3360a4=md5(JSON[_0x0375('0x48')](_0x480cbb));if(_0x62ce0b[_0x0375('0x75')]!==_0x3360a4){_0x62ce0b[_0x0375('0x75')]=_0x3360a4;emit(util[_0x0375('0x76')](_0x0375('0x77'),_0x480cbb['name']),_0x0375('0x78'),_0x480cbb);}}}function emitCampaignSummary(_0x3008f3){if(_0x3008f3[_0x0375('0x54')]===_0x0375('0x79')){emit(util[_0x0375('0x76')](_0x0375('0x7a'),_0x3008f3[_0x0375('0x40')]),'campaign:save',_0x3008f3);}}function checkGetDataPredictive(_0x1e84c3){if(isNotNull(_0x1e84c3)&&!_['isEmpty'](_0x1e84c3)){loggerPredictive[_0x0375('0x7b')](_0x0375('0x7c'));loggerPredictive[_0x0375('0x7b')](_0x0375('0x7d'),_0x1e84c3[_0x0375('0x6d')]);loggerPredictive[_0x0375('0x7b')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e84c3['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x0375('0x7b')](_0x0375('0x7e'),_0x1e84c3[_0x0375('0x7f')]);loggerPredictive[_0x0375('0x7b')](_0x0375('0x80'),_0x1e84c3[_0x0375('0x69')]);loggerPredictive[_0x0375('0x7b')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e84c3[_0x0375('0x81')]);loggerPredictive[_0x0375('0x7b')](_0x0375('0x82'),_0x1e84c3[_0x0375('0x68')]);loggerPredictive[_0x0375('0x7b')](_0x0375('0x83'));if(_0x1e84c3[_0x0375('0x6d')]>0x0){if(!_[_0x0375('0x84')](_0x1e84c3[_0x0375('0x68')])&&_0x1e84c3[_0x0375('0x68')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_['isUndefined'](_0x1e84c3[_0x0375('0x81')])&&_0x1e84c3[_0x0375('0x81')]>0x0){return!![];}loggerPredictive[_0x0375('0x7b')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive['info'](_0x0375('0x85'));}}else{loggerPredictive[_0x0375('0x7b')](_0x0375('0x86'));}return![];}function mergeDataErlangB(_0x25e63b){return function(_0x2be455){loggerPredictive['info'](_0x0375('0x87'));loggerPredictive[_0x0375('0x7b')](_0x0375('0x88'),_0x2be455['erlangCalls']);loggerPredictive['info'](_0x0375('0x89'),_0x2be455[_0x0375('0x8a')]);loggerPredictive[_0x0375('0x7b')](_0x0375('0x8b'),_0x2be455[_0x0375('0x6f')]);loggerPredictive['info'](_0x0375('0x8c'),_0x2be455[_0x0375('0x70')]);loggerPredictive['info'](_0x0375('0x8b'),_0x2be455['erlangAbandonmentRate']);loggerPredictive[_0x0375('0x7b')](_0x0375('0x83'));_[_0x0375('0x8d')](_0x25e63b,_0x2be455);};}function getDiff(_0x1f527a){var _0x4b55ba=moment()[_0x0375('0x49')](0x0);var _0x295040=moment(_0x1f527a)[_0x0375('0x49')](0x0);return _0x4b55ba['diff'](_0x295040,_0x0375('0x4b'));}function ifInterval(_0x5bf49f,_0x1afa5b){if(_[_0x0375('0x84')](_0x1afa5b)){return![];}return getDiff(_0x1afa5b)<_0x5bf49f*0x3c;}function freeVariablesPredictive(_0x27806f){if(isNotNull(_0x27806f)){if(!_[_0x0375('0x84')](_0x27806f[_0x0375('0x28')])){_0x27806f['startProgressive']=undefined;loggerPredictive['info'](_0x27806f[_0x0375('0x40')],_0x0375('0x8e'));}if(!_[_0x0375('0x84')](_0x27806f[_0x0375('0x71')])){_0x27806f[_0x0375('0x71')]=undefined;loggerPredictive[_0x0375('0x7b')](_0x27806f[_0x0375('0x40')],'clearing\x20variable\x20start\x20predictive');}if(!_[_0x0375('0x84')](_0x27806f['handlePredictive'])){clearInterval(_0x27806f['handlePredictive']);_0x27806f[_0x0375('0x8f')]=undefined;loggerPredictive[_0x0375('0x7b')](_0x27806f[_0x0375('0x40')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x582885,_0x19610c){if(_0x19610c===0x0){return 0x0;}var _0x2226eb=0x1;for(var _0x33e84c=0x1;_0x33e84c<=_0x19610c;_0x33e84c+=0x1){_0x2226eb=0x1+_0x2226eb*_0x33e84c/_0x582885;}return 0x1/_0x2226eb;}function isVoiceQueueOutbound(_0x50c957){return _0x50c957===_0x0375('0x4c');}function isNotPreview(_0x4a5fc0){return _0x4a5fc0!==_0x0375('0x90');}function isCampaignIvr(_0x477605){return _0x477605===_0x0375('0x79');}function getCallerId(_0x3e98e9,_0x89f29e,_0x5d9483){if(!_[_0x0375('0x84')](_0x5d9483)&&typeof _0x5d9483==='string'&&!_[_0x0375('0x44')](_0x5d9483)){if(!_[_0x0375('0x84')](_0x89f29e)&&typeof _0x89f29e===_0x0375('0x91')&&!_[_0x0375('0x44')](_0x89f29e)){return util[_0x0375('0x76')](_0x0375('0x92'),_0x89f29e,_0x5d9483);}return util[_0x0375('0x76')](_0x0375('0x92'),_0x5d9483,_0x5d9483);}if(!_[_0x0375('0x84')](_0x3e98e9)&&typeof _0x3e98e9===_0x0375('0x91')&&!_[_0x0375('0x44')](_0x3e98e9)){return _0x3e98e9;}return _0x0375('0x93');}function loggerCatchQueueSummary(_0x570425,_0x5116c6){return function(_0x1c098a){freeVariablesPredictive(_0x5116c6);emitVoiceQueueSummary(_0x5116c6);emitCampaignSummary(_0x5116c6);loggerSyncQueueSummary[_0x0375('0x94')](_0x570425,util[_0x0375('0x95')](_0x1c098a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x11827a,_0x4a536a){return function(_0x455e){loggerPredictive['error'](_0x4a536a[_0x0375('0x40')],_0x11827a);loggerPredictive[_0x0375('0x94')](_0x455e['stack']);freeVariablesPredictive(_0x4a536a);};}function loggerCatch(_0x2f610d){return function(_0x438622){logger[_0x0375('0x94')](_0x2f610d,util[_0x0375('0x95')](_0x438622,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x5049c3){return _0x5049c3&&!_[_0x0375('0x84')](_0x5049c3)&&_0x5049c3[_0x0375('0x96')]>0x0;}function decremetOriginate(_0xdade95){if(!_[_0x0375('0x84')](_0xdade95)&&_0xdade95!==null){if(typeof _0xdade95[_0x0375('0x97')]!==_0x0375('0x98')){if(_0xdade95[_0x0375('0x97')]>0x0){_0xdade95[_0x0375('0x97')]-=0x1;}else{logger[_0x0375('0x94')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x0375('0x94')](_0x0375('0x99'));}}function checkContactLowerLimitOriginate(_0x40d223,_0x55440a,_0x7eb8e7){if(_0x55440a>_0x7eb8e7){for(var _0x1848d9=0x0;_0x1848d9<_0x55440a-_0x7eb8e7;_0x1848d9+=0x1){decremetOriginate(_0x40d223);}}}function loggerGetContactDialer(_0x1d4229,_0x278783,_0x54decb){return function(_0x5778b3){checkContactLowerLimitOriginate(_0x278783,_0x54decb,0x0);logger[_0x0375('0x94')](_0x1d4229,util[_0x0375('0x95')](_0x5778b3,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x60297f){return function(_0x28cf3b){if(isNotNull(_0x28cf3b)&&isNotNull(_0x28cf3b[0x0])){if(_0x28cf3b[0x0][_0x0375('0x9a')]>0x0){_0x60297f['message']=_0x0375('0x9b');logger[_0x0375('0x7b')](_0x0375('0x9c')+_0x60297f[_0x0375('0x40')],_0x28cf3b[0x0][_0x0375('0x9a')],'contacts');}else{_0x60297f[_0x0375('0x3c')]=_0x0375('0x9d');logger[_0x0375('0x7b')]('[getContactDialer2][Empty]'+_0x60297f[_0x0375('0x40')]);}}};}function notSendMessagesQueue(_0x266123){if(_0x266123[_0x0375('0x9e')]){freeVariablesPredictive(_0x266123);if(_0x266123['originated']===0x0&&_0x266123[_0x0375('0x9f')]===0x0&&_0x266123[_0x0375('0x57')]===0x0&&(_0x266123[_0x0375('0x4f')]||0x0)===0x0){_0x266123[_0x0375('0x9e')]=![];_0x266123[_0x0375('0xa0')]=0x0;_0x266123[_0x0375('0x3c')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x0375('0x94')](_0x0375('0xa1'),_0x266123[_0x0375('0x40')],'is\x20not\x20active');}else{_0x266123[_0x0375('0x3c')]=_0x0375('0xa2');loggerSyncQueueSummary['error'](_0x0375('0xa1'),_0x266123[_0x0375('0x40')],_0x0375('0xa3'));}emitVoiceQueueSummary(_0x266123);}}function notSendMessagesCampaign(_0x41a905){if(_0x41a905[_0x0375('0x9e')]){if(_0x41a905[_0x0375('0x97')]===0x0){_0x41a905[_0x0375('0x9e')]=![];_0x41a905[_0x0375('0x3c')]=_0x0375('0x3f');loggerSyncQueueSummary['error'](_0x0375('0xa4'),_0x41a905['name'],_0x0375('0xa5'));}else{_0x41a905[_0x0375('0x3c')]='IS_DISACTIVED';loggerSyncQueueSummary[_0x0375('0x94')](_0x0375('0xa4'),_0x41a905[_0x0375('0x40')],_0x0375('0xa3'));}emitCampaignSummary(_0x41a905);}}function createObjHistory(_0x15cea3,_0x2b89a7,_0x588fce,_0xbe8f3f,_0x47310d){_0x15cea3[_0x0375('0x3c')]=_0x588fce;var _0x244fb1=new Action(_0x15cea3,_0x2b89a7);var _0x50fbfb=new History(_0x244fb1);_0x50fbfb[_0x0375('0xa6')]=_0xbe8f3f;_0x50fbfb['statedesc']=_0x47310d;_0x50fbfb['endtime']=_0x244fb1[_0x0375('0xa7')];return _0x50fbfb;}Dialer[_0x0375('0xa8')][_0x0375('0x3b')]=function(){var _0x6baa39=this;setInterval(function(){_0x6baa39[_0x0375('0xa9')](_0x6baa39[_0x0375('0xaa')],_0x0375('0xab'));_0x6baa39[_0x0375('0xa9')](_0x6baa39[_0x0375('0xac')],_0x0375('0xad'));},0x32c8);};Dialer[_0x0375('0xa8')]['clearZombieChannels']=function(_0x5c17fb,_0x4157d){var _0x3a9e75=this;for(var _0x4daf0d in _0x5c17fb){if(typeof _0x5c17fb[_0x4daf0d]!==_0x0375('0x98')){this[_0x0375('0x21')][_0x0375('0x1e')](function(){if(!_['isNil'](_0x5c17fb[_0x4daf0d])){return ami[_0x0375('0xae')]({'action':_0x0375('0xaf'),'channel':_0x5c17fb[_0x4daf0d]['channel']})[_0x0375('0xb0')](function(_0x7adfc8){if(_0x7adfc8[_0x0375('0x3c')]===_0x0375('0xb1')){setTimeout(function(){if(_0x5c17fb[_0x4daf0d]&&_0x5c17fb[_0x4daf0d][_0x0375('0x54')]!=='ivr'){_0x3a9e75[_0x0375('0xb2')](_0x3a9e75[_0x0375('0xb3')][_0x5c17fb[_0x4daf0d][_0x0375('0xb4')]]);logger[_0x0375('0x94')](_0x0375('0xb5'),_0x4157d,_0x4daf0d,_0x5c17fb[_0x4daf0d][_0x0375('0xb4')]);delete _0x5c17fb[_0x4daf0d];}if(_0x5c17fb[_0x4daf0d]&&_0x5c17fb[_0x4daf0d][_0x0375('0x54')]===_0x0375('0x79')){_0x3a9e75[_0x0375('0xb2')](_0x3a9e75[_0x0375('0x22')][_0x5c17fb[_0x4daf0d]['queue']]);logger['error'](_0x0375('0xb6'),_0x4157d,_0x4daf0d,_0x5c17fb[_0x4daf0d][_0x0375('0xb4')]);delete _0x5c17fb[_0x4daf0d];}},0x2328);}});}});}}};Dialer[_0x0375('0xa8')][_0x0375('0xb7')]=function(_0x365d53){return BPromise[_0x0375('0xb8')]()[_0x0375('0xb9')](cmHopper['countReScheduled'](_0x365d53))[_0x0375('0xb0')](loggerCatch(_0x0375('0xba')));};Dialer[_0x0375('0xa8')][_0x0375('0xbb')]=function(_0x562ce1){return BPromise[_0x0375('0xb8')]()[_0x0375('0xb9')](cmHopperBlack[_0x0375('0xbb')](_0x562ce1))[_0x0375('0xb0')](loggerCatch(_0x0375('0xbc')));};Dialer[_0x0375('0xa8')][_0x0375('0xbd')]=function(_0x2aae3a){return BPromise[_0x0375('0xb8')]()['then'](cmHopperBlack[_0x0375('0xbd')](_0x2aae3a))[_0x0375('0xb0')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0x0375('0xa8')][_0x0375('0xbe')]=function(_0x56abdb){return BPromise[_0x0375('0xb8')]()['then'](cmHopperHistory[_0x0375('0xbf')](_0x56abdb))[_0x0375('0xb0')](loggerCatch(_0x0375('0xc0')));};Dialer[_0x0375('0xa8')]['rescheduleContact']=function(_0x58cd94){return BPromise['resolve']()[_0x0375('0xb9')](cmHopper[_0x0375('0xc1')](_0x58cd94))[_0x0375('0xb0')](loggerCatch(_0x0375('0xc2')));};Dialer[_0x0375('0xa8')]['unlockContact']=function(_0x1c72df,_0x55302b,_0x2d98d1){return BPromise[_0x0375('0xb8')]()[_0x0375('0xb9')](cmHopper['unlockContact'](_0x1c72df,_0x55302b,_0x2d98d1))[_0x0375('0xb0')](loggerCatch(_0x0375('0xc3')));};Dialer[_0x0375('0xa8')][_0x0375('0xc4')]=function(_0x4e5b3b,_0x3a8dc1,_0x104b43,_0x2a13ab,_0x4a180d){return BPromise['resolve']()[_0x0375('0xb9')](cmHopper[_0x0375('0xc4')](_0x4e5b3b,_0x3a8dc1,_0x104b43,_0x2a13ab))['catch'](function(_0x8c9b15){_0x4a180d[_0x0375('0xc5')]-=_0x104b43;_0x4a180d[_0x0375('0xc5')]=_0x4a180d['temp']>0x0?_0x4a180d[_0x0375('0xc5')]:0x0;loggerCatch(_0x0375('0xc6'))(_0x8c9b15);});};Dialer[_0x0375('0xa8')]['getContactDialerIvr']=function(_0x316e80,_0x3ebe46,_0x3846e4,_0x596b8b){return BPromise['resolve']()['then'](cmHopper[_0x0375('0xc7')](_0x316e80,_0x3ebe46,_0x3846e4))[_0x0375('0xb0')](function(_0x4994a2){_0x596b8b[_0x0375('0xc5')]-=_0x3ebe46;_0x596b8b['temp']=_0x596b8b['temp']>0x0?_0x596b8b['temp']:0x0;loggerCatch(_0x0375('0xc8'))(_0x4994a2);});};Dialer['prototype'][_0x0375('0xc9')]=function(_0x1badc6){return BPromise[_0x0375('0xb8')]()[_0x0375('0xb9')](voiceQueueRt[_0x0375('0xc9')](_0x1badc6))[_0x0375('0xb0')](loggerCatch(_0x0375('0xca')));};Dialer[_0x0375('0xa8')][_0x0375('0xcb')]=function(_0x52f6de){return BPromise[_0x0375('0xb8')]()[_0x0375('0xb9')](cmHopper[_0x0375('0xcb')](_0x52f6de))[_0x0375('0xb0')](loggerCatch(_0x0375('0xcc')));};Dialer[_0x0375('0xa8')][_0x0375('0xcd')]=function(_0x10316f){return BPromise[_0x0375('0xb8')]()[_0x0375('0xb9')](cmHopperHistory[_0x0375('0xcd')](_0x10316f))[_0x0375('0xb0')](loggerCatch(_0x0375('0xce')));};Dialer['prototype'][_0x0375('0xb2')]=function(_0x3e696c){if(!_[_0x0375('0x84')](_0x3e696c)&&_0x3e696c!==null){if(typeof _0x3e696c['originated']!==_0x0375('0x98')){if(_0x3e696c[_0x0375('0x97')]>0x0){_0x3e696c[_0x0375('0x97')]-=0x1;}else{logger[_0x0375('0x94')](_0x0375('0xcf'));}}}else{logger[_0x0375('0x94')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x0375('0xa8')][_0x0375('0xd0')]=function(_0x3233e4,_0x58af24){var _0x12a1e2=this;return function(_0x207e49){_0x12a1e2[_0x0375('0xb2')](_0x58af24);logger[_0x0375('0x94')](_0x3233e4,util[_0x0375('0x95')](_0x207e49,{'showHidden':![],'depth':null}));};};Dialer[_0x0375('0xa8')][_0x0375('0xd1')]=function(_0x134c28,_0x59cbec,_0x375b6a){var _0x315d6d={'state':0x19,'statedesc':_0x0375('0xd2')};this[_0x0375('0xb2')](_0x59cbec);this[_0x0375('0xd3')](_['merge'](_0x315d6d,_[_0x0375('0xd4')](_0x375b6a,['ContactId',_0x0375('0xd5'),'UserId','VoiceQueueId',_0x0375('0xd6')])),_0x0375('0xd7'),_0x0375('0xd8'));logger[_0x0375('0x94')](_0x134c28);};Dialer[_0x0375('0xa8')]['isSuccess']=function(_0x6b827b){return _0x6b827b===_0x0375('0xd9');};Dialer[_0x0375('0xa8')]['isTrunkReachable']=function(_0x3bad9b){return!_[_0x0375('0x84')](_0x3bad9b)&&_0x3bad9b&&!_[_0x0375('0x84')](_0x3bad9b[_0x0375('0x40')])&&!_[_0x0375('0x84')](_0x3bad9b[_0x0375('0x73')])&&_0x3bad9b[_0x0375('0x73')]&&(this[_0x0375('0x24')][util[_0x0375('0x76')]('SIP/%s',_0x3bad9b[_0x0375('0x40')])][_0x0375('0xaf')]==='reachable'||this['trunks'][util[_0x0375('0x76')](_0x0375('0xda'),_0x3bad9b[_0x0375('0x40')])][_0x0375('0xaf')]===_0x0375('0xdb'));};Dialer['prototype'][_0x0375('0xd3')]=function(_0x10d62c,_0x4696b9,_0x591506){this[_0x0375('0xcd')](_0x10d62c)[_0x0375('0xb0')](loggerCatch(_0x4696b9));this[_0x0375('0xcb')](_0x10d62c)[_0x0375('0xb0')](loggerCatch(_0x591506));};Dialer['prototype'][_0x0375('0xdc')]=function(_0x1fb524){var _0xd9bdf9=this['uniqueId'][_0x1fb524[_0x0375('0xdd')]];var _0x160a6c;if(!_[_0x0375('0xde')](_0x1fb524)&&!_[_0x0375('0xde')](_0x1fb524[_0x0375('0xdf')])&&!_['isNil'](_0x1fb524['variable'][_0x0375('0xe0')])&&_0x1fb524['exten']===_0x0375('0xe1')&&_0xd9bdf9){if(_0xd9bdf9[_0x0375('0x54')]!==_0x0375('0x79')&&this[_0x0375('0xb3')][_0xd9bdf9[_0x0375('0xb4')]][_0x0375('0xe2')]&&_0x1fb524[_0x0375('0xe3')]===_0x0375('0xe4')){delete this[_0x0375('0xaa')][_0x1fb524[_0x0375('0xdd')]];this[_0x0375('0xb2')](this[_0x0375('0xb3')][_0xd9bdf9[_0x0375('0xb4')]]);this['voiceQueues'][_0xd9bdf9['queue']][_0x0375('0xe5')]+=0x1;this[_0x0375('0xb3')][_0xd9bdf9[_0x0375('0xb4')]][_0x0375('0x5d')]+=0x1;_0x160a6c=new Hangup(_0xd9bdf9,_0x1fb524);_0x160a6c[_0x0375('0xa6')]=0x12;_0x160a6c['statedesc']=_0x0375('0xe6');_0x160a6c[_0x0375('0xe7')]='AMD';ami[_0x0375('0xe8')](_0x0375('0xe9'),ut[_0x0375('0xea')](_0x160a6c,_0x0375('0xeb')));this[_0x0375('0xd3')](_0x160a6c,'[syncHangupInAMD][createHistory]',_0x0375('0xec'));}if(_0xd9bdf9[_0x0375('0x54')]!==_0x0375('0x79')&&this[_0x0375('0xb3')][_0xd9bdf9['queue']]['dialAMDActive']&&_0x1fb524[_0x0375('0xe3')]===_0x0375('0xed')){var _0x33304a=this;return new BPromise(function(_0x28a440,_0x28d4db){delete _0x33304a[_0x0375('0xaa')][_0x1fb524[_0x0375('0xdd')]];_0x33304a[_0x0375('0xb2')](_0x33304a[_0x0375('0xb3')][_0xd9bdf9[_0x0375('0xb4')]]);_0x33304a[_0x0375('0xb3')][_0xd9bdf9[_0x0375('0xb4')]][_0x0375('0xe5')]+=0x1;_0x33304a['voiceQueues'][_0xd9bdf9['queue']][_0x0375('0x5d')]+=0x1;var _0x2fd517=_0x33304a[_0x0375('0xb3')][_0xd9bdf9[_0x0375('0xb4')]];var _0x14c3b7=new Hangup(_0xd9bdf9,_0x1fb524);_0x14c3b7[_0x0375('0xa6')]=0x13;_0x14c3b7[_0x0375('0xee')]=_0x0375('0xef');_0x14c3b7[_0x0375('0xe7')]=_0x0375('0xf0');_0x14c3b7[_0x0375('0xf1')]+=0x1;_0x14c3b7[_0x0375('0xf2')]+=0x1;_0x14c3b7[_0x0375('0xeb')]=!![];ami[_0x0375('0xe8')](_0x0375('0xe9'),ut['buildObj'](_0x14c3b7,_0x0375('0xeb')));_0x33304a[_0x0375('0xcd')](_0x14c3b7)[_0x0375('0xb0')](loggerCatch(_0x0375('0xf3')));if(_0x14c3b7[_0x0375('0xf4')]+_0x14c3b7[_0x0375('0xf5')]+_0x14c3b7[_0x0375('0xf6')]+_0x14c3b7[_0x0375('0xf7')]+_0x14c3b7[_0x0375('0xf8')]+_0x14c3b7['countabandonedretry']+_0x14c3b7['countmachineretry']+_0x14c3b7[_0x0375('0xf9')]>=_0x2fd517[_0x0375('0xfa')]){_0x33304a['stateGlobal'](_0x14c3b7,_0x28a440,_0x28d4db,'reason19\x20machine....');}else{if(_0x14c3b7[_0x0375('0xf1')]>=_0x2fd517[_0x0375('0xfb')]){_0x33304a['createStateFinal'](_0x14c3b7,_0x28a440,_0x28d4db,_0x0375('0xfc'));}else{_0x33304a[_0x0375('0xc1')]({'active':![],'countmachineretry':_0x14c3b7[_0x0375('0xf1')],'scheduledat':moment()['add'](_0x2fd517[_0x0375('0xfd')],_0x0375('0xfe'))[_0x0375('0x76')](_0x0375('0xff')),'ContactId':_0x14c3b7[_0x0375('0x100')],'ListId':_0x14c3b7[_0x0375('0xd5')],'VoiceQueueId':_0x14c3b7[_0x0375('0x101')]||undefined,'CampaignId':_0x14c3b7[_0x0375('0xd6')]||undefined})[_0x0375('0xb0')](loggerCatch(_0x0375('0x102')));_0x28a440({'reschedule':0x1});}}});}if(_0xd9bdf9[_0x0375('0x54')]==='ivr'&&this[_0x0375('0x22')][_0xd9bdf9['queue']][_0x0375('0xe2')]&&_0x1fb524[_0x0375('0xe3')]===_0x0375('0xe4')){delete this['uniqueId'][_0x1fb524[_0x0375('0xdd')]];this['updateOriginated'](this[_0x0375('0x22')][_0xd9bdf9['queue']]);_0x160a6c=new Hangup(_0xd9bdf9,_0x1fb524);_0x160a6c[_0x0375('0xa6')]=0x12;_0x160a6c[_0x0375('0xee')]=_0x0375('0xe6');_0x160a6c[_0x0375('0xe7')]=_0x0375('0xf0');ami[_0x0375('0xe8')](_0x0375('0xe9'),ut[_0x0375('0xea')](_0x160a6c,'amd'));this[_0x0375('0xd3')](_0x160a6c,_0x0375('0x103'),_0x0375('0x104'));}if(_0xd9bdf9['type']===_0x0375('0x79')&&this[_0x0375('0x22')][_0xd9bdf9['queue']]['dialAMDActive']&&_0x1fb524[_0x0375('0xe3')]===_0x0375('0xed')){var _0x33304a=this;return new BPromise(function(_0x54267f,_0x1bbe44){delete _0x33304a[_0x0375('0xaa')][_0x1fb524['uniqueid']];_0x33304a[_0x0375('0xb2')](_0x33304a[_0x0375('0x22')][_0xd9bdf9['queue']]);_0x33304a['campaigns'][_0xd9bdf9[_0x0375('0xb4')]][_0x0375('0xe5')]+=0x1;_0x33304a[_0x0375('0x22')][_0xd9bdf9[_0x0375('0xb4')]][_0x0375('0x5d')]+=0x1;var _0x42d39c=_0x33304a[_0x0375('0x22')][_0xd9bdf9['queue']];var _0x4fef39=new Hangup(_0xd9bdf9,_0x1fb524);_0x4fef39[_0x0375('0xa6')]=0x13;_0x4fef39[_0x0375('0xee')]=_0x0375('0xef');_0x4fef39[_0x0375('0xe7')]='AMD';_0x4fef39[_0x0375('0xf1')]+=0x1;_0x4fef39[_0x0375('0xf2')]+=0x1;_0x4fef39['amd']=!![];ami[_0x0375('0xe8')](_0x0375('0xe9'),ut[_0x0375('0xea')](_0x4fef39,_0x0375('0xeb')));_0x33304a[_0x0375('0xcd')](_0x4fef39)[_0x0375('0xb0')](loggerCatch(_0x0375('0xf3')));if(_0x4fef39[_0x0375('0xf4')]+_0x4fef39[_0x0375('0xf5')]+_0x4fef39[_0x0375('0xf6')]+_0x4fef39[_0x0375('0xf7')]+_0x4fef39[_0x0375('0xf8')]+_0x4fef39['countabandonedretry']+_0x4fef39['countmachineretry']+_0x4fef39[_0x0375('0xf9')]>=_0x42d39c[_0x0375('0xfa')]){_0x33304a[_0x0375('0x105')](_0x4fef39,_0x54267f,_0x1bbe44,_0x0375('0x106'));}else{if(_0x4fef39['countmachineretry']>=_0x42d39c[_0x0375('0xfb')]){_0x33304a['createStateFinal'](_0x4fef39,_0x54267f,_0x1bbe44,_0x0375('0xfc'));}else{_0x33304a['rescheduleContact']({'active':![],'countmachineretry':_0x4fef39[_0x0375('0xf1')],'scheduledat':moment()['add'](_0x42d39c['dialMachineRetryFrequency'],_0x0375('0xfe'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4fef39[_0x0375('0x100')],'ListId':_0x4fef39[_0x0375('0xd5')],'VoiceQueueId':_0x4fef39[_0x0375('0x101')]||undefined,'CampaignId':_0x4fef39['CampaignId']||undefined})['catch'](loggerCatch(_0x0375('0x102')));_0x54267f({'reschedule':0x1});}}});}}};Dialer[_0x0375('0xa8')][_0x0375('0x107')]=function(_0x3c1745){var _0x5d493a=this[_0x0375('0xaa')][_0x3c1745[_0x0375('0xdd')]];var _0x68574d=this;var _0x19e744;if(_0x5d493a&&_0x5d493a[_0x0375('0x54')]==='ivr'){delete this[_0x0375('0xaa')][_0x3c1745[_0x0375('0xdd')]];this[_0x0375('0xb2')](this[_0x0375('0x22')][_0x5d493a[_0x0375('0xb4')]]);this[_0x0375('0x22')][_0x5d493a['queue']][_0x0375('0x108')]+=0x1;_0x19e744=new Hangup(_0x5d493a,_0x3c1745);this[_0x0375('0xcd')](_0x19e744)[_0x0375('0xb0')](loggerCatch(_0x0375('0x109')));this[_0x0375('0xcb')](_0x19e744)[_0x0375('0xb0')](loggerCatch('[syncHangupIvr]'));}if(_0x5d493a&&_0x5d493a['type']!==_0x0375('0x79')&&isNotNull(this['voiceQueues'][_0x5d493a[_0x0375('0xb4')]][_0x0375('0x10a')])){delete this[_0x0375('0xaa')][_0x3c1745[_0x0375('0xdd')]];this['updateOriginated'](this[_0x0375('0xb3')][_0x5d493a[_0x0375('0xb4')]]);this[_0x0375('0xb3')][_0x5d493a[_0x0375('0xb4')]][_0x0375('0xe5')]+=0x1;this[_0x0375('0xb3')][_0x5d493a['queue']][_0x0375('0x5d')]+=0x1;_0x19e744=new Hangup(_0x5d493a,_0x3c1745);_0x19e744['state']=0x10;_0x19e744[_0x0375('0xee')]=_0x0375('0x10b');_0x19e744[_0x0375('0xe7')]=_0x0375('0x10c');this[_0x0375('0xcd')](_0x19e744)[_0x0375('0xb0')](loggerCatch(_0x0375('0x109')));this['moveContactManagedDialer'](_0x19e744)[_0x0375('0xb0')](loggerCatch('[syncHangupIvr]'));}if(_0x5d493a&&_0x5d493a[_0x0375('0x54')]!==_0x0375('0x79')&&!isNotNull(this[_0x0375('0xb3')][_0x5d493a[_0x0375('0xb4')]]['dialQueueProject'])){delete this[_0x0375('0xaa')][_0x3c1745[_0x0375('0xdd')]];this[_0x0375('0xb2')](this['voiceQueues'][_0x5d493a[_0x0375('0xb4')]]);this[_0x0375('0xb3')][_0x5d493a['queue']][_0x0375('0x10d')]+=0x1;_0x19e744=new Hangup(_0x5d493a,_0x3c1745);_0x19e744[_0x0375('0xa6')]=0xc;_0x19e744['statedesc']=_0x3c1745[_0x0375('0x10e')];_0x19e744[_0x0375('0xe7')]=_0x0375('0x10f');this[_0x0375('0xcd')](_0x19e744)[_0x0375('0xb0')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x0375('0xcb')](_0x19e744)[_0x0375('0xb0')](loggerCatch(_0x0375('0x110')));}};Dialer[_0x0375('0xa8')][_0x0375('0x111')]=function(_0x77c560){var _0x4f896f=this['uniqueId'][_0x77c560[_0x0375('0xdd')]];var _0x43fac4=this;if(this[_0x0375('0xb3')][_0x77c560[_0x0375('0xb4')]]){if(_0x4f896f&&_0x4f896f['type']!==_0x0375('0x79')){delete this[_0x0375('0xaa')][_0x77c560[_0x0375('0xdd')]];this[_0x0375('0xb3')][_0x77c560['queue']]['outboundAnswerCallsDay']+=0x1;var _0x3319e0=new AgentComplete(_0x4f896f,_0x77c560);if(_0x77c560[_0x0375('0x112')]===_0x0375('0x113')){_0x3319e0[_0x0375('0x114')]=this[_0x0375('0xb3')][_0x77c560[_0x0375('0xb4')]][_0x0375('0x115')]&&this[_0x0375('0xb3')][_0x77c560[_0x0375('0xb4')]][_0x0375('0x116')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x0375('0xcd')](_0x3319e0)['catch'](loggerCatch(_0x0375('0x117')));this[_0x0375('0xcb')](_0x3319e0)[_0x0375('0xb0')](loggerCatch(_0x0375('0x118')));}}};Dialer['prototype']['syncAgentConnect']=function(_0x1713a5){if(this[_0x0375('0xb3')][_0x1713a5[_0x0375('0xb4')]]){if(this['uniqueId'][_0x1713a5[_0x0375('0xdd')]]&&this[_0x0375('0xaa')][_0x1713a5['uniqueid']][_0x0375('0x54')]!==_0x0375('0x79')){this['updateOriginated'](this['voiceQueues'][_0x1713a5['queue']]);this[_0x0375('0xaa')][_0x1713a5[_0x0375('0xdd')]]['answertime']=moment()[_0x0375('0x76')](_0x0375('0xff'));}}};Dialer[_0x0375('0xa8')][_0x0375('0x119')]=function(_0x573898){this[_0x0375('0xcd')](_0x573898)[_0x0375('0xb0')](loggerCatch(_0x0375('0x117')));this[_0x0375('0xcb')](_0x573898)['catch'](loggerCatch(_0x0375('0x11a')));};Dialer[_0x0375('0xa8')][_0x0375('0x2f')]=function(_0x4067e4){var _0x47817f=this[_0x0375('0xaa')][_0x4067e4[_0x0375('0xdd')]];var _0xfaf673=this;if(this[_0x0375('0xb3')][_0x4067e4['queue']]){if(_0x47817f&&_0x47817f['type']!==_0x0375('0x79')){delete this[_0x0375('0xaa')][_0x4067e4['uniqueid']];this[_0x0375('0xb2')](this[_0x0375('0xb3')][_0x4067e4['queue']]);_0x47817f[_0x0375('0x11b')]=moment()['format'](_0x0375('0xff'));var _0x59f903=new QueueCallerAbandon(_0x47817f,_0x4067e4);if(getSeconds(_0x47817f[_0x0375('0x11b')],_0x47817f[_0x0375('0x11c')])>=_0x47817f['dialQueueTimeout']){this['voiceQueues'][_0x4067e4[_0x0375('0xb4')]][_0x0375('0x7f')]+=0x1;this[_0x0375('0xb3')][_0x4067e4[_0x0375('0xb4')]][_0x0375('0x62')]+=0x1;this[_0x0375('0xb3')][_0x4067e4[_0x0375('0xb4')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x59f903['state']=0xa;_0x59f903[_0x0375('0xee')]=_0x0375('0x11d');_0x59f903[_0x0375('0x11e')]=_0x0375('0x11f');_0x59f903[_0x0375('0x114')]=this[_0x0375('0xb3')][_0x4067e4[_0x0375('0xb4')]][_0x0375('0x115')]?moment()[_0x0375('0x76')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x59f903[_0x0375('0xf8')]+=0x1;_0x59f903['countglobal']+=0x1;if(_0x59f903[_0x0375('0xf8')]>=this[_0x0375('0xb3')][_0x4067e4[_0x0375('0xb4')]][_0x0375('0x120')]){this['queueCallerAbandonCreateState'](_0x59f903);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x59f903[_0x0375('0xf8')],'scheduledat':moment()['add'](this['voiceQueues'][_0x4067e4['queue']][_0x0375('0x121')],_0x0375('0xfe'))[_0x0375('0x76')](_0x0375('0xff')),'ContactId':_0x47817f[_0x0375('0x100')],'ListId':_0x47817f[_0x0375('0xd5')],'VoiceQueueId':_0x47817f[_0x0375('0x101')]||undefined,'CampaignId':_0x47817f['CampaignId']||undefined})['catch'](loggerCatch(_0x0375('0x122')));var _0x20758e=new History(_0x59f903);_0x20758e[_0x0375('0xa6')]=0xa;_0x20758e[_0x0375('0xee')]=_0x0375('0x11d');_0x20758e['starttime']=moment()[_0x0375('0x76')]('YYYY-MM-DD\x20HH:mm:ss');_0x20758e[_0x0375('0x123')]=_0x20758e[_0x0375('0xa7')];_0x20758e[_0x0375('0x124')]=_0x59f903[_0x0375('0x124')];_0x20758e[_0x0375('0x125')]=_0x59f903['calleridnum'];this[_0x0375('0xcd')](_0x20758e)[_0x0375('0xb0')](loggerCatch(_0x0375('0x126')));}}else{this[_0x0375('0xb3')][_0x4067e4[_0x0375('0xb4')]][_0x0375('0x69')]+=0x1;this[_0x0375('0xb3')][_0x4067e4['queue']][_0x0375('0x61')]+=0x1;_0x59f903[_0x0375('0xa6')]=0xb;_0x59f903[_0x0375('0xee')]=_0x0375('0x127');_0x59f903[_0x0375('0x11e')]='CALLEREXIT';_0x59f903['countabandonedretry']+=0x1;_0x59f903[_0x0375('0xf2')]+=0x1;if(_0x59f903[_0x0375('0x128')]>=this[_0x0375('0xb3')][_0x4067e4[_0x0375('0xb4')]]['dialAbandonedMaxRetry']){this[_0x0375('0x119')](_0x59f903);}else{this[_0x0375('0xc1')]({'active':![],'countabandonedretry':_0x59f903[_0x0375('0x128')],'scheduledat':moment()[_0x0375('0x129')](this['voiceQueues'][_0x4067e4[_0x0375('0xb4')]][_0x0375('0x12a')],'minutes')[_0x0375('0x76')](_0x0375('0xff')),'ContactId':_0x47817f[_0x0375('0x100')],'ListId':_0x47817f[_0x0375('0xd5')],'VoiceQueueId':_0x47817f[_0x0375('0x101')]||undefined,'CampaignId':_0x47817f[_0x0375('0xd6')]||undefined})[_0x0375('0xb0')](loggerCatch(_0x0375('0x12b')));var _0x20758e=new History(_0x59f903);_0x20758e[_0x0375('0xa6')]=0xb;_0x20758e['statedesc']='Abandoned';_0x20758e[_0x0375('0xa7')]=moment()[_0x0375('0x76')](_0x0375('0xff'));_0x20758e['endtime']=_0x20758e[_0x0375('0xa7')];_0x20758e['calleridname']=_0x59f903['calleridname'];_0x20758e[_0x0375('0x125')]=_0x59f903[_0x0375('0x125')];this[_0x0375('0xcd')](_0x20758e)[_0x0375('0xb0')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0x0375('0xa8')][_0x0375('0x35')]=function(_0x517d05){if(this['actions'][_0x517d05[_0x0375('0xdd')]]){this['actions'][_0x517d05[_0x0375('0xdd')]][_0x0375('0x12c')]=_0x517d05['channel'];}if(this[_0x0375('0xaa')][_0x517d05['uniqueid']]){this[_0x0375('0xaa')][_0x517d05[_0x0375('0xdd')]][_0x0375('0x12c')]=_0x517d05[_0x0375('0x12c')];}};Dialer[_0x0375('0xa8')][_0x0375('0x38')]=function(_0x37a0e0){if(strategy[this[_0x0375('0xb3')][this[_0x0375('0xac')][_0x37a0e0[_0x0375('0x12d')]][_0x0375('0xb4')]][_0x0375('0x4d')]]===_0x0375('0x1d')){if(this[_0x0375('0xac')][_0x37a0e0[_0x0375('0x12d')]]&&_[_0x0375('0xde')](this[_0x0375('0xac')][_0x37a0e0[_0x0375('0x12d')]]['locked'])&&_0x37a0e0[_0x0375('0xaf')]==='1'&&_0x37a0e0[_0x0375('0x12e')]==='0'){if(this[_0x0375('0x23')][_0x37a0e0[_0x0375('0x12f')]]){if(!this[_0x0375('0x23')][_0x37a0e0[_0x0375('0x12f')]][_0x0375('0x130')]){this[_0x0375('0x23')][_0x37a0e0['stateinterface']][_0x0375('0x130')]=!![];this[_0x0375('0xac')][_0x37a0e0[_0x0375('0x12d')]][_0x0375('0x130')]=!![];this[_0x0375('0xac')][_0x37a0e0[_0x0375('0x12d')]]['stateinterface']=_0x37a0e0[_0x0375('0x12f')];}}}}else if((strategy[this[_0x0375('0xb3')][this[_0x0375('0xac')][_0x37a0e0['actionid']]['queue']][_0x0375('0x4d')]]||_0x0375('0x131'))==='rrmemory'){if(this[_0x0375('0xac')][_0x37a0e0[_0x0375('0x12d')]]){if(this['agents'][_0x37a0e0[_0x0375('0x12f')]]){this[_0x0375('0xac')][_0x37a0e0[_0x0375('0x12d')]][_0x0375('0x12f')]=_0x37a0e0[_0x0375('0x12f')];if(_['isNil'](this[_0x0375('0x2a')][this[_0x0375('0xac')][_0x37a0e0['actionid']]['queue']])){this['queueBooked'][this[_0x0375('0xac')][_0x37a0e0['actionid']][_0x0375('0xb4')]]=[];}this[_0x0375('0x2a')][this['actions'][_0x37a0e0[_0x0375('0x12d')]]['queue']][_0x0375('0x132')](_['merge'](_[_0x0375('0xd4')](this['actions'][_0x37a0e0['actionid']],[_0x0375('0x133'),_0x0375('0x12f')]),{'status':_0x37a0e0['status'],'paused':_0x37a0e0['paused']}));}}}};function unlockQueueStatus(_0x238592,_0x3fc2e3){setTimeout(function(){if(_[_0x0375('0x84')](_0x238592[_0x0375('0x134')])){loggerBooked['error'](_0x0375('0x135'),_0x3fc2e3);}_0x238592[_0x0375('0x134')]=!![];loggerBooked[_0x0375('0x7b')]('[booked][unlockQueueStatus]',_0x3fc2e3,JSON['stringify'](_['pick'](_0x238592,[_0x0375('0x40'),_0x0375('0x134')])));},0x1f3);}Dialer['prototype']['syncQueueStatusComplete']=function(_0x64d7e8){var _0x17cba8=this;var _0x5da507=_0x17cba8[_0x0375('0xb3')][_0x17cba8['actions'][_0x64d7e8[_0x0375('0x12d')]][_0x0375('0xb4')]];if(strategy[this['voiceQueues'][this[_0x0375('0xac')][_0x64d7e8[_0x0375('0x12d')]][_0x0375('0xb4')]][_0x0375('0x4d')]]===_0x0375('0x1d')){if(this[_0x0375('0xac')][_0x64d7e8['actionid']]&&this[_0x0375('0xac')][_0x64d7e8['actionid']][_0x0375('0x12f')]){this[_0x0375('0x90')][_0x0375('0x136')](this[_0x0375('0xac')][_0x64d7e8[_0x0375('0x12d')]]['idHopper'],this[_0x0375('0xac')][_0x64d7e8['actionid']][_0x0375('0x12f')])[_0x0375('0xb0')](function(_0x319741){logger[_0x0375('0x94')](_0x0375('0x137'),util['inspect'](_0x319741,{'showHidden':![],'depth':null}));})[_0x0375('0x20')](function(){_0x17cba8[_0x0375('0xb2')](_0x17cba8['voiceQueues'][_0x17cba8[_0x0375('0xac')][_0x64d7e8[_0x0375('0x12d')]][_0x0375('0xb4')]]);_0x17cba8[_0x0375('0x23')][_0x17cba8[_0x0375('0xac')][_0x64d7e8[_0x0375('0x12d')]]['stateinterface']][_0x0375('0x130')]=![];delete _0x17cba8[_0x0375('0xac')][_0x64d7e8[_0x0375('0x12d')]];unlockQueueStatus(_0x5da507);});}else{this[_0x0375('0xb2')](this[_0x0375('0xb3')][this['actions'][_0x64d7e8[_0x0375('0x12d')]][_0x0375('0xb4')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x0375('0xac')][_0x64d7e8[_0x0375('0x12d')]][_0x0375('0x100')],'ListId':this[_0x0375('0xac')][_0x64d7e8[_0x0375('0x12d')]][_0x0375('0xd5')],'VoiceQueueId':this['actions'][_0x64d7e8['actionid']][_0x0375('0x101')]||undefined,'CampaignId':this[_0x0375('0xac')][_0x64d7e8[_0x0375('0x12d')]][_0x0375('0xd6')]||undefined})[_0x0375('0xb0')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x64d7e8[_0x0375('0x12d')]];unlockQueueStatus(_0x5da507);}}else if((strategy[this[_0x0375('0xb3')][this['actions'][_0x64d7e8[_0x0375('0x12d')]]['queue']][_0x0375('0x4d')]]||_0x0375('0x131'))==='rrmemory'){var _0x2546c4;if(this[_0x0375('0xac')][_0x64d7e8[_0x0375('0x12d')]]&&!_[_0x0375('0x44')](this[_0x0375('0x2a')][this[_0x0375('0xac')][_0x64d7e8[_0x0375('0x12d')]][_0x0375('0xb4')]])){if(this[_0x0375('0x2b')][_0x17cba8[_0x0375('0xac')][_0x64d7e8[_0x0375('0x12d')]][_0x0375('0xb4')]]){this[_0x0375('0x2b')][_0x17cba8[_0x0375('0xac')][_0x64d7e8[_0x0375('0x12d')]]['queue']]=this[_0x0375('0x2b')][this['actions'][_0x64d7e8[_0x0375('0x12d')]][_0x0375('0xb4')]]?this['queueBookedRR'][this[_0x0375('0xac')][_0x64d7e8[_0x0375('0x12d')]][_0x0375('0xb4')]]:this[_0x0375('0x2a')][this[_0x0375('0xac')][_0x64d7e8[_0x0375('0x12d')]]['queue']]?this['queueBooked'][this[_0x0375('0xac')][_0x64d7e8['actionid']][_0x0375('0xb4')]][_0x0375('0x138')]||0x0:0x0;}this['queueBooked'][this[_0x0375('0xac')][_0x64d7e8[_0x0375('0x12d')]][_0x0375('0xb4')]][_0x0375('0x138')]=this[_0x0375('0x2b')][this[_0x0375('0xac')][_0x64d7e8['actionid']][_0x0375('0xb4')]];for(var _0x39192a=0x0;_0x39192a=0x0;})['catch'](myreject(_0x1fe8c8)));}}else{_0x37e7ec[_0x0375('0x132')](ami[_0x0375('0xae')]({'action':'command','command':util[_0x0375('0x76')](_0x0375('0x153'),_0x10ae92,!_[_0x0375('0x84')](config[_0x0375('0x154')][_0x578be0])?_0x578be0:'')})[_0x0375('0xb9')](function(_0x4f17da){return _0x4f17da['content'][_0x0375('0x151')](_0x0375('0x152'))>=0x0;})[_0x0375('0xb0')](myreject(_0x1fe8c8)));}BPromise[_0x0375('0x155')](_0x37e7ec)['then'](function(_0x34ab9a){var _0x40e4b2=_[_0x0375('0x156')](_0x34ab9a);if(_0x40e4b2){return _0x3690c0(_0x40e4b2);}else{_0x519dea[_0x0375('0x3c')]=_0x4ca5eb?_0x0375('0x157'):_0x0375('0x158');return _0x1fe8c8(msgResponse(_0x0375('0x159'),'Failure','Global:\x20'+_0x4ca5eb+'\x20'+_0x3939e0+_0x0375('0x15a')+util[_0x0375('0x95')](_0x10ae92,{'showHidden':![],'depth':null})+_0x0375('0x15b')+_0x578be0));}})['catch'](function(_0x5601ae){return _0x1fe8c8(msgResponse(_0x0375('0x148'),_0x0375('0x14b'),JSON[_0x0375('0x48')](_0x5601ae)));});});};Dialer['prototype']['checkDialMethod']=function(_0x29da65){var _0x351710=this;return function(){switch(_0x29da65[_0x0375('0x15c')]){case _0x0375('0x15d'):freeVariablesPredictive(_0x29da65);_0x351710[_0x0375('0x15e')](_0x29da65,0x1);break;case _0x0375('0x15f'):freeVariablesPredictive(_0x29da65);_0x351710[_0x0375('0x15e')](_0x29da65,_0x29da65[_0x0375('0x160')]);break;case _0x0375('0xa'):_0x351710[_0x0375('0xa')](_0x29da65);break;case _0x0375('0x9'):freeVariablesPredictive(_0x29da65);_0x351710['handlePower'](_0x29da65,0x1);break;default:freeVariablesPredictive(_0x29da65);logger[_0x0375('0x94')](_0x0375('0x161'),_0x29da65[_0x0375('0x40')],_0x0375('0x162'));}};};Dialer[_0x0375('0xa8')]['launchHandleIvr']=function(_0x558adb){var _0x5688a5=this;return function(){_0x5688a5['handleIvr'](_0x558adb);};};Dialer[_0x0375('0xa8')][_0x0375('0xc')]=function(_0x494060){var _0x3d27bf=this;if(isNotPreview(_0x494060[_0x0375('0x15c')])){if(isVoiceQueueOutbound(_0x494060[_0x0375('0x54')])&&isActive(_0x494060['dialActive'])){_0x494060[_0x0375('0x9e')]=!![];BPromise[_0x0375('0xb8')]()[_0x0375('0xb9')](checkIsLoggedIn(_0x494060,_0x494060['loggedIn']))[_0x0375('0xb9')](checkIsActive(_0x494060,_0x494060[_0x0375('0x59')]))[_0x0375('0xb9')](checkInterval(_0x494060))['then'](_0x3d27bf['checkIsTrunkReachable'](_0x494060))[_0x0375('0xb9')](_0x3d27bf[_0x0375('0x146')](_0x494060['dialGlobalInterval'],_0x494060[_0x0375('0x163')],_0x494060[_0x0375('0x40')],_0x494060))[_0x0375('0xb9')](_0x3d27bf[_0x0375('0x147')](_0x494060[_0x0375('0x41')],_0x494060[_0x0375('0x163')],_0x494060[_0x0375('0x40')],_0x494060))[_0x0375('0xb9')](_0x3d27bf[_0x0375('0x164')](_0x494060))['catch'](loggerCatchQueueSummary('[syncQueueSummary]',_0x494060));}else{notSendMessagesQueue(_0x494060);}}else{freeVariablesPredictive(_0x494060);}};Dialer[_0x0375('0xa8')][_0x0375('0x143')]=function(){var _0x318ef5=this;var _0x19da83;for(var _0x526104 in this[_0x0375('0x22')]){if(typeof this['campaigns'][_0x526104]!=='undefined'){_0x19da83=this[_0x0375('0x22')][_0x526104];if(isCampaignIvr(_0x19da83['type'])&&isActive(_0x19da83[_0x0375('0x73')])){_0x19da83['sendMessageOneNotActive']=!![];BPromise[_0x0375('0xb8')]()[_0x0375('0xb9')](checkIsActive(_0x19da83,_0x19da83[_0x0375('0x73')]))[_0x0375('0xb9')](checkInterval(_0x19da83))[_0x0375('0xb9')](_0x318ef5[_0x0375('0x165')](_0x19da83))[_0x0375('0xb9')](_0x318ef5[_0x0375('0x146')](_0x19da83[_0x0375('0x166')],_0x19da83[_0x0375('0x163')],_0x19da83[_0x0375('0x40')],_0x19da83))[_0x0375('0xb9')](_0x318ef5[_0x0375('0x147')](_0x19da83[_0x0375('0x41')],_0x19da83[_0x0375('0x163')],_0x19da83[_0x0375('0x40')],_0x19da83))['then'](_0x318ef5[_0x0375('0x167')](_0x19da83))['catch'](loggerCatchQueueSummary(_0x0375('0x168'),_0x19da83));}else{notSendMessagesCampaign(_0x19da83);}}}};function getCallerIdRandom(_0x45cd0e,_0x2490ef){var _0x448561;var _0x1702ab;var _0x2245cf;if(_0x2490ef<=0x0){_0x2490ef=0x1;}_0x448561=new RegExp(_0x0375('0x169')+_0x2490ef+'}$');_0x1702ab=Math[_0x0375('0x16a')](0xa,_0x2490ef-0x1);_0x2245cf=Math[_0x0375('0x16a')](0xa,_0x2490ef)-0x1;return util[_0x0375('0x76')]('%s',_[_0x0375('0x16b')](_0x45cd0e,_0x448561,_[_0x0375('0x16c')](_0x1702ab,_0x2245cf)));}function extractCalleridName(_0x5e33a1){var _0x47d530=_0x5e33a1[_0x0375('0x16d')](/"(.*?)"/);return _0x47d530?_0x47d530[0x1]:_0x5e33a1;}function extractCalleridNumber(_0x2b0408){var _0x4c2af6=_0x2b0408[_0x0375('0x16d')](/<(.*?)>/);return _0x4c2af6?_0x4c2af6[0x1]:_0x2b0408;}Dialer[_0x0375('0xa8')]['actionOriginate']=function(_0x3581d9,_0x4a5386){var _0x88ef88=this;var _0x58e2d7=uuid['v4']();this[_0x0375('0xac')][_0x58e2d7]=new Action(_0x3581d9,_0x4a5386,_0x58e2d7);return new BPromise(function(_0xe42170,_0x1cfde9){if(_[_0x0375('0x84')](_0x3581d9)&&typeof _0x3581d9!==_0x0375('0x16e')){return _0x1cfde9(msgResponse(_0x0375('0x16f'),_0x0375('0x14b'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x4a5386['Contact'][_0x0375('0x170')])||_0x4a5386[_0x0375('0x171')][_0x0375('0x170')]===null){return _0x1cfde9(msgResponse(_0x0375('0x16f'),_0x0375('0x14b'),_0x0375('0x172')));}var _0x164483={'XMD-CALLERID':_0x88ef88[_0x0375('0xac')][_0x58e2d7]['getCaller'](),'XMD-AGI':_0x3581d9[_0x0375('0x10a')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x3581d9['dialQueueProject']):_0x0375('0x173'),'XMD-AGIAFTER':_0x3581d9[_0x0375('0x115')]?util[_0x0375('0x76')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3581d9[_0x0375('0x115')]):'NONE','XMD-QUEUE':_0x3581d9[_0x0375('0x54')]===_0x0375('0x4c')?util['format'](_0x0375('0x174'),_0x3581d9['name'],_0x3581d9[_0x0375('0x175')]||'',_0x3581d9[_0x0375('0x116')]?'c':'',_0x3581d9[_0x0375('0x176')]||0x3):_0x0375('0x173'),'XMD-CONTACTID':_0x4a5386[_0x0375('0x100')],'XMD-CDRTYPE':_0x0375('0x8'),'CALLERID(all)':_0x88ef88[_0x0375('0xac')][_0x58e2d7]['getCaller'](),'XMD-AMD':_0x3581d9[_0x0375('0xe2')]?'ACTIVE':'NONE','XMD-DESTINATION':_0x0375('0xe1')};if(_0x3581d9[_0x0375('0xe2')]){_0x164483['XMD-AMDINITIALSILENCE']=_0x3581d9[_0x0375('0x177')]||0x9c4;_0x164483['XMD-AMDGREETING']=_0x3581d9[_0x0375('0x178')]||0x5dc;_0x164483[_0x0375('0x179')]=_0x3581d9[_0x0375('0x17a')]||0x320;_0x164483[_0x0375('0x17b')]=_0x3581d9[_0x0375('0x17c')]||0x1388;_0x164483[_0x0375('0x17d')]=_0x3581d9[_0x0375('0x17e')]||0x64;_0x164483['XMD-AMDBETWEENWORDSSILENCE']=_0x3581d9[_0x0375('0x17f')]||0x32;_0x164483['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x3581d9[_0x0375('0x180')]||0x3;_0x164483[_0x0375('0x181')]=_0x3581d9[_0x0375('0x182')]||0x100;_0x164483[_0x0375('0x183')]=_0x3581d9[_0x0375('0x184')]||0x1388;}if(_0x3581d9['type']==='outbound'){_0x164483[_0x0375('0x185')]=_0x4a5386[_0x0375('0x101')];}else{_0x164483[_0x0375('0x186')]=_0x4a5386[_0x0375('0xd6')];}for(var _0x315048 in _0x4a5386['Contact']){if(typeof _0x4a5386[_0x0375('0x171')][_0x315048]!==_0x0375('0x98')){if(isNotNull(_0x4a5386[_0x0375('0x171')][_0x315048])&&_0x315048!=='id'&&_0x315048!==_0x0375('0x187')&&_0x315048!=='createdAt'&&_0x315048!==_0x0375('0x188')){_0x164483[util['format'](_0x0375('0x189'),_0x0375('0x18a'),_[_0x0375('0x18b')](_0x315048))]=_0x4a5386[_0x0375('0x171')][_0x315048];}}}var _0x5891f=_0x88ef88['isTrunkReachable'](_0x3581d9[_0x0375('0x72')])?getCallerId(_0x3581d9[_0x0375('0x72')]['callerid'],_0x3581d9[_0x0375('0x5a')],_0x3581d9[_0x0375('0x18c')]>0x0?getCallerIdRandom(_0x3581d9[_0x0375('0x5b')],_0x3581d9['dialRandomLastDigitCallerIdNumber']):_0x3581d9[_0x0375('0x5b')]):getCallerId(_[_0x0375('0xde')](_0x3581d9[_0x0375('0x18d')])?_0x3581d9[_0x0375('0x72')][_0x0375('0x74')]:_0x3581d9['TrunkBackup'][_0x0375('0x74')],_0x3581d9[_0x0375('0x5a')],_0x3581d9['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3581d9[_0x0375('0x5b')],_0x3581d9['dialRandomLastDigitCallerIdNumber']):_0x3581d9[_0x0375('0x5b')]);if(_0x5891f){_0x164483[_0x0375('0x18e')]=_0x88ef88['actions'][_0x58e2d7][_0x0375('0x18f')]=extractCalleridName(_0x5891f);_0x164483[_0x0375('0x190')]=_0x88ef88[_0x0375('0xac')][_0x58e2d7][_0x0375('0x191')]=extractCalleridNumber(_0x5891f);}return ami['Action']({'actionid':_0x58e2d7,'action':_0x0375('0x16f'),'channel':_0x88ef88['isTrunkReachable'](_0x3581d9[_0x0375('0x72')])?util['format']('SIP/%s/%s%s',_0x3581d9[_0x0375('0x72')][_0x0375('0x40')],isNotNull(_0x3581d9[_0x0375('0x192')])?_0x3581d9['dialPrefix'][_0x0375('0x193')]()||'':'',_0x3581d9[_0x0375('0x194')]>0x0?_0x4a5386[_0x0375('0x171')][_0x0375('0x170')][_0x0375('0x195')](_0x3581d9[_0x0375('0x194')]):_0x4a5386[_0x0375('0x171')][_0x0375('0x170')]):util[_0x0375('0x76')](_0x0375('0x196'),_[_0x0375('0xde')](_0x3581d9['TrunkBackup'])?_0x3581d9[_0x0375('0x72')][_0x0375('0x40')]:_0x3581d9[_0x0375('0x18d')][_0x0375('0x40')],isNotNull(_0x3581d9[_0x0375('0x192')])?_0x3581d9[_0x0375('0x192')][_0x0375('0x193')]()||'':'',_0x3581d9['dialCutDigit']>0x0?_0x4a5386[_0x0375('0x171')][_0x0375('0x170')]['substring'](_0x3581d9[_0x0375('0x194')]):_0x4a5386[_0x0375('0x171')][_0x0375('0x170')]),'callerid':_0x5891f,'Exten':_0x0375('0xe1'),'Context':'from-sip','Priority':'1','variable':_0x164483,'timeout':(_0x3581d9[_0x0375('0x5c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x58e2d7})[_0x0375('0xb9')](function(_0x5f257c){return _0xe42170(_0x5f257c);})[_0x0375('0xb0')](function(_0x31b900){_0x3581d9['outboundOriginateFailureCallsDay']+=0x1;var _0x52e817=new History(_0x88ef88[_0x0375('0xac')][_0x58e2d7]);logger['error'](util[_0x0375('0x76')](_0x0375('0x197'),JSON[_0x0375('0x48')](_0x31b900)));_0x52e817[_0x0375('0xa6')]=0xe;_0x52e817[_0x0375('0xee')]=_0x0375('0x198');_0x52e817['starttime']=moment()[_0x0375('0x76')]('YYYY-MM-DD\x20HH:mm:ss');_0x52e817[_0x0375('0x123')]=_0x52e817['starttime'];_0x88ef88[_0x0375('0xcd')](_0x52e817)[_0x0375('0xb0')](loggerCatch(_0x0375('0x199')));_0x88ef88['moveContactManagedDialer'](_0x52e817)['catch'](loggerCatch(_0x0375('0x199')))['finally'](function(){delete _0x88ef88['actions'][_0x58e2d7];return _0x1cfde9(msgResponse(_0x0375('0x16f'),_0x0375('0x47'),_0x0375('0x19a')));});});});};Dialer[_0x0375('0xa8')][_0x0375('0x31')]=function(_0x5cf387){var _0x262270=this[_0x0375('0xac')][_0x5cf387[_0x0375('0x12d')]];if(_0x262270){delete this[_0x0375('0xac')][_0x5cf387[_0x0375('0x12d')]];_0x262270['responsetime']=moment()[_0x0375('0x76')](_0x0375('0xff'));var _0x36be32=_0x262270[_0x0375('0x54')]===_0x0375('0x79')?this['campaigns'][_0x262270['queue']]:this[_0x0375('0xb3')][_0x262270[_0x0375('0x19b')]()];if(!this['isSuccess'](_0x5cf387[_0x0375('0x19c')])){this[_0x0375('0xb2')](_0x36be32);return this[_0x0375('0x19d')](_0x262270,_0x36be32,_0x5cf387)[_0x0375('0xb0')](loggerCatch(_0x0375('0x19e')));}this[_0x0375('0xaa')][_0x5cf387['uniqueid']]=_0x262270;}};Dialer['prototype'][_0x0375('0x19f')]=function(_0xf9d348,_0x2cf8cc,_0x55ab87){var _0x441141=new History(_0x2cf8cc);if(_0x441141[_0x0375('0xf4')]+_0x441141[_0x0375('0xf5')]+_0x441141[_0x0375('0xf6')]+_0x441141[_0x0375('0xf7')]+_0x441141['countdropretry']+_0x441141['countabandonedretry']+_0x441141[_0x0375('0xf1')]+_0x441141[_0x0375('0xf9')]>=_0x55ab87[_0x0375('0xfa')]-0x1){return!![];}switch(_0xf9d348){case 0x3:if(_0x441141[_0x0375('0xf6')]>=_0x55ab87['dialNoAnswerMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0x441141['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x0375('0x129')](_0x55ab87['dialNoAnswerRetryFrequency'],_0x0375('0xfe'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x441141['ContactId'],'ListId':_0x441141['ListId'],'VoiceQueueId':_0x441141['VoiceQueueId']||undefined,'CampaignId':_0x441141[_0x0375('0xd6')]||undefined})[_0x0375('0xb0')](loggerCatch(_0x0375('0x1a0')));break;case 0x5:if(_0x441141['countbusyretry']>=_0x55ab87[_0x0375('0x1a1')]-0x1){return!![];}this[_0x0375('0xc1')]({'active':![],'countbusyretry':_0x441141[_0x0375('0xf4')]+=0x1,'scheduledat':moment()['add'](_0x55ab87['dialBusyRetryFrequency'],'minutes')['format'](_0x0375('0xff')),'ContactId':_0x441141[_0x0375('0x100')],'ListId':_0x441141['ListId'],'VoiceQueueId':_0x441141[_0x0375('0x101')]||undefined,'CampaignId':_0x441141[_0x0375('0xd6')]||undefined})[_0x0375('0xb0')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x441141[_0x0375('0xf5')]>=_0x55ab87['dialCongestionMaxRetry']-0x1){return!![];}this[_0x0375('0xc1')]({'active':![],'countcongestionretry':_0x441141[_0x0375('0xf5')]+=0x1,'scheduledat':moment()[_0x0375('0x129')](_0x55ab87[_0x0375('0x1a2')],'minutes')['format'](_0x0375('0xff')),'ContactId':_0x441141[_0x0375('0x100')],'ListId':_0x441141[_0x0375('0xd5')],'VoiceQueueId':_0x441141['VoiceQueueId']||undefined,'CampaignId':_0x441141[_0x0375('0xd6')]||undefined})[_0x0375('0xb0')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x441141[_0x0375('0xf7')]>=_0x55ab87[_0x0375('0x1a3')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x441141[_0x0375('0xf7')]+=0x1,'scheduledat':moment()[_0x0375('0x129')](_0x55ab87['dialNoSuchNumberRetryFrequency'],_0x0375('0xfe'))[_0x0375('0x76')](_0x0375('0xff')),'ContactId':_0x441141['ContactId'],'ListId':_0x441141[_0x0375('0xd5')],'VoiceQueueId':_0x441141[_0x0375('0x101')]||undefined,'CampaignId':_0x441141['CampaignId']||undefined})[_0x0375('0xb0')](loggerCatch(_0x0375('0x1a4')));}break;case 0xa:if(_0x441141[_0x0375('0xf8')]>=_0x55ab87[_0x0375('0x120')]-0x1){return!![];}this[_0x0375('0xc1')]({'active':![],'countdropretry':_0x441141[_0x0375('0xf8')]+=0x1,'scheduledat':moment()[_0x0375('0x129')](_0x55ab87[_0x0375('0x121')],_0x0375('0xfe'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x441141[_0x0375('0x100')],'ListId':_0x441141['ListId'],'VoiceQueueId':_0x441141['VoiceQueueId']||undefined,'CampaignId':_0x441141[_0x0375('0xd6')]||undefined})['catch'](loggerCatch(_0x0375('0x122')));break;case 0xb:if(_0x441141[_0x0375('0x128')]>=_0x55ab87[_0x0375('0x1a5')]-0x1){return!![];}this[_0x0375('0xc1')]({'active':![],'countabandonedretry':_0x441141[_0x0375('0x128')]+=0x1,'scheduledat':moment()[_0x0375('0x129')](_0x55ab87[_0x0375('0x12a')],'minutes')['format'](_0x0375('0xff')),'ContactId':_0x441141[_0x0375('0x100')],'ListId':_0x441141['ListId'],'VoiceQueueId':_0x441141[_0x0375('0x101')]||undefined,'CampaignId':_0x441141[_0x0375('0xd6')]||undefined})[_0x0375('0xb0')](loggerCatch(_0x0375('0x12b')));break;case 0x13:if(_0x441141['countmachineretry']>=_0x55ab87['dialMachineMaxRetry']-0x1){return!![];}this[_0x0375('0xc1')]({'active':![],'countmachineretry':_0x441141[_0x0375('0xf1')]+=0x1,'scheduledat':moment()[_0x0375('0x129')](_0x55ab87[_0x0375('0xfd')],'minutes')['format'](_0x0375('0xff')),'ContactId':_0x441141[_0x0375('0x100')],'ListId':_0x441141['ListId'],'VoiceQueueId':_0x441141[_0x0375('0x101')]||undefined,'CampaignId':_0x441141[_0x0375('0xd6')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x441141['countagentrejectretry']>=_0x55ab87[_0x0375('0x1a6')]-0x1){return!![];}this[_0x0375('0xc1')]({'active':![],'countagentrejectretry':_0x441141[_0x0375('0xf9')]+=0x1,'scheduledat':moment()['add'](_0x55ab87[_0x0375('0x1a7')],_0x0375('0xfe'))[_0x0375('0x76')](_0x0375('0xff')),'ContactId':_0x441141[_0x0375('0x100')],'ListId':_0x441141['ListId'],'VoiceQueueId':_0x441141['VoiceQueueId']||undefined,'CampaignId':_0x441141['CampaignId']||undefined})[_0x0375('0xb0')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0x0375('0xa8')][_0x0375('0x19d')]=function(_0x1cdc65,_0x234674,_0x414577){var _0x57bf5d=this;var _0x17eba3=new History(_0x1cdc65);return new BPromise(function(_0x3fe079,_0x7760dc){if(_[_0x0375('0x84')](_0x234674)&&typeof _0x234674!=='object'){return _0x7760dc(msgResponse(_0x0375('0x1a8'),'Failure',_0x0375('0x1a9')));}if(_['isUndefined'](_0x414577)&&typeof _0x414577!==_0x0375('0x16e')){return _0x7760dc(msgResponse('[callProgressDetecting]',_0x0375('0x14b'),_0x0375('0x1aa')));}switch(_0x414577[_0x0375('0x112')]){case'0':_0x234674[_0x0375('0x1ab')]+=0x1;_0x17eba3[_0x0375('0xa6')]=0x0;_0x17eba3['statedesc']=_0x0375('0x1ac');_0x17eba3[_0x0375('0xf7')]+=0x1;_0x17eba3['countglobal']+=0x1;ami['emit'](_0x0375('0x1ad'),ut[_0x0375('0xea')](_0x1cdc65,_0x0375('0x1ae')));_0x57bf5d[_0x0375('0xcd')](_0x17eba3)[_0x0375('0xb0')](loggerCatch(_0x0375('0xf3')));if(_0x57bf5d[_0x0375('0x19f')](0x0,_0x1cdc65,_0x234674)){if(_0x17eba3['countnosuchnumberretry']>=_0x234674[_0x0375('0x1a3')]){_0x57bf5d[_0x0375('0x1af')](_0x17eba3,_0x3fe079,_0x7760dc,_0x0375('0x1b0'));}else{_0x57bf5d['stateGlobal'](_0x17eba3,_0x3fe079,_0x7760dc,_0x0375('0x1b0'));}}break;case'3':_0x234674[_0x0375('0x63')]+=0x1;_0x17eba3[_0x0375('0xa6')]=0x3;_0x17eba3[_0x0375('0xee')]=_0x0375('0x1b1');_0x17eba3['countnoanswerretry']+=0x1;_0x17eba3['countglobal']+=0x1;ami['emit'](_0x0375('0x1b2'),ut['buildObj'](_0x1cdc65,_0x0375('0x1b3')));_0x57bf5d[_0x0375('0xcd')](_0x17eba3)[_0x0375('0xb0')](loggerCatch(_0x0375('0x1b4')));if(_0x57bf5d[_0x0375('0x19f')](0x3,_0x1cdc65,_0x234674)){if(_0x17eba3[_0x0375('0xf6')]>=_0x234674[_0x0375('0x1b5')]){_0x57bf5d[_0x0375('0x1af')](_0x17eba3,_0x3fe079,_0x7760dc,_0x0375('0x1b6'));}else{_0x57bf5d[_0x0375('0x105')](_0x17eba3,_0x3fe079,_0x7760dc,_0x0375('0x1b6'));}}break;case'5':_0x234674['outboundBusyCallsDay']+=0x1;_0x17eba3[_0x0375('0xa6')]=0x5;_0x17eba3[_0x0375('0xee')]=_0x0375('0x1b7');_0x17eba3['countbusyretry']+=0x1;_0x17eba3['countglobal']+=0x1;ami[_0x0375('0xe8')](_0x0375('0x1b8'),ut[_0x0375('0xea')](_0x1cdc65,_0x0375('0x1b9')));_0x57bf5d[_0x0375('0xcd')](_0x17eba3)['catch'](loggerCatch(_0x0375('0x1ba')));if(_0x57bf5d[_0x0375('0x19f')](0x5,_0x1cdc65,_0x234674)){if(_0x17eba3[_0x0375('0xf4')]>=_0x234674[_0x0375('0x1a1')]){_0x57bf5d['createStateFinal'](_0x17eba3,_0x3fe079,_0x7760dc,_0x0375('0x1bb'));}else{_0x57bf5d['stateGlobal'](_0x17eba3,_0x3fe079,_0x7760dc,_0x0375('0x1bb'));}}break;case'8':_0x234674[_0x0375('0x60')]+=0x1;_0x17eba3['state']=0x8;_0x17eba3[_0x0375('0xee')]=_0x0375('0x1bc');_0x17eba3['countcongestionretry']+=0x1;_0x17eba3[_0x0375('0xf2')]+=0x1;ami['emit'](_0x0375('0x1bd'),ut[_0x0375('0xea')](_0x1cdc65,_0x0375('0x1be')));_0x57bf5d[_0x0375('0xcd')](_0x17eba3)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x57bf5d[_0x0375('0x19f')](0x8,_0x1cdc65,_0x234674)){if(_0x17eba3['countcongestionretry']>=_0x234674[_0x0375('0x1bf')]){_0x57bf5d[_0x0375('0x1af')](_0x17eba3,_0x3fe079,_0x7760dc,_0x0375('0x1c0'));}else{_0x57bf5d[_0x0375('0x105')](_0x17eba3,_0x3fe079,_0x7760dc,_0x0375('0x1c0'));}}break;case'11':_0x234674[_0x0375('0x1c1')]+=0x1;_0x17eba3[_0x0375('0xa6')]=0xb;_0x17eba3[_0x0375('0xee')]=_0x0375('0x127');_0x17eba3[_0x0375('0x128')]+=0x1;_0x17eba3['countglobal']+=0x1;_0x57bf5d['createHistory'](_0x17eba3)[_0x0375('0xb0')](loggerCatch(_0x0375('0x1c2')));if(_0x57bf5d[_0x0375('0x19f')](0xb,_0x1cdc65,_0x234674)){if(_0x17eba3[_0x0375('0x128')]>=_0x234674[_0x0375('0x1a5')]){_0x57bf5d[_0x0375('0x1af')](_0x17eba3,_0x3fe079,_0x7760dc,'reason\x2011\x20abandoned');}else{_0x57bf5d[_0x0375('0x105')](_0x17eba3,_0x3fe079,_0x7760dc,_0x0375('0x1c3'));}}break;case'20':_0x234674[_0x0375('0x66')]+=0x1;_0x17eba3[_0x0375('0xa6')]=0x14;_0x17eba3[_0x0375('0xee')]='AgentReject';_0x17eba3[_0x0375('0xf9')]+=0x1;_0x17eba3['countglobal']+=0x1;ami[_0x0375('0xe8')]('custom:agentreject',ut[_0x0375('0xea')](_0x1cdc65,_0x0375('0x1c4')));_0x57bf5d[_0x0375('0xcd')](_0x17eba3)[_0x0375('0xb0')](loggerCatch(_0x0375('0x1c5')));if(_0x57bf5d[_0x0375('0x19f')](0x14,_0x1cdc65,_0x234674)){if(_0x17eba3[_0x0375('0xf9')]>=_0x234674[_0x0375('0x1a6')]){_0x57bf5d[_0x0375('0x1af')](_0x17eba3,_0x3fe079,_0x7760dc,_0x0375('0x1c6'));}else{_0x57bf5d[_0x0375('0x105')](_0x17eba3,_0x3fe079,_0x7760dc,_0x0375('0x1c6'));}}break;default:_0x234674['outboundUnknownCallsDay']+=0x1;_0x17eba3[_0x0375('0xa6')]=0xc;_0x17eba3[_0x0375('0xee')]=_0x414577[_0x0375('0x112')];_0x57bf5d['createHistory'](_0x17eba3)[_0x0375('0xb0')](loggerCatch(_0x0375('0x1c7')));if(_0x57bf5d[_0x0375('0x19f')](_0x414577[_0x0375('0x112')],_0x1cdc65,_0x234674)){if(_0x17eba3[_0x0375('0xf4')]+_0x17eba3['countcongestionretry']+_0x17eba3['countnoanswerretry']+_0x17eba3[_0x0375('0xf7')]+_0x17eba3[_0x0375('0xf8')]+_0x17eba3['countabandonedretry']+_0x17eba3[_0x0375('0xf1')]+_0x17eba3[_0x0375('0xf9')]>=_0x234674[_0x0375('0xfa')]){_0x57bf5d[_0x0375('0x105')](_0x17eba3,_0x3fe079,_0x7760dc,_0x414577[_0x0375('0x112')]);}else{_0x57bf5d['createStateFinal'](_0x17eba3,_0x3fe079,_0x7760dc,_0x414577[_0x0375('0x112')]);}}}});};Dialer[_0x0375('0xa8')][_0x0375('0x105')]=function(_0x59e59d,_0x2f3058,_0x2ca769,_0x303327){var _0xb0b4a3=new Final(_0x59e59d);_0xb0b4a3[_0x0375('0xa6')]=0xf;_0xb0b4a3[_0x0375('0xee')]='Global';this[_0x0375('0x1af')](_0xb0b4a3,_0x2f3058,_0x2ca769,_0x303327);};Dialer[_0x0375('0xa8')][_0x0375('0x1af')]=function(_0x2f9de5,_0x272c0b,_0x1e07e5,_0x4c1c9d){this[_0x0375('0xcb')](_0x2f9de5)[_0x0375('0xb9')](function(){return _0x272c0b(msgResponse(_0x0375('0x1a8'),_0x0375('0xd9'),_0x4c1c9d));})[_0x0375('0xb0')](function(){return _0x1e07e5(msgResponse(_0x0375('0x1c8'),_0x0375('0x14b'),_0x0375('0x1c9')));});};Dialer[_0x0375('0xa8')][_0x0375('0xa')]=function(_0x200883){var _0x77042d=_0x200883[_0x0375('0x1ca')]/0x64;var _0x31eec1=_0x200883['outboundDropCallsDayTimeout']/(_0x200883[_0x0375('0x62')]+_0x200883[_0x0375('0xe5')]);var _0x2382ea=Math[_0x0375('0x1cb')](_0x200883['predictiveIntervalAvailable']*(_0x200883[_0x0375('0x1cc')]/0x64));var _0x2e70db=Math[_0x0375('0x1cb')](_0x200883[_0x0375('0x1cd')]*(_0x200883['predictiveIntervalMinThreshold']/0x64));var _0x423ee8=_0x200883[_0x0375('0xa0')]+_0x200883[_0x0375('0x9f')];var _0x18de5f=Math['floor'](_0x200883[_0x0375('0x6e')]*_0x200883[_0x0375('0x6f')]*_0x200883['predictiveIntervalHitRate']*_0x200883[_0x0375('0x6b')]);if(_[_0x0375('0x84')](_0x200883[_0x0375('0x28')])){if(!_[_0x0375('0x84')](_0x200883['startPredictive'])){_0x200883['startPredictive']=undefined;loggerPredictive[_0x0375('0x94')](_0x0375('0x1ce'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x0375('0x84')](_0x200883[_0x0375('0x8f')])){loggerPredictive[_0x0375('0x94')](_0x0375('0x1ce'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x200883[_0x0375('0x8f')]);_0x200883[_0x0375('0x8f')]=undefined;}_0x200883[_0x0375('0x28')]=moment()[_0x0375('0x76')](_0x0375('0xff'));loggerPredictive[_0x0375('0x7b')](_0x200883[_0x0375('0x40')],_0x0375('0x1cf'),_0x200883[_0x0375('0x28')]);this[_0x0375('0x15e')](_0x200883,0x1);}else if(ifInterval(_0x200883[_0x0375('0x1d0')],_0x200883['startProgressive'])){this[_0x0375('0x15e')](_0x200883,0x1);loggerPredictiveCalls[_0x0375('0x7b')]('[startMethodPredictive][StartProgressive][Loop]',_0x200883[_0x0375('0x28')],_0x200883[_0x0375('0x40')]);_0x200883['erlangCalls']=0x0;_0x200883['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x77042d<_0x31eec1&&_0x200883['dialPredictiveOptimization']===_0x0375('0x1d1')){freeVariablesPredictive(_0x200883);loggerPredictive[_0x0375('0x7b')](_0x0375('0x1d2'),_0x0375('0x1d3'),_0x31eec1,_0x0375('0x28'),_0x200883[_0x0375('0x40')]);}else if(_0x18de5f<_0x200883['predictiveIntervalErlangCallsDroppedCalls']&&_0x200883['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x200883);loggerPredictive[_0x0375('0x7b')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x18de5f,'Drop\x20in\x20this\x20interval',_0x200883[_0x0375('0x1d4')],_0x0375('0x28'),_0x200883[_0x0375('0x40')]);}else if(!ifInterval(_0x200883[_0x0375('0x1d0')],_0x200883[_0x0375('0x28')])&&_[_0x0375('0x84')](_0x200883['startPredictive'])&&!_['isUndefined'](_0x200883[_0x0375('0x28')])){_0x200883[_0x0375('0x71')]=moment()[_0x0375('0x76')](_0x0375('0xff'));loggerPredictive[_0x0375('0x7b')](_0x200883[_0x0375('0x40')],_0x0375('0x1d5'),_0x200883[_0x0375('0x71')]);this['averageHandleTime'](_0x200883['dialPredictiveInterval'])['then'](this[_0x0375('0x1d6')](_0x200883))[_0x0375('0xb9')](mergeDataErlangB(_0x200883))[_0x0375('0xb9')](this[_0x0375('0x1d7')](_0x200883))[_0x0375('0xb0')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x200883));}else if(!ifInterval(_0x200883[_0x0375('0x1d0')],_0x200883[_0x0375('0x71')])){_0x200883[_0x0375('0x1d4')]=0x0;_0x200883[_0x0375('0x71')]=moment()[_0x0375('0x76')](_0x0375('0xff'));loggerPredictive[_0x0375('0x7b')](_0x200883[_0x0375('0x40')],_0x0375('0x1d8'),_0x200883['startPredictive']);clearInterval(_0x200883[_0x0375('0x8f')]);_0x200883[_0x0375('0x8f')]=undefined;this['averageHandleTime'](_0x200883['dialPredictiveInterval'])[_0x0375('0xb9')](this[_0x0375('0x1d6')](_0x200883))[_0x0375('0xb9')](mergeDataErlangB(_0x200883))[_0x0375('0xb9')](this[_0x0375('0x1d7')](_0x200883))[_0x0375('0xb0')](loggerCatchPredictive(_0x0375('0x1d9'),_0x200883));}else if(_0x200883[_0x0375('0x1cd')]&&_0x423ee8<_0x200883['predictiveIntervalAvailable']-_0x2e70db){freeVariablesPredictive(_0x200883);loggerPredictive[_0x0375('0x7b')](_0x200883[_0x0375('0x40')],_0x0375('0x1da'),_0x423ee8,_0x0375('0x1db'),_0x200883[_0x0375('0x1cd')],'-',_0x2e70db,'=',_0x200883[_0x0375('0x1cd')]-_0x2e70db,')');}else if(_0x200883[_0x0375('0x1cd')]&&_0x423ee8>_0x200883[_0x0375('0x1cd')]+_0x2382ea){freeVariablesPredictive(_0x200883);loggerPredictive[_0x0375('0x7b')](_0x200883[_0x0375('0x40')],_0x0375('0x1da'),_0x423ee8,_0x0375('0x1dc'),_0x200883['predictiveIntervalAvailable'],'+',_0x2382ea,'=',_0x200883['predictiveIntervalAvailable']+_0x2382ea,')');}};Dialer[_0x0375('0xa8')]['getDataPredictive']=function(_0x2b6007){var _0x17a71b=this;return function(_0x11c34f){return new BPromise(function(_0x3bf0e,_0x5d12be){_[_0x0375('0x8d')](_0x2b6007,_0x11c34f[0x0]);if(checkGetDataPredictive(_0x11c34f[0x0])){var _0x3a80ae=_0x2b6007[_0x0375('0x1cd')]=_0x2b6007[_0x0375('0x9f')]+_0x2b6007['available'];var _0x3a7f2e=_0x2b6007[_0x0375('0x1d0')]*0x3c;var _0x2769a3=_0x11c34f[0x0][_0x0375('0x68')]+_0x11c34f[0x0][_0x0375('0x81')];var _0x4aee3b=(_0x11c34f[0x0][_0x0375('0x67')]+_0x11c34f[0x0][_0x0375('0x7f')]+_0x11c34f[0x0][_0x0375('0x69')])/_0x11c34f[0x0][_0x0375('0x6d')];_0x2b6007[_0x0375('0x6a')]=_0x4aee3b>0x0?_0x4aee3b:0x1;switch(_0x2b6007[_0x0375('0x1dd')]){case _0x0375('0x1d1'):var _0x59232a=_0x2b6007[_0x0375('0x1ca')]/0x64;return _0x17a71b[_0x0375('0x1de')](_0x3a80ae,_0x3a7f2e,_0x2769a3,_0x4aee3b,_0x59232a)['then'](function(_0x23dca3){return _0x3bf0e(_0x23dca3);});case _0x0375('0x1df'):var _0xf13042=_0x2b6007[_0x0375('0x1ca')]/0x64;return _0x17a71b[_0x0375('0x1e0')](_0x3a80ae,_0x3a7f2e,_0x2769a3,_0x4aee3b,_0xf13042)[_0x0375('0xb9')](function(_0x1dbd17){return _0x3bf0e(_0x1dbd17);});default:return _0x5d12be(msgResponse(_0x0375('0x1e1'),'Failure',_0x0375('0x1e2')));}}else{return _0x5d12be(msgResponse(_0x0375('0x1e1'),'Failure',_0x0375('0x1e3')));}});};};Dialer['prototype'][_0x0375('0x1e4')]=function(_0xe014d2){var _0x14d345=this;return function(_0x2ec098){return new BPromise(function(_0x5b850f,_0x5b5bc8){_[_0x0375('0x8d')](_0xe014d2,_0x2ec098[0x0]);if(checkGetDataPredictive(_0x2ec098[0x0])){loggerPredictive[_0x0375('0x7b')](JSON[_0x0375('0x48')](_0x2ec098[0x0]));if(_0xe014d2[_0x0375('0x1dd')]===_0x0375('0x1d1')){return _0x14d345[_0x0375('0xc9')](_0xe014d2['id'])['then'](function(_0x2d96f3){var _0xc365d1=_0xe014d2[_0x0375('0x4e')]-_0x2d96f3[0x0][_0x0375('0x1e5')];var _0x36dfc2=_0xe014d2[_0x0375('0x1d0')]*0x3c;var _0x5c9975=_0x2ec098[0x0]['predictiveIntervalAvgTalktime']+_0x2ec098[0x0][_0x0375('0x81')];var _0x443808=(_0x2ec098[0x0]['predictiveIntervalAnsweredCalls']+_0x2ec098[0x0][_0x0375('0x7f')]+_0x2ec098[0x0][_0x0375('0x69')])/_0x2ec098[0x0][_0x0375('0x6d')];var _0x4fcbc5=_0xe014d2[_0x0375('0x1ca')]/0x64;_0xe014d2[_0x0375('0x6c')]=_0x2d96f3[0x0][_0x0375('0x1e5')]||0x0;_0xe014d2['predictiveIntervalHitRate']=_0x443808>0x0?_0x443808:0x1;return _0x14d345[_0x0375('0x1de')](_0xc365d1,_0x36dfc2,_0x5c9975,_0x443808,_0x4fcbc5);})[_0x0375('0xb9')](function(_0xc20eaa){return _0x5b850f(_0xc20eaa);})[_0x0375('0xb0')](function(_0xefc6e0){return _0x5b5bc8(msgResponse(_0x0375('0x1e6'),_0x0375('0x14b'),JSON[_0x0375('0x48')](_0xefc6e0)));});}if(_0xe014d2[_0x0375('0x1dd')]===_0x0375('0x1df')){return _0x14d345[_0x0375('0xc9')](_0xe014d2['id'])[_0x0375('0xb9')](function(_0x7534f6){var _0x4e79e1=_0xe014d2[_0x0375('0x4e')]-_0x7534f6[0x0]['outboundQueuePauses'];var _0x1e5f39=_0xe014d2[_0x0375('0x1d0')]*0x3c;var _0x547843=_0x2ec098[0x0][_0x0375('0x68')]+_0x2ec098[0x0][_0x0375('0x81')];var _0x1581de=(_0x2ec098[0x0][_0x0375('0x67')]+_0x2ec098[0x0][_0x0375('0x7f')]+_0x2ec098[0x0][_0x0375('0x69')])/_0x2ec098[0x0][_0x0375('0x6d')];var _0x4abf58=_0xe014d2[_0x0375('0x1ca')]/0x64;_0xe014d2[_0x0375('0x6c')]=_0x7534f6[0x0][_0x0375('0x1e5')]||0x0;_0xe014d2[_0x0375('0x6a')]=_0x1581de>0x0?_0x1581de:0x1;return _0x14d345['busyFactor'](_0x4e79e1,_0x1e5f39,_0x547843,_0x1581de,_0x4abf58);})[_0x0375('0xb9')](function(_0x487d24){return _0x5b850f(_0x487d24);})[_0x0375('0xb0')](function(_0x5b3fb0){return _0x5b5bc8(msgResponse(_0x0375('0x1e6'),_0x0375('0x14b'),JSON[_0x0375('0x48')](_0x5b3fb0)));});}}else{return _0x5b5bc8(msgResponse(_0x0375('0x1e1'),_0x0375('0x14b'),_0x0375('0x1e3')));}});};};Dialer[_0x0375('0xa8')]['startMethodPredictive']=function(_0xa73713){var _0x5d893d=this;return function(){var _0xfc108b=0x0;var _0x586932=Math[_0x0375('0x1e7')](_0xa73713[_0x0375('0x8a')]*0x3e8);if(_0x586932>0x0){_0x586932=_0x586932<0x64?0x64:_0x586932;loggerPredictive[_0x0375('0x7b')](_0xa73713[_0x0375('0x40')],_0x0375('0x1e8'),_0x586932,_0x0375('0x49'));_0xa73713[_0x0375('0x8f')]=setInterval(function(){_0x5d893d[_0x0375('0x8f')](_0xa73713);loggerPredictiveCalls[_0x0375('0x7b')]('[handlePredictive]',_0xfc108b+=0x1);},_0x586932);}else{loggerPredictive[_0x0375('0x7b')](_0xa73713[_0x0375('0x40')],_0x0375('0x1e9'));}};};Dialer[_0x0375('0xa8')][_0x0375('0x1ea')]=function(_0x22c130,_0x33952f){var _0x550adb=this;return function(_0x47c662){if(_[_0x0375('0x44')](_0x47c662)){if(_[_0x0375('0xde')](_0x33952f[_0x0375('0x1eb')])||!_0x33952f['recallme']){if(_0x22c130[_0x0375('0x15c')]===_0x0375('0x9')){_0x22c130['queueStatusComplete']=_[_0x0375('0x84')](_0x22c130[_0x0375('0x134')])?!![]:_0x22c130[_0x0375('0x134')];var _0x552989=uuid['v4']();_0x550adb['actions'][_0x552989]=new Action(_0x22c130,_0x33952f,_0x552989);loggerBooked[_0x0375('0x7b')]('[booked][checkContactBlack]',_0x552989,_0x0375('0x1ec'),JSON[_0x0375('0x48')](_0x22c130['queueStatusComplete']),_0x0375('0x1ed'),_0x22c130[_0x0375('0x40')]);if(_0x22c130[_0x0375('0x134')]){_0x22c130[_0x0375('0x134')]=![];_0x550adb[_0x0375('0x2a')][_0x550adb['actions'][_0x552989][_0x0375('0xb4')]]=[];ami[_0x0375('0xae')]({'actionid':_0x552989,'action':_0x0375('0x1ee'),'queue':_0x22c130['name']})[_0x0375('0xb0')](function(){_0x550adb[_0x0375('0xb2')](_0x22c130);_0x550adb[_0x0375('0xc1')]({'active':![],'ContactId':_0x550adb[_0x0375('0xac')][_0x552989][_0x0375('0x100')],'ListId':_0x550adb[_0x0375('0xac')][_0x552989][_0x0375('0xd5')],'VoiceQueueId':_0x550adb[_0x0375('0xac')][_0x552989][_0x0375('0x101')]||undefined,'CampaignId':_0x550adb[_0x0375('0xac')][_0x552989][_0x0375('0xd6')]||undefined})[_0x0375('0xb0')](loggerCatch(_0x0375('0x1ef')));delete _0x550adb[_0x0375('0xac')][_0x552989];});}else{loggerBooked['info'](_0x0375('0x1f0'),JSON[_0x0375('0x48')](_0x22c130[_0x0375('0x134')]),_0x0375('0x1ed'),_0x22c130[_0x0375('0x40')]);_0x550adb['updateOriginated'](_0x22c130);_0x550adb[_0x0375('0xc1')]({'active':![],'ContactId':_0x550adb[_0x0375('0xac')][_0x552989]['ContactId'],'ListId':_0x550adb['actions'][_0x552989][_0x0375('0xd5')],'VoiceQueueId':_0x550adb[_0x0375('0xac')][_0x552989]['VoiceQueueId']||undefined,'CampaignId':_0x550adb[_0x0375('0xac')][_0x552989][_0x0375('0xd6')]||undefined})[_0x0375('0xb0')](loggerCatch(_0x0375('0x1ef')));delete _0x550adb[_0x0375('0xac')][_0x552989];}}else{return _0x550adb['actionOriginate'](_0x22c130,_0x33952f);}}else{if(getDiff(_0x33952f[_0x0375('0x1f1')])<_0x22c130[_0x0375('0x1f2')]*0x3c){if(_0x33952f['Agent']&&!_0x33952f[_0x0375('0x1f3')][_0x0375('0x1f4')]){_0x550adb[_0x0375('0x90')]['run'](_0x33952f['id'])[_0x0375('0x20')](function(){_0x550adb[_0x0375('0xb2')](_0x22c130);});}else{_0x550adb[_0x0375('0x1f5')]({'active':![]},_0x33952f['id'],0x1)[_0x0375('0x20')](function(){_0x550adb[_0x0375('0xb2')](_0x22c130);});}}else{_0x22c130[_0x0375('0x65')]+=0x1;_0x550adb['updateOriginated'](_0x22c130);if(_0x22c130['dialRecallInQueue']){_0x550adb[_0x0375('0xc1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x33952f[_0x0375('0x100')],'ListId':_0x33952f['ListId'],'VoiceQueueId':_0x33952f[_0x0375('0x101')]||undefined,'CampaignId':_0x33952f[_0x0375('0xd6')]||undefined})[_0x0375('0xb0')](loggerCatch(_0x0375('0x1f6')));_0x550adb['createHistory'](createObjHistory(_0x22c130,_0x33952f,_0x0375('0x1f7'),0x17,_0x0375('0x1f8')))[_0x0375('0xb0')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x550adb[_0x0375('0xd3')](createObjHistory(_0x22c130,_0x33952f,_0x0375('0x1f9'),0x16,_0x0375('0x1fa')),_0x0375('0x1fb'),'[Originate][HistoryRecallClose]');}}}}else{_0x22c130['outboundBlacklistCallsDay']+=0x1;_0x550adb['saveInDb'](createObjHistory(_0x22c130,_0x33952f,_0x0375('0x1fc'),0xd,_0x0375('0x1fd')),_0x0375('0x1fe'),_0x0375('0x1ff'));throw _0x0375('0x200');}};};Dialer[_0x0375('0xa8')][_0x0375('0x201')]=function(_0x4a1d4c){var _0x1c0ee0=this;var _0x6acbf3=_0x4a1d4c[_0x0375('0x202')]-_0x4a1d4c[_0x0375('0x97')]-_0x4a1d4c[_0x0375('0xc5')];emitCampaignSummary(_0x4a1d4c);if(_0x6acbf3>0x0){if(_0x6acbf3>this[_0x0375('0x25')]){_0x6acbf3=this[_0x0375('0x25')];}_0x4a1d4c[_0x0375('0xc5')]+=_0x6acbf3;this[_0x0375('0xc7')](_0x4a1d4c['id'],_0x6acbf3,_0x4a1d4c[_0x0375('0x203')],_0x4a1d4c)['then'](function(_0x9cfafa){_0x4a1d4c[_0x0375('0xc5')]-=_0x6acbf3;_0x4a1d4c['temp']=_0x4a1d4c[_0x0375('0xc5')]>0x0?_0x4a1d4c['temp']:0x0;if(!checkContactEmpty(_0x9cfafa)){_0x4a1d4c['message']=_0x0375('0x9d');logger[_0x0375('0x7b')](_0x0375('0x204')+_0x4a1d4c[_0x0375('0x40')]);}else{_0x4a1d4c[_0x0375('0x97')]+=_0x9cfafa[_0x0375('0x96')];_0x4a1d4c[_0x0375('0x3c')]=_0x0375('0x205');for(var _0x5c4e2e=0x0;_0x5c4e2e<_0x9cfafa['length'];_0x5c4e2e+=0x1){_0x4a1d4c['ivrTotalCallsDays']+=0x1;if(_[_0x0375('0xde')](_0x9cfafa[_0x5c4e2e])||_[_0x0375('0xde')](_0x9cfafa[_0x5c4e2e][_0x0375('0x171')])||_[_0x0375('0xde')](_0x9cfafa[_0x5c4e2e][_0x0375('0x171')][_0x0375('0x170')])){_0x1c0ee0[_0x0375('0xd1')](_0x0375('0x206'),_0x4a1d4c,_0x9cfafa[_0x5c4e2e]);}else{_0x1c0ee0[_0x0375('0xbd')](_[_0x0375('0xd4')](_0x9cfafa[_0x5c4e2e],[_0x0375('0xd6'),_0x0375('0x207')]))[_0x0375('0xb9')](_0x1c0ee0['checkContactBlack'](_0x4a1d4c,_0x9cfafa[_0x5c4e2e]))[_0x0375('0xb0')](_0x1c0ee0['loggerHandler'](_0x0375('0x208'),_0x4a1d4c));}}}})[_0x0375('0xb0')](loggerGetContactDialer('[getContactCampaign2]',_0x4a1d4c,_0x6acbf3));}};Dialer[_0x0375('0xa8')][_0x0375('0x15e')]=function(_0x2bdf8e,_0x30a110){var _0x5cf53c=this;var _0x1bd381=[];var _0x5e0733=_0x30a110>=0x1?_0x30a110:0x1;if(_0x2bdf8e[_0x0375('0x15c')]===_0x0375('0x9')){_0x5e0733=0x1;}var _0x1fb446=Math[_0x0375('0x1e7')](_0x2bdf8e[_0x0375('0xa0')]*_0x5e0733)-_0x2bdf8e['originated']-_0x2bdf8e[_0x0375('0xc5')];emitVoiceQueueSummary(_0x2bdf8e);if(_0x2bdf8e['dialLimitQueue']>0x0){var _0x4db49b=_0x2bdf8e[_0x0375('0x209')]-_0x2bdf8e['originated']-_0x2bdf8e['talking']-_0x2bdf8e[_0x0375('0xc5')]-_0x2bdf8e['pTalking'];if(_0x1fb446>_0x4db49b){_0x1fb446=_0x4db49b;}}if(_0x1fb446>0x0){if(_0x2bdf8e[_0x0375('0x15c')]===_0x0375('0x9')){_0x1fb446=0x1;}if(_0x1fb446>this[_0x0375('0x25')]){_0x1fb446=this[_0x0375('0x25')];}_0x2bdf8e[_0x0375('0xc5')]+=_0x1fb446;for(var _0x477edb in this[_0x0375('0x23')]){if(typeof this['agents'][_0x477edb]!==_0x0375('0x98')){if(this[_0x0375('0x23')][_0x477edb]['state']==='not_inuse'&&this[_0x0375('0x23')][_0x477edb][_0x0375('0xaf')]===_0x0375('0x20a')){_0x1bd381[_0x0375('0x132')](this[_0x0375('0x23')][_0x477edb]['id']);}}}this['getContactDialer'](_0x2bdf8e['id'],_0x1bd381,_0x1fb446,_0x2bdf8e['dialOrderByScheduledAt'],_0x2bdf8e)['then'](function(_0x514777){_0x2bdf8e[_0x0375('0xc5')]-=_0x1fb446;_0x2bdf8e[_0x0375('0xc5')]=_0x2bdf8e[_0x0375('0xc5')]>0x0?_0x2bdf8e['temp']:0x0;if(!checkContactEmpty(_0x514777)){_0x5cf53c[_0x0375('0xb7')](_0x2bdf8e)[_0x0375('0xb9')](sendMessageReschedule(_0x2bdf8e))[_0x0375('0xb0')](loggerCatch(_0x0375('0xba')));}else{_0x2bdf8e[_0x0375('0x97')]+=_0x514777[_0x0375('0x96')];_0x2bdf8e[_0x0375('0x3c')]=_0x2bdf8e[_0x0375('0x15c')]===_0x0375('0x9')?_0x0375('0x20b'):_0x0375('0x205');for(var _0x1e3047=0x0;_0x1e3047<_0x514777['length'];_0x1e3047+=0x1){if(_[_0x0375('0xde')](_0x514777[_0x1e3047])||_[_0x0375('0xde')](_0x514777[_0x1e3047]['Contact'])||_[_0x0375('0xde')](_0x514777[_0x1e3047]['Contact']['phone'])){_0x5cf53c['emptyContact'](_0x0375('0x206'),_0x2bdf8e,_0x514777[_0x1e3047]);}else{_0x5cf53c[_0x0375('0xbb')](_[_0x0375('0xd4')](_0x514777[_0x1e3047],[_0x0375('0x101'),_0x0375('0x207')]))[_0x0375('0xb9')](_0x5cf53c[_0x0375('0x1ea')](_0x2bdf8e,_0x514777[_0x1e3047]))[_0x0375('0xb0')](_0x5cf53c[_0x0375('0xd0')](_0x0375('0x206'),_0x2bdf8e));}}}})[_0x0375('0xb0')](loggerGetContactDialer(_0x0375('0x20c'),_0x2bdf8e,_0x1fb446));}};Dialer[_0x0375('0xa8')][_0x0375('0x8f')]=function(_0x1310cd){if(_0x1310cd[_0x0375('0x209')]>0x0){var _0x19540c=_0x1310cd[_0x0375('0x209')]-_0x1310cd[_0x0375('0x97')]-_0x1310cd[_0x0375('0x9f')];if(_0x19540c>0x0){this[_0x0375('0x20d')](_0x1310cd);}else{loggerPredictiveCalls[_0x0375('0x7b')]('[handlePredictive][limitChannel]');}}else{this['tryOriginatePredictive'](_0x1310cd);}};Dialer[_0x0375('0xa8')][_0x0375('0x20d')]=function(_0x204a91){var _0x188331=this;var _0x4eab37=[];_0x204a91[_0x0375('0x97')]+=0x1;for(var _0x2e0ab0 in this['agents']){if(typeof this['agents'][_0x2e0ab0]!==_0x0375('0x98')){if(this['agents'][_0x2e0ab0]['state']===_0x0375('0x20e')&&this[_0x0375('0x23')][_0x2e0ab0][_0x0375('0xaf')]===_0x0375('0x20a')){_0x4eab37['push'](this[_0x0375('0x23')][_0x2e0ab0]['id']);}}}this[_0x0375('0xc4')](_0x204a91['id'],_0x4eab37,0x1,_0x204a91[_0x0375('0x203')],_0x204a91)[_0x0375('0xb9')](function(_0x290464){if(!checkContactEmpty(_0x290464)){checkContactLowerLimitOriginate(_0x204a91,0x1,0x0);_0x188331[_0x0375('0xb7')](_0x204a91)[_0x0375('0xb9')](sendMessageReschedule(_0x204a91))['catch'](loggerCatch(_0x0375('0xba')));}else{_0x204a91[_0x0375('0x3c')]=_0x0375('0x205');if(_['isNil'](_0x290464[0x0])||_[_0x0375('0xde')](_0x290464[0x0][_0x0375('0x171')])||_['isNil'](_0x290464[0x0][_0x0375('0x171')]['phone'])){_0x188331[_0x0375('0xd1')](_0x0375('0x206'),_0x204a91,_0x290464[0x0]);}else{_0x188331[_0x0375('0xbb')](_[_0x0375('0xd4')](_0x290464[0x0],[_0x0375('0x101'),'Contact.phone']))[_0x0375('0xb9')](_0x188331[_0x0375('0x1ea')](_0x204a91,_0x290464[0x0]))[_0x0375('0xb0')](_0x188331[_0x0375('0xd0')](_0x0375('0x20f'),_0x204a91));}}})[_0x0375('0xb0')](loggerGetContactDialer(_0x0375('0x210'),_0x204a91,0x1));emitVoiceQueueSummary(_0x204a91);};Dialer[_0x0375('0xa8')][_0x0375('0x1de')]=function(_0x218ffd,_0x435c41,_0x333638,_0x27f26c,_0x311816,_0x483063){loggerPredictive[_0x0375('0x7b')](_0x0375('0x211'));loggerPredictive['info'](_0x0375('0x212'),_0x218ffd);loggerPredictive[_0x0375('0x7b')](_0x0375('0x213'),_0x435c41);loggerPredictive[_0x0375('0x7b')](_0x0375('0x214'),_0x333638);loggerPredictive[_0x0375('0x7b')](_0x0375('0x215'),_0x27f26c);loggerPredictive[_0x0375('0x7b')](_0x0375('0x216'),_0x311816);loggerPredictive[_0x0375('0x7b')](_0x0375('0x83'));return new BPromise(function(_0x37ee35,_0x182d72){if(_0x218ffd<=0x0||isNaN(_0x218ffd)){return _0x182d72(msgResponse(_0x0375('0x217'),_0x0375('0x47'),'m\x20=\x20'+_0x218ffd));}if(_0x333638<=0x0||isNaN(_0x333638)){return _0x182d72(msgResponse('[abandonmentRate]',_0x0375('0x47'),'Ts\x20=\x20'+_0x333638));}if(_0x27f26c<=0x0||isNaN(_0x27f26c)){return _0x182d72(msgResponse(_0x0375('0x217'),_0x0375('0x47'),'p\x20=\x20'+_0x27f26c));}if(_0x435c41<=0x0||isNaN(_0x435c41)){return _0x182d72(msgResponse(_0x0375('0x217'),_0x0375('0x47'),_0x0375('0x218')+_0x435c41));}if(_0x311816<=0x0||isNaN(_0x311816)){return _0x182d72(msgResponse('[abandonmentRate]','Error',_0x0375('0x219')+_0x311816));}_0x483063=_0x483063||0x0;var _0x494322=0x1/_0x333638;var _0xb54123=0x0;var _0x45c98=0x0;var _0x2ffc69=0x0;var _0x32ee82=0x0;for(var _0x220c90=0x0;_0x2ffc69<_0x311816;_0x220c90+=0x1){_0x45c98=_0x220c90/_0x435c41;_0xb54123=(_0x27f26c*_0x45c98+_0x483063)/_0x494322;_0x2ffc69=erlangb(_0xb54123,_0x218ffd);_0x32ee82=_0xb54123/_0x218ffd*(0x1-erlangb(_0xb54123,_0x218ffd));}return _0x37ee35({'erlangCalls':_0x220c90,'erlangCallToSecond':_0x435c41/_0x220c90,'erlangAbandonmentRate':_0x2ffc69,'erlangBusyFactor':_0x32ee82});});};Dialer[_0x0375('0xa8')][_0x0375('0x1e0')]=function(_0x2dcc52,_0x55f6b7,_0x184c49,_0x133c8e,_0x313e58,_0x40f2d5){loggerPredictive[_0x0375('0x7b')](_0x0375('0x21a'));loggerPredictive['info'](_0x0375('0x212'),_0x2dcc52);loggerPredictive[_0x0375('0x7b')](_0x0375('0x213'),_0x55f6b7);loggerPredictive[_0x0375('0x7b')](_0x0375('0x214'),_0x184c49);loggerPredictive['info'](_0x0375('0x215'),_0x133c8e);loggerPredictive[_0x0375('0x7b')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x313e58);loggerPredictive[_0x0375('0x7b')](_0x0375('0x83'));return new BPromise(function(_0x42a88c,_0x1df9a7){if(_0x2dcc52<=0x0||isNaN(_0x2dcc52)){return _0x1df9a7(msgResponse(_0x0375('0x21b'),'Error',_0x0375('0x21c')+_0x2dcc52));}if(_0x184c49<=0x0||isNaN(_0x184c49)){return _0x1df9a7(msgResponse(_0x0375('0x21b'),_0x0375('0x47'),'Ts\x20=\x20'+_0x184c49));}if(_0x133c8e<=0x0||isNaN(_0x133c8e)){return _0x1df9a7(msgResponse(_0x0375('0x21b'),_0x0375('0x47'),'p\x20=\x20'+_0x133c8e));}if(_0x55f6b7<=0x0||isNaN(_0x55f6b7)){return _0x1df9a7(msgResponse(_0x0375('0x21b'),_0x0375('0x47'),_0x0375('0x218')+_0x55f6b7));}if(_0x313e58<=0x0||isNaN(_0x313e58)){return _0x1df9a7(msgResponse(_0x0375('0x21b'),_0x0375('0x47'),_0x0375('0x21d')+_0x313e58));}_0x40f2d5=_0x40f2d5||0x0;var _0x2cbb0d=0x1/_0x184c49;var _0x132c5e=0x0;var _0x43542a=0x0;var _0x23a182=0x0;var _0x17682a=0x0;for(var _0x59e321=0x0;_0x17682a<_0x313e58;_0x59e321+=0x1){_0x43542a=_0x59e321/_0x55f6b7;_0x132c5e=(_0x133c8e*_0x43542a+_0x40f2d5)/_0x2cbb0d;_0x23a182=erlangb(_0x132c5e,_0x2dcc52);_0x17682a=_0x132c5e/_0x2dcc52*(0x1-erlangb(_0x132c5e,_0x2dcc52));}return _0x42a88c({'erlangCalls':_0x59e321,'erlangCallToSecond':_0x55f6b7/_0x59e321,'erlangAbandonmentRate':_0x23a182,'erlangBusyFactor':_0x17682a});});};module[_0x0375('0x21e')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 1f8cbd4..cb35087 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 _0xbd1f=['scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','ringtime','holdtime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','moment','milliseconds','diff','seconds'];(function(_0x1b5a3c,_0x16313c){var _0xc45d36=function(_0x2f5c8b){while(--_0x2f5c8b){_0x1b5a3c['push'](_0x1b5a3c['shift']());}};_0xc45d36(++_0x16313c);}(_0xbd1f,0x102));var _0xfbd1=function(_0x5c3023,_0x59be84){_0x5c3023=_0x5c3023-0x0;var _0x3e3f58=_0xbd1f[_0x5c3023];return _0x3e3f58;};'use strict';var util=require(_0xfbd1('0x0'));var _=require(_0xfbd1('0x1'));var moment=require(_0xfbd1('0x2'));function getSeconds(_0x20b355,_0x501045){var _0x56724f=moment(_0x20b355)['milliseconds'](0x0);var _0x4bbbf9=moment(_0x501045)[_0xfbd1('0x3')](0x0);return _0x56724f[_0xfbd1('0x4')](_0x4bbbf9,_0xfbd1('0x5'));}function QueueCallerAbandon(_0x178b3c,_0x4507ac){this[_0xfbd1('0x6')]=_0x178b3c[_0xfbd1('0x6')];this[_0xfbd1('0x7')]=_0x178b3c[_0xfbd1('0x7')];this[_0xfbd1('0x8')]=_0x178b3c['type']===_0xfbd1('0x9')?_0xfbd1('0xa'):_0x178b3c[_0xfbd1('0x7')];this['countbusyretry']=_0x178b3c[_0xfbd1('0xb')];this['countcongestionretry']=_0x178b3c[_0xfbd1('0xc')];this[_0xfbd1('0xd')]=_0x178b3c[_0xfbd1('0xd')];this[_0xfbd1('0xe')]=_0x178b3c[_0xfbd1('0xb')]+_0x178b3c['countcongestionretry']+_0x178b3c[_0xfbd1('0xd')]+_0x178b3c['countnosuchnumberretry']+_0x178b3c['countdropretry']+_0x178b3c[_0xfbd1('0xf')]+_0x178b3c['countmachineretry']+_0x178b3c[_0xfbd1('0x10')];this[_0xfbd1('0x11')]=_0x178b3c[_0xfbd1('0x11')];this[_0xfbd1('0x12')]=_0x178b3c[_0xfbd1('0x12')];this['countabandonedretry']=_0x178b3c[_0xfbd1('0xf')];this['countmachineretry']=_0x178b3c[_0xfbd1('0x13')];this['countagentrejectretry']=_0x178b3c['countagentrejectretry'];this[_0xfbd1('0x14')]=_0x4507ac['uniqueid'];this[_0xfbd1('0x15')]=_0x178b3c[_0xfbd1('0x16')];this[_0xfbd1('0x17')]=_0x178b3c[_0xfbd1('0x18')];this[_0xfbd1('0x19')]=_0x178b3c[_0xfbd1('0x19')];this[_0xfbd1('0x1a')]=_0x178b3c[_0xfbd1('0x1a')];this['droptime']=_0x178b3c['droptime'];this['endtime']=this[_0xfbd1('0x1b')];this[_0xfbd1('0x1c')]=getSeconds(_0x178b3c[_0xfbd1('0x1a')],_0x178b3c[_0xfbd1('0x19')]);this[_0xfbd1('0x1d')]=getSeconds(this[_0xfbd1('0x1b')],_0x178b3c[_0xfbd1('0x1a')]);this['talktime']=0x0;this[_0xfbd1('0xa')]=_0x4507ac[_0xfbd1('0xa')];this[_0xfbd1('0x1e')]=_0x4507ac[_0xfbd1('0x1f')];this[_0xfbd1('0x20')]=_0x4507ac[_0xfbd1('0x20')];this[_0xfbd1('0x21')]=_0x178b3c[_0xfbd1('0x21')];this[_0xfbd1('0x22')]=_0x178b3c[_0xfbd1('0x22')];this[_0xfbd1('0x23')]=_0x178b3c[_0xfbd1('0x23')];this[_0xfbd1('0x24')]=_0x178b3c[_0xfbd1('0x24')];this[_0xfbd1('0x25')]=_0x178b3c['ContactId'];this[_0xfbd1('0x26')]=_0x178b3c[_0xfbd1('0x26')];this['UserId']=_0x178b3c[_0xfbd1('0x27')];this[_0xfbd1('0x28')]=_0x178b3c[_0xfbd1('0x28')];this[_0xfbd1('0x29')]=_0x178b3c['CampaignId'];this['originatecalleridnum']=_0x178b3c[_0xfbd1('0x2a')]||'';this['originatecalleridname']=_0x178b3c['originatecalleridname']||'';}module[_0xfbd1('0x2b')]=QueueCallerAbandon; \ No newline at end of file +var _0x5554=['campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','endtime','droptime','ringtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','seconds','scheduledat','type'];(function(_0x1e1010,_0x40ad0a){var _0x2b70a1=function(_0xb512aa){while(--_0xb512aa){_0x1e1010['push'](_0x1e1010['shift']());}};_0x2b70a1(++_0x40ad0a);}(_0x5554,0xfc));var _0x4555=function(_0x39d544,_0x35c14f){_0x39d544=_0x39d544-0x0;var _0x5a5ff2=_0x5554[_0x39d544];return _0x5a5ff2;};'use strict';var util=require(_0x4555('0x0'));var _=require(_0x4555('0x1'));var moment=require(_0x4555('0x2'));function getSeconds(_0x456f50,_0x5542c3){var _0x517843=moment(_0x456f50)['milliseconds'](0x0);var _0x406d92=moment(_0x5542c3)['milliseconds'](0x0);return _0x517843['diff'](_0x406d92,_0x4555('0x3'));}function QueueCallerAbandon(_0x1a8253,_0x2d4bda){this[_0x4555('0x4')]=_0x1a8253[_0x4555('0x4')];this[_0x4555('0x5')]=_0x1a8253[_0x4555('0x5')];this[_0x4555('0x6')]=_0x1a8253[_0x4555('0x5')]===_0x4555('0x7')?_0x4555('0x8'):_0x1a8253[_0x4555('0x5')];this[_0x4555('0x9')]=_0x1a8253[_0x4555('0x9')];this['countcongestionretry']=_0x1a8253[_0x4555('0xa')];this['countnoanswerretry']=_0x1a8253[_0x4555('0xb')];this[_0x4555('0xc')]=_0x1a8253[_0x4555('0x9')]+_0x1a8253[_0x4555('0xa')]+_0x1a8253[_0x4555('0xb')]+_0x1a8253[_0x4555('0xd')]+_0x1a8253[_0x4555('0xe')]+_0x1a8253['countabandonedretry']+_0x1a8253[_0x4555('0xf')]+_0x1a8253[_0x4555('0x10')];this[_0x4555('0xd')]=_0x1a8253[_0x4555('0xd')];this['countdropretry']=_0x1a8253['countdropretry'];this[_0x4555('0x11')]=_0x1a8253[_0x4555('0x11')];this[_0x4555('0xf')]=_0x1a8253[_0x4555('0xf')];this[_0x4555('0x10')]=_0x1a8253[_0x4555('0x10')];this[_0x4555('0x12')]=_0x2d4bda[_0x4555('0x12')];this[_0x4555('0x13')]=_0x1a8253[_0x4555('0x14')];this[_0x4555('0x15')]=_0x1a8253[_0x4555('0x16')];this[_0x4555('0x17')]=_0x1a8253['starttime'];this['responsetime']=_0x1a8253[_0x4555('0x18')];this['droptime']=_0x1a8253['droptime'];this[_0x4555('0x19')]=this[_0x4555('0x1a')];this[_0x4555('0x1b')]=getSeconds(_0x1a8253['responsetime'],_0x1a8253[_0x4555('0x17')]);this[_0x4555('0x1c')]=getSeconds(this['droptime'],_0x1a8253['responsetime']);this[_0x4555('0x1d')]=0x0;this['queue']=_0x2d4bda[_0x4555('0x8')];this[_0x4555('0x1e')]=_0x2d4bda[_0x4555('0x1f')];this[_0x4555('0x20')]=_0x2d4bda['reason'];this['callback']=_0x1a8253[_0x4555('0x21')];this['callbackuniqueid']=_0x1a8253[_0x4555('0x22')];this[_0x4555('0x23')]=_0x1a8253['callbackat'];this[_0x4555('0x24')]=_0x1a8253[_0x4555('0x24')];this['ContactId']=_0x1a8253['ContactId'];this[_0x4555('0x25')]=_0x1a8253[_0x4555('0x25')];this['UserId']=_0x1a8253['UserId'];this[_0x4555('0x26')]=_0x1a8253[_0x4555('0x26')];this[_0x4555('0x27')]=_0x1a8253[_0x4555('0x27')];this[_0x4555('0x28')]=_0x1a8253[_0x4555('0x28')]||'';this[_0x4555('0x29')]=_0x1a8253[_0x4555('0x29')]||'';}module[_0x4555('0x2a')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 71cb473..a545214 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(_0x373e2c,_0x19d258){var _0x578eae=function(_0x2c5593){while(--_0x2c5593){_0x373e2c['push'](_0x373e2c['shift']());}};_0x578eae(++_0x19d258);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x2fccce,_0x1fa141){var _0x4220f1=function(_0x1336b5){while(--_0x1336b5){_0x2fccce['push'](_0x2fccce['shift']());}};_0x4220f1(++_0x1fa141);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'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 1ae6edc..2019a99 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 _0x3691=['isNil','active','SIP/%s','checkTrunk','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','uuid','path','tiff2pdf','./util/gs','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','syncNewchannel','syncVarSet','bind','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','\x20hangup\x20sendFile\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','Trunk','Trunk\x20Reachable','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','format','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isTrunkReachable'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0x3691,0x82));var _0x1369=function(_0x3da242,_0x23eb65){_0x3da242=_0x3da242-0x0;var _0x48380d=_0x3691[_0x3da242];return _0x48380d;};'use strict';var util=require(_0x1369('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0x1369('0x1'));var moment=require('moment');var path=require(_0x1369('0x2'));var tiff2pdf=require(_0x1369('0x3'));var gs=require(_0x1369('0x4'));var logger=require('../../../config/logger')('fax');var ami=require(_0x1369('0x5'));var rpcDb=require(_0x1369('0x6'));var Channel=require(_0x1369('0x7'));var ut=require(_0x1369('0x8'));var Action=require(_0x1369('0x9'));var faxAccount=require(_0x1369('0xa'));var attachment=require(_0x1369('0xb'));var faxMessage=require(_0x1369('0xc'));function Fax(_0x38b25d){this[_0x1369('0xd')]={};this[_0x1369('0xe')]=_0x38b25d[_0x1369('0xe')];this['trunks']=_0x38b25d[_0x1369('0xf')];this['actions']={};ami['on']('newchannel',this[_0x1369('0x10')]['bind'](this));ami['on']('varset',this[_0x1369('0x11')][_0x1369('0x12')](this));ami['on'](_0x1369('0x13'),this['syncNewState'][_0x1369('0x12')](this));ami['on'](_0x1369('0x14'),this[_0x1369('0x15')][_0x1369('0x12')](this));ami['on'](_0x1369('0x16'),this[_0x1369('0x17')][_0x1369('0x12')](this));ami['on'](_0x1369('0x18'),this['syncReceiveFax'][_0x1369('0x12')](this));ami['on']('hangup',this[_0x1369('0x19')][_0x1369('0x12')](this));ami['on'](_0x1369('0x1a'),this[_0x1369('0x1b')]['bind'](this));}Fax[_0x1369('0x1c')]['syncNewchannel']=function(_0x2afc66){if(_0x2afc66[_0x1369('0x1d')]===_0x1369('0x1e')){for(var _0x1962c8 in this[_0x1369('0xe')]){if(this[_0x1369('0xe')][_0x1369('0x1f')](_0x1962c8)){if(_0x2afc66[_0x1369('0x20')]===this['faxAccounts'][_0x1962c8][_0x1369('0x21')]){this[_0x1369('0xd')][_0x2afc66[_0x1369('0x22')]]={};this[_0x1369('0xd')][_0x2afc66['uniqueid']][_0x1369('0x23')]=_0x2afc66['channel'];this['channels'][_0x2afc66[_0x1369('0x22')]]['id']=this[_0x1369('0xe')][_0x1962c8]['id'];this[_0x1369('0xd')][_0x2afc66[_0x1369('0x22')]][_0x1369('0x24')]=this[_0x1369('0xe')][_0x1962c8][_0x1369('0x24')];logger[_0x1369('0x25')](_0x2afc66[_0x1369('0x22')],_0x1369('0x26'));}}}}if(this[_0x1369('0x27')][_0x2afc66[_0x1369('0x22')]]){this[_0x1369('0xd')][_0x2afc66[_0x1369('0x22')]]={};this[_0x1369('0xd')][_0x2afc66['uniqueid']][_0x1369('0x23')]=_0x2afc66[_0x1369('0x23')];logger[_0x1369('0x25')](_0x2afc66[_0x1369('0x22')],_0x1369('0x26'));}};Fax['prototype'][_0x1369('0x11')]=function(_0x362738){if(this[_0x1369('0xd')][_0x362738['uniqueid']]){for(var _0xef95d2 in _0x362738[_0x1369('0x28')]){if(_0x362738[_0x1369('0x28')]['hasOwnProperty'](_0xef95d2)){this[_0x1369('0xd')][_0x362738[_0x1369('0x22')]][_0xef95d2]=_0x362738[_0x1369('0x29')];}}}};Fax['prototype'][_0x1369('0x2a')]=function(_0x47ba11){if(this[_0x1369('0xd')][_0x47ba11[_0x1369('0x22')]]){this[_0x1369('0xd')][_0x47ba11['uniqueid']][_0x1369('0x2b')]=_0x47ba11['channelstate'];this[_0x1369('0xd')][_0x47ba11[_0x1369('0x22')]]['channelstatedesc']=_0x47ba11[_0x1369('0x2c')];}};Fax[_0x1369('0x1c')][_0x1369('0x15')]=function(_0x126859){if(this[_0x1369('0xd')][_0x126859['uniqueid']]){for(var _0x5bac23 in _0x126859['variable']){if(_0x126859[_0x1369('0x28')][_0x1369('0x1f')](_0x5bac23)){this[_0x1369('0xd')][_0x126859['uniqueid']][_0x5bac23]=_0x126859[_0x1369('0x29')];}}}};Fax['prototype'][_0x1369('0x17')]=function(_0x22df9a){if(this[_0x1369('0xd')][_0x22df9a['uniqueid']]){this[_0x1369('0xd')][_0x22df9a[_0x1369('0x22')]][_0x1369('0x2d')]=_0x22df9a[_0x1369('0x2d')];this[_0x1369('0xd')][_0x22df9a[_0x1369('0x22')]]['status']=_0x22df9a[_0x1369('0x2e')];this[_0x1369('0xd')][_0x22df9a[_0x1369('0x22')]][_0x1369('0x21')]=_0x22df9a[_0x1369('0x21')];this['channels'][_0x22df9a[_0x1369('0x22')]]['filename']=_0x22df9a['filename'];logger[_0x1369('0x25')](_0x22df9a[_0x1369('0x22')],_0x1369('0x2f'));}};Fax[_0x1369('0x1c')][_0x1369('0x30')]=function(_0x45d68f){var _0x492d02=this;if(this[_0x1369('0xd')][_0x45d68f[_0x1369('0x22')]]){var _0x2f71b3=this[_0x1369('0xd')][_0x45d68f[_0x1369('0x22')]]['id'];this[_0x1369('0xd')][_0x45d68f[_0x1369('0x22')]]['remotestationid']=_0x45d68f[_0x1369('0x31')];this[_0x1369('0xd')][_0x45d68f[_0x1369('0x22')]][_0x1369('0x32')]=_0x45d68f[_0x1369('0x32')];this[_0x1369('0xd')][_0x45d68f['uniqueid']][_0x1369('0x21')]=_0x45d68f[_0x1369('0x21')];this['channels'][_0x45d68f[_0x1369('0x22')]][_0x1369('0x33')]=_0x45d68f[_0x1369('0x33')];this[_0x1369('0xd')][_0x45d68f[_0x1369('0x22')]][_0x1369('0x34')]=_0x45d68f[_0x1369('0x34')];this[_0x1369('0xd')][_0x45d68f['uniqueid']][_0x1369('0x35')]=_0x45d68f[_0x1369('0x35')];this[_0x1369('0xd')][_0x45d68f[_0x1369('0x22')]][_0x1369('0x36')]=_0x45d68f[_0x1369('0x36')];if(this['channels'][_0x45d68f[_0x1369('0x22')]][_0x1369('0x32')]>0x0){tiff2pdf(_0x45d68f[_0x1369('0x35')],_0x1369('0x37'),function(_0x3dbc04){logger[_0x1369('0x25')](_0x45d68f[_0x1369('0x22')],_0x1369('0x38'),_0x3dbc04[_0x1369('0x39')]);attachment[_0x1369('0x3a')]({'name':path[_0x1369('0x3b')](_0x45d68f[_0x1369('0x35')])[_0x1369('0x24')],'basename':path[_0x1369('0x3b')](_0x45d68f[_0x1369('0x35')])[_0x1369('0x24')]+_0x1369('0x3c'),'type':_0x1369('0x3d')})[_0x1369('0x3e')](function(_0x296201){faxAccount[_0x1369('0x3f')](_0x2f71b3,{'from':_0x45d68f[_0x1369('0x36')],'mapKey':_0x1369('0x40'),'body':path[_0x1369('0x3b')](_0x45d68f[_0x1369('0x35')])[_0x1369('0x24')]+_0x1369('0x3c'),'AttachmentId':_0x296201['id']})[_0x1369('0x41')](function(_0x3dc7b3){logger[_0x1369('0x42')](_0x45d68f[_0x1369('0x22')],_0x1369('0x43'),JSON[_0x1369('0x44')](_0x3dc7b3));});})[_0x1369('0x41')](function(_0x40bdc2){logger[_0x1369('0x42')](_0x45d68f[_0x1369('0x22')],_0x1369('0x45'),JSON['stringify'](_0x40bdc2));});});}logger['info'](_0x45d68f['uniqueid'],_0x1369('0x45'));}};Fax[_0x1369('0x1c')]['syncOriginateResponse']=function(_0x3df15a){if(this[_0x1369('0x27')][_0x3df15a[_0x1369('0x22')]]){_[_0x1369('0x46')](this[_0x1369('0xd')][_0x3df15a[_0x1369('0x22')]],_[_0x1369('0x47')](_0x3df15a,[_0x1369('0x48'),_0x1369('0x49')]));}};function updateStatus(_0x551fec){if(_0x551fec[_0x1369('0x4a')]){faxMessage[_0x1369('0x4b')](_0x551fec[_0x1369('0x4a')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x1369('0x3e')](function(_0x5b8968){ut[_0x1369('0x4c')](_0x1369('0x4d'),_0x5b8968);})[_0x1369('0x41')](function(_0x1fabac){ut[_0x1369('0x4c')]('[Fax][Message][Error][NoUpdate1]',_0x1fabac);});}else{ut[_0x1369('0x4c')](_0x1369('0x4e'));}}Fax[_0x1369('0x1c')][_0x1369('0x4f')]=function(_0x4d3b85,_0x29dcaa,_0x1acf1c){var _0x4b29a6=this;var _0x28fd8f={};if(_0x29dcaa){_0x28fd8f={'read':_0x29dcaa};}else{_0x28fd8f={'failMessage':_0x1acf1c};}if(this[_0x1369('0x27')][_0x4d3b85][_0x1369('0x4a')]){faxMessage[_0x1369('0x4b')](this[_0x1369('0x27')][_0x4d3b85][_0x1369('0x4a')],_0x28fd8f)[_0x1369('0x3e')](function(_0x51640d){ut[_0x1369('0x4c')]('[Fax][Message][Updated]',_0x51640d);})[_0x1369('0x41')](function(_0x430f80){ut[_0x1369('0x4c')](_0x1369('0x50'),_0x430f80);})['finally'](function(){delete _0x4b29a6[_0x1369('0xd')][_0x4d3b85];delete _0x4b29a6[_0x1369('0x27')][_0x4d3b85];});}else{ut[_0x1369('0x4c')]('[Fax][Message][NoUpdate2]');delete this[_0x1369('0xd')][_0x4d3b85];delete this[_0x1369('0x27')][_0x4d3b85];}};Fax['prototype']['syncHangup']=function(_0x17fd8c){var _0x193a5c=this;if(this['channels'][_0x17fd8c[_0x1369('0x22')]]){if(this[_0x1369('0x27')][_0x17fd8c[_0x1369('0x22')]]){this['channels'][_0x17fd8c[_0x1369('0x22')]]['id']=this[_0x1369('0x27')][_0x17fd8c[_0x1369('0x22')]]['id'];this[_0x1369('0xd')][_0x17fd8c[_0x1369('0x22')]]['name']=this[_0x1369('0x27')][_0x17fd8c[_0x1369('0x22')]]['name'];}logger[_0x1369('0x25')](_0x17fd8c['uniqueid'],this[_0x1369('0x27')][_0x17fd8c[_0x1369('0x22')]]?_0x1369('0x51'):'\x20hangup\x20faxRiceive\x20',JSON[_0x1369('0x44')](this[_0x1369('0xd')][_0x17fd8c[_0x1369('0x22')]]));if(this[_0x1369('0x27')][_0x17fd8c[_0x1369('0x22')]]){if(this['channels'][_0x17fd8c['uniqueid']]['faxpages']>0x0&&this['channels'][_0x17fd8c[_0x1369('0x22')]]['faxstatus']===_0x1369('0x52')){this[_0x1369('0x4f')](_0x17fd8c['uniqueid'],!![]);}else{this[_0x1369('0x4f')](_0x17fd8c[_0x1369('0x22')],![],this['channels'][_0x17fd8c[_0x1369('0x22')]][_0x1369('0x53')]?_0x1369('0x54')+this[_0x1369('0xd')][_0x17fd8c[_0x1369('0x22')]][_0x1369('0x53')]:_0x1369('0x55'));}}}};Fax[_0x1369('0x1c')][_0x1369('0x56')]=function(_0x313f2f){var _0x426918=this;return new BPromise(function(_0xa68877,_0x3a1723){_0x426918[_0x1369('0x57')](_0x313f2f,_0x426918['faxAccounts'][_0x313f2f[_0x1369('0x58')]])[_0x1369('0x3e')](function(_0x1e4772){ut['logger'](_0x1369('0x59'),_0x1e4772);_0xa68877(ut[_0x1369('0x39')](_0x1369('0x5a')));})[_0x1369('0x41')](function(_0x4d0df0){ut['logger'](_0x1369('0x5b'),_0x4d0df0);updateStatus(_0x313f2f);_0x3a1723(ut['message'](_0x1369('0x5c')));});});};Fax['prototype'][_0x1369('0x5d')]=function(_0x5a6b87){var _0x321b27=this;return new BPromise(function(_0x2a449a,_0x450bd3){var _0x2cc867=_0x321b27['checkTrunk'](_0x321b27[_0x1369('0xe')][_0x5a6b87[_0x1369('0x58')]][_0x1369('0x5e')],_0x5a6b87);if(_0x2cc867['isValid']){_0x2a449a(ut[_0x1369('0x39')](_0x1369('0x5f')));}else{_0x450bd3(ut[_0x1369('0x39')](_0x2cc867[_0x1369('0x39')]));}});};function originate(_0x3d74d1,_0x488b53,_0x39a4da){return new BPromise(function(_0x1a53e8,_0x475cb4){if(_0x39a4da){var _0x2a7eaa=util['format'](_0x1369('0x60'),path[_0x1369('0x3b')](_0x3d74d1[_0x1369('0x2')])[_0x1369('0x24')],_0x3d74d1[_0x1369('0x2')]);gs['execute'](_0x2a7eaa)[_0x1369('0x3e')](function(){_0x3d74d1['path']=util[_0x1369('0x61')](_0x1369('0x62'),path[_0x1369('0x3b')](_0x3d74d1[_0x1369('0x2')])['dir'],path[_0x1369('0x3b')](_0x3d74d1['path'])['name']);_0x488b53[_0x1369('0x63')]=_0x3d74d1[_0x1369('0x2')];ut['logger'](_0x1369('0x64'),'');ami['Action'](ut[_0x1369('0x65')](_0x3d74d1,_0x488b53))[_0x1369('0x3e')](function(_0x384819){_0x1a53e8(_0x384819);})[_0x1369('0x41')](function(_0x517fd6){_0x475cb4(_0x517fd6);});})[_0x1369('0x41')](function(_0x5b3c78){_0x475cb4(_0x5b3c78);});}else{ami[_0x1369('0x66')](ut[_0x1369('0x65')](_0x3d74d1,_0x488b53))[_0x1369('0x3e')](function(_0x35a954){_0x1a53e8(_0x35a954);})[_0x1369('0x41')](function(_0x4054ad){_0x475cb4(_0x4054ad);});}});}Fax[_0x1369('0x1c')][_0x1369('0x57')]=function(_0x595a27,_0x447a18){var _0x450d06=this;return new BPromise(function(_0x57e20b,_0x29cbb2){var _0x4e8214=uuid['v4']();var _0x40be25=ut[_0x1369('0x67')](_0x595a27,_0x447a18);_0x450d06['actions'][_0x4e8214]=new Action(_0x4e8214,_0x447a18,_0x595a27);var _0x3e8297=_0x450d06[_0x1369('0x27')][_0x4e8214];if(path[_0x1369('0x3b')](_0x595a27['path'])[_0x1369('0x68')]===_0x1369('0x3c')){originate(_0x3e8297,_0x40be25,!![])[_0x1369('0x3e')](function(_0x264b0e){_0x57e20b(_0x264b0e);})[_0x1369('0x41')](function(_0x3284cc){_0x29cbb2(_0x3284cc);});}else{originate(_0x3e8297,_0x40be25,![])[_0x1369('0x3e')](function(_0x11aa55){_0x57e20b(_0x11aa55);})['catch'](function(_0x133fc2){_0x29cbb2(_0x133fc2);});}});};Fax[_0x1369('0x1c')][_0x1369('0x69')]=function(_0x51ec96){return!_[_0x1369('0x6a')](_0x51ec96)&&!_[_0x1369('0x6a')](_0x51ec96[_0x1369('0x24')])&&!_[_0x1369('0x6a')](_0x51ec96[_0x1369('0x6b')])&&_0x51ec96[_0x1369('0x6b')]&&!_[_0x1369('0x6a')](this[_0x1369('0xf')][util[_0x1369('0x61')](_0x1369('0x6c'),_0x51ec96[_0x1369('0x24')])])&&!_[_0x1369('0x6a')](this['trunks'][util['format'](_0x1369('0x6c'),_0x51ec96[_0x1369('0x24')])][_0x1369('0x2e')])&&(this[_0x1369('0xf')][util[_0x1369('0x61')]('SIP/%s',_0x51ec96['name'])]['status']==='reachable'||this[_0x1369('0xf')][util[_0x1369('0x61')](_0x1369('0x6c'),_0x51ec96['name'])][_0x1369('0x2e')]==='unmonitored');};Fax[_0x1369('0x1c')][_0x1369('0x6d')]=function(_0x172a1f,_0x280c70){if(!this[_0x1369('0x69')](_0x172a1f)){ut['logger'](_0x1369('0x6e'),_[_0x1369('0x6a')](_0x172a1f)?'':_0x172a1f[_0x1369('0x24')]+_0x1369('0x6f'));return{'isValid':![],'message':_0x1369('0x70')};}if(_[_0x1369('0x6a')](_0x280c70[_0x1369('0x40')])){ut[_0x1369('0x4c')](_0x1369('0x71'),JSON['stringify'](_0x280c70));return{'isValid':![],'message':_0x1369('0x72')};}if(_[_0x1369('0x6a')](_0x280c70['path'])){ut[_0x1369('0x4c')]('[Fax][checkTrunk][Empty\x20path]',JSON['stringify'](_0x280c70));return{'isValid':![],'message':_0x1369('0x73')};}return{'isValid':!![],'message':_0x1369('0x74')};};module[_0x1369('0x75')]=Fax; \ No newline at end of file +var _0x768c=['channelstatedesc','value','status','filename','\x20syncFaxStatus\x20','remotestationid','resolution','transferrate','calleridnum','pagestransferred','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','unmonitored','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','syncVarSet','bind','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','hasOwnProperty','syncNewState','channelstate'];(function(_0x3aafbc,_0x2c449a){var _0x151a9c=function(_0x390fcd){while(--_0x390fcd){_0x3aafbc['push'](_0x3aafbc['shift']());}};_0x151a9c(++_0x2c449a);}(_0x768c,0x139));var _0xc768=function(_0xe98cc9,_0x2974e6){_0xe98cc9=_0xe98cc9-0x0;var _0xce87e5=_0x768c[_0xe98cc9];return _0xce87e5;};'use strict';var util=require(_0xc768('0x0'));var _=require(_0xc768('0x1'));var BPromise=require(_0xc768('0x2'));var uuid=require(_0xc768('0x3'));var moment=require(_0xc768('0x4'));var path=require(_0xc768('0x5'));var tiff2pdf=require(_0xc768('0x6'));var gs=require(_0xc768('0x7'));var logger=require(_0xc768('0x8'))(_0xc768('0x9'));var ami=require('../ami');var rpcDb=require(_0xc768('0xa'));var Channel=require(_0xc768('0xb'));var ut=require(_0xc768('0xc'));var Action=require(_0xc768('0xd'));var faxAccount=require(_0xc768('0xe'));var attachment=require(_0xc768('0xf'));var faxMessage=require(_0xc768('0x10'));function Fax(_0x827fc0){this[_0xc768('0x11')]={};this[_0xc768('0x12')]=_0x827fc0[_0xc768('0x12')];this[_0xc768('0x13')]=_0x827fc0[_0xc768('0x13')];this[_0xc768('0x14')]={};ami['on']('newchannel',this[_0xc768('0x15')]['bind'](this));ami['on']('varset',this[_0xc768('0x16')][_0xc768('0x17')](this));ami['on']('newstate',this['syncNewState']['bind'](this));ami['on'](_0xc768('0x18'),this[_0xc768('0x19')][_0xc768('0x17')](this));ami['on'](_0xc768('0x1a'),this[_0xc768('0x1b')][_0xc768('0x17')](this));ami['on']('receivefax',this[_0xc768('0x1c')][_0xc768('0x17')](this));ami['on'](_0xc768('0x1d'),this[_0xc768('0x1e')]['bind'](this));ami['on'](_0xc768('0x1f'),this[_0xc768('0x20')]['bind'](this));}Fax[_0xc768('0x21')][_0xc768('0x15')]=function(_0x169bf8){if(_0x169bf8[_0xc768('0x22')]===_0xc768('0x23')){for(var _0x1b0079 in this[_0xc768('0x12')]){if(this[_0xc768('0x12')]['hasOwnProperty'](_0x1b0079)){if(_0x169bf8[_0xc768('0x24')]===this[_0xc768('0x12')][_0x1b0079][_0xc768('0x25')]){this['channels'][_0x169bf8['uniqueid']]={};this[_0xc768('0x11')][_0x169bf8[_0xc768('0x26')]][_0xc768('0x27')]=_0x169bf8[_0xc768('0x27')];this[_0xc768('0x11')][_0x169bf8['uniqueid']]['id']=this['faxAccounts'][_0x1b0079]['id'];this[_0xc768('0x11')][_0x169bf8[_0xc768('0x26')]][_0xc768('0x28')]=this[_0xc768('0x12')][_0x1b0079][_0xc768('0x28')];logger[_0xc768('0x29')](_0x169bf8[_0xc768('0x26')],_0xc768('0x2a'));}}}}if(this['actions'][_0x169bf8['uniqueid']]){this['channels'][_0x169bf8[_0xc768('0x26')]]={};this[_0xc768('0x11')][_0x169bf8[_0xc768('0x26')]]['channel']=_0x169bf8[_0xc768('0x27')];logger[_0xc768('0x29')](_0x169bf8[_0xc768('0x26')],_0xc768('0x2a'));}};Fax['prototype'][_0xc768('0x16')]=function(_0x506dbb){if(this[_0xc768('0x11')][_0x506dbb[_0xc768('0x26')]]){for(var _0xf5e3ab in _0x506dbb[_0xc768('0x2b')]){if(_0x506dbb['variable'][_0xc768('0x2c')](_0xf5e3ab)){this[_0xc768('0x11')][_0x506dbb[_0xc768('0x26')]][_0xf5e3ab]=_0x506dbb['value'];}}}};Fax[_0xc768('0x21')][_0xc768('0x2d')]=function(_0x4be543){if(this[_0xc768('0x11')][_0x4be543['uniqueid']]){this[_0xc768('0x11')][_0x4be543['uniqueid']][_0xc768('0x2e')]=_0x4be543[_0xc768('0x2e')];this[_0xc768('0x11')][_0x4be543['uniqueid']][_0xc768('0x2f')]=_0x4be543[_0xc768('0x2f')];}};Fax[_0xc768('0x21')][_0xc768('0x19')]=function(_0x22d481){if(this['channels'][_0x22d481['uniqueid']]){for(var _0x228cf1 in _0x22d481[_0xc768('0x2b')]){if(_0x22d481[_0xc768('0x2b')][_0xc768('0x2c')](_0x228cf1)){this[_0xc768('0x11')][_0x22d481[_0xc768('0x26')]][_0x228cf1]=_0x22d481[_0xc768('0x30')];}}}};Fax[_0xc768('0x21')][_0xc768('0x1b')]=function(_0xab7720){if(this[_0xc768('0x11')][_0xab7720['uniqueid']]){this[_0xc768('0x11')][_0xab7720[_0xc768('0x26')]]['operation']=_0xab7720['operation'];this['channels'][_0xab7720[_0xc768('0x26')]][_0xc768('0x31')]=_0xab7720[_0xc768('0x31')];this[_0xc768('0x11')][_0xab7720[_0xc768('0x26')]][_0xc768('0x25')]=_0xab7720[_0xc768('0x25')];this[_0xc768('0x11')][_0xab7720[_0xc768('0x26')]][_0xc768('0x32')]=_0xab7720['filename'];logger['info'](_0xab7720[_0xc768('0x26')],_0xc768('0x33'));}};Fax['prototype']['syncReceiveFax']=function(_0x5b8595){var _0x54b1e7=this;if(this[_0xc768('0x11')][_0x5b8595[_0xc768('0x26')]]){var _0x220ae5=this[_0xc768('0x11')][_0x5b8595[_0xc768('0x26')]]['id'];this[_0xc768('0x11')][_0x5b8595[_0xc768('0x26')]][_0xc768('0x34')]=_0x5b8595[_0xc768('0x34')];this[_0xc768('0x11')][_0x5b8595[_0xc768('0x26')]]['pagestransferred']=_0x5b8595['pagestransferred'];this[_0xc768('0x11')][_0x5b8595['uniqueid']][_0xc768('0x25')]=_0x5b8595[_0xc768('0x25')];this[_0xc768('0x11')][_0x5b8595[_0xc768('0x26')]]['resolution']=_0x5b8595[_0xc768('0x35')];this[_0xc768('0x11')][_0x5b8595['uniqueid']]['transferrate']=_0x5b8595[_0xc768('0x36')];this[_0xc768('0x11')][_0x5b8595[_0xc768('0x26')]]['filename']=_0x5b8595[_0xc768('0x32')];this[_0xc768('0x11')][_0x5b8595[_0xc768('0x26')]]['calleridnum']=_0x5b8595[_0xc768('0x37')];if(this[_0xc768('0x11')][_0x5b8595[_0xc768('0x26')]][_0xc768('0x38')]>0x0){tiff2pdf(_0x5b8595[_0xc768('0x32')],_0xc768('0x39'),function(_0x2db527){logger[_0xc768('0x29')](_0x5b8595[_0xc768('0x26')],_0xc768('0x3a'),_0x2db527[_0xc768('0x3b')]);attachment[_0xc768('0x3c')]({'name':path[_0xc768('0x3d')](_0x5b8595[_0xc768('0x32')])[_0xc768('0x28')],'basename':path[_0xc768('0x3d')](_0x5b8595[_0xc768('0x32')])[_0xc768('0x28')]+_0xc768('0x3e'),'type':_0xc768('0x3f')})['then'](function(_0xe00537){faxAccount['notify'](_0x220ae5,{'from':_0x5b8595[_0xc768('0x37')],'mapKey':'fax','body':path[_0xc768('0x3d')](_0x5b8595[_0xc768('0x32')])[_0xc768('0x28')]+_0xc768('0x3e'),'AttachmentId':_0xe00537['id']})[_0xc768('0x40')](function(_0x44627d){logger[_0xc768('0x41')](_0x5b8595[_0xc768('0x26')],_0xc768('0x42'),JSON['stringify'](_0x44627d));});})['catch'](function(_0x4012e1){logger['error'](_0x5b8595['uniqueid'],_0xc768('0x43'),JSON[_0xc768('0x44')](_0x4012e1));});});}logger[_0xc768('0x29')](_0x5b8595[_0xc768('0x26')],_0xc768('0x43'));}};Fax['prototype'][_0xc768('0x20')]=function(_0x5eaa42){if(this[_0xc768('0x14')][_0x5eaa42['uniqueid']]){_['merge'](this[_0xc768('0x11')][_0x5eaa42[_0xc768('0x26')]],_[_0xc768('0x45')](_0x5eaa42,[_0xc768('0x46'),_0xc768('0x47')]));}};function updateStatus(_0x359f10){if(_0x359f10[_0xc768('0x48')]){faxMessage[_0xc768('0x49')](_0x359f10[_0xc768('0x48')],{'failMessage':_0xc768('0x4a')})[_0xc768('0x4b')](function(_0x349972){ut['logger'](_0xc768('0x4c'),_0x349972);})[_0xc768('0x40')](function(_0xecc342){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0xecc342);});}else{ut[_0xc768('0x4d')](_0xc768('0x4e'));}}Fax['prototype'][_0xc768('0x4f')]=function(_0x53c0b2,_0x426030,_0x184afb){var _0x286958=this;var _0x428413={};if(_0x426030){_0x428413={'read':_0x426030};}else{_0x428413={'failMessage':_0x184afb};}if(this[_0xc768('0x14')][_0x53c0b2]['AttachmentId']){faxMessage[_0xc768('0x49')](this[_0xc768('0x14')][_0x53c0b2]['AttachmentId'],_0x428413)[_0xc768('0x4b')](function(_0x59736a){ut[_0xc768('0x4d')](_0xc768('0x50'),_0x59736a);})[_0xc768('0x40')](function(_0x299f75){ut[_0xc768('0x4d')](_0xc768('0x51'),_0x299f75);})['finally'](function(){delete _0x286958[_0xc768('0x11')][_0x53c0b2];delete _0x286958[_0xc768('0x14')][_0x53c0b2];});}else{ut[_0xc768('0x4d')](_0xc768('0x52'));delete this[_0xc768('0x11')][_0x53c0b2];delete this['actions'][_0x53c0b2];}};Fax[_0xc768('0x21')][_0xc768('0x1e')]=function(_0x5d89b8){var _0x4bf291=this;if(this['channels'][_0x5d89b8[_0xc768('0x26')]]){if(this['actions'][_0x5d89b8['uniqueid']]){this[_0xc768('0x11')][_0x5d89b8[_0xc768('0x26')]]['id']=this['actions'][_0x5d89b8['uniqueid']]['id'];this[_0xc768('0x11')][_0x5d89b8['uniqueid']][_0xc768('0x28')]=this[_0xc768('0x14')][_0x5d89b8['uniqueid']][_0xc768('0x28')];}logger[_0xc768('0x29')](_0x5d89b8['uniqueid'],this[_0xc768('0x14')][_0x5d89b8[_0xc768('0x26')]]?_0xc768('0x53'):_0xc768('0x54'),JSON[_0xc768('0x44')](this[_0xc768('0x11')][_0x5d89b8[_0xc768('0x26')]]));if(this[_0xc768('0x14')][_0x5d89b8[_0xc768('0x26')]]){if(this[_0xc768('0x11')][_0x5d89b8[_0xc768('0x26')]][_0xc768('0x55')]>0x0&&this[_0xc768('0x11')][_0x5d89b8[_0xc768('0x26')]][_0xc768('0x1a')]===_0xc768('0x56')){this[_0xc768('0x4f')](_0x5d89b8[_0xc768('0x26')],!![]);}else{this[_0xc768('0x4f')](_0x5d89b8[_0xc768('0x26')],![],this[_0xc768('0x11')][_0x5d89b8['uniqueid']][_0xc768('0x57')]?_0xc768('0x58')+this[_0xc768('0x11')][_0x5d89b8[_0xc768('0x26')]][_0xc768('0x57')]:_0xc768('0x59'));}}}};Fax[_0xc768('0x21')]['send']=function(_0x4f50d9){var _0x526c06=this;return new BPromise(function(_0x44769c,_0x5a2472){_0x526c06['execOriginate'](_0x4f50d9,_0x526c06[_0xc768('0x12')][_0x4f50d9[_0xc768('0x5a')]])[_0xc768('0x4b')](function(_0x344236){ut[_0xc768('0x4d')](_0xc768('0x5b'),_0x344236);_0x44769c(ut[_0xc768('0x3b')](_0xc768('0x5c')));})[_0xc768('0x40')](function(_0x34bad8){ut['logger'](_0xc768('0x5d'),_0x34bad8);updateStatus(_0x4f50d9);_0x5a2472(ut['message'](_0xc768('0x5e')));});});};Fax[_0xc768('0x21')][_0xc768('0x5f')]=function(_0x23a78f){var _0x403a80=this;return new BPromise(function(_0x283ac3,_0x316716){var _0x333cac=_0x403a80[_0xc768('0x60')](_0x403a80['faxAccounts'][_0x23a78f[_0xc768('0x5a')]][_0xc768('0x61')],_0x23a78f);if(_0x333cac[_0xc768('0x62')]){_0x283ac3(ut['message'](_0xc768('0x63')));}else{_0x316716(ut[_0xc768('0x3b')](_0x333cac['message']));}});};function originate(_0x22b225,_0x4be187,_0x4cdc2c){return new BPromise(function(_0x341d3c,_0xbe5094){if(_0x4cdc2c){var _0x50b4ca=util[_0xc768('0x64')](_0xc768('0x65'),path['parse'](_0x22b225[_0xc768('0x5')])[_0xc768('0x28')],_0x22b225['path']);gs['execute'](_0x50b4ca)['then'](function(){_0x22b225['path']=util[_0xc768('0x64')](_0xc768('0x66'),path[_0xc768('0x3d')](_0x22b225[_0xc768('0x5')])[_0xc768('0x67')],path[_0xc768('0x3d')](_0x22b225[_0xc768('0x5')])[_0xc768('0x28')]);_0x4be187['XMF-PATH']=_0x22b225[_0xc768('0x5')];ut[_0xc768('0x4d')](_0xc768('0x68'),'');ami[_0xc768('0x69')](ut['variablesAction'](_0x22b225,_0x4be187))[_0xc768('0x4b')](function(_0x399cb2){_0x341d3c(_0x399cb2);})[_0xc768('0x40')](function(_0x3d2e08){_0xbe5094(_0x3d2e08);});})[_0xc768('0x40')](function(_0x44244c){_0xbe5094(_0x44244c);});}else{ami[_0xc768('0x69')](ut[_0xc768('0x6a')](_0x22b225,_0x4be187))[_0xc768('0x4b')](function(_0x47e746){_0x341d3c(_0x47e746);})['catch'](function(_0x5784e7){_0xbe5094(_0x5784e7);});}});}Fax['prototype'][_0xc768('0x6b')]=function(_0x1d7984,_0x3ed646){var _0x342add=this;return new BPromise(function(_0x3177f1,_0x1d964a){var _0x28741e=uuid['v4']();var _0x5658f2=ut[_0xc768('0x6c')](_0x1d7984,_0x3ed646);_0x342add[_0xc768('0x14')][_0x28741e]=new Action(_0x28741e,_0x3ed646,_0x1d7984);var _0x3d1066=_0x342add[_0xc768('0x14')][_0x28741e];if(path['parse'](_0x1d7984[_0xc768('0x5')])[_0xc768('0x6d')]==='.pdf'){originate(_0x3d1066,_0x5658f2,!![])[_0xc768('0x4b')](function(_0x1da979){_0x3177f1(_0x1da979);})[_0xc768('0x40')](function(_0x28a66e){_0x1d964a(_0x28a66e);});}else{originate(_0x3d1066,_0x5658f2,![])[_0xc768('0x4b')](function(_0x33c6cf){_0x3177f1(_0x33c6cf);})[_0xc768('0x40')](function(_0x3204ac){_0x1d964a(_0x3204ac);});}});};Fax[_0xc768('0x21')][_0xc768('0x6e')]=function(_0x3fc489){return!_[_0xc768('0x6f')](_0x3fc489)&&!_[_0xc768('0x6f')](_0x3fc489[_0xc768('0x28')])&&!_['isNil'](_0x3fc489[_0xc768('0x70')])&&_0x3fc489[_0xc768('0x70')]&&!_[_0xc768('0x6f')](this[_0xc768('0x13')][util[_0xc768('0x64')](_0xc768('0x71'),_0x3fc489[_0xc768('0x28')])])&&!_[_0xc768('0x6f')](this['trunks'][util['format'](_0xc768('0x71'),_0x3fc489['name'])]['status'])&&(this['trunks'][util[_0xc768('0x64')]('SIP/%s',_0x3fc489[_0xc768('0x28')])][_0xc768('0x31')]==='reachable'||this[_0xc768('0x13')][util[_0xc768('0x64')](_0xc768('0x71'),_0x3fc489['name'])][_0xc768('0x31')]===_0xc768('0x72'));};Fax['prototype']['checkTrunk']=function(_0x58cd77,_0x562197){if(!this['isTrunkReachable'](_0x58cd77)){ut[_0xc768('0x4d')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0xc768('0x6f')](_0x58cd77)?'':_0x58cd77[_0xc768('0x28')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0xc768('0x6f')](_0x562197['fax'])){ut[_0xc768('0x4d')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xc768('0x44')](_0x562197));return{'isValid':![],'message':_0xc768('0x73')};}if(_[_0xc768('0x6f')](_0x562197[_0xc768('0x5')])){ut[_0xc768('0x4d')](_0xc768('0x74'),JSON[_0xc768('0x44')](_0x562197));return{'isValid':![],'message':_0xc768('0x75')};}return{'isValid':!![],'message':_0xc768('0x76')};};module[_0xc768('0x77')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index acf7f23..4a99ab5 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 _0x063d=['notify','catch','[Notify]\x20','util','bluebird','../../../config/logger','../rpc/faxAccount','inspect'];(function(_0x77d76e,_0x106ed2){var _0x5620c8=function(_0x481b37){while(--_0x481b37){_0x77d76e['push'](_0x77d76e['shift']());}};_0x5620c8(++_0x106ed2);}(_0x063d,0xbb));var _0xd063=function(_0x42cd10,_0x582044){_0x42cd10=_0x42cd10-0x0;var _0x22a6b6=_0x063d[_0x42cd10];return _0x22a6b6;};'use strict';var util=require(_0xd063('0x0'));var BPromise=require(_0xd063('0x1'));var logger=require(_0xd063('0x2'))('preview');var _=require('lodash');var faxAccount=require(_0xd063('0x3'));function loggerCatch(_0x3f27eb){return function(_0x118984){logger['error'](_0x3f27eb,util[_0xd063('0x4')](_0x118984,{'showHidden':![],'depth':null}));};}exports[_0xd063('0x5')]=function(_0x4d1994,_0x5dd4e0){return BPromise['resolve']()['then'](faxAccount['notify'](_0x4d1994,_0x5dd4e0))[_0xd063('0x6')](loggerCatch(_0xd063('0x7')));}; \ No newline at end of file +var _0xf4f5=['resolve','then','catch','[Notify]\x20','bluebird','preview','lodash','../rpc/faxAccount','error','inspect','notify'];(function(_0x33dc27,_0x43321d){var _0x14c0e2=function(_0x19b890){while(--_0x19b890){_0x33dc27['push'](_0x33dc27['shift']());}};_0x14c0e2(++_0x43321d);}(_0xf4f5,0x138));var _0x5f4f=function(_0x12b286,_0x4aa5e5){_0x12b286=_0x12b286-0x0;var _0x50236a=_0xf4f5[_0x12b286];return _0x50236a;};'use strict';var util=require('util');var BPromise=require(_0x5f4f('0x0'));var logger=require('../../../config/logger')(_0x5f4f('0x1'));var _=require(_0x5f4f('0x2'));var faxAccount=require(_0x5f4f('0x3'));function loggerCatch(_0x4213e4){return function(_0x5a689e){logger[_0x5f4f('0x4')](_0x4213e4,util[_0x5f4f('0x5')](_0x5a689e,{'showHidden':![],'depth':null}));};}exports[_0x5f4f('0x6')]=function(_0x814010,_0x5099bc){return BPromise[_0x5f4f('0x7')]()[_0x5f4f('0x8')](faxAccount['notify'](_0x814010,_0x5099bc))[_0x5f4f('0x9')](loggerCatch(_0x5f4f('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index c0a8887..472ea80 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 _0x19f1=['info','Exec\x20gs','inspect','util','../../../../config/logger','fax','bluebird','child_process','exec','execute'];(function(_0x3e8a58,_0x59660e){var _0x5d165a=function(_0x2e179b){while(--_0x2e179b){_0x3e8a58['push'](_0x3e8a58['shift']());}};_0x5d165a(++_0x59660e);}(_0x19f1,0x143));var _0x119f=function(_0x1809d4,_0x2fd2b0){_0x1809d4=_0x1809d4-0x0;var _0x41d9f4=_0x19f1[_0x1809d4];return _0x41d9f4;};'use strict';var util=require(_0x119f('0x0'));var logger=require(_0x119f('0x1'))(_0x119f('0x2'));var BPromise=require(_0x119f('0x3'));var exec=require(_0x119f('0x4'))[_0x119f('0x5')];exports[_0x119f('0x6')]=function(_0x1f8b16){return new BPromise(function(_0x358bfb,_0xcbfa13){exec(_0x1f8b16,function(_0x51159b,_0x391984,_0x3461f1){logger[_0x119f('0x7')]('Exec\x20gs',_0x391984);if(_0x51159b){logger['info'](_0x119f('0x8'),'\x20Error\x20:',util[_0x119f('0x9')](_0x51159b,{'showHidden':![],'depth':null}),_0x391984,_0x3461f1);_0xcbfa13(_0x51159b);}_0x358bfb(_0x391984);});});}; \ No newline at end of file +var _0xf0b7=['execute','info','Exec\x20gs','inspect','util','../../../../config/logger','fax','child_process'];(function(_0x5c0986,_0xa66530){var _0x5a08e7=function(_0x1a6d2d){while(--_0x1a6d2d){_0x5c0986['push'](_0x5c0986['shift']());}};_0x5a08e7(++_0xa66530);}(_0xf0b7,0x15c));var _0x7f0b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf0b7[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x7f0b('0x0'));var logger=require(_0x7f0b('0x1'))(_0x7f0b('0x2'));var BPromise=require('bluebird');var exec=require(_0x7f0b('0x3'))['exec'];exports[_0x7f0b('0x4')]=function(_0x534830){return new BPromise(function(_0x18f17a,_0x4dab35){exec(_0x534830,function(_0x4266d4,_0x3a7b86,_0x1eef76){logger[_0x7f0b('0x5')](_0x7f0b('0x6'),_0x3a7b86);if(_0x4266d4){logger[_0x7f0b('0x5')](_0x7f0b('0x6'),'\x20Error\x20:',util[_0x7f0b('0x7')](_0x4266d4,{'showHidden':![],'depth':null}),_0x3a7b86,_0x1eef76);_0x4dab35(_0x4266d4);}_0x18f17a(_0x3a7b86);});});}; \ 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 c0f77c8..cadcbd9 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 _0xff1c=['fax','message','info','inspect','addVariables','headerinfo','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','util','moment'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xff1c,0x185));var _0xcff1=function(_0x44f914,_0x36060b){_0x44f914=_0x44f914-0x0;var _0x7f34f6=_0xff1c[_0x44f914];return _0x7f34f6;};'use strict';var util=require(_0xcff1('0x0'));var _=require('lodash');var moment=require(_0xcff1('0x1'));var logger=require('../../../../config/logger')(_0xcff1('0x2'));exports[_0xcff1('0x3')]=function(_0x2811f1){return{'message':_0x2811f1};};exports['logger']=function(_0x5477cc,_0x244b1b){logger[_0xcff1('0x4')](_0x5477cc,util[_0xcff1('0x5')](_0x244b1b,{'showHidden':![],'depth':null}));};exports[_0xcff1('0x6')]=function(_0x4c287c,_0x22cb3c){var _0x4cdf81={'XMF-ECM':_0x22cb3c['ecm'],'XMF-HEADERINFO':_0x22cb3c[_0xcff1('0x7')],'XMF-MINRATE':_0x22cb3c['minrate'],'XMF-MAXRATE':_0x22cb3c['maxrate'],'XMF-MODEM':util[_0xcff1('0x8')](_0xcff1('0x9'),_0x22cb3c[_0xcff1('0xa')]),'XMF-GATEWAY':_0x22cb3c[_0xcff1('0xb')],'XMF-FAXDETECT':_0x22cb3c[_0xcff1('0xc')],'XMF-T38TIMEOUT':_0x22cb3c[_0xcff1('0xd')],'XMF-LOCALSTATIONID':_0x22cb3c[_0xcff1('0xe')],'XMF-PATH':_0x4c287c[_0xcff1('0xf')]};return _0x4cdf81;};exports[_0xcff1('0x10')]=function(_0x2a411f,_0xc51cd6){return{'actionid':_0x2a411f[_0xcff1('0x11')],'action':_0xcff1('0x12'),'channel':_0x2a411f[_0xcff1('0x13')],'Exten':_0xcff1('0x14'),'Context':_0xcff1('0x15'),'Priority':'1','callerid':util[_0xcff1('0x8')](_0xcff1('0x16'),_0x2a411f['headerinfo']?_0x2a411f[_0xcff1('0x7')]:'',_0x2a411f['localstationid']),'variable':_0xc51cd6,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2a411f[_0xcff1('0x11')]};}; \ No newline at end of file +var _0xac43=['from-sip','util','lodash','moment','logger','info','inspect','ecm','headerinfo','minrate','format','\x22%s\x22','modem','t38timeout','localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax'];(function(_0x857d3c,_0x20cd2d){var _0x1dad9b=function(_0x220d2c){while(--_0x220d2c){_0x857d3c['push'](_0x857d3c['shift']());}};_0x1dad9b(++_0x20cd2d);}(_0xac43,0xd3));var _0x3ac4=function(_0x38f3d9,_0x36af17){_0x38f3d9=_0x38f3d9-0x0;var _0x48ec0f=_0xac43[_0x38f3d9];return _0x48ec0f;};'use strict';var util=require(_0x3ac4('0x0'));var _=require(_0x3ac4('0x1'));var moment=require(_0x3ac4('0x2'));var logger=require('../../../../config/logger')('fax');exports['message']=function(_0x26fe41){return{'message':_0x26fe41};};exports[_0x3ac4('0x3')]=function(_0xe4236a,_0x14fe6d){logger[_0x3ac4('0x4')](_0xe4236a,util[_0x3ac4('0x5')](_0x14fe6d,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x998d9a,_0x1d738e){var _0x5e914d={'XMF-ECM':_0x1d738e[_0x3ac4('0x6')],'XMF-HEADERINFO':_0x1d738e[_0x3ac4('0x7')],'XMF-MINRATE':_0x1d738e[_0x3ac4('0x8')],'XMF-MAXRATE':_0x1d738e['maxrate'],'XMF-MODEM':util[_0x3ac4('0x9')](_0x3ac4('0xa'),_0x1d738e[_0x3ac4('0xb')]),'XMF-GATEWAY':_0x1d738e['gateway'],'XMF-FAXDETECT':_0x1d738e['faxdetect'],'XMF-T38TIMEOUT':_0x1d738e[_0x3ac4('0xc')],'XMF-LOCALSTATIONID':_0x1d738e[_0x3ac4('0xd')],'XMF-PATH':_0x998d9a[_0x3ac4('0xe')]};return _0x5e914d;};exports[_0x3ac4('0xf')]=function(_0x16f9f3,_0x306b61){return{'actionid':_0x16f9f3[_0x3ac4('0x10')],'action':_0x3ac4('0x11'),'channel':_0x16f9f3[_0x3ac4('0x12')],'Exten':_0x3ac4('0x13'),'Context':_0x3ac4('0x14'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x16f9f3['headerinfo']?_0x16f9f3[_0x3ac4('0x7')]:'',_0x16f9f3['localstationid']),'variable':_0x306b61,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x16f9f3['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index d5b288c..7a293b5 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 _0x458e=['sync','util','moment','./server','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','catch','log'];(function(_0x210f48,_0x585ad0){var _0x2f421f=function(_0x279f27){while(--_0x279f27){_0x210f48['push'](_0x210f48['shift']());}};_0x2f421f(++_0x585ad0);}(_0x458e,0xc7));var _0xe458=function(_0x3c3e92,_0x539b90){_0x3c3e92=_0x3c3e92-0x0;var _0x3a545c=_0x458e[_0x3c3e92];return _0x3a545c;};'use strict';var BPromise=require('bluebird');var util=require(_0xe458('0x0'));var moment=require(_0xe458('0x1'));var server=require(_0xe458('0x2'));var Realtime=require('./realtime');var Report=require(_0xe458('0x3'));var Acw=require(_0xe458('0x4'));var Trigger=require(_0xe458('0x5'));var Dialer=require(_0xe458('0x6'));var Preview=require(_0xe458('0x7'));var Fax=require(_0xe458('0x8'));var user=require(_0xe458('0x9'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xe458('0xa'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xe458('0xb'));var trigger=require(_0xe458('0xc'));var template=require(_0xe458('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xe458('0xe'));var voiceExtension=require(_0xe458('0xf'));var faxAccount=require('./rpc/faxAccount');var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xe458('0x10'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xe458('0x11'));var desk=require(_0xe458('0x12'));var zoho=require(_0xe458('0x13'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xe458('0x14'));var servicenow=require(_0xe458('0x15'));var dynamics365=require(_0xe458('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xe458('0x17')](_0xe458('0x18'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xe458('0x17')](_0xe458('0x18'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0xe458('0x19')](user[_0xe458('0x1a')]())[_0xe458('0x19')](realtime[_0xe458('0x1b')]())['then'](user[_0xe458('0x1c')]())[_0xe458('0x19')](realtime[_0xe458('0x1d')]())[_0xe458('0x19')](trunk[_0xe458('0x1e')]())[_0xe458('0x19')](realtime[_0xe458('0x1f')]())['then'](voiceQueue[_0xe458('0x20')]())[_0xe458('0x19')](realtime[_0xe458('0x21')]())['then'](trigger[_0xe458('0x22')]())[_0xe458('0x19')](realtime['initTriggers']())['then'](template['getTemplates']())[_0xe458('0x19')](realtime[_0xe458('0x23')]())[_0xe458('0x19')](zendesk[_0xe458('0x24')]())[_0xe458('0x19')](realtime['initZendeskAccounts']())[_0xe458('0x19')](salesforce[_0xe458('0x25')]())[_0xe458('0x19')](realtime[_0xe458('0x26')]())['then'](sugarcrm[_0xe458('0x27')]())[_0xe458('0x19')](realtime[_0xe458('0x28')]())[_0xe458('0x19')](freshdesk[_0xe458('0x29')]())[_0xe458('0x19')](realtime[_0xe458('0x2a')]())[_0xe458('0x19')](desk[_0xe458('0x2b')]())[_0xe458('0x19')](realtime['initDeskAccounts']())[_0xe458('0x19')](zoho[_0xe458('0x2c')]())[_0xe458('0x19')](realtime['initZohoAccounts']())['then'](vtiger[_0xe458('0x2d')]())[_0xe458('0x19')](realtime[_0xe458('0x2e')]())[_0xe458('0x19')](freshsales[_0xe458('0x2f')]())[_0xe458('0x19')](realtime['initFreshsalesAccounts']())[_0xe458('0x19')](servicenow[_0xe458('0x30')]())['then'](realtime[_0xe458('0x31')]())['then'](dynamics365[_0xe458('0x32')]())[_0xe458('0x19')](realtime['initDynamics365Accounts']())['then'](campaign[_0xe458('0x33')]())[_0xe458('0x19')](realtime[_0xe458('0x34')]())[_0xe458('0x19')](voiceExtension['getVoiceExtensions']())[_0xe458('0x19')](realtime[_0xe458('0x35')]())[_0xe458('0x19')](faxAccount[_0xe458('0x36')]())['then'](realtime[_0xe458('0x37')]())[_0xe458('0x19')](function(){return realtime;});}function initParams(){return BPromise[_0xe458('0x38')]()[_0xe458('0x19')](voiceQueueReport[_0xe458('0x39')]())[_0xe458('0x19')](realtime[_0xe458('0x3a')]())['then'](cmHopperHistory[_0xe458('0x3b')]())[_0xe458('0x19')](realtime[_0xe458('0x3c')]())[_0xe458('0x19')](cmHopperHistory[_0xe458('0x3d')]())[_0xe458('0x19')](realtime['initCampaignHopperHistory']())[_0xe458('0x19')](voiceCallReport[_0xe458('0x3e')]())['then'](realtime['initVoiceCallReports']())['then'](function(_0x3a96e4){})[_0xe458('0x3f')](function(_0x1aad98){console[_0xe458('0x40')](_0x1aad98);});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x415342){return initRealtime();})[_0xe458('0x19')](function(){return initParams();})[_0xe458('0x19')](function(){report[_0xe458('0x41')]();setInterval(initRealtime,0x1388);})[_0xe458('0x3f')](function(_0x37390c){console[_0xe458('0x40')](_0x37390c);});}main(); \ No newline at end of file +var _0x8612=['getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initVoiceCallReports','catch','listen','sync','log','bluebird','./server','./realtime','./acw','./trigger','./rpc/user','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates'];(function(_0x5b5c7b,_0x39560a){var _0x42b617=function(_0x539202){while(--_0x539202){_0x5b5c7b['push'](_0x5b5c7b['shift']());}};_0x42b617(++_0x39560a);}(_0x8612,0x99));var _0x2861=function(_0x563441,_0x24dbc6){_0x563441=_0x563441-0x0;var _0x590a1a=_0x8612[_0x563441];return _0x590a1a;};'use strict';var BPromise=require(_0x2861('0x0'));var util=require('util');var moment=require('moment');var server=require(_0x2861('0x1'));var Realtime=require(_0x2861('0x2'));var Report=require('./report');var Acw=require(_0x2861('0x3'));var Trigger=require(_0x2861('0x4'));var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require('./fax');var user=require(_0x2861('0x5'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x2861('0x6'));var trunk=require(_0x2861('0x7'));var trigger=require(_0x2861('0x8'));var template=require('./rpc/template');var cmHopperHistory=require(_0x2861('0x9'));var campaign=require(_0x2861('0xa'));var voiceExtension=require(_0x2861('0xb'));var faxAccount=require(_0x2861('0xc'));var zendesk=require(_0x2861('0xd'));var salesforce=require(_0x2861('0xe'));var sugarcrm=require(_0x2861('0xf'));var freshdesk=require(_0x2861('0x10'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x2861('0x11'));var vtiger=require(_0x2861('0x12'));var freshsales=require(_0x2861('0x13'));var servicenow=require(_0x2861('0x14'));var dynamics365=require(_0x2861('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()[_0x2861('0x16')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x2861('0x16')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x2861('0x17')](user[_0x2861('0x18')]())[_0x2861('0x17')](realtime[_0x2861('0x19')]())[_0x2861('0x17')](user[_0x2861('0x1a')]())[_0x2861('0x17')](realtime[_0x2861('0x1b')]())[_0x2861('0x17')](trunk[_0x2861('0x1c')]())['then'](realtime['initTrunks']())[_0x2861('0x17')](voiceQueue[_0x2861('0x1d')]())[_0x2861('0x17')](realtime[_0x2861('0x1e')]())['then'](trigger['getTriggers']())[_0x2861('0x17')](realtime[_0x2861('0x1f')]())[_0x2861('0x17')](template[_0x2861('0x20')]())[_0x2861('0x17')](realtime['initTemplates']())[_0x2861('0x17')](zendesk[_0x2861('0x21')]())[_0x2861('0x17')](realtime[_0x2861('0x22')]())[_0x2861('0x17')](salesforce[_0x2861('0x23')]())['then'](realtime[_0x2861('0x24')]())[_0x2861('0x17')](sugarcrm['getSugarcrmAccounts']())[_0x2861('0x17')](realtime[_0x2861('0x25')]())['then'](freshdesk[_0x2861('0x26')]())['then'](realtime[_0x2861('0x27')]())['then'](desk['getDeskAccounts']())[_0x2861('0x17')](realtime[_0x2861('0x28')]())[_0x2861('0x17')](zoho['getZohoAccounts']())[_0x2861('0x17')](realtime['initZohoAccounts']())[_0x2861('0x17')](vtiger[_0x2861('0x29')]())['then'](realtime[_0x2861('0x2a')]())[_0x2861('0x17')](freshsales['getFreshsalesAccounts']())[_0x2861('0x17')](realtime[_0x2861('0x2b')]())[_0x2861('0x17')](servicenow[_0x2861('0x2c')]())[_0x2861('0x17')](realtime[_0x2861('0x2d')]())[_0x2861('0x17')](dynamics365[_0x2861('0x2e')]())[_0x2861('0x17')](realtime[_0x2861('0x2f')]())[_0x2861('0x17')](campaign['getCampaigns']())[_0x2861('0x17')](realtime[_0x2861('0x30')]())[_0x2861('0x17')](voiceExtension['getVoiceExtensions']())[_0x2861('0x17')](realtime[_0x2861('0x31')]())[_0x2861('0x17')](faxAccount[_0x2861('0x32')]())[_0x2861('0x17')](realtime[_0x2861('0x33')]())[_0x2861('0x17')](function(){return realtime;});}function initParams(){return BPromise[_0x2861('0x34')]()[_0x2861('0x17')](voiceQueueReport[_0x2861('0x35')]())['then'](realtime[_0x2861('0x36')]())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x2861('0x17')](realtime[_0x2861('0x37')]())[_0x2861('0x17')](cmHopperHistory[_0x2861('0x38')]())[_0x2861('0x17')](realtime['initCampaignHopperHistory']())[_0x2861('0x17')](voiceCallReport['getVoiceCallReports']())[_0x2861('0x17')](realtime[_0x2861('0x39')]())['then'](function(_0x17ec7b){})[_0x2861('0x3a')](function(_0x573cbf){console['log'](_0x573cbf);});}function main(){return server[_0x2861('0x3b')](realtime,preview,fax)[_0x2861('0x17')](function(_0x18c4d1){return initRealtime();})[_0x2861('0x17')](function(){return initParams();})['then'](function(){report[_0x2861('0x3c')]();setInterval(initRealtime,0x1388);})[_0x2861('0x3a')](function(_0x49163d){console[_0x2861('0x3d')](_0x49163d);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 1ffa916..ef8ad3e 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 _0x0713=['idle','inuse','talking','voiceStatusTime','toNumber','format','voiceStatusQueue','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusCallerIdNumber','onhold','local','prototype','state','toLowerCase','not_inuse'];(function(_0x2bf868,_0x3bf8e1){var _0x2e2293=function(_0xb3adcc){while(--_0xb3adcc){_0x2bf868['push'](_0x2bf868['shift']());}};_0x2e2293(++_0x3bf8e1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var md5=require(_0x3071('0x1'));var Redis=require(_0x3071('0x2'));var config=require(_0x3071('0x3'));config[_0x3071('0x4')]=_['defaults'](config[_0x3071('0x4')],{'host':_0x3071('0x5'),'port':0x18eb});var io=require(_0x3071('0x6'))(new Redis(config[_0x3071('0x4')]));function Agent(_0xabd7b6){this['id']=_0xabd7b6['id']||0x0;this[_0x3071('0x7')]=_0xabd7b6[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0xabd7b6[_0x3071('0x8')]||'';this[_0x3071('0x9')]=_0xabd7b6[_0x3071('0x9')]||'';this[_0x3071('0xa')]=_0xabd7b6[_0x3071('0xa')]||'';this['state']=_0x3071('0xb');this[_0x3071('0xc')]=0x0;this[_0x3071('0xd')]=_0x3071('0xb');this[_0x3071('0xe')]='';this['phone']='';this[_0x3071('0xf')]='';this[_0x3071('0x10')]='';this[_0x3071('0x11')]=_0xabd7b6[_0x3071('0x11')]||![];this[_0x3071('0x12')]='unknown';this['voiceStatusTime']=0x0;this[_0x3071('0x13')]='';this['voiceStatusQueue']='';this[_0x3071('0x14')]=![];this[_0x3071('0x15')]=![];this['md5']='';}Agent[_0x3071('0x16')]['updateStatusRealtime']=function(_0x2fc15d){var _0x45c93b;if(_0x2fc15d&&_0x2fc15d[_0x3071('0x17')]){_0x45c93b=_0x2fc15d[_0x3071('0x17')][_0x3071('0x18')]();switch(_0x45c93b){case _0x3071('0x19'):_0x45c93b=_0x3071('0x1a');break;case _0x3071('0x1b'):_0x45c93b=_0x3071('0x1c');break;}}if(_0x45c93b&&this[_0x3071('0x12')]!==_0x45c93b||_0x2fc15d['statePause']){this[_0x3071('0x1d')]=_[_0x3071('0x1e')](moment()[_0x3071('0x1f')]('x'));}if(_0x45c93b){this[_0x3071('0x12')]=_0x45c93b;}var _0x3acf0e={'id':this['id'],'name':this[_0x3071('0x7')],'email':this[_0x3071('0x8')],'accountcode':this[_0x3071('0x9')],'fullname':this['fullname'],'state':this[_0x3071('0x17')],'stateTime':this[_0x3071('0xc')],'status':this[_0x3071('0xd')],'address':this['address'],'online':this[_0x3071('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3071('0x1d')],'voiceStatusCallerIdNumber':this[_0x3071('0x13')],'voiceStatusQueue':this[_0x3071('0x20')],'interface':this[_0x3071('0x10')],'onhold':this[_0x3071('0x14')]};var _0x34c50e=md5(JSON[_0x3071('0x21')](_0x3acf0e));if(this[_0x3071('0x1')]!==_0x34c50e){this['md5']=_0x34c50e;io['to'](util['format'](_0x3071('0x22'),_0x3acf0e[_0x3071('0x7')]))[_0x3071('0x23')](_0x3071('0x24'),_0x3acf0e);io[_0x3071('0x23')](_0x3071('0x25'),_0x3acf0e);}};module[_0x3071('0x26')]=Agent; \ No newline at end of file +var _0x70e0=['name','voiceStatusQueue','onhold','stringify','md5','user:%s','user:save','emit','user:presence','lodash','util','moment','../../../config/environment','redis','defaults','socket.io-emitter','email','accountcode','fullname','state','unknown','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','local','toLowerCase','not_inuse','idle','inuse','statePause','toNumber','format'];(function(_0x101f99,_0x593f1a){var _0x1e55f7=function(_0x1e4ad4){while(--_0x1e4ad4){_0x101f99['push'](_0x101f99['shift']());}};_0x1e55f7(++_0x593f1a);}(_0x70e0,0x17b));var _0x070e=function(_0x15fe1c,_0x533beb){_0x15fe1c=_0x15fe1c-0x0;var _0x563a7e=_0x70e0[_0x15fe1c];return _0x563a7e;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x070e('0x3'));config[_0x070e('0x4')]=_[_0x070e('0x5')](config[_0x070e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x070e('0x6'))(new Redis(config['redis']));function Agent(_0x46fe68){this['id']=_0x46fe68['id']||0x0;this['name']=_0x46fe68['name']||'';this['email']=_0x46fe68[_0x070e('0x7')]||'';this[_0x070e('0x8')]=_0x46fe68[_0x070e('0x8')]||'';this[_0x070e('0x9')]=_0x46fe68[_0x070e('0x9')]||'';this[_0x070e('0xa')]=_0x070e('0xb');this['stateTime']=0x0;this['status']=_0x070e('0xb');this[_0x070e('0xc')]='';this[_0x070e('0xd')]='';this[_0x070e('0xe')]='';this[_0x070e('0xf')]='';this[_0x070e('0x10')]=_0x46fe68[_0x070e('0x10')]||![];this[_0x070e('0x11')]=_0x070e('0xb');this[_0x070e('0x12')]=0x0;this[_0x070e('0x13')]='';this['voiceStatusQueue']='';this['onhold']=![];this[_0x070e('0x14')]=![];this['md5']='';}Agent['prototype']['updateStatusRealtime']=function(_0x11d2ce){var _0x14c3fd;if(_0x11d2ce&&_0x11d2ce['state']){_0x14c3fd=_0x11d2ce['state'][_0x070e('0x15')]();switch(_0x14c3fd){case _0x070e('0x16'):_0x14c3fd=_0x070e('0x17');break;case _0x070e('0x18'):_0x14c3fd='talking';break;}}if(_0x14c3fd&&this['voiceStatus']!==_0x14c3fd||_0x11d2ce[_0x070e('0x19')]){this[_0x070e('0x12')]=_[_0x070e('0x1a')](moment()[_0x070e('0x1b')]('x'));}if(_0x14c3fd){this[_0x070e('0x11')]=_0x14c3fd;}var _0x5037eb={'id':this['id'],'name':this[_0x070e('0x1c')],'email':this[_0x070e('0x7')],'accountcode':this[_0x070e('0x8')],'fullname':this[_0x070e('0x9')],'state':this[_0x070e('0xa')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x070e('0x10')],'voiceStatus':this[_0x070e('0x11')],'voiceStatusTime':this[_0x070e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x070e('0x1d')],'interface':this['interface'],'onhold':this[_0x070e('0x1e')]};var _0x3f6985=md5(JSON[_0x070e('0x1f')](_0x5037eb));if(this[_0x070e('0x20')]!==_0x3f6985){this[_0x070e('0x20')]=_0x3f6985;io['to'](util[_0x070e('0x1b')](_0x070e('0x21'),_0x5037eb[_0x070e('0x1c')]))['emit'](_0x070e('0x22'),_0x5037eb);io[_0x070e('0x23')](_0x070e('0x24'),_0x5037eb);}};module['exports']=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 50473ca..39bebea 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 _0x6d16=['dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry'];(function(_0x503ffd,_0x8ecde){var _0x160437=function(_0x2d45dd){while(--_0x2d45dd){_0x503ffd['push'](_0x503ffd['shift']());}};_0x160437(++_0x8ecde);}(_0x6d16,0xb6));var _0x66d1=function(_0x87db3c,_0x727b5a){_0x87db3c=_0x87db3c-0x0;var _0x36f93f=_0x6d16[_0x87db3c];return _0x36f93f;};'use strict';function Campaign(_0xa9bec9){this['id']=_0xa9bec9['id']||0x0;this[_0x66d1('0x0')]=_0xa9bec9[_0x66d1('0x0')]||'';this[_0x66d1('0x1')]=_0xa9bec9[_0x66d1('0x1')]||_0x66d1('0x2');this[_0x66d1('0x3')]=0x0;this[_0x66d1('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x66d1('0x5')]='';this['sendMessageOneNotActive']=!![];this[_0x66d1('0x6')]=_0xa9bec9[_0x66d1('0x6')];this[_0x66d1('0x7')]=_0xa9bec9[_0x66d1('0x7')];this['dialTimezone']=_0xa9bec9[_0x66d1('0x8')]||null;this[_0x66d1('0x9')]=_0xa9bec9[_0x66d1('0x9')]?_0xa9bec9['dialGlobalInterval']:null;this[_0x66d1('0xa')]=_0xa9bec9[_0x66d1('0xa')];this[_0x66d1('0xb')]=_0xa9bec9[_0x66d1('0xb')];this[_0x66d1('0xc')]=_0xa9bec9[_0x66d1('0xc')]||0x1e;this[_0x66d1('0xd')]=_0xa9bec9['dialCongestionMaxRetry'];this[_0x66d1('0xe')]=_0xa9bec9[_0x66d1('0xe')];this[_0x66d1('0xf')]=_0xa9bec9[_0x66d1('0xf')];this[_0x66d1('0x10')]=_0xa9bec9[_0x66d1('0x10')];this[_0x66d1('0x11')]=_0xa9bec9[_0x66d1('0x11')];this[_0x66d1('0x12')]=_0xa9bec9[_0x66d1('0x12')];this['dialGlobalMaxRetry']=_0xa9bec9[_0x66d1('0x13')];this[_0x66d1('0x14')]=_0xa9bec9['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0xa9bec9[_0x66d1('0x15')]||0x96;this[_0x66d1('0x16')]=_0xa9bec9['dialDropMaxRetry']||0x3;this[_0x66d1('0x17')]=_0xa9bec9[_0x66d1('0x17')]||0x96;this[_0x66d1('0x18')]=_0xa9bec9['dialAbandonedMaxRetry']||0x3;this[_0x66d1('0x19')]=_0xa9bec9[_0x66d1('0x19')]||0x96;this['dialMachineMaxRetry']=_0xa9bec9[_0x66d1('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0xa9bec9[_0x66d1('0x1b')]||0x96;this[_0x66d1('0x1c')]=_0xa9bec9['dialAgentRejectMaxRetry']||0x3;this[_0x66d1('0x1d')]=_0xa9bec9[_0x66d1('0x1d')]||0x96;this[_0x66d1('0x1e')]=_0xa9bec9[_0x66d1('0x1e')]||'DESC';this[_0x66d1('0x1f')]=_0xa9bec9[_0x66d1('0x1f')]||undefined;this[_0x66d1('0x20')]=_0xa9bec9['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0xa9bec9[_0x66d1('0x21')]||undefined;this[_0x66d1('0x22')]=_0xa9bec9['TrunkBackup']?_0xa9bec9['TrunkBackup']:undefined;this['Trunk']=_0xa9bec9['Trunk']?_0xa9bec9[_0x66d1('0x23')]:undefined;this[_0x66d1('0x24')]=_0xa9bec9[_0x66d1('0x24')]?_0xa9bec9['Interval']:undefined;this[_0x66d1('0x25')]=_0xa9bec9[_0x66d1('0x25')]?_0xa9bec9['SquareProject']:undefined;this[_0x66d1('0x26')]=_0xa9bec9[_0x66d1('0x25')]?_0xa9bec9[_0x66d1('0x25')][_0x66d1('0x0')]:undefined;this[_0x66d1('0x27')]=_0xa9bec9[_0x66d1('0x27')]||![];this[_0x66d1('0x28')]=_0xa9bec9[_0x66d1('0x28')];this[_0x66d1('0x29')]=_0xa9bec9['dialAMDGreeting'];this[_0x66d1('0x2a')]=_0xa9bec9[_0x66d1('0x2a')];this['dialAMDTotalAnalysisTime']=_0xa9bec9[_0x66d1('0x2b')];this['dialAMDMinWordLength']=_0xa9bec9[_0x66d1('0x2c')];this[_0x66d1('0x2d')]=_0xa9bec9[_0x66d1('0x2d')];this[_0x66d1('0x2e')]=_0xa9bec9[_0x66d1('0x2e')];this[_0x66d1('0x2f')]=_0xa9bec9[_0x66d1('0x2f')];this[_0x66d1('0x30')]=_0xa9bec9[_0x66d1('0x30')];}module[_0x66d1('0x31')]=Campaign; \ No newline at end of file +var _0x8aa8=['dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency'];(function(_0x538331,_0x13fede){var _0x1fec3d=function(_0x24518b){while(--_0x24518b){_0x538331['push'](_0x538331['shift']());}};_0x1fec3d(++_0x13fede);}(_0x8aa8,0xcc));var _0x88aa=function(_0x49d54b,_0x1d4532){_0x49d54b=_0x49d54b-0x0;var _0x484f80=_0x8aa8[_0x49d54b];return _0x484f80;};'use strict';function Campaign(_0x341f49){this['id']=_0x341f49['id']||0x0;this[_0x88aa('0x0')]=_0x341f49[_0x88aa('0x0')]||'';this[_0x88aa('0x1')]=_0x341f49[_0x88aa('0x1')]||'campaign';this['originated']=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x88aa('0x2')]=0x0;this[_0x88aa('0x3')]='';this[_0x88aa('0x4')]=!![];this[_0x88aa('0x5')]=_0x341f49[_0x88aa('0x5')];this['limitCalls']=_0x341f49[_0x88aa('0x6')];this[_0x88aa('0x7')]=_0x341f49[_0x88aa('0x7')]||null;this[_0x88aa('0x8')]=_0x341f49[_0x88aa('0x8')]?_0x341f49[_0x88aa('0x8')]:null;this[_0x88aa('0x9')]=_0x341f49[_0x88aa('0x9')];this[_0x88aa('0xa')]=_0x341f49[_0x88aa('0xa')];this[_0x88aa('0xb')]=_0x341f49['dialOriginateTimeout']||0x1e;this[_0x88aa('0xc')]=_0x341f49[_0x88aa('0xc')];this[_0x88aa('0xd')]=_0x341f49[_0x88aa('0xd')];this[_0x88aa('0xe')]=_0x341f49[_0x88aa('0xe')];this[_0x88aa('0xf')]=_0x341f49[_0x88aa('0xf')];this[_0x88aa('0x10')]=_0x341f49[_0x88aa('0x10')];this[_0x88aa('0x11')]=_0x341f49[_0x88aa('0x11')];this['dialGlobalMaxRetry']=_0x341f49['dialGlobalMaxRetry'];this[_0x88aa('0x12')]=_0x341f49['dialNoSuchNumberMaxRetry']||0x3;this[_0x88aa('0x13')]=_0x341f49[_0x88aa('0x13')]||0x96;this[_0x88aa('0x14')]=_0x341f49[_0x88aa('0x14')]||0x3;this['dialDropRetryFrequency']=_0x341f49[_0x88aa('0x15')]||0x96;this[_0x88aa('0x16')]=_0x341f49['dialAbandonedMaxRetry']||0x3;this[_0x88aa('0x17')]=_0x341f49['dialAbandonedRetryFrequency']||0x96;this[_0x88aa('0x18')]=_0x341f49[_0x88aa('0x18')]||0x3;this[_0x88aa('0x19')]=_0x341f49['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x341f49[_0x88aa('0x1a')]||0x3;this[_0x88aa('0x1b')]=_0x341f49[_0x88aa('0x1b')]||0x96;this[_0x88aa('0x1c')]=_0x341f49['dialOrderByScheduledAt']||_0x88aa('0x1d');this[_0x88aa('0x1e')]=_0x341f49[_0x88aa('0x1e')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x341f49[_0x88aa('0x1f')]||undefined;this[_0x88aa('0x20')]=_0x341f49[_0x88aa('0x20')]||undefined;this['TrunkBackup']=_0x341f49['TrunkBackup']?_0x341f49['TrunkBackup']:undefined;this[_0x88aa('0x21')]=_0x341f49[_0x88aa('0x21')]?_0x341f49[_0x88aa('0x21')]:undefined;this[_0x88aa('0x22')]=_0x341f49[_0x88aa('0x22')]?_0x341f49[_0x88aa('0x22')]:undefined;this[_0x88aa('0x23')]=_0x341f49[_0x88aa('0x23')]?_0x341f49['SquareProject']:undefined;this[_0x88aa('0x24')]=_0x341f49[_0x88aa('0x23')]?_0x341f49[_0x88aa('0x23')][_0x88aa('0x0')]:undefined;this[_0x88aa('0x25')]=_0x341f49[_0x88aa('0x25')]||![];this['dialAMDInitialSilence']=_0x341f49['dialAMDInitialSilence'];this[_0x88aa('0x26')]=_0x341f49['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x341f49[_0x88aa('0x27')];this[_0x88aa('0x28')]=_0x341f49[_0x88aa('0x28')];this[_0x88aa('0x29')]=_0x341f49[_0x88aa('0x29')];this[_0x88aa('0x2a')]=_0x341f49[_0x88aa('0x2a')];this[_0x88aa('0x2b')]=_0x341f49['dialAMDMaximumNumberOfWords'];this[_0x88aa('0x2c')]=_0x341f49['dialAMDSilenceThreshold'];this[_0x88aa('0x2d')]=_0x341f49[_0x88aa('0x2d')];}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 0fcad1b..05924b4 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 _0xc87b=['holdtime','type','tag','disposition','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','uniqueid','linkedid','exten','answered','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds'];(function(_0x4d9cf6,_0x25b660){var _0x37c52f=function(_0x158aa0){while(--_0x158aa0){_0x4d9cf6['push'](_0x4d9cf6['shift']());}};_0x37c52f(++_0x25b660);}(_0xc87b,0xb2));var _0xbc87=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0xc87b[_0x24061a];return _0x82054e;};'use strict';function Channel(){this[_0xbc87('0x0')]=null;this[_0xbc87('0x1')]='';this[_0xbc87('0x2')]='';this[_0xbc87('0x3')]=0x0;this['calleridname']='';this[_0xbc87('0x4')]=undefined;this[_0xbc87('0x5')]=undefined;this[_0xbc87('0x6')]=0x0;this['context']='';this[_0xbc87('0x7')]=0x0;this[_0xbc87('0x8')]=0x0;this[_0xbc87('0x9')]=0x0;this[_0xbc87('0xa')]=![];this['answertime']=null;this[_0xbc87('0xb')]=null;this[_0xbc87('0xc')]=![];this[_0xbc87('0xd')]=![];this[_0xbc87('0xe')]='';this[_0xbc87('0xf')]='';this[_0xbc87('0x10')]=0x0;this[_0xbc87('0x11')]=0x0;this[_0xbc87('0x12')]=0x0;this[_0xbc87('0x13')]=null;this[_0xbc87('0x14')]=null;this[_0xbc87('0x15')]=null;this['monitor']=![];this[_0xbc87('0x16')]=null;this['queue']=null;this[_0xbc87('0x17')]=[];this[_0xbc87('0x18')]=undefined;this[_0xbc87('0x19')]=undefined;this['transferType']=undefined;this[_0xbc87('0x1a')]=0x0;}module[_0xbc87('0x1b')]=Channel; \ No newline at end of file +var _0x3611=['uniqueid','exten','answered','endtime','abandoned','duration','billableseconds','holdtime','type','tag','disposition','monitor','queue','transferconnectedlinenum','mohtime','exports','starttime','calleridnum','connectedlinename','accountcode','context'];(function(_0x14117d,_0x3c6718){var _0x58b5b8=function(_0x30fb13){while(--_0x30fb13){_0x14117d['push'](_0x14117d['shift']());}};_0x58b5b8(++_0x3c6718);}(_0x3611,0x136));var _0x1361=function(_0x3b81a3,_0x32c8c5){_0x3b81a3=_0x3b81a3-0x0;var _0x4ca844=_0x3611[_0x3b81a3];return _0x4ca844;};'use strict';function Channel(){this[_0x1361('0x0')]=null;this['channel']='';this['destinationchannel']='';this[_0x1361('0x1')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0x1361('0x2')]=undefined;this[_0x1361('0x3')]=0x0;this[_0x1361('0x4')]='';this[_0x1361('0x5')]=0x0;this['linkedid']=0x0;this[_0x1361('0x6')]=0x0;this[_0x1361('0x7')]=![];this['answertime']=null;this[_0x1361('0x8')]=null;this['unmanaged']=![];this[_0x1361('0x9')]=![];this['lastapplication']='';this['lastdata']='';this[_0x1361('0xa')]=0x0;this[_0x1361('0xb')]=0x0;this[_0x1361('0xc')]=0x0;this[_0x1361('0xd')]=null;this[_0x1361('0xe')]=null;this[_0x1361('0xf')]=null;this[_0x1361('0x10')]=![];this['monitorFilename']=null;this[_0x1361('0x11')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0x1361('0x12')]=undefined;this['transferType']=undefined;this[_0x1361('0x13')]=0x0;}module[_0x1361('0x14')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 8847414..01d1265 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 _0x1c21=['token','tokenSecret','type','serverUrl','exports','name','username','remoteUri','authType','password','consumerSecret'];(function(_0x47adb8,_0x591ccc){var _0x4689a8=function(_0x2ba76f){while(--_0x2ba76f){_0x47adb8['push'](_0x47adb8['shift']());}};_0x4689a8(++_0x591ccc);}(_0x1c21,0x1f4));var _0x11c2=function(_0x2a2f1b,_0xbd475b){_0x2a2f1b=_0x2a2f1b-0x0;var _0x54b718=_0x1c21[_0x2a2f1b];return _0x54b718;};'use strict';function DeskAccount(_0x248b0e){this['id']=_0x248b0e['id']||0x0;this[_0x11c2('0x0')]=_0x248b0e['name']||'';this[_0x11c2('0x1')]=_0x248b0e[_0x11c2('0x1')]||'';this[_0x11c2('0x2')]=_0x248b0e[_0x11c2('0x2')]||'';this[_0x11c2('0x3')]=_0x248b0e['authType']||'';this['password']=_0x248b0e[_0x11c2('0x4')]||'';this['consumerKey']=_0x248b0e['consumerKey']||'';this[_0x11c2('0x5')]=_0x248b0e[_0x11c2('0x5')]||'';this[_0x11c2('0x6')]=_0x248b0e[_0x11c2('0x6')]||'';this[_0x11c2('0x7')]=_0x248b0e[_0x11c2('0x7')]||'';this[_0x11c2('0x8')]=_0x248b0e[_0x11c2('0x8')]||'';this[_0x11c2('0x9')]=_0x248b0e[_0x11c2('0x9')]||'';this['Configurations']=_0x248b0e['Configurations']||{};}module[_0x11c2('0xa')]=DeskAccount; \ No newline at end of file +var _0xbf37=['remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username'];(function(_0x51ed78,_0x47af57){var _0x24c1ee=function(_0x393f62){while(--_0x393f62){_0x51ed78['push'](_0x51ed78['shift']());}};_0x24c1ee(++_0x47af57);}(_0xbf37,0x1a0));var _0x7bf3=function(_0xc8d30c,_0x32192f){_0xc8d30c=_0xc8d30c-0x0;var _0x5af6a2=_0xbf37[_0xc8d30c];return _0x5af6a2;};'use strict';function DeskAccount(_0x1bdd5e){this['id']=_0x1bdd5e['id']||0x0;this[_0x7bf3('0x0')]=_0x1bdd5e[_0x7bf3('0x0')]||'';this[_0x7bf3('0x1')]=_0x1bdd5e[_0x7bf3('0x1')]||'';this[_0x7bf3('0x2')]=_0x1bdd5e[_0x7bf3('0x2')]||'';this['authType']=_0x1bdd5e['authType']||'';this[_0x7bf3('0x3')]=_0x1bdd5e[_0x7bf3('0x3')]||'';this[_0x7bf3('0x4')]=_0x1bdd5e[_0x7bf3('0x4')]||'';this[_0x7bf3('0x5')]=_0x1bdd5e[_0x7bf3('0x5')]||'';this[_0x7bf3('0x6')]=_0x1bdd5e[_0x7bf3('0x6')]||'';this[_0x7bf3('0x7')]=_0x1bdd5e[_0x7bf3('0x7')]||'';this[_0x7bf3('0x8')]=_0x1bdd5e[_0x7bf3('0x8')]||'';this[_0x7bf3('0x9')]=_0x1bdd5e[_0x7bf3('0x9')]||'';this[_0x7bf3('0xa')]=_0x1bdd5e[_0x7bf3('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 4097b69..35767ca 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 _0x0713=['Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';function Dynamics365Account(_0x4bf247){this['id']=_0x4bf247['id']||0x0;this['name']=_0x4bf247[_0x3071('0x0')]||'';this[_0x3071('0x1')]=_0x4bf247[_0x3071('0x1')]||'';this[_0x3071('0x2')]=_0x4bf247[_0x3071('0x2')]||'';this['remoteUri']=_0x4bf247[_0x3071('0x3')]||'';this[_0x3071('0x4')]=_0x4bf247[_0x3071('0x4')]||'';this[_0x3071('0x5')]=_0x4bf247[_0x3071('0x5')]||'';this[_0x3071('0x6')]=_0x4bf247[_0x3071('0x6')]||{};this[_0x3071('0x7')]=_0x4bf247[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0x4bf247[_0x3071('0x8')]||{};}module[_0x3071('0x9')]=Dynamics365Account; \ No newline at end of file +var _0xb43b=['Configurations','exports','name','username','password','remoteUri','tenantId','clientSecret','serverUrl'];(function(_0x3478fb,_0x538848){var _0xe7861d=function(_0x25da20){while(--_0x25da20){_0x3478fb['push'](_0x3478fb['shift']());}};_0xe7861d(++_0x538848);}(_0xb43b,0x1b2));var _0xbb43=function(_0x318758,_0xc55b56){_0x318758=_0x318758-0x0;var _0xaa43a6=_0xb43b[_0x318758];return _0xaa43a6;};'use strict';function Dynamics365Account(_0x2ee678){this['id']=_0x2ee678['id']||0x0;this[_0xbb43('0x0')]=_0x2ee678['name']||'';this[_0xbb43('0x1')]=_0x2ee678[_0xbb43('0x1')]||'';this[_0xbb43('0x2')]=_0x2ee678['password']||'';this[_0xbb43('0x3')]=_0x2ee678[_0xbb43('0x3')]||'';this[_0xbb43('0x4')]=_0x2ee678[_0xbb43('0x4')]||'';this['clientId']=_0x2ee678['clientId']||'';this[_0xbb43('0x5')]=_0x2ee678['clientSecret']||{};this[_0xbb43('0x6')]=_0x2ee678[_0xbb43('0x6')]||'';this[_0xbb43('0x7')]=_0x2ee678[_0xbb43('0x7')]||{};}module[_0xbb43('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 39abf88..29c4f29 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 _0x7428=['key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7428,0x1aa));var _0x8742=function(_0x16c4c4,_0x2c5a29){_0x16c4c4=_0x16c4c4-0x0;var _0x4a4c77=_0x7428[_0x16c4c4];return _0x4a4c77;};'use strict';function FaxAccount(_0x4b5b38){this['id']=_0x4b5b38['id']||0x0;this[_0x8742('0x0')]=_0x4b5b38[_0x8742('0x0')]||'';this[_0x8742('0x1')]=_0x4b5b38[_0x8742('0x1')];this[_0x8742('0x2')]=_0x4b5b38[_0x8742('0x2')];this[_0x8742('0x3')]=_0x4b5b38[_0x8742('0x3')];this[_0x8742('0x4')]=_0x4b5b38[_0x8742('0x4')];this[_0x8742('0x5')]=_0x4b5b38[_0x8742('0x5')]||0x960;this[_0x8742('0x6')]=_0x4b5b38[_0x8742('0x6')]||0x3840;this[_0x8742('0x7')]=_0x4b5b38[_0x8742('0x7')]||_0x8742('0x8');this[_0x8742('0x9')]=_0x4b5b38[_0x8742('0x9')]||'no';this['faxdetect']=_0x4b5b38[_0x8742('0xa')]||'no';this[_0x8742('0xb')]=_0x4b5b38[_0x8742('0xb')]||0x1388;this[_0x8742('0xc')]=_0x4b5b38[_0x8742('0xc')]||_0x8742('0xd');this[_0x8742('0xe')]=_0x4b5b38[_0x8742('0xe')]?_0x4b5b38[_0x8742('0xe')]:undefined;this['ListId']=_0x4b5b38[_0x8742('0xf')];this['key']=_0x4b5b38[_0x8742('0x10')];}module['exports']=FaxAccount; \ No newline at end of file +var _0xd8aa=['maxrate','modem','gateway','faxdetect','t38timeout','tech','Trunk','ListId','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x39a1cf,_0x4f1244){var _0xd2c0a5=function(_0x54d8b2){while(--_0x54d8b2){_0x39a1cf['push'](_0x39a1cf['shift']());}};_0xd2c0a5(++_0x4f1244);}(_0xd8aa,0xf6));var _0xad8a=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8aa[_0xa464c9];return _0x3d73c4;};'use strict';function FaxAccount(_0x9c6937){this['id']=_0x9c6937['id']||0x0;this[_0xad8a('0x0')]=_0x9c6937[_0xad8a('0x0')]||'';this[_0xad8a('0x1')]=_0x9c6937['description'];this[_0xad8a('0x2')]=_0x9c6937['ecm'];this[_0xad8a('0x3')]=_0x9c6937[_0xad8a('0x3')];this[_0xad8a('0x4')]=_0x9c6937[_0xad8a('0x4')];this[_0xad8a('0x5')]=_0x9c6937['minrate']||0x960;this['maxrate']=_0x9c6937[_0xad8a('0x6')]||0x3840;this[_0xad8a('0x7')]=_0x9c6937['modem']||'v17,v27,v29';this[_0xad8a('0x8')]=_0x9c6937[_0xad8a('0x8')]||'no';this[_0xad8a('0x9')]=_0x9c6937[_0xad8a('0x9')]||'no';this[_0xad8a('0xa')]=_0x9c6937[_0xad8a('0xa')]||0x1388;this['tech']=_0x9c6937[_0xad8a('0xb')]||'SIP';this['Trunk']=_0x9c6937[_0xad8a('0xc')]?_0x9c6937[_0xad8a('0xc')]:undefined;this['ListId']=_0x9c6937[_0xad8a('0xd')];this['key']=_0x9c6937['key'];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index cf1e507..3efce7a 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 _0x1270=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x18f5b5,_0x25c072){var _0x517c5f=function(_0x1ba3aa){while(--_0x1ba3aa){_0x18f5b5['push'](_0x18f5b5['shift']());}};_0x517c5f(++_0x25c072);}(_0x1270,0x74));var _0x0127=function(_0xd6575d,_0x4ec5aa){_0xd6575d=_0xd6575d-0x0;var _0x325ac3=_0x1270[_0xd6575d];return _0x325ac3;};'use strict';function FreshdeskAccount(_0x37c9ff){this['id']=_0x37c9ff['id']||0x0;this[_0x0127('0x0')]=_0x37c9ff[_0x0127('0x0')]||'';this['username']=_0x37c9ff[_0x0127('0x1')]||'';this[_0x0127('0x2')]=_0x37c9ff[_0x0127('0x3')]||'';this[_0x0127('0x4')]=_0x37c9ff[_0x0127('0x4')]||'';this[_0x0127('0x5')]=_0x37c9ff['serverUrl']||'';this[_0x0127('0x6')]=_0x37c9ff['Configurations']||{};}module[_0x0127('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xa104=['name','username','remoteUri','serverUrl','Configurations'];(function(_0x4ba924,_0x517bd2){var _0x2a7c9b=function(_0x21c09a){while(--_0x21c09a){_0x4ba924['push'](_0x4ba924['shift']());}};_0x2a7c9b(++_0x517bd2);}(_0xa104,0xbe));var _0x4a10=function(_0x2b98c4,_0x205472){_0x2b98c4=_0x2b98c4-0x0;var _0x1afb52=_0xa104[_0x2b98c4];return _0x1afb52;};'use strict';function FreshdeskAccount(_0x47865f){this['id']=_0x47865f['id']||0x0;this[_0x4a10('0x0')]=_0x47865f[_0x4a10('0x0')]||'';this[_0x4a10('0x1')]=_0x47865f[_0x4a10('0x1')]||'';this['apiKey']=_0x47865f['token']||'';this[_0x4a10('0x2')]=_0x47865f[_0x4a10('0x2')]||'';this['serverUrl']=_0x47865f[_0x4a10('0x3')]||'';this['Configurations']=_0x47865f[_0x4a10('0x4')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index e2c412d..33634d7 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 _0x6657=['apiKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x29c2f7,_0x1ffb8b){var _0x3582e6=function(_0x4e91dc){while(--_0x4e91dc){_0x29c2f7['push'](_0x29c2f7['shift']());}};_0x3582e6(++_0x1ffb8b);}(_0x6657,0x17f));var _0x7665=function(_0x551e6b,_0x378961){_0x551e6b=_0x551e6b-0x0;var _0x5e35cb=_0x6657[_0x551e6b];return _0x5e35cb;};'use strict';function FreshsalesAccount(_0x7771c6){this['id']=_0x7771c6['id']||0x0;this['name']=_0x7771c6[_0x7665('0x0')]||'';this[_0x7665('0x1')]=_0x7771c6[_0x7665('0x1')]||'';this[_0x7665('0x2')]=_0x7771c6['token']||'';this[_0x7665('0x3')]=_0x7771c6[_0x7665('0x3')]||'';this[_0x7665('0x4')]=_0x7771c6[_0x7665('0x4')]||'';this[_0x7665('0x5')]=_0x7771c6[_0x7665('0x5')]||{};}module[_0x7665('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x08d9=['apiKey','token','serverUrl','Configurations','exports','name','username'];(function(_0x2b845b,_0x23265d){var _0x54efa3=function(_0x71111d){while(--_0x71111d){_0x2b845b['push'](_0x2b845b['shift']());}};_0x54efa3(++_0x23265d);}(_0x08d9,0xc2));var _0x908d=function(_0x4bf71a,_0x3051c4){_0x4bf71a=_0x4bf71a-0x0;var _0xb620f5=_0x08d9[_0x4bf71a];return _0xb620f5;};'use strict';function FreshsalesAccount(_0x3c3ec6){this['id']=_0x3c3ec6['id']||0x0;this['name']=_0x3c3ec6[_0x908d('0x0')]||'';this['username']=_0x3c3ec6[_0x908d('0x1')]||'';this[_0x908d('0x2')]=_0x3c3ec6[_0x908d('0x3')]||'';this['remoteUri']=_0x3c3ec6['remoteUri']||'';this[_0x908d('0x4')]=_0x3c3ec6[_0x908d('0x4')]||'';this[_0x908d('0x5')]=_0x3c3ec6[_0x908d('0x5')]||{};}module[_0x908d('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 5bfbcc3..ac43e20 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 _0xfd87=['type','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','accountcode','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','mohtime','exports'];(function(_0x3c7577,_0x46dcf5){var _0x35dde6=function(_0x4f6948){while(--_0x4f6948){_0x3c7577['push'](_0x3c7577['shift']());}};_0x35dde6(++_0x46dcf5);}(_0xfd87,0x1a9));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this[_0x7fd8('0x0')]=_0x7fd8('0x1');this[_0x7fd8('0x2')]='';this['calleridnum']='';this[_0x7fd8('0x3')]='';this[_0x7fd8('0x4')]='';this[_0x7fd8('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x7fd8('0x6')]=0x1;this[_0x7fd8('0x7')]=0x1;this[_0x7fd8('0x8')]=![];this[_0x7fd8('0x9')]=null;this[_0x7fd8('0xa')]=![];this[_0x7fd8('0xb')]=null;this[_0x7fd8('0xc')]=![];this[_0x7fd8('0xd')]=null;this['originalposition']=0x1;this[_0x7fd8('0xe')]='';this[_0x7fd8('0xf')]='';this['connectedlinename']='';this[_0x7fd8('0x10')]='';this['context']='';this[_0x7fd8('0x11')]='';this[_0x7fd8('0x12')]='';this[_0x7fd8('0x13')]=0x0;this[_0x7fd8('0x14')]=![];this[_0x7fd8('0x15')]='';this[_0x7fd8('0x16')]='voice';this[_0x7fd8('0x17')]=0x0;this['variables']={};}module[_0x7fd8('0x18')]=QueueReport; \ No newline at end of file +var _0x234e=['queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','exten','holdtime','lastAssignedTo','voice','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','count'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0x234e,0xaf));var _0xe234=function(_0x225f58,_0x142d6b){_0x225f58=_0x225f58-0x0;var _0x4d347e=_0x234e[_0x225f58];return _0x4d347e;};'use strict';function QueueReport(){this[_0xe234('0x0')]=_0xe234('0x1');this[_0xe234('0x2')]='';this[_0xe234('0x3')]='';this[_0xe234('0x4')]='';this[_0xe234('0x5')]='';this[_0xe234('0x6')]=null;this['queuecallerleaveAt']=null;this[_0xe234('0x7')]=0x1;this[_0xe234('0x8')]=0x1;this['queuecallerabandon']=![];this[_0xe234('0x9')]=null;this[_0xe234('0xa')]=![];this[_0xe234('0xb')]=null;this[_0xe234('0xc')]=![];this[_0xe234('0xd')]=null;this[_0xe234('0xe')]=0x1;this[_0xe234('0xf')]='';this[_0xe234('0x10')]='';this[_0xe234('0x11')]='';this['accountcode']='';this[_0xe234('0x12')]='';this[_0xe234('0x13')]='';this['priority']='';this[_0xe234('0x14')]=0x0;this['assigned']=![];this[_0xe234('0x15')]='';this['motionChannel']=_0xe234('0x16');this['mohtime']=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 e388ff2..f147708 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 _0x434a=['username','remoteUri','password','clientId','clientSecret','securityToken','type','Configurations','exports','name'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x434a,0x9f));var _0xa434=function(_0xc47dac,_0x45b2e2){_0xc47dac=_0xc47dac-0x0;var _0x598437=_0x434a[_0xc47dac];return _0x598437;};'use strict';function SalesforceAccount(_0x100f4a){this['id']=_0x100f4a['id']||0x0;this[_0xa434('0x0')]=_0x100f4a['name']||'';this[_0xa434('0x1')]=_0x100f4a['username']||'';this[_0xa434('0x2')]=_0x100f4a['remoteUri']||'';this[_0xa434('0x3')]=_0x100f4a[_0xa434('0x3')]||'';this[_0xa434('0x4')]=_0x100f4a['clientId']||'';this[_0xa434('0x5')]=_0x100f4a[_0xa434('0x5')]||'';this[_0xa434('0x6')]=_0x100f4a['securityToken']||'';this[_0xa434('0x7')]=_0x100f4a[_0xa434('0x7')]||'integrationTab';this['serverUrl']=_0x100f4a['serverUrl']||'';this[_0xa434('0x8')]=_0x100f4a[_0xa434('0x8')]||{};}module[_0xa434('0x9')]=SalesforceAccount; \ No newline at end of file +var _0xd126=['remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations','username'];(function(_0x4a4bd7,_0x83338c){var _0xf7f9bf=function(_0x278c1f){while(--_0x278c1f){_0x4a4bd7['push'](_0x4a4bd7['shift']());}};_0xf7f9bf(++_0x83338c);}(_0xd126,0x6b));var _0x6d12=function(_0x4ca160,_0x14886c){_0x4ca160=_0x4ca160-0x0;var _0x303ae9=_0xd126[_0x4ca160];return _0x303ae9;};'use strict';function SalesforceAccount(_0x35bcda){this['id']=_0x35bcda['id']||0x0;this['name']=_0x35bcda['name']||'';this[_0x6d12('0x0')]=_0x35bcda[_0x6d12('0x0')]||'';this[_0x6d12('0x1')]=_0x35bcda[_0x6d12('0x1')]||'';this[_0x6d12('0x2')]=_0x35bcda[_0x6d12('0x2')]||'';this[_0x6d12('0x3')]=_0x35bcda['clientId']||'';this[_0x6d12('0x4')]=_0x35bcda[_0x6d12('0x4')]||'';this[_0x6d12('0x5')]=_0x35bcda[_0x6d12('0x5')]||'';this[_0x6d12('0x6')]=_0x35bcda['type']||'integrationTab';this[_0x6d12('0x7')]=_0x35bcda[_0x6d12('0x7')]||'';this[_0x6d12('0x8')]=_0x35bcda['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 3f0b406..a987ce3 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 _0x90ec=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x58a4ac,_0x43fd42){var _0x545810=function(_0x308e65){while(--_0x308e65){_0x58a4ac['push'](_0x58a4ac['shift']());}};_0x545810(++_0x43fd42);}(_0x90ec,0xc8));var _0xc90e=function(_0x3b7c71,_0x173154){_0x3b7c71=_0x3b7c71-0x0;var _0x1f603a=_0x90ec[_0x3b7c71];return _0x1f603a;};'use strict';function ServicenowAccount(_0x2acf41){this['id']=_0x2acf41['id']||0x0;this['name']=_0x2acf41[_0xc90e('0x0')]||'';this[_0xc90e('0x1')]=_0x2acf41[_0xc90e('0x1')]||'';this[_0xc90e('0x2')]=_0x2acf41['password']||'';this['remoteUri']=_0x2acf41[_0xc90e('0x3')]||'';this[_0xc90e('0x4')]=_0x2acf41[_0xc90e('0x4')]||'';this[_0xc90e('0x5')]=_0x2acf41[_0xc90e('0x5')]||{};}module[_0xc90e('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x5c90=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x35af05,_0x41f785){var _0x5de56e=function(_0x704ae9){while(--_0x704ae9){_0x35af05['push'](_0x35af05['shift']());}};_0x5de56e(++_0x41f785);}(_0x5c90,0xa7));var _0x05c9=function(_0x1bbf5e,_0x29fc83){_0x1bbf5e=_0x1bbf5e-0x0;var _0x5a5855=_0x5c90[_0x1bbf5e];return _0x5a5855;};'use strict';function ServicenowAccount(_0x3aa59c){this['id']=_0x3aa59c['id']||0x0;this[_0x05c9('0x0')]=_0x3aa59c[_0x05c9('0x0')]||'';this[_0x05c9('0x1')]=_0x3aa59c[_0x05c9('0x1')]||'';this[_0x05c9('0x2')]=_0x3aa59c[_0x05c9('0x2')]||'';this[_0x05c9('0x3')]=_0x3aa59c[_0x05c9('0x3')]||'';this[_0x05c9('0x4')]=_0x3aa59c[_0x05c9('0x4')]||'';this[_0x05c9('0x5')]=_0x3aa59c[_0x05c9('0x5')]||{};}module[_0x05c9('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 155b074..8e69984 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 _0x1af1=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1af1,0x1e9));var _0x11af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1af1[_0x3dd15e];return _0x231fd0;};'use strict';function SugarcrmAccount(_0x398b53){this['id']=_0x398b53['id']||0x0;this[_0x11af('0x0')]=_0x398b53['name']||'';this['username']=_0x398b53[_0x11af('0x1')]||'';this[_0x11af('0x2')]=_0x398b53[_0x11af('0x2')]||'';this[_0x11af('0x3')]=_0x398b53[_0x11af('0x3')]||'';this[_0x11af('0x4')]=_0x398b53['serverUrl']||'';this[_0x11af('0x5')]=_0x398b53[_0x11af('0x5')]||{};}module[_0x11af('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xf5a7=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0xf5a7,0x133));var _0x7f5a=function(_0x20403d,_0x34bbba){_0x20403d=_0x20403d-0x0;var _0x116690=_0xf5a7[_0x20403d];return _0x116690;};'use strict';function SugarcrmAccount(_0x227d06){this['id']=_0x227d06['id']||0x0;this[_0x7f5a('0x0')]=_0x227d06['name']||'';this[_0x7f5a('0x1')]=_0x227d06[_0x7f5a('0x1')]||'';this[_0x7f5a('0x2')]=_0x227d06[_0x7f5a('0x2')]||'';this[_0x7f5a('0x3')]=_0x227d06[_0x7f5a('0x3')]||'';this[_0x7f5a('0x4')]=_0x227d06[_0x7f5a('0x4')]||'';this[_0x7f5a('0x5')]=_0x227d06['Configurations']||{};}module[_0x7f5a('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 918affd..f377500 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 _0x3eae=['unknown','stateTime','address','exports','name','accountcode','state'];(function(_0x513334,_0x5a4c25){var _0x781254=function(_0x64a826){while(--_0x64a826){_0x513334['push'](_0x513334['shift']());}};_0x781254(++_0x5a4c25);}(_0x3eae,0x66));var _0xe3ea=function(_0x24392f,_0x15a3e5){_0x24392f=_0x24392f-0x0;var _0x591e33=_0x3eae[_0x24392f];return _0x591e33;};'use strict';function Telephone(_0x14ad49){this['id']=_0x14ad49['id']||0x0;this['name']=_0x14ad49[_0xe3ea('0x0')]||'';this[_0xe3ea('0x1')]=_0x14ad49['accountcode']||'';this[_0xe3ea('0x2')]=_0xe3ea('0x3');this[_0xe3ea('0x4')]=0x0;this['status']='unknown';this[_0xe3ea('0x5')]='';}module[_0xe3ea('0x6')]=Telephone; \ No newline at end of file +var _0x4cba=['exports','name','accountcode','state','unknown','stateTime','status'];(function(_0x30b0bc,_0x25d8a0){var _0x65938e=function(_0x349ca9){while(--_0x349ca9){_0x30b0bc['push'](_0x30b0bc['shift']());}};_0x65938e(++_0x25d8a0);}(_0x4cba,0x119));var _0xa4cb=function(_0x293d88,_0x21a47c){_0x293d88=_0x293d88-0x0;var _0x3c53b7=_0x4cba[_0x293d88];return _0x3c53b7;};'use strict';function Telephone(_0x107033){this['id']=_0x107033['id']||0x0;this[_0xa4cb('0x0')]=_0x107033[_0xa4cb('0x0')]||'';this['accountcode']=_0x107033[_0xa4cb('0x1')]||'';this[_0xa4cb('0x2')]=_0xa4cb('0x3');this[_0xa4cb('0x4')]=0x0;this[_0xa4cb('0x5')]=_0xa4cb('0x3');this['address']='';}module[_0xa4cb('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 8a5cd63..9cce622 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(_0x33cdfe,_0x1da086){var _0x2d6ca4=function(_0x1f243a){while(--_0x1f243a){_0x33cdfe['push'](_0x33cdfe['shift']());}};_0x2d6ca4(++_0x1da086);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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(_0x545512,_0x15b08a){var _0x12ffe6=function(_0x4ccad7){while(--_0x4ccad7){_0x545512['push'](_0x545512['shift']());}};_0x12ffe6(++_0x15b08a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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 94fb6f4..0a41d2a 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 _0x757a=['name','status','AllConditions','AnyConditions','Actions','exports'];(function(_0xc9cda6,_0x18d645){var _0x32354b=function(_0x12fe63){while(--_0x12fe63){_0xc9cda6['push'](_0xc9cda6['shift']());}};_0x32354b(++_0x18d645);}(_0x757a,0xde));var _0xa757=function(_0x3524a4,_0x3c479a){_0x3524a4=_0x3524a4-0x0;var _0x16f2c7=_0x757a[_0x3524a4];return _0x16f2c7;};'use strict';function Trigger(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['channel']=_0x1acf7d['channel']||'voice';this[_0xa757('0x1')]=_0x1acf7d[_0xa757('0x1')]||![];this[_0xa757('0x2')]=_0x1acf7d[_0xa757('0x2')]||[];this[_0xa757('0x3')]=_0x1acf7d[_0xa757('0x3')]||[];this['Actions']=_0x1acf7d[_0xa757('0x4')]||[];}module[_0xa757('0x5')]=Trigger; \ No newline at end of file +var _0x1a85=['status','AllConditions','AnyConditions','Actions','name','channel'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1a85,0x178));var _0x51a8=function(_0x40ecd0,_0x27de55){_0x40ecd0=_0x40ecd0-0x0;var _0x5a9953=_0x1a85[_0x40ecd0];return _0x5a9953;};'use strict';function Trigger(_0x4570ac){this['id']=_0x4570ac['id']||0x0;this['name']=_0x4570ac[_0x51a8('0x0')]||'';this[_0x51a8('0x1')]=_0x4570ac[_0x51a8('0x1')]||'voice';this['status']=_0x4570ac[_0x51a8('0x2')]||![];this[_0x51a8('0x3')]=_0x4570ac[_0x51a8('0x3')]||[];this['AnyConditions']=_0x4570ac[_0x51a8('0x4')]||[];this['Actions']=_0x4570ac[_0x51a8('0x5')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index d491b59..5cbfe6e 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 _0xa110=['refresh','stateRegistry','address','defaultuser','active','name','state','unknown','stateTime','registry','indexOf','split','host','port','domain','domainport'];(function(_0x3f2154,_0x1affbb){var _0x3ff02b=function(_0x3ccdc5){while(--_0x3ccdc5){_0x3f2154['push'](_0x3f2154['shift']());}};_0x3ff02b(++_0x1affbb);}(_0xa110,0x64));var _0x0a11=function(_0x309571,_0x1264e0){_0x309571=_0x309571-0x0;var _0x42d4c9=_0xa110[_0x309571];return _0x42d4c9;};'use strict';function Trunk(_0x489c85){this['id']=_0x489c85['id']||0x0;this['active']=_0x489c85[_0x0a11('0x0')]||![];this[_0x0a11('0x1')]=_0x489c85[_0x0a11('0x1')]||'';this[_0x0a11('0x2')]=_0x0a11('0x3');this[_0x0a11('0x4')]=0x0;this['status']=_0x0a11('0x3');this[_0x0a11('0x5')]=_0x489c85['registry']&&_0x489c85['registry'][_0x0a11('0x6')](':')?_0x489c85[_0x0a11('0x5')][_0x0a11('0x7')](':')[0x0]:'';this[_0x0a11('0x8')]='';this[_0x0a11('0x9')]='';this[_0x0a11('0xa')]='';this[_0x0a11('0xb')]='';this[_0x0a11('0xc')]='';this[_0x0a11('0xd')]=_0x0a11('0x3');this['registrationtime']='';this[_0x0a11('0xe')]='';this['defaultuser']=_0x489c85[_0x0a11('0xf')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0x2eee=['domainport','stateRegistry','registrationtime','address','defaultuser','active','name','stateTime','unknown','registry','indexOf','split','host','port','domain'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2eee,0x8c));var _0xe2ee=function(_0x30d87a,_0xf3a07f){_0x30d87a=_0x30d87a-0x0;var _0x48f64b=_0x2eee[_0x30d87a];return _0x48f64b;};'use strict';function Trunk(_0x5a4f90){this['id']=_0x5a4f90['id']||0x0;this[_0xe2ee('0x0')]=_0x5a4f90[_0xe2ee('0x0')]||![];this[_0xe2ee('0x1')]=_0x5a4f90[_0xe2ee('0x1')]||'';this['state']='unknown';this[_0xe2ee('0x2')]=0x0;this['status']=_0xe2ee('0x3');this[_0xe2ee('0x4')]=_0x5a4f90['registry']&&_0x5a4f90['registry'][_0xe2ee('0x5')](':')?_0x5a4f90[_0xe2ee('0x4')][_0xe2ee('0x6')](':')[0x0]:'';this[_0xe2ee('0x7')]='';this[_0xe2ee('0x8')]='';this[_0xe2ee('0x9')]='';this[_0xe2ee('0xa')]='';this['refresh']='';this[_0xe2ee('0xb')]=_0xe2ee('0x3');this[_0xe2ee('0xc')]='';this[_0xe2ee('0xd')]='';this[_0xe2ee('0xe')]=_0x5a4f90['defaultuser']||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index c6c2681..d8acc82 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 _0x35ff=['recordingFormat','mandatoryDisposition','exten'];(function(_0x21c269,_0x1947a8){var _0x53b1ec=function(_0x30c7a5){while(--_0x30c7a5){_0x21c269['push'](_0x21c269['shift']());}};_0x53b1ec(++_0x1947a8);}(_0x35ff,0x8c));var _0xf35f=function(_0x197d26,_0x5e2760){_0x197d26=_0x197d26-0x0;var _0x3f30bf=_0x35ff[_0x197d26];return _0x3f30bf;};'use strict';function voiceExtension(_0x568d3d){this['id']=_0x568d3d['id']||0x0;this['exten']=_0x568d3d[_0xf35f('0x0')]||'';this[_0xf35f('0x1')]=_0x568d3d[_0xf35f('0x1')]||'none';this[_0xf35f('0x2')]=_0x568d3d['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x80bb=['mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x3824f1,_0x19aa05){var _0x182a25=function(_0x32c3af){while(--_0x32c3af){_0x3824f1['push'](_0x3824f1['shift']());}};_0x182a25(++_0x19aa05);}(_0x80bb,0x1a6));var _0xb80b=function(_0x480686,_0x5d1ca5){_0x480686=_0x480686-0x0;var _0x111b11=_0x80bb[_0x480686];return _0x111b11;};'use strict';function voiceExtension(_0x4bf101){this['id']=_0x4bf101['id']||0x0;this['exten']=_0x4bf101[_0xb80b('0x0')]||'';this[_0xb80b('0x1')]=_0x4bf101['recordingFormat']||'none';this[_0xb80b('0x2')]=_0x4bf101[_0xb80b('0x2')]||![];}module[_0xb80b('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 325e640..b032ed3 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 _0x49f5=['message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','erlangCalls','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','busy','unavailable','ringing','ringinuse','onhold','wav','wav49','rrmemory','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive'];(function(_0x1e54da,_0x52a355){var _0x284966=function(_0x55d6cb){while(--_0x55d6cb){_0x1e54da['push'](_0x1e54da['shift']());}};_0x284966(++_0x52a355);}(_0x49f5,0xd0));var _0x549f=function(_0x3ac563,_0x53621e){_0x3ac563=_0x3ac563-0x0;var _0x3e855f=_0x49f5[_0x3ac563];return _0x3e855f;};'use strict';var statusDesc=['unknown',_0x549f('0x0'),'inuse',_0x549f('0x1'),'invalid',_0x549f('0x2'),_0x549f('0x3'),_0x549f('0x4'),_0x549f('0x5')];var monitorFormat={'wav':_0x549f('0x6'),'wav49':_0x549f('0x7'),'gsm':'gsm'};var strategy={'rrmemory':_0x549f('0x8'),'roundrobin':'roundrobin'};function VoiceQueue(_0x1e3d1b){this['id']=_0x1e3d1b['id']||0x0;this[_0x549f('0x9')]=_0x1e3d1b[_0x549f('0x9')]||'';this[_0x549f('0xa')]=_0x1e3d1b[_0x549f('0xa')]||'';this['type']=_0x1e3d1b[_0x549f('0xb')]||_0x549f('0xc');this[_0x549f('0xd')]=0x0;this[_0x549f('0xe')]=0x0;this[_0x549f('0xf')]=0x0;this[_0x549f('0x10')]=0x0;this[_0x549f('0x11')]=0x0;this[_0x549f('0x12')]=0x0;this[_0x549f('0x13')]=0x0;this[_0x549f('0x14')]=0x0;this[_0x549f('0x15')]=0x0;this[_0x549f('0x16')]=0x0;this[_0x549f('0x17')]=0x0;this[_0x549f('0x18')]=_0x1e3d1b[_0x549f('0x18')]||![];this['acwTimeout']=_0x1e3d1b[_0x549f('0x19')]||0xa;this[_0x549f('0x1a')]=_0x1e3d1b[_0x549f('0x1a')]||'no';this[_0x549f('0x1b')]=!![];this[_0x549f('0x1c')]='';this['originated']=0x0;this[_0x549f('0x1d')]=0x0;this[_0x549f('0x1e')]=_0x1e3d1b[_0x549f('0x1e')]||null;this[_0x549f('0x1f')]=_0x1e3d1b[_0x549f('0x1f')]?_0x1e3d1b[_0x549f('0x1f')]:null;this[_0x549f('0x20')]=_0x1e3d1b[_0x549f('0x20')];this[_0x549f('0x21')]=_0x1e3d1b[_0x549f('0x21')]||_0x549f('0x22');this['dialLimitChannel']=_0x1e3d1b[_0x549f('0x23')]||0x0;this[_0x549f('0x24')]=_0x1e3d1b[_0x549f('0x24')]||0x0;this['dialPowerLevel']=_0x1e3d1b[_0x549f('0x25')]||0x1;this['dialPredictiveOptimization']=_0x1e3d1b[_0x549f('0x26')]||_0x549f('0x27');this[_0x549f('0x28')]=_0x1e3d1b['dialPredictiveOptimizationPercentage']||0.03;this[_0x549f('0x29')]=_0x1e3d1b[_0x549f('0x29')]||0x258;this['dialOriginateCallerIdName']=_0x1e3d1b['dialOriginateCallerIdName']||'anonymous';this[_0x549f('0x2a')]=_0x1e3d1b['dialOriginateCallerIdNumber']||_0x549f('0x2b');this[_0x549f('0x2c')]=_0x1e3d1b[_0x549f('0x2c')]||0x1e;this['dialQueueOptions']=_0x1e3d1b['dialQueueOptions']||_0x549f('0x2d');this[_0x549f('0x2e')]=_0x1e3d1b['dialQueueTimeout']||0x3;this[_0x549f('0x2f')]=_0x1e3d1b['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x1e3d1b[_0x549f('0x30')]||0x3;this['dialCongestionRetryFrequency']=_0x1e3d1b[_0x549f('0x31')]||0x96;this[_0x549f('0x32')]=_0x1e3d1b[_0x549f('0x32')]||0x3;this[_0x549f('0x33')]=_0x1e3d1b[_0x549f('0x33')]||0x96;this[_0x549f('0x34')]=_0x1e3d1b[_0x549f('0x34')]||0x3;this[_0x549f('0x35')]=_0x1e3d1b['dialNoAnswerRetryFrequency']||0x96;this[_0x549f('0x36')]=_0x1e3d1b[_0x549f('0x36')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x1e3d1b[_0x549f('0x37')]||0x96;this['dialDropMaxRetry']=_0x1e3d1b['dialDropMaxRetry']||0x3;this[_0x549f('0x38')]=_0x1e3d1b[_0x549f('0x38')]||0x96;this[_0x549f('0x39')]=_0x1e3d1b[_0x549f('0x39')]||0x3;this[_0x549f('0x3a')]=_0x1e3d1b[_0x549f('0x3a')]||0x96;this[_0x549f('0x3b')]=_0x1e3d1b[_0x549f('0x3b')]||0x3;this[_0x549f('0x3c')]=_0x1e3d1b[_0x549f('0x3c')]||0x96;this['dialAgentRejectMaxRetry']=_0x1e3d1b[_0x549f('0x3d')]||0x3;this[_0x549f('0x3e')]=_0x1e3d1b[_0x549f('0x3e')]||0x96;this[_0x549f('0x3f')]=_0x1e3d1b[_0x549f('0x3f')]||0x4;this[_0x549f('0x40')]=_0x1e3d1b['Trunk']?_0x1e3d1b[_0x549f('0x40')]:undefined;this[_0x549f('0x41')]=_0x1e3d1b['TrunkBackup']?_0x1e3d1b[_0x549f('0x41')]:undefined;this['dialPrefix']=_0x1e3d1b[_0x549f('0x42')]||undefined;this[_0x549f('0x43')]=_0x1e3d1b[_0x549f('0x43')]?_0x1e3d1b[_0x549f('0x43')]:undefined;this[_0x549f('0x44')]=_0x1e3d1b[_0x549f('0x44')]||_0x549f('0x45');this[_0x549f('0x46')]=_0x1e3d1b[_0x549f('0x46')]||undefined;this[_0x549f('0x47')]=_0x1e3d1b[_0x549f('0x47')]||undefined;this['strategy']=strategy[_0x1e3d1b[_0x549f('0x48')]]||'rrmemory';this[_0x549f('0x49')]=!![];this[_0x549f('0x4a')]=_0x1e3d1b['dialAMDActive']||![];this[_0x549f('0x4b')]=_0x1e3d1b['dialAMDInitialSilence'];this[_0x549f('0x4c')]=_0x1e3d1b['dialAMDGreeting'];this[_0x549f('0x4d')]=_0x1e3d1b[_0x549f('0x4d')];this[_0x549f('0x4e')]=_0x1e3d1b['dialAMDTotalAnalysisTime'];this[_0x549f('0x4f')]=_0x1e3d1b[_0x549f('0x4f')];this[_0x549f('0x50')]=_0x1e3d1b[_0x549f('0x50')];this[_0x549f('0x51')]=_0x1e3d1b[_0x549f('0x51')];this[_0x549f('0x52')]=_0x1e3d1b['dialAMDSilenceThreshold'];this[_0x549f('0x53')]=_0x1e3d1b[_0x549f('0x53')];this[_0x549f('0x54')]=0x0;this[_0x549f('0x55')]=0x0;this['timeout']=_0x1e3d1b[_0x549f('0x56')];this[_0x549f('0x57')]=0x0;this[_0x549f('0x58')]=0x0;this[_0x549f('0x59')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x549f('0x5a')]=0x0;this[_0x549f('0x5b')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x549f('0x5c')]=0x0;this[_0x549f('0x5d')]=0x0;this[_0x549f('0x5e')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x549f('0x5f')]=0x0;this[_0x549f('0x60')]=0x0;this[_0x549f('0x61')]=undefined;this[_0x549f('0x62')]=undefined;this[_0x549f('0x63')]=undefined;this[_0x549f('0x64')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x549f('0x65')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x549f('0x66')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x549f('0x67')]=0x0;this[_0x549f('0x68')]=0x0;this[_0x549f('0x69')]=0x0;this['predictiveIntervalMaxThreshold']=_0x1e3d1b[_0x549f('0x6a')]||0x14;this['predictiveIntervalMinThreshold']=_0x1e3d1b['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x549f('0x6b')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x549f('0x6c')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0x549f('0x6d')]=0x0;this[_0x549f('0x6e')]=_0x1e3d1b['dialRecallMeTimeout']||0x1e;this[_0x549f('0x6f')]=_0x1e3d1b['dialRecallInQueue']||![];this[_0x549f('0x70')]=_0x1e3d1b['dialQueueProject2']||undefined;this[_0x549f('0x71')]=_0x1e3d1b['dialAgiAfterHangupClient']||![];this[_0x549f('0x72')]=_0x1e3d1b['dialAgiAfterHangupAgent']||![];this[_0x549f('0xa')]=monitorFormat[_0x1e3d1b[_0x549f('0xa')]]?monitorFormat[_0x1e3d1b['monitor_format']]:undefined;this[_0x549f('0x73')]=_0x1e3d1b[_0x549f('0x73')]||![];this[_0x549f('0x74')]=_0x1e3d1b[_0x549f('0x74')]?_0x1e3d1b['mandatoryDispositionPause']:undefined;}module[_0x549f('0x75')]=VoiceQueue; \ No newline at end of file +var _0x22d7=['waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','inuse','busy','unavailable','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound'];(function(_0x185d89,_0x109f97){var _0x169a46=function(_0x29b857){while(--_0x29b857){_0x185d89['push'](_0x185d89['shift']());}};_0x169a46(++_0x109f97);}(_0x22d7,0x158));var _0x722d=function(_0x5e7ee9,_0x4dbc4b){_0x5e7ee9=_0x5e7ee9-0x0;var _0xadb900=_0x22d7[_0x5e7ee9];return _0xadb900;};'use strict';var statusDesc=[_0x722d('0x0'),'not_inuse',_0x722d('0x1'),_0x722d('0x2'),'invalid',_0x722d('0x3'),'ringing','ringinuse','onhold'];var monitorFormat={'wav':_0x722d('0x4'),'wav49':_0x722d('0x5'),'gsm':_0x722d('0x6')};var strategy={'rrmemory':_0x722d('0x7'),'roundrobin':_0x722d('0x8')};function VoiceQueue(_0x3dbb7a){this['id']=_0x3dbb7a['id']||0x0;this[_0x722d('0x9')]=_0x3dbb7a[_0x722d('0x9')]||'';this[_0x722d('0xa')]=_0x3dbb7a[_0x722d('0xa')]||'';this[_0x722d('0xb')]=_0x3dbb7a['type']||_0x722d('0xc');this[_0x722d('0xd')]=0x0;this['talking']=0x0;this[_0x722d('0xe')]=0x0;this[_0x722d('0xf')]=0x0;this[_0x722d('0x10')]=0x0;this[_0x722d('0x11')]=0x0;this[_0x722d('0x12')]=0x0;this[_0x722d('0x13')]=0x0;this[_0x722d('0x14')]=0x0;this[_0x722d('0x15')]=0x0;this[_0x722d('0x16')]=0x0;this[_0x722d('0x17')]=_0x3dbb7a[_0x722d('0x17')]||![];this['acwTimeout']=_0x3dbb7a['acwTimeout']||0xa;this[_0x722d('0x18')]=_0x3dbb7a[_0x722d('0x18')]||'no';this[_0x722d('0x19')]=!![];this['message']='';this[_0x722d('0x1a')]=0x0;this[_0x722d('0x1b')]=0x0;this[_0x722d('0x1c')]=_0x3dbb7a[_0x722d('0x1c')]||null;this[_0x722d('0x1d')]=_0x3dbb7a[_0x722d('0x1d')]?_0x3dbb7a['dialGlobalInterval']:null;this[_0x722d('0x1e')]=_0x3dbb7a[_0x722d('0x1e')];this['dialMethod']=_0x3dbb7a[_0x722d('0x1f')]||_0x722d('0x20');this[_0x722d('0x21')]=_0x3dbb7a['dialLimitChannel']||0x0;this[_0x722d('0x22')]=_0x3dbb7a[_0x722d('0x22')]||0x0;this[_0x722d('0x23')]=_0x3dbb7a[_0x722d('0x23')]||0x1;this[_0x722d('0x24')]=_0x3dbb7a[_0x722d('0x24')]||_0x722d('0x25');this[_0x722d('0x26')]=_0x3dbb7a[_0x722d('0x26')]||0.03;this[_0x722d('0x27')]=_0x3dbb7a[_0x722d('0x27')]||0x258;this[_0x722d('0x28')]=_0x3dbb7a[_0x722d('0x28')]||_0x722d('0x29');this[_0x722d('0x2a')]=_0x3dbb7a[_0x722d('0x2a')]||_0x722d('0x29');this[_0x722d('0x2b')]=_0x3dbb7a['dialOriginateTimeout']||0x1e;this[_0x722d('0x2c')]=_0x3dbb7a[_0x722d('0x2c')]||'tTxX';this[_0x722d('0x2d')]=_0x3dbb7a[_0x722d('0x2d')]||0x3;this[_0x722d('0x2e')]=_0x3dbb7a['dialQueueProject']||undefined;this[_0x722d('0x2f')]=_0x3dbb7a[_0x722d('0x2f')]||0x3;this[_0x722d('0x30')]=_0x3dbb7a['dialCongestionRetryFrequency']||0x96;this[_0x722d('0x31')]=_0x3dbb7a[_0x722d('0x31')]||0x3;this['dialBusyRetryFrequency']=_0x3dbb7a[_0x722d('0x32')]||0x96;this[_0x722d('0x33')]=_0x3dbb7a['dialNoAnswerMaxRetry']||0x3;this[_0x722d('0x34')]=_0x3dbb7a['dialNoAnswerRetryFrequency']||0x96;this[_0x722d('0x35')]=_0x3dbb7a['dialNoSuchNumberMaxRetry']||0x3;this[_0x722d('0x36')]=_0x3dbb7a[_0x722d('0x36')]||0x96;this[_0x722d('0x37')]=_0x3dbb7a[_0x722d('0x37')]||0x3;this['dialDropRetryFrequency']=_0x3dbb7a[_0x722d('0x38')]||0x96;this[_0x722d('0x39')]=_0x3dbb7a[_0x722d('0x39')]||0x3;this[_0x722d('0x3a')]=_0x3dbb7a[_0x722d('0x3a')]||0x96;this['dialMachineMaxRetry']=_0x3dbb7a[_0x722d('0x3b')]||0x3;this[_0x722d('0x3c')]=_0x3dbb7a[_0x722d('0x3c')]||0x96;this[_0x722d('0x3d')]=_0x3dbb7a[_0x722d('0x3d')]||0x3;this['dialAgentRejectRetryFrequency']=_0x3dbb7a['dialAgentRejectRetryFrequency']||0x96;this[_0x722d('0x3e')]=_0x3dbb7a[_0x722d('0x3e')]||0x4;this[_0x722d('0x3f')]=_0x3dbb7a[_0x722d('0x3f')]?_0x3dbb7a['Trunk']:undefined;this['TrunkBackup']=_0x3dbb7a[_0x722d('0x40')]?_0x3dbb7a['TrunkBackup']:undefined;this['dialPrefix']=_0x3dbb7a[_0x722d('0x41')]||undefined;this[_0x722d('0x42')]=_0x3dbb7a[_0x722d('0x42')]?_0x3dbb7a[_0x722d('0x42')]:undefined;this[_0x722d('0x43')]=_0x3dbb7a[_0x722d('0x43')]||'DESC';this[_0x722d('0x44')]=_0x3dbb7a[_0x722d('0x44')]||undefined;this[_0x722d('0x45')]=_0x3dbb7a[_0x722d('0x45')]||undefined;this[_0x722d('0x46')]=strategy[_0x3dbb7a[_0x722d('0x46')]]||_0x722d('0x7');this['queueStatusComplete']=!![];this[_0x722d('0x47')]=_0x3dbb7a[_0x722d('0x47')]||![];this[_0x722d('0x48')]=_0x3dbb7a[_0x722d('0x48')];this['dialAMDGreeting']=_0x3dbb7a[_0x722d('0x49')];this['dialAMDAfterGreetingSilence']=_0x3dbb7a['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x3dbb7a['dialAMDTotalAnalysisTime'];this[_0x722d('0x4a')]=_0x3dbb7a[_0x722d('0x4a')];this['dialAMDBetweenWordsSilence']=_0x3dbb7a[_0x722d('0x4b')];this[_0x722d('0x4c')]=_0x3dbb7a['dialAMDMaximumNumberOfWords'];this[_0x722d('0x4d')]=_0x3dbb7a[_0x722d('0x4d')];this[_0x722d('0x4e')]=_0x3dbb7a[_0x722d('0x4e')];this['outboundRejectCallsDay']=0x0;this[_0x722d('0x4f')]=0x0;this[_0x722d('0x50')]=_0x3dbb7a[_0x722d('0x50')];this['outboundAnswerCallsDay']=0x0;this[_0x722d('0x51')]=0x0;this[_0x722d('0x52')]=0x0;this[_0x722d('0x53')]=0x0;this[_0x722d('0x54')]=0x0;this[_0x722d('0x55')]=0x0;this[_0x722d('0x56')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x722d('0x57')]=0x0;this[_0x722d('0x58')]=0x0;this[_0x722d('0x59')]=0x0;this[_0x722d('0x5a')]=0x0;this[_0x722d('0x5b')]=0x0;this[_0x722d('0x5c')]=0x0;this[_0x722d('0x5d')]=undefined;this[_0x722d('0x5e')]=undefined;this['handlePredictive']=undefined;this[_0x722d('0x5f')]=1.05;this[_0x722d('0x60')]=0x0;this[_0x722d('0x61')]=0x0;this[_0x722d('0x62')]=0x0;this[_0x722d('0x63')]=0x0;this[_0x722d('0x64')]=0x0;this[_0x722d('0x65')]=0x0;this[_0x722d('0x66')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x722d('0x67')]=_0x3dbb7a[_0x722d('0x68')]||0x14;this[_0x722d('0x69')]=_0x3dbb7a[_0x722d('0x68')]||0xa;this[_0x722d('0x6a')]=0x0;this[_0x722d('0x6b')]=0x0;this[_0x722d('0x6c')]=0x1;this[_0x722d('0x6d')]=0x0;this['erlangCallToSecond']=0x0;this[_0x722d('0x6e')]=0x0;this[_0x722d('0x6f')]=0x0;this[_0x722d('0x70')]=_0x3dbb7a[_0x722d('0x70')]||0x1e;this[_0x722d('0x71')]=_0x3dbb7a['dialRecallInQueue']||![];this[_0x722d('0x72')]=_0x3dbb7a[_0x722d('0x72')]||undefined;this[_0x722d('0x73')]=_0x3dbb7a[_0x722d('0x73')]||![];this[_0x722d('0x74')]=_0x3dbb7a['dialAgiAfterHangupAgent']||![];this[_0x722d('0xa')]=monitorFormat[_0x3dbb7a['monitor_format']]?monitorFormat[_0x3dbb7a[_0x722d('0xa')]]:undefined;this[_0x722d('0x75')]=_0x3dbb7a['mandatoryDisposition']||![];this[_0x722d('0x76')]=_0x3dbb7a[_0x722d('0x76')]?_0x3dbb7a['mandatoryDispositionPause']:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 31530a3..3f8a62c 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 _0x7cef=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x56dda5,_0x40d426){var _0x12574f=function(_0x27934c){while(--_0x27934c){_0x56dda5['push'](_0x56dda5['shift']());}};_0x12574f(++_0x40d426);}(_0x7cef,0xe4));var _0xf7ce=function(_0x9d781e,_0x19598a){_0x9d781e=_0x9d781e-0x0;var _0x1011d3=_0x7cef[_0x9d781e];return _0x1011d3;};'use strict';function VtigerAccount(_0xdcbf20){this['id']=_0xdcbf20['id']||0x0;this[_0xf7ce('0x0')]=_0xdcbf20['name']||'';this[_0xf7ce('0x1')]=_0xdcbf20[_0xf7ce('0x1')]||'';this['accessKey']=_0xdcbf20[_0xf7ce('0x2')]||'';this[_0xf7ce('0x3')]=_0xdcbf20[_0xf7ce('0x3')]||'';this[_0xf7ce('0x4')]=_0xdcbf20[_0xf7ce('0x4')]||'';this[_0xf7ce('0x5')]=_0xdcbf20[_0xf7ce('0x5')]||{};}module[_0xf7ce('0x6')]=VtigerAccount; \ No newline at end of file +var _0x31b3=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x12c047,_0x40c3c0){var _0x194d65=function(_0x5dd6cc){while(--_0x5dd6cc){_0x12c047['push'](_0x12c047['shift']());}};_0x194d65(++_0x40c3c0);}(_0x31b3,0x14a));var _0x331b=function(_0x408e97,_0x4b23e2){_0x408e97=_0x408e97-0x0;var _0x227b62=_0x31b3[_0x408e97];return _0x227b62;};'use strict';function VtigerAccount(_0x352aba){this['id']=_0x352aba['id']||0x0;this['name']=_0x352aba[_0x331b('0x0')]||'';this[_0x331b('0x1')]=_0x352aba['username']||'';this['accessKey']=_0x352aba[_0x331b('0x2')]||'';this['remoteUri']=_0x352aba[_0x331b('0x3')]||'';this[_0x331b('0x4')]=_0x352aba[_0x331b('0x4')]||'';this['Configurations']=_0x352aba[_0x331b('0x5')]||{};}module[_0x331b('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 add9837..4fc88c3 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 _0xf309=['exports','name','username','password','token','remoteUri','authType','type','serverUrl','Configurations'];(function(_0x1bc150,_0x2d1bfd){var _0x234d69=function(_0x12e003){while(--_0x12e003){_0x1bc150['push'](_0x1bc150['shift']());}};_0x234d69(++_0x2d1bfd);}(_0xf309,0x1d7));var _0x9f30=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf309[_0x432682];return _0x463d05;};'use strict';function ZendeskAccount(_0x5b7864){this['id']=_0x5b7864['id']||0x0;this['name']=_0x5b7864[_0x9f30('0x0')]||'';this[_0x9f30('0x1')]=_0x5b7864[_0x9f30('0x1')]||'';this[_0x9f30('0x2')]=_0x5b7864['password']||'';this[_0x9f30('0x3')]=_0x5b7864[_0x9f30('0x3')]||'';this[_0x9f30('0x4')]=_0x5b7864['remoteUri']||'';this[_0x9f30('0x5')]=_0x5b7864[_0x9f30('0x5')]||'';this[_0x9f30('0x6')]=_0x5b7864[_0x9f30('0x6')]||'integrationTab';this[_0x9f30('0x7')]=_0x5b7864[_0x9f30('0x7')]||'';this[_0x9f30('0x8')]=_0x5b7864[_0x9f30('0x8')]||{};}module[_0x9f30('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x8b09=['token','remoteUri','authType','type','serverUrl','Configurations','exports','name','username','password'];(function(_0x2ce49c,_0x5e04dd){var _0x44a958=function(_0x1fc253){while(--_0x1fc253){_0x2ce49c['push'](_0x2ce49c['shift']());}};_0x44a958(++_0x5e04dd);}(_0x8b09,0x15b));var _0x98b0=function(_0x13030e,_0x4e9c89){_0x13030e=_0x13030e-0x0;var _0x5b4f69=_0x8b09[_0x13030e];return _0x5b4f69;};'use strict';function ZendeskAccount(_0x3e6066){this['id']=_0x3e6066['id']||0x0;this[_0x98b0('0x0')]=_0x3e6066[_0x98b0('0x0')]||'';this[_0x98b0('0x1')]=_0x3e6066[_0x98b0('0x1')]||'';this[_0x98b0('0x2')]=_0x3e6066[_0x98b0('0x2')]||'';this[_0x98b0('0x3')]=_0x3e6066[_0x98b0('0x3')]||'';this['remoteUri']=_0x3e6066[_0x98b0('0x4')]||'';this[_0x98b0('0x5')]=_0x3e6066[_0x98b0('0x5')]||'';this[_0x98b0('0x6')]=_0x3e6066[_0x98b0('0x6')]||'integrationTab';this[_0x98b0('0x7')]=_0x3e6066[_0x98b0('0x7')]||'';this[_0x98b0('0x8')]=_0x3e6066[_0x98b0('0x8')]||{};}module[_0x98b0('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 bf1018f..4f62f3d 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 _0xb6ea=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0xb6ea,0x10a));var _0xab6e=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb6ea[_0x4b369d];return _0x571a98;};'use strict';function ZohoAccount(_0x3627fd){this['id']=_0x3627fd['id']||0x0;this[_0xab6e('0x0')]=_0x3627fd['name']||'';this[_0xab6e('0x1')]=_0x3627fd['description']||'';this[_0xab6e('0x2')]=_0x3627fd[_0xab6e('0x2')]||'';this['zone']=_0x3627fd[_0xab6e('0x3')]||'';this[_0xab6e('0x4')]=_0x3627fd[_0xab6e('0x4')]||'';this['clientSecret']=_0x3627fd[_0xab6e('0x5')]||'';this[_0xab6e('0x6')]=_0x3627fd[_0xab6e('0x6')]||'';this[_0xab6e('0x7')]=_0x3627fd[_0xab6e('0x7')]||'';this['refreshToken']=_0x3627fd[_0xab6e('0x8')]||'';this['Configurations']=_0x3627fd[_0xab6e('0x9')]||{};}module[_0xab6e('0xa')]=ZohoAccount; \ No newline at end of file +var _0xabcf=['clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host','zone','clientId'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xabcf,0x1d1));var _0xfabc=function(_0x47490d,_0x579402){_0x47490d=_0x47490d-0x0;var _0x3ed4ad=_0xabcf[_0x47490d];return _0x3ed4ad;};'use strict';function ZohoAccount(_0x13df4d){this['id']=_0x13df4d['id']||0x0;this['name']=_0x13df4d[_0xfabc('0x0')]||'';this[_0xfabc('0x1')]=_0x13df4d[_0xfabc('0x1')]||'';this['host']=_0x13df4d[_0xfabc('0x2')]||'';this[_0xfabc('0x3')]=_0x13df4d[_0xfabc('0x3')]||'';this['clientId']=_0x13df4d[_0xfabc('0x4')]||'';this[_0xfabc('0x5')]=_0x13df4d[_0xfabc('0x5')]||'';this[_0xfabc('0x6')]=_0x13df4d[_0xfabc('0x6')]||'';this[_0xfabc('0x7')]=_0x13df4d[_0xfabc('0x7')]||'';this['refreshToken']=_0x13df4d[_0xfabc('0x8')]||'';this['Configurations']=_0x13df4d[_0xfabc('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index cd986eb..1461e5b 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 _0x74c6=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','exports','util','lodash','moment','isNil','string','queue','name','type','campaigntype','dialAnswer','Agent','channelAgent','membername','SIP/%s','calleridname','Contact','phone','firstName','lastName','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x74c6,0x15d));var _0x674c=function(_0x1eb126,_0x1c0265){_0x1eb126=_0x1eb126-0x0;var _0x345fc8=_0x74c6[_0x1eb126];return _0x345fc8;};'use strict';var util=require(_0x674c('0x0'));var _=require(_0x674c('0x1'));var moment=require(_0x674c('0x2'));function checkNameSurname(_0x3f0c64,_0x1abff6,_0x3a9bba){var _0x76a519='';if(!_[_0x674c('0x3')](_0x1abff6)&&_0x674c('0x4')===typeof _0x1abff6){_0x76a519+=_0x1abff6;}if(!_[_0x674c('0x3')](_0x3a9bba)&&'string'===typeof _0x3a9bba){_0x76a519+='\x20'+_0x3a9bba;}if(_0x76a519!==''){return _0x76a519;}return _0x3f0c64;}function Action(_0x4e9d88,_0x5466c5,_0x2b1080,_0x1cd419,_0x1a0ff3){this['uniqueid']=_0x2b1080||undefined;this['idContact']=_0x4e9d88['id'];this[_0x674c('0x5')]=_0x5466c5[_0x674c('0x6')];this['type']=_0x5466c5[_0x674c('0x7')];this[_0x674c('0x8')]='queue';this[_0x674c('0x9')]=![];this['membername']=_[_0x674c('0x3')](_0x4e9d88[_0x674c('0xa')])?undefined:_0x4e9d88[_0x674c('0xa')][_0x674c('0x6')];this[_0x674c('0xb')]=this[_0x674c('0xc')]?util['format'](_0x674c('0xd'),this[_0x674c('0xc')]):_0x1cd419||undefined;this[_0x674c('0xe')]=checkNameSurname(_0x4e9d88[_0x674c('0xf')][_0x674c('0x10')],_0x4e9d88[_0x674c('0xf')][_0x674c('0x11')],_0x4e9d88[_0x674c('0xf')][_0x674c('0x12')]);this['active']=_0x4e9d88['active']||![];this['calleridnum']=_0x4e9d88[_0x674c('0xf')][_0x674c('0x10')];this[_0x674c('0x13')]=_0x4e9d88['scheduledat'];this[_0x674c('0x14')]=_0x4e9d88[_0x674c('0x14')]||0x0;this[_0x674c('0x15')]=_0x4e9d88[_0x674c('0x15')]||0x0;this[_0x674c('0x16')]=_0x4e9d88['countnoanswerretry']||0x0;this[_0x674c('0x17')]=(_0x4e9d88[_0x674c('0x14')]||0x0)+(_0x4e9d88[_0x674c('0x15')]||0x0)+(_0x4e9d88['countnoanswerretry']||0x0)+(_0x4e9d88[_0x674c('0x18')]||0x0)+(_0x4e9d88[_0x674c('0x19')]||0x0)+(_0x4e9d88['countabandonedretry']||0x0)+(_0x4e9d88['countmachineretry']||0x0)+(_0x4e9d88['countagentrejectretry']||0x0);this['countnosuchnumberretry']=_0x4e9d88[_0x674c('0x18')]||0x0;this[_0x674c('0x19')]=_0x4e9d88[_0x674c('0x19')]||0x0;this[_0x674c('0x1a')]=_0x4e9d88['countabandonedretry']||0x0;this['countmachineretry']=_0x4e9d88[_0x674c('0x1b')]||0x0;this[_0x674c('0x1c')]=_0x4e9d88[_0x674c('0x1c')]||0x0;this[_0x674c('0x1d')]=_0x4e9d88[_0x674c('0x1d')];this[_0x674c('0x1e')]=_0x4e9d88['callbackuniqueid'];this['callbackat']=_0x4e9d88[_0x674c('0x1f')];this['recallme']=_0x4e9d88[_0x674c('0x20')];this[_0x674c('0x21')]=_0x4e9d88[_0x674c('0x21')];this[_0x674c('0x22')]=_0x4e9d88['ListId'];this['UserId']=_[_0x674c('0x3')](_0x4e9d88[_0x674c('0xa')])?_0x4e9d88['UserId']:_0x4e9d88[_0x674c('0xa')]['id'];this['VoiceQueueId']=_0x4e9d88[_0x674c('0x23')];this[_0x674c('0x24')]='';this[_0x674c('0x25')]='';}Action[_0x674c('0x26')][_0x674c('0x27')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0x674c('0xe')],this[_0x674c('0x28')]);};module[_0x674c('0x29')]=Action; \ No newline at end of file +var _0x8ebe=['exports','lodash','isNil','string','idContact','type','campaigntype','queue','membername','Agent','name','channelAgent','format','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>'];(function(_0xea6018,_0x4cf082){var _0x57b54d=function(_0x49099a){while(--_0x49099a){_0xea6018['push'](_0xea6018['shift']());}};_0x57b54d(++_0x4cf082);}(_0x8ebe,0x1b9));var _0xe8eb=function(_0x28f32c,_0x4cc342){_0x28f32c=_0x28f32c-0x0;var _0x355402=_0x8ebe[_0x28f32c];return _0x355402;};'use strict';var util=require('util');var _=require(_0xe8eb('0x0'));var moment=require('moment');function checkNameSurname(_0x2cbca4,_0x3510c5,_0x2e6a13){var _0x3d1fae='';if(!_[_0xe8eb('0x1')](_0x3510c5)&&_0xe8eb('0x2')===typeof _0x3510c5){_0x3d1fae+=_0x3510c5;}if(!_[_0xe8eb('0x1')](_0x2e6a13)&&_0xe8eb('0x2')===typeof _0x2e6a13){_0x3d1fae+='\x20'+_0x2e6a13;}if(_0x3d1fae!==''){return _0x3d1fae;}return _0x2cbca4;}function Action(_0x114b19,_0x1687f6,_0x6f8404,_0x3edf,_0x31076d){this['uniqueid']=_0x6f8404||undefined;this[_0xe8eb('0x3')]=_0x114b19['id'];this['queue']=_0x1687f6['name'];this['type']=_0x1687f6[_0xe8eb('0x4')];this[_0xe8eb('0x5')]=_0xe8eb('0x6');this['dialAnswer']=![];this[_0xe8eb('0x7')]=_[_0xe8eb('0x1')](_0x114b19[_0xe8eb('0x8')])?undefined:_0x114b19[_0xe8eb('0x8')][_0xe8eb('0x9')];this[_0xe8eb('0xa')]=this[_0xe8eb('0x7')]?util[_0xe8eb('0xb')]('SIP/%s',this[_0xe8eb('0x7')]):_0x3edf||undefined;this['calleridname']=checkNameSurname(_0x114b19[_0xe8eb('0xc')][_0xe8eb('0xd')],_0x114b19['Contact'][_0xe8eb('0xe')],_0x114b19[_0xe8eb('0xc')][_0xe8eb('0xf')]);this['active']=_0x114b19[_0xe8eb('0x10')]||![];this[_0xe8eb('0x11')]=_0x114b19['Contact'][_0xe8eb('0xd')];this[_0xe8eb('0x12')]=_0x114b19[_0xe8eb('0x12')];this['countbusyretry']=_0x114b19[_0xe8eb('0x13')]||0x0;this[_0xe8eb('0x14')]=_0x114b19[_0xe8eb('0x14')]||0x0;this[_0xe8eb('0x15')]=_0x114b19[_0xe8eb('0x15')]||0x0;this['countglobal']=(_0x114b19[_0xe8eb('0x13')]||0x0)+(_0x114b19[_0xe8eb('0x14')]||0x0)+(_0x114b19['countnoanswerretry']||0x0)+(_0x114b19[_0xe8eb('0x16')]||0x0)+(_0x114b19[_0xe8eb('0x17')]||0x0)+(_0x114b19['countabandonedretry']||0x0)+(_0x114b19['countmachineretry']||0x0)+(_0x114b19[_0xe8eb('0x18')]||0x0);this[_0xe8eb('0x16')]=_0x114b19['countnosuchnumberretry']||0x0;this[_0xe8eb('0x17')]=_0x114b19[_0xe8eb('0x17')]||0x0;this['countabandonedretry']=_0x114b19[_0xe8eb('0x19')]||0x0;this[_0xe8eb('0x1a')]=_0x114b19['countmachineretry']||0x0;this[_0xe8eb('0x18')]=_0x114b19[_0xe8eb('0x18')]||0x0;this['callback']=_0x114b19[_0xe8eb('0x1b')];this[_0xe8eb('0x1c')]=_0x114b19[_0xe8eb('0x1c')];this[_0xe8eb('0x1d')]=_0x114b19[_0xe8eb('0x1d')];this[_0xe8eb('0x1e')]=_0x114b19['recallme'];this[_0xe8eb('0x1f')]=_0x114b19['ContactId'];this[_0xe8eb('0x20')]=_0x114b19[_0xe8eb('0x20')];this[_0xe8eb('0x21')]=_[_0xe8eb('0x1')](_0x114b19[_0xe8eb('0x8')])?_0x114b19['UserId']:_0x114b19['Agent']['id'];this[_0xe8eb('0x22')]=_0x114b19[_0xe8eb('0x22')];this[_0xe8eb('0x23')]='';this[_0xe8eb('0x24')]='';}Action['prototype'][_0xe8eb('0x25')]=function(){return util[_0xe8eb('0xb')](_0xe8eb('0x26'),this['calleridname'],this['number']);};module[_0xe8eb('0x27')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 530f317..f324ce8 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 _0xc4aa=['syncCampaigns','hasOwnProperty','preview','type','setMessage','recallMe','clearZombieChannel','enqueue','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking:\x20','pick','contactId','UserId','VoiceQueueId','ListId','status','channel','catch','No\x20such\x20channel','updateOriginated','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','dialRecallMeTimeout','voicePause','run','logger2','[RecallMe]','logCustomer','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','YYYY-MM-DD\x20HH:mm:ss','responsetime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswerGlobal]','talktime','[syncHangup][talking][decrement]','uniqueid','BUSY','countbusyretry','Busy','busy','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','countagentrejectretry','AgentReject','custom:agentreject','agentreject','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','countabandonedetry','dialAbandonedMaxRety','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedRetryFrequency','cause-txt','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','isTrunkReachable','SIP/%s','reachable','unmonitored','execRun','unlockContact','disableContact','recallme','validateContact','isValid','logger','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','toLowerVariables','Action','channelAgent','destconnectedlinenum','user:%s','user:agentconnect','accountcode','calleridnum','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','lookAgent','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','rejected','starttime','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','channelstate','transfer','[syncHangup][talking][transfer]','syncDialEnd','destlinkedid','syncHangupRequest','addVariable','variables','filterKey','keys','variable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','./action','redis','localhost','socket.io-emitter','prototype','tail','finally','sequence','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','outbound','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','NOT_ACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','message','IS_DISACTIVED','\x20is\x20disactive'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc4aa,0xf9));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'use strict';var util=require(_0xac4a('0x0'));var _=require('lodash');var BPromise=require('bluebird');var uuid=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var md5=require(_0xac4a('0x3'));var Redis=require(_0xac4a('0x4'));var config=require(_0xac4a('0x5'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0xac4a('0x6'))(_0xac4a('0x7'));var ami=require(_0xac4a('0x8'));var rpcDb=require(_0xac4a('0x9'));var Action=require(_0xac4a('0xa'));var ut=require('./util/util');config[_0xac4a('0xb')]=_['defaults'](config['redis'],{'host':_0xac4a('0xc'),'port':0x18eb});var io=require(_0xac4a('0xd'))(new Redis(config[_0xac4a('0xb')]));var Sequence=function(){};Sequence[_0xac4a('0xe')]['enqueue']=function(_0x1be171){this[_0xac4a('0xf')]=this['tail']?this['tail'][_0xac4a('0x10')](_0x1be171):_0x1be171();};function Preview(_0x13e354){this[_0xac4a('0x11')]=new Sequence();this['campaignsPreview']=_0x13e354[_0xac4a('0x12')];this[_0xac4a('0x13')]=_0x13e354[_0xac4a('0x13')];this[_0xac4a('0x14')]={};this['agents']=_0x13e354[_0xac4a('0x15')];this[_0xac4a('0x16')]=0x0;ami['on'](_0xac4a('0x17'),this['syncOriginateResponse'][_0xac4a('0x18')](this));ami['on'](_0xac4a('0x19'),this[_0xac4a('0x1a')][_0xac4a('0x18')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0xac4a('0x18')](this));ami['on']('dialend',this['syncDialEnd'][_0xac4a('0x18')](this));ami['on'](_0xac4a('0x1b'),this[_0xac4a('0x1c')]['bind'](this));ami['on'](_0xac4a('0x1d'),this[_0xac4a('0x1e')][_0xac4a('0x18')](this));ami['on'](_0xac4a('0x1f'),this[_0xac4a('0x20')]['bind'](this));ami['on'](_0xac4a('0x21'),this[_0xac4a('0x22')][_0xac4a('0x18')](this));this[_0xac4a('0x23')](this[_0xac4a('0x24')]);}function emit(_0x211d2b,_0xa33125,_0xc65a62){io['to'](_0x211d2b)[_0xac4a('0x25')](_0xa33125,_0xc65a62);}function emitCampaignPreview(_0x52d1af){if(_0x52d1af['type']===_0xac4a('0x26')){var _0x35ede0={'id':_0x52d1af['id'],'name':_0x52d1af[_0xac4a('0x27')],'strategy':_0x52d1af[_0xac4a('0x28')],'answered':_0x52d1af[_0xac4a('0x29')],'available':_0x52d1af[_0xac4a('0x2a')],'loggedIn':_0x52d1af[_0xac4a('0x2b')],'pTalking':_0x52d1af[_0xac4a('0x2c')],'sumBillable':_0x52d1af[_0xac4a('0x2d')],'sumDuration':_0x52d1af[_0xac4a('0x2e')],'sumHoldTime':_0x52d1af[_0xac4a('0x2f')]||0x0,'talking':_0x52d1af[_0xac4a('0x30')],'total':_0x52d1af[_0xac4a('0x31')],'type':_0x52d1af['type'],'unmanaged':_0x52d1af['unmanaged'],'abandoned':_0x52d1af[_0xac4a('0x32')],'waiting':_0x52d1af[_0xac4a('0x33')],'loggedInDb':_0x52d1af[_0xac4a('0x34')],'dialActive':_0x52d1af[_0xac4a('0x35')],'dialMethod':_0x52d1af[_0xac4a('0x36')],'dialOriginateCallerIdName':_0x52d1af[_0xac4a('0x37')],'dialOriginateCallerIdNumber':_0x52d1af[_0xac4a('0x38')],'dialOriginateTimeout':_0x52d1af[_0xac4a('0x39')],'dialPrefix':_0x52d1af[_0xac4a('0x3a')],'outboundAnswerAgiCallsDay':_0x52d1af['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x52d1af['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x52d1af[_0xac4a('0x3b')],'outboundBusyCallsDay':_0x52d1af['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x52d1af[_0xac4a('0x3c')],'outboundDropCallsDayACS':_0x52d1af[_0xac4a('0x3d')],'outboundDropCallsDayCallersExit':_0x52d1af[_0xac4a('0x3e')],'outboundDropCallsDayTimeout':_0x52d1af[_0xac4a('0x3f')],'outboundNoAnswerCallsDay':_0x52d1af[_0xac4a('0x40')],'outboundNoSuchCallsDay':_0x52d1af[_0xac4a('0x41')],'outboundOriginateFailureCallsDay':_0x52d1af[_0xac4a('0x42')],'outboundReCallsDay':_0x52d1af[_0xac4a('0x43')],'outboundRejectCallsDay':_0x52d1af[_0xac4a('0x44')],'outboundUnknownCallsDay':_0x52d1af[_0xac4a('0x45')],'outboundAbandonedCallsDay':_0x52d1af['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x52d1af[_0xac4a('0x46')],'predictiveIntervalAvgHoldtime':_0x52d1af[_0xac4a('0x47')],'predictiveIntervalAvgTalktime':_0x52d1af[_0xac4a('0x48')],'predictiveIntervalDroppedCallsCallersExit':_0x52d1af[_0xac4a('0x49')],'predictiveIntervalDroppedCallsTimeout':_0x52d1af[_0xac4a('0x4a')],'predictiveIntervalErlangCalls':_0x52d1af[_0xac4a('0x4b')],'predictiveIntervalErlangCallsDroppedCalls':_0x52d1af[_0xac4a('0x4c')],'predictiveIntervalHitRate':_0x52d1af[_0xac4a('0x4d')],'predictiveIntervalMultiplicativeFactor':_0x52d1af[_0xac4a('0x4e')],'predictiveIntervalPauses':_0x52d1af[_0xac4a('0x4f')],'predictiveIntervalAvailable':_0x52d1af[_0xac4a('0x50')],'predictiveIntervalTotalCalls':_0x52d1af[_0xac4a('0x51')],'message':_0x52d1af['message'],'originated':_0x52d1af[_0xac4a('0x52')],'erlangCalls':_0x52d1af[_0xac4a('0x53')],'erlangCallToSecond':_0x52d1af[_0xac4a('0x54')],'erlangAbandonmentRate':_0x52d1af[_0xac4a('0x55')],'erlangBusyFactor':_0x52d1af[_0xac4a('0x56')],'startPredictive':_0x52d1af[_0xac4a('0x57')],'startProgressive':_0x52d1af[_0xac4a('0x58')]};if(_0x52d1af[_0xac4a('0x59')]){_0x35ede0[_0xac4a('0x59')]={'id':_0x52d1af[_0xac4a('0x59')]['id'],'name':_0x52d1af[_0xac4a('0x59')][_0xac4a('0x27')],'active':_0x52d1af['Trunk'][_0xac4a('0x5a')],'callerid':_0x52d1af['Trunk'][_0xac4a('0x5b')]};}if(_0x52d1af['Interval']){_0x35ede0[_0xac4a('0x5c')]={'id':_0x52d1af[_0xac4a('0x5c')]['id'],'name':_0x52d1af[_0xac4a('0x5c')][_0xac4a('0x27')]};}var _0x313b47=md5(JSON['stringify'](_0x35ede0));if(_0x52d1af[_0xac4a('0x3')]!==_0x313b47){_0x52d1af[_0xac4a('0x3')]=_0x313b47;emit(util['format']('voice:queue:%s',_0x35ede0[_0xac4a('0x27')]),_0xac4a('0x5d'),_0x35ede0);}}}function emitVoiceQueueChannelRemove(_0x280414){logger[_0xac4a('0x5e')](_0xac4a('0x5f'),JSON[_0xac4a('0x60')](_0x280414));emit(util[_0xac4a('0x61')](_0xac4a('0x62'),_0x280414['name']),_0xac4a('0x63'),_0x280414);io[_0xac4a('0x25')](_0xac4a('0x64'),_0x280414);}function notSendMessagesQueue(_0x56b041){if(_0x56b041[_0xac4a('0x65')]){if(_0x56b041[_0xac4a('0x52')]===0x0&&_0x56b041[_0xac4a('0x2c')]===0x0){_0x56b041[_0xac4a('0x65')]=![];_0x56b041[_0xac4a('0x2a')]=0x0;_0x56b041['paused']=0x0;_0x56b041['message']=_0xac4a('0x66');ut['logger'](_0xac4a('0x67'),_0x56b041[_0xac4a('0x27')]+'\x20is\x20not\x20active');}else{_0x56b041[_0xac4a('0x68')]=_0xac4a('0x69');ut['logger'](_0xac4a('0x67'),_0x56b041[_0xac4a('0x27')]+_0xac4a('0x6a'));}emitCampaignPreview(_0x56b041);}}Preview['prototype'][_0xac4a('0x23')]=function(){var _0x27651e=this;setInterval(function(){_0x27651e[_0xac4a('0x6b')]();},0x7cf);};Preview[_0xac4a('0xe')][_0xac4a('0x6b')]=function(){var _0xf4c3f0=this[_0xac4a('0x24')];this[_0xac4a('0x16')]+=0x1;for(var _0x1c0dfd in _0xf4c3f0){if(_0xf4c3f0[_0xac4a('0x6c')](_0x1c0dfd)&&(_0xf4c3f0[_0x1c0dfd][_0xac4a('0x36')]===_0xac4a('0x6d')||_0xf4c3f0[_0x1c0dfd][_0xac4a('0x36')]==='booked')&&_0xf4c3f0[_0x1c0dfd][_0xac4a('0x6e')]===_0xac4a('0x26')){if(this[_0xac4a('0x16')]>0x7){this[_0xac4a('0x16')]=0x0;this['clearZombieChannels']();}}if(_0xf4c3f0[_0xac4a('0x6c')](_0x1c0dfd)&&_0xf4c3f0[_0x1c0dfd]['dialMethod']===_0xac4a('0x6d')&&_0xf4c3f0[_0x1c0dfd][_0xac4a('0x6e')]===_0xac4a('0x26')){if(_0xf4c3f0[_0x1c0dfd][_0xac4a('0x35')]){this[_0xac4a('0x6f')](_0xf4c3f0[_0x1c0dfd]);this[_0xac4a('0x70')](_0xf4c3f0[_0x1c0dfd]);}else{notSendMessagesQueue(_0xf4c3f0[_0x1c0dfd]);}}}};Preview[_0xac4a('0xe')][_0xac4a('0x71')]=function(_0x229b22){var _0x5d547b=this;this[_0xac4a('0x11')][_0xac4a('0x72')](function(){if(!_['isNil'](_0x5d547b['actions'][_0x229b22])){loggerAction[_0xac4a('0x5e')](_0xac4a('0x73'),_0x229b22,_0xac4a('0x74'),_0x5d547b['actions'][_0x229b22]['queue'],_0xac4a('0x75'),JSON['stringify'](_0x5d547b[_0xac4a('0x24')][_0x5d547b[_0xac4a('0x14')][_0x229b22][_0xac4a('0x76')]][_0xac4a('0x52')]),_0xac4a('0x77'),JSON[_0xac4a('0x60')](_0x5d547b[_0xac4a('0x24')][_0x5d547b['actions'][_0x229b22][_0xac4a('0x76')]][_0xac4a('0x2c')]),JSON[_0xac4a('0x60')](_0x5d547b[_0xac4a('0x14')][_0x229b22]['dialAnswer']),JSON[_0xac4a('0x60')](_[_0xac4a('0x78')](_0x5d547b[_0xac4a('0x14')][_0x229b22],[_0xac4a('0x79'),_0xac4a('0x7a'),_0xac4a('0x7b'),_0xac4a('0x7c')])));return ami['Action']({'action':_0xac4a('0x7d'),'channel':_0x5d547b[_0xac4a('0x14')][_0x229b22][_0xac4a('0x7e')]})[_0xac4a('0x7f')](function(_0x186496){if(_0x186496['message']===_0xac4a('0x80')){setTimeout(function(){if(_0x5d547b[_0xac4a('0x14')][_0x229b22]){ut[_0xac4a('0x81')](_0x5d547b[_0xac4a('0x24')][_0x5d547b[_0xac4a('0x14')][_0x229b22][_0xac4a('0x76')]],'[clearZombieChannel]');if(_0x5d547b[_0xac4a('0x14')][_0x229b22][_0xac4a('0x82')]===!![]){ut[_0xac4a('0x83')](_0x5d547b[_0xac4a('0x24')][_0x5d547b[_0xac4a('0x14')][_0x229b22][_0xac4a('0x76')]],_0xac4a('0x84'));ut[_0xac4a('0x85')](_0xac4a('0x86')+_0x229b22,_0x5d547b[_0xac4a('0x14')][_0x229b22]['queue']);}ut['loggerError'](_0xac4a('0x87')+_0x229b22,_0x5d547b[_0xac4a('0x14')][_0x229b22][_0xac4a('0x76')]);delete _0x5d547b[_0xac4a('0x14')][_0x229b22];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x2f3f56=this;loggerAction[_0xac4a('0x5e')](_0xac4a('0x88'),_[_0xac4a('0x89')](this[_0xac4a('0x14')]));for(var _0xc329ed in this[_0xac4a('0x14')]){if(_0x2f3f56[_0xac4a('0x14')]['hasOwnProperty'](_0xc329ed)){_0x2f3f56[_0xac4a('0x71')](_0xc329ed);}}};Preview[_0xac4a('0xe')][_0xac4a('0x70')]=function(_0x104577){var _0x1c2343=this;rpcDb[_0xac4a('0x8a')](_0x104577['id'],ut[_0xac4a('0x8b')](this[_0xac4a('0x15')]))[_0xac4a('0x8c')](function(_0x17a623){if(!_[_0xac4a('0x8d')](_0x17a623)){for(var _0x4fe99d=0x0;_0x4fe99d<_0x17a623[_0xac4a('0x8e')];_0x4fe99d+=0x1){if(ut[_0xac4a('0x8f')](_0x17a623[_0x4fe99d]['scheduledat'])<_0x104577[_0xac4a('0x90')]*0x3c){if(_0x17a623[_0x4fe99d]['Agent']&&!_0x17a623[_0x4fe99d]['Agent'][_0xac4a('0x91')]){_0x1c2343[_0xac4a('0x92')](_0x17a623[_0x4fe99d]['id'])['then'](ut[_0xac4a('0x93')]('[RecallMe]'))[_0xac4a('0x7f')](ut[_0xac4a('0x93')](_0xac4a('0x94')));}else{rpcDb['disableContact'](_0x17a623[_0x4fe99d]['id']);}}else{var _0x3427cf=new Action(_0x17a623[_0x4fe99d],_0x104577);_0x3427cf['starttime']=moment()[_0xac4a('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x104577[_0xac4a('0x43')]+=0x1;ut[_0xac4a('0x95')](_0x3427cf,0x17,'RecallInQueue');if(_0x104577[_0xac4a('0x96')]){rpcDb['rescheduleContactInQueue'](ut[_0xac4a('0x97')](_0x17a623[_0x4fe99d]));rpcDb[_0xac4a('0x98')](_0x3427cf,_0xac4a('0x99'));}else{ut[_0xac4a('0x95')](_0x3427cf,0x16,'RecallFailedTimeout');rpcDb[_0xac4a('0x98')](_0x3427cf,_0xac4a('0x9a'));rpcDb['createCustomerFinal'](_0x3427cf,_0xac4a('0x9a'));}}}}})[_0xac4a('0x7f')](ut['logger2'](_0xac4a('0x9b')));};Preview[_0xac4a('0xe')][_0xac4a('0x6f')]=function(_0xe50196){_0xe50196['sendMessageOneNotActive']=!![];if(ut[_0xac4a('0x9c')](_0xe50196[_0xac4a('0x2b')])){_0xe50196['message']=_0xac4a('0x9d');}else if(!ut[_0xac4a('0x9e')](_0xe50196['dialActive'])){_0xe50196['message']='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0xe50196[_0xac4a('0x59')])){if(!this['isTrunkReachable'](_0xe50196[_0xac4a('0x9f')])){_0xe50196[_0xac4a('0x68')]=_0xac4a('0xa0');}else{_0xe50196[_0xac4a('0x68')]=_0xac4a('0xa1');}}else{_0xe50196[_0xac4a('0x68')]='ACTIVE';}emitCampaignPreview(_0xe50196);};Preview[_0xac4a('0xe')][_0xac4a('0xa2')]=function(_0x2dfd4f,_0x1f6cf5,_0x4f9410){var _0xf1ab01=this;var _0x5ad022=this[_0xac4a('0x14')][_0x1f6cf5];var _0x10f3a9=this['campaignsPreview'][_0x5ad022[_0xac4a('0x76')]];var _0x43e10d;if(_0x10f3a9){switch(_0x4f9410){case'1':_0x10f3a9[_0xac4a('0x41')]+=0x1;_0x5ad022['countnosuchnumberretry']+=0x1;_0x5ad022[_0xac4a('0xa3')]=ut[_0xac4a('0xa4')](_0x5ad022);ut['logCustomer'](_0x5ad022,0x0,_0xac4a('0xa5'));ami[_0xac4a('0x25')]('custom:agentnosuchnumber',ut[_0xac4a('0xa6')](_0x5ad022,_0xac4a('0xa7')));rpcDb['createCustomerHistory'](_0x5ad022,_0xac4a('0xa8'));if(ut['totalGlobal'](_0x5ad022)>=_0x10f3a9[_0xac4a('0xa9')]){_0x43e10d=ut['cloneAction'](_0x5ad022,0xf,_0xac4a('0xaa'));rpcDb[_0xac4a('0xab')](_0x43e10d,_0xac4a('0xac'));}else{if(_0x5ad022[_0xac4a('0xad')]>=_0x10f3a9[_0xac4a('0xae')]){rpcDb['createCustomerFinal'](_0x5ad022,_0xac4a('0xac'));}else{rpcDb[_0xac4a('0xaf')](ut[_0xac4a('0xb0')](_0x5ad022,_0xac4a('0xad'),_0x10f3a9[_0xac4a('0xb1')]),_0x5ad022[_0xac4a('0xb2')],_0x5ad022[_0xac4a('0xb3')]);}}delete this[_0xac4a('0x14')][_0x2dfd4f[_0xac4a('0xb4')]];break;case'ANSWER':var _0x2d935f=moment()[_0xac4a('0x61')](_0xac4a('0xb5'));_0x5ad022[_0xac4a('0xb6')]=_0x2d935f;_0x5ad022['answertime']=_0x2d935f;_0x5ad022[_0xac4a('0x82')]=!![];_0x10f3a9['pTalking']+=0x1;logger[_0xac4a('0x5e')](_0xac4a('0xb7'),_0x5ad022['uniqueid'],_0xac4a('0xb8'),_0x10f3a9[_0xac4a('0x27')],_0xac4a('0x77'),_0x10f3a9[_0xac4a('0x2c')]);ami[_0xac4a('0x25')](_0xac4a('0xb9'),ut['buildObj'](_0x5ad022,_0xac4a('0xba'),this[_0xac4a('0x24')][_0x5ad022[_0xac4a('0x76')]]));if(_0x10f3a9['acw']){ami[_0xac4a('0x25')]('custom:agentConnectPreview',ut[_0xac4a('0xbb')](_0x5ad022));}break;case'16':ami[_0xac4a('0x25')](_0xac4a('0xbc'),ut[_0xac4a('0xa6')](_0x5ad022,_0xac4a('0xbd'),this[_0xac4a('0x24')][_0x5ad022['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x5ad022,_0xac4a('0xbd')));_0x10f3a9[_0xac4a('0xbe')]+=0x1;_0x10f3a9[_0xac4a('0x31')]+=0x1;_0x10f3a9[_0xac4a('0x29')]+=0x1;ut[_0xac4a('0x83')](_0x10f3a9,_0xac4a('0xbf'));_0x5ad022[_0xac4a('0xa3')]=ut['totalGlobal'](_0x5ad022);ut[_0xac4a('0x95')](_0x5ad022,0x4,_0xac4a('0xc0'));rpcDb[_0xac4a('0x98')](_0x5ad022,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0xac4a('0xab')](_0x5ad022,_0xac4a('0xc1'));rpcDb['crateCustomerReportQueue'](_0x5ad022);_0x10f3a9[_0xac4a('0x2e')]+=_0x5ad022[_0xac4a('0xc2')];_0x10f3a9[_0xac4a('0x2d')]+=_0x5ad022['talktime'];logger[_0xac4a('0x5e')](_0xac4a('0xc3'),_0x5ad022[_0xac4a('0xc4')],'\x20Queue',_0x10f3a9[_0xac4a('0x27')],_0xac4a('0x77'),_0x10f3a9['pTalking']);delete this[_0xac4a('0x14')][_0x2dfd4f[_0xac4a('0xb4')]];break;case _0xac4a('0xc5'):_0x10f3a9['outboundBusyCallsDay']+=0x1;_0x5ad022[_0xac4a('0xc6')]+=0x1;_0x5ad022['countglobal']=ut['totalGlobal'](_0x5ad022);ut['logCustomer'](_0x5ad022,0x5,_0xac4a('0xc7'));ami[_0xac4a('0x25')]('custom:agentbusy',ut[_0xac4a('0xa6')](_0x5ad022,_0xac4a('0xc8')));rpcDb[_0xac4a('0x98')](_0x5ad022,'[callProgressDetectingCustomer][logBusy]');if(ut[_0xac4a('0xa4')](_0x5ad022)>=_0x10f3a9[_0xac4a('0xa9')]){_0x43e10d=ut[_0xac4a('0xc9')](_0x5ad022,0xf,'Global');rpcDb[_0xac4a('0xab')](_0x43e10d,_0xac4a('0xca'));}else{if(_0x5ad022[_0xac4a('0xc6')]>=_0x10f3a9[_0xac4a('0xcb')]){rpcDb[_0xac4a('0xab')](_0x5ad022,_0xac4a('0xcc'));}else{rpcDb[_0xac4a('0xaf')](ut[_0xac4a('0xb0')](_0x5ad022,_0xac4a('0xc6'),_0x10f3a9['dialBusyRetryFrequency']),_0x5ad022[_0xac4a('0xb2')],_0x5ad022[_0xac4a('0xb3')]);}}break;case'NOANSWER':_0x10f3a9[_0xac4a('0x40')]+=0x1;_0x5ad022['countnoanswerretry']+=0x1;_0x5ad022[_0xac4a('0xa3')]=ut['totalGlobal'](_0x5ad022);ut[_0xac4a('0x95')](_0x5ad022,0x3,_0xac4a('0xcd'));ami[_0xac4a('0x25')](_0xac4a('0xce'),ut[_0xac4a('0xa6')](_0x5ad022,_0xac4a('0xcf')));rpcDb[_0xac4a('0x98')](_0x5ad022,_0xac4a('0xd0'));if(ut[_0xac4a('0xa4')](_0x5ad022)>=_0x10f3a9['dialGlobalMaxRetry']){_0x43e10d=ut[_0xac4a('0xc9')](_0x5ad022,0xf,_0xac4a('0xaa'));rpcDb[_0xac4a('0xab')](_0x43e10d,_0xac4a('0xd1'));}else{if(_0x5ad022[_0xac4a('0xd2')]>=_0x10f3a9[_0xac4a('0xd3')]){rpcDb[_0xac4a('0xab')](_0x5ad022,_0xac4a('0xd0'));}else{rpcDb[_0xac4a('0xaf')](ut['scheduledAt'](_0x5ad022,_0xac4a('0xd2'),_0x10f3a9[_0xac4a('0xd4')]),_0x5ad022[_0xac4a('0xb2')],_0x5ad022[_0xac4a('0xb3')]);}}break;case _0xac4a('0xd5'):_0x10f3a9[_0xac4a('0x3c')]+=0x1;_0x5ad022[_0xac4a('0xd6')]+=0x1;_0x5ad022['countglobal']=ut[_0xac4a('0xa4')](_0x5ad022);ut[_0xac4a('0x95')](_0x5ad022,0x8,_0xac4a('0xd7'));ami[_0xac4a('0x25')](_0xac4a('0xd8'),ut[_0xac4a('0xa6')](_0x5ad022,_0xac4a('0xd9')));rpcDb[_0xac4a('0x98')](_0x5ad022,_0xac4a('0xda'));if(ut[_0xac4a('0xa4')](_0x5ad022)>=_0x10f3a9[_0xac4a('0xa9')]){_0x43e10d=ut[_0xac4a('0xc9')](_0x5ad022,0xf,_0xac4a('0xaa'));rpcDb[_0xac4a('0xab')](_0x43e10d,_0xac4a('0xdb'));}else{if(_0x5ad022['countcongestionretry']>=_0x10f3a9[_0xac4a('0xdc')]){rpcDb[_0xac4a('0xab')](_0x5ad022,_0xac4a('0xda'));}else{rpcDb[_0xac4a('0xaf')](ut[_0xac4a('0xb0')](_0x5ad022,'countcongestionretry',_0x10f3a9[_0xac4a('0xdd')]),_0x5ad022[_0xac4a('0xb2')],_0x5ad022[_0xac4a('0xb3')]);}}break;case _0xac4a('0xde'):_0x10f3a9[_0xac4a('0x44')]+=0x1;_0x5ad022[_0xac4a('0xdf')]+=0x1;_0x5ad022[_0xac4a('0xa3')]=ut[_0xac4a('0xa4')](_0x5ad022);ut[_0xac4a('0x95')](_0x5ad022,0x14,_0xac4a('0xe0'));ami['emit'](_0xac4a('0xe1'),ut[_0xac4a('0xa6')](_0x5ad022,_0xac4a('0xe2')));rpcDb[_0xac4a('0x98')](_0x5ad022,'[syncHangupRequest][logAgentReject]');if(ut['totalGlobal'](_0x5ad022)>=_0x10f3a9[_0xac4a('0xa9')]){_0x43e10d=ut['cloneAction'](_0x5ad022,0x14,_0xac4a('0xe0'));rpcDb[_0xac4a('0xab')](_0x43e10d,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x5ad022['countagentrejectretry']>=_0x10f3a9[_0xac4a('0xe3')]){rpcDb['createCustomerFinal'](_0x5ad022,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x5ad022,'countagentrejectretry',_0x10f3a9[_0xac4a('0xe4')]),_0x5ad022['unlockAgent'],_0x5ad022[_0xac4a('0xb3')]);}}break;case _0xac4a('0xe5'):_0x10f3a9['outboundAbandonedCallsDay']+=0x1;_0x5ad022[_0xac4a('0xe6')]+=0x1;_0x5ad022[_0xac4a('0xa3')]=ut[_0xac4a('0xa4')](_0x5ad022);ut[_0xac4a('0x95')](_0x5ad022,0xb,_0xac4a('0xe7'));rpcDb[_0xac4a('0x98')](_0x5ad022,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0xac4a('0xa4')](_0x5ad022)>=_0x10f3a9[_0xac4a('0xa9')]){_0x43e10d=ut[_0xac4a('0xc9')](_0x5ad022,0xf,_0xac4a('0xaa'));rpcDb[_0xac4a('0xab')](_0x43e10d,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x5ad022[_0xac4a('0xe8')]>=_0x10f3a9[_0xac4a('0xe9')]){rpcDb[_0xac4a('0xab')](_0x5ad022,_0xac4a('0xea'));}else{rpcDb[_0xac4a('0xaf')](ut[_0xac4a('0xb0')](_0x5ad022,_0xac4a('0xe6'),_0x10f3a9[_0xac4a('0xeb')]),_0x5ad022[_0xac4a('0xb2')],_0x5ad022[_0xac4a('0xb3')]);}}break;case'18':_0x10f3a9[_0xac4a('0x45')]+=0x1;_0x5ad022['countmachineretry']+=0x1;_0x5ad022[_0xac4a('0xa3')]=ut[_0xac4a('0xa4')](_0x5ad022);ut['logCustomer'](_0x5ad022,0x12,_0x2dfd4f[_0xac4a('0xec')]||_0x2dfd4f['dialstatus']);ami['emit']('custom:amd',ut[_0xac4a('0xa6')](_0x5ad022,'amd'));rpcDb[_0xac4a('0x98')](_0x5ad022,'[callProgressDetectingCustomer][hangupInAMD]');if(ut['totalGlobal'](_0x5ad022)>=_0x10f3a9['dialGlobalMaxRetry']){_0x43e10d=ut[_0xac4a('0xc9')](_0x5ad022,0xf,_0xac4a('0xaa'));rpcDb[_0xac4a('0xab')](_0x43e10d,_0xac4a('0xed'));}else{rpcDb[_0xac4a('0xab')](_0x5ad022,_0xac4a('0xed'));}delete this['actions'][_0x2dfd4f[_0xac4a('0xb4')]];break;case'19':_0x10f3a9[_0xac4a('0x45')]+=0x1;_0x5ad022['countglobal']=ut['totalGlobal'](_0x5ad022);ut[_0xac4a('0x95')](_0x5ad022,0x13,_0x2dfd4f[_0xac4a('0xec')]||_0x2dfd4f[_0xac4a('0xee')]);ami[_0xac4a('0x25')](_0xac4a('0xef'),ut[_0xac4a('0xa6')](_0x5ad022,_0xac4a('0xf0')));rpcDb['createCustomerHistory'](_0x5ad022,_0xac4a('0xf1'));if(ut[_0xac4a('0xa4')](_0x5ad022)>=_0x10f3a9[_0xac4a('0xa9')]){_0x43e10d=ut['cloneAction'](_0x5ad022,0xf,_0xac4a('0xaa'));rpcDb['createCustomerFinal'](_0x43e10d,_0xac4a('0xf1'));}else{rpcDb[_0xac4a('0xab')](_0x5ad022,_0xac4a('0xf1'));}delete this[_0xac4a('0x14')][_0x2dfd4f['linkedid']];break;default:if(_0x5ad022[_0xac4a('0x82')]){ut['decrementTalkink'](_0x10f3a9,_0xac4a('0xf2'));ut['loggerError'](_0xac4a('0xf3')+_0x10f3a9[_0xac4a('0x27')],_0x2dfd4f);}_0x10f3a9[_0xac4a('0x45')]+=0x1;_0x5ad022[_0xac4a('0xa3')]=ut[_0xac4a('0xa4')](_0x5ad022);ut[_0xac4a('0x95')](_0x5ad022,0xc,_0x2dfd4f[_0xac4a('0xec')]||_0x2dfd4f[_0xac4a('0xee')]);rpcDb[_0xac4a('0x98')](_0x5ad022,_0xac4a('0xf4'));if(ut['totalGlobal'](_0x5ad022)>=_0x10f3a9[_0xac4a('0xa9')]){_0x43e10d=ut['cloneAction'](_0x5ad022,0xf,_0xac4a('0xaa'));rpcDb[_0xac4a('0xab')](_0x43e10d,_0xac4a('0xf5'));}else{rpcDb[_0xac4a('0xab')](_0x5ad022,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x2dfd4f[_0xac4a('0xb4')]];}if(!(_0x5ad022[_0xac4a('0x82')]&&_0x4f9410==='16')){ut[_0xac4a('0x81')](_0x10f3a9,_0xac4a('0xf6'));logger[_0xac4a('0x5e')](_0xac4a('0xf7'),_0x5ad022[_0xac4a('0xc4')],_0xac4a('0xb8'),_0x10f3a9[_0xac4a('0x27')],_0xac4a('0x75'),_0x10f3a9[_0xac4a('0x52')]);}if(_0x4f9410!==_0xac4a('0xf8')){delete this[_0xac4a('0x14')][_0x2dfd4f[_0xac4a('0xb4')]];delete this[_0xac4a('0x14')][_0x2dfd4f['destlinkedid']];}}};Preview[_0xac4a('0xe')][_0xac4a('0xf9')]=function(_0x28715c,_0x525319,_0x465efa){if(_[_0xac4a('0xfa')](_0x525319)&&_0xac4a('0xfb')!==typeof _0x525319){return;}if(_[_0xac4a('0xfa')](_0x465efa)&&_0xac4a('0xfb')!==typeof _0x465efa){return;}switch(_0x465efa[_0xac4a('0xfc')]){case'0':ut[_0xac4a('0xfd')](_0x28715c,0x0,'NoSuchNumber');rpcDb[_0xac4a('0xfe')](_0x28715c,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0xac4a('0xfd')](_0x28715c,0x3,_0xac4a('0xcd'));rpcDb['createAgentHistory'](_0x28715c,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xac4a('0xfd')](_0x28715c,0x5,_0xac4a('0xc7'));rpcDb['createAgentHistory'](_0x28715c,_0xac4a('0xff'));break;case'8':ut[_0xac4a('0xfd')](_0x28715c,0x8,_0xac4a('0xd7'));rpcDb['createAgentHistory'](_0x28715c,_0xac4a('0x100'));break;case'22':ut[_0xac4a('0xfd')](_0x28715c,0x16,_0xac4a('0x101'));rpcDb[_0xac4a('0xfe')](_0x28715c,_0xac4a('0x102'));break;default:ut['logAgent'](_0x28715c,0xc,_0x465efa[_0xac4a('0xfc')]);rpcDb[_0xac4a('0xfe')](_0x28715c,_0xac4a('0x100'));}ut['updateOriginated'](_0x525319,_0xac4a('0x103'));logger[_0xac4a('0x5e')](_0xac4a('0x104'),_0x28715c[_0xac4a('0xc4')],_0xac4a('0xb8'),_0x525319['name'],_0xac4a('0x75'),_0x525319[_0xac4a('0x52')]);delete this[_0xac4a('0x14')][_0x28715c[_0xac4a('0xc4')]];};Preview['prototype'][_0xac4a('0x105')]=function(_0x434c6b,_0x5eec15,_0x5d982e,_0x4c05a9,_0x3825f9){var _0x157695=this;return new BPromise(function(_0x486e48,_0x4f9ca4){if(_[_0xac4a('0x8d')](_0x5eec15)||_[_0xac4a('0x8d')](_0x5eec15[_0xac4a('0x106')])||_[_0xac4a('0x8d')](_0x5eec15[_0xac4a('0x106')][_0xac4a('0x107')])||_['isNil'](_0x5eec15[_0xac4a('0x7b')])){_0x4f9ca4(ut['message'](_0xac4a('0x108'),_0x4c05a9,_0x3825f9));return;}var _0x548d67=uuid['v4']();var _0x4bc20c=_0x157695[_0xac4a('0x24')][_0x5eec15[_0xac4a('0x74')][_0xac4a('0x27')]];var _0x159860=_0x5d982e?_0x157695['agents'][_0x5d982e]['id']:undefined;_0x157695[_0xac4a('0x14')][_0x548d67]=new Action(_0x5eec15,_0x4bc20c,_0x548d67,_0x5d982e,_0x159860);var _0x38ecbf=_0x157695[_0xac4a('0x14')][_0x548d67];_0x38ecbf[_0xac4a('0xb2')]=_0x4c05a9;_0x38ecbf[_0xac4a('0xb3')]=_0x3825f9;_0x38ecbf['lookAgent']=_0x5d982e;if(_[_0xac4a('0x109')](_0x434c6b)){_0x157695[_0xac4a('0x10a')](_0x38ecbf,_0x4bc20c,_0x5eec15,_0x5d982e)['then'](function(_0x28e189){logger[_0xac4a('0x5e')](_0xac4a('0x10b'),_0xac4a('0x10c')+_0x38ecbf['queue']+'\x20IdHopper:\x20'+_0x38ecbf[_0xac4a('0x10d')],JSON[_0xac4a('0x60')](_0x28e189));ami[_0xac4a('0x25')](_0xac4a('0x10e'),ut[_0xac4a('0xa6')](_0x38ecbf,_0xac4a('0x10f'),_0x157695['campaignsPreview'][_0x38ecbf[_0xac4a('0x76')]]));_0x486e48(ut[_0xac4a('0x68')](_0xac4a('0x110')));})['catch'](function(_0x1889f5){ut['logger'](_0xac4a('0x111'),_0x1889f5);_0x4f9ca4(ut[_0xac4a('0x68')](_0xac4a('0x112'),_0x4c05a9,_0x3825f9));});}else{_0x4bc20c[_0xac4a('0x3b')]+=0x1;ut[_0xac4a('0x113')](_0x38ecbf);rpcDb['createHistory'](_0x38ecbf,'[Blacklist][error]');delete _0x157695[_0xac4a('0x14')][_0x548d67];_0x4f9ca4(ut[_0xac4a('0x68')]('Contact\x20in\x20black\x20List',_0x4c05a9,_0x3825f9));}});};Preview[_0xac4a('0xe')][_0xac4a('0x114')]=function(_0x40f9ec){return!_[_0xac4a('0x8d')](_0x40f9ec)&&!_[_0xac4a('0x8d')](_0x40f9ec[_0xac4a('0x27')])&&!_[_0xac4a('0x8d')](_0x40f9ec[_0xac4a('0x5a')])&&_0x40f9ec[_0xac4a('0x5a')]&&!_[_0xac4a('0x8d')](this[_0xac4a('0x13')][util[_0xac4a('0x61')](_0xac4a('0x115'),_0x40f9ec[_0xac4a('0x27')])])&&!_[_0xac4a('0x8d')](this[_0xac4a('0x13')][util[_0xac4a('0x61')](_0xac4a('0x115'),_0x40f9ec[_0xac4a('0x27')])][_0xac4a('0x7d')])&&(this[_0xac4a('0x13')][util[_0xac4a('0x61')](_0xac4a('0x115'),_0x40f9ec[_0xac4a('0x27')])][_0xac4a('0x7d')]===_0xac4a('0x116')||this['trunks'][util[_0xac4a('0x61')](_0xac4a('0x115'),_0x40f9ec['name'])][_0xac4a('0x7d')]===_0xac4a('0x117'));};Preview[_0xac4a('0xe')][_0xac4a('0x92')]=function(_0x8b8b9c,_0x32b698){var _0x434713=this;return new BPromise(function(_0x2a381f,_0x15796d){_0x434713[_0xac4a('0x118')](_0x8b8b9c,_0x32b698)[_0xac4a('0x8c')](function(_0x5c8f7d){_0x2a381f(_['pick'](_0x5c8f7d,[_0xac4a('0x68')]));})[_0xac4a('0x7f')](function(_0x48900e){if(_0x48900e['unlock']){rpcDb[_0xac4a('0x119')](_0x8b8b9c);}if(_0x48900e[_0xac4a('0x5a')]){rpcDb[_0xac4a('0x11a')](_0x8b8b9c);}_0x15796d(_[_0xac4a('0x78')](_0x48900e,['message']));});});};Preview['prototype'][_0xac4a('0x118')]=function(_0x1c816c,_0x5a67de){var _0x217edb=this;return new BPromise(function(_0x1bebf9,_0x50de8f){var _0x57d94f,_0x4b202f;rpcDb['getContactPreview'](_0x1c816c)['then'](function(_0x3cee0a){if(!_[_0xac4a('0x8d')](_0x3cee0a[0x0])){_0x4b202f=_0x3cee0a[0x0][_0xac4a('0x11b')]?![]:!![];_0x57d94f=_0x3cee0a[0x0][_0xac4a('0x11b')]?!![]:![];_0x57d94f=_0x5a67de?!![]:_0x57d94f;}var _0x1bc74a=_0x217edb[_0xac4a('0x11c')](_0x3cee0a);if(_0x1bc74a[_0xac4a('0x11d')]){rpcDb['checkIsBlackList'](_[_0xac4a('0x78')](_0x3cee0a[0x0],['VoiceQueueId','Contact.phone']))[_0xac4a('0x8c')](function(_0x111bca){_0x217edb[_0xac4a('0x105')](_0x111bca,_0x3cee0a[0x0],_0x5a67de,_0x4b202f,_0x57d94f)[_0xac4a('0x8c')](function(_0x16356b){_0x1bebf9(_0x16356b);})[_0xac4a('0x7f')](function(_0x4794f6){_0x50de8f(_0x4794f6);});})[_0xac4a('0x7f')](function(_0x44361e){ut[_0xac4a('0x11e')](_0xac4a('0x11f'),_0x44361e);_0x50de8f(ut['message'](_0xac4a('0x120'),_0x4b202f,_0x57d94f));});}else{_0x50de8f(ut[_0xac4a('0x68')](_0x1bc74a[_0xac4a('0x68')],_0x4b202f,_0x57d94f));}})['catch'](function(_0x41ed96){ut[_0xac4a('0x11e')](_0xac4a('0x121'),_0x41ed96);_0x50de8f(ut[_0xac4a('0x68')](_0xac4a('0x120'),![],!![]));});});};Preview[_0xac4a('0xe')]['validateContact']=function(_0x599607){if(_[_0xac4a('0x8d')](_0x599607)||_[_0xac4a('0x109')](_0x599607)||!_[_0xac4a('0x8d')](_0x599607[0x0]['Agent'])&&_[_0xac4a('0x8d')](_0x599607[0x0][_0xac4a('0x122')][_0xac4a('0x27')])){ut[_0xac4a('0x11e')](_0xac4a('0x123'),_0x599607);return{'isValid':![],'message':_0xac4a('0x124')};}var _0x11976b=this[_0xac4a('0x24')][_0x599607[0x0][_0xac4a('0x74')]['name']];_0x11976b['message']=_0xac4a('0xa1');if(_[_0xac4a('0x8d')](_0x11976b)){ut[_0xac4a('0x11e')](_0xac4a('0x125'),_0x11976b);return{'isValid':![],'message':_0xac4a('0x126')};}if(!this[_0xac4a('0x114')](_0x11976b['Trunk'])){ut[_0xac4a('0x11e')]('[Preview][validateContact][Trunk\x20not\x20work]',_0xac4a('0x127')+_0x11976b['name']+_0xac4a('0x128'));if(!this[_0xac4a('0x114')](_0x11976b[_0xac4a('0x9f')])){ut[_0xac4a('0x11e')](_0xac4a('0x129'),_0x11976b['name']+_0xac4a('0x12a'));return{'isValid':![],'message':_0xac4a('0x12b')};}}if(!ut['isActive'](_0x11976b[_0xac4a('0x35')])){ut['logger'](_0xac4a('0x12c'),_0x11976b[_0xac4a('0x27')]+_0xac4a('0x12d'));return{'isValid':![],'message':_0xac4a('0x127')+_0x11976b[_0xac4a('0x27')]+_0xac4a('0x12d')};}return{'isValid':!![],'message':_0xac4a('0x12e')};};Preview['prototype']['execCall']=function(_0xfe3daf,_0x4db1a4,_0x1b0756,_0x686146){var _0x118ac4=this;return new BPromise(function(_0x5f202c,_0x742967){var _0x24783e=_0xfe3daf['uniqueid'];var _0x445939=_0x118ac4[_0xac4a('0x114')](_0x4db1a4[_0xac4a('0x59')])?util['format'](_0xac4a('0x12f'),_0x4db1a4[_0xac4a('0x59')]['name'],_['isNil'](_0x4db1a4[_0xac4a('0x3a')])?'':_0x4db1a4[_0xac4a('0x3a')][_0xac4a('0x130')]()||'',_0x4db1a4[_0xac4a('0x131')]>0x0?_0x1b0756[_0xac4a('0x106')][_0xac4a('0x107')][_0xac4a('0x132')](_0x4db1a4[_0xac4a('0x131')]):_0x1b0756['Contact'][_0xac4a('0x107')]):util[_0xac4a('0x61')](_0xac4a('0x12f'),_[_0xac4a('0x8d')](_0x4db1a4[_0xac4a('0x9f')])?_0x4db1a4[_0xac4a('0x59')][_0xac4a('0x27')]:_0x4db1a4[_0xac4a('0x9f')][_0xac4a('0x27')],_[_0xac4a('0x8d')](_0x4db1a4[_0xac4a('0x3a')])?'':_0x4db1a4['dialPrefix'][_0xac4a('0x130')]()||'',_0x4db1a4[_0xac4a('0x131')]>0x0?_0x1b0756[_0xac4a('0x106')][_0xac4a('0x107')][_0xac4a('0x132')](_0x4db1a4[_0xac4a('0x131')]):_0x1b0756[_0xac4a('0x106')][_0xac4a('0x107')]);var _0x5f07e4=_0x118ac4[_0xac4a('0x114')](_0x4db1a4['Trunk'])?ut[_0xac4a('0x133')](_0x4db1a4[_0xac4a('0x59')]['callerid'],_0x4db1a4[_0xac4a('0x37')],_0x4db1a4[_0xac4a('0x134')]>0x0?ut[_0xac4a('0x135')](_0x4db1a4[_0xac4a('0x38')],_0x4db1a4[_0xac4a('0x134')]):_0x4db1a4['dialOriginateCallerIdNumber']):ut[_0xac4a('0x133')](_['isNil'](_0x4db1a4['TrunkBackup'])?_0x4db1a4[_0xac4a('0x59')][_0xac4a('0x5b')]:_0x4db1a4['TrunkBackup'][_0xac4a('0x5b')],_0x4db1a4[_0xac4a('0x37')],_0x4db1a4[_0xac4a('0x134')]>0x0?ut['getCallerIdRandom'](_0x4db1a4[_0xac4a('0x38')],_0x4db1a4[_0xac4a('0x134')]):_0x4db1a4[_0xac4a('0x38')]);if(_0x5f07e4){_0xfe3daf[_0xac4a('0x136')]=ut[_0xac4a('0x137')](_0x5f07e4);_0xfe3daf['originatecalleridnum']=ut[_0xac4a('0x138')](_0x5f07e4);}var _0x4a0d11=ut[_0xac4a('0x139')](_0x4db1a4,_0x1b0756,_0x445939,_0x5f07e4,_0x24783e,_0xfe3daf);_[_0xac4a('0x13a')](_0xfe3daf,ut[_0xac4a('0x13b')](_0x4a0d11));_0xfe3daf['starttime']=moment()[_0xac4a('0x61')](_0xac4a('0xb5'));ami[_0xac4a('0x13c')](ut['variablesAction'](_0xfe3daf,_0x4db1a4,_0x4a0d11,_0xfe3daf['activeContact'],_0x686146))[_0xac4a('0x8c')](function(_0xce3758){var _0x52d400=_0xfe3daf[_0xac4a('0x13d')];if(!_[_0xac4a('0x8d')](_0x52d400)){if(!_[_0xac4a('0x8d')](_0x118ac4[_0xac4a('0x15')][_0x52d400])){_0x118ac4[_0xac4a('0x15')][_0x52d400][_0xac4a('0x13e')]=_0xfe3daf['calleridnum'];emit(util['format'](_0xac4a('0x13f'),_0x118ac4[_0xac4a('0x15')][_0x52d400][_0xac4a('0x27')]),_0xac4a('0x140'),{'destaccountcode':_0x118ac4[_0xac4a('0x15')][_0x52d400][_0xac4a('0x141')],'destconnectedlinenum':_0xfe3daf[_0xac4a('0x142')]});}}_0x4db1a4[_0xac4a('0x52')]+=0x1;logger[_0xac4a('0x5e')](_0xac4a('0x143'),_0x24783e,_0xac4a('0xb8'),_0x4db1a4[_0xac4a('0x27')],_0xac4a('0x75'),_0x4db1a4[_0xac4a('0x52')]);_0x5f202c(_0xce3758);})[_0xac4a('0x7f')](function(_0x3f5fbe){ut[_0xac4a('0xfd')](_0xfe3daf,0xe,_0xac4a('0x144'));rpcDb[_0xac4a('0xfe')](_0xfe3daf,_0xac4a('0x145'));_0x742967(_0x3f5fbe);});});};Preview['prototype'][_0xac4a('0x1c')]=function(_0x4c5721){if(this['actions'][_0x4c5721[_0xac4a('0xb4')]]){this[_0xac4a('0x14')][_0x4c5721[_0xac4a('0xb4')]]['channel']=_0x4c5721[_0xac4a('0x7e')];}};Preview['prototype'][_0xac4a('0x146')]=function(_0x23cc3d){var _0x5d6d28=this;var _0x1a1f0a=this['actions'][_0x23cc3d['actionid']];if(_0x1a1f0a){if(_0x1a1f0a[_0xac4a('0x147')]&&this[_0xac4a('0x15')][_0x1a1f0a[_0xac4a('0x147')]]){ut[_0xac4a('0x148')](_0x1a1f0a,this[_0xac4a('0x15')][_0x1a1f0a[_0xac4a('0x147')]][_0xac4a('0x27')],this['agents'][_0x1a1f0a[_0xac4a('0x147')]]['id']);}var _0x2e18ab=_[_0xac4a('0x149')](_0x1a1f0a);_0x2e18ab['responsetime']=moment()[_0xac4a('0x61')](_0xac4a('0xb5'));var _0x45df6f=_0x5d6d28[_0xac4a('0x24')][_0x1a1f0a[_0xac4a('0x76')]];if(ut[_0xac4a('0x14a')](_0x23cc3d[_0xac4a('0x14b')])){if(_0x1a1f0a[_0xac4a('0xb2')]){rpcDb['unlockContact'](_0x1a1f0a['idContact']);}if(_0x1a1f0a['activeContact']){rpcDb['disableContact'](_0x1a1f0a[_0xac4a('0x10d')]);}ami['emit'](_0xac4a('0x14c'),ut['buildObj'](_0x1a1f0a,_0xac4a('0x14d'),this[_0xac4a('0x24')][_0x1a1f0a[_0xac4a('0x76')]]));this[_0xac4a('0xf9')](_0x2e18ab,_0x45df6f,_0x23cc3d);}else{_0x1a1f0a[_0xac4a('0x14e')]=moment()['format'](_0xac4a('0xb5'));ut[_0xac4a('0xfd')](_0x2e18ab,0x4,'Answer');rpcDb[_0xac4a('0xfe')](_0x2e18ab,_0xac4a('0x14f'));}}};Preview[_0xac4a('0xe')][_0xac4a('0x1a')]=function(_0x19c2f5){var _0x1de1ca=this;var _0x47b314=this[_0xac4a('0x14')][_0x19c2f5[_0xac4a('0xb4')]];var _0x572e40;if(_0x47b314){_0x572e40=this[_0xac4a('0x24')][_0x47b314[_0xac4a('0x76')]];logger[_0xac4a('0x5e')](_0xac4a('0x150'),_0x19c2f5[_0xac4a('0xb4')],_0xac4a('0xb8'),_0x572e40[_0xac4a('0x27')],_0xac4a('0x77'),_0x572e40[_0xac4a('0x2c')]);}if(this[_0xac4a('0x14')][_0x19c2f5[_0xac4a('0xb4')]]&&_0x19c2f5[_0xac4a('0xb4')]!==_0x19c2f5[_0xac4a('0xc4')]){if(_0x19c2f5['cause']==='16'&&this[_0xac4a('0x14')][_0x19c2f5[_0xac4a('0xb4')]][_0xac4a('0x82')]){this[_0xac4a('0xa2')](_0x19c2f5,_0x19c2f5['linkedid'],_0x19c2f5[_0xac4a('0x151')]);}else if(this[_0xac4a('0x14')][_0x19c2f5[_0xac4a('0xb4')]][_0xac4a('0x82')]){logger[_0xac4a('0x5e')](_0xac4a('0x152'),_0x19c2f5[_0xac4a('0xb4')],_0x19c2f5[_0xac4a('0x151')],_0xac4a('0xb8'),_0x572e40['name'],'pTalking:\x20',_0x572e40[_0xac4a('0x2c')]);this[_0xac4a('0xa2')](_0x19c2f5,_0x19c2f5[_0xac4a('0xb4')],_0x19c2f5[_0xac4a('0x151')]);}}else if(_0x47b314&&_[_0xac4a('0x8d')](_0x47b314['statedesc'])&&_0x572e40['dialQueueProject']&&_0x19c2f5[_0xac4a('0xb4')]===_0x19c2f5[_0xac4a('0xc4')]&&_['isNil'](_0x19c2f5[_0xac4a('0xfc')])&&_0x19c2f5[_0xac4a('0x151')]==='16'&&_0x19c2f5[_0xac4a('0x153')]==='6'&&_['isUndefined'](_0x47b314[_0xac4a('0x154')])){if(_0x47b314[_0xac4a('0xb2')]){rpcDb[_0xac4a('0x119')](_0x47b314[_0xac4a('0x10d')]);}if(_0x47b314[_0xac4a('0xb3')]){rpcDb[_0xac4a('0x11a')](_0x47b314[_0xac4a('0x10d')]);}_0x19c2f5['reason']='22';this[_0xac4a('0xf9')](_0x47b314,_0x572e40,_0x19c2f5);}else if(_0x47b314&&_0x47b314[_0xac4a('0x154')]){if(_0x19c2f5[_0xac4a('0x151')]==='16'&&this[_0xac4a('0x14')][_0x19c2f5['linkedid']][_0xac4a('0x82')]){logger['info'](_0xac4a('0x155'),_0x19c2f5[_0xac4a('0xb4')],_0x19c2f5['cause'],'\x20Queue',_0x572e40[_0xac4a('0x27')],_0xac4a('0x77'),_0x572e40['pTalking']);this[_0xac4a('0xa2')](_0x19c2f5,_0x19c2f5['linkedid'],_0x19c2f5['cause']);}else if(this[_0xac4a('0x14')][_0x19c2f5[_0xac4a('0xb4')]]['dialAnswer']){logger[_0xac4a('0x5e')](_0xac4a('0x152'),_0x19c2f5[_0xac4a('0xb4')],_0x19c2f5[_0xac4a('0x151')],_0xac4a('0xb8'),_0x572e40[_0xac4a('0x27')],_0xac4a('0x77'),_0x572e40[_0xac4a('0x2c')]);this[_0xac4a('0xa2')](_0x19c2f5,_0x19c2f5[_0xac4a('0xb4')],_0x19c2f5[_0xac4a('0x151')]);}}};Preview[_0xac4a('0xe')][_0xac4a('0x156')]=function(_0x14d593){if(this[_0xac4a('0x14')][_0x14d593['destlinkedid']]&&_0x14d593['destlinkedid']!==_0x14d593['destuniqueid']){this[_0xac4a('0xa2')](_0x14d593,_0x14d593[_0xac4a('0x157')],_0x14d593[_0xac4a('0xee')]);}};Preview[_0xac4a('0xe')][_0xac4a('0x158')]=function(_0x4fe31e){if(this[_0xac4a('0x14')][_0x4fe31e[_0xac4a('0xb4')]]&&_0x4fe31e[_0xac4a('0xb4')]!==_0x4fe31e[_0xac4a('0xc4')]&&!this[_0xac4a('0x14')][_0x4fe31e[_0xac4a('0xb4')]]['dialAnswer']){if(_0x4fe31e[_0xac4a('0x151')]==='1'){this[_0xac4a('0xa2')](_0x4fe31e,_0x4fe31e[_0xac4a('0xb4')],_0x4fe31e[_0xac4a('0x151')]);}}};Preview[_0xac4a('0xe')][_0xac4a('0x159')]=function(_0x599afb,_0x311835,_0x4ea65c){if(this[_0xac4a('0x14')][_0x599afb]){if(_[_0xac4a('0x8d')](this[_0xac4a('0x14')][_0x599afb]['variables'])){this['actions'][_0x599afb][_0xac4a('0x15a')]={};}this['actions'][_0x599afb][_0xac4a('0x15a')][_0x311835]=_0x4ea65c;}};Preview[_0xac4a('0xe')][_0xac4a('0x1e')]=function(_0x425cb7){try{if(!_[_0xac4a('0x8d')](_0x425cb7)){if(ut[_0xac4a('0x15b')](_[_0xac4a('0x15c')](_0x425cb7[_0xac4a('0x15d')])[0x0])){this[_0xac4a('0x159')](_0x425cb7['uniqueid'],_['keys'](_0x425cb7[_0xac4a('0x15d')])[0x0],_0x425cb7[_0xac4a('0x15e')]);}}}catch(_0x31d577){logger[_0xac4a('0x15f')]('[syncVarSet][Preview]',util[_0xac4a('0x160')](_0x31d577,{'showHidden':![],'depth':null}));}};Preview[_0xac4a('0xe')][_0xac4a('0x20')]=function(_0x55c9d7){if(_0x55c9d7){if(this[_0xac4a('0x14')][_0x55c9d7[_0xac4a('0x161')]]){this[_0xac4a('0x14')][_0x55c9d7[_0xac4a('0x161')]][_0xac4a('0x154')]=!![];}}};Preview[_0xac4a('0xe')]['syncBlindTransfer']=function(_0x2417bd){if(_0x2417bd){if(this[_0xac4a('0x14')][_0x2417bd[_0xac4a('0x162')]]){this[_0xac4a('0x14')][_0x2417bd[_0xac4a('0x162')]][_0xac4a('0x154')]=!![];}}};module[_0xac4a('0x163')]=Preview; \ No newline at end of file +var _0x5ad7=['logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20disactive','syncCampaigns','clockClearZombieChannels','hasOwnProperty','preview','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','[clearZombieChannels][talking]','Queue','queue','originated:\x20','dialAnswer','pick','UserId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','loggerError','[action]','size','getContactRecallMe','agentReadyId','then','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','[RecallMe]','catch','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','logCustomer','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','logger2','IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','unlockAgent','activeContact','linkedid','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','decrementTalkink','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','dialBusyRetryFrequency','NOANSWER','NoAnswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','countagentrejectretry','AgentReject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','VoiceQueueId','Contact\x20is\x20undefined','lookAgent','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','called','Calling','Call\x20failed','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','run','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[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]','\x20Not\x20Active','execCall','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','channelAgent','destconnectedlinenum','calleridnum','user:%s','user:agentconnect','accountcode','OriginateError','[originateFailure][logOriginateFailure]','actionid','isFailure','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','destuniqueid','addVariable','variables','syncVarSet','variable','value','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','answered','available','loggedIn','total','unmanaged','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','voice_queue_presence:remove','sendMessageOneNotActive','pTalking','paused','NOT_ACTIVE'];(function(_0x4f3045,_0x55d80f){var _0x408e8c=function(_0x3ef924){while(--_0x3ef924){_0x4f3045['push'](_0x4f3045['shift']());}};_0x408e8c(++_0x55d80f);}(_0x5ad7,0xfa));var _0x75ad=function(_0x119ec9,_0x318805){_0x119ec9=_0x119ec9-0x0;var _0x532852=_0x5ad7[_0x119ec9];return _0x532852;};'use strict';var util=require(_0x75ad('0x0'));var _=require(_0x75ad('0x1'));var BPromise=require(_0x75ad('0x2'));var uuid=require(_0x75ad('0x3'));var moment=require(_0x75ad('0x4'));var md5=require(_0x75ad('0x5'));var Redis=require(_0x75ad('0x6'));var config=require(_0x75ad('0x7'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0x75ad('0x8'))(_0x75ad('0x9'));var ami=require(_0x75ad('0xa'));var rpcDb=require(_0x75ad('0xb'));var Action=require(_0x75ad('0xc'));var ut=require(_0x75ad('0xd'));config[_0x75ad('0xe')]=_['defaults'](config['redis'],{'host':_0x75ad('0xf'),'port':0x18eb});var io=require(_0x75ad('0x10'))(new Redis(config[_0x75ad('0xe')]));var Sequence=function(){};Sequence[_0x75ad('0x11')][_0x75ad('0x12')]=function(_0xf8a7e){this[_0x75ad('0x13')]=this['tail']?this[_0x75ad('0x13')][_0x75ad('0x14')](_0xf8a7e):_0xf8a7e();};function Preview(_0x382443){this[_0x75ad('0x15')]=new Sequence();this[_0x75ad('0x16')]=_0x382443[_0x75ad('0x17')];this[_0x75ad('0x18')]=_0x382443['trunks'];this[_0x75ad('0x19')]={};this[_0x75ad('0x1a')]=_0x382443['agents'];this['clockClearZombieChannels']=0x0;ami['on'](_0x75ad('0x1b'),this[_0x75ad('0x1c')][_0x75ad('0x1d')](this));ami['on']('hangup',this['syncHangup'][_0x75ad('0x1d')](this));ami['on'](_0x75ad('0x1e'),this[_0x75ad('0x1f')][_0x75ad('0x1d')](this));ami['on']('dialend',this[_0x75ad('0x20')][_0x75ad('0x1d')](this));ami['on'](_0x75ad('0x21'),this[_0x75ad('0x22')]['bind'](this));ami['on'](_0x75ad('0x23'),this['syncVarSet'][_0x75ad('0x1d')](this));ami['on'](_0x75ad('0x24'),this[_0x75ad('0x25')][_0x75ad('0x1d')](this));ami['on'](_0x75ad('0x26'),this[_0x75ad('0x27')][_0x75ad('0x1d')](this));this[_0x75ad('0x28')](this[_0x75ad('0x16')]);}function emit(_0x729f5,_0x5642c4,_0x379ca1){io['to'](_0x729f5)[_0x75ad('0x29')](_0x5642c4,_0x379ca1);}function emitCampaignPreview(_0x577783){if(_0x577783[_0x75ad('0x2a')]===_0x75ad('0x2b')){var _0x21936c={'id':_0x577783['id'],'name':_0x577783[_0x75ad('0x2c')],'strategy':_0x577783[_0x75ad('0x2d')],'answered':_0x577783[_0x75ad('0x2e')],'available':_0x577783[_0x75ad('0x2f')],'loggedIn':_0x577783[_0x75ad('0x30')],'pTalking':_0x577783['pTalking'],'sumBillable':_0x577783['sumBillable'],'sumDuration':_0x577783['sumDuration'],'sumHoldTime':_0x577783['sumHoldTime']||0x0,'talking':_0x577783['talking'],'total':_0x577783[_0x75ad('0x31')],'type':_0x577783['type'],'unmanaged':_0x577783[_0x75ad('0x32')],'abandoned':_0x577783[_0x75ad('0x33')],'waiting':_0x577783[_0x75ad('0x34')],'loggedInDb':_0x577783['loggedInDb'],'dialActive':_0x577783[_0x75ad('0x35')],'dialMethod':_0x577783[_0x75ad('0x36')],'dialOriginateCallerIdName':_0x577783[_0x75ad('0x37')],'dialOriginateCallerIdNumber':_0x577783[_0x75ad('0x38')],'dialOriginateTimeout':_0x577783['dialOriginateTimeout'],'dialPrefix':_0x577783['dialPrefix'],'outboundAnswerAgiCallsDay':_0x577783[_0x75ad('0x39')],'outboundAnswerCallsDay':_0x577783[_0x75ad('0x3a')],'outboundBlacklistCallsDay':_0x577783['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x577783['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x577783['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x577783['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x577783[_0x75ad('0x3b')],'outboundDropCallsDayTimeout':_0x577783['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x577783[_0x75ad('0x3c')],'outboundNoSuchCallsDay':_0x577783['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x577783[_0x75ad('0x3d')],'outboundReCallsDay':_0x577783[_0x75ad('0x3e')],'outboundRejectCallsDay':_0x577783['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x577783[_0x75ad('0x3f')],'outboundAbandonedCallsDay':_0x577783['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x577783[_0x75ad('0x40')],'predictiveIntervalAvgHoldtime':_0x577783['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x577783[_0x75ad('0x41')],'predictiveIntervalDroppedCallsCallersExit':_0x577783['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x577783[_0x75ad('0x42')],'predictiveIntervalErlangCalls':_0x577783['predictiveIntervalErlangCalls'],'predictiveIntervalErlangCallsDroppedCalls':_0x577783[_0x75ad('0x43')],'predictiveIntervalHitRate':_0x577783[_0x75ad('0x44')],'predictiveIntervalMultiplicativeFactor':_0x577783[_0x75ad('0x45')],'predictiveIntervalPauses':_0x577783[_0x75ad('0x46')],'predictiveIntervalAvailable':_0x577783['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x577783[_0x75ad('0x47')],'message':_0x577783[_0x75ad('0x48')],'originated':_0x577783[_0x75ad('0x49')],'erlangCalls':_0x577783[_0x75ad('0x4a')],'erlangCallToSecond':_0x577783[_0x75ad('0x4b')],'erlangAbandonmentRate':_0x577783[_0x75ad('0x4c')],'erlangBusyFactor':_0x577783[_0x75ad('0x4d')],'startPredictive':_0x577783[_0x75ad('0x4e')],'startProgressive':_0x577783[_0x75ad('0x4f')]};if(_0x577783[_0x75ad('0x50')]){_0x21936c['Trunk']={'id':_0x577783[_0x75ad('0x50')]['id'],'name':_0x577783['Trunk'][_0x75ad('0x2c')],'active':_0x577783[_0x75ad('0x50')][_0x75ad('0x51')],'callerid':_0x577783[_0x75ad('0x50')][_0x75ad('0x52')]};}if(_0x577783[_0x75ad('0x53')]){_0x21936c[_0x75ad('0x53')]={'id':_0x577783['Interval']['id'],'name':_0x577783[_0x75ad('0x53')][_0x75ad('0x2c')]};}var _0x504069=md5(JSON[_0x75ad('0x54')](_0x21936c));if(_0x577783[_0x75ad('0x5')]!==_0x504069){_0x577783['md5']=_0x504069;emit(util[_0x75ad('0x55')](_0x75ad('0x56'),_0x21936c[_0x75ad('0x2c')]),_0x75ad('0x57'),_0x21936c);}}}function emitVoiceQueueChannelRemove(_0x55b900){logger[_0x75ad('0x58')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x75ad('0x54')](_0x55b900));emit(util[_0x75ad('0x55')]('voice:queue:%s',_0x55b900[_0x75ad('0x2c')]),'voice_queue_channel:remove',_0x55b900);io['emit'](_0x75ad('0x59'),_0x55b900);}function notSendMessagesQueue(_0x51f31e){if(_0x51f31e[_0x75ad('0x5a')]){if(_0x51f31e[_0x75ad('0x49')]===0x0&&_0x51f31e[_0x75ad('0x5b')]===0x0){_0x51f31e[_0x75ad('0x5a')]=![];_0x51f31e[_0x75ad('0x2f')]=0x0;_0x51f31e[_0x75ad('0x5c')]=0x0;_0x51f31e[_0x75ad('0x48')]=_0x75ad('0x5d');ut[_0x75ad('0x5e')](_0x75ad('0x5f'),_0x51f31e[_0x75ad('0x2c')]+'\x20is\x20not\x20active');}else{_0x51f31e['message']='IS_DISACTIVED';ut['logger'](_0x75ad('0x5f'),_0x51f31e[_0x75ad('0x2c')]+_0x75ad('0x60'));}emitCampaignPreview(_0x51f31e);}}Preview['prototype']['loopCampaigns']=function(){var _0x1bbdd7=this;setInterval(function(){_0x1bbdd7[_0x75ad('0x61')]();},0x7cf);};Preview[_0x75ad('0x11')][_0x75ad('0x61')]=function(){var _0x1a1ee9=this[_0x75ad('0x16')];this[_0x75ad('0x62')]+=0x1;for(var _0x5f0585 in _0x1a1ee9){if(_0x1a1ee9[_0x75ad('0x63')](_0x5f0585)&&(_0x1a1ee9[_0x5f0585][_0x75ad('0x36')]===_0x75ad('0x64')||_0x1a1ee9[_0x5f0585][_0x75ad('0x36')]===_0x75ad('0x65'))&&_0x1a1ee9[_0x5f0585][_0x75ad('0x2a')]===_0x75ad('0x2b')){if(this['clockClearZombieChannels']>0x7){this[_0x75ad('0x62')]=0x0;this[_0x75ad('0x66')]();}}if(_0x1a1ee9[_0x75ad('0x63')](_0x5f0585)&&_0x1a1ee9[_0x5f0585]['dialMethod']==='preview'&&_0x1a1ee9[_0x5f0585][_0x75ad('0x2a')]==='outbound'){if(_0x1a1ee9[_0x5f0585][_0x75ad('0x35')]){this[_0x75ad('0x67')](_0x1a1ee9[_0x5f0585]);this[_0x75ad('0x68')](_0x1a1ee9[_0x5f0585]);}else{notSendMessagesQueue(_0x1a1ee9[_0x5f0585]);}}}};Preview[_0x75ad('0x11')][_0x75ad('0x69')]=function(_0x2920fe){var _0x3d69f6=this;this[_0x75ad('0x15')][_0x75ad('0x12')](function(){if(!_['isNil'](_0x3d69f6[_0x75ad('0x19')][_0x2920fe])){loggerAction[_0x75ad('0x58')](_0x75ad('0x6a'),_0x2920fe,_0x75ad('0x6b'),_0x3d69f6['actions'][_0x2920fe][_0x75ad('0x6c')],_0x75ad('0x6d'),JSON['stringify'](_0x3d69f6[_0x75ad('0x16')][_0x3d69f6['actions'][_0x2920fe][_0x75ad('0x6c')]][_0x75ad('0x49')]),'pTalking:\x20',JSON['stringify'](_0x3d69f6[_0x75ad('0x16')][_0x3d69f6[_0x75ad('0x19')][_0x2920fe][_0x75ad('0x6c')]]['pTalking']),JSON[_0x75ad('0x54')](_0x3d69f6['actions'][_0x2920fe][_0x75ad('0x6e')]),JSON[_0x75ad('0x54')](_[_0x75ad('0x6f')](_0x3d69f6[_0x75ad('0x19')][_0x2920fe],['contactId',_0x75ad('0x70'),'VoiceQueueId','ListId'])));return ami[_0x75ad('0x71')]({'action':_0x75ad('0x72'),'channel':_0x3d69f6[_0x75ad('0x19')][_0x2920fe][_0x75ad('0x73')]})['catch'](function(_0x1e9973){if(_0x1e9973[_0x75ad('0x48')]===_0x75ad('0x74')){setTimeout(function(){if(_0x3d69f6['actions'][_0x2920fe]){ut[_0x75ad('0x75')](_0x3d69f6[_0x75ad('0x16')][_0x3d69f6[_0x75ad('0x19')][_0x2920fe]['queue']],_0x75ad('0x76'));if(_0x3d69f6[_0x75ad('0x19')][_0x2920fe][_0x75ad('0x6e')]===!![]){ut['decrementTalkink'](_0x3d69f6[_0x75ad('0x16')][_0x3d69f6[_0x75ad('0x19')][_0x2920fe][_0x75ad('0x6c')]],_0x75ad('0x76'));ut[_0x75ad('0x77')]('[Dialer][checkChannel][pTalking][Preview]'+_0x2920fe,_0x3d69f6[_0x75ad('0x19')][_0x2920fe][_0x75ad('0x6c')]);}ut[_0x75ad('0x77')]('[Dialer][checkChannel][Preview]'+_0x2920fe,_0x3d69f6[_0x75ad('0x19')][_0x2920fe]['queue']);delete _0x3d69f6['actions'][_0x2920fe];}},0x2328);}});}});};Preview['prototype']['clearZombieChannels']=function(){var _0x3ba28e=this;loggerAction[_0x75ad('0x58')](_0x75ad('0x78'),_[_0x75ad('0x79')](this[_0x75ad('0x19')]));for(var _0x251998 in this[_0x75ad('0x19')]){if(_0x3ba28e[_0x75ad('0x19')]['hasOwnProperty'](_0x251998)){_0x3ba28e['clearZombieChannel'](_0x251998);}}};Preview['prototype']['recallMe']=function(_0x37184c){var _0x2e2b91=this;rpcDb[_0x75ad('0x7a')](_0x37184c['id'],ut[_0x75ad('0x7b')](this['agents']))[_0x75ad('0x7c')](function(_0x379d17){if(!_[_0x75ad('0x7d')](_0x379d17)){for(var _0x215d00=0x0;_0x215d00<_0x379d17[_0x75ad('0x7e')];_0x215d00+=0x1){if(ut[_0x75ad('0x7f')](_0x379d17[_0x215d00][_0x75ad('0x80')])<_0x37184c[_0x75ad('0x81')]*0x3c){if(_0x379d17[_0x215d00][_0x75ad('0x82')]&&!_0x379d17[_0x215d00]['Agent']['voicePause']){_0x2e2b91['run'](_0x379d17[_0x215d00]['id'])[_0x75ad('0x7c')](ut['logger2'](_0x75ad('0x83')))[_0x75ad('0x84')](ut['logger2'](_0x75ad('0x83')));}else{rpcDb[_0x75ad('0x85')](_0x379d17[_0x215d00]['id']);}}else{var _0x35d577=new Action(_0x379d17[_0x215d00],_0x37184c);_0x35d577[_0x75ad('0x86')]=moment()[_0x75ad('0x55')](_0x75ad('0x87'));_0x37184c[_0x75ad('0x3e')]+=0x1;ut['logCustomer'](_0x35d577,0x17,_0x75ad('0x88'));if(_0x37184c[_0x75ad('0x89')]){rpcDb[_0x75ad('0x8a')](ut[_0x75ad('0x8b')](_0x379d17[_0x215d00]));rpcDb['createCustomerHistory'](_0x35d577,_0x75ad('0x8c'));}else{ut[_0x75ad('0x8d')](_0x35d577,0x16,_0x75ad('0x8e'));rpcDb[_0x75ad('0x8f')](_0x35d577,_0x75ad('0x90'));rpcDb['createCustomerFinal'](_0x35d577,_0x75ad('0x90'));}}}}})[_0x75ad('0x84')](ut[_0x75ad('0x91')]('[getContactRecallMe]'));};Preview[_0x75ad('0x11')][_0x75ad('0x67')]=function(_0x25b894){_0x25b894[_0x75ad('0x5a')]=!![];if(ut[_0x75ad('0x92')](_0x25b894[_0x75ad('0x30')])){_0x25b894[_0x75ad('0x48')]=_0x75ad('0x93');}else if(!ut[_0x75ad('0x94')](_0x25b894['dialActive'])){_0x25b894['message']=_0x75ad('0x5d');}else if(!this[_0x75ad('0x95')](_0x25b894[_0x75ad('0x50')])){if(!this[_0x75ad('0x95')](_0x25b894[_0x75ad('0x96')])){_0x25b894[_0x75ad('0x48')]=_0x75ad('0x97');}else{_0x25b894[_0x75ad('0x48')]=_0x75ad('0x98');}}else{_0x25b894[_0x75ad('0x48')]='ACTIVE';}emitCampaignPreview(_0x25b894);};Preview['prototype'][_0x75ad('0x99')]=function(_0xf71e84,_0x5e2500,_0x426008){var _0x51f772=this;var _0x2acfcf=this[_0x75ad('0x19')][_0x5e2500];var _0x3bcce7=this[_0x75ad('0x16')][_0x2acfcf['queue']];var _0x326f96;if(_0x3bcce7){switch(_0x426008){case'1':_0x3bcce7['outboundNoSuchCallsDay']+=0x1;_0x2acfcf[_0x75ad('0x9a')]+=0x1;_0x2acfcf[_0x75ad('0x9b')]=ut[_0x75ad('0x9c')](_0x2acfcf);ut[_0x75ad('0x8d')](_0x2acfcf,0x0,_0x75ad('0x9d'));ami[_0x75ad('0x29')](_0x75ad('0x9e'),ut[_0x75ad('0x9f')](_0x2acfcf,_0x75ad('0xa0')));rpcDb[_0x75ad('0x8f')](_0x2acfcf,_0x75ad('0xa1'));if(ut['totalGlobal'](_0x2acfcf)>=_0x3bcce7[_0x75ad('0xa2')]){_0x326f96=ut[_0x75ad('0xa3')](_0x2acfcf,0xf,_0x75ad('0xa4'));rpcDb[_0x75ad('0xa5')](_0x326f96,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x2acfcf[_0x75ad('0x9a')]>=_0x3bcce7['dialNoSuchNumberMaxRetry']){rpcDb[_0x75ad('0xa5')](_0x2acfcf,_0x75ad('0xa6'));}else{rpcDb[_0x75ad('0xa7')](ut['scheduledAt'](_0x2acfcf,_0x75ad('0x9a'),_0x3bcce7['dialNoSuchNumberRetryFrequency']),_0x2acfcf[_0x75ad('0xa8')],_0x2acfcf[_0x75ad('0xa9')]);}}delete this[_0x75ad('0x19')][_0xf71e84[_0x75ad('0xaa')]];break;case _0x75ad('0xab'):var _0xc918b5=moment()['format'](_0x75ad('0x87'));_0x2acfcf[_0x75ad('0xac')]=_0xc918b5;_0x2acfcf[_0x75ad('0xad')]=_0xc918b5;_0x2acfcf[_0x75ad('0x6e')]=!![];_0x3bcce7[_0x75ad('0x5b')]+=0x1;logger[_0x75ad('0x58')](_0x75ad('0xae'),_0x2acfcf[_0x75ad('0xaf')],_0x75ad('0xb0'),_0x3bcce7[_0x75ad('0x2c')],_0x75ad('0xb1'),_0x3bcce7['pTalking']);ami[_0x75ad('0x29')](_0x75ad('0xb2'),ut[_0x75ad('0x9f')](_0x2acfcf,_0x75ad('0xb3'),this[_0x75ad('0x16')][_0x2acfcf[_0x75ad('0x6c')]]));if(_0x3bcce7[_0x75ad('0xb4')]){ami[_0x75ad('0x29')](_0x75ad('0xb5'),ut[_0x75ad('0xb6')](_0x2acfcf));}break;case'16':ami[_0x75ad('0x29')](_0x75ad('0xb7'),ut[_0x75ad('0x9f')](_0x2acfcf,_0x75ad('0xb8'),this[_0x75ad('0x16')][_0x2acfcf['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x2acfcf,'complete'));_0x3bcce7[_0x75ad('0x3a')]+=0x1;_0x3bcce7[_0x75ad('0x31')]+=0x1;_0x3bcce7[_0x75ad('0x2e')]+=0x1;ut[_0x75ad('0xb9')](_0x3bcce7,_0x75ad('0xba'));_0x2acfcf['countglobal']=ut[_0x75ad('0x9c')](_0x2acfcf);ut[_0x75ad('0x8d')](_0x2acfcf,0x4,'Answer');rpcDb['createCustomerHistory'](_0x2acfcf,_0x75ad('0xbb'));rpcDb[_0x75ad('0xa5')](_0x2acfcf,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x75ad('0xbc')](_0x2acfcf);_0x3bcce7[_0x75ad('0xbd')]+=_0x2acfcf['talktime'];_0x3bcce7[_0x75ad('0xbe')]+=_0x2acfcf[_0x75ad('0xbf')];logger['info'](_0x75ad('0xc0'),_0x2acfcf[_0x75ad('0xaf')],_0x75ad('0xb0'),_0x3bcce7[_0x75ad('0x2c')],_0x75ad('0xb1'),_0x3bcce7[_0x75ad('0x5b')]);delete this[_0x75ad('0x19')][_0xf71e84[_0x75ad('0xaa')]];break;case _0x75ad('0xc1'):_0x3bcce7[_0x75ad('0xc2')]+=0x1;_0x2acfcf[_0x75ad('0xc3')]+=0x1;_0x2acfcf[_0x75ad('0x9b')]=ut['totalGlobal'](_0x2acfcf);ut[_0x75ad('0x8d')](_0x2acfcf,0x5,_0x75ad('0xc4'));ami[_0x75ad('0x29')](_0x75ad('0xc5'),ut[_0x75ad('0x9f')](_0x2acfcf,'busy'));rpcDb[_0x75ad('0x8f')](_0x2acfcf,_0x75ad('0xc6'));if(ut[_0x75ad('0x9c')](_0x2acfcf)>=_0x3bcce7[_0x75ad('0xa2')]){_0x326f96=ut['cloneAction'](_0x2acfcf,0xf,_0x75ad('0xa4'));rpcDb[_0x75ad('0xa5')](_0x326f96,_0x75ad('0xc7'));}else{if(_0x2acfcf[_0x75ad('0xc3')]>=_0x3bcce7[_0x75ad('0xc8')]){rpcDb[_0x75ad('0xa5')](_0x2acfcf,_0x75ad('0xc6'));}else{rpcDb[_0x75ad('0xa7')](ut[_0x75ad('0xc9')](_0x2acfcf,_0x75ad('0xc3'),_0x3bcce7[_0x75ad('0xca')]),_0x2acfcf['unlockAgent'],_0x2acfcf[_0x75ad('0xa9')]);}}break;case _0x75ad('0xcb'):_0x3bcce7[_0x75ad('0x3c')]+=0x1;_0x2acfcf['countnoanswerretry']+=0x1;_0x2acfcf['countglobal']=ut['totalGlobal'](_0x2acfcf);ut[_0x75ad('0x8d')](_0x2acfcf,0x3,_0x75ad('0xcc'));ami[_0x75ad('0x29')]('custom:agentnoanswer',ut['buildObj'](_0x2acfcf,_0x75ad('0xcd')));rpcDb['createCustomerHistory'](_0x2acfcf,_0x75ad('0xce'));if(ut[_0x75ad('0x9c')](_0x2acfcf)>=_0x3bcce7[_0x75ad('0xa2')]){_0x326f96=ut[_0x75ad('0xa3')](_0x2acfcf,0xf,_0x75ad('0xa4'));rpcDb[_0x75ad('0xa5')](_0x326f96,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x2acfcf[_0x75ad('0xcf')]>=_0x3bcce7[_0x75ad('0xd0')]){rpcDb[_0x75ad('0xa5')](_0x2acfcf,_0x75ad('0xce'));}else{rpcDb[_0x75ad('0xa7')](ut[_0x75ad('0xc9')](_0x2acfcf,'countnoanswerretry',_0x3bcce7[_0x75ad('0xd1')]),_0x2acfcf[_0x75ad('0xa8')],_0x2acfcf[_0x75ad('0xa9')]);}}break;case _0x75ad('0xd2'):_0x3bcce7[_0x75ad('0xd3')]+=0x1;_0x2acfcf[_0x75ad('0xd4')]+=0x1;_0x2acfcf[_0x75ad('0x9b')]=ut[_0x75ad('0x9c')](_0x2acfcf);ut[_0x75ad('0x8d')](_0x2acfcf,0x8,_0x75ad('0xd5'));ami[_0x75ad('0x29')](_0x75ad('0xd6'),ut['buildObj'](_0x2acfcf,_0x75ad('0xd7')));rpcDb[_0x75ad('0x8f')](_0x2acfcf,_0x75ad('0xd8'));if(ut['totalGlobal'](_0x2acfcf)>=_0x3bcce7[_0x75ad('0xa2')]){_0x326f96=ut['cloneAction'](_0x2acfcf,0xf,_0x75ad('0xa4'));rpcDb['createCustomerFinal'](_0x326f96,_0x75ad('0xd9'));}else{if(_0x2acfcf[_0x75ad('0xd4')]>=_0x3bcce7[_0x75ad('0xda')]){rpcDb[_0x75ad('0xa5')](_0x2acfcf,_0x75ad('0xd8'));}else{rpcDb[_0x75ad('0xa7')](ut[_0x75ad('0xc9')](_0x2acfcf,_0x75ad('0xd4'),_0x3bcce7[_0x75ad('0xca')]),_0x2acfcf[_0x75ad('0xa8')],_0x2acfcf['activeContact']);}}break;case'CANCEL':_0x3bcce7['outboundRejectCallsDay']+=0x1;_0x2acfcf[_0x75ad('0xdb')]+=0x1;_0x2acfcf[_0x75ad('0x9b')]=ut['totalGlobal'](_0x2acfcf);ut['logCustomer'](_0x2acfcf,0x14,_0x75ad('0xdc'));ami[_0x75ad('0x29')]('custom:agentreject',ut['buildObj'](_0x2acfcf,_0x75ad('0xdd')));rpcDb[_0x75ad('0x8f')](_0x2acfcf,'[syncHangupRequest][logAgentReject]');if(ut['totalGlobal'](_0x2acfcf)>=_0x3bcce7[_0x75ad('0xa2')]){_0x326f96=ut[_0x75ad('0xa3')](_0x2acfcf,0x14,_0x75ad('0xdc'));rpcDb[_0x75ad('0xa5')](_0x326f96,_0x75ad('0xde'));}else{if(_0x2acfcf[_0x75ad('0xdb')]>=_0x3bcce7[_0x75ad('0xdf')]){rpcDb[_0x75ad('0xa5')](_0x2acfcf,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x75ad('0xa7')](ut[_0x75ad('0xc9')](_0x2acfcf,_0x75ad('0xdb'),_0x3bcce7['dialAgentRejectRetryFrequency']),_0x2acfcf['unlockAgent'],_0x2acfcf[_0x75ad('0xa9')]);}}break;case _0x75ad('0xe0'):_0x3bcce7[_0x75ad('0xe1')]+=0x1;_0x2acfcf[_0x75ad('0xe2')]+=0x1;_0x2acfcf[_0x75ad('0x9b')]=ut[_0x75ad('0x9c')](_0x2acfcf);ut[_0x75ad('0x8d')](_0x2acfcf,0xb,_0x75ad('0xe3'));rpcDb[_0x75ad('0x8f')](_0x2acfcf,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x75ad('0x9c')](_0x2acfcf)>=_0x3bcce7['dialGlobalMaxRetry']){_0x326f96=ut[_0x75ad('0xa3')](_0x2acfcf,0xf,_0x75ad('0xa4'));rpcDb['createCustomerFinal'](_0x326f96,_0x75ad('0xe4'));}else{if(_0x2acfcf[_0x75ad('0xe5')]>=_0x3bcce7[_0x75ad('0xe6')]){rpcDb[_0x75ad('0xa5')](_0x2acfcf,_0x75ad('0xe4'));}else{rpcDb[_0x75ad('0xa7')](ut[_0x75ad('0xc9')](_0x2acfcf,_0x75ad('0xe2'),_0x3bcce7[_0x75ad('0xe7')]),_0x2acfcf[_0x75ad('0xa8')],_0x2acfcf[_0x75ad('0xa9')]);}}break;case'18':_0x3bcce7[_0x75ad('0x3f')]+=0x1;_0x2acfcf[_0x75ad('0xe8')]+=0x1;_0x2acfcf[_0x75ad('0x9b')]=ut[_0x75ad('0x9c')](_0x2acfcf);ut[_0x75ad('0x8d')](_0x2acfcf,0x12,_0xf71e84[_0x75ad('0xe9')]||_0xf71e84['dialstatus']);ami[_0x75ad('0x29')]('custom:amd',ut[_0x75ad('0x9f')](_0x2acfcf,'amd'));rpcDb[_0x75ad('0x8f')](_0x2acfcf,_0x75ad('0xea'));if(ut[_0x75ad('0x9c')](_0x2acfcf)>=_0x3bcce7['dialGlobalMaxRetry']){_0x326f96=ut[_0x75ad('0xa3')](_0x2acfcf,0xf,_0x75ad('0xa4'));rpcDb[_0x75ad('0xa5')](_0x326f96,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x75ad('0xa5')](_0x2acfcf,_0x75ad('0xea'));}delete this['actions'][_0xf71e84[_0x75ad('0xaa')]];break;case'19':_0x3bcce7['outboundUnknownCallsDay']+=0x1;_0x2acfcf['countglobal']=ut[_0x75ad('0x9c')](_0x2acfcf);ut['logCustomer'](_0x2acfcf,0x13,_0xf71e84['cause-txt']||_0xf71e84[_0x75ad('0xeb')]);ami[_0x75ad('0x29')](_0x75ad('0xec'),ut[_0x75ad('0x9f')](_0x2acfcf,_0x75ad('0xed')));rpcDb[_0x75ad('0x8f')](_0x2acfcf,_0x75ad('0xee'));if(ut[_0x75ad('0x9c')](_0x2acfcf)>=_0x3bcce7[_0x75ad('0xa2')]){_0x326f96=ut[_0x75ad('0xa3')](_0x2acfcf,0xf,'Global');rpcDb['createCustomerFinal'](_0x326f96,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x75ad('0xa5')](_0x2acfcf,_0x75ad('0xee'));}delete this['actions'][_0xf71e84[_0x75ad('0xaa')]];break;default:if(_0x2acfcf['dialAnswer']){ut['decrementTalkink'](_0x3bcce7,_0x75ad('0xef'));ut['loggerError'](_0x75ad('0xf0')+_0x3bcce7[_0x75ad('0x2c')],_0xf71e84);}_0x3bcce7['outboundUnknownCallsDay']+=0x1;_0x2acfcf[_0x75ad('0x9b')]=ut[_0x75ad('0x9c')](_0x2acfcf);ut[_0x75ad('0x8d')](_0x2acfcf,0xc,_0xf71e84[_0x75ad('0xe9')]||_0xf71e84['dialstatus']);rpcDb[_0x75ad('0x8f')](_0x2acfcf,_0x75ad('0xf1'));if(ut[_0x75ad('0x9c')](_0x2acfcf)>=_0x3bcce7[_0x75ad('0xa2')]){_0x326f96=ut[_0x75ad('0xa3')](_0x2acfcf,0xf,_0x75ad('0xa4'));rpcDb['createCustomerFinal'](_0x326f96,_0x75ad('0xf2'));}else{rpcDb[_0x75ad('0xa5')](_0x2acfcf,_0x75ad('0xf2'));}delete this[_0x75ad('0x19')][_0xf71e84[_0x75ad('0xaa')]];}if(!(_0x2acfcf[_0x75ad('0x6e')]&&_0x426008==='16')){ut['updateOriginated'](_0x3bcce7,'[callProgressDetectingCustomer]');logger[_0x75ad('0x58')](_0x75ad('0xf3'),_0x2acfcf[_0x75ad('0xaf')],_0x75ad('0xb0'),_0x3bcce7[_0x75ad('0x2c')],_0x75ad('0x6d'),_0x3bcce7[_0x75ad('0x49')]);}if(_0x426008!==_0x75ad('0xab')){delete this[_0x75ad('0x19')][_0xf71e84['linkedid']];delete this[_0x75ad('0x19')][_0xf71e84[_0x75ad('0xf4')]];}}};Preview[_0x75ad('0x11')][_0x75ad('0xf5')]=function(_0x52a807,_0x5cb2a3,_0x3e1495){if(_[_0x75ad('0xf6')](_0x5cb2a3)&&_0x75ad('0xf7')!==typeof _0x5cb2a3){return;}if(_[_0x75ad('0xf6')](_0x3e1495)&&_0x75ad('0xf7')!==typeof _0x3e1495){return;}switch(_0x3e1495[_0x75ad('0xf8')]){case'0':ut[_0x75ad('0xf9')](_0x52a807,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x52a807,_0x75ad('0xfa'));break;case'3':ut[_0x75ad('0xf9')](_0x52a807,0x3,_0x75ad('0xcc'));rpcDb[_0x75ad('0xfb')](_0x52a807,_0x75ad('0xfc'));break;case'5':ut['logAgent'](_0x52a807,0x5,_0x75ad('0xc4'));rpcDb[_0x75ad('0xfb')](_0x52a807,_0x75ad('0xfd'));break;case'8':ut[_0x75ad('0xf9')](_0x52a807,0x8,_0x75ad('0xd5'));rpcDb[_0x75ad('0xfb')](_0x52a807,_0x75ad('0xfe'));break;case'22':ut[_0x75ad('0xf9')](_0x52a807,0x16,_0x75ad('0xff'));rpcDb['createAgentHistory'](_0x52a807,_0x75ad('0x100'));break;default:ut[_0x75ad('0xf9')](_0x52a807,0xc,_0x3e1495[_0x75ad('0xf8')]);rpcDb[_0x75ad('0xfb')](_0x52a807,_0x75ad('0xfe'));}ut['updateOriginated'](_0x5cb2a3,_0x75ad('0x101'));logger[_0x75ad('0x58')]('[originated][decrement][callProgressDetectingAgent]',_0x52a807[_0x75ad('0xaf')],_0x75ad('0xb0'),_0x5cb2a3['name'],_0x75ad('0x6d'),_0x5cb2a3['originated']);delete this[_0x75ad('0x19')][_0x52a807[_0x75ad('0xaf')]];};Preview[_0x75ad('0x11')][_0x75ad('0x102')]=function(_0x4b9817,_0x834670,_0x1db2a5,_0x4274b9,_0x3cd832){var _0x545d00=this;return new BPromise(function(_0x5d7c8e,_0x5bebc0){if(_[_0x75ad('0x7d')](_0x834670)||_[_0x75ad('0x7d')](_0x834670['Contact'])||_[_0x75ad('0x7d')](_0x834670[_0x75ad('0x103')][_0x75ad('0x104')])||_[_0x75ad('0x7d')](_0x834670[_0x75ad('0x105')])){_0x5bebc0(ut[_0x75ad('0x48')](_0x75ad('0x106'),_0x4274b9,_0x3cd832));return;}var _0x1aede2=uuid['v4']();var _0x6ce5a4=_0x545d00[_0x75ad('0x16')][_0x834670[_0x75ad('0x6b')][_0x75ad('0x2c')]];var _0xc6ecf=_0x1db2a5?_0x545d00['agents'][_0x1db2a5]['id']:undefined;_0x545d00['actions'][_0x1aede2]=new Action(_0x834670,_0x6ce5a4,_0x1aede2,_0x1db2a5,_0xc6ecf);var _0x314ea1=_0x545d00[_0x75ad('0x19')][_0x1aede2];_0x314ea1[_0x75ad('0xa8')]=_0x4274b9;_0x314ea1[_0x75ad('0xa9')]=_0x3cd832;_0x314ea1[_0x75ad('0x107')]=_0x1db2a5;if(_['isEmpty'](_0x4b9817)){_0x545d00['execCall'](_0x314ea1,_0x6ce5a4,_0x834670,_0x1db2a5)['then'](function(_0x57163a){logger[_0x75ad('0x58')](_0x75ad('0x108'),_0x75ad('0x109')+_0x314ea1['queue']+'\x20IdHopper:\x20'+_0x314ea1[_0x75ad('0x10a')],JSON[_0x75ad('0x54')](_0x57163a));ami[_0x75ad('0x29')](_0x75ad('0x10b'),ut[_0x75ad('0x9f')](_0x314ea1,_0x75ad('0x10c'),_0x545d00[_0x75ad('0x16')][_0x314ea1['queue']]));_0x5d7c8e(ut[_0x75ad('0x48')](_0x75ad('0x10d')));})[_0x75ad('0x84')](function(_0x550343){ut[_0x75ad('0x5e')]('[Preview][execCall][failure]',_0x550343);_0x5bebc0(ut[_0x75ad('0x48')](_0x75ad('0x10e'),_0x4274b9,_0x3cd832));});}else{_0x6ce5a4[_0x75ad('0x10f')]+=0x1;ut[_0x75ad('0x110')](_0x314ea1);rpcDb[_0x75ad('0x111')](_0x314ea1,_0x75ad('0x112'));delete _0x545d00[_0x75ad('0x19')][_0x1aede2];_0x5bebc0(ut[_0x75ad('0x48')](_0x75ad('0x113'),_0x4274b9,_0x3cd832));}});};Preview[_0x75ad('0x11')][_0x75ad('0x95')]=function(_0x1eaaeb){return!_[_0x75ad('0x7d')](_0x1eaaeb)&&!_['isNil'](_0x1eaaeb[_0x75ad('0x2c')])&&!_[_0x75ad('0x7d')](_0x1eaaeb[_0x75ad('0x51')])&&_0x1eaaeb[_0x75ad('0x51')]&&!_[_0x75ad('0x7d')](this[_0x75ad('0x18')][util['format'](_0x75ad('0x114'),_0x1eaaeb[_0x75ad('0x2c')])])&&!_['isNil'](this['trunks'][util[_0x75ad('0x55')](_0x75ad('0x114'),_0x1eaaeb[_0x75ad('0x2c')])]['status'])&&(this[_0x75ad('0x18')][util['format'](_0x75ad('0x114'),_0x1eaaeb[_0x75ad('0x2c')])][_0x75ad('0x72')]==='reachable'||this['trunks'][util[_0x75ad('0x55')]('SIP/%s',_0x1eaaeb[_0x75ad('0x2c')])][_0x75ad('0x72')]==='unmonitored');};Preview[_0x75ad('0x11')][_0x75ad('0x115')]=function(_0x191a44,_0xf95529){var _0xae8d38=this;return new BPromise(function(_0x29c054,_0x120718){_0xae8d38[_0x75ad('0x116')](_0x191a44,_0xf95529)['then'](function(_0x46a124){_0x29c054(_['pick'](_0x46a124,[_0x75ad('0x48')]));})[_0x75ad('0x84')](function(_0x2e65aa){if(_0x2e65aa[_0x75ad('0x117')]){rpcDb[_0x75ad('0x118')](_0x191a44);}if(_0x2e65aa[_0x75ad('0x51')]){rpcDb[_0x75ad('0x85')](_0x191a44);}_0x120718(_[_0x75ad('0x6f')](_0x2e65aa,[_0x75ad('0x48')]));});});};Preview[_0x75ad('0x11')][_0x75ad('0x116')]=function(_0x45a3b0,_0x455faa){var _0x4c2ac1=this;return new BPromise(function(_0x564910,_0x31ddbe){var _0x376ab7,_0xa4d185;rpcDb[_0x75ad('0x119')](_0x45a3b0)[_0x75ad('0x7c')](function(_0x5c2e0c){if(!_['isNil'](_0x5c2e0c[0x0])){_0xa4d185=_0x5c2e0c[0x0][_0x75ad('0x11a')]?![]:!![];_0x376ab7=_0x5c2e0c[0x0][_0x75ad('0x11a')]?!![]:![];_0x376ab7=_0x455faa?!![]:_0x376ab7;}var _0xe78ae1=_0x4c2ac1[_0x75ad('0x11b')](_0x5c2e0c);if(_0xe78ae1[_0x75ad('0x11c')]){rpcDb[_0x75ad('0x11d')](_[_0x75ad('0x6f')](_0x5c2e0c[0x0],[_0x75ad('0x105'),_0x75ad('0x11e')]))[_0x75ad('0x7c')](function(_0x1b3ed8){_0x4c2ac1[_0x75ad('0x102')](_0x1b3ed8,_0x5c2e0c[0x0],_0x455faa,_0xa4d185,_0x376ab7)['then'](function(_0xf9b9fd){_0x564910(_0xf9b9fd);})['catch'](function(_0x140155){_0x31ddbe(_0x140155);});})[_0x75ad('0x84')](function(_0x40a3b7){ut[_0x75ad('0x5e')](_0x75ad('0x11f'),_0x40a3b7);_0x31ddbe(ut[_0x75ad('0x48')](_0x75ad('0x120'),_0xa4d185,_0x376ab7));});}else{_0x31ddbe(ut['message'](_0xe78ae1['message'],_0xa4d185,_0x376ab7));}})['catch'](function(_0x2886dc){ut[_0x75ad('0x5e')](_0x75ad('0x121'),_0x2886dc);_0x31ddbe(ut[_0x75ad('0x48')](_0x75ad('0x120'),![],!![]));});});};Preview[_0x75ad('0x11')][_0x75ad('0x11b')]=function(_0x185c21){if(_['isNil'](_0x185c21)||_['isEmpty'](_0x185c21)||!_[_0x75ad('0x7d')](_0x185c21[0x0][_0x75ad('0x82')])&&_[_0x75ad('0x7d')](_0x185c21[0x0]['Agent'][_0x75ad('0x2c')])){ut[_0x75ad('0x5e')](_0x75ad('0x122'),_0x185c21);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x577536=this[_0x75ad('0x16')][_0x185c21[0x0]['Queue'][_0x75ad('0x2c')]];_0x577536[_0x75ad('0x48')]=_0x75ad('0x98');if(_[_0x75ad('0x7d')](_0x577536)){ut[_0x75ad('0x5e')](_0x75ad('0x123'),_0x577536);return{'isValid':![],'message':_0x75ad('0x124')};}if(!this[_0x75ad('0x95')](_0x577536[_0x75ad('0x50')])){ut[_0x75ad('0x5e')](_0x75ad('0x125'),_0x75ad('0x126')+_0x577536[_0x75ad('0x2c')]+_0x75ad('0x127'));if(!this[_0x75ad('0x95')](_0x577536[_0x75ad('0x96')])){ut[_0x75ad('0x5e')](_0x75ad('0x125'),_0x577536[_0x75ad('0x2c')]+_0x75ad('0x128'));return{'isValid':![],'message':_0x75ad('0x129')};}}if(!ut[_0x75ad('0x94')](_0x577536[_0x75ad('0x35')])){ut[_0x75ad('0x5e')](_0x75ad('0x12a'),_0x577536[_0x75ad('0x2c')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x75ad('0x126')+_0x577536[_0x75ad('0x2c')]+_0x75ad('0x12b')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x75ad('0x11')][_0x75ad('0x12c')]=function(_0x748d80,_0x86afe0,_0x36bbc8,_0x55b607){var _0x2907f5=this;return new BPromise(function(_0x642ab8,_0x4b3479){var _0x17280e=_0x748d80['uniqueid'];var _0x5cea64=_0x2907f5[_0x75ad('0x95')](_0x86afe0['Trunk'])?util[_0x75ad('0x55')](_0x75ad('0x12d'),_0x86afe0[_0x75ad('0x50')][_0x75ad('0x2c')],_[_0x75ad('0x7d')](_0x86afe0['dialPrefix'])?'':_0x86afe0[_0x75ad('0x12e')][_0x75ad('0x12f')]()||'',_0x86afe0[_0x75ad('0x130')]>0x0?_0x36bbc8['Contact'][_0x75ad('0x104')][_0x75ad('0x131')](_0x86afe0[_0x75ad('0x130')]):_0x36bbc8[_0x75ad('0x103')][_0x75ad('0x104')]):util[_0x75ad('0x55')](_0x75ad('0x12d'),_[_0x75ad('0x7d')](_0x86afe0[_0x75ad('0x96')])?_0x86afe0[_0x75ad('0x50')]['name']:_0x86afe0[_0x75ad('0x96')][_0x75ad('0x2c')],_[_0x75ad('0x7d')](_0x86afe0[_0x75ad('0x12e')])?'':_0x86afe0[_0x75ad('0x12e')][_0x75ad('0x12f')]()||'',_0x86afe0[_0x75ad('0x130')]>0x0?_0x36bbc8[_0x75ad('0x103')][_0x75ad('0x104')][_0x75ad('0x131')](_0x86afe0[_0x75ad('0x130')]):_0x36bbc8['Contact'][_0x75ad('0x104')]);var _0x11734a=_0x2907f5[_0x75ad('0x95')](_0x86afe0['Trunk'])?ut['getCallerId'](_0x86afe0[_0x75ad('0x50')][_0x75ad('0x52')],_0x86afe0[_0x75ad('0x37')],_0x86afe0['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x75ad('0x132')](_0x86afe0[_0x75ad('0x38')],_0x86afe0[_0x75ad('0x133')]):_0x86afe0[_0x75ad('0x38')]):ut[_0x75ad('0x134')](_['isNil'](_0x86afe0['TrunkBackup'])?_0x86afe0[_0x75ad('0x50')]['callerid']:_0x86afe0[_0x75ad('0x96')][_0x75ad('0x52')],_0x86afe0['dialOriginateCallerIdName'],_0x86afe0[_0x75ad('0x133')]>0x0?ut[_0x75ad('0x132')](_0x86afe0[_0x75ad('0x38')],_0x86afe0['dialRandomLastDigitCallerIdNumber']):_0x86afe0[_0x75ad('0x38')]);if(_0x11734a){_0x748d80[_0x75ad('0x135')]=ut[_0x75ad('0x136')](_0x11734a);_0x748d80['originatecalleridnum']=ut[_0x75ad('0x137')](_0x11734a);}var _0x183238=ut[_0x75ad('0x138')](_0x86afe0,_0x36bbc8,_0x5cea64,_0x11734a,_0x17280e,_0x748d80);_[_0x75ad('0x139')](_0x748d80,ut['toLowerVariables'](_0x183238));_0x748d80[_0x75ad('0x86')]=moment()['format'](_0x75ad('0x87'));ami[_0x75ad('0x71')](ut['variablesAction'](_0x748d80,_0x86afe0,_0x183238,_0x748d80['activeContact'],_0x55b607))['then'](function(_0x1ae1e9){var _0x125e21=_0x748d80[_0x75ad('0x13a')];if(!_[_0x75ad('0x7d')](_0x125e21)){if(!_[_0x75ad('0x7d')](_0x2907f5['agents'][_0x125e21])){_0x2907f5['agents'][_0x125e21][_0x75ad('0x13b')]=_0x748d80[_0x75ad('0x13c')];emit(util[_0x75ad('0x55')](_0x75ad('0x13d'),_0x2907f5[_0x75ad('0x1a')][_0x125e21][_0x75ad('0x2c')]),_0x75ad('0x13e'),{'destaccountcode':_0x2907f5[_0x75ad('0x1a')][_0x125e21][_0x75ad('0x13f')],'destconnectedlinenum':_0x748d80['calleridnum']});}}_0x86afe0[_0x75ad('0x49')]+=0x1;logger['info']('[originated][increment]',_0x17280e,_0x75ad('0xb0'),_0x86afe0[_0x75ad('0x2c')],'originated:\x20',_0x86afe0['originated']);_0x642ab8(_0x1ae1e9);})[_0x75ad('0x84')](function(_0x2eef37){ut[_0x75ad('0xf9')](_0x748d80,0xe,_0x75ad('0x140'));rpcDb[_0x75ad('0xfb')](_0x748d80,_0x75ad('0x141'));_0x4b3479(_0x2eef37);});});};Preview[_0x75ad('0x11')]['syncNewExten']=function(_0x3471ff){if(this['actions'][_0x3471ff[_0x75ad('0xaa')]]){this[_0x75ad('0x19')][_0x3471ff[_0x75ad('0xaa')]]['channel']=_0x3471ff[_0x75ad('0x73')];}};Preview[_0x75ad('0x11')][_0x75ad('0x1c')]=function(_0x386195){var _0x446e38=this;var _0x41fc64=this[_0x75ad('0x19')][_0x386195[_0x75ad('0x142')]];if(_0x41fc64){if(_0x41fc64[_0x75ad('0x107')]&&this[_0x75ad('0x1a')][_0x41fc64[_0x75ad('0x107')]]){ut['logLookAgent'](_0x41fc64,this['agents'][_0x41fc64[_0x75ad('0x107')]][_0x75ad('0x2c')],this[_0x75ad('0x1a')][_0x41fc64['lookAgent']]['id']);}var _0x3cf482=_['clone'](_0x41fc64);_0x3cf482[_0x75ad('0xac')]=moment()[_0x75ad('0x55')](_0x75ad('0x87'));var _0x40c4fe=_0x446e38[_0x75ad('0x16')][_0x41fc64[_0x75ad('0x6c')]];if(ut[_0x75ad('0x143')](_0x386195['response'])){if(_0x41fc64[_0x75ad('0xa8')]){rpcDb['unlockContact'](_0x41fc64[_0x75ad('0x10a')]);}if(_0x41fc64[_0x75ad('0xa9')]){rpcDb['disableContact'](_0x41fc64[_0x75ad('0x10a')]);}ami[_0x75ad('0x29')](_0x75ad('0x144'),ut['buildObj'](_0x41fc64,_0x75ad('0x145'),this['campaignsPreview'][_0x41fc64['queue']]));this['callProgressDetectingAgent'](_0x3cf482,_0x40c4fe,_0x386195);}else{_0x41fc64[_0x75ad('0x86')]=moment()[_0x75ad('0x55')](_0x75ad('0x87'));ut[_0x75ad('0xf9')](_0x3cf482,0x4,_0x75ad('0x146'));rpcDb[_0x75ad('0xfb')](_0x3cf482,_0x75ad('0x147'));}}};Preview[_0x75ad('0x11')][_0x75ad('0x148')]=function(_0x2b8810){var _0x10518b=this;var _0x188132=this[_0x75ad('0x19')][_0x2b8810[_0x75ad('0xaa')]];var _0x460188;if(_0x188132){_0x460188=this[_0x75ad('0x16')][_0x188132[_0x75ad('0x6c')]];logger['info'](_0x75ad('0x149'),_0x2b8810[_0x75ad('0xaa')],_0x75ad('0xb0'),_0x460188[_0x75ad('0x2c')],_0x75ad('0xb1'),_0x460188['pTalking']);}if(this[_0x75ad('0x19')][_0x2b8810['linkedid']]&&_0x2b8810[_0x75ad('0xaa')]!==_0x2b8810['uniqueid']){if(_0x2b8810[_0x75ad('0x14a')]==='16'&&this[_0x75ad('0x19')][_0x2b8810['linkedid']][_0x75ad('0x6e')]){this['callProgressDetectingCustomer'](_0x2b8810,_0x2b8810[_0x75ad('0xaa')],_0x2b8810[_0x75ad('0x14a')]);}else if(this[_0x75ad('0x19')][_0x2b8810[_0x75ad('0xaa')]][_0x75ad('0x6e')]){logger[_0x75ad('0x58')](_0x75ad('0x14b'),_0x2b8810[_0x75ad('0xaa')],_0x2b8810['cause'],_0x75ad('0xb0'),_0x460188[_0x75ad('0x2c')],_0x75ad('0xb1'),_0x460188[_0x75ad('0x5b')]);this[_0x75ad('0x99')](_0x2b8810,_0x2b8810[_0x75ad('0xaa')],_0x2b8810[_0x75ad('0x14a')]);}}else if(_0x188132&&_[_0x75ad('0x7d')](_0x188132['statedesc'])&&_0x460188[_0x75ad('0x14c')]&&_0x2b8810[_0x75ad('0xaa')]===_0x2b8810[_0x75ad('0xaf')]&&_[_0x75ad('0x7d')](_0x2b8810[_0x75ad('0xf8')])&&_0x2b8810[_0x75ad('0x14a')]==='16'&&_0x2b8810[_0x75ad('0x14d')]==='6'&&_[_0x75ad('0xf6')](_0x188132['transfer'])){if(_0x188132['unlockAgent']){rpcDb['unlockContact'](_0x188132['idContact']);}if(_0x188132[_0x75ad('0xa9')]){rpcDb[_0x75ad('0x85')](_0x188132[_0x75ad('0x10a')]);}_0x2b8810[_0x75ad('0xf8')]='22';this[_0x75ad('0xf5')](_0x188132,_0x460188,_0x2b8810);}else if(_0x188132&&_0x188132['transfer']){if(_0x2b8810[_0x75ad('0x14a')]==='16'&&this[_0x75ad('0x19')][_0x2b8810[_0x75ad('0xaa')]][_0x75ad('0x6e')]){logger['info']('[syncHangup][talking][transfer]',_0x2b8810['linkedid'],_0x2b8810[_0x75ad('0x14a')],_0x75ad('0xb0'),_0x460188['name'],'pTalking:\x20',_0x460188[_0x75ad('0x5b')]);this[_0x75ad('0x99')](_0x2b8810,_0x2b8810['linkedid'],_0x2b8810['cause']);}else if(this[_0x75ad('0x19')][_0x2b8810[_0x75ad('0xaa')]][_0x75ad('0x6e')]){logger[_0x75ad('0x58')](_0x75ad('0x14b'),_0x2b8810['linkedid'],_0x2b8810['cause'],_0x75ad('0xb0'),_0x460188[_0x75ad('0x2c')],_0x75ad('0xb1'),_0x460188[_0x75ad('0x5b')]);this['callProgressDetectingCustomer'](_0x2b8810,_0x2b8810[_0x75ad('0xaa')],_0x2b8810[_0x75ad('0x14a')]);}}};Preview['prototype'][_0x75ad('0x20')]=function(_0x14e7fc){if(this[_0x75ad('0x19')][_0x14e7fc[_0x75ad('0xf4')]]&&_0x14e7fc[_0x75ad('0xf4')]!==_0x14e7fc[_0x75ad('0x14e')]){this[_0x75ad('0x99')](_0x14e7fc,_0x14e7fc[_0x75ad('0xf4')],_0x14e7fc[_0x75ad('0xeb')]);}};Preview[_0x75ad('0x11')][_0x75ad('0x1f')]=function(_0x3acde7){if(this[_0x75ad('0x19')][_0x3acde7['linkedid']]&&_0x3acde7[_0x75ad('0xaa')]!==_0x3acde7['uniqueid']&&!this['actions'][_0x3acde7['linkedid']]['dialAnswer']){if(_0x3acde7[_0x75ad('0x14a')]==='1'){this['callProgressDetectingCustomer'](_0x3acde7,_0x3acde7[_0x75ad('0xaa')],_0x3acde7[_0x75ad('0x14a')]);}}};Preview[_0x75ad('0x11')][_0x75ad('0x14f')]=function(_0x252325,_0x30372a,_0x5b1861){if(this[_0x75ad('0x19')][_0x252325]){if(_[_0x75ad('0x7d')](this['actions'][_0x252325]['variables'])){this['actions'][_0x252325][_0x75ad('0x150')]={};}this[_0x75ad('0x19')][_0x252325][_0x75ad('0x150')][_0x30372a]=_0x5b1861;}};Preview[_0x75ad('0x11')][_0x75ad('0x151')]=function(_0x54ebe9){try{if(!_[_0x75ad('0x7d')](_0x54ebe9)){if(ut['filterKey'](_['keys'](_0x54ebe9[_0x75ad('0x152')])[0x0])){this['addVariable'](_0x54ebe9[_0x75ad('0xaf')],_['keys'](_0x54ebe9[_0x75ad('0x152')])[0x0],_0x54ebe9[_0x75ad('0x153')]);}}}catch(_0x3d4e50){logger['error']('[syncVarSet][Preview]',util[_0x75ad('0x154')](_0x3d4e50,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x75ad('0x25')]=function(_0x5a01f4){if(_0x5a01f4){if(this[_0x75ad('0x19')][_0x5a01f4['transfertargetlinkedid']]){this[_0x75ad('0x19')][_0x5a01f4[_0x75ad('0x155')]]['transfer']=!![];}}};Preview[_0x75ad('0x11')][_0x75ad('0x27')]=function(_0x5a37fb){if(_0x5a37fb){if(this['actions'][_0x5a37fb[_0x75ad('0x156')]]){this[_0x75ad('0x19')][_0x5a37fb[_0x75ad('0x156')]]['transfer']=!![];}}};module[_0x75ad('0x157')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index c63136c..98bc94a 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 _0xb4a9=['[rescheduleContactInQueue]\x20','util','bluebird','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','create','getContactRecallMe'];(function(_0x3a9a94,_0x1688dd){var _0x1e477e=function(_0x315e87){while(--_0x315e87){_0x3a9a94['push'](_0x3a9a94['shift']());}};_0x1e477e(++_0x1688dd);}(_0xb4a9,0x1f0));var _0x9b4a=function(_0xee2aa9,_0x40271b){_0xee2aa9=_0xee2aa9-0x0;var _0x5e7fad=_0xb4a9[_0xee2aa9];return _0x5e7fad;};'use strict';var util=require(_0x9b4a('0x0'));var BPromise=require(_0x9b4a('0x1'));var logger=require('../../../config/logger')('preview');var _=require('lodash');var cmHopper=require(_0x9b4a('0x2'));var cmHopperFinal=require(_0x9b4a('0x3'));var cmHopperHistory=require(_0x9b4a('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x9b4a('0x5'));var agentReportPreview=require(_0x9b4a('0x6'));var voiceQueueReport=require(_0x9b4a('0x7'));function loggerCatch(_0x23db5c){return function(_0x2f7edb){logger[_0x9b4a('0x8')](_0x23db5c,util[_0x9b4a('0x9')](_0x2f7edb,{'showHidden':![],'depth':null}));};}function create(_0x33c244){return BPromise[_0x9b4a('0xa')]()[_0x9b4a('0xb')](cmHopperHistory[_0x9b4a('0xc')](_0x33c244))[_0x9b4a('0xd')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x5f2b0e){return BPromise[_0x9b4a('0xa')]()[_0x9b4a('0xb')](agentReportPreview[_0x9b4a('0xc')](_0x5f2b0e))['catch'](loggerCatch(_0x9b4a('0xe')));}function moveContact(_0x2a5e37){return BPromise[_0x9b4a('0xa')]()[_0x9b4a('0xb')](cmHopper[_0x9b4a('0xf')](_0x2a5e37,!![]))[_0x9b4a('0xd')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x9b4a('0x10')]=function(_0x405617){return BPromise[_0x9b4a('0xa')]()[_0x9b4a('0xb')](cmHopperBlack[_0x9b4a('0x10')](_0x405617))[_0x9b4a('0xd')](loggerCatch(_0x9b4a('0x11')));};exports['getContactPreview']=function(_0x4830b4){return BPromise['resolve']()[_0x9b4a('0xb')](cmHopper[_0x9b4a('0x12')](_0x4830b4))[_0x9b4a('0xd')](loggerCatch(_0x9b4a('0x13')));};exports['createHistory']=function(_0x5972a0,_0x2072f3){create(_0x5972a0)[_0x9b4a('0xd')](loggerCatch(_0x2072f3));moveContact(_0x5972a0)[_0x9b4a('0xd')](loggerCatch(_0x2072f3));};exports['createAgentHistory']=function(_0x280da1,_0x194664){createAgent(_0x280da1)[_0x9b4a('0xd')](loggerCatch(_0x194664));};exports[_0x9b4a('0x14')]=function(_0x14e2f0,_0x52cc40){create(_0x14e2f0)[_0x9b4a('0xd')](loggerCatch(_0x52cc40));};exports[_0x9b4a('0x15')]=function(_0x1dfb8c,_0x514c02){moveContact(_0x1dfb8c)[_0x9b4a('0xd')](loggerCatch(_0x514c02));};exports[_0x9b4a('0x16')]=function(_0x13d72f,_0xe166b1,_0x5b47fa){if(_0xe166b1){_0x13d72f[_0x9b4a('0x17')]=null;}if(_0x5b47fa){_0x13d72f[_0x9b4a('0x18')]=![];}return BPromise[_0x9b4a('0xa')]()['then'](cmHopper[_0x9b4a('0x16')](_0x13d72f))[_0x9b4a('0xd')](loggerCatch(_0x9b4a('0x19')));};exports[_0x9b4a('0x1a')]=function(_0x2356c9){return BPromise[_0x9b4a('0xa')]()[_0x9b4a('0xb')](cmHopper[_0x9b4a('0x1a')](_0x2356c9))[_0x9b4a('0xd')](loggerCatch(_0x9b4a('0x1b')));};exports[_0x9b4a('0x1c')]=function(_0x1539c2){return BPromise[_0x9b4a('0xa')]()[_0x9b4a('0xb')](cmHopper[_0x9b4a('0x1c')]({'UserId':null},_0x1539c2,0x1))[_0x9b4a('0xd')](loggerCatch(_0x9b4a('0x1d')));};exports['disableContact']=function(_0x56a2d4){return BPromise['resolve']()[_0x9b4a('0xb')](cmHopper[_0x9b4a('0x1c')]({'active':![]},_0x56a2d4,0x1))[_0x9b4a('0xd')](loggerCatch(_0x9b4a('0x1e')));};exports[_0x9b4a('0x1f')]=function(_0x587188){var _0x3876c4={};_0x3876c4[_0x9b4a('0x20')]=_0x587188['type'];_0x3876c4[_0x9b4a('0x21')]=_0x587188['uniqueid'];_0x3876c4[_0x9b4a('0x22')]=_0x587188[_0x9b4a('0x22')];_0x3876c4[_0x9b4a('0x23')]=_0x587188[_0x9b4a('0x23')];_0x3876c4[_0x9b4a('0x24')]=_0x587188['queue'];_0x3876c4[_0x9b4a('0x25')]=_0x587188[_0x9b4a('0x26')];_0x3876c4[_0x9b4a('0x27')]=_0x587188['answertime'];_0x3876c4[_0x9b4a('0x28')]=0x1;_0x3876c4['queuecallercompleteAt']=_0x587188[_0x9b4a('0x29')];_0x3876c4[_0x9b4a('0x2a')]=_0x587188[_0x9b4a('0x2b')];_0x3876c4[_0x9b4a('0x2c')]=_0x9b4a('0x2d');_0x3876c4[_0x9b4a('0x2e')]=_0x9b4a('0x2f');_0x3876c4[_0x9b4a('0x30')]=0x0;_0x3876c4[_0x9b4a('0x31')]=0x1;_0x3876c4[_0x9b4a('0x32')]=_0x587188[_0x9b4a('0x2b')];_0x3876c4['queuecallerexitreason']=_0x9b4a('0x33');return BPromise[_0x9b4a('0xa')]()[_0x9b4a('0xb')](voiceQueueReport[_0x9b4a('0x34')](_0x3876c4))[_0x9b4a('0xd')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x10fdb1,_0xad226f){return BPromise[_0x9b4a('0xa')]()[_0x9b4a('0xb')](cmHopper[_0x9b4a('0x35')](_0x10fdb1,_0xad226f))[_0x9b4a('0xd')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x5a3e3e){return BPromise[_0x9b4a('0xa')]()[_0x9b4a('0xb')](cmHopper[_0x9b4a('0x16')](_0x5a3e3e,!![],!![]))[_0x9b4a('0xd')](loggerCatch(_0x9b4a('0x36')));}; \ No newline at end of file +var _0xb96c=['[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','../../../config/logger','lodash','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','then','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','lastAssignedTo','create'];(function(_0x37b973,_0x404a16){var _0x30f30f=function(_0x8f052e){while(--_0x8f052e){_0x37b973['push'](_0x37b973['shift']());}};_0x30f30f(++_0x404a16);}(_0xb96c,0x6f));var _0xcb96=function(_0x1750a9,_0x373841){_0x1750a9=_0x1750a9-0x0;var _0x409942=_0xb96c[_0x1750a9];return _0x409942;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xcb96('0x0'))('preview');var _=require(_0xcb96('0x1'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xcb96('0x2'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xcb96('0x3'));var voiceQueueRt=require(_0xcb96('0x4'));var agentReportPreview=require(_0xcb96('0x5'));var voiceQueueReport=require(_0xcb96('0x6'));function loggerCatch(_0x176e4e){return function(_0x319dd6){logger[_0xcb96('0x7')](_0x176e4e,util['inspect'](_0x319dd6,{'showHidden':![],'depth':null}));};}function create(_0x15fdb6){return BPromise['resolve']()[_0xcb96('0x8')](cmHopperHistory[_0xcb96('0x9')](_0x15fdb6))[_0xcb96('0xa')](loggerCatch(_0xcb96('0xb')));}function createAgent(_0x18cd5f){return BPromise[_0xcb96('0xc')]()[_0xcb96('0x8')](agentReportPreview[_0xcb96('0x9')](_0x18cd5f))[_0xcb96('0xa')](loggerCatch(_0xcb96('0xb')));}function moveContact(_0x36ebcc){return BPromise[_0xcb96('0xc')]()['then'](cmHopper[_0xcb96('0xd')](_0x36ebcc,!![]))[_0xcb96('0xa')](loggerCatch(_0xcb96('0xe')));}exports[_0xcb96('0xf')]=function(_0x3ed667){return BPromise[_0xcb96('0xc')]()['then'](cmHopperBlack[_0xcb96('0xf')](_0x3ed667))[_0xcb96('0xa')](loggerCatch(_0xcb96('0x10')));};exports[_0xcb96('0x11')]=function(_0x3364a9){return BPromise[_0xcb96('0xc')]()[_0xcb96('0x8')](cmHopper['getContactPreview'](_0x3364a9))[_0xcb96('0xa')](loggerCatch(_0xcb96('0x12')));};exports['createHistory']=function(_0x428b24,_0x50a5ec){create(_0x428b24)[_0xcb96('0xa')](loggerCatch(_0x50a5ec));moveContact(_0x428b24)[_0xcb96('0xa')](loggerCatch(_0x50a5ec));};exports[_0xcb96('0x13')]=function(_0x5bdf05,_0x2163c1){createAgent(_0x5bdf05)[_0xcb96('0xa')](loggerCatch(_0x2163c1));};exports[_0xcb96('0x14')]=function(_0x3e2ee3,_0x2ac00d){create(_0x3e2ee3)[_0xcb96('0xa')](loggerCatch(_0x2ac00d));};exports[_0xcb96('0x15')]=function(_0x30b27b,_0x40994d){moveContact(_0x30b27b)['catch'](loggerCatch(_0x40994d));};exports[_0xcb96('0x16')]=function(_0x5e97e0,_0x39978e,_0x1df6da){if(_0x39978e){_0x5e97e0['UserId']=null;}if(_0x1df6da){_0x5e97e0[_0xcb96('0x17')]=![];}return BPromise[_0xcb96('0xc')]()[_0xcb96('0x8')](cmHopper[_0xcb96('0x16')](_0x5e97e0))[_0xcb96('0xa')](loggerCatch(_0xcb96('0x18')));};exports[_0xcb96('0x19')]=function(_0x293cca){return BPromise[_0xcb96('0xc')]()[_0xcb96('0x8')](cmHopper['countReScheduled'](_0x293cca))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0xcb96('0x1a')]=function(_0xb88a1e){return BPromise[_0xcb96('0xc')]()['then'](cmHopper['unlockContact']({'UserId':null},_0xb88a1e,0x1))['catch'](loggerCatch(_0xcb96('0x1b')));};exports[_0xcb96('0x1c')]=function(_0x4f6cf7){return BPromise[_0xcb96('0xc')]()['then'](cmHopper['unlockContact']({'active':![]},_0x4f6cf7,0x1))[_0xcb96('0xa')](loggerCatch(_0xcb96('0x1d')));};exports[_0xcb96('0x1e')]=function(_0x232429){var _0xd4ffe2={};_0xd4ffe2[_0xcb96('0x1f')]=_0x232429[_0xcb96('0x1f')];_0xd4ffe2[_0xcb96('0x20')]=_0x232429[_0xcb96('0x20')];_0xd4ffe2[_0xcb96('0x21')]=_0x232429['calleridnum'];_0xd4ffe2[_0xcb96('0x22')]=_0x232429[_0xcb96('0x22')];_0xd4ffe2[_0xcb96('0x23')]=_0x232429[_0xcb96('0x23')];_0xd4ffe2['queuecallerjoinAt']=_0x232429[_0xcb96('0x24')];_0xd4ffe2['queuecallerleaveAt']=_0x232429['answertime'];_0xd4ffe2['queuecallercomplete']=0x1;_0xd4ffe2[_0xcb96('0x25')]=_0x232429[_0xcb96('0x26')];_0xd4ffe2[_0xcb96('0x27')]=_0x232429[_0xcb96('0x28')];_0xd4ffe2[_0xcb96('0x29')]=_0xcb96('0x2a');_0xd4ffe2[_0xcb96('0x2b')]=_0xcb96('0x2c');_0xd4ffe2[_0xcb96('0x2d')]=0x0;_0xd4ffe2['assigned']=0x1;_0xd4ffe2[_0xcb96('0x2e')]=_0x232429[_0xcb96('0x28')];_0xd4ffe2['queuecallerexitreason']='COMPLETED';return BPromise[_0xcb96('0xc')]()[_0xcb96('0x8')](voiceQueueReport[_0xcb96('0x2f')](_0xd4ffe2))[_0xcb96('0xa')](loggerCatch(_0xcb96('0x30')));};exports[_0xcb96('0x31')]=function(_0x3e7ba9,_0x29104a){return BPromise[_0xcb96('0xc')]()[_0xcb96('0x8')](cmHopper[_0xcb96('0x31')](_0x3e7ba9,_0x29104a))[_0xcb96('0xa')](loggerCatch(_0xcb96('0x32')));};exports[_0xcb96('0x33')]=function(_0x4f0750){return BPromise[_0xcb96('0xc')]()[_0xcb96('0x8')](cmHopper[_0xcb96('0x16')](_0x4f0750,!![],!![]))[_0xcb96('0xa')](loggerCatch(_0xcb96('0x34')));}; \ 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 25721e8..0eea837 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 _0x7fe1=['[updateOriginated]\x20is\x20null\x20or\x20undefined','state','statedesc','Blacklist','starttime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','responsetime','membername','UserId','logCustomer','talktime','answertime','isFailure','RECALL','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','IsNotLoggedIn','queue','voice','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-dialtimeout','xmd-dialoptions','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','util','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','error','inspect','logger','loggerError','logger2','info','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','updatedAt','%s%s','XMD-','toLowerVariables','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative'];(function(_0x2bd1ec,_0x3fe65f){var _0x2f7577=function(_0x5234fb){while(--_0x5234fb){_0x2bd1ec['push'](_0x2bd1ec['shift']());}};_0x2f7577(++_0x3fe65f);}(_0x7fe1,0x1f4));var _0x17fe=function(_0x15a3d3,_0x1fe368){_0x15a3d3=_0x15a3d3-0x0;var _0x1fa778=_0x7fe1[_0x15a3d3];return _0x1fa778;};'use strict';var util=require(_0x17fe('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x17fe('0x1'))(_0x17fe('0x2'));var ipAgi=process[_0x17fe('0x3')][_0x17fe('0x4')]||_0x17fe('0x5');function getSeconds(_0x4fbcaf,_0x96b393){var _0xe560fa=moment(_0x4fbcaf)[_0x17fe('0x6')](0x0);var _0x5dcc1e=moment(_0x96b393)[_0x17fe('0x6')](0x0);return _0xe560fa['diff'](_0x5dcc1e,_0x17fe('0x7'));}exports[_0x17fe('0x8')]=function(_0x6f1527){return function(_0xcff51e){logger[_0x17fe('0x9')](_0x6f1527,util[_0x17fe('0xa')](_0xcff51e,{'showHidden':![],'depth':null}));};};exports[_0x17fe('0xb')]=function(_0x36bb25,_0x60b8ea){logger['info'](_0x36bb25,util[_0x17fe('0xa')](_0x60b8ea,{'showHidden':![],'depth':null}));};exports[_0x17fe('0xc')]=function(_0x7366e8,_0x41c43e){logger[_0x17fe('0x9')](_0x7366e8,util['inspect'](_0x41c43e,{'showHidden':![],'depth':null}));};exports[_0x17fe('0xd')]=function(_0x2a00af){return function(_0x57f314){logger[_0x17fe('0xe')](_0x2a00af,util['inspect'](_0x57f314,{'showHidden':![],'depth':null}));};};exports[_0x17fe('0xf')]=function(_0x37d07b,_0x33ea20,_0x2f5049){return{'message':_0x37d07b,'unlock':_0x33ea20,'active':_0x2f5049};};exports[_0x17fe('0x10')]=function(_0x38f1ef,_0x416aa9,_0x10fa60){if(!_[_0x17fe('0x11')](_0x10fa60)&&_0x17fe('0x12')===typeof _0x10fa60&&!_[_0x17fe('0x13')](_0x10fa60)){if(!_['isUndefined'](_0x416aa9)&&'string'===typeof _0x416aa9&&!_[_0x17fe('0x13')](_0x416aa9)){return util[_0x17fe('0x14')]('\x22%s\x22\x20<%s>',_0x416aa9,_0x10fa60);}return util[_0x17fe('0x14')](_0x17fe('0x15'),_0x10fa60,_0x10fa60);}if(!_['isUndefined'](_0x38f1ef)&&_0x17fe('0x12')===typeof _0x38f1ef&&!_[_0x17fe('0x13')](_0x38f1ef)){return _0x38f1ef;}return _0x17fe('0x16');};exports[_0x17fe('0x17')]=function(_0x5221f2){if(_[_0x17fe('0x18')](_0x5221f2)){return![];}return _0x5221f2;};exports[_0x17fe('0x19')]=function(_0xf3a2a1,_0x3c556e,_0xef7b17,_0x2f33cb,_0x371b41,_0x11628){var _0x183544={'XMD-QUEUE':_0x3c556e[_0x17fe('0x1a')]?_0x3c556e[_0x17fe('0x1a')][_0x17fe('0x1b')]:'','XMD-CALLERID':_0x2f33cb,'XMD-CALLERID-PREVIEW':_0x11628?util[_0x17fe('0x14')]('\x22%s\x22\x20<%s>',_0x11628[_0x17fe('0x1c')],_0x11628[_0x17fe('0x1d')]):_0x2f33cb,'XMD-DIALID':_0x371b41,'XMD-CONTACTID':_0x3c556e[_0x17fe('0x1e')],'XMD-CDRTYPE':_0x17fe('0x1f'),'CALLERID(all)':_0x2f33cb,'XMD-VOICEQUEUEID':_0x3c556e[_0x17fe('0x20')],'XMD-DIALCHANNEL':_0xef7b17,'XMD-DIALTIMEOUT':_0xf3a2a1[_0x17fe('0x21')]||0x1e,'XMD-DIALOPTIONS':util[_0x17fe('0x14')](_0x17fe('0x22'),_0xf3a2a1[_0x17fe('0x23')]?'g':'',_[_0x17fe('0x13')](_0xf3a2a1[_0x17fe('0x24')])?'':_0x17fe('0x25')),'XMD-DIALURL':_0xf3a2a1[_0x17fe('0x26')]||'','XMD-AGI':_0xf3a2a1['dialQueueProject']?util[_0x17fe('0x14')](_0x17fe('0x27'),ipAgi,_0xf3a2a1[_0x17fe('0x28')]):_0x17fe('0x29'),'XMD-AGIAFTER':_0xf3a2a1[_0x17fe('0x23')]?util[_0x17fe('0x14')]('\x22agi://%s/square,%s\x22',ipAgi,_0xf3a2a1[_0x17fe('0x23')]):_0x17fe('0x29'),'XMD-ORIGINATECALLERIDNUM':_0x11628?_0x11628[_0x17fe('0x2a')]:'','XMD-ORIGINATECALLERIDNAME':_0x11628?_0x11628[_0x17fe('0x2b')]:'','XMD-DESTINATION':_0x17fe('0x2c')};if(!_[_0x17fe('0x13')](_0xf3a2a1['monitor_format'])){_0x183544[util[_0x17fe('0x14')]('%s',_0x17fe('0x2d'))]=_0xf3a2a1[_0x17fe('0x24')];_0x183544[util[_0x17fe('0x14')]('%s',_0x17fe('0x2e'))]=_0x371b41;}if(_0x3c556e&&_0x3c556e[_0x17fe('0x2f')]){for(var _0xfe99ec in _0x3c556e[_0x17fe('0x2f')]){if(_0x3c556e[_0x17fe('0x2f')][_0x17fe('0x30')](_0xfe99ec)){if(!_['isNil'](_0x3c556e[_0x17fe('0x2f')][_0xfe99ec])&&_0xfe99ec!=='id'&&_0xfe99ec!=='tags'&&_0xfe99ec!=='createdAt'&&_0xfe99ec!==_0x17fe('0x31')){_0x183544[util[_0x17fe('0x14')](_0x17fe('0x32'),_0x17fe('0x33'),_['toUpper'](_0xfe99ec))]=_0x3c556e[_0x17fe('0x2f')][_0xfe99ec];}}}}return _0x183544;};exports[_0x17fe('0x34')]=function(_0x3c74f7){var _0x19a062={};for(var _0x149097 in _0x3c74f7){if(_0x3c74f7[_0x17fe('0x30')](_0x149097)){_0x19a062[util[_0x17fe('0x14')]('%s',_['toLower'](_0x149097))]=_0x3c74f7[_0x149097];}}return{'variables':_0x19a062};};exports[_0x17fe('0x35')]=function(_0x53605d,_0x3cc2e1){if(!_[_0x17fe('0x18')](_0x53605d)){if(_0x53605d[_0x17fe('0x30')]('originated')){if(_0x53605d[_0x17fe('0x36')]>0x0){_0x53605d[_0x17fe('0x36')]-=0x1;}else{logger[_0x17fe('0x9')](_0x17fe('0x37'),_0x3cc2e1);}}}else{logger[_0x17fe('0x9')](_0x17fe('0x38'),_0x3cc2e1);}};exports['logBlacklist']=function(_0x25cd19){var _0x1c93a0=moment()[_0x17fe('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x25cd19[_0x17fe('0x39')]=0xd;_0x25cd19[_0x17fe('0x3a')]=_0x17fe('0x3b');_0x25cd19[_0x17fe('0x3c')]=_0x1c93a0;_0x25cd19['responsetime']=_0x1c93a0;_0x25cd19[_0x17fe('0x3d')]=_0x1c93a0;};exports[_0x17fe('0x3e')]=function(_0x2c57a4,_0x9d6372,_0x45a45c){var _0x45bbac=moment()[_0x17fe('0x14')](_0x17fe('0x3f'));_0x2c57a4['state']=_0x9d6372;_0x2c57a4['statedesc']=_0x45a45c;_0x2c57a4['responsetime']=_0x45bbac;_0x2c57a4['ringtime']=getSeconds(_0x2c57a4[_0x17fe('0x40')],_0x2c57a4[_0x17fe('0x3c')]);};exports['logLookAgent']=function(_0x515530,_0x55b30a,_0x2f229a){_0x515530[_0x17fe('0x41')]=_0x55b30a;_0x515530[_0x17fe('0x42')]=_0x2f229a;};exports[_0x17fe('0x43')]=function(_0xc52eb5,_0x4c6099,_0x3499fd){var _0x4fa9d4=moment()[_0x17fe('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0xc52eb5[_0x17fe('0x39')]=_0x4c6099;_0xc52eb5[_0x17fe('0x3a')]=_0x3499fd;_0xc52eb5[_0x17fe('0x40')]=_0xc52eb5[_0x17fe('0x40')]?_0xc52eb5[_0x17fe('0x40')]:_0x4fa9d4;_0xc52eb5[_0x17fe('0x3d')]=_0xc52eb5[_0x17fe('0x3d')]?_0xc52eb5[_0x17fe('0x3d')]:_0x4fa9d4;_0xc52eb5['ringtime']=getSeconds(_0xc52eb5[_0x17fe('0x40')]||0x0,_0xc52eb5['starttime']||0x0);_0xc52eb5[_0x17fe('0x44')]=_0xc52eb5[_0x17fe('0x45')]?getSeconds(_0xc52eb5[_0x17fe('0x3d')],_0xc52eb5[_0x17fe('0x45')]):0x0;};exports[_0x17fe('0x46')]=function(_0x4cd8bf){return _0x4cd8bf==='Failure';};exports['variablesAction']=function(_0x1316ef,_0x42858f,_0x4812d9,_0x553d06,_0x5c25fb){var _0x48291b=_0x553d06?_0x17fe('0x47'):_0x1316ef[_0x17fe('0x1c')];_0x48291b=_0x5c25fb?'BOOKED':_0x48291b;return{'actionid':_0x1316ef[_0x17fe('0x48')],'action':_0x17fe('0x49'),'channel':_0x1316ef[_0x17fe('0x4a')],'callerid':util[_0x17fe('0x14')](_0x17fe('0x15'),_0x48291b,_0x1316ef[_0x17fe('0x1d')]),'Exten':_0x17fe('0x2c'),'Context':_0x17fe('0x4b'),'Priority':'1','variable':_0x4812d9,'timeout':(_0x42858f[_0x17fe('0x4c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1316ef['uniqueid']};};exports[_0x17fe('0x4d')]=function(_0x1c9042){return _0x1c9042[_0x17fe('0x4e')]+_0x1c9042[_0x17fe('0x4f')]+_0x1c9042['countnoanswerretry']+_0x1c9042[_0x17fe('0x50')]+_0x1c9042[_0x17fe('0x51')];};exports[_0x17fe('0x52')]=function(_0x414006){var _0x3633bc=_[_0x17fe('0x53')](_0x414006);_0x3633bc['state']=0xf;_0x3633bc['statedesc']=_0x17fe('0x54');return _0x3633bc;};exports[_0x17fe('0x55')]=function(_0x703d39,_0x568a5d,_0x31401e){var _0x5be6e0={};_0x5be6e0[_0x568a5d]=_0x703d39[_0x568a5d];_0x5be6e0[_0x17fe('0x56')]=![];_0x5be6e0[_0x17fe('0x57')]=moment()[_0x17fe('0x58')](_0x31401e,'minutes')['format'](_0x17fe('0x3f'));_0x5be6e0['ContactId']=_0x703d39[_0x17fe('0x1e')];_0x5be6e0['ListId']=_0x703d39[_0x17fe('0x59')];_0x5be6e0[_0x17fe('0x20')]=_0x703d39[_0x17fe('0x20')]||undefined;return _0x5be6e0;};exports[_0x17fe('0x5a')]=function(_0xf04025,_0x462dc6){if(!_[_0x17fe('0x18')](_0xf04025)){if(_0xf04025[_0x17fe('0x5b')]>0x0){_0xf04025[_0x17fe('0x5b')]-=0x1;}else{logger[_0x17fe('0x9')](_0x462dc6,_0x17fe('0x5c'));}}else{logger[_0x17fe('0x9')](_0x462dc6,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x17fe('0x5d')]=function(_0x119823){if(_0x119823<=0x0){return!![];}return![];};exports['buildObj']=function(_0x29eea9,_0x197b1f,_0x5da213){_0x29eea9['lastevent']=_0x197b1f;_0x29eea9[_0x17fe('0x1b')]=_0x29eea9[_0x17fe('0x5e')];_0x29eea9['interface']=_0x29eea9[_0x17fe('0x4a')];_0x29eea9['motionChannel']=_0x17fe('0x5f');if(_0x5da213){_0x29eea9[_0x17fe('0x60')]=_0x5da213[_0x17fe('0x60')];}return _0x29eea9;};exports[_0x17fe('0x61')]=function(_0x3fb18a){var _0x1b657e={};_0x1b657e['queue']=_0x3fb18a[_0x17fe('0x5e')];_0x1b657e[_0x17fe('0x62')]=_0x3fb18a[_0x17fe('0x4a')];_0x1b657e[_0x17fe('0x48')]=_0x3fb18a[_0x17fe('0x48')];return _0x1b657e;};exports[_0x17fe('0x63')]=function(_0x18c0d2){var _0xf6f5e4=[];for(var _0xf6bca5 in _0x18c0d2){if(_0x18c0d2[_0x17fe('0x30')](_0xf6bca5)){if(!_[_0x17fe('0x18')](_0x18c0d2[_0xf6bca5])&&_0x18c0d2[_0xf6bca5]['state']===_0x17fe('0x64')&&_0x18c0d2[_0xf6bca5][_0x17fe('0x65')]===_0x17fe('0x66')){_0xf6f5e4[_0x17fe('0x67')](_0x18c0d2[_0xf6bca5]['id']);}}}return _0xf6f5e4;};exports[_0x17fe('0x68')]=function(_0x5674ab){var _0x5d6c3a=moment()[_0x17fe('0x6')](0x0);var _0xbf8920=moment(_0x5674ab)[_0x17fe('0x6')](0x0);return _0x5d6c3a['diff'](_0xbf8920,_0x17fe('0x7'));};exports['createBody']=function(_0x52791c){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x52791c[_0x17fe('0x1e')],'ListId':_0x52791c[_0x17fe('0x59')],'VoiceQueueId':_0x52791c['VoiceQueueId']||undefined,'CampaignId':_0x52791c[_0x17fe('0x69')]||undefined};};exports[_0x17fe('0x6a')]=function(_0x2f830e){if(_0x2f830e===_0x17fe('0x48')||_0x2f830e===_0x17fe('0x6b')||_0x2f830e===_0x17fe('0x5e')||_0x2f830e===_0x17fe('0x6c')||_0x2f830e===_0x17fe('0x6d')||_0x2f830e===_0x17fe('0x6e')||_0x2f830e==='membername'||_0x2f830e===_0x17fe('0x4a')||_0x2f830e===_0x17fe('0x1c')||_0x2f830e==='active'||_0x2f830e===_0x17fe('0x1d')||_0x2f830e===_0x17fe('0x57')||_0x2f830e===_0x17fe('0x4e')||_0x2f830e===_0x17fe('0x4f')||_0x2f830e===_0x17fe('0x6f')||_0x2f830e===_0x17fe('0x70')||_0x2f830e===_0x17fe('0x71')||_0x2f830e===_0x17fe('0x72')||_0x2f830e===_0x17fe('0x73')||_0x2f830e===_0x17fe('0x74')||_0x2f830e===_0x17fe('0x1e')||_0x2f830e===_0x17fe('0x59')||_0x2f830e==='UserId'||_0x2f830e===_0x17fe('0x20')||_0x2f830e===_0x17fe('0x75')||_0x2f830e==='xmd-voicequeueid'||_0x2f830e==='xmd-queue'||_0x2f830e==='xmd-phone'||_0x2f830e==='xmd-listid'||_0x2f830e==='xmd-dialurl'||_0x2f830e===_0x17fe('0x76')||_0x2f830e===_0x17fe('0x77')||_0x2f830e==='xmd-dialid'||_0x2f830e==='xmd-dialchannel'||_0x2f830e===_0x17fe('0x78')||_0x2f830e===_0x17fe('0x79')||_0x2f830e===_0x17fe('0x7a')||_0x2f830e===_0x17fe('0x7b')||_0x2f830e==='xmd-agi'||_0x2f830e===_0x17fe('0x7c')||_0x2f830e==='rtpaudioqosbridged'||_0x2f830e===_0x17fe('0x7d')||_0x2f830e===_0x17fe('0x7e')||_0x2f830e===_0x17fe('0x7f')||_0x2f830e===_0x17fe('0x80')||_0x2f830e===_0x17fe('0x81')||_0x2f830e==='rtpaudioqosrttbridged'||_0x2f830e==='rtpaudioqos'||_0x2f830e===_0x17fe('0x82')||_0x2f830e===_0x17fe('0x7d')||_0x2f830e===_0x17fe('0x7e')||_0x2f830e===_0x17fe('0x7f')||_0x2f830e==='rtpaudioqoslossbridged'||_0x2f830e===_0x17fe('0x81')||_0x2f830e==='rtpaudioqosrttbridged'||_0x2f830e==='bridgepeer'||_0x2f830e===_0x17fe('0x83')||_0x2f830e===_0x17fe('0x39')||_0x2f830e==='statedesc'){return![];}return!![];};exports[_0x17fe('0x84')]=function(_0x15a886,_0x389f44){var _0x3fe181,_0x1fb0f4,_0x3de9a2;if(_0x389f44<=0x0){_0x389f44=0x1;}_0x3fe181=new RegExp(_0x17fe('0x85')+_0x389f44+'}$');_0x1fb0f4=Math[_0x17fe('0x86')](0xa,_0x389f44-0x1);_0x3de9a2=Math[_0x17fe('0x86')](0xa,_0x389f44)-0x1;return util['format']('%s',_['replace'](_0x15a886,_0x3fe181,_[_0x17fe('0x87')](_0x1fb0f4,_0x3de9a2)));};exports[_0x17fe('0x88')]=function(_0x1bac38){var _0x17737b=_0x1bac38[_0x17fe('0x89')](/"(.*?)"/);return _0x17737b?_0x17737b[0x1]:_0x1bac38;};exports[_0x17fe('0x8a')]=function(_0x4797f9){var _0x4a51ea=_0x4797f9[_0x17fe('0x89')](/<(.*?)>/);return _0x4a51ea?_0x4a51ea[0x1]:_0x4797f9;}; \ No newline at end of file +var _0x726f=['queue','motionChannel','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','CampaignId','filterKey','idContact','campaigntype','calleridname','countnoanswerretry','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','bridgepvtcallid','pow','replace','random','extractCalleridName','extractCalleridNumber','match','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','seconds','inspect','logger','info','logger2','getCallerId','string','isUndefined','format','\x22%s\x22\x20<%s>','isEmpty','isActive','isNil','addVariables','Queue','calleridnum','ContactId','dialer','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','updatedAt','%s%s','toUpper','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','error','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logAgent','ringtime','membername','logCustomer','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x726f,0x14a));var _0xf726=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x726f[_0x19950b];return _0x3c6b41;};'use strict';var util=require(_0xf726('0x0'));var _=require(_0xf726('0x1'));var moment=require(_0xf726('0x2'));var logger=require(_0xf726('0x3'))(_0xf726('0x4'));var ipAgi=process[_0xf726('0x5')][_0xf726('0x6')]||_0xf726('0x7');function getSeconds(_0x20785b,_0x2dd0e4){var _0x322e32=moment(_0x20785b)[_0xf726('0x8')](0x0);var _0x303080=moment(_0x2dd0e4)[_0xf726('0x8')](0x0);return _0x322e32[_0xf726('0x9')](_0x303080,_0xf726('0xa'));}exports['loggerCatch']=function(_0x4677c2){return function(_0x5f1645){logger['error'](_0x4677c2,util[_0xf726('0xb')](_0x5f1645,{'showHidden':![],'depth':null}));};};exports[_0xf726('0xc')]=function(_0x3034d8,_0x4bc24d){logger[_0xf726('0xd')](_0x3034d8,util[_0xf726('0xb')](_0x4bc24d,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x12bfa5,_0x3b2282){logger['error'](_0x12bfa5,util[_0xf726('0xb')](_0x3b2282,{'showHidden':![],'depth':null}));};exports[_0xf726('0xe')]=function(_0x28ba95){return function(_0xc97c42){logger[_0xf726('0xd')](_0x28ba95,util['inspect'](_0xc97c42,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x28b455,_0x101508,_0x263d66){return{'message':_0x28b455,'unlock':_0x101508,'active':_0x263d66};};exports[_0xf726('0xf')]=function(_0x496ec7,_0x10e74c,_0x2ffa8b){if(!_['isUndefined'](_0x2ffa8b)&&_0xf726('0x10')===typeof _0x2ffa8b&&!_['isEmpty'](_0x2ffa8b)){if(!_[_0xf726('0x11')](_0x10e74c)&&_0xf726('0x10')===typeof _0x10e74c&&!_['isEmpty'](_0x10e74c)){return util[_0xf726('0x12')](_0xf726('0x13'),_0x10e74c,_0x2ffa8b);}return util['format'](_0xf726('0x13'),_0x2ffa8b,_0x2ffa8b);}if(!_[_0xf726('0x11')](_0x496ec7)&&_0xf726('0x10')===typeof _0x496ec7&&!_[_0xf726('0x14')](_0x496ec7)){return _0x496ec7;}return'\x22\x22\x20<>';};exports[_0xf726('0x15')]=function(_0x45b5bc){if(_[_0xf726('0x16')](_0x45b5bc)){return![];}return _0x45b5bc;};exports[_0xf726('0x17')]=function(_0x5bf2d1,_0x4732ef,_0x1c76cd,_0x5a815,_0x536ed7,_0x4581d6){var _0x23533a={'XMD-QUEUE':_0x4732ef[_0xf726('0x18')]?_0x4732ef['Queue']['name']:'','XMD-CALLERID':_0x5a815,'XMD-CALLERID-PREVIEW':_0x4581d6?util['format'](_0xf726('0x13'),_0x4581d6['calleridname'],_0x4581d6[_0xf726('0x19')]):_0x5a815,'XMD-DIALID':_0x536ed7,'XMD-CONTACTID':_0x4732ef[_0xf726('0x1a')],'XMD-CDRTYPE':_0xf726('0x1b'),'CALLERID(all)':_0x5a815,'XMD-VOICEQUEUEID':_0x4732ef['VoiceQueueId'],'XMD-DIALCHANNEL':_0x1c76cd,'XMD-DIALTIMEOUT':_0x5bf2d1['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xf726('0x12')]('\x22rtTxX%s%s\x22',_0x5bf2d1[_0xf726('0x1c')]?'g':'',_['isEmpty'](_0x5bf2d1['monitor_format'])?'':_0xf726('0x1d')),'XMD-DIALURL':_0x5bf2d1[_0xf726('0x1e')]||'','XMD-AGI':_0x5bf2d1[_0xf726('0x1f')]?util['format'](_0xf726('0x20'),ipAgi,_0x5bf2d1[_0xf726('0x1f')]):_0xf726('0x21'),'XMD-AGIAFTER':_0x5bf2d1[_0xf726('0x1c')]?util['format'](_0xf726('0x20'),ipAgi,_0x5bf2d1['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x4581d6?_0x4581d6['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x4581d6?_0x4581d6[_0xf726('0x22')]:'','XMD-DESTINATION':_0xf726('0x23')};if(!_[_0xf726('0x14')](_0x5bf2d1[_0xf726('0x24')])){_0x23533a[util[_0xf726('0x12')]('%s',_0xf726('0x25'))]=_0x5bf2d1['monitor_format'];_0x23533a[util[_0xf726('0x12')]('%s',_0xf726('0x26'))]=_0x536ed7;}if(_0x4732ef&&_0x4732ef[_0xf726('0x27')]){for(var _0x2f1ead in _0x4732ef[_0xf726('0x27')]){if(_0x4732ef['Contact']['hasOwnProperty'](_0x2f1ead)){if(!_[_0xf726('0x16')](_0x4732ef['Contact'][_0x2f1ead])&&_0x2f1ead!=='id'&&_0x2f1ead!==_0xf726('0x28')&&_0x2f1ead!==_0xf726('0x29')&&_0x2f1ead!==_0xf726('0x2a')){_0x23533a[util[_0xf726('0x12')](_0xf726('0x2b'),'XMD-',_[_0xf726('0x2c')](_0x2f1ead))]=_0x4732ef[_0xf726('0x27')][_0x2f1ead];}}}}return _0x23533a;};exports[_0xf726('0x2d')]=function(_0x2cdf0b){var _0x3cf73d={};for(var _0x5d6c1c in _0x2cdf0b){if(_0x2cdf0b[_0xf726('0x2e')](_0x5d6c1c)){_0x3cf73d[util[_0xf726('0x12')]('%s',_[_0xf726('0x2f')](_0x5d6c1c))]=_0x2cdf0b[_0x5d6c1c];}}return{'variables':_0x3cf73d};};exports[_0xf726('0x30')]=function(_0x5afdb0,_0x5a69a3){if(!_['isNil'](_0x5afdb0)){if(_0x5afdb0['hasOwnProperty']('originated')){if(_0x5afdb0[_0xf726('0x31')]>0x0){_0x5afdb0['originated']-=0x1;}else{logger[_0xf726('0x32')](_0xf726('0x33'),_0x5a69a3);}}}else{logger[_0xf726('0x32')](_0xf726('0x34'),_0x5a69a3);}};exports['logBlacklist']=function(_0x34c67e){var _0x4a90e0=moment()[_0xf726('0x12')](_0xf726('0x35'));_0x34c67e[_0xf726('0x36')]=0xd;_0x34c67e[_0xf726('0x37')]=_0xf726('0x38');_0x34c67e[_0xf726('0x39')]=_0x4a90e0;_0x34c67e[_0xf726('0x3a')]=_0x4a90e0;_0x34c67e[_0xf726('0x3b')]=_0x4a90e0;};exports[_0xf726('0x3c')]=function(_0x3be272,_0x2def81,_0x1079bb){var _0x46e5e1=moment()[_0xf726('0x12')](_0xf726('0x35'));_0x3be272['state']=_0x2def81;_0x3be272[_0xf726('0x37')]=_0x1079bb;_0x3be272['responsetime']=_0x46e5e1;_0x3be272[_0xf726('0x3d')]=getSeconds(_0x3be272[_0xf726('0x3a')],_0x3be272[_0xf726('0x39')]);};exports['logLookAgent']=function(_0x10b5cc,_0x3b9272,_0x3aa76d){_0x10b5cc[_0xf726('0x3e')]=_0x3b9272;_0x10b5cc['UserId']=_0x3aa76d;};exports[_0xf726('0x3f')]=function(_0x2f635a,_0x35b6fe,_0x3f054c){var _0x3af700=moment()[_0xf726('0x12')](_0xf726('0x35'));_0x2f635a[_0xf726('0x36')]=_0x35b6fe;_0x2f635a['statedesc']=_0x3f054c;_0x2f635a[_0xf726('0x3a')]=_0x2f635a[_0xf726('0x3a')]?_0x2f635a[_0xf726('0x3a')]:_0x3af700;_0x2f635a[_0xf726('0x3b')]=_0x2f635a[_0xf726('0x3b')]?_0x2f635a[_0xf726('0x3b')]:_0x3af700;_0x2f635a['ringtime']=getSeconds(_0x2f635a[_0xf726('0x3a')]||0x0,_0x2f635a[_0xf726('0x39')]||0x0);_0x2f635a['talktime']=_0x2f635a['answertime']?getSeconds(_0x2f635a[_0xf726('0x3b')],_0x2f635a[_0xf726('0x40')]):0x0;};exports[_0xf726('0x41')]=function(_0x1e530d){return _0x1e530d===_0xf726('0x42');};exports[_0xf726('0x43')]=function(_0x3fead0,_0x2d72db,_0x3ec661,_0x5d5c07,_0xf2de6d){var _0xb727db=_0x5d5c07?_0xf726('0x44'):_0x3fead0['calleridname'];_0xb727db=_0xf2de6d?_0xf726('0x45'):_0xb727db;return{'actionid':_0x3fead0[_0xf726('0x46')],'action':_0xf726('0x47'),'channel':_0x3fead0[_0xf726('0x48')],'callerid':util[_0xf726('0x12')](_0xf726('0x13'),_0xb727db,_0x3fead0['calleridnum']),'Exten':_0xf726('0x23'),'Context':_0xf726('0x49'),'Priority':'1','variable':_0x3ec661,'timeout':(_0x2d72db[_0xf726('0x4a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3fead0['uniqueid']};};exports[_0xf726('0x4b')]=function(_0x4c6658){return _0x4c6658[_0xf726('0x4c')]+_0x4c6658[_0xf726('0x4d')]+_0x4c6658['countnoanswerretry']+_0x4c6658[_0xf726('0x4e')]+_0x4c6658[_0xf726('0x4f')];};exports['cloneAction']=function(_0x2b9bd5){var _0x58d773=_[_0xf726('0x50')](_0x2b9bd5);_0x58d773[_0xf726('0x36')]=0xf;_0x58d773['statedesc']=_0xf726('0x51');return _0x58d773;};exports[_0xf726('0x52')]=function(_0x3001f8,_0xb6e068,_0x231cc7){var _0x508b92={};_0x508b92[_0xb6e068]=_0x3001f8[_0xb6e068];_0x508b92[_0xf726('0x53')]=![];_0x508b92[_0xf726('0x54')]=moment()['add'](_0x231cc7,_0xf726('0x55'))['format'](_0xf726('0x35'));_0x508b92[_0xf726('0x1a')]=_0x3001f8[_0xf726('0x1a')];_0x508b92[_0xf726('0x56')]=_0x3001f8[_0xf726('0x56')];_0x508b92[_0xf726('0x57')]=_0x3001f8[_0xf726('0x57')]||undefined;return _0x508b92;};exports[_0xf726('0x58')]=function(_0x13f264,_0x57e245){if(!_[_0xf726('0x16')](_0x13f264)){if(_0x13f264[_0xf726('0x59')]>0x0){_0x13f264[_0xf726('0x59')]-=0x1;}else{logger['error'](_0x57e245,_0xf726('0x5a'));}}else{logger['error'](_0x57e245,_0xf726('0x5b'));}};exports[_0xf726('0x5c')]=function(_0x8212eb){if(_0x8212eb<=0x0){return!![];}return![];};exports[_0xf726('0x5d')]=function(_0x462e59,_0x5887ec,_0x3332ee){_0x462e59[_0xf726('0x5e')]=_0x5887ec;_0x462e59[_0xf726('0x5f')]=_0x462e59[_0xf726('0x60')];_0x462e59['interface']=_0x462e59['channelAgent'];_0x462e59[_0xf726('0x61')]='voice';if(_0x3332ee){_0x462e59[_0xf726('0x62')]=_0x3332ee[_0xf726('0x62')];}return _0x462e59;};exports[_0xf726('0x63')]=function(_0x51a029){var _0x3ff5b7={};_0x3ff5b7[_0xf726('0x60')]=_0x51a029[_0xf726('0x60')];_0x3ff5b7[_0xf726('0x64')]=_0x51a029['channelAgent'];_0x3ff5b7[_0xf726('0x46')]=_0x51a029['uniqueid'];return _0x3ff5b7;};exports[_0xf726('0x65')]=function(_0x23535a){var _0x5b8740=[];for(var _0x1c3895 in _0x23535a){if(_0x23535a['hasOwnProperty'](_0x1c3895)){if(!_['isNil'](_0x23535a[_0x1c3895])&&_0x23535a[_0x1c3895][_0xf726('0x36')]===_0xf726('0x66')&&_0x23535a[_0x1c3895][_0xf726('0x67')]===_0xf726('0x68')){_0x5b8740[_0xf726('0x69')](_0x23535a[_0x1c3895]['id']);}}}return _0x5b8740;};exports[_0xf726('0x6a')]=function(_0x33eeef){var _0x23a4e8=moment()[_0xf726('0x8')](0x0);var _0x5475f1=moment(_0x33eeef)[_0xf726('0x8')](0x0);return _0x23a4e8[_0xf726('0x9')](_0x5475f1,_0xf726('0xa'));};exports['createBody']=function(_0xc94b8e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xc94b8e['ContactId'],'ListId':_0xc94b8e[_0xf726('0x56')],'VoiceQueueId':_0xc94b8e[_0xf726('0x57')]||undefined,'CampaignId':_0xc94b8e[_0xf726('0x6b')]||undefined};};exports[_0xf726('0x6c')]=function(_0xe636d1){if(_0xe636d1===_0xf726('0x46')||_0xe636d1===_0xf726('0x6d')||_0xe636d1===_0xf726('0x60')||_0xe636d1==='type'||_0xe636d1===_0xf726('0x6e')||_0xe636d1==='dialAnswer'||_0xe636d1==='membername'||_0xe636d1===_0xf726('0x48')||_0xe636d1===_0xf726('0x6f')||_0xe636d1===_0xf726('0x53')||_0xe636d1===_0xf726('0x19')||_0xe636d1===_0xf726('0x54')||_0xe636d1===_0xf726('0x4c')||_0xe636d1===_0xf726('0x4d')||_0xe636d1===_0xf726('0x70')||_0xe636d1===_0xf726('0x71')||_0xe636d1===_0xf726('0x72')||_0xe636d1===_0xf726('0x73')||_0xe636d1===_0xf726('0x74')||_0xe636d1===_0xf726('0x75')||_0xe636d1===_0xf726('0x1a')||_0xe636d1==='ListId'||_0xe636d1===_0xf726('0x76')||_0xe636d1===_0xf726('0x57')||_0xe636d1===_0xf726('0x77')||_0xe636d1==='xmd-voicequeueid'||_0xe636d1==='xmd-queue'||_0xe636d1===_0xf726('0x78')||_0xe636d1==='xmd-listid'||_0xe636d1===_0xf726('0x79')||_0xe636d1===_0xf726('0x7a')||_0xe636d1==='xmd-dialoptions'||_0xe636d1===_0xf726('0x7b')||_0xe636d1===_0xf726('0x7c')||_0xe636d1===_0xf726('0x7d')||_0xe636d1===_0xf726('0x7e')||_0xe636d1==='xmd-callerid'||_0xe636d1===_0xf726('0x7f')||_0xe636d1==='xmd-agi'||_0xe636d1==='rtpaudioqos'||_0xe636d1==='rtpaudioqosbridged'||_0xe636d1===_0xf726('0x80')||_0xe636d1===_0xf726('0x81')||_0xe636d1===_0xf726('0x82')||_0xe636d1===_0xf726('0x83')||_0xe636d1===_0xf726('0x84')||_0xe636d1===_0xf726('0x85')||_0xe636d1==='rtpaudioqos'||_0xe636d1===_0xf726('0x86')||_0xe636d1===_0xf726('0x80')||_0xe636d1==='rtpaudioqosjitterbridged'||_0xe636d1===_0xf726('0x82')||_0xe636d1==='rtpaudioqoslossbridged'||_0xe636d1===_0xf726('0x84')||_0xe636d1==='rtpaudioqosrttbridged'||_0xe636d1==='bridgepeer'||_0xe636d1===_0xf726('0x87')||_0xe636d1===_0xf726('0x36')||_0xe636d1===_0xf726('0x37')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x4c01fa,_0x209f2c){var _0x28e8c9,_0x37a31f,_0x328067;if(_0x209f2c<=0x0){_0x209f2c=0x1;}_0x28e8c9=new RegExp('\x5cw{0,'+_0x209f2c+'}$');_0x37a31f=Math[_0xf726('0x88')](0xa,_0x209f2c-0x1);_0x328067=Math[_0xf726('0x88')](0xa,_0x209f2c)-0x1;return util[_0xf726('0x12')]('%s',_[_0xf726('0x89')](_0x4c01fa,_0x28e8c9,_[_0xf726('0x8a')](_0x37a31f,_0x328067)));};exports[_0xf726('0x8b')]=function(_0x1f372b){var _0x1470ed=_0x1f372b['match'](/"(.*?)"/);return _0x1470ed?_0x1470ed[0x1]:_0x1f372b;};exports[_0xf726('0x8c')]=function(_0x561f00){var _0x5a8736=_0x561f00[_0xf726('0x8d')](/<(.*?)>/);return _0x5a8736?_0x5a8736[0x1]:_0x561f00;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index d1043bd..b123f09 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 _0xae90=['number','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xae90,0x1c0));var _0x0ae9=function(_0x3ec761,_0x37adc1){_0x3ec761=_0x3ec761-0x0;var _0x27123b=_0xae90[_0x3ec761];return _0x27123b;};'use strict';exports[_0x0ae9('0x0')]={'queue':{'type':_0x0ae9('0x1'),'required':!![]},'interface':{'type':_0x0ae9('0x1'),'required':!![]},'membername':{'type':_0x0ae9('0x1'),'required':!![]},'penalty':{'type':_0x0ae9('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x0ae9('0x3')]={'queue':{'type':_0x0ae9('0x1'),'required':!![]},'interface':{'type':_0x0ae9('0x1'),'required':!![]}};exports[_0x0ae9('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports[_0x0ae9('0x5')]={'module':{'type':_0x0ae9('0x1'),'required':![]}};exports[_0x0ae9('0x6')]={'uniqueid':{'type':_0x0ae9('0x1'),'required':!![]}};exports[_0x0ae9('0x7')]={'uniqueid':{'type':_0x0ae9('0x1'),'required':!![]},'filename':{'type':_0x0ae9('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x0ae9('0x1')}};exports[_0x0ae9('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x0ae9('0x9')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x0ae9('0x1')}}; \ No newline at end of file +var _0xbb5f=['boolean','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string','number','queueremove'];(function(_0x397df0,_0x3b05ec){var _0x11491e=function(_0x553e39){while(--_0x553e39){_0x397df0['push'](_0x397df0['shift']());}};_0x11491e(++_0x3b05ec);}(_0xbb5f,0xc2));var _0xfbb5=function(_0x2a7d83,_0x1e7243){_0x2a7d83=_0x2a7d83-0x0;var _0x2f92fa=_0xbb5f[_0x2a7d83];return _0x2f92fa;};'use strict';exports[_0xfbb5('0x0')]={'queue':{'type':_0xfbb5('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xfbb5('0x1'),'required':!![]},'penalty':{'type':_0xfbb5('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xfbb5('0x3')]={'queue':{'type':_0xfbb5('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xfbb5('0x1'),'required':!![]},'paused':{'type':_0xfbb5('0x4')},'reason':{'type':'string','required':![]}};exports[_0xfbb5('0x5')]={'module':{'type':_0xfbb5('0x1'),'required':![]}};exports[_0xfbb5('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xfbb5('0x7')]={'uniqueid':{'type':_0xfbb5('0x1'),'required':!![]},'filename':{'type':_0xfbb5('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xfbb5('0x1')}};exports[_0xfbb5('0x8')]={'uniqueid':{'type':_0xfbb5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':'string','required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xfbb5('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index ce044a7..276a49a 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 _0xb72c=['queuecallerexitAt','diff','queuecallerjoinAt','queuecallercomplete','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','bluebird','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','vtigerAccounts','freshsalesAccounts','faxAccounts','hasOwnProperty','mapKeys','format','isNil','interface','SIP/%s','name','total','answered','sumHoldTime','sumDuration','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','length','mergeFromDatabase','initTelephones','isUndefined','initTrunks','initVoiceQueues','initTriggers','triggers','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','seconds','queuecallercompleteAt'];(function(_0x4a037c,_0x2839e2){var _0x9c5ada=function(_0x219a93){while(--_0x219a93){_0x4a037c['push'](_0x4a037c['shift']());}};_0x9c5ada(++_0x2839e2);}(_0xb72c,0x145));var _0xcb72=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb72c[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xcb72('0x0'));var util=require('util');var _=require('lodash');var moment=require('moment');var Agent=require(_0xcb72('0x1'));var Telephone=require(_0xcb72('0x2'));var Trunk=require(_0xcb72('0x3'));var VoiceQueue=require(_0xcb72('0x4'));var Trigger=require('../model/trigger');var Template=require(_0xcb72('0x5'));var Campaign=require(_0xcb72('0x6'));var VoiceExtension=require(_0xcb72('0x7'));var ZendeskAccount=require(_0xcb72('0x8'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xcb72('0x9'));var ZohoAccount=require(_0xcb72('0xa'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xcb72('0xb'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0xcb72('0xc'));var FreshsalesAccount=require(_0xcb72('0xd'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xcb72('0xe')]={};this[_0xcb72('0xf')]={};this[_0xcb72('0x10')]={};this[_0xcb72('0x11')]={};this['triggers']={};this[_0xcb72('0x12')]={};this[_0xcb72('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xcb72('0x14')]={};this[_0xcb72('0x15')]={};this['queueChannels']={};this[_0xcb72('0x16')]={};this[_0xcb72('0x17')]={};this[_0xcb72('0x18')]={};this[_0xcb72('0x19')]={};this[_0xcb72('0x1a')]={};this[_0xcb72('0x1b')]={};this[_0xcb72('0x1c')]={};this[_0xcb72('0x1d')]={};this['deskAccounts']={};this[_0xcb72('0x1e')]={};this['servicenowAccounts']={};this['dynamics365Accounts']={};this[_0xcb72('0x1f')]={};this[_0xcb72('0x20')]={};};function freeIsNotKey(_0x1e1dd8,_0x62772d,_0x1c5218){var _0x275b71=_['mapKeys'](_0x1e1dd8,function(_0x12ffd3,_0x23618b){return _0x12ffd3[_0x1c5218];});for(var _0x1fac8b in _0x62772d){if(_0x62772d[_0xcb72('0x21')](_0x1fac8b)){if(!_0x275b71[_0x1fac8b]){delete _0x62772d[_0x1fac8b];}}}}function freeIsNotKeySip(_0x3dbd7e,_0x557b18){var _0x25c479=_[_0xcb72('0x22')](_0x3dbd7e,function(_0x54ff72,_0x561141){return util[_0xcb72('0x23')]('SIP/%s',_0x54ff72['name']);});for(var _0xd36e95 in _0x557b18){if(_0x557b18['hasOwnProperty'](_0xd36e95)){if(!_0x25c479[_0xd36e95]){delete _0x557b18[_0xd36e95];}}}}function freeIsNotKeyAgent(_0x42687e,_0xe36caa){var _0x2bc266=_[_0xcb72('0x22')](_0x42687e,function(_0x13ec18,_0x593465){var _0x157714=_[_0xcb72('0x24')](_0x13ec18[_0xcb72('0x25')])?util[_0xcb72('0x23')](_0xcb72('0x26'),_0x13ec18[_0xcb72('0x27')]):_0x13ec18['interface'];return _0x157714;});for(var _0x4e83d7 in _0xe36caa){if(_0xe36caa[_0xcb72('0x21')](_0x4e83d7)){if(!_0x2bc266[_0x4e83d7]){delete _0xe36caa[_0x4e83d7];}}}}function clearVoiceCallReports(_0x5a727b){_0x5a727b[_0xcb72('0x28')]=0x0;_0x5a727b[_0xcb72('0x29')]=0x0;_0x5a727b[_0xcb72('0x2a')]=0x0;_0x5a727b[_0xcb72('0x2b')]=0x0;_0x5a727b['sumBillable']=0x0;}function clearCampaigns(_0x2cd727){if(!_[_0xcb72('0x2c')](_0x2cd727)){for(var _0x2e2b40 in _0x2cd727){if(_0x2cd727[_0xcb72('0x21')](_0x2e2b40)){_0x2cd727[_0x2e2b40][_0xcb72('0x2d')]=0x0;_0x2cd727[_0x2e2b40][_0xcb72('0x2e')]=0x0;}}}}function clearVoiceQueues(_0x217cc){if(!_[_0xcb72('0x2c')](_0x217cc)){for(var _0x5f122a in _0x217cc){if(_0x217cc[_0xcb72('0x21')](_0x5f122a)){_0x217cc[_0x5f122a]['total']=0x0;_0x217cc[_0x5f122a]['answered']=0x0;_0x217cc[_0x5f122a][_0xcb72('0x2f')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x30')]=0x0;_0x217cc[_0x5f122a]['sumHoldTime']=0x0;_0x217cc[_0x5f122a][_0xcb72('0x2b')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x31')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x32')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x33')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x34')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x35')]=0x0;_0x217cc[_0x5f122a]['outboundNoSuchCallsDay']=0x0;_0x217cc[_0x5f122a]['outboundUnknownCallsDay']=0x0;_0x217cc[_0x5f122a][_0xcb72('0x36')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x37')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x38')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x39')]=0x0;_0x217cc[_0x5f122a]['outboundRejectCallsDay']=0x0;_0x217cc[_0x5f122a][_0xcb72('0x3a')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x32')]=0x0;_0x217cc[_0x5f122a][_0xcb72('0x3b')]=0x0;_0x217cc[_0x5f122a]['queueStatusComplete']=!![];}}}}Realtime[_0xcb72('0x3c')]['mergeFromDatabase']=function(_0x49fa1a,_0x184826){for(var _0x52e467 in _0x184826){if(_0x49fa1a[_0xcb72('0x21')](_0x52e467)){_0x49fa1a[_0x52e467]=_0x184826[_0x52e467];}}};Realtime[_0xcb72('0x3c')]['initAgents']=function(){var _0x33c7ee=this;return function(_0x4ace01){if(_0x4ace01){freeIsNotKeyAgent(_0x4ace01,_0x33c7ee[_0xcb72('0xe')]);for(var _0x54d6fa=0x0,_0xce485b={},_0x438bf6={};_0x54d6fa<_0x4ace01[_0xcb72('0x3d')];_0x54d6fa+=0x1){_0xce485b=_0x4ace01[_0x54d6fa];var _0x5538ac=_[_0xcb72('0x24')](_0xce485b['interface'])?util[_0xcb72('0x23')]('SIP/%s',_0xce485b['name']):_0xce485b[_0xcb72('0x25')];if(_['isUndefined'](_0x33c7ee['agents'][_0x5538ac])){_0x33c7ee[_0xcb72('0xe')][_0x5538ac]=new Agent(_0xce485b);}else{_0x33c7ee[_0xcb72('0x3e')](_0x33c7ee[_0xcb72('0xe')][_0x5538ac],_0xce485b);}}}return _0x33c7ee[_0xcb72('0xe')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x3f')]=function(){var _0x3eb32d=this;return function(_0x31455e){if(_0x31455e){freeIsNotKeySip(_0x31455e,_0x3eb32d[_0xcb72('0xf')]);for(var _0x49c987=0x0,_0x51dc2f={},_0xd7c235={};_0x49c987<_0x31455e[_0xcb72('0x3d')];_0x49c987+=0x1){_0x51dc2f=_0x31455e[_0x49c987];if(_[_0xcb72('0x40')](_0x3eb32d['telephones'][util[_0xcb72('0x23')](_0xcb72('0x26'),_0x51dc2f[_0xcb72('0x27')])])){_0x3eb32d[_0xcb72('0xf')][util[_0xcb72('0x23')]('SIP/%s',_0x51dc2f[_0xcb72('0x27')])]=new Telephone(_0x51dc2f);}else{_0x3eb32d[_0xcb72('0x3e')](_0x3eb32d[_0xcb72('0xf')][util[_0xcb72('0x23')](_0xcb72('0x26'),_0x51dc2f[_0xcb72('0x27')])],_0x51dc2f);}}}return _0x3eb32d[_0xcb72('0xf')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x41')]=function(){var _0xd9368c=this;return function(_0x34c5be){if(_0x34c5be){freeIsNotKeySip(_0x34c5be,_0xd9368c[_0xcb72('0x10')]);for(var _0x1e2d05=0x0,_0x3e023d={},_0x4e5587={};_0x1e2d05<_0x34c5be[_0xcb72('0x3d')];_0x1e2d05+=0x1){_0x3e023d=_0x34c5be[_0x1e2d05];if(_['isUndefined'](_0xd9368c[_0xcb72('0x10')][util[_0xcb72('0x23')]('SIP/%s',_0x3e023d['name'])])){_0xd9368c['trunks'][util['format'](_0xcb72('0x26'),_0x3e023d[_0xcb72('0x27')])]=new Trunk(_0x3e023d);}else{_0xd9368c[_0xcb72('0x3e')](_0xd9368c[_0xcb72('0x10')][util[_0xcb72('0x23')]('SIP/%s',_0x3e023d[_0xcb72('0x27')])],_0x3e023d);}}}return _0xd9368c[_0xcb72('0x10')];};};Realtime['prototype'][_0xcb72('0x42')]=function(){var _0x3dc0dd=this;return function(_0x1042c4){if(_0x1042c4){freeIsNotKey(_0x1042c4,_0x3dc0dd[_0xcb72('0x11')],'name');for(var _0x3508f3=0x0,_0x348068={},_0x38798e={};_0x3508f3<_0x1042c4[_0xcb72('0x3d')];_0x3508f3+=0x1){_0x348068=_0x1042c4[_0x3508f3];if(_['isUndefined'](_0x3dc0dd[_0xcb72('0x11')][_0x348068[_0xcb72('0x27')]])){_0x3dc0dd[_0xcb72('0x11')][_0x348068['name']]=new VoiceQueue(_0x348068);}else{_0x3dc0dd[_0xcb72('0x3e')](_0x3dc0dd['voiceQueues'][_0x348068[_0xcb72('0x27')]],_0x348068);}}}return _0x3dc0dd['voiceQueues'];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x43')]=function(){var _0xf31d17=this;return function(_0x3ba8f5){if(_0x3ba8f5){freeIsNotKey(_0x3ba8f5,_0xf31d17[_0xcb72('0x44')],'id');for(var _0x3c8116=0x0,_0x522716={},_0x1bf156={};_0x3c8116<_0x3ba8f5[_0xcb72('0x3d')];_0x3c8116+=0x1){_0x522716=_0x3ba8f5[_0x3c8116];if(_['isUndefined'](_0xf31d17['triggers'][_0x522716['id']])){_0xf31d17[_0xcb72('0x44')][_0x522716['id']]=new Trigger(_0x522716);}else{_0xf31d17[_0xcb72('0x3e')](_0xf31d17[_0xcb72('0x44')][_0x522716['id']],_0x522716);}}}return _0xf31d17['triggers'];};};Realtime[_0xcb72('0x3c')]['initTemplates']=function(){var _0x366dec=this;return function(_0x1d9d7e){if(_0x1d9d7e){freeIsNotKey(_0x1d9d7e,_0x366dec['templates'],'id');for(var _0x35d165=0x0,_0x415075={},_0x24a0e7={};_0x35d165<_0x1d9d7e['length'];_0x35d165+=0x1){_0x415075=_0x1d9d7e[_0x35d165];if(_['isUndefined'](_0x366dec[_0xcb72('0x13')][_0x415075['id']])){_0x366dec[_0xcb72('0x13')][_0x415075['id']]=new Template(_0x415075);}else{_0x366dec[_0xcb72('0x3e')](_0x366dec[_0xcb72('0x13')][_0x415075['id']],_0x415075);}}}return _0x366dec['templates'];};};Realtime['prototype']['initZendeskAccounts']=function(){var _0x4ef83c=this;return function(_0x2150f4){if(_0x2150f4){freeIsNotKey(_0x2150f4,_0x4ef83c[_0xcb72('0x19')],'id');for(var _0x58e280=0x0,_0xf58178={},_0x52a7d6={};_0x58e280<_0x2150f4['length'];_0x58e280+=0x1){_0xf58178=_0x2150f4[_0x58e280];if(_[_0xcb72('0x40')](_0x4ef83c[_0xcb72('0x19')][_0xf58178['id']])){_0x4ef83c[_0xcb72('0x19')][_0xf58178['id']]=new ZendeskAccount(_0xf58178);}else{_0x4ef83c['mergeFromDatabase'](_0x4ef83c['zendeskAccounts'][_0xf58178['id']],_0xf58178);}}}return _0x4ef83c[_0xcb72('0x19')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x45')]=function(){var _0x3afff4=this;return function(_0x2ebcff){if(_0x2ebcff){freeIsNotKey(_0x2ebcff,_0x3afff4[_0xcb72('0x1a')],'id');for(var _0x1495b9=0x0,_0x213ea5={},_0x7996fe={};_0x1495b9<_0x2ebcff[_0xcb72('0x3d')];_0x1495b9+=0x1){_0x213ea5=_0x2ebcff[_0x1495b9];if(_[_0xcb72('0x40')](_0x3afff4[_0xcb72('0x1a')][_0x213ea5['id']])){_0x3afff4[_0xcb72('0x1a')][_0x213ea5['id']]=new SalesforceAccount(_0x213ea5);}else{_0x3afff4[_0xcb72('0x3e')](_0x3afff4[_0xcb72('0x1a')][_0x213ea5['id']],_0x213ea5);}}}return _0x3afff4[_0xcb72('0x1a')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x46')]=function(){var _0x498b6f=this;return function(_0x24c507){if(_0x24c507){freeIsNotKey(_0x24c507,_0x498b6f[_0xcb72('0x1c')],'id');for(var _0x3d2f25=0x0,_0xcb078e={},_0x50e79e={};_0x3d2f25<_0x24c507[_0xcb72('0x3d')];_0x3d2f25+=0x1){_0xcb078e=_0x24c507[_0x3d2f25];if(_['isUndefined'](_0x498b6f[_0xcb72('0x1c')][_0xcb078e['id']])){_0x498b6f[_0xcb72('0x1c')][_0xcb078e['id']]=new FreshdeskAccount(_0xcb078e);}else{_0x498b6f['mergeFromDatabase'](_0x498b6f[_0xcb72('0x1c')][_0xcb078e['id']],_0xcb078e);}}}return _0x498b6f[_0xcb72('0x1c')];};};Realtime['prototype'][_0xcb72('0x47')]=function(){var _0x24393b=this;return function(_0x4b16ac){if(_0x4b16ac){freeIsNotKey(_0x4b16ac,_0x24393b[_0xcb72('0x1d')],'id');for(var _0x521af2=0x0,_0x421910={},_0x24b5eb={};_0x521af2<_0x4b16ac[_0xcb72('0x3d')];_0x521af2+=0x1){_0x421910=_0x4b16ac[_0x521af2];if(_[_0xcb72('0x40')](_0x24393b[_0xcb72('0x1d')][_0x421910['id']])){_0x24393b[_0xcb72('0x1d')][_0x421910['id']]=new ZohoAccount(_0x421910);}else{_0x24393b[_0xcb72('0x3e')](_0x24393b['zohoAccounts'][_0x421910['id']],_0x421910);}}}return _0x24393b[_0xcb72('0x1d')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x48')]=function(){var _0x4a1937=this;return function(_0x3115dc){if(_0x3115dc){freeIsNotKey(_0x3115dc,_0x4a1937[_0xcb72('0x49')],'id');for(var _0x625440=0x0,_0x2b7e76={},_0x2f4e98={};_0x625440<_0x3115dc['length'];_0x625440+=0x1){_0x2b7e76=_0x3115dc[_0x625440];if(_['isUndefined'](_0x4a1937[_0xcb72('0x49')][_0x2b7e76['id']])){_0x4a1937[_0xcb72('0x49')][_0x2b7e76['id']]=new DeskAccount(_0x2b7e76);}else{_0x4a1937[_0xcb72('0x3e')](_0x4a1937[_0xcb72('0x49')][_0x2b7e76['id']],_0x2b7e76);}}}return _0x4a1937[_0xcb72('0x49')];};};Realtime[_0xcb72('0x3c')]['initSugarcrmAccounts']=function(){var _0x1e9ead=this;return function(_0x59f548){if(_0x59f548){freeIsNotKey(_0x59f548,_0x1e9ead[_0xcb72('0x1b')],'id');for(var _0x388ba8=0x0,_0x35c63d={},_0x1adfe9={};_0x388ba8<_0x59f548['length'];_0x388ba8+=0x1){_0x35c63d=_0x59f548[_0x388ba8];if(_[_0xcb72('0x40')](_0x1e9ead[_0xcb72('0x1b')][_0x35c63d['id']])){_0x1e9ead['sugarcrmAccounts'][_0x35c63d['id']]=new SugarcrmAccount(_0x35c63d);}else{_0x1e9ead[_0xcb72('0x3e')](_0x1e9ead[_0xcb72('0x1b')][_0x35c63d['id']],_0x35c63d);}}}return _0x1e9ead[_0xcb72('0x1b')];};};Realtime[_0xcb72('0x3c')]['initVtigerAccounts']=function(){var _0x11d8d3=this;return function(_0x43f00a){if(_0x43f00a){freeIsNotKey(_0x43f00a,_0x11d8d3[_0xcb72('0x1e')],'id');for(var _0x1bf29f=0x0,_0x17ac6d={},_0x472801={};_0x1bf29f<_0x43f00a[_0xcb72('0x3d')];_0x1bf29f+=0x1){_0x17ac6d=_0x43f00a[_0x1bf29f];if(_['isUndefined'](_0x11d8d3[_0xcb72('0x1e')][_0x17ac6d['id']])){_0x11d8d3[_0xcb72('0x1e')][_0x17ac6d['id']]=new VtigerAccount(_0x17ac6d);}else{_0x11d8d3['mergeFromDatabase'](_0x11d8d3['vtigerAccounts'][_0x17ac6d['id']],_0x17ac6d);}}}return _0x11d8d3[_0xcb72('0x1e')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x4a')]=function(){var _0x52143c=this;return function(_0x37f1a5){if(_0x37f1a5){freeIsNotKey(_0x37f1a5,_0x52143c[_0xcb72('0x4b')],'id');for(var _0x5a039e=0x0,_0x1d6c17={},_0x37bd68={};_0x5a039e<_0x37f1a5[_0xcb72('0x3d')];_0x5a039e+=0x1){_0x1d6c17=_0x37f1a5[_0x5a039e];if(_[_0xcb72('0x40')](_0x52143c['servicenowAccounts'][_0x1d6c17['id']])){_0x52143c[_0xcb72('0x4b')][_0x1d6c17['id']]=new ServicenowAccount(_0x1d6c17);}else{_0x52143c['mergeFromDatabase'](_0x52143c['servicenowAccounts'][_0x1d6c17['id']],_0x1d6c17);}}}return _0x52143c['servicenowAccounts'];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x4c')]=function(){var _0x5b673e=this;return function(_0x5cb131){if(_0x5cb131){freeIsNotKey(_0x5cb131,_0x5b673e[_0xcb72('0x4d')],'id');for(var _0x4dee36=0x0,_0x3ef3b9={},_0x275be5={};_0x4dee36<_0x5cb131['length'];_0x4dee36+=0x1){_0x3ef3b9=_0x5cb131[_0x4dee36];if(_[_0xcb72('0x40')](_0x5b673e[_0xcb72('0x4d')][_0x3ef3b9['id']])){_0x5b673e[_0xcb72('0x4d')][_0x3ef3b9['id']]=new Dynamics365Account(_0x3ef3b9);}else{_0x5b673e[_0xcb72('0x3e')](_0x5b673e[_0xcb72('0x4d')][_0x3ef3b9['id']],_0x3ef3b9);}}}return _0x5b673e['dynamics365Accounts'];};};Realtime['prototype']['initFreshsalesAccounts']=function(){var _0x33d0e8=this;return function(_0x469fd5){if(_0x469fd5){freeIsNotKey(_0x469fd5,_0x33d0e8['freshsalesAccounts'],'id');for(var _0x1ff439=0x0,_0x8287d3={},_0x5017ef={};_0x1ff439<_0x469fd5[_0xcb72('0x3d')];_0x1ff439+=0x1){_0x8287d3=_0x469fd5[_0x1ff439];if(_[_0xcb72('0x40')](_0x33d0e8[_0xcb72('0x1f')][_0x8287d3['id']])){_0x33d0e8[_0xcb72('0x1f')][_0x8287d3['id']]=new FreshsalesAccount(_0x8287d3);}else{_0x33d0e8[_0xcb72('0x3e')](_0x33d0e8[_0xcb72('0x1f')][_0x8287d3['id']],_0x8287d3);}}}return _0x33d0e8['freshsalesAccounts'];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x4e')]=function(){var _0x34d3f3=this;return function(_0x5154dc){for(var _0x41f573=0x0;_0x41f573<_0x5154dc[_0xcb72('0x3d')];_0x41f573+=0x1){_[_0xcb72('0x4f')](_0x34d3f3[_0xcb72('0x11')][_0x5154dc[_0x41f573][_0xcb72('0x27')]],_0x5154dc[_0x41f573]);}return _0x34d3f3[_0xcb72('0x11')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x50')]=function(){var _0x40cc02=this;return function(_0x1dbb3f){clearVoiceQueues(_0x40cc02[_0xcb72('0x11')]);if(_0x1dbb3f){_0x1dbb3f=_[_0xcb72('0x51')](_0x1dbb3f,'uniqueid');for(var _0x5462fa in _0x1dbb3f){if(_0x1dbb3f[_0xcb72('0x21')](_0x5462fa)){var _0x186d6c={};for(var _0x426880=0x0;_0x426880<_0x1dbb3f[_0x5462fa][_0xcb72('0x3d')];_0x426880+=0x1){var _0x2b1b52=_0x1dbb3f[_0x5462fa][_0x426880]['queue'];if(_0x40cc02[_0xcb72('0x11')][_0x2b1b52]){if(_0x1dbb3f[_0x5462fa][_0x426880][_0xcb72('0x52')]){_0x40cc02[_0xcb72('0x11')][_0x2b1b52][_0xcb72('0x2f')]+=0x1;}if(_0x1dbb3f[_0x5462fa][_0x426880][_0xcb72('0x53')]){_0x40cc02[_0xcb72('0x11')][_0x2b1b52][_0xcb72('0x30')]+=0x1;}_0x40cc02['voiceQueues'][_0x2b1b52][_0xcb72('0x2a')]+=moment(_0x1dbb3f[_0x5462fa][_0x426880][_0xcb72('0x54')])['diff'](moment(_0x1dbb3f[_0x5462fa][_0x426880]['queuecallerjoinAt']),_0xcb72('0x55'))||0x0;if(_0x426880===_0x1dbb3f[_0x5462fa][_0xcb72('0x3d')]-0x1){_0x40cc02[_0xcb72('0x11')][_0x2b1b52][_0xcb72('0x2b')]+=moment(_0x1dbb3f[_0x5462fa][_0x426880][_0xcb72('0x56')]||_0x1dbb3f[_0x5462fa][_0x426880]['queuecallerabandonAt']||_0x1dbb3f[_0x5462fa][_0x426880][_0xcb72('0x57')])[_0xcb72('0x58')](moment(_0x1dbb3f[_0x5462fa][_0x426880][_0xcb72('0x59')]),_0xcb72('0x55'))||0x0;_0x40cc02[_0xcb72('0x11')][_0x2b1b52][_0xcb72('0x28')]+=0x1;if(_0x1dbb3f[_0x5462fa][_0x426880][_0xcb72('0x5a')]){_0x40cc02['voiceQueues'][_0x2b1b52][_0xcb72('0x29')]+=0x1;_0x40cc02[_0xcb72('0x11')][_0x2b1b52][_0xcb72('0x31')]+=moment(_0x1dbb3f[_0x5462fa][_0x426880][_0xcb72('0x56')])[_0xcb72('0x58')](moment(_0x1dbb3f[_0x5462fa][_0x426880][_0xcb72('0x54')]),_0xcb72('0x55'))||0x0;}}else{_0x40cc02['voiceQueues'][_0x2b1b52][_0xcb72('0x2b')]+=_0x40cc02['voiceQueues'][_0x2b1b52]['sumHoldTime']||0x0;}}}}}}return _0x40cc02['voiceQueues'];};};Realtime['prototype'][_0xcb72('0x5b')]=function(){var _0x12cb63=this;return function(_0x1bdd1c){clearVoiceCallReports(_0x12cb63['outbound']);if(_0x1bdd1c){for(var _0xc7fcd0=0x0;_0xc7fcd0<_0x1bdd1c[_0xcb72('0x3d')];_0xc7fcd0+=0x1){_0x12cb63[_0xcb72('0x5c')][_0xcb72('0x28')]+=0x1;_0x12cb63[_0xcb72('0x5c')]['sumDuration']+=_0x1bdd1c[_0xc7fcd0][_0xcb72('0x5d')];if(_0x1bdd1c[_0xc7fcd0][_0xcb72('0x5e')]===_0xcb72('0x5f')){_0x12cb63[_0xcb72('0x5c')][_0xcb72('0x29')]+=0x1;_0x12cb63[_0xcb72('0x5c')][_0xcb72('0x2a')]+=_0x1bdd1c[_0xc7fcd0][_0xcb72('0x5d')]-_0x1bdd1c[_0xc7fcd0]['billableseconds']||0x0;_0x12cb63[_0xcb72('0x5c')][_0xcb72('0x31')]+=_0x1bdd1c[_0xc7fcd0][_0xcb72('0x60')];}}}return _0x12cb63[_0xcb72('0x5c')];};};Realtime['prototype'][_0xcb72('0x61')]=function(){var _0x461e5=this;return function(_0x35d74f){if(_0x35d74f){freeIsNotKey(_0x35d74f,_0x461e5['campaigns'],_0xcb72('0x27'));for(var _0x4604e3=0x0,_0x4d799b={};_0x4604e3<_0x35d74f['length'];_0x4604e3+=0x1){_0x4d799b=_0x35d74f[_0x4604e3];if(_['isUndefined'](_0x461e5[_0xcb72('0x12')][_0x4d799b[_0xcb72('0x27')]])){_0x461e5[_0xcb72('0x12')][_0x4d799b[_0xcb72('0x27')]]=new Campaign(_0x4d799b);}else{_0x461e5[_0xcb72('0x3e')](_0x461e5[_0xcb72('0x12')][_0x4d799b['name']],_0x4d799b);_0x461e5[_0xcb72('0x12')][_0x4d799b[_0xcb72('0x27')]][_0xcb72('0x62')]=_0x4d799b[_0xcb72('0x63')]?_0x4d799b[_0xcb72('0x63')][_0xcb72('0x27')]:undefined;}}}return _0x461e5[_0xcb72('0x12')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x64')]=function(){var _0x8fc845=this;return function(_0x56c86b){if(_0x56c86b){freeIsNotKey(_0x56c86b,_0x8fc845['voiceExtensions'],'id');for(var _0x3f5339=0x0,_0x738173={};_0x3f5339<_0x56c86b[_0xcb72('0x3d')];_0x3f5339+=0x1){_0x738173=_0x56c86b[_0x3f5339];if(_[_0xcb72('0x40')](_0x8fc845[_0xcb72('0x14')][_0x738173['id']])){_0x8fc845[_0xcb72('0x14')][_0x738173['id']]=new VoiceExtension(_0x738173);}else{_0x8fc845[_0xcb72('0x3e')](_0x8fc845[_0xcb72('0x14')][_0x738173['id']],_0x738173);}}}return _0x8fc845[_0xcb72('0x14')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x65')]=function(){var _0x336b68=this;return function(_0x29466c){clearCampaigns(_0x336b68['campaigns']);for(var _0x4fda6e=0x0;_0x4fda6e<_0x29466c[_0xcb72('0x3d')];_0x4fda6e+=0x1){_[_0xcb72('0x4f')](_0x336b68[_0xcb72('0x12')][_0x29466c[_0x4fda6e][_0xcb72('0x27')]],_0x29466c[_0x4fda6e]);}return _0x336b68[_0xcb72('0x12')];};};Realtime[_0xcb72('0x3c')][_0xcb72('0x66')]=function(){var _0x4318b7=this;return function(_0x178195){if(_0x178195){freeIsNotKey(_0x178195,_0x4318b7[_0xcb72('0x20')],'id');for(var _0x173c83=0x0,_0x58fdf2={},_0x1ef355={};_0x173c83<_0x178195['length'];_0x173c83+=0x1){_0x58fdf2=_0x178195[_0x173c83];if(_['isUndefined'](_0x4318b7['faxAccounts'][_0x58fdf2['id']])){_0x4318b7[_0xcb72('0x20')][_0x58fdf2['id']]=new FaxAccount(_0x58fdf2);}else{_0x4318b7[_0xcb72('0x3e')](_0x4318b7[_0xcb72('0x20')][_0x58fdf2['id']],_0x58fdf2);}}}return _0x4318b7[_0xcb72('0x20')];};};module['exports']=Realtime; \ No newline at end of file +var _0xfd26=['initCampaigns','SquareProject','initVoiceExtensions','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','../model/agent','../model/telephone','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','agents','telephones','trunks','triggers','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','mapKeys','hasOwnProperty','SIP/%s','name','isNil','interface','total','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','unmanaged','abandoned','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','initTelephones','length','isUndefined','format','initTrunks','initVoiceQueues','voiceQueues','initTriggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initSugarcrmAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','merge','initVoiceQueueReports','groupBy','queue','queuecallerexit','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerleaveAt','initVoiceCallReports','outbound','disposition','ANSWERED','duration','billableseconds'];(function(_0x5126cc,_0x393d0a){var _0x3c8312=function(_0x48f757){while(--_0x48f757){_0x5126cc['push'](_0x5126cc['shift']());}};_0x3c8312(++_0x393d0a);}(_0xfd26,0xd8));var _0x6fd2=function(_0x27ddd3,_0x22fee7){_0x27ddd3=_0x27ddd3-0x0;var _0x304252=_0xfd26[_0x27ddd3];return _0x304252;};'use strict';var BPromise=require(_0x6fd2('0x0'));var util=require(_0x6fd2('0x1'));var _=require(_0x6fd2('0x2'));var moment=require('moment');var Agent=require(_0x6fd2('0x3'));var Telephone=require(_0x6fd2('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0x6fd2('0x5'));var Trigger=require('../model/trigger');var Template=require(_0x6fd2('0x6'));var Campaign=require(_0x6fd2('0x7'));var VoiceExtension=require(_0x6fd2('0x8'));var ZendeskAccount=require(_0x6fd2('0x9'));var SalesforceAccount=require(_0x6fd2('0xa'));var FreshdeskAccount=require(_0x6fd2('0xb'));var SugarcrmAccount=require(_0x6fd2('0xc'));var ZohoAccount=require(_0x6fd2('0xd'));var DeskAccount=require(_0x6fd2('0xe'));var VtigerAccount=require(_0x6fd2('0xf'));var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0x6fd2('0x10')]={};this[_0x6fd2('0x11')]={};this[_0x6fd2('0x12')]={};this['voiceQueues']={};this[_0x6fd2('0x13')]={};this[_0x6fd2('0x14')]={};this[_0x6fd2('0x15')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x6fd2('0x16')]={};this[_0x6fd2('0x17')]={};this[_0x6fd2('0x18')]={};this[_0x6fd2('0x19')]={};this['timers']={};this['settings']={};this[_0x6fd2('0x1a')]={};this['salesforceAccounts']={};this[_0x6fd2('0x1b')]={};this[_0x6fd2('0x1c')]={};this[_0x6fd2('0x1d')]={};this[_0x6fd2('0x1e')]={};this[_0x6fd2('0x1f')]={};this['servicenowAccounts']={};this['dynamics365Accounts']={};this['freshsalesAccounts']={};this['faxAccounts']={};};function freeIsNotKey(_0x276fad,_0x1f53db,_0x51f1e3){var _0x46b4fd=_[_0x6fd2('0x20')](_0x276fad,function(_0x2e1519,_0x19e019){return _0x2e1519[_0x51f1e3];});for(var _0x53ee6c in _0x1f53db){if(_0x1f53db[_0x6fd2('0x21')](_0x53ee6c)){if(!_0x46b4fd[_0x53ee6c]){delete _0x1f53db[_0x53ee6c];}}}}function freeIsNotKeySip(_0x3a2554,_0x4a477e){var _0x4c89ca=_['mapKeys'](_0x3a2554,function(_0x1f6f47,_0x310355){return util['format'](_0x6fd2('0x22'),_0x1f6f47[_0x6fd2('0x23')]);});for(var _0x5140ec in _0x4a477e){if(_0x4a477e[_0x6fd2('0x21')](_0x5140ec)){if(!_0x4c89ca[_0x5140ec]){delete _0x4a477e[_0x5140ec];}}}}function freeIsNotKeyAgent(_0x3d416a,_0x2c143c){var _0x26d056=_[_0x6fd2('0x20')](_0x3d416a,function(_0x52e44e,_0x89f371){var _0x3705d7=_[_0x6fd2('0x24')](_0x52e44e['interface'])?util['format']('SIP/%s',_0x52e44e['name']):_0x52e44e[_0x6fd2('0x25')];return _0x3705d7;});for(var _0x17b29c in _0x2c143c){if(_0x2c143c[_0x6fd2('0x21')](_0x17b29c)){if(!_0x26d056[_0x17b29c]){delete _0x2c143c[_0x17b29c];}}}}function clearVoiceCallReports(_0x17ff58){_0x17ff58[_0x6fd2('0x26')]=0x0;_0x17ff58[_0x6fd2('0x27')]=0x0;_0x17ff58[_0x6fd2('0x28')]=0x0;_0x17ff58[_0x6fd2('0x29')]=0x0;_0x17ff58[_0x6fd2('0x2a')]=0x0;}function clearCampaigns(_0x4bf710){if(!_[_0x6fd2('0x2b')](_0x4bf710)){for(var _0x4ebe90 in _0x4bf710){if(_0x4bf710[_0x6fd2('0x21')](_0x4ebe90)){_0x4bf710[_0x4ebe90]['ivrTotalCallsDays']=0x0;_0x4bf710[_0x4ebe90]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x354a37){if(!_[_0x6fd2('0x2b')](_0x354a37)){for(var _0x11b225 in _0x354a37){if(_0x354a37[_0x6fd2('0x21')](_0x11b225)){_0x354a37[_0x11b225][_0x6fd2('0x26')]=0x0;_0x354a37[_0x11b225][_0x6fd2('0x27')]=0x0;_0x354a37[_0x11b225][_0x6fd2('0x2c')]=0x0;_0x354a37[_0x11b225][_0x6fd2('0x2d')]=0x0;_0x354a37[_0x11b225][_0x6fd2('0x28')]=0x0;_0x354a37[_0x11b225][_0x6fd2('0x29')]=0x0;_0x354a37[_0x11b225][_0x6fd2('0x2a')]=0x0;_0x354a37[_0x11b225]['outboundAnswerAgiCallsDay']=0x0;_0x354a37[_0x11b225][_0x6fd2('0x2e')]=0x0;_0x354a37[_0x11b225][_0x6fd2('0x2f')]=0x0;_0x354a37[_0x11b225][_0x6fd2('0x30')]=0x0;_0x354a37[_0x11b225][_0x6fd2('0x31')]=0x0;_0x354a37[_0x11b225][_0x6fd2('0x32')]=0x0;_0x354a37[_0x11b225][_0x6fd2('0x33')]=0x0;_0x354a37[_0x11b225]['outboundDropCallsDayCallersExit']=0x0;_0x354a37[_0x11b225][_0x6fd2('0x34')]=0x0;_0x354a37[_0x11b225][_0x6fd2('0x35')]=0x0;_0x354a37[_0x11b225]['outboundRejectCallsDay']=0x0;_0x354a37[_0x11b225][_0x6fd2('0x36')]=0x0;_0x354a37[_0x11b225][_0x6fd2('0x37')]=0x0;_0x354a37[_0x11b225]['outboundAnswerCallsDay']=0x0;_0x354a37[_0x11b225][_0x6fd2('0x38')]=!![];}}}}Realtime[_0x6fd2('0x39')][_0x6fd2('0x3a')]=function(_0x363e04,_0x41dd8c){for(var _0x31c92f in _0x41dd8c){if(_0x363e04[_0x6fd2('0x21')](_0x31c92f)){_0x363e04[_0x31c92f]=_0x41dd8c[_0x31c92f];}}};Realtime[_0x6fd2('0x39')][_0x6fd2('0x3b')]=function(){var _0x7e3f91=this;return function(_0x25b086){if(_0x25b086){freeIsNotKeyAgent(_0x25b086,_0x7e3f91[_0x6fd2('0x10')]);for(var _0x326dc0=0x0,_0x1c29c1={},_0x3f7e1b={};_0x326dc0<_0x25b086['length'];_0x326dc0+=0x1){_0x1c29c1=_0x25b086[_0x326dc0];var _0x3dabad=_['isNil'](_0x1c29c1[_0x6fd2('0x25')])?util['format'](_0x6fd2('0x22'),_0x1c29c1['name']):_0x1c29c1[_0x6fd2('0x25')];if(_['isUndefined'](_0x7e3f91[_0x6fd2('0x10')][_0x3dabad])){_0x7e3f91[_0x6fd2('0x10')][_0x3dabad]=new Agent(_0x1c29c1);}else{_0x7e3f91[_0x6fd2('0x3a')](_0x7e3f91[_0x6fd2('0x10')][_0x3dabad],_0x1c29c1);}}}return _0x7e3f91[_0x6fd2('0x10')];};};Realtime[_0x6fd2('0x39')][_0x6fd2('0x3c')]=function(){var _0x5e8e95=this;return function(_0x48dd5d){if(_0x48dd5d){freeIsNotKeySip(_0x48dd5d,_0x5e8e95[_0x6fd2('0x11')]);for(var _0xb33e30=0x0,_0x4897c8={},_0x218dc6={};_0xb33e30<_0x48dd5d[_0x6fd2('0x3d')];_0xb33e30+=0x1){_0x4897c8=_0x48dd5d[_0xb33e30];if(_[_0x6fd2('0x3e')](_0x5e8e95[_0x6fd2('0x11')][util[_0x6fd2('0x3f')](_0x6fd2('0x22'),_0x4897c8['name'])])){_0x5e8e95['telephones'][util[_0x6fd2('0x3f')](_0x6fd2('0x22'),_0x4897c8[_0x6fd2('0x23')])]=new Telephone(_0x4897c8);}else{_0x5e8e95[_0x6fd2('0x3a')](_0x5e8e95['telephones'][util['format'](_0x6fd2('0x22'),_0x4897c8[_0x6fd2('0x23')])],_0x4897c8);}}}return _0x5e8e95[_0x6fd2('0x11')];};};Realtime[_0x6fd2('0x39')][_0x6fd2('0x40')]=function(){var _0x61cf7a=this;return function(_0x556555){if(_0x556555){freeIsNotKeySip(_0x556555,_0x61cf7a['trunks']);for(var _0x37106d=0x0,_0x5ee972={},_0x897d5a={};_0x37106d<_0x556555[_0x6fd2('0x3d')];_0x37106d+=0x1){_0x5ee972=_0x556555[_0x37106d];if(_[_0x6fd2('0x3e')](_0x61cf7a[_0x6fd2('0x12')][util[_0x6fd2('0x3f')]('SIP/%s',_0x5ee972[_0x6fd2('0x23')])])){_0x61cf7a['trunks'][util[_0x6fd2('0x3f')](_0x6fd2('0x22'),_0x5ee972[_0x6fd2('0x23')])]=new Trunk(_0x5ee972);}else{_0x61cf7a['mergeFromDatabase'](_0x61cf7a['trunks'][util[_0x6fd2('0x3f')](_0x6fd2('0x22'),_0x5ee972['name'])],_0x5ee972);}}}return _0x61cf7a[_0x6fd2('0x12')];};};Realtime[_0x6fd2('0x39')][_0x6fd2('0x41')]=function(){var _0x38d884=this;return function(_0x563f63){if(_0x563f63){freeIsNotKey(_0x563f63,_0x38d884[_0x6fd2('0x42')],_0x6fd2('0x23'));for(var _0x5adfe8=0x0,_0x5b230d={},_0x39449e={};_0x5adfe8<_0x563f63[_0x6fd2('0x3d')];_0x5adfe8+=0x1){_0x5b230d=_0x563f63[_0x5adfe8];if(_[_0x6fd2('0x3e')](_0x38d884['voiceQueues'][_0x5b230d[_0x6fd2('0x23')]])){_0x38d884['voiceQueues'][_0x5b230d['name']]=new VoiceQueue(_0x5b230d);}else{_0x38d884[_0x6fd2('0x3a')](_0x38d884[_0x6fd2('0x42')][_0x5b230d[_0x6fd2('0x23')]],_0x5b230d);}}}return _0x38d884[_0x6fd2('0x42')];};};Realtime['prototype'][_0x6fd2('0x43')]=function(){var _0x519a25=this;return function(_0x1d5241){if(_0x1d5241){freeIsNotKey(_0x1d5241,_0x519a25[_0x6fd2('0x13')],'id');for(var _0x228c55=0x0,_0x2fcce1={},_0x1ea7f3={};_0x228c55<_0x1d5241['length'];_0x228c55+=0x1){_0x2fcce1=_0x1d5241[_0x228c55];if(_['isUndefined'](_0x519a25[_0x6fd2('0x13')][_0x2fcce1['id']])){_0x519a25[_0x6fd2('0x13')][_0x2fcce1['id']]=new Trigger(_0x2fcce1);}else{_0x519a25[_0x6fd2('0x3a')](_0x519a25[_0x6fd2('0x13')][_0x2fcce1['id']],_0x2fcce1);}}}return _0x519a25[_0x6fd2('0x13')];};};Realtime['prototype'][_0x6fd2('0x44')]=function(){var _0x3dd678=this;return function(_0x5119b3){if(_0x5119b3){freeIsNotKey(_0x5119b3,_0x3dd678[_0x6fd2('0x15')],'id');for(var _0x207d8b=0x0,_0x4932e0={},_0x367ca6={};_0x207d8b<_0x5119b3['length'];_0x207d8b+=0x1){_0x4932e0=_0x5119b3[_0x207d8b];if(_[_0x6fd2('0x3e')](_0x3dd678['templates'][_0x4932e0['id']])){_0x3dd678[_0x6fd2('0x15')][_0x4932e0['id']]=new Template(_0x4932e0);}else{_0x3dd678[_0x6fd2('0x3a')](_0x3dd678[_0x6fd2('0x15')][_0x4932e0['id']],_0x4932e0);}}}return _0x3dd678['templates'];};};Realtime[_0x6fd2('0x39')][_0x6fd2('0x45')]=function(){var _0x28c345=this;return function(_0x5f4712){if(_0x5f4712){freeIsNotKey(_0x5f4712,_0x28c345['zendeskAccounts'],'id');for(var _0x4dd89b=0x0,_0x5f7771={},_0x1ce941={};_0x4dd89b<_0x5f4712['length'];_0x4dd89b+=0x1){_0x5f7771=_0x5f4712[_0x4dd89b];if(_[_0x6fd2('0x3e')](_0x28c345[_0x6fd2('0x1a')][_0x5f7771['id']])){_0x28c345[_0x6fd2('0x1a')][_0x5f7771['id']]=new ZendeskAccount(_0x5f7771);}else{_0x28c345['mergeFromDatabase'](_0x28c345['zendeskAccounts'][_0x5f7771['id']],_0x5f7771);}}}return _0x28c345[_0x6fd2('0x1a')];};};Realtime[_0x6fd2('0x39')][_0x6fd2('0x46')]=function(){var _0x535cbc=this;return function(_0x2c5bbb){if(_0x2c5bbb){freeIsNotKey(_0x2c5bbb,_0x535cbc[_0x6fd2('0x47')],'id');for(var _0xc54d75=0x0,_0x589fd3={},_0x1fbfd0={};_0xc54d75<_0x2c5bbb[_0x6fd2('0x3d')];_0xc54d75+=0x1){_0x589fd3=_0x2c5bbb[_0xc54d75];if(_['isUndefined'](_0x535cbc['salesforceAccounts'][_0x589fd3['id']])){_0x535cbc[_0x6fd2('0x47')][_0x589fd3['id']]=new SalesforceAccount(_0x589fd3);}else{_0x535cbc[_0x6fd2('0x3a')](_0x535cbc['salesforceAccounts'][_0x589fd3['id']],_0x589fd3);}}}return _0x535cbc[_0x6fd2('0x47')];};};Realtime[_0x6fd2('0x39')][_0x6fd2('0x48')]=function(){var _0x1b8329=this;return function(_0x5750ab){if(_0x5750ab){freeIsNotKey(_0x5750ab,_0x1b8329[_0x6fd2('0x1c')],'id');for(var _0x47a24d=0x0,_0x5cc5e8={},_0x32fdfe={};_0x47a24d<_0x5750ab[_0x6fd2('0x3d')];_0x47a24d+=0x1){_0x5cc5e8=_0x5750ab[_0x47a24d];if(_['isUndefined'](_0x1b8329['freshdeskAccounts'][_0x5cc5e8['id']])){_0x1b8329[_0x6fd2('0x1c')][_0x5cc5e8['id']]=new FreshdeskAccount(_0x5cc5e8);}else{_0x1b8329['mergeFromDatabase'](_0x1b8329[_0x6fd2('0x1c')][_0x5cc5e8['id']],_0x5cc5e8);}}}return _0x1b8329[_0x6fd2('0x1c')];};};Realtime[_0x6fd2('0x39')][_0x6fd2('0x49')]=function(){var _0x190e78=this;return function(_0x23457a){if(_0x23457a){freeIsNotKey(_0x23457a,_0x190e78[_0x6fd2('0x1d')],'id');for(var _0x55a25f=0x0,_0x3c227a={},_0x414803={};_0x55a25f<_0x23457a[_0x6fd2('0x3d')];_0x55a25f+=0x1){_0x3c227a=_0x23457a[_0x55a25f];if(_['isUndefined'](_0x190e78[_0x6fd2('0x1d')][_0x3c227a['id']])){_0x190e78[_0x6fd2('0x1d')][_0x3c227a['id']]=new ZohoAccount(_0x3c227a);}else{_0x190e78[_0x6fd2('0x3a')](_0x190e78[_0x6fd2('0x1d')][_0x3c227a['id']],_0x3c227a);}}}return _0x190e78[_0x6fd2('0x1d')];};};Realtime[_0x6fd2('0x39')]['initDeskAccounts']=function(){var _0x563217=this;return function(_0x5278b5){if(_0x5278b5){freeIsNotKey(_0x5278b5,_0x563217[_0x6fd2('0x1e')],'id');for(var _0x55e60d=0x0,_0x537efe={},_0x336e7c={};_0x55e60d<_0x5278b5[_0x6fd2('0x3d')];_0x55e60d+=0x1){_0x537efe=_0x5278b5[_0x55e60d];if(_[_0x6fd2('0x3e')](_0x563217[_0x6fd2('0x1e')][_0x537efe['id']])){_0x563217[_0x6fd2('0x1e')][_0x537efe['id']]=new DeskAccount(_0x537efe);}else{_0x563217['mergeFromDatabase'](_0x563217[_0x6fd2('0x1e')][_0x537efe['id']],_0x537efe);}}}return _0x563217['deskAccounts'];};};Realtime[_0x6fd2('0x39')][_0x6fd2('0x4a')]=function(){var _0x2da11b=this;return function(_0x28b3a9){if(_0x28b3a9){freeIsNotKey(_0x28b3a9,_0x2da11b[_0x6fd2('0x1b')],'id');for(var _0x15e826=0x0,_0x48dadd={},_0x5ed1df={};_0x15e826<_0x28b3a9[_0x6fd2('0x3d')];_0x15e826+=0x1){_0x48dadd=_0x28b3a9[_0x15e826];if(_[_0x6fd2('0x3e')](_0x2da11b[_0x6fd2('0x1b')][_0x48dadd['id']])){_0x2da11b[_0x6fd2('0x1b')][_0x48dadd['id']]=new SugarcrmAccount(_0x48dadd);}else{_0x2da11b['mergeFromDatabase'](_0x2da11b['sugarcrmAccounts'][_0x48dadd['id']],_0x48dadd);}}}return _0x2da11b[_0x6fd2('0x1b')];};};Realtime[_0x6fd2('0x39')]['initVtigerAccounts']=function(){var _0x4538b4=this;return function(_0x147de6){if(_0x147de6){freeIsNotKey(_0x147de6,_0x4538b4[_0x6fd2('0x1f')],'id');for(var _0x4690e9=0x0,_0x14a5f9={},_0x492b11={};_0x4690e9<_0x147de6[_0x6fd2('0x3d')];_0x4690e9+=0x1){_0x14a5f9=_0x147de6[_0x4690e9];if(_[_0x6fd2('0x3e')](_0x4538b4[_0x6fd2('0x1f')][_0x14a5f9['id']])){_0x4538b4[_0x6fd2('0x1f')][_0x14a5f9['id']]=new VtigerAccount(_0x14a5f9);}else{_0x4538b4[_0x6fd2('0x3a')](_0x4538b4[_0x6fd2('0x1f')][_0x14a5f9['id']],_0x14a5f9);}}}return _0x4538b4[_0x6fd2('0x1f')];};};Realtime[_0x6fd2('0x39')][_0x6fd2('0x4b')]=function(){var _0x5e4a9b=this;return function(_0x2a1cb0){if(_0x2a1cb0){freeIsNotKey(_0x2a1cb0,_0x5e4a9b[_0x6fd2('0x4c')],'id');for(var _0x38fd5c=0x0,_0x406142={},_0x5032e2={};_0x38fd5c<_0x2a1cb0['length'];_0x38fd5c+=0x1){_0x406142=_0x2a1cb0[_0x38fd5c];if(_[_0x6fd2('0x3e')](_0x5e4a9b[_0x6fd2('0x4c')][_0x406142['id']])){_0x5e4a9b['servicenowAccounts'][_0x406142['id']]=new ServicenowAccount(_0x406142);}else{_0x5e4a9b['mergeFromDatabase'](_0x5e4a9b[_0x6fd2('0x4c')][_0x406142['id']],_0x406142);}}}return _0x5e4a9b['servicenowAccounts'];};};Realtime[_0x6fd2('0x39')][_0x6fd2('0x4d')]=function(){var _0x47c4e1=this;return function(_0x164393){if(_0x164393){freeIsNotKey(_0x164393,_0x47c4e1[_0x6fd2('0x4e')],'id');for(var _0x171f62=0x0,_0x38aef6={},_0x5c3e59={};_0x171f62<_0x164393[_0x6fd2('0x3d')];_0x171f62+=0x1){_0x38aef6=_0x164393[_0x171f62];if(_[_0x6fd2('0x3e')](_0x47c4e1[_0x6fd2('0x4e')][_0x38aef6['id']])){_0x47c4e1[_0x6fd2('0x4e')][_0x38aef6['id']]=new Dynamics365Account(_0x38aef6);}else{_0x47c4e1['mergeFromDatabase'](_0x47c4e1[_0x6fd2('0x4e')][_0x38aef6['id']],_0x38aef6);}}}return _0x47c4e1[_0x6fd2('0x4e')];};};Realtime['prototype'][_0x6fd2('0x4f')]=function(){var _0x22b136=this;return function(_0x14c797){if(_0x14c797){freeIsNotKey(_0x14c797,_0x22b136[_0x6fd2('0x50')],'id');for(var _0x3e23d2=0x0,_0x42d71c={},_0x58fd0e={};_0x3e23d2<_0x14c797[_0x6fd2('0x3d')];_0x3e23d2+=0x1){_0x42d71c=_0x14c797[_0x3e23d2];if(_[_0x6fd2('0x3e')](_0x22b136[_0x6fd2('0x50')][_0x42d71c['id']])){_0x22b136[_0x6fd2('0x50')][_0x42d71c['id']]=new FreshsalesAccount(_0x42d71c);}else{_0x22b136[_0x6fd2('0x3a')](_0x22b136[_0x6fd2('0x50')][_0x42d71c['id']],_0x42d71c);}}}return _0x22b136['freshsalesAccounts'];};};Realtime[_0x6fd2('0x39')]['initVoiceQueueHopperHistory']=function(){var _0x42a48b=this;return function(_0x3a6538){for(var _0x1b6295=0x0;_0x1b6295<_0x3a6538[_0x6fd2('0x3d')];_0x1b6295+=0x1){_[_0x6fd2('0x51')](_0x42a48b[_0x6fd2('0x42')][_0x3a6538[_0x1b6295][_0x6fd2('0x23')]],_0x3a6538[_0x1b6295]);}return _0x42a48b['voiceQueues'];};};Realtime['prototype'][_0x6fd2('0x52')]=function(){var _0x41adb1=this;return function(_0x153b86){clearVoiceQueues(_0x41adb1[_0x6fd2('0x42')]);if(_0x153b86){_0x153b86=_[_0x6fd2('0x53')](_0x153b86,'uniqueid');for(var _0x56d95e in _0x153b86){if(_0x153b86['hasOwnProperty'](_0x56d95e)){var _0x3f5994={};for(var _0xdd18e5=0x0;_0xdd18e5<_0x153b86[_0x56d95e]['length'];_0xdd18e5+=0x1){var _0x201319=_0x153b86[_0x56d95e][_0xdd18e5][_0x6fd2('0x54')];if(_0x41adb1[_0x6fd2('0x42')][_0x201319]){if(_0x153b86[_0x56d95e][_0xdd18e5][_0x6fd2('0x55')]){_0x41adb1[_0x6fd2('0x42')][_0x201319][_0x6fd2('0x2c')]+=0x1;}if(_0x153b86[_0x56d95e][_0xdd18e5]['queuecallerabandon']){_0x41adb1['voiceQueues'][_0x201319][_0x6fd2('0x2d')]+=0x1;}_0x41adb1['voiceQueues'][_0x201319]['sumHoldTime']+=moment(_0x153b86[_0x56d95e][_0xdd18e5]['queuecallerleaveAt'])[_0x6fd2('0x56')](moment(_0x153b86[_0x56d95e][_0xdd18e5][_0x6fd2('0x57')]),_0x6fd2('0x58'))||0x0;if(_0xdd18e5===_0x153b86[_0x56d95e][_0x6fd2('0x3d')]-0x1){_0x41adb1[_0x6fd2('0x42')][_0x201319][_0x6fd2('0x29')]+=moment(_0x153b86[_0x56d95e][_0xdd18e5]['queuecallercompleteAt']||_0x153b86[_0x56d95e][_0xdd18e5][_0x6fd2('0x59')]||_0x153b86[_0x56d95e][_0xdd18e5]['queuecallerexitAt'])['diff'](moment(_0x153b86[_0x56d95e][_0xdd18e5]['queuecallerjoinAt']),_0x6fd2('0x58'))||0x0;_0x41adb1['voiceQueues'][_0x201319][_0x6fd2('0x26')]+=0x1;if(_0x153b86[_0x56d95e][_0xdd18e5][_0x6fd2('0x5a')]){_0x41adb1[_0x6fd2('0x42')][_0x201319]['answered']+=0x1;_0x41adb1[_0x6fd2('0x42')][_0x201319]['sumBillable']+=moment(_0x153b86[_0x56d95e][_0xdd18e5][_0x6fd2('0x5b')])[_0x6fd2('0x56')](moment(_0x153b86[_0x56d95e][_0xdd18e5][_0x6fd2('0x5c')]),'seconds')||0x0;}}else{_0x41adb1[_0x6fd2('0x42')][_0x201319][_0x6fd2('0x29')]+=_0x41adb1[_0x6fd2('0x42')][_0x201319][_0x6fd2('0x28')]||0x0;}}}}}}return _0x41adb1[_0x6fd2('0x42')];};};Realtime[_0x6fd2('0x39')][_0x6fd2('0x5d')]=function(){var _0x22c44a=this;return function(_0x594a5a){clearVoiceCallReports(_0x22c44a[_0x6fd2('0x5e')]);if(_0x594a5a){for(var _0x530d0c=0x0;_0x530d0c<_0x594a5a[_0x6fd2('0x3d')];_0x530d0c+=0x1){_0x22c44a[_0x6fd2('0x5e')][_0x6fd2('0x26')]+=0x1;_0x22c44a[_0x6fd2('0x5e')][_0x6fd2('0x29')]+=_0x594a5a[_0x530d0c]['duration'];if(_0x594a5a[_0x530d0c][_0x6fd2('0x5f')]===_0x6fd2('0x60')){_0x22c44a[_0x6fd2('0x5e')][_0x6fd2('0x27')]+=0x1;_0x22c44a[_0x6fd2('0x5e')][_0x6fd2('0x28')]+=_0x594a5a[_0x530d0c][_0x6fd2('0x61')]-_0x594a5a[_0x530d0c][_0x6fd2('0x62')]||0x0;_0x22c44a[_0x6fd2('0x5e')]['sumBillable']+=_0x594a5a[_0x530d0c][_0x6fd2('0x62')];}}}return _0x22c44a[_0x6fd2('0x5e')];};};Realtime['prototype'][_0x6fd2('0x63')]=function(){var _0x314885=this;return function(_0x25e852){if(_0x25e852){freeIsNotKey(_0x25e852,_0x314885[_0x6fd2('0x14')],'name');for(var _0x1a10f0=0x0,_0x131389={};_0x1a10f0<_0x25e852['length'];_0x1a10f0+=0x1){_0x131389=_0x25e852[_0x1a10f0];if(_['isUndefined'](_0x314885[_0x6fd2('0x14')][_0x131389[_0x6fd2('0x23')]])){_0x314885[_0x6fd2('0x14')][_0x131389['name']]=new Campaign(_0x131389);}else{_0x314885[_0x6fd2('0x3a')](_0x314885[_0x6fd2('0x14')][_0x131389[_0x6fd2('0x23')]],_0x131389);_0x314885[_0x6fd2('0x14')][_0x131389[_0x6fd2('0x23')]]['dialQueueProject']=_0x131389['SquareProject']?_0x131389[_0x6fd2('0x64')]['name']:undefined;}}}return _0x314885[_0x6fd2('0x14')];};};Realtime[_0x6fd2('0x39')][_0x6fd2('0x65')]=function(){var _0x14b9ac=this;return function(_0x44ef73){if(_0x44ef73){freeIsNotKey(_0x44ef73,_0x14b9ac[_0x6fd2('0x16')],'id');for(var _0x5ba36d=0x0,_0x462210={};_0x5ba36d<_0x44ef73['length'];_0x5ba36d+=0x1){_0x462210=_0x44ef73[_0x5ba36d];if(_[_0x6fd2('0x3e')](_0x14b9ac[_0x6fd2('0x16')][_0x462210['id']])){_0x14b9ac[_0x6fd2('0x16')][_0x462210['id']]=new VoiceExtension(_0x462210);}else{_0x14b9ac[_0x6fd2('0x3a')](_0x14b9ac[_0x6fd2('0x16')][_0x462210['id']],_0x462210);}}}return _0x14b9ac['voiceExtensions'];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x441d3c=this;return function(_0x28ba0f){clearCampaigns(_0x441d3c[_0x6fd2('0x14')]);for(var _0x36e70c=0x0;_0x36e70c<_0x28ba0f[_0x6fd2('0x3d')];_0x36e70c+=0x1){_[_0x6fd2('0x51')](_0x441d3c[_0x6fd2('0x14')][_0x28ba0f[_0x36e70c]['name']],_0x28ba0f[_0x36e70c]);}return _0x441d3c['campaigns'];};};Realtime[_0x6fd2('0x39')][_0x6fd2('0x66')]=function(){var _0x563df6=this;return function(_0x36a874){if(_0x36a874){freeIsNotKey(_0x36a874,_0x563df6[_0x6fd2('0x67')],'id');for(var _0x19747a=0x0,_0x12dfb4={},_0x2d77e4={};_0x19747a<_0x36a874['length'];_0x19747a+=0x1){_0x12dfb4=_0x36a874[_0x19747a];if(_[_0x6fd2('0x3e')](_0x563df6[_0x6fd2('0x67')][_0x12dfb4['id']])){_0x563df6[_0x6fd2('0x67')][_0x12dfb4['id']]=new FaxAccount(_0x12dfb4);}else{_0x563df6[_0x6fd2('0x3a')](_0x563df6['faxAccounts'][_0x12dfb4['id']],_0x12dfb4);}}}return _0x563df6[_0x6fd2('0x67')];};};module[_0x6fd2('0x68')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index c041a9e..c4a72b4 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 _0xcdb0=['monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','membername','isArray','forEach','startsWith','Local','substring','indexOf','mobile','phone','transfererlinkedid','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','queuecallerexit','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','exten','type','queue','context','calleridnum','channel','callerid','originatecalleridnum','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','blindTransfer','monitor'];(function(_0x47635e,_0xfa18e0){var _0x3d7b0c=function(_0x5d2bb0){while(--_0x5d2bb0){_0x47635e['push'](_0x47635e['shift']());}};_0x3d7b0c(++_0xfa18e0);}(_0xcdb0,0xb0));var _0x0cdb=function(_0x1c9623,_0xf8dd7d){_0x1c9623=_0x1c9623-0x0;var _0x5a9d11=_0xcdb0[_0x1c9623];return _0x5a9d11;};'use strict';var _=require('lodash');var moment=require(_0x0cdb('0x0'));var util=require(_0x0cdb('0x1'));var config=require(_0x0cdb('0x2'));var ami=require(_0x0cdb('0x3'));var RpcVoiceAgentReport=require(_0x0cdb('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x0cdb('0x5'));var RpcMemberReport=require(_0x0cdb('0x6'));var RpcVoiceQueueReport=require(_0x0cdb('0x7'));var RpcVoiceRecording=require(_0x0cdb('0x8'));var RpcVoiceTransferReport=require(_0x0cdb('0x9'));var VoiceQueueReport=require(_0x0cdb('0xa'));var VoiceCallReport=require(_0x0cdb('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x0cdb('0xc'));var UserReport=require(_0x0cdb('0xd'));function Report(_0x16bc7f){this[_0x0cdb('0xe')]=_0x16bc7f;this[_0x0cdb('0xf')]=_0x16bc7f[_0x0cdb('0xf')];this['telephones']=_0x16bc7f[_0x0cdb('0x10')];}Report[_0x0cdb('0x11')]['sync']=function(_0x2ae801){var _0x217939=new VoiceQueueReport(this['realtime']);var _0x5980eb=new VoiceAgentReport(this[_0x0cdb('0xe')]);var _0x5cad91=new VoiceDialReport(this[_0x0cdb('0xe')]);var _0x3ed6be=new VoiceCallReport(this[_0x0cdb('0xe')]);var _0x56bb35=new UserReport(this[_0x0cdb('0xe')]);if(config['xdr']&&config['xdr'][_0x0cdb('0x12')]){ami['on'](_0x0cdb('0x13'),this[_0x0cdb('0x14')][_0x0cdb('0x15')](this));ami['on'](_0x0cdb('0x16'),this[_0x0cdb('0x17')][_0x0cdb('0x15')](this));ami['on'](_0x0cdb('0x18'),this[_0x0cdb('0x19')]['bind'](this));ami['on'](_0x0cdb('0x1a'),this[_0x0cdb('0x1b')][_0x0cdb('0x15')](this));ami['on']('blindtransfer',this['blindTransfer'][_0x0cdb('0x15')](this));ami['on']('attendedtransfer',this[_0x0cdb('0x1c')][_0x0cdb('0x15')](this));}};Report[_0x0cdb('0x11')][_0x0cdb('0x1d')]=function(_0x28e0a0){var _0x59a441;_0x59a441=_[_0x0cdb('0x1e')](this[_0x0cdb('0xf')],function(_0x5ead34){return _0x5ead34[_0x0cdb('0x1f')]==_0x28e0a0||_0x5ead34[_0x0cdb('0x20')]==_0x28e0a0;});if(_[_0x0cdb('0x21')](_0x59a441)){var _0x4a169c=_[_0x0cdb('0x1e')](this[_0x0cdb('0x10')],function(_0x544f4e){return _0x544f4e[_0x0cdb('0x1f')]==_0x28e0a0||_0x544f4e[_0x0cdb('0x20')]==_0x28e0a0;});if(_0x4a169c){_0x59a441=_['find'](this[_0x0cdb('0xf')],function(_0xffab0c){return _0xffab0c[_0x0cdb('0x22')]==util[_0x0cdb('0x23')](_0x0cdb('0x24'),_0x4a169c[_0x0cdb('0x20')]);});}}return _0x59a441;};Report[_0x0cdb('0x11')][_0x0cdb('0x14')]=function(_0x39e74b){for(var _0x3bfeb7=0x0;_0x3bfeb7<_0x39e74b[_0x0cdb('0x25')];_0x3bfeb7+=0x1){var _0x58d019=this['findAgent'](_0x39e74b[_0x3bfeb7]['connectedlinenum']);if(_0x58d019){_0x39e74b[_0x3bfeb7]['accountcode']=_0x58d019[_0x0cdb('0x1f')];_0x39e74b[_0x3bfeb7]['assigned']=!![];_0x39e74b[_0x3bfeb7][_0x0cdb('0x26')]=_0x58d019['name'];_0x39e74b[_0x3bfeb7][_0x0cdb('0x22')]=_[_0x0cdb('0x21')](_0x58d019[_0x0cdb('0x22')])?util[_0x0cdb('0x23')](_0x0cdb('0x24'),_0x58d019['name']):_0x58d019[_0x0cdb('0x22')];if(_0x39e74b[_0x3bfeb7][_0x0cdb('0x27')]){_0x39e74b[_0x3bfeb7][_0x0cdb('0x28')]=moment()[_0x0cdb('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x39e74b[_0x3bfeb7][_0x0cdb('0x29')]){_0x39e74b[_0x3bfeb7]['queuecallerexitAt']=moment()[_0x0cdb('0x23')](_0x0cdb('0x2a'));}RpcMemberReport['voiceQueueReport'](_0x39e74b[_0x3bfeb7]);}RpcVoiceQueueReport[_0x0cdb('0x2b')](_0x39e74b[_0x3bfeb7]);}};function extractCalleridNumber(_0x31fae1){var _0x16aefd=_0x31fae1[_0x0cdb('0x2c')](/<(.*?)>/);return _0x16aefd?_0x16aefd[0x1]:_0x31fae1;}Report[_0x0cdb('0x11')][_0x0cdb('0x17')]=function(_0x3c448c){_0x3c448c[_0x0cdb('0x2d')]=_0x3c448c[_0x0cdb('0x2d')]||_0x3c448c[_0x0cdb('0x2e')];if(_0x3c448c[_0x0cdb('0x2f')]=='dialer'){_0x3c448c['lastapplication']=_0x0cdb('0x30');_0x3c448c['lastdata']=_0x3c448c[_0x0cdb('0x30')];if(_0x3c448c[_0x0cdb('0x31')]=='from-voip-provider'){_0x3c448c['accountcode']='';_0x3c448c[_0x0cdb('0x2d')]=extractCalleridNumber(_0x3c448c['callerid']);}else if(_0x3c448c[_0x0cdb('0x31')]=='from-sip'){if(_0x3c448c[_0x0cdb('0x2d')]=='xcally-motion-preview'){_0x3c448c['destination']=extractCalleridNumber(_0x3c448c['calleridpreview']);_0x3c448c[_0x0cdb('0x32')]=_0x3c448c['originatecalleridnum'];_0x3c448c['destinationchannel']=[_0x3c448c[_0x0cdb('0x33')],_0x3c448c[_0x0cdb('0x33')]=_0x3c448c['destinationchannel']][0x0];_0x3c448c[_0x0cdb('0x34')]=_0x3c448c['calleridpreview'];}else{_0x3c448c[_0x0cdb('0x2d')]=_0x3c448c['calleridnum'];_0x3c448c[_0x0cdb('0x32')]=_0x3c448c[_0x0cdb('0x35')];if(_0x3c448c['disposition']==_0x0cdb('0x36')){_0x3c448c['accountcode']=_0x3c448c[_0x0cdb('0x37')];}else{_0x3c448c[_0x0cdb('0x1f')]='';}}}}else{_0x3c448c[_0x0cdb('0x34')]=util[_0x0cdb('0x23')](_0x0cdb('0x38'),_0x3c448c[_0x0cdb('0x39')],_0x3c448c['calleridnum']);}if(RpcVoiceTransferReport['transfers'][_0x3c448c[_0x0cdb('0x3a')]]){var _0x175ebc=RpcVoiceTransferReport[_0x0cdb('0x3b')][_0x3c448c[_0x0cdb('0x3a')]];_0x175ebc[_0x0cdb('0x3c')]=_0x3c448c[_0x0cdb('0x3d')];RpcVoiceTransferReport[_0x0cdb('0x3e')](_0x175ebc);delete RpcVoiceTransferReport[_0x0cdb('0x3b')][_0x3c448c['linkedid']];}RpcVoiceCallReport[_0x0cdb('0x2b')](_0x3c448c);if(_0x3c448c[_0x0cdb('0x3f')]){for(var _0x4644c6=0x0;_0x4644c6<_0x3c448c[_0x0cdb('0x40')][_0x0cdb('0x25')];_0x4644c6+=0x1){_0x3c448c[_0x0cdb('0x41')]=_0x3c448c['monitors'][_0x4644c6][_0x0cdb('0x42')];_0x3c448c[_0x0cdb('0x43')]=_0x3c448c[_0x0cdb('0x40')][_0x4644c6]['createdAt'];if(_0x3c448c[_0x0cdb('0x2e')]==_0x0cdb('0x44')){_0x3c448c[_0x0cdb('0x32')]=_0x3c448c[_0x0cdb('0x37')];_0x3c448c[_0x0cdb('0x39')]=_0x3c448c['connectedlinename'];_0x3c448c['connectedlinenum']=_0x3c448c[_0x0cdb('0x1f')];_0x3c448c[_0x0cdb('0x45')]=_0x3c448c[_0x0cdb('0x46')];_0x3c448c[_0x0cdb('0x2e')]=_0x3c448c[_0x0cdb('0x35')];}else if(_0x3c448c['exten']=='xcally-motion-dialer'){_0x3c448c[_0x0cdb('0x32')]=_0x3c448c[_0x0cdb('0x2d')];_0x3c448c[_0x0cdb('0x2e')]=_0x3c448c[_0x0cdb('0x35')];}RpcVoiceRecording['create'](_0x3c448c);}}};Report[_0x0cdb('0x11')][_0x0cdb('0x19')]=function(_0xc66cfe){if(_[_0x0cdb('0x47')](_0xc66cfe)){_0xc66cfe[_0x0cdb('0x48')](function(_0x27f538){RpcVoiceAgentReport[_0x0cdb('0x2b')](_0x27f538);});}else{RpcVoiceAgentReport[_0x0cdb('0x2b')](_0xc66cfe);}};Report[_0x0cdb('0x11')][_0x0cdb('0x1b')]=function(_0x3545e9){RpcVoiceDialReport['create'](_0x3545e9);var _0x220ec4;var _0x3737a9;var _0x15a87d=_0x3545e9[_0x0cdb('0x33')];if(_[_0x0cdb('0x49')](_0x15a87d,_0x0cdb('0x4a'))){_0x3737a9=_0x15a87d[_0x0cdb('0x4b')](_0x15a87d['indexOf']('/')+0x1,_0x15a87d[_0x0cdb('0x4c')]('@'));_0x220ec4=_[_0x0cdb('0x1e')](this[_0x0cdb('0xf')],function(_0x2e6828){return _0x2e6828[_0x0cdb('0x4d')]==_0x3737a9||_0x2e6828[_0x0cdb('0x4e')]==_0x3737a9||_0x2e6828[_0x0cdb('0x1f')]==_0x3737a9;});}else{_0x3737a9=_0x15a87d[_0x0cdb('0x4b')](_0x15a87d[_0x0cdb('0x4c')]('/')+0x1,_0x15a87d['lastIndexOf']('-'));_0x220ec4=this[_0x0cdb('0x1d')](_0x3737a9);}if(_0x220ec4){_0x3545e9['interface']=_[_0x0cdb('0x21')](_0x220ec4[_0x0cdb('0x22')])?util[_0x0cdb('0x23')]('SIP/%s',_0x220ec4[_0x0cdb('0x20')]):_0x220ec4[_0x0cdb('0x22')];_0x3545e9[_0x0cdb('0x46')]=_0x220ec4[_0x0cdb('0x20')];_0x3545e9['accountcode']=_0x220ec4[_0x0cdb('0x1f')];RpcMemberReport['voiceDialReport'](_0x3545e9);}};Report['prototype'][_0x0cdb('0x3e')]=function(_0x29126f){RpcVoiceTransferReport[_0x0cdb('0x3b')][_0x29126f[_0x0cdb('0x4f')]]=_0x29126f;};Report[_0x0cdb('0x11')][_0x0cdb('0x1c')]=function(_0x254944){RpcVoiceTransferReport[_0x0cdb('0x1c')](_0x254944);};module['exports']=Report; \ No newline at end of file +var _0xaf9c=['queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','destination','exten','dialer','lastapplication','queue','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','disposition','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','monitors','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceDialReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','interface','format','SIP/%s','length','assigned','isNil'];(function(_0x4712e2,_0x1c1133){var _0x10c781=function(_0x503d61){while(--_0x503d61){_0x4712e2['push'](_0x4712e2['shift']());}};_0x10c781(++_0x1c1133);}(_0xaf9c,0x87));var _0xcaf9=function(_0x817d9b,_0x3c37e3){_0x817d9b=_0x817d9b-0x0;var _0x2752e1=_0xaf9c[_0x817d9b];return _0x2752e1;};'use strict';var _=require(_0xcaf9('0x0'));var moment=require(_0xcaf9('0x1'));var util=require(_0xcaf9('0x2'));var config=require(_0xcaf9('0x3'));var ami=require(_0xcaf9('0x4'));var RpcVoiceAgentReport=require(_0xcaf9('0x5'));var RpcVoiceCallReport=require(_0xcaf9('0x6'));var RpcVoiceDialReport=require(_0xcaf9('0x7'));var RpcMemberReport=require(_0xcaf9('0x8'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xcaf9('0x9'));var RpcVoiceTransferReport=require(_0xcaf9('0xa'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xcaf9('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xcaf9('0xc'));var UserReport=require('./userReport');function Report(_0x9c6dd6){this['realtime']=_0x9c6dd6;this[_0xcaf9('0xd')]=_0x9c6dd6[_0xcaf9('0xd')];this['telephones']=_0x9c6dd6[_0xcaf9('0xe')];}Report[_0xcaf9('0xf')][_0xcaf9('0x10')]=function(_0x49d9f9){var _0x91369d=new VoiceQueueReport(this[_0xcaf9('0x11')]);var _0x48edbe=new VoiceAgentReport(this[_0xcaf9('0x11')]);var _0x118637=new VoiceDialReport(this['realtime']);var _0x43cd11=new VoiceCallReport(this['realtime']);var _0x39f43b=new UserReport(this[_0xcaf9('0x11')]);if(config[_0xcaf9('0x12')]&&config[_0xcaf9('0x12')][_0xcaf9('0x13')]){ami['on'](_0xcaf9('0x14'),this[_0xcaf9('0x15')][_0xcaf9('0x16')](this));ami['on'](_0xcaf9('0x17'),this[_0xcaf9('0x18')]['bind'](this));ami['on'](_0xcaf9('0x19'),this[_0xcaf9('0x1a')][_0xcaf9('0x16')](this));ami['on'](_0xcaf9('0x1b'),this['voiceDialReport']['bind'](this));ami['on'](_0xcaf9('0x1c'),this['blindTransfer'][_0xcaf9('0x16')](this));ami['on'](_0xcaf9('0x1d'),this[_0xcaf9('0x1e')][_0xcaf9('0x16')](this));}};Report[_0xcaf9('0xf')][_0xcaf9('0x1f')]=function(_0x59915b){var _0x157c30;_0x157c30=_[_0xcaf9('0x20')](this[_0xcaf9('0xd')],function(_0x117603){return _0x117603[_0xcaf9('0x21')]==_0x59915b||_0x117603['name']==_0x59915b;});if(_['isNil'](_0x157c30)){var _0x2b4ab1=_['find'](this['telephones'],function(_0x492b1a){return _0x492b1a[_0xcaf9('0x21')]==_0x59915b||_0x492b1a[_0xcaf9('0x22')]==_0x59915b;});if(_0x2b4ab1){_0x157c30=_['find'](this[_0xcaf9('0xd')],function(_0xb55b2a){return _0xb55b2a[_0xcaf9('0x23')]==util[_0xcaf9('0x24')](_0xcaf9('0x25'),_0x2b4ab1['name']);});}}return _0x157c30;};Report[_0xcaf9('0xf')][_0xcaf9('0x15')]=function(_0x31036d){for(var _0x4f5634=0x0;_0x4f5634<_0x31036d[_0xcaf9('0x26')];_0x4f5634+=0x1){var _0x213b53=this['findAgent'](_0x31036d[_0x4f5634]['connectedlinenum']);if(_0x213b53){_0x31036d[_0x4f5634]['accountcode']=_0x213b53[_0xcaf9('0x21')];_0x31036d[_0x4f5634][_0xcaf9('0x27')]=!![];_0x31036d[_0x4f5634]['lastAssignedTo']=_0x213b53[_0xcaf9('0x22')];_0x31036d[_0x4f5634]['interface']=_[_0xcaf9('0x28')](_0x213b53[_0xcaf9('0x23')])?util['format'](_0xcaf9('0x25'),_0x213b53['name']):_0x213b53[_0xcaf9('0x23')];if(_0x31036d[_0x4f5634][_0xcaf9('0x29')]){_0x31036d[_0x4f5634]['queuecallercompleteAt']=moment()['format'](_0xcaf9('0x2a'));}if(_0x31036d[_0x4f5634][_0xcaf9('0x2b')]){_0x31036d[_0x4f5634][_0xcaf9('0x2c')]=moment()[_0xcaf9('0x24')](_0xcaf9('0x2a'));}RpcMemberReport[_0xcaf9('0x15')](_0x31036d[_0x4f5634]);}RpcVoiceQueueReport[_0xcaf9('0x2d')](_0x31036d[_0x4f5634]);}};function extractCalleridNumber(_0x393272){var _0x1b6e64=_0x393272['match'](/<(.*?)>/);return _0x1b6e64?_0x1b6e64[0x1]:_0x393272;}Report['prototype'][_0xcaf9('0x18')]=function(_0x3db9a8){_0x3db9a8[_0xcaf9('0x2e')]=_0x3db9a8[_0xcaf9('0x2e')]||_0x3db9a8[_0xcaf9('0x2f')];if(_0x3db9a8['type']==_0xcaf9('0x30')){_0x3db9a8[_0xcaf9('0x31')]=_0xcaf9('0x32');_0x3db9a8['lastdata']=_0x3db9a8[_0xcaf9('0x32')];if(_0x3db9a8['context']==_0xcaf9('0x33')){_0x3db9a8[_0xcaf9('0x21')]='';_0x3db9a8[_0xcaf9('0x2e')]=extractCalleridNumber(_0x3db9a8[_0xcaf9('0x34')]);}else if(_0x3db9a8[_0xcaf9('0x35')]==_0xcaf9('0x36')){if(_0x3db9a8[_0xcaf9('0x2e')]==_0xcaf9('0x37')){_0x3db9a8[_0xcaf9('0x2e')]=extractCalleridNumber(_0x3db9a8[_0xcaf9('0x38')]);_0x3db9a8[_0xcaf9('0x39')]=_0x3db9a8[_0xcaf9('0x3a')];_0x3db9a8[_0xcaf9('0x3b')]=[_0x3db9a8[_0xcaf9('0x3c')],_0x3db9a8[_0xcaf9('0x3c')]=_0x3db9a8[_0xcaf9('0x3b')]][0x0];_0x3db9a8[_0xcaf9('0x34')]=_0x3db9a8[_0xcaf9('0x38')];}else{_0x3db9a8[_0xcaf9('0x2e')]=_0x3db9a8[_0xcaf9('0x39')];_0x3db9a8['calleridnum']=_0x3db9a8[_0xcaf9('0x3a')];if(_0x3db9a8[_0xcaf9('0x3d')]=='ANSWERED'){_0x3db9a8['accountcode']=_0x3db9a8[_0xcaf9('0x3e')];}else{_0x3db9a8[_0xcaf9('0x21')]='';}}}}else{_0x3db9a8['callerid']=util[_0xcaf9('0x24')](_0xcaf9('0x3f'),_0x3db9a8[_0xcaf9('0x40')],_0x3db9a8[_0xcaf9('0x39')]);}if(RpcVoiceTransferReport[_0xcaf9('0x41')][_0x3db9a8[_0xcaf9('0x42')]]){var _0x2d19e0=RpcVoiceTransferReport[_0xcaf9('0x41')][_0x3db9a8[_0xcaf9('0x42')]];_0x2d19e0[_0xcaf9('0x43')]=_0x3db9a8[_0xcaf9('0x44')];RpcVoiceTransferReport[_0xcaf9('0x45')](_0x2d19e0);delete RpcVoiceTransferReport[_0xcaf9('0x41')][_0x3db9a8['linkedid']];}RpcVoiceCallReport['create'](_0x3db9a8);if(_0x3db9a8['monitor']){for(var _0x2b3b5=0x0;_0x2b3b5<_0x3db9a8[_0xcaf9('0x46')][_0xcaf9('0x26')];_0x2b3b5+=0x1){_0x3db9a8['monitorFilename']=_0x3db9a8[_0xcaf9('0x46')][_0x2b3b5][_0xcaf9('0x47')];_0x3db9a8[_0xcaf9('0x48')]=_0x3db9a8['monitors'][_0x2b3b5][_0xcaf9('0x48')];if(_0x3db9a8['exten']==_0xcaf9('0x37')){_0x3db9a8[_0xcaf9('0x39')]=_0x3db9a8['connectedlinenum'];_0x3db9a8[_0xcaf9('0x40')]=_0x3db9a8[_0xcaf9('0x49')];_0x3db9a8[_0xcaf9('0x3e')]=_0x3db9a8[_0xcaf9('0x21')];_0x3db9a8[_0xcaf9('0x49')]=_0x3db9a8[_0xcaf9('0x4a')];_0x3db9a8[_0xcaf9('0x2f')]=_0x3db9a8[_0xcaf9('0x3a')];}else if(_0x3db9a8[_0xcaf9('0x2f')]==_0xcaf9('0x4b')){_0x3db9a8[_0xcaf9('0x39')]=_0x3db9a8[_0xcaf9('0x2e')];_0x3db9a8[_0xcaf9('0x2f')]=_0x3db9a8[_0xcaf9('0x3a')];}RpcVoiceRecording[_0xcaf9('0x2d')](_0x3db9a8);}}};Report[_0xcaf9('0xf')]['voiceAgentReport']=function(_0x4eb381){if(_[_0xcaf9('0x4c')](_0x4eb381)){_0x4eb381[_0xcaf9('0x4d')](function(_0xc20f5){RpcVoiceAgentReport[_0xcaf9('0x2d')](_0xc20f5);});}else{RpcVoiceAgentReport['create'](_0x4eb381);}};Report[_0xcaf9('0xf')][_0xcaf9('0x4e')]=function(_0x4623e5){RpcVoiceDialReport[_0xcaf9('0x2d')](_0x4623e5);var _0x589e83;var _0x2b3dda;var _0x4ecf9a=_0x4623e5[_0xcaf9('0x3c')];if(_[_0xcaf9('0x4f')](_0x4ecf9a,_0xcaf9('0x50'))){_0x2b3dda=_0x4ecf9a[_0xcaf9('0x51')](_0x4ecf9a[_0xcaf9('0x52')]('/')+0x1,_0x4ecf9a['indexOf']('@'));_0x589e83=_[_0xcaf9('0x20')](this[_0xcaf9('0xd')],function(_0x4a54a6){return _0x4a54a6[_0xcaf9('0x53')]==_0x2b3dda||_0x4a54a6[_0xcaf9('0x54')]==_0x2b3dda||_0x4a54a6['accountcode']==_0x2b3dda;});}else{_0x2b3dda=_0x4ecf9a[_0xcaf9('0x51')](_0x4ecf9a['indexOf']('/')+0x1,_0x4ecf9a[_0xcaf9('0x55')]('-'));_0x589e83=this[_0xcaf9('0x1f')](_0x2b3dda);}if(_0x589e83){_0x4623e5[_0xcaf9('0x23')]=_[_0xcaf9('0x28')](_0x589e83['interface'])?util[_0xcaf9('0x24')]('SIP/%s',_0x589e83['name']):_0x589e83[_0xcaf9('0x23')];_0x4623e5[_0xcaf9('0x4a')]=_0x589e83[_0xcaf9('0x22')];_0x4623e5[_0xcaf9('0x21')]=_0x589e83[_0xcaf9('0x21')];RpcMemberReport['voiceDialReport'](_0x4623e5);}};Report['prototype'][_0xcaf9('0x45')]=function(_0x1ecc4b){RpcVoiceTransferReport[_0xcaf9('0x41')][_0x1ecc4b[_0xcaf9('0x56')]]=_0x1ecc4b;};Report[_0xcaf9('0xf')][_0xcaf9('0x1e')]=function(_0x51b364){RpcVoiceTransferReport[_0xcaf9('0x1e')](_0x51b364);};module[_0xcaf9('0x57')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index f9d21d6..1c15a95 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 _0x6c65=['moment','util','ioredis','bluebird','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','trunks','agents','telephones','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][devicestatelist]','inspect','actionSipPeerStatus','prototype','isNotNull','isUndefined','emit','syncRegistry','info','debug','[userReport][registry]','find','stateRegistry','state','omit','event','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','name','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','format','updateStatusRealtime','telephone:%s','telephone:save','trunk:save','startsWith','Local','substring','indexOf','phone','accountcode','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash'];(function(_0x14eea5,_0x4088b4){var _0x33cfb6=function(_0x2502da){while(--_0x2502da){_0x14eea5['push'](_0x14eea5['shift']());}};_0x33cfb6(++_0x4088b4);}(_0x6c65,0x8f));var _0x56c6=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x6c65[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x56c6('0x0'));var moment=require(_0x56c6('0x1'));var util=require(_0x56c6('0x2'));var Redis=require(_0x56c6('0x3'));var BPromise=require(_0x56c6('0x4'));var config=require('../../../config/environment');var logger=require(_0x56c6('0x5'))(_0x56c6('0x6'));var ami=require('../ami');config[_0x56c6('0x7')]=_[_0x56c6('0x8')](config[_0x56c6('0x7')],{'host':_0x56c6('0x9'),'port':0x18eb});var io=require(_0x56c6('0xa'))(new Redis(config[_0x56c6('0x7')]));function UserReport(_0x3f5974){this[_0x56c6('0xb')]=_0x3f5974[_0x56c6('0xb')];this[_0x56c6('0xc')]=_0x3f5974['agents'];this[_0x56c6('0xd')]=_0x3f5974['telephones'];ami['on']('registryentry',this['syncRegistry'][_0x56c6('0xe')](this));ami['on'](_0x56c6('0xf'),this['syncRegistry']['bind'](this));ami['on'](_0x56c6('0x10'),this[_0x56c6('0x11')]['bind'](this));ami['on'](_0x56c6('0x12'),this[_0x56c6('0x13')][_0x56c6('0xe')](this));return this[_0x56c6('0x14')]();}function showSipRegistrations(){Promise[_0x56c6('0x15')]()[_0x56c6('0x16')](ami[_0x56c6('0x17')]())[_0x56c6('0x18')](function(_0x57f9c0){logger[_0x56c6('0x19')]('[userReport][sipshowregistry]',util['inspect'](_0x57f9c0,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x56c6('0x15')]()[_0x56c6('0x16')](ami['actionDeviceStateList']())[_0x56c6('0x18')](function(_0x75c358){logger['error'](_0x56c6('0x1a'),util[_0x56c6('0x1b')](_0x75c358,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x56c6('0x15')]()[_0x56c6('0x16')](ami[_0x56c6('0x1c')]())[_0x56c6('0x18')](function(_0x426c18){logger[_0x56c6('0x19')]('[userReport][sippeerstatus]',util[_0x56c6('0x1b')](_0x426c18,{'showHidden':![],'depth':null}));});}UserReport[_0x56c6('0x1d')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0x56c6('0x15')]()[_0x56c6('0x16')](showSipRegistrations())[_0x56c6('0x16')](listDeviceStates())[_0x56c6('0x16')](showPeersStatus());},0x32c8);};UserReport[_0x56c6('0x1d')][_0x56c6('0x1e')]=function(_0x1c3e7a){return _0x1c3e7a!==null&&!_[_0x56c6('0x1f')](_0x1c3e7a);};UserReport[_0x56c6('0x1d')][_0x56c6('0x20')]=function(_0x2a595a,_0x5e8818,_0x132b4a){io['to'](_0x2a595a)[_0x56c6('0x20')](_0x5e8818,_0x132b4a);};UserReport[_0x56c6('0x1d')][_0x56c6('0x21')]=function(_0x299e1c){try{if(this[_0x56c6('0x1e')](_0x299e1c)){logger[_0x56c6('0x22')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x299e1c['username'],_0x299e1c['state']);logger[_0x56c6('0x23')](_0x56c6('0x24'),util[_0x56c6('0x1b')](_0x299e1c,{'showHidden':![],'depth':null}));var _0xd941cd=_[_0x56c6('0x25')](this['trunks'],{'defaultuser':_0x299e1c['username']});if(_0xd941cd){_0x299e1c[_0x56c6('0x26')]=_0x299e1c[_0x56c6('0x27')];_['merge'](_0xd941cd,_[_0x56c6('0x28')](_0x299e1c,[_0x56c6('0x29'),_0x56c6('0x2a'),'username',_0x56c6('0x27')]));logger[_0x56c6('0x23')](_0x56c6('0x2b'),util[_0x56c6('0x1b')](_0xd941cd,{'showHidden':![],'depth':null}));this[_0x56c6('0x20')](util['format'](_0x56c6('0x2c'),_0xd941cd[_0x56c6('0x2d')]),'trunk:save',_0xd941cd);}}}catch(_0x36f3d8){logger[_0x56c6('0x19')](_0x56c6('0x24'),util[_0x56c6('0x1b')](_0x36f3d8,{'showHidden':![],'depth':null}));}};UserReport[_0x56c6('0x1d')][_0x56c6('0x11')]=function(_0x19ad1e){try{if(this[_0x56c6('0x1e')](_0x19ad1e)){logger['info'](_0x56c6('0x2e'),_0x19ad1e[_0x56c6('0x2f')],_0x19ad1e['state']);logger['debug'](_0x56c6('0x30'),util[_0x56c6('0x1b')](_0x19ad1e,{'showHidden':![],'depth':null}));if(this[_0x56c6('0xc')][_0x19ad1e['device']]){if(!this[_0x56c6('0xc')][_0x19ad1e['device']][_0x56c6('0x31')]||_0x19ad1e[_0x56c6('0x27')][_0x56c6('0x32')]()==_0x56c6('0x33')){this[_0x56c6('0xc')][_0x19ad1e['device']][_0x56c6('0x31')]=![];if(this[_0x56c6('0xc')][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x27')]!==_0x19ad1e[_0x56c6('0x27')][_0x56c6('0x32')]()){this['agents'][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x34')]=_[_0x56c6('0x35')](moment()[_0x56c6('0x36')]('x'));}this[_0x56c6('0xc')][_0x19ad1e['device']][_0x56c6('0x27')]=_0x19ad1e[_0x56c6('0x27')][_0x56c6('0x32')]();this['agents'][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x37')](_0x19ad1e);}}else if(this[_0x56c6('0xd')][_0x19ad1e[_0x56c6('0x2f')]]){if(this[_0x56c6('0xd')][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x27')]!==_0x19ad1e[_0x56c6('0x27')][_0x56c6('0x32')]()){this[_0x56c6('0xd')][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x34')]=_[_0x56c6('0x35')](moment()[_0x56c6('0x36')]('x'));}this[_0x56c6('0xd')][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x27')]=_0x19ad1e['state'][_0x56c6('0x32')]();logger[_0x56c6('0x23')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x56c6('0x1b')](this[_0x56c6('0xd')][_0x19ad1e[_0x56c6('0x2f')]],{'showHidden':![],'depth':null}));this[_0x56c6('0x20')](util[_0x56c6('0x36')](_0x56c6('0x38'),this[_0x56c6('0xd')][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x2d')]),_0x56c6('0x39'),this[_0x56c6('0xd')][_0x19ad1e[_0x56c6('0x2f')]]);}else if(this['trunks'][_0x19ad1e[_0x56c6('0x2f')]]){if(this[_0x56c6('0xb')][_0x19ad1e['device']]['state']!==_0x19ad1e[_0x56c6('0x27')][_0x56c6('0x32')]()){this[_0x56c6('0xb')][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x34')]=_['toNumber'](moment()[_0x56c6('0x36')]('x'));}this['trunks'][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x27')]=_0x19ad1e[_0x56c6('0x27')][_0x56c6('0x32')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x56c6('0x1b')](this[_0x56c6('0xb')][_0x19ad1e[_0x56c6('0x2f')]],{'showHidden':![],'depth':null}));this['emit'](util['format']('trunk:%s',this[_0x56c6('0xb')][_0x19ad1e[_0x56c6('0x2f')]][_0x56c6('0x2d')]),_0x56c6('0x3a'),this[_0x56c6('0xb')][_0x19ad1e[_0x56c6('0x2f')]]);}else if(_[_0x56c6('0x3b')](_0x19ad1e['device'],_0x56c6('0x3c'))){var _0x194677=_0x19ad1e[_0x56c6('0x2f')];var _0x49cd2c=_0x194677[_0x56c6('0x3d')](_0x194677[_0x56c6('0x3e')]('/')+0x1,_0x194677[_0x56c6('0x3e')]('@'));var _0x5ed826=_['find'](this['agents'],function(_0x953a76){return _0x953a76['mobile']==_0x49cd2c||_0x953a76[_0x56c6('0x3f')]==_0x49cd2c||_0x953a76[_0x56c6('0x40')]==_0x49cd2c;});if(_0x5ed826){if(_0x5ed826['state']!==_0x19ad1e[_0x56c6('0x27')][_0x56c6('0x32')]()){_0x5ed826[_0x56c6('0x34')]=_['toNumber'](moment()[_0x56c6('0x36')]('x'));}_0x5ed826[_0x56c6('0x27')]=_0x19ad1e[_0x56c6('0x27')][_0x56c6('0x32')]();_0x5ed826['local']=!![];_0x5ed826['updateStatusRealtime'](_0x19ad1e);}}}}catch(_0x1a3cd6){logger['error'](_0x56c6('0x30'),util[_0x56c6('0x1b')](_0x1a3cd6,{'showHidden':![],'depth':null}));}};UserReport[_0x56c6('0x1d')]['syncPeerStatus']=function(_0x36b25d){try{if(this[_0x56c6('0x1e')](_0x36b25d)&&this[_0x56c6('0x1e')](_0x36b25d['peerstatus'])){logger[_0x56c6('0x22')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x36b25d[_0x56c6('0x41')],_0x36b25d[_0x56c6('0x42')],_0x36b25d[_0x56c6('0x12')]);logger[_0x56c6('0x23')](_0x56c6('0x43'),util[_0x56c6('0x1b')](_0x36b25d,{'showHidden':![],'depth':null}));if(this[_0x56c6('0xc')][_0x36b25d['peer']]){if(!this[_0x56c6('0xc')][_0x36b25d[_0x56c6('0x41')]]['local']||_0x36b25d[_0x56c6('0x12')][_0x56c6('0x32')]()==_0x56c6('0x44')){this[_0x56c6('0xc')][_0x36b25d[_0x56c6('0x41')]][_0x56c6('0x31')]=![];this[_0x56c6('0xc')][_0x36b25d[_0x56c6('0x41')]]['status']=_0x36b25d[_0x56c6('0x12')]['toLowerCase']();this[_0x56c6('0xc')][_0x36b25d[_0x56c6('0x41')]][_0x56c6('0x42')]=_0x36b25d[_0x56c6('0x42')];this[_0x56c6('0xc')][_0x36b25d[_0x56c6('0x41')]][_0x56c6('0x37')](_0x36b25d);}}else if(this[_0x56c6('0xd')][_0x36b25d['peer']]){this[_0x56c6('0xd')][_0x36b25d[_0x56c6('0x41')]][_0x56c6('0x45')]=_0x36b25d[_0x56c6('0x12')][_0x56c6('0x32')]();this['telephones'][_0x36b25d[_0x56c6('0x41')]][_0x56c6('0x42')]=_0x36b25d['address'];logger[_0x56c6('0x23')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x56c6('0x1b')](this[_0x56c6('0xd')][_0x36b25d['peer']],{'showHidden':![],'depth':null}));this[_0x56c6('0x20')](util['format']('telephone:%s',this[_0x56c6('0xd')][_0x36b25d[_0x56c6('0x41')]]['name']),_0x56c6('0x39'),this['telephones'][_0x36b25d[_0x56c6('0x41')]]);}else if(this[_0x56c6('0xb')][_0x36b25d[_0x56c6('0x41')]]){this[_0x56c6('0xb')][_0x36b25d['peer']][_0x56c6('0x45')]=_0x36b25d['peerstatus']['toLowerCase']();this[_0x56c6('0xb')][_0x36b25d[_0x56c6('0x41')]][_0x56c6('0x42')]=_0x36b25d[_0x56c6('0x42')];logger['debug'](_0x56c6('0x46'),util[_0x56c6('0x1b')](this[_0x56c6('0xb')][_0x36b25d[_0x56c6('0x41')]],{'showHidden':![],'depth':null}));this[_0x56c6('0x20')](util[_0x56c6('0x36')]('trunk:%s',this[_0x56c6('0xb')][_0x36b25d[_0x56c6('0x41')]][_0x56c6('0x2d')]),_0x56c6('0x3a'),this[_0x56c6('0xb')][_0x36b25d[_0x56c6('0x41')]]);}}}catch(_0x5b88a0){logger[_0x56c6('0x19')]('[userReport][peerstatus]',util[_0x56c6('0x1b')](_0x5b88a0,{'showHidden':![],'depth':null}));}};module[_0x56c6('0x47')]=UserReport; \ No newline at end of file +var _0xc0b8=['resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','find','trunks','username','stateRegistry','merge','omit','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','name','trunk:save','[userReport][registry]','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','inuse','toLowerCase','stateTime','format','updateStatusRealtime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','indexOf','phone','accountcode','local','peer','[userReport][peerstatus]','registered','status','address','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','../ami','defaults','redis','localhost','socket.io-emitter','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','peerstatus','syncPeerStatus','syncRealtimeShow'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xc0b8,0x123));var _0x8c0b=function(_0x19b5fe,_0x23eb2e){_0x19b5fe=_0x19b5fe-0x0;var _0x1f1819=_0xc0b8[_0x19b5fe];return _0x1f1819;};'use strict';var _=require('lodash');var moment=require(_0x8c0b('0x0'));var util=require(_0x8c0b('0x1'));var Redis=require(_0x8c0b('0x2'));var BPromise=require(_0x8c0b('0x3'));var config=require(_0x8c0b('0x4'));var logger=require(_0x8c0b('0x5'))('ami');var ami=require(_0x8c0b('0x6'));config['redis']=_[_0x8c0b('0x7')](config[_0x8c0b('0x8')],{'host':_0x8c0b('0x9'),'port':0x18eb});var io=require(_0x8c0b('0xa'))(new Redis(config[_0x8c0b('0x8')]));function UserReport(_0x4f6582){this['trunks']=_0x4f6582['trunks'];this[_0x8c0b('0xb')]=_0x4f6582[_0x8c0b('0xb')];this['telephones']=_0x4f6582[_0x8c0b('0xc')];ami['on'](_0x8c0b('0xd'),this[_0x8c0b('0xe')][_0x8c0b('0xf')](this));ami['on'](_0x8c0b('0x10'),this[_0x8c0b('0xe')][_0x8c0b('0xf')](this));ami['on'](_0x8c0b('0x11'),this['syncDeviceState'][_0x8c0b('0xf')](this));ami['on'](_0x8c0b('0x12'),this[_0x8c0b('0x13')][_0x8c0b('0xf')](this));return this[_0x8c0b('0x14')]();}function showSipRegistrations(){Promise[_0x8c0b('0x15')]()[_0x8c0b('0x16')](ami[_0x8c0b('0x17')]())[_0x8c0b('0x18')](function(_0x21d0b0){logger[_0x8c0b('0x19')](_0x8c0b('0x1a'),util[_0x8c0b('0x1b')](_0x21d0b0,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x8c0b('0x15')]()[_0x8c0b('0x16')](ami[_0x8c0b('0x1c')]())[_0x8c0b('0x18')](function(_0x33f09b){logger[_0x8c0b('0x19')](_0x8c0b('0x1d'),util[_0x8c0b('0x1b')](_0x33f09b,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x8c0b('0x15')]()['then'](ami[_0x8c0b('0x1e')]())[_0x8c0b('0x18')](function(_0x3e2f25){logger[_0x8c0b('0x19')](_0x8c0b('0x1f'),util[_0x8c0b('0x1b')](_0x3e2f25,{'showHidden':![],'depth':null}));});}UserReport[_0x8c0b('0x20')][_0x8c0b('0x14')]=function(){setInterval(function(){BPromise['resolve']()[_0x8c0b('0x16')](showSipRegistrations())[_0x8c0b('0x16')](listDeviceStates())[_0x8c0b('0x16')](showPeersStatus());},0x32c8);};UserReport[_0x8c0b('0x20')][_0x8c0b('0x21')]=function(_0x229bd8){return _0x229bd8!==null&&!_[_0x8c0b('0x22')](_0x229bd8);};UserReport[_0x8c0b('0x20')][_0x8c0b('0x23')]=function(_0x595789,_0x40e2cc,_0x52a72c){io['to'](_0x595789)[_0x8c0b('0x23')](_0x40e2cc,_0x52a72c);};UserReport['prototype'][_0x8c0b('0xe')]=function(_0x167580){try{if(this[_0x8c0b('0x21')](_0x167580)){logger[_0x8c0b('0x24')](_0x8c0b('0x25'),_0x167580['username'],_0x167580[_0x8c0b('0x26')]);logger[_0x8c0b('0x27')]('[userReport][registry]',util['inspect'](_0x167580,{'showHidden':![],'depth':null}));var _0x130773=_[_0x8c0b('0x28')](this[_0x8c0b('0x29')],{'defaultuser':_0x167580[_0x8c0b('0x2a')]});if(_0x130773){_0x167580[_0x8c0b('0x2b')]=_0x167580['state'];_[_0x8c0b('0x2c')](_0x130773,_[_0x8c0b('0x2d')](_0x167580,['event',_0x8c0b('0x2e'),_0x8c0b('0x2a'),_0x8c0b('0x26')]));logger[_0x8c0b('0x27')](_0x8c0b('0x2f'),util['inspect'](_0x130773,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x8c0b('0x30'),_0x130773[_0x8c0b('0x31')]),_0x8c0b('0x32'),_0x130773);}}}catch(_0x10bade){logger['error'](_0x8c0b('0x33'),util['inspect'](_0x10bade,{'showHidden':![],'depth':null}));}};UserReport[_0x8c0b('0x20')][_0x8c0b('0x34')]=function(_0x1cd353){try{if(this[_0x8c0b('0x21')](_0x1cd353)){logger[_0x8c0b('0x24')](_0x8c0b('0x35'),_0x1cd353[_0x8c0b('0x36')],_0x1cd353[_0x8c0b('0x26')]);logger['debug'](_0x8c0b('0x37'),util[_0x8c0b('0x1b')](_0x1cd353,{'showHidden':![],'depth':null}));if(this['agents'][_0x1cd353['device']]){if(!this[_0x8c0b('0xb')][_0x1cd353[_0x8c0b('0x36')]]['local']||_0x1cd353[_0x8c0b('0x26')]['toLowerCase']()==_0x8c0b('0x38')){this['agents'][_0x1cd353[_0x8c0b('0x36')]]['local']=![];if(this[_0x8c0b('0xb')][_0x1cd353[_0x8c0b('0x36')]]['state']!==_0x1cd353[_0x8c0b('0x26')][_0x8c0b('0x39')]()){this['agents'][_0x1cd353[_0x8c0b('0x36')]][_0x8c0b('0x3a')]=_['toNumber'](moment()[_0x8c0b('0x3b')]('x'));}this[_0x8c0b('0xb')][_0x1cd353[_0x8c0b('0x36')]]['state']=_0x1cd353[_0x8c0b('0x26')][_0x8c0b('0x39')]();this[_0x8c0b('0xb')][_0x1cd353[_0x8c0b('0x36')]][_0x8c0b('0x3c')](_0x1cd353);}}else if(this['telephones'][_0x1cd353[_0x8c0b('0x36')]]){if(this[_0x8c0b('0xc')][_0x1cd353[_0x8c0b('0x36')]]['state']!==_0x1cd353[_0x8c0b('0x26')]['toLowerCase']()){this[_0x8c0b('0xc')][_0x1cd353[_0x8c0b('0x36')]][_0x8c0b('0x3a')]=_[_0x8c0b('0x3d')](moment()[_0x8c0b('0x3b')]('x'));}this[_0x8c0b('0xc')][_0x1cd353[_0x8c0b('0x36')]][_0x8c0b('0x26')]=_0x1cd353[_0x8c0b('0x26')][_0x8c0b('0x39')]();logger[_0x8c0b('0x27')](_0x8c0b('0x3e'),util['inspect'](this[_0x8c0b('0xc')][_0x1cd353[_0x8c0b('0x36')]],{'showHidden':![],'depth':null}));this[_0x8c0b('0x23')](util[_0x8c0b('0x3b')]('telephone:%s',this[_0x8c0b('0xc')][_0x1cd353[_0x8c0b('0x36')]]['name']),_0x8c0b('0x3f'),this[_0x8c0b('0xc')][_0x1cd353['device']]);}else if(this['trunks'][_0x1cd353[_0x8c0b('0x36')]]){if(this[_0x8c0b('0x29')][_0x1cd353[_0x8c0b('0x36')]][_0x8c0b('0x26')]!==_0x1cd353[_0x8c0b('0x26')][_0x8c0b('0x39')]()){this['trunks'][_0x1cd353[_0x8c0b('0x36')]][_0x8c0b('0x3a')]=_[_0x8c0b('0x3d')](moment()[_0x8c0b('0x3b')]('x'));}this[_0x8c0b('0x29')][_0x1cd353[_0x8c0b('0x36')]]['state']=_0x1cd353[_0x8c0b('0x26')][_0x8c0b('0x39')]();logger[_0x8c0b('0x27')](_0x8c0b('0x40'),util[_0x8c0b('0x1b')](this[_0x8c0b('0x29')][_0x1cd353[_0x8c0b('0x36')]],{'showHidden':![],'depth':null}));this[_0x8c0b('0x23')](util[_0x8c0b('0x3b')](_0x8c0b('0x30'),this[_0x8c0b('0x29')][_0x1cd353[_0x8c0b('0x36')]][_0x8c0b('0x31')]),_0x8c0b('0x32'),this[_0x8c0b('0x29')][_0x1cd353[_0x8c0b('0x36')]]);}else if(_[_0x8c0b('0x41')](_0x1cd353[_0x8c0b('0x36')],_0x8c0b('0x42'))){var _0x3b2202=_0x1cd353[_0x8c0b('0x36')];var _0x57e71d=_0x3b2202['substring'](_0x3b2202[_0x8c0b('0x43')]('/')+0x1,_0x3b2202[_0x8c0b('0x43')]('@'));var _0x5eeca4=_['find'](this[_0x8c0b('0xb')],function(_0x548bbf){return _0x548bbf['mobile']==_0x57e71d||_0x548bbf[_0x8c0b('0x44')]==_0x57e71d||_0x548bbf[_0x8c0b('0x45')]==_0x57e71d;});if(_0x5eeca4){if(_0x5eeca4[_0x8c0b('0x26')]!==_0x1cd353[_0x8c0b('0x26')]['toLowerCase']()){_0x5eeca4[_0x8c0b('0x3a')]=_[_0x8c0b('0x3d')](moment()[_0x8c0b('0x3b')]('x'));}_0x5eeca4['state']=_0x1cd353['state'][_0x8c0b('0x39')]();_0x5eeca4[_0x8c0b('0x46')]=!![];_0x5eeca4[_0x8c0b('0x3c')](_0x1cd353);}}}}catch(_0x140da4){logger[_0x8c0b('0x19')]('[userReport][devicestatechange]',util[_0x8c0b('0x1b')](_0x140da4,{'showHidden':![],'depth':null}));}};UserReport[_0x8c0b('0x20')]['syncPeerStatus']=function(_0x4342ca){try{if(this['isNotNull'](_0x4342ca)&&this[_0x8c0b('0x21')](_0x4342ca[_0x8c0b('0x12')])){logger['info']('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x4342ca[_0x8c0b('0x47')],_0x4342ca['address'],_0x4342ca[_0x8c0b('0x12')]);logger['debug'](_0x8c0b('0x48'),util[_0x8c0b('0x1b')](_0x4342ca,{'showHidden':![],'depth':null}));if(this['agents'][_0x4342ca[_0x8c0b('0x47')]]){if(!this[_0x8c0b('0xb')][_0x4342ca[_0x8c0b('0x47')]]['local']||_0x4342ca['peerstatus'][_0x8c0b('0x39')]()==_0x8c0b('0x49')){this[_0x8c0b('0xb')][_0x4342ca[_0x8c0b('0x47')]]['local']=![];this['agents'][_0x4342ca[_0x8c0b('0x47')]][_0x8c0b('0x4a')]=_0x4342ca['peerstatus']['toLowerCase']();this[_0x8c0b('0xb')][_0x4342ca['peer']][_0x8c0b('0x4b')]=_0x4342ca[_0x8c0b('0x4b')];this['agents'][_0x4342ca[_0x8c0b('0x47')]][_0x8c0b('0x3c')](_0x4342ca);}}else if(this[_0x8c0b('0xc')][_0x4342ca['peer']]){this['telephones'][_0x4342ca['peer']][_0x8c0b('0x4a')]=_0x4342ca[_0x8c0b('0x12')]['toLowerCase']();this[_0x8c0b('0xc')][_0x4342ca[_0x8c0b('0x47')]][_0x8c0b('0x4b')]=_0x4342ca[_0x8c0b('0x4b')];logger[_0x8c0b('0x27')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x8c0b('0x1b')](this['telephones'][_0x4342ca['peer']],{'showHidden':![],'depth':null}));this[_0x8c0b('0x23')](util[_0x8c0b('0x3b')]('telephone:%s',this['telephones'][_0x4342ca['peer']][_0x8c0b('0x31')]),'telephone:save',this[_0x8c0b('0xc')][_0x4342ca[_0x8c0b('0x47')]]);}else if(this['trunks'][_0x4342ca[_0x8c0b('0x47')]]){this[_0x8c0b('0x29')][_0x4342ca[_0x8c0b('0x47')]][_0x8c0b('0x4a')]=_0x4342ca[_0x8c0b('0x12')][_0x8c0b('0x39')]();this[_0x8c0b('0x29')][_0x4342ca['peer']][_0x8c0b('0x4b')]=_0x4342ca[_0x8c0b('0x4b')];logger[_0x8c0b('0x27')](_0x8c0b('0x4c'),util[_0x8c0b('0x1b')](this[_0x8c0b('0x29')][_0x4342ca[_0x8c0b('0x47')]],{'showHidden':![],'depth':null}));this[_0x8c0b('0x23')](util['format']('trunk:%s',this[_0x8c0b('0x29')][_0x4342ca[_0x8c0b('0x47')]][_0x8c0b('0x31')]),'trunk:save',this[_0x8c0b('0x29')][_0x4342ca['peer']]);}}}catch(_0x19b9c4){logger[_0x8c0b('0x19')](_0x8c0b('0x48'),util[_0x8c0b('0x1b')](_0x19b9c4,{'showHidden':![],'depth':null}));}};module[_0x8c0b('0x4d')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 83be33a..058a9bc 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 _0xb2cb=['variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','varset','syncVarSet','musiconholdstart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','inspect','isUndefined','format','called','queue','mandatoryDisposition','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','YYYY-MM-DD\x20HH:mm:ss','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','hasOwnProperty','agentringnoanswerAt','abandoned','custom:agentqueuecallerabandon','syncAgentComplete','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','agent','talktime','acwTimeout','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','keys','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','variable','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','bridgepeer','membercalls','memberinterface','memberlastcall','memberrealtime','isNil','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','transfer','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','syncMusicOnHoldStart','channel','substring','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','ioredis','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','channels','voiceQueues','agents'];(function(_0x3e7260,_0x1fcd09){var _0x566ab8=function(_0x5aa90d){while(--_0x5aa90d){_0x3e7260['push'](_0x3e7260['shift']());}};_0x566ab8(++_0x1fcd09);}(_0xb2cb,0x8a));var _0xbb2c=function(_0xd8aad0,_0x4da2cd){_0xd8aad0=_0xd8aad0-0x0;var _0x570860=_0xb2cb[_0xd8aad0];return _0x570860;};'use strict';var _=require(_0xbb2c('0x0'));var moment=require(_0xbb2c('0x1'));var util=require(_0xbb2c('0x2'));var Redis=require(_0xbb2c('0x3'));var config=require('../../../config/environment');var logger=require(_0xbb2c('0x4'))(_0xbb2c('0x5'));var ami=require(_0xbb2c('0x6'));config['redis']=_[_0xbb2c('0x7')](config[_0xbb2c('0x8')],{'host':_0xbb2c('0x9'),'port':0x18eb});var io=require(_0xbb2c('0xa'))(new Redis(config['redis']));function VoiceAgentReport(_0xf1f24){this[_0xbb2c('0xb')]={};this['voiceChannels']=_0xf1f24['channels'];this[_0xbb2c('0xc')]=_0xf1f24[_0xbb2c('0xc')];this[_0xbb2c('0xd')]=_0xf1f24[_0xbb2c('0xd')];this[_0xbb2c('0xe')]={};ami['on'](_0xbb2c('0xf'),this[_0xbb2c('0x10')][_0xbb2c('0x11')](this));ami['on'](_0xbb2c('0x12'),this[_0xbb2c('0x13')][_0xbb2c('0x11')](this));ami['on']('agentringnoanswer',this[_0xbb2c('0x14')][_0xbb2c('0x11')](this));ami['on'](_0xbb2c('0x15'),this[_0xbb2c('0x16')][_0xbb2c('0x11')](this));ami['on'](_0xbb2c('0x17'),this['syncAgentComplete'][_0xbb2c('0x11')](this));ami['on'](_0xbb2c('0x18'),this[_0xbb2c('0x19')][_0xbb2c('0x11')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0xbb2c('0x1a'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0xbb2c('0x1b'),this['syncMusicOnHoldStop'][_0xbb2c('0x11')](this));ami['on'](_0xbb2c('0x1c'),this[_0xbb2c('0x1d')][_0xbb2c('0x11')](this));ami['on'](_0xbb2c('0x1e'),this[_0xbb2c('0x1f')]['bind'](this));}VoiceAgentReport['prototype']['emit']=function(_0xb9a13c,_0x555e25,_0x12609c){io['to'](_0xb9a13c)[_0xbb2c('0x20')](_0x555e25,_0x12609c);};VoiceAgentReport[_0xbb2c('0x21')][_0xbb2c('0x22')]=function(_0x53a8d6){return _0x53a8d6!==null&&!_['isUndefined'](_0x53a8d6);};VoiceAgentReport['prototype']['syncAgentCalled']=function(_0x24135a){try{if(this[_0xbb2c('0x22')](_0x24135a)){logger[_0xbb2c('0x23')](_0xbb2c('0x24'),_0x24135a[_0xbb2c('0x25')],_0x24135a[_0xbb2c('0x26')],_0x24135a[_0xbb2c('0x27')]);logger[_0xbb2c('0x28')]('[%s][voiceAgentReport][agentcalled]\x20event:',_0x24135a[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x24135a,{'showHidden':![],'depth':null}));if(_[_0xbb2c('0x2a')](this['channels'][_0x24135a[_0xbb2c('0x25')]])){this[_0xbb2c('0xb')][_0x24135a[_0xbb2c('0x25')]]={};}if(_[_0xbb2c('0x2a')](this[_0xbb2c('0xb')][_0x24135a['uniqueid']][_0x24135a[_0xbb2c('0x27')]])){this[_0xbb2c('0xb')][_0x24135a[_0xbb2c('0x25')]][_0x24135a[_0xbb2c('0x27')]]={'agentcalledAt':moment()[_0xbb2c('0x2b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xbb2c('0x2c'),'mandatoryDisposition':this[_0xbb2c('0xc')][_0x24135a[_0xbb2c('0x2d')]]?this[_0xbb2c('0xc')][_0x24135a[_0xbb2c('0x2d')]][_0xbb2c('0x2e')]||![]:![],'type':this[_0xbb2c('0xc')][_0x24135a[_0xbb2c('0x2d')]]?this[_0xbb2c('0xc')][_0x24135a[_0xbb2c('0x2d')]]['type']||_0xbb2c('0x2f'):_0xbb2c('0x2f'),'variables':this[_0xbb2c('0xe')][_0x24135a['uniqueid']],'motionChannel':'voice'};}_[_0xbb2c('0x30')](this[_0xbb2c('0xb')][_0x24135a[_0xbb2c('0x25')]][_0x24135a['destuniqueid']],_[_0xbb2c('0x31')](_0x24135a,[_0xbb2c('0x32'),_0xbb2c('0x33')]));logger[_0xbb2c('0x28')](_0xbb2c('0x34'),_0x24135a[_0xbb2c('0x25')],util['inspect'](this['channels'][_0x24135a[_0xbb2c('0x25')]][_0x24135a['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xbb2c('0x20')](_0xbb2c('0x35'),this[_0xbb2c('0xb')][_0x24135a['uniqueid']][_0x24135a[_0xbb2c('0x27')]]);logger[_0xbb2c('0x28')](_0xbb2c('0x36'),_0x24135a[_0xbb2c('0x25')],util[_0xbb2c('0x29')](this[_0xbb2c('0xb')][_0x24135a[_0xbb2c('0x25')]][_0x24135a['destuniqueid']],{'showHidden':![],'depth':null}));this[_0xbb2c('0x20')](util[_0xbb2c('0x2b')](_0xbb2c('0x37'),_0x24135a[_0xbb2c('0x26')]),_0xbb2c('0x38'),this[_0xbb2c('0xb')][_0x24135a['uniqueid']][_0x24135a[_0xbb2c('0x27')]]);}}catch(_0x17b350){logger[_0xbb2c('0x39')]('[%s][voiceAgentReport][agentcalled]',_0x24135a[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x17b350,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbb2c('0x21')][_0xbb2c('0x13')]=function(_0x45818e){try{if(this['isNotNull'](_0x45818e)){if(this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]]){logger[_0xbb2c('0x28')]('[%s][voiceAgentReport][agentconnect]\x20event:',_0x45818e[_0xbb2c('0x25')],util['inspect'](_0x45818e,{'showHidden':![],'depth':null}));for(var _0x1afa20 in this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]]){if(this['channels'][_0x45818e[_0xbb2c('0x25')]]['hasOwnProperty'](_0x1afa20)){if(_0x45818e[_0xbb2c('0x27')]===_0x1afa20){logger['info'](_0xbb2c('0x3a'),_0x45818e['uniqueid'],_0x45818e[_0xbb2c('0x26')],_0x45818e[_0xbb2c('0x27')]);this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x3b')]=moment()[_0xbb2c('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x3c')]=_0x45818e['connectedlinename'];this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x3d')]=_0x45818e[_0xbb2c('0x3d')];this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x3e')]=_0x45818e[_0xbb2c('0x3e')];this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x3f')]=_0x45818e[_0xbb2c('0x3f')];this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20]['holdtime']=_0x45818e[_0xbb2c('0x40')];this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x41')]='connect';if(this['voiceChannels'][this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20]['uniqueid']]){var _0x10e38c=this[_0xbb2c('0x42')][this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x25')]][_0xbb2c('0x43')];this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x43')]=_0x10e38c;_0x45818e[_0xbb2c('0x43')]=_0x10e38c;}_['merge'](this[_0xbb2c('0xd')][_0x45818e[_0xbb2c('0x44')]],_[_0xbb2c('0x45')](_0x45818e,['queue','destconnectedlinenum','routealias']));logger['debug'](_0xbb2c('0x46'),_0x45818e[_0xbb2c('0x25')],util[_0xbb2c('0x29')](this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x45818e[_0xbb2c('0x27')]],{'showHidden':![],'depth':null}));ami[_0xbb2c('0x20')](_0xbb2c('0x47'),this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x45818e[_0xbb2c('0x27')]]);logger[_0xbb2c('0x28')](_0xbb2c('0x48'),_0x45818e[_0xbb2c('0x25')],util[_0xbb2c('0x29')](this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x45818e[_0xbb2c('0x27')]],{'showHidden':![],'depth':null}));this[_0xbb2c('0x20')](util[_0xbb2c('0x2b')]('user:%s',_0x45818e[_0xbb2c('0x26')]),_0xbb2c('0x49'),this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x45818e[_0xbb2c('0x27')]]);}else if(!this['channels'][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x4a')]&&!this['channels'][_0x45818e[_0xbb2c('0x25')]][_0x1afa20]['agentcomplete']){logger[_0xbb2c('0x23')](_0xbb2c('0x4b'),_0x45818e['uniqueid'],this['channels'][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x26')],_0x1afa20);this['channels'][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x4a')]=!![];this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20]['agentringnoanswerAt']=moment()[_0xbb2c('0x2b')](_0xbb2c('0x4c'));this[_0xbb2c('0xb')][_0x45818e['uniqueid']][_0x1afa20][_0xbb2c('0x4d')]=_0x45818e[_0xbb2c('0x27')];this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x4e')]=_0x45818e[_0xbb2c('0x26')];this[_0xbb2c('0xb')][_0x45818e[_0xbb2c('0x25')]][_0x1afa20][_0xbb2c('0x41')]=_0xbb2c('0x4f');this[_0xbb2c('0xb')][_0x45818e['uniqueid']][_0x1afa20][_0xbb2c('0x50')]='answered_elsewhere';logger['debug'](_0xbb2c('0x51'),_0x45818e[_0xbb2c('0x25')],util[_0xbb2c('0x29')](this['channels'][_0x45818e[_0xbb2c('0x25')]][_0x1afa20],{'showHidden':![],'depth':null}));ami[_0xbb2c('0x20')]('custom:agentansweredelsewhere',this['channels'][_0x45818e[_0xbb2c('0x25')]][_0x1afa20]);}}}}}}catch(_0x39ebd0){logger['error'](_0xbb2c('0x52'),_0x45818e[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x39ebd0,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbb2c('0x21')][_0xbb2c('0x14')]=function(_0x5e2d83){try{if(this[_0xbb2c('0x22')](_0x5e2d83)){logger[_0xbb2c('0x28')](_0xbb2c('0x53'),_0x5e2d83[_0xbb2c('0x25')],util['inspect'](_0x5e2d83,{'showHidden':![],'depth':null}));if(this[_0xbb2c('0xb')][_0x5e2d83['uniqueid']]&&this[_0xbb2c('0xb')][_0x5e2d83[_0xbb2c('0x25')]][_0x5e2d83[_0xbb2c('0x27')]]){logger[_0xbb2c('0x23')](_0xbb2c('0x54'),_0x5e2d83[_0xbb2c('0x25')],_0x5e2d83['membername'],_0x5e2d83['destuniqueid']);this[_0xbb2c('0xb')][_0x5e2d83[_0xbb2c('0x25')]][_0x5e2d83[_0xbb2c('0x27')]][_0xbb2c('0x4a')]=!![];this['channels'][_0x5e2d83[_0xbb2c('0x25')]][_0x5e2d83[_0xbb2c('0x27')]]['agentringnoanswerAt']=moment()[_0xbb2c('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbb2c('0xb')][_0x5e2d83[_0xbb2c('0x25')]][_0x5e2d83[_0xbb2c('0x27')]][_0xbb2c('0x41')]=_0xbb2c('0x55');this['channels'][_0x5e2d83[_0xbb2c('0x25')]][_0x5e2d83['destuniqueid']][_0xbb2c('0x50')]=_0xbb2c('0x55');logger[_0xbb2c('0x28')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x5e2d83[_0xbb2c('0x25')],util[_0xbb2c('0x29')](this['channels'][_0x5e2d83['uniqueid']][_0x5e2d83[_0xbb2c('0x27')]],{'showHidden':![],'depth':null}));ami[_0xbb2c('0x20')]('custom:agentringnoanswer',this[_0xbb2c('0xb')][_0x5e2d83[_0xbb2c('0x25')]][_0x5e2d83['destuniqueid']]);}}}catch(_0x153193){logger['error'](_0xbb2c('0x56'),_0x5e2d83[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x153193,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbb2c('0x21')]['syncQueueCallerAbandon']=function(_0x2a4ef4){try{if(this[_0xbb2c('0x22')](_0x2a4ef4)){logger[_0xbb2c('0x28')](_0xbb2c('0x57'),_0x2a4ef4[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x2a4ef4,{'showHidden':![],'depth':null}));if(this[_0xbb2c('0xb')][_0x2a4ef4[_0xbb2c('0x25')]]){for(var _0x221e45 in this['channels'][_0x2a4ef4[_0xbb2c('0x25')]]){if(this['channels'][_0x2a4ef4['uniqueid']][_0xbb2c('0x58')](_0x221e45)&&!this[_0xbb2c('0xb')][_0x2a4ef4[_0xbb2c('0x25')]][_0x221e45][_0xbb2c('0x4a')]&&!this[_0xbb2c('0xb')][_0x2a4ef4[_0xbb2c('0x25')]][_0x221e45][_0xbb2c('0x17')]){logger['info']('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2a4ef4['uniqueid'],this['channels'][_0x2a4ef4[_0xbb2c('0x25')]][_0x221e45][_0xbb2c('0x26')],_0x221e45);this[_0xbb2c('0xb')][_0x2a4ef4['uniqueid']][_0x221e45][_0xbb2c('0x4a')]=!![];this['channels'][_0x2a4ef4['uniqueid']][_0x221e45][_0xbb2c('0x59')]=moment()[_0xbb2c('0x2b')](_0xbb2c('0x4c'));this[_0xbb2c('0xb')][_0x2a4ef4['uniqueid']][_0x221e45][_0xbb2c('0x41')]=_0xbb2c('0x5a');this['channels'][_0x2a4ef4[_0xbb2c('0x25')]][_0x221e45]['reason']=_0xbb2c('0x5a');logger[_0xbb2c('0x28')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x2a4ef4['uniqueid'],util[_0xbb2c('0x29')](this[_0xbb2c('0xb')][_0x2a4ef4[_0xbb2c('0x25')]][_0x221e45],{'showHidden':![],'depth':null}));ami[_0xbb2c('0x20')](_0xbb2c('0x5b'),this[_0xbb2c('0xb')][_0x2a4ef4[_0xbb2c('0x25')]][_0x221e45]);}}}}}catch(_0x49d292){logger['error']('[%s][voiceAgentReport][queuecallerabandon]',_0x2a4ef4['uniqueid'],util[_0xbb2c('0x29')](_0x49d292,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbb2c('0x21')][_0xbb2c('0x5c')]=function(_0x498df4){try{if(this['isNotNull'](_0x498df4)){logger[_0xbb2c('0x28')](_0xbb2c('0x5d'),_0x498df4[_0xbb2c('0x25')],util['inspect'](_0x498df4,{'showHidden':![],'depth':null}));if(this[_0xbb2c('0xb')][_0x498df4[_0xbb2c('0x25')]]){for(var _0x2a0ea6 in this[_0xbb2c('0xb')][_0x498df4['uniqueid']]){if(this[_0xbb2c('0xb')][_0x498df4['uniqueid']][_0xbb2c('0x58')](_0x2a0ea6)){if(this[_0xbb2c('0xb')][_0x498df4['uniqueid']][_0x2a0ea6][_0xbb2c('0x3b')]&&!this[_0xbb2c('0xb')][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6][_0xbb2c('0x17')]){logger[_0xbb2c('0x23')](_0xbb2c('0x5e'),_0x498df4[_0xbb2c('0x25')],this[_0xbb2c('0xb')][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6][_0xbb2c('0x26')],_0x2a0ea6);this[_0xbb2c('0xb')][_0x498df4['uniqueid']][_0x2a0ea6][_0xbb2c('0x17')]=!![];this[_0xbb2c('0xb')][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6][_0xbb2c('0x5f')]=moment()[_0xbb2c('0x2b')](_0xbb2c('0x4c'));this['channels'][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6][_0xbb2c('0x41')]=_0xbb2c('0x60');this['channels'][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6][_0xbb2c('0x50')]=_0x498df4[_0xbb2c('0x50')]=='transfer'?_0xbb2c('0x61'):_0x498df4['reason'];this['channels'][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6][_0xbb2c('0x62')]=_0x498df4[_0xbb2c('0x62')];if(this['voiceQueues'][_0x498df4['queue']]&&this[_0xbb2c('0xc')][_0x498df4[_0xbb2c('0x2d')]]['acw']){this[_0xbb2c('0xb')][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6]['acwtime']=this['voiceQueues'][_0x498df4[_0xbb2c('0x2d')]][_0xbb2c('0x63')];this[_0xbb2c('0xb')][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6]['agentacw']=!![];}this[_0xbb2c('0xd')][_0x498df4[_0xbb2c('0x44')]]=_[_0xbb2c('0x31')](this[_0xbb2c('0xd')][_0x498df4[_0xbb2c('0x44')]],[_0xbb2c('0x2d'),_0xbb2c('0x64')]);logger['debug'](_0xbb2c('0x65'),_0x498df4[_0xbb2c('0x25')],util['inspect'](this[_0xbb2c('0xb')][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6],{'showHidden':![],'depth':null}));ami[_0xbb2c('0x20')](_0xbb2c('0x66'),this['channels'][_0x498df4['uniqueid']][_0x2a0ea6]);logger[_0xbb2c('0x28')](_0xbb2c('0x67'),_0x498df4[_0xbb2c('0x25')],util[_0xbb2c('0x29')](this['channels'][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6],{'showHidden':![],'depth':null}));this['emit'](util[_0xbb2c('0x2b')]('user:%s',_0x498df4[_0xbb2c('0x26')]),_0xbb2c('0x68'),this['channels'][_0x498df4[_0xbb2c('0x25')]][_0x2a0ea6]);}}}}}}catch(_0x19051e){logger[_0xbb2c('0x39')](_0xbb2c('0x69'),_0x498df4[_0xbb2c('0x25')],util['inspect'](_0x19051e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbb2c('0x21')][_0xbb2c('0x19')]=function(_0x1b0d0e){try{if(this[_0xbb2c('0x22')](_0x1b0d0e)){logger['debug'](_0xbb2c('0x6a'),_0x1b0d0e[_0xbb2c('0x25')],util['inspect'](_0x1b0d0e,{'showHidden':![],'depth':null}));this['addVariable'](_0x1b0d0e[_0xbb2c('0x25')],_[_0xbb2c('0x6b')](_0x1b0d0e['variable'])[0x0],_0x1b0d0e[_0xbb2c('0x6c')]);if(this['channels'][_0x1b0d0e[_0xbb2c('0x25')]]){for(var _0x1a8b38 in this[_0xbb2c('0xb')][_0x1b0d0e['uniqueid']]){if(this[_0xbb2c('0xb')][_0x1b0d0e['uniqueid']][_0xbb2c('0x58')](_0x1a8b38)){logger[_0xbb2c('0x23')](_0xbb2c('0x6d'),_0x1b0d0e['uniqueid'],_0x1a8b38,_[_0xbb2c('0x6b')](_0x1b0d0e[_0xbb2c('0x6e')])[0x0],_0x1b0d0e['value']);if(_[_0xbb2c('0x2a')](this[_0xbb2c('0xb')][_0x1b0d0e['uniqueid']][_0x1a8b38][_0xbb2c('0xe')])){this[_0xbb2c('0xb')][_0x1b0d0e[_0xbb2c('0x25')]][_0x1a8b38][_0xbb2c('0xe')]={};}this[_0xbb2c('0xb')][_0x1b0d0e['uniqueid']][_0x1a8b38]['variables']=this[_0xbb2c('0xe')][_0x1b0d0e['uniqueid']];}}}}}catch(_0x2c761c){logger[_0xbb2c('0x39')]('[%s][voiceAgentReport][varset]',_0x1b0d0e[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x2c761c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbb2c('0x21')][_0xbb2c('0x6f')]=function(_0x185354,_0x2ff8c3,_0x3c5728){var _0x1c15e6=[_0xbb2c('0x70'),_0xbb2c('0x71'),_0xbb2c('0x72'),_0xbb2c('0x73'),'rtpaudioqosloss',_0xbb2c('0x74'),_0xbb2c('0x75'),'rtpaudioqosrttbridged',_0xbb2c('0x76'),'sipuri',_0xbb2c('0x77'),'bridgepvtcallid',_0xbb2c('0x78'),'memberdynamic',_0xbb2c('0x79'),_0xbb2c('0x7a'),'membername','memberpenalty',_0xbb2c('0x7b')];if(!_[_0xbb2c('0x7c')](_0x2ff8c3)&&!_['includes'](_0x1c15e6,_0x2ff8c3)){if(_[_0xbb2c('0x2a')](this[_0xbb2c('0xe')][_0x185354])){this[_0xbb2c('0xe')][_0x185354]={};}this[_0xbb2c('0xe')][_0x185354][_0x2ff8c3]=_0x3c5728;}};VoiceAgentReport[_0xbb2c('0x21')][_0xbb2c('0x7d')]=function(_0x45ec1d){try{if(this[_0xbb2c('0x22')](_0x45ec1d)){logger['debug'](_0xbb2c('0x7e'),_0x45ec1d['uniqueid'],util[_0xbb2c('0x29')](_0x45ec1d,{'showHidden':![],'depth':null}));if(this[_0xbb2c('0xb')][_0x45ec1d[_0xbb2c('0x25')]]){for(var _0x518e14 in this[_0xbb2c('0xb')][_0x45ec1d[_0xbb2c('0x25')]]){if(this['channels'][_0x45ec1d[_0xbb2c('0x25')]]['hasOwnProperty'](_0x518e14)){if(this['channels'][_0x45ec1d[_0xbb2c('0x25')]][_0x518e14][_0xbb2c('0x50')]==_0xbb2c('0x7f')&&this[_0xbb2c('0xb')][_0x45ec1d['uniqueid']][_0x518e14][_0xbb2c('0x17')]){logger['info'](_0xbb2c('0x80'),_0x45ec1d[_0xbb2c('0x25')],_0x518e14);this[_0xbb2c('0xb')][_0x45ec1d[_0xbb2c('0x25')]][_0x518e14][_0xbb2c('0x5f')]=moment()[_0xbb2c('0x2b')](_0xbb2c('0x4c'));}}}logger['debug'](_0xbb2c('0x81'),_0x45ec1d[_0xbb2c('0x25')],util['inspect'](_[_0xbb2c('0x82')](this['channels'][_0x45ec1d[_0xbb2c('0x25')]]),{'showHidden':![],'depth':null}));ami['emit'](_0xbb2c('0x83'),_[_0xbb2c('0x82')](this['channels'][_0x45ec1d['uniqueid']]));delete this[_0xbb2c('0xb')][_0x45ec1d[_0xbb2c('0x25')]];}if(this[_0xbb2c('0xe')][_0x45ec1d['uniqueid']]){delete this[_0xbb2c('0xe')][_0x45ec1d['uniqueid']];}}}catch(_0x4c9204){logger[_0xbb2c('0x39')](_0xbb2c('0x84'),_0x45ec1d[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x4c9204,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xbb2c('0x1d')]=function(_0x30c7a4){try{if(this[_0xbb2c('0x22')](_0x30c7a4)){logger[_0xbb2c('0x28')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x30c7a4['uniqueid'],util[_0xbb2c('0x29')](_0x30c7a4,{'showHidden':![],'depth':null}));if(this['channels'][_0x30c7a4['transfereeuniqueid']]){for(var _0x391725 in this[_0xbb2c('0xb')][_0x30c7a4['transfereeuniqueid']]){if(this['channels'][_0x30c7a4[_0xbb2c('0x85')]][_0xbb2c('0x58')](_0x391725)){if(_0x30c7a4[_0xbb2c('0x86')]===_0x391725){logger[_0xbb2c('0x23')](_0xbb2c('0x87'),_0x30c7a4[_0xbb2c('0x25')],this['channels'][_0x30c7a4['transfereeuniqueid']][_0x391725][_0xbb2c('0x26')],_0x391725);var _0x588754=moment();this[_0xbb2c('0xb')][_0x30c7a4[_0xbb2c('0x85')]][_0x391725][_0xbb2c('0x17')]=!![];this['channels'][_0x30c7a4[_0xbb2c('0x85')]][_0x391725][_0xbb2c('0x5f')]=moment()[_0xbb2c('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xbb2c('0xb')][_0x30c7a4[_0xbb2c('0x85')]][_0x391725][_0xbb2c('0x41')]=_0xbb2c('0x60');this['channels'][_0x30c7a4['transfereeuniqueid']][_0x391725][_0xbb2c('0x50')]=_0xbb2c('0x7f');this[_0xbb2c('0xb')][_0x30c7a4[_0xbb2c('0x85')]][_0x391725]['talktime']=_0x588754[_0xbb2c('0x88')](this[_0xbb2c('0xb')][_0x30c7a4['transfereeuniqueid']][_0x391725]['agentconnectAt'],_0xbb2c('0x89'));}}}}if(this[_0xbb2c('0xb')][_0x30c7a4[_0xbb2c('0x8a')]]){var _0x13e1af=this['channels'][_0x30c7a4[_0xbb2c('0x8a')]];this[_0xbb2c('0xb')][_0x30c7a4['secondtransfereruniqueid']]=this[_0xbb2c('0xb')][_0x30c7a4[_0xbb2c('0x85')]];this[_0xbb2c('0xb')][_0x30c7a4['transfereeuniqueid']]=_0x13e1af;}}}catch(_0x33924d){logger[_0xbb2c('0x39')](_0xbb2c('0x8b'),_0x30c7a4[_0xbb2c('0x25')],util['inspect'](_0x33924d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbb2c('0x21')][_0xbb2c('0x1f')]=function(_0x3be1d5){try{if(this['isNotNull'](_0x3be1d5)){logger[_0xbb2c('0x28')](_0xbb2c('0x8c'),_0x3be1d5[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x3be1d5,{'showHidden':![],'depth':null}));if(this[_0xbb2c('0xb')][_0x3be1d5[_0xbb2c('0x85')]]){for(var _0x5cbf45 in this['channels'][_0x3be1d5[_0xbb2c('0x85')]]){if(this[_0xbb2c('0xb')][_0x3be1d5['transfereeuniqueid']][_0xbb2c('0x58')](_0x5cbf45)){if(_0x3be1d5[_0xbb2c('0x8d')]===_0x5cbf45){logger['info'](_0xbb2c('0x8e'),_0x3be1d5[_0xbb2c('0x25')],this[_0xbb2c('0xb')][_0x3be1d5[_0xbb2c('0x85')]][_0x5cbf45][_0xbb2c('0x26')],_0x5cbf45);var _0xc91537=moment();this[_0xbb2c('0xb')][_0x3be1d5[_0xbb2c('0x85')]][_0x5cbf45]['agentcomplete']=!![];this[_0xbb2c('0xb')][_0x3be1d5['transfereeuniqueid']][_0x5cbf45][_0xbb2c('0x5f')]=_0xc91537;this['channels'][_0x3be1d5[_0xbb2c('0x85')]][_0x5cbf45][_0xbb2c('0x41')]=_0xbb2c('0x60');this[_0xbb2c('0xb')][_0x3be1d5[_0xbb2c('0x85')]][_0x5cbf45][_0xbb2c('0x50')]=_0xbb2c('0x7f');this[_0xbb2c('0xb')][_0x3be1d5['transfereeuniqueid']][_0x5cbf45][_0xbb2c('0x62')]=_0xc91537['diff'](this[_0xbb2c('0xb')][_0x3be1d5['transfereeuniqueid']][_0x5cbf45][_0xbb2c('0x3b')],_0xbb2c('0x89'));}}}}}}catch(_0x3f3224){logger[_0xbb2c('0x39')]('[%s][voiceAgentReport][blindtransfer]',_0x3be1d5['uniqueid'],util[_0xbb2c('0x29')](_0x3f3224,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbb2c('0x21')][_0xbb2c('0x8f')]=function(_0x40c31d){var _0x218060='';try{if(this['isNotNull'](_0x40c31d)){logger[_0xbb2c('0x28')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x40c31d[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x40c31d,{'showHidden':![],'depth':null}));if(_0x40c31d[_0xbb2c('0x90')]){_0x218060=_0x40c31d[_0xbb2c('0x90')][_0xbb2c('0x91')](0x0,_0x40c31d[_0xbb2c('0x90')]['lastIndexOf']('-'));if(this[_0xbb2c('0xd')][_0x218060]){logger[_0xbb2c('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20interface:%s',_0x40c31d['uniqueid'],_0x218060);this[_0xbb2c('0xd')][_0x218060][_0xbb2c('0x92')]=!![];}}}}catch(_0x3ef09d){logger[_0xbb2c('0x39')](_0xbb2c('0x93'),_0x40c31d[_0xbb2c('0x25')],util['inspect'](_0x3ef09d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xbb2c('0x21')]['syncMusicOnHoldStop']=function(_0x5009c5){var _0x2d5348='';try{if(this['isNotNull'](_0x5009c5)){logger[_0xbb2c('0x28')](_0xbb2c('0x94'),_0x5009c5[_0xbb2c('0x25')],util[_0xbb2c('0x29')](_0x5009c5,{'showHidden':![],'depth':null}));if(_0x5009c5['channel']){_0x2d5348=_0x5009c5[_0xbb2c('0x90')][_0xbb2c('0x91')](0x0,_0x5009c5[_0xbb2c('0x90')][_0xbb2c('0x95')]('-'));if(this[_0xbb2c('0xd')][_0x2d5348]){logger[_0xbb2c('0x23')](_0xbb2c('0x96'),_0x5009c5['uniqueid'],_0x2d5348);this['agents'][_0x2d5348][_0xbb2c('0x92')]=![];}}}}catch(_0x3d7010){logger['error'](_0xbb2c('0x97'),_0x5009c5[_0xbb2c('0x25')],util['inspect'](_0x3d7010,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xef2a=['membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','voiceQueues','queue','mandatoryDisposition','type','inbound','voice','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','connect','routealias','interface','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','lastevent','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20event:','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','transfer','agent','talktime','acw','acwtime','acwTimeout','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','transfereeuniqueid','origtransfereruniqueid','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','syncBlindTransfer','transfereruniqueid','complete','diff','[%s][voiceAgentReport][blindtransfer]','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','onhold','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','socket.io-emitter','voiceChannels','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','musiconholdstart','attendedtransfer','syncAttendedTransfer','prototype','emit','isNotNull','isUndefined','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xef2a,0x1a0));var _0xaef2=function(_0x5e8dd7,_0x4ddd1e){_0x5e8dd7=_0x5e8dd7-0x0;var _0x4d5237=_0xef2a[_0x5e8dd7];return _0x4d5237;};'use strict';var _=require(_0xaef2('0x0'));var moment=require(_0xaef2('0x1'));var util=require(_0xaef2('0x2'));var Redis=require(_0xaef2('0x3'));var config=require(_0xaef2('0x4'));var logger=require(_0xaef2('0x5'))(_0xaef2('0x6'));var ami=require(_0xaef2('0x7'));config['redis']=_[_0xaef2('0x8')](config[_0xaef2('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xaef2('0xa'))(new Redis(config['redis']));function VoiceAgentReport(_0x309da5){this['channels']={};this[_0xaef2('0xb')]=_0x309da5['channels'];this['voiceQueues']=_0x309da5['voiceQueues'];this['agents']=_0x309da5[_0xaef2('0xc')];this[_0xaef2('0xd')]={};ami['on'](_0xaef2('0xe'),this[_0xaef2('0xf')][_0xaef2('0x10')](this));ami['on'](_0xaef2('0x11'),this[_0xaef2('0x12')]['bind'](this));ami['on']('agentringnoanswer',this[_0xaef2('0x13')]['bind'](this));ami['on'](_0xaef2('0x14'),this[_0xaef2('0x15')]['bind'](this));ami['on'](_0xaef2('0x16'),this[_0xaef2('0x17')][_0xaef2('0x10')](this));ami['on'](_0xaef2('0x18'),this[_0xaef2('0x19')][_0xaef2('0x10')](this));ami['on'](_0xaef2('0x1a'),this['syncHangup'][_0xaef2('0x10')](this));ami['on'](_0xaef2('0x1b'),this['syncMusicOnHoldStart'][_0xaef2('0x10')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0xaef2('0x10')](this));ami['on'](_0xaef2('0x1c'),this[_0xaef2('0x1d')][_0xaef2('0x10')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xaef2('0x10')](this));}VoiceAgentReport[_0xaef2('0x1e')][_0xaef2('0x1f')]=function(_0x4a7e70,_0x365094,_0x58fcf1){io['to'](_0x4a7e70)[_0xaef2('0x1f')](_0x365094,_0x58fcf1);};VoiceAgentReport[_0xaef2('0x1e')][_0xaef2('0x20')]=function(_0xf0c538){return _0xf0c538!==null&&!_[_0xaef2('0x21')](_0xf0c538);};VoiceAgentReport[_0xaef2('0x1e')][_0xaef2('0xf')]=function(_0x1a64ae){try{if(this[_0xaef2('0x20')](_0x1a64ae)){logger[_0xaef2('0x22')](_0xaef2('0x23'),_0x1a64ae[_0xaef2('0x24')],_0x1a64ae[_0xaef2('0x25')],_0x1a64ae[_0xaef2('0x26')]);logger[_0xaef2('0x27')](_0xaef2('0x28'),_0x1a64ae['uniqueid'],util[_0xaef2('0x29')](_0x1a64ae,{'showHidden':![],'depth':null}));if(_[_0xaef2('0x21')](this[_0xaef2('0x2a')][_0x1a64ae[_0xaef2('0x24')]])){this[_0xaef2('0x2a')][_0x1a64ae['uniqueid']]={};}if(_[_0xaef2('0x21')](this[_0xaef2('0x2a')][_0x1a64ae['uniqueid']][_0x1a64ae[_0xaef2('0x26')]])){this[_0xaef2('0x2a')][_0x1a64ae[_0xaef2('0x24')]][_0x1a64ae[_0xaef2('0x26')]]={'agentcalledAt':moment()[_0xaef2('0x2b')](_0xaef2('0x2c')),'lastevent':_0xaef2('0x2d'),'mandatoryDisposition':this[_0xaef2('0x2e')][_0x1a64ae[_0xaef2('0x2f')]]?this['voiceQueues'][_0x1a64ae[_0xaef2('0x2f')]][_0xaef2('0x30')]||![]:![],'type':this[_0xaef2('0x2e')][_0x1a64ae['queue']]?this[_0xaef2('0x2e')][_0x1a64ae['queue']][_0xaef2('0x31')]||_0xaef2('0x32'):_0xaef2('0x32'),'variables':this[_0xaef2('0xd')][_0x1a64ae['uniqueid']],'motionChannel':_0xaef2('0x33')};}_[_0xaef2('0x34')](this['channels'][_0x1a64ae['uniqueid']][_0x1a64ae[_0xaef2('0x26')]],_[_0xaef2('0x35')](_0x1a64ae,[_0xaef2('0x36'),_0xaef2('0x37')]));logger[_0xaef2('0x27')](_0xaef2('0x38'),_0x1a64ae[_0xaef2('0x24')],util[_0xaef2('0x29')](this['channels'][_0x1a64ae[_0xaef2('0x24')]][_0x1a64ae['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xaef2('0x39'),this[_0xaef2('0x2a')][_0x1a64ae[_0xaef2('0x24')]][_0x1a64ae[_0xaef2('0x26')]]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x1a64ae[_0xaef2('0x24')],util[_0xaef2('0x29')](this['channels'][_0x1a64ae[_0xaef2('0x24')]][_0x1a64ae[_0xaef2('0x26')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xaef2('0x2b')](_0xaef2('0x3a'),_0x1a64ae[_0xaef2('0x25')]),_0xaef2('0x3b'),this[_0xaef2('0x2a')][_0x1a64ae[_0xaef2('0x24')]][_0x1a64ae[_0xaef2('0x26')]]);}}catch(_0x5e0998){logger['error'](_0xaef2('0x3c'),_0x1a64ae['uniqueid'],util[_0xaef2('0x29')](_0x5e0998,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xaef2('0x12')]=function(_0x2cfac5){try{if(this[_0xaef2('0x20')](_0x2cfac5)){if(this[_0xaef2('0x2a')][_0x2cfac5[_0xaef2('0x24')]]){logger[_0xaef2('0x27')](_0xaef2('0x3d'),_0x2cfac5[_0xaef2('0x24')],util[_0xaef2('0x29')](_0x2cfac5,{'showHidden':![],'depth':null}));for(var _0x4f317d in this['channels'][_0x2cfac5[_0xaef2('0x24')]]){if(this[_0xaef2('0x2a')][_0x2cfac5[_0xaef2('0x24')]][_0xaef2('0x3e')](_0x4f317d)){if(_0x2cfac5[_0xaef2('0x26')]===_0x4f317d){logger[_0xaef2('0x22')](_0xaef2('0x3f'),_0x2cfac5[_0xaef2('0x24')],_0x2cfac5[_0xaef2('0x25')],_0x2cfac5['destuniqueid']);this[_0xaef2('0x2a')][_0x2cfac5[_0xaef2('0x24')]][_0x4f317d][_0xaef2('0x40')]=moment()[_0xaef2('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xaef2('0x2a')][_0x2cfac5['uniqueid']][_0x4f317d][_0xaef2('0x41')]=_0x2cfac5['connectedlinename'];this[_0xaef2('0x2a')][_0x2cfac5[_0xaef2('0x24')]][_0x4f317d][_0xaef2('0x42')]=_0x2cfac5[_0xaef2('0x42')];this[_0xaef2('0x2a')][_0x2cfac5['uniqueid']][_0x4f317d][_0xaef2('0x43')]=_0x2cfac5['destchannelstate'];this[_0xaef2('0x2a')][_0x2cfac5[_0xaef2('0x24')]][_0x4f317d]['destchannelstatedesc']=_0x2cfac5[_0xaef2('0x44')];this[_0xaef2('0x2a')][_0x2cfac5['uniqueid']][_0x4f317d][_0xaef2('0x45')]=_0x2cfac5[_0xaef2('0x45')];this['channels'][_0x2cfac5['uniqueid']][_0x4f317d]['lastevent']=_0xaef2('0x46');if(this['voiceChannels'][this[_0xaef2('0x2a')][_0x2cfac5[_0xaef2('0x24')]][_0x4f317d][_0xaef2('0x24')]]){var _0x48d088=this[_0xaef2('0xb')][this['channels'][_0x2cfac5[_0xaef2('0x24')]][_0x4f317d][_0xaef2('0x24')]][_0xaef2('0x47')];this[_0xaef2('0x2a')][_0x2cfac5[_0xaef2('0x24')]][_0x4f317d][_0xaef2('0x47')]=_0x48d088;_0x2cfac5[_0xaef2('0x47')]=_0x48d088;}_[_0xaef2('0x34')](this[_0xaef2('0xc')][_0x2cfac5[_0xaef2('0x48')]],_['pick'](_0x2cfac5,['queue',_0xaef2('0x49'),_0xaef2('0x47')]));logger[_0xaef2('0x27')](_0xaef2('0x4a'),_0x2cfac5['uniqueid'],util[_0xaef2('0x29')](this[_0xaef2('0x2a')][_0x2cfac5['uniqueid']][_0x2cfac5[_0xaef2('0x26')]],{'showHidden':![],'depth':null}));ami['emit']('custom:agentconnect',this['channels'][_0x2cfac5['uniqueid']][_0x2cfac5[_0xaef2('0x26')]]);logger[_0xaef2('0x27')](_0xaef2('0x4b'),_0x2cfac5[_0xaef2('0x24')],util[_0xaef2('0x29')](this[_0xaef2('0x2a')][_0x2cfac5[_0xaef2('0x24')]][_0x2cfac5['destuniqueid']],{'showHidden':![],'depth':null}));this[_0xaef2('0x1f')](util['format'](_0xaef2('0x3a'),_0x2cfac5['membername']),'user:agentconnect',this[_0xaef2('0x2a')][_0x2cfac5['uniqueid']][_0x2cfac5[_0xaef2('0x26')]]);}else if(!this[_0xaef2('0x2a')][_0x2cfac5[_0xaef2('0x24')]][_0x4f317d][_0xaef2('0x4c')]&&!this['channels'][_0x2cfac5['uniqueid']][_0x4f317d][_0xaef2('0x16')]){logger[_0xaef2('0x22')](_0xaef2('0x4d'),_0x2cfac5[_0xaef2('0x24')],this[_0xaef2('0x2a')][_0x2cfac5[_0xaef2('0x24')]][_0x4f317d][_0xaef2('0x25')],_0x4f317d);this[_0xaef2('0x2a')][_0x2cfac5[_0xaef2('0x24')]][_0x4f317d][_0xaef2('0x4c')]=!![];this[_0xaef2('0x2a')][_0x2cfac5[_0xaef2('0x24')]][_0x4f317d][_0xaef2('0x4e')]=moment()['format'](_0xaef2('0x2c'));this[_0xaef2('0x2a')][_0x2cfac5[_0xaef2('0x24')]][_0x4f317d][_0xaef2('0x4f')]=_0x2cfac5[_0xaef2('0x26')];this[_0xaef2('0x2a')][_0x2cfac5[_0xaef2('0x24')]][_0x4f317d]['answeredelsewheremembername']=_0x2cfac5[_0xaef2('0x25')];this[_0xaef2('0x2a')][_0x2cfac5[_0xaef2('0x24')]][_0x4f317d][_0xaef2('0x50')]=_0xaef2('0x51');this[_0xaef2('0x2a')][_0x2cfac5[_0xaef2('0x24')]][_0x4f317d][_0xaef2('0x52')]=_0xaef2('0x51');logger[_0xaef2('0x27')](_0xaef2('0x53'),_0x2cfac5[_0xaef2('0x24')],util[_0xaef2('0x29')](this[_0xaef2('0x2a')][_0x2cfac5[_0xaef2('0x24')]][_0x4f317d],{'showHidden':![],'depth':null}));ami[_0xaef2('0x1f')](_0xaef2('0x54'),this[_0xaef2('0x2a')][_0x2cfac5[_0xaef2('0x24')]][_0x4f317d]);}}}}}}catch(_0x1457a1){logger[_0xaef2('0x55')](_0xaef2('0x56'),_0x2cfac5[_0xaef2('0x24')],util[_0xaef2('0x29')](_0x1457a1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xaef2('0x13')]=function(_0x37814f){try{if(this[_0xaef2('0x20')](_0x37814f)){logger['debug'](_0xaef2('0x57'),_0x37814f['uniqueid'],util[_0xaef2('0x29')](_0x37814f,{'showHidden':![],'depth':null}));if(this[_0xaef2('0x2a')][_0x37814f[_0xaef2('0x24')]]&&this[_0xaef2('0x2a')][_0x37814f[_0xaef2('0x24')]][_0x37814f[_0xaef2('0x26')]]){logger['info'](_0xaef2('0x58'),_0x37814f[_0xaef2('0x24')],_0x37814f[_0xaef2('0x25')],_0x37814f[_0xaef2('0x26')]);this[_0xaef2('0x2a')][_0x37814f['uniqueid']][_0x37814f[_0xaef2('0x26')]][_0xaef2('0x4c')]=!![];this['channels'][_0x37814f['uniqueid']][_0x37814f[_0xaef2('0x26')]]['agentringnoanswerAt']=moment()['format'](_0xaef2('0x2c'));this[_0xaef2('0x2a')][_0x37814f[_0xaef2('0x24')]][_0x37814f[_0xaef2('0x26')]][_0xaef2('0x50')]=_0xaef2('0x59');this[_0xaef2('0x2a')][_0x37814f[_0xaef2('0x24')]][_0x37814f[_0xaef2('0x26')]][_0xaef2('0x52')]='rejected';logger[_0xaef2('0x27')](_0xaef2('0x5a'),_0x37814f['uniqueid'],util[_0xaef2('0x29')](this[_0xaef2('0x2a')][_0x37814f[_0xaef2('0x24')]][_0x37814f['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xaef2('0x1f')](_0xaef2('0x5b'),this[_0xaef2('0x2a')][_0x37814f[_0xaef2('0x24')]][_0x37814f['destuniqueid']]);}}}catch(_0x3eff29){logger['error']('[%s][voiceAgentReport][agentringnoanswer]',_0x37814f[_0xaef2('0x24')],util['inspect'](_0x3eff29,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xaef2('0x1e')][_0xaef2('0x15')]=function(_0xb7d31){try{if(this['isNotNull'](_0xb7d31)){logger['debug'](_0xaef2('0x5c'),_0xb7d31[_0xaef2('0x24')],util[_0xaef2('0x29')](_0xb7d31,{'showHidden':![],'depth':null}));if(this[_0xaef2('0x2a')][_0xb7d31[_0xaef2('0x24')]]){for(var _0x57169b in this[_0xaef2('0x2a')][_0xb7d31[_0xaef2('0x24')]]){if(this[_0xaef2('0x2a')][_0xb7d31[_0xaef2('0x24')]][_0xaef2('0x3e')](_0x57169b)&&!this[_0xaef2('0x2a')][_0xb7d31['uniqueid']][_0x57169b][_0xaef2('0x4c')]&&!this[_0xaef2('0x2a')][_0xb7d31[_0xaef2('0x24')]][_0x57169b][_0xaef2('0x16')]){logger[_0xaef2('0x22')]('[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0xb7d31[_0xaef2('0x24')],this[_0xaef2('0x2a')][_0xb7d31[_0xaef2('0x24')]][_0x57169b][_0xaef2('0x25')],_0x57169b);this[_0xaef2('0x2a')][_0xb7d31[_0xaef2('0x24')]][_0x57169b][_0xaef2('0x4c')]=!![];this[_0xaef2('0x2a')][_0xb7d31[_0xaef2('0x24')]][_0x57169b][_0xaef2('0x4e')]=moment()[_0xaef2('0x2b')](_0xaef2('0x2c'));this[_0xaef2('0x2a')][_0xb7d31[_0xaef2('0x24')]][_0x57169b][_0xaef2('0x50')]=_0xaef2('0x5d');this['channels'][_0xb7d31[_0xaef2('0x24')]][_0x57169b][_0xaef2('0x52')]='abandoned';logger[_0xaef2('0x27')](_0xaef2('0x5e'),_0xb7d31['uniqueid'],util[_0xaef2('0x29')](this[_0xaef2('0x2a')][_0xb7d31[_0xaef2('0x24')]][_0x57169b],{'showHidden':![],'depth':null}));ami[_0xaef2('0x1f')](_0xaef2('0x5f'),this[_0xaef2('0x2a')][_0xb7d31[_0xaef2('0x24')]][_0x57169b]);}}}}}catch(_0x464e34){logger[_0xaef2('0x55')]('[%s][voiceAgentReport][queuecallerabandon]',_0xb7d31[_0xaef2('0x24')],util[_0xaef2('0x29')](_0x464e34,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xaef2('0x17')]=function(_0x3c8be1){try{if(this[_0xaef2('0x20')](_0x3c8be1)){logger[_0xaef2('0x27')](_0xaef2('0x60'),_0x3c8be1[_0xaef2('0x24')],util['inspect'](_0x3c8be1,{'showHidden':![],'depth':null}));if(this[_0xaef2('0x2a')][_0x3c8be1['uniqueid']]){for(var _0x423cdd in this[_0xaef2('0x2a')][_0x3c8be1['uniqueid']]){if(this['channels'][_0x3c8be1['uniqueid']][_0xaef2('0x3e')](_0x423cdd)){if(this['channels'][_0x3c8be1[_0xaef2('0x24')]][_0x423cdd][_0xaef2('0x40')]&&!this['channels'][_0x3c8be1[_0xaef2('0x24')]][_0x423cdd][_0xaef2('0x16')]){logger[_0xaef2('0x22')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x3c8be1[_0xaef2('0x24')],this[_0xaef2('0x2a')][_0x3c8be1[_0xaef2('0x24')]][_0x423cdd][_0xaef2('0x25')],_0x423cdd);this['channels'][_0x3c8be1[_0xaef2('0x24')]][_0x423cdd]['agentcomplete']=!![];this[_0xaef2('0x2a')][_0x3c8be1['uniqueid']][_0x423cdd][_0xaef2('0x61')]=moment()['format'](_0xaef2('0x2c'));this[_0xaef2('0x2a')][_0x3c8be1[_0xaef2('0x24')]][_0x423cdd][_0xaef2('0x50')]='complete';this['channels'][_0x3c8be1[_0xaef2('0x24')]][_0x423cdd]['reason']=_0x3c8be1['reason']==_0xaef2('0x62')?_0xaef2('0x63'):_0x3c8be1[_0xaef2('0x52')];this[_0xaef2('0x2a')][_0x3c8be1['uniqueid']][_0x423cdd]['talktime']=_0x3c8be1[_0xaef2('0x64')];if(this[_0xaef2('0x2e')][_0x3c8be1[_0xaef2('0x2f')]]&&this[_0xaef2('0x2e')][_0x3c8be1['queue']][_0xaef2('0x65')]){this[_0xaef2('0x2a')][_0x3c8be1[_0xaef2('0x24')]][_0x423cdd][_0xaef2('0x66')]=this['voiceQueues'][_0x3c8be1['queue']][_0xaef2('0x67')];this['channels'][_0x3c8be1[_0xaef2('0x24')]][_0x423cdd]['agentacw']=!![];}this[_0xaef2('0xc')][_0x3c8be1[_0xaef2('0x48')]]=_[_0xaef2('0x35')](this['agents'][_0x3c8be1['interface']],['queue',_0xaef2('0x49')]);logger[_0xaef2('0x27')](_0xaef2('0x68'),_0x3c8be1[_0xaef2('0x24')],util['inspect'](this[_0xaef2('0x2a')][_0x3c8be1[_0xaef2('0x24')]][_0x423cdd],{'showHidden':![],'depth':null}));ami[_0xaef2('0x1f')]('custom:agentcomplete',this['channels'][_0x3c8be1[_0xaef2('0x24')]][_0x423cdd]);logger['debug']('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x3c8be1[_0xaef2('0x24')],util[_0xaef2('0x29')](this[_0xaef2('0x2a')][_0x3c8be1[_0xaef2('0x24')]][_0x423cdd],{'showHidden':![],'depth':null}));this[_0xaef2('0x1f')](util[_0xaef2('0x2b')](_0xaef2('0x3a'),_0x3c8be1[_0xaef2('0x25')]),_0xaef2('0x69'),this[_0xaef2('0x2a')][_0x3c8be1[_0xaef2('0x24')]][_0x423cdd]);}}}}}}catch(_0x10f5ce){logger['error'](_0xaef2('0x6a'),_0x3c8be1[_0xaef2('0x24')],util[_0xaef2('0x29')](_0x10f5ce,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xaef2('0x1e')]['syncVarSet']=function(_0x4f57cb){try{if(this['isNotNull'](_0x4f57cb)){logger[_0xaef2('0x27')](_0xaef2('0x6b'),_0x4f57cb[_0xaef2('0x24')],util[_0xaef2('0x29')](_0x4f57cb,{'showHidden':![],'depth':null}));this['addVariable'](_0x4f57cb[_0xaef2('0x24')],_['keys'](_0x4f57cb[_0xaef2('0x6c')])[0x0],_0x4f57cb[_0xaef2('0x6d')]);if(this['channels'][_0x4f57cb[_0xaef2('0x24')]]){for(var _0x3bd4f2 in this[_0xaef2('0x2a')][_0x4f57cb[_0xaef2('0x24')]]){if(this[_0xaef2('0x2a')][_0x4f57cb[_0xaef2('0x24')]][_0xaef2('0x3e')](_0x3bd4f2)){logger['info'](_0xaef2('0x6e'),_0x4f57cb[_0xaef2('0x24')],_0x3bd4f2,_['keys'](_0x4f57cb[_0xaef2('0x6c')])[0x0],_0x4f57cb[_0xaef2('0x6d')]);if(_[_0xaef2('0x21')](this[_0xaef2('0x2a')][_0x4f57cb[_0xaef2('0x24')]][_0x3bd4f2][_0xaef2('0xd')])){this[_0xaef2('0x2a')][_0x4f57cb[_0xaef2('0x24')]][_0x3bd4f2][_0xaef2('0xd')]={};}this[_0xaef2('0x2a')][_0x4f57cb[_0xaef2('0x24')]][_0x3bd4f2][_0xaef2('0xd')]=this[_0xaef2('0xd')][_0x4f57cb[_0xaef2('0x24')]];}}}}}catch(_0x1743ce){logger['error']('[%s][voiceAgentReport][varset]',_0x4f57cb[_0xaef2('0x24')],util[_0xaef2('0x29')](_0x1743ce,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xaef2('0x1e')][_0xaef2('0x6f')]=function(_0x4c1892,_0x3c779e,_0xdbe623){var _0x44e83a=['rtpaudioqos','rtpaudioqosbridged',_0xaef2('0x70'),_0xaef2('0x71'),'rtpaudioqosloss',_0xaef2('0x72'),_0xaef2('0x73'),'rtpaudioqosrttbridged','sipcallid',_0xaef2('0x74'),_0xaef2('0x75'),_0xaef2('0x76'),_0xaef2('0x77'),_0xaef2('0x78'),_0xaef2('0x79'),_0xaef2('0x7a'),_0xaef2('0x25'),_0xaef2('0x7b'),'memberrealtime'];if(!_[_0xaef2('0x7c')](_0x3c779e)&&!_['includes'](_0x44e83a,_0x3c779e)){if(_[_0xaef2('0x21')](this[_0xaef2('0xd')][_0x4c1892])){this[_0xaef2('0xd')][_0x4c1892]={};}this[_0xaef2('0xd')][_0x4c1892][_0x3c779e]=_0xdbe623;}};VoiceAgentReport[_0xaef2('0x1e')]['syncHangup']=function(_0xc46882){try{if(this['isNotNull'](_0xc46882)){logger[_0xaef2('0x27')](_0xaef2('0x7d'),_0xc46882['uniqueid'],util['inspect'](_0xc46882,{'showHidden':![],'depth':null}));if(this[_0xaef2('0x2a')][_0xc46882[_0xaef2('0x24')]]){for(var _0x4a11b6 in this[_0xaef2('0x2a')][_0xc46882[_0xaef2('0x24')]]){if(this[_0xaef2('0x2a')][_0xc46882[_0xaef2('0x24')]]['hasOwnProperty'](_0x4a11b6)){if(this['channels'][_0xc46882[_0xaef2('0x24')]][_0x4a11b6][_0xaef2('0x52')]=='transfer'&&this[_0xaef2('0x2a')][_0xc46882[_0xaef2('0x24')]][_0x4a11b6][_0xaef2('0x16')]){logger[_0xaef2('0x22')](_0xaef2('0x7e'),_0xc46882[_0xaef2('0x24')],_0x4a11b6);this['channels'][_0xc46882['uniqueid']][_0x4a11b6][_0xaef2('0x61')]=moment()[_0xaef2('0x2b')](_0xaef2('0x2c'));}}}logger['debug'](_0xaef2('0x7f'),_0xc46882[_0xaef2('0x24')],util[_0xaef2('0x29')](_[_0xaef2('0x80')](this[_0xaef2('0x2a')][_0xc46882['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0xaef2('0x1f')](_0xaef2('0x81'),_[_0xaef2('0x80')](this[_0xaef2('0x2a')][_0xc46882[_0xaef2('0x24')]]));delete this['channels'][_0xc46882[_0xaef2('0x24')]];}if(this[_0xaef2('0xd')][_0xc46882[_0xaef2('0x24')]]){delete this[_0xaef2('0xd')][_0xc46882[_0xaef2('0x24')]];}}}catch(_0x1f8bfb){logger[_0xaef2('0x55')](_0xaef2('0x82'),_0xc46882[_0xaef2('0x24')],util[_0xaef2('0x29')](_0x1f8bfb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xaef2('0x1e')]['syncAttendedTransfer']=function(_0x239a3a){try{if(this['isNotNull'](_0x239a3a)){logger[_0xaef2('0x27')]('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x239a3a[_0xaef2('0x24')],util['inspect'](_0x239a3a,{'showHidden':![],'depth':null}));if(this[_0xaef2('0x2a')][_0x239a3a[_0xaef2('0x83')]]){for(var _0x4ad832 in this[_0xaef2('0x2a')][_0x239a3a['transfereeuniqueid']]){if(this['channels'][_0x239a3a[_0xaef2('0x83')]]['hasOwnProperty'](_0x4ad832)){if(_0x239a3a[_0xaef2('0x84')]===_0x4ad832){logger[_0xaef2('0x22')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x239a3a[_0xaef2('0x24')],this[_0xaef2('0x2a')][_0x239a3a[_0xaef2('0x83')]][_0x4ad832][_0xaef2('0x25')],_0x4ad832);var _0x1d7dff=moment();this[_0xaef2('0x2a')][_0x239a3a['transfereeuniqueid']][_0x4ad832][_0xaef2('0x16')]=!![];this['channels'][_0x239a3a[_0xaef2('0x83')]][_0x4ad832][_0xaef2('0x61')]=moment()[_0xaef2('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xaef2('0x2a')][_0x239a3a[_0xaef2('0x83')]][_0x4ad832][_0xaef2('0x50')]='complete';this[_0xaef2('0x2a')][_0x239a3a[_0xaef2('0x83')]][_0x4ad832][_0xaef2('0x52')]='transfer';this[_0xaef2('0x2a')][_0x239a3a['transfereeuniqueid']][_0x4ad832][_0xaef2('0x64')]=_0x1d7dff['diff'](this[_0xaef2('0x2a')][_0x239a3a[_0xaef2('0x83')]][_0x4ad832][_0xaef2('0x40')],_0xaef2('0x85'));}}}}if(this[_0xaef2('0x2a')][_0x239a3a[_0xaef2('0x86')]]){var _0x26e6bf=this['channels'][_0x239a3a['secondtransfereruniqueid']];this[_0xaef2('0x2a')][_0x239a3a[_0xaef2('0x86')]]=this[_0xaef2('0x2a')][_0x239a3a[_0xaef2('0x83')]];this['channels'][_0x239a3a[_0xaef2('0x83')]]=_0x26e6bf;}}}catch(_0x68cd9e){logger[_0xaef2('0x55')](_0xaef2('0x87'),_0x239a3a[_0xaef2('0x24')],util[_0xaef2('0x29')](_0x68cd9e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xaef2('0x1e')][_0xaef2('0x88')]=function(_0x2485ef){try{if(this['isNotNull'](_0x2485ef)){logger['debug']('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x2485ef[_0xaef2('0x24')],util[_0xaef2('0x29')](_0x2485ef,{'showHidden':![],'depth':null}));if(this['channels'][_0x2485ef[_0xaef2('0x83')]]){for(var _0x368293 in this[_0xaef2('0x2a')][_0x2485ef[_0xaef2('0x83')]]){if(this['channels'][_0x2485ef['transfereeuniqueid']]['hasOwnProperty'](_0x368293)){if(_0x2485ef[_0xaef2('0x89')]===_0x368293){logger[_0xaef2('0x22')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2485ef[_0xaef2('0x24')],this[_0xaef2('0x2a')][_0x2485ef[_0xaef2('0x83')]][_0x368293]['membername'],_0x368293);var _0x2b48fa=moment();this['channels'][_0x2485ef[_0xaef2('0x83')]][_0x368293][_0xaef2('0x16')]=!![];this['channels'][_0x2485ef['transfereeuniqueid']][_0x368293][_0xaef2('0x61')]=_0x2b48fa;this[_0xaef2('0x2a')][_0x2485ef[_0xaef2('0x83')]][_0x368293]['lastevent']=_0xaef2('0x8a');this[_0xaef2('0x2a')][_0x2485ef['transfereeuniqueid']][_0x368293][_0xaef2('0x52')]=_0xaef2('0x62');this['channels'][_0x2485ef[_0xaef2('0x83')]][_0x368293][_0xaef2('0x64')]=_0x2b48fa[_0xaef2('0x8b')](this[_0xaef2('0x2a')][_0x2485ef[_0xaef2('0x83')]][_0x368293][_0xaef2('0x40')],_0xaef2('0x85'));}}}}}}catch(_0x3e0f11){logger[_0xaef2('0x55')](_0xaef2('0x8c'),_0x2485ef[_0xaef2('0x24')],util[_0xaef2('0x29')](_0x3e0f11,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x3d6b1c){var _0x48e90b='';try{if(this[_0xaef2('0x20')](_0x3d6b1c)){logger[_0xaef2('0x27')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x3d6b1c[_0xaef2('0x24')],util[_0xaef2('0x29')](_0x3d6b1c,{'showHidden':![],'depth':null}));if(_0x3d6b1c[_0xaef2('0x8d')]){_0x48e90b=_0x3d6b1c[_0xaef2('0x8d')]['substring'](0x0,_0x3d6b1c[_0xaef2('0x8d')][_0xaef2('0x8e')]('-'));if(this[_0xaef2('0xc')][_0x48e90b]){logger[_0xaef2('0x22')](_0xaef2('0x8f'),_0x3d6b1c[_0xaef2('0x24')],_0x48e90b);this[_0xaef2('0xc')][_0x48e90b]['onhold']=!![];}}}}catch(_0x40a060){logger['error'](_0xaef2('0x90'),_0x3d6b1c[_0xaef2('0x24')],util[_0xaef2('0x29')](_0x40a060,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xaef2('0x1e')][_0xaef2('0x91')]=function(_0x197cc7){var _0x34e3ea='';try{if(this[_0xaef2('0x20')](_0x197cc7)){logger[_0xaef2('0x27')](_0xaef2('0x92'),_0x197cc7['uniqueid'],util[_0xaef2('0x29')](_0x197cc7,{'showHidden':![],'depth':null}));if(_0x197cc7[_0xaef2('0x8d')]){_0x34e3ea=_0x197cc7[_0xaef2('0x8d')][_0xaef2('0x93')](0x0,_0x197cc7[_0xaef2('0x8d')][_0xaef2('0x8e')]('-'));if(this[_0xaef2('0xc')][_0x34e3ea]){logger[_0xaef2('0x22')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x197cc7[_0xaef2('0x24')],_0x34e3ea);this['agents'][_0x34e3ea][_0xaef2('0x94')]=![];}}}}catch(_0xd07db){logger[_0xaef2('0x55')](_0xaef2('0x95'),_0x197cc7[_0xaef2('0x24')],util[_0xaef2('0x29')](_0xd07db,{'showHidden':![],'depth':null}));}};module[_0xaef2('0x96')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index f94ba5d..ee314ea 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 _0xf13d=['[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','linkedid','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','starttime','duration','subtract','seconds','includes','lastapplication','lastdata','set','startsWith','cdr(','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','diff','connectedlinenum','destinationchannel','UserId','membername','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','replace','.WAV','monitorFilename','find','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','callerid','xmd-cdrtype','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','syncMixMonitorFilename','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','then','transferType','undefined','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','transfercalleridnum','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','outbound','ATTENDED','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereecalleridnum','BLIND','BlindTransfer','transfereruniqueid','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','isNil','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','queue','agi','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','redis','defaults','localhost','channels','agents','blindTransfers','coreshowchannel','bind','newexten','syncNewExten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','error','inspect','isUndefined','prototype','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','pick','keys','channel','exten','xcally-motion-preview','split','user:%s','name','user:agentconnect','[%s][voiceCallReport][newcallerid]','isNotNull','[%s][voiceCallReport][newchannel]\x20event:','context','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','merge','from-sip','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode'];(function(_0x4e4061,_0x26503b){var _0x371dbd=function(_0x31a31f){while(--_0x31a31f){_0x4e4061['push'](_0x4e4061['shift']());}};_0x371dbd(++_0x26503b);}(_0xf13d,0x76));var _0xdf13=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xf13d[_0x1928c9];return _0x51b5fb;};'use strict';var BPromise=require(_0xdf13('0x0'));var _=require(_0xdf13('0x1'));var moment=require(_0xdf13('0x2'));var util=require(_0xdf13('0x3'));var path=require('path');var Redis=require(_0xdf13('0x4'));var config=require(_0xdf13('0x5'));var logger=require(_0xdf13('0x6'))(_0xdf13('0x7'));var ami=require(_0xdf13('0x8'));var Channel=require(_0xdf13('0x9'));var RpcSetting=require('../rpc/setting');var statusDesc=[_0xdf13('0xa'),_0xdf13('0xb'),_0xdf13('0xc'),_0xdf13('0xd'),_0xdf13('0xe'),_0xdf13('0xf'),_0xdf13('0x10'),'ringinuse','onhold'];var applications=['set',_0xdf13('0x11'),_0xdf13('0x12'),'dial',_0xdf13('0x13'),_0xdf13('0x14')];var dispositions=['NO\x20ANSWER',_0xdf13('0x15'),_0xdf13('0x15'),_0xdf13('0x16'),_0xdf13('0x16'),_0xdf13('0x16'),_0xdf13('0x17'),'BUSY','FAILED',_0xdf13('0x15'),_0xdf13('0x15')];var actions={};config[_0xdf13('0x18')]=_[_0xdf13('0x19')](config[_0xdf13('0x18')],{'host':_0xdf13('0x1a'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdf13('0x18')]));function VoiceCallReport(_0x3f838a){this['channels']=_0x3f838a[_0xdf13('0x1b')];this[_0xdf13('0x1c')]=_0x3f838a[_0xdf13('0x1c')];this[_0xdf13('0x1d')]={};ami['on'](_0xdf13('0x1e'),this['syncNewExten'][_0xdf13('0x1f')](this));ami['on'](_0xdf13('0x20'),this[_0xdf13('0x21')]['bind'](this));ami['on'](_0xdf13('0x22'),this[_0xdf13('0x23')][_0xdf13('0x1f')](this));ami['on'](_0xdf13('0x24'),this[_0xdf13('0x25')]['bind'](this));ami['on'](_0xdf13('0x26'),this[_0xdf13('0x27')]['bind'](this));ami['on']('hangup',this[_0xdf13('0x28')][_0xdf13('0x1f')](this));ami['on']('newcallerid',this[_0xdf13('0x29')]['bind'](this));ami['on'](_0xdf13('0x2a'),this[_0xdf13('0x2b')][_0xdf13('0x1f')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xdf13('0x1f')](this));ami['on']('musiconholdstart',this[_0xdf13('0x2c')][_0xdf13('0x1f')](this));ami['on'](_0xdf13('0x2d'),this[_0xdf13('0x2e')][_0xdf13('0x1f')](this));try{logger[_0xdf13('0x2f')]('[voiceCallReport][coreshowchannels]\x20started');ami['actionCoreShowChannels']();}catch(_0x4c166e){logger[_0xdf13('0x30')]('[voiceCallReport][coreshowchannels]',util[_0xdf13('0x31')](_0x4c166e,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x313de9){return _0x313de9!==null&&!_[_0xdf13('0x32')](_0x313de9);};VoiceCallReport[_0xdf13('0x33')][_0xdf13('0x34')]=function(_0x37384c,_0x1876e9,_0x2cf969){io['to'](_0x37384c)[_0xdf13('0x34')](_0x1876e9,_0x2cf969);};VoiceCallReport[_0xdf13('0x33')]['syncNewCallerId']=function(_0x473caf){try{if(this['isNotNull'](_0x473caf)){logger[_0xdf13('0x2f')](_0xdf13('0x35'),_0x473caf[_0xdf13('0x36')],_0x473caf['calleridname'],_0x473caf[_0xdf13('0x37')]);logger[_0xdf13('0x38')](_0xdf13('0x39'),_0x473caf[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x473caf,{'showHidden':![],'depth':null}));if(_0x473caf['uniqueid']===_0x473caf['linkedid']){if(!_['isUndefined'](this[_0xdf13('0x1b')][_0x473caf[_0xdf13('0x36')]])){_['merge'](this[_0xdf13('0x1b')][_0x473caf[_0xdf13('0x36')]],_[_0xdf13('0x3a')](_0x473caf,_[_0xdf13('0x3b')](this[_0xdf13('0x1b')][_0x473caf['uniqueid']])));}}if(_0x473caf['context']==='from-sip'){if(this[_0xdf13('0x1c')][_0x473caf[_0xdf13('0x3c')]['split']('-')[0x0]]){if(_0x473caf[_0xdf13('0x3d')]==_0xdf13('0x3e')){this[_0xdf13('0x1c')][_0x473caf[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]]['destconnectedlinenum']=_0x473caf['connectedlinenum'];this[_0xdf13('0x34')](util['format'](_0xdf13('0x40'),this[_0xdf13('0x1c')][_0x473caf['channel'][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x41')]),_0xdf13('0x42'),{'destaccountcode':this[_0xdf13('0x1c')][_0x473caf[_0xdf13('0x3c')]['split']('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x473caf['connectedlinenum']});}}}}}catch(_0xdc4d41){logger[_0xdf13('0x30')](_0xdf13('0x43'),_0x473caf[_0xdf13('0x36')],util[_0xdf13('0x31')](_0xdc4d41,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdf13('0x33')][_0xdf13('0x23')]=function(_0x3aca71){try{if(this[_0xdf13('0x44')](_0x3aca71)){logger['debug'](_0xdf13('0x45'),_0x3aca71[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x3aca71,{'showHidden':![],'depth':null}));if(_0x3aca71[_0xdf13('0x36')]===_0x3aca71['linkedid']&&_0x3aca71['channel']!='OutgoingSpoolFailed'){if(_[_0xdf13('0x32')](this['channels'][_0x3aca71['uniqueid']])){logger[_0xdf13('0x2f')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x3aca71[_0xdf13('0x36')],_0x3aca71[_0xdf13('0x46')],_0x3aca71[_0xdf13('0x3d')]);this['channels'][_0x3aca71['uniqueid']]=new Channel();this['channels'][_0x3aca71[_0xdf13('0x36')]]['starttime']=moment()[_0xdf13('0x47')](_0xdf13('0x48'));this[_0xdf13('0x1b')][_0x3aca71['uniqueid']][_0xdf13('0x49')]=dispositions[_['toNumber'](_0x3aca71[_0xdf13('0x4a')])];_[_0xdf13('0x4b')](this[_0xdf13('0x1b')][_0x3aca71[_0xdf13('0x36')]],_['pick'](_0x3aca71,_[_0xdf13('0x3b')](this[_0xdf13('0x1b')][_0x3aca71[_0xdf13('0x36')]])));if(_0x3aca71[_0xdf13('0x46')]===_0xdf13('0x4c')){if(this[_0xdf13('0x1c')][_0x3aca71[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]]){if(_['isUndefined'](this[_0xdf13('0x1c')][_0x3aca71['channel']['split']('-')[0x0]][_0xdf13('0x4d')])){this['agents'][_0x3aca71['channel'][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x4d')]=_0x3aca71[_0xdf13('0x3d')];logger[_0xdf13('0x38')](_0xdf13('0x4e'),_0x3aca71[_0xdf13('0x36')],util[_0xdf13('0x31')]({'destaccountcode':this[_0xdf13('0x1c')][_0x3aca71[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x4f')],'destconnectedlinenum':_0x3aca71[_0xdf13('0x3d')]},{'showHidden':![],'depth':null}));this[_0xdf13('0x34')](util[_0xdf13('0x47')](_0xdf13('0x40'),this[_0xdf13('0x1c')][_0x3aca71[_0xdf13('0x3c')]['split']('-')[0x0]][_0xdf13('0x41')]),'user:agentconnect',{'destaccountcode':this['agents'][_0x3aca71[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x4f')],'destconnectedlinenum':_0x3aca71[_0xdf13('0x3d')]});}}}}}}}catch(_0x20f9a0){logger[_0xdf13('0x30')](_0xdf13('0x50'),_0x3aca71[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x20f9a0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdf13('0x33')][_0xdf13('0x21')]=function(_0x18f8ac){try{if(this[_0xdf13('0x44')](_0x18f8ac)){logger[_0xdf13('0x38')](_0xdf13('0x51'),_0x18f8ac['uniqueid'],util['inspect'](_0x18f8ac,{'showHidden':![],'depth':null}));if(_0x18f8ac[_0xdf13('0x36')]===_0x18f8ac[_0xdf13('0x52')]&&_0x18f8ac[_0xdf13('0x3d')]!='h'&&_0x18f8ac['channel']!=_0xdf13('0x53')){_0x18f8ac[_0xdf13('0x54')]=_0x18f8ac[_0xdf13('0x54')][_0xdf13('0x55')]();_0x18f8ac[_0xdf13('0x56')]=_0x18f8ac['appdata']&&_0x18f8ac[_0xdf13('0x57')]['startsWith'](_0xdf13('0x58'))?_0x18f8ac['appdata']:(_0x18f8ac[_0xdf13('0x57')]||_0x18f8ac[_0xdf13('0x56')])['toLowerCase']();logger[_0xdf13('0x2f')](_0xdf13('0x59'),_0x18f8ac[_0xdf13('0x36')],_0x18f8ac[_0xdf13('0x54')],_0x18f8ac['applicationdata']);if(_[_0xdf13('0x32')](this[_0xdf13('0x1b')][_0x18f8ac['uniqueid']])){this[_0xdf13('0x1b')][_0x18f8ac[_0xdf13('0x36')]]=new Channel();this[_0xdf13('0x1b')][_0x18f8ac['uniqueid']][_0xdf13('0x5a')]=_0x18f8ac[_0xdf13('0x5b')]?moment()[_0xdf13('0x5c')](moment['duration'](_0x18f8ac[_0xdf13('0x5b')])[_0xdf13('0x5d')](),_0xdf13('0x5d'))[_0xdf13('0x47')](_0xdf13('0x48')):moment()[_0xdf13('0x47')](_0xdf13('0x48'));this[_0xdf13('0x1b')][_0x18f8ac[_0xdf13('0x36')]][_0xdf13('0x49')]='NO\x20ANSWER';}_[_0xdf13('0x4b')](this[_0xdf13('0x1b')][_0x18f8ac[_0xdf13('0x36')]],_[_0xdf13('0x3a')](_0x18f8ac,_[_0xdf13('0x3b')](this[_0xdf13('0x1b')][_0x18f8ac['uniqueid']])));if(_[_0xdf13('0x5e')](applications,_0x18f8ac['application'])){this[_0xdf13('0x1b')][_0x18f8ac['uniqueid']][_0xdf13('0x5f')]=_0x18f8ac[_0xdf13('0x54')];this[_0xdf13('0x1b')][_0x18f8ac[_0xdf13('0x36')]][_0xdf13('0x60')]=_0x18f8ac[_0xdf13('0x56')];if(_0x18f8ac[_0xdf13('0x54')]===_0xdf13('0x61')&&_[_0xdf13('0x62')](_0x18f8ac[_0xdf13('0x56')]['toLowerCase'](),_0xdf13('0x63'))){var _0x1d7c20=_0x18f8ac['applicationdata']['split']('=');var _0x3dd4be=_0x1d7c20[0x0][_0xdf13('0x55')]()['match'](/cdr\((.*)\)/);if(_0x3dd4be){this[_0xdf13('0x1b')][_0x18f8ac[_0xdf13('0x36')]][_0x3dd4be[0x1]]=_0x1d7c20[0x1];}}else if(_0x18f8ac[_0xdf13('0x54')]===_0xdf13('0x11')){this[_0xdf13('0x1b')][_0x18f8ac[_0xdf13('0x36')]][_0xdf13('0x11')]=_0x18f8ac[_0xdf13('0x56')][_0xdf13('0x3f')](',')[0x0];}}}}}catch(_0x490af1){logger[_0xdf13('0x30')](_0xdf13('0x64'),_0x18f8ac[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x490af1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdf13('0x33')][_0xdf13('0x25')]=function(_0x3ca239){try{if(this[_0xdf13('0x44')](_0x3ca239)){logger['info'](_0xdf13('0x65'),_0x3ca239[_0xdf13('0x36')],_0x3ca239['linkedid'],_0x3ca239[_0xdf13('0x66')],_0x3ca239['calleridnum']);logger[_0xdf13('0x38')](_0xdf13('0x67'),_0x3ca239[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x3ca239,{'showHidden':![],'depth':null}));if(_0x3ca239[_0xdf13('0x36')]!==_0x3ca239[_0xdf13('0x52')]){if(this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]]){if(_0x3ca239['channelstate']==='6'){if(!this['channels'][_0x3ca239[_0xdf13('0x52')]][_0xdf13('0x68')]){var _0x545473=moment();this[_0xdf13('0x1b')][_0x3ca239['linkedid']]['answered']=!![];this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]][_0xdf13('0x69')]=_0x545473[_0xdf13('0x47')](_0xdf13('0x48'));if(this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]][_0xdf13('0x5a')]){this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]]['holdtime']=_0x545473[_0xdf13('0x6a')](this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]][_0xdf13('0x5a')],_0xdf13('0x5d'));}}this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]][_0xdf13('0x52')]=_0x3ca239[_0xdf13('0x36')];if(_0x3ca239['calleridnum']!=='xcally-motion-preview'){this[_0xdf13('0x1b')][_0x3ca239['linkedid']][_0xdf13('0x6b')]=_0x3ca239[_0xdf13('0x37')];}this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]]['connectedlinename']=_0x3ca239[_0xdf13('0x66')];this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]][_0xdf13('0x6c')]=_0x3ca239[_0xdf13('0x3c')];this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]]['disposition']=dispositions[_['toNumber'](_0x3ca239['channelstate'])];if(this[_0xdf13('0x1c')][_0x3ca239[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]]){this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]][_0xdf13('0x6d')]=this[_0xdf13('0x1c')][_0x3ca239[_0xdf13('0x3c')]['split']('-')[0x0]]['id'];this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]][_0xdf13('0x6e')]=this[_0xdf13('0x1c')][_0x3ca239[_0xdf13('0x3c')]['split']('-')[0x0]][_0xdf13('0x41')];}}}}else{if(this['channels'][_0x3ca239[_0xdf13('0x36')]]){if(_0x3ca239[_0xdf13('0x4a')]==='6'){if(this[_0xdf13('0x1c')][_0x3ca239[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]]){this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x36')]][_0xdf13('0x6d')]=this[_0xdf13('0x1c')][_0x3ca239[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]]['id'];this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x36')]][_0xdf13('0x6e')]=this[_0xdf13('0x1c')][_0x3ca239[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x41')];}}}}if(_0x3ca239['channelstate']==='6'&&_0x3ca239['context']===_0xdf13('0x4c')){if(this[_0xdf13('0x1c')][_0x3ca239[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]]){this[_0xdf13('0x1c')][_0x3ca239[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x4d')]=_0x3ca239[_0xdf13('0x3d')];var _0x46fd79;if(this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x36')]])_0x46fd79=this[_0xdf13('0x1b')][_0x3ca239['uniqueid']]['routealias'];else if(this['channels'][_0x3ca239[_0xdf13('0x52')]])_0x46fd79=this[_0xdf13('0x1b')][_0x3ca239[_0xdf13('0x52')]]['routealias'];logger[_0xdf13('0x38')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x3ca239[_0xdf13('0x36')],util['inspect']({'destaccountcode':this['agents'][_0x3ca239['channel'][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x4f')],'destconnectedlinenum':_0x3ca239[_0xdf13('0x3d')],'routealias':_0x46fd79},{'showHidden':![],'depth':null}));this[_0xdf13('0x34')](util['format'](_0xdf13('0x40'),this['agents'][_0x3ca239['channel'][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x41')]),_0xdf13('0x42'),{'destaccountcode':this[_0xdf13('0x1c')][_0x3ca239['channel']['split']('-')[0x0]][_0xdf13('0x4f')],'destconnectedlinenum':_0x3ca239[_0xdf13('0x3d')],'routealias':_0x46fd79});}}}}catch(_0x2e2de5){logger[_0xdf13('0x30')](_0xdf13('0x6f'),_0x3ca239[_0xdf13('0x36')],util['inspect'](_0x2e2de5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdf13('0x33')]['syncMixMonitorFilename']=function(_0x2c13bf,_0x55c6af){try{if(this[_0xdf13('0x1b')][_0x2c13bf]){logger[_0xdf13('0x2f')](_0xdf13('0x70'),_0x2c13bf,_0x55c6af);this['channels'][_0x2c13bf][_0xdf13('0x71')]=!![];if(_['endsWith'](_0x55c6af,_0xdf13('0x72'))){_0x55c6af=_0x55c6af[_0xdf13('0x73')](_0xdf13('0x72'),_0xdf13('0x74'));}this[_0xdf13('0x1b')][_0x2c13bf][_0xdf13('0x75')]=_0x55c6af;var _0xa315e4=_[_0xdf13('0x76')](this[_0xdf13('0x1b')][_0x2c13bf][_0xdf13('0x77')],{'filename':_0x55c6af});if(_['isNil'](_0xa315e4)){this[_0xdf13('0x1b')][_0x2c13bf][_0xdf13('0x77')]['push']({'filename':_0x55c6af,'createdAt':moment()[_0xdf13('0x47')](_0xdf13('0x48')),'mixmonitorid':'','status':_0xdf13('0x78')});}}}catch(_0x4504ed){logger[_0xdf13('0x30')](_0xdf13('0x79'),_0x2c13bf,util[_0xdf13('0x31')](_0x4504ed,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdf13('0x33')][_0xdf13('0x27')]=function(_0x5aedac){try{if(this['isNotNull'](_0x5aedac)){logger[_0xdf13('0x38')](_0xdf13('0x7a'),_0x5aedac['uniqueid'],util['inspect'](_0x5aedac,{'showHidden':![],'depth':null}));if(this[_0xdf13('0x1b')][_0x5aedac[_0xdf13('0x36')]]&&_0x5aedac['channel']!=_0xdf13('0x53')){if(this[_0xdf13('0x44')](_0x5aedac[_0xdf13('0x7b')])){if(this[_0xdf13('0x44')](_0x5aedac[_0xdf13('0x7b')][_0xdf13('0x7c')])){logger[_0xdf13('0x2f')](_0xdf13('0x7d'),_0x5aedac[_0xdf13('0x36')],_0x5aedac[_0xdf13('0x7e')]);this['syncMixMonitorFilename'](_0x5aedac[_0xdf13('0x36')],_0x5aedac[_0xdf13('0x7e')]);}else if(this[_0xdf13('0x44')](_0x5aedac[_0xdf13('0x7b')][_0xdf13('0x7f')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x5aedac[_0xdf13('0x36')],_0x5aedac[_0xdf13('0x7e')]);this[_0xdf13('0x1b')][_0x5aedac[_0xdf13('0x36')]]['calleridnum']=_0x5aedac[_0xdf13('0x7e')];}else if(this['isNotNull'](_0x5aedac[_0xdf13('0x7b')]['xmd-callerid'])){logger[_0xdf13('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x5aedac[_0xdf13('0x36')],_0x5aedac[_0xdf13('0x7e')]);this['channels'][_0x5aedac['uniqueid']][_0xdf13('0x80')]=_0x5aedac[_0xdf13('0x7e')];}else if(this[_0xdf13('0x44')](_0x5aedac['variable'][_0xdf13('0x81')])){logger[_0xdf13('0x2f')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5aedac[_0xdf13('0x36')],_0x5aedac['value']);this[_0xdf13('0x1b')][_0x5aedac[_0xdf13('0x36')]][_0xdf13('0x82')]=_0x5aedac[_0xdf13('0x7e')];}else if(this['isNotNull'](_0x5aedac[_0xdf13('0x7b')]['xmd-queue'])){logger[_0xdf13('0x2f')](_0xdf13('0x83'),_0x5aedac['uniqueid'],_0x5aedac[_0xdf13('0x7e')]['split'](',')[0x0]);this[_0xdf13('0x1b')][_0x5aedac[_0xdf13('0x36')]]['queue']=_0x5aedac['value'][_0xdf13('0x3f')](',')[0x0];}else if(this[_0xdf13('0x44')](_0x5aedac[_0xdf13('0x7b')][_0xdf13('0x84')])){logger['info'](_0xdf13('0x85'),_0x5aedac[_0xdf13('0x36')],_0x5aedac[_0xdf13('0x7e')]);this[_0xdf13('0x1b')][_0x5aedac[_0xdf13('0x36')]][_0xdf13('0x86')]=_0x5aedac['value'];}else if(this[_0xdf13('0x44')](_0x5aedac[_0xdf13('0x7b')][_0xdf13('0x87')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x5aedac[_0xdf13('0x36')],_0x5aedac[_0xdf13('0x7e')]);this['channels'][_0x5aedac[_0xdf13('0x36')]]['destination']=_0x5aedac['value'];}else if(this['isNotNull'](_0x5aedac[_0xdf13('0x7b')]['xmd-callerid-preview'])){logger[_0xdf13('0x2f')](_0xdf13('0x88'),_0x5aedac[_0xdf13('0x36')],_0x5aedac[_0xdf13('0x7e')]);this[_0xdf13('0x1b')][_0x5aedac[_0xdf13('0x36')]][_0xdf13('0x89')]=_0x5aedac[_0xdf13('0x7e')];}else if(this[_0xdf13('0x44')](_0x5aedac[_0xdf13('0x7b')][_0xdf13('0x8a')])){logger['info'](_0xdf13('0x8b'),_0x5aedac['uniqueid'],_0x5aedac[_0xdf13('0x7e')]);this[_0xdf13('0x1b')][_0x5aedac[_0xdf13('0x36')]]['queue']=_0x5aedac[_0xdf13('0x7e')];}else if(this['isNotNull'](_0x5aedac['variable'][_0xdf13('0x8c')])){logger['info'](_0xdf13('0x8d'),_0x5aedac['uniqueid'],_0x5aedac['value']);this[_0xdf13('0x1b')][_0x5aedac[_0xdf13('0x36')]][_0xdf13('0x8e')]=_0x5aedac[_0xdf13('0x7e')];}}}else if(this[_0xdf13('0x44')](_0x5aedac[_0xdf13('0x7b')][_0xdf13('0x7c')])){if(_0x5aedac[_0xdf13('0x7e')]){var _0x159c90=path[_0xdf13('0x8f')](_0x5aedac[_0xdf13('0x7e')])[_0xdf13('0x41')];logger[_0xdf13('0x2f')](_0xdf13('0x7d'),_0x159c90,_0x5aedac[_0xdf13('0x7e')]);this[_0xdf13('0x90')](_0x159c90,_0x5aedac[_0xdf13('0x7e')]);}}else if(this[_0xdf13('0x1b')][_0x5aedac[_0xdf13('0x52')]]){if(this[_0xdf13('0x44')](_0x5aedac['variable'])){if(this['isNotNull'](_0x5aedac[_0xdf13('0x7b')]['sipcallid'])){logger[_0xdf13('0x2f')](_0xdf13('0x8d'),_0x5aedac[_0xdf13('0x52')],_0x5aedac[_0xdf13('0x7e')]);this[_0xdf13('0x1b')][_0x5aedac['linkedid']]['sipcalllinkedid']=_0x5aedac[_0xdf13('0x7e')];}}}}}catch(_0x566a16){logger[_0xdf13('0x30')](_0xdf13('0x91'),_0x5aedac[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x566a16,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdf13('0x33')][_0xdf13('0x28')]=function(_0x119405){try{if(this[_0xdf13('0x44')](_0x119405)){logger[_0xdf13('0x38')](_0xdf13('0x92'),_0x119405[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x119405,{'showHidden':![],'depth':null}));if(this[_0xdf13('0x1b')][_0x119405['uniqueid']]){logger[_0xdf13('0x2f')](_0xdf13('0x93'),_0x119405['uniqueid'],_0x119405['cause-txt']);var _0x441040=moment();this[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]]['endtime']=_0x441040[_0xdf13('0x47')](_0xdf13('0x48'));this[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]][_0xdf13('0x5b')]=_0x441040[_0xdf13('0x6a')](this['channels'][_0x119405['uniqueid']][_0xdf13('0x5a')],'seconds');if(this[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]]['answered']){this[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]][_0xdf13('0x94')]=_0x441040[_0xdf13('0x6a')](this[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]][_0xdf13('0x69')],_0xdf13('0x5d'));this[_0xdf13('0x1b')][_0x119405['uniqueid']]['holdtime']=this[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]][_0xdf13('0x5b')]-this[_0xdf13('0x1b')][_0x119405['uniqueid']][_0xdf13('0x94')];}if(_0x119405['context']===_0xdf13('0x4c')){if(this[_0xdf13('0x1c')][_0x119405[_0xdf13('0x3c')]['split']('-')[0x0]]){this[_0xdf13('0x1c')][_0x119405[_0xdf13('0x3c')]['split']('-')[0x0]]=_[_0xdf13('0x95')](this[_0xdf13('0x1c')][_0x119405[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0xdf13('0x96'),_0x119405['uniqueid'],util[_0xdf13('0x31')]({'id':this['agents'][_0x119405[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x119405[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x4f')]},{'showHidden':![],'depth':null}));this[_0xdf13('0x34')](util['format'](_0xdf13('0x40'),this[_0xdf13('0x1c')][_0x119405[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x41')]),_0xdf13('0x97'),{'id':this[_0xdf13('0x1c')][_0x119405[_0xdf13('0x3c')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xdf13('0x1c')][_0x119405[_0xdf13('0x3c')][_0xdf13('0x3f')]('-')[0x0]][_0xdf13('0x4f')]});}}var _0x870ded=this;Promise[_0xdf13('0x98')]()[_0xdf13('0x99')](function(){var _0x37f685=_0x870ded[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]];if(typeof _0x37f685[_0xdf13('0x9a')]===_0xdf13('0x9b'))return;if(_['isEmpty'](_0x37f685[_0xdf13('0x77')]))return;return RpcSetting[_0xdf13('0x9c')]()[_0xdf13('0x99')](function(_0x197826){if(!_0x197826[_0xdf13('0x9d')])return;return Promise[_0xdf13('0x98')]()[_0xdf13('0x99')](function(){return ami[_0xdf13('0x9e')]({'action':_0xdf13('0x9f'),'channel':_0x37f685['channel']})[_0xdf13('0xa0')](function(){});})[_0xdf13('0x99')](function(){return ami['Action']({'action':_0xdf13('0x9f'),'channel':_0x37f685[_0xdf13('0x6c')]})[_0xdf13('0xa0')](function(){})[_0xdf13('0xa1')](function(){var _0x1e2621=_0x870ded[_0xdf13('0x1c')][_0x37f685['destinationchannel']['split']('-')[0x0]];if(!_0x1e2621)return;io[_0xdf13('0x34')](_0xdf13('0xa2'),{'agentId':_0x1e2621['id'],'uniqueid':_0x37f685[_0xdf13('0x36')]});});});});})['then'](function(){if(_0x119405[_0xdf13('0xa3')]==='BlindTransfer'){_0x870ded[_0xdf13('0x1d')][_0x119405[_0xdf13('0x36')]]=_0x870ded[_0xdf13('0x1b')][_0x119405['uniqueid']];}else{if(_0x870ded['channels'][_0x119405[_0xdf13('0x36')]][_0xdf13('0x82')]==='outbound'&&_0x870ded[_0xdf13('0x1d')][_0x119405['uniqueid']]){_0x870ded['channels'][_0x119405['uniqueid']][_0xdf13('0x36')]=[_0x870ded[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]]['linkedid'],_0x870ded[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]][_0xdf13('0x52')]=_0x870ded[_0xdf13('0x1b')][_0x119405[_0xdf13('0x36')]][_0xdf13('0x36')]][0x0];delete _0x870ded[_0xdf13('0x1d')][_0x119405[_0xdf13('0x36')]];}}logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x119405[_0xdf13('0x36')],util['inspect'](_0x870ded[_0xdf13('0x1b')][_0x119405['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xdf13('0x34')](_0xdf13('0xa4'),_0x870ded['channels'][_0x119405[_0xdf13('0x36')]]);delete _0x870ded['channels'][_0x119405[_0xdf13('0x36')]];});}}}catch(_0x3d16c2){logger[_0xdf13('0x30')](_0xdf13('0xa5'),_0x119405[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x3d16c2,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xdf13('0x2b')]=function(_0x50dcee){try{if(this[_0xdf13('0x44')](_0x50dcee)){logger[_0xdf13('0x2f')](_0xdf13('0xa6'),_0x50dcee[_0xdf13('0x36')],_0x50dcee[_0xdf13('0xa7')],_0x50dcee[_0xdf13('0xa8')]);logger['debug']('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x50dcee[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x50dcee,{'showHidden':![],'depth':null}));if(this['channels'][_0x50dcee['transfereeuniqueid']]){this[_0xdf13('0x1b')][_0x50dcee['transfereeuniqueid']][_0xdf13('0xa9')]=_0x50dcee['origtransferercalleridnum'];this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xaa')]][_0xdf13('0xab')]=_0x50dcee['transfertargetcalleridnum'];if(this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xac')]]){var _0x4b087b=this[_0xdf13('0x1b')][_0x50dcee['secondtransfereruniqueid']];this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xac')]]=this['channels'][_0x50dcee['transfereeuniqueid']];this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xaa')]]=_0x4b087b;}}else if(this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xad')]]){this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xad')]]['transfercalleridnum']=_0x50dcee['origtransferercalleridnum'];this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xad')]][_0xdf13('0xab')]=_0x50dcee[_0xdf13('0xa8')];if(this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xae')]]){var _0x4b087b=this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xae')]];this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xae')]]=this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xad')]];this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xad')]]=_0x4b087b;}}if((this['channels'][_0x50dcee['origtransfereruniqueid']]||this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xaf')]])&&this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xac')]]){var _0x27c48b=_[_0xdf13('0xb0')]([this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xae')]],this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xaf')]],this[_0xdf13('0x1b')][_0x50dcee['secondtransfereruniqueid']]],function(_0x285e6e){return _0x285e6e&&_0x285e6e['type']===_0xdf13('0xb1')&&_0x285e6e['routeid'];});if(_0x27c48b){if(this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xae')]])this['channels'][_0x50dcee['origtransfereruniqueid']]['transferType']=_0xdf13('0xb2');if(this['channels'][_0x50dcee[_0xdf13('0xaf')]])this[_0xdf13('0x1b')][_0x50dcee[_0xdf13('0xaf')]][_0xdf13('0x9a')]=_0xdf13('0xb2');this[_0xdf13('0x1b')][_0x50dcee['secondtransfereruniqueid']][_0xdf13('0x9a')]=_0xdf13('0xb2');}}}}catch(_0x3e503d){logger[_0xdf13('0x30')](_0xdf13('0xb3'),_0x50dcee['uniqueid'],util['inspect'](_0x3e503d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdf13('0x33')][_0xdf13('0xb4')]=function(_0x5e993c){try{if(this['isNotNull'](_0x5e993c)){logger[_0xdf13('0x2f')](_0xdf13('0xb5'),_0x5e993c[_0xdf13('0x36')],_0x5e993c['transfereecalleridnum'],_0x5e993c[_0xdf13('0xb6')]);logger[_0xdf13('0x38')](_0xdf13('0xb7'),_0x5e993c['uniqueid'],util[_0xdf13('0x31')](_0x5e993c,{'showHidden':![],'depth':null}));if(this['channels'][_0x5e993c[_0xdf13('0xaa')]]){this[_0xdf13('0x1b')][_0x5e993c['transfereeuniqueid']]['transfercalleridnum']=_0x5e993c[_0xdf13('0xb8')];this[_0xdf13('0x1b')][_0x5e993c[_0xdf13('0xaa')]]['transferconnectedlinenum']=_0x5e993c[_0xdf13('0xb6')];this['channels'][_0x5e993c[_0xdf13('0xaa')]][_0xdf13('0x9a')]=_0xdf13('0xb9');this[_0xdf13('0x28')]({'event':_0xdf13('0xba'),'uniqueid':_0x5e993c['transfereeuniqueid'],'context':_0x5e993c['context'],'channel':_0x5e993c['transfererchannel']});}else{this[_0xdf13('0x1b')][_0x5e993c[_0xdf13('0xbb')]][_0xdf13('0x9a')]=_0xdf13('0xb9');}}}catch(_0x43e6f1){logger[_0xdf13('0x30')]('[%s][voiceCallReport][blindtransfer]',_0x5e993c[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x43e6f1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xdf13('0x33')][_0xdf13('0x2c')]=function(_0x1dd738){try{if(this['isNotNull'](_0x1dd738)){logger['debug']('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x1dd738[_0xdf13('0x36')],util['inspect'](_0x1dd738,{'showHidden':![],'depth':null}));if(this['channels'][_0x1dd738[_0xdf13('0x36')]]){if(!_['isNil'](this[_0xdf13('0x1b')][_0x1dd738['uniqueid']]['answertime'])){this[_0xdf13('0x1b')][_0x1dd738['uniqueid']][_0xdf13('0xbc')]=moment()[_0xdf13('0x47')](_0xdf13('0x48'));logger[_0xdf13('0x2f')](_0xdf13('0xbd'),_0x1dd738[_0xdf13('0x36')],this['channels'][_0x1dd738[_0xdf13('0x36')]]['mohstarttime']);}}}}catch(_0x22e83a){logger['error'](_0xdf13('0xbe'),_0x1dd738[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x22e83a,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xdf13('0x2e')]=function(_0x440a6b){try{if(this[_0xdf13('0x44')](_0x440a6b)){logger[_0xdf13('0x38')](_0xdf13('0xbf'),_0x440a6b[_0xdf13('0x36')],util[_0xdf13('0x31')](_0x440a6b,{'showHidden':![],'depth':null}));if(this[_0xdf13('0x1b')][_0x440a6b[_0xdf13('0x36')]]){if(!_[_0xdf13('0xc0')](this['channels'][_0x440a6b[_0xdf13('0x36')]]['mohstarttime'])){this[_0xdf13('0x1b')][_0x440a6b[_0xdf13('0x36')]][_0xdf13('0xc1')]+=moment()[_0xdf13('0xc2')](0x0)['diff'](this[_0xdf13('0x1b')][_0x440a6b[_0xdf13('0x36')]][_0xdf13('0xbc')],_0xdf13('0x5d'));logger[_0xdf13('0x2f')](_0xdf13('0xc3'),_0x440a6b[_0xdf13('0x36')],this[_0xdf13('0x1b')][_0x440a6b[_0xdf13('0x36')]][_0xdf13('0xc1')]);delete this[_0xdf13('0x1b')][_0x440a6b[_0xdf13('0x36')]]['mohstarttime'];}}}}catch(_0x6d36d5){logger[_0xdf13('0x30')](_0xdf13('0xc4'),_0x440a6b[_0xdf13('0x36')],util['inspect'](_0x6d36d5,{'showHidden':![],'depth':null}));}};module[_0xdf13('0xc5')]=VoiceCallReport; \ No newline at end of file +var _0x7574=['user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','exten','starttime','format','disposition','toNumber','channelstate','pick','from-sip','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newexten]\x20event:','application','applicationdata','appdata','startsWith','CDR(routeAlias)','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastapplication','lastdata','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','destinationchannel','membername','UserId','routealias','[%s][voiceCallReport][newstate]','monitor','endsWith','.wav49','.WAV','find','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','parse','syncMixMonitorFilename','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','diff','holdtime','billableseconds','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','resolve','transferType','undefined','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','webbar:stopmonitors','then','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transferconnectedlinenum','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','path','../../../config/environment','../../../config/logger','ami','../ami','../rpc/setting','unknown','not_inuse','inuse','invalid','unavailable','ringinuse','onhold','set','queue','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','defaults','redis','channels','agents','blindTransfers','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','linkedid','merge','keys','context','channel','split','xcally-motion-preview','destconnectedlinenum','connectedlinenum','user:%s','name'];(function(_0x2dade6,_0x3f17bf){var _0x4935ae=function(_0xfc99a5){while(--_0xfc99a5){_0x2dade6['push'](_0x2dade6['shift']());}};_0x4935ae(++_0x3f17bf);}(_0x7574,0x85));var _0x4757=function(_0x588aaa,_0x475e99){_0x588aaa=_0x588aaa-0x0;var _0x28f84a=_0x7574[_0x588aaa];return _0x28f84a;};'use strict';var BPromise=require(_0x4757('0x0'));var _=require(_0x4757('0x1'));var moment=require(_0x4757('0x2'));var util=require(_0x4757('0x3'));var path=require(_0x4757('0x4'));var Redis=require('ioredis');var config=require(_0x4757('0x5'));var logger=require(_0x4757('0x6'))(_0x4757('0x7'));var ami=require(_0x4757('0x8'));var Channel=require('../model/channel');var RpcSetting=require(_0x4757('0x9'));var statusDesc=[_0x4757('0xa'),_0x4757('0xb'),_0x4757('0xc'),'busy',_0x4757('0xd'),_0x4757('0xe'),'ringing',_0x4757('0xf'),_0x4757('0x10')];var applications=[_0x4757('0x11'),_0x4757('0x12'),'agi',_0x4757('0x13'),_0x4757('0x14'),_0x4757('0x15')];var dispositions=[_0x4757('0x16'),_0x4757('0x17'),_0x4757('0x17'),'NO\x20ANSWER',_0x4757('0x16'),_0x4757('0x16'),_0x4757('0x18'),'BUSY',_0x4757('0x17'),_0x4757('0x17'),_0x4757('0x17')];var actions={};config['redis']=_[_0x4757('0x19')](config[_0x4757('0x1a')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4757('0x1a')]));function VoiceCallReport(_0x14b4d1){this[_0x4757('0x1b')]=_0x14b4d1[_0x4757('0x1b')];this[_0x4757('0x1c')]=_0x14b4d1['agents'];this[_0x4757('0x1d')]={};ami['on']('coreshowchannel',this[_0x4757('0x1e')][_0x4757('0x1f')](this));ami['on'](_0x4757('0x20'),this[_0x4757('0x1e')][_0x4757('0x1f')](this));ami['on']('newchannel',this[_0x4757('0x21')]['bind'](this));ami['on'](_0x4757('0x22'),this[_0x4757('0x23')][_0x4757('0x1f')](this));ami['on'](_0x4757('0x24'),this[_0x4757('0x25')]['bind'](this));ami['on']('hangup',this[_0x4757('0x26')][_0x4757('0x1f')](this));ami['on'](_0x4757('0x27'),this[_0x4757('0x28')][_0x4757('0x1f')](this));ami['on']('attendedtransfer',this[_0x4757('0x29')][_0x4757('0x1f')](this));ami['on']('blindtransfer',this[_0x4757('0x2a')]['bind'](this));ami['on'](_0x4757('0x2b'),this[_0x4757('0x2c')][_0x4757('0x1f')](this));ami['on'](_0x4757('0x2d'),this['syncMusicOnHoldStop'][_0x4757('0x1f')](this));try{logger[_0x4757('0x2e')](_0x4757('0x2f'));ami[_0x4757('0x30')]();}catch(_0x25a698){logger[_0x4757('0x31')](_0x4757('0x32'),util[_0x4757('0x33')](_0x25a698,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x4757('0x34')]['isNotNull']=function(_0x2a7389){return _0x2a7389!==null&&!_[_0x4757('0x35')](_0x2a7389);};VoiceCallReport['prototype'][_0x4757('0x36')]=function(_0x2d13db,_0x47d177,_0x565e16){io['to'](_0x2d13db)['emit'](_0x47d177,_0x565e16);};VoiceCallReport[_0x4757('0x34')]['syncNewCallerId']=function(_0x3189e4){try{if(this[_0x4757('0x37')](_0x3189e4)){logger[_0x4757('0x2e')](_0x4757('0x38'),_0x3189e4[_0x4757('0x39')],_0x3189e4[_0x4757('0x3a')],_0x3189e4['calleridnum']);logger[_0x4757('0x3b')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x3189e4[_0x4757('0x39')],util['inspect'](_0x3189e4,{'showHidden':![],'depth':null}));if(_0x3189e4[_0x4757('0x39')]===_0x3189e4[_0x4757('0x3c')]){if(!_[_0x4757('0x35')](this[_0x4757('0x1b')][_0x3189e4[_0x4757('0x39')]])){_[_0x4757('0x3d')](this[_0x4757('0x1b')][_0x3189e4[_0x4757('0x39')]],_['pick'](_0x3189e4,_[_0x4757('0x3e')](this['channels'][_0x3189e4['uniqueid']])));}}if(_0x3189e4[_0x4757('0x3f')]==='from-sip'){if(this[_0x4757('0x1c')][_0x3189e4[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]]){if(_0x3189e4['exten']==_0x4757('0x42')){this[_0x4757('0x1c')][_0x3189e4[_0x4757('0x40')]['split']('-')[0x0]][_0x4757('0x43')]=_0x3189e4[_0x4757('0x44')];this[_0x4757('0x36')](util['format'](_0x4757('0x45'),this[_0x4757('0x1c')][_0x3189e4[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]][_0x4757('0x46')]),_0x4757('0x47'),{'destaccountcode':this['agents'][_0x3189e4[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]][_0x4757('0x48')],'destconnectedlinenum':_0x3189e4[_0x4757('0x44')]});}}}}}catch(_0x4d6ecb){logger[_0x4757('0x31')](_0x4757('0x49'),_0x3189e4['uniqueid'],util['inspect'](_0x4d6ecb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4757('0x34')][_0x4757('0x21')]=function(_0x372bdc){try{if(this[_0x4757('0x37')](_0x372bdc)){logger['debug'](_0x4757('0x4a'),_0x372bdc['uniqueid'],util[_0x4757('0x33')](_0x372bdc,{'showHidden':![],'depth':null}));if(_0x372bdc[_0x4757('0x39')]===_0x372bdc[_0x4757('0x3c')]&&_0x372bdc[_0x4757('0x40')]!=_0x4757('0x4b')){if(_[_0x4757('0x35')](this[_0x4757('0x1b')][_0x372bdc[_0x4757('0x39')]])){logger['info']('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x372bdc[_0x4757('0x39')],_0x372bdc[_0x4757('0x3f')],_0x372bdc[_0x4757('0x4c')]);this[_0x4757('0x1b')][_0x372bdc[_0x4757('0x39')]]=new Channel();this['channels'][_0x372bdc[_0x4757('0x39')]][_0x4757('0x4d')]=moment()[_0x4757('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4757('0x1b')][_0x372bdc['uniqueid']][_0x4757('0x4f')]=dispositions[_[_0x4757('0x50')](_0x372bdc[_0x4757('0x51')])];_[_0x4757('0x3d')](this[_0x4757('0x1b')][_0x372bdc[_0x4757('0x39')]],_[_0x4757('0x52')](_0x372bdc,_[_0x4757('0x3e')](this[_0x4757('0x1b')][_0x372bdc[_0x4757('0x39')]])));if(_0x372bdc['context']===_0x4757('0x53')){if(this[_0x4757('0x1c')][_0x372bdc[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]]){if(_[_0x4757('0x35')](this['agents'][_0x372bdc[_0x4757('0x40')]['split']('-')[0x0]][_0x4757('0x43')])){this[_0x4757('0x1c')][_0x372bdc['channel']['split']('-')[0x0]][_0x4757('0x43')]=_0x372bdc[_0x4757('0x4c')];logger['debug'](_0x4757('0x54'),_0x372bdc['uniqueid'],util[_0x4757('0x33')]({'destaccountcode':this[_0x4757('0x1c')][_0x372bdc[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]][_0x4757('0x48')],'destconnectedlinenum':_0x372bdc[_0x4757('0x4c')]},{'showHidden':![],'depth':null}));this[_0x4757('0x36')](util[_0x4757('0x4e')](_0x4757('0x45'),this[_0x4757('0x1c')][_0x372bdc[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]][_0x4757('0x46')]),_0x4757('0x47'),{'destaccountcode':this[_0x4757('0x1c')][_0x372bdc[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x372bdc['exten']});}}}}}}}catch(_0xc425ff){logger['error']('[%s][voiceCallReport][newchannel]',_0x372bdc['uniqueid'],util[_0x4757('0x33')](_0xc425ff,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4757('0x34')][_0x4757('0x1e')]=function(_0xf2999){try{if(this[_0x4757('0x37')](_0xf2999)){logger[_0x4757('0x3b')](_0x4757('0x55'),_0xf2999[_0x4757('0x39')],util['inspect'](_0xf2999,{'showHidden':![],'depth':null}));if(_0xf2999['uniqueid']===_0xf2999[_0x4757('0x3c')]&&_0xf2999['exten']!='h'&&_0xf2999[_0x4757('0x40')]!=_0x4757('0x4b')){_0xf2999[_0x4757('0x56')]=_0xf2999[_0x4757('0x56')]['toLowerCase']();_0xf2999[_0x4757('0x57')]=_0xf2999[_0x4757('0x58')]&&_0xf2999['appdata'][_0x4757('0x59')](_0x4757('0x5a'))?_0xf2999[_0x4757('0x58')]:(_0xf2999[_0x4757('0x58')]||_0xf2999[_0x4757('0x57')])[_0x4757('0x5b')]();logger[_0x4757('0x2e')](_0x4757('0x5c'),_0xf2999[_0x4757('0x39')],_0xf2999[_0x4757('0x56')],_0xf2999['applicationdata']);if(_['isUndefined'](this[_0x4757('0x1b')][_0xf2999[_0x4757('0x39')]])){this[_0x4757('0x1b')][_0xf2999[_0x4757('0x39')]]=new Channel();this[_0x4757('0x1b')][_0xf2999[_0x4757('0x39')]][_0x4757('0x4d')]=_0xf2999[_0x4757('0x5d')]?moment()['subtract'](moment[_0x4757('0x5d')](_0xf2999['duration'])['seconds'](),_0x4757('0x5e'))[_0x4757('0x4e')](_0x4757('0x5f')):moment()[_0x4757('0x4e')](_0x4757('0x5f'));this[_0x4757('0x1b')][_0xf2999['uniqueid']][_0x4757('0x4f')]='NO\x20ANSWER';}_['merge'](this[_0x4757('0x1b')][_0xf2999[_0x4757('0x39')]],_['pick'](_0xf2999,_[_0x4757('0x3e')](this[_0x4757('0x1b')][_0xf2999[_0x4757('0x39')]])));if(_[_0x4757('0x60')](applications,_0xf2999[_0x4757('0x56')])){this[_0x4757('0x1b')][_0xf2999[_0x4757('0x39')]][_0x4757('0x61')]=_0xf2999[_0x4757('0x56')];this['channels'][_0xf2999[_0x4757('0x39')]][_0x4757('0x62')]=_0xf2999[_0x4757('0x57')];if(_0xf2999['application']===_0x4757('0x11')&&_[_0x4757('0x59')](_0xf2999[_0x4757('0x57')]['toLowerCase'](),_0x4757('0x63'))){var _0x36660a=_0xf2999[_0x4757('0x57')][_0x4757('0x41')]('=');var _0x17e6e2=_0x36660a[0x0][_0x4757('0x5b')]()[_0x4757('0x64')](/cdr\((.*)\)/);if(_0x17e6e2){this['channels'][_0xf2999[_0x4757('0x39')]][_0x17e6e2[0x1]]=_0x36660a[0x1];}}else if(_0xf2999[_0x4757('0x56')]===_0x4757('0x12')){this[_0x4757('0x1b')][_0xf2999[_0x4757('0x39')]][_0x4757('0x12')]=_0xf2999[_0x4757('0x57')][_0x4757('0x41')](',')[0x0];}}}}}catch(_0x491bd9){logger[_0x4757('0x31')](_0x4757('0x65'),_0xf2999[_0x4757('0x39')],util[_0x4757('0x33')](_0x491bd9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4757('0x34')][_0x4757('0x23')]=function(_0x414441){try{if(this[_0x4757('0x37')](_0x414441)){logger[_0x4757('0x2e')](_0x4757('0x66'),_0x414441[_0x4757('0x39')],_0x414441[_0x4757('0x3c')],_0x414441[_0x4757('0x3a')],_0x414441[_0x4757('0x67')]);logger[_0x4757('0x3b')](_0x4757('0x68'),_0x414441['uniqueid'],util[_0x4757('0x33')](_0x414441,{'showHidden':![],'depth':null}));if(_0x414441['uniqueid']!==_0x414441[_0x4757('0x3c')]){if(this[_0x4757('0x1b')][_0x414441['linkedid']]){if(_0x414441['channelstate']==='6'){if(!this[_0x4757('0x1b')][_0x414441[_0x4757('0x3c')]]['answered']){var _0x515f11=moment();this['channels'][_0x414441[_0x4757('0x3c')]][_0x4757('0x69')]=!![];this[_0x4757('0x1b')][_0x414441[_0x4757('0x3c')]][_0x4757('0x6a')]=_0x515f11[_0x4757('0x4e')](_0x4757('0x5f'));if(this[_0x4757('0x1b')][_0x414441['linkedid']][_0x4757('0x4d')]){this[_0x4757('0x1b')][_0x414441['linkedid']]['holdtime']=_0x515f11['diff'](this[_0x4757('0x1b')][_0x414441[_0x4757('0x3c')]][_0x4757('0x4d')],_0x4757('0x5e'));}}this[_0x4757('0x1b')][_0x414441[_0x4757('0x3c')]][_0x4757('0x3c')]=_0x414441[_0x4757('0x39')];if(_0x414441['calleridnum']!==_0x4757('0x42')){this['channels'][_0x414441[_0x4757('0x3c')]]['connectedlinenum']=_0x414441[_0x4757('0x67')];}this[_0x4757('0x1b')][_0x414441[_0x4757('0x3c')]]['connectedlinename']=_0x414441['calleridname'];this['channels'][_0x414441[_0x4757('0x3c')]][_0x4757('0x6b')]=_0x414441[_0x4757('0x40')];this[_0x4757('0x1b')][_0x414441[_0x4757('0x3c')]][_0x4757('0x4f')]=dispositions[_['toNumber'](_0x414441[_0x4757('0x51')])];if(this['agents'][_0x414441[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]]){this[_0x4757('0x1b')][_0x414441[_0x4757('0x3c')]]['UserId']=this[_0x4757('0x1c')][_0x414441[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]]['id'];this[_0x4757('0x1b')][_0x414441['linkedid']][_0x4757('0x6c')]=this[_0x4757('0x1c')][_0x414441[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]][_0x4757('0x46')];}}}}else{if(this[_0x4757('0x1b')][_0x414441[_0x4757('0x39')]]){if(_0x414441['channelstate']==='6'){if(this[_0x4757('0x1c')][_0x414441[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]]){this['channels'][_0x414441['uniqueid']][_0x4757('0x6d')]=this[_0x4757('0x1c')][_0x414441[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]]['id'];this[_0x4757('0x1b')][_0x414441[_0x4757('0x39')]][_0x4757('0x6c')]=this['agents'][_0x414441[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]]['name'];}}}}if(_0x414441[_0x4757('0x51')]==='6'&&_0x414441['context']==='from-sip'){if(this[_0x4757('0x1c')][_0x414441[_0x4757('0x40')]['split']('-')[0x0]]){this[_0x4757('0x1c')][_0x414441[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]][_0x4757('0x43')]=_0x414441[_0x4757('0x4c')];var _0x134540;if(this['channels'][_0x414441[_0x4757('0x39')]])_0x134540=this['channels'][_0x414441['uniqueid']]['routealias'];else if(this['channels'][_0x414441[_0x4757('0x3c')]])_0x134540=this[_0x4757('0x1b')][_0x414441[_0x4757('0x3c')]][_0x4757('0x6e')];logger[_0x4757('0x3b')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x414441['uniqueid'],util[_0x4757('0x33')]({'destaccountcode':this[_0x4757('0x1c')][_0x414441[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]][_0x4757('0x48')],'destconnectedlinenum':_0x414441[_0x4757('0x4c')],'routealias':_0x134540},{'showHidden':![],'depth':null}));this['emit'](util[_0x4757('0x4e')](_0x4757('0x45'),this[_0x4757('0x1c')][_0x414441[_0x4757('0x40')]['split']('-')[0x0]][_0x4757('0x46')]),_0x4757('0x47'),{'destaccountcode':this[_0x4757('0x1c')][_0x414441[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]][_0x4757('0x48')],'destconnectedlinenum':_0x414441[_0x4757('0x4c')],'routealias':_0x134540});}}}}catch(_0x4d38ec){logger[_0x4757('0x31')](_0x4757('0x6f'),_0x414441[_0x4757('0x39')],util[_0x4757('0x33')](_0x4d38ec,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4757('0x34')]['syncMixMonitorFilename']=function(_0x549ce4,_0x1b3c4f){try{if(this[_0x4757('0x1b')][_0x549ce4]){logger['info']('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x549ce4,_0x1b3c4f);this[_0x4757('0x1b')][_0x549ce4][_0x4757('0x70')]=!![];if(_[_0x4757('0x71')](_0x1b3c4f,'.wav49')){_0x1b3c4f=_0x1b3c4f['replace'](_0x4757('0x72'),_0x4757('0x73'));}this[_0x4757('0x1b')][_0x549ce4]['monitorFilename']=_0x1b3c4f;var _0x50e8fc=_[_0x4757('0x74')](this[_0x4757('0x1b')][_0x549ce4][_0x4757('0x75')],{'filename':_0x1b3c4f});if(_[_0x4757('0x76')](_0x50e8fc)){this[_0x4757('0x1b')][_0x549ce4][_0x4757('0x75')][_0x4757('0x77')]({'filename':_0x1b3c4f,'createdAt':moment()[_0x4757('0x4e')](_0x4757('0x5f')),'mixmonitorid':'','status':_0x4757('0x78')});}}}catch(_0x5cb960){logger['error'](_0x4757('0x79'),_0x549ce4,util[_0x4757('0x33')](_0x5cb960,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4757('0x34')][_0x4757('0x25')]=function(_0x5e032c){try{if(this['isNotNull'](_0x5e032c)){logger['debug'](_0x4757('0x7a'),_0x5e032c[_0x4757('0x39')],util['inspect'](_0x5e032c,{'showHidden':![],'depth':null}));if(this[_0x4757('0x1b')][_0x5e032c[_0x4757('0x39')]]&&_0x5e032c['channel']!=_0x4757('0x4b')){if(this[_0x4757('0x37')](_0x5e032c[_0x4757('0x7b')])){if(this[_0x4757('0x37')](_0x5e032c[_0x4757('0x7b')][_0x4757('0x7c')])){logger[_0x4757('0x2e')](_0x4757('0x7d'),_0x5e032c['uniqueid'],_0x5e032c[_0x4757('0x7e')]);this['syncMixMonitorFilename'](_0x5e032c[_0x4757('0x39')],_0x5e032c[_0x4757('0x7e')]);}else if(this['isNotNull'](_0x5e032c['variable'][_0x4757('0x7f')])){logger[_0x4757('0x2e')](_0x4757('0x80'),_0x5e032c[_0x4757('0x39')],_0x5e032c[_0x4757('0x7e')]);this[_0x4757('0x1b')][_0x5e032c[_0x4757('0x39')]][_0x4757('0x67')]=_0x5e032c[_0x4757('0x7e')];}else if(this[_0x4757('0x37')](_0x5e032c[_0x4757('0x7b')][_0x4757('0x81')])){logger[_0x4757('0x2e')](_0x4757('0x82'),_0x5e032c['uniqueid'],_0x5e032c['value']);this[_0x4757('0x1b')][_0x5e032c[_0x4757('0x39')]][_0x4757('0x83')]=_0x5e032c['value'];}else if(this['isNotNull'](_0x5e032c[_0x4757('0x7b')]['xmd-cdrtype'])){logger[_0x4757('0x2e')](_0x4757('0x84'),_0x5e032c[_0x4757('0x39')],_0x5e032c[_0x4757('0x7e')]);this['channels'][_0x5e032c[_0x4757('0x39')]][_0x4757('0x85')]=_0x5e032c['value'];}else if(this['isNotNull'](_0x5e032c[_0x4757('0x7b')][_0x4757('0x86')])){logger[_0x4757('0x2e')](_0x4757('0x87'),_0x5e032c[_0x4757('0x39')],_0x5e032c['value']['split'](',')[0x0]);this[_0x4757('0x1b')][_0x5e032c[_0x4757('0x39')]][_0x4757('0x12')]=_0x5e032c[_0x4757('0x7e')]['split'](',')[0x0];}else if(this[_0x4757('0x37')](_0x5e032c['variable'][_0x4757('0x88')])){logger[_0x4757('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x5e032c[_0x4757('0x39')],_0x5e032c[_0x4757('0x7e')]);this['channels'][_0x5e032c[_0x4757('0x39')]][_0x4757('0x89')]=_0x5e032c[_0x4757('0x7e')];}else if(this['isNotNull'](_0x5e032c[_0x4757('0x7b')][_0x4757('0x8a')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x5e032c[_0x4757('0x39')],_0x5e032c['value']);this[_0x4757('0x1b')][_0x5e032c['uniqueid']][_0x4757('0x8b')]=_0x5e032c[_0x4757('0x7e')];}else if(this[_0x4757('0x37')](_0x5e032c[_0x4757('0x7b')]['xmd-callerid-preview'])){logger[_0x4757('0x2e')](_0x4757('0x8c'),_0x5e032c[_0x4757('0x39')],_0x5e032c[_0x4757('0x7e')]);this[_0x4757('0x1b')][_0x5e032c[_0x4757('0x39')]][_0x4757('0x8d')]=_0x5e032c[_0x4757('0x7e')];}else if(this[_0x4757('0x37')](_0x5e032c[_0x4757('0x7b')][_0x4757('0x8e')])){logger[_0x4757('0x2e')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x5e032c[_0x4757('0x39')],_0x5e032c[_0x4757('0x7e')]);this[_0x4757('0x1b')][_0x5e032c[_0x4757('0x39')]][_0x4757('0x12')]=_0x5e032c[_0x4757('0x7e')];}else if(this[_0x4757('0x37')](_0x5e032c[_0x4757('0x7b')][_0x4757('0x8f')])){logger[_0x4757('0x2e')](_0x4757('0x90'),_0x5e032c[_0x4757('0x39')],_0x5e032c[_0x4757('0x7e')]);this[_0x4757('0x1b')][_0x5e032c[_0x4757('0x39')]]['sipcalluniqueid']=_0x5e032c[_0x4757('0x7e')];}}}else if(this['isNotNull'](_0x5e032c[_0x4757('0x7b')][_0x4757('0x7c')])){if(_0x5e032c[_0x4757('0x7e')]){var _0x1ba575=path[_0x4757('0x91')](_0x5e032c[_0x4757('0x7e')])[_0x4757('0x46')];logger[_0x4757('0x2e')](_0x4757('0x7d'),_0x1ba575,_0x5e032c[_0x4757('0x7e')]);this[_0x4757('0x92')](_0x1ba575,_0x5e032c[_0x4757('0x7e')]);}}else if(this[_0x4757('0x1b')][_0x5e032c['linkedid']]){if(this['isNotNull'](_0x5e032c[_0x4757('0x7b')])){if(this[_0x4757('0x37')](_0x5e032c[_0x4757('0x7b')][_0x4757('0x8f')])){logger[_0x4757('0x2e')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x5e032c[_0x4757('0x3c')],_0x5e032c[_0x4757('0x7e')]);this['channels'][_0x5e032c[_0x4757('0x3c')]]['sipcalllinkedid']=_0x5e032c[_0x4757('0x7e')];}}}}}catch(_0x59fea6){logger[_0x4757('0x31')](_0x4757('0x93'),_0x5e032c[_0x4757('0x39')],util[_0x4757('0x33')](_0x59fea6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4757('0x34')][_0x4757('0x26')]=function(_0x4d6b19){try{if(this['isNotNull'](_0x4d6b19)){logger['debug'](_0x4757('0x94'),_0x4d6b19[_0x4757('0x39')],util['inspect'](_0x4d6b19,{'showHidden':![],'depth':null}));if(this['channels'][_0x4d6b19[_0x4757('0x39')]]){logger['info'](_0x4757('0x95'),_0x4d6b19[_0x4757('0x39')],_0x4d6b19[_0x4757('0x96')]);var _0xa50364=moment();this[_0x4757('0x1b')][_0x4d6b19[_0x4757('0x39')]][_0x4757('0x97')]=_0xa50364[_0x4757('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x4757('0x1b')][_0x4d6b19[_0x4757('0x39')]][_0x4757('0x5d')]=_0xa50364['diff'](this[_0x4757('0x1b')][_0x4d6b19[_0x4757('0x39')]]['starttime'],'seconds');if(this['channels'][_0x4d6b19[_0x4757('0x39')]][_0x4757('0x69')]){this[_0x4757('0x1b')][_0x4d6b19[_0x4757('0x39')]]['billableseconds']=_0xa50364[_0x4757('0x98')](this['channels'][_0x4d6b19[_0x4757('0x39')]][_0x4757('0x6a')],'seconds');this['channels'][_0x4d6b19[_0x4757('0x39')]][_0x4757('0x99')]=this[_0x4757('0x1b')][_0x4d6b19[_0x4757('0x39')]][_0x4757('0x5d')]-this['channels'][_0x4d6b19[_0x4757('0x39')]][_0x4757('0x9a')];}if(_0x4d6b19[_0x4757('0x3f')]==='from-sip'){if(this[_0x4757('0x1c')][_0x4d6b19[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]]){this[_0x4757('0x1c')][_0x4d6b19[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]]=_['omit'](this['agents'][_0x4d6b19[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]],['destconnectedlinenum']);logger[_0x4757('0x3b')](_0x4757('0x9b'),_0x4d6b19[_0x4757('0x39')],util[_0x4757('0x33')]({'id':this[_0x4757('0x1c')][_0x4d6b19[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]]['id'],'destaccountcode':this[_0x4757('0x1c')][_0x4d6b19[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]][_0x4757('0x48')]},{'showHidden':![],'depth':null}));this[_0x4757('0x36')](util[_0x4757('0x4e')]('user:%s',this[_0x4757('0x1c')][_0x4d6b19['channel'][_0x4757('0x41')]('-')[0x0]][_0x4757('0x46')]),_0x4757('0x9c'),{'id':this[_0x4757('0x1c')][_0x4d6b19[_0x4757('0x40')][_0x4757('0x41')]('-')[0x0]]['id'],'destaccountcode':this[_0x4757('0x1c')][_0x4d6b19[_0x4757('0x40')]['split']('-')[0x0]][_0x4757('0x48')]});}}var _0x4bdc5a=this;Promise[_0x4757('0x9d')]()['then'](function(){var _0x35bd2b=_0x4bdc5a[_0x4757('0x1b')][_0x4d6b19[_0x4757('0x39')]];if(typeof _0x35bd2b[_0x4757('0x9e')]===_0x4757('0x9f'))return;if(_['isEmpty'](_0x35bd2b[_0x4757('0x75')]))return;return RpcSetting[_0x4757('0xa0')]()['then'](function(_0xe6240d){if(!_0xe6240d[_0x4757('0xa1')])return;return Promise[_0x4757('0x9d')]()['then'](function(){return ami[_0x4757('0xa2')]({'action':_0x4757('0xa3'),'channel':_0x35bd2b[_0x4757('0x40')]})[_0x4757('0xa4')](function(){});})['then'](function(){return ami[_0x4757('0xa2')]({'action':_0x4757('0xa3'),'channel':_0x35bd2b[_0x4757('0x6b')]})['catch'](function(){})['finally'](function(){var _0x14c450=_0x4bdc5a[_0x4757('0x1c')][_0x35bd2b[_0x4757('0x6b')][_0x4757('0x41')]('-')[0x0]];if(!_0x14c450)return;io[_0x4757('0x36')](_0x4757('0xa5'),{'agentId':_0x14c450['id'],'uniqueid':_0x35bd2b['uniqueid']});});});});})[_0x4757('0xa6')](function(){if(_0x4d6b19['event']===_0x4757('0xa7')){_0x4bdc5a[_0x4757('0x1d')][_0x4d6b19[_0x4757('0x39')]]=_0x4bdc5a[_0x4757('0x1b')][_0x4d6b19[_0x4757('0x39')]];}else{if(_0x4bdc5a[_0x4757('0x1b')][_0x4d6b19[_0x4757('0x39')]][_0x4757('0x85')]===_0x4757('0xa8')&&_0x4bdc5a[_0x4757('0x1d')][_0x4d6b19[_0x4757('0x39')]]){_0x4bdc5a[_0x4757('0x1b')][_0x4d6b19[_0x4757('0x39')]][_0x4757('0x39')]=[_0x4bdc5a[_0x4757('0x1b')][_0x4d6b19['uniqueid']][_0x4757('0x3c')],_0x4bdc5a[_0x4757('0x1b')][_0x4d6b19[_0x4757('0x39')]]['linkedid']=_0x4bdc5a[_0x4757('0x1b')][_0x4d6b19[_0x4757('0x39')]][_0x4757('0x39')]][0x0];delete _0x4bdc5a[_0x4757('0x1d')][_0x4d6b19[_0x4757('0x39')]];}}logger[_0x4757('0x3b')](_0x4757('0xa9'),_0x4d6b19['uniqueid'],util[_0x4757('0x33')](_0x4bdc5a[_0x4757('0x1b')][_0x4d6b19['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x4757('0x36')](_0x4757('0xaa'),_0x4bdc5a['channels'][_0x4d6b19[_0x4757('0x39')]]);delete _0x4bdc5a[_0x4757('0x1b')][_0x4d6b19['uniqueid']];});}}}catch(_0x3a0959){logger[_0x4757('0x31')](_0x4757('0xab'),_0x4d6b19[_0x4757('0x39')],util[_0x4757('0x33')](_0x3a0959,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4757('0x34')]['syncAttendedTransfer']=function(_0x52762f){try{if(this['isNotNull'](_0x52762f)){logger[_0x4757('0x2e')](_0x4757('0xac'),_0x52762f['uniqueid'],_0x52762f[_0x4757('0xad')],_0x52762f[_0x4757('0xae')]);logger[_0x4757('0x3b')](_0x4757('0xaf'),_0x52762f[_0x4757('0x39')],util[_0x4757('0x33')](_0x52762f,{'showHidden':![],'depth':null}));if(this['channels'][_0x52762f[_0x4757('0xb0')]]){this['channels'][_0x52762f['transfereeuniqueid']][_0x4757('0xb1')]=_0x52762f['origtransferercalleridnum'];this[_0x4757('0x1b')][_0x52762f['transfereeuniqueid']]['transferconnectedlinenum']=_0x52762f[_0x4757('0xae')];if(this[_0x4757('0x1b')][_0x52762f['secondtransfereruniqueid']]){var _0x913820=this[_0x4757('0x1b')][_0x52762f[_0x4757('0xb2')]];this['channels'][_0x52762f['secondtransfereruniqueid']]=this[_0x4757('0x1b')][_0x52762f[_0x4757('0xb0')]];this[_0x4757('0x1b')][_0x52762f['transfereeuniqueid']]=_0x913820;}}else if(this[_0x4757('0x1b')][_0x52762f['transfertargetuniqueid']]){this[_0x4757('0x1b')][_0x52762f[_0x4757('0xb3')]]['transfercalleridnum']=_0x52762f[_0x4757('0xad')];this['channels'][_0x52762f['transfertargetuniqueid']]['transferconnectedlinenum']=_0x52762f[_0x4757('0xae')];if(this[_0x4757('0x1b')][_0x52762f[_0x4757('0xb4')]]){var _0x913820=this['channels'][_0x52762f[_0x4757('0xb4')]];this[_0x4757('0x1b')][_0x52762f[_0x4757('0xb4')]]=this['channels'][_0x52762f[_0x4757('0xb3')]];this['channels'][_0x52762f[_0x4757('0xb3')]]=_0x913820;}}if((this[_0x4757('0x1b')][_0x52762f['origtransfereruniqueid']]||this[_0x4757('0x1b')][_0x52762f[_0x4757('0xb5')]])&&this['channels'][_0x52762f[_0x4757('0xb2')]]){var _0x4c574b=_[_0x4757('0xb6')]([this['channels'][_0x52762f['origtransfereruniqueid']],this[_0x4757('0x1b')][_0x52762f[_0x4757('0xb5')]],this['channels'][_0x52762f[_0x4757('0xb2')]]],function(_0x5d09e8){return _0x5d09e8&&_0x5d09e8[_0x4757('0x85')]==='outbound'&&_0x5d09e8[_0x4757('0xb7')];});if(_0x4c574b){if(this[_0x4757('0x1b')][_0x52762f['origtransfereruniqueid']])this['channels'][_0x52762f['origtransfereruniqueid']][_0x4757('0x9e')]='ATTENDED';if(this[_0x4757('0x1b')][_0x52762f[_0x4757('0xb5')]])this[_0x4757('0x1b')][_0x52762f[_0x4757('0xb5')]][_0x4757('0x9e')]='ATTENDED';this[_0x4757('0x1b')][_0x52762f[_0x4757('0xb2')]][_0x4757('0x9e')]='ATTENDED';}}}}catch(_0x15f7c0){logger[_0x4757('0x31')]('[%s][voiceCallReport][attendedtransfer]',_0x52762f[_0x4757('0x39')],util[_0x4757('0x33')](_0x15f7c0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4757('0x34')]['syncBlindTransfer']=function(_0x4d2f82){try{if(this['isNotNull'](_0x4d2f82)){logger[_0x4757('0x2e')](_0x4757('0xb8'),_0x4d2f82['uniqueid'],_0x4d2f82[_0x4757('0xb9')],_0x4d2f82[_0x4757('0xba')]);logger[_0x4757('0x3b')](_0x4757('0xbb'),_0x4d2f82['uniqueid'],util[_0x4757('0x33')](_0x4d2f82,{'showHidden':![],'depth':null}));if(this[_0x4757('0x1b')][_0x4d2f82[_0x4757('0xb0')]]){this[_0x4757('0x1b')][_0x4d2f82['transfereeuniqueid']]['transfercalleridnum']=_0x4d2f82[_0x4757('0xb9')];this[_0x4757('0x1b')][_0x4d2f82[_0x4757('0xb0')]][_0x4757('0xbc')]=_0x4d2f82['extension'];this['channels'][_0x4d2f82['transfereeuniqueid']][_0x4757('0x9e')]=_0x4757('0xbd');this[_0x4757('0x26')]({'event':'BlindTransfer','uniqueid':_0x4d2f82[_0x4757('0xb0')],'context':_0x4d2f82[_0x4757('0x3f')],'channel':_0x4d2f82[_0x4757('0xbe')]});}else{this[_0x4757('0x1b')][_0x4d2f82[_0x4757('0xbf')]][_0x4757('0x9e')]='BLIND';}}}catch(_0x238b3a){logger[_0x4757('0x31')](_0x4757('0xc0'),_0x4d2f82[_0x4757('0x39')],util['inspect'](_0x238b3a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4757('0x34')][_0x4757('0x2c')]=function(_0xccdf13){try{if(this[_0x4757('0x37')](_0xccdf13)){logger[_0x4757('0x3b')](_0x4757('0xc1'),_0xccdf13[_0x4757('0x39')],util['inspect'](_0xccdf13,{'showHidden':![],'depth':null}));if(this['channels'][_0xccdf13[_0x4757('0x39')]]){if(!_['isNil'](this['channels'][_0xccdf13['uniqueid']]['answertime'])){this['channels'][_0xccdf13[_0x4757('0x39')]][_0x4757('0xc2')]=moment()[_0x4757('0x4e')](_0x4757('0x5f'));logger[_0x4757('0x2e')](_0x4757('0xc3'),_0xccdf13[_0x4757('0x39')],this['channels'][_0xccdf13[_0x4757('0x39')]][_0x4757('0xc2')]);}}}}catch(_0x184d46){logger['error'](_0x4757('0xc4'),_0xccdf13[_0x4757('0x39')],util[_0x4757('0x33')](_0x184d46,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x4757('0x34')][_0x4757('0xc5')]=function(_0x5b559e){try{if(this[_0x4757('0x37')](_0x5b559e)){logger[_0x4757('0x3b')](_0x4757('0xc6'),_0x5b559e['uniqueid'],util[_0x4757('0x33')](_0x5b559e,{'showHidden':![],'depth':null}));if(this[_0x4757('0x1b')][_0x5b559e[_0x4757('0x39')]]){if(!_[_0x4757('0x76')](this[_0x4757('0x1b')][_0x5b559e[_0x4757('0x39')]]['mohstarttime'])){this[_0x4757('0x1b')][_0x5b559e[_0x4757('0x39')]]['mohtime']+=moment()[_0x4757('0xc7')](0x0)['diff'](this[_0x4757('0x1b')][_0x5b559e[_0x4757('0x39')]][_0x4757('0xc2')],'seconds');logger['info'](_0x4757('0xc8'),_0x5b559e[_0x4757('0x39')],this[_0x4757('0x1b')][_0x5b559e['uniqueid']][_0x4757('0xc9')]);delete this[_0x4757('0x1b')][_0x5b559e[_0x4757('0x39')]]['mohstarttime'];}}}}catch(_0x421ac1){logger[_0x4757('0x31')](_0x4757('0xca'),_0x5b559e[_0x4757('0x39')],util[_0x4757('0x33')](_0x421ac1,{'showHidden':![],'depth':null}));}};module[_0x4757('0xcb')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 672902b..126b5b4 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 _0x719a=['YYYY-MM-DD\x20HH:mm:ss','called','channel','lastIndexOf','substring','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','inspect','voice:outbound','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','syncVarSet','addVariable','variable','value','outboundrouteid','variables','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','duration','diff','starttime','seconds','total','answertime','answered','holdtime','sumHoldTime','sumBillable','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','application','set','applicationdata','appdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceDialReport][newexten]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','socket.io-emitter','channels','outboundChannels','outbound','applications','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','newexten','syncNewExten','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','format'];(function(_0x47d4d4,_0x43d64d){var _0x2ddb9d=function(_0x11ca44){while(--_0x11ca44){_0x47d4d4['push'](_0x47d4d4['shift']());}};_0x2ddb9d(++_0x43d64d);}(_0x719a,0x14e));var _0xa719=function(_0x328833,_0x47f0db){_0x328833=_0x328833-0x0;var _0x3b0988=_0x719a[_0x328833];return _0x3b0988;};'use strict';var _=require(_0xa719('0x0'));var moment=require('moment');var util=require(_0xa719('0x1'));var Redis=require(_0xa719('0x2'));var config=require(_0xa719('0x3'));var logger=require(_0xa719('0x4'))(_0xa719('0x5'));var ami=require(_0xa719('0x6'));config[_0xa719('0x7')]=_[_0xa719('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xa719('0x9'))(new Redis(config[_0xa719('0x7')]));function VoiceDialReport(_0x2c4b30){this[_0xa719('0xa')]=_0x2c4b30[_0xa719('0xb')];this[_0xa719('0xc')]=_0x2c4b30[_0xa719('0xc')];this[_0xa719('0xd')]={};this['variables']={};ami['on'](_0xa719('0xe'),this[_0xa719('0xf')][_0xa719('0x10')](this));ami['on'](_0xa719('0x11'),this[_0xa719('0x12')][_0xa719('0x10')](this));ami['on']('varset',this['syncVarSet'][_0xa719('0x10')](this));ami['on'](_0xa719('0x13'),this[_0xa719('0x14')]['bind'](this));ami['on'](_0xa719('0x15'),this[_0xa719('0x16')][_0xa719('0x10')](this));}VoiceDialReport[_0xa719('0x17')][_0xa719('0x18')]=function(_0x41c614){return _0x41c614!==null&&!_[_0xa719('0x19')](_0x41c614);};VoiceDialReport[_0xa719('0x17')][_0xa719('0x1a')]=function(_0x52d8dc,_0x34d473,_0x44a98d){io['to'](_0x52d8dc)[_0xa719('0x1a')](_0x34d473,_0x44a98d);};VoiceDialReport[_0xa719('0x17')]['syncDialBegin']=function(_0x1b1eed){try{if(this['isNotNull'](_0x1b1eed)){logger[_0xa719('0x1b')](_0xa719('0x1c'),_0x1b1eed[_0xa719('0x1d')],util['inspect'](_0x1b1eed,{'showHidden':![],'depth':null}));if(this[_0xa719('0xa')][_0x1b1eed['uniqueid']]){_[_0xa719('0x1e')](this[_0xa719('0xa')][_0x1b1eed[_0xa719('0x1d')]],{'starttime':moment()[_0xa719('0x1f')](_0xa719('0x20')),'lastevent':_0xa719('0x21'),'interface':_0x1b1eed[_0xa719('0x22')]['substring'](0x0,_0x1b1eed[_0xa719('0x22')][_0xa719('0x23')]('-')),'membername':_0x1b1eed[_0xa719('0x22')][_0xa719('0x24')](_0x1b1eed['channel'][_0xa719('0x23')]('/')+0x1,_0x1b1eed[_0xa719('0x22')][_0xa719('0x23')]('-'))},_[_0xa719('0x25')](_0x1b1eed,[_0xa719('0x26'),_0xa719('0x27')]));logger['info'](_0xa719('0x28'),_0x1b1eed['uniqueid'],this[_0xa719('0xa')][_0x1b1eed[_0xa719('0x1d')]][_0xa719('0x29')],this['channels'][_0x1b1eed[_0xa719('0x1d')]][_0xa719('0x2a')]);logger[_0xa719('0x1b')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x1b1eed[_0xa719('0x1d')],util[_0xa719('0x2b')](this[_0xa719('0xa')][_0x1b1eed[_0xa719('0x1d')]],{'showHidden':![],'depth':null}));if(this[_0xa719('0xd')][_0x1b1eed[_0xa719('0x1d')]])_[_0xa719('0x1e')](this[_0xa719('0xa')][_0x1b1eed[_0xa719('0x1d')]],this[_0xa719('0xd')][_0x1b1eed[_0xa719('0x1d')]]);this[_0xa719('0x1a')](_0xa719('0x2c'),_0xa719('0x2d'),this['channels'][_0x1b1eed['uniqueid']]);logger['debug']('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x1b1eed[_0xa719('0x1d')],util['inspect'](this[_0xa719('0xa')][_0x1b1eed['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xa719('0x1a')](_0xa719('0x2e'),this[_0xa719('0xa')][_0x1b1eed[_0xa719('0x1d')]]);}}}catch(_0x4cd128){logger[_0xa719('0x2f')]('[%s][voiceDialReport][dialbegin]',_0x1b1eed[_0xa719('0x1d')],util[_0xa719('0x2b')](_0x4cd128,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa719('0x17')][_0xa719('0x12')]=function(_0x116c3d){try{if(this[_0xa719('0x18')](_0x116c3d)){logger[_0xa719('0x1b')](_0xa719('0x30'),_0x116c3d['uniqueid'],util['inspect'](_0x116c3d,{'showHidden':![],'depth':null}));if(this[_0xa719('0xa')][_0x116c3d[_0xa719('0x1d')]]){this[_0xa719('0xa')][_0x116c3d[_0xa719('0x1d')]][_0xa719('0x31')]=_0x116c3d[_0xa719('0x31')];if(_0x116c3d[_0xa719('0x31')]===_0xa719('0x32')){this[_0xa719('0xa')][_0x116c3d[_0xa719('0x1d')]][_0xa719('0x33')]=_0x116c3d[_0xa719('0x33')];this[_0xa719('0xa')][_0x116c3d[_0xa719('0x1d')]][_0xa719('0x34')]=_0x116c3d[_0xa719('0x34')];this['channels'][_0x116c3d[_0xa719('0x1d')]]['answertime']=moment()[_0xa719('0x1f')](_0xa719('0x20'));this[_0xa719('0xa')][_0x116c3d[_0xa719('0x1d')]][_0xa719('0x35')]=_0xa719('0x36');logger[_0xa719('0x37')](_0xa719('0x38'),_0x116c3d[_0xa719('0x1d')],_0x116c3d[_0xa719('0x22')][_0xa719('0x24')](_0x116c3d[_0xa719('0x22')][_0xa719('0x23')]('/')+0x1,_0x116c3d[_0xa719('0x22')]['lastIndexOf']('-')));logger[_0xa719('0x1b')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x116c3d['uniqueid'],util[_0xa719('0x2b')](this['channels'][_0x116c3d[_0xa719('0x1d')]],{'showHidden':![],'depth':null}));ami[_0xa719('0x1a')](_0xa719('0x39'),this[_0xa719('0xa')][_0x116c3d[_0xa719('0x1d')]]);}logger[_0xa719('0x1b')](_0xa719('0x3a'),_0x116c3d['uniqueid'],util[_0xa719('0x2b')](this['channels'][_0x116c3d['uniqueid']],{'showHidden':![],'depth':null}));this[_0xa719('0x1a')]('voice:outbound',_0xa719('0x2d'),this['channels'][_0x116c3d[_0xa719('0x1d')]]);}}}catch(_0xa2da7d){logger['error'](_0xa719('0x3b'),_0x116c3d[_0xa719('0x1d')],util[_0xa719('0x2b')](_0xa2da7d,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xa719('0x3c')]=function(_0x441095){try{if(this[_0xa719('0x18')](_0x441095)){logger[_0xa719('0x1b')]('[%s][voiceDialReport][varset]\x20event:',_0x441095[_0xa719('0x1d')],util[_0xa719('0x2b')](_0x441095,{'showHidden':![],'depth':null}));this[_0xa719('0x3d')](_0x441095[_0xa719('0x1d')],_['keys'](_0x441095[_0xa719('0x3e')])[0x0],_0x441095[_0xa719('0x3f')]);if(this[_0xa719('0x18')](_0x441095[_0xa719('0x3e')])&&this[_0xa719('0x18')](_0x441095[_0xa719('0x3e')][_0xa719('0x40')])){if(_[_0xa719('0x19')](this[_0xa719('0xa')][_0x441095[_0xa719('0x1d')]])){this[_0xa719('0xa')][_0x441095[_0xa719('0x1d')]]={'routeId':_0x441095[_0xa719('0x3f')],'variables':this[_0xa719('0x41')][_0x441095[_0xa719('0x1d')]],'motionChannel':_0xa719('0x42')};logger[_0xa719('0x37')](_0xa719('0x43'),_0x441095[_0xa719('0x1d')],_0x441095['variable'][_0xa719('0x40')],_[_0xa719('0x44')](_0x441095[_0xa719('0x3e')])[0x0],_0x441095[_0xa719('0x3f')]);logger[_0xa719('0x1b')](_0xa719('0x45'),_0x441095[_0xa719('0x1d')],util[_0xa719('0x2b')](this[_0xa719('0xa')][_0x441095['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0xa719('0x2c'),'voice_outbound_channel:save',this[_0xa719('0xa')][_0x441095['uniqueid']]);}}}}catch(_0x3731d1){logger['error'](_0xa719('0x46'),_0x441095[_0xa719('0x1d')],util[_0xa719('0x2b')](_0x3731d1,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xa719('0x3d')]=function(_0x1de5e2,_0x47901f,_0x31cd47){var _0x43bd09=[_0xa719('0x47'),_0xa719('0x48'),_0xa719('0x49'),_0xa719('0x4a'),_0xa719('0x4b'),_0xa719('0x4c'),_0xa719('0x4d'),'rtpaudioqosrttbridged',_0xa719('0x4e'),_0xa719('0x4f'),_0xa719('0x50'),'bridgepvtcallid','membercalls',_0xa719('0x51'),_0xa719('0x52'),_0xa719('0x53'),_0xa719('0x29'),_0xa719('0x54'),_0xa719('0x55')];if(!_[_0xa719('0x56')](_0x47901f)&&!_[_0xa719('0x57')](_0x43bd09,_0x47901f)){if(_[_0xa719('0x19')](this[_0xa719('0x41')][_0x1de5e2])){this[_0xa719('0x41')][_0x1de5e2]={};}this['variables'][_0x1de5e2][_0x47901f]=_0x31cd47;}};VoiceDialReport[_0xa719('0x17')][_0xa719('0x16')]=function(_0x5a757e){try{if(this[_0xa719('0x18')](_0x5a757e)){logger['debug']('[%s][voiceDialReport][hangup]\x20event:',_0x5a757e[_0xa719('0x1d')],util[_0xa719('0x2b')](_0x5a757e,{'showHidden':![],'depth':null}));if(this[_0xa719('0xa')][_0x5a757e['uniqueid']]){logger[_0xa719('0x37')](_0xa719('0x58'),_0x5a757e[_0xa719('0x1d')],_0x5a757e[_0xa719('0x59')]);this['channels'][_0x5a757e[_0xa719('0x1d')]]['endtime']=moment()[_0xa719('0x1f')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa719('0xa')][_0x5a757e[_0xa719('0x1d')]][_0xa719('0x5a')]=moment(this[_0xa719('0xa')][_0x5a757e[_0xa719('0x1d')]]['endtime'])[_0xa719('0x5b')](this['channels'][_0x5a757e[_0xa719('0x1d')]][_0xa719('0x5c')],_0xa719('0x5d'));this[_0xa719('0xa')][_0x5a757e[_0xa719('0x1d')]][_0xa719('0x35')]='complete';this[_0xa719('0xc')][_0xa719('0x5e')]+=0x1;if(this[_0xa719('0xa')][_0x5a757e[_0xa719('0x1d')]][_0xa719('0x5f')]){this[_0xa719('0xc')][_0xa719('0x60')]+=0x1;this[_0xa719('0xa')][_0x5a757e['uniqueid']][_0xa719('0x61')]=moment(this[_0xa719('0xa')][_0x5a757e['uniqueid']][_0xa719('0x5f')])[_0xa719('0x5b')](this['channels'][_0x5a757e[_0xa719('0x1d')]]['starttime'],'seconds');this[_0xa719('0xa')][_0x5a757e['uniqueid']]['billableseconds']=moment(this['channels'][_0x5a757e[_0xa719('0x1d')]]['endtime'])['diff'](this['channels'][_0x5a757e[_0xa719('0x1d')]][_0xa719('0x5f')],_0xa719('0x5d'));this[_0xa719('0xc')][_0xa719('0x62')]+=this['channels'][_0x5a757e['uniqueid']]['holdtime']||0x0;this[_0xa719('0xc')][_0xa719('0x63')]+=this['channels'][_0x5a757e[_0xa719('0x1d')]][_0xa719('0x64')];}this[_0xa719('0xc')][_0xa719('0x65')]+=this['channels'][_0x5a757e['uniqueid']][_0xa719('0x5a')];logger['debug'](_0xa719('0x66'),_0x5a757e[_0xa719('0x1d')],util['inspect'](this[_0xa719('0xa')][_0x5a757e[_0xa719('0x1d')]],{'showHidden':![],'depth':null}));ami[_0xa719('0x1a')](_0xa719('0x67'),this[_0xa719('0xa')][_0x5a757e[_0xa719('0x1d')]]);logger[_0xa719('0x1b')](_0xa719('0x68'),_0x5a757e[_0xa719('0x1d')],util['inspect'](this['channels'][_0x5a757e[_0xa719('0x1d')]],{'showHidden':![],'depth':null}));ami['emit'](_0xa719('0x69'),this['channels'][_0x5a757e[_0xa719('0x1d')]]);logger[_0xa719('0x1b')](_0xa719('0x6a'),_0x5a757e[_0xa719('0x1d')],util[_0xa719('0x2b')](this[_0xa719('0xa')][_0x5a757e[_0xa719('0x1d')]],{'showHidden':![],'depth':null}));this[_0xa719('0x1a')](_0xa719('0x2c'),_0xa719('0x6b'),this[_0xa719('0xc')]);logger[_0xa719('0x37')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this['channels'][_0x5a757e[_0xa719('0x1d')]]));logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x5a757e[_0xa719('0x1d')],util[_0xa719('0x2b')](this[_0xa719('0xa')][_0x5a757e[_0xa719('0x1d')]],{'showHidden':![],'depth':null}));this[_0xa719('0x1a')](_0xa719('0x2c'),_0xa719('0x6c'),this[_0xa719('0xa')][_0x5a757e[_0xa719('0x1d')]]);delete this[_0xa719('0xa')][_0x5a757e['uniqueid']];}else if(this[_0xa719('0xa')][_0x5a757e[_0xa719('0x6d')]]){this[_0xa719('0xa')][_0x5a757e[_0xa719('0x6d')]][_0xa719('0x1d')]=this[_0xa719('0xa')][_0x5a757e[_0xa719('0x6d')]][_0xa719('0x6e')];}if(this['variables'][_0x5a757e[_0xa719('0x1d')]]){delete this[_0xa719('0x41')][_0x5a757e[_0xa719('0x1d')]];}}}catch(_0x28829d){logger['error'](_0xa719('0x6f'),_0x5a757e[_0xa719('0x1d')],util[_0xa719('0x2b')](_0x28829d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xa719('0x17')][_0xa719('0x14')]=function(_0x556e96){try{if(this['isNotNull'](_0x556e96)){logger[_0xa719('0x1b')]('[%s][voiceDialReport][newexten]\x20event:',_0x556e96[_0xa719('0x1d')],util['inspect'](_0x556e96,{'showHidden':![],'depth':null}));if(_0x556e96[_0xa719('0x70')]['toLowerCase']()===_0xa719('0x71')){_0x556e96[_0xa719('0x72')]=(_0x556e96[_0xa719('0x73')]||_0x556e96['applicationdata'])['toLowerCase']();if(_['startsWith'](_0x556e96[_0xa719('0x72')],_0xa719('0x74'))){if(_[_0xa719('0x19')](this['applications'][_0x556e96[_0xa719('0x1d')]]))this['applications'][_0x556e96[_0xa719('0x1d')]]={};logger['info'](_0xa719('0x75'),_0x556e96[_0xa719('0x1d')],_0x556e96['application'],_0x556e96[_0xa719('0x72')]);var _0x1c4276=_0x556e96[_0xa719('0x72')][_0xa719('0x76')]('=');var _0x4f6e94=_0x1c4276[0x0][_0xa719('0x77')](/cdr\((.*)\)/);if(_0x4f6e94)this[_0xa719('0xd')][_0x556e96[_0xa719('0x1d')]][_0x4f6e94[0x1]]=_0x1c4276[0x1];}}}}catch(_0x9e93be){logger[_0xa719('0x2f')](_0xa719('0x78'),_0x556e96[_0xa719('0x1d')],util[_0xa719('0x2b')](_0x9e93be,{'showHidden':![],'depth':null}));}};module[_0xa719('0x79')]=VoiceDialReport; \ No newline at end of file +var _0x80e0=['[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinename','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','isNotNull','[%s][voiceDialReport][varset]\x20event:','keys','variable','value','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','variables','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','diff','starttime','seconds','complete','total','answertime','answered','billableseconds','holdtime','sumBillable','sumDuration','duration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%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:','linkedid','destuniqueid','error','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','application','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','channels','outboundChannels','outbound','applications','dialbegin','syncDialBegin','dialend','syncDialEnd','varset','syncVarSet','bind','newexten','syncNewExten','syncHangup','prototype','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','info','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save'];(function(_0x443e0c,_0x51ca0e){var _0x963c7e=function(_0x1e1b9f){while(--_0x1e1b9f){_0x443e0c['push'](_0x443e0c['shift']());}};_0x963c7e(++_0x51ca0e);}(_0x80e0,0x1af));var _0x080e=function(_0x30620a,_0x459d84){_0x30620a=_0x30620a-0x0;var _0x459c97=_0x80e0[_0x30620a];return _0x459c97;};'use strict';var _=require(_0x080e('0x0'));var moment=require(_0x080e('0x1'));var util=require(_0x080e('0x2'));var Redis=require('ioredis');var config=require(_0x080e('0x3'));var logger=require(_0x080e('0x4'))(_0x080e('0x5'));var ami=require(_0x080e('0x6'));config[_0x080e('0x7')]=_[_0x080e('0x8')](config[_0x080e('0x7')],{'host':_0x080e('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x080e('0x7')]));function VoiceDialReport(_0x5bb85f){this[_0x080e('0xa')]=_0x5bb85f[_0x080e('0xb')];this['outbound']=_0x5bb85f[_0x080e('0xc')];this[_0x080e('0xd')]={};this['variables']={};ami['on'](_0x080e('0xe'),this[_0x080e('0xf')]['bind'](this));ami['on'](_0x080e('0x10'),this[_0x080e('0x11')]['bind'](this));ami['on'](_0x080e('0x12'),this[_0x080e('0x13')][_0x080e('0x14')](this));ami['on'](_0x080e('0x15'),this[_0x080e('0x16')]['bind'](this));ami['on']('hangup',this[_0x080e('0x17')][_0x080e('0x14')](this));}VoiceDialReport[_0x080e('0x18')]['isNotNull']=function(_0x30f8d4){return _0x30f8d4!==null&&!_[_0x080e('0x19')](_0x30f8d4);};VoiceDialReport[_0x080e('0x18')][_0x080e('0x1a')]=function(_0x2b0005,_0x2c0009,_0x36fc94){io['to'](_0x2b0005)['emit'](_0x2c0009,_0x36fc94);};VoiceDialReport[_0x080e('0x18')][_0x080e('0xf')]=function(_0x22618b){try{if(this['isNotNull'](_0x22618b)){logger[_0x080e('0x1b')](_0x080e('0x1c'),_0x22618b[_0x080e('0x1d')],util[_0x080e('0x1e')](_0x22618b,{'showHidden':![],'depth':null}));if(this[_0x080e('0xa')][_0x22618b[_0x080e('0x1d')]]){_[_0x080e('0x1f')](this[_0x080e('0xa')][_0x22618b[_0x080e('0x1d')]],{'starttime':moment()['format'](_0x080e('0x20')),'lastevent':_0x080e('0x21'),'interface':_0x22618b[_0x080e('0x22')][_0x080e('0x23')](0x0,_0x22618b['channel'][_0x080e('0x24')]('-')),'membername':_0x22618b['channel'][_0x080e('0x23')](_0x22618b[_0x080e('0x22')][_0x080e('0x24')]('/')+0x1,_0x22618b['channel'][_0x080e('0x24')]('-'))},_[_0x080e('0x25')](_0x22618b,[_0x080e('0x26'),'privilege']));logger[_0x080e('0x27')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x22618b['uniqueid'],this[_0x080e('0xa')][_0x22618b['uniqueid']][_0x080e('0x28')],this['channels'][_0x22618b[_0x080e('0x1d')]][_0x080e('0x29')]);logger['debug'](_0x080e('0x2a'),_0x22618b['uniqueid'],util[_0x080e('0x1e')](this[_0x080e('0xa')][_0x22618b[_0x080e('0x1d')]],{'showHidden':![],'depth':null}));if(this[_0x080e('0xd')][_0x22618b[_0x080e('0x1d')]])_['merge'](this[_0x080e('0xa')][_0x22618b['uniqueid']],this['applications'][_0x22618b[_0x080e('0x1d')]]);this[_0x080e('0x1a')](_0x080e('0x2b'),_0x080e('0x2c'),this[_0x080e('0xa')][_0x22618b[_0x080e('0x1d')]]);logger['debug'](_0x080e('0x2d'),_0x22618b[_0x080e('0x1d')],util[_0x080e('0x1e')](this[_0x080e('0xa')][_0x22618b[_0x080e('0x1d')]],{'showHidden':![],'depth':null}));ami[_0x080e('0x1a')](_0x080e('0x2e'),this[_0x080e('0xa')][_0x22618b[_0x080e('0x1d')]]);}}}catch(_0x2e10e1){logger['error']('[%s][voiceDialReport][dialbegin]',_0x22618b[_0x080e('0x1d')],util[_0x080e('0x1e')](_0x2e10e1,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x080e('0x18')][_0x080e('0x11')]=function(_0x7eb667){try{if(this['isNotNull'](_0x7eb667)){logger[_0x080e('0x1b')](_0x080e('0x2f'),_0x7eb667[_0x080e('0x1d')],util[_0x080e('0x1e')](_0x7eb667,{'showHidden':![],'depth':null}));if(this[_0x080e('0xa')][_0x7eb667['uniqueid']]){this[_0x080e('0xa')][_0x7eb667[_0x080e('0x1d')]]['dialstatus']=_0x7eb667[_0x080e('0x30')];if(_0x7eb667['dialstatus']==='ANSWER'){this[_0x080e('0xa')][_0x7eb667[_0x080e('0x1d')]]['connectedlinenum']=_0x7eb667['connectedlinenum'];this['channels'][_0x7eb667[_0x080e('0x1d')]][_0x080e('0x31')]=_0x7eb667[_0x080e('0x31')];this[_0x080e('0xa')][_0x7eb667[_0x080e('0x1d')]]['answertime']=moment()['format'](_0x080e('0x20'));this[_0x080e('0xa')][_0x7eb667[_0x080e('0x1d')]][_0x080e('0x32')]=_0x080e('0x33');logger['info'](_0x080e('0x34'),_0x7eb667[_0x080e('0x1d')],_0x7eb667[_0x080e('0x22')][_0x080e('0x23')](_0x7eb667[_0x080e('0x22')][_0x080e('0x24')]('/')+0x1,_0x7eb667[_0x080e('0x22')]['lastIndexOf']('-')));logger[_0x080e('0x1b')](_0x080e('0x35'),_0x7eb667[_0x080e('0x1d')],util[_0x080e('0x1e')](this[_0x080e('0xa')][_0x7eb667[_0x080e('0x1d')]],{'showHidden':![],'depth':null}));ami[_0x080e('0x1a')](_0x080e('0x36'),this[_0x080e('0xa')][_0x7eb667[_0x080e('0x1d')]]);}logger[_0x080e('0x1b')](_0x080e('0x37'),_0x7eb667['uniqueid'],util[_0x080e('0x1e')](this[_0x080e('0xa')][_0x7eb667[_0x080e('0x1d')]],{'showHidden':![],'depth':null}));this['emit'](_0x080e('0x2b'),_0x080e('0x2c'),this[_0x080e('0xa')][_0x7eb667[_0x080e('0x1d')]]);}}}catch(_0x586957){logger['error'](_0x080e('0x38'),_0x7eb667[_0x080e('0x1d')],util[_0x080e('0x1e')](_0x586957,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x080e('0x18')]['syncVarSet']=function(_0x59e10b){try{if(this[_0x080e('0x39')](_0x59e10b)){logger[_0x080e('0x1b')](_0x080e('0x3a'),_0x59e10b['uniqueid'],util[_0x080e('0x1e')](_0x59e10b,{'showHidden':![],'depth':null}));this['addVariable'](_0x59e10b['uniqueid'],_[_0x080e('0x3b')](_0x59e10b[_0x080e('0x3c')])[0x0],_0x59e10b[_0x080e('0x3d')]);if(this[_0x080e('0x39')](_0x59e10b[_0x080e('0x3c')])&&this[_0x080e('0x39')](_0x59e10b['variable']['outboundrouteid'])){if(_['isUndefined'](this[_0x080e('0xa')][_0x59e10b[_0x080e('0x1d')]])){this[_0x080e('0xa')][_0x59e10b[_0x080e('0x1d')]]={'routeId':_0x59e10b['value'],'variables':this['variables'][_0x59e10b['uniqueid']],'motionChannel':_0x080e('0x3e')};logger['info'](_0x080e('0x3f'),_0x59e10b[_0x080e('0x1d')],_0x59e10b[_0x080e('0x3c')][_0x080e('0x40')],_[_0x080e('0x3b')](_0x59e10b[_0x080e('0x3c')])[0x0],_0x59e10b[_0x080e('0x3d')]);logger[_0x080e('0x1b')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x59e10b[_0x080e('0x1d')],util[_0x080e('0x1e')](this[_0x080e('0xa')][_0x59e10b['uniqueid']],{'showHidden':![],'depth':null}));this[_0x080e('0x1a')](_0x080e('0x2b'),'voice_outbound_channel:save',this[_0x080e('0xa')][_0x59e10b[_0x080e('0x1d')]]);}}}}catch(_0x54eafd){logger['error'](_0x080e('0x41'),_0x59e10b[_0x080e('0x1d')],util[_0x080e('0x1e')](_0x54eafd,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x080e('0x18')][_0x080e('0x42')]=function(_0x28ca2a,_0x52b911,_0x478579){var _0x1352ba=[_0x080e('0x43'),_0x080e('0x44'),_0x080e('0x45'),_0x080e('0x46'),'rtpaudioqosloss',_0x080e('0x47'),_0x080e('0x48'),_0x080e('0x49'),_0x080e('0x4a'),'sipuri',_0x080e('0x4b'),_0x080e('0x4c'),'membercalls',_0x080e('0x4d'),_0x080e('0x4e'),_0x080e('0x4f'),_0x080e('0x28'),_0x080e('0x50'),'memberrealtime'];if(!_[_0x080e('0x51')](_0x52b911)&&!_['includes'](_0x1352ba,_0x52b911)){if(_[_0x080e('0x19')](this[_0x080e('0x52')][_0x28ca2a])){this['variables'][_0x28ca2a]={};}this[_0x080e('0x52')][_0x28ca2a][_0x52b911]=_0x478579;}};VoiceDialReport[_0x080e('0x18')][_0x080e('0x17')]=function(_0x20fc2c){try{if(this['isNotNull'](_0x20fc2c)){logger[_0x080e('0x1b')](_0x080e('0x53'),_0x20fc2c[_0x080e('0x1d')],util[_0x080e('0x1e')](_0x20fc2c,{'showHidden':![],'depth':null}));if(this[_0x080e('0xa')][_0x20fc2c[_0x080e('0x1d')]]){logger[_0x080e('0x27')](_0x080e('0x54'),_0x20fc2c[_0x080e('0x1d')],_0x20fc2c[_0x080e('0x55')]);this[_0x080e('0xa')][_0x20fc2c[_0x080e('0x1d')]][_0x080e('0x56')]=moment()['format'](_0x080e('0x20'));this[_0x080e('0xa')][_0x20fc2c['uniqueid']]['duration']=moment(this[_0x080e('0xa')][_0x20fc2c['uniqueid']][_0x080e('0x56')])[_0x080e('0x57')](this[_0x080e('0xa')][_0x20fc2c[_0x080e('0x1d')]][_0x080e('0x58')],_0x080e('0x59'));this['channels'][_0x20fc2c[_0x080e('0x1d')]]['lastevent']=_0x080e('0x5a');this['outbound'][_0x080e('0x5b')]+=0x1;if(this[_0x080e('0xa')][_0x20fc2c[_0x080e('0x1d')]][_0x080e('0x5c')]){this[_0x080e('0xc')][_0x080e('0x5d')]+=0x1;this[_0x080e('0xa')][_0x20fc2c['uniqueid']]['holdtime']=moment(this[_0x080e('0xa')][_0x20fc2c[_0x080e('0x1d')]][_0x080e('0x5c')])[_0x080e('0x57')](this[_0x080e('0xa')][_0x20fc2c[_0x080e('0x1d')]][_0x080e('0x58')],_0x080e('0x59'));this['channels'][_0x20fc2c[_0x080e('0x1d')]][_0x080e('0x5e')]=moment(this[_0x080e('0xa')][_0x20fc2c[_0x080e('0x1d')]][_0x080e('0x56')])['diff'](this[_0x080e('0xa')][_0x20fc2c[_0x080e('0x1d')]][_0x080e('0x5c')],_0x080e('0x59'));this[_0x080e('0xc')]['sumHoldTime']+=this[_0x080e('0xa')][_0x20fc2c[_0x080e('0x1d')]][_0x080e('0x5f')]||0x0;this[_0x080e('0xc')][_0x080e('0x60')]+=this[_0x080e('0xa')][_0x20fc2c['uniqueid']]['billableseconds'];}this[_0x080e('0xc')][_0x080e('0x61')]+=this['channels'][_0x20fc2c[_0x080e('0x1d')]][_0x080e('0x62')];logger[_0x080e('0x1b')](_0x080e('0x63'),_0x20fc2c['uniqueid'],util[_0x080e('0x1e')](this['channels'][_0x20fc2c['uniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceDialReport',this[_0x080e('0xa')][_0x20fc2c[_0x080e('0x1d')]]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x20fc2c[_0x080e('0x1d')],util['inspect'](this[_0x080e('0xa')][_0x20fc2c[_0x080e('0x1d')]],{'showHidden':![],'depth':null}));ami[_0x080e('0x1a')]('custom:dialend',this['channels'][_0x20fc2c[_0x080e('0x1d')]]);logger[_0x080e('0x1b')](_0x080e('0x64'),_0x20fc2c['uniqueid'],util[_0x080e('0x1e')](this[_0x080e('0xa')][_0x20fc2c['uniqueid']],{'showHidden':![],'depth':null}));this[_0x080e('0x1a')]('voice:outbound','voice_outbound:save',this[_0x080e('0xc')]);logger[_0x080e('0x27')](_0x080e('0x65'),JSON[_0x080e('0x66')](this[_0x080e('0xa')][_0x20fc2c['uniqueid']]));logger['debug'](_0x080e('0x67'),_0x20fc2c[_0x080e('0x1d')],util[_0x080e('0x1e')](this['channels'][_0x20fc2c['uniqueid']],{'showHidden':![],'depth':null}));this[_0x080e('0x1a')](_0x080e('0x2b'),'voice_outbound_channel:remove',this[_0x080e('0xa')][_0x20fc2c['uniqueid']]);delete this['channels'][_0x20fc2c[_0x080e('0x1d')]];}else if(this[_0x080e('0xa')][_0x20fc2c[_0x080e('0x68')]]){this[_0x080e('0xa')][_0x20fc2c[_0x080e('0x68')]][_0x080e('0x1d')]=this[_0x080e('0xa')][_0x20fc2c['linkedid']][_0x080e('0x69')];}if(this[_0x080e('0x52')][_0x20fc2c[_0x080e('0x1d')]]){delete this[_0x080e('0x52')][_0x20fc2c[_0x080e('0x1d')]];}}}catch(_0x45132a){logger[_0x080e('0x6a')]('[%s][voiceDialReport][hangup]',_0x20fc2c['uniqueid'],util['inspect'](_0x45132a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x080e('0x18')][_0x080e('0x16')]=function(_0x13b465){try{if(this[_0x080e('0x39')](_0x13b465)){logger[_0x080e('0x1b')](_0x080e('0x6b'),_0x13b465[_0x080e('0x1d')],util[_0x080e('0x1e')](_0x13b465,{'showHidden':![],'depth':null}));if(_0x13b465['application'][_0x080e('0x6c')]()==='set'){_0x13b465[_0x080e('0x6d')]=(_0x13b465[_0x080e('0x6e')]||_0x13b465[_0x080e('0x6d')])[_0x080e('0x6c')]();if(_[_0x080e('0x6f')](_0x13b465[_0x080e('0x6d')],_0x080e('0x70'))){if(_[_0x080e('0x19')](this[_0x080e('0xd')][_0x13b465[_0x080e('0x1d')]]))this['applications'][_0x13b465[_0x080e('0x1d')]]={};logger[_0x080e('0x27')](_0x080e('0x71'),_0x13b465[_0x080e('0x1d')],_0x13b465[_0x080e('0x72')],_0x13b465['applicationdata']);var _0xbcaf7d=_0x13b465['applicationdata'][_0x080e('0x73')]('=');var _0x5f4fc2=_0xbcaf7d[0x0][_0x080e('0x74')](/cdr\((.*)\)/);if(_0x5f4fc2)this[_0x080e('0xd')][_0x13b465[_0x080e('0x1d')]][_0x5f4fc2[0x1]]=_0xbcaf7d[0x1];}}}}catch(_0x1bfda5){logger[_0x080e('0x6a')](_0x080e('0x75'),_0x13b465[_0x080e('0x1d')],util[_0x080e('0x1e')](_0x1bfda5,{'showHidden':![],'depth':null}));}};module[_0x080e('0x76')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index b320abc..658b951 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 _0x4876=['isNotNull','queue','[voiceQueueReport][queuesummary]\x20event:','callers','toNumber','loggedin','emitVoiceQueueSummary','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','syncQueueCallerJoin','[%s][voiceQueueReport][queuecallerjoin]','inbound','queuecallerjoinAt','position','count','routealias','info','merge','pick','push','syncQueueCallerAbandon','last','queuecallercomplete','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerabandon]','[%s][voiceQueueReport][queuecallerleave]','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','syncAgentConnect','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','channel','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','COMPLETEDBY','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','queueposition','EXITWITHKEY','queuecallerleaveAt','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','keys','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberrealtime','[%s][voiceQueueReport][hangup]','sumHoldTime','length','milliseconds','sumBillable','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','transfereeuniqueid','transferexten','secondtransfererexten','transferuniqueid','ATTENDEDTRANSFER','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','ATTENDED','origtransfereruniqueid','transfertargetuniqueid','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','BlindTransfer','context','transfererchannel','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','CDR(routeAlias)','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','exports','util','../../../config/environment','ami','../ami','../model/queueReport','redis','localhost','prototype','enqueue','tail','finally','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','queuesummary','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','queuecallerjoin','queuecallerabandon','syncQueueCallerLeave','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','newexten','syncNewExten','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','waiting','queueStatusComplete','clearZombieChannels','switch','sequence','isNil','Action','message','No\x20such\x20channel','[%s][voiceQueueReport][checkChannel]','inspect','error','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','name','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','voice_queue_channel:remove','voice_queue_presence:remove','type','strategy','answered','available','loggedIn','pTalking','sumDuration','total','unmanaged','abandoned','Trunk','Interval','stringify','md5','debug','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isUndefined','catch','[voiceQueueReport][queues]','then','[voiceQueueReport][queuesummary]'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x6487('0x0'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0x6487('0x1'));var logger=require('../../../config/logger')(_0x6487('0x2'));var ami=require(_0x6487('0x3'));var QueueReport=require(_0x6487('0x4'));config[_0x6487('0x5')]=_['defaults'](config[_0x6487('0x5')],{'host':_0x6487('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6487('0x5')]));var Sequence=function(){};Sequence[_0x6487('0x7')][_0x6487('0x8')]=function(_0x3f237a){this[_0x6487('0x9')]=this[_0x6487('0x9')]?this[_0x6487('0x9')][_0x6487('0xa')](_0x3f237a):_0x3f237a();};function VoiceQueueReport(_0x5f8f96){this['sequence']=new Sequence();this[_0x6487('0xb')]={};this[_0x6487('0xc')]=_0x5f8f96[_0x6487('0xc')];this[_0x6487('0xd')]=_0x5f8f96[_0x6487('0xe')];this[_0x6487('0xf')]=_0x5f8f96[_0x6487('0xf')];this[_0x6487('0x10')]=!![];this['campaigns']=_0x5f8f96[_0x6487('0x11')];this[_0x6487('0x12')]={};ami['on'](_0x6487('0x13'),this[_0x6487('0x14')]['bind'](this));ami['on'](_0x6487('0x15'),this[_0x6487('0x16')][_0x6487('0x17')](this));ami['on'](_0x6487('0x18'),this['syncQueueCallerJoin']['bind'](this));ami['on'](_0x6487('0x19'),this['syncQueueCallerAbandon'][_0x6487('0x17')](this));ami['on']('queuecallerleave',this[_0x6487('0x1a')][_0x6487('0x17')](this));ami['on'](_0x6487('0x1b'),this[_0x6487('0x1c')][_0x6487('0x17')](this));ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on'](_0x6487('0x1d'),this[_0x6487('0x1e')][_0x6487('0x17')](this));ami['on'](_0x6487('0x1f'),this[_0x6487('0x20')][_0x6487('0x17')](this));ami['on'](_0x6487('0x21'),this[_0x6487('0x22')][_0x6487('0x17')](this));ami['on'](_0x6487('0x23'),this[_0x6487('0x24')][_0x6487('0x17')](this));ami['on'](_0x6487('0x25'),this[_0x6487('0x26')][_0x6487('0x17')](this));ami['on'](_0x6487('0x27'),this[_0x6487('0x28')][_0x6487('0x17')](this));ami['on'](_0x6487('0x29'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0x6487('0x2a'),this['syncBlindTransfer']['bind'](this));this[_0x6487('0x2b')]();this[_0x6487('0x2c')]();}function clearChannels(_0x4ebd9d){if(!_[_0x6487('0x2d')](_0x4ebd9d)){for(var _0x38ac56 in _0x4ebd9d){if(_0x4ebd9d[_0x6487('0x2e')](_0x38ac56)){delete _0x4ebd9d[_0x38ac56];}}}}function clearCampaigns(_0x3afdc6){if(!_[_0x6487('0x2d')](_0x3afdc6)){for(var _0x5439f7 in _0x3afdc6){if(_0x3afdc6[_0x6487('0x2e')](_0x5439f7)){_0x3afdc6[_0x5439f7]['originated']=0x0;}}}}function clearVoiceQueues(_0x335bd8){if(!_['isEmpty'](_0x335bd8)){for(var _0x5a9ef0 in _0x335bd8){if(_0x335bd8[_0x6487('0x2e')](_0x5a9ef0)){_0x335bd8[_0x5a9ef0][_0x6487('0x2f')]=0x0;_0x335bd8[_0x5a9ef0][_0x6487('0x30')]=0x0;_0x335bd8[_0x5a9ef0]['pTalking']=0x0;_0x335bd8[_0x5a9ef0][_0x6487('0x31')]=0x0;_0x335bd8[_0x5a9ef0][_0x6487('0x32')]=!![];}}}}function clearAgentBooked(_0x33085b){if(!_[_0x6487('0x2d')](_0x33085b)){for(var _0x35b089 in _0x33085b){if(_0x33085b[_0x6487('0x2e')](_0x35b089)){_0x33085b[_0x35b089]['unlockRR']=!![];}}}}VoiceQueueReport[_0x6487('0x7')][_0x6487('0x33')]=function(){var _0x5df993=this;for(var _0x38126a in this[_0x6487('0xd')]){if(this[_0x6487('0xd')][_0x6487('0x2e')](_0x38126a)&&!this[_0x6487('0xd')][_0x38126a][_0x6487('0x34')]){this[_0x6487('0x35')]['enqueue'](function(){if(!_[_0x6487('0x36')](_0x5df993['channels'][_0x38126a])){return ami[_0x6487('0x37')]({'action':'status','channel':_0x5df993['channels'][_0x38126a]['channel']})['catch'](function(_0x2f077d){if(_0x2f077d[_0x6487('0x38')]===_0x6487('0x39')){setTimeout(function(){if(_0x5df993['channels'][_0x38126a]){delete _0x5df993[_0x6487('0xd')][_0x38126a];logger['error'](_0x6487('0x3a'),_0x38126a,util[_0x6487('0x3b')](_0x2f077d,{'showHidden':![],'depth':null}));}if(_0x5df993[_0x6487('0xb')][_0x38126a]){delete _0x5df993[_0x6487('0xb')][_0x38126a];logger[_0x6487('0x3c')]('[%s][voiceQueueReport][checkQueueReport]',_0x38126a,util[_0x6487('0x3b')](_0x2f077d,{'showHidden':![],'depth':null}));}if(_0x5df993['variables'][_0x38126a]){delete _0x5df993[_0x6487('0x12')][_0x38126a];logger[_0x6487('0x3c')](_0x6487('0x3d'),_0x38126a,util[_0x6487('0x3b')](_0x2f077d,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x6487('0x22')]=function(){logger[_0x6487('0x3c')](_0x6487('0x3e'));clearChannels(this['channels']);this['clearQueueReport'](this[_0x6487('0xb')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x6487('0xf')]);clearCampaigns(this[_0x6487('0x11')]);};VoiceQueueReport[_0x6487('0x7')]['clearQueueReport']=function(_0x171a49){var _0xc3423b=this;if(!_[_0x6487('0x2d')](_0x171a49)){for(var _0x1c128a in _0x171a49){if(_0x171a49[_0x6487('0x2e')](_0x1c128a)){_0xc3423b[_0x6487('0x3f')](_0x171a49[_0x1c128a],_0x6487('0x40'));delete _0x171a49[_0x1c128a];}}}};VoiceQueueReport['prototype'][_0x6487('0x41')]=function(_0x3aa184,_0x192028,_0x5f4720){io['to'](_0x3aa184)[_0x6487('0x41')](_0x192028,_0x5f4720);};VoiceQueueReport['prototype'][_0x6487('0x42')]=function(_0x499b8a,_0x270879){logger['debug'](_0x6487('0x43')+_0x270879+_0x6487('0x44'),_0x499b8a[_0x6487('0x45')],util[_0x6487('0x3b')](_0x499b8a,{'showHidden':![],'depth':null}));this[_0x6487('0x41')](util[_0x6487('0x46')](_0x6487('0x47'),_0x499b8a[_0x6487('0x48')]),'voice_queue_channel:save',_0x499b8a);io[_0x6487('0x41')](_0x6487('0x49'),_0x499b8a);};VoiceQueueReport[_0x6487('0x7')][_0x6487('0x3f')]=function(_0x3598c4,_0x12f7f5){logger['debug'](_0x6487('0x43')+_0x12f7f5+_0x6487('0x4a'),_0x3598c4['uniqueid'],util[_0x6487('0x3b')](_0x3598c4,{'showHidden':![],'depth':null}));this[_0x6487('0x41')](util[_0x6487('0x46')](_0x6487('0x47'),_0x3598c4[_0x6487('0x48')]),_0x6487('0x4b'),_0x3598c4);io[_0x6487('0x41')](_0x6487('0x4c'),_0x3598c4);};VoiceQueueReport[_0x6487('0x7')]['emitVoiceQueueSummary']=function(_0x118efa,_0x11b9c5){if(_0x118efa[_0x6487('0x4d')]==='inbound'){var _0x497f46={'id':_0x118efa['id'],'name':_0x118efa[_0x6487('0x48')],'strategy':_0x118efa[_0x6487('0x4e')],'answered':_0x118efa[_0x6487('0x4f')],'available':_0x118efa[_0x6487('0x50')],'loggedIn':_0x118efa[_0x6487('0x51')],'pTalking':_0x118efa[_0x6487('0x52')],'sumBillable':_0x118efa['sumBillable'],'sumDuration':_0x118efa[_0x6487('0x53')],'sumHoldTime':_0x118efa['sumHoldTime']||0x0,'talking':_0x118efa[_0x6487('0x30')],'total':_0x118efa[_0x6487('0x54')],'type':_0x118efa[_0x6487('0x4d')],'unmanaged':_0x118efa[_0x6487('0x55')],'abandoned':_0x118efa[_0x6487('0x56')],'waiting':_0x118efa[_0x6487('0x31')]};if(_0x118efa[_0x6487('0x57')]){_0x497f46[_0x6487('0x57')]={'id':_0x118efa[_0x6487('0x57')]['id'],'name':_0x118efa[_0x6487('0x57')][_0x6487('0x48')],'active':_0x118efa[_0x6487('0x57')]['active'],'callerid':_0x118efa[_0x6487('0x57')]['callerid']};}if(_0x118efa[_0x6487('0x58')]){_0x497f46[_0x6487('0x58')]={'id':_0x118efa[_0x6487('0x58')]['id'],'name':_0x118efa[_0x6487('0x58')][_0x6487('0x48')]};}var _0x461a8b=md5(JSON[_0x6487('0x59')](_0x497f46));if(_0x118efa[_0x6487('0x5a')]!==_0x461a8b){_0x118efa[_0x6487('0x5a')]=_0x461a8b;logger[_0x6487('0x5b')](_0x6487('0x5c')+_0x11b9c5+_0x6487('0x5d'),util[_0x6487('0x3b')](_0x497f46,{'showHidden':![],'depth':null}));this[_0x6487('0x41')](util[_0x6487('0x46')](_0x6487('0x47'),_0x497f46[_0x6487('0x48')]),_0x6487('0x5e'),_0x497f46);}}};VoiceQueueReport[_0x6487('0x7')]['isNotNull']=function(_0x301f96){return _0x301f96!==null&&!_[_0x6487('0x5f')](_0x301f96);};VoiceQueueReport['prototype'][_0x6487('0x2c')]=function(){var _0x38a94b=this;setInterval(function(){_0x38a94b[_0x6487('0x33')]();ami[_0x6487('0x37')]({'action':'queues'})[_0x6487('0x60')](function(_0x430230){logger[_0x6487('0x3c')](_0x6487('0x61'),util[_0x6487('0x3b')](_0x430230,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x6487('0x7')][_0x6487('0x2b')]=function(){var _0x4e7f65=this;setInterval(function(){if(_0x4e7f65[_0x6487('0x10')]){return ami[_0x6487('0x37')]({'action':_0x6487('0x13')})[_0x6487('0x62')](function(_0x3980ba){_0x4e7f65[_0x6487('0x10')]=![];})[_0x6487('0x60')](function(_0x447f7e){logger[_0x6487('0x3c')](_0x6487('0x63'),util[_0x6487('0x3b')](_0x447f7e,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0x6487('0x14')]=function(_0x5ee1d7){try{if(this[_0x6487('0x64')](_0x5ee1d7)&&this[_0x6487('0x64')](_0x5ee1d7[_0x6487('0x65')])){logger[_0x6487('0x5b')](_0x6487('0x66'),util[_0x6487('0x3b')](_0x5ee1d7,{'showHidden':![],'depth':null}));if(this[_0x6487('0xf')][_0x5ee1d7[_0x6487('0x65')]]){logger['info']('[voiceQueueReport][queuesummary]\x20name:%s',_0x5ee1d7[_0x6487('0x65')]);var _0x1c0ab6=_['countBy'](this[_0x6487('0xd')],_0x6487('0x65'))[_0x5ee1d7[_0x6487('0x65')]]||0x0;var _0x7b0612=_0x1c0ab6-_0x5ee1d7[_0x6487('0x67')];if(this[_0x6487('0xf')][_0x5ee1d7[_0x6487('0x65')]]['waiting']!==_['toNumber'](_0x5ee1d7['callers'])||this['voiceQueues'][_0x5ee1d7['queue']][_0x6487('0x51')]!==_[_0x6487('0x68')](_0x5ee1d7[_0x6487('0x69')])||this[_0x6487('0xf')][_0x5ee1d7[_0x6487('0x65')]][_0x6487('0x50')]!==_[_0x6487('0x68')](_0x5ee1d7[_0x6487('0x50')])||this['voiceQueues'][_0x5ee1d7['queue']][_0x6487('0x30')]!==_0x7b0612){this[_0x6487('0xf')][_0x5ee1d7[_0x6487('0x65')]][_0x6487('0x31')]=_[_0x6487('0x68')](_0x5ee1d7[_0x6487('0x67')]);this[_0x6487('0xf')][_0x5ee1d7[_0x6487('0x65')]]['loggedIn']=_[_0x6487('0x68')](_0x5ee1d7[_0x6487('0x69')]);this[_0x6487('0xf')][_0x5ee1d7[_0x6487('0x65')]][_0x6487('0x50')]=_[_0x6487('0x68')](_0x5ee1d7[_0x6487('0x50')]);this[_0x6487('0xf')][_0x5ee1d7['queue']]['talking']=_0x7b0612>0x0?_0x7b0612:0x0;this[_0x6487('0xf')][_0x5ee1d7[_0x6487('0x65')]][_0x6487('0x30')]=this[_0x6487('0xf')][_0x5ee1d7['queue']]['talking']>_[_0x6487('0x68')](_0x5ee1d7[_0x6487('0x69')])?_[_0x6487('0x68')](_0x5ee1d7[_0x6487('0x69')]):this[_0x6487('0xf')][_0x5ee1d7[_0x6487('0x65')]][_0x6487('0x30')];this[_0x6487('0x6a')](this[_0x6487('0xf')][_0x5ee1d7[_0x6487('0x65')]],'queuesummary');}logger[_0x6487('0x5b')](_0x6487('0x6b'),util[_0x6487('0x3b')](this[_0x6487('0xf')][_0x5ee1d7[_0x6487('0x65')]],{'showHidden':![],'depth':null}));ami[_0x6487('0x41')](_0x6487('0x6c'),this[_0x6487('0xf')][_0x5ee1d7['queue']]);}}}catch(_0x367451){logger['error'](_0x6487('0x63'),util[_0x6487('0x3b')](_0x367451,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6487('0x7')][_0x6487('0x16')]=function(_0xe9d794){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x6487('0x3b')](_0xe9d794,{'showHidden':![],'depth':null}));this[_0x6487('0x10')]=!![];};VoiceQueueReport[_0x6487('0x7')][_0x6487('0x6d')]=function(_0x3ee8a6){try{if(this[_0x6487('0x64')](_0x3ee8a6)){logger[_0x6487('0x5b')](_0x6487('0x6e'),_0x3ee8a6[_0x6487('0x45')],util[_0x6487('0x3b')](_0x3ee8a6,{'showHidden':![],'depth':null}));if(_[_0x6487('0x5f')](this[_0x6487('0xb')][_0x3ee8a6[_0x6487('0x45')]]))this[_0x6487('0xb')][_0x3ee8a6[_0x6487('0x45')]]=[];if(_['isUndefined'](this[_0x6487('0xd')][_0x3ee8a6[_0x6487('0x45')]]))this[_0x6487('0xd')][_0x3ee8a6[_0x6487('0x45')]]={};var _0x4b9fbd=new QueueReport();_0x4b9fbd[_0x6487('0x48')]=_0x3ee8a6['queue'];_0x4b9fbd[_0x6487('0x4d')]=this[_0x6487('0xf')][_0x4b9fbd[_0x6487('0x48')]]&&this[_0x6487('0xf')][_0x4b9fbd[_0x6487('0x48')]][_0x6487('0x4d')]?this[_0x6487('0xf')][_0x4b9fbd[_0x6487('0x48')]][_0x6487('0x4d')]||'inbound':_0x6487('0x6f');_0x4b9fbd['queue']=_0x3ee8a6['queue'];_0x4b9fbd[_0x6487('0x70')]=moment()[_0x6487('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x4b9fbd[_0x6487('0x71')]=_0x3ee8a6[_0x6487('0x71')];_0x4b9fbd['count']=_0x3ee8a6[_0x6487('0x72')];_0x4b9fbd[_0x6487('0x45')]=_0x3ee8a6[_0x6487('0x45')];_0x4b9fbd[_0x6487('0x73')]=this['channels'][_0x3ee8a6[_0x6487('0x45')]]['routealias'];logger[_0x6487('0x74')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x4b9fbd[_0x6487('0x48')],_0x4b9fbd['type']);_[_0x6487('0x75')](_0x4b9fbd,_[_0x6487('0x76')](_0x3ee8a6,_['keys'](_0x4b9fbd)));this[_0x6487('0xb')][_0x3ee8a6[_0x6487('0x45')]][_0x6487('0x77')](_0x4b9fbd);this['channels'][_0x3ee8a6[_0x6487('0x45')]]=_0x4b9fbd;this[_0x6487('0x42')](_0x4b9fbd,_0x6487('0x18'));}}catch(_0x55bd4f){logger[_0x6487('0x3c')](_0x6487('0x6e'),_0x3ee8a6[_0x6487('0x45')],util[_0x6487('0x3b')](_0x55bd4f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6487('0x7')][_0x6487('0x78')]=function(_0xceb29){try{if(this['isNotNull'](_0xceb29)){logger[_0x6487('0x5b')]('[%s][voiceQueueReport][queuecallerabandon]',_0xceb29[_0x6487('0x45')],util[_0x6487('0x3b')](_0xceb29,{'showHidden':![],'depth':null}));if(this[_0x6487('0xb')][_0xceb29[_0x6487('0x45')]]){var _0x7809ae=_[_0x6487('0x79')](this[_0x6487('0xb')][_0xceb29[_0x6487('0x45')]]);_0x7809ae[_0x6487('0x7a')]=![];_0x7809ae['queuecallercompleteAt']=null;_0x7809ae[_0x6487('0x7b')]=_0xceb29['holdtime'];_0x7809ae[_0x6487('0x7c')]=_0xceb29[_0x6487('0x7c')];_0x7809ae['queuecallerabandon']=!![];_0x7809ae[_0x6487('0x7d')]=moment()[_0x6487('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0x7809ae[_0x6487('0x7e')]=_0x6487('0x7f');_0x7809ae[_0x6487('0x80')]=null;logger[_0x6487('0x74')](_0x6487('0x81'),_0x7809ae[_0x6487('0x48')],_0x7809ae['type']);this[_0x6487('0xd')][_0xceb29[_0x6487('0x45')]]=_0x7809ae;this['emitVoiceQueueChannelRemove'](_0x7809ae,'queuecallerabandon');}}}catch(_0x5055d8){logger['error'](_0x6487('0x82'),_0xceb29[_0x6487('0x45')],util[_0x6487('0x3b')](_0x5055d8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6487('0x7')]['syncQueueCallerLeave']=function(_0x12b8f5){try{if(this[_0x6487('0x64')](_0x12b8f5)){logger['debug'](_0x6487('0x83'),_0x12b8f5['uniqueid'],util['inspect'](_0x12b8f5,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x12b8f5[_0x6487('0x45')]]){var _0x5424d0=_[_0x6487('0x79')](this['queueReports'][_0x12b8f5[_0x6487('0x45')]]);_0x5424d0['queuecallerleaveAt']=moment()[_0x6487('0x46')](_0x6487('0x84'));_0x5424d0[_0x6487('0x85')]=_0x12b8f5['connectedlinenum'];_0x5424d0[_0x6487('0x86')]=_0x12b8f5[_0x6487('0x86')];logger['info'](_0x6487('0x87'),_0x5424d0['name'],_0x5424d0[_0x6487('0x4d')],_0x12b8f5['connectedlinenum'],_0x12b8f5[_0x6487('0x86')]);this[_0x6487('0xd')][_0x12b8f5[_0x6487('0x45')]]=_0x5424d0;this[_0x6487('0x42')](_0x5424d0,'queuecallerleave');}}}catch(_0x17c8a0){logger[_0x6487('0x3c')](_0x6487('0x83'),_0x12b8f5['uniqueid'],util['inspect'](_0x17c8a0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6487('0x7')][_0x6487('0x88')]=function(_0x1bc347){try{if(this['isNotNull'](_0x1bc347)){logger[_0x6487('0x5b')](_0x6487('0x89'),_0x1bc347[_0x6487('0x45')],util['inspect'](_0x1bc347,{'showHidden':![],'depth':null}));if(this[_0x6487('0xb')][_0x1bc347[_0x6487('0x45')]]){var _0x2e163e=_[_0x6487('0x79')](this[_0x6487('0xb')][_0x1bc347[_0x6487('0x45')]]);_0x2e163e[_0x6487('0x7a')]=!![];_0x2e163e[_0x6487('0x7e')]='COMPLETEDBYAGENT';logger[_0x6487('0x74')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x2e163e[_0x6487('0x48')],_0x2e163e[_0x6487('0x4d')]);}}}catch(_0x1b9997){logger['error'](_0x6487('0x89'),_0x1bc347[_0x6487('0x45')],util[_0x6487('0x3b')](_0x1b9997,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6487('0x7')]['syncAgentComplete']=function(_0x57fb13){try{if(this['isNotNull'](_0x57fb13)){logger[_0x6487('0x5b')](_0x6487('0x8a'),_0x57fb13['uniqueid'],util['inspect'](_0x57fb13,{'showHidden':![],'depth':null}));if(this[_0x6487('0xb')][_0x57fb13[_0x6487('0x45')]]){var _0x3b33b9=_[_0x6487('0x79')](this['queueReports'][_0x57fb13[_0x6487('0x45')]]);_0x3b33b9['queuecallerabandon']=![];_0x3b33b9[_0x6487('0x7d')]=null;_0x3b33b9['assigned']=!![];_0x3b33b9[_0x6487('0x80')]=_0x57fb13['membername'];_0x3b33b9[_0x6487('0x7b')]=_0x57fb13['holdtime'];_0x3b33b9['queuecallercomplete']=!![];_0x3b33b9[_0x6487('0x8b')]=![];_0x3b33b9[_0x6487('0x8c')]=null;if(!_0x3b33b9[_0x6487('0x8d')]){if(_0x57fb13[_0x6487('0x8e')]==_0x6487('0x8d')){_0x3b33b9[_0x6487('0x7e')]=_0x6487('0x8f');logger[_0x6487('0x74')](_0x6487('0x90'),_0x3b33b9[_0x6487('0x48')],_0x3b33b9['type']);}else{if(_[_0x6487('0x91')](_0x57fb13[_0x6487('0x92')]['toLowerCase'](),_0x6487('0x93'))){if(this['queueReports'][_0x57fb13[_0x6487('0x94')]]){var _0x9f8b2d=_[_0x6487('0x79')](this[_0x6487('0xb')][_0x57fb13[_0x6487('0x94')]]);_0x9f8b2d[_0x6487('0x7a')]=![];_0x9f8b2d[_0x6487('0x8b')]=!![];_0x9f8b2d[_0x6487('0x8c')]=moment(_0x3b33b9['queuecallerjoinAt'])[_0x6487('0x95')](_0x57fb13[_0x6487('0x7b')],_0x6487('0x96'))[_0x6487('0x46')](_0x6487('0x84'));_0x9f8b2d[_0x6487('0x7e')]=_0x6487('0x97');_0x9f8b2d['transfer']=!![];_0x9f8b2d[_0x6487('0x98')]=_0x6487('0x99');_0x9f8b2d['transferexten']=_0x57fb13['destexten'];_0x9f8b2d['transferuniqueid']=_0x57fb13[_0x6487('0x45')];logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x9f8b2d[_0x6487('0x48')],_0x9f8b2d['type']);var _0x3d287a=this[_0x6487('0xb')][_0x57fb13['linkedid']];this['queueReports'][_0x57fb13[_0x6487('0x94')]]=this[_0x6487('0xb')][_0x57fb13[_0x6487('0x45')]];this[_0x6487('0xb')][_0x57fb13['uniqueid']]=_0x3d287a;}}else{_0x3b33b9[_0x6487('0x7e')]=_0x6487('0x9a')+_0x57fb13['reason']['toUpperCase']();logger[_0x6487('0x74')](_0x6487('0x9b'),_0x3b33b9[_0x6487('0x48')],_0x3b33b9[_0x6487('0x4d')],_0x3b33b9['queuecallerexitreason']);}}}this[_0x6487('0xd')][_0x57fb13[_0x6487('0x45')]]=_0x3b33b9;this[_0x6487('0x3f')](_0x3b33b9,'agentcomplete');}}}catch(_0x29ba21){logger[_0x6487('0x3c')](_0x6487('0x8a'),_0x57fb13[_0x6487('0x45')],util[_0x6487('0x3b')](_0x29ba21,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6487('0x7')][_0x6487('0x1e')]=function(_0x3f8931){try{if(this[_0x6487('0x64')](_0x3f8931)){logger[_0x6487('0x5b')](_0x6487('0x9c'),_0x3f8931[_0x6487('0x45')],util[_0x6487('0x3b')](_0x3f8931,{'showHidden':![],'depth':null}));this['addVariable'](_0x3f8931[_0x6487('0x45')],_['keys'](_0x3f8931[_0x6487('0x9d')])[0x0],_0x3f8931[_0x6487('0x9e')]);if(this[_0x6487('0xb')][_0x3f8931[_0x6487('0x45')]]){var _0x30058e=_['last'](this[_0x6487('0xb')][_0x3f8931[_0x6487('0x45')]]);if(_0x30058e){if(this['isNotNull'](_0x3f8931[_0x6487('0x9d')])&&this[_0x6487('0x64')](_0x3f8931[_0x6487('0x9d')]['queuestatus'])){switch(_0x3f8931[_0x6487('0x9e')]){case _0x6487('0x9f'):_0x30058e['queuecallerexit']=![];_0x30058e['queuecallerexitAt']=null;break;case _0x6487('0xa0'):_0x30058e[_0x6487('0xa1')]=_0x6487('0xa2');_0x30058e['queuecallerexit']=!![];_0x30058e[_0x6487('0x8c')]=moment()['format'](_0x6487('0x84'));_0x30058e['queuecallerleaveAt']=moment()[_0x6487('0x46')](_0x6487('0x84'));logger[_0x6487('0x5b')](_0x6487('0xa3'),_0x3f8931[_0x6487('0x45')],util[_0x6487('0x3b')](_0x30058e,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x30058e);break;default:_0x30058e[_0x6487('0x8b')]=!![];_0x30058e['queuecallerexitAt']=moment()[_0x6487('0x46')](_0x6487('0x84'));_0x30058e['queuecallerleaveAt']=moment()[_0x6487('0x46')](_0x6487('0x84'));}_0x30058e[_0x6487('0x19')]=![];_0x30058e['queuecallerabandonAt']=null;_0x30058e[_0x6487('0x7e')]=_0x3f8931[_0x6487('0x9e')];this['channels'][_0x3f8931[_0x6487('0x45')]]=_0x30058e;this[_0x6487('0x3f')](_0x30058e,_0x6487('0x1d'));}else if(this[_0x6487('0x64')](_0x3f8931[_0x6487('0x9d')])&&this[_0x6487('0x64')](_0x3f8931['variable'][_0x6487('0xa4')])){if(!_0x30058e['queuecallerabandon']){_0x30058e[_0x6487('0x8b')]=!![];_0x30058e[_0x6487('0x8c')]=moment()[_0x6487('0x46')](_0x6487('0x84'));_0x30058e['queuecallerexitreason']=_0x6487('0xa5');_0x30058e[_0x6487('0xa6')]=moment()[_0x6487('0x46')](_0x6487('0x84'));this[_0x6487('0xd')][_0x3f8931['uniqueid']]=_0x30058e;}}logger[_0x6487('0x74')](_0x6487('0xa7'),_0x3f8931['uniqueid'],_0x30058e[_0x6487('0x48')],_0x30058e[_0x6487('0x4d')],_[_0x6487('0xa8')](_0x3f8931[_0x6487('0x9d')])[0x0],_0x3f8931['value']);_0x30058e['variables']=this['variables'][_0x3f8931[_0x6487('0x45')]];}}}}catch(_0x294621){logger[_0x6487('0x3c')](_0x6487('0x9c'),_0x3f8931[_0x6487('0x45')],util['inspect'](_0x294621,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6487('0xa9')]=function(_0x58a2cd,_0x2944da,_0x162993){var _0x21bb4d=[_0x6487('0xaa'),_0x6487('0xab'),_0x6487('0xac'),_0x6487('0xad'),_0x6487('0xae'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0x6487('0xaf'),_0x6487('0xb0'),_0x6487('0xb1'),'bridgepeer',_0x6487('0xb2'),_0x6487('0xb3'),_0x6487('0xb4'),_0x6487('0xb5'),_0x6487('0xb6'),_0x6487('0xb7'),'memberpenalty',_0x6487('0xb8')];if(!_[_0x6487('0x36')](_0x2944da)&&!_['includes'](_0x21bb4d,_0x2944da)){if(_['isUndefined'](this['variables'][_0x58a2cd])){this[_0x6487('0x12')][_0x58a2cd]={};}this[_0x6487('0x12')][_0x58a2cd][_0x2944da]=_0x162993;}};VoiceQueueReport[_0x6487('0x7')][_0x6487('0x20')]=function(_0x5971c5){try{if(this[_0x6487('0x64')](_0x5971c5)){logger[_0x6487('0x5b')](_0x6487('0xb9'),_0x5971c5[_0x6487('0x45')],util['inspect'](_0x5971c5,{'showHidden':![],'depth':null}));if(this[_0x6487('0xb')][_0x5971c5[_0x6487('0x45')]]){for(var _0x6f94f7=0x0,_0x1f3c37={};_0x6f94f70x0?_0x38aa06:0x0;this['voiceQueues'][_0x2e93cc[_0x4cf1('0x6a')]][_0x4cf1('0x36')]=this['voiceQueues'][_0x2e93cc[_0x4cf1('0x6a')]]['talking']>_[_0x4cf1('0x6e')](_0x2e93cc[_0x4cf1('0x6f')])?_[_0x4cf1('0x6e')](_0x2e93cc[_0x4cf1('0x6f')]):this[_0x4cf1('0x13')][_0x2e93cc['queue']][_0x4cf1('0x36')];this[_0x4cf1('0x56')](this[_0x4cf1('0x13')][_0x2e93cc[_0x4cf1('0x6a')]],_0x4cf1('0x16'));}logger['debug'](_0x4cf1('0x70'),util['inspect'](this['voiceQueues'][_0x2e93cc[_0x4cf1('0x6a')]],{'showHidden':![],'depth':null}));ami[_0x4cf1('0x49')](_0x4cf1('0x71'),this['voiceQueues'][_0x2e93cc[_0x4cf1('0x6a')]]);}}}catch(_0x427da1){logger[_0x4cf1('0x40')](_0x4cf1('0x69'),util[_0x4cf1('0x42')](_0x427da1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4cf1('0xb')][_0x4cf1('0x1a')]=function(_0x516862){logger[_0x4cf1('0x4a')](_0x4cf1('0x72'),util[_0x4cf1('0x42')](_0x516862,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0x4cf1('0xb')][_0x4cf1('0x1c')]=function(_0x4210a4){try{if(this[_0x4cf1('0x66')](_0x4210a4)){logger['debug'](_0x4cf1('0x73'),_0x4210a4[_0x4cf1('0x4d')],util['inspect'](_0x4210a4,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0x4210a4[_0x4cf1('0x4d')]]))this[_0x4cf1('0xf')][_0x4210a4[_0x4cf1('0x4d')]]=[];if(_['isUndefined'](this['channels'][_0x4210a4['uniqueid']]))this[_0x4cf1('0x11')][_0x4210a4[_0x4cf1('0x4d')]]={};var _0xcfa9b8=new QueueReport();_0xcfa9b8[_0x4cf1('0x50')]=_0x4210a4[_0x4cf1('0x6a')];_0xcfa9b8[_0x4cf1('0x57')]=this['voiceQueues'][_0xcfa9b8[_0x4cf1('0x50')]]&&this['voiceQueues'][_0xcfa9b8['name']][_0x4cf1('0x57')]?this[_0x4cf1('0x13')][_0xcfa9b8[_0x4cf1('0x50')]][_0x4cf1('0x57')]||'inbound':'inbound';_0xcfa9b8['queue']=_0x4210a4['queue'];_0xcfa9b8[_0x4cf1('0x74')]=moment()[_0x4cf1('0x4e')](_0x4cf1('0x75'));_0xcfa9b8[_0x4cf1('0x76')]=_0x4210a4['position'];_0xcfa9b8[_0x4cf1('0x77')]=_0x4210a4[_0x4cf1('0x77')];_0xcfa9b8['uniqueid']=_0x4210a4['uniqueid'];_0xcfa9b8[_0x4cf1('0x78')]=this[_0x4cf1('0x11')][_0x4210a4[_0x4cf1('0x4d')]][_0x4cf1('0x78')];logger[_0x4cf1('0x6b')](_0x4cf1('0x79'),_0xcfa9b8[_0x4cf1('0x50')],_0xcfa9b8['type']);_['merge'](_0xcfa9b8,_[_0x4cf1('0x7a')](_0x4210a4,_[_0x4cf1('0x7b')](_0xcfa9b8)));this[_0x4cf1('0xf')][_0x4210a4[_0x4cf1('0x4d')]][_0x4cf1('0x7c')](_0xcfa9b8);this['channels'][_0x4210a4[_0x4cf1('0x4d')]]=_0xcfa9b8;this[_0x4cf1('0x7d')](_0xcfa9b8,'queuecallerjoin');}}catch(_0x2f58d4){logger[_0x4cf1('0x40')](_0x4cf1('0x73'),_0x4210a4[_0x4cf1('0x4d')],util['inspect'](_0x2f58d4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4cf1('0xb')][_0x4cf1('0x1e')]=function(_0x64e59e){try{if(this[_0x4cf1('0x66')](_0x64e59e)){logger[_0x4cf1('0x4a')]('[%s][voiceQueueReport][queuecallerabandon]',_0x64e59e[_0x4cf1('0x4d')],util[_0x4cf1('0x42')](_0x64e59e,{'showHidden':![],'depth':null}));if(this[_0x4cf1('0xf')][_0x64e59e[_0x4cf1('0x4d')]]){var _0x13d24a=_[_0x4cf1('0x7e')](this[_0x4cf1('0xf')][_0x64e59e[_0x4cf1('0x4d')]]);_0x13d24a['queuecallercomplete']=![];_0x13d24a['queuecallercompleteAt']=null;_0x13d24a[_0x4cf1('0x7f')]=_0x64e59e[_0x4cf1('0x7f')];_0x13d24a[_0x4cf1('0x80')]=_0x64e59e[_0x4cf1('0x80')];_0x13d24a['queuecallerabandon']=!![];_0x13d24a[_0x4cf1('0x81')]=moment()[_0x4cf1('0x4e')](_0x4cf1('0x75'));_0x13d24a[_0x4cf1('0x82')]='ABANDONED';_0x13d24a[_0x4cf1('0x83')]=null;logger[_0x4cf1('0x6b')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x13d24a[_0x4cf1('0x50')],_0x13d24a['type']);this[_0x4cf1('0x11')][_0x64e59e[_0x4cf1('0x4d')]]=_0x13d24a;this['emitVoiceQueueChannelRemove'](_0x13d24a,_0x4cf1('0x1d'));}}}catch(_0xbb3103){logger[_0x4cf1('0x40')]('[%s][voiceQueueReport][queuecallerabandon]',_0x64e59e[_0x4cf1('0x4d')],util[_0x4cf1('0x42')](_0xbb3103,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4cf1('0xb')]['syncQueueCallerLeave']=function(_0x27338e){try{if(this[_0x4cf1('0x66')](_0x27338e)){logger[_0x4cf1('0x4a')](_0x4cf1('0x84'),_0x27338e[_0x4cf1('0x4d')],util[_0x4cf1('0x42')](_0x27338e,{'showHidden':![],'depth':null}));if(this[_0x4cf1('0xf')][_0x27338e[_0x4cf1('0x4d')]]){var _0x3af0b8=_[_0x4cf1('0x7e')](this[_0x4cf1('0xf')][_0x27338e[_0x4cf1('0x4d')]]);_0x3af0b8['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3af0b8['connectedlinenum']=_0x27338e[_0x4cf1('0x85')];_0x3af0b8[_0x4cf1('0x86')]=_0x27338e[_0x4cf1('0x86')];logger[_0x4cf1('0x6b')](_0x4cf1('0x87'),_0x3af0b8[_0x4cf1('0x50')],_0x3af0b8[_0x4cf1('0x57')],_0x27338e['connectedlinenum'],_0x27338e[_0x4cf1('0x86')]);this[_0x4cf1('0x11')][_0x27338e[_0x4cf1('0x4d')]]=_0x3af0b8;this[_0x4cf1('0x7d')](_0x3af0b8,'queuecallerleave');}}}catch(_0x2dd49a){logger[_0x4cf1('0x40')](_0x4cf1('0x84'),_0x27338e[_0x4cf1('0x4d')],util[_0x4cf1('0x42')](_0x2dd49a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4cf1('0xb')][_0x4cf1('0x23')]=function(_0x2cb28f){try{if(this[_0x4cf1('0x66')](_0x2cb28f)){logger[_0x4cf1('0x4a')](_0x4cf1('0x88'),_0x2cb28f[_0x4cf1('0x4d')],util['inspect'](_0x2cb28f,{'showHidden':![],'depth':null}));if(this[_0x4cf1('0xf')][_0x2cb28f[_0x4cf1('0x4d')]]){var _0x59f10f=_[_0x4cf1('0x7e')](this[_0x4cf1('0xf')][_0x2cb28f['uniqueid']]);_0x59f10f[_0x4cf1('0x89')]=!![];_0x59f10f[_0x4cf1('0x82')]=_0x4cf1('0x8a');logger[_0x4cf1('0x6b')](_0x4cf1('0x8b'),_0x59f10f[_0x4cf1('0x50')],_0x59f10f[_0x4cf1('0x57')]);}}}catch(_0x43f97){logger[_0x4cf1('0x40')](_0x4cf1('0x88'),_0x2cb28f[_0x4cf1('0x4d')],util['inspect'](_0x43f97,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4cf1('0xb')][_0x4cf1('0x21')]=function(_0x302233){try{if(this[_0x4cf1('0x66')](_0x302233)){logger['debug'](_0x4cf1('0x8c'),_0x302233[_0x4cf1('0x4d')],util[_0x4cf1('0x42')](_0x302233,{'showHidden':![],'depth':null}));if(this[_0x4cf1('0xf')][_0x302233[_0x4cf1('0x4d')]]){var _0x4e0bfd=_[_0x4cf1('0x7e')](this[_0x4cf1('0xf')][_0x302233[_0x4cf1('0x4d')]]);_0x4e0bfd[_0x4cf1('0x1d')]=![];_0x4e0bfd['queuecallerabandonAt']=null;_0x4e0bfd[_0x4cf1('0x8d')]=!![];_0x4e0bfd[_0x4cf1('0x83')]=_0x302233['membername'];_0x4e0bfd[_0x4cf1('0x7f')]=_0x302233[_0x4cf1('0x7f')];_0x4e0bfd['queuecallercomplete']=!![];_0x4e0bfd[_0x4cf1('0x8e')]=![];_0x4e0bfd[_0x4cf1('0x8f')]=null;if(!_0x4e0bfd[_0x4cf1('0x90')]){if(_0x302233[_0x4cf1('0x91')]==_0x4cf1('0x90')){_0x4e0bfd['queuecallerexitreason']=_0x4cf1('0x92');logger[_0x4cf1('0x6b')](_0x4cf1('0x93'),_0x4e0bfd[_0x4cf1('0x50')],_0x4e0bfd[_0x4cf1('0x57')]);}else{if(_[_0x4cf1('0x94')](_0x302233['channel'][_0x4cf1('0x95')](),_0x4cf1('0x96'))){if(this[_0x4cf1('0xf')][_0x302233[_0x4cf1('0x97')]]){var _0x46ab7e=_[_0x4cf1('0x7e')](this[_0x4cf1('0xf')][_0x302233['linkedid']]);_0x46ab7e[_0x4cf1('0x89')]=![];_0x46ab7e['queuecallerexit']=!![];_0x46ab7e[_0x4cf1('0x8f')]=moment(_0x4e0bfd['queuecallerjoinAt'])[_0x4cf1('0x98')](_0x302233['holdtime'],'seconds')['format'](_0x4cf1('0x75'));_0x46ab7e[_0x4cf1('0x82')]=_0x4cf1('0x99');_0x46ab7e[_0x4cf1('0x90')]=!![];_0x46ab7e['transfertype']=_0x4cf1('0x9a');_0x46ab7e[_0x4cf1('0x9b')]=_0x302233[_0x4cf1('0x9c')];_0x46ab7e[_0x4cf1('0x9d')]=_0x302233[_0x4cf1('0x4d')];logger['info'](_0x4cf1('0x9e'),_0x46ab7e[_0x4cf1('0x50')],_0x46ab7e[_0x4cf1('0x57')]);var _0x3e9d80=this['queueReports'][_0x302233[_0x4cf1('0x97')]];this['queueReports'][_0x302233[_0x4cf1('0x97')]]=this['queueReports'][_0x302233[_0x4cf1('0x4d')]];this[_0x4cf1('0xf')][_0x302233[_0x4cf1('0x4d')]]=_0x3e9d80;}}else{_0x4e0bfd[_0x4cf1('0x82')]=_0x4cf1('0x9f')+_0x302233[_0x4cf1('0x91')][_0x4cf1('0xa0')]();logger[_0x4cf1('0x6b')](_0x4cf1('0xa1'),_0x4e0bfd['name'],_0x4e0bfd[_0x4cf1('0x57')],_0x4e0bfd[_0x4cf1('0x82')]);}}}this[_0x4cf1('0x11')][_0x302233['uniqueid']]=_0x4e0bfd;this[_0x4cf1('0x47')](_0x4e0bfd,_0x4cf1('0x20'));}}}catch(_0x52b3d2){logger[_0x4cf1('0x40')](_0x4cf1('0x8c'),_0x302233[_0x4cf1('0x4d')],util[_0x4cf1('0x42')](_0x52b3d2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4cf1('0xb')][_0x4cf1('0x25')]=function(_0x1e0133){try{if(this[_0x4cf1('0x66')](_0x1e0133)){logger[_0x4cf1('0x4a')](_0x4cf1('0xa2'),_0x1e0133['uniqueid'],util[_0x4cf1('0x42')](_0x1e0133,{'showHidden':![],'depth':null}));this[_0x4cf1('0xa3')](_0x1e0133[_0x4cf1('0x4d')],_[_0x4cf1('0x7b')](_0x1e0133[_0x4cf1('0xa4')])[0x0],_0x1e0133[_0x4cf1('0xa5')]);if(this[_0x4cf1('0xf')][_0x1e0133[_0x4cf1('0x4d')]]){var _0x2c0415=_[_0x4cf1('0x7e')](this[_0x4cf1('0xf')][_0x1e0133[_0x4cf1('0x4d')]]);if(_0x2c0415){if(this[_0x4cf1('0x66')](_0x1e0133['variable'])&&this[_0x4cf1('0x66')](_0x1e0133['variable']['queuestatus'])){switch(_0x1e0133['value']){case'CONTINUE':_0x2c0415[_0x4cf1('0x8e')]=![];_0x2c0415[_0x4cf1('0x8f')]=null;break;case'TIMEOUT':_0x2c0415['lastevent']=_0x4cf1('0xa6');_0x2c0415[_0x4cf1('0x8e')]=!![];_0x2c0415[_0x4cf1('0x8f')]=moment()[_0x4cf1('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c0415[_0x4cf1('0xa7')]=moment()[_0x4cf1('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x4cf1('0x4a')](_0x4cf1('0xa8'),_0x1e0133[_0x4cf1('0x4d')],util[_0x4cf1('0x42')](_0x2c0415,{'showHidden':![],'depth':null}));ami[_0x4cf1('0x49')](_0x4cf1('0xa9'),_0x2c0415);break;default:_0x2c0415[_0x4cf1('0x8e')]=!![];_0x2c0415[_0x4cf1('0x8f')]=moment()[_0x4cf1('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c0415['queuecallerleaveAt']=moment()[_0x4cf1('0x4e')](_0x4cf1('0x75'));}_0x2c0415[_0x4cf1('0x1d')]=![];_0x2c0415[_0x4cf1('0x81')]=null;_0x2c0415[_0x4cf1('0x82')]=_0x1e0133['value'];this[_0x4cf1('0x11')][_0x1e0133[_0x4cf1('0x4d')]]=_0x2c0415;this['emitVoiceQueueChannelRemove'](_0x2c0415,'varset');}else if(this['isNotNull'](_0x1e0133[_0x4cf1('0xa4')])&&this['isNotNull'](_0x1e0133[_0x4cf1('0xa4')][_0x4cf1('0xaa')])){if(!_0x2c0415[_0x4cf1('0x1d')]){_0x2c0415[_0x4cf1('0x8e')]=!![];_0x2c0415[_0x4cf1('0x8f')]=moment()[_0x4cf1('0x4e')](_0x4cf1('0x75'));_0x2c0415[_0x4cf1('0x82')]=_0x4cf1('0xab');_0x2c0415[_0x4cf1('0xa7')]=moment()[_0x4cf1('0x4e')](_0x4cf1('0x75'));this[_0x4cf1('0x11')][_0x1e0133[_0x4cf1('0x4d')]]=_0x2c0415;}}logger['info'](_0x4cf1('0xac'),_0x1e0133[_0x4cf1('0x4d')],_0x2c0415['name'],_0x2c0415[_0x4cf1('0x57')],_['keys'](_0x1e0133[_0x4cf1('0xa4')])[0x0],_0x1e0133['value']);_0x2c0415['variables']=this[_0x4cf1('0x15')][_0x1e0133[_0x4cf1('0x4d')]];}}}}catch(_0xaa25fc){logger['error']('[%s][voiceQueueReport][varset]',_0x1e0133[_0x4cf1('0x4d')],util[_0x4cf1('0x42')](_0xaa25fc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x4cf1('0xb')][_0x4cf1('0xa3')]=function(_0x3f278f,_0x52cb41,_0x3aa12e){var _0x355865=[_0x4cf1('0xad'),_0x4cf1('0xae'),_0x4cf1('0xaf'),_0x4cf1('0xb0'),'rtpaudioqosloss',_0x4cf1('0xb1'),_0x4cf1('0xb2'),'rtpaudioqosrttbridged',_0x4cf1('0xb3'),_0x4cf1('0xb4'),'bridgepeer',_0x4cf1('0xb5'),_0x4cf1('0xb6'),'memberdynamic',_0x4cf1('0xb7'),_0x4cf1('0xb8'),_0x4cf1('0xb9'),_0x4cf1('0xba'),'memberrealtime'];if(!_['isNil'](_0x52cb41)&&!_[_0x4cf1('0xbb')](_0x355865,_0x52cb41)){if(_['isUndefined'](this[_0x4cf1('0x15')][_0x3f278f])){this[_0x4cf1('0x15')][_0x3f278f]={};}this['variables'][_0x3f278f][_0x52cb41]=_0x3aa12e;}};VoiceQueueReport[_0x4cf1('0xb')]['syncHangup']=function(_0x4df364){try{if(this[_0x4cf1('0x66')](_0x4df364)){logger[_0x4cf1('0x4a')](_0x4cf1('0xbc'),_0x4df364[_0x4cf1('0x4d')],util[_0x4cf1('0x42')](_0x4df364,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4df364[_0x4cf1('0x4d')]]){for(var _0x19427c=0x0,_0x48940d={};_0x19427c=0x0?moment(_0x153f59[_0x41aa('0x13')])['diff'](_0x153f59[_0x41aa('0x15')],_0x41aa('0xa')):null,'data1':_0x41aa('0x16'),'data2':_0x153f59[_0x41aa('0xe')],'data3':_0x153f59[_0x41aa('0xc')],'data4':_0x153f59[_0x41aa('0x17')]||null,'role':_0x41aa('0xd'),'internal':_0x153f59[_0x41aa('0xe')]?_[_0x41aa('0xf')](_0x153f59[_0x41aa('0xe')]):undefined,'uniqueid':_0x153f59[_0x41aa('0x10')]},'log':_0x41aa('0x4')});}; \ No newline at end of file +var _0x95fe=['lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','isNil','SIP/%s','lastAssignedTo','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','accountcode','uniqueid','voiceDialReport','CreateMemberReport','interface','starttime','endtime','dialstring','agent','toNumber'];(function(_0x1e85db,_0x432aad){var _0x11066d=function(_0x254d3c){while(--_0x254d3c){_0x1e85db['push'](_0x1e85db['shift']());}};_0x11066d(++_0x432aad);}(_0x95fe,0x1d0));var _0xe95f=function(_0xdd6f7f,_0x3f6265){_0xdd6f7f=_0xdd6f7f-0x0;var _0xa10222=_0x95fe[_0xdd6f7f];return _0xa10222;};'use strict';var moment=require('moment');var _=require(_0xe95f('0x0'));var util=require(_0xe95f('0x1'));var client=require(_0xe95f('0x2'));exports[_0xe95f('0x3')]=function(_0x3c72d0){var _0x2cd7d8=_0x3c72d0[_0xe95f('0x4')]||_0x3c72d0[_0xe95f('0x5')];return client[_0xe95f('0x6')]('CreateMemberReport',{'body':{'channel':_0xe95f('0x7'),'membername':_0x3c72d0['lastAssignedTo'],'interface':_[_0xe95f('0x8')](_0x3c72d0['interface'])?util['format'](_0xe95f('0x9'),_0x3c72d0[_0xe95f('0xa')]):_0x3c72d0['interface'],'type':_0xe95f('0xb'),'enterAt':_0x3c72d0[_0xe95f('0xc')],'exitAt':_0x2cd7d8,'duration':moment(_0x2cd7d8)[_0xe95f('0xd')](_0x3c72d0[_0xe95f('0xc')],_0xe95f('0xe')),'data1':_0xe95f('0xf'),'data2':_0x3c72d0[_0xe95f('0x10')],'data3':_0x3c72d0[_0xe95f('0x11')],'data4':null,'data5':_0x3c72d0[_0xe95f('0x12')],'role':'agent','internal':_0x3c72d0[_0xe95f('0x13')]?_['toNumber'](_0x3c72d0[_0xe95f('0x13')]):undefined,'uniqueid':_0x3c72d0[_0xe95f('0x14')]},'log':'CreateMemberReport'});};exports[_0xe95f('0x15')]=function(_0x563dee){return client[_0xe95f('0x6')](_0xe95f('0x16'),{'body':{'channel':'voice','membername':_0x563dee['membername'],'interface':_0x563dee[_0xe95f('0x17')],'type':'TALKING','enterAt':_0x563dee[_0xe95f('0x18')],'exitAt':_0x563dee[_0xe95f('0x19')],'duration':moment(_0x563dee['endtime'])[_0xe95f('0xd')](_0x563dee[_0xe95f('0x18')],_0xe95f('0xe'))>=0x0?moment(_0x563dee[_0xe95f('0x19')])[_0xe95f('0xd')](_0x563dee['starttime'],'seconds'):null,'data1':'outbound','data2':_0x563dee[_0xe95f('0x13')],'data3':_0x563dee[_0xe95f('0x11')],'data4':_0x563dee[_0xe95f('0x1a')]||null,'role':_0xe95f('0x1b'),'internal':_0x563dee['accountcode']?_[_0xe95f('0x1c')](_0x563dee[_0xe95f('0x13')]):undefined,'uniqueid':_0x563dee[_0xe95f('0x14')]},'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 8f59e37..75a6a8b 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 _0x36f9=['GetSettings','../client','Request'];(function(_0x2f99a4,_0x27d920){var _0x94892b=function(_0x342273){while(--_0x342273){_0x2f99a4['push'](_0x2f99a4['shift']());}};_0x94892b(++_0x27d920);}(_0x36f9,0x151));var _0x936f=function(_0x35fc38,_0x13e00f){_0x35fc38=_0x35fc38-0x0;var _0x152094=_0x36f9[_0x35fc38];return _0x152094;};'use strict';var client=require(_0x936f('0x0'));exports['getSettings']=function(){return client[_0x936f('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0x936f('0x2')});}; \ No newline at end of file +var _0x61ea=['getSettings','Request','ShowSetting','GetSettings','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x61ea,0x1d5));var _0xa61e=function(_0x1ec7bd,_0x278988){_0x1ec7bd=_0x1ec7bd-0x0;var _0x25ea8b=_0x61ea[_0x1ec7bd];return _0x25ea8b;};'use strict';var client=require(_0xa61e('0x0'));exports[_0xa61e('0x1')]=function(){return client[_0xa61e('0x2')](_0xa61e('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer']},'log':_0xa61e('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 7151a6c..5a71193 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 _0x9b85=['Request','GetTemplate','name','getTemplates'];(function(_0x35d896,_0x31f68d){var _0x4f5aed=function(_0x27c667){while(--_0x27c667){_0x35d896['push'](_0x35d896['shift']());}};_0x4f5aed(++_0x31f68d);}(_0x9b85,0xd7));var _0x59b8=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9b85[_0x5ddb1c];return _0x354adc;};'use strict';var client=require('../client');exports[_0x59b8('0x0')]=function(_0x559639){return function(_0x459fb0){return client[_0x59b8('0x1')](_0x59b8('0x2'),{'options':{'raw':!![],'attributes':['id',_0x59b8('0x3'),'html']},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x8d75=['GetTemplate','../client','getTemplates','Request'];(function(_0x23670b,_0x3181ce){var _0x5ff5e2=function(_0x1202b0){while(--_0x1202b0){_0x23670b['push'](_0x23670b['shift']());}};_0x5ff5e2(++_0x3181ce);}(_0x8d75,0x6d));var _0x58d7=function(_0x5ccf9e,_0xf02d96){_0x5ccf9e=_0x5ccf9e-0x0;var _0x3ccac2=_0x8d75[_0x5ccf9e];return _0x3ccac2;};'use strict';var client=require(_0x58d7('0x0'));exports[_0x58d7('0x1')]=function(_0x56d602){return function(_0x140752){return client[_0x58d7('0x2')](_0x58d7('0x3'),{'options':{'raw':!![],'attributes':['id','name','html']},'log':_0x58d7('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index ce22ff5..13d8280 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 _0xec6e=['AnyConditions','operator','Actions','action','data1','data2','data3','../client','Request','GetTrigger','status','Condition','AllConditions','field','value'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xec6e,0x133));var _0xeec6=function(_0x5e1e25,_0xdc1421){_0x5e1e25=_0x5e1e25-0x0;var _0x548e5f=_0xec6e[_0x5e1e25];return _0x548e5f;};'use strict';var client=require(_0xeec6('0x0'));exports['getTriggers']=function(_0xa015c1){return function(_0x85b53b){return client[_0xeec6('0x1')](_0xeec6('0x2'),{'options':{'raw':![],'attributes':['id','name','channel',_0xeec6('0x3')],'include':[{'model':_0xeec6('0x4'),'as':_0xeec6('0x5'),'attributes':['id',_0xeec6('0x6'),'operator',_0xeec6('0x7')]},{'model':_0xeec6('0x4'),'as':_0xeec6('0x8'),'attributes':['id',_0xeec6('0x6'),_0xeec6('0x9'),_0xeec6('0x7')]},{'model':'Action','as':_0xeec6('0xa'),'attributes':['id',_0xeec6('0xb'),_0xeec6('0xc'),_0xeec6('0xd'),_0xeec6('0xe'),'data4','data5','data6','data7']}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x3ea2=['status','AllConditions','operator','value','Condition','field','Action','Actions','data1','data2','data4','data5','data6','data7','getTriggers','Request','name','channel'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3ea2,0x19a));var _0x23ea=function(_0xd62e7a,_0xac4f19){_0xd62e7a=_0xd62e7a-0x0;var _0x1bf0c8=_0x3ea2[_0xd62e7a];return _0x1bf0c8;};'use strict';var client=require('../client');exports[_0x23ea('0x0')]=function(_0x5c4393){return function(_0x3fc654){return client[_0x23ea('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0x23ea('0x2'),_0x23ea('0x3'),_0x23ea('0x4')],'include':[{'model':'Condition','as':_0x23ea('0x5'),'attributes':['id','field',_0x23ea('0x6'),_0x23ea('0x7')]},{'model':_0x23ea('0x8'),'as':'AnyConditions','attributes':['id',_0x23ea('0x9'),'operator',_0x23ea('0x7')]},{'model':_0x23ea('0xa'),'as':_0x23ea('0xb'),'attributes':['id','action',_0x23ea('0xc'),_0x23ea('0xd'),'data3',_0x23ea('0xe'),_0x23ea('0xf'),_0x23ea('0x10'),_0x23ea('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 6f8df27..5882fcb 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 _0x5d20=['GetTrunk','name','registry','../client','getTrunks'];(function(_0x2a8eb4,_0x3bea2c){var _0x2e70ce=function(_0x1b4fcd){while(--_0x1b4fcd){_0x2a8eb4['push'](_0x2a8eb4['shift']());}};_0x2e70ce(++_0x3bea2c);}(_0x5d20,0x15c));var _0x05d2=function(_0x10c343,_0x9bf50a){_0x10c343=_0x10c343-0x0;var _0x37b10c=_0x5d20[_0x10c343];return _0x37b10c;};'use strict';var client=require(_0x05d2('0x0'));exports[_0x05d2('0x1')]=function(_0x4bdd05){return function(_0x1b92c1){return client['Request'](_0x05d2('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x05d2('0x3'),_0x05d2('0x4'),'defaultuser']},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x861a=['Request','GetTrunk','name','registry','../client'];(function(_0x37dac2,_0xdb5e75){var _0x351e15=function(_0x241d5e){while(--_0x241d5e){_0x37dac2['push'](_0x37dac2['shift']());}};_0x351e15(++_0xdb5e75);}(_0x861a,0x194));var _0xa861=function(_0x5bd59b,_0xc5dbd9){_0x5bd59b=_0x5bd59b-0x0;var _0xd70506=_0x861a[_0x5bd59b];return _0xd70506;};'use strict';var client=require(_0xa861('0x0'));exports['getTrunks']=function(_0xc6332b){return function(_0x5ba173){return client[_0xa861('0x1')](_0xa861('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa861('0x3'),_0xa861('0x4'),'defaultuser']},'log':_0xa861('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index b723a0e..ee80c6d 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 _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xe706,0xa3));var _0x6e70=function(_0x1b959e,_0x5b2d5f){_0x1b959e=_0x1b959e-0x0;var _0xa5ecea=_0xe706[_0x1b959e];return _0xa5ecea;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x41661b,_0x1b9b8d){var _0x950204=function(_0x353a54){while(--_0x353a54){_0x41661b['push'](_0x41661b['shift']());}};_0x950204(++_0x1b9b8d);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index ca46d3b..0712155 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 _0x23ef=['CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport','../client','create'];(function(_0x206118,_0x528c29){var _0x421b6d=function(_0x11d75a){while(--_0x11d75a){_0x206118['push'](_0x206118['shift']());}};_0x421b6d(++_0x528c29);}(_0x23ef,0x118));var _0xf23e=function(_0xceac40,_0xb7f69e){_0xceac40=_0xceac40-0x0;var _0x1cb0aa=_0x23ef[_0xceac40];return _0x1cb0aa;};'use strict';var client=require(_0xf23e('0x0'));exports[_0xf23e('0x1')]=function(_0x5c500b){return client['Request'](_0xf23e('0x2'),{'body':_0x5c500b,'log':'CreateVoiceAgentReport'});};exports[_0xf23e('0x3')]=function(_0x307d6d,_0x48846e,_0x3b5cc4){return client[_0xf23e('0x4')](_0xf23e('0x5'),{'body':_0x307d6d,'options':{'where':{'uniqueid':_0x48846e,'interface':_0x3b5cc4,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0xc9a0=['../client','create','CreateVoiceAgentReport','update','Request'];(function(_0x64ee20,_0x35cbce){var _0xd08bc5=function(_0x4fdc5a){while(--_0x4fdc5a){_0x64ee20['push'](_0x64ee20['shift']());}};_0xd08bc5(++_0x35cbce);}(_0xc9a0,0xc3));var _0x0c9a=function(_0xba2191,_0x1b9405){_0xba2191=_0xba2191-0x0;var _0x1e8361=_0xc9a0[_0xba2191];return _0x1e8361;};'use strict';var client=require(_0x0c9a('0x0'));exports[_0x0c9a('0x1')]=function(_0x1cb692){return client['Request'](_0x0c9a('0x2'),{'body':_0x1cb692,'log':_0x0c9a('0x2')});};exports[_0x0c9a('0x3')]=function(_0x488acd,_0x4e75c8,_0x4ee837){return client[_0x0c9a('0x4')]('UpdateVoiceAgentReport',{'body':_0x488acd,'options':{'where':{'uniqueid':_0x4e75c8,'interface':_0x4ee837,'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 a24c517..30a2681 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 _0xc87c=['Request','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','startOf','day','YYYY-MM-DD\x20HH:mm:ss','format','disposition','duration','billableseconds','moment','util','lodash','../client','create'];(function(_0x52e0fa,_0xe925de){var _0x532ce8=function(_0x39914a){while(--_0x39914a){_0x52e0fa['push'](_0x52e0fa['shift']());}};_0x532ce8(++_0xe925de);}(_0xc87c,0x177));var _0xcc87=function(_0x308f66,_0x1ceeb7){_0x308f66=_0x308f66-0x0;var _0x1aabec=_0xc87c[_0x308f66];return _0x1aabec;};'use strict';var moment=require(_0xcc87('0x0'));var util=require(_0xcc87('0x1'));var _=require(_0xcc87('0x2'));var client=require(_0xcc87('0x3'));exports[_0xcc87('0x4')]=function(_0x519432){return client[_0xcc87('0x5')](_0xcc87('0x6'),{'body':_['merge'](_0x519432,{'source':_0x519432[_0xcc87('0x7')],'destinationcontext':_0x519432[_0xcc87('0x8')],'callerid':_0x519432[_0xcc87('0x9')],'amaflags':_0xcc87('0xa')}),'log':_0xcc87('0x6')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0xcc87('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xcc87('0xc')](_0xcc87('0xd'))['format'](_0xcc87('0xe')),moment()['endOf'](_0xcc87('0xd'))[_0xcc87('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0xcc87('0x10'),_0xcc87('0x11'),_0xcc87('0x12')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x8266=['create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','../client'];(function(_0x15a4bc,_0x59bd7a){var _0x206fb6=function(_0x232372){while(--_0x232372){_0x15a4bc['push'](_0x15a4bc['shift']());}};_0x206fb6(++_0x59bd7a);}(_0x8266,0xd1));var _0x6826=function(_0x167f09,_0xaea666){_0x167f09=_0x167f09-0x0;var _0x43b49d=_0x8266[_0x167f09];return _0x43b49d;};'use strict';var moment=require('moment');var util=require('util');var _=require('lodash');var client=require(_0x6826('0x0'));exports[_0x6826('0x1')]=function(_0x3f9882){return client[_0x6826('0x2')](_0x6826('0x3'),{'body':_[_0x6826('0x4')](_0x3f9882,{'source':_0x3f9882[_0x6826('0x5')],'destinationcontext':_0x3f9882[_0x6826('0x6')],'callerid':_0x3f9882[_0x6826('0x7')],'amaflags':_0x6826('0x8')}),'log':_0x6826('0x3')});};exports[_0x6826('0x9')]=function(){return function(){return client['Request'](_0x6826('0xa'),{'options':{'where':{'type':[_0x6826('0xb')],'createdAt':{'$between':[moment()[_0x6826('0xc')](_0x6826('0xd'))['format'](_0x6826('0xe')),moment()[_0x6826('0xf')]('day')['format'](_0x6826('0xe'))]}},'attributes':[_0x6826('0x10'),_0x6826('0x11'),_0x6826('0x12'),_0x6826('0x13')]},'log':_0x6826('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 843c4bc..9095fb1 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 _0x9810=['create','Request','CreateVoiceDialReport','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9810,0x1d3));var _0x0981=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0x9810[_0x87239];return _0x53af1e;};'use strict';var client=require(_0x0981('0x0'));exports[_0x0981('0x1')]=function(_0x493ce0){return client[_0x0981('0x2')](_0x0981('0x3'),{'body':_0x493ce0,'log':_0x0981('0x3')});}; \ No newline at end of file +var _0xefdf=['Request','CreateVoiceDialReport','create'];(function(_0x319c72,_0x1c489b){var _0xca3f47=function(_0x20b771){while(--_0x20b771){_0x319c72['push'](_0x319c72['shift']());}};_0xca3f47(++_0x1c489b);}(_0xefdf,0x1cd));var _0xfefd=function(_0x5b8155,_0x51c636){_0x5b8155=_0x5b8155-0x0;var _0x1d6f07=_0xefdf[_0x5b8155];return _0x1d6f07;};'use strict';var client=require('../client');exports[_0xfefd('0x0')]=function(_0x5a644c){return client[_0xfefd('0x1')](_0xfefd('0x2'),{'body':_0x5a644c,'log':_0xfefd('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 9faa0a1..f2535b3 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 _0x8c38=['recordingFormat','../client','getVoiceExtensions','GetVoiceExtension','exten'];(function(_0x23555e,_0x2b5362){var _0x1991ef=function(_0x82f1a8){while(--_0x82f1a8){_0x23555e['push'](_0x23555e['shift']());}};_0x1991ef(++_0x2b5362);}(_0x8c38,0x83));var _0x88c3=function(_0x19e552,_0x20c618){_0x19e552=_0x19e552-0x0;var _0x4542d5=_0x8c38[_0x19e552];return _0x4542d5;};'use strict';var client=require(_0x88c3('0x0'));exports[_0x88c3('0x1')]=function(){return function(){return client['Request'](_0x88c3('0x2'),{'options':{'raw':!![],'attributes':['id',_0x88c3('0x3'),_0x88c3('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x88c3('0x1')});};}; \ No newline at end of file +var _0xfc03=['Request','GetVoiceExtension','recordingFormat','../client'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfc03,0x16f));var _0x3fc0=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xfc03[_0x4e7d25];return _0x526fe6;};'use strict';var client=require(_0x3fc0('0x0'));exports['getVoiceExtensions']=function(){return function(){return client[_0x3fc0('0x1')](_0x3fc0('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x3fc0('0x3')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 7023875..d9414aa 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 _0xecf3=['Intervals','interval','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','Trunk','callerid','Pause','mandatoryDispositionPause','TrunkBackup','active','Interval'];(function(_0x35d568,_0x4d47ae){var _0x5dac84=function(_0x265aaf){while(--_0x265aaf){_0x35d568['push'](_0x35d568['shift']());}};_0x5dac84(++_0x4d47ae);}(_0xecf3,0x13d));var _0x3ecf=function(_0x10bc02,_0x24724d){_0x10bc02=_0x10bc02-0x0;var _0x5a2bbf=_0xecf3[_0x10bc02];return _0x5a2bbf;};'use strict';var client=require('../client');exports[_0x3ecf('0x0')]=function(){return function(){return client['Request'](_0x3ecf('0x1'),{'options':{'raw':![],'attributes':['id',_0x3ecf('0x2'),_0x3ecf('0x3'),_0x3ecf('0x4'),_0x3ecf('0x5'),_0x3ecf('0x6'),_0x3ecf('0x7'),_0x3ecf('0x8'),_0x3ecf('0x9'),'dialLimitChannel',_0x3ecf('0xa'),_0x3ecf('0xb'),_0x3ecf('0xc'),_0x3ecf('0xd'),_0x3ecf('0xe'),'dialOriginateCallerIdName',_0x3ecf('0xf'),_0x3ecf('0x10'),_0x3ecf('0x11'),_0x3ecf('0x12'),_0x3ecf('0x13'),_0x3ecf('0x14'),_0x3ecf('0x15'),_0x3ecf('0x16'),_0x3ecf('0x17'),_0x3ecf('0x18'),_0x3ecf('0x19'),_0x3ecf('0x1a'),'dialTimezone','dialGlobalInterval','dialPrefix',_0x3ecf('0x1b'),_0x3ecf('0x1c'),'dialAMDInitialSilence',_0x3ecf('0x1d'),_0x3ecf('0x1e'),_0x3ecf('0x1f'),_0x3ecf('0x20'),_0x3ecf('0x21'),'dialAMDMaximumNumberOfWords',_0x3ecf('0x22'),_0x3ecf('0x23'),_0x3ecf('0x24'),_0x3ecf('0x25'),'dialRecallInQueue',_0x3ecf('0x26'),_0x3ecf('0x27'),_0x3ecf('0x28'),_0x3ecf('0x29'),_0x3ecf('0x6'),'strategy','dialRandomLastDigitCallerIdNumber',_0x3ecf('0x2a'),_0x3ecf('0x2b'),'dialNoSuchNumberRetryFrequency',_0x3ecf('0x2c'),_0x3ecf('0x2d'),_0x3ecf('0x2e'),_0x3ecf('0x2f'),_0x3ecf('0x30'),_0x3ecf('0x31'),_0x3ecf('0x32'),_0x3ecf('0x33'),_0x3ecf('0x34'),_0x3ecf('0x35'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':'Trunk','as':_0x3ecf('0x36'),'attributes':['id',_0x3ecf('0x2'),_0x3ecf('0x37'),'active']},{'model':_0x3ecf('0x38'),'as':_0x3ecf('0x39'),'attributes':['id',_0x3ecf('0x2')]},{'model':_0x3ecf('0x36'),'as':_0x3ecf('0x3a'),'attributes':['id',_0x3ecf('0x2'),'callerid',_0x3ecf('0x3b')]},{'model':_0x3ecf('0x3c'),'as':_0x3ecf('0x3c'),'attributes':['id',_0x3ecf('0x2')],'include':[{'model':_0x3ecf('0x3c'),'as':_0x3ecf('0x3d'),'attributes':['id','name',_0x3ecf('0x3e')]}]}]},'log':_0x3ecf('0x0')});};}; \ No newline at end of file +var _0x58d2=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0x3e080c,_0x5651ba){var _0x4d52d0=function(_0x5dc573){while(--_0x5dc573){_0x3e080c['push'](_0x3e080c['shift']());}};_0x4d52d0(++_0x5651ba);}(_0x58d2,0x1b2));var _0x258d=function(_0x455f19,_0x4f8f3a){_0x455f19=_0x455f19-0x0;var _0x422f21=_0x58d2[_0x455f19];return _0x422f21;};'use strict';var client=require(_0x258d('0x0'));exports[_0x258d('0x1')]=function(){return function(){return client[_0x258d('0x2')](_0x258d('0x3'),{'options':{'raw':![],'attributes':['id',_0x258d('0x4'),_0x258d('0x5'),_0x258d('0x6'),_0x258d('0x7'),_0x258d('0x8'),_0x258d('0x9'),_0x258d('0xa'),_0x258d('0xb'),_0x258d('0xc'),_0x258d('0xd'),'dialPowerLevel','dialPredictiveOptimization',_0x258d('0xe'),_0x258d('0xf'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions',_0x258d('0x10'),_0x258d('0x11'),'dialCongestionMaxRetry',_0x258d('0x12'),'dialBusyMaxRetry',_0x258d('0x13'),_0x258d('0x14'),_0x258d('0x15'),_0x258d('0x16'),'dialTimezone',_0x258d('0x17'),_0x258d('0x18'),_0x258d('0x19'),_0x258d('0x1a'),_0x258d('0x1b'),'dialAMDGreeting',_0x258d('0x1c'),_0x258d('0x1d'),_0x258d('0x1e'),_0x258d('0x1f'),'dialAMDMaximumNumberOfWords',_0x258d('0x20'),_0x258d('0x21'),_0x258d('0x22'),'dialRecallMeTimeout','dialRecallInQueue',_0x258d('0x23'),_0x258d('0x24'),_0x258d('0x25'),_0x258d('0x26'),_0x258d('0x8'),_0x258d('0x27'),_0x258d('0x28'),_0x258d('0x29'),_0x258d('0x2a'),_0x258d('0x2b'),_0x258d('0x2c'),_0x258d('0x2d'),_0x258d('0x2e'),_0x258d('0x2f'),'dialMachineMaxRetry',_0x258d('0x30'),'dialAgentRejectMaxRetry',_0x258d('0x31'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x258d('0x32'),'as':'Trunk','attributes':['id','name',_0x258d('0x33'),_0x258d('0x34')]},{'model':_0x258d('0x35'),'as':_0x258d('0x36'),'attributes':['id','name']},{'model':_0x258d('0x32'),'as':_0x258d('0x37'),'attributes':['id',_0x258d('0x4'),'callerid','active']},{'model':_0x258d('0x38'),'as':'Interval','attributes':['id',_0x258d('0x4')],'include':[{'model':_0x258d('0x38'),'as':_0x258d('0x39'),'attributes':['id','name','interval']}]}]},'log':_0x258d('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 24e67fd..1ab03b6 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(_0x802949,_0x769749){var _0x508ed6=function(_0x3a60ac){while(--_0x3a60ac){_0x802949['push'](_0x802949['shift']());}};_0x508ed6(++_0x769749);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x466de1,_0x5e35ee){var _0x325b2b=function(_0x569fad){while(--_0x569fad){_0x466de1['push'](_0x466de1['shift']());}};_0x325b2b(++_0x5e35ee);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index ccec5d1..f8edaee 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 _0x8921=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x33f6fb,_0x41d20f){var _0x42fc14=function(_0x2eb75b){while(--_0x2eb75b){_0x33f6fb['push'](_0x33f6fb['shift']());}};_0x42fc14(++_0x41d20f);}(_0x8921,0x177));var _0x1892=function(_0x2ce5b1,_0x26f163){_0x2ce5b1=_0x2ce5b1-0x0;var _0x4ba99e=_0x8921[_0x2ce5b1];return _0x4ba99e;};'use strict';var client=require(_0x1892('0x0'));exports[_0x1892('0x1')]=function(_0x8997bf){return function(){return client[_0x1892('0x2')](_0x1892('0x3'),{'options':{'where':{'VoiceQueueId':_0x8997bf,'paused':!![]},'raw':!![]},'log':_0x1892('0x1')});};}; \ No newline at end of file +var _0x8efc=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0xc78832,_0x27a347){var _0x21753a=function(_0x2efa96){while(--_0x2efa96){_0xc78832['push'](_0xc78832['shift']());}};_0x21753a(++_0x27a347);}(_0x8efc,0x17a));var _0xc8ef=function(_0x136a23,_0x507cda){_0x136a23=_0x136a23-0x0;var _0x48e69b=_0x8efc[_0x136a23];return _0x48e69b;};'use strict';var client=require('../client');exports[_0xc8ef('0x0')]=function(_0x4bd4f2){return function(){return client[_0xc8ef('0x1')](_0xc8ef('0x2'),{'options':{'where':{'VoiceQueueId':_0x4bd4f2,'paused':!![]},'raw':!![]},'log':_0xc8ef('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index c3878a9..636f25a 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(_0x323f85,_0x1beb12){var _0x1de722=function(_0x4f6134){while(--_0x4f6134){_0x323f85['push'](_0x323f85['shift']());}};_0x1de722(++_0x1beb12);}(_0x7a54,0x106));var _0x47a5=function(_0x152162,_0x1ac321){_0x152162=_0x152162-0x0;var _0x3d23be=_0x7a54[_0x152162];return _0x3d23be;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x11ddcf,_0x14e460){var _0x2da4a8=function(_0x38322e){while(--_0x38322e){_0x11ddcf['push'](_0x11ddcf['shift']());}};_0x2da4a8(++_0x14e460);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 181d218..36e678a 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 _0xa651=['Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer'];(function(_0x412200,_0x5735c6){var _0x140699=function(_0x184ec2){while(--_0x184ec2){_0x412200['push'](_0x412200['shift']());}};_0x140699(++_0x5735c6);}(_0xa651,0x135));var _0x1a65=function(_0x11ec09,_0x24e078){_0x11ec09=_0x11ec09-0x0;var _0x410d64=_0xa651[_0x11ec09];return _0x410d64;};'use strict';var client=require(_0x1a65('0x0'));exports[_0x1a65('0x1')]={};exports[_0x1a65('0x2')]=function(_0x106f43){return client[_0x1a65('0x3')](_0x1a65('0x4'),{'body':{'result':_0x106f43[_0x1a65('0x5')],'transfererchannel':_0x106f43[_0x1a65('0x6')],'transferercalleridnum':_0x106f43[_0x1a65('0x7')],'transferercalleridname':_0x106f43['transferercalleridname'],'transfererconnectedlinenum':_0x106f43[_0x1a65('0x8')],'transfererconnectedlinename':_0x106f43[_0x1a65('0x9')],'transfereraccountcode':_0x106f43['transfereraccountcode'],'transferercontext':_0x106f43['transferercontext'],'transfererexten':_0x106f43[_0x1a65('0xa')],'transfererlinkedid':_0x106f43[_0x1a65('0xb')],'transfereechannel':_0x106f43[_0x1a65('0xc')],'transfereecalleridnum':_0x106f43[_0x1a65('0xd')],'transfereecalleridname':_0x106f43['transfereecalleridname'],'transfereeconnectedlinenum':_0x106f43[_0x1a65('0xe')],'transfereeconnectedlinename':_0x106f43['transfereeconnectedlinename'],'transfereeaccountcode':_0x106f43[_0x1a65('0xf')],'transfereecontext':_0x106f43[_0x1a65('0x10')],'transfereeexten':_0x106f43[_0x1a65('0x11')],'transfereelinkedid':_0x106f43[_0x1a65('0x12')],'isexternal':_0x106f43['isexternal'],'context':_0x106f43[_0x1a65('0x13')],'extension':_0x106f43['extension'],'type':_0x1a65('0x14')},'log':_0x1a65('0x4')});};exports[_0x1a65('0x15')]=function(_0x4e1022){return client['Request'](_0x1a65('0x4'),{'body':{'result':_0x4e1022[_0x1a65('0x5')],'transfererchannel':_0x4e1022[_0x1a65('0x16')],'transferercalleridnum':_0x4e1022[_0x1a65('0x17')],'transferercalleridname':_0x4e1022[_0x1a65('0x18')],'transfererconnectedlinenum':_0x4e1022['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4e1022[_0x1a65('0x19')],'transfereraccountcode':_0x4e1022[_0x1a65('0x1a')],'transferercontext':_0x4e1022['secondtransferercontext'],'transfererexten':_0x4e1022['secondtransfererexten'],'transfererlinkedid':_0x4e1022[_0x1a65('0x1b')],'transfereechannel':_0x4e1022['transfertargetchannel'],'transfereecalleridnum':_0x4e1022[_0x1a65('0x1c')],'transfereecalleridname':_0x4e1022[_0x1a65('0x1d')],'transfereeconnectedlinenum':_0x4e1022[_0x1a65('0x1e')],'transfereeconnectedlinename':_0x4e1022[_0x1a65('0x1f')],'transfereeaccountcode':_0x4e1022[_0x1a65('0x20')],'transfereecontext':_0x4e1022[_0x1a65('0x21')],'transfereeexten':_0x4e1022[_0x1a65('0x22')],'transfereelinkedid':_0x4e1022[_0x1a65('0x23')],'isexternal':_0x4e1022['isexternal'],'context':_0x4e1022[_0x1a65('0x24')],'extension':_0x4e1022[_0x1a65('0x25')],'type':_0x1a65('0x26')},'log':_0x1a65('0x4')});}; \ No newline at end of file +var _0xe58b=['../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','origtransferercontext','origtransfererexten','attended'];(function(_0x416a3f,_0x4711c6){var _0x563b51=function(_0x5f5777){while(--_0x5f5777){_0x416a3f['push'](_0x416a3f['shift']());}};_0x563b51(++_0x4711c6);}(_0xe58b,0x17a));var _0xbe58=function(_0x41aaa5,_0x5d880b){_0x41aaa5=_0x41aaa5-0x0;var _0x35c60f=_0xe58b[_0x41aaa5];return _0x35c60f;};'use strict';var client=require(_0xbe58('0x0'));exports['transfers']={};exports[_0xbe58('0x1')]=function(_0x58f407){return client[_0xbe58('0x2')](_0xbe58('0x3'),{'body':{'result':_0x58f407[_0xbe58('0x4')],'transfererchannel':_0x58f407[_0xbe58('0x5')],'transferercalleridnum':_0x58f407[_0xbe58('0x6')],'transferercalleridname':_0x58f407['transferercalleridname'],'transfererconnectedlinenum':_0x58f407['transfererconnectedlinenum'],'transfererconnectedlinename':_0x58f407[_0xbe58('0x7')],'transfereraccountcode':_0x58f407['transfereraccountcode'],'transferercontext':_0x58f407[_0xbe58('0x8')],'transfererexten':_0x58f407[_0xbe58('0x9')],'transfererlinkedid':_0x58f407[_0xbe58('0xa')],'transfereechannel':_0x58f407[_0xbe58('0xb')],'transfereecalleridnum':_0x58f407[_0xbe58('0xc')],'transfereecalleridname':_0x58f407[_0xbe58('0xd')],'transfereeconnectedlinenum':_0x58f407[_0xbe58('0xe')],'transfereeconnectedlinename':_0x58f407[_0xbe58('0xf')],'transfereeaccountcode':_0x58f407[_0xbe58('0x10')],'transfereecontext':_0x58f407[_0xbe58('0x11')],'transfereeexten':_0x58f407[_0xbe58('0x12')],'transfereelinkedid':_0x58f407[_0xbe58('0x13')],'isexternal':_0x58f407[_0xbe58('0x14')],'context':_0x58f407[_0xbe58('0x15')],'extension':_0x58f407['extension'],'type':_0xbe58('0x16')},'log':_0xbe58('0x3')});};exports[_0xbe58('0x17')]=function(_0x1559eb){return client[_0xbe58('0x2')](_0xbe58('0x3'),{'body':{'result':_0x1559eb[_0xbe58('0x4')],'transfererchannel':_0x1559eb[_0xbe58('0x18')],'transferercalleridnum':_0x1559eb[_0xbe58('0x19')],'transferercalleridname':_0x1559eb['origtransferercalleridname'],'transfererconnectedlinenum':_0x1559eb[_0xbe58('0x1a')],'transfererconnectedlinename':_0x1559eb[_0xbe58('0x1b')],'transfereraccountcode':_0x1559eb[_0xbe58('0x1c')],'transferercontext':_0x1559eb[_0xbe58('0x1d')],'transfererexten':_0x1559eb[_0xbe58('0x1e')],'transfererlinkedid':_0x1559eb[_0xbe58('0x1f')],'transfereechannel':_0x1559eb[_0xbe58('0x20')],'transfereecalleridnum':_0x1559eb[_0xbe58('0x21')],'transfereecalleridname':_0x1559eb[_0xbe58('0x22')],'transfereeconnectedlinenum':_0x1559eb[_0xbe58('0x23')],'transfereeconnectedlinename':_0x1559eb[_0xbe58('0x24')],'transfereeaccountcode':_0x1559eb[_0xbe58('0x25')],'transfereecontext':_0x1559eb[_0xbe58('0x26')],'transfereeexten':_0x1559eb['transfertargetexten'],'transfereelinkedid':_0x1559eb['transfertargetlinkedid'],'isexternal':_0x1559eb['isexternal'],'context':_0x1559eb[_0xbe58('0x27')],'extension':_0x1559eb[_0xbe58('0x28')],'type':_0xbe58('0x29')},'log':_0xbe58('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 871b70d..18db78d 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 _0xb511=['outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','username','map','channel','filename','uniqueid','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','MixMonitor\x20Success','catch','Channel\x20doesn\x27t\x20exist','voicechannel','validate','StopMixMonitor','destinationchannel','stop','%s.%s','status','queueChannels','voicequeuechannelhangup','Hangup','Redirect','exten','context','telephones','trunks','outboundChannels','outbound','Event\x20name\x20mandatory','emit','custom:','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','moment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','pause','QueuePause','isConnected','asterisk','ami\x20disconnected','join','keys','module','action','Action','then','message','error','pick','command','content','voiceQueues','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay'];(function(_0x463b1c,_0x515717){var _0x3f79b9=function(_0x248bb1){while(--_0x248bb1){_0x463b1c['push'](_0x463b1c['shift']());}};_0x3f79b9(++_0x515717);}(_0xb511,0x165));var _0x1b51=function(_0xdabe57,_0xa9586){_0xdabe57=_0xdabe57-0x0;var _0x56de6d=_0xb511[_0xdabe57];return _0x56de6d;};'use strict';var _=require(_0x1b51('0x0'));var util=require(_0x1b51('0x1'));var jayson=require(_0x1b51('0x2'));var schema=require('validate');var BPromise=require(_0x1b51('0x3'));var moment=require(_0x1b51('0x4'));var config=require('../../../config/environment');var properties=require(_0x1b51('0x5'));var ami=require(_0x1b51('0x6'));exports[_0x1b51('0x7')]=function(_0x4d17ab,_0x14e88a,_0x463bec){return new BPromise(function(_0x506653,_0x475add){var _0x43c14c={'QueuePause':function(_0x5e7ece){return new Promise(function(_0xfa46a3,_0x1690c9){var _0x407a2f=util[_0x1b51('0x8')](_0x1b51('0x9'),_0x1b51('0xa'),_0x5e7ece[_0x1b51('0xb')]);if(_0x4d17ab[_0x1b51('0xc')]&&_0x4d17ab['timers'][_0x407a2f]&&_0x4d17ab[_0x1b51('0xc')][_0x407a2f][_0x1b51('0xd')]){_0x4d17ab[_0x1b51('0xc')][_0x407a2f][_0x1b51('0xe')]();}if(_0x4d17ab[_0x1b51('0xf')][_0x407a2f]){_0x4d17ab[_0x1b51('0xf')][_0x407a2f]['updateStatusRealtime']({'statePause':_0x5e7ece[_0x1b51('0x10')]?!![]:![]});}_0xfa46a3({'code':0xc8,'message':_0x1b51('0x11')});});},'Reload':function(_0x146dc0){var _0x119628=this;return new Promise(function(_0x3abd5c,_0x46c991){if(ami[_0x1b51('0x12')]()==![]){return _0x46c991(_0x119628['error'](0x1f4,[config[_0x1b51('0x13')]['ip'],config['asterisk']['username'],_0x1b51('0x14')][_0x1b51('0x15')]('\x20')));}_0x146dc0=_['pick'](_0x146dc0,_[_0x1b51('0x16')](properties[_0x1b51('0x17')]));_0x146dc0[_0x1b51('0x18')]='Reload';return ami[_0x1b51('0x19')](_0x146dc0)[_0x1b51('0x1a')](function(_0x24bfc1){_0x3abd5c({'code':0xc8,'message':_0x24bfc1[_0x1b51('0x1b')]});})['catch'](function(_0x238749){_0x46c991(_0x119628[_0x1b51('0x1c')](0x1f5,_0x238749[_0x1b51('0x1b')]));});});},'Command':function(_0x556762){var _0x5e222b=this;return new Promise(function(_0x1d67f3,_0x3ff992){if(ami['isConnected']()==![]){return _0x3ff992(_0x5e222b[_0x1b51('0x1c')](0x1f4,[config[_0x1b51('0x13')]['ip'],config['asterisk']['username'],_0x1b51('0x14')][_0x1b51('0x15')]('\x20')));}_0x556762=_[_0x1b51('0x1d')](_0x556762,_0x1b51('0x1e'));_0x556762['action']='Command';return ami[_0x1b51('0x19')](_0x556762)[_0x1b51('0x1a')](function(_0x4c6c6b){_0x1d67f3({'code':0xc8,'message':_0x4c6c6b[_0x1b51('0x1f')]});})['catch'](function(_0x4a2e45){_0x3ff992(_0x5e222b[_0x1b51('0x1c')](0x1f5,_0x4a2e45['message']));});});},'VoiceQueues':function(_0x1eac36){return new Promise(function(_0x2a720f,_0x54a526){var _0x1ba4d2=[];for(var _0x68cdfb in _0x4d17ab[_0x1b51('0x20')]){if(_0x4d17ab[_0x1b51('0x20')]['hasOwnProperty'](_0x68cdfb)){var _0x5559cf=_0x4d17ab[_0x1b51('0x20')][_0x68cdfb];var _0x1a6c68={'id':_0x5559cf['id'],'name':_0x5559cf[_0x1b51('0xb')],'strategy':_0x5559cf[_0x1b51('0x21')],'answered':_0x5559cf[_0x1b51('0x22')],'available':_0x5559cf[_0x1b51('0x23')],'loggedIn':_0x5559cf[_0x1b51('0x24')],'pTalking':_0x5559cf['pTalking'],'sumBillable':_0x5559cf[_0x1b51('0x25')],'sumDuration':_0x5559cf[_0x1b51('0x26')],'sumHoldTime':_0x5559cf[_0x1b51('0x27')]||0x0,'talking':_0x5559cf['talking'],'total':_0x5559cf[_0x1b51('0x28')],'type':_0x5559cf[_0x1b51('0x29')],'unmanaged':_0x5559cf[_0x1b51('0x2a')],'abandoned':_0x5559cf[_0x1b51('0x2b')],'waiting':_0x5559cf[_0x1b51('0x2c')],'loggedInDb':_0x5559cf[_0x1b51('0x2d')]};if(_0x5559cf[_0x1b51('0x29')]==='outbound'){_0x1a6c68[_0x1b51('0x2e')]=_0x5559cf[_0x1b51('0x2e')];_0x1a6c68[_0x1b51('0x2f')]=_0x5559cf[_0x1b51('0x2f')];_0x1a6c68[_0x1b51('0x30')]=_0x5559cf[_0x1b51('0x30')];_0x1a6c68[_0x1b51('0x31')]=_0x5559cf[_0x1b51('0x31')];_0x1a6c68[_0x1b51('0x32')]=_0x5559cf['dialOriginateTimeout'];_0x1a6c68[_0x1b51('0x33')]=_0x5559cf[_0x1b51('0x33')];_0x1a6c68['temp']=_0x5559cf[_0x1b51('0x34')];_0x1a6c68['outboundAnswerAgiCallsDay']=_0x5559cf[_0x1b51('0x35')];_0x1a6c68[_0x1b51('0x36')]=_0x5559cf[_0x1b51('0x36')];_0x1a6c68[_0x1b51('0x37')]=_0x5559cf['outboundBlacklistCallsDay'];_0x1a6c68[_0x1b51('0x38')]=_0x5559cf[_0x1b51('0x38')];_0x1a6c68[_0x1b51('0x39')]=_0x5559cf[_0x1b51('0x39')];_0x1a6c68['outboundDropCallsDayACS']=_0x5559cf['outboundDropCallsDayACS'];_0x1a6c68[_0x1b51('0x3a')]=_0x5559cf[_0x1b51('0x3a')];_0x1a6c68[_0x1b51('0x3b')]=_0x5559cf[_0x1b51('0x3b')];_0x1a6c68[_0x1b51('0x3c')]=_0x5559cf['outboundNoAnswerCallsDay'];_0x1a6c68[_0x1b51('0x3d')]=_0x5559cf[_0x1b51('0x3d')];_0x1a6c68[_0x1b51('0x3e')]=_0x5559cf[_0x1b51('0x3e')];_0x1a6c68[_0x1b51('0x3f')]=_0x5559cf[_0x1b51('0x3f')];_0x1a6c68['outboundRejectCallsDay']=_0x5559cf[_0x1b51('0x40')];_0x1a6c68[_0x1b51('0x41')]=_0x5559cf[_0x1b51('0x41')];_0x1a6c68[_0x1b51('0x42')]=_0x5559cf['predictiveIntervalAnsweredCalls'];_0x1a6c68[_0x1b51('0x43')]=_0x5559cf[_0x1b51('0x43')];_0x1a6c68[_0x1b51('0x44')]=_0x5559cf[_0x1b51('0x44')];_0x1a6c68['predictiveIntervalDroppedCallsCallersExit']=_0x5559cf[_0x1b51('0x45')];_0x1a6c68[_0x1b51('0x46')]=_0x5559cf[_0x1b51('0x46')];_0x1a6c68['predictiveIntervalErlangCalls']=_0x5559cf['predictiveIntervalErlangCalls'];_0x1a6c68[_0x1b51('0x47')]=_0x5559cf['predictiveIntervalErlangCallsDroppedCalls'];_0x1a6c68[_0x1b51('0x48')]=_0x5559cf['predictiveIntervalHitRate'];_0x1a6c68[_0x1b51('0x49')]=_0x5559cf[_0x1b51('0x49')];_0x1a6c68['predictiveIntervalPauses']=_0x5559cf[_0x1b51('0x4a')];_0x1a6c68['predictiveIntervalAvailable']=_0x5559cf[_0x1b51('0x4b')];_0x1a6c68[_0x1b51('0x4c')]=_0x5559cf[_0x1b51('0x4c')];_0x1a6c68[_0x1b51('0x1b')]=_0x5559cf[_0x1b51('0x1b')];_0x1a6c68[_0x1b51('0x4d')]=_0x5559cf['originated'];_0x1a6c68[_0x1b51('0x4e')]=_0x5559cf[_0x1b51('0x4e')];_0x1a6c68[_0x1b51('0x4f')]=_0x5559cf[_0x1b51('0x4f')];_0x1a6c68[_0x1b51('0x50')]=_0x5559cf[_0x1b51('0x50')];_0x1a6c68['erlangBusyFactor']=_0x5559cf[_0x1b51('0x51')];_0x1a6c68[_0x1b51('0x52')]=_0x5559cf[_0x1b51('0x52')];_0x1a6c68[_0x1b51('0x53')]=_0x5559cf[_0x1b51('0x53')];}if(_0x5559cf[_0x1b51('0x54')]){_0x1a6c68['Trunk']={'id':_0x5559cf[_0x1b51('0x54')]['id'],'name':_0x5559cf[_0x1b51('0x54')]['name'],'active':_0x5559cf[_0x1b51('0x54')][_0x1b51('0x55')],'callerid':_0x5559cf[_0x1b51('0x54')][_0x1b51('0x56')]};}if(_0x5559cf[_0x1b51('0x57')]){_0x1a6c68[_0x1b51('0x57')]={'id':_0x5559cf[_0x1b51('0x57')]['id'],'name':_0x5559cf[_0x1b51('0x57')][_0x1b51('0xb')]};}_0x1ba4d2[_0x1b51('0x58')](_0x1a6c68);}}_0x2a720f({'count':_0x1ba4d2[_0x1b51('0x59')],'rows':_0x1ba4d2});});},'UpdateVoiceQueue':function(_0xd27a41){return new Promise(function(_0x2732e8,_0x3e2921){var _0x526547=_[_0x1b51('0x5a')](_0x4d17ab[_0x1b51('0x20')],{'id':parseInt(_0xd27a41['id'])});var _0x94e9ff=_[_0x1b51('0x5b')](_0xd27a41,['id']);if(_0x526547){for(var _0x1a15b3 in _0x94e9ff){if(typeof _0x94e9ff[_0x1a15b3]!==_0x1b51('0x5c')&&typeof _0x526547[_0x1a15b3]!=='undefined'){_0x526547[_0x1a15b3]=_0x94e9ff[_0x1a15b3];}}_0x2732e8(_0x526547);}else{_0x3e2921();}});},'VoiceChannels':function(_0x3ef6af){return new Promise(function(_0x23035b,_0x43aef2){var _0x3a01d9=_[_0x1b51('0x5d')](_0x4d17ab[_0x1b51('0x5e')]);_0x23035b({'count':_0x3a01d9['length'],'rows':_0x3a01d9});});},'VoiceChannelMixMonitor':function(_0x3db7d3){var _0x16b0ec=this;return new Promise(function(_0xe39db8,_0x595cbc){if(ami[_0x1b51('0x12')]()==![]){return _0x595cbc(_0x16b0ec[_0x1b51('0x1c')](0x1f4,[config[_0x1b51('0x13')]['ip'],config[_0x1b51('0x13')][_0x1b51('0x5f')],_0x1b51('0x14')][_0x1b51('0x15')]('\x20')));}var _0x2d5a57=schema(properties['voicechannel'])['validate'](_0x3db7d3);if(_0x2d5a57['length']>0x0){return _0x595cbc(_0x16b0ec[_0x1b51('0x1c')](0x1f4,_[_0x1b51('0x60')](_0x2d5a57,'message')['join'](',\x20')));}var _0x56736b=_[_0x1b51('0x5a')](_0x4d17ab[_0x1b51('0x5e')],{'uniqueid':_0x3db7d3['uniqueid']});if(_0x56736b&&_0x56736b[_0x1b51('0x61')]){var _0x78b3f5=util[_0x1b51('0x8')]('%s.%s',_0x3db7d3[_0x1b51('0x62')]||_0x3db7d3[_0x1b51('0x63')],_0x3db7d3[_0x1b51('0x8')]||_0x1b51('0x64'));return ami['Action']({'action':'MixMonitor','channel':_0x56736b[_0x1b51('0x61')],'file':_0x78b3f5,'options':_0x1b51('0x65')})['then'](function(_0x2b0d49){var _0x18707e=_[_0x1b51('0x5a')](_0x56736b[_0x1b51('0x66')],{'filename':_0x1b51('0x67')+_0x78b3f5[_0x1b51('0x68')]()});if(_['isNil'](_0x18707e)){_0x56736b['monitors'][_0x1b51('0x58')]({'filename':_0x1b51('0x67')+_0x78b3f5[_0x1b51('0x68')](),'createdAt':moment()[_0x1b51('0x8')](_0x1b51('0x69')),'mixmonitorid':_0x2b0d49['mixmonitorid'],'status':'rec'});}else{_0x18707e[_0x1b51('0x6a')]=_0x2b0d49['mixmonitorid'];_0x18707e['status']='rec';}_0xe39db8({'code':0xc8,'message':[_0x3db7d3[_0x1b51('0x63')],_0x1b51('0x6b'),_0x2b0d49[_0x1b51('0x6a')]][_0x1b51('0x15')]('\x20'),'mixmonitorid':_0x2b0d49[_0x1b51('0x6a')]});})[_0x1b51('0x6c')](function(_0x36b520){_0x595cbc(_0x16b0ec[_0x1b51('0x1c')](0x1f5,[_0x3db7d3[_0x1b51('0x63')],_0x36b520[_0x1b51('0x1b')][_0x1b51('0x68')]()][_0x1b51('0x15')]('\x20')));});}else{return _0x595cbc(_0x16b0ec['error'](0x1f5,_0x1b51('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x25b050){var _0x7b23ce=this;return new Promise(function(_0x2063c6,_0x875489){if(ami['isConnected']()==![]){return _0x875489(_0x7b23ce[_0x1b51('0x1c')](0x1f4,[config['asterisk']['ip'],config[_0x1b51('0x13')][_0x1b51('0x5f')],_0x1b51('0x14')][_0x1b51('0x15')]('\x20')));}var _0x3ddf0d=schema(properties[_0x1b51('0x6e')])[_0x1b51('0x6f')](_0x25b050);if(_0x3ddf0d['length']>0x0){return _0x875489(_0x7b23ce[_0x1b51('0x1c')](0x1f4,_['map'](_0x3ddf0d,_0x1b51('0x1b'))['join'](',\x20')));}var _0x4b8a15=_[_0x1b51('0x5a')](_0x4d17ab[_0x1b51('0x5e')],{'uniqueid':_0x25b050['uniqueid']});if(_0x4b8a15){return BPromise['resolve']()['then'](function(){if(_0x4b8a15[_0x1b51('0x61')]){return ami[_0x1b51('0x19')]({'action':_0x1b51('0x70'),'channel':_0x4b8a15[_0x1b51('0x61')],'mixmonitorid':_0x25b050[_0x1b51('0x6a')]})[_0x1b51('0x6c')](function(_0x41922f){});}})[_0x1b51('0x1a')](function(){if(_0x4b8a15[_0x1b51('0x71')]){return ami[_0x1b51('0x19')]({'action':_0x1b51('0x70'),'channel':_0x4b8a15['destinationchannel'],'mixmonitorid':_0x25b050['mixmonitorid']})[_0x1b51('0x6c')](function(_0x39d3ba){});}})[_0x1b51('0x1a')](function(_0x1353a9){var _0x5ba89d=_[_0x1b51('0x5a')](_0x4b8a15[_0x1b51('0x66')],{'mixmonitorid':_0x25b050[_0x1b51('0x6a')]});if(_0x5ba89d){_0x5ba89d['status']=_0x1b51('0x72');}})[_0x1b51('0x1a')](function(){var _0x19b760=util[_0x1b51('0x8')](_0x1b51('0x73'),_0x25b050[_0x1b51('0x62')]||_0x25b050[_0x1b51('0x63')],_0x25b050['format']||_0x1b51('0x64'));var _0x3b0af5=_[_0x1b51('0x5a')](_0x4b8a15['monitors'],{'filename':_0x1b51('0x67')+_0x19b760[_0x1b51('0x68')]()});if(_0x3b0af5){_0x3b0af5[_0x1b51('0x74')]=_0x1b51('0x72');}})[_0x1b51('0x1a')](function(){_0x2063c6({'code':0xc8,'message':[_0x25b050[_0x1b51('0x63')],'StopMixMonitor\x20Success'][_0x1b51('0x15')]('\x20')});})[_0x1b51('0x6c')](function(_0x3e72dc){_0x875489(_0x7b23ce['error'](0x1f5,[_0x25b050['uniqueid'],_0x3e72dc[_0x1b51('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x875489(_0x7b23ce[_0x1b51('0x1c')](0x1f5,_0x1b51('0x6d')));}});},'VoiceQueuesChannels':function(_0x34336b){return new Promise(function(_0x2ccea1,_0x126ac1){var _0x35fe05=_['values'](_0x4d17ab[_0x1b51('0x75')]);_0x2ccea1({'count':_0x35fe05[_0x1b51('0x59')],'rows':_0x35fe05});});},'VoiceQueuesChannel':function(_0x30f64d){var _0x4d39b6=this;return new Promise(function(_0x4269f6,_0x2fad15){var _0xe37dc1=schema(properties['voicequeuechannel'])['validate'](_0x30f64d);if(_0xe37dc1[_0x1b51('0x59')]>0x0){return _0x2fad15(_0x4d39b6[_0x1b51('0x1c')](0x1f4,_[_0x1b51('0x60')](_0xe37dc1,_0x1b51('0x1b'))['join'](',\x20')));}var _0x5128a5=_[_0x1b51('0x5a')](_0x4d17ab['queueChannels'],{'uniqueid':_0x30f64d[_0x1b51('0x63')]});if(_0x5128a5){_0x4269f6(_0x5128a5);}else{return _0x2fad15(_0x4d39b6[_0x1b51('0x1c')](0x1f5,_0x1b51('0x6d')));}});},'VoiceQueuesChannelHangup':function(_0x549f69){var _0x71b46c=this;return new Promise(function(_0x31f9d9,_0x161af8){if(ami[_0x1b51('0x12')]()==![]){return _0x161af8(_0x71b46c[_0x1b51('0x1c')](0x1f4,[config[_0x1b51('0x13')]['ip'],config['asterisk'][_0x1b51('0x5f')],_0x1b51('0x14')]['join']('\x20')));}var _0x4ae114=schema(properties[_0x1b51('0x76')])[_0x1b51('0x6f')](_0x549f69);if(_0x4ae114[_0x1b51('0x59')]>0x0){return _0x161af8(_0x71b46c[_0x1b51('0x1c')](0x1f4,_['map'](_0x4ae114,_0x1b51('0x1b'))[_0x1b51('0x15')](',\x20')));}var _0x423a92=_[_0x1b51('0x5a')](_0x4d17ab[_0x1b51('0x75')],{'uniqueid':_0x549f69[_0x1b51('0x63')]});if(_0x423a92&&_0x423a92[_0x1b51('0x61')]){return ami['Action']({'action':_0x1b51('0x77'),'channel':_0x423a92[_0x1b51('0x61')]})['then'](function(_0x22c3c9){_0x31f9d9({'code':0xc8,'message':[_0x549f69[_0x1b51('0x63')],_0x22c3c9[_0x1b51('0x1b')][_0x1b51('0x68')]()]['join']('\x20')});})[_0x1b51('0x6c')](function(_0x9227f9){_0x161af8(_0x71b46c[_0x1b51('0x1c')](0x1f5,[_0x549f69[_0x1b51('0x63')],_0x9227f9[_0x1b51('0x1b')][_0x1b51('0x68')]()][_0x1b51('0x15')]('\x20')));});}else{return _0x161af8(_0x71b46c['error'](0x1f5,_0x1b51('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x30b8a0){var _0x3e786c=this;return new Promise(function(_0x37b382,_0x46194a){if(ami['isConnected']()==![]){return _0x46194a(_0x3e786c[_0x1b51('0x1c')](0x1f4,[config[_0x1b51('0x13')]['ip'],config[_0x1b51('0x13')][_0x1b51('0x5f')],_0x1b51('0x14')][_0x1b51('0x15')]('\x20')));}var _0x8c050c=schema(properties['voicequeuechannelredirect'])['validate'](_0x30b8a0);if(_0x8c050c['length']>0x0){return _0x46194a(_0x3e786c[_0x1b51('0x1c')](0x1f4,_[_0x1b51('0x60')](_0x8c050c,_0x1b51('0x1b'))[_0x1b51('0x15')](',\x20')));}var _0x53de66=_[_0x1b51('0x5a')](_0x4d17ab[_0x1b51('0x75')],{'uniqueid':_0x30b8a0[_0x1b51('0x63')]});if(_0x53de66&&_0x53de66[_0x1b51('0x61')]){return ami[_0x1b51('0x19')]({'action':_0x1b51('0x78'),'channel':_0x53de66[_0x1b51('0x61')],'exten':_0x30b8a0[_0x1b51('0x79')],'context':_0x30b8a0['context']||_0x53de66[_0x1b51('0x7a')],'priority':0x1})[_0x1b51('0x1a')](function(_0x4d89f1){_0x37b382({'code':0xc8,'message':[_0x30b8a0[_0x1b51('0x63')],_0x4d89f1[_0x1b51('0x1b')]['toLowerCase']()][_0x1b51('0x15')]('\x20')});})[_0x1b51('0x6c')](function(_0x47ac6e){_0x46194a(_0x3e786c[_0x1b51('0x1c')](0x1f5,[_0x30b8a0['uniqueid'],_0x47ac6e[_0x1b51('0x1b')][_0x1b51('0x68')]()][_0x1b51('0x15')]('\x20')));});}else{return _0x46194a(_0x3e786c[_0x1b51('0x1c')](0x1f5,_0x1b51('0x6d')));}});},'Agents':function(_0x685925){return new Promise(function(_0x6d9b96,_0x40e315){var _0x58aead=_[_0x1b51('0x5d')](_0x4d17ab['agents']);_0x6d9b96({'count':_0x58aead[_0x1b51('0x59')],'rows':_0x58aead});});},'Telephones':function(_0x11ea3b){return new Promise(function(_0x1de9bd,_0x446563){var _0x1eaeeb=_[_0x1b51('0x5d')](_0x4d17ab[_0x1b51('0x7b')]);_0x1de9bd({'count':_0x1eaeeb[_0x1b51('0x59')],'rows':_0x1eaeeb});});},'Trunks':function(_0x409e71){return new Promise(function(_0x11af6f,_0x376b71){var _0x1fafbc=_['values'](_0x4d17ab[_0x1b51('0x7c')]);_0x11af6f({'count':_0x1fafbc['length'],'rows':_0x1fafbc});});},'OutboundChannels':function(_0x1e7c54){return new Promise(function(_0x51641d,_0x37a6c5){var _0x2a0645=_[_0x1b51('0x5d')](_0x4d17ab[_0x1b51('0x7d')]);_0x51641d({'count':_0x2a0645[_0x1b51('0x59')],'rows':_0x2a0645});});},'Outbound':function(_0x3d233d){return new Promise(function(_0x46119b,_0x32c072){_0x46119b(_0x4d17ab[_0x1b51('0x7e')]);});},'Campaigns':function(_0x3e9017){return new Promise(function(_0x22df69,_0x5ee437){var _0x464930=_['values'](_0x4d17ab['campaigns']);_0x22df69({'count':_0x464930[_0x1b51('0x59')],'rows':_0x464930});});},'VoiceQueuesPreview':function(_0x243934){var _0x281efc=this;return new Promise(function(_0x542e10,_0x16a99b){_0x14e88a['run'](_0x243934['id'])['then'](function(_0x33a575){_0x542e10({'code':0xc8,'message':_0x33a575[_0x1b51('0x1b')]});})[_0x1b51('0x6c')](function(_0x43d5d2){_0x16a99b(_0x281efc[_0x1b51('0x1c')](0x1f4,_0x43d5d2[_0x1b51('0x1b')]));});});},'EventManager':function(_0x20c1ea){var _0x31982c=this;return new Promise(function(_0x1f76d3,_0x2af6ac){if(!_0x20c1ea['event']){return _0x2af6ac(_0x31982c[_0x1b51('0x1c')](0x1f4,_0x1b51('0x7f')));}ami[_0x1b51('0x80')](_0x1b51('0x81')+_0x20c1ea['event'],_0x20c1ea['message']);_0x1f76d3({'code':0xc8,'message':_0x20c1ea});});},'FaxAccounts':function(_0x435b75){return new Promise(function(_0x551e1f,_0x56cd21){var _0x3e2b58=_[_0x1b51('0x5d')](_0x4d17ab[_0x1b51('0x82')]);_0x551e1f({'count':_0x3e2b58[_0x1b51('0x59')],'rows':_0x3e2b58});});},'SendFax':function(_0x1c4239){var _0x176299=this;return new Promise(function(_0x2f563a,_0x1d3dbb){_0x463bec[_0x1b51('0x83')](_0x1c4239)[_0x1b51('0x1a')](function(_0x5dc3e5){_0x2f563a({'code':0xc8,'message':_0x5dc3e5[_0x1b51('0x1b')]});})[_0x1b51('0x6c')](function(_0x482bc5){_0x1d3dbb(_0x176299['error'](0x1f4,_0x482bc5[_0x1b51('0x1b')]));});});},'CheckAfterSend':function(_0x3ea898){var _0x42734e=this;return new Promise(function(_0x2920c1,_0x1cf773){_0x463bec[_0x1b51('0x84')](_0x3ea898)['then'](function(_0x47fda3){_0x2920c1({'code':0xc8,'message':_0x47fda3['message']});})[_0x1b51('0x6c')](function(_0x4e3f14){_0x1cf773(_0x42734e[_0x1b51('0x1c')](0x1f4,_0x4e3f14[_0x1b51('0x1b')]));});});}};var _0x2ae6cc=jayson[_0x1b51('0x85')](_0x43c14c)[_0x1b51('0x86')]();_0x2ae6cc['on'](_0x1b51('0x1c'),function(_0x576cb6){return _0x475add(_0x576cb6);});_0x2ae6cc[_0x1b51('0x7')](0x232a,_0x1b51('0x87'),function(){console['log'](_0x1b51('0x88'),0x232a);return _0x506653(_0x1b51('0x89')+0x232a);});});}; \ No newline at end of file +var _0xe61c=['answered','loggedIn','pTalking','talking','total','type','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','push','length','find','omit','undefined','values','channels','map','uniqueid','channel','filename','MixMonitor','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','voicechannel','StopMixMonitor','destinationchannel','stop','%s.%s','wav','StopMixMonitor\x20Success','voicequeuechannel','voicequeuechannelhangup','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','outbound','campaigns','run','event','emit','custom:','faxAccounts','send','checkAfterSend','server','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','bluebird','../properties','listen','format','%s/%s','SIP','name','timers','updateAcw','agents','pause','QueuePause','error','asterisk','username','ami\x20disconnected','keys','Reload','Action','then','message','isConnected','join','pick','command','action','Command','catch','voiceQueues','hasOwnProperty','strategy'];(function(_0x1cb0b4,_0x1fd48d){var _0x525b60=function(_0x1efccc){while(--_0x1efccc){_0x1cb0b4['push'](_0x1cb0b4['shift']());}};_0x525b60(++_0x1fd48d);}(_0xe61c,0xee));var _0xce61=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0xe61c[_0x1602ef];return _0x5870ee;};'use strict';var _=require(_0xce61('0x0'));var util=require('util');var jayson=require(_0xce61('0x1'));var schema=require(_0xce61('0x2'));var BPromise=require(_0xce61('0x3'));var moment=require('moment');var config=require('../../../config/environment');var properties=require(_0xce61('0x4'));var ami=require('../ami');exports[_0xce61('0x5')]=function(_0xefb221,_0x2a74bf,_0x200b9a){return new BPromise(function(_0x239319,_0x310203){var _0x24528e={'QueuePause':function(_0x5f1d02){return new Promise(function(_0x2fad37,_0x4b52c3){var _0x349745=util[_0xce61('0x6')](_0xce61('0x7'),_0xce61('0x8'),_0x5f1d02[_0xce61('0x9')]);if(_0xefb221['timers']&&_0xefb221[_0xce61('0xa')][_0x349745]&&_0xefb221[_0xce61('0xa')][_0x349745]['timer']){_0xefb221[_0xce61('0xa')][_0x349745][_0xce61('0xb')]();}if(_0xefb221['agents'][_0x349745]){_0xefb221[_0xce61('0xc')][_0x349745]['updateStatusRealtime']({'statePause':_0x5f1d02[_0xce61('0xd')]?!![]:![]});}_0x2fad37({'code':0xc8,'message':_0xce61('0xe')});});},'Reload':function(_0x5e45f1){var _0x2a3019=this;return new Promise(function(_0x4ec131,_0x28ea5f){if(ami['isConnected']()==![]){return _0x28ea5f(_0x2a3019[_0xce61('0xf')](0x1f4,[config[_0xce61('0x10')]['ip'],config[_0xce61('0x10')][_0xce61('0x11')],_0xce61('0x12')]['join']('\x20')));}_0x5e45f1=_['pick'](_0x5e45f1,_[_0xce61('0x13')](properties['module']));_0x5e45f1['action']=_0xce61('0x14');return ami[_0xce61('0x15')](_0x5e45f1)[_0xce61('0x16')](function(_0x47eb72){_0x4ec131({'code':0xc8,'message':_0x47eb72[_0xce61('0x17')]});})['catch'](function(_0x3df071){_0x28ea5f(_0x2a3019[_0xce61('0xf')](0x1f5,_0x3df071[_0xce61('0x17')]));});});},'Command':function(_0x2191b9){var _0x3e30fa=this;return new Promise(function(_0x2c9ec7,_0xea8db2){if(ami[_0xce61('0x18')]()==![]){return _0xea8db2(_0x3e30fa['error'](0x1f4,[config['asterisk']['ip'],config[_0xce61('0x10')]['username'],_0xce61('0x12')][_0xce61('0x19')]('\x20')));}_0x2191b9=_[_0xce61('0x1a')](_0x2191b9,_0xce61('0x1b'));_0x2191b9[_0xce61('0x1c')]=_0xce61('0x1d');return ami[_0xce61('0x15')](_0x2191b9)[_0xce61('0x16')](function(_0x479691){_0x2c9ec7({'code':0xc8,'message':_0x479691['content']});})[_0xce61('0x1e')](function(_0x2e559b){_0xea8db2(_0x3e30fa[_0xce61('0xf')](0x1f5,_0x2e559b[_0xce61('0x17')]));});});},'VoiceQueues':function(_0x2cf24c){return new Promise(function(_0x2241b2,_0x471a08){var _0x274f04=[];for(var _0x33c3ad in _0xefb221[_0xce61('0x1f')]){if(_0xefb221['voiceQueues'][_0xce61('0x20')](_0x33c3ad)){var _0x48b544=_0xefb221[_0xce61('0x1f')][_0x33c3ad];var _0x2de420={'id':_0x48b544['id'],'name':_0x48b544[_0xce61('0x9')],'strategy':_0x48b544[_0xce61('0x21')],'answered':_0x48b544[_0xce61('0x22')],'available':_0x48b544['available'],'loggedIn':_0x48b544[_0xce61('0x23')],'pTalking':_0x48b544[_0xce61('0x24')],'sumBillable':_0x48b544['sumBillable'],'sumDuration':_0x48b544['sumDuration'],'sumHoldTime':_0x48b544['sumHoldTime']||0x0,'talking':_0x48b544[_0xce61('0x25')],'total':_0x48b544[_0xce61('0x26')],'type':_0x48b544[_0xce61('0x27')],'unmanaged':_0x48b544[_0xce61('0x28')],'abandoned':_0x48b544[_0xce61('0x29')],'waiting':_0x48b544['waiting'],'loggedInDb':_0x48b544[_0xce61('0x2a')]};if(_0x48b544[_0xce61('0x27')]==='outbound'){_0x2de420[_0xce61('0x2b')]=_0x48b544[_0xce61('0x2b')];_0x2de420['dialMethod']=_0x48b544[_0xce61('0x2c')];_0x2de420[_0xce61('0x2d')]=_0x48b544['dialOriginateCallerIdName'];_0x2de420[_0xce61('0x2e')]=_0x48b544['dialOriginateCallerIdNumber'];_0x2de420[_0xce61('0x2f')]=_0x48b544['dialOriginateTimeout'];_0x2de420['dialPrefix']=_0x48b544['dialPrefix'];_0x2de420[_0xce61('0x30')]=_0x48b544[_0xce61('0x30')];_0x2de420[_0xce61('0x31')]=_0x48b544[_0xce61('0x31')];_0x2de420[_0xce61('0x32')]=_0x48b544[_0xce61('0x32')];_0x2de420[_0xce61('0x33')]=_0x48b544[_0xce61('0x33')];_0x2de420[_0xce61('0x34')]=_0x48b544[_0xce61('0x34')];_0x2de420[_0xce61('0x35')]=_0x48b544[_0xce61('0x35')];_0x2de420[_0xce61('0x36')]=_0x48b544[_0xce61('0x36')];_0x2de420[_0xce61('0x37')]=_0x48b544[_0xce61('0x37')];_0x2de420[_0xce61('0x38')]=_0x48b544[_0xce61('0x38')];_0x2de420[_0xce61('0x39')]=_0x48b544[_0xce61('0x39')];_0x2de420['outboundNoSuchCallsDay']=_0x48b544[_0xce61('0x3a')];_0x2de420[_0xce61('0x3b')]=_0x48b544[_0xce61('0x3b')];_0x2de420['outboundReCallsDay']=_0x48b544['outboundReCallsDay'];_0x2de420['outboundRejectCallsDay']=_0x48b544[_0xce61('0x3c')];_0x2de420[_0xce61('0x3d')]=_0x48b544[_0xce61('0x3d')];_0x2de420[_0xce61('0x3e')]=_0x48b544[_0xce61('0x3e')];_0x2de420[_0xce61('0x3f')]=_0x48b544[_0xce61('0x3f')];_0x2de420[_0xce61('0x40')]=_0x48b544[_0xce61('0x40')];_0x2de420['predictiveIntervalDroppedCallsCallersExit']=_0x48b544['predictiveIntervalDroppedCallsCallersExit'];_0x2de420[_0xce61('0x41')]=_0x48b544[_0xce61('0x41')];_0x2de420[_0xce61('0x42')]=_0x48b544[_0xce61('0x42')];_0x2de420[_0xce61('0x43')]=_0x48b544['predictiveIntervalErlangCallsDroppedCalls'];_0x2de420[_0xce61('0x44')]=_0x48b544[_0xce61('0x44')];_0x2de420[_0xce61('0x45')]=_0x48b544[_0xce61('0x45')];_0x2de420[_0xce61('0x46')]=_0x48b544[_0xce61('0x46')];_0x2de420['predictiveIntervalAvailable']=_0x48b544[_0xce61('0x47')];_0x2de420[_0xce61('0x48')]=_0x48b544['predictiveIntervalTotalCalls'];_0x2de420['message']=_0x48b544[_0xce61('0x17')];_0x2de420[_0xce61('0x49')]=_0x48b544[_0xce61('0x49')];_0x2de420[_0xce61('0x4a')]=_0x48b544[_0xce61('0x4a')];_0x2de420['erlangCallToSecond']=_0x48b544[_0xce61('0x4b')];_0x2de420['erlangAbandonmentRate']=_0x48b544[_0xce61('0x4c')];_0x2de420[_0xce61('0x4d')]=_0x48b544[_0xce61('0x4d')];_0x2de420[_0xce61('0x4e')]=_0x48b544['startPredictive'];_0x2de420['startProgressive']=_0x48b544['startProgressive'];}if(_0x48b544[_0xce61('0x4f')]){_0x2de420['Trunk']={'id':_0x48b544[_0xce61('0x4f')]['id'],'name':_0x48b544[_0xce61('0x4f')]['name'],'active':_0x48b544[_0xce61('0x4f')][_0xce61('0x50')],'callerid':_0x48b544['Trunk'][_0xce61('0x51')]};}if(_0x48b544[_0xce61('0x52')]){_0x2de420[_0xce61('0x52')]={'id':_0x48b544[_0xce61('0x52')]['id'],'name':_0x48b544['Interval'][_0xce61('0x9')]};}_0x274f04[_0xce61('0x53')](_0x2de420);}}_0x2241b2({'count':_0x274f04[_0xce61('0x54')],'rows':_0x274f04});});},'UpdateVoiceQueue':function(_0x58254c){return new Promise(function(_0x30c0a9,_0x4b3f06){var _0x252e7b=_[_0xce61('0x55')](_0xefb221[_0xce61('0x1f')],{'id':parseInt(_0x58254c['id'])});var _0x25e088=_[_0xce61('0x56')](_0x58254c,['id']);if(_0x252e7b){for(var _0x4e05a3 in _0x25e088){if(typeof _0x25e088[_0x4e05a3]!==_0xce61('0x57')&&typeof _0x252e7b[_0x4e05a3]!==_0xce61('0x57')){_0x252e7b[_0x4e05a3]=_0x25e088[_0x4e05a3];}}_0x30c0a9(_0x252e7b);}else{_0x4b3f06();}});},'VoiceChannels':function(_0x2f5344){return new Promise(function(_0x4f8e3d,_0x595e2e){var _0x4f6c62=_[_0xce61('0x58')](_0xefb221[_0xce61('0x59')]);_0x4f8e3d({'count':_0x4f6c62['length'],'rows':_0x4f6c62});});},'VoiceChannelMixMonitor':function(_0xb7f12f){var _0x15a3c6=this;return new Promise(function(_0x23a471,_0x159fb6){if(ami[_0xce61('0x18')]()==![]){return _0x159fb6(_0x15a3c6[_0xce61('0xf')](0x1f4,[config[_0xce61('0x10')]['ip'],config[_0xce61('0x10')][_0xce61('0x11')],_0xce61('0x12')]['join']('\x20')));}var _0x4e4ed4=schema(properties['voicechannel'])[_0xce61('0x2')](_0xb7f12f);if(_0x4e4ed4[_0xce61('0x54')]>0x0){return _0x159fb6(_0x15a3c6[_0xce61('0xf')](0x1f4,_[_0xce61('0x5a')](_0x4e4ed4,_0xce61('0x17'))[_0xce61('0x19')](',\x20')));}var _0x3895b5=_['find'](_0xefb221[_0xce61('0x59')],{'uniqueid':_0xb7f12f[_0xce61('0x5b')]});if(_0x3895b5&&_0x3895b5[_0xce61('0x5c')]){var _0x59cd8e=util['format']('%s.%s',_0xb7f12f[_0xce61('0x5d')]||_0xb7f12f[_0xce61('0x5b')],_0xb7f12f['format']||'wav');return ami[_0xce61('0x15')]({'action':_0xce61('0x5e'),'channel':_0x3895b5[_0xce61('0x5c')],'file':_0x59cd8e,'options':'ai(mixmonitorid)'})[_0xce61('0x16')](function(_0x5de1bd){var _0x250824=_[_0xce61('0x55')](_0x3895b5[_0xce61('0x5f')],{'filename':'/var/spool/asterisk/monitor/'+_0x59cd8e[_0xce61('0x60')]()});if(_[_0xce61('0x61')](_0x250824)){_0x3895b5[_0xce61('0x5f')][_0xce61('0x53')]({'filename':_0xce61('0x62')+_0x59cd8e[_0xce61('0x60')](),'createdAt':moment()[_0xce61('0x6')](_0xce61('0x63')),'mixmonitorid':_0x5de1bd[_0xce61('0x64')],'status':_0xce61('0x65')});}else{_0x250824['mixmonitorid']=_0x5de1bd[_0xce61('0x64')];_0x250824[_0xce61('0x66')]=_0xce61('0x65');}_0x23a471({'code':0xc8,'message':[_0xb7f12f[_0xce61('0x5b')],_0xce61('0x67'),_0x5de1bd[_0xce61('0x64')]][_0xce61('0x19')]('\x20'),'mixmonitorid':_0x5de1bd['mixmonitorid']});})[_0xce61('0x1e')](function(_0x4db7e2){_0x159fb6(_0x15a3c6[_0xce61('0xf')](0x1f5,[_0xb7f12f['uniqueid'],_0x4db7e2[_0xce61('0x17')][_0xce61('0x60')]()][_0xce61('0x19')]('\x20')));});}else{return _0x159fb6(_0x15a3c6[_0xce61('0xf')](0x1f5,_0xce61('0x68')));}});},'VoiceChannelStopMixMonitor':function(_0x4f812e){var _0x3b26b6=this;return new Promise(function(_0x5127c7,_0x356b63){if(ami[_0xce61('0x18')]()==![]){return _0x356b63(_0x3b26b6[_0xce61('0xf')](0x1f4,[config[_0xce61('0x10')]['ip'],config['asterisk'][_0xce61('0x11')],_0xce61('0x12')][_0xce61('0x19')]('\x20')));}var _0x12392b=schema(properties[_0xce61('0x69')])[_0xce61('0x2')](_0x4f812e);if(_0x12392b[_0xce61('0x54')]>0x0){return _0x356b63(_0x3b26b6[_0xce61('0xf')](0x1f4,_['map'](_0x12392b,_0xce61('0x17'))[_0xce61('0x19')](',\x20')));}var _0x45c6d5=_[_0xce61('0x55')](_0xefb221['channels'],{'uniqueid':_0x4f812e[_0xce61('0x5b')]});if(_0x45c6d5){return BPromise['resolve']()[_0xce61('0x16')](function(){if(_0x45c6d5[_0xce61('0x5c')]){return ami[_0xce61('0x15')]({'action':_0xce61('0x6a'),'channel':_0x45c6d5[_0xce61('0x5c')],'mixmonitorid':_0x4f812e[_0xce61('0x64')]})[_0xce61('0x1e')](function(_0x19277e){});}})['then'](function(){if(_0x45c6d5[_0xce61('0x6b')]){return ami[_0xce61('0x15')]({'action':'StopMixMonitor','channel':_0x45c6d5[_0xce61('0x6b')],'mixmonitorid':_0x4f812e[_0xce61('0x64')]})[_0xce61('0x1e')](function(_0x3b129c){});}})[_0xce61('0x16')](function(_0x332f39){var _0x1103d8=_[_0xce61('0x55')](_0x45c6d5[_0xce61('0x5f')],{'mixmonitorid':_0x4f812e[_0xce61('0x64')]});if(_0x1103d8){_0x1103d8[_0xce61('0x66')]=_0xce61('0x6c');}})['then'](function(){var _0x278da8=util[_0xce61('0x6')](_0xce61('0x6d'),_0x4f812e[_0xce61('0x5d')]||_0x4f812e[_0xce61('0x5b')],_0x4f812e[_0xce61('0x6')]||_0xce61('0x6e'));var _0xc7945b=_['find'](_0x45c6d5[_0xce61('0x5f')],{'filename':_0xce61('0x62')+_0x278da8[_0xce61('0x60')]()});if(_0xc7945b){_0xc7945b[_0xce61('0x66')]=_0xce61('0x6c');}})[_0xce61('0x16')](function(){_0x5127c7({'code':0xc8,'message':[_0x4f812e['uniqueid'],_0xce61('0x6f')][_0xce61('0x19')]('\x20')});})[_0xce61('0x1e')](function(_0x53f280){_0x356b63(_0x3b26b6['error'](0x1f5,[_0x4f812e[_0xce61('0x5b')],_0x53f280[_0xce61('0x17')][_0xce61('0x60')]()][_0xce61('0x19')]('\x20')));});}else{return _0x356b63(_0x3b26b6[_0xce61('0xf')](0x1f5,_0xce61('0x68')));}});},'VoiceQueuesChannels':function(_0x576415){return new Promise(function(_0x28bdb1,_0x2aed2d){var _0x2d7d80=_[_0xce61('0x58')](_0xefb221['queueChannels']);_0x28bdb1({'count':_0x2d7d80[_0xce61('0x54')],'rows':_0x2d7d80});});},'VoiceQueuesChannel':function(_0x92e776){var _0x47cec5=this;return new Promise(function(_0x197a74,_0x4c6bda){var _0x55df08=schema(properties[_0xce61('0x70')])[_0xce61('0x2')](_0x92e776);if(_0x55df08['length']>0x0){return _0x4c6bda(_0x47cec5[_0xce61('0xf')](0x1f4,_[_0xce61('0x5a')](_0x55df08,'message')[_0xce61('0x19')](',\x20')));}var _0x390cdf=_['find'](_0xefb221['queueChannels'],{'uniqueid':_0x92e776['uniqueid']});if(_0x390cdf){_0x197a74(_0x390cdf);}else{return _0x4c6bda(_0x47cec5['error'](0x1f5,_0xce61('0x68')));}});},'VoiceQueuesChannelHangup':function(_0x3f65fb){var _0x3066b6=this;return new Promise(function(_0x27714e,_0x4f0f3c){if(ami['isConnected']()==![]){return _0x4f0f3c(_0x3066b6[_0xce61('0xf')](0x1f4,[config[_0xce61('0x10')]['ip'],config['asterisk'][_0xce61('0x11')],_0xce61('0x12')][_0xce61('0x19')]('\x20')));}var _0x1f84ea=schema(properties[_0xce61('0x71')])[_0xce61('0x2')](_0x3f65fb);if(_0x1f84ea[_0xce61('0x54')]>0x0){return _0x4f0f3c(_0x3066b6[_0xce61('0xf')](0x1f4,_[_0xce61('0x5a')](_0x1f84ea,'message')[_0xce61('0x19')](',\x20')));}var _0x473c9b=_[_0xce61('0x55')](_0xefb221[_0xce61('0x72')],{'uniqueid':_0x3f65fb[_0xce61('0x5b')]});if(_0x473c9b&&_0x473c9b[_0xce61('0x5c')]){return ami[_0xce61('0x15')]({'action':_0xce61('0x73'),'channel':_0x473c9b[_0xce61('0x5c')]})[_0xce61('0x16')](function(_0x58eba3){_0x27714e({'code':0xc8,'message':[_0x3f65fb[_0xce61('0x5b')],_0x58eba3[_0xce61('0x17')]['toLowerCase']()][_0xce61('0x19')]('\x20')});})[_0xce61('0x1e')](function(_0x1ef8e9){_0x4f0f3c(_0x3066b6[_0xce61('0xf')](0x1f5,[_0x3f65fb[_0xce61('0x5b')],_0x1ef8e9['message'][_0xce61('0x60')]()][_0xce61('0x19')]('\x20')));});}else{return _0x4f0f3c(_0x3066b6[_0xce61('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x447f1a){var _0x23642d=this;return new Promise(function(_0x159147,_0x206e19){if(ami['isConnected']()==![]){return _0x206e19(_0x23642d[_0xce61('0xf')](0x1f4,[config[_0xce61('0x10')]['ip'],config[_0xce61('0x10')][_0xce61('0x11')],_0xce61('0x12')][_0xce61('0x19')]('\x20')));}var _0x3c3279=schema(properties[_0xce61('0x74')])['validate'](_0x447f1a);if(_0x3c3279[_0xce61('0x54')]>0x0){return _0x206e19(_0x23642d[_0xce61('0xf')](0x1f4,_[_0xce61('0x5a')](_0x3c3279,'message')[_0xce61('0x19')](',\x20')));}var _0x2e86e4=_[_0xce61('0x55')](_0xefb221[_0xce61('0x72')],{'uniqueid':_0x447f1a['uniqueid']});if(_0x2e86e4&&_0x2e86e4[_0xce61('0x5c')]){return ami['Action']({'action':_0xce61('0x75'),'channel':_0x2e86e4[_0xce61('0x5c')],'exten':_0x447f1a[_0xce61('0x76')],'context':_0x447f1a[_0xce61('0x77')]||_0x2e86e4[_0xce61('0x77')],'priority':0x1})[_0xce61('0x16')](function(_0x54f726){_0x159147({'code':0xc8,'message':[_0x447f1a[_0xce61('0x5b')],_0x54f726[_0xce61('0x17')]['toLowerCase']()]['join']('\x20')});})[_0xce61('0x1e')](function(_0x4b9e63){_0x206e19(_0x23642d[_0xce61('0xf')](0x1f5,[_0x447f1a[_0xce61('0x5b')],_0x4b9e63[_0xce61('0x17')]['toLowerCase']()][_0xce61('0x19')]('\x20')));});}else{return _0x206e19(_0x23642d['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x47ab25){return new Promise(function(_0x56892c,_0x4a31cd){var _0x54f98d=_[_0xce61('0x58')](_0xefb221[_0xce61('0xc')]);_0x56892c({'count':_0x54f98d['length'],'rows':_0x54f98d});});},'Telephones':function(_0x2345d0){return new Promise(function(_0x45dbd9,_0x3ce801){var _0x45b227=_[_0xce61('0x58')](_0xefb221[_0xce61('0x78')]);_0x45dbd9({'count':_0x45b227[_0xce61('0x54')],'rows':_0x45b227});});},'Trunks':function(_0x5cd4b9){return new Promise(function(_0x319366,_0x4e4a52){var _0x29526f=_[_0xce61('0x58')](_0xefb221[_0xce61('0x79')]);_0x319366({'count':_0x29526f[_0xce61('0x54')],'rows':_0x29526f});});},'OutboundChannels':function(_0xe68e10){return new Promise(function(_0x533611,_0x2700c6){var _0x55dcfa=_[_0xce61('0x58')](_0xefb221[_0xce61('0x7a')]);_0x533611({'count':_0x55dcfa['length'],'rows':_0x55dcfa});});},'Outbound':function(_0x174334){return new Promise(function(_0x43956b,_0x2073da){_0x43956b(_0xefb221[_0xce61('0x7b')]);});},'Campaigns':function(_0x51e2e1){return new Promise(function(_0x3fa18d,_0x13bd60){var _0x48b60e=_[_0xce61('0x58')](_0xefb221[_0xce61('0x7c')]);_0x3fa18d({'count':_0x48b60e['length'],'rows':_0x48b60e});});},'VoiceQueuesPreview':function(_0x37bd11){var _0x596386=this;return new Promise(function(_0x3ff97b,_0x1e5c75){_0x2a74bf[_0xce61('0x7d')](_0x37bd11['id'])['then'](function(_0x508986){_0x3ff97b({'code':0xc8,'message':_0x508986[_0xce61('0x17')]});})['catch'](function(_0x3dd7e1){_0x1e5c75(_0x596386[_0xce61('0xf')](0x1f4,_0x3dd7e1[_0xce61('0x17')]));});});},'EventManager':function(_0x4bcd01){var _0x301de1=this;return new Promise(function(_0x55afb7,_0x5c1a22){if(!_0x4bcd01[_0xce61('0x7e')]){return _0x5c1a22(_0x301de1[_0xce61('0xf')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xce61('0x7f')](_0xce61('0x80')+_0x4bcd01[_0xce61('0x7e')],_0x4bcd01[_0xce61('0x17')]);_0x55afb7({'code':0xc8,'message':_0x4bcd01});});},'FaxAccounts':function(_0x543cf0){return new Promise(function(_0x4f2f3d,_0x2c09da){var _0x1c35d8=_[_0xce61('0x58')](_0xefb221[_0xce61('0x81')]);_0x4f2f3d({'count':_0x1c35d8['length'],'rows':_0x1c35d8});});},'SendFax':function(_0x1fd2fd){var _0x1cea16=this;return new Promise(function(_0x5202a5,_0x4f079c){_0x200b9a[_0xce61('0x82')](_0x1fd2fd)[_0xce61('0x16')](function(_0x26b8f1){_0x5202a5({'code':0xc8,'message':_0x26b8f1['message']});})[_0xce61('0x1e')](function(_0x4e5281){_0x4f079c(_0x1cea16[_0xce61('0xf')](0x1f4,_0x4e5281['message']));});});},'CheckAfterSend':function(_0x4a3b6c){var _0x5771e2=this;return new Promise(function(_0x1098ac,_0x1c2dd6){_0x200b9a[_0xce61('0x83')](_0x4a3b6c)[_0xce61('0x16')](function(_0x2c9c56){_0x1098ac({'code':0xc8,'message':_0x2c9c56[_0xce61('0x17')]});})['catch'](function(_0x5646a0){_0x1c2dd6(_0x5771e2[_0xce61('0xf')](0x1f4,_0x5646a0[_0xce61('0x17')]));});});}};var _0x44e045=jayson[_0xce61('0x84')](_0x24528e)['http']();_0x44e045['on'](_0xce61('0xf'),function(_0x1a4b4f){return _0x310203(_0x1a4b4f);});_0x44e045[_0xce61('0x5')](0x232a,_0xce61('0x85'),function(){console[_0xce61('0x86')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x239319(_0xce61('0x87')+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 153948a..6d40411 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 _0x099f=['phone','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','isNil','calleridname','','Unknown','destcalleridname','push','name','format','trigger:%s','action','toLowerCase','merge','lodash','bluebird','ioredis','util','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','data2','xmd-contactid','ListId','data3'];(function(_0x106a51,_0x7b2ebf){var _0x23f2a9=function(_0x4467d3){while(--_0x4467d3){_0x106a51['push'](_0x106a51['shift']());}};_0x23f2a9(++_0x7b2ebf);}(_0x099f,0x180));var _0xf099=function(_0x331b2f,_0xeca73d){_0x331b2f=_0x331b2f-0x0;var _0x1eda76=_0x099f[_0x331b2f];return _0x1eda76;};'use strict';var _=require(_0xf099('0x0'));var BPromise=require(_0xf099('0x1'));var Redis=require(_0xf099('0x2'));var util=require(_0xf099('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xf099('0x4'));var cmContactRpc=require(_0xf099('0x5'));config[_0xf099('0x6')]=_[_0xf099('0x7')](config[_0xf099('0x6')],{'host':_0xf099('0x8'),'port':0x18eb});var io=require(_0xf099('0x9'))(new Redis(config[_0xf099('0x6')]));function emit(_0x43fcdd,_0x552860,_0x792679,_0x45c49c,_0x1f0648){logger[_0xf099('0xa')](_0xf099('0xb'),_0x43fcdd,_0x552860['id'],_0x792679,_0x45c49c,JSON['stringify'](_0x1f0648));io['to'](_0x792679)['emit'](_0x45c49c,_0x1f0648);}exports['exec']=function(_0x3871cb,_0x1af8a5,_0x178c33,_0xfbf230){var _0xec8959,_0x501a5d;var _0x40a6ca={};var _0x4f8e57=Number(_0x178c33['data1']);var _0x2aaa05=_0x178c33[_0xf099('0xc')]?Boolean(Number(_0x178c33['data2'])):![];var _0x31e5a7;if(_0xfbf230[_0xf099('0xd')]){_0x40a6ca['id']=_0xfbf230[_0xf099('0xd')];}if(!_0x40a6ca['id']){_0x40a6ca[_0xf099('0xe')]=_0x4f8e57;_0x31e5a7=_0x178c33[_0xf099('0xf')]&&_0x178c33[_0xf099('0xf')]!=='0'?_0x178c33['data3']['split'](','):[_0xf099('0x10')];_0x40a6ca['$or']=_[_0xf099('0x11')](_0x31e5a7,function(_0x42682b){var _0x49f2ed={};_0x49f2ed[_0x42682b]=_0xfbf230[_0xf099('0x12')]?_0xfbf230[_0xf099('0x13')]:_0xfbf230[_0xf099('0x14')];return _0x49f2ed;});}var _0xce9fac=['id',_0xf099('0x15'),_0xf099('0x16'),_0xf099('0x10'),_0xf099('0x17'),'fax',_0xf099('0xe'),_0xf099('0x18'),_0xf099('0x19'),_0xf099('0x1a')];var _0x384efa=_[_0xf099('0x1b')](_0xce9fac,_0x31e5a7);BPromise[_0xf099('0x1c')]()[_0xf099('0x1d')](cmContactRpc[_0xf099('0x1e')]({'attributes':_0x384efa,'where':_0x40a6ca}))[_0xf099('0x1d')](function(_0x4964aa){_0x501a5d=_0x4964aa;if(!_[_0xf099('0x1f')](_0x501a5d)){if(_0x501a5d[_0xf099('0x20')]===0x1){_0xec8959=_0x501a5d[0x0];logger[_0xf099('0xa')](_0xf099('0x21'),_0xfbf230[_0xf099('0x22')],_0x1af8a5['id'],_0xec8959['id']);}else{logger[_0xf099('0xa')](_0xf099('0x23'),_0xfbf230['uniqueid'],_0x1af8a5['id'],_[_0xf099('0x11')](_0x501a5d,'id')[_0xf099('0x24')](','));}return;}else{logger[_0xf099('0xa')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0xfbf230[_0xf099('0x22')],_0x1af8a5['id']);var _0x4015c0={'ListId':_0x4f8e57};var _0x559172=_0x178c33[_0xf099('0x25')]&&_0x178c33['data4']!=='0'?_0x178c33[_0xf099('0x25')]:_0xf099('0x10');if(_0x2aaa05){logger[_0xf099('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0xfbf230[_0xf099('0x22')],_0x1af8a5['id']);_0x4015c0[_0x559172]=_[_0xf099('0x26')](_0xfbf230['routeId'])?_0xfbf230[_0xf099('0x14')]:_0xfbf230[_0xf099('0x13')];if(_['isNil'](_0xfbf230[_0xf099('0x12')])){_0x4015c0['firstName']=_0xfbf230['calleridname']&&_0xfbf230[_0xf099('0x27')]!==_0xf099('0x28')?_0xfbf230[_0xf099('0x27')]:_0xf099('0x29');}else{_0x4015c0['firstName']=_0xfbf230[_0xf099('0x2a')]&&_0xfbf230[_0xf099('0x2a')]!==_0xf099('0x28')?_0xfbf230[_0xf099('0x2a')]:'Unknown';}return BPromise[_0xf099('0x1c')]()['then'](cmContactRpc['createContact'](_0x4015c0))['then'](function(_0x52049c){_0xec8959=_0x52049c;_0x501a5d[_0xf099('0x2b')](_0x52049c);if(_0xec8959){logger[_0xf099('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0xfbf230[_0xf099('0x22')],_0x1af8a5['id'],_0xec8959['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0xfbf230['uniqueid'],_0x1af8a5['id']);_0x4015c0[_0x559172]=_['isNil'](_0xfbf230[_0xf099('0x12')])?_0xfbf230[_0xf099('0x14')]:_0xfbf230[_0xf099('0x13')];if(_[_0xf099('0x26')](_0xfbf230['routeId'])){_0x4015c0[_0xf099('0x15')]=_0xfbf230[_0xf099('0x27')]&&_0xfbf230[_0xf099('0x27')]!==_0xf099('0x28')?_0xfbf230['calleridname']:_0xf099('0x29');}else{_0x4015c0['firstName']=_0xfbf230['destcalleridname']&&_0xfbf230[_0xf099('0x2a')]!==''?_0xfbf230[_0xf099('0x2a')]:_0xf099('0x29');}_0xec8959=_0x4015c0;_0x501a5d[_0xf099('0x2b')](_0x4015c0);return;}}})[_0xf099('0x1d')](function(){if(_0x3871cb){emit(_0xfbf230['uniqueid'],_0x1af8a5,util['format']('user:%s',_0x3871cb[_0xf099('0x2c')]),util[_0xf099('0x2d')](_0xf099('0x2e'),_0x178c33[_0xf099('0x2f')][_0xf099('0x30')]()),{'evt':_[_0xf099('0x31')](_0xfbf230,{'autoCreate':_0x2aaa05}),'contact':_0xec8959===undefined?{}:_0xec8959,'contacts':_0x501a5d[_0xf099('0x20')]===0x0?undefined:_0x501a5d});}});}; \ No newline at end of file +var _0xc03e=['[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','destcalleridnum','calleridname','Unknown','destcalleridname','','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','trigger:%s','action','merge','bluebird','ioredis','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','emit','data2','xmd-contactid','ListId','split','phone','$or','calleridnum','firstName','lastName','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length'];(function(_0x34df4a,_0x209d10){var _0x145c69=function(_0xb9bcbd){while(--_0xb9bcbd){_0x34df4a['push'](_0x34df4a['shift']());}};_0x145c69(++_0x209d10);}(_0xc03e,0x11a));var _0xec03=function(_0x23292a,_0x1e08ea){_0x23292a=_0x23292a-0x0;var _0x4564f2=_0xc03e[_0x23292a];return _0x4564f2;};'use strict';var _=require('lodash');var BPromise=require(_0xec03('0x0'));var Redis=require(_0xec03('0x1'));var util=require('util');var config=require(_0xec03('0x2'));var logger=require('../../../../config/logger')(_0xec03('0x3'));var cmContactRpc=require(_0xec03('0x4'));config[_0xec03('0x5')]=_[_0xec03('0x6')](config[_0xec03('0x5')],{'host':_0xec03('0x7'),'port':0x18eb});var io=require(_0xec03('0x8'))(new Redis(config[_0xec03('0x5')]));function emit(_0x588329,_0x3b979f,_0x39da06,_0x1f0aad,_0x361e82){logger[_0xec03('0x9')]('[CM][%s][%s]',_0x588329,_0x3b979f['id'],_0x39da06,_0x1f0aad,JSON['stringify'](_0x361e82));io['to'](_0x39da06)[_0xec03('0xa')](_0x1f0aad,_0x361e82);}exports['exec']=function(_0x3d5fd1,_0x57b74f,_0x21e31f,_0x153d72){var _0xa4b7a0,_0xf4a6e3;var _0x4a54c7={};var _0x1d3386=Number(_0x21e31f['data1']);var _0x50c6cd=_0x21e31f[_0xec03('0xb')]?Boolean(Number(_0x21e31f[_0xec03('0xb')])):![];var _0x2589b9;if(_0x153d72[_0xec03('0xc')]){_0x4a54c7['id']=_0x153d72[_0xec03('0xc')];}if(!_0x4a54c7['id']){_0x4a54c7[_0xec03('0xd')]=_0x1d3386;_0x2589b9=_0x21e31f['data3']&&_0x21e31f['data3']!=='0'?_0x21e31f['data3'][_0xec03('0xe')](','):[_0xec03('0xf')];_0x4a54c7[_0xec03('0x10')]=_['map'](_0x2589b9,function(_0x1b9b95){var _0x3aa841={};_0x3aa841[_0x1b9b95]=_0x153d72['routeId']?_0x153d72['destcalleridnum']:_0x153d72[_0xec03('0x11')];return _0x3aa841;});}var _0x5398b9=['id',_0xec03('0x12'),_0xec03('0x13'),_0xec03('0xf'),'mobile',_0xec03('0x14'),_0xec03('0xd'),_0xec03('0x15'),_0xec03('0x16'),_0xec03('0x17')];var _0x346ad6=_[_0xec03('0x18')](_0x5398b9,_0x2589b9);BPromise[_0xec03('0x19')]()[_0xec03('0x1a')](cmContactRpc[_0xec03('0x1b')]({'attributes':_0x346ad6,'where':_0x4a54c7}))[_0xec03('0x1a')](function(_0x3173f0){_0xf4a6e3=_0x3173f0;if(!_[_0xec03('0x1c')](_0xf4a6e3)){if(_0xf4a6e3[_0xec03('0x1d')]===0x1){_0xa4b7a0=_0xf4a6e3[0x0];logger[_0xec03('0x9')](_0xec03('0x1e'),_0x153d72[_0xec03('0x1f')],_0x57b74f['id'],_0xa4b7a0['id']);}else{logger['info'](_0xec03('0x20'),_0x153d72[_0xec03('0x1f')],_0x57b74f['id'],_[_0xec03('0x21')](_0xf4a6e3,'id')[_0xec03('0x22')](','));}return;}else{logger[_0xec03('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x153d72[_0xec03('0x1f')],_0x57b74f['id']);var _0x5959da={'ListId':_0x1d3386};var _0x26ab94=_0x21e31f[_0xec03('0x23')]&&_0x21e31f['data4']!=='0'?_0x21e31f[_0xec03('0x23')]:'phone';if(_0x50c6cd){logger[_0xec03('0x9')](_0xec03('0x24'),_0x153d72[_0xec03('0x1f')],_0x57b74f['id']);_0x5959da[_0x26ab94]=_[_0xec03('0x25')](_0x153d72[_0xec03('0x26')])?_0x153d72[_0xec03('0x11')]:_0x153d72[_0xec03('0x27')];if(_[_0xec03('0x25')](_0x153d72[_0xec03('0x26')])){_0x5959da[_0xec03('0x12')]=_0x153d72['calleridname']&&_0x153d72[_0xec03('0x28')]!==''?_0x153d72['calleridname']:_0xec03('0x29');}else{_0x5959da[_0xec03('0x12')]=_0x153d72[_0xec03('0x2a')]&&_0x153d72[_0xec03('0x2a')]!==_0xec03('0x2b')?_0x153d72['destcalleridname']:_0xec03('0x29');}return BPromise['resolve']()[_0xec03('0x1a')](cmContactRpc[_0xec03('0x2c')](_0x5959da))[_0xec03('0x1a')](function(_0x3eddfc){_0xa4b7a0=_0x3eddfc;_0xf4a6e3['push'](_0x3eddfc);if(_0xa4b7a0){logger[_0xec03('0x9')](_0xec03('0x2d'),_0x153d72[_0xec03('0x1f')],_0x57b74f['id'],_0xa4b7a0['id']);}return;});}else{logger['info'](_0xec03('0x2e'),_0x153d72[_0xec03('0x1f')],_0x57b74f['id']);_0x5959da[_0x26ab94]=_[_0xec03('0x25')](_0x153d72['routeId'])?_0x153d72['calleridnum']:_0x153d72[_0xec03('0x27')];if(_[_0xec03('0x25')](_0x153d72[_0xec03('0x26')])){_0x5959da['firstName']=_0x153d72[_0xec03('0x28')]&&_0x153d72[_0xec03('0x28')]!==_0xec03('0x2b')?_0x153d72['calleridname']:_0xec03('0x29');}else{_0x5959da[_0xec03('0x12')]=_0x153d72[_0xec03('0x2a')]&&_0x153d72['destcalleridname']!==_0xec03('0x2b')?_0x153d72[_0xec03('0x2a')]:_0xec03('0x29');}_0xa4b7a0=_0x5959da;_0xf4a6e3[_0xec03('0x2f')](_0x5959da);return;}}})[_0xec03('0x1a')](function(){if(_0x3d5fd1){emit(_0x153d72[_0xec03('0x1f')],_0x57b74f,util[_0xec03('0x30')]('user:%s',_0x3d5fd1['name']),util[_0xec03('0x30')](_0xec03('0x31'),_0x21e31f[_0xec03('0x32')]['toLowerCase']()),{'evt':_[_0xec03('0x33')](_0x153d72,{'autoCreate':_0x50c6cd}),'contact':_0xa4b7a0===undefined?{}:_0xa4b7a0,'contacts':_0xf4a6e3['length']===0x0?undefined:_0xf4a6e3});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index f7602b5..ff37cf9 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 _0x7f91=['jscripty','trigger:%s','integration','accounts','queue','urlforward','exec','script','search','replace','channel','AllConditions','some','checkConditions','account','chat','ChatWebsiteId','operator','value','AccountId','interaction','event','agent','membername','lastevent','routeId','exports','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','redis','localhost','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','bind','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialconnect','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:outgoingmessage','custom:acceptmessage','emit','info','stringify','clone','motionChannel','undefined','voice','checkTriggers','prototype','interface','hasOwnProperty','status','checkTrigger','merge','length','action','toLowerCase','contactmanager','motionbar','data1','TemplateId','html','data2','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winArguments','format','user:%s','name','trigger:%s:%s'];(function(_0x13d02b,_0x4023a9){var _0x2759a7=function(_0x4c8153){while(--_0x4c8153){_0x13d02b['push'](_0x13d02b['shift']());}};_0x2759a7(++_0x4023a9);}(_0x7f91,0x105));var _0x17f9=function(_0x46599d,_0x335ded){_0x46599d=_0x46599d-0x0;var _0x2e111a=_0x7f91[_0x46599d];return _0x2e111a;};'use strict';var util=require(_0x17f9('0x0'));var _=require(_0x17f9('0x1'));var url=require(_0x17f9('0x2'));var Mustache=require(_0x17f9('0x3'));var Redis=require(_0x17f9('0x4'));var urlforward=require(_0x17f9('0x5'));var integration=require(_0x17f9('0x6'));var cmContact=require(_0x17f9('0x7'));var script=require(_0x17f9('0x8'));var config=require(_0x17f9('0x9'));var logger=require('../../../config/logger')('trigger');var ami=require('../ami');config[_0x17f9('0xa')]=_['defaults'](config[_0x17f9('0xa')],{'host':_0x17f9('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x17f9('0xa')]));var operators={'equals':function(_0x216c54,_0x76cf31){return _0x216c54==_0x76cf31;},'not_equals':function(_0x40c667,_0x98d32b){return _0x40c667!=_0x98d32b;}};var barAndWebActions=[_0x17f9('0xc'),_0x17f9('0x2'),_0x17f9('0xd')];function Trigger(_0x4f4fdf){this['triggers']=_0x4f4fdf[_0x17f9('0xe')];this[_0x17f9('0xf')]=_0x4f4fdf[_0x17f9('0xf')];this[_0x17f9('0x10')]=_0x4f4fdf['voiceQueues'];this[_0x17f9('0x11')]=_0x4f4fdf[_0x17f9('0x11')];this[_0x17f9('0x12')]=_0x4f4fdf[_0x17f9('0x12')];this[_0x17f9('0x13')]=_0x4f4fdf['zendeskAccounts'];this[_0x17f9('0x14')]=_0x4f4fdf['freshdeskAccounts'];this[_0x17f9('0x15')]=_0x4f4fdf[_0x17f9('0x15')];this[_0x17f9('0x16')]=_0x4f4fdf[_0x17f9('0x16')];this['zohoAccounts']=_0x4f4fdf[_0x17f9('0x17')];this[_0x17f9('0x18')]=_0x4f4fdf[_0x17f9('0x18')];this[_0x17f9('0x19')]=_0x4f4fdf[_0x17f9('0x19')];this[_0x17f9('0x1a')]=_0x4f4fdf['servicenowAccounts'];this['dynamics365Accounts']=_0x4f4fdf[_0x17f9('0x1b')];this[_0x17f9('0x1c')]=_0x4f4fdf[_0x17f9('0x1c')];this['accounts']={'zendesk':this[_0x17f9('0x13')],'salesforce':this[_0x17f9('0x15')],'freshdesk':this[_0x17f9('0x14')],'sugarcrm':this[_0x17f9('0x16')],'zoho':this['zohoAccounts'],'desk':this[_0x17f9('0x18')],'vtiger':this['vtigerAccounts'],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x17f9('0x1c')],'servicenow':this['servicenowAccounts']};ami['on']('custom:agentcalled',this['syncCustomEvent'][_0x17f9('0x1d')](this));ami['on']('custom:agentconnect',this[_0x17f9('0x1e')]['bind'](this));ami['on'](_0x17f9('0x1f'),this[_0x17f9('0x1e')]['bind'](this));ami['on'](_0x17f9('0x20'),this[_0x17f9('0x1e')][_0x17f9('0x1d')](this));ami['on']('custom:agentnosuchnumber',this[_0x17f9('0x1e')][_0x17f9('0x1d')](this));ami['on'](_0x17f9('0x21'),this[_0x17f9('0x1e')]['bind'](this));ami['on'](_0x17f9('0x22'),this[_0x17f9('0x1e')][_0x17f9('0x1d')](this));ami['on'](_0x17f9('0x23'),this[_0x17f9('0x1e')]['bind'](this));ami['on'](_0x17f9('0x24'),this[_0x17f9('0x1e')][_0x17f9('0x1d')](this));ami['on'](_0x17f9('0x25'),this[_0x17f9('0x1e')][_0x17f9('0x1d')](this));ami['on'](_0x17f9('0x26'),this[_0x17f9('0x1e')][_0x17f9('0x1d')](this));ami['on'](_0x17f9('0x27'),this[_0x17f9('0x1e')]['bind'](this));ami['on']('custom:dialbegin',this['syncAgentDial'][_0x17f9('0x1d')](this));ami['on'](_0x17f9('0x28'),this[_0x17f9('0x29')]['bind'](this));ami['on'](_0x17f9('0x2a'),this[_0x17f9('0x29')]['bind'](this));ami['on'](_0x17f9('0x2b'),this[_0x17f9('0x1e')][_0x17f9('0x1d')](this));ami['on'](_0x17f9('0x2c'),this['syncCustomEvent'][_0x17f9('0x1d')](this));ami['on']('custom:incomingmessage',this['syncCustomEvent'][_0x17f9('0x1d')](this));ami['on'](_0x17f9('0x2d'),this[_0x17f9('0x1e')][_0x17f9('0x1d')](this));ami['on'](_0x17f9('0x2e'),this['syncCustomEvent'][_0x17f9('0x1d')](this));ami['on']('custom:rejectmessage',this['syncCustomEvent']['bind'](this));}Trigger['prototype'][_0x17f9('0x2f')]=function(_0x36c895,_0x31b803,_0x2a2179){logger[_0x17f9('0x30')](_0x36c895,_0x31b803,JSON[_0x17f9('0x31')](_0x2a2179));io['to'](_0x36c895)[_0x17f9('0x2f')](_0x31b803,_0x2a2179);};Trigger['prototype'][_0x17f9('0x1e')]=function(_0x471ae9){var _0x734dbc=_[_0x17f9('0x32')](_0x471ae9);if(typeof _0x734dbc[_0x17f9('0x33')]===_0x17f9('0x34')){_0x734dbc[_0x17f9('0x33')]=_0x17f9('0x35');}this[_0x17f9('0x36')](_0x734dbc);};Trigger[_0x17f9('0x37')][_0x17f9('0x29')]=function(_0x49b0ec){if(this[_0x17f9('0xf')][_0x49b0ec[_0x17f9('0x38')]]){this[_0x17f9('0x1e')](_0x49b0ec);}};Trigger[_0x17f9('0x37')][_0x17f9('0x36')]=function(_0x49f66d){var _0xb2b197;for(var _0x21d19c in this[_0x17f9('0xe')]){if(this['triggers'][_0x17f9('0x39')](_0x21d19c)){if(this[_0x17f9('0xe')][_0x21d19c][_0x17f9('0x3a')]){_0xb2b197=this[_0x17f9('0x3b')](this[_0x17f9('0xe')][_0x21d19c],_0x49f66d);if(_0xb2b197){_[_0x17f9('0x3c')](_0x49f66d,_0x49f66d['variables']);for(var _0x5b06fb=0x0,_0x2fb75b,_0x247c47,_0x4d8f1f;_0x5b06fb0x0){_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 +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(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x5fc3,0xa8));var _0x35fc=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0x5fc3[_0x2f3794];return _0x1c9fbe;};'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 a8195b7..a8cf1d8 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 _0xa081=['%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','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','inspect','lodash','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','defaults','socket.io-emitter','redis','POST','remoteUri','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','validateEmail','userEmail','email','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','internalemailaddress','userId','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','headers','odata-entityid','substring','lastIndexOf','enduserId','calleridnum','replace','%2b','telephone1','contactid',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','nameField','customField','idField','indexOf','incidents','assign','getString','Subjects','Descriptions','Fields','ticketType','phonecall','/contacts(','callDirection','4.0','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','queue','unmanaged'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa081,0x146));var _0x1a08=function(_0x275b73,_0x5c4387){_0x275b73=_0x275b73-0x0;var _0x2676f2=_0xa081[_0x275b73];return _0x2676f2;};'use strict';var _=require(_0x1a08('0x0'));var BPromise=require('bluebird');var rp=require('request-promise');var util=require('util');var intUtil=require(_0x1a08('0x1'));var md5=require(_0x1a08('0x2'));var Redis=require(_0x1a08('0x3'));var logger=require(_0x1a08('0x4'))(_0x1a08('0x5'));var config=require(_0x1a08('0x6'));config['redis']=_[_0x1a08('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1a08('0x8'))(new Redis(config[_0x1a08('0x9')]));function getAuthToken(_0xcbf95,_0x2d396f,_0x34eded){var _0x39c861={'method':_0x1a08('0xa'),'uri':_0x2d396f,'form':{'client_id':_0xcbf95['clientId'],'resource':_0xcbf95[_0x1a08('0xb')],'username':_0xcbf95[_0x1a08('0xc')],'password':_0xcbf95[_0x1a08('0xd')],'grant_type':_0x1a08('0xd'),'client_secret':_0xcbf95[_0x1a08('0xe')]},'json':!![]};return rp(_0x39c861)[_0x1a08('0xf')](function(_0x11b072){return _0x11b072[_0x1a08('0x10')];})[_0x1a08('0x11')](function(_0x112ad1){logger[_0x1a08('0x12')]('['+[_0x34eded[_0x1a08('0x13')]()]+_0x1a08('0x14'));return _0x112ad1[_0x1a08('0x15')];});}function getUser(_0x57a178,_0x19ed2f,_0x3f61ae,_0x157348,_0xa2b7a9,_0x3df3e7){return new BPromise(function(_0x33ec65,_0x1f3315){return getAuthToken(_0x19ed2f,_0x157348,_0x3df3e7)[_0x1a08('0xf')](function(_0x534126){var _0x376738={'method':_0x1a08('0x16'),'uri':_0xa2b7a9+_0x1a08('0x17'),'headers':{'Authorization':_0x1a08('0x18')+_0x534126,'OData-Version':'4.0'},'json':!![]};return rp(_0x376738);})[_0x1a08('0xf')](function(_0x145ce){var _0x5059c2=_0x145ce[_0x1a08('0x19')];var _0x11dda5=![];var _0xa21ec9=null;if(!_['isNil'](_0x3f61ae)){if(intUtil[_0x1a08('0x1a')](_0x3f61ae['email'])){_0x57a178[_0x1a08('0x1b')]=_0x3f61ae['email'];for(_0xa21ec9=0x0;_0xa21ec9<_0x5059c2['length'];_0xa21ec9++){if(_0x5059c2[_0xa21ec9]['internalemailaddress']===_0x3f61ae[_0x1a08('0x1c')]&&!_0x5059c2[_0xa21ec9][_0x1a08('0x1d')]){_0x11dda5=!![];logger[_0x1a08('0x1e')]('['+[_0x3df3e7[_0x1a08('0x13')]()]+_0x1a08('0x1f')+_0x5059c2[_0xa21ec9][_0x1a08('0x20')]+'!');_0x57a178['userId']=_0x5059c2[_0xa21ec9]['systemuserid'];}}}}if(!_0x11dda5){logger[_0x1a08('0x1e')]('['+[_0x3df3e7[_0x1a08('0x13')]()]+_0x1a08('0x21'));_0x57a178[_0x1a08('0x1b')]=_0x19ed2f[_0x1a08('0xc')];for(_0xa21ec9=0x0;_0xa21ec9<_0x5059c2[_0x1a08('0x22')];_0xa21ec9++){if(_0x5059c2[_0xa21ec9][_0x1a08('0x23')]===_0x19ed2f[_0x1a08('0xc')]){_0x57a178[_0x1a08('0x24')]=_0x5059c2[_0xa21ec9]['systemuserid'];}}}_0x33ec65(_0x57a178);})[_0x1a08('0x11')](function(_0x4eef6c){_0x1f3315(_0x4eef6c[_0x1a08('0x15')]);});});}function createEndUser(_0x12ec84,_0x152c0c,_0x12c28f,_0x4b07b1,_0x38135e,_0x3ea25a){return new BPromise(function(_0x3a595c,_0xb0c02a){return getAuthToken(_0x152c0c,_0x12c28f,_0x3ea25a)[_0x1a08('0xf')](function(_0x2bc3ce){var _0x4280c9=_0x3ea25a[_0x1a08('0x25')]()===_0x1a08('0x26')?_0x38135e[_0x1a08('0x27')]:_0x38135e['calleridnum'];var _0x238c54={'method':_0x1a08('0xa'),'uri':_0x4b07b1+_0x1a08('0x28'),'body':{'telephone1':_0x4280c9,'fullname':_0x4280c9,'firstname':_0x4280c9,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x1a08('0x29')+_0x12ec84[_0x1a08('0x24')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x2bc3ce,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x238c54);})[_0x1a08('0xf')](function(_0x487fdf){var _0x2db64c=_0x487fdf[_0x1a08('0x2a')][_0x1a08('0x2b')];var _0x2ff94b=_0x2db64c[_0x1a08('0x2c')](_0x2db64c['lastIndexOf']('(')+0x1,_0x2db64c[_0x1a08('0x2d')](')'));_0x12ec84[_0x1a08('0x2e')]=_0x2ff94b;_0x3a595c(_0x12ec84);})['catch'](function(_0x481049){_0xb0c02a(_0x481049[_0x1a08('0x15')]);});});}function getEndUser(_0x477d9e,_0x2ee9b1,_0x34326d,_0x65a20d,_0x5bd208,_0xb35049){return new BPromise(function(_0x33fd6c,_0x22866e){var _0x354f5c=_0xb35049['toLowerCase']()===_0x1a08('0x26')?_0x5bd208['destcalleridnum']:_0x5bd208[_0x1a08('0x2f')];return getAuthToken(_0x2ee9b1,_0x34326d,_0xb35049)[_0x1a08('0xf')](function(_0xfe4338){var _0x17216d={'method':_0x1a08('0x16'),'uri':_0x65a20d+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x354f5c[_0x1a08('0x30')]('+',_0x1a08('0x31'))+'\x27','headers':{'Authorization':_0x1a08('0x18')+_0xfe4338,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x17216d);})[_0x1a08('0xf')](function(_0x3c2827){var _0x5baa1b=null;if(_0x3c2827){var _0x20ee4b=_0x3c2827[_0x1a08('0x19')];var _0x17e463=![];for(_0x5baa1b=0x0;_0x5baa1b<_0x20ee4b[_0x1a08('0x22')];_0x5baa1b++){if(_0x20ee4b[_0x5baa1b][_0x1a08('0x32')]===_0x354f5c){_0x17e463=!![];_0x477d9e[_0x1a08('0x2e')]=_0x20ee4b[_0x5baa1b][_0x1a08('0x33')];}}if(_0x17e463){_0x33fd6c(_0x477d9e);}else{return createEndUser(_0x477d9e,_0x2ee9b1,_0x34326d,_0x65a20d,_0x5bd208,_0xb35049)[_0x1a08('0xf')](function(_0x1acc51){logger[_0x1a08('0x1e')]('['+[_0xb35049['toUpperCase']()]+_0x1a08('0x34'),_0x1acc51[_0x1a08('0x2e')]);_0x33fd6c(_0x1acc51);});}}else{return createEndUser(_0x477d9e,_0x2ee9b1,_0x34326d,_0x65a20d,_0x5bd208,_0xb35049)['then'](function(_0x3dd746){logger[_0x1a08('0x1e')]('['+[_0xb35049['toUpperCase']()]+_0x1a08('0x35'),_0x3dd746[_0x1a08('0x2e')]);_0x33fd6c(_0x3dd746);});}});});}function getCustomFields(_0x4410af,_0x5c9bd7,_0x389e2b){var _0x2008de={};if(_0x4410af[_0x1a08('0x22')]>0x0){_[_0x1a08('0x36')](_0x4410af,function(_0x2897c7){if(_[_0x1a08('0x37')]([_0x1a08('0x38'),_0x1a08('0x39')],_0x2897c7['type'])&&_0x2897c7[_0x1a08('0x3a')]&&!_0x2897c7[_0x1a08('0x3b')]){var _0x5d2032=_0x2897c7[_0x1a08('0x3c')][_0x1a08('0x25')]();var _0x21e1e7=_0x5d2032['substring'](0x0,_0x5d2032[_0x1a08('0x3d')]('_'));var _0x2f8913=_0x5d2032[_0x1a08('0x2c')](_0x5d2032['indexOf']('_')+0x1);if(_0x21e1e7===_0x389e2b){_0x2008de[_0x2f8913]=_0x2897c7['content'];}}});}return _0x2008de;}function getTicket(_0x9cf0cc,_0x35206d,_0x33a7e6,_0x286f04,_0x4258c5,_0x22aeba,_0x331447){return new BPromise(function(_0x382e14,_0xf6c648){var _0x4f2dfa;return getAuthToken(_0x35206d,_0x33a7e6,_0x331447)[_0x1a08('0xf')](function(_0x268e52){if(_0x22aeba['ticketType']==='incident'){_0x4f2dfa={'method':_0x1a08('0xa'),'uri':_0x286f04+_0x1a08('0x3e'),'body':Object[_0x1a08('0x3f')]({},{'title':intUtil[_0x1a08('0x40')](_0x22aeba[_0x1a08('0x41')],_0x4258c5,'\x20'),'description':intUtil[_0x1a08('0x40')](_0x22aeba[_0x1a08('0x42')],_0x4258c5,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x9cf0cc[_0x1a08('0x2e')]+')','ownerid@odata.bind':'/systemusers('+_0x9cf0cc[_0x1a08('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x22aeba[_0x1a08('0x43')],_0x4258c5,_0x22aeba[_0x1a08('0x44')])),'headers':{'Authorization':_0x1a08('0x18')+_0x268e52,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x22aeba[_0x1a08('0x44')]===_0x1a08('0x45')){_0x4f2dfa={'method':_0x1a08('0xa'),'uri':_0x286f04+'phonecalls','body':Object[_0x1a08('0x3f')]({},{'subject':intUtil[_0x1a08('0x40')](_0x22aeba['Subjects'],_0x4258c5,'\x20'),'phonenumber':String(_0x4258c5[_0x1a08('0x2f')]),'description':intUtil[_0x1a08('0x40')](_0x22aeba[_0x1a08('0x42')],_0x4258c5,'\x0a'),'regardingobjectid_contact@odata.bind':_0x1a08('0x46')+_0x9cf0cc[_0x1a08('0x2e')]+')','ownerid@odata.bind':'/systemusers('+_0x9cf0cc[_0x1a08('0x24')]+')','directioncode':_0x9cf0cc['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x1a08('0x29')+_0x9cf0cc[_0x1a08('0x24')]+')','participationtypemask':_0x9cf0cc[_0x1a08('0x47')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x1a08('0x46')+_0x9cf0cc[_0x1a08('0x2e')]+')','participationtypemask':_0x9cf0cc[_0x1a08('0x47')]==='queue'?0x1:0x2}]},getCustomFields(_0x22aeba[_0x1a08('0x43')],_0x4258c5,_0x22aeba['ticketType'])),'headers':{'Authorization':_0x1a08('0x18')+_0x268e52,'OData-Version':_0x1a08('0x48')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4f2dfa);})[_0x1a08('0xf')](function(_0x2de71c){var _0x52d348=_0x2de71c[_0x1a08('0x2a')][_0x1a08('0x2b')];var _0x52c3b3=_0x52d348[_0x1a08('0x2c')](_0x52d348[_0x1a08('0x2d')]('(')+0x1,_0x52d348[_0x1a08('0x2d')](')'));_0x9cf0cc['ticketId']=_0x52c3b3;_0x382e14(_0x9cf0cc);})['catch'](function(_0x2bdfb8){_0xf6c648(_0x2bdfb8['message']);});});}function emit(_0x4f7357,_0x1f8883,_0x349fb9,_0x5052b2){var _0x101592={'uri':util[_0x1a08('0x49')](_0x1a08('0x4a'),_0x4f7357,_0x349fb9,_0x5052b2)};io['to'](util['format'](_0x1a08('0x4b'),_0x1f8883))[_0x1a08('0x4c')](_0x1a08('0x4d'),_0x101592);}exports['cs']=function(_0x3da431,_0x10e9ba,_0x532677,_0x26ccd9,_0x52da45,_0x2b186c,_0x4f6ddd,_0x59a273){var _0x31c02b={};_0x2b186c['remoteUri']=intUtil[_0x1a08('0x4e')](_0x2b186c['remoteUri']);_0x2b186c[_0x1a08('0x4f')]=intUtil[_0x1a08('0x4e')](_0x2b186c['serverUrl']);_0x31c02b[_0x1a08('0x47')]=_0x59a273===_0x1a08('0x50')||_0x59a273===_0x1a08('0x51')?_0x1a08('0x50'):'outbound';var _0x57f66a=util[_0x1a08('0x49')](_0x1a08('0x52'),_0x2b186c[_0x1a08('0xb')]);var _0x350863=util[_0x1a08('0x49')]('https://login.microsoftonline.com/%s/oauth2/token',_0x2b186c[_0x1a08('0x53')]);var _0x410ade=util[_0x1a08('0x49')](_0x1a08('0x54'),_0x2b186c[_0x1a08('0x4f')],_0x10e9ba[_0x1a08('0x55')],md5(_0x10e9ba[_0x1a08('0x55')]));if(_0x52da45&&_0x52da45[_0x1a08('0x56')]){logger[_0x1a08('0x1e')](_0x1a08('0x57'),_0x1a08('0x58'));_0x10e9ba[_0x1a08('0x59')]=_0x410ade;}else if(_0x4f6ddd&&_0x4f6ddd[_0x1a08('0x5a')]&&_0x4f6ddd[_0x1a08('0x5a')]!=='none'){logger['info'](_0x1a08('0x5b'),_0x1a08('0x58'));_0x10e9ba['recordingURL']=_0x410ade;}else{_0x10e9ba['recordingURL']='';}return getUser(_0x31c02b,_0x2b186c,_0x26ccd9,_0x350863,_0x57f66a,_0x59a273)[_0x1a08('0xf')](function(_0x298c04){logger[_0x1a08('0x1e')]('['+_0x59a273[_0x1a08('0x13')]()+_0x1a08('0x5c'),_0x298c04[_0x1a08('0x24')]);logger[_0x1a08('0x1e')]('['+_0x59a273[_0x1a08('0x13')]()+_0x1a08('0x5d'),_0x298c04[_0x1a08('0x1b')]);return getEndUser(_0x298c04,_0x2b186c,_0x350863,_0x57f66a,_0x10e9ba,_0x59a273);})[_0x1a08('0xf')](function(_0x3d353f){logger[_0x1a08('0x1e')]('['+_0x59a273[_0x1a08('0x13')]()+_0x1a08('0x5e'),_0x3d353f[_0x1a08('0x2e')]);logger[_0x1a08('0x1e')]('['+_0x59a273[_0x1a08('0x13')]()+_0x1a08('0x5f'),_0x10e9ba['calleridnum']);return getTicket(_0x3d353f,_0x2b186c,_0x350863,_0x57f66a,_0x10e9ba,_0x532677,_0x59a273);})['then'](function(_0x442148){logger[_0x1a08('0x1e')](util[_0x1a08('0x49')]('['+_0x59a273['toUpperCase']()+_0x1a08('0x60'),_0x532677['ticketType'],_0x442148[_0x1a08('0x61')]));logger[_0x1a08('0x1e')](util[_0x1a08('0x49')]('['+_0x59a273[_0x1a08('0x13')]()+_0x1a08('0x62'),_0x59a273));if(_0x59a273!==_0x1a08('0x51')){logger[_0x1a08('0x1e')]('['+_0x59a273[_0x1a08('0x13')]()+']',_0x1a08('0x63'));emit(_0x2b186c['remoteUri'],_0x26ccd9[_0x1a08('0x64')],_0x532677[_0x1a08('0x44')],_0x442148[_0x1a08('0x61')]);}})[_0x1a08('0x11')](function(_0x30f689){logger['error']('['+_0x59a273['toUpperCase']()+']\x20Error\x20running\x20Dynamics365\x20integration',util[_0x1a08('0x65')](_0x30f689,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x66a3=['util','./util','md5','ioredis','../../../../config/logger','dynamics365','defaults','redis','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','error','toUpperCase','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','isNil','validateEmail','userEmail','email','length','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId','internalemailaddress','catch','toLowerCase','destcalleridnum','contacts','/systemusers(','headers','odata-entityid','enduserId','outbound','replace','%2b','Bearer\x20','value','telephone1',']\x20Enduser\x20created!',']\x20Enduser\x20Created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','phonecalls','calleridnum','callDirection','queue','lastIndexOf','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','request-promise'];(function(_0xfaddc9,_0x5c9ad2){var _0x579846=function(_0x44e4ea){while(--_0x44e4ea){_0xfaddc9['push'](_0xfaddc9['shift']());}};_0x579846(++_0x5c9ad2);}(_0x66a3,0x1d9));var _0x366a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x66a3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x366a('0x0'));var BPromise=require('bluebird');var rp=require(_0x366a('0x1'));var util=require(_0x366a('0x2'));var intUtil=require(_0x366a('0x3'));var md5=require(_0x366a('0x4'));var Redis=require(_0x366a('0x5'));var logger=require(_0x366a('0x6'))(_0x366a('0x7'));var config=require('../../../../config/environment');config['redis']=_[_0x366a('0x8')](config[_0x366a('0x9')],{'host':_0x366a('0xa'),'port':0x18eb});var io=require(_0x366a('0xb'))(new Redis(config[_0x366a('0x9')]));function getAuthToken(_0x43b4cb,_0x15d7d7,_0x554862){var _0x2e667c={'method':_0x366a('0xc'),'uri':_0x15d7d7,'form':{'client_id':_0x43b4cb[_0x366a('0xd')],'resource':_0x43b4cb[_0x366a('0xe')],'username':_0x43b4cb[_0x366a('0xf')],'password':_0x43b4cb[_0x366a('0x10')],'grant_type':_0x366a('0x10'),'client_secret':_0x43b4cb['clientSecret']},'json':!![]};return rp(_0x2e667c)['then'](function(_0x23a74a){return _0x23a74a['access_token'];})['catch'](function(_0x20c943){logger[_0x366a('0x11')]('['+[_0x554862[_0x366a('0x12')]()]+']\x20Wrong\x20credentials!');return _0x20c943[_0x366a('0x13')];});}function getUser(_0x4f2d98,_0x4cb0f3,_0x1910ef,_0x44880f,_0x442823,_0x14e4f9){return new BPromise(function(_0x2a691e,_0x290760){return getAuthToken(_0x4cb0f3,_0x44880f,_0x14e4f9)[_0x366a('0x14')](function(_0x56a384){var _0x1fd830={'method':_0x366a('0x15'),'uri':_0x442823+_0x366a('0x16'),'headers':{'Authorization':'Bearer\x20'+_0x56a384,'OData-Version':_0x366a('0x17')},'json':!![]};return rp(_0x1fd830);})[_0x366a('0x14')](function(_0x41c95e){var _0x5ebbdf=_0x41c95e['value'];var _0x156fcd=![];var _0x15fe58=null;if(!_[_0x366a('0x18')](_0x1910ef)){if(intUtil[_0x366a('0x19')](_0x1910ef['email'])){_0x4f2d98[_0x366a('0x1a')]=_0x1910ef[_0x366a('0x1b')];for(_0x15fe58=0x0;_0x15fe58<_0x5ebbdf[_0x366a('0x1c')];_0x15fe58++){if(_0x5ebbdf[_0x15fe58]['internalemailaddress']===_0x1910ef[_0x366a('0x1b')]&&!_0x5ebbdf[_0x15fe58][_0x366a('0x1d')]){_0x156fcd=!![];logger[_0x366a('0x1e')]('['+[_0x14e4f9[_0x366a('0x12')]()]+_0x366a('0x1f')+_0x5ebbdf[_0x15fe58][_0x366a('0x20')]+'!');_0x4f2d98[_0x366a('0x21')]=_0x5ebbdf[_0x15fe58][_0x366a('0x20')];}}}}if(!_0x156fcd){logger[_0x366a('0x1e')]('['+[_0x14e4f9['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x4f2d98[_0x366a('0x1a')]=_0x4cb0f3[_0x366a('0xf')];for(_0x15fe58=0x0;_0x15fe58<_0x5ebbdf['length'];_0x15fe58++){if(_0x5ebbdf[_0x15fe58][_0x366a('0x22')]===_0x4cb0f3[_0x366a('0xf')]){_0x4f2d98[_0x366a('0x21')]=_0x5ebbdf[_0x15fe58]['systemuserid'];}}}_0x2a691e(_0x4f2d98);})[_0x366a('0x23')](function(_0x42fd8c){_0x290760(_0x42fd8c['message']);});});}function createEndUser(_0xfcbe7e,_0x51c402,_0x57a5ae,_0x3cadfa,_0x2e3ca1,_0x273bea){return new BPromise(function(_0xab8177,_0x4e0e6e){return getAuthToken(_0x51c402,_0x57a5ae,_0x273bea)['then'](function(_0xb7a32c){var _0x280c3a=_0x273bea[_0x366a('0x24')]()==='outbound'?_0x2e3ca1[_0x366a('0x25')]:_0x2e3ca1['calleridnum'];var _0x3325f8={'method':_0x366a('0xc'),'uri':_0x3cadfa+_0x366a('0x26'),'body':{'telephone1':_0x280c3a,'fullname':_0x280c3a,'firstname':_0x280c3a,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x366a('0x27')+_0xfcbe7e[_0x366a('0x21')]+')'},'headers':{'Authorization':'Bearer\x20'+_0xb7a32c,'OData-Version':_0x366a('0x17')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x3325f8);})[_0x366a('0x14')](function(_0x2054b4){var _0x674b29=_0x2054b4[_0x366a('0x28')][_0x366a('0x29')];var _0x15002c=_0x674b29['substring'](_0x674b29['lastIndexOf']('(')+0x1,_0x674b29['lastIndexOf'](')'));_0xfcbe7e[_0x366a('0x2a')]=_0x15002c;_0xab8177(_0xfcbe7e);})['catch'](function(_0x16956c){_0x4e0e6e(_0x16956c[_0x366a('0x13')]);});});}function getEndUser(_0x2bb8b8,_0x4348bb,_0x1e57d0,_0xc152ff,_0x5051eb,_0x8e782c){return new BPromise(function(_0x41819b,_0x11817f){var _0x1fc132=_0x8e782c[_0x366a('0x24')]()===_0x366a('0x2b')?_0x5051eb['destcalleridnum']:_0x5051eb['calleridnum'];return getAuthToken(_0x4348bb,_0x1e57d0,_0x8e782c)[_0x366a('0x14')](function(_0x3dbc41){var _0x3354f7={'method':_0x366a('0x15'),'uri':_0xc152ff+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x1fc132[_0x366a('0x2c')]('+',_0x366a('0x2d'))+'\x27','headers':{'Authorization':_0x366a('0x2e')+_0x3dbc41,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3354f7);})[_0x366a('0x14')](function(_0x1b1b6e){var _0x5d5d56=null;if(_0x1b1b6e){var _0x53bf5b=_0x1b1b6e[_0x366a('0x2f')];var _0x3d646e=![];for(_0x5d5d56=0x0;_0x5d5d56<_0x53bf5b[_0x366a('0x1c')];_0x5d5d56++){if(_0x53bf5b[_0x5d5d56][_0x366a('0x30')]===_0x1fc132){_0x3d646e=!![];_0x2bb8b8[_0x366a('0x2a')]=_0x53bf5b[_0x5d5d56]['contactid'];}}if(_0x3d646e){_0x41819b(_0x2bb8b8);}else{return createEndUser(_0x2bb8b8,_0x4348bb,_0x1e57d0,_0xc152ff,_0x5051eb,_0x8e782c)['then'](function(_0x13617c){logger[_0x366a('0x1e')]('['+[_0x8e782c[_0x366a('0x12')]()]+_0x366a('0x31'),_0x13617c[_0x366a('0x2a')]);_0x41819b(_0x13617c);});}}else{return createEndUser(_0x2bb8b8,_0x4348bb,_0x1e57d0,_0xc152ff,_0x5051eb,_0x8e782c)[_0x366a('0x14')](function(_0x10ad7a){logger['info']('['+[_0x8e782c['toUpperCase']()]+_0x366a('0x32'),_0x10ad7a[_0x366a('0x2a')]);_0x41819b(_0x10ad7a);});}});});}function getCustomFields(_0x50ae14,_0x3545b6,_0x18193f){var _0x594696={};if(_0x50ae14[_0x366a('0x1c')]>0x0){_[_0x366a('0x33')](_0x50ae14,function(_0xd193ee){if(_[_0x366a('0x34')]([_0x366a('0x35'),_0x366a('0x36')],_0xd193ee[_0x366a('0x37')])&&_0xd193ee[_0x366a('0x38')]&&!_0xd193ee[_0x366a('0x39')]){var _0xa26352=_0xd193ee[_0x366a('0x3a')][_0x366a('0x24')]();var _0x4e8043=_0xa26352['substring'](0x0,_0xa26352['indexOf']('_'));var _0x3451ed=_0xa26352['substring'](_0xa26352[_0x366a('0x3b')]('_')+0x1);if(_0x4e8043===_0x18193f){_0x594696[_0x3451ed]=_0xd193ee['content'];}}});}return _0x594696;}function getTicket(_0x52e734,_0x23489b,_0x48877a,_0x5c4d38,_0x411673,_0x3f8378,_0x2f9992){return new BPromise(function(_0x3434b5,_0x771254){var _0x46c179;return getAuthToken(_0x23489b,_0x48877a,_0x2f9992)[_0x366a('0x14')](function(_0x59c391){if(_0x3f8378[_0x366a('0x3c')]===_0x366a('0x3d')){_0x46c179={'method':_0x366a('0xc'),'uri':_0x5c4d38+_0x366a('0x3e'),'body':Object[_0x366a('0x3f')]({},{'title':intUtil[_0x366a('0x40')](_0x3f8378[_0x366a('0x41')],_0x411673,'\x20'),'description':intUtil[_0x366a('0x40')](_0x3f8378[_0x366a('0x42')],_0x411673,'\x0a'),'customerid_contact@odata.bind':_0x366a('0x43')+_0x52e734[_0x366a('0x2a')]+')','ownerid@odata.bind':_0x366a('0x27')+_0x52e734['userId']+')','caseorigincode':'1'},getCustomFields(_0x3f8378['Fields'],_0x411673,_0x3f8378[_0x366a('0x3c')])),'headers':{'Authorization':_0x366a('0x2e')+_0x59c391,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3f8378['ticketType']==='phonecall'){_0x46c179={'method':_0x366a('0xc'),'uri':_0x5c4d38+_0x366a('0x44'),'body':Object[_0x366a('0x3f')]({},{'subject':intUtil[_0x366a('0x40')](_0x3f8378[_0x366a('0x41')],_0x411673,'\x20'),'phonenumber':String(_0x411673[_0x366a('0x45')]),'description':intUtil['getString'](_0x3f8378[_0x366a('0x42')],_0x411673,'\x0a'),'regardingobjectid_contact@odata.bind':_0x366a('0x43')+_0x52e734[_0x366a('0x2a')]+')','ownerid@odata.bind':_0x366a('0x27')+_0x52e734[_0x366a('0x21')]+')','directioncode':_0x52e734[_0x366a('0x46')]===_0x366a('0x47')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x366a('0x27')+_0x52e734['userId']+')','participationtypemask':_0x52e734['callDirection']===_0x366a('0x47')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x52e734[_0x366a('0x2a')]+')','participationtypemask':_0x52e734[_0x366a('0x46')]===_0x366a('0x47')?0x1:0x2}]},getCustomFields(_0x3f8378['Fields'],_0x411673,_0x3f8378['ticketType'])),'headers':{'Authorization':_0x366a('0x2e')+_0x59c391,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x46c179);})['then'](function(_0xcf1934){var _0x2d4f7d=_0xcf1934[_0x366a('0x28')]['odata-entityid'];var _0x13cf4c=_0x2d4f7d['substring'](_0x2d4f7d[_0x366a('0x48')]('(')+0x1,_0x2d4f7d[_0x366a('0x48')](')'));_0x52e734[_0x366a('0x49')]=_0x13cf4c;_0x3434b5(_0x52e734);})[_0x366a('0x23')](function(_0x281f9b){_0x771254(_0x281f9b[_0x366a('0x13')]);});});}function emit(_0x40f869,_0xef8d7c,_0x209da5,_0x2a86ba){var _0x25ea67={'uri':util['format'](_0x366a('0x4a'),_0x40f869,_0x209da5,_0x2a86ba)};io['to'](util[_0x366a('0x4b')](_0x366a('0x4c'),_0xef8d7c))[_0x366a('0x4d')](_0x366a('0x4e'),_0x25ea67);}exports['cs']=function(_0x19e133,_0x66df1e,_0x147c0e,_0xa7640f,_0x2351c1,_0x21d443,_0x488ac3,_0x3e5003){var _0x1bb0b7={};_0x21d443[_0x366a('0xe')]=intUtil[_0x366a('0x4f')](_0x21d443[_0x366a('0xe')]);_0x21d443[_0x366a('0x50')]=intUtil['stripTrailingSlash'](_0x21d443[_0x366a('0x50')]);_0x1bb0b7[_0x366a('0x46')]=_0x3e5003===_0x366a('0x47')||_0x3e5003===_0x366a('0x51')?'queue':_0x366a('0x2b');var _0x25c66e=util[_0x366a('0x4b')](_0x366a('0x52'),_0x21d443[_0x366a('0xe')]);var _0x47bc1f=util[_0x366a('0x4b')](_0x366a('0x53'),_0x21d443['tenantId']);var _0x5d7fb7=util[_0x366a('0x4b')](_0x366a('0x54'),_0x21d443[_0x366a('0x50')],_0x66df1e[_0x366a('0x55')],md5(_0x66df1e[_0x366a('0x55')]));if(_0x2351c1&&_0x2351c1['monitor_format']){logger[_0x366a('0x1e')]('[QUEUE]',_0x366a('0x56'));_0x66df1e[_0x366a('0x57')]=_0x5d7fb7;}else if(_0x488ac3&&_0x488ac3['recordingFormat']&&_0x488ac3['recordingFormat']!=='none'){logger[_0x366a('0x1e')](_0x366a('0x58'),_0x366a('0x56'));_0x66df1e[_0x366a('0x57')]=_0x5d7fb7;}else{_0x66df1e[_0x366a('0x57')]='';}return getUser(_0x1bb0b7,_0x21d443,_0xa7640f,_0x47bc1f,_0x25c66e,_0x3e5003)[_0x366a('0x14')](function(_0x3d74cf){logger[_0x366a('0x1e')]('['+_0x3e5003[_0x366a('0x12')]()+_0x366a('0x59'),_0x3d74cf[_0x366a('0x21')]);logger[_0x366a('0x1e')]('['+_0x3e5003[_0x366a('0x12')]()+']\x20The\x20User\x20email\x20is:',_0x3d74cf[_0x366a('0x1a')]);return getEndUser(_0x3d74cf,_0x21d443,_0x47bc1f,_0x25c66e,_0x66df1e,_0x3e5003);})[_0x366a('0x14')](function(_0x55902b){logger[_0x366a('0x1e')]('['+_0x3e5003['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x55902b[_0x366a('0x2a')]);logger['info']('['+_0x3e5003[_0x366a('0x12')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x66df1e['calleridnum']);return getTicket(_0x55902b,_0x21d443,_0x47bc1f,_0x25c66e,_0x66df1e,_0x147c0e,_0x3e5003);})[_0x366a('0x14')](function(_0x39a2a9){logger['info'](util['format']('['+_0x3e5003[_0x366a('0x12')]()+_0x366a('0x5a'),_0x147c0e['ticketType'],_0x39a2a9[_0x366a('0x49')]));logger[_0x366a('0x1e')](util['format']('['+_0x3e5003[_0x366a('0x12')]()+_0x366a('0x5b'),_0x3e5003));if(_0x3e5003!==_0x366a('0x51')){logger[_0x366a('0x1e')]('['+_0x3e5003['toUpperCase']()+']',_0x366a('0x5c'));emit(_0x21d443[_0x366a('0xe')],_0xa7640f[_0x366a('0x5d')],_0x147c0e['ticketType'],_0x39a2a9['ticketId']);}})[_0x366a('0x23')](function(_0x104da1){logger[_0x366a('0x11')]('['+_0x3e5003[_0x366a('0x12')]()+_0x366a('0x5e'),util['inspect'](_0x104da1,{'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 11f20d3..e3dffb9 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 _0x996c=['toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/helpdesk/tickets/%d','catch','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','name','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','POST','then','validateEmail','%s/api/v2/agents','remoteUri','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','forEach','includes','type','idField','customField','push','content','variable','variableName','customVariable','Variable'];(function(_0xa388a2,_0x40bde6){var _0x7ce7f6=function(_0x5a242a){while(--_0x5a242a){_0xa388a2['push'](_0xa388a2['shift']());}};_0x7ce7f6(++_0x40bde6);}(_0x996c,0x1e3));var _0xc996=function(_0x4014e5,_0x125e6a){_0x4014e5=_0x4014e5-0x0;var _0x4ee8b7=_0x996c[_0x4014e5];return _0x4ee8b7;};'use strict';var _=require(_0xc996('0x0'));var rp=require(_0xc996('0x1'));var md5=require(_0xc996('0x2'));var util=require(_0xc996('0x3'));var Redis=require('ioredis');var intUtil=require(_0xc996('0x4'));var config=require(_0xc996('0x5'));var logger=require('../../../../config/logger')('freshdesk');config[_0xc996('0x6')]=_[_0xc996('0x7')](config[_0xc996('0x6')],{'host':_0xc996('0x8'),'port':0x18eb});var io=require(_0xc996('0x9'))(new Redis(config['redis']));var headers={'Content-Type':_0xc996('0xa'),'Accept':'application/json'};function emit(_0x1702c5,_0x15e441,_0x306c4e){io['to'](_0x1702c5)[_0xc996('0xb')](_0x15e441,_0x306c4e);}function getTicket(_0x4eaede,_0x1210b7,_0x58465e,_0x661cc6,_0x450db3){logger[_0xc996('0xc')](_0xc996('0xd'));var _0x2fdbec=_[_0xc996('0xe')]({'responder_id':_0x1210b7['id'],'requester_id':_0x58465e['id'],'name':util[_0xc996('0xf')](_0xc996('0x10'),_0x450db3[_0xc996('0x11')]),'phone':_0x450db3[_0xc996('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xc996('0x13')](_0x661cc6[_0xc996('0x14')],_0x450db3,'\x20'),'description':intUtil[_0xc996('0x13')](_0x661cc6[_0xc996('0x15')],_0x450db3,_0xc996('0x16')),'tags':getTags(_0x661cc6['Tags'],_0xc996('0x17'))},getCustomFields(_0x661cc6['Fields'],_0x450db3));_0x2fdbec['custom_fields']=_[_0xc996('0x18')](_[_0xc996('0x19')](_0x2fdbec[_0xc996('0x1a')],'id'),_0xc996('0x1b'));return request({'uri':util[_0xc996('0xf')](_0xc996('0x1c'),_0x4eaede['remoteUri']),'method':_0xc996('0x1d'),'body':_0x2fdbec})[_0xc996('0x1e')](function(_0x352189){logger[_0xc996('0xc')]('Ticket\x20created!');return _0x352189;});}function getUser(_0x45707b,_0x14b630){if(intUtil[_0xc996('0x1f')](_0x14b630)){return request({'uri':util['format'](_0xc996('0x20'),_0x45707b[_0xc996('0x21')]),'qs':{'email':_0x14b630}})[_0xc996('0x1e')](function(_0x385798){if(_0x385798['length']){logger[_0xc996('0xc')](_0xc996('0x22'));return _[_0xc996('0x23')](_0x385798,function(_0x28dccd){return _0x28dccd['contact']['email']===_0x14b630;});}else{logger[_0xc996('0xc')](_0xc996('0x24'));return request({'uri':util[_0xc996('0xf')](_0xc996('0x25'),_0x45707b[_0xc996('0x21')])})['then'](function(_0x1c5d2b){logger['info']('Admin\x20account\x20selected.');return _0x1c5d2b;});}});}else{logger[_0xc996('0xc')](_0xc996('0x26'));return request({'uri':util['format'](_0xc996('0x25'),_0x45707b[_0xc996('0x21')])})[_0xc996('0x1e')](function(_0x1110ef){logger['info'](_0xc996('0x27'));return _0x1110ef;});}}function getEndUser(_0x555b20,_0x14872d,_0x346c10){logger[_0xc996('0xc')](_0xc996('0x28'),_0x346c10);return request({'uri':util[_0xc996('0xf')](_0xc996('0x29'),_0x555b20['remoteUri']),'qs':{'phone':_0x346c10}})[_0xc996('0x1e')](function(_0x1ebfbf){if(_0x1ebfbf[_0xc996('0x2a')]){logger['info']('Enduser\x20found!');return _[_0xc996('0x23')](_0x1ebfbf,{'phone':_0x346c10});}else{logger[_0xc996('0xc')](_0xc996('0x2b'));return request({'uri':util[_0xc996('0xf')](_0xc996('0x29'),_0x555b20[_0xc996('0x21')]),'method':_0xc996('0x1d'),'body':{'name':_0x14872d,'phone':_0x346c10}})['then'](function(_0x232a4e){logger[_0xc996('0xc')](_0xc996('0x2c'));return _0x232a4e;});}});}function getAuth(_0x46f81e){return util[_0xc996('0xf')](_0xc996('0x2d'),new Buffer(_0x46f81e[_0xc996('0x2e')]+':X')[_0xc996('0x2f')](_0xc996('0x30')));}function request(_0x256cf3){logger[_0xc996('0x31')](_0xc996('0x32'),JSON[_0xc996('0x33')](_0x256cf3));return rp(_[_0xc996('0x7')](_0x256cf3,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5aa446,_0x2b3dad){var _0x44d56c=[];if(_0x5aa446&&_0x5aa446[_0xc996('0x2a')]>0x0){_0x44d56c=_['map'](_0x5aa446,_0x2b3dad);}return _0x44d56c;}function getCustomFields(_0x10c002,_0x50baee){var _0x523e04=[];var _0x50da23={'custom_fields':[]};if(_0x10c002[_0xc996('0x2a')]>0x0){_[_0xc996('0x34')](_0x10c002,function(_0x1d1c89){if(_[_0xc996('0x35')](['string','picklist'],_0x1d1c89[_0xc996('0x36')])&&_0x1d1c89['nameField']&&!_0x1d1c89['customField']){_0x50da23[_0x1d1c89['nameField']['toLowerCase']()]=_0x1d1c89['content'][_0xc996('0x2f')]();}else if(_[_0xc996('0x35')](['string','picklist'],_0x1d1c89[_0xc996('0x36')])&&_0x1d1c89[_0xc996('0x37')]&&_0x1d1c89[_0xc996('0x38')]){_0x50da23[_0xc996('0x1a')][_0xc996('0x39')]({'id':_0x1d1c89[_0xc996('0x37')],'value':_0x1d1c89[_0xc996('0x3a')][_0xc996('0x2f')]()});}else if(_0x1d1c89['type']===_0xc996('0x3b')&&_0x1d1c89[_0xc996('0x3c')]&&_0x1d1c89[_0xc996('0x37')]&&_0x1d1c89[_0xc996('0x38')]){_0x50baee[_0x1d1c89[_0xc996('0x3c')]]&&_0x50da23[_0xc996('0x1a')][_0xc996('0x39')]({'id':_0x1d1c89[_0xc996('0x37')],'value':_0x50baee[_0x1d1c89[_0xc996('0x3c')]]['toString']()});}else if(_0x1d1c89[_0xc996('0x36')]===_0xc996('0x3d')&&_0x1d1c89[_0xc996('0x3e')]&&_0x1d1c89[_0xc996('0x3e')][_0xc996('0x17')]&&_0x1d1c89['idField']&&_0x1d1c89['customField']){_0x50baee[_0x1d1c89[_0xc996('0x3e')]['name'][_0xc996('0x3f')]()]&&_0x50da23[_0xc996('0x1a')][_0xc996('0x39')]({'id':_0x1d1c89['idField'],'value':_0x50baee[_0x1d1c89[_0xc996('0x3e')]['name'][_0xc996('0x3f')]()][_0xc996('0x2f')]()});}});}return _0x50da23;}exports[_0xc996('0x40')]=function(_0x42c299,_0x5cea89,_0x4d5aff,_0x12f9d9,_0x361a39,_0x338b70){var _0x407383,_0x4decf5;_0x338b70['remoteUri']=intUtil[_0xc996('0x41')](_0x338b70[_0xc996('0x21')]);_0x338b70[_0xc996('0x42')]=intUtil[_0xc996('0x41')](_0x338b70['serverUrl']);if(_0x361a39&&_0x361a39[_0xc996('0x43')]){logger[_0xc996('0xc')](_0xc996('0x44'),'Recording\x20is\x20enabled!');_0x5cea89[_0xc996('0x45')]=util[_0xc996('0xf')](_0xc996('0x46'),_0x338b70[_0xc996('0x42')],_0x5cea89[_0xc996('0x47')],md5(_0x5cea89[_0xc996('0x47')]));}else{_0x5cea89[_0xc996('0x45')]='';}headers[_0xc996('0x48')]=getAuth(_0x338b70);return getUser(_0x338b70,_0x12f9d9['email'])[_0xc996('0x1e')](function(_0x7f7d9f){_0x407383=_0x7f7d9f;logger[_0xc996('0xc')](_0xc996('0x49'),_0x407383['id']);return getEndUser(_0x338b70,_0x5cea89[_0xc996('0x11')],_0x5cea89[_0xc996('0x12')]);})['then'](function(_0x2cb347){_0x4decf5=_0x2cb347;logger[_0xc996('0xc')](_0xc996('0x4a'),_0x4decf5['id']);return getTicket(_0x338b70,_0x407383,_0x4decf5,_0x4d5aff,_0x5cea89);})[_0xc996('0x1e')](function(_0x4fbb63){if(_0x4fbb63&&_0x4fbb63['id']){logger['info']('Ticket\x20created!');logger['info'](_0xc996('0x4b'),_0x4fbb63['id']);logger[_0xc996('0xc')](_0xc996('0x44'),_0xc996('0x4c'));emit(util['format'](_0xc996('0x4d'),_0x12f9d9[_0xc996('0x17')]),_0xc996('0x4e'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x338b70[_0xc996('0x21')],_0x4fbb63['id'])});}})['catch'](function(_0x4ddcbc){logger[_0xc996('0x4f')]('[QUEUE]',JSON[_0xc996('0x33')](_0x4ddcbc));});};exports[_0xc996('0x50')]=function(_0x1de571,_0x24c4e6,_0x423e5a,_0x3b8cb3,_0x6671ed,_0x14b0cf,_0x51579d){var _0x4a68f0,_0x36d7e8;_0x14b0cf['remoteUri']=intUtil[_0xc996('0x41')](_0x14b0cf[_0xc996('0x21')]);_0x14b0cf['serverUrl']=intUtil[_0xc996('0x41')](_0x14b0cf[_0xc996('0x42')]);if(_0x51579d&&_0x51579d[_0xc996('0x51')]&&_0x51579d['recordingFormat']!=='none'){logger[_0xc996('0xc')](_0xc996('0x52'),_0xc996('0x53'));_0x24c4e6['recordingURL']=util[_0xc996('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x14b0cf[_0xc996('0x42')],_0x24c4e6[_0xc996('0x47')],md5(_0x24c4e6[_0xc996('0x47')]));}headers['Authorization']=getAuth(_0x14b0cf);return getUser(_0x14b0cf,_0x3b8cb3['email'])[_0xc996('0x1e')](function(_0x29a3ee){_0x4a68f0=_0x29a3ee;logger[_0xc996('0xc')]('The\x20User\x20ID\x20is:',_0x4a68f0['id']);return getEndUser(_0x14b0cf,_0x24c4e6[_0xc996('0x54')],_0x24c4e6[_0xc996('0x55')]);})[_0xc996('0x1e')](function(_0x3a81a0){_0x36d7e8=_0x3a81a0;logger[_0xc996('0xc')](_0xc996('0x4a'),_0x36d7e8['id']);return getTicket(_0x14b0cf,_0x4a68f0,_0x36d7e8,_0x423e5a,_0x24c4e6);})['then'](function(_0x205783){if(_0x205783&&_0x205783['id']){logger[_0xc996('0xc')](_0xc996('0x56'));logger[_0xc996('0xc')](_0xc996('0x4b'),_0x205783['id']);logger[_0xc996('0xc')]('[OUTBOUND]',_0xc996('0x4c'));emit(util[_0xc996('0xf')]('user:%s',_0x3b8cb3[_0xc996('0x17')]),_0xc996('0x4e'),{'uri':util['format'](_0xc996('0x57'),_0x14b0cf[_0xc996('0x21')],_0x205783['id'])});}})[_0xc996('0x58')](function(_0x9d33c1){logger[_0xc996('0x4f')](_0xc996('0x52'),JSON[_0xc996('0x33')](_0x9d33c1));});};exports['unmanaged']=function(_0x2a5ad4,_0x14a4d5,_0x53798a,_0x1f7333,_0x22f59a,_0x49624a){var _0x471034,_0xd6f113;_0x49624a[_0xc996('0x21')]=intUtil[_0xc996('0x41')](_0x49624a[_0xc996('0x21')]);_0x49624a['serverUrl']=intUtil['stripTrailingSlash'](_0x49624a[_0xc996('0x42')]);if(_0x22f59a&&_0x22f59a[_0xc996('0x43')]){logger['info']('['+_0x14a4d5[_0xc996('0x59')][_0xc996('0x5a')]()+']',_0xc996('0x53'));_0x14a4d5[_0xc996('0x45')]=util[_0xc996('0xf')](_0xc996('0x46'),_0x49624a[_0xc996('0x42')],_0x14a4d5[_0xc996('0x47')],md5(_0x14a4d5['uniqueid']));}else{_0x14a4d5[_0xc996('0x45')]='';}headers[_0xc996('0x48')]=getAuth(_0x49624a);return getUser(_0x49624a,'')[_0xc996('0x1e')](function(_0x113622){_0x471034=_0x113622;logger['info'](_0xc996('0x49'),_0x471034['id']);return getEndUser(_0x49624a,_0x14a4d5[_0xc996('0x11')],_0x14a4d5['calleridnum']);})[_0xc996('0x1e')](function(_0x446c25){_0xd6f113=_0x446c25;logger[_0xc996('0xc')](_0xc996('0x4a'),_0xd6f113['id']);return getTicket(_0x49624a,_0x471034,_0xd6f113,_0x53798a,_0x14a4d5);})[_0xc996('0x1e')](function(_0x3164eb){if(_0x3164eb){logger['info'](_0xc996('0x56'));logger[_0xc996('0xc')](_0xc996('0x4b'),_0x3164eb['id']);}})[_0xc996('0x58')](function(_0x563632){logger['error']('['+_0x14a4d5['lastevent'][_0xc996('0x5a')]()+']',JSON[_0xc996('0x33')](_0x563632));});}; \ No newline at end of file +var _0xb523=['emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]','stringify','defaults','map','forEach','includes','string','picklist','type','customField','toLowerCase','content','idField','push','variable','variableName','Variable','name','queue','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','user:%s','monitor_format','toUpperCase','lastevent','request-promise','md5','util','ioredis','./util','freshdesk','redis','localhost','socket.io-emitter','application/json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb523,0x1c2));var _0x3b52=function(_0x1a7cb3,_0x2e4178){_0x1a7cb3=_0x1a7cb3-0x0;var _0x233ef7=_0xb523[_0x1a7cb3];return _0x233ef7;};'use strict';var _=require('lodash');var rp=require(_0x3b52('0x0'));var md5=require(_0x3b52('0x1'));var util=require(_0x3b52('0x2'));var Redis=require(_0x3b52('0x3'));var intUtil=require(_0x3b52('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x3b52('0x5'));config[_0x3b52('0x6')]=_['defaults'](config[_0x3b52('0x6')],{'host':_0x3b52('0x7'),'port':0x18eb});var io=require(_0x3b52('0x8'))(new Redis(config[_0x3b52('0x6')]));var headers={'Content-Type':_0x3b52('0x9'),'Accept':_0x3b52('0x9')};function emit(_0x2d64a0,_0x277295,_0xbad33b){io['to'](_0x2d64a0)[_0x3b52('0xa')](_0x277295,_0xbad33b);}function getTicket(_0x59e968,_0x25122e,_0x33673b,_0x54ec10,_0x2d90e4){logger[_0x3b52('0xb')](_0x3b52('0xc'));var _0x1c4713=_[_0x3b52('0xd')]({'responder_id':_0x25122e['id'],'requester_id':_0x33673b['id'],'name':util[_0x3b52('0xe')](_0x3b52('0xf'),_0x2d90e4[_0x3b52('0x10')]),'phone':_0x2d90e4[_0x3b52('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x54ec10['Subjects'],_0x2d90e4,'\x20'),'description':intUtil[_0x3b52('0x12')](_0x54ec10[_0x3b52('0x13')],_0x2d90e4,_0x3b52('0x14')),'tags':getTags(_0x54ec10['Tags'],'name')},getCustomFields(_0x54ec10[_0x3b52('0x15')],_0x2d90e4));_0x1c4713[_0x3b52('0x16')]=_[_0x3b52('0x17')](_[_0x3b52('0x18')](_0x1c4713['custom_fields'],'id'),_0x3b52('0x19'));return request({'uri':util[_0x3b52('0xe')](_0x3b52('0x1a'),_0x59e968[_0x3b52('0x1b')]),'method':_0x3b52('0x1c'),'body':_0x1c4713})[_0x3b52('0x1d')](function(_0x362b61){logger[_0x3b52('0xb')](_0x3b52('0x1e'));return _0x362b61;});}function getUser(_0x50ddc7,_0x1d1e43){if(intUtil[_0x3b52('0x1f')](_0x1d1e43)){return request({'uri':util[_0x3b52('0xe')](_0x3b52('0x20'),_0x50ddc7[_0x3b52('0x1b')]),'qs':{'email':_0x1d1e43}})[_0x3b52('0x1d')](function(_0x5798dd){if(_0x5798dd[_0x3b52('0x21')]){logger[_0x3b52('0xb')](_0x3b52('0x22'));return _['find'](_0x5798dd,function(_0x34ae8a){return _0x34ae8a['contact'][_0x3b52('0x23')]===_0x1d1e43;});}else{logger['info'](_0x3b52('0x24'));return request({'uri':util[_0x3b52('0xe')](_0x3b52('0x25'),_0x50ddc7[_0x3b52('0x1b')])})[_0x3b52('0x1d')](function(_0x45a7ad){logger[_0x3b52('0xb')](_0x3b52('0x26'));return _0x45a7ad;});}});}else{logger[_0x3b52('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x3b52('0xe')](_0x3b52('0x25'),_0x50ddc7[_0x3b52('0x1b')])})['then'](function(_0x2cb9b1){logger[_0x3b52('0xb')](_0x3b52('0x26'));return _0x2cb9b1;});}}function getEndUser(_0xb2d536,_0x4d352e,_0x5cee51){logger[_0x3b52('0xb')](_0x3b52('0x27'),_0x5cee51);return request({'uri':util[_0x3b52('0xe')](_0x3b52('0x28'),_0xb2d536[_0x3b52('0x1b')]),'qs':{'phone':_0x5cee51}})[_0x3b52('0x1d')](function(_0xc64cf5){if(_0xc64cf5['length']){logger[_0x3b52('0xb')](_0x3b52('0x29'));return _[_0x3b52('0x2a')](_0xc64cf5,{'phone':_0x5cee51});}else{logger[_0x3b52('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x3b52('0xe')](_0x3b52('0x28'),_0xb2d536[_0x3b52('0x1b')]),'method':_0x3b52('0x1c'),'body':{'name':_0x4d352e,'phone':_0x5cee51}})[_0x3b52('0x1d')](function(_0x19b4b4){logger[_0x3b52('0xb')](_0x3b52('0x2b'));return _0x19b4b4;});}});}function getAuth(_0x2a2a53){return util[_0x3b52('0xe')]('Basic\x20%s',new Buffer(_0x2a2a53[_0x3b52('0x2c')]+':X')[_0x3b52('0x2d')](_0x3b52('0x2e')));}function request(_0x37ed5a){logger[_0x3b52('0x2f')](_0x3b52('0x30'),JSON[_0x3b52('0x31')](_0x37ed5a));return rp(_[_0x3b52('0x32')](_0x37ed5a,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x404ad8,_0xc91749){var _0xdfce4f=[];if(_0x404ad8&&_0x404ad8[_0x3b52('0x21')]>0x0){_0xdfce4f=_[_0x3b52('0x33')](_0x404ad8,_0xc91749);}return _0xdfce4f;}function getCustomFields(_0x2aa150,_0x2560df){var _0x6b2594=[];var _0x1e154e={'custom_fields':[]};if(_0x2aa150['length']>0x0){_[_0x3b52('0x34')](_0x2aa150,function(_0x5067fc){if(_[_0x3b52('0x35')]([_0x3b52('0x36'),_0x3b52('0x37')],_0x5067fc[_0x3b52('0x38')])&&_0x5067fc['nameField']&&!_0x5067fc[_0x3b52('0x39')]){_0x1e154e[_0x5067fc['nameField'][_0x3b52('0x3a')]()]=_0x5067fc[_0x3b52('0x3b')][_0x3b52('0x2d')]();}else if(_[_0x3b52('0x35')]([_0x3b52('0x36'),_0x3b52('0x37')],_0x5067fc['type'])&&_0x5067fc[_0x3b52('0x3c')]&&_0x5067fc[_0x3b52('0x39')]){_0x1e154e['custom_fields'][_0x3b52('0x3d')]({'id':_0x5067fc['idField'],'value':_0x5067fc[_0x3b52('0x3b')][_0x3b52('0x2d')]()});}else if(_0x5067fc[_0x3b52('0x38')]===_0x3b52('0x3e')&&_0x5067fc[_0x3b52('0x3f')]&&_0x5067fc[_0x3b52('0x3c')]&&_0x5067fc['customField']){_0x2560df[_0x5067fc[_0x3b52('0x3f')]]&&_0x1e154e[_0x3b52('0x16')][_0x3b52('0x3d')]({'id':_0x5067fc[_0x3b52('0x3c')],'value':_0x2560df[_0x5067fc['variableName']][_0x3b52('0x2d')]()});}else if(_0x5067fc['type']==='customVariable'&&_0x5067fc[_0x3b52('0x40')]&&_0x5067fc['Variable'][_0x3b52('0x41')]&&_0x5067fc['idField']&&_0x5067fc['customField']){_0x2560df[_0x5067fc[_0x3b52('0x40')]['name']['toLowerCase']()]&&_0x1e154e[_0x3b52('0x16')][_0x3b52('0x3d')]({'id':_0x5067fc[_0x3b52('0x3c')],'value':_0x2560df[_0x5067fc['Variable']['name'][_0x3b52('0x3a')]()][_0x3b52('0x2d')]()});}});}return _0x1e154e;}exports[_0x3b52('0x42')]=function(_0x51259e,_0x3794ff,_0x3bcd98,_0x163b02,_0xa11fe6,_0x33c4fc){var _0x31777e,_0x10ca7d;_0x33c4fc[_0x3b52('0x1b')]=intUtil['stripTrailingSlash'](_0x33c4fc[_0x3b52('0x1b')]);_0x33c4fc['serverUrl']=intUtil['stripTrailingSlash'](_0x33c4fc[_0x3b52('0x43')]);if(_0xa11fe6&&_0xa11fe6['monitor_format']){logger['info'](_0x3b52('0x44'),_0x3b52('0x45'));_0x3794ff[_0x3b52('0x46')]=util[_0x3b52('0xe')](_0x3b52('0x47'),_0x33c4fc[_0x3b52('0x43')],_0x3794ff['uniqueid'],md5(_0x3794ff[_0x3b52('0x48')]));}else{_0x3794ff['recordingURL']='';}headers[_0x3b52('0x49')]=getAuth(_0x33c4fc);return getUser(_0x33c4fc,_0x163b02[_0x3b52('0x23')])['then'](function(_0xe598dd){_0x31777e=_0xe598dd;logger[_0x3b52('0xb')](_0x3b52('0x4a'),_0x31777e['id']);return getEndUser(_0x33c4fc,_0x3794ff[_0x3b52('0x10')],_0x3794ff['calleridnum']);})['then'](function(_0x5af2e9){_0x10ca7d=_0x5af2e9;logger['info'](_0x3b52('0x4b'),_0x10ca7d['id']);return getTicket(_0x33c4fc,_0x31777e,_0x10ca7d,_0x3bcd98,_0x3794ff);})['then'](function(_0x1c3ca9){if(_0x1c3ca9&&_0x1c3ca9['id']){logger[_0x3b52('0xb')](_0x3b52('0x1e'));logger[_0x3b52('0xb')](_0x3b52('0x4c'),_0x1c3ca9['id']);logger[_0x3b52('0xb')](_0x3b52('0x44'),_0x3b52('0x4d'));emit(util[_0x3b52('0xe')]('user:%s',_0x163b02[_0x3b52('0x41')]),_0x3b52('0x4e'),{'uri':util['format'](_0x3b52('0x4f'),_0x33c4fc['remoteUri'],_0x1c3ca9['id'])});}})[_0x3b52('0x50')](function(_0x78a860){logger[_0x3b52('0x51')]('[QUEUE]',JSON[_0x3b52('0x31')](_0x78a860));});};exports[_0x3b52('0x52')]=function(_0x32df60,_0x5098fb,_0xca4dfe,_0x16690d,_0x5bd5ee,_0x5ea66c,_0x34d613){var _0x336b16,_0x5115e1;_0x5ea66c['remoteUri']=intUtil[_0x3b52('0x53')](_0x5ea66c[_0x3b52('0x1b')]);_0x5ea66c['serverUrl']=intUtil[_0x3b52('0x53')](_0x5ea66c[_0x3b52('0x43')]);if(_0x34d613&&_0x34d613[_0x3b52('0x54')]&&_0x34d613['recordingFormat']!==_0x3b52('0x55')){logger[_0x3b52('0xb')](_0x3b52('0x56'),_0x3b52('0x45'));_0x5098fb[_0x3b52('0x46')]=util[_0x3b52('0xe')](_0x3b52('0x47'),_0x5ea66c[_0x3b52('0x43')],_0x5098fb[_0x3b52('0x48')],md5(_0x5098fb[_0x3b52('0x48')]));}headers['Authorization']=getAuth(_0x5ea66c);return getUser(_0x5ea66c,_0x16690d[_0x3b52('0x23')])[_0x3b52('0x1d')](function(_0x11cd19){_0x336b16=_0x11cd19;logger[_0x3b52('0xb')](_0x3b52('0x4a'),_0x336b16['id']);return getEndUser(_0x5ea66c,_0x5098fb[_0x3b52('0x57')],_0x5098fb['destcalleridnum']);})[_0x3b52('0x1d')](function(_0x27900d){_0x5115e1=_0x27900d;logger[_0x3b52('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5115e1['id']);return getTicket(_0x5ea66c,_0x336b16,_0x5115e1,_0xca4dfe,_0x5098fb);})['then'](function(_0xcabdb){if(_0xcabdb&&_0xcabdb['id']){logger[_0x3b52('0xb')](_0x3b52('0x1e'));logger[_0x3b52('0xb')]('The\x20Ticket\x20ID\x20is:',_0xcabdb['id']);logger[_0x3b52('0xb')](_0x3b52('0x56'),_0x3b52('0x4d'));emit(util[_0x3b52('0xe')](_0x3b52('0x58'),_0x16690d['name']),_0x3b52('0x4e'),{'uri':util[_0x3b52('0xe')](_0x3b52('0x4f'),_0x5ea66c[_0x3b52('0x1b')],_0xcabdb['id'])});}})[_0x3b52('0x50')](function(_0x4f2424){logger[_0x3b52('0x51')](_0x3b52('0x56'),JSON[_0x3b52('0x31')](_0x4f2424));});};exports['unmanaged']=function(_0x2611b5,_0x42f20f,_0x155595,_0x3e8313,_0x5df00e,_0x335399){var _0x1bbb4a,_0x5b272c;_0x335399['remoteUri']=intUtil[_0x3b52('0x53')](_0x335399[_0x3b52('0x1b')]);_0x335399[_0x3b52('0x43')]=intUtil[_0x3b52('0x53')](_0x335399[_0x3b52('0x43')]);if(_0x5df00e&&_0x5df00e[_0x3b52('0x59')]){logger[_0x3b52('0xb')]('['+_0x42f20f['lastevent'][_0x3b52('0x5a')]()+']',_0x3b52('0x45'));_0x42f20f[_0x3b52('0x46')]=util[_0x3b52('0xe')](_0x3b52('0x47'),_0x335399['serverUrl'],_0x42f20f[_0x3b52('0x48')],md5(_0x42f20f['uniqueid']));}else{_0x42f20f[_0x3b52('0x46')]='';}headers[_0x3b52('0x49')]=getAuth(_0x335399);return getUser(_0x335399,'')[_0x3b52('0x1d')](function(_0x20af87){_0x1bbb4a=_0x20af87;logger[_0x3b52('0xb')]('The\x20User\x20ID\x20is:',_0x1bbb4a['id']);return getEndUser(_0x335399,_0x42f20f[_0x3b52('0x10')],_0x42f20f[_0x3b52('0x11')]);})[_0x3b52('0x1d')](function(_0x5accc6){_0x5b272c=_0x5accc6;logger[_0x3b52('0xb')]('The\x20Enduser\x20ID\x20is:',_0x5b272c['id']);return getTicket(_0x335399,_0x1bbb4a,_0x5b272c,_0x155595,_0x42f20f);})[_0x3b52('0x1d')](function(_0x4d35eb){if(_0x4d35eb){logger[_0x3b52('0xb')](_0x3b52('0x1e'));logger[_0x3b52('0xb')]('The\x20Ticket\x20ID\x20is:',_0x4d35eb['id']);}})[_0x3b52('0x50')](function(_0x19a3a4){logger[_0x3b52('0x51')]('['+_0x42f20f[_0x3b52('0x5b')]['toUpperCase']()+']',JSON[_0x3b52('0x31')](_0x19a3a4));});}; \ 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 b0103ac..84e0555 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 _0x1c1d=['&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20created:','POST','/api/contacts','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','YYYY-MM-DDTHH:mm:ss','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','moment','ioredis','./util','redis','defaults','localhost','socket.io-emitter','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','GET','/api/selector/owners','Getting\x20user\x20list','agentEmail','userEmail','userId','Admin\x20selected','/api/lookup?q='];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x1c1d,0x1d8));var _0xd1c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c1d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd1c1('0x0'));var rp=require(_0xd1c1('0x1'));var md5=require(_0xd1c1('0x2'));var util=require('util');var moment=require(_0xd1c1('0x3'));var Promise=require('bluebird');var Redis=require(_0xd1c1('0x4'));var intUtil=require(_0xd1c1('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshsales');config[_0xd1c1('0x6')]=_[_0xd1c1('0x7')](config['redis'],{'host':_0xd1c1('0x8'),'port':0x18eb});var io=require(_0xd1c1('0x9'))(new Redis(config[_0xd1c1('0x6')]));function getAdminId(_0x425d9f,_0xad26b0,_0x5a23e5,_0x11b335){return new Promise(function(_0x4fa887,_0x39d8fd){var _0x1c3a28=![];var _0x48faaf={'method':'GET','uri':_0x11b335+'/api/selector/owners','json':!![]};_0x48faaf['headers']=_0x5a23e5;logger[_0xd1c1('0xa')](_0xd1c1('0xb'));return rp(_0x48faaf)[_0xd1c1('0xc')](function(_0x17380d){if(_0x17380d){var _0x25396f=_0x17380d[_0xd1c1('0xd')];var _0x189f04=null;for(_0x189f04=0x0;_0x189f04<_0x25396f[_0xd1c1('0xe')];_0x189f04++){if(_0x25396f[_0x189f04][_0xd1c1('0xf')]===_0x425d9f[_0xd1c1('0x10')]){_0x425d9f[_0xd1c1('0x11')]=_0x25396f[_0x189f04]['id'];_0x1c3a28=!![];}}if(_0x1c3a28){logger['info'](_0xd1c1('0x12'),_0x425d9f[_0xd1c1('0x11')]);_0x4fa887(_0x425d9f);}else{_0x39d8fd({'statusCode':0x194,'message':_0xd1c1('0x13')});}}else{_0x39d8fd({'statusCode':0x194,'message':_0xd1c1('0x13')});}})[_0xd1c1('0x14')](function(_0x3a7879){logger[_0xd1c1('0x15')]('['+[_0xad26b0[_0xd1c1('0x16')]()]+']',_0x3a7879[_0xd1c1('0x17')]);_0x39d8fd(_0x3a7879);});});}function getUser(_0x2e78ad,_0x232b7e,_0x2ede71){return function(_0x55e193){return new Promise(function(_0x228f56,_0x43dc13){var _0x2a8ce6={'method':_0xd1c1('0x18'),'uri':_0x2ede71+_0xd1c1('0x19'),'json':!![]};_0x2a8ce6['headers']=_0x232b7e;logger['info'](_0xd1c1('0x1a'));return rp(_0x2a8ce6)[_0xd1c1('0xc')](function(_0x6fe88){if(_0x6fe88){var _0x221a2d=_0x6fe88[_0xd1c1('0xd')];var _0x2942f5=![];var _0x4032e8=null;if(_0x55e193[_0xd1c1('0x1b')]!==null){logger[_0xd1c1('0xa')]('Getting\x20user\x20with\x20email',_0x55e193[_0xd1c1('0x1b')]);_0x55e193[_0xd1c1('0x1c')]=_0x55e193[_0xd1c1('0x1b')];for(_0x4032e8=0x0;_0x4032e8<_0x221a2d[_0xd1c1('0xe')];_0x4032e8++){if(_0x221a2d[_0x4032e8]['email']===_0x55e193[_0xd1c1('0x1b')]){_0x2942f5=!![];_0x55e193[_0xd1c1('0x1d')]=_0x221a2d[_0x4032e8]['id'];logger[_0xd1c1('0xa')]('User\x20found:',_0x55e193[_0xd1c1('0x1d')]);}}}if(!_0x2942f5){logger[_0xd1c1('0xa')](_0xd1c1('0x1e'));_0x55e193[_0xd1c1('0x1c')]=_0x55e193[_0xd1c1('0x10')];_0x55e193[_0xd1c1('0x1d')]=_0x55e193[_0xd1c1('0x11')];_0x2942f5=!![];}if(_0x2942f5){_0x228f56(_0x55e193);}else{_0x43dc13({'statusCode':0x194,'message':_0xd1c1('0x13')});}}else{_0x43dc13({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xd1c1('0x14')](function(_0x3e1a7f){logger['error']('['+[_0x2e78ad[_0xd1c1('0x16')]()]+']',_0x3e1a7f[_0xd1c1('0x17')]);_0x43dc13(_0x3e1a7f);});});};}function searchContact(_0x2b21cc,_0x36d24f,_0x7560e,_0x237dcd){return new Promise(function(_0x185531,_0x4892a4){var _0x3694da={'method':_0xd1c1('0x18'),'headers':_0x36d24f,'uri':_0x2b21cc+_0xd1c1('0x1f')+_0x237dcd+_0xd1c1('0x20')+_0x7560e+_0xd1c1('0x21'),'json':!![]};rp(_0x3694da)['then'](function(_0x528938){var _0x5d9a1d=_[_0xd1c1('0x22')](_0x528938[_0xd1c1('0x23')][_0xd1c1('0x23')],[_0x7560e,_0x237dcd]);_0x185531(_0x5d9a1d);})[_0xd1c1('0x14')](function(_0x3e8af0){_0x4892a4(_0x3e8af0);});});}function getEndUser(_0x2831ef,_0x152d3c,_0x1112af){return function(_0x5c8647){return new Promise(function(_0x5642e0,_0x2fde3c){logger[_0xd1c1('0xa')](util[_0xd1c1('0x24')](_0xd1c1('0x25'),_0x5c8647[_0xd1c1('0x26')]));searchContact(_0x1112af,_0x152d3c,_0xd1c1('0x27'),_0x5c8647['contactNumber'])['then'](function(_0x45751d){if(_0x45751d){_0x5c8647[_0xd1c1('0x28')]=_0x45751d['id'];logger[_0xd1c1('0xa')]('Contact\x20found\x20mobile_number:',_0x5c8647[_0xd1c1('0x28')]);return _0x5642e0(_0x5c8647);}searchContact(_0x1112af,_0x152d3c,'work_number',_0x5c8647[_0xd1c1('0x26')])[_0xd1c1('0xc')](function(_0x17c991){if(_0x17c991){_0x5c8647[_0xd1c1('0x28')]=_0x17c991['id'];logger[_0xd1c1('0xa')]('Contact\x20found\x20work_number:',_0x5c8647['endUserId']);return _0x5642e0(_0x5c8647);}createEndUser(_0x5c8647,_0x2831ef,_0x152d3c,_0x1112af)[_0xd1c1('0xc')](function(_0x501eb3){logger[_0xd1c1('0xa')](_0xd1c1('0x29'),_0x501eb3['endUserId']);return _0x5642e0(_0x501eb3);});});})[_0xd1c1('0x14')](function(_0x39100e){_0x2fde3c(_0x39100e);});});};}function createEndUser(_0x179b97,_0x2b546e,_0x4c2739,_0x5c53e1){return new Promise(function(_0x59d92c,_0x1dbb81){var _0x193e1a=moment();var _0x527c19={'method':_0xd1c1('0x2a'),'uri':_0x5c53e1+_0xd1c1('0x2b'),'body':{'contact':{'last_name':_0x179b97[_0xd1c1('0x26')],'work_number':_0x179b97[_0xd1c1('0x26')],'mobile_number':_0x179b97[_0xd1c1('0x26')],'owner_id':_0x179b97['userId'],'created_at':_0x193e1a[_0xd1c1('0x24')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x527c19[_0xd1c1('0x2c')]=_0x4c2739;logger[_0xd1c1('0xa')](_0xd1c1('0x2d'));return rp(_0x527c19)[_0xd1c1('0xc')](function(_0x3208eb){_0x179b97[_0xd1c1('0x28')]=_0x3208eb[_0xd1c1('0x2e')]['id'];_0x59d92c(_0x179b97);})[_0xd1c1('0x14')](function(_0x63fdd4){logger[_0xd1c1('0x15')]('['+[_0x2b546e[_0xd1c1('0x16')]()]+']',_0x63fdd4[_0xd1c1('0x17')]);_0x1dbb81(_0x63fdd4['message']);});});}function getTicket(_0x47ac3e,_0x12154d,_0x1274d3,_0x102413,_0x102b32){return function(_0x10c9d6){logger['info'](_0xd1c1('0x2f'));return new Promise(function(_0x45333a,_0x571403){var _0x5bd949=moment();var _0x3a28e3={'method':_0xd1c1('0x2a'),'uri':_0x1274d3+_0xd1c1('0x30'),'body':{'title':intUtil[_0xd1c1('0x31')](_0x102413[_0xd1c1('0x32')],_0x102b32,'\x20'),'description':intUtil[_0xd1c1('0x31')](_0x102413[_0xd1c1('0x33')],_0x102b32,'\x0a'),'owner_id':_0x10c9d6[_0xd1c1('0x1d')],'creater_id':_0x10c9d6['adminId'],'targetable_id':_0x10c9d6[_0xd1c1('0x28')],'targetable_type':'Contact','created_at':_0x5bd949[_0xd1c1('0x24')](_0xd1c1('0x34')),'due_date':_0x5bd949[_0xd1c1('0x35')](0x1e,'m')[_0xd1c1('0x24')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x3a28e3[_0xd1c1('0x2c')]=_0x12154d;return rp(_0x3a28e3)[_0xd1c1('0xc')](function(_0x56db12){_0x10c9d6[_0xd1c1('0x36')]=_0x56db12[_0xd1c1('0x37')]['id'];logger['info'](_0xd1c1('0x38'),_0x10c9d6[_0xd1c1('0x36')]);_0x45333a(_0x10c9d6);})[_0xd1c1('0x14')](function(_0xd7ee79){logger[_0xd1c1('0x15')]('['+[_0x47ac3e['toUpperCase']()]+']',_0xd7ee79['message']);_0x571403(_0xd7ee79[_0xd1c1('0x17')]);});});};}function emit(_0x1eb2a5,_0x395abc,_0x20084e){var _0x1707f2={'uri':_0x1eb2a5+_0xd1c1('0x39')+_0x20084e};io['to'](util[_0xd1c1('0x24')](_0xd1c1('0x3a'),_0x395abc))[_0xd1c1('0x3b')]('trigger:browser:url',_0x1707f2);}exports['cs']=function(_0xb23b9,_0x412338,_0xa8a727,_0x4c7be4,_0x247054,_0x55a82d,_0x3a6cec,_0xc7f4da){var _0x4413d1={};var _0x5d23d6={'Authorization':_0xd1c1('0x3c')+_0x55a82d[_0xd1c1('0x3d')]};_0x55a82d[_0xd1c1('0x3e')]=intUtil[_0xd1c1('0x3f')](_0x55a82d[_0xd1c1('0x3e')]);_0x55a82d['serverUrl']=intUtil[_0xd1c1('0x3f')](_0x55a82d[_0xd1c1('0x40')]);var _0x34f2c6=_0x55a82d[_0xd1c1('0x3e')];_0x4413d1[_0xd1c1('0x10')]=_0x55a82d[_0xd1c1('0x41')];_0x4413d1['contactNumber']=_0xc7f4da['toLowerCase']()===_0xd1c1('0x42')?_0x412338['destcalleridnum']:_0x412338[_0xd1c1('0x43')];_0x4413d1[_0xd1c1('0x44')]=_0xc7f4da===_0xd1c1('0x45')||_0xc7f4da===_0xd1c1('0x46')?_0xd1c1('0x45'):'outbound';if(_0x4c7be4){_0x4413d1[_0xd1c1('0x1b')]=_0x4c7be4[_0xd1c1('0xf')];}var _0x354784=util[_0xd1c1('0x24')](_0xd1c1('0x47'),_0x55a82d['serverUrl'],_0x412338['uniqueid'],md5(_0x412338[_0xd1c1('0x48')]));if(_0x247054&&_0x247054[_0xd1c1('0x49')]){logger['info'](_0xd1c1('0x4a'),_0xd1c1('0x4b'));_0x412338[_0xd1c1('0x4c')]=_0x354784;}else if(_0x3a6cec&&_0x3a6cec[_0xd1c1('0x4d')]&&_0x3a6cec[_0xd1c1('0x4d')]!==_0xd1c1('0x4e')){logger[_0xd1c1('0xa')](_0xd1c1('0x4f'),_0xd1c1('0x4b'));_0x412338[_0xd1c1('0x4c')]=_0x354784;}else{_0x412338[_0xd1c1('0x4c')]='';}return getAdminId(_0x4413d1,_0xc7f4da,_0x5d23d6,_0x34f2c6)['then'](getUser(_0xc7f4da,_0x5d23d6,_0x34f2c6))[_0xd1c1('0xc')](getEndUser(_0xc7f4da,_0x5d23d6,_0x34f2c6))[_0xd1c1('0xc')](getTicket(_0xc7f4da,_0x5d23d6,_0x34f2c6,_0xa8a727,_0x412338))[_0xd1c1('0xc')](function(_0x27f6b0){logger['info'](util[_0xd1c1('0x24')](_0xd1c1('0x50'),_0x27f6b0[_0xd1c1('0x36')]));if(_0xc7f4da!==_0xd1c1('0x46')){logger[_0xd1c1('0xa')]('['+[_0xc7f4da[_0xd1c1('0x16')]()]+']',_0xd1c1('0x51'));emit(_0x34f2c6,_0x4c7be4['name'],_0x27f6b0[_0xd1c1('0x28')]);}})[_0xd1c1('0x14')](function(_0x30a2ea){logger['error']('['+[_0xc7f4da[_0xd1c1('0x16')]()]+_0xd1c1('0x52'),util[_0xd1c1('0x53')](_0x30a2ea,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb2a2=['find','contacts','format','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','error','Creating\x20new\x20task','getString','Descriptions','add','ticketId','task','Task\x20created:','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','lodash','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','then','users','length','email','adminId','info','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','agentEmail','userEmail','userId','Admin\x20selected','adminEmail','&f='];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0xb2a2,0x174));var _0x2b2a=function(_0x3ad936,_0x5bc74d){_0x3ad936=_0x3ad936-0x0;var _0x21072c=_0xb2a2[_0x3ad936];return _0x21072c;};'use strict';var _=require(_0x2b2a('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x2b2a('0x1'));var moment=require(_0x2b2a('0x2'));var Promise=require(_0x2b2a('0x3'));var Redis=require(_0x2b2a('0x4'));var intUtil=require(_0x2b2a('0x5'));var config=require(_0x2b2a('0x6'));var logger=require(_0x2b2a('0x7'))(_0x2b2a('0x8'));config['redis']=_[_0x2b2a('0x9')](config[_0x2b2a('0xa')],{'host':_0x2b2a('0xb'),'port':0x18eb});var io=require(_0x2b2a('0xc'))(new Redis(config[_0x2b2a('0xa')]));function getAdminId(_0x1e64d2,_0x13d0ae,_0x16a713,_0x2efc9b){return new Promise(function(_0x360ed8,_0x218c68){var _0x894fc1=![];var _0x36698c={'method':_0x2b2a('0xd'),'uri':_0x2efc9b+_0x2b2a('0xe'),'json':!![]};_0x36698c[_0x2b2a('0xf')]=_0x16a713;logger['info']('Getting\x20admin\x20information');return rp(_0x36698c)[_0x2b2a('0x10')](function(_0x16c869){if(_0x16c869){var _0x10aa45=_0x16c869[_0x2b2a('0x11')];var _0x3083fc=null;for(_0x3083fc=0x0;_0x3083fc<_0x10aa45[_0x2b2a('0x12')];_0x3083fc++){if(_0x10aa45[_0x3083fc][_0x2b2a('0x13')]===_0x1e64d2['adminEmail']){_0x1e64d2[_0x2b2a('0x14')]=_0x10aa45[_0x3083fc]['id'];_0x894fc1=!![];}}if(_0x894fc1){logger[_0x2b2a('0x15')]('Admin\x20found:',_0x1e64d2[_0x2b2a('0x14')]);_0x360ed8(_0x1e64d2);}else{_0x218c68({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x218c68({'statusCode':0x194,'message':_0x2b2a('0x16')});}})[_0x2b2a('0x17')](function(_0x20ebc0){logger['error']('['+[_0x13d0ae[_0x2b2a('0x18')]()]+']',_0x20ebc0[_0x2b2a('0x19')]);_0x218c68(_0x20ebc0);});});}function getUser(_0x1a4abf,_0x3b072a,_0x23ea58){return function(_0x32ce33){return new Promise(function(_0x2f9989,_0x37649d){var _0x110ca5={'method':_0x2b2a('0xd'),'uri':_0x23ea58+_0x2b2a('0xe'),'json':!![]};_0x110ca5[_0x2b2a('0xf')]=_0x3b072a;logger['info'](_0x2b2a('0x1a'));return rp(_0x110ca5)[_0x2b2a('0x10')](function(_0x315208){if(_0x315208){var _0x757b85=_0x315208[_0x2b2a('0x11')];var _0x11f50b=![];var _0x1acc5d=null;if(_0x32ce33['agentEmail']!==null){logger['info']('Getting\x20user\x20with\x20email',_0x32ce33[_0x2b2a('0x1b')]);_0x32ce33[_0x2b2a('0x1c')]=_0x32ce33[_0x2b2a('0x1b')];for(_0x1acc5d=0x0;_0x1acc5d<_0x757b85[_0x2b2a('0x12')];_0x1acc5d++){if(_0x757b85[_0x1acc5d][_0x2b2a('0x13')]===_0x32ce33[_0x2b2a('0x1b')]){_0x11f50b=!![];_0x32ce33[_0x2b2a('0x1d')]=_0x757b85[_0x1acc5d]['id'];logger[_0x2b2a('0x15')]('User\x20found:',_0x32ce33[_0x2b2a('0x1d')]);}}}if(!_0x11f50b){logger[_0x2b2a('0x15')](_0x2b2a('0x1e'));_0x32ce33[_0x2b2a('0x1c')]=_0x32ce33[_0x2b2a('0x1f')];_0x32ce33[_0x2b2a('0x1d')]=_0x32ce33['adminId'];_0x11f50b=!![];}if(_0x11f50b){_0x2f9989(_0x32ce33);}else{_0x37649d({'statusCode':0x194,'message':_0x2b2a('0x16')});}}else{_0x37649d({'statusCode':0x194,'message':_0x2b2a('0x16')});}})[_0x2b2a('0x17')](function(_0x587658){logger['error']('['+[_0x1a4abf[_0x2b2a('0x18')]()]+']',_0x587658['message']);_0x37649d(_0x587658);});});};}function searchContact(_0x3ced26,_0x3d3763,_0x9bbc30,_0x4438d9){return new Promise(function(_0x26c557,_0x4082c8){var _0x2d2057={'method':_0x2b2a('0xd'),'headers':_0x3d3763,'uri':_0x3ced26+'/api/lookup?q='+_0x4438d9+_0x2b2a('0x20')+_0x9bbc30+'&entities=contact','json':!![]};rp(_0x2d2057)[_0x2b2a('0x10')](function(_0x3d3d12){var _0x3b48e6=_[_0x2b2a('0x21')](_0x3d3d12[_0x2b2a('0x22')][_0x2b2a('0x22')],[_0x9bbc30,_0x4438d9]);_0x26c557(_0x3b48e6);})[_0x2b2a('0x17')](function(_0x51a85a){_0x4082c8(_0x51a85a);});});}function getEndUser(_0x104e58,_0x3fdb60,_0x269af5){return function(_0x2b57cf){return new Promise(function(_0x4a83c8,_0x1dd7c4){logger[_0x2b2a('0x15')](util[_0x2b2a('0x23')]('Searching\x20contact\x20with\x20phone\x20%s',_0x2b57cf[_0x2b2a('0x24')]));searchContact(_0x269af5,_0x3fdb60,_0x2b2a('0x25'),_0x2b57cf[_0x2b2a('0x24')])[_0x2b2a('0x10')](function(_0x1afcd6){if(_0x1afcd6){_0x2b57cf['endUserId']=_0x1afcd6['id'];logger[_0x2b2a('0x15')](_0x2b2a('0x26'),_0x2b57cf[_0x2b2a('0x27')]);return _0x4a83c8(_0x2b57cf);}searchContact(_0x269af5,_0x3fdb60,'work_number',_0x2b57cf[_0x2b2a('0x24')])[_0x2b2a('0x10')](function(_0x2c6ec4){if(_0x2c6ec4){_0x2b57cf[_0x2b2a('0x27')]=_0x2c6ec4['id'];logger['info'](_0x2b2a('0x28'),_0x2b57cf[_0x2b2a('0x27')]);return _0x4a83c8(_0x2b57cf);}createEndUser(_0x2b57cf,_0x104e58,_0x3fdb60,_0x269af5)['then'](function(_0x4fed1e){logger[_0x2b2a('0x15')](_0x2b2a('0x29'),_0x4fed1e[_0x2b2a('0x27')]);return _0x4a83c8(_0x4fed1e);});});})['catch'](function(_0x4f2015){_0x1dd7c4(_0x4f2015);});});};}function createEndUser(_0x249cd5,_0xcb56ac,_0x501d89,_0x29a13f){return new Promise(function(_0x207832,_0x41c3b6){var _0x5a4fdf=moment();var _0x174d95={'method':_0x2b2a('0x2a'),'uri':_0x29a13f+_0x2b2a('0x2b'),'body':{'contact':{'last_name':_0x249cd5[_0x2b2a('0x24')],'work_number':_0x249cd5[_0x2b2a('0x24')],'mobile_number':_0x249cd5[_0x2b2a('0x24')],'owner_id':_0x249cd5['userId'],'created_at':_0x5a4fdf['format'](_0x2b2a('0x2c'))}},'json':!![]};_0x174d95['headers']=_0x501d89;logger[_0x2b2a('0x15')](_0x2b2a('0x2d'));return rp(_0x174d95)[_0x2b2a('0x10')](function(_0x3b165b){_0x249cd5['endUserId']=_0x3b165b[_0x2b2a('0x2e')]['id'];_0x207832(_0x249cd5);})['catch'](function(_0x4d3782){logger[_0x2b2a('0x2f')]('['+[_0xcb56ac[_0x2b2a('0x18')]()]+']',_0x4d3782[_0x2b2a('0x19')]);_0x41c3b6(_0x4d3782[_0x2b2a('0x19')]);});});}function getTicket(_0x35887d,_0x384085,_0x21d488,_0x1519ce,_0x224375){return function(_0x2c7bc3){logger[_0x2b2a('0x15')](_0x2b2a('0x30'));return new Promise(function(_0x5f52e5,_0xaa05a){var _0x1e8948=moment();var _0xe352f5={'method':_0x2b2a('0x2a'),'uri':_0x21d488+'/api/tasks','body':{'title':intUtil[_0x2b2a('0x31')](_0x1519ce['Subjects'],_0x224375,'\x20'),'description':intUtil[_0x2b2a('0x31')](_0x1519ce[_0x2b2a('0x32')],_0x224375,'\x0a'),'owner_id':_0x2c7bc3[_0x2b2a('0x1d')],'creater_id':_0x2c7bc3[_0x2b2a('0x14')],'targetable_id':_0x2c7bc3['endUserId'],'targetable_type':'Contact','created_at':_0x1e8948[_0x2b2a('0x23')](_0x2b2a('0x2c')),'due_date':_0x1e8948[_0x2b2a('0x33')](0x1e,'m')[_0x2b2a('0x23')](_0x2b2a('0x2c'))},'json':!![]};_0xe352f5['headers']=_0x384085;return rp(_0xe352f5)[_0x2b2a('0x10')](function(_0xe91125){_0x2c7bc3[_0x2b2a('0x34')]=_0xe91125[_0x2b2a('0x35')]['id'];logger[_0x2b2a('0x15')](_0x2b2a('0x36'),_0x2c7bc3['ticketId']);_0x5f52e5(_0x2c7bc3);})[_0x2b2a('0x17')](function(_0x10c4d9){logger[_0x2b2a('0x2f')]('['+[_0x35887d[_0x2b2a('0x18')]()]+']',_0x10c4d9['message']);_0xaa05a(_0x10c4d9[_0x2b2a('0x19')]);});});};}function emit(_0x45b107,_0x475944,_0x2b4e98){var _0x2390d8={'uri':_0x45b107+'/contacts/'+_0x2b4e98};io['to'](util[_0x2b2a('0x23')]('user:%s',_0x475944))[_0x2b2a('0x37')](_0x2b2a('0x38'),_0x2390d8);}exports['cs']=function(_0x27381d,_0x4464d8,_0xe6d0b3,_0x10dad9,_0x49befb,_0x26df6e,_0x5aba1a,_0x1479d4){var _0x1520b1={};var _0x2fbaf3={'Authorization':_0x2b2a('0x39')+_0x26df6e[_0x2b2a('0x3a')]};_0x26df6e[_0x2b2a('0x3b')]=intUtil['stripTrailingSlash'](_0x26df6e['remoteUri']);_0x26df6e[_0x2b2a('0x3c')]=intUtil[_0x2b2a('0x3d')](_0x26df6e['serverUrl']);var _0x4d0edc=_0x26df6e[_0x2b2a('0x3b')];_0x1520b1[_0x2b2a('0x1f')]=_0x26df6e[_0x2b2a('0x3e')];_0x1520b1[_0x2b2a('0x24')]=_0x1479d4[_0x2b2a('0x3f')]()===_0x2b2a('0x40')?_0x4464d8[_0x2b2a('0x41')]:_0x4464d8[_0x2b2a('0x42')];_0x1520b1[_0x2b2a('0x43')]=_0x1479d4===_0x2b2a('0x44')||_0x1479d4===_0x2b2a('0x45')?_0x2b2a('0x44'):_0x2b2a('0x40');if(_0x10dad9){_0x1520b1[_0x2b2a('0x1b')]=_0x10dad9[_0x2b2a('0x13')];}var _0x553342=util['format'](_0x2b2a('0x46'),_0x26df6e[_0x2b2a('0x3c')],_0x4464d8[_0x2b2a('0x47')],md5(_0x4464d8[_0x2b2a('0x47')]));if(_0x49befb&&_0x49befb['monitor_format']){logger[_0x2b2a('0x15')](_0x2b2a('0x48'),'Recording\x20is\x20enabled!');_0x4464d8['recordingURL']=_0x553342;}else if(_0x5aba1a&&_0x5aba1a[_0x2b2a('0x49')]&&_0x5aba1a[_0x2b2a('0x49')]!==_0x2b2a('0x4a')){logger[_0x2b2a('0x15')](_0x2b2a('0x4b'),_0x2b2a('0x4c'));_0x4464d8[_0x2b2a('0x4d')]=_0x553342;}else{_0x4464d8[_0x2b2a('0x4d')]='';}return getAdminId(_0x1520b1,_0x1479d4,_0x2fbaf3,_0x4d0edc)['then'](getUser(_0x1479d4,_0x2fbaf3,_0x4d0edc))[_0x2b2a('0x10')](getEndUser(_0x1479d4,_0x2fbaf3,_0x4d0edc))[_0x2b2a('0x10')](getTicket(_0x1479d4,_0x2fbaf3,_0x4d0edc,_0xe6d0b3,_0x4464d8))[_0x2b2a('0x10')](function(_0x3ade69){logger[_0x2b2a('0x15')](util[_0x2b2a('0x23')](_0x2b2a('0x4e'),_0x3ade69[_0x2b2a('0x34')]));if(_0x1479d4!==_0x2b2a('0x45')){logger[_0x2b2a('0x15')]('['+[_0x1479d4[_0x2b2a('0x18')]()]+']',_0x2b2a('0x4f'));emit(_0x4d0edc,_0x10dad9[_0x2b2a('0x50')],_0x3ade69[_0x2b2a('0x27')]);}})[_0x2b2a('0x17')](function(_0x2ca823){logger[_0x2b2a('0x2f')]('['+[_0x1479d4['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x2ca823,{'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 771106d..ce66f41 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 _0xede1=['salesforce','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','unmanaged','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','./zendesk','./sugarcrm','./freshdesk','./zoho','./vtiger','./servicenow','./dynamics365','zendesk'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0xede1,0x1a8));var _0x1ede=function(_0x54efe3,_0x228f0d){_0x54efe3=_0x54efe3-0x0;var _0x1fd3bc=_0xede1[_0x54efe3];return _0x1fd3bc;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x1ede('0x0'));var salesforce=require('./salesforce');var sugarcrm=require(_0x1ede('0x1'));var freshdesk=require(_0x1ede('0x2'));var zoho=require(_0x1ede('0x3'));var desk=require('./desk');var vtiger=require(_0x1ede('0x4'));var servicenow=require(_0x1ede('0x5'));var dynamics365=require(_0x1ede('0x6'));var freshsales=require('./freshsales');var integrations=[_0x1ede('0x7'),_0x1ede('0x8'),_0x1ede('0x9'),_0x1ede('0xa'),_0x1ede('0xb'),'desk',_0x1ede('0xc'),_0x1ede('0xd'),_0x1ede('0xe'),_0x1ede('0xf')];exports[_0x1ede('0x10')]=function(_0x200ffa,_0x335660,_0x520d9e,_0x104ed9,_0x28cfac,_0x468d47){if(_0x520d9e){if(_[_0x1ede('0x11')](integrations,_0x200ffa[_0x1ede('0x12')][_0x1ede('0x13')]())){try{var _0x5c8523=null;var _0x2bf74f='';var _0x5aaae9=_0x520d9e[_0x200ffa[_0x1ede('0x12')][_0x1ede('0x13')]()];if(_0x5aaae9){var _0x597ce6=_0x5aaae9[_0x200ffa[_0x1ede('0x14')]];if(_0x597ce6){var _0x34d4b3=_[_0x1ede('0x15')](_0x597ce6[_0x1ede('0x16')],{'id':parseInt(_0x200ffa[_0x1ede('0x17')],0xa)});if(_0x34d4b3){if(_0x104ed9){if(_0x28cfac&&_0x335660[_0x1ede('0x18')]){_0x2bf74f=_0x1ede('0x18');}else if(_0x335660[_0x1ede('0x19')]){_0x2bf74f='outbound';}else{console[_0x1ede('0x1a')](_0x1ede('0x1b'),_0x335660);}}else{_0x2bf74f=_0x1ede('0x1c');}switch(_0x200ffa[_0x1ede('0x12')]['toLowerCase']()){case _0x1ede('0x7'):zendesk[_0x2bf74f](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47);break;case _0x1ede('0x8'):salesforce[_0x2bf74f](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47);break;case _0x1ede('0x9'):sugarcrm[_0x2bf74f](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47);break;case _0x1ede('0xa'):freshdesk[_0x2bf74f](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47);break;case _0x1ede('0xb'):zoho[_0x2bf74f](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47);break;case'desk':desk[_0x2bf74f](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47);break;case _0x1ede('0xc'):vtiger[_0x2bf74f](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47);break;case'freshsales':freshsales['cs'](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47,_0x2bf74f);break;case'servicenow':servicenow['cs'](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47,_0x2bf74f);break;case _0x1ede('0xd'):dynamics365['cs'](_0x200ffa,_0x335660,_0x34d4b3,_0x104ed9,_0x28cfac,_0x597ce6,_0x468d47,_0x2bf74f);break;default:console[_0x1ede('0x1a')](_0x1ede('0x1d'));}}else{_0x5c8523=require(_0x1ede('0x1e'))(_0x200ffa[_0x1ede('0x12')]['toLowerCase']());_0x5c8523[_0x1ede('0x1f')](_0x1ede('0x20'),util[_0x1ede('0x21')](_0x1ede('0x22'),_0x200ffa[_0x1ede('0x12')]['toLowerCase'](),_0x200ffa['data3']));}}else{_0x5c8523=require(_0x1ede('0x1e'))(_0x200ffa[_0x1ede('0x12')][_0x1ede('0x13')]());_0x5c8523['error']('[EXEC]',util[_0x1ede('0x21')](_0x1ede('0x23'),_0x200ffa['data1']['toLowerCase'](),_0x200ffa[_0x1ede('0x14')]));}}else{}}catch(_0x8d5fc0){console[_0x1ede('0x1f')](_0x8d5fc0);}}}}; \ No newline at end of file +var _0x9522=['unmanaged','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','data2','./zendesk','./salesforce','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','data1','toLowerCase','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN'];(function(_0xfcd99e,_0x3b5072){var _0x251514=function(_0x2685ba){while(--_0x2685ba){_0xfcd99e['push'](_0xfcd99e['shift']());}};_0x251514(++_0x3b5072);}(_0x9522,0x104));var _0x2952=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9522[_0x46e363];return _0x3fb059;};'use strict';var _=require('lodash');var util=require('util');var zendesk=require(_0x2952('0x0'));var salesforce=require(_0x2952('0x1'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x2952('0x2'));var zoho=require(_0x2952('0x3'));var desk=require(_0x2952('0x4'));var vtiger=require(_0x2952('0x5'));var servicenow=require(_0x2952('0x6'));var dynamics365=require(_0x2952('0x7'));var freshsales=require('./freshsales');var integrations=[_0x2952('0x8'),_0x2952('0x9'),_0x2952('0xa'),_0x2952('0xb'),_0x2952('0xc'),_0x2952('0xd'),_0x2952('0xe'),_0x2952('0xf'),_0x2952('0x10'),_0x2952('0x11')];exports[_0x2952('0x12')]=function(_0x2b711,_0x34a696,_0x2c1226,_0x4ad989,_0x3eace8,_0x438088){if(_0x2c1226){if(_['includes'](integrations,_0x2b711[_0x2952('0x13')][_0x2952('0x14')]())){try{var _0x579fc5=null;var _0x41ea3b='';var _0x5521f5=_0x2c1226[_0x2b711['data1'][_0x2952('0x14')]()];if(_0x5521f5){var _0x5a54f0=_0x5521f5[_0x2b711['data2']];if(_0x5a54f0){var _0x387627=_[_0x2952('0x15')](_0x5a54f0[_0x2952('0x16')],{'id':parseInt(_0x2b711[_0x2952('0x17')],0xa)});if(_0x387627){if(_0x4ad989){if(_0x3eace8&&_0x34a696[_0x2952('0x18')]){_0x41ea3b=_0x2952('0x18');}else if(_0x34a696[_0x2952('0x19')]){_0x41ea3b=_0x2952('0x1a');}else{console['log'](_0x2952('0x1b'),_0x34a696);}}else{_0x41ea3b=_0x2952('0x1c');}switch(_0x2b711[_0x2952('0x13')]['toLowerCase']()){case _0x2952('0x8'):zendesk[_0x41ea3b](_0x2b711,_0x34a696,_0x387627,_0x4ad989,_0x3eace8,_0x5a54f0,_0x438088);break;case _0x2952('0x9'):salesforce[_0x41ea3b](_0x2b711,_0x34a696,_0x387627,_0x4ad989,_0x3eace8,_0x5a54f0,_0x438088);break;case _0x2952('0xa'):sugarcrm[_0x41ea3b](_0x2b711,_0x34a696,_0x387627,_0x4ad989,_0x3eace8,_0x5a54f0,_0x438088);break;case _0x2952('0xb'):freshdesk[_0x41ea3b](_0x2b711,_0x34a696,_0x387627,_0x4ad989,_0x3eace8,_0x5a54f0,_0x438088);break;case'zoho':zoho[_0x41ea3b](_0x2b711,_0x34a696,_0x387627,_0x4ad989,_0x3eace8,_0x5a54f0,_0x438088);break;case _0x2952('0xd'):desk[_0x41ea3b](_0x2b711,_0x34a696,_0x387627,_0x4ad989,_0x3eace8,_0x5a54f0,_0x438088);break;case _0x2952('0xe'):vtiger[_0x41ea3b](_0x2b711,_0x34a696,_0x387627,_0x4ad989,_0x3eace8,_0x5a54f0,_0x438088);break;case _0x2952('0x10'):freshsales['cs'](_0x2b711,_0x34a696,_0x387627,_0x4ad989,_0x3eace8,_0x5a54f0,_0x438088,_0x41ea3b);break;case _0x2952('0x11'):servicenow['cs'](_0x2b711,_0x34a696,_0x387627,_0x4ad989,_0x3eace8,_0x5a54f0,_0x438088,_0x41ea3b);break;case'dynamics365':dynamics365['cs'](_0x2b711,_0x34a696,_0x387627,_0x4ad989,_0x3eace8,_0x5a54f0,_0x438088,_0x41ea3b);break;default:console['log'](_0x2952('0x1d'));}}else{_0x579fc5=require(_0x2952('0x1e'))(_0x2b711[_0x2952('0x13')][_0x2952('0x14')]());_0x579fc5[_0x2952('0x1f')](_0x2952('0x20'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x2b711[_0x2952('0x13')][_0x2952('0x14')](),_0x2b711[_0x2952('0x17')]));}}else{_0x579fc5=require(_0x2952('0x1e'))(_0x2b711[_0x2952('0x13')]['toLowerCase']());_0x579fc5[_0x2952('0x1f')](_0x2952('0x20'),util[_0x2952('0x21')](_0x2952('0x22'),_0x2b711[_0x2952('0x13')][_0x2952('0x14')](),_0x2b711[_0x2952('0x23')]));}}else{}}catch(_0x5d321c){console[_0x2952('0x1f')](_0x5d321c);}}}}; \ 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 8a6f7f4..9cea865 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 _0x73cc=['identity','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','$or','Contact','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','merge','Account','first','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Name','upperFirst','create','picklist','idField','content','toString','variableName','Variable','name','password','concat','securityToken','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','calleridname','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','ioredis','../../../../config/environment','salesforce','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','ticketType','ActivityDate','IsReminderSet','IsRecurrence','contact','endUserType','lead','WhoId','WhatId','Case','account','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.'];(function(_0x4630ce,_0x4b90e2){var _0x465231=function(_0x356a35){while(--_0x356a35){_0x4630ce['push'](_0x4630ce['shift']());}};_0x465231(++_0x4b90e2);}(_0x73cc,0x1c8));var _0xc73c=function(_0x102348,_0x7ad319){_0x102348=_0x102348-0x0;var _0x58faed=_0x73cc[_0x102348];return _0x58faed;};'use strict';var _=require(_0xc73c('0x0'));var rp=require(_0xc73c('0x1'));var moment=require(_0xc73c('0x2'));var BPromise=require(_0xc73c('0x3'));var md5=require(_0xc73c('0x4'));var jsforce=require(_0xc73c('0x5'));var util=require('util');var Redis=require(_0xc73c('0x6'));var intUtil=require('./util');var config=require(_0xc73c('0x7'));var logger=require('../../../../config/logger')(_0xc73c('0x8'));config[_0xc73c('0x9')]=_['defaults'](config[_0xc73c('0x9')],{'host':_0xc73c('0xa'),'port':0x18eb});var io=require(_0xc73c('0xb'))(new Redis(config[_0xc73c('0x9')]));function emit(_0x362db2,_0x579135,_0x4eec9b){io['to'](_0x362db2)[_0xc73c('0xc')](_0x579135,_0x4eec9b);}function getTicket(_0x20f9a5,_0x3a4eaa,_0x262938,_0x5b2391,_0x215714,_0x2fc3c3,_0x368ca9,_0xf680de){var _0x5e0740=Object[_0xc73c('0xd')]({},{'OwnerId':_0x3a4eaa['id'],'Subject':intUtil[_0xc73c('0xe')](_0x5b2391[_0xc73c('0xf')],_0x215714,'\x20'),'Description':intUtil['getString'](_0x5b2391['Descriptions'],_0x215714,'\x0a')},getCustomFields(_0x2fc3c3,_0x215714));if(_0x262938){if(_0x5b2391[_0xc73c('0x10')]==='Task'){_0x5e0740[_0xc73c('0x11')]=moment['utc']();_0x5e0740[_0xc73c('0x12')]=![];_0x5e0740[_0xc73c('0x13')]=![];if(_0x262938['endUserType']===_0xc73c('0x14')||_0x262938[_0xc73c('0x15')]===_0xc73c('0x16')){_0x5e0740[_0xc73c('0x17')]=_0x262938['id'];}else if(_0x262938[_0xc73c('0x15')]==='account'){_0x5e0740[_0xc73c('0x18')]=_0x262938['id'];}}else if(_0x5b2391[_0xc73c('0x10')]===_0xc73c('0x19')){if(_0x262938[_0xc73c('0x15')]==='contact'){_0x5e0740['ContactId']=_0x262938['id'];}else if(_0x262938[_0xc73c('0x15')]===_0xc73c('0x1a')){_0x5e0740[_0xc73c('0x1b')]=_0x262938['id'];}else if(_0x262938['endUserType']===_0xc73c('0x16')&&_0x5b2391[_0xc73c('0x1c')]){_0x5e0740[_0x5b2391[_0xc73c('0x1c')]]=_0x262938['id'];}else{logger[_0xc73c('0x1d')](_0xc73c('0x1e'));}}}return _0x368ca9[_0xc73c('0x1f')](_0x5b2391[_0xc73c('0x10')])['create'](_0x5e0740);}function getUser(_0x2df882,_0x277087,_0xb7a8b2){if(!_[_0xc73c('0x20')](_0x277087)&&intUtil[_0xc73c('0x21')](_0x277087)){var _0x20cda7={'Email':_0x277087};var _0x1ec70b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xb7a8b2[_0xc73c('0x1f')](_0xc73c('0x22'))[_0xc73c('0x23')](_0x20cda7,_0x1ec70b)[_0xc73c('0x24')]()[_0xc73c('0x25')](function(_0x286bab){if(_0x286bab[_0xc73c('0x26')]){var _0x3b0c53=_[_0xc73c('0x23')](_0x286bab,function(_0x50aa5d){return _0x50aa5d[_0xc73c('0x27')]===_0x277087;});if(_0x3b0c53){logger[_0xc73c('0x1d')](_0xc73c('0x28'),_0x277087);return BPromise[_0xc73c('0x29')]({'id':_0x3b0c53['Id'],'name':_0x3b0c53['Name']});}}else{logger[_0xc73c('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x277087);return _0xb7a8b2['identity']()[_0xc73c('0x25')](function(_0x350626){return BPromise[_0xc73c('0x29')]({'id':_0x350626[_0xc73c('0x2a')],'name':_0x350626['display_name']});});}});}else{logger[_0xc73c('0x1d')](_0xc73c('0x2b'),_0x277087);return _0xb7a8b2[_0xc73c('0x2c')]()[_0xc73c('0x25')](function(_0x242272){return BPromise['resolve']({'id':_0x242272[_0xc73c('0x2a')],'name':_0x242272[_0xc73c('0x2d')]});});}}function getEndUser(_0x4818dc,_0x53542e,_0x25b5cb,_0x5450c9,_0xa248a6){var _0x365034={'$or':{'Phone':_0x5450c9}};var _0x2a6216={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xc73c('0x25')](function(){logger['info'](_0xc73c('0x2e'),_0x5450c9,_0x53542e[_0xc73c('0x2f')]);switch(_0x53542e[_0xc73c('0x2f')]){case _0xc73c('0x30'):var _0x25caa8=_['cloneDeep'](_0x365034);if(_0x53542e[_0xc73c('0x31')]){var _0x72a02e={};_0x72a02e[_0x53542e[_0xc73c('0x31')]]=_0x5450c9;_['merge'](_0x25caa8[_0xc73c('0x32')],_0x72a02e);}return _0xa248a6[_0xc73c('0x1f')](_0xc73c('0x33'))[_0xc73c('0x23')](_0x25caa8,_0x2a6216)[_0xc73c('0x24')]()['then'](function(_0x111ccf){if(_0x111ccf&&_0x111ccf['length']){return _0x111ccf;}else{var _0x72079f=_[_0xc73c('0x34')](_0x365034);if(_0x53542e['additionalSearchLead']){var _0x253d03={};_0x253d03[_0x53542e[_0xc73c('0x35')]]=_0x5450c9;_['merge'](_0x72079f['$or'],_0x253d03);}return _0xa248a6[_0xc73c('0x1f')](_0xc73c('0x36'))[_0xc73c('0x23')](_0x72079f,_0x2a6216);}});case _0xc73c('0x37'):var _0x38e510=_['cloneDeep'](_0x365034);if(_0x53542e[_0xc73c('0x38')]){var _0x72a02e={};_0x72a02e[_0x53542e['additionalSearchAccount']]=_0x5450c9;_[_0xc73c('0x39')](_0x38e510[_0xc73c('0x32')],_0x72a02e);}return _0xa248a6[_0xc73c('0x1f')](_0xc73c('0x3a'))[_0xc73c('0x23')](_0x38e510,_0x2a6216)[_0xc73c('0x24')]()['then'](function(_0x11b96e){if(_0x11b96e&&_0x11b96e[_0xc73c('0x26')]){return _0x11b96e;}else{var _0x538e3c=_[_0xc73c('0x34')](_0x365034);if(_0x53542e[_0xc73c('0x31')]){var _0x592b03={};_0x592b03[_0x53542e['additionalSearchContact']]=_0x5450c9;_['merge'](_0x538e3c['$or'],_0x592b03);}return _0xa248a6[_0xc73c('0x1f')](_0xc73c('0x33'))[_0xc73c('0x23')](_0x538e3c,_0x2a6216)['then'](function(_0x22e4df){if(_0x22e4df&&_0x22e4df[_0xc73c('0x26')]){return _0x22e4df;}else{var _0x55a25b=_[_0xc73c('0x34')](_0x365034);if(_0x53542e[_0xc73c('0x35')]){var _0x22b2d4={};_0x22b2d4[_0x53542e['additionalSearchLead']]=_0x5450c9;_['merge'](_0x55a25b[_0xc73c('0x32')],_0x22b2d4);}return _0xa248a6[_0xc73c('0x1f')](_0xc73c('0x36'))[_0xc73c('0x23')](_0x55a25b,_0x2a6216);}});}});case'contact':var _0x25caa8=_['cloneDeep'](_0x365034);if(_0x53542e[_0xc73c('0x31')]){var _0x72a02e={};_0x72a02e[_0x53542e[_0xc73c('0x31')]]=_0x5450c9;_[_0xc73c('0x39')](_0x25caa8[_0xc73c('0x32')],_0x72a02e);}return _0xa248a6[_0xc73c('0x1f')]('Contact')[_0xc73c('0x23')](_0x25caa8,_0x2a6216)[_0xc73c('0x24')]();case _0xc73c('0x16'):var _0x207b1f=_['cloneDeep'](_0x365034);if(_0x53542e[_0xc73c('0x35')]){var _0x72a02e={};_0x72a02e[_0x53542e[_0xc73c('0x35')]]=_0x5450c9;_[_0xc73c('0x39')](_0x207b1f['$or'],_0x72a02e);}return _0xa248a6[_0xc73c('0x1f')](_0xc73c('0x36'))[_0xc73c('0x23')](_0x207b1f,_0x2a6216);case'account':var _0x38e510=_[_0xc73c('0x34')](_0x365034);if(_0x53542e[_0xc73c('0x38')]){var _0x72a02e={};_0x72a02e[_0x53542e['additionalSearchAccount']]=_0x5450c9;_[_0xc73c('0x39')](_0x38e510[_0xc73c('0x32')],_0x72a02e);}return _0xa248a6[_0xc73c('0x1f')](_0xc73c('0x3a'))[_0xc73c('0x23')](_0x38e510,_0x2a6216);default:return null;}})[_0xc73c('0x25')](function(_0x358dda){if(_0x358dda&&_0x358dda[_0xc73c('0x26')]){var _0x395b92=_[_0xc73c('0x3b')](_0x358dda);if(_0x395b92){return BPromise['resolve']({'id':_0x395b92['Id'],'name':_0x395b92['Name'],'phone':_0x395b92[_0xc73c('0x3c')],'endUserType':_0x395b92['attributes'][_0xc73c('0x3d')][_0xc73c('0x3e')]()});}}})[_0xc73c('0x25')](function(_0x3a8975){if(_0x3a8975){logger[_0xc73c('0x1d')](_0xc73c('0x3f'),_0x3a8975[_0xc73c('0x15')],_0x5450c9);return BPromise['resolve'](_0x3a8975);}else{logger[_0xc73c('0x1d')](_0xc73c('0x40'),_0x5450c9);var _0x75c5e={'Phone':_0x5450c9};if(_0x53542e[_0xc73c('0x41')]){if(_0x53542e[_0xc73c('0x41')]===_0xc73c('0x14')){logger[_0xc73c('0x1d')](_0xc73c('0x42'),_0x5450c9,_0x53542e[_0xc73c('0x41')]);_0x75c5e[_0xc73c('0x43')]=_0x25b5cb!==_0xc73c('0x44')?_0x25b5cb:util[_0xc73c('0x45')](_0xc73c('0x46'),_0x5450c9);}else if(_0x53542e[_0xc73c('0x41')]===_0xc73c('0x16')){logger[_0xc73c('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5450c9,_0x53542e[_0xc73c('0x41')]);_0x75c5e['LastName']=_0x25b5cb!==''?_0x25b5cb:util[_0xc73c('0x45')](_0xc73c('0x46'),_0x5450c9);_0x75c5e['Company']='No\x20Company';}else if(_0x53542e[_0xc73c('0x41')]===_0xc73c('0x1a')){logger[_0xc73c('0x1d')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5450c9,_0x53542e['moduleCreate']);_0x75c5e[_0xc73c('0x47')]=_0x25b5cb!==''?_0x25b5cb:util[_0xc73c('0x45')](_0xc73c('0x46'),_0x5450c9);}else{return null;}}return _0xa248a6[_0xc73c('0x1f')](_[_0xc73c('0x48')](_0x53542e[_0xc73c('0x41')]))[_0xc73c('0x49')](_0x75c5e)[_0xc73c('0x25')](function(_0x401b38){return BPromise[_0xc73c('0x29')]({'id':_0x401b38['id'],'endUserType':_0x53542e['moduleCreate']});});}});}function getCustomFields(_0x327bd5,_0x20fad4){var _0x470846={};if(_0x327bd5[_0xc73c('0x26')]>0x0){_['forEach'](_0x327bd5,function(_0x4bc020){if(_['includes'](['string',_0xc73c('0x4a')],_0x4bc020[_0xc73c('0x3d')])&&_0x4bc020[_0xc73c('0x4b')]){_0x470846[_0x4bc020[_0xc73c('0x4b')]]=_0x4bc020[_0xc73c('0x4c')][_0xc73c('0x4d')]();}else if(_0x4bc020[_0xc73c('0x3d')]==='variable'&&_0x4bc020['variableName']&&_0x4bc020[_0xc73c('0x4b')]){_0x20fad4[_0x4bc020[_0xc73c('0x4e')]]&&(_0x470846[_0x4bc020[_0xc73c('0x4b')]]=_0x20fad4[_0x4bc020['variableName']][_0xc73c('0x4d')]());}else if(_0x4bc020['type']==='customVariable'&&_0x4bc020['Variable']&&_0x4bc020[_0xc73c('0x4f')][_0xc73c('0x50')]&&_0x4bc020['idField']){_0x20fad4[_0x4bc020['Variable'][_0xc73c('0x50')][_0xc73c('0x3e')]()]&&(_0x470846[_0x4bc020[_0xc73c('0x4b')]]=_0x20fad4[_0x4bc020['Variable']['name'][_0xc73c('0x3e')]()]['toString']());}});}return _0x470846;}function getConnection(_0x301425){var _0x33ce6e=_0x301425[_0xc73c('0x51')][_0xc73c('0x52')](_0x301425[_0xc73c('0x53')]);var _0x8f5b58=new jsforce['Connection']({'oauth2':{'loginUrl':_0x301425[_0xc73c('0x54')]||'https://login.salesforce.com','clientId':_0x301425[_0xc73c('0x55')],'clientSecret':_0x301425[_0xc73c('0x56')]}});return _0x8f5b58[_0xc73c('0x57')](_0x301425[_0xc73c('0x58')],_0x33ce6e)[_0xc73c('0x25')](function(){logger[_0xc73c('0x1d')](_0xc73c('0x59'));return _0x8f5b58;});}exports[_0xc73c('0x5a')]=function(_0x4ba104,_0x1e8266,_0x4e46ce,_0x383f24,_0x337e53,_0x16eeb5){var _0x1348cd,_0x36275e,_0x56fb41,_0x2816a6;_0x16eeb5[_0xc73c('0x5b')]=intUtil[_0xc73c('0x5c')](_0x16eeb5[_0xc73c('0x5b')]);_0x16eeb5[_0xc73c('0x54')]=intUtil[_0xc73c('0x5c')](_0x16eeb5[_0xc73c('0x54')]);if(_0x337e53&&_0x337e53[_0xc73c('0x5d')]){logger[_0xc73c('0x1d')](_0xc73c('0x5e'),'Recording\x20is\x20enabled!');_0x1e8266[_0xc73c('0x5f')]=util[_0xc73c('0x45')](_0xc73c('0x60'),_0x16eeb5[_0xc73c('0x5b')],_0x1e8266[_0xc73c('0x61')],md5(_0x1e8266[_0xc73c('0x61')]));}else{_0x1e8266[_0xc73c('0x5f')]='';}return getConnection(_0x16eeb5)[_0xc73c('0x25')](function(_0x1f50bb){_0x2816a6=_0x1f50bb;return getUser(_0x16eeb5,_0x383f24[_0xc73c('0x62')],_0x2816a6);})[_0xc73c('0x25')](function(_0xb63bbd){_0x1348cd=_0xb63bbd;return getEndUser(_0x16eeb5,_0x4e46ce,_0x1e8266['calleridname'],_0x1e8266['calleridnum'],_0x2816a6);})['then'](function(_0x1c360b){_0x36275e=_0x1c360b;return getTicket(_0x16eeb5,_0x1348cd,_0x36275e,_0x4e46ce,_0x1e8266,_0x4e46ce[_0xc73c('0x63')],_0x2816a6,_0xc73c('0x5a'));})[_0xc73c('0x25')](function(_0x189f23){_0x56fb41=_0x189f23;logger[_0xc73c('0x1d')](_0xc73c('0x64'),_0x56fb41['id']);logger[_0xc73c('0x1d')](_0xc73c('0x65'),_0x56fb41['id'],_0x383f24[_0xc73c('0x50')],_0x16eeb5[_0xc73c('0x3d')]);switch(_0x16eeb5[_0xc73c('0x3d')]){case'integrationTab':emit(util[_0xc73c('0x45')](_0xc73c('0x66'),_0x383f24['name']),'trigger:salesforce:display',{'recordId':_0x56fb41['id']});break;case'newTab':emit(util[_0xc73c('0x45')](_0xc73c('0x66'),_0x383f24['name']),_0xc73c('0x67'),{'uri':util[_0xc73c('0x45')](_0xc73c('0x68'),_0x2816a6[_0xc73c('0x69')],_0x56fb41['id'])});break;default:logger[_0xc73c('0x6a')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xc73c('0x6b')](function(_0x4890f8){logger[_0xc73c('0x6a')](_0xc73c('0x5e'),_0x4890f8);});};exports['outbound']=function(_0x47c469,_0x27fe6a,_0x3ac849,_0x2f4562,_0x4786c7,_0x31274b,_0x9410e1){var _0x250a1d,_0x40488e,_0xf13200,_0x364980;_0x31274b[_0xc73c('0x5b')]=intUtil[_0xc73c('0x5c')](_0x31274b[_0xc73c('0x5b')]);_0x31274b['remoteUri']=intUtil[_0xc73c('0x5c')](_0x31274b[_0xc73c('0x54')]);if(_0x9410e1&&_0x9410e1[_0xc73c('0x6c')]&&_0x9410e1[_0xc73c('0x6c')]!=='none'){logger[_0xc73c('0x1d')](_0xc73c('0x6d'),_0xc73c('0x6e'));_0x27fe6a[_0xc73c('0x5f')]=util[_0xc73c('0x45')](_0xc73c('0x60'),_0x31274b[_0xc73c('0x5b')],_0x27fe6a[_0xc73c('0x61')],md5(_0x27fe6a[_0xc73c('0x61')]));}return getConnection(_0x31274b)[_0xc73c('0x25')](function(_0x24b62e){_0x364980=_0x24b62e;return getUser(_0x31274b,_0x2f4562['email'],_0x364980);})['then'](function(_0x623245){_0x250a1d=_0x623245;return getEndUser(_0x31274b,_0x3ac849,_0x27fe6a[_0xc73c('0x6f')],_0x27fe6a['destcalleridnum'],_0x364980);})[_0xc73c('0x25')](function(_0xb61d2){_0x40488e=_0xb61d2;return getTicket(_0x31274b,_0x250a1d,_0x40488e,_0x3ac849,_0x27fe6a,_0x3ac849['Fields'],_0x364980,_0xc73c('0x70'));})[_0xc73c('0x25')](function(_0x12c90b){_0xf13200=_0x12c90b;logger[_0xc73c('0x1d')](_0xc73c('0x71'),_0xf13200['id']);logger[_0xc73c('0x1d')](_0xc73c('0x72'),_0xf13200['id'],_0x2f4562[_0xc73c('0x50')],_0x31274b['type']);switch(_0x31274b[_0xc73c('0x3d')]){case _0xc73c('0x73'):emit(util[_0xc73c('0x45')](_0xc73c('0x66'),_0x2f4562['name']),_0xc73c('0x74'),{'recordId':_0xf13200['id']});break;case _0xc73c('0x75'):emit(util[_0xc73c('0x45')](_0xc73c('0x66'),_0x2f4562[_0xc73c('0x50')]),'trigger:browser:url',{'uri':util[_0xc73c('0x45')](_0xc73c('0x68'),_0x364980[_0xc73c('0x69')],_0xf13200['id'])});break;default:logger[_0xc73c('0x6a')](_0xc73c('0x6d'),_0xc73c('0x76'));}})[_0xc73c('0x6b')](function(_0x6491c6){logger[_0xc73c('0x6a')]('[OUTBOUND]',_0x6491c6);});};exports[_0xc73c('0x77')]=function(_0x20ef9c,_0x3377f7,_0xb783dd,_0x17e1e4,_0x357ff0,_0x1ee82f){var _0x58685e,_0x382b47,_0x292794,_0x4431e0;_0x1ee82f[_0xc73c('0x5b')]=intUtil['stripTrailingSlash'](_0x1ee82f[_0xc73c('0x5b')]);_0x1ee82f[_0xc73c('0x54')]=intUtil[_0xc73c('0x5c')](_0x1ee82f[_0xc73c('0x54')]);if(_0x357ff0&&_0x357ff0['monitor_format']){logger[_0xc73c('0x1d')]('['+_0x3377f7['lastevent'][_0xc73c('0x78')]()+']',_0xc73c('0x6e'));_0x3377f7[_0xc73c('0x5f')]=util[_0xc73c('0x45')](_0xc73c('0x60'),_0x1ee82f[_0xc73c('0x5b')],_0x3377f7['uniqueid'],md5(_0x3377f7[_0xc73c('0x61')]));}else{_0x3377f7[_0xc73c('0x5f')]='';}return getConnection(_0x1ee82f)['then'](function(_0x550f2f){_0x4431e0=_0x550f2f;if(!_[_0xc73c('0x20')](_0x17e1e4)){return getUser(_0x1ee82f,_0x17e1e4[_0xc73c('0x50')],_0x4431e0);}else{return getUser(_0x1ee82f,null,_0x4431e0);}})['then'](function(_0x3615cd){_0x58685e=_0x3615cd;return getEndUser(_0x1ee82f,_0xb783dd,_0x3377f7[_0xc73c('0x79')],_0x3377f7['calleridnum'],_0x4431e0);})[_0xc73c('0x25')](function(_0x2b7dfd){_0x382b47=_0x2b7dfd;return getTicket(_0x1ee82f,_0x58685e,_0x382b47,_0xb783dd,_0x3377f7,_0xb783dd[_0xc73c('0x63')],_0x4431e0);})['then'](function(_0xd49f5b){_0x292794=_0xd49f5b;logger[_0xc73c('0x1d')]('['+_0x3377f7[_0xc73c('0x7a')][_0xc73c('0x78')]()+_0xc73c('0x7b'),_0x292794['id']);logger[_0xc73c('0x1d')]('['+_0x3377f7[_0xc73c('0x7a')][_0xc73c('0x78')]()+_0xc73c('0x7c'),_0x1ee82f[_0xc73c('0x3d')]);})[_0xc73c('0x6b')](function(_0x4b2f9e){logger[_0xc73c('0x6a')]('['+_0x3377f7[_0xc73c('0x7a')][_0xc73c('0x78')]()+']',_0x4b2f9e);});}; \ No newline at end of file +var _0x999b=['Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','','No\x20Company','create','forEach','string','type','idField','content','toString','variable','variableName','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','outbound','recordingFormat','[OUTBOUND]','email','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','lastevent','toUpperCase','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','lead','WhoId','account','WhatId','Case','contact','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','isNil','validateEmail','User','execute','then','length','find','Email','resolve','Name','identity','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','sobject','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','first','Phone','attributes','toLowerCase'];(function(_0x4d560a,_0x48d9dd){var _0x368b51=function(_0x4124a8){while(--_0x4124a8){_0x4d560a['push'](_0x4d560a['shift']());}};_0x368b51(++_0x48d9dd);}(_0x999b,0x143));var _0xb999=function(_0x10eaae,_0x2a9be2){_0x10eaae=_0x10eaae-0x0;var _0x44cc40=_0x999b[_0x10eaae];return _0x44cc40;};'use strict';var _=require(_0xb999('0x0'));var rp=require(_0xb999('0x1'));var moment=require(_0xb999('0x2'));var BPromise=require(_0xb999('0x3'));var md5=require(_0xb999('0x4'));var jsforce=require(_0xb999('0x5'));var util=require(_0xb999('0x6'));var Redis=require(_0xb999('0x7'));var intUtil=require(_0xb999('0x8'));var config=require(_0xb999('0x9'));var logger=require(_0xb999('0xa'))('salesforce');config[_0xb999('0xb')]=_[_0xb999('0xc')](config[_0xb999('0xb')],{'host':_0xb999('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb999('0xb')]));function emit(_0x268f50,_0x1fcb41,_0x647113){io['to'](_0x268f50)[_0xb999('0xe')](_0x1fcb41,_0x647113);}function getTicket(_0x8b3d6c,_0x517e14,_0x4c7052,_0x371d47,_0x232c1d,_0x4b7425,_0x3efe9d,_0x2f4b66){var _0x57ca3a=Object[_0xb999('0xf')]({},{'OwnerId':_0x517e14['id'],'Subject':intUtil[_0xb999('0x10')](_0x371d47[_0xb999('0x11')],_0x232c1d,'\x20'),'Description':intUtil[_0xb999('0x10')](_0x371d47[_0xb999('0x12')],_0x232c1d,'\x0a')},getCustomFields(_0x4b7425,_0x232c1d));if(_0x4c7052){if(_0x371d47[_0xb999('0x13')]===_0xb999('0x14')){_0x57ca3a[_0xb999('0x15')]=moment[_0xb999('0x16')]();_0x57ca3a['IsReminderSet']=![];_0x57ca3a[_0xb999('0x17')]=![];if(_0x4c7052[_0xb999('0x18')]==='contact'||_0x4c7052[_0xb999('0x18')]===_0xb999('0x19')){_0x57ca3a[_0xb999('0x1a')]=_0x4c7052['id'];}else if(_0x4c7052[_0xb999('0x18')]===_0xb999('0x1b')){_0x57ca3a[_0xb999('0x1c')]=_0x4c7052['id'];}}else if(_0x371d47['ticketType']===_0xb999('0x1d')){if(_0x4c7052[_0xb999('0x18')]===_0xb999('0x1e')){_0x57ca3a[_0xb999('0x1f')]=_0x4c7052['id'];}else if(_0x4c7052[_0xb999('0x18')]===_0xb999('0x1b')){_0x57ca3a[_0xb999('0x20')]=_0x4c7052['id'];}else if(_0x4c7052['endUserType']===_0xb999('0x19')&&_0x371d47['leadId']){_0x57ca3a[_0x371d47[_0xb999('0x21')]]=_0x4c7052['id'];}else{logger[_0xb999('0x22')](_0xb999('0x23'));}}}return _0x3efe9d['sobject'](_0x371d47[_0xb999('0x13')])['create'](_0x57ca3a);}function getUser(_0x4faa35,_0x3c4476,_0x45deee){if(!_[_0xb999('0x24')](_0x3c4476)&&intUtil[_0xb999('0x25')](_0x3c4476)){var _0x28dd21={'Email':_0x3c4476};var _0x205fe8={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x45deee['sobject'](_0xb999('0x26'))['find'](_0x28dd21,_0x205fe8)[_0xb999('0x27')]()[_0xb999('0x28')](function(_0x1db839){if(_0x1db839[_0xb999('0x29')]){var _0x53cb32=_[_0xb999('0x2a')](_0x1db839,function(_0xfb51a7){return _0xfb51a7[_0xb999('0x2b')]===_0x3c4476;});if(_0x53cb32){logger[_0xb999('0x22')]('Agent\x20%s\x20found.',_0x3c4476);return BPromise[_0xb999('0x2c')]({'id':_0x53cb32['Id'],'name':_0x53cb32[_0xb999('0x2d')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x3c4476);return _0x45deee[_0xb999('0x2e')]()['then'](function(_0x4b337c){return BPromise['resolve']({'id':_0x4b337c[_0xb999('0x2f')],'name':_0x4b337c['display_name']});});}});}else{logger[_0xb999('0x22')](_0xb999('0x30'),_0x3c4476);return _0x45deee[_0xb999('0x2e')]()['then'](function(_0x560c45){return BPromise['resolve']({'id':_0x560c45[_0xb999('0x2f')],'name':_0x560c45[_0xb999('0x31')]});});}}function getEndUser(_0x3e6f22,_0x57f614,_0xb4ceb9,_0x3f588a,_0x5aea82){var _0x139af1={'$or':{'Phone':_0x3f588a}};var _0x37e3f6={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger['info']('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x3f588a,_0x57f614[_0xb999('0x32')]);switch(_0x57f614[_0xb999('0x32')]){case _0xb999('0x33'):var _0x20cc5c=_[_0xb999('0x34')](_0x139af1);if(_0x57f614[_0xb999('0x35')]){var _0x58093c={};_0x58093c[_0x57f614[_0xb999('0x35')]]=_0x3f588a;_[_0xb999('0x36')](_0x20cc5c[_0xb999('0x37')],_0x58093c);}return _0x5aea82[_0xb999('0x38')]('Contact')[_0xb999('0x2a')](_0x20cc5c,_0x37e3f6)[_0xb999('0x27')]()['then'](function(_0x3b2790){if(_0x3b2790&&_0x3b2790['length']){return _0x3b2790;}else{var _0x47b08=_['cloneDeep'](_0x139af1);if(_0x57f614[_0xb999('0x39')]){var _0x439d30={};_0x439d30[_0x57f614[_0xb999('0x39')]]=_0x3f588a;_[_0xb999('0x36')](_0x47b08['$or'],_0x439d30);}return _0x5aea82[_0xb999('0x38')](_0xb999('0x3a'))[_0xb999('0x2a')](_0x47b08,_0x37e3f6);}});case _0xb999('0x3b'):var _0x99d956=_['cloneDeep'](_0x139af1);if(_0x57f614[_0xb999('0x3c')]){var _0x58093c={};_0x58093c[_0x57f614['additionalSearchAccount']]=_0x3f588a;_['merge'](_0x99d956[_0xb999('0x37')],_0x58093c);}return _0x5aea82[_0xb999('0x38')](_0xb999('0x3d'))[_0xb999('0x2a')](_0x99d956,_0x37e3f6)[_0xb999('0x27')]()['then'](function(_0x3d232a){if(_0x3d232a&&_0x3d232a['length']){return _0x3d232a;}else{var _0x3358de=_['cloneDeep'](_0x139af1);if(_0x57f614['additionalSearchContact']){var _0x315bf9={};_0x315bf9[_0x57f614[_0xb999('0x35')]]=_0x3f588a;_[_0xb999('0x36')](_0x3358de[_0xb999('0x37')],_0x315bf9);}return _0x5aea82[_0xb999('0x38')](_0xb999('0x3e'))[_0xb999('0x2a')](_0x3358de,_0x37e3f6)[_0xb999('0x28')](function(_0x25e85c){if(_0x25e85c&&_0x25e85c[_0xb999('0x29')]){return _0x25e85c;}else{var _0x3882af=_[_0xb999('0x34')](_0x139af1);if(_0x57f614[_0xb999('0x39')]){var _0x3a759b={};_0x3a759b[_0x57f614['additionalSearchLead']]=_0x3f588a;_[_0xb999('0x36')](_0x3882af[_0xb999('0x37')],_0x3a759b);}return _0x5aea82[_0xb999('0x38')](_0xb999('0x3a'))[_0xb999('0x2a')](_0x3882af,_0x37e3f6);}});}});case _0xb999('0x1e'):var _0x20cc5c=_['cloneDeep'](_0x139af1);if(_0x57f614[_0xb999('0x35')]){var _0x58093c={};_0x58093c[_0x57f614[_0xb999('0x35')]]=_0x3f588a;_[_0xb999('0x36')](_0x20cc5c[_0xb999('0x37')],_0x58093c);}return _0x5aea82[_0xb999('0x38')]('Contact')[_0xb999('0x2a')](_0x20cc5c,_0x37e3f6)[_0xb999('0x27')]();case _0xb999('0x19'):var _0x6c265b=_[_0xb999('0x34')](_0x139af1);if(_0x57f614[_0xb999('0x39')]){var _0x58093c={};_0x58093c[_0x57f614[_0xb999('0x39')]]=_0x3f588a;_[_0xb999('0x36')](_0x6c265b[_0xb999('0x37')],_0x58093c);}return _0x5aea82['sobject'](_0xb999('0x3a'))[_0xb999('0x2a')](_0x6c265b,_0x37e3f6);case _0xb999('0x1b'):var _0x99d956=_[_0xb999('0x34')](_0x139af1);if(_0x57f614[_0xb999('0x3c')]){var _0x58093c={};_0x58093c[_0x57f614[_0xb999('0x3c')]]=_0x3f588a;_[_0xb999('0x36')](_0x99d956['$or'],_0x58093c);}return _0x5aea82[_0xb999('0x38')](_0xb999('0x3d'))[_0xb999('0x2a')](_0x99d956,_0x37e3f6);default:return null;}})[_0xb999('0x28')](function(_0x5c51f9){if(_0x5c51f9&&_0x5c51f9[_0xb999('0x29')]){var _0x1eedab=_[_0xb999('0x3f')](_0x5c51f9);if(_0x1eedab){return BPromise[_0xb999('0x2c')]({'id':_0x1eedab['Id'],'name':_0x1eedab[_0xb999('0x2d')],'phone':_0x1eedab[_0xb999('0x40')],'endUserType':_0x1eedab[_0xb999('0x41')]['type'][_0xb999('0x42')]()});}}})[_0xb999('0x28')](function(_0x7410e1){if(_0x7410e1){logger[_0xb999('0x22')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x7410e1[_0xb999('0x18')],_0x3f588a);return BPromise[_0xb999('0x2c')](_0x7410e1);}else{logger[_0xb999('0x22')](_0xb999('0x43'),_0x3f588a);var _0x3abb53={'Phone':_0x3f588a};if(_0x57f614[_0xb999('0x44')]){if(_0x57f614[_0xb999('0x44')]===_0xb999('0x1e')){logger[_0xb999('0x22')](_0xb999('0x45'),_0x3f588a,_0x57f614[_0xb999('0x44')]);_0x3abb53[_0xb999('0x46')]=_0xb4ceb9!==''?_0xb4ceb9:util[_0xb999('0x47')](_0xb999('0x48'),_0x3f588a);}else if(_0x57f614[_0xb999('0x44')]==='lead'){logger['info'](_0xb999('0x45'),_0x3f588a,_0x57f614[_0xb999('0x44')]);_0x3abb53[_0xb999('0x46')]=_0xb4ceb9!==_0xb999('0x49')?_0xb4ceb9:util['format'](_0xb999('0x48'),_0x3f588a);_0x3abb53['Company']=_0xb999('0x4a');}else if(_0x57f614[_0xb999('0x44')]===_0xb999('0x1b')){logger[_0xb999('0x22')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3f588a,_0x57f614['moduleCreate']);_0x3abb53['Name']=_0xb4ceb9!==_0xb999('0x49')?_0xb4ceb9:util['format'](_0xb999('0x48'),_0x3f588a);}else{return null;}}return _0x5aea82[_0xb999('0x38')](_['upperFirst'](_0x57f614[_0xb999('0x44')]))[_0xb999('0x4b')](_0x3abb53)['then'](function(_0x4ca925){return BPromise['resolve']({'id':_0x4ca925['id'],'endUserType':_0x57f614[_0xb999('0x44')]});});}});}function getCustomFields(_0x8ae90c,_0x44cca7){var _0x553340={};if(_0x8ae90c[_0xb999('0x29')]>0x0){_[_0xb999('0x4c')](_0x8ae90c,function(_0x374510){if(_['includes']([_0xb999('0x4d'),'picklist'],_0x374510[_0xb999('0x4e')])&&_0x374510['idField']){_0x553340[_0x374510[_0xb999('0x4f')]]=_0x374510[_0xb999('0x50')][_0xb999('0x51')]();}else if(_0x374510[_0xb999('0x4e')]===_0xb999('0x52')&&_0x374510['variableName']&&_0x374510[_0xb999('0x4f')]){_0x44cca7[_0x374510[_0xb999('0x53')]]&&(_0x553340[_0x374510[_0xb999('0x4f')]]=_0x44cca7[_0x374510['variableName']][_0xb999('0x51')]());}else if(_0x374510['type']==='customVariable'&&_0x374510[_0xb999('0x54')]&&_0x374510[_0xb999('0x54')][_0xb999('0x55')]&&_0x374510['idField']){_0x44cca7[_0x374510[_0xb999('0x54')][_0xb999('0x55')][_0xb999('0x42')]()]&&(_0x553340[_0x374510[_0xb999('0x4f')]]=_0x44cca7[_0x374510[_0xb999('0x54')][_0xb999('0x55')][_0xb999('0x42')]()]['toString']());}});}return _0x553340;}function getConnection(_0x5243bf){var _0x52808d=_0x5243bf[_0xb999('0x56')][_0xb999('0x57')](_0x5243bf[_0xb999('0x58')]);var _0x53b54f=new jsforce[(_0xb999('0x59'))]({'oauth2':{'loginUrl':_0x5243bf[_0xb999('0x5a')]||_0xb999('0x5b'),'clientId':_0x5243bf[_0xb999('0x5c')],'clientSecret':_0x5243bf['clientSecret']}});return _0x53b54f[_0xb999('0x5d')](_0x5243bf['username'],_0x52808d)['then'](function(){logger[_0xb999('0x22')](_0xb999('0x5e'));return _0x53b54f;});}exports[_0xb999('0x5f')]=function(_0x5c6322,_0x24c021,_0x5b7b1f,_0x5cd61f,_0x1d2de9,_0x504e94){var _0x2909d5,_0x319643,_0x45bced,_0xf65c4b;_0x504e94[_0xb999('0x60')]=intUtil[_0xb999('0x61')](_0x504e94[_0xb999('0x60')]);_0x504e94[_0xb999('0x5a')]=intUtil[_0xb999('0x61')](_0x504e94[_0xb999('0x5a')]);if(_0x1d2de9&&_0x1d2de9['monitor_format']){logger[_0xb999('0x22')](_0xb999('0x62'),_0xb999('0x63'));_0x24c021['recordingURL']=util[_0xb999('0x47')](_0xb999('0x64'),_0x504e94['serverUrl'],_0x24c021['uniqueid'],md5(_0x24c021[_0xb999('0x65')]));}else{_0x24c021[_0xb999('0x66')]='';}return getConnection(_0x504e94)[_0xb999('0x28')](function(_0x257486){_0xf65c4b=_0x257486;return getUser(_0x504e94,_0x5cd61f['email'],_0xf65c4b);})['then'](function(_0x3ebc18){_0x2909d5=_0x3ebc18;return getEndUser(_0x504e94,_0x5b7b1f,_0x24c021[_0xb999('0x67')],_0x24c021[_0xb999('0x68')],_0xf65c4b);})[_0xb999('0x28')](function(_0x1cdec3){_0x319643=_0x1cdec3;return getTicket(_0x504e94,_0x2909d5,_0x319643,_0x5b7b1f,_0x24c021,_0x5b7b1f['Fields'],_0xf65c4b,'queue');})['then'](function(_0xda9eda){_0x45bced=_0xda9eda;logger['info'](_0xb999('0x69'),_0x45bced['id']);logger[_0xb999('0x22')](_0xb999('0x6a'),_0x45bced['id'],_0x5cd61f['name'],_0x504e94[_0xb999('0x4e')]);switch(_0x504e94[_0xb999('0x4e')]){case _0xb999('0x6b'):emit(util['format'](_0xb999('0x6c'),_0x5cd61f['name']),_0xb999('0x6d'),{'recordId':_0x45bced['id']});break;case _0xb999('0x6e'):emit(util[_0xb999('0x47')]('user:%s',_0x5cd61f[_0xb999('0x55')]),_0xb999('0x6f'),{'uri':util[_0xb999('0x47')]('%s/%s/e',_0xf65c4b['instanceUrl'],_0x45bced['id'])});break;default:logger[_0xb999('0x70')](_0xb999('0x71'));}})['catch'](function(_0x395c7f){logger[_0xb999('0x70')](_0xb999('0x62'),_0x395c7f);});};exports[_0xb999('0x72')]=function(_0x3a7655,_0x2663fc,_0x3a7911,_0x1319bb,_0x3b4a6e,_0x4f2874,_0x2237d2){var _0xae0363,_0x9eb902,_0x1a6549,_0x5db464;_0x4f2874[_0xb999('0x60')]=intUtil['stripTrailingSlash'](_0x4f2874[_0xb999('0x60')]);_0x4f2874[_0xb999('0x5a')]=intUtil[_0xb999('0x61')](_0x4f2874[_0xb999('0x5a')]);if(_0x2237d2&&_0x2237d2[_0xb999('0x73')]&&_0x2237d2['recordingFormat']!=='none'){logger[_0xb999('0x22')](_0xb999('0x74'),_0xb999('0x63'));_0x2663fc[_0xb999('0x66')]=util[_0xb999('0x47')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4f2874[_0xb999('0x60')],_0x2663fc[_0xb999('0x65')],md5(_0x2663fc[_0xb999('0x65')]));}return getConnection(_0x4f2874)['then'](function(_0x1efda8){_0x5db464=_0x1efda8;return getUser(_0x4f2874,_0x1319bb[_0xb999('0x75')],_0x5db464);})[_0xb999('0x28')](function(_0x18463f){_0xae0363=_0x18463f;return getEndUser(_0x4f2874,_0x3a7911,_0x2663fc[_0xb999('0x76')],_0x2663fc[_0xb999('0x77')],_0x5db464);})[_0xb999('0x28')](function(_0x49d784){_0x9eb902=_0x49d784;return getTicket(_0x4f2874,_0xae0363,_0x9eb902,_0x3a7911,_0x2663fc,_0x3a7911[_0xb999('0x78')],_0x5db464,'outbound');})[_0xb999('0x28')](function(_0x4087e6){_0x1a6549=_0x4087e6;logger[_0xb999('0x22')](_0xb999('0x79'),_0x1a6549['id']);logger[_0xb999('0x22')](_0xb999('0x7a'),_0x1a6549['id'],_0x1319bb[_0xb999('0x55')],_0x4f2874['type']);switch(_0x4f2874[_0xb999('0x4e')]){case _0xb999('0x6b'):emit(util['format'](_0xb999('0x6c'),_0x1319bb['name']),'trigger:salesforce:display',{'recordId':_0x1a6549['id']});break;case _0xb999('0x6e'):emit(util['format'](_0xb999('0x6c'),_0x1319bb['name']),_0xb999('0x6f'),{'uri':util[_0xb999('0x47')](_0xb999('0x7b'),_0x5db464[_0xb999('0x7c')],_0x1a6549['id'])});break;default:logger[_0xb999('0x70')](_0xb999('0x74'),_0xb999('0x7d'));}})[_0xb999('0x7e')](function(_0x1027fa){logger[_0xb999('0x70')](_0xb999('0x74'),_0x1027fa);});};exports[_0xb999('0x7f')]=function(_0x2d08f1,_0xdbbd5a,_0x140143,_0x17c455,_0x54e338,_0x357148){var _0x4e25da,_0x538f9a,_0x1d2ca6,_0xd4fc0a;_0x357148[_0xb999('0x60')]=intUtil['stripTrailingSlash'](_0x357148[_0xb999('0x60')]);_0x357148[_0xb999('0x5a')]=intUtil[_0xb999('0x61')](_0x357148['remoteUri']);if(_0x54e338&&_0x54e338['monitor_format']){logger[_0xb999('0x22')]('['+_0xdbbd5a[_0xb999('0x80')][_0xb999('0x81')]()+']','Recording\x20is\x20enabled!');_0xdbbd5a[_0xb999('0x66')]=util[_0xb999('0x47')](_0xb999('0x64'),_0x357148[_0xb999('0x60')],_0xdbbd5a[_0xb999('0x65')],md5(_0xdbbd5a['uniqueid']));}else{_0xdbbd5a[_0xb999('0x66')]='';}return getConnection(_0x357148)['then'](function(_0x15d68f){_0xd4fc0a=_0x15d68f;if(!_[_0xb999('0x24')](_0x17c455)){return getUser(_0x357148,_0x17c455[_0xb999('0x55')],_0xd4fc0a);}else{return getUser(_0x357148,null,_0xd4fc0a);}})[_0xb999('0x28')](function(_0x213465){_0x4e25da=_0x213465;return getEndUser(_0x357148,_0x140143,_0xdbbd5a[_0xb999('0x67')],_0xdbbd5a[_0xb999('0x68')],_0xd4fc0a);})[_0xb999('0x28')](function(_0x3e4641){_0x538f9a=_0x3e4641;return getTicket(_0x357148,_0x4e25da,_0x538f9a,_0x140143,_0xdbbd5a,_0x140143[_0xb999('0x78')],_0xd4fc0a);})[_0xb999('0x28')](function(_0x5c7661){_0x1d2ca6=_0x5c7661;logger[_0xb999('0x22')]('['+_0xdbbd5a[_0xb999('0x80')][_0xb999('0x81')]()+']\x20Ticket\x20%s\x20created.',_0x1d2ca6['id']);logger[_0xb999('0x22')]('['+_0xdbbd5a[_0xb999('0x80')][_0xb999('0x81')]()+']\x20Integration\x20account\x20type\x20%s.',_0x357148[_0xb999('0x4e')]);})[_0xb999('0x7e')](function(_0x5eeb4f){logger['error']('['+_0xdbbd5a[_0xb999('0x80')][_0xb999('0x81')]()+']',_0x5eeb4f);});}; \ 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 d4a3222..09e786e 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 _0xb93f=['Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident\x20-\x20','ticketNumber',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','socket.io-emitter','redis','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb93f,0x17e));var _0xfb93=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xb93f[_0x4c7fb5];return _0x2e10ac;};'use strict';var _=require(_0xfb93('0x0'));var Promise=require(_0xfb93('0x1'));var rp=require('request-promise');var util=require(_0xfb93('0x2'));var md5=require(_0xfb93('0x3'));var Redis=require(_0xfb93('0x4'));var intUtil=require(_0xfb93('0x5'));var config=require(_0xfb93('0x6'));var logger=require(_0xfb93('0x7'))('servicenow');config['redis']=_[_0xfb93('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xfb93('0x9'))(new Redis(config[_0xfb93('0xa')]));function getAdminUser(_0x5c1cbc,_0x21a066,_0x11a25b,_0x5655d1,_0x1c3c21,_0xeaf148){return new Promise(function(_0x261c57,_0x3e8ab1){var _0x4ab007={'method':'GET','uri':_0x5655d1+_0xfb93('0xb')+'&'+_0x1c3c21+'&'+_0xeaf148,'auth':_0x21a066,'json':!![]};return rp(_0x4ab007)[_0xfb93('0xc')](function(_0x2409b3){if(_0x2409b3[_0xfb93('0xd')][_0xfb93('0xe')]>0x0){_0x11a25b[_0xfb93('0xf')]=_0x2409b3[_0xfb93('0xd')][0x0][_0xfb93('0x10')];}logger[_0xfb93('0x11')]('['+[_0x5c1cbc[_0xfb93('0x12')]()]+_0xfb93('0x13'),_0x11a25b);_0x261c57(_0x11a25b);})[_0xfb93('0x14')](function(_0x50326a){logger[_0xfb93('0x15')]('['+[_0x5c1cbc[_0xfb93('0x12')]()]+']',_0x50326a[_0xfb93('0x16')]);_0x3e8ab1(_0x50326a[_0xfb93('0x16')]);});});}function getUser(_0x404691,_0x567445,_0x8e846a,_0x4e4719,_0x25df92){return function(_0x18ec11){logger['info']('['+[_0x404691[_0xfb93('0x12')]()]+_0xfb93('0x17'),_0x18ec11);return new Promise(function(_0x3093a6,_0xca1b48){if(intUtil['validateEmail'](_0x18ec11[_0xfb93('0x18')])){var _0x2c5fb1={'method':_0xfb93('0x19'),'uri':_0x8e846a+_0xfb93('0x1a')+_0x18ec11[_0xfb93('0x18')]+'&'+_0x4e4719+'&'+_0x25df92,'auth':_0x567445,'json':!![]};logger[_0xfb93('0x11')]('['+[_0x404691[_0xfb93('0x12')]()]+_0xfb93('0x1b'),_0x2c5fb1);return rp(_0x2c5fb1)[_0xfb93('0xc')](function(_0x1aedb3){logger[_0xfb93('0x11')]('['+[_0x404691[_0xfb93('0x12')]()]+_0xfb93('0x1c'),_0x1aedb3);if(_0x1aedb3[_0xfb93('0xd')][_0xfb93('0xe')]>0x0&&String(_0x1aedb3[_0xfb93('0xd')][0x0][_0xfb93('0x1d')])==='true'){_0x18ec11[_0xfb93('0x1e')]=_0x1aedb3[_0xfb93('0xd')][0x0][_0xfb93('0x10')];}else{_0x18ec11[_0xfb93('0x1e')]=_0x18ec11[_0xfb93('0xf')];_0x18ec11[_0xfb93('0x18')]=_0x18ec11[_0xfb93('0x1f')];}logger[_0xfb93('0x11')]('['+[_0x404691[_0xfb93('0x12')]()]+_0xfb93('0x20'),_0x18ec11);_0x3093a6(_0x18ec11);})[_0xfb93('0x14')](function(_0x677c5f){logger[_0xfb93('0x15')]('['+[_0x404691[_0xfb93('0x12')]()]+']',_0x677c5f[_0xfb93('0x16')]);_0xca1b48(_0x677c5f[_0xfb93('0x16')]);});}else{logger[_0xfb93('0x11')]('['+[_0x404691[_0xfb93('0x12')]()]+_0xfb93('0x21'));_0x18ec11[_0xfb93('0x1e')]=_0x18ec11[_0xfb93('0xf')];_0x18ec11[_0xfb93('0x18')]=_0x18ec11[_0xfb93('0x1f')];_0x3093a6(_0x18ec11);}});};}function createEndUser(_0xa64aad,_0x4348fa,_0x4e07db,_0x2e2d4f,_0x41c8b9){logger[_0xfb93('0x11')]('['+[_0xa64aad[_0xfb93('0x12')]()]+_0xfb93('0x22'),_0x4e07db);return new Promise(function(_0x540642,_0x71d33a){var _0x28ea4f={'method':_0xfb93('0x23'),'uri':_0x2e2d4f+'sys_user?'+_0x41c8b9,'body':{'user_name':_0x4e07db[_0xfb93('0x24')],'roles':'user','first_name':_0x4e07db[_0xfb93('0x24')],'active':_0xfb93('0x25'),'date_format':_0xfb93('0x26'),'phone':_0x4e07db[_0xfb93('0x24')]},'auth':_0x4348fa,'json':!![]};return rp(_0x28ea4f)['then'](function(_0x16399e){logger[_0xfb93('0x11')]('['+[_0xa64aad[_0xfb93('0x12')]()]+_0xfb93('0x27'),_0x16399e[_0xfb93('0xd')]);_0x4e07db[_0xfb93('0x28')]=_0x16399e[_0xfb93('0xd')][_0xfb93('0x10')];_0x540642(_0x4e07db);})[_0xfb93('0x14')](function(_0x471347){logger[_0xfb93('0x15')]('['+[_0xa64aad[_0xfb93('0x12')]()]+']',_0x471347['message']);_0x71d33a(_0x471347[_0xfb93('0x16')]);});});}function getEndUser(_0x2ae9de,_0x4d2eca,_0x3f912a,_0x34ab0e,_0x3bc800){return function(_0x243f49){logger[_0xfb93('0x11')]('['+[_0x2ae9de[_0xfb93('0x12')]()]+_0xfb93('0x29'),_0x243f49);return new Promise(function(_0xaa02d5,_0x2e9d5e){var _0x534b5e={'method':'GET','uri':_0x3f912a+'sys_user?sysparm_query=phone%3D'+_0x243f49[_0xfb93('0x24')]+'&'+_0x34ab0e+'&'+_0x3bc800,'auth':_0x4d2eca,'json':!![]};return rp(_0x534b5e)[_0xfb93('0xc')](function(_0x281d81){if(_0x281d81[_0xfb93('0xd')][_0xfb93('0xe')]>0x0){_0x243f49[_0xfb93('0x28')]=_0x281d81[_0xfb93('0xd')][0x0][_0xfb93('0x10')];logger[_0xfb93('0x11')]('['+[_0x2ae9de[_0xfb93('0x12')]()]+_0xfb93('0x2a'),_0x243f49);_0xaa02d5(_0x243f49);}else{return createEndUser(_0x2ae9de,_0x4d2eca,_0x243f49,_0x3f912a,_0x34ab0e)['then'](function(_0x5372de){logger['info']('['+[_0x2ae9de[_0xfb93('0x12')]()]+'],\x20createEndUser\x20crm',_0x5372de);_0xaa02d5(_0x5372de);});}})['catch'](function(_0x1ac152){logger[_0xfb93('0x15')]('['+[_0x2ae9de[_0xfb93('0x12')]()]+']',_0x1ac152['message']);_0x2e9d5e(_0x1ac152[_0xfb93('0x16')]);});});};}function getCustomFields(_0x3071d9,_0x6df596){var _0xf0770f={};if(_0x3071d9['length']>0x0){_[_0xfb93('0x2b')](_0x3071d9,function(_0x4078d8){if(_[_0xfb93('0x2c')]([_0xfb93('0x2d'),_0xfb93('0x2e')],_0x4078d8[_0xfb93('0x2f')])&&_0x4078d8[_0xfb93('0x30')]&&!_0x4078d8[_0xfb93('0x31')]){_0xf0770f[_0x4078d8[_0xfb93('0x30')][_0xfb93('0x32')]()]=_0x4078d8[_0xfb93('0x33')][_0xfb93('0x34')]();}else if(_[_0xfb93('0x2c')](['string',_0xfb93('0x2e')],_0x4078d8[_0xfb93('0x2f')])&&_0x4078d8[_0xfb93('0x35')]&&_0x4078d8['customField']){_0xf0770f[_0x4078d8['idField'][_0xfb93('0x32')]()]=_0x4078d8[_0xfb93('0x33')]['toString']();}else if(_0x4078d8['type']===_0xfb93('0x36')&&_0x4078d8['variableName']&&_0x4078d8[_0xfb93('0x35')]&&_0x4078d8['customField']){_0xf0770f[_0x4078d8[_0xfb93('0x35')][_0xfb93('0x32')]()]=_0x6df596[_0x4078d8[_0xfb93('0x37')]][_0xfb93('0x34')]();}else if(_0x4078d8[_0xfb93('0x2f')]===_0xfb93('0x38')&&_0x4078d8[_0xfb93('0x39')]&&_0x4078d8[_0xfb93('0x39')][_0xfb93('0x3a')]&&_0x4078d8[_0xfb93('0x35')]&&_0x4078d8['customField']){_0xf0770f[_0x4078d8[_0xfb93('0x35')][_0xfb93('0x32')]()]=_0x6df596[_0x4078d8[_0xfb93('0x39')][_0xfb93('0x3a')][_0xfb93('0x32')]()][_0xfb93('0x34')]();}});}return _0xf0770f;}function getTicket(_0x5eb30d,_0x171c4b,_0x17e5a3,_0x4402c7,_0x9a84bb,_0x57f53e){return function(_0x29369f){logger['info']('['+[_0x5eb30d[_0xfb93('0x12')]()]+_0xfb93('0x3b'),_0x29369f);return new Promise(function(_0x454d72,_0x1dd9dd){var _0x305ed5=_0x5eb30d['toLowerCase']()===_0xfb93('0x3c')?_0x29369f[_0xfb93('0x1e')]:_0x29369f[_0xfb93('0x28')];var _0x16d36b={'method':_0xfb93('0x23'),'uri':_0x17e5a3+_0xfb93('0x3d')+'?'+_0x57f53e,'body':Object[_0xfb93('0x3e')]({},{'active':_0xfb93('0x25'),'caller_id':_0x305ed5,'assigned_to':_0x29369f[_0xfb93('0x1e')],'short_description':intUtil[_0xfb93('0x3f')](_0x4402c7[_0xfb93('0x40')],_0x9a84bb,'\x20'),'description':intUtil['getString'](_0x4402c7[_0xfb93('0x41')],_0x9a84bb,'\x0a')},getCustomFields(_0x4402c7[_0xfb93('0x42')],_0x9a84bb)),'auth':_0x171c4b,'json':!![]};return rp(_0x16d36b)[_0xfb93('0xc')](function(_0x3a36a6){logger['info']('['+[_0x5eb30d[_0xfb93('0x12')]()]+_0xfb93('0x43'),_0x3a36a6[_0xfb93('0xd')]);_0x29369f[_0xfb93('0x44')]=_0x3a36a6[_0xfb93('0xd')]['sys_id'];_0x29369f['ticketNumber']=_0x3a36a6[_0xfb93('0xd')][_0xfb93('0x45')];logger[_0xfb93('0x11')]('['+[_0x5eb30d[_0xfb93('0x12')]()]+_0xfb93('0x46'),_0x29369f);_0x454d72(_0x29369f);})[_0xfb93('0x14')](function(_0x22a267){logger['error']('['+[_0x5eb30d[_0xfb93('0x12')]()]+']',_0x22a267['message']);_0x1dd9dd(_0x22a267[_0xfb93('0x16')]);});});};}function createRemoteTag(_0x46b058,_0x1f2815,_0x361acd,_0x136810){return new Promise(function(_0x35f829,_0x1dadf4){var _0x42e74a={'method':_0xfb93('0x23'),'uri':_0x361acd+_0xfb93('0x47')+'?'+_0x136810,'body':{'short_description':_0x46b058,'global':!![],'active':!![],'name':_0x46b058},'auth':_0x1f2815,'json':!![]};return rp(_0x42e74a)['then'](function(_0x5f1e48){var _0x2a452b=_0x5f1e48['result'][_0xfb93('0x10')];_0x35f829(_0x2a452b);});});}function getRemoteTag(_0x39a238,_0x5aa5db,_0x4df0ea,_0x324840,_0x42973f){return new Promise(function(_0x22e6b2,_0x277fe2){var _0x42bde2={'method':'GET','uri':_0x4df0ea+_0xfb93('0x47')+_0xfb93('0x48')+_0x39a238+'&'+_0x324840,'auth':_0x5aa5db,'json':!![]};return rp(_0x42bde2)['then'](function(_0x5a7d1f){if(_0x5a7d1f[_0xfb93('0xd')][_0xfb93('0xe')]>0x0){var _0x51e43e=_0x5a7d1f[_0xfb93('0xd')][0x0]['sys_id'];_0x22e6b2(_0x51e43e);}else{return createRemoteTag(_0x39a238,_0x5aa5db,_0x4df0ea,_0x324840)['then'](function(_0x368c20){_0x22e6b2(_0x368c20);});}});});}function assignTagToIncident(_0x391289,_0x3baa56,_0x1d521f,_0x4ff915,_0x605942){return new Promise(function(_0x25dd99,_0x6cbfbb){var _0x245229={'method':_0xfb93('0x23'),'uri':_0x1d521f+'label_entry'+'?'+_0x605942,'body':{'label':_0x391289,'table':_0xfb93('0x3d'),'id_type':'Incident','table_key':_0x4ff915['ticketId'],'title':_0xfb93('0x49')+_0x4ff915[_0xfb93('0x4a')],'id_display':_0x4ff915[_0xfb93('0x4a')]},'auth':_0x3baa56,'json':!![]};return rp(_0x245229)['then'](function(_0x512803){_0x25dd99();})[_0xfb93('0x14')](function(){_0x25dd99();});});}function manageTags(_0x4a9c27,_0xb879c3,_0x41d198,_0x1568ea,_0x41ce9a,_0x3d1d01,_0xcb9c6d){return new Promise(function(_0x458bd3,_0x1c0df3){var _0xb1c71c=[];_0xb879c3[_0xfb93('0x2b')](function(_0x389130){_0xb1c71c['push'](getRemoteTag(_0x389130,_0x41d198,_0x1568ea,_0x3d1d01,_0xcb9c6d));});return Promise['all'](_0xb1c71c)[_0xfb93('0xc')](function(_0x37ccb4){if(_0x37ccb4[_0xfb93('0xe')]){logger[_0xfb93('0x11')]('['+[_0x4a9c27['toUpperCase']()]+_0xfb93('0x4b'),_0x37ccb4);var _0x5057d5=[];_0x37ccb4[_0xfb93('0x2b')](function(_0x28edf8){_0x5057d5[_0xfb93('0x4c')](assignTagToIncident(_0x28edf8,_0x41d198,_0x1568ea,_0x41ce9a,_0x3d1d01));});return Promise[_0xfb93('0x4d')](_0x5057d5)['then'](function(){_0x458bd3();})[_0xfb93('0x14')](function(){_0x458bd3();});}else{_0x458bd3();}});});}function getTags(_0x2e13ee,_0x5a09d3,_0x275775,_0x400695,_0x2204a9,_0x151729){return function(_0x56cb33){return new Promise(function(_0x35d7aa,_0x267a60){var _0x130a78=[];var _0x28ff10=_0x400695[_0xfb93('0x4e')];if(_0x28ff10&&_0x28ff10[_0xfb93('0xe')]>0x0){_0x130a78=_[_0xfb93('0x4f')](_0x28ff10,'name');}if(_0x130a78[_0xfb93('0xe')]>0x0){return manageTags(_0x2e13ee,_0x130a78,_0x5a09d3,_0x275775,_0x56cb33,_0x2204a9,_0x151729)[_0xfb93('0xc')](function(){_0x35d7aa(_0x56cb33);});}else{_0x35d7aa(_0x56cb33);}});};}function emit(_0x48b7a0,_0x51d866,_0x2ccedd){var _0x5a79a1=_0xfb93('0x50')+_0xfb93('0x51')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xfb93('0x52');var _0x5192e5={'uri':_0x48b7a0+_0xfb93('0x53')+_0x2ccedd+_0x5a79a1};io['to'](util[_0xfb93('0x54')](_0xfb93('0x55'),_0x51d866))['emit'](_0xfb93('0x56'),_0x5192e5);}exports['cs']=function(_0x2c091f,_0x2d09ca,_0x174908,_0x521e51,_0x2d3f62,_0x26f2e6,_0x40ba36,_0x278c99){var _0x221be9={};var _0x35a473={'user':_0x26f2e6[_0xfb93('0x57')],'pass':_0x26f2e6['password']};var _0x23a6b0=_0xfb93('0x58');var _0x495c25=_0xfb93('0x59');_0x26f2e6[_0xfb93('0x5a')]=intUtil[_0xfb93('0x5b')](_0x26f2e6[_0xfb93('0x5a')]);_0x26f2e6[_0xfb93('0x5c')]=intUtil[_0xfb93('0x5b')](_0x26f2e6[_0xfb93('0x5c')]);var _0x4b08c8=util['format'](_0xfb93('0x5d'),_0x26f2e6[_0xfb93('0x5a')]);_0x221be9[_0xfb93('0x18')]=!_['isNil'](_0x521e51)?_0x521e51[_0xfb93('0x5e')]:null;_0x221be9[_0xfb93('0x1f')]=_0x26f2e6[_0xfb93('0x5e')];_0x221be9['endUserNumber']=_0x278c99[_0xfb93('0x32')]()===_0xfb93('0x3c')?_0x2d09ca[_0xfb93('0x5f')]:_0x2d09ca[_0xfb93('0x60')];_0x221be9[_0xfb93('0x61')]=_0x278c99===_0xfb93('0x62')||_0x278c99===_0xfb93('0x63')?_0xfb93('0x62'):_0xfb93('0x3c');var _0x51100e=util[_0xfb93('0x54')](_0xfb93('0x64'),_0x26f2e6[_0xfb93('0x5c')],_0x2d09ca[_0xfb93('0x65')],md5(_0x2d09ca[_0xfb93('0x65')]));if(_0x2d3f62&&_0x2d3f62[_0xfb93('0x66')]){logger[_0xfb93('0x11')](_0xfb93('0x67'),_0xfb93('0x68'));_0x2d09ca[_0xfb93('0x69')]=_0x51100e;}else if(_0x40ba36&&_0x40ba36[_0xfb93('0x6a')]&&_0x40ba36[_0xfb93('0x6a')]!=='none'){logger[_0xfb93('0x11')](_0xfb93('0x6b'),_0xfb93('0x68'));_0x2d09ca[_0xfb93('0x69')]=_0x51100e;}else{_0x2d09ca[_0xfb93('0x69')]='';}return getAdminUser(_0x278c99,_0x35a473,_0x221be9,_0x4b08c8,_0x495c25,_0x23a6b0)['then'](getUser(_0x278c99,_0x35a473,_0x4b08c8,_0x495c25,_0x23a6b0))[_0xfb93('0xc')](getEndUser(_0x278c99,_0x35a473,_0x4b08c8,_0x495c25,_0x23a6b0))[_0xfb93('0xc')](getTicket(_0x278c99,_0x35a473,_0x4b08c8,_0x174908,_0x2d09ca,_0x495c25))[_0xfb93('0xc')](function(_0x1918cc){logger[_0xfb93('0x11')](util[_0xfb93('0x54')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1918cc['ticketId']));logger[_0xfb93('0x11')](util[_0xfb93('0x54')](_0xfb93('0x6c'),_0x278c99));if(_0x278c99!==_0xfb93('0x63')){logger['info']('['+[_0x278c99[_0xfb93('0x12')]()]+']',_0xfb93('0x6d'));emit(_0x26f2e6[_0xfb93('0x5a')],_0x521e51[_0xfb93('0x3a')],_0x1918cc[_0xfb93('0x44')]);}})[_0xfb93('0x14')](function(_0x5a7f6d){logger[_0xfb93('0x15')]('['+[_0x278c99['toUpperCase']()]+_0xfb93('0x6e'),util[_0xfb93('0x6f')](_0x5a7f6d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8e6d=['includes','string','idField','type','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','Tags','map','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','user:%s','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','unmanaged','queue','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','localhost','GET','result','length','sys_id','toUpperCase','catch','message','userEmail','sys_user?sysparm_query=email%3D','info','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','true','userId','adminId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','System','],\x20EndUser\x20schema','error','],\x20getEndUser\x20input\x20crm','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','picklist','nameField','customField','toLowerCase','content','toString'];(function(_0x5f5aac,_0xa930c7){var _0x1453ff=function(_0x35de82){while(--_0x35de82){_0x5f5aac['push'](_0x5f5aac['shift']());}};_0x1453ff(++_0xa930c7);}(_0x8e6d,0x168));var _0xd8e6=function(_0x2ede87,_0x3bad73){_0x2ede87=_0x2ede87-0x0;var _0x10f2b7=_0x8e6d[_0x2ede87];return _0x10f2b7;};'use strict';var _=require(_0xd8e6('0x0'));var Promise=require(_0xd8e6('0x1'));var rp=require(_0xd8e6('0x2'));var util=require(_0xd8e6('0x3'));var md5=require(_0xd8e6('0x4'));var Redis=require(_0xd8e6('0x5'));var intUtil=require(_0xd8e6('0x6'));var config=require(_0xd8e6('0x7'));var logger=require('../../../../config/logger')(_0xd8e6('0x8'));config['redis']=_['defaults'](config[_0xd8e6('0x9')],{'host':_0xd8e6('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd8e6('0x9')]));function getAdminUser(_0x5146b9,_0x2ee077,_0x4572f7,_0x293e5f,_0x32fdb2,_0x41c097){return new Promise(function(_0x21961d,_0x195720){var _0x2dc6f1={'method':_0xd8e6('0xb'),'uri':_0x293e5f+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x32fdb2+'&'+_0x41c097,'auth':_0x2ee077,'json':!![]};return rp(_0x2dc6f1)['then'](function(_0x428aef){if(_0x428aef[_0xd8e6('0xc')][_0xd8e6('0xd')]>0x0){_0x4572f7['adminId']=_0x428aef[_0xd8e6('0xc')][0x0][_0xd8e6('0xe')];}logger['info']('['+[_0x5146b9[_0xd8e6('0xf')]()]+'],\x20getAdminUser\x20crm',_0x4572f7);_0x21961d(_0x4572f7);})[_0xd8e6('0x10')](function(_0x7fe891){logger['error']('['+[_0x5146b9['toUpperCase']()]+']',_0x7fe891['message']);_0x195720(_0x7fe891[_0xd8e6('0x11')]);});});}function getUser(_0x2aa218,_0x5a4be5,_0x1f9d42,_0x47c5b5,_0x405caf){return function(_0x42eec2){logger['info']('['+[_0x2aa218[_0xd8e6('0xf')]()]+'],\x20getUser\x20input\x20crm',_0x42eec2);return new Promise(function(_0x1a5766,_0x270e20){if(intUtil['validateEmail'](_0x42eec2[_0xd8e6('0x12')])){var _0x308104={'method':_0xd8e6('0xb'),'uri':_0x1f9d42+_0xd8e6('0x13')+_0x42eec2[_0xd8e6('0x12')]+'&'+_0x47c5b5+'&'+_0x405caf,'auth':_0x5a4be5,'json':!![]};logger[_0xd8e6('0x14')]('['+[_0x2aa218[_0xd8e6('0xf')]()]+_0xd8e6('0x15'),_0x308104);return rp(_0x308104)[_0xd8e6('0x16')](function(_0x2baafc){logger['info']('['+[_0x2aa218[_0xd8e6('0xf')]()]+_0xd8e6('0x17'),_0x2baafc);if(_0x2baafc[_0xd8e6('0xc')][_0xd8e6('0xd')]>0x0&&String(_0x2baafc[_0xd8e6('0xc')][0x0]['active'])===_0xd8e6('0x18')){_0x42eec2[_0xd8e6('0x19')]=_0x2baafc[_0xd8e6('0xc')][0x0]['sys_id'];}else{_0x42eec2[_0xd8e6('0x19')]=_0x42eec2[_0xd8e6('0x1a')];_0x42eec2['userEmail']=_0x42eec2[_0xd8e6('0x1b')];}logger[_0xd8e6('0x14')]('['+[_0x2aa218[_0xd8e6('0xf')]()]+_0xd8e6('0x1c'),_0x42eec2);_0x1a5766(_0x42eec2);})['catch'](function(_0x2cea14){logger['error']('['+[_0x2aa218[_0xd8e6('0xf')]()]+']',_0x2cea14[_0xd8e6('0x11')]);_0x270e20(_0x2cea14['message']);});}else{logger[_0xd8e6('0x14')]('['+[_0x2aa218[_0xd8e6('0xf')]()]+_0xd8e6('0x1d'));_0x42eec2['userId']=_0x42eec2[_0xd8e6('0x1a')];_0x42eec2['userEmail']=_0x42eec2['adminEmail'];_0x1a5766(_0x42eec2);}});};}function createEndUser(_0x4e5c42,_0x48fb8c,_0x4b109f,_0x2d25be,_0x121327){logger[_0xd8e6('0x14')]('['+[_0x4e5c42[_0xd8e6('0xf')]()]+_0xd8e6('0x1e'),_0x4b109f);return new Promise(function(_0x15a8c8,_0x7ccee9){var _0x3570ea={'method':_0xd8e6('0x1f'),'uri':_0x2d25be+'sys_user?'+_0x121327,'body':{'user_name':_0x4b109f[_0xd8e6('0x20')],'roles':_0xd8e6('0x21'),'first_name':_0x4b109f[_0xd8e6('0x20')],'active':'true','date_format':_0xd8e6('0x22'),'phone':_0x4b109f[_0xd8e6('0x20')]},'auth':_0x48fb8c,'json':!![]};return rp(_0x3570ea)[_0xd8e6('0x16')](function(_0x1bbde){logger[_0xd8e6('0x14')]('['+[_0x4e5c42[_0xd8e6('0xf')]()]+_0xd8e6('0x23'),_0x1bbde[_0xd8e6('0xc')]);_0x4b109f['endUserId']=_0x1bbde[_0xd8e6('0xc')][_0xd8e6('0xe')];_0x15a8c8(_0x4b109f);})[_0xd8e6('0x10')](function(_0xe37fd5){logger[_0xd8e6('0x24')]('['+[_0x4e5c42[_0xd8e6('0xf')]()]+']',_0xe37fd5[_0xd8e6('0x11')]);_0x7ccee9(_0xe37fd5[_0xd8e6('0x11')]);});});}function getEndUser(_0x5935cd,_0x418b3e,_0x2b5886,_0x43c1e9,_0x1576de){return function(_0x2a5f9c){logger[_0xd8e6('0x14')]('['+[_0x5935cd['toUpperCase']()]+_0xd8e6('0x25'),_0x2a5f9c);return new Promise(function(_0x4b0ff5,_0x5581b2){var _0x4411c9={'method':'GET','uri':_0x2b5886+'sys_user?sysparm_query=phone%3D'+_0x2a5f9c[_0xd8e6('0x20')]+'&'+_0x43c1e9+'&'+_0x1576de,'auth':_0x418b3e,'json':!![]};return rp(_0x4411c9)[_0xd8e6('0x16')](function(_0xab9b52){if(_0xab9b52['result'][_0xd8e6('0xd')]>0x0){_0x2a5f9c[_0xd8e6('0x26')]=_0xab9b52['result'][0x0][_0xd8e6('0xe')];logger[_0xd8e6('0x14')]('['+[_0x5935cd[_0xd8e6('0xf')]()]+_0xd8e6('0x27'),_0x2a5f9c);_0x4b0ff5(_0x2a5f9c);}else{return createEndUser(_0x5935cd,_0x418b3e,_0x2a5f9c,_0x2b5886,_0x43c1e9)[_0xd8e6('0x16')](function(_0x5af96f){logger[_0xd8e6('0x14')]('['+[_0x5935cd[_0xd8e6('0xf')]()]+_0xd8e6('0x28'),_0x5af96f);_0x4b0ff5(_0x5af96f);});}})[_0xd8e6('0x10')](function(_0x35f83a){logger['error']('['+[_0x5935cd['toUpperCase']()]+']',_0x35f83a[_0xd8e6('0x11')]);_0x5581b2(_0x35f83a[_0xd8e6('0x11')]);});});};}function getCustomFields(_0x4566ea,_0x5746ee){var _0x4094a1={};if(_0x4566ea[_0xd8e6('0xd')]>0x0){_[_0xd8e6('0x29')](_0x4566ea,function(_0x58097b){if(_['includes'](['string',_0xd8e6('0x2a')],_0x58097b['type'])&&_0x58097b[_0xd8e6('0x2b')]&&!_0x58097b[_0xd8e6('0x2c')]){_0x4094a1[_0x58097b[_0xd8e6('0x2b')][_0xd8e6('0x2d')]()]=_0x58097b[_0xd8e6('0x2e')][_0xd8e6('0x2f')]();}else if(_[_0xd8e6('0x30')]([_0xd8e6('0x31'),_0xd8e6('0x2a')],_0x58097b['type'])&&_0x58097b[_0xd8e6('0x32')]&&_0x58097b['customField']){_0x4094a1[_0x58097b[_0xd8e6('0x32')][_0xd8e6('0x2d')]()]=_0x58097b[_0xd8e6('0x2e')][_0xd8e6('0x2f')]();}else if(_0x58097b[_0xd8e6('0x33')]===_0xd8e6('0x34')&&_0x58097b[_0xd8e6('0x35')]&&_0x58097b['idField']&&_0x58097b[_0xd8e6('0x2c')]){_0x4094a1[_0x58097b[_0xd8e6('0x32')][_0xd8e6('0x2d')]()]=_0x5746ee[_0x58097b[_0xd8e6('0x35')]][_0xd8e6('0x2f')]();}else if(_0x58097b[_0xd8e6('0x33')]===_0xd8e6('0x36')&&_0x58097b[_0xd8e6('0x37')]&&_0x58097b['Variable'][_0xd8e6('0x38')]&&_0x58097b[_0xd8e6('0x32')]&&_0x58097b[_0xd8e6('0x2c')]){_0x4094a1[_0x58097b[_0xd8e6('0x32')][_0xd8e6('0x2d')]()]=_0x5746ee[_0x58097b[_0xd8e6('0x37')][_0xd8e6('0x38')][_0xd8e6('0x2d')]()][_0xd8e6('0x2f')]();}});}return _0x4094a1;}function getTicket(_0x49d2b3,_0x3d08cd,_0x1f0816,_0x7e567a,_0x42c4d3,_0x3b4938){return function(_0x4c8f0f){logger[_0xd8e6('0x14')]('['+[_0x49d2b3[_0xd8e6('0xf')]()]+_0xd8e6('0x39'),_0x4c8f0f);return new Promise(function(_0x3fbaef,_0xba5096){var _0xa89e95=_0x49d2b3[_0xd8e6('0x2d')]()===_0xd8e6('0x3a')?_0x4c8f0f[_0xd8e6('0x19')]:_0x4c8f0f[_0xd8e6('0x26')];var _0x3676ec={'method':_0xd8e6('0x1f'),'uri':_0x1f0816+_0xd8e6('0x3b')+'?'+_0x3b4938,'body':Object[_0xd8e6('0x3c')]({},{'active':_0xd8e6('0x18'),'caller_id':_0xa89e95,'assigned_to':_0x4c8f0f[_0xd8e6('0x19')],'short_description':intUtil[_0xd8e6('0x3d')](_0x7e567a[_0xd8e6('0x3e')],_0x42c4d3,'\x20'),'description':intUtil['getString'](_0x7e567a[_0xd8e6('0x3f')],_0x42c4d3,'\x0a')},getCustomFields(_0x7e567a[_0xd8e6('0x40')],_0x42c4d3)),'auth':_0x3d08cd,'json':!![]};return rp(_0x3676ec)[_0xd8e6('0x16')](function(_0xb6d217){logger['info']('['+[_0x49d2b3[_0xd8e6('0xf')]()]+_0xd8e6('0x41'),_0xb6d217[_0xd8e6('0xc')]);_0x4c8f0f[_0xd8e6('0x42')]=_0xb6d217[_0xd8e6('0xc')][_0xd8e6('0xe')];_0x4c8f0f['ticketNumber']=_0xb6d217[_0xd8e6('0xc')]['number'];logger[_0xd8e6('0x14')]('['+[_0x49d2b3[_0xd8e6('0xf')]()]+_0xd8e6('0x43'),_0x4c8f0f);_0x3fbaef(_0x4c8f0f);})['catch'](function(_0xdff1ab){logger[_0xd8e6('0x24')]('['+[_0x49d2b3['toUpperCase']()]+']',_0xdff1ab['message']);_0xba5096(_0xdff1ab[_0xd8e6('0x11')]);});});};}function createRemoteTag(_0x430866,_0xddbf83,_0x5d54da,_0xc06a17){return new Promise(function(_0x12f692,_0x533953){var _0x13113a={'method':'POST','uri':_0x5d54da+_0xd8e6('0x44')+'?'+_0xc06a17,'body':{'short_description':_0x430866,'global':!![],'active':!![],'name':_0x430866},'auth':_0xddbf83,'json':!![]};return rp(_0x13113a)[_0xd8e6('0x16')](function(_0x2c3803){var _0x336f92=_0x2c3803[_0xd8e6('0xc')][_0xd8e6('0xe')];_0x12f692(_0x336f92);});});}function getRemoteTag(_0x4976fd,_0x414b57,_0x406e07,_0x129a95,_0x3f8796){return new Promise(function(_0x5e9b2b,_0x289772){var _0xe226e3={'method':_0xd8e6('0xb'),'uri':_0x406e07+_0xd8e6('0x44')+_0xd8e6('0x45')+_0x4976fd+'&'+_0x129a95,'auth':_0x414b57,'json':!![]};return rp(_0xe226e3)['then'](function(_0x560dc1){if(_0x560dc1['result']['length']>0x0){var _0x15aa23=_0x560dc1[_0xd8e6('0xc')][0x0][_0xd8e6('0xe')];_0x5e9b2b(_0x15aa23);}else{return createRemoteTag(_0x4976fd,_0x414b57,_0x406e07,_0x129a95)['then'](function(_0x1a9361){_0x5e9b2b(_0x1a9361);});}});});}function assignTagToIncident(_0x5db8b8,_0x396da2,_0x1e64da,_0x38fe5b,_0x283e8a){return new Promise(function(_0x27d75f,_0x4485b1){var _0x3e96ab={'method':'POST','uri':_0x1e64da+_0xd8e6('0x46')+'?'+_0x283e8a,'body':{'label':_0x5db8b8,'table':_0xd8e6('0x3b'),'id_type':_0xd8e6('0x47'),'table_key':_0x38fe5b[_0xd8e6('0x42')],'title':_0xd8e6('0x48')+_0x38fe5b['ticketNumber'],'id_display':_0x38fe5b['ticketNumber']},'auth':_0x396da2,'json':!![]};return rp(_0x3e96ab)[_0xd8e6('0x16')](function(_0x4a99c7){_0x27d75f();})[_0xd8e6('0x10')](function(){_0x27d75f();});});}function manageTags(_0x5f512a,_0x46fd69,_0x430d83,_0x3e9651,_0x21778b,_0x30e431,_0x39a53e){return new Promise(function(_0x308152,_0x54689d){var _0x5d4009=[];_0x46fd69[_0xd8e6('0x29')](function(_0x5b8a5f){_0x5d4009[_0xd8e6('0x49')](getRemoteTag(_0x5b8a5f,_0x430d83,_0x3e9651,_0x30e431,_0x39a53e));});return Promise['all'](_0x5d4009)[_0xd8e6('0x16')](function(_0x4495f3){if(_0x4495f3[_0xd8e6('0xd')]){logger[_0xd8e6('0x14')]('['+[_0x5f512a[_0xd8e6('0xf')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x4495f3);var _0x22cd6d=[];_0x4495f3[_0xd8e6('0x29')](function(_0x2ed229){_0x22cd6d[_0xd8e6('0x49')](assignTagToIncident(_0x2ed229,_0x430d83,_0x3e9651,_0x21778b,_0x30e431));});return Promise['all'](_0x22cd6d)[_0xd8e6('0x16')](function(){_0x308152();})['catch'](function(){_0x308152();});}else{_0x308152();}});});}function getTags(_0x328e8b,_0x9ad1da,_0x1b286a,_0x5982a5,_0xbf5bab,_0x11fa9f){return function(_0x12958e){return new Promise(function(_0x42d80c,_0x272921){var _0x503c68=[];var _0x56754e=_0x5982a5[_0xd8e6('0x4a')];if(_0x56754e&&_0x56754e[_0xd8e6('0xd')]>0x0){_0x503c68=_[_0xd8e6('0x4b')](_0x56754e,_0xd8e6('0x38'));}if(_0x503c68[_0xd8e6('0xd')]>0x0){return manageTags(_0x328e8b,_0x503c68,_0x9ad1da,_0x1b286a,_0x12958e,_0xbf5bab,_0x11fa9f)[_0xd8e6('0x16')](function(){_0x42d80c(_0x12958e);});}else{_0x42d80c(_0x12958e);}});};}function emit(_0x378364,_0x58800f,_0x53dfd2){var _0x521b50='%26sysparm_record_target%3Dincident'+_0xd8e6('0x4c')+_0xd8e6('0x4d')+'%255EORDERBYDESCnumber';var _0x8b324d={'uri':_0x378364+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x53dfd2+_0x521b50};io['to'](util['format'](_0xd8e6('0x4e'),_0x58800f))['emit']('trigger:browser:url',_0x8b324d);}exports['cs']=function(_0x21de14,_0x588ae8,_0x4c8e19,_0x19e4c3,_0x4a3cfa,_0x21c226,_0x212ca1,_0x1fc108){var _0xe0e479={};var _0x790e3e={'user':_0x21c226['username'],'pass':_0x21c226['password']};var _0xa8c879='sysparm_limit=1';var _0x1c3bf8='sysparm_display_value=true';_0x21c226[_0xd8e6('0x4f')]=intUtil[_0xd8e6('0x50')](_0x21c226['remoteUri']);_0x21c226['serverUrl']=intUtil['stripTrailingSlash'](_0x21c226[_0xd8e6('0x51')]);var _0x7de45f=util['format'](_0xd8e6('0x52'),_0x21c226[_0xd8e6('0x4f')]);_0xe0e479[_0xd8e6('0x12')]=!_[_0xd8e6('0x53')](_0x19e4c3)?_0x19e4c3[_0xd8e6('0x54')]:null;_0xe0e479[_0xd8e6('0x1b')]=_0x21c226['email'];_0xe0e479['endUserNumber']=_0x1fc108[_0xd8e6('0x2d')]()===_0xd8e6('0x3a')?_0x588ae8[_0xd8e6('0x55')]:_0x588ae8[_0xd8e6('0x56')];_0xe0e479[_0xd8e6('0x57')]=_0x1fc108==='queue'||_0x1fc108===_0xd8e6('0x58')?_0xd8e6('0x59'):_0xd8e6('0x3a');var _0x47c504=util[_0xd8e6('0x5a')](_0xd8e6('0x5b'),_0x21c226[_0xd8e6('0x51')],_0x588ae8[_0xd8e6('0x5c')],md5(_0x588ae8[_0xd8e6('0x5c')]));if(_0x4a3cfa&&_0x4a3cfa[_0xd8e6('0x5d')]){logger[_0xd8e6('0x14')]('[QUEUE]',_0xd8e6('0x5e'));_0x588ae8[_0xd8e6('0x5f')]=_0x47c504;}else if(_0x212ca1&&_0x212ca1[_0xd8e6('0x60')]&&_0x212ca1['recordingFormat']!==_0xd8e6('0x61')){logger['info']('[OUTBOUND]',_0xd8e6('0x5e'));_0x588ae8[_0xd8e6('0x5f')]=_0x47c504;}else{_0x588ae8[_0xd8e6('0x5f')]='';}return getAdminUser(_0x1fc108,_0x790e3e,_0xe0e479,_0x7de45f,_0x1c3bf8,_0xa8c879)[_0xd8e6('0x16')](getUser(_0x1fc108,_0x790e3e,_0x7de45f,_0x1c3bf8,_0xa8c879))[_0xd8e6('0x16')](getEndUser(_0x1fc108,_0x790e3e,_0x7de45f,_0x1c3bf8,_0xa8c879))['then'](getTicket(_0x1fc108,_0x790e3e,_0x7de45f,_0x4c8e19,_0x588ae8,_0x1c3bf8))['then'](function(_0x60b00f){logger['info'](util[_0xd8e6('0x5a')](_0xd8e6('0x62'),_0x60b00f[_0xd8e6('0x42')]));logger['info'](util['format']('call\x20direction:\x20%s',_0x1fc108));if(_0x1fc108!=='unmanaged'){logger[_0xd8e6('0x14')]('['+[_0x1fc108[_0xd8e6('0xf')]()]+']',_0xd8e6('0x63'));emit(_0x21c226['remoteUri'],_0x19e4c3[_0xd8e6('0x38')],_0x60b00f['ticketId']);}})[_0xd8e6('0x10')](function(_0x31d781){logger[_0xd8e6('0x24')]('['+[_0x1fc108[_0xd8e6('0xf')]()]+_0xd8e6('0x64'),util[_0xd8e6('0x65')](_0x31d781,{'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 09c2db5..36ad35d 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 _0xc415=['The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','version','lastevent','toUpperCase','isNil','lodash','request-promise','bluebird','md5','util','./util','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','description','toISOString','replace','duration_hours','duration_minutes','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Basic\x20%s','apiKey','toString','base64','get_server_info','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','name_value_list','Agent\x20found!','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','phone_home','then','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','debug','[HTTP]','merge','map','type','string','customField','nameField','content','custom_fields','variable','customVariable','Variable','toLowerCase','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum'];(function(_0x1577a7,_0x542b54){var _0x3618e2=function(_0x3300b6){while(--_0x3300b6){_0x1577a7['push'](_0x1577a7['shift']());}};_0x3618e2(++_0x542b54);}(_0xc415,0x17b));var _0x5c41=function(_0x5c5327,_0x56ee95){_0x5c5327=_0x5c5327-0x0;var _0x58a447=_0xc415[_0x5c5327];return _0x58a447;};'use strict';var _=require(_0x5c41('0x0'));var rp=require(_0x5c41('0x1'));var BPromise=require(_0x5c41('0x2'));var md5=require(_0x5c41('0x3'));var util=require(_0x5c41('0x4'));var Redis=require('ioredis');var intUtil=require(_0x5c41('0x5'));var config=require('../../../../config/environment');var logger=require(_0x5c41('0x6'))(_0x5c41('0x7'));config[_0x5c41('0x8')]=_[_0x5c41('0x9')](config['redis'],{'host':_0x5c41('0xa'),'port':0x18eb});var io=require(_0x5c41('0xb'))(new Redis(config[_0x5c41('0x8')]));var def={'method':_0x5c41('0xc'),'json':!![]};function emit(_0x4cd759,_0x212559,_0x125513){io['to'](_0x4cd759)[_0x5c41('0xd')](_0x212559,_0x125513);}function getTicket(_0x152b28,_0x175c7d,_0x32a3a5,_0x1db4c1,_0x748c54,_0x5f4ed4,_0x271f18,_0x2128ba){logger[_0x5c41('0xe')](_0x5c41('0xf'));var _0x260563=new Date();var _0x583889=[{'name':_0x5c41('0x10'),'value':intUtil[_0x5c41('0x11')](_0x1db4c1[_0x5c41('0x12')],_0x748c54,'\x20')},{'name':'assigned_user_id','value':_0x175c7d['id']},{'name':'created_by','value':_0x175c7d['id']},{'name':_0x5c41('0x13'),'value':intUtil[_0x5c41('0x11')](_0x1db4c1['Descriptions'],_0x748c54,'\x0a')},{'name':'date_start','value':_0x260563[_0x5c41('0x14')]()['slice'](0x0,0x13)[_0x5c41('0x15')]('T','\x20')},{'name':_0x5c41('0x16'),'value':'0'},{'name':_0x5c41('0x17'),'value':'15'},{'name':'parent_id','value':_0x32a3a5['id']},{'name':'parent_type','value':_0x5c41('0x18')},{'name':_0x5c41('0x19'),'value':_0x32a3a5[_0x5c41('0x10')]},{'name':_0x5c41('0x1a'),'value':_0x2128ba}];if(_0x5f4ed4[_0x5c41('0x1b')]){_[_0x5c41('0x1c')](_0x5f4ed4,function(_0x5d409b){if(_0x748c54[_0x5d409b[_0x5c41('0x1d')]]){_0x583889[_0x5c41('0x1e')]({'name':_0x5d409b[_0x5c41('0x1f')],'value':_0x748c54[_0x5d409b['variableName']]});}});}return request({'form':{'method':_0x5c41('0x20'),'input_type':_0x5c41('0x21'),'response_type':_0x5c41('0x21'),'rest_data':JSON[_0x5c41('0x22')]({'session':_0x271f18['id'],'module_name':'Calls','name_value_list':_0x583889})}});}function getAuth(_0xbac826){return util['format'](_0x5c41('0x23'),new Buffer(_0xbac826[_0x5c41('0x24')]+':X')[_0x5c41('0x25')](_0x5c41('0x26')));}function getServerInfo(_0x418a9f){return request({'form':{'method':_0x5c41('0x27'),'input_type':'JSON','response_type':_0x5c41('0x21'),'rest_data':JSON[_0x5c41('0x22')]({'session':_0x418a9f['id']})}});}function getUser(_0x196428,_0x351b45,_0x387eb7){if(!_['isNil'](_0x351b45)){logger['info']('Getting\x20agent\x20with\x20name',_0x351b45);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x5c41('0x21'),'rest_data':JSON[_0x5c41('0x22')]({'session':_0x387eb7['id'],'module_name':_0x5c41('0x28'),'query':util[_0x5c41('0x29')](_0x5c41('0x2a'),_0x351b45),'order_by':'','offset':'0','select_fields':['id',_0x5c41('0x10'),_0x5c41('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1426f2){if(_0x1426f2['entry_list']['length']){var _0x4f14c9=_['find'](_0x1426f2[_0x5c41('0x2c')],function(_0x39ca57){return _0x39ca57[_0x5c41('0x2d')][_0x5c41('0x2b')]['value']===_0x351b45;});if(_0x4f14c9){logger[_0x5c41('0xe')](_0x5c41('0x2e'));return BPromise['resolve']({'id':_0x4f14c9[_0x5c41('0x2d')]['id'][_0x5c41('0x2f')],'name':_0x4f14c9[_0x5c41('0x2d')][_0x5c41('0x10')][_0x5c41('0x2f')]});}}logger['info'](_0x5c41('0x30'));return BPromise[_0x5c41('0x31')]({'id':_0x387eb7['name_value_list']['user_id'][_0x5c41('0x2f')],'name':_0x387eb7[_0x5c41('0x2d')][_0x5c41('0x2b')][_0x5c41('0x2f')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x5c41('0x31')]({'id':_0x387eb7[_0x5c41('0x2d')][_0x5c41('0x32')]['value'],'name':_0x387eb7['name_value_list'][_0x5c41('0x2b')][_0x5c41('0x2f')]});}}function getEndUser(_0x193f2d,_0x2cb8c1,_0x53c27b,_0x1010be){logger[_0x5c41('0xe')](_0x5c41('0x33'),_0x53c27b);return request({'form':{'method':_0x5c41('0x34'),'input_type':'JSON','response_type':_0x5c41('0x21'),'rest_data':JSON[_0x5c41('0x22')]({'session':_0x1010be['id'],'module_name':_0x5c41('0x18'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x53c27b),'order_by':'','offset':'0','select_fields':['id',_0x5c41('0x10'),_0x5c41('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x5c41('0x36')](function(_0x138fc4){if(_0x138fc4[_0x5c41('0x2c')][_0x5c41('0x1b')]){var _0x181115=_[_0x5c41('0x37')](_0x138fc4[_0x5c41('0x2c')],function(_0x15fe05){return _0x15fe05[_0x5c41('0x2d')][_0x5c41('0x35')]['value']===_0x53c27b;});if(_0x181115){logger[_0x5c41('0xe')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x181115[_0x5c41('0x2d')]['id']['value'],'name':_0x181115[_0x5c41('0x2d')][_0x5c41('0x10')][_0x5c41('0x2f')],'phone':_0x181115[_0x5c41('0x2d')][_0x5c41('0x35')][_0x5c41('0x2f')]});}}else{logger[_0x5c41('0xe')](_0x5c41('0x38'));return request({'form':{'method':_0x5c41('0x20'),'input_type':_0x5c41('0x21'),'response_type':_0x5c41('0x21'),'rest_data':JSON[_0x5c41('0x22')]({'session':_0x1010be['id'],'module_name':_0x5c41('0x18'),'name_value_list':[{'name':_0x5c41('0x39'),'value':_0x2cb8c1!==''?_0x2cb8c1:util[_0x5c41('0x29')]('Caller\x20-\x20%s',_0x53c27b)},{'name':'phone_home','value':_0x53c27b}]})}})[_0x5c41('0x36')](function(_0x583f21){logger[_0x5c41('0xe')]('Enduser\x20created.');return BPromise[_0x5c41('0x31')]({'id':_0x583f21['id'],'name':_0x583f21[_0x5c41('0x2c')]['first_name'][_0x5c41('0x2f')],'phone':_0x583f21[_0x5c41('0x2c')][_0x5c41('0x35')][_0x5c41('0x2f')]});});}});}function request(_0x2c352b){logger[_0x5c41('0x3a')](_0x5c41('0x3b'),JSON[_0x5c41('0x22')](_0x2c352b));return rp(_[_0x5c41('0x3c')](def,_0x2c352b));}function getTags(_0x382901,_0x22e845){var _0x28baae=[];if(_0x382901&&_0x382901[_0x5c41('0x1b')]>0x0){_0x28baae=_[_0x5c41('0x3d')](_0x382901,_0x22e845);}return _0x28baae;}function getCustomFields(_0x401aa3,_0x254f2a){var _0x328636=[];var _0x13f7d2={'custom_fields':[]};if(_0x401aa3[_0x5c41('0x1b')]>0x0){_['forEach'](_0x401aa3,function(_0x2f811e){if(_0x2f811e[_0x5c41('0x3e')]===_0x5c41('0x3f')&&_0x2f811e['nameField']&&!_0x2f811e[_0x5c41('0x40')]){_0x13f7d2[_0x2f811e[_0x5c41('0x41')]['toLowerCase']()]=_0x2f811e[_0x5c41('0x42')]['toString']();}else if(_0x2f811e[_0x5c41('0x3e')]==='string'&&_0x2f811e[_0x5c41('0x1f')]&&_0x2f811e['customField']){_0x13f7d2[_0x5c41('0x43')][_0x5c41('0x1e')]({'id':_0x2f811e['idField'],'value':_0x2f811e['content'][_0x5c41('0x25')]()});}else if(_0x2f811e[_0x5c41('0x3e')]===_0x5c41('0x44')&&_0x2f811e[_0x5c41('0x1d')]&&_0x2f811e['idField']&&_0x2f811e[_0x5c41('0x40')]){_0x254f2a[_0x2f811e[_0x5c41('0x1d')]]&&_0x13f7d2[_0x5c41('0x43')][_0x5c41('0x1e')]({'id':_0x2f811e[_0x5c41('0x1f')],'value':_0x254f2a[_0x2f811e[_0x5c41('0x1d')]][_0x5c41('0x25')]()});}else if(_0x2f811e[_0x5c41('0x3e')]===_0x5c41('0x45')&&_0x2f811e[_0x5c41('0x46')]&&_0x2f811e['Variable'][_0x5c41('0x10')]&&_0x2f811e[_0x5c41('0x1f')]&&_0x2f811e['customField']){_0x254f2a[_0x2f811e[_0x5c41('0x46')]['name'][_0x5c41('0x47')]()]&&_0x13f7d2[_0x5c41('0x43')]['push']({'id':_0x2f811e[_0x5c41('0x1f')],'value':_0x254f2a[_0x2f811e[_0x5c41('0x46')][_0x5c41('0x10')][_0x5c41('0x47')]()][_0x5c41('0x25')]()});}});}return _0x13f7d2;}function getConnection(_0x45bd0e){return request({'method':_0x5c41('0xc'),'form':{'method':_0x5c41('0x48'),'input_type':_0x5c41('0x21'),'response_type':'JSON','rest_data':JSON[_0x5c41('0x22')]({'user_auth':{'user_name':_0x45bd0e[_0x5c41('0x49')],'password':_0x45bd0e[_0x5c41('0x4a')],'encryption':_0x5c41('0x4b')},'application':_0x5c41('0x4c')})}})[_0x5c41('0x36')](function(_0x5aed92){var _0x43b598=_0x5aed92;if(_0x43b598['id']){def['sessionID']=_0x43b598['id'];return BPromise[_0x5c41('0x31')](_0x43b598);}else{throw new Error(util['format'](_0x5c41('0x4d'),_0x45bd0e['id']));}});}function setRelationship(_0x50b4a9,_0x4ff757,_0x4f451c,_0x21aad8){return request({'form':{'method':_0x5c41('0x4e'),'input_type':_0x5c41('0x21'),'response_type':'JSON','rest_data':JSON[_0x5c41('0x22')]({'session':_0x50b4a9['id'],'module_name':'Calls','module_id':_0x4f451c['id'],'link_field_name':_0x21aad8,'related_ids':[_0x4ff757['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x5c41('0x4f')]=function(_0xd74bf7,_0x3f571b,_0x56c124,_0x5cf0bb,_0x5429f3,_0x56363b){var _0x115e54,_0x44726c,_0x2d123f,_0x256b4b;_0x56363b['remoteUri']=intUtil[_0x5c41('0x50')](_0x56363b[_0x5c41('0x51')]);_0x56363b[_0x5c41('0x52')]=intUtil[_0x5c41('0x50')](_0x56363b[_0x5c41('0x52')]);def[_0x5c41('0x53')]=util['format'](_0x5c41('0x54'),_0x56363b[_0x5c41('0x51')]);if(_0x5429f3&&_0x5429f3[_0x5c41('0x55')]){logger[_0x5c41('0xe')]('[QUEUE]',_0x5c41('0x56'));_0x3f571b[_0x5c41('0x57')]=util[_0x5c41('0x29')](_0x5c41('0x58'),_0x56363b[_0x5c41('0x52')],_0x3f571b[_0x5c41('0x59')],md5(_0x3f571b['uniqueid']));}else{_0x3f571b[_0x5c41('0x57')]='';}return getConnection(_0x56363b)[_0x5c41('0x36')](function(_0x2324e2){_0x256b4b=_0x2324e2;return getUser(_0x56363b,_0x5cf0bb[_0x5c41('0x10')],_0x256b4b);})[_0x5c41('0x36')](function(_0x47611c){_0x115e54=_0x47611c;logger['info'](_0x5c41('0x5a'),_0x115e54['id']);return getEndUser(_0x56363b,_0x3f571b[_0x5c41('0x5b')],_0x3f571b[_0x5c41('0x5c')],_0x256b4b);})[_0x5c41('0x36')](function(_0x55a6f0){_0x44726c=_0x55a6f0;logger['info'](_0x5c41('0x5d'),_0x44726c['id']);return getTicket(_0x56363b,_0x115e54,_0x44726c,_0x56c124,_0x3f571b,_0x56c124[_0x5c41('0x5e')],_0x256b4b,_0x5c41('0x5f'));})[_0x5c41('0x36')](function(_0x51b099){_0x2d123f=_0x51b099;logger[_0x5c41('0xe')](_0x5c41('0x60'));logger['info'](_0x5c41('0x61'),_0x2d123f['id']);return setRelationship(_0x256b4b,_0x115e54,_0x2d123f,_0x5c41('0x62'));})[_0x5c41('0x36')](function(){return setRelationship(_0x256b4b,_0x44726c,_0x2d123f,_0x5c41('0x63'));})[_0x5c41('0x36')](function(){return getServerInfo(_0x256b4b);})[_0x5c41('0x36')](function(_0x55ed28){var _0x4b2446=parseInt(_0x55ed28['version'][_0x5c41('0x64')](0x0));var _0x382df9=util['format'](_0x5c41('0x65'),_0x56363b[_0x5c41('0x51')],_0x2d123f['id']);if(_0x4b2446>0x6){_0x382df9=util['format'](_0x5c41('0x66'),_0x56363b[_0x5c41('0x51')],_0x2d123f['id']);}logger[_0x5c41('0xe')](_0x5c41('0x67'),_0x5c41('0x68'));emit(util['format'](_0x5c41('0x69'),_0x5cf0bb['name']),'trigger:browser:url',{'uri':_0x382df9});})[_0x5c41('0x6a')](function(_0x2996cc){logger[_0x5c41('0x6b')](_0x5c41('0x67'),JSON[_0x5c41('0x22')](_0x2996cc));});};exports[_0x5c41('0x6c')]=function(_0x51685f,_0x344799,_0x316120,_0x2a6e00,_0x588e85,_0x3bed8d,_0x4cb92d){var _0x521972,_0x1874dc,_0x2b57b3,_0x4ea46a;_0x3bed8d['remoteUri']=intUtil[_0x5c41('0x50')](_0x3bed8d[_0x5c41('0x51')]);_0x3bed8d[_0x5c41('0x52')]=intUtil[_0x5c41('0x50')](_0x3bed8d[_0x5c41('0x52')]);def[_0x5c41('0x53')]=util[_0x5c41('0x29')](_0x5c41('0x54'),_0x3bed8d[_0x5c41('0x51')]);if(_0x4cb92d&&_0x4cb92d[_0x5c41('0x6d')]&&_0x4cb92d[_0x5c41('0x6d')]!==_0x5c41('0x6e')){logger['info'](_0x5c41('0x6f'),_0x5c41('0x56'));_0x344799['recordingURL']=util[_0x5c41('0x29')](_0x5c41('0x58'),_0x3bed8d[_0x5c41('0x52')],_0x344799[_0x5c41('0x59')],md5(_0x344799[_0x5c41('0x59')]));}return getConnection(_0x3bed8d)[_0x5c41('0x36')](function(_0x3b35bc){_0x4ea46a=_0x3b35bc;return getUser(_0x3bed8d,_0x2a6e00[_0x5c41('0x10')],_0x4ea46a);})['then'](function(_0x467038){_0x521972=_0x467038;logger['info'](_0x5c41('0x5a'),_0x521972['id']);return getEndUser(_0x3bed8d,_0x344799[_0x5c41('0x70')],_0x344799[_0x5c41('0x71')],_0x4ea46a);})[_0x5c41('0x36')](function(_0x2cd377){_0x1874dc=_0x2cd377;logger['info'](_0x5c41('0x5d'),_0x1874dc['id']);return getTicket(_0x3bed8d,_0x521972,_0x1874dc,_0x316120,_0x344799,_0x316120['Fields'],_0x4ea46a,'Outbound');})['then'](function(_0x103c42){_0x2b57b3=_0x103c42;logger['info'](_0x5c41('0x60'));logger['info'](_0x5c41('0x61'),_0x2b57b3['id']);return setRelationship(_0x4ea46a,_0x521972,_0x2b57b3,_0x5c41('0x62'));})[_0x5c41('0x36')](function(){return setRelationship(_0x4ea46a,_0x1874dc,_0x2b57b3,_0x5c41('0x63'));})[_0x5c41('0x36')](function(){return getServerInfo(_0x4ea46a);})[_0x5c41('0x36')](function(_0x45ab77){var _0x3392e9=parseInt(_0x45ab77[_0x5c41('0x72')][_0x5c41('0x64')](0x0));var _0x50fb8f=util[_0x5c41('0x29')](_0x5c41('0x65'),_0x3bed8d['remoteUri'],_0x2b57b3['id']);if(_0x3392e9>0x6){_0x50fb8f=util[_0x5c41('0x29')](_0x5c41('0x66'),_0x3bed8d[_0x5c41('0x51')],_0x2b57b3['id']);}logger[_0x5c41('0xe')](_0x5c41('0x6f'),_0x5c41('0x68'));emit(util['format'](_0x5c41('0x69'),_0x2a6e00['name']),'trigger:browser:url',{'uri':_0x50fb8f});})[_0x5c41('0x6a')](function(_0x144427){logger[_0x5c41('0x6b')](_0x5c41('0x6f'),JSON[_0x5c41('0x22')](_0x144427));});};exports['unmanaged']=function(_0x24b05d,_0x4ee3db,_0x46c734,_0x556fd2,_0x582999,_0x10902f){var _0x503f70,_0x5d55d5,_0x28ced1,_0x51288c;_0x10902f[_0x5c41('0x51')]=intUtil['stripTrailingSlash'](_0x10902f[_0x5c41('0x51')]);_0x10902f[_0x5c41('0x52')]=intUtil[_0x5c41('0x50')](_0x10902f[_0x5c41('0x52')]);def['uri']=util[_0x5c41('0x29')]('%s/service/v4_1/rest.php',_0x10902f[_0x5c41('0x51')]);if(_0x582999&&_0x582999[_0x5c41('0x55')]){logger[_0x5c41('0xe')]('['+_0x4ee3db[_0x5c41('0x73')][_0x5c41('0x74')]()+']','Recording\x20is\x20enabled!');_0x4ee3db[_0x5c41('0x57')]=util[_0x5c41('0x29')](_0x5c41('0x58'),_0x10902f[_0x5c41('0x52')],_0x4ee3db[_0x5c41('0x59')],md5(_0x4ee3db[_0x5c41('0x59')]));}else{_0x4ee3db[_0x5c41('0x57')]='';}return getConnection(_0x10902f)['then'](function(_0xabc5c3){_0x51288c=_0xabc5c3;if(!_[_0x5c41('0x75')](_0x556fd2)){return getUser(_0x10902f,_0x556fd2[_0x5c41('0x10')],_0x51288c);}else{return getUser(_0x10902f,null,_0x51288c);}})[_0x5c41('0x36')](function(_0x5b7f61){_0x503f70=_0x5b7f61;logger[_0x5c41('0xe')](_0x5c41('0x5a'),_0x503f70['id']);return getEndUser(_0x10902f,_0x4ee3db[_0x5c41('0x5b')],_0x4ee3db['calleridnum'],_0x51288c);})[_0x5c41('0x36')](function(_0xe528fc){_0x5d55d5=_0xe528fc;logger[_0x5c41('0xe')]('The\x20Enduser\x20ID\x20is:',_0x5d55d5['id']);return getTicket(_0x10902f,_0x503f70,_0x5d55d5,_0x46c734,_0x4ee3db,_0x46c734['Fields'],_0x51288c,'Inbound');})[_0x5c41('0x36')](function(_0x5c5c10){_0x28ced1=_0x5c5c10;logger[_0x5c41('0xe')](_0x5c41('0x60'));logger[_0x5c41('0xe')](_0x5c41('0x61'),_0x28ced1['id']);return setRelationship(_0x51288c,_0x503f70,_0x28ced1,_0x5c41('0x62'));})['then'](function(){return setRelationship(_0x51288c,_0x5d55d5,_0x28ced1,_0x5c41('0x63'));})[_0x5c41('0x36')](function(){return getServerInfo(_0x51288c);})['catch'](function(_0x336a8f){logger[_0x5c41('0x6b')]('['+_0x4ee3db[_0x5c41('0x73')][_0x5c41('0x74')]()+']',JSON['stringify'](_0x336a8f));});}; \ No newline at end of file +var _0x1ada=['get_server_info','get_entry_list','Employees','user_name','entry_list','length','find','name_value_list','value','Agent\x20found!','resolve','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','then','Enduser\x20found!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','forEach','string','nameField','customField','toLowerCase','content','type','idField','variable','custom_fields','customVariable','Variable','login','username','password','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','charAt','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','outbound','uri','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','catch','unmanaged','monitor_format','toUpperCase','isNil','calleridname','contacts','lastevent','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','info','name','getString','Subjects','description','Descriptions','date_start','slice','replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','direction','push','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString'];(function(_0x544511,_0x4f65b2){var _0x4d0bbf=function(_0x325b3a){while(--_0x325b3a){_0x544511['push'](_0x544511['shift']());}};_0x4d0bbf(++_0x4f65b2);}(_0x1ada,0x147));var _0xa1ad=function(_0x463a04,_0x54445a){_0x463a04=_0x463a04-0x0;var _0x8c68bd=_0x1ada[_0x463a04];return _0x8c68bd;};'use strict';var _=require(_0xa1ad('0x0'));var rp=require(_0xa1ad('0x1'));var BPromise=require(_0xa1ad('0x2'));var md5=require('md5');var util=require(_0xa1ad('0x3'));var Redis=require(_0xa1ad('0x4'));var intUtil=require(_0xa1ad('0x5'));var config=require(_0xa1ad('0x6'));var logger=require(_0xa1ad('0x7'))(_0xa1ad('0x8'));config[_0xa1ad('0x9')]=_[_0xa1ad('0xa')](config[_0xa1ad('0x9')],{'host':_0xa1ad('0xb'),'port':0x18eb});var io=require(_0xa1ad('0xc'))(new Redis(config[_0xa1ad('0x9')]));var def={'method':_0xa1ad('0xd'),'json':!![]};function emit(_0x3408f8,_0x3fc2c8,_0xc0650f){io['to'](_0x3408f8)['emit'](_0x3fc2c8,_0xc0650f);}function getTicket(_0x4700e1,_0x15636d,_0x191750,_0x130a85,_0x288805,_0x52f6cc,_0x5eecd7,_0x46d61e){logger[_0xa1ad('0xe')]('Creating\x20new\x20ticket...');var _0x35b31e=new Date();var _0x733f81=[{'name':_0xa1ad('0xf'),'value':intUtil[_0xa1ad('0x10')](_0x130a85[_0xa1ad('0x11')],_0x288805,'\x20')},{'name':'assigned_user_id','value':_0x15636d['id']},{'name':'created_by','value':_0x15636d['id']},{'name':_0xa1ad('0x12'),'value':intUtil[_0xa1ad('0x10')](_0x130a85[_0xa1ad('0x13')],_0x288805,'\x0a')},{'name':_0xa1ad('0x14'),'value':_0x35b31e['toISOString']()[_0xa1ad('0x15')](0x0,0x13)[_0xa1ad('0x16')]('T','\x20')},{'name':_0xa1ad('0x17'),'value':'0'},{'name':_0xa1ad('0x18'),'value':'15'},{'name':'parent_id','value':_0x191750['id']},{'name':_0xa1ad('0x19'),'value':_0xa1ad('0x1a')},{'name':_0xa1ad('0x1b'),'value':_0x191750[_0xa1ad('0xf')]},{'name':_0xa1ad('0x1c'),'value':_0x46d61e}];if(_0x52f6cc['length']){_['forEach'](_0x52f6cc,function(_0x16f36e){if(_0x288805[_0x16f36e['variableName']]){_0x733f81[_0xa1ad('0x1d')]({'name':_0x16f36e['idField'],'value':_0x288805[_0x16f36e[_0xa1ad('0x1e')]]});}});}return request({'form':{'method':_0xa1ad('0x1f'),'input_type':_0xa1ad('0x20'),'response_type':_0xa1ad('0x20'),'rest_data':JSON[_0xa1ad('0x21')]({'session':_0x5eecd7['id'],'module_name':_0xa1ad('0x22'),'name_value_list':_0x733f81})}});}function getAuth(_0x145028){return util[_0xa1ad('0x23')](_0xa1ad('0x24'),new Buffer(_0x145028[_0xa1ad('0x25')]+':X')[_0xa1ad('0x26')]('base64'));}function getServerInfo(_0x443312){return request({'form':{'method':_0xa1ad('0x27'),'input_type':_0xa1ad('0x20'),'response_type':_0xa1ad('0x20'),'rest_data':JSON[_0xa1ad('0x21')]({'session':_0x443312['id']})}});}function getUser(_0x93e502,_0x5035c9,_0xe4d91b){if(!_['isNil'](_0x5035c9)){logger['info']('Getting\x20agent\x20with\x20name',_0x5035c9);return request({'form':{'method':_0xa1ad('0x28'),'input_type':_0xa1ad('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0xe4d91b['id'],'module_name':_0xa1ad('0x29'),'query':util[_0xa1ad('0x23')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x5035c9),'order_by':'','offset':'0','select_fields':['id',_0xa1ad('0xf'),_0xa1ad('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x155d66){if(_0x155d66[_0xa1ad('0x2b')][_0xa1ad('0x2c')]){var _0x4dd574=_[_0xa1ad('0x2d')](_0x155d66[_0xa1ad('0x2b')],function(_0x326ce7){return _0x326ce7[_0xa1ad('0x2e')][_0xa1ad('0x2a')][_0xa1ad('0x2f')]===_0x5035c9;});if(_0x4dd574){logger['info'](_0xa1ad('0x30'));return BPromise[_0xa1ad('0x31')]({'id':_0x4dd574[_0xa1ad('0x2e')]['id'][_0xa1ad('0x2f')],'name':_0x4dd574[_0xa1ad('0x2e')]['name']['value']});}}logger[_0xa1ad('0xe')](_0xa1ad('0x32'));return BPromise[_0xa1ad('0x31')]({'id':_0xe4d91b[_0xa1ad('0x2e')]['user_id'][_0xa1ad('0x2f')],'name':_0xe4d91b[_0xa1ad('0x2e')][_0xa1ad('0x2a')][_0xa1ad('0x2f')]});});}else{logger[_0xa1ad('0xe')](_0xa1ad('0x33'));return BPromise[_0xa1ad('0x31')]({'id':_0xe4d91b[_0xa1ad('0x2e')][_0xa1ad('0x34')][_0xa1ad('0x2f')],'name':_0xe4d91b[_0xa1ad('0x2e')]['user_name'][_0xa1ad('0x2f')]});}}function getEndUser(_0x32ff20,_0x170299,_0x4af6d3,_0x10d4b0){logger[_0xa1ad('0xe')](_0xa1ad('0x35'),_0x4af6d3);return request({'form':{'method':_0xa1ad('0x28'),'input_type':_0xa1ad('0x20'),'response_type':_0xa1ad('0x20'),'rest_data':JSON['stringify']({'session':_0x10d4b0['id'],'module_name':'Contacts','query':util['format'](_0xa1ad('0x36'),_0x4af6d3),'order_by':'','offset':'0','select_fields':['id','name',_0xa1ad('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa1ad('0x38')](function(_0x3414aa){if(_0x3414aa[_0xa1ad('0x2b')]['length']){var _0x2d3318=_['find'](_0x3414aa[_0xa1ad('0x2b')],function(_0xc7fda3){return _0xc7fda3[_0xa1ad('0x2e')][_0xa1ad('0x37')][_0xa1ad('0x2f')]===_0x4af6d3;});if(_0x2d3318){logger[_0xa1ad('0xe')](_0xa1ad('0x39'));return BPromise['resolve']({'id':_0x2d3318[_0xa1ad('0x2e')]['id'][_0xa1ad('0x2f')],'name':_0x2d3318[_0xa1ad('0x2e')]['name'][_0xa1ad('0x2f')],'phone':_0x2d3318[_0xa1ad('0x2e')][_0xa1ad('0x37')][_0xa1ad('0x2f')]});}}else{logger[_0xa1ad('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':'set_entry','input_type':_0xa1ad('0x20'),'response_type':_0xa1ad('0x20'),'rest_data':JSON[_0xa1ad('0x21')]({'session':_0x10d4b0['id'],'module_name':_0xa1ad('0x1a'),'name_value_list':[{'name':_0xa1ad('0x3a'),'value':_0x170299!==_0xa1ad('0x3b')?_0x170299:util[_0xa1ad('0x23')](_0xa1ad('0x3c'),_0x4af6d3)},{'name':_0xa1ad('0x37'),'value':_0x4af6d3}]})}})[_0xa1ad('0x38')](function(_0x152b9c){logger['info'](_0xa1ad('0x3d'));return BPromise['resolve']({'id':_0x152b9c['id'],'name':_0x152b9c[_0xa1ad('0x2b')]['first_name'][_0xa1ad('0x2f')],'phone':_0x152b9c[_0xa1ad('0x2b')][_0xa1ad('0x37')][_0xa1ad('0x2f')]});});}});}function request(_0x277f09){logger[_0xa1ad('0x3e')](_0xa1ad('0x3f'),JSON[_0xa1ad('0x21')](_0x277f09));return rp(_[_0xa1ad('0x40')](def,_0x277f09));}function getTags(_0x352268,_0x5c74e7){var _0x8db883=[];if(_0x352268&&_0x352268[_0xa1ad('0x2c')]>0x0){_0x8db883=_['map'](_0x352268,_0x5c74e7);}return _0x8db883;}function getCustomFields(_0x5de61c,_0xc67845){var _0x2705e3=[];var _0x501cf1={'custom_fields':[]};if(_0x5de61c['length']>0x0){_[_0xa1ad('0x41')](_0x5de61c,function(_0x26e894){if(_0x26e894['type']===_0xa1ad('0x42')&&_0x26e894[_0xa1ad('0x43')]&&!_0x26e894[_0xa1ad('0x44')]){_0x501cf1[_0x26e894['nameField'][_0xa1ad('0x45')]()]=_0x26e894[_0xa1ad('0x46')][_0xa1ad('0x26')]();}else if(_0x26e894[_0xa1ad('0x47')]===_0xa1ad('0x42')&&_0x26e894[_0xa1ad('0x48')]&&_0x26e894[_0xa1ad('0x44')]){_0x501cf1['custom_fields'][_0xa1ad('0x1d')]({'id':_0x26e894[_0xa1ad('0x48')],'value':_0x26e894['content'][_0xa1ad('0x26')]()});}else if(_0x26e894[_0xa1ad('0x47')]===_0xa1ad('0x49')&&_0x26e894[_0xa1ad('0x1e')]&&_0x26e894[_0xa1ad('0x48')]&&_0x26e894['customField']){_0xc67845[_0x26e894[_0xa1ad('0x1e')]]&&_0x501cf1[_0xa1ad('0x4a')][_0xa1ad('0x1d')]({'id':_0x26e894[_0xa1ad('0x48')],'value':_0xc67845[_0x26e894[_0xa1ad('0x1e')]][_0xa1ad('0x26')]()});}else if(_0x26e894[_0xa1ad('0x47')]===_0xa1ad('0x4b')&&_0x26e894[_0xa1ad('0x4c')]&&_0x26e894['Variable'][_0xa1ad('0xf')]&&_0x26e894[_0xa1ad('0x48')]&&_0x26e894[_0xa1ad('0x44')]){_0xc67845[_0x26e894[_0xa1ad('0x4c')][_0xa1ad('0xf')]['toLowerCase']()]&&_0x501cf1['custom_fields'][_0xa1ad('0x1d')]({'id':_0x26e894[_0xa1ad('0x48')],'value':_0xc67845[_0x26e894[_0xa1ad('0x4c')]['name'][_0xa1ad('0x45')]()]['toString']()});}});}return _0x501cf1;}function getConnection(_0x34d5e9){return request({'method':_0xa1ad('0xd'),'form':{'method':_0xa1ad('0x4d'),'input_type':_0xa1ad('0x20'),'response_type':_0xa1ad('0x20'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x34d5e9[_0xa1ad('0x4e')],'password':_0x34d5e9[_0xa1ad('0x4f')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0xa1ad('0x38')](function(_0x2d8fcf){var _0x1baebf=_0x2d8fcf;if(_0x1baebf['id']){def[_0xa1ad('0x50')]=_0x1baebf['id'];return BPromise['resolve'](_0x1baebf);}else{throw new Error(util[_0xa1ad('0x23')](_0xa1ad('0x51'),_0x34d5e9['id']));}});}function setRelationship(_0x31079f,_0x4401f5,_0x3f1e0c,_0x240de8){return request({'form':{'method':_0xa1ad('0x52'),'input_type':_0xa1ad('0x20'),'response_type':_0xa1ad('0x20'),'rest_data':JSON[_0xa1ad('0x21')]({'session':_0x31079f['id'],'module_name':_0xa1ad('0x22'),'module_id':_0x3f1e0c['id'],'link_field_name':_0x240de8,'related_ids':[_0x4401f5['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x2e94a0,_0x27c7c5,_0x2c87a9,_0x1821ac,_0x22c79d,_0x6fb549){var _0x4ff8ed,_0x11babe,_0x2f3a18,_0x41e45e;_0x6fb549[_0xa1ad('0x53')]=intUtil[_0xa1ad('0x54')](_0x6fb549[_0xa1ad('0x53')]);_0x6fb549[_0xa1ad('0x55')]=intUtil[_0xa1ad('0x54')](_0x6fb549[_0xa1ad('0x55')]);def['uri']=util['format'](_0xa1ad('0x56'),_0x6fb549['remoteUri']);if(_0x22c79d&&_0x22c79d['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x27c7c5['recordingURL']=util[_0xa1ad('0x23')](_0xa1ad('0x57'),_0x6fb549[_0xa1ad('0x55')],_0x27c7c5['uniqueid'],md5(_0x27c7c5[_0xa1ad('0x58')]));}else{_0x27c7c5[_0xa1ad('0x59')]='';}return getConnection(_0x6fb549)[_0xa1ad('0x38')](function(_0x381563){_0x41e45e=_0x381563;return getUser(_0x6fb549,_0x1821ac[_0xa1ad('0xf')],_0x41e45e);})['then'](function(_0x4ee1ab){_0x4ff8ed=_0x4ee1ab;logger['info'](_0xa1ad('0x5a'),_0x4ff8ed['id']);return getEndUser(_0x6fb549,_0x27c7c5['calleridname'],_0x27c7c5[_0xa1ad('0x5b')],_0x41e45e);})['then'](function(_0x4ff59a){_0x11babe=_0x4ff59a;logger[_0xa1ad('0xe')](_0xa1ad('0x5c'),_0x11babe['id']);return getTicket(_0x6fb549,_0x4ff8ed,_0x11babe,_0x2c87a9,_0x27c7c5,_0x2c87a9[_0xa1ad('0x5d')],_0x41e45e,_0xa1ad('0x5e'));})[_0xa1ad('0x38')](function(_0x3c9159){_0x2f3a18=_0x3c9159;logger['info'](_0xa1ad('0x5f'));logger[_0xa1ad('0xe')](_0xa1ad('0x60'),_0x2f3a18['id']);return setRelationship(_0x41e45e,_0x4ff8ed,_0x2f3a18,_0xa1ad('0x61'));})[_0xa1ad('0x38')](function(){return setRelationship(_0x41e45e,_0x11babe,_0x2f3a18,'contacts');})[_0xa1ad('0x38')](function(){return getServerInfo(_0x41e45e);})[_0xa1ad('0x38')](function(_0x203b8d){var _0x155354=parseInt(_0x203b8d['version'][_0xa1ad('0x62')](0x0));var _0x45cd21=util['format']('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x6fb549[_0xa1ad('0x53')],_0x2f3a18['id']);if(_0x155354>0x6){_0x45cd21=util[_0xa1ad('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x6fb549['remoteUri'],_0x2f3a18['id']);}logger[_0xa1ad('0xe')](_0xa1ad('0x63'),_0xa1ad('0x64'));emit(util[_0xa1ad('0x23')]('user:%s',_0x1821ac[_0xa1ad('0xf')]),_0xa1ad('0x65'),{'uri':_0x45cd21});})['catch'](function(_0x4677ad){logger[_0xa1ad('0x66')](_0xa1ad('0x63'),JSON[_0xa1ad('0x21')](_0x4677ad));});};exports[_0xa1ad('0x67')]=function(_0x11df98,_0x359e0a,_0xbc1f7f,_0x4cc59f,_0x32dc02,_0x504a2b,_0x3fca19){var _0x2c7e1f,_0xf590a4,_0x18bb0d,_0x518b70;_0x504a2b['remoteUri']=intUtil['stripTrailingSlash'](_0x504a2b['remoteUri']);_0x504a2b[_0xa1ad('0x55')]=intUtil[_0xa1ad('0x54')](_0x504a2b[_0xa1ad('0x55')]);def[_0xa1ad('0x68')]=util[_0xa1ad('0x23')](_0xa1ad('0x56'),_0x504a2b[_0xa1ad('0x53')]);if(_0x3fca19&&_0x3fca19['recordingFormat']&&_0x3fca19[_0xa1ad('0x69')]!==_0xa1ad('0x6a')){logger[_0xa1ad('0xe')](_0xa1ad('0x6b'),_0xa1ad('0x6c'));_0x359e0a[_0xa1ad('0x59')]=util[_0xa1ad('0x23')](_0xa1ad('0x57'),_0x504a2b['serverUrl'],_0x359e0a[_0xa1ad('0x58')],md5(_0x359e0a[_0xa1ad('0x58')]));}return getConnection(_0x504a2b)[_0xa1ad('0x38')](function(_0x1d289b){_0x518b70=_0x1d289b;return getUser(_0x504a2b,_0x4cc59f[_0xa1ad('0xf')],_0x518b70);})[_0xa1ad('0x38')](function(_0x19095a){_0x2c7e1f=_0x19095a;logger[_0xa1ad('0xe')](_0xa1ad('0x5a'),_0x2c7e1f['id']);return getEndUser(_0x504a2b,_0x359e0a[_0xa1ad('0x6d')],_0x359e0a[_0xa1ad('0x6e')],_0x518b70);})[_0xa1ad('0x38')](function(_0x81c854){_0xf590a4=_0x81c854;logger[_0xa1ad('0xe')]('The\x20Enduser\x20ID\x20is:',_0xf590a4['id']);return getTicket(_0x504a2b,_0x2c7e1f,_0xf590a4,_0xbc1f7f,_0x359e0a,_0xbc1f7f[_0xa1ad('0x5d')],_0x518b70,'Outbound');})[_0xa1ad('0x38')](function(_0x280817){_0x18bb0d=_0x280817;logger[_0xa1ad('0xe')](_0xa1ad('0x5f'));logger[_0xa1ad('0xe')]('The\x20Ticket\x20ID\x20is:',_0x18bb0d['id']);return setRelationship(_0x518b70,_0x2c7e1f,_0x18bb0d,_0xa1ad('0x61'));})[_0xa1ad('0x38')](function(){return setRelationship(_0x518b70,_0xf590a4,_0x18bb0d,'contacts');})[_0xa1ad('0x38')](function(){return getServerInfo(_0x518b70);})[_0xa1ad('0x38')](function(_0x2a27b6){var _0x727adc=parseInt(_0x2a27b6[_0xa1ad('0x6f')][_0xa1ad('0x62')](0x0));var _0x438b46=util['format'](_0xa1ad('0x70'),_0x504a2b[_0xa1ad('0x53')],_0x18bb0d['id']);if(_0x727adc>0x6){_0x438b46=util[_0xa1ad('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x504a2b[_0xa1ad('0x53')],_0x18bb0d['id']);}logger['info']('[OUTBOUND]',_0xa1ad('0x64'));emit(util['format'](_0xa1ad('0x71'),_0x4cc59f[_0xa1ad('0xf')]),_0xa1ad('0x65'),{'uri':_0x438b46});})[_0xa1ad('0x72')](function(_0x2f23e4){logger[_0xa1ad('0x66')](_0xa1ad('0x6b'),JSON[_0xa1ad('0x21')](_0x2f23e4));});};exports[_0xa1ad('0x73')]=function(_0x423be8,_0xcf99b0,_0x418a49,_0x333a2b,_0x16567a,_0x1c54be){var _0x3d6a4d,_0x3094ba,_0x3b4336,_0x34657f;_0x1c54be[_0xa1ad('0x53')]=intUtil[_0xa1ad('0x54')](_0x1c54be[_0xa1ad('0x53')]);_0x1c54be['serverUrl']=intUtil[_0xa1ad('0x54')](_0x1c54be[_0xa1ad('0x55')]);def['uri']=util[_0xa1ad('0x23')](_0xa1ad('0x56'),_0x1c54be[_0xa1ad('0x53')]);if(_0x16567a&&_0x16567a[_0xa1ad('0x74')]){logger[_0xa1ad('0xe')]('['+_0xcf99b0['lastevent'][_0xa1ad('0x75')]()+']',_0xa1ad('0x6c'));_0xcf99b0['recordingURL']=util[_0xa1ad('0x23')](_0xa1ad('0x57'),_0x1c54be['serverUrl'],_0xcf99b0[_0xa1ad('0x58')],md5(_0xcf99b0[_0xa1ad('0x58')]));}else{_0xcf99b0[_0xa1ad('0x59')]='';}return getConnection(_0x1c54be)[_0xa1ad('0x38')](function(_0x13a874){_0x34657f=_0x13a874;if(!_[_0xa1ad('0x76')](_0x333a2b)){return getUser(_0x1c54be,_0x333a2b[_0xa1ad('0xf')],_0x34657f);}else{return getUser(_0x1c54be,null,_0x34657f);}})['then'](function(_0x35e967){_0x3d6a4d=_0x35e967;logger[_0xa1ad('0xe')](_0xa1ad('0x5a'),_0x3d6a4d['id']);return getEndUser(_0x1c54be,_0xcf99b0[_0xa1ad('0x77')],_0xcf99b0['calleridnum'],_0x34657f);})['then'](function(_0x4da86c){_0x3094ba=_0x4da86c;logger[_0xa1ad('0xe')](_0xa1ad('0x5c'),_0x3094ba['id']);return getTicket(_0x1c54be,_0x3d6a4d,_0x3094ba,_0x418a49,_0xcf99b0,_0x418a49['Fields'],_0x34657f,_0xa1ad('0x5e'));})[_0xa1ad('0x38')](function(_0x120dc1){_0x3b4336=_0x120dc1;logger[_0xa1ad('0xe')](_0xa1ad('0x5f'));logger[_0xa1ad('0xe')](_0xa1ad('0x60'),_0x3b4336['id']);return setRelationship(_0x34657f,_0x3d6a4d,_0x3b4336,'users');})['then'](function(){return setRelationship(_0x34657f,_0x3094ba,_0x3b4336,_0xa1ad('0x78'));})['then'](function(){return getServerInfo(_0x34657f);})[_0xa1ad('0x72')](function(_0x459ca9){logger[_0xa1ad('0x66')]('['+_0xcf99b0[_0xa1ad('0x79')][_0xa1ad('0x75')]()+']',JSON[_0xa1ad('0x21')](_0x459ca9));});}; \ 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 5dcaf31..d9ff285 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 _0x7ab4=['join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','util','getString','type','string','push','content','variable','variableName','toString','customVariable','Variable','toLowerCase','keyType','key','format','%s:\x20%s','name'];(function(_0x216e58,_0x497adc){var _0x5adcad=function(_0x22197f){while(--_0x22197f){_0x216e58['push'](_0x216e58['shift']());}};_0x5adcad(++_0x497adc);}(_0x7ab4,0x1b7));var _0x47ab=function(_0x1b6ae1,_0x7265ae){_0x1b6ae1=_0x1b6ae1-0x0;var _0x5843a2=_0x7ab4[_0x1b6ae1];return _0x5843a2;};'use strict';var _=require('lodash');var util=require(_0x47ab('0x0'));exports[_0x47ab('0x1')]=function(_0x42e4c4,_0x29401b,_0xa498a8){var _0x260c84=[];if(_0x42e4c4['length']>0x0){var _0x56c5e6=_['sortBy'](_0x42e4c4,['id']);for(var _0x471d54=0x0;_0x471d54<_0x56c5e6['length'];_0x471d54++){var _0x17f3d3=_0x56c5e6[_0x471d54];if(_0x17f3d3[_0x47ab('0x2')]===_0x47ab('0x3')){_0x260c84[_0x47ab('0x4')](_0x17f3d3[_0x47ab('0x5')]);}else if(_0x17f3d3[_0x47ab('0x2')]===_0x47ab('0x6')&&_0x17f3d3[_0x47ab('0x7')]){_0x29401b[_0x17f3d3[_0x47ab('0x7')]]&&_0x260c84[_0x47ab('0x4')](_0x29401b[_0x17f3d3[_0x47ab('0x7')]][_0x47ab('0x8')]());}else if(_0x17f3d3[_0x47ab('0x2')]===_0x47ab('0x9')&&_0x17f3d3[_0x47ab('0xa')]&&_0x17f3d3[_0x47ab('0xa')]['name']){_0x29401b[_0x17f3d3[_0x47ab('0xa')]['name'][_0x47ab('0xb')]()]&&_0x260c84[_0x47ab('0x4')](_0x29401b[_0x17f3d3['Variable']['name'][_0x47ab('0xb')]()][_0x47ab('0x8')]());}else if(_0x17f3d3[_0x47ab('0x2')]==='keyValue'){if(_0x17f3d3[_0x47ab('0xc')]===_0x47ab('0x3')&&_0x17f3d3[_0x47ab('0xd')]){_0x260c84[_0x47ab('0x4')](util[_0x47ab('0xe')](_0x47ab('0xf'),_0x17f3d3['key'],_0x17f3d3['keyContent']));}else if(_0x17f3d3[_0x47ab('0xc')]==='variable'&&_0x17f3d3[_0x47ab('0x7')]&&_0x17f3d3[_0x47ab('0xd')]){_0x29401b[_0x17f3d3[_0x47ab('0x7')]]&&_0x260c84[_0x47ab('0x4')](util['format'](_0x47ab('0xf'),_0x17f3d3[_0x47ab('0xd')],_0x29401b[_0x17f3d3[_0x47ab('0x7')]]));}else if(_0x17f3d3['keyType']==='customVariable'&&_0x17f3d3['Variable']&&_0x17f3d3[_0x47ab('0xa')]['name']&&_0x17f3d3['key']){_0x29401b[_0x17f3d3[_0x47ab('0xa')][_0x47ab('0x10')][_0x47ab('0xb')]()]&&_0x260c84[_0x47ab('0x4')](util[_0x47ab('0xe')](_0x47ab('0xf'),_0x17f3d3[_0x47ab('0xd')],_0x29401b[_0x17f3d3[_0x47ab('0xa')][_0x47ab('0x10')][_0x47ab('0xb')]()]));}}}}return _0x260c84[_0x47ab('0x11')](_0xa498a8);};exports[_0x47ab('0x12')]=function(_0x16b7d6){var _0x38ecfa=_0x16b7d6['slice'](-0x1);if(_0x38ecfa==='/'){_0x16b7d6=_0x16b7d6[_0x47ab('0x13')](0x0,_0x16b7d6[_0x47ab('0x14')](_0x38ecfa));}return _0x16b7d6;};exports[_0x47ab('0x15')]=function(_0xe1f3f3){if(!_[_0x47ab('0x16')](_0xe1f3f3)&&_0xe1f3f3!==''){var _0x3dad8f=/^(([^<>()\[\]\\.,;:\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 _0x3dad8f[_0x47ab('0x17')](String(_0xe1f3f3)[_0x47ab('0xb')]());}else{return![];}}; \ No newline at end of file +var _0x192e=['customVariable','Variable','name','toLowerCase','key','keyContent','keyType','variable','format','%s:\x20%s','join','slice','substring','lastIndexOf','validateEmail','lodash','util','getString','length','sortBy','type','string','push','content','variableName','toString'];(function(_0x175742,_0x8954e2){var _0x19feb8=function(_0x2218d1){while(--_0x2218d1){_0x175742['push'](_0x175742['shift']());}};_0x19feb8(++_0x8954e2);}(_0x192e,0x12d));var _0xe192=function(_0x59c146,_0x3ec902){_0x59c146=_0x59c146-0x0;var _0x35a1e1=_0x192e[_0x59c146];return _0x35a1e1;};'use strict';var _=require(_0xe192('0x0'));var util=require(_0xe192('0x1'));exports[_0xe192('0x2')]=function(_0xc912a7,_0x3b4d64,_0xa3f053){var _0x1a6e26=[];if(_0xc912a7[_0xe192('0x3')]>0x0){var _0x33ef01=_[_0xe192('0x4')](_0xc912a7,['id']);for(var _0x5bf172=0x0;_0x5bf172<_0x33ef01[_0xe192('0x3')];_0x5bf172++){var _0x45a067=_0x33ef01[_0x5bf172];if(_0x45a067[_0xe192('0x5')]===_0xe192('0x6')){_0x1a6e26[_0xe192('0x7')](_0x45a067[_0xe192('0x8')]);}else if(_0x45a067[_0xe192('0x5')]==='variable'&&_0x45a067[_0xe192('0x9')]){_0x3b4d64[_0x45a067['variableName']]&&_0x1a6e26['push'](_0x3b4d64[_0x45a067['variableName']][_0xe192('0xa')]());}else if(_0x45a067[_0xe192('0x5')]===_0xe192('0xb')&&_0x45a067[_0xe192('0xc')]&&_0x45a067[_0xe192('0xc')]['name']){_0x3b4d64[_0x45a067[_0xe192('0xc')][_0xe192('0xd')]['toLowerCase']()]&&_0x1a6e26[_0xe192('0x7')](_0x3b4d64[_0x45a067[_0xe192('0xc')]['name'][_0xe192('0xe')]()][_0xe192('0xa')]());}else if(_0x45a067[_0xe192('0x5')]==='keyValue'){if(_0x45a067['keyType']===_0xe192('0x6')&&_0x45a067['key']){_0x1a6e26['push'](util['format']('%s:\x20%s',_0x45a067[_0xe192('0xf')],_0x45a067[_0xe192('0x10')]));}else if(_0x45a067[_0xe192('0x11')]===_0xe192('0x12')&&_0x45a067['variableName']&&_0x45a067[_0xe192('0xf')]){_0x3b4d64[_0x45a067[_0xe192('0x9')]]&&_0x1a6e26['push'](util[_0xe192('0x13')](_0xe192('0x14'),_0x45a067['key'],_0x3b4d64[_0x45a067[_0xe192('0x9')]]));}else if(_0x45a067['keyType']==='customVariable'&&_0x45a067['Variable']&&_0x45a067['Variable']['name']&&_0x45a067['key']){_0x3b4d64[_0x45a067[_0xe192('0xc')][_0xe192('0xd')][_0xe192('0xe')]()]&&_0x1a6e26['push'](util[_0xe192('0x13')]('%s:\x20%s',_0x45a067[_0xe192('0xf')],_0x3b4d64[_0x45a067['Variable']['name'][_0xe192('0xe')]()]));}}}}return _0x1a6e26[_0xe192('0x15')](_0xa3f053);};exports['stripTrailingSlash']=function(_0x57bf9b){var _0x1b60ed=_0x57bf9b[_0xe192('0x16')](-0x1);if(_0x1b60ed==='/'){_0x57bf9b=_0x57bf9b[_0xe192('0x17')](0x0,_0x57bf9b[_0xe192('0x18')](_0x1b60ed));}return _0x57bf9b;};exports[_0xe192('0x19')]=function(_0x4e94f2){if(!_['isNil'](_0x4e94f2)&&_0x4e94f2!==''){var _0x1b2925=/^(([^<>()\[\]\\.,;:\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 _0x1b2925['test'](String(_0x4e94f2)[_0xe192('0xe')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index bb88055..e9fe52e 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 _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x1a1b6e,_0x3a07a9){var _0x571e2c=function(_0x6cea62){while(--_0x6cea62){_0x1a1b6e['push'](_0x1a1b6e['shift']());}};_0x571e2c(++_0x3a07a9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ No newline at end of file +var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xa9e0,0x123));var _0x0a9e=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xa9e0[_0x484e36];return _0xafc85d;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 4e33cb6..fef20be 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 _0x5a9b=['catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','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','filter','end-user','length','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','string','nameField','toLowerCase','content','picklist','idField','customField','custom_fields','push','type','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','Authorization','email','calleridname','calleridnum','The\x20Enduser\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','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','trigger:browser:url'];(function(_0x15f4d2,_0x3cb7c6){var _0x127d6a=function(_0x4ceb2f){while(--_0x4ceb2f){_0x15f4d2['push'](_0x15f4d2['shift']());}};_0x127d6a(++_0x3cb7c6);}(_0x5a9b,0xf0));var _0xb5a9=function(_0x6c8609,_0x5bf137){_0x6c8609=_0x6c8609-0x0;var _0x520004=_0x5a9b[_0x6c8609];return _0x520004;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xb5a9('0x0'));var util=require(_0xb5a9('0x1'));var Redis=require('ioredis');var intUtil=require(_0xb5a9('0x2'));var config=require(_0xb5a9('0x3'));var logger=require(_0xb5a9('0x4'))(_0xb5a9('0x5'));config[_0xb5a9('0x6')]=_[_0xb5a9('0x7')](config['redis'],{'host':_0xb5a9('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb5a9('0x6')]));function emit(_0xca161a,_0x3e0cdb,_0x46ad2f){io['to'](_0xca161a)[_0xb5a9('0x9')](_0x3e0cdb,_0x46ad2f);}var headers={'Content-Type':'application/json','Accept':_0xb5a9('0xa')};function getTicket(_0x18e1de,_0x3ce8b4,_0x132e2b,_0x2d39bf,_0x102ce3){logger[_0xb5a9('0xb')](_0xb5a9('0xc'));return request({'uri':util[_0xb5a9('0xd')](_0xb5a9('0xe'),_0x18e1de[_0xb5a9('0xf')]),'method':_0xb5a9('0x10'),'body':{'ticket':_[_0xb5a9('0x11')]({'requester_id':_0x132e2b['id'],'submitter_id':_0x3ce8b4?_0x3ce8b4['id']:undefined,'assignee_id':_0x3ce8b4?_0x3ce8b4['id']:undefined,'tags':getTags(_0x2d39bf[_0xb5a9('0x12')],'name'),'subject':intUtil[_0xb5a9('0x13')](_0x2d39bf[_0xb5a9('0x14')],_0x102ce3,'\x20'),'description':intUtil[_0xb5a9('0x13')](_0x2d39bf['Descriptions'],_0x102ce3,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x2d39bf[_0xb5a9('0x15')],_0x102ce3,'\x0a')}},getCustomFields(_0x2d39bf[_0xb5a9('0x16')],_0x102ce3))}})[_0xb5a9('0x17')](function(_0x415973){logger[_0xb5a9('0xb')](_0xb5a9('0x18'));return _0x415973[_0xb5a9('0x19')];});}function getUser(_0x145a99,_0x2f3178){if(intUtil['validateEmail'](_0x2f3178)){logger[_0xb5a9('0xb')](_0xb5a9('0x1a'),_0x2f3178);return request({'uri':util[_0xb5a9('0xd')](_0xb5a9('0x1b'),_0x145a99[_0xb5a9('0xf')]),'qs':{'query':util[_0xb5a9('0xd')](_0xb5a9('0x1c'),_0x2f3178)}})['then'](function(_0x45f14d){if(_0x45f14d[_0xb5a9('0x1d')]){logger[_0xb5a9('0xb')](_0xb5a9('0x1e'));return _[_0xb5a9('0x1f')](_0x45f14d[_0xb5a9('0x20')],{'email':_0x2f3178,'role':'agent'});}else{logger[_0xb5a9('0xb')](_0xb5a9('0x21'));return request({'uri':util[_0xb5a9('0xd')](_0xb5a9('0x22'),_0x145a99[_0xb5a9('0xf')])})['then'](function(_0x2ae53c){logger[_0xb5a9('0xb')]('Admin\x20account\x20selected.');return _0x2ae53c['user'];});}});}else{logger[_0xb5a9('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xb5a9('0xd')]('%s/users/me.json',_0x145a99['remoteUri'])})['then'](function(_0x2891eb){logger[_0xb5a9('0xb')](_0xb5a9('0x23'));return _0x2891eb[_0xb5a9('0x24')];});}}function getEndUser(_0x202423,_0x593216,_0x32ca9d){logger[_0xb5a9('0xb')](_0xb5a9('0x25'),_0x32ca9d);return request({'uri':util[_0xb5a9('0xd')](_0xb5a9('0x1b'),_0x202423[_0xb5a9('0xf')]),'qs':{'query':util[_0xb5a9('0xd')](_0xb5a9('0x26'),_0x32ca9d)}})[_0xb5a9('0x17')](function(_0x17f3ce){var _0x452837;if(_0x17f3ce[_0xb5a9('0x20')]['length']){_0x17f3ce['results']=_[_0xb5a9('0x27')](_0x17f3ce[_0xb5a9('0x20')],{'suspended':![],'role':_0xb5a9('0x28')});if(_0x17f3ce[_0xb5a9('0x20')][_0xb5a9('0x29')]){_0x452837=_[_0xb5a9('0x2a')](_0x17f3ce[_0xb5a9('0x20')]);}}if(_0x452837){logger[_0xb5a9('0xb')](_0xb5a9('0x2b'));return _0x452837;}else{logger['info'](_0xb5a9('0x2c'));return request({'uri':util['format']('%s/users.json',_0x202423[_0xb5a9('0xf')]),'method':_0xb5a9('0x10'),'body':{'user':{'role':_0xb5a9('0x28'),'name':util['format'](_0xb5a9('0x2d'),_0x593216||_0x32ca9d),'phone':_0x32ca9d}}})[_0xb5a9('0x17')](function(_0x3d6e2b){logger[_0xb5a9('0xb')](_0xb5a9('0x2e'));return _0x3d6e2b[_0xb5a9('0x24')];});}});}function getAuth(_0x4b785f){var _0x282701;if(_0x4b785f[_0xb5a9('0x2f')]===_0xb5a9('0x30')){_0x282701=util[_0xb5a9('0xd')](_0xb5a9('0x31'),_0x4b785f['username'],_0x4b785f[_0xb5a9('0x30')]);}else if(_0x4b785f[_0xb5a9('0x2f')]===_0xb5a9('0x32')){_0x282701=util[_0xb5a9('0xd')]('%s/token:%s',_0x4b785f['username'],_0x4b785f[_0xb5a9('0x32')]);}return util[_0xb5a9('0xd')](_0xb5a9('0x33'),new Buffer(_0x282701)[_0xb5a9('0x34')](_0xb5a9('0x35')));}function request(_0x1fa70f){logger[_0xb5a9('0x36')](_0xb5a9('0x37'),JSON[_0xb5a9('0x38')](_0x1fa70f));return rp(_['defaults'](_0x1fa70f,{'method':_0xb5a9('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x3be531,_0x38ce41){var _0x19f66b=[];if(_0x3be531&&_0x3be531[_0xb5a9('0x29')]>0x0){_0x19f66b=_[_0xb5a9('0x3a')](_0x3be531,_0x38ce41);}return _0x19f66b;}function getCustomFields(_0x452e82,_0x47adf7){var _0x146389=[];var _0x3724ad={'custom_fields':[]};if(_0x452e82[_0xb5a9('0x29')]>0x0){_[_0xb5a9('0x3b')](_0x452e82,function(_0x336f66){if(_['includes']([_0xb5a9('0x3c'),'picklist'],_0x336f66['type'])&&_0x336f66['nameField']&&!_0x336f66['customField']){_0x3724ad[_0x336f66[_0xb5a9('0x3d')][_0xb5a9('0x3e')]()]=_0x336f66[_0xb5a9('0x3f')]['toString']();}else if(_['includes']([_0xb5a9('0x3c'),_0xb5a9('0x40')],_0x336f66['type'])&&_0x336f66[_0xb5a9('0x41')]&&_0x336f66[_0xb5a9('0x42')]){_0x3724ad[_0xb5a9('0x43')][_0xb5a9('0x44')]({'id':_0x336f66[_0xb5a9('0x41')],'value':_0x336f66[_0xb5a9('0x3f')][_0xb5a9('0x34')]()});}else if(_0x336f66[_0xb5a9('0x45')]===_0xb5a9('0x46')&&_0x336f66['variableName']&&_0x336f66['idField']&&_0x336f66['customField']){_0x47adf7[_0x336f66['variableName']]&&_0x3724ad['custom_fields'][_0xb5a9('0x44')]({'id':_0x336f66['idField'],'value':_0x47adf7[_0x336f66[_0xb5a9('0x47')]][_0xb5a9('0x34')]()});}else if(_0x336f66[_0xb5a9('0x45')]===_0xb5a9('0x48')&&_0x336f66[_0xb5a9('0x49')]&&_0x336f66[_0xb5a9('0x49')][_0xb5a9('0x4a')]&&_0x336f66[_0xb5a9('0x41')]&&_0x336f66[_0xb5a9('0x42')]){_0x47adf7[_0x336f66[_0xb5a9('0x49')][_0xb5a9('0x4a')][_0xb5a9('0x3e')]()]&&_0x3724ad[_0xb5a9('0x43')][_0xb5a9('0x44')]({'id':_0x336f66[_0xb5a9('0x41')],'value':_0x47adf7[_0x336f66['Variable'][_0xb5a9('0x4a')]['toLowerCase']()][_0xb5a9('0x34')]()});}});}return _0x3724ad;}exports[_0xb5a9('0x4b')]=function(_0x3191fd,_0xaad31b,_0xbc514b,_0x412c2e,_0x374979,_0x1a7160){var _0x3fe8d5,_0x4a840f;_0x1a7160[_0xb5a9('0xf')]=intUtil['stripTrailingSlash'](_0x1a7160[_0xb5a9('0xf')]);_0x1a7160['serverUrl']=intUtil[_0xb5a9('0x4c')](_0x1a7160['serverUrl']);if(_0x374979&&_0x374979[_0xb5a9('0x4d')]){logger[_0xb5a9('0xb')](_0xb5a9('0x4e'),'Recording\x20is\x20enabled!');_0xaad31b['recordingURL']=util[_0xb5a9('0xd')](_0xb5a9('0x4f'),_0x1a7160[_0xb5a9('0x50')],_0xaad31b['uniqueid'],md5(_0xaad31b[_0xb5a9('0x51')]));}else{_0xaad31b[_0xb5a9('0x52')]='';}headers[_0xb5a9('0x53')]=getAuth(_0x1a7160);return getUser(_0x1a7160,_0x412c2e[_0xb5a9('0x54')])[_0xb5a9('0x17')](function(_0x2e0a8c){_0x3fe8d5=_0x2e0a8c;logger[_0xb5a9('0xb')]('The\x20User\x20ID\x20is:',_0x3fe8d5['id']);return getEndUser(_0x1a7160,_0xaad31b[_0xb5a9('0x55')],_0xaad31b[_0xb5a9('0x56')]);})[_0xb5a9('0x17')](function(_0x3e5b90){_0x4a840f=_0x3e5b90;logger['info'](_0xb5a9('0x57'),_0x4a840f['id']);return getTicket(_0x1a7160,_0x3fe8d5,_0x4a840f,_0xbc514b,_0xaad31b);})[_0xb5a9('0x17')](function(_0x247a62){if(_0x247a62){logger[_0xb5a9('0xb')]('The\x20Ticket\x20ID\x20is:',_0x247a62['id']);switch(_0x1a7160['type']){case _0xb5a9('0x58'):logger['info']('[QUEUE]',_0xb5a9('0x59'));return request({'uri':util[_0xb5a9('0xd')](_0xb5a9('0x5a'),_0x1a7160['remoteUri'],_0x3fe8d5['id'],_0x247a62['id']),'method':'POST'});case _0xb5a9('0x5b'):logger['info']('[QUEUE]',_0xb5a9('0x5c'));emit(util[_0xb5a9('0xd')](_0xb5a9('0x5d'),_0x412c2e[_0xb5a9('0x4a')]),'trigger:browser:url',{'uri':util[_0xb5a9('0xd')](_0xb5a9('0x5e'),_0x1a7160[_0xb5a9('0xf')][_0xb5a9('0x5f')](_0xb5a9('0x60'),''),_0x247a62['id'])});break;default:logger[_0xb5a9('0x61')]('[QUEUE]',_0xb5a9('0x62'));}}})['catch'](function(_0x15bf99){logger['error'](_0xb5a9('0x63'),util[_0xb5a9('0x64')](_0x15bf99,{'showHidden':!![],'depth':null}));});};exports[_0xb5a9('0x65')]=function(_0x1dec16,_0x54cadb,_0x2276e1,_0x4812f3,_0x449a2f,_0x31a803,_0x52b157){var _0x118790,_0x3a7e9a;_0x31a803[_0xb5a9('0xf')]=intUtil['stripTrailingSlash'](_0x31a803[_0xb5a9('0xf')]);_0x31a803[_0xb5a9('0x50')]=intUtil[_0xb5a9('0x4c')](_0x31a803[_0xb5a9('0x50')]);if(_0x52b157&&_0x52b157[_0xb5a9('0x66')]&&_0x52b157[_0xb5a9('0x66')]!==_0xb5a9('0x67')){logger[_0xb5a9('0xb')](_0xb5a9('0x68'),_0xb5a9('0x69'));_0x54cadb[_0xb5a9('0x52')]=util[_0xb5a9('0xd')](_0xb5a9('0x4f'),_0x31a803[_0xb5a9('0x50')],_0x54cadb[_0xb5a9('0x51')],md5(_0x54cadb[_0xb5a9('0x51')]));}headers[_0xb5a9('0x53')]=getAuth(_0x31a803);return getUser(_0x31a803,_0x4812f3['email'])[_0xb5a9('0x17')](function(_0x2bc631){_0x118790=_0x2bc631;logger[_0xb5a9('0xb')](_0xb5a9('0x6a'),_0x118790['id']);return getEndUser(_0x31a803,_0x54cadb[_0xb5a9('0x6b')],_0x54cadb[_0xb5a9('0x6c')]);})[_0xb5a9('0x17')](function(_0x79ea78){_0x3a7e9a=_0x79ea78;logger[_0xb5a9('0xb')](_0xb5a9('0x57'),_0x3a7e9a['id']);return getTicket(_0x31a803,_0x118790,_0x3a7e9a,_0x2276e1,_0x54cadb);})[_0xb5a9('0x17')](function(_0x2763e9){if(_0x2763e9){logger['info'](_0xb5a9('0x6d'),_0x2763e9['id']);switch(_0x31a803[_0xb5a9('0x45')]){case _0xb5a9('0x58'):logger['info'](_0xb5a9('0x68'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xb5a9('0xd')](_0xb5a9('0x5a'),_0x31a803['remoteUri'],_0x118790['id'],_0x2763e9['id']),'method':_0xb5a9('0x10')});case _0xb5a9('0x5b'):logger[_0xb5a9('0xb')](_0xb5a9('0x68'),_0xb5a9('0x5c'));emit(util[_0xb5a9('0xd')](_0xb5a9('0x5d'),_0x4812f3[_0xb5a9('0x4a')]),_0xb5a9('0x6e'),{'uri':util[_0xb5a9('0xd')](_0xb5a9('0x5e'),_0x31a803[_0xb5a9('0xf')][_0xb5a9('0x5f')](_0xb5a9('0x60'),''),_0x2763e9['id'])});break;default:logger[_0xb5a9('0x61')](_0xb5a9('0x68'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xb5a9('0x6f')](function(_0x4f8cf0){logger[_0xb5a9('0x61')](_0xb5a9('0x70'),util['inspect'](_0x4f8cf0,{'showHidden':!![],'depth':null}));});};exports[_0xb5a9('0x71')]=function(_0x110b12,_0x57ead1,_0x1290c7,_0x5c22ee,_0x4c1820,_0x3d4aa0){var _0x95ec29,_0x437199;_0x3d4aa0[_0xb5a9('0xf')]=intUtil[_0xb5a9('0x4c')](_0x3d4aa0[_0xb5a9('0xf')]);_0x3d4aa0[_0xb5a9('0x50')]=intUtil['stripTrailingSlash'](_0x3d4aa0['serverUrl']);if(_0x4c1820&&_0x4c1820[_0xb5a9('0x4d')]){logger[_0xb5a9('0xb')]('['+_0x57ead1[_0xb5a9('0x72')][_0xb5a9('0x73')]()+']',_0xb5a9('0x69'));_0x57ead1['recordingURL']=util['format'](_0xb5a9('0x4f'),_0x3d4aa0[_0xb5a9('0x50')],_0x57ead1[_0xb5a9('0x51')],md5(_0x57ead1[_0xb5a9('0x51')]));}else{_0x57ead1[_0xb5a9('0x52')]='';}headers[_0xb5a9('0x53')]=getAuth(_0x3d4aa0);return getUser(_0x3d4aa0)['then'](function(_0x426809){_0x95ec29=_0x426809;logger['info'](_0xb5a9('0x6a'),_0x95ec29['id']);return getEndUser(_0x3d4aa0,_0x57ead1[_0xb5a9('0x55')],_0x57ead1[_0xb5a9('0x56')]);})[_0xb5a9('0x17')](function(_0x17f981){_0x437199=_0x17f981;logger['info'](_0xb5a9('0x57'),_0x437199['id']);return getTicket(_0x3d4aa0,_0x95ec29,_0x437199,_0x1290c7,_0x57ead1);})[_0xb5a9('0x17')](function(_0x5cc08d){if(_0x5cc08d){logger['info']('The\x20Ticket\x20ID\x20is:',_0x5cc08d['id']);}})[_0xb5a9('0x6f')](function(_0x2900e6){logger[_0xb5a9('0x61')]('['+_0x57ead1[_0xb5a9('0x72')][_0xb5a9('0x73')]()+']'+_0xb5a9('0x74'),util[_0xb5a9('0x64')](_0x2900e6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa991=['toLowerCase','content','includes','type','idField','custom_fields','push','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','recordingFormat','none','[OUTBOUND]','destcalleridnum','/api/v2','inspect','monitor_format','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','Tags','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','validateEmail','%s/search.json','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Admin\x20account\x20selected.','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','[HTTP]','stringify','defaults','GET','map','length','string','picklist','nameField','customField'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0xa991,0x10c));var _0x1a99=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xa991[_0x68c979];return _0x4f0001;};'use strict';var _=require(_0x1a99('0x0'));var rp=require('request-promise');var md5=require(_0x1a99('0x1'));var util=require(_0x1a99('0x2'));var Redis=require(_0x1a99('0x3'));var intUtil=require('./util');var config=require(_0x1a99('0x4'));var logger=require(_0x1a99('0x5'))('zendesk');config[_0x1a99('0x6')]=_['defaults'](config[_0x1a99('0x6')],{'host':_0x1a99('0x7'),'port':0x18eb});var io=require(_0x1a99('0x8'))(new Redis(config[_0x1a99('0x6')]));function emit(_0x5e4728,_0x3ad815,_0x340fa6){io['to'](_0x5e4728)[_0x1a99('0x9')](_0x3ad815,_0x340fa6);}var headers={'Content-Type':'application/json','Accept':_0x1a99('0xa')};function getTicket(_0x5c3180,_0x3d881a,_0x1d71ca,_0x411ab1,_0x2992f5){logger[_0x1a99('0xb')](_0x1a99('0xc'));return request({'uri':util[_0x1a99('0xd')](_0x1a99('0xe'),_0x5c3180['remoteUri']),'method':_0x1a99('0xf'),'body':{'ticket':_[_0x1a99('0x10')]({'requester_id':_0x1d71ca['id'],'submitter_id':_0x3d881a?_0x3d881a['id']:undefined,'assignee_id':_0x3d881a?_0x3d881a['id']:undefined,'tags':getTags(_0x411ab1[_0x1a99('0x11')],'name'),'subject':intUtil[_0x1a99('0x12')](_0x411ab1[_0x1a99('0x13')],_0x2992f5,'\x20'),'description':intUtil[_0x1a99('0x12')](_0x411ab1[_0x1a99('0x14')],_0x2992f5,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x411ab1[_0x1a99('0x14')],_0x2992f5,'\x0a')}},getCustomFields(_0x411ab1[_0x1a99('0x15')],_0x2992f5))}})[_0x1a99('0x16')](function(_0x1bc8ad){logger['info'](_0x1a99('0x17'));return _0x1bc8ad['ticket'];});}function getUser(_0x1a44d7,_0x1a8f90){if(intUtil[_0x1a99('0x18')](_0x1a8f90)){logger[_0x1a99('0xb')]('Getting\x20agent\x20with\x20email',_0x1a8f90);return request({'uri':util[_0x1a99('0xd')](_0x1a99('0x19'),_0x1a44d7['remoteUri']),'qs':{'query':util[_0x1a99('0xd')]('type:user\x20role:agent\x20email:%s',_0x1a8f90)}})['then'](function(_0x28d1a2){if(_0x28d1a2['count']){logger[_0x1a99('0xb')](_0x1a99('0x1a'));return _[_0x1a99('0x1b')](_0x28d1a2[_0x1a99('0x1c')],{'email':_0x1a8f90,'role':_0x1a99('0x1d')});}else{logger[_0x1a99('0xb')](_0x1a99('0x1e'));return request({'uri':util[_0x1a99('0xd')]('%s/users/me.json',_0x1a44d7[_0x1a99('0x1f')])})[_0x1a99('0x16')](function(_0x2bd4fa){logger[_0x1a99('0xb')](_0x1a99('0x20'));return _0x2bd4fa['user'];});}});}else{logger['info'](_0x1a99('0x1e'));return request({'uri':util[_0x1a99('0xd')](_0x1a99('0x21'),_0x1a44d7[_0x1a99('0x1f')])})[_0x1a99('0x16')](function(_0x39a7e4){logger['info'](_0x1a99('0x20'));return _0x39a7e4[_0x1a99('0x22')];});}}function getEndUser(_0x73f141,_0x371af9,_0x4352e1){logger[_0x1a99('0xb')](_0x1a99('0x23'),_0x4352e1);return request({'uri':util['format'](_0x1a99('0x19'),_0x73f141[_0x1a99('0x1f')]),'qs':{'query':util[_0x1a99('0xd')](_0x1a99('0x24'),_0x4352e1)}})['then'](function(_0x3f1e40){var _0x35f2a5;if(_0x3f1e40['results']['length']){_0x3f1e40['results']=_[_0x1a99('0x25')](_0x3f1e40[_0x1a99('0x1c')],{'suspended':![],'role':_0x1a99('0x26')});if(_0x3f1e40['results']['length']){_0x35f2a5=_['first'](_0x3f1e40[_0x1a99('0x1c')]);}}if(_0x35f2a5){logger[_0x1a99('0xb')](_0x1a99('0x27'));return _0x35f2a5;}else{logger[_0x1a99('0xb')](_0x1a99('0x28'));return request({'uri':util[_0x1a99('0xd')](_0x1a99('0x29'),_0x73f141[_0x1a99('0x1f')]),'method':_0x1a99('0xf'),'body':{'user':{'role':'end-user','name':util[_0x1a99('0xd')]('Caller\x20-\x20%s',_0x371af9||_0x4352e1),'phone':_0x4352e1}}})[_0x1a99('0x16')](function(_0x36020e){logger[_0x1a99('0xb')](_0x1a99('0x2a'));return _0x36020e[_0x1a99('0x22')];});}});}function getAuth(_0x5377fd){var _0x232de2;if(_0x5377fd[_0x1a99('0x2b')]==='password'){_0x232de2=util[_0x1a99('0xd')](_0x1a99('0x2c'),_0x5377fd[_0x1a99('0x2d')],_0x5377fd[_0x1a99('0x2e')]);}else if(_0x5377fd[_0x1a99('0x2b')]===_0x1a99('0x2f')){_0x232de2=util[_0x1a99('0xd')](_0x1a99('0x30'),_0x5377fd[_0x1a99('0x2d')],_0x5377fd[_0x1a99('0x2f')]);}return util[_0x1a99('0xd')](_0x1a99('0x31'),new Buffer(_0x232de2)[_0x1a99('0x32')](_0x1a99('0x33')));}function request(_0x100b15){logger['debug'](_0x1a99('0x34'),JSON[_0x1a99('0x35')](_0x100b15));return rp(_[_0x1a99('0x36')](_0x100b15,{'method':_0x1a99('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x6b59d8,_0x2ba988){var _0x5b0970=[];if(_0x6b59d8&&_0x6b59d8['length']>0x0){_0x5b0970=_[_0x1a99('0x38')](_0x6b59d8,_0x2ba988);}return _0x5b0970;}function getCustomFields(_0x41e647,_0x52c235){var _0x4cc291=[];var _0x246d83={'custom_fields':[]};if(_0x41e647[_0x1a99('0x39')]>0x0){_['forEach'](_0x41e647,function(_0x3fb9ce){if(_['includes']([_0x1a99('0x3a'),_0x1a99('0x3b')],_0x3fb9ce['type'])&&_0x3fb9ce[_0x1a99('0x3c')]&&!_0x3fb9ce[_0x1a99('0x3d')]){_0x246d83[_0x3fb9ce['nameField'][_0x1a99('0x3e')]()]=_0x3fb9ce[_0x1a99('0x3f')][_0x1a99('0x32')]();}else if(_[_0x1a99('0x40')]([_0x1a99('0x3a'),'picklist'],_0x3fb9ce[_0x1a99('0x41')])&&_0x3fb9ce[_0x1a99('0x42')]&&_0x3fb9ce['customField']){_0x246d83[_0x1a99('0x43')][_0x1a99('0x44')]({'id':_0x3fb9ce['idField'],'value':_0x3fb9ce[_0x1a99('0x3f')]['toString']()});}else if(_0x3fb9ce[_0x1a99('0x41')]===_0x1a99('0x45')&&_0x3fb9ce[_0x1a99('0x46')]&&_0x3fb9ce[_0x1a99('0x42')]&&_0x3fb9ce[_0x1a99('0x3d')]){_0x52c235[_0x3fb9ce[_0x1a99('0x46')]]&&_0x246d83['custom_fields']['push']({'id':_0x3fb9ce[_0x1a99('0x42')],'value':_0x52c235[_0x3fb9ce[_0x1a99('0x46')]][_0x1a99('0x32')]()});}else if(_0x3fb9ce[_0x1a99('0x41')]===_0x1a99('0x47')&&_0x3fb9ce[_0x1a99('0x48')]&&_0x3fb9ce[_0x1a99('0x48')][_0x1a99('0x49')]&&_0x3fb9ce[_0x1a99('0x42')]&&_0x3fb9ce[_0x1a99('0x3d')]){_0x52c235[_0x3fb9ce['Variable'][_0x1a99('0x49')][_0x1a99('0x3e')]()]&&_0x246d83[_0x1a99('0x43')]['push']({'id':_0x3fb9ce[_0x1a99('0x42')],'value':_0x52c235[_0x3fb9ce[_0x1a99('0x48')][_0x1a99('0x49')][_0x1a99('0x3e')]()][_0x1a99('0x32')]()});}});}return _0x246d83;}exports[_0x1a99('0x4a')]=function(_0x46438b,_0x4c3df1,_0x23b502,_0x1be2d7,_0x3cb644,_0x22347a){var _0x309b6d,_0x4b8e0b;_0x22347a[_0x1a99('0x1f')]=intUtil[_0x1a99('0x4b')](_0x22347a[_0x1a99('0x1f')]);_0x22347a[_0x1a99('0x4c')]=intUtil[_0x1a99('0x4b')](_0x22347a['serverUrl']);if(_0x3cb644&&_0x3cb644['monitor_format']){logger['info'](_0x1a99('0x4d'),_0x1a99('0x4e'));_0x4c3df1[_0x1a99('0x4f')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x22347a[_0x1a99('0x4c')],_0x4c3df1[_0x1a99('0x50')],md5(_0x4c3df1[_0x1a99('0x50')]));}else{_0x4c3df1[_0x1a99('0x4f')]='';}headers[_0x1a99('0x51')]=getAuth(_0x22347a);return getUser(_0x22347a,_0x1be2d7[_0x1a99('0x52')])[_0x1a99('0x16')](function(_0xdd87d8){_0x309b6d=_0xdd87d8;logger[_0x1a99('0xb')](_0x1a99('0x53'),_0x309b6d['id']);return getEndUser(_0x22347a,_0x4c3df1['calleridname'],_0x4c3df1[_0x1a99('0x54')]);})[_0x1a99('0x16')](function(_0x50e7a2){_0x4b8e0b=_0x50e7a2;logger[_0x1a99('0xb')](_0x1a99('0x55'),_0x4b8e0b['id']);return getTicket(_0x22347a,_0x309b6d,_0x4b8e0b,_0x23b502,_0x4c3df1);})[_0x1a99('0x16')](function(_0x258fcc){if(_0x258fcc){logger[_0x1a99('0xb')](_0x1a99('0x56'),_0x258fcc['id']);switch(_0x22347a[_0x1a99('0x41')]){case _0x1a99('0x57'):logger[_0x1a99('0xb')](_0x1a99('0x4d'),_0x1a99('0x58'));return request({'uri':util[_0x1a99('0xd')](_0x1a99('0x59'),_0x22347a[_0x1a99('0x1f')],_0x309b6d['id'],_0x258fcc['id']),'method':_0x1a99('0xf')});case _0x1a99('0x5a'):logger[_0x1a99('0xb')](_0x1a99('0x4d'),_0x1a99('0x5b'));emit(util[_0x1a99('0xd')](_0x1a99('0x5c'),_0x1be2d7[_0x1a99('0x49')]),_0x1a99('0x5d'),{'uri':util[_0x1a99('0xd')](_0x1a99('0x5e'),_0x22347a['remoteUri'][_0x1a99('0x5f')]('/api/v2',''),_0x258fcc['id'])});break;default:logger[_0x1a99('0x60')]('[QUEUE]',_0x1a99('0x61'));}}})[_0x1a99('0x62')](function(_0x4c8daa){logger['error'](_0x1a99('0x63'),util['inspect'](_0x4c8daa,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x2dc5ad,_0x48b4c4,_0x50d23f,_0x7aa3ef,_0x52d6d2,_0x18fa34,_0x17543d){var _0x3581bb,_0x5c796f;_0x18fa34['remoteUri']=intUtil[_0x1a99('0x4b')](_0x18fa34[_0x1a99('0x1f')]);_0x18fa34['serverUrl']=intUtil['stripTrailingSlash'](_0x18fa34[_0x1a99('0x4c')]);if(_0x17543d&&_0x17543d[_0x1a99('0x64')]&&_0x17543d['recordingFormat']!==_0x1a99('0x65')){logger[_0x1a99('0xb')](_0x1a99('0x66'),_0x1a99('0x4e'));_0x48b4c4['recordingURL']=util[_0x1a99('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x18fa34['serverUrl'],_0x48b4c4[_0x1a99('0x50')],md5(_0x48b4c4['uniqueid']));}headers[_0x1a99('0x51')]=getAuth(_0x18fa34);return getUser(_0x18fa34,_0x7aa3ef[_0x1a99('0x52')])[_0x1a99('0x16')](function(_0x5ae353){_0x3581bb=_0x5ae353;logger['info'](_0x1a99('0x53'),_0x3581bb['id']);return getEndUser(_0x18fa34,_0x48b4c4['destcalleridname'],_0x48b4c4[_0x1a99('0x67')]);})['then'](function(_0x14982a){_0x5c796f=_0x14982a;logger['info'](_0x1a99('0x55'),_0x5c796f['id']);return getTicket(_0x18fa34,_0x3581bb,_0x5c796f,_0x50d23f,_0x48b4c4);})[_0x1a99('0x16')](function(_0x430cf6){if(_0x430cf6){logger['info']('The\x20Ticket\x20ID\x20is:',_0x430cf6['id']);switch(_0x18fa34['type']){case _0x1a99('0x57'):logger['info']('[OUTBOUND]',_0x1a99('0x58'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x18fa34['remoteUri'],_0x3581bb['id'],_0x430cf6['id']),'method':'POST'});case _0x1a99('0x5a'):logger[_0x1a99('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1a99('0xd')](_0x1a99('0x5c'),_0x7aa3ef[_0x1a99('0x49')]),_0x1a99('0x5d'),{'uri':util[_0x1a99('0xd')](_0x1a99('0x5e'),_0x18fa34[_0x1a99('0x1f')]['replace'](_0x1a99('0x68'),''),_0x430cf6['id'])});break;default:logger[_0x1a99('0x60')](_0x1a99('0x66'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x4fc1bd){logger[_0x1a99('0x60')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x1a99('0x69')](_0x4fc1bd,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x503ef6,_0x3d5ffb,_0x539729,_0x687c20,_0x8f5507,_0x232a32){var _0x483acd,_0x8b05e0;_0x232a32['remoteUri']=intUtil[_0x1a99('0x4b')](_0x232a32[_0x1a99('0x1f')]);_0x232a32['serverUrl']=intUtil['stripTrailingSlash'](_0x232a32[_0x1a99('0x4c')]);if(_0x8f5507&&_0x8f5507[_0x1a99('0x6a')]){logger['info']('['+_0x3d5ffb[_0x1a99('0x6b')][_0x1a99('0x6c')]()+']','Recording\x20is\x20enabled!');_0x3d5ffb['recordingURL']=util[_0x1a99('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x232a32[_0x1a99('0x4c')],_0x3d5ffb['uniqueid'],md5(_0x3d5ffb['uniqueid']));}else{_0x3d5ffb[_0x1a99('0x4f')]='';}headers[_0x1a99('0x51')]=getAuth(_0x232a32);return getUser(_0x232a32)[_0x1a99('0x16')](function(_0x11b5d8){_0x483acd=_0x11b5d8;logger['info'](_0x1a99('0x53'),_0x483acd['id']);return getEndUser(_0x232a32,_0x3d5ffb[_0x1a99('0x6d')],_0x3d5ffb['calleridnum']);})[_0x1a99('0x16')](function(_0x32e8a0){_0x8b05e0=_0x32e8a0;logger[_0x1a99('0xb')](_0x1a99('0x55'),_0x8b05e0['id']);return getTicket(_0x232a32,_0x483acd,_0x8b05e0,_0x539729,_0x3d5ffb);})[_0x1a99('0x16')](function(_0x4e6b54){if(_0x4e6b54){logger[_0x1a99('0xb')](_0x1a99('0x56'),_0x4e6b54['id']);}})['catch'](function(_0x287d11){logger[_0x1a99('0x60')]('['+_0x3d5ffb[_0x1a99('0x6b')][_0x1a99('0x6c')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x1a99('0x69')](_0x287d11,{'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 94d7668..a1db43c 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 _0xec79=['uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Leads','Creating\x20new\x20call...','Owner','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','endtime','YYYY-MM-DDTHH:mm:ss','starttime','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','code','Call\x20created!','stack','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','trigger:browser:url','https://crm.','recordingFormat','[OUTBOUND]','uniqueid','zoho.eu','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','/crm/EntityInfo.do?module=Calls&id=','lastevent','toUpperCase','lodash','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','debug','[HTTP]','forEach','includes','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','catch','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','ActiveUsers','users','isArrayLikeObject','email','Using\x20the\x20admin\x20account!','profile','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','stringify','data','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR'];(function(_0x2c2581,_0x50b2d9){var _0x15a028=function(_0x5bb7f6){while(--_0x5bb7f6){_0x2c2581['push'](_0x2c2581['shift']());}};_0x15a028(++_0x50b2d9);}(_0xec79,0xdd));var _0x9ec7=function(_0x37cd8c,_0x425de5){_0x37cd8c=_0x37cd8c-0x0;var _0x213168=_0xec79[_0x37cd8c];return _0x213168;};'use strict';var _=require(_0x9ec7('0x0'));var rp=require(_0x9ec7('0x1'));var md5=require('md5');var util=require(_0x9ec7('0x2'));var intUtil=require(_0x9ec7('0x3'));var moment=require(_0x9ec7('0x4'));var Redis=require(_0x9ec7('0x5'));var BPromise=require(_0x9ec7('0x6'));var config=require(_0x9ec7('0x7'));var logger=require(_0x9ec7('0x8'))('zoho');config[_0x9ec7('0x9')]=_[_0x9ec7('0xa')](config[_0x9ec7('0x9')],{'host':_0x9ec7('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9ec7('0x9')]));function emit(_0x3df0e5,_0xa6d5d5,_0x530a40){io['to'](_0x3df0e5)[_0x9ec7('0xc')](_0xa6d5d5,_0x530a40);}function request(_0x5d6e0d){logger[_0x9ec7('0xd')](_0x9ec7('0xe'),JSON['stringify'](_0x5d6e0d));return rp(_0x5d6e0d);}function getCustomFields(_0x4810dd,_0x2e45c7){var _0x24d3e3={};if(_0x4810dd['length']>0x0){_[_0x9ec7('0xf')](_0x4810dd,function(_0x5dc852){if(_[_0x9ec7('0x10')](['string','picklist'],_0x5dc852[_0x9ec7('0x11')])&&_0x5dc852[_0x9ec7('0x12')]){_0x24d3e3[_0x5dc852[_0x9ec7('0x12')]]=_0x5dc852['content'][_0x9ec7('0x13')]();}else if(_0x5dc852['type']===_0x9ec7('0x14')&&_0x5dc852[_0x9ec7('0x15')]&&_0x5dc852[_0x9ec7('0x12')]&&_0x2e45c7[_0x5dc852[_0x9ec7('0x15')]]){_0x24d3e3[_0x5dc852[_0x9ec7('0x12')]]=_0x2e45c7[_0x5dc852[_0x9ec7('0x15')]][_0x9ec7('0x13')]();}else if(_0x5dc852['type']===_0x9ec7('0x16')&&_0x5dc852['Variable']&&_0x5dc852[_0x9ec7('0x17')][_0x9ec7('0x18')]&&_0x5dc852[_0x9ec7('0x12')]&&_0x2e45c7[_0x5dc852[_0x9ec7('0x17')][_0x9ec7('0x18')]['toLowerCase']()]){_0x24d3e3[_0x5dc852[_0x9ec7('0x12')]]=_0x2e45c7[_0x5dc852[_0x9ec7('0x17')][_0x9ec7('0x18')][_0x9ec7('0x19')]()][_0x9ec7('0x13')]();}});}return _0x24d3e3;}function getName(_0xbe97c3){if(_0xbe97c3[_0x9ec7('0x1a')]('\x20')>0x0){var _0x57e6dd=_0xbe97c3[_0x9ec7('0x1b')](/ (.+)/);if(_0x57e6dd[0x1]){return _0x57e6dd;}}return[_0xbe97c3,_0xbe97c3];}var accountsTokens={};function getAccessToken(_0x1058f6){return new Promise(function(_0x4b97f0,_0x4f45a4){if(!_[_0x9ec7('0x1c')](accountsTokens[_0x1058f6['id']])&&!_[_0x9ec7('0x1c')](accountsTokens[_0x1058f6['id']]['access_token'])){if(moment()[_0x9ec7('0x1d')](accountsTokens[_0x1058f6['id']][_0x9ec7('0x1e')])){_0x4b97f0(accountsTokens[_0x1058f6['id']][_0x9ec7('0x1f')]);}}var _0x11f4e5;switch(_0x1058f6[_0x9ec7('0x20')]){case'US':_0x11f4e5='https://accounts.zoho.com';break;case'AU':_0x11f4e5=_0x9ec7('0x21');break;case'EU':_0x11f4e5=_0x9ec7('0x22');break;case'IN':_0x11f4e5=_0x9ec7('0x23');break;case'CN':_0x11f4e5=_0x9ec7('0x24');break;default:_0x11f4e5=_0x9ec7('0x22');break;}var _0x3ba220={'method':'POST','uri':_0x11f4e5+_0x9ec7('0x25'),'qs':{'refresh_token':_0x1058f6[_0x9ec7('0x26')],'client_id':_0x1058f6[_0x9ec7('0x27')],'client_secret':_0x1058f6[_0x9ec7('0x28')],'grant_type':_0x9ec7('0x29')},'json':!![]};return rp(_0x3ba220)[_0x9ec7('0x2a')](function(_0x1c3fbb){accountsTokens[_0x1058f6['id']]={'access_token':_0x1c3fbb[_0x9ec7('0x1f')],'expires_in':moment()[_0x9ec7('0x2b')](_0x1c3fbb[_0x9ec7('0x1e')],'seconds')};_0x4b97f0(_0x1c3fbb[_0x9ec7('0x1f')]);})[_0x9ec7('0x2c')](function(_0x541eca){logger['error'](_0x9ec7('0x2d'),_0x541eca['stack']);_0x4f45a4(_0x541eca);});});}function getUser(_0x458cd0,_0x175257,_0x1fa2ff,_0x228026){logger[_0x9ec7('0x2e')](_0x9ec7('0x2f'));return request({'method':_0x9ec7('0x30'),'uri':util[_0x9ec7('0x31')]('https://www.zohoapis.%s/crm/v2/users',_0x175257),'qs':{'type':_0x9ec7('0x32')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x458cd0},'json':!![]})[_0x9ec7('0x2a')](function(_0x445cc6){if(_0x445cc6[_0x9ec7('0x33')]){var _0x94e4a5=-0x1;if(_[_0x9ec7('0x34')](_0x445cc6[_0x9ec7('0x33')])){if(!_[_0x9ec7('0x1c')](_0x228026)){_0x94e4a5=_['findIndex'](_0x445cc6[_0x9ec7('0x33')],function(_0x342284){return _0x342284[_0x9ec7('0x35')]===_0x228026;});}if(_0x94e4a5>=0x0){logger[_0x9ec7('0x2e')]('Agent\x20found!');}else{logger[_0x9ec7('0x2e')](_0x9ec7('0x36'));_0x94e4a5=_['findIndex'](_0x445cc6[_0x9ec7('0x33')],function(_0x5bf8aa){return _0x5bf8aa[_0x9ec7('0x37')][_0x9ec7('0x18')]==='Administrator';});}return _0x445cc6[_0x9ec7('0x33')][_0x94e4a5];}else{if(_0x445cc6[_0x9ec7('0x38')][_0x9ec7('0x37')][_0x9ec7('0x18')]==='Administrator'){logger[_0x9ec7('0x2e')](_0x9ec7('0x36'));user=_0x445cc6[_0x9ec7('0x38')];return user;}else{logger[_0x9ec7('0x39')](_0x9ec7('0x3a'),JSON['stringify'](_0x445cc6));throw new Error(_0x9ec7('0x3b')+JSON[_0x9ec7('0x3c')](_0x445cc6));}}}else{logger[_0x9ec7('0x39')](_0x9ec7('0x3a'),JSON[_0x9ec7('0x3c')](_0x445cc6));throw new Error(_0x9ec7('0x3b')+JSON[_0x9ec7('0x3c')](_0x445cc6));}})[_0x9ec7('0x2c')](function(_0x5341ed){console[_0x9ec7('0x39')](_0x5341ed);});}function getZohoUser(_0x15ae2e,_0xff2cad){return new BPromise(function(_0x3dbc0c,_0x570244){request(_0x15ae2e)[_0x9ec7('0x2a')](function(_0x19c765){var _0x23cefb=null;if(_0x19c765){_0x23cefb=_0x19c765[_0x9ec7('0x3d')][0x0];_0x23cefb[_0x9ec7('0x3e')]=_0xff2cad;}_0x3dbc0c(_0x23cefb);})[_0x9ec7('0x2c')](function(_0x18e665){_0x570244(_0x18e665);});});}function createEndUser(_0x5d546a,_0x3b8ec8,_0x187288,_0x123312,_0x7c711f,_0x4902e0){var _0x187288=getName(_0x187288);return request({'method':_0x9ec7('0x3f'),'uri':_0x9ec7('0x40')+_0x3b8ec8+_0x9ec7('0x41')+_[_0x9ec7('0x42')](_0x4902e0[_0x9ec7('0x43')])+'s','body':{'data':[{'Last_Name':_0x187288[0x1],'First_Name':_0x187288[0x0],'Phone':_0x123312,'Owner':{'name':!_[_0x9ec7('0x1c')](_0x7c711f[_0x9ec7('0x44')][_0x9ec7('0x18')])?_0x7c711f[_0x9ec7('0x44')][_0x9ec7('0x18')]:!_[_0x9ec7('0x1c')](_0x7c711f[_0x9ec7('0x45')])?_0x7c711f[_0x9ec7('0x45')]+'\x20'+_0x7c711f[_0x9ec7('0x46')]:_0x7c711f[_0x9ec7('0x46')],'id':_0x7c711f['id']}}]},'headers':{'Authorization':_0x9ec7('0x47')+_0x5d546a},'json':!![]})[_0x9ec7('0x2a')](function(_0x383b0f){if(_0x383b0f&&_0x383b0f[_0x9ec7('0x3d')][0x0]['code']===_0x9ec7('0x48')){var _0x486b27=_0x383b0f['data'][0x0][_0x9ec7('0x49')];_0x486b27[_0x9ec7('0x3e')]=_[_0x9ec7('0x42')](_0x4902e0[_0x9ec7('0x43')])+'s';return _0x486b27;}logger[_0x9ec7('0x39')](_0x9ec7('0x3a'),JSON[_0x9ec7('0x3c')](data));throw new Error(_0x9ec7('0x4a')+JSON[_0x9ec7('0x3c')](data));})[_0x9ec7('0x2c')](function(_0xbb9f0e){console[_0x9ec7('0x4b')](_0x9ec7('0x4c'),_0xbb9f0e);});}function getEndUser(_0x114cfa,_0x23f77c,_0x1f7aff,_0x46d229,_0x579cb6,_0x42e4d9,_0x523cb1){var _0x1549a8={'method':_0x9ec7('0x30'),'uri':'','headers':{'Authorization':_0x9ec7('0x47')+_0x114cfa},'json':!![]};switch(_0x523cb1['moduleSearch']){case'contact_lead':_0x1549a8[_0x9ec7('0x4d')]=_0x9ec7('0x40')+_0x23f77c+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x579cb6+'))';return getZohoUser(_0x1549a8,_0x9ec7('0x4e'))[_0x9ec7('0x2a')](function(_0xab0c07){if(_0xab0c07)return _0xab0c07;_0x1549a8[_0x9ec7('0x4d')]=_0x9ec7('0x40')+_0x23f77c+_0x9ec7('0x4f')+_0x579cb6+'))';return getZohoUser(_0x1549a8,'Leads')[_0x9ec7('0x2a')](function(_0x44ca07){if(_0x44ca07)return _0x44ca07;if(_0x523cb1['moduleCreate']!=_0x9ec7('0x50')){return createEndUser(_0x114cfa,_0x23f77c,_0x46d229,_0x579cb6,_0x42e4d9,_0x523cb1);}else{return{};}});});break;case'contact':_0x1549a8['uri']='https://www.zohoapis.'+_0x23f77c+_0x9ec7('0x51')+_0x579cb6+'))';return getZohoUser(_0x1549a8,_0x9ec7('0x4e'))[_0x9ec7('0x2a')](function(_0x3db754){if(_0x3db754)return _0x3db754;if(_0x523cb1[_0x9ec7('0x43')]!=_0x9ec7('0x50')){return createEndUser(_0x114cfa,_0x23f77c,_0x46d229,_0x579cb6,_0x42e4d9,_0x523cb1);}else{return{};}});break;case _0x9ec7('0x52'):_0x1549a8['uri']='https://www.zohoapis.'+_0x23f77c+_0x9ec7('0x4f')+_0x579cb6+'))';return getZohoUser(_0x1549a8,_0x9ec7('0x53'))[_0x9ec7('0x2a')](function(_0xab0861){if(_0xab0861)return _0xab0861;if(_0x523cb1['moduleCreate']!='nothing'){return createEndUser(_0x114cfa,_0x23f77c,_0x46d229,_0x579cb6,_0x42e4d9,_0x523cb1);}else{return{};}});break;}}function getCall(_0x44b392,_0x599263,_0x2be51e,_0x2c8636,_0x3fcd2f,_0x1ab6d6,_0x27159b,_0x46f090){logger['info'](_0x9ec7('0x54'));var _0xf4940f={};_0xf4940f[_0x9ec7('0x55')]={'name':!_[_0x9ec7('0x1c')](_0x2c8636[_0x9ec7('0x44')][_0x9ec7('0x18')])&&!_[_0x9ec7('0x1c')](_0x2c8636[_0x9ec7('0x37')]['name'])&&_0x2c8636[_0x9ec7('0x37')][_0x9ec7('0x18')]==='administrator'?_0x2c8636[_0x9ec7('0x44')][_0x9ec7('0x18')]:!_[_0x9ec7('0x1c')](_0x2c8636[_0x9ec7('0x45')])?_0x2c8636[_0x9ec7('0x45')]+'\x20'+_0x2c8636['last_name']:_0x2c8636[_0x9ec7('0x46')],'id':_0x2c8636['id']};_0xf4940f['Subject']=intUtil[_0x9ec7('0x56')](_0x1ab6d6[_0x9ec7('0x57')],_0x27159b,'\x20');_0xf4940f['Description']=intUtil[_0x9ec7('0x56')](_0x1ab6d6[_0x9ec7('0x58')],_0x27159b,'\x0a');if(_0x3fcd2f[_0x9ec7('0x3e')]==='Contacts'){_0xf4940f[_0x9ec7('0x59')]={'name':!_['isNil'](_0x3fcd2f[_0x9ec7('0x5a')])?_0x3fcd2f[_0x9ec7('0x5a')]:!_[_0x9ec7('0x1c')](_0x3fcd2f[_0x9ec7('0x5b')])?_0x3fcd2f[_0x9ec7('0x5b')]+'\x20'+_0x3fcd2f[_0x9ec7('0x5c')]:_0x3fcd2f['Last_Name'],'id':_0x3fcd2f['id']};}if(_0x3fcd2f[_0x9ec7('0x3e')]===_0x9ec7('0x53')){_0xf4940f[_0x9ec7('0x5d')]={'name':!_['isNil'](_0x3fcd2f[_0x9ec7('0x5a')])?_0x3fcd2f[_0x9ec7('0x5a')]:!_[_0x9ec7('0x1c')](_0x3fcd2f[_0x9ec7('0x5b')])?_0x3fcd2f[_0x9ec7('0x5b')]+'\x20'+_0x3fcd2f[_0x9ec7('0x5c')]:_0x3fcd2f['Last_Name'],'id':_0x3fcd2f['id']};_0xf4940f[_0x9ec7('0x5e')]=_['startCase'](_0x3fcd2f[_0x9ec7('0x3e')]);}if(_0x27159b[_0x9ec7('0x5f')]){_0xf4940f[_0x9ec7('0x60')]=moment[_0x9ec7('0x61')](parseInt(_0x27159b['talktime'])*0x3e8)[_0x9ec7('0x31')]('mm:ss');}else if(_0x27159b['answertime']&&_0x27159b[_0x9ec7('0x62')]){_0xf4940f[_0x9ec7('0x60')]=moment[_0x9ec7('0x61')](moment(_0x27159b[_0x9ec7('0x62')],_0x9ec7('0x63'))['diff'](moment(_0x27159b[_0x9ec7('0x64')],_0x9ec7('0x63'))))['format']('mm:ss');}switch(_0x27159b['lastevent']){case'called':_0xf4940f[_0x9ec7('0x65')]=_0x9ec7('0x66');break;case _0x9ec7('0x67'):case'connect':_0xf4940f['Call_Result']=_0x9ec7('0x68');break;case _0x9ec7('0x69'):_0xf4940f[_0x9ec7('0x65')]=_0x9ec7('0x6a');break;case _0x9ec7('0x6b'):_0xf4940f[_0x9ec7('0x65')]=_0x9ec7('0x6c');break;case'timeout':_0xf4940f[_0x9ec7('0x65')]=_0x9ec7('0x6d');default:}_0xf4940f[_0x9ec7('0x6e')]=(_0x46f090==='outbound'?moment(_0x27159b[_0x9ec7('0x64')])[_0x9ec7('0x31')](_0x9ec7('0x63')):moment(_0x27159b[_0x9ec7('0x6f')])[_0x9ec7('0x31')](_0x9ec7('0x63')))||moment()[_0x9ec7('0x31')](_0x9ec7('0x63'));_0xf4940f[_0x9ec7('0x70')]=_0x46f090||_0x9ec7('0x71');_0xf4940f=_['merge'](_0xf4940f,getCustomFields(_0x1ab6d6[_0x9ec7('0x72')],_0x27159b));return request({'method':'POST','uri':_0x9ec7('0x40')+_0x599263+_0x9ec7('0x73'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x44b392},'body':{'data':[_0xf4940f]},'json':!![]})[_0x9ec7('0x2a')](function(_0x9e29a7){if(_0x9e29a7&&_0x9e29a7[_0x9ec7('0x3d')][0x0][_0x9ec7('0x74')]===_0x9ec7('0x48')){logger[_0x9ec7('0x2e')](_0x9ec7('0x75'));return{'id':_0x9e29a7[_0x9ec7('0x3d')][0x0]['details']['id']};}})[_0x9ec7('0x2c')](function(_0x49fa62){logger[_0x9ec7('0x2e')]('err',_0x49fa62[_0x9ec7('0x76')]);console[_0x9ec7('0x4b')](_0x9ec7('0x77'),_0x49fa62);});}exports[_0x9ec7('0x78')]=function(_0x22ca3f,_0x24fd1c,_0x1a5a2a,_0x110d6c,_0x2c5c9a,_0xad8f4a){var _0x6b3f9,_0x27cd2d,_0x3fd718;_0xad8f4a[_0x9ec7('0x79')]=intUtil['stripTrailingSlash'](_0xad8f4a[_0x9ec7('0x79')]);_0xad8f4a[_0x9ec7('0x7a')]=intUtil[_0x9ec7('0x7b')](_0xad8f4a[_0x9ec7('0x7a')]);if(_0x2c5c9a&&_0x2c5c9a[_0x9ec7('0x7c')]){logger[_0x9ec7('0x2e')](_0x9ec7('0x7d'),_0x9ec7('0x7e'));_0x24fd1c[_0x9ec7('0x7f')]=_0xad8f4a[_0x9ec7('0x7a')]+_0x9ec7('0x80')+_0x24fd1c['uniqueid']+_0x9ec7('0x81')+md5(_0x24fd1c['uniqueid']);}else{_0x24fd1c[_0x9ec7('0x7f')]='';}var _0x2766d7=_0xad8f4a[_0x9ec7('0x79')]==='zoho.eu'?'eu':_0x9ec7('0x82');return getAccessToken(_0xad8f4a)[_0x9ec7('0x2a')](function(_0x15f87c){_0x3fd718=_0x15f87c;return getUser(_0x3fd718,_0x2766d7,_0xad8f4a,_0x110d6c[_0x9ec7('0x35')]);})[_0x9ec7('0x2a')](function(_0x34b384){_0x6b3f9=_0x34b384;logger[_0x9ec7('0x2e')](_0x9ec7('0x83'),_0x6b3f9['id']);return getEndUser(_0x3fd718,_0x2766d7,_0xad8f4a,_0x24fd1c[_0x9ec7('0x84')],_0x24fd1c[_0x9ec7('0x85')],_0x6b3f9,_0x1a5a2a);})[_0x9ec7('0x2a')](function(_0x4a4d65){_0x27cd2d=_0x4a4d65;return getCall(_0x3fd718,_0x2766d7,_0xad8f4a,_0x6b3f9,_0x27cd2d,_0x1a5a2a,_0x24fd1c,'Inbound');})[_0x9ec7('0x2a')](function(_0x50fa7f){if(_0x50fa7f){logger[_0x9ec7('0x2e')]('The\x20Call\x20ID\x20is:',_0x50fa7f['id']);logger[_0x9ec7('0x2e')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9ec7('0x31')]('user:%s',_0x110d6c[_0x9ec7('0x18')]),_0x9ec7('0x86'),{'uri':_0x9ec7('0x87')+_0xad8f4a['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x50fa7f['id']});}})[_0x9ec7('0x2c')](function(_0x5e2dd9){logger[_0x9ec7('0x39')](_0x9ec7('0x7d'),JSON[_0x9ec7('0x3c')](_0x5e2dd9));});};exports['outbound']=function(_0x1bc72a,_0x4f13ce,_0x5e8dd0,_0xb48eb6,_0x2a3b52,_0xa12306,_0x3b4865){var _0x5a2de7,_0x42e0cf,_0x457313;_0xa12306[_0x9ec7('0x79')]=intUtil['stripTrailingSlash'](_0xa12306[_0x9ec7('0x79')]);_0xa12306[_0x9ec7('0x7a')]=intUtil['stripTrailingSlash'](_0xa12306[_0x9ec7('0x7a')]);if(_0x3b4865&&_0x3b4865[_0x9ec7('0x88')]&&_0x3b4865[_0x9ec7('0x88')]!=='none'){logger[_0x9ec7('0x2e')](_0x9ec7('0x89'),'Recording\x20is\x20enabled!');_0x4f13ce[_0x9ec7('0x7f')]=_0xa12306['serverUrl']+_0x9ec7('0x80')+_0x4f13ce['uniqueid']+_0x9ec7('0x81')+md5(_0x4f13ce[_0x9ec7('0x8a')]);}var _0x4e1c5e=_0xa12306[_0x9ec7('0x79')]===_0x9ec7('0x8b')?'eu':_0x9ec7('0x82');return getAccessToken(_0xa12306)[_0x9ec7('0x2a')](function(_0x51b652){_0x457313=_0x51b652;return getUser(_0x457313,_0x4e1c5e,_0xa12306,_0xb48eb6[_0x9ec7('0x35')]);})['then'](function(_0x31a344){_0x5a2de7=_0x31a344;logger[_0x9ec7('0x2e')](_0x9ec7('0x83'),_0x5a2de7['id']);return getEndUser(_0x457313,_0x4e1c5e,_0xa12306,_0x4f13ce[_0x9ec7('0x8c')],_0x4f13ce[_0x9ec7('0x8d')],_0x5a2de7,_0x5e8dd0);})['then'](function(_0x263a00){_0x42e0cf=_0x263a00;return getCall(_0x457313,_0x4e1c5e,_0xa12306,_0x5a2de7,_0x42e0cf,_0x5e8dd0,_0x4f13ce,_0x9ec7('0x8e'));})[_0x9ec7('0x2a')](function(_0x598ff2){if(_0x598ff2){logger[_0x9ec7('0x2e')](_0x9ec7('0x8f'),_0x598ff2['id']);logger[_0x9ec7('0x2e')](_0x9ec7('0x89'),_0x9ec7('0x90'));emit(util[_0x9ec7('0x31')](_0x9ec7('0x91'),_0xb48eb6[_0x9ec7('0x18')]),_0x9ec7('0x86'),{'uri':_0x9ec7('0x87')+_0xa12306[_0x9ec7('0x79')]+_0x9ec7('0x92')+_0x598ff2['id']});}})['catch'](function(_0x43e4de){logger[_0x9ec7('0x39')]('[OUTBOUND]',JSON[_0x9ec7('0x3c')](_0x43e4de));});};exports['unmanaged']=function(_0x36ff66,_0x7adce0,_0xbc1dc0,_0xb8a242,_0x11ff64,_0x4d957c){var _0x225c4e,_0x461e72,_0xd2b5dc;_0x4d957c[_0x9ec7('0x79')]=intUtil[_0x9ec7('0x7b')](_0x4d957c[_0x9ec7('0x79')]);_0x4d957c['serverUrl']=intUtil[_0x9ec7('0x7b')](_0x4d957c[_0x9ec7('0x7a')]);if(_0x11ff64&&_0x11ff64[_0x9ec7('0x7c')]){logger['info']('['+_0x7adce0[_0x9ec7('0x93')][_0x9ec7('0x94')]()+']',_0x9ec7('0x7e'));_0x7adce0[_0x9ec7('0x7f')]=_0x4d957c['serverUrl']+_0x9ec7('0x80')+_0x7adce0[_0x9ec7('0x8a')]+'/downloads?type=uniqueid&token='+md5(_0x7adce0[_0x9ec7('0x8a')]);}else{_0x7adce0[_0x9ec7('0x7f')]='';}var _0x4b45c5=_0x4d957c['host']===_0x9ec7('0x8b')?'eu':_0x9ec7('0x82');return getAccessToken(_0x4d957c)[_0x9ec7('0x2a')](function(_0x31754a){_0xd2b5dc=_0x31754a;return getUser(_0xd2b5dc,_0x4b45c5,_0x4d957c);})[_0x9ec7('0x2a')](function(_0x3afdf1){_0x225c4e=_0x3afdf1;logger[_0x9ec7('0x2e')](_0x9ec7('0x83'),_0x225c4e['id']);return getEndUser(_0xd2b5dc,_0x4b45c5,_0x4d957c,_0x7adce0[_0x9ec7('0x84')],_0x7adce0[_0x9ec7('0x85')],_0x225c4e,_0xbc1dc0);})['then'](function(_0x156fa1){_0x461e72=_0x156fa1;return getCall(_0xd2b5dc,_0x4b45c5,_0x4d957c,_0x225c4e,_0x461e72,_0xbc1dc0,_0x7adce0,_0x9ec7('0x71'));})['then'](function(_0x3c910e){if(_0x3c910e){logger[_0x9ec7('0x2e')](_0x9ec7('0x8f'),_0x3c910e['id']);}})[_0x9ec7('0x2c')](function(_0x38b434){logger[_0x9ec7('0x39')]('['+_0x7adce0[_0x9ec7('0x93')][_0x9ec7('0x94')]()+']',JSON[_0x9ec7('0x3c')](_0x38b434));});}; \ No newline at end of file +var _0x1d65=['The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','details','startCase','Error:\x20','log','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','nothing','contact','Contacts','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','utc','talktime','mm:ss','answertime','Call_Duration','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Call_Result','Called','complete','connect','abandoned','Abandoned','timeout','Call_Start_Time','outbound','starttime','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','recordingURL','zoho.eu','calleridname','calleridnum','The\x20Call\x20ID\x20is:','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','user:%s','https://crm.','unmanaged','toUpperCase','com','The\x20User\x20ID\x20is:','lodash','request-promise','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user'];(function(_0x279a53,_0x69e5d6){var _0x5172f0=function(_0x52b76e){while(--_0x52b76e){_0x279a53['push'](_0x279a53['shift']());}};_0x5172f0(++_0x69e5d6);}(_0x1d65,0x199));var _0x51d6=function(_0x1a1269,_0x4d8e3c){_0x1a1269=_0x1a1269-0x0;var _0xe0e23f=_0x1d65[_0x1a1269];return _0xe0e23f;};'use strict';var _=require(_0x51d6('0x0'));var rp=require(_0x51d6('0x1'));var md5=require(_0x51d6('0x2'));var util=require(_0x51d6('0x3'));var intUtil=require(_0x51d6('0x4'));var moment=require(_0x51d6('0x5'));var Redis=require('ioredis');var BPromise=require(_0x51d6('0x6'));var config=require(_0x51d6('0x7'));var logger=require(_0x51d6('0x8'))(_0x51d6('0x9'));config[_0x51d6('0xa')]=_[_0x51d6('0xb')](config[_0x51d6('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x51d6('0xc'))(new Redis(config[_0x51d6('0xa')]));function emit(_0x4623b6,_0x2209b6,_0x7cac2a){io['to'](_0x4623b6)[_0x51d6('0xd')](_0x2209b6,_0x7cac2a);}function request(_0x4fb6ea){logger[_0x51d6('0xe')](_0x51d6('0xf'),JSON[_0x51d6('0x10')](_0x4fb6ea));return rp(_0x4fb6ea);}function getCustomFields(_0x447d78,_0x13d510){var _0x215837={};if(_0x447d78[_0x51d6('0x11')]>0x0){_[_0x51d6('0x12')](_0x447d78,function(_0x1fcbea){if(_[_0x51d6('0x13')]([_0x51d6('0x14'),_0x51d6('0x15')],_0x1fcbea[_0x51d6('0x16')])&&_0x1fcbea[_0x51d6('0x17')]){_0x215837[_0x1fcbea[_0x51d6('0x17')]]=_0x1fcbea[_0x51d6('0x18')][_0x51d6('0x19')]();}else if(_0x1fcbea[_0x51d6('0x16')]===_0x51d6('0x1a')&&_0x1fcbea[_0x51d6('0x1b')]&&_0x1fcbea[_0x51d6('0x17')]&&_0x13d510[_0x1fcbea[_0x51d6('0x1b')]]){_0x215837[_0x1fcbea['idField']]=_0x13d510[_0x1fcbea['variableName']][_0x51d6('0x19')]();}else if(_0x1fcbea[_0x51d6('0x16')]==='customVariable'&&_0x1fcbea['Variable']&&_0x1fcbea[_0x51d6('0x1c')][_0x51d6('0x1d')]&&_0x1fcbea[_0x51d6('0x17')]&&_0x13d510[_0x1fcbea[_0x51d6('0x1c')]['name'][_0x51d6('0x1e')]()]){_0x215837[_0x1fcbea[_0x51d6('0x17')]]=_0x13d510[_0x1fcbea[_0x51d6('0x1c')]['name'][_0x51d6('0x1e')]()][_0x51d6('0x19')]();}});}return _0x215837;}function getName(_0x3daebc){if(_0x3daebc[_0x51d6('0x1f')]('\x20')>0x0){var _0x1bcfd4=_0x3daebc[_0x51d6('0x20')](/ (.+)/);if(_0x1bcfd4[0x1]){return _0x1bcfd4;}}return[_0x3daebc,_0x3daebc];}var accountsTokens={};function getAccessToken(_0x24a11c){return new Promise(function(_0x41cc14,_0x29caf8){if(!_[_0x51d6('0x21')](accountsTokens[_0x24a11c['id']])&&!_['isNil'](accountsTokens[_0x24a11c['id']][_0x51d6('0x22')])){if(moment()[_0x51d6('0x23')](accountsTokens[_0x24a11c['id']][_0x51d6('0x24')])){_0x41cc14(accountsTokens[_0x24a11c['id']][_0x51d6('0x22')]);}}var _0x126b5;switch(_0x24a11c['zone']){case'US':_0x126b5=_0x51d6('0x25');break;case'AU':_0x126b5=_0x51d6('0x26');break;case'EU':_0x126b5=_0x51d6('0x27');break;case'IN':_0x126b5=_0x51d6('0x28');break;case'CN':_0x126b5=_0x51d6('0x29');break;default:_0x126b5='https://accounts.zoho.eu';break;}var _0x21c04b={'method':_0x51d6('0x2a'),'uri':_0x126b5+_0x51d6('0x2b'),'qs':{'refresh_token':_0x24a11c[_0x51d6('0x2c')],'client_id':_0x24a11c[_0x51d6('0x2d')],'client_secret':_0x24a11c[_0x51d6('0x2e')],'grant_type':_0x51d6('0x2f')},'json':!![]};return rp(_0x21c04b)[_0x51d6('0x30')](function(_0x406cf5){accountsTokens[_0x24a11c['id']]={'access_token':_0x406cf5[_0x51d6('0x22')],'expires_in':moment()['add'](_0x406cf5[_0x51d6('0x24')],'seconds')};_0x41cc14(_0x406cf5['access_token']);})[_0x51d6('0x31')](function(_0x5a829a){logger[_0x51d6('0x32')](_0x51d6('0x33'),_0x5a829a[_0x51d6('0x34')]);_0x29caf8(_0x5a829a);});});}function getUser(_0x3e2a1d,_0x4bfd72,_0x15d510,_0x380a75){logger[_0x51d6('0x35')](_0x51d6('0x36'));return request({'method':_0x51d6('0x37'),'uri':util[_0x51d6('0x38')](_0x51d6('0x39'),_0x4bfd72),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x51d6('0x3a')+_0x3e2a1d},'json':!![]})[_0x51d6('0x30')](function(_0x434c75){if(_0x434c75[_0x51d6('0x3b')]){var _0x165511=-0x1;if(_[_0x51d6('0x3c')](_0x434c75[_0x51d6('0x3b')])){if(!_['isNil'](_0x380a75)){_0x165511=_[_0x51d6('0x3d')](_0x434c75[_0x51d6('0x3b')],function(_0x165d66){return _0x165d66[_0x51d6('0x3e')]===_0x380a75;});}if(_0x165511>=0x0){logger[_0x51d6('0x35')](_0x51d6('0x3f'));}else{logger[_0x51d6('0x35')](_0x51d6('0x40'));_0x165511=_[_0x51d6('0x3d')](_0x434c75[_0x51d6('0x3b')],function(_0x54b8cb){return _0x54b8cb[_0x51d6('0x41')][_0x51d6('0x1d')]===_0x51d6('0x42');});}return _0x434c75['users'][_0x165511];}else{if(_0x434c75[_0x51d6('0x43')]['profile'][_0x51d6('0x1d')]===_0x51d6('0x42')){logger[_0x51d6('0x35')]('Using\x20the\x20admin\x20account!');user=_0x434c75[_0x51d6('0x43')];return user;}else{logger['error'](_0x51d6('0x44'),JSON[_0x51d6('0x10')](_0x434c75));throw new Error(_0x51d6('0x45')+JSON['stringify'](_0x434c75));}}}else{logger['error'](_0x51d6('0x44'),JSON[_0x51d6('0x10')](_0x434c75));throw new Error(_0x51d6('0x45')+JSON['stringify'](_0x434c75));}})[_0x51d6('0x31')](function(_0x24459d){console['error'](_0x24459d);});}function getZohoUser(_0xf9b6bd,_0x2acac8){return new BPromise(function(_0x2961b7,_0x135c01){request(_0xf9b6bd)[_0x51d6('0x30')](function(_0x56bea5){var _0x24350c=null;if(_0x56bea5){_0x24350c=_0x56bea5[_0x51d6('0x46')][0x0];_0x24350c[_0x51d6('0x47')]=_0x2acac8;}_0x2961b7(_0x24350c);})[_0x51d6('0x31')](function(_0x53bf24){_0x135c01(_0x53bf24);});});}function createEndUser(_0x200bba,_0x4852ba,_0x290344,_0x11e580,_0x49c652,_0x19dfdc){var _0x290344=getName(_0x290344);return request({'method':_0x51d6('0x2a'),'uri':_0x51d6('0x48')+_0x4852ba+_0x51d6('0x49')+_['startCase'](_0x19dfdc[_0x51d6('0x4a')])+'s','body':{'data':[{'Last_Name':_0x290344[0x1],'First_Name':_0x290344[0x0],'Phone':_0x11e580,'Owner':{'name':!_[_0x51d6('0x21')](_0x49c652[_0x51d6('0x4b')][_0x51d6('0x1d')])?_0x49c652[_0x51d6('0x4b')][_0x51d6('0x1d')]:!_[_0x51d6('0x21')](_0x49c652[_0x51d6('0x4c')])?_0x49c652[_0x51d6('0x4c')]+'\x20'+_0x49c652[_0x51d6('0x4d')]:_0x49c652[_0x51d6('0x4d')],'id':_0x49c652['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x200bba},'json':!![]})[_0x51d6('0x30')](function(_0x168dd6){if(_0x168dd6&&_0x168dd6['data'][0x0][_0x51d6('0x4e')]===_0x51d6('0x4f')){var _0x32667d=_0x168dd6['data'][0x0][_0x51d6('0x50')];_0x32667d[_0x51d6('0x47')]=_[_0x51d6('0x51')](_0x19dfdc['moduleCreate'])+'s';return _0x32667d;}logger['error'](_0x51d6('0x44'),JSON[_0x51d6('0x10')](data));throw new Error(_0x51d6('0x52')+JSON[_0x51d6('0x10')](data));})[_0x51d6('0x31')](function(_0x2289f3){console[_0x51d6('0x53')]('CREATE\x20ERROR',_0x2289f3);});}function getEndUser(_0x4963a5,_0x5dcb7a,_0x58b161,_0x3b9a67,_0x5a0a4c,_0x579b0b,_0x3312ab){var _0x18235f={'method':'GET','uri':'','headers':{'Authorization':_0x51d6('0x3a')+_0x4963a5},'json':!![]};switch(_0x3312ab[_0x51d6('0x54')]){case _0x51d6('0x55'):_0x18235f[_0x51d6('0x56')]=_0x51d6('0x48')+_0x5dcb7a+_0x51d6('0x57')+_0x5a0a4c+'))';return getZohoUser(_0x18235f,'Contacts')[_0x51d6('0x30')](function(_0x612105){if(_0x612105)return _0x612105;_0x18235f[_0x51d6('0x56')]=_0x51d6('0x48')+_0x5dcb7a+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x5a0a4c+'))';return getZohoUser(_0x18235f,'Leads')[_0x51d6('0x30')](function(_0x27f92b){if(_0x27f92b)return _0x27f92b;if(_0x3312ab[_0x51d6('0x4a')]!=_0x51d6('0x58')){return createEndUser(_0x4963a5,_0x5dcb7a,_0x3b9a67,_0x5a0a4c,_0x579b0b,_0x3312ab);}else{return{};}});});break;case _0x51d6('0x59'):_0x18235f[_0x51d6('0x56')]=_0x51d6('0x48')+_0x5dcb7a+_0x51d6('0x57')+_0x5a0a4c+'))';return getZohoUser(_0x18235f,_0x51d6('0x5a'))[_0x51d6('0x30')](function(_0x1dd2eb){if(_0x1dd2eb)return _0x1dd2eb;if(_0x3312ab[_0x51d6('0x4a')]!=_0x51d6('0x58')){return createEndUser(_0x4963a5,_0x5dcb7a,_0x3b9a67,_0x5a0a4c,_0x579b0b,_0x3312ab);}else{return{};}});break;case _0x51d6('0x5b'):_0x18235f['uri']=_0x51d6('0x48')+_0x5dcb7a+_0x51d6('0x5c')+_0x5a0a4c+'))';return getZohoUser(_0x18235f,_0x51d6('0x5d'))[_0x51d6('0x30')](function(_0x55928f){if(_0x55928f)return _0x55928f;if(_0x3312ab[_0x51d6('0x4a')]!='nothing'){return createEndUser(_0x4963a5,_0x5dcb7a,_0x3b9a67,_0x5a0a4c,_0x579b0b,_0x3312ab);}else{return{};}});break;}}function getCall(_0x5694bb,_0x3885cd,_0x51d208,_0x35f940,_0x5b9bad,_0x43cdd3,_0x2f15ab,_0x421a70){logger[_0x51d6('0x35')](_0x51d6('0x5e'));var _0x4b297a={};_0x4b297a[_0x51d6('0x5f')]={'name':!_[_0x51d6('0x21')](_0x35f940['role'][_0x51d6('0x1d')])&&!_[_0x51d6('0x21')](_0x35f940['profile']['name'])&&_0x35f940[_0x51d6('0x41')]['name']===_0x51d6('0x60')?_0x35f940[_0x51d6('0x4b')][_0x51d6('0x1d')]:!_['isNil'](_0x35f940[_0x51d6('0x4c')])?_0x35f940['first_name']+'\x20'+_0x35f940[_0x51d6('0x4d')]:_0x35f940[_0x51d6('0x4d')],'id':_0x35f940['id']};_0x4b297a[_0x51d6('0x61')]=intUtil[_0x51d6('0x62')](_0x43cdd3[_0x51d6('0x63')],_0x2f15ab,'\x20');_0x4b297a['Description']=intUtil[_0x51d6('0x62')](_0x43cdd3[_0x51d6('0x64')],_0x2f15ab,'\x0a');if(_0x5b9bad['enduserType']===_0x51d6('0x5a')){_0x4b297a[_0x51d6('0x65')]={'name':!_[_0x51d6('0x21')](_0x5b9bad[_0x51d6('0x66')])?_0x5b9bad['Full_Name']:!_[_0x51d6('0x21')](_0x5b9bad['First_Name'])?_0x5b9bad[_0x51d6('0x67')]+'\x20'+_0x5b9bad[_0x51d6('0x68')]:_0x5b9bad[_0x51d6('0x68')],'id':_0x5b9bad['id']};}if(_0x5b9bad[_0x51d6('0x47')]===_0x51d6('0x5d')){_0x4b297a[_0x51d6('0x69')]={'name':!_[_0x51d6('0x21')](_0x5b9bad[_0x51d6('0x66')])?_0x5b9bad[_0x51d6('0x66')]:!_[_0x51d6('0x21')](_0x5b9bad[_0x51d6('0x67')])?_0x5b9bad[_0x51d6('0x67')]+'\x20'+_0x5b9bad[_0x51d6('0x68')]:_0x5b9bad[_0x51d6('0x68')],'id':_0x5b9bad['id']};_0x4b297a[_0x51d6('0x6a')]=_[_0x51d6('0x51')](_0x5b9bad['enduserType']);}if(_0x2f15ab['talktime']){_0x4b297a['Call_Duration']=moment[_0x51d6('0x6b')](parseInt(_0x2f15ab[_0x51d6('0x6c')])*0x3e8)[_0x51d6('0x38')](_0x51d6('0x6d'));}else if(_0x2f15ab[_0x51d6('0x6e')]&&_0x2f15ab['endtime']){_0x4b297a[_0x51d6('0x6f')]=moment[_0x51d6('0x6b')](moment(_0x2f15ab[_0x51d6('0x70')],_0x51d6('0x71'))[_0x51d6('0x72')](moment(_0x2f15ab['starttime'],_0x51d6('0x71'))))[_0x51d6('0x38')]('mm:ss');}switch(_0x2f15ab[_0x51d6('0x73')]){case'called':_0x4b297a[_0x51d6('0x74')]=_0x51d6('0x75');break;case _0x51d6('0x76'):case _0x51d6('0x77'):_0x4b297a[_0x51d6('0x74')]='Answered';break;case'rejected':_0x4b297a[_0x51d6('0x74')]='Rejected';break;case _0x51d6('0x78'):_0x4b297a[_0x51d6('0x74')]=_0x51d6('0x79');break;case _0x51d6('0x7a'):_0x4b297a['Call_Result']='Timeout';default:}_0x4b297a[_0x51d6('0x7b')]=(_0x421a70===_0x51d6('0x7c')?moment(_0x2f15ab[_0x51d6('0x7d')])[_0x51d6('0x38')](_0x51d6('0x71')):moment(_0x2f15ab['agentcalledAt'])['format'](_0x51d6('0x71')))||moment()[_0x51d6('0x38')](_0x51d6('0x71'));_0x4b297a['Call_Type']=_0x421a70||_0x51d6('0x7e');_0x4b297a=_[_0x51d6('0x7f')](_0x4b297a,getCustomFields(_0x43cdd3['Fields'],_0x2f15ab));return request({'method':_0x51d6('0x2a'),'uri':'https://www.zohoapis.'+_0x3885cd+_0x51d6('0x80'),'headers':{'Authorization':_0x51d6('0x3a')+_0x5694bb},'body':{'data':[_0x4b297a]},'json':!![]})[_0x51d6('0x30')](function(_0x312d1c){if(_0x312d1c&&_0x312d1c[_0x51d6('0x46')][0x0][_0x51d6('0x4e')]===_0x51d6('0x4f')){logger[_0x51d6('0x35')](_0x51d6('0x81'));return{'id':_0x312d1c['data'][0x0][_0x51d6('0x50')]['id']};}})[_0x51d6('0x31')](function(_0x5a0012){logger[_0x51d6('0x35')](_0x51d6('0x82'),_0x5a0012['stack']);console[_0x51d6('0x53')]('err',_0x5a0012);});}exports[_0x51d6('0x83')]=function(_0x1b5a55,_0x412a5b,_0x3c532b,_0x27006e,_0x25cd25,_0x86c735){var _0x4936b1,_0x3e11ef,_0x2b990f;_0x86c735[_0x51d6('0x84')]=intUtil[_0x51d6('0x85')](_0x86c735[_0x51d6('0x84')]);_0x86c735[_0x51d6('0x86')]=intUtil[_0x51d6('0x85')](_0x86c735[_0x51d6('0x86')]);if(_0x25cd25&&_0x25cd25[_0x51d6('0x87')]){logger[_0x51d6('0x35')](_0x51d6('0x88'),'Recording\x20is\x20enabled!');_0x412a5b['recordingURL']=_0x86c735['serverUrl']+_0x51d6('0x89')+_0x412a5b['uniqueid']+_0x51d6('0x8a')+md5(_0x412a5b[_0x51d6('0x8b')]);}else{_0x412a5b[_0x51d6('0x8c')]='';}var _0x21e801=_0x86c735[_0x51d6('0x84')]===_0x51d6('0x8d')?'eu':'com';return getAccessToken(_0x86c735)[_0x51d6('0x30')](function(_0x59202f){_0x2b990f=_0x59202f;return getUser(_0x2b990f,_0x21e801,_0x86c735,_0x27006e['email']);})[_0x51d6('0x30')](function(_0x3cd1e3){_0x4936b1=_0x3cd1e3;logger['info']('The\x20User\x20ID\x20is:',_0x4936b1['id']);return getEndUser(_0x2b990f,_0x21e801,_0x86c735,_0x412a5b[_0x51d6('0x8e')],_0x412a5b[_0x51d6('0x8f')],_0x4936b1,_0x3c532b);})[_0x51d6('0x30')](function(_0x1689aa){_0x3e11ef=_0x1689aa;return getCall(_0x2b990f,_0x21e801,_0x86c735,_0x4936b1,_0x3e11ef,_0x3c532b,_0x412a5b,_0x51d6('0x7e'));})[_0x51d6('0x30')](function(_0x1d09fa){if(_0x1d09fa){logger[_0x51d6('0x35')](_0x51d6('0x90'),_0x1d09fa['id']);logger[_0x51d6('0x35')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x51d6('0x38')]('user:%s',_0x27006e[_0x51d6('0x1d')]),_0x51d6('0x91'),{'uri':'https://crm.'+_0x86c735['host']+_0x51d6('0x92')+_0x1d09fa['id']});}})[_0x51d6('0x31')](function(_0x1828c5){logger[_0x51d6('0x32')](_0x51d6('0x88'),JSON['stringify'](_0x1828c5));});};exports[_0x51d6('0x7c')]=function(_0xab6918,_0x4f1290,_0x109500,_0x344615,_0x221fe9,_0x4df405,_0x5762fc){var _0x5b364f,_0x5e8fe0,_0x1bffe2;_0x4df405[_0x51d6('0x84')]=intUtil[_0x51d6('0x85')](_0x4df405['host']);_0x4df405[_0x51d6('0x86')]=intUtil[_0x51d6('0x85')](_0x4df405['serverUrl']);if(_0x5762fc&&_0x5762fc[_0x51d6('0x93')]&&_0x5762fc[_0x51d6('0x93')]!==_0x51d6('0x94')){logger[_0x51d6('0x35')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4f1290[_0x51d6('0x8c')]=_0x4df405[_0x51d6('0x86')]+'/api/voice/recordings/'+_0x4f1290['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x4f1290[_0x51d6('0x8b')]);}var _0x162251=_0x4df405[_0x51d6('0x84')]===_0x51d6('0x8d')?'eu':'com';return getAccessToken(_0x4df405)[_0x51d6('0x30')](function(_0x2fc0ce){_0x1bffe2=_0x2fc0ce;return getUser(_0x1bffe2,_0x162251,_0x4df405,_0x344615[_0x51d6('0x3e')]);})[_0x51d6('0x30')](function(_0x3de3c0){_0x5b364f=_0x3de3c0;logger[_0x51d6('0x35')]('The\x20User\x20ID\x20is:',_0x5b364f['id']);return getEndUser(_0x1bffe2,_0x162251,_0x4df405,_0x4f1290[_0x51d6('0x95')],_0x4f1290[_0x51d6('0x96')],_0x5b364f,_0x109500);})[_0x51d6('0x30')](function(_0x509884){_0x5e8fe0=_0x509884;return getCall(_0x1bffe2,_0x162251,_0x4df405,_0x5b364f,_0x5e8fe0,_0x109500,_0x4f1290,_0x51d6('0x97'));})[_0x51d6('0x30')](function(_0x4b8edb){if(_0x4b8edb){logger['info'](_0x51d6('0x90'),_0x4b8edb['id']);logger[_0x51d6('0x35')](_0x51d6('0x98'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x51d6('0x38')](_0x51d6('0x99'),_0x344615[_0x51d6('0x1d')]),_0x51d6('0x91'),{'uri':_0x51d6('0x9a')+_0x4df405['host']+_0x51d6('0x92')+_0x4b8edb['id']});}})['catch'](function(_0x171c1c){logger[_0x51d6('0x32')](_0x51d6('0x98'),JSON[_0x51d6('0x10')](_0x171c1c));});};exports[_0x51d6('0x9b')]=function(_0x5ef930,_0x4d63d6,_0x308f6b,_0x3e0dd9,_0x344de7,_0x5cdb0a){var _0x5e8bf3,_0x5d3c00,_0xb3309a;_0x5cdb0a[_0x51d6('0x84')]=intUtil['stripTrailingSlash'](_0x5cdb0a[_0x51d6('0x84')]);_0x5cdb0a['serverUrl']=intUtil['stripTrailingSlash'](_0x5cdb0a[_0x51d6('0x86')]);if(_0x344de7&&_0x344de7[_0x51d6('0x87')]){logger['info']('['+_0x4d63d6['lastevent'][_0x51d6('0x9c')]()+']','Recording\x20is\x20enabled!');_0x4d63d6[_0x51d6('0x8c')]=_0x5cdb0a[_0x51d6('0x86')]+_0x51d6('0x89')+_0x4d63d6['uniqueid']+_0x51d6('0x8a')+md5(_0x4d63d6[_0x51d6('0x8b')]);}else{_0x4d63d6[_0x51d6('0x8c')]='';}var _0x20bbd4=_0x5cdb0a[_0x51d6('0x84')]===_0x51d6('0x8d')?'eu':_0x51d6('0x9d');return getAccessToken(_0x5cdb0a)[_0x51d6('0x30')](function(_0x154408){_0xb3309a=_0x154408;return getUser(_0xb3309a,_0x20bbd4,_0x5cdb0a);})[_0x51d6('0x30')](function(_0x1d6976){_0x5e8bf3=_0x1d6976;logger[_0x51d6('0x35')](_0x51d6('0x9e'),_0x5e8bf3['id']);return getEndUser(_0xb3309a,_0x20bbd4,_0x5cdb0a,_0x4d63d6[_0x51d6('0x8e')],_0x4d63d6[_0x51d6('0x8f')],_0x5e8bf3,_0x308f6b);})[_0x51d6('0x30')](function(_0x53f431){_0x5d3c00=_0x53f431;return getCall(_0xb3309a,_0x20bbd4,_0x5cdb0a,_0x5e8bf3,_0x5d3c00,_0x308f6b,_0x4d63d6,_0x51d6('0x7e'));})[_0x51d6('0x30')](function(_0x5dd976){if(_0x5dd976){logger[_0x51d6('0x35')](_0x51d6('0x90'),_0x5dd976['id']);}})[_0x51d6('0x31')](function(_0xe8ea48){logger[_0x51d6('0x32')]('['+_0x4d63d6[_0x51d6('0x73')]['toUpperCase']()+']',JSON['stringify'](_0xe8ea48));});}; \ 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 78fb570..ebb2e8c 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 _0xeaf4=['format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','exec','data3','error'];(function(_0x18c0bc,_0x3d9186){var _0x440c03=function(_0x399a3f){while(--_0x399a3f){_0x18c0bc['push'](_0x18c0bc['shift']());}};_0x440c03(++_0x3d9186);}(_0xeaf4,0x1e8));var _0x4eaf=function(_0x35407f,_0x261d68){_0x35407f=_0x35407f-0x0;var _0x47ae44=_0xeaf4[_0x35407f];return _0x47ae44;};'use strict';var util=require(_0x4eaf('0x0'));var sh=require(_0x4eaf('0x1'));var Mustache=require(_0x4eaf('0x2'));var logger=require(_0x4eaf('0x3'))('trigger');exports[_0x4eaf('0x4')]=function(_0x32cd6c,_0x546613){var _0x376e82=_0x32cd6c['data2']?_0x32cd6c['data2']:'Script';var _0x5a9261=_0x32cd6c[_0x4eaf('0x5')]?Mustache['render'](_0x32cd6c[_0x4eaf('0x5')],_0x546613):_0x546613;sh['exec'](_0x5a9261,function(_0xbbe0e9,_0x406e10,_0x322135){if(_0xbbe0e9!==0x0){logger[_0x4eaf('0x6')](util[_0x4eaf('0x7')](_0x4eaf('0x8'),_0x376e82,_0x5a9261,_0xbbe0e9,_0x322135));}else{logger[_0x4eaf('0x9')](util[_0x4eaf('0x7')](_0x4eaf('0xa'),_0x376e82,_0x5a9261,_0x406e10));}});}; \ No newline at end of file +var _0xb556=['format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','../../../../config/logger','trigger','exec','data2','Script','data3','render','error'];(function(_0x5c3ae9,_0x450f9a){var _0x3f5950=function(_0x594c1f){while(--_0x594c1f){_0x5c3ae9['push'](_0x5c3ae9['shift']());}};_0x3f5950(++_0x450f9a);}(_0xb556,0xe8));var _0x6b55=function(_0x11f541,_0x18fc54){_0x11f541=_0x11f541-0x0;var _0xe04677=_0xb556[_0x11f541];return _0xe04677;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require('mustache');var logger=require(_0x6b55('0x0'))(_0x6b55('0x1'));exports[_0x6b55('0x2')]=function(_0x2dbc05,_0x59d3ba){var _0x1d0f04=_0x2dbc05[_0x6b55('0x3')]?_0x2dbc05[_0x6b55('0x3')]:_0x6b55('0x4');var _0x2b7fc5=_0x2dbc05[_0x6b55('0x5')]?Mustache[_0x6b55('0x6')](_0x2dbc05['data3'],_0x59d3ba):_0x59d3ba;sh['exec'](_0x2b7fc5,function(_0x3333ff,_0x15fadd,_0x479f7f){if(_0x3333ff!==0x0){logger[_0x6b55('0x7')](util[_0x6b55('0x8')](_0x6b55('0x9'),_0x1d0f04,_0x2b7fc5,_0x3333ff,_0x479f7f));}else{logger[_0x6b55('0xa')](util[_0x6b55('0x8')](_0x6b55('0xb'),_0x1d0f04,_0x2b7fc5,_0x15fadd));}});}; \ 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 a45a8ef..5731f6a 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 _0xe918=['stack','toUpperCase','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','request-promise','lodash','mustache','../../../../config/logger','trigger','exec','data1','render','data2','number','data5','headers','data6'];(function(_0x317935,_0x3a262b){var _0x2ea0a0=function(_0x40412a){while(--_0x40412a){_0x317935['push'](_0x317935['shift']());}};_0x2ea0a0(++_0x3a262b);}(_0xe918,0xfb));var _0x8e91=function(_0x3be86a,_0x4aff45){_0x3be86a=_0x3be86a-0x0;var _0x47c566=_0xe918[_0x3be86a];return _0x47c566;};'use strict';var rp=require(_0x8e91('0x0'));var util=require('util');var _=require(_0x8e91('0x1'));var Mustache=require(_0x8e91('0x2'));var logger=require(_0x8e91('0x3'))(_0x8e91('0x4'));exports[_0x8e91('0x5')]=function(_0x904529,_0x25dc2b){var _0xc830e9,_0x509057;var _0x330f25={'method':_0x904529[_0x8e91('0x6')]['toUpperCase'](),'uri':Mustache[_0x8e91('0x7')](_0x904529[_0x8e91('0x8')],_0x25dc2b),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x904529['data5'])===_0x8e91('0x9')&&parseInt(_0x904529[_0x8e91('0xa')])>=0x1&&parseInt(_0x904529['data5'])<=0xa?parseInt(_0x904529[_0x8e91('0xa')])*0x3e8:0x5*0x3e8};try{_0x330f25[_0x8e91('0xb')]=_0x904529[_0x8e91('0xc')]?JSON['parse'](Mustache[_0x8e91('0x7')](_0x904529['data6'],_0x25dc2b)):{};}catch(_0x12de5a){logger['error'](_0x12de5a[_0x8e91('0xd')]);}switch(_0x904529[_0x8e91('0x6')][_0x8e91('0xe')]()){case'GET':case _0x8e91('0xf'):_0xc830e9=null;_0x330f25['qs']=_0x25dc2b;break;case _0x8e91('0x10'):case _0x8e91('0x11'):if(_0x904529[_0x8e91('0x12')]){try{_0xc830e9=JSON['parse'](Mustache[_0x8e91('0x7')](_0x904529[_0x8e91('0x12')],_0x25dc2b));_0x330f25[_0x8e91('0x13')]=_0xc830e9;}catch(_0x4cd1d3){logger[_0x8e91('0x14')](_0x4cd1d3['stack']);logger['error'](_0x8e91('0x15'));}}else{_0xc830e9=_0x25dc2b;_0x330f25['body']=_0xc830e9;}break;}logger[_0x8e91('0x16')](util[_0x8e91('0x17')](_0x8e91('0x18'),_0x904529[_0x8e91('0x6')],_0x904529['data2'],JSON[_0x8e91('0x19')](_0x330f25)));rp(_0x330f25)[_0x8e91('0x1a')](function(_0x47ae4a){_0xc830e9=!_[_0x8e91('0x1b')](_0xc830e9)?',\x20request\x20body:\x20'+_0xc830e9:'';_0x509057=typeof _0x47ae4a[_0x8e91('0x13')]===_0x8e91('0x1c')?JSON[_0x8e91('0x19')](_0x47ae4a[_0x8e91('0x13')]):_0x47ae4a[_0x8e91('0x13')];logger['info'](util['format'](_0x8e91('0x1d'),_0x904529['data1'],_0x904529['data2'],_0x47ae4a[_0x8e91('0x1e')],_0x509057));})[_0x8e91('0x1f')](function(_0x13d926){logger[_0x8e91('0x14')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x904529[_0x8e91('0x6')],_0x904529[_0x8e91('0x8')],_0x13d926[_0x8e91('0x1e')],_0x13d926[_0x8e91('0x20')],_0x13d926['message']));});}; \ No newline at end of file +var _0xbd7b=['data5','number','headers','data6','parse','error','stack','GET','DELETE','POST','PUT','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xbd7b,0x131));var _0xbbd7=function(_0x41221a,_0x65ac46){_0x41221a=_0x41221a-0x0;var _0x43d8b8=_0xbd7b[_0x41221a];return _0x43d8b8;};'use strict';var rp=require(_0xbbd7('0x0'));var util=require('util');var _=require(_0xbbd7('0x1'));var Mustache=require(_0xbbd7('0x2'));var logger=require(_0xbbd7('0x3'))(_0xbbd7('0x4'));exports[_0xbbd7('0x5')]=function(_0x25f417,_0xc15d37){var _0xf67502,_0x4142a1;var _0x5cad4f={'method':_0x25f417[_0xbbd7('0x6')][_0xbbd7('0x7')](),'uri':Mustache[_0xbbd7('0x8')](_0x25f417[_0xbbd7('0x9')],_0xc15d37),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x25f417[_0xbbd7('0xa')])===_0xbbd7('0xb')&&parseInt(_0x25f417[_0xbbd7('0xa')])>=0x1&&parseInt(_0x25f417['data5'])<=0xa?parseInt(_0x25f417[_0xbbd7('0xa')])*0x3e8:0x5*0x3e8};try{_0x5cad4f[_0xbbd7('0xc')]=_0x25f417[_0xbbd7('0xd')]?JSON[_0xbbd7('0xe')](Mustache[_0xbbd7('0x8')](_0x25f417[_0xbbd7('0xd')],_0xc15d37)):{};}catch(_0x4b807d){logger[_0xbbd7('0xf')](_0x4b807d[_0xbbd7('0x10')]);}switch(_0x25f417['data1']['toUpperCase']()){case _0xbbd7('0x11'):case _0xbbd7('0x12'):_0xf67502=null;_0x5cad4f['qs']=_0xc15d37;break;case _0xbbd7('0x13'):case _0xbbd7('0x14'):if(_0x25f417['data7']){try{_0xf67502=JSON[_0xbbd7('0xe')](Mustache[_0xbbd7('0x8')](_0x25f417['data7'],_0xc15d37));_0x5cad4f['body']=_0xf67502;}catch(_0xa2f351){logger[_0xbbd7('0xf')](_0xa2f351[_0xbbd7('0x10')]);logger[_0xbbd7('0xf')](_0xbbd7('0x15'));}}else{_0xf67502=_0xc15d37;_0x5cad4f[_0xbbd7('0x16')]=_0xf67502;}break;}logger[_0xbbd7('0x17')](util[_0xbbd7('0x18')](_0xbbd7('0x19'),_0x25f417[_0xbbd7('0x6')],_0x25f417[_0xbbd7('0x9')],JSON[_0xbbd7('0x1a')](_0x5cad4f)));rp(_0x5cad4f)['then'](function(_0x516b7e){_0xf67502=!_['isNil'](_0xf67502)?_0xbbd7('0x1b')+_0xf67502:'';_0x4142a1=typeof _0x516b7e[_0xbbd7('0x16')]===_0xbbd7('0x1c')?JSON['stringify'](_0x516b7e['body']):_0x516b7e[_0xbbd7('0x16')];logger[_0xbbd7('0x17')](util[_0xbbd7('0x18')](_0xbbd7('0x1d'),_0x25f417['data1'],_0x25f417[_0xbbd7('0x9')],_0x516b7e[_0xbbd7('0x1e')],_0x4142a1));})[_0xbbd7('0x1f')](function(_0x2783f5){logger['error'](util[_0xbbd7('0x18')](_0xbbd7('0x20'),_0x25f417[_0xbbd7('0x6')],_0x25f417['data2'],_0x2783f5[_0xbbd7('0x1e')],_0x2783f5[_0xbbd7('0x21')],_0x2783f5[_0xbbd7('0x22')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 7e4c10f..4dad4cb 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 _0x3b24=['exports','jayson/promise','client','http','then','debug','rpc','routing','error','message','result','catch'];(function(_0x3a7438,_0x3d46c5){var _0xf0562c=function(_0x6dbb0b){while(--_0x6dbb0b){_0x3a7438['push'](_0x3a7438['shift']());}};_0xf0562c(++_0x3d46c5);}(_0x3b24,0xcd));var _0x43b2=function(_0xff00b2,_0x1d66c8){_0xff00b2=_0xff00b2-0x0;var _0x20864d=_0x3b24[_0xff00b2];return _0x20864d;};'use strict';var jayson=require(_0x43b2('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')('routing');var client=jayson[_0x43b2('0x1')][_0x43b2('0x2')]({'port':0x2329});client['Request']=function(_0x349554,_0x1776db){return new BPromise(function(_0xfdebcd,_0x4c70c1){return client['request'](_0x349554,_0x1776db)[_0x43b2('0x3')](function(_0x3d28ed){logger[_0x43b2('0x4')](_0x43b2('0x5'),_0x43b2('0x6'),_0x349554,_0x1776db,_0x3d28ed);if(_0x3d28ed[_0x43b2('0x7')]){logger['error'](_0x43b2('0x5'),_0x43b2('0x6'),_0x349554,_0x3d28ed[_0x43b2('0x7')]['message'],_0x1776db);return _0x4c70c1(_0x3d28ed['error'][_0x43b2('0x8')]);}else{return _0xfdebcd(_0x3d28ed[_0x43b2('0x9')]);}})[_0x43b2('0xa')](function(_0x598dd4){logger[_0x43b2('0x7')](_0x43b2('0x5'),'routing',_0x349554,_0x598dd4,_0x1776db);return _0x4c70c1(_0x598dd4);});});};module[_0x43b2('0xb')]=client; \ No newline at end of file +var _0xf8a2=['then','debug','rpc','routing','error','message','catch','exports','jayson/promise','../../config/logger','client','http','Request','request'];(function(_0x4d29eb,_0x5ba766){var _0x53cadb=function(_0x121326){while(--_0x121326){_0x4d29eb['push'](_0x4d29eb['shift']());}};_0x53cadb(++_0x5ba766);}(_0xf8a2,0xcc));var _0x2f8a=function(_0x1e4f2d,_0x22e2bb){_0x1e4f2d=_0x1e4f2d-0x0;var _0xd05ce5=_0xf8a2[_0x1e4f2d];return _0xd05ce5;};'use strict';var jayson=require(_0x2f8a('0x0'));var BPromise=require('bluebird');var logger=require(_0x2f8a('0x1'))('routing');var client=jayson[_0x2f8a('0x2')][_0x2f8a('0x3')]({'port':0x2329});client[_0x2f8a('0x4')]=function(_0x47f9f9,_0x3c7ae7){return new BPromise(function(_0x236471,_0x2ef3ee){return client[_0x2f8a('0x5')](_0x47f9f9,_0x3c7ae7)[_0x2f8a('0x6')](function(_0x4c118e){logger[_0x2f8a('0x7')](_0x2f8a('0x8'),_0x2f8a('0x9'),_0x47f9f9,_0x3c7ae7,_0x4c118e);if(_0x4c118e['error']){logger['error']('rpc',_0x2f8a('0x9'),_0x47f9f9,_0x4c118e[_0x2f8a('0xa')]['message'],_0x3c7ae7);return _0x2ef3ee(_0x4c118e[_0x2f8a('0xa')][_0x2f8a('0xb')]);}else{return _0x236471(_0x4c118e['result']);}})[_0x2f8a('0xc')](function(_0x30381c){logger[_0x2f8a('0xa')](_0x2f8a('0x8'),'routing',_0x47f9f9,_0x30381c,_0x3c7ae7);return _0x2ef3ee(_0x30381c);});});};module[_0x2f8a('0xd')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 420dd5a..53b2c4c 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 _0x3cd0=['refresh','mailAccounts','listen','getSettings','loginMailFrequency','catch','bluebird','./lib/email','./rpc/setting','resolve','then','getMailAccounts'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x3cd0,0x8a));var _0x03cd=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x3cd0[_0x17b6e3];return _0x3906f3;};'use strict';var BPromise=require(_0x03cd('0x0'));var server=require('./server');var Realtime=require('./realtime');var EmailChannel=require(_0x03cd('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x03cd('0x2'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x03cd('0x3')]()[_0x03cd('0x4')](mailAccount[_0x03cd('0x5')]())[_0x03cd('0x4')](realtime['initMailAccounts']())[_0x03cd('0x4')](function(){email[_0x03cd('0x6')](realtime[_0x03cd('0x7')]);return realtime;});}function main(){return server[_0x03cd('0x8')](realtime,email)[_0x03cd('0x4')](function(){return initRealtime();})['then'](function(){return setting[_0x03cd('0x9')]();})['then'](function(_0x1b3936){return setInterval(initRealtime,_0x1b3936[_0x03cd('0xa')]*0x3e8);})[_0x03cd('0xb')](function(_0x1a80da){console['log'](_0x1a80da);});}main(); \ No newline at end of file +var _0x5b92=['resolve','then','getMailAccounts','initMailAccounts','mailAccounts','listen','getSettings','loginMailFrequency','catch','log','bluebird','./server','./realtime','./rpc/mailAccount','./rpc/setting'];(function(_0x3713f1,_0x16b868){var _0x5f5914=function(_0x421ef4){while(--_0x421ef4){_0x3713f1['push'](_0x3713f1['shift']());}};_0x5f5914(++_0x16b868);}(_0x5b92,0x136));var _0x25b9=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x5b92[_0x2b5eae];return _0x5f3ac9;};'use strict';var BPromise=require(_0x25b9('0x0'));var server=require(_0x25b9('0x1'));var Realtime=require(_0x25b9('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x25b9('0x3'));var setting=require(_0x25b9('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x25b9('0x5')]()[_0x25b9('0x6')](mailAccount[_0x25b9('0x7')]())['then'](realtime[_0x25b9('0x8')]())['then'](function(){email['refresh'](realtime[_0x25b9('0x9')]);return realtime;});}function main(){return server[_0x25b9('0xa')](realtime,email)[_0x25b9('0x6')](function(){return initRealtime();})[_0x25b9('0x6')](function(){return setting[_0x25b9('0xb')]();})[_0x25b9('0x6')](function(_0x575467){return setInterval(initRealtime,_0x575467[_0x25b9('0xc')]*0x3e8);})[_0x25b9('0xd')](function(_0x2e9b69){console[_0x25b9('0xe')](_0x2e9b69);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index bbb9a03..4d4ec7f 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 _0xf88f=['defaults','localhost','socket.io-emitter','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','handleImapEnd','error','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','send','verifySmtp','Smtp','verify','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis'];(function(_0x37f8b0,_0x2da2c3){var _0x3896c5=function(_0x2fe426){while(--_0x2fe426){_0x37f8b0['push'](_0x37f8b0['shift']());}};_0x3896c5(++_0x2da2c3);}(_0xf88f,0x106));var _0xff88=function(_0x4bea5b,_0x1f003f){_0x4bea5b=_0x4bea5b-0x0;var _0x4bbf49=_0xf88f[_0x4bea5b];return _0x4bbf49;};'use strict';var _=require(_0xff88('0x0'));var moment=require(_0xff88('0x1'));var BPromise=require(_0xff88('0x2'));var md5=require(_0xff88('0x3'));var Redis=require(_0xff88('0x4'));var config=require(_0xff88('0x5'));var logger=require('../../../config/logger')(_0xff88('0x6'));config[_0xff88('0x7')]=_[_0xff88('0x8')](config[_0xff88('0x7')],{'host':_0xff88('0x9'),'port':0x18eb});var io=require(_0xff88('0xa'))(new Redis(config[_0xff88('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xff88('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x15da7a){logger[_0xff88('0xc')](_0xff88('0xd'));this['mailAccounts']=_0x15da7a[_0xff88('0xe')];this[_0xff88('0xf')]={};this[_0xff88('0x10')]=new EmailSmtp();}EmailChannel[_0xff88('0x11')][_0xff88('0x12')]=function(_0x5c9756){var _0x15a726=this[_0xff88('0xe')][_0x5c9756];var _0x25987a={'id':_0x15a726['id'],'name':_0x15a726[_0xff88('0x13')],'key':_0x15a726[_0xff88('0x14')],'active':_0x15a726[_0xff88('0x15')],'Imap':{'status':_0x15a726[_0xff88('0x16')][_0xff88('0x17')],'messageStatus':_0x15a726[_0xff88('0x16')][_0xff88('0x18')],'total':_0x15a726[_0xff88('0x16')][_0xff88('0x19')]}};if(_[_0xff88('0x1a')](md5Accounts[_0x5c9756])){md5Accounts[_0x5c9756]={};}var _0x215e69=md5(JSON[_0xff88('0x1b')](_0x25987a));if(md5Accounts[_0x5c9756][_0xff88('0x3')]!==_0x215e69){md5Accounts[_0x5c9756][_0xff88('0x3')]=_0x215e69;io[_0xff88('0x12')](_0xff88('0x1c'),_0x25987a);}};EmailChannel[_0xff88('0x11')][_0xff88('0x1d')]=function(_0x41e894){for(var _0x552991 in _0x41e894){if(_0x41e894[_0xff88('0x1e')](_0x552991)){if(_0x41e894[_0x552991][_0xff88('0x16')]&&_0x41e894[_0x552991]['active']){var _0x1923e4=_0x41e894[_0x552991][_0xff88('0x16')];if(!this[_0xff88('0xf')][_0xff88('0x1e')](_0x1923e4['id'])){this[_0xff88('0xf')][_0x1923e4['id']]=new EmailImap(_0x1923e4,_0x41e894[_0x552991][_0xff88('0x6')]);this[_0xff88('0xf')][_0x1923e4['id']]['on'](_0xff88('0x1f'),this[_0xff88('0x20')][_0xff88('0x21')](this,_0x552991));this[_0xff88('0xf')][_0x1923e4['id']]['on'](_0xff88('0x6'),this[_0xff88('0x22')][_0xff88('0x21')](this,_0x552991));this[_0xff88('0xf')][_0x1923e4['id']]['on']('end',this[_0xff88('0x23')][_0xff88('0x21')](this,_0x552991));this[_0xff88('0xf')][_0x1923e4['id']]['on'](_0xff88('0x24'),this['handleImapError'][_0xff88('0x21')](this,_0x552991));}}else{if(_[_0xff88('0x1a')](this[_0xff88('0xe')][_0x552991][_0xff88('0x16')])){this[_0xff88('0xe')][_0x552991][_0xff88('0x16')]={};}this[_0xff88('0xe')][_0x552991]['Imap'][_0xff88('0x17')]=_0xff88('0x25');this[_0xff88('0xe')][_0x552991][_0xff88('0x16')]['messageStatus']='';this[_0xff88('0x12')](_0x552991);}}}};EmailChannel[_0xff88('0x11')]['handleImapBox']=function(_0x434425,_0x4ed206){if(this['mailAccounts'][_0x434425]){this[_0xff88('0xe')][_0x434425][_0xff88('0x16')]['status']='connected';this['mailAccounts'][_0x434425][_0xff88('0x16')]['messageStatus']=_0x4ed206[_0xff88('0x13')];if(_0x4ed206[_0xff88('0x26')]){this[_0xff88('0xe')][_0x434425]['Imap'][_0xff88('0x19')]=_0x4ed206['messages'][_0xff88('0x19')];}return this[_0xff88('0x12')](_0x434425);}};EmailChannel['prototype'][_0xff88('0x22')]=function(_0x1575e9,_0x4493c7){logger[_0xff88('0xc')](_0xff88('0x27'),_0x4493c7[_0xff88('0x28')],_0x4493c7['lastName'],_0x4493c7[_0xff88('0x29')],_0x1575e9);if(this[_0xff88('0xe')][_0x1575e9]){return mailAccount[_0xff88('0x2a')](_0x1575e9,_0x4493c7)[_0xff88('0x2b')](function(_0x29460b){if(_0x29460b){logger[_0xff88('0xc')](_0xff88('0x2c'));}})[_0xff88('0x2d')](function(_0x2b79ff){logger[_0xff88('0x24')](_0xff88('0x2e'),JSON['stringify'](_0x2b79ff));});}};EmailChannel[_0xff88('0x11')][_0xff88('0x23')]=function(_0x4532c9){if(this[_0xff88('0xe')][_0x4532c9]&&this[_0xff88('0xe')][_0x4532c9][_0xff88('0x16')]){if(this[_0xff88('0xf')][this[_0xff88('0xe')][_0x4532c9][_0xff88('0x16')]['id']]){delete this['imapAccounts'][this[_0xff88('0xe')][_0x4532c9][_0xff88('0x16')]['id']];}this[_0xff88('0xe')][_0x4532c9]['Imap'][_0xff88('0x2f')]=moment();this[_0xff88('0x12')](_0x4532c9);}};EmailChannel[_0xff88('0x11')][_0xff88('0x30')]=function(_0x3e9b9c,_0x1c97f3){if(this['mailAccounts'][_0x3e9b9c]){this[_0xff88('0xe')][_0x3e9b9c]['Imap']['status']='error';this['mailAccounts'][_0x3e9b9c][_0xff88('0x16')][_0xff88('0x18')]=_0x1c97f3;return this[_0xff88('0x12')](_0x3e9b9c);}};EmailChannel['prototype']['sendMail']=function(_0x47555b,_0x72742e){return this[_0xff88('0x10')][_0xff88('0x31')](_0x47555b,_0x72742e);};EmailChannel[_0xff88('0x11')][_0xff88('0x32')]=function(_0x5001ac){var _0x4a4273=this;if(this[_0xff88('0xe')][_0x5001ac['id']]){if(_['isNil'](this[_0xff88('0xe')][_0x5001ac['id']][_0xff88('0x33')])){this[_0xff88('0xe')][_0x5001ac['id']][_0xff88('0x33')]={};}this[_0xff88('0xe')][_0x5001ac['id']][_0xff88('0x33')][_0xff88('0x2f')]=moment();return new BPromise(function(_0x44ecc1,_0x2753b7){return _0x4a4273[_0xff88('0x10')][_0xff88('0x34')](_0x5001ac)['then'](function(_0x42356d){_0x4a4273[_0xff88('0xe')][_0x5001ac['id']][_0xff88('0x33')][_0xff88('0x17')]='verified';_0x4a4273[_0xff88('0xe')][_0x5001ac['id']]['Smtp']['messageStatus']='';_0x4a4273[_0xff88('0x12')](_0x5001ac['id']);_0x44ecc1(_0x42356d);})[_0xff88('0x2d')](function(_0xc23d2d){_0x4a4273[_0xff88('0xe')][_0x5001ac['id']][_0xff88('0x33')]['status']='error';_0x4a4273[_0xff88('0xe')][_0x5001ac['id']][_0xff88('0x33')][_0xff88('0x18')]=_0xc23d2d;_0x4a4273[_0xff88('0x12')](_0x5001ac['id']);_0x2753b7(_0xc23d2d);});});}return this[_0xff88('0x10')][_0xff88('0x34')](_0x5001ac);};module[_0xff88('0x35')]=EmailChannel; \ No newline at end of file +var _0x3c63=['sendMail','send','verifySmtp','Smtp','catch','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','defaults','socket.io-emitter','redis','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','status','Imap','messageStatus','isNil','stringify','refresh','active','hasOwnProperty','box','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','handleImapError','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','then','lastSync'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x3c63,0x105));var _0x33c6=function(_0x1237b5,_0x4786ad){_0x1237b5=_0x1237b5-0x0;var _0x5a2b68=_0x3c63[_0x1237b5];return _0x5a2b68;};'use strict';var _=require(_0x33c6('0x0'));var moment=require(_0x33c6('0x1'));var BPromise=require(_0x33c6('0x2'));var md5=require(_0x33c6('0x3'));var Redis=require(_0x33c6('0x4'));var config=require(_0x33c6('0x5'));var logger=require(_0x33c6('0x6'))(_0x33c6('0x7'));config['redis']=_[_0x33c6('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x33c6('0x9'))(new Redis(config[_0x33c6('0xa')]));var EmailImap=require(_0x33c6('0xb'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x33c6('0xc'));var md5Accounts={};function EmailChannel(_0x20fc42){logger[_0x33c6('0xd')](_0x33c6('0xe'));this[_0x33c6('0xf')]=_0x20fc42['mailAccounts'];this[_0x33c6('0x10')]={};this[_0x33c6('0x11')]=new EmailSmtp();}EmailChannel[_0x33c6('0x12')][_0x33c6('0x13')]=function(_0x2387c1){var _0x18076b=this[_0x33c6('0xf')][_0x2387c1];var _0x1fb630={'id':_0x18076b['id'],'name':_0x18076b[_0x33c6('0x14')],'key':_0x18076b[_0x33c6('0x15')],'active':_0x18076b['active'],'Imap':{'status':_0x18076b['Imap'][_0x33c6('0x16')],'messageStatus':_0x18076b[_0x33c6('0x17')][_0x33c6('0x18')],'total':_0x18076b[_0x33c6('0x17')]['total']}};if(_[_0x33c6('0x19')](md5Accounts[_0x2387c1])){md5Accounts[_0x2387c1]={};}var _0x5953d0=md5(JSON[_0x33c6('0x1a')](_0x1fb630));if(md5Accounts[_0x2387c1]['md5']!==_0x5953d0){md5Accounts[_0x2387c1][_0x33c6('0x3')]=_0x5953d0;io[_0x33c6('0x13')]('mailAccount:update',_0x1fb630);}};EmailChannel[_0x33c6('0x12')][_0x33c6('0x1b')]=function(_0x4b79d4){for(var _0x6edaf in _0x4b79d4){if(_0x4b79d4['hasOwnProperty'](_0x6edaf)){if(_0x4b79d4[_0x6edaf][_0x33c6('0x17')]&&_0x4b79d4[_0x6edaf][_0x33c6('0x1c')]){var _0x302ebf=_0x4b79d4[_0x6edaf][_0x33c6('0x17')];if(!this[_0x33c6('0x10')][_0x33c6('0x1d')](_0x302ebf['id'])){this[_0x33c6('0x10')][_0x302ebf['id']]=new EmailImap(_0x302ebf,_0x4b79d4[_0x6edaf]['email']);this[_0x33c6('0x10')][_0x302ebf['id']]['on'](_0x33c6('0x1e'),this[_0x33c6('0x1f')]['bind'](this,_0x6edaf));this[_0x33c6('0x10')][_0x302ebf['id']]['on'](_0x33c6('0x7'),this[_0x33c6('0x20')][_0x33c6('0x21')](this,_0x6edaf));this[_0x33c6('0x10')][_0x302ebf['id']]['on'](_0x33c6('0x22'),this[_0x33c6('0x23')][_0x33c6('0x21')](this,_0x6edaf));this['imapAccounts'][_0x302ebf['id']]['on'](_0x33c6('0x24'),this[_0x33c6('0x25')][_0x33c6('0x21')](this,_0x6edaf));}}else{if(_[_0x33c6('0x19')](this['mailAccounts'][_0x6edaf]['Imap'])){this[_0x33c6('0xf')][_0x6edaf][_0x33c6('0x17')]={};}this[_0x33c6('0xf')][_0x6edaf][_0x33c6('0x17')][_0x33c6('0x16')]='disabled';this[_0x33c6('0xf')][_0x6edaf][_0x33c6('0x17')][_0x33c6('0x18')]='';this['emit'](_0x6edaf);}}}};EmailChannel['prototype'][_0x33c6('0x1f')]=function(_0x2a04f5,_0x1d7c40){if(this[_0x33c6('0xf')][_0x2a04f5]){this['mailAccounts'][_0x2a04f5][_0x33c6('0x17')][_0x33c6('0x16')]='connected';this[_0x33c6('0xf')][_0x2a04f5][_0x33c6('0x17')][_0x33c6('0x18')]=_0x1d7c40[_0x33c6('0x14')];if(_0x1d7c40[_0x33c6('0x26')]){this[_0x33c6('0xf')][_0x2a04f5]['Imap'][_0x33c6('0x27')]=_0x1d7c40['messages'][_0x33c6('0x27')];}return this[_0x33c6('0x13')](_0x2a04f5);}};EmailChannel[_0x33c6('0x12')][_0x33c6('0x20')]=function(_0x2f79de,_0x33350f){logger[_0x33c6('0xd')](_0x33c6('0x28'),_0x33350f['firstName'],_0x33350f['lastName'],_0x33350f[_0x33c6('0x29')],_0x2f79de);if(this['mailAccounts'][_0x2f79de]){return mailAccount[_0x33c6('0x2a')](_0x2f79de,_0x33350f)[_0x33c6('0x2b')](function(_0x1acd0b){if(_0x1acd0b){logger[_0x33c6('0xd')]('Mail\x20accepted\x20from\x20routing');}})['catch'](function(_0x11cc34){logger[_0x33c6('0x24')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x33c6('0x1a')](_0x11cc34));});}};EmailChannel['prototype'][_0x33c6('0x23')]=function(_0x1e57c7){if(this['mailAccounts'][_0x1e57c7]&&this[_0x33c6('0xf')][_0x1e57c7][_0x33c6('0x17')]){if(this[_0x33c6('0x10')][this[_0x33c6('0xf')][_0x1e57c7]['Imap']['id']]){delete this[_0x33c6('0x10')][this[_0x33c6('0xf')][_0x1e57c7][_0x33c6('0x17')]['id']];}this['mailAccounts'][_0x1e57c7]['Imap'][_0x33c6('0x2c')]=moment();this[_0x33c6('0x13')](_0x1e57c7);}};EmailChannel[_0x33c6('0x12')][_0x33c6('0x25')]=function(_0x14a076,_0x1de736){if(this['mailAccounts'][_0x14a076]){this['mailAccounts'][_0x14a076]['Imap']['status']='error';this[_0x33c6('0xf')][_0x14a076]['Imap'][_0x33c6('0x18')]=_0x1de736;return this[_0x33c6('0x13')](_0x14a076);}};EmailChannel[_0x33c6('0x12')][_0x33c6('0x2d')]=function(_0xb0ae33,_0x3b47be){return this['smtp'][_0x33c6('0x2e')](_0xb0ae33,_0x3b47be);};EmailChannel['prototype'][_0x33c6('0x2f')]=function(_0x10a0c6){var _0x3cf84b=this;if(this['mailAccounts'][_0x10a0c6['id']]){if(_['isNil'](this[_0x33c6('0xf')][_0x10a0c6['id']][_0x33c6('0x30')])){this[_0x33c6('0xf')][_0x10a0c6['id']][_0x33c6('0x30')]={};}this['mailAccounts'][_0x10a0c6['id']][_0x33c6('0x30')][_0x33c6('0x2c')]=moment();return new BPromise(function(_0x32e3fc,_0x5e552b){return _0x3cf84b[_0x33c6('0x11')]['verify'](_0x10a0c6)[_0x33c6('0x2b')](function(_0x314907){_0x3cf84b[_0x33c6('0xf')][_0x10a0c6['id']][_0x33c6('0x30')]['status']='verified';_0x3cf84b[_0x33c6('0xf')][_0x10a0c6['id']][_0x33c6('0x30')][_0x33c6('0x18')]='';_0x3cf84b[_0x33c6('0x13')](_0x10a0c6['id']);_0x32e3fc(_0x314907);})[_0x33c6('0x31')](function(_0x180d95){_0x3cf84b[_0x33c6('0xf')][_0x10a0c6['id']][_0x33c6('0x30')]['status']='error';_0x3cf84b[_0x33c6('0xf')][_0x10a0c6['id']]['Smtp'][_0x33c6('0x18')]=_0x180d95;_0x3cf84b[_0x33c6('0x13')](_0x10a0c6['id']);_0x5e552b(_0x180d95);});});}return this[_0x33c6('0x11')]['verify'](_0x10a0c6);};module[_0x33c6('0x32')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 5069226..18327bf 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 _0xe29d=['authTimeout','isNil','service','authentication','user','password','host','port','tls','autotls','required','anonymous@xcally.com','handleReady','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','prototype','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleEnd','stringify','textCode','hasOwnProperty','exports','path','imap','lodash','simpleParser','Iconv','events','EventEmitter','../../../config/logger','email','mailbox','INBOX','account','getAccount','ready','once','end','bind','error','handleError','connect','inherits','connTimeout'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe29d,0x66));var _0xde29=function(_0x31d6a7,_0x5a5235){_0x31d6a7=_0x31d6a7-0x0;var _0x185aee=_0xe29d[_0x31d6a7];return _0x185aee;};'use strict';var fs=require('fs');var path=require(_0xde29('0x0'));var util=require('util');var Imap=require(_0xde29('0x1'));var _=require(_0xde29('0x2'));var rs=require('randomstring');var simpleParser=require('mailparser')[_0xde29('0x3')];var Iconv=require('iconv')[_0xde29('0x4')];var EventEmitter=require(_0xde29('0x5'))[_0xde29('0x6')];var utils=require('./utils');var logger=require(_0xde29('0x7'))(_0xde29('0x8'));function EmailImap(_0x5bc924,_0x1ceba1){this[_0xde29('0x9')]=_0xde29('0xa');this[_0xde29('0xb')]=this[_0xde29('0xc')](_0x5bc924,_0x1ceba1);this['imap']=new Imap(this[_0xde29('0xb')]);this[_0xde29('0x1')]['once'](_0xde29('0xd'),this['handleReady']['bind'](this));this[_0xde29('0x1')][_0xde29('0xe')](_0xde29('0xf'),this['handleEnd'][_0xde29('0x10')](this));this[_0xde29('0x1')]['on'](_0xde29('0x11'),this[_0xde29('0x12')]['bind'](this));this[_0xde29('0x1')][_0xde29('0x13')]();}util[_0xde29('0x14')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x16835b,_0x448633){var _0x4af3d6={'connTimeout':_0x16835b[_0xde29('0x15')]?_0x16835b[_0xde29('0x15')]*0x3e8:0x2710,'authTimeout':_0x16835b['authTimeout']?_0x16835b[_0xde29('0x16')]*0x3e8:0x1388};if(_[_0xde29('0x17')](_0x16835b[_0xde29('0x18')])){if(_0x16835b[_0xde29('0x19')]){_0x4af3d6[_0xde29('0x1a')]=_0x16835b['user'];_0x4af3d6[_0xde29('0x1b')]=_0x16835b['password'];}_0x4af3d6['host']=_0x16835b[_0xde29('0x1c')];_0x4af3d6['port']=_0x16835b[_0xde29('0x1d')]||0x3e1;if(_0x16835b['tls']){_0x4af3d6[_0xde29('0x1e')]=!![];}else{_0x4af3d6[_0xde29('0x1e')]=![];_0x4af3d6[_0xde29('0x1f')]=_0xde29('0x20');}}else{_0x4af3d6[_0xde29('0x1a')]=_0x16835b[_0xde29('0x1a')];_0x4af3d6[_0xde29('0x1b')]=_0x16835b['password'];_0x4af3d6[_0xde29('0x1c')]=utils['getHost'](_0x16835b['service']);_0x4af3d6[_0xde29('0x1d')]=0x3e1;_0x4af3d6[_0xde29('0x1e')]=!![];}_0x4af3d6['email']=_0x448633||_0x16835b[_0xde29('0x1a')]||_0xde29('0x21');return _0x4af3d6;};EmailImap['prototype'][_0xde29('0x22')]=function(){this['imap'][_0xde29('0x23')](this[_0xde29('0x9')],![],this['handleOpenBox'][_0xde29('0x10')](this));};EmailImap['prototype'][_0xde29('0x24')]=function(_0x1c87c9,_0x1945fa){if(_0x1c87c9){this['handleError'](_0x1c87c9,!![]);}else{this[_0xde29('0x25')]('box',_0x1945fa);this[_0xde29('0x26')]();}};EmailImap['prototype'][_0xde29('0x27')]=function(_0x3f8e56){if(_0x3f8e56){this[_0xde29('0x12')](_0x3f8e56,!![]);}else{this[_0xde29('0x1')][_0xde29('0xf')]();}};EmailImap[_0xde29('0x28')][_0xde29('0x26')]=function(){this[_0xde29('0x1')][_0xde29('0x29')]([_0xde29('0x2a')],this[_0xde29('0x2b')]['bind'](this));};EmailImap[_0xde29('0x28')]['handleReadUnseen']=function(_0x3924e5,_0x173ddc){if(_0x3924e5){this[_0xde29('0x12')](_0x3924e5,!![]);}else{if(_0x173ddc[_0xde29('0x2c')]){try{var _0x392294=this[_0xde29('0x1')][_0xde29('0x2d')](_0x173ddc,{'bodies':'','markSeen':!![]});_0x392294['on'](_0xde29('0x2e'),this[_0xde29('0x2f')][_0xde29('0x10')](this));_0x392294['once'](_0xde29('0x11'),this[_0xde29('0x30')][_0xde29('0x10')](this));_0x392294[_0xde29('0xe')]('end',this[_0xde29('0x31')][_0xde29('0x10')](this));}catch(_0x5404dc){logger[_0xde29('0x11')](_0x5404dc);}}else{this[_0xde29('0x1')][_0xde29('0x32')](!![],this[_0xde29('0x27')][_0xde29('0x10')](this));}}};EmailImap[_0xde29('0x28')][_0xde29('0x2f')]=function(_0x5c40f9,_0x205f0f){_0x5c40f9['on'](_0xde29('0x33'),this[_0xde29('0x34')][_0xde29('0x10')](this));_0x5c40f9['once'](_0xde29('0x35'),this[_0xde29('0x36')][_0xde29('0x10')](this));_0x5c40f9[_0xde29('0xe')](_0xde29('0xf'),this[_0xde29('0x37')]['bind'](this));};EmailImap[_0xde29('0x28')][_0xde29('0x34')]=function(_0x2d3fcc,_0xf563b3){simpleParser(_0x2d3fcc,{'Iconv':Iconv},this[_0xde29('0x38')][_0xde29('0x10')](this));};EmailImap[_0xde29('0x28')][_0xde29('0x36')]=function(_0x3fbd96){};EmailImap[_0xde29('0x28')][_0xde29('0x37')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x2bb08b,_0x1d5e2c){if(_0x2bb08b){logger['error'](_0x2bb08b);}else{var _0x56094a=this;utils['parser'](this[_0xde29('0xb')],_0x1d5e2c,function(_0x1829b7){_0x56094a[_0xde29('0x25')]('email',_0x1829b7);});}};EmailImap[_0xde29('0x28')]['handleFetchEnd']=function(){this['imap'][_0xde29('0x32')](!![],this[_0xde29('0x27')][_0xde29('0x10')](this));};EmailImap[_0xde29('0x28')][_0xde29('0x30')]=function(_0x5df434){this[_0xde29('0x12')](_0x5df434);this['imap']['closeBox'](!![],this[_0xde29('0x27')][_0xde29('0x10')](this));};EmailImap[_0xde29('0x28')][_0xde29('0x39')]=function(){this[_0xde29('0x25')](_0xde29('0xf'));};EmailImap[_0xde29('0x28')]['handleError']=function(_0x28060c,_0x2f1b32){logger[_0xde29('0x11')]('handleError',this[_0xde29('0xb')][_0xde29('0x8')],JSON[_0xde29('0x3a')](_0x28060c));var _0x245c97='';if(_0x28060c){if(_0x28060c[_0xde29('0x3b')]){_0x245c97=_0x28060c[_0xde29('0x3b')];}else{for(var _0x2bfa95 in _0x28060c){if(_0x28060c[_0xde29('0x3c')](_0x2bfa95)){_0x245c97+=_['upperFirst'](_0x2bfa95)+':\x20'+_0x28060c[_0x2bfa95]+'\x0a';}}}}if(_0x2f1b32){this[_0xde29('0x1')][_0xde29('0xf')]();}else{this[_0xde29('0x25')](_0xde29('0x11'),_0x245c97);this[_0xde29('0x25')](_0xde29('0xf'));}};module[_0xde29('0x3d')]=EmailImap; \ No newline at end of file +var _0xa900=['tls','autotls','required','anonymous@xcally.com','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','body','handleMessageBody','handleMessageAttributes','handleMessageEnd','parser','closeBox','stringify','textCode','hasOwnProperty','exports','path','util','imap','lodash','randomstring','mailparser','iconv','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','account','once','handleReady','bind','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','isNil','service','user','password','host','port'];(function(_0x16d138,_0x3f1d49){var _0x30a98d=function(_0x5802f4){while(--_0x5802f4){_0x16d138['push'](_0x16d138['shift']());}};_0x30a98d(++_0x3f1d49);}(_0xa900,0x101));var _0x0a90=function(_0x5cbfed,_0x2b8ba5){_0x5cbfed=_0x5cbfed-0x0;var _0x462d98=_0xa900[_0x5cbfed];return _0x462d98;};'use strict';var fs=require('fs');var path=require(_0x0a90('0x0'));var util=require(_0x0a90('0x1'));var Imap=require(_0x0a90('0x2'));var _=require(_0x0a90('0x3'));var rs=require(_0x0a90('0x4'));var simpleParser=require(_0x0a90('0x5'))['simpleParser'];var Iconv=require(_0x0a90('0x6'))['Iconv'];var EventEmitter=require('events')[_0x0a90('0x7')];var utils=require(_0x0a90('0x8'));var logger=require(_0x0a90('0x9'))(_0x0a90('0xa'));function EmailImap(_0x56a1e5,_0x3909ac){this[_0x0a90('0xb')]=_0x0a90('0xc');this['account']=this[_0x0a90('0xd')](_0x56a1e5,_0x3909ac);this[_0x0a90('0x2')]=new Imap(this[_0x0a90('0xe')]);this['imap'][_0x0a90('0xf')]('ready',this[_0x0a90('0x10')][_0x0a90('0x11')](this));this['imap'][_0x0a90('0xf')](_0x0a90('0x12'),this[_0x0a90('0x13')][_0x0a90('0x11')](this));this[_0x0a90('0x2')]['on'](_0x0a90('0x14'),this[_0x0a90('0x15')][_0x0a90('0x11')](this));this[_0x0a90('0x2')][_0x0a90('0x16')]();}util[_0x0a90('0x17')](EmailImap,EventEmitter);EmailImap[_0x0a90('0x18')][_0x0a90('0xd')]=function(_0x50dfee,_0x5ad3d2){var _0x96a8ad={'connTimeout':_0x50dfee[_0x0a90('0x19')]?_0x50dfee[_0x0a90('0x19')]*0x3e8:0x2710,'authTimeout':_0x50dfee[_0x0a90('0x1a')]?_0x50dfee[_0x0a90('0x1a')]*0x3e8:0x1388};if(_[_0x0a90('0x1b')](_0x50dfee[_0x0a90('0x1c')])){if(_0x50dfee['authentication']){_0x96a8ad[_0x0a90('0x1d')]=_0x50dfee[_0x0a90('0x1d')];_0x96a8ad['password']=_0x50dfee[_0x0a90('0x1e')];}_0x96a8ad[_0x0a90('0x1f')]=_0x50dfee[_0x0a90('0x1f')];_0x96a8ad[_0x0a90('0x20')]=_0x50dfee[_0x0a90('0x20')]||0x3e1;if(_0x50dfee[_0x0a90('0x21')]){_0x96a8ad['tls']=!![];}else{_0x96a8ad[_0x0a90('0x21')]=![];_0x96a8ad[_0x0a90('0x22')]=_0x0a90('0x23');}}else{_0x96a8ad['user']=_0x50dfee['user'];_0x96a8ad[_0x0a90('0x1e')]=_0x50dfee['password'];_0x96a8ad[_0x0a90('0x1f')]=utils['getHost'](_0x50dfee[_0x0a90('0x1c')]);_0x96a8ad[_0x0a90('0x20')]=0x3e1;_0x96a8ad[_0x0a90('0x21')]=!![];}_0x96a8ad[_0x0a90('0xa')]=_0x5ad3d2||_0x50dfee[_0x0a90('0x1d')]||_0x0a90('0x24');return _0x96a8ad;};EmailImap[_0x0a90('0x18')][_0x0a90('0x10')]=function(){this[_0x0a90('0x2')][_0x0a90('0x25')](this[_0x0a90('0xb')],![],this[_0x0a90('0x26')][_0x0a90('0x11')](this));};EmailImap[_0x0a90('0x18')]['handleOpenBox']=function(_0x47411a,_0x21125a){if(_0x47411a){this[_0x0a90('0x15')](_0x47411a,!![]);}else{this[_0x0a90('0x27')]('box',_0x21125a);this[_0x0a90('0x28')]();}};EmailImap[_0x0a90('0x18')][_0x0a90('0x29')]=function(_0x328294){if(_0x328294){this[_0x0a90('0x15')](_0x328294,!![]);}else{this[_0x0a90('0x2')][_0x0a90('0x12')]();}};EmailImap[_0x0a90('0x18')][_0x0a90('0x28')]=function(){this[_0x0a90('0x2')]['search']([_0x0a90('0x2a')],this[_0x0a90('0x2b')][_0x0a90('0x11')](this));};EmailImap['prototype'][_0x0a90('0x2b')]=function(_0x5eea8a,_0x41c872){if(_0x5eea8a){this[_0x0a90('0x15')](_0x5eea8a,!![]);}else{if(_0x41c872['length']){try{var _0x18beba=this['imap'][_0x0a90('0x2c')](_0x41c872,{'bodies':'','markSeen':!![]});_0x18beba['on']('message',this[_0x0a90('0x2d')][_0x0a90('0x11')](this));_0x18beba[_0x0a90('0xf')](_0x0a90('0x14'),this[_0x0a90('0x2e')][_0x0a90('0x11')](this));_0x18beba[_0x0a90('0xf')](_0x0a90('0x12'),this[_0x0a90('0x2f')]['bind'](this));}catch(_0x3e7027){logger[_0x0a90('0x14')](_0x3e7027);}}else{this['imap']['closeBox'](!![],this[_0x0a90('0x29')]['bind'](this));}}};EmailImap['prototype'][_0x0a90('0x2d')]=function(_0x20a765,_0x11c553){_0x20a765['on'](_0x0a90('0x30'),this[_0x0a90('0x31')][_0x0a90('0x11')](this));_0x20a765[_0x0a90('0xf')]('attributes',this[_0x0a90('0x32')][_0x0a90('0x11')](this));_0x20a765[_0x0a90('0xf')](_0x0a90('0x12'),this['handleMessageEnd']['bind'](this));};EmailImap['prototype']['handleMessageBody']=function(_0x1303ed,_0x2b8fdc){simpleParser(_0x1303ed,{'Iconv':Iconv},this['handleSimpleParser'][_0x0a90('0x11')](this));};EmailImap[_0x0a90('0x18')]['handleMessageAttributes']=function(_0x5f76f8){};EmailImap['prototype'][_0x0a90('0x33')]=function(){};EmailImap[_0x0a90('0x18')]['handleSimpleParser']=function(_0x53eb86,_0x4cc613){if(_0x53eb86){logger[_0x0a90('0x14')](_0x53eb86);}else{var _0x3b3139=this;utils[_0x0a90('0x34')](this['account'],_0x4cc613,function(_0x1b3cd3){_0x3b3139['emit'](_0x0a90('0xa'),_0x1b3cd3);});}};EmailImap['prototype'][_0x0a90('0x2f')]=function(){this[_0x0a90('0x2')][_0x0a90('0x35')](!![],this['handleCloseBox'][_0x0a90('0x11')](this));};EmailImap[_0x0a90('0x18')]['handleFetchError']=function(_0x44ea85){this['handleError'](_0x44ea85);this[_0x0a90('0x2')][_0x0a90('0x35')](!![],this[_0x0a90('0x29')][_0x0a90('0x11')](this));};EmailImap[_0x0a90('0x18')][_0x0a90('0x13')]=function(){this[_0x0a90('0x27')](_0x0a90('0x12'));};EmailImap['prototype'][_0x0a90('0x15')]=function(_0x4d5a45,_0x123e56){logger[_0x0a90('0x14')](_0x0a90('0x15'),this[_0x0a90('0xe')][_0x0a90('0xa')],JSON[_0x0a90('0x36')](_0x4d5a45));var _0x1ab11d='';if(_0x4d5a45){if(_0x4d5a45[_0x0a90('0x37')]){_0x1ab11d=_0x4d5a45[_0x0a90('0x37')];}else{for(var _0x1bb351 in _0x4d5a45){if(_0x4d5a45[_0x0a90('0x38')](_0x1bb351)){_0x1ab11d+=_['upperFirst'](_0x1bb351)+':\x20'+_0x4d5a45[_0x1bb351]+'\x0a';}}}}if(_0x123e56){this[_0x0a90('0x2')][_0x0a90('0x12')]();}else{this[_0x0a90('0x27')](_0x0a90('0x14'),_0x1ab11d);this[_0x0a90('0x27')](_0x0a90('0x12'));}};module[_0x0a90('0x39')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index e1761de..0fb6118 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 _0x9f2d=['bluebird','nodemailer-plugin-inline-base64','prototype','createTransport','use','compile','toString','verify','Not\x20verifired','nodemailer'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9f2d,0x10d));var _0xd9f2=function(_0x38bfa2,_0x3aa3c2){_0x38bfa2=_0x38bfa2-0x0;var _0x49f240=_0x9f2d[_0x38bfa2];return _0x49f240;};'use strict';var nodemailer=require(_0xd9f2('0x0'));var BPromise=require(_0xd9f2('0x1'));var inlineBase64=require(_0xd9f2('0x2'));function EmailSmtp(){}EmailSmtp[_0xd9f2('0x3')]['send']=function(_0xd2b400,_0x2fc9dd){return new BPromise(function(_0x9e6500,_0x814b5a){var _0xe4c4e3=nodemailer[_0xd9f2('0x4')](_0xd2b400);_0xe4c4e3[_0xd9f2('0x5')](_0xd9f2('0x6'),inlineBase64());_0xe4c4e3['sendMail'](_0x2fc9dd,function(_0x57df2c,_0x392e16){if(_0x57df2c){_0x814b5a(_0x57df2c[_0xd9f2('0x7')]());}else{_0x9e6500(_0x392e16);}});});};EmailSmtp[_0xd9f2('0x3')][_0xd9f2('0x8')]=function(_0x15a79a){return new BPromise(function(_0x527543,_0x19f8ee){var _0x27e5cb=nodemailer['createTransport'](_0x15a79a);_0x27e5cb[_0xd9f2('0x8')](function(_0x58101a,_0x6c86a4){if(_0x58101a){_0x19f8ee(_0x58101a[_0xd9f2('0x7')]());}else{if(_0x6c86a4){_0x527543(_0x6c86a4);}else{_0x19f8ee(_0xd9f2('0x9'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x6456=['nodemailer','bluebird','nodemailer-plugin-inline-base64','send','createTransport','compile','toString','verify','Not\x20verifired','exports'];(function(_0x5497a8,_0x313007){var _0x18d7cc=function(_0x37537d){while(--_0x37537d){_0x5497a8['push'](_0x5497a8['shift']());}};_0x18d7cc(++_0x313007);}(_0x6456,0xe6));var _0x6645=function(_0x148ca4,_0x35e36c){_0x148ca4=_0x148ca4-0x0;var _0x51465a=_0x6456[_0x148ca4];return _0x51465a;};'use strict';var nodemailer=require(_0x6645('0x0'));var BPromise=require(_0x6645('0x1'));var inlineBase64=require(_0x6645('0x2'));function EmailSmtp(){}EmailSmtp['prototype'][_0x6645('0x3')]=function(_0x1c4f9f,_0x4e7296){return new BPromise(function(_0x1f2c82,_0xf40a82){var _0x3c5f31=nodemailer[_0x6645('0x4')](_0x1c4f9f);_0x3c5f31['use'](_0x6645('0x5'),inlineBase64());_0x3c5f31['sendMail'](_0x4e7296,function(_0x541c84,_0x3a42f7){if(_0x541c84){_0xf40a82(_0x541c84[_0x6645('0x6')]());}else{_0x1f2c82(_0x3a42f7);}});});};EmailSmtp['prototype'][_0x6645('0x7')]=function(_0x43770d){return new BPromise(function(_0xe85395,_0xd6272e){var _0x21ee38=nodemailer['createTransport'](_0x43770d);_0x21ee38['verify'](function(_0x173833,_0x4e5e45){if(_0x173833){_0xd6272e(_0x173833[_0x6645('0x6')]());}else{if(_0x4e5e45){_0xe85395(_0x4e5e45);}else{_0xd6272e(_0x6645('0x8'));}}});});};module[_0x6645('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index e1d30de..91added 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 _0xacf4=['outlook365','outlook.office365.com','127.0.0.1','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','address','anonymous','generate','@xcally.com','name','substring','slice','join','Anonymous','value','length','test','html','replace','\x20[Attachment:\x20','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','getHost','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com'];(function(_0x5b3546,_0x168b1a){var _0x5eb84f=function(_0x1ab1ab){while(--_0x1ab1ab){_0x5b3546['push'](_0x5b3546['shift']());}};_0x5eb84f(++_0x168b1a);}(_0xacf4,0xe7));var _0x4acf=function(_0x2b3208,_0x26f23b){_0x2b3208=_0x2b3208-0x0;var _0xde06e1=_0xacf4[_0x2b3208];return _0xde06e1;};'use strict';var _=require('lodash');var moment=require('moment');var random=require(_0x4acf('0x0'));var fs=require('fs');var path=require(_0x4acf('0x1'));var util=require(_0x4acf('0x2'));var tnef=require(_0x4acf('0x3'));var logger=require(_0x4acf('0x4'))(_0x4acf('0x5'));var config=require(_0x4acf('0x6'));function getAddress(_0x5cf22d){var _0x380435=_[_0x4acf('0x7')](_0x5cf22d['value']);return _0x380435&&_0x380435[_0x4acf('0x8')]?_0x380435[_0x4acf('0x8')]:_0x4acf('0x9')+random[_0x4acf('0xa')](0x6)+_0x4acf('0xb');}function getFirstName(_0x50f5f4){var _0x55f61d=_[_0x4acf('0x7')](_0x50f5f4['value']);if(_0x55f61d&&_0x55f61d[_0x4acf('0xc')]){if(_0x55f61d[_0x4acf('0xc')]==_0x55f61d[_0x4acf('0x8')]){return _0x55f61d['name'][_0x4acf('0xd')](0x0,_0x55f61d[_0x4acf('0xc')]['indexOf']('@'));}var _0x5f22d9=_0x55f61d[_0x4acf('0xc')]['split'](/\s+/);return _0x5f22d9['length']>0x1?_0x5f22d9[_0x4acf('0xe')](0x0,-0x1)[_0x4acf('0xf')]('\x20'):_0x55f61d[_0x4acf('0xc')];}return _0x4acf('0x10');}function getLastName(_0x18629e){var _0x1a9949=_[_0x4acf('0x7')](_0x18629e[_0x4acf('0x11')]);if(_0x1a9949&&_0x1a9949[_0x4acf('0xc')]){var _0x312bb5=_0x1a9949[_0x4acf('0xc')]['split'](/\s+/);return _0x312bb5[_0x4acf('0x12')]>0x1?_0x312bb5['pop']():'';}return'';}function getMails(_0x34cec1,_0x4041c8){var _0xccf970='';for(var _0x5d934a=0x0;_0x5d934a<_0x4041c8['value'][_0x4acf('0x12')];_0x5d934a+=0x1){if(_0x4041c8[_0x4acf('0x11')][_0x5d934a][_0x4acf('0x8')]!==_0x34cec1){if(!_['isEmpty'](_0xccf970)){_0xccf970+=',';}_0xccf970+=_0x4041c8[_0x4acf('0x11')][_0x5d934a][_0x4acf('0xc')]||_0x4041c8[_0x4acf('0x11')][_0x5d934a][_0x4acf('0x8')]||'';_0xccf970+='\x20<';_0xccf970+=_0x4041c8[_0x4acf('0x11')][_0x5d934a][_0x4acf('0x8')]?_0x4041c8[_0x4acf('0x11')][_0x5d934a][_0x4acf('0x8')]:_0x4acf('0x9')+random[_0x4acf('0xa')](0x6)+_0x4acf('0xb');_0xccf970+='>';}}return _0xccf970;}function parseEmail(_0x5f0284,_0x28d698,_0x6bd89){if(_0x28d698['html']){var _0x41e5d2=/)<[^<]*)*<\/script>/gi;while(_0x41e5d2[_0x4acf('0x13')](_0x28d698['html'])){_0x28d698[_0x4acf('0x14')]=_0x28d698[_0x4acf('0x14')][_0x4acf('0x15')](_0x41e5d2,'');}if(_0x28d698[_0x4acf('0x14')]['includes'](_0x4acf('0x16'))){var _0x12e717=[];_0x28d698['attachments'][_0x4acf('0x17')](_0x1af4e9=>{_0x12e717['push'](_0x1af4e9[_0x4acf('0x18')]);});var _0x7ebb=/]+>/g;var _0x38152c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x16458f=_0x28d698['html']['replace'](_0x38152c,_0x4acf('0x19'));var _0x3f548a=_0x16458f[_0x4acf('0x15')](_0x7ebb,_0x4acf('0x1a'));for(let _0x14086c=0x0;_0x14086c<_0x12e717[_0x4acf('0x12')];_0x14086c++){var _0xb83274=_0x3f548a[_0x4acf('0x15')](_0x4acf('0x1a'),_0x4acf('0x1b')+_0x12e717[_0x14086c]+'\x20]');_0x3f548a=_0xb83274;}_0x28d698[_0x4acf('0x14')]=_0x3f548a;}_0x6bd89[_0x4acf('0x1c')]=_0x28d698[_0x4acf('0x14')];}else{_0x6bd89[_0x4acf('0x1c')]=_0x28d698[_0x4acf('0x1d')];}if(_0x6bd89[_0x4acf('0x1c')]){_0x6bd89[_0x4acf('0x1c')]=_0x6bd89['body'][_0x4acf('0x15')](/0x0){var _0x55216a=['Auto-Submitted:\x20auto-replied',_0x4acf('0x30'),_0x4acf('0x31')];for(var _0x208af3=0x0;_0x208af3<_0x28d698['headerLines'][_0x4acf('0x12')];_0x208af3++){var _0x3b6574=_[_0x4acf('0x32')](_0x55216a,_0x28d698[_0x4acf('0x2f')][_0x208af3][_0x4acf('0x33')]);if(_0x3b6574>=0x0){_0x6bd89[_0x4acf('0x34')]=!![];}}}return _0x6bd89;}exports[_0x4acf('0x35')]=function(_0x17d5e9,_0x461547,_0x3b8cfa){var _0x25d84c={'from':getAddress(_0x461547['from']),'firstName':getFirstName(_0x461547[_0x4acf('0x36')]),'lastName':getLastName(_0x461547[_0x4acf('0x36')]),'mapKey':_0x4acf('0x5'),'message':{'from':getMails(_0x17d5e9[_0x4acf('0x5')],_0x461547[_0x4acf('0x36')]),'to':_0x17d5e9['email'],'cc':'','subject':_0x461547['subject']||'','messageId':_0x461547[_0x4acf('0x37')],'inReplyTo':_0x461547[_0x4acf('0x38')],'sentAt':moment(_0x461547[_0x4acf('0x39')])[_0x4acf('0x28')](_0x4acf('0x3a')),'attach':![],'attachments':[]}};if(!_0x461547[_0x4acf('0x14')]&&!_0x461547['textAsHtml']){var _0x2e7128=_['filter'](_0x461547[_0x4acf('0x24')],{'contentType':_0x4acf('0x3b')});if(_0x2e7128['length']){logger['info'](util[_0x4acf('0x28')](_0x4acf('0x3c'),_0x461547[_0x4acf('0x37')]));tnef[_0x4acf('0x3d')](_['first'](_0x2e7128)[_0x4acf('0x2c')],function(_0x13fac4,_0x2378c6){if(_0x2378c6){_0x461547[_0x4acf('0x14')]=_0x2378c6[_0x4acf('0x3e')]||_0x4acf('0x3f');if(_0x2378c6[_0x4acf('0x40')]){for(var _0x2d946c=0x0;_0x2d946c<_0x2378c6['Attachments']['length'];_0x2d946c++){var _0x1f5c5f=_0x2378c6[_0x4acf('0x40')][_0x2d946c];_0x25d84c[_0x4acf('0x1f')][_0x4acf('0x24')][_0x4acf('0x2d')]({'filename':_0x1f5c5f[_0x4acf('0x41')],'content':Buffer[_0x4acf('0x36')](_0x1f5c5f[_0x4acf('0x42')])});}}}_0x3b8cfa(parseEmail(_0x17d5e9,_0x461547,_0x25d84c));});}else{_0x461547[_0x4acf('0x14')]=_0x4acf('0x3f');_0x3b8cfa(parseEmail(_0x17d5e9,_0x461547,_0x25d84c));}}else{_0x3b8cfa(parseEmail(_0x17d5e9,_0x461547,_0x25d84c));}};exports[_0x4acf('0x43')]=function(_0x9aa592){switch(_0x9aa592){case'gmail':return _0x4acf('0x44');case _0x4acf('0x45'):return _0x4acf('0x46');case _0x4acf('0x47'):return _0x4acf('0x48');case _0x4acf('0x49'):return _0x4acf('0x4a');}return _0x4acf('0x4b');}; \ No newline at end of file +var _0x46c1=['attachments','push','filename','replace','_SRC','_IMG','body','textAsHtml','Empty\x20message

','Attachments','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','127.0.0.1','moment','randomstring','path','util','node-tnef','email','../../../config/environment','head','address','anonymous','generate','value','name','substring','indexOf','split','length','join','Anonymous','pop','isEmpty','@xcally.com','test','html','includes','0x1?_0x4de290['slice'](0x0,-0x1)[_0x146c('0x11')]('\x20'):_0x52d430['name'];}return _0x146c('0x12');}function getLastName(_0x51d151){var _0x2f4dab=_[_0x146c('0x7')](_0x51d151[_0x146c('0xb')]);if(_0x2f4dab&&_0x2f4dab[_0x146c('0xc')]){var _0x542a59=_0x2f4dab[_0x146c('0xc')][_0x146c('0xf')](/\s+/);return _0x542a59['length']>0x1?_0x542a59[_0x146c('0x13')]():'';}return'';}function getMails(_0x50bdae,_0x4a554b){var _0x15aaf4='';for(var _0x512ac8=0x0;_0x512ac8<_0x4a554b[_0x146c('0xb')][_0x146c('0x10')];_0x512ac8+=0x1){if(_0x4a554b[_0x146c('0xb')][_0x512ac8]['address']!==_0x50bdae){if(!_[_0x146c('0x14')](_0x15aaf4)){_0x15aaf4+=',';}_0x15aaf4+=_0x4a554b[_0x146c('0xb')][_0x512ac8][_0x146c('0xc')]||_0x4a554b[_0x146c('0xb')][_0x512ac8][_0x146c('0x8')]||'';_0x15aaf4+='\x20<';_0x15aaf4+=_0x4a554b[_0x146c('0xb')][_0x512ac8][_0x146c('0x8')]?_0x4a554b[_0x146c('0xb')][_0x512ac8][_0x146c('0x8')]:'anonymous'+random[_0x146c('0xa')](0x6)+_0x146c('0x15');_0x15aaf4+='>';}}return _0x15aaf4;}function parseEmail(_0x2d157c,_0x8e7792,_0x11ac12){if(_0x8e7792['html']){var _0x5b5ada=/)<[^<]*)*<\/script>/gi;while(_0x5b5ada[_0x146c('0x16')](_0x8e7792[_0x146c('0x17')])){_0x8e7792[_0x146c('0x17')]=_0x8e7792[_0x146c('0x17')]['replace'](_0x5b5ada,'');}if(_0x8e7792[_0x146c('0x17')][_0x146c('0x18')](_0x146c('0x19'))){var _0x153fe0=[];_0x8e7792[_0x146c('0x1a')]['forEach'](_0x5d9cc9=>{_0x153fe0[_0x146c('0x1b')](_0x5d9cc9[_0x146c('0x1c')]);});var _0x393e6c=/]+>/g;var _0x46c83c=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4eef57=_0x8e7792[_0x146c('0x17')][_0x146c('0x1d')](_0x46c83c,_0x146c('0x1e'));var _0x3ad5fb=_0x4eef57[_0x146c('0x1d')](_0x393e6c,_0x146c('0x1f'));for(let _0x2b66d2=0x0;_0x2b66d2<_0x153fe0[_0x146c('0x10')];_0x2b66d2++){var _0x3bd8b5=_0x3ad5fb['replace'](_0x146c('0x1f'),'\x20[Attachment:\x20'+_0x153fe0[_0x2b66d2]+'\x20]');_0x3ad5fb=_0x3bd8b5;}_0x8e7792[_0x146c('0x17')]=_0x3ad5fb;}_0x11ac12[_0x146c('0x20')]=_0x8e7792[_0x146c('0x17')];}else{_0x11ac12[_0x146c('0x20')]=_0x8e7792[_0x146c('0x21')];}if(_0x11ac12[_0x146c('0x20')]){_0x11ac12[_0x146c('0x20')]=_0x11ac12[_0x146c('0x20')][_0x146c('0x1d')](/0x0){var _0xf0ef19=[_0x146c('0x2e'),_0x146c('0x2f'),'Precedence:\x20auto_reply'];for(var _0x3022d6=0x0;_0x3022d6<_0x8e7792[_0x146c('0x2d')][_0x146c('0x10')];_0x3022d6++){var _0x4055ce=_[_0x146c('0xe')](_0xf0ef19,_0x8e7792[_0x146c('0x2d')][_0x3022d6][_0x146c('0x30')]);if(_0x4055ce>=0x0){_0x11ac12[_0x146c('0x31')]=!![];}}}return _0x11ac12;}exports[_0x146c('0x32')]=function(_0x29149a,_0x58d7ec,_0x15693d){var _0x1c8927={'from':getAddress(_0x58d7ec[_0x146c('0x33')]),'firstName':getFirstName(_0x58d7ec['from']),'lastName':getLastName(_0x58d7ec[_0x146c('0x33')]),'mapKey':_0x146c('0x5'),'message':{'from':getMails(_0x29149a[_0x146c('0x5')],_0x58d7ec['from']),'to':_0x29149a[_0x146c('0x5')],'cc':'','subject':_0x58d7ec[_0x146c('0x34')]||'','messageId':_0x58d7ec['messageId'],'inReplyTo':_0x58d7ec[_0x146c('0x35')],'sentAt':moment(_0x58d7ec[_0x146c('0x36')])[_0x146c('0x28')](_0x146c('0x37')),'attach':![],'attachments':[]}};if(!_0x58d7ec[_0x146c('0x17')]&&!_0x58d7ec['textAsHtml']){var _0x4a68fd=_[_0x146c('0x38')](_0x58d7ec['attachments'],{'contentType':_0x146c('0x39')});if(_0x4a68fd[_0x146c('0x10')]){logger[_0x146c('0x3a')](util['format'](_0x146c('0x3b'),_0x58d7ec[_0x146c('0x3c')]));tnef[_0x146c('0x3d')](_[_0x146c('0x3e')](_0x4a68fd)[_0x146c('0x3f')],function(_0x5dca52,_0x4a8188){if(_0x4a8188){_0x58d7ec[_0x146c('0x17')]=_0x4a8188[_0x146c('0x40')]||_0x146c('0x41');if(_0x4a8188[_0x146c('0x42')]){for(var _0xc6b7be=0x0;_0xc6b7be<_0x4a8188[_0x146c('0x42')]['length'];_0xc6b7be++){var _0x1488ac=_0x4a8188['Attachments'][_0xc6b7be];_0x1c8927[_0x146c('0x23')][_0x146c('0x1a')]['push']({'filename':_0x1488ac['Title'],'content':Buffer[_0x146c('0x33')](_0x1488ac['Data'])});}}}_0x15693d(parseEmail(_0x29149a,_0x58d7ec,_0x1c8927));});}else{_0x58d7ec['html']='

Empty\x20message

';_0x15693d(parseEmail(_0x29149a,_0x58d7ec,_0x1c8927));}}else{_0x15693d(parseEmail(_0x29149a,_0x58d7ec,_0x1c8927));}};exports[_0x146c('0x43')]=function(_0xb37756){switch(_0xb37756){case _0x146c('0x44'):return _0x146c('0x45');case'yahoo':return _0x146c('0x46');case _0x146c('0x47'):return'imap-mail.outlook.com';case _0x146c('0x48'):return _0x146c('0x49');}return _0x146c('0x4a');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 4952ddd..ad0dbef 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 _0x664b=['exports','name','key','SERV','active','Imap','Smtp'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x664b,0x1ac));var _0xb664=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x664b[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');function MailAccount(_0x4f83e0){this['id']=_0x4f83e0['id']||0x0;this[_0xb664('0x0')]=_0x4f83e0['name']||'Service';this[_0xb664('0x1')]=_0x4f83e0[_0xb664('0x1')]||_0xb664('0x2');this[_0xb664('0x3')]=_0x4f83e0[_0xb664('0x3')]||![];this[_0xb664('0x4')]=_0x4f83e0[_0xb664('0x4')]||[];this[_0xb664('0x5')]=_0x4f83e0[_0xb664('0x5')]||[];}module[_0xb664('0x6')]=MailAccount; \ No newline at end of file +var _0x9877=['Imap','Smtp','name','Service','key','SERV','active'];(function(_0x5e5e39,_0x474a85){var _0x4eb98d=function(_0x2a30c0){while(--_0x2a30c0){_0x5e5e39['push'](_0x5e5e39['shift']());}};_0x4eb98d(++_0x474a85);}(_0x9877,0x17c));var _0x7987=function(_0x14c358,_0x33e382){_0x14c358=_0x14c358-0x0;var _0x3509da=_0x9877[_0x14c358];return _0x3509da;};'use strict';var _=require('lodash');function MailAccount(_0x525668){this['id']=_0x525668['id']||0x0;this[_0x7987('0x0')]=_0x525668[_0x7987('0x0')]||_0x7987('0x1');this[_0x7987('0x2')]=_0x525668[_0x7987('0x2')]||_0x7987('0x3');this['active']=_0x525668[_0x7987('0x4')]||![];this[_0x7987('0x5')]=_0x525668[_0x7987('0x5')]||[];this[_0x7987('0x6')]=_0x525668[_0x7987('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 9eb1faf..daa11fa 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 _0x2cd5=['initMailAccounts','length','isUndefined','merge','exports','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','mergeFromDatabase','prototype'];(function(_0x24d9a3,_0x243332){var _0x3e77ae=function(_0x3e9cd4){while(--_0x3e9cd4){_0x24d9a3['push'](_0x24d9a3['shift']());}};_0x3e77ae(++_0x243332);}(_0x2cd5,0x19c));var _0x52cd=function(_0xe95c54,_0x19dc54){_0xe95c54=_0xe95c54-0x0;var _0x46493d=_0x2cd5[_0xe95c54];return _0x46493d;};'use strict';var _=require('lodash');var MailAccount=require(_0x52cd('0x0'));var Realtime=function(){this[_0x52cd('0x1')]={};};function freeIsNotKey(_0x5db59a,_0x4e2fc7,_0x3b76e2){var _0x79b801=_[_0x52cd('0x2')](_0x5db59a,function(_0x12fab1,_0x2967ba){return _0x12fab1[_0x3b76e2];});for(var _0x3605bd in _0x4e2fc7){if(_0x4e2fc7[_0x52cd('0x3')](_0x3605bd)){if(!_0x79b801[_0x3605bd]){delete _0x4e2fc7[_0x3605bd];}}}}Realtime['prototype'][_0x52cd('0x4')]=function(_0x383e82,_0x266ab1){for(var _0x3898c7 in _0x266ab1){if(_0x383e82[_0x52cd('0x3')](_0x3898c7)){_0x383e82[_0x3898c7]=_0x266ab1[_0x3898c7];}}};Realtime[_0x52cd('0x5')][_0x52cd('0x6')]=function(){var _0x275436=this;return function(_0x30f9ef){if(_0x30f9ef){freeIsNotKey(_0x30f9ef,_0x275436['mailAccounts'],'id');for(var _0x341cb8=0x0,_0x2e5d55={},_0x298311={};_0x341cb8<_0x30f9ef[_0x52cd('0x7')];_0x341cb8+=0x1){_0x2e5d55=_0x30f9ef[_0x341cb8];if(_[_0x52cd('0x8')](_0x275436[_0x52cd('0x1')][_0x2e5d55['id']])){_0x275436[_0x52cd('0x1')][_0x2e5d55['id']]=new MailAccount(_0x2e5d55);}else{_[_0x52cd('0x9')](_0x275436[_0x52cd('0x1')][_0x2e5d55['id']],_0x2e5d55);}}}return _0x275436[_0x52cd('0x1')];};};module[_0x52cd('0xa')]=Realtime; \ No newline at end of file +var _0x3a10=['mailAccounts','mapKeys','hasOwnProperty','initMailAccounts','isUndefined','exports'];(function(_0x28cccc,_0x56cb14){var _0x24c981=function(_0x2adbbf){while(--_0x2adbbf){_0x28cccc['push'](_0x28cccc['shift']());}};_0x24c981(++_0x56cb14);}(_0x3a10,0x17a));var _0x03a1=function(_0x2d10ec,_0x20b51b){_0x2d10ec=_0x2d10ec-0x0;var _0x10e9ab=_0x3a10[_0x2d10ec];return _0x10e9ab;};'use strict';var _=require('lodash');var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0x03a1('0x0')]={};};function freeIsNotKey(_0x2ad03f,_0x89839b,_0x9d1aa4){var _0xc03b67=_[_0x03a1('0x1')](_0x2ad03f,function(_0x221872,_0x45420e){return _0x221872[_0x9d1aa4];});for(var _0x14be70 in _0x89839b){if(_0x89839b[_0x03a1('0x2')](_0x14be70)){if(!_0xc03b67[_0x14be70]){delete _0x89839b[_0x14be70];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x44dcd3,_0x4b3c27){for(var _0x318c11 in _0x4b3c27){if(_0x44dcd3[_0x03a1('0x2')](_0x318c11)){_0x44dcd3[_0x318c11]=_0x4b3c27[_0x318c11];}}};Realtime['prototype'][_0x03a1('0x3')]=function(){var _0x475fa5=this;return function(_0x2bf679){if(_0x2bf679){freeIsNotKey(_0x2bf679,_0x475fa5[_0x03a1('0x0')],'id');for(var _0x2e71b6=0x0,_0x4a8c71={},_0x27d871={};_0x2e71b6<_0x2bf679['length'];_0x2e71b6+=0x1){_0x4a8c71=_0x2bf679[_0x2e71b6];if(_[_0x03a1('0x4')](_0x475fa5[_0x03a1('0x0')][_0x4a8c71['id']])){_0x475fa5[_0x03a1('0x0')][_0x4a8c71['id']]=new MailAccount(_0x4a8c71);}else{_['merge'](_0x475fa5['mailAccounts'][_0x4a8c71['id']],_0x4a8c71);}}}return _0x475fa5[_0x03a1('0x0')];};};module[_0x03a1('0x5')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index f47a032..703e3dd 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 _0x34a5=['name','service','email','active','key','ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client'];(function(_0x45a2f4,_0x2ac8d6){var _0x523c07=function(_0x160237){while(--_0x160237){_0x45a2f4['push'](_0x45a2f4['shift']());}};_0x523c07(++_0x2ac8d6);}(_0x34a5,0xc2));var _0x534a=function(_0x1af06c,_0x133369){_0x1af06c=_0x1af06c-0x0;var _0x2e6b1d=_0x34a5[_0x1af06c];return _0x2e6b1d;};'use strict';var client=require(_0x534a('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0x534a('0x1'),_0x534a('0x2'),_0x534a('0x3'),_0x534a('0x4'),_0x534a('0x5'),_0x534a('0x6'),_0x534a('0x7')],'raw':![],'include':[{'model':_0x534a('0x8'),'as':_0x534a('0x9')},{'model':_0x534a('0xa'),'as':_0x534a('0xb')}]},'log':_0x534a('0xc')});};};exports[_0x534a('0xd')]=function(_0x3c85e8,_0x10ebcc){return client['Request'](_0x534a('0xe'),{'account':{'id':_0x3c85e8},'body':_0x10ebcc,'log':_0x534a('0xe')});}; \ No newline at end of file +var _0x8411=['Smtp','getMailAccount','notify','NotifyMailAccount','Request','GetMailAccount','email','active','key','ListId','TemplateId','Imap'];(function(_0x366269,_0x31d7d3){var _0x34ed77=function(_0x58bef0){while(--_0x58bef0){_0x366269['push'](_0x366269['shift']());}};_0x34ed77(++_0x31d7d3);}(_0x8411,0x118));var _0x1841=function(_0x772e8,_0x434fa8){_0x772e8=_0x772e8-0x0;var _0xcea20=_0x8411[_0x772e8];return _0xcea20;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client[_0x1841('0x0')](_0x1841('0x1'),{'options':{'attributes':['id','name','service',_0x1841('0x2'),_0x1841('0x3'),_0x1841('0x4'),_0x1841('0x5'),_0x1841('0x6')],'raw':![],'include':[{'model':'MailServerIn','as':_0x1841('0x7')},{'model':'MailServerOut','as':_0x1841('0x8')}]},'log':_0x1841('0x9')});};};exports[_0x1841('0xa')]=function(_0xa774c1,_0x31f16d){return client[_0x1841('0x0')](_0x1841('0xb'),{'account':{'id':_0xa774c1},'body':_0x31f16d,'log':_0x1841('0xb')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 002eefe..d3f9a28 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 _0x7cf4=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x1cb8f0,_0x3077f8){var _0x31cf46=function(_0x2a966f){while(--_0x2a966f){_0x1cb8f0['push'](_0x1cb8f0['shift']());}};_0x31cf46(++_0x3077f8);}(_0x7cf4,0x91));var _0x47cf=function(_0x4c8adf,_0x305009){_0x4c8adf=_0x4c8adf-0x0;var _0x495ac7=_0x7cf4[_0x4c8adf];return _0x495ac7;};'use strict';var client=require(_0x47cf('0x0'));exports[_0x47cf('0x1')]=function(){return client[_0x47cf('0x2')](_0x47cf('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x47cf('0x4')]},'log':_0x47cf('0x5')});}; \ No newline at end of file +var _0x2613=['Request','ShowSetting','GetSettings','../client'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x2613,0x8b));var _0x3261=function(_0x12fca3,_0x1dd5e4){_0x12fca3=_0x12fca3-0x0;var _0x1aa91f=_0x2613[_0x12fca3];return _0x1aa91f;};'use strict';var client=require(_0x3261('0x0'));exports['getSettings']=function(){return client[_0x3261('0x1')](_0x3261('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x3261('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 18c69aa..41e80bb 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 078b5a5..ab81a1e 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 _0x82cb=['once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','../../config/socketio','default','../../config/express','../../routes'];(function(_0x165ad0,_0x48f424){var _0x203068=function(_0x2cdee6){while(--_0x2cdee6){_0x165ad0['push'](_0x165ad0['shift']());}};_0x203068(++_0x48f424);}(_0x82cb,0x17c));var _0xb82c=function(_0xec695c,_0x6d98df){_0xec695c=_0xec695c-0x0;var _0x3ccfd6=_0x82cb[_0xec695c];return _0x3ccfd6;};'use strict';var _=require('lodash');var http=require(_0xb82c('0x0'));var express=require(_0xb82c('0x1'));var sticky=require(_0xb82c('0x2'));var Redis=require(_0xb82c('0x3'));var config=require(_0xb82c('0x4'));var app=express();var server=http[_0xb82c('0x5')](app);server[_0xb82c('0x6')]=0xdbba0;if(sticky[_0xb82c('0x7')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':[_0xb82c('0x8'),_0xb82c('0x9')]});config[_0xb82c('0xa')]=_[_0xb82c('0xb')](config[_0xb82c('0xa')],{'host':_0xb82c('0xc'),'port':0x18eb});socketio[_0xb82c('0xd')](require(_0xb82c('0xe'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xb82c('0xa')])}));require(_0xb82c('0xf'))['default']();require(_0xb82c('0x10'))[_0xb82c('0x11')](socketio);require(_0xb82c('0x12'))[_0xb82c('0x11')](app);require(_0xb82c('0x13'))[_0xb82c('0x11')](app);}else{server[_0xb82c('0x14')](_0xb82c('0x15'),function(){console[_0xb82c('0x16')](_0xb82c('0x17'),config['port']);});}exports=module[_0xb82c('0x18')]=app; \ No newline at end of file +var _0xc98f=['adapter','socket.io-redis','../../config/triggers','default','../../config/express','../../routes','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','lodash','http','express','sticky-session','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','redis','defaults','localhost'];(function(_0x3d8088,_0x59af8b){var _0x1705a6=function(_0x44ef7b){while(--_0x44ef7b){_0x3d8088['push'](_0x3d8088['shift']());}};_0x1705a6(++_0x59af8b);}(_0xc98f,0x14b));var _0xfc98=function(_0x550fb5,_0x179273){_0x550fb5=_0x550fb5-0x0;var _0x29ca1d=_0xc98f[_0x550fb5];return _0x29ca1d;};'use strict';var _=require(_0xfc98('0x0'));var http=require(_0xfc98('0x1'));var express=require(_0xfc98('0x2'));var sticky=require(_0xfc98('0x3'));var Redis=require('ioredis');var config=require(_0xfc98('0x4'));var app=express();var server=http[_0xfc98('0x5')](app);server[_0xfc98('0x6')]=0xdbba0;if(sticky[_0xfc98('0x7')](server,config[_0xfc98('0x8')])){var socketio=require(_0xfc98('0x9'))(server,{'transports':[_0xfc98('0xa'),'polling']});config[_0xfc98('0xb')]=_[_0xfc98('0xc')](config[_0xfc98('0xb')],{'host':_0xfc98('0xd'),'port':0x18eb});socketio[_0xfc98('0xe')](require(_0xfc98('0xf'))({'pubClient':new Redis(config[_0xfc98('0xb')]),'subClient':new Redis(config[_0xfc98('0xb')])}));require(_0xfc98('0x10'))[_0xfc98('0x11')]();require('../../config/socketio')[_0xfc98('0x11')](socketio);require(_0xfc98('0x12'))[_0xfc98('0x11')](app);require(_0xfc98('0x13'))[_0xfc98('0x11')](app);}else{server[_0xfc98('0x14')](_0xfc98('0x15'),function(){console['log'](_0xfc98('0x16'),config[_0xfc98('0x8')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 23c5799..d3da44c 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 _0x8236=['bluebird','routing','client','http','Request','debug','error','result','rpc','exports','jayson/promise'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8236,0xba));var _0x6823=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x8236[_0x4b055c];return _0x4b62bb;};'use strict';var jayson=require(_0x6823('0x0'));var BPromise=require(_0x6823('0x1'));var logger=require('../../config/logger')(_0x6823('0x2'));var client=jayson[_0x6823('0x3')][_0x6823('0x4')]({'port':0x2329});client[_0x6823('0x5')]=function(_0x4124b8,_0xc7c2ea){return new BPromise(function(_0x29ae69,_0x550c00){return client['request'](_0x4124b8,_0xc7c2ea)['then'](function(_0x4bf99b){logger[_0x6823('0x6')]('rpc',_0x6823('0x2'),_0x4124b8,_0xc7c2ea,_0x4bf99b);if(_0x4bf99b[_0x6823('0x7')]){logger['error']('rpc',_0x6823('0x2'),_0x4124b8,_0x4bf99b[_0x6823('0x7')]['message'],_0xc7c2ea);return _0x550c00(_0x4bf99b[_0x6823('0x7')]['message']);}else{return _0x29ae69(_0x4bf99b[_0x6823('0x8')]);}})['catch'](function(_0x565888){logger['error'](_0x6823('0x9'),_0x6823('0x2'),_0x4124b8,_0x565888,_0xc7c2ea);return _0x550c00(_0x565888);});});};module[_0x6823('0xa')]=client; \ No newline at end of file +var _0x3503=['catch','jayson/promise','bluebird','../../config/logger','routing','client','Request','then','debug','rpc','error','message','result'];(function(_0x4e11ed,_0x48ea66){var _0x5461e2=function(_0x56eb1b){while(--_0x56eb1b){_0x4e11ed['push'](_0x4e11ed['shift']());}};_0x5461e2(++_0x48ea66);}(_0x3503,0xc4));var _0x3350=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3503[_0x17d9e3];return _0x14192d;};'use strict';var jayson=require(_0x3350('0x0'));var BPromise=require(_0x3350('0x1'));var logger=require(_0x3350('0x2'))(_0x3350('0x3'));var client=jayson[_0x3350('0x4')]['http']({'port':0x2329});client[_0x3350('0x5')]=function(_0x2a007d,_0x1a9221){return new BPromise(function(_0x58bc4e,_0x4b4e90){return client['request'](_0x2a007d,_0x1a9221)[_0x3350('0x6')](function(_0x497663){logger[_0x3350('0x7')](_0x3350('0x8'),_0x3350('0x3'),_0x2a007d,_0x1a9221,_0x497663);if(_0x497663[_0x3350('0x9')]){logger[_0x3350('0x9')](_0x3350('0x8'),_0x3350('0x3'),_0x2a007d,_0x497663[_0x3350('0x9')][_0x3350('0xa')],_0x1a9221);return _0x4b4e90(_0x497663[_0x3350('0x9')][_0x3350('0xa')]);}else{return _0x58bc4e(_0x497663[_0x3350('0xb')]);}})[_0x3350('0xc')](function(_0x5f4bbb){logger[_0x3350('0x9')](_0x3350('0x8'),_0x3350('0x3'),_0x2a007d,_0x5f4bbb,_0x1a9221);return _0x4b4e90(_0x5f4bbb);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 4824244..b7c3924 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 _0x5629=['getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','bluebird','./server','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then'];(function(_0x362c1e,_0x42a74f){var _0x573180=function(_0x511b1b){while(--_0x511b1b){_0x362c1e['push'](_0x362c1e['shift']());}};_0x573180(++_0x42a74f);}(_0x5629,0x12e));var _0x9562=function(_0x2cd2f5,_0x268405){_0x2cd2f5=_0x2cd2f5-0x0;var _0x3ae97c=_0x5629[_0x2cd2f5];return _0x3ae97c;};'use strict';var BPromise=require(_0x9562('0x0'));var server=require(_0x9562('0x1'));var Realtime=require('./realtime');var user=require(_0x9562('0x2'));var interval=require(_0x9562('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x9562('0x4'));var smsQueue=require(_0x9562('0x5'));var mailQueue=require(_0x9562('0x6'));var faxQueue=require(_0x9562('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x9562('0x8')]()[_0x9562('0x9')](user[_0x9562('0xa')]())[_0x9562('0x9')](realtime[_0x9562('0xb')]())[_0x9562('0x9')](interval[_0x9562('0xc')]())[_0x9562('0x9')](realtime[_0x9562('0xd')]())[_0x9562('0x9')](openchannelQueue[_0x9562('0xe')]())[_0x9562('0x9')](realtime[_0x9562('0xf')]())['then'](chatQueue[_0x9562('0x10')]())[_0x9562('0x9')](realtime[_0x9562('0x11')]())[_0x9562('0x9')](smsQueue['getSmsQueues']())[_0x9562('0x9')](realtime[_0x9562('0x12')]())[_0x9562('0x9')](mailQueue[_0x9562('0x13')]())[_0x9562('0x9')](realtime[_0x9562('0x14')]())['then'](faxQueue[_0x9562('0x15')]())[_0x9562('0x9')](realtime[_0x9562('0x16')]())['then'](whatsappQueue[_0x9562('0x17')]())['then'](realtime[_0x9562('0x18')]())[_0x9562('0x9')](function(){return realtime;});}function main(){return server[_0x9562('0x19')](realtime)[_0x9562('0x9')](function(_0x3ca006){return initRealtime();})['then'](function(_0xb9581a){return setInterval(initRealtime,0x1388);})['catch'](function(_0x3b91a0){console['log'](_0x3b91a0);});}main(); \ No newline at end of file +var _0xaf69=['then','getAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','initMailQueues','getFaxQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve'];(function(_0x4e0b26,_0x1fd6e2){var _0x3d358b=function(_0x273dde){while(--_0x273dde){_0x4e0b26['push'](_0x4e0b26['shift']());}};_0x3d358b(++_0x1fd6e2);}(_0xaf69,0x1ea));var _0x9af6=function(_0x1fb49a,_0x28057f){_0x1fb49a=_0x1fb49a-0x0;var _0x30b618=_0xaf69[_0x1fb49a];return _0x30b618;};'use strict';var BPromise=require(_0x9af6('0x0'));var server=require(_0x9af6('0x1'));var Realtime=require(_0x9af6('0x2'));var user=require(_0x9af6('0x3'));var interval=require(_0x9af6('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x9af6('0x5'));var smsQueue=require(_0x9af6('0x6'));var mailQueue=require(_0x9af6('0x7'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x9af6('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x9af6('0x9')]()[_0x9af6('0xa')](user[_0x9af6('0xb')]())['then'](realtime['initAgents']())[_0x9af6('0xa')](interval[_0x9af6('0xc')]())[_0x9af6('0xa')](realtime[_0x9af6('0xd')]())[_0x9af6('0xa')](openchannelQueue[_0x9af6('0xe')]())[_0x9af6('0xa')](realtime[_0x9af6('0xf')]())[_0x9af6('0xa')](chatQueue[_0x9af6('0x10')]())[_0x9af6('0xa')](realtime[_0x9af6('0x11')]())[_0x9af6('0xa')](smsQueue['getSmsQueues']())[_0x9af6('0xa')](realtime[_0x9af6('0x12')]())['then'](mailQueue['getMailQueues']())[_0x9af6('0xa')](realtime[_0x9af6('0x13')]())[_0x9af6('0xa')](faxQueue[_0x9af6('0x14')]())['then'](realtime['initFaxQueues']())[_0x9af6('0xa')](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0x9af6('0x15')]())[_0x9af6('0xa')](function(){return realtime;});}function main(){return server[_0x9af6('0x16')](realtime)['then'](function(_0x307307){return initRealtime();})['then'](function(_0x229294){return setInterval(initRealtime,0x1388);})[_0x9af6('0x17')](function(_0x52e3e4){console[_0x9af6('0x18')](_0x52e3e4);});}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 71bc7b5..e734a3f 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fc3=['lodash','util','EventEmitter','init','isNil','ignoreFactChanges','inherits','activeRules','prototype','register','isArray','rules','isObject','sync','orderBy','asc','execute','clone','ruleRef','name','index_','push','call','nextTick','next','isEqual','restart','length','condition','matchPath','noop','findRules','filter','prioritize','priority','toJSON','map','consequence','toString','fromJSON','isString','parse'];(function(_0x2b9c5a,_0x52f3e7){var _0x2e0b2b=function(_0x51b225){while(--_0x51b225){_0x2b9c5a['push'](_0x2b9c5a['shift']());}};_0x2e0b2b(++_0x52f3e7);}(_0x5fc3,0xa8));var _0x35fc=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x5fc3[_0x56fe98];return _0x212f4f;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var EventEmitter=require('events')[_0x35fc('0x2')];function RuleEngine(_0x2ac6da,_0x196bc2){this[_0x35fc('0x3')]();if(!_[_0x35fc('0x4')](_0x2ac6da)){this['register'](_0x2ac6da);}if(_0x196bc2){this[_0x35fc('0x5')]=_0x196bc2[_0x35fc('0x5')];}return this;}util[_0x35fc('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype']['init']=function(_0x19a0d1){this['rules']=[];this[_0x35fc('0x7')]=[];};RuleEngine[_0x35fc('0x8')][_0x35fc('0x9')]=function(_0x1e5f90){if(Array[_0x35fc('0xa')](_0x1e5f90)){this[_0x35fc('0xb')]=this[_0x35fc('0xb')]['concat'](_0x1e5f90);}else if(_0x1e5f90!==null&&_[_0x35fc('0xc')](_0x1e5f90)){this[_0x35fc('0xb')]['push'](_0x1e5f90);}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')]['sync']=function(){this[_0x35fc('0x7')]=this[_0x35fc('0xb')]['filter'](function(_0x4cbe74){if(_[_0x35fc('0x4')](_0x4cbe74['on'])){_0x4cbe74['on']=!![];}if(_0x4cbe74['on']===!![]){return _0x4cbe74;}});this['activeRules']=_[_0x35fc('0xe')](this[_0x35fc('0x7')],['p'],[_0x35fc('0xf')]);};RuleEngine[_0x35fc('0x8')][_0x35fc('0x10')]=function(_0x5cfe94,_0x59507a){var _0x5eac0f=![];_0x5cfe94['result']=!![];var _0x398b67=_[_0x35fc('0x11')](_0x5cfe94);var _0x53b898=_[_0x35fc('0x11')](_0x5cfe94);var _0x227a49=this[_0x35fc('0x7')];var _0x480851=[];var _0x26ba54=this[_0x35fc('0x5')];(function FnRuleLoop(_0x553677){var _0x41e165={'rules':function(){return _0x227a49;},'rule':function(){return _0x227a49[_0x553677];},'when':function(_0x363e47){if(_0x363e47){var _0x2e513b=_0x227a49[_0x553677]['consequence'];_0x2e513b[_0x35fc('0x12')]=_0x227a49[_0x553677]['id']||_0x227a49[_0x553677][_0x35fc('0x13')]||_0x35fc('0x14')+_0x553677;process['nextTick'](function(){_0x480851[_0x35fc('0x15')](_0x2e513b[_0x35fc('0x12')]);_0x2e513b[_0x35fc('0x16')](_0x398b67,_0x41e165);});}else{process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x18')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x5eac0f=!![];return FnRuleLoop(0x0);},'next':function(_0x21f1a9){if(!_0x26ba54&&!_[_0x35fc('0x19')](_0x53b898,_0x398b67)){_0x53b898=_[_0x35fc('0x11')](_0x398b67);process[_0x35fc('0x17')](function(){_0x41e165[_0x35fc('0x1a')]();});}else{process['nextTick'](function(){if(_[_0x35fc('0x4')](_0x21f1a9)){return FnRuleLoop(_0x553677+0x1);}else{return FnRuleLoop(_0x21f1a9);}});}}};if(_0x553677<_0x227a49[_0x35fc('0x1b')]&&_0x5eac0f===![]){var _0x257719=_0x227a49[_0x553677][_0x35fc('0x1c')];_0x257719[_0x35fc('0x16')](_0x398b67,_0x41e165);}else{process['nextTick'](function(){_0x398b67[_0x35fc('0x1d')]=_0x480851;return _0x59507a?_0x59507a(_0x398b67):_[_0x35fc('0x1e')]();});}}(0x0));};RuleEngine['prototype'][_0x35fc('0x1f')]=function(_0x5a93df){if(_[_0x35fc('0x4')](_0x5a93df)){return this['rules'];}else{var _0x4086e9=_['matches'](_0x5a93df);return _[_0x35fc('0x20')](this[_0x35fc('0xb')],_0x4086e9);}};RuleEngine['prototype']['turn']=function(_0x47774c,_0x58edb6){var _0x274208=_0x47774c==='on'||_0x47774c==='ON'?!![]:![];var _0x1a5d92=this['findRules'](_0x58edb6);for(var _0x26b7cb=0x0,_0x645eac=_0x1a5d92[_0x35fc('0x1b')];_0x26b7cb<_0x645eac;_0x26b7cb+=0x1){_0x1a5d92[_0x26b7cb]['on']=_0x274208;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x21')]=function(_0x11ccdb,_0x451f0c){_0x11ccdb=parseInt(_0x11ccdb,0xa);var _0x54aedc=this[_0x35fc('0x1f')](_0x451f0c);for(var _0x220931=0x0,_0x22af18=_0x54aedc['length'];_0x220931<_0x22af18;_0x220931+=0x1){_0x54aedc[_0x220931][_0x35fc('0x22')]=_0x11ccdb;}this[_0x35fc('0xd')]();};RuleEngine[_0x35fc('0x8')][_0x35fc('0x23')]=function(){var _0xd8a4ca=this[_0x35fc('0xb')];if(_0xd8a4ca instanceof Array){_0xd8a4ca=_0xd8a4ca[_0x35fc('0x24')](function(_0x37b435){_0x37b435[_0x35fc('0x1c')]=_0x37b435[_0x35fc('0x1c')]['toString']();_0x37b435['consequence']=_0x37b435[_0x35fc('0x25')]['toString']();return _0x37b435;});}else if(!_[_0x35fc('0x4')](_0xd8a4ca)){_0xd8a4ca[_0x35fc('0x1c')]=_0xd8a4ca[_0x35fc('0x1c')][_0x35fc('0x26')]();_0xd8a4ca[_0x35fc('0x25')]=_0xd8a4ca[_0x35fc('0x25')]['toString']();}return _0xd8a4ca;};RuleEngine[_0x35fc('0x8')][_0x35fc('0x27')]=function(_0x46b9ef){this[_0x35fc('0x3')]();if(_[_0x35fc('0x28')](_0x46b9ef)){_0x46b9ef=JSON[_0x35fc('0x29')](_0x46b9ef);}if(_0x46b9ef instanceof Array){_0x46b9ef=_0x46b9ef['map'](function(_0x2483be){_0x2483be[_0x35fc('0x1c')]=eval('('+_0x2483be[_0x35fc('0x1c')]+')');_0x2483be['consequence']=eval('('+_0x2483be[_0x35fc('0x25')]+')');return _0x2483be;});}else if(_0x46b9ef!==null&&typeof _0x46b9ef=='object'){_0x46b9ef[_0x35fc('0x1c')]=eval('('+_0x46b9ef[_0x35fc('0x1c')]+')');_0x46b9ef[_0x35fc('0x25')]=eval('('+_0x46b9ef[_0x35fc('0x25')]+')');}this['register'](_0x46b9ef);};module['exports']=RuleEngine; \ No newline at end of file +var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x542a5d,_0x27e6c8){var _0x251378=function(_0x295247){while(--_0x295247){_0x542a5d['push'](_0x542a5d['shift']());}};_0x251378(++_0x27e6c8);}(_0x326f,0xd1));var _0xf326=function(_0x1d6f10,_0xafed65){_0x1d6f10=_0x1d6f10-0x0;var _0xb7e89e=_0x326f[_0x1d6f10];return _0xb7e89e;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 3b1a448..2ae7396 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 _0xb3c9=['error','message','result','sendMailMessage','SendMail','jayson/promise','client','http','request','then'];(function(_0x5c50f7,_0x312a25){var _0x41aa2d=function(_0x239e67){while(--_0x239e67){_0x5c50f7['push'](_0x5c50f7['shift']());}};_0x41aa2d(++_0x312a25);}(_0xb3c9,0x1c7));var _0x9b3c=function(_0x3763a1,_0x5f1e2b){_0x3763a1=_0x3763a1-0x0;var _0x38c606=_0xb3c9[_0x3763a1];return _0x38c606;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x9b3c('0x0'));var client=jayson[_0x9b3c('0x1')][_0x9b3c('0x2')]({'port':0x232b});function request(_0x342faf,_0xcc2b82){return new BPromise(function(_0x5ee2b2,_0x319457){return client[_0x9b3c('0x3')](_0x342faf,_0xcc2b82)[_0x9b3c('0x4')](function(_0x27e674){if(_0x27e674['error']){return _0x319457(_0x27e674[_0x9b3c('0x5')][_0x9b3c('0x6')]);}else{return _0x5ee2b2(_0x27e674[_0x9b3c('0x7')]);}})['catch'](function(_0x158ca5){return _0x319457(_0x158ca5);});});}exports[_0x9b3c('0x8')]=function(_0x2d7471,_0x310631){return request(_0x9b3c('0x9'),{'account':_0x2d7471,'message':_0x310631});}; \ No newline at end of file +var _0x3358=['catch','sendMailMessage','bluebird','jayson/promise','client','then','error','message','result'];(function(_0x109c85,_0x15caa5){var _0x1ef372=function(_0x4be9f4){while(--_0x4be9f4){_0x109c85['push'](_0x109c85['shift']());}};_0x1ef372(++_0x15caa5);}(_0x3358,0x1bb));var _0x8335=function(_0x4ea0d7,_0x2a1ae6){_0x4ea0d7=_0x4ea0d7-0x0;var _0x4c9744=_0x3358[_0x4ea0d7];return _0x4c9744;};'use strict';var BPromise=require(_0x8335('0x0'));var jayson=require(_0x8335('0x1'));var client=jayson[_0x8335('0x2')]['http']({'port':0x232b});function request(_0x24238f,_0x5bef07){return new BPromise(function(_0x2a84c6,_0x248543){return client['request'](_0x24238f,_0x5bef07)[_0x8335('0x3')](function(_0x5061ae){if(_0x5061ae[_0x8335('0x4')]){return _0x248543(_0x5061ae[_0x8335('0x4')][_0x8335('0x5')]);}else{return _0x2a84c6(_0x5061ae[_0x8335('0x6')]);}})[_0x8335('0x7')](function(_0x51ab0b){return _0x248543(_0x51ab0b);});});}exports[_0x8335('0x8')]=function(_0x578ef0,_0x2349b3){return request('SendMail',{'account':_0x578ef0,'message':_0x2349b3});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 72d3e74..d025643 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 _0xbf06=['chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','busy','updateRealtime','getChannelStatus','Capacity','CurrentCapacity','working','idle','prototype','sms','whatsapp','length','toNumber','format','openchannelPause','mailCapacity','mailCurrentCapacity','faxStatus','smsStatusTime','whatsappStatus','openchannelStatusTime','busyQueue','user:save','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','name','online','voicePause','chatPause','mailPause','faxPause','smsPause'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbf06,0x101));var _0x6bf0=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xbf06[_0x166d93];return _0xba708;};'use strict';var _=require('lodash');var moment=require(_0x6bf0('0x0'));var md5=require(_0x6bf0('0x1'));var Redis=require(_0x6bf0('0x2'));var config=require(_0x6bf0('0x3'));config[_0x6bf0('0x4')]=_[_0x6bf0('0x5')](config[_0x6bf0('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6bf0('0x4')]));function Agent(_0x1d9a84){this['id']=_0x1d9a84['id']||0x0;this[_0x6bf0('0x6')]=_0x1d9a84[_0x6bf0('0x6')]||'';this['online']=_0x1d9a84[_0x6bf0('0x7')]||!![];this[_0x6bf0('0x8')]=_0x1d9a84[_0x6bf0('0x8')]||![];this[_0x6bf0('0x9')]=_0x1d9a84[_0x6bf0('0x9')]||![];this['mailPause']=_0x1d9a84[_0x6bf0('0xa')]||![];this[_0x6bf0('0xb')]=_0x1d9a84[_0x6bf0('0xb')]||![];this[_0x6bf0('0xc')]=_0x1d9a84[_0x6bf0('0xc')]||![];this['openchannelPause']=_0x1d9a84['openchannelPause']||![];this[_0x6bf0('0xd')]=_0x6bf0('0xe');this[_0x6bf0('0xf')]=0x0;this[_0x6bf0('0x10')]=_0x1d9a84[_0x6bf0('0x10')]||0x0;this[_0x6bf0('0x11')]=0x0;this[_0x6bf0('0x12')]=_0x6bf0('0xe');this[_0x6bf0('0x13')]=0x0;this['mailCapacity']=_0x1d9a84['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0x6bf0('0xe');this[_0x6bf0('0x14')]=0x0;this[_0x6bf0('0x15')]=_0x1d9a84[_0x6bf0('0x15')]||0x0;this[_0x6bf0('0x16')]=0x0;this[_0x6bf0('0x17')]=_0x6bf0('0xe');this['smsStatusTime']=0x0;this[_0x6bf0('0x18')]=_0x1d9a84[_0x6bf0('0x18')]||0x0;this[_0x6bf0('0x19')]=0x0;this['whatsappStatus']='unknown';this[_0x6bf0('0x1a')]=0x0;this[_0x6bf0('0x1b')]=_0x1d9a84[_0x6bf0('0x1b')]||0x0;this[_0x6bf0('0x1c')]=0x0;this[_0x6bf0('0x1d')]=_0x6bf0('0xe');this['openchannelStatusTime']=0x0;this[_0x6bf0('0x1e')]=_0x1d9a84[_0x6bf0('0x1e')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x6bf0('0x1f')]=![];this['busyQueue']=undefined;this[_0x6bf0('0x1')]='';this[_0x6bf0('0x20')]();}Agent['prototype'][_0x6bf0('0x21')]=function(_0x4767bd){if(this[_0x4767bd+'CurrentCapacity']>0x0){if(this[_0x4767bd+_0x6bf0('0x22')]>0x0&&this[_0x4767bd+_0x6bf0('0x23')]>=this[_0x4767bd+_0x6bf0('0x22')]){return'maxcapacity';}else{return _0x6bf0('0x24');}}else{return _0x6bf0('0x25');}};Agent[_0x6bf0('0x26')][_0x6bf0('0x20')]=function(){var _0x204bab=['mail','chat','openchannel','fax',_0x6bf0('0x27'),_0x6bf0('0x28')];for(var _0x20111e=0x0;_0x20111e<_0x204bab[_0x6bf0('0x29')];_0x20111e+=0x1){var _0x306b8a=this[_0x6bf0('0x21')](_0x204bab[_0x20111e]);if(this[_0x204bab[_0x20111e]+'Status']!==_0x306b8a){this[_0x204bab[_0x20111e]+'StatusTime']=_[_0x6bf0('0x2a')](moment()[_0x6bf0('0x2b')]('x'));}this[_0x204bab[_0x20111e]+'Status']=_0x306b8a;}var _0x220c3a={'id':this['id'],'name':this[_0x6bf0('0x6')],'online':this[_0x6bf0('0x7')],'voicePause':this[_0x6bf0('0x8')],'chatPause':this['chatPause'],'mailPause':this[_0x6bf0('0xa')],'smsPause':this[_0x6bf0('0xc')],'faxPause':this[_0x6bf0('0xb')],'openchannelPause':this[_0x6bf0('0x2c')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x6bf0('0xf')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x6bf0('0x11')],'mailStatus':this[_0x6bf0('0x12')],'mailStatusTime':this[_0x6bf0('0x13')],'mailCapacity':this[_0x6bf0('0x2d')],'mailCurrentCapacity':this[_0x6bf0('0x2e')],'faxStatus':this[_0x6bf0('0x2f')],'faxStatusTime':this[_0x6bf0('0x14')],'faxCapacity':this[_0x6bf0('0x15')],'faxCurrentCapacity':this[_0x6bf0('0x16')],'smsStatus':this[_0x6bf0('0x17')],'smsStatusTime':this[_0x6bf0('0x30')],'smsCapacity':this[_0x6bf0('0x18')],'smsCurrentCapacity':this[_0x6bf0('0x19')],'whatsappStatus':this[_0x6bf0('0x31')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x6bf0('0x1b')],'whatsappCurrentCapacity':this[_0x6bf0('0x1c')],'openchannelStatus':this[_0x6bf0('0x1d')],'openchannelStatusTime':this[_0x6bf0('0x32')],'openchannelCapacity':this[_0x6bf0('0x1e')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x6bf0('0x33')]};var _0xf5aea2=md5(JSON['stringify'](_0x220c3a));if(this[_0x6bf0('0x1')]!==_0xf5aea2){this[_0x6bf0('0x1')]=_0xf5aea2;io['emit'](_0x6bf0('0x34'),_0x220c3a);}};module[_0x6bf0('0x35')]=Agent; \ No newline at end of file +var _0x9256=['localhost','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','md5','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','openchannel','whatsapp','length','StatusTime','toNumber','Status','chatStatusTime','mailCurrentCapacity','faxStatus','faxCurrentCapacity','whatsappStatus','whatsappStatusTime','busy','stringify','emit','user:save','exports','lodash','../../../config/environment','redis'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0x9256,0xa8));var _0x6925=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x9256[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6925('0x0'));var moment=require('moment');var md5=require('md5');var Redis=require('ioredis');var config=require(_0x6925('0x1'));config['redis']=_['defaults'](config[_0x6925('0x2')],{'host':_0x6925('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6925('0x2')]));function Agent(_0x4b859d){this['id']=_0x4b859d['id']||0x0;this[_0x6925('0x4')]=_0x4b859d[_0x6925('0x4')]||'';this['online']=_0x4b859d['online']||!![];this[_0x6925('0x5')]=_0x4b859d['voicePause']||![];this[_0x6925('0x6')]=_0x4b859d[_0x6925('0x6')]||![];this[_0x6925('0x7')]=_0x4b859d[_0x6925('0x7')]||![];this[_0x6925('0x8')]=_0x4b859d[_0x6925('0x8')]||![];this[_0x6925('0x9')]=_0x4b859d[_0x6925('0x9')]||![];this['openchannelPause']=_0x4b859d[_0x6925('0xa')]||![];this[_0x6925('0xb')]=_0x6925('0xc');this['chatStatusTime']=0x0;this['chatCapacity']=_0x4b859d[_0x6925('0xd')]||0x0;this[_0x6925('0xe')]=0x0;this[_0x6925('0xf')]=_0x6925('0xc');this['mailStatusTime']=0x0;this[_0x6925('0x10')]=_0x4b859d[_0x6925('0x10')]||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']=_0x6925('0xc');this[_0x6925('0x11')]=0x0;this[_0x6925('0x12')]=_0x4b859d[_0x6925('0x12')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x6925('0x13')]=_0x6925('0xc');this[_0x6925('0x14')]=0x0;this[_0x6925('0x15')]=_0x4b859d[_0x6925('0x15')]||0x0;this[_0x6925('0x16')]=0x0;this['whatsappStatus']=_0x6925('0xc');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x4b859d[_0x6925('0x17')]||0x0;this[_0x6925('0x18')]=0x0;this[_0x6925('0x19')]=_0x6925('0xc');this[_0x6925('0x1a')]=0x0;this['openchannelCapacity']=_0x4b859d[_0x6925('0x1b')]||0x0;this[_0x6925('0x1c')]=0x0;this['busy']=![];this[_0x6925('0x1d')]=undefined;this[_0x6925('0x1e')]='';this[_0x6925('0x1f')]();}Agent[_0x6925('0x20')][_0x6925('0x21')]=function(_0x578640){if(this[_0x578640+_0x6925('0x22')]>0x0){if(this[_0x578640+_0x6925('0x23')]>0x0&&this[_0x578640+_0x6925('0x22')]>=this[_0x578640+_0x6925('0x23')]){return _0x6925('0x24');}else{return _0x6925('0x25');}}else{return _0x6925('0x26');}};Agent[_0x6925('0x20')][_0x6925('0x1f')]=function(){var _0x1498d9=[_0x6925('0x27'),'chat',_0x6925('0x28'),'fax','sms',_0x6925('0x29')];for(var _0x528059=0x0;_0x528059<_0x1498d9[_0x6925('0x2a')];_0x528059+=0x1){var _0x255ae3=this['getChannelStatus'](_0x1498d9[_0x528059]);if(this[_0x1498d9[_0x528059]+'Status']!==_0x255ae3){this[_0x1498d9[_0x528059]+_0x6925('0x2b')]=_[_0x6925('0x2c')](moment()['format']('x'));}this[_0x1498d9[_0x528059]+_0x6925('0x2d')]=_0x255ae3;}var _0x3b2e55={'id':this['id'],'name':this[_0x6925('0x4')],'online':this['online'],'voicePause':this[_0x6925('0x5')],'chatPause':this[_0x6925('0x6')],'mailPause':this['mailPause'],'smsPause':this[_0x6925('0x9')],'faxPause':this[_0x6925('0x8')],'openchannelPause':this[_0x6925('0xa')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0x6925('0x2e')],'chatCapacity':this[_0x6925('0xd')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x6925('0xf')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x6925('0x10')],'mailCurrentCapacity':this[_0x6925('0x2f')],'faxStatus':this[_0x6925('0x30')],'faxStatusTime':this[_0x6925('0x11')],'faxCapacity':this[_0x6925('0x12')],'faxCurrentCapacity':this[_0x6925('0x31')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x6925('0x14')],'smsCapacity':this[_0x6925('0x15')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x6925('0x32')],'whatsappStatusTime':this[_0x6925('0x33')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x6925('0x19')],'openchannelStatusTime':this[_0x6925('0x1a')],'openchannelCapacity':this[_0x6925('0x1b')],'openchannelCurrentCapacity':this[_0x6925('0x1c')],'busy':this[_0x6925('0x34')],'busyQueue':this[_0x6925('0x1d')]};var _0x5123ae=md5(JSON[_0x6925('0x35')](_0x3b2e55));if(this[_0x6925('0x1e')]!==_0x5123ae){this[_0x6925('0x1e')]=_0x5123ae;io[_0x6925('0x36')](_0x6925('0x37'),_0x3b2e55);}};module[_0x6925('0x38')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 7f04732..c7a74cf 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 _0xdf9b=['mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','loggedIn','paused','length','online','chatPause','available','format','emit','chat_queue:save','lodash','ioredis','redis','localhost','name','timeout','strategy','beepall','Agents'];(function(_0x5e4b51,_0x2cdf31){var _0x28a1e4=function(_0x35cf2a){while(--_0x35cf2a){_0x5e4b51['push'](_0x5e4b51['shift']());}};_0x28a1e4(++_0x2cdf31);}(_0xdf9b,0x1cb));var _0xbdf9=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xdf9b[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xbdf9('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xbdf9('0x1'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xbdf9('0x2')],{'host':_0xbdf9('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbdf9('0x2')]));function ChatQueue(_0x37938e){this['id']=_0x37938e['id']||0x0;this['name']=_0x37938e[_0xbdf9('0x4')]||'';this[_0xbdf9('0x5')]=_0x37938e['timeout']||0xa;this[_0xbdf9('0x6')]=_0x37938e[_0xbdf9('0x6')]||_0xbdf9('0x7');this[_0xbdf9('0x8')]=_0x37938e['Agents'];this[_0xbdf9('0x9')]={};this[_0xbdf9('0xa')]=0x0;this[_0xbdf9('0xb')]='';this['updateRouting']();this['updateRealtime']();}ChatQueue[_0xbdf9('0xc')][_0xbdf9('0xd')]=function(){var _0x146928=this[_0xbdf9('0x9')][_0xbdf9('0xe')];this[_0xbdf9('0x9')]=_[_0xbdf9('0xf')](this[_0xbdf9('0x8')],'id');this[_0xbdf9('0x9')][_0xbdf9('0xe')]=_0x146928;};ChatQueue[_0xbdf9('0xc')][_0xbdf9('0x10')]=function(){this[_0xbdf9('0x11')]=0x0;this[_0xbdf9('0x12')]=0x0;for(var _0x3603d5=0x0;_0x3603d5=0x0?this[_0xbdf9('0x16')]:0x0;var _0xbd2a6={'id':this['id'],'available':this[_0xbdf9('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xbdf9('0x4')],'paused':this[_0xbdf9('0x12')],'waiting':this[_0xbdf9('0xa')]};var _0x3e351f=md5(JSON['stringify'](_0xbd2a6));if(this[_0xbdf9('0xb')]!==_0x3e351f){this['md5']=_0x3e351f;io['to'](util[_0xbdf9('0x17')]('chat:queue:%s',_0xbd2a6[_0xbdf9('0x4')]))[_0xbdf9('0x18')](_0xbdf9('0x19'),_0xbd2a6);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x6c3d=['util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','chatPause','available','stringify','format','emit','exports','md5'];(function(_0x1bad26,_0xf6f79f){var _0x23b581=function(_0x4040c9){while(--_0x4040c9){_0x1bad26['push'](_0x1bad26['shift']());}};_0x23b581(++_0xf6f79f);}(_0x6c3d,0xb5));var _0xd6c3=function(_0x342f27,_0x180560){_0x342f27=_0x342f27-0x0;var _0x57d103=_0x6c3d[_0x342f27];return _0x57d103;};'use strict';var _=require('lodash');var md5=require(_0xd6c3('0x0'));var util=require(_0xd6c3('0x1'));var Redis=require(_0xd6c3('0x2'));var config=require(_0xd6c3('0x3'));config[_0xd6c3('0x4')]=_['defaults'](config[_0xd6c3('0x4')],{'host':_0xd6c3('0x5'),'port':0x18eb});var io=require(_0xd6c3('0x6'))(new Redis(config[_0xd6c3('0x4')]));function ChatQueue(_0x1b5e72){this['id']=_0x1b5e72['id']||0x0;this[_0xd6c3('0x7')]=_0x1b5e72[_0xd6c3('0x7')]||'';this[_0xd6c3('0x8')]=_0x1b5e72['timeout']||0xa;this['strategy']=_0x1b5e72['strategy']||_0xd6c3('0x9');this[_0xd6c3('0xa')]=_0x1b5e72[_0xd6c3('0xa')];this[_0xd6c3('0xb')]={};this[_0xd6c3('0xc')]=0x0;this['md5']='';this[_0xd6c3('0xd')]();this[_0xd6c3('0xe')]();}ChatQueue[_0xd6c3('0xf')][_0xd6c3('0xd')]=function(){var _0x37692f=this[_0xd6c3('0xb')][_0xd6c3('0x10')];this['mapAgentsId']=_['map'](this[_0xd6c3('0xa')],'id');this[_0xd6c3('0xb')][_0xd6c3('0x10')]=_0x37692f;};ChatQueue['prototype'][_0xd6c3('0xe')]=function(){this[_0xd6c3('0x11')]=0x0;this[_0xd6c3('0x12')]=0x0;for(var _0x3ac78f=0x0;_0x3ac78f=0x0?this[_0xd6c3('0x15')]:0x0;var _0x209f38={'id':this['id'],'available':this[_0xd6c3('0x15')],'loggedIn':this[_0xd6c3('0x11')],'name':this[_0xd6c3('0x7')],'paused':this[_0xd6c3('0x12')],'waiting':this['waiting']};var _0x3a745c=md5(JSON[_0xd6c3('0x16')](_0x209f38));if(this[_0xd6c3('0x0')]!==_0x3a745c){this[_0xd6c3('0x0')]=_0x3a745c;io['to'](util[_0xd6c3('0x17')]('chat:queue:%s',_0x209f38['name']))[_0xd6c3('0x18')]('chat_queue:save',_0x209f38);}};module[_0xd6c3('0x19')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index aa8f053..ce6dc54 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 _0x1667=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','loggedIn','paused','faxPause','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x1667,0x149));var _0x7166=function(_0x680821,_0x23e67f){_0x680821=_0x680821-0x0;var _0x3f132c=_0x1667[_0x680821];return _0x3f132c;};'use strict';var _=require(_0x7166('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x7166('0x1'));var config=require(_0x7166('0x2'));config[_0x7166('0x3')]=_['defaults'](config[_0x7166('0x3')],{'host':_0x7166('0x4'),'port':0x18eb});var io=require(_0x7166('0x5'))(new Redis(config[_0x7166('0x3')]));function FaxQueue(_0x1d33fa){this['id']=_0x1d33fa['id']||0x0;this['name']=_0x1d33fa[_0x7166('0x6')]||'';this['timeout']=_0x1d33fa[_0x7166('0x7')]||0xa;this[_0x7166('0x8')]=_0x1d33fa['strategy']||_0x7166('0x9');this[_0x7166('0xa')]=_0x1d33fa[_0x7166('0xa')];this[_0x7166('0xb')]={};this[_0x7166('0xc')]=0x0;this[_0x7166('0xd')]='';this['updateRouting']();this[_0x7166('0xe')]();}FaxQueue[_0x7166('0xf')][_0x7166('0x10')]=function(){var _0xd62358=this['mapAgentsId'][_0x7166('0x11')];this['mapAgentsId']=_['map'](this[_0x7166('0xa')],'id');this[_0x7166('0xb')][_0x7166('0x11')]=_0xd62358;};FaxQueue[_0x7166('0xf')][_0x7166('0xe')]=function(){this[_0x7166('0x12')]=0x0;this[_0x7166('0x13')]=0x0;for(var _0x39852c=0x0;_0x39852c=0x0?this[_0x7166('0x15')]:0x0;var _0x76a6fc={'id':this['id'],'available':this[_0x7166('0x15')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x7166('0xc')]};var _0x4da989=md5(JSON[_0x7166('0x16')](_0x76a6fc));if(this[_0x7166('0xd')]!==_0x4da989){this[_0x7166('0xd')]=_0x4da989;io['to'](util[_0x7166('0x17')](_0x7166('0x18'),_0x76a6fc[_0x7166('0x6')]))[_0x7166('0x19')](_0x7166('0x1a'),_0x76a6fc);}};module[_0x7166('0x1b')]=FaxQueue; \ No newline at end of file +var _0x1b7a=['prototype','_rr','map','updateRealtime','loggedIn','paused','length','faxPause','available','stringify','format','emit','fax_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting'];(function(_0x445e28,_0x174e80){var _0x3aee5a=function(_0x42a89b){while(--_0x42a89b){_0x445e28['push'](_0x445e28['shift']());}};_0x3aee5a(++_0x174e80);}(_0x1b7a,0xc8));var _0xa1b7=function(_0x543451,_0x4684b7){_0x543451=_0x543451-0x0;var _0x15e8cb=_0x1b7a[_0x543451];return _0x15e8cb;};'use strict';var _=require(_0xa1b7('0x0'));var md5=require('md5');var util=require(_0xa1b7('0x1'));var Redis=require(_0xa1b7('0x2'));var config=require(_0xa1b7('0x3'));config[_0xa1b7('0x4')]=_[_0xa1b7('0x5')](config[_0xa1b7('0x4')],{'host':_0xa1b7('0x6'),'port':0x18eb});var io=require(_0xa1b7('0x7'))(new Redis(config['redis']));function FaxQueue(_0x584d04){this['id']=_0x584d04['id']||0x0;this[_0xa1b7('0x8')]=_0x584d04[_0xa1b7('0x8')]||'';this['timeout']=_0x584d04[_0xa1b7('0x9')]||0xa;this[_0xa1b7('0xa')]=_0x584d04['strategy']||_0xa1b7('0xb');this[_0xa1b7('0xc')]=_0x584d04[_0xa1b7('0xc')];this[_0xa1b7('0xd')]={};this[_0xa1b7('0xe')]=0x0;this[_0xa1b7('0xf')]='';this[_0xa1b7('0x10')]();this['updateRealtime']();}FaxQueue[_0xa1b7('0x11')][_0xa1b7('0x10')]=function(){var _0x42d723=this[_0xa1b7('0xd')][_0xa1b7('0x12')];this[_0xa1b7('0xd')]=_[_0xa1b7('0x13')](this[_0xa1b7('0xc')],'id');this[_0xa1b7('0xd')][_0xa1b7('0x12')]=_0x42d723;};FaxQueue['prototype'][_0xa1b7('0x14')]=function(){this[_0xa1b7('0x15')]=0x0;this[_0xa1b7('0x16')]=0x0;for(var _0x5cd75a=0x0;_0x5cd75a=0x0?this[_0xa1b7('0x19')]:0x0;var _0x252bf9={'id':this['id'],'available':this[_0xa1b7('0x19')],'loggedIn':this[_0xa1b7('0x15')],'name':this[_0xa1b7('0x8')],'paused':this['paused'],'waiting':this[_0xa1b7('0xe')]};var _0x254f10=md5(JSON[_0xa1b7('0x1a')](_0x252bf9));if(this[_0xa1b7('0xf')]!==_0x254f10){this[_0xa1b7('0xf')]=_0x254f10;io['to'](util[_0xa1b7('0x1b')]('fax:queue:%s',_0x252bf9[_0xa1b7('0x8')]))[_0xa1b7('0x1c')](_0xa1b7('0x1d'),_0x252bf9);}};module[_0xa1b7('0x1e')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index d1fc555..68b9e67 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 _0x5276=['Intervals','exports','name'];(function(_0x2a7211,_0x1821be){var _0x6eda40=function(_0x4491d2){while(--_0x4491d2){_0x2a7211['push'](_0x2a7211['shift']());}};_0x6eda40(++_0x1821be);}(_0x5276,0xc8));var _0x6527=function(_0x74eb58,_0x58f2d4){_0x74eb58=_0x74eb58-0x0;var _0x28e469=_0x5276[_0x74eb58];return _0x28e469;};'use strict';function Interval(_0x232c0e){this['id']=_0x232c0e['id']||0x0;this[_0x6527('0x0')]=_0x232c0e[_0x6527('0x0')]||'';this[_0x6527('0x1')]=_0x232c0e[_0x6527('0x1')]||{};}module[_0x6527('0x2')]=Interval; \ No newline at end of file +var _0xaa8a=['Intervals','exports'];(function(_0x556ced,_0x426bd5){var _0x1ba0e8=function(_0x4739ae){while(--_0x4739ae){_0x556ced['push'](_0x556ced['shift']());}};_0x1ba0e8(++_0x426bd5);}(_0xaa8a,0x112));var _0xaaa8=function(_0xc77819,_0x139fdc){_0xc77819=_0xc77819-0x0;var _0x1c9434=_0xaa8a[_0xc77819];return _0x1c9434;};'use strict';function Interval(_0x180068){this['id']=_0x180068['id']||0x0;this['name']=_0x180068['name']||'';this[_0xaaa8('0x0')]=_0x180068['Intervals']||{};}module[_0xaaa8('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 fbd6996..f4d3285 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 _0x7d44=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','mailPause','available','mail:queue:%s','emit','mail_queue:save','exports','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name'];(function(_0x50ffd4,_0x49445a){var _0xec696e=function(_0x58d4eb){while(--_0x58d4eb){_0x50ffd4['push'](_0x50ffd4['shift']());}};_0xec696e(++_0x49445a);}(_0x7d44,0xed));var _0x47d4=function(_0x1ec744,_0x3444a4){_0x1ec744=_0x1ec744-0x0;var _0x370924=_0x7d44[_0x1ec744];return _0x370924;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require('ioredis');var config=require(_0x47d4('0x0'));config['redis']=_[_0x47d4('0x1')](config[_0x47d4('0x2')],{'host':_0x47d4('0x3'),'port':0x18eb});var io=require(_0x47d4('0x4'))(new Redis(config[_0x47d4('0x2')]));function MailQueue(_0x301c2f){this['id']=_0x301c2f['id']||0x0;this['name']=_0x301c2f[_0x47d4('0x5')]||'';this[_0x47d4('0x6')]=_0x301c2f['timeout']||0xa;this[_0x47d4('0x7')]=_0x301c2f[_0x47d4('0x7')]||_0x47d4('0x8');this[_0x47d4('0x9')]=_0x301c2f['Agents'];this[_0x47d4('0xa')]={};this[_0x47d4('0xb')]=0x0;this[_0x47d4('0xc')]='';this[_0x47d4('0xd')]();this[_0x47d4('0xe')]();}MailQueue[_0x47d4('0xf')]['updateRouting']=function(){var _0x2fb056=this['mapAgentsId'][_0x47d4('0x10')];this[_0x47d4('0xa')]=_[_0x47d4('0x11')](this['Agents'],'id');this[_0x47d4('0xa')]['_rr']=_0x2fb056;};MailQueue[_0x47d4('0xf')][_0x47d4('0xe')]=function(){this[_0x47d4('0x12')]=0x0;this[_0x47d4('0x13')]=0x0;for(var _0x824f80=0x0;_0x824f80=0x0?this[_0x47d4('0x16')]:0x0;var _0x481344={'id':this['id'],'available':this[_0x47d4('0x16')],'loggedIn':this[_0x47d4('0x12')],'name':this[_0x47d4('0x5')],'paused':this[_0x47d4('0x13')],'waiting':this[_0x47d4('0xb')]};var _0xb5a0ba=md5(JSON['stringify'](_0x481344));if(this['md5']!==_0xb5a0ba){this[_0x47d4('0xc')]=_0xb5a0ba;io['to'](util['format'](_0x47d4('0x17'),_0x481344[_0x47d4('0x5')]))[_0x47d4('0x18')](_0x47d4('0x19'),_0x481344);}};module[_0x47d4('0x1a')]=MailQueue; \ No newline at end of file +var _0x59e6=['exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','online','mailPause','available','stringify','format','emit','mail_queue:save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x59e6,0x7d));var _0x659e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x59e6[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x659e('0x0'));var md5=require(_0x659e('0x1'));var util=require(_0x659e('0x2'));var Redis=require(_0x659e('0x3'));var config=require(_0x659e('0x4'));config[_0x659e('0x5')]=_[_0x659e('0x6')](config[_0x659e('0x5')],{'host':_0x659e('0x7'),'port':0x18eb});var io=require(_0x659e('0x8'))(new Redis(config[_0x659e('0x5')]));function MailQueue(_0x39b18b){this['id']=_0x39b18b['id']||0x0;this[_0x659e('0x9')]=_0x39b18b[_0x659e('0x9')]||'';this[_0x659e('0xa')]=_0x39b18b[_0x659e('0xa')]||0xa;this[_0x659e('0xb')]=_0x39b18b[_0x659e('0xb')]||_0x659e('0xc');this[_0x659e('0xd')]=_0x39b18b[_0x659e('0xd')];this[_0x659e('0xe')]={};this[_0x659e('0xf')]=0x0;this[_0x659e('0x1')]='';this['updateRouting']();this[_0x659e('0x10')]();}MailQueue[_0x659e('0x11')][_0x659e('0x12')]=function(){var _0x5e3af5=this[_0x659e('0xe')][_0x659e('0x13')];this[_0x659e('0xe')]=_[_0x659e('0x14')](this[_0x659e('0xd')],'id');this[_0x659e('0xe')][_0x659e('0x13')]=_0x5e3af5;};MailQueue[_0x659e('0x11')][_0x659e('0x10')]=function(){this[_0x659e('0x15')]=0x0;this[_0x659e('0x16')]=0x0;for(var _0x373f96=0x0;_0x373f96=0x0?this['available']:0x0;var _0x2c9b60={'id':this['id'],'available':this[_0x659e('0x19')],'loggedIn':this['loggedIn'],'name':this[_0x659e('0x9')],'paused':this[_0x659e('0x16')],'waiting':this['waiting']};var _0x3d309e=md5(JSON[_0x659e('0x1a')](_0x2c9b60));if(this[_0x659e('0x1')]!==_0x3d309e){this[_0x659e('0x1')]=_0x3d309e;io['to'](util[_0x659e('0x1b')]('mail:queue:%s',_0x2c9b60[_0x659e('0x9')]))[_0x659e('0x1c')](_0x659e('0x1d'),_0x2c9b60);}};module[_0x659e('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 1292beb..ccee300 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x326f,0xd1));var _0xf326=function(_0x48b260,_0x619297){_0x48b260=_0x48b260-0x0;var _0x1f32a0=_0x326f[_0x48b260];return _0x1f32a0;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 43d1bf7..1fe2498 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 _0x44ae=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','smsPause','available','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents'];(function(_0x2966da,_0x5c8c85){var _0x4d734b=function(_0x4e81f6){while(--_0x4e81f6){_0x2966da['push'](_0x2966da['shift']());}};_0x4d734b(++_0x5c8c85);}(_0x44ae,0x17d));var _0xe44a=function(_0x52c617,_0x285a92){_0x52c617=_0x52c617-0x0;var _0xc6e1f2=_0x44ae[_0x52c617];return _0xc6e1f2;};'use strict';var _=require(_0xe44a('0x0'));var md5=require(_0xe44a('0x1'));var util=require(_0xe44a('0x2'));var Redis=require(_0xe44a('0x3'));var config=require('../../../config/environment');config[_0xe44a('0x4')]=_['defaults'](config[_0xe44a('0x4')],{'host':_0xe44a('0x5'),'port':0x18eb});var io=require(_0xe44a('0x6'))(new Redis(config[_0xe44a('0x4')]));function SmsQueue(_0x1a8842){this['id']=_0x1a8842['id']||0x0;this[_0xe44a('0x7')]=_0x1a8842['name']||'';this[_0xe44a('0x8')]=_0x1a8842[_0xe44a('0x8')]||0xa;this[_0xe44a('0x9')]=_0x1a8842[_0xe44a('0x9')]||'beepall';this[_0xe44a('0xa')]=_0x1a8842[_0xe44a('0xa')];this[_0xe44a('0xb')]={};this[_0xe44a('0xc')]=0x0;this['md5']='';this[_0xe44a('0xd')]();this[_0xe44a('0xe')]();}SmsQueue[_0xe44a('0xf')][_0xe44a('0xd')]=function(){var _0xe19628=this[_0xe44a('0xb')][_0xe44a('0x10')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0xe44a('0xb')][_0xe44a('0x10')]=_0xe19628;};SmsQueue[_0xe44a('0xf')]['updateRealtime']=function(){this[_0xe44a('0x11')]=0x0;this[_0xe44a('0x12')]=0x0;for(var _0x3656b2=0x0;_0x3656b2=0x0?this[_0xe44a('0x16')]:0x0;var _0x509f30={'id':this['id'],'available':this[_0xe44a('0x16')],'loggedIn':this[_0xe44a('0x11')],'name':this[_0xe44a('0x7')],'paused':this[_0xe44a('0x12')],'waiting':this[_0xe44a('0xc')]};var _0x33e9ac=md5(JSON['stringify'](_0x509f30));if(this[_0xe44a('0x1')]!==_0x33e9ac){this['md5']=_0x33e9ac;io['to'](util[_0xe44a('0x17')](_0xe44a('0x18'),_0x509f30[_0xe44a('0x7')]))[_0xe44a('0x19')](_0xe44a('0x1a'),_0x509f30);}};module[_0xe44a('0x1b')]=SmsQueue; \ No newline at end of file +var _0xa1a5=['strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','updateRealtime','paused','length','online','smsPause','available','loggedIn','stringify','format','sms:queue:%s','sms_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0xa1a5,0x1b8));var _0x5a1a=function(_0xf3953a,_0x2661ce){_0xf3953a=_0xf3953a-0x0;var _0x4159de=_0xa1a5[_0xf3953a];return _0x4159de;};'use strict';var _=require(_0x5a1a('0x0'));var md5=require('md5');var util=require(_0x5a1a('0x1'));var Redis=require(_0x5a1a('0x2'));var config=require(_0x5a1a('0x3'));config[_0x5a1a('0x4')]=_[_0x5a1a('0x5')](config['redis'],{'host':_0x5a1a('0x6'),'port':0x18eb});var io=require(_0x5a1a('0x7'))(new Redis(config[_0x5a1a('0x4')]));function SmsQueue(_0x416416){this['id']=_0x416416['id']||0x0;this[_0x5a1a('0x8')]=_0x416416[_0x5a1a('0x8')]||'';this[_0x5a1a('0x9')]=_0x416416['timeout']||0xa;this[_0x5a1a('0xa')]=_0x416416[_0x5a1a('0xa')]||_0x5a1a('0xb');this[_0x5a1a('0xc')]=_0x416416[_0x5a1a('0xc')];this[_0x5a1a('0xd')]={};this[_0x5a1a('0xe')]=0x0;this[_0x5a1a('0xf')]='';this[_0x5a1a('0x10')]();this['updateRealtime']();}SmsQueue[_0x5a1a('0x11')][_0x5a1a('0x10')]=function(){var _0x1474c2=this['mapAgentsId'][_0x5a1a('0x12')];this['mapAgentsId']=_['map'](this['Agents'],'id');this[_0x5a1a('0xd')][_0x5a1a('0x12')]=_0x1474c2;};SmsQueue[_0x5a1a('0x11')][_0x5a1a('0x13')]=function(){this['loggedIn']=0x0;this[_0x5a1a('0x14')]=0x0;for(var _0x30e2a5=0x0;_0x30e2a5=0x0?this['available']:0x0;var _0x9e7924={'id':this['id'],'available':this[_0x5a1a('0x18')],'loggedIn':this[_0x5a1a('0x19')],'name':this[_0x5a1a('0x8')],'paused':this[_0x5a1a('0x14')],'waiting':this[_0x5a1a('0xe')]};var _0x3c47e3=md5(JSON[_0x5a1a('0x1a')](_0x9e7924));if(this[_0x5a1a('0xf')]!==_0x3c47e3){this[_0x5a1a('0xf')]=_0x3c47e3;io['to'](util[_0x5a1a('0x1b')](_0x5a1a('0x1c'),_0x9e7924['name']))['emit'](_0x5a1a('0x1d'),_0x9e7924);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 80cb437..baa2796 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 _0xf140=['redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment'];(function(_0xaed4a7,_0x1000bf){var _0x3abf09=function(_0x424b8b){while(--_0x424b8b){_0xaed4a7['push'](_0xaed4a7['shift']());}};_0x3abf09(++_0x1000bf);}(_0xf140,0x1a0));var _0x0f14=function(_0x16e3dc,_0x35770a){_0x16e3dc=_0x16e3dc-0x0;var _0x2f1001=_0xf140[_0x16e3dc];return _0x2f1001;};'use strict';var _=require('lodash');var md5=require(_0x0f14('0x0'));var util=require(_0x0f14('0x1'));var Redis=require(_0x0f14('0x2'));var config=require(_0x0f14('0x3'));config[_0x0f14('0x4')]=_[_0x0f14('0x5')](config[_0x0f14('0x4')],{'host':_0x0f14('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0f14('0x4')]));function WhatsappQueue(_0x575f64){this['id']=_0x575f64['id']||0x0;this[_0x0f14('0x7')]=_0x575f64[_0x0f14('0x7')]||'';this['timeout']=_0x575f64[_0x0f14('0x8')]||0xa;this[_0x0f14('0x9')]=_0x575f64[_0x0f14('0x9')]||'beepall';this['Agents']=_0x575f64[_0x0f14('0xa')];this[_0x0f14('0xb')]={};this[_0x0f14('0xc')]=0x0;this['md5']='';this['updateRouting']();this[_0x0f14('0xd')]();}WhatsappQueue[_0x0f14('0xe')]['updateRouting']=function(){var _0x48a5df=this['mapAgentsId'][_0x0f14('0xf')];this[_0x0f14('0xb')]=_[_0x0f14('0x10')](this['Agents'],'id');this[_0x0f14('0xb')][_0x0f14('0xf')]=_0x48a5df;};WhatsappQueue[_0x0f14('0xe')][_0x0f14('0xd')]=function(){this['loggedIn']=0x0;this[_0x0f14('0x11')]=0x0;for(var _0x5d4ab3=0x0;_0x5d4ab3=0x0?this[_0x0f14('0x15')]:0x0;var _0x740817={'id':this['id'],'available':this[_0x0f14('0x15')],'loggedIn':this[_0x0f14('0x14')],'name':this[_0x0f14('0x7')],'paused':this[_0x0f14('0x11')],'waiting':this[_0x0f14('0xc')]};var _0x44fc1d=md5(JSON[_0x0f14('0x16')](_0x740817));if(this[_0x0f14('0x0')]!==_0x44fc1d){this[_0x0f14('0x0')]=_0x44fc1d;io['to'](util[_0x0f14('0x17')](_0x0f14('0x18'),_0x740817[_0x0f14('0x7')]))[_0x0f14('0x19')](_0x0f14('0x1a'),_0x740817);}};module[_0x0f14('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0xdd4f=['util','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','updateRouting','updateRealtime','_rr','map','mapAgentsId','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','lodash','md5'];(function(_0x3d3d80,_0x429715){var _0x57ac58=function(_0x1d586b){while(--_0x1d586b){_0x3d3d80['push'](_0x3d3d80['shift']());}};_0x57ac58(++_0x429715);}(_0xdd4f,0x14e));var _0xfdd4=function(_0x3f5cb9,_0x5e9390){_0x3f5cb9=_0x3f5cb9-0x0;var _0x25f765=_0xdd4f[_0x3f5cb9];return _0x25f765;};'use strict';var _=require(_0xfdd4('0x0'));var md5=require(_0xfdd4('0x1'));var util=require(_0xfdd4('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xfdd4('0x3')]=_[_0xfdd4('0x4')](config['redis'],{'host':_0xfdd4('0x5'),'port':0x18eb});var io=require(_0xfdd4('0x6'))(new Redis(config[_0xfdd4('0x3')]));function WhatsappQueue(_0x25bbd9){this['id']=_0x25bbd9['id']||0x0;this[_0xfdd4('0x7')]=_0x25bbd9[_0xfdd4('0x7')]||'';this[_0xfdd4('0x8')]=_0x25bbd9['timeout']||0xa;this[_0xfdd4('0x9')]=_0x25bbd9[_0xfdd4('0x9')]||'beepall';this[_0xfdd4('0xa')]=_0x25bbd9[_0xfdd4('0xa')];this['mapAgentsId']={};this['waiting']=0x0;this[_0xfdd4('0x1')]='';this[_0xfdd4('0xb')]();this[_0xfdd4('0xc')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0xc7c3a0=this['mapAgentsId'][_0xfdd4('0xd')];this['mapAgentsId']=_[_0xfdd4('0xe')](this[_0xfdd4('0xa')],'id');this[_0xfdd4('0xf')][_0xfdd4('0xd')]=_0xc7c3a0;};WhatsappQueue[_0xfdd4('0x10')][_0xfdd4('0xc')]=function(){this[_0xfdd4('0x11')]=0x0;this[_0xfdd4('0x12')]=0x0;for(var _0x268d75=0x0;_0x268d75=0x0?this['available']:0x0;var _0x820e7f={'id':this['id'],'available':this[_0xfdd4('0x15')],'loggedIn':this[_0xfdd4('0x11')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xfdd4('0x16')]};var _0x582588=md5(JSON[_0xfdd4('0x17')](_0x820e7f));if(this[_0xfdd4('0x1')]!==_0x582588){this[_0xfdd4('0x1')]=_0x582588;io['to'](util[_0xfdd4('0x18')](_0xfdd4('0x19'),_0x820e7f[_0xfdd4('0x7')]))[_0xfdd4('0x1a')](_0xfdd4('0x1b'),_0x820e7f);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 1caf400..8472e80 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(_0x4d7fb1,_0x4e8c97){var _0x83c7b7=function(_0x49e397){while(--_0x49e397){_0x4d7fb1['push'](_0x4d7fb1['shift']());}};_0x83c7b7(++_0x4e8c97);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b47d9,_0x1327ce){_0x5b47d9=_0x5b47d9-0x0;var _0x4151f0=_0xb10b[_0x5b47d9];return _0x4151f0;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x3e0f1e,_0x57183b){var _0x50b66a=function(_0x4fae06){while(--_0x4fae06){_0x3e0f1e['push'](_0x3e0f1e['shift']());}};_0x50b66a(++_0x57183b);}(_0xb10b,0x12a));var _0xbb10=function(_0x54336b,_0x48b028){_0x54336b=_0x54336b-0x0;var _0x5b64a3=_0xb10b[_0x54336b];return _0x5b64a3;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 4506f06..ffe82ae 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 _0xe760=['Request','UpdateChatInteraction','addTags','addTagsToChatInteraction','update'];(function(_0x182140,_0x4d3397){var _0x1a6415=function(_0xcbc8eb){while(--_0xcbc8eb){_0x182140['push'](_0x182140['shift']());}};_0x1a6415(++_0x4d3397);}(_0xe760,0x9a));var _0x0e76=function(_0x2c87fd,_0x3fddbd){_0x2c87fd=_0x2c87fd-0x0;var _0x1f5bfe=_0xe760[_0x2c87fd];return _0x1f5bfe;};'use strict';var client=require('../client');exports[_0x0e76('0x0')]=function(_0x1f08f3,_0x2b151e){return client[_0x0e76('0x1')](_0x0e76('0x2'),{'body':_0x2b151e,'options':{'where':{'id':_0x1f08f3}},'log':'updateChatInteraction'});};exports[_0x0e76('0x3')]=function(_0x5a2215,_0x1ea0a0){return client[_0x0e76('0x1')]('AddTagsToChatInteraction',{'body':_0x1ea0a0,'options':{'where':{'id':_0x5a2215}},'log':_0x0e76('0x4')});}; \ No newline at end of file +var _0xc0f9=['addTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction'];(function(_0x1d169e,_0x5175d7){var _0x186744=function(_0x5a0717){while(--_0x5a0717){_0x1d169e['push'](_0x1d169e['shift']());}};_0x186744(++_0x5175d7);}(_0xc0f9,0x121));var _0x9c0f=function(_0x4c70c4,_0x963969){_0x4c70c4=_0x4c70c4-0x0;var _0x437865=_0xc0f9[_0x4c70c4];return _0x437865;};'use strict';var client=require(_0x9c0f('0x0'));exports['update']=function(_0x33e0b3,_0x3f05e4){return client[_0x9c0f('0x1')](_0x9c0f('0x2'),{'body':_0x3f05e4,'options':{'where':{'id':_0x33e0b3}},'log':_0x9c0f('0x3')});};exports['addTags']=function(_0x323382,_0x3ab26c){return client['Request'](_0x9c0f('0x4'),{'body':_0x3ab26c,'options':{'where':{'id':_0x323382}},'log':_0x9c0f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 9eca427..edd97ad 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 _0x823a=['CreateChatMessage','createChatMessage','../client','create'];(function(_0x17edb4,_0x23fcdd){var _0x123c9d=function(_0x1abf3b){while(--_0x1abf3b){_0x17edb4['push'](_0x17edb4['shift']());}};_0x123c9d(++_0x23fcdd);}(_0x823a,0xfa));var _0xa823=function(_0x2cf437,_0x5b0508){_0x2cf437=_0x2cf437-0x0;var _0x2f1fd2=_0x823a[_0x2cf437];return _0x2f1fd2;};'use strict';var client=require(_0xa823('0x0'));exports[_0xa823('0x1')]=function(_0x3a97c0){return client['Request'](_0xa823('0x2'),{'body':_0x3a97c0,'log':_0xa823('0x3')});}; \ No newline at end of file +var _0x3492=['../client','create','CreateChatMessage','createChatMessage'];(function(_0x48562e,_0x1da1bc){var _0x19df96=function(_0xf7fd7e){while(--_0xf7fd7e){_0x48562e['push'](_0x48562e['shift']());}};_0x19df96(++_0x1da1bc);}(_0x3492,0x14c));var _0x2349=function(_0x3b0a37,_0x296b59){_0x3b0a37=_0x3b0a37-0x0;var _0x33b608=_0x3492[_0x3b0a37];return _0x33b608;};'use strict';var client=require(_0x2349('0x0'));exports[_0x2349('0x1')]=function(_0x42ce88){return client['Request'](_0x2349('0x2'),{'body':_0x42ce88,'log':_0x2349('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index de5ee05..16a1859 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 _0x1ef3=['name','timeout','User','Agents','online','chatPause','../client','getChatQueues','GetChatQueue'];(function(_0x102881,_0x58d723){var _0x5c63d0=function(_0x955c59){while(--_0x955c59){_0x102881['push'](_0x102881['shift']());}};_0x5c63d0(++_0x58d723);}(_0x1ef3,0x69));var _0x31ef=function(_0x768bbb,_0x5592c4){_0x768bbb=_0x768bbb-0x0;var _0x5d05c6=_0x1ef3[_0x768bbb];return _0x5d05c6;};'use strict';var client=require(_0x31ef('0x0'));exports[_0x31ef('0x1')]=function(){return function(){return client['Request'](_0x31ef('0x2'),{'options':{'raw':![],'attributes':['id',_0x31ef('0x3'),_0x31ef('0x4'),'strategy'],'include':[{'model':_0x31ef('0x5'),'as':_0x31ef('0x6'),'attributes':['id','name',_0x31ef('0x7'),_0x31ef('0x8')]}]},'log':_0x31ef('0x1')});};}; \ No newline at end of file +var _0xcb99=['name','online','getChatQueues','../client','Request','timeout','strategy','User'];(function(_0x3f5c80,_0x2e1382){var _0x3997b2=function(_0x18845a){while(--_0x18845a){_0x3f5c80['push'](_0x3f5c80['shift']());}};_0x3997b2(++_0x2e1382);}(_0xcb99,0x8b));var _0x9cb9=function(_0x222df7,_0x3e073f){_0x222df7=_0x222df7-0x0;var _0x2cceae=_0xcb99[_0x222df7];return _0x2cceae;};'use strict';var client=require(_0x9cb9('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x9cb9('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0x9cb9('0x2'),_0x9cb9('0x3')],'include':[{'model':_0x9cb9('0x4'),'as':'Agents','attributes':['id',_0x9cb9('0x5'),_0x9cb9('0x6'),'chatPause']}]},'log':_0x9cb9('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 115714e..f5f81a0 100644 --- a/server/services/routing/rpc/chatQueueReport.js +++ b/server/services/routing/rpc/chatQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35aa=['CreateChatQueueReport','update','UpdateChatQueueReport','DESC','create','Request'];(function(_0x40473c,_0x43635d){var _0x424acc=function(_0x3c4633){while(--_0x3c4633){_0x40473c['push'](_0x40473c['shift']());}};_0x424acc(++_0x43635d);}(_0x35aa,0xbe));var _0xa35a=function(_0x157624,_0x3ee799){_0x157624=_0x157624-0x0;var _0x517e0c=_0x35aa[_0x157624];return _0x517e0c;};'use strict';var client=require('../client');exports[_0xa35a('0x0')]=function(_0x2d2970){return client[_0xa35a('0x1')](_0xa35a('0x2'),{'body':_0x2d2970,'log':'CreateChatQueueReport'});};exports[_0xa35a('0x3')]=function(_0x4303b4,_0x24cc2){return client[_0xa35a('0x1')](_0xa35a('0x4'),{'body':_0x24cc2,'options':{'where':{'uniqueid':_0x4303b4},'order':[['id',_0xa35a('0x5')]],'limit':0x1},'log':_0xa35a('0x4')});}; \ No newline at end of file +var _0xa8eb=['Request','DESC','../client','CreateChatQueueReport','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8eb,0x179));var _0xba8e=function(_0x7192c3,_0x29d1aa){_0x7192c3=_0x7192c3-0x0;var _0x79a6ed=_0xa8eb[_0x7192c3];return _0x79a6ed;};'use strict';var client=require(_0xba8e('0x0'));exports['create']=function(_0x26595f){return client['Request'](_0xba8e('0x1'),{'body':_0x26595f,'log':_0xba8e('0x1')});};exports[_0xba8e('0x2')]=function(_0x5c94e6,_0x353df2){return client[_0xba8e('0x3')]('UpdateChatQueueReport',{'body':_0x353df2,'options':{'where':{'uniqueid':_0x5c94e6},'order':[['id',_0xba8e('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 3064104..972db4f 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0xf168d3,_0x43dcfc){var _0x17fb54=function(_0x3d9674){while(--_0x3d9674){_0xf168d3['push'](_0xf168d3['shift']());}};_0x17fb54(++_0x43dcfc);}(_0x7a54,0x106));var _0x47a5=function(_0x183e84,_0x4cd2d9){_0x183e84=_0x183e84-0x0;var _0x40c4c3=_0x7a54[_0x183e84];return _0x40c4c3;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x46ec32,_0x1e842f){var _0x338f60=function(_0x10e02c){while(--_0x10e02c){_0x46ec32['push'](_0x46ec32['shift']());}};_0x338f60(++_0x1e842f);}(_0x7a54,0x106));var _0x47a5=function(_0x5c7799,_0xc0b7da){_0x5c7799=_0x5c7799-0x0;var _0x1a77ab=_0x7a54[_0x5c7799];return _0x1a77ab;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 7ab269a..f9b7720 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 _0xb7b9=['../client','create','Request','createFaxMessage'];(function(_0x4001ad,_0x1e22dd){var _0x4c7ec2=function(_0x24cb8a){while(--_0x24cb8a){_0x4001ad['push'](_0x4001ad['shift']());}};_0x4c7ec2(++_0x1e22dd);}(_0xb7b9,0x1f4));var _0x9b7b=function(_0x17c8b9,_0x1ba8b4){_0x17c8b9=_0x17c8b9-0x0;var _0xa7e0b0=_0xb7b9[_0x17c8b9];return _0xa7e0b0;};'use strict';var client=require(_0x9b7b('0x0'));exports[_0x9b7b('0x1')]=function(_0x144975){return client[_0x9b7b('0x2')]('CreateFaxMessage',{'body':_0x144975,'log':_0x9b7b('0x3')});}; \ No newline at end of file +var _0x05b4=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x05b4,0x136));var _0x405b=function(_0xa6db31,_0x5afbca){_0xa6db31=_0xa6db31-0x0;var _0x272c6a=_0x05b4[_0xa6db31];return _0x272c6a;};'use strict';var client=require(_0x405b('0x0'));exports[_0x405b('0x1')]=function(_0x5ce814){return client[_0x405b('0x2')](_0x405b('0x3'),{'body':_0x5ce814,'log':_0x405b('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 416a652..1bf8237 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 _0xe461=['Request','GetFaxQueue','name','timeout','strategy','User','Agents','faxPause','../client','getFaxQueues'];(function(_0x3cc052,_0x1a2e1f){var _0x3940a3=function(_0x2c7961){while(--_0x2c7961){_0x3cc052['push'](_0x3cc052['shift']());}};_0x3940a3(++_0x1a2e1f);}(_0xe461,0x9e));var _0x1e46=function(_0x446ef5,_0xc9752e){_0x446ef5=_0x446ef5-0x0;var _0xcd1516=_0xe461[_0x446ef5];return _0xcd1516;};'use strict';var client=require(_0x1e46('0x0'));exports[_0x1e46('0x1')]=function(){return function(){return client[_0x1e46('0x2')](_0x1e46('0x3'),{'options':{'raw':![],'attributes':['id',_0x1e46('0x4'),_0x1e46('0x5'),_0x1e46('0x6')],'include':[{'model':_0x1e46('0x7'),'as':_0x1e46('0x8'),'attributes':['id',_0x1e46('0x4'),'online',_0x1e46('0x9')]}]},'log':_0x1e46('0x1')});};}; \ No newline at end of file +var _0xdd39=['getFaxQueues','Request','GetFaxQueue','name','timeout','Agents','online','faxPause','../client'];(function(_0x1ac97c,_0x580f3b){var _0x26638c=function(_0x4e5e2c){while(--_0x4e5e2c){_0x1ac97c['push'](_0x1ac97c['shift']());}};_0x26638c(++_0x580f3b);}(_0xdd39,0x1af));var _0x9dd3=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xdd39[_0x819464];return _0x49dcc0;};'use strict';var client=require(_0x9dd3('0x0'));exports[_0x9dd3('0x1')]=function(){return function(){return client[_0x9dd3('0x2')](_0x9dd3('0x3'),{'options':{'raw':![],'attributes':['id',_0x9dd3('0x4'),_0x9dd3('0x5'),'strategy'],'include':[{'model':'User','as':_0x9dd3('0x6'),'attributes':['id',_0x9dd3('0x4'),_0x9dd3('0x7'),_0x9dd3('0x8')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 3fb41a0..56f9cd9 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 _0x4172=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x4172,0x1c7));var _0x2417=function(_0x42c71c,_0x406fac){_0x42c71c=_0x42c71c-0x0;var _0x4fc7ac=_0x4172[_0x42c71c];return _0x4fc7ac;};'use strict';var client=require(_0x2417('0x0'));exports['create']=function(_0x590a8b){return client[_0x2417('0x1')](_0x2417('0x2'),{'body':_0x590a8b,'log':_0x2417('0x2')});};exports[_0x2417('0x3')]=function(_0x295ab0,_0x8c86a8){return client['Request'](_0x2417('0x4'),{'body':_0x8c86a8,'options':{'where':{'uniqueid':_0x295ab0},'order':[['id',_0x2417('0x5')]],'limit':0x1},'log':_0x2417('0x4')});}; \ No newline at end of file +var _0x615a=['UpdateFaxQueueReport','../client','CreateFaxQueueReport','update','Request'];(function(_0x2ab37b,_0x5918a7){var _0x5dadb4=function(_0x1b2dc9){while(--_0x1b2dc9){_0x2ab37b['push'](_0x2ab37b['shift']());}};_0x5dadb4(++_0x5918a7);}(_0x615a,0x119));var _0xa615=function(_0x444e8b,_0x3524cc){_0x444e8b=_0x444e8b-0x0;var _0x35eb37=_0x615a[_0x444e8b];return _0x35eb37;};'use strict';var client=require(_0xa615('0x0'));exports['create']=function(_0x21ebaf){return client['Request'](_0xa615('0x1'),{'body':_0x21ebaf,'log':_0xa615('0x1')});};exports[_0xa615('0x2')]=function(_0x11fd6e,_0x52ae35){return client[_0xa615('0x3')](_0xa615('0x4'),{'body':_0x52ae35,'options':{'where':{'uniqueid':_0x11fd6e},'order':[['id','DESC']],'limit':0x1},'log':_0xa615('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index a23b12e..14bdb3d 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 _0xdcdd=['name','Interval','interval','../client','getIntervals','Request','GetInterval'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xdcdd,0xb9));var _0xddcd=function(_0x15d566,_0xec7bc2){_0x15d566=_0x15d566-0x0;var _0x283002=_0xdcdd[_0x15d566];return _0x283002;};'use strict';var client=require(_0xddcd('0x0'));exports[_0xddcd('0x1')]=function(){return function(){return client[_0xddcd('0x2')](_0xddcd('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xddcd('0x4')],'include':[{'model':_0xddcd('0x5'),'as':'Intervals','attributes':['id',_0xddcd('0x4'),_0xddcd('0x6')]}]},'log':_0xddcd('0x1')});};}; \ No newline at end of file +var _0x0ddf=['GetInterval','name','Interval','interval','../client','getIntervals'];(function(_0x162732,_0x3654e1){var _0x1100e1=function(_0x4a9554){while(--_0x4a9554){_0x162732['push'](_0x162732['shift']());}};_0x1100e1(++_0x3654e1);}(_0x0ddf,0x1c0));var _0xf0dd=function(_0x13d93b,_0x577f4b){_0x13d93b=_0x13d93b-0x0;var _0x2aa740=_0x0ddf[_0x13d93b];return _0x2aa740;};'use strict';var client=require(_0xf0dd('0x0'));exports[_0xf0dd('0x1')]=function(){return function(){return client['Request'](_0xf0dd('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xf0dd('0x3')],'include':[{'model':_0xf0dd('0x4'),'as':'Intervals','attributes':['id','name',_0xf0dd('0x5')]}]},'log':'getIntervals'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index a349a1a..bc96012 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 _0xa456=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0x15b1ec,_0x15ee62){var _0x33320c=function(_0x26e74d){while(--_0x26e74d){_0x15b1ec['push'](_0x15b1ec['shift']());}};_0x33320c(++_0x15ee62);}(_0xa456,0x142));var _0x6a45=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xa456[_0x2080a3];return _0x8d7d17;};'use strict';var client=require(_0x6a45('0x0'));exports[_0x6a45('0x1')]=function(_0x56dfe8,_0xd5464e){return client['Request'](_0x6a45('0x2'),{'body':_0xd5464e,'options':{'where':{'id':_0x56dfe8}},'log':_0x6a45('0x3')});};exports[_0x6a45('0x4')]=function(_0x500c72,_0x1f0701){return client[_0x6a45('0x5')](_0x6a45('0x6'),{'body':_0x1f0701,'options':{'where':{'id':_0x500c72}},'log':_0x6a45('0x7')});}; \ No newline at end of file +var _0x4bd3=['../client','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x110cbb,_0x186ee7){var _0x145f91=function(_0x3d2195){while(--_0x3d2195){_0x110cbb['push'](_0x110cbb['shift']());}};_0x145f91(++_0x186ee7);}(_0x4bd3,0x174));var _0x34bd=function(_0xedbe14,_0x596fbd){_0xedbe14=_0xedbe14-0x0;var _0x5dda9b=_0x4bd3[_0xedbe14];return _0x5dda9b;};'use strict';var client=require(_0x34bd('0x0'));exports['update']=function(_0x415bd3,_0x22a9f9){return client['Request']('UpdateMailInteraction',{'body':_0x22a9f9,'options':{'where':{'id':_0x415bd3}},'log':'updateMailInteraction'});};exports[_0x34bd('0x1')]=function(_0x44854a,_0x1fc8eb){return client['Request'](_0x34bd('0x2'),{'body':_0x1fc8eb,'options':{'where':{'id':_0x44854a}},'log':_0x34bd('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 2748eeb..ca3b3ce 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 _0xc23a=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0x1e7031,_0x4587b9){var _0x9f2d64=function(_0x3c8c82){while(--_0x3c8c82){_0x1e7031['push'](_0x1e7031['shift']());}};_0x9f2d64(++_0x4587b9);}(_0xc23a,0xd1));var _0xac23=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0xc23a[_0x12fc8d];return _0x3f9d04;};'use strict';var client=require(_0xac23('0x0'));exports[_0xac23('0x1')]=function(_0x409a97){return client[_0xac23('0x2')](_0xac23('0x3'),{'body':_0x409a97,'log':_0xac23('0x4')});}; \ No newline at end of file +var _0xae03=['CreateMailMessage','../client','create','Request'];(function(_0x2dbcf0,_0x1c9ce9){var _0x185a15=function(_0x51b059){while(--_0x51b059){_0x2dbcf0['push'](_0x2dbcf0['shift']());}};_0x185a15(++_0x1c9ce9);}(_0xae03,0xf5));var _0x3ae0=function(_0x1b5837,_0x4c6ebd){_0x1b5837=_0x1b5837-0x0;var _0x22552f=_0xae03[_0x1b5837];return _0x22552f;};'use strict';var client=require(_0x3ae0('0x0'));exports[_0x3ae0('0x1')]=function(_0x131562){return client[_0x3ae0('0x2')](_0x3ae0('0x3'),{'body':_0x131562,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 293e1b5..0bc3e70 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 _0xf77b=['User','Agents','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','strategy'];(function(_0x25b7f4,_0x1fc48c){var _0x138824=function(_0x3c8525){while(--_0x3c8525){_0x25b7f4['push'](_0x25b7f4['shift']());}};_0x138824(++_0x1fc48c);}(_0xf77b,0x1da));var _0xbf77=function(_0x261522,_0x1adc1f){_0x261522=_0x261522-0x0;var _0x98a25a=_0xf77b[_0x261522];return _0x98a25a;};'use strict';var client=require(_0xbf77('0x0'));exports[_0xbf77('0x1')]=function(){return function(){return client[_0xbf77('0x2')](_0xbf77('0x3'),{'options':{'raw':![],'attributes':['id',_0xbf77('0x4'),'timeout',_0xbf77('0x5')],'include':[{'model':_0xbf77('0x6'),'as':_0xbf77('0x7'),'attributes':['id',_0xbf77('0x4'),_0xbf77('0x8'),_0xbf77('0x9')]}]},'log':_0xbf77('0x1')});};}; \ No newline at end of file +var _0x28fa=['online','mailPause','getMailQueues','Request','GetMailQueue','strategy','Agents','name'];(function(_0x540b38,_0x5b94b3){var _0x2118d8=function(_0x424c30){while(--_0x424c30){_0x540b38['push'](_0x540b38['shift']());}};_0x2118d8(++_0x5b94b3);}(_0x28fa,0x1ba));var _0xa28f=function(_0x560788,_0x13d82a){_0x560788=_0x560788-0x0;var _0x4aa652=_0x28fa[_0x560788];return _0x4aa652;};'use strict';var client=require('../client');exports[_0xa28f('0x0')]=function(){return function(){return client[_0xa28f('0x1')](_0xa28f('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xa28f('0x3')],'include':[{'model':'User','as':_0xa28f('0x4'),'attributes':['id',_0xa28f('0x5'),_0xa28f('0x6'),_0xa28f('0x7')]}]},'log':_0xa28f('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 7239535..558be43 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 _0xce35=['CreateMailQueueReport','update','DESC','UpdateMailQueueReport','../client','create','Request'];(function(_0x2dcf94,_0x518944){var _0x3d6cb6=function(_0x112f01){while(--_0x112f01){_0x2dcf94['push'](_0x2dcf94['shift']());}};_0x3d6cb6(++_0x518944);}(_0xce35,0x1a8));var _0x5ce3=function(_0xa42252,_0x44c78f){_0xa42252=_0xa42252-0x0;var _0x15e8b=_0xce35[_0xa42252];return _0x15e8b;};'use strict';var client=require(_0x5ce3('0x0'));exports[_0x5ce3('0x1')]=function(_0x245535){return client[_0x5ce3('0x2')](_0x5ce3('0x3'),{'body':_0x245535,'log':'CreateMailQueueReport'});};exports[_0x5ce3('0x4')]=function(_0x3dde80,_0x2faddb){return client['Request']('UpdateMailQueueReport',{'body':_0x2faddb,'options':{'where':{'uniqueid':_0x3dde80},'order':[['id',_0x5ce3('0x5')]],'limit':0x1},'log':_0x5ce3('0x6')});}; \ No newline at end of file +var _0xe885=['UpdateMailQueueReport','DESC','../client','create','CreateMailQueueReport','update','Request'];(function(_0x3dfbda,_0xb03990){var _0x11b92f=function(_0x424271){while(--_0x424271){_0x3dfbda['push'](_0x3dfbda['shift']());}};_0x11b92f(++_0xb03990);}(_0xe885,0xdb));var _0x5e88=function(_0x136a60,_0x5bb51b){_0x136a60=_0x136a60-0x0;var _0xc72bc2=_0xe885[_0x136a60];return _0xc72bc2;};'use strict';var client=require(_0x5e88('0x0'));exports[_0x5e88('0x1')]=function(_0x4ff047){return client['Request'](_0x5e88('0x2'),{'body':_0x4ff047,'log':_0x5e88('0x2')});};exports[_0x5e88('0x3')]=function(_0xfa8fbb,_0x266b2d){return client[_0x5e88('0x4')](_0x5e88('0x5'),{'body':_0x266b2d,'options':{'where':{'uniqueid':_0xfa8fbb},'order':[['id',_0x5e88('0x6')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index c414aaf..23982f5 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 _0xffeb=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','Request','updateOpenchannelInteraction','addTags'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0xffeb,0x134));var _0xbffe=function(_0x2fa51a,_0x4d691d){_0x2fa51a=_0x2fa51a-0x0;var _0xf7e4c0=_0xffeb[_0x2fa51a];return _0xf7e4c0;};'use strict';var client=require(_0xbffe('0x0'));exports['update']=function(_0x2609c2,_0xd3b781){return client[_0xbffe('0x1')]('UpdateOpenchannelInteraction',{'body':_0xd3b781,'options':{'where':{'id':_0x2609c2}},'log':_0xbffe('0x2')});};exports[_0xbffe('0x3')]=function(_0x4c52cb,_0x92755d){return client[_0xbffe('0x1')](_0xbffe('0x4'),{'body':_0x92755d,'options':{'where':{'id':_0x4c52cb}},'log':_0xbffe('0x5')});}; \ No newline at end of file +var _0x0641=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','addTagsToChatInteraction','../client','update','Request'];(function(_0x2de3a3,_0x36d720){var _0x214c4d=function(_0x4eaff7){while(--_0x4eaff7){_0x2de3a3['push'](_0x2de3a3['shift']());}};_0x214c4d(++_0x36d720);}(_0x0641,0x12a));var _0x1064=function(_0x555ab9,_0x30c354){_0x555ab9=_0x555ab9-0x0;var _0x4c29f5=_0x0641[_0x555ab9];return _0x4c29f5;};'use strict';var client=require(_0x1064('0x0'));exports[_0x1064('0x1')]=function(_0xdee6df,_0x476206){return client[_0x1064('0x2')](_0x1064('0x3'),{'body':_0x476206,'options':{'where':{'id':_0xdee6df}},'log':_0x1064('0x4')});};exports[_0x1064('0x5')]=function(_0x13172d,_0x1baa23){return client[_0x1064('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x1baa23,'options':{'where':{'id':_0x13172d}},'log':_0x1064('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 52f68df..8e23789 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 _0x9bc9=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x1e5db8,_0x44ef41){var _0x219a51=function(_0x5b86a3){while(--_0x5b86a3){_0x1e5db8['push'](_0x1e5db8['shift']());}};_0x219a51(++_0x44ef41);}(_0x9bc9,0xe1));var _0x99bc=function(_0x2a8eab,_0x334b58){_0x2a8eab=_0x2a8eab-0x0;var _0x5015c6=_0x9bc9[_0x2a8eab];return _0x5015c6;};'use strict';var client=require(_0x99bc('0x0'));exports[_0x99bc('0x1')]=function(_0x59760d){return client[_0x99bc('0x2')](_0x99bc('0x3'),{'body':_0x59760d,'log':_0x99bc('0x4')});}; \ No newline at end of file +var _0x1554=['Request','createOpenchannelMessage','../client'];(function(_0x1e8bc4,_0x3bb2c1){var _0x5eca97=function(_0x5758db){while(--_0x5758db){_0x1e8bc4['push'](_0x1e8bc4['shift']());}};_0x5eca97(++_0x3bb2c1);}(_0x1554,0x65));var _0x4155=function(_0x2859ad,_0x2604f5){_0x2859ad=_0x2859ad-0x0;var _0x50861e=_0x1554[_0x2859ad];return _0x50861e;};'use strict';var client=require(_0x4155('0x0'));exports['create']=function(_0x5b9077){return client[_0x4155('0x1')]('CreateOpenchannelMessage',{'body':_0x5b9077,'log':_0x4155('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index b14ccca..da159a2 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 _0x0cdd=['openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout'];(function(_0x4e3079,_0x2e48ea){var _0x4356fb=function(_0x3f31e0){while(--_0x3f31e0){_0x4e3079['push'](_0x4e3079['shift']());}};_0x4356fb(++_0x2e48ea);}(_0x0cdd,0x158));var _0xd0cd=function(_0x5617b7,_0x709746){_0x5617b7=_0x5617b7-0x0;var _0x4838a1=_0x0cdd[_0x5617b7];return _0x4838a1;};'use strict';var client=require(_0xd0cd('0x0'));exports[_0xd0cd('0x1')]=function(){return function(){return client[_0xd0cd('0x2')](_0xd0cd('0x3'),{'options':{'raw':![],'attributes':['id',_0xd0cd('0x4'),_0xd0cd('0x5'),'strategy'],'include':[{'model':'User','as':'Agents','attributes':['id',_0xd0cd('0x4'),'online',_0xd0cd('0x6')]}]},'log':_0xd0cd('0x1')});};}; \ No newline at end of file +var _0x6443=['Agents','online','getOpenchannelQueues','Request','name','strategy'];(function(_0x24ef36,_0x5766f7){var _0x2c9bc6=function(_0x5e6032){while(--_0x5e6032){_0x24ef36['push'](_0x24ef36['shift']());}};_0x2c9bc6(++_0x5766f7);}(_0x6443,0x164));var _0x3644=function(_0x20ebb5,_0x237d88){_0x20ebb5=_0x20ebb5-0x0;var _0x487182=_0x6443[_0x20ebb5];return _0x487182;};'use strict';var client=require('../client');exports[_0x3644('0x0')]=function(){return function(){return client[_0x3644('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0x3644('0x2'),'timeout',_0x3644('0x3')],'include':[{'model':'User','as':_0x3644('0x4'),'attributes':['id',_0x3644('0x2'),_0x3644('0x5'),'openchannelPause']}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 8c6f82d..66f52b8 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 _0x4a24=['CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','Request'];(function(_0x25844c,_0x2682a2){var _0x49e34b=function(_0x13c1e6){while(--_0x13c1e6){_0x25844c['push'](_0x25844c['shift']());}};_0x49e34b(++_0x2682a2);}(_0x4a24,0xef));var _0x44a2=function(_0x544099,_0x372b30){_0x544099=_0x544099-0x0;var _0x20ab09=_0x4a24[_0x544099];return _0x20ab09;};'use strict';var client=require('../client');exports['create']=function(_0x25a55b){return client[_0x44a2('0x0')](_0x44a2('0x1'),{'body':_0x25a55b,'log':_0x44a2('0x1')});};exports['update']=function(_0x5661a6,_0xb9684d){return client[_0x44a2('0x0')](_0x44a2('0x2'),{'body':_0xb9684d,'options':{'where':{'uniqueid':_0x5661a6},'order':[['id','DESC']],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x6a7c=['DESC','../client','create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x565a37,_0x3e26b7){var _0x2a60e2=function(_0x3b4c77){while(--_0x3b4c77){_0x565a37['push'](_0x565a37['shift']());}};_0x2a60e2(++_0x3e26b7);}(_0x6a7c,0x166));var _0xc6a7=function(_0x16b9e9,_0x1d1657){_0x16b9e9=_0x16b9e9-0x0;var _0x1532aa=_0x6a7c[_0x16b9e9];return _0x1532aa;};'use strict';var client=require(_0xc6a7('0x0'));exports[_0xc6a7('0x1')]=function(_0x36abca){return client[_0xc6a7('0x2')](_0xc6a7('0x3'),{'body':_0x36abca,'log':'CreateOpenchannelQueueReport'});};exports[_0xc6a7('0x4')]=function(_0x28da98,_0x3c4e93){return client[_0xc6a7('0x2')](_0xc6a7('0x5'),{'body':_0x3c4e93,'options':{'where':{'uniqueid':_0x28da98},'order':[['id',_0xc6a7('0x6')]],'limit':0x1},'log':_0xc6a7('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index e3ff13d..30d2f8c 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 _0x294b=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x2a2d7a,_0x3638fa){var _0x122240=function(_0x484c0f){while(--_0x484c0f){_0x2a2d7a['push'](_0x2a2d7a['shift']());}};_0x122240(++_0x3638fa);}(_0x294b,0xea));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xb294('0x0'));exports['update']=function(_0x3ae39b,_0x16bc4c){return client[_0xb294('0x1')](_0xb294('0x2'),{'body':_0x16bc4c,'options':{'where':{'id':_0x3ae39b}},'log':_0xb294('0x3')});};exports[_0xb294('0x4')]=function(_0x58fe24,_0x5c0237){return client[_0xb294('0x1')](_0xb294('0x5'),{'body':_0x5c0237,'options':{'where':{'id':_0x58fe24}},'log':_0xb294('0x6')});}; \ No newline at end of file +var _0xdd0c=['Request','AddTagsToSmsInteraction','update','UpdateSmsInteraction','addTags'];(function(_0x46e700,_0x56afb1){var _0x46ec64=function(_0xe97cc1){while(--_0xe97cc1){_0x46e700['push'](_0x46e700['shift']());}};_0x46ec64(++_0x56afb1);}(_0xdd0c,0x165));var _0xcdd0=function(_0x4a1276,_0x3aa70c){_0x4a1276=_0x4a1276-0x0;var _0x500dd3=_0xdd0c[_0x4a1276];return _0x500dd3;};'use strict';var client=require('../client');exports[_0xcdd0('0x0')]=function(_0xa28dbc,_0x3c0b5d){return client['Request'](_0xcdd0('0x1'),{'body':_0x3c0b5d,'options':{'where':{'id':_0xa28dbc}},'log':'updateSmsInteraction'});};exports[_0xcdd0('0x2')]=function(_0x159e38,_0x432716){return client[_0xcdd0('0x3')](_0xcdd0('0x4'),{'body':_0x432716,'options':{'where':{'id':_0x159e38}},'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 19f0cf7..2161193 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 _0x21e6=['createSmsMessage','../client','create','CreateSmsMessage'];(function(_0x5c4bf4,_0x1f5d28){var _0x555f0e=function(_0x2325a8){while(--_0x2325a8){_0x5c4bf4['push'](_0x5c4bf4['shift']());}};_0x555f0e(++_0x1f5d28);}(_0x21e6,0x155));var _0x621e=function(_0x54cd98,_0x3029e6){_0x54cd98=_0x54cd98-0x0;var _0x4abd09=_0x21e6[_0x54cd98];return _0x4abd09;};'use strict';var client=require(_0x621e('0x0'));exports[_0x621e('0x1')]=function(_0x40a068){return client['Request'](_0x621e('0x2'),{'body':_0x40a068,'log':_0x621e('0x3')});}; \ No newline at end of file +var _0x875d=['../client','create','CreateSmsMessage','createSmsMessage'];(function(_0x2eb3db,_0x4a32c0){var _0x358f33=function(_0x1d0588){while(--_0x1d0588){_0x2eb3db['push'](_0x2eb3db['shift']());}};_0x358f33(++_0x4a32c0);}(_0x875d,0x120));var _0xd875=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x875d[_0x166742];return _0xb7814a;};'use strict';var client=require(_0xd875('0x0'));exports[_0xd875('0x1')]=function(_0x222eb4){return client['Request'](_0xd875('0x2'),{'body':_0x222eb4,'log':_0xd875('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 90416a7..fe3836e 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x20ff58,_0x2ad62f){var _0xa1a390=function(_0x5bf50c){while(--_0x5bf50c){_0x20ff58['push'](_0x20ff58['shift']());}};_0xa1a390(++_0x2ad62f);}(_0xb7e7,0x121));var _0x7b7e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xb7e7[_0x297fd3];return _0x2af381;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x568480,_0x58aabb){var _0x9623e6=function(_0x3f2ae9){while(--_0x3f2ae9){_0x568480['push'](_0x568480['shift']());}};_0x9623e6(++_0x58aabb);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index a10601e..86cecd6 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 _0x9c44=['Request','CreateSmsQueueReport','update','UpdateSmsQueueReport'];(function(_0x49fc41,_0x33dee2){var _0x4bec26=function(_0x2c75dd){while(--_0x2c75dd){_0x49fc41['push'](_0x49fc41['shift']());}};_0x4bec26(++_0x33dee2);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'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 +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xedd9,0xfc));var _0x9edd=function(_0x1a45b6,_0x12bddd){_0x1a45b6=_0x1a45b6-0x0;var _0x19eb37=_0xedd9[_0x1a45b6];return _0x19eb37;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index df5baf2..c86b92c 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(_0x294c63,_0x3c83b9){var _0x3756eb=function(_0x4865b5){while(--_0x4865b5){_0x294c63['push'](_0x294c63['shift']());}};_0x3756eb(++_0x3c83b9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x470ae1,_0x13a644){var _0x72aa39=function(_0x203846){while(--_0x203846){_0x470ae1['push'](_0x470ae1['shift']());}};_0x72aa39(++_0x13a644);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 b6d06a6..4a5f98e 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 _0xd2f5=['../client','Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x5db1c0,_0x21819a){var _0x549cf4=function(_0xf0689b){while(--_0xf0689b){_0x5db1c0['push'](_0x5db1c0['shift']());}};_0x549cf4(++_0x21819a);}(_0xd2f5,0x144));var _0x5d2f=function(_0x14238b,_0x5e77b4){_0x14238b=_0x14238b-0x0;var _0x2f3166=_0xd2f5[_0x14238b];return _0x2f3166;};'use strict';var client=require(_0x5d2f('0x0'));exports['update']=function(_0x194209,_0x58ee4e){return client[_0x5d2f('0x1')]('UpdateWhatsappInteraction',{'body':_0x58ee4e,'options':{'where':{'id':_0x194209}},'log':_0x5d2f('0x2')});};exports[_0x5d2f('0x3')]=function(_0x102911,_0xc7102b){return client[_0x5d2f('0x1')](_0x5d2f('0x4'),{'body':_0xc7102b,'options':{'where':{'id':_0x102911}},'log':_0x5d2f('0x5')});}; \ No newline at end of file +var _0x96fd=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','update','Request','updateWhatsappInteraction'];(function(_0x4b798e,_0x526362){var _0x1fc077=function(_0x28a792){while(--_0x28a792){_0x4b798e['push'](_0x4b798e['shift']());}};_0x1fc077(++_0x526362);}(_0x96fd,0x1e9));var _0xd96f=function(_0x4e437a,_0x14ef62){_0x4e437a=_0x4e437a-0x0;var _0x4e98f7=_0x96fd[_0x4e437a];return _0x4e98f7;};'use strict';var client=require('../client');exports[_0xd96f('0x0')]=function(_0x5334c3,_0x2022bf){return client[_0xd96f('0x1')]('UpdateWhatsappInteraction',{'body':_0x2022bf,'options':{'where':{'id':_0x5334c3}},'log':_0xd96f('0x2')});};exports[_0xd96f('0x3')]=function(_0x44f63c,_0x22b39b){return client['Request'](_0xd96f('0x4'),{'body':_0x22b39b,'options':{'where':{'id':_0x44f63c}},'log':_0xd96f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index eb0ca62..a06dde4 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 _0x28d0=['Request','CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0x28d0,0x94));var _0x028d=function(_0x4ce11d,_0x439037){_0x4ce11d=_0x4ce11d-0x0;var _0x5c8e56=_0x28d0[_0x4ce11d];return _0x5c8e56;};'use strict';var client=require(_0x028d('0x0'));exports[_0x028d('0x1')]=function(_0x1536a5){return client[_0x028d('0x2')](_0x028d('0x3'),{'body':_0x1536a5,'log':_0x028d('0x4')});}; \ No newline at end of file +var _0xc427=['../client','create','Request','createWhatsappMessage'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc427,0x70));var _0x7c42=function(_0x141d98,_0x1c628d){_0x141d98=_0x141d98-0x0;var _0x1cc3ea=_0xc427[_0x141d98];return _0x1cc3ea;};'use strict';var client=require(_0x7c42('0x0'));exports[_0x7c42('0x1')]=function(_0x1fe1e6){return client[_0x7c42('0x2')]('CreateWhatsappMessage',{'body':_0x1fe1e6,'log':_0x7c42('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index ad9ba22..bf1533f 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 _0xfe48=['getWhatsappQueues','name','timeout','strategy','User','Agents','whatsappPause','../client'];(function(_0x4f676e,_0x571ace){var _0x542a9b=function(_0x31a202){while(--_0x31a202){_0x4f676e['push'](_0x4f676e['shift']());}};_0x542a9b(++_0x571ace);}(_0xfe48,0x9f));var _0x8fe4=function(_0x92624e,_0x3ad9e0){_0x92624e=_0x92624e-0x0;var _0x592713=_0xfe48[_0x92624e];return _0x592713;};'use strict';var client=require(_0x8fe4('0x0'));exports[_0x8fe4('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x8fe4('0x2'),_0x8fe4('0x3'),_0x8fe4('0x4')],'include':[{'model':_0x8fe4('0x5'),'as':_0x8fe4('0x6'),'attributes':['id',_0x8fe4('0x2'),'online',_0x8fe4('0x7')]}]},'log':_0x8fe4('0x1')});};}; \ No newline at end of file +var _0xe16a=['../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','online','whatsappPause'];(function(_0xf13ca6,_0x5735ea){var _0x4a4387=function(_0x103f67){while(--_0x103f67){_0xf13ca6['push'](_0xf13ca6['shift']());}};_0x4a4387(++_0x5735ea);}(_0xe16a,0xc6));var _0xae16=function(_0x50059e,_0x4263b0){_0x50059e=_0x50059e-0x0;var _0x2a4088=_0xe16a[_0x50059e];return _0x2a4088;};'use strict';var client=require(_0xae16('0x0'));exports[_0xae16('0x1')]=function(){return function(){return client[_0xae16('0x2')](_0xae16('0x3'),{'options':{'raw':![],'attributes':['id',_0xae16('0x4'),_0xae16('0x5'),_0xae16('0x6')],'include':[{'model':_0xae16('0x7'),'as':_0xae16('0x8'),'attributes':['id',_0xae16('0x4'),_0xae16('0x9'),_0xae16('0xa')]}]},'log':_0xae16('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 1eb33d9..6434eaa 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 _0xacb6=['CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport','../client'];(function(_0x304690,_0x223e0f){var _0x5037b7=function(_0x4f87b2){while(--_0x4f87b2){_0x304690['push'](_0x304690['shift']());}};_0x5037b7(++_0x223e0f);}(_0xacb6,0x16c));var _0x6acb=function(_0x232559,_0x324eb3){_0x232559=_0x232559-0x0;var _0x25be03=_0xacb6[_0x232559];return _0x25be03;};'use strict';var client=require(_0x6acb('0x0'));exports['create']=function(_0x239aac){return client['Request'](_0x6acb('0x1'),{'body':_0x239aac,'log':_0x6acb('0x1')});};exports[_0x6acb('0x2')]=function(_0x36f05d,_0x45f7f5){return client[_0x6acb('0x3')](_0x6acb('0x4'),{'body':_0x45f7f5,'options':{'where':{'uniqueid':_0x36f05d},'order':[['id','DESC']],'limit':0x1},'log':_0x6acb('0x4')});}; \ No newline at end of file +var _0xe6e1=['UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport'];(function(_0x44c8cb,_0x2e28c7){var _0x3bf406=function(_0x2dbe74){while(--_0x2dbe74){_0x44c8cb['push'](_0x44c8cb['shift']());}};_0x3bf406(++_0x2e28c7);}(_0xe6e1,0xc8));var _0x1e6e=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xe6e1[_0x465028];return _0xb783d4;};'use strict';var client=require(_0x1e6e('0x0'));exports[_0x1e6e('0x1')]=function(_0x4d2307){return client[_0x1e6e('0x2')](_0x1e6e('0x3'),{'body':_0x4d2307,'log':_0x1e6e('0x3')});};exports['update']=function(_0x10d5b8,_0x8792f0){return client[_0x1e6e('0x2')](_0x1e6e('0x4'),{'body':_0x8792f0,'options':{'where':{'uniqueid':_0x10d5b8},'order':[['id',_0x1e6e('0x5')]],'limit':0x1},'log':_0x1e6e('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 dd15e7a..dd6cec3 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 _0x2aa7=['[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','lodash','util','../../../../config/logger','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','message','join','agents','name','timeout','createQueue','atimeout','channel','START:%s','rules','end','close','stop','[%s][AGENT]\x20ROUTING\x20END'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_0x2aa7,0xa8));var _0x72aa=function(_0x5e3fa0,_0x4e1dac){_0x5e3fa0=_0x5e3fa0-0x0;var _0x4ef06c=_0x2aa7[_0x5e3fa0];return _0x4ef06c;};'use strict';var schema=require('validate');var _=require(_0x72aa('0x0'));var util=require(_0x72aa('0x1'));var seqqueue=require('seq-queue');var logger=require(_0x72aa('0x2'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':_0x72aa('0x3'),'required':!![],'message':_0x72aa('0x4')},'timeout':{'type':_0x72aa('0x5'),'message':_0x72aa('0x6')}});function writeLog(_0xfeaa7e,_0x228da9,_0x2e2b81){return logger[_0x72aa('0x7')](util[_0x72aa('0x8')](_0x72aa('0x9'),_0xfeaa7e,_0x228da9['name'],_0x2e2b81));}function handleFindAgent(_0x26d6ff){return function(_0x46c254){return _0x46c254['name']['toLowerCase']()===_0x26d6ff[_0x72aa('0xa')]();};}exports[_0x72aa('0xb')]=function(_0x473ffc,_0x1d5d92,_0x56bd19,_0x496844){return function(_0x29d1bf){try{var _0x38a430={'name':_0x1d5d92[0x0],'timeout':_0x1d5d92[0x1]};var _0x1972f4=queue[_0x72aa('0xc')](_0x38a430,{'typecast':!![]});if(_0x1972f4[_0x72aa('0xd')]){logger[_0x72aa('0xe')](_0x72aa('0xf'),_0x473ffc,_['map'](_0x1972f4,_0x72aa('0x10'))[_0x72aa('0x11')](',\x20'));_0x29d1bf['stop']();}else{var _0x127a5a=_['find'](_0x56bd19[_0x72aa('0x12')],handleFindAgent(_0x38a430[_0x72aa('0x13')]));if(_0x127a5a){var _0x3cf223=(_0x38a430[_0x72aa('0x14')]||0xa)*0x3e8;var _0x2e8e3a,_0x2e7ec6;var _0x16f6c4=seqqueue[_0x72aa('0x15')](_0x3cf223);_0x16f6c4['id']=_0x473ffc;_0x16f6c4[_0x72aa('0x16')]=_0x3cf223;_0x16f6c4[_0x72aa('0x17')]=_0x496844[_0x72aa('0x17')];writeLog(_0x473ffc,_0x127a5a,util[_0x72aa('0x8')](_0x72aa('0x18'),_0x3cf223));_0x56bd19[_0x72aa('0x19')][_0x473ffc]['on'](_0x72aa('0x1a'),function(){logger[_0x72aa('0x7')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x473ffc);clearTimeout(_0x2e7ec6);_0x2e7ec6=undefined;_0x16f6c4[_0x72aa('0x1b')]();if(_0x56bd19[_0x72aa('0x19')][_0x473ffc]){delete _0x56bd19[_0x72aa('0x19')][_0x473ffc];}_0x29d1bf[_0x72aa('0x1c')]();});_0x56bd19[_0x72aa('0x19')][_0x473ffc]['on']('complete',function(){if(_0x56bd19[_0x72aa('0x19')][_0x473ffc]){delete _0x56bd19[_0x72aa('0x19')][_0x473ffc];}});_0x2e7ec6=setTimeout(function(){logger[_0x72aa('0x7')](_0x72aa('0x1d'),_0x473ffc);clearTimeout(_0x2e7ec6);_0x16f6c4['close']();_0x29d1bf['next']();},_0x3cf223);strategy['agent'](_0x16f6c4,_0x127a5a,_0x56bd19,_0x496844);}else{logger['error'](_0x72aa('0x1e'),_0x473ffc,_0x38a430[_0x72aa('0x13')]);_0x29d1bf[_0x72aa('0x1c')]();}}}catch(_0x10bc11){console[_0x72aa('0x1f')](_0x10bc11);logger[_0x72aa('0xe')]('[%s][QUEUE]\x20%s',_0x473ffc,_0x10bc11[_0x72aa('0x20')]);_0x29d1bf[_0x72aa('0x1c')]();}};}; \ No newline at end of file +var _0xf2a9=['format','name','toLowerCase','consequence','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info'];(function(_0x2de753,_0x4a544d){var _0x8e70a5=function(_0x498455){while(--_0x498455){_0x2de753['push'](_0x2de753['shift']());}};_0x8e70a5(++_0x4a544d);}(_0xf2a9,0x1ee));var _0x9f2a=function(_0x353367,_0x1cab7b){_0x353367=_0x353367-0x0;var _0x59929c=_0xf2a9[_0x353367];return _0x59929c;};'use strict';var schema=require(_0x9f2a('0x0'));var _=require(_0x9f2a('0x1'));var util=require(_0x9f2a('0x2'));var seqqueue=require(_0x9f2a('0x3'));var logger=require(_0x9f2a('0x4'))(_0x9f2a('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x9f2a('0x6')},'timeout':{'type':_0x9f2a('0x7'),'message':_0x9f2a('0x8')}});function writeLog(_0xfb175e,_0x543a6a,_0x390a70){return logger[_0x9f2a('0x9')](util[_0x9f2a('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0xfb175e,_0x543a6a[_0x9f2a('0xb')],_0x390a70));}function handleFindAgent(_0x508fd7){return function(_0x411c5a){return _0x411c5a[_0x9f2a('0xb')]['toLowerCase']()===_0x508fd7[_0x9f2a('0xc')]();};}exports[_0x9f2a('0xd')]=function(_0x34def9,_0x124fb6,_0x338a9c,_0x21def4){return function(_0x2060a4){try{var _0x8b47ff={'name':_0x124fb6[0x0],'timeout':_0x124fb6[0x1]};var _0x146059=queue[_0x9f2a('0x0')](_0x8b47ff,{'typecast':!![]});if(_0x146059['length']){logger['error'](_0x9f2a('0xe'),_0x34def9,_[_0x9f2a('0xf')](_0x146059,_0x9f2a('0x10'))[_0x9f2a('0x11')](',\x20'));_0x2060a4[_0x9f2a('0x12')]();}else{var _0x18fbc3=_[_0x9f2a('0x13')](_0x338a9c[_0x9f2a('0x14')],handleFindAgent(_0x8b47ff['name']));if(_0x18fbc3){var _0x530192=(_0x8b47ff[_0x9f2a('0x15')]||0xa)*0x3e8;var _0x4aae3f,_0x285c11;var _0x433288=seqqueue['createQueue'](_0x530192);_0x433288['id']=_0x34def9;_0x433288[_0x9f2a('0x16')]=_0x530192;_0x433288[_0x9f2a('0x17')]=_0x21def4[_0x9f2a('0x17')];writeLog(_0x34def9,_0x18fbc3,util[_0x9f2a('0xa')](_0x9f2a('0x18'),_0x530192));_0x338a9c[_0x9f2a('0x19')][_0x34def9]['on'](_0x9f2a('0x1a'),function(){logger[_0x9f2a('0x9')](_0x9f2a('0x1b'),_0x34def9);clearTimeout(_0x285c11);_0x285c11=undefined;_0x433288[_0x9f2a('0x1c')]();if(_0x338a9c[_0x9f2a('0x19')][_0x34def9]){delete _0x338a9c['rules'][_0x34def9];}_0x2060a4[_0x9f2a('0x12')]();});_0x338a9c[_0x9f2a('0x19')][_0x34def9]['on']('complete',function(){if(_0x338a9c[_0x9f2a('0x19')][_0x34def9]){delete _0x338a9c[_0x9f2a('0x19')][_0x34def9];}});_0x285c11=setTimeout(function(){logger[_0x9f2a('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x34def9);clearTimeout(_0x285c11);_0x433288[_0x9f2a('0x1c')]();_0x2060a4[_0x9f2a('0x1d')]();},_0x530192);strategy[_0x9f2a('0x1e')](_0x433288,_0x18fbc3,_0x338a9c,_0x21def4);}else{logger['error'](_0x9f2a('0x1f'),_0x34def9,_0x8b47ff[_0x9f2a('0xb')]);_0x2060a4[_0x9f2a('0x12')]();}}}catch(_0x2bb0bf){console[_0x9f2a('0x20')](_0x2bb0bf);logger[_0x9f2a('0x21')](_0x9f2a('0x22'),_0x34def9,_0x2bb0bf[_0x9f2a('0x23')]);_0x2060a4['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index 5d90db5..fda9ae8 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 _0x68a6=['LexRuntime','$LATEST','message','amazonlex','providerName','providerResponse','stringify','dialogState','next','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','out','channel','sms','whatsapp','phone','interaction','ChatWebsiteId','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop'];(function(_0x33f257,_0x1e0ad1){var _0x327566=function(_0x4c1b5f){while(--_0x4c1b5f){_0x33f257['push'](_0x33f257['shift']());}};_0x327566(++_0x1e0ad1);}(_0x68a6,0x67));var _0x668a=function(_0x2d63a5,_0x433cdc){_0x2d63a5=_0x2d63a5-0x0;var _0x576ac1=_0x68a6[_0x2d63a5];return _0x576ac1;};'use strict';var _=require(_0x668a('0x0'));var moment=require(_0x668a('0x1'));var AWS=require(_0x668a('0x2'));var utils=require('./utils');var logger=require(_0x668a('0x3'))(_0x668a('0x4'));var rpc={'chatMessage':require(_0x668a('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x668a('0x6')),'smsMessage':require(_0x668a('0x7')),'faxMessage':require(_0x668a('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x668a('0x9')]=function(_0x5d17d2,_0x22e2fc){return function(_0x5309aa){try{if(!_[_0x668a('0xa')](this['interaction'][_0x668a('0xb')])){logger[_0x668a('0xc')](_0x668a('0xd'),_0x5d17d2,_0x668a('0xe'));return _0x5309aa['next']();}var _0xafb44b={'ContactId':this['contact']['id'],'sentAt':moment()[_0x668a('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x668a('0x10')};if(this[_0x668a('0x11')]===_0x668a('0x12')||this[_0x668a('0x11')]===_0x668a('0x13')){_0xafb44b[_0x668a('0x14')]=this[_0x668a('0x15')][_0x668a('0x14')];}var _0x4759f2=this['channel'];if(_0x4759f2==='chat'){_0xafb44b[_0x668a('0x16')]=this['account']['id'];}else{_0xafb44b[_[_0x668a('0x17')](_0x4759f2)+_0x668a('0x18')]=this['account']['id'];}_0xafb44b[_[_0x668a('0x17')](_0x4759f2)+_0x668a('0x19')]=this['interaction']['id'];if(this[_0x668a('0x15')][_0x668a('0x1a')]){var _0x440800=_0x22e2fc[0x4];if(!_[_0x668a('0x1b')](_0x440800)){_0xafb44b[_0x668a('0x1c')]=utils[_0x668a('0x1d')](_0x440800,this);return rpc[_0x4759f2+_0x668a('0x1e')][_0x668a('0x1f')](_0xafb44b)[_0x668a('0x20')](function(_0x169f19){logger[_0x668a('0xc')](_0x668a('0xd'),_0x5d17d2,_0xafb44b['body']);})[_0x668a('0x21')](function(_0x598f8c){logger[_0x668a('0x22')]('[%s][AMAZONLEX]\x20%s',_0x5d17d2,JSON['stringify'](_0x598f8c));})[_0x668a('0x23')](function(){logger[_0x668a('0xc')](_0x668a('0x24'),_0x5d17d2);_0x5309aa[_0x668a('0x25')]();});}else{logger[_0x668a('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5d17d2);_0x5309aa[_0x668a('0x25')]();}}else{var _0x19c078=this;var _0x492872=new AWS[(_0x668a('0x26'))]({'accessKeyId':_0x22e2fc[0x0],'secretAccessKey':_0x22e2fc[0x1],'region':_0x22e2fc[0x2]});var _0x3a1372={'botAlias':_0x668a('0x27'),'botName':_0x22e2fc[0x3],'inputText':this['message']['body'],'userId':this[_0x668a('0x11')]+':'+this['interaction']['id']['toString']()};_0x492872['postText'](_0x3a1372,function(_0x51d027,_0x3714ff){if(_0x51d027){logger[_0x668a('0x22')](_0x668a('0xd'),_0x5d17d2,_0x51d027[_0x668a('0x28')]);_0x5309aa['next']();}else if(_0x3714ff&&_0x3714ff[_0x668a('0x28')]){_0x19c078[_0x668a('0x1c')][_0x668a('0x29')]=_0x3714ff;_0xafb44b[_0x668a('0x1c')]=_0x3714ff[_0x668a('0x28')];_0xafb44b[_0x668a('0x2a')]=_0x668a('0x29');_0xafb44b[_0x668a('0x2b')]=JSON[_0x668a('0x2c')](_0x3714ff);return rpc[_0x4759f2+_0x668a('0x1e')][_0x668a('0x1f')](_0xafb44b)[_0x668a('0x20')](function(_0x2d7ec3){logger[_0x668a('0xc')]('[%s][AMAZONLEX]\x20%s',_0x5d17d2,_0xafb44b[_0x668a('0x1c')]);if(_0x3714ff[_0x668a('0x2d')]=='Failed'){_0x5309aa[_0x668a('0x2e')]();}else{_0x5309aa[_0x668a('0x25')]();}})['catch'](function(_0x5a8cf9){logger[_0x668a('0x22')](_0x668a('0xd'),_0x5d17d2,JSON[_0x668a('0x2c')](_0x5a8cf9));_0x5309aa[_0x668a('0x2e')]();});}else{_0x5309aa[_0x668a('0x2e')]();}});}}catch(_0x4567e0){logger[_0x668a('0x22')](_0x668a('0xd'),_0x5d17d2,JSON[_0x668a('0x2c')](_0x4567e0));_0x5309aa['stop']();}};}; \ No newline at end of file +var _0x6005=['created','isEmpty','body','Message','then','catch','error','finally','stop','$LATEST','message','toString','postText','amazonlex','providerResponse','create','stringify','lodash','moment','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId'];(function(_0x425a94,_0x41a542){var _0x1f16fa=function(_0x43863e){while(--_0x43863e){_0x425a94['push'](_0x425a94['shift']());}};_0x1f16fa(++_0x41a542);}(_0x6005,0x95));var _0x5600=function(_0xdc8974,_0x1542ac){_0xdc8974=_0xdc8974-0x0;var _0x1573c4=_0x6005[_0xdc8974];return _0x1573c4;};'use strict';var _=require(_0x5600('0x0'));var moment=require(_0x5600('0x1'));var AWS=require('aws-sdk');var utils=require(_0x5600('0x2'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x5600('0x3')),'openchannelMessage':require(_0x5600('0x4')),'mailMessage':require(_0x5600('0x5')),'smsMessage':require(_0x5600('0x6')),'faxMessage':require(_0x5600('0x7')),'whatsappMessage':require(_0x5600('0x8'))};exports[_0x5600('0x9')]=function(_0x27dfda,_0x2d45fc){return function(_0x46dbe8){try{if(!_[_0x5600('0xa')](this[_0x5600('0xb')]['UserId'])){logger[_0x5600('0xc')](_0x5600('0xd'),_0x27dfda,_0x5600('0xe'));return _0x46dbe8[_0x5600('0xf')]();}var _0x191f2a={'ContactId':this[_0x5600('0x10')]['id'],'sentAt':moment()[_0x5600('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x5600('0x12')};if(this[_0x5600('0x13')]===_0x5600('0x14')||this[_0x5600('0x13')]===_0x5600('0x15')){_0x191f2a[_0x5600('0x16')]=this[_0x5600('0xb')][_0x5600('0x16')];}var _0x331bc1=this[_0x5600('0x13')];if(_0x331bc1==='chat'){_0x191f2a[_0x5600('0x17')]=this[_0x5600('0x18')]['id'];}else{_0x191f2a[_[_0x5600('0x19')](_0x331bc1)+_0x5600('0x1a')]=this[_0x5600('0x18')]['id'];}_0x191f2a[_['upperFirst'](_0x331bc1)+'InteractionId']=this[_0x5600('0xb')]['id'];if(this['interaction'][_0x5600('0x1b')]){var _0x259ba4=_0x2d45fc[0x4];if(!_[_0x5600('0x1c')](_0x259ba4)){_0x191f2a[_0x5600('0x1d')]=utils['getMustacheRender'](_0x259ba4,this);return rpc[_0x331bc1+_0x5600('0x1e')]['create'](_0x191f2a)[_0x5600('0x1f')](function(_0x2dff75){logger['info'](_0x5600('0xd'),_0x27dfda,_0x191f2a[_0x5600('0x1d')]);})[_0x5600('0x20')](function(_0x31f127){logger[_0x5600('0x21')](_0x5600('0xd'),_0x27dfda,JSON['stringify'](_0x31f127));})[_0x5600('0x22')](function(){logger[_0x5600('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x27dfda);_0x46dbe8[_0x5600('0x23')]();});}else{logger[_0x5600('0xc')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x27dfda);_0x46dbe8['stop']();}}else{var _0x1a9a18=this;var _0x25da71=new AWS['LexRuntime']({'accessKeyId':_0x2d45fc[0x0],'secretAccessKey':_0x2d45fc[0x1],'region':_0x2d45fc[0x2]});var _0x55609f={'botAlias':_0x5600('0x24'),'botName':_0x2d45fc[0x3],'inputText':this[_0x5600('0x25')][_0x5600('0x1d')],'userId':this[_0x5600('0x13')]+':'+this[_0x5600('0xb')]['id'][_0x5600('0x26')]()};_0x25da71[_0x5600('0x27')](_0x55609f,function(_0x42ef21,_0x916efe){if(_0x42ef21){logger[_0x5600('0x21')](_0x5600('0xd'),_0x27dfda,_0x42ef21['message']);_0x46dbe8[_0x5600('0xf')]();}else if(_0x916efe&&_0x916efe[_0x5600('0x25')]){_0x1a9a18['body'][_0x5600('0x28')]=_0x916efe;_0x191f2a[_0x5600('0x1d')]=_0x916efe[_0x5600('0x25')];_0x191f2a['providerName']=_0x5600('0x28');_0x191f2a[_0x5600('0x29')]=JSON['stringify'](_0x916efe);return rpc[_0x331bc1+_0x5600('0x1e')][_0x5600('0x2a')](_0x191f2a)[_0x5600('0x1f')](function(_0x39d260){logger['info']('[%s][AMAZONLEX]\x20%s',_0x27dfda,_0x191f2a[_0x5600('0x1d')]);if(_0x916efe['dialogState']=='Failed'){_0x46dbe8[_0x5600('0xf')]();}else{_0x46dbe8[_0x5600('0x23')]();}})['catch'](function(_0x4d2ed4){logger[_0x5600('0x21')](_0x5600('0xd'),_0x27dfda,JSON[_0x5600('0x2b')](_0x4d2ed4));_0x46dbe8[_0x5600('0xf')]();});}else{_0x46dbe8[_0x5600('0xf')]();}});}}catch(_0x26d6b7){logger['error'](_0x5600('0xd'),_0x27dfda,JSON[_0x5600('0x2b')](_0x26d6b7));_0x46dbe8[_0x5600('0x23')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 829c1e6..9e1d4c7 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 _0x1ff5=['./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','channel','mail','body','isAutoreply','next','isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','chat','account','upperFirst','AccountId','InteractionId','Message','Smtp','service','host','port','secure','auth','user','pass','inReplyTo','html','','replace','','headers','auto-replied','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','stringify','resolve','update','catch','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','Interaction','lodash','moment'];(function(_0x30764b,_0x4b85d5){var _0x4153d1=function(_0x338bff){while(--_0x338bff){_0x30764b['push'](_0x30764b['shift']());}};_0x4153d1(++_0x4b85d5);}(_0x1ff5,0x15c));var _0x51ff=function(_0x5d5a16,_0xd9d6bb){_0x5d5a16=_0x5d5a16-0x0;var _0x58e7fe=_0x1ff5[_0x5d5a16];return _0x58e7fe;};'use strict';var _=require(_0x51ff('0x0'));var moment=require(_0x51ff('0x1'));var utils=require(_0x51ff('0x2'));var logger=require('../../../../config/logger')(_0x51ff('0x3'));var rpc={'chatMessage':require(_0x51ff('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x51ff('0x5')),'smsMessage':require(_0x51ff('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x51ff('0x7')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x51ff('0x8')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x51ff('0x9')),'faxInteraction':require(_0x51ff('0xa')),'whatsappInteraction':require(_0x51ff('0xb'))};var mailRpc=require('../../mailRpc');exports[_0x51ff('0xc')]=function(_0xcaf9f4,_0x1ced0b,_0x34faf5,_0x542dae){return function(_0x5129bb){try{var _0x8b12=this[_0x51ff('0xd')];if(_0x8b12===_0x51ff('0xe')&&_0x542dae[_0x51ff('0xf')][_0x51ff('0x10')]){logger['info']('[%s][AUTOREPLY]\x20%s',_0xcaf9f4,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x5129bb[_0x51ff('0x11')]();}if(_0x1ced0b[0x0]==='1'&&(_[_0x51ff('0x12')](this[_0x51ff('0x13')][_0x51ff('0x14')])||!this[_0x51ff('0x13')][_0x51ff('0x14')])){logger[_0x51ff('0x15')](_0x51ff('0x16'),_0xcaf9f4,_0x51ff('0x17'));return _0x5129bb[_0x51ff('0x11')]();}if(_0x1ced0b[0x0]==='2'&&this['interaction'][_0x51ff('0x18')]){logger[_0x51ff('0x15')](_0x51ff('0x19'),_0xcaf9f4,'One\x20Time\x20already\x20sent');return _0x5129bb[_0x51ff('0x11')]();}var _0x241b51={'ContactId':this[_0x51ff('0x1a')]['id'],'sentAt':moment()[_0x51ff('0x1b')](_0x51ff('0x1c')),'direction':_0x51ff('0x1d')};if(this[_0x51ff('0xd')]===_0x51ff('0xe')){_0x241b51[_0x51ff('0xf')]=utils['getMustacheRender'](_0x1ced0b[0x2],this);}else{_0x241b51[_0x51ff('0xf')]=utils[_0x51ff('0x1e')](_0x1ced0b[0x1],this);}if(this['message']){_0x241b51['to']=this[_0x51ff('0x1f')][_0x51ff('0x20')]||'';if(this[_0x51ff('0xd')]===_0x51ff('0xe')&&_0x1ced0b[0x1]==='1'){_0x241b51['cc']=this[_0x51ff('0x1f')]['cc']||'';}_0x241b51[_0x51ff('0x20')]=this[_0x51ff('0x1f')]['to']||'';_0x241b51[_0x51ff('0x21')]=this[_0x51ff('0x1f')][_0x51ff('0x21')]||'';_0x241b51[_0x51ff('0x22')]=!![];if(this[_0x51ff('0x1f')][_0x51ff('0x23')]){_0x241b51[_0x51ff('0x23')]='';_0x241b51[_0x51ff('0x23')]+=_['startsWith'](this['message'][_0x51ff('0x23')],'Re:')?'':'Re:\x20';_0x241b51[_0x51ff('0x23')]+=this[_0x51ff('0x1f')][_0x51ff('0x23')];}}if(this['channel']===_0x51ff('0x24')){_0x241b51['ChatWebsiteId']=this[_0x51ff('0x25')]['id'];}else{_0x241b51[_[_0x51ff('0x26')](this[_0x51ff('0xd')])+_0x51ff('0x27')]=this[_0x51ff('0x25')]['id'];}_0x241b51[_[_0x51ff('0x26')](this[_0x51ff('0xd')])+_0x51ff('0x28')]=this[_0x51ff('0x13')]['id'];var _0x2a9b68=this[_0x51ff('0x13')];if(rpc[this[_0x51ff('0xd')]+_0x51ff('0x29')]){if(this['channel']===_0x51ff('0xe')){var _0xb58431={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x51ff('0x2a')][_0x51ff('0x2b')]){_0xb58431['service']=this[_0x51ff('0x25')]['Smtp']['service'];}else{_0xb58431['host']=this[_0x51ff('0x25')][_0x51ff('0x2a')][_0x51ff('0x2c')];_0xb58431[_0x51ff('0x2d')]=this[_0x51ff('0x25')]['Smtp'][_0x51ff('0x2d')];_0xb58431[_0x51ff('0x2e')]=this[_0x51ff('0x25')][_0x51ff('0x2a')][_0x51ff('0x2e')];}if(this['account']['Smtp']['authentication']){_0xb58431[_0x51ff('0x2f')]={'user':this['account'][_0x51ff('0x2a')][_0x51ff('0x30')],'pass':this[_0x51ff('0x25')]['Smtp'][_0x51ff('0x31')]};}_0x241b51[_0x51ff('0x32')]=this[_0x51ff('0x1f')]['messageId'];_0x241b51[_0x51ff('0x33')]=_0x51ff('0x34')+_[_0x51ff('0x35')](_0x241b51[_0x51ff('0xf')],_0x51ff('0x36'),_0x51ff('0x37'))+_0x51ff('0x38');_0x241b51[_0x51ff('0x39')]={'Auto-Submitted':_0x51ff('0x3a'),'X-Auto-Response-Suppress':'All','Precedence':'auto_reply'};return mailRpc['sendMailMessage'](_0xb58431,_0x241b51)[_0x51ff('0x3b')](function(_0x1eb9f2){logger['info'](_0x51ff('0x3c'),_0xcaf9f4);_0x241b51['messageId']=_0x1eb9f2[_0x51ff('0x1f')][_0x51ff('0x3d')];return rpc[_0x8b12+_0x51ff('0x29')]['create'](_0x241b51);})['then'](function(_0x596982){logger[_0x51ff('0x15')](_0x51ff('0x16'),_0xcaf9f4,JSON[_0x51ff('0x3e')](_0x596982));})['catch'](function(_0x2e7d52){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0xcaf9f4,JSON['stringify'](_0x2e7d52));})['finally'](function(){Promise[_0x51ff('0x3f')]()['then'](function(){if(_0x1ced0b[0x0]!=='2'||_0x2a9b68[_0x51ff('0x18')])return;return rpc[_0x8b12+'Interaction'][_0x51ff('0x40')](_0x2a9b68['id'],{'autoreplyExecuted':!![]})[_0x51ff('0x3b')](function(_0x3cc57a){logger[_0x51ff('0x15')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xcaf9f4,JSON[_0x51ff('0x3e')](_0x3cc57a));})[_0x51ff('0x41')](function(_0x1996b2){logger[_0x51ff('0x42')](_0x51ff('0x43'),_0xcaf9f4,JSON[_0x51ff('0x3e')](_0x1996b2));});})[_0x51ff('0x3b')](function(){_0x5129bb['next']();});});}else{return rpc[this['channel']+_0x51ff('0x29')][_0x51ff('0x44')](_0x241b51)[_0x51ff('0x3b')](function(_0x360f13){logger[_0x51ff('0x15')]('[%s][AUTOREPLY]\x20%s',_0xcaf9f4,_0x241b51[_0x51ff('0xf')]);})[_0x51ff('0x41')](function(_0x872367){logger[_0x51ff('0x42')]('[%s][AUTOREPLY]\x20%s',_0xcaf9f4,JSON['stringify'](_0x872367));})['finally'](function(){Promise[_0x51ff('0x3f')]()[_0x51ff('0x3b')](function(){if(_0x1ced0b[0x0]!=='2'||_0x2a9b68[_0x51ff('0x18')])return;return rpc[_0x8b12+_0x51ff('0x45')][_0x51ff('0x40')](_0x2a9b68['id'],{'autoreplyExecuted':!![]})['then'](function(_0x3fd234){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xcaf9f4,JSON['stringify'](_0x3fd234));})[_0x51ff('0x41')](function(_0xfbabb){logger['error'](_0x51ff('0x43'),_0xcaf9f4,JSON[_0x51ff('0x3e')](_0xfbabb));});})['then'](function(){_0x5129bb[_0x51ff('0x11')]();});});}}}catch(_0xe39a04){logger[_0x51ff('0x42')](_0x51ff('0x16'),_0xcaf9f4,JSON[_0x51ff('0x3e')](_0xe39a04));_0x5129bb['stop']();}};}; \ No newline at end of file +var _0x3e46=['../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','mail','body','isAutoreply','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','info','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','channel','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Smtp','host','port','secure','authentication','auth','user','inReplyTo','','','All','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','Message','create','then','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','catch','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','routing','../../rpc/openchannelMessage'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x3e46,0x11f));var _0x63e4=function(_0x490726,_0x4728a6){_0x490726=_0x490726-0x0;var _0x55d52e=_0x3e46[_0x490726];return _0x55d52e;};'use strict';var _=require(_0x63e4('0x0'));var moment=require(_0x63e4('0x1'));var utils=require(_0x63e4('0x2'));var logger=require('../../../../config/logger')(_0x63e4('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x63e4('0x4')),'mailMessage':require(_0x63e4('0x5')),'smsMessage':require(_0x63e4('0x6')),'faxMessage':require(_0x63e4('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x63e4('0x8')),'openchannelInteraction':require(_0x63e4('0x9')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x63e4('0xa')),'faxInteraction':require(_0x63e4('0xb')),'whatsappInteraction':require(_0x63e4('0xc'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x417336,_0xfddc6c,_0x315c11,_0x44cc39){return function(_0x1a98a6){try{var _0x40ca9b=this['channel'];if(_0x40ca9b===_0x63e4('0xd')&&_0x44cc39[_0x63e4('0xe')][_0x63e4('0xf')]){logger['info'](_0x63e4('0x10'),_0x417336,_0x63e4('0x11'));return _0x1a98a6['next']();}if(_0xfddc6c[0x0]==='1'&&(_[_0x63e4('0x12')](this[_0x63e4('0x13')][_0x63e4('0x14')])||!this[_0x63e4('0x13')]['created'])){logger[_0x63e4('0x15')]('[%s][AUTOREPLY]\x20%s',_0x417336,_0x63e4('0x16'));return _0x1a98a6[_0x63e4('0x17')]();}if(_0xfddc6c[0x0]==='2'&&this[_0x63e4('0x13')][_0x63e4('0x18')]){logger[_0x63e4('0x15')](_0x63e4('0x19'),_0x417336,_0x63e4('0x1a'));return _0x1a98a6['next']();}var _0x134147={'ContactId':this[_0x63e4('0x1b')]['id'],'sentAt':moment()['format'](_0x63e4('0x1c')),'direction':'out'};if(this[_0x63e4('0x1d')]===_0x63e4('0xd')){_0x134147[_0x63e4('0xe')]=utils[_0x63e4('0x1e')](_0xfddc6c[0x2],this);}else{_0x134147['body']=utils[_0x63e4('0x1e')](_0xfddc6c[0x1],this);}if(this['message']){_0x134147['to']=this[_0x63e4('0x1f')][_0x63e4('0x20')]||'';if(this[_0x63e4('0x1d')]===_0x63e4('0xd')&&_0xfddc6c[0x1]==='1'){_0x134147['cc']=this[_0x63e4('0x1f')]['cc']||'';}_0x134147[_0x63e4('0x20')]=this['message']['to']||'';_0x134147[_0x63e4('0x21')]=this[_0x63e4('0x1f')][_0x63e4('0x21')]||'';_0x134147[_0x63e4('0x22')]=!![];if(this[_0x63e4('0x1f')]['subject']){_0x134147[_0x63e4('0x23')]='';_0x134147[_0x63e4('0x23')]+=_[_0x63e4('0x24')](this[_0x63e4('0x1f')][_0x63e4('0x23')],_0x63e4('0x25'))?'':_0x63e4('0x26');_0x134147[_0x63e4('0x23')]+=this[_0x63e4('0x1f')][_0x63e4('0x23')];}}if(this[_0x63e4('0x1d')]===_0x63e4('0x27')){_0x134147[_0x63e4('0x28')]=this[_0x63e4('0x29')]['id'];}else{_0x134147[_[_0x63e4('0x2a')](this[_0x63e4('0x1d')])+_0x63e4('0x2b')]=this[_0x63e4('0x29')]['id'];}_0x134147[_[_0x63e4('0x2a')](this['channel'])+_0x63e4('0x2c')]=this[_0x63e4('0x13')]['id'];var _0x45eba9=this[_0x63e4('0x13')];if(rpc[this[_0x63e4('0x1d')]+'Message']){if(this['channel']===_0x63e4('0xd')){var _0x5789da={'tls':{'rejectUnauthorized':![]}};if(this[_0x63e4('0x29')][_0x63e4('0x2d')]['service']){_0x5789da['service']=this[_0x63e4('0x29')][_0x63e4('0x2d')]['service'];}else{_0x5789da[_0x63e4('0x2e')]=this[_0x63e4('0x29')][_0x63e4('0x2d')][_0x63e4('0x2e')];_0x5789da['port']=this[_0x63e4('0x29')][_0x63e4('0x2d')][_0x63e4('0x2f')];_0x5789da['secure']=this[_0x63e4('0x29')]['Smtp'][_0x63e4('0x30')];}if(this[_0x63e4('0x29')]['Smtp'][_0x63e4('0x31')]){_0x5789da[_0x63e4('0x32')]={'user':this[_0x63e4('0x29')]['Smtp'][_0x63e4('0x33')],'pass':this[_0x63e4('0x29')][_0x63e4('0x2d')]['pass']};}_0x134147[_0x63e4('0x34')]=this['message']['messageId'];_0x134147['html']=_0x63e4('0x35')+_['replace'](_0x134147['body'],_0x63e4('0x36'),_0x63e4('0x37'))+_0x63e4('0x38');_0x134147['headers']={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x63e4('0x39'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](_0x5789da,_0x134147)['then'](function(_0x31038a){logger[_0x63e4('0x15')](_0x63e4('0x3a'),_0x417336);_0x134147[_0x63e4('0x3b')]=_0x31038a[_0x63e4('0x1f')][_0x63e4('0x3b')];return rpc[_0x40ca9b+_0x63e4('0x3c')][_0x63e4('0x3d')](_0x134147);})[_0x63e4('0x3e')](function(_0x5ac6bc){logger[_0x63e4('0x15')]('[%s][AUTOREPLY]\x20%s',_0x417336,JSON[_0x63e4('0x3f')](_0x5ac6bc));})['catch'](function(_0x2a363c){logger[_0x63e4('0x40')](_0x63e4('0x41'),_0x417336,JSON[_0x63e4('0x3f')](_0x2a363c));})[_0x63e4('0x42')](function(){Promise[_0x63e4('0x43')]()[_0x63e4('0x3e')](function(){if(_0xfddc6c[0x0]!=='2'||_0x45eba9['autoreplyExecuted'])return;return rpc[_0x40ca9b+_0x63e4('0x44')][_0x63e4('0x45')](_0x45eba9['id'],{'autoreplyExecuted':!![]})[_0x63e4('0x3e')](function(_0x1b969d){logger[_0x63e4('0x15')](_0x63e4('0x19'),_0x417336,JSON['stringify'](_0x1b969d));})[_0x63e4('0x46')](function(_0x1069ca){logger[_0x63e4('0x40')](_0x63e4('0x47'),_0x417336,JSON['stringify'](_0x1069ca));});})[_0x63e4('0x3e')](function(){_0x1a98a6[_0x63e4('0x17')]();});});}else{return rpc[this[_0x63e4('0x1d')]+_0x63e4('0x3c')][_0x63e4('0x3d')](_0x134147)[_0x63e4('0x3e')](function(_0x42aa39){logger[_0x63e4('0x15')](_0x63e4('0x10'),_0x417336,_0x134147[_0x63e4('0xe')]);})['catch'](function(_0x2800cb){logger[_0x63e4('0x40')](_0x63e4('0x10'),_0x417336,JSON['stringify'](_0x2800cb));})['finally'](function(){Promise[_0x63e4('0x43')]()[_0x63e4('0x3e')](function(){if(_0xfddc6c[0x0]!=='2'||_0x45eba9[_0x63e4('0x18')])return;return rpc[_0x40ca9b+_0x63e4('0x44')][_0x63e4('0x45')](_0x45eba9['id'],{'autoreplyExecuted':!![]})[_0x63e4('0x3e')](function(_0x122fcb){logger['info'](_0x63e4('0x19'),_0x417336,JSON[_0x63e4('0x3f')](_0x122fcb));})[_0x63e4('0x46')](function(_0x2ed429){logger[_0x63e4('0x40')](_0x63e4('0x47'),_0x417336,JSON[_0x63e4('0x3f')](_0x2ed429));});})[_0x63e4('0x3e')](function(){_0x1a98a6['next']();});});}}}catch(_0x120b82){logger[_0x63e4('0x40')](_0x63e4('0x10'),_0x417336,JSON[_0x63e4('0x3f')](_0x120b82));_0x1a98a6[_0x63e4('0x48')]();}};}; \ 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 f319965..c6db67a 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 _0x8d3d=['../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','interaction','error','stringify','finally','stop','moment','../../../../config/logger'];(function(_0x1cf63c,_0xfdfeea){var _0x5dcc26=function(_0x15154b){while(--_0x15154b){_0x1cf63c['push'](_0x1cf63c['shift']());}};_0x5dcc26(++_0xfdfeea);}(_0x8d3d,0x8e));var _0xd8d3=function(_0x3246d9,_0x44bd95){_0x3246d9=_0x3246d9-0x0;var _0x3066c2=_0x8d3d[_0x3246d9];return _0x3066c2;};'use strict';var moment=require(_0xd8d3('0x0'));var logger=require(_0xd8d3('0x1'))('routing');var rpc={'chatInteraction':require(_0xd8d3('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xd8d3('0x3')),'mailInteraction':require(_0xd8d3('0x4')),'faxInteraction':require(_0xd8d3('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xd8d3('0x6')]=function(_0x2f9360,_0x1ecb7f,_0xd652b2,_0x4d41b3){return function(_0x19af0b){try{logger[_0xd8d3('0x7')](_0xd8d3('0x8'),_0x2f9360,_0x1ecb7f[0x0]);var _0x41f175={'closed':0x1,'closedAt':moment()['format'](_0xd8d3('0x9')),'closeReason':_0xd8d3('0xa'),'disposition':_0x1ecb7f[0x0]};if(rpc[_0x4d41b3[_0xd8d3('0xb')]+_0xd8d3('0xc')]){rpc[_0x4d41b3['channel']+_0xd8d3('0xc')]['update'](_0x4d41b3['interaction']['id'],_0x41f175)['then'](function(_0x475a73){logger['info']('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x2f9360,_0x4d41b3[_0xd8d3('0xd')]['id']);})['catch'](function(_0x374424){logger[_0xd8d3('0xe')]('[%s][CLOSE]\x20%s',_0x2f9360,JSON[_0xd8d3('0xf')](_0x374424));})[_0xd8d3('0x10')](function(){_0x19af0b[_0xd8d3('0x11')]();});}}catch(_0x27acc2){logger['error']('[%s][CLOSE]\x20%s',_0x2f9360,JSON[_0xd8d3('0xf')](_0x27acc2));_0x19af0b[_0xd8d3('0x11')]();}};}; \ No newline at end of file +var _0x10db=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','error','../../../../config/logger','../../rpc/smsInteraction'];(function(_0x1763e5,_0x5603eb){var _0x1962b4=function(_0x5ec687){while(--_0x5ec687){_0x1763e5['push'](_0x1763e5['shift']());}};_0x1962b4(++_0x5603eb);}(_0x10db,0x96));var _0xb10d=function(_0x23dfcd,_0x21b8ea){_0x23dfcd=_0x23dfcd-0x0;var _0x1387fe=_0x10db[_0x23dfcd];return _0x1387fe;};'use strict';var moment=require('moment');var logger=require(_0xb10d('0x0'))('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0xb10d('0x1')),'mailInteraction':require(_0xb10d('0x2')),'faxInteraction':require(_0xb10d('0x3')),'whatsappInteraction':require(_0xb10d('0x4'))};exports[_0xb10d('0x5')]=function(_0x3ab406,_0x3cc0b1,_0x383644,_0x16cca0){return function(_0x4f2f1f){try{logger[_0xb10d('0x6')](_0xb10d('0x7'),_0x3ab406,_0x3cc0b1[0x0]);var _0x353d3a={'closed':0x1,'closedAt':moment()['format'](_0xb10d('0x8')),'closeReason':'system','disposition':_0x3cc0b1[0x0]};if(rpc[_0x16cca0[_0xb10d('0x9')]+'Interaction']){rpc[_0x16cca0[_0xb10d('0x9')]+_0xb10d('0xa')]['update'](_0x16cca0[_0xb10d('0xb')]['id'],_0x353d3a)['then'](function(_0x40bf11){logger['info'](_0xb10d('0xc'),_0x3ab406,_0x16cca0[_0xb10d('0xb')]['id']);})[_0xb10d('0xd')](function(_0x4ab849){logger['error'](_0xb10d('0xe'),_0x3ab406,JSON[_0xb10d('0xf')](_0x4ab849));})[_0xb10d('0x10')](function(){_0x4f2f1f[_0xb10d('0x11')]();});}}catch(_0x1ec6d1){logger[_0xb10d('0x12')](_0xb10d('0xe'),_0x3ab406,JSON['stringify'](_0x1ec6d1));_0x4f2f1f[_0xb10d('0x11')]();}};}; \ 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 c50fca2..d0db7b1 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 _0xb422=['stringify','metadata','endConversation','error','md5','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','[%s][DIALOGFLOW]\x20%s','next','contact','format','out','channel','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','Message','create','then','info','catch','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','message','dialogflow','result','speech','providerName','providerResponse'];(function(_0x25fcd8,_0x1104f1){var _0x356ddf=function(_0x1fb3f3){while(--_0x1fb3f3){_0x25fcd8['push'](_0x25fcd8['shift']());}};_0x356ddf(++_0x1104f1);}(_0xb422,0x85));var _0x2b42=function(_0x277a8d,_0x8f4900){_0x277a8d=_0x277a8d-0x0;var _0x3e1793=_0xb422[_0x277a8d];return _0x3e1793;};'use strict';var _=require('lodash');var moment=require('moment');var apiai=require('apiai-promise');var md5=require(_0x2b42('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x2b42('0x1'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2b42('0x2')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2b42('0x3')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x2b42('0x4'))};exports[_0x2b42('0x5')]=function(_0x750c2,_0x51b3bd){return function(_0xde9c67){try{if(!_[_0x2b42('0x6')](this[_0x2b42('0x7')]['UserId'])){logger['info'](_0x2b42('0x8'),_0x750c2,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0xde9c67[_0x2b42('0x9')]();}var _0xcc84af={'ContactId':this[_0x2b42('0xa')]['id'],'sentAt':moment()[_0x2b42('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x2b42('0xc')};if(this[_0x2b42('0xd')]==='sms'||this[_0x2b42('0xd')]===_0x2b42('0xe')){_0xcc84af[_0x2b42('0xf')]=this[_0x2b42('0x7')]['phone'];}var _0x5054fe=this[_0x2b42('0xd')];if(_0x5054fe===_0x2b42('0x10')){_0xcc84af['ChatWebsiteId']=this[_0x2b42('0x11')]['id'];}else{_0xcc84af[_[_0x2b42('0x12')](_0x5054fe)+_0x2b42('0x13')]=this[_0x2b42('0x11')]['id'];}_0xcc84af[_[_0x2b42('0x12')](_0x5054fe)+_0x2b42('0x14')]=this[_0x2b42('0x7')]['id'];if(this[_0x2b42('0x7')][_0x2b42('0x15')]){var _0x1f7e7a=_0x51b3bd[0x2];if(!_['isEmpty'](_0x1f7e7a)){_0xcc84af[_0x2b42('0x16')]=utils[_0x2b42('0x17')](_0x1f7e7a,this);return rpc[_0x5054fe+_0x2b42('0x18')][_0x2b42('0x19')](_0xcc84af)[_0x2b42('0x1a')](function(_0x3ab83c){logger[_0x2b42('0x1b')](_0x2b42('0x8'),_0x750c2,_0xcc84af['body']);})[_0x2b42('0x1c')](function(_0x27d80a){logger['error'](_0x2b42('0x8'),_0x750c2,JSON['stringify'](_0x27d80a));})[_0x2b42('0x1d')](function(){logger[_0x2b42('0x1b')](_0x2b42('0x1e'),_0x750c2);_0xde9c67['stop']();});}else{logger['info'](_0x2b42('0x1f'),_0x750c2);_0xde9c67[_0x2b42('0x20')]();}}else{var _0x24ac96=this;var _0x2ee957=apiai(_0x51b3bd[0x0],{'language':_0x51b3bd[0x1]||'en'});return _0x2ee957['textRequest'](this[_0x2b42('0x21')][_0x2b42('0x16')],{'sessionId':md5(this['interaction']['id'])})[_0x2b42('0x1a')](function(_0x2e9aa1){_0x24ac96[_0x2b42('0x16')][_0x2b42('0x22')]=_0x2e9aa1;_0xcc84af[_0x2b42('0x16')]=_0x2e9aa1[_0x2b42('0x23')]['fulfillment'][_0x2b42('0x24')];_0xcc84af[_0x2b42('0x25')]=_0x2b42('0x22');_0xcc84af[_0x2b42('0x26')]=JSON[_0x2b42('0x27')](_0x2e9aa1);return rpc[_0x5054fe+_0x2b42('0x18')][_0x2b42('0x19')](_0xcc84af)[_0x2b42('0x1a')](function(_0x2db5d7){logger[_0x2b42('0x1b')](_0x2b42('0x8'),_0x750c2,_0xcc84af['body']);if(_0x2e9aa1['result'][_0x2b42('0x28')][_0x2b42('0x29')]){_0xde9c67[_0x2b42('0x9')]();}else{_0xde9c67[_0x2b42('0x20')]();}})['catch'](function(_0x286223){logger[_0x2b42('0x2a')](_0x2b42('0x8'),_0x750c2,JSON['stringify'](_0x286223));_0xde9c67['next']();});})[_0x2b42('0x1c')](function(_0x15298d){logger[_0x2b42('0x2a')](_0x2b42('0x8'),_0x750c2,_0x15298d['message']);_0xde9c67[_0x2b42('0x9')]();});}}catch(_0x38148e){logger[_0x2b42('0x2a')]('[%s][DIALOGFLOW]\x20%s',_0x750c2,JSON[_0x2b42('0x27')](_0x38148e));_0xde9c67[_0x2b42('0x20')]();}};}; \ No newline at end of file +var _0x2d2c=['InteractionId','created','isEmpty','body','getMustacheRender','create','then','catch','error','stringify','finally','stop','message','dialogflow','fulfillment','speech','providerName','providerResponse','result','metadata','endConversation','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','ChatWebsiteId','AccountId','account','upperFirst'];(function(_0x5cb063,_0x36958b){var _0x24288a=function(_0x287e0f){while(--_0x287e0f){_0x5cb063['push'](_0x5cb063['shift']());}};_0x24288a(++_0x36958b);}(_0x2d2c,0x1d7));var _0xc2d2=function(_0x402731,_0x43c115){_0x402731=_0x402731-0x0;var _0x111736=_0x2d2c[_0x402731];return _0x111736;};'use strict';var _=require(_0xc2d2('0x0'));var moment=require(_0xc2d2('0x1'));var apiai=require(_0xc2d2('0x2'));var md5=require(_0xc2d2('0x3'));var utils=require(_0xc2d2('0x4'));var logger=require(_0xc2d2('0x5'))('routing');var rpc={'chatMessage':require(_0xc2d2('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc2d2('0x7')),'smsMessage':require(_0xc2d2('0x8')),'faxMessage':require(_0xc2d2('0x9')),'whatsappMessage':require(_0xc2d2('0xa'))};exports[_0xc2d2('0xb')]=function(_0x5d2d3f,_0x54136b){return function(_0x241c02){try{if(!_[_0xc2d2('0xc')](this[_0xc2d2('0xd')][_0xc2d2('0xe')])){logger[_0xc2d2('0xf')](_0xc2d2('0x10'),_0x5d2d3f,_0xc2d2('0x11'));return _0x241c02[_0xc2d2('0x12')]();}var _0x43ecff={'ContactId':this[_0xc2d2('0x13')]['id'],'sentAt':moment()[_0xc2d2('0x14')](_0xc2d2('0x15')),'direction':'out'};if(this[_0xc2d2('0x16')]===_0xc2d2('0x17')||this[_0xc2d2('0x16')]==='whatsapp'){_0x43ecff[_0xc2d2('0x18')]=this[_0xc2d2('0xd')]['phone'];}var _0x8a3d9a=this[_0xc2d2('0x16')];if(_0x8a3d9a==='chat'){_0x43ecff[_0xc2d2('0x19')]=this['account']['id'];}else{_0x43ecff[_['upperFirst'](_0x8a3d9a)+_0xc2d2('0x1a')]=this[_0xc2d2('0x1b')]['id'];}_0x43ecff[_[_0xc2d2('0x1c')](_0x8a3d9a)+_0xc2d2('0x1d')]=this[_0xc2d2('0xd')]['id'];if(this[_0xc2d2('0xd')][_0xc2d2('0x1e')]){var _0x23957d=_0x54136b[0x2];if(!_[_0xc2d2('0x1f')](_0x23957d)){_0x43ecff[_0xc2d2('0x20')]=utils[_0xc2d2('0x21')](_0x23957d,this);return rpc[_0x8a3d9a+'Message'][_0xc2d2('0x22')](_0x43ecff)[_0xc2d2('0x23')](function(_0x34f750){logger[_0xc2d2('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x5d2d3f,_0x43ecff[_0xc2d2('0x20')]);})[_0xc2d2('0x24')](function(_0x5c8e79){logger[_0xc2d2('0x25')](_0xc2d2('0x10'),_0x5d2d3f,JSON[_0xc2d2('0x26')](_0x5c8e79));})[_0xc2d2('0x27')](function(){logger[_0xc2d2('0xf')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5d2d3f);_0x241c02[_0xc2d2('0x28')]();});}else{logger[_0xc2d2('0xf')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x5d2d3f);_0x241c02[_0xc2d2('0x28')]();}}else{var _0x4e3cb5=this;var _0x5ecf78=apiai(_0x54136b[0x0],{'language':_0x54136b[0x1]||'en'});return _0x5ecf78['textRequest'](this[_0xc2d2('0x29')][_0xc2d2('0x20')],{'sessionId':md5(this[_0xc2d2('0xd')]['id'])})['then'](function(_0x2dbc46){_0x4e3cb5[_0xc2d2('0x20')][_0xc2d2('0x2a')]=_0x2dbc46;_0x43ecff[_0xc2d2('0x20')]=_0x2dbc46['result'][_0xc2d2('0x2b')][_0xc2d2('0x2c')];_0x43ecff[_0xc2d2('0x2d')]=_0xc2d2('0x2a');_0x43ecff[_0xc2d2('0x2e')]=JSON[_0xc2d2('0x26')](_0x2dbc46);return rpc[_0x8a3d9a+'Message'][_0xc2d2('0x22')](_0x43ecff)[_0xc2d2('0x23')](function(_0x2613d2){logger[_0xc2d2('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x5d2d3f,_0x43ecff['body']);if(_0x2dbc46[_0xc2d2('0x2f')][_0xc2d2('0x30')][_0xc2d2('0x31')]){_0x241c02[_0xc2d2('0x12')]();}else{_0x241c02[_0xc2d2('0x28')]();}})[_0xc2d2('0x24')](function(_0x4d4af2){logger[_0xc2d2('0x25')](_0xc2d2('0x10'),_0x5d2d3f,JSON['stringify'](_0x4d4af2));_0x241c02[_0xc2d2('0x12')]();});})[_0xc2d2('0x24')](function(_0xd0f7de){logger[_0xc2d2('0x25')](_0xc2d2('0x10'),_0x5d2d3f,_0xd0f7de['message']);_0x241c02['next']();});}}catch(_0xcfe3dc){logger['error'](_0xc2d2('0x10'),_0x5d2d3f,JSON[_0xc2d2('0x26')](_0xcfe3dc));_0x241c02[_0xc2d2('0x28')]();}};}; \ 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 10d420b..12bf8ef 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 _0xce58=['finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','SessionsClient','message','detectIntent','then','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','intentDetectionConfidence','providerName','length','all','lodash','dialogflow','md5','moment','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','Message','create','[%s][DIALOGFLOWV2]\x20%s','body','catch','error','stringify','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','created','isEmpty','getMustacheRender'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xce58,0x1b4));var _0x8ce5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce58[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ce5('0x0'));var dialogflow=require(_0x8ce5('0x1'));var md5=require(_0x8ce5('0x2'));var moment=require(_0x8ce5('0x3'));var Promise=require('bluebird');var logger=require('../../../../config/logger')('routing');var utils=require(_0x8ce5('0x4'));var rpc={'chatMessage':require(_0x8ce5('0x5')),'openchannelMessage':require(_0x8ce5('0x6')),'mailMessage':require(_0x8ce5('0x7')),'smsMessage':require(_0x8ce5('0x8')),'faxMessage':require(_0x8ce5('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x4922a1,_0x554d8e,_0x43bb84,_0x1f5cfb){return new Promise(function(_0x502c77,_0x1df175){var _0x255507=_['clone'](_0x43bb84);_0x255507['body']=_0x1f5cfb;return rpc[_0x554d8e+_0x8ce5('0xa')][_0x8ce5('0xb')](_0x255507)['then'](function(){logger['info'](_0x8ce5('0xc'),_0x4922a1,_0x255507[_0x8ce5('0xd')]);_0x502c77();})[_0x8ce5('0xe')](function(_0x16b59c){logger[_0x8ce5('0xf')](_0x8ce5('0xc'),_0x4922a1,JSON[_0x8ce5('0x10')](_0x16b59c));_0x1df175(_0x16b59c);});});}exports['consequence']=function(_0xea380c,_0x62d4b0){return function(_0x18847b){try{if(!_[_0x8ce5('0x11')](this[_0x8ce5('0x12')][_0x8ce5('0x13')])){logger[_0x8ce5('0x14')]('[%s][DIALOGFLOWV2]\x20%s',_0xea380c,_0x8ce5('0x15'));return _0x18847b[_0x8ce5('0x16')]();}var _0x457345={'ContactId':this[_0x8ce5('0x17')]['id'],'sentAt':moment()[_0x8ce5('0x18')](_0x8ce5('0x19')),'direction':_0x8ce5('0x1a')};if(this[_0x8ce5('0x1b')]===_0x8ce5('0x1c')||this[_0x8ce5('0x1b')]===_0x8ce5('0x1d')){_0x457345['phone']=this[_0x8ce5('0x12')][_0x8ce5('0x1e')];}var _0x12527f=this['channel'];if(_0x12527f===_0x8ce5('0x1f')){_0x457345[_0x8ce5('0x20')]=this[_0x8ce5('0x21')]['id'];}else{_0x457345[_['upperFirst'](_0x12527f)+_0x8ce5('0x22')]=this[_0x8ce5('0x21')]['id'];}_0x457345[_[_0x8ce5('0x23')](_0x12527f)+_0x8ce5('0x24')]=this['interaction']['id'];if(this[_0x8ce5('0x12')][_0x8ce5('0x25')]){var _0x33c91f=_0x62d4b0[0x4];if(!_[_0x8ce5('0x26')](_0x33c91f)){_0x457345[_0x8ce5('0xd')]=utils[_0x8ce5('0x27')](_0x33c91f,this);return rpc[_0x12527f+_0x8ce5('0xa')][_0x8ce5('0xb')](_0x457345)['then'](function(_0x317bd7){logger[_0x8ce5('0x14')](_0x8ce5('0xc'),_0xea380c,_0x457345[_0x8ce5('0xd')]);})[_0x8ce5('0xe')](function(_0x3b7eaa){logger[_0x8ce5('0xf')](_0x8ce5('0xc'),_0xea380c,JSON['stringify'](_0x3b7eaa));})[_0x8ce5('0x28')](function(){logger[_0x8ce5('0x14')](_0x8ce5('0x29'),_0xea380c);_0x18847b[_0x8ce5('0x2a')]();});}else{logger['info']('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xea380c);_0x18847b[_0x8ce5('0x2a')]();}}else{var _0x49d65c=this;var _0x17c896=_0x62d4b0[0x2]['replace'](/\\n/g,'\x0a');var _0x74aade={'credentials':{'private_key':_0x17c896,'client_email':_0x62d4b0[0x1]}};var _0x4ae752=new dialogflow[(_0x8ce5('0x2b'))](_0x74aade);var _0x4b0bd0=_0x4ae752['sessionPath'](_0x62d4b0[0x0],md5(_0x49d65c[_0x8ce5('0x12')]['id']));var _0x42f6d7={'session':_0x4b0bd0,'queryInput':{'text':{'text':_0x49d65c[_0x8ce5('0x2c')][_0x8ce5('0xd')],'languageCode':_0x62d4b0[0x3]||'en'}}};return _0x4ae752[_0x8ce5('0x2d')](_0x42f6d7)[_0x8ce5('0x2e')](function(_0x46fbe3){if(_0x46fbe3&&_0x46fbe3['length']){_0x49d65c[_0x8ce5('0xd')][_0x8ce5('0x2f')]=_0x46fbe3;var _0x444d4f=_0x46fbe3[0x0];var _0x480670=_0x444d4f[_0x8ce5('0x30')][_0x8ce5('0x31')]&&_0x444d4f[_0x8ce5('0x30')]['diagnosticInfo'][_0x8ce5('0x32')]?_0x444d4f[_0x8ce5('0x30')][_0x8ce5('0x31')]['fields'][_0x8ce5('0x33')][_0x8ce5('0x34')]:![];_0x49d65c[_0x8ce5('0xd')]['DIALOGFLOWV2_ACTION']=_0x444d4f[_0x8ce5('0x30')]['action'];_0x49d65c[_0x8ce5('0xd')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x444d4f[_0x8ce5('0x30')][_0x8ce5('0x35')];_0x49d65c[_0x8ce5('0xd')][_0x8ce5('0x36')]=_0x444d4f[_0x8ce5('0x30')][_0x8ce5('0x31')]&&_0x444d4f['queryResult'][_0x8ce5('0x31')][_0x8ce5('0x32')]?_0x444d4f['queryResult'][_0x8ce5('0x31')][_0x8ce5('0x32')][_0x8ce5('0x33')][_0x8ce5('0x34')]:![];_0x49d65c['body']['DIALOGFLOWV2_INTENTNAME']=_0x444d4f[_0x8ce5('0x30')][_0x8ce5('0x37')][_0x8ce5('0x38')];_0x49d65c[_0x8ce5('0xd')][_0x8ce5('0x39')]=_0x444d4f[_0x8ce5('0x30')]['intent'][_0x8ce5('0x3a')];_0x49d65c[_0x8ce5('0xd')][_0x8ce5('0x3b')]=_0x444d4f['queryResult'][_0x8ce5('0x37')][_0x8ce5('0x3c')];_0x49d65c[_0x8ce5('0xd')]['DIALOGFLOWV2_LANGUAGECODE']=_0x444d4f[_0x8ce5('0x30')][_0x8ce5('0x3d')];_0x49d65c[_0x8ce5('0xd')][_0x8ce5('0x3e')]=_0x444d4f[_0x8ce5('0x30')][_0x8ce5('0x3f')];_0x49d65c[_0x8ce5('0xd')]['DIALOGFLOWV2_SCORE']=_0x444d4f[_0x8ce5('0x30')][_0x8ce5('0x40')];_0x457345[_0x8ce5('0x41')]=_0x8ce5('0x2f');_0x457345['providerResponse']=JSON[_0x8ce5('0x10')](_0x46fbe3);var _0x15396b=[];for(var _0x55cc77=0x0;_0x55cc77<_0x46fbe3[_0x8ce5('0x42')];_0x55cc77++){var _0x4acac2=_0x46fbe3[_0x55cc77];if(_0x4acac2&&_0x4acac2[_0x8ce5('0x30')]&&_0x4acac2[_0x8ce5('0x30')]['fulfillmentText']){_0x15396b['push'](createMessage(_0xea380c,_0x12527f,_0x457345,_0x4acac2[_0x8ce5('0x30')]['fulfillmentText']));}}return Promise[_0x8ce5('0x43')](_0x15396b)[_0x8ce5('0x2e')](function(){if(_0x480670){_0x18847b[_0x8ce5('0x16')]();}else{_0x18847b[_0x8ce5('0x2a')]();}})[_0x8ce5('0xe')](function(_0x5bb062){logger[_0x8ce5('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0xea380c,JSON['stringify'](_0x5bb062));_0x18847b[_0x8ce5('0x16')]();});}})[_0x8ce5('0xe')](function(_0x23aefb){logger[_0x8ce5('0xf')](_0x8ce5('0xc'),_0xea380c,_0x23aefb[_0x8ce5('0x2c')]);_0x18847b[_0x8ce5('0x16')]();});}}catch(_0x3af5bf){logger[_0x8ce5('0xf')](_0x8ce5('0xc'),_0xea380c,JSON[_0x8ce5('0x10')](_0x3af5bf));_0x18847b['stop']();}};}; \ No newline at end of file +var _0x8225=['format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','ChatWebsiteId','account','AccountId','upperFirst','interaction','created','isEmpty','Message','create','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','action','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','intent','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','length','fulfillmentText','push','all','lodash','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','body','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact'];(function(_0x2c34ca,_0x507416){var _0xc690f8=function(_0x5e56f9){while(--_0x5e56f9){_0x2c34ca['push'](_0x2c34ca['shift']());}};_0xc690f8(++_0x507416);}(_0x8225,0x150));var _0x5822=function(_0x52a12a,_0x19ffde){_0x52a12a=_0x52a12a-0x0;var _0xf034fb=_0x8225[_0x52a12a];return _0xf034fb;};'use strict';var _=require(_0x5822('0x0'));var dialogflow=require(_0x5822('0x1'));var md5=require(_0x5822('0x2'));var moment=require(_0x5822('0x3'));var Promise=require(_0x5822('0x4'));var logger=require(_0x5822('0x5'))(_0x5822('0x6'));var utils=require(_0x5822('0x7'));var rpc={'chatMessage':require(_0x5822('0x8')),'openchannelMessage':require(_0x5822('0x9')),'mailMessage':require(_0x5822('0xa')),'smsMessage':require(_0x5822('0xb')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x5822('0xc'))};function createMessage(_0x1c8519,_0x32fb23,_0xc52124,_0x2ddd46){return new Promise(function(_0x565c36,_0x330ddf){var _0x34dc75=_['clone'](_0xc52124);_0x34dc75[_0x5822('0xd')]=_0x2ddd46;return rpc[_0x32fb23+'Message']['create'](_0x34dc75)[_0x5822('0xe')](function(){logger[_0x5822('0xf')](_0x5822('0x10'),_0x1c8519,_0x34dc75[_0x5822('0xd')]);_0x565c36();})[_0x5822('0x11')](function(_0x28610a){logger[_0x5822('0x12')](_0x5822('0x10'),_0x1c8519,JSON[_0x5822('0x13')](_0x28610a));_0x330ddf(_0x28610a);});});}exports[_0x5822('0x14')]=function(_0x1c1453,_0x282dba){return function(_0x6fc74b){try{if(!_['isNil'](this['interaction']['UserId'])){logger[_0x5822('0xf')](_0x5822('0x10'),_0x1c1453,_0x5822('0x15'));return _0x6fc74b[_0x5822('0x16')]();}var _0x1cbd95={'ContactId':this[_0x5822('0x17')]['id'],'sentAt':moment()[_0x5822('0x18')](_0x5822('0x19')),'direction':_0x5822('0x1a')};if(this[_0x5822('0x1b')]===_0x5822('0x1c')||this['channel']===_0x5822('0x1d')){_0x1cbd95['phone']=this['interaction']['phone'];}var _0x2f9a58=this[_0x5822('0x1b')];if(_0x2f9a58==='chat'){_0x1cbd95[_0x5822('0x1e')]=this[_0x5822('0x1f')]['id'];}else{_0x1cbd95[_['upperFirst'](_0x2f9a58)+_0x5822('0x20')]=this['account']['id'];}_0x1cbd95[_[_0x5822('0x21')](_0x2f9a58)+'InteractionId']=this['interaction']['id'];if(this[_0x5822('0x22')][_0x5822('0x23')]){var _0x3adc84=_0x282dba[0x4];if(!_[_0x5822('0x24')](_0x3adc84)){_0x1cbd95[_0x5822('0xd')]=utils['getMustacheRender'](_0x3adc84,this);return rpc[_0x2f9a58+_0x5822('0x25')][_0x5822('0x26')](_0x1cbd95)[_0x5822('0xe')](function(_0x47482b){logger[_0x5822('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x1c1453,_0x1cbd95[_0x5822('0xd')]);})['catch'](function(_0x5f0114){logger[_0x5822('0x12')](_0x5822('0x10'),_0x1c1453,JSON[_0x5822('0x13')](_0x5f0114));})[_0x5822('0x27')](function(){logger[_0x5822('0xf')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1c1453);_0x6fc74b[_0x5822('0x28')]();});}else{logger[_0x5822('0xf')](_0x5822('0x29'),_0x1c1453);_0x6fc74b[_0x5822('0x28')]();}}else{var _0x40fd72=this;var _0x56985e=_0x282dba[0x2][_0x5822('0x2a')](/\\n/g,'\x0a');var _0x397088={'credentials':{'private_key':_0x56985e,'client_email':_0x282dba[0x1]}};var _0x56e6fc=new dialogflow['SessionsClient'](_0x397088);var _0x15dac5=_0x56e6fc[_0x5822('0x2b')](_0x282dba[0x0],md5(_0x40fd72[_0x5822('0x22')]['id']));var _0x53f18c={'session':_0x15dac5,'queryInput':{'text':{'text':_0x40fd72[_0x5822('0x2c')][_0x5822('0xd')],'languageCode':_0x282dba[0x3]||'en'}}};return _0x56e6fc[_0x5822('0x2d')](_0x53f18c)['then'](function(_0x4c0cf8){if(_0x4c0cf8&&_0x4c0cf8['length']){_0x40fd72[_0x5822('0xd')][_0x5822('0x2e')]=_0x4c0cf8;var _0x1435df=_0x4c0cf8[0x0];var _0x143097=_0x1435df[_0x5822('0x2f')]['diagnosticInfo']&&_0x1435df[_0x5822('0x2f')][_0x5822('0x30')][_0x5822('0x31')]?_0x1435df['queryResult']['diagnosticInfo']['fields'][_0x5822('0x32')][_0x5822('0x33')]:![];_0x40fd72['body']['DIALOGFLOWV2_ACTION']=_0x1435df[_0x5822('0x2f')][_0x5822('0x34')];_0x40fd72['body']['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x1435df[_0x5822('0x2f')][_0x5822('0x35')];_0x40fd72['body']['DIALOGFLOWV2_ENDCONVERSATION']=_0x1435df[_0x5822('0x2f')][_0x5822('0x30')]&&_0x1435df[_0x5822('0x2f')][_0x5822('0x30')][_0x5822('0x31')]?_0x1435df[_0x5822('0x2f')][_0x5822('0x30')][_0x5822('0x31')][_0x5822('0x32')]['boolValue']:![];_0x40fd72[_0x5822('0xd')][_0x5822('0x36')]=_0x1435df[_0x5822('0x2f')]['intent'][_0x5822('0x37')];_0x40fd72[_0x5822('0xd')][_0x5822('0x38')]=_0x1435df['queryResult']['intent'][_0x5822('0x39')];_0x40fd72[_0x5822('0xd')][_0x5822('0x3a')]=_0x1435df[_0x5822('0x2f')][_0x5822('0x3b')][_0x5822('0x3c')];_0x40fd72['body'][_0x5822('0x3d')]=_0x1435df[_0x5822('0x2f')]['languageCode'];_0x40fd72[_0x5822('0xd')][_0x5822('0x3e')]=_0x1435df[_0x5822('0x2f')][_0x5822('0x3f')];_0x40fd72[_0x5822('0xd')][_0x5822('0x40')]=_0x1435df['queryResult'][_0x5822('0x41')];_0x1cbd95[_0x5822('0x42')]='dialogflowV2';_0x1cbd95[_0x5822('0x43')]=JSON['stringify'](_0x4c0cf8);var _0x7f30cc=[];for(var _0x47174d=0x0;_0x47174d<_0x4c0cf8[_0x5822('0x44')];_0x47174d++){var _0x2a3a10=_0x4c0cf8[_0x47174d];if(_0x2a3a10&&_0x2a3a10[_0x5822('0x2f')]&&_0x2a3a10[_0x5822('0x2f')][_0x5822('0x45')]){_0x7f30cc[_0x5822('0x46')](createMessage(_0x1c1453,_0x2f9a58,_0x1cbd95,_0x2a3a10[_0x5822('0x2f')][_0x5822('0x45')]));}}return Promise[_0x5822('0x47')](_0x7f30cc)[_0x5822('0xe')](function(){if(_0x143097){_0x6fc74b['next']();}else{_0x6fc74b[_0x5822('0x28')]();}})[_0x5822('0x11')](function(_0x39a6a1){logger[_0x5822('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x1c1453,JSON[_0x5822('0x13')](_0x39a6a1));_0x6fc74b['next']();});}})['catch'](function(_0x3ab9e0){logger[_0x5822('0x12')](_0x5822('0x10'),_0x1c1453,_0x3ab9e0[_0x5822('0x2c')]);_0x6fc74b[_0x5822('0x16')]();});}}catch(_0x4314a4){logger[_0x5822('0x12')](_0x5822('0x10'),_0x1c1453,JSON[_0x5822('0x13')](_0x4314a4));_0x6fc74b[_0x5822('0x28')]();}};}; \ 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 feb2318..76fbac7 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 _0xdfec=['[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','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','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found'];(function(_0x4ecbbb,_0x395578){var _0x5d61c6=function(_0x2c5f8e){while(--_0x2c5f8e){_0x4ecbbb['push'](_0x4ecbbb['shift']());}};_0x5d61c6(++_0x395578);}(_0xdfec,0x102));var _0xcdfe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdfec[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require(_0xcdfe('0x0'));var _=require('lodash');var htmlToText=require(_0xcdfe('0x1'));var utils=require(_0xcdfe('0x2'));var logger=require(_0xcdfe('0x3'))(_0xcdfe('0x4'));var gotoif=schema({'condition':{'type':_0xcdfe('0x5'),'required':!![],'message':_0xcdfe('0x6')},'priorityTrue':{'type':_0xcdfe('0x7'),'message':_0xcdfe('0x8')},'priorityFalse':{'type':_0xcdfe('0x7'),'message':_0xcdfe('0x9')}});exports[_0xcdfe('0xa')]=function(_0x1e1c64,_0x2d89ff){return function(_0x47fd62){try{var _0x125ded={'condition':htmlToText[_0xcdfe('0xb')](utils[_0xcdfe('0xc')](_0x2d89ff[0x0],this),{'wordwrap':![]})[_0xcdfe('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2d89ff[0x1],'priorityFalse':_0x2d89ff[0x2]};var _0x56f337=gotoif['validate'](_0x125ded,{'typecast':!![]});if(_0x56f337[_0xcdfe('0xe')]){logger[_0xcdfe('0xf')](_0xcdfe('0x10'),_0x1e1c64,_[_0xcdfe('0x11')](_0x56f337,_0xcdfe('0x12'))[_0xcdfe('0x13')](',\x20'));_0x47fd62[_0xcdfe('0x14')]();}else{try{var _0x50cffc=eval('('+_0x125ded[_0xcdfe('0x15')]+')');var _0x4dda1e=_0x50cffc?_0x125ded[_0xcdfe('0x16')]:_0x125ded[_0xcdfe('0x17')];logger[_0xcdfe('0x18')](_0xcdfe('0x19'),_0x1e1c64,_0x125ded[_0xcdfe('0x15')],_0x50cffc,_0x4dda1e||'next');if(_0x4dda1e){var _0x5517dc=_[_0xcdfe('0x1a')](_0x47fd62['rules'](),{'p':_0x4dda1e});if(_0x5517dc>=0x0){logger[_0xcdfe('0x18')](_0xcdfe('0x1b'),_0x1e1c64,_0x4dda1e||_0xcdfe('0x1c'),_0x5517dc);_0x47fd62['next'](_0x5517dc);}else{logger[_0xcdfe('0x18')](_0xcdfe('0x1d'),_0x1e1c64,_0x4dda1e||_0xcdfe('0x1c'));_0x47fd62[_0xcdfe('0x14')]();}}else{_0x47fd62['next']();}}catch(_0x35ccd4){logger[_0xcdfe('0xf')](_0xcdfe('0x1e'),_0x1e1c64,_0x35ccd4[_0xcdfe('0x12')]);_0x47fd62[_0xcdfe('0x14')]();}}}catch(_0x3800e9){logger[_0xcdfe('0xf')](_0xcdfe('0x10'),_0x1e1c64,JSON[_0xcdfe('0x1f')](_0x3800e9));_0x47fd62[_0xcdfe('0x14')]();}};}; \ No newline at end of file +var _0xd2e1=['html-to-text','../../../../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','join','stop','condition','priorityFalse','next','findIndex','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','message','validate','lodash'];(function(_0x203f07,_0x4f3336){var _0x52ea7a=function(_0x42004b){while(--_0x42004b){_0x203f07['push'](_0x203f07['shift']());}};_0x52ea7a(++_0x4f3336);}(_0xd2e1,0x132));var _0x1d2e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xd2e1[_0x46e363];return _0x3fb059;};'use strict';var schema=require(_0x1d2e('0x0'));var _=require(_0x1d2e('0x1'));var htmlToText=require(_0x1d2e('0x2'));var utils=require('./utils');var logger=require(_0x1d2e('0x3'))(_0x1d2e('0x4'));var gotoif=schema({'condition':{'type':_0x1d2e('0x5'),'required':!![],'message':_0x1d2e('0x6')},'priorityTrue':{'type':_0x1d2e('0x7'),'message':_0x1d2e('0x8')},'priorityFalse':{'type':'number','message':_0x1d2e('0x9')}});exports[_0x1d2e('0xa')]=function(_0x29daaf,_0x1787a9){return function(_0x24541c){try{var _0x51eb7e={'condition':htmlToText['fromString'](utils[_0x1d2e('0xb')](_0x1787a9[0x0],this),{'wordwrap':![]})[_0x1d2e('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1787a9[0x1],'priorityFalse':_0x1787a9[0x2]};var _0x8914b6=gotoif['validate'](_0x51eb7e,{'typecast':!![]});if(_0x8914b6[_0x1d2e('0xd')]){logger['error'](_0x1d2e('0xe'),_0x29daaf,_[_0x1d2e('0xf')](_0x8914b6,'message')[_0x1d2e('0x10')](',\x20'));_0x24541c[_0x1d2e('0x11')]();}else{try{var _0x2e98a1=eval('('+_0x51eb7e[_0x1d2e('0x12')]+')');var _0x41d920=_0x2e98a1?_0x51eb7e['priorityTrue']:_0x51eb7e[_0x1d2e('0x13')];logger['info']('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x29daaf,_0x51eb7e['condition'],_0x2e98a1,_0x41d920||_0x1d2e('0x14'));if(_0x41d920){var _0x3bcc11=_[_0x1d2e('0x15')](_0x24541c[_0x1d2e('0x16')](),{'p':_0x41d920});if(_0x3bcc11>=0x0){logger[_0x1d2e('0x17')](_0x1d2e('0x18'),_0x29daaf,_0x41d920||_0x1d2e('0x14'),_0x3bcc11);_0x24541c[_0x1d2e('0x14')](_0x3bcc11);}else{logger[_0x1d2e('0x17')](_0x1d2e('0x19'),_0x29daaf,_0x41d920||'next');_0x24541c[_0x1d2e('0x11')]();}}else{_0x24541c['next']();}}catch(_0x13815a){logger[_0x1d2e('0x1a')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x29daaf,_0x13815a[_0x1d2e('0x1b')]);_0x24541c[_0x1d2e('0x11')]();}}}catch(_0x500840){logger[_0x1d2e('0x1a')](_0x1d2e('0xe'),_0x29daaf,JSON['stringify'](_0x500840));_0x24541c[_0x1d2e('0x11')]();}};}; \ 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 e7c0961..3169966 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 _0xd7c1=['number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing'];(function(_0x1257a4,_0x1d002d){var _0x5ef875=function(_0x428054){while(--_0x428054){_0x1257a4['push'](_0x1257a4['shift']());}};_0x5ef875(++_0x1d002d);}(_0xd7c1,0x1ea));var _0x1d7c=function(_0xb12e89,_0x122d41){_0xb12e89=_0xb12e89-0x0;var _0x579360=_0xd7c1[_0xb12e89];return _0x579360;};'use strict';var schema=require(_0x1d7c('0x0'));var _=require(_0x1d7c('0x1'));var logger=require(_0x1d7c('0x2'))(_0x1d7c('0x3'));var gotop=schema({'priority':{'type':_0x1d7c('0x4'),'required':!![],'message':_0x1d7c('0x5')}});exports['consequence']=function(_0x5c5f01,_0x504e43){return function(_0x4ec808){try{var _0x299e7f={'priority':_0x504e43[0x0]};var _0x4860e0=gotop[_0x1d7c('0x0')](_0x299e7f,{'typecast':!![]});if(_0x4860e0[_0x1d7c('0x6')]){logger[_0x1d7c('0x7')](_0x1d7c('0x8'),_0x5c5f01,_[_0x1d7c('0x9')](_0x4860e0,_0x1d7c('0xa'))['join'](',\x20'));_0x4ec808[_0x1d7c('0xb')]();}else{logger[_0x1d7c('0xc')](_0x1d7c('0xd'),_0x5c5f01,_0x299e7f['priority']);if(_0x299e7f[_0x1d7c('0xe')]){var _0x2e253d=_[_0x1d7c('0xf')](_0x4ec808['rules'](),{'p':_0x299e7f['priority']});if(_0x2e253d>=0x0){logger[_0x1d7c('0xc')](_0x1d7c('0x10'),_0x5c5f01,_0x299e7f[_0x1d7c('0xe')]||_0x1d7c('0x11'),_0x2e253d);_0x4ec808[_0x1d7c('0x11')](_0x2e253d);}else{logger['info'](_0x1d7c('0x12'),_0x5c5f01,_0x299e7f['priority']||_0x1d7c('0x11'));_0x4ec808[_0x1d7c('0xb')]();}}else{_0x4ec808[_0x1d7c('0x11')]();}}}catch(_0x3315a6){logger['error']('[%s][GOTOP]\x20%s',_0x5c5f01,JSON['stringify'](_0x3315a6));_0x4ec808[_0x1d7c('0xb')]();}};}; \ No newline at end of file +var _0x2b00=['validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify'];(function(_0x6088fd,_0x17153e){var _0x22b5b1=function(_0x1c8627){while(--_0x1c8627){_0x6088fd['push'](_0x6088fd['shift']());}};_0x22b5b1(++_0x17153e);}(_0x2b00,0x140));var _0x02b0=function(_0x50e0c5,_0x49351f){_0x50e0c5=_0x50e0c5-0x0;var _0x11d623=_0x2b00[_0x50e0c5];return _0x11d623;};'use strict';var schema=require(_0x02b0('0x0'));var _=require('lodash');var logger=require(_0x02b0('0x1'))(_0x02b0('0x2'));var gotop=schema({'priority':{'type':_0x02b0('0x3'),'required':!![],'message':_0x02b0('0x4')}});exports[_0x02b0('0x5')]=function(_0xf31128,_0x426c2e){return function(_0x331c1d){try{var _0x307709={'priority':_0x426c2e[0x0]};var _0x3da48a=gotop[_0x02b0('0x0')](_0x307709,{'typecast':!![]});if(_0x3da48a[_0x02b0('0x6')]){logger[_0x02b0('0x7')](_0x02b0('0x8'),_0xf31128,_[_0x02b0('0x9')](_0x3da48a,_0x02b0('0xa'))['join'](',\x20'));_0x331c1d[_0x02b0('0xb')]();}else{logger[_0x02b0('0xc')](_0x02b0('0xd'),_0xf31128,_0x307709[_0x02b0('0xe')]);if(_0x307709[_0x02b0('0xe')]){var _0x1530b1=_[_0x02b0('0xf')](_0x331c1d['rules'](),{'p':_0x307709[_0x02b0('0xe')]});if(_0x1530b1>=0x0){logger['info'](_0x02b0('0x10'),_0xf31128,_0x307709['priority']||'next',_0x1530b1);_0x331c1d[_0x02b0('0x11')](_0x1530b1);}else{logger[_0x02b0('0xc')](_0x02b0('0x12'),_0xf31128,_0x307709['priority']||_0x02b0('0x11'));_0x331c1d[_0x02b0('0xb')]();}}else{_0x331c1d[_0x02b0('0x11')]();}}}catch(_0x3086d3){logger[_0x02b0('0x7')]('[%s][GOTOP]\x20%s',_0xf31128,JSON[_0x02b0('0x13')](_0x3086d3));_0x331c1d[_0x02b0('0xb')]();}};}; \ 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 efefc7a..baee3c8 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 _0xd744=['../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','Message','then','info','body','catch','error','[%s][MESSAGE]\x20%s','stringify','lodash','./utils'];(function(_0x1f357,_0x1c80fc){var _0x5c8813=function(_0x2b087e){while(--_0x2b087e){_0x1f357['push'](_0x1f357['shift']());}};_0x5c8813(++_0x1c80fc);}(_0xd744,0x7b));var _0x4d74=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xd744[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x4d74('0x0'));var utils=require(_0x4d74('0x1'));var logger=require(_0x4d74('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x4d74('0x3')),'mailMessage':require(_0x4d74('0x4')),'smsMessage':require(_0x4d74('0x5')),'faxMessage':require(_0x4d74('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x4d74('0x7')]=function(_0x3535e3,_0x3f5feb){return function(_0x41e795){try{var _0x57e0f0={'body':utils[_0x4d74('0x8')](_0x3f5feb[0x0],this),'ContactId':this['contact']['id']};if(this[_0x4d74('0x9')]===_0x4d74('0xa')){_0x57e0f0[_0x4d74('0xb')]=this['account']['id'];}else{_0x57e0f0[_[_0x4d74('0xc')](this[_0x4d74('0x9')])+_0x4d74('0xd')]=this[_0x4d74('0xe')]['id'];}_0x57e0f0[_[_0x4d74('0xc')](this[_0x4d74('0x9')])+_0x4d74('0xf')]=this[_0x4d74('0x10')]['id'];if(rpc[this['channel']+_0x4d74('0x11')]){return rpc[this[_0x4d74('0x9')]+_0x4d74('0x11')]['create'](_0x57e0f0)[_0x4d74('0x12')](function(_0x1cea6b){logger[_0x4d74('0x13')]('[%s][MESSAGE]\x20%s',_0x3535e3,_0x57e0f0[_0x4d74('0x14')]);_0x41e795['next']();})[_0x4d74('0x15')](function(_0x35e64d){logger[_0x4d74('0x16')](_0x4d74('0x17'),_0x3535e3,JSON[_0x4d74('0x18')](_0x35e64d));_0x41e795['stop']();});}}catch(_0x3dc4a9){logger[_0x4d74('0x16')]('[%s][MESSAGE]\x20%s',_0x3535e3,JSON['stringify'](_0x3dc4a9));_0x41e795['stop']();}};}; \ No newline at end of file +var _0xf604=['account','upperFirst','InteractionId','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','stringify','error','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat'];(function(_0x592b51,_0x5263c5){var _0x5da3c2=function(_0x2d5f85){while(--_0x2d5f85){_0x592b51['push'](_0x592b51['shift']());}};_0x5da3c2(++_0x5263c5);}(_0xf604,0x1a4));var _0x4f60=function(_0x3c228f,_0x3f4627){_0x3c228f=_0x3c228f-0x0;var _0x447a2f=_0xf604[_0x3c228f];return _0x447a2f;};'use strict';var _=require(_0x4f60('0x0'));var utils=require(_0x4f60('0x1'));var logger=require(_0x4f60('0x2'))(_0x4f60('0x3'));var rpc={'chatMessage':require(_0x4f60('0x4')),'openchannelMessage':require(_0x4f60('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x4f60('0x6')),'whatsappMessage':require(_0x4f60('0x7'))};exports[_0x4f60('0x8')]=function(_0x32cc92,_0x27ba20){return function(_0x375b4f){try{var _0xf758bb={'body':utils['getMustacheRender'](_0x27ba20[0x0],this),'ContactId':this[_0x4f60('0x9')]['id']};if(this[_0x4f60('0xa')]===_0x4f60('0xb')){_0xf758bb['ChatWebsiteId']=this['account']['id'];}else{_0xf758bb[_['upperFirst'](this[_0x4f60('0xa')])+'AccountId']=this[_0x4f60('0xc')]['id'];}_0xf758bb[_[_0x4f60('0xd')](this[_0x4f60('0xa')])+_0x4f60('0xe')]=this['interaction']['id'];if(rpc[this['channel']+'Message']){return rpc[this[_0x4f60('0xa')]+_0x4f60('0xf')][_0x4f60('0x10')](_0xf758bb)[_0x4f60('0x11')](function(_0x4b919a){logger[_0x4f60('0x12')](_0x4f60('0x13'),_0x32cc92,_0xf758bb['body']);_0x375b4f[_0x4f60('0x14')]();})[_0x4f60('0x15')](function(_0x1f86cd){logger['error'](_0x4f60('0x13'),_0x32cc92,JSON[_0x4f60('0x16')](_0x1f86cd));_0x375b4f['stop']();});}}catch(_0x241569){logger[_0x4f60('0x17')](_0x4f60('0x13'),_0x32cc92,JSON[_0x4f60('0x16')](_0x241569));_0x375b4f['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 35a9348..03792fb 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 _0xac47=['getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing','consequence'];(function(_0x34a1b2,_0x3b2ee5){var _0x52c608=function(_0x545a81){while(--_0x545a81){_0x34a1b2['push'](_0x34a1b2['shift']());}};_0x52c608(++_0x3b2ee5);}(_0xac47,0xef));var _0x7ac4=function(_0xef66ed,_0x1a5239){_0xef66ed=_0xef66ed-0x0;var _0xa14f66=_0xac47[_0xef66ed];return _0xa14f66;};'use strict';var utils=require(_0x7ac4('0x0'));var logger=require(_0x7ac4('0x1'))(_0x7ac4('0x2'));exports[_0x7ac4('0x3')]=function(_0x17b7cc,_0x32bb16){return function(_0xe5889d){try{logger['info']('[%s][NOOP]\x20%s',_0x17b7cc,utils[_0x7ac4('0x4')](_0x32bb16[0x0],this));_0xe5889d[_0x7ac4('0x5')]();}catch(_0x4faa40){logger[_0x7ac4('0x6')]('[%s][NOOP]\x20%s',_0x17b7cc,JSON[_0x7ac4('0x7')](_0x4faa40));_0xe5889d[_0x7ac4('0x8')]();}};}; \ No newline at end of file +var _0x3732=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','./utils','../../../../config/logger','routing','consequence'];(function(_0x2a723e,_0x61bb43){var _0x48a0e1=function(_0x470e57){while(--_0x470e57){_0x2a723e['push'](_0x2a723e['shift']());}};_0x48a0e1(++_0x61bb43);}(_0x3732,0xef));var _0x2373=function(_0x51ea04,_0x1d95c0){_0x51ea04=_0x51ea04-0x0;var _0x1e9342=_0x3732[_0x51ea04];return _0x1e9342;};'use strict';var utils=require(_0x2373('0x0'));var logger=require(_0x2373('0x1'))(_0x2373('0x2'));exports[_0x2373('0x3')]=function(_0x14f8e6,_0x66a028){return function(_0x4099d7){try{logger['info'](_0x2373('0x4'),_0x14f8e6,utils[_0x2373('0x5')](_0x66a028[0x0],this));_0x4099d7[_0x2373('0x6')]();}catch(_0x17fd42){logger[_0x2373('0x7')](_0x2373('0x4'),_0x14f8e6,JSON[_0x2373('0x8')](_0x17fd42));_0x4099d7['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 67b758b..e2f27bc 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 _0x7c9a=['WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','[%s][STOP:QUEUE][NAME:%s]','[%s][END:QUEUE][NAME:%s]','update','catch','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','find','Queues','timeout','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stop','log','stack','validate','util','seq-queue','ioredis','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','pick','format','%s:queue:%s','save','remove','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','message','AccountId'];(function(_0x2f9d3e,_0x29345f){var _0x32d8e6=function(_0x9f63fc){while(--_0x9f63fc){_0x2f9d3e['push'](_0x2f9d3e['shift']());}};_0x32d8e6(++_0x29345f);}(_0x7c9a,0x1b3));var _0xa7c9=function(_0x2843b8,_0x2d1367){_0x2843b8=_0x2843b8-0x0;var _0x4f177f=_0x7c9a[_0x2843b8];return _0x4f177f;};'use strict';var schema=require(_0xa7c9('0x0'));var _=require('lodash');var util=require(_0xa7c9('0x1'));var seqqueue=require(_0xa7c9('0x2'));var moment=require('moment');var Redis=require(_0xa7c9('0x3'));var config=require('../../../../config/environment');var logger=require(_0xa7c9('0x4'))(_0xa7c9('0x5'));var strategy=require(_0xa7c9('0x6'));config[_0xa7c9('0x7')]=_['defaults'](config[_0xa7c9('0x7')],{'host':_0xa7c9('0x8'),'port':0x18eb});var io=require(_0xa7c9('0x9'))(new Redis(config['redis']));var attributes=['id',_0xa7c9('0xa'),_0xa7c9('0xb'),_0xa7c9('0xc'),_0xa7c9('0xd'),_0xa7c9('0xe')];function emit(_0x3c30b7,_0x267c57,_0x3a214b){io['to'](_0x3c30b7)['emit'](_0x267c57,_0x3a214b);}function emitChannelQueueInteraction(_0x35f418,_0x56cd6c,_0x23349b,_0x19f78f,_0x6474d2,_0xea8e44,_0x4f7604,_0x23f9a0){var _0x352a8f=_[_0xa7c9('0xf')](_0x23349b);_0x352a8f[_0xa7c9('0xa')]=_0x23f9a0;_0x352a8f[_0xa7c9('0xc')]=_0x56cd6c;_0x352a8f[_0xa7c9('0xb')]=_0x19f78f;_0x352a8f['id']=_0x6474d2;if(_0xea8e44){_0x4f7604[util['format']('%sQueuesWaitingInteractions',_0x35f418)][_0x6474d2]=_[_0xa7c9('0x10')](_0x352a8f,attributes);}else{delete _0x4f7604[util[_0xa7c9('0x11')]('%sQueuesWaitingInteractions',_0x35f418)][_0x6474d2];}emit(util[_0xa7c9('0x11')](_0xa7c9('0x12'),_0x35f418,_0x56cd6c),util[_0xa7c9('0x11')]('%s_queue_waiting_interaction:%s',_0x35f418,_0xea8e44?_0xa7c9('0x13'):_0xa7c9('0x14')),_[_0xa7c9('0x10')](_0x352a8f,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xa7c9('0x15')),'chatQueueReport':require(_0xa7c9('0x16')),'smsQueueReport':require(_0xa7c9('0x17')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xa7c9('0x18'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0xa7c9('0x19')},'timeout':{'type':_0xa7c9('0x1a'),'message':_0xa7c9('0x1b')}});function startRouting(_0x36de47,_0x4477ac,_0x3c683a,_0x4aa649){if(_0x36de47&&_0x4477ac&&_0x3c683a){_0x4477ac[_0xa7c9('0x1c')]+=0x1;var _0x2693fb={'uniqueid':_0x36de47,'from':_0x3c683a[_0xa7c9('0x1d')]?_0x3c683a[_0xa7c9('0x1d')][_0xa7c9('0xd')]:'','joinAt':moment()[_0xa7c9('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3c683a[_0xa7c9('0x1e')]?_0x3c683a[_0xa7c9('0x1e')]['id']:null,'ListId':_0x3c683a[_0xa7c9('0x1f')]?_0x3c683a['list']['id']:null};_0x2693fb[_[_0xa7c9('0x20')](_0x3c683a[_0xa7c9('0x21')])+_0xa7c9('0x22')]=_0x4477ac['id']||null;_0x2693fb[_['upperFirst'](_0x3c683a[_0xa7c9('0x21')])+_0xa7c9('0x23')]=_0x3c683a[_0xa7c9('0x24')]?_0x3c683a['interaction']['id']:null;_0x2693fb[_['upperFirst'](_0x3c683a[_0xa7c9('0x21')])+'MessageId']=_0x3c683a[_0xa7c9('0x25')]?_0x3c683a[_0xa7c9('0x25')]['id']:null;_0x2693fb[_['upperFirst'](_0x3c683a[_0xa7c9('0x21')])+(_0x3c683a[_0xa7c9('0x21')]!=='chat'?_0xa7c9('0x26'):_0xa7c9('0x27'))]=_0x3c683a[_0xa7c9('0xb')]?_0x3c683a[_0xa7c9('0xb')]['id']:null;logger[_0xa7c9('0x28')](util[_0xa7c9('0x11')](_0xa7c9('0x29'),_0x36de47,_0x4477ac[_0xa7c9('0x2a')]));emitChannelQueueInteraction(_0x3c683a[_0xa7c9('0x21')],_0x4477ac[_0xa7c9('0x2a')],_0x2693fb,_0x3c683a['account']['name'],_0x3c683a[_0xa7c9('0x25')]['id'],!![],_0x4aa649,_0x4477ac['id']);if(rpc[_0x3c683a[_0xa7c9('0x21')]+'QueueReport']){return rpc[_0x3c683a['channel']+_0xa7c9('0x2b')][_0xa7c9('0x2c')](_0x2693fb)['catch'](function(_0x2bcc82){logger[_0xa7c9('0x2d')](_0xa7c9('0x2e'));});}}}function stopRouting(_0x2da26f,_0x340814,_0x5d871c,_0x443102){if(_0x2da26f&&_0x340814){_0x340814[_0xa7c9('0x1c')]-=0x1;var _0x52be25={'leaveAt':moment()[_0xa7c9('0x11')](_0xa7c9('0x2f')),'acceptAt':moment()[_0xa7c9('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0xa7c9('0x30')};logger[_0xa7c9('0x28')](util[_0xa7c9('0x11')](_0xa7c9('0x31'),_0x2da26f,_0x340814[_0xa7c9('0x2a')]));emitChannelQueueInteraction(_0x5d871c['channel'],_0x340814['name'],_0x5d871c[_0xa7c9('0x1d')],_0x5d871c['account'][_0xa7c9('0x2a')],_0x5d871c[_0xa7c9('0x25')]['id'],![],_0x443102,_0x340814['id']);if(rpc[_0x5d871c['channel']+_0xa7c9('0x2b')]){return rpc[_0x5d871c[_0xa7c9('0x21')]+_0xa7c9('0x2b')]['update'](_0x2da26f,_0x52be25)['catch'](function(_0x5c1c65){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0x3df6f0,_0x482387,_0x3ba1bb,_0x11582d){if(_0x3df6f0&&_0x482387){_0x482387[_0xa7c9('0x1c')]-=0x1;var _0x1b9b46={'leaveAt':moment()['format'](_0xa7c9('0x2f')),'exitAt':moment()[_0xa7c9('0x11')](_0xa7c9('0x2f')),'reason':'timeout'};logger[_0xa7c9('0x28')](util['format'](_0xa7c9('0x32'),_0x3df6f0,_0x482387[_0xa7c9('0x2a')]));emitChannelQueueInteraction(_0x3ba1bb[_0xa7c9('0x21')],_0x482387[_0xa7c9('0x2a')],_0x3ba1bb['body'],_0x3ba1bb['account']['name'],_0x3ba1bb[_0xa7c9('0x25')]['id'],![],_0x11582d);if(rpc[_0x3ba1bb[_0xa7c9('0x21')]+_0xa7c9('0x2b')]){return rpc[_0x3ba1bb[_0xa7c9('0x21')]+'QueueReport'][_0xa7c9('0x33')](_0x3df6f0,_0x1b9b46)[_0xa7c9('0x34')](function(_0x15ab7a){logger['error'](_0xa7c9('0x35'));});}}}function handleFindQueue(_0x33d9e4){return function(_0x26f573){return _0x26f573[_0xa7c9('0x2a')][_0xa7c9('0x36')]()===_0x33d9e4['toLowerCase']();};}exports[_0xa7c9('0x37')]=function(_0x622446,_0x13d902,_0x440de7,_0x59f0eb){return function(_0x4d9d15){try{var _0x2e2ff2={'name':_0x13d902[0x0],'timeout':_0x13d902[0x1]};var _0x19e1d1=queue[_0xa7c9('0x0')](_0x2e2ff2,{'typecast':!![]});if(_0x19e1d1[_0xa7c9('0x38')]){logger['error'](_0xa7c9('0x39'),_0x622446,_[_0xa7c9('0x3a')](_0x19e1d1,_0xa7c9('0x25'))[_0xa7c9('0x3b')](',\x20'));_0x4d9d15['stop']();}else{var _0x230a64=_[_0xa7c9('0x3c')](_0x440de7[_0x59f0eb[_0xa7c9('0x21')]+_0xa7c9('0x3d')],handleFindQueue(_0x2e2ff2[_0xa7c9('0x2a')]));if(_0x230a64){startRouting(_0x622446,_0x230a64,_0x59f0eb,_0x440de7);var _0xe6de17=(_0x230a64[_0xa7c9('0x3e')]||0xa)*0x3e8;var _0x173e5e=(_0x2e2ff2[_0xa7c9('0x3e')]||0x14)*0x3e8;var _0x4efea1,_0x4626ce;if(_0xe6de17>_0x173e5e){_0x173e5e=_0xe6de17;}var _0x12c0a9=seqqueue[_0xa7c9('0x3f')](_0xe6de17);_0x12c0a9['id']=_0x622446;_0x12c0a9['atimeout']=_0xe6de17;_0x12c0a9[_0xa7c9('0x40')]=_0x173e5e;_0x12c0a9[_0xa7c9('0x21')]=_0x59f0eb[_0xa7c9('0x21')];_0x440de7[_0xa7c9('0x41')][_0x622446]['on'](_0xa7c9('0x42'),function(){logger[_0xa7c9('0x28')](_0xa7c9('0x43'),_0x622446);stopRouting(_0x622446,_0x230a64,_0x59f0eb,_0x440de7);clearTimeout(_0x4efea1);_0x4efea1=undefined;_0x12c0a9[_0xa7c9('0x44')](!![]);if(_0x440de7['rules'][_0x622446]){delete _0x440de7[_0xa7c9('0x41')][_0x622446];}_0x4d9d15['stop']();});_0x440de7[_0xa7c9('0x41')][_0x622446]['on'](_0xa7c9('0x45'),function(){if(_0x440de7[_0xa7c9('0x41')][_0x622446]){delete _0x440de7[_0xa7c9('0x41')][_0x622446];}});_0x4efea1=setTimeout(function(){logger[_0xa7c9('0x28')](_0xa7c9('0x46'),_0x622446);endRouting(_0x622446,_0x230a64,_0x59f0eb,_0x440de7);clearTimeout(_0x4efea1);_0x12c0a9[_0xa7c9('0x44')](!![]);_0x4d9d15[_0xa7c9('0x47')]();},_0x173e5e);switch(_0x230a64[_0xa7c9('0x48')]){case _0xa7c9('0x49'):strategy[_0xa7c9('0x49')](_0x12c0a9,_0x230a64,_0x440de7,_0x59f0eb);break;default:strategy[_0xa7c9('0x4a')](_0x12c0a9,_0x230a64,_0x440de7,_0x59f0eb);}}else{logger[_0xa7c9('0x2d')](_0xa7c9('0x4b'),_0x622446,_0x2e2ff2['name']);_0x4d9d15[_0xa7c9('0x4c')]();}}}catch(_0x9702f7){console[_0xa7c9('0x4d')](_0x9702f7);logger[_0xa7c9('0x2d')](_0xa7c9('0x39'),_0x622446,_0x9702f7[_0xa7c9('0x4e')]);_0x4d9d15[_0xa7c9('0x4c')]();}};}; \ No newline at end of file +var _0x4a47=['contact','list','upperFirst','channel','QueueId','InteractionId','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','update\x20queue\x20report','timeout','length','[%s][QUEUE]\x20%s','map','stop','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','queue','from','emit','clone','account','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','waiting','body','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4a47,0x15e));var _0x74a4=function(_0x23285f,_0x5529ce){_0x23285f=_0x23285f-0x0;var _0x1a5a34=_0x4a47[_0x23285f];return _0x1a5a34;};'use strict';var schema=require(_0x74a4('0x0'));var _=require(_0x74a4('0x1'));var util=require(_0x74a4('0x2'));var seqqueue=require(_0x74a4('0x3'));var moment=require(_0x74a4('0x4'));var Redis=require(_0x74a4('0x5'));var config=require(_0x74a4('0x6'));var logger=require(_0x74a4('0x7'))(_0x74a4('0x8'));var strategy=require(_0x74a4('0x9'));config['redis']=_[_0x74a4('0xa')](config[_0x74a4('0xb')],{'host':_0x74a4('0xc'),'port':0x18eb});var io=require(_0x74a4('0xd'))(new Redis(config['redis']));var attributes=['id',_0x74a4('0xe'),'account',_0x74a4('0xf'),_0x74a4('0x10'),'joinAt'];function emit(_0x41e5c9,_0x3a0dee,_0x483206){io['to'](_0x41e5c9)[_0x74a4('0x11')](_0x3a0dee,_0x483206);}function emitChannelQueueInteraction(_0x542358,_0x23265f,_0x4f5e8c,_0x5aa50a,_0x44f244,_0xc614c7,_0x532545,_0x2dea3b){var _0x343e0a=_[_0x74a4('0x12')](_0x4f5e8c);_0x343e0a[_0x74a4('0xe')]=_0x2dea3b;_0x343e0a['queue']=_0x23265f;_0x343e0a[_0x74a4('0x13')]=_0x5aa50a;_0x343e0a['id']=_0x44f244;if(_0xc614c7){_0x532545[util[_0x74a4('0x14')](_0x74a4('0x15'),_0x542358)][_0x44f244]=_[_0x74a4('0x16')](_0x343e0a,attributes);}else{delete _0x532545[util[_0x74a4('0x14')](_0x74a4('0x15'),_0x542358)][_0x44f244];}emit(util['format'](_0x74a4('0x17'),_0x542358,_0x23265f),util[_0x74a4('0x14')](_0x74a4('0x18'),_0x542358,_0xc614c7?_0x74a4('0x19'):'remove'),_[_0x74a4('0x16')](_0x343e0a,attributes));}var rpc={'openchannelQueueReport':require(_0x74a4('0x1a')),'mailQueueReport':require(_0x74a4('0x1b')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x74a4('0x1c')),'whatsappQueueReport':require(_0x74a4('0x1d'))};var queue=schema({'name':{'type':_0x74a4('0x1e'),'required':!![],'message':_0x74a4('0x1f')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x192001,_0x1d2788,_0x564967,_0x1e6c5d){if(_0x192001&&_0x1d2788&&_0x564967){_0x1d2788[_0x74a4('0x20')]+=0x1;var _0x212954={'uniqueid':_0x192001,'from':_0x564967[_0x74a4('0x21')]?_0x564967[_0x74a4('0x21')]['from']:'','joinAt':moment()['format'](_0x74a4('0x22')),'ContactId':_0x564967['contact']?_0x564967[_0x74a4('0x23')]['id']:null,'ListId':_0x564967['list']?_0x564967[_0x74a4('0x24')]['id']:null};_0x212954[_[_0x74a4('0x25')](_0x564967[_0x74a4('0x26')])+_0x74a4('0x27')]=_0x1d2788['id']||null;_0x212954[_['upperFirst'](_0x564967[_0x74a4('0x26')])+_0x74a4('0x28')]=_0x564967['interaction']?_0x564967[_0x74a4('0x29')]['id']:null;_0x212954[_['upperFirst'](_0x564967[_0x74a4('0x26')])+'MessageId']=_0x564967['message']?_0x564967[_0x74a4('0x2a')]['id']:null;_0x212954[_['upperFirst'](_0x564967[_0x74a4('0x26')])+(_0x564967[_0x74a4('0x26')]!==_0x74a4('0x2b')?_0x74a4('0x2c'):_0x74a4('0x2d'))]=_0x564967[_0x74a4('0x13')]?_0x564967[_0x74a4('0x13')]['id']:null;logger[_0x74a4('0x2e')](util[_0x74a4('0x14')](_0x74a4('0x2f'),_0x192001,_0x1d2788[_0x74a4('0x30')]));emitChannelQueueInteraction(_0x564967[_0x74a4('0x26')],_0x1d2788['name'],_0x212954,_0x564967[_0x74a4('0x13')][_0x74a4('0x30')],_0x564967[_0x74a4('0x2a')]['id'],!![],_0x1e6c5d,_0x1d2788['id']);if(rpc[_0x564967[_0x74a4('0x26')]+_0x74a4('0x31')]){return rpc[_0x564967[_0x74a4('0x26')]+_0x74a4('0x31')][_0x74a4('0x32')](_0x212954)[_0x74a4('0x33')](function(_0x2727af){logger[_0x74a4('0x34')](_0x74a4('0x35'));});}}}function stopRouting(_0x13dc41,_0x256b4f,_0x45ed0e,_0x404170){if(_0x13dc41&&_0x256b4f){_0x256b4f['waiting']-=0x1;var _0x36b46a={'leaveAt':moment()[_0x74a4('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x74a4('0x14')](_0x74a4('0x22')),'reason':_0x74a4('0x36')};logger[_0x74a4('0x2e')](util[_0x74a4('0x14')](_0x74a4('0x37'),_0x13dc41,_0x256b4f[_0x74a4('0x30')]));emitChannelQueueInteraction(_0x45ed0e[_0x74a4('0x26')],_0x256b4f['name'],_0x45ed0e[_0x74a4('0x21')],_0x45ed0e[_0x74a4('0x13')][_0x74a4('0x30')],_0x45ed0e[_0x74a4('0x2a')]['id'],![],_0x404170,_0x256b4f['id']);if(rpc[_0x45ed0e['channel']+_0x74a4('0x31')]){return rpc[_0x45ed0e[_0x74a4('0x26')]+_0x74a4('0x31')][_0x74a4('0x38')](_0x13dc41,_0x36b46a)['catch'](function(_0x549986){logger['error'](_0x74a4('0x39'));});}}}function endRouting(_0x35da13,_0x198531,_0x252d0c,_0x156d92){if(_0x35da13&&_0x198531){_0x198531[_0x74a4('0x20')]-=0x1;var _0x398e28={'leaveAt':moment()[_0x74a4('0x14')](_0x74a4('0x22')),'exitAt':moment()[_0x74a4('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x74a4('0x3a')};logger['info'](util[_0x74a4('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x35da13,_0x198531[_0x74a4('0x30')]));emitChannelQueueInteraction(_0x252d0c[_0x74a4('0x26')],_0x198531['name'],_0x252d0c['body'],_0x252d0c[_0x74a4('0x13')][_0x74a4('0x30')],_0x252d0c[_0x74a4('0x2a')]['id'],![],_0x156d92);if(rpc[_0x252d0c[_0x74a4('0x26')]+'QueueReport']){return rpc[_0x252d0c[_0x74a4('0x26')]+_0x74a4('0x31')][_0x74a4('0x38')](_0x35da13,_0x398e28)['catch'](function(_0x415e88){logger['error']('update\x20queue\x20report');});}}}function handleFindQueue(_0xf1abd1){return function(_0x5d3d95){return _0x5d3d95[_0x74a4('0x30')]['toLowerCase']()===_0xf1abd1['toLowerCase']();};}exports['consequence']=function(_0x36cc7a,_0x4444b7,_0xbfd4f1,_0x3317ba){return function(_0x4404bc){try{var _0x2648a1={'name':_0x4444b7[0x0],'timeout':_0x4444b7[0x1]};var _0x6c3452=queue[_0x74a4('0x0')](_0x2648a1,{'typecast':!![]});if(_0x6c3452[_0x74a4('0x3b')]){logger['error'](_0x74a4('0x3c'),_0x36cc7a,_[_0x74a4('0x3d')](_0x6c3452,_0x74a4('0x2a'))['join'](',\x20'));_0x4404bc[_0x74a4('0x3e')]();}else{var _0x5e61d0=_['find'](_0xbfd4f1[_0x3317ba[_0x74a4('0x26')]+_0x74a4('0x3f')],handleFindQueue(_0x2648a1['name']));if(_0x5e61d0){startRouting(_0x36cc7a,_0x5e61d0,_0x3317ba,_0xbfd4f1);var _0x480c8a=(_0x5e61d0[_0x74a4('0x3a')]||0xa)*0x3e8;var _0x31926b=(_0x2648a1[_0x74a4('0x3a')]||0x14)*0x3e8;var _0x1d11b3,_0x2443e2;if(_0x480c8a>_0x31926b){_0x31926b=_0x480c8a;}var _0x15c6f6=seqqueue[_0x74a4('0x40')](_0x480c8a);_0x15c6f6['id']=_0x36cc7a;_0x15c6f6[_0x74a4('0x41')]=_0x480c8a;_0x15c6f6[_0x74a4('0x42')]=_0x31926b;_0x15c6f6['channel']=_0x3317ba[_0x74a4('0x26')];_0xbfd4f1[_0x74a4('0x43')][_0x36cc7a]['on'](_0x74a4('0x44'),function(){logger[_0x74a4('0x2e')](_0x74a4('0x45'),_0x36cc7a);stopRouting(_0x36cc7a,_0x5e61d0,_0x3317ba,_0xbfd4f1);clearTimeout(_0x1d11b3);_0x1d11b3=undefined;_0x15c6f6[_0x74a4('0x46')](!![]);if(_0xbfd4f1[_0x74a4('0x43')][_0x36cc7a]){delete _0xbfd4f1[_0x74a4('0x43')][_0x36cc7a];}_0x4404bc['stop']();});_0xbfd4f1[_0x74a4('0x43')][_0x36cc7a]['on'](_0x74a4('0x47'),function(){if(_0xbfd4f1[_0x74a4('0x43')][_0x36cc7a]){delete _0xbfd4f1[_0x74a4('0x43')][_0x36cc7a];}});_0x1d11b3=setTimeout(function(){logger[_0x74a4('0x2e')](_0x74a4('0x48'),_0x36cc7a);endRouting(_0x36cc7a,_0x5e61d0,_0x3317ba,_0xbfd4f1);clearTimeout(_0x1d11b3);_0x15c6f6['close'](!![]);_0x4404bc['next']();},_0x31926b);switch(_0x5e61d0['strategy']){case _0x74a4('0x49'):strategy['rrmemory'](_0x15c6f6,_0x5e61d0,_0xbfd4f1,_0x3317ba);break;default:strategy[_0x74a4('0x4a')](_0x15c6f6,_0x5e61d0,_0xbfd4f1,_0x3317ba);}}else{logger[_0x74a4('0x34')](_0x74a4('0x4b'),_0x36cc7a,_0x2648a1[_0x74a4('0x30')]);_0x4404bc[_0x74a4('0x3e')]();}}}catch(_0x5c6245){console[_0x74a4('0x4c')](_0x5c6245);logger[_0x74a4('0x34')](_0x74a4('0x3c'),_0x36cc7a,_0x5c6245['stack']);_0x4404bc[_0x74a4('0x3e')]();}};}; \ 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 6a6e2da..95e6456 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 _0x8a08=['RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','bind','handleTimeout','drained','handleDrained','prototype','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agent','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x8a08,0x1f2));var _0x88a0=function(_0x4c1e31,_0x4ff96d){_0x4c1e31=_0x4c1e31-0x0;var _0x58757c=_0x8a08[_0x4c1e31];return _0x58757c;};'use strict';var _=require(_0x88a0('0x0'));var uuid=require(_0x88a0('0x1'));var util=require(_0x88a0('0x2'));var logger=require(_0x88a0('0x3'))(_0x88a0('0x4'));var Agent=function(_0x49aba8,_0x3a0b90,_0x1ea0d1,_0x2eb5b1){this[_0x88a0('0x5')]=uuid['v4']();this[_0x88a0('0x6')]=_0x49aba8;this['agent']=_0x3a0b90;this[_0x88a0('0x7')]=_0x1ea0d1;this[_0x88a0('0x4')]=_0x2eb5b1;this[_0x88a0('0x6')][_0x88a0('0x8')](this['handleRun'][_0x88a0('0x9')](this),this[_0x88a0('0xa')][_0x88a0('0x9')](this));this[_0x88a0('0x6')]['on']('timeout',this[_0x88a0('0xa')][_0x88a0('0x9')](this));this[_0x88a0('0x6')]['on'](_0x88a0('0xb'),this[_0x88a0('0xc')]['bind'](this));};Agent[_0x88a0('0xd')][_0x88a0('0x8')]=function(){this[_0x88a0('0x6')][_0x88a0('0x8')](this[_0x88a0('0xe')]['bind'](this),this[_0x88a0('0xa')]['bind'](this));};Agent['prototype'][_0x88a0('0xc')]=function(){this[_0x88a0('0xa')](!![]);};Agent[_0x88a0('0xd')][_0x88a0('0xe')]=function(_0x313740){logger[_0x88a0('0xf')](_0x88a0('0x10'),this['squeue']['id'],this['agent']['id']);if(_[_0x88a0('0x11')](this[_0x88a0('0x7')][_0x88a0('0x12')][this['agent']['id']])){logger[_0x88a0('0xf')](_0x88a0('0x13'),this[_0x88a0('0x6')]['id'],this[_0x88a0('0x14')]['id']);setTimeout(this['push'][_0x88a0('0x9')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0x88a0('0x15')](this[_0x88a0('0x6')]['id'],this['realtime'][_0x88a0('0x12')][this[_0x88a0('0x14')]['id']],this[_0x88a0('0x6')][_0x88a0('0x16')],![])){this['realtime']['agents'][this[_0x88a0('0x14')]['id']][_0x88a0('0x17')]=!![];this[_0x88a0('0x7')]['agents'][this[_0x88a0('0x14')]['id']][_0x88a0('0x18')]=undefined;util[_0x88a0('0x19')](this['notificationId'],this[_0x88a0('0x6')]['id'],this['realtime'][_0x88a0('0x12')][this[_0x88a0('0x14')]['id']],null,this[_0x88a0('0x4')]);util[_0x88a0('0x1a')](this[_0x88a0('0x6')]['id'],this[_0x88a0('0x7')][_0x88a0('0x12')][this[_0x88a0('0x14')]['id']],_0x88a0('0x1b')+(this[_0x88a0('0x4')]['forcedOwnership']?_0x88a0('0x1c'):''));}else{logger[_0x88a0('0xf')](_0x88a0('0x1d'),this[_0x88a0('0x6')]['id'],this[_0x88a0('0x14')]['id']);setTimeout(this[_0x88a0('0x8')]['bind'](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0xa68350){if(_[_0x88a0('0x11')](this['realtime'][_0x88a0('0x12')][this[_0x88a0('0x14')]['id']])){return logger[_0x88a0('0xf')](_0x88a0('0x13'),this[_0x88a0('0x6')]['id'],this[_0x88a0('0x14')]['id']);}else{logger[_0x88a0('0xf')](_0x88a0('0x1e'),this[_0x88a0('0x6')]['id'],this[_0x88a0('0x14')]['id']);util[_0x88a0('0x1f')](this[_0x88a0('0x5')],this[_0x88a0('0x6')]['id'],this[_0x88a0('0x7')][_0x88a0('0x12')][this[_0x88a0('0x14')]['id']],null,this[_0x88a0('0x4')]);this[_0x88a0('0x7')][_0x88a0('0x12')][this[_0x88a0('0x14')]['id']]['busy']=![];this['realtime'][_0x88a0('0x12')][this[_0x88a0('0x14')]['id']][_0x88a0('0x18')]=undefined;util[_0x88a0('0x1a')](this[_0x88a0('0x6')]['id'],this[_0x88a0('0x7')][_0x88a0('0x12')][this[_0x88a0('0x14')]['id']],_0xa68350?_0x88a0('0x20'):_0x88a0('0x21'));}if(!_0xa68350){setTimeout(this['push'][_0x88a0('0x9')](this),0x3e8);}};function agent(_0x2d9d1b,_0x247ea2,_0x5e7fe1,_0x1d14c3){return new Agent(_0x2d9d1b,_0x247ea2,_0x5e7fe1,_0x1d14c3);}module[_0x88a0('0x22')]=agent; \ No newline at end of file +var _0xa93a=['push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime'];(function(_0x2e24d0,_0x34db1d){var _0x5aec4a=function(_0x1dbf44){while(--_0x1dbf44){_0x2e24d0['push'](_0x2e24d0['shift']());}};_0x5aec4a(++_0x34db1d);}(_0xa93a,0x9d));var _0xaa93=function(_0x2d9cc0,_0x34f334){_0x2d9cc0=_0x2d9cc0-0x0;var _0x540792=_0xa93a[_0x2d9cc0];return _0x540792;};'use strict';var _=require('lodash');var uuid=require(_0xaa93('0x0'));var util=require(_0xaa93('0x1'));var logger=require(_0xaa93('0x2'))(_0xaa93('0x3'));var Agent=function(_0x25930d,_0x1662c9,_0x280690,_0x5b2580){this[_0xaa93('0x4')]=uuid['v4']();this[_0xaa93('0x5')]=_0x25930d;this[_0xaa93('0x6')]=_0x1662c9;this[_0xaa93('0x7')]=_0x280690;this[_0xaa93('0x3')]=_0x5b2580;this[_0xaa93('0x5')][_0xaa93('0x8')](this[_0xaa93('0x9')][_0xaa93('0xa')](this),this[_0xaa93('0xb')][_0xaa93('0xa')](this));this['squeue']['on'](_0xaa93('0xc'),this['handleTimeout'][_0xaa93('0xa')](this));this[_0xaa93('0x5')]['on']('drained',this[_0xaa93('0xd')][_0xaa93('0xa')](this));};Agent[_0xaa93('0xe')][_0xaa93('0x8')]=function(){this[_0xaa93('0x5')][_0xaa93('0x8')](this[_0xaa93('0x9')][_0xaa93('0xa')](this),this[_0xaa93('0xb')][_0xaa93('0xa')](this));};Agent[_0xaa93('0xe')]['handleDrained']=function(){this[_0xaa93('0xb')](!![]);};Agent[_0xaa93('0xe')][_0xaa93('0x9')]=function(_0x5a4dfc){logger['info'](_0xaa93('0xf'),this[_0xaa93('0x5')]['id'],this[_0xaa93('0x6')]['id']);if(_[_0xaa93('0x10')](this[_0xaa93('0x7')]['agents'][this[_0xaa93('0x6')]['id']])){logger[_0xaa93('0x11')](_0xaa93('0x12'),this[_0xaa93('0x5')]['id'],this[_0xaa93('0x6')]['id']);setTimeout(this[_0xaa93('0x8')][_0xaa93('0xa')](this),0x3e8);}else{if(this[_0xaa93('0x3')][_0xaa93('0x13')]||util['isAgentAvailable'](this[_0xaa93('0x5')]['id'],this[_0xaa93('0x7')][_0xaa93('0x14')][this[_0xaa93('0x6')]['id']],this['squeue'][_0xaa93('0x15')],![])){this[_0xaa93('0x7')][_0xaa93('0x14')][this[_0xaa93('0x6')]['id']][_0xaa93('0x16')]=!![];this[_0xaa93('0x7')]['agents'][this[_0xaa93('0x6')]['id']][_0xaa93('0x17')]=undefined;util[_0xaa93('0x18')](this[_0xaa93('0x4')],this[_0xaa93('0x5')]['id'],this[_0xaa93('0x7')]['agents'][this[_0xaa93('0x6')]['id']],null,this[_0xaa93('0x3')]);util[_0xaa93('0x19')](this['squeue']['id'],this['realtime']['agents'][this[_0xaa93('0x6')]['id']],_0xaa93('0x1a')+(this[_0xaa93('0x3')][_0xaa93('0x13')]?_0xaa93('0x1b'):''));}else{logger[_0xaa93('0x11')](_0xaa93('0x1c'),this[_0xaa93('0x5')]['id'],this[_0xaa93('0x6')]['id']);setTimeout(this['push'][_0xaa93('0xa')](this),0x3e8);}}};Agent[_0xaa93('0xe')]['handleTimeout']=function(_0x51773b){if(_[_0xaa93('0x10')](this['realtime'][_0xaa93('0x14')][this[_0xaa93('0x6')]['id']])){return logger['info'](_0xaa93('0x12'),this['squeue']['id'],this['agent']['id']);}else{logger['info'](_0xaa93('0x1d'),this[_0xaa93('0x5')]['id'],this[_0xaa93('0x6')]['id']);util[_0xaa93('0x1e')](this['notificationId'],this[_0xaa93('0x5')]['id'],this[_0xaa93('0x7')]['agents'][this[_0xaa93('0x6')]['id']],null,this['routing']);this[_0xaa93('0x7')][_0xaa93('0x14')][this[_0xaa93('0x6')]['id']][_0xaa93('0x16')]=![];this[_0xaa93('0x7')][_0xaa93('0x14')][this[_0xaa93('0x6')]['id']][_0xaa93('0x17')]=undefined;util[_0xaa93('0x19')](this['squeue']['id'],this[_0xaa93('0x7')][_0xaa93('0x14')][this['agent']['id']],_0x51773b?_0xaa93('0x1f'):'TIMEOUT');}if(!_0x51773b){setTimeout(this['push'][_0xaa93('0xa')](this),0x3e8);}};function agent(_0x1c5a45,_0x435e0d,_0x23df9a,_0x171eb3){return new Agent(_0x1c5a45,_0x435e0d,_0x23df9a,_0x171eb3);}module[_0xaa93('0x20')]=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 3f851c3..bdd20c6 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 _0x5301=['channel','RINGING','busy','busyQueue','name','showNotification','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','writeLog','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','handleRun','bind','handleTimeout','drained','handleDrained','prototype','push','isNil','queue','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x5301,0x157));var _0x1530=function(_0x1e65de,_0x57ef24){_0x1e65de=_0x1e65de-0x0;var _0x25f4da=_0x5301[_0x1e65de];return _0x25f4da;};'use strict';var _=require('lodash');var uuid=require(_0x1530('0x0'));var util=require(_0x1530('0x1'));var logger=require(_0x1530('0x2'))(_0x1530('0x3'));var Beepall=function(_0x34cc3a,_0x5b02c1,_0x1fa680,_0x639c58){this[_0x1530('0x4')]=uuid['v4']();this[_0x1530('0x5')]=_0x34cc3a;this['queue']=_0x5b02c1;this[_0x1530('0x6')]=_0x1fa680;this['routing']=_0x639c58;this[_0x1530('0x5')]['push'](this[_0x1530('0x7')][_0x1530('0x8')](this),this[_0x1530('0x9')][_0x1530('0x8')](this));this[_0x1530('0x5')]['on']('timeout',this['handleTimeout'][_0x1530('0x8')](this));this[_0x1530('0x5')]['on'](_0x1530('0xa'),this[_0x1530('0xb')]['bind'](this));};Beepall[_0x1530('0xc')][_0x1530('0xd')]=function(){this[_0x1530('0x5')][_0x1530('0xd')](this['handleRun']['bind'](this),this[_0x1530('0x9')][_0x1530('0x8')](this));};Beepall['prototype'][_0x1530('0xb')]=function(_0xbdc8b5){this['handleTimeout'](!![]);};Beepall[_0x1530('0xc')][_0x1530('0x7')]=function(_0x40ec08){var _0x190f8c=!![];if(!_[_0x1530('0xe')](this[_0x1530('0xf')])&&!_[_0x1530('0xe')](this[_0x1530('0xf')][_0x1530('0x10')])&&this[_0x1530('0xf')][_0x1530('0x10')][_0x1530('0x11')]>0x0){for(var _0x4da2b1=0x0,_0x1b8e27;_0x4da2b10x0){for(var _0x4f5164=0x0,_0x33a1db;_0x4f51640x0&&_0x326be8[_0xbc72e6+'CurrentCapacity']>=_0x326be8[_0xbc72e6+_0x43d0('0x24')]){writeLog(_0x19d2ff,_0x326be8,_0xbc72e6[_0x43d0('0x26')]()+_0x43d0('0x27'));return![];}}return!![];};exports['showNotification']=function(_0x447725,_0x38e89e,_0x2c4f3f,_0x1eb771,_0x37d78f){return sendNotification(!![],_0x447725,_0x38e89e,_0x2c4f3f,_0x1eb771,_0x37d78f);};exports[_0x43d0('0x28')]=function(_0x31a057,_0x4a3cd4,_0x2b0784,_0x2f5bc5,_0x6bc471){return sendNotification(![],_0x31a057,_0x4a3cd4,_0x2b0784,_0x2f5bc5,_0x6bc471);};exports['writeLog']=writeLog; \ No newline at end of file +var _0xb016=['OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','writeLog','lodash','util','ioredis','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:save','split','name','notificationSound','account','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','user:%s','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online'];(function(_0x5ddda9,_0x43e558){var _0x53a004=function(_0x2794a1){while(--_0x2794a1){_0x5ddda9['push'](_0x5ddda9['shift']());}};_0x53a004(++_0x43e558);}(_0xb016,0x159));var _0x6b01=function(_0x527977,_0x91d911){_0x527977=_0x527977-0x0;var _0x48f73d=_0xb016[_0x527977];return _0x48f73d;};'use strict';var _=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var utils=require('../utils');var Mustache=require('mustache');var Redis=require(_0x6b01('0x2'));var config=require('../../../../../config/environment');var logger=require(_0x6b01('0x3'))(_0x6b01('0x4'));config[_0x6b01('0x5')]=_[_0x6b01('0x6')](config['redis'],{'host':_0x6b01('0x7'),'port':0x18eb});var io=require(_0x6b01('0x8'))(new Redis(config[_0x6b01('0x5')]));function emit(_0x5759a1,_0x5c5bfb,_0x374aab){io['to'](_0x5759a1)[_0x6b01('0x9')](_0x5c5bfb,_0x374aab);}function sendNotification(_0x526a7d,_0x5f4636,_0x92bf23,_0x1cb3a6,_0x2c4e48,_0x242394){io['to'](util[_0x6b01('0xa')]('user:%s',_0x1cb3a6['name']))[_0x6b01('0x9')](_0x6b01('0xb'),_0x1cb3a6);var _0x2660c7=_0x242394||{};var _0x5a8817=_0x92bf23[_0x6b01('0xc')]('.');var _0x5c54e4={'uniqueid':_0x5f4636,'channel':_0x5a8817[0x0],'id':_0x5a8817[0x1],'title':_0x5a8817[0x0]+'\x20interaction','interactionId':_0x5a8817[0x2],'queue':_0x2c4e48?_0x2c4e48[_0x6b01('0xd')]:null,'sound':_0x2660c7['account'][_0x6b01('0xe')],'shake':_0x2660c7[_0x6b01('0xf')]['notificationShake']};try{if(!_0x2660c7[_0x6b01('0x10')]){_0x2660c7['body']={};}if(_0x2c4e48){_0x2660c7['body']['queue']=_0x2c4e48;}else if(_0x2660c7[_0x6b01('0x10')]['queue']){delete _0x2660c7['body'][_0x6b01('0x11')];}_0x5c54e4[_0x6b01('0x12')]=utils[_0x6b01('0x13')](_0x2660c7[_0x6b01('0xf')][_0x6b01('0x14')],_0x2660c7);}catch(_0x2d077f){_0x5c54e4[_0x6b01('0x12')]=_0x6b01('0x15');logger[_0x6b01('0x16')](util[_0x6b01('0xa')](_0x6b01('0x17'),_0x5f4636,_0x2d077f['message']));}io['to'](util[_0x6b01('0xa')](_0x6b01('0x18'),_0x1cb3a6[_0x6b01('0xd')]))[_0x6b01('0x9')](util[_0x6b01('0xa')](_0x6b01('0x19'),_0x526a7d?_0x6b01('0x1a'):_0x6b01('0x1b')),_0x5c54e4);}function writeLog(_0x54a942,_0x3029e2,_0xc1f453){return logger[_0x6b01('0x1c')](util[_0x6b01('0xa')](_0x6b01('0x1d'),_0x54a942,_0x3029e2[_0x6b01('0xd')],_0xc1f453));}exports[_0x6b01('0x1e')]=function(_0x542fab,_0x7caa07,_0xcf9200,_0x42c990){if(_0x7caa07['busy']){writeLog(_0x542fab,_0x7caa07,_0x6b01('0x1f'));return![];}if(!_0x7caa07[_0x6b01('0x20')]){writeLog(_0x542fab,_0x7caa07,_0x6b01('0x21'));return![];}if(_0x7caa07[_0xcf9200+_0x6b01('0x22')]){writeLog(_0x542fab,_0x7caa07,_0x6b01('0x23'));return![];}if(_0x42c990&&_0x7caa07[_0x6b01('0x24')](_0xcf9200+_0x6b01('0x25'))&&_0x7caa07[_0x6b01('0x24')](_0xcf9200+_0x6b01('0x26'))){if(_0x7caa07[_0xcf9200+_0x6b01('0x25')]>0x0&&_0x7caa07[_0xcf9200+_0x6b01('0x26')]>=_0x7caa07[_0xcf9200+_0x6b01('0x25')]){writeLog(_0x542fab,_0x7caa07,_0xcf9200[_0x6b01('0x27')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x6b01('0x28')]=function(_0x220efb,_0x32128f,_0x21f165,_0x68491,_0x528cbd){return sendNotification(!![],_0x220efb,_0x32128f,_0x21f165,_0x68491,_0x528cbd);};exports['hideNotification']=function(_0x3fae61,_0x3df3d4,_0xc574c,_0x8883d1,_0x2a894e){return sendNotification(![],_0x3fae61,_0x3df3d4,_0xc574c,_0x8883d1,_0x2a894e);};exports[_0x6b01('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 55f97da..4c910fd 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 _0xc03d=['[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim'];(function(_0xfcf877,_0x4d0b1e){var _0x2145f3=function(_0x51cc4a){while(--_0x51cc4a){_0xfcf877['push'](_0xfcf877['shift']());}};_0x2145f3(++_0x4d0b1e);}(_0xc03d,0x127));var _0xdc03=function(_0x538404,_0x3988ee){_0x538404=_0x538404-0x0;var _0x45b9ba=_0xc03d[_0x538404];return _0x45b9ba;};'use strict';var schema=require(_0xdc03('0x0'));var sh=require(_0xdc03('0x1'));var _=require(_0xdc03('0x2'));var utils=require('./utils');var logger=require(_0xdc03('0x3'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0xdc03('0x4')}});exports[_0xdc03('0x5')]=function(_0x3692a3,_0xbb2ba4){return function(_0x49e6b0){try{var _0x2fc71d={'command':_0xbb2ba4[0x0]};var _0x36ec86=system[_0xdc03('0x0')](_0x2fc71d,{'typecast':!![]});if(_0x36ec86[_0xdc03('0x6')]){logger[_0xdc03('0x7')](_0xdc03('0x8'),_0x3692a3,_[_0xdc03('0x9')](_0x36ec86,_0xdc03('0xa'))[_0xdc03('0xb')](',\x20'));logger[_0xdc03('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x3692a3);_0x49e6b0['next']();}else{var _0x38c75f=this;var _0x476d76=utils[_0xdc03('0xd')](_0xbb2ba4[0x0],this);logger[_0xdc03('0xc')](_0xdc03('0xe'),_0x3692a3,_0x476d76);sh[_0xdc03('0xf')](_[_0xdc03('0x10')](_0x476d76),function(_0x50d01a,_0x364e2e){logger[_0xdc03('0xc')](_0xdc03('0x11'),_0x3692a3,_0x50d01a);if(_0x50d01a==0x0){var _0x1d27f0=_0x364e2e[_0xdc03('0x12')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0xbb2ba4[0x1])||_[_0xdc03('0x13')](_0xbb2ba4[0x1])){logger[_0xdc03('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x3692a3);_0x38c75f[_0xdc03('0x14')][_0xbb2ba4[0x1]]=_0x1d27f0;}else{logger['info'](_0xdc03('0x15'),_0x3692a3,_0xbb2ba4[0x1],_0x1d27f0);_0x38c75f[_0xdc03('0x14')][_0xbb2ba4[0x1]]=_0x1d27f0;}}_0x49e6b0[_0xdc03('0x16')]();});}}catch(_0x16e062){logger[_0xdc03('0x7')](_0xdc03('0x8'),_0x3692a3,_[_0xdc03('0x17')](_0x16e062)?JSON[_0xdc03('0x18')](_0x16e062):_0x16e062);logger['info'](_0xdc03('0x19'),_0x3692a3);_0x49e6b0[_0xdc03('0x16')]();}};}; \ No newline at end of file +var _0x6816=['info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','next','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','message','join'];(function(_0x2c286b,_0x1d9043){var _0x142433=function(_0x47be70){while(--_0x47be70){_0x2c286b['push'](_0x2c286b['shift']());}};_0x142433(++_0x1d9043);}(_0x6816,0x16f));var _0x6681=function(_0x40cfe5,_0x2421a4){_0x40cfe5=_0x40cfe5-0x0;var _0x20d3d4=_0x6816[_0x40cfe5];return _0x20d3d4;};'use strict';var schema=require(_0x6681('0x0'));var sh=require(_0x6681('0x1'));var _=require(_0x6681('0x2'));var utils=require('./utils');var logger=require(_0x6681('0x3'))('routing');var system=schema({'command':{'type':_0x6681('0x4'),'required':!![],'message':_0x6681('0x5')}});exports[_0x6681('0x6')]=function(_0xfac1c9,_0x2179df){return function(_0x1b038d){try{var _0x2c5e2f={'command':_0x2179df[0x0]};var _0x26181e=system[_0x6681('0x0')](_0x2c5e2f,{'typecast':!![]});if(_0x26181e[_0x6681('0x7')]){logger[_0x6681('0x8')]('[%s][SYSTEM]\x20%s',_0xfac1c9,_['map'](_0x26181e,_0x6681('0x9'))[_0x6681('0xa')](',\x20'));logger[_0x6681('0xb')](_0x6681('0xc'),_0xfac1c9);_0x1b038d['next']();}else{var _0x19b371=this;var _0x21c6dc=utils[_0x6681('0xd')](_0x2179df[0x0],this);logger[_0x6681('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0xfac1c9,_0x21c6dc);sh[_0x6681('0xe')](_[_0x6681('0xf')](_0x21c6dc),function(_0x256aa6,_0x176591){logger['info'](_0x6681('0x10'),_0xfac1c9,_0x256aa6);if(_0x256aa6==0x0){var _0x4cdcf5=_0x176591[_0x6681('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0x6681('0x12')](_0x2179df[0x1])||_[_0x6681('0x13')](_0x2179df[0x1])){logger[_0x6681('0xb')](_0x6681('0x14'),_0xfac1c9);_0x19b371['body'][_0x2179df[0x1]]=_0x4cdcf5;}else{logger[_0x6681('0xb')](_0x6681('0x15'),_0xfac1c9,_0x2179df[0x1],_0x4cdcf5);_0x19b371[_0x6681('0x16')][_0x2179df[0x1]]=_0x4cdcf5;}}_0x1b038d[_0x6681('0x17')]();});}}catch(_0x1edcae){logger[_0x6681('0x8')](_0x6681('0x18'),_0xfac1c9,_[_0x6681('0x19')](_0x1edcae)?JSON[_0x6681('0x1a')](_0x1edcae):_0x1edcae);logger[_0x6681('0xb')](_0x6681('0xc'),_0xfac1c9);_0x1b038d[_0x6681('0x17')]();}};}; \ 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 b32077a..f9cfb25 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 _0xb2ee=['[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','[%s][TAG]\x20%s','stringify','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','consequence','length','error','message','next','Interaction','channel','interaction','then'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xb2ee,0x101));var _0xeb2e=function(_0x319380,_0x5ecd07){_0x319380=_0x319380-0x0;var _0x1f0823=_0xb2ee[_0x319380];return _0x1f0823;};'use strict';var schema=require(_0xeb2e('0x0'));var _=require(_0xeb2e('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xeb2e('0x2')),'smsInteraction':require(_0xeb2e('0x3')),'mailInteraction':require(_0xeb2e('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xeb2e('0x5'))};var logger=require(_0xeb2e('0x6'))(_0xeb2e('0x7'));var tag=schema({'tag':{'type':_0xeb2e('0x8'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0xeb2e('0x9')]=function(_0x97bab6,_0x4bbe1a,_0x34597d,_0x3e83a1){return function(_0x4b1ea2){try{var _0x5a94d0={'tag':_0x4bbe1a[0x0]};var _0x5b0821=tag[_0xeb2e('0x0')](_0x5a94d0,{'typecast':!![]});if(_0x5b0821[_0xeb2e('0xa')]){logger[_0xeb2e('0xb')]('[%s][TAG]\x20%s',_0x97bab6,_['map'](_0x5b0821,_0xeb2e('0xc'))['join'](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x97bab6);_0x4b1ea2[_0xeb2e('0xd')]();}else{var _0x382694={'ids':[_0x4bbe1a[0x0]]};if(rpc[_0x3e83a1['channel']+_0xeb2e('0xe')]){rpc[_0x3e83a1[_0xeb2e('0xf')]+'Interaction']['addTags'](_0x3e83a1[_0xeb2e('0x10')]['id'],_0x382694)[_0xeb2e('0x11')](function(_0x452d8b){logger['info'](_0xeb2e('0x12'),_0x97bab6,_0x4bbe1a[0x1],_0x3e83a1[_0xeb2e('0xf')],_0x3e83a1[_0xeb2e('0x10')]['id']);})['catch'](function(_0x418eef){logger[_0xeb2e('0xb')](_0xeb2e('0x13'),_0x97bab6,JSON[_0xeb2e('0x14')](_0x418eef));logger[_0xeb2e('0x15')](_0xeb2e('0x16'),_0x97bab6);})[_0xeb2e('0x17')](function(){_0x4b1ea2[_0xeb2e('0xd')]();});}}}catch(_0x2d3253){logger[_0xeb2e('0xb')](_0xeb2e('0x13'),_0x97bab6,_[_0xeb2e('0x18')](_0x2d3253)?JSON[_0xeb2e('0x14')](_0x2d3253):_0x2d3253);logger[_0xeb2e('0x15')](_0xeb2e('0x16'),_0x97bab6);_0x4b1ea2[_0xeb2e('0xd')]();}};}; \ No newline at end of file +var _0x3e97=['length','error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','number','consequence'];(function(_0x3bda98,_0x1f790f){var _0x148844=function(_0x5850a1){while(--_0x5850a1){_0x3bda98['push'](_0x3bda98['shift']());}};_0x148844(++_0x1f790f);}(_0x3e97,0xbf));var _0x73e9=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x3e97[_0x5b644e];return _0x49c6bf;};'use strict';var schema=require(_0x73e9('0x0'));var _=require(_0x73e9('0x1'));var rpc={'chatInteraction':require(_0x73e9('0x2')),'openchannelInteraction':require(_0x73e9('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x73e9('0x4')),'faxInteraction':require(_0x73e9('0x5')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x73e9('0x6'))('routing');var tag=schema({'tag':{'type':_0x73e9('0x7'),'required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x73e9('0x8')]=function(_0x49b25c,_0xdbc975,_0x55dead,_0x3d8731){return function(_0x14d9f8){try{var _0x29c301={'tag':_0xdbc975[0x0]};var _0xbb070d=tag[_0x73e9('0x0')](_0x29c301,{'typecast':!![]});if(_0xbb070d[_0x73e9('0x9')]){logger[_0x73e9('0xa')](_0x73e9('0xb'),_0x49b25c,_[_0x73e9('0xc')](_0xbb070d,'message')[_0x73e9('0xd')](',\x20'));logger[_0x73e9('0xe')](_0x73e9('0xf'),_0x49b25c);_0x14d9f8[_0x73e9('0x10')]();}else{var _0xc43d1c={'ids':[_0xdbc975[0x0]]};if(rpc[_0x3d8731[_0x73e9('0x11')]+'Interaction']){rpc[_0x3d8731['channel']+_0x73e9('0x12')][_0x73e9('0x13')](_0x3d8731['interaction']['id'],_0xc43d1c)[_0x73e9('0x14')](function(_0x198f1b){logger[_0x73e9('0xe')](_0x73e9('0x15'),_0x49b25c,_0xdbc975[0x1],_0x3d8731[_0x73e9('0x11')],_0x3d8731['interaction']['id']);})['catch'](function(_0x36181e){logger[_0x73e9('0xa')](_0x73e9('0xb'),_0x49b25c,JSON[_0x73e9('0x16')](_0x36181e));logger[_0x73e9('0xe')](_0x73e9('0xf'),_0x49b25c);})[_0x73e9('0x17')](function(){_0x14d9f8[_0x73e9('0x10')]();});}}}catch(_0x14d81a){logger['error'](_0x73e9('0xb'),_0x49b25c,_[_0x73e9('0x18')](_0x14d81a)?JSON[_0x73e9('0x16')](_0x14d81a):_0x14d81a);logger[_0x73e9('0xe')](_0x73e9('0xf'),_0x49b25c);_0x14d9f8['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 27a4221..d4833db 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x3fa871,_0x50a4c7){var _0x55da0d=function(_0x252dde){while(--_0x252dde){_0x3fa871['push'](_0x3fa871['shift']());}};_0x55da0d(++_0x50a4c7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x67f5d9,_0x2b939d){var _0x386271=function(_0x54aa30){while(--_0x54aa30){_0x67f5d9['push'](_0x67f5d9['shift']());}};_0x386271(++_0x2b939d);}(_0xe706,0xa3));var _0x6e70=function(_0x273e2c,_0x2acc61){_0x273e2c=_0x273e2c-0x0;var _0x11928d=_0xe706[_0x273e2c];return _0x11928d;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 5b8a2f5..619ca7a 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 _0x7f56=['Please\x20create\x20a\x20new\x20file\x20under','rules','execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','QueueReport','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','waiting','mailQueues','available','loggedIn','name','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','isNil','IntervalId','Intervals','map','interval','message','interaction','applications','length','existsSync','.js','toLowerCase','appdata','split','channel','mail','push','slice','join','dialogflow','dialogflowv2','amazonlex','tag','TagId','format','%s:%s:%s','app','./interval','condition','intervals','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error'];(function(_0x34e37e,_0x3db1ca){var _0x4eb5a3=function(_0x9e3f45){while(--_0x9e3f45){_0x34e37e['push'](_0x34e37e['shift']());}};_0x4eb5a3(++_0x3db1ca);}(_0x7f56,0x155));var _0x67f5=function(_0x1a0600,_0x41feef){_0x1a0600=_0x1a0600-0x0;var _0x734670=_0x7f56[_0x1a0600];return _0x734670;};'use strict';var _=require(_0x67f5('0x0'));var util=require(_0x67f5('0x1'));var path=require(_0x67f5('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x67f5('0x3'));var uuid=require(_0x67f5('0x4'));var config=require(_0x67f5('0x5'));var logger=require(_0x67f5('0x6'))(_0x67f5('0x7'));var rpc={'openchannelQueueReport':require(_0x67f5('0x8')),'mailQueueReport':require(_0x67f5('0x9')),'chatQueueReport':require(_0x67f5('0xa')),'smsQueueReport':require(_0x67f5('0xb')),'faxQueueReport':require(_0x67f5('0xc')),'whatsappQueueReport':require(_0x67f5('0xd'))};var RuleEngine=require(_0x67f5('0xe'));function getId(_0xe94053,_0xa1ae36,_0x25fa74){return util['format']('%s.%s.%s',_0xe94053,_0xa1ae36||0x0,_0x25fa74||0x0);}function getIntervals(_0xdce1ad,_0x1778b2){var _0x22194a=[];if(!_[_0x67f5('0xf')](_0x1778b2[_0x67f5('0x10')])&&!_[_0x67f5('0xf')](_0xdce1ad[_0x1778b2[_0x67f5('0x10')]])&&!_[_0x67f5('0xf')](_0xdce1ad[_0x1778b2[_0x67f5('0x10')]][_0x67f5('0x11')])){_0x22194a=_[_0x67f5('0x12')](_0xdce1ad[_0x1778b2[_0x67f5('0x10')]]['Intervals'],_0x67f5('0x13'));}else if(!_[_0x67f5('0xf')](_0x1778b2[_0x67f5('0x13')])){_0x22194a=[_0x1778b2[_0x67f5('0x13')]];}return _0x22194a;}exports['listen']=function(_0x182dbc){_0x182dbc['rules']={};return new BPromise(function(_0x19b7ac,_0x2f7dcd){var _0x3573f7={'Start':function(_0x1a2e6e){var _0x47efb9=this;return new Promise(function(_0x372e65,_0x543db7){if(_0x1a2e6e){try{var _0x1641c6=[];var _0x4f9880=getId(_0x1a2e6e['channel'],_0x1a2e6e['message']?_0x1a2e6e[_0x67f5('0x14')]['id']:0x0,_0x1a2e6e['interaction']?_0x1a2e6e[_0x67f5('0x15')]['id']:0x0);if(_0x1a2e6e[_0x67f5('0x16')]&&_['isArray'](_0x1a2e6e[_0x67f5('0x16')])&&_0x1a2e6e[_0x67f5('0x16')][_0x67f5('0x17')]){for(var _0x284573=0x0;_0x284573<_0x1a2e6e[_0x67f5('0x16')][_0x67f5('0x17')];_0x284573+=0x1){var _0x4213f0=_0x1a2e6e[_0x67f5('0x16')][_0x284573];if(fs[_0x67f5('0x18')](path['join'](__dirname,_0x67f5('0x16'),_0x4213f0['app']+_0x67f5('0x19')))){var _0x3a83fb=[];switch(_0x4213f0['app'][_0x67f5('0x1a')]()){case'autoreply':var _0x177f8c=_0x4213f0[_0x67f5('0x1b')][_0x67f5('0x1c')](',');if(_0x1a2e6e[_0x67f5('0x1d')]===_0x67f5('0x1e')){_0x3a83fb[_0x67f5('0x1f')](_0x177f8c[0x0]);_0x3a83fb['push'](_0x177f8c[0x1]);_0x3a83fb[_0x67f5('0x1f')](_0x177f8c[_0x67f5('0x20')](0x2,_0x177f8c[_0x67f5('0x17')])[_0x67f5('0x21')](','));}else{_0x3a83fb[_0x67f5('0x1f')](_0x177f8c[0x0]);_0x3a83fb[_0x67f5('0x1f')](_0x177f8c['slice'](0x1,_0x177f8c[_0x67f5('0x17')])[_0x67f5('0x21')](','));}break;case _0x67f5('0x22'):var _0x405a4d=_0x4213f0[_0x67f5('0x1b')]['split'](',');_0x3a83fb['push'](_0x405a4d[0x0]);_0x3a83fb['push'](_0x405a4d[0x1]);_0x3a83fb['push'](_0x405a4d['slice'](0x2,_0x405a4d[_0x67f5('0x17')])[_0x67f5('0x21')](','));break;case _0x67f5('0x23'):var _0x510d30=_0x4213f0[_0x67f5('0x1b')][_0x67f5('0x1c')](',');_0x3a83fb[_0x67f5('0x1f')](_0x510d30[0x0]);_0x3a83fb[_0x67f5('0x1f')](_0x510d30[0x1]);_0x3a83fb[_0x67f5('0x1f')](_0x510d30[0x2]);_0x3a83fb['push'](_0x510d30[0x3]);_0x3a83fb[_0x67f5('0x1f')](_0x510d30['slice'](0x4,_0x510d30[_0x67f5('0x17')])['join'](','));break;case _0x67f5('0x24'):var _0x21c2bb=_0x4213f0[_0x67f5('0x1b')]['split'](',');_0x3a83fb[_0x67f5('0x1f')](_0x21c2bb[0x0]);_0x3a83fb[_0x67f5('0x1f')](_0x21c2bb[0x1]);_0x3a83fb[_0x67f5('0x1f')](_0x21c2bb[0x2]);_0x3a83fb[_0x67f5('0x1f')](_0x21c2bb[0x3]);_0x3a83fb[_0x67f5('0x1f')](_0x21c2bb['slice'](0x4,_0x21c2bb[_0x67f5('0x17')])[_0x67f5('0x21')](','));break;case _0x67f5('0x14'):_0x3a83fb[_0x67f5('0x1f')](_0x4213f0[_0x67f5('0x1b')]);break;case _0x67f5('0x25'):_0x3a83fb[_0x67f5('0x1f')](_0x4213f0[_0x67f5('0x26')]);_0x3a83fb[_0x67f5('0x1f')](_0x4213f0[_0x67f5('0x1b')]);break;default:_0x3a83fb=_['isNil'](_0x4213f0[_0x67f5('0x1b')])?[]:_0x4213f0[_0x67f5('0x1b')][_0x67f5('0x1c')](',');}var _0x5f53e2={'id':util[_0x67f5('0x27')](_0x67f5('0x28'),_0x4f9880,_0x4213f0['id'],_0x4213f0[_0x67f5('0x29')]),'condition':require(_0x67f5('0x2a'))[_0x67f5('0x2b')](_0x4f9880,getIntervals(_0x182dbc[_0x67f5('0x2c')],_0x4213f0),_0x182dbc),'consequence':require('./applications/'+_0x4213f0[_0x67f5('0x29')])['consequence'](_0x4f9880,_0x3a83fb,_0x182dbc,_0x1a2e6e),'p':_0x4213f0[_0x67f5('0x2d')]||0x0};logger[_0x67f5('0x2e')](_0x67f5('0x2f'),_0x5f53e2['id'],_0x67f5('0x30'),getIntervals(_0x182dbc['intervals'],_0x4213f0)['join'](_0x67f5('0x31')));_0x1641c6[_0x67f5('0x1f')](_0x5f53e2);}else{logger[_0x67f5('0x32')](_0x67f5('0x33'),path[_0x67f5('0x21')](__dirname,'applications',_0x4213f0[_0x67f5('0x29')]+_0x67f5('0x19')));}}_0x182dbc[_0x67f5('0x34')][_0x4f9880]=new RuleEngine(_0x1641c6);_0x182dbc[_0x67f5('0x34')][_0x4f9880][_0x67f5('0x35')](_0x1a2e6e,function(_0x4977a0){logger[_0x67f5('0x2e')](_0x67f5('0x36'),JSON[_0x67f5('0x37')](_0x4977a0['matchPath']));if(_0x182dbc['rules'][_0x4f9880]){_0x182dbc[_0x67f5('0x34')][_0x4f9880][_0x67f5('0x38')](_0x67f5('0x39'));}});return _0x372e65({'code':0xc8,'message':_0x1a2e6e});}else{logger['info'](_0x67f5('0x3a'));return _0x372e65({'code':0xc8,'message':_0x1a2e6e});}}catch(_0x50b206){logger[_0x67f5('0x32')](_0x50b206[_0x67f5('0x3b')]);return _0x543db7(_0x47efb9[_0x67f5('0x32')](0x1f4,_0x50b206));}}return _0x543db7(_0x67f5('0x3c'));});},'AcceptMessage':function(_0x3e431f){var _0x24ae18=this;return new Promise(function(_0x368f2a,_0x24a620){if(_0x3e431f[_0x67f5('0x3d')]&&_0x3e431f[_0x67f5('0x3d')]['id']){if(_0x182dbc[_0x67f5('0x3e')][_0x3e431f[_0x67f5('0x3d')]['id']]){_0x182dbc[_0x67f5('0x3e')][_0x3e431f[_0x67f5('0x3d')]['id']][_0x67f5('0x3f')]=![];_0x182dbc[_0x67f5('0x3e')][_0x3e431f[_0x67f5('0x3d')]['id']][_0x67f5('0x40')]=undefined;}}if(_0x3e431f[_0x67f5('0x14')]&&_0x3e431f[_0x67f5('0x14')]['id']){try{var _0x50cbc6=getId(_0x3e431f[_0x67f5('0x1d')],_0x3e431f[_0x67f5('0x14')]?_0x3e431f[_0x67f5('0x14')]['id']:0x0,_0x3e431f['interaction']?_0x3e431f['interaction']['id']:0x0);if(_0x182dbc[_0x67f5('0x34')][_0x50cbc6]){_0x182dbc[_0x67f5('0x34')][_0x50cbc6]['emit'](_0x67f5('0x41'));if(rpc[_0x3e431f['channel']+_0x67f5('0x42')]){rpc[_0x3e431f[_0x67f5('0x1d')]+_0x67f5('0x42')]['update'](_0x50cbc6,{'UserId':_0x3e431f[_0x67f5('0x14')][_0x67f5('0x43')]})[_0x67f5('0x44')](function(_0x51418a){logger['error'](_0x67f5('0x45'));});}}return _0x368f2a({'code':0xc8,'message':_0x3e431f});}catch(_0x359a80){logger[_0x67f5('0x32')](_0x359a80[_0x67f5('0x3b')]);return _0x24a620(_0x24ae18['error'](0x1f4,_0x359a80));}}logger[_0x67f5('0x32')](_0x67f5('0x46'));return _0x24a620(_0x24ae18['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x31374f){var _0x2ad0a0=this;return new Promise(function(_0x3bcc55,_0x495699){if(_0x31374f[_0x67f5('0x3d')]&&_0x31374f[_0x67f5('0x3d')]['id']){try{if(_0x182dbc[_0x67f5('0x3e')][_0x31374f[_0x67f5('0x3d')]['id']]){_0x182dbc[_0x67f5('0x3e')][_0x31374f[_0x67f5('0x3d')]['id']]['busy']=![];_0x182dbc[_0x67f5('0x3e')][_0x31374f[_0x67f5('0x3d')]['id']]['busyQueue']=undefined;}return _0x3bcc55({'code':0xc8,'message':_0x31374f});}catch(_0x191493){logger[_0x67f5('0x32')](_0x191493[_0x67f5('0x3b')]);return _0x495699(_0x2ad0a0[_0x67f5('0x32')](0x1f4,_0x191493));}}logger[_0x67f5('0x32')](_0x67f5('0x46'));return _0x495699(_0x2ad0a0[_0x67f5('0x32')](0x1f4,_0x67f5('0x46')));});},'AbandonInteraction':function(_0x492bd){var _0x38aee8=this;return new Promise(function(_0x158a22,_0x6efeca){if(_0x492bd[_0x67f5('0x1d')]&&_0x492bd[_0x67f5('0x15')]&&_0x492bd[_0x67f5('0x15')]['id']){try{var _0x6347a6=getId(_0x492bd[_0x67f5('0x1d')],_0x492bd[_0x67f5('0x14')]?_0x492bd[_0x67f5('0x14')]['id']:0x0,_0x492bd[_0x67f5('0x15')]?_0x492bd[_0x67f5('0x15')]['id']:0x0);if(_0x182dbc[_0x67f5('0x34')][_0x6347a6]){_0x182dbc[_0x67f5('0x34')][_0x6347a6][_0x67f5('0x38')]('end');}return _0x158a22({'code':0xc8,'message':_0x492bd});}catch(_0x59be6a){logger['error'](_0x59be6a['stack']);return _0x6efeca(_0x38aee8['error'](0x1f4,_0x59be6a));}}logger[_0x67f5('0x32')](_0x67f5('0x46'));return _0x6efeca(_0x38aee8[_0x67f5('0x32')](0x1f4,_0x67f5('0x46')));});},'AgentCapacity':function(_0x5bdeea){var _0x16d446=this;return new Promise(function(_0x2fd982,_0x3fec4f){if(_0x182dbc[_0x67f5('0x3e')][_0x67f5('0x47')](_0x5bdeea['id'])){for(var _0x47873b in _0x5bdeea[_0x67f5('0x48')]){if(_0x5bdeea[_0x67f5('0x48')][_0x67f5('0x47')](_0x47873b)){if(_0x182dbc['agents'][_0x5bdeea['id']][_0x67f5('0x47')](_0x47873b+_0x67f5('0x49'))){_0x182dbc[_0x67f5('0x3e')][_0x5bdeea['id']][_0x47873b+_0x67f5('0x49')]=parseInt(_0x5bdeea[_0x67f5('0x48')][_0x47873b],0xa);}}}_0x182dbc[_0x67f5('0x3e')][_0x5bdeea['id']][_0x67f5('0x4a')]();return _0x2fd982({'code':0xc8,'message':_0x182dbc['agents'][_0x5bdeea['id']]});}else{return _0x3fec4f(_0x16d446[_0x67f5('0x32')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x88315e){return new Promise(function(_0x39a23b,_0x4a3ec0){var _0x3f7662=_[_0x67f5('0x4b')](_0x182dbc[_0x67f5('0x3e')]);_0x39a23b({'count':_0x3f7662[_0x67f5('0x17')],'rows':_0x3f7662});});},'ChatQueues':function(_0x392ab7){return new Promise(function(_0x55672a,_0x2e8899){var _0x12cbcf=[];for(var _0x2ab73f in _0x182dbc['chatQueues']){if(_0x182dbc['chatQueues']['hasOwnProperty'](_0x2ab73f)){var _0xe200db=_0x182dbc[_0x67f5('0x4c')][_0x2ab73f];var _0x2b49c6={'id':_0xe200db['id'],'available':_0xe200db['available'],'loggedIn':_0xe200db['loggedIn'],'name':_0xe200db['name'],'paused':_0xe200db['paused'],'waiting':_0xe200db[_0x67f5('0x4d')]};_0x12cbcf[_0x67f5('0x1f')](_0x2b49c6);}}_0x55672a({'count':_0x12cbcf['length'],'rows':_0x12cbcf});});},'MailQueues':function(_0x316e7a){return new Promise(function(_0x5f0436,_0x7d633a){var _0x3494da=[];for(var _0x2115eb in _0x182dbc[_0x67f5('0x4e')]){if(_0x182dbc['mailQueues'][_0x67f5('0x47')](_0x2115eb)){var _0x369d5e=_0x182dbc[_0x67f5('0x4e')][_0x2115eb];var _0x4ac7a3={'id':_0x369d5e['id'],'available':_0x369d5e[_0x67f5('0x4f')],'loggedIn':_0x369d5e[_0x67f5('0x50')],'name':_0x369d5e[_0x67f5('0x51')],'paused':_0x369d5e[_0x67f5('0x52')],'waiting':_0x369d5e[_0x67f5('0x4d')]};_0x3494da[_0x67f5('0x1f')](_0x4ac7a3);}}_0x5f0436({'count':_0x3494da[_0x67f5('0x17')],'rows':_0x3494da});});},'OpenchannelQueues':function(_0x5caf84){return new Promise(function(_0x3a9167,_0x15c0be){var _0x47b975=[];for(var _0x5c3658 in _0x182dbc['openchannelQueues']){if(_0x182dbc[_0x67f5('0x53')][_0x67f5('0x47')](_0x5c3658)){var _0x32c3ef=_0x182dbc['openchannelQueues'][_0x5c3658];var _0x236d21={'id':_0x32c3ef['id'],'available':_0x32c3ef[_0x67f5('0x4f')],'loggedIn':_0x32c3ef[_0x67f5('0x50')],'name':_0x32c3ef[_0x67f5('0x51')],'paused':_0x32c3ef[_0x67f5('0x52')],'waiting':_0x32c3ef[_0x67f5('0x4d')]};_0x47b975[_0x67f5('0x1f')](_0x236d21);}}_0x3a9167({'count':_0x47b975['length'],'rows':_0x47b975});});},'SmsQueues':function(_0x591df9){return new Promise(function(_0x4e532d,_0x1b83e9){var _0x5bd802=[];for(var _0x3b33fc in _0x182dbc[_0x67f5('0x54')]){if(_0x182dbc[_0x67f5('0x54')][_0x67f5('0x47')](_0x3b33fc)){var _0x1d8270=_0x182dbc[_0x67f5('0x54')][_0x3b33fc];var _0x1447e8={'id':_0x1d8270['id'],'available':_0x1d8270[_0x67f5('0x4f')],'loggedIn':_0x1d8270[_0x67f5('0x50')],'name':_0x1d8270[_0x67f5('0x51')],'paused':_0x1d8270['paused'],'waiting':_0x1d8270[_0x67f5('0x4d')]};_0x5bd802[_0x67f5('0x1f')](_0x1447e8);}}_0x4e532d({'count':_0x5bd802['length'],'rows':_0x5bd802});});},'FaxQueues':function(_0x35fc06){return new Promise(function(_0x21e2d9,_0x1badbb){var _0x4beb6c=[];for(var _0x5551be in _0x182dbc['faxQueues']){if(_0x182dbc[_0x67f5('0x55')][_0x67f5('0x47')](_0x5551be)){var _0x306cc4=_0x182dbc[_0x67f5('0x55')][_0x5551be];var _0x506c95={'id':_0x306cc4['id'],'available':_0x306cc4['available'],'loggedIn':_0x306cc4['loggedIn'],'name':_0x306cc4[_0x67f5('0x51')],'paused':_0x306cc4[_0x67f5('0x52')],'waiting':_0x306cc4[_0x67f5('0x4d')]};_0x4beb6c[_0x67f5('0x1f')](_0x506c95);}}_0x21e2d9({'count':_0x4beb6c[_0x67f5('0x17')],'rows':_0x4beb6c});});},'WhatsappQueues':function(_0x206464){return new Promise(function(_0x274089,_0x430daf){var _0x3db1a6=[];for(var _0x426010 in _0x182dbc[_0x67f5('0x56')]){if(_0x182dbc[_0x67f5('0x56')][_0x67f5('0x47')](_0x426010)){var _0x49b678=_0x182dbc[_0x67f5('0x56')][_0x426010];var _0x401ecb={'id':_0x49b678['id'],'available':_0x49b678[_0x67f5('0x4f')],'loggedIn':_0x49b678['loggedIn'],'name':_0x49b678[_0x67f5('0x51')],'paused':_0x49b678[_0x67f5('0x52')],'waiting':_0x49b678[_0x67f5('0x4d')]};_0x3db1a6[_0x67f5('0x1f')](_0x401ecb);}}_0x274089({'count':_0x3db1a6[_0x67f5('0x17')],'rows':_0x3db1a6});});},'ChatQueuesWaitingInteractions':function(_0x1d309b){return new Promise(function(_0x5d2175,_0x2a069f){var _0x3c5d2b=_[_0x67f5('0x4b')](_0x182dbc[_0x67f5('0x57')]);_0x5d2175({'count':_0x3c5d2b[_0x67f5('0x17')],'rows':_0x3c5d2b});});},'MailQueuesWaitingInteractions':function(_0x532c14){return new Promise(function(_0x1ff0f4,_0x3f6151){var _0x2d1fd8=_[_0x67f5('0x4b')](_0x182dbc[_0x67f5('0x58')]);_0x1ff0f4({'count':_0x2d1fd8[_0x67f5('0x17')],'rows':_0x2d1fd8});});},'OpenchannelQueuesWaitingInteractions':function(_0x5076d7){return new Promise(function(_0x424f6f,_0x3aa51a){var _0x51ccef=_[_0x67f5('0x4b')](_0x182dbc[_0x67f5('0x59')]);_0x424f6f({'count':_0x51ccef[_0x67f5('0x17')],'rows':_0x51ccef});});},'SmsQueuesWaitingInteractions':function(_0x432769){return new Promise(function(_0x48f408,_0x31e986){var _0x4f68d7=_[_0x67f5('0x4b')](_0x182dbc[_0x67f5('0x5a')]);_0x48f408({'count':_0x4f68d7[_0x67f5('0x17')],'rows':_0x4f68d7});});},'FaxQueuesWaitingInteractions':function(_0x43eaf3){return new Promise(function(_0x10e5e7,_0x15f6fd){var _0x18aa87=_[_0x67f5('0x4b')](_0x182dbc['faxQueuesWaitingInteractions']);_0x10e5e7({'count':_0x18aa87[_0x67f5('0x17')],'rows':_0x18aa87});});},'WhatsappQueuesWaitingInteractions':function(_0x380544){return new Promise(function(_0x345db6,_0x49926a){var _0xe97eea=_[_0x67f5('0x4b')](_0x182dbc[_0x67f5('0x5b')]);_0x345db6({'count':_0xe97eea[_0x67f5('0x17')],'rows':_0xe97eea});});}};var _0x5a4929=jayson[_0x67f5('0x5c')](_0x3573f7)[_0x67f5('0x5d')]();_0x5a4929['on'](_0x67f5('0x32'),function(_0xe9877b){logger[_0x67f5('0x32')](JSON['stringify'](_0xe9877b));return _0x2f7dcd(_0xe9877b);});_0x5a4929[_0x67f5('0x5e')](0x232c,'127.0.0.1',function(){console[_0x67f5('0x5f')](_0x67f5('0x60'),0x232c);return _0x19b7ac(_0x67f5('0x61')+0x232c);});});}; \ No newline at end of file +var _0xf266=['IntervalId','map','interval','listen','message','interaction','applications','isArray','length','existsSync','app','.js','autoreply','appdata','mail','push','slice','join','dialogflow','split','dialogflowv2','amazonlex','tag','TagId','format','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','rules','Applications\x20executed','matchPath','stack','routing\x20is\x20empty','agent','agents','channel','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','busyQueue','emit','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','isNil'];(function(_0x294ce0,_0x6e4da9){var _0x1ec478=function(_0x11c8ba){while(--_0x11c8ba){_0x294ce0['push'](_0x294ce0['shift']());}};_0x1ec478(++_0x6e4da9);}(_0xf266,0x10e));var _0x6f26=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xf266[_0x363ef8];return _0x148822;};'use strict';var _=require(_0x6f26('0x0'));var util=require(_0x6f26('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x6f26('0x2'));var BPromise=require(_0x6f26('0x3'));var uuid=require('uuid');var config=require('../../../config/environment');var logger=require(_0x6f26('0x4'))(_0x6f26('0x5'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x6f26('0x6')),'chatQueueReport':require(_0x6f26('0x7')),'smsQueueReport':require(_0x6f26('0x8')),'faxQueueReport':require(_0x6f26('0x9')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x6f26('0xa'));function getId(_0x3cf203,_0xf3251d,_0x467e55){return util['format']('%s.%s.%s',_0x3cf203,_0xf3251d||0x0,_0x467e55||0x0);}function getIntervals(_0x1155d2,_0x338334){var _0x5449bc=[];if(!_[_0x6f26('0xb')](_0x338334[_0x6f26('0xc')])&&!_[_0x6f26('0xb')](_0x1155d2[_0x338334['IntervalId']])&&!_[_0x6f26('0xb')](_0x1155d2[_0x338334['IntervalId']]['Intervals'])){_0x5449bc=_[_0x6f26('0xd')](_0x1155d2[_0x338334[_0x6f26('0xc')]]['Intervals'],'interval');}else if(!_['isNil'](_0x338334[_0x6f26('0xe')])){_0x5449bc=[_0x338334['interval']];}return _0x5449bc;}exports[_0x6f26('0xf')]=function(_0x3f8fad){_0x3f8fad['rules']={};return new BPromise(function(_0x5cc804,_0x1c6907){var _0x4b402d={'Start':function(_0x4d0b7e){var _0x5e9fa3=this;return new Promise(function(_0x472152,_0x2f16e5){if(_0x4d0b7e){try{var _0x103ca5=[];var _0x54bd05=getId(_0x4d0b7e['channel'],_0x4d0b7e[_0x6f26('0x10')]?_0x4d0b7e[_0x6f26('0x10')]['id']:0x0,_0x4d0b7e[_0x6f26('0x11')]?_0x4d0b7e[_0x6f26('0x11')]['id']:0x0);if(_0x4d0b7e[_0x6f26('0x12')]&&_[_0x6f26('0x13')](_0x4d0b7e[_0x6f26('0x12')])&&_0x4d0b7e[_0x6f26('0x12')][_0x6f26('0x14')]){for(var _0x4f4546=0x0;_0x4f4546<_0x4d0b7e[_0x6f26('0x12')][_0x6f26('0x14')];_0x4f4546+=0x1){var _0x1033fa=_0x4d0b7e[_0x6f26('0x12')][_0x4f4546];if(fs[_0x6f26('0x15')](path['join'](__dirname,'applications',_0x1033fa[_0x6f26('0x16')]+_0x6f26('0x17')))){var _0x434d04=[];switch(_0x1033fa[_0x6f26('0x16')]['toLowerCase']()){case _0x6f26('0x18'):var _0x38431b=_0x1033fa[_0x6f26('0x19')]['split'](',');if(_0x4d0b7e['channel']===_0x6f26('0x1a')){_0x434d04['push'](_0x38431b[0x0]);_0x434d04[_0x6f26('0x1b')](_0x38431b[0x1]);_0x434d04[_0x6f26('0x1b')](_0x38431b[_0x6f26('0x1c')](0x2,_0x38431b['length'])['join'](','));}else{_0x434d04[_0x6f26('0x1b')](_0x38431b[0x0]);_0x434d04['push'](_0x38431b['slice'](0x1,_0x38431b['length'])[_0x6f26('0x1d')](','));}break;case _0x6f26('0x1e'):var _0x5d85fb=_0x1033fa[_0x6f26('0x19')][_0x6f26('0x1f')](',');_0x434d04['push'](_0x5d85fb[0x0]);_0x434d04[_0x6f26('0x1b')](_0x5d85fb[0x1]);_0x434d04[_0x6f26('0x1b')](_0x5d85fb[_0x6f26('0x1c')](0x2,_0x5d85fb['length'])[_0x6f26('0x1d')](','));break;case _0x6f26('0x20'):var _0x231366=_0x1033fa[_0x6f26('0x19')][_0x6f26('0x1f')](',');_0x434d04[_0x6f26('0x1b')](_0x231366[0x0]);_0x434d04[_0x6f26('0x1b')](_0x231366[0x1]);_0x434d04[_0x6f26('0x1b')](_0x231366[0x2]);_0x434d04['push'](_0x231366[0x3]);_0x434d04[_0x6f26('0x1b')](_0x231366[_0x6f26('0x1c')](0x4,_0x231366[_0x6f26('0x14')])[_0x6f26('0x1d')](','));break;case _0x6f26('0x21'):var _0x3ed9bd=_0x1033fa['appdata']['split'](',');_0x434d04[_0x6f26('0x1b')](_0x3ed9bd[0x0]);_0x434d04[_0x6f26('0x1b')](_0x3ed9bd[0x1]);_0x434d04[_0x6f26('0x1b')](_0x3ed9bd[0x2]);_0x434d04[_0x6f26('0x1b')](_0x3ed9bd[0x3]);_0x434d04[_0x6f26('0x1b')](_0x3ed9bd[_0x6f26('0x1c')](0x4,_0x3ed9bd['length'])['join'](','));break;case'message':_0x434d04[_0x6f26('0x1b')](_0x1033fa['appdata']);break;case _0x6f26('0x22'):_0x434d04[_0x6f26('0x1b')](_0x1033fa[_0x6f26('0x23')]);_0x434d04[_0x6f26('0x1b')](_0x1033fa[_0x6f26('0x19')]);break;default:_0x434d04=_[_0x6f26('0xb')](_0x1033fa[_0x6f26('0x19')])?[]:_0x1033fa['appdata']['split'](',');}var _0x56adf2={'id':util[_0x6f26('0x24')]('%s:%s:%s',_0x54bd05,_0x1033fa['id'],_0x1033fa['app']),'condition':require(_0x6f26('0x25'))['condition'](_0x54bd05,getIntervals(_0x3f8fad[_0x6f26('0x26')],_0x1033fa),_0x3f8fad),'consequence':require(_0x6f26('0x27')+_0x1033fa[_0x6f26('0x16')])[_0x6f26('0x28')](_0x54bd05,_0x434d04,_0x3f8fad,_0x4d0b7e),'p':_0x1033fa[_0x6f26('0x29')]||0x0};logger[_0x6f26('0x2a')](_0x6f26('0x2b'),_0x56adf2['id'],_0x6f26('0x2c'),getIntervals(_0x3f8fad[_0x6f26('0x26')],_0x1033fa)[_0x6f26('0x1d')](_0x6f26('0x2d')));_0x103ca5[_0x6f26('0x1b')](_0x56adf2);}else{logger[_0x6f26('0x2e')](_0x6f26('0x2f'),path[_0x6f26('0x1d')](__dirname,_0x6f26('0x12'),_0x1033fa[_0x6f26('0x16')]+'.js'));}}_0x3f8fad[_0x6f26('0x30')][_0x54bd05]=new RuleEngine(_0x103ca5);_0x3f8fad[_0x6f26('0x30')][_0x54bd05]['execute'](_0x4d0b7e,function(_0x2f5b11){logger[_0x6f26('0x2a')](_0x6f26('0x31'),JSON['stringify'](_0x2f5b11[_0x6f26('0x32')]));if(_0x3f8fad[_0x6f26('0x30')][_0x54bd05]){_0x3f8fad[_0x6f26('0x30')][_0x54bd05]['emit']('complete');}});return _0x472152({'code':0xc8,'message':_0x4d0b7e});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x472152({'code':0xc8,'message':_0x4d0b7e});}}catch(_0x54ed3e){logger['error'](_0x54ed3e[_0x6f26('0x33')]);return _0x2f16e5(_0x5e9fa3[_0x6f26('0x2e')](0x1f4,_0x54ed3e));}}return _0x2f16e5(_0x6f26('0x34'));});},'AcceptMessage':function(_0x1c11ad){var _0x5458f8=this;return new Promise(function(_0x45cbf7,_0x46b1d4){if(_0x1c11ad[_0x6f26('0x35')]&&_0x1c11ad[_0x6f26('0x35')]['id']){if(_0x3f8fad[_0x6f26('0x36')][_0x1c11ad['agent']['id']]){_0x3f8fad[_0x6f26('0x36')][_0x1c11ad[_0x6f26('0x35')]['id']]['busy']=![];_0x3f8fad[_0x6f26('0x36')][_0x1c11ad[_0x6f26('0x35')]['id']]['busyQueue']=undefined;}}if(_0x1c11ad['message']&&_0x1c11ad[_0x6f26('0x10')]['id']){try{var _0x890c32=getId(_0x1c11ad[_0x6f26('0x37')],_0x1c11ad[_0x6f26('0x10')]?_0x1c11ad[_0x6f26('0x10')]['id']:0x0,_0x1c11ad[_0x6f26('0x11')]?_0x1c11ad[_0x6f26('0x11')]['id']:0x0);if(_0x3f8fad[_0x6f26('0x30')][_0x890c32]){_0x3f8fad[_0x6f26('0x30')][_0x890c32]['emit']('end');if(rpc[_0x1c11ad['channel']+'QueueReport']){rpc[_0x1c11ad[_0x6f26('0x37')]+_0x6f26('0x38')][_0x6f26('0x39')](_0x890c32,{'UserId':_0x1c11ad['message'][_0x6f26('0x3a')]})[_0x6f26('0x3b')](function(_0x96a46a){logger[_0x6f26('0x2e')](_0x6f26('0x3c'));});}}return _0x45cbf7({'code':0xc8,'message':_0x1c11ad});}catch(_0xb36c6f){logger['error'](_0xb36c6f['stack']);return _0x46b1d4(_0x5458f8[_0x6f26('0x2e')](0x1f4,_0xb36c6f));}}logger[_0x6f26('0x2e')]('message\x20is\x20empty');return _0x46b1d4(_0x5458f8['error'](0x1f4,_0x6f26('0x3d')));});},'RejectMessage':function(_0xcc73dc){var _0x2baaad=this;return new Promise(function(_0x29c9d7,_0x4306aa){if(_0xcc73dc['agent']&&_0xcc73dc[_0x6f26('0x35')]['id']){try{if(_0x3f8fad[_0x6f26('0x36')][_0xcc73dc[_0x6f26('0x35')]['id']]){_0x3f8fad[_0x6f26('0x36')][_0xcc73dc[_0x6f26('0x35')]['id']][_0x6f26('0x3e')]=![];_0x3f8fad['agents'][_0xcc73dc[_0x6f26('0x35')]['id']][_0x6f26('0x3f')]=undefined;}return _0x29c9d7({'code':0xc8,'message':_0xcc73dc});}catch(_0x20791c){logger[_0x6f26('0x2e')](_0x20791c[_0x6f26('0x33')]);return _0x4306aa(_0x2baaad[_0x6f26('0x2e')](0x1f4,_0x20791c));}}logger[_0x6f26('0x2e')](_0x6f26('0x3d'));return _0x4306aa(_0x2baaad[_0x6f26('0x2e')](0x1f4,_0x6f26('0x3d')));});},'AbandonInteraction':function(_0x543992){var _0x30b9cb=this;return new Promise(function(_0x649ed5,_0x2921cc){if(_0x543992['channel']&&_0x543992['interaction']&&_0x543992[_0x6f26('0x11')]['id']){try{var _0x3625ec=getId(_0x543992[_0x6f26('0x37')],_0x543992[_0x6f26('0x10')]?_0x543992[_0x6f26('0x10')]['id']:0x0,_0x543992['interaction']?_0x543992[_0x6f26('0x11')]['id']:0x0);if(_0x3f8fad['rules'][_0x3625ec]){_0x3f8fad['rules'][_0x3625ec][_0x6f26('0x40')](_0x6f26('0x41'));}return _0x649ed5({'code':0xc8,'message':_0x543992});}catch(_0x4e7ea3){logger['error'](_0x4e7ea3[_0x6f26('0x33')]);return _0x2921cc(_0x30b9cb[_0x6f26('0x2e')](0x1f4,_0x4e7ea3));}}logger['error'](_0x6f26('0x3d'));return _0x2921cc(_0x30b9cb[_0x6f26('0x2e')](0x1f4,_0x6f26('0x3d')));});},'AgentCapacity':function(_0x536b99){var _0x44d044=this;return new Promise(function(_0x1c2289,_0x78827d){if(_0x3f8fad['agents'][_0x6f26('0x42')](_0x536b99['id'])){for(var _0x3e4be3 in _0x536b99[_0x6f26('0x43')]){if(_0x536b99[_0x6f26('0x43')][_0x6f26('0x42')](_0x3e4be3)){if(_0x3f8fad['agents'][_0x536b99['id']][_0x6f26('0x42')](_0x3e4be3+_0x6f26('0x44'))){_0x3f8fad[_0x6f26('0x36')][_0x536b99['id']][_0x3e4be3+_0x6f26('0x44')]=parseInt(_0x536b99[_0x6f26('0x43')][_0x3e4be3],0xa);}}}_0x3f8fad['agents'][_0x536b99['id']][_0x6f26('0x45')]();return _0x1c2289({'code':0xc8,'message':_0x3f8fad['agents'][_0x536b99['id']]});}else{return _0x78827d(_0x44d044[_0x6f26('0x2e')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x3deb44){return new Promise(function(_0x33aa72,_0x641e96){var _0x326edb=_[_0x6f26('0x46')](_0x3f8fad[_0x6f26('0x36')]);_0x33aa72({'count':_0x326edb[_0x6f26('0x14')],'rows':_0x326edb});});},'ChatQueues':function(_0x14f781){return new Promise(function(_0x165006,_0x45e3ad){var _0x506c7a=[];for(var _0x970f87 in _0x3f8fad[_0x6f26('0x47')]){if(_0x3f8fad['chatQueues'][_0x6f26('0x42')](_0x970f87)){var _0x41384b=_0x3f8fad['chatQueues'][_0x970f87];var _0x376294={'id':_0x41384b['id'],'available':_0x41384b['available'],'loggedIn':_0x41384b[_0x6f26('0x48')],'name':_0x41384b[_0x6f26('0x49')],'paused':_0x41384b[_0x6f26('0x4a')],'waiting':_0x41384b[_0x6f26('0x4b')]};_0x506c7a[_0x6f26('0x1b')](_0x376294);}}_0x165006({'count':_0x506c7a['length'],'rows':_0x506c7a});});},'MailQueues':function(_0x4518ca){return new Promise(function(_0x23c6fa,_0x52f14b){var _0x4a8b21=[];for(var _0x4522f4 in _0x3f8fad[_0x6f26('0x4c')]){if(_0x3f8fad[_0x6f26('0x4c')]['hasOwnProperty'](_0x4522f4)){var _0x5c8d7e=_0x3f8fad[_0x6f26('0x4c')][_0x4522f4];var _0x2619b5={'id':_0x5c8d7e['id'],'available':_0x5c8d7e[_0x6f26('0x4d')],'loggedIn':_0x5c8d7e[_0x6f26('0x48')],'name':_0x5c8d7e[_0x6f26('0x49')],'paused':_0x5c8d7e[_0x6f26('0x4a')],'waiting':_0x5c8d7e['waiting']};_0x4a8b21[_0x6f26('0x1b')](_0x2619b5);}}_0x23c6fa({'count':_0x4a8b21[_0x6f26('0x14')],'rows':_0x4a8b21});});},'OpenchannelQueues':function(_0x112930){return new Promise(function(_0x5b650d,_0x1f7266){var _0x2cc2ee=[];for(var _0x410812 in _0x3f8fad[_0x6f26('0x4e')]){if(_0x3f8fad[_0x6f26('0x4e')]['hasOwnProperty'](_0x410812)){var _0x2da83e=_0x3f8fad['openchannelQueues'][_0x410812];var _0x40dcb1={'id':_0x2da83e['id'],'available':_0x2da83e[_0x6f26('0x4d')],'loggedIn':_0x2da83e['loggedIn'],'name':_0x2da83e['name'],'paused':_0x2da83e['paused'],'waiting':_0x2da83e['waiting']};_0x2cc2ee[_0x6f26('0x1b')](_0x40dcb1);}}_0x5b650d({'count':_0x2cc2ee['length'],'rows':_0x2cc2ee});});},'SmsQueues':function(_0xff45e){return new Promise(function(_0x1c7835,_0xb64433){var _0x4ef835=[];for(var _0x1b94ad in _0x3f8fad[_0x6f26('0x4f')]){if(_0x3f8fad['smsQueues'][_0x6f26('0x42')](_0x1b94ad)){var _0x55a3fb=_0x3f8fad[_0x6f26('0x4f')][_0x1b94ad];var _0x51f036={'id':_0x55a3fb['id'],'available':_0x55a3fb['available'],'loggedIn':_0x55a3fb['loggedIn'],'name':_0x55a3fb[_0x6f26('0x49')],'paused':_0x55a3fb['paused'],'waiting':_0x55a3fb[_0x6f26('0x4b')]};_0x4ef835[_0x6f26('0x1b')](_0x51f036);}}_0x1c7835({'count':_0x4ef835['length'],'rows':_0x4ef835});});},'FaxQueues':function(_0x1271b1){return new Promise(function(_0x5cae89,_0x4fcd31){var _0x18c992=[];for(var _0xeab158 in _0x3f8fad[_0x6f26('0x50')]){if(_0x3f8fad[_0x6f26('0x50')][_0x6f26('0x42')](_0xeab158)){var _0x4bf49b=_0x3f8fad[_0x6f26('0x50')][_0xeab158];var _0x523d6c={'id':_0x4bf49b['id'],'available':_0x4bf49b[_0x6f26('0x4d')],'loggedIn':_0x4bf49b['loggedIn'],'name':_0x4bf49b[_0x6f26('0x49')],'paused':_0x4bf49b['paused'],'waiting':_0x4bf49b['waiting']};_0x18c992[_0x6f26('0x1b')](_0x523d6c);}}_0x5cae89({'count':_0x18c992[_0x6f26('0x14')],'rows':_0x18c992});});},'WhatsappQueues':function(_0x5a9b03){return new Promise(function(_0x464ade,_0x472a97){var _0x1d47e1=[];for(var _0x214dbf in _0x3f8fad[_0x6f26('0x51')]){if(_0x3f8fad[_0x6f26('0x51')][_0x6f26('0x42')](_0x214dbf)){var _0x51c1ef=_0x3f8fad[_0x6f26('0x51')][_0x214dbf];var _0x1941f8={'id':_0x51c1ef['id'],'available':_0x51c1ef['available'],'loggedIn':_0x51c1ef[_0x6f26('0x48')],'name':_0x51c1ef[_0x6f26('0x49')],'paused':_0x51c1ef['paused'],'waiting':_0x51c1ef['waiting']};_0x1d47e1[_0x6f26('0x1b')](_0x1941f8);}}_0x464ade({'count':_0x1d47e1[_0x6f26('0x14')],'rows':_0x1d47e1});});},'ChatQueuesWaitingInteractions':function(_0x3fd443){return new Promise(function(_0x165ae2,_0x1e1d29){var _0x4d06e3=_['values'](_0x3f8fad[_0x6f26('0x52')]);_0x165ae2({'count':_0x4d06e3['length'],'rows':_0x4d06e3});});},'MailQueuesWaitingInteractions':function(_0x5d16a1){return new Promise(function(_0x4fd0b9,_0x586c8f){var _0x57a2ec=_[_0x6f26('0x46')](_0x3f8fad[_0x6f26('0x53')]);_0x4fd0b9({'count':_0x57a2ec['length'],'rows':_0x57a2ec});});},'OpenchannelQueuesWaitingInteractions':function(_0x214fd0){return new Promise(function(_0x5bdf68,_0x506b85){var _0x499b78=_[_0x6f26('0x46')](_0x3f8fad[_0x6f26('0x54')]);_0x5bdf68({'count':_0x499b78[_0x6f26('0x14')],'rows':_0x499b78});});},'SmsQueuesWaitingInteractions':function(_0x3ff199){return new Promise(function(_0x1325f5,_0x2d3afc){var _0x4f0e96=_['values'](_0x3f8fad[_0x6f26('0x55')]);_0x1325f5({'count':_0x4f0e96[_0x6f26('0x14')],'rows':_0x4f0e96});});},'FaxQueuesWaitingInteractions':function(_0xa794b2){return new Promise(function(_0xddd618,_0x1f95d9){var _0x157a00=_[_0x6f26('0x46')](_0x3f8fad[_0x6f26('0x56')]);_0xddd618({'count':_0x157a00[_0x6f26('0x14')],'rows':_0x157a00});});},'WhatsappQueuesWaitingInteractions':function(_0x371f62){return new Promise(function(_0x49a374,_0x86886a){var _0x409c26=_[_0x6f26('0x46')](_0x3f8fad[_0x6f26('0x57')]);_0x49a374({'count':_0x409c26[_0x6f26('0x14')],'rows':_0x409c26});});}};var _0x541daa=jayson[_0x6f26('0x58')](_0x4b402d)[_0x6f26('0x59')]();_0x541daa['on'](_0x6f26('0x2e'),function(_0x80a04b){logger['error'](JSON[_0x6f26('0x5a')](_0x80a04b));return _0x1c6907(_0x80a04b);});_0x541daa[_0x6f26('0xf')](0x232c,_0x6f26('0x5b'),function(){console[_0x6f26('0x5c')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x5cc804(_0x6f26('0x5d')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index f5f2e92..53c499a 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 _0x5456=['message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','format','iftime\x20%s','true','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','bluebird','jayson/promise','lodash','../../../config/logger','routing','client','http','request','then','error'];(function(_0xcd000e,_0x20e0cd){var _0x1a0ec5=function(_0x2c9750){while(--_0x2c9750){_0xcd000e['push'](_0xcd000e['shift']());}};_0x1a0ec5(++_0x20e0cd);}(_0x5456,0x18b));var _0x6545=function(_0x2ac877,_0xb277f2){_0x2ac877=_0x2ac877-0x0;var _0x27e7fe=_0x5456[_0x2ac877];return _0x27e7fe;};'use strict';var util=require(_0x6545('0x0'));var BPromise=require(_0x6545('0x1'));var jayson=require(_0x6545('0x2'));var _=require(_0x6545('0x3'));var logger=require(_0x6545('0x4'))(_0x6545('0x5'));var client=jayson[_0x6545('0x6')][_0x6545('0x7')]({'port':0x232a});function request(_0x2a3a72,_0x34f52f){return new BPromise(function(_0x4aeaf2,_0x519fc0){return client[_0x6545('0x8')](_0x2a3a72,_0x34f52f)[_0x6545('0x9')](function(_0x1c805e){if(_0x1c805e[_0x6545('0xa')]){return _0x519fc0(_0x1c805e['error'][_0x6545('0xb')]);}else{return _0x4aeaf2(_0x1c805e[_0x6545('0xc')]);}})[_0x6545('0xd')](function(_0x5e4a2a){return _0x519fc0(_0x5e4a2a);});});}exports[_0x6545('0xe')]=function(_0xdc48a4,_0x1e217a,_0x43810f){return function(_0x361925){if(_0x43810f[_0x6545('0xf')]&&!_0x43810f[_0x6545('0xf')][_0xdc48a4]){logger[_0x6545('0x10')](_0x6545('0x11'),_0xdc48a4);return _0x361925[_0x6545('0x12')]();}var _0x4d40ab=[];for(var _0x30538c=0x0;_0x30538c<_0x1e217a[_0x6545('0x13')];_0x30538c+=0x1){_0x4d40ab['push'](request('Command',{'command':util[_0x6545('0x14')](_0x6545('0x15'),_0x1e217a[_0x30538c])})['then'](function(_0x3abd27){return _0x3abd27&&_0x3abd27[_0x6545('0xb')]&&_0x3abd27['message']['indexOf'](_0x6545('0x16'))>=0x0?!![]:![];})[_0x6545('0xd')](function(_0x22ffe9){logger['error']('[%s][INTERVAL]\x20%s',_0xdc48a4,_0x1e217a[_0x30538c]);}));}BPromise['all'](_0x4d40ab)[_0x6545('0x9')](function(_0x2d73c1){var _0xa36d35=_[_0x6545('0x17')](_0x2d73c1);logger[_0x6545('0x10')](_0x6545('0x18'),_0xdc48a4,_0x1e217a[_0x6545('0x19')](_0x6545('0x1a')),_0xa36d35);_0x361925[_0x6545('0x1b')](_0xa36d35);})[_0x6545('0xd')](function(_0x33b2c9){console['log'](_0x33b2c9);logger[_0x6545('0xa')]('[%s][INTERVAL]\x20%s\x20%s',_0xdc48a4,_0x1e217a[_0x6545('0x19')](_0x6545('0x1a')),_0x33b2c9[_0x6545('0x1c')]);_0x361925[_0x6545('0x12')]();});};}; \ No newline at end of file +var _0xe6b8=['push','format','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','log','stack','stop','bluebird','jayson/promise','lodash','routing','client','http','request','then','error','message','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length'];(function(_0x3c8219,_0x4f09ab){var _0x1a5abf=function(_0x1ff743){while(--_0x1ff743){_0x3c8219['push'](_0x3c8219['shift']());}};_0x1a5abf(++_0x4f09ab);}(_0xe6b8,0x107));var _0x8e6b=function(_0x4a543b,_0x3035fa){_0x4a543b=_0x4a543b-0x0;var _0x3246=_0xe6b8[_0x4a543b];return _0x3246;};'use strict';var util=require('util');var BPromise=require(_0x8e6b('0x0'));var jayson=require(_0x8e6b('0x1'));var _=require(_0x8e6b('0x2'));var logger=require('../../../config/logger')(_0x8e6b('0x3'));var client=jayson[_0x8e6b('0x4')][_0x8e6b('0x5')]({'port':0x232a});function request(_0x63dbd2,_0x549894){return new BPromise(function(_0x5c73d3,_0x191514){return client[_0x8e6b('0x6')](_0x63dbd2,_0x549894)[_0x8e6b('0x7')](function(_0x564d4a){if(_0x564d4a[_0x8e6b('0x8')]){return _0x191514(_0x564d4a['error'][_0x8e6b('0x9')]);}else{return _0x5c73d3(_0x564d4a[_0x8e6b('0xa')]);}})[_0x8e6b('0xb')](function(_0x1e6b2a){return _0x191514(_0x1e6b2a);});});}exports[_0x8e6b('0xc')]=function(_0x129554,_0x57be60,_0x401654){return function(_0x43b0b8){if(_0x401654[_0x8e6b('0xd')]&&!_0x401654[_0x8e6b('0xd')][_0x129554]){logger['info'](_0x8e6b('0xe'),_0x129554);return _0x43b0b8['stop']();}var _0x1bf5ea=[];for(var _0x15605c=0x0;_0x15605c<_0x57be60[_0x8e6b('0xf')];_0x15605c+=0x1){_0x1bf5ea[_0x8e6b('0x10')](request('Command',{'command':util[_0x8e6b('0x11')]('iftime\x20%s',_0x57be60[_0x15605c])})['then'](function(_0x5ec280){return _0x5ec280&&_0x5ec280[_0x8e6b('0x9')]&&_0x5ec280[_0x8e6b('0x9')][_0x8e6b('0x12')](_0x8e6b('0x13'))>=0x0?!![]:![];})['catch'](function(_0xe82248){logger[_0x8e6b('0x8')](_0x8e6b('0x14'),_0x129554,_0x57be60[_0x15605c]);}));}BPromise[_0x8e6b('0x15')](_0x1bf5ea)[_0x8e6b('0x7')](function(_0x1d6d5c){var _0x13e221=_[_0x8e6b('0x16')](_0x1d6d5c);logger[_0x8e6b('0x17')](_0x8e6b('0x18'),_0x129554,_0x57be60[_0x8e6b('0x19')](_0x8e6b('0x1a')),_0x13e221);_0x43b0b8[_0x8e6b('0x1b')](_0x13e221);})[_0x8e6b('0xb')](function(_0xd047c0){console[_0x8e6b('0x1c')](_0xd047c0);logger[_0x8e6b('0x8')](_0x8e6b('0x18'),_0x129554,_0x57be60[_0x8e6b('0x19')]('\x20|\x20'),_0xd047c0[_0x8e6b('0x1d')]);_0x43b0b8[_0x8e6b('0x1e')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 3805f07..499e7f7 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 _0xe706=['then','type','agentacw','agentcomplete','acw','acwtime','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','now','called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfertargetuniqueid','agentcalledAt','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName'];(function(_0x543eee,_0x428e5e){var _0x4c2d56=function(_0x472beb){while(--_0x472beb){_0x543eee['push'](_0x543eee['shift']());}};_0x4c2d56(++_0x428e5e);}(_0xe706,0xa3));var _0x6e70=function(_0x528622,_0xcb18f0){_0x528622=_0x528622-0x0;var _0x1b12a0=_0xe706[_0x528622];return _0x1b12a0;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var utils=require(_0x6e70('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5e8446,_0x2cae77){utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x5'),_0x5e8446[_0x6e70('0x6')],_0x5e8446[_0x6e70('0x7')],_0x5e8446[_0x6e70('0x8')],_0x5e8446[_0x6e70('0x9')],_0x5e8446[_0x6e70('0xa')],_0x5e8446[_0x6e70('0xb')],_0x5e8446[_0x6e70('0xc')],_0x5e8446[_0x6e70('0xd')]));if(_0x5e8446[_0x6e70('0x8')]){utils[_0x6e70('0xe')](_0x5e8446[_0x6e70('0x8')])[_0x6e70('0xf')](function(_0x954545){if(_0x954545){_0x5e8446[_0x6e70('0x10')]=_0x954545[_0x6e70('0x10')];_0x5e8446[_0x6e70('0x11')]=_0x5e8446[_0x6e70('0x12')]?_0x954545[_0x6e70('0x13')]:![];_0x5e8446[_0x6e70('0x14')]=_0x5e8446[_0x6e70('0x11')]?_0x954545['acwTimeout']:0x0;}utils['request'](_0x6e70('0x15'),_0x5e8446);});}else{utils[_0x6e70('0x16')](_0x6e70('0x15'),_0x5e8446);}if(_0x2cae77){delete transfers[_0x5e8446[_0x6e70('0x6')]];}else{delete agents[_0x5e8446[_0x6e70('0x17')]];}}exports[_0x6e70('0x18')]=function(_0xa1eb74){try{utils[_0x6e70('0x19')](util['format']('[%s][agents][agentcalled]',_0xa1eb74['uniqueid']),_0xa1eb74);agents[_0xa1eb74[_0x6e70('0x17')]]=_0xa1eb74;agents[_0xa1eb74['destuniqueid']]['agentcalledAt']=utils[_0x6e70('0x1a')]();agents[_0xa1eb74[_0x6e70('0x17')]]['lastevent']=_0x6e70('0x1b');agents[_0xa1eb74['destuniqueid']][_0x6e70('0xc')]=null;agents[_0xa1eb74[_0x6e70('0x17')]]['connectedlinename']=null;utils['info'](util[_0x6e70('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xa1eb74[_0x6e70('0x6')],agents[_0xa1eb74[_0x6e70('0x17')]]['membername'],_0xa1eb74['destuniqueid']));}catch(_0xc238ba){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x1d'),_0xa1eb74[_0x6e70('0x6')]),_0xc238ba);}};exports[_0x6e70('0x1e')]=function(_0x1b2453){try{if(!_[_0x6e70('0x1f')](agents[_0x1b2453[_0x6e70('0x17')]])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x20'),_0x1b2453[_0x6e70('0x6')]),_0x1b2453);utils[_0x6e70('0x3')](util['format'](_0x6e70('0x21'),_0x1b2453[_0x6e70('0x6')],agents[_0x1b2453[_0x6e70('0x17')]]['membername'],_0x1b2453[_0x6e70('0x17')]));agents[_0x1b2453['destuniqueid']]['agentringnoanswer']=!![];agents[_0x1b2453['destuniqueid']][_0x6e70('0x22')]=utils[_0x6e70('0x1a')]();agents[_0x1b2453['destuniqueid']][_0x6e70('0xd')]=_0x6e70('0x23');agents[_0x1b2453['destuniqueid']][_0x6e70('0x24')]=_0x6e70('0x23');agents[_0x1b2453[_0x6e70('0x17')]]['holdtime']=_0x1b2453['ringtime']?parseInt(_0x1b2453[_0x6e70('0x25')])/0x3e8:0x0;agents[_0x1b2453[_0x6e70('0x17')]][_0x6e70('0x26')]=0x0;unanswered[_0x6e70('0x27')](_0x1b2453[_0x6e70('0x17')]);}}catch(_0x5d772a){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x20'),_0x1b2453[_0x6e70('0x6')]),_0x5d772a);}};exports[_0x6e70('0x28')]=function(_0x20a225){try{_[_0x6e70('0x29')](agents,function(_0x24114a,_0x3a0821){if(_0x24114a[_0x6e70('0x6')]==_0x20a225['uniqueid']&&!_[_0x6e70('0x2a')](unanswered,_0x24114a['destuniqueid'])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x2b'),_0x20a225[_0x6e70('0x6')]),_0x20a225);utils[_0x6e70('0x3')](util['format'](_0x6e70('0x2c'),_0x20a225[_0x6e70('0x6')],_0x24114a['membername'],_0x24114a[_0x6e70('0x17')]));_0x24114a[_0x6e70('0x1e')]=!![];_0x24114a['agentringnoanswerAt']=utils[_0x6e70('0x1a')]();_0x24114a[_0x6e70('0xd')]=_0x6e70('0x2d');_0x24114a[_0x6e70('0x24')]=_0x6e70('0x2d');_0x24114a[_0x6e70('0x2e')]=_0x20a225[_0x6e70('0x2e')];_0x24114a[_0x6e70('0x26')]=0x0;writeDB(_0x24114a);}});}catch(_0xf146fd){utils[_0x6e70('0x1c')](util['format'](_0x6e70('0x2b'),_0x20a225['uniqueid']),_0xf146fd);}};exports[_0x6e70('0x2f')]=function(_0x3222a2){try{if(agents[_0x3222a2[_0x6e70('0x17')]]){utils[_0x6e70('0x19')](util[_0x6e70('0x4')](_0x6e70('0x30'),_0x3222a2[_0x6e70('0x6')]),_0x3222a2);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x31'),_0x3222a2[_0x6e70('0x6')],agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x9')],_0x3222a2['destuniqueid']));agents[_0x3222a2['destuniqueid']]['agentconnectAt']=utils[_0x6e70('0x1a')]();agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0xc')]=_0x3222a2[_0x6e70('0xc')];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x32')]=_0x3222a2['connectedlinename'];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0x2e')]=_0x3222a2[_0x6e70('0x25')];agents[_0x3222a2[_0x6e70('0x17')]][_0x6e70('0xd')]=_0x6e70('0x33');_[_0x6e70('0x29')](agents,function(_0x16fc7d,_0x5be100){if(_0x16fc7d[_0x6e70('0x17')]!=_0x3222a2[_0x6e70('0x17')]&&_0x16fc7d[_0x6e70('0x6')]==_0x3222a2[_0x6e70('0x6')]){_0x16fc7d[_0x6e70('0x26')]=0x0;_0x16fc7d[_0x6e70('0x2e')]=_0x3222a2[_0x6e70('0x25')];_0x16fc7d['agentringnoanswer']=!![];_0x16fc7d['agentringnoanswerAt']=utils['now']();_0x16fc7d[_0x6e70('0xd')]=_0x6e70('0x34');_0x16fc7d[_0x6e70('0x24')]=_0x6e70('0x34');_0x16fc7d[_0x6e70('0x35')]=_0x3222a2['destuniqueid'];_0x16fc7d[_0x6e70('0x36')]=_0x3222a2[_0x6e70('0x9')];writeDB(_0x16fc7d);}});}}catch(_0x2a2aca){utils['error'](util['format']('[%s][agents][agentconnect]',_0x3222a2[_0x6e70('0x6')]),_0x2a2aca);}};exports['agentcomplete']=function(_0x42f49a){try{if(!_[_0x6e70('0x1f')](agents[_0x42f49a[_0x6e70('0x17')]])){utils[_0x6e70('0x19')](util['format'](_0x6e70('0x37'),_0x42f49a['uniqueid']),_0x42f49a);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x38'),_0x42f49a[_0x6e70('0x6')],agents[_0x42f49a['destuniqueid']][_0x6e70('0x9')],_0x42f49a[_0x6e70('0x17')]));agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x12')]=!![];agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x39')]=utils[_0x6e70('0x1a')]();agents[_0x42f49a['destuniqueid']][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x39')],agents[_0x42f49a[_0x6e70('0x17')]][_0x6e70('0x3b')]);agents[_0x42f49a[_0x6e70('0x17')]]['reason']=_0x42f49a[_0x6e70('0x24')];agents[_0x42f49a['destuniqueid']][_0x6e70('0xd')]=_0x6e70('0x3c');writeDB(agents[_0x42f49a['destuniqueid']]);}}catch(_0x53efc3){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x37'),_0x42f49a['uniqueid']),_0x53efc3);}};exports['blindtransfer']=function(_0x238ebb){try{if(!_[_0x6e70('0x1f')](agents[_0x238ebb[_0x6e70('0x3d')]])){utils[_0x6e70('0x19')](util[_0x6e70('0x4')](_0x6e70('0x3e'),_0x238ebb['uniqueid']),_0x238ebb);utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x3f'),_0x238ebb[_0x6e70('0x6')],agents[_0x238ebb[_0x6e70('0x3d')]]['membername'],agents[_0x238ebb['transfereruniqueid']][_0x6e70('0x6')]));agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x40')]=!![];agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x41')]='blind';agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x42')]=_0x238ebb[_0x6e70('0x43')];agents[_0x238ebb[_0x6e70('0x3d')]][_0x6e70('0x44')]=agents[_0x238ebb['transfereruniqueid']][_0x6e70('0x6')];}}catch(_0x1dd242){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x3e'),_0x238ebb[_0x6e70('0x6')]),_0x1dd242);}};exports['attendedtransfer']=function(_0x40e7c6){try{utils[_0x6e70('0x19')](util['format'](_0x6e70('0x45'),_0x40e7c6[_0x6e70('0x46')]),_0x40e7c6);if(_0x40e7c6['origtransfereruniqueid']==_0x40e7c6[_0x6e70('0x47')]){if(!_[_0x6e70('0x1f')](agents[_0x40e7c6[_0x6e70('0x48')]])){utils[_0x6e70('0x3')](util[_0x6e70('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x40e7c6[_0x6e70('0x46')],agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x9')]));agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x40')]=!![];agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x41')]=_0x6e70('0x49');agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x42')]=_0x40e7c6[_0x6e70('0x4a')];agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0x44')]=_0x40e7c6[_0x6e70('0x46')];}if(_0x40e7c6[_0x6e70('0x4b')]&&agents[_0x40e7c6[_0x6e70('0x4b')]]){agents[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4c')]=0x1;transfers[_0x40e7c6[_0x6e70('0x4b')]]=_[_0x6e70('0x4d')](agents[_0x40e7c6['transfereeuniqueid']]);transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0xb')]=agents[_0x40e7c6[_0x6e70('0x48')]][_0x6e70('0xb')];transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4e')]=agents[_0x40e7c6['secondtransfereruniqueid']][_0x6e70('0x4e')];transfers[_0x40e7c6[_0x6e70('0x4b')]]['agentcalledAt']=utils[_0x6e70('0x1a')]();transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x3b')]=utils['now']();transfers[_0x40e7c6['transfereeuniqueid']][_0x6e70('0x2e')]=0x0;transfers[_0x40e7c6[_0x6e70('0x4b')]][_0x6e70('0x4c')]=0x2;}}else if(_0x40e7c6[_0x6e70('0x48')]==_0x40e7c6[_0x6e70('0x4f')]){if(!_[_0x6e70('0x1f')](agents[_0x40e7c6[_0x6e70('0x46')]])){utils['info'](util['format'](_0x6e70('0x50'),_0x40e7c6[_0x6e70('0x46')],agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x9')]));agents[_0x40e7c6['origtransfereruniqueid']]['transfer']=!![];agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x41')]='ATTENDED';agents[_0x40e7c6['origtransfereruniqueid']][_0x6e70('0x42')]=_0x40e7c6['secondtransfererexten'];agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0x44')]=_0x40e7c6[_0x6e70('0x48')];}if(_0x40e7c6[_0x6e70('0x51')]&&agents[_0x40e7c6[_0x6e70('0x51')]]){agents[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x4c')]=0x1;transfers[_0x40e7c6[_0x6e70('0x51')]]=_['clone'](agents[_0x40e7c6[_0x6e70('0x51')]]);transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0xb')]=agents[_0x40e7c6[_0x6e70('0x46')]][_0x6e70('0xb')];transfers[_0x40e7c6['transfertargetuniqueid']]['calleridname']=agents[_0x40e7c6['origtransfereruniqueid']][_0x6e70('0x4e')];transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x52')]=utils['now']();transfers[_0x40e7c6['transfertargetuniqueid']][_0x6e70('0x3b')]=utils[_0x6e70('0x1a')]();transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x2e')]=0x0;transfers[_0x40e7c6[_0x6e70('0x51')]][_0x6e70('0x4c')]=0x2;}}}catch(_0x5eb6f0){utils[_0x6e70('0x1c')](util[_0x6e70('0x4')](_0x6e70('0x45'),_0x40e7c6[_0x6e70('0x46')]),_0x5eb6f0);}};exports['hangup']=function(_0xce964b){try{utils['debug'](util['format'](_0x6e70('0x53'),_0xce964b[_0x6e70('0x6')]),_0xce964b);if(agents[_0xce964b[_0x6e70('0x6')]]&&agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]===_0x6e70('0x23')){if(_0xce964b['cause']==='21'){agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=_0x6e70('0x54');agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x54');}utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x55'),_0xce964b[_0x6e70('0x6')],agents[_0xce964b['uniqueid']][_0x6e70('0x9')],agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')],agents[_0xce964b['uniqueid']]['lastevent']));writeDB(agents[_0xce964b[_0x6e70('0x6')]]);var _0x18ecf0=unanswered[_0x6e70('0x56')](_0xce964b[_0x6e70('0x6')]);if(_0x18ecf0>-0x1){unanswered[_0x6e70('0x57')](_0x18ecf0,0x1);}}if(transfers[_0xce964b['uniqueid']]){transfers[_0xce964b['uniqueid']][_0x6e70('0x12')]=!![];transfers[_0xce964b[_0x6e70('0x6')]]['agentcompleteAt']=utils[_0x6e70('0x1a')]();transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x39')],transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x3b')]);transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=_0x6e70('0x58');transfers[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x3c');utils['info'](util['format'](_0x6e70('0x55'),_0xce964b['uniqueid'],transfers[_0xce964b[_0x6e70('0x6')]]['membername'],transfers[_0xce964b['uniqueid']][_0x6e70('0x24')],transfers[_0xce964b['uniqueid']]['lastevent']));writeDB(transfers[_0xce964b[_0x6e70('0x6')]],!![]);}if(agents[_0xce964b[_0x6e70('0x6')]]&&agents[_0xce964b[_0x6e70('0x6')]]['agentconnectAt']){agents[_0xce964b['uniqueid']]['agentcomplete']=!![];agents[_0xce964b[_0x6e70('0x6')]]['agentcompleteAt']=utils[_0x6e70('0x1a')]();agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x26')]=utils[_0x6e70('0x3a')](agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x39')],agents[_0xce964b[_0x6e70('0x6')]]['agentconnectAt']);agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0x24')]=agents[_0xce964b[_0x6e70('0x6')]]['transfer']?_0x6e70('0x40'):_0x6e70('0x58');agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]=_0x6e70('0x3c');utils[_0x6e70('0x3')](util[_0x6e70('0x4')](_0x6e70('0x55'),_0xce964b[_0x6e70('0x6')],agents[_0xce964b['uniqueid']][_0x6e70('0x9')],agents[_0xce964b[_0x6e70('0x6')]]['reason'],agents[_0xce964b[_0x6e70('0x6')]][_0x6e70('0xd')]));writeDB(agents[_0xce964b['uniqueid']]);}}catch(_0x596d71){utils[_0x6e70('0x1c')](util['format'](_0x6e70('0x53'),_0xce964b['uniqueid']),_0x596d71);}}; \ No newline at end of file +var _0xe1e3=['agentcompleteAt','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transferexten','transfereeuniqueid','calleridname','agentcalledAt','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transferuniqueid','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','splice','agent','complete','lodash','util','format','uniqueid','channel','queue','membername','interface','calleridnum','lastevent','getVoiceQueueByName','then','agentcomplete','acwtime','agentacw','acwTimeout','CreateVoiceAgentReport','[%s][agents][agentcalled]','destuniqueid','now','called','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','debug','agentringnoanswer','agentringnoanswerAt','timeout','talktime','error','queuecallerabandon','includes','[%s][agents][queuecallerabandon]','abandoned','reason','holdtime','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinenum','connectedlinename','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime'];(function(_0x47878c,_0x406d83){var _0x182cf0=function(_0x50aa77){while(--_0x50aa77){_0x47878c['push'](_0x47878c['shift']());}};_0x182cf0(++_0x406d83);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x3a091a,_0x321b6a){_0x3a091a=_0x3a091a-0x0;var _0x5c1336=_0xe1e3[_0x3a091a];return _0x5c1336;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0xdbdabb,_0x5e9f9a){utils['info'](util[_0x3e1e('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0xdbdabb[_0x3e1e('0x3')],_0xdbdabb[_0x3e1e('0x4')],_0xdbdabb[_0x3e1e('0x5')],_0xdbdabb[_0x3e1e('0x6')],_0xdbdabb[_0x3e1e('0x7')],_0xdbdabb[_0x3e1e('0x8')],_0xdbdabb['connectedlinenum'],_0xdbdabb[_0x3e1e('0x9')]));if(_0xdbdabb[_0x3e1e('0x5')]){utils[_0x3e1e('0xa')](_0xdbdabb[_0x3e1e('0x5')])[_0x3e1e('0xb')](function(_0x1e5173){if(_0x1e5173){_0xdbdabb['type']=_0x1e5173['type'];_0xdbdabb['agentacw']=_0xdbdabb[_0x3e1e('0xc')]?_0x1e5173['acw']:![];_0xdbdabb[_0x3e1e('0xd')]=_0xdbdabb[_0x3e1e('0xe')]?_0x1e5173[_0x3e1e('0xf')]:0x0;}utils['request'](_0x3e1e('0x10'),_0xdbdabb);});}else{utils['request']('CreateVoiceAgentReport',_0xdbdabb);}if(_0x5e9f9a){delete transfers[_0xdbdabb['uniqueid']];}else{delete agents[_0xdbdabb['destuniqueid']];}}exports['agentcalled']=function(_0x14ad58){try{utils['debug'](util['format'](_0x3e1e('0x11'),_0x14ad58[_0x3e1e('0x3')]),_0x14ad58);agents[_0x14ad58[_0x3e1e('0x12')]]=_0x14ad58;agents[_0x14ad58['destuniqueid']]['agentcalledAt']=utils[_0x3e1e('0x13')]();agents[_0x14ad58[_0x3e1e('0x12')]]['lastevent']=_0x3e1e('0x14');agents[_0x14ad58[_0x3e1e('0x12')]]['connectedlinenum']=null;agents[_0x14ad58[_0x3e1e('0x12')]]['connectedlinename']=null;utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x16'),_0x14ad58[_0x3e1e('0x3')],agents[_0x14ad58[_0x3e1e('0x12')]][_0x3e1e('0x6')],_0x14ad58['destuniqueid']));}catch(_0x5dccb8){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x11'),_0x14ad58[_0x3e1e('0x3')]),_0x5dccb8);}};exports['agentringnoanswer']=function(_0x1c5acd){try{if(!_['isNil'](agents[_0x1c5acd[_0x3e1e('0x12')]])){utils[_0x3e1e('0x17')](util[_0x3e1e('0x2')]('[%s][agents][agentringnoanswer]',_0x1c5acd[_0x3e1e('0x3')]),_0x1c5acd);utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x1c5acd['uniqueid'],agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x6')],_0x1c5acd['destuniqueid']));agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x18')]=!![];agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x19')]=utils[_0x3e1e('0x13')]();agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x9')]=_0x3e1e('0x1a');agents[_0x1c5acd['destuniqueid']]['reason']=_0x3e1e('0x1a');agents[_0x1c5acd[_0x3e1e('0x12')]]['holdtime']=_0x1c5acd['ringtime']?parseInt(_0x1c5acd['ringtime'])/0x3e8:0x0;agents[_0x1c5acd[_0x3e1e('0x12')]][_0x3e1e('0x1b')]=0x0;unanswered['push'](_0x1c5acd[_0x3e1e('0x12')]);}}catch(_0x5ac814){utils[_0x3e1e('0x1c')](util[_0x3e1e('0x2')]('[%s][agents][agentringnoanswer]',_0x1c5acd[_0x3e1e('0x3')]),_0x5ac814);}};exports[_0x3e1e('0x1d')]=function(_0x45ed0e){try{_['forIn'](agents,function(_0xdef39,_0x4ec149){if(_0xdef39['uniqueid']==_0x45ed0e['uniqueid']&&!_[_0x3e1e('0x1e')](unanswered,_0xdef39['destuniqueid'])){utils['debug'](util[_0x3e1e('0x2')](_0x3e1e('0x1f'),_0x45ed0e[_0x3e1e('0x3')]),_0x45ed0e);utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x45ed0e['uniqueid'],_0xdef39['membername'],_0xdef39['destuniqueid']));_0xdef39[_0x3e1e('0x18')]=!![];_0xdef39[_0x3e1e('0x19')]=utils[_0x3e1e('0x13')]();_0xdef39[_0x3e1e('0x9')]=_0x3e1e('0x20');_0xdef39[_0x3e1e('0x21')]=_0x3e1e('0x20');_0xdef39[_0x3e1e('0x22')]=_0x45ed0e['holdtime'];_0xdef39[_0x3e1e('0x1b')]=0x0;writeDB(_0xdef39);}});}catch(_0x348ef5){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x1f'),_0x45ed0e[_0x3e1e('0x3')]),_0x348ef5);}};exports[_0x3e1e('0x23')]=function(_0x55a082){try{if(agents[_0x55a082['destuniqueid']]){utils[_0x3e1e('0x17')](util[_0x3e1e('0x2')]('[%s][agents][agentconnect]',_0x55a082[_0x3e1e('0x3')]),_0x55a082);utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x24'),_0x55a082[_0x3e1e('0x3')],agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x6')],_0x55a082[_0x3e1e('0x12')]));agents[_0x55a082['destuniqueid']][_0x3e1e('0x25')]=utils[_0x3e1e('0x13')]();agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x26')]=_0x55a082['connectedlinenum'];agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x27')]=_0x55a082[_0x3e1e('0x27')];agents[_0x55a082[_0x3e1e('0x12')]][_0x3e1e('0x22')]=_0x55a082[_0x3e1e('0x28')];agents[_0x55a082[_0x3e1e('0x12')]]['lastevent']=_0x3e1e('0x29');_['forIn'](agents,function(_0x53bdf5,_0x4f598e){if(_0x53bdf5[_0x3e1e('0x12')]!=_0x55a082[_0x3e1e('0x12')]&&_0x53bdf5['uniqueid']==_0x55a082[_0x3e1e('0x3')]){_0x53bdf5[_0x3e1e('0x1b')]=0x0;_0x53bdf5['holdtime']=_0x55a082[_0x3e1e('0x28')];_0x53bdf5[_0x3e1e('0x18')]=!![];_0x53bdf5['agentringnoanswerAt']=utils['now']();_0x53bdf5[_0x3e1e('0x9')]='answered_elsewhere';_0x53bdf5['reason']=_0x3e1e('0x2a');_0x53bdf5[_0x3e1e('0x2b')]=_0x55a082[_0x3e1e('0x12')];_0x53bdf5[_0x3e1e('0x2c')]=_0x55a082[_0x3e1e('0x6')];writeDB(_0x53bdf5);}});}}catch(_0x55ea1d){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x2d'),_0x55a082[_0x3e1e('0x3')]),_0x55ea1d);}};exports['agentcomplete']=function(_0x1124d0){try{if(!_[_0x3e1e('0x2e')](agents[_0x1124d0[_0x3e1e('0x12')]])){utils['debug'](util[_0x3e1e('0x2')]('[%s][agents][agentcomplete]',_0x1124d0['uniqueid']),_0x1124d0);utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x2f'),_0x1124d0[_0x3e1e('0x3')],agents[_0x1124d0['destuniqueid']]['membername'],_0x1124d0['destuniqueid']));agents[_0x1124d0['destuniqueid']][_0x3e1e('0xc')]=!![];agents[_0x1124d0[_0x3e1e('0x12')]]['agentcompleteAt']=utils['now']();agents[_0x1124d0[_0x3e1e('0x12')]][_0x3e1e('0x1b')]=utils[_0x3e1e('0x30')](agents[_0x1124d0['destuniqueid']][_0x3e1e('0x31')],agents[_0x1124d0['destuniqueid']][_0x3e1e('0x25')]);agents[_0x1124d0[_0x3e1e('0x12')]][_0x3e1e('0x21')]=_0x1124d0[_0x3e1e('0x21')];agents[_0x1124d0[_0x3e1e('0x12')]][_0x3e1e('0x9')]='complete';writeDB(agents[_0x1124d0[_0x3e1e('0x12')]]);}}catch(_0x1ce1cd){utils['error'](util[_0x3e1e('0x2')](_0x3e1e('0x32'),_0x1124d0['uniqueid']),_0x1ce1cd);}};exports[_0x3e1e('0x33')]=function(_0x347b3f){try{if(!_[_0x3e1e('0x2e')](agents[_0x347b3f[_0x3e1e('0x34')]])){utils['debug'](util[_0x3e1e('0x2')](_0x3e1e('0x35'),_0x347b3f[_0x3e1e('0x3')]),_0x347b3f);utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x36'),_0x347b3f[_0x3e1e('0x3')],agents[_0x347b3f[_0x3e1e('0x34')]][_0x3e1e('0x6')],agents[_0x347b3f[_0x3e1e('0x34')]][_0x3e1e('0x3')]));agents[_0x347b3f[_0x3e1e('0x34')]][_0x3e1e('0x37')]=!![];agents[_0x347b3f['transfereruniqueid']][_0x3e1e('0x38')]='blind';agents[_0x347b3f['transfereruniqueid']]['transferexten']=_0x347b3f[_0x3e1e('0x39')];agents[_0x347b3f[_0x3e1e('0x34')]]['transferuniqueid']=agents[_0x347b3f[_0x3e1e('0x34')]]['uniqueid'];}}catch(_0x5b2416){utils[_0x3e1e('0x1c')](util['format']('[%s][agents][blindtransfer]',_0x347b3f['uniqueid']),_0x5b2416);}};exports[_0x3e1e('0x3a')]=function(_0xe577b2){try{utils[_0x3e1e('0x17')](util[_0x3e1e('0x2')](_0x3e1e('0x3b'),_0xe577b2[_0x3e1e('0x3c')]),_0xe577b2);if(_0xe577b2[_0x3e1e('0x3c')]==_0xe577b2['origtransfererlinkedid']){if(!_[_0x3e1e('0x2e')](agents[_0xe577b2['secondtransfereruniqueid']])){utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x3d'),_0xe577b2['origtransfereruniqueid'],agents[_0xe577b2['secondtransfereruniqueid']][_0x3e1e('0x6')]));agents[_0xe577b2[_0x3e1e('0x3e')]]['transfer']=!![];agents[_0xe577b2[_0x3e1e('0x3e')]]['transfertype']='ATTENDED';agents[_0xe577b2[_0x3e1e('0x3e')]][_0x3e1e('0x3f')]=_0xe577b2['origtransfererexten'];agents[_0xe577b2[_0x3e1e('0x3e')]]['transferuniqueid']=_0xe577b2['origtransfereruniqueid'];}if(_0xe577b2[_0x3e1e('0x40')]&&agents[_0xe577b2['transfereeuniqueid']]){agents[_0xe577b2[_0x3e1e('0x40')]]['agententerreason']=0x1;transfers[_0xe577b2[_0x3e1e('0x40')]]=_['clone'](agents[_0xe577b2[_0x3e1e('0x40')]]);transfers[_0xe577b2[_0x3e1e('0x40')]]['calleridnum']=agents[_0xe577b2['secondtransfereruniqueid']]['calleridnum'];transfers[_0xe577b2[_0x3e1e('0x40')]][_0x3e1e('0x41')]=agents[_0xe577b2[_0x3e1e('0x3e')]]['calleridname'];transfers[_0xe577b2[_0x3e1e('0x40')]][_0x3e1e('0x42')]=utils[_0x3e1e('0x13')]();transfers[_0xe577b2['transfereeuniqueid']]['agentconnectAt']=utils[_0x3e1e('0x13')]();transfers[_0xe577b2['transfereeuniqueid']][_0x3e1e('0x22')]=0x0;transfers[_0xe577b2[_0x3e1e('0x40')]][_0x3e1e('0x43')]=0x2;}}else if(_0xe577b2['secondtransfereruniqueid']==_0xe577b2[_0x3e1e('0x44')]){if(!_['isNil'](agents[_0xe577b2[_0x3e1e('0x3c')]])){utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x3d'),_0xe577b2['origtransfereruniqueid'],agents[_0xe577b2[_0x3e1e('0x3c')]]['membername']));agents[_0xe577b2[_0x3e1e('0x3c')]]['transfer']=!![];agents[_0xe577b2[_0x3e1e('0x3c')]][_0x3e1e('0x38')]=_0x3e1e('0x45');agents[_0xe577b2['origtransfereruniqueid']][_0x3e1e('0x3f')]=_0xe577b2[_0x3e1e('0x46')];agents[_0xe577b2['origtransfereruniqueid']][_0x3e1e('0x47')]=_0xe577b2['secondtransfereruniqueid'];}if(_0xe577b2['transfertargetuniqueid']&&agents[_0xe577b2['transfertargetuniqueid']]){agents[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x43')]=0x1;transfers[_0xe577b2[_0x3e1e('0x48')]]=_[_0x3e1e('0x49')](agents[_0xe577b2[_0x3e1e('0x48')]]);transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x8')]=agents[_0xe577b2['origtransfereruniqueid']][_0x3e1e('0x8')];transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x41')]=agents[_0xe577b2[_0x3e1e('0x3c')]][_0x3e1e('0x41')];transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x42')]=utils[_0x3e1e('0x13')]();transfers[_0xe577b2['transfertargetuniqueid']]['agentconnectAt']=utils[_0x3e1e('0x13')]();transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x22')]=0x0;transfers[_0xe577b2[_0x3e1e('0x48')]][_0x3e1e('0x43')]=0x2;}}}catch(_0x2e950d){utils[_0x3e1e('0x1c')](util[_0x3e1e('0x2')](_0x3e1e('0x3b'),_0xe577b2[_0x3e1e('0x3c')]),_0x2e950d);}};exports[_0x3e1e('0x4a')]=function(_0x50ba57){try{utils['debug'](util['format'](_0x3e1e('0x4b'),_0x50ba57[_0x3e1e('0x3')]),_0x50ba57);if(agents[_0x50ba57[_0x3e1e('0x3')]]&&agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')]==='timeout'){if(_0x50ba57[_0x3e1e('0x4c')]==='21'){agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')]=_0x3e1e('0x4d');agents[_0x50ba57[_0x3e1e('0x3')]]['lastevent']=_0x3e1e('0x4d');}utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x4e'),_0x50ba57[_0x3e1e('0x3')],agents[_0x50ba57[_0x3e1e('0x3')]]['membername'],agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')],agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x9')]));writeDB(agents[_0x50ba57[_0x3e1e('0x3')]]);var _0x372581=unanswered['indexOf'](_0x50ba57[_0x3e1e('0x3')]);if(_0x372581>-0x1){unanswered[_0x3e1e('0x4f')](_0x372581,0x1);}}if(transfers[_0x50ba57[_0x3e1e('0x3')]]){transfers[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0xc')]=!![];transfers[_0x50ba57[_0x3e1e('0x3')]]['agentcompleteAt']=utils[_0x3e1e('0x13')]();transfers[_0x50ba57['uniqueid']][_0x3e1e('0x1b')]=utils[_0x3e1e('0x30')](transfers[_0x50ba57['uniqueid']][_0x3e1e('0x31')],transfers[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x25')]);transfers[_0x50ba57[_0x3e1e('0x3')]]['reason']=_0x3e1e('0x50');transfers[_0x50ba57['uniqueid']][_0x3e1e('0x9')]=_0x3e1e('0x51');utils[_0x3e1e('0x15')](util[_0x3e1e('0x2')](_0x3e1e('0x4e'),_0x50ba57[_0x3e1e('0x3')],transfers[_0x50ba57['uniqueid']][_0x3e1e('0x6')],transfers[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')],transfers[_0x50ba57[_0x3e1e('0x3')]]['lastevent']));writeDB(transfers[_0x50ba57[_0x3e1e('0x3')]],!![]);}if(agents[_0x50ba57[_0x3e1e('0x3')]]&&agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x25')]){agents[_0x50ba57['uniqueid']][_0x3e1e('0xc')]=!![];agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x31')]=utils[_0x3e1e('0x13')]();agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x1b')]=utils['diffTime'](agents[_0x50ba57['uniqueid']]['agentcompleteAt'],agents[_0x50ba57[_0x3e1e('0x3')]]['agentconnectAt']);agents[_0x50ba57[_0x3e1e('0x3')]]['reason']=agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x37')]?_0x3e1e('0x37'):_0x3e1e('0x50');agents[_0x50ba57['uniqueid']][_0x3e1e('0x9')]='complete';utils[_0x3e1e('0x15')](util['format'](_0x3e1e('0x4e'),_0x50ba57[_0x3e1e('0x3')],agents[_0x50ba57['uniqueid']][_0x3e1e('0x6')],agents[_0x50ba57[_0x3e1e('0x3')]][_0x3e1e('0x21')],agents[_0x50ba57['uniqueid']]['lastevent']));writeDB(agents[_0x50ba57[_0x3e1e('0x3')]]);}}catch(_0x20bb6d){utils[_0x3e1e('0x1c')](util['format'](_0x3e1e('0x4b'),_0x50ba57['uniqueid']),_0x20bb6d);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 14e4d63..8d40cd6 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 _0xceb6=['UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','newstate','debug','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmd-queue','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','lastdata','xmd-contactid','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','noop','execif','[%s][calls][newexten]','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then'];(function(_0x570e36,_0x4f6e20){var _0x4ec4f3=function(_0x2846be){while(--_0x2846be){_0x570e36['push'](_0x570e36['shift']());}};_0x4ec4f3(++_0x4f6e20);}(_0xceb6,0x193));var _0x6ceb=function(_0x8ed2fe,_0x19ca78){_0x8ed2fe=_0x8ed2fe-0x0;var _0x23a751=_0xceb6[_0x8ed2fe];return _0x23a751;};'use strict';var _=require(_0x6ceb('0x0'));var util=require(_0x6ceb('0x1'));var utils=require('./utils');var transfers=require('./transfers.controller');var dispositions=[_0x6ceb('0x2'),_0x6ceb('0x3'),_0x6ceb('0x3'),_0x6ceb('0x2'),_0x6ceb('0x2'),_0x6ceb('0x2'),_0x6ceb('0x4'),_0x6ceb('0x5'),'FAILED','FAILED','FAILED'];var channels={};function writeDB(_0xe524c7){var _0x5ef6ed;if(transfers[_0x6ceb('0x6')][_0xe524c7[_0x6ceb('0x7')]]){_0x5ef6ed=_0xe524c7[_0x6ceb('0x7')];_0xe524c7[_0x6ceb('0x7')]=transfers['blinds'][_0xe524c7[_0x6ceb('0x7')]][_0x6ceb('0x8')];}utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')](_0x6ceb('0xb'),_0xe524c7['uniqueid'],_0xe524c7[_0x6ceb('0xc')],_0xe524c7[_0x6ceb('0xd')],_0xe524c7[_0x6ceb('0xe')],_0xe524c7[_0x6ceb('0xf')],_0xe524c7[_0x6ceb('0x10')],_0xe524c7[_0x6ceb('0x11')],_0xe524c7['lastevent']));if(_0xe524c7[_0x6ceb('0x12')]){utils[_0x6ceb('0x13')](_0xe524c7[_0x6ceb('0x12')])[_0x6ceb('0x14')](function(_0x5b6d02){if(_0x5b6d02){_0xe524c7[_0x6ceb('0x15')]=_0x5b6d02['id'];}utils[_0x6ceb('0x16')](_0x6ceb('0x17'),_0xe524c7);});}else{utils[_0x6ceb('0x16')](_0x6ceb('0x17'),_0xe524c7);}if(channels[_0xe524c7[_0x6ceb('0x7')]]){delete channels[_0xe524c7[_0x6ceb('0x7')]];}else if(_0x5ef6ed&&channels[_0x5ef6ed]){delete transfers[_0x6ceb('0x6')][_0x5ef6ed];delete channels[_0x5ef6ed];}}exports[_0x6ceb('0x18')]=function(_0x2f95dc){try{utils['debug'](util[_0x6ceb('0xa')](_0x6ceb('0x19'),_0x2f95dc[_0x6ceb('0x7')]),_0x2f95dc);if(_0x2f95dc[_0x6ceb('0x7')]==_0x2f95dc['linkedid']&&_0x2f95dc[_0x6ceb('0xc')]!=_0x6ceb('0x1a')){utils[_0x6ceb('0x9')](util['format'](_0x6ceb('0x1b'),_0x2f95dc['uniqueid'],_0x2f95dc[_0x6ceb('0x1c')],_0x2f95dc['exten']));channels[_0x2f95dc[_0x6ceb('0x7')]]={'uniqueid':_0x2f95dc[_0x6ceb('0x7')],'accountcode':_0x2f95dc[_0x6ceb('0x12')],'source':_0x2f95dc[_0x6ceb('0x10')],'destination':_0x2f95dc[_0x6ceb('0x1d')],'destinationcontext':_0x2f95dc[_0x6ceb('0x1c')],'channel':_0x2f95dc[_0x6ceb('0xc')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x6ceb('0x2'),'amaflags':_0x6ceb('0x1e')};}}catch(_0x3631c1){utils[_0x6ceb('0x1f')](util[_0x6ceb('0xa')](_0x6ceb('0x19'),_0x2f95dc[_0x6ceb('0x7')]),_0x3631c1);}};exports[_0x6ceb('0x20')]=function(_0x57656e){try{utils[_0x6ceb('0x21')](util['format']('[%s][calls][newstate]',_0x57656e[_0x6ceb('0x7')]),_0x57656e);if(!_[_0x6ceb('0x22')](channels[_0x57656e[_0x6ceb('0x7')]])&&_0x57656e[_0x6ceb('0x23')]==0x6){utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')](_0x6ceb('0x24'),_0x57656e[_0x6ceb('0x7')],_0x57656e[_0x6ceb('0x1c')],_0x57656e[_0x6ceb('0xc')]));if(_[_0x6ceb('0x22')](channels[_0x57656e[_0x6ceb('0x7')]][_0x6ceb('0x25')])){channels[_0x57656e[_0x6ceb('0x7')]][_0x6ceb('0x25')]=utils[_0x6ceb('0x26')]();}}else if(!_[_0x6ceb('0x22')](channels[_0x57656e[_0x6ceb('0x27')]])&&_0x57656e[_0x6ceb('0x23')]==0x6&&_0x57656e[_0x6ceb('0x1c')]!=_0x6ceb('0x28')){utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')](_0x6ceb('0x29'),_0x57656e[_0x6ceb('0x7')],_0x57656e['linkedid'],_0x57656e[_0x6ceb('0x1c')],_0x57656e['channel']));channels[_0x57656e[_0x6ceb('0x27')]][_0x6ceb('0x12')]=_0x57656e[_0x6ceb('0x12')];channels[_0x57656e['linkedid']]['destinationchannel']=_0x57656e['channel'];if(_['isNil'](channels[_0x57656e[_0x6ceb('0x27')]][_0x6ceb('0x2a')])){channels[_0x57656e['linkedid']]['answertime']=utils[_0x6ceb('0x26')]();}channels[_0x57656e[_0x6ceb('0x27')]][_0x6ceb('0x2b')]=dispositions[_[_0x6ceb('0x2c')](_0x57656e[_0x6ceb('0x23')])]||_0x6ceb('0x4');}}catch(_0x40cc9c){utils[_0x6ceb('0x1f')](util[_0x6ceb('0xa')]('[%s][calls][newstate]',_0x57656e[_0x6ceb('0x7')]),_0x40cc9c);}};exports[_0x6ceb('0x2d')]=function(_0xee294){try{if(!_[_0x6ceb('0x22')](channels[_0xee294[_0x6ceb('0x7')]])){utils[_0x6ceb('0x21')](util[_0x6ceb('0xa')](_0x6ceb('0x2e'),_0xee294['uniqueid']),_0xee294);if(_[_0x6ceb('0x22')](channels[_0xee294['uniqueid']][_0x6ceb('0x2f')])){channels[_0xee294[_0x6ceb('0x7')]][_0x6ceb('0x2f')]=_0xee294['calleridname']+'\x20<'+_0xee294[_0x6ceb('0x10')]+'>';}utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')](_0x6ceb('0x30'),_0xee294[_0x6ceb('0x7')],channels[_0xee294[_0x6ceb('0x7')]][_0x6ceb('0x2f')],_0xee294[_0x6ceb('0x31')]));channels[_0xee294[_0x6ceb('0x7')]][_0x6ceb('0x32')]=utils[_0x6ceb('0x26')]();channels[_0xee294['uniqueid']][_0x6ceb('0x33')]=utils[_0x6ceb('0x34')](channels[_0xee294['uniqueid']][_0x6ceb('0x32')],channels[_0xee294[_0x6ceb('0x7')]]['starttime']);channels[_0xee294[_0x6ceb('0x7')]]['billableseconds']=channels[_0xee294['uniqueid']]['answertime']?utils[_0x6ceb('0x34')](channels[_0xee294[_0x6ceb('0x7')]][_0x6ceb('0x32')],channels[_0xee294['uniqueid']][_0x6ceb('0x2a')]):0x0;writeDB(channels[_0xee294[_0x6ceb('0x7')]]);}}catch(_0x53ecbf){utils[_0x6ceb('0x1f')](util['format'](_0x6ceb('0x2e'),_0xee294[_0x6ceb('0x7')]),_0x53ecbf);}};exports[_0x6ceb('0x35')]=function(_0x5efac0){try{if(!_[_0x6ceb('0x22')](channels[_0x5efac0[_0x6ceb('0x36')]])){utils[_0x6ceb('0x21')](util[_0x6ceb('0xa')](_0x6ceb('0x37'),_0x5efac0[_0x6ceb('0x38')]),_0x5efac0);if(channels[_0x5efac0[_0x6ceb('0x36')]][_0x6ceb('0xc')]==_0x5efac0[_0x6ceb('0x39')]){utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5efac0['origtransfereruniqueid'],_0x5efac0[_0x6ceb('0x36')],_0x5efac0[_0x6ceb('0x3a')]));channels[_0x5efac0['localtwolinkedid']][_0x6ceb('0x3b')]=_0x5efac0[_0x6ceb('0x3a')];channels[_0x5efac0[_0x6ceb('0x36')]][_0x6ceb('0x3c')]=_0x6ceb('0x3d');}else if(channels[_0x5efac0['localtwolinkedid']][_0x6ceb('0xc')]=_0x5efac0[_0x6ceb('0x3e')]){utils[_0x6ceb('0x9')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5efac0['origtransfereruniqueid'],_0x5efac0['localtwolinkedid'],_0x5efac0[_0x6ceb('0x3f')]));channels[_0x5efac0[_0x6ceb('0x36')]][_0x6ceb('0x3b')]=_0x5efac0['origtransfererchannel'];channels[_0x5efac0[_0x6ceb('0x36')]][_0x6ceb('0x3c')]='_attended';}}}catch(_0x51d3fc){utils['error'](util[_0x6ceb('0xa')](_0x6ceb('0x37'),_0x5efac0['origtransfereruniqueid']),_0x51d3fc);}};exports[_0x6ceb('0x40')]=function(_0x2282b7){try{if(!_[_0x6ceb('0x22')](channels[_0x2282b7['uniqueid']])){utils['debug'](util[_0x6ceb('0xa')]('[%s][calls][musiconholdstart]',_0x2282b7['uniqueid']),_0x2282b7);channels[_0x2282b7['uniqueid']][_0x6ceb('0x41')]=utils[_0x6ceb('0x26')]();utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')](_0x6ceb('0x42'),_0x2282b7[_0x6ceb('0x7')],channels[_0x2282b7[_0x6ceb('0x7')]][_0x6ceb('0x41')]));}}catch(_0x2d5e3c){utils[_0x6ceb('0x1f')](util[_0x6ceb('0xa')]('[%s][calls][musiconholdstart]',_0x2282b7[_0x6ceb('0x7')]),_0x2d5e3c);}};exports[_0x6ceb('0x43')]=function(_0x2b9d98){try{if(!_[_0x6ceb('0x22')](channels[_0x2b9d98['uniqueid']])){utils[_0x6ceb('0x21')](util['format'](_0x6ceb('0x44'),_0x2b9d98[_0x6ceb('0x7')]),_0x2b9d98);if(!_[_0x6ceb('0x22')](channels[_0x2b9d98[_0x6ceb('0x7')]]['musiconholdstartAt'])){channels[_0x2b9d98[_0x6ceb('0x7')]][_0x6ceb('0x45')]+=utils['diffTime'](utils[_0x6ceb('0x26')](),channels[_0x2b9d98[_0x6ceb('0x7')]]['musiconholdstartAt']);utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x2b9d98[_0x6ceb('0x7')],channels[_0x2b9d98[_0x6ceb('0x7')]][_0x6ceb('0x45')]));delete channels[_0x2b9d98[_0x6ceb('0x7')]][_0x6ceb('0x41')];}}}catch(_0xd7f821){utils[_0x6ceb('0x1f')](util['format'](_0x6ceb('0x44'),_0x2b9d98['uniqueid']),_0xd7f821);}};exports[_0x6ceb('0x46')]=function(_0xedfa67){try{if(!_['isNil'](channels[_0xedfa67['uniqueid']])){utils[_0x6ceb('0x21')](util[_0x6ceb('0xa')]('[%s][calls][varset]',_0xedfa67[_0x6ceb('0x7')]),_0xedfa67);if(!_[_0x6ceb('0x22')](_0xedfa67[_0x6ceb('0x47')][_0x6ceb('0x48')])){utils[_0x6ceb('0x9')](util['format'](_0x6ceb('0x49'),_0xedfa67[_0x6ceb('0x7')],_0xedfa67[_0x6ceb('0x4a')]));channels[_0xedfa67[_0x6ceb('0x7')]]['source']=_0xedfa67[_0x6ceb('0x4a')];}if(!_[_0x6ceb('0x22')](_0xedfa67[_0x6ceb('0x47')][_0x6ceb('0x4b')])){utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')](_0x6ceb('0x4c'),_0xedfa67[_0x6ceb('0x7')],_0xedfa67['value']));channels[_0xedfa67[_0x6ceb('0x7')]]['destination']=_0xedfa67[_0x6ceb('0x4a')];channels[_0xedfa67['uniqueid']][_0x6ceb('0x2f')]='\x22'+_0xedfa67[_0x6ceb('0x4a')]+_0x6ceb('0x4d')+_0xedfa67[_0x6ceb('0x4a')]+'>';}if(!_['isNil'](_0xedfa67[_0x6ceb('0x47')][_0x6ceb('0x4e')])||!_[_0x6ceb('0x22')](_0xedfa67[_0x6ceb('0x47')][_0x6ceb('0x4f')])){utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0xedfa67[_0x6ceb('0x7')],!_[_0x6ceb('0x22')](_0xedfa67['variable']['xmd-callerid-preview'])?_0x6ceb('0x4e'):'xmd-callerid',_0xedfa67[_0x6ceb('0x4a')]));channels[_0xedfa67[_0x6ceb('0x7')]][_0x6ceb('0x2f')]=_0xedfa67['value'];}if(!_[_0x6ceb('0x22')](_0xedfa67['variable'][_0x6ceb('0x50')])||!_[_0x6ceb('0x22')](_0xedfa67[_0x6ceb('0x47')][_0x6ceb('0x51')])){utils[_0x6ceb('0x9')](util['format'](_0x6ceb('0x52'),_0xedfa67[_0x6ceb('0x7')],!_[_0x6ceb('0x22')](_0xedfa67['variable'][_0x6ceb('0x50')])?_0x6ceb('0x50'):_0x6ceb('0x51'),_0xedfa67[_0x6ceb('0x4a')]));channels[_0xedfa67[_0x6ceb('0x7')]]['lastapplication']='Queue';channels[_0xedfa67[_0x6ceb('0x7')]][_0x6ceb('0x53')]=_0xedfa67[_0x6ceb('0x4a')];channels[_0xedfa67[_0x6ceb('0x7')]][_0x6ceb('0xd')]=!![];}if(!_['isNil'](_0xedfa67[_0x6ceb('0x47')][_0x6ceb('0x54')])){utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0xedfa67[_0x6ceb('0x7')],_0xedfa67['value']));channels[_0xedfa67[_0x6ceb('0x7')]]['ContactId']=_0xedfa67[_0x6ceb('0x4a')];}if(!_[_0x6ceb('0x22')](_0xedfa67[_0x6ceb('0x47')][_0x6ceb('0x55')])){utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')](_0x6ceb('0x56'),_0xedfa67[_0x6ceb('0x7')],_0xedfa67[_0x6ceb('0x4a')]));channels[_0xedfa67['uniqueid']][_0x6ceb('0x57')]=_0xedfa67[_0x6ceb('0x4a')];}if(!_[_0x6ceb('0x22')](_0xedfa67[_0x6ceb('0x47')][_0x6ceb('0x58')])){utils[_0x6ceb('0x9')](util['format']('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0xedfa67['uniqueid'],_0xedfa67[_0x6ceb('0x4a')]));channels[_0xedfa67[_0x6ceb('0x7')]][_0x6ceb('0x59')]=_0xedfa67[_0x6ceb('0x4a')];}if(!_['isNil'](_0xedfa67[_0x6ceb('0x47')][_0x6ceb('0x5a')])){utils[_0x6ceb('0x9')](util[_0x6ceb('0xa')](_0x6ceb('0x5b'),_0xedfa67[_0x6ceb('0x7')],_0xedfa67[_0x6ceb('0x4a')]));channels[_0xedfa67[_0x6ceb('0x7')]][_0x6ceb('0x5a')]=_0xedfa67['value'];}}}catch(_0xfeccba){utils[_0x6ceb('0x1f')](util[_0x6ceb('0xa')](_0x6ceb('0x5c'),_0xedfa67[_0x6ceb('0x7')]),_0xfeccba);}};exports[_0x6ceb('0x5d')]=function(_0xa83618){try{if(!_[_0x6ceb('0x22')](channels[_0xa83618[_0x6ceb('0x7')]])){utils[_0x6ceb('0x21')](util[_0x6ceb('0xa')]('[%s][calls][newexten]',_0xa83618[_0x6ceb('0x7')]),_0xa83618);utils['info'](util[_0x6ceb('0xa')](_0x6ceb('0x5e'),_0xa83618[_0x6ceb('0x7')],_0xa83618['application'],_0xa83618[_0x6ceb('0x5f')]));if(_0xa83618[_0x6ceb('0x60')][_0x6ceb('0x61')]()=='set'&&_[_0x6ceb('0x62')](_0xa83618[_0x6ceb('0x5f')][_0x6ceb('0x61')](),_0x6ceb('0x63'))){var _0x59fba0=_0xa83618[_0x6ceb('0x5f')][_0x6ceb('0x64')]('=');var _0x506fe=_0x59fba0[0x0][_0x6ceb('0x65')](_0x59fba0[0x0][_0x6ceb('0x66')]('(')+0x1,_0x59fba0[0x0][_0x6ceb('0x66')](')'));var _0x37506e=_0x59fba0[0x1];channels[_0xa83618['uniqueid']][_0x506fe]=_0x37506e;}if(!_['includes']([_0x6ceb('0x2d'),_0x6ceb('0x67'),_0x6ceb('0x68'),'set','gotoif'],_0xa83618[_0x6ceb('0x60')][_0x6ceb('0x61')]())){channels[_0xa83618['uniqueid']]['lastapplication']=_0xa83618[_0x6ceb('0x60')];channels[_0xa83618[_0x6ceb('0x7')]][_0x6ceb('0x53')]=_0xa83618[_0x6ceb('0x5f')];}}}catch(_0xdf3ec1){utils[_0x6ceb('0x1f')](util[_0x6ceb('0xa')](_0x6ceb('0x69'),_0xa83618[_0x6ceb('0x7')]),_0xdf3ec1);}}; \ No newline at end of file +var _0x0fa0=['noop','execif','gotoif','lastapplication','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','info','format','channel','queue','membername','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','newstate','channelstate','systemanswertime','isNil','transfer','linkedid','destinationchannel','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','diffTime','starttime','billableseconds','answertime','attendedtransfer','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','origtransfererchannel','userfield','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][calls][musiconholdstart]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','xmd-phone','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','substring','lastIndexOf','includes'];(function(_0x60290f,_0x1da37a){var _0x38eaa0=function(_0x596744){while(--_0x596744){_0x60290f['push'](_0x60290f['shift']());}};_0x38eaa0(++_0x1da37a);}(_0x0fa0,0x6f));var _0x00fa=function(_0x434c03,_0x3f1d43){_0x434c03=_0x434c03-0x0;var _0x259604=_0x0fa0[_0x434c03];return _0x259604;};'use strict';var _=require(_0x00fa('0x0'));var util=require(_0x00fa('0x1'));var utils=require(_0x00fa('0x2'));var transfers=require(_0x00fa('0x3'));var dispositions=[_0x00fa('0x4'),_0x00fa('0x5'),_0x00fa('0x5'),_0x00fa('0x4'),_0x00fa('0x4'),'NO\x20ANSWER',_0x00fa('0x6'),_0x00fa('0x7'),_0x00fa('0x5'),_0x00fa('0x5'),'FAILED'];var channels={};function writeDB(_0xd46f19){var _0x230269;if(transfers[_0x00fa('0x8')][_0xd46f19[_0x00fa('0x9')]]){_0x230269=_0xd46f19['uniqueid'];_0xd46f19[_0x00fa('0x9')]=transfers[_0x00fa('0x8')][_0xd46f19[_0x00fa('0x9')]]['transfereeuniqueid'];}utils[_0x00fa('0xa')](util[_0x00fa('0xb')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0xd46f19[_0x00fa('0x9')],_0xd46f19[_0x00fa('0xc')],_0xd46f19[_0x00fa('0xd')],_0xd46f19[_0x00fa('0xe')],_0xd46f19['interface'],_0xd46f19[_0x00fa('0xf')],_0xd46f19[_0x00fa('0x10')],_0xd46f19[_0x00fa('0x11')]));if(_0xd46f19[_0x00fa('0x12')]){utils[_0x00fa('0x13')](_0xd46f19[_0x00fa('0x12')])[_0x00fa('0x14')](function(_0x217f75){if(_0x217f75){_0xd46f19['UserId']=_0x217f75['id'];}utils[_0x00fa('0x15')](_0x00fa('0x16'),_0xd46f19);});}else{utils[_0x00fa('0x15')](_0x00fa('0x16'),_0xd46f19);}if(channels[_0xd46f19['uniqueid']]){delete channels[_0xd46f19[_0x00fa('0x9')]];}else if(_0x230269&&channels[_0x230269]){delete transfers[_0x00fa('0x8')][_0x230269];delete channels[_0x230269];}}exports[_0x00fa('0x17')]=function(_0xef0d14){try{utils[_0x00fa('0x18')](util[_0x00fa('0xb')](_0x00fa('0x19'),_0xef0d14['uniqueid']),_0xef0d14);if(_0xef0d14[_0x00fa('0x9')]==_0xef0d14['linkedid']&&_0xef0d14[_0x00fa('0xc')]!=_0x00fa('0x1a')){utils[_0x00fa('0xa')](util[_0x00fa('0xb')](_0x00fa('0x1b'),_0xef0d14[_0x00fa('0x9')],_0xef0d14[_0x00fa('0x1c')],_0xef0d14[_0x00fa('0x1d')]));channels[_0xef0d14[_0x00fa('0x9')]]={'uniqueid':_0xef0d14[_0x00fa('0x9')],'accountcode':_0xef0d14[_0x00fa('0x12')],'source':_0xef0d14[_0x00fa('0xf')],'destination':_0xef0d14[_0x00fa('0x1d')],'destinationcontext':_0xef0d14['context'],'channel':_0xef0d14['channel'],'starttime':utils[_0x00fa('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x00fa('0x4'),'amaflags':_0x00fa('0x1f')};}}catch(_0x429b59){utils[_0x00fa('0x20')](util[_0x00fa('0xb')](_0x00fa('0x19'),_0xef0d14[_0x00fa('0x9')]),_0x429b59);}};exports[_0x00fa('0x21')]=function(_0x549852){try{utils[_0x00fa('0x18')](util[_0x00fa('0xb')]('[%s][calls][newstate]',_0x549852[_0x00fa('0x9')]),_0x549852);if(!_['isNil'](channels[_0x549852[_0x00fa('0x9')]])&&_0x549852[_0x00fa('0x22')]==0x6){utils[_0x00fa('0xa')](util[_0x00fa('0xb')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x549852[_0x00fa('0x9')],_0x549852[_0x00fa('0x1c')],_0x549852[_0x00fa('0xc')]));if(_['isNil'](channels[_0x549852[_0x00fa('0x9')]][_0x00fa('0x23')])){channels[_0x549852[_0x00fa('0x9')]]['systemanswertime']=utils[_0x00fa('0x1e')]();}}else if(!_[_0x00fa('0x24')](channels[_0x549852['linkedid']])&&_0x549852[_0x00fa('0x22')]==0x6&&_0x549852[_0x00fa('0x1c')]!=_0x00fa('0x25')){utils['info'](util[_0x00fa('0xb')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x549852[_0x00fa('0x9')],_0x549852[_0x00fa('0x26')],_0x549852['context'],_0x549852['channel']));channels[_0x549852[_0x00fa('0x26')]][_0x00fa('0x12')]=_0x549852[_0x00fa('0x12')];channels[_0x549852[_0x00fa('0x26')]][_0x00fa('0x27')]=_0x549852['channel'];if(_[_0x00fa('0x24')](channels[_0x549852[_0x00fa('0x26')]]['answertime'])){channels[_0x549852[_0x00fa('0x26')]]['answertime']=utils['now']();}channels[_0x549852[_0x00fa('0x26')]][_0x00fa('0x28')]=dispositions[_[_0x00fa('0x29')](_0x549852[_0x00fa('0x22')])]||'ANSWERED';}}catch(_0x525a7b){utils[_0x00fa('0x20')](util[_0x00fa('0xb')]('[%s][calls][newstate]',_0x549852[_0x00fa('0x9')]),_0x525a7b);}};exports[_0x00fa('0x2a')]=function(_0x400954){try{if(!_[_0x00fa('0x24')](channels[_0x400954['uniqueid']])){utils[_0x00fa('0x18')](util[_0x00fa('0xb')](_0x00fa('0x2b'),_0x400954[_0x00fa('0x9')]),_0x400954);if(_[_0x00fa('0x24')](channels[_0x400954[_0x00fa('0x9')]][_0x00fa('0x2c')])){channels[_0x400954['uniqueid']]['callerid']=_0x400954[_0x00fa('0x2d')]+'\x20<'+_0x400954[_0x00fa('0xf')]+'>';}utils[_0x00fa('0xa')](util[_0x00fa('0xb')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x400954['uniqueid'],channels[_0x400954[_0x00fa('0x9')]][_0x00fa('0x2c')],_0x400954[_0x00fa('0x2e')]));channels[_0x400954[_0x00fa('0x9')]][_0x00fa('0x2f')]=utils['now']();channels[_0x400954['uniqueid']]['duration']=utils[_0x00fa('0x30')](channels[_0x400954[_0x00fa('0x9')]]['endtime'],channels[_0x400954[_0x00fa('0x9')]][_0x00fa('0x31')]);channels[_0x400954[_0x00fa('0x9')]][_0x00fa('0x32')]=channels[_0x400954['uniqueid']][_0x00fa('0x33')]?utils[_0x00fa('0x30')](channels[_0x400954[_0x00fa('0x9')]][_0x00fa('0x2f')],channels[_0x400954[_0x00fa('0x9')]][_0x00fa('0x33')]):0x0;writeDB(channels[_0x400954[_0x00fa('0x9')]]);}}catch(_0x4aca81){utils[_0x00fa('0x20')](util[_0x00fa('0xb')](_0x00fa('0x2b'),_0x400954[_0x00fa('0x9')]),_0x4aca81);}};exports[_0x00fa('0x34')]=function(_0x558b1c){try{if(!_['isNil'](channels[_0x558b1c['localtwolinkedid']])){utils[_0x00fa('0x18')](util['format']('[%s][calls][attendedtransfer]',_0x558b1c[_0x00fa('0x35')]),_0x558b1c);if(channels[_0x558b1c[_0x00fa('0x36')]][_0x00fa('0xc')]==_0x558b1c[_0x00fa('0x37')]){utils[_0x00fa('0xa')](util[_0x00fa('0xb')](_0x00fa('0x38'),_0x558b1c[_0x00fa('0x35')],_0x558b1c['localtwolinkedid'],_0x558b1c[_0x00fa('0x39')]));channels[_0x558b1c[_0x00fa('0x36')]][_0x00fa('0x27')]=_0x558b1c[_0x00fa('0x39')];channels[_0x558b1c[_0x00fa('0x36')]]['userfield']=_0x00fa('0x3a');}else if(channels[_0x558b1c['localtwolinkedid']]['channel']=_0x558b1c['transfertargetchannel']){utils[_0x00fa('0xa')](util[_0x00fa('0xb')](_0x00fa('0x38'),_0x558b1c[_0x00fa('0x35')],_0x558b1c[_0x00fa('0x36')],_0x558b1c[_0x00fa('0x3b')]));channels[_0x558b1c[_0x00fa('0x36')]][_0x00fa('0x27')]=_0x558b1c['origtransfererchannel'];channels[_0x558b1c[_0x00fa('0x36')]][_0x00fa('0x3c')]=_0x00fa('0x3a');}}}catch(_0x59f15d){utils[_0x00fa('0x20')](util[_0x00fa('0xb')](_0x00fa('0x3d'),_0x558b1c[_0x00fa('0x35')]),_0x59f15d);}};exports[_0x00fa('0x3e')]=function(_0x30651b){try{if(!_[_0x00fa('0x24')](channels[_0x30651b['uniqueid']])){utils[_0x00fa('0x18')](util['format']('[%s][calls][musiconholdstart]',_0x30651b[_0x00fa('0x9')]),_0x30651b);channels[_0x30651b['uniqueid']]['musiconholdstartAt']=utils[_0x00fa('0x1e')]();utils[_0x00fa('0xa')](util[_0x00fa('0xb')](_0x00fa('0x3f'),_0x30651b[_0x00fa('0x9')],channels[_0x30651b[_0x00fa('0x9')]][_0x00fa('0x40')]));}}catch(_0x3afe5d){utils['error'](util['format'](_0x00fa('0x41'),_0x30651b[_0x00fa('0x9')]),_0x3afe5d);}};exports['musiconholdstop']=function(_0x4c7657){try{if(!_['isNil'](channels[_0x4c7657[_0x00fa('0x9')]])){utils[_0x00fa('0x18')](util[_0x00fa('0xb')]('[%s][calls][musiconholdstop]',_0x4c7657[_0x00fa('0x9')]),_0x4c7657);if(!_[_0x00fa('0x24')](channels[_0x4c7657[_0x00fa('0x9')]][_0x00fa('0x40')])){channels[_0x4c7657[_0x00fa('0x9')]][_0x00fa('0x42')]+=utils['diffTime'](utils[_0x00fa('0x1e')](),channels[_0x4c7657[_0x00fa('0x9')]]['musiconholdstartAt']);utils[_0x00fa('0xa')](util[_0x00fa('0xb')](_0x00fa('0x43'),_0x4c7657['uniqueid'],channels[_0x4c7657['uniqueid']]['mohtime']));delete channels[_0x4c7657['uniqueid']]['musiconholdstartAt'];}}}catch(_0xd1f2a3){utils['error'](util[_0x00fa('0xb')](_0x00fa('0x44'),_0x4c7657[_0x00fa('0x9')]),_0xd1f2a3);}};exports['varset']=function(_0x2f3759){try{if(!_['isNil'](channels[_0x2f3759[_0x00fa('0x9')]])){utils['debug'](util[_0x00fa('0xb')](_0x00fa('0x45'),_0x2f3759['uniqueid']),_0x2f3759);if(!_[_0x00fa('0x24')](_0x2f3759[_0x00fa('0x46')][_0x00fa('0x47')])){utils[_0x00fa('0xa')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x2f3759[_0x00fa('0x9')],_0x2f3759[_0x00fa('0x48')]));channels[_0x2f3759[_0x00fa('0x9')]][_0x00fa('0x49')]=_0x2f3759['value'];}if(!_[_0x00fa('0x24')](_0x2f3759['variable'][_0x00fa('0x4a')])){utils[_0x00fa('0xa')](util[_0x00fa('0xb')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x2f3759[_0x00fa('0x9')],_0x2f3759['value']));channels[_0x2f3759[_0x00fa('0x9')]][_0x00fa('0x4b')]=_0x2f3759[_0x00fa('0x48')];channels[_0x2f3759[_0x00fa('0x9')]]['callerid']='\x22'+_0x2f3759[_0x00fa('0x48')]+'\x22\x20<'+_0x2f3759[_0x00fa('0x48')]+'>';}if(!_[_0x00fa('0x24')](_0x2f3759[_0x00fa('0x46')][_0x00fa('0x4c')])||!_['isNil'](_0x2f3759['variable'][_0x00fa('0x4d')])){utils[_0x00fa('0xa')](util[_0x00fa('0xb')](_0x00fa('0x4e'),_0x2f3759[_0x00fa('0x9')],!_[_0x00fa('0x24')](_0x2f3759[_0x00fa('0x46')][_0x00fa('0x4c')])?_0x00fa('0x4c'):_0x00fa('0x4d'),_0x2f3759[_0x00fa('0x48')]));channels[_0x2f3759[_0x00fa('0x9')]][_0x00fa('0x2c')]=_0x2f3759['value'];}if(!_[_0x00fa('0x24')](_0x2f3759[_0x00fa('0x46')][_0x00fa('0x4f')])||!_[_0x00fa('0x24')](_0x2f3759[_0x00fa('0x46')]['xmcs-queue'])){utils[_0x00fa('0xa')](util['format'](_0x00fa('0x4e'),_0x2f3759[_0x00fa('0x9')],!_['isNil'](_0x2f3759['variable'][_0x00fa('0x4f')])?_0x00fa('0x4f'):_0x00fa('0x50'),_0x2f3759[_0x00fa('0x48')]));channels[_0x2f3759[_0x00fa('0x9')]]['lastapplication']=_0x00fa('0x51');channels[_0x2f3759['uniqueid']][_0x00fa('0x52')]=_0x2f3759[_0x00fa('0x48')];channels[_0x2f3759['uniqueid']][_0x00fa('0xd')]=!![];}if(!_[_0x00fa('0x24')](_0x2f3759[_0x00fa('0x46')][_0x00fa('0x53')])){utils[_0x00fa('0xa')](util[_0x00fa('0xb')](_0x00fa('0x54'),_0x2f3759[_0x00fa('0x9')],_0x2f3759['value']));channels[_0x2f3759[_0x00fa('0x9')]][_0x00fa('0x55')]=_0x2f3759[_0x00fa('0x48')];}if(!_['isNil'](_0x2f3759[_0x00fa('0x46')][_0x00fa('0x56')])){utils[_0x00fa('0xa')](util[_0x00fa('0xb')](_0x00fa('0x57'),_0x2f3759['uniqueid'],_0x2f3759[_0x00fa('0x48')]));channels[_0x2f3759[_0x00fa('0x9')]]['type']=_0x2f3759[_0x00fa('0x48')];}if(!_[_0x00fa('0x24')](_0x2f3759[_0x00fa('0x46')][_0x00fa('0x58')])){utils[_0x00fa('0xa')](util[_0x00fa('0xb')](_0x00fa('0x59'),_0x2f3759[_0x00fa('0x9')],_0x2f3759[_0x00fa('0x48')]));channels[_0x2f3759['uniqueid']]['routeid']=_0x2f3759[_0x00fa('0x48')];}if(!_[_0x00fa('0x24')](_0x2f3759[_0x00fa('0x46')][_0x00fa('0x5a')])){utils[_0x00fa('0xa')](util['format'](_0x00fa('0x5b'),_0x2f3759['uniqueid'],_0x2f3759['value']));channels[_0x2f3759[_0x00fa('0x9')]][_0x00fa('0x5a')]=_0x2f3759[_0x00fa('0x48')];}}}catch(_0x26f6dc){utils['error'](util['format'](_0x00fa('0x45'),_0x2f3759[_0x00fa('0x9')]),_0x26f6dc);}};exports[_0x00fa('0x5c')]=function(_0x662b6){try{if(!_[_0x00fa('0x24')](channels[_0x662b6[_0x00fa('0x9')]])){utils[_0x00fa('0x18')](util[_0x00fa('0xb')](_0x00fa('0x5d'),_0x662b6['uniqueid']),_0x662b6);utils['info'](util[_0x00fa('0xb')](_0x00fa('0x5e'),_0x662b6['uniqueid'],_0x662b6[_0x00fa('0x5f')],_0x662b6[_0x00fa('0x60')]));if(_0x662b6[_0x00fa('0x5f')][_0x00fa('0x61')]()==_0x00fa('0x62')&&_['startsWith'](_0x662b6[_0x00fa('0x60')]['toLowerCase'](),_0x00fa('0x63'))){var _0x3b318b=_0x662b6[_0x00fa('0x60')]['split']('=');var _0x10b31c=_0x3b318b[0x0][_0x00fa('0x64')](_0x3b318b[0x0][_0x00fa('0x65')]('(')+0x1,_0x3b318b[0x0][_0x00fa('0x65')](')'));var _0x21a1ff=_0x3b318b[0x1];channels[_0x662b6[_0x00fa('0x9')]][_0x10b31c]=_0x21a1ff;}if(!_[_0x00fa('0x66')]([_0x00fa('0x2a'),_0x00fa('0x67'),_0x00fa('0x68'),_0x00fa('0x62'),_0x00fa('0x69')],_0x662b6['application'][_0x00fa('0x61')]())){channels[_0x662b6['uniqueid']][_0x00fa('0x6a')]=_0x662b6[_0x00fa('0x5f')];channels[_0x662b6[_0x00fa('0x9')]][_0x00fa('0x52')]=_0x662b6[_0x00fa('0x60')];}}}catch(_0x30066e){utils['error'](util['format'](_0x00fa('0x5d'),_0x662b6['uniqueid']),_0x30066e);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index b9eafc2..a50708c 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 _0x771d=['[core]\x20connected','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','[core]\x20close','managerevent','./utils','connect','info'];(function(_0x3e99cb,_0x1d2fe0){var _0x1bc729=function(_0x40006f){while(--_0x40006f){_0x3e99cb['push'](_0x3e99cb['shift']());}};_0x1bc729(++_0x1d2fe0);}(_0x771d,0xd5));var _0xd771=function(_0x3eaece,_0x486dc6){_0x3eaece=_0x3eaece-0x0;var _0x55ef74=_0x771d[_0x3eaece];return _0x55ef74;};'use strict';var utils=require(_0xd771('0x0'));exports[_0xd771('0x1')]=function(){utils[_0xd771('0x2')](_0xd771('0x3'));};exports[_0xd771('0x4')]=function(){utils[_0xd771('0x2')](_0xd771('0x5'));};exports[_0xd771('0x6')]=function(){utils[_0xd771('0x2')](_0xd771('0x7'));};exports[_0xd771('0x8')]=function(_0x4b4973){utils['error'](_0xd771('0x9'),_0x4b4973);};exports['close']=function(){utils[_0xd771('0x2')](_0xd771('0xa'));};exports[_0xd771('0xb')]=function(_0xcd66d9){}; \ No newline at end of file +var _0x51ed=['fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','managerevent','./utils','connect','info','[core]\x20connected','shutdown'];(function(_0x201a7a,_0x3b199b){var _0x44170a=function(_0x35425b){while(--_0x35425b){_0x201a7a['push'](_0x201a7a['shift']());}};_0x44170a(++_0x3b199b);}(_0x51ed,0x12f));var _0xd51e=function(_0x5db32d,_0x2849c6){_0x5db32d=_0x5db32d-0x0;var _0x2d4d9d=_0x51ed[_0x5db32d];return _0x2d4d9d;};'use strict';var utils=require(_0xd51e('0x0'));exports[_0xd51e('0x1')]=function(){utils[_0xd51e('0x2')](_0xd51e('0x3'));};exports[_0xd51e('0x4')]=function(){utils[_0xd51e('0x2')]('[core]\x20shutdown');};exports[_0xd51e('0x5')]=function(){utils['info'](_0xd51e('0x6'));};exports[_0xd51e('0x7')]=function(_0x148a90){utils['error'](_0xd51e('0x8'),_0x148a90);};exports[_0xd51e('0x9')]=function(){utils[_0xd51e('0x2')]('[core]\x20close');};exports[_0xd51e('0xa')]=function(_0x8bc693){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 1fa10d4..496b610 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 _0x5d32=['connectedlinenum','request','CreateVoiceDialReport','uniqueid','newexten','[%s][dials][newexten]','application','toLowerCase','appdata','cdr(routeid)','error','debug','[%s][dials][varset]','isNil','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','ANSWER','answertime','now','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','endtime','holdtime','diffTime','billableseconds','util','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum'];(function(_0x348b29,_0x3be5e9){var _0xc260c5=function(_0x568363){while(--_0x568363){_0x348b29['push'](_0x348b29['shift']());}};_0xc260c5(++_0x3be5e9);}(_0x5d32,0xbd));var _0x25d3=function(_0x2d364e,_0x301c5e){_0x2d364e=_0x2d364e-0x0;var _0x1b9312=_0x5d32[_0x2d364e];return _0x1b9312;};'use strict';var _=require('lodash');var util=require(_0x25d3('0x0'));var utils=require('./utils');var dials={};function writeDB(_0x41b342){utils[_0x25d3('0x1')](util[_0x25d3('0x2')](_0x25d3('0x3'),_0x41b342['uniqueid'],_0x41b342[_0x25d3('0x4')],_0x41b342[_0x25d3('0x5')],_0x41b342[_0x25d3('0x6')],_0x41b342[_0x25d3('0x7')],_0x41b342['dialstatus']));utils[_0x25d3('0x8')](_0x25d3('0x9'),_0x41b342);delete dials[_0x41b342[_0x25d3('0xa')]];}exports[_0x25d3('0xb')]=function(_0xe6294a){try{utils['debug'](util['format'](_0x25d3('0xc'),_0xe6294a['uniqueid']),_0xe6294a);utils[_0x25d3('0x1')](util[_0x25d3('0x2')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0xe6294a['uniqueid'],_0xe6294a['application'],_0xe6294a['appdata']));if(_0xe6294a[_0x25d3('0xd')][_0x25d3('0xe')]()=='set'&&_['startsWith'](_0xe6294a[_0x25d3('0xf')]['toLowerCase'](),_0x25d3('0x10'))){var _0x427c2b=_0xe6294a[_0x25d3('0xf')]['split']('=');dials[_0xe6294a[_0x25d3('0xa')]]={'routeId':_0x427c2b[0x1]};}}catch(_0x2dccb2){utils[_0x25d3('0x11')](util['format'](_0x25d3('0xc'),_0xe6294a[_0x25d3('0xa')]),_0x2dccb2);}};exports['varset']=function(_0x12572b){try{utils[_0x25d3('0x12')](util[_0x25d3('0x2')](_0x25d3('0x13'),_0x12572b[_0x25d3('0xa')]),_0x12572b);if(!_[_0x25d3('0x14')](_0x12572b['variable'][_0x25d3('0x15')])){utils[_0x25d3('0x1')](util[_0x25d3('0x2')](_0x25d3('0x16'),_0x12572b[_0x25d3('0xa')],_0x12572b[_0x25d3('0x17')]));dials[_0x12572b[_0x25d3('0xa')]]={'routeId':_0x12572b[_0x25d3('0x17')]};}}catch(_0x47ba6c){utils[_0x25d3('0x11')](util[_0x25d3('0x2')](_0x25d3('0x13'),_0x12572b[_0x25d3('0xa')]),_0x47ba6c);}};exports[_0x25d3('0x18')]=function(_0x25ba7a){try{if(!_[_0x25d3('0x14')](dials[_0x25ba7a[_0x25d3('0xa')]])){utils[_0x25d3('0x12')](util[_0x25d3('0x2')](_0x25d3('0x19'),_0x25ba7a['uniqueid']),_0x25ba7a);dials[_0x25ba7a[_0x25d3('0xa')]]=_[_0x25d3('0x1a')](dials[_0x25ba7a[_0x25d3('0xa')]],_0x25ba7a);dials[_0x25ba7a[_0x25d3('0xa')]][_0x25d3('0x1b')]=utils['now']();dials[_0x25ba7a[_0x25d3('0xa')]]['lastevent']='called';utils[_0x25d3('0x1')](util['format'](_0x25d3('0x1c'),_0x25ba7a[_0x25d3('0xa')],dials[_0x25ba7a[_0x25d3('0xa')]][_0x25d3('0x1b')]));}}catch(_0x540927){utils['error'](util['format'](_0x25d3('0x19'),_0x25ba7a[_0x25d3('0xa')]),_0x540927);}};exports[_0x25d3('0x1d')]=function(_0x54d953){try{if(!_[_0x25d3('0x14')](dials[_0x54d953['uniqueid']])){utils[_0x25d3('0x12')](util[_0x25d3('0x2')](_0x25d3('0x1e'),_0x54d953[_0x25d3('0xa')]),_0x54d953);dials[_0x54d953['uniqueid']][_0x25d3('0x1f')]=_0x54d953[_0x25d3('0x1f')];if(_0x54d953[_0x25d3('0x1f')]==_0x25d3('0x20')){dials[_0x54d953[_0x25d3('0xa')]]=_[_0x25d3('0x1a')](dials[_0x54d953[_0x25d3('0xa')]],_0x54d953);dials[_0x54d953['uniqueid']][_0x25d3('0x21')]=utils[_0x25d3('0x22')]();dials[_0x54d953[_0x25d3('0xa')]][_0x25d3('0x23')]=_0x25d3('0x24');utils['info'](util[_0x25d3('0x2')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x54d953[_0x25d3('0xa')],_0x54d953['dialstatus'],dials[_0x54d953[_0x25d3('0xa')]]['answertime']));}else{utils[_0x25d3('0x1')](util[_0x25d3('0x2')](_0x25d3('0x25'),_0x54d953[_0x25d3('0xa')],_0x54d953['dialstatus']));}}}catch(_0xf21b01){utils[_0x25d3('0x11')](util[_0x25d3('0x2')](_0x25d3('0x1e'),_0x54d953[_0x25d3('0xa')]),_0xf21b01);}};exports[_0x25d3('0x26')]=function(_0x4ee542){try{if(!_[_0x25d3('0x14')](dials[_0x4ee542[_0x25d3('0xa')]])){utils[_0x25d3('0x12')](util[_0x25d3('0x2')](_0x25d3('0x27'),_0x4ee542[_0x25d3('0xa')]),_0x4ee542);utils[_0x25d3('0x1')](util[_0x25d3('0x2')](_0x25d3('0x28'),_0x4ee542[_0x25d3('0xa')],_0x4ee542[_0x25d3('0x6')],_0x4ee542[_0x25d3('0x29')],_0x4ee542[_0x25d3('0x2a')]));dials[_0x4ee542[_0x25d3('0xa')]]=_[_0x25d3('0x1a')](dials[_0x4ee542[_0x25d3('0xa')]],{'endtime':utils[_0x25d3('0x22')](),'lastevent':_0x25d3('0x2b')});dials[_0x4ee542[_0x25d3('0xa')]][_0x25d3('0x2c')]=utils['diffTime'](dials[_0x4ee542['uniqueid']][_0x25d3('0x2d')],dials[_0x4ee542[_0x25d3('0xa')]]['starttime']);dials[_0x4ee542[_0x25d3('0xa')]][_0x25d3('0x2e')]=utils[_0x25d3('0x2f')](dials[_0x4ee542[_0x25d3('0xa')]][_0x25d3('0x21')]||dials[_0x4ee542['uniqueid']][_0x25d3('0x2d')],dials[_0x4ee542[_0x25d3('0xa')]][_0x25d3('0x1b')]);dials[_0x4ee542[_0x25d3('0xa')]][_0x25d3('0x30')]=dials[_0x4ee542[_0x25d3('0xa')]]['answertime']?utils[_0x25d3('0x2f')](dials[_0x4ee542[_0x25d3('0xa')]][_0x25d3('0x2d')],dials[_0x4ee542['uniqueid']]['answertime']):0x0;writeDB(dials[_0x4ee542[_0x25d3('0xa')]]);}}catch(_0x36d032){utils[_0x25d3('0x11')](util[_0x25d3('0x2')](_0x25d3('0x27'),_0x4ee542[_0x25d3('0xa')]),_0x36d032);}}; \ No newline at end of file +var _0xb364=['endtime','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','request','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','startsWith','appdata','cdr(routeid)','error','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','calleridname','cause-txt','complete','duration','diffTime','billableseconds'];(function(_0x103855,_0x58de6a){var _0x527eb0=function(_0x433c3a){while(--_0x433c3a){_0x103855['push'](_0x103855['shift']());}};_0x527eb0(++_0x58de6a);}(_0xb364,0x191));var _0x4b36=function(_0x494ba8,_0x4d2fa4){_0x494ba8=_0x494ba8-0x0;var _0x1bdc22=_0xb364[_0x494ba8];return _0x1bdc22;};'use strict';var _=require(_0x4b36('0x0'));var util=require(_0x4b36('0x1'));var utils=require(_0x4b36('0x2'));var dials={};function writeDB(_0x27f4b7){utils[_0x4b36('0x3')](util[_0x4b36('0x4')](_0x4b36('0x5'),_0x27f4b7[_0x4b36('0x6')],_0x27f4b7['channel'],_0x27f4b7[_0x4b36('0x7')],_0x27f4b7[_0x4b36('0x8')],_0x27f4b7[_0x4b36('0x9')],_0x27f4b7[_0x4b36('0xa')]));utils[_0x4b36('0xb')]('CreateVoiceDialReport',_0x27f4b7);delete dials[_0x27f4b7[_0x4b36('0x6')]];}exports[_0x4b36('0xc')]=function(_0x49b2a7){try{utils[_0x4b36('0xd')](util[_0x4b36('0x4')](_0x4b36('0xe'),_0x49b2a7[_0x4b36('0x6')]),_0x49b2a7);utils[_0x4b36('0x3')](util[_0x4b36('0x4')](_0x4b36('0xf'),_0x49b2a7[_0x4b36('0x6')],_0x49b2a7[_0x4b36('0x10')],_0x49b2a7['appdata']));if(_0x49b2a7['application'][_0x4b36('0x11')]()=='set'&&_[_0x4b36('0x12')](_0x49b2a7[_0x4b36('0x13')][_0x4b36('0x11')](),_0x4b36('0x14'))){var _0x3fedb1=_0x49b2a7[_0x4b36('0x13')]['split']('=');dials[_0x49b2a7[_0x4b36('0x6')]]={'routeId':_0x3fedb1[0x1]};}}catch(_0xabffcb){utils[_0x4b36('0x15')](util[_0x4b36('0x4')](_0x4b36('0xe'),_0x49b2a7[_0x4b36('0x6')]),_0xabffcb);}};exports[_0x4b36('0x16')]=function(_0xc6f15){try{utils[_0x4b36('0xd')](util['format'](_0x4b36('0x17'),_0xc6f15[_0x4b36('0x6')]),_0xc6f15);if(!_[_0x4b36('0x18')](_0xc6f15[_0x4b36('0x19')][_0x4b36('0x1a')])){utils['info'](util[_0x4b36('0x4')](_0x4b36('0x1b'),_0xc6f15[_0x4b36('0x6')],_0xc6f15[_0x4b36('0x1c')]));dials[_0xc6f15[_0x4b36('0x6')]]={'routeId':_0xc6f15['value']};}}catch(_0x47d46d){utils[_0x4b36('0x15')](util['format'](_0x4b36('0x17'),_0xc6f15[_0x4b36('0x6')]),_0x47d46d);}};exports['dialbegin']=function(_0x48ffc9){try{if(!_[_0x4b36('0x18')](dials[_0x48ffc9[_0x4b36('0x6')]])){utils[_0x4b36('0xd')](util[_0x4b36('0x4')](_0x4b36('0x1d'),_0x48ffc9[_0x4b36('0x6')]),_0x48ffc9);dials[_0x48ffc9['uniqueid']]=_[_0x4b36('0x1e')](dials[_0x48ffc9[_0x4b36('0x6')]],_0x48ffc9);dials[_0x48ffc9[_0x4b36('0x6')]][_0x4b36('0x1f')]=utils[_0x4b36('0x20')]();dials[_0x48ffc9[_0x4b36('0x6')]][_0x4b36('0x21')]=_0x4b36('0x22');utils['info'](util['format'](_0x4b36('0x23'),_0x48ffc9[_0x4b36('0x6')],dials[_0x48ffc9['uniqueid']][_0x4b36('0x1f')]));}}catch(_0x13e67b){utils[_0x4b36('0x15')](util['format']('[%s][dials][dialbegin]',_0x48ffc9[_0x4b36('0x6')]),_0x13e67b);}};exports['dialend']=function(_0x510ec7){try{if(!_[_0x4b36('0x18')](dials[_0x510ec7[_0x4b36('0x6')]])){utils['debug'](util[_0x4b36('0x4')](_0x4b36('0x24'),_0x510ec7[_0x4b36('0x6')]),_0x510ec7);dials[_0x510ec7[_0x4b36('0x6')]]['dialstatus']=_0x510ec7[_0x4b36('0xa')];if(_0x510ec7[_0x4b36('0xa')]==_0x4b36('0x25')){dials[_0x510ec7[_0x4b36('0x6')]]=_[_0x4b36('0x1e')](dials[_0x510ec7['uniqueid']],_0x510ec7);dials[_0x510ec7[_0x4b36('0x6')]][_0x4b36('0x26')]=utils['now']();dials[_0x510ec7[_0x4b36('0x6')]][_0x4b36('0x21')]=_0x4b36('0x27');utils['info'](util['format']('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x510ec7['uniqueid'],_0x510ec7[_0x4b36('0xa')],dials[_0x510ec7[_0x4b36('0x6')]][_0x4b36('0x26')]));}else{utils[_0x4b36('0x3')](util['format'](_0x4b36('0x28'),_0x510ec7[_0x4b36('0x6')],_0x510ec7['dialstatus']));}}}catch(_0x37c647){utils[_0x4b36('0x15')](util['format'](_0x4b36('0x24'),_0x510ec7[_0x4b36('0x6')]),_0x37c647);}};exports[_0x4b36('0x29')]=function(_0x488244){try{if(!_['isNil'](dials[_0x488244[_0x4b36('0x6')]])){utils[_0x4b36('0xd')](util[_0x4b36('0x4')](_0x4b36('0x2a'),_0x488244[_0x4b36('0x6')]),_0x488244);utils[_0x4b36('0x3')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x488244['uniqueid'],_0x488244['calleridnum'],_0x488244[_0x4b36('0x2b')],_0x488244[_0x4b36('0x2c')]));dials[_0x488244['uniqueid']]=_[_0x4b36('0x1e')](dials[_0x488244[_0x4b36('0x6')]],{'endtime':utils[_0x4b36('0x20')](),'lastevent':_0x4b36('0x2d')});dials[_0x488244[_0x4b36('0x6')]][_0x4b36('0x2e')]=utils[_0x4b36('0x2f')](dials[_0x488244['uniqueid']]['endtime'],dials[_0x488244['uniqueid']][_0x4b36('0x1f')]);dials[_0x488244[_0x4b36('0x6')]]['holdtime']=utils[_0x4b36('0x2f')](dials[_0x488244[_0x4b36('0x6')]]['answertime']||dials[_0x488244['uniqueid']]['endtime'],dials[_0x488244[_0x4b36('0x6')]][_0x4b36('0x1f')]);dials[_0x488244[_0x4b36('0x6')]][_0x4b36('0x30')]=dials[_0x488244[_0x4b36('0x6')]]['answertime']?utils[_0x4b36('0x2f')](dials[_0x488244[_0x4b36('0x6')]][_0x4b36('0x31')],dials[_0x488244[_0x4b36('0x6')]][_0x4b36('0x26')]):0x0;writeDB(dials[_0x488244['uniqueid']]);}}catch(_0x2b35be){utils[_0x4b36('0x15')](util[_0x4b36('0x4')](_0x4b36('0x2a'),_0x488244[_0x4b36('0x6')]),_0x2b35be);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index fd9dcef..e8d37f6 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 _0x4948=['[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','asterisk','port','username','password','keepConnected','xdr','disabled','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','close','managerevent','debug','format','device','devicestatechange','error','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','uniqueid','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon'];(function(_0x3c1e8a,_0x38fc3b){var _0x271c83=function(_0x294660){while(--_0x294660){_0x3c1e8a['push'](_0x3c1e8a['shift']());}};_0x271c83(++_0x38fc3b);}(_0x4948,0x64));var _0x8494=function(_0x10bf6c,_0x374250){_0x10bf6c=_0x10bf6c-0x0;var _0x6870ad=_0x4948[_0x10bf6c];return _0x6870ad;};var AsteriskManager=require(_0x8494('0x0'));var config=require(_0x8494('0x1'));var utils=require('./utils');var util=require(_0x8494('0x2'));var ami=new AsteriskManager(config[_0x8494('0x3')][_0x8494('0x4')],config['asterisk']['ip'],config[_0x8494('0x3')][_0x8494('0x5')],config[_0x8494('0x3')][_0x8494('0x6')],!![]);ami[_0x8494('0x7')]();if(config[_0x8494('0x8')]&&config['xdr'][_0x8494('0x9')]){utils['info'](_0x8494('0xa'));}else{var agents=require(_0x8494('0xb'));var calls=require(_0x8494('0xc'));var queues=require('./queues.controller');var recordings=require(_0x8494('0xd'));var members=require(_0x8494('0xe'));var dials=require(_0x8494('0xf'));var transfers=require(_0x8494('0x10'));var core=require('./core.controller');ami['on'](_0x8494('0x11'),core[_0x8494('0x11')]);ami['on'](_0x8494('0x12'),core[_0x8494('0x12')]);ami['on'](_0x8494('0x13'),core[_0x8494('0x13')]);ami['on']('error',core['error']);ami['on'](_0x8494('0x14'),core['close']);ami['on'](_0x8494('0x15'),core['managerevent']);ami['on']('devicestatechange',function(_0x107de4){try{utils[_0x8494('0x16')](util[_0x8494('0x17')]('[%s][index][devicestatechange]',_0x107de4[_0x8494('0x18')]),_0x107de4);members[_0x8494('0x19')](_0x107de4);}catch(_0x4b0930){utils[_0x8494('0x1a')](util['format'](_0x8494('0x1b'),_0x107de4['device']),_0x4b0930);}});ami['on'](_0x8494('0x1c'),function(_0x520259){try{utils[_0x8494('0x16')](util[_0x8494('0x17')](_0x8494('0x1d'),_0x520259['uniqueid']),_0x520259);agents[_0x8494('0x1c')](_0x520259);}catch(_0x1439fb){utils[_0x8494('0x1a')](util[_0x8494('0x17')]('[%s][index][agentcalled]',_0x520259['uniqueid']),_0x1439fb);}});ami['on'](_0x8494('0x1e'),function(_0x1ab8c8){try{utils[_0x8494('0x16')](util['format'](_0x8494('0x1f'),_0x1ab8c8[_0x8494('0x20')]),_0x1ab8c8);agents[_0x8494('0x1e')](_0x1ab8c8);}catch(_0x12e0e1){utils[_0x8494('0x1a')](util[_0x8494('0x17')](_0x8494('0x1f'),_0x1ab8c8[_0x8494('0x20')]),_0x12e0e1);}});ami['on'](_0x8494('0x21'),function(_0x96d3d){try{utils[_0x8494('0x16')](util['format'](_0x8494('0x22'),_0x96d3d[_0x8494('0x20')]),_0x96d3d);agents[_0x8494('0x21')](_0x96d3d);queues[_0x8494('0x21')](_0x96d3d);}catch(_0x3d46ba){utils[_0x8494('0x1a')](util[_0x8494('0x17')](_0x8494('0x22'),_0x96d3d['uniqueid']),_0x3d46ba);}});ami['on'](_0x8494('0x23'),function(_0x14d676){try{utils[_0x8494('0x16')](util['format'](_0x8494('0x24'),_0x14d676[_0x8494('0x20')]),_0x14d676);agents[_0x8494('0x23')](_0x14d676);queues[_0x8494('0x23')](_0x14d676);members[_0x8494('0x23')](_0x14d676);}catch(_0x2710f0){utils['error'](util[_0x8494('0x17')](_0x8494('0x24'),_0x14d676[_0x8494('0x20')]),_0x2710f0);}});ami['on'](_0x8494('0x25'),function(_0x25df7d){try{utils[_0x8494('0x16')](util[_0x8494('0x17')]('[%s][index][queuecallerabandon]',_0x25df7d['uniqueid']),_0x25df7d);agents[_0x8494('0x25')](_0x25df7d);queues[_0x8494('0x25')](_0x25df7d);}catch(_0x384b76){utils['error'](util[_0x8494('0x17')](_0x8494('0x26'),_0x25df7d[_0x8494('0x20')]),_0x384b76);}});ami['on'](_0x8494('0x27'),function(_0x496f86){try{utils[_0x8494('0x16')](util[_0x8494('0x17')](_0x8494('0x28'),_0x496f86[_0x8494('0x20')]),_0x496f86);queues[_0x8494('0x27')](_0x496f86);recordings[_0x8494('0x27')](_0x496f86);}catch(_0x78929){utils['error'](util[_0x8494('0x17')]('[%s][index][queuecallerjoin]',_0x496f86['uniqueid']),_0x78929);}});ami['on']('queuecallerleave',function(_0x29d3e8){try{utils[_0x8494('0x16')](util['format'](_0x8494('0x29'),_0x29d3e8['uniqueid']),_0x29d3e8);queues[_0x8494('0x2a')](_0x29d3e8);}catch(_0x2c6608){utils[_0x8494('0x1a')](util[_0x8494('0x17')]('[%s][index][queuecallerleave]',_0x29d3e8['uniqueid']),_0x2c6608);}});ami['on'](_0x8494('0x2b'),function(_0x48048f){try{utils[_0x8494('0x16')](util[_0x8494('0x17')](_0x8494('0x2c'),_0x48048f[_0x8494('0x20')]),_0x48048f);queues[_0x8494('0x2b')](_0x48048f);calls[_0x8494('0x2b')](_0x48048f);}catch(_0x34c0c6){utils[_0x8494('0x1a')](util[_0x8494('0x17')](_0x8494('0x2c'),_0x48048f[_0x8494('0x20')]),_0x34c0c6);}});ami['on'](_0x8494('0x2d'),function(_0x38c689){try{utils[_0x8494('0x16')](util[_0x8494('0x17')](_0x8494('0x2e'),_0x38c689[_0x8494('0x20')]),_0x38c689);queues[_0x8494('0x2d')](_0x38c689);calls[_0x8494('0x2d')](_0x38c689);}catch(_0x1d3f15){utils[_0x8494('0x1a')](util['format'](_0x8494('0x2e'),_0x38c689[_0x8494('0x20')]),_0x1d3f15);}});ami['on'](_0x8494('0x2f'),function(_0x340878){try{utils[_0x8494('0x16')](util[_0x8494('0x17')](_0x8494('0x30'),_0x340878['uniqueid']),_0x340878);calls['newstate'](_0x340878);recordings[_0x8494('0x2f')](_0x340878);}catch(_0x40a444){utils[_0x8494('0x1a')](util['format'](_0x8494('0x30'),_0x340878['uniqueid']),_0x40a444);}});ami['on'](_0x8494('0x31'),function(_0x8b8c9e){try{utils[_0x8494('0x16')](util[_0x8494('0x17')](_0x8494('0x32'),_0x8b8c9e['uniqueid']),_0x8b8c9e);calls['hangup'](_0x8b8c9e);recordings[_0x8494('0x31')](_0x8b8c9e);dials['hangup'](_0x8b8c9e);agents[_0x8494('0x31')](_0x8b8c9e);queues['hangup'](_0x8b8c9e);}catch(_0x482c55){utils['error'](util[_0x8494('0x17')](_0x8494('0x32'),_0x8b8c9e[_0x8494('0x20')]),_0x482c55);}});ami['on']('cdr',function(_0x365084){try{utils[_0x8494('0x16')](util[_0x8494('0x17')]('[%s][index][cdr]',_0x365084[_0x8494('0x20')]),_0x365084);members[_0x8494('0x33')](_0x365084);}catch(_0x29d7b7){utils[_0x8494('0x1a')](util[_0x8494('0x17')](_0x8494('0x34'),_0x365084[_0x8494('0x20')]),_0x29d7b7);}});ami['on'](_0x8494('0x35'),function(_0x2109ea){try{utils[_0x8494('0x16')](util['format'](_0x8494('0x36'),_0x2109ea[_0x8494('0x20')]),_0x2109ea);queues[_0x8494('0x35')](_0x2109ea);agents[_0x8494('0x35')](_0x2109ea);transfers[_0x8494('0x35')](_0x2109ea);}catch(_0x12ab6d){utils['error'](util['format'](_0x8494('0x36'),_0x2109ea[_0x8494('0x20')]),_0x12ab6d);}});ami['on'](_0x8494('0x37'),function(_0xe91ab7){try{utils[_0x8494('0x16')](util[_0x8494('0x17')](_0x8494('0x38'),_0xe91ab7[_0x8494('0x39')]),_0xe91ab7);queues['attendedtransfer'](_0xe91ab7);transfers['attendedtransfer'](_0xe91ab7);agents[_0x8494('0x37')](_0xe91ab7);calls[_0x8494('0x37')](_0xe91ab7);}catch(_0x267010){utils['error'](util[_0x8494('0x17')](_0x8494('0x38'),_0xe91ab7[_0x8494('0x39')]),_0x267010);}});ami['on'](_0x8494('0x3a'),function(_0x4b4260){try{utils[_0x8494('0x16')](util['format'](_0x8494('0x3b'),_0x4b4260['uniqueid']),_0x4b4260);queues[_0x8494('0x3a')](_0x4b4260);recordings[_0x8494('0x3a')](_0x4b4260);calls[_0x8494('0x3a')](_0x4b4260);dials[_0x8494('0x3a')](_0x4b4260);}catch(_0x50cd9a){utils[_0x8494('0x1a')](util[_0x8494('0x17')](_0x8494('0x3b'),_0x4b4260['uniqueid']),_0x50cd9a);}});ami['on']('newexten',function(_0x2d150b){try{utils['debug'](util[_0x8494('0x17')](_0x8494('0x3c'),_0x2d150b[_0x8494('0x20')]),_0x2d150b);calls[_0x8494('0x3d')](_0x2d150b);recordings['newexten'](_0x2d150b);dials[_0x8494('0x3d')](_0x2d150b);}catch(_0x4df1c7){utils[_0x8494('0x1a')](util[_0x8494('0x17')](_0x8494('0x3c'),_0x2d150b[_0x8494('0x20')]),_0x4df1c7);}});ami['on'](_0x8494('0x3e'),function(_0x474470){try{utils[_0x8494('0x16')](util[_0x8494('0x17')](_0x8494('0x3f'),_0x474470[_0x8494('0x20')]),_0x474470);calls[_0x8494('0x3e')](_0x474470);recordings['newchannel'](_0x474470);}catch(_0xbcabd8){utils[_0x8494('0x1a')](util['format'](_0x8494('0x3f'),_0x474470[_0x8494('0x20')]),_0xbcabd8);}});ami['on'](_0x8494('0x40'),function(_0x36e91b){try{utils[_0x8494('0x16')](util[_0x8494('0x17')](_0x8494('0x41'),_0x36e91b[_0x8494('0x20')]),_0x36e91b);dials[_0x8494('0x40')](_0x36e91b);}catch(_0xad1a86){utils['error'](util['format'](_0x8494('0x42'),_0x36e91b[_0x8494('0x20')]),_0xad1a86);}});ami['on']('dialend',function(_0x9c0cf3){try{utils['debug'](util[_0x8494('0x17')]('[%s][index][dialend]',_0x9c0cf3[_0x8494('0x20')]),_0x9c0cf3);dials[_0x8494('0x43')](_0x9c0cf3);}catch(_0x4ae273){utils[_0x8494('0x1a')](util[_0x8494('0x17')](_0x8494('0x44'),_0x9c0cf3[_0x8494('0x20')]),_0x4ae273);}});} \ No newline at end of file +var _0x6404=['xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','[%s][index][devicestatechange]','device','devicestatechange','agentcalled','[%s][index][agentcalled]','uniqueid','format','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','asterisk','port','username','password'];(function(_0x43b371,_0x4b62a3){var _0x2c5528=function(_0x311914){while(--_0x311914){_0x43b371['push'](_0x43b371['shift']());}};_0x2c5528(++_0x4b62a3);}(_0x6404,0xfe));var _0x4640=function(_0x298723,_0x38b35c){_0x298723=_0x298723-0x0;var _0x3d68d9=_0x6404[_0x298723];return _0x3d68d9;};var AsteriskManager=require(_0x4640('0x0'));var config=require(_0x4640('0x1'));var utils=require('./utils');var util=require('util');var ami=new AsteriskManager(config[_0x4640('0x2')][_0x4640('0x3')],config['asterisk']['ip'],config['asterisk'][_0x4640('0x4')],config[_0x4640('0x2')][_0x4640('0x5')],!![]);ami['keepConnected']();if(config[_0x4640('0x6')]&&config[_0x4640('0x6')][_0x4640('0x7')]){utils[_0x4640('0x8')](_0x4640('0x9'));}else{var agents=require(_0x4640('0xa'));var calls=require(_0x4640('0xb'));var queues=require(_0x4640('0xc'));var recordings=require(_0x4640('0xd'));var members=require(_0x4640('0xe'));var dials=require('./dials.controller');var transfers=require('./transfers.controller');var core=require('./core.controller');ami['on']('connect',core[_0x4640('0xf')]);ami['on']('shutdown',core[_0x4640('0x10')]);ami['on'](_0x4640('0x11'),core['fullybooted']);ami['on'](_0x4640('0x12'),core[_0x4640('0x12')]);ami['on'](_0x4640('0x13'),core[_0x4640('0x13')]);ami['on'](_0x4640('0x14'),core[_0x4640('0x14')]);ami['on']('devicestatechange',function(_0x1e64a1){try{utils[_0x4640('0x15')](util['format'](_0x4640('0x16'),_0x1e64a1[_0x4640('0x17')]),_0x1e64a1);members[_0x4640('0x18')](_0x1e64a1);}catch(_0x1a0987){utils[_0x4640('0x12')](util['format']('[%s][index][devicestatechange]',_0x1e64a1[_0x4640('0x17')]),_0x1a0987);}});ami['on'](_0x4640('0x19'),function(_0x44aa33){try{utils[_0x4640('0x15')](util['format'](_0x4640('0x1a'),_0x44aa33[_0x4640('0x1b')]),_0x44aa33);agents[_0x4640('0x19')](_0x44aa33);}catch(_0x141599){utils[_0x4640('0x12')](util[_0x4640('0x1c')](_0x4640('0x1a'),_0x44aa33['uniqueid']),_0x141599);}});ami['on'](_0x4640('0x1d'),function(_0x29424d){try{utils['debug'](util['format'](_0x4640('0x1e'),_0x29424d[_0x4640('0x1b')]),_0x29424d);agents['agentringnoanswer'](_0x29424d);}catch(_0x3d7886){utils[_0x4640('0x12')](util['format']('[%s][index][agentringnoanswer]',_0x29424d[_0x4640('0x1b')]),_0x3d7886);}});ami['on'](_0x4640('0x1f'),function(_0x5d4d1d){try{utils['debug'](util[_0x4640('0x1c')](_0x4640('0x20'),_0x5d4d1d[_0x4640('0x1b')]),_0x5d4d1d);agents[_0x4640('0x1f')](_0x5d4d1d);queues['agentconnect'](_0x5d4d1d);}catch(_0x146aee){utils[_0x4640('0x12')](util[_0x4640('0x1c')](_0x4640('0x20'),_0x5d4d1d[_0x4640('0x1b')]),_0x146aee);}});ami['on'](_0x4640('0x21'),function(_0x1a0b2d){try{utils[_0x4640('0x15')](util[_0x4640('0x1c')](_0x4640('0x22'),_0x1a0b2d[_0x4640('0x1b')]),_0x1a0b2d);agents[_0x4640('0x21')](_0x1a0b2d);queues['agentcomplete'](_0x1a0b2d);members[_0x4640('0x21')](_0x1a0b2d);}catch(_0x4831f7){utils['error'](util[_0x4640('0x1c')](_0x4640('0x22'),_0x1a0b2d['uniqueid']),_0x4831f7);}});ami['on'](_0x4640('0x23'),function(_0x3e9f01){try{utils['debug'](util['format']('[%s][index][queuecallerabandon]',_0x3e9f01[_0x4640('0x1b')]),_0x3e9f01);agents[_0x4640('0x23')](_0x3e9f01);queues['queuecallerabandon'](_0x3e9f01);}catch(_0x19083c){utils[_0x4640('0x12')](util['format'](_0x4640('0x24'),_0x3e9f01[_0x4640('0x1b')]),_0x19083c);}});ami['on'](_0x4640('0x25'),function(_0x1a886a){try{utils[_0x4640('0x15')](util['format']('[%s][index][queuecallerjoin]',_0x1a886a[_0x4640('0x1b')]),_0x1a886a);queues[_0x4640('0x25')](_0x1a886a);recordings[_0x4640('0x25')](_0x1a886a);}catch(_0x1e2b90){utils[_0x4640('0x12')](util[_0x4640('0x1c')](_0x4640('0x26'),_0x1a886a[_0x4640('0x1b')]),_0x1e2b90);}});ami['on'](_0x4640('0x27'),function(_0x414904){try{utils[_0x4640('0x15')](util[_0x4640('0x1c')](_0x4640('0x28'),_0x414904[_0x4640('0x1b')]),_0x414904);queues[_0x4640('0x27')](_0x414904);}catch(_0x5c69af){utils[_0x4640('0x12')](util[_0x4640('0x1c')](_0x4640('0x28'),_0x414904['uniqueid']),_0x5c69af);}});ami['on'](_0x4640('0x29'),function(_0x1eea18){try{utils[_0x4640('0x15')](util[_0x4640('0x1c')](_0x4640('0x2a'),_0x1eea18[_0x4640('0x1b')]),_0x1eea18);queues['musiconholdstart'](_0x1eea18);calls[_0x4640('0x29')](_0x1eea18);}catch(_0x329875){utils[_0x4640('0x12')](util['format'](_0x4640('0x2a'),_0x1eea18[_0x4640('0x1b')]),_0x329875);}});ami['on'](_0x4640('0x2b'),function(_0x7f2026){try{utils[_0x4640('0x15')](util[_0x4640('0x1c')](_0x4640('0x2c'),_0x7f2026[_0x4640('0x1b')]),_0x7f2026);queues['musiconholdstop'](_0x7f2026);calls[_0x4640('0x2b')](_0x7f2026);}catch(_0x3bd931){utils[_0x4640('0x12')](util[_0x4640('0x1c')](_0x4640('0x2c'),_0x7f2026[_0x4640('0x1b')]),_0x3bd931);}});ami['on'](_0x4640('0x2d'),function(_0x48ae9c){try{utils['debug'](util['format'](_0x4640('0x2e'),_0x48ae9c[_0x4640('0x1b')]),_0x48ae9c);calls[_0x4640('0x2d')](_0x48ae9c);recordings[_0x4640('0x2d')](_0x48ae9c);}catch(_0x54d302){utils[_0x4640('0x12')](util[_0x4640('0x1c')](_0x4640('0x2e'),_0x48ae9c[_0x4640('0x1b')]),_0x54d302);}});ami['on'](_0x4640('0x2f'),function(_0x3aa690){try{utils[_0x4640('0x15')](util[_0x4640('0x1c')](_0x4640('0x30'),_0x3aa690['uniqueid']),_0x3aa690);calls[_0x4640('0x2f')](_0x3aa690);recordings['hangup'](_0x3aa690);dials[_0x4640('0x2f')](_0x3aa690);agents[_0x4640('0x2f')](_0x3aa690);queues[_0x4640('0x2f')](_0x3aa690);}catch(_0xcd52a1){utils['error'](util[_0x4640('0x1c')](_0x4640('0x30'),_0x3aa690[_0x4640('0x1b')]),_0xcd52a1);}});ami['on'](_0x4640('0x31'),function(_0x349017){try{utils['debug'](util['format'](_0x4640('0x32'),_0x349017[_0x4640('0x1b')]),_0x349017);members['cdr'](_0x349017);}catch(_0x28f6f2){utils[_0x4640('0x12')](util[_0x4640('0x1c')]('[%s][index][cdr]',_0x349017[_0x4640('0x1b')]),_0x28f6f2);}});ami['on'](_0x4640('0x33'),function(_0x2f22d3){try{utils['debug'](util['format']('[%s][index][blindtransfer]',_0x2f22d3[_0x4640('0x1b')]),_0x2f22d3);queues['blindtransfer'](_0x2f22d3);agents[_0x4640('0x33')](_0x2f22d3);transfers[_0x4640('0x33')](_0x2f22d3);}catch(_0x57ec07){utils[_0x4640('0x12')](util[_0x4640('0x1c')](_0x4640('0x34'),_0x2f22d3['uniqueid']),_0x57ec07);}});ami['on'](_0x4640('0x35'),function(_0x532030){try{utils[_0x4640('0x15')](util[_0x4640('0x1c')](_0x4640('0x36'),_0x532030[_0x4640('0x37')]),_0x532030);queues[_0x4640('0x35')](_0x532030);transfers[_0x4640('0x35')](_0x532030);agents[_0x4640('0x35')](_0x532030);calls[_0x4640('0x35')](_0x532030);}catch(_0x5d0c52){utils[_0x4640('0x12')](util[_0x4640('0x1c')]('[%s][index][attendedtransfer]',_0x532030['origtransfereruniqueid']),_0x5d0c52);}});ami['on'](_0x4640('0x38'),function(_0x2a90e3){try{utils[_0x4640('0x15')](util[_0x4640('0x1c')](_0x4640('0x39'),_0x2a90e3[_0x4640('0x1b')]),_0x2a90e3);queues[_0x4640('0x38')](_0x2a90e3);recordings[_0x4640('0x38')](_0x2a90e3);calls['varset'](_0x2a90e3);dials[_0x4640('0x38')](_0x2a90e3);}catch(_0x37454f){utils['error'](util[_0x4640('0x1c')](_0x4640('0x39'),_0x2a90e3['uniqueid']),_0x37454f);}});ami['on']('newexten',function(_0x43ec4a){try{utils[_0x4640('0x15')](util['format'](_0x4640('0x3a'),_0x43ec4a[_0x4640('0x1b')]),_0x43ec4a);calls[_0x4640('0x3b')](_0x43ec4a);recordings[_0x4640('0x3b')](_0x43ec4a);dials[_0x4640('0x3b')](_0x43ec4a);}catch(_0x3e848b){utils[_0x4640('0x12')](util[_0x4640('0x1c')](_0x4640('0x3a'),_0x43ec4a[_0x4640('0x1b')]),_0x3e848b);}});ami['on'](_0x4640('0x3c'),function(_0x40a118){try{utils[_0x4640('0x15')](util[_0x4640('0x1c')](_0x4640('0x3d'),_0x40a118[_0x4640('0x1b')]),_0x40a118);calls[_0x4640('0x3c')](_0x40a118);recordings[_0x4640('0x3c')](_0x40a118);}catch(_0x54f9df){utils['error'](util[_0x4640('0x1c')](_0x4640('0x3d'),_0x40a118[_0x4640('0x1b')]),_0x54f9df);}});ami['on'](_0x4640('0x3e'),function(_0x3c8c61){try{utils['debug'](util['format']('[%s][index][dialbegin]',_0x3c8c61[_0x4640('0x1b')]),_0x3c8c61);dials[_0x4640('0x3e')](_0x3c8c61);}catch(_0x315943){utils[_0x4640('0x12')](util['format']('[%s]dialbegin',_0x3c8c61['uniqueid']),_0x315943);}});ami['on']('dialend',function(_0x1218fe){try{utils['debug'](util[_0x4640('0x1c')](_0x4640('0x3f'),_0x1218fe[_0x4640('0x1b')]),_0x1218fe);dials[_0x4640('0x40')](_0x1218fe);}catch(_0x139e88){utils['error'](util[_0x4640('0x1c')](_0x4640('0x3f'),_0x1218fe[_0x4640('0x1b')]),_0x139e88);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 364559b..4158854 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 _0xfb92=['error','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','debug','[%s][members][cdr]','split','data1','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','getUserByInterface','then','name','internal','request','getUserByName','membername','CreateMemberReport','catch','[%s][members][writeDB]','startsWith','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime'];(function(_0x599d65,_0x569eef){var _0x3af2de=function(_0x57e935){while(--_0x57e935){_0x599d65['push'](_0x599d65['shift']());}};_0x3af2de(++_0x569eef);}(_0xfb92,0x1e3));var _0x2fb9=function(_0x2d35aa,_0x4b47e6){_0x2d35aa=_0x2d35aa-0x0;var _0x5047e6=_0xfb92[_0x2d35aa];return _0x5047e6;};'use strict';var _=require(_0x2fb9('0x0'));var util=require('util');var utils=require(_0x2fb9('0x1'));var members={};var exclude=[_0x2fb9('0x2'),_0x2fb9('0x3')];function writeDB(_0x33f0c7){utils[_0x2fb9('0x4')](util[_0x2fb9('0x5')](_0x2fb9('0x6'),_0x33f0c7[_0x2fb9('0x7')],_0x33f0c7[_0x2fb9('0x8')],_0x33f0c7[_0x2fb9('0x9')],_0x33f0c7[_0x2fb9('0xa')],_0x33f0c7['membername'],_0x33f0c7['type']));if(_0x33f0c7['interface']){utils[_0x2fb9('0xb')](_0x33f0c7[_0x2fb9('0x8')])[_0x2fb9('0xc')](function(_0x4b0315){if(_0x4b0315){_0x33f0c7['membername']=_0x4b0315[_0x2fb9('0xd')];_0x33f0c7[_0x2fb9('0xe')]=_0x4b0315[_0x2fb9('0xe')];utils[_0x2fb9('0xf')]('CreateMemberReport',_0x33f0c7);}else{utils[_0x2fb9('0x10')](_0x33f0c7['interface']['split']('/')[0x1])['then'](function(_0x31d830){if(_0x31d830){_0x33f0c7[_0x2fb9('0x11')]=_0x31d830[_0x2fb9('0xd')];_0x33f0c7[_0x2fb9('0xe')]=_0x31d830[_0x2fb9('0xe')];utils[_0x2fb9('0xf')](_0x2fb9('0x12'),_0x33f0c7);}});}})[_0x2fb9('0x13')](function(_0x2d71b1){utils['error'](util[_0x2fb9('0x5')](_0x2fb9('0x14'),_0x33f0c7[_0x2fb9('0x7')]),_0x2d71b1);});}delete members[_0x33f0c7['interface']];}function startsWith(_0x1f6384,_0x4c5ded){return _['some'](_0x1f6384,function(_0x4f0aa3){return _[_0x2fb9('0x15')](_0x4c5ded,_0x4f0aa3);});}exports['devicestatechange']=function(_0x511cb9){try{utils['debug'](util[_0x2fb9('0x5')](_0x2fb9('0x16'),members[_0x511cb9[_0x2fb9('0x17')]]?members[_0x511cb9[_0x2fb9('0x17')]][_0x2fb9('0x7')]:_0x511cb9[_0x2fb9('0x17')]),_0x511cb9);utils[_0x2fb9('0x4')](util[_0x2fb9('0x5')](_0x2fb9('0x18'),members[_0x511cb9['device']]?members[_0x511cb9[_0x2fb9('0x17')]][_0x2fb9('0x7')]:_0x511cb9[_0x2fb9('0x17')],_0x511cb9[_0x2fb9('0x19')],_0x511cb9[_0x2fb9('0x17')]));switch(_0x511cb9[_0x2fb9('0x19')]){case _0x2fb9('0x1a'):case _0x2fb9('0x1b'):if(!startsWith(exclude,_0x511cb9[_0x2fb9('0x17')])){members[_0x511cb9[_0x2fb9('0x17')]]={'channel':_0x2fb9('0x1c'),'interface':_0x511cb9['device'],'type':_0x2fb9('0x1d'),'enterAt':utils[_0x2fb9('0x1e')](),'role':_0x2fb9('0x1f')};}break;case _0x2fb9('0x20'):if(!_[_0x2fb9('0x21')](members[_0x511cb9[_0x2fb9('0x17')]])){members[_0x511cb9[_0x2fb9('0x17')]][_0x2fb9('0x22')]=utils[_0x2fb9('0x1e')]();members[_0x511cb9['device']][_0x2fb9('0x23')]=utils[_0x2fb9('0x24')](members[_0x511cb9['device']][_0x2fb9('0x22')],members[_0x511cb9[_0x2fb9('0x17')]]['enterAt']);if(members[_0x511cb9[_0x2fb9('0x17')]][_0x2fb9('0x7')]){writeDB(members[_0x511cb9[_0x2fb9('0x17')]]);}}break;default:break;}}catch(_0x3909a){utils[_0x2fb9('0x25')](util['format']('[%s][members][devicestatechange]',members[_0x511cb9['device']]?members[_0x511cb9[_0x2fb9('0x17')]][_0x2fb9('0x7')]:_0x511cb9['device']),_0x3909a);}};exports[_0x2fb9('0x26')]=function(_0x3d34d8){try{if(!_[_0x2fb9('0x21')](members[_0x3d34d8[_0x2fb9('0x8')]])){utils['debug'](util['format']('[%s][members][agentcomplete]',_0x3d34d8['uniqueid']),_0x3d34d8);utils['info'](util['format'](_0x2fb9('0x27'),_0x3d34d8[_0x2fb9('0x7')],_0x3d34d8[_0x2fb9('0x8')],_0x3d34d8['queue']));members[_0x3d34d8['interface']]=_[_0x2fb9('0x28')](members[_0x3d34d8[_0x2fb9('0x8')]],{'data4':_0x3d34d8[_0x2fb9('0x29')],'uniqueid':_0x3d34d8[_0x2fb9('0x7')]});}}catch(_0x557aac){utils['error'](util[_0x2fb9('0x5')]('[%s][members][agentcomplete]',_0x3d34d8['uniqueid']),_0x557aac);}};exports[_0x2fb9('0x2a')]=function(_0x5df964){try{utils[_0x2fb9('0x2b')](util[_0x2fb9('0x5')](_0x2fb9('0x2c'),_0x5df964[_0x2fb9('0x7')]),_0x5df964);if(_0x5df964[_0x2fb9('0x9')]){var _0x1cf06d=_0x5df964['channel'][_0x2fb9('0x2d')]('-')[0x0];if(!_[_0x2fb9('0x21')](members[_0x1cf06d])){members[_0x1cf06d]=_[_0x2fb9('0x28')](members[_0x1cf06d],{'data1':members[_0x1cf06d][_0x2fb9('0x2e')]||_0x5df964['type'],'data2':members[_0x1cf06d]['data2']||_0x5df964[_0x2fb9('0x2f')],'data3':members[_0x1cf06d][_0x2fb9('0x30')]||_0x5df964[_0x2fb9('0x31')],'uniqueid':members[_0x1cf06d][_0x2fb9('0x7')]||_0x5df964[_0x2fb9('0x7')]});utils[_0x2fb9('0x4')](util[_0x2fb9('0x5')](_0x2fb9('0x32'),_0x5df964[_0x2fb9('0x7')],members[_0x1cf06d]['data1'],members[_0x1cf06d][_0x2fb9('0xa')],members[_0x1cf06d][_0x2fb9('0x30')]));if(members[_0x1cf06d][_0x2fb9('0x22')]){writeDB(members[_0x1cf06d]);}}}if(_0x5df964[_0x2fb9('0x33')]){var _0x28b500=_0x5df964['destinationchannel'][_0x2fb9('0x2d')]('-')[0x0];if(!_[_0x2fb9('0x21')](members[_0x28b500])){members[_0x28b500]=_[_0x2fb9('0x28')](members[_0x28b500],{'data1':members[_0x28b500]['data1']||_0x5df964['type'],'data2':members[_0x28b500]['data2']||_0x5df964[_0x2fb9('0x2f')],'data3':members[_0x28b500][_0x2fb9('0x30')]||_0x5df964[_0x2fb9('0x31')],'uniqueid':members[_0x28b500][_0x2fb9('0x7')]||_0x5df964[_0x2fb9('0x7')]});utils['info'](util[_0x2fb9('0x5')](_0x2fb9('0x32'),_0x5df964['uniqueid'],members[_0x28b500][_0x2fb9('0x2e')],members[_0x28b500][_0x2fb9('0xa')],members[_0x28b500][_0x2fb9('0x30')]));if(members[_0x28b500]['exitAt']){writeDB(members[_0x28b500]);}}}}catch(_0x402f03){utils['error'](util[_0x2fb9('0x5')](_0x2fb9('0x2c'),_0x5df964[_0x2fb9('0x7')]),_0x402f03);}}; \ No newline at end of file +var _0x3f91=['source','data2','data3','destinationchannel','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','type','getUserByInterface','then','membername','name','internal','CreateMemberReport','getUserByName','request','catch','error','[%s][members][writeDB]','some','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','TALKING','now','isNil','exitAt','duration','diffTime','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3f91,0x99));var _0x13f9=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x3f91[_0x5a776b];return _0xbbef59;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x13f9('0x0'));var members={};var exclude=[_0x13f9('0x1'),_0x13f9('0x2')];function writeDB(_0x4baca5){utils[_0x13f9('0x3')](util[_0x13f9('0x4')](_0x13f9('0x5'),_0x4baca5[_0x13f9('0x6')],_0x4baca5[_0x13f9('0x7')],_0x4baca5[_0x13f9('0x8')],_0x4baca5['data2'],_0x4baca5['membername'],_0x4baca5[_0x13f9('0x9')]));if(_0x4baca5[_0x13f9('0x7')]){utils[_0x13f9('0xa')](_0x4baca5[_0x13f9('0x7')])[_0x13f9('0xb')](function(_0x3f009a){if(_0x3f009a){_0x4baca5[_0x13f9('0xc')]=_0x3f009a[_0x13f9('0xd')];_0x4baca5[_0x13f9('0xe')]=_0x3f009a[_0x13f9('0xe')];utils['request'](_0x13f9('0xf'),_0x4baca5);}else{utils[_0x13f9('0x10')](_0x4baca5[_0x13f9('0x7')]['split']('/')[0x1])[_0x13f9('0xb')](function(_0x492c44){if(_0x492c44){_0x4baca5[_0x13f9('0xc')]=_0x492c44['name'];_0x4baca5[_0x13f9('0xe')]=_0x492c44[_0x13f9('0xe')];utils[_0x13f9('0x11')]('CreateMemberReport',_0x4baca5);}});}})[_0x13f9('0x12')](function(_0x1df23d){utils[_0x13f9('0x13')](util[_0x13f9('0x4')](_0x13f9('0x14'),_0x4baca5['uniqueid']),_0x1df23d);});}delete members[_0x4baca5['interface']];}function startsWith(_0x410b57,_0x103e32){return _[_0x13f9('0x15')](_0x410b57,function(_0x3783c5){return _['startsWith'](_0x103e32,_0x3783c5);});}exports['devicestatechange']=function(_0x1faeec){try{utils[_0x13f9('0x16')](util[_0x13f9('0x4')](_0x13f9('0x17'),members[_0x1faeec[_0x13f9('0x18')]]?members[_0x1faeec[_0x13f9('0x18')]][_0x13f9('0x6')]:_0x1faeec[_0x13f9('0x18')]),_0x1faeec);utils['info'](util['format'](_0x13f9('0x19'),members[_0x1faeec[_0x13f9('0x18')]]?members[_0x1faeec['device']][_0x13f9('0x6')]:_0x1faeec[_0x13f9('0x18')],_0x1faeec[_0x13f9('0x1a')],_0x1faeec['device']));switch(_0x1faeec[_0x13f9('0x1a')]){case'INUSE':case _0x13f9('0x1b'):if(!startsWith(exclude,_0x1faeec[_0x13f9('0x18')])){members[_0x1faeec['device']]={'channel':_0x13f9('0x1c'),'interface':_0x1faeec['device'],'type':_0x13f9('0x1d'),'enterAt':utils[_0x13f9('0x1e')](),'role':'agent'};}break;case'NOT_INUSE':if(!_[_0x13f9('0x1f')](members[_0x1faeec['device']])){members[_0x1faeec[_0x13f9('0x18')]][_0x13f9('0x20')]=utils[_0x13f9('0x1e')]();members[_0x1faeec[_0x13f9('0x18')]][_0x13f9('0x21')]=utils[_0x13f9('0x22')](members[_0x1faeec[_0x13f9('0x18')]][_0x13f9('0x20')],members[_0x1faeec[_0x13f9('0x18')]]['enterAt']);if(members[_0x1faeec['device']][_0x13f9('0x6')]){writeDB(members[_0x1faeec[_0x13f9('0x18')]]);}}break;default:break;}}catch(_0x256ffd){utils[_0x13f9('0x13')](util[_0x13f9('0x4')](_0x13f9('0x17'),members[_0x1faeec[_0x13f9('0x18')]]?members[_0x1faeec[_0x13f9('0x18')]]['uniqueid']:_0x1faeec[_0x13f9('0x18')]),_0x256ffd);}};exports[_0x13f9('0x23')]=function(_0x3f03e7){try{if(!_['isNil'](members[_0x3f03e7[_0x13f9('0x7')]])){utils[_0x13f9('0x16')](util['format']('[%s][members][agentcomplete]',_0x3f03e7['uniqueid']),_0x3f03e7);utils[_0x13f9('0x3')](util[_0x13f9('0x4')](_0x13f9('0x24'),_0x3f03e7[_0x13f9('0x6')],_0x3f03e7[_0x13f9('0x7')],_0x3f03e7[_0x13f9('0x25')]));members[_0x3f03e7[_0x13f9('0x7')]]=_[_0x13f9('0x26')](members[_0x3f03e7[_0x13f9('0x7')]],{'data4':_0x3f03e7[_0x13f9('0x25')],'uniqueid':_0x3f03e7['uniqueid']});}}catch(_0x33026f){utils[_0x13f9('0x13')](util[_0x13f9('0x4')](_0x13f9('0x27'),_0x3f03e7[_0x13f9('0x6')]),_0x33026f);}};exports[_0x13f9('0x28')]=function(_0xb14908){try{utils[_0x13f9('0x16')](util[_0x13f9('0x4')](_0x13f9('0x29'),_0xb14908['uniqueid']),_0xb14908);if(_0xb14908[_0x13f9('0x8')]){var _0x25d696=_0xb14908[_0x13f9('0x8')]['split']('-')[0x0];if(!_['isNil'](members[_0x25d696])){members[_0x25d696]=_[_0x13f9('0x26')](members[_0x25d696],{'data1':members[_0x25d696][_0x13f9('0x2a')]||_0xb14908['type'],'data2':members[_0x25d696]['data2']||_0xb14908[_0x13f9('0x2b')],'data3':members[_0x25d696]['data3']||_0xb14908['destination'],'uniqueid':members[_0x25d696][_0x13f9('0x6')]||_0xb14908[_0x13f9('0x6')]});utils[_0x13f9('0x3')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xb14908[_0x13f9('0x6')],members[_0x25d696][_0x13f9('0x2a')],members[_0x25d696][_0x13f9('0x2c')],members[_0x25d696][_0x13f9('0x2d')]));if(members[_0x25d696][_0x13f9('0x20')]){writeDB(members[_0x25d696]);}}}if(_0xb14908[_0x13f9('0x2e')]){var _0x4b5a1a=_0xb14908[_0x13f9('0x2e')]['split']('-')[0x0];if(!_[_0x13f9('0x1f')](members[_0x4b5a1a])){members[_0x4b5a1a]=_['assign'](members[_0x4b5a1a],{'data1':members[_0x4b5a1a][_0x13f9('0x2a')]||_0xb14908[_0x13f9('0x9')],'data2':members[_0x4b5a1a][_0x13f9('0x2c')]||_0xb14908[_0x13f9('0x2b')],'data3':members[_0x4b5a1a][_0x13f9('0x2d')]||_0xb14908[_0x13f9('0x2f')],'uniqueid':members[_0x4b5a1a]['uniqueid']||_0xb14908['uniqueid']});utils[_0x13f9('0x3')](util[_0x13f9('0x4')](_0x13f9('0x30'),_0xb14908[_0x13f9('0x6')],members[_0x4b5a1a][_0x13f9('0x2a')],members[_0x4b5a1a][_0x13f9('0x2c')],members[_0x4b5a1a]['data3']));if(members[_0x4b5a1a][_0x13f9('0x20')]){writeDB(members[_0x4b5a1a]);}}}}catch(_0x1901e6){utils['error'](util[_0x13f9('0x4')](_0x13f9('0x29'),_0xb14908[_0x13f9('0x6')]),_0x1901e6);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index e7289de..0962a20 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 _0x3c03=['channel','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','[%s][queues][hangup]','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','isNil','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','error','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','queuecallerleaveAt','diffTime','queuecallerjoinAt','count','connectedlinename','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','lastAssignedTo','[%s][queues][agentcomplete]','assigned','queuecallercompleteAt','reason','transfer','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','transferexten','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','holdtime','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDED','transfertargetlinkedid','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid'];(function(_0x130db5,_0x293537){var _0x5e2a3b=function(_0x2444f7){while(--_0x2444f7){_0x130db5['push'](_0x130db5['shift']());}};_0x5e2a3b(++_0x293537);}(_0x3c03,0xcc));var _0x33c0=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x3c03[_0xd1d19a];return _0x52a79d;};'use strict';var _=require('lodash');var util=require(_0x33c0('0x0'));var utils=require(_0x33c0('0x1'));var queues={};function writeDB(_0x5e6d5a){utils[_0x33c0('0x2')](util[_0x33c0('0x3')](_0x33c0('0x4'),_0x5e6d5a[_0x33c0('0x5')],_0x5e6d5a[_0x33c0('0x6')],_0x5e6d5a['queue'],_0x5e6d5a['lastAssignedTo'],_0x5e6d5a[_0x33c0('0x7')],_0x5e6d5a[_0x33c0('0x8')],_0x5e6d5a[_0x33c0('0x9')]));if(_0x5e6d5a['queue']){utils[_0x33c0('0xa')](_0x5e6d5a[_0x33c0('0xb')])[_0x33c0('0xc')](function(_0x4ba202){if(_0x4ba202){_0x5e6d5a[_0x33c0('0xd')]=_0x4ba202['type'];}utils[_0x33c0('0xe')](_0x33c0('0xf'),_0x5e6d5a);});}else{utils[_0x33c0('0xe')](_0x33c0('0xf'),_0x5e6d5a);}if(_0x5e6d5a[_0x33c0('0x10')]){delete queues[_0x5e6d5a[_0x33c0('0x10')]];}else{delete queues[_0x5e6d5a[_0x33c0('0x5')]];}}exports['queuecallerjoin']=function(_0x5bf2a0){try{utils[_0x33c0('0x11')](util[_0x33c0('0x3')](_0x33c0('0x12'),_0x5bf2a0[_0x33c0('0x5')]),_0x5bf2a0);utils[_0x33c0('0x2')](util['format'](_0x33c0('0x13'),_0x5bf2a0[_0x33c0('0x5')],_0x5bf2a0[_0x33c0('0xb')],_0x5bf2a0[_0x33c0('0x14')]));queues[_0x5bf2a0[_0x33c0('0x5')]]=_[_0x33c0('0x15')](_0x5bf2a0,{'originalposition':_0x5bf2a0['position'],'queuecallerjoinAt':utils[_0x33c0('0x16')](),'mohtime':0x0});}catch(_0x598ce3){utils['error'](util[_0x33c0('0x3')]('[%s][queues][queuecallerjoin]',_0x5bf2a0['uniqueid']),_0x598ce3);}};exports[_0x33c0('0x17')]=function(_0x25bbf6){try{if(!_['isNil'](queues[_0x25bbf6['uniqueid']])){utils['debug'](util[_0x33c0('0x3')](_0x33c0('0x18'),_0x25bbf6[_0x33c0('0x5')]),_0x25bbf6);if(queues[_0x25bbf6[_0x33c0('0x5')]]['queuecallerleaveAt']){if(!queues[_0x25bbf6[_0x33c0('0x5')]]['queuecallerabandon']&&!queues[_0x25bbf6[_0x33c0('0x5')]][_0x33c0('0x19')]){queues[_0x25bbf6[_0x33c0('0x5')]][_0x33c0('0x1a')]=!![];queues[_0x25bbf6[_0x33c0('0x5')]]['queuecallercompleteAt']=utils[_0x33c0('0x16')]();queues[_0x25bbf6['uniqueid']]['queuecallerexitreason']=_0x33c0('0x1b');}utils[_0x33c0('0x2')](util[_0x33c0('0x3')](_0x33c0('0x1c'),_0x25bbf6[_0x33c0('0x5')],queues[_0x25bbf6[_0x33c0('0x5')]][_0x33c0('0x1d')],queues[_0x25bbf6[_0x33c0('0x5')]][_0x33c0('0x9')]));writeDB(queues[_0x25bbf6['uniqueid']]);}else if(queues[_0x25bbf6[_0x33c0('0x5')]][_0x33c0('0x10')]){utils[_0x33c0('0x2')](util[_0x33c0('0x3')](_0x33c0('0x1e'),_0x25bbf6[_0x33c0('0x5')],queues[_0x25bbf6[_0x33c0('0x5')]][_0x33c0('0x1d')],queues[_0x25bbf6['uniqueid']][_0x33c0('0x10')]));queues[queues[_0x25bbf6[_0x33c0('0x5')]]['transfereduniqueid']]=queues[_0x25bbf6[_0x33c0('0x5')]];queues[queues[_0x25bbf6['uniqueid']]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x25bbf6[_0x33c0('0x5')]];}}}catch(_0x226551){utils['error'](util[_0x33c0('0x3')](_0x33c0('0x18'),_0x25bbf6[_0x33c0('0x5')]),_0x226551);}};exports[_0x33c0('0x1f')]=function(_0x13c177){try{utils[_0x33c0('0x11')](util[_0x33c0('0x3')](_0x33c0('0x20'),_0x13c177[_0x33c0('0x5')]),_0x13c177);if(!_['isNil'](_0x13c177[_0x33c0('0x21')]['queuestatus'])&&_0x13c177[_0x33c0('0x22')][_0x33c0('0x23')]()!==_0x33c0('0x24')){if(!_['isNil'](queues[_0x13c177[_0x33c0('0x5')]])){queues[_0x13c177[_0x33c0('0x5')]][_0x33c0('0x25')]=![];queues[_0x13c177[_0x33c0('0x5')]][_0x33c0('0x26')]=null;queues[_0x13c177[_0x33c0('0x5')]]['queuecallerexit']=!![];queues[_0x13c177['uniqueid']][_0x33c0('0x27')]=utils[_0x33c0('0x16')]();queues[_0x13c177[_0x33c0('0x5')]]['queuecallerexitreason']=_0x13c177[_0x33c0('0x22')][_0x33c0('0x23')]();utils[_0x33c0('0x2')](util[_0x33c0('0x3')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x13c177['uniqueid'],queues[_0x13c177[_0x33c0('0x5')]][_0x33c0('0x1d')],_0x13c177[_0x33c0('0x22')],queues[_0x13c177[_0x33c0('0x5')]][_0x33c0('0x9')]));writeDB(queues[_0x13c177[_0x33c0('0x5')]]);}}else if(!_[_0x33c0('0x28')](_0x13c177['variable'][_0x33c0('0x29')])){if(!_[_0x33c0('0x28')](queues[_0x13c177[_0x33c0('0x5')]])&&!queues[_0x13c177[_0x33c0('0x5')]]['queuecallerabandon']){queues[_0x13c177[_0x33c0('0x5')]][_0x33c0('0x25')]=![];queues[_0x13c177[_0x33c0('0x5')]]['queuecallerabandonAt']=null;queues[_0x13c177[_0x33c0('0x5')]][_0x33c0('0x19')]=!![];queues[_0x13c177['uniqueid']][_0x33c0('0x27')]=utils[_0x33c0('0x16')]();queues[_0x13c177['uniqueid']]['queuecallerexitreason']=_0x33c0('0x2a');utils['info'](util[_0x33c0('0x3')](_0x33c0('0x2b'),_0x13c177['uniqueid'],queues[_0x13c177[_0x33c0('0x5')]][_0x33c0('0x1d')],_0x13c177[_0x33c0('0x22')],queues[_0x13c177[_0x33c0('0x5')]]['queuecallerexitreason']));}}}catch(_0x407450){utils['error'](util[_0x33c0('0x3')](_0x33c0('0x20'),_0x13c177[_0x33c0('0x5')]),_0x407450);}};exports[_0x33c0('0x25')]=function(_0x581015){try{if(!_[_0x33c0('0x28')](queues[_0x581015['uniqueid']])){utils['debug'](util[_0x33c0('0x3')](_0x33c0('0x2c'),_0x581015[_0x33c0('0x5')]),_0x581015);queues[_0x581015[_0x33c0('0x5')]][_0x33c0('0x19')]=![];queues[_0x581015['uniqueid']][_0x33c0('0x27')]=null;queues[_0x581015[_0x33c0('0x5')]][_0x33c0('0x25')]=!![];queues[_0x581015['uniqueid']][_0x33c0('0x26')]=utils['now']();queues[_0x581015[_0x33c0('0x5')]][_0x33c0('0x9')]=_0x33c0('0x2d');utils['info'](util[_0x33c0('0x3')](_0x33c0('0x2e'),_0x581015[_0x33c0('0x5')],queues[_0x581015[_0x33c0('0x5')]]['name'],queues[_0x581015[_0x33c0('0x5')]][_0x33c0('0x9')]));}}catch(_0x28b681){utils[_0x33c0('0x2f')](util[_0x33c0('0x3')](_0x33c0('0x2c'),_0x581015['uniqueid']),_0x28b681);}};exports[_0x33c0('0x30')]=function(_0x2ca6d6){try{if(!_['isNil'](queues[_0x2ca6d6[_0x33c0('0x5')]])){utils[_0x33c0('0x11')](util[_0x33c0('0x3')](_0x33c0('0x31'),_0x2ca6d6[_0x33c0('0x5')]),_0x2ca6d6);utils['info'](util[_0x33c0('0x3')](_0x33c0('0x32'),_0x2ca6d6[_0x33c0('0x5')],queues[_0x2ca6d6[_0x33c0('0x5')]][_0x33c0('0x1d')],_0x2ca6d6[_0x33c0('0x33')],_0x2ca6d6['connectedlinename']));queues[_0x2ca6d6[_0x33c0('0x5')]]['queuecallerleave']=!![];queues[_0x2ca6d6[_0x33c0('0x5')]][_0x33c0('0x34')]=utils[_0x33c0('0x16')]();queues[_0x2ca6d6[_0x33c0('0x5')]]['holdtime']=utils[_0x33c0('0x35')](queues[_0x2ca6d6['uniqueid']][_0x33c0('0x34')],queues[_0x2ca6d6[_0x33c0('0x5')]][_0x33c0('0x36')]);queues[_0x2ca6d6['uniqueid']][_0x33c0('0x14')]=_0x2ca6d6[_0x33c0('0x14')];queues[_0x2ca6d6[_0x33c0('0x5')]][_0x33c0('0x37')]=_0x2ca6d6[_0x33c0('0x37')];queues[_0x2ca6d6[_0x33c0('0x5')]][_0x33c0('0x33')]=_0x2ca6d6[_0x33c0('0x33')];queues[_0x2ca6d6['uniqueid']][_0x33c0('0x38')]=_0x2ca6d6[_0x33c0('0x38')];}}catch(_0x45895c){utils[_0x33c0('0x2f')](util[_0x33c0('0x3')]('[%s][queues][queuecallerleave]',_0x2ca6d6['uniqueid']),_0x45895c);}};exports['agentconnect']=function(_0x26ac81){try{if(!_[_0x33c0('0x28')](queues[_0x26ac81[_0x33c0('0x5')]])){utils[_0x33c0('0x11')](util[_0x33c0('0x3')](_0x33c0('0x39'),_0x26ac81['uniqueid']),_0x26ac81);utils[_0x33c0('0x2')](util[_0x33c0('0x3')](_0x33c0('0x3a'),_0x26ac81[_0x33c0('0x5')],queues[_0x26ac81[_0x33c0('0x5')]]['name'],_0x26ac81[_0x33c0('0x3b')],_0x26ac81[_0x33c0('0x3c')]));queues[_0x26ac81[_0x33c0('0x5')]][_0x33c0('0x25')]=![];queues[_0x26ac81['uniqueid']][_0x33c0('0x25')]=![];queues[_0x26ac81[_0x33c0('0x5')]][_0x33c0('0x26')]=null;queues[_0x26ac81['uniqueid']][_0x33c0('0x19')]=![];queues[_0x26ac81['uniqueid']][_0x33c0('0x9')]=null;queues[_0x26ac81[_0x33c0('0x5')]][_0x33c0('0x27')]=null;queues[_0x26ac81['uniqueid']]['assigned']=!![];queues[_0x26ac81[_0x33c0('0x5')]][_0x33c0('0x8')]=_0x26ac81[_0x33c0('0x3c')];queues[_0x26ac81['uniqueid']][_0x33c0('0x3d')]=_0x26ac81['membername'];}}catch(_0x1ad0fb){utils['error'](util[_0x33c0('0x3')](_0x33c0('0x39'),_0x26ac81['uniqueid']),_0x1ad0fb);}};exports['agentcomplete']=function(_0x21acd8){try{if(!_[_0x33c0('0x28')](queues[_0x21acd8['uniqueid']])){if(queues[_0x21acd8[_0x33c0('0x5')]][_0x33c0('0x34')]){utils['debug'](util[_0x33c0('0x3')](_0x33c0('0x3e'),_0x21acd8[_0x33c0('0x5')]),_0x21acd8);queues[_0x21acd8[_0x33c0('0x5')]]['queuecallerabandon']=![];queues[_0x21acd8['uniqueid']][_0x33c0('0x25')]=![];queues[_0x21acd8[_0x33c0('0x5')]]['queuecallerabandonAt']=null;queues[_0x21acd8['uniqueid']][_0x33c0('0x19')]=![];queues[_0x21acd8[_0x33c0('0x5')]][_0x33c0('0x27')]=null;queues[_0x21acd8[_0x33c0('0x5')]][_0x33c0('0x3f')]=!![];queues[_0x21acd8['uniqueid']]['lastAssignedTo']=_0x21acd8['membername'];queues[_0x21acd8[_0x33c0('0x5')]][_0x33c0('0x1a')]=!![];queues[_0x21acd8[_0x33c0('0x5')]][_0x33c0('0x40')]=utils[_0x33c0('0x16')]();if(_0x21acd8[_0x33c0('0x41')]=='transfer'){if(!queues[_0x21acd8[_0x33c0('0x5')]][_0x33c0('0x42')]){queues[_0x21acd8[_0x33c0('0x5')]][_0x33c0('0x9')]='TRANSFER';}}else{queues[_0x21acd8['uniqueid']][_0x33c0('0x9')]='COMPLETEDBY'+_0x21acd8[_0x33c0('0x41')][_0x33c0('0x23')]();}utils[_0x33c0('0x2')](util['format'](_0x33c0('0x43'),_0x21acd8[_0x33c0('0x5')],queues[_0x21acd8[_0x33c0('0x5')]][_0x33c0('0x1d')],_0x21acd8[_0x33c0('0x3b')],queues[_0x21acd8[_0x33c0('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x21acd8[_0x33c0('0x5')]]);}}}catch(_0x514f10){utils[_0x33c0('0x2f')](util[_0x33c0('0x3')](_0x33c0('0x3e'),_0x21acd8[_0x33c0('0x5')]),_0x514f10);}};exports[_0x33c0('0x44')]=function(_0x30026b){try{if(!_[_0x33c0('0x28')](queues[_0x30026b['transfereeuniqueid']])){utils[_0x33c0('0x11')](util[_0x33c0('0x3')](_0x33c0('0x45'),_0x30026b['uniqueid']),_0x30026b);queues[_0x30026b['transfereeuniqueid']]['transfer']=!![];queues[_0x30026b[_0x33c0('0x46')]][_0x33c0('0x47')]=_0x33c0('0x48');queues[_0x30026b['transfereeuniqueid']]['transferexten']=_0x30026b[_0x33c0('0x49')];queues[_0x30026b['transfereeuniqueid']][_0x33c0('0x4a')]=_0x30026b[_0x33c0('0x46')];queues[_0x30026b[_0x33c0('0x46')]]['queuecallerexitreason']=_0x33c0('0x4b');utils['info'](util[_0x33c0('0x3')](_0x33c0('0x4c'),_0x30026b[_0x33c0('0x5')],queues[_0x30026b['transfereeuniqueid']]['name'],_0x30026b['transfereeuniqueid'],_0x30026b['extension']));}}catch(_0x381403){utils['error'](util['format']('[%s][queues][blindtransfer]',_0x30026b[_0x33c0('0x5')]),_0x381403);}};exports[_0x33c0('0x4d')]=function(_0x94937a){try{utils[_0x33c0('0x11')](util['format']('[%s][queues][attendedtransfer]',_0x94937a['origtransfereruniqueid']),_0x94937a);if(_0x94937a[_0x33c0('0x4e')]==_0x94937a[_0x33c0('0x4f')]){if(!_[_0x33c0('0x28')](queues[_0x94937a[_0x33c0('0x50')]])){utils[_0x33c0('0x2')](util[_0x33c0('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x94937a[_0x33c0('0x4e')],queues[_0x94937a['secondtransfererlinkedid']][_0x33c0('0x1d')],_0x94937a[_0x33c0('0x51')]));queues[_0x94937a[_0x33c0('0x50')]][_0x33c0('0x42')]=!![];queues[_0x94937a[_0x33c0('0x50')]][_0x33c0('0x47')]='ATTENDED';queues[_0x94937a[_0x33c0('0x50')]][_0x33c0('0x52')]=_0x94937a[_0x33c0('0x51')];queues[_0x94937a[_0x33c0('0x50')]]['transferuniqueid']=_0x94937a[_0x33c0('0x4e')];queues[_0x94937a[_0x33c0('0x50')]]['queuecallerexitreason']=_0x33c0('0x53');}if(!_['isNil'](queues[_0x94937a['origtransfererlinkedid']])){if(_0x94937a[_0x33c0('0x54')]&&queues[_0x94937a[_0x33c0('0x54')]]){queues[_0x94937a['transfereelinkedid']][_0x33c0('0x55')]=0x1;queues[_0x94937a[_0x33c0('0x46')]]=_[_0x33c0('0x56')](queues[_0x94937a['transfereelinkedid']]);queues[_0x94937a['transfereeuniqueid']][_0x33c0('0x10')]=_0x94937a[_0x33c0('0x57')];queues[_0x94937a[_0x33c0('0x46')]][_0x33c0('0x55')]=0x2;queues[_0x94937a['transfereeuniqueid']][_0x33c0('0x7')]=queues[_0x94937a[_0x33c0('0x50')]][_0x33c0('0x7')];queues[_0x94937a[_0x33c0('0x46')]][_0x33c0('0x58')]=queues[_0x94937a['secondtransfererlinkedid']]['calleridname'];queues[_0x94937a[_0x33c0('0x46')]][_0x33c0('0x36')]=utils[_0x33c0('0x16')]();queues[_0x94937a[_0x33c0('0x46')]]['queuecallerleaveAt']=utils[_0x33c0('0x16')]();queues[_0x94937a['transfereeuniqueid']][_0x33c0('0x59')]=0x0;queues[_0x94937a[_0x33c0('0x46')]][_0x33c0('0x5a')]=0x0;utils[_0x33c0('0x2')](util[_0x33c0('0x3')](_0x33c0('0x5b'),_0x94937a[_0x33c0('0x4e')],queues[_0x94937a['transfereeuniqueid']][_0x33c0('0x1d')],queues[_0x94937a['transfereeuniqueid']]['calleridnum'],queues[_0x94937a[_0x33c0('0x46')]]['calleridname']));}else{utils[_0x33c0('0x2')](util[_0x33c0('0x3')](_0x33c0('0x5c'),_0x94937a['origtransfereruniqueid'],queues[_0x94937a[_0x33c0('0x4f')]][_0x33c0('0x1d')],_0x94937a[_0x33c0('0x50')]));queues[_0x94937a['origtransfererlinkedid']][_0x33c0('0x10')]=_0x94937a[_0x33c0('0x50')];}}}else if(_0x94937a[_0x33c0('0x5d')]==_0x94937a[_0x33c0('0x50')]){if(!_[_0x33c0('0x28')](queues[_0x94937a[_0x33c0('0x4f')]])){utils['info'](util[_0x33c0('0x3')](_0x33c0('0x5e'),_0x94937a[_0x33c0('0x4e')],queues[_0x94937a[_0x33c0('0x4f')]]['name'],_0x94937a[_0x33c0('0x5d')],_0x94937a[_0x33c0('0x5f')]));queues[_0x94937a[_0x33c0('0x4f')]]['transfer']=!![];queues[_0x94937a[_0x33c0('0x4f')]][_0x33c0('0x47')]=_0x33c0('0x60');queues[_0x94937a[_0x33c0('0x4f')]][_0x33c0('0x52')]=_0x94937a[_0x33c0('0x5f')];queues[_0x94937a[_0x33c0('0x4f')]]['transferuniqueid']=_0x94937a[_0x33c0('0x5d')];queues[_0x94937a['origtransfererlinkedid']][_0x33c0('0x9')]=_0x33c0('0x53');}if(!_[_0x33c0('0x28')](queues[_0x94937a['secondtransfererlinkedid']])){if(_0x94937a[_0x33c0('0x61')]&&queues[_0x94937a[_0x33c0('0x61')]]){queues[_0x94937a[_0x33c0('0x61')]][_0x33c0('0x55')]=0x1;queues[_0x94937a[_0x33c0('0x57')]]=_[_0x33c0('0x56')](queues[_0x94937a[_0x33c0('0x61')]]);queues[_0x94937a[_0x33c0('0x57')]][_0x33c0('0x10')]=_0x94937a[_0x33c0('0x57')];queues[_0x94937a[_0x33c0('0x57')]]['queuecallerenterreason']=0x2;queues[_0x94937a[_0x33c0('0x57')]]['calleridnum']=queues[_0x94937a[_0x33c0('0x4f')]][_0x33c0('0x7')];queues[_0x94937a[_0x33c0('0x57')]][_0x33c0('0x58')]=queues[_0x94937a[_0x33c0('0x4f')]][_0x33c0('0x58')];queues[_0x94937a['transfertargetuniqueid']][_0x33c0('0x36')]=utils[_0x33c0('0x16')]();queues[_0x94937a[_0x33c0('0x57')]][_0x33c0('0x34')]=utils[_0x33c0('0x16')]();queues[_0x94937a[_0x33c0('0x57')]][_0x33c0('0x59')]=0x0;queues[_0x94937a[_0x33c0('0x57')]][_0x33c0('0x5a')]=0x0;utils[_0x33c0('0x2')](util[_0x33c0('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x94937a['origtransfereruniqueid'],queues[_0x94937a[_0x33c0('0x57')]][_0x33c0('0x1d')],queues[_0x94937a[_0x33c0('0x57')]][_0x33c0('0x10')],queues[_0x94937a['transfertargetuniqueid']][_0x33c0('0x7')],queues[_0x94937a[_0x33c0('0x57')]]['calleridname']));}else{utils[_0x33c0('0x2')](util['format'](_0x33c0('0x5c'),_0x94937a[_0x33c0('0x4e')],queues[_0x94937a[_0x33c0('0x50')]][_0x33c0('0x1d')],_0x94937a[_0x33c0('0x4f')]));queues[_0x94937a[_0x33c0('0x50')]][_0x33c0('0x10')]=_0x94937a[_0x33c0('0x4f')];}}}}catch(_0x289d2f){utils[_0x33c0('0x2f')](util[_0x33c0('0x3')]('[%s][queues][attendedtransfer]',_0x94937a[_0x33c0('0x4e')]),_0x289d2f);}};exports[_0x33c0('0x62')]=function(_0x255c6d){try{if(!_['isNil'](queues[_0x255c6d[_0x33c0('0x5')]])){utils[_0x33c0('0x11')](util['format'](_0x33c0('0x63'),_0x255c6d['uniqueid']),_0x255c6d);queues[_0x255c6d[_0x33c0('0x5')]][_0x33c0('0x64')]=utils[_0x33c0('0x16')]();utils[_0x33c0('0x2')](util[_0x33c0('0x3')](_0x33c0('0x65'),_0x255c6d[_0x33c0('0x5')],queues[_0x255c6d[_0x33c0('0x5')]][_0x33c0('0x1d')],queues[_0x255c6d[_0x33c0('0x5')]][_0x33c0('0x64')]));}}catch(_0x3e956e){utils[_0x33c0('0x2f')](util[_0x33c0('0x3')]('[%s][queues][musiconholdstart]',_0x255c6d[_0x33c0('0x5')]),_0x3e956e);}};exports[_0x33c0('0x66')]=function(_0x497012){try{if(!_[_0x33c0('0x28')](queues[_0x497012[_0x33c0('0x5')]])){if(!_[_0x33c0('0x28')](queues[_0x497012[_0x33c0('0x5')]][_0x33c0('0x64')])){utils['debug'](util['format'](_0x33c0('0x67'),_0x497012['uniqueid']),_0x497012);queues[_0x497012[_0x33c0('0x5')]]['mohtime']+=utils[_0x33c0('0x35')](utils[_0x33c0('0x16')](),queues[_0x497012[_0x33c0('0x5')]][_0x33c0('0x64')]);utils[_0x33c0('0x2')](util[_0x33c0('0x3')](_0x33c0('0x68'),_0x497012[_0x33c0('0x5')],queues[_0x497012['uniqueid']][_0x33c0('0x1d')],queues[_0x497012[_0x33c0('0x5')]][_0x33c0('0x5a')]));delete queues[_0x497012[_0x33c0('0x5')]][_0x33c0('0x64')];}}}catch(_0x30a7ec){utils[_0x33c0('0x2f')](util[_0x33c0('0x3')]('[%s][queues][musiconholdstop]',_0x497012[_0x33c0('0x5')]),_0x30a7ec);}}; \ No newline at end of file +var _0x5edf=['[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','debug','[%s][queues][queuecallerjoin]','uniqueid','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','name','queueposition','queuecallerabandon','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','assigned','destaccountcode','[%s][queues][agentcomplete]','membername','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfererlinkedid','secondtransfererlinkedid','origtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','transfereelinkedid','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','holdtime','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]'];(function(_0x4fa2ae,_0xf5dbb){var _0x308880=function(_0x5931b6){while(--_0x5931b6){_0x4fa2ae['push'](_0x4fa2ae['shift']());}};_0x308880(++_0xf5dbb);}(_0x5edf,0xd3));var _0xf5ed=function(_0x6c85ac,_0x3a3c4c){_0x6c85ac=_0x6c85ac-0x0;var _0x3919fd=_0x5edf[_0x6c85ac];return _0x3919fd;};'use strict';var _=require(_0xf5ed('0x0'));var util=require(_0xf5ed('0x1'));var utils=require(_0xf5ed('0x2'));var queues={};function writeDB(_0x1f2dd1){utils[_0xf5ed('0x3')](util[_0xf5ed('0x4')](_0xf5ed('0x5'),_0x1f2dd1['uniqueid'],_0x1f2dd1['channel'],_0x1f2dd1['queue'],_0x1f2dd1[_0xf5ed('0x6')],_0x1f2dd1[_0xf5ed('0x7')],_0x1f2dd1[_0xf5ed('0x8')],_0x1f2dd1[_0xf5ed('0x9')]));if(_0x1f2dd1[_0xf5ed('0xa')]){utils[_0xf5ed('0xb')](_0x1f2dd1[_0xf5ed('0xa')])[_0xf5ed('0xc')](function(_0x44f67){if(_0x44f67){_0x1f2dd1[_0xf5ed('0xd')]=_0x44f67['type'];}utils[_0xf5ed('0xe')]('CreateVoiceQueueReport',_0x1f2dd1);});}else{utils[_0xf5ed('0xe')](_0xf5ed('0xf'),_0x1f2dd1);}if(_0x1f2dd1[_0xf5ed('0x10')]){delete queues[_0x1f2dd1['transfereduniqueid']];}else{delete queues[_0x1f2dd1['uniqueid']];}}exports['queuecallerjoin']=function(_0x30415c){try{utils[_0xf5ed('0x11')](util[_0xf5ed('0x4')](_0xf5ed('0x12'),_0x30415c[_0xf5ed('0x13')]),_0x30415c);utils['info'](util[_0xf5ed('0x4')](_0xf5ed('0x14'),_0x30415c[_0xf5ed('0x13')],_0x30415c[_0xf5ed('0xa')],_0x30415c[_0xf5ed('0x15')]));queues[_0x30415c[_0xf5ed('0x13')]]=_[_0xf5ed('0x16')](_0x30415c,{'originalposition':_0x30415c[_0xf5ed('0x15')],'queuecallerjoinAt':utils[_0xf5ed('0x17')](),'mohtime':0x0});}catch(_0x53f7d3){utils[_0xf5ed('0x18')](util['format']('[%s][queues][queuecallerjoin]',_0x30415c['uniqueid']),_0x53f7d3);}};exports['hangup']=function(_0x45e1e9){try{if(!_[_0xf5ed('0x19')](queues[_0x45e1e9[_0xf5ed('0x13')]])){utils['debug'](util['format'](_0xf5ed('0x1a'),_0x45e1e9[_0xf5ed('0x13')]),_0x45e1e9);if(queues[_0x45e1e9[_0xf5ed('0x13')]][_0xf5ed('0x1b')]){if(!queues[_0x45e1e9[_0xf5ed('0x13')]]['queuecallerabandon']&&!queues[_0x45e1e9[_0xf5ed('0x13')]][_0xf5ed('0x1c')]){queues[_0x45e1e9['uniqueid']][_0xf5ed('0x1d')]=!![];queues[_0x45e1e9[_0xf5ed('0x13')]][_0xf5ed('0x1e')]=utils[_0xf5ed('0x17')]();queues[_0x45e1e9[_0xf5ed('0x13')]]['queuecallerexitreason']=_0xf5ed('0x1f');}utils[_0xf5ed('0x3')](util['format'](_0xf5ed('0x20'),_0x45e1e9['uniqueid'],queues[_0x45e1e9[_0xf5ed('0x13')]]['name'],queues[_0x45e1e9[_0xf5ed('0x13')]][_0xf5ed('0x9')]));writeDB(queues[_0x45e1e9[_0xf5ed('0x13')]]);}else if(queues[_0x45e1e9[_0xf5ed('0x13')]][_0xf5ed('0x10')]){utils[_0xf5ed('0x3')](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x45e1e9['uniqueid'],queues[_0x45e1e9['uniqueid']]['name'],queues[_0x45e1e9[_0xf5ed('0x13')]][_0xf5ed('0x10')]));queues[queues[_0x45e1e9['uniqueid']][_0xf5ed('0x10')]]=queues[_0x45e1e9['uniqueid']];queues[queues[_0x45e1e9[_0xf5ed('0x13')]][_0xf5ed('0x10')]][_0xf5ed('0x21')]=0x2;delete queues[_0x45e1e9[_0xf5ed('0x13')]];}}}catch(_0x1d19a6){utils[_0xf5ed('0x18')](util[_0xf5ed('0x4')](_0xf5ed('0x1a'),_0x45e1e9['uniqueid']),_0x1d19a6);}};exports[_0xf5ed('0x22')]=function(_0x4fda37){try{utils[_0xf5ed('0x11')](util[_0xf5ed('0x4')](_0xf5ed('0x23'),_0x4fda37[_0xf5ed('0x13')]),_0x4fda37);if(!_[_0xf5ed('0x19')](_0x4fda37[_0xf5ed('0x24')][_0xf5ed('0x25')])&&_0x4fda37['value'][_0xf5ed('0x26')]()!==_0xf5ed('0x27')){if(!_[_0xf5ed('0x19')](queues[_0x4fda37[_0xf5ed('0x13')]])){queues[_0x4fda37['uniqueid']]['queuecallerabandon']=![];queues[_0x4fda37[_0xf5ed('0x13')]][_0xf5ed('0x28')]=null;queues[_0x4fda37[_0xf5ed('0x13')]][_0xf5ed('0x1c')]=!![];queues[_0x4fda37[_0xf5ed('0x13')]][_0xf5ed('0x29')]=utils[_0xf5ed('0x17')]();queues[_0x4fda37[_0xf5ed('0x13')]][_0xf5ed('0x9')]=_0x4fda37[_0xf5ed('0x2a')][_0xf5ed('0x26')]();utils[_0xf5ed('0x3')](util[_0xf5ed('0x4')](_0xf5ed('0x2b'),_0x4fda37[_0xf5ed('0x13')],queues[_0x4fda37[_0xf5ed('0x13')]][_0xf5ed('0x2c')],_0x4fda37[_0xf5ed('0x2a')],queues[_0x4fda37['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x4fda37[_0xf5ed('0x13')]]);}}else if(!_[_0xf5ed('0x19')](_0x4fda37[_0xf5ed('0x24')][_0xf5ed('0x2d')])){if(!_[_0xf5ed('0x19')](queues[_0x4fda37[_0xf5ed('0x13')]])&&!queues[_0x4fda37['uniqueid']][_0xf5ed('0x2e')]){queues[_0x4fda37[_0xf5ed('0x13')]][_0xf5ed('0x2e')]=![];queues[_0x4fda37[_0xf5ed('0x13')]]['queuecallerabandonAt']=null;queues[_0x4fda37[_0xf5ed('0x13')]][_0xf5ed('0x1c')]=!![];queues[_0x4fda37[_0xf5ed('0x13')]][_0xf5ed('0x29')]=utils['now']();queues[_0x4fda37[_0xf5ed('0x13')]]['queuecallerexitreason']=_0xf5ed('0x2f');utils[_0xf5ed('0x3')](util['format'](_0xf5ed('0x30'),_0x4fda37[_0xf5ed('0x13')],queues[_0x4fda37[_0xf5ed('0x13')]]['name'],_0x4fda37[_0xf5ed('0x2a')],queues[_0x4fda37['uniqueid']][_0xf5ed('0x9')]));}}}catch(_0x33733c){utils['error'](util[_0xf5ed('0x4')](_0xf5ed('0x23'),_0x4fda37['uniqueid']),_0x33733c);}};exports[_0xf5ed('0x2e')]=function(_0x4d6ae6){try{if(!_['isNil'](queues[_0x4d6ae6[_0xf5ed('0x13')]])){utils[_0xf5ed('0x11')](util[_0xf5ed('0x4')]('[%s][queues][queuecallerabandon]',_0x4d6ae6[_0xf5ed('0x13')]),_0x4d6ae6);queues[_0x4d6ae6['uniqueid']][_0xf5ed('0x1c')]=![];queues[_0x4d6ae6[_0xf5ed('0x13')]]['queuecallerexitAt']=null;queues[_0x4d6ae6[_0xf5ed('0x13')]][_0xf5ed('0x2e')]=!![];queues[_0x4d6ae6[_0xf5ed('0x13')]]['queuecallerabandonAt']=utils['now']();queues[_0x4d6ae6[_0xf5ed('0x13')]][_0xf5ed('0x9')]=_0xf5ed('0x31');utils[_0xf5ed('0x3')](util[_0xf5ed('0x4')](_0xf5ed('0x32'),_0x4d6ae6[_0xf5ed('0x13')],queues[_0x4d6ae6[_0xf5ed('0x13')]][_0xf5ed('0x2c')],queues[_0x4d6ae6['uniqueid']][_0xf5ed('0x9')]));}}catch(_0x261472){utils[_0xf5ed('0x18')](util[_0xf5ed('0x4')](_0xf5ed('0x33'),_0x4d6ae6[_0xf5ed('0x13')]),_0x261472);}};exports[_0xf5ed('0x34')]=function(_0x7d76fa){try{if(!_[_0xf5ed('0x19')](queues[_0x7d76fa[_0xf5ed('0x13')]])){utils['debug'](util[_0xf5ed('0x4')](_0xf5ed('0x35'),_0x7d76fa[_0xf5ed('0x13')]),_0x7d76fa);utils['info'](util[_0xf5ed('0x4')](_0xf5ed('0x36'),_0x7d76fa['uniqueid'],queues[_0x7d76fa[_0xf5ed('0x13')]][_0xf5ed('0x2c')],_0x7d76fa[_0xf5ed('0x37')],_0x7d76fa[_0xf5ed('0x38')]));queues[_0x7d76fa[_0xf5ed('0x13')]][_0xf5ed('0x34')]=!![];queues[_0x7d76fa[_0xf5ed('0x13')]][_0xf5ed('0x1b')]=utils[_0xf5ed('0x17')]();queues[_0x7d76fa[_0xf5ed('0x13')]]['holdtime']=utils[_0xf5ed('0x39')](queues[_0x7d76fa[_0xf5ed('0x13')]][_0xf5ed('0x1b')],queues[_0x7d76fa[_0xf5ed('0x13')]][_0xf5ed('0x3a')]);queues[_0x7d76fa[_0xf5ed('0x13')]]['position']=_0x7d76fa[_0xf5ed('0x15')];queues[_0x7d76fa['uniqueid']][_0xf5ed('0x3b')]=_0x7d76fa[_0xf5ed('0x3b')];queues[_0x7d76fa['uniqueid']][_0xf5ed('0x37')]=_0x7d76fa[_0xf5ed('0x37')];queues[_0x7d76fa['uniqueid']]['connectedlinename']=_0x7d76fa[_0xf5ed('0x38')];}}catch(_0x10f208){utils['error'](util[_0xf5ed('0x4')]('[%s][queues][queuecallerleave]',_0x7d76fa[_0xf5ed('0x13')]),_0x10f208);}};exports[_0xf5ed('0x3c')]=function(_0x3cf63e){try{if(!_[_0xf5ed('0x19')](queues[_0x3cf63e['uniqueid']])){utils[_0xf5ed('0x11')](util[_0xf5ed('0x4')](_0xf5ed('0x3d'),_0x3cf63e[_0xf5ed('0x13')]),_0x3cf63e);utils['info'](util[_0xf5ed('0x4')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x3cf63e[_0xf5ed('0x13')],queues[_0x3cf63e[_0xf5ed('0x13')]]['name'],_0x3cf63e['membername'],_0x3cf63e['destaccountcode']));queues[_0x3cf63e['uniqueid']][_0xf5ed('0x2e')]=![];queues[_0x3cf63e[_0xf5ed('0x13')]][_0xf5ed('0x2e')]=![];queues[_0x3cf63e[_0xf5ed('0x13')]][_0xf5ed('0x28')]=null;queues[_0x3cf63e[_0xf5ed('0x13')]][_0xf5ed('0x1c')]=![];queues[_0x3cf63e[_0xf5ed('0x13')]][_0xf5ed('0x9')]=null;queues[_0x3cf63e[_0xf5ed('0x13')]][_0xf5ed('0x29')]=null;queues[_0x3cf63e[_0xf5ed('0x13')]][_0xf5ed('0x3e')]=!![];queues[_0x3cf63e[_0xf5ed('0x13')]][_0xf5ed('0x8')]=_0x3cf63e[_0xf5ed('0x3f')];queues[_0x3cf63e[_0xf5ed('0x13')]][_0xf5ed('0x6')]=_0x3cf63e['membername'];}}catch(_0x593052){utils['error'](util[_0xf5ed('0x4')](_0xf5ed('0x3d'),_0x3cf63e['uniqueid']),_0x593052);}};exports['agentcomplete']=function(_0x2b1182){try{if(!_[_0xf5ed('0x19')](queues[_0x2b1182['uniqueid']])){if(queues[_0x2b1182['uniqueid']][_0xf5ed('0x1b')]){utils['debug'](util[_0xf5ed('0x4')](_0xf5ed('0x40'),_0x2b1182[_0xf5ed('0x13')]),_0x2b1182);queues[_0x2b1182[_0xf5ed('0x13')]]['queuecallerabandon']=![];queues[_0x2b1182[_0xf5ed('0x13')]][_0xf5ed('0x2e')]=![];queues[_0x2b1182[_0xf5ed('0x13')]]['queuecallerabandonAt']=null;queues[_0x2b1182[_0xf5ed('0x13')]][_0xf5ed('0x1c')]=![];queues[_0x2b1182[_0xf5ed('0x13')]][_0xf5ed('0x29')]=null;queues[_0x2b1182[_0xf5ed('0x13')]][_0xf5ed('0x3e')]=!![];queues[_0x2b1182[_0xf5ed('0x13')]][_0xf5ed('0x6')]=_0x2b1182[_0xf5ed('0x41')];queues[_0x2b1182[_0xf5ed('0x13')]][_0xf5ed('0x1d')]=!![];queues[_0x2b1182[_0xf5ed('0x13')]]['queuecallercompleteAt']=utils[_0xf5ed('0x17')]();if(_0x2b1182[_0xf5ed('0x42')]==_0xf5ed('0x43')){if(!queues[_0x2b1182[_0xf5ed('0x13')]][_0xf5ed('0x43')]){queues[_0x2b1182[_0xf5ed('0x13')]][_0xf5ed('0x9')]='TRANSFER';}}else{queues[_0x2b1182['uniqueid']]['queuecallerexitreason']=_0xf5ed('0x44')+_0x2b1182[_0xf5ed('0x42')][_0xf5ed('0x26')]();}utils[_0xf5ed('0x3')](util[_0xf5ed('0x4')](_0xf5ed('0x45'),_0x2b1182[_0xf5ed('0x13')],queues[_0x2b1182[_0xf5ed('0x13')]][_0xf5ed('0x2c')],_0x2b1182[_0xf5ed('0x41')],queues[_0x2b1182['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x2b1182[_0xf5ed('0x13')]]);}}}catch(_0x13f6c2){utils[_0xf5ed('0x18')](util[_0xf5ed('0x4')](_0xf5ed('0x40'),_0x2b1182[_0xf5ed('0x13')]),_0x13f6c2);}};exports[_0xf5ed('0x46')]=function(_0x408df3){try{if(!_[_0xf5ed('0x19')](queues[_0x408df3[_0xf5ed('0x47')]])){utils['debug'](util['format']('[%s][queues][blindtransfer]',_0x408df3['uniqueid']),_0x408df3);queues[_0x408df3[_0xf5ed('0x47')]]['transfer']=!![];queues[_0x408df3[_0xf5ed('0x47')]][_0xf5ed('0x48')]=_0xf5ed('0x49');queues[_0x408df3[_0xf5ed('0x47')]]['transferexten']=_0x408df3[_0xf5ed('0x4a')];queues[_0x408df3[_0xf5ed('0x47')]][_0xf5ed('0x4b')]=_0x408df3[_0xf5ed('0x47')];queues[_0x408df3[_0xf5ed('0x47')]][_0xf5ed('0x9')]=_0xf5ed('0x4c');utils['info'](util[_0xf5ed('0x4')](_0xf5ed('0x4d'),_0x408df3[_0xf5ed('0x13')],queues[_0x408df3[_0xf5ed('0x47')]][_0xf5ed('0x2c')],_0x408df3['transfereeuniqueid'],_0x408df3[_0xf5ed('0x4a')]));}}catch(_0xb7ae93){utils[_0xf5ed('0x18')](util[_0xf5ed('0x4')](_0xf5ed('0x4e'),_0x408df3[_0xf5ed('0x13')]),_0xb7ae93);}};exports[_0xf5ed('0x4f')]=function(_0x3c0175){try{utils[_0xf5ed('0x11')](util[_0xf5ed('0x4')](_0xf5ed('0x50'),_0x3c0175['origtransfereruniqueid']),_0x3c0175);if(_0x3c0175['origtransfereruniqueid']==_0x3c0175[_0xf5ed('0x51')]){if(!_[_0xf5ed('0x19')](queues[_0x3c0175[_0xf5ed('0x52')]])){utils[_0xf5ed('0x3')](util[_0xf5ed('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x3c0175[_0xf5ed('0x53')],queues[_0x3c0175[_0xf5ed('0x52')]][_0xf5ed('0x2c')],_0x3c0175['origtransfererexten']));queues[_0x3c0175[_0xf5ed('0x52')]][_0xf5ed('0x43')]=!![];queues[_0x3c0175[_0xf5ed('0x52')]][_0xf5ed('0x48')]=_0xf5ed('0x54');queues[_0x3c0175[_0xf5ed('0x52')]][_0xf5ed('0x55')]=_0x3c0175[_0xf5ed('0x56')];queues[_0x3c0175['secondtransfererlinkedid']][_0xf5ed('0x4b')]=_0x3c0175[_0xf5ed('0x53')];queues[_0x3c0175[_0xf5ed('0x52')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_[_0xf5ed('0x19')](queues[_0x3c0175[_0xf5ed('0x51')]])){if(_0x3c0175[_0xf5ed('0x57')]&&queues[_0x3c0175['transfereelinkedid']]){queues[_0x3c0175['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x3c0175[_0xf5ed('0x47')]]=_['clone'](queues[_0x3c0175[_0xf5ed('0x57')]]);queues[_0x3c0175[_0xf5ed('0x47')]][_0xf5ed('0x10')]=_0x3c0175[_0xf5ed('0x58')];queues[_0x3c0175[_0xf5ed('0x47')]]['queuecallerenterreason']=0x2;queues[_0x3c0175[_0xf5ed('0x47')]][_0xf5ed('0x7')]=queues[_0x3c0175[_0xf5ed('0x52')]][_0xf5ed('0x7')];queues[_0x3c0175['transfereeuniqueid']][_0xf5ed('0x59')]=queues[_0x3c0175[_0xf5ed('0x52')]][_0xf5ed('0x59')];queues[_0x3c0175[_0xf5ed('0x47')]][_0xf5ed('0x3a')]=utils[_0xf5ed('0x17')]();queues[_0x3c0175[_0xf5ed('0x47')]][_0xf5ed('0x1b')]=utils['now']();queues[_0x3c0175['transfereeuniqueid']]['holdtime']=0x0;queues[_0x3c0175['transfereeuniqueid']][_0xf5ed('0x5a')]=0x0;utils[_0xf5ed('0x3')](util[_0xf5ed('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x3c0175[_0xf5ed('0x53')],queues[_0x3c0175[_0xf5ed('0x47')]][_0xf5ed('0x2c')],queues[_0x3c0175['transfereeuniqueid']][_0xf5ed('0x7')],queues[_0x3c0175['transfereeuniqueid']][_0xf5ed('0x59')]));}else{utils[_0xf5ed('0x3')](util['format'](_0xf5ed('0x5b'),_0x3c0175[_0xf5ed('0x53')],queues[_0x3c0175[_0xf5ed('0x51')]][_0xf5ed('0x2c')],_0x3c0175['secondtransfererlinkedid']));queues[_0x3c0175[_0xf5ed('0x51')]]['transfereduniqueid']=_0x3c0175[_0xf5ed('0x52')];}}}else if(_0x3c0175[_0xf5ed('0x5c')]==_0x3c0175[_0xf5ed('0x52')]){if(!_[_0xf5ed('0x19')](queues[_0x3c0175['origtransfererlinkedid']])){utils[_0xf5ed('0x3')](util[_0xf5ed('0x4')](_0xf5ed('0x5d'),_0x3c0175[_0xf5ed('0x53')],queues[_0x3c0175[_0xf5ed('0x51')]][_0xf5ed('0x2c')],_0x3c0175['secondtransfereruniqueid'],_0x3c0175[_0xf5ed('0x5e')]));queues[_0x3c0175[_0xf5ed('0x51')]][_0xf5ed('0x43')]=!![];queues[_0x3c0175['origtransfererlinkedid']][_0xf5ed('0x48')]=_0xf5ed('0x54');queues[_0x3c0175[_0xf5ed('0x51')]]['transferexten']=_0x3c0175[_0xf5ed('0x5e')];queues[_0x3c0175[_0xf5ed('0x51')]][_0xf5ed('0x4b')]=_0x3c0175[_0xf5ed('0x5c')];queues[_0x3c0175[_0xf5ed('0x51')]][_0xf5ed('0x9')]=_0xf5ed('0x5f');}if(!_[_0xf5ed('0x19')](queues[_0x3c0175[_0xf5ed('0x52')]])){if(_0x3c0175[_0xf5ed('0x60')]&&queues[_0x3c0175[_0xf5ed('0x60')]]){queues[_0x3c0175['transfertargetlinkedid']][_0xf5ed('0x21')]=0x1;queues[_0x3c0175[_0xf5ed('0x58')]]=_['clone'](queues[_0x3c0175['transfertargetlinkedid']]);queues[_0x3c0175['transfertargetuniqueid']][_0xf5ed('0x10')]=_0x3c0175['transfertargetuniqueid'];queues[_0x3c0175['transfertargetuniqueid']][_0xf5ed('0x21')]=0x2;queues[_0x3c0175[_0xf5ed('0x58')]][_0xf5ed('0x7')]=queues[_0x3c0175['origtransfererlinkedid']]['calleridnum'];queues[_0x3c0175[_0xf5ed('0x58')]]['calleridname']=queues[_0x3c0175['origtransfererlinkedid']][_0xf5ed('0x59')];queues[_0x3c0175[_0xf5ed('0x58')]][_0xf5ed('0x3a')]=utils[_0xf5ed('0x17')]();queues[_0x3c0175[_0xf5ed('0x58')]][_0xf5ed('0x1b')]=utils[_0xf5ed('0x17')]();queues[_0x3c0175[_0xf5ed('0x58')]][_0xf5ed('0x61')]=0x0;queues[_0x3c0175['transfertargetuniqueid']]['mohtime']=0x0;utils[_0xf5ed('0x3')](util[_0xf5ed('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x3c0175['origtransfereruniqueid'],queues[_0x3c0175[_0xf5ed('0x58')]][_0xf5ed('0x2c')],queues[_0x3c0175[_0xf5ed('0x58')]][_0xf5ed('0x10')],queues[_0x3c0175[_0xf5ed('0x58')]][_0xf5ed('0x7')],queues[_0x3c0175['transfertargetuniqueid']][_0xf5ed('0x59')]));}else{utils[_0xf5ed('0x3')](util[_0xf5ed('0x4')](_0xf5ed('0x5b'),_0x3c0175[_0xf5ed('0x53')],queues[_0x3c0175[_0xf5ed('0x52')]]['name'],_0x3c0175[_0xf5ed('0x51')]));queues[_0x3c0175[_0xf5ed('0x52')]][_0xf5ed('0x10')]=_0x3c0175[_0xf5ed('0x51')];}}}}catch(_0x41e106){utils[_0xf5ed('0x18')](util[_0xf5ed('0x4')](_0xf5ed('0x50'),_0x3c0175[_0xf5ed('0x53')]),_0x41e106);}};exports[_0xf5ed('0x62')]=function(_0x21e9e5){try{if(!_[_0xf5ed('0x19')](queues[_0x21e9e5[_0xf5ed('0x13')]])){utils[_0xf5ed('0x11')](util['format']('[%s][queues][musiconholdstart]',_0x21e9e5[_0xf5ed('0x13')]),_0x21e9e5);queues[_0x21e9e5['uniqueid']][_0xf5ed('0x63')]=utils[_0xf5ed('0x17')]();utils[_0xf5ed('0x3')](util[_0xf5ed('0x4')](_0xf5ed('0x64'),_0x21e9e5[_0xf5ed('0x13')],queues[_0x21e9e5[_0xf5ed('0x13')]]['name'],queues[_0x21e9e5[_0xf5ed('0x13')]][_0xf5ed('0x63')]));}}catch(_0x2f7825){utils[_0xf5ed('0x18')](util[_0xf5ed('0x4')](_0xf5ed('0x65'),_0x21e9e5[_0xf5ed('0x13')]),_0x2f7825);}};exports[_0xf5ed('0x66')]=function(_0x3fb1fb){try{if(!_['isNil'](queues[_0x3fb1fb[_0xf5ed('0x13')]])){if(!_['isNil'](queues[_0x3fb1fb['uniqueid']]['musiconholdstartAt'])){utils[_0xf5ed('0x11')](util[_0xf5ed('0x4')](_0xf5ed('0x67'),_0x3fb1fb['uniqueid']),_0x3fb1fb);queues[_0x3fb1fb[_0xf5ed('0x13')]][_0xf5ed('0x5a')]+=utils[_0xf5ed('0x39')](utils[_0xf5ed('0x17')](),queues[_0x3fb1fb[_0xf5ed('0x13')]][_0xf5ed('0x63')]);utils[_0xf5ed('0x3')](util[_0xf5ed('0x4')](_0xf5ed('0x68'),_0x3fb1fb['uniqueid'],queues[_0x3fb1fb[_0xf5ed('0x13')]][_0xf5ed('0x2c')],queues[_0x3fb1fb[_0xf5ed('0x13')]][_0xf5ed('0x5a')]));delete queues[_0x3fb1fb[_0xf5ed('0x13')]][_0xf5ed('0x63')];}}}catch(_0x8433c8){utils['error'](util[_0xf5ed('0x4')]('[%s][queues][musiconholdstop]',_0x3fb1fb['uniqueid']),_0x8433c8);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 7fcb39a..6907b94 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 _0x8a13=['[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','CreateVoiceRecording','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','appdata','toLowerCase','cdr','split','substring'];(function(_0x384fc4,_0x1740d6){var _0x292817=function(_0x50249c){while(--_0x50249c){_0x384fc4['push'](_0x384fc4['shift']());}};_0x292817(++_0x1740d6);}(_0x8a13,0x16b));var _0x38a1=function(_0x5d6448,_0x53522f){_0x5d6448=_0x5d6448-0x0;var _0x58c195=_0x8a13[_0x5d6448];return _0x58c195;};'use strict';var _=require(_0x38a1('0x0'));var util=require('util');var utils=require(_0x38a1('0x1'));var recordings={};function writeDB(_0x50ecd8){utils[_0x38a1('0x2')](util[_0x38a1('0x3')](_0x38a1('0x4'),_0x50ecd8[_0x38a1('0x5')]));if(_0x50ecd8[_0x38a1('0x6')]){utils[_0x38a1('0x7')](_0x50ecd8[_0x38a1('0x6')])[_0x38a1('0x8')](function(_0x1517af){if(_0x1517af){_0x50ecd8[_0x38a1('0x9')]=_0x1517af[_0x38a1('0xa')];_0x50ecd8[_0x38a1('0xb')]=_0x1517af['id'];}utils['request'](_0x38a1('0xc'),_0x50ecd8);});}else{utils['request'](_0x38a1('0xc'),_0x50ecd8);}}exports['newchannel']=function(_0x1f3be4){try{utils[_0x38a1('0xd')](util[_0x38a1('0x3')](_0x38a1('0xe'),_0x1f3be4[_0x38a1('0x5')]),_0x1f3be4);if(_0x1f3be4[_0x38a1('0x5')]==_0x1f3be4[_0x38a1('0xf')]){utils[_0x38a1('0x2')](util['format'](_0x38a1('0x10'),_0x1f3be4[_0x38a1('0x5')],_0x1f3be4['context'],_0x1f3be4[_0x38a1('0x11')]));recordings[_0x1f3be4[_0x38a1('0x5')]]={'uniqueid':_0x1f3be4[_0x38a1('0x5')],'accountcode':_0x1f3be4['accountcode'],'exten':_0x1f3be4[_0x38a1('0x11')],'context':_0x1f3be4[_0x38a1('0x12')],'channel':_0x1f3be4[_0x38a1('0x13')],'monitors':[]};}}catch(_0x4e4fc9){utils[_0x38a1('0x14')](util[_0x38a1('0x3')]('[%s][recordings][newchannel]',_0x1f3be4[_0x38a1('0x5')]),_0x4e4fc9);}};exports[_0x38a1('0x15')]=function(_0x3c0577){try{utils[_0x38a1('0xd')](util[_0x38a1('0x3')]('[%s][recordings][newstate]',_0x3c0577[_0x38a1('0x5')]),_0x3c0577);if(!_[_0x38a1('0x16')](recordings[_0x3c0577[_0x38a1('0x5')]])&&_0x3c0577[_0x38a1('0x17')]==0x6){utils[_0x38a1('0x2')](util[_0x38a1('0x3')](_0x38a1('0x18'),_0x3c0577[_0x38a1('0x5')],_0x3c0577[_0x38a1('0x12')],_0x3c0577[_0x38a1('0x13')]));}else if(!_[_0x38a1('0x16')](recordings[_0x3c0577['linkedid']])&&_0x3c0577[_0x38a1('0x17')]==0x6&&_0x3c0577['context']!='transfer'){utils[_0x38a1('0x2')](util[_0x38a1('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x3c0577[_0x38a1('0x5')],_0x3c0577['linkedid'],_0x3c0577[_0x38a1('0x12')],_0x3c0577[_0x38a1('0x13')]));recordings[_0x3c0577[_0x38a1('0xf')]][_0x38a1('0x6')]=_0x3c0577[_0x38a1('0x6')];}}catch(_0xb96a40){utils[_0x38a1('0x14')](util[_0x38a1('0x3')](_0x38a1('0x19'),_0x3c0577[_0x38a1('0x5')]),_0xb96a40);}};exports['varset']=function(_0x2d5bf0){try{if(!_['isNil'](_0x2d5bf0[_0x38a1('0x1a')])&&!_[_0x38a1('0x16')](_0x2d5bf0[_0x38a1('0x1a')][_0x38a1('0x1b')])){utils[_0x38a1('0xd')](util[_0x38a1('0x3')]('[%s][recordings][varset]',_0x2d5bf0[_0x38a1('0x5')]),_0x2d5bf0);utils['info'](util[_0x38a1('0x3')](_0x38a1('0x1c'),_0x2d5bf0['uniqueid'],_0x2d5bf0[_0x38a1('0x1a')],_0x2d5bf0[_0x38a1('0x1d')]));if(_['endsWith'](_0x2d5bf0[_0x38a1('0x1d')],_0x38a1('0x1e'))){_0x2d5bf0[_0x38a1('0x1d')]=_0x2d5bf0[_0x38a1('0x1d')][_0x38a1('0x1f')](_0x38a1('0x1e'),'.WAV');}if(recordings[_0x2d5bf0['linkedid']]){var _0x925120=_[_0x38a1('0x20')](recordings[_0x2d5bf0[_0x38a1('0xf')]][_0x38a1('0x21')],{'value':_0x2d5bf0[_0x38a1('0x1d')]});if(_[_0x38a1('0x16')](_0x925120)){recordings[_0x2d5bf0[_0x38a1('0xf')]][_0x38a1('0x21')][_0x38a1('0x22')]({'value':_0x2d5bf0[_0x38a1('0x1d')]});}}}}catch(_0x5206af){utils[_0x38a1('0x14')](util['format']('[%s][recordings][varset]',_0x2d5bf0[_0x38a1('0x5')]),_0x5206af);}};exports[_0x38a1('0x23')]=function(_0x4c3d59){try{if(!_['isNil'](recordings[_0x4c3d59['uniqueid']])){utils[_0x38a1('0xd')](util[_0x38a1('0x3')](_0x38a1('0x24'),_0x4c3d59[_0x38a1('0x5')]),_0x4c3d59);utils[_0x38a1('0x2')](util[_0x38a1('0x3')](_0x38a1('0x25'),_0x4c3d59[_0x38a1('0x5')],_0x4c3d59['calleridnum'],_0x4c3d59[_0x38a1('0x26')],_0x4c3d59['cause-txt']));recordings[_0x4c3d59[_0x38a1('0x5')]][_0x38a1('0x27')]=_0x4c3d59['calleridnum'];recordings[_0x4c3d59[_0x38a1('0x5')]][_0x38a1('0x26')]=_0x4c3d59[_0x38a1('0x26')];recordings[_0x4c3d59['uniqueid']]['connectedlinenum']=_0x4c3d59[_0x38a1('0x28')];recordings[_0x4c3d59[_0x38a1('0x5')]][_0x38a1('0x29')]=_0x4c3d59[_0x38a1('0x29')];if(recordings[_0x4c3d59['uniqueid']][_0x38a1('0x2a')]==_0x38a1('0x2b')&&recordings[_0x4c3d59[_0x38a1('0x5')]]['accountcode']){recordings[_0x4c3d59[_0x38a1('0x5')]][_0x38a1('0x28')]=recordings[_0x4c3d59[_0x38a1('0x5')]][_0x38a1('0x6')];recordings[_0x4c3d59['uniqueid']][_0x38a1('0x29')]='';}recordings[_0x4c3d59[_0x38a1('0x5')]][_0x38a1('0x21')][_0x38a1('0x2c')](function(_0x2998be){var _0x4737ad=_[_0x38a1('0x2d')](recordings[_0x4c3d59['uniqueid']]);_0x4737ad[_0x38a1('0x1d')]=_0x2998be[_0x38a1('0x1d')];writeDB(_0x4737ad);});delete recordings[_0x4c3d59[_0x38a1('0x5')]];}}catch(_0x1b2923){utils[_0x38a1('0x14')](util['format']('[%s][recordings][hangup]',_0x4c3d59[_0x38a1('0x5')]),_0x1b2923);}};exports[_0x38a1('0x2e')]=function(_0x1fba81){try{if(!_[_0x38a1('0x16')](recordings[_0x1fba81[_0x38a1('0x5')]])){utils['debug'](util['format'](_0x38a1('0x2f'),_0x1fba81[_0x38a1('0x5')]),_0x1fba81);utils[_0x38a1('0x2')](util['format'](_0x38a1('0x30'),_0x1fba81[_0x38a1('0x5')],_0x1fba81[_0x38a1('0x31')],_0x1fba81['appdata']));if(_0x1fba81[_0x38a1('0x31')]['toLowerCase']()==_0x38a1('0x32')&&_[_0x38a1('0x33')](_0x1fba81[_0x38a1('0x34')][_0x38a1('0x35')](),_0x38a1('0x36'))){var _0x414698=_0x1fba81[_0x38a1('0x34')][_0x38a1('0x37')]('=');var _0x51610e=_0x414698[0x0][_0x38a1('0x38')](_0x414698[0x0]['lastIndexOf']('(')+0x1,_0x414698[0x0]['lastIndexOf'](')'));var _0x191c3f=_0x414698[0x1];recordings[_0x1fba81[_0x38a1('0x5')]][_0x51610e]=_0x191c3f;}}}catch(_0x5c13fe){utils[_0x38a1('0x14')](util['format'](_0x38a1('0x2f'),_0x1fba81[_0x38a1('0x5')]),_0x5c13fe);}};exports['queuecallerjoin']=function(_0x190025){try{if(!_[_0x38a1('0x16')](recordings[_0x190025[_0x38a1('0x5')]])){utils[_0x38a1('0xd')](util[_0x38a1('0x3')]('[%s][recordings][queuecallerjoin]',_0x190025[_0x38a1('0x5')]),_0x190025);utils[_0x38a1('0x2')](util[_0x38a1('0x3')](_0x38a1('0x39'),_0x190025[_0x38a1('0x5')],_0x190025[_0x38a1('0x3a')]));recordings[_0x190025[_0x38a1('0x5')]]['queue']=_0x190025[_0x38a1('0x3a')];}}catch(_0x1e3270){utils['error'](util['format'](_0x38a1('0x3b'),_0x190025[_0x38a1('0x5')]),_0x1e3270);}}; \ No newline at end of file +var _0xf40e=['[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','info','[%s][recordings][writeDB]','uniqueid','accountcode','membername','name','UserId','CreateVoiceRecording','request','newchannel','format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','isNil','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','find','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','type','outbound','connectedlinename','forEach','[%s][recordings][hangup]','newexten','debug','[%s][recordings][newexten]','application','toLowerCase','set','startsWith','appdata','cdr','substring','queuecallerjoin','[%s][recordings][queuecallerjoin]'];(function(_0x1c0cd9,_0x44b4a5){var _0x2ddab3=function(_0x24f831){while(--_0x24f831){_0x1c0cd9['push'](_0x1c0cd9['shift']());}};_0x2ddab3(++_0x44b4a5);}(_0xf40e,0x170));var _0xef40=function(_0x1cea81,_0x2c08ee){_0x1cea81=_0x1cea81-0x0;var _0x497871=_0xf40e[_0x1cea81];return _0x497871;};'use strict';var _=require(_0xef40('0x0'));var util=require('util');var utils=require('./utils');var recordings={};function writeDB(_0x4b444b){utils[_0xef40('0x1')](util['format'](_0xef40('0x2'),_0x4b444b[_0xef40('0x3')]));if(_0x4b444b[_0xef40('0x4')]){utils['getUserByInternal'](_0x4b444b[_0xef40('0x4')])['then'](function(_0x271cfc){if(_0x271cfc){_0x4b444b[_0xef40('0x5')]=_0x271cfc[_0xef40('0x6')];_0x4b444b[_0xef40('0x7')]=_0x271cfc['id'];}utils['request'](_0xef40('0x8'),_0x4b444b);});}else{utils[_0xef40('0x9')](_0xef40('0x8'),_0x4b444b);}}exports[_0xef40('0xa')]=function(_0x17fb5d){try{utils['debug'](util[_0xef40('0xb')](_0xef40('0xc'),_0x17fb5d[_0xef40('0x3')]),_0x17fb5d);if(_0x17fb5d['uniqueid']==_0x17fb5d[_0xef40('0xd')]){utils['info'](util['format'](_0xef40('0xe'),_0x17fb5d['uniqueid'],_0x17fb5d[_0xef40('0xf')],_0x17fb5d[_0xef40('0x10')]));recordings[_0x17fb5d[_0xef40('0x3')]]={'uniqueid':_0x17fb5d[_0xef40('0x3')],'accountcode':_0x17fb5d[_0xef40('0x4')],'exten':_0x17fb5d[_0xef40('0x10')],'context':_0x17fb5d[_0xef40('0xf')],'channel':_0x17fb5d[_0xef40('0x11')],'monitors':[]};}}catch(_0x114d8d){utils[_0xef40('0x12')](util[_0xef40('0xb')](_0xef40('0xc'),_0x17fb5d['uniqueid']),_0x114d8d);}};exports[_0xef40('0x13')]=function(_0x2e2679){try{utils['debug'](util[_0xef40('0xb')]('[%s][recordings][newstate]',_0x2e2679[_0xef40('0x3')]),_0x2e2679);if(!_['isNil'](recordings[_0x2e2679[_0xef40('0x3')]])&&_0x2e2679['channelstate']==0x6){utils[_0xef40('0x1')](util[_0xef40('0xb')](_0xef40('0x14'),_0x2e2679[_0xef40('0x3')],_0x2e2679[_0xef40('0xf')],_0x2e2679['channel']));}else if(!_[_0xef40('0x15')](recordings[_0x2e2679['linkedid']])&&_0x2e2679[_0xef40('0x16')]==0x6&&_0x2e2679['context']!=_0xef40('0x17')){utils['info'](util['format'](_0xef40('0x18'),_0x2e2679[_0xef40('0x3')],_0x2e2679[_0xef40('0xd')],_0x2e2679[_0xef40('0xf')],_0x2e2679[_0xef40('0x11')]));recordings[_0x2e2679[_0xef40('0xd')]][_0xef40('0x4')]=_0x2e2679[_0xef40('0x4')];}}catch(_0x2b51cd){utils[_0xef40('0x12')](util['format'](_0xef40('0x19'),_0x2e2679['uniqueid']),_0x2b51cd);}};exports[_0xef40('0x1a')]=function(_0x102dd2){try{if(!_['isNil'](_0x102dd2[_0xef40('0x1b')])&&!_[_0xef40('0x15')](_0x102dd2['variable'][_0xef40('0x1c')])){utils['debug'](util[_0xef40('0xb')]('[%s][recordings][varset]',_0x102dd2[_0xef40('0x3')]),_0x102dd2);utils[_0xef40('0x1')](util[_0xef40('0xb')](_0xef40('0x1d'),_0x102dd2['uniqueid'],_0x102dd2[_0xef40('0x1b')],_0x102dd2[_0xef40('0x1e')]));if(_['endsWith'](_0x102dd2[_0xef40('0x1e')],_0xef40('0x1f'))){_0x102dd2['value']=_0x102dd2[_0xef40('0x1e')][_0xef40('0x20')](_0xef40('0x1f'),'.WAV');}if(recordings[_0x102dd2[_0xef40('0xd')]]){var _0x8441dc=_[_0xef40('0x21')](recordings[_0x102dd2['linkedid']][_0xef40('0x22')],{'value':_0x102dd2['value']});if(_['isNil'](_0x8441dc)){recordings[_0x102dd2['linkedid']][_0xef40('0x22')][_0xef40('0x23')]({'value':_0x102dd2[_0xef40('0x1e')]});}}}}catch(_0x2ac1dc){utils[_0xef40('0x12')](util['format'](_0xef40('0x24'),_0x102dd2[_0xef40('0x3')]),_0x2ac1dc);}};exports['hangup']=function(_0x3d3a16){try{if(!_[_0xef40('0x15')](recordings[_0x3d3a16[_0xef40('0x3')]])){utils['debug'](util[_0xef40('0xb')]('[%s][recordings][hangup]',_0x3d3a16[_0xef40('0x3')]),_0x3d3a16);utils[_0xef40('0x1')](util[_0xef40('0xb')](_0xef40('0x25'),_0x3d3a16[_0xef40('0x3')],_0x3d3a16[_0xef40('0x26')],_0x3d3a16[_0xef40('0x27')],_0x3d3a16[_0xef40('0x28')]));recordings[_0x3d3a16[_0xef40('0x3')]][_0xef40('0x26')]=_0x3d3a16['calleridnum'];recordings[_0x3d3a16[_0xef40('0x3')]][_0xef40('0x27')]=_0x3d3a16[_0xef40('0x27')];recordings[_0x3d3a16[_0xef40('0x3')]][_0xef40('0x29')]=_0x3d3a16['connectedlinenum'];recordings[_0x3d3a16['uniqueid']]['connectedlinename']=_0x3d3a16['connectedlinename'];if(recordings[_0x3d3a16['uniqueid']][_0xef40('0x2a')]==_0xef40('0x2b')&&recordings[_0x3d3a16[_0xef40('0x3')]][_0xef40('0x4')]){recordings[_0x3d3a16[_0xef40('0x3')]][_0xef40('0x29')]=recordings[_0x3d3a16[_0xef40('0x3')]][_0xef40('0x4')];recordings[_0x3d3a16[_0xef40('0x3')]][_0xef40('0x2c')]='';}recordings[_0x3d3a16[_0xef40('0x3')]]['monitors'][_0xef40('0x2d')](function(_0x17ed34){var _0x440bfd=_['clone'](recordings[_0x3d3a16[_0xef40('0x3')]]);_0x440bfd['value']=_0x17ed34[_0xef40('0x1e')];writeDB(_0x440bfd);});delete recordings[_0x3d3a16[_0xef40('0x3')]];}}catch(_0x5e0023){utils[_0xef40('0x12')](util[_0xef40('0xb')](_0xef40('0x2e'),_0x3d3a16[_0xef40('0x3')]),_0x5e0023);}};exports[_0xef40('0x2f')]=function(_0x5bd50c){try{if(!_[_0xef40('0x15')](recordings[_0x5bd50c['uniqueid']])){utils[_0xef40('0x30')](util[_0xef40('0xb')](_0xef40('0x31'),_0x5bd50c[_0xef40('0x3')]),_0x5bd50c);utils[_0xef40('0x1')](util[_0xef40('0xb')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x5bd50c['uniqueid'],_0x5bd50c[_0xef40('0x32')],_0x5bd50c['appdata']));if(_0x5bd50c['application'][_0xef40('0x33')]()==_0xef40('0x34')&&_[_0xef40('0x35')](_0x5bd50c[_0xef40('0x36')][_0xef40('0x33')](),_0xef40('0x37'))){var _0x4bb0b7=_0x5bd50c[_0xef40('0x36')]['split']('=');var _0x59b545=_0x4bb0b7[0x0][_0xef40('0x38')](_0x4bb0b7[0x0]['lastIndexOf']('(')+0x1,_0x4bb0b7[0x0]['lastIndexOf'](')'));var _0x4913bb=_0x4bb0b7[0x1];recordings[_0x5bd50c[_0xef40('0x3')]][_0x59b545]=_0x4913bb;}}}catch(_0x3bc299){utils[_0xef40('0x12')](util[_0xef40('0xb')](_0xef40('0x31'),_0x5bd50c[_0xef40('0x3')]),_0x3bc299);}};exports[_0xef40('0x39')]=function(_0x115d6a){try{if(!_[_0xef40('0x15')](recordings[_0x115d6a['uniqueid']])){utils['debug'](util[_0xef40('0xb')](_0xef40('0x3a'),_0x115d6a[_0xef40('0x3')]),_0x115d6a);utils['info'](util[_0xef40('0xb')](_0xef40('0x3b'),_0x115d6a['uniqueid'],_0x115d6a[_0xef40('0x3c')]));recordings[_0x115d6a[_0xef40('0x3')]][_0xef40('0x3c')]=_0x115d6a[_0xef40('0x3c')];}}catch(_0x4a6667){utils[_0xef40('0x12')](util[_0xef40('0xb')](_0xef40('0x3a'),_0x115d6a[_0xef40('0x3')]),_0x4a6667);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 2233419..6c8c147 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 _0x60c5=['CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetlinkedid','error','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x60c5,0xe7));var _0x560c=function(_0x1fd6b7,_0x4994b8){_0x1fd6b7=_0x1fd6b7-0x0;var _0x11fa5f=_0x60c5[_0x1fd6b7];return _0x11fa5f;};'use strict';var _=require(_0x560c('0x0'));var util=require('util');var utils=require(_0x560c('0x1'));function writeDB(_0x5b5a18){utils[_0x560c('0x2')](util[_0x560c('0x3')](_0x560c('0x4'),_0x5b5a18[_0x560c('0x5')]===_0x560c('0x6')?_0x5b5a18[_0x560c('0x7')]:_0x5b5a18['uniqueid'],_0x5b5a18[_0x560c('0x5')]));utils[_0x560c('0x8')](_0x560c('0x9'),_0x5b5a18);}exports[_0x560c('0xa')]={};exports[_0x560c('0xb')]=function(_0x3be987){try{utils[_0x560c('0xc')](util[_0x560c('0x3')](_0x560c('0xd'),_0x3be987[_0x560c('0xe')]),_0x3be987);utils[_0x560c('0x2')](util['format'](_0x560c('0xf'),_0x3be987[_0x560c('0xe')],_0x3be987['transferercalleridnum'],_0x3be987[_0x560c('0x10')],_0x3be987[_0x560c('0x11')],_0x3be987[_0x560c('0x12')]));_0x3be987[_0x560c('0x5')]=_0x560c('0x13');exports[_0x560c('0xa')][_0x3be987[_0x560c('0x14')]]=_0x3be987;writeDB(_0x3be987);}catch(_0x4166af){utils['error'](util[_0x560c('0x3')]('[%s][transfers][blindtransfer]',_0x3be987['uniqueid']),_0x4166af);}};exports[_0x560c('0x15')]=function(_0xb60931){try{utils[_0x560c('0xc')](util[_0x560c('0x3')](_0x560c('0x16'),_0xb60931[_0x560c('0x7')]),_0xb60931);utils['info'](util[_0x560c('0x3')](_0x560c('0x17'),_0xb60931['origtransfereruniqueid'],_0xb60931['origtransferercalleridnum'],_0xb60931[_0x560c('0x18')],_0xb60931['transfertargetcalleridnum'],_0xb60931[_0x560c('0x19')]));_0xb60931=_[_0x560c('0x1a')](_0xb60931,{'transfererchannel':_0xb60931[_0x560c('0x1b')],'transferercalleridnum':_0xb60931[_0x560c('0x1c')],'transferercalleridname':_0xb60931[_0x560c('0x18')],'transfererconnectedlinenum':_0xb60931['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0xb60931['secondtransfererconnectedlinename'],'transfereraccountcode':_0xb60931[_0x560c('0x1d')],'transferercontext':_0xb60931[_0x560c('0x1e')],'transfererexten':_0xb60931[_0x560c('0x1f')],'transfererlinkedid':_0xb60931[_0x560c('0x20')],'context':_0xb60931['origtransferercontext'],'extension':_0xb60931[_0x560c('0x21')],'type':_0x560c('0x6')});if(_['isNil'](_0xb60931[_0x560c('0x22')])){_0xb60931=_[_0x560c('0x1a')](_0xb60931,{'transfereechannel':_0xb60931[_0x560c('0x23')],'transfereecalleridnum':_0xb60931[_0x560c('0x24')],'transfereecalleridname':_0xb60931[_0x560c('0x19')],'transfereeconnectedlinenum':_0xb60931[_0x560c('0x25')],'transfereeconnectedlinename':_0xb60931['transfertargetconnectedlinename'],'transfereeaccountcode':_0xb60931['transfertargetaccountcode'],'transfereecontext':_0xb60931['transfertargetcontext'],'transfereeexten':_0xb60931['transfertargetexten'],'transfereelinkedid':_0xb60931[_0x560c('0x26')]});}writeDB(_0xb60931);}catch(_0x198c5d){utils[_0x560c('0x27')](util[_0x560c('0x3')](_0x560c('0x16'),_0xb60931['origtransfereruniqueid']),_0x198c5d);}}; \ No newline at end of file +var _0x2f28=['origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','[%s][transfers][blindtransfer]','debug','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','secondtransferercontext'];(function(_0x32eb19,_0x46611a){var _0x49f2d9=function(_0x3429c3){while(--_0x3429c3){_0x32eb19['push'](_0x32eb19['shift']());}};_0x49f2d9(++_0x46611a);}(_0x2f28,0x1cd));var _0x82f2=function(_0xe591a7,_0x25c84d){_0xe591a7=_0xe591a7-0x0;var _0x3f0a72=_0x2f28[_0xe591a7];return _0x3f0a72;};'use strict';var _=require(_0x82f2('0x0'));var util=require(_0x82f2('0x1'));var utils=require(_0x82f2('0x2'));function writeDB(_0x4c5b5d){utils[_0x82f2('0x3')](util[_0x82f2('0x4')](_0x82f2('0x5'),_0x4c5b5d[_0x82f2('0x6')]==='attended'?_0x4c5b5d[_0x82f2('0x7')]:_0x4c5b5d[_0x82f2('0x8')],_0x4c5b5d[_0x82f2('0x6')]));utils[_0x82f2('0x9')](_0x82f2('0xa'),_0x4c5b5d);}exports[_0x82f2('0xb')]={};exports[_0x82f2('0xc')]=function(_0x4e4d89){try{utils['debug'](util['format']('[%s][transfers][blindtransfer]',_0x4e4d89['uniqueid']),_0x4e4d89);utils['info'](util[_0x82f2('0x4')](_0x82f2('0xd'),_0x4e4d89[_0x82f2('0x8')],_0x4e4d89[_0x82f2('0xe')],_0x4e4d89[_0x82f2('0xf')],_0x4e4d89[_0x82f2('0x10')],_0x4e4d89[_0x82f2('0x11')]));_0x4e4d89[_0x82f2('0x6')]=_0x82f2('0x12');exports['blinds'][_0x4e4d89[_0x82f2('0x13')]]=_0x4e4d89;writeDB(_0x4e4d89);}catch(_0x5c356e){utils[_0x82f2('0x14')](util[_0x82f2('0x4')](_0x82f2('0x15'),_0x4e4d89[_0x82f2('0x8')]),_0x5c356e);}};exports['attendedtransfer']=function(_0x1bea19){try{utils[_0x82f2('0x16')](util[_0x82f2('0x4')]('[%s][transfers][attendedtransfer]',_0x1bea19[_0x82f2('0x7')]),_0x1bea19);utils[_0x82f2('0x3')](util['format'](_0x82f2('0x17'),_0x1bea19[_0x82f2('0x7')],_0x1bea19[_0x82f2('0x18')],_0x1bea19[_0x82f2('0x19')],_0x1bea19['transfertargetcalleridnum'],_0x1bea19[_0x82f2('0x1a')]));_0x1bea19=_[_0x82f2('0x1b')](_0x1bea19,{'transfererchannel':_0x1bea19[_0x82f2('0x1c')],'transferercalleridnum':_0x1bea19[_0x82f2('0x18')],'transferercalleridname':_0x1bea19[_0x82f2('0x19')],'transfererconnectedlinenum':_0x1bea19['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1bea19[_0x82f2('0x1d')],'transfereraccountcode':_0x1bea19['origtransfereraccountcode'],'transferercontext':_0x1bea19[_0x82f2('0x1e')],'transfererexten':_0x1bea19['secondtransfererexten'],'transfererlinkedid':_0x1bea19[_0x82f2('0x1f')],'context':_0x1bea19[_0x82f2('0x20')],'extension':_0x1bea19[_0x82f2('0x21')],'type':_0x82f2('0x22')});if(_['isNil'](_0x1bea19[_0x82f2('0x23')])){_0x1bea19=_['assign'](_0x1bea19,{'transfereechannel':_0x1bea19[_0x82f2('0x24')],'transfereecalleridnum':_0x1bea19['transfertargetcalleridnum'],'transfereecalleridname':_0x1bea19['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x1bea19[_0x82f2('0x25')],'transfereeconnectedlinename':_0x1bea19[_0x82f2('0x26')],'transfereeaccountcode':_0x1bea19['transfertargetaccountcode'],'transfereecontext':_0x1bea19['transfertargetcontext'],'transfereeexten':_0x1bea19['transfertargetexten'],'transfereelinkedid':_0x1bea19[_0x82f2('0x27')]});}writeDB(_0x1bea19);}catch(_0x121548){utils[_0x82f2('0x14')](util[_0x82f2('0x4')](_0x82f2('0x28'),_0x1bea19[_0x82f2('0x7')]),_0x121548);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index c8988c6..55cac8f 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 _0xcf30=['internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','info','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','catch','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','found','[utils][getUserByName]','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','seconds','format','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','http','../../config/logger','debug','inspect','error','request','then','[utils][request]\x20name:%s'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xcf30,0x128));var _0x0cf3=function(_0x1df013,_0x1aa443){_0x1df013=_0x1df013-0x0;var _0x412ace=_0xcf30[_0x1df013];return _0x412ace;};'use strict';var BPromise=require(_0x0cf3('0x0'));var jayson=require(_0x0cf3('0x1'));var moment=require(_0x0cf3('0x2'));var util=require(_0x0cf3('0x3'));var client=jayson['client'][_0x0cf3('0x4')]({'port':0x2329});var logger=require(_0x0cf3('0x5'))('xdr');exports['info']=function(_0x5be27c,_0x238cb6){logger['info'](_0x5be27c,_0x238cb6?util['inspect'](_0x238cb6,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x126c36,_0x3e41ed){logger[_0x0cf3('0x6')](_0x126c36,_0x3e41ed?util[_0x0cf3('0x7')](_0x3e41ed,{'showHidden':![],'depth':null}):'');};exports[_0x0cf3('0x8')]=function(_0x47d53b,_0x2565bb){logger['error'](_0x47d53b,_0x2565bb?util[_0x0cf3('0x7')](_0x2565bb,{'showHidden':![],'depth':null}):'');};exports[_0x0cf3('0x9')]=function(_0x18b2d1,_0x1793a4){return client[_0x0cf3('0x9')](_0x18b2d1,{'body':_0x1793a4})[_0x0cf3('0xa')](function(_0x28e07f){logger[_0x0cf3('0x6')]('[utils][request]\x20name:%s',_0x18b2d1,_0x28e07f?util[_0x0cf3('0x7')](_0x28e07f,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x50df01){logger['error'](_0x0cf3('0xb'),_0x18b2d1,_0x50df01?util[_0x0cf3('0x7')](_0x50df01,{'showHidden':![],'depth':null}):'');});};function getUser(_0x528e19){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id',_0x0cf3('0xc'),_0x0cf3('0xd'),_0x0cf3('0xe')],'where':_0x528e19,'limit':0x1}})[_0x0cf3('0xa')](function(_0x41d672){logger['debug'](_0x0cf3('0xf'),JSON[_0x0cf3('0x10')](_0x528e19),_0x41d672?util['inspect'](_0x41d672,{'showHidden':![],'depth':null}):'');return _0x41d672[_0x0cf3('0x11')][_0x0cf3('0x12')]?_0x41d672[_0x0cf3('0x11')][0x0]:null;});}exports[_0x0cf3('0x13')]=function(_0xa78c05){return new BPromise(function(_0x2ab930,_0x3f9b97){if(_0xa78c05){return getUser({'internal':_0xa78c05})[_0x0cf3('0xa')](function(_0x52eef8){logger[_0x0cf3('0x14')](_0x0cf3('0x15'),_0xa78c05,_0x52eef8?'found':_0x0cf3('0x16'));return _0x2ab930(_0x52eef8);})[_0x0cf3('0x17')](function(_0xa81872){logger[_0x0cf3('0x8')](_0x0cf3('0x18'),_0xa81872?util['inspect'](_0xa81872,{'showHidden':![],'depth':null}):'');return _0x2ab930(null);});}return _0x2ab930(null);});};exports[_0x0cf3('0x19')]=function(_0x5cf070){return new BPromise(function(_0x444fc1,_0x46cec4){if(_0x5cf070){return getUser({'interface':_0x5cf070})[_0x0cf3('0xa')](function(_0x5ed4ba){logger[_0x0cf3('0x14')](_0x0cf3('0x1a'),_0x5cf070,_0x5ed4ba?'found':_0x0cf3('0x16'));return _0x444fc1(_0x5ed4ba);})['catch'](function(_0x45ae4f){logger['error'](_0x0cf3('0x1b'),_0x45ae4f?util[_0x0cf3('0x7')](_0x45ae4f,{'showHidden':![],'depth':null}):'');return _0x444fc1(null);});}return _0x444fc1(null);});};exports['getUserByName']=function(_0x358eff){return new BPromise(function(_0x3205c0,_0x57dc10){if(_0x358eff){return getUser({'name':_0x358eff})[_0x0cf3('0xa')](function(_0x6e0ca3){logger['info']('[utils][getUserByName]\x20name:%s\x20%s',_0x358eff,_0x6e0ca3?_0x0cf3('0x1c'):_0x0cf3('0x16'));return _0x3205c0(_0x6e0ca3);})[_0x0cf3('0x17')](function(_0x319336){logger['error'](_0x0cf3('0x1d'),_0x319336?util[_0x0cf3('0x7')](_0x319336,{'showHidden':![],'depth':null}):'');return _0x3205c0(null);});}return _0x3205c0(null);});};exports['getVoiceQueueByName']=function(_0x1a1e94){return new BPromise(function(_0x19f1cf,_0x4b78a0){if(_0x1a1e94){return client[_0x0cf3('0x9')](_0x0cf3('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x0cf3('0xd'),_0x0cf3('0x1f'),_0x0cf3('0x20'),_0x0cf3('0x21')],'where':{'name':_0x1a1e94},'limit':0x1}})['then'](function(_0x3a7af0){logger[_0x0cf3('0x6')](_0x0cf3('0x22'),_0x1a1e94,_0x3a7af0?util[_0x0cf3('0x7')](_0x3a7af0,{'showHidden':![],'depth':null}):'');logger['info'](_0x0cf3('0x23'),_0x1a1e94,_0x3a7af0?_0x0cf3('0x1c'):_0x0cf3('0x16'));return _0x19f1cf(_0x3a7af0[_0x0cf3('0x11')][_0x0cf3('0x12')]?_0x3a7af0[_0x0cf3('0x11')][0x0]:null);})[_0x0cf3('0x17')](function(_0x14f58d){logger['error'](_0x0cf3('0x24'),_0x14f58d?util[_0x0cf3('0x7')](_0x14f58d,{'showHidden':![],'depth':null}):'');return _0x19f1cf(null);});}return _0x19f1cf(null);});};exports['addTime']=function(_0x43320b,_0x15a460){return moment(_0x43320b)['add'](_0x15a460,_0x0cf3('0x25'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x54f89e,_0x39cd89){return moment(_0x54f89e)['subtract'](_0x39cd89,'seconds')[_0x0cf3('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x33a4cf,_0x280630){return moment(_0x33a4cf)[_0x0cf3('0x27')](moment(_0x280630),_0x0cf3('0x25'));};exports[_0x0cf3('0x28')]=function(_0x4bdb13,_0x5d8804){return parseInt(_0x4bdb13,0xa)+parseInt(_0x5d8804,0xa);};exports[_0x0cf3('0x29')]=function(){return moment()[_0x0cf3('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x0cf3('0x2a')]=function(_0x4a3a97,_0x97b4c0){if(_0x97b4c0){return moment(_0x4a3a97)['isAfter'](_0x97b4c0);}return!![];};exports[_0x0cf3('0x2b')]=function(_0x3e3b2c,_0x5971e0){if(_0x5971e0){return moment(_0x3e3b2c)[_0x0cf3('0x2b')](_0x5971e0);}else if(_0x3e3b2c){return!![];}return![];}; \ No newline at end of file +var _0xc3d5=['debug','[utils][getUser]\x20where:%s','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','name','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','../../config/logger','xdr','info','request','then','catch','error','[utils][request]\x20name:%s','inspect','interface'];(function(_0x2b5a41,_0x5ac813){var _0x50f282=function(_0x5e8d34){while(--_0x5e8d34){_0x2b5a41['push'](_0x2b5a41['shift']());}};_0x50f282(++_0x5ac813);}(_0xc3d5,0x16f));var _0x5c3d=function(_0x443bb2,_0x27cfaf){_0x443bb2=_0x443bb2-0x0;var _0x39d037=_0xc3d5[_0x443bb2];return _0x39d037;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x5c3d('0x0'));var moment=require('moment');var util=require('util');var client=jayson['client']['http']({'port':0x2329});var logger=require(_0x5c3d('0x1'))(_0x5c3d('0x2'));exports['info']=function(_0x25d40b,_0x18e693){logger[_0x5c3d('0x3')](_0x25d40b,_0x18e693?util['inspect'](_0x18e693,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x2e6688,_0xb19bc6){logger['debug'](_0x2e6688,_0xb19bc6?util['inspect'](_0xb19bc6,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0xeb27d5,_0x447a6b){logger['error'](_0xeb27d5,_0x447a6b?util['inspect'](_0x447a6b,{'showHidden':![],'depth':null}):'');};exports[_0x5c3d('0x4')]=function(_0x5a2064,_0x2ada72){return client[_0x5c3d('0x4')](_0x5a2064,{'body':_0x2ada72})[_0x5c3d('0x5')](function(_0x32db0d){logger['debug']('[utils][request]\x20name:%s',_0x5a2064,_0x32db0d?util['inspect'](_0x32db0d,{'showHidden':![],'depth':null}):'');})[_0x5c3d('0x6')](function(_0x5478db){logger[_0x5c3d('0x7')](_0x5c3d('0x8'),_0x5a2064,_0x5478db?util[_0x5c3d('0x9')](_0x5478db,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3277db){return client[_0x5c3d('0x4')]('GetUser',{'options':{'raw':!![],'attributes':['id','internal','name',_0x5c3d('0xa')],'where':_0x3277db,'limit':0x1}})[_0x5c3d('0x5')](function(_0x54b07e){logger[_0x5c3d('0xb')](_0x5c3d('0xc'),JSON[_0x5c3d('0xd')](_0x3277db),_0x54b07e?util[_0x5c3d('0x9')](_0x54b07e,{'showHidden':![],'depth':null}):'');return _0x54b07e[_0x5c3d('0xe')][_0x5c3d('0xf')]?_0x54b07e['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x1080e4){return new BPromise(function(_0xc3cf04,_0x40e6cb){if(_0x1080e4){return getUser({'internal':_0x1080e4})[_0x5c3d('0x5')](function(_0x45a2e0){logger[_0x5c3d('0x3')](_0x5c3d('0x10'),_0x1080e4,_0x45a2e0?_0x5c3d('0x11'):_0x5c3d('0x12'));return _0xc3cf04(_0x45a2e0);})[_0x5c3d('0x6')](function(_0x8d7626){logger[_0x5c3d('0x7')]('[utils][getUserByInternal]',_0x8d7626?util[_0x5c3d('0x9')](_0x8d7626,{'showHidden':![],'depth':null}):'');return _0xc3cf04(null);});}return _0xc3cf04(null);});};exports[_0x5c3d('0x13')]=function(_0x5bee7d){return new BPromise(function(_0x5af9ea,_0x296899){if(_0x5bee7d){return getUser({'interface':_0x5bee7d})[_0x5c3d('0x5')](function(_0x4b98e5){logger[_0x5c3d('0x3')](_0x5c3d('0x14'),_0x5bee7d,_0x4b98e5?_0x5c3d('0x11'):_0x5c3d('0x12'));return _0x5af9ea(_0x4b98e5);})[_0x5c3d('0x6')](function(_0x4e9f2f){logger[_0x5c3d('0x7')](_0x5c3d('0x15'),_0x4e9f2f?util[_0x5c3d('0x9')](_0x4e9f2f,{'showHidden':![],'depth':null}):'');return _0x5af9ea(null);});}return _0x5af9ea(null);});};exports['getUserByName']=function(_0x4f731c){return new BPromise(function(_0xbebc5d,_0x3b50c2){if(_0x4f731c){return getUser({'name':_0x4f731c})['then'](function(_0x456b81){logger[_0x5c3d('0x3')](_0x5c3d('0x16'),_0x4f731c,_0x456b81?_0x5c3d('0x11'):'notfound');return _0xbebc5d(_0x456b81);})[_0x5c3d('0x6')](function(_0x2a0be9){logger[_0x5c3d('0x7')](_0x5c3d('0x17'),_0x2a0be9?util[_0x5c3d('0x9')](_0x2a0be9,{'showHidden':![],'depth':null}):'');return _0xbebc5d(null);});}return _0xbebc5d(null);});};exports['getVoiceQueueByName']=function(_0x29b430){return new BPromise(function(_0x554295,_0x54afc8){if(_0x29b430){return client[_0x5c3d('0x4')](_0x5c3d('0x18'),{'options':{'raw':!![],'attributes':['id',_0x5c3d('0x19'),'type',_0x5c3d('0x1a'),'acwTimeout'],'where':{'name':_0x29b430},'limit':0x1}})[_0x5c3d('0x5')](function(_0x4996a){logger[_0x5c3d('0xb')](_0x5c3d('0x1b'),_0x29b430,_0x4996a?util[_0x5c3d('0x9')](_0x4996a,{'showHidden':![],'depth':null}):'');logger[_0x5c3d('0x3')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x29b430,_0x4996a?_0x5c3d('0x11'):_0x5c3d('0x12'));return _0x554295(_0x4996a[_0x5c3d('0xe')][_0x5c3d('0xf')]?_0x4996a['result'][0x0]:null);})[_0x5c3d('0x6')](function(_0x6069c5){logger[_0x5c3d('0x7')](_0x5c3d('0x1c'),_0x6069c5?util[_0x5c3d('0x9')](_0x6069c5,{'showHidden':![],'depth':null}):'');return _0x554295(null);});}return _0x554295(null);});};exports[_0x5c3d('0x1d')]=function(_0x24d950,_0x2d1fad){return moment(_0x24d950)[_0x5c3d('0x1e')](_0x2d1fad,_0x5c3d('0x1f'))[_0x5c3d('0x20')](_0x5c3d('0x21'));};exports[_0x5c3d('0x22')]=function(_0x347215,_0x5ad51d){return moment(_0x347215)[_0x5c3d('0x23')](_0x5ad51d,_0x5c3d('0x1f'))[_0x5c3d('0x20')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x5c3d('0x24')]=function(_0xf40319,_0x3bc544){return moment(_0xf40319)[_0x5c3d('0x25')](moment(_0x3bc544),_0x5c3d('0x1f'));};exports[_0x5c3d('0x26')]=function(_0x52f557,_0x4257e2){return parseInt(_0x52f557,0xa)+parseInt(_0x4257e2,0xa);};exports[_0x5c3d('0x27')]=function(){return moment()[_0x5c3d('0x20')](_0x5c3d('0x21'));};exports[_0x5c3d('0x28')]=function(_0x302331,_0x28e4bf){if(_0x28e4bf){return moment(_0x302331)[_0x5c3d('0x28')](_0x28e4bf);}return!![];};exports[_0x5c3d('0x29')]=function(_0xc8a706,_0x554af1){if(_0x554af1){return moment(_0xc8a706)['isBefore'](_0x554af1);}else if(_0xc8a706){return!![];}return![];}; \ No newline at end of file -- 1.7.1